From: Andrea Bianco Date: Tue, 11 Jan 2022 11:43:48 +0000 (+0100) Subject: Built motion from commit fda31434.|2.5.44 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=2e31c218a901103f37844aa0b6300187da81ec56;p=motion2.git Built motion from commit fda31434.|2.5.44 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8a4667d..d070563 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-10T17:27:50.727Z", + "time": "2022-01-11T11:34:17.811Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a653553..a8f21a4 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-10T17:27:50.727Z", + "time": "2022-01-11T11:34:17.811Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index a1cbd46..563c479 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 _0x9534=['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[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x30eecf,_0x30cfdb){var _0x10bb61=function(_0x35b4fc){while(--_0x35b4fc){_0x30eecf['push'](_0x30eecf['shift']());}};_0x10bb61(++_0x30cfdb);}(_0x9534,0xc6));var _0x4953=function(_0x152c9a,_0x15db16){_0x152c9a=_0x152c9a-0x0;var _0x43a214=_0x9534[_0x152c9a];return _0x43a214;};'use strict';var Sequelize=require(_0x4953('0x0'));module[_0x4953('0x1')]={'name':{'type':Sequelize[_0x4953('0x2')],'get':function(_0x401bb5){return this['getDataValue'](_0x4953('0x3'));}},'action':{'type':Sequelize[_0x4953('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4953('0x5'),_0x4953('0x6'),'motionbar','jscripty',_0x4953('0x7'),'browser',_0x4953('0x8'),'script']],'msg':_0x4953('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x4953('0x4')](0x1000),'comment':_0x4953('0xa')},'data2':{'type':Sequelize[_0x4953('0x4')](0x1000),'comment':_0x4953('0xb')},'data3':{'type':Sequelize[_0x4953('0x4')](0x1000),'comment':_0x4953('0xc')},'data4':{'type':Sequelize[_0x4953('0x4')](0x1000),'comments':_0x4953('0xd')},'data5':{'type':Sequelize[_0x4953('0x4')](0x1000),'comments':_0x4953('0xe')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x4953('0xf')}}; \ No newline at end of file +var _0xc86f=['getDataValue','action','STRING','contactManager','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','sequelize','exports'];(function(_0x1f3244,_0x23cd4f){var _0x14c9c0=function(_0x2b87b2){while(--_0x2b87b2){_0x1f3244['push'](_0x1f3244['shift']());}};_0x14c9c0(++_0x23cd4f);}(_0xc86f,0xce));var _0xfc86=function(_0x59dfec,_0x2409e7){_0x59dfec=_0x59dfec-0x0;var _0x1e194a=_0xc86f[_0x59dfec];return _0x1e194a;};'use strict';var Sequelize=require(_0xfc86('0x0'));module[_0xfc86('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3fbf8e){return this[_0xfc86('0x2')](_0xfc86('0x3'));}},'action':{'type':Sequelize[_0xfc86('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xfc86('0x5'),_0xfc86('0x6'),_0xfc86('0x7'),'jscripty',_0xfc86('0x8'),_0xfc86('0x9'),_0xfc86('0xa'),_0xfc86('0xb')]],'msg':_0xfc86('0xc')}},'comment':_0xfc86('0xc')},'data1':{'type':Sequelize[_0xfc86('0x4')](0x1000),'comment':_0xfc86('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xfc86('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xfc86('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xfc86('0x4')](0x1000),'comments':_0xfc86('0xf')},'data6':{'type':Sequelize[_0xfc86('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 48629d1..e62eb06 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 _0xde9e=['find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','body','Action'];(function(_0x3f5522,_0x28e324){var _0x4731f1=function(_0xfe154){while(--_0xfe154){_0x3f5522['push'](_0x3f5522['shift']());}};_0x4731f1(++_0x28e324);}(_0xde9e,0x18b));var _0xede9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde9e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xede9('0x0'));var rimraf=require(_0xede9('0x1'));var zipdir=require(_0xede9('0x2'));var jsonpatch=require(_0xede9('0x3'));var rp=require(_0xede9('0x4'));var moment=require(_0xede9('0x5'));var BPromise=require(_0xede9('0x6'));var Mustache=require(_0xede9('0x7'));var util=require(_0xede9('0x8'));var path=require(_0xede9('0x9'));var sox=require(_0xede9('0xa'));var csv=require(_0xede9('0xb'));var ejs=require(_0xede9('0xc'));var fs=require('fs');var fs_extra=require(_0xede9('0xd'));var _=require(_0xede9('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xede9('0xf'));var deskjs=require(_0xede9('0x10'));var toCsv=require(_0xede9('0xb'));var querystring=require(_0xede9('0x11'));var Papa=require(_0xede9('0x12'));var Redis=require(_0xede9('0x13'));var authService=require(_0xede9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xede9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xede9('0x16'));var utils=require(_0xede9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xede9('0x18'));var db=require(_0xede9('0x19'))['db'];function respondWithStatusCode(_0x5db679,_0x283d46){_0x283d46=_0x283d46||0xcc;return function(_0x4b8cba){if(_0x4b8cba){return _0x5db679[_0xede9('0x1a')](_0x283d46);}return _0x5db679[_0xede9('0x1b')](_0x283d46)[_0xede9('0x1c')]();};}function respondWithResult(_0x16b5ed,_0x1d9da7){_0x1d9da7=_0x1d9da7||0xc8;return function(_0x114074){if(_0x114074){return _0x16b5ed['status'](_0x1d9da7)[_0xede9('0x1d')](_0x114074);}};}function respondWithFilteredResult(_0x590ac4,_0x4aa27c){return function(_0x399796){if(_0x399796){var _0x20c9a6=typeof _0x4aa27c['offset']===_0xede9('0x1e')&&typeof _0x4aa27c[_0xede9('0x1f')]==='undefined';var _0x468f93=_0x399796['count'];var _0x46a785=_0x20c9a6?0x0:_0x4aa27c[_0xede9('0x20')];var _0x27e47e=_0x20c9a6?_0x399796[_0xede9('0x21')]:_0x4aa27c['offset']+_0x4aa27c[_0xede9('0x1f')];var _0x4c0181;if(_0x27e47e>=_0x468f93){_0x27e47e=_0x468f93;_0x4c0181=0xc8;}else{_0x4c0181=0xce;}_0x590ac4[_0xede9('0x1b')](_0x4c0181);return _0x590ac4[_0xede9('0x22')](_0xede9('0x23'),_0x46a785+'-'+_0x27e47e+'/'+_0x468f93)[_0xede9('0x1d')](_0x399796);}return null;};}function patchUpdates(_0x1ab444){return function(_0x8fc1ba){try{jsonpatch[_0xede9('0x24')](_0x8fc1ba,_0x1ab444,!![]);}catch(_0x39c878){return BPromise[_0xede9('0x25')](_0x39c878);}return _0x8fc1ba[_0xede9('0x26')]();};}function saveUpdates(_0x36f182,_0x2f333f){return function(_0x16e97){if(_0x16e97){return _0x16e97[_0xede9('0x27')](_0x36f182)[_0xede9('0x28')](function(_0x2f797a){return _0x2f797a;});}return null;};}function removeEntity(_0x3793d3,_0x3ecbf3){return function(_0x1e0692){if(_0x1e0692){return _0x1e0692[_0xede9('0x29')]()[_0xede9('0x28')](function(){_0x3793d3[_0xede9('0x1b')](0xcc)[_0xede9('0x1c')]();});}};}function handleEntityNotFound(_0x473dad,_0x3f2b76){return function(_0x4e3aba){if(!_0x4e3aba){_0x473dad[_0xede9('0x1a')](0x194);}return _0x4e3aba;};}function handleError(_0x742a22,_0x1c9117){_0x1c9117=_0x1c9117||0x1f4;return function(_0x1f9c4b){logger['error'](_0x1f9c4b['stack']);if(_0x1f9c4b[_0xede9('0x2a')]){delete _0x1f9c4b[_0xede9('0x2a')];}_0x742a22['status'](_0x1c9117)[_0xede9('0x2b')](_0x1f9c4b);};}exports[_0xede9('0x27')]=function(_0x482110,_0x5ebabe){if(_0x482110[_0xede9('0x2c')]['id']){delete _0x482110['body']['id'];}return db[_0xede9('0x2d')][_0xede9('0x2e')]({'where':{'id':_0x482110[_0xede9('0x2f')]['id']}})[_0xede9('0x28')](handleEntityNotFound(_0x5ebabe,null))[_0xede9('0x28')](saveUpdates(_0x482110[_0xede9('0x2c')],null))[_0xede9('0x28')](respondWithResult(_0x5ebabe,null))[_0xede9('0x30')](handleError(_0x5ebabe,null));};exports['destroy']=function(_0x553580,_0x2485e2){return db[_0xede9('0x2d')]['find']({'where':{'id':_0x553580[_0xede9('0x2f')]['id']}})[_0xede9('0x28')](handleEntityNotFound(_0x2485e2,null))[_0xede9('0x28')](removeEntity(_0x2485e2,null))[_0xede9('0x30')](handleError(_0x2485e2,null));}; \ No newline at end of file +var _0x68d1=['update','body','Action','find','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','save','then','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x68d1,0x9a));var _0x168d=function(_0x4046f7,_0x3e6ba7){_0x4046f7=_0x4046f7-0x0;var _0x584402=_0x68d1[_0x4046f7];return _0x584402;};'use strict';var emlformat=require(_0x168d('0x0'));var rimraf=require(_0x168d('0x1'));var zipdir=require(_0x168d('0x2'));var jsonpatch=require(_0x168d('0x3'));var rp=require(_0x168d('0x4'));var moment=require(_0x168d('0x5'));var BPromise=require(_0x168d('0x6'));var Mustache=require('mustache');var util=require(_0x168d('0x7'));var path=require(_0x168d('0x8'));var sox=require(_0x168d('0x9'));var csv=require('to-csv');var ejs=require(_0x168d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x168d('0xb'));var squel=require(_0x168d('0xc'));var crypto=require('crypto');var jsforce=require(_0x168d('0xd'));var deskjs=require(_0x168d('0xe'));var toCsv=require(_0x168d('0xf'));var querystring=require(_0x168d('0x10'));var Papa=require(_0x168d('0x11'));var Redis=require('ioredis');var authService=require(_0x168d('0x12'));var qs=require(_0x168d('0x13'));var as=require(_0x168d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x168d('0x15'))(_0x168d('0x16'));var utils=require('../../config/utils');var config=require(_0x168d('0x17'));var licenseUtil=require(_0x168d('0x18'));var db=require(_0x168d('0x19'))['db'];function respondWithStatusCode(_0x155481,_0x1b4cb8){_0x1b4cb8=_0x1b4cb8||0xcc;return function(_0x188a62){if(_0x188a62){return _0x155481[_0x168d('0x1a')](_0x1b4cb8);}return _0x155481[_0x168d('0x1b')](_0x1b4cb8)[_0x168d('0x1c')]();};}function respondWithResult(_0x13ed0b,_0x3d6600){_0x3d6600=_0x3d6600||0xc8;return function(_0x31f2c0){if(_0x31f2c0){return _0x13ed0b[_0x168d('0x1b')](_0x3d6600)[_0x168d('0x1d')](_0x31f2c0);}};}function respondWithFilteredResult(_0x4d3f88,_0x513fb9){return function(_0x3f3702){if(_0x3f3702){var _0x35656f=typeof _0x513fb9['offset']===_0x168d('0x1e')&&typeof _0x513fb9['limit']===_0x168d('0x1e');var _0x41ceab=_0x3f3702[_0x168d('0x1f')];var _0x5476cf=_0x35656f?0x0:_0x513fb9['offset'];var _0x338829=_0x35656f?_0x3f3702[_0x168d('0x1f')]:_0x513fb9['offset']+_0x513fb9[_0x168d('0x20')];var _0x53ca4d;if(_0x338829>=_0x41ceab){_0x338829=_0x41ceab;_0x53ca4d=0xc8;}else{_0x53ca4d=0xce;}_0x4d3f88[_0x168d('0x1b')](_0x53ca4d);return _0x4d3f88[_0x168d('0x21')](_0x168d('0x22'),_0x5476cf+'-'+_0x338829+'/'+_0x41ceab)[_0x168d('0x1d')](_0x3f3702);}return null;};}function patchUpdates(_0xf98a70){return function(_0x274e25){try{jsonpatch[_0x168d('0x23')](_0x274e25,_0xf98a70,!![]);}catch(_0x2c340e){return BPromise[_0x168d('0x24')](_0x2c340e);}return _0x274e25[_0x168d('0x25')]();};}function saveUpdates(_0x3d3ef3,_0x514a09){return function(_0x491b2a){if(_0x491b2a){return _0x491b2a['update'](_0x3d3ef3)[_0x168d('0x26')](function(_0x3b1fa4){return _0x3b1fa4;});}return null;};}function removeEntity(_0x136bea,_0x1c2ff4){return function(_0x3a6b5a){if(_0x3a6b5a){return _0x3a6b5a['destroy']()['then'](function(){_0x136bea[_0x168d('0x1b')](0xcc)[_0x168d('0x1c')]();});}};}function handleEntityNotFound(_0x1e1477,_0x4a716f){return function(_0x2422bb){if(!_0x2422bb){_0x1e1477[_0x168d('0x1a')](0x194);}return _0x2422bb;};}function handleError(_0x2d3350,_0xf5f239){_0xf5f239=_0xf5f239||0x1f4;return function(_0x345c72){logger['error'](_0x345c72[_0x168d('0x27')]);if(_0x345c72['name']){delete _0x345c72[_0x168d('0x28')];}_0x2d3350[_0x168d('0x1b')](_0xf5f239)[_0x168d('0x29')](_0x345c72);};}exports[_0x168d('0x2a')]=function(_0x556af5,_0x38ee30){if(_0x556af5[_0x168d('0x2b')]['id']){delete _0x556af5[_0x168d('0x2b')]['id'];}return db[_0x168d('0x2c')][_0x168d('0x2d')]({'where':{'id':_0x556af5[_0x168d('0x2e')]['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x38ee30,null))['then'](saveUpdates(_0x556af5[_0x168d('0x2b')],null))['then'](respondWithResult(_0x38ee30,null))[_0x168d('0x2f')](handleError(_0x38ee30,null));};exports[_0x168d('0x30')]=function(_0x3a8899,_0x5a349a){return db['Action'][_0x168d('0x2d')]({'where':{'id':_0x3a8899[_0x168d('0x2e')]['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x5a349a,null))['then'](removeEntity(_0x5a349a,null))['catch'](handleError(_0x5a349a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 22a246e..3ee96a5 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 _0xe23a=['../../config/environment','./action.attributes','exports','define','Action','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x26a490,_0x1d54cf){var _0x4f14c1=function(_0x47922f){while(--_0x47922f){_0x26a490['push'](_0x26a490['shift']());}};_0x4f14c1(++_0x1d54cf);}(_0xe23a,0x165));var _0xae23=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xe23a[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0xae23('0x0'));var util=require(_0xae23('0x1'));var logger=require(_0xae23('0x2'))(_0xae23('0x3'));var moment=require(_0xae23('0x4'));var BPromise=require('bluebird');var rp=require(_0xae23('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae23('0x6'));var attributes=require(_0xae23('0x7'));module[_0xae23('0x8')]=function(_0x2a6b82,_0x8a5ecf){return _0x2a6b82[_0xae23('0x9')](_0xae23('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10d0=['path','rimraf','../../config/environment','exports','Action','tools_actions','lodash','util','api','bluebird'];(function(_0x23b5b6,_0x88ba37){var _0x20392d=function(_0x1c0398){while(--_0x1c0398){_0x23b5b6['push'](_0x23b5b6['shift']());}};_0x20392d(++_0x88ba37);}(_0x10d0,0x13c));var _0x010d=function(_0x13fc10,_0x35a13c){_0x13fc10=_0x13fc10-0x0;var _0x211d0d=_0x10d0[_0x13fc10];return _0x211d0d;};'use strict';var _=require(_0x010d('0x0'));var util=require(_0x010d('0x1'));var logger=require('../../config/logger')(_0x010d('0x2'));var moment=require('moment');var BPromise=require(_0x010d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x010d('0x4'));var rimraf=require(_0x010d('0x5'));var config=require(_0x010d('0x6'));var attributes=require('./action.attributes');module[_0x010d('0x7')]=function(_0x17a8f6,_0x4335fc){return _0x17a8f6['define'](_0x010d('0x8'),attributes,{'tableName':_0x010d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 332fd58..fd2ee3b 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x7217,0x19e));var _0x7721=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7217[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x4975,0x86));var _0x5497=function(_0xfe1276,_0x59fd1e){_0xfe1276=_0xfe1276-0x0;var _0x47d5ba=_0x4975[_0xfe1276];return _0x47d5ba;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 82c52b0..c834abc 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 _0xa955=['../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa955,0x15a));var _0x5a95=function(_0x2e1e32,_0x467539){_0x2e1e32=_0x2e1e32-0x0;var _0x5b7e9d=_0xa955[_0x2e1e32];return _0x5b7e9d;};'use strict';var multer=require(_0x5a95('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5a95('0x1'));var express=require(_0x5a95('0x2'));var router=express[_0x5a95('0x3')]();var fs_extra=require(_0x5a95('0x4'));var auth=require(_0x5a95('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5a95('0x6'));var controller=require('./action.controller');router[_0x5a95('0x7')](_0x5a95('0x8'),auth[_0x5a95('0x9')](),controller[_0x5a95('0xa')]);router[_0x5a95('0xb')](_0x5a95('0x8'),auth[_0x5a95('0x9')](),controller[_0x5a95('0xc')]);module['exports']=router; \ No newline at end of file +var _0x1366=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','./action.controller','put','/:id','isAuthenticated'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1366,0x1a4));var _0x6136=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1366[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x6136('0x0'));var util=require('util');var path=require(_0x6136('0x1'));var timeout=require(_0x6136('0x2'));var express=require(_0x6136('0x3'));var router=express[_0x6136('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(_0x6136('0x5'));router[_0x6136('0x6')](_0x6136('0x7'),auth[_0x6136('0x8')](),controller[_0x6136('0x9')]);router[_0x6136('0xa')](_0x6136('0x7'),auth[_0x6136('0x8')](),controller[_0x6136('0xb')]);module[_0x6136('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index f134f66..fa296c6 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 _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x14090e,_0x30c2f7){var _0x554da7=function(_0x165d16){while(--_0x165d16){_0x14090e['push'](_0x14090e['shift']());}};_0x554da7(++_0x30c2f7);}(_0x6aa7,0x178));var _0x76aa=function(_0x449f15,_0x315f99){_0x449f15=_0x449f15-0x0;var _0x1fb5f4=_0x6aa7[_0x449f15];return _0x1fb5f4;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x267095,_0xd6b820){var _0x2c31be=function(_0xed99a8){while(--_0xed99a8){_0x267095['push'](_0x267095['shift']());}};_0x2c31be(++_0xd6b820);}(_0x24ca,0x1bc));var _0xa24c=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x24ca[_0x48d6a3];return _0x38bfa0;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a53a4a9..92c12f7 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 _0xa1ab=['GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','sequelize','toString','QueryTypes','SELECT','SEC_TO_TIME(%s)','IS\x20NULL','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','web','fullPath','%s-%s.%s','generate','output','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','MIN(%s)','Limited\x20Query:','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)'];(function(_0x595284,_0x2b5c86){var _0x1e948f=function(_0x16c7ff){while(--_0x16c7ff){_0x595284['push'](_0x595284['shift']());}};_0x1e948f(++_0x2b5c86);}(_0xa1ab,0x1a1));var _0xba1a=function(_0x329dc8,_0x98b7cb){_0x329dc8=_0x329dc8-0x0;var _0x1a34c2=_0xa1ab[_0x329dc8];return _0x1a34c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba1a('0x0'));var zipdir=require(_0xba1a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba1a('0x2'));var BPromise=require(_0xba1a('0x3'));var Mustache=require(_0xba1a('0x4'));var util=require(_0xba1a('0x5'));var path=require(_0xba1a('0x6'));var sox=require(_0xba1a('0x7'));var csv=require('to-csv');var ejs=require(_0xba1a('0x8'));var fs=require('fs');var fs_extra=require(_0xba1a('0x9'));var _=require(_0xba1a('0xa'));var squel=require(_0xba1a('0xb'));var crypto=require(_0xba1a('0xc'));var jsforce=require(_0xba1a('0xd'));var deskjs=require(_0xba1a('0xe'));var toCsv=require(_0xba1a('0xf'));var querystring=require(_0xba1a('0x10'));var Papa=require(_0xba1a('0x11'));var Redis=require(_0xba1a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xba1a('0x13'));var as=require(_0xba1a('0x14'));var hardwareService=require(_0xba1a('0x15'));var logger=require(_0xba1a('0x16'))(_0xba1a('0x17'));var utils=require('../../config/utils');var config=require(_0xba1a('0x18'));var licenseUtil=require(_0xba1a('0x19'));var db=require(_0xba1a('0x1a'))['db'];var dbH=require(_0xba1a('0x1a'))[_0xba1a('0x1b')];function respondWithStatusCode(_0x2e086c,_0x428a3d){_0x428a3d=_0x428a3d||0xcc;return function(_0x160131){if(_0x160131){return _0x2e086c[_0xba1a('0x1c')](_0x428a3d);}return _0x2e086c[_0xba1a('0x1d')](_0x428a3d)['end']();};}function respondWithResult(_0x984dc1,_0x3a24b3){_0x3a24b3=_0x3a24b3||0xc8;return function(_0x32e884){if(_0x32e884){return _0x984dc1['status'](_0x3a24b3)['json'](_0x32e884);}};}function respondWithFilteredResult(_0x4ee554,_0xeda5){return function(_0x428c94){if(_0x428c94){var _0x1dd592=typeof _0xeda5[_0xba1a('0x1e')]===_0xba1a('0x1f')&&typeof _0xeda5[_0xba1a('0x20')]===_0xba1a('0x1f');var _0x1b91a3=_0x428c94[_0xba1a('0x21')];var _0x390ceb=_0x1dd592?0x0:_0xeda5[_0xba1a('0x1e')];var _0x142f72=_0x1dd592?_0x428c94[_0xba1a('0x21')]:_0xeda5[_0xba1a('0x1e')]+_0xeda5[_0xba1a('0x20')];var _0x1d2b1d;if(_0x142f72>=_0x1b91a3){_0x142f72=_0x1b91a3;_0x1d2b1d=0xc8;}else{_0x1d2b1d=0xce;}_0x4ee554[_0xba1a('0x1d')](_0x1d2b1d);return _0x4ee554[_0xba1a('0x22')](_0xba1a('0x23'),_0x390ceb+'-'+_0x142f72+'/'+_0x1b91a3)[_0xba1a('0x24')](_0x428c94);}return null;};}function patchUpdates(_0x130d10){return function(_0x122131){try{jsonpatch[_0xba1a('0x25')](_0x122131,_0x130d10,!![]);}catch(_0x26413b){return BPromise['reject'](_0x26413b);}return _0x122131['save']();};}function saveUpdates(_0x28cedb,_0x12eb44){return function(_0x45ac95){if(_0x45ac95){return _0x45ac95[_0xba1a('0x26')](_0x28cedb)[_0xba1a('0x27')](function(_0x212abc){return _0x212abc;});}return null;};}function removeEntity(_0x1ad725,_0x216e1d){return function(_0x379fe8){if(_0x379fe8){return _0x379fe8[_0xba1a('0x28')]()[_0xba1a('0x27')](function(){var _0x3ea4f3=_0x379fe8[_0xba1a('0x29')]({'plain':!![]});var _0x310e2e=_0xba1a('0x2a');return db[_0xba1a('0x2b')][_0xba1a('0x28')]({'where':{'type':_0x310e2e,'resourceId':_0x3ea4f3['id']}})[_0xba1a('0x27')](function(){return _0x379fe8;});})[_0xba1a('0x27')](function(){_0x1ad725[_0xba1a('0x1d')](0xcc)[_0xba1a('0x2c')]();});}};}function handleEntityNotFound(_0x3d473b,_0xe5b1c0){return function(_0x3c56a4){if(!_0x3c56a4){_0x3d473b[_0xba1a('0x1c')](0x194);}return _0x3c56a4;};}function handleError(_0x206021,_0x4b906d){_0x4b906d=_0x4b906d||0x1f4;return function(_0x7cc229){logger[_0xba1a('0x2d')](_0x7cc229[_0xba1a('0x2e')]);if(_0x7cc229['name']){delete _0x7cc229[_0xba1a('0x2f')];}_0x206021[_0xba1a('0x1d')](_0x4b906d)[_0xba1a('0x30')](_0x7cc229);};}exports[_0xba1a('0x31')]=function(_0x9ee4dc,_0x5c843b){var _0x38bdf8={},_0x13a85a={},_0x26cc5e={'count':0x0,'rows':[]};var _0xd648a4=_[_0xba1a('0x32')](db['AnalyticCustomReport'][_0xba1a('0x33')],function(_0x235fdf){return{'name':_0x235fdf[_0xba1a('0x34')],'type':_0x235fdf[_0xba1a('0x35')][_0xba1a('0x36')]};});_0x13a85a[_0xba1a('0x37')]=_[_0xba1a('0x32')](_0xd648a4,_0xba1a('0x2f'));_0x13a85a['query']=_['keys'](_0x9ee4dc[_0xba1a('0x38')]);_0x13a85a[_0xba1a('0x39')]=_[_0xba1a('0x3a')](_0x13a85a[_0xba1a('0x37')],_0x13a85a[_0xba1a('0x38')]);_0x38bdf8[_0xba1a('0x3b')]=_['intersection'](_0x13a85a[_0xba1a('0x37')],qs[_0xba1a('0x3c')](_0x9ee4dc[_0xba1a('0x38')][_0xba1a('0x3c')]));_0x38bdf8[_0xba1a('0x3b')]=_0x38bdf8[_0xba1a('0x3b')][_0xba1a('0x3d')]?_0x38bdf8[_0xba1a('0x3b')]:_0x13a85a[_0xba1a('0x37')];if(!_0x9ee4dc[_0xba1a('0x38')]['hasOwnProperty']('nolimit')){_0x38bdf8[_0xba1a('0x20')]=qs[_0xba1a('0x20')](_0x9ee4dc[_0xba1a('0x38')][_0xba1a('0x20')]);_0x38bdf8[_0xba1a('0x1e')]=qs[_0xba1a('0x1e')](_0x9ee4dc[_0xba1a('0x38')][_0xba1a('0x1e')]);}_0x38bdf8[_0xba1a('0x3e')]=qs['sort'](_0x9ee4dc[_0xba1a('0x38')][_0xba1a('0x3f')]);_0x38bdf8[_0xba1a('0x40')]=qs[_0xba1a('0x39')](_[_0xba1a('0x41')](_0x9ee4dc[_0xba1a('0x38')],_0x13a85a[_0xba1a('0x39')]),_0xd648a4);if(_0x9ee4dc[_0xba1a('0x38')][_0xba1a('0x42')]){_0x38bdf8[_0xba1a('0x40')]=_['merge'](_0x38bdf8[_0xba1a('0x40')],{'$or':_[_0xba1a('0x32')](_0xd648a4,function(_0x56a970){if(_0x56a970[_0xba1a('0x35')]!==_0xba1a('0x43')){var _0x4e1d3b={};_0x4e1d3b[_0x56a970['name']]={'$like':'%'+_0x9ee4dc[_0xba1a('0x38')][_0xba1a('0x42')]+'%'};return _0x4e1d3b;}})});}_0x38bdf8=_[_0xba1a('0x44')]({},_0x38bdf8,_0x9ee4dc[_0xba1a('0x45')]);var _0x3d7a34={'where':_0x38bdf8[_0xba1a('0x40')]};return db[_0xba1a('0x46')][_0xba1a('0x21')](_0x3d7a34)[_0xba1a('0x27')](function(_0x493a10){_0x26cc5e[_0xba1a('0x21')]=_0x493a10;if(_0x9ee4dc[_0xba1a('0x38')][_0xba1a('0x47')]){_0x38bdf8[_0xba1a('0x48')]=[{'all':!![]}];}return db[_0xba1a('0x46')][_0xba1a('0x49')](_0x38bdf8);})[_0xba1a('0x27')](function(_0x1dd149){_0x26cc5e[_0xba1a('0x4a')]=_0x1dd149;return _0x26cc5e;})[_0xba1a('0x27')](respondWithFilteredResult(_0x5c843b,_0x38bdf8))[_0xba1a('0x4b')](handleError(_0x5c843b,null));};exports[_0xba1a('0x4c')]=function(_0xdd00fe,_0x2865e4){var _0x44cc24={'raw':![],'where':{'id':_0xdd00fe[_0xba1a('0x4d')]['id']}},_0x31a957={};_0x31a957[_0xba1a('0x37')]=_[_0xba1a('0x4e')](db['AnalyticCustomReport'][_0xba1a('0x33')]);_0x31a957[_0xba1a('0x38')]=_[_0xba1a('0x4e')](_0xdd00fe['query']);_0x31a957[_0xba1a('0x39')]=_[_0xba1a('0x3a')](_0x31a957['model'],_0x31a957[_0xba1a('0x38')]);_0x44cc24[_0xba1a('0x3b')]=_[_0xba1a('0x3a')](_0x31a957[_0xba1a('0x37')],qs[_0xba1a('0x3c')](_0xdd00fe[_0xba1a('0x38')][_0xba1a('0x3c')]));_0x44cc24[_0xba1a('0x3b')]=_0x44cc24['attributes'][_0xba1a('0x3d')]?_0x44cc24[_0xba1a('0x3b')]:_0x31a957['model'];if(_0xdd00fe['query'][_0xba1a('0x47')]){_0x44cc24[_0xba1a('0x48')]=[{'all':!![]}];}_0x44cc24=_[_0xba1a('0x44')]({},_0x44cc24,_0xdd00fe[_0xba1a('0x45')]);return db[_0xba1a('0x46')][_0xba1a('0x4f')](_0x44cc24)[_0xba1a('0x27')](handleEntityNotFound(_0x2865e4,null))['then'](respondWithResult(_0x2865e4,null))[_0xba1a('0x4b')](handleError(_0x2865e4,null));};exports[_0xba1a('0x50')]=function(_0x4b77ff,_0x35ec7d){return db[_0xba1a('0x46')][_0xba1a('0x50')](_0x4b77ff['body'],{})[_0xba1a('0x27')](function(_0x2947a3){var _0x5a8714=_0x4b77ff[_0xba1a('0x51')][_0xba1a('0x29')]({'plain':!![]});if(!_0x5a8714)throw new Error(_0xba1a('0x52'));if(_0x5a8714[_0xba1a('0x53')]===_0xba1a('0x51')){var _0x37b445=_0x2947a3[_0xba1a('0x29')]({'plain':!![]});var _0x46f348=_0xba1a('0x54');return db[_0xba1a('0x55')][_0xba1a('0x4f')]({'where':{'name':_0x46f348,'userProfileId':_0x5a8714[_0xba1a('0x56')]},'raw':!![]})[_0xba1a('0x27')](function(_0x1b25c9){if(_0x1b25c9&&_0x1b25c9[_0xba1a('0x57')]===0x0){return db[_0xba1a('0x2b')][_0xba1a('0x50')]({'name':_0x37b445[_0xba1a('0x2f')],'resourceId':_0x37b445['id'],'type':_0xba1a('0x2a'),'sectionId':_0x1b25c9['id']},{})[_0xba1a('0x27')](function(){return _0x2947a3;});}else{return _0x2947a3;}})[_0xba1a('0x4b')](function(_0x1c724c){logger[_0xba1a('0x2d')](_0xba1a('0x58'),_0x1c724c);throw _0x1c724c;});}return _0x2947a3;})[_0xba1a('0x27')](respondWithResult(_0x35ec7d,0xc9))[_0xba1a('0x4b')](handleError(_0x35ec7d,null));};exports['update']=function(_0x476883,_0x2c2711){if(_0x476883[_0xba1a('0x59')]['id']){delete _0x476883[_0xba1a('0x59')]['id'];}return db[_0xba1a('0x46')][_0xba1a('0x4f')]({'where':{'id':_0x476883['params']['id']}})[_0xba1a('0x27')](handleEntityNotFound(_0x2c2711,null))[_0xba1a('0x27')](saveUpdates(_0x476883[_0xba1a('0x59')],null))[_0xba1a('0x27')](respondWithResult(_0x2c2711,null))[_0xba1a('0x4b')](handleError(_0x2c2711,null));};exports['destroy']=function(_0x42e1ec,_0x537336){return db['AnalyticCustomReport']['find']({'where':{'id':_0x42e1ec[_0xba1a('0x4d')]['id']}})[_0xba1a('0x27')](handleEntityNotFound(_0x537336,null))[_0xba1a('0x27')](removeEntity(_0x537336,null))[_0xba1a('0x4b')](handleError(_0x537336,null));};exports['preview']=function(_0x3381c3,_0x5e1303){var _0x46872e=0xa;var _0x152316=[_0xba1a('0x5a'),_0xba1a('0x5b'),_0xba1a('0x5c'),_0xba1a('0x5d')];var _0x1e6d48={'SUM':_0xba1a('0x5e'),'COUNT':_0xba1a('0x5f'),'COUNT DISTINCT':_0xba1a('0x60'),'MAX':_0xba1a('0x61'),'MIN':'MIN(%s)','AVG':_0xba1a('0x62'),'GROUP_CONCAT':_0xba1a('0x63'),'GROUP_CONCAT ASC':_0xba1a('0x64'),'GROUP_CONCAT DESC':_0xba1a('0x65')};var _0x560747={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xba1a('0x66'),'HOUR':_0xba1a('0x67'),'ROUND':_0xba1a('0x68'),'UNIX_TIMESTAMP':_0xba1a('0x69')};var _0x416ab6=function(_0x2d2d83){return!_[_0xba1a('0x6a')](['IS\x20NULL',_0xba1a('0x6b'),_0xba1a('0x6c'),_0xba1a('0x6d')],_0x2d2d83);};var _0xb84e9a=function(_0x16e0d0){if(!_0x16e0d0||!_0x16e0d0[_0xba1a('0x6e')]['length']){return'';}for(var _0x39fefb='(',_0x4d828b=0x0;_0x4d828b<_0x16e0d0['rules'][_0xba1a('0x3d')];_0x4d828b+=0x1){_0x4d828b>0x0&&(_0x39fefb+='\x20'+_0x16e0d0[_0xba1a('0x6f')]+'\x20');_0x39fefb+=_0x16e0d0['rules'][_0x4d828b][_0xba1a('0x70')]?_0xb84e9a(_0x16e0d0['rules'][_0x4d828b][_0xba1a('0x70')]):_0x16e0d0[_0xba1a('0x6e')][_0x4d828b][_0xba1a('0x71')]+'\x20'+_0x16e0d0[_0xba1a('0x6e')][_0x4d828b][_0xba1a('0x72')]+(_0x416ab6(_0x16e0d0[_0xba1a('0x6e')][_0x4d828b][_0xba1a('0x72')])?'\x20'+_0x16e0d0[_0xba1a('0x6e')][_0x4d828b]['value']:'');}return _0x39fefb+')';};var _0xb8c40b={'where':{'id':_0x3381c3[_0xba1a('0x4d')]['id']}},_0x101067,_0x17d3da,_0x583d30,_0xdc43cd,_0x513d64;_0xb8c40b=_[_0xba1a('0x44')]({},_0xb8c40b,_0x3381c3['options']);return db[_0xba1a('0x46')][_0xba1a('0x4f')](_0xb8c40b)[_0xba1a('0x27')](function(_0x38f1f1){if(_0x38f1f1){_0x101067=_0x38f1f1;return _0x38f1f1[_0xba1a('0x73')]();}return null;})[_0xba1a('0x27')](function(_0x3a64f3){if(_0x3a64f3){if(!_0x3a64f3[_0xba1a('0x3d')]){throw new db[(_0xba1a('0x74'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x17d3da=_0x3a64f3;return db['AnalyticMetric'][_0xba1a('0x49')]({'raw':!![]});}return null;})[_0xba1a('0x27')](function(_0x4d3961){if(_0x4d3961){_0x583d30=_[_0xba1a('0x75')](_0x4d3961,'id');var _0x26c815;var _0x406a05=squel[_0xba1a('0x76')]();_0x406a05[_0xba1a('0x77')](_0x101067[_0xba1a('0x78')]);for(var _0x346237=0x0;_0x346237<_0x17d3da[_0xba1a('0x3d')];_0x346237+=0x1){_0x26c815=_0x17d3da[_0x346237][_0xba1a('0x79')]?_0x583d30[_0x17d3da[_0x346237]['MetricId']][_0xba1a('0x7a')]:_0x17d3da[_0x346237][_0xba1a('0x71')];_0x26c815=_0x17d3da[_0x346237]['function']?_['replace'](_0x1e6d48[_0x17d3da[_0x346237][_0xba1a('0x7b')]],'%s',_0x26c815):_0x26c815;_0x26c815=_0x17d3da[_0x346237][_0xba1a('0x7c')]?_[_0xba1a('0x7d')](_0x560747[_0x17d3da[_0x346237][_0xba1a('0x7c')]],'%s',_0x26c815):_0x26c815;if(_0x17d3da[_0x346237][_0xba1a('0x7e')]){_0x406a05[_0xba1a('0x70')](_0x26c815);}_0x17d3da[_0x346237]['orderBy']&&_0x406a05['order'](_0x26c815,_0x17d3da[_0x346237][_0xba1a('0x7f')]===_0xba1a('0x80')?![]:!![]);_0x406a05['field'](_0x26c815,_0x17d3da[_0x346237][_0xba1a('0x81')]||_0x26c815);}if(_0x101067[_0xba1a('0x82')]){_0x101067[_0xba1a('0x82')]=JSON['parse'](_0x101067['joins']);for(var _0x508a50=0x0;_0x508a50<_0x101067[_0xba1a('0x82')][_0xba1a('0x3d')];_0x508a50+=0x1){if(_0x101067[_0xba1a('0x82')][_0x508a50][_0xba1a('0x35')]&&_[_0xba1a('0x6a')](_0x152316,_0x101067[_0xba1a('0x82')][_0x508a50]['type'])&&_0x101067[_0xba1a('0x82')][_0x508a50][_0xba1a('0x83')]&&_0x101067[_0xba1a('0x82')][_0x508a50][_0xba1a('0x84')]&&_0x101067[_0xba1a('0x82')][_0x508a50][_0xba1a('0x85')]){_0x406a05[_0x101067[_0xba1a('0x82')][_0x508a50][_0xba1a('0x35')]](_0x101067[_0xba1a('0x82')][_0x508a50][_0xba1a('0x84')],null,util[_0xba1a('0x7c')](_0xba1a('0x86'),_0x101067[_0xba1a('0x78')],_0x101067[_0xba1a('0x82')][_0x508a50][_0xba1a('0x83')],_0x101067['joins'][_0x508a50][_0xba1a('0x84')],_0x101067[_0xba1a('0x82')][_0x508a50]['foreignKey']));}}}if(_0x101067[_0xba1a('0x87')]){_0x101067[_0xba1a('0x87')]=JSON[_0xba1a('0x88')](_0x101067[_0xba1a('0x87')]);_0x406a05[_0xba1a('0x40')](_0xb84e9a(_0x101067['conditions']['group']));}_0x513d64=_0x406a05[_0xba1a('0x89')]();_0x406a05[_0xba1a('0x20')](_0x46872e);_0x406a05[_0xba1a('0x1e')](0x0);logger[_0xba1a('0x8a')]('Limited\x20Query:',_0x406a05['toString']());return dbH[_0xba1a('0x8b')][_0xba1a('0x38')](_0x406a05[_0xba1a('0x8c')](),{'type':dbH[_0xba1a('0x8b')][_0xba1a('0x8d')][_0xba1a('0x8e')]});}})['then'](respondWithResult(_0x5e1303,null))[_0xba1a('0x4b')](handleError(_0x5e1303,null));};function runReport(_0xb11ada,_0x360e74,_0x5b358a){var _0x25dfa2=_0x360e74[_0xba1a('0x2f')];var _0x3f7500=0xa;var _0x4403e2=['join',_0xba1a('0x5b'),_0xba1a('0x5c'),_0xba1a('0x5d')];var _0x5c1b4c={'SUM':_0xba1a('0x5e'),'COUNT':_0xba1a('0x5f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xba1a('0x61'),'MIN':'MIN(%s)','AVG':_0xba1a('0x62'),'GROUP_CONCAT':_0xba1a('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x41dab7={'SEC_TO_TIME':_0xba1a('0x8f'),'DATE':_0xba1a('0x66'),'HOUR':_0xba1a('0x67'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xba1a('0x69')};var _0x10195f=function(_0x37b3ae){return!_[_0xba1a('0x6a')]([_0xba1a('0x90'),_0xba1a('0x6b'),_0xba1a('0x6c'),'IS\x20NOT\x20EMPTY'],_0x37b3ae);};var _0xcd9b99=function(_0x52707f){if(!_0x52707f||!_0x52707f[_0xba1a('0x6e')][_0xba1a('0x3d')]){return'';}for(var _0x50eece='(',_0x3861d1=0x0;_0x3861d1<_0x52707f[_0xba1a('0x6e')][_0xba1a('0x3d')];_0x3861d1+=0x1){_0x3861d1>0x0&&(_0x50eece+='\x20'+_0x52707f[_0xba1a('0x6f')]+'\x20');_0x50eece+=_0x52707f[_0xba1a('0x6e')][_0x3861d1][_0xba1a('0x70')]?_0xcd9b99(_0x52707f['rules'][_0x3861d1][_0xba1a('0x70')]):_0x52707f['rules'][_0x3861d1][_0xba1a('0x71')]+'\x20'+_0x52707f[_0xba1a('0x6e')][_0x3861d1][_0xba1a('0x72')]+(_0x10195f(_0x52707f[_0xba1a('0x6e')][_0x3861d1][_0xba1a('0x72')])?'\x20'+_0x52707f[_0xba1a('0x6e')][_0x3861d1][_0xba1a('0x91')]:'');}return _0x50eece+')';};var _0x308d9d={'where':{'id':_0xb11ada['id']}},_0x4e92d1,_0x32bd94,_0x14a028,_0x20fe59,_0x20ad83;_0x308d9d=_[_0xba1a('0x44')]({},_0x308d9d,_0x5b358a);return db[_0xba1a('0x46')][_0xba1a('0x4f')](_0x308d9d)[_0xba1a('0x27')](function(_0x47f484){if(_0x47f484){_0x4e92d1=_0x47f484;return _0x47f484[_0xba1a('0x73')]();}return null;})[_0xba1a('0x27')](function(_0x5cf1db){if(_0x5cf1db){if(!_0x5cf1db['length']){throw new db[(_0xba1a('0x74'))][(_0xba1a('0x92'))](_0xba1a('0x93'),0x193);}_0x32bd94=_0x5cf1db;return db[_0xba1a('0x94')][_0xba1a('0x49')]({'raw':!![]});}return null;})[_0xba1a('0x27')](function(_0x14c0f0){if(_0x14c0f0){_0x14a028=_[_0xba1a('0x75')](_0x14c0f0,'id');var _0x362540;var _0x2bbef2=squel[_0xba1a('0x76')]();_0x2bbef2[_0xba1a('0x77')](_0x4e92d1[_0xba1a('0x78')]);for(var _0x2736ba=0x0;_0x2736ba<_0x32bd94['length'];_0x2736ba+=0x1){_0x362540=_0x32bd94[_0x2736ba][_0xba1a('0x79')]?_0x14a028[_0x32bd94[_0x2736ba][_0xba1a('0x79')]]['metric']:_0x32bd94[_0x2736ba]['field'];_0x362540=_0x32bd94[_0x2736ba][_0xba1a('0x7b')]?_['replace'](_0x5c1b4c[_0x32bd94[_0x2736ba][_0xba1a('0x7b')]],'%s',_0x362540):_0x362540;_0x362540=_0x32bd94[_0x2736ba]['format']?_['replace'](_0x41dab7[_0x32bd94[_0x2736ba][_0xba1a('0x7c')]],'%s',_0x362540):_0x362540;if(_0x32bd94[_0x2736ba][_0xba1a('0x7e')]){_0x2bbef2[_0xba1a('0x70')](_0x362540);}_0x32bd94[_0x2736ba][_0xba1a('0x7f')]&&_0x2bbef2[_0xba1a('0x3e')](_0x362540,_0x32bd94[_0x2736ba][_0xba1a('0x7f')]===_0xba1a('0x80')?![]:!![]);_0x2bbef2[_0xba1a('0x71')](_0x362540,_0x32bd94[_0x2736ba][_0xba1a('0x81')]||_0x362540);}if(_0x4e92d1['joins']){_0x4e92d1['joins']=JSON[_0xba1a('0x88')](_0x4e92d1[_0xba1a('0x82')]);for(var _0x43141f=0x0;_0x43141f<_0x4e92d1['joins'][_0xba1a('0x3d')];_0x43141f+=0x1){if(_0x4e92d1[_0xba1a('0x82')][_0x43141f][_0xba1a('0x35')]&&_[_0xba1a('0x6a')](_0x4403e2,_0x4e92d1[_0xba1a('0x82')][_0x43141f][_0xba1a('0x35')])&&_0x4e92d1[_0xba1a('0x82')][_0x43141f][_0xba1a('0x83')]&&_0x4e92d1[_0xba1a('0x82')][_0x43141f][_0xba1a('0x84')]&&_0x4e92d1[_0xba1a('0x82')][_0x43141f][_0xba1a('0x85')]){_0x2bbef2[_0x4e92d1[_0xba1a('0x82')][_0x43141f][_0xba1a('0x35')]](_0x4e92d1[_0xba1a('0x82')][_0x43141f][_0xba1a('0x84')],null,util[_0xba1a('0x7c')](_0xba1a('0x86'),_0x4e92d1[_0xba1a('0x78')],_0x4e92d1['joins'][_0x43141f]['parentKey'],_0x4e92d1['joins'][_0x43141f][_0xba1a('0x84')],_0x4e92d1['joins'][_0x43141f][_0xba1a('0x85')]));}}}if(_0x4e92d1[_0xba1a('0x87')]){_0x4e92d1['conditions']=JSON[_0xba1a('0x88')](_0x4e92d1[_0xba1a('0x87')]);_0x2bbef2[_0xba1a('0x40')](_0xcd9b99(_0x4e92d1[_0xba1a('0x87')][_0xba1a('0x70')]));}_0x20ad83=_0x2bbef2[_0xba1a('0x89')]();_0x2bbef2[_0xba1a('0x20')](_0x3f7500);_0x2bbef2[_0xba1a('0x1e')](0x0);return;}})[_0xba1a('0x27')](function(){if(_0x360e74['output']===_0xba1a('0x95')){return null;}var _0x5cad85=_[_0xba1a('0x44')](_0x360e74,{'name':_0x360e74[_0xba1a('0x96')]||_0x360e74[_0xba1a('0x2f')]||_0x4e92d1[_0xba1a('0x2f')],'basename':_0x25dfa2,'savename':util[_0xba1a('0x7c')](_0xba1a('0x97'),_0x360e74[_0xba1a('0x2f')]||_0x4e92d1[_0xba1a('0x2f')],require('randomstring')[_0xba1a('0x98')](0x4),_0x360e74[_0xba1a('0x99')]||_0xba1a('0x9a')),'reportId':_0x4e92d1['id'],'reportType':_0xba1a('0x9b')});return db['AnalyticExtractedReport']['create'](_0x5cad85,{'raw':!![]});})[_0xba1a('0x27')](function(_0x4f215e){if(_0x4e92d1[_0xba1a('0x78')]===_0xba1a('0x9c')){_0x20ad83[_0xba1a('0x40')](_0x4e92d1[_0xba1a('0x78')]+_0xba1a('0x9d'),_0x360e74[_0xba1a('0x9e')],_0x360e74[_0xba1a('0x9f')]);}else{_0x20ad83['where'](_0x4e92d1['table']+_0xba1a('0xa0'),_0x360e74[_0xba1a('0x9e')],_0x360e74[_0xba1a('0x9f')]);}if(_0x4f215e){logger[_0xba1a('0xa1')](_0xba1a('0xa2'),_0x20ad83[_0xba1a('0x8c')]());require(_0xba1a('0xa3'))[_0xba1a('0xa4')](path[_0xba1a('0x5a')](__dirname,'../../components/export/',_0x4f215e['output']),[_0x4f215e['id'],_0x20ad83['toString'](),path[_0xba1a('0x5a')](__dirname,_0xba1a('0xa5'),_0x4f215e[_0xba1a('0xa6')]),_0x25dfa2]);return _0x4f215e;}else{var _0x47891b=squel[_0xba1a('0x76')]();_0x47891b[_0xba1a('0x77')]('('+_0x20ad83[_0xba1a('0x8c')]()+')',_0xba1a('0xa7'));_0x47891b['field'](_0xba1a('0xa8'),_0xba1a('0x21'));_0x20ad83['limit'](_0x360e74['limit']||_0x3f7500);_0x20ad83[_0xba1a('0x1e')](_0x360e74[_0xba1a('0x1e')]||0x0);return dbH['sequelize'][_0xba1a('0x38')](_0x47891b[_0xba1a('0x8c')](),{'type':dbH[_0xba1a('0x8b')][_0xba1a('0x8d')][_0xba1a('0x8e')]})[_0xba1a('0x27')](function(_0x17f333){if(!_0x17f333['length']){_0x20fe59=0x0;}else{_0x20fe59=_0x17f333[0x0][_0xba1a('0x21')]||0x0;}return dbH['sequelize']['query'](_0x20ad83[_0xba1a('0x8c')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xba1a('0x27')](function(_0x1d6bdf){return{'rows':_0x1d6bdf||[],'count':_0x20fe59};});}});}exports[_0xba1a('0xa9')]=function(_0x5c79cb,_0x1a8e43){return runReport(_0x5c79cb[_0xba1a('0x4d')],_0x5c79cb[_0xba1a('0x38')],_0x5c79cb[_0xba1a('0x45')])[_0xba1a('0x27')](respondWithResult(_0x1a8e43,null))[_0xba1a('0x4b')](handleError(_0x1a8e43,null));};exports['runReport']=runReport;exports[_0xba1a('0x38')]=function(_0x56e673,_0x1a6ef6){var _0x4a4818=0xa;var _0x109552=[_0xba1a('0x5a'),_0xba1a('0x5b'),_0xba1a('0x5c'),_0xba1a('0x5d')];var _0x4c306f={'SUM':'SUM(%s)','COUNT':_0xba1a('0x5f'),'COUNT DISTINCT':_0xba1a('0x60'),'MAX':_0xba1a('0x61'),'MIN':_0xba1a('0xaa'),'AVG':_0xba1a('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xba1a('0x64'),'GROUP_CONCAT DESC':_0xba1a('0x65')};var _0x4b2388={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xba1a('0x66'),'HOUR':_0xba1a('0x67'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2a0cc1=function(_0xf7fa59){return!_[_0xba1a('0x6a')](['IS\x20NULL',_0xba1a('0x6b'),_0xba1a('0x6c'),'IS\x20NOT\x20EMPTY'],_0xf7fa59);};var _0x5a3680=function(_0x5991bc){if(!_0x5991bc||!_0x5991bc[_0xba1a('0x6e')][_0xba1a('0x3d')]){return'';}for(var _0x5e14f4='(',_0x561b93=0x0;_0x561b93<_0x5991bc[_0xba1a('0x6e')][_0xba1a('0x3d')];_0x561b93+=0x1){_0x561b93>0x0&&(_0x5e14f4+='\x20'+_0x5991bc[_0xba1a('0x6f')]+'\x20');_0x5e14f4+=_0x5991bc[_0xba1a('0x6e')][_0x561b93][_0xba1a('0x70')]?_0x5a3680(_0x5991bc[_0xba1a('0x6e')][_0x561b93][_0xba1a('0x70')]):_0x5991bc[_0xba1a('0x6e')][_0x561b93]['field']+'\x20'+_0x5991bc[_0xba1a('0x6e')][_0x561b93][_0xba1a('0x72')]+(_0x2a0cc1(_0x5991bc['rules'][_0x561b93][_0xba1a('0x72')])?'\x20'+_0x5991bc[_0xba1a('0x6e')][_0x561b93][_0xba1a('0x91')]:'');}return _0x5e14f4+')';};var _0x513993={'where':{'id':_0x56e673[_0xba1a('0x4d')]['id']}},_0x54baa4,_0x1aeacf,_0x625f79,_0x3be5b3,_0x4d6524;_0x513993=_['merge']({},_0x513993,_0x56e673[_0xba1a('0x45')]);return db[_0xba1a('0x46')]['find'](_0x513993)[_0xba1a('0x27')](function(_0x57005a){if(_0x57005a){_0x54baa4=_0x57005a;return _0x57005a['getFields']();}return null;})['then'](function(_0x180293){if(_0x180293){if(!_0x180293[_0xba1a('0x3d')]){throw new db['Sequelize'][(_0xba1a('0x92'))](_0xba1a('0x93'),0x193);}_0x1aeacf=_0x180293;return db['AnalyticMetric'][_0xba1a('0x49')]({'raw':!![]});}return null;})[_0xba1a('0x27')](function(_0x1768e7){if(_0x1768e7){_0x625f79=_[_0xba1a('0x75')](_0x1768e7,'id');var _0x313bf4;var _0x24d330=squel[_0xba1a('0x76')]();_0x24d330[_0xba1a('0x77')](_0x54baa4['table']);for(var _0x17d743=0x0;_0x17d743<_0x1aeacf[_0xba1a('0x3d')];_0x17d743+=0x1){_0x313bf4=_0x1aeacf[_0x17d743][_0xba1a('0x79')]?_0x625f79[_0x1aeacf[_0x17d743][_0xba1a('0x79')]]['metric']:_0x1aeacf[_0x17d743]['field'];_0x313bf4=_0x1aeacf[_0x17d743][_0xba1a('0x7b')]?_[_0xba1a('0x7d')](_0x4c306f[_0x1aeacf[_0x17d743]['function']],'%s',_0x313bf4):_0x313bf4;_0x313bf4=_0x1aeacf[_0x17d743][_0xba1a('0x7c')]?_[_0xba1a('0x7d')](_0x4b2388[_0x1aeacf[_0x17d743]['format']],'%s',_0x313bf4):_0x313bf4;if(_0x1aeacf[_0x17d743][_0xba1a('0x7e')]){_0x24d330['group'](_0x313bf4);}_0x1aeacf[_0x17d743][_0xba1a('0x7f')]&&_0x24d330['order'](_0x313bf4,_0x1aeacf[_0x17d743][_0xba1a('0x7f')]===_0xba1a('0x80')?![]:!![]);_0x24d330['field'](_0x313bf4,_0x1aeacf[_0x17d743][_0xba1a('0x81')]||_0x313bf4);}if(_0x54baa4[_0xba1a('0x82')]){_0x54baa4['joins']=JSON['parse'](_0x54baa4[_0xba1a('0x82')]);for(var _0x2ee27f=0x0;_0x2ee27f<_0x54baa4[_0xba1a('0x82')][_0xba1a('0x3d')];_0x2ee27f+=0x1){if(_0x54baa4[_0xba1a('0x82')][_0x2ee27f][_0xba1a('0x35')]&&_[_0xba1a('0x6a')](_0x109552,_0x54baa4[_0xba1a('0x82')][_0x2ee27f][_0xba1a('0x35')])&&_0x54baa4[_0xba1a('0x82')][_0x2ee27f][_0xba1a('0x83')]&&_0x54baa4[_0xba1a('0x82')][_0x2ee27f][_0xba1a('0x84')]&&_0x54baa4[_0xba1a('0x82')][_0x2ee27f]['foreignKey']){_0x24d330[_0x54baa4[_0xba1a('0x82')][_0x2ee27f][_0xba1a('0x35')]](_0x54baa4[_0xba1a('0x82')][_0x2ee27f]['foreignTable'],null,util[_0xba1a('0x7c')]('%s.%s\x20=\x20%s.%s',_0x54baa4['table'],_0x54baa4[_0xba1a('0x82')][_0x2ee27f][_0xba1a('0x83')],_0x54baa4[_0xba1a('0x82')][_0x2ee27f][_0xba1a('0x84')],_0x54baa4['joins'][_0x2ee27f][_0xba1a('0x85')]));}}}if(_0x54baa4['conditions']){_0x54baa4[_0xba1a('0x87')]=JSON[_0xba1a('0x88')](_0x54baa4['conditions']);_0x24d330[_0xba1a('0x40')](_0x5a3680(_0x54baa4[_0xba1a('0x87')][_0xba1a('0x70')]));}_0x4d6524=_0x24d330[_0xba1a('0x89')]();_0x24d330[_0xba1a('0x20')](_0x4a4818);_0x24d330[_0xba1a('0x1e')](0x0);logger['debug'](_0xba1a('0xab'),_0x24d330[_0xba1a('0x8c')]());return dbH[_0xba1a('0x8b')][_0xba1a('0x38')](_0x24d330[_0xba1a('0x8c')](),{'type':dbH[_0xba1a('0x8b')][_0xba1a('0x8d')][_0xba1a('0x8e')]});}})['then'](function(){return{'sql':_0x4d6524[_0xba1a('0x8c')]()};})['then'](respondWithResult(_0x1a6ef6,null))[_0xba1a('0x4b')](handleError(_0x1a6ef6,null));}; \ No newline at end of file +var _0x0603=['undefined','offset','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','includeAll','findAll','catch','show','rawAttributes','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','update','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','limit','debug','toString','sequelize','SELECT','join','DATE(%s)','IS\x20NOT\x20EMPTY','operator','value','Sequelize','DESC','parentKey','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../files/reports','savename','QueryTypes','run','runReport','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x0603,0x1cb));var _0x3060=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x0603[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3060('0x0'));var zipdir=require(_0x3060('0x1'));var jsonpatch=require(_0x3060('0x2'));var rp=require('request-promise');var moment=require(_0x3060('0x3'));var BPromise=require(_0x3060('0x4'));var Mustache=require(_0x3060('0x5'));var util=require(_0x3060('0x6'));var path=require(_0x3060('0x7'));var sox=require(_0x3060('0x8'));var csv=require(_0x3060('0x9'));var ejs=require(_0x3060('0xa'));var fs=require('fs');var fs_extra=require(_0x3060('0xb'));var _=require('lodash');var squel=require(_0x3060('0xc'));var crypto=require(_0x3060('0xd'));var jsforce=require(_0x3060('0xe'));var deskjs=require(_0x3060('0xf'));var toCsv=require(_0x3060('0x9'));var querystring=require(_0x3060('0x10'));var Papa=require(_0x3060('0x11'));var Redis=require(_0x3060('0x12'));var authService=require(_0x3060('0x13'));var qs=require(_0x3060('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3060('0x15'));var utils=require(_0x3060('0x16'));var config=require(_0x3060('0x17'));var licenseUtil=require(_0x3060('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3060('0x19'))['dbH'];function respondWithStatusCode(_0x1b0b23,_0x3cee17){_0x3cee17=_0x3cee17||0xcc;return function(_0x4ce1c3){if(_0x4ce1c3){return _0x1b0b23[_0x3060('0x1a')](_0x3cee17);}return _0x1b0b23[_0x3060('0x1b')](_0x3cee17)[_0x3060('0x1c')]();};}function respondWithResult(_0x3911ca,_0x951062){_0x951062=_0x951062||0xc8;return function(_0x356bcf){if(_0x356bcf){return _0x3911ca['status'](_0x951062)[_0x3060('0x1d')](_0x356bcf);}};}function respondWithFilteredResult(_0x60daa4,_0x5be196){return function(_0x1f0311){if(_0x1f0311){var _0x5ee358=typeof _0x5be196['offset']===_0x3060('0x1e')&&typeof _0x5be196['limit']===_0x3060('0x1e');var _0x30f308=_0x1f0311['count'];var _0x3eb387=_0x5ee358?0x0:_0x5be196[_0x3060('0x1f')];var _0xbd463b=_0x5ee358?_0x1f0311['count']:_0x5be196[_0x3060('0x1f')]+_0x5be196['limit'];var _0x1006aa;if(_0xbd463b>=_0x30f308){_0xbd463b=_0x30f308;_0x1006aa=0xc8;}else{_0x1006aa=0xce;}_0x60daa4[_0x3060('0x1b')](_0x1006aa);return _0x60daa4['set'](_0x3060('0x20'),_0x3eb387+'-'+_0xbd463b+'/'+_0x30f308)['json'](_0x1f0311);}return null;};}function patchUpdates(_0x38c65d){return function(_0x4e640a){try{jsonpatch[_0x3060('0x21')](_0x4e640a,_0x38c65d,!![]);}catch(_0x43de69){return BPromise[_0x3060('0x22')](_0x43de69);}return _0x4e640a[_0x3060('0x23')]();};}function saveUpdates(_0x5d6b37,_0x5eba9b){return function(_0x270a3b){if(_0x270a3b){return _0x270a3b['update'](_0x5d6b37)[_0x3060('0x24')](function(_0x414d60){return _0x414d60;});}return null;};}function removeEntity(_0x2f56e4,_0x39aa77){return function(_0x15b829){if(_0x15b829){return _0x15b829['destroy']()['then'](function(){var _0x28b195=_0x15b829[_0x3060('0x25')]({'plain':!![]});var _0x22a637='CustomReports';return db[_0x3060('0x26')][_0x3060('0x27')]({'where':{'type':_0x22a637,'resourceId':_0x28b195['id']}})['then'](function(){return _0x15b829;});})[_0x3060('0x24')](function(){_0x2f56e4[_0x3060('0x1b')](0xcc)[_0x3060('0x1c')]();});}};}function handleEntityNotFound(_0x552e38,_0xb5b40f){return function(_0x5e8483){if(!_0x5e8483){_0x552e38[_0x3060('0x1a')](0x194);}return _0x5e8483;};}function handleError(_0xb05d3,_0x2999e4){_0x2999e4=_0x2999e4||0x1f4;return function(_0x7e792f){logger[_0x3060('0x28')](_0x7e792f[_0x3060('0x29')]);if(_0x7e792f[_0x3060('0x2a')]){delete _0x7e792f[_0x3060('0x2a')];}_0xb05d3[_0x3060('0x1b')](_0x2999e4)['send'](_0x7e792f);};}exports[_0x3060('0x2b')]=function(_0x2f456c,_0x3cdb1c){var _0x472d72={},_0x331d63={},_0x3b61cc={'count':0x0,'rows':[]};var _0x158b19=_[_0x3060('0x2c')](db[_0x3060('0x2d')]['rawAttributes'],function(_0x382078){return{'name':_0x382078[_0x3060('0x2e')],'type':_0x382078[_0x3060('0x2f')][_0x3060('0x30')]};});_0x331d63[_0x3060('0x31')]=_[_0x3060('0x2c')](_0x158b19,'name');_0x331d63[_0x3060('0x32')]=_[_0x3060('0x33')](_0x2f456c[_0x3060('0x32')]);_0x331d63[_0x3060('0x34')]=_[_0x3060('0x35')](_0x331d63['model'],_0x331d63['query']);_0x472d72[_0x3060('0x36')]=_[_0x3060('0x35')](_0x331d63[_0x3060('0x31')],qs[_0x3060('0x37')](_0x2f456c[_0x3060('0x32')][_0x3060('0x37')]));_0x472d72['attributes']=_0x472d72[_0x3060('0x36')][_0x3060('0x38')]?_0x472d72[_0x3060('0x36')]:_0x331d63[_0x3060('0x31')];if(!_0x2f456c[_0x3060('0x32')][_0x3060('0x39')]('nolimit')){_0x472d72['limit']=qs['limit'](_0x2f456c[_0x3060('0x32')]['limit']);_0x472d72[_0x3060('0x1f')]=qs[_0x3060('0x1f')](_0x2f456c[_0x3060('0x32')][_0x3060('0x1f')]);}_0x472d72[_0x3060('0x3a')]=qs[_0x3060('0x3b')](_0x2f456c[_0x3060('0x32')][_0x3060('0x3b')]);_0x472d72[_0x3060('0x3c')]=qs[_0x3060('0x34')](_['pick'](_0x2f456c[_0x3060('0x32')],_0x331d63[_0x3060('0x34')]),_0x158b19);if(_0x2f456c[_0x3060('0x32')][_0x3060('0x3d')]){_0x472d72[_0x3060('0x3c')]=_[_0x3060('0x3e')](_0x472d72[_0x3060('0x3c')],{'$or':_[_0x3060('0x2c')](_0x158b19,function(_0x4c202e){if(_0x4c202e[_0x3060('0x2f')]!==_0x3060('0x3f')){var _0x378dc8={};_0x378dc8[_0x4c202e[_0x3060('0x2a')]]={'$like':'%'+_0x2f456c[_0x3060('0x32')]['filter']+'%'};return _0x378dc8;}})});}_0x472d72=_[_0x3060('0x3e')]({},_0x472d72,_0x2f456c['options']);var _0x4ebdc5={'where':_0x472d72[_0x3060('0x3c')]};return db[_0x3060('0x2d')][_0x3060('0x40')](_0x4ebdc5)['then'](function(_0x13b71d){_0x3b61cc['count']=_0x13b71d;if(_0x2f456c[_0x3060('0x32')][_0x3060('0x41')]){_0x472d72['include']=[{'all':!![]}];}return db[_0x3060('0x2d')][_0x3060('0x42')](_0x472d72);})[_0x3060('0x24')](function(_0x79e373){_0x3b61cc['rows']=_0x79e373;return _0x3b61cc;})[_0x3060('0x24')](respondWithFilteredResult(_0x3cdb1c,_0x472d72))[_0x3060('0x43')](handleError(_0x3cdb1c,null));};exports[_0x3060('0x44')]=function(_0x242dbc,_0x170042){var _0x31909b={'raw':![],'where':{'id':_0x242dbc['params']['id']}},_0x1991a3={};_0x1991a3[_0x3060('0x31')]=_[_0x3060('0x33')](db['AnalyticCustomReport'][_0x3060('0x45')]);_0x1991a3[_0x3060('0x32')]=_[_0x3060('0x33')](_0x242dbc[_0x3060('0x32')]);_0x1991a3[_0x3060('0x34')]=_['intersection'](_0x1991a3[_0x3060('0x31')],_0x1991a3[_0x3060('0x32')]);_0x31909b[_0x3060('0x36')]=_[_0x3060('0x35')](_0x1991a3[_0x3060('0x31')],qs[_0x3060('0x37')](_0x242dbc['query'][_0x3060('0x37')]));_0x31909b[_0x3060('0x36')]=_0x31909b['attributes'][_0x3060('0x38')]?_0x31909b[_0x3060('0x36')]:_0x1991a3['model'];if(_0x242dbc[_0x3060('0x32')]['includeAll']){_0x31909b['include']=[{'all':!![]}];}_0x31909b=_[_0x3060('0x3e')]({},_0x31909b,_0x242dbc['options']);return db['AnalyticCustomReport']['find'](_0x31909b)[_0x3060('0x24')](handleEntityNotFound(_0x170042,null))[_0x3060('0x24')](respondWithResult(_0x170042,null))[_0x3060('0x43')](handleError(_0x170042,null));};exports['create']=function(_0x2c7420,_0x3fd8ee){return db[_0x3060('0x2d')][_0x3060('0x46')](_0x2c7420[_0x3060('0x47')],{})[_0x3060('0x24')](function(_0x1f7d72){var _0x3fc889=_0x2c7420[_0x3060('0x48')][_0x3060('0x25')]({'plain':!![]});if(!_0x3fc889)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fc889['role']===_0x3060('0x48')){var _0x5967d5=_0x1f7d72[_0x3060('0x25')]({'plain':!![]});var _0x8b295b=_0x3060('0x49');return db[_0x3060('0x4a')]['find']({'where':{'name':_0x8b295b,'userProfileId':_0x3fc889[_0x3060('0x4b')]},'raw':!![]})['then'](function(_0x33efed){if(_0x33efed&&_0x33efed[_0x3060('0x4c')]===0x0){return db['UserProfileResource'][_0x3060('0x46')]({'name':_0x5967d5[_0x3060('0x2a')],'resourceId':_0x5967d5['id'],'type':_0x3060('0x4d'),'sectionId':_0x33efed['id']},{})['then'](function(){return _0x1f7d72;});}else{return _0x1f7d72;}})['catch'](function(_0x4720f2){logger[_0x3060('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4720f2);throw _0x4720f2;});}return _0x1f7d72;})['then'](respondWithResult(_0x3fd8ee,0xc9))[_0x3060('0x43')](handleError(_0x3fd8ee,null));};exports[_0x3060('0x4e')]=function(_0x4b0635,_0x37a57d){if(_0x4b0635[_0x3060('0x47')]['id']){delete _0x4b0635[_0x3060('0x47')]['id'];}return db[_0x3060('0x2d')][_0x3060('0x4f')]({'where':{'id':_0x4b0635['params']['id']}})[_0x3060('0x24')](handleEntityNotFound(_0x37a57d,null))[_0x3060('0x24')](saveUpdates(_0x4b0635[_0x3060('0x47')],null))[_0x3060('0x24')](respondWithResult(_0x37a57d,null))[_0x3060('0x43')](handleError(_0x37a57d,null));};exports['destroy']=function(_0x52e946,_0x3c4659){return db['AnalyticCustomReport']['find']({'where':{'id':_0x52e946[_0x3060('0x50')]['id']}})[_0x3060('0x24')](handleEntityNotFound(_0x3c4659,null))['then'](removeEntity(_0x3c4659,null))[_0x3060('0x43')](handleError(_0x3c4659,null));};exports[_0x3060('0x51')]=function(_0x358037,_0x5c9c12){var _0x5120cd=0xa;var _0x1524e2=['join',_0x3060('0x52'),_0x3060('0x53'),_0x3060('0x54')];var _0x5f08c2={'SUM':_0x3060('0x55'),'COUNT':_0x3060('0x56'),'COUNT DISTINCT':_0x3060('0x57'),'MAX':_0x3060('0x58'),'MIN':_0x3060('0x59'),'AVG':_0x3060('0x5a'),'GROUP_CONCAT':_0x3060('0x5b'),'GROUP_CONCAT ASC':_0x3060('0x5c'),'GROUP_CONCAT DESC':_0x3060('0x5d')};var _0x10fa68={'SEC_TO_TIME':_0x3060('0x5e'),'DATE':'DATE(%s)','HOUR':_0x3060('0x5f'),'ROUND':_0x3060('0x60'),'UNIX_TIMESTAMP':_0x3060('0x61')};var _0x5a7b3a=function(_0x2129ab){return!_[_0x3060('0x62')]([_0x3060('0x63'),_0x3060('0x64'),_0x3060('0x65'),'IS\x20NOT\x20EMPTY'],_0x2129ab);};var _0x40e6b4=function(_0x49222b){if(!_0x49222b||!_0x49222b['rules'][_0x3060('0x38')]){return'';}for(var _0xa1bd0='(',_0x454552=0x0;_0x454552<_0x49222b[_0x3060('0x66')][_0x3060('0x38')];_0x454552+=0x1){_0x454552>0x0&&(_0xa1bd0+='\x20'+_0x49222b['operator']+'\x20');_0xa1bd0+=_0x49222b[_0x3060('0x66')][_0x454552]['group']?_0x40e6b4(_0x49222b['rules'][_0x454552][_0x3060('0x67')]):_0x49222b['rules'][_0x454552][_0x3060('0x68')]+'\x20'+_0x49222b[_0x3060('0x66')][_0x454552][_0x3060('0x69')]+(_0x5a7b3a(_0x49222b[_0x3060('0x66')][_0x454552]['condition'])?'\x20'+_0x49222b[_0x3060('0x66')][_0x454552]['value']:'');}return _0xa1bd0+')';};var _0x5d0e28={'where':{'id':_0x358037[_0x3060('0x50')]['id']}},_0x1b9b71,_0x30da1d,_0x4d85c5,_0x4df653,_0xd00efe;_0x5d0e28=_['merge']({},_0x5d0e28,_0x358037[_0x3060('0x6a')]);return db['AnalyticCustomReport'][_0x3060('0x4f')](_0x5d0e28)[_0x3060('0x24')](function(_0x44a634){if(_0x44a634){_0x1b9b71=_0x44a634;return _0x44a634[_0x3060('0x6b')]();}return null;})['then'](function(_0x2b0ec2){if(_0x2b0ec2){if(!_0x2b0ec2[_0x3060('0x38')]){throw new db['Sequelize'][(_0x3060('0x6c'))](_0x3060('0x6d'),0x193);}_0x30da1d=_0x2b0ec2;return db[_0x3060('0x6e')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x29a7b5){if(_0x29a7b5){_0x4d85c5=_[_0x3060('0x6f')](_0x29a7b5,'id');var _0x1f3583;var _0x2178ec=squel[_0x3060('0x70')]();_0x2178ec[_0x3060('0x71')](_0x1b9b71['table']);for(var _0x1e210c=0x0;_0x1e210c<_0x30da1d[_0x3060('0x38')];_0x1e210c+=0x1){_0x1f3583=_0x30da1d[_0x1e210c][_0x3060('0x72')]?_0x4d85c5[_0x30da1d[_0x1e210c][_0x3060('0x72')]][_0x3060('0x73')]:_0x30da1d[_0x1e210c][_0x3060('0x68')];_0x1f3583=_0x30da1d[_0x1e210c][_0x3060('0x74')]?_[_0x3060('0x75')](_0x5f08c2[_0x30da1d[_0x1e210c][_0x3060('0x74')]],'%s',_0x1f3583):_0x1f3583;_0x1f3583=_0x30da1d[_0x1e210c][_0x3060('0x76')]?_[_0x3060('0x75')](_0x10fa68[_0x30da1d[_0x1e210c][_0x3060('0x76')]],'%s',_0x1f3583):_0x1f3583;if(_0x30da1d[_0x1e210c][_0x3060('0x77')]){_0x2178ec[_0x3060('0x67')](_0x1f3583);}_0x30da1d[_0x1e210c]['orderBy']&&_0x2178ec[_0x3060('0x3a')](_0x1f3583,_0x30da1d[_0x1e210c][_0x3060('0x78')]==='DESC'?![]:!![]);_0x2178ec[_0x3060('0x68')](_0x1f3583,_0x30da1d[_0x1e210c][_0x3060('0x79')]||_0x1f3583);}if(_0x1b9b71[_0x3060('0x7a')]){_0x1b9b71[_0x3060('0x7a')]=JSON[_0x3060('0x7b')](_0x1b9b71['joins']);for(var _0x45e584=0x0;_0x45e584<_0x1b9b71[_0x3060('0x7a')]['length'];_0x45e584+=0x1){if(_0x1b9b71[_0x3060('0x7a')][_0x45e584]['type']&&_[_0x3060('0x62')](_0x1524e2,_0x1b9b71[_0x3060('0x7a')][_0x45e584][_0x3060('0x2f')])&&_0x1b9b71['joins'][_0x45e584]['parentKey']&&_0x1b9b71[_0x3060('0x7a')][_0x45e584]['foreignTable']&&_0x1b9b71[_0x3060('0x7a')][_0x45e584]['foreignKey']){_0x2178ec[_0x1b9b71[_0x3060('0x7a')][_0x45e584]['type']](_0x1b9b71['joins'][_0x45e584][_0x3060('0x7c')],null,util[_0x3060('0x76')](_0x3060('0x7d'),_0x1b9b71[_0x3060('0x7e')],_0x1b9b71[_0x3060('0x7a')][_0x45e584]['parentKey'],_0x1b9b71[_0x3060('0x7a')][_0x45e584][_0x3060('0x7c')],_0x1b9b71[_0x3060('0x7a')][_0x45e584][_0x3060('0x7f')]));}}}if(_0x1b9b71[_0x3060('0x80')]){_0x1b9b71[_0x3060('0x80')]=JSON[_0x3060('0x7b')](_0x1b9b71['conditions']);_0x2178ec['where'](_0x40e6b4(_0x1b9b71[_0x3060('0x80')][_0x3060('0x67')]));}_0xd00efe=_0x2178ec[_0x3060('0x81')]();_0x2178ec[_0x3060('0x82')](_0x5120cd);_0x2178ec[_0x3060('0x1f')](0x0);logger[_0x3060('0x83')]('Limited\x20Query:',_0x2178ec[_0x3060('0x84')]());return dbH[_0x3060('0x85')][_0x3060('0x32')](_0x2178ec[_0x3060('0x84')](),{'type':dbH[_0x3060('0x85')]['QueryTypes'][_0x3060('0x86')]});}})[_0x3060('0x24')](respondWithResult(_0x5c9c12,null))['catch'](handleError(_0x5c9c12,null));};function runReport(_0x32d30e,_0x3a3feb,_0x35a122){var _0x589e6b=_0x3a3feb[_0x3060('0x2a')];var _0xd53265=0xa;var _0x486e19=[_0x3060('0x87'),'left_join',_0x3060('0x53'),'cross_join'];var _0x5f5d78={'SUM':_0x3060('0x55'),'COUNT':_0x3060('0x56'),'COUNT DISTINCT':_0x3060('0x57'),'MAX':_0x3060('0x58'),'MIN':_0x3060('0x59'),'AVG':_0x3060('0x5a'),'GROUP_CONCAT':_0x3060('0x5b'),'GROUP_CONCAT ASC':_0x3060('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x30245d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3060('0x88'),'HOUR':_0x3060('0x5f'),'ROUND':_0x3060('0x60'),'UNIX_TIMESTAMP':_0x3060('0x61')};var _0x11db3f=function(_0x42a7a7){return!_[_0x3060('0x62')]([_0x3060('0x63'),_0x3060('0x64'),'IS\x20EMPTY',_0x3060('0x89')],_0x42a7a7);};var _0x34b664=function(_0x360017){if(!_0x360017||!_0x360017[_0x3060('0x66')]['length']){return'';}for(var _0x3143e1='(',_0x1b2f99=0x0;_0x1b2f99<_0x360017[_0x3060('0x66')][_0x3060('0x38')];_0x1b2f99+=0x1){_0x1b2f99>0x0&&(_0x3143e1+='\x20'+_0x360017[_0x3060('0x8a')]+'\x20');_0x3143e1+=_0x360017[_0x3060('0x66')][_0x1b2f99][_0x3060('0x67')]?_0x34b664(_0x360017[_0x3060('0x66')][_0x1b2f99][_0x3060('0x67')]):_0x360017[_0x3060('0x66')][_0x1b2f99][_0x3060('0x68')]+'\x20'+_0x360017['rules'][_0x1b2f99]['condition']+(_0x11db3f(_0x360017[_0x3060('0x66')][_0x1b2f99][_0x3060('0x69')])?'\x20'+_0x360017['rules'][_0x1b2f99][_0x3060('0x8b')]:'');}return _0x3143e1+')';};var _0x3944ff={'where':{'id':_0x32d30e['id']}},_0x3f7f68,_0x4f7a3d,_0x2579e9,_0x33e987,_0xb42a26;_0x3944ff=_[_0x3060('0x3e')]({},_0x3944ff,_0x35a122);return db[_0x3060('0x2d')]['find'](_0x3944ff)[_0x3060('0x24')](function(_0x42eacd){if(_0x42eacd){_0x3f7f68=_0x42eacd;return _0x42eacd[_0x3060('0x6b')]();}return null;})['then'](function(_0x2b87ba){if(_0x2b87ba){if(!_0x2b87ba[_0x3060('0x38')]){throw new db[(_0x3060('0x8c'))][(_0x3060('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4f7a3d=_0x2b87ba;return db[_0x3060('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x3060('0x24')](function(_0x362743){if(_0x362743){_0x2579e9=_[_0x3060('0x6f')](_0x362743,'id');var _0x5169bd;var _0x20d074=squel[_0x3060('0x70')]();_0x20d074[_0x3060('0x71')](_0x3f7f68[_0x3060('0x7e')]);for(var _0x21cdea=0x0;_0x21cdea<_0x4f7a3d['length'];_0x21cdea+=0x1){_0x5169bd=_0x4f7a3d[_0x21cdea]['MetricId']?_0x2579e9[_0x4f7a3d[_0x21cdea][_0x3060('0x72')]]['metric']:_0x4f7a3d[_0x21cdea][_0x3060('0x68')];_0x5169bd=_0x4f7a3d[_0x21cdea][_0x3060('0x74')]?_[_0x3060('0x75')](_0x5f5d78[_0x4f7a3d[_0x21cdea][_0x3060('0x74')]],'%s',_0x5169bd):_0x5169bd;_0x5169bd=_0x4f7a3d[_0x21cdea][_0x3060('0x76')]?_[_0x3060('0x75')](_0x30245d[_0x4f7a3d[_0x21cdea][_0x3060('0x76')]],'%s',_0x5169bd):_0x5169bd;if(_0x4f7a3d[_0x21cdea][_0x3060('0x77')]){_0x20d074[_0x3060('0x67')](_0x5169bd);}_0x4f7a3d[_0x21cdea][_0x3060('0x78')]&&_0x20d074[_0x3060('0x3a')](_0x5169bd,_0x4f7a3d[_0x21cdea]['orderBy']===_0x3060('0x8d')?![]:!![]);_0x20d074[_0x3060('0x68')](_0x5169bd,_0x4f7a3d[_0x21cdea][_0x3060('0x79')]||_0x5169bd);}if(_0x3f7f68[_0x3060('0x7a')]){_0x3f7f68[_0x3060('0x7a')]=JSON[_0x3060('0x7b')](_0x3f7f68[_0x3060('0x7a')]);for(var _0x1dedb1=0x0;_0x1dedb1<_0x3f7f68[_0x3060('0x7a')][_0x3060('0x38')];_0x1dedb1+=0x1){if(_0x3f7f68[_0x3060('0x7a')][_0x1dedb1][_0x3060('0x2f')]&&_['includes'](_0x486e19,_0x3f7f68['joins'][_0x1dedb1]['type'])&&_0x3f7f68[_0x3060('0x7a')][_0x1dedb1][_0x3060('0x8e')]&&_0x3f7f68['joins'][_0x1dedb1][_0x3060('0x7c')]&&_0x3f7f68[_0x3060('0x7a')][_0x1dedb1][_0x3060('0x7f')]){_0x20d074[_0x3f7f68['joins'][_0x1dedb1]['type']](_0x3f7f68[_0x3060('0x7a')][_0x1dedb1][_0x3060('0x7c')],null,util[_0x3060('0x76')](_0x3060('0x7d'),_0x3f7f68[_0x3060('0x7e')],_0x3f7f68[_0x3060('0x7a')][_0x1dedb1][_0x3060('0x8e')],_0x3f7f68[_0x3060('0x7a')][_0x1dedb1][_0x3060('0x7c')],_0x3f7f68[_0x3060('0x7a')][_0x1dedb1][_0x3060('0x7f')]));}}}if(_0x3f7f68[_0x3060('0x80')]){_0x3f7f68[_0x3060('0x80')]=JSON[_0x3060('0x7b')](_0x3f7f68[_0x3060('0x80')]);_0x20d074['where'](_0x34b664(_0x3f7f68[_0x3060('0x80')][_0x3060('0x67')]));}_0xb42a26=_0x20d074[_0x3060('0x81')]();_0x20d074[_0x3060('0x82')](_0xd53265);_0x20d074[_0x3060('0x1f')](0x0);return;}})[_0x3060('0x24')](function(){if(_0x3a3feb[_0x3060('0x8f')]===_0x3060('0x90')){return null;}var _0x3b7c90=_['merge'](_0x3a3feb,{'name':_0x3a3feb['fullPath']||_0x3a3feb[_0x3060('0x2a')]||_0x3f7f68['name'],'basename':_0x589e6b,'savename':util[_0x3060('0x76')](_0x3060('0x91'),_0x3a3feb[_0x3060('0x2a')]||_0x3f7f68['name'],require(_0x3060('0x92'))[_0x3060('0x93')](0x4),_0x3a3feb[_0x3060('0x8f')]||_0x3060('0x94')),'reportId':_0x3f7f68['id'],'reportType':_0x3060('0x95')});return db[_0x3060('0x96')][_0x3060('0x46')](_0x3b7c90,{'raw':!![]});})['then'](function(_0x34fe44){if(_0x3f7f68[_0x3060('0x7e')]===_0x3060('0x97')){_0xb42a26[_0x3060('0x3c')](_0x3f7f68[_0x3060('0x7e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a3feb[_0x3060('0x98')],_0x3a3feb[_0x3060('0x99')]);}else{_0xb42a26[_0x3060('0x3c')](_0x3f7f68[_0x3060('0x7e')]+_0x3060('0x9a'),_0x3a3feb[_0x3060('0x98')],_0x3a3feb[_0x3060('0x99')]);}if(_0x34fe44){logger[_0x3060('0x9b')]('Run\x20Query:',_0xb42a26[_0x3060('0x84')]());require(_0x3060('0x9c'))[_0x3060('0x9d')](path['join'](__dirname,'../../components/export/',_0x34fe44[_0x3060('0x8f')]),[_0x34fe44['id'],_0xb42a26[_0x3060('0x84')](),path[_0x3060('0x87')](__dirname,_0x3060('0x9e'),_0x34fe44[_0x3060('0x9f')]),_0x589e6b]);return _0x34fe44;}else{var _0x37b934=squel['select']();_0x37b934[_0x3060('0x71')]('('+_0xb42a26[_0x3060('0x84')]()+')','countTable');_0x37b934['field']('COUNT(*)',_0x3060('0x40'));_0xb42a26['limit'](_0x3a3feb['limit']||_0xd53265);_0xb42a26['offset'](_0x3a3feb['offset']||0x0);return dbH['sequelize'][_0x3060('0x32')](_0x37b934[_0x3060('0x84')](),{'type':dbH[_0x3060('0x85')][_0x3060('0xa0')][_0x3060('0x86')]})[_0x3060('0x24')](function(_0x378dd0){if(!_0x378dd0['length']){_0x33e987=0x0;}else{_0x33e987=_0x378dd0[0x0][_0x3060('0x40')]||0x0;}return dbH[_0x3060('0x85')][_0x3060('0x32')](_0xb42a26[_0x3060('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x3060('0x86')]});})[_0x3060('0x24')](function(_0x1dcc58){return{'rows':_0x1dcc58||[],'count':_0x33e987};});}});}exports[_0x3060('0xa1')]=function(_0x35b9d3,_0x40c45c){return runReport(_0x35b9d3[_0x3060('0x50')],_0x35b9d3[_0x3060('0x32')],_0x35b9d3['options'])[_0x3060('0x24')](respondWithResult(_0x40c45c,null))[_0x3060('0x43')](handleError(_0x40c45c,null));};exports[_0x3060('0xa2')]=runReport;exports['query']=function(_0x20ebfe,_0x1eed0a){var _0x1d4c20=0xa;var _0x4f75c3=[_0x3060('0x87'),_0x3060('0x52'),'right_join',_0x3060('0x54')];var _0x49d23c={'SUM':'SUM(%s)','COUNT':_0x3060('0x56'),'COUNT DISTINCT':_0x3060('0x57'),'MAX':_0x3060('0x58'),'MIN':_0x3060('0x59'),'AVG':_0x3060('0x5a'),'GROUP_CONCAT':_0x3060('0x5b'),'GROUP_CONCAT ASC':_0x3060('0x5c'),'GROUP_CONCAT DESC':_0x3060('0x5d')};var _0x489743={'SEC_TO_TIME':_0x3060('0x5e'),'DATE':_0x3060('0x88'),'HOUR':_0x3060('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3060('0x61')};var _0x4c9ab2=function(_0x266cbe){return!_['includes'](['IS\x20NULL',_0x3060('0x64'),_0x3060('0x65'),'IS\x20NOT\x20EMPTY'],_0x266cbe);};var _0x380109=function(_0x419123){if(!_0x419123||!_0x419123['rules'][_0x3060('0x38')]){return'';}for(var _0x370648='(',_0x13e274=0x0;_0x13e274<_0x419123[_0x3060('0x66')][_0x3060('0x38')];_0x13e274+=0x1){_0x13e274>0x0&&(_0x370648+='\x20'+_0x419123[_0x3060('0x8a')]+'\x20');_0x370648+=_0x419123['rules'][_0x13e274]['group']?_0x380109(_0x419123['rules'][_0x13e274]['group']):_0x419123[_0x3060('0x66')][_0x13e274][_0x3060('0x68')]+'\x20'+_0x419123[_0x3060('0x66')][_0x13e274]['condition']+(_0x4c9ab2(_0x419123[_0x3060('0x66')][_0x13e274][_0x3060('0x69')])?'\x20'+_0x419123[_0x3060('0x66')][_0x13e274][_0x3060('0x8b')]:'');}return _0x370648+')';};var _0x4a667e={'where':{'id':_0x20ebfe[_0x3060('0x50')]['id']}},_0x1ab720,_0x37fd4a,_0x368981,_0x437775,_0x5ea90b;_0x4a667e=_[_0x3060('0x3e')]({},_0x4a667e,_0x20ebfe[_0x3060('0x6a')]);return db['AnalyticCustomReport'][_0x3060('0x4f')](_0x4a667e)[_0x3060('0x24')](function(_0x1a01a2){if(_0x1a01a2){_0x1ab720=_0x1a01a2;return _0x1a01a2[_0x3060('0x6b')]();}return null;})[_0x3060('0x24')](function(_0x161d5f){if(_0x161d5f){if(!_0x161d5f[_0x3060('0x38')]){throw new db['Sequelize'][(_0x3060('0x6c'))](_0x3060('0x6d'),0x193);}_0x37fd4a=_0x161d5f;return db[_0x3060('0x6e')][_0x3060('0x42')]({'raw':!![]});}return null;})[_0x3060('0x24')](function(_0x2ae288){if(_0x2ae288){_0x368981=_[_0x3060('0x6f')](_0x2ae288,'id');var _0x2c4c60;var _0x30994c=squel[_0x3060('0x70')]();_0x30994c[_0x3060('0x71')](_0x1ab720['table']);for(var _0x243ea7=0x0;_0x243ea7<_0x37fd4a[_0x3060('0x38')];_0x243ea7+=0x1){_0x2c4c60=_0x37fd4a[_0x243ea7][_0x3060('0x72')]?_0x368981[_0x37fd4a[_0x243ea7][_0x3060('0x72')]]['metric']:_0x37fd4a[_0x243ea7][_0x3060('0x68')];_0x2c4c60=_0x37fd4a[_0x243ea7][_0x3060('0x74')]?_[_0x3060('0x75')](_0x49d23c[_0x37fd4a[_0x243ea7][_0x3060('0x74')]],'%s',_0x2c4c60):_0x2c4c60;_0x2c4c60=_0x37fd4a[_0x243ea7]['format']?_['replace'](_0x489743[_0x37fd4a[_0x243ea7]['format']],'%s',_0x2c4c60):_0x2c4c60;if(_0x37fd4a[_0x243ea7][_0x3060('0x77')]){_0x30994c['group'](_0x2c4c60);}_0x37fd4a[_0x243ea7]['orderBy']&&_0x30994c['order'](_0x2c4c60,_0x37fd4a[_0x243ea7][_0x3060('0x78')]==='DESC'?![]:!![]);_0x30994c[_0x3060('0x68')](_0x2c4c60,_0x37fd4a[_0x243ea7]['alias']||_0x2c4c60);}if(_0x1ab720['joins']){_0x1ab720[_0x3060('0x7a')]=JSON['parse'](_0x1ab720[_0x3060('0x7a')]);for(var _0x5f394d=0x0;_0x5f394d<_0x1ab720[_0x3060('0x7a')]['length'];_0x5f394d+=0x1){if(_0x1ab720[_0x3060('0x7a')][_0x5f394d][_0x3060('0x2f')]&&_[_0x3060('0x62')](_0x4f75c3,_0x1ab720[_0x3060('0x7a')][_0x5f394d]['type'])&&_0x1ab720[_0x3060('0x7a')][_0x5f394d][_0x3060('0x8e')]&&_0x1ab720[_0x3060('0x7a')][_0x5f394d][_0x3060('0x7c')]&&_0x1ab720[_0x3060('0x7a')][_0x5f394d][_0x3060('0x7f')]){_0x30994c[_0x1ab720[_0x3060('0x7a')][_0x5f394d][_0x3060('0x2f')]](_0x1ab720[_0x3060('0x7a')][_0x5f394d][_0x3060('0x7c')],null,util['format'](_0x3060('0x7d'),_0x1ab720[_0x3060('0x7e')],_0x1ab720['joins'][_0x5f394d][_0x3060('0x8e')],_0x1ab720[_0x3060('0x7a')][_0x5f394d][_0x3060('0x7c')],_0x1ab720['joins'][_0x5f394d][_0x3060('0x7f')]));}}}if(_0x1ab720[_0x3060('0x80')]){_0x1ab720['conditions']=JSON[_0x3060('0x7b')](_0x1ab720['conditions']);_0x30994c[_0x3060('0x3c')](_0x380109(_0x1ab720[_0x3060('0x80')][_0x3060('0x67')]));}_0x5ea90b=_0x30994c[_0x3060('0x81')]();_0x30994c['limit'](_0x1d4c20);_0x30994c[_0x3060('0x1f')](0x0);logger[_0x3060('0x83')]('Limited\x20Query:',_0x30994c[_0x3060('0x84')]());return dbH[_0x3060('0x85')]['query'](_0x30994c['toString'](),{'type':dbH['sequelize'][_0x3060('0xa0')][_0x3060('0x86')]});}})[_0x3060('0x24')](function(){return{'sql':_0x5ea90b['toString']()};})['then'](respondWithResult(_0x1eed0a,null))[_0x3060('0x43')](handleError(_0x1eed0a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 44ecf85..17d9925 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 _0x43f2=['define','AnalyticCustomReport','analytics_custom_reports','util','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0x43f2,0x19d));var _0x243f=function(_0x4b357a,_0x26a686){_0x4b357a=_0x4b357a-0x0;var _0x488c3c=_0x43f2[_0x4b357a];return _0x488c3c;};'use strict';var _=require('lodash');var util=require(_0x243f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x243f('0x1'));var BPromise=require(_0x243f('0x2'));var rp=require(_0x243f('0x3'));var fs=require('fs');var path=require(_0x243f('0x4'));var rimraf=require('rimraf');var config=require(_0x243f('0x5'));var attributes=require(_0x243f('0x6'));module['exports']=function(_0x2f8ea4,_0x47b7c4){return _0x2f8ea4[_0x243f('0x7')](_0x243f('0x8'),attributes,{'tableName':_0x243f('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98ba=['bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0xa5bd84,_0x287943){var _0x22bcca=function(_0x13f6f4){while(--_0x13f6f4){_0xa5bd84['push'](_0xa5bd84['shift']());}};_0x22bcca(++_0x287943);}(_0x98ba,0x141));var _0xa98b=function(_0x339981,_0x53680c){_0x339981=_0x339981-0x0;var _0x3f9bf3=_0x98ba[_0x339981];return _0x3f9bf3;};'use strict';var _=require(_0xa98b('0x0'));var util=require(_0xa98b('0x1'));var logger=require(_0xa98b('0x2'))(_0xa98b('0x3'));var moment=require('moment');var BPromise=require(_0xa98b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa98b('0x5'));var rimraf=require(_0xa98b('0x6'));var config=require(_0xa98b('0x7'));var attributes=require(_0xa98b('0x8'));module[_0xa98b('0x9')]=function(_0x57d117,_0x421b61){return _0x57d117[_0xa98b('0xa')](_0xa98b('0xb'),attributes,{'tableName':_0xa98b('0xc'),'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 f636b01..ffdafb3 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 _0x4545=['client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4b449e,_0x42468e){var _0x23d5c3=function(_0x349e31){while(--_0x349e31){_0x4b449e['push'](_0x4b449e['shift']());}};_0x23d5c3(++_0x42468e);}(_0x4545,0x6e));var _0x5454=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4545[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x5454('0x0'));var util=require(_0x5454('0x1'));var moment=require(_0x5454('0x2'));var BPromise=require(_0x5454('0x3'));var rs=require(_0x5454('0x4'));var fs=require('fs');var Redis=require(_0x5454('0x5'));var db=require(_0x5454('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5454('0x7'))(_0x5454('0x8'));var config=require(_0x5454('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5454('0xa')][_0x5454('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c558,_0x144c73,_0x388142){return new BPromise(function(_0x35f4a6,_0x18be25){return client[_0x5454('0xc')](_0x54c558,_0x388142)[_0x5454('0xd')](function(_0x2c84eb){logger[_0x5454('0xe')](_0x5454('0xf'),_0x144c73,_0x5454('0x10'));logger[_0x5454('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x144c73,_0x5454('0x10'),JSON[_0x5454('0x12')](_0x2c84eb));if(_0x2c84eb['error']){if(_0x2c84eb['error'][_0x5454('0x13')]===0x1f4){logger[_0x5454('0x14')](_0x5454('0xf'),_0x144c73,_0x2c84eb[_0x5454('0x14')][_0x5454('0x15')]);return _0x18be25(_0x2c84eb[_0x5454('0x14')]['message']);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x144c73,_0x2c84eb[_0x5454('0x14')][_0x5454('0x15')]);return _0x35f4a6(_0x2c84eb[_0x5454('0x14')]['message']);}else{logger[_0x5454('0xe')](_0x5454('0xf'),_0x144c73,_0x5454('0x10'));_0x35f4a6(_0x2c84eb[_0x5454('0x16')][_0x5454('0x15')]);}})[_0x5454('0x17')](function(_0x41c73d){logger[_0x5454('0x14')](_0x5454('0xf'),_0x144c73,_0x41c73d);_0x18be25(_0x41c73d);});});} \ No newline at end of file +var _0x94ed=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment','randomstring'];(function(_0x372590,_0x1ebb65){var _0x21abe6=function(_0xce83f4){while(--_0xce83f4){_0x372590['push'](_0x372590['shift']());}};_0x21abe6(++_0x1ebb65);}(_0x94ed,0x15a));var _0xd94e=function(_0x307d2b,_0x3796e0){_0x307d2b=_0x307d2b-0x0;var _0xe82587=_0x94ed[_0x307d2b];return _0xe82587;};'use strict';var _=require(_0xd94e('0x0'));var util=require(_0xd94e('0x1'));var moment=require(_0xd94e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd94e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd94e('0x4'))['db'];var utils=require(_0xd94e('0x5'));var logger=require(_0xd94e('0x6'))(_0xd94e('0x7'));var config=require(_0xd94e('0x8'));var jayson=require(_0xd94e('0x9'));var client=jayson[_0xd94e('0xa')][_0xd94e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa66d47,_0xf33958,_0x5e3b7d){return new BPromise(function(_0x45cc86,_0x2dc96d){return client[_0xd94e('0xc')](_0xa66d47,_0x5e3b7d)[_0xd94e('0xd')](function(_0x387b8c){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0xf33958,_0xd94e('0xe'));logger[_0xd94e('0xf')](_0xd94e('0x10'),_0xf33958,_0xd94e('0xe'),JSON[_0xd94e('0x11')](_0x387b8c));if(_0x387b8c['error']){if(_0x387b8c[_0xd94e('0x12')][_0xd94e('0x13')]===0x1f4){logger[_0xd94e('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xf33958,_0x387b8c[_0xd94e('0x12')]['message']);return _0x2dc96d(_0x387b8c[_0xd94e('0x12')][_0xd94e('0x14')]);}logger[_0xd94e('0x12')](_0xd94e('0x15'),_0xf33958,_0x387b8c[_0xd94e('0x12')][_0xd94e('0x14')]);return _0x45cc86(_0x387b8c[_0xd94e('0x12')][_0xd94e('0x14')]);}else{logger[_0xd94e('0x16')](_0xd94e('0x15'),_0xf33958,_0xd94e('0xe'));_0x45cc86(_0x387b8c[_0xd94e('0x17')]['message']);}})[_0xd94e('0x18')](function(_0x77f3d4){logger[_0xd94e('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xf33958,_0x77f3d4);_0x2dc96d(_0x77f3d4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 33ea503..3782760 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 _0xa7f4=['get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x363050,_0x24b3ac){var _0x31f581=function(_0x576f64){while(--_0x576f64){_0x363050['push'](_0x363050['shift']());}};_0x31f581(++_0x24b3ac);}(_0xa7f4,0x1c7));var _0x4a7f=function(_0x4d86de,_0x52bed5){_0x4d86de=_0x4d86de-0x0;var _0x487f71=_0xa7f4[_0x4d86de];return _0x487f71;};'use strict';var multer=require(_0x4a7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4a7f('0x1'));var express=require('express');var router=express[_0x4a7f('0x2')]();var fs_extra=require(_0x4a7f('0x3'));var auth=require(_0x4a7f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a7f('0x5'));var controller=require(_0x4a7f('0x6'));router[_0x4a7f('0x7')]('/',auth[_0x4a7f('0x8')](),controller['index']);router['get'](_0x4a7f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4a7f('0x7')](_0x4a7f('0xa'),auth[_0x4a7f('0x8')](),controller[_0x4a7f('0xb')]);router[_0x4a7f('0x7')](_0x4a7f('0xc'),auth[_0x4a7f('0x8')](),controller[_0x4a7f('0xd')]);router[_0x4a7f('0x7')](_0x4a7f('0xe'),auth[_0x4a7f('0x8')](),controller[_0x4a7f('0xf')]);router[_0x4a7f('0x10')]('/',auth[_0x4a7f('0x8')](),controller[_0x4a7f('0x11')]);router[_0x4a7f('0x12')](_0x4a7f('0x9'),auth[_0x4a7f('0x8')](),controller['update']);router[_0x4a7f('0x13')](_0x4a7f('0x9'),auth[_0x4a7f('0x8')](),controller[_0x4a7f('0x14')]);module[_0x4a7f('0x15')]=router; \ No newline at end of file +var _0x01cd=['../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','/:id/preview','preview','/:id/run','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x25f359,_0x45d884){var _0x32185e=function(_0x1ab66c){while(--_0x1ab66c){_0x25f359['push'](_0x25f359['shift']());}};_0x32185e(++_0x45d884);}(_0x01cd,0xf6));var _0xd01c=function(_0x1b0a38,_0x1c0b07){_0x1b0a38=_0x1b0a38-0x0;var _0x588b5c=_0x01cd[_0x1b0a38];return _0x588b5c;};'use strict';var multer=require(_0xd01c('0x0'));var util=require(_0xd01c('0x1'));var path=require(_0xd01c('0x2'));var timeout=require(_0xd01c('0x3'));var express=require('express');var router=express[_0xd01c('0x4')]();var fs_extra=require(_0xd01c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd01c('0x6'));var config=require('../../config/environment');var controller=require(_0xd01c('0x7'));router[_0xd01c('0x8')]('/',auth[_0xd01c('0x9')](),controller['index']);router[_0xd01c('0x8')]('/:id',auth[_0xd01c('0x9')](),controller['show']);router[_0xd01c('0x8')](_0xd01c('0xa'),auth[_0xd01c('0x9')](),controller[_0xd01c('0xb')]);router['get'](_0xd01c('0xc'),auth['isAuthenticated'](),controller['run']);router[_0xd01c('0x8')]('/:id/query',auth[_0xd01c('0x9')](),controller['query']);router[_0xd01c('0xd')]('/',auth[_0xd01c('0x9')](),controller[_0xd01c('0xe')]);router[_0xd01c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd01c('0x10')]);router[_0xd01c('0x11')](_0xd01c('0x12'),auth[_0xd01c('0x9')](),controller[_0xd01c('0x13')]);module[_0xd01c('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 78cc567..a1416a5 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 _0xeec6=['STRING','TEXT','sequelize','exports'];(function(_0x26964c,_0x167e0d){var _0x44fca=function(_0x57d484){while(--_0x57d484){_0x26964c['push'](_0x26964c['shift']());}};_0x44fca(++_0x167e0d);}(_0xeec6,0x1c2));var _0x6eec=function(_0x53b594,_0x559767){_0x53b594=_0x53b594-0x0;var _0x1e616f=_0xeec6[_0x53b594];return _0x1e616f;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6eec('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x6eec('0x2')]},'conditions':{'type':Sequelize[_0x6eec('0x3')]},'joins':{'type':Sequelize[_0x6eec('0x3')]}}; \ No newline at end of file +var _0x7fbe=['STRING','TEXT'];(function(_0x31f207,_0x33353a){var _0x1089ef=function(_0xdaaf31){while(--_0xdaaf31){_0x31f207['push'](_0x31f207['shift']());}};_0x1089ef(++_0x33353a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3fccbb,_0x473396){_0x3fccbb=_0x3fccbb-0x0;var _0x11df6e=_0x7fbe[_0x3fccbb];return _0x11df6e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xe7fb('0x0')]},'parent':{'type':Sequelize[_0xe7fb('0x0')]},'table':{'type':Sequelize[_0xe7fb('0x0')]},'conditions':{'type':Sequelize[_0xe7fb('0x1')]},'joins':{'type':Sequelize[_0xe7fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c99549c..b6dd923 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 _0x2542=['getFields','ValidationErrorItem','metric','format','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','sequelize','SELECT','run','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','save','destroy','then','get','end','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','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)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','replace','function','groupBy','orderBy','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value'];(function(_0x174a6c,_0x2818a0){var _0x5f37f9=function(_0x1e6e6c){while(--_0x1e6e6c){_0x174a6c['push'](_0x174a6c['shift']());}};_0x5f37f9(++_0x2818a0);}(_0x2542,0x169));var _0x2254=function(_0x563e46,_0x127714){_0x563e46=_0x563e46-0x0;var _0x18b414=_0x2542[_0x563e46];return _0x18b414;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];var dbH=require(_0x2254('0x19'))[_0x2254('0x1a')];function respondWithStatusCode(_0x3c326b,_0x381efe){_0x381efe=_0x381efe||0xcc;return function(_0x592a4f){if(_0x592a4f){return _0x3c326b[_0x2254('0x1b')](_0x381efe);}return _0x3c326b[_0x2254('0x1c')](_0x381efe)['end']();};}function respondWithResult(_0x2f4de,_0x1e582d){_0x1e582d=_0x1e582d||0xc8;return function(_0xfb23cb){if(_0xfb23cb){return _0x2f4de[_0x2254('0x1c')](_0x1e582d)[_0x2254('0x1d')](_0xfb23cb);}};}function respondWithFilteredResult(_0xbc5548,_0x50f137){return function(_0x18baf4){if(_0x18baf4){var _0x57247a=typeof _0x50f137[_0x2254('0x1e')]===_0x2254('0x1f')&&typeof _0x50f137[_0x2254('0x20')]===_0x2254('0x1f');var _0x1ae11e=_0x18baf4[_0x2254('0x21')];var _0x497724=_0x57247a?0x0:_0x50f137['offset'];var _0x5ec98d=_0x57247a?_0x18baf4[_0x2254('0x21')]:_0x50f137[_0x2254('0x1e')]+_0x50f137[_0x2254('0x20')];var _0x1f1163;if(_0x5ec98d>=_0x1ae11e){_0x5ec98d=_0x1ae11e;_0x1f1163=0xc8;}else{_0x1f1163=0xce;}_0xbc5548[_0x2254('0x1c')](_0x1f1163);return _0xbc5548[_0x2254('0x22')]('Content-Range',_0x497724+'-'+_0x5ec98d+'/'+_0x1ae11e)[_0x2254('0x1d')](_0x18baf4);}return null;};}function patchUpdates(_0x16148d){return function(_0x906cde){try{jsonpatch['apply'](_0x906cde,_0x16148d,!![]);}catch(_0x52fedc){return BPromise['reject'](_0x52fedc);}return _0x906cde[_0x2254('0x23')]();};}function saveUpdates(_0x559af4,_0xf88b56){return function(_0x56b91e){if(_0x56b91e){return _0x56b91e['update'](_0x559af4)['then'](function(_0x540020){return _0x540020;});}return null;};}function removeEntity(_0x5e5edb,_0x4f797d){return function(_0x1aa71f){if(_0x1aa71f){return _0x1aa71f[_0x2254('0x24')]()[_0x2254('0x25')](function(){var _0x265467=_0x1aa71f[_0x2254('0x26')]({'plain':!![]});var _0x1349c9='DefaultReports';return db['UserProfileResource'][_0x2254('0x24')]({'where':{'type':_0x1349c9,'resourceId':_0x265467['id']}})['then'](function(){return _0x1aa71f;});})[_0x2254('0x25')](function(){_0x5e5edb[_0x2254('0x1c')](0xcc)[_0x2254('0x27')]();});}};}function handleEntityNotFound(_0x3aa0bd,_0x19043b){return function(_0x482688){if(!_0x482688){_0x3aa0bd[_0x2254('0x1b')](0x194);}return _0x482688;};}function handleError(_0x2a789b,_0x21285d){_0x21285d=_0x21285d||0x1f4;return function(_0x37af8b){logger[_0x2254('0x28')](_0x37af8b[_0x2254('0x29')]);if(_0x37af8b[_0x2254('0x2a')]){delete _0x37af8b[_0x2254('0x2a')];}_0x2a789b[_0x2254('0x1c')](_0x21285d)[_0x2254('0x2b')](_0x37af8b);};}exports[_0x2254('0x2c')]=function(_0xad7774,_0x220f2a){var _0x27d30a={},_0x4577f4={},_0x1b16c8={'count':0x0,'rows':[]};var _0x2c929f=_[_0x2254('0x2d')](db[_0x2254('0x2e')]['rawAttributes'],function(_0xe29526){return{'name':_0xe29526[_0x2254('0x2f')],'type':_0xe29526[_0x2254('0x30')][_0x2254('0x31')]};});_0x4577f4[_0x2254('0x32')]=_[_0x2254('0x2d')](_0x2c929f,_0x2254('0x2a'));_0x4577f4[_0x2254('0x33')]=_[_0x2254('0x34')](_0xad7774['query']);_0x4577f4[_0x2254('0x35')]=_[_0x2254('0x36')](_0x4577f4['model'],_0x4577f4[_0x2254('0x33')]);_0x27d30a[_0x2254('0x37')]=_[_0x2254('0x36')](_0x4577f4[_0x2254('0x32')],qs['fields'](_0xad7774['query'][_0x2254('0x38')]));_0x27d30a['attributes']=_0x27d30a[_0x2254('0x37')][_0x2254('0x39')]?_0x27d30a[_0x2254('0x37')]:_0x4577f4[_0x2254('0x32')];if(!_0xad7774[_0x2254('0x33')][_0x2254('0x3a')](_0x2254('0x3b'))){_0x27d30a['limit']=qs[_0x2254('0x20')](_0xad7774[_0x2254('0x33')][_0x2254('0x20')]);_0x27d30a[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0xad7774[_0x2254('0x33')][_0x2254('0x1e')]);}_0x27d30a[_0x2254('0x3c')]=qs[_0x2254('0x3d')](_0xad7774[_0x2254('0x33')]['sort']);_0x27d30a[_0x2254('0x3e')]=qs[_0x2254('0x35')](_[_0x2254('0x3f')](_0xad7774[_0x2254('0x33')],_0x4577f4['filters']),_0x2c929f);if(_0xad7774[_0x2254('0x33')][_0x2254('0x40')]){_0x27d30a[_0x2254('0x3e')]=_[_0x2254('0x41')](_0x27d30a[_0x2254('0x3e')],{'$or':_[_0x2254('0x2d')](_0x2c929f,function(_0x423377){if(_0x423377[_0x2254('0x30')]!=='VIRTUAL'){var _0x362ad1={};_0x362ad1[_0x423377['name']]={'$like':'%'+_0xad7774[_0x2254('0x33')][_0x2254('0x40')]+'%'};return _0x362ad1;}})});}_0x27d30a=_[_0x2254('0x41')]({},_0x27d30a,_0xad7774[_0x2254('0x42')]);var _0x460bb3={'where':_0x27d30a[_0x2254('0x3e')]};return db[_0x2254('0x2e')]['count'](_0x460bb3)[_0x2254('0x25')](function(_0x2f1ff9){_0x1b16c8[_0x2254('0x21')]=_0x2f1ff9;if(_0xad7774[_0x2254('0x33')][_0x2254('0x43')]){_0x27d30a['include']=[{'all':!![]}];}return db[_0x2254('0x2e')][_0x2254('0x44')](_0x27d30a);})[_0x2254('0x25')](function(_0x135ed8){_0x1b16c8[_0x2254('0x45')]=_0x135ed8;return _0x1b16c8;})['then'](respondWithFilteredResult(_0x220f2a,_0x27d30a))[_0x2254('0x46')](handleError(_0x220f2a,null));};exports['show']=function(_0x91e091,_0x1ded9a){var _0xb4d042={'raw':!![],'where':{'id':_0x91e091[_0x2254('0x47')]['id']}},_0x31c31e={};_0x31c31e[_0x2254('0x32')]=_[_0x2254('0x34')](db[_0x2254('0x2e')][_0x2254('0x48')]);_0x31c31e[_0x2254('0x33')]=_[_0x2254('0x34')](_0x91e091[_0x2254('0x33')]);_0x31c31e[_0x2254('0x35')]=_['intersection'](_0x31c31e[_0x2254('0x32')],_0x31c31e[_0x2254('0x33')]);_0xb4d042[_0x2254('0x37')]=_['intersection'](_0x31c31e[_0x2254('0x32')],qs[_0x2254('0x38')](_0x91e091[_0x2254('0x33')][_0x2254('0x38')]));_0xb4d042[_0x2254('0x37')]=_0xb4d042[_0x2254('0x37')][_0x2254('0x39')]?_0xb4d042[_0x2254('0x37')]:_0x31c31e[_0x2254('0x32')];if(_0x91e091['query'][_0x2254('0x43')]){_0xb4d042[_0x2254('0x49')]=[{'all':!![]}];}_0xb4d042=_[_0x2254('0x41')]({},_0xb4d042,_0x91e091[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0xb4d042)[_0x2254('0x25')](handleEntityNotFound(_0x1ded9a,null))[_0x2254('0x25')](respondWithResult(_0x1ded9a,null))[_0x2254('0x46')](handleError(_0x1ded9a,null));};exports[_0x2254('0x4b')]=function(_0x5b14c5,_0x36b977){return db[_0x2254('0x2e')]['create'](_0x5b14c5[_0x2254('0x4c')],{})[_0x2254('0x25')](function(_0x12e2ff){var _0x4331a9=_0x5b14c5['user'][_0x2254('0x26')]({'plain':!![]});if(!_0x4331a9)throw new Error(_0x2254('0x4d'));if(_0x4331a9['role']===_0x2254('0x4e')){var _0x3f0670=_0x12e2ff[_0x2254('0x26')]({'plain':!![]});var _0x43bb88='Reports';return db[_0x2254('0x4f')][_0x2254('0x4a')]({'where':{'name':_0x43bb88,'userProfileId':_0x4331a9[_0x2254('0x50')]},'raw':!![]})['then'](function(_0x4cc18a){if(_0x4cc18a&&_0x4cc18a[_0x2254('0x51')]===0x0){return db[_0x2254('0x52')]['create']({'name':_0x3f0670[_0x2254('0x2a')],'resourceId':_0x3f0670['id'],'type':'DefaultReports','sectionId':_0x4cc18a['id']},{})['then'](function(){return _0x12e2ff;});}else{return _0x12e2ff;}})[_0x2254('0x46')](function(_0x135962){logger[_0x2254('0x28')](_0x2254('0x53'),_0x135962);throw _0x135962;});}return _0x12e2ff;})[_0x2254('0x25')](respondWithResult(_0x36b977,0xc9))['catch'](handleError(_0x36b977,null));};exports['update']=function(_0x1bd988,_0x5e3fbc){if(_0x1bd988[_0x2254('0x4c')]['id']){delete _0x1bd988[_0x2254('0x4c')]['id'];}return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x1bd988['params']['id']}})[_0x2254('0x25')](handleEntityNotFound(_0x5e3fbc,null))[_0x2254('0x25')](saveUpdates(_0x1bd988['body'],null))['then'](respondWithResult(_0x5e3fbc,null))[_0x2254('0x46')](handleError(_0x5e3fbc,null));};exports['destroy']=function(_0x2cc59c,_0x305ace){return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x2cc59c[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x305ace,null))['then'](removeEntity(_0x305ace,null))[_0x2254('0x46')](handleError(_0x305ace,null));};exports['preview']=function(_0x335c66,_0x510fe0){var _0x4da493=0xa;var _0x5999c8=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x13606e={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':_0x2254('0x5b'),'MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f391d={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x329378=function(_0xae171c){return!_[_0x2254('0x65')]([_0x2254('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2254('0x67')],_0xae171c);};var _0x423c17=function(_0x1d73a3){if(!_0x1d73a3||!_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x53b55b='(',_0x45b7bd=0x0;_0x45b7bd<_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')];_0x45b7bd+=0x1){_0x45b7bd>0x0&&(_0x53b55b+='\x20'+_0x1d73a3['operator']+'\x20');_0x53b55b+=_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]?_0x423c17(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]):_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['field']+'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd][_0x2254('0x6a')]+(_0x329378(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x6a')])?'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['value']:'');}return _0x53b55b+')';};var _0x5cc6bd={'where':{'id':_0x335c66['params']['id']}},_0xde4e7,_0xa159a4,_0x486b82,_0x506d95,_0x48406e;_0x5cc6bd=_[_0x2254('0x41')]({},_0x5cc6bd,_0x335c66['options']);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x5cc6bd)[_0x2254('0x25')](function(_0x1ed6b9){if(_0x1ed6b9){_0xde4e7=_0x1ed6b9;return _0x1ed6b9['getFields']();}return null;})[_0x2254('0x25')](function(_0x5ecf82){if(_0x5ecf82){if(!_0x5ecf82[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xa159a4=_0x5ecf82;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x3b3b20){if(_0x3b3b20){_0x486b82=_[_0x2254('0x6e')](_0x3b3b20,'id');var _0x3cefbe;var _0x4f77e5=squel[_0x2254('0x6f')]();_0x4f77e5[_0x2254('0x70')](_0xde4e7['table']);for(var _0x1ac8ff=0x0;_0x1ac8ff<_0xa159a4[_0x2254('0x39')];_0x1ac8ff+=0x1){_0x3cefbe=_0xa159a4[_0x1ac8ff]['MetricId']?_0x486b82[_0xa159a4[_0x1ac8ff][_0x2254('0x71')]]['metric']:_0xa159a4[_0x1ac8ff][_0x2254('0x72')];_0x3cefbe=_0xa159a4[_0x1ac8ff]['function']?_[_0x2254('0x73')](_0x13606e[_0xa159a4[_0x1ac8ff][_0x2254('0x74')]],'%s',_0x3cefbe):_0x3cefbe;_0x3cefbe=_0xa159a4[_0x1ac8ff]['format']?_[_0x2254('0x73')](_0x2f391d[_0xa159a4[_0x1ac8ff]['format']],'%s',_0x3cefbe):_0x3cefbe;if(_0xa159a4[_0x1ac8ff][_0x2254('0x75')]){_0x4f77e5[_0x2254('0x69')](_0x3cefbe);}_0xa159a4[_0x1ac8ff][_0x2254('0x76')]&&_0x4f77e5['order'](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x76')]==='DESC'?![]:!![]);_0x4f77e5[_0x2254('0x72')](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x77')]||_0x3cefbe);}if(_0xde4e7['joins']){_0xde4e7['joins']=JSON[_0x2254('0x78')](_0xde4e7[_0x2254('0x79')]);for(var _0x451520=0x0;_0x451520<_0xde4e7[_0x2254('0x79')]['length'];_0x451520+=0x1){if(_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x5999c8,_0xde4e7[_0x2254('0x79')][_0x451520]['type'])&&_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7a')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7b')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7c')]){_0x4f77e5[_0xde4e7['joins'][_0x451520]['type']](_0xde4e7['joins'][_0x451520][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0xde4e7[_0x2254('0x7e')],_0xde4e7['joins'][_0x451520][_0x2254('0x7a')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7b')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7c')]));}}}if(_0xde4e7[_0x2254('0x7f')]){_0xde4e7['conditions']=JSON['parse'](_0xde4e7[_0x2254('0x7f')]);_0x4f77e5[_0x2254('0x3e')](_0x423c17(_0xde4e7[_0x2254('0x7f')][_0x2254('0x69')]));}_0x48406e=_0x4f77e5[_0x2254('0x80')]();_0x4f77e5[_0x2254('0x20')](_0x4da493);_0x4f77e5[_0x2254('0x1e')](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4f77e5[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4f77e5[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')]['SELECT']});}})[_0x2254('0x25')](respondWithResult(_0x510fe0,null))[_0x2254('0x46')](handleError(_0x510fe0,null));};function runReport(_0x4dfcb4,_0x1c317b,_0x4e699c){var _0x2ad519=_0x1c317b[_0x2254('0x2a')];var _0x30f2c9=0xa;var _0x1f7a48=['join',_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x3a8d4f={'SUM':'SUM(%s)','COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f3650={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x251d70=function(_0x2c7705){return!_['includes']([_0x2254('0x66'),'IS\x20NOT\x20NULL',_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x2c7705);};var _0x36d121=function(_0x207a09){if(!_0x207a09||!_0x207a09[_0x2254('0x68')]['length']){return'';}for(var _0x8a3656='(',_0x1554f1=0x0;_0x1554f1<_0x207a09[_0x2254('0x68')][_0x2254('0x39')];_0x1554f1+=0x1){_0x1554f1>0x0&&(_0x8a3656+='\x20'+_0x207a09[_0x2254('0x87')]+'\x20');_0x8a3656+=_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]?_0x36d121(_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]):_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x72')]+'\x20'+_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x6a')]+(_0x251d70(_0x207a09['rules'][_0x1554f1][_0x2254('0x6a')])?'\x20'+_0x207a09['rules'][_0x1554f1][_0x2254('0x88')]:'');}return _0x8a3656+')';};var _0xb98b40={'where':{'id':_0x4dfcb4['id']}},_0x3b1d5c,_0x2c907a,_0x23b78c,_0x2b5dba,_0x30307a;_0xb98b40=_['merge']({},_0xb98b40,_0x4e699c);return db[_0x2254('0x2e')]['find'](_0xb98b40)[_0x2254('0x25')](function(_0x52712d){if(_0x52712d){_0x3b1d5c=_0x52712d;return _0x52712d[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x1d0c8f){if(_0x1d0c8f){if(!_0x1d0c8f['length']){throw new db[(_0x2254('0x6b'))][(_0x2254('0x8a'))](_0x2254('0x6c'),0x193);}_0x2c907a=_0x1d0c8f;return db[_0x2254('0x6d')][_0x2254('0x44')]({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x34185c){if(_0x34185c){_0x23b78c=_[_0x2254('0x6e')](_0x34185c,'id');var _0x5e94b6;var _0x56239e=squel[_0x2254('0x6f')]();_0x56239e['from'](_0x3b1d5c[_0x2254('0x7e')]);for(var _0x3a1365=0x0;_0x3a1365<_0x2c907a[_0x2254('0x39')];_0x3a1365+=0x1){_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x71')]?_0x23b78c[_0x2c907a[_0x3a1365][_0x2254('0x71')]][_0x2254('0x8b')]:_0x2c907a[_0x3a1365][_0x2254('0x72')];_0x5e94b6=_0x2c907a[_0x3a1365]['function']?_[_0x2254('0x73')](_0x3a8d4f[_0x2c907a[_0x3a1365][_0x2254('0x74')]],'%s',_0x5e94b6):_0x5e94b6;_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x8c')]?_['replace'](_0x2f3650[_0x2c907a[_0x3a1365][_0x2254('0x8c')]],'%s',_0x5e94b6):_0x5e94b6;if(_0x2c907a[_0x3a1365][_0x2254('0x75')]){_0x56239e[_0x2254('0x69')](_0x5e94b6);}_0x2c907a[_0x3a1365][_0x2254('0x76')]&&_0x56239e[_0x2254('0x3c')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x56239e[_0x2254('0x72')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x77')]||_0x5e94b6);}if(_0x3b1d5c['joins']){_0x3b1d5c[_0x2254('0x79')]=JSON[_0x2254('0x78')](_0x3b1d5c['joins']);for(var _0x4cec5b=0x0;_0x4cec5b<_0x3b1d5c[_0x2254('0x79')]['length'];_0x4cec5b+=0x1){if(_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x1f7a48,_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')])&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7a')]&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b]['foreignTable']&&_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7c')]){_0x56239e[_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]](_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3b1d5c[_0x2254('0x7e')],_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7a')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7c')]));}}}if(_0x3b1d5c[_0x2254('0x7f')]){_0x3b1d5c[_0x2254('0x7f')]=JSON['parse'](_0x3b1d5c[_0x2254('0x7f')]);_0x56239e[_0x2254('0x3e')](_0x36d121(_0x3b1d5c['conditions'][_0x2254('0x69')]));}_0x30307a=_0x56239e[_0x2254('0x80')]();_0x56239e[_0x2254('0x20')](_0x30f2c9);_0x56239e[_0x2254('0x1e')](0x0);return;}})[_0x2254('0x25')](function(){if(_0x1c317b[_0x2254('0x8e')]===_0x2254('0x8f')){return null;}var _0x38e2df=_[_0x2254('0x41')](_0x1c317b,{'name':_0x1c317b[_0x2254('0x90')]||_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c['name'],'basename':_0x2ad519,'savename':util[_0x2254('0x8c')](_0x2254('0x91'),_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c[_0x2254('0x2a')],require(_0x2254('0x92'))[_0x2254('0x93')](0x4),_0x1c317b[_0x2254('0x8e')]||'csv'),'reportId':_0x3b1d5c['id'],'reportType':_0x2254('0x94')});return db[_0x2254('0x95')][_0x2254('0x4b')](_0x38e2df,{'raw':!![]});})['then'](function(_0x60f5ac){if(_0x3b1d5c[_0x2254('0x7e')]===_0x2254('0x96')){_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x97'),_0x1c317b['startDate'],_0x1c317b[_0x2254('0x98')]);}else{_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x99'),_0x1c317b[_0x2254('0x9a')],_0x1c317b['endDate']);}if(_0x60f5ac){logger['info'](_0x2254('0x9b'),_0x30307a['toString']());require(_0x2254('0x9c'))[_0x2254('0x9d')](path[_0x2254('0x54')](__dirname,_0x2254('0x9e'),_0x60f5ac[_0x2254('0x8e')]),[_0x60f5ac['id'],_0x30307a[_0x2254('0x83')](),path['join'](__dirname,'../../files/reports',_0x60f5ac[_0x2254('0x9f')]),_0x2ad519]);return _0x60f5ac;}else{var _0x3317d4=squel[_0x2254('0x6f')]();_0x3317d4[_0x2254('0x70')]('('+_0x30307a['toString']()+')',_0x2254('0xa0'));_0x3317d4[_0x2254('0x72')](_0x2254('0xa1'),_0x2254('0x21'));_0x30307a[_0x2254('0x20')](_0x1c317b[_0x2254('0x20')]||_0x30f2c9);_0x30307a[_0x2254('0x1e')](_0x1c317b[_0x2254('0x1e')]||0x0);return dbH[_0x2254('0xa2')]['query'](_0x3317d4[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')]['SELECT']})[_0x2254('0x25')](function(_0xe38a28){if(!_0xe38a28[_0x2254('0x39')]){_0x2b5dba=0x0;}else{_0x2b5dba=_0xe38a28[0x0]['count']||0x0;}return dbH['sequelize'][_0x2254('0x33')](_0x30307a[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')][_0x2254('0xa3')]});})[_0x2254('0x25')](function(_0x4011de){return{'rows':_0x4011de||[],'count':_0x2b5dba};});}});}exports[_0x2254('0xa4')]=function(_0x5cb3d1,_0x1d8238){return runReport(_0x5cb3d1[_0x2254('0x47')],_0x5cb3d1[_0x2254('0x33')],_0x5cb3d1[_0x2254('0x42')])[_0x2254('0x25')](respondWithResult(_0x1d8238,null))[_0x2254('0x46')](handleError(_0x1d8238,null));};exports['runReport']=runReport;exports['query']=function(_0x40339d,_0x4b3b96){var _0x59b8af=0xa;var _0x408695=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),'cross_join'];var _0x596eae={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x739a29={'SEC_TO_TIME':_0x2254('0x61'),'DATE':'DATE(%s)','HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x243466=function(_0x1b8587){return!_[_0x2254('0x65')]([_0x2254('0x66'),_0x2254('0xa5'),_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x1b8587);};var _0xbec5d0=function(_0x18f841){if(!_0x18f841||!_0x18f841[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x275b56='(',_0x315add=0x0;_0x315add<_0x18f841['rules']['length'];_0x315add+=0x1){_0x315add>0x0&&(_0x275b56+='\x20'+_0x18f841[_0x2254('0x87')]+'\x20');_0x275b56+=_0x18f841['rules'][_0x315add][_0x2254('0x69')]?_0xbec5d0(_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x69')]):_0x18f841[_0x2254('0x68')][_0x315add]['field']+'\x20'+_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x6a')]+(_0x243466(_0x18f841[_0x2254('0x68')][_0x315add]['condition'])?'\x20'+_0x18f841['rules'][_0x315add][_0x2254('0x88')]:'');}return _0x275b56+')';};var _0x51b02a={'where':{'id':_0x40339d[_0x2254('0x47')]['id']}},_0x3e7642,_0xe1abb6,_0x1a44d0,_0x4af6a7,_0x539aba;_0x51b02a=_[_0x2254('0x41')]({},_0x51b02a,_0x40339d[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x51b02a)['then'](function(_0x34e28b){if(_0x34e28b){_0x3e7642=_0x34e28b;return _0x34e28b[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x5d373){if(_0x5d373){if(!_0x5d373[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xe1abb6=_0x5d373;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x56a7ce){if(_0x56a7ce){_0x1a44d0=_[_0x2254('0x6e')](_0x56a7ce,'id');var _0x34bf19;var _0x4965c7=squel[_0x2254('0x6f')]();_0x4965c7[_0x2254('0x70')](_0x3e7642[_0x2254('0x7e')]);for(var _0x45541b=0x0;_0x45541b<_0xe1abb6[_0x2254('0x39')];_0x45541b+=0x1){_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x71')]?_0x1a44d0[_0xe1abb6[_0x45541b][_0x2254('0x71')]][_0x2254('0x8b')]:_0xe1abb6[_0x45541b][_0x2254('0x72')];_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x74')]?_[_0x2254('0x73')](_0x596eae[_0xe1abb6[_0x45541b][_0x2254('0x74')]],'%s',_0x34bf19):_0x34bf19;_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x8c')]?_[_0x2254('0x73')](_0x739a29[_0xe1abb6[_0x45541b]['format']],'%s',_0x34bf19):_0x34bf19;if(_0xe1abb6[_0x45541b][_0x2254('0x75')]){_0x4965c7[_0x2254('0x69')](_0x34bf19);}_0xe1abb6[_0x45541b]['orderBy']&&_0x4965c7['order'](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x4965c7[_0x2254('0x72')](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x77')]||_0x34bf19);}if(_0x3e7642['joins']){_0x3e7642[_0x2254('0x79')]=JSON['parse'](_0x3e7642['joins']);for(var _0x40fec0=0x0;_0x40fec0<_0x3e7642[_0x2254('0x79')][_0x2254('0x39')];_0x40fec0+=0x1){if(_0x3e7642[_0x2254('0x79')][_0x40fec0]['type']&&_[_0x2254('0x65')](_0x408695,_0x3e7642['joins'][_0x40fec0][_0x2254('0x30')])&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]){_0x4965c7[_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x30')]](_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0x3e7642[_0x2254('0x7e')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]));}}}if(_0x3e7642['conditions']){_0x3e7642[_0x2254('0x7f')]=JSON[_0x2254('0x78')](_0x3e7642[_0x2254('0x7f')]);_0x4965c7[_0x2254('0x3e')](_0xbec5d0(_0x3e7642[_0x2254('0x7f')]['group']));}_0x539aba=_0x4965c7[_0x2254('0x80')]();_0x4965c7[_0x2254('0x20')](_0x59b8af);_0x4965c7['offset'](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4965c7[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4965c7[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')][_0x2254('0xa3')]});}})[_0x2254('0x25')](function(){return{'sql':_0x539aba[_0x2254('0x83')]()};})['then'](respondWithResult(_0x4b3b96,null))[_0x2254('0x46')](handleError(_0x4b3b96,null));}; \ No newline at end of file +var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x3f922a,_0x405a7e){var _0xed5abb=function(_0x54f9f1){while(--_0x54f9f1){_0x3f922a['push'](_0x3f922a['shift']());}};_0xed5abb(++_0x405a7e);}(_0xf494,0x1c6));var _0x4f49=function(_0x47077d,_0x16ad9f){_0x47077d=_0x47077d-0x0;var _0x2cf416=_0xf494[_0x47077d];return _0x2cf416;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f33d4c9..95e5b66 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 _0x0759=['api','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','util'];(function(_0x5a7dcf,_0x233849){var _0x5ca6b6=function(_0x1aef7d){while(--_0x1aef7d){_0x5a7dcf['push'](_0x5a7dcf['shift']());}};_0x5ca6b6(++_0x233849);}(_0x0759,0x167));var _0x9075=function(_0x3926d,_0x4e2a07){_0x3926d=_0x3926d-0x0;var _0x1add48=_0x0759[_0x3926d];return _0x1add48;};'use strict';var _=require('lodash');var util=require(_0x9075('0x0'));var logger=require('../../config/logger')(_0x9075('0x1'));var moment=require('moment');var BPromise=require(_0x9075('0x2'));var rp=require(_0x9075('0x3'));var fs=require('fs');var path=require(_0x9075('0x4'));var rimraf=require(_0x9075('0x5'));var config=require('../../config/environment');var attributes=require(_0x9075('0x6'));module[_0x9075('0x7')]=function(_0x17a95c,_0x5b4abe){return _0x17a95c[_0x9075('0x8')](_0x9075('0x9'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e39=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticDefaultReport','analytics_default_reports','util'];(function(_0x3f14cc,_0x4ec13e){var _0x494737=function(_0x1bd326){while(--_0x1bd326){_0x3f14cc['push'](_0x3f14cc['shift']());}};_0x494737(++_0x4ec13e);}(_0x5e39,0x78));var _0x95e3=function(_0x34cf01,_0x226b5c){_0x34cf01=_0x34cf01-0x0;var _0x3d3fca=_0x5e39[_0x34cf01];return _0x3d3fca;};'use strict';var _=require('lodash');var util=require(_0x95e3('0x0'));var logger=require(_0x95e3('0x1'))(_0x95e3('0x2'));var moment=require('moment');var BPromise=require(_0x95e3('0x3'));var rp=require(_0x95e3('0x4'));var fs=require('fs');var path=require(_0x95e3('0x5'));var rimraf=require(_0x95e3('0x6'));var config=require(_0x95e3('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x95e3('0x8')]=function(_0xc40ba7,_0x56a7b9){return _0xc40ba7['define'](_0x95e3('0x9'),attributes,{'tableName':_0x95e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index f190ac9..b0c1e3e 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 _0x27bd=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x27bd,0x12a));var _0xd27b=function(_0xbd82fc,_0xca905c){_0xbd82fc=_0xbd82fc-0x0;var _0x4859ed=_0x27bd[_0xbd82fc];return _0x4859ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd27b('0x0'));var BPromise=require('bluebird');var rs=require(_0xd27b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd27b('0x2'))(_0xd27b('0x3'));var config=require(_0xd27b('0x4'));var jayson=require(_0xd27b('0x5'));var client=jayson['client'][_0xd27b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x468dbb,_0x2bc99c,_0x53d04f){return new BPromise(function(_0xec0675,_0x513b20){return client[_0xd27b('0x7')](_0x468dbb,_0x53d04f)[_0xd27b('0x8')](function(_0x59c160){logger[_0xd27b('0x9')](_0xd27b('0xa'),_0x2bc99c,_0xd27b('0xb'));logger[_0xd27b('0xc')](_0xd27b('0xd'),_0x2bc99c,_0xd27b('0xb'),JSON['stringify'](_0x59c160));if(_0x59c160['error']){if(_0x59c160[_0xd27b('0xe')]['code']===0x1f4){logger[_0xd27b('0xe')](_0xd27b('0xa'),_0x2bc99c,_0x59c160[_0xd27b('0xe')][_0xd27b('0xf')]);return _0x513b20(_0x59c160['error'][_0xd27b('0xf')]);}logger['error'](_0xd27b('0xa'),_0x2bc99c,_0x59c160[_0xd27b('0xe')][_0xd27b('0xf')]);return _0xec0675(_0x59c160[_0xd27b('0xe')]['message']);}else{logger[_0xd27b('0x9')](_0xd27b('0xa'),_0x2bc99c,_0xd27b('0xb'));_0xec0675(_0x59c160[_0xd27b('0x10')]['message']);}})[_0xd27b('0x11')](function(_0x250ed3){logger[_0xd27b('0xe')](_0xd27b('0xa'),_0x2bc99c,_0x250ed3);_0x513b20(_0x250ed3);});});} \ No newline at end of file +var _0x3c67=['request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x241066,_0x259d25){var _0x154003=function(_0x6b9d0d){while(--_0x6b9d0d){_0x241066['push'](_0x241066['shift']());}};_0x154003(++_0x259d25);}(_0x3c67,0x10d));var _0x73c6=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x3c67[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x73c6('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73c6('0x1'));var db=require(_0x73c6('0x2'))['db'];var utils=require(_0x73c6('0x3'));var logger=require(_0x73c6('0x4'))(_0x73c6('0x5'));var config=require(_0x73c6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x73c6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c1687,_0x1a93ca,_0x138b69){return new BPromise(function(_0x18df16,_0x102f07){return client[_0x73c6('0x8')](_0x2c1687,_0x138b69)[_0x73c6('0x9')](function(_0x10dda3){logger['info'](_0x73c6('0xa'),_0x1a93ca,_0x73c6('0xb'));logger[_0x73c6('0xc')](_0x73c6('0xd'),_0x1a93ca,'request\x20sent',JSON[_0x73c6('0xe')](_0x10dda3));if(_0x10dda3['error']){if(_0x10dda3[_0x73c6('0xf')]['code']===0x1f4){logger[_0x73c6('0xf')](_0x73c6('0xa'),_0x1a93ca,_0x10dda3['error'][_0x73c6('0x10')]);return _0x102f07(_0x10dda3['error']['message']);}logger[_0x73c6('0xf')](_0x73c6('0xa'),_0x1a93ca,_0x10dda3[_0x73c6('0xf')][_0x73c6('0x10')]);return _0x18df16(_0x10dda3[_0x73c6('0xf')][_0x73c6('0x10')]);}else{logger[_0x73c6('0x11')](_0x73c6('0xa'),_0x1a93ca,'request\x20sent');_0x18df16(_0x10dda3[_0x73c6('0x12')]['message']);}})[_0x73c6('0x13')](function(_0x34ba56){logger['error'](_0x73c6('0xa'),_0x1a93ca,_0x34ba56);_0x102f07(_0x34ba56);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c951d06..d0e0a7a 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 _0xc21d=['../../config/environment','get','isAuthenticated','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x68359d,_0x51477f){var _0x15d875=function(_0x5efef8){while(--_0x5efef8){_0x68359d['push'](_0x68359d['shift']());}};_0x15d875(++_0x51477f);}(_0xc21d,0xdf));var _0xdc21=function(_0x29678a,_0xd09044){_0x29678a=_0x29678a-0x0;var _0xd762b6=_0xc21d[_0x29678a];return _0xd762b6;};'use strict';var multer=require(_0xdc21('0x0'));var util=require(_0xdc21('0x1'));var path=require(_0xdc21('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc21('0x3'));var router=express[_0xdc21('0x4')]();var fs_extra=require(_0xdc21('0x5'));var auth=require(_0xdc21('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc21('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0xdc21('0x8')]('/',auth[_0xdc21('0x9')](),controller['index']);router['get'](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0xb')]);router[_0xdc21('0x8')](_0xdc21('0xc'),auth[_0xdc21('0x9')](),controller['preview']);router['get'](_0xdc21('0xd'),auth['isAuthenticated'](),controller[_0xdc21('0xe')]);router[_0xdc21('0x8')](_0xdc21('0xf'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x10')]);router[_0xdc21('0x11')]('/',auth[_0xdc21('0x9')](),controller[_0xdc21('0x12')]);router[_0xdc21('0x13')](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x14')]);router['delete'](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x15')]);module[_0xdc21('0x16')]=router; \ No newline at end of file +var _0x204c=['show','/:id/preview','isAuthenticated','/:id/run','run','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id'];(function(_0xa6fdc4,_0x592600){var _0x54cd78=function(_0x280660){while(--_0x280660){_0xa6fdc4['push'](_0xa6fdc4['shift']());}};_0x54cd78(++_0x592600);}(_0x204c,0xdc));var _0xc204=function(_0x599c13,_0x3a49c6){_0x599c13=_0x599c13-0x0;var _0x163768=_0x204c[_0x599c13];return _0x163768;};'use strict';var multer=require(_0xc204('0x0'));var util=require(_0xc204('0x1'));var path=require(_0xc204('0x2'));var timeout=require(_0xc204('0x3'));var express=require(_0xc204('0x4'));var router=express[_0xc204('0x5')]();var fs_extra=require(_0xc204('0x6'));var auth=require(_0xc204('0x7'));var interaction=require(_0xc204('0x8'));var config=require(_0xc204('0x9'));var controller=require(_0xc204('0xa'));router[_0xc204('0xb')]('/',auth['isAuthenticated'](),controller[_0xc204('0xc')]);router[_0xc204('0xb')](_0xc204('0xd'),auth['isAuthenticated'](),controller[_0xc204('0xe')]);router['get'](_0xc204('0xf'),auth[_0xc204('0x10')](),controller['preview']);router[_0xc204('0xb')](_0xc204('0x11'),auth[_0xc204('0x10')](),controller[_0xc204('0x12')]);router[_0xc204('0xb')]('/:id/query',auth[_0xc204('0x10')](),controller[_0xc204('0x13')]);router[_0xc204('0x14')]('/',auth['isAuthenticated'](),controller[_0xc204('0x15')]);router['put']('/:id',auth[_0xc204('0x10')](),controller[_0xc204('0x16')]);router[_0xc204('0x17')]('/:id',auth[_0xc204('0x10')](),controller[_0xc204('0x18')]);module[_0xc204('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index fbdfe34..2a73597 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 _0x9f58=['pdf','xlsx','csv','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM'];(function(_0x2c931f,_0x12d1c9){var _0x5f1470=function(_0x3b5d03){while(--_0x3b5d03){_0x2c931f['push'](_0x2c931f['shift']());}};_0x5f1470(++_0x12d1c9);}(_0x9f58,0x167));var _0x89f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f58[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x89f5('0x0'));var moment=require(_0x89f5('0x1'));module[_0x89f5('0x2')]={'name':{'type':Sequelize[_0x89f5('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x89f5('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x89f5('0x4')]('csv',_0x89f5('0x5'),_0x89f5('0x6')),'allowNull':![],'defaultValue':_0x89f5('0x7')},'savename':{'type':Sequelize[_0x89f5('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x89f5('0x8')]},'status':{'type':Sequelize[_0x89f5('0x3')],'defaultValue':_0x89f5('0x9')},'type':{'type':Sequelize[_0x89f5('0x4')](_0x89f5('0xa'),_0x89f5('0xb')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x89f5('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0e1e=['Loading','manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x3ed0df,_0x1c8083){var _0x47cee4=function(_0x11e879){while(--_0x11e879){_0x3ed0df['push'](_0x3ed0df['shift']());}};_0x47cee4(++_0x1c8083);}(_0x0e1e,0x7a));var _0xe0e1=function(_0x579982,_0x4efe5b){_0x579982=_0x579982-0x0;var _0x1e6345=_0x0e1e[_0x579982];return _0x1e6345;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe0e1('0x0'));module[_0xe0e1('0x1')]={'name':{'type':Sequelize[_0xe0e1('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xe0e1('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xe0e1('0x3')](_0xe0e1('0x4'),_0xe0e1('0x5'),_0xe0e1('0x6')),'allowNull':![],'defaultValue':_0xe0e1('0x4')},'savename':{'type':Sequelize[_0xe0e1('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe0e1('0x7')]},'endDate':{'type':Sequelize[_0xe0e1('0x7')]},'status':{'type':Sequelize[_0xe0e1('0x2')],'defaultValue':_0xe0e1('0x8')},'type':{'type':Sequelize[_0xe0e1('0x3')](_0xe0e1('0x9'),_0xe0e1('0xa')),'allowNull':![],'defaultValue':_0xe0e1('0x9')},'reportId':{'type':Sequelize[_0xe0e1('0xb')](0xb)[_0xe0e1('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 73dcd7c..b7aa167 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 _0xefe2=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','existsSync','join','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','output','eml-format','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefe2,0x19f));var _0x2efe=function(_0x101013,_0x1c64ed){_0x101013=_0x101013-0x0;var _0x40d26b=_0xefe2[_0x101013];return _0x40d26b;};'use strict';var emlformat=require(_0x2efe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2efe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2efe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2efe('0x3'));var util=require(_0x2efe('0x4'));var path=require('path');var sox=require(_0x2efe('0x5'));var csv=require(_0x2efe('0x6'));var ejs=require(_0x2efe('0x7'));var fs=require('fs');var fs_extra=require(_0x2efe('0x8'));var _=require('lodash');var squel=require(_0x2efe('0x9'));var crypto=require(_0x2efe('0xa'));var jsforce=require(_0x2efe('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2efe('0x6'));var querystring=require('querystring');var Papa=require(_0x2efe('0xc'));var Redis=require(_0x2efe('0xd'));var authService=require(_0x2efe('0xe'));var qs=require(_0x2efe('0xf'));var as=require(_0x2efe('0x10'));var hardwareService=require(_0x2efe('0x11'));var logger=require('../../config/logger')(_0x2efe('0x12'));var utils=require(_0x2efe('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2efe('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x404a96,_0x291719){_0x291719=_0x291719||0xcc;return function(_0x3bda91){if(_0x3bda91){return _0x404a96[_0x2efe('0x15')](_0x291719);}return _0x404a96[_0x2efe('0x16')](_0x291719)[_0x2efe('0x17')]();};}function respondWithResult(_0x25b2c2,_0x4bab36){_0x4bab36=_0x4bab36||0xc8;return function(_0x39a608){if(_0x39a608){return _0x25b2c2[_0x2efe('0x16')](_0x4bab36)[_0x2efe('0x18')](_0x39a608);}};}function respondWithFilteredResult(_0x5f158b,_0xd8c448){return function(_0x4e5bb){if(_0x4e5bb){var _0x30b43b=typeof _0xd8c448[_0x2efe('0x19')]===_0x2efe('0x1a')&&typeof _0xd8c448[_0x2efe('0x1b')]==='undefined';var _0x3f70be=_0x4e5bb['count'];var _0x10c5a8=_0x30b43b?0x0:_0xd8c448[_0x2efe('0x19')];var _0x8652eb=_0x30b43b?_0x4e5bb[_0x2efe('0x1c')]:_0xd8c448[_0x2efe('0x19')]+_0xd8c448[_0x2efe('0x1b')];var _0x333abb;if(_0x8652eb>=_0x3f70be){_0x8652eb=_0x3f70be;_0x333abb=0xc8;}else{_0x333abb=0xce;}_0x5f158b[_0x2efe('0x16')](_0x333abb);return _0x5f158b[_0x2efe('0x1d')]('Content-Range',_0x10c5a8+'-'+_0x8652eb+'/'+_0x3f70be)[_0x2efe('0x18')](_0x4e5bb);}return null;};}function patchUpdates(_0x3647fc){return function(_0x326321){try{jsonpatch[_0x2efe('0x1e')](_0x326321,_0x3647fc,!![]);}catch(_0x95049b){return BPromise[_0x2efe('0x1f')](_0x95049b);}return _0x326321[_0x2efe('0x20')]();};}function saveUpdates(_0x32a55a,_0x390ba3){return function(_0x5accf3){if(_0x5accf3){return _0x5accf3['update'](_0x32a55a)[_0x2efe('0x21')](function(_0x3cfe31){return _0x3cfe31;});}return null;};}function removeEntity(_0x1452be,_0x33cb7f){return function(_0x1c9b64){if(_0x1c9b64){return _0x1c9b64[_0x2efe('0x22')]()[_0x2efe('0x21')](function(){var _0x5e6d5=_0x1c9b64[_0x2efe('0x23')]({'plain':!![]});var _0x2c54d5='ExtractedReports';return db['UserProfileResource'][_0x2efe('0x22')]({'where':{'type':_0x2c54d5,'resourceId':_0x5e6d5['id']}})[_0x2efe('0x21')](function(){return _0x1c9b64;});})[_0x2efe('0x21')](function(){_0x1452be[_0x2efe('0x16')](0xcc)[_0x2efe('0x17')]();});}};}function handleEntityNotFound(_0x1fcf9b,_0x5aecb4){return function(_0x5150a4){if(!_0x5150a4){_0x1fcf9b['sendStatus'](0x194);}return _0x5150a4;};}function handleError(_0x48990c,_0x147439){_0x147439=_0x147439||0x1f4;return function(_0x4a02fa){logger['error'](_0x4a02fa[_0x2efe('0x24')]);if(_0x4a02fa[_0x2efe('0x25')]){delete _0x4a02fa['name'];}_0x48990c[_0x2efe('0x16')](_0x147439)[_0x2efe('0x26')](_0x4a02fa);};}exports[_0x2efe('0x27')]=function(_0x3fe097,_0x272734){var _0x4decdb={},_0x48d07b={},_0x1c1a17={'count':0x0,'rows':[]};var _0x2a3d35=_[_0x2efe('0x28')](db[_0x2efe('0x29')][_0x2efe('0x2a')],function(_0x397cef){return{'name':_0x397cef[_0x2efe('0x2b')],'type':_0x397cef[_0x2efe('0x2c')][_0x2efe('0x2d')]};});_0x48d07b['model']=_['map'](_0x2a3d35,_0x2efe('0x25'));_0x48d07b[_0x2efe('0x2e')]=_[_0x2efe('0x2f')](_0x3fe097[_0x2efe('0x2e')]);_0x48d07b[_0x2efe('0x30')]=_[_0x2efe('0x31')](_0x48d07b[_0x2efe('0x32')],_0x48d07b['query']);_0x4decdb[_0x2efe('0x33')]=_['intersection'](_0x48d07b[_0x2efe('0x32')],qs[_0x2efe('0x34')](_0x3fe097[_0x2efe('0x2e')][_0x2efe('0x34')]));_0x4decdb['attributes']=_0x4decdb[_0x2efe('0x33')][_0x2efe('0x35')]?_0x4decdb[_0x2efe('0x33')]:_0x48d07b[_0x2efe('0x32')];if(!_0x3fe097[_0x2efe('0x2e')][_0x2efe('0x36')](_0x2efe('0x37'))){_0x4decdb[_0x2efe('0x1b')]=qs['limit'](_0x3fe097[_0x2efe('0x2e')]['limit']);_0x4decdb['offset']=qs[_0x2efe('0x19')](_0x3fe097[_0x2efe('0x2e')][_0x2efe('0x19')]);}_0x4decdb[_0x2efe('0x38')]=qs[_0x2efe('0x39')](_0x3fe097[_0x2efe('0x2e')][_0x2efe('0x39')]);_0x4decdb[_0x2efe('0x3a')]=qs[_0x2efe('0x30')](_['pick'](_0x3fe097[_0x2efe('0x2e')],_0x48d07b[_0x2efe('0x30')]),_0x2a3d35);if(_0x3fe097[_0x2efe('0x2e')][_0x2efe('0x3b')]){_0x4decdb['where']=_[_0x2efe('0x3c')](_0x4decdb[_0x2efe('0x3a')],{'$or':_[_0x2efe('0x28')](_0x2a3d35,function(_0xdd9e87){if(_0xdd9e87[_0x2efe('0x2c')]!==_0x2efe('0x3d')){var _0x410a1b={};_0x410a1b[_0xdd9e87['name']]={'$like':'%'+_0x3fe097['query']['filter']+'%'};return _0x410a1b;}})});}_0x4decdb=_[_0x2efe('0x3c')]({},_0x4decdb,_0x3fe097[_0x2efe('0x3e')]);var _0x267bdc={'where':_0x4decdb['where']};return db[_0x2efe('0x29')][_0x2efe('0x1c')](_0x267bdc)[_0x2efe('0x21')](function(_0x188c21){_0x1c1a17[_0x2efe('0x1c')]=_0x188c21;if(_0x3fe097['query'][_0x2efe('0x3f')]){_0x4decdb[_0x2efe('0x40')]=[{'all':!![]}];}return db[_0x2efe('0x29')][_0x2efe('0x41')](_0x4decdb);})['then'](function(_0x18629d){_0x1c1a17[_0x2efe('0x42')]=_0x18629d;return _0x1c1a17;})[_0x2efe('0x21')](respondWithFilteredResult(_0x272734,_0x4decdb))['catch'](handleError(_0x272734,null));};exports[_0x2efe('0x43')]=function(_0x2eca8a,_0x18c125){var _0x57c1bd={'raw':!![],'where':{'id':_0x2eca8a[_0x2efe('0x44')]['id']}},_0x30e94c={};_0x30e94c['model']=_[_0x2efe('0x2f')](db['AnalyticExtractedReport'][_0x2efe('0x2a')]);_0x30e94c[_0x2efe('0x2e')]=_[_0x2efe('0x2f')](_0x2eca8a[_0x2efe('0x2e')]);_0x30e94c[_0x2efe('0x30')]=_[_0x2efe('0x31')](_0x30e94c[_0x2efe('0x32')],_0x30e94c[_0x2efe('0x2e')]);_0x57c1bd['attributes']=_[_0x2efe('0x31')](_0x30e94c['model'],qs[_0x2efe('0x34')](_0x2eca8a[_0x2efe('0x2e')]['fields']));_0x57c1bd['attributes']=_0x57c1bd[_0x2efe('0x33')][_0x2efe('0x35')]?_0x57c1bd[_0x2efe('0x33')]:_0x30e94c['model'];if(_0x2eca8a[_0x2efe('0x2e')]['includeAll']){_0x57c1bd[_0x2efe('0x40')]=[{'all':!![]}];}_0x57c1bd=_[_0x2efe('0x3c')]({},_0x57c1bd,_0x2eca8a[_0x2efe('0x3e')]);return db[_0x2efe('0x29')][_0x2efe('0x45')](_0x57c1bd)[_0x2efe('0x21')](handleEntityNotFound(_0x18c125,null))['then'](respondWithResult(_0x18c125,null))[_0x2efe('0x46')](handleError(_0x18c125,null));};exports[_0x2efe('0x47')]=function(_0xdfcdfc,_0xf5cb32){return db[_0x2efe('0x29')][_0x2efe('0x47')](_0xdfcdfc[_0x2efe('0x48')],{})['then'](function(_0x2574d4){var _0x2cabd2=_0xdfcdfc[_0x2efe('0x49')][_0x2efe('0x23')]({'plain':!![]});if(!_0x2cabd2)throw new Error(_0x2efe('0x4a'));if(_0x2cabd2[_0x2efe('0x4b')]==='user'){var _0x2b68ce=_0x2574d4['get']({'plain':!![]});var _0x196e47=_0x2efe('0x4c');return db[_0x2efe('0x4d')][_0x2efe('0x45')]({'where':{'name':_0x196e47,'userProfileId':_0x2cabd2[_0x2efe('0x4e')]},'raw':!![]})[_0x2efe('0x21')](function(_0x3c8cf6){if(_0x3c8cf6&&_0x3c8cf6[_0x2efe('0x4f')]===0x0){return db['UserProfileResource'][_0x2efe('0x47')]({'name':_0x2b68ce[_0x2efe('0x25')],'resourceId':_0x2b68ce['id'],'type':_0x3c8cf6[_0x2efe('0x25')],'sectionId':_0x3c8cf6['id']},{})[_0x2efe('0x21')](function(){return _0x2574d4;});}else{return _0x2574d4;}})[_0x2efe('0x46')](function(_0x5a4ce5){logger['error'](_0x2efe('0x50'),_0x5a4ce5);throw _0x5a4ce5;});}return _0x2574d4;})['then'](respondWithResult(_0xf5cb32,0xc9))[_0x2efe('0x46')](handleError(_0xf5cb32,null));};exports[_0x2efe('0x51')]=function(_0xdcb254,_0xe1c96e){if(_0xdcb254[_0x2efe('0x48')]['id']){delete _0xdcb254[_0x2efe('0x48')]['id'];}return db[_0x2efe('0x29')][_0x2efe('0x45')]({'where':{'id':_0xdcb254['params']['id']}})[_0x2efe('0x21')](handleEntityNotFound(_0xe1c96e,null))[_0x2efe('0x21')](saveUpdates(_0xdcb254[_0x2efe('0x48')],null))[_0x2efe('0x21')](respondWithResult(_0xe1c96e,null))[_0x2efe('0x46')](handleError(_0xe1c96e,null));};exports['destroy']=function(_0x28d724,_0x48adea){return db[_0x2efe('0x29')][_0x2efe('0x45')]({'where':{'id':_0x28d724[_0x2efe('0x44')]['id']}})['then'](handleEntityNotFound(_0x48adea,null))[_0x2efe('0x21')](removeEntity(_0x48adea,null))[_0x2efe('0x46')](handleError(_0x48adea,null));};exports[_0x2efe('0x52')]=function(_0x3ff6f8,_0x5227f3,_0x1900fb){return db[_0x2efe('0x29')]['find']({'where':{'id':_0x3ff6f8['params']['id']},'attributes':[_0x2efe('0x25'),'basename','savename','output'],'raw':!![]})[_0x2efe('0x21')](handleEntityNotFound(_0x5227f3,null))[_0x2efe('0x21')](function(_0x547903){if(_0x547903){if(!fs[_0x2efe('0x53')](path[_0x2efe('0x54')](config['root'],_0x2efe('0x55'),_0x547903[_0x2efe('0x56')]))){throw new db[(_0x2efe('0x57'))][(_0x2efe('0x58'))](_0x2efe('0x59'));}if(_0x3ff6f8[_0x2efe('0x2e')][_0x2efe('0x5a')]){return _0x5227f3[_0x2efe('0x15')](0xc8);}return _0x5227f3[_0x2efe('0x52')](path[_0x2efe('0x54')](config['root'],'server/files/reports',_0x547903[_0x2efe('0x56')]),util['format']('%s.%s',_0x547903['basename']||_0x547903[_0x2efe('0x25')],_0x547903[_0x2efe('0x5b')]['toLowerCase']()));}})[_0x2efe('0x46')](handleError(_0x5227f3,null));}; \ No newline at end of file +var _0x4089=['Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','output','toLowerCase','eml-format','fast-json-patch','request-promise','moment','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','sendStatus','name','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','type','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','root','server/files/reports','Sequelize','ValidationError'];(function(_0x3bca43,_0x1af273){var _0xc44228=function(_0x44db93){while(--_0x44db93){_0x3bca43['push'](_0x3bca43['shift']());}};_0xc44228(++_0x1af273);}(_0x4089,0x1bf));var _0x9408=function(_0x2af409,_0x54a91c){_0x2af409=_0x2af409-0x0;var _0x299b77=_0x4089[_0x2af409];return _0x299b77;};'use strict';var emlformat=require(_0x9408('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9408('0x1'));var rp=require(_0x9408('0x2'));var moment=require(_0x9408('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9408('0x4'));var sox=require(_0x9408('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9408('0x6'));var squel=require(_0x9408('0x7'));var crypto=require('crypto');var jsforce=require(_0x9408('0x8'));var deskjs=require(_0x9408('0x9'));var toCsv=require(_0x9408('0xa'));var querystring=require(_0x9408('0xb'));var Papa=require(_0x9408('0xc'));var Redis=require(_0x9408('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9408('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9408('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x9408('0x10'));var licenseUtil=require(_0x9408('0x11'));var db=require(_0x9408('0x12'))['db'];function respondWithStatusCode(_0x231d35,_0x20ea01){_0x20ea01=_0x20ea01||0xcc;return function(_0x39e11b){if(_0x39e11b){return _0x231d35['sendStatus'](_0x20ea01);}return _0x231d35[_0x9408('0x13')](_0x20ea01)[_0x9408('0x14')]();};}function respondWithResult(_0x2063bb,_0x9f3b2d){_0x9f3b2d=_0x9f3b2d||0xc8;return function(_0x1bf413){if(_0x1bf413){return _0x2063bb[_0x9408('0x13')](_0x9f3b2d)[_0x9408('0x15')](_0x1bf413);}};}function respondWithFilteredResult(_0x2469d2,_0x13eeb5){return function(_0x1e7d52){if(_0x1e7d52){var _0x37bb6d=typeof _0x13eeb5[_0x9408('0x16')]===_0x9408('0x17')&&typeof _0x13eeb5[_0x9408('0x18')]==='undefined';var _0x27c000=_0x1e7d52[_0x9408('0x19')];var _0x3c60b2=_0x37bb6d?0x0:_0x13eeb5['offset'];var _0x586874=_0x37bb6d?_0x1e7d52['count']:_0x13eeb5[_0x9408('0x16')]+_0x13eeb5['limit'];var _0x19d139;if(_0x586874>=_0x27c000){_0x586874=_0x27c000;_0x19d139=0xc8;}else{_0x19d139=0xce;}_0x2469d2[_0x9408('0x13')](_0x19d139);return _0x2469d2[_0x9408('0x1a')](_0x9408('0x1b'),_0x3c60b2+'-'+_0x586874+'/'+_0x27c000)[_0x9408('0x15')](_0x1e7d52);}return null;};}function patchUpdates(_0x51ce73){return function(_0x51504a){try{jsonpatch[_0x9408('0x1c')](_0x51504a,_0x51ce73,!![]);}catch(_0xbf4163){return BPromise['reject'](_0xbf4163);}return _0x51504a[_0x9408('0x1d')]();};}function saveUpdates(_0x6382eb,_0x524821){return function(_0x2c3af9){if(_0x2c3af9){return _0x2c3af9[_0x9408('0x1e')](_0x6382eb)[_0x9408('0x1f')](function(_0x14d2b3){return _0x14d2b3;});}return null;};}function removeEntity(_0x1b5a36,_0x2ead69){return function(_0x169a55){if(_0x169a55){return _0x169a55[_0x9408('0x20')]()['then'](function(){var _0x2f915c=_0x169a55[_0x9408('0x21')]({'plain':!![]});var _0x120eb7='ExtractedReports';return db['UserProfileResource'][_0x9408('0x20')]({'where':{'type':_0x120eb7,'resourceId':_0x2f915c['id']}})[_0x9408('0x1f')](function(){return _0x169a55;});})[_0x9408('0x1f')](function(){_0x1b5a36[_0x9408('0x13')](0xcc)[_0x9408('0x14')]();});}};}function handleEntityNotFound(_0x45407e,_0x5b2cc6){return function(_0x4f73f0){if(!_0x4f73f0){_0x45407e[_0x9408('0x22')](0x194);}return _0x4f73f0;};}function handleError(_0x4ebecd,_0x5b7a1e){_0x5b7a1e=_0x5b7a1e||0x1f4;return function(_0x4c7622){logger['error'](_0x4c7622['stack']);if(_0x4c7622[_0x9408('0x23')]){delete _0x4c7622[_0x9408('0x23')];}_0x4ebecd[_0x9408('0x13')](_0x5b7a1e)['send'](_0x4c7622);};}exports['index']=function(_0x1d2f69,_0x880843){var _0x2162b9={},_0x3e7b35={},_0x1aab62={'count':0x0,'rows':[]};var _0x238672=_['map'](db['AnalyticExtractedReport'][_0x9408('0x24')],function(_0x1a546b){return{'name':_0x1a546b[_0x9408('0x25')],'type':_0x1a546b['type'][_0x9408('0x26')]};});_0x3e7b35[_0x9408('0x27')]=_[_0x9408('0x28')](_0x238672,_0x9408('0x23'));_0x3e7b35[_0x9408('0x29')]=_[_0x9408('0x2a')](_0x1d2f69[_0x9408('0x29')]);_0x3e7b35[_0x9408('0x2b')]=_[_0x9408('0x2c')](_0x3e7b35[_0x9408('0x27')],_0x3e7b35[_0x9408('0x29')]);_0x2162b9[_0x9408('0x2d')]=_['intersection'](_0x3e7b35['model'],qs[_0x9408('0x2e')](_0x1d2f69[_0x9408('0x29')][_0x9408('0x2e')]));_0x2162b9[_0x9408('0x2d')]=_0x2162b9['attributes'][_0x9408('0x2f')]?_0x2162b9['attributes']:_0x3e7b35[_0x9408('0x27')];if(!_0x1d2f69[_0x9408('0x29')]['hasOwnProperty']('nolimit')){_0x2162b9[_0x9408('0x18')]=qs[_0x9408('0x18')](_0x1d2f69[_0x9408('0x29')]['limit']);_0x2162b9[_0x9408('0x16')]=qs[_0x9408('0x16')](_0x1d2f69[_0x9408('0x29')][_0x9408('0x16')]);}_0x2162b9[_0x9408('0x30')]=qs['sort'](_0x1d2f69[_0x9408('0x29')]['sort']);_0x2162b9[_0x9408('0x31')]=qs['filters'](_[_0x9408('0x32')](_0x1d2f69[_0x9408('0x29')],_0x3e7b35[_0x9408('0x2b')]),_0x238672);if(_0x1d2f69['query'][_0x9408('0x33')]){_0x2162b9[_0x9408('0x31')]=_[_0x9408('0x34')](_0x2162b9['where'],{'$or':_[_0x9408('0x28')](_0x238672,function(_0x4d93b2){if(_0x4d93b2[_0x9408('0x35')]!==_0x9408('0x36')){var _0x3730e9={};_0x3730e9[_0x4d93b2['name']]={'$like':'%'+_0x1d2f69[_0x9408('0x29')][_0x9408('0x33')]+'%'};return _0x3730e9;}})});}_0x2162b9=_[_0x9408('0x34')]({},_0x2162b9,_0x1d2f69[_0x9408('0x37')]);var _0x582acd={'where':_0x2162b9[_0x9408('0x31')]};return db[_0x9408('0x38')]['count'](_0x582acd)[_0x9408('0x1f')](function(_0x4d4daa){_0x1aab62[_0x9408('0x19')]=_0x4d4daa;if(_0x1d2f69[_0x9408('0x29')][_0x9408('0x39')]){_0x2162b9[_0x9408('0x3a')]=[{'all':!![]}];}return db[_0x9408('0x38')]['findAll'](_0x2162b9);})[_0x9408('0x1f')](function(_0x479fb8){_0x1aab62[_0x9408('0x3b')]=_0x479fb8;return _0x1aab62;})['then'](respondWithFilteredResult(_0x880843,_0x2162b9))[_0x9408('0x3c')](handleError(_0x880843,null));};exports['show']=function(_0x504142,_0x2732b3){var _0x554a5d={'raw':!![],'where':{'id':_0x504142['params']['id']}},_0x411869={};_0x411869[_0x9408('0x27')]=_['keys'](db['AnalyticExtractedReport']['rawAttributes']);_0x411869[_0x9408('0x29')]=_[_0x9408('0x2a')](_0x504142['query']);_0x411869[_0x9408('0x2b')]=_[_0x9408('0x2c')](_0x411869['model'],_0x411869[_0x9408('0x29')]);_0x554a5d['attributes']=_[_0x9408('0x2c')](_0x411869[_0x9408('0x27')],qs[_0x9408('0x2e')](_0x504142[_0x9408('0x29')]['fields']));_0x554a5d[_0x9408('0x2d')]=_0x554a5d[_0x9408('0x2d')][_0x9408('0x2f')]?_0x554a5d[_0x9408('0x2d')]:_0x411869['model'];if(_0x504142[_0x9408('0x29')][_0x9408('0x39')]){_0x554a5d[_0x9408('0x3a')]=[{'all':!![]}];}_0x554a5d=_[_0x9408('0x34')]({},_0x554a5d,_0x504142[_0x9408('0x37')]);return db[_0x9408('0x38')][_0x9408('0x3d')](_0x554a5d)[_0x9408('0x1f')](handleEntityNotFound(_0x2732b3,null))['then'](respondWithResult(_0x2732b3,null))[_0x9408('0x3c')](handleError(_0x2732b3,null));};exports[_0x9408('0x3e')]=function(_0x6da154,_0x1774ad){return db['AnalyticExtractedReport'][_0x9408('0x3e')](_0x6da154[_0x9408('0x3f')],{})['then'](function(_0x106392){var _0x1dab53=_0x6da154[_0x9408('0x40')]['get']({'plain':!![]});if(!_0x1dab53)throw new Error(_0x9408('0x41'));if(_0x1dab53[_0x9408('0x42')]===_0x9408('0x40')){var _0x55ad3d=_0x106392[_0x9408('0x21')]({'plain':!![]});var _0x526999=_0x9408('0x43');return db[_0x9408('0x44')][_0x9408('0x3d')]({'where':{'name':_0x526999,'userProfileId':_0x1dab53['userProfileId']},'raw':!![]})[_0x9408('0x1f')](function(_0x1441df){if(_0x1441df&&_0x1441df['autoAssociation']===0x0){return db[_0x9408('0x45')][_0x9408('0x3e')]({'name':_0x55ad3d['name'],'resourceId':_0x55ad3d['id'],'type':_0x1441df[_0x9408('0x23')],'sectionId':_0x1441df['id']},{})[_0x9408('0x1f')](function(){return _0x106392;});}else{return _0x106392;}})['catch'](function(_0xc2971e){logger[_0x9408('0x46')](_0x9408('0x47'),_0xc2971e);throw _0xc2971e;});}return _0x106392;})[_0x9408('0x1f')](respondWithResult(_0x1774ad,0xc9))['catch'](handleError(_0x1774ad,null));};exports[_0x9408('0x1e')]=function(_0x927909,_0x418146){if(_0x927909[_0x9408('0x3f')]['id']){delete _0x927909['body']['id'];}return db[_0x9408('0x38')][_0x9408('0x3d')]({'where':{'id':_0x927909[_0x9408('0x48')]['id']}})['then'](handleEntityNotFound(_0x418146,null))[_0x9408('0x1f')](saveUpdates(_0x927909[_0x9408('0x3f')],null))['then'](respondWithResult(_0x418146,null))[_0x9408('0x3c')](handleError(_0x418146,null));};exports['destroy']=function(_0x2ae610,_0xb04c75){return db[_0x9408('0x38')][_0x9408('0x3d')]({'where':{'id':_0x2ae610[_0x9408('0x48')]['id']}})[_0x9408('0x1f')](handleEntityNotFound(_0xb04c75,null))[_0x9408('0x1f')](removeEntity(_0xb04c75,null))[_0x9408('0x3c')](handleError(_0xb04c75,null));};exports[_0x9408('0x49')]=function(_0x4cfd41,_0x5ad4db,_0x1e8079){return db[_0x9408('0x38')][_0x9408('0x3d')]({'where':{'id':_0x4cfd41[_0x9408('0x48')]['id']},'attributes':['name',_0x9408('0x4a'),_0x9408('0x4b'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x5ad4db,null))[_0x9408('0x1f')](function(_0x1d8167){if(_0x1d8167){if(!fs[_0x9408('0x4c')](path['join'](config[_0x9408('0x4d')],_0x9408('0x4e'),_0x1d8167[_0x9408('0x4b')]))){throw new db[(_0x9408('0x4f'))][(_0x9408('0x50'))](_0x9408('0x51'));}if(_0x4cfd41['query'][_0x9408('0x52')]){return _0x5ad4db[_0x9408('0x22')](0xc8);}return _0x5ad4db[_0x9408('0x49')](path[_0x9408('0x53')](config['root'],_0x9408('0x4e'),_0x1d8167['savename']),util[_0x9408('0x54')](_0x9408('0x55'),_0x1d8167[_0x9408('0x4a')]||_0x1d8167[_0x9408('0x23')],_0x1d8167[_0x9408('0x56')][_0x9408('0x57')]()));}})['catch'](handleError(_0x5ad4db,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9228a6b..3bbc07b 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 _0xd683=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','util','../../config/logger','api','moment'];(function(_0x7f7401,_0xa49bd8){var _0x301bca=function(_0x3cab42){while(--_0x3cab42){_0x7f7401['push'](_0x7f7401['shift']());}};_0x301bca(++_0xa49bd8);}(_0xd683,0x10d));var _0x3d68=function(_0xfaf51b,_0x4b9c2b){_0xfaf51b=_0xfaf51b-0x0;var _0x4b71e8=_0xd683[_0xfaf51b];return _0x4b71e8;};'use strict';var _=require('lodash');var util=require(_0x3d68('0x0'));var logger=require(_0x3d68('0x1'))(_0x3d68('0x2'));var moment=require(_0x3d68('0x3'));var BPromise=require(_0x3d68('0x4'));var rp=require(_0x3d68('0x5'));var fs=require('fs');var path=require(_0x3d68('0x6'));var rimraf=require(_0x3d68('0x7'));var config=require(_0x3d68('0x8'));var attributes=require(_0x3d68('0x9'));module[_0x3d68('0xa')]=function(_0x12f021,_0x2247c1){return _0x12f021[_0x3d68('0xb')](_0x3d68('0xc'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f0d=['request-promise','path','rimraf','../../config/environment','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5d2aee,_0x4912f8){var _0x43b7f8=function(_0x247425){while(--_0x247425){_0x5d2aee['push'](_0x5d2aee['shift']());}};_0x43b7f8(++_0x4912f8);}(_0x4f0d,0xba));var _0xd4f0=function(_0x3aaf97,_0x4fa2e8){_0x3aaf97=_0x3aaf97-0x0;var _0xeba75e=_0x4f0d[_0x3aaf97];return _0xeba75e;};'use strict';var _=require(_0xd4f0('0x0'));var util=require(_0xd4f0('0x1'));var logger=require(_0xd4f0('0x2'))(_0xd4f0('0x3'));var moment=require(_0xd4f0('0x4'));var BPromise=require(_0xd4f0('0x5'));var rp=require(_0xd4f0('0x6'));var fs=require('fs');var path=require(_0xd4f0('0x7'));var rimraf=require(_0xd4f0('0x8'));var config=require(_0xd4f0('0x9'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x1604d5,_0x3d15c0){return _0x1604d5[_0xd4f0('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xd4f0('0xb'),'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 fa58491..275c7b5 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 _0x3521=['info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x3521,0x183));var _0x1352=function(_0x4f7742,_0x15ce9a){_0x4f7742=_0x4f7742-0x0;var _0x270a53=_0x3521[_0x4f7742];return _0x270a53;};'use strict';var _=require(_0x1352('0x0'));var util=require(_0x1352('0x1'));var moment=require('moment');var BPromise=require(_0x1352('0x2'));var rs=require(_0x1352('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1352('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1352('0x5'));var config=require(_0x1352('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1352('0x7')][_0x1352('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3006d3,_0x4c481f,_0x2e1c91){return new BPromise(function(_0x1cbfcf,_0x21db13){return client['request'](_0x3006d3,_0x2e1c91)['then'](function(_0x212e2c){logger[_0x1352('0x9')](_0x1352('0xa'),_0x4c481f,'request\x20sent');logger[_0x1352('0xb')](_0x1352('0xc'),_0x4c481f,'request\x20sent',JSON[_0x1352('0xd')](_0x212e2c));if(_0x212e2c[_0x1352('0xe')]){if(_0x212e2c[_0x1352('0xe')][_0x1352('0xf')]===0x1f4){logger[_0x1352('0xe')](_0x1352('0xa'),_0x4c481f,_0x212e2c[_0x1352('0xe')][_0x1352('0x10')]);return _0x21db13(_0x212e2c[_0x1352('0xe')][_0x1352('0x10')]);}logger[_0x1352('0xe')](_0x1352('0xa'),_0x4c481f,_0x212e2c['error'][_0x1352('0x10')]);return _0x1cbfcf(_0x212e2c[_0x1352('0xe')][_0x1352('0x10')]);}else{logger[_0x1352('0x9')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4c481f,_0x1352('0x11'));_0x1cbfcf(_0x212e2c['result'][_0x1352('0x10')]);}})['catch'](function(_0x193f1c){logger['error'](_0x1352('0xa'),_0x4c481f,_0x193f1c);_0x21db13(_0x193f1c);});});} \ No newline at end of file +var _0xc366=['client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1eac42,_0x555028){var _0x2004d0=function(_0x564a1c){while(--_0x564a1c){_0x1eac42['push'](_0x1eac42['shift']());}};_0x2004d0(++_0x555028);}(_0xc366,0xb6));var _0x6c36=function(_0x22084b,_0x1d5154){_0x22084b=_0x22084b-0x0;var _0x6dca4c=_0xc366[_0x22084b];return _0x6dca4c;};'use strict';var _=require(_0x6c36('0x0'));var util=require(_0x6c36('0x1'));var moment=require(_0x6c36('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c36('0x3'));var fs=require('fs');var Redis=require(_0x6c36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c36('0x5'));var logger=require(_0x6c36('0x6'))(_0x6c36('0x7'));var config=require(_0x6c36('0x8'));var jayson=require(_0x6c36('0x9'));var client=jayson[_0x6c36('0xa')][_0x6c36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7e786b,_0x1b2031,_0x5f3d53){return new BPromise(function(_0x100658,_0x247591){return client[_0x6c36('0xc')](_0x7e786b,_0x5f3d53)[_0x6c36('0xd')](function(_0x4e03d0){logger[_0x6c36('0xe')](_0x6c36('0xf'),_0x1b2031,_0x6c36('0x10'));logger[_0x6c36('0x11')](_0x6c36('0x12'),_0x1b2031,_0x6c36('0x10'),JSON[_0x6c36('0x13')](_0x4e03d0));if(_0x4e03d0[_0x6c36('0x14')]){if(_0x4e03d0[_0x6c36('0x14')][_0x6c36('0x15')]===0x1f4){logger[_0x6c36('0x14')](_0x6c36('0xf'),_0x1b2031,_0x4e03d0['error'][_0x6c36('0x16')]);return _0x247591(_0x4e03d0[_0x6c36('0x14')][_0x6c36('0x16')]);}logger[_0x6c36('0x14')](_0x6c36('0xf'),_0x1b2031,_0x4e03d0[_0x6c36('0x14')][_0x6c36('0x16')]);return _0x100658(_0x4e03d0[_0x6c36('0x14')][_0x6c36('0x16')]);}else{logger[_0x6c36('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b2031,_0x6c36('0x10'));_0x100658(_0x4e03d0['result']['message']);}})[_0x6c36('0x17')](function(_0x5babbf){logger[_0x6c36('0x14')](_0x6c36('0xf'),_0x1b2031,_0x5babbf);_0x247591(_0x5babbf);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e9d974b..f3ee26c 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 _0xf32a=['index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xf32a,0x186));var _0xaf32=function(_0xf7dc4d,_0x49f0d4){_0xf7dc4d=_0xf7dc4d-0x0;var _0x1781bd=_0xf32a[_0xf7dc4d];return _0x1781bd;};'use strict';var multer=require(_0xaf32('0x0'));var util=require(_0xaf32('0x1'));var path=require(_0xaf32('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf32('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf32('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaf32('0x5'));var controller=require(_0xaf32('0x6'));router[_0xaf32('0x7')]('/',auth[_0xaf32('0x8')](),controller[_0xaf32('0x9')]);router[_0xaf32('0x7')](_0xaf32('0xa'),auth[_0xaf32('0x8')](),controller[_0xaf32('0xb')]);router[_0xaf32('0x7')](_0xaf32('0xc'),auth[_0xaf32('0x8')](),controller[_0xaf32('0xd')]);router[_0xaf32('0xe')]('/',auth[_0xaf32('0x8')](),controller[_0xaf32('0xf')]);router[_0xaf32('0x10')](_0xaf32('0xa'),auth[_0xaf32('0x8')](),controller[_0xaf32('0x11')]);router[_0xaf32('0x12')]('/:id',auth[_0xaf32('0x8')](),controller[_0xaf32('0x13')]);module[_0xaf32('0x14')]=router; \ No newline at end of file +var _0xafe1=['show','/:id/download','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','index','get','/:id','isAuthenticated'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xafe1,0x1ab));var _0x1afe=function(_0x44ac1e,_0x63343b){_0x44ac1e=_0x44ac1e-0x0;var _0x2e0adf=_0xafe1[_0x44ac1e];return _0x2e0adf;};'use strict';var multer=require('multer');var util=require(_0x1afe('0x0'));var path=require(_0x1afe('0x1'));var timeout=require(_0x1afe('0x2'));var express=require(_0x1afe('0x3'));var router=express[_0x1afe('0x4')]();var fs_extra=require(_0x1afe('0x5'));var auth=require(_0x1afe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1afe('0x7'));var controller=require(_0x1afe('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1afe('0x9')]);router[_0x1afe('0xa')](_0x1afe('0xb'),auth[_0x1afe('0xc')](),controller[_0x1afe('0xd')]);router[_0x1afe('0xa')](_0x1afe('0xe'),auth[_0x1afe('0xc')](),controller['download']);router[_0x1afe('0xf')]('/',auth['isAuthenticated'](),controller[_0x1afe('0x10')]);router[_0x1afe('0x11')](_0x1afe('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1afe('0x12')](_0x1afe('0xb'),auth[_0x1afe('0xc')](),controller[_0x1afe('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 2ecb56e..de56bbe 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 _0x2712=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x5b1877,_0x474eda){var _0x2887a8=function(_0x4805cc){while(--_0x4805cc){_0x5b1877['push'](_0x5b1877['shift']());}};_0x2887a8(++_0x474eda);}(_0x2712,0xb9));var _0x2271=function(_0x5e2abb,_0x1b768c){_0x5e2abb=_0x5e2abb-0x0;var _0xb1b934=_0x2712[_0x5e2abb];return _0xb1b934;};'use strict';var Sequelize=require(_0x2271('0x0'));module['exports']={'field':{'type':Sequelize[_0x2271('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x2271('0x2')]},'groupBy':{'type':Sequelize[_0x2271('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x2271('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6838=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2cde2a,_0x4325c4){var _0x110f55=function(_0x4927f5){while(--_0x4927f5){_0x2cde2a['push'](_0x2cde2a['shift']());}};_0x110f55(++_0x4325c4);}(_0x6838,0x96));var _0x8683=function(_0x19e38e,_0xb15cc7){_0x19e38e=_0x19e38e-0x0;var _0x14bec3=_0x6838[_0x19e38e];return _0x14bec3;};'use strict';var Sequelize=require(_0x8683('0x0'));module[_0x8683('0x1')]={'field':{'type':Sequelize[_0x8683('0x2')]},'alias':{'type':Sequelize[_0x8683('0x3')]},'function':{'type':Sequelize[_0x8683('0x3')]},'format':{'type':Sequelize[_0x8683('0x3')]},'groupBy':{'type':Sequelize[_0x8683('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8683('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index af8bda5..197b14e 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 _0x7202=['addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','bulkCreate','body','find','bulkDestroy','ids'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x7202,0x1af));var _0x2720=function(_0x1d4e36,_0x54fde6){_0x1d4e36=_0x1d4e36-0x0;var _0x4dab8c=_0x7202[_0x1d4e36];return _0x4dab8c;};'use strict';var emlformat=require(_0x2720('0x0'));var rimraf=require(_0x2720('0x1'));var zipdir=require(_0x2720('0x2'));var jsonpatch=require(_0x2720('0x3'));var rp=require(_0x2720('0x4'));var moment=require(_0x2720('0x5'));var BPromise=require(_0x2720('0x6'));var Mustache=require(_0x2720('0x7'));var util=require(_0x2720('0x8'));var path=require('path');var sox=require(_0x2720('0x9'));var csv=require(_0x2720('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2720('0xb'));var _=require('lodash');var squel=require(_0x2720('0xc'));var crypto=require('crypto');var jsforce=require(_0x2720('0xd'));var deskjs=require(_0x2720('0xe'));var toCsv=require(_0x2720('0xa'));var querystring=require(_0x2720('0xf'));var Papa=require('papaparse');var Redis=require(_0x2720('0x10'));var authService=require(_0x2720('0x11'));var qs=require(_0x2720('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2720('0x13'));var logger=require(_0x2720('0x14'))(_0x2720('0x15'));var utils=require(_0x2720('0x16'));var config=require(_0x2720('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2720('0x18'))['db'];function respondWithStatusCode(_0x38b91c,_0x2d094f){_0x2d094f=_0x2d094f||0xcc;return function(_0x12b1ab){if(_0x12b1ab){return _0x38b91c[_0x2720('0x19')](_0x2d094f);}return _0x38b91c[_0x2720('0x1a')](_0x2d094f)[_0x2720('0x1b')]();};}function respondWithResult(_0x2a86ea,_0x296d5c){_0x296d5c=_0x296d5c||0xc8;return function(_0x364603){if(_0x364603){return _0x2a86ea[_0x2720('0x1a')](_0x296d5c)[_0x2720('0x1c')](_0x364603);}};}function respondWithFilteredResult(_0x9e612b,_0x556138){return function(_0xcef845){if(_0xcef845){var _0x44485a=typeof _0x556138[_0x2720('0x1d')]===_0x2720('0x1e')&&typeof _0x556138[_0x2720('0x1f')]===_0x2720('0x1e');var _0x320efe=_0xcef845[_0x2720('0x20')];var _0x30b3a0=_0x44485a?0x0:_0x556138[_0x2720('0x1d')];var _0x3282f8=_0x44485a?_0xcef845[_0x2720('0x20')]:_0x556138[_0x2720('0x1d')]+_0x556138[_0x2720('0x1f')];var _0xe2997c;if(_0x3282f8>=_0x320efe){_0x3282f8=_0x320efe;_0xe2997c=0xc8;}else{_0xe2997c=0xce;}_0x9e612b[_0x2720('0x1a')](_0xe2997c);return _0x9e612b[_0x2720('0x21')](_0x2720('0x22'),_0x30b3a0+'-'+_0x3282f8+'/'+_0x320efe)[_0x2720('0x1c')](_0xcef845);}return null;};}function patchUpdates(_0x341a28){return function(_0x50ef34){try{jsonpatch[_0x2720('0x23')](_0x50ef34,_0x341a28,!![]);}catch(_0x59ea77){return BPromise[_0x2720('0x24')](_0x59ea77);}return _0x50ef34['save']();};}function saveUpdates(_0x54997f,_0x893bad){return function(_0x247549){if(_0x247549){return _0x247549['update'](_0x54997f)[_0x2720('0x25')](function(_0xaa15ea){return _0xaa15ea;});}return null;};}function removeEntity(_0x269948,_0x3bda6a){return function(_0x4ae61c){if(_0x4ae61c){return _0x4ae61c[_0x2720('0x26')]()[_0x2720('0x25')](function(){_0x269948['status'](0xcc)[_0x2720('0x1b')]();});}};}function handleEntityNotFound(_0xc876f0,_0x3a889a){return function(_0x45b7ad){if(!_0x45b7ad){_0xc876f0[_0x2720('0x19')](0x194);}return _0x45b7ad;};}function handleError(_0x9a75ca,_0x2d1610){_0x2d1610=_0x2d1610||0x1f4;return function(_0x36b71f){logger[_0x2720('0x27')](_0x36b71f['stack']);if(_0x36b71f['name']){delete _0x36b71f[_0x2720('0x28')];}_0x9a75ca[_0x2720('0x1a')](_0x2d1610)[_0x2720('0x29')](_0x36b71f);};}exports[_0x2720('0x2a')]=function(_0x39fe5a,_0x14947d){var _0x11bc88={},_0x58d743={},_0x83e7b1={'count':0x0,'rows':[]};var _0x4ae70c=_[_0x2720('0x2b')](db[_0x2720('0x2c')][_0x2720('0x2d')],function(_0x14ab15){return{'name':_0x14ab15[_0x2720('0x2e')],'type':_0x14ab15[_0x2720('0x2f')][_0x2720('0x30')]};});_0x58d743[_0x2720('0x31')]=_[_0x2720('0x2b')](_0x4ae70c,_0x2720('0x28'));_0x58d743[_0x2720('0x32')]=_[_0x2720('0x33')](_0x39fe5a['query']);_0x58d743['filters']=_[_0x2720('0x34')](_0x58d743[_0x2720('0x31')],_0x58d743['query']);_0x11bc88[_0x2720('0x35')]=_[_0x2720('0x34')](_0x58d743[_0x2720('0x31')],qs[_0x2720('0x36')](_0x39fe5a['query']['fields']));_0x11bc88['attributes']=_0x11bc88[_0x2720('0x35')][_0x2720('0x37')]?_0x11bc88[_0x2720('0x35')]:_0x58d743['model'];if(!_0x39fe5a[_0x2720('0x32')][_0x2720('0x38')](_0x2720('0x39'))){_0x11bc88[_0x2720('0x1f')]=qs[_0x2720('0x1f')](_0x39fe5a[_0x2720('0x32')][_0x2720('0x1f')]);_0x11bc88[_0x2720('0x1d')]=qs[_0x2720('0x1d')](_0x39fe5a['query'][_0x2720('0x1d')]);}_0x11bc88['order']=qs[_0x2720('0x3a')](_0x39fe5a[_0x2720('0x32')][_0x2720('0x3a')]);_0x11bc88[_0x2720('0x3b')]=qs[_0x2720('0x3c')](_[_0x2720('0x3d')](_0x39fe5a[_0x2720('0x32')],_0x58d743['filters']),_0x4ae70c);if(_0x39fe5a[_0x2720('0x32')][_0x2720('0x3e')]){_0x11bc88[_0x2720('0x3b')]=_[_0x2720('0x3f')](_0x11bc88[_0x2720('0x3b')],{'$or':_['map'](_0x4ae70c,function(_0x19b902){if(_0x19b902[_0x2720('0x2f')]!==_0x2720('0x40')){var _0x3aa077={};_0x3aa077[_0x19b902[_0x2720('0x28')]]={'$like':'%'+_0x39fe5a[_0x2720('0x32')][_0x2720('0x3e')]+'%'};return _0x3aa077;}})});}_0x11bc88=_['merge']({},_0x11bc88,_0x39fe5a['options']);var _0xdaf033={'where':_0x11bc88[_0x2720('0x3b')]};return db['AnalyticFieldReport'][_0x2720('0x20')](_0xdaf033)[_0x2720('0x25')](function(_0x491cc7){_0x83e7b1[_0x2720('0x20')]=_0x491cc7;if(_0x39fe5a['query']['includeAll']){_0x11bc88[_0x2720('0x41')]=[{'all':!![]}];}return db[_0x2720('0x2c')][_0x2720('0x42')](_0x11bc88);})['then'](function(_0x242ae3){_0x83e7b1[_0x2720('0x43')]=_0x242ae3;return _0x83e7b1;})[_0x2720('0x25')](respondWithFilteredResult(_0x14947d,_0x11bc88))[_0x2720('0x44')](handleError(_0x14947d,null));};exports[_0x2720('0x45')]=function(_0x343767,_0x2ba86c){var _0x3d3e12={'raw':![],'where':{'id':_0x343767[_0x2720('0x46')]['id']}},_0x39e645={};_0x39e645[_0x2720('0x31')]=_['keys'](db['AnalyticFieldReport'][_0x2720('0x2d')]);_0x39e645[_0x2720('0x32')]=_[_0x2720('0x33')](_0x343767['query']);_0x39e645[_0x2720('0x3c')]=_[_0x2720('0x34')](_0x39e645[_0x2720('0x31')],_0x39e645[_0x2720('0x32')]);_0x3d3e12['attributes']=_['intersection'](_0x39e645[_0x2720('0x31')],qs[_0x2720('0x36')](_0x343767[_0x2720('0x32')][_0x2720('0x36')]));_0x3d3e12[_0x2720('0x35')]=_0x3d3e12[_0x2720('0x35')][_0x2720('0x37')]?_0x3d3e12[_0x2720('0x35')]:_0x39e645[_0x2720('0x31')];if(_0x343767[_0x2720('0x32')][_0x2720('0x47')]){_0x3d3e12[_0x2720('0x41')]=[{'all':!![]}];}_0x3d3e12=_[_0x2720('0x3f')]({},_0x3d3e12,_0x343767[_0x2720('0x48')]);return db[_0x2720('0x2c')]['find'](_0x3d3e12)['then'](handleEntityNotFound(_0x2ba86c,null))['then'](respondWithResult(_0x2ba86c,null))[_0x2720('0x44')](handleError(_0x2ba86c,null));};exports[_0x2720('0x49')]=function(_0x104da6,_0x1ea7cc){return db['AnalyticFieldReport'][_0x2720('0x49')](_0x104da6['body'],{})[_0x2720('0x25')](respondWithResult(_0x1ea7cc,0xc9))[_0x2720('0x44')](handleError(_0x1ea7cc,null));};exports[_0x2720('0x4a')]=function(_0x5a97f6,_0x43a42d){return db['AnalyticFieldReport'][_0x2720('0x4a')](_0x5a97f6[_0x2720('0x4b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x43a42d,0xc9))['catch'](handleError(_0x43a42d,null));};exports['update']=function(_0x22fb4a,_0x4fb89a){if(_0x22fb4a['body']['id']){delete _0x22fb4a[_0x2720('0x4b')]['id'];}return db[_0x2720('0x2c')][_0x2720('0x4c')]({'where':{'id':_0x22fb4a['params']['id']}})['then'](handleEntityNotFound(_0x4fb89a,null))[_0x2720('0x25')](saveUpdates(_0x22fb4a[_0x2720('0x4b')],null))[_0x2720('0x25')](respondWithResult(_0x4fb89a,null))[_0x2720('0x44')](handleError(_0x4fb89a,null));};exports[_0x2720('0x26')]=function(_0x2d7e7f,_0x278b11){return db[_0x2720('0x2c')]['find']({'where':{'id':_0x2d7e7f[_0x2720('0x46')]['id']}})[_0x2720('0x25')](handleEntityNotFound(_0x278b11,null))[_0x2720('0x25')](removeEntity(_0x278b11,null))['catch'](handleError(_0x278b11,null));};exports[_0x2720('0x4d')]=function(_0x3dddc4,_0xce6c9b){return db[_0x2720('0x2c')]['destroy']({'where':{'id':_0x3dddc4[_0x2720('0x32')][_0x2720('0x4e')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xce6c9b,0xcc))[_0x2720('0x44')](handleError(_0xce6c9b,null));};exports[_0x2720('0x4f')]=function(_0x192650,_0x198375,_0x1e804a){return db[_0x2720('0x50')][_0x2720('0x51')]({'where':{'id':_0x192650[_0x2720('0x46')]['id']}})[_0x2720('0x25')](handleEntityNotFound(_0x198375,null))[_0x2720('0x25')](function(_0xb1c333){if(_0xb1c333){return db[_0x2720('0x52')][_0x2720('0x53')](function(_0x2efb96){return db[_0x2720('0x2c')][_0x2720('0x26')]({'where':{'CustomReportId':_0x192650[_0x2720('0x46')]['id']},'transaction':_0x2efb96})[_0x2720('0x25')](function(_0x5cc4c9){var _0x3103b2=_[_0x2720('0x2b')](_0x192650['body'],function(_0x59da52){delete _0x59da52['id'];_0x59da52[_0x2720('0x54')]=_0x192650['params']['id'];return _0x59da52;});return db[_0x2720('0x2c')][_0x2720('0x4a')](_0x3103b2,{'transaction':_0x2efb96});});})['then'](function(){return db[_0x2720('0x2c')][_0x2720('0x42')]({'where':{'CustomReportId':_0x192650[_0x2720('0x46')]['id']}});});}})[_0x2720('0x25')](respondWithResult(_0x198375,null))['catch'](handleError(_0x198375,null));}; \ No newline at end of file +var _0xb783=['create','bulkCreate','body','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch'];(function(_0x25fa4a,_0x200e19){var _0x2faa7b=function(_0x10b98d){while(--_0x10b98d){_0x25fa4a['push'](_0x25fa4a['shift']());}};_0x2faa7b(++_0x200e19);}(_0xb783,0x154));var _0x3b78=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb783[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b78('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b78('0x1'));var rp=require(_0x3b78('0x2'));var moment=require(_0x3b78('0x3'));var BPromise=require(_0x3b78('0x4'));var Mustache=require(_0x3b78('0x5'));var util=require(_0x3b78('0x6'));var path=require(_0x3b78('0x7'));var sox=require(_0x3b78('0x8'));var csv=require(_0x3b78('0x9'));var ejs=require(_0x3b78('0xa'));var fs=require('fs');var fs_extra=require(_0x3b78('0xb'));var _=require('lodash');var squel=require(_0x3b78('0xc'));var crypto=require('crypto');var jsforce=require(_0x3b78('0xd'));var deskjs=require(_0x3b78('0xe'));var toCsv=require(_0x3b78('0x9'));var querystring=require(_0x3b78('0xf'));var Papa=require('papaparse');var Redis=require(_0x3b78('0x10'));var authService=require(_0x3b78('0x11'));var qs=require(_0x3b78('0x12'));var as=require(_0x3b78('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3b78('0x14'));var licenseUtil=require(_0x3b78('0x15'));var db=require(_0x3b78('0x16'))['db'];function respondWithStatusCode(_0x1339ba,_0x57f1fe){_0x57f1fe=_0x57f1fe||0xcc;return function(_0x2c7fc0){if(_0x2c7fc0){return _0x1339ba[_0x3b78('0x17')](_0x57f1fe);}return _0x1339ba['status'](_0x57f1fe)['end']();};}function respondWithResult(_0x4c5a3d,_0x147dd2){_0x147dd2=_0x147dd2||0xc8;return function(_0x15700e){if(_0x15700e){return _0x4c5a3d[_0x3b78('0x18')](_0x147dd2)[_0x3b78('0x19')](_0x15700e);}};}function respondWithFilteredResult(_0x4a0b9a,_0x3581f8){return function(_0x310f74){if(_0x310f74){var _0x3e976f=typeof _0x3581f8[_0x3b78('0x1a')]==='undefined'&&typeof _0x3581f8['limit']===_0x3b78('0x1b');var _0x4bac18=_0x310f74[_0x3b78('0x1c')];var _0x349f69=_0x3e976f?0x0:_0x3581f8['offset'];var _0x2702d6=_0x3e976f?_0x310f74['count']:_0x3581f8[_0x3b78('0x1a')]+_0x3581f8['limit'];var _0x1903fc;if(_0x2702d6>=_0x4bac18){_0x2702d6=_0x4bac18;_0x1903fc=0xc8;}else{_0x1903fc=0xce;}_0x4a0b9a[_0x3b78('0x18')](_0x1903fc);return _0x4a0b9a[_0x3b78('0x1d')](_0x3b78('0x1e'),_0x349f69+'-'+_0x2702d6+'/'+_0x4bac18)[_0x3b78('0x19')](_0x310f74);}return null;};}function patchUpdates(_0x4eaf75){return function(_0x44a540){try{jsonpatch[_0x3b78('0x1f')](_0x44a540,_0x4eaf75,!![]);}catch(_0xf46f80){return BPromise[_0x3b78('0x20')](_0xf46f80);}return _0x44a540['save']();};}function saveUpdates(_0x2b9fab,_0x525c99){return function(_0x1b737c){if(_0x1b737c){return _0x1b737c[_0x3b78('0x21')](_0x2b9fab)[_0x3b78('0x22')](function(_0x466c1d){return _0x466c1d;});}return null;};}function removeEntity(_0x39b93e,_0x2d6956){return function(_0x1ce94d){if(_0x1ce94d){return _0x1ce94d[_0x3b78('0x23')]()[_0x3b78('0x22')](function(){_0x39b93e['status'](0xcc)[_0x3b78('0x24')]();});}};}function handleEntityNotFound(_0x1528e5,_0xc4bfd3){return function(_0x3f82cd){if(!_0x3f82cd){_0x1528e5[_0x3b78('0x17')](0x194);}return _0x3f82cd;};}function handleError(_0x568549,_0x3a949d){_0x3a949d=_0x3a949d||0x1f4;return function(_0x1c74b1){logger['error'](_0x1c74b1[_0x3b78('0x25')]);if(_0x1c74b1[_0x3b78('0x26')]){delete _0x1c74b1[_0x3b78('0x26')];}_0x568549[_0x3b78('0x18')](_0x3a949d)[_0x3b78('0x27')](_0x1c74b1);};}exports[_0x3b78('0x28')]=function(_0x17bfa0,_0xce6d01){var _0x3d0f50={},_0x5c68e4={},_0x4b45ab={'count':0x0,'rows':[]};var _0x48a1de=_[_0x3b78('0x29')](db[_0x3b78('0x2a')][_0x3b78('0x2b')],function(_0x228512){return{'name':_0x228512[_0x3b78('0x2c')],'type':_0x228512[_0x3b78('0x2d')]['key']};});_0x5c68e4[_0x3b78('0x2e')]=_[_0x3b78('0x29')](_0x48a1de,_0x3b78('0x26'));_0x5c68e4[_0x3b78('0x2f')]=_['keys'](_0x17bfa0[_0x3b78('0x2f')]);_0x5c68e4[_0x3b78('0x30')]=_[_0x3b78('0x31')](_0x5c68e4[_0x3b78('0x2e')],_0x5c68e4['query']);_0x3d0f50[_0x3b78('0x32')]=_[_0x3b78('0x31')](_0x5c68e4['model'],qs[_0x3b78('0x33')](_0x17bfa0['query']['fields']));_0x3d0f50[_0x3b78('0x32')]=_0x3d0f50[_0x3b78('0x32')][_0x3b78('0x34')]?_0x3d0f50[_0x3b78('0x32')]:_0x5c68e4[_0x3b78('0x2e')];if(!_0x17bfa0[_0x3b78('0x2f')][_0x3b78('0x35')](_0x3b78('0x36'))){_0x3d0f50[_0x3b78('0x37')]=qs['limit'](_0x17bfa0[_0x3b78('0x2f')][_0x3b78('0x37')]);_0x3d0f50[_0x3b78('0x1a')]=qs[_0x3b78('0x1a')](_0x17bfa0[_0x3b78('0x2f')][_0x3b78('0x1a')]);}_0x3d0f50[_0x3b78('0x38')]=qs['sort'](_0x17bfa0['query']['sort']);_0x3d0f50['where']=qs[_0x3b78('0x30')](_['pick'](_0x17bfa0['query'],_0x5c68e4['filters']),_0x48a1de);if(_0x17bfa0[_0x3b78('0x2f')][_0x3b78('0x39')]){_0x3d0f50[_0x3b78('0x3a')]=_[_0x3b78('0x3b')](_0x3d0f50[_0x3b78('0x3a')],{'$or':_[_0x3b78('0x29')](_0x48a1de,function(_0x22d4e1){if(_0x22d4e1[_0x3b78('0x2d')]!==_0x3b78('0x3c')){var _0x115b07={};_0x115b07[_0x22d4e1['name']]={'$like':'%'+_0x17bfa0[_0x3b78('0x2f')][_0x3b78('0x39')]+'%'};return _0x115b07;}})});}_0x3d0f50=_[_0x3b78('0x3b')]({},_0x3d0f50,_0x17bfa0[_0x3b78('0x3d')]);var _0x1472a2={'where':_0x3d0f50[_0x3b78('0x3a')]};return db[_0x3b78('0x2a')][_0x3b78('0x1c')](_0x1472a2)[_0x3b78('0x22')](function(_0x95c981){_0x4b45ab[_0x3b78('0x1c')]=_0x95c981;if(_0x17bfa0[_0x3b78('0x2f')][_0x3b78('0x3e')]){_0x3d0f50[_0x3b78('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x3b78('0x40')](_0x3d0f50);})[_0x3b78('0x22')](function(_0x246a37){_0x4b45ab[_0x3b78('0x41')]=_0x246a37;return _0x4b45ab;})[_0x3b78('0x22')](respondWithFilteredResult(_0xce6d01,_0x3d0f50))['catch'](handleError(_0xce6d01,null));};exports[_0x3b78('0x42')]=function(_0x2bd9a7,_0xd6aad){var _0x162d7f={'raw':![],'where':{'id':_0x2bd9a7['params']['id']}},_0x20cf11={};_0x20cf11[_0x3b78('0x2e')]=_[_0x3b78('0x43')](db[_0x3b78('0x2a')][_0x3b78('0x2b')]);_0x20cf11[_0x3b78('0x2f')]=_['keys'](_0x2bd9a7[_0x3b78('0x2f')]);_0x20cf11[_0x3b78('0x30')]=_['intersection'](_0x20cf11['model'],_0x20cf11[_0x3b78('0x2f')]);_0x162d7f['attributes']=_[_0x3b78('0x31')](_0x20cf11[_0x3b78('0x2e')],qs[_0x3b78('0x33')](_0x2bd9a7[_0x3b78('0x2f')][_0x3b78('0x33')]));_0x162d7f[_0x3b78('0x32')]=_0x162d7f['attributes'][_0x3b78('0x34')]?_0x162d7f['attributes']:_0x20cf11[_0x3b78('0x2e')];if(_0x2bd9a7[_0x3b78('0x2f')][_0x3b78('0x3e')]){_0x162d7f[_0x3b78('0x3f')]=[{'all':!![]}];}_0x162d7f=_[_0x3b78('0x3b')]({},_0x162d7f,_0x2bd9a7[_0x3b78('0x3d')]);return db[_0x3b78('0x2a')][_0x3b78('0x44')](_0x162d7f)[_0x3b78('0x22')](handleEntityNotFound(_0xd6aad,null))['then'](respondWithResult(_0xd6aad,null))[_0x3b78('0x45')](handleError(_0xd6aad,null));};exports[_0x3b78('0x46')]=function(_0x49717c,_0x542e73){return db[_0x3b78('0x2a')][_0x3b78('0x46')](_0x49717c['body'],{})['then'](respondWithResult(_0x542e73,0xc9))[_0x3b78('0x45')](handleError(_0x542e73,null));};exports[_0x3b78('0x47')]=function(_0x3c66e2,_0x398b14){return db[_0x3b78('0x2a')][_0x3b78('0x47')](_0x3c66e2[_0x3b78('0x48')],{'raw':![],'individualHooks':!![]})[_0x3b78('0x22')](respondWithResult(_0x398b14,0xc9))[_0x3b78('0x45')](handleError(_0x398b14,null));};exports[_0x3b78('0x21')]=function(_0xac17d7,_0x52e009){if(_0xac17d7[_0x3b78('0x48')]['id']){delete _0xac17d7[_0x3b78('0x48')]['id'];}return db['AnalyticFieldReport'][_0x3b78('0x44')]({'where':{'id':_0xac17d7[_0x3b78('0x49')]['id']}})[_0x3b78('0x22')](handleEntityNotFound(_0x52e009,null))[_0x3b78('0x22')](saveUpdates(_0xac17d7[_0x3b78('0x48')],null))[_0x3b78('0x22')](respondWithResult(_0x52e009,null))['catch'](handleError(_0x52e009,null));};exports['destroy']=function(_0x16c7be,_0x252d17){return db[_0x3b78('0x2a')]['find']({'where':{'id':_0x16c7be[_0x3b78('0x49')]['id']}})[_0x3b78('0x22')](handleEntityNotFound(_0x252d17,null))[_0x3b78('0x22')](removeEntity(_0x252d17,null))[_0x3b78('0x45')](handleError(_0x252d17,null));};exports[_0x3b78('0x4a')]=function(_0x4d291b,_0x1cf4b8){return db['AnalyticFieldReport'][_0x3b78('0x23')]({'where':{'id':_0x4d291b[_0x3b78('0x2f')][_0x3b78('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x3b78('0x22')](respondWithResult(_0x1cf4b8,0xcc))[_0x3b78('0x45')](handleError(_0x1cf4b8,null));};exports[_0x3b78('0x4c')]=function(_0x17128f,_0x246e68,_0x2cdb8b){return db[_0x3b78('0x4d')][_0x3b78('0x4e')]({'where':{'id':_0x17128f[_0x3b78('0x49')]['id']}})[_0x3b78('0x22')](handleEntityNotFound(_0x246e68,null))['then'](function(_0x598abf){if(_0x598abf){return db[_0x3b78('0x4f')][_0x3b78('0x50')](function(_0x255fe6){return db['AnalyticFieldReport'][_0x3b78('0x23')]({'where':{'CustomReportId':_0x17128f[_0x3b78('0x49')]['id']},'transaction':_0x255fe6})[_0x3b78('0x22')](function(_0x3a68ed){var _0x3b8f78=_[_0x3b78('0x29')](_0x17128f['body'],function(_0x4b881d){delete _0x4b881d['id'];_0x4b881d[_0x3b78('0x51')]=_0x17128f[_0x3b78('0x49')]['id'];return _0x4b881d;});return db[_0x3b78('0x2a')][_0x3b78('0x47')](_0x3b8f78,{'transaction':_0x255fe6});});})['then'](function(){return db[_0x3b78('0x2a')][_0x3b78('0x40')]({'where':{'CustomReportId':_0x17128f[_0x3b78('0x49')]['id']}});});}})['then'](respondWithResult(_0x246e68,null))['catch'](handleError(_0x246e68,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b559c2d..1ed1e2a 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 _0x230d=['./analyticFieldReport.attributes','exports','define','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x273a62,_0x476b33){var _0x29222d=function(_0x1862ca){while(--_0x1862ca){_0x273a62['push'](_0x273a62['shift']());}};_0x29222d(++_0x476b33);}(_0x230d,0x16b));var _0xd230=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x230d[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xd230('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd230('0x1'));var moment=require('moment');var BPromise=require(_0xd230('0x2'));var rp=require(_0xd230('0x3'));var fs=require('fs');var path=require(_0xd230('0x4'));var rimraf=require(_0xd230('0x5'));var config=require(_0xd230('0x6'));var attributes=require(_0xd230('0x7'));module[_0xd230('0x8')]=function(_0x1fc42d,_0x5b3245){return _0x1fc42d[_0xd230('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30b2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x30b2,0xb6));var _0x230b=function(_0xea8c60,_0xb2a815){_0xea8c60=_0xea8c60-0x0;var _0x2a6e18=_0x30b2[_0xea8c60];return _0x2a6e18;};'use strict';var _=require(_0x230b('0x0'));var util=require(_0x230b('0x1'));var logger=require(_0x230b('0x2'))(_0x230b('0x3'));var moment=require(_0x230b('0x4'));var BPromise=require(_0x230b('0x5'));var rp=require(_0x230b('0x6'));var fs=require('fs');var path=require(_0x230b('0x7'));var rimraf=require(_0x230b('0x8'));var config=require(_0x230b('0x9'));var attributes=require(_0x230b('0xa'));module[_0x230b('0xb')]=function(_0x11ecd5,_0x43d67c){return _0x11ecd5[_0x230b('0xc')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index a0abdee..b38a3ab 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 _0x5754=['rpc','../../config/environment','jayson/promise','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x43d691,_0x16829c){var _0x428ff7=function(_0x22c902){while(--_0x22c902){_0x43d691['push'](_0x43d691['shift']());}};_0x428ff7(++_0x16829c);}(_0x5754,0x1db));var _0x4575=function(_0x52669a,_0xbab1e0){_0x52669a=_0x52669a-0x0;var _0x49c514=_0x5754[_0x52669a];return _0x49c514;};'use strict';var _=require(_0x4575('0x0'));var util=require(_0x4575('0x1'));var moment=require(_0x4575('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4575('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4575('0x4'))(_0x4575('0x5'));var config=require(_0x4575('0x6'));var jayson=require(_0x4575('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31bda0,_0x244cdb,_0x3cc6ba){return new BPromise(function(_0x4b9bc4,_0x9898c1){return client[_0x4575('0x8')](_0x31bda0,_0x3cc6ba)[_0x4575('0x9')](function(_0x5b9120){logger[_0x4575('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x244cdb,'request\x20sent');logger[_0x4575('0xb')](_0x4575('0xc'),_0x244cdb,'request\x20sent',JSON[_0x4575('0xd')](_0x5b9120));if(_0x5b9120[_0x4575('0xe')]){if(_0x5b9120[_0x4575('0xe')]['code']===0x1f4){logger[_0x4575('0xe')](_0x4575('0xf'),_0x244cdb,_0x5b9120[_0x4575('0xe')][_0x4575('0x10')]);return _0x9898c1(_0x5b9120[_0x4575('0xe')][_0x4575('0x10')]);}logger[_0x4575('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x244cdb,_0x5b9120['error']['message']);return _0x4b9bc4(_0x5b9120[_0x4575('0xe')][_0x4575('0x10')]);}else{logger[_0x4575('0xa')](_0x4575('0xf'),_0x244cdb,_0x4575('0x11'));_0x4b9bc4(_0x5b9120[_0x4575('0x12')]['message']);}})[_0x4575('0x13')](function(_0xeb93d4){logger[_0x4575('0xe')](_0x4575('0xf'),_0x244cdb,_0xeb93d4);_0x9898c1(_0xeb93d4);});});} \ No newline at end of file +var _0x4fcf=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0x4fcf,0x83));var _0xf4fc=function(_0x2c2439,_0x325167){_0x2c2439=_0x2c2439-0x0;var _0x2db2ef=_0x4fcf[_0x2c2439];return _0x2db2ef;};'use strict';var _=require(_0xf4fc('0x0'));var util=require(_0xf4fc('0x1'));var moment=require(_0xf4fc('0x2'));var BPromise=require(_0xf4fc('0x3'));var rs=require(_0xf4fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4fc('0x5'))['db'];var utils=require(_0xf4fc('0x6'));var logger=require('../../config/logger')(_0xf4fc('0x7'));var config=require(_0xf4fc('0x8'));var jayson=require(_0xf4fc('0x9'));var client=jayson['client'][_0xf4fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x252c51,_0x26f07b,_0x5e6819){return new BPromise(function(_0x55a00f,_0x13f6bf){return client[_0xf4fc('0xb')](_0x252c51,_0x5e6819)[_0xf4fc('0xc')](function(_0x7c564b){logger[_0xf4fc('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x26f07b,_0xf4fc('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x26f07b,_0xf4fc('0xe'),JSON[_0xf4fc('0xf')](_0x7c564b));if(_0x7c564b[_0xf4fc('0x10')]){if(_0x7c564b[_0xf4fc('0x10')][_0xf4fc('0x11')]===0x1f4){logger[_0xf4fc('0x10')](_0xf4fc('0x12'),_0x26f07b,_0x7c564b['error']['message']);return _0x13f6bf(_0x7c564b[_0xf4fc('0x10')]['message']);}logger['error'](_0xf4fc('0x12'),_0x26f07b,_0x7c564b['error'][_0xf4fc('0x13')]);return _0x55a00f(_0x7c564b[_0xf4fc('0x10')][_0xf4fc('0x13')]);}else{logger[_0xf4fc('0xd')](_0xf4fc('0x12'),_0x26f07b,'request\x20sent');_0x55a00f(_0x7c564b[_0xf4fc('0x14')][_0xf4fc('0x13')]);}})[_0xf4fc('0x15')](function(_0x545391){logger[_0xf4fc('0x10')](_0xf4fc('0x12'),_0x26f07b,_0x545391);_0x13f6bf(_0x545391);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f190dfe..7321747 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(_0x419a97,_0x19fe2f){var _0x421d39=function(_0xd4afc4){while(--_0xd4afc4){_0x419a97['push'](_0x419a97['shift']());}};_0x421d39(++_0x19fe2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x5b1ffc,_0xcb589c){var _0xce73b0=function(_0x3f6ff4){while(--_0x3f6ff4){_0x5b1ffc['push'](_0x5b1ffc['shift']());}};_0xce73b0(++_0xcb589c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 ce7828a..d08ea32 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 _0x2cbd=['exports','name','STRING','TEXT','sequelize'];(function(_0x3c166f,_0x56520f){var _0xf2c083=function(_0x17409a){while(--_0x17409a){_0x3c166f['push'](_0x3c166f['shift']());}};_0xf2c083(++_0x56520f);}(_0x2cbd,0x19e));var _0xd2cb=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2cbd[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xd2cb('0x0'));module[_0xd2cb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd2cb('0x2')},'table':{'type':Sequelize[_0xd2cb('0x3')]},'metric':{'type':Sequelize[_0xd2cb('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe9e8=['name','TEXT','sequelize','exports','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x3b1cf8,_0x2068f1){_0x3b1cf8=_0x3b1cf8-0x0;var _0x5bd2e0=_0xe9e8[_0x3b1cf8];return _0x5bd2e0;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'name':{'type':Sequelize[_0x8e9e('0x2')],'allowNull':![],'unique':_0x8e9e('0x3')},'table':{'type':Sequelize[_0x8e9e('0x2')]},'metric':{'type':Sequelize[_0x8e9e('0x4')]},'description':{'type':Sequelize[_0x8e9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5f74b10..9489a45 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 _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x162e6c,_0x40cee6){_0x162e6c=_0x162e6c-0x0;var _0x36b22d=_0x1cb9[_0x162e6c];return _0x36b22d;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file +var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','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','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'];(function(_0x14eba6,_0x395ec9){var _0x37f5ad=function(_0x445d2c){while(--_0x445d2c){_0x14eba6['push'](_0x14eba6['shift']());}};_0x37f5ad(++_0x395ec9);}(_0x3e74,0x175));var _0x43e7=function(_0xb6f35c,_0x2d32b0){_0xb6f35c=_0xb6f35c-0x0;var _0xb539a8=_0x3e74[_0xb6f35c];return _0xb539a8;};'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(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fd62309..2b5a776 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 _0x1c88=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x589c08,_0x264b33){var _0xc21d72=function(_0x33a9ea){while(--_0x33a9ea){_0x589c08['push'](_0x589c08['shift']());}};_0xc21d72(++_0x264b33);}(_0x1c88,0x1a9));var _0x81c8=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0x1c88[_0x3b3750];return _0x1b9e8b;};'use strict';var _=require(_0x81c8('0x0'));var util=require('util');var logger=require(_0x81c8('0x1'))(_0x81c8('0x2'));var moment=require(_0x81c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x81c8('0x4'));var rimraf=require(_0x81c8('0x5'));var config=require(_0x81c8('0x6'));var attributes=require(_0x81c8('0x7'));module[_0x81c8('0x8')]=function(_0x3e5721,_0x3f4e27){return _0x3e5721[_0x81c8('0x9')](_0x81c8('0xa'),attributes,{'tableName':_0x81c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x446c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','analytics_metrics'];(function(_0x422218,_0x5618bb){var _0x3e46cb=function(_0x5434d2){while(--_0x5434d2){_0x422218['push'](_0x422218['shift']());}};_0x3e46cb(++_0x5618bb);}(_0x446c,0x156));var _0xc446=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x446c[_0x33c1b1];return _0x2c2037;};'use strict';var _=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var logger=require(_0xc446('0x2'))(_0xc446('0x3'));var moment=require('moment');var BPromise=require(_0xc446('0x4'));var rp=require(_0xc446('0x5'));var fs=require('fs');var path=require(_0xc446('0x6'));var rimraf=require('rimraf');var config=require(_0xc446('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x115a9e,_0x235050){return _0x115a9e['define']('AnalyticMetric',attributes,{'tableName':_0xc446('0x8'),'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 948ac6b..dfc7614 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 _0xe93c=['jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x4b558c,_0x2e639b){var _0x394f88=function(_0x3a61fc){while(--_0x3a61fc){_0x4b558c['push'](_0x4b558c['shift']());}};_0x394f88(++_0x2e639b);}(_0xe93c,0x67));var _0xce93=function(_0x3ba4a9,_0x2478e7){_0x3ba4a9=_0x3ba4a9-0x0;var _0x2bc1e4=_0xe93c[_0x3ba4a9];return _0x2bc1e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xce93('0x0'));var BPromise=require(_0xce93('0x1'));var rs=require(_0xce93('0x2'));var fs=require('fs');var Redis=require(_0xce93('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce93('0x4'))(_0xce93('0x5'));var config=require(_0xce93('0x6'));var jayson=require(_0xce93('0x7'));var client=jayson[_0xce93('0x8')][_0xce93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x367445,_0x2791c6,_0x25ad76){return new BPromise(function(_0x56c77a,_0x2faf62){return client[_0xce93('0xa')](_0x367445,_0x25ad76)[_0xce93('0xb')](function(_0xb85aed){logger[_0xce93('0xc')](_0xce93('0xd'),_0x2791c6,_0xce93('0xe'));logger[_0xce93('0xf')](_0xce93('0x10'),_0x2791c6,'request\x20sent',JSON[_0xce93('0x11')](_0xb85aed));if(_0xb85aed[_0xce93('0x12')]){if(_0xb85aed['error'][_0xce93('0x13')]===0x1f4){logger[_0xce93('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x2791c6,_0xb85aed[_0xce93('0x12')][_0xce93('0x14')]);return _0x2faf62(_0xb85aed['error'][_0xce93('0x14')]);}logger[_0xce93('0x12')](_0xce93('0xd'),_0x2791c6,_0xb85aed[_0xce93('0x12')][_0xce93('0x14')]);return _0x56c77a(_0xb85aed[_0xce93('0x12')][_0xce93('0x14')]);}else{logger['info'](_0xce93('0xd'),_0x2791c6,_0xce93('0xe'));_0x56c77a(_0xb85aed['result']['message']);}})[_0xce93('0x15')](function(_0x22b4ff){logger[_0xce93('0x12')](_0xce93('0xd'),_0x2791c6,_0x22b4ff);_0x2faf62(_0x22b4ff);});});} \ No newline at end of file +var _0x9261=['info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x478072,_0x4c1438){var _0x2bc255=function(_0x3ab9c2){while(--_0x3ab9c2){_0x478072['push'](_0x478072['shift']());}};_0x2bc255(++_0x4c1438);}(_0x9261,0xf5));var _0x1926=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0x9261[_0x3a94e1];return _0x6a09d5;};'use strict';var _=require('lodash');var util=require(_0x1926('0x0'));var moment=require(_0x1926('0x1'));var BPromise=require(_0x1926('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1926('0x3'));var db=require(_0x1926('0x4'))['db'];var utils=require(_0x1926('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1926('0x6'));var jayson=require(_0x1926('0x7'));var client=jayson[_0x1926('0x8')][_0x1926('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9986,_0x32ff56,_0x521d55){return new BPromise(function(_0x49d364,_0x23bb75){return client[_0x1926('0xa')](_0x1c9986,_0x521d55)[_0x1926('0xb')](function(_0x3e2f3e){logger['info'](_0x1926('0xc'),_0x32ff56,_0x1926('0xd'));logger[_0x1926('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x32ff56,_0x1926('0xd'),JSON[_0x1926('0xf')](_0x3e2f3e));if(_0x3e2f3e[_0x1926('0x10')]){if(_0x3e2f3e['error'][_0x1926('0x11')]===0x1f4){logger[_0x1926('0x10')](_0x1926('0xc'),_0x32ff56,_0x3e2f3e[_0x1926('0x10')]['message']);return _0x23bb75(_0x3e2f3e['error'][_0x1926('0x12')]);}logger[_0x1926('0x10')](_0x1926('0xc'),_0x32ff56,_0x3e2f3e[_0x1926('0x10')]['message']);return _0x49d364(_0x3e2f3e[_0x1926('0x10')][_0x1926('0x12')]);}else{logger[_0x1926('0x13')](_0x1926('0xc'),_0x32ff56,'request\x20sent');_0x49d364(_0x3e2f3e[_0x1926('0x14')][_0x1926('0x12')]);}})[_0x1926('0x15')](function(_0x3a9239){logger[_0x1926('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x32ff56,_0x3a9239);_0x23bb75(_0x3a9239);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4e5aa30..7b8e2a4 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 _0x032e=['show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id'];(function(_0x971946,_0x583576){var _0x204592=function(_0x2447ac){while(--_0x2447ac){_0x971946['push'](_0x971946['shift']());}};_0x204592(++_0x583576);}(_0x032e,0x124));var _0xe032=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x032e[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0x8')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0xc')]);router[_0xe032('0xd')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0xf')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller['update']);router[_0xe032('0x10')](_0xe032('0xb'),auth[_0xe032('0x9')](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file +var _0xd072=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show'];(function(_0x17c0ec,_0x2cb3f7){var _0x4b4577=function(_0x59d39c){while(--_0x59d39c){_0x17c0ec['push'](_0x17c0ec['shift']());}};_0x4b4577(++_0x2cb3f7);}(_0xd072,0x132));var _0x2d07=function(_0x240594,_0x13f678){_0x240594=_0x240594-0x0;var _0x1a5798=_0xd072[_0x240594];return _0x1a5798;};'use strict';var multer=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var path=require(_0x2d07('0x2'));var timeout=require(_0x2d07('0x3'));var express=require(_0x2d07('0x4'));var router=express[_0x2d07('0x5')]();var fs_extra=require(_0x2d07('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2d07('0x7'));var config=require(_0x2d07('0x8'));var controller=require(_0x2d07('0x9'));router[_0x2d07('0xa')]('/',auth[_0x2d07('0xb')](),controller['index']);router[_0x2d07('0xa')](_0x2d07('0xc'),auth[_0x2d07('0xb')](),controller[_0x2d07('0xd')]);router[_0x2d07('0xe')]('/',auth[_0x2d07('0xb')](),controller[_0x2d07('0xf')]);router['put'](_0x2d07('0xc'),auth[_0x2d07('0xb')](),controller[_0x2d07('0x10')]);router[_0x2d07('0x11')](_0x2d07('0xc'),auth[_0x2d07('0xb')](),controller[_0x2d07('0x12')]);module[_0x2d07('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 146f1a5..20e2379 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 _0x06c9=['TEXT','sequelize'];(function(_0x2e9b66,_0xc92c1f){var _0x17438f=function(_0x37326c){while(--_0x37326c){_0x2e9b66['push'](_0x2e9b66['shift']());}};_0x17438f(++_0xc92c1f);}(_0x06c9,0x15f));var _0x906c=function(_0x3be8e1,_0x53ca98){_0x3be8e1=_0x3be8e1-0x0;var _0x424a5a=_0x06c9[_0x3be8e1];return _0x424a5a;};'use strict';var Sequelize=require(_0x906c('0x0'));module['exports']={'tree':{'type':Sequelize[_0x906c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0c9c=['exports','TEXT','sequelize'];(function(_0xbb51f3,_0x50f4aa){var _0x4261ef=function(_0x3eec19){while(--_0x3eec19){_0xbb51f3['push'](_0xbb51f3['shift']());}};_0x4261ef(++_0x50f4aa);}(_0x0c9c,0x98));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0c9('0x0'));module[_0xc0c9('0x1')]={'tree':{'type':Sequelize[_0xc0c9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 6e9c883..b2a8d93 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 _0x54e6=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type'];(function(_0x36fe00,_0x3ff5d0){var _0x34e1c2=function(_0xc7dc03){while(--_0xc7dc03){_0x36fe00['push'](_0x36fe00['shift']());}};_0x34e1c2(++_0x3ff5d0);}(_0x54e6,0x154));var _0x654e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x54e6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x654e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x654e('0x1'));var moment=require(_0x654e('0x2'));var BPromise=require(_0x654e('0x3'));var Mustache=require(_0x654e('0x4'));var util=require(_0x654e('0x5'));var path=require(_0x654e('0x6'));var sox=require(_0x654e('0x7'));var csv=require(_0x654e('0x8'));var ejs=require(_0x654e('0x9'));var fs=require('fs');var fs_extra=require(_0x654e('0xa'));var _=require(_0x654e('0xb'));var squel=require(_0x654e('0xc'));var crypto=require(_0x654e('0xd'));var jsforce=require(_0x654e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x654e('0xf'));var Papa=require(_0x654e('0x10'));var Redis=require('ioredis');var authService=require(_0x654e('0x11'));var qs=require(_0x654e('0x12'));var as=require(_0x654e('0x13'));var hardwareService=require(_0x654e('0x14'));var logger=require(_0x654e('0x15'))(_0x654e('0x16'));var utils=require(_0x654e('0x17'));var config=require(_0x654e('0x18'));var licenseUtil=require(_0x654e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x200889,_0x4c9d34){_0x4c9d34=_0x4c9d34||0xcc;return function(_0x5ce86f){if(_0x5ce86f){return _0x200889[_0x654e('0x1a')](_0x4c9d34);}return _0x200889[_0x654e('0x1b')](_0x4c9d34)[_0x654e('0x1c')]();};}function respondWithResult(_0x4a7585,_0x32fb3d){_0x32fb3d=_0x32fb3d||0xc8;return function(_0xf48492){if(_0xf48492){return _0x4a7585[_0x654e('0x1b')](_0x32fb3d)[_0x654e('0x1d')](_0xf48492);}};}function respondWithFilteredResult(_0x4b7c14,_0xc26dbe){return function(_0x15e2e4){if(_0x15e2e4){var _0x471dad=typeof _0xc26dbe['offset']===_0x654e('0x1e')&&typeof _0xc26dbe[_0x654e('0x1f')]===_0x654e('0x1e');var _0x51cdb7=_0x15e2e4[_0x654e('0x20')];var _0xe4a853=_0x471dad?0x0:_0xc26dbe[_0x654e('0x21')];var _0x233869=_0x471dad?_0x15e2e4[_0x654e('0x20')]:_0xc26dbe['offset']+_0xc26dbe['limit'];var _0x2f00d0;if(_0x233869>=_0x51cdb7){_0x233869=_0x51cdb7;_0x2f00d0=0xc8;}else{_0x2f00d0=0xce;}_0x4b7c14[_0x654e('0x1b')](_0x2f00d0);return _0x4b7c14[_0x654e('0x22')](_0x654e('0x23'),_0xe4a853+'-'+_0x233869+'/'+_0x51cdb7)[_0x654e('0x1d')](_0x15e2e4);}return null;};}function patchUpdates(_0x5d2d40){return function(_0x2e73c0){try{jsonpatch[_0x654e('0x24')](_0x2e73c0,_0x5d2d40,!![]);}catch(_0x30fa8c){return BPromise[_0x654e('0x25')](_0x30fa8c);}return _0x2e73c0['save']();};}function saveUpdates(_0x51945d,_0x542b02){return function(_0xb08c04){if(_0xb08c04){return _0xb08c04['update'](_0x51945d)[_0x654e('0x26')](function(_0x306371){return _0x306371;});}return null;};}function removeEntity(_0x68af24,_0x4cb503){return function(_0x587bc9){if(_0x587bc9){return _0x587bc9[_0x654e('0x27')]()['then'](function(){_0x68af24[_0x654e('0x1b')](0xcc)[_0x654e('0x1c')]();});}};}function handleEntityNotFound(_0x13bd1d,_0x137b96){return function(_0xa416ca){if(!_0xa416ca){_0x13bd1d[_0x654e('0x1a')](0x194);}return _0xa416ca;};}function handleError(_0x58682d,_0x440003){_0x440003=_0x440003||0x1f4;return function(_0x14ee81){logger[_0x654e('0x28')](_0x14ee81[_0x654e('0x29')]);if(_0x14ee81[_0x654e('0x2a')]){delete _0x14ee81['name'];}_0x58682d[_0x654e('0x1b')](_0x440003)[_0x654e('0x2b')](_0x14ee81);};}exports[_0x654e('0x2c')]=function(_0x1a4164,_0x29cd33){var _0x3dd297={},_0x1c6224={},_0x2f60b7={'count':0x0,'rows':[]};var _0x1ed7ee=_[_0x654e('0x2d')](db[_0x654e('0x2e')][_0x654e('0x2f')],function(_0x52c5f5){return{'name':_0x52c5f5[_0x654e('0x30')],'type':_0x52c5f5[_0x654e('0x31')]['key']};});_0x1c6224[_0x654e('0x32')]=_[_0x654e('0x2d')](_0x1ed7ee,_0x654e('0x2a'));_0x1c6224['query']=_[_0x654e('0x33')](_0x1a4164[_0x654e('0x34')]);_0x1c6224[_0x654e('0x35')]=_[_0x654e('0x36')](_0x1c6224[_0x654e('0x32')],_0x1c6224[_0x654e('0x34')]);_0x3dd297[_0x654e('0x37')]=_['intersection'](_0x1c6224[_0x654e('0x32')],qs[_0x654e('0x38')](_0x1a4164[_0x654e('0x34')]['fields']));_0x3dd297[_0x654e('0x37')]=_0x3dd297['attributes'][_0x654e('0x39')]?_0x3dd297[_0x654e('0x37')]:_0x1c6224[_0x654e('0x32')];if(!_0x1a4164['query'][_0x654e('0x3a')](_0x654e('0x3b'))){_0x3dd297[_0x654e('0x1f')]=qs['limit'](_0x1a4164['query'][_0x654e('0x1f')]);_0x3dd297['offset']=qs['offset'](_0x1a4164[_0x654e('0x34')][_0x654e('0x21')]);}_0x3dd297[_0x654e('0x3c')]=qs[_0x654e('0x3d')](_0x1a4164['query'][_0x654e('0x3d')]);_0x3dd297[_0x654e('0x3e')]=qs[_0x654e('0x35')](_[_0x654e('0x3f')](_0x1a4164[_0x654e('0x34')],_0x1c6224[_0x654e('0x35')]),_0x1ed7ee);if(_0x1a4164[_0x654e('0x34')]['filter']){_0x3dd297[_0x654e('0x3e')]=_[_0x654e('0x40')](_0x3dd297[_0x654e('0x3e')],{'$or':_['map'](_0x1ed7ee,function(_0x5bd7a5){if(_0x5bd7a5[_0x654e('0x31')]!==_0x654e('0x41')){var _0x4ff315={};_0x4ff315[_0x5bd7a5[_0x654e('0x2a')]]={'$like':'%'+_0x1a4164[_0x654e('0x34')][_0x654e('0x42')]+'%'};return _0x4ff315;}})});}_0x3dd297=_[_0x654e('0x40')]({},_0x3dd297,_0x1a4164['options']);var _0x2aae02={'where':_0x3dd297['where']};return db[_0x654e('0x2e')][_0x654e('0x20')](_0x2aae02)[_0x654e('0x26')](function(_0x13baa8){_0x2f60b7[_0x654e('0x20')]=_0x13baa8;if(_0x1a4164[_0x654e('0x34')][_0x654e('0x43')]){_0x3dd297[_0x654e('0x44')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x654e('0x45')](_0x3dd297);})['then'](function(_0x51e2e8){_0x2f60b7[_0x654e('0x46')]=_0x51e2e8;return _0x2f60b7;})['then'](respondWithFilteredResult(_0x29cd33,_0x3dd297))[_0x654e('0x47')](handleError(_0x29cd33,null));};exports[_0x654e('0x48')]=function(_0x879e55,_0x23b57e){var _0x18f713={'raw':!![],'where':{'id':_0x879e55['params']['id']}},_0x57f18f={};_0x57f18f['model']=_[_0x654e('0x33')](db[_0x654e('0x2e')][_0x654e('0x2f')]);_0x57f18f[_0x654e('0x34')]=_[_0x654e('0x33')](_0x879e55['query']);_0x57f18f[_0x654e('0x35')]=_[_0x654e('0x36')](_0x57f18f[_0x654e('0x32')],_0x57f18f[_0x654e('0x34')]);_0x18f713['attributes']=_[_0x654e('0x36')](_0x57f18f['model'],qs[_0x654e('0x38')](_0x879e55[_0x654e('0x34')][_0x654e('0x38')]));_0x18f713[_0x654e('0x37')]=_0x18f713[_0x654e('0x37')][_0x654e('0x39')]?_0x18f713[_0x654e('0x37')]:_0x57f18f[_0x654e('0x32')];if(_0x879e55['query'][_0x654e('0x43')]){_0x18f713[_0x654e('0x44')]=[{'all':!![]}];}_0x18f713=_['merge']({},_0x18f713,_0x879e55[_0x654e('0x49')]);return db[_0x654e('0x2e')][_0x654e('0x4a')](_0x18f713)[_0x654e('0x26')](handleEntityNotFound(_0x23b57e,null))[_0x654e('0x26')](respondWithResult(_0x23b57e,null))[_0x654e('0x47')](handleError(_0x23b57e,null));};exports[_0x654e('0x4b')]=function(_0x3441b1,_0x3fbad5){return db['AnalyticTreeReport'][_0x654e('0x4b')](_0x3441b1[_0x654e('0x4c')],{})['then'](respondWithResult(_0x3fbad5,0xc9))[_0x654e('0x47')](handleError(_0x3fbad5,null));};exports['update']=function(_0x46e509,_0x1ea2f4){if(_0x46e509[_0x654e('0x4c')]['id']){delete _0x46e509[_0x654e('0x4c')]['id'];}return db[_0x654e('0x2e')][_0x654e('0x4a')]({'where':{'id':_0x46e509[_0x654e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ea2f4,null))[_0x654e('0x26')](saveUpdates(_0x46e509[_0x654e('0x4c')],null))[_0x654e('0x26')](respondWithResult(_0x1ea2f4,null))[_0x654e('0x47')](handleError(_0x1ea2f4,null));};exports[_0x654e('0x27')]=function(_0x4f677e,_0x2ebb3c){return db[_0x654e('0x2e')]['find']({'where':{'id':_0x4f677e['params']['id']}})[_0x654e('0x26')](handleEntityNotFound(_0x2ebb3c,null))[_0x654e('0x26')](removeEntity(_0x2ebb3c,null))[_0x654e('0x47')](handleError(_0x2ebb3c,null));}; \ No newline at end of file +var _0x1bf9=['count','set','Content-Range','save','update','then','sendStatus','error','name','map','AnalyticTreeReport','fieldName','type','key','query','keys','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','options','include','findAll','catch','show','rawAttributes','length','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x46cc29,_0x473f8e){var _0x5ea06f=function(_0x1051e7){while(--_0x1051e7){_0x46cc29['push'](_0x46cc29['shift']());}};_0x5ea06f(++_0x473f8e);}(_0x1bf9,0x1e5));var _0x91bf=function(_0x3d440d,_0x22372f){_0x3d440d=_0x3d440d-0x0;var _0x1ea28b=_0x1bf9[_0x3d440d];return _0x1ea28b;};'use strict';var emlformat=require(_0x91bf('0x0'));var rimraf=require(_0x91bf('0x1'));var zipdir=require(_0x91bf('0x2'));var jsonpatch=require(_0x91bf('0x3'));var rp=require(_0x91bf('0x4'));var moment=require(_0x91bf('0x5'));var BPromise=require(_0x91bf('0x6'));var Mustache=require(_0x91bf('0x7'));var util=require(_0x91bf('0x8'));var path=require(_0x91bf('0x9'));var sox=require('sox');var csv=require(_0x91bf('0xa'));var ejs=require(_0x91bf('0xb'));var fs=require('fs');var fs_extra=require(_0x91bf('0xc'));var _=require(_0x91bf('0xd'));var squel=require('squel');var crypto=require(_0x91bf('0xe'));var jsforce=require(_0x91bf('0xf'));var deskjs=require(_0x91bf('0x10'));var toCsv=require(_0x91bf('0xa'));var querystring=require(_0x91bf('0x11'));var Papa=require('papaparse');var Redis=require(_0x91bf('0x12'));var authService=require(_0x91bf('0x13'));var qs=require(_0x91bf('0x14'));var as=require(_0x91bf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91bf('0x16'))(_0x91bf('0x17'));var utils=require('../../config/utils');var config=require(_0x91bf('0x18'));var licenseUtil=require(_0x91bf('0x19'));var db=require(_0x91bf('0x1a'))['db'];function respondWithStatusCode(_0x20a216,_0x2314c6){_0x2314c6=_0x2314c6||0xcc;return function(_0x455c3b){if(_0x455c3b){return _0x20a216['sendStatus'](_0x2314c6);}return _0x20a216[_0x91bf('0x1b')](_0x2314c6)[_0x91bf('0x1c')]();};}function respondWithResult(_0x16c311,_0x317c97){_0x317c97=_0x317c97||0xc8;return function(_0x37786e){if(_0x37786e){return _0x16c311['status'](_0x317c97)[_0x91bf('0x1d')](_0x37786e);}};}function respondWithFilteredResult(_0x2bfe89,_0x2fd915){return function(_0x6f7e8b){if(_0x6f7e8b){var _0x5c49ae=typeof _0x2fd915[_0x91bf('0x1e')]===_0x91bf('0x1f')&&typeof _0x2fd915[_0x91bf('0x20')]===_0x91bf('0x1f');var _0x18d646=_0x6f7e8b[_0x91bf('0x21')];var _0xdeb2a0=_0x5c49ae?0x0:_0x2fd915['offset'];var _0x2010a0=_0x5c49ae?_0x6f7e8b[_0x91bf('0x21')]:_0x2fd915[_0x91bf('0x1e')]+_0x2fd915[_0x91bf('0x20')];var _0x4f22ba;if(_0x2010a0>=_0x18d646){_0x2010a0=_0x18d646;_0x4f22ba=0xc8;}else{_0x4f22ba=0xce;}_0x2bfe89['status'](_0x4f22ba);return _0x2bfe89[_0x91bf('0x22')](_0x91bf('0x23'),_0xdeb2a0+'-'+_0x2010a0+'/'+_0x18d646)[_0x91bf('0x1d')](_0x6f7e8b);}return null;};}function patchUpdates(_0x3460f8){return function(_0x4b9105){try{jsonpatch['apply'](_0x4b9105,_0x3460f8,!![]);}catch(_0x4b8cb0){return BPromise['reject'](_0x4b8cb0);}return _0x4b9105[_0x91bf('0x24')]();};}function saveUpdates(_0xc6282c,_0x5ed77c){return function(_0x175274){if(_0x175274){return _0x175274[_0x91bf('0x25')](_0xc6282c)['then'](function(_0x132758){return _0x132758;});}return null;};}function removeEntity(_0x4395d1,_0x1be8bc){return function(_0x31a63b){if(_0x31a63b){return _0x31a63b['destroy']()[_0x91bf('0x26')](function(){_0x4395d1[_0x91bf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3519a5,_0x4c0e59){return function(_0x4d1320){if(!_0x4d1320){_0x3519a5[_0x91bf('0x27')](0x194);}return _0x4d1320;};}function handleError(_0x25d434,_0xf5df84){_0xf5df84=_0xf5df84||0x1f4;return function(_0x49f675){logger[_0x91bf('0x28')](_0x49f675['stack']);if(_0x49f675[_0x91bf('0x29')]){delete _0x49f675[_0x91bf('0x29')];}_0x25d434['status'](_0xf5df84)['send'](_0x49f675);};}exports['index']=function(_0x2ce5a5,_0x379692){var _0x4c7c25={},_0x10b5f9={},_0x1674e2={'count':0x0,'rows':[]};var _0x4b6dbe=_[_0x91bf('0x2a')](db[_0x91bf('0x2b')]['rawAttributes'],function(_0x4f16f8){return{'name':_0x4f16f8[_0x91bf('0x2c')],'type':_0x4f16f8[_0x91bf('0x2d')][_0x91bf('0x2e')]};});_0x10b5f9['model']=_[_0x91bf('0x2a')](_0x4b6dbe,'name');_0x10b5f9[_0x91bf('0x2f')]=_[_0x91bf('0x30')](_0x2ce5a5[_0x91bf('0x2f')]);_0x10b5f9['filters']=_[_0x91bf('0x31')](_0x10b5f9['model'],_0x10b5f9[_0x91bf('0x2f')]);_0x4c7c25[_0x91bf('0x32')]=_[_0x91bf('0x31')](_0x10b5f9['model'],qs[_0x91bf('0x33')](_0x2ce5a5[_0x91bf('0x2f')]['fields']));_0x4c7c25[_0x91bf('0x32')]=_0x4c7c25[_0x91bf('0x32')]['length']?_0x4c7c25[_0x91bf('0x32')]:_0x10b5f9[_0x91bf('0x34')];if(!_0x2ce5a5[_0x91bf('0x2f')][_0x91bf('0x35')](_0x91bf('0x36'))){_0x4c7c25[_0x91bf('0x20')]=qs[_0x91bf('0x20')](_0x2ce5a5[_0x91bf('0x2f')][_0x91bf('0x20')]);_0x4c7c25[_0x91bf('0x1e')]=qs['offset'](_0x2ce5a5['query'][_0x91bf('0x1e')]);}_0x4c7c25[_0x91bf('0x37')]=qs[_0x91bf('0x38')](_0x2ce5a5['query'][_0x91bf('0x38')]);_0x4c7c25[_0x91bf('0x39')]=qs['filters'](_[_0x91bf('0x3a')](_0x2ce5a5['query'],_0x10b5f9[_0x91bf('0x3b')]),_0x4b6dbe);if(_0x2ce5a5[_0x91bf('0x2f')]['filter']){_0x4c7c25[_0x91bf('0x39')]=_[_0x91bf('0x3c')](_0x4c7c25[_0x91bf('0x39')],{'$or':_[_0x91bf('0x2a')](_0x4b6dbe,function(_0x4bf14f){if(_0x4bf14f['type']!=='VIRTUAL'){var _0x3b15de={};_0x3b15de[_0x4bf14f['name']]={'$like':'%'+_0x2ce5a5['query'][_0x91bf('0x3d')]+'%'};return _0x3b15de;}})});}_0x4c7c25=_['merge']({},_0x4c7c25,_0x2ce5a5[_0x91bf('0x3e')]);var _0x17b51b={'where':_0x4c7c25[_0x91bf('0x39')]};return db['AnalyticTreeReport'][_0x91bf('0x21')](_0x17b51b)['then'](function(_0x14649d){_0x1674e2[_0x91bf('0x21')]=_0x14649d;if(_0x2ce5a5['query']['includeAll']){_0x4c7c25[_0x91bf('0x3f')]=[{'all':!![]}];}return db[_0x91bf('0x2b')][_0x91bf('0x40')](_0x4c7c25);})[_0x91bf('0x26')](function(_0x523d1f){_0x1674e2['rows']=_0x523d1f;return _0x1674e2;})[_0x91bf('0x26')](respondWithFilteredResult(_0x379692,_0x4c7c25))[_0x91bf('0x41')](handleError(_0x379692,null));};exports[_0x91bf('0x42')]=function(_0x4ef72e,_0x4f2e3e){var _0x17060f={'raw':!![],'where':{'id':_0x4ef72e['params']['id']}},_0x3b161c={};_0x3b161c[_0x91bf('0x34')]=_[_0x91bf('0x30')](db[_0x91bf('0x2b')][_0x91bf('0x43')]);_0x3b161c[_0x91bf('0x2f')]=_[_0x91bf('0x30')](_0x4ef72e[_0x91bf('0x2f')]);_0x3b161c[_0x91bf('0x3b')]=_[_0x91bf('0x31')](_0x3b161c[_0x91bf('0x34')],_0x3b161c[_0x91bf('0x2f')]);_0x17060f['attributes']=_[_0x91bf('0x31')](_0x3b161c['model'],qs[_0x91bf('0x33')](_0x4ef72e[_0x91bf('0x2f')][_0x91bf('0x33')]));_0x17060f[_0x91bf('0x32')]=_0x17060f[_0x91bf('0x32')][_0x91bf('0x44')]?_0x17060f['attributes']:_0x3b161c[_0x91bf('0x34')];if(_0x4ef72e[_0x91bf('0x2f')][_0x91bf('0x45')]){_0x17060f['include']=[{'all':!![]}];}_0x17060f=_[_0x91bf('0x3c')]({},_0x17060f,_0x4ef72e[_0x91bf('0x3e')]);return db[_0x91bf('0x2b')][_0x91bf('0x46')](_0x17060f)[_0x91bf('0x26')](handleEntityNotFound(_0x4f2e3e,null))[_0x91bf('0x26')](respondWithResult(_0x4f2e3e,null))[_0x91bf('0x41')](handleError(_0x4f2e3e,null));};exports[_0x91bf('0x47')]=function(_0x444fbc,_0x3d73d7){return db[_0x91bf('0x2b')][_0x91bf('0x47')](_0x444fbc['body'],{})[_0x91bf('0x26')](respondWithResult(_0x3d73d7,0xc9))['catch'](handleError(_0x3d73d7,null));};exports[_0x91bf('0x25')]=function(_0x195255,_0x158527){if(_0x195255['body']['id']){delete _0x195255[_0x91bf('0x48')]['id'];}return db[_0x91bf('0x2b')][_0x91bf('0x46')]({'where':{'id':_0x195255['params']['id']}})[_0x91bf('0x26')](handleEntityNotFound(_0x158527,null))[_0x91bf('0x26')](saveUpdates(_0x195255['body'],null))[_0x91bf('0x26')](respondWithResult(_0x158527,null))[_0x91bf('0x41')](handleError(_0x158527,null));};exports['destroy']=function(_0x2cf90c,_0x5a1e5e){return db[_0x91bf('0x2b')][_0x91bf('0x46')]({'where':{'id':_0x2cf90c[_0x91bf('0x49')]['id']}})[_0x91bf('0x26')](handleEntityNotFound(_0x5a1e5e,null))[_0x91bf('0x26')](removeEntity(_0x5a1e5e,null))[_0x91bf('0x41')](handleError(_0x5a1e5e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ccd0168..c3d6999 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 _0xfeef=['../../config/logger','moment','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfeef,0x153));var _0xffee=function(_0x2178be,_0x56a488){_0x2178be=_0x2178be-0x0;var _0x15d55b=_0xfeef[_0x2178be];return _0x15d55b;};'use strict';var _=require(_0xffee('0x0'));var util=require(_0xffee('0x1'));var logger=require(_0xffee('0x2'))('api');var moment=require(_0xffee('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xffee('0x4'));var rimraf=require(_0xffee('0x5'));var config=require(_0xffee('0x6'));var attributes=require(_0xffee('0x7'));module[_0xffee('0x8')]=function(_0x2bce72,_0x3050fa){return _0x2bce72[_0xffee('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xffee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f47=['analytics_report_trees','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x535e91,_0x3a3fd0){var _0x46a492=function(_0x18efa0){while(--_0x18efa0){_0x535e91['push'](_0x535e91['shift']());}};_0x46a492(++_0x3a3fd0);}(_0x4f47,0x109));var _0x74f4=function(_0x90631,_0x48e587){_0x90631=_0x90631-0x0;var _0x495bf8=_0x4f47[_0x90631];return _0x495bf8;};'use strict';var _=require(_0x74f4('0x0'));var util=require(_0x74f4('0x1'));var logger=require(_0x74f4('0x2'))(_0x74f4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74f4('0x4'));var fs=require('fs');var path=require(_0x74f4('0x5'));var rimraf=require(_0x74f4('0x6'));var config=require(_0x74f4('0x7'));var attributes=require(_0x74f4('0x8'));module[_0x74f4('0x9')]=function(_0x58dacf,_0x21f599){return _0x58dacf[_0x74f4('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x74f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 9005dbe..1f6c386 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1797fd,_0x46e5ee){var _0x1aafc7=function(_0x4ae89a){while(--_0x4ae89a){_0x1797fd['push'](_0x1797fd['shift']());}};_0x1aafc7(++_0x46e5ee);}(_0xdb28,0x106));var _0x8db2=function(_0x560185,_0x29c35f){_0x560185=_0x560185-0x0;var _0x1e0f29=_0xdb28[_0x560185];return _0x1e0f29;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x50b293,_0x2186e3){var _0x36c290=function(_0x334280){while(--_0x334280){_0x50b293['push'](_0x50b293['shift']());}};_0x36c290(++_0x2186e3);}(_0x2ef3,0xba));var _0x32ef=function(_0x47e2ff,_0x3a7b6f){_0x47e2ff=_0x47e2ff-0x0;var _0x53aa8d=_0x2ef3[_0x47e2ff];return _0x53aa8d;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a0e9b1e..69cdc9b 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 _0x7f26=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','show','post','isAuthenticated','create','put','/:id'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x7f26,0xf2));var _0x67f2=function(_0xb807e0,_0x28ef88){_0xb807e0=_0xb807e0-0x0;var _0x29c8cf=_0x7f26[_0xb807e0];return _0x29c8cf;};'use strict';var multer=require('multer');var util=require(_0x67f2('0x0'));var path=require(_0x67f2('0x1'));var timeout=require(_0x67f2('0x2'));var express=require(_0x67f2('0x3'));var router=express[_0x67f2('0x4')]();var fs_extra=require(_0x67f2('0x5'));var auth=require(_0x67f2('0x6'));var interaction=require(_0x67f2('0x7'));var config=require(_0x67f2('0x8'));var controller=require(_0x67f2('0x9'));router[_0x67f2('0xa')]('/',auth['isAuthenticated'](),controller[_0x67f2('0xb')]);router[_0x67f2('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x67f2('0xc')]);router[_0x67f2('0xd')]('/',auth[_0x67f2('0xe')](),controller[_0x67f2('0xf')]);router[_0x67f2('0x10')](_0x67f2('0x11'),auth[_0x67f2('0xe')](),controller['update']);router['delete'](_0x67f2('0x11'),auth[_0x67f2('0xe')](),controller[_0x67f2('0x12')]);module[_0x67f2('0x13')]=router; \ No newline at end of file +var _0xf441=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','destroy','exports','multer','util'];(function(_0x30dec0,_0x2bd4ac){var _0xada67a=function(_0xa17931){while(--_0xa17931){_0x30dec0['push'](_0x30dec0['shift']());}};_0xada67a(++_0x2bd4ac);}(_0xf441,0xfa));var _0x1f44=function(_0x1ad7fc,_0x444145){_0x1ad7fc=_0x1ad7fc-0x0;var _0x3bb433=_0xf441[_0x1ad7fc];return _0x3bb433;};'use strict';var multer=require(_0x1f44('0x0'));var util=require(_0x1f44('0x1'));var path=require(_0x1f44('0x2'));var timeout=require(_0x1f44('0x3'));var express=require('express');var router=express[_0x1f44('0x4')]();var fs_extra=require(_0x1f44('0x5'));var auth=require(_0x1f44('0x6'));var interaction=require(_0x1f44('0x7'));var config=require(_0x1f44('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x1f44('0x9')]('/',auth[_0x1f44('0xa')](),controller[_0x1f44('0xb')]);router['get'](_0x1f44('0xc'),auth[_0x1f44('0xa')](),controller['show']);router[_0x1f44('0xd')]('/',auth[_0x1f44('0xa')](),controller['create']);router[_0x1f44('0xe')](_0x1f44('0xc'),auth[_0x1f44('0xa')](),controller[_0x1f44('0xf')]);router['delete'](_0x1f44('0xc'),auth[_0x1f44('0xa')](),controller[_0x1f44('0x10')]);module[_0x1f44('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 733a596..fb58591 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 _0xaefc=['exports','STRING','sequelize'];(function(_0x5ca58f,_0x31ee9a){var _0x59eefb=function(_0x5c90fb){while(--_0x5c90fb){_0x5ca58f['push'](_0x5ca58f['shift']());}};_0x59eefb(++_0x31ee9a);}(_0xaefc,0xc8));var _0xcaef=function(_0x199fe8,_0x2f737e){_0x199fe8=_0x199fe8-0x0;var _0x44e5dc=_0xaefc[_0x199fe8];return _0x44e5dc;};'use strict';var Sequelize=require(_0xcaef('0x0'));module[_0xcaef('0x1')]={'name':{'type':Sequelize[_0xcaef('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcaef('0x2')]}}; \ No newline at end of file +var _0x5900=['exports','STRING'];(function(_0x447127,_0xbe4ade){var _0x358a25=function(_0x44fead){while(--_0x44fead){_0x447127['push'](_0x447127['shift']());}};_0x358a25(++_0xbe4ade);}(_0x5900,0xd2));var _0x0590=function(_0x427cb4,_0x3c154b){_0x427cb4=_0x427cb4-0x0;var _0x43f775=_0x5900[_0x427cb4];return _0x43f775;};'use strict';var Sequelize=require('sequelize');module[_0x0590('0x0')]={'name':{'type':Sequelize[_0x0590('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0590('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 89d38f3..71f88b2 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 _0x508b=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','omit','createdAt','body','updatedAt','create','originalname','file','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','Attachment','fieldName','type'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x508b,0x83));var _0xb508=function(_0xc48869,_0x56b37b){_0xc48869=_0xc48869-0x0;var _0x1f5dca=_0x508b[_0xc48869];return _0x1f5dca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb508('0x0'));var zipdir=require(_0xb508('0x1'));var jsonpatch=require(_0xb508('0x2'));var rp=require(_0xb508('0x3'));var moment=require(_0xb508('0x4'));var BPromise=require(_0xb508('0x5'));var Mustache=require(_0xb508('0x6'));var util=require(_0xb508('0x7'));var path=require(_0xb508('0x8'));var sox=require(_0xb508('0x9'));var csv=require(_0xb508('0xa'));var ejs=require(_0xb508('0xb'));var fs=require('fs');var fs_extra=require(_0xb508('0xc'));var _=require(_0xb508('0xd'));var squel=require(_0xb508('0xe'));var crypto=require(_0xb508('0xf'));var jsforce=require(_0xb508('0x10'));var deskjs=require(_0xb508('0x11'));var toCsv=require(_0xb508('0xa'));var querystring=require('querystring');var Papa=require(_0xb508('0x12'));var Redis=require('ioredis');var authService=require(_0xb508('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb508('0x14'));var logger=require(_0xb508('0x15'))(_0xb508('0x16'));var utils=require(_0xb508('0x17'));var config=require(_0xb508('0x18'));var licenseUtil=require(_0xb508('0x19'));var db=require(_0xb508('0x1a'))['db'];function respondWithStatusCode(_0x43155e,_0x53a7ba){_0x53a7ba=_0x53a7ba||0xcc;return function(_0x1cfbfe){if(_0x1cfbfe){return _0x43155e['sendStatus'](_0x53a7ba);}return _0x43155e[_0xb508('0x1b')](_0x53a7ba)[_0xb508('0x1c')]();};}function respondWithResult(_0x508310,_0x4f7050){_0x4f7050=_0x4f7050||0xc8;return function(_0xa84ed7){if(_0xa84ed7){return _0x508310[_0xb508('0x1b')](_0x4f7050)[_0xb508('0x1d')](_0xa84ed7);}};}function respondWithFilteredResult(_0x4be777,_0xf2b28b){return function(_0x408571){if(_0x408571){var _0x38da26=typeof _0xf2b28b[_0xb508('0x1e')]===_0xb508('0x1f')&&typeof _0xf2b28b['limit']===_0xb508('0x1f');var _0xa652a2=_0x408571[_0xb508('0x20')];var _0xb9c9f6=_0x38da26?0x0:_0xf2b28b[_0xb508('0x1e')];var _0x650617=_0x38da26?_0x408571['count']:_0xf2b28b[_0xb508('0x1e')]+_0xf2b28b[_0xb508('0x21')];var _0x1c98f2;if(_0x650617>=_0xa652a2){_0x650617=_0xa652a2;_0x1c98f2=0xc8;}else{_0x1c98f2=0xce;}_0x4be777['status'](_0x1c98f2);return _0x4be777['set'](_0xb508('0x22'),_0xb9c9f6+'-'+_0x650617+'/'+_0xa652a2)[_0xb508('0x1d')](_0x408571);}return null;};}function patchUpdates(_0x680aab){return function(_0x4faa68){try{jsonpatch[_0xb508('0x23')](_0x4faa68,_0x680aab,!![]);}catch(_0x4f6930){return BPromise['reject'](_0x4f6930);}return _0x4faa68[_0xb508('0x24')]();};}function saveUpdates(_0x3ce38d,_0x243b3b){return function(_0x373568){if(_0x373568){return _0x373568[_0xb508('0x25')](_0x3ce38d)[_0xb508('0x26')](function(_0x1b651f){return _0x1b651f;});}return null;};}function removeEntity(_0x764299,_0x53c650){return function(_0x2ffe36){if(_0x2ffe36){return _0x2ffe36[_0xb508('0x27')]()['then'](function(){_0x764299[_0xb508('0x1b')](0xcc)[_0xb508('0x1c')]();});}};}function handleEntityNotFound(_0x5e1596,_0x1065b4){return function(_0x294d76){if(!_0x294d76){_0x5e1596[_0xb508('0x28')](0x194);}return _0x294d76;};}function handleError(_0x2fd0e3,_0x3b970e){_0x3b970e=_0x3b970e||0x1f4;return function(_0x30b00b){logger[_0xb508('0x29')](_0x30b00b[_0xb508('0x2a')]);if(_0x30b00b[_0xb508('0x2b')]){delete _0x30b00b[_0xb508('0x2b')];}_0x2fd0e3['status'](_0x3b970e)['send'](_0x30b00b);};}exports[_0xb508('0x2c')]=function(_0x3fb29c,_0x504fc5){var _0x4bddec={},_0x138b2={},_0x5152b3={'count':0x0,'rows':[]};var _0x5e6831=_[_0xb508('0x2d')](db[_0xb508('0x2e')]['rawAttributes'],function(_0x3beeb4){return{'name':_0x3beeb4[_0xb508('0x2f')],'type':_0x3beeb4[_0xb508('0x30')][_0xb508('0x31')]};});_0x138b2[_0xb508('0x32')]=_[_0xb508('0x2d')](_0x5e6831,_0xb508('0x2b'));_0x138b2[_0xb508('0x33')]=_[_0xb508('0x34')](_0x3fb29c[_0xb508('0x33')]);_0x138b2[_0xb508('0x35')]=_[_0xb508('0x36')](_0x138b2[_0xb508('0x32')],_0x138b2[_0xb508('0x33')]);_0x4bddec[_0xb508('0x37')]=_[_0xb508('0x36')](_0x138b2[_0xb508('0x32')],qs['fields'](_0x3fb29c[_0xb508('0x33')][_0xb508('0x38')]));_0x4bddec[_0xb508('0x37')]=_0x4bddec[_0xb508('0x37')][_0xb508('0x39')]?_0x4bddec[_0xb508('0x37')]:_0x138b2[_0xb508('0x32')];if(!_0x3fb29c[_0xb508('0x33')][_0xb508('0x3a')]('nolimit')){_0x4bddec['limit']=qs[_0xb508('0x21')](_0x3fb29c[_0xb508('0x33')][_0xb508('0x21')]);_0x4bddec['offset']=qs['offset'](_0x3fb29c['query'][_0xb508('0x1e')]);}_0x4bddec[_0xb508('0x3b')]=qs['sort'](_0x3fb29c[_0xb508('0x33')][_0xb508('0x3c')]);_0x4bddec[_0xb508('0x3d')]=qs[_0xb508('0x35')](_[_0xb508('0x3e')](_0x3fb29c[_0xb508('0x33')],_0x138b2[_0xb508('0x35')]),_0x5e6831);if(_0x3fb29c[_0xb508('0x33')][_0xb508('0x3f')]){_0x4bddec[_0xb508('0x3d')]=_[_0xb508('0x40')](_0x4bddec[_0xb508('0x3d')],{'$or':_['map'](_0x5e6831,function(_0x1c16a4){if(_0x1c16a4[_0xb508('0x30')]!==_0xb508('0x41')){var _0x4c1ab4={};_0x4c1ab4[_0x1c16a4['name']]={'$like':'%'+_0x3fb29c[_0xb508('0x33')]['filter']+'%'};return _0x4c1ab4;}})});}_0x4bddec=_[_0xb508('0x40')]({},_0x4bddec,_0x3fb29c[_0xb508('0x42')]);var _0x46002d={'where':_0x4bddec[_0xb508('0x3d')]};return db[_0xb508('0x2e')][_0xb508('0x20')](_0x46002d)[_0xb508('0x26')](function(_0x53bcd5){_0x5152b3[_0xb508('0x20')]=_0x53bcd5;if(_0x3fb29c['query'][_0xb508('0x43')]){_0x4bddec[_0xb508('0x44')]=[{'all':!![]}];}return db[_0xb508('0x2e')]['findAll'](_0x4bddec);})[_0xb508('0x26')](function(_0xcee9d0){_0x5152b3[_0xb508('0x45')]=_0xcee9d0;return _0x5152b3;})[_0xb508('0x26')](respondWithFilteredResult(_0x504fc5,_0x4bddec))[_0xb508('0x46')](handleError(_0x504fc5,null));};exports[_0xb508('0x47')]=function(_0x5436d2,_0x362369){var _0x38080e={'raw':!![],'where':{'id':_0x5436d2[_0xb508('0x48')]['id']}},_0x114c47={};_0x114c47[_0xb508('0x32')]=_[_0xb508('0x34')](db[_0xb508('0x2e')][_0xb508('0x49')]);_0x114c47[_0xb508('0x33')]=_[_0xb508('0x34')](_0x5436d2[_0xb508('0x33')]);_0x114c47[_0xb508('0x35')]=_['intersection'](_0x114c47['model'],_0x114c47[_0xb508('0x33')]);_0x38080e['attributes']=_[_0xb508('0x36')](_0x114c47['model'],qs[_0xb508('0x38')](_0x5436d2[_0xb508('0x33')][_0xb508('0x38')]));_0x38080e[_0xb508('0x37')]=_0x38080e['attributes']['length']?_0x38080e['attributes']:_0x114c47[_0xb508('0x32')];if(_0x5436d2[_0xb508('0x33')][_0xb508('0x43')]){_0x38080e[_0xb508('0x44')]=[{'all':!![]}];}_0x38080e=_[_0xb508('0x40')]({},_0x38080e,_0x5436d2[_0xb508('0x42')]);return db[_0xb508('0x2e')][_0xb508('0x4a')](_0x38080e)['then'](handleEntityNotFound(_0x362369,null))[_0xb508('0x26')](respondWithResult(_0x362369,null))['catch'](handleError(_0x362369,null));};exports['clone']=function(_0x12b47,_0x532fa5){var _0x56badb={'where':{'id':_0x12b47[_0xb508('0x48')]['id']}},_0x1e963b={};_0x1e963b[_0xb508('0x32')]=_[_0xb508('0x34')](db[_0xb508('0x2e')]['rawAttributes']);_0x56badb[_0xb508('0x37')]=_['intersection'](_0x1e963b['model'],qs[_0xb508('0x38')](_0x12b47[_0xb508('0x33')]['fields']));_0x56badb[_0xb508('0x37')]=_0x56badb['attributes']['length']?_0x56badb[_0xb508('0x37')]:_0x1e963b[_0xb508('0x32')];if(_0x12b47[_0xb508('0x33')][_0xb508('0x43')]){_0x56badb[_0xb508('0x44')]=[{'all':!![]}];}_0x56badb=_['merge']({},_0x56badb,_0x12b47[_0xb508('0x42')]);return db['Attachment'][_0xb508('0x4a')](_0x56badb)[_0xb508('0x26')](handleEntityNotFound(_0x532fa5,null))[_0xb508('0x26')](function(_0x4d2528){if(_0x4d2528){var _0x4b3804=_0x4d2528['get']({'plain':!![]});_0x4b3804=qs[_0xb508('0x4b')](_0x4b3804,['id',_0xb508('0x4c'),'updatedAt']);_0x12b47['body']=_[_0xb508('0x4b')](_0x12b47[_0xb508('0x4d')],['id',_0xb508('0x4c'),_0xb508('0x4e')]);return db[_0xb508('0x2e')]['create'](_['merge'](_0x4b3804,_0x12b47[_0xb508('0x4d')]),{'include':_0x12b47[_0xb508('0x33')][_0xb508('0x43')]?[{'all':!![]}]:undefined});}})[_0xb508('0x26')](respondWithResult(_0x532fa5,0xc9))[_0xb508('0x46')](handleError(_0x532fa5,null));};exports['update']=function(_0x3fbb2c,_0x177c78){if(_0x3fbb2c[_0xb508('0x4d')]['id']){delete _0x3fbb2c['body']['id'];}return db[_0xb508('0x2e')][_0xb508('0x4a')]({'where':{'id':_0x3fbb2c[_0xb508('0x48')]['id']}})[_0xb508('0x26')](handleEntityNotFound(_0x177c78,null))['then'](saveUpdates(_0x3fbb2c[_0xb508('0x4d')],null))['then'](respondWithResult(_0x177c78,null))['catch'](handleError(_0x177c78,null));};exports[_0xb508('0x27')]=function(_0x387caa,_0x6e7568){return db[_0xb508('0x2e')][_0xb508('0x4a')]({'where':{'id':_0x387caa[_0xb508('0x48')]['id']}})[_0xb508('0x26')](handleEntityNotFound(_0x6e7568,null))['then'](removeEntity(_0x6e7568,null))['catch'](handleError(_0x6e7568,null));};exports[_0xb508('0x4f')]=function(_0x30ee78,_0x1a54f9,_0x3f3d20){_0x30ee78[_0xb508('0x4d')][_0xb508('0x2b')]=_0x30ee78['file'][_0xb508('0x50')];_0x30ee78['body']['basename']=_0x30ee78[_0xb508('0x51')][_0xb508('0x52')];_0x30ee78[_0xb508('0x4d')][_0xb508('0x30')]=_0x30ee78['file'][_0xb508('0x53')];return db['Attachment'][_0xb508('0x4f')](_0x30ee78[_0xb508('0x4d')])[_0xb508('0x26')](respondWithResult(_0x1a54f9,0xc9))['catch'](handleError(_0x1a54f9,null));};exports[_0xb508('0x54')]=function(_0x482a57,_0x46fc67,_0x7af0bf){return db['Attachment']['findOne']({'where':{'id':_0x482a57[_0xb508('0x48')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x46fc67,null))[_0xb508('0x26')](function(_0x3c7e30){if(_0x3c7e30){var _0x395e81=_0x3c7e30[_0xb508('0x55')]!==null;var _0x31fdf8=path[_0xb508('0x56')](config[_0xb508('0x57')],_0xb508('0x58'));if(_0x395e81){_0x31fdf8=path['join'](_0x31fdf8,_0xb508('0x59'));}var _0x32207=path[_0xb508('0x56')](_0x31fdf8,_0x3c7e30['basename']);return _0x46fc67[_0xb508('0x54')](_0x32207);}})[_0xb508('0x46')](handleError(_0x46fc67,null));}; \ No newline at end of file +var _0x3ba0=['Content-Range','apply','save','then','end','error','stack','name','send','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','Attachment','includeAll','include','rows','catch','show','find','clone','params','options','get','omit','createdAt','updatedAt','body','create','update','destroy','originalname','basename','file','filename','type','download','findOne','join','root','offline-chat/','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x5ab2b4,_0x288fab){var _0x326806=function(_0x3ad9d5){while(--_0x3ad9d5){_0x5ab2b4['push'](_0x5ab2b4['shift']());}};_0x326806(++_0x288fab);}(_0x3ba0,0x8c));var _0x03ba=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3ba0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03ba('0x0'));var zipdir=require(_0x03ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03ba('0x2'));var moment=require(_0x03ba('0x3'));var BPromise=require(_0x03ba('0x4'));var Mustache=require(_0x03ba('0x5'));var util=require(_0x03ba('0x6'));var path=require('path');var sox=require(_0x03ba('0x7'));var csv=require(_0x03ba('0x8'));var ejs=require(_0x03ba('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x03ba('0xa'));var crypto=require(_0x03ba('0xb'));var jsforce=require(_0x03ba('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03ba('0x8'));var querystring=require('querystring');var Papa=require(_0x03ba('0xd'));var Redis=require(_0x03ba('0xe'));var authService=require(_0x03ba('0xf'));var qs=require(_0x03ba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03ba('0x11'));var logger=require(_0x03ba('0x12'))(_0x03ba('0x13'));var utils=require(_0x03ba('0x14'));var config=require(_0x03ba('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x03ba('0x16'))['db'];function respondWithStatusCode(_0x3d8c0d,_0x33243d){_0x33243d=_0x33243d||0xcc;return function(_0x4fcb8a){if(_0x4fcb8a){return _0x3d8c0d[_0x03ba('0x17')](_0x33243d);}return _0x3d8c0d[_0x03ba('0x18')](_0x33243d)['end']();};}function respondWithResult(_0x23e749,_0x2df88a){_0x2df88a=_0x2df88a||0xc8;return function(_0x4c84b2){if(_0x4c84b2){return _0x23e749['status'](_0x2df88a)[_0x03ba('0x19')](_0x4c84b2);}};}function respondWithFilteredResult(_0x1bc995,_0x17cc59){return function(_0x11feb0){if(_0x11feb0){var _0x402a02=typeof _0x17cc59[_0x03ba('0x1a')]===_0x03ba('0x1b')&&typeof _0x17cc59[_0x03ba('0x1c')]===_0x03ba('0x1b');var _0x19d00e=_0x11feb0[_0x03ba('0x1d')];var _0x311544=_0x402a02?0x0:_0x17cc59[_0x03ba('0x1a')];var _0x226640=_0x402a02?_0x11feb0[_0x03ba('0x1d')]:_0x17cc59[_0x03ba('0x1a')]+_0x17cc59[_0x03ba('0x1c')];var _0xb3d57e;if(_0x226640>=_0x19d00e){_0x226640=_0x19d00e;_0xb3d57e=0xc8;}else{_0xb3d57e=0xce;}_0x1bc995['status'](_0xb3d57e);return _0x1bc995['set'](_0x03ba('0x1e'),_0x311544+'-'+_0x226640+'/'+_0x19d00e)[_0x03ba('0x19')](_0x11feb0);}return null;};}function patchUpdates(_0x3fbee2){return function(_0x451076){try{jsonpatch[_0x03ba('0x1f')](_0x451076,_0x3fbee2,!![]);}catch(_0x3a3280){return BPromise['reject'](_0x3a3280);}return _0x451076[_0x03ba('0x20')]();};}function saveUpdates(_0x4fe24b,_0x266bfc){return function(_0x59e80b){if(_0x59e80b){return _0x59e80b['update'](_0x4fe24b)[_0x03ba('0x21')](function(_0x177e1d){return _0x177e1d;});}return null;};}function removeEntity(_0x3532d4,_0x36fd0b){return function(_0x421cdb){if(_0x421cdb){return _0x421cdb['destroy']()['then'](function(){_0x3532d4[_0x03ba('0x18')](0xcc)[_0x03ba('0x22')]();});}};}function handleEntityNotFound(_0x5046c3,_0xb39d83){return function(_0xfba6a2){if(!_0xfba6a2){_0x5046c3['sendStatus'](0x194);}return _0xfba6a2;};}function handleError(_0x1511b9,_0x6aeeb9){_0x6aeeb9=_0x6aeeb9||0x1f4;return function(_0x4b13d8){logger[_0x03ba('0x23')](_0x4b13d8[_0x03ba('0x24')]);if(_0x4b13d8[_0x03ba('0x25')]){delete _0x4b13d8[_0x03ba('0x25')];}_0x1511b9[_0x03ba('0x18')](_0x6aeeb9)[_0x03ba('0x26')](_0x4b13d8);};}exports['index']=function(_0x5cbc85,_0x46636b){var _0x1d4654={},_0x22cdf3={},_0x1ac050={'count':0x0,'rows':[]};var _0x962aff=_['map'](db['Attachment'][_0x03ba('0x27')],function(_0x596399){return{'name':_0x596399['fieldName'],'type':_0x596399['type']['key']};});_0x22cdf3[_0x03ba('0x28')]=_[_0x03ba('0x29')](_0x962aff,_0x03ba('0x25'));_0x22cdf3['query']=_[_0x03ba('0x2a')](_0x5cbc85[_0x03ba('0x2b')]);_0x22cdf3[_0x03ba('0x2c')]=_[_0x03ba('0x2d')](_0x22cdf3['model'],_0x22cdf3[_0x03ba('0x2b')]);_0x1d4654[_0x03ba('0x2e')]=_[_0x03ba('0x2d')](_0x22cdf3[_0x03ba('0x28')],qs[_0x03ba('0x2f')](_0x5cbc85[_0x03ba('0x2b')]['fields']));_0x1d4654[_0x03ba('0x2e')]=_0x1d4654['attributes'][_0x03ba('0x30')]?_0x1d4654[_0x03ba('0x2e')]:_0x22cdf3[_0x03ba('0x28')];if(!_0x5cbc85['query'][_0x03ba('0x31')](_0x03ba('0x32'))){_0x1d4654[_0x03ba('0x1c')]=qs[_0x03ba('0x1c')](_0x5cbc85['query'][_0x03ba('0x1c')]);_0x1d4654[_0x03ba('0x1a')]=qs['offset'](_0x5cbc85['query'][_0x03ba('0x1a')]);}_0x1d4654[_0x03ba('0x33')]=qs[_0x03ba('0x34')](_0x5cbc85[_0x03ba('0x2b')]['sort']);_0x1d4654[_0x03ba('0x35')]=qs['filters'](_[_0x03ba('0x36')](_0x5cbc85[_0x03ba('0x2b')],_0x22cdf3[_0x03ba('0x2c')]),_0x962aff);if(_0x5cbc85['query']['filter']){_0x1d4654[_0x03ba('0x35')]=_[_0x03ba('0x37')](_0x1d4654[_0x03ba('0x35')],{'$or':_[_0x03ba('0x29')](_0x962aff,function(_0x3b36ad){if(_0x3b36ad['type']!=='VIRTUAL'){var _0x2a2fdd={};_0x2a2fdd[_0x3b36ad[_0x03ba('0x25')]]={'$like':'%'+_0x5cbc85[_0x03ba('0x2b')][_0x03ba('0x38')]+'%'};return _0x2a2fdd;}})});}_0x1d4654=_[_0x03ba('0x37')]({},_0x1d4654,_0x5cbc85['options']);var _0x2277f2={'where':_0x1d4654['where']};return db[_0x03ba('0x39')]['count'](_0x2277f2)[_0x03ba('0x21')](function(_0x484328){_0x1ac050[_0x03ba('0x1d')]=_0x484328;if(_0x5cbc85[_0x03ba('0x2b')][_0x03ba('0x3a')]){_0x1d4654[_0x03ba('0x3b')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x1d4654);})['then'](function(_0x21cda){_0x1ac050[_0x03ba('0x3c')]=_0x21cda;return _0x1ac050;})['then'](respondWithFilteredResult(_0x46636b,_0x1d4654))[_0x03ba('0x3d')](handleError(_0x46636b,null));};exports[_0x03ba('0x3e')]=function(_0x4fe7eb,_0x52eefe){var _0xbfffb={'raw':!![],'where':{'id':_0x4fe7eb['params']['id']}},_0x36cc6b={};_0x36cc6b[_0x03ba('0x28')]=_[_0x03ba('0x2a')](db[_0x03ba('0x39')][_0x03ba('0x27')]);_0x36cc6b[_0x03ba('0x2b')]=_[_0x03ba('0x2a')](_0x4fe7eb[_0x03ba('0x2b')]);_0x36cc6b[_0x03ba('0x2c')]=_[_0x03ba('0x2d')](_0x36cc6b[_0x03ba('0x28')],_0x36cc6b['query']);_0xbfffb[_0x03ba('0x2e')]=_['intersection'](_0x36cc6b[_0x03ba('0x28')],qs['fields'](_0x4fe7eb[_0x03ba('0x2b')][_0x03ba('0x2f')]));_0xbfffb[_0x03ba('0x2e')]=_0xbfffb[_0x03ba('0x2e')]['length']?_0xbfffb[_0x03ba('0x2e')]:_0x36cc6b[_0x03ba('0x28')];if(_0x4fe7eb[_0x03ba('0x2b')][_0x03ba('0x3a')]){_0xbfffb[_0x03ba('0x3b')]=[{'all':!![]}];}_0xbfffb=_['merge']({},_0xbfffb,_0x4fe7eb['options']);return db['Attachment'][_0x03ba('0x3f')](_0xbfffb)[_0x03ba('0x21')](handleEntityNotFound(_0x52eefe,null))[_0x03ba('0x21')](respondWithResult(_0x52eefe,null))[_0x03ba('0x3d')](handleError(_0x52eefe,null));};exports[_0x03ba('0x40')]=function(_0x1d252,_0x52e8a2){var _0x2b49f7={'where':{'id':_0x1d252[_0x03ba('0x41')]['id']}},_0x36ced6={};_0x36ced6['model']=_[_0x03ba('0x2a')](db[_0x03ba('0x39')][_0x03ba('0x27')]);_0x2b49f7[_0x03ba('0x2e')]=_['intersection'](_0x36ced6[_0x03ba('0x28')],qs[_0x03ba('0x2f')](_0x1d252[_0x03ba('0x2b')]['fields']));_0x2b49f7['attributes']=_0x2b49f7['attributes']['length']?_0x2b49f7[_0x03ba('0x2e')]:_0x36ced6['model'];if(_0x1d252['query'][_0x03ba('0x3a')]){_0x2b49f7[_0x03ba('0x3b')]=[{'all':!![]}];}_0x2b49f7=_[_0x03ba('0x37')]({},_0x2b49f7,_0x1d252[_0x03ba('0x42')]);return db[_0x03ba('0x39')][_0x03ba('0x3f')](_0x2b49f7)['then'](handleEntityNotFound(_0x52e8a2,null))[_0x03ba('0x21')](function(_0x43c7f3){if(_0x43c7f3){var _0x39a4d9=_0x43c7f3[_0x03ba('0x43')]({'plain':!![]});_0x39a4d9=qs[_0x03ba('0x44')](_0x39a4d9,['id',_0x03ba('0x45'),_0x03ba('0x46')]);_0x1d252[_0x03ba('0x47')]=_[_0x03ba('0x44')](_0x1d252[_0x03ba('0x47')],['id',_0x03ba('0x45'),_0x03ba('0x46')]);return db['Attachment'][_0x03ba('0x48')](_[_0x03ba('0x37')](_0x39a4d9,_0x1d252[_0x03ba('0x47')]),{'include':_0x1d252[_0x03ba('0x2b')][_0x03ba('0x3a')]?[{'all':!![]}]:undefined});}})[_0x03ba('0x21')](respondWithResult(_0x52e8a2,0xc9))['catch'](handleError(_0x52e8a2,null));};exports[_0x03ba('0x49')]=function(_0x2099ec,_0x4c043e){if(_0x2099ec[_0x03ba('0x47')]['id']){delete _0x2099ec['body']['id'];}return db['Attachment']['find']({'where':{'id':_0x2099ec[_0x03ba('0x41')]['id']}})[_0x03ba('0x21')](handleEntityNotFound(_0x4c043e,null))['then'](saveUpdates(_0x2099ec[_0x03ba('0x47')],null))[_0x03ba('0x21')](respondWithResult(_0x4c043e,null))[_0x03ba('0x3d')](handleError(_0x4c043e,null));};exports[_0x03ba('0x4a')]=function(_0x189adf,_0x38272b){return db[_0x03ba('0x39')][_0x03ba('0x3f')]({'where':{'id':_0x189adf[_0x03ba('0x41')]['id']}})[_0x03ba('0x21')](handleEntityNotFound(_0x38272b,null))['then'](removeEntity(_0x38272b,null))[_0x03ba('0x3d')](handleError(_0x38272b,null));};exports[_0x03ba('0x48')]=function(_0x226a17,_0x2a53b3,_0x446007){_0x226a17[_0x03ba('0x47')][_0x03ba('0x25')]=_0x226a17['file'][_0x03ba('0x4b')];_0x226a17[_0x03ba('0x47')][_0x03ba('0x4c')]=_0x226a17[_0x03ba('0x4d')][_0x03ba('0x4e')];_0x226a17[_0x03ba('0x47')][_0x03ba('0x4f')]=_0x226a17[_0x03ba('0x4d')]['mimetype'];return db[_0x03ba('0x39')][_0x03ba('0x48')](_0x226a17[_0x03ba('0x47')])['then'](respondWithResult(_0x2a53b3,0xc9))[_0x03ba('0x3d')](handleError(_0x2a53b3,null));};exports[_0x03ba('0x50')]=function(_0x3d06ea,_0x46b43c,_0x2c5f93){return db['Attachment'][_0x03ba('0x51')]({'where':{'id':_0x3d06ea[_0x03ba('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x46b43c,null))[_0x03ba('0x21')](function(_0x26ad9b){if(_0x26ad9b){var _0x4ccf38=_0x26ad9b['ChatOfflineMessageId']!==null;var _0x203b49=path[_0x03ba('0x52')](config[_0x03ba('0x53')],'server/files/attachments/');if(_0x4ccf38){_0x203b49=path['join'](_0x203b49,_0x03ba('0x54'));}var _0x10983f=path[_0x03ba('0x52')](_0x203b49,_0x26ad9b['basename']);return _0x46b43c[_0x03ba('0x50')](_0x10983f);}})[_0x03ba('0x3d')](handleError(_0x46b43c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b2002ff..fa0ca5c 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 _0xeaff=['../../config/environment','exports','define','Attachment','attachments','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x263a5c,_0x461a5e){var _0x19c4de=function(_0x13db9f){while(--_0x13db9f){_0x263a5c['push'](_0x263a5c['shift']());}};_0x19c4de(++_0x461a5e);}(_0xeaff,0x131));var _0xfeaf=function(_0x43a639,_0x20225c){_0x43a639=_0x43a639-0x0;var _0x51ec84=_0xeaff[_0x43a639];return _0x51ec84;};'use strict';var _=require(_0xfeaf('0x0'));var util=require(_0xfeaf('0x1'));var logger=require(_0xfeaf('0x2'))(_0xfeaf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfeaf('0x4'));var fs=require('fs');var path=require(_0xfeaf('0x5'));var rimraf=require(_0xfeaf('0x6'));var config=require(_0xfeaf('0x7'));var attributes=require('./attachment.attributes');module[_0xfeaf('0x8')]=function(_0x26ee7c,_0x4e0bce){return _0x26ee7c[_0xfeaf('0x9')](_0xfeaf('0xa'),attributes,{'tableName':_0xfeaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1b4=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xf1b4,0x173));var _0x4f1b=function(_0x1e520,_0x48d019){_0x1e520=_0x1e520-0x0;var _0x382f02=_0xf1b4[_0x1e520];return _0x382f02;};'use strict';var _=require(_0x4f1b('0x0'));var util=require(_0x4f1b('0x1'));var logger=require(_0x4f1b('0x2'))(_0x4f1b('0x3'));var moment=require(_0x4f1b('0x4'));var BPromise=require(_0x4f1b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4f1b('0x6'));var config=require(_0x4f1b('0x7'));var attributes=require(_0x4f1b('0x8'));module[_0x4f1b('0x9')]=function(_0x203810,_0x5bcc8c){return _0x203810[_0x4f1b('0xa')](_0x4f1b('0xb'),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 fdcc0b0..ec54190 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 _0xee39=['create','body','options','raw','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateAttachment','Attachment'];(function(_0x606961,_0x14eb5e){var _0x1b63ed=function(_0x44e380){while(--_0x44e380){_0x606961['push'](_0x606961['shift']());}};_0x1b63ed(++_0x14eb5e);}(_0xee39,0x1e6));var _0x9ee3=function(_0x5efbfc,_0x5c1e32){_0x5efbfc=_0x5efbfc-0x0;var _0x286883=_0xee39[_0x5efbfc];return _0x286883;};'use strict';var _=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var moment=require(_0x9ee3('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ee3('0x3'));var fs=require('fs');var Redis=require(_0x9ee3('0x4'));var db=require(_0x9ee3('0x5'))['db'];var utils=require(_0x9ee3('0x6'));var logger=require(_0x9ee3('0x7'))(_0x9ee3('0x8'));var config=require(_0x9ee3('0x9'));var jayson=require(_0x9ee3('0xa'));var client=jayson[_0x9ee3('0xb')][_0x9ee3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dc1eb,_0x10e9e6,_0x22264c){return new BPromise(function(_0x22c8fc,_0x4d1a57){return client[_0x9ee3('0xd')](_0x4dc1eb,_0x22264c)['then'](function(_0x1bde67){logger['info'](_0x9ee3('0xe'),_0x10e9e6,'request\x20sent');logger['debug'](_0x9ee3('0xf'),_0x10e9e6,'request\x20sent',JSON[_0x9ee3('0x10')](_0x1bde67));if(_0x1bde67['error']){if(_0x1bde67[_0x9ee3('0x11')][_0x9ee3('0x12')]===0x1f4){logger[_0x9ee3('0x11')](_0x9ee3('0xe'),_0x10e9e6,_0x1bde67[_0x9ee3('0x11')][_0x9ee3('0x13')]);return _0x4d1a57(_0x1bde67[_0x9ee3('0x11')]['message']);}logger[_0x9ee3('0x11')](_0x9ee3('0xe'),_0x10e9e6,_0x1bde67[_0x9ee3('0x11')]['message']);return _0x22c8fc(_0x1bde67[_0x9ee3('0x11')][_0x9ee3('0x13')]);}else{logger[_0x9ee3('0x14')](_0x9ee3('0xe'),_0x10e9e6,'request\x20sent');_0x22c8fc(_0x1bde67['result'][_0x9ee3('0x13')]);}})[_0x9ee3('0x15')](function(_0x456bf7){logger[_0x9ee3('0x11')](_0x9ee3('0xe'),_0x10e9e6,_0x456bf7);_0x4d1a57(_0x456bf7);});});}exports[_0x9ee3('0x16')]=function(_0x4a0de5){var _0x4a987a=this;return new Promise(function(_0x1f937f,_0x1342e2){return db[_0x9ee3('0x17')][_0x9ee3('0x18')](_0x4a0de5[_0x9ee3('0x19')],{'raw':_0x4a0de5[_0x9ee3('0x1a')]?_0x4a0de5[_0x9ee3('0x1a')][_0x9ee3('0x1b')]===undefined?!![]:![]:!![]})[_0x9ee3('0x1c')](function(_0x80671d){logger['info'](_0x9ee3('0x16'),_0x4a0de5);logger[_0x9ee3('0x1d')](_0x9ee3('0x16'),_0x4a0de5,JSON[_0x9ee3('0x10')](_0x80671d));_0x1f937f(_0x80671d);})[_0x9ee3('0x15')](function(_0x44bc5a){logger['error'](_0x9ee3('0x16'),_0x44bc5a[_0x9ee3('0x13')],_0x4a0de5);_0x1342e2(_0x4a987a[_0x9ee3('0x11')](0x1f4,_0x44bc5a[_0x9ee3('0x13')]));});});}; \ No newline at end of file +var _0x76dc=['code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','options','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x76dc,0x1f2));var _0xc76d=function(_0x5d1445,_0xed27f2){_0x5d1445=_0x5d1445-0x0;var _0xe6c508=_0x76dc[_0x5d1445];return _0xe6c508;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4832bd,_0x4ce0bd,_0x119f38){return new BPromise(function(_0x114572,_0x18574f){return client['request'](_0x4832bd,_0x119f38)['then'](function(_0x1dc996){logger[_0xc76d('0xa')]('Attachment,\x20%s,\x20%s',_0x4ce0bd,_0xc76d('0xb'));logger['debug'](_0xc76d('0xc'),_0x4ce0bd,_0xc76d('0xb'),JSON[_0xc76d('0xd')](_0x1dc996));if(_0x1dc996[_0xc76d('0xe')]){if(_0x1dc996[_0xc76d('0xe')][_0xc76d('0xf')]===0x1f4){logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);return _0x18574f(_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);}logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996['error'][_0xc76d('0x11')]);return _0x114572(_0x1dc996[_0xc76d('0xe')]['message']);}else{logger[_0xc76d('0xa')](_0xc76d('0x10'),_0x4ce0bd,_0xc76d('0xb'));_0x114572(_0x1dc996[_0xc76d('0x12')]['message']);}})[_0xc76d('0x13')](function(_0x5d881c){logger['error'](_0xc76d('0x10'),_0x4ce0bd,_0x5d881c);_0x18574f(_0x5d881c);});});}exports[_0xc76d('0x14')]=function(_0x339623){var _0x23f3ca=this;return new Promise(function(_0xd1d16f,_0x4b0402){return db[_0xc76d('0x15')][_0xc76d('0x16')](_0x339623[_0xc76d('0x17')],{'raw':_0x339623[_0xc76d('0x18')]?_0x339623[_0xc76d('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc76d('0x19')](function(_0x324db7){logger['info'](_0xc76d('0x14'),_0x339623);logger[_0xc76d('0x1a')](_0xc76d('0x14'),_0x339623,JSON[_0xc76d('0xd')](_0x324db7));_0xd1d16f(_0x324db7);})[_0xc76d('0x13')](function(_0x3d357b){logger[_0xc76d('0xe')](_0xc76d('0x14'),_0x3d357b[_0xc76d('0x11')],_0x339623);_0x4b0402(_0x23f3ca[_0xc76d('0xe')](0x1f4,_0x3d357b[_0xc76d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3d2c943..92af615 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x263965,_0x5e0cb8){var _0x41f0fe=function(_0x33acad){while(--_0x33acad){_0x263965['push'](_0x263965['shift']());}};_0x41f0fe(++_0x5e0cb8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c540d,_0x16c677){_0x1c540d=_0x1c540d-0x0;var _0x23ea63=_0x5f2f[_0x1c540d];return _0x23ea63;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x0b0e[_0x52684f];return _0x4a55f0;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 3330d35..81b9f4a 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 _0x93dd=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','add','minutes','getLicense','catch','status','message','login','ad-login','signToken','json','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','blockDuration','then','adSsoEnabled'];(function(_0x572ae6,_0x5590fd){var _0x43423a=function(_0x165b05){while(--_0x165b05){_0x572ae6['push'](_0x572ae6['shift']());}};_0x43423a(++_0x5590fd);}(_0x93dd,0x14f));var _0xd93d=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x93dd[_0x51020b];return _0x371e47;};'use strict';var passport=require(_0xd93d('0x0'));var LocalStrategy=require(_0xd93d('0x1'))[_0xd93d('0x2')];var moment=require(_0xd93d('0x3'));var ActiveDirectory=require(_0xd93d('0x4'));var BPromise=require(_0xd93d('0x5'));var util=require(_0xd93d('0x6'));var db=require(_0xd93d('0x7'))['db'];var authService=require(_0xd93d('0x8'));var utils=require(_0xd93d('0x9'));var config=require(_0xd93d('0xa'));var logger=require(_0xd93d('0xb'))(_0xd93d('0xc'));function isActiveDirectoryConfigured(_0x1380e8){var _0xa57b97=![];if(typeof _0x1380e8['activedirectory']!==_0xd93d('0xd')){_0xa57b97=_0x1380e8[_0xd93d('0xe')][_0xd93d('0xf')]&&_0x1380e8['activedirectory'][_0xd93d('0x10')]&&_0x1380e8[_0xd93d('0xe')][_0xd93d('0x11')];}return _0xa57b97;}function adAuthenticate(_0x5320a4,_0x2e325b,_0x3cbd42){return new BPromise(function(_0x1c4aa0,_0x4a4cbf){try{var _0x25216f=new ActiveDirectory(_0x5320a4);_0x25216f[_0xd93d('0x12')](_0x2e325b,_0x3cbd42,function(_0xebb4e,_0x1cac67){if(_0xebb4e){logger[_0xd93d('0x13')](_0xd93d('0x14'),_0x2e325b,util[_0xd93d('0x15')](_0xebb4e,{'showHidden':![],'depth':null}));_0x4a4cbf('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x1cac67){logger['error'](_0xd93d('0x16'),_0x2e325b);_0x4a4cbf(_0xd93d('0x17'));}else{_0x1c4aa0(_0x1cac67);}});}catch(_0x45da81){_0x4a4cbf(_0x45da81);}});}function ActiveDirectoryAuthenticate(_0x18d0a7,_0x54405f,_0x35d0ee,_0x307619){var _0x2f625a,_0x55a716;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x54405f);return _0x307619(null,![],{'message':_0xd93d('0x17')});}return db[_0xd93d('0x18')][_0xd93d('0x19')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xd93d('0x1a')],'raw':!![]})[_0xd93d('0x1b')](function(_0x5b7fbd){_0x2f625a=_0x5b7fbd;if(!_0x2f625a[_0xd93d('0x1c')]){logger[_0xd93d('0x13')](_0xd93d('0x1d'),_0x54405f);throw new Error(_0xd93d('0x17'));}return _0x18d0a7[_0xd93d('0x19')]({'logging':!![],'attributes':['id',_0xd93d('0x1e'),_0xd93d('0x1f'),_0xd93d('0x20'),_0xd93d('0x21'),_0xd93d('0x22'),_0xd93d('0x23'),_0xd93d('0x24'),_0xd93d('0x25')],'where':{'name':_0x54405f,'role':{'$or':[_0xd93d('0x26'),_0xd93d('0x27'),_0xd93d('0x28')]},'adSsoEnabled':!![]}});})[_0xd93d('0x1b')](function(_0x21465c){if(!_0x21465c||_0x21465c&&_0x21465c['name']!==_0x54405f){throw new Error(_0xd93d('0x17'));}_0x55a716=_0x21465c;var _0x3f2030=_0x55a716[_0xd93d('0x1e')]+'@'+config['activedirectory'][_0xd93d('0x11')];return adAuthenticate(config[_0xd93d('0xe')],_0x3f2030,_0x35d0ee);})['then'](function(_0x13d156){if(_0x55a716[_0xd93d('0x22')]){throw new Error(_0xd93d('0x17'));}if(_0x2f625a[_0xd93d('0x1a')]>0x0){if(_0x55a716[_0xd93d('0x23')]){if(moment(_0x55a716[_0xd93d('0x24')])[_0xd93d('0x29')](_0x2f625a['blockDuration'],_0xd93d('0x2a'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x55a716,0x0,![],null)['then'](function(){return utils[_0xd93d('0x2b')](_0x55a716);})[_0xd93d('0x1b')](function(){return _0x307619(null,_0x55a716);});}else{return utils[_0xd93d('0x2b')](_0x55a716)['then'](function(){return _0x307619(null,_0x55a716);});}}else{return utils[_0xd93d('0x2b')](_0x55a716)[_0xd93d('0x1b')](function(){return _0x307619(null,_0x55a716);});}})[_0xd93d('0x2c')](function(_0x2e5042){return _0x307619(null,![],_0x2e5042);});}function handleError(_0x2877cc,_0x3f3277,_0x25a0fd){return _0x2877cc[_0xd93d('0x2d')](_0x3f3277||0x1f4)['send']({'message':_0x25a0fd?_0x25a0fd[_0xd93d('0x2e')]||_0x25a0fd:''});}exports[_0xd93d('0x2f')]=function(_0x8ca457,_0x33eeea,_0x31cf8d){passport[_0xd93d('0x12')](_0xd93d('0x30'),function(_0x31ab26,_0x38884b,_0x42c3e7){var _0x59ee93=_0x31ab26||_0x42c3e7;if(_0x59ee93){return handleError(_0x33eeea,0x191,_0x59ee93);}if(!_0x38884b){return handleError(_0x33eeea,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1fda2a={'payload':{'id':_0x38884b['id'],'role':_0x38884b[_0xd93d('0x21')]},'options':{'expiresIn':0x15180}};return authService[_0xd93d('0x31')](_0x1fda2a)[_0xd93d('0x1b')](function(_0x33466c){_0x33eeea[_0xd93d('0x32')]({'id':_0x38884b['id'],'token':_0x33466c,'statusCall':'','isAlreadyLogged':_0x38884b[_0xd93d('0x25')]});});}})(_0x8ca457,_0x33eeea,_0x31cf8d);};passport['use'](_0xd93d('0x30'),new LocalStrategy({'usernameField':'name','passwordField':_0xd93d('0x1f')},function(_0x109a3f,_0xbc63f5,_0x29ef8b){return ActiveDirectoryAuthenticate(db[_0xd93d('0x33')],_0x109a3f,_0xbc63f5,_0x29ef8b);})); \ No newline at end of file +var _0x086d=['bluebird','util','../../mysqldb','../../components/auth/service','../../config/logger','api','activedirectory','undefined','domain','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','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','blockedAt','admin','user','agent','disabled','add','minutes','getLicense','status','send','message','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','User','passport','moment','activedirectory2'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x086d,0x81));var _0xd086=function(_0x52e590,_0x52d936){_0x52e590=_0x52e590-0x0;var _0x376559=_0x086d[_0x52e590];return _0x376559;};'use strict';var passport=require(_0xd086('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0xd086('0x1'));var ActiveDirectory=require(_0xd086('0x2'));var BPromise=require(_0xd086('0x3'));var util=require(_0xd086('0x4'));var db=require(_0xd086('0x5'))['db'];var authService=require(_0xd086('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0xd086('0x7'))(_0xd086('0x8'));function isActiveDirectoryConfigured(_0x45fefe){var _0x513cf5=![];if(typeof _0x45fefe[_0xd086('0x9')]!==_0xd086('0xa')){_0x513cf5=_0x45fefe[_0xd086('0x9')]['baseDN']&&_0x45fefe[_0xd086('0x9')]['url']&&_0x45fefe[_0xd086('0x9')][_0xd086('0xb')];}return _0x513cf5;}function adAuthenticate(_0x12d5ab,_0x4fd624,_0x35f7fd){return new BPromise(function(_0x125b96,_0x22a7da){try{var _0x36573e=new ActiveDirectory(_0x12d5ab);_0x36573e['authenticate'](_0x4fd624,_0x35f7fd,function(_0xf01b5e,_0x151292){if(_0xf01b5e){logger[_0xd086('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x4fd624,util['inspect'](_0xf01b5e,{'showHidden':![],'depth':null}));_0x22a7da(_0xd086('0xd'));}else if(!_0x151292){logger[_0xd086('0xc')](_0xd086('0xe'),_0x4fd624);_0x22a7da(_0xd086('0xd'));}else{_0x125b96(_0x151292);}});}catch(_0x227f15){_0x22a7da(_0x227f15);}});}function ActiveDirectoryAuthenticate(_0x55449a,_0x46b66d,_0x1a1116,_0x585d18){var _0x2ace02,_0xb63b46;if(!isActiveDirectoryConfigured(config)){logger[_0xd086('0xc')](_0xd086('0xf'),_0x46b66d);return _0x585d18(null,![],{'message':_0xd086('0xd')});}return db[_0xd086('0x10')][_0xd086('0x11')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xd086('0x12')],'raw':!![]})[_0xd086('0x13')](function(_0x52f0a4){_0x2ace02=_0x52f0a4;if(!_0x2ace02[_0xd086('0x14')]){logger['error'](_0xd086('0x15'),_0x46b66d);throw new Error(_0xd086('0xd'));}return _0x55449a[_0xd086('0x11')]({'logging':!![],'attributes':['id',_0xd086('0x16'),_0xd086('0x17'),_0xd086('0x18'),_0xd086('0x19'),'disabled',_0xd086('0x1a'),_0xd086('0x1b'),'online'],'where':{'name':_0x46b66d,'role':{'$or':[_0xd086('0x1c'),_0xd086('0x1d'),_0xd086('0x1e')]},'adSsoEnabled':!![]}});})[_0xd086('0x13')](function(_0x46c56d){if(!_0x46c56d||_0x46c56d&&_0x46c56d[_0xd086('0x16')]!==_0x46b66d){throw new Error(_0xd086('0xd'));}_0xb63b46=_0x46c56d;var _0x190cd1=_0xb63b46['name']+'@'+config['activedirectory'][_0xd086('0xb')];return adAuthenticate(config[_0xd086('0x9')],_0x190cd1,_0x1a1116);})[_0xd086('0x13')](function(_0x43159b){if(_0xb63b46[_0xd086('0x1f')]){throw new Error(_0xd086('0xd'));}if(_0x2ace02[_0xd086('0x12')]>0x0){if(_0xb63b46[_0xd086('0x1a')]){if(moment(_0xb63b46['blockedAt'])[_0xd086('0x20')](_0x2ace02[_0xd086('0x12')],_0xd086('0x21'))>moment()){throw new Error(_0xd086('0xd'));}return utils['clearBlockUser'](_0xb63b46,0x0,![],null)[_0xd086('0x13')](function(){return utils[_0xd086('0x22')](_0xb63b46);})['then'](function(){return _0x585d18(null,_0xb63b46);});}else{return utils[_0xd086('0x22')](_0xb63b46)[_0xd086('0x13')](function(){return _0x585d18(null,_0xb63b46);});}}else{return utils[_0xd086('0x22')](_0xb63b46)[_0xd086('0x13')](function(){return _0x585d18(null,_0xb63b46);});}})['catch'](function(_0x1a412a){return _0x585d18(null,![],_0x1a412a);});}function handleError(_0x3e9063,_0x462ad6,_0x12dd9f){return _0x3e9063[_0xd086('0x23')](_0x462ad6||0x1f4)[_0xd086('0x24')]({'message':_0x12dd9f?_0x12dd9f[_0xd086('0x25')]||_0x12dd9f:''});}exports['login']=function(_0x1f7430,_0x45662e,_0x504d3e){passport[_0xd086('0x26')](_0xd086('0x27'),function(_0x2a0717,_0x5be14e,_0x24bedd){var _0xd35f31=_0x2a0717||_0x24bedd;if(_0xd35f31){return handleError(_0x45662e,0x191,_0xd35f31);}if(!_0x5be14e){return handleError(_0x45662e,0x194,{'message':_0xd086('0x28')});}else{var _0x294ed4={'payload':{'id':_0x5be14e['id'],'role':_0x5be14e[_0xd086('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x294ed4)[_0xd086('0x13')](function(_0x56c3a5){_0x45662e[_0xd086('0x29')]({'id':_0x5be14e['id'],'token':_0x56c3a5,'statusCall':'','isAlreadyLogged':_0x5be14e[_0xd086('0x2a')]});});}})(_0x1f7430,_0x45662e,_0x504d3e);};passport['use'](_0xd086('0x27'),new LocalStrategy({'usernameField':_0xd086('0x16'),'passwordField':_0xd086('0x17')},function(_0x5eb285,_0x4cd870,_0x193a0e){return ActiveDirectoryAuthenticate(db[_0xd086('0x2b')],_0x5eb285,_0x4cd870,_0x193a0e);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index be056c1..2b88dca 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 _0xb4e1=['login','express','Router','./authActiveDirectory.controller','post'];(function(_0x2b9242,_0x43ae35){var _0x3a833a=function(_0x254242){while(--_0x254242){_0x2b9242['push'](_0x2b9242['shift']());}};_0x3a833a(++_0x43ae35);}(_0xb4e1,0x1d2));var _0x1b4e=function(_0x5c77b9,_0x21ce72){_0x5c77b9=_0x5c77b9-0x0;var _0x350ca6=_0xb4e1[_0x5c77b9];return _0x350ca6;};'use strict';var express=require(_0x1b4e('0x0'));var router=express[_0x1b4e('0x1')]();var controller=require(_0x1b4e('0x2'));router[_0x1b4e('0x3')]('/',controller[_0x1b4e('0x4')]);module['exports']=router; \ No newline at end of file +var _0xcc62=['express','exports'];(function(_0x5a6e32,_0x573b46){var _0x168e07=function(_0x427e62){while(--_0x427e62){_0x5a6e32['push'](_0x5a6e32['shift']());}};_0x168e07(++_0x573b46);}(_0xcc62,0x172));var _0x2cc6=function(_0x1b224e,_0x3d63bf){_0x1b224e=_0x1b224e-0x0;var _0x9a6667=_0xcc62[_0x1b224e];return _0x9a6667;};'use strict';var express=require(_0x2cc6('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller['login']);module[_0x2cc6('0x1')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 417fd7d..9b7f9ff 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(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x7a54,0x106));var _0x47a5=function(_0x1f56fc,_0x376bee){_0x1f56fc=_0x1f56fc-0x0;var _0x58ae7c=_0x7a54[_0x1f56fc];return _0x58ae7c;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x7a54,0x106));var _0x47a5=function(_0x3a3ec9,_0x5a5b4f){_0x3a3ec9=_0x3a3ec9-0x0;var _0x289755=_0x7a54[_0x3a3ec9];return _0x289755;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 13cfba1..90be8c0 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 _0x204d=['express','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','isMiddleware'];(function(_0x3471b7,_0x3aaa34){var _0xe4b843=function(_0x14e455){while(--_0x14e455){_0x3471b7['push'](_0x3471b7['shift']());}};_0xe4b843(++_0x3aaa34);}(_0x204d,0x150));var _0xd204=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x204d[_0xe8129c];return _0x709fc5;};'use strict';var express=require(_0xd204('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0xd204('0x1'));var userController=require(_0xd204('0x2'));var authService=require(_0xd204('0x3'));router['get']('/',controller[_0xd204('0x4')]);router[_0xd204('0x5')]('/callback',controller['callback'],authService[_0xd204('0x6')],userController[_0xd204('0x4')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xde5f=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x12093a,_0x4f85e3){var _0x21940c=function(_0xba825a){while(--_0xba825a){_0x12093a['push'](_0x12093a['shift']());}};_0x21940c(++_0x4f85e3);}(_0xde5f,0x97));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xfde5('0x0'));var passport=require(_0xfde5('0x1'));var router=express[_0xfde5('0x2')]();var controller=require(_0xfde5('0x3'));var userController=require(_0xfde5('0x4'));var authService=require(_0xfde5('0x5'));router[_0xfde5('0x6')]('/',controller[_0xfde5('0x7')]);router[_0xfde5('0x6')](_0xfde5('0x8'),controller[_0xfde5('0x9')],authService[_0xfde5('0xa')],userController[_0xfde5('0x7')],authService[_0xfde5('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 89d6237..bb41e99 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 _0x0504=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','token','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','Password\x20reset!','use','User','passport','passport-local','Strategy','lodash','randomstring','moment','../../config/utils','client','http','allowedLoginAttempts','then','findOne','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','minutes','clearBlockUser','add','getLicense','catch','blocked','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','message','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset'];(function(_0x175ee9,_0x2de806){var _0x475b96=function(_0x98c9ec){while(--_0x98c9ec){_0x175ee9['push'](_0x175ee9['shift']());}};_0x475b96(++_0x2de806);}(_0x0504,0x1c3));var _0x4050=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x0504[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require('util');var passport=require(_0x4050('0x0'));var LocalStrategy=require(_0x4050('0x1'))[_0x4050('0x2')];var jayson=require('jayson/promise');var _=require(_0x4050('0x3'));var rs=require(_0x4050('0x4'));var moment=require(_0x4050('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x4050('0x6'));var client=jayson[_0x4050('0x7')][_0x4050('0x8')]({'port':0x232b});function localAuthenticate(_0x4b86c4,_0x307538,_0x321748,_0x1d7eb0){var _0x4276cc,_0x21b34d;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x4050('0x9'),'blockDuration'],'raw':!![]})[_0x4050('0xa')](function(_0x55f2fa){_0x4276cc=_0x55f2fa;return _0x4b86c4[_0x4050('0xb')]({'attributes':['id',_0x4050('0xc'),_0x4050('0xd'),_0x4050('0xe'),_0x4050('0xf'),_0x4050('0x10'),'blocked',_0x4050('0x11'),_0x4050('0x12')],'where':{'name':_0x307538,'role':{'$or':[_0x4050('0x13'),'user',_0x4050('0x14')]}}});})[_0x4050('0xa')](function(_0x57be0e){if(!_0x57be0e||_0x57be0e&&_0x57be0e['name']!==_0x307538){throw new Error(_0x4050('0x15'));}else{_0x21b34d=_0x57be0e;return _0x21b34d;}})[_0x4050('0xa')](function(){_0x21b34d[_0x4050('0x16')](_0x321748,function(_0x49cbdb,_0x4f632a){var _0x56c435=_0x21b34d[_0x4050('0x12')]+0x1;if(_0x49cbdb){return _0x1d7eb0(_0x49cbdb);}else if(!_0x4f632a){if(_0x21b34d[_0x4050('0x10')]){return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});}else if(_0x4276cc[_0x4050('0x9')]>0x0){if(_0x21b34d['blocked']){if(_0x4276cc[_0x4050('0x17')]>0x0){if(moment(_0x21b34d[_0x4050('0x11')])['add'](_0x4276cc[_0x4050('0x17')],_0x4050('0x18'))>moment()){return _0x1d7eb0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4050('0x19')](_0x21b34d,_0x56c435,![],null)[_0x4050('0xa')](function(){return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});});}}else{return _0x1d7eb0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x56c435>=_0x4276cc['allowedLoginAttempts']){return utils[_0x4050('0x19')](_0x21b34d,0x0,!![],moment())[_0x4050('0xa')](function(){return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});});}else{return utils['clearBlockUser'](_0x21b34d,_0x56c435,![],null)[_0x4050('0xa')](function(){return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});});}}}else{return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});}}else{if(_0x21b34d['disabled']){return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});}else if(_0x4276cc['allowedLoginAttempts']>0x0){if(_0x21b34d['blocked']){if(_0x4276cc[_0x4050('0x17')]>0x0){if(moment(_0x21b34d['blockedAt'])[_0x4050('0x1a')](_0x4276cc[_0x4050('0x17')],_0x4050('0x18'))>moment()){return _0x1d7eb0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x4050('0x19')](_0x21b34d,0x0,![],null)['then'](function(){return utils[_0x4050('0x1b')](_0x21b34d);})['then'](function(){return _0x1d7eb0(null,_0x21b34d);});}}else{return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});}}else{return utils[_0x4050('0x19')](_0x21b34d,0x0,![],null)[_0x4050('0xa')](function(){return utils[_0x4050('0x1b')](_0x21b34d);})['then'](function(){return _0x1d7eb0(null,_0x21b34d);})[_0x4050('0x1c')](function(_0xa592d9){return _0x1d7eb0(null,![],_0xa592d9);});}}else{if(_0x21b34d[_0x4050('0x1d')]){return _0x1d7eb0(null,![],{'message':_0x4050('0x15')});}else{return utils[_0x4050('0x1b')](_0x21b34d)[_0x4050('0xa')](function(){return _0x1d7eb0(null,_0x21b34d);});}}}});})[_0x4050('0x1c')](function(_0x34e6af){return _0x1d7eb0(null,![],_0x34e6af);});}function sendServiceMail(_0xb6fe4){return db[_0x4050('0x1e')][_0x4050('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x4050('0x20')],'include':[{'model':db[_0x4050('0x21')],'as':_0x4050('0x22')}]})[_0x4050('0xa')](function(_0x1783ad){if(!_0x1783ad){throw new Error(_0x4050('0x23'));}var _0x5f4142={'tls':{'rejectUnauthorized':![]}};if(_0x1783ad['Smtp'][_0x4050('0x24')]){_0x5f4142[_0x4050('0x24')]=_0x1783ad[_0x4050('0x22')]['service'];}else{_0x5f4142[_0x4050('0x25')]=_0x1783ad[_0x4050('0x22')][_0x4050('0x25')];_0x5f4142['port']=_0x1783ad[_0x4050('0x22')][_0x4050('0x26')];_0x5f4142[_0x4050('0x27')]=_0x1783ad['Smtp'][_0x4050('0x27')];}if(_0x1783ad[_0x4050('0x22')][_0x4050('0x28')]){_0x5f4142[_0x4050('0x29')]={'user':_0x1783ad[_0x4050('0x22')][_0x4050('0x2a')],'pass':_0x1783ad['Smtp']['pass']};}var _0x1f3860={'account':_0x5f4142,'message':_[_0x4050('0x2b')]({'from':util['format'](_0x4050('0x2c'),_0x1783ad[_0x4050('0xc')],_0x1783ad[_0x4050('0x20')]||_0x1783ad[_0x4050('0x22')][_0x4050('0x2a')])},_0xb6fe4)};return client[_0x4050('0x2d')](_0x4050('0x2e'),_0x1f3860);})[_0x4050('0xa')](function(_0x1fb041){if(_0x1fb041[_0x4050('0x2f')]){throw new Error(util[_0x4050('0x30')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1fb041[_0x4050('0x2f')][_0x4050('0x31')]||JSON['stringify'](_0x1fb041['error'])));}return!![];});}function handleError(_0x5673b1,_0x5577da,_0x14acf3){return _0x5673b1['status'](_0x5577da||0x1f4)[_0x4050('0x32')]({'message':_0x14acf3?_0x14acf3[_0x4050('0x31')]||_0x14acf3:''});}exports[_0x4050('0x33')]=function(_0x45c739,_0x46b415,_0x24e37a){passport['authenticate'](_0x4050('0x34'),function(_0x2ac8fd,_0x182351,_0x26a480){var _0x43155a=_0x2ac8fd||_0x26a480;if(_0x43155a){return handleError(_0x46b415,0x191,_0x43155a);}if(!_0x182351){return handleError(_0x46b415,0x194,{'message':_0x4050('0x35')});}else{var _0x1ed4ed={'payload':{'id':_0x182351['id'],'role':_0x182351[_0x4050('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x4050('0x36')](_0x1ed4ed)[_0x4050('0xa')](function(_0x1e9a0c){_0x46b415[_0x4050('0x37')]({'id':_0x182351['id'],'token':_0x1e9a0c,'statusCall':'','isAlreadyLogged':_0x182351[_0x4050('0x38')]});});}})(_0x45c739,_0x46b415,_0x24e37a);};exports[_0x4050('0x39')]=function(_0x48b16,_0x2bfc6b,_0x929dea){if(!_0x48b16[_0x4050('0x3a')][_0x4050('0x20')]){return handleError(_0x2bfc6b,0x1f4,{'message':_0x4050('0x3b')});}var _0x12624f=rs[_0x4050('0x3c')]();_0x48b16['body'][_0x4050('0x20')]=_0x48b16[_0x4050('0x3a')][_0x4050('0x20')][_0x4050('0x3d')]()[_0x4050('0x3e')]();var _0x514fe8;return db[_0x4050('0x3f')][_0x4050('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x4050('0x17')],'raw':!![]})[_0x4050('0xa')](function(_0x41f3b4){_0x514fe8=_0x41f3b4;return db['User']['find']({'where':{'email':_0x48b16['body'][_0x4050('0x20')]}});})[_0x4050('0xa')](function(_0x1d256e){if(!_0x1d256e){throw new Error(_0x4050('0x40'));}if(_0x1d256e['disabled']){throw new Error(_0x4050('0x41'));}if(_0x1d256e[_0x4050('0x1d')]){if(moment(_0x1d256e[_0x4050('0x11')])[_0x4050('0x1a')](_0x514fe8[_0x4050('0x17')],_0x4050('0x18'))>moment()){throw new Error(_0x4050('0x42'));}else{_0x1d256e[_0x4050('0x1d')]=![];_0x1d256e[_0x4050('0x11')]=null;}}_0x1d256e[_0x4050('0x43')]=_0x12624f;_0x1d256e[_0x4050('0x44')]=Date[_0x4050('0x45')]()+0x36ee80;return _0x1d256e['save']();})['then'](function(){return sendServiceMail({'to':_0x48b16['body']['email'],'subject':_0x4050('0x46'),'text':_0x4050('0x47')+_0x4050('0x48')+_0x4050('0x49')+_0x48b16['headers'][_0x4050('0x25')]+_0x4050('0x4a')+_0x12624f+'\x0a\x0a'+_0x4050('0x4b')});})[_0x4050('0xa')](function(){_0x2bfc6b[_0x4050('0x4c')](0xc8)[_0x4050('0x32')]({'message':_0x4050('0x4d')});})['catch'](function(_0x3a7c0a){return handleError(_0x2bfc6b,0x1f4,_0x3a7c0a);});};exports['reset']=function(_0x2b4996,_0x58bf2e,_0x1b49a9){return db['User'][_0x4050('0x1f')]({'where':{'resetPasswordToken':_0x2b4996['params'][_0x4050('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x4050('0x45')]()}}})[_0x4050('0xa')](function(_0x3fcfc3){if(!_0x3fcfc3){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x4050('0x3f')]['findOne']({'attributes':['id',_0x4050('0x4f'),'enforcePasswordHistory',_0x4050('0x50')]})[_0x4050('0xa')](function(_0x3e229f){if(_0x3e229f[_0x4050('0x4f')])authService[_0x4050('0x51')](_0x2b4996[_0x4050('0x3a')][_0x4050('0xd')]);if(!_0x3e229f[_0x4050('0x52')]||!_0x3fcfc3[_0x4050('0x53')])return _0x3fcfc3;authService['validatePasswordHistory'](_0x2b4996[_0x4050('0x3a')][_0x4050('0xd')],_0x3fcfc3[_0x4050('0x53')],_0x3e229f[_0x4050('0x50')]);return _0x3fcfc3;})[_0x4050('0xa')](function(){_0x3fcfc3['password']=_0x2b4996[_0x4050('0x3a')][_0x4050('0xd')];_0x3fcfc3[_0x4050('0x43')]=null;_0x3fcfc3[_0x4050('0x44')]=null;return _0x3fcfc3['save']();});})['then'](function(){_0x58bf2e[_0x4050('0x4c')](0xc8)[_0x4050('0x32')]({'message':_0x4050('0x54')});})['catch'](function(_0x5c7693){return handleError(_0x58bf2e,0x1f4,_0x5c7693);});};passport[_0x4050('0x55')](_0x4050('0x34'),new LocalStrategy({'usernameField':_0x4050('0xc'),'passwordField':_0x4050('0xd')},function(_0x25ab86,_0x33cdfa,_0x2bca79){return localAuthenticate(db[_0x4050('0x56')],_0x25ab86,_0x33cdfa,_0x2bca79);})); \ No newline at end of file +var _0x253f=['agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','Email\x20parameter\x20is\x20missing','body','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordExpires','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','client','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user'];(function(_0x1d3758,_0x6d8928){var _0x161087=function(_0x46f67f){while(--_0x46f67f){_0x1d3758['push'](_0x1d3758['shift']());}};_0x161087(++_0x6d8928);}(_0x253f,0x1ee));var _0xf253=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x253f[_0x16d10f];return _0x50c823;};'use strict';var util=require(_0xf253('0x0'));var passport=require(_0xf253('0x1'));var LocalStrategy=require(_0xf253('0x2'))['Strategy'];var jayson=require(_0xf253('0x3'));var _=require(_0xf253('0x4'));var rs=require(_0xf253('0x5'));var moment=require('moment');var db=require(_0xf253('0x6'))['db'];var authService=require(_0xf253('0x7'));var utils=require('../../config/utils');var client=jayson[_0xf253('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x59e72c,_0x487cef,_0x161fab,_0x5200ce){var _0x4f6753,_0x3effc5;return db['Setting'][_0xf253('0x9')]({'where':{'id':0x1},'attributes':[_0xf253('0xa'),_0xf253('0xb')],'raw':!![]})[_0xf253('0xc')](function(_0x5dcef1){_0x4f6753=_0x5dcef1;return _0x59e72c[_0xf253('0x9')]({'attributes':['id',_0xf253('0xd'),_0xf253('0xe'),_0xf253('0xf'),'role',_0xf253('0x10'),_0xf253('0x11'),_0xf253('0x12'),_0xf253('0x13')],'where':{'name':_0x487cef,'role':{'$or':[_0xf253('0x14'),_0xf253('0x15'),_0xf253('0x16')]}}});})[_0xf253('0xc')](function(_0x191021){if(!_0x191021||_0x191021&&_0x191021[_0xf253('0xd')]!==_0x487cef){throw new Error(_0xf253('0x17'));}else{_0x3effc5=_0x191021;return _0x3effc5;}})['then'](function(){_0x3effc5[_0xf253('0x18')](_0x161fab,function(_0x3a06bc,_0x50421a){var _0x50522e=_0x3effc5['loginAttempts']+0x1;if(_0x3a06bc){return _0x5200ce(_0x3a06bc);}else if(!_0x50421a){if(_0x3effc5[_0xf253('0x10')]){return _0x5200ce(null,![],{'message':_0xf253('0x17')});}else if(_0x4f6753['allowedLoginAttempts']>0x0){if(_0x3effc5[_0xf253('0x11')]){if(_0x4f6753[_0xf253('0xb')]>0x0){if(moment(_0x3effc5['blockedAt'])[_0xf253('0x19')](_0x4f6753['blockDuration'],_0xf253('0x1a'))>moment()){return _0x5200ce(null,![],{'message':_0xf253('0x17')});}else{return utils[_0xf253('0x1b')](_0x3effc5,_0x50522e,![],null)[_0xf253('0xc')](function(){return _0x5200ce(null,![],{'message':_0xf253('0x17')});});}}else{return _0x5200ce(null,![],{'message':_0xf253('0x17')});}}else{if(_0x50522e>=_0x4f6753['allowedLoginAttempts']){return utils[_0xf253('0x1b')](_0x3effc5,0x0,!![],moment())[_0xf253('0xc')](function(){return _0x5200ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xf253('0x1b')](_0x3effc5,_0x50522e,![],null)[_0xf253('0xc')](function(){return _0x5200ce(null,![],{'message':_0xf253('0x17')});});}}}else{return _0x5200ce(null,![],{'message':_0xf253('0x17')});}}else{if(_0x3effc5[_0xf253('0x10')]){return _0x5200ce(null,![],{'message':_0xf253('0x17')});}else if(_0x4f6753[_0xf253('0xa')]>0x0){if(_0x3effc5[_0xf253('0x11')]){if(_0x4f6753[_0xf253('0xb')]>0x0){if(moment(_0x3effc5['blockedAt'])['add'](_0x4f6753['blockDuration'],_0xf253('0x1a'))>moment()){return _0x5200ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf253('0x1b')](_0x3effc5,0x0,![],null)[_0xf253('0xc')](function(){return utils['getLicense'](_0x3effc5);})[_0xf253('0xc')](function(){return _0x5200ce(null,_0x3effc5);});}}else{return _0x5200ce(null,![],{'message':_0xf253('0x17')});}}else{return utils[_0xf253('0x1b')](_0x3effc5,0x0,![],null)[_0xf253('0xc')](function(){return utils['getLicense'](_0x3effc5);})['then'](function(){return _0x5200ce(null,_0x3effc5);})[_0xf253('0x1c')](function(_0x33f905){return _0x5200ce(null,![],_0x33f905);});}}else{if(_0x3effc5[_0xf253('0x11')]){return _0x5200ce(null,![],{'message':_0xf253('0x17')});}else{return utils['getLicense'](_0x3effc5)[_0xf253('0xc')](function(){return _0x5200ce(null,_0x3effc5);});}}}});})[_0xf253('0x1c')](function(_0x23f684){return _0x5200ce(null,![],_0x23f684);});}function sendServiceMail(_0x56074a){return db[_0xf253('0x1d')][_0xf253('0x1e')]({'where':{'service':!![]},'attributes':['id',_0xf253('0xd'),_0xf253('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0xf253('0x20')}]})['then'](function(_0x2db280){if(!_0x2db280){throw new Error(_0xf253('0x21'));}var _0x3f1adc={'tls':{'rejectUnauthorized':![]}};if(_0x2db280[_0xf253('0x20')][_0xf253('0x22')]){_0x3f1adc[_0xf253('0x22')]=_0x2db280[_0xf253('0x20')]['service'];}else{_0x3f1adc['host']=_0x2db280['Smtp'][_0xf253('0x23')];_0x3f1adc[_0xf253('0x24')]=_0x2db280[_0xf253('0x20')][_0xf253('0x24')];_0x3f1adc[_0xf253('0x25')]=_0x2db280['Smtp']['secure'];}if(_0x2db280[_0xf253('0x20')][_0xf253('0x26')]){_0x3f1adc['auth']={'user':_0x2db280[_0xf253('0x20')][_0xf253('0x15')],'pass':_0x2db280['Smtp']['pass']};}var _0x1b0642={'account':_0x3f1adc,'message':_[_0xf253('0x27')]({'from':util[_0xf253('0x28')](_0xf253('0x29'),_0x2db280[_0xf253('0xd')],_0x2db280[_0xf253('0x1f')]||_0x2db280[_0xf253('0x20')][_0xf253('0x15')])},_0x56074a)};return client[_0xf253('0x2a')](_0xf253('0x2b'),_0x1b0642);})['then'](function(_0x4489c8){if(_0x4489c8[_0xf253('0x2c')]){throw new Error(util['format'](_0xf253('0x2d'),_0x4489c8[_0xf253('0x2c')][_0xf253('0x2e')]||JSON[_0xf253('0x2f')](_0x4489c8['error'])));}return!![];});}function handleError(_0x4b875d,_0x3873c8,_0x9f41da){return _0x4b875d['status'](_0x3873c8||0x1f4)[_0xf253('0x30')]({'message':_0x9f41da?_0x9f41da[_0xf253('0x2e')]||_0x9f41da:''});}exports[_0xf253('0x31')]=function(_0x443052,_0x2b66be,_0x128883){passport[_0xf253('0x18')](_0xf253('0x32'),function(_0x869bef,_0x24dd54,_0xe878c0){var _0x2cc65d=_0x869bef||_0xe878c0;if(_0x2cc65d){return handleError(_0x2b66be,0x191,_0x2cc65d);}if(!_0x24dd54){return handleError(_0x2b66be,0x194,{'message':_0xf253('0x33')});}else{var _0x58f4da={'payload':{'id':_0x24dd54['id'],'role':_0x24dd54['role']},'options':{'expiresIn':0x15180}};return authService[_0xf253('0x34')](_0x58f4da)[_0xf253('0xc')](function(_0x43e378){_0x2b66be[_0xf253('0x35')]({'id':_0x24dd54['id'],'token':_0x43e378,'statusCall':'','isAlreadyLogged':_0x24dd54[_0xf253('0x36')]});});}})(_0x443052,_0x2b66be,_0x128883);};exports['forgot']=function(_0x1249de,_0x10b68d,_0x25a27f){if(!_0x1249de['body'][_0xf253('0x1f')]){return handleError(_0x10b68d,0x1f4,{'message':_0xf253('0x37')});}var _0xa81d69=rs['generate']();_0x1249de[_0xf253('0x38')][_0xf253('0x1f')]=_0x1249de[_0xf253('0x38')][_0xf253('0x1f')][_0xf253('0x39')]()[_0xf253('0x3a')]();var _0xd7169d;return db[_0xf253('0x3b')][_0xf253('0x9')]({'where':{'id':0x1},'attributes':[_0xf253('0xa'),_0xf253('0xb')],'raw':!![]})[_0xf253('0xc')](function(_0x2e06b4){_0xd7169d=_0x2e06b4;return db[_0xf253('0x3c')][_0xf253('0x1e')]({'where':{'email':_0x1249de[_0xf253('0x38')][_0xf253('0x1f')]}});})[_0xf253('0xc')](function(_0x1e9ce3){if(!_0x1e9ce3){throw new Error(_0xf253('0x3d'));}if(_0x1e9ce3[_0xf253('0x10')]){throw new Error(_0xf253('0x3e'));}if(_0x1e9ce3['blocked']){if(moment(_0x1e9ce3[_0xf253('0x12')])[_0xf253('0x19')](_0xd7169d[_0xf253('0xb')],_0xf253('0x1a'))>moment()){throw new Error(_0xf253('0x3f'));}else{_0x1e9ce3[_0xf253('0x11')]=![];_0x1e9ce3[_0xf253('0x12')]=null;}}_0x1e9ce3[_0xf253('0x40')]=_0xa81d69;_0x1e9ce3['resetPasswordExpires']=Date[_0xf253('0x41')]()+0x36ee80;return _0x1e9ce3['save']();})[_0xf253('0xc')](function(){return sendServiceMail({'to':_0x1249de[_0xf253('0x38')]['email'],'subject':_0xf253('0x42'),'text':_0xf253('0x43')+_0xf253('0x44')+'https://'+_0x1249de[_0xf253('0x45')][_0xf253('0x23')]+_0xf253('0x46')+_0xa81d69+'\x0a\x0a'+_0xf253('0x47')});})[_0xf253('0xc')](function(){_0x10b68d[_0xf253('0x48')](0xc8)[_0xf253('0x30')]({'message':_0xf253('0x49')});})[_0xf253('0x1c')](function(_0x28f431){return handleError(_0x10b68d,0x1f4,_0x28f431);});};exports['reset']=function(_0x3086fd,_0x5d9c92,_0x218c63){return db['User'][_0xf253('0x1e')]({'where':{'resetPasswordToken':_0x3086fd[_0xf253('0x4a')][_0xf253('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xf253('0xc')](function(_0x11c0bf){if(!_0x11c0bf){throw new Error(_0xf253('0x4c'));}return db[_0xf253('0x3b')][_0xf253('0x9')]({'attributes':['id',_0xf253('0x4d'),_0xf253('0x4e'),'passwordHistoryLimit']})[_0xf253('0xc')](function(_0x4ef208){if(_0x4ef208[_0xf253('0x4d')])authService['validatePasswordPattern'](_0x3086fd['body']['password']);if(!_0x4ef208['enforcePasswordHistory']||!_0x11c0bf[_0xf253('0x4f')])return _0x11c0bf;authService[_0xf253('0x50')](_0x3086fd[_0xf253('0x38')]['password'],_0x11c0bf['previousPasswords'],_0x4ef208[_0xf253('0x51')]);return _0x11c0bf;})['then'](function(){_0x11c0bf['password']=_0x3086fd[_0xf253('0x38')]['password'];_0x11c0bf[_0xf253('0x40')]=null;_0x11c0bf[_0xf253('0x52')]=null;return _0x11c0bf[_0xf253('0x53')]();});})[_0xf253('0xc')](function(){_0x5d9c92['status'](0xc8)[_0xf253('0x30')]({'message':_0xf253('0x54')});})[_0xf253('0x1c')](function(_0x1bf3b1){return handleError(_0x5d9c92,0x1f4,_0x1bf3b1);});};passport[_0xf253('0x55')](_0xf253('0x32'),new LocalStrategy({'usernameField':_0xf253('0xd'),'passwordField':_0xf253('0xe')},function(_0xbaa29e,_0x3fec08,_0x59cc38){return localAuthenticate(db[_0xf253('0x3c')],_0xbaa29e,_0x3fec08,_0x59cc38);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ca963a0..14c4a10 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 _0x1f01=['./authLocal.controller','post','login','/forgot','reset','exports','Router'];(function(_0xaaea0a,_0x45bc95){var _0x5c3546=function(_0x580f5c){while(--_0x580f5c){_0xaaea0a['push'](_0xaaea0a['shift']());}};_0x5c3546(++_0x45bc95);}(_0x1f01,0xa0));var _0x11f0=function(_0x5ab238,_0x4ddda9){_0x5ab238=_0x5ab238-0x0;var _0x236db6=_0x1f01[_0x5ab238];return _0x236db6;};'use strict';var express=require('express');var router=express[_0x11f0('0x0')]();var controller=require(_0x11f0('0x1'));router[_0x11f0('0x2')]('/',controller[_0x11f0('0x3')]);router[_0x11f0('0x2')](_0x11f0('0x4'),controller['forgot']);router[_0x11f0('0x2')]('/reset/:token',controller[_0x11f0('0x5')]);module[_0x11f0('0x6')]=router; \ No newline at end of file +var _0x24a4=['exports','express','Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset'];(function(_0xa547ca,_0x514951){var _0xd5e1c1=function(_0x400751){while(--_0x400751){_0xa547ca['push'](_0xa547ca['shift']());}};_0xd5e1c1(++_0x514951);}(_0x24a4,0x157));var _0x424a=function(_0x2d63e7,_0x3dda73){_0x2d63e7=_0x2d63e7-0x0;var _0x5e8406=_0x24a4[_0x2d63e7];return _0x5e8406;};'use strict';var express=require(_0x424a('0x0'));var router=express[_0x424a('0x1')]();var controller=require(_0x424a('0x2'));router[_0x424a('0x3')]('/',controller[_0x424a('0x4')]);router[_0x424a('0x3')](_0x424a('0x5'),controller['forgot']);router['post'](_0x424a('0x6'),controller[_0x424a('0x7')]);module[_0x424a('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ff523d6..2d96316 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 _0x2b83=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x183c00,_0x5327b8){var _0x4a8361=function(_0x126739){while(--_0x126739){_0x183c00['push'](_0x183c00['shift']());}};_0x4a8361(++_0x5327b8);}(_0x2b83,0xe0));var _0x32b8=function(_0x1602de,_0x294c96){_0x1602de=_0x1602de-0x0;var _0x6e66c8=_0x2b83[_0x1602de];return _0x6e66c8;};'use strict';var Sequelize=require(_0x32b8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x32b8('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x32b8('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x32b8('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x93c0=['STRING','sequelize','exports'];(function(_0x5ac92d,_0x14061b){var _0x1abd6e=function(_0x241e4e){while(--_0x241e4e){_0x5ac92d['push'](_0x5ac92d['shift']());}};_0x1abd6e(++_0x14061b);}(_0x93c0,0xe5));var _0x093c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x93c0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x093c('0x0'));module[_0x093c('0x1')]={'name':{'type':Sequelize[_0x093c('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x093c('0x2')]},'description':{'type':Sequelize[_0x093c('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 1e10dbd..faa3ee0 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 _0xb63a=['../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','end','stack','name','send','index','map','Automation','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','findAll','catch','show','params','rawAttributes','keys','length','include','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','hasOwnProperty','nolimit','addActions','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x114f39,_0x329501){var _0x2df275=function(_0x502383){while(--_0x502383){_0x114f39['push'](_0x114f39['shift']());}};_0x2df275(++_0x329501);}(_0xb63a,0x139));var _0xab63=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0xb63a[_0x193ddf];return _0x5bc6df;};'use strict';var emlformat=require(_0xab63('0x0'));var rimraf=require(_0xab63('0x1'));var zipdir=require(_0xab63('0x2'));var jsonpatch=require(_0xab63('0x3'));var rp=require(_0xab63('0x4'));var moment=require('moment');var BPromise=require(_0xab63('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab63('0x6'));var sox=require(_0xab63('0x7'));var csv=require(_0xab63('0x8'));var ejs=require(_0xab63('0x9'));var fs=require('fs');var fs_extra=require(_0xab63('0xa'));var _=require(_0xab63('0xb'));var squel=require(_0xab63('0xc'));var crypto=require(_0xab63('0xd'));var jsforce=require(_0xab63('0xe'));var deskjs=require(_0xab63('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab63('0x10'));var authService=require(_0xab63('0x11'));var qs=require(_0xab63('0x12'));var as=require(_0xab63('0x13'));var hardwareService=require(_0xab63('0x14'));var logger=require('../../config/logger')(_0xab63('0x15'));var utils=require(_0xab63('0x16'));var config=require(_0xab63('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x625e34,_0x34881c){_0x34881c=_0x34881c||0xcc;return function(_0x467e7b){if(_0x467e7b){return _0x625e34[_0xab63('0x18')](_0x34881c);}return _0x625e34[_0xab63('0x19')](_0x34881c)['end']();};}function respondWithResult(_0x2422e6,_0x146339){_0x146339=_0x146339||0xc8;return function(_0x384064){if(_0x384064){return _0x2422e6[_0xab63('0x19')](_0x146339)[_0xab63('0x1a')](_0x384064);}};}function respondWithFilteredResult(_0x48247f,_0x5a9fdc){return function(_0x18766d){if(_0x18766d){var _0x6453ed=typeof _0x5a9fdc[_0xab63('0x1b')]==='undefined'&&typeof _0x5a9fdc[_0xab63('0x1c')]===_0xab63('0x1d');var _0x39af0f=_0x18766d[_0xab63('0x1e')];var _0x2b2cde=_0x6453ed?0x0:_0x5a9fdc['offset'];var _0x13ed72=_0x6453ed?_0x18766d[_0xab63('0x1e')]:_0x5a9fdc['offset']+_0x5a9fdc[_0xab63('0x1c')];var _0x3d7120;if(_0x13ed72>=_0x39af0f){_0x13ed72=_0x39af0f;_0x3d7120=0xc8;}else{_0x3d7120=0xce;}_0x48247f['status'](_0x3d7120);return _0x48247f[_0xab63('0x1f')]('Content-Range',_0x2b2cde+'-'+_0x13ed72+'/'+_0x39af0f)[_0xab63('0x1a')](_0x18766d);}return null;};}function patchUpdates(_0x20e260){return function(_0x17ed42){try{jsonpatch[_0xab63('0x20')](_0x17ed42,_0x20e260,!![]);}catch(_0x38a588){return BPromise[_0xab63('0x21')](_0x38a588);}return _0x17ed42['save']();};}function saveUpdates(_0x4b85a2,_0x5c0edf){return function(_0x1de266){if(_0x1de266){return _0x1de266[_0xab63('0x22')](_0x4b85a2)[_0xab63('0x23')](function(_0x3d4d25){return _0x3d4d25;});}return null;};}function removeEntity(_0x56a1f2,_0x178579){return function(_0x32de43){if(_0x32de43){return _0x32de43[_0xab63('0x24')]()['then'](function(){_0x56a1f2['status'](0xcc)[_0xab63('0x25')]();});}};}function handleEntityNotFound(_0x3c690c,_0x5dda7a){return function(_0x23c819){if(!_0x23c819){_0x3c690c[_0xab63('0x18')](0x194);}return _0x23c819;};}function handleError(_0x42243d,_0x1287c0){_0x1287c0=_0x1287c0||0x1f4;return function(_0x427e26){logger['error'](_0x427e26[_0xab63('0x26')]);if(_0x427e26[_0xab63('0x27')]){delete _0x427e26[_0xab63('0x27')];}_0x42243d['status'](_0x1287c0)[_0xab63('0x28')](_0x427e26);};}exports[_0xab63('0x29')]=function(_0x228c63,_0x2dca30){var _0x10f607={},_0x42238d={},_0x5043ec={'count':0x0,'rows':[]};var _0x1f01be=_[_0xab63('0x2a')](db[_0xab63('0x2b')]['rawAttributes'],function(_0x42b897){return{'name':_0x42b897[_0xab63('0x2c')],'type':_0x42b897[_0xab63('0x2d')][_0xab63('0x2e')]};});_0x42238d[_0xab63('0x2f')]=_['map'](_0x1f01be,'name');_0x42238d[_0xab63('0x30')]=_['keys'](_0x228c63[_0xab63('0x30')]);_0x42238d[_0xab63('0x31')]=_[_0xab63('0x32')](_0x42238d['model'],_0x42238d[_0xab63('0x30')]);_0x10f607[_0xab63('0x33')]=_[_0xab63('0x32')](_0x42238d[_0xab63('0x2f')],qs[_0xab63('0x34')](_0x228c63[_0xab63('0x30')]['fields']));_0x10f607[_0xab63('0x33')]=_0x10f607[_0xab63('0x33')]['length']?_0x10f607[_0xab63('0x33')]:_0x42238d[_0xab63('0x2f')];if(!_0x228c63['query']['hasOwnProperty']('nolimit')){_0x10f607[_0xab63('0x1c')]=qs['limit'](_0x228c63[_0xab63('0x30')]['limit']);_0x10f607[_0xab63('0x1b')]=qs[_0xab63('0x1b')](_0x228c63[_0xab63('0x30')]['offset']);}_0x10f607[_0xab63('0x35')]=qs[_0xab63('0x36')](_0x228c63[_0xab63('0x30')][_0xab63('0x36')]);_0x10f607['where']=qs['filters'](_[_0xab63('0x37')](_0x228c63['query'],_0x42238d['filters']),_0x1f01be);if(_0x228c63[_0xab63('0x30')]['filter']){_0x10f607['where']=_[_0xab63('0x38')](_0x10f607['where'],{'$or':_[_0xab63('0x2a')](_0x1f01be,function(_0x2df0a5){if(_0x2df0a5[_0xab63('0x2d')]!==_0xab63('0x39')){var _0x1f2f17={};_0x1f2f17[_0x2df0a5[_0xab63('0x27')]]={'$like':'%'+_0x228c63['query'][_0xab63('0x3a')]+'%'};return _0x1f2f17;}})});}_0x10f607=_[_0xab63('0x38')]({},_0x10f607,_0x228c63[_0xab63('0x3b')]);var _0x4eedca={'where':_0x10f607[_0xab63('0x3c')]};return db['Automation']['count'](_0x4eedca)['then'](function(_0x379845){_0x5043ec[_0xab63('0x1e')]=_0x379845;if(_0x228c63[_0xab63('0x30')][_0xab63('0x3d')]){_0x10f607['include']=[{'all':!![]}];}return db['Automation'][_0xab63('0x3e')](_0x10f607);})[_0xab63('0x23')](function(_0x47385c){_0x5043ec['rows']=_0x47385c;return _0x5043ec;})[_0xab63('0x23')](respondWithFilteredResult(_0x2dca30,_0x10f607))[_0xab63('0x3f')](handleError(_0x2dca30,null));};exports[_0xab63('0x40')]=function(_0x4eb694,_0x1e498f){var _0x5bda10={'raw':![],'where':{'id':_0x4eb694[_0xab63('0x41')]['id']}},_0x4c9c9b={};_0x4c9c9b[_0xab63('0x2f')]=_['keys'](db[_0xab63('0x2b')][_0xab63('0x42')]);_0x4c9c9b[_0xab63('0x30')]=_[_0xab63('0x43')](_0x4eb694[_0xab63('0x30')]);_0x4c9c9b['filters']=_[_0xab63('0x32')](_0x4c9c9b['model'],_0x4c9c9b[_0xab63('0x30')]);_0x5bda10[_0xab63('0x33')]=_[_0xab63('0x32')](_0x4c9c9b[_0xab63('0x2f')],qs[_0xab63('0x34')](_0x4eb694[_0xab63('0x30')][_0xab63('0x34')]));_0x5bda10[_0xab63('0x33')]=_0x5bda10[_0xab63('0x33')][_0xab63('0x44')]?_0x5bda10['attributes']:_0x4c9c9b[_0xab63('0x2f')];if(_0x4eb694[_0xab63('0x30')]['includeAll']){_0x5bda10[_0xab63('0x45')]=[{'all':!![]}];}_0x5bda10=_[_0xab63('0x38')]({},_0x5bda10,_0x4eb694['options']);return db[_0xab63('0x2b')][_0xab63('0x46')](_0x5bda10)['then'](handleEntityNotFound(_0x1e498f,null))[_0xab63('0x23')](respondWithResult(_0x1e498f,null))[_0xab63('0x3f')](handleError(_0x1e498f,null));};exports[_0xab63('0x47')]=function(_0x547812,_0x2aa996){return db[_0xab63('0x2b')][_0xab63('0x47')](_0x547812[_0xab63('0x48')],{})[_0xab63('0x23')](respondWithResult(_0x2aa996,0xc9))[_0xab63('0x3f')](handleError(_0x2aa996,null));};exports[_0xab63('0x22')]=function(_0x1dee17,_0x1a1e6b){if(_0x1dee17['body']['id']){delete _0x1dee17['body']['id'];}return db[_0xab63('0x2b')][_0xab63('0x46')]({'where':{'id':_0x1dee17[_0xab63('0x41')]['id']}})[_0xab63('0x23')](handleEntityNotFound(_0x1a1e6b,null))[_0xab63('0x23')](saveUpdates(_0x1dee17[_0xab63('0x48')],null))[_0xab63('0x23')](respondWithResult(_0x1a1e6b,null))['catch'](handleError(_0x1a1e6b,null));};exports['destroy']=function(_0x2a8744,_0x49ce2a){return db['Automation'][_0xab63('0x46')]({'where':{'id':_0x2a8744[_0xab63('0x41')]['id']}})[_0xab63('0x23')](handleEntityNotFound(_0x49ce2a,null))[_0xab63('0x23')](removeEntity(_0x49ce2a,null))[_0xab63('0x3f')](handleError(_0x49ce2a,null));};exports[_0xab63('0x49')]=function(_0x3df9b6,_0x281912,_0x385eba){return db[_0xab63('0x4a')][_0xab63('0x46')]({'where':{'id':_0x3df9b6[_0xab63('0x41')]['id']}})[_0xab63('0x23')](handleEntityNotFound(_0x281912,null))['then'](function(_0x2ff7e3){if(_0x2ff7e3){return _0x2ff7e3[_0xab63('0x49')](_0x3df9b6['body'][_0xab63('0x4b')],_[_0xab63('0x4c')](_0x3df9b6[_0xab63('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x281912,null))[_0xab63('0x3f')](handleError(_0x281912,null));};exports['getConditions']=function(_0x4b540c,_0x4b42b6,_0x2a7171){var _0x296525={};var _0x280a2a={};var _0x430db8;var _0x1a2b7a;return db['Automation'][_0xab63('0x4d')]({'where':{'id':_0x4b540c[_0xab63('0x41')]['id']}})[_0xab63('0x23')](handleEntityNotFound(_0x4b42b6,null))[_0xab63('0x23')](function(_0x4187b3){if(_0x4187b3){_0x430db8=_0x4187b3;_0x280a2a[_0xab63('0x2f')]=_[_0xab63('0x43')](db[_0xab63('0x4a')][_0xab63('0x42')]);_0x280a2a[_0xab63('0x30')]=_[_0xab63('0x43')](_0x4b540c[_0xab63('0x30')]);_0x280a2a['filters']=_[_0xab63('0x32')](_0x280a2a[_0xab63('0x2f')],_0x280a2a[_0xab63('0x30')]);_0x296525[_0xab63('0x33')]=_[_0xab63('0x32')](_0x280a2a[_0xab63('0x2f')],qs[_0xab63('0x34')](_0x4b540c[_0xab63('0x30')][_0xab63('0x34')]));_0x296525[_0xab63('0x33')]=_0x296525[_0xab63('0x33')][_0xab63('0x44')]?_0x296525[_0xab63('0x33')]:_0x280a2a[_0xab63('0x2f')];_0x296525[_0xab63('0x35')]=qs[_0xab63('0x36')](_0x4b540c[_0xab63('0x30')]['sort']);_0x296525[_0xab63('0x3c')]=qs['filters'](_[_0xab63('0x37')](_0x4b540c[_0xab63('0x30')],_0x280a2a[_0xab63('0x31')]));if(_0x4b540c[_0xab63('0x30')][_0xab63('0x3a')]){_0x296525['where']=_['merge'](_0x296525[_0xab63('0x3c')],{'$or':_[_0xab63('0x2a')](_0x296525[_0xab63('0x33')],function(_0x8d5be6){var _0x9085cc={};_0x9085cc[_0x8d5be6]={'$like':'%'+_0x4b540c[_0xab63('0x30')][_0xab63('0x3a')]+'%'};return _0x9085cc;})});}_0x296525=_[_0xab63('0x38')]({},_0x296525,_0x4b540c[_0xab63('0x3b')]);return _0x430db8[_0xab63('0x4e')](_0x296525);}})[_0xab63('0x23')](function(_0x402d2a){if(_0x402d2a){_0x1a2b7a=_0x402d2a[_0xab63('0x44')];if(!_0x4b540c[_0xab63('0x30')][_0xab63('0x4f')](_0xab63('0x50'))){_0x296525[_0xab63('0x1c')]=qs[_0xab63('0x1c')](_0x4b540c[_0xab63('0x30')]['limit']);_0x296525[_0xab63('0x1b')]=qs[_0xab63('0x1b')](_0x4b540c[_0xab63('0x30')]['offset']);}return _0x430db8[_0xab63('0x4e')](_0x296525);}})[_0xab63('0x23')](function(_0x4db8ec){if(_0x4db8ec){return _0x4db8ec?{'count':_0x1a2b7a,'rows':_0x4db8ec}:null;}})[_0xab63('0x23')](respondWithResult(_0x4b42b6,null))[_0xab63('0x3f')](handleError(_0x4b42b6,null));};exports[_0xab63('0x51')]=function(_0x3df5b7,_0x4bf4fc,_0x48f3c7){return db['Action']['find']({'where':{'id':_0x3df5b7[_0xab63('0x41')]['id']}})[_0xab63('0x23')](handleEntityNotFound(_0x4bf4fc,null))[_0xab63('0x23')](function(_0x3a5858){if(_0x3a5858){return _0x3a5858[_0xab63('0x51')](_0x3df5b7[_0xab63('0x48')][_0xab63('0x4b')],_['omit'](_0x3df5b7[_0xab63('0x48')],[_0xab63('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x4bf4fc,null))[_0xab63('0x3f')](handleError(_0x4bf4fc,null));};exports[_0xab63('0x52')]=function(_0x3143b2,_0x479493,_0x5ad6d4){var _0x122f04={};var _0x5c3c6e={};var _0x41278a;var _0x2a856e;return db[_0xab63('0x2b')][_0xab63('0x4d')]({'where':{'id':_0x3143b2['params']['id']}})[_0xab63('0x23')](handleEntityNotFound(_0x479493,null))[_0xab63('0x23')](function(_0x1966a9){if(_0x1966a9){_0x41278a=_0x1966a9;_0x5c3c6e['model']=_[_0xab63('0x43')](db[_0xab63('0x53')][_0xab63('0x42')]);_0x5c3c6e[_0xab63('0x30')]=_[_0xab63('0x43')](_0x3143b2[_0xab63('0x30')]);_0x5c3c6e[_0xab63('0x31')]=_['intersection'](_0x5c3c6e[_0xab63('0x2f')],_0x5c3c6e[_0xab63('0x30')]);_0x122f04['attributes']=_[_0xab63('0x32')](_0x5c3c6e['model'],qs[_0xab63('0x34')](_0x3143b2[_0xab63('0x30')][_0xab63('0x34')]));_0x122f04[_0xab63('0x33')]=_0x122f04['attributes']['length']?_0x122f04[_0xab63('0x33')]:_0x5c3c6e[_0xab63('0x2f')];_0x122f04[_0xab63('0x35')]=qs['sort'](_0x3143b2['query'][_0xab63('0x36')]);_0x122f04[_0xab63('0x3c')]=qs[_0xab63('0x31')](_[_0xab63('0x37')](_0x3143b2[_0xab63('0x30')],_0x5c3c6e['filters']));if(_0x3143b2[_0xab63('0x30')]['filter']){_0x122f04['where']=_[_0xab63('0x38')](_0x122f04[_0xab63('0x3c')],{'$or':_[_0xab63('0x2a')](_0x122f04['attributes'],function(_0x51a496){var _0x5f0335={};_0x5f0335[_0x51a496]={'$like':'%'+_0x3143b2['query'][_0xab63('0x3a')]+'%'};return _0x5f0335;})});}_0x122f04=_[_0xab63('0x38')]({},_0x122f04,_0x3143b2[_0xab63('0x3b')]);return _0x41278a[_0xab63('0x52')](_0x122f04);}})['then'](function(_0x5ae21f){if(_0x5ae21f){_0x2a856e=_0x5ae21f[_0xab63('0x44')];if(!_0x3143b2[_0xab63('0x30')][_0xab63('0x4f')](_0xab63('0x50'))){_0x122f04[_0xab63('0x1c')]=qs[_0xab63('0x1c')](_0x3143b2[_0xab63('0x30')]['limit']);_0x122f04['offset']=qs['offset'](_0x3143b2['query'][_0xab63('0x1b')]);}return _0x41278a[_0xab63('0x52')](_0x122f04);}})['then'](function(_0x54731c){if(_0x54731c){return _0x54731c?{'count':_0x2a856e,'rows':_0x54731c}:null;}})['then'](respondWithResult(_0x479493,null))[_0xab63('0x3f')](handleError(_0x479493,null));}; \ No newline at end of file +var _0xed2f=['mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','length','create','body','find','addConditions','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','zip-dir','request-promise','moment','bluebird'];(function(_0x43ebd4,_0x3b3630){var _0x218876=function(_0xcd1b78){while(--_0xcd1b78){_0x43ebd4['push'](_0x43ebd4['shift']());}};_0x218876(++_0x3b3630);}(_0xed2f,0x144));var _0xfed2=function(_0x2d0eb9,_0x3c2bd7){_0x2d0eb9=_0x2d0eb9-0x0;var _0x3b362f=_0xed2f[_0x2d0eb9];return _0x3b362f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfed2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfed2('0x1'));var moment=require(_0xfed2('0x2'));var BPromise=require(_0xfed2('0x3'));var Mustache=require(_0xfed2('0x4'));var util=require(_0xfed2('0x5'));var path=require('path');var sox=require(_0xfed2('0x6'));var csv=require(_0xfed2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfed2('0x8'));var _=require('lodash');var squel=require(_0xfed2('0x9'));var crypto=require(_0xfed2('0xa'));var jsforce=require(_0xfed2('0xb'));var deskjs=require(_0xfed2('0xc'));var toCsv=require(_0xfed2('0x7'));var querystring=require(_0xfed2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfed2('0xe'));var qs=require(_0xfed2('0xf'));var as=require(_0xfed2('0x10'));var hardwareService=require(_0xfed2('0x11'));var logger=require(_0xfed2('0x12'))(_0xfed2('0x13'));var utils=require(_0xfed2('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfed2('0x15'))['db'];function respondWithStatusCode(_0x1f1fe2,_0x152e6e){_0x152e6e=_0x152e6e||0xcc;return function(_0x273da0){if(_0x273da0){return _0x1f1fe2[_0xfed2('0x16')](_0x152e6e);}return _0x1f1fe2[_0xfed2('0x17')](_0x152e6e)['end']();};}function respondWithResult(_0x214836,_0x5a1d08){_0x5a1d08=_0x5a1d08||0xc8;return function(_0x4fd9b3){if(_0x4fd9b3){return _0x214836[_0xfed2('0x17')](_0x5a1d08)[_0xfed2('0x18')](_0x4fd9b3);}};}function respondWithFilteredResult(_0x45ab4a,_0x2a849d){return function(_0x4bfa61){if(_0x4bfa61){var _0x5cfbcc=typeof _0x2a849d[_0xfed2('0x19')]===_0xfed2('0x1a')&&typeof _0x2a849d['limit']==='undefined';var _0x2e3df5=_0x4bfa61['count'];var _0x26c0b8=_0x5cfbcc?0x0:_0x2a849d[_0xfed2('0x19')];var _0x175475=_0x5cfbcc?_0x4bfa61['count']:_0x2a849d[_0xfed2('0x19')]+_0x2a849d[_0xfed2('0x1b')];var _0x2ce5d4;if(_0x175475>=_0x2e3df5){_0x175475=_0x2e3df5;_0x2ce5d4=0xc8;}else{_0x2ce5d4=0xce;}_0x45ab4a[_0xfed2('0x17')](_0x2ce5d4);return _0x45ab4a[_0xfed2('0x1c')](_0xfed2('0x1d'),_0x26c0b8+'-'+_0x175475+'/'+_0x2e3df5)['json'](_0x4bfa61);}return null;};}function patchUpdates(_0x10c298){return function(_0x43fb9f){try{jsonpatch['apply'](_0x43fb9f,_0x10c298,!![]);}catch(_0x3599ec){return BPromise[_0xfed2('0x1e')](_0x3599ec);}return _0x43fb9f[_0xfed2('0x1f')]();};}function saveUpdates(_0x5dbcf8,_0x2572b5){return function(_0x5c6fae){if(_0x5c6fae){return _0x5c6fae[_0xfed2('0x20')](_0x5dbcf8)[_0xfed2('0x21')](function(_0x3a7ee7){return _0x3a7ee7;});}return null;};}function removeEntity(_0x4a13ce,_0x5ccb72){return function(_0x326a9c){if(_0x326a9c){return _0x326a9c['destroy']()[_0xfed2('0x21')](function(){_0x4a13ce[_0xfed2('0x17')](0xcc)[_0xfed2('0x22')]();});}};}function handleEntityNotFound(_0x46cd71,_0x4050cc){return function(_0x375600){if(!_0x375600){_0x46cd71['sendStatus'](0x194);}return _0x375600;};}function handleError(_0x4b08d0,_0x4aa93a){_0x4aa93a=_0x4aa93a||0x1f4;return function(_0x3b2085){logger[_0xfed2('0x23')](_0x3b2085[_0xfed2('0x24')]);if(_0x3b2085['name']){delete _0x3b2085[_0xfed2('0x25')];}_0x4b08d0[_0xfed2('0x17')](_0x4aa93a)[_0xfed2('0x26')](_0x3b2085);};}exports[_0xfed2('0x27')]=function(_0x1958e2,_0x34c990){var _0x1a85bf={},_0x202c7d={},_0x4e1745={'count':0x0,'rows':[]};var _0x5c0d9a=_[_0xfed2('0x28')](db[_0xfed2('0x29')][_0xfed2('0x2a')],function(_0x23150b){return{'name':_0x23150b[_0xfed2('0x2b')],'type':_0x23150b[_0xfed2('0x2c')][_0xfed2('0x2d')]};});_0x202c7d['model']=_[_0xfed2('0x28')](_0x5c0d9a,'name');_0x202c7d[_0xfed2('0x2e')]=_[_0xfed2('0x2f')](_0x1958e2[_0xfed2('0x2e')]);_0x202c7d['filters']=_[_0xfed2('0x30')](_0x202c7d[_0xfed2('0x31')],_0x202c7d[_0xfed2('0x2e')]);_0x1a85bf[_0xfed2('0x32')]=_[_0xfed2('0x30')](_0x202c7d['model'],qs[_0xfed2('0x33')](_0x1958e2[_0xfed2('0x2e')]['fields']));_0x1a85bf['attributes']=_0x1a85bf[_0xfed2('0x32')]['length']?_0x1a85bf[_0xfed2('0x32')]:_0x202c7d[_0xfed2('0x31')];if(!_0x1958e2[_0xfed2('0x2e')]['hasOwnProperty'](_0xfed2('0x34'))){_0x1a85bf[_0xfed2('0x1b')]=qs[_0xfed2('0x1b')](_0x1958e2[_0xfed2('0x2e')][_0xfed2('0x1b')]);_0x1a85bf[_0xfed2('0x19')]=qs[_0xfed2('0x19')](_0x1958e2[_0xfed2('0x2e')][_0xfed2('0x19')]);}_0x1a85bf[_0xfed2('0x35')]=qs[_0xfed2('0x36')](_0x1958e2[_0xfed2('0x2e')][_0xfed2('0x36')]);_0x1a85bf[_0xfed2('0x37')]=qs[_0xfed2('0x38')](_[_0xfed2('0x39')](_0x1958e2[_0xfed2('0x2e')],_0x202c7d[_0xfed2('0x38')]),_0x5c0d9a);if(_0x1958e2[_0xfed2('0x2e')][_0xfed2('0x3a')]){_0x1a85bf[_0xfed2('0x37')]=_[_0xfed2('0x3b')](_0x1a85bf[_0xfed2('0x37')],{'$or':_[_0xfed2('0x28')](_0x5c0d9a,function(_0x377ce7){if(_0x377ce7[_0xfed2('0x2c')]!==_0xfed2('0x3c')){var _0x2afe4c={};_0x2afe4c[_0x377ce7[_0xfed2('0x25')]]={'$like':'%'+_0x1958e2[_0xfed2('0x2e')][_0xfed2('0x3a')]+'%'};return _0x2afe4c;}})});}_0x1a85bf=_[_0xfed2('0x3b')]({},_0x1a85bf,_0x1958e2[_0xfed2('0x3d')]);var _0x439e3f={'where':_0x1a85bf[_0xfed2('0x37')]};return db[_0xfed2('0x29')][_0xfed2('0x3e')](_0x439e3f)[_0xfed2('0x21')](function(_0x4acc43){_0x4e1745[_0xfed2('0x3e')]=_0x4acc43;if(_0x1958e2[_0xfed2('0x2e')][_0xfed2('0x3f')]){_0x1a85bf[_0xfed2('0x40')]=[{'all':!![]}];}return db[_0xfed2('0x29')]['findAll'](_0x1a85bf);})[_0xfed2('0x21')](function(_0x10a672){_0x4e1745['rows']=_0x10a672;return _0x4e1745;})[_0xfed2('0x21')](respondWithFilteredResult(_0x34c990,_0x1a85bf))[_0xfed2('0x41')](handleError(_0x34c990,null));};exports[_0xfed2('0x42')]=function(_0x38f696,_0xbc3ec0){var _0x139c57={'raw':![],'where':{'id':_0x38f696[_0xfed2('0x43')]['id']}},_0xdfd24d={};_0xdfd24d[_0xfed2('0x31')]=_[_0xfed2('0x2f')](db[_0xfed2('0x29')][_0xfed2('0x2a')]);_0xdfd24d['query']=_[_0xfed2('0x2f')](_0x38f696[_0xfed2('0x2e')]);_0xdfd24d[_0xfed2('0x38')]=_['intersection'](_0xdfd24d['model'],_0xdfd24d[_0xfed2('0x2e')]);_0x139c57[_0xfed2('0x32')]=_['intersection'](_0xdfd24d[_0xfed2('0x31')],qs[_0xfed2('0x33')](_0x38f696[_0xfed2('0x2e')][_0xfed2('0x33')]));_0x139c57[_0xfed2('0x32')]=_0x139c57[_0xfed2('0x32')][_0xfed2('0x44')]?_0x139c57['attributes']:_0xdfd24d[_0xfed2('0x31')];if(_0x38f696[_0xfed2('0x2e')][_0xfed2('0x3f')]){_0x139c57[_0xfed2('0x40')]=[{'all':!![]}];}_0x139c57=_['merge']({},_0x139c57,_0x38f696['options']);return db['Automation']['find'](_0x139c57)[_0xfed2('0x21')](handleEntityNotFound(_0xbc3ec0,null))[_0xfed2('0x21')](respondWithResult(_0xbc3ec0,null))[_0xfed2('0x41')](handleError(_0xbc3ec0,null));};exports[_0xfed2('0x45')]=function(_0x58c632,_0x4eb3e4){return db[_0xfed2('0x29')][_0xfed2('0x45')](_0x58c632['body'],{})[_0xfed2('0x21')](respondWithResult(_0x4eb3e4,0xc9))[_0xfed2('0x41')](handleError(_0x4eb3e4,null));};exports[_0xfed2('0x20')]=function(_0x18703f,_0x5ba565){if(_0x18703f[_0xfed2('0x46')]['id']){delete _0x18703f[_0xfed2('0x46')]['id'];}return db['Automation'][_0xfed2('0x47')]({'where':{'id':_0x18703f[_0xfed2('0x43')]['id']}})[_0xfed2('0x21')](handleEntityNotFound(_0x5ba565,null))['then'](saveUpdates(_0x18703f['body'],null))[_0xfed2('0x21')](respondWithResult(_0x5ba565,null))[_0xfed2('0x41')](handleError(_0x5ba565,null));};exports['destroy']=function(_0xa9bc5,_0xdd165){return db[_0xfed2('0x29')][_0xfed2('0x47')]({'where':{'id':_0xa9bc5[_0xfed2('0x43')]['id']}})[_0xfed2('0x21')](handleEntityNotFound(_0xdd165,null))['then'](removeEntity(_0xdd165,null))[_0xfed2('0x41')](handleError(_0xdd165,null));};exports[_0xfed2('0x48')]=function(_0x3e756b,_0x2bb4b0,_0x325c88){return db[_0xfed2('0x49')][_0xfed2('0x47')]({'where':{'id':_0x3e756b[_0xfed2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2bb4b0,null))[_0xfed2('0x21')](function(_0x321720){if(_0x321720){return _0x321720[_0xfed2('0x48')](_0x3e756b[_0xfed2('0x46')][_0xfed2('0x4a')],_[_0xfed2('0x4b')](_0x3e756b[_0xfed2('0x46')],[_0xfed2('0x4a'),'id'])||{});}})[_0xfed2('0x21')](respondWithResult(_0x2bb4b0,null))[_0xfed2('0x41')](handleError(_0x2bb4b0,null));};exports[_0xfed2('0x4c')]=function(_0x13b0a1,_0x472e94,_0x507567){var _0x5c9abf={};var _0x548834={};var _0x2a68a2;var _0x145e57;return db[_0xfed2('0x29')][_0xfed2('0x4d')]({'where':{'id':_0x13b0a1[_0xfed2('0x43')]['id']}})[_0xfed2('0x21')](handleEntityNotFound(_0x472e94,null))['then'](function(_0x4a1c7f){if(_0x4a1c7f){_0x2a68a2=_0x4a1c7f;_0x548834['model']=_[_0xfed2('0x2f')](db[_0xfed2('0x49')][_0xfed2('0x2a')]);_0x548834[_0xfed2('0x2e')]=_[_0xfed2('0x2f')](_0x13b0a1[_0xfed2('0x2e')]);_0x548834['filters']=_[_0xfed2('0x30')](_0x548834[_0xfed2('0x31')],_0x548834[_0xfed2('0x2e')]);_0x5c9abf['attributes']=_[_0xfed2('0x30')](_0x548834[_0xfed2('0x31')],qs[_0xfed2('0x33')](_0x13b0a1[_0xfed2('0x2e')]['fields']));_0x5c9abf[_0xfed2('0x32')]=_0x5c9abf[_0xfed2('0x32')][_0xfed2('0x44')]?_0x5c9abf[_0xfed2('0x32')]:_0x548834[_0xfed2('0x31')];_0x5c9abf[_0xfed2('0x35')]=qs[_0xfed2('0x36')](_0x13b0a1[_0xfed2('0x2e')][_0xfed2('0x36')]);_0x5c9abf['where']=qs['filters'](_['pick'](_0x13b0a1['query'],_0x548834[_0xfed2('0x38')]));if(_0x13b0a1['query']['filter']){_0x5c9abf[_0xfed2('0x37')]=_['merge'](_0x5c9abf[_0xfed2('0x37')],{'$or':_[_0xfed2('0x28')](_0x5c9abf[_0xfed2('0x32')],function(_0x379139){var _0x1f1a4b={};_0x1f1a4b[_0x379139]={'$like':'%'+_0x13b0a1[_0xfed2('0x2e')][_0xfed2('0x3a')]+'%'};return _0x1f1a4b;})});}_0x5c9abf=_[_0xfed2('0x3b')]({},_0x5c9abf,_0x13b0a1[_0xfed2('0x3d')]);return _0x2a68a2[_0xfed2('0x4c')](_0x5c9abf);}})[_0xfed2('0x21')](function(_0x4c2e35){if(_0x4c2e35){_0x145e57=_0x4c2e35[_0xfed2('0x44')];if(!_0x13b0a1['query'][_0xfed2('0x4e')](_0xfed2('0x34'))){_0x5c9abf[_0xfed2('0x1b')]=qs[_0xfed2('0x1b')](_0x13b0a1['query'][_0xfed2('0x1b')]);_0x5c9abf[_0xfed2('0x19')]=qs[_0xfed2('0x19')](_0x13b0a1[_0xfed2('0x2e')]['offset']);}return _0x2a68a2[_0xfed2('0x4c')](_0x5c9abf);}})[_0xfed2('0x21')](function(_0x4fdda4){if(_0x4fdda4){return _0x4fdda4?{'count':_0x145e57,'rows':_0x4fdda4}:null;}})[_0xfed2('0x21')](respondWithResult(_0x472e94,null))[_0xfed2('0x41')](handleError(_0x472e94,null));};exports[_0xfed2('0x4f')]=function(_0x4ea45c,_0x5a1e4a,_0x4f1dcf){return db[_0xfed2('0x50')][_0xfed2('0x47')]({'where':{'id':_0x4ea45c['params']['id']}})['then'](handleEntityNotFound(_0x5a1e4a,null))[_0xfed2('0x21')](function(_0x229d53){if(_0x229d53){return _0x229d53['addActions'](_0x4ea45c['body']['ids'],_[_0xfed2('0x4b')](_0x4ea45c[_0xfed2('0x46')],[_0xfed2('0x4a'),'id'])||{});}})[_0xfed2('0x21')](respondWithResult(_0x5a1e4a,null))['catch'](handleError(_0x5a1e4a,null));};exports['getActions']=function(_0x28165d,_0x5f3b76,_0x2afaf9){var _0x244093={};var _0x31d66a={};var _0x12de3d;var _0x482a67;return db['Automation'][_0xfed2('0x4d')]({'where':{'id':_0x28165d[_0xfed2('0x43')]['id']}})['then'](handleEntityNotFound(_0x5f3b76,null))[_0xfed2('0x21')](function(_0x1fefb7){if(_0x1fefb7){_0x12de3d=_0x1fefb7;_0x31d66a[_0xfed2('0x31')]=_[_0xfed2('0x2f')](db['Action'][_0xfed2('0x2a')]);_0x31d66a[_0xfed2('0x2e')]=_[_0xfed2('0x2f')](_0x28165d[_0xfed2('0x2e')]);_0x31d66a['filters']=_[_0xfed2('0x30')](_0x31d66a[_0xfed2('0x31')],_0x31d66a[_0xfed2('0x2e')]);_0x244093[_0xfed2('0x32')]=_['intersection'](_0x31d66a['model'],qs[_0xfed2('0x33')](_0x28165d[_0xfed2('0x2e')][_0xfed2('0x33')]));_0x244093[_0xfed2('0x32')]=_0x244093[_0xfed2('0x32')][_0xfed2('0x44')]?_0x244093['attributes']:_0x31d66a[_0xfed2('0x31')];_0x244093[_0xfed2('0x35')]=qs['sort'](_0x28165d['query'][_0xfed2('0x36')]);_0x244093[_0xfed2('0x37')]=qs['filters'](_['pick'](_0x28165d[_0xfed2('0x2e')],_0x31d66a[_0xfed2('0x38')]));if(_0x28165d[_0xfed2('0x2e')]['filter']){_0x244093['where']=_[_0xfed2('0x3b')](_0x244093[_0xfed2('0x37')],{'$or':_[_0xfed2('0x28')](_0x244093[_0xfed2('0x32')],function(_0x4ec94b){var _0x347697={};_0x347697[_0x4ec94b]={'$like':'%'+_0x28165d[_0xfed2('0x2e')]['filter']+'%'};return _0x347697;})});}_0x244093=_[_0xfed2('0x3b')]({},_0x244093,_0x28165d[_0xfed2('0x3d')]);return _0x12de3d[_0xfed2('0x51')](_0x244093);}})['then'](function(_0x3f8623){if(_0x3f8623){_0x482a67=_0x3f8623[_0xfed2('0x44')];if(!_0x28165d['query'][_0xfed2('0x4e')](_0xfed2('0x34'))){_0x244093[_0xfed2('0x1b')]=qs[_0xfed2('0x1b')](_0x28165d[_0xfed2('0x2e')]['limit']);_0x244093[_0xfed2('0x19')]=qs['offset'](_0x28165d[_0xfed2('0x2e')][_0xfed2('0x19')]);}return _0x12de3d[_0xfed2('0x51')](_0x244093);}})[_0xfed2('0x21')](function(_0x330966){if(_0x330966){return _0x330966?{'count':_0x482a67,'rows':_0x330966}:null;}})[_0xfed2('0x21')](respondWithResult(_0x5f3b76,null))[_0xfed2('0x41')](handleError(_0x5f3b76,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 567af26..1c59a25 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 _0x4f32=['bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','../../config/logger','api','moment'];(function(_0x170cb1,_0x283ec6){var _0x17d3a4=function(_0x31db9f){while(--_0x31db9f){_0x170cb1['push'](_0x170cb1['shift']());}};_0x17d3a4(++_0x283ec6);}(_0x4f32,0x74));var _0x24f3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4f32[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x24f3('0x0'));var util=require('util');var logger=require(_0x24f3('0x1'))(_0x24f3('0x2'));var moment=require(_0x24f3('0x3'));var BPromise=require(_0x24f3('0x4'));var rp=require(_0x24f3('0x5'));var fs=require('fs');var path=require(_0x24f3('0x6'));var rimraf=require('rimraf');var config=require(_0x24f3('0x7'));var attributes=require(_0x24f3('0x8'));module[_0x24f3('0x9')]=function(_0x39942f,_0x96957c){return _0x39942f[_0x24f3('0xa')]('Automation',attributes,{'tableName':_0x24f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8d8=['rimraf','../../config/environment','exports','Automation','tools_automations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x26be9c,_0x142905){var _0x13a443=function(_0xa65ff1){while(--_0xa65ff1){_0x26be9c['push'](_0x26be9c['shift']());}};_0x13a443(++_0x142905);}(_0xf8d8,0x94));var _0x8f8d=function(_0x8e74c4,_0x4c3b72){_0x8e74c4=_0x8e74c4-0x0;var _0x50e53f=_0xf8d8[_0x8e74c4];return _0x50e53f;};'use strict';var _=require(_0x8f8d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8f8d('0x1'));var moment=require(_0x8f8d('0x2'));var BPromise=require(_0x8f8d('0x3'));var rp=require(_0x8f8d('0x4'));var fs=require('fs');var path=require(_0x8f8d('0x5'));var rimraf=require(_0x8f8d('0x6'));var config=require(_0x8f8d('0x7'));var attributes=require('./automation.attributes');module[_0x8f8d('0x8')]=function(_0x316e5b,_0x1d0632){return _0x316e5b['define'](_0x8f8d('0x9'),attributes,{'tableName':_0x8f8d('0xa'),'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 e53c859..8241287 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 _0x8212=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1b7442,_0x392128){var _0x15ef34=function(_0x415bd6){while(--_0x415bd6){_0x1b7442['push'](_0x1b7442['shift']());}};_0x15ef34(++_0x392128);}(_0x8212,0xb3));var _0x2821=function(_0x315860,_0x142502){_0x315860=_0x315860-0x0;var _0x4a60f4=_0x8212[_0x315860];return _0x4a60f4;};'use strict';var _=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var moment=require('moment');var BPromise=require(_0x2821('0x2'));var rs=require(_0x2821('0x3'));var fs=require('fs');var Redis=require(_0x2821('0x4'));var db=require(_0x2821('0x5'))['db'];var utils=require(_0x2821('0x6'));var logger=require(_0x2821('0x7'))(_0x2821('0x8'));var config=require(_0x2821('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2821('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x376c57,_0x1dc078,_0x4ea6d5){return new BPromise(function(_0x3644aa,_0x201069){return client[_0x2821('0xb')](_0x376c57,_0x4ea6d5)[_0x2821('0xc')](function(_0x16003f){logger[_0x2821('0xd')](_0x2821('0xe'),_0x1dc078,_0x2821('0xf'));logger[_0x2821('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x1dc078,_0x2821('0xf'),JSON[_0x2821('0x11')](_0x16003f));if(_0x16003f[_0x2821('0x12')]){if(_0x16003f['error']['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x1dc078,_0x16003f[_0x2821('0x12')][_0x2821('0x13')]);return _0x201069(_0x16003f[_0x2821('0x12')][_0x2821('0x13')]);}logger[_0x2821('0x12')](_0x2821('0xe'),_0x1dc078,_0x16003f['error'][_0x2821('0x13')]);return _0x3644aa(_0x16003f['error']['message']);}else{logger[_0x2821('0xd')](_0x2821('0xe'),_0x1dc078,_0x2821('0xf'));_0x3644aa(_0x16003f[_0x2821('0x14')]['message']);}})[_0x2821('0x15')](function(_0x5c2aa7){logger[_0x2821('0x12')](_0x2821('0xe'),_0x1dc078,_0x5c2aa7);_0x201069(_0x5c2aa7);});});} \ No newline at end of file +var _0xfbbb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x2dedea,_0x3dc336){var _0x363838=function(_0x2c422c){while(--_0x2c422c){_0x2dedea['push'](_0x2dedea['shift']());}};_0x363838(++_0x3dc336);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x373e22,_0x7cc6d1){_0x373e22=_0x373e22-0x0;var _0x3e06b5=_0xfbbb[_0x373e22];return _0x3e06b5;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var moment=require(_0xbfbb('0x2'));var BPromise=require(_0xbfbb('0x3'));var rs=require(_0xbfbb('0x4'));var fs=require('fs');var Redis=require(_0xbfbb('0x5'));var db=require(_0xbfbb('0x6'))['db'];var utils=require(_0xbfbb('0x7'));var logger=require(_0xbfbb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbb('0x9'));var client=jayson['client'][_0xbfbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c6cc,_0x16a41c,_0x5a69b3){return new BPromise(function(_0x1f2c31,_0x3260a7){return client[_0xbfbb('0xb')](_0x16c6cc,_0x5a69b3)[_0xbfbb('0xc')](function(_0x1baefa){logger[_0xbfbb('0xd')]('Automation,\x20%s,\x20%s',_0x16a41c,_0xbfbb('0xe'));logger[_0xbfbb('0xf')](_0xbfbb('0x10'),_0x16a41c,_0xbfbb('0xe'),JSON['stringify'](_0x1baefa));if(_0x1baefa[_0xbfbb('0x11')]){if(_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x12')]===0x1f4){logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x3260a7(_0x1baefa[_0xbfbb('0x11')]['message']);}logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x1f2c31(_0x1baefa[_0xbfbb('0x11')]['message']);}else{logger[_0xbfbb('0xd')](_0xbfbb('0x13'),_0x16a41c,_0xbfbb('0xe'));_0x1f2c31(_0x1baefa[_0xbfbb('0x15')][_0xbfbb('0x14')]);}})[_0xbfbb('0x16')](function(_0x2f49e5){logger['error']('Automation,\x20%s,\x20%s',_0x16a41c,_0x2f49e5);_0x3260a7(_0x2f49e5);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index afe0b1a..4f68f73 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 _0x0faf=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','/:id/conditions','/:id/actions','getActions','post','create','addActions','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0faf,0x132));var _0xf0fa=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x0faf[_0x2faddb];return _0x273c05;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),auth[_0xf0fa('0xa')](),controller['show']);router[_0xf0fa('0xc')](_0xf0fa('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0xf0fa('0xc')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x10')]);router[_0xf0fa('0x11')]('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x12')]);router[_0xf0fa('0x11')]('/:id/conditions',auth[_0xf0fa('0xa')](),controller['addConditions']);router[_0xf0fa('0x11')]('/:id/actions',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x13')]);router[_0xf0fa('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf0fa('0x15')]);router['delete'](_0xf0fa('0xd'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x16')]);module[_0xf0fa('0x17')]=router; \ No newline at end of file +var _0xb701=['update','delete','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put'];(function(_0x23a8f9,_0x21c7c4){var _0x3a89ec=function(_0x4e52ee){while(--_0x4e52ee){_0x23a8f9['push'](_0x23a8f9['shift']());}};_0x3a89ec(++_0x21c7c4);}(_0xb701,0x144));var _0x1b70=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb701[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require(_0x1b70('0x0'));var path=require('path');var timeout=require(_0x1b70('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b70('0x2'));var auth=require(_0x1b70('0x3'));var interaction=require(_0x1b70('0x4'));var config=require(_0x1b70('0x5'));var controller=require(_0x1b70('0x6'));router[_0x1b70('0x7')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x9')]);router[_0x1b70('0x7')](_0x1b70('0xa'),auth['isAuthenticated'](),controller[_0x1b70('0xb')]);router[_0x1b70('0x7')](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0xd')]);router[_0x1b70('0x7')](_0x1b70('0xe'),auth['isAuthenticated'](),controller[_0x1b70('0xf')]);router[_0x1b70('0x10')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x11')]);router[_0x1b70('0x10')](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x12')]);router[_0x1b70('0x10')](_0x1b70('0xe'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x13')]);router[_0x1b70('0x14')]('/:id',auth[_0x1b70('0x8')](),controller[_0x1b70('0x15')]);router[_0x1b70('0x16')](_0x1b70('0xa'),auth['isAuthenticated'](),controller['destroy']);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 f362370..db46922 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 _0xa3cb=['Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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\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)'];(function(_0x1b8524,_0x1bb669){var _0x81418d=function(_0x5f5795){while(--_0x5f5795){_0x1b8524['push'](_0x1b8524['shift']());}};_0x81418d(++_0x1bb669);}(_0xa3cb,0x1e0));var _0xba3c=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0xa3cb[_0x2bc3f4];return _0x14ac53;};'use strict';var Sequelize=require(_0xba3c('0x0'));module['exports']={'name':{'type':Sequelize[_0xba3c('0x1')],'unique':_0xba3c('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xba3c('0x3')](_0xba3c('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xba3c('0x1')]},'active':{'type':Sequelize[_0xba3c('0x5')],'defaultValue':0x0,'comment':_0xba3c('0x6')},'limitCalls':{'type':Sequelize[_0xba3c('0x7')](0x4)[_0xba3c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xba3c('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xba3c('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xba3c('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xba3c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba3c('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba3c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba3c('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xba3c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba3c('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba3c('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xba3c('0x7')](0x5)[_0xba3c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'defaultValue':0x3,'comment':_0xba3c('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xba3c('0x7')](0x5)[_0xba3c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xba3c('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xba3c('0x1')],'defaultValue':_0xba3c('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xba3c('0x11'),_0xba3c('0x12'),_0xba3c('0x13')),'defaultValue':_0xba3c('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xba3c('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xba3c('0x7')](0x9)[_0xba3c('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xba3c('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xba3c('0x7')](0x9)[_0xba3c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xba3c('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xba3c('0x7')](0x9)[_0xba3c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xba3c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xba3c('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xba3c('0x7')](0x9)[_0xba3c('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xba3c('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xba3c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xba3c('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xba3c('0x7')](0x9)[_0xba3c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xba3c('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xba3c('0x7')](0x5)[_0xba3c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xba3c('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xba3c('0x3')](_0xba3c('0x1c'),_0xba3c('0x1d')),'defaultValue':_0xba3c('0x1c')},'dialPrefix':{'type':Sequelize[_0xba3c('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xba3c('0x1e')},'dialCutDigit':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xba3c('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba3c('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xba3c('0x7')](0x5)[_0xba3c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba3c('0x21')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba3c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba3c('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xba3c('0x7')](0x5)[_0xba3c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba3c('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba3c('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xba3c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba3c('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0xba3c('0x7')](0x3)[_0xba3c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba3c('0x26')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xba3c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba3c('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xba3c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba3c('0x28')}}; \ No newline at end of file +var _0x1d16=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','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)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0x1d16,0xa8));var _0x61d1=function(_0x4f1749,_0x998e73){_0x4f1749=_0x4f1749-0x0;var _0x9a9ab3=_0x1d16[_0x4f1749];return _0x9a9ab3;};'use strict';var Sequelize=require('sequelize');module[_0x61d1('0x0')]={'name':{'type':Sequelize[_0x61d1('0x1')],'unique':_0x61d1('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x61d1('0x3')),'allowNull':![],'defaultValue':_0x61d1('0x3')},'description':{'type':Sequelize[_0x61d1('0x1')]},'active':{'type':Sequelize[_0x61d1('0x4')],'defaultValue':0x0,'comment':_0x61d1('0x5')},'limitCalls':{'type':Sequelize[_0x61d1('0x6')](0x4)[_0x61d1('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x61d1('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x61d1('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x61d1('0x6')](0x3)[_0x61d1('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x61d1('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x61d1('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x61d1('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x61d1('0x6')](0x5)[_0x61d1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x61d1('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x61d1('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x61d1('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x61d1('0x6')](0x5)[_0x61d1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x61d1('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x61d1('0x7')],'defaultValue':0x3,'comment':_0x61d1('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x61d1('0x6')](0x5)[_0x61d1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x61d1('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x61d1('0x6')](0x3)[_0x61d1('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x61d1('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x61d1('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x61d1('0x10'),_0x61d1('0x11'),_0x61d1('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x61d1('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x61d1('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x61d1('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x61d1('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x61d1('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x61d1('0x6')](0x9)[_0x61d1('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x61d1('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x61d1('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x61d1('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x61d1('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x61d1('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x61d1('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x61d1('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x61d1('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x61d1('0x6')](0x9)[_0x61d1('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x61d1('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x61d1('0x1a')](_0x61d1('0x1b'),_0x61d1('0x1c')),'defaultValue':_0x61d1('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x61d1('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x61d1('0x1d')},'dialCutDigit':{'type':Sequelize[_0x61d1('0x6')](0x3)[_0x61d1('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x61d1('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x61d1('0x6')](0x3)[_0x61d1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x61d1('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x61d1('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x61d1('0x6')](0x3)[_0x61d1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x61d1('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x61d1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x61d1('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x61d1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x61d1('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x61d1('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x61d1('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x61d1('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x61d1('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x61d1('0x6')](0x3)[_0x61d1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x61d1('0x6')](0x5)[_0x61d1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x61d1('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 395b3f9..2258b82 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 _0xb583=['hasOwnProperty','nolimit','CampaignId','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','field','phone','NOW()','scheduledAt','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','get','IvrCampaigns','UserProfileResource','then','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','update','findOne','CmHopper'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0xb583,0x1b9));var _0x3b58=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb583[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x3b58('0x0'));var rimraf=require(_0x3b58('0x1'));var zipdir=require(_0x3b58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b58('0x3'));var BPromise=require(_0x3b58('0x4'));var Mustache=require(_0x3b58('0x5'));var util=require(_0x3b58('0x6'));var path=require(_0x3b58('0x7'));var sox=require(_0x3b58('0x8'));var csv=require(_0x3b58('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b58('0xa'));var _=require('lodash');var squel=require(_0x3b58('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b58('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3b58('0xd'));var Papa=require('papaparse');var Redis=require(_0x3b58('0xe'));var authService=require(_0x3b58('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3b58('0x10'));var hardwareService=require(_0x3b58('0x11'));var logger=require(_0x3b58('0x12'))('api');var utils=require(_0x3b58('0x13'));var config=require(_0x3b58('0x14'));var licenseUtil=require(_0x3b58('0x15'));var db=require(_0x3b58('0x16'))['db'];function respondWithStatusCode(_0x5f4a83,_0x2dc4c1){_0x2dc4c1=_0x2dc4c1||0xcc;return function(_0x4c14bf){if(_0x4c14bf){return _0x5f4a83[_0x3b58('0x17')](_0x2dc4c1);}return _0x5f4a83['status'](_0x2dc4c1)[_0x3b58('0x18')]();};}function respondWithResult(_0x42584d,_0x4b6e85){_0x4b6e85=_0x4b6e85||0xc8;return function(_0x2df66a){if(_0x2df66a){return _0x42584d[_0x3b58('0x19')](_0x4b6e85)[_0x3b58('0x1a')](_0x2df66a);}};}function respondWithFilteredResult(_0x29ca0a,_0x39ff5d){return function(_0x490db5){if(_0x490db5){var _0x151ed0=typeof _0x39ff5d[_0x3b58('0x1b')]===_0x3b58('0x1c')&&typeof _0x39ff5d['limit']===_0x3b58('0x1c');var _0x4feeea=_0x490db5['count'];var _0x175929=_0x151ed0?0x0:_0x39ff5d[_0x3b58('0x1b')];var _0xfbcc21=_0x151ed0?_0x490db5[_0x3b58('0x1d')]:_0x39ff5d[_0x3b58('0x1b')]+_0x39ff5d[_0x3b58('0x1e')];var _0x1aac09;if(_0xfbcc21>=_0x4feeea){_0xfbcc21=_0x4feeea;_0x1aac09=0xc8;}else{_0x1aac09=0xce;}_0x29ca0a[_0x3b58('0x19')](_0x1aac09);return _0x29ca0a[_0x3b58('0x1f')](_0x3b58('0x20'),_0x175929+'-'+_0xfbcc21+'/'+_0x4feeea)[_0x3b58('0x1a')](_0x490db5);}return null;};}function patchUpdates(_0x43ef7c){return function(_0x22a87b){try{jsonpatch[_0x3b58('0x21')](_0x22a87b,_0x43ef7c,!![]);}catch(_0x524ae0){return BPromise[_0x3b58('0x22')](_0x524ae0);}return _0x22a87b[_0x3b58('0x23')]();};}function saveUpdates(_0x388a70,_0x5a0fb0){return function(_0x3c68d1){if(_0x3c68d1){return _0x3c68d1['update'](_0x388a70)['then'](function(_0x3a3067){return _0x3a3067;});}return null;};}function removeEntity(_0x5354ff,_0xe76df5){return function(_0x161f7a){if(_0x161f7a){return _0x161f7a[_0x3b58('0x24')]()['then'](function(){var _0x2cd0fe=_0x161f7a[_0x3b58('0x25')]({'plain':!![]});var _0xa45017=_0x3b58('0x26');return db[_0x3b58('0x27')][_0x3b58('0x24')]({'where':{'type':_0xa45017,'resourceId':_0x2cd0fe['id']}})[_0x3b58('0x28')](function(){return _0x161f7a;});})[_0x3b58('0x28')](function(){_0x5354ff[_0x3b58('0x19')](0xcc)[_0x3b58('0x18')]();});}};}function handleEntityNotFound(_0x3e1134,_0x5d2c5d){return function(_0x4f03ca){if(!_0x4f03ca){_0x3e1134[_0x3b58('0x17')](0x194);}return _0x4f03ca;};}function handleError(_0x3dcc49,_0x3511ec){_0x3511ec=_0x3511ec||0x1f4;return function(_0x3df8e4){logger[_0x3b58('0x29')](_0x3df8e4[_0x3b58('0x2a')]);if(_0x3df8e4[_0x3b58('0x2b')]){delete _0x3df8e4[_0x3b58('0x2b')];}_0x3dcc49['status'](_0x3511ec)[_0x3b58('0x2c')](_0x3df8e4);};}exports[_0x3b58('0x2d')]=function(_0x4bec55,_0x578e0f){var _0x3abb12={},_0x54d935={},_0x42d2dc={'count':0x0,'rows':[]};var _0x585573=_[_0x3b58('0x2e')](db[_0x3b58('0x2f')][_0x3b58('0x30')],function(_0x27a74b){return{'name':_0x27a74b[_0x3b58('0x31')],'type':_0x27a74b[_0x3b58('0x32')][_0x3b58('0x33')]};});_0x54d935[_0x3b58('0x34')]=_[_0x3b58('0x2e')](_0x585573,_0x3b58('0x2b'));_0x54d935[_0x3b58('0x35')]=_[_0x3b58('0x36')](_0x4bec55[_0x3b58('0x35')]);_0x54d935['filters']=_[_0x3b58('0x37')](_0x54d935['model'],_0x54d935['query']);_0x3abb12[_0x3b58('0x38')]=_[_0x3b58('0x37')](_0x54d935['model'],qs[_0x3b58('0x39')](_0x4bec55['query'][_0x3b58('0x39')]));_0x3abb12[_0x3b58('0x38')]=_0x3abb12[_0x3b58('0x38')]['length']?_0x3abb12['attributes']:_0x54d935[_0x3b58('0x34')];if(!_0x4bec55[_0x3b58('0x35')]['hasOwnProperty']('nolimit')){_0x3abb12[_0x3b58('0x1e')]=qs[_0x3b58('0x1e')](_0x4bec55[_0x3b58('0x35')][_0x3b58('0x1e')]);_0x3abb12['offset']=qs[_0x3b58('0x1b')](_0x4bec55['query'][_0x3b58('0x1b')]);}_0x3abb12[_0x3b58('0x3a')]=qs[_0x3b58('0x3b')](_0x4bec55['query'][_0x3b58('0x3b')]);_0x3abb12[_0x3b58('0x3c')]=qs[_0x3b58('0x3d')](_['pick'](_0x4bec55[_0x3b58('0x35')],_0x54d935[_0x3b58('0x3d')]),_0x585573);if(_0x4bec55[_0x3b58('0x35')][_0x3b58('0x3e')]){_0x3abb12[_0x3b58('0x3c')]=_[_0x3b58('0x3f')](_0x3abb12[_0x3b58('0x3c')],{'$or':_[_0x3b58('0x2e')](_0x585573,function(_0x2bae1a){if(_0x2bae1a[_0x3b58('0x32')]!=='VIRTUAL'){var _0x2347e7={};_0x2347e7[_0x2bae1a[_0x3b58('0x2b')]]={'$like':'%'+_0x4bec55[_0x3b58('0x35')][_0x3b58('0x3e')]+'%'};return _0x2347e7;}})});}_0x3abb12=_[_0x3b58('0x3f')]({},_0x3abb12,_0x4bec55[_0x3b58('0x40')]);var _0x383464={'where':_0x3abb12[_0x3b58('0x3c')]};return db['Campaign'][_0x3b58('0x1d')](_0x383464)[_0x3b58('0x28')](function(_0x3475c5){_0x42d2dc[_0x3b58('0x1d')]=_0x3475c5;if(_0x4bec55[_0x3b58('0x35')][_0x3b58('0x41')]){_0x3abb12[_0x3b58('0x42')]=[{'all':!![]}];}return db[_0x3b58('0x2f')][_0x3b58('0x43')](_0x3abb12);})[_0x3b58('0x28')](function(_0x925886){_0x42d2dc[_0x3b58('0x44')]=_0x925886;return _0x42d2dc;})[_0x3b58('0x28')](respondWithFilteredResult(_0x578e0f,_0x3abb12))[_0x3b58('0x45')](handleError(_0x578e0f,null));};exports['show']=function(_0x1291be,_0x41f486){var _0x3bdf61={'raw':![],'where':{'id':_0x1291be[_0x3b58('0x46')]['id']}},_0xe2c57d={};_0xe2c57d[_0x3b58('0x34')]=_[_0x3b58('0x36')](db[_0x3b58('0x2f')]['rawAttributes']);_0xe2c57d[_0x3b58('0x35')]=_[_0x3b58('0x36')](_0x1291be[_0x3b58('0x35')]);_0xe2c57d[_0x3b58('0x3d')]=_[_0x3b58('0x37')](_0xe2c57d[_0x3b58('0x34')],_0xe2c57d['query']);_0x3bdf61[_0x3b58('0x38')]=_[_0x3b58('0x37')](_0xe2c57d[_0x3b58('0x34')],qs[_0x3b58('0x39')](_0x1291be['query'][_0x3b58('0x39')]));_0x3bdf61[_0x3b58('0x38')]=_0x3bdf61[_0x3b58('0x38')][_0x3b58('0x47')]?_0x3bdf61[_0x3b58('0x38')]:_0xe2c57d[_0x3b58('0x34')];if(_0x1291be['query']['includeAll']){_0x3bdf61[_0x3b58('0x42')]=[{'all':!![]}];}_0x3bdf61=_[_0x3b58('0x3f')]({},_0x3bdf61,_0x1291be[_0x3b58('0x40')]);return db['Campaign'][_0x3b58('0x48')](_0x3bdf61)[_0x3b58('0x28')](handleEntityNotFound(_0x41f486,null))[_0x3b58('0x28')](respondWithResult(_0x41f486,null))[_0x3b58('0x45')](handleError(_0x41f486,null));};exports[_0x3b58('0x49')]=function(_0x4f39e5,_0x40defc){return db[_0x3b58('0x2f')][_0x3b58('0x49')](_0x4f39e5[_0x3b58('0x4a')],{})[_0x3b58('0x28')](function(_0x11fb74){var _0x12a019=_0x4f39e5[_0x3b58('0x4b')][_0x3b58('0x25')]({'plain':!![]});if(!_0x12a019)throw new Error(_0x3b58('0x4c'));if(_0x12a019[_0x3b58('0x4d')]===_0x3b58('0x4b')){var _0x3d5af7=_0x11fb74[_0x3b58('0x25')]({'plain':!![]});var _0x473989=_0x3b58('0x26');return db[_0x3b58('0x4e')][_0x3b58('0x48')]({'where':{'name':_0x473989,'userProfileId':_0x12a019[_0x3b58('0x4f')]},'raw':!![]})[_0x3b58('0x28')](function(_0x2e909){if(_0x2e909&&_0x2e909['autoAssociation']===0x0){return db[_0x3b58('0x27')][_0x3b58('0x49')]({'name':_0x3d5af7[_0x3b58('0x2b')],'resourceId':_0x3d5af7['id'],'type':_0x2e909['name'],'sectionId':_0x2e909['id']},{})['then'](function(){return _0x11fb74;});}else{return _0x11fb74;}})[_0x3b58('0x45')](function(_0x15c634){logger['error'](_0x3b58('0x50'),_0x15c634);throw _0x15c634;});}return _0x11fb74;})[_0x3b58('0x28')](respondWithResult(_0x40defc,0xc9))[_0x3b58('0x45')](handleError(_0x40defc,null));};exports[_0x3b58('0x51')]=function(_0x3adcf0,_0x8261e5){var _0x24f0b4={'where':{'id':_0x3adcf0[_0x3b58('0x46')]['id']}},_0x13f92d={};_0x13f92d[_0x3b58('0x34')]=_[_0x3b58('0x36')](db[_0x3b58('0x2f')][_0x3b58('0x30')]);_0x24f0b4[_0x3b58('0x38')]=_[_0x3b58('0x37')](_0x13f92d['model'],qs['fields'](_0x3adcf0[_0x3b58('0x35')][_0x3b58('0x39')]));_0x24f0b4[_0x3b58('0x38')]=_0x24f0b4['attributes'][_0x3b58('0x47')]?_0x24f0b4[_0x3b58('0x38')]:_0x13f92d[_0x3b58('0x34')];if(_0x3adcf0['query'][_0x3b58('0x41')]){_0x24f0b4[_0x3b58('0x42')]=[{'all':!![]}];}_0x24f0b4=_['merge']({},_0x24f0b4,_0x3adcf0[_0x3b58('0x40')]);return db[_0x3b58('0x2f')][_0x3b58('0x48')](_0x24f0b4)['then'](handleEntityNotFound(_0x8261e5,null))[_0x3b58('0x28')](function(_0x509c6c){if(_0x509c6c){var _0x504e34=_0x509c6c[_0x3b58('0x25')]({'plain':!![]});_0x504e34=qs[_0x3b58('0x52')](_0x504e34,['id','createdAt',_0x3b58('0x53')]);_0x3adcf0['body']=_[_0x3b58('0x52')](_0x3adcf0['body'],['id','createdAt','updatedAt']);return db['Campaign'][_0x3b58('0x49')](_[_0x3b58('0x3f')](_0x504e34,_0x3adcf0['body']),{'include':_0x3adcf0[_0x3b58('0x35')][_0x3b58('0x41')]?[{'all':!![]}]:undefined})[_0x3b58('0x28')](function(_0x1c6726){var _0x4c22e3=_0x3adcf0['user'][_0x3b58('0x25')]({'plain':!![]});if(!_0x4c22e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c22e3[_0x3b58('0x4d')]===_0x3b58('0x4b')){var _0x4c67c2=_0x1c6726[_0x3b58('0x25')]({'plain':!![]});var _0x102032=_0x3b58('0x26');return db[_0x3b58('0x4e')][_0x3b58('0x48')]({'where':{'name':_0x102032,'userProfileId':_0x4c22e3['userProfileId']},'raw':!![]})[_0x3b58('0x28')](function(_0x4903b5){if(_0x4903b5&&_0x4903b5['autoAssociation']===0x0){return db[_0x3b58('0x27')][_0x3b58('0x49')]({'name':_0x4c67c2[_0x3b58('0x2b')],'resourceId':_0x4c67c2['id'],'type':_0x4903b5[_0x3b58('0x2b')],'sectionId':_0x4903b5['id']},{})[_0x3b58('0x28')](function(){return _0x1c6726;});}else{return _0x1c6726;}})[_0x3b58('0x45')](function(_0xbc9309){logger[_0x3b58('0x29')](_0x3b58('0x50'),_0xbc9309);throw _0xbc9309;});}return _0x1c6726;});}})[_0x3b58('0x28')](respondWithResult(_0x8261e5,0xc9))[_0x3b58('0x45')](handleError(_0x8261e5,null));};exports[_0x3b58('0x54')]=function(_0x4250ee,_0x2bb0a1){if(_0x4250ee['body']['id']){delete _0x4250ee['body']['id'];}return db[_0x3b58('0x2f')][_0x3b58('0x48')]({'where':{'id':_0x4250ee[_0x3b58('0x46')]['id']}})[_0x3b58('0x28')](handleEntityNotFound(_0x2bb0a1,null))[_0x3b58('0x28')](saveUpdates(_0x4250ee[_0x3b58('0x4a')],null))[_0x3b58('0x28')](respondWithResult(_0x2bb0a1,null))[_0x3b58('0x45')](handleError(_0x2bb0a1,null));};exports[_0x3b58('0x24')]=function(_0x281344,_0x1a6c43){return db[_0x3b58('0x2f')][_0x3b58('0x48')]({'where':{'id':_0x281344[_0x3b58('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a6c43,null))[_0x3b58('0x28')](removeEntity(_0x1a6c43,null))['catch'](handleError(_0x1a6c43,null));};exports['getHoppers']=function(_0x307e62,_0x61e582,_0x13b68f){var _0x14e509={'raw':!![],'where':{}};var _0x4b306f={};var _0x213c3f={'count':0x0,'rows':[]};return db['Campaign'][_0x3b58('0x55')]({'where':{'id':_0x307e62[_0x3b58('0x46')]['id']}})[_0x3b58('0x28')](handleEntityNotFound(_0x61e582,null))[_0x3b58('0x28')](function(_0xc04ad9){if(_0xc04ad9){_0x4b306f['model']=_[_0x3b58('0x36')](db[_0x3b58('0x56')]['rawAttributes']);_0x4b306f['query']=_['keys'](_0x307e62[_0x3b58('0x35')]);_0x4b306f[_0x3b58('0x3d')]=_[_0x3b58('0x37')](_0x4b306f[_0x3b58('0x34')],_0x4b306f[_0x3b58('0x35')]);_0x14e509[_0x3b58('0x38')]=_[_0x3b58('0x37')](_0x4b306f[_0x3b58('0x34')],qs[_0x3b58('0x39')](_0x307e62[_0x3b58('0x35')]['fields']));_0x14e509[_0x3b58('0x38')]=_0x14e509[_0x3b58('0x38')]['length']?_0x14e509[_0x3b58('0x38')]:_0x4b306f[_0x3b58('0x34')];if(!_0x307e62[_0x3b58('0x35')][_0x3b58('0x57')](_0x3b58('0x58'))){_0x14e509[_0x3b58('0x1e')]=qs[_0x3b58('0x1e')](_0x307e62[_0x3b58('0x35')]['limit']);_0x14e509[_0x3b58('0x1b')]=qs['offset'](_0x307e62[_0x3b58('0x35')][_0x3b58('0x1b')]);}_0x14e509['order']=qs[_0x3b58('0x3b')](_0x307e62[_0x3b58('0x35')][_0x3b58('0x3b')]);_0x14e509[_0x3b58('0x3c')]=qs[_0x3b58('0x3d')](_['pick'](_0x307e62[_0x3b58('0x35')],_0x4b306f[_0x3b58('0x3d')]));_0x14e509[_0x3b58('0x3c')][_0x3b58('0x59')]=_0xc04ad9['id'];if(_0x307e62['query'][_0x3b58('0x3e')]){_0x14e509[_0x3b58('0x3c')]=_[_0x3b58('0x3f')](_0x14e509[_0x3b58('0x3c')],{'$or':_[_0x3b58('0x2e')](_0x14e509[_0x3b58('0x38')],function(_0x4ed516){var _0x358a53={};_0x358a53[_0x4ed516]={'$like':'%'+_0x307e62['query'][_0x3b58('0x3e')]+'%'};return _0x358a53;})});}_0x14e509=_['merge']({},_0x14e509,_0x307e62[_0x3b58('0x40')]);return db[_0x3b58('0x56')][_0x3b58('0x1d')]({'where':_0x14e509[_0x3b58('0x3c')]})[_0x3b58('0x28')](function(_0x3052da){_0x213c3f['count']=_0x3052da;if(_0x307e62[_0x3b58('0x35')][_0x3b58('0x41')]){_0x14e509[_0x3b58('0x42')]=[{'all':!![]}];}return db[_0x3b58('0x56')]['findAll'](_0x14e509);})['then'](function(_0x57dc9c){_0x213c3f['rows']=_0x57dc9c;return _0x213c3f;});}})[_0x3b58('0x28')](respondWithFilteredResult(_0x61e582,_0x14e509))[_0x3b58('0x45')](handleError(_0x61e582,null));};exports['getHopperHistories']=function(_0xec19d4,_0x37be5c,_0x46fe9b){var _0x1cfa26={'raw':!![],'where':{}};var _0x45aaa9={};var _0x1e3196={'count':0x0,'rows':[]};return db['Campaign'][_0x3b58('0x55')]({'where':{'id':_0xec19d4[_0x3b58('0x46')]['id']}})[_0x3b58('0x28')](handleEntityNotFound(_0x37be5c,null))[_0x3b58('0x28')](function(_0x51c031){if(_0x51c031){_0x45aaa9['model']=_['keys'](db[_0x3b58('0x5a')][_0x3b58('0x30')]);_0x45aaa9['query']=_[_0x3b58('0x36')](_0xec19d4[_0x3b58('0x35')]);_0x45aaa9[_0x3b58('0x3d')]=_['intersection'](_0x45aaa9[_0x3b58('0x34')],_0x45aaa9[_0x3b58('0x35')]);_0x1cfa26['attributes']=_['intersection'](_0x45aaa9['model'],qs['fields'](_0xec19d4[_0x3b58('0x35')]['fields']));_0x1cfa26[_0x3b58('0x38')]=_0x1cfa26[_0x3b58('0x38')][_0x3b58('0x47')]?_0x1cfa26[_0x3b58('0x38')]:_0x45aaa9[_0x3b58('0x34')];if(!_0xec19d4[_0x3b58('0x35')][_0x3b58('0x57')](_0x3b58('0x58'))){_0x1cfa26[_0x3b58('0x1e')]=qs['limit'](_0xec19d4['query'][_0x3b58('0x1e')]);_0x1cfa26[_0x3b58('0x1b')]=qs['offset'](_0xec19d4[_0x3b58('0x35')][_0x3b58('0x1b')]);}_0x1cfa26[_0x3b58('0x3a')]=qs[_0x3b58('0x3b')](_0xec19d4[_0x3b58('0x35')][_0x3b58('0x3b')]);_0x1cfa26[_0x3b58('0x3c')]=qs['filters'](_[_0x3b58('0x5b')](_0xec19d4['query'],_0x45aaa9[_0x3b58('0x3d')]));_0x1cfa26[_0x3b58('0x3c')][_0x3b58('0x59')]=_0x51c031['id'];if(_0xec19d4[_0x3b58('0x35')][_0x3b58('0x3e')]){_0x1cfa26[_0x3b58('0x3c')]=_[_0x3b58('0x3f')](_0x1cfa26[_0x3b58('0x3c')],{'$or':_[_0x3b58('0x2e')](_0x1cfa26[_0x3b58('0x38')],function(_0x2e2804){var _0x3f249e={};_0x3f249e[_0x2e2804]={'$like':'%'+_0xec19d4[_0x3b58('0x35')]['filter']+'%'};return _0x3f249e;})});}_0x1cfa26=_[_0x3b58('0x3f')]({},_0x1cfa26,_0xec19d4[_0x3b58('0x40')]);return db[_0x3b58('0x5a')][_0x3b58('0x1d')]({'where':_0x1cfa26[_0x3b58('0x3c')]})[_0x3b58('0x28')](function(_0x298a6e){_0x1e3196[_0x3b58('0x1d')]=_0x298a6e;if(_0xec19d4[_0x3b58('0x35')][_0x3b58('0x41')]){_0x1cfa26['include']=[{'all':!![]}];}return db[_0x3b58('0x5a')][_0x3b58('0x43')](_0x1cfa26);})['then'](function(_0x2ed388){_0x1e3196['rows']=_0x2ed388;return _0x1e3196;});}})['then'](respondWithFilteredResult(_0x37be5c,_0x1cfa26))[_0x3b58('0x45')](handleError(_0x37be5c,null));};exports[_0x3b58('0x5c')]=function(_0x96ae8e,_0x16af4d,_0x213f44){var _0x1baeab={'raw':!![],'where':{}};var _0x52c98c={};var _0x43650f={'count':0x0,'rows':[]};return db[_0x3b58('0x2f')][_0x3b58('0x55')]({'where':{'id':_0x96ae8e[_0x3b58('0x46')]['id']}})['then'](handleEntityNotFound(_0x16af4d,null))['then'](function(_0x31b6b8){if(_0x31b6b8){_0x52c98c[_0x3b58('0x34')]=_[_0x3b58('0x36')](db[_0x3b58('0x5d')][_0x3b58('0x30')]);_0x52c98c[_0x3b58('0x35')]=_['keys'](_0x96ae8e[_0x3b58('0x35')]);_0x52c98c['filters']=_[_0x3b58('0x37')](_0x52c98c[_0x3b58('0x34')],_0x52c98c[_0x3b58('0x35')]);_0x1baeab[_0x3b58('0x38')]=_['intersection'](_0x52c98c['model'],qs[_0x3b58('0x39')](_0x96ae8e['query'][_0x3b58('0x39')]));_0x1baeab[_0x3b58('0x38')]=_0x1baeab[_0x3b58('0x38')][_0x3b58('0x47')]?_0x1baeab[_0x3b58('0x38')]:_0x52c98c[_0x3b58('0x34')];if(!_0x96ae8e[_0x3b58('0x35')][_0x3b58('0x57')](_0x3b58('0x58'))){_0x1baeab[_0x3b58('0x1e')]=qs[_0x3b58('0x1e')](_0x96ae8e['query']['limit']);_0x1baeab[_0x3b58('0x1b')]=qs['offset'](_0x96ae8e[_0x3b58('0x35')][_0x3b58('0x1b')]);}_0x1baeab[_0x3b58('0x3a')]=qs[_0x3b58('0x3b')](_0x96ae8e['query']['sort']);_0x1baeab[_0x3b58('0x3c')]=qs['filters'](_[_0x3b58('0x5b')](_0x96ae8e['query'],_0x52c98c[_0x3b58('0x3d')]));_0x1baeab[_0x3b58('0x3c')]['CampaignId']=_0x31b6b8['id'];if(_0x96ae8e[_0x3b58('0x35')][_0x3b58('0x3e')]){_0x1baeab['where']=_[_0x3b58('0x3f')](_0x1baeab[_0x3b58('0x3c')],{'$or':_['map'](_0x1baeab[_0x3b58('0x38')],function(_0x49b96c){var _0x298a4e={};_0x298a4e[_0x49b96c]={'$like':'%'+_0x96ae8e['query'][_0x3b58('0x3e')]+'%'};return _0x298a4e;})});}_0x1baeab=_[_0x3b58('0x3f')]({},_0x1baeab,_0x96ae8e['options']);return db[_0x3b58('0x5d')][_0x3b58('0x1d')]({'where':_0x1baeab[_0x3b58('0x3c')]})[_0x3b58('0x28')](function(_0x4712d7){_0x43650f[_0x3b58('0x1d')]=_0x4712d7;if(_0x96ae8e[_0x3b58('0x35')][_0x3b58('0x41')]){_0x1baeab[_0x3b58('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3b58('0x43')](_0x1baeab);})['then'](function(_0x5727d2){_0x43650f['rows']=_0x5727d2;return _0x43650f;});}})['then'](respondWithFilteredResult(_0x16af4d,_0x1baeab))[_0x3b58('0x45')](handleError(_0x16af4d,null));};exports[_0x3b58('0x5e')]=function(_0x3651b2,_0x20005b,_0x32e402){var _0x122c05={'raw':!![],'where':{}};var _0x266123={};var _0x4569d9={'count':0x0,'rows':[]};return db[_0x3b58('0x2f')][_0x3b58('0x55')]({'where':{'id':_0x3651b2[_0x3b58('0x46')]['id']}})[_0x3b58('0x28')](handleEntityNotFound(_0x20005b,null))[_0x3b58('0x28')](function(_0x4c6e55){if(_0x4c6e55){_0x266123[_0x3b58('0x34')]=_[_0x3b58('0x36')](db[_0x3b58('0x5f')][_0x3b58('0x30')]);_0x266123[_0x3b58('0x35')]=_[_0x3b58('0x36')](_0x3651b2['query']);_0x266123[_0x3b58('0x3d')]=_[_0x3b58('0x37')](_0x266123[_0x3b58('0x34')],_0x266123[_0x3b58('0x35')]);_0x122c05[_0x3b58('0x38')]=_['intersection'](_0x266123['model'],qs['fields'](_0x3651b2[_0x3b58('0x35')]['fields']));_0x122c05['attributes']=_0x122c05['attributes'][_0x3b58('0x47')]?_0x122c05[_0x3b58('0x38')]:_0x266123[_0x3b58('0x34')];if(!_0x3651b2['query']['hasOwnProperty'](_0x3b58('0x58'))){_0x122c05[_0x3b58('0x1e')]=qs[_0x3b58('0x1e')](_0x3651b2[_0x3b58('0x35')]['limit']);_0x122c05[_0x3b58('0x1b')]=qs[_0x3b58('0x1b')](_0x3651b2[_0x3b58('0x35')][_0x3b58('0x1b')]);}_0x122c05[_0x3b58('0x3a')]=qs['sort'](_0x3651b2['query']['sort']);_0x122c05[_0x3b58('0x3c')]=qs[_0x3b58('0x3d')](_['pick'](_0x3651b2[_0x3b58('0x35')],_0x266123['filters']));_0x122c05[_0x3b58('0x3c')][_0x3b58('0x59')]=_0x4c6e55['id'];if(_0x3651b2[_0x3b58('0x35')][_0x3b58('0x3e')]){_0x122c05[_0x3b58('0x3c')]=_[_0x3b58('0x3f')](_0x122c05[_0x3b58('0x3c')],{'$or':_[_0x3b58('0x2e')](_0x122c05[_0x3b58('0x38')],function(_0x150d68){var _0x13d441={};_0x13d441[_0x150d68]={'$like':'%'+_0x3651b2[_0x3b58('0x35')][_0x3b58('0x3e')]+'%'};return _0x13d441;})});}_0x122c05=_[_0x3b58('0x3f')]({},_0x122c05,_0x3651b2['options']);return db[_0x3b58('0x5f')][_0x3b58('0x1d')]({'where':_0x122c05[_0x3b58('0x3c')]})['then'](function(_0xc91177){_0x4569d9[_0x3b58('0x1d')]=_0xc91177;if(_0x3651b2[_0x3b58('0x35')][_0x3b58('0x41')]){_0x122c05['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x3b58('0x43')](_0x122c05);})[_0x3b58('0x28')](function(_0x5a74ab){_0x4569d9[_0x3b58('0x44')]=_0x5a74ab;return _0x4569d9;});}})[_0x3b58('0x28')](respondWithFilteredResult(_0x20005b,_0x122c05))[_0x3b58('0x45')](handleError(_0x20005b,null));};exports[_0x3b58('0x60')]=function(_0x2c2ad5,_0x5d88e0,_0x5b53b0){var _0x1a7d62={};var _0xffaa8c={};var _0x3d218d;var _0x4c55b1;return db[_0x3b58('0x2f')][_0x3b58('0x55')]({'where':{'id':_0x2c2ad5[_0x3b58('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d88e0,null))[_0x3b58('0x28')](function(_0x449a6c){if(_0x449a6c){_0x3d218d=_0x449a6c;_0xffaa8c[_0x3b58('0x34')]=_['keys'](db[_0x3b58('0x61')][_0x3b58('0x30')]);_0xffaa8c['query']=_['keys'](_0x2c2ad5[_0x3b58('0x35')]);_0xffaa8c[_0x3b58('0x3d')]=_[_0x3b58('0x37')](_0xffaa8c[_0x3b58('0x34')],_0xffaa8c[_0x3b58('0x35')]);_0x1a7d62[_0x3b58('0x38')]=_['intersection'](_0xffaa8c[_0x3b58('0x34')],qs['fields'](_0x2c2ad5[_0x3b58('0x35')]['fields']));_0x1a7d62['attributes']=_0x1a7d62[_0x3b58('0x38')][_0x3b58('0x47')]?_0x1a7d62[_0x3b58('0x38')]:_0xffaa8c[_0x3b58('0x34')];_0x1a7d62['order']=qs[_0x3b58('0x3b')](_0x2c2ad5[_0x3b58('0x35')][_0x3b58('0x3b')]);_0x1a7d62[_0x3b58('0x3c')]=qs['filters'](_[_0x3b58('0x5b')](_0x2c2ad5[_0x3b58('0x35')],_0xffaa8c[_0x3b58('0x3d')]));if(_0x2c2ad5[_0x3b58('0x35')][_0x3b58('0x3e')]){_0x1a7d62['where']=_[_0x3b58('0x3f')](_0x1a7d62[_0x3b58('0x3c')],{'$or':_[_0x3b58('0x2e')](_0x1a7d62['attributes'],function(_0x13f558){var _0x14bd62={};_0x14bd62[_0x13f558]={'$like':'%'+_0x2c2ad5[_0x3b58('0x35')]['filter']+'%'};return _0x14bd62;})});}_0x1a7d62=_[_0x3b58('0x3f')]({},_0x1a7d62,_0x2c2ad5[_0x3b58('0x40')]);return _0x3d218d[_0x3b58('0x60')](_0x1a7d62);}})[_0x3b58('0x28')](function(_0x2b06ac){if(_0x2b06ac){_0x4c55b1=_0x2b06ac[_0x3b58('0x47')];if(!_0x2c2ad5[_0x3b58('0x35')][_0x3b58('0x57')](_0x3b58('0x58'))){_0x1a7d62[_0x3b58('0x1e')]=qs[_0x3b58('0x1e')](_0x2c2ad5['query'][_0x3b58('0x1e')]);_0x1a7d62[_0x3b58('0x1b')]=qs[_0x3b58('0x1b')](_0x2c2ad5[_0x3b58('0x35')][_0x3b58('0x1b')]);}return _0x3d218d['getLists'](_0x1a7d62);}})[_0x3b58('0x28')](function(_0x4e4a6a){if(_0x4e4a6a){return _0x4e4a6a?{'count':_0x4c55b1,'rows':_0x4e4a6a}:null;}})['then'](respondWithResult(_0x5d88e0,null))['catch'](handleError(_0x5d88e0,null));};exports[_0x3b58('0x62')]=function(_0x1441fa,_0x2dd0e5,_0x2e2eee){var _0x1bfd7f,_0x35289f;return db[_0x3b58('0x2f')][_0x3b58('0x48')]({'where':{'id':_0x1441fa[_0x3b58('0x46')]['id']}})[_0x3b58('0x28')](handleEntityNotFound(_0x2dd0e5,null))['then'](function(_0x46c467){if(_0x46c467){_0x35289f=_0x46c467;return _0x46c467[_0x3b58('0x62')](_0x1441fa['body'][_0x3b58('0x63')],_[_0x3b58('0x52')](_0x1441fa[_0x3b58('0x4a')],[_0x3b58('0x63'),'id'])||{});}return null;})['spread'](function(_0x13bdb8){var _0x3b7bda;_0x1bfd7f=_0x13bdb8||[];var _0x3ac218=[];if(_0x13bdb8){for(var _0x57d22e=0x0;_0x57d22e<_0x13bdb8[_0x3b58('0x47')];_0x57d22e+=0x1){var _0x1c765b=_0x13bdb8[_0x57d22e][_0x3b58('0x25')]({'plain':!![]});_0x35289f['dialCheckDuplicateType']=_0x1441fa[_0x3b58('0x4a')][_0x3b58('0x64')]?_0x1441fa[_0x3b58('0x4a')][_0x3b58('0x64')]:_0x35289f['dialCheckDuplicateType'];switch(_0x35289f[_0x3b58('0x64')]){case'always':_0x3b7bda=squel[_0x3b58('0x65')]()[_0x3b58('0x66')](_0x3b58('0x67'))[_0x3b58('0x68')](['phone','scheduledAt',_0x3b58('0x69'),_0x3b58('0x6a'),'CampaignId',_0x3b58('0x6b'),_0x3b58('0x53')],squel['select']()[_0x3b58('0x6c')](_0x3b58('0x6d'),'phone')['field'](_0x3b58('0x6e'),_0x3b58('0x6f'))[_0x3b58('0x6c')]('id','ContactId')[_0x3b58('0x6c')](_0x1c765b[_0x3b58('0x70')][_0x3b58('0x71')](),_0x3b58('0x6a'))[_0x3b58('0x6c')](_0x1441fa[_0x3b58('0x46')]['id'][_0x3b58('0x71')](),'CampaignId')['field']('NOW()',_0x3b58('0x6b'))[_0x3b58('0x6c')](_0x3b58('0x6e'),_0x3b58('0x53'))['from'](_0x3b58('0x72'))['where'](_0x3b58('0x73'))['where'](_0x3b58('0x74'),_0x1c765b['CmListId'][_0x3b58('0x71')]())[_0x3b58('0x3c')](_0x3b58('0x75'))[_0x3b58('0x3c')](_0x3b58('0x76'),squel[_0x3b58('0x77')]()[_0x3b58('0x6c')]('COALESCE(calleridnum,\x27\x27)')[_0x3b58('0x78')](_0x3b58('0x79'))[_0x3b58('0x3c')](_0x3b58('0x7a'),_0x1441fa[_0x3b58('0x46')]['id'][_0x3b58('0x71')]()))[_0x3b58('0x3c')](_0x3b58('0x76'),squel[_0x3b58('0x77')]()[_0x3b58('0x6c')]('COALESCE(phone,\x27\x27)')[_0x3b58('0x78')](_0x3b58('0x67'))[_0x3b58('0x3c')](_0x3b58('0x7a'),_0x1441fa[_0x3b58('0x46')]['id'][_0x3b58('0x71')]())))[_0x3b58('0x71')]();break;case _0x3b58('0x7b'):_0x3b7bda=squel['insert']()['into'](_0x3b58('0x67'))[_0x3b58('0x68')]([_0x3b58('0x6d'),_0x3b58('0x6f'),_0x3b58('0x69'),'ListId',_0x3b58('0x59'),_0x3b58('0x6b'),_0x3b58('0x53')],squel['select']()[_0x3b58('0x6c')](_0x3b58('0x6d'),'phone')[_0x3b58('0x6c')](_0x3b58('0x6e'),_0x3b58('0x6f'))['field']('id',_0x3b58('0x69'))['field'](_0x1c765b[_0x3b58('0x70')][_0x3b58('0x71')](),'ListId')[_0x3b58('0x6c')](_0x1441fa[_0x3b58('0x46')]['id'][_0x3b58('0x71')](),_0x3b58('0x59'))[_0x3b58('0x6c')](_0x3b58('0x6e'),_0x3b58('0x6b'))['field'](_0x3b58('0x6e'),_0x3b58('0x53'))[_0x3b58('0x78')]('cm_contacts')[_0x3b58('0x3c')](_0x3b58('0x73'))[_0x3b58('0x3c')](_0x3b58('0x74'),_0x1c765b['CmListId']['toString']())['where'](_0x3b58('0x75'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x3b58('0x77')]()['field']('COALESCE(phone,\x27\x27)')[_0x3b58('0x78')](_0x3b58('0x67'))['where'](_0x3b58('0x7a'),_0x1441fa[_0x3b58('0x46')]['id']['toString']())))[_0x3b58('0x71')]();break;default:_0x3b7bda=squel['insert']()[_0x3b58('0x66')](_0x3b58('0x67'))[_0x3b58('0x68')](['phone','scheduledAt',_0x3b58('0x69'),_0x3b58('0x6a'),'CampaignId',_0x3b58('0x6b'),_0x3b58('0x53')],squel[_0x3b58('0x77')]()[_0x3b58('0x6c')](_0x3b58('0x6d'),'phone')[_0x3b58('0x6c')](_0x3b58('0x6e'),_0x3b58('0x6f'))[_0x3b58('0x6c')]('id',_0x3b58('0x69'))[_0x3b58('0x6c')](_0x1c765b['CmListId']['toString'](),_0x3b58('0x6a'))[_0x3b58('0x6c')](_0x1441fa[_0x3b58('0x46')]['id']['toString'](),_0x3b58('0x59'))[_0x3b58('0x6c')]('NOW()',_0x3b58('0x6b'))[_0x3b58('0x6c')]('NOW()',_0x3b58('0x53'))[_0x3b58('0x78')]('cm_contacts')['where'](_0x3b58('0x73'))[_0x3b58('0x3c')](_0x3b58('0x74'),_0x1c765b[_0x3b58('0x70')]['toString']())[_0x3b58('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x3b58('0x71')]();}_0x3ac218[_0x3b58('0x7c')](db[_0x3b58('0x7d')][_0x3b58('0x35')](_0x3b7bda));}return BPromise[_0x3b58('0x7e')](_0x3ac218);}})[_0x3b58('0x28')](function(){return _0x1bfd7f;})['then'](respondWithResult(_0x2dd0e5,null))[_0x3b58('0x45')](handleError(_0x2dd0e5,null));};exports[_0x3b58('0x7f')]=function(_0xe12bfa,_0x43c81f,_0x5eb016){return db[_0x3b58('0x2f')][_0x3b58('0x48')]({'where':{'id':_0xe12bfa[_0x3b58('0x46')]['id']}})[_0x3b58('0x28')](handleEntityNotFound(_0x43c81f,null))['then'](function(_0x57387c){if(_0x57387c){return _0x57387c[_0x3b58('0x7f')](_0xe12bfa[_0x3b58('0x35')][_0x3b58('0x63')]);}})[_0x3b58('0x28')](function(_0x439208){if(_0x439208){return db[_0x3b58('0x56')][_0x3b58('0x24')]({'where':{'ListId':_0xe12bfa[_0x3b58('0x35')][_0x3b58('0x63')],'CampaignId':_0xe12bfa['params']['id']}})[_0x3b58('0x28')](function(){return _0x439208;});}})[_0x3b58('0x28')](respondWithStatusCode(_0x43c81f,null))[_0x3b58('0x45')](handleError(_0x43c81f,null));};exports[_0x3b58('0x80')]=function(_0x6dc35c,_0xb629de,_0x5a9aba){var _0x539d14={};var _0x339a2b={};var _0xf10bfb;var _0x583782;return db[_0x3b58('0x2f')][_0x3b58('0x55')]({'where':{'id':_0x6dc35c[_0x3b58('0x46')]['id']}})[_0x3b58('0x28')](handleEntityNotFound(_0xb629de,null))[_0x3b58('0x28')](function(_0xfc12c1){if(_0xfc12c1){_0xf10bfb=_0xfc12c1;_0x339a2b[_0x3b58('0x34')]=_[_0x3b58('0x36')](db[_0x3b58('0x61')]['rawAttributes']);_0x339a2b[_0x3b58('0x35')]=_[_0x3b58('0x36')](_0x6dc35c['query']);_0x339a2b['filters']=_[_0x3b58('0x37')](_0x339a2b[_0x3b58('0x34')],_0x339a2b[_0x3b58('0x35')]);_0x539d14[_0x3b58('0x38')]=_[_0x3b58('0x37')](_0x339a2b[_0x3b58('0x34')],qs[_0x3b58('0x39')](_0x6dc35c[_0x3b58('0x35')][_0x3b58('0x39')]));_0x539d14['attributes']=_0x539d14[_0x3b58('0x38')]['length']?_0x539d14[_0x3b58('0x38')]:_0x339a2b[_0x3b58('0x34')];_0x539d14[_0x3b58('0x3a')]=qs[_0x3b58('0x3b')](_0x6dc35c[_0x3b58('0x35')]['sort']);_0x539d14[_0x3b58('0x3c')]=qs[_0x3b58('0x3d')](_['pick'](_0x6dc35c['query'],_0x339a2b[_0x3b58('0x3d')]));if(_0x6dc35c[_0x3b58('0x35')][_0x3b58('0x3e')]){_0x539d14[_0x3b58('0x3c')]=_[_0x3b58('0x3f')](_0x539d14[_0x3b58('0x3c')],{'$or':_[_0x3b58('0x2e')](_0x539d14[_0x3b58('0x38')],function(_0x3238a4){var _0x4f652c={};_0x4f652c[_0x3238a4]={'$like':'%'+_0x6dc35c['query'][_0x3b58('0x3e')]+'%'};return _0x4f652c;})});}_0x539d14=_['merge']({},_0x539d14,_0x6dc35c[_0x3b58('0x40')]);return _0xf10bfb[_0x3b58('0x80')](_0x539d14);}})[_0x3b58('0x28')](function(_0x4f001b){if(_0x4f001b){_0x583782=_0x4f001b['length'];if(!_0x6dc35c[_0x3b58('0x35')][_0x3b58('0x57')](_0x3b58('0x58'))){_0x539d14[_0x3b58('0x1e')]=qs[_0x3b58('0x1e')](_0x6dc35c[_0x3b58('0x35')][_0x3b58('0x1e')]);_0x539d14[_0x3b58('0x1b')]=qs[_0x3b58('0x1b')](_0x6dc35c[_0x3b58('0x35')][_0x3b58('0x1b')]);}return _0xf10bfb['getBlackLists'](_0x539d14);}})['then'](function(_0x30621b){if(_0x30621b){return _0x30621b?{'count':_0x583782,'rows':_0x30621b}:null;}})[_0x3b58('0x28')](respondWithResult(_0xb629de,null))[_0x3b58('0x45')](handleError(_0xb629de,null));};exports[_0x3b58('0x81')]=function(_0x4dc66e,_0x2f4fec,_0x4ac536){var _0x2e920c,_0x19dc4c;return db[_0x3b58('0x2f')]['find']({'where':{'id':_0x4dc66e['params']['id']}})['then'](handleEntityNotFound(_0x2f4fec,null))['then'](function(_0x4df684){if(_0x4df684){_0x19dc4c=_0x4df684;return _0x4df684[_0x3b58('0x81')](_0x4dc66e[_0x3b58('0x4a')]['ids'],_[_0x3b58('0x52')](_0x4dc66e[_0x3b58('0x4a')],[_0x3b58('0x63'),'id'])||{});}return null;})['spread'](function(_0x22b175){var _0x1a528a;_0x2e920c=_0x22b175||[];var _0x4e9995=[];if(_0x22b175){for(var _0x237a9e=0x0;_0x237a9e<_0x22b175[_0x3b58('0x47')];_0x237a9e+=0x1){var _0x49b4d9=_0x22b175[_0x237a9e]['get']({'plain':!![]});_0x1a528a=squel[_0x3b58('0x65')]()[_0x3b58('0x66')](_0x3b58('0x82'))[_0x3b58('0x68')]([_0x3b58('0x6d'),_0x3b58('0x69'),_0x3b58('0x6a'),_0x3b58('0x59'),_0x3b58('0x6b'),'updatedAt'],squel[_0x3b58('0x77')]()['field'](_0x3b58('0x6d'),'phone')['field']('id',_0x3b58('0x69'))['field'](_0x49b4d9[_0x3b58('0x70')][_0x3b58('0x71')](),'ListId')[_0x3b58('0x6c')](_0x4dc66e[_0x3b58('0x46')]['id']['toString'](),_0x3b58('0x59'))['field'](_0x3b58('0x6e'),_0x3b58('0x6b'))['field'](_0x3b58('0x6e'),'updatedAt')['from'](_0x3b58('0x72'))['where'](_0x3b58('0x73'))[_0x3b58('0x3c')](_0x3b58('0x74'),_0x49b4d9[_0x3b58('0x70')][_0x3b58('0x71')]())[_0x3b58('0x3c')](_0x3b58('0x75')))[_0x3b58('0x71')]();_0x4e9995['push'](db['sequelize']['query'](_0x1a528a));}return BPromise[_0x3b58('0x7e')](_0x4e9995);}})[_0x3b58('0x28')](function(){return _0x2e920c;})['then'](respondWithResult(_0x2f4fec,null))[_0x3b58('0x45')](handleError(_0x2f4fec,null));};exports[_0x3b58('0x83')]=function(_0x418208,_0x2e6cf6,_0x40ca6b){return db['Campaign']['find']({'where':{'id':_0x418208[_0x3b58('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e6cf6,null))[_0x3b58('0x28')](function(_0x19a7f7){if(_0x19a7f7){return _0x19a7f7[_0x3b58('0x83')](_0x418208[_0x3b58('0x35')][_0x3b58('0x63')]);}})['then'](function(_0x53900b){if(_0x53900b){return db[_0x3b58('0x5f')][_0x3b58('0x24')]({'where':{'ListId':_0x418208[_0x3b58('0x35')]['ids'],'CampaignId':_0x418208['params']['id']}})['then'](function(){return _0x53900b;});}})[_0x3b58('0x28')](respondWithStatusCode(_0x2e6cf6,null))[_0x3b58('0x45')](handleError(_0x2e6cf6,null));}; \ No newline at end of file +var _0xa418=['merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','clone','params','omit','updatedAt','body','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','pick','where','CampaignId','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','select','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','into','push','sequelize','all','ids','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','IvrCampaigns','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x20dace,_0xf23e25){var _0x4ccf52=function(_0x4de8ca){while(--_0x4de8ca){_0x20dace['push'](_0x20dace['shift']());}};_0x4ccf52(++_0xf23e25);}(_0xa418,0x14e));var _0x8a41=function(_0x15bf14,_0x1bf16e){_0x15bf14=_0x15bf14-0x0;var _0x4da42a=_0xa418[_0x15bf14];return _0x4da42a;};'use strict';var emlformat=require(_0x8a41('0x0'));var rimraf=require(_0x8a41('0x1'));var zipdir=require(_0x8a41('0x2'));var jsonpatch=require(_0x8a41('0x3'));var rp=require('request-promise');var moment=require(_0x8a41('0x4'));var BPromise=require(_0x8a41('0x5'));var Mustache=require(_0x8a41('0x6'));var util=require('util');var path=require(_0x8a41('0x7'));var sox=require(_0x8a41('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a41('0x9'));var _=require(_0x8a41('0xa'));var squel=require(_0x8a41('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a41('0xc'));var deskjs=require(_0x8a41('0xd'));var toCsv=require(_0x8a41('0xe'));var querystring=require(_0x8a41('0xf'));var Papa=require(_0x8a41('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a41('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8a41('0x12'));var config=require(_0x8a41('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x179a13,_0x477715){_0x477715=_0x477715||0xcc;return function(_0x2dcd32){if(_0x2dcd32){return _0x179a13[_0x8a41('0x14')](_0x477715);}return _0x179a13['status'](_0x477715)[_0x8a41('0x15')]();};}function respondWithResult(_0x2faafa,_0x4843e5){_0x4843e5=_0x4843e5||0xc8;return function(_0x39865d){if(_0x39865d){return _0x2faafa[_0x8a41('0x16')](_0x4843e5)[_0x8a41('0x17')](_0x39865d);}};}function respondWithFilteredResult(_0x1fc189,_0x5e4cfd){return function(_0x473669){if(_0x473669){var _0x57e786=typeof _0x5e4cfd[_0x8a41('0x18')]===_0x8a41('0x19')&&typeof _0x5e4cfd[_0x8a41('0x1a')]==='undefined';var _0x1fc621=_0x473669[_0x8a41('0x1b')];var _0x5da0cf=_0x57e786?0x0:_0x5e4cfd[_0x8a41('0x18')];var _0x4e092a=_0x57e786?_0x473669[_0x8a41('0x1b')]:_0x5e4cfd[_0x8a41('0x18')]+_0x5e4cfd[_0x8a41('0x1a')];var _0xb20c61;if(_0x4e092a>=_0x1fc621){_0x4e092a=_0x1fc621;_0xb20c61=0xc8;}else{_0xb20c61=0xce;}_0x1fc189[_0x8a41('0x16')](_0xb20c61);return _0x1fc189[_0x8a41('0x1c')](_0x8a41('0x1d'),_0x5da0cf+'-'+_0x4e092a+'/'+_0x1fc621)[_0x8a41('0x17')](_0x473669);}return null;};}function patchUpdates(_0x30e282){return function(_0x57346d){try{jsonpatch['apply'](_0x57346d,_0x30e282,!![]);}catch(_0xb3c4a5){return BPromise[_0x8a41('0x1e')](_0xb3c4a5);}return _0x57346d[_0x8a41('0x1f')]();};}function saveUpdates(_0x2a5233,_0x3fba8f){return function(_0x16584d){if(_0x16584d){return _0x16584d[_0x8a41('0x20')](_0x2a5233)[_0x8a41('0x21')](function(_0x1453f3){return _0x1453f3;});}return null;};}function removeEntity(_0x234890,_0x4c48ac){return function(_0x3230f7){if(_0x3230f7){return _0x3230f7[_0x8a41('0x22')]()[_0x8a41('0x21')](function(){var _0x5ad14b=_0x3230f7['get']({'plain':!![]});var _0x4885b9=_0x8a41('0x23');return db['UserProfileResource'][_0x8a41('0x22')]({'where':{'type':_0x4885b9,'resourceId':_0x5ad14b['id']}})['then'](function(){return _0x3230f7;});})[_0x8a41('0x21')](function(){_0x234890[_0x8a41('0x16')](0xcc)[_0x8a41('0x15')]();});}};}function handleEntityNotFound(_0x53ca9f,_0x51e4ba){return function(_0x32ee82){if(!_0x32ee82){_0x53ca9f[_0x8a41('0x14')](0x194);}return _0x32ee82;};}function handleError(_0x357167,_0x3bf6d3){_0x3bf6d3=_0x3bf6d3||0x1f4;return function(_0x28aad0){logger[_0x8a41('0x24')](_0x28aad0[_0x8a41('0x25')]);if(_0x28aad0[_0x8a41('0x26')]){delete _0x28aad0[_0x8a41('0x26')];}_0x357167[_0x8a41('0x16')](_0x3bf6d3)[_0x8a41('0x27')](_0x28aad0);};}exports[_0x8a41('0x28')]=function(_0x2ce97f,_0x48d5cc){var _0x2facb6={},_0x1d2e17={},_0x1dbb1b={'count':0x0,'rows':[]};var _0xdc8ac4=_[_0x8a41('0x29')](db[_0x8a41('0x2a')][_0x8a41('0x2b')],function(_0x1128e1){return{'name':_0x1128e1[_0x8a41('0x2c')],'type':_0x1128e1[_0x8a41('0x2d')][_0x8a41('0x2e')]};});_0x1d2e17['model']=_[_0x8a41('0x29')](_0xdc8ac4,_0x8a41('0x26'));_0x1d2e17[_0x8a41('0x2f')]=_['keys'](_0x2ce97f[_0x8a41('0x2f')]);_0x1d2e17[_0x8a41('0x30')]=_['intersection'](_0x1d2e17[_0x8a41('0x31')],_0x1d2e17[_0x8a41('0x2f')]);_0x2facb6[_0x8a41('0x32')]=_[_0x8a41('0x33')](_0x1d2e17[_0x8a41('0x31')],qs[_0x8a41('0x34')](_0x2ce97f[_0x8a41('0x2f')][_0x8a41('0x34')]));_0x2facb6[_0x8a41('0x32')]=_0x2facb6[_0x8a41('0x32')][_0x8a41('0x35')]?_0x2facb6[_0x8a41('0x32')]:_0x1d2e17['model'];if(!_0x2ce97f['query'][_0x8a41('0x36')](_0x8a41('0x37'))){_0x2facb6['limit']=qs[_0x8a41('0x1a')](_0x2ce97f[_0x8a41('0x2f')]['limit']);_0x2facb6[_0x8a41('0x18')]=qs['offset'](_0x2ce97f[_0x8a41('0x2f')][_0x8a41('0x18')]);}_0x2facb6[_0x8a41('0x38')]=qs[_0x8a41('0x39')](_0x2ce97f[_0x8a41('0x2f')][_0x8a41('0x39')]);_0x2facb6['where']=qs[_0x8a41('0x30')](_['pick'](_0x2ce97f[_0x8a41('0x2f')],_0x1d2e17[_0x8a41('0x30')]),_0xdc8ac4);if(_0x2ce97f[_0x8a41('0x2f')][_0x8a41('0x3a')]){_0x2facb6['where']=_[_0x8a41('0x3b')](_0x2facb6['where'],{'$or':_[_0x8a41('0x29')](_0xdc8ac4,function(_0x1f1295){if(_0x1f1295[_0x8a41('0x2d')]!==_0x8a41('0x3c')){var _0x5aade8={};_0x5aade8[_0x1f1295[_0x8a41('0x26')]]={'$like':'%'+_0x2ce97f['query'][_0x8a41('0x3a')]+'%'};return _0x5aade8;}})});}_0x2facb6=_[_0x8a41('0x3b')]({},_0x2facb6,_0x2ce97f['options']);var _0x3a269e={'where':_0x2facb6['where']};return db['Campaign'][_0x8a41('0x1b')](_0x3a269e)[_0x8a41('0x21')](function(_0x36458c){_0x1dbb1b['count']=_0x36458c;if(_0x2ce97f[_0x8a41('0x2f')][_0x8a41('0x3d')]){_0x2facb6[_0x8a41('0x3e')]=[{'all':!![]}];}return db[_0x8a41('0x2a')][_0x8a41('0x3f')](_0x2facb6);})[_0x8a41('0x21')](function(_0x4b198e){_0x1dbb1b[_0x8a41('0x40')]=_0x4b198e;return _0x1dbb1b;})[_0x8a41('0x21')](respondWithFilteredResult(_0x48d5cc,_0x2facb6))['catch'](handleError(_0x48d5cc,null));};exports[_0x8a41('0x41')]=function(_0x5aaa77,_0xc246ab){var _0x882072={'raw':![],'where':{'id':_0x5aaa77['params']['id']}},_0x3cd0cf={};_0x3cd0cf[_0x8a41('0x31')]=_[_0x8a41('0x42')](db[_0x8a41('0x2a')][_0x8a41('0x2b')]);_0x3cd0cf['query']=_[_0x8a41('0x42')](_0x5aaa77[_0x8a41('0x2f')]);_0x3cd0cf[_0x8a41('0x30')]=_[_0x8a41('0x33')](_0x3cd0cf['model'],_0x3cd0cf['query']);_0x882072[_0x8a41('0x32')]=_[_0x8a41('0x33')](_0x3cd0cf['model'],qs[_0x8a41('0x34')](_0x5aaa77[_0x8a41('0x2f')][_0x8a41('0x34')]));_0x882072[_0x8a41('0x32')]=_0x882072[_0x8a41('0x32')][_0x8a41('0x35')]?_0x882072['attributes']:_0x3cd0cf[_0x8a41('0x31')];if(_0x5aaa77[_0x8a41('0x2f')][_0x8a41('0x3d')]){_0x882072[_0x8a41('0x3e')]=[{'all':!![]}];}_0x882072=_[_0x8a41('0x3b')]({},_0x882072,_0x5aaa77[_0x8a41('0x43')]);return db['Campaign']['find'](_0x882072)[_0x8a41('0x21')](handleEntityNotFound(_0xc246ab,null))[_0x8a41('0x21')](respondWithResult(_0xc246ab,null))[_0x8a41('0x44')](handleError(_0xc246ab,null));};exports[_0x8a41('0x45')]=function(_0x1e645,_0x5d780e){return db[_0x8a41('0x2a')][_0x8a41('0x45')](_0x1e645['body'],{})[_0x8a41('0x21')](function(_0x3d5891){var _0x290036=_0x1e645[_0x8a41('0x46')][_0x8a41('0x47')]({'plain':!![]});if(!_0x290036)throw new Error(_0x8a41('0x48'));if(_0x290036[_0x8a41('0x49')]===_0x8a41('0x46')){var _0x58f6d3=_0x3d5891[_0x8a41('0x47')]({'plain':!![]});var _0x427cc2=_0x8a41('0x23');return db[_0x8a41('0x4a')][_0x8a41('0x4b')]({'where':{'name':_0x427cc2,'userProfileId':_0x290036[_0x8a41('0x4c')]},'raw':!![]})[_0x8a41('0x21')](function(_0x4cf439){if(_0x4cf439&&_0x4cf439[_0x8a41('0x4d')]===0x0){return db[_0x8a41('0x4e')][_0x8a41('0x45')]({'name':_0x58f6d3[_0x8a41('0x26')],'resourceId':_0x58f6d3['id'],'type':_0x4cf439[_0x8a41('0x26')],'sectionId':_0x4cf439['id']},{})[_0x8a41('0x21')](function(){return _0x3d5891;});}else{return _0x3d5891;}})[_0x8a41('0x44')](function(_0x3e4ac0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e4ac0);throw _0x3e4ac0;});}return _0x3d5891;})['then'](respondWithResult(_0x5d780e,0xc9))[_0x8a41('0x44')](handleError(_0x5d780e,null));};exports[_0x8a41('0x4f')]=function(_0x3b6047,_0x2d4dd2){var _0x497ae3={'where':{'id':_0x3b6047[_0x8a41('0x50')]['id']}},_0x2791c6={};_0x2791c6[_0x8a41('0x31')]=_['keys'](db[_0x8a41('0x2a')][_0x8a41('0x2b')]);_0x497ae3[_0x8a41('0x32')]=_['intersection'](_0x2791c6['model'],qs[_0x8a41('0x34')](_0x3b6047[_0x8a41('0x2f')][_0x8a41('0x34')]));_0x497ae3[_0x8a41('0x32')]=_0x497ae3[_0x8a41('0x32')][_0x8a41('0x35')]?_0x497ae3['attributes']:_0x2791c6['model'];if(_0x3b6047[_0x8a41('0x2f')][_0x8a41('0x3d')]){_0x497ae3[_0x8a41('0x3e')]=[{'all':!![]}];}_0x497ae3=_[_0x8a41('0x3b')]({},_0x497ae3,_0x3b6047[_0x8a41('0x43')]);return db[_0x8a41('0x2a')][_0x8a41('0x4b')](_0x497ae3)['then'](handleEntityNotFound(_0x2d4dd2,null))[_0x8a41('0x21')](function(_0x1f075d){if(_0x1f075d){var _0x482de4=_0x1f075d[_0x8a41('0x47')]({'plain':!![]});_0x482de4=qs[_0x8a41('0x51')](_0x482de4,['id','createdAt',_0x8a41('0x52')]);_0x3b6047[_0x8a41('0x53')]=_[_0x8a41('0x51')](_0x3b6047[_0x8a41('0x53')],['id',_0x8a41('0x54'),_0x8a41('0x52')]);return db['Campaign'][_0x8a41('0x45')](_[_0x8a41('0x3b')](_0x482de4,_0x3b6047[_0x8a41('0x53')]),{'include':_0x3b6047[_0x8a41('0x2f')][_0x8a41('0x3d')]?[{'all':!![]}]:undefined})[_0x8a41('0x21')](function(_0x13de31){var _0x131909=_0x3b6047[_0x8a41('0x46')]['get']({'plain':!![]});if(!_0x131909)throw new Error(_0x8a41('0x48'));if(_0x131909[_0x8a41('0x49')]==='user'){var _0x3c3f0e=_0x13de31['get']({'plain':!![]});var _0x1dc8cd=_0x8a41('0x23');return db['UserProfileSection'][_0x8a41('0x4b')]({'where':{'name':_0x1dc8cd,'userProfileId':_0x131909[_0x8a41('0x4c')]},'raw':!![]})[_0x8a41('0x21')](function(_0x43ab2a){if(_0x43ab2a&&_0x43ab2a[_0x8a41('0x4d')]===0x0){return db[_0x8a41('0x4e')][_0x8a41('0x45')]({'name':_0x3c3f0e['name'],'resourceId':_0x3c3f0e['id'],'type':_0x43ab2a[_0x8a41('0x26')],'sectionId':_0x43ab2a['id']},{})[_0x8a41('0x21')](function(){return _0x13de31;});}else{return _0x13de31;}})[_0x8a41('0x44')](function(_0x3dfc11){logger[_0x8a41('0x24')](_0x8a41('0x55'),_0x3dfc11);throw _0x3dfc11;});}return _0x13de31;});}})['then'](respondWithResult(_0x2d4dd2,0xc9))[_0x8a41('0x44')](handleError(_0x2d4dd2,null));};exports[_0x8a41('0x20')]=function(_0x1aa8cb,_0x14a668){if(_0x1aa8cb[_0x8a41('0x53')]['id']){delete _0x1aa8cb[_0x8a41('0x53')]['id'];}return db[_0x8a41('0x2a')][_0x8a41('0x4b')]({'where':{'id':_0x1aa8cb[_0x8a41('0x50')]['id']}})['then'](handleEntityNotFound(_0x14a668,null))[_0x8a41('0x21')](saveUpdates(_0x1aa8cb[_0x8a41('0x53')],null))[_0x8a41('0x21')](respondWithResult(_0x14a668,null))['catch'](handleError(_0x14a668,null));};exports[_0x8a41('0x22')]=function(_0x257954,_0x5bf899){return db[_0x8a41('0x2a')]['find']({'where':{'id':_0x257954[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x5bf899,null))['then'](removeEntity(_0x5bf899,null))[_0x8a41('0x44')](handleError(_0x5bf899,null));};exports['getHoppers']=function(_0x5714b7,_0x47b1de,_0x2580c5){var _0xfa9996={'raw':!![],'where':{}};var _0x323e8e={};var _0x3befec={'count':0x0,'rows':[]};return db[_0x8a41('0x2a')][_0x8a41('0x56')]({'where':{'id':_0x5714b7[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x47b1de,null))[_0x8a41('0x21')](function(_0xf68562){if(_0xf68562){_0x323e8e[_0x8a41('0x31')]=_['keys'](db[_0x8a41('0x57')][_0x8a41('0x2b')]);_0x323e8e[_0x8a41('0x2f')]=_[_0x8a41('0x42')](_0x5714b7[_0x8a41('0x2f')]);_0x323e8e[_0x8a41('0x30')]=_[_0x8a41('0x33')](_0x323e8e[_0x8a41('0x31')],_0x323e8e[_0x8a41('0x2f')]);_0xfa9996[_0x8a41('0x32')]=_[_0x8a41('0x33')](_0x323e8e[_0x8a41('0x31')],qs[_0x8a41('0x34')](_0x5714b7['query'][_0x8a41('0x34')]));_0xfa9996['attributes']=_0xfa9996['attributes'][_0x8a41('0x35')]?_0xfa9996[_0x8a41('0x32')]:_0x323e8e[_0x8a41('0x31')];if(!_0x5714b7['query']['hasOwnProperty'](_0x8a41('0x37'))){_0xfa9996['limit']=qs['limit'](_0x5714b7[_0x8a41('0x2f')][_0x8a41('0x1a')]);_0xfa9996[_0x8a41('0x18')]=qs['offset'](_0x5714b7[_0x8a41('0x2f')][_0x8a41('0x18')]);}_0xfa9996[_0x8a41('0x38')]=qs[_0x8a41('0x39')](_0x5714b7[_0x8a41('0x2f')][_0x8a41('0x39')]);_0xfa9996['where']=qs[_0x8a41('0x30')](_[_0x8a41('0x58')](_0x5714b7[_0x8a41('0x2f')],_0x323e8e[_0x8a41('0x30')]));_0xfa9996[_0x8a41('0x59')][_0x8a41('0x5a')]=_0xf68562['id'];if(_0x5714b7['query'][_0x8a41('0x3a')]){_0xfa9996[_0x8a41('0x59')]=_[_0x8a41('0x3b')](_0xfa9996[_0x8a41('0x59')],{'$or':_['map'](_0xfa9996[_0x8a41('0x32')],function(_0x2c183f){var _0x516ca5={};_0x516ca5[_0x2c183f]={'$like':'%'+_0x5714b7[_0x8a41('0x2f')][_0x8a41('0x3a')]+'%'};return _0x516ca5;})});}_0xfa9996=_[_0x8a41('0x3b')]({},_0xfa9996,_0x5714b7[_0x8a41('0x43')]);return db[_0x8a41('0x57')]['count']({'where':_0xfa9996[_0x8a41('0x59')]})[_0x8a41('0x21')](function(_0x2a7039){_0x3befec[_0x8a41('0x1b')]=_0x2a7039;if(_0x5714b7[_0x8a41('0x2f')][_0x8a41('0x3d')]){_0xfa9996['include']=[{'all':!![]}];}return db['CmHopper'][_0x8a41('0x3f')](_0xfa9996);})[_0x8a41('0x21')](function(_0x12dddb){_0x3befec[_0x8a41('0x40')]=_0x12dddb;return _0x3befec;});}})[_0x8a41('0x21')](respondWithFilteredResult(_0x47b1de,_0xfa9996))[_0x8a41('0x44')](handleError(_0x47b1de,null));};exports['getHopperHistories']=function(_0x130b71,_0x46acac,_0x2bfa4){var _0x1f644f={'raw':!![],'where':{}};var _0x26eca3={};var _0x2672df={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x130b71[_0x8a41('0x50')]['id']}})['then'](handleEntityNotFound(_0x46acac,null))['then'](function(_0x2f9e4b){if(_0x2f9e4b){_0x26eca3[_0x8a41('0x31')]=_['keys'](db['CmHopperHistory'][_0x8a41('0x2b')]);_0x26eca3[_0x8a41('0x2f')]=_['keys'](_0x130b71[_0x8a41('0x2f')]);_0x26eca3[_0x8a41('0x30')]=_['intersection'](_0x26eca3[_0x8a41('0x31')],_0x26eca3[_0x8a41('0x2f')]);_0x1f644f[_0x8a41('0x32')]=_[_0x8a41('0x33')](_0x26eca3[_0x8a41('0x31')],qs[_0x8a41('0x34')](_0x130b71[_0x8a41('0x2f')][_0x8a41('0x34')]));_0x1f644f[_0x8a41('0x32')]=_0x1f644f[_0x8a41('0x32')][_0x8a41('0x35')]?_0x1f644f['attributes']:_0x26eca3['model'];if(!_0x130b71[_0x8a41('0x2f')][_0x8a41('0x36')](_0x8a41('0x37'))){_0x1f644f[_0x8a41('0x1a')]=qs[_0x8a41('0x1a')](_0x130b71[_0x8a41('0x2f')][_0x8a41('0x1a')]);_0x1f644f['offset']=qs['offset'](_0x130b71[_0x8a41('0x2f')][_0x8a41('0x18')]);}_0x1f644f[_0x8a41('0x38')]=qs[_0x8a41('0x39')](_0x130b71[_0x8a41('0x2f')][_0x8a41('0x39')]);_0x1f644f[_0x8a41('0x59')]=qs[_0x8a41('0x30')](_[_0x8a41('0x58')](_0x130b71[_0x8a41('0x2f')],_0x26eca3[_0x8a41('0x30')]));_0x1f644f['where']['CampaignId']=_0x2f9e4b['id'];if(_0x130b71[_0x8a41('0x2f')][_0x8a41('0x3a')]){_0x1f644f[_0x8a41('0x59')]=_['merge'](_0x1f644f[_0x8a41('0x59')],{'$or':_['map'](_0x1f644f['attributes'],function(_0x11cea0){var _0x438318={};_0x438318[_0x11cea0]={'$like':'%'+_0x130b71[_0x8a41('0x2f')][_0x8a41('0x3a')]+'%'};return _0x438318;})});}_0x1f644f=_[_0x8a41('0x3b')]({},_0x1f644f,_0x130b71[_0x8a41('0x43')]);return db[_0x8a41('0x5b')][_0x8a41('0x1b')]({'where':_0x1f644f['where']})[_0x8a41('0x21')](function(_0x5c8e7f){_0x2672df['count']=_0x5c8e7f;if(_0x130b71[_0x8a41('0x2f')]['includeAll']){_0x1f644f[_0x8a41('0x3e')]=[{'all':!![]}];}return db[_0x8a41('0x5b')][_0x8a41('0x3f')](_0x1f644f);})['then'](function(_0x1639f8){_0x2672df['rows']=_0x1639f8;return _0x2672df;});}})[_0x8a41('0x21')](respondWithFilteredResult(_0x46acac,_0x1f644f))[_0x8a41('0x44')](handleError(_0x46acac,null));};exports['getHopperFinals']=function(_0x574085,_0x45d669,_0x1de92c){var _0x172883={'raw':!![],'where':{}};var _0x25bb58={};var _0x9e08be={'count':0x0,'rows':[]};return db[_0x8a41('0x2a')][_0x8a41('0x56')]({'where':{'id':_0x574085[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x45d669,null))[_0x8a41('0x21')](function(_0x1260e8){if(_0x1260e8){_0x25bb58[_0x8a41('0x31')]=_[_0x8a41('0x42')](db['CmHopperFinal'][_0x8a41('0x2b')]);_0x25bb58[_0x8a41('0x2f')]=_['keys'](_0x574085[_0x8a41('0x2f')]);_0x25bb58['filters']=_[_0x8a41('0x33')](_0x25bb58[_0x8a41('0x31')],_0x25bb58[_0x8a41('0x2f')]);_0x172883[_0x8a41('0x32')]=_[_0x8a41('0x33')](_0x25bb58['model'],qs[_0x8a41('0x34')](_0x574085[_0x8a41('0x2f')][_0x8a41('0x34')]));_0x172883[_0x8a41('0x32')]=_0x172883[_0x8a41('0x32')][_0x8a41('0x35')]?_0x172883[_0x8a41('0x32')]:_0x25bb58[_0x8a41('0x31')];if(!_0x574085[_0x8a41('0x2f')]['hasOwnProperty'](_0x8a41('0x37'))){_0x172883[_0x8a41('0x1a')]=qs['limit'](_0x574085[_0x8a41('0x2f')]['limit']);_0x172883[_0x8a41('0x18')]=qs[_0x8a41('0x18')](_0x574085[_0x8a41('0x2f')][_0x8a41('0x18')]);}_0x172883[_0x8a41('0x38')]=qs[_0x8a41('0x39')](_0x574085[_0x8a41('0x2f')][_0x8a41('0x39')]);_0x172883[_0x8a41('0x59')]=qs[_0x8a41('0x30')](_[_0x8a41('0x58')](_0x574085[_0x8a41('0x2f')],_0x25bb58[_0x8a41('0x30')]));_0x172883[_0x8a41('0x59')][_0x8a41('0x5a')]=_0x1260e8['id'];if(_0x574085[_0x8a41('0x2f')][_0x8a41('0x3a')]){_0x172883['where']=_[_0x8a41('0x3b')](_0x172883[_0x8a41('0x59')],{'$or':_[_0x8a41('0x29')](_0x172883[_0x8a41('0x32')],function(_0x172893){var _0x56c9e6={};_0x56c9e6[_0x172893]={'$like':'%'+_0x574085[_0x8a41('0x2f')][_0x8a41('0x3a')]+'%'};return _0x56c9e6;})});}_0x172883=_[_0x8a41('0x3b')]({},_0x172883,_0x574085[_0x8a41('0x43')]);return db[_0x8a41('0x5c')][_0x8a41('0x1b')]({'where':_0x172883[_0x8a41('0x59')]})[_0x8a41('0x21')](function(_0xe65db0){_0x9e08be[_0x8a41('0x1b')]=_0xe65db0;if(_0x574085['query'][_0x8a41('0x3d')]){_0x172883['include']=[{'all':!![]}];}return db[_0x8a41('0x5c')][_0x8a41('0x3f')](_0x172883);})[_0x8a41('0x21')](function(_0x7e408d){_0x9e08be[_0x8a41('0x40')]=_0x7e408d;return _0x9e08be;});}})[_0x8a41('0x21')](respondWithFilteredResult(_0x45d669,_0x172883))[_0x8a41('0x44')](handleError(_0x45d669,null));};exports['getHopperBlacks']=function(_0x52e5f5,_0x3ac221,_0x3c7fe7){var _0x3492df={'raw':!![],'where':{}};var _0x4720ca={};var _0x3f7b6e={'count':0x0,'rows':[]};return db[_0x8a41('0x2a')][_0x8a41('0x56')]({'where':{'id':_0x52e5f5[_0x8a41('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ac221,null))[_0x8a41('0x21')](function(_0x30d2f6){if(_0x30d2f6){_0x4720ca[_0x8a41('0x31')]=_[_0x8a41('0x42')](db[_0x8a41('0x5d')][_0x8a41('0x2b')]);_0x4720ca[_0x8a41('0x2f')]=_[_0x8a41('0x42')](_0x52e5f5[_0x8a41('0x2f')]);_0x4720ca[_0x8a41('0x30')]=_['intersection'](_0x4720ca[_0x8a41('0x31')],_0x4720ca[_0x8a41('0x2f')]);_0x3492df['attributes']=_[_0x8a41('0x33')](_0x4720ca['model'],qs[_0x8a41('0x34')](_0x52e5f5['query'][_0x8a41('0x34')]));_0x3492df[_0x8a41('0x32')]=_0x3492df[_0x8a41('0x32')]['length']?_0x3492df[_0x8a41('0x32')]:_0x4720ca[_0x8a41('0x31')];if(!_0x52e5f5[_0x8a41('0x2f')][_0x8a41('0x36')](_0x8a41('0x37'))){_0x3492df[_0x8a41('0x1a')]=qs[_0x8a41('0x1a')](_0x52e5f5[_0x8a41('0x2f')][_0x8a41('0x1a')]);_0x3492df[_0x8a41('0x18')]=qs[_0x8a41('0x18')](_0x52e5f5[_0x8a41('0x2f')][_0x8a41('0x18')]);}_0x3492df[_0x8a41('0x38')]=qs[_0x8a41('0x39')](_0x52e5f5[_0x8a41('0x2f')][_0x8a41('0x39')]);_0x3492df[_0x8a41('0x59')]=qs[_0x8a41('0x30')](_['pick'](_0x52e5f5['query'],_0x4720ca['filters']));_0x3492df[_0x8a41('0x59')][_0x8a41('0x5a')]=_0x30d2f6['id'];if(_0x52e5f5[_0x8a41('0x2f')]['filter']){_0x3492df[_0x8a41('0x59')]=_[_0x8a41('0x3b')](_0x3492df['where'],{'$or':_[_0x8a41('0x29')](_0x3492df[_0x8a41('0x32')],function(_0x4a06be){var _0xadd953={};_0xadd953[_0x4a06be]={'$like':'%'+_0x52e5f5[_0x8a41('0x2f')][_0x8a41('0x3a')]+'%'};return _0xadd953;})});}_0x3492df=_[_0x8a41('0x3b')]({},_0x3492df,_0x52e5f5[_0x8a41('0x43')]);return db[_0x8a41('0x5d')]['count']({'where':_0x3492df[_0x8a41('0x59')]})[_0x8a41('0x21')](function(_0x20217f){_0x3f7b6e['count']=_0x20217f;if(_0x52e5f5[_0x8a41('0x2f')][_0x8a41('0x3d')]){_0x3492df[_0x8a41('0x3e')]=[{'all':!![]}];}return db[_0x8a41('0x5d')]['findAll'](_0x3492df);})[_0x8a41('0x21')](function(_0xe64f2){_0x3f7b6e[_0x8a41('0x40')]=_0xe64f2;return _0x3f7b6e;});}})['then'](respondWithFilteredResult(_0x3ac221,_0x3492df))[_0x8a41('0x44')](handleError(_0x3ac221,null));};exports[_0x8a41('0x5e')]=function(_0x7905f5,_0x524a34,_0x119704){var _0x3e3dff={};var _0x13ed90={};var _0x17fceb;var _0x2999cf;return db[_0x8a41('0x2a')][_0x8a41('0x56')]({'where':{'id':_0x7905f5['params']['id']}})['then'](handleEntityNotFound(_0x524a34,null))[_0x8a41('0x21')](function(_0x25afa9){if(_0x25afa9){_0x17fceb=_0x25afa9;_0x13ed90[_0x8a41('0x31')]=_['keys'](db[_0x8a41('0x5f')]['rawAttributes']);_0x13ed90['query']=_[_0x8a41('0x42')](_0x7905f5[_0x8a41('0x2f')]);_0x13ed90['filters']=_[_0x8a41('0x33')](_0x13ed90[_0x8a41('0x31')],_0x13ed90[_0x8a41('0x2f')]);_0x3e3dff[_0x8a41('0x32')]=_[_0x8a41('0x33')](_0x13ed90[_0x8a41('0x31')],qs[_0x8a41('0x34')](_0x7905f5[_0x8a41('0x2f')]['fields']));_0x3e3dff[_0x8a41('0x32')]=_0x3e3dff['attributes']['length']?_0x3e3dff[_0x8a41('0x32')]:_0x13ed90[_0x8a41('0x31')];_0x3e3dff[_0x8a41('0x38')]=qs['sort'](_0x7905f5[_0x8a41('0x2f')]['sort']);_0x3e3dff[_0x8a41('0x59')]=qs['filters'](_[_0x8a41('0x58')](_0x7905f5['query'],_0x13ed90['filters']));if(_0x7905f5[_0x8a41('0x2f')][_0x8a41('0x3a')]){_0x3e3dff[_0x8a41('0x59')]=_[_0x8a41('0x3b')](_0x3e3dff[_0x8a41('0x59')],{'$or':_[_0x8a41('0x29')](_0x3e3dff[_0x8a41('0x32')],function(_0x3e5d5d){var _0x584f7c={};_0x584f7c[_0x3e5d5d]={'$like':'%'+_0x7905f5[_0x8a41('0x2f')]['filter']+'%'};return _0x584f7c;})});}_0x3e3dff=_['merge']({},_0x3e3dff,_0x7905f5[_0x8a41('0x43')]);return _0x17fceb[_0x8a41('0x5e')](_0x3e3dff);}})[_0x8a41('0x21')](function(_0x2433fd){if(_0x2433fd){_0x2999cf=_0x2433fd['length'];if(!_0x7905f5['query'][_0x8a41('0x36')](_0x8a41('0x37'))){_0x3e3dff[_0x8a41('0x1a')]=qs[_0x8a41('0x1a')](_0x7905f5[_0x8a41('0x2f')]['limit']);_0x3e3dff['offset']=qs[_0x8a41('0x18')](_0x7905f5[_0x8a41('0x2f')][_0x8a41('0x18')]);}return _0x17fceb[_0x8a41('0x5e')](_0x3e3dff);}})[_0x8a41('0x21')](function(_0xb43052){if(_0xb43052){return _0xb43052?{'count':_0x2999cf,'rows':_0xb43052}:null;}})[_0x8a41('0x21')](respondWithResult(_0x524a34,null))[_0x8a41('0x44')](handleError(_0x524a34,null));};exports['addLists']=function(_0xd02357,_0x49053d,_0x2a6c52){var _0x4fd7d0,_0x40c9a4;return db[_0x8a41('0x2a')][_0x8a41('0x4b')]({'where':{'id':_0xd02357[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x49053d,null))['then'](function(_0x352102){if(_0x352102){_0x40c9a4=_0x352102;return _0x352102[_0x8a41('0x60')](_0xd02357[_0x8a41('0x53')]['ids'],_[_0x8a41('0x51')](_0xd02357[_0x8a41('0x53')],['ids','id'])||{});}return null;})[_0x8a41('0x61')](function(_0x46a2ac){var _0x2721df;_0x4fd7d0=_0x46a2ac||[];var _0x410f39=[];if(_0x46a2ac){for(var _0x3f0173=0x0;_0x3f0173<_0x46a2ac[_0x8a41('0x35')];_0x3f0173+=0x1){var _0x2f62c2=_0x46a2ac[_0x3f0173]['get']({'plain':!![]});_0x40c9a4['dialCheckDuplicateType']=_0xd02357[_0x8a41('0x53')][_0x8a41('0x62')]?_0xd02357[_0x8a41('0x53')][_0x8a41('0x62')]:_0x40c9a4[_0x8a41('0x62')];switch(_0x40c9a4['dialCheckDuplicateType']){case _0x8a41('0x63'):_0x2721df=squel[_0x8a41('0x64')]()['into'](_0x8a41('0x65'))[_0x8a41('0x66')]([_0x8a41('0x67'),_0x8a41('0x68'),_0x8a41('0x69'),_0x8a41('0x6a'),_0x8a41('0x5a'),_0x8a41('0x54'),'updatedAt'],squel['select']()[_0x8a41('0x6b')](_0x8a41('0x67'),_0x8a41('0x67'))[_0x8a41('0x6b')](_0x8a41('0x6c'),_0x8a41('0x68'))[_0x8a41('0x6b')]('id',_0x8a41('0x69'))[_0x8a41('0x6b')](_0x2f62c2[_0x8a41('0x6d')][_0x8a41('0x6e')](),'ListId')[_0x8a41('0x6b')](_0xd02357['params']['id'][_0x8a41('0x6e')](),_0x8a41('0x5a'))[_0x8a41('0x6b')](_0x8a41('0x6c'),_0x8a41('0x54'))[_0x8a41('0x6b')](_0x8a41('0x6c'),_0x8a41('0x52'))[_0x8a41('0x6f')](_0x8a41('0x70'))[_0x8a41('0x59')]('deletedAt\x20IS\x20NULL')[_0x8a41('0x59')]('ListId\x20=\x20?',_0x2f62c2[_0x8a41('0x6d')][_0x8a41('0x6e')]())['where'](_0x8a41('0x71'))['where'](_0x8a41('0x72'),squel['select']()['field'](_0x8a41('0x73'))['from'](_0x8a41('0x74'))[_0x8a41('0x59')]('CampaignId\x20=\x20?',_0xd02357[_0x8a41('0x50')]['id'][_0x8a41('0x6e')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x8a41('0x75')]()['field'](_0x8a41('0x76'))['from'](_0x8a41('0x65'))[_0x8a41('0x59')](_0x8a41('0x77'),_0xd02357[_0x8a41('0x50')]['id']['toString']())))[_0x8a41('0x6e')]();break;case _0x8a41('0x78'):_0x2721df=squel['insert']()['into'](_0x8a41('0x65'))[_0x8a41('0x66')]([_0x8a41('0x67'),_0x8a41('0x68'),_0x8a41('0x69'),_0x8a41('0x6a'),'CampaignId',_0x8a41('0x54'),_0x8a41('0x52')],squel['select']()[_0x8a41('0x6b')](_0x8a41('0x67'),_0x8a41('0x67'))['field'](_0x8a41('0x6c'),_0x8a41('0x68'))[_0x8a41('0x6b')]('id',_0x8a41('0x69'))[_0x8a41('0x6b')](_0x2f62c2['CmListId']['toString'](),_0x8a41('0x6a'))['field'](_0xd02357[_0x8a41('0x50')]['id'][_0x8a41('0x6e')](),_0x8a41('0x5a'))[_0x8a41('0x6b')](_0x8a41('0x6c'),_0x8a41('0x54'))[_0x8a41('0x6b')](_0x8a41('0x6c'),_0x8a41('0x52'))[_0x8a41('0x6f')](_0x8a41('0x70'))['where'](_0x8a41('0x79'))[_0x8a41('0x59')](_0x8a41('0x7a'),_0x2f62c2['CmListId']['toString']())[_0x8a41('0x59')]('phone\x20IS\x20NOT\x20NULL')[_0x8a41('0x59')](_0x8a41('0x72'),squel[_0x8a41('0x75')]()[_0x8a41('0x6b')](_0x8a41('0x76'))[_0x8a41('0x6f')](_0x8a41('0x65'))[_0x8a41('0x59')](_0x8a41('0x77'),_0xd02357[_0x8a41('0x50')]['id'][_0x8a41('0x6e')]())))[_0x8a41('0x6e')]();break;default:_0x2721df=squel[_0x8a41('0x64')]()[_0x8a41('0x7b')]('cm_hopper')[_0x8a41('0x66')]([_0x8a41('0x67'),_0x8a41('0x68'),'ContactId',_0x8a41('0x6a'),_0x8a41('0x5a'),_0x8a41('0x54'),'updatedAt'],squel[_0x8a41('0x75')]()[_0x8a41('0x6b')](_0x8a41('0x67'),'phone')['field'](_0x8a41('0x6c'),_0x8a41('0x68'))[_0x8a41('0x6b')]('id',_0x8a41('0x69'))[_0x8a41('0x6b')](_0x2f62c2[_0x8a41('0x6d')][_0x8a41('0x6e')](),_0x8a41('0x6a'))[_0x8a41('0x6b')](_0xd02357[_0x8a41('0x50')]['id'][_0x8a41('0x6e')](),_0x8a41('0x5a'))[_0x8a41('0x6b')]('NOW()',_0x8a41('0x54'))[_0x8a41('0x6b')]('NOW()',_0x8a41('0x52'))[_0x8a41('0x6f')](_0x8a41('0x70'))['where'](_0x8a41('0x79'))[_0x8a41('0x59')](_0x8a41('0x7a'),_0x2f62c2['CmListId']['toString']())[_0x8a41('0x59')](_0x8a41('0x71')))['toString']();}_0x410f39[_0x8a41('0x7c')](db[_0x8a41('0x7d')][_0x8a41('0x2f')](_0x2721df));}return BPromise[_0x8a41('0x7e')](_0x410f39);}})[_0x8a41('0x21')](function(){return _0x4fd7d0;})['then'](respondWithResult(_0x49053d,null))[_0x8a41('0x44')](handleError(_0x49053d,null));};exports['removeLists']=function(_0x426fc2,_0x17a601,_0x36d2f6){return db[_0x8a41('0x2a')][_0x8a41('0x4b')]({'where':{'id':_0x426fc2[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x17a601,null))[_0x8a41('0x21')](function(_0x4669a3){if(_0x4669a3){return _0x4669a3['removeLists'](_0x426fc2['query']['ids']);}})['then'](function(_0x3ee4ab){if(_0x3ee4ab){return db[_0x8a41('0x57')][_0x8a41('0x22')]({'where':{'ListId':_0x426fc2[_0x8a41('0x2f')][_0x8a41('0x7f')],'CampaignId':_0x426fc2['params']['id']}})[_0x8a41('0x21')](function(){return _0x3ee4ab;});}})[_0x8a41('0x21')](respondWithStatusCode(_0x17a601,null))[_0x8a41('0x44')](handleError(_0x17a601,null));};exports['getBlackLists']=function(_0x3b2a05,_0x398f00,_0xfecbad){var _0x32dcf5={};var _0x248efd={};var _0x47d0e8;var _0x375e83;return db[_0x8a41('0x2a')][_0x8a41('0x56')]({'where':{'id':_0x3b2a05['params']['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x398f00,null))[_0x8a41('0x21')](function(_0x4826e0){if(_0x4826e0){_0x47d0e8=_0x4826e0;_0x248efd[_0x8a41('0x31')]=_[_0x8a41('0x42')](db['CmList'][_0x8a41('0x2b')]);_0x248efd[_0x8a41('0x2f')]=_[_0x8a41('0x42')](_0x3b2a05['query']);_0x248efd[_0x8a41('0x30')]=_[_0x8a41('0x33')](_0x248efd[_0x8a41('0x31')],_0x248efd['query']);_0x32dcf5['attributes']=_[_0x8a41('0x33')](_0x248efd[_0x8a41('0x31')],qs[_0x8a41('0x34')](_0x3b2a05[_0x8a41('0x2f')][_0x8a41('0x34')]));_0x32dcf5[_0x8a41('0x32')]=_0x32dcf5['attributes'][_0x8a41('0x35')]?_0x32dcf5[_0x8a41('0x32')]:_0x248efd[_0x8a41('0x31')];_0x32dcf5[_0x8a41('0x38')]=qs[_0x8a41('0x39')](_0x3b2a05[_0x8a41('0x2f')][_0x8a41('0x39')]);_0x32dcf5['where']=qs[_0x8a41('0x30')](_[_0x8a41('0x58')](_0x3b2a05['query'],_0x248efd[_0x8a41('0x30')]));if(_0x3b2a05[_0x8a41('0x2f')]['filter']){_0x32dcf5[_0x8a41('0x59')]=_[_0x8a41('0x3b')](_0x32dcf5[_0x8a41('0x59')],{'$or':_[_0x8a41('0x29')](_0x32dcf5['attributes'],function(_0x1cf13f){var _0x37c48d={};_0x37c48d[_0x1cf13f]={'$like':'%'+_0x3b2a05['query'][_0x8a41('0x3a')]+'%'};return _0x37c48d;})});}_0x32dcf5=_[_0x8a41('0x3b')]({},_0x32dcf5,_0x3b2a05[_0x8a41('0x43')]);return _0x47d0e8[_0x8a41('0x80')](_0x32dcf5);}})['then'](function(_0xe94410){if(_0xe94410){_0x375e83=_0xe94410['length'];if(!_0x3b2a05[_0x8a41('0x2f')][_0x8a41('0x36')](_0x8a41('0x37'))){_0x32dcf5[_0x8a41('0x1a')]=qs['limit'](_0x3b2a05[_0x8a41('0x2f')]['limit']);_0x32dcf5[_0x8a41('0x18')]=qs[_0x8a41('0x18')](_0x3b2a05[_0x8a41('0x2f')]['offset']);}return _0x47d0e8[_0x8a41('0x80')](_0x32dcf5);}})['then'](function(_0x17a975){if(_0x17a975){return _0x17a975?{'count':_0x375e83,'rows':_0x17a975}:null;}})[_0x8a41('0x21')](respondWithResult(_0x398f00,null))[_0x8a41('0x44')](handleError(_0x398f00,null));};exports['addBlackLists']=function(_0x4ed465,_0x4fc157,_0x600db){var _0x5b9d22,_0x562623;return db['Campaign'][_0x8a41('0x4b')]({'where':{'id':_0x4ed465[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x4fc157,null))['then'](function(_0x458307){if(_0x458307){_0x562623=_0x458307;return _0x458307[_0x8a41('0x81')](_0x4ed465[_0x8a41('0x53')][_0x8a41('0x7f')],_[_0x8a41('0x51')](_0x4ed465['body'],['ids','id'])||{});}return null;})[_0x8a41('0x61')](function(_0x4d1afe){var _0x82580b;_0x5b9d22=_0x4d1afe||[];var _0x24fa88=[];if(_0x4d1afe){for(var _0x550932=0x0;_0x550932<_0x4d1afe[_0x8a41('0x35')];_0x550932+=0x1){var _0x7524fc=_0x4d1afe[_0x550932]['get']({'plain':!![]});_0x82580b=squel[_0x8a41('0x64')]()[_0x8a41('0x7b')]('cm_hopper_black')[_0x8a41('0x66')]([_0x8a41('0x67'),_0x8a41('0x69'),_0x8a41('0x6a'),_0x8a41('0x5a'),_0x8a41('0x54'),_0x8a41('0x52')],squel['select']()[_0x8a41('0x6b')](_0x8a41('0x67'),_0x8a41('0x67'))[_0x8a41('0x6b')]('id',_0x8a41('0x69'))['field'](_0x7524fc['CmListId'][_0x8a41('0x6e')](),_0x8a41('0x6a'))[_0x8a41('0x6b')](_0x4ed465[_0x8a41('0x50')]['id'][_0x8a41('0x6e')](),_0x8a41('0x5a'))[_0x8a41('0x6b')]('NOW()','createdAt')['field'](_0x8a41('0x6c'),_0x8a41('0x52'))[_0x8a41('0x6f')](_0x8a41('0x70'))[_0x8a41('0x59')](_0x8a41('0x79'))[_0x8a41('0x59')]('ListId\x20=\x20?',_0x7524fc['CmListId'][_0x8a41('0x6e')]())[_0x8a41('0x59')](_0x8a41('0x71')))[_0x8a41('0x6e')]();_0x24fa88['push'](db[_0x8a41('0x7d')][_0x8a41('0x2f')](_0x82580b));}return BPromise[_0x8a41('0x7e')](_0x24fa88);}})[_0x8a41('0x21')](function(){return _0x5b9d22;})[_0x8a41('0x21')](respondWithResult(_0x4fc157,null))[_0x8a41('0x44')](handleError(_0x4fc157,null));};exports[_0x8a41('0x82')]=function(_0x2f67ea,_0x182974,_0xc29391){return db[_0x8a41('0x2a')][_0x8a41('0x4b')]({'where':{'id':_0x2f67ea[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](handleEntityNotFound(_0x182974,null))[_0x8a41('0x21')](function(_0x28df36){if(_0x28df36){return _0x28df36[_0x8a41('0x82')](_0x2f67ea[_0x8a41('0x2f')]['ids']);}})[_0x8a41('0x21')](function(_0x4cba9e){if(_0x4cba9e){return db[_0x8a41('0x5d')]['destroy']({'where':{'ListId':_0x2f67ea[_0x8a41('0x2f')][_0x8a41('0x7f')],'CampaignId':_0x2f67ea[_0x8a41('0x50')]['id']}})[_0x8a41('0x21')](function(){return _0x4cba9e;});}})[_0x8a41('0x21')](respondWithStatusCode(_0x182974,null))[_0x8a41('0x44')](handleError(_0x182974,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 03855a8..da712d4 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(_0x2a05bf,_0x55e3a4){var _0x38a62e=function(_0x28d868){while(--_0x28d868){_0x2a05bf['push'](_0x2a05bf['shift']());}};_0x38a62e(++_0x55e3a4);}(_0x7a54,0x106));var _0x47a5=function(_0x38b875,_0xaf5112){_0x38b875=_0x38b875-0x0;var _0x49071c=_0x7a54[_0x38b875];return _0x49071c;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2d06ef,_0x2b609d){var _0x5ea499=function(_0x3cd37a){while(--_0x3cd37a){_0x2d06ef['push'](_0x2d06ef['shift']());}};_0x5ea499(++_0x2b609d);}(_0x7a54,0x106));var _0x47a5=function(_0x4e9b75,_0x20463d){_0x4e9b75=_0x4e9b75-0x0;var _0x215b0f=_0x7a54[_0x4e9b75];return _0x215b0f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index d7f87d5..bb8e0df 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 _0x98b8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','GetCampaign','lodash'];(function(_0x255be9,_0x3345d9){var _0x34fedf=function(_0x2e198c){while(--_0x2e198c){_0x255be9['push'](_0x255be9['shift']());}};_0x34fedf(++_0x3345d9);}(_0x98b8,0x93));var _0x898b=function(_0xb4df7d,_0xd352df){_0xb4df7d=_0xb4df7d-0x0;var _0x43bdc0=_0x98b8[_0xb4df7d];return _0x43bdc0;};'use strict';var _=require(_0x898b('0x0'));var util=require(_0x898b('0x1'));var moment=require(_0x898b('0x2'));var BPromise=require(_0x898b('0x3'));var rs=require(_0x898b('0x4'));var fs=require('fs');var Redis=require(_0x898b('0x5'));var db=require(_0x898b('0x6'))['db'];var utils=require(_0x898b('0x7'));var logger=require(_0x898b('0x8'))(_0x898b('0x9'));var config=require(_0x898b('0xa'));var jayson=require(_0x898b('0xb'));var client=jayson[_0x898b('0xc')][_0x898b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x124030,_0x4e9410,_0x3989f9){return new BPromise(function(_0x32e2e,_0x4220a7){return client[_0x898b('0xe')](_0x124030,_0x3989f9)[_0x898b('0xf')](function(_0x46118b){logger[_0x898b('0x10')](_0x898b('0x11'),_0x4e9410,'request\x20sent');logger[_0x898b('0x12')]('Campaign,\x20%s,\x20%s,\x20%s',_0x4e9410,'request\x20sent',JSON[_0x898b('0x13')](_0x46118b));if(_0x46118b[_0x898b('0x14')]){if(_0x46118b[_0x898b('0x14')][_0x898b('0x15')]===0x1f4){logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);return _0x4220a7(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}logger[_0x898b('0x14')](_0x898b('0x11'),_0x4e9410,_0x46118b['error'][_0x898b('0x16')]);return _0x32e2e(_0x46118b[_0x898b('0x14')][_0x898b('0x16')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x4e9410,_0x898b('0x17'));_0x32e2e(_0x46118b[_0x898b('0x18')][_0x898b('0x16')]);}})[_0x898b('0x19')](function(_0x54cd3b){logger[_0x898b('0x14')]('Campaign,\x20%s,\x20%s',_0x4e9410,_0x54cd3b);_0x4220a7(_0x54cd3b);});});}exports['GetCampaign']=function(_0x3ad191){var _0x250349=this;return new Promise(function(_0x3f001a,_0x4b1a40){return db[_0x898b('0x1a')][_0x898b('0x1b')]({'raw':_0x3ad191[_0x898b('0x1c')]?_0x3ad191[_0x898b('0x1c')][_0x898b('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ad191[_0x898b('0x1c')]?_0x3ad191[_0x898b('0x1c')][_0x898b('0x1e')]||null:null,'attributes':_0x3ad191[_0x898b('0x1c')]?_0x3ad191[_0x898b('0x1c')]['attributes']||null:null,'limit':_0x3ad191['options']?_0x3ad191[_0x898b('0x1c')][_0x898b('0x1f')]||null:null,'include':_0x3ad191['options']?_0x3ad191[_0x898b('0x1c')][_0x898b('0x20')]?_[_0x898b('0x21')](_0x3ad191['options']['include'],function(_0x66101f){return{'model':db[_0x66101f[_0x898b('0x22')]],'as':_0x66101f['as'],'attributes':_0x66101f[_0x898b('0x23')],'include':_0x66101f[_0x898b('0x20')]?_[_0x898b('0x21')](_0x66101f[_0x898b('0x20')],function(_0x11c558){return{'model':db[_0x11c558[_0x898b('0x22')]],'as':_0x11c558['as'],'attributes':_0x11c558[_0x898b('0x23')],'include':_0x11c558[_0x898b('0x20')]?_[_0x898b('0x21')](_0x11c558[_0x898b('0x20')],function(_0x163a6c){return{'model':db[_0x163a6c['model']],'as':_0x163a6c['as'],'attributes':_0x163a6c['attributes']};}):[]};}):[]};}):[]:[]})[_0x898b('0xf')](function(_0xb5c11){logger[_0x898b('0x10')](_0x898b('0x24'),_0x3ad191);logger[_0x898b('0x12')](_0x898b('0x24'),_0x3ad191,JSON[_0x898b('0x13')](_0xb5c11));_0x3f001a(_0xb5c11);})[_0x898b('0x19')](function(_0x320237){logger[_0x898b('0x14')]('GetCampaign',_0x320237['message'],_0x3ad191);_0x4b1a40(_0x250349[_0x898b('0x14')](0x1f4,_0x320237[_0x898b('0x16')]));});});}; \ No newline at end of file +var _0xac65=['limit','include','map','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xac65,0x11d));var _0x5ac6=function(_0x5098a0,_0x100da0){_0x5098a0=_0x5098a0-0x0;var _0x2cfe61=_0xac65[_0x5098a0];return _0x2cfe61;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var moment=require(_0x5ac6('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ac6('0x3'));var fs=require('fs');var Redis=require(_0x5ac6('0x4'));var db=require(_0x5ac6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ac6('0x6'))(_0x5ac6('0x7'));var config=require(_0x5ac6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5ac6('0x9')][_0x5ac6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130661,_0x402f26,_0xa61e6f){return new BPromise(function(_0x932f6f,_0x3a90a6){return client[_0x5ac6('0xb')](_0x130661,_0xa61e6f)[_0x5ac6('0xc')](function(_0x3b04ab){logger[_0x5ac6('0xd')](_0x5ac6('0xe'),_0x402f26,_0x5ac6('0xf'));logger[_0x5ac6('0x10')](_0x5ac6('0x11'),_0x402f26,_0x5ac6('0xf'),JSON[_0x5ac6('0x12')](_0x3b04ab));if(_0x3b04ab[_0x5ac6('0x13')]){if(_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x14')]===0x1f4){logger[_0x5ac6('0x13')](_0x5ac6('0xe'),_0x402f26,_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x15')]);return _0x3a90a6(_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x15')]);}logger['error'](_0x5ac6('0xe'),_0x402f26,_0x3b04ab[_0x5ac6('0x13')][_0x5ac6('0x15')]);return _0x932f6f(_0x3b04ab['error'][_0x5ac6('0x15')]);}else{logger[_0x5ac6('0xd')](_0x5ac6('0xe'),_0x402f26,_0x5ac6('0xf'));_0x932f6f(_0x3b04ab[_0x5ac6('0x16')]['message']);}})[_0x5ac6('0x17')](function(_0x5e4885){logger['error'](_0x5ac6('0xe'),_0x402f26,_0x5e4885);_0x3a90a6(_0x5e4885);});});}exports[_0x5ac6('0x18')]=function(_0x2e62d9){var _0x3a88a1=this;return new Promise(function(_0x24ccd2,_0x3759dd){return db[_0x5ac6('0x19')][_0x5ac6('0x1a')]({'raw':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9['options'][_0x5ac6('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9[_0x5ac6('0x1b')][_0x5ac6('0x1d')]||null:null,'attributes':_0x2e62d9['options']?_0x2e62d9[_0x5ac6('0x1b')]['attributes']||null:null,'limit':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9['options'][_0x5ac6('0x1e')]||null:null,'include':_0x2e62d9[_0x5ac6('0x1b')]?_0x2e62d9['options'][_0x5ac6('0x1f')]?_[_0x5ac6('0x20')](_0x2e62d9['options'][_0x5ac6('0x1f')],function(_0x4c07d6){return{'model':db[_0x4c07d6[_0x5ac6('0x21')]],'as':_0x4c07d6['as'],'attributes':_0x4c07d6[_0x5ac6('0x22')],'include':_0x4c07d6[_0x5ac6('0x1f')]?_[_0x5ac6('0x20')](_0x4c07d6[_0x5ac6('0x1f')],function(_0x3da323){return{'model':db[_0x3da323[_0x5ac6('0x21')]],'as':_0x3da323['as'],'attributes':_0x3da323['attributes'],'include':_0x3da323[_0x5ac6('0x1f')]?_[_0x5ac6('0x20')](_0x3da323['include'],function(_0x333464){return{'model':db[_0x333464['model']],'as':_0x333464['as'],'attributes':_0x333464[_0x5ac6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5ac6('0xc')](function(_0x51fdf4){logger[_0x5ac6('0xd')]('GetCampaign',_0x2e62d9);logger['debug'](_0x5ac6('0x18'),_0x2e62d9,JSON['stringify'](_0x51fdf4));_0x24ccd2(_0x51fdf4);})[_0x5ac6('0x17')](function(_0x2c02f7){logger['error']('GetCampaign',_0x2c02f7[_0x5ac6('0x15')],_0x2e62d9);_0x3759dd(_0x3a88a1['error'](0x1f4,_0x2c02f7[_0x5ac6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 4f3b307..de4990f 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 _0xe306=['/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addBlackLists','put','/:id/lists','removeLists','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','index','get','/:id','show'];(function(_0x4b05d0,_0x6e2c9c){var _0x4b8be0=function(_0x2c7102){while(--_0x2c7102){_0x4b05d0['push'](_0x4b05d0['shift']());}};_0x4b8be0(++_0x6e2c9c);}(_0xe306,0x180));var _0x6e30=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xe306[_0x521929];return _0x632436;};'use strict';var multer=require(_0x6e30('0x0'));var util=require(_0x6e30('0x1'));var path=require(_0x6e30('0x2'));var timeout=require(_0x6e30('0x3'));var express=require(_0x6e30('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e30('0x5'));var interaction=require(_0x6e30('0x6'));var config=require('../../config/environment');var controller=require(_0x6e30('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e30('0x8')]);router[_0x6e30('0x9')](_0x6e30('0xa'),auth['isAuthenticated'](),controller[_0x6e30('0xb')]);router[_0x6e30('0x9')](_0x6e30('0xc'),auth[_0x6e30('0xd')](),controller[_0x6e30('0xe')]);router[_0x6e30('0x9')](_0x6e30('0xf'),auth[_0x6e30('0xd')](),controller[_0x6e30('0x10')]);router[_0x6e30('0x9')](_0x6e30('0x11'),auth['isAuthenticated'](),controller[_0x6e30('0x12')]);router[_0x6e30('0x9')](_0x6e30('0x13'),auth[_0x6e30('0xd')](),controller['getHopperBlacks']);router[_0x6e30('0x9')]('/:id/lists',auth[_0x6e30('0xd')](),controller[_0x6e30('0x14')]);router[_0x6e30('0x9')](_0x6e30('0x15'),auth['isAuthenticated'](),controller[_0x6e30('0x16')]);router[_0x6e30('0x17')]('/',auth[_0x6e30('0xd')](),controller[_0x6e30('0x18')]);router[_0x6e30('0x17')](_0x6e30('0x19'),auth[_0x6e30('0xd')](),controller['clone']);router[_0x6e30('0x17')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router['post'](_0x6e30('0x15'),auth['isAuthenticated'](),controller[_0x6e30('0x1a')]);router[_0x6e30('0x1b')](_0x6e30('0xa'),auth[_0x6e30('0xd')](),controller['update']);router['delete']('/:id',auth[_0x6e30('0xd')](),controller['destroy']);router['delete'](_0x6e30('0x1c'),auth[_0x6e30('0xd')](),controller[_0x6e30('0x1d')]);router[_0x6e30('0x1e')](_0x6e30('0x15'),auth[_0x6e30('0xd')](),controller[_0x6e30('0x1f')]);module[_0x6e30('0x20')]=router; \ No newline at end of file +var _0x93b3=['/:id/blacklists','create','/:id/clone','post','addLists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists'];(function(_0x3521b1,_0x19755a){var _0x35d82d=function(_0x19dafc){while(--_0x19dafc){_0x3521b1['push'](_0x3521b1['shift']());}};_0x35d82d(++_0x19755a);}(_0x93b3,0x1c6));var _0x393b=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0x93b3[_0x1c97c8];return _0x2c096d;};'use strict';var multer=require(_0x393b('0x0'));var util=require(_0x393b('0x1'));var path=require(_0x393b('0x2'));var timeout=require(_0x393b('0x3'));var express=require('express');var router=express[_0x393b('0x4')]();var fs_extra=require(_0x393b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x393b('0x6'));var config=require(_0x393b('0x7'));var controller=require(_0x393b('0x8'));router[_0x393b('0x9')]('/',auth[_0x393b('0xa')](),controller['index']);router[_0x393b('0x9')](_0x393b('0xb'),auth[_0x393b('0xa')](),controller[_0x393b('0xc')]);router[_0x393b('0x9')](_0x393b('0xd'),auth[_0x393b('0xa')](),controller[_0x393b('0xe')]);router[_0x393b('0x9')](_0x393b('0xf'),auth[_0x393b('0xa')](),controller[_0x393b('0x10')]);router['get'](_0x393b('0x11'),auth[_0x393b('0xa')](),controller[_0x393b('0x12')]);router[_0x393b('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x393b('0x13')]);router[_0x393b('0x9')](_0x393b('0x14'),auth[_0x393b('0xa')](),controller[_0x393b('0x15')]);router[_0x393b('0x9')](_0x393b('0x16'),auth[_0x393b('0xa')](),controller['getBlackLists']);router['post']('/',auth[_0x393b('0xa')](),controller[_0x393b('0x17')]);router['post'](_0x393b('0x18'),auth[_0x393b('0xa')](),controller['clone']);router[_0x393b('0x19')](_0x393b('0x14'),auth[_0x393b('0xa')](),controller[_0x393b('0x1a')]);router[_0x393b('0x19')]('/:id/blacklists',auth[_0x393b('0xa')](),controller[_0x393b('0x1b')]);router['put'](_0x393b('0xb'),auth[_0x393b('0xa')](),controller[_0x393b('0x1c')]);router[_0x393b('0x1d')](_0x393b('0xb'),auth[_0x393b('0xa')](),controller[_0x393b('0x1e')]);router['delete'](_0x393b('0x14'),auth[_0x393b('0xa')](),controller[_0x393b('0x1f')]);router['delete'](_0x393b('0x16'),auth['isAuthenticated'](),controller[_0x393b('0x20')]);module[_0x393b('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 6c36d09..c085e3e 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 _0xbacf=['sequelize','exports','STRING','getDataValue'];(function(_0x27a5bb,_0x3f4cfb){var _0x2e17ea=function(_0x22912d){while(--_0x22912d){_0x27a5bb['push'](_0x27a5bb['shift']());}};_0x2e17ea(++_0x3f4cfb);}(_0xbacf,0x6c));var _0xfbac=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xbacf[_0x999b85];return _0x1d7124;};'use strict';var Sequelize=require(_0xfbac('0x0'));module[_0xfbac('0x1')]={'key':{'type':Sequelize[_0xfbac('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xfbac('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfbac('0x3')]('key');}}}; \ No newline at end of file +var _0x1cf7=['sequelize','exports','STRING','getDataValue'];(function(_0x2df523,_0x11b09e){var _0x43f919=function(_0x53c3d6){while(--_0x53c3d6){_0x2df523['push'](_0x2df523['shift']());}};_0x43f919(++_0x11b09e);}(_0x1cf7,0x68));var _0x71cf=function(_0x303de5,_0x4d510c){_0x303de5=_0x303de5-0x0;var _0x9d6e42=_0x1cf7[_0x303de5];return _0x9d6e42;};'use strict';var Sequelize=require(_0x71cf('0x0'));module[_0x71cf('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x71cf('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x71cf('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1c6b522..c769168 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 _0xe940=['moment','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','length','includeAll','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2a63bd,_0x2974e7){var _0x416d78=function(_0x1bbf83){while(--_0x1bbf83){_0x2a63bd['push'](_0x2a63bd['shift']());}};_0x416d78(++_0x2974e7);}(_0xe940,0x1af));var _0x0e94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe940[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e94('0x0'));var zipdir=require(_0x0e94('0x1'));var jsonpatch=require(_0x0e94('0x2'));var rp=require(_0x0e94('0x3'));var moment=require(_0x0e94('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e94('0x5'));var path=require('path');var sox=require(_0x0e94('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e94('0x7'));var _=require(_0x0e94('0x8'));var squel=require('squel');var crypto=require(_0x0e94('0x9'));var jsforce=require(_0x0e94('0xa'));var deskjs=require(_0x0e94('0xb'));var toCsv=require(_0x0e94('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e94('0xd'));var authService=require(_0x0e94('0xe'));var qs=require(_0x0e94('0xf'));var as=require(_0x0e94('0x10'));var hardwareService=require(_0x0e94('0x11'));var logger=require('../../config/logger')(_0x0e94('0x12'));var utils=require(_0x0e94('0x13'));var config=require(_0x0e94('0x14'));var licenseUtil=require(_0x0e94('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa30021,_0x2aa48c){_0x2aa48c=_0x2aa48c||0xcc;return function(_0x59b042){if(_0x59b042){return _0xa30021['sendStatus'](_0x2aa48c);}return _0xa30021['status'](_0x2aa48c)[_0x0e94('0x16')]();};}function respondWithResult(_0x45b5ab,_0x4b8897){_0x4b8897=_0x4b8897||0xc8;return function(_0x80a14c){if(_0x80a14c){return _0x45b5ab[_0x0e94('0x17')](_0x4b8897)['json'](_0x80a14c);}};}function respondWithFilteredResult(_0x5f42e0,_0x21b36b){return function(_0x31be23){if(_0x31be23){var _0x1ee020=typeof _0x21b36b[_0x0e94('0x18')]===_0x0e94('0x19')&&typeof _0x21b36b['limit']===_0x0e94('0x19');var _0x34e116=_0x31be23[_0x0e94('0x1a')];var _0x5d5dec=_0x1ee020?0x0:_0x21b36b[_0x0e94('0x18')];var _0x4fae1d=_0x1ee020?_0x31be23[_0x0e94('0x1a')]:_0x21b36b['offset']+_0x21b36b[_0x0e94('0x1b')];var _0x116dab;if(_0x4fae1d>=_0x34e116){_0x4fae1d=_0x34e116;_0x116dab=0xc8;}else{_0x116dab=0xce;}_0x5f42e0[_0x0e94('0x17')](_0x116dab);return _0x5f42e0[_0x0e94('0x1c')](_0x0e94('0x1d'),_0x5d5dec+'-'+_0x4fae1d+'/'+_0x34e116)['json'](_0x31be23);}return null;};}function patchUpdates(_0x5f3bad){return function(_0x5a6c45){try{jsonpatch[_0x0e94('0x1e')](_0x5a6c45,_0x5f3bad,!![]);}catch(_0x1a1630){return BPromise[_0x0e94('0x1f')](_0x1a1630);}return _0x5a6c45[_0x0e94('0x20')]();};}function saveUpdates(_0x536e8a,_0x3bdb4f){return function(_0x8093c1){if(_0x8093c1){return _0x8093c1[_0x0e94('0x21')](_0x536e8a)[_0x0e94('0x22')](function(_0x1bb2fa){return _0x1bb2fa;});}return null;};}function removeEntity(_0x49c54a,_0x12833e){return function(_0x1e6348){if(_0x1e6348){return _0x1e6348[_0x0e94('0x23')]()[_0x0e94('0x22')](function(){var _0x4eccc0=_0x1e6348[_0x0e94('0x24')]({'plain':!![]});var _0xfd2c6d=_0x0e94('0x25');return db[_0x0e94('0x26')][_0x0e94('0x23')]({'where':{'type':_0xfd2c6d,'resourceId':_0x4eccc0['id']}})[_0x0e94('0x22')](function(){return _0x1e6348;});})['then'](function(){_0x49c54a[_0x0e94('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5e03f,_0x1c04c6){return function(_0x295e72){if(!_0x295e72){_0xe5e03f[_0x0e94('0x27')](0x194);}return _0x295e72;};}function handleError(_0x4e8c6f,_0x375ad3){_0x375ad3=_0x375ad3||0x1f4;return function(_0x9daf63){logger['error'](_0x9daf63[_0x0e94('0x28')]);if(_0x9daf63[_0x0e94('0x29')]){delete _0x9daf63[_0x0e94('0x29')];}_0x4e8c6f[_0x0e94('0x17')](_0x375ad3)[_0x0e94('0x2a')](_0x9daf63);};}exports['index']=function(_0x32d75a,_0x416087){var _0x1f116a={},_0x2f97d6={},_0x463545={'count':0x0,'rows':[]};var _0x58b4ab=_[_0x0e94('0x2b')](db[_0x0e94('0x2c')][_0x0e94('0x2d')],function(_0x16dec1){return{'name':_0x16dec1[_0x0e94('0x2e')],'type':_0x16dec1[_0x0e94('0x2f')][_0x0e94('0x30')]};});_0x2f97d6[_0x0e94('0x31')]=_['map'](_0x58b4ab,'name');_0x2f97d6[_0x0e94('0x32')]=_['keys'](_0x32d75a[_0x0e94('0x32')]);_0x2f97d6[_0x0e94('0x33')]=_['intersection'](_0x2f97d6[_0x0e94('0x31')],_0x2f97d6[_0x0e94('0x32')]);_0x1f116a[_0x0e94('0x34')]=_[_0x0e94('0x35')](_0x2f97d6[_0x0e94('0x31')],qs['fields'](_0x32d75a['query'][_0x0e94('0x36')]));_0x1f116a[_0x0e94('0x34')]=_0x1f116a['attributes']['length']?_0x1f116a[_0x0e94('0x34')]:_0x2f97d6['model'];if(!_0x32d75a['query']['hasOwnProperty'](_0x0e94('0x37'))){_0x1f116a[_0x0e94('0x1b')]=qs[_0x0e94('0x1b')](_0x32d75a[_0x0e94('0x32')]['limit']);_0x1f116a[_0x0e94('0x18')]=qs[_0x0e94('0x18')](_0x32d75a[_0x0e94('0x32')][_0x0e94('0x18')]);}_0x1f116a[_0x0e94('0x38')]=qs[_0x0e94('0x39')](_0x32d75a[_0x0e94('0x32')][_0x0e94('0x39')]);_0x1f116a[_0x0e94('0x3a')]=qs['filters'](_[_0x0e94('0x3b')](_0x32d75a['query'],_0x2f97d6[_0x0e94('0x33')]),_0x58b4ab);if(_0x32d75a[_0x0e94('0x32')][_0x0e94('0x3c')]){_0x1f116a['where']=_[_0x0e94('0x3d')](_0x1f116a[_0x0e94('0x3a')],{'$or':[{'key':{'$like':'%'+_0x32d75a[_0x0e94('0x32')][_0x0e94('0x3c')]+'%'}},{'value':{'$like':'%'+_0x32d75a[_0x0e94('0x32')][_0x0e94('0x3c')]+'%'}}]});}_0x1f116a=_[_0x0e94('0x3d')]({},_0x1f116a,_0x32d75a[_0x0e94('0x3e')]);var _0x22abff={'where':_0x1f116a[_0x0e94('0x3a')]};return db[_0x0e94('0x2c')][_0x0e94('0x1a')](_0x22abff)['then'](function(_0x1c3b13){_0x463545[_0x0e94('0x1a')]=_0x1c3b13;if(_0x32d75a['query']['includeAll']){_0x1f116a[_0x0e94('0x3f')]=[{'all':!![]}];}return db[_0x0e94('0x2c')][_0x0e94('0x40')](_0x1f116a);})['then'](function(_0x11037c){_0x463545[_0x0e94('0x41')]=_0x11037c;return _0x463545;})['then'](respondWithFilteredResult(_0x416087,_0x1f116a))[_0x0e94('0x42')](handleError(_0x416087,null));};exports['show']=function(_0x4eb650,_0x4b6963){var _0x4cac6a={'raw':!![],'where':{'id':_0x4eb650[_0x0e94('0x43')]['id']}},_0x2890dc={};_0x2890dc[_0x0e94('0x31')]=_[_0x0e94('0x44')](db['CannedAnswer'][_0x0e94('0x2d')]);_0x2890dc['query']=_[_0x0e94('0x44')](_0x4eb650[_0x0e94('0x32')]);_0x2890dc[_0x0e94('0x33')]=_[_0x0e94('0x35')](_0x2890dc[_0x0e94('0x31')],_0x2890dc[_0x0e94('0x32')]);_0x4cac6a[_0x0e94('0x34')]=_[_0x0e94('0x35')](_0x2890dc[_0x0e94('0x31')],qs[_0x0e94('0x36')](_0x4eb650[_0x0e94('0x32')][_0x0e94('0x36')]));_0x4cac6a['attributes']=_0x4cac6a[_0x0e94('0x34')][_0x0e94('0x45')]?_0x4cac6a[_0x0e94('0x34')]:_0x2890dc[_0x0e94('0x31')];if(_0x4eb650[_0x0e94('0x32')][_0x0e94('0x46')]){_0x4cac6a['include']=[{'all':!![]}];}_0x4cac6a=_[_0x0e94('0x3d')]({},_0x4cac6a,_0x4eb650[_0x0e94('0x3e')]);return db[_0x0e94('0x2c')][_0x0e94('0x47')](_0x4cac6a)[_0x0e94('0x22')](handleEntityNotFound(_0x4b6963,null))['then'](respondWithResult(_0x4b6963,null))[_0x0e94('0x42')](handleError(_0x4b6963,null));};exports[_0x0e94('0x21')]=function(_0x39b36d,_0x43b231){if(_0x39b36d['body']['id']){delete _0x39b36d['body']['id'];}return db[_0x0e94('0x2c')][_0x0e94('0x47')]({'where':{'id':_0x39b36d[_0x0e94('0x43')]['id']}})[_0x0e94('0x22')](handleEntityNotFound(_0x43b231,null))['then'](saveUpdates(_0x39b36d['body'],null))[_0x0e94('0x22')](respondWithResult(_0x43b231,null))['catch'](handleError(_0x43b231,null));};exports[_0x0e94('0x23')]=function(_0x27e1a3,_0x47f84b){return db['CannedAnswer'][_0x0e94('0x47')]({'where':{'id':_0x27e1a3[_0x0e94('0x43')]['id']}})['then'](handleEntityNotFound(_0x47f84b,null))['then'](removeEntity(_0x47f84b,null))[_0x0e94('0x42')](handleError(_0x47f84b,null));};exports['create']=function(_0x17a4a2,_0x55e757){var _0x2bf0dd={'key':_0x17a4a2['body']['key']};if(_0x17a4a2[_0x0e94('0x48')][_0x0e94('0x49')]){_0x2bf0dd[_0x0e94('0x49')]=_0x17a4a2[_0x0e94('0x48')][_0x0e94('0x49')];}else if(_0x17a4a2['body'][_0x0e94('0x4a')]){_0x2bf0dd['SmsAccountId']=_0x17a4a2[_0x0e94('0x48')]['SmsAccountId'];}else if(_0x17a4a2[_0x0e94('0x48')][_0x0e94('0x4b')]){_0x2bf0dd[_0x0e94('0x4b')]=_0x17a4a2[_0x0e94('0x48')][_0x0e94('0x4b')];}else if(_0x17a4a2[_0x0e94('0x48')][_0x0e94('0x4c')]){_0x2bf0dd['ChatWebsiteId']=_0x17a4a2[_0x0e94('0x48')][_0x0e94('0x4c')];}return db[_0x0e94('0x2c')][_0x0e94('0x47')]({'where':_0x2bf0dd})['then'](function(_0xc92e60){if(_0xc92e60){throw new db[(_0x0e94('0x4d'))][(_0x0e94('0x4e'))](_0x0e94('0x4f'));}return db[_0x0e94('0x2c')][_0x0e94('0x50')](_0x17a4a2[_0x0e94('0x48')]);})['then'](function(_0x3d2d00){var _0x553332=_0x17a4a2[_0x0e94('0x51')][_0x0e94('0x24')]({'plain':!![]});if(!_0x553332)throw new Error(_0x0e94('0x52'));if(_0x553332[_0x0e94('0x53')]==='user'){var _0x5e2f2e=_0x3d2d00[_0x0e94('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x0e94('0x47')]({'where':{'name':_0x0e94('0x25'),'userProfileId':_0x553332[_0x0e94('0x54')]},'raw':!![]})[_0x0e94('0x22')](function(_0x4ab43){if(_0x4ab43&&_0x4ab43[_0x0e94('0x55')]===0x0){return db['UserProfileResource'][_0x0e94('0x50')]({'name':_0x5e2f2e[_0x0e94('0x29')],'resourceId':_0x5e2f2e['id'],'type':_0x4ab43['name'],'sectionId':_0x4ab43['id']},{})[_0x0e94('0x22')](function(){return _0x3d2d00;});}else{return _0x3d2d00;}})[_0x0e94('0x42')](function(_0x3464e9){logger['error'](_0x0e94('0x56'),_0x3464e9);throw _0x3464e9;});}return _0x3d2d00;})[_0x0e94('0x22')](respondWithResult(_0x55e757,0xc9))[_0x0e94('0x42')](handleError(_0x55e757,null));}; \ No newline at end of file +var _0xa7c0=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','get','CannedAnswers','destroy','end','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0xa7c0,0x9e));var _0x0a7c=function(_0x56a200,_0x4f3117){_0x56a200=_0x56a200-0x0;var _0x16f4e0=_0xa7c0[_0x56a200];return _0x16f4e0;};'use strict';var emlformat=require(_0x0a7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a7c('0x1'));var jsonpatch=require(_0x0a7c('0x2'));var rp=require('request-promise');var moment=require(_0x0a7c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a7c('0x4'));var util=require(_0x0a7c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0a7c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a7c('0x7'));var _=require(_0x0a7c('0x8'));var squel=require(_0x0a7c('0x9'));var crypto=require(_0x0a7c('0xa'));var jsforce=require(_0x0a7c('0xb'));var deskjs=require(_0x0a7c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a7c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0a7c('0xe'));var as=require(_0x0a7c('0xf'));var hardwareService=require(_0x0a7c('0x10'));var logger=require(_0x0a7c('0x11'))(_0x0a7c('0x12'));var utils=require(_0x0a7c('0x13'));var config=require(_0x0a7c('0x14'));var licenseUtil=require(_0x0a7c('0x15'));var db=require(_0x0a7c('0x16'))['db'];function respondWithStatusCode(_0x50e3a5,_0x4d3a31){_0x4d3a31=_0x4d3a31||0xcc;return function(_0x1d3ee3){if(_0x1d3ee3){return _0x50e3a5[_0x0a7c('0x17')](_0x4d3a31);}return _0x50e3a5['status'](_0x4d3a31)['end']();};}function respondWithResult(_0x47e829,_0x1bacf1){_0x1bacf1=_0x1bacf1||0xc8;return function(_0x4df775){if(_0x4df775){return _0x47e829[_0x0a7c('0x18')](_0x1bacf1)[_0x0a7c('0x19')](_0x4df775);}};}function respondWithFilteredResult(_0x42044f,_0x1bd4e0){return function(_0x110afd){if(_0x110afd){var _0xbd1c53=typeof _0x1bd4e0[_0x0a7c('0x1a')]===_0x0a7c('0x1b')&&typeof _0x1bd4e0[_0x0a7c('0x1c')]==='undefined';var _0x3841a9=_0x110afd['count'];var _0x44a9c7=_0xbd1c53?0x0:_0x1bd4e0['offset'];var _0x353ae2=_0xbd1c53?_0x110afd[_0x0a7c('0x1d')]:_0x1bd4e0['offset']+_0x1bd4e0[_0x0a7c('0x1c')];var _0x3f6bd4;if(_0x353ae2>=_0x3841a9){_0x353ae2=_0x3841a9;_0x3f6bd4=0xc8;}else{_0x3f6bd4=0xce;}_0x42044f['status'](_0x3f6bd4);return _0x42044f[_0x0a7c('0x1e')](_0x0a7c('0x1f'),_0x44a9c7+'-'+_0x353ae2+'/'+_0x3841a9)['json'](_0x110afd);}return null;};}function patchUpdates(_0x7f14e9){return function(_0x4c8f91){try{jsonpatch[_0x0a7c('0x20')](_0x4c8f91,_0x7f14e9,!![]);}catch(_0xf40e15){return BPromise['reject'](_0xf40e15);}return _0x4c8f91[_0x0a7c('0x21')]();};}function saveUpdates(_0x3c4058,_0x4ba972){return function(_0x2b3346){if(_0x2b3346){return _0x2b3346['update'](_0x3c4058)[_0x0a7c('0x22')](function(_0x21ae2b){return _0x21ae2b;});}return null;};}function removeEntity(_0x1c61b9,_0x202c09){return function(_0x2dbb7d){if(_0x2dbb7d){return _0x2dbb7d['destroy']()[_0x0a7c('0x22')](function(){var _0x41d945=_0x2dbb7d[_0x0a7c('0x23')]({'plain':!![]});var _0x1ad857=_0x0a7c('0x24');return db['UserProfileResource'][_0x0a7c('0x25')]({'where':{'type':_0x1ad857,'resourceId':_0x41d945['id']}})['then'](function(){return _0x2dbb7d;});})[_0x0a7c('0x22')](function(){_0x1c61b9[_0x0a7c('0x18')](0xcc)[_0x0a7c('0x26')]();});}};}function handleEntityNotFound(_0x42073e,_0x25ece3){return function(_0x4831d2){if(!_0x4831d2){_0x42073e[_0x0a7c('0x17')](0x194);}return _0x4831d2;};}function handleError(_0x5d1770,_0x589d36){_0x589d36=_0x589d36||0x1f4;return function(_0x1e9243){logger[_0x0a7c('0x27')](_0x1e9243[_0x0a7c('0x28')]);if(_0x1e9243[_0x0a7c('0x29')]){delete _0x1e9243[_0x0a7c('0x29')];}_0x5d1770[_0x0a7c('0x18')](_0x589d36)[_0x0a7c('0x2a')](_0x1e9243);};}exports[_0x0a7c('0x2b')]=function(_0x428f35,_0x267052){var _0x37c6e7={},_0x15e691={},_0x1cdbfe={'count':0x0,'rows':[]};var _0x2db58e=_['map'](db[_0x0a7c('0x2c')][_0x0a7c('0x2d')],function(_0x23efc7){return{'name':_0x23efc7[_0x0a7c('0x2e')],'type':_0x23efc7[_0x0a7c('0x2f')][_0x0a7c('0x30')]};});_0x15e691['model']=_[_0x0a7c('0x31')](_0x2db58e,'name');_0x15e691[_0x0a7c('0x32')]=_[_0x0a7c('0x33')](_0x428f35[_0x0a7c('0x32')]);_0x15e691[_0x0a7c('0x34')]=_[_0x0a7c('0x35')](_0x15e691['model'],_0x15e691[_0x0a7c('0x32')]);_0x37c6e7['attributes']=_['intersection'](_0x15e691[_0x0a7c('0x36')],qs['fields'](_0x428f35[_0x0a7c('0x32')][_0x0a7c('0x37')]));_0x37c6e7['attributes']=_0x37c6e7[_0x0a7c('0x38')][_0x0a7c('0x39')]?_0x37c6e7[_0x0a7c('0x38')]:_0x15e691[_0x0a7c('0x36')];if(!_0x428f35['query'][_0x0a7c('0x3a')](_0x0a7c('0x3b'))){_0x37c6e7[_0x0a7c('0x1c')]=qs[_0x0a7c('0x1c')](_0x428f35['query'][_0x0a7c('0x1c')]);_0x37c6e7[_0x0a7c('0x1a')]=qs[_0x0a7c('0x1a')](_0x428f35[_0x0a7c('0x32')][_0x0a7c('0x1a')]);}_0x37c6e7[_0x0a7c('0x3c')]=qs[_0x0a7c('0x3d')](_0x428f35[_0x0a7c('0x32')][_0x0a7c('0x3d')]);_0x37c6e7[_0x0a7c('0x3e')]=qs[_0x0a7c('0x34')](_[_0x0a7c('0x3f')](_0x428f35['query'],_0x15e691[_0x0a7c('0x34')]),_0x2db58e);if(_0x428f35[_0x0a7c('0x32')]['filter']){_0x37c6e7[_0x0a7c('0x3e')]=_[_0x0a7c('0x40')](_0x37c6e7[_0x0a7c('0x3e')],{'$or':[{'key':{'$like':'%'+_0x428f35[_0x0a7c('0x32')][_0x0a7c('0x41')]+'%'}},{'value':{'$like':'%'+_0x428f35[_0x0a7c('0x32')][_0x0a7c('0x41')]+'%'}}]});}_0x37c6e7=_['merge']({},_0x37c6e7,_0x428f35[_0x0a7c('0x42')]);var _0x10507d={'where':_0x37c6e7[_0x0a7c('0x3e')]};return db[_0x0a7c('0x2c')][_0x0a7c('0x1d')](_0x10507d)[_0x0a7c('0x22')](function(_0x346468){_0x1cdbfe['count']=_0x346468;if(_0x428f35['query'][_0x0a7c('0x43')]){_0x37c6e7[_0x0a7c('0x44')]=[{'all':!![]}];}return db[_0x0a7c('0x2c')]['findAll'](_0x37c6e7);})['then'](function(_0x49b815){_0x1cdbfe[_0x0a7c('0x45')]=_0x49b815;return _0x1cdbfe;})['then'](respondWithFilteredResult(_0x267052,_0x37c6e7))[_0x0a7c('0x46')](handleError(_0x267052,null));};exports[_0x0a7c('0x47')]=function(_0x4c37c3,_0x9e5b7){var _0x29c673={'raw':!![],'where':{'id':_0x4c37c3[_0x0a7c('0x48')]['id']}},_0x26f550={};_0x26f550['model']=_[_0x0a7c('0x33')](db[_0x0a7c('0x2c')][_0x0a7c('0x2d')]);_0x26f550[_0x0a7c('0x32')]=_[_0x0a7c('0x33')](_0x4c37c3[_0x0a7c('0x32')]);_0x26f550[_0x0a7c('0x34')]=_[_0x0a7c('0x35')](_0x26f550['model'],_0x26f550[_0x0a7c('0x32')]);_0x29c673[_0x0a7c('0x38')]=_['intersection'](_0x26f550[_0x0a7c('0x36')],qs[_0x0a7c('0x37')](_0x4c37c3[_0x0a7c('0x32')][_0x0a7c('0x37')]));_0x29c673['attributes']=_0x29c673[_0x0a7c('0x38')]['length']?_0x29c673['attributes']:_0x26f550[_0x0a7c('0x36')];if(_0x4c37c3[_0x0a7c('0x32')]['includeAll']){_0x29c673[_0x0a7c('0x44')]=[{'all':!![]}];}_0x29c673=_[_0x0a7c('0x40')]({},_0x29c673,_0x4c37c3['options']);return db['CannedAnswer'][_0x0a7c('0x49')](_0x29c673)[_0x0a7c('0x22')](handleEntityNotFound(_0x9e5b7,null))['then'](respondWithResult(_0x9e5b7,null))[_0x0a7c('0x46')](handleError(_0x9e5b7,null));};exports[_0x0a7c('0x4a')]=function(_0x349af3,_0x5e4b91){if(_0x349af3[_0x0a7c('0x4b')]['id']){delete _0x349af3['body']['id'];}return db[_0x0a7c('0x2c')]['find']({'where':{'id':_0x349af3[_0x0a7c('0x48')]['id']}})[_0x0a7c('0x22')](handleEntityNotFound(_0x5e4b91,null))[_0x0a7c('0x22')](saveUpdates(_0x349af3['body'],null))[_0x0a7c('0x22')](respondWithResult(_0x5e4b91,null))['catch'](handleError(_0x5e4b91,null));};exports[_0x0a7c('0x25')]=function(_0xae90c7,_0x2580f4){return db['CannedAnswer'][_0x0a7c('0x49')]({'where':{'id':_0xae90c7[_0x0a7c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2580f4,null))[_0x0a7c('0x22')](removeEntity(_0x2580f4,null))['catch'](handleError(_0x2580f4,null));};exports['create']=function(_0x5be837,_0xdd6652){var _0x8e6bfa={'key':_0x5be837[_0x0a7c('0x4b')][_0x0a7c('0x30')]};if(_0x5be837['body'][_0x0a7c('0x4c')]){_0x8e6bfa[_0x0a7c('0x4c')]=_0x5be837[_0x0a7c('0x4b')][_0x0a7c('0x4c')];}else if(_0x5be837['body'][_0x0a7c('0x4d')]){_0x8e6bfa['SmsAccountId']=_0x5be837[_0x0a7c('0x4b')][_0x0a7c('0x4d')];}else if(_0x5be837[_0x0a7c('0x4b')][_0x0a7c('0x4e')]){_0x8e6bfa['OpenchannelAccountId']=_0x5be837[_0x0a7c('0x4b')][_0x0a7c('0x4e')];}else if(_0x5be837['body'][_0x0a7c('0x4f')]){_0x8e6bfa[_0x0a7c('0x4f')]=_0x5be837[_0x0a7c('0x4b')]['ChatWebsiteId'];}return db[_0x0a7c('0x2c')]['find']({'where':_0x8e6bfa})[_0x0a7c('0x22')](function(_0xab411){if(_0xab411){throw new db['Sequelize']['ValidationError'](_0x0a7c('0x50'));}return db[_0x0a7c('0x2c')][_0x0a7c('0x51')](_0x5be837['body']);})[_0x0a7c('0x22')](function(_0x5ae88b){var _0x232a58=_0x5be837[_0x0a7c('0x52')]['get']({'plain':!![]});if(!_0x232a58)throw new Error(_0x0a7c('0x53'));if(_0x232a58[_0x0a7c('0x54')]===_0x0a7c('0x52')){var _0x4000d9=_0x5ae88b['get']({'plain':!![]});return db[_0x0a7c('0x55')][_0x0a7c('0x49')]({'where':{'name':_0x0a7c('0x24'),'userProfileId':_0x232a58[_0x0a7c('0x56')]},'raw':!![]})[_0x0a7c('0x22')](function(_0x58ba59){if(_0x58ba59&&_0x58ba59[_0x0a7c('0x57')]===0x0){return db[_0x0a7c('0x58')]['create']({'name':_0x4000d9[_0x0a7c('0x29')],'resourceId':_0x4000d9['id'],'type':_0x58ba59[_0x0a7c('0x29')],'sectionId':_0x58ba59['id']},{})['then'](function(){return _0x5ae88b;});}else{return _0x5ae88b;}})[_0x0a7c('0x46')](function(_0x218d30){logger['error'](_0x0a7c('0x59'),_0x218d30);throw _0x218d30;});}return _0x5ae88b;})[_0x0a7c('0x22')](respondWithResult(_0xdd6652,0xc9))[_0x0a7c('0x46')](handleError(_0xdd6652,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 686f53c..a6fcf37 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 _0x7537=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util'];(function(_0x47e1f7,_0x295566){var _0x4687b3=function(_0x3d841d){while(--_0x3d841d){_0x47e1f7['push'](_0x47e1f7['shift']());}};_0x4687b3(++_0x295566);}(_0x7537,0x7c));var _0x7753=function(_0x42816e,_0x4d4e12){_0x42816e=_0x42816e-0x0;var _0x4d7c35=_0x7537[_0x42816e];return _0x4d7c35;};'use strict';var _=require(_0x7753('0x0'));var util=require(_0x7753('0x1'));var logger=require(_0x7753('0x2'))(_0x7753('0x3'));var moment=require(_0x7753('0x4'));var BPromise=require(_0x7753('0x5'));var rp=require(_0x7753('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7753('0x7'));var config=require('../../config/environment');var attributes=require(_0x7753('0x8'));module[_0x7753('0x9')]=function(_0x645ea2,_0x495904){return _0x645ea2[_0x7753('0xa')](_0x7753('0xb'),attributes,{'tableName':_0x7753('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7753('0xd')});}; \ No newline at end of file +var _0x1899=['./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x1899,0x148));var _0x9189=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x1899[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x9189('0x0'));var util=require('util');var logger=require(_0x9189('0x1'))(_0x9189('0x2'));var moment=require(_0x9189('0x3'));var BPromise=require(_0x9189('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9189('0x5'));var rimraf=require(_0x9189('0x6'));var config=require(_0x9189('0x7'));var attributes=require(_0x9189('0x8'));module[_0x9189('0x9')]=function(_0x452750,_0x19394c){return _0x452750['define'](_0x9189('0xa'),attributes,{'tableName':_0x9189('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9189('0xc'),'collate':_0x9189('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9dec99b..d04bc26 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(_0x13aab3,_0x47ae1c){var _0x4520fe=function(_0x46ba7d){while(--_0x46ba7d){_0x13aab3['push'](_0x13aab3['shift']());}};_0x4520fe(++_0x47ae1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0xf02e80,_0x23fae1){var _0x3ecba0=function(_0x15035c){while(--_0x15035c){_0xf02e80['push'](_0xf02e80['shift']());}};_0x3ecba0(++_0x23fae1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 8ecdb04..889e105 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 _0xdfbd=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','destroy','exports'];(function(_0x22fd8d,_0x52ba52){var _0x1fe685=function(_0x17db14){while(--_0x17db14){_0x22fd8d['push'](_0x22fd8d['shift']());}};_0x1fe685(++_0x52ba52);}(_0xdfbd,0xea));var _0xddfb=function(_0x4805b5,_0x546114){_0x4805b5=_0x4805b5-0x0;var _0x28cb53=_0xdfbd[_0x4805b5];return _0x28cb53;};'use strict';var multer=require(_0xddfb('0x0'));var util=require(_0xddfb('0x1'));var path=require(_0xddfb('0x2'));var timeout=require('connect-timeout');var express=require(_0xddfb('0x3'));var router=express[_0xddfb('0x4')]();var fs_extra=require(_0xddfb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xddfb('0x6'));var config=require(_0xddfb('0x7'));var controller=require('./cannedAnswer.controller');router[_0xddfb('0x8')]('/',auth[_0xddfb('0x9')](),controller[_0xddfb('0xa')]);router[_0xddfb('0x8')]('/:id',auth[_0xddfb('0x9')](),controller[_0xddfb('0xb')]);router[_0xddfb('0xc')]('/',auth['isAuthenticated'](),controller[_0xddfb('0xd')]);router[_0xddfb('0xe')](_0xddfb('0xf'),auth[_0xddfb('0x9')](),controller['update']);router['delete'](_0xddfb('0xf'),auth['isAuthenticated'](),controller[_0xddfb('0x10')]);module[_0xddfb('0x11')]=router; \ No newline at end of file +var _0x6094=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x57878e,_0x2b0acf){var _0xacb6e1=function(_0x9ec3e1){while(--_0x9ec3e1){_0x57878e['push'](_0x57878e['shift']());}};_0xacb6e1(++_0x2b0acf);}(_0x6094,0xc5));var _0x4609=function(_0x5ceb6e,_0x18ecd0){_0x5ceb6e=_0x5ceb6e-0x0;var _0x48cb26=_0x6094[_0x5ceb6e];return _0x48cb26;};'use strict';var multer=require(_0x4609('0x0'));var util=require(_0x4609('0x1'));var path=require(_0x4609('0x2'));var timeout=require(_0x4609('0x3'));var express=require(_0x4609('0x4'));var router=express[_0x4609('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4609('0x6'));var interaction=require(_0x4609('0x7'));var config=require(_0x4609('0x8'));var controller=require('./cannedAnswer.controller');router[_0x4609('0x9')]('/',auth['isAuthenticated'](),controller[_0x4609('0xa')]);router[_0x4609('0x9')](_0x4609('0xb'),auth[_0x4609('0xc')](),controller['show']);router['post']('/',auth[_0x4609('0xc')](),controller[_0x4609('0xd')]);router[_0x4609('0xe')](_0x4609('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4609('0xf')]('/:id',auth[_0x4609('0xc')](),controller['destroy']);module[_0x4609('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index eec3eb5..b3e922e 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 _0x3d0a=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x12af32,_0x8d8b5a){var _0x27d9e3=function(_0x199cee){while(--_0x199cee){_0x12af32['push'](_0x12af32['shift']());}};_0x27d9e3(++_0x8d8b5a);}(_0x3d0a,0xa9));var _0xa3d0=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3d0a[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xa3d0('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xa3d0('0x1')],'allowNull':![],'defaultValue':_0xa3d0('0x2')},'clid':{'type':Sequelize[_0xa3d0('0x3')]},'src':{'type':Sequelize[_0xa3d0('0x3')]},'dst':{'type':Sequelize[_0xa3d0('0x3')]},'dcontext':{'type':Sequelize[_0xa3d0('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xa3d0('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa3d0('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa3d0('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa3d0('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xa3d0('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa3d0('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b0b=['INTEGER','sequelize','exports','DATE','STRING'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0x1b0b,0x173));var _0xb1b0=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x1b0b[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xb1b0('0x0'));module[_0xb1b0('0x1')]={'calldate':{'type':Sequelize[_0xb1b0('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xb1b0('0x3')]},'src':{'type':Sequelize[_0xb1b0('0x3')]},'dst':{'type':Sequelize[_0xb1b0('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xb1b0('0x3')]},'lastdata':{'type':Sequelize[_0xb1b0('0x3')]},'duration':{'type':Sequelize[_0xb1b0('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb1b0('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb1b0('0x3')]},'amaflags':{'type':Sequelize[_0xb1b0('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb1b0('0x3')]},'userfield':{'type':Sequelize[_0xb1b0('0x3')]},'uniqueid':{'type':Sequelize[_0xb1b0('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xb1b0('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xb1b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b51cfff..6dcd160 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 _0xa1f6=['error','stack','name','send','index','map','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xa1f6[_0x3815c2];return _0x271f88;};'use strict';var emlformat=require(_0x6a1f('0x0'));var rimraf=require(_0x6a1f('0x1'));var zipdir=require(_0x6a1f('0x2'));var jsonpatch=require(_0x6a1f('0x3'));var rp=require(_0x6a1f('0x4'));var moment=require(_0x6a1f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6a1f('0x6'));var ejs=require(_0x6a1f('0x7'));var fs=require('fs');var fs_extra=require(_0x6a1f('0x8'));var _=require(_0x6a1f('0x9'));var squel=require(_0x6a1f('0xa'));var crypto=require(_0x6a1f('0xb'));var jsforce=require(_0x6a1f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a1f('0x6'));var querystring=require(_0x6a1f('0xd'));var Papa=require(_0x6a1f('0xe'));var Redis=require(_0x6a1f('0xf'));var authService=require(_0x6a1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a1f('0x11'));var hardwareService=require(_0x6a1f('0x12'));var logger=require(_0x6a1f('0x13'))(_0x6a1f('0x14'));var utils=require('../../config/utils');var config=require(_0x6a1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a1f('0x16'))['db'];function respondWithStatusCode(_0x17edb6,_0x2a4e94){_0x2a4e94=_0x2a4e94||0xcc;return function(_0x442576){if(_0x442576){return _0x17edb6[_0x6a1f('0x17')](_0x2a4e94);}return _0x17edb6[_0x6a1f('0x18')](_0x2a4e94)[_0x6a1f('0x19')]();};}function respondWithResult(_0x8c3a36,_0x1918c6){_0x1918c6=_0x1918c6||0xc8;return function(_0x27d8f8){if(_0x27d8f8){return _0x8c3a36[_0x6a1f('0x18')](_0x1918c6)[_0x6a1f('0x1a')](_0x27d8f8);}};}function respondWithFilteredResult(_0x253305,_0x2677c1){return function(_0x14ecec){if(_0x14ecec){var _0x11ee0e=typeof _0x2677c1[_0x6a1f('0x1b')]===_0x6a1f('0x1c')&&typeof _0x2677c1[_0x6a1f('0x1d')]==='undefined';var _0x392ccb=_0x14ecec[_0x6a1f('0x1e')];var _0x1ccbed=_0x11ee0e?0x0:_0x2677c1[_0x6a1f('0x1b')];var _0x21d268=_0x11ee0e?_0x14ecec[_0x6a1f('0x1e')]:_0x2677c1[_0x6a1f('0x1b')]+_0x2677c1[_0x6a1f('0x1d')];var _0x5cb044;if(_0x21d268>=_0x392ccb){_0x21d268=_0x392ccb;_0x5cb044=0xc8;}else{_0x5cb044=0xce;}_0x253305[_0x6a1f('0x18')](_0x5cb044);return _0x253305['set'](_0x6a1f('0x1f'),_0x1ccbed+'-'+_0x21d268+'/'+_0x392ccb)[_0x6a1f('0x1a')](_0x14ecec);}return null;};}function patchUpdates(_0x3c7ed0){return function(_0x1b5856){try{jsonpatch[_0x6a1f('0x20')](_0x1b5856,_0x3c7ed0,!![]);}catch(_0x4eae7f){return BPromise[_0x6a1f('0x21')](_0x4eae7f);}return _0x1b5856[_0x6a1f('0x22')]();};}function saveUpdates(_0xa43cd5,_0x1be0c3){return function(_0x312e75){if(_0x312e75){return _0x312e75[_0x6a1f('0x23')](_0xa43cd5)[_0x6a1f('0x24')](function(_0x2736ab){return _0x2736ab;});}return null;};}function removeEntity(_0x53229b,_0x1eb146){return function(_0x3d953d){if(_0x3d953d){return _0x3d953d['destroy']()['then'](function(){_0x53229b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea158,_0x5e6013){return function(_0x5abe40){if(!_0x5abe40){_0x3ea158[_0x6a1f('0x17')](0x194);}return _0x5abe40;};}function handleError(_0x286d1d,_0x2b53ca){_0x2b53ca=_0x2b53ca||0x1f4;return function(_0x1e8db8){logger[_0x6a1f('0x25')](_0x1e8db8[_0x6a1f('0x26')]);if(_0x1e8db8[_0x6a1f('0x27')]){delete _0x1e8db8[_0x6a1f('0x27')];}_0x286d1d['status'](_0x2b53ca)[_0x6a1f('0x28')](_0x1e8db8);};}exports[_0x6a1f('0x29')]=function(_0x3f0730,_0x574d80){var _0x1e951c={},_0x155c58={},_0x257cee={'count':0x0,'rows':[]};var _0x113422=_[_0x6a1f('0x2a')](db[_0x6a1f('0x2b')][_0x6a1f('0x2c')],function(_0x58d879){return{'name':_0x58d879['fieldName'],'type':_0x58d879[_0x6a1f('0x2d')][_0x6a1f('0x2e')]};});_0x155c58[_0x6a1f('0x2f')]=_[_0x6a1f('0x2a')](_0x113422,_0x6a1f('0x27'));_0x155c58[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x3f0730['query']);_0x155c58[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x155c58['model'],_0x155c58[_0x6a1f('0x30')]);_0x1e951c[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x155c58['model'],qs['fields'](_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x35')]));_0x1e951c[_0x6a1f('0x34')]=_0x1e951c['attributes']['length']?_0x1e951c[_0x6a1f('0x34')]:_0x155c58[_0x6a1f('0x2f')];if(!_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x36')](_0x6a1f('0x37'))){_0x1e951c[_0x6a1f('0x1d')]=qs[_0x6a1f('0x1d')](_0x3f0730['query'][_0x6a1f('0x1d')]);_0x1e951c['offset']=qs[_0x6a1f('0x1b')](_0x3f0730[_0x6a1f('0x30')]['offset']);}_0x1e951c[_0x6a1f('0x38')]=qs[_0x6a1f('0x39')](_0x3f0730['query'][_0x6a1f('0x39')]);_0x1e951c['where']=qs[_0x6a1f('0x32')](_['pick'](_0x3f0730[_0x6a1f('0x30')],_0x155c58['filters']),_0x113422);if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]){_0x1e951c['where']=_[_0x6a1f('0x3b')](_0x1e951c[_0x6a1f('0x3c')],{'$or':_['map'](_0x113422,function(_0x5beb28){if(_0x5beb28[_0x6a1f('0x2d')]!==_0x6a1f('0x3d')){var _0x314fef={};_0x314fef[_0x5beb28[_0x6a1f('0x27')]]={'$like':'%'+_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]+'%'};return _0x314fef;}})});}_0x1e951c=_['merge']({},_0x1e951c,_0x3f0730[_0x6a1f('0x3e')]);var _0x2da23a={'where':_0x1e951c[_0x6a1f('0x3c')]};return db[_0x6a1f('0x2b')][_0x6a1f('0x1e')](_0x2da23a)[_0x6a1f('0x24')](function(_0x27be0a){_0x257cee[_0x6a1f('0x1e')]=_0x27be0a;if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3f')]){_0x1e951c[_0x6a1f('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x6a1f('0x41')](_0x1e951c);})[_0x6a1f('0x24')](function(_0x334fc4){_0x257cee[_0x6a1f('0x42')]=_0x334fc4;return _0x257cee;})[_0x6a1f('0x24')](respondWithFilteredResult(_0x574d80,_0x1e951c))[_0x6a1f('0x43')](handleError(_0x574d80,null));};exports['show']=function(_0x211009,_0x482c3a){var _0x3a6f80={'raw':!![],'where':{'id':_0x211009[_0x6a1f('0x44')]['id']}},_0x33208d={};_0x33208d[_0x6a1f('0x2f')]=_[_0x6a1f('0x31')](db[_0x6a1f('0x2b')]['rawAttributes']);_0x33208d[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x211009[_0x6a1f('0x30')]);_0x33208d[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],_0x33208d[_0x6a1f('0x30')]);_0x3a6f80[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],qs['fields'](_0x211009['query']['fields']));_0x3a6f80[_0x6a1f('0x34')]=_0x3a6f80[_0x6a1f('0x34')][_0x6a1f('0x45')]?_0x3a6f80[_0x6a1f('0x34')]:_0x33208d[_0x6a1f('0x2f')];if(_0x211009[_0x6a1f('0x30')]['includeAll']){_0x3a6f80[_0x6a1f('0x40')]=[{'all':!![]}];}_0x3a6f80=_['merge']({},_0x3a6f80,_0x211009[_0x6a1f('0x3e')]);return db[_0x6a1f('0x2b')]['find'](_0x3a6f80)[_0x6a1f('0x24')](handleEntityNotFound(_0x482c3a,null))['then'](respondWithResult(_0x482c3a,null))[_0x6a1f('0x43')](handleError(_0x482c3a,null));};exports[_0x6a1f('0x46')]=function(_0xa864f3,_0x4318fd){return db[_0x6a1f('0x2b')][_0x6a1f('0x46')](_0xa864f3['body'],{})[_0x6a1f('0x24')](respondWithResult(_0x4318fd,0xc9))[_0x6a1f('0x43')](handleError(_0x4318fd,null));};exports[_0x6a1f('0x23')]=function(_0x2bea1a,_0x34fa17){if(_0x2bea1a[_0x6a1f('0x47')]['id']){delete _0x2bea1a[_0x6a1f('0x47')]['id'];}return db[_0x6a1f('0x2b')]['find']({'where':{'id':_0x2bea1a[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x34fa17,null))[_0x6a1f('0x24')](saveUpdates(_0x2bea1a['body'],null))[_0x6a1f('0x24')](respondWithResult(_0x34fa17,null))['catch'](handleError(_0x34fa17,null));};exports[_0x6a1f('0x48')]=function(_0x52c262,_0x366a60){return db['Cdr'][_0x6a1f('0x49')]({'where':{'id':_0x52c262[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x366a60,null))['then'](removeEntity(_0x366a60,null))[_0x6a1f('0x43')](handleError(_0x366a60,null));};exports['describe']=function(_0x143873,_0x55d114){return db['Cdr'][_0x6a1f('0x4a')]()[_0x6a1f('0x24')](respondWithResult(_0x55d114,null))['catch'](handleError(_0x55d114,null));}; \ No newline at end of file +var _0xbeea=['stack','name','index','map','Cdr','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','save','update','destroy','then','sendStatus'];(function(_0x5cba0e,_0x4fb1a6){var _0x5e1e19=function(_0x76779c){while(--_0x76779c){_0x5cba0e['push'](_0x5cba0e['shift']());}};_0x5e1e19(++_0x4fb1a6);}(_0xbeea,0xb1));var _0xabee=function(_0x4925de,_0x71d11d){_0x4925de=_0x4925de-0x0;var _0x6683df=_0xbeea[_0x4925de];return _0x6683df;};'use strict';var emlformat=require(_0xabee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabee('0x1'));var jsonpatch=require(_0xabee('0x2'));var rp=require(_0xabee('0x3'));var moment=require('moment');var BPromise=require(_0xabee('0x4'));var Mustache=require('mustache');var util=require(_0xabee('0x5'));var path=require(_0xabee('0x6'));var sox=require(_0xabee('0x7'));var csv=require(_0xabee('0x8'));var ejs=require(_0xabee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xabee('0xa'));var crypto=require(_0xabee('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xabee('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabee('0xd'));var Papa=require(_0xabee('0xe'));var Redis=require(_0xabee('0xf'));var authService=require(_0xabee('0x10'));var qs=require(_0xabee('0x11'));var as=require(_0xabee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabee('0x13'))(_0xabee('0x14'));var utils=require(_0xabee('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabee('0x16'));var db=require(_0xabee('0x17'))['db'];function respondWithStatusCode(_0x16d6a5,_0x49fb73){_0x49fb73=_0x49fb73||0xcc;return function(_0x5915a1){if(_0x5915a1){return _0x16d6a5['sendStatus'](_0x49fb73);}return _0x16d6a5['status'](_0x49fb73)['end']();};}function respondWithResult(_0x113c5c,_0x370a4e){_0x370a4e=_0x370a4e||0xc8;return function(_0x38ba29){if(_0x38ba29){return _0x113c5c[_0xabee('0x18')](_0x370a4e)[_0xabee('0x19')](_0x38ba29);}};}function respondWithFilteredResult(_0x5e94ff,_0x177670){return function(_0x2d85a4){if(_0x2d85a4){var _0x2f1107=typeof _0x177670[_0xabee('0x1a')]===_0xabee('0x1b')&&typeof _0x177670[_0xabee('0x1c')]===_0xabee('0x1b');var _0x5a9562=_0x2d85a4[_0xabee('0x1d')];var _0x112bb9=_0x2f1107?0x0:_0x177670[_0xabee('0x1a')];var _0x471b24=_0x2f1107?_0x2d85a4[_0xabee('0x1d')]:_0x177670[_0xabee('0x1a')]+_0x177670['limit'];var _0x47fa3f;if(_0x471b24>=_0x5a9562){_0x471b24=_0x5a9562;_0x47fa3f=0xc8;}else{_0x47fa3f=0xce;}_0x5e94ff[_0xabee('0x18')](_0x47fa3f);return _0x5e94ff['set']('Content-Range',_0x112bb9+'-'+_0x471b24+'/'+_0x5a9562)[_0xabee('0x19')](_0x2d85a4);}return null;};}function patchUpdates(_0x443301){return function(_0x3dd1ff){try{jsonpatch[_0xabee('0x1e')](_0x3dd1ff,_0x443301,!![]);}catch(_0x2b66f5){return BPromise['reject'](_0x2b66f5);}return _0x3dd1ff[_0xabee('0x1f')]();};}function saveUpdates(_0x54014d,_0x4f5501){return function(_0x4926d7){if(_0x4926d7){return _0x4926d7[_0xabee('0x20')](_0x54014d)['then'](function(_0x870569){return _0x870569;});}return null;};}function removeEntity(_0x2834e3,_0x520bc){return function(_0x15a36c){if(_0x15a36c){return _0x15a36c[_0xabee('0x21')]()[_0xabee('0x22')](function(){_0x2834e3[_0xabee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdbbf57,_0xfc419d){return function(_0x42277e){if(!_0x42277e){_0xdbbf57[_0xabee('0x23')](0x194);}return _0x42277e;};}function handleError(_0x4ae65e,_0x2aa470){_0x2aa470=_0x2aa470||0x1f4;return function(_0x123d58){logger['error'](_0x123d58[_0xabee('0x24')]);if(_0x123d58[_0xabee('0x25')]){delete _0x123d58[_0xabee('0x25')];}_0x4ae65e[_0xabee('0x18')](_0x2aa470)['send'](_0x123d58);};}exports[_0xabee('0x26')]=function(_0x2b7464,_0x1b5aee){var _0x37e780={},_0x1c4f51={},_0x116e41={'count':0x0,'rows':[]};var _0x3df00d=_[_0xabee('0x27')](db[_0xabee('0x28')]['rawAttributes'],function(_0x2a2441){return{'name':_0x2a2441['fieldName'],'type':_0x2a2441[_0xabee('0x29')][_0xabee('0x2a')]};});_0x1c4f51[_0xabee('0x2b')]=_[_0xabee('0x27')](_0x3df00d,'name');_0x1c4f51[_0xabee('0x2c')]=_['keys'](_0x2b7464[_0xabee('0x2c')]);_0x1c4f51['filters']=_[_0xabee('0x2d')](_0x1c4f51['model'],_0x1c4f51['query']);_0x37e780[_0xabee('0x2e')]=_[_0xabee('0x2d')](_0x1c4f51[_0xabee('0x2b')],qs[_0xabee('0x2f')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x2f')]));_0x37e780[_0xabee('0x2e')]=_0x37e780[_0xabee('0x2e')]['length']?_0x37e780[_0xabee('0x2e')]:_0x1c4f51[_0xabee('0x2b')];if(!_0x2b7464[_0xabee('0x2c')][_0xabee('0x30')](_0xabee('0x31'))){_0x37e780[_0xabee('0x1c')]=qs[_0xabee('0x1c')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x1c')]);_0x37e780[_0xabee('0x1a')]=qs[_0xabee('0x1a')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x1a')]);}_0x37e780[_0xabee('0x32')]=qs[_0xabee('0x33')](_0x2b7464[_0xabee('0x2c')][_0xabee('0x33')]);_0x37e780['where']=qs['filters'](_[_0xabee('0x34')](_0x2b7464[_0xabee('0x2c')],_0x1c4f51[_0xabee('0x35')]),_0x3df00d);if(_0x2b7464[_0xabee('0x2c')]['filter']){_0x37e780[_0xabee('0x36')]=_[_0xabee('0x37')](_0x37e780[_0xabee('0x36')],{'$or':_['map'](_0x3df00d,function(_0x1a48d5){if(_0x1a48d5['type']!==_0xabee('0x38')){var _0x879d31={};_0x879d31[_0x1a48d5[_0xabee('0x25')]]={'$like':'%'+_0x2b7464[_0xabee('0x2c')]['filter']+'%'};return _0x879d31;}})});}_0x37e780=_['merge']({},_0x37e780,_0x2b7464[_0xabee('0x39')]);var _0xb76b1d={'where':_0x37e780[_0xabee('0x36')]};return db[_0xabee('0x28')][_0xabee('0x1d')](_0xb76b1d)['then'](function(_0x229b00){_0x116e41[_0xabee('0x1d')]=_0x229b00;if(_0x2b7464['query'][_0xabee('0x3a')]){_0x37e780[_0xabee('0x3b')]=[{'all':!![]}];}return db['Cdr'][_0xabee('0x3c')](_0x37e780);})[_0xabee('0x22')](function(_0x3f05ee){_0x116e41[_0xabee('0x3d')]=_0x3f05ee;return _0x116e41;})[_0xabee('0x22')](respondWithFilteredResult(_0x1b5aee,_0x37e780))[_0xabee('0x3e')](handleError(_0x1b5aee,null));};exports[_0xabee('0x3f')]=function(_0x4ee7e6,_0x36fc07){var _0x22fc91={'raw':!![],'where':{'id':_0x4ee7e6['params']['id']}},_0x206350={};_0x206350[_0xabee('0x2b')]=_[_0xabee('0x40')](db['Cdr'][_0xabee('0x41')]);_0x206350[_0xabee('0x2c')]=_['keys'](_0x4ee7e6[_0xabee('0x2c')]);_0x206350[_0xabee('0x35')]=_[_0xabee('0x2d')](_0x206350[_0xabee('0x2b')],_0x206350[_0xabee('0x2c')]);_0x22fc91[_0xabee('0x2e')]=_[_0xabee('0x2d')](_0x206350['model'],qs[_0xabee('0x2f')](_0x4ee7e6[_0xabee('0x2c')][_0xabee('0x2f')]));_0x22fc91['attributes']=_0x22fc91[_0xabee('0x2e')][_0xabee('0x42')]?_0x22fc91['attributes']:_0x206350['model'];if(_0x4ee7e6['query'][_0xabee('0x3a')]){_0x22fc91[_0xabee('0x3b')]=[{'all':!![]}];}_0x22fc91=_['merge']({},_0x22fc91,_0x4ee7e6['options']);return db[_0xabee('0x28')][_0xabee('0x43')](_0x22fc91)[_0xabee('0x22')](handleEntityNotFound(_0x36fc07,null))[_0xabee('0x22')](respondWithResult(_0x36fc07,null))[_0xabee('0x3e')](handleError(_0x36fc07,null));};exports[_0xabee('0x44')]=function(_0x430b08,_0x307d34){return db[_0xabee('0x28')][_0xabee('0x44')](_0x430b08[_0xabee('0x45')],{})[_0xabee('0x22')](respondWithResult(_0x307d34,0xc9))[_0xabee('0x3e')](handleError(_0x307d34,null));};exports[_0xabee('0x20')]=function(_0x3e277d,_0x252f60){if(_0x3e277d[_0xabee('0x45')]['id']){delete _0x3e277d[_0xabee('0x45')]['id'];}return db['Cdr'][_0xabee('0x43')]({'where':{'id':_0x3e277d[_0xabee('0x46')]['id']}})['then'](handleEntityNotFound(_0x252f60,null))['then'](saveUpdates(_0x3e277d[_0xabee('0x45')],null))[_0xabee('0x22')](respondWithResult(_0x252f60,null))[_0xabee('0x3e')](handleError(_0x252f60,null));};exports[_0xabee('0x21')]=function(_0xe2433f,_0x3d819a){return db[_0xabee('0x28')]['find']({'where':{'id':_0xe2433f[_0xabee('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d819a,null))[_0xabee('0x22')](removeEntity(_0x3d819a,null))[_0xabee('0x3e')](handleError(_0x3d819a,null));};exports['describe']=function(_0x3ebd50,_0x3aaf14){return db[_0xabee('0x28')]['describe']()[_0xabee('0x22')](respondWithResult(_0x3aaf14,null))['catch'](handleError(_0x3aaf14,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c21391a..ba57417 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x148c5c,_0x1b5c70){var _0x5ec287=function(_0x3a3c19){while(--_0x3a3c19){_0x148c5c['push'](_0x148c5c['shift']());}};_0x5ec287(++_0x1b5c70);}(_0x7a54,0x106));var _0x47a5=function(_0x55803d,_0x4c9027){_0x55803d=_0x55803d-0x0;var _0x3504ba=_0x7a54[_0x55803d];return _0x3504ba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2854f9,_0x10c35f){var _0x331008=function(_0x16820d){while(--_0x16820d){_0x2854f9['push'](_0x2854f9['shift']());}};_0x331008(++_0x10c35f);}(_0x7a54,0x106));var _0x47a5=function(_0x409b10,_0x4d8646){_0x409b10=_0x409b10-0x0;var _0x4e5f05=_0x7a54[_0x409b10];return _0x4e5f05;};'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 d5a606e..f2e180c 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 _0xc604=['request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','Cdr,\x20%s,\x20%s'];(function(_0x4214b1,_0x228fa4){var _0x2abe03=function(_0x1670cf){while(--_0x1670cf){_0x4214b1['push'](_0x4214b1['shift']());}};_0x2abe03(++_0x228fa4);}(_0xc604,0xed));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c60('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c60('0x1'));var db=require(_0x4c60('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c60('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c60('0x4')][_0x4c60('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x342f99,_0x3fc1b1,_0x437898){return new BPromise(function(_0x1664d5,_0x58f72a){return client[_0x4c60('0x6')](_0x342f99,_0x437898)[_0x4c60('0x7')](function(_0x2a95f2){logger[_0x4c60('0x8')](_0x4c60('0x9'),_0x3fc1b1,_0x4c60('0xa'));logger[_0x4c60('0xb')](_0x4c60('0xc'),_0x3fc1b1,_0x4c60('0xa'),JSON[_0x4c60('0xd')](_0x2a95f2));if(_0x2a95f2[_0x4c60('0xe')]){if(_0x2a95f2[_0x4c60('0xe')][_0x4c60('0xf')]===0x1f4){logger[_0x4c60('0xe')](_0x4c60('0x9'),_0x3fc1b1,_0x2a95f2['error']['message']);return _0x58f72a(_0x2a95f2[_0x4c60('0xe')][_0x4c60('0x10')]);}logger[_0x4c60('0xe')](_0x4c60('0x9'),_0x3fc1b1,_0x2a95f2[_0x4c60('0xe')][_0x4c60('0x10')]);return _0x1664d5(_0x2a95f2[_0x4c60('0xe')][_0x4c60('0x10')]);}else{logger[_0x4c60('0x8')](_0x4c60('0x9'),_0x3fc1b1,'request\x20sent');_0x1664d5(_0x2a95f2[_0x4c60('0x11')][_0x4c60('0x10')]);}})[_0x4c60('0x12')](function(_0x5d9424){logger[_0x4c60('0xe')](_0x4c60('0x9'),_0x3fc1b1,_0x5d9424);_0x58f72a(_0x5d9424);});});} \ No newline at end of file +var _0xe307=['code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x563023,_0x33bbbb){var _0x8e7784=function(_0x563a92){while(--_0x563a92){_0x563023['push'](_0x563023['shift']());}};_0x8e7784(++_0x33bbbb);}(_0xe307,0xd4));var _0x7e30=function(_0x226bc5,_0x29fb55){_0x226bc5=_0x226bc5-0x0;var _0x50d54d=_0xe307[_0x226bc5];return _0x50d54d;};'use strict';var _=require(_0x7e30('0x0'));var util=require('util');var moment=require(_0x7e30('0x1'));var BPromise=require(_0x7e30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e30('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e30('0x4'))(_0x7e30('0x5'));var config=require('../../config/environment');var jayson=require(_0x7e30('0x6'));var client=jayson[_0x7e30('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x289f77,_0x399102,_0x5e9840){return new BPromise(function(_0x5bc961,_0x4bbe5a){return client[_0x7e30('0x8')](_0x289f77,_0x5e9840)[_0x7e30('0x9')](function(_0x3491c3){logger[_0x7e30('0xa')](_0x7e30('0xb'),_0x399102,_0x7e30('0xc'));logger[_0x7e30('0xd')]('Cdr,\x20%s,\x20%s,\x20%s',_0x399102,_0x7e30('0xc'),JSON[_0x7e30('0xe')](_0x3491c3));if(_0x3491c3[_0x7e30('0xf')]){if(_0x3491c3[_0x7e30('0xf')][_0x7e30('0x10')]===0x1f4){logger[_0x7e30('0xf')]('Cdr,\x20%s,\x20%s',_0x399102,_0x3491c3[_0x7e30('0xf')][_0x7e30('0x11')]);return _0x4bbe5a(_0x3491c3[_0x7e30('0xf')][_0x7e30('0x11')]);}logger[_0x7e30('0xf')](_0x7e30('0xb'),_0x399102,_0x3491c3[_0x7e30('0xf')]['message']);return _0x5bc961(_0x3491c3['error']['message']);}else{logger['info'](_0x7e30('0xb'),_0x399102,_0x7e30('0xc'));_0x5bc961(_0x3491c3[_0x7e30('0x12')]['message']);}})['catch'](function(_0x51172b){logger['error'](_0x7e30('0xb'),_0x399102,_0x51172b);_0x4bbe5a(_0x51172b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 80a087c..d7d5e11 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x47cfa0,_0x176b87){var _0x386b1d=function(_0x5785e5){while(--_0x5785e5){_0x47cfa0['push'](_0x47cfa0['shift']());}};_0x386b1d(++_0x176b87);}(_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 +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(_0x251895,_0x414adb){var _0x70b2dd=function(_0x340030){while(--_0x340030){_0x251895['push'](_0x251895['shift']());}};_0x70b2dd(++_0x414adb);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a634850..7e8d80d 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 _0xeb88=['STRING','INTEGER','TEXT'];(function(_0x33ff0c,_0x448c2a){var _0x44bdc2=function(_0x4f8652){while(--_0x4f8652){_0x33ff0c['push'](_0x33ff0c['shift']());}};_0x44bdc2(++_0x448c2a);}(_0xeb88,0x124));var _0x8eb8=function(_0x2f89eb,_0x5623d2){_0x2f89eb=_0x2f89eb-0x0;var _0x53edbc=_0xeb88[_0x2f89eb];return _0x53edbc;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8eb8('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8eb8('0x1')]()},'description':{'type':Sequelize[_0x8eb8('0x2')]},'interval':{'type':Sequelize[_0x8eb8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x17d3=['*,*,*,*','sequelize','STRING','noop'];(function(_0x1df32f,_0x37dca3){var _0x40ec9a=function(_0xfe2fec){while(--_0xfe2fec){_0x1df32f['push'](_0x1df32f['shift']());}};_0x40ec9a(++_0x37dca3);}(_0x17d3,0x71));var _0x317d=function(_0x2bb776,_0x51d4a2){_0x2bb776=_0x2bb776-0x0;var _0x34654b=_0x17d3[_0x2bb776];return _0x34654b;};'use strict';var Sequelize=require(_0x317d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x317d('0x1')],'allowNull':![],'defaultValue':_0x317d('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x317d('0x1')],'defaultValue':_0x317d('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 740d39c..7ab1bf9 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 _0x4977=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','name','send','show','params','keys','ChatApplication','query','intersection','attributes','model','fields','length','includeAll','options','body','catch','find','eml-format','rimraf','zip-dir'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x4977,0x1cd));var _0x7497=function(_0x1d9b56,_0x1f3422){_0x1d9b56=_0x1d9b56-0x0;var _0x3af3cb=_0x4977[_0x1d9b56];return _0x3af3cb;};'use strict';var emlformat=require(_0x7497('0x0'));var rimraf=require(_0x7497('0x1'));var zipdir=require(_0x7497('0x2'));var jsonpatch=require(_0x7497('0x3'));var rp=require(_0x7497('0x4'));var moment=require('moment');var BPromise=require(_0x7497('0x5'));var Mustache=require(_0x7497('0x6'));var util=require(_0x7497('0x7'));var path=require(_0x7497('0x8'));var sox=require(_0x7497('0x9'));var csv=require(_0x7497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7497('0xb'));var _=require(_0x7497('0xc'));var squel=require(_0x7497('0xd'));var crypto=require(_0x7497('0xe'));var jsforce=require(_0x7497('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7497('0xa'));var querystring=require(_0x7497('0x10'));var Papa=require('papaparse');var Redis=require(_0x7497('0x11'));var authService=require(_0x7497('0x12'));var qs=require(_0x7497('0x13'));var as=require(_0x7497('0x14'));var hardwareService=require(_0x7497('0x15'));var logger=require(_0x7497('0x16'))(_0x7497('0x17'));var utils=require(_0x7497('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7497('0x19'));var db=require(_0x7497('0x1a'))['db'];function respondWithStatusCode(_0x5e327f,_0x5be343){_0x5be343=_0x5be343||0xcc;return function(_0x1845c9){if(_0x1845c9){return _0x5e327f[_0x7497('0x1b')](_0x5be343);}return _0x5e327f[_0x7497('0x1c')](_0x5be343)[_0x7497('0x1d')]();};}function respondWithResult(_0x20faeb,_0x5242b3){_0x5242b3=_0x5242b3||0xc8;return function(_0x454656){if(_0x454656){return _0x20faeb['status'](_0x5242b3)[_0x7497('0x1e')](_0x454656);}};}function respondWithFilteredResult(_0x366ee3,_0x1b240e){return function(_0x44c562){if(_0x44c562){var _0x2f3dce=typeof _0x1b240e['offset']===_0x7497('0x1f')&&typeof _0x1b240e[_0x7497('0x20')]===_0x7497('0x1f');var _0x72b64d=_0x44c562[_0x7497('0x21')];var _0x5a2995=_0x2f3dce?0x0:_0x1b240e['offset'];var _0x41269c=_0x2f3dce?_0x44c562[_0x7497('0x21')]:_0x1b240e[_0x7497('0x22')]+_0x1b240e[_0x7497('0x20')];var _0x324ab3;if(_0x41269c>=_0x72b64d){_0x41269c=_0x72b64d;_0x324ab3=0xc8;}else{_0x324ab3=0xce;}_0x366ee3[_0x7497('0x1c')](_0x324ab3);return _0x366ee3['set'](_0x7497('0x23'),_0x5a2995+'-'+_0x41269c+'/'+_0x72b64d)[_0x7497('0x1e')](_0x44c562);}return null;};}function patchUpdates(_0x142ce0){return function(_0x43910d){try{jsonpatch['apply'](_0x43910d,_0x142ce0,!![]);}catch(_0x456b5d){return BPromise[_0x7497('0x24')](_0x456b5d);}return _0x43910d[_0x7497('0x25')]();};}function saveUpdates(_0x31a354,_0x37c1f8){return function(_0x1fe043){if(_0x1fe043){return _0x1fe043[_0x7497('0x26')](_0x31a354)[_0x7497('0x27')](function(_0x4ee3f0){return _0x4ee3f0;});}return null;};}function removeEntity(_0x5a78ce,_0x16ef09){return function(_0x45b4bc){if(_0x45b4bc){return _0x45b4bc[_0x7497('0x28')]()[_0x7497('0x27')](function(){_0x5a78ce[_0x7497('0x1c')](0xcc)[_0x7497('0x1d')]();});}};}function handleEntityNotFound(_0x17b9ad,_0x5775d4){return function(_0x18a5dd){if(!_0x18a5dd){_0x17b9ad[_0x7497('0x1b')](0x194);}return _0x18a5dd;};}function handleError(_0x3dd18d,_0x3d1d50){_0x3d1d50=_0x3d1d50||0x1f4;return function(_0x18ce8d){logger['error'](_0x18ce8d['stack']);if(_0x18ce8d[_0x7497('0x29')]){delete _0x18ce8d[_0x7497('0x29')];}_0x3dd18d[_0x7497('0x1c')](_0x3d1d50)[_0x7497('0x2a')](_0x18ce8d);};}exports[_0x7497('0x2b')]=function(_0x452142,_0xea2a5){var _0xdbcbc1={'raw':!![],'where':{'id':_0x452142[_0x7497('0x2c')]['id']}},_0x4e4c05={};_0x4e4c05['model']=_[_0x7497('0x2d')](db[_0x7497('0x2e')]['rawAttributes']);_0x4e4c05['query']=_[_0x7497('0x2d')](_0x452142[_0x7497('0x2f')]);_0x4e4c05['filters']=_[_0x7497('0x30')](_0x4e4c05['model'],_0x4e4c05[_0x7497('0x2f')]);_0xdbcbc1[_0x7497('0x31')]=_[_0x7497('0x30')](_0x4e4c05[_0x7497('0x32')],qs[_0x7497('0x33')](_0x452142[_0x7497('0x2f')][_0x7497('0x33')]));_0xdbcbc1['attributes']=_0xdbcbc1[_0x7497('0x31')][_0x7497('0x34')]?_0xdbcbc1[_0x7497('0x31')]:_0x4e4c05['model'];if(_0x452142[_0x7497('0x2f')][_0x7497('0x35')]){_0xdbcbc1['include']=[{'all':!![]}];}_0xdbcbc1=_['merge']({},_0xdbcbc1,_0x452142[_0x7497('0x36')]);return db[_0x7497('0x2e')]['find'](_0xdbcbc1)[_0x7497('0x27')](handleEntityNotFound(_0xea2a5,null))['then'](respondWithResult(_0xea2a5,null))['catch'](handleError(_0xea2a5,null));};exports[_0x7497('0x26')]=function(_0x1c15c9,_0x157cad){if(_0x1c15c9[_0x7497('0x37')]['id']){delete _0x1c15c9['body']['id'];}return db[_0x7497('0x2e')]['find']({'where':{'id':_0x1c15c9[_0x7497('0x2c')]['id']}})[_0x7497('0x27')](handleEntityNotFound(_0x157cad,null))[_0x7497('0x27')](saveUpdates(_0x1c15c9[_0x7497('0x37')],null))[_0x7497('0x27')](respondWithResult(_0x157cad,null))[_0x7497('0x38')](handleError(_0x157cad,null));};exports[_0x7497('0x28')]=function(_0x257a13,_0x9dccd9){return db[_0x7497('0x2e')][_0x7497('0x39')]({'where':{'id':_0x257a13[_0x7497('0x2c')]['id']}})[_0x7497('0x27')](handleEntityNotFound(_0x9dccd9,null))['then'](removeEntity(_0x9dccd9,null))[_0x7497('0x38')](handleError(_0x9dccd9,null));}; \ No newline at end of file +var _0x235a=['offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','model','includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x235a,0x1ef));var _0xa235=function(_0x1e60cc,_0x31bed7){_0x1e60cc=_0x1e60cc-0x0;var _0x473266=_0x235a[_0x1e60cc];return _0x473266;};'use strict';var emlformat=require(_0xa235('0x0'));var rimraf=require(_0xa235('0x1'));var zipdir=require(_0xa235('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa235('0x3'));var moment=require('moment');var BPromise=require(_0xa235('0x4'));var Mustache=require(_0xa235('0x5'));var util=require(_0xa235('0x6'));var path=require(_0xa235('0x7'));var sox=require(_0xa235('0x8'));var csv=require(_0xa235('0x9'));var ejs=require(_0xa235('0xa'));var fs=require('fs');var fs_extra=require(_0xa235('0xb'));var _=require('lodash');var squel=require(_0xa235('0xc'));var crypto=require(_0xa235('0xd'));var jsforce=require(_0xa235('0xe'));var deskjs=require(_0xa235('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa235('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa235('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa235('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa235('0x13'));var config=require(_0xa235('0x14'));var licenseUtil=require(_0xa235('0x15'));var db=require(_0xa235('0x16'))['db'];function respondWithStatusCode(_0x5330db,_0x5510ff){_0x5510ff=_0x5510ff||0xcc;return function(_0x47aad7){if(_0x47aad7){return _0x5330db[_0xa235('0x17')](_0x5510ff);}return _0x5330db[_0xa235('0x18')](_0x5510ff)[_0xa235('0x19')]();};}function respondWithResult(_0x3bf6fc,_0x36b4b1){_0x36b4b1=_0x36b4b1||0xc8;return function(_0x44ea6a){if(_0x44ea6a){return _0x3bf6fc[_0xa235('0x18')](_0x36b4b1)[_0xa235('0x1a')](_0x44ea6a);}};}function respondWithFilteredResult(_0x1369de,_0x4aceee){return function(_0x352463){if(_0x352463){var _0x20cd67=typeof _0x4aceee[_0xa235('0x1b')]===_0xa235('0x1c')&&typeof _0x4aceee[_0xa235('0x1d')]===_0xa235('0x1c');var _0x5c6e95=_0x352463['count'];var _0x446ea2=_0x20cd67?0x0:_0x4aceee[_0xa235('0x1b')];var _0x2b3769=_0x20cd67?_0x352463['count']:_0x4aceee[_0xa235('0x1b')]+_0x4aceee[_0xa235('0x1d')];var _0x3ca514;if(_0x2b3769>=_0x5c6e95){_0x2b3769=_0x5c6e95;_0x3ca514=0xc8;}else{_0x3ca514=0xce;}_0x1369de[_0xa235('0x18')](_0x3ca514);return _0x1369de[_0xa235('0x1e')](_0xa235('0x1f'),_0x446ea2+'-'+_0x2b3769+'/'+_0x5c6e95)[_0xa235('0x1a')](_0x352463);}return null;};}function patchUpdates(_0x483771){return function(_0x5a3bea){try{jsonpatch[_0xa235('0x20')](_0x5a3bea,_0x483771,!![]);}catch(_0x21940f){return BPromise[_0xa235('0x21')](_0x21940f);}return _0x5a3bea[_0xa235('0x22')]();};}function saveUpdates(_0x2e38e,_0x3deeea){return function(_0x3d9f70){if(_0x3d9f70){return _0x3d9f70[_0xa235('0x23')](_0x2e38e)[_0xa235('0x24')](function(_0x216083){return _0x216083;});}return null;};}function removeEntity(_0x3219f1,_0x20292c){return function(_0xee45e1){if(_0xee45e1){return _0xee45e1[_0xa235('0x25')]()[_0xa235('0x24')](function(){_0x3219f1[_0xa235('0x18')](0xcc)[_0xa235('0x19')]();});}};}function handleEntityNotFound(_0x13c868,_0x976c9f){return function(_0x1cb892){if(!_0x1cb892){_0x13c868[_0xa235('0x17')](0x194);}return _0x1cb892;};}function handleError(_0x57f591,_0xe1176c){_0xe1176c=_0xe1176c||0x1f4;return function(_0x533b15){logger[_0xa235('0x26')](_0x533b15['stack']);if(_0x533b15[_0xa235('0x27')]){delete _0x533b15[_0xa235('0x27')];}_0x57f591[_0xa235('0x18')](_0xe1176c)[_0xa235('0x28')](_0x533b15);};}exports[_0xa235('0x29')]=function(_0x5d811a,_0x2585c7){var _0x612f2={'raw':!![],'where':{'id':_0x5d811a['params']['id']}},_0x55a21e={};_0x55a21e['model']=_['keys'](db[_0xa235('0x2a')][_0xa235('0x2b')]);_0x55a21e[_0xa235('0x2c')]=_[_0xa235('0x2d')](_0x5d811a[_0xa235('0x2c')]);_0x55a21e[_0xa235('0x2e')]=_[_0xa235('0x2f')](_0x55a21e['model'],_0x55a21e['query']);_0x612f2[_0xa235('0x30')]=_[_0xa235('0x2f')](_0x55a21e['model'],qs[_0xa235('0x31')](_0x5d811a[_0xa235('0x2c')][_0xa235('0x31')]));_0x612f2[_0xa235('0x30')]=_0x612f2[_0xa235('0x30')][_0xa235('0x32')]?_0x612f2[_0xa235('0x30')]:_0x55a21e[_0xa235('0x33')];if(_0x5d811a['query'][_0xa235('0x34')]){_0x612f2['include']=[{'all':!![]}];}_0x612f2=_[_0xa235('0x35')]({},_0x612f2,_0x5d811a[_0xa235('0x36')]);return db[_0xa235('0x2a')][_0xa235('0x37')](_0x612f2)[_0xa235('0x24')](handleEntityNotFound(_0x2585c7,null))[_0xa235('0x24')](respondWithResult(_0x2585c7,null))[_0xa235('0x38')](handleError(_0x2585c7,null));};exports[_0xa235('0x23')]=function(_0xa1b9d2,_0x34bba1){if(_0xa1b9d2[_0xa235('0x39')]['id']){delete _0xa1b9d2[_0xa235('0x39')]['id'];}return db[_0xa235('0x2a')]['find']({'where':{'id':_0xa1b9d2['params']['id']}})['then'](handleEntityNotFound(_0x34bba1,null))[_0xa235('0x24')](saveUpdates(_0xa1b9d2['body'],null))[_0xa235('0x24')](respondWithResult(_0x34bba1,null))[_0xa235('0x38')](handleError(_0x34bba1,null));};exports[_0xa235('0x25')]=function(_0x21a835,_0x473af7){return db[_0xa235('0x2a')][_0xa235('0x37')]({'where':{'id':_0x21a835['params']['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x473af7,null))[_0xa235('0x24')](removeEntity(_0x473af7,null))['catch'](handleError(_0x473af7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fc67dfc..99b32d6 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 _0x5693=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4c825d,_0x10ec2b){var _0x43de87=function(_0xcab4a3){while(--_0xcab4a3){_0x4c825d['push'](_0x4c825d['shift']());}};_0x43de87(++_0x10ec2b);}(_0x5693,0x1d2));var _0x3569=function(_0x14a69f,_0x159b4e){_0x14a69f=_0x14a69f-0x0;var _0x4d542c=_0x5693[_0x14a69f];return _0x4d542c;};'use strict';var _=require(_0x3569('0x0'));var util=require(_0x3569('0x1'));var logger=require(_0x3569('0x2'))('api');var moment=require(_0x3569('0x3'));var BPromise=require(_0x3569('0x4'));var rp=require(_0x3569('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3569('0x6'));var config=require(_0x3569('0x7'));var attributes=require('./chatApplication.attributes');module[_0x3569('0x8')]=function(_0x4376ef,_0x502b41){return _0x4376ef[_0x3569('0x9')](_0x3569('0xa'),attributes,{'tableName':_0x3569('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3569('0xc'),'collate':_0x3569('0xd')});}; \ No newline at end of file +var _0x6c91=['define','ChatApplication','chat_applications','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes'];(function(_0x48c8fe,_0x5e89a5){var _0xaa78ca=function(_0x140b38){while(--_0x140b38){_0x48c8fe['push'](_0x48c8fe['shift']());}};_0xaa78ca(++_0x5e89a5);}(_0x6c91,0x85));var _0x16c9=function(_0x3f127e,_0x5724f2){_0x3f127e=_0x3f127e-0x0;var _0x23e0ff=_0x6c91[_0x3f127e];return _0x23e0ff;};'use strict';var _=require(_0x16c9('0x0'));var util=require(_0x16c9('0x1'));var logger=require(_0x16c9('0x2'))(_0x16c9('0x3'));var moment=require(_0x16c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x16c9('0x5'));var fs=require('fs');var path=require(_0x16c9('0x6'));var rimraf=require(_0x16c9('0x7'));var config=require(_0x16c9('0x8'));var attributes=require(_0x16c9('0x9'));module['exports']=function(_0x53391b,_0x47bdb6){return _0x53391b[_0x16c9('0xa')](_0x16c9('0xb'),attributes,{'tableName':_0x16c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 458e2ec..62d4be4 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 _0xbedd=['util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','lodash'];(function(_0x659eb6,_0x264282){var _0x252fbe=function(_0x3967a7){while(--_0x3967a7){_0x659eb6['push'](_0x659eb6['shift']());}};_0x252fbe(++_0x264282);}(_0xbedd,0x17b));var _0xdbed=function(_0x3e7ae6,_0x2e14d9){_0x3e7ae6=_0x3e7ae6-0x0;var _0xdfaa19=_0xbedd[_0x3e7ae6];return _0xdfaa19;};'use strict';var _=require(_0xdbed('0x0'));var util=require(_0xdbed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdbed('0x2'));var fs=require('fs');var Redis=require(_0xdbed('0x3'));var db=require(_0xdbed('0x4'))['db'];var utils=require(_0xdbed('0x5'));var logger=require('../../config/logger')(_0xdbed('0x6'));var config=require('../../config/environment');var jayson=require(_0xdbed('0x7'));var client=jayson[_0xdbed('0x8')][_0xdbed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410d51,_0x365980,_0x4a3cb5){return new BPromise(function(_0x509e5c,_0x33e95f){return client['request'](_0x410d51,_0x4a3cb5)[_0xdbed('0xa')](function(_0x582919){logger['info'](_0xdbed('0xb'),_0x365980,_0xdbed('0xc'));logger[_0xdbed('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x365980,_0xdbed('0xc'),JSON[_0xdbed('0xe')](_0x582919));if(_0x582919[_0xdbed('0xf')]){if(_0x582919[_0xdbed('0xf')]['code']===0x1f4){logger[_0xdbed('0xf')](_0xdbed('0xb'),_0x365980,_0x582919['error'][_0xdbed('0x10')]);return _0x33e95f(_0x582919[_0xdbed('0xf')]['message']);}logger[_0xdbed('0xf')](_0xdbed('0xb'),_0x365980,_0x582919['error']['message']);return _0x509e5c(_0x582919[_0xdbed('0xf')]['message']);}else{logger[_0xdbed('0x11')](_0xdbed('0xb'),_0x365980,'request\x20sent');_0x509e5c(_0x582919['result']['message']);}})[_0xdbed('0x12')](function(_0x39d13e){logger['error'](_0xdbed('0xb'),_0x365980,_0x39d13e);_0x33e95f(_0x39d13e);});});} \ No newline at end of file +var _0x39fd=['moment','bluebird','ioredis','../../config/utils','rpc','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0xdac5f,_0x1c39c7){var _0x5ea6c3=function(_0x4e3ebb){while(--_0x4e3ebb){_0xdac5f['push'](_0xdac5f['shift']());}};_0x5ea6c3(++_0x1c39c7);}(_0x39fd,0xc6));var _0xd39f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x39fd[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd39f('0x0'));var util=require(_0xd39f('0x1'));var moment=require(_0xd39f('0x2'));var BPromise=require(_0xd39f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd39f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd39f('0x5'));var logger=require('../../config/logger')(_0xd39f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd39f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8e24,_0x555b81,_0x43510e){return new BPromise(function(_0x40489c,_0x2a688e){return client[_0xd39f('0x8')](_0x3c8e24,_0x43510e)[_0xd39f('0x9')](function(_0x335eae){logger[_0xd39f('0xa')](_0xd39f('0xb'),_0x555b81,_0xd39f('0xc'));logger[_0xd39f('0xd')](_0xd39f('0xe'),_0x555b81,_0xd39f('0xc'),JSON['stringify'](_0x335eae));if(_0x335eae[_0xd39f('0xf')]){if(_0x335eae[_0xd39f('0xf')][_0xd39f('0x10')]===0x1f4){logger[_0xd39f('0xf')](_0xd39f('0xb'),_0x555b81,_0x335eae[_0xd39f('0xf')][_0xd39f('0x11')]);return _0x2a688e(_0x335eae[_0xd39f('0xf')][_0xd39f('0x11')]);}logger[_0xd39f('0xf')](_0xd39f('0xb'),_0x555b81,_0x335eae['error'][_0xd39f('0x11')]);return _0x40489c(_0x335eae['error']['message']);}else{logger[_0xd39f('0xa')](_0xd39f('0xb'),_0x555b81,_0xd39f('0xc'));_0x40489c(_0x335eae[_0xd39f('0x12')][_0xd39f('0x11')]);}})[_0xd39f('0x13')](function(_0x245997){logger['error'](_0xd39f('0xb'),_0x555b81,_0x245997);_0x2a688e(_0x245997);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f7022a9..8d9d860 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 _0x0d2d=['get','/:id','isAuthenticated','show','put','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0d2d,0x71));var _0xd0d2=function(_0x112ecc,_0x316376){_0x112ecc=_0x112ecc-0x0;var _0x24e59b=_0x0d2d[_0x112ecc];return _0x24e59b;};'use strict';var multer=require('multer');var util=require(_0xd0d2('0x0'));var path=require(_0xd0d2('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0d2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd0d2('0x3'));var interaction=require(_0xd0d2('0x4'));var config=require(_0xd0d2('0x5'));var controller=require(_0xd0d2('0x6'));router[_0xd0d2('0x7')](_0xd0d2('0x8'),auth[_0xd0d2('0x9')](),controller[_0xd0d2('0xa')]);router[_0xd0d2('0xb')](_0xd0d2('0x8'),auth[_0xd0d2('0x9')](),controller['update']);router[_0xd0d2('0xc')](_0xd0d2('0x8'),auth[_0xd0d2('0x9')](),controller[_0xd0d2('0xd')]);module[_0xd0d2('0xe')]=router; \ No newline at end of file +var _0x33d4=['../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x33d4,0x107));var _0x433d=function(_0x4fbd7c,_0x4c77fc){_0x4fbd7c=_0x4fbd7c-0x0;var _0x20fdfe=_0x33d4[_0x4fbd7c];return _0x20fdfe;};'use strict';var multer=require(_0x433d('0x0'));var util=require(_0x433d('0x1'));var path=require(_0x433d('0x2'));var timeout=require(_0x433d('0x3'));var express=require(_0x433d('0x4'));var router=express[_0x433d('0x5')]();var fs_extra=require(_0x433d('0x6'));var auth=require(_0x433d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x433d('0x8'));var controller=require(_0x433d('0x9'));router[_0x433d('0xa')](_0x433d('0xb'),auth['isAuthenticated'](),controller[_0x433d('0xc')]);router[_0x433d('0xd')](_0x433d('0xb'),auth[_0x433d('0xe')](),controller[_0x433d('0xf')]);router[_0x433d('0x10')](_0x433d('0xb'),auth[_0x433d('0xe')](),controller[_0x433d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 84079ed..a745292 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 _0x71ad=['STRING','sequelize','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x71ad,0xee));var _0xd71a=function(_0x5b4648,_0x31adb9){_0x5b4648=_0x5b4648-0x0;var _0x9e6d94=_0x71ad[_0x5b4648];return _0x9e6d94;};'use strict';var Sequelize=require(_0xd71a('0x0'));module[_0xd71a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd71a('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9219=['STRING','BOOLEAN','exports'];(function(_0x241b9c,_0x10f3ce){var _0x34af06=function(_0x4366f3){while(--_0x4366f3){_0x241b9c['push'](_0x241b9c['shift']());}};_0x34af06(++_0x10f3ce);}(_0x9219,0x1cd));var _0x9921=function(_0x1fc032,_0x4af4a2){_0x1fc032=_0x1fc032-0x0;var _0x3155ae=_0x9219[_0x1fc032];return _0x3155ae;};'use strict';var Sequelize=require('sequelize');module[_0x9921('0x0')]={'name':{'type':Sequelize[_0x9921('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9921('0x1')]},'write':{'type':Sequelize[_0x9921('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4d28515..c220b03 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 _0xa010=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','save','update','then','error','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','ChatGroup','includeAll','include','findAll','catch','find','create','body','params','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','rawAttributes','removeMembers','addMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0xa010,0xb0));var _0x0a01=function(_0x327b49,_0xc232b8){_0x327b49=_0x327b49-0x0;var _0x4e7265=_0xa010[_0x327b49];return _0x4e7265;};'use strict';var emlformat=require(_0x0a01('0x0'));var rimraf=require(_0x0a01('0x1'));var zipdir=require(_0x0a01('0x2'));var jsonpatch=require(_0x0a01('0x3'));var rp=require(_0x0a01('0x4'));var moment=require(_0x0a01('0x5'));var BPromise=require(_0x0a01('0x6'));var Mustache=require('mustache');var util=require(_0x0a01('0x7'));var path=require('path');var sox=require(_0x0a01('0x8'));var csv=require(_0x0a01('0x9'));var ejs=require(_0x0a01('0xa'));var fs=require('fs');var fs_extra=require(_0x0a01('0xb'));var _=require('lodash');var squel=require(_0x0a01('0xc'));var crypto=require(_0x0a01('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a01('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a01('0xf'));var Redis=require(_0x0a01('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0a01('0x11'));var as=require(_0x0a01('0x12'));var hardwareService=require(_0x0a01('0x13'));var logger=require('../../config/logger')(_0x0a01('0x14'));var utils=require(_0x0a01('0x15'));var config=require(_0x0a01('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a01('0x17'))['db'];config[_0x0a01('0x18')]=_[_0x0a01('0x19')](config[_0x0a01('0x18')],{'host':_0x0a01('0x1a'),'port':0x18eb});var socket=require(_0x0a01('0x1b'))(new Redis(config[_0x0a01('0x18')]));require('./chatGroup.socket')[_0x0a01('0x1c')](socket);function respondWithStatusCode(_0x26eb66,_0x2ac3ea){_0x2ac3ea=_0x2ac3ea||0xcc;return function(_0x11f75b){if(_0x11f75b){return _0x26eb66['sendStatus'](_0x2ac3ea);}return _0x26eb66['status'](_0x2ac3ea)[_0x0a01('0x1d')]();};}function respondWithResult(_0x37a298,_0x4a6dfc){_0x4a6dfc=_0x4a6dfc||0xc8;return function(_0x31beaa){if(_0x31beaa){return _0x37a298['status'](_0x4a6dfc)[_0x0a01('0x1e')](_0x31beaa);}};}function respondWithFilteredResult(_0x2106f6,_0x21fd3e){return function(_0x2d826a){if(_0x2d826a){var _0x2c436d=typeof _0x21fd3e[_0x0a01('0x1f')]===_0x0a01('0x20')&&typeof _0x21fd3e['limit']==='undefined';var _0x174ba9=_0x2d826a[_0x0a01('0x21')];var _0x292a88=_0x2c436d?0x0:_0x21fd3e[_0x0a01('0x1f')];var _0x2a8c79=_0x2c436d?_0x2d826a[_0x0a01('0x21')]:_0x21fd3e[_0x0a01('0x1f')]+_0x21fd3e[_0x0a01('0x22')];var _0x2d75ac;if(_0x2a8c79>=_0x174ba9){_0x2a8c79=_0x174ba9;_0x2d75ac=0xc8;}else{_0x2d75ac=0xce;}_0x2106f6[_0x0a01('0x23')](_0x2d75ac);return _0x2106f6[_0x0a01('0x24')](_0x0a01('0x25'),_0x292a88+'-'+_0x2a8c79+'/'+_0x174ba9)[_0x0a01('0x1e')](_0x2d826a);}return null;};}function patchUpdates(_0x2ddc99){return function(_0x331f11){try{jsonpatch[_0x0a01('0x26')](_0x331f11,_0x2ddc99,!![]);}catch(_0x2ce5af){return BPromise['reject'](_0x2ce5af);}return _0x331f11[_0x0a01('0x27')]();};}function saveUpdates(_0x18d91b,_0x29297a){return function(_0x3b5b2b){if(_0x3b5b2b){return _0x3b5b2b[_0x0a01('0x28')](_0x18d91b)[_0x0a01('0x29')](function(_0x3cca57){return _0x3cca57;});}return null;};}function removeEntity(_0x291d14,_0x33fcce){return function(_0x34520e){if(_0x34520e){return _0x34520e['destroy']()[_0x0a01('0x29')](function(){_0x291d14[_0x0a01('0x23')](0xcc)[_0x0a01('0x1d')]();});}};}function handleEntityNotFound(_0x2636df,_0xfa6e9b){return function(_0x1fb245){if(!_0x1fb245){_0x2636df['sendStatus'](0x194);}return _0x1fb245;};}function handleError(_0x44ad41,_0x4b0044){_0x4b0044=_0x4b0044||0x1f4;return function(_0x11ba13){logger[_0x0a01('0x2a')](_0x11ba13['stack']);if(_0x11ba13[_0x0a01('0x2b')]){delete _0x11ba13['name'];}_0x44ad41[_0x0a01('0x23')](_0x4b0044)[_0x0a01('0x2c')](_0x11ba13);};}exports['index']=function(_0x4f97fa,_0x4bc6f3){var _0x5aaa1e={},_0x36af2e={},_0x1419fc={'count':0x0,'rows':[]};var _0x338105=_[_0x0a01('0x2d')](db['ChatGroup']['rawAttributes'],function(_0x28588c){return{'name':_0x28588c['fieldName'],'type':_0x28588c[_0x0a01('0x2e')][_0x0a01('0x2f')]};});_0x36af2e[_0x0a01('0x30')]=_[_0x0a01('0x2d')](_0x338105,_0x0a01('0x2b'));_0x36af2e[_0x0a01('0x31')]=_[_0x0a01('0x32')](_0x4f97fa['query']);_0x36af2e[_0x0a01('0x33')]=_[_0x0a01('0x34')](_0x36af2e[_0x0a01('0x30')],_0x36af2e[_0x0a01('0x31')]);_0x5aaa1e[_0x0a01('0x35')]=_[_0x0a01('0x34')](_0x36af2e[_0x0a01('0x30')],qs[_0x0a01('0x36')](_0x4f97fa[_0x0a01('0x31')]['fields']));_0x5aaa1e[_0x0a01('0x35')]=_0x5aaa1e[_0x0a01('0x35')][_0x0a01('0x37')]?_0x5aaa1e[_0x0a01('0x35')]:_0x36af2e[_0x0a01('0x30')];if(!_0x4f97fa['query'][_0x0a01('0x38')]('nolimit')){_0x5aaa1e[_0x0a01('0x22')]=qs['limit'](_0x4f97fa[_0x0a01('0x31')]['limit']);_0x5aaa1e['offset']=qs['offset'](_0x4f97fa[_0x0a01('0x31')][_0x0a01('0x1f')]);}_0x5aaa1e[_0x0a01('0x39')]=qs['sort'](_0x4f97fa[_0x0a01('0x31')][_0x0a01('0x3a')]);_0x5aaa1e[_0x0a01('0x3b')]=qs[_0x0a01('0x33')](_[_0x0a01('0x3c')](_0x4f97fa[_0x0a01('0x31')],_0x36af2e[_0x0a01('0x33')]),_0x338105);if(_0x4f97fa[_0x0a01('0x31')][_0x0a01('0x3d')]){_0x5aaa1e[_0x0a01('0x3b')]=_['merge'](_0x5aaa1e[_0x0a01('0x3b')],{'$or':_[_0x0a01('0x2d')](_0x338105,function(_0xf22f72){if(_0xf22f72[_0x0a01('0x2e')]!==_0x0a01('0x3e')){var _0x4727af={};_0x4727af[_0xf22f72[_0x0a01('0x2b')]]={'$like':'%'+_0x4f97fa[_0x0a01('0x31')][_0x0a01('0x3d')]+'%'};return _0x4727af;}})});}_0x5aaa1e=_[_0x0a01('0x3f')]({},_0x5aaa1e,_0x4f97fa[_0x0a01('0x40')]);var _0x5ea1e9={'where':_0x5aaa1e['where']};return db[_0x0a01('0x41')][_0x0a01('0x21')](_0x5ea1e9)[_0x0a01('0x29')](function(_0x4eb51){_0x1419fc[_0x0a01('0x21')]=_0x4eb51;if(_0x4f97fa[_0x0a01('0x31')][_0x0a01('0x42')]){_0x5aaa1e[_0x0a01('0x43')]=[{'all':!![]}];}return db['ChatGroup'][_0x0a01('0x44')](_0x5aaa1e);})[_0x0a01('0x29')](function(_0x525b48){_0x1419fc['rows']=_0x525b48;return _0x1419fc;})[_0x0a01('0x29')](respondWithFilteredResult(_0x4bc6f3,_0x5aaa1e))[_0x0a01('0x45')](handleError(_0x4bc6f3,null));};exports['show']=function(_0x337dcc,_0x36afb0){var _0x3906ed={'raw':!![],'where':{'id':_0x337dcc['params']['id']}},_0x5b7757={};_0x5b7757[_0x0a01('0x30')]=_['keys'](db[_0x0a01('0x41')]['rawAttributes']);_0x5b7757[_0x0a01('0x31')]=_[_0x0a01('0x32')](_0x337dcc[_0x0a01('0x31')]);_0x5b7757[_0x0a01('0x33')]=_[_0x0a01('0x34')](_0x5b7757[_0x0a01('0x30')],_0x5b7757[_0x0a01('0x31')]);_0x3906ed['attributes']=_[_0x0a01('0x34')](_0x5b7757[_0x0a01('0x30')],qs[_0x0a01('0x36')](_0x337dcc[_0x0a01('0x31')][_0x0a01('0x36')]));_0x3906ed[_0x0a01('0x35')]=_0x3906ed[_0x0a01('0x35')][_0x0a01('0x37')]?_0x3906ed[_0x0a01('0x35')]:_0x5b7757[_0x0a01('0x30')];if(_0x337dcc[_0x0a01('0x31')][_0x0a01('0x42')]){_0x3906ed[_0x0a01('0x43')]=[{'all':!![]}];}_0x3906ed=_[_0x0a01('0x3f')]({},_0x3906ed,_0x337dcc['options']);return db[_0x0a01('0x41')][_0x0a01('0x46')](_0x3906ed)[_0x0a01('0x29')](handleEntityNotFound(_0x36afb0,null))[_0x0a01('0x29')](respondWithResult(_0x36afb0,null))['catch'](handleError(_0x36afb0,null));};exports[_0x0a01('0x47')]=function(_0x5487da,_0x572a6b){return db[_0x0a01('0x41')][_0x0a01('0x47')](_0x5487da['body'],{})[_0x0a01('0x29')](respondWithResult(_0x572a6b,0xc9))[_0x0a01('0x45')](handleError(_0x572a6b,null));};exports['update']=function(_0x51e6b8,_0x44f9c7){if(_0x51e6b8[_0x0a01('0x48')]['id']){delete _0x51e6b8[_0x0a01('0x48')]['id'];}return db['ChatGroup'][_0x0a01('0x46')]({'where':{'id':_0x51e6b8[_0x0a01('0x49')]['id']}})[_0x0a01('0x29')](handleEntityNotFound(_0x44f9c7,null))['then'](saveUpdates(_0x51e6b8['body'],null))[_0x0a01('0x29')](respondWithResult(_0x44f9c7,null))[_0x0a01('0x45')](handleError(_0x44f9c7,null));};exports[_0x0a01('0x4a')]=function(_0x1e0460,_0x25ef78){return db[_0x0a01('0x41')][_0x0a01('0x46')]({'where':{'id':_0x1e0460[_0x0a01('0x49')]['id']}})[_0x0a01('0x29')](handleEntityNotFound(_0x25ef78,null))[_0x0a01('0x29')](removeEntity(_0x25ef78,null))[_0x0a01('0x45')](handleError(_0x25ef78,null));};exports[_0x0a01('0x4b')]=function(_0x117811,_0x5a261f){return db[_0x0a01('0x41')][_0x0a01('0x4b')]()[_0x0a01('0x29')](respondWithResult(_0x5a261f,null))['catch'](handleError(_0x5a261f,null));};exports[_0x0a01('0x4c')]=function(_0x22e1db,_0x6b3e61,_0x2307e7){return db[_0x0a01('0x4d')][_0x0a01('0x21')]({'where':{'ChatGroupId':_0x22e1db[_0x0a01('0x49')]['id'],'ToId':_0x22e1db['user']['id'],'read':![]}})[_0x0a01('0x29')](function(_0x3bd110){return{'id':_[_0x0a01('0x4e')](_0x22e1db['params']['id']),'count':_0x3bd110};})[_0x0a01('0x29')](respondWithResult(_0x6b3e61,null))[_0x0a01('0x45')](handleError(_0x6b3e61,null));};exports['addMembers']=function(_0x459183,_0x276e92,_0x41085d){return db[_0x0a01('0x41')]['find']({'where':{'id':_0x459183[_0x0a01('0x49')]['id']}})['then'](handleEntityNotFound(_0x276e92,null))['then'](function(_0x336416){if(_0x336416){return _0x336416[_0x0a01('0x4f')](_0x459183['body'][_0x0a01('0x50')],_[_0x0a01('0x51')](_0x459183[_0x0a01('0x48')],[_0x0a01('0x50'),'id'])||{});}})[_0x0a01('0x29')](respondWithResult(_0x276e92,null))[_0x0a01('0x45')](handleError(_0x276e92,null));};exports[_0x0a01('0x52')]=function(_0x453a9b,_0x567bf4,_0x44908b){var _0x10f125={};var _0x8870b9={};var _0x333ac9;var _0x30fdc9;return db['ChatGroup'][_0x0a01('0x53')]({'where':{'id':_0x453a9b[_0x0a01('0x49')]['id']}})[_0x0a01('0x29')](handleEntityNotFound(_0x567bf4,null))[_0x0a01('0x29')](function(_0x1b5048){if(_0x1b5048){_0x333ac9=_0x1b5048;_0x8870b9[_0x0a01('0x30')]=_[_0x0a01('0x32')](db[_0x0a01('0x54')][_0x0a01('0x55')]);_0x8870b9[_0x0a01('0x31')]=_[_0x0a01('0x32')](_0x453a9b[_0x0a01('0x31')]);_0x8870b9[_0x0a01('0x33')]=_[_0x0a01('0x34')](_0x8870b9[_0x0a01('0x30')],_0x8870b9[_0x0a01('0x31')]);_0x10f125[_0x0a01('0x35')]=_['intersection'](_0x8870b9[_0x0a01('0x30')],qs[_0x0a01('0x36')](_0x453a9b['query'][_0x0a01('0x36')]));_0x10f125[_0x0a01('0x35')]=_0x10f125[_0x0a01('0x35')]['length']?_0x10f125[_0x0a01('0x35')]:_0x8870b9[_0x0a01('0x30')];_0x10f125[_0x0a01('0x39')]=qs[_0x0a01('0x3a')](_0x453a9b[_0x0a01('0x31')][_0x0a01('0x3a')]);_0x10f125[_0x0a01('0x3b')]=qs['filters'](_['pick'](_0x453a9b['query'],_0x8870b9[_0x0a01('0x33')]));if(_0x453a9b['query']['filter']){_0x10f125[_0x0a01('0x3b')]=_[_0x0a01('0x3f')](_0x10f125['where'],{'$or':_['map'](_0x10f125[_0x0a01('0x35')],function(_0x9b2049){var _0x44f67a={};_0x44f67a[_0x9b2049]={'$like':'%'+_0x453a9b[_0x0a01('0x31')]['filter']+'%'};return _0x44f67a;})});}_0x10f125=_[_0x0a01('0x3f')]({},_0x10f125,_0x453a9b[_0x0a01('0x40')]);return _0x333ac9['getMembers'](_0x10f125);}})[_0x0a01('0x29')](function(_0x2157ef){if(_0x2157ef){_0x30fdc9=_0x2157ef['length'];if(!_0x453a9b[_0x0a01('0x31')][_0x0a01('0x38')]('nolimit')){_0x10f125[_0x0a01('0x22')]=qs['limit'](_0x453a9b['query'][_0x0a01('0x22')]);_0x10f125[_0x0a01('0x1f')]=qs[_0x0a01('0x1f')](_0x453a9b[_0x0a01('0x31')][_0x0a01('0x1f')]);}return _0x333ac9[_0x0a01('0x52')](_0x10f125);}})['then'](function(_0x3334c1){if(_0x3334c1){return _0x3334c1?{'count':_0x30fdc9,'rows':_0x3334c1}:null;}})['then'](respondWithResult(_0x567bf4,null))[_0x0a01('0x45')](handleError(_0x567bf4,null));};exports[_0x0a01('0x56')]=function(_0x26f338,_0x2b425a,_0x398996){return db['ChatGroup'][_0x0a01('0x46')]({'where':{'id':_0x26f338[_0x0a01('0x49')]['id']}})[_0x0a01('0x29')](handleEntityNotFound(_0x2b425a,null))[_0x0a01('0x29')](function(_0x1dcca8){if(_0x1dcca8){return _0x1dcca8[_0x0a01('0x56')](_0x26f338[_0x0a01('0x31')][_0x0a01('0x50')]);}})['then'](respondWithStatusCode(_0x2b425a,null))['catch'](handleError(_0x2b425a,null));};exports[_0x0a01('0x57')]=function(_0x109665,_0x19742b,_0x457fa0){if(_0x109665[_0x0a01('0x48')]['id']){delete _0x109665[_0x0a01('0x48')]['id'];}return db['ChatGroup'][_0x0a01('0x46')]({'where':{'id':_0x109665[_0x0a01('0x49')]['id']}})[_0x0a01('0x29')](handleEntityNotFound(_0x19742b,null))['then'](function(_0x4621b0){if(_0x4621b0){_0x109665[_0x0a01('0x48')]['ChatGroupId']=_0x4621b0['id'];return db[_0x0a01('0x4d')][_0x0a01('0x47')](_0x109665['body']);}})['then'](respondWithResult(_0x19742b,null))[_0x0a01('0x45')](handleError(_0x19742b,null));};exports[_0x0a01('0x58')]=function(_0x1e27ce,_0xddb5c4,_0x2711b7){var _0x11ee75={};var _0x3e943d={};var _0x6533ff;var _0x1be833;return db[_0x0a01('0x41')]['findOne']({'where':{'id':_0x1e27ce[_0x0a01('0x49')]['id']}})[_0x0a01('0x29')](handleEntityNotFound(_0xddb5c4,null))['then'](function(_0x289d4b){if(_0x289d4b){_0x6533ff=_0x289d4b;_0x3e943d[_0x0a01('0x30')]=_['keys'](db[_0x0a01('0x4d')][_0x0a01('0x55')]);_0x3e943d[_0x0a01('0x31')]=_[_0x0a01('0x32')](_0x1e27ce['query']);_0x3e943d[_0x0a01('0x33')]=_['intersection'](_0x3e943d[_0x0a01('0x30')],_0x3e943d['query']);_0x11ee75['attributes']=_[_0x0a01('0x34')](_0x3e943d[_0x0a01('0x30')],qs[_0x0a01('0x36')](_0x1e27ce[_0x0a01('0x31')]['fields']));_0x11ee75[_0x0a01('0x35')]=_0x11ee75[_0x0a01('0x35')]['length']?_0x11ee75['attributes']:_0x3e943d[_0x0a01('0x30')];_0x11ee75[_0x0a01('0x39')]=qs[_0x0a01('0x3a')](_0x1e27ce[_0x0a01('0x31')][_0x0a01('0x3a')]);_0x11ee75[_0x0a01('0x3b')]=qs[_0x0a01('0x33')](_[_0x0a01('0x3c')](_0x1e27ce['query'],_0x3e943d[_0x0a01('0x33')]));if(_0x1e27ce[_0x0a01('0x31')][_0x0a01('0x3d')]){_0x11ee75[_0x0a01('0x3b')]=_['merge'](_0x11ee75[_0x0a01('0x3b')],{'$or':_['map'](_0x11ee75['attributes'],function(_0x3d6cf5){var _0x3a0a24={};_0x3a0a24[_0x3d6cf5]={'$like':'%'+_0x1e27ce[_0x0a01('0x31')][_0x0a01('0x3d')]+'%'};return _0x3a0a24;})});}if(_0x1e27ce['query'][_0x0a01('0x59')]){var _0x3670e1=_0x1e27ce[_0x0a01('0x31')][_0x0a01('0x59')][_0x0a01('0x5a')](',');var _0x3017d7={};_0x3017d7[_0x3670e1[0x0]]={'$gte':moment(_0x3670e1[0x1])[_0x0a01('0x5b')](_0x0a01('0x5c'))};_0x11ee75[_0x0a01('0x3b')]=_[_0x0a01('0x3f')](_0x11ee75[_0x0a01('0x3b')],_0x3017d7);}_0x11ee75=_[_0x0a01('0x3f')]({},_0x11ee75,_0x1e27ce[_0x0a01('0x40')]);return _0x6533ff[_0x0a01('0x58')](_0x11ee75);}})[_0x0a01('0x29')](function(_0x26fc14){if(_0x26fc14){_0x1be833=_0x26fc14[_0x0a01('0x37')];if(!_0x1e27ce[_0x0a01('0x31')][_0x0a01('0x38')](_0x0a01('0x5d'))){_0x11ee75['limit']=qs['limit'](_0x1e27ce[_0x0a01('0x31')]['limit']);_0x11ee75[_0x0a01('0x1f')]=qs['offset'](_0x1e27ce[_0x0a01('0x31')][_0x0a01('0x1f')]);}return _0x6533ff['getMessages'](_0x11ee75);}})['then'](function(_0x14eec8){if(_0x14eec8){return _0x14eec8?{'count':_0x1be833,'rows':_0x14eec8}:null;}})['then'](respondWithResult(_0xddb5c4,null))[_0x0a01('0x45')](handleError(_0xddb5c4,null));}; \ No newline at end of file +var _0xaf76=['keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','findAll','catch','show','fields','includeAll','include','options','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','query'];(function(_0x26362d,_0x518e22){var _0x1d8b46=function(_0x48adbb){while(--_0x48adbb){_0x26362d['push'](_0x26362d['shift']());}};_0x1d8b46(++_0x518e22);}(_0xaf76,0xea));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6af7('0x0'));var zipdir=require(_0x6af7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6af7('0x2'));var Mustache=require(_0x6af7('0x3'));var util=require(_0x6af7('0x4'));var path=require('path');var sox=require(_0x6af7('0x5'));var csv=require(_0x6af7('0x6'));var ejs=require(_0x6af7('0x7'));var fs=require('fs');var fs_extra=require(_0x6af7('0x8'));var _=require(_0x6af7('0x9'));var squel=require('squel');var crypto=require(_0x6af7('0xa'));var jsforce=require(_0x6af7('0xb'));var deskjs=require(_0x6af7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6af7('0xd'));var Redis=require(_0x6af7('0xe'));var authService=require(_0x6af7('0xf'));var qs=require(_0x6af7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6af7('0x11'));var logger=require(_0x6af7('0x12'))(_0x6af7('0x13'));var utils=require(_0x6af7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6af7('0x15'));var db=require('../../mysqldb')['db'];config[_0x6af7('0x16')]=_[_0x6af7('0x17')](config[_0x6af7('0x16')],{'host':_0x6af7('0x18'),'port':0x18eb});var socket=require(_0x6af7('0x19'))(new Redis(config[_0x6af7('0x16')]));require(_0x6af7('0x1a'))[_0x6af7('0x1b')](socket);function respondWithStatusCode(_0x162d8b,_0x2750bc){_0x2750bc=_0x2750bc||0xcc;return function(_0x1cab02){if(_0x1cab02){return _0x162d8b[_0x6af7('0x1c')](_0x2750bc);}return _0x162d8b[_0x6af7('0x1d')](_0x2750bc)['end']();};}function respondWithResult(_0x2688b5,_0x192ffe){_0x192ffe=_0x192ffe||0xc8;return function(_0x49d8df){if(_0x49d8df){return _0x2688b5[_0x6af7('0x1d')](_0x192ffe)[_0x6af7('0x1e')](_0x49d8df);}};}function respondWithFilteredResult(_0x350552,_0xab3963){return function(_0x3b8e8c){if(_0x3b8e8c){var _0x573eb9=typeof _0xab3963[_0x6af7('0x1f')]==='undefined'&&typeof _0xab3963['limit']===_0x6af7('0x20');var _0x2ea309=_0x3b8e8c['count'];var _0x5c3630=_0x573eb9?0x0:_0xab3963[_0x6af7('0x1f')];var _0x1ffe96=_0x573eb9?_0x3b8e8c[_0x6af7('0x21')]:_0xab3963[_0x6af7('0x1f')]+_0xab3963[_0x6af7('0x22')];var _0x245eb9;if(_0x1ffe96>=_0x2ea309){_0x1ffe96=_0x2ea309;_0x245eb9=0xc8;}else{_0x245eb9=0xce;}_0x350552[_0x6af7('0x1d')](_0x245eb9);return _0x350552[_0x6af7('0x23')](_0x6af7('0x24'),_0x5c3630+'-'+_0x1ffe96+'/'+_0x2ea309)[_0x6af7('0x1e')](_0x3b8e8c);}return null;};}function patchUpdates(_0x4f20ee){return function(_0x4031d7){try{jsonpatch['apply'](_0x4031d7,_0x4f20ee,!![]);}catch(_0x46ee97){return BPromise[_0x6af7('0x25')](_0x46ee97);}return _0x4031d7[_0x6af7('0x26')]();};}function saveUpdates(_0x43b942,_0x2d17c0){return function(_0x3a9afa){if(_0x3a9afa){return _0x3a9afa[_0x6af7('0x27')](_0x43b942)[_0x6af7('0x28')](function(_0x2f8e59){return _0x2f8e59;});}return null;};}function removeEntity(_0x1d5f33,_0x11a1c9){return function(_0x3aa096){if(_0x3aa096){return _0x3aa096[_0x6af7('0x29')]()[_0x6af7('0x28')](function(){_0x1d5f33[_0x6af7('0x1d')](0xcc)[_0x6af7('0x2a')]();});}};}function handleEntityNotFound(_0x82e45f,_0x1141db){return function(_0x3db8f0){if(!_0x3db8f0){_0x82e45f[_0x6af7('0x1c')](0x194);}return _0x3db8f0;};}function handleError(_0x4f8f55,_0x1fee4b){_0x1fee4b=_0x1fee4b||0x1f4;return function(_0x4d8955){logger[_0x6af7('0x2b')](_0x4d8955[_0x6af7('0x2c')]);if(_0x4d8955[_0x6af7('0x2d')]){delete _0x4d8955[_0x6af7('0x2d')];}_0x4f8f55[_0x6af7('0x1d')](_0x1fee4b)[_0x6af7('0x2e')](_0x4d8955);};}exports[_0x6af7('0x2f')]=function(_0x1a0288,_0x257c8c){var _0x2190b3={},_0x1159fd={},_0x530cef={'count':0x0,'rows':[]};var _0x5176fd=_[_0x6af7('0x30')](db[_0x6af7('0x31')][_0x6af7('0x32')],function(_0x55fe80){return{'name':_0x55fe80[_0x6af7('0x33')],'type':_0x55fe80[_0x6af7('0x34')]['key']};});_0x1159fd['model']=_['map'](_0x5176fd,_0x6af7('0x2d'));_0x1159fd[_0x6af7('0x35')]=_[_0x6af7('0x36')](_0x1a0288[_0x6af7('0x35')]);_0x1159fd[_0x6af7('0x37')]=_['intersection'](_0x1159fd[_0x6af7('0x38')],_0x1159fd['query']);_0x2190b3[_0x6af7('0x39')]=_[_0x6af7('0x3a')](_0x1159fd[_0x6af7('0x38')],qs['fields'](_0x1a0288[_0x6af7('0x35')]['fields']));_0x2190b3[_0x6af7('0x39')]=_0x2190b3[_0x6af7('0x39')][_0x6af7('0x3b')]?_0x2190b3['attributes']:_0x1159fd[_0x6af7('0x38')];if(!_0x1a0288[_0x6af7('0x35')][_0x6af7('0x3c')](_0x6af7('0x3d'))){_0x2190b3[_0x6af7('0x22')]=qs['limit'](_0x1a0288[_0x6af7('0x35')][_0x6af7('0x22')]);_0x2190b3[_0x6af7('0x1f')]=qs['offset'](_0x1a0288[_0x6af7('0x35')][_0x6af7('0x1f')]);}_0x2190b3[_0x6af7('0x3e')]=qs[_0x6af7('0x3f')](_0x1a0288[_0x6af7('0x35')][_0x6af7('0x3f')]);_0x2190b3['where']=qs['filters'](_['pick'](_0x1a0288[_0x6af7('0x35')],_0x1159fd[_0x6af7('0x37')]),_0x5176fd);if(_0x1a0288[_0x6af7('0x35')][_0x6af7('0x40')]){_0x2190b3[_0x6af7('0x41')]=_[_0x6af7('0x42')](_0x2190b3[_0x6af7('0x41')],{'$or':_[_0x6af7('0x30')](_0x5176fd,function(_0x303e1b){if(_0x303e1b[_0x6af7('0x34')]!==_0x6af7('0x43')){var _0x14ed90={};_0x14ed90[_0x303e1b['name']]={'$like':'%'+_0x1a0288[_0x6af7('0x35')][_0x6af7('0x40')]+'%'};return _0x14ed90;}})});}_0x2190b3=_[_0x6af7('0x42')]({},_0x2190b3,_0x1a0288['options']);var _0x582370={'where':_0x2190b3[_0x6af7('0x41')]};return db[_0x6af7('0x31')]['count'](_0x582370)[_0x6af7('0x28')](function(_0xfb1f5){_0x530cef['count']=_0xfb1f5;if(_0x1a0288[_0x6af7('0x35')]['includeAll']){_0x2190b3['include']=[{'all':!![]}];}return db[_0x6af7('0x31')][_0x6af7('0x44')](_0x2190b3);})['then'](function(_0x5a2dec){_0x530cef['rows']=_0x5a2dec;return _0x530cef;})['then'](respondWithFilteredResult(_0x257c8c,_0x2190b3))[_0x6af7('0x45')](handleError(_0x257c8c,null));};exports[_0x6af7('0x46')]=function(_0x10945e,_0x5ca71c){var _0x4e8272={'raw':!![],'where':{'id':_0x10945e['params']['id']}},_0x52b3de={};_0x52b3de[_0x6af7('0x38')]=_[_0x6af7('0x36')](db[_0x6af7('0x31')]['rawAttributes']);_0x52b3de[_0x6af7('0x35')]=_[_0x6af7('0x36')](_0x10945e[_0x6af7('0x35')]);_0x52b3de[_0x6af7('0x37')]=_[_0x6af7('0x3a')](_0x52b3de[_0x6af7('0x38')],_0x52b3de[_0x6af7('0x35')]);_0x4e8272[_0x6af7('0x39')]=_[_0x6af7('0x3a')](_0x52b3de[_0x6af7('0x38')],qs[_0x6af7('0x47')](_0x10945e[_0x6af7('0x35')]['fields']));_0x4e8272[_0x6af7('0x39')]=_0x4e8272[_0x6af7('0x39')]['length']?_0x4e8272['attributes']:_0x52b3de[_0x6af7('0x38')];if(_0x10945e[_0x6af7('0x35')][_0x6af7('0x48')]){_0x4e8272[_0x6af7('0x49')]=[{'all':!![]}];}_0x4e8272=_[_0x6af7('0x42')]({},_0x4e8272,_0x10945e[_0x6af7('0x4a')]);return db[_0x6af7('0x31')][_0x6af7('0x4b')](_0x4e8272)[_0x6af7('0x28')](handleEntityNotFound(_0x5ca71c,null))[_0x6af7('0x28')](respondWithResult(_0x5ca71c,null))['catch'](handleError(_0x5ca71c,null));};exports[_0x6af7('0x4c')]=function(_0x58383b,_0x410ef0){return db['ChatGroup']['create'](_0x58383b[_0x6af7('0x4d')],{})[_0x6af7('0x28')](respondWithResult(_0x410ef0,0xc9))[_0x6af7('0x45')](handleError(_0x410ef0,null));};exports[_0x6af7('0x27')]=function(_0x52cc48,_0x2b88a0){if(_0x52cc48[_0x6af7('0x4d')]['id']){delete _0x52cc48[_0x6af7('0x4d')]['id'];}return db[_0x6af7('0x31')]['find']({'where':{'id':_0x52cc48[_0x6af7('0x4e')]['id']}})[_0x6af7('0x28')](handleEntityNotFound(_0x2b88a0,null))[_0x6af7('0x28')](saveUpdates(_0x52cc48[_0x6af7('0x4d')],null))[_0x6af7('0x28')](respondWithResult(_0x2b88a0,null))['catch'](handleError(_0x2b88a0,null));};exports['destroy']=function(_0x42de3,_0x4ad614){return db[_0x6af7('0x31')][_0x6af7('0x4b')]({'where':{'id':_0x42de3[_0x6af7('0x4e')]['id']}})[_0x6af7('0x28')](handleEntityNotFound(_0x4ad614,null))['then'](removeEntity(_0x4ad614,null))[_0x6af7('0x45')](handleError(_0x4ad614,null));};exports[_0x6af7('0x4f')]=function(_0x3aa3ca,_0x4b1fe8){return db[_0x6af7('0x31')]['describe']()[_0x6af7('0x28')](respondWithResult(_0x4b1fe8,null))[_0x6af7('0x45')](handleError(_0x4b1fe8,null));};exports[_0x6af7('0x50')]=function(_0x4174d7,_0x27689e,_0x40ae55){return db[_0x6af7('0x51')][_0x6af7('0x21')]({'where':{'ChatGroupId':_0x4174d7[_0x6af7('0x4e')]['id'],'ToId':_0x4174d7[_0x6af7('0x52')]['id'],'read':![]}})[_0x6af7('0x28')](function(_0x86b214){return{'id':_[_0x6af7('0x53')](_0x4174d7[_0x6af7('0x4e')]['id']),'count':_0x86b214};})[_0x6af7('0x28')](respondWithResult(_0x27689e,null))[_0x6af7('0x45')](handleError(_0x27689e,null));};exports[_0x6af7('0x54')]=function(_0x12438e,_0x1768cc,_0x1b41e0){return db[_0x6af7('0x31')][_0x6af7('0x4b')]({'where':{'id':_0x12438e[_0x6af7('0x4e')]['id']}})[_0x6af7('0x28')](handleEntityNotFound(_0x1768cc,null))[_0x6af7('0x28')](function(_0x38daab){if(_0x38daab){return _0x38daab['addMembers'](_0x12438e[_0x6af7('0x4d')][_0x6af7('0x55')],_[_0x6af7('0x56')](_0x12438e[_0x6af7('0x4d')],[_0x6af7('0x55'),'id'])||{});}})['then'](respondWithResult(_0x1768cc,null))[_0x6af7('0x45')](handleError(_0x1768cc,null));};exports[_0x6af7('0x57')]=function(_0x1c441a,_0x31016a,_0x41d5c3){var _0x5eef6b={};var _0x3202ab={};var _0x5ec47e;var _0x52fd6f;return db[_0x6af7('0x31')][_0x6af7('0x58')]({'where':{'id':_0x1c441a['params']['id']}})[_0x6af7('0x28')](handleEntityNotFound(_0x31016a,null))[_0x6af7('0x28')](function(_0x29b17d){if(_0x29b17d){_0x5ec47e=_0x29b17d;_0x3202ab['model']=_['keys'](db[_0x6af7('0x59')][_0x6af7('0x32')]);_0x3202ab['query']=_[_0x6af7('0x36')](_0x1c441a[_0x6af7('0x35')]);_0x3202ab[_0x6af7('0x37')]=_[_0x6af7('0x3a')](_0x3202ab[_0x6af7('0x38')],_0x3202ab[_0x6af7('0x35')]);_0x5eef6b[_0x6af7('0x39')]=_[_0x6af7('0x3a')](_0x3202ab[_0x6af7('0x38')],qs[_0x6af7('0x47')](_0x1c441a[_0x6af7('0x35')][_0x6af7('0x47')]));_0x5eef6b[_0x6af7('0x39')]=_0x5eef6b[_0x6af7('0x39')]['length']?_0x5eef6b[_0x6af7('0x39')]:_0x3202ab[_0x6af7('0x38')];_0x5eef6b[_0x6af7('0x3e')]=qs[_0x6af7('0x3f')](_0x1c441a[_0x6af7('0x35')][_0x6af7('0x3f')]);_0x5eef6b['where']=qs[_0x6af7('0x37')](_['pick'](_0x1c441a['query'],_0x3202ab[_0x6af7('0x37')]));if(_0x1c441a[_0x6af7('0x35')][_0x6af7('0x40')]){_0x5eef6b[_0x6af7('0x41')]=_[_0x6af7('0x42')](_0x5eef6b['where'],{'$or':_[_0x6af7('0x30')](_0x5eef6b[_0x6af7('0x39')],function(_0x3738ad){var _0x58e230={};_0x58e230[_0x3738ad]={'$like':'%'+_0x1c441a['query'][_0x6af7('0x40')]+'%'};return _0x58e230;})});}_0x5eef6b=_[_0x6af7('0x42')]({},_0x5eef6b,_0x1c441a[_0x6af7('0x4a')]);return _0x5ec47e[_0x6af7('0x57')](_0x5eef6b);}})[_0x6af7('0x28')](function(_0x2115f4){if(_0x2115f4){_0x52fd6f=_0x2115f4[_0x6af7('0x3b')];if(!_0x1c441a['query']['hasOwnProperty'](_0x6af7('0x3d'))){_0x5eef6b['limit']=qs['limit'](_0x1c441a[_0x6af7('0x35')][_0x6af7('0x22')]);_0x5eef6b['offset']=qs[_0x6af7('0x1f')](_0x1c441a[_0x6af7('0x35')][_0x6af7('0x1f')]);}return _0x5ec47e[_0x6af7('0x57')](_0x5eef6b);}})['then'](function(_0xeb42e){if(_0xeb42e){return _0xeb42e?{'count':_0x52fd6f,'rows':_0xeb42e}:null;}})[_0x6af7('0x28')](respondWithResult(_0x31016a,null))[_0x6af7('0x45')](handleError(_0x31016a,null));};exports[_0x6af7('0x5a')]=function(_0x53f5c3,_0x2be882,_0x26b60c){return db[_0x6af7('0x31')][_0x6af7('0x4b')]({'where':{'id':_0x53f5c3[_0x6af7('0x4e')]['id']}})[_0x6af7('0x28')](handleEntityNotFound(_0x2be882,null))[_0x6af7('0x28')](function(_0x447c50){if(_0x447c50){return _0x447c50[_0x6af7('0x5a')](_0x53f5c3[_0x6af7('0x35')][_0x6af7('0x55')]);}})[_0x6af7('0x28')](respondWithStatusCode(_0x2be882,null))['catch'](handleError(_0x2be882,null));};exports[_0x6af7('0x5b')]=function(_0x435c57,_0x3b5b67,_0x1d7fdf){if(_0x435c57[_0x6af7('0x4d')]['id']){delete _0x435c57[_0x6af7('0x4d')]['id'];}return db[_0x6af7('0x31')][_0x6af7('0x4b')]({'where':{'id':_0x435c57[_0x6af7('0x4e')]['id']}})[_0x6af7('0x28')](handleEntityNotFound(_0x3b5b67,null))[_0x6af7('0x28')](function(_0x124bfc){if(_0x124bfc){_0x435c57[_0x6af7('0x4d')][_0x6af7('0x5c')]=_0x124bfc['id'];return db[_0x6af7('0x51')][_0x6af7('0x4c')](_0x435c57[_0x6af7('0x4d')]);}})[_0x6af7('0x28')](respondWithResult(_0x3b5b67,null))['catch'](handleError(_0x3b5b67,null));};exports[_0x6af7('0x5d')]=function(_0x58b727,_0x23da3f,_0x42ba63){var _0x5e64a7={};var _0x279f76={};var _0x17586f;var _0x21081c;return db[_0x6af7('0x31')][_0x6af7('0x58')]({'where':{'id':_0x58b727[_0x6af7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x23da3f,null))['then'](function(_0x282d59){if(_0x282d59){_0x17586f=_0x282d59;_0x279f76[_0x6af7('0x38')]=_[_0x6af7('0x36')](db[_0x6af7('0x51')][_0x6af7('0x32')]);_0x279f76['query']=_[_0x6af7('0x36')](_0x58b727['query']);_0x279f76[_0x6af7('0x37')]=_[_0x6af7('0x3a')](_0x279f76[_0x6af7('0x38')],_0x279f76[_0x6af7('0x35')]);_0x5e64a7[_0x6af7('0x39')]=_[_0x6af7('0x3a')](_0x279f76['model'],qs['fields'](_0x58b727[_0x6af7('0x35')][_0x6af7('0x47')]));_0x5e64a7[_0x6af7('0x39')]=_0x5e64a7[_0x6af7('0x39')]['length']?_0x5e64a7[_0x6af7('0x39')]:_0x279f76[_0x6af7('0x38')];_0x5e64a7[_0x6af7('0x3e')]=qs[_0x6af7('0x3f')](_0x58b727['query'][_0x6af7('0x3f')]);_0x5e64a7[_0x6af7('0x41')]=qs[_0x6af7('0x37')](_['pick'](_0x58b727['query'],_0x279f76[_0x6af7('0x37')]));if(_0x58b727[_0x6af7('0x35')][_0x6af7('0x40')]){_0x5e64a7[_0x6af7('0x41')]=_[_0x6af7('0x42')](_0x5e64a7[_0x6af7('0x41')],{'$or':_['map'](_0x5e64a7['attributes'],function(_0x25cd02){var _0x2e5a74={};_0x2e5a74[_0x25cd02]={'$like':'%'+_0x58b727[_0x6af7('0x35')]['filter']+'%'};return _0x2e5a74;})});}if(_0x58b727[_0x6af7('0x35')][_0x6af7('0x5e')]){var _0x3d4a5a=_0x58b727[_0x6af7('0x35')][_0x6af7('0x5e')]['split'](',');var _0x3b725e={};_0x3b725e[_0x3d4a5a[0x0]]={'$gte':moment(_0x3d4a5a[0x1])['format'](_0x6af7('0x5f'))};_0x5e64a7[_0x6af7('0x41')]=_[_0x6af7('0x42')](_0x5e64a7[_0x6af7('0x41')],_0x3b725e);}_0x5e64a7=_[_0x6af7('0x42')]({},_0x5e64a7,_0x58b727[_0x6af7('0x4a')]);return _0x17586f['getMessages'](_0x5e64a7);}})['then'](function(_0x56c142){if(_0x56c142){_0x21081c=_0x56c142[_0x6af7('0x3b')];if(!_0x58b727[_0x6af7('0x35')][_0x6af7('0x3c')](_0x6af7('0x3d'))){_0x5e64a7[_0x6af7('0x22')]=qs[_0x6af7('0x22')](_0x58b727[_0x6af7('0x35')][_0x6af7('0x22')]);_0x5e64a7['offset']=qs[_0x6af7('0x1f')](_0x58b727['query'][_0x6af7('0x1f')]);}return _0x17586f[_0x6af7('0x5d')](_0x5e64a7);}})['then'](function(_0x160a13){if(_0x160a13){return _0x160a13?{'count':_0x21081c,'rows':_0x160a13}:null;}})[_0x6af7('0x28')](respondWithResult(_0x23da3f,null))[_0x6af7('0x45')](handleError(_0x23da3f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9cdd646..1f1075c 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 _0x6bd1=['emit','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x287184,_0x1231a7){var _0x1b59f3=function(_0x28ba9a){while(--_0x28ba9a){_0x287184['push'](_0x287184['shift']());}};_0x1b59f3(++_0x1231a7);}(_0x6bd1,0xe8));var _0x16bd=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x6bd1[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0x16bd('0x0'));var ChatGroup=require(_0x16bd('0x1'))['db'][_0x16bd('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x16bd('0x3')](0x0);var events={'afterCreate':_0x16bd('0x4'),'afterUpdate':_0x16bd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42c392){return function(_0x13490f,_0x167f73,_0x5943a3){ChatGroupEvents[_0x16bd('0x6')](_0x42c392+':'+_0x13490f['id'],_0x13490f);ChatGroupEvents[_0x16bd('0x6')](_0x42c392,_0x13490f);_0x5943a3(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 _0xe969=['hasOwnProperty','hook','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe969,0x11a));var _0x9e96=function(_0x59ded6,_0x2d75a6){_0x59ded6=_0x59ded6-0x0;var _0x370563=_0xe969[_0x59ded6];return _0x370563;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x9e96('0x0'))['db'][_0x9e96('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9e96('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e96('0x3'),'afterDestroy':_0x9e96('0x4')};function emitEvent(_0x73d180){return function(_0x4adb1d,_0x38694b,_0x5a0c99){ChatGroupEvents[_0x9e96('0x5')](_0x73d180+':'+_0x4adb1d['id'],_0x4adb1d);ChatGroupEvents[_0x9e96('0x5')](_0x73d180,_0x4adb1d);_0x5a0c99(null);};}for(var e in events){if(events[_0x9e96('0x6')](e)){var event=events[e];ChatGroup[_0x9e96('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f1556b2..c0f8a00 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 _0xe1b1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x2bac49,_0x1ff679){var _0x2fba36=function(_0x262320){while(--_0x262320){_0x2bac49['push'](_0x2bac49['shift']());}};_0x2fba36(++_0x1ff679);}(_0xe1b1,0x69));var _0x1e1b=function(_0x110844,_0x372560){_0x110844=_0x110844-0x0;var _0x55c2c6=_0xe1b1[_0x110844];return _0x55c2c6;};'use strict';var _=require(_0x1e1b('0x0'));var util=require(_0x1e1b('0x1'));var logger=require(_0x1e1b('0x2'))(_0x1e1b('0x3'));var moment=require(_0x1e1b('0x4'));var BPromise=require(_0x1e1b('0x5'));var rp=require(_0x1e1b('0x6'));var fs=require('fs');var path=require(_0x1e1b('0x7'));var rimraf=require(_0x1e1b('0x8'));var config=require(_0x1e1b('0x9'));var attributes=require(_0x1e1b('0xa'));module[_0x1e1b('0xb')]=function(_0xf6d9b5,_0x4fd1c8){return _0xf6d9b5[_0x1e1b('0xc')](_0x1e1b('0xd'),attributes,{'tableName':_0x1e1b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cf0=['./chatGroup.attributes','define','ChatGroup','lodash','util','api','moment','request-promise','rimraf'];(function(_0x53e29e,_0x17c540){var _0x54c118=function(_0x45b1bf){while(--_0x45b1bf){_0x53e29e['push'](_0x53e29e['shift']());}};_0x54c118(++_0x17c540);}(_0x9cf0,0xe4));var _0x09cf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9cf0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x09cf('0x0'));var util=require(_0x09cf('0x1'));var logger=require('../../config/logger')(_0x09cf('0x2'));var moment=require(_0x09cf('0x3'));var BPromise=require('bluebird');var rp=require(_0x09cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09cf('0x5'));var config=require('../../config/environment');var attributes=require(_0x09cf('0x6'));module['exports']=function(_0x310539,_0x4de535){return _0x310539[_0x09cf('0x7')](_0x09cf('0x8'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 9dcd6e0..f656055 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 _0x8f9e=['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','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x8f9e,0x160));var _0xe8f9=function(_0x491d38,_0xf06ba1){_0x491d38=_0x491d38-0x0;var _0xc066de=_0x8f9e[_0x491d38];return _0xc066de;};'use strict';var _=require(_0xe8f9('0x0'));var util=require(_0xe8f9('0x1'));var moment=require('moment');var BPromise=require(_0xe8f9('0x2'));var rs=require(_0xe8f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe8f9('0x4'))('rpc');var config=require(_0xe8f9('0x5'));var jayson=require(_0xe8f9('0x6'));var client=jayson[_0xe8f9('0x7')][_0xe8f9('0x8')]({'port':0x232a});config[_0xe8f9('0x9')]=_[_0xe8f9('0xa')](config['redis'],{'host':_0xe8f9('0xb'),'port':0x18eb});var socket=require(_0xe8f9('0xc'))(new Redis(config[_0xe8f9('0x9')]));require(_0xe8f9('0xd'))[_0xe8f9('0xe')](socket);function respondWithRpcPromise(_0x4b2417,_0x8c8658,_0x88109d){return new BPromise(function(_0x7ce949,_0x404b2b){return client[_0xe8f9('0xf')](_0x4b2417,_0x88109d)[_0xe8f9('0x10')](function(_0x59b0ca){logger[_0xe8f9('0x11')]('ChatGroup,\x20%s,\x20%s',_0x8c8658,_0xe8f9('0x12'));logger[_0xe8f9('0x13')](_0xe8f9('0x14'),_0x8c8658,'request\x20sent',JSON[_0xe8f9('0x15')](_0x59b0ca));if(_0x59b0ca[_0xe8f9('0x16')]){if(_0x59b0ca['error'][_0xe8f9('0x17')]===0x1f4){logger['error'](_0xe8f9('0x18'),_0x8c8658,_0x59b0ca['error'][_0xe8f9('0x19')]);return _0x404b2b(_0x59b0ca[_0xe8f9('0x16')][_0xe8f9('0x19')]);}logger[_0xe8f9('0x16')](_0xe8f9('0x18'),_0x8c8658,_0x59b0ca[_0xe8f9('0x16')][_0xe8f9('0x19')]);return _0x7ce949(_0x59b0ca[_0xe8f9('0x16')][_0xe8f9('0x19')]);}else{logger[_0xe8f9('0x11')](_0xe8f9('0x18'),_0x8c8658,_0xe8f9('0x12'));_0x7ce949(_0x59b0ca[_0xe8f9('0x1a')][_0xe8f9('0x19')]);}})[_0xe8f9('0x1b')](function(_0x3309de){logger['error'](_0xe8f9('0x18'),_0x8c8658,_0x3309de);_0x404b2b(_0x3309de);});});} \ No newline at end of file +var _0x3435=['register','request','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x3c2d00,_0xb9f383){var _0xa3c945=function(_0x28d0fc){while(--_0x28d0fc){_0x3c2d00['push'](_0x3c2d00['shift']());}};_0xa3c945(++_0xb9f383);}(_0x3435,0xfa));var _0x5343=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x3435[_0x178856];return _0x3c7fe7;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var rs=require(_0x5343('0x4'));var fs=require('fs');var Redis=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5343('0x6'));var logger=require(_0x5343('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});config['redis']=_[_0x5343('0xa')](config[_0x5343('0xb')],{'host':_0x5343('0xc'),'port':0x18eb});var socket=require(_0x5343('0xd'))(new Redis(config[_0x5343('0xb')]));require('./chatGroup.socket')[_0x5343('0xe')](socket);function respondWithRpcPromise(_0x50d857,_0x1b310a,_0x328e54){return new BPromise(function(_0x27ed68,_0x2e6df1){return client[_0x5343('0xf')](_0x50d857,_0x328e54)['then'](function(_0x42a94a){logger[_0x5343('0x10')](_0x5343('0x11'),_0x1b310a,'request\x20sent');logger[_0x5343('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1b310a,_0x5343('0x13'),JSON[_0x5343('0x14')](_0x42a94a));if(_0x42a94a['error']){if(_0x42a94a[_0x5343('0x15')]['code']===0x1f4){logger[_0x5343('0x15')](_0x5343('0x11'),_0x1b310a,_0x42a94a[_0x5343('0x15')][_0x5343('0x16')]);return _0x2e6df1(_0x42a94a['error'][_0x5343('0x16')]);}logger[_0x5343('0x15')](_0x5343('0x11'),_0x1b310a,_0x42a94a[_0x5343('0x15')][_0x5343('0x16')]);return _0x27ed68(_0x42a94a[_0x5343('0x15')][_0x5343('0x16')]);}else{logger[_0x5343('0x10')]('ChatGroup,\x20%s,\x20%s',_0x1b310a,_0x5343('0x13'));_0x27ed68(_0x42a94a[_0x5343('0x17')][_0x5343('0x16')]);}})['catch'](function(_0x1eb3bd){logger[_0x5343('0x15')](_0x5343('0x11'),_0x1b310a,_0x1eb3bd);_0x2e6df1(_0x1eb3bd);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1fd494c..3e3ea0d 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 _0x14e6=['update','emit','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x288b0c,_0x320f29){var _0x4c4681=function(_0x1cf78c){while(--_0x1cf78c){_0x288b0c['push'](_0x288b0c['shift']());}};_0x4c4681(++_0x320f29);}(_0x14e6,0xa5));var _0x614e=function(_0x4ae024,_0x2e3bfc){_0x4ae024=_0x4ae024-0x0;var _0x1b0f81=_0x14e6[_0x4ae024];return _0x1b0f81;};'use strict';var ChatGroupEvents=require(_0x614e('0x0'));var events=[_0x614e('0x1'),_0x614e('0x2'),_0x614e('0x3')];function createListener(_0x3eb157,_0x258c26){return function(_0x1c8267){_0x258c26[_0x614e('0x4')](_0x3eb157,_0x1c8267);};}function removeListener(_0x34f133,_0x18dbd1){return function(){ChatGroupEvents['removeListener'](_0x34f133,_0x18dbd1);};}exports[_0x614e('0x5')]=function(_0x3a08c0){for(var _0x2bd04d=0x0,_0x93f318=events[_0x614e('0x6')];_0x2bd04d<_0x93f318;_0x2bd04d++){var _0x5723af=events[_0x2bd04d];var _0x41a010=createListener(_0x614e('0x7')+_0x5723af,_0x3a08c0);ChatGroupEvents['on'](_0x5723af,_0x41a010);}}; \ No newline at end of file +var _0x82cf=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x82cf,0x79));var _0xf82c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x82cf[_0x2d7f0e];return _0x110b07;};'use strict';var ChatGroupEvents=require(_0xf82c('0x0'));var events=[_0xf82c('0x1'),_0xf82c('0x2'),_0xf82c('0x3')];function createListener(_0x482c9e,_0x522146){return function(_0x1d9514){_0x522146[_0xf82c('0x4')](_0x482c9e,_0x1d9514);};}function removeListener(_0x19575f,_0x1eec85){return function(){ChatGroupEvents[_0xf82c('0x5')](_0x19575f,_0x1eec85);};}exports[_0xf82c('0x6')]=function(_0x1746c4){for(var _0xf8d72a=0x0,_0x3e5163=events[_0xf82c('0x7')];_0xf8d72a<_0x3e5163;_0xf8d72a++){var _0x2839c2=events[_0xf8d72a];var _0x39862d=createListener(_0xf82c('0x8')+_0x2839c2,_0x1746c4);ChatGroupEvents['on'](_0x2839c2,_0x39862d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index da90d47..52c2467 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 _0xaee8=['/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','delete','removeMembers','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xaee8,0x143));var _0x8aee=function(_0x41fcb8,_0x12c1e9){_0x41fcb8=_0x41fcb8-0x0;var _0x3c7d62=_0xaee8[_0x41fcb8];return _0x3c7d62;};'use strict';var multer=require(_0x8aee('0x0'));var util=require(_0x8aee('0x1'));var path=require(_0x8aee('0x2'));var timeout=require(_0x8aee('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8aee('0x4'));var auth=require(_0x8aee('0x5'));var interaction=require(_0x8aee('0x6'));var config=require(_0x8aee('0x7'));var controller=require(_0x8aee('0x8'));router[_0x8aee('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8aee('0xa'),auth[_0x8aee('0xb')](),controller[_0x8aee('0xc')]);router[_0x8aee('0x9')](_0x8aee('0xd'),auth[_0x8aee('0xb')](),controller[_0x8aee('0xe')]);router[_0x8aee('0x9')](_0x8aee('0xf'),auth[_0x8aee('0xb')](),controller[_0x8aee('0x10')]);router['get']('/:id/members',auth[_0x8aee('0xb')](),controller[_0x8aee('0x11')]);router[_0x8aee('0x9')](_0x8aee('0x12'),auth['isAuthenticated'](),controller[_0x8aee('0x13')]);router['post']('/',auth[_0x8aee('0xb')](),controller['create']);router[_0x8aee('0x14')](_0x8aee('0x15'),auth[_0x8aee('0xb')](),controller['addMembers']);router[_0x8aee('0x14')](_0x8aee('0x12'),auth[_0x8aee('0xb')](),controller['addMessage']);router['put'](_0x8aee('0xd'),auth[_0x8aee('0xb')](),controller['update']);router[_0x8aee('0x16')]('/:id',auth[_0x8aee('0xb')](),controller['destroy']);router[_0x8aee('0x16')](_0x8aee('0x15'),auth[_0x8aee('0xb')](),controller[_0x8aee('0x17')]);module['exports']=router; \ No newline at end of file +var _0x9c6c=['get','isAuthenticated','describe','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra'];(function(_0x350d9e,_0x1d8afb){var _0x6cc933=function(_0x5344b2){while(--_0x5344b2){_0x350d9e['push'](_0x350d9e['shift']());}};_0x6cc933(++_0x1d8afb);}(_0x9c6c,0x113));var _0xc9c6=function(_0x42ec17,_0x2758a0){_0x42ec17=_0x42ec17-0x0;var _0x5bae9e=_0x9c6c[_0x42ec17];return _0x5bae9e;};'use strict';var multer=require(_0xc9c6('0x0'));var util=require('util');var path=require(_0xc9c6('0x1'));var timeout=require(_0xc9c6('0x2'));var express=require(_0xc9c6('0x3'));var router=express['Router']();var fs_extra=require(_0xc9c6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0xc9c6('0x5')]('/',auth[_0xc9c6('0x6')](),controller['index']);router[_0xc9c6('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xc9c6('0x7')]);router['get']('/:id',auth[_0xc9c6('0x6')](),controller['show']);router[_0xc9c6('0x5')](_0xc9c6('0x8'),auth[_0xc9c6('0x6')](),controller[_0xc9c6('0x9')]);router['get'](_0xc9c6('0xa'),auth[_0xc9c6('0x6')](),controller[_0xc9c6('0xb')]);router[_0xc9c6('0x5')]('/:id/messages',auth[_0xc9c6('0x6')](),controller[_0xc9c6('0xc')]);router[_0xc9c6('0xd')]('/',auth[_0xc9c6('0x6')](),controller[_0xc9c6('0xe')]);router['post'](_0xc9c6('0xa'),auth['isAuthenticated'](),controller['addMembers']);router['post']('/:id/messages',auth[_0xc9c6('0x6')](),controller['addMessage']);router[_0xc9c6('0xf')](_0xc9c6('0x10'),auth[_0xc9c6('0x6')](),controller[_0xc9c6('0x11')]);router[_0xc9c6('0x12')](_0xc9c6('0x10'),auth['isAuthenticated'](),controller[_0xc9c6('0x13')]);router[_0xc9c6('0x12')](_0xc9c6('0xa'),auth[_0xc9c6('0x6')](),controller['removeMembers']);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 ea53bff..4ce12a1 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 _0x00ea=['BOOLEAN','ENUM','star','thumb','TEXT','DATE','STRING','long','exports'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x00ea,0x19d));var _0xa00e=function(_0x12e0d9,_0xf9817c){_0x12e0d9=_0x12e0d9-0x0;var _0x53b561=_0x00ea[_0x12e0d9];return _0x53b561;};'use strict';var Sequelize=require('sequelize');module[_0xa00e('0x0')]={'closed':{'type':Sequelize[_0xa00e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa00e('0x2')](_0xa00e('0x3'),_0xa00e('0x4')),'defaultValue':_0xa00e('0x3')},'ratingMessage':{'type':Sequelize[_0xa00e('0x5')]},'pathTranscript':{'type':Sequelize[_0xa00e('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa00e('0x6')]},'disposition':{'type':Sequelize[_0xa00e('0x7')]},'secondDisposition':{'type':Sequelize[_0xa00e('0x7')]},'thirdDisposition':{'type':Sequelize[_0xa00e('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xa00e('0x7')]},'browserVersion':{'type':Sequelize[_0xa00e('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa00e('0x7')]},'deviceModel':{'type':Sequelize[_0xa00e('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xa00e('0x7')]},'referer':{'type':Sequelize[_0xa00e('0x5')]},'customerIp':{'type':Sequelize[_0xa00e('0x7')]},'formData':{'type':Sequelize['TEXT'](_0xa00e('0x8'))},'read1stAt':{'type':Sequelize[_0xa00e('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa00e('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa00e('0x7')]},'customerPort':{'type':Sequelize[_0xa00e('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xa00e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xa00e('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x1beb=['ENUM','star','TEXT','STRING','DATE','long','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x50521a,_0x59dd5e){var _0x4c3aa1=function(_0x15a28b){while(--_0x15a28b){_0x50521a['push'](_0x50521a['shift']());}};_0x4c3aa1(++_0x59dd5e);}(_0x1beb,0x165));var _0xb1be=function(_0x16176e,_0x82a1b2){_0x16176e=_0x16176e-0x0;var _0x3769f4=_0x1beb[_0x16176e];return _0x3769f4;};'use strict';var Sequelize=require(_0xb1be('0x0'));module[_0xb1be('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb1be('0x2')]},'ratingType':{'type':Sequelize[_0xb1be('0x3')](_0xb1be('0x4'),'thumb'),'defaultValue':_0xb1be('0x4')},'ratingMessage':{'type':Sequelize[_0xb1be('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xb1be('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb1be('0x7')]},'disposition':{'type':Sequelize[_0xb1be('0x6')]},'secondDisposition':{'type':Sequelize[_0xb1be('0x6')]},'thirdDisposition':{'type':Sequelize[_0xb1be('0x6')]},'note':{'type':Sequelize[_0xb1be('0x6')]},'browserName':{'type':Sequelize[_0xb1be('0x6')]},'browserVersion':{'type':Sequelize[_0xb1be('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xb1be('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xb1be('0x6')]},'referer':{'type':Sequelize[_0xb1be('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xb1be('0x8'))},'read1stAt':{'type':Sequelize[_0xb1be('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb1be('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xb1be('0x6')]},'customerPort':{'type':Sequelize[_0xb1be('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xb1be('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 03854bd..d8c9619 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 _0xddda=['basename','existsSync','createReadStream','pipe','createWriteStream','firstName','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','Users','map','fullname','TagIds','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','UserId','disposition','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','field','color','tools_tags','select','u.fullname','from','user_has_chat_interactions','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','toString','sequelize','keyBy','Account.key','a.mandatoryDisposition','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','Contact.lastName','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','include','catch','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','vidaooEscalation','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','System','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ChatMessage','ids','omit','getMessages','nolimit','order','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','getMyMessages','includeAgent','alias','addTags','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','direction','Account','Owner','get','mkdirSync','N.A.','closedAt','browserName','referer','customerIp','customerPort'];(function(_0x166f3c,_0x5770af){var _0x58e68b=function(_0x3242ca){while(--_0x3242ca){_0x166f3c['push'](_0x166f3c['shift']());}};_0x58e68b(++_0x5770af);}(_0xddda,0x14a));var _0xaddd=function(_0x1c0847,_0x5e4a){_0x1c0847=_0x1c0847-0x0;var _0xd43a48=_0xddda[_0x1c0847];return _0xd43a48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaddd('0x0'));var zipdir=require(_0xaddd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaddd('0x2'));var BPromise=require(_0xaddd('0x3'));var Mustache=require(_0xaddd('0x4'));var util=require(_0xaddd('0x5'));var path=require(_0xaddd('0x6'));var sox=require(_0xaddd('0x7'));var csv=require(_0xaddd('0x8'));var ejs=require(_0xaddd('0x9'));var fs=require('fs');var fs_extra=require(_0xaddd('0xa'));var _=require('lodash');var squel=require(_0xaddd('0xb'));var crypto=require(_0xaddd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaddd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaddd('0xe'));var Papa=require(_0xaddd('0xf'));var Redis=require('ioredis');var authService=require(_0xaddd('0x10'));var qs=require(_0xaddd('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xaddd('0x12'));var hardwareService=require(_0xaddd('0x13'));var logger=require(_0xaddd('0x14'))(_0xaddd('0x15'));var utils=require(_0xaddd('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaddd('0x17'))['db'];config[_0xaddd('0x18')]=_['defaults'](config['redis'],{'host':_0xaddd('0x19'),'port':0x18eb});var socket=require(_0xaddd('0x1a'))(new Redis(config[_0xaddd('0x18')]));require(_0xaddd('0x1b'))[_0xaddd('0x1c')](socket);var jayson=require(_0xaddd('0x1d'));var client=jayson['client'][_0xaddd('0x1e')]({'port':0x232b});var client9004=jayson[_0xaddd('0x1f')][_0xaddd('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x35fd61,_0x3deb31,_0x45ba06,_0x506ba3){return new BPromise(function(_0x2b18f3,_0x28b897){var _0x144449=_0x506ba3||client;return _0x144449[_0xaddd('0x20')](_0x35fd61,_0x45ba06)['then'](function(_0x263a84){logger[_0xaddd('0x21')](_0xaddd('0x22'),_0x3deb31,_0xaddd('0x23'));logger['debug'](_0xaddd('0x24'),_0x3deb31,_0xaddd('0x23'),JSON['stringify'](_0x263a84));if(_0x263a84[_0xaddd('0x25')]){if(_0x263a84[_0xaddd('0x25')][_0xaddd('0x26')]===0x1f4){logger[_0xaddd('0x25')](_0xaddd('0x22'),_0x3deb31,_0x263a84[_0xaddd('0x25')][_0xaddd('0x27')]);return _0x28b897(_0x263a84[_0xaddd('0x25')]['message']);}logger['error'](_0xaddd('0x22'),_0x3deb31,_0x263a84[_0xaddd('0x25')][_0xaddd('0x27')]);return _0x2b18f3(_0x263a84['error'][_0xaddd('0x27')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3deb31,_0xaddd('0x23'));_0x2b18f3(_0x263a84['result'][_0xaddd('0x27')]);}})['catch'](function(_0x589b46){logger[_0xaddd('0x25')](_0xaddd('0x22'),_0x3deb31,_0x589b46);_0x28b897(_0x589b46);});});}function respondWithStatusCode(_0x1b42ba,_0x3f7a99){_0x3f7a99=_0x3f7a99||0xcc;return function(_0xffed69){if(_0xffed69){return _0x1b42ba[_0xaddd('0x28')](_0x3f7a99);}return _0x1b42ba[_0xaddd('0x29')](_0x3f7a99)[_0xaddd('0x2a')]();};}function respondWithResult(_0x593f37,_0x224acf){_0x224acf=_0x224acf||0xc8;return function(_0x4832b2){if(_0x4832b2){return _0x593f37[_0xaddd('0x29')](_0x224acf)[_0xaddd('0x2b')](_0x4832b2);}};}function respondWithFilteredResult(_0x4d4c96,_0x169a89){return function(_0x48bd8a){if(_0x48bd8a){var _0x20f386=typeof _0x169a89[_0xaddd('0x2c')]===_0xaddd('0x2d')&&typeof _0x169a89[_0xaddd('0x2e')]===_0xaddd('0x2d');var _0x3b9724=_0x48bd8a['count'];var _0x4c3308=_0x20f386?0x0:_0x169a89[_0xaddd('0x2c')];var _0x382444=_0x20f386?_0x48bd8a[_0xaddd('0x2f')]:_0x169a89['offset']+_0x169a89[_0xaddd('0x2e')];var _0x2d2be4;if(_0x382444>=_0x3b9724){_0x382444=_0x3b9724;_0x2d2be4=0xc8;}else{_0x2d2be4=0xce;}_0x4d4c96[_0xaddd('0x29')](_0x2d2be4);return _0x4d4c96[_0xaddd('0x30')]('Content-Range',_0x4c3308+'-'+_0x382444+'/'+_0x3b9724)[_0xaddd('0x2b')](_0x48bd8a);}return null;};}function patchUpdates(_0x323e46){return function(_0x2c2927){try{jsonpatch[_0xaddd('0x31')](_0x2c2927,_0x323e46,!![]);}catch(_0x23bd8e){return BPromise[_0xaddd('0x32')](_0x23bd8e);}return _0x2c2927[_0xaddd('0x33')]();};}function saveUpdates(_0x167c20,_0x267d1d){return function(_0x5744ec){if(_0x5744ec){return _0x5744ec[_0xaddd('0x34')](_0x167c20)[_0xaddd('0x35')](function(_0x44f79e){return _0x44f79e;});}return null;};}function removeEntity(_0x147246,_0x5ad3e3){return function(_0x45dc01){if(_0x45dc01){return _0x45dc01[_0xaddd('0x36')]()[_0xaddd('0x35')](function(){_0x147246['status'](0xcc)[_0xaddd('0x2a')]();});}};}function handleEntityNotFound(_0x37f699,_0x135239){return function(_0x18f74b){if(!_0x18f74b){_0x37f699['sendStatus'](0x194);}return _0x18f74b;};}function handleError(_0x1e84e0,_0x424737){_0x424737=_0x424737||0x1f4;return function(_0x312b6f){logger[_0xaddd('0x25')](_0x312b6f[_0xaddd('0x37')]);if(_0x312b6f[_0xaddd('0x38')]){delete _0x312b6f[_0xaddd('0x38')];}_0x1e84e0[_0xaddd('0x29')](_0x424737)[_0xaddd('0x39')](_0x312b6f);};}function getMustacheRender(_0x1575f0,_0x4836c1){return Mustache[_0xaddd('0x3a')](_0x1575f0,_[_0xaddd('0x3b')](_0x4836c1[_0xaddd('0x3c')],{'contact':_0x4836c1[_0xaddd('0x3d')],'message':_0x4836c1[_0xaddd('0x27')],'agent':_0x4836c1[_0xaddd('0x3e')],'interaction':_0x4836c1[_0xaddd('0x3f')],'account':_0x4836c1['account']}))||'';}function getInteractionUsers(_0x15efd3,_0x2dd198){return new BPromise(function(_0x1a4c6d,_0x4d9539){try{if(_0x2dd198[_0x15efd3['id']]){_0x15efd3[_0xaddd('0x40')]=_[_0xaddd('0x41')](_0x2dd198[_0x15efd3['id']],function(_0x500247){return{'id':_0x500247['id'],'fullname':_0x500247[_0xaddd('0x42')]};});}}catch(_0x18f9e2){_0x4d9539(_0x18f9e2);}_0x1a4c6d(_0x15efd3);});}function getInteractionTags(_0x2e9f37,_0x465231){return new BPromise(function(_0x57835d,_0x498aae){try{if(_0x2e9f37['TagIds']){_0x2e9f37['Tags']=[];_0x2e9f37[_0xaddd('0x43')]['split'](',')[_0xaddd('0x44')](function(_0x24be45){_0x2e9f37['Tags'][_0xaddd('0x45')](_0x465231[_0x24be45]);});}delete _0x2e9f37['TagIds'];}catch(_0x32b573){_0x498aae(_0x32b573);}_0x57835d(_0x2e9f37);});}function updateChatInteraction(_0x5bd0ef,_0x34dfb5,_0x70afd8){return new BPromise(function(_0x3f1db4,_0x22649a){return getInteractionUsers(_0x5bd0ef,_0x70afd8)[_0xaddd('0x35')](function(_0x2a2437){return getInteractionTags(_0x2a2437,_0x34dfb5);})[_0xaddd('0x35')](function(_0x58ef5f){return getStateInteraction(_0x58ef5f);})[_0xaddd('0x35')](function(_0x2b0954){_0x3f1db4(_0x2b0954);})['catch'](function(_0x1b01ce){_0x22649a(_0x1b01ce);});});}function getStateInteraction(_0x3b4053){return new BPromise(function(_0x58578c){_0x3b4053[_0xaddd('0x46')]=0x0;_0x3b4053[_0xaddd('0x47')]=0x0;_0x3b4053[_0xaddd('0x48')]=0x0;_0x3b4053[_0xaddd('0x49')]=0x0;_0x3b4053[_0xaddd('0x4a')]=0x0;_0x3b4053[_0xaddd('0x4b')]=0x0;if(!_0x3b4053['closed']&&!_0x3b4053[_0xaddd('0x4c')]){_0x3b4053['waiting']+=0x1;}if(!_0x3b4053['closed']&&_0x3b4053[_0xaddd('0x4c')]){_0x3b4053[_0xaddd('0x47')]+=0x1;if(_0x3b4053[_0xaddd('0x46')]){_0x3b4053[_0xaddd('0x46')]-=0x1;}}if(_0x3b4053['closed']&&_0x3b4053[_0xaddd('0x4d')]===_0xaddd('0x4a')){_0x3b4053[_0xaddd('0x4a')]+=0x1;if(_0x3b4053[_0xaddd('0x46')]){_0x3b4053['waiting']-=0x1;}}else if(_0x3b4053['closed']&&!_0x3b4053[_0xaddd('0x4c')]&&_0x3b4053['disposition']){_0x3b4053[_0xaddd('0x49')]+=0x1;if(_0x3b4053[_0xaddd('0x46')]){_0x3b4053[_0xaddd('0x46')]-=0x1;}}else if(_0x3b4053['closed']&&_0x3b4053[_0xaddd('0x4c')]){_0x3b4053[_0xaddd('0x48')]+=0x1;if(_0x3b4053[_0xaddd('0x47')]){_0x3b4053[_0xaddd('0x47')]-=0x1;}}_0x3b4053[_0xaddd('0x4b')]+=0x1;_0x58578c(_0x3b4053);});}exports['index']=function(_0x5a93e8,_0x36b971){var _0x1b2c59={},_0x7e5ec8={},_0x2fbca2={'count':0x0,'rows':[]};var _0x3d4236=_[_0xaddd('0x41')](db[_0xaddd('0x4e')][_0xaddd('0x4f')],function(_0x5a1c34){return{'name':_0x5a1c34[_0xaddd('0x50')],'type':_0x5a1c34[_0xaddd('0x51')][_0xaddd('0x52')]};});_0x7e5ec8[_0xaddd('0x53')]=_['map'](_0x3d4236,_0xaddd('0x38'));_0x7e5ec8[_0xaddd('0x54')]=_[_0xaddd('0x55')](_0x5a93e8[_0xaddd('0x54')]);_0x7e5ec8[_0xaddd('0x56')]=_[_0xaddd('0x57')](_0x7e5ec8[_0xaddd('0x53')],_0x7e5ec8[_0xaddd('0x54')]);_0x1b2c59[_0xaddd('0x58')]=_[_0xaddd('0x57')](_0x7e5ec8[_0xaddd('0x53')],qs[_0xaddd('0x59')](_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x59')]));_0x1b2c59[_0xaddd('0x58')]=_0x1b2c59[_0xaddd('0x58')][_0xaddd('0x5a')]?_0x1b2c59[_0xaddd('0x58')]:_0x7e5ec8['model'];if(!_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x5b')]('nolimit')){_0x1b2c59[_0xaddd('0x2e')]=qs[_0xaddd('0x2e')](_0x5a93e8['query'][_0xaddd('0x2e')]);_0x1b2c59[_0xaddd('0x2c')]=qs['offset'](_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x2c')]);}_0x1b2c59['order']=qs[_0xaddd('0x5c')](_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x5c')]);_0x1b2c59[_0xaddd('0x5d')]=qs[_0xaddd('0x56')](_[_0xaddd('0x5e')](_0x5a93e8[_0xaddd('0x54')],_0x7e5ec8[_0xaddd('0x56')]),_0x3d4236);var _0x4a3a93=[];var _0x11a2b8=squel['select']()[_0xaddd('0x5f')]('id')[_0xaddd('0x5f')](_0xaddd('0x38'))[_0xaddd('0x5f')](_0xaddd('0x60'))['from'](_0xaddd('0x61'));var _0x2789a6=squel[_0xaddd('0x62')]()[_0xaddd('0x5f')]('u.id')['field'](_0xaddd('0x63'))[_0xaddd('0x5f')]('ui.ChatInteractionId')[_0xaddd('0x64')](_0xaddd('0x65'),'ui')['left_join']('users','u',_0xaddd('0x66'));var _0x1ea112=squel[_0xaddd('0x62')]()[_0xaddd('0x64')]('chat_interactions','i')['left_join'](_0xaddd('0x67'),'c',_0xaddd('0x68'))[_0xaddd('0x69')](_0xaddd('0x6a'),'o','o.id\x20=\x20i.UserId')[_0xaddd('0x69')](_0xaddd('0x6b'),'a',_0xaddd('0x6c'))[_0xaddd('0x69')](_0xaddd('0x6d'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0xaddd('0x69')](_0xaddd('0x61'),'t',_0xaddd('0x6e'));var _0x1cbc4b=squel[_0xaddd('0x6f')]();var _0x22182d=[];var _0x3d9d67=squel[_0xaddd('0x6f')]();var _0x1232dc;if(_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x70')]){_0x1232dc=as[_0xaddd('0x71')](_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x70')]);var _0x4044df=_0x1232dc[_0xaddd('0x72')];for(var _0x473659=0x0;_0x473659<_0x1232dc[_0xaddd('0x73')][_0xaddd('0x5a')];_0x473659++){var _0x3e199e=_0x1232dc[_0xaddd('0x73')][_0x473659];var _0x2316bc='i';var _0x10ee86=_[_0xaddd('0x74')](_0x3d4236,[_0xaddd('0x38'),_0x3e199e[_0xaddd('0x5f')]]);if(!_0x10ee86){switch(_0x3e199e[_0xaddd('0x5f')]){case _0xaddd('0x75'):if(_0x3e199e['value']==0x1){_0x1ea112[_0xaddd('0x76')]('`'+_0x3e199e['field']+_0xaddd('0x77'));}else{_0x1ea112[_0xaddd('0x76')]('`'+_0x3e199e[_0xaddd('0x5f')]+_0xaddd('0x78'));}break;case _0xaddd('0x79'):if(_0x3e199e[_0xaddd('0x7a')]===_0xaddd('0x7b')){if(_0x3e199e[_0xaddd('0x7c')][_0xaddd('0x7d')]('\x20')[_0xaddd('0x5a')]>0x1){_0x1cbc4b[_0x4044df]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xaddd('0x7e')](_0x3e199e[_0xaddd('0x7c')]),null);}else{var _0x5ccfc0='%'+_0x3e199e[_0xaddd('0x7c')]+'%';_0x1cbc4b[_0x4044df]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5ccfc0,_0x5ccfc0,_0x5ccfc0);}}else{_0x10ee86=_[_0xaddd('0x74')](_0x3d4236,[_0xaddd('0x38'),_0xaddd('0x7f')]);_0x3e199e[_0xaddd('0x5f')]=_0xaddd('0x7f');_0x4b45c1=as[_0xaddd('0x80')](_0x2316bc,_0x10ee86['type'],_0x3e199e);_0x1cbc4b[_0x4044df](_0x4b45c1[_0xaddd('0x81')],_0x4b45c1[_0xaddd('0x7c')][_0xaddd('0x82')],_0x4b45c1[_0xaddd('0x7c')][_0xaddd('0x2a')]);}break;case _0xaddd('0x83'):var _0x129fbb=_0x3e199e[_0xaddd('0x7c')]['split'](',')[_0xaddd('0x41')](function(_0x5a65c3){return Number(_0x5a65c3);});_0x129fbb[_0xaddd('0x44')](function(_0x5a5f1f){_0x3d9d67['or'](_0xaddd('0x84'),'%,'+_0x5a5f1f+',%');});_0x22182d=_['union'](_0x22182d,_0x129fbb);break;case _0xaddd('0x85'):if(_0x3e199e[_0xaddd('0x7a')]===_0xaddd('0x7b')){_0x1cbc4b[_0x4044df](_0xaddd('0x86'),'%'+_0x3e199e[_0xaddd('0x7c')]+'%',null);}else{_0x10ee86=_[_0xaddd('0x74')](_0x3d4236,[_0xaddd('0x38'),_0xaddd('0x4c')]);_0x3e199e[_0xaddd('0x5f')]='UserId';_0x4b45c1=as['buildExpression'](_0x2316bc,_0x10ee86[_0xaddd('0x51')],_0x3e199e);_0x1cbc4b[_0x4044df](_0x4b45c1[_0xaddd('0x81')],_0x4b45c1[_0xaddd('0x7c')][_0xaddd('0x82')],_0x4b45c1['value'][_0xaddd('0x2a')]);}break;case _0xaddd('0x3c'):_0x4b45c1=as[_0xaddd('0x80')]('me',null,_0x3e199e);_0x1cbc4b[_0x4044df](_0x4b45c1[_0xaddd('0x81')],_0x4b45c1[_0xaddd('0x7c')][_0xaddd('0x82')],_0x4b45c1[_0xaddd('0x7c')]['end']);break;}}else{var _0x4b45c1=as['buildExpression'](_0x2316bc,_0x10ee86['type'],_0x3e199e);_0x1cbc4b[_0x4044df](_0x4b45c1['text'],_0x4b45c1[_0xaddd('0x7c')][_0xaddd('0x82')],_0x4b45c1['value'][_0xaddd('0x2a')]);}}}else{var _0x123bf1=_(_0x5a93e8[_0xaddd('0x54')])[_0xaddd('0x55')]()['map'](function(_0x2d5157){return _[_0xaddd('0x87')](_0x3d4236,[_0xaddd('0x38'),_0x2d5157])?_0x2d5157:undefined;})[_0xaddd('0x88')]()[_0xaddd('0x7c')]();if(!_[_0xaddd('0x89')](_0x123bf1)){_0x123bf1['forEach'](function(_0x5222a2){if(_0x5222a2===_0xaddd('0x8a')){_0x1ea112[_0xaddd('0x5d')]('i.ChatWebsiteId\x20IN\x20?',[][_0xaddd('0x8b')](_0x5a93e8[_0xaddd('0x54')][_0x5222a2]));}else if(_0x5222a2===_0xaddd('0x8c')){var _0x4ac0a2=JSON[_0xaddd('0x8d')](_0x5a93e8[_0xaddd('0x54')][_0x5222a2])[_0xaddd('0x8e')];var _0x55c312=JSON[_0xaddd('0x8d')](_0x5a93e8[_0xaddd('0x54')][_0x5222a2])['$lte'];_0x1ea112[_0xaddd('0x5d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4ac0a2,_0x55c312);}else{if(_0x5a93e8[_0xaddd('0x54')][_0x5222a2]===_0xaddd('0x8f')){_0x1ea112['where']('i.'+_0x5222a2+_0xaddd('0x90'));}else{_0x1ea112[_0xaddd('0x5d')]('i.'+_0x5222a2+_0xaddd('0x91'),_0x5a93e8[_0xaddd('0x54')][_0x5222a2]);}}});}if(_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x92')]){if(_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x92')]==0x1){_0x1ea112[_0xaddd('0x76')]('`unreadMessages`\x20=\x200');}else{_0x1ea112[_0xaddd('0x76')](_0xaddd('0x93'));}}if(_0x5a93e8['query'][_0xaddd('0x94')]){_0x22182d=_[_0xaddd('0x95')](_0x5a93e8[_0xaddd('0x54')]['tag'])?_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x94')]:new Array(_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x94')]);_0x22182d[_0xaddd('0x44')](function(_0x2cc17d){_0x3d9d67['or'](_0xaddd('0x84'),'%,'+_0x2cc17d+',%');});}if(_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x96')]){var _0x3429d8=_0x5a93e8['query'][_0xaddd('0x96')]['replace']('\x5c','\x5c\x5c')[_0xaddd('0x97')](/'/g,'\x27\x27');if(qs[_0xaddd('0x98')](_0x3429d8)){_0x1cbc4b['or']('i.id\x20LIKE\x20?',_0x3429d8+'%');}else{_0x1cbc4b['or'](_0xaddd('0x99'),qs[_0xaddd('0x7e')](_0x3429d8))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3429d8+'%');}}}_0x1ea112[_0xaddd('0x5d')](_0x1cbc4b);_0x1ea112[_0xaddd('0x9a')](_0xaddd('0x9b'));var _0x8a3af0={'type':db[_0xaddd('0x9c')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1e51da=_0x1ea112['clone']();_0x1e51da['field'](_0xaddd('0x9b'));_0x1e51da[_0xaddd('0x5f')](_0xaddd('0x9d'),_0xaddd('0x75'));if(_0x1b2c59['order']){_0x1b2c59['order'][_0xaddd('0x44')](function(_0x174151){var _0x2dbcc6=_0x174151[0x0]===_0xaddd('0x9e')?_0x174151[0x0]:'i.'+_0x174151[0x0];_0x1ea112['order'](_0x2dbcc6,_0x174151[0x1]===_0xaddd('0x9f')?![]:!![]);});}if(!_[_0xaddd('0x89')](_0x22182d)){_0x1ea112[_0xaddd('0x76')](_0x3d9d67);_0x1e51da[_0xaddd('0x5d')]('t.id\x20IN\x20?',_0x22182d);}BPromise[_0xaddd('0xa0')]()[_0xaddd('0x35')](function(){if(!_0x1232dc){if(_0x5a93e8['query']['ChatWebsiteId'])return;_0x1e51da[_0xaddd('0x5d')](_0xaddd('0xa1'));_0x1ea112['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x5a93e8[_0xaddd('0xa2')][_0xaddd('0xa3')]!==_0xaddd('0x3e'))return;return _0x5a93e8[_0xaddd('0xa2')][_0xaddd('0xa4')]({'attributes':['id'],'raw':!![]})[_0xaddd('0x35')](function(_0xf04589){if(_[_0xaddd('0x89')](_0xf04589)){_0x1e51da[_0xaddd('0x5d')]('i.ChatWebsiteId\x20IS\x20NULL');_0x1ea112[_0xaddd('0x5d')](_0xaddd('0xa5'));}else{_0x1e51da[_0xaddd('0x5d')](_0xaddd('0xa6'),_['map'](_0xf04589,'id'));_0x1ea112[_0xaddd('0x5d')](_0xaddd('0xa6'),_[_0xaddd('0x41')](_0xf04589,'id'));}});})['then'](function(){if(_0x5a93e8[_0xaddd('0xa2')]['role']===_0xaddd('0x3e')&&!_0x1232dc&&!_0x5a93e8[_0xaddd('0x54')]['ChatWebsiteId'])return[];return db['sequelize'][_0xaddd('0x54')](_0x1e51da[_0xaddd('0xa7')](),_0x8a3af0);})['then'](function(_0x32755e){_0x2fbca2[_0xaddd('0x2f')]=_0x32755e[_0xaddd('0x5a')];if(_0x2fbca2[_0xaddd('0x2f')]===0x0)return[];return db[_0xaddd('0xa8')][_0xaddd('0x54')](_0x11a2b8[_0xaddd('0xa7')](),_0x8a3af0)['then'](function(_0x3bf2f7){_0x4a3a93=_[_0xaddd('0xa9')](_0x3bf2f7,'id');_0x8a3af0=_['merge'](_0x8a3af0,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a93e8[_0xaddd('0x54')][_0xaddd('0x59')]){_0x1b2c59[_0xaddd('0x58')][_0xaddd('0x44')](function(_0x4ec5d5){_0x1ea112[_0xaddd('0x5f')]('i.'+_0x4ec5d5);});}else{_0x1ea112[_0xaddd('0x5f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xaddd('0x75'));_0x1ea112[_0xaddd('0x5f')]('a.key',_0xaddd('0xaa'));_0x1ea112[_0xaddd('0x5f')](_0xaddd('0xab'),'Account.mandatoryDisposition');_0x1ea112['field'](_0xaddd('0xac'),_0xaddd('0x9e'));_0x1ea112[_0xaddd('0x5f')](_0xaddd('0xad'));_0x1ea112[_0xaddd('0x5f')](_0xaddd('0xae'),_0xaddd('0xaf'));_0x1ea112[_0xaddd('0x5f')]('c.lastName',_0xaddd('0xb0'));_0x1ea112['field']('c.email',_0xaddd('0xb1'));_0x1ea112[_0xaddd('0x5f')]('c.phone',_0xaddd('0xb2'));_0x1ea112[_0xaddd('0x5f')](_0xaddd('0xb3'),'Contact.mobile');_0x1ea112[_0xaddd('0x5f')](_0xaddd('0xb4'),_0xaddd('0xb5'));_0x1ea112[_0xaddd('0x5f')]('o.fullname',_0xaddd('0xb6'));_0x1ea112[_0xaddd('0x5f')](_0xaddd('0xb7'),_0xaddd('0xb8'));_0x1ea112['field'](_0xaddd('0xb9'),_0xaddd('0x43'));}if(_0x1b2c59[_0xaddd('0x2e')])_0x1ea112['limit'](_0x1b2c59[_0xaddd('0x2e')]);if(_0x1b2c59[_0xaddd('0x2c')])_0x1ea112['offset'](_0x1b2c59[_0xaddd('0x2c')]);return db[_0xaddd('0xa8')][_0xaddd('0x54')](_0x1ea112['toString'](),_0x8a3af0);})['then'](function(_0x5eb1bb){if(_0x5eb1bb[_0xaddd('0x5a')]>0x0)_0x2789a6[_0xaddd('0x5d')](_0xaddd('0xba'),_[_0xaddd('0x41')](_0x5eb1bb,'id'));return db[_0xaddd('0xa8')][_0xaddd('0x54')](_0x2789a6[_0xaddd('0xa7')](),_0x8a3af0)[_0xaddd('0x35')](function(_0x571e13){var _0x219e5b=_[_0xaddd('0xbb')](_0x571e13,_0xaddd('0xbc'));var _0x4baa3f=[];_0x5eb1bb[_0xaddd('0x44')](function(_0x19d551){_0x4baa3f['push'](updateChatInteraction(_0x19d551,_0x4a3a93,_0x219e5b));});return BPromise[_0xaddd('0xbd')](_0x4baa3f);});});})['then'](function(_0x138ae1){_0x2fbca2[_0xaddd('0xbe')]=_0x138ae1;return _0x2fbca2;})['then'](respondWithFilteredResult(_0x36b971,_0x1b2c59))['catch'](handleError(_0x36b971,null));};exports[_0xaddd('0xbf')]=function(_0x3950ef,_0xa0745){var _0x3118f4={'raw':![],'where':{'id':_0x3950ef[_0xaddd('0xc0')]['id']}},_0x54e91d={};_0x54e91d[_0xaddd('0x53')]=_[_0xaddd('0x55')](db[_0xaddd('0x4e')]['rawAttributes']);_0x54e91d[_0xaddd('0x54')]=_[_0xaddd('0x55')](_0x3950ef[_0xaddd('0x54')]);_0x54e91d[_0xaddd('0x56')]=_[_0xaddd('0x57')](_0x54e91d['model'],_0x54e91d[_0xaddd('0x54')]);_0x3118f4[_0xaddd('0x58')]=_[_0xaddd('0x57')](_0x54e91d['model'],qs[_0xaddd('0x59')](_0x3950ef[_0xaddd('0x54')][_0xaddd('0x59')]));_0x3118f4[_0xaddd('0x58')]=_0x3118f4['attributes'][_0xaddd('0x5a')]?_0x3118f4[_0xaddd('0x58')]:_0x54e91d[_0xaddd('0x53')];if(_0x3950ef[_0xaddd('0x54')]['includeAll']){_0x3118f4[_0xaddd('0xc1')]=[{'all':!![]}];}_0x3118f4=_[_0xaddd('0x3b')]({},_0x3118f4,_0x3950ef['options']);return db[_0xaddd('0x4e')]['find'](_0x3118f4)[_0xaddd('0x35')](handleEntityNotFound(_0xa0745,null))[_0xaddd('0x35')](respondWithResult(_0xa0745,null))[_0xaddd('0xc2')](handleError(_0xa0745,null));};exports[_0xaddd('0xc3')]=function(_0x169dd7,_0x1efa31){return db[_0xaddd('0x4e')][_0xaddd('0xc3')](_0x169dd7[_0xaddd('0x3c')],{})[_0xaddd('0x35')](respondWithResult(_0x1efa31,0xc9))[_0xaddd('0xc2')](handleError(_0x1efa31,null));};exports[_0xaddd('0x34')]=function(_0x1be4ec,_0x31678f){if(_0x1be4ec[_0xaddd('0x3c')]['id']){delete _0x1be4ec[_0xaddd('0x3c')]['id'];}return db[_0xaddd('0x4e')][_0xaddd('0x74')]({'where':{'id':_0x1be4ec[_0xaddd('0xc0')]['id']}})[_0xaddd('0x35')](handleEntityNotFound(_0x31678f,null))[_0xaddd('0x35')](saveUpdates(_0x1be4ec['body'],null))['then'](respondWithResult(_0x31678f,null))[_0xaddd('0xc2')](handleError(_0x31678f,null));};exports[_0xaddd('0x36')]=function(_0x3b177d,_0x5c88ed){return db['ChatInteraction'][_0xaddd('0x74')]({'where':{'id':_0x3b177d['params']['id']}})[_0xaddd('0x35')](handleEntityNotFound(_0x5c88ed,null))['then'](removeEntity(_0x5c88ed,null))['catch'](handleError(_0x5c88ed,null));};exports[_0xaddd('0xc4')]=function(_0x151f03,_0x1e1377){return db['ChatInteraction'][_0xaddd('0xc4')]()[_0xaddd('0x35')](respondWithResult(_0x1e1377,null))[_0xaddd('0xc2')](handleError(_0x1e1377,null));};exports['createVidaooSession']=function(_0x5457b5,_0x56726f){var _0x33d126=_0x5457b5[_0xaddd('0xc0')]['id'];var _0x4ac955;var _0x5d06db;var _0x8cf1a;return db[_0xaddd('0x4e')][_0xaddd('0xc5')]({'where':{'id':_0x33d126}})['then'](function(_0x9c6a44){_0x4ac955=_0x9c6a44;return db[_0xaddd('0xc6')][_0xaddd('0xc5')]({'where':{'id':_0x9c6a44[_0xaddd('0x8a')]},'attributes':['id',_0xaddd('0xc7'),'vidaooEscalation',_0xaddd('0xc8'),_0xaddd('0xc9'),'vidaooMetadata'],'raw':!![]});})[_0xaddd('0x35')](function(_0x27d0d0){if(_0x27d0d0&&_0x27d0d0[_0xaddd('0xc7')]&&_0x27d0d0[_0xaddd('0xca')]){_0x5d06db=_0x27d0d0;var _0x4df1f0={'interaction':{'id':_0x33d126},'agent':{'id':_0x5457b5[_0xaddd('0xa2')]['id'],'name':_0x5457b5[_0xaddd('0xa2')]['name'],'fullname':_0x5457b5['user'][_0xaddd('0x42')],'email':_0x5457b5[_0xaddd('0xa2')][_0xaddd('0xcb')]},'contact':_0x5457b5[_0xaddd('0x3c')]['contact'],'account':_0x5457b5[_0xaddd('0x3c')][_0xaddd('0xcc')]};var _0x593db4={'rejectUnauthorized':![],'method':'POST','url':_0xaddd('0xcd'),'headers':{'X-APIKEY':_0x27d0d0[_0xaddd('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5457b5[_0xaddd('0xa2')][_0xaddd('0xcb')]],'buttons':null,'topic':_0x5d06db[_0xaddd('0xc8')],'note':_[_0xaddd('0xce')](_0x5d06db[_0xaddd('0xc9')])?null:getMustacheRender(_0x5d06db['vidaooNote'],_0x4df1f0),'metadata':null},'redirect':_0xaddd('0xcf'),'json':!![]};try{if(!_[_0xaddd('0xce')](_0x5d06db[_0xaddd('0xd0')])){var _0x2f449a=getMustacheRender(_0x5d06db[_0xaddd('0xd0')],_0x4df1f0);var _0x32b8c5=JSON[_0xaddd('0x8d')](_0x2f449a);_0x593db4[_0xaddd('0x3c')][_0xaddd('0xd1')]=_0x32b8c5;}}catch(_0x41173e){throw new db[(_0xaddd('0x9c'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x593db4);}else{throw new db[(_0xaddd('0x9c'))][(_0xaddd('0xd2'))](_0xaddd('0xd3'));}})[_0xaddd('0x35')](function(_0x39577c){_0x8cf1a=_0x39577c;if(_0x8cf1a['id']){var _0x2ade70={'body':_0x8cf1a[_0xaddd('0xd4')],'ChatWebsiteId':_0x5d06db['id'],'ChatInteractionId':_0x4ac955['id'],'direction':_0xaddd('0xd5'),'UserId':_0x5457b5[_0xaddd('0xa2')]['id']};return db['ChatMessage'][_0xaddd('0xc3')](_0x2ade70,{});}else{throw new db['Sequelize'][(_0xaddd('0xd2'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xaddd('0x35')](function(){return _0x4ac955[_0xaddd('0xd6')]({'vidaooSessionId':_0x8cf1a['id']});})[_0xaddd('0x35')](respondWithResult(_0x56726f,null))[_0xaddd('0xc2')](handleError(_0x56726f,null));};exports[_0xaddd('0xd7')]=function(_0x1ed5d3,_0x13c8af){if(_0x1ed5d3[_0xaddd('0x3c')]['id']){delete _0x1ed5d3['body']['id'];}return db[_0xaddd('0x4e')][_0xaddd('0x74')]({'where':{'id':_0x1ed5d3[_0xaddd('0xc0')]['id']},'include':[{'model':db[_0xaddd('0xd8')],'as':_0xaddd('0x79')}]})[_0xaddd('0x35')](handleEntityNotFound(_0x13c8af,null))[_0xaddd('0x35')](saveUpdates(_0x1ed5d3[_0xaddd('0x3c')],null))[_0xaddd('0x35')](respondWithResult(_0x13c8af,null))[_0xaddd('0xc2')](handleError(_0x13c8af,null));};exports[_0xaddd('0xd9')]=function(_0x523523,_0x4a2dfc,_0x15a67b){if(_0x523523[_0xaddd('0x3c')]['id']){delete _0x523523['body']['id'];}return db[_0xaddd('0x4e')]['find']({'where':{'id':_0x523523[_0xaddd('0xc0')]['id']}})[_0xaddd('0x35')](function(_0x178166){if(!_0x178166){logger[_0xaddd('0x25')](_0xaddd('0xda'),'abandon',0x194,_0xaddd('0xdb'));_0x4a2dfc[_0xaddd('0x28')](0x194);}else{if(_0x178166['UserId']){throw new db[(_0xaddd('0x9c'))][(_0xaddd('0xd2'))](_0xaddd('0xdc'));}}return _0x178166;})['then'](function(_0x335511){if(_0x335511){return _0x335511['update']({'closed':_0x523523[_0xaddd('0x3c')][_0xaddd('0xdd')],'disposition':_0x523523[_0xaddd('0x3c')][_0xaddd('0x4d')]})[_0xaddd('0x35')](function(_0x1250f7){return _0x1250f7;});}})['then'](function(_0x160775){return respondWithRpcPromise(_0xaddd('0xde'),'abandon',_0x523523[_0xaddd('0x3c')],client9004);})[_0xaddd('0x35')](respondWithResult(_0x4a2dfc,null))[_0xaddd('0xc2')](handleError(_0x4a2dfc,null));};exports['attachmentUpload']=function(_0x30475a,_0x18b591,_0x15bfd9){_0x30475a[_0xaddd('0x3c')][_0xaddd('0x38')]=_0x30475a[_0xaddd('0xdf')][_0xaddd('0xe0')];_0x30475a[_0xaddd('0x3c')]['basename']=_0x30475a[_0xaddd('0xdf')][_0xaddd('0xe1')];_0x30475a['body'][_0xaddd('0x51')]=_0x30475a['file'][_0xaddd('0xe2')];return db[_0xaddd('0xe3')][_0xaddd('0xc3')](_0x30475a['body'])[_0xaddd('0x35')](respondWithResult(_0x18b591,0xc9))['catch'](handleError(_0x18b591,null));};exports[_0xaddd('0xe4')]=function(_0xf72efd,_0x1849d6,_0xde282a){return db['ChatInteraction'][_0xaddd('0xc5')]({'where':{'id':_0xf72efd[_0xaddd('0xc0')]['id']},'raw':!![]})[_0xaddd('0x35')](handleEntityNotFound(_0x1849d6,null))[_0xaddd('0x35')](function(_0xfd177a){if(_0xfd177a){if(_0xfd177a['closed']){return _0x1849d6['status'](0x193)[_0xaddd('0x2b')]({'status':0x193,'message':_0xaddd('0xe5')});}return db['Attachment']['findOne']({'where':{'id':_0xf72efd['query'][_0xaddd('0xe6')]},'raw':!![]})[_0xaddd('0x35')](handleEntityNotFound(_0x1849d6,null));}})[_0xaddd('0x35')](function(_0x3207d5){if(_0x3207d5){var _0x5aa307=_0x3207d5[_0xaddd('0xe7')]!==null;var _0x263aaf=path[_0xaddd('0xe8')](config[_0xaddd('0xe9')],'server/files/attachments/');if(_0x5aa307){_0x263aaf=path[_0xaddd('0xe8')](_0x263aaf,_0xaddd('0xea'));}var _0x35d62b=path[_0xaddd('0xe8')](_0x263aaf,_0x3207d5['basename']);return _0x1849d6[_0xaddd('0xeb')](_0x35d62b);}})[_0xaddd('0xc2')](handleError(_0x1849d6,null));};exports[_0xaddd('0xec')]=function(_0x253cf8,_0x2a3757){var _0x1a906d=null;var _0xb37a84=null;var _0x175459=null;var _0x3a4c39=null;if(_0x253cf8[_0xaddd('0x3c')]['id']){delete _0x253cf8[_0xaddd('0x3c')]['id'];}if(_0x253cf8[_0xaddd('0x3c')][_0xaddd('0xed')]){_0x3a4c39=path[_0xaddd('0xe8')](config[_0xaddd('0xe9')],_0xaddd('0xee'),util[_0xaddd('0xef')]('transcript-%s.txt',Date[_0xaddd('0xf0')]()));_0x253cf8[_0xaddd('0x3c')][_0xaddd('0xf1')]=_0x3a4c39;}return db['ChatInteraction'][_0xaddd('0x74')]({'where':{'id':_0x253cf8['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xaddd('0x85')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x2a3757,null))['then'](saveUpdates(_0x253cf8[_0xaddd('0x3c')],null))[_0xaddd('0x35')](function(_0x43bdb0){if(_0x43bdb0){_0x1a906d=_0x43bdb0;return db[_0xaddd('0xc6')][_0xaddd('0x74')]({'where':{'id':_0x1a906d['ChatWebsiteId']}});}})[_0xaddd('0x35')](function(_0x240c0c){if(_0x240c0c){_0x175459=_0x240c0c;return db[_0xaddd('0xd8')]['find']({'where':{'id':_0x1a906d[_0xaddd('0x7f')]}});}})[_0xaddd('0x35')](function(_0x10553c){if(_0x10553c){_0xb37a84=_0x10553c;if(_0x3a4c39){var _0x1b5c0b=null;for(var _0x18e936=0x1;_0x18e936<_0x1a906d[_0xaddd('0xf2')][_0xaddd('0x5a')];++_0x18e936){_0x1b5c0b=_0x1a906d[_0xaddd('0xf2')][_0x18e936];var _0x5d8ce5=_0x1b5c0b[_0xaddd('0x4c')]?util[_0xaddd('0xef')]('%s%d',_0x175459['agentAlias'],_0x1b5c0b[_0xaddd('0x4c')]):_0xaddd('0xf3');var _0x5ae97d=_0x253cf8[_0xaddd('0x3c')]['customer']||util['format'](_0xaddd('0xf4'),_0xaddd('0xf5'),_0x1b5c0b[_0xaddd('0x7f')]);switch(_0x175459[_0xaddd('0xf6')]){case _0xaddd('0xf7'):_0x5d8ce5=_0x1b5c0b['UserId']?util['format'](_0xaddd('0xf4'),_0x175459[_0xaddd('0xf8')],_0x1b5c0b[_0xaddd('0x4c')]):_0xaddd('0xf3');break;case _0xaddd('0xf9'):_0x5d8ce5=_0x1b5c0b[_0xaddd('0x4c')]?_0x1b5c0b[_0xaddd('0x85')]['alias']||_0x1b5c0b['User'][_0xaddd('0x42')]:_0xaddd('0xf3');break;case _0xaddd('0xfa'):_0x5d8ce5=_0x1b5c0b[_0xaddd('0x4c')]?_0x1b5c0b['User'][_0xaddd('0x42')]:_0xaddd('0xf3');break;default:_0x5d8ce5=_0x1b5c0b[_0xaddd('0x4c')]?util[_0xaddd('0xef')]('%s%d',_0x175459[_0xaddd('0xf8')],_0x1b5c0b[_0xaddd('0x4c')]):_0xaddd('0xf3');}var _0x4ab318=util['format'](_0xaddd('0xfb'),moment(_0x1b5c0b[_0xaddd('0x8c')])[_0xaddd('0xef')](_0xaddd('0xfc')),_0x1b5c0b['direction']==='in'?_0x5ae97d:_0x5d8ce5,_0x1b5c0b[_0xaddd('0x3c')]);if(!_0x1b5c0b[_0xaddd('0xfd')]){fs[_0xaddd('0xfe')](_0x3a4c39,_0x4ab318);}}return db[_0xaddd('0xff')][_0xaddd('0xc5')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xaddd('0x100'),'raw':!![]}]});}}})[_0xaddd('0x35')](function(_0x58fcb1){if(_0x58fcb1&&_0x58fcb1[_0xaddd('0x100')]&&_0x253cf8[_0xaddd('0x3c')]){var _0x29f865={'tls':{'rejectUnauthorized':![]}};if(_0x58fcb1['Smtp'][_0xaddd('0x101')]){_0x29f865[_0xaddd('0x101')]=_0x58fcb1[_0xaddd('0x100')][_0xaddd('0x101')];}else{_0x29f865[_0xaddd('0x102')]=_0x58fcb1[_0xaddd('0x100')][_0xaddd('0x102')];_0x29f865[_0xaddd('0x103')]=_0x58fcb1[_0xaddd('0x100')][_0xaddd('0x103')];_0x29f865[_0xaddd('0x104')]=_0x58fcb1['Smtp'][_0xaddd('0x104')];}if(_0x58fcb1[_0xaddd('0x100')][_0xaddd('0x105')]){_0x29f865[_0xaddd('0x106')]={'user':_0x58fcb1['Smtp'][_0xaddd('0xa2')],'pass':_0x58fcb1['Smtp'][_0xaddd('0x107')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x29f865,'message':{'from':util[_0xaddd('0xef')](_0xaddd('0x108'),_0x58fcb1[_0xaddd('0x38')],_0x58fcb1[_0xaddd('0xcb')]||_0x58fcb1[_0xaddd('0x100')][_0xaddd('0xa2')]),'to':_0x253cf8[_0xaddd('0x3c')]['mailTranscript'],'subject':_0xaddd('0x109'),'text':util[_0xaddd('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x253cf8[_0xaddd('0x3c')][_0xaddd('0xed')]),'attachments':[{'path':_0x3a4c39}]}})[_0xaddd('0x35')](function(){return _0x1a906d;})['catch'](function(_0x7ec3e9){console[_0xaddd('0x25')](_0x7ec3e9);});}else{return _0x1a906d;}})[_0xaddd('0x35')](respondWithStatusCode(_0x2a3757,0xc8))[_0xaddd('0xc2')](handleError(_0x2a3757,null));};exports[_0xaddd('0x10a')]=function(_0x4aacdb,_0x1cf762,_0x48611a){return db[_0xaddd('0x10b')]['find']({'where':{'id':_0x4aacdb[_0xaddd('0xc0')]['id']}})[_0xaddd('0x35')](handleEntityNotFound(_0x1cf762,null))[_0xaddd('0x35')](function(_0x491d90){if(_0x491d90){return _0x491d90[_0xaddd('0x10a')](_0x4aacdb[_0xaddd('0x3c')][_0xaddd('0x10c')],_[_0xaddd('0x10d')](_0x4aacdb['body'],[_0xaddd('0x10c'),'id'])||{});}})[_0xaddd('0x35')](respondWithResult(_0x1cf762,null))[_0xaddd('0xc2')](handleError(_0x1cf762,null));};exports[_0xaddd('0x10e')]=function(_0x4cb7ea,_0x180c15,_0x2909f5){var _0x95448={'raw':![],'where':{}};var _0xb4e4df={};var _0x471fa0={'count':0x0,'rows':[]};return db[_0xaddd('0x4e')]['findOne']({'where':{'id':_0x4cb7ea[_0xaddd('0xc0')]['id']}})['then'](handleEntityNotFound(_0x180c15,null))['then'](function(_0x474fff){if(_0x474fff){_0xb4e4df[_0xaddd('0x53')]=_[_0xaddd('0x55')](db[_0xaddd('0x10b')][_0xaddd('0x4f')]);_0xb4e4df[_0xaddd('0x54')]=_['keys'](_0x4cb7ea[_0xaddd('0x54')]);_0xb4e4df[_0xaddd('0x56')]=_[_0xaddd('0x57')](_0xb4e4df[_0xaddd('0x53')],_0xb4e4df['query']);_0x95448[_0xaddd('0x58')]=_[_0xaddd('0x57')](_0xb4e4df[_0xaddd('0x53')],qs[_0xaddd('0x59')](_0x4cb7ea[_0xaddd('0x54')][_0xaddd('0x59')]));_0x95448['attributes']=_0x95448[_0xaddd('0x58')][_0xaddd('0x5a')]?_0x95448[_0xaddd('0x58')]:_0xb4e4df['model'];if(!_0x4cb7ea[_0xaddd('0x54')][_0xaddd('0x5b')](_0xaddd('0x10f'))){_0x95448['limit']=qs[_0xaddd('0x2e')](_0x4cb7ea[_0xaddd('0x54')][_0xaddd('0x2e')]);_0x95448[_0xaddd('0x2c')]=qs[_0xaddd('0x2c')](_0x4cb7ea[_0xaddd('0x54')][_0xaddd('0x2c')]);}_0x95448[_0xaddd('0x110')]=qs[_0xaddd('0x5c')](_0x4cb7ea[_0xaddd('0x54')][_0xaddd('0x5c')]);_0x95448[_0xaddd('0x5d')]=qs[_0xaddd('0x56')](_[_0xaddd('0x5e')](_0x4cb7ea['query'],_0xb4e4df[_0xaddd('0x56')]));_0x95448[_0xaddd('0x5d')][_0xaddd('0xbc')]=_0x474fff['id'];if(_0x4cb7ea['query']['filter']){_0x95448['where']=_['merge'](_0x95448[_0xaddd('0x5d')],{'$or':_[_0xaddd('0x41')](_0x95448[_0xaddd('0x58')],function(_0x1ead76){var _0x5dc2b7={};_0x5dc2b7[_0x1ead76]={'$like':'%'+_0x4cb7ea[_0xaddd('0x54')][_0xaddd('0x96')]+'%'};return _0x5dc2b7;})});}if(_0x4cb7ea[_0xaddd('0x54')]['$gte']){var _0x2ea7f4=_0x4cb7ea[_0xaddd('0x54')][_0xaddd('0x8e')]['split'](',');var _0xd81e3b={};_0xd81e3b[_0x2ea7f4[0x0]]={'$gte':moment(_0x2ea7f4[0x1])[_0xaddd('0xef')](_0xaddd('0x111'))};_0x95448[_0xaddd('0x5d')]=_[_0xaddd('0x3b')](_0x95448['where'],_0xd81e3b);}_0x95448=_[_0xaddd('0x3b')]({},_0x95448,_0x4cb7ea[_0xaddd('0x112')]);return db[_0xaddd('0x10b')][_0xaddd('0x2f')]({'where':_0x95448[_0xaddd('0x5d')]})[_0xaddd('0x35')](function(_0x95cfe5){_0x471fa0['count']=_0x95cfe5;if(_0x4cb7ea['query'][_0xaddd('0x113')]){_0x95448[_0xaddd('0xc1')]=[{'all':!![]}];}return db[_0xaddd('0x10b')][_0xaddd('0x114')](_0x95448);})[_0xaddd('0x35')](function(_0x83335b){_0x471fa0[_0xaddd('0xbe')]=_0x83335b;return _0x471fa0;});}})[_0xaddd('0x35')](respondWithFilteredResult(_0x180c15,_0x95448))[_0xaddd('0xc2')](handleError(_0x180c15,null));};exports[_0xaddd('0x115')]=function(_0x124ab0,_0x2387e9,_0x1885bb){var _0x1be44b={'where':{}},_0x286228={},_0x5efbd1={'count':0x0,'rows':[]};return db[_0xaddd('0x4e')][_0xaddd('0xc5')]({'where':{'id':_0x124ab0[_0xaddd('0xc0')]['id']}})[_0xaddd('0x35')](handleEntityNotFound(_0x2387e9,null))[_0xaddd('0x35')](function(_0x50aed7){if(_0x50aed7){_0x286228[_0xaddd('0x53')]=_[_0xaddd('0x55')](db['ChatMessage'][_0xaddd('0x4f')]);_0x286228[_0xaddd('0x54')]=_[_0xaddd('0x55')](_0x124ab0[_0xaddd('0x54')]);_0x286228[_0xaddd('0x56')]=_[_0xaddd('0x57')](_0x286228['model'],_0x286228[_0xaddd('0x54')]);_0x1be44b['attributes']=_[_0xaddd('0x57')](_0x286228[_0xaddd('0x53')],qs[_0xaddd('0x59')](_0x124ab0[_0xaddd('0x54')][_0xaddd('0x59')]));_0x1be44b[_0xaddd('0x58')]=_0x1be44b['attributes'][_0xaddd('0x5a')]?_0x1be44b[_0xaddd('0x58')]:_0x286228[_0xaddd('0x53')];if(!_0x124ab0[_0xaddd('0x54')]['hasOwnProperty'](_0xaddd('0x10f'))){_0x1be44b[_0xaddd('0x2e')]=qs[_0xaddd('0x2e')](_0x124ab0['query'][_0xaddd('0x2e')]);_0x1be44b[_0xaddd('0x2c')]=qs['offset'](_0x124ab0[_0xaddd('0x54')]['offset']);}_0x1be44b[_0xaddd('0x110')]=qs['sort'](_0x124ab0[_0xaddd('0x54')]['sort']);_0x1be44b[_0xaddd('0x5d')]=qs[_0xaddd('0x56')](_[_0xaddd('0x5e')](_0x124ab0[_0xaddd('0x54')],_0x286228[_0xaddd('0x56')]));_0x1be44b['where'][_0xaddd('0xbc')]=_0x50aed7['id'];if(_0x124ab0[_0xaddd('0x54')]['filter']){_0x1be44b[_0xaddd('0x5d')]=_[_0xaddd('0x3b')](_0x1be44b['where'],{'$or':_[_0xaddd('0x41')](_0x1be44b['attributes'],function(_0x472098){var _0x279606={};_0x279606[_0x472098]={'$like':'%'+_0x124ab0[_0xaddd('0x54')][_0xaddd('0x96')]+'%'};return _0x279606;})});}_0x1be44b[_0xaddd('0x5d')][_0xaddd('0xfd')]=![];if(_0x124ab0[_0xaddd('0x54')]['id']){_0x1be44b['where']['id']={'$gt':_0x124ab0[_0xaddd('0x54')]['id']};}_0x1be44b=_[_0xaddd('0x3b')]({},_0x1be44b,_0x124ab0[_0xaddd('0x112')]);return db[_0xaddd('0x10b')][_0xaddd('0x2f')]({'where':_0x1be44b[_0xaddd('0x5d')]})[_0xaddd('0x35')](function(_0x4890f9){_0x5efbd1[_0xaddd('0x2f')]=_0x4890f9;_0x1be44b[_0xaddd('0xc1')]=[];if(_0x124ab0[_0xaddd('0x54')][_0xaddd('0x116')]){_0x1be44b[_0xaddd('0xc1')]['push']({'model':db[_0xaddd('0x85')],'as':_0xaddd('0x85'),'attributes':['id',_0xaddd('0x42'),_0xaddd('0x117')]});}if(_0x124ab0[_0xaddd('0x54')]['includeAll']){_0x1be44b['include']=[{'all':!![]}];}return db[_0xaddd('0x10b')][_0xaddd('0x114')](_0x1be44b);})['then'](function(_0x1e80c7){_0x5efbd1['rows']=_0x1e80c7;return _0x5efbd1;});}})[_0xaddd('0x35')](respondWithFilteredResult(_0x2387e9,_0x1be44b))[_0xaddd('0xc2')](handleError(_0x2387e9,null));};exports[_0xaddd('0x118')]=function(_0x30b74d,_0x1822c8,_0x1ac681){return db[_0xaddd('0x4e')]['find']({'where':{'id':_0x30b74d[_0xaddd('0xc0')]['id']}})[_0xaddd('0x35')](handleEntityNotFound(_0x1822c8,null))[_0xaddd('0x35')](function(_0x204f99){if(_0x204f99){return _0x204f99['setTags'](_0x30b74d[_0xaddd('0x3c')]['ids'],_[_0xaddd('0x10d')](_0x30b74d[_0xaddd('0x3c')],[_0xaddd('0x10c'),'id'])||{})['spread'](function(){return db[_0xaddd('0x83')][_0xaddd('0x114')]({'attributes':['id',_0xaddd('0x38'),'color'],'where':{'id':_0x30b74d[_0xaddd('0x3c')][_0xaddd('0x10c')]}});})[_0xaddd('0x35')](function(_0x12b3ea){socket[_0xaddd('0x119')](_0xaddd('0x11a'),{'id':Number(_0x30b74d['params']['id']),'tags':_0x12b3ea||[]});return{'id':Number(_0x30b74d[_0xaddd('0xc0')]['id']),'tags':_0x12b3ea||[]};});}})['then'](respondWithResult(_0x1822c8,null))[_0xaddd('0xc2')](handleError(_0x1822c8,null));};exports[_0xaddd('0x11b')]=function(_0x433033,_0x2daeb1,_0x21209f){return db[_0xaddd('0x4e')][_0xaddd('0x74')]({'where':{'id':_0x433033[_0xaddd('0xc0')]['id']}})[_0xaddd('0x35')](handleEntityNotFound(_0x2daeb1,null))[_0xaddd('0x35')](function(_0x328c40){if(_0x328c40){return _0x328c40[_0xaddd('0x11b')](_0x433033[_0xaddd('0x54')]['ids']);}})[_0xaddd('0x35')](respondWithStatusCode(_0x2daeb1,null))[_0xaddd('0xc2')](handleError(_0x2daeb1,null));};exports['download']=function(_0x4eef78,_0x55e93d){var _0x19a536=moment()[_0xaddd('0x11c')]()[_0xaddd('0xa7')]();var _0x32c9e1=path[_0xaddd('0xe8')](config['root'],_0xaddd('0x11d'),_0xaddd('0x11e'),_0xaddd('0x11f'));var _0x4d6aa0=path[_0xaddd('0xe8')](config[_0xaddd('0xe9')],'server',_0xaddd('0x11e'),_0xaddd('0x120'));var _0x40a5ba=path[_0xaddd('0xe8')](_0x32c9e1,_0x19a536);var _0x124ff6=util[_0xaddd('0xef')](_0xaddd('0x121'),_0x4eef78[_0xaddd('0xc0')]['id'],_0x19a536);var _0x5cd6e5=path['join'](_0x32c9e1,_0x124ff6);var _0x3d03e9=[];_0x3d03e9[_0xaddd('0x45')]({'model':db['User'],'as':'User','attributes':['id',_0xaddd('0x42')],'raw':!![]});_0x3d03e9['push']({'model':db[_0xaddd('0xd8')],'as':'Contact','attributes':['id','firstName',_0xaddd('0x122')],'raw':!![]});if(_0x4eef78['query'][_0xaddd('0x120')]){_0x3d03e9[_0xaddd('0x45')]({'model':db['Attachment'],'as':_0xaddd('0xe3'),'raw':!![]});}var _0x66ef3b=[{'model':db[_0xaddd('0x10b')],'as':_0xaddd('0xf2'),'attributes':['id',_0xaddd('0x3c'),_0xaddd('0x8c'),_0xaddd('0x123'),_0xaddd('0xfd'),_0xaddd('0x92')],'include':_0x3d03e9}];_0x66ef3b[_0xaddd('0x45')]({'model':db[_0xaddd('0xc6')],'as':_0xaddd('0x124'),'attributes':['id',_0xaddd('0x38')]});_0x66ef3b['push']({'model':db[_0xaddd('0x85')],'as':_0xaddd('0x125'),'attributes':['id',_0xaddd('0x42')]});return db[_0xaddd('0x4e')]['find']({'where':{'id':_0x4eef78[_0xaddd('0xc0')]['id']},'include':_0x66ef3b})[_0xaddd('0x35')](handleEntityNotFound(_0x55e93d,null))[_0xaddd('0x35')](function(_0x2a15d4){if(_0x2a15d4){var _0x114c1b=_0x2a15d4[_0xaddd('0x126')]({'plain':!![]});fs[_0xaddd('0x127')](_0x40a5ba);var _0x31e89d={'channel':'Chat','account':_0x114c1b[_0xaddd('0x124')]['name'],'agent':_0x114c1b[_0xaddd('0x125')]?_0x114c1b[_0xaddd('0x125')][_0xaddd('0x42')]:_0xaddd('0x128'),'createdAt':moment(_0x114c1b[_0xaddd('0x8c')])[_0xaddd('0xef')](_0xaddd('0x111'))[_0xaddd('0xa7')](),'closedAt':_0x114c1b[_0xaddd('0xdd')]?moment(_0x114c1b[_0xaddd('0x129')])[_0xaddd('0xef')](_0xaddd('0x111'))[_0xaddd('0xa7')]():'','disposition':_0x114c1b[_0xaddd('0x4d')],'chatInfo':{'browser':_0x114c1b[_0xaddd('0x12a')],'os':_0x114c1b['osName'],'referer':_0x114c1b[_0xaddd('0x12b')],'customerIp':_0x114c1b[_0xaddd('0x12c')],'customerPort':_0x114c1b[_0xaddd('0x12d')]?_0x114c1b[_0xaddd('0x12d')]:_0xaddd('0x128')},'messages':_(_0x114c1b[_0xaddd('0xf2')])['tail']()[_0xaddd('0x96')]({'secret':![]})[_0xaddd('0x41')](function(_0x379237){if(_0x379237[_0xaddd('0xe3')]){var _0x5ab18b=path[_0xaddd('0xe8')](_0x4d6aa0,_0x379237['Attachment'][_0xaddd('0x12e')]);if(fs[_0xaddd('0x12f')](_0x5ab18b)){fs[_0xaddd('0x130')](_0x5ab18b)[_0xaddd('0x131')](fs[_0xaddd('0x132')](path[_0xaddd('0xe8')](_0x40a5ba,_0x379237[_0xaddd('0xe3')][_0xaddd('0x12e')])));}}return{'date':moment(_0x379237['createdAt'])[_0xaddd('0xef')](_0xaddd('0x111'))[_0xaddd('0xa7')](),'sender':_0x379237[_0xaddd('0x123')]==='out'?_0x379237['User']?_0x379237[_0xaddd('0x85')]['fullname']:_0xaddd('0xf3'):_0x379237[_0xaddd('0x79')][_0xaddd('0x133')]+(_0x379237[_0xaddd('0x79')][_0xaddd('0x122')]?'\x20'+_0x379237[_0xaddd('0x79')][_0xaddd('0x122')]:''),'body':_0x379237[_0xaddd('0xe3')]?_0x379237[_0xaddd('0xe3')]['basename']:_0x379237[_0xaddd('0x3c')],'direction':_0x379237[_0xaddd('0x123')]==='out'?'A':'C','secret':_0x379237[_0xaddd('0xfd')],'read':_0x379237[_0xaddd('0x92')],'attachment':_0x379237[_0xaddd('0xe3')]};})[_0xaddd('0x7c')]()};return ejs[_0xaddd('0x134')](path[_0xaddd('0xe8')](config[_0xaddd('0xe9')],_0xaddd('0x11d'),_0xaddd('0x135'),_0xaddd('0x136')),{'interaction':_0x31e89d})[_0xaddd('0x35')](function(_0x40ae45){var _0x222f77=path[_0xaddd('0xe8')](_0x40a5ba,_0xaddd('0x137')+_0x114c1b['id']+'-'+_0x19a536+'.pdf');var _0x51667b={'path':_0x222f77,'channel':'Chat','interactionId':_0x114c1b['id']};return pdf[_0xaddd('0x138')](_0x40ae45,_0x51667b);})['then'](function(){return new BPromise(function(_0x552f6c,_0x26010a){zipdir(_0x40a5ba,{'saveTo':_0x5cd6e5},function(_0x4d3ae3,_0x3a4313){if(_0x4d3ae3)return _0x26010a(_0x4d3ae3);return _0x552f6c(_0x3a4313);});})[_0xaddd('0x35')](function(){return new BPromise(function(_0x5de6da,_0x2cdb51){rimraf(_0x40a5ba,function(_0x337a24){if(_0x337a24)_0x2cdb51(_0x337a24);return _0x5de6da();});});})[_0xaddd('0x35')](function(){return _0x55e93d[_0xaddd('0xeb')](_0x5cd6e5,_0x124ff6,function(_0x41f307){if(_0x41f307){console[_0xaddd('0x139')](_0xaddd('0x13a'),_0x41f307);}else{fs[_0xaddd('0x13b')](_0x5cd6e5);}});});});}else{return _0x55e93d[_0xaddd('0x28')](0xc8);}})[_0xaddd('0xc2')](handleError(_0x55e93d,null));}; \ No newline at end of file +var _0xa061=['where','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','from','chat_interactions','o.id\x20=\x20i.UserId','chat_websites','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','includeAll','options','create','body','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','user','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','entity\x20not\x20found','attachmentUpload','file','originalname','basename','filename','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','offline-chat/','close','mailTranscript','root','server/files/chat/upload/','format','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','pick','split','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','includeAgent','alias','addTags','spread','removeTags','download','unix','server','files','CmContact','lastName','Owner','mkdirSync','Chat','Account','N.A.','osName','referer','customerIp','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','out','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','destroy','stack','name','send','render','contact','agent','interaction','account','Users','map','Tags','TagIds','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','UserId','closed','disposition','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x25ed4,_0x3f8b40){var _0x13df04=function(_0x5a3ecc){while(--_0x5a3ecc){_0x25ed4['push'](_0x25ed4['shift']());}};_0x13df04(++_0x3f8b40);}(_0xa061,0xe2));var _0x1a06=function(_0x5f51d2,_0x4f0133){_0x5f51d2=_0x5f51d2-0x0;var _0x24bf08=_0xa061[_0x5f51d2];return _0x24bf08;};'use strict';var emlformat=require(_0x1a06('0x0'));var rimraf=require(_0x1a06('0x1'));var zipdir=require(_0x1a06('0x2'));var jsonpatch=require(_0x1a06('0x3'));var rp=require(_0x1a06('0x4'));var moment=require('moment');var BPromise=require(_0x1a06('0x5'));var Mustache=require(_0x1a06('0x6'));var util=require(_0x1a06('0x7'));var path=require(_0x1a06('0x8'));var sox=require(_0x1a06('0x9'));var csv=require(_0x1a06('0xa'));var ejs=require(_0x1a06('0xb'));var fs=require('fs');var fs_extra=require(_0x1a06('0xc'));var _=require(_0x1a06('0xd'));var squel=require('squel');var crypto=require(_0x1a06('0xe'));var jsforce=require(_0x1a06('0xf'));var deskjs=require(_0x1a06('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1a06('0x11'));var Papa=require('papaparse');var Redis=require(_0x1a06('0x12'));var authService=require(_0x1a06('0x13'));var qs=require(_0x1a06('0x14'));var as=require(_0x1a06('0x15'));var pdf=require(_0x1a06('0x16'));var hardwareService=require(_0x1a06('0x17'));var logger=require(_0x1a06('0x18'))(_0x1a06('0x19'));var utils=require('../../config/utils');var config=require(_0x1a06('0x1a'));var licenseUtil=require(_0x1a06('0x1b'));var db=require(_0x1a06('0x1c'))['db'];config[_0x1a06('0x1d')]=_[_0x1a06('0x1e')](config[_0x1a06('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1a06('0x1f'))[_0x1a06('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1a06('0x21')][_0x1a06('0x22')]({'port':0x232b});var client9004=jayson[_0x1a06('0x21')][_0x1a06('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x2f0979,_0x527d89,_0x281b05,_0x134d16){return new BPromise(function(_0x58c908,_0x2dd45b){var _0x204b17=_0x134d16||client;return _0x204b17[_0x1a06('0x23')](_0x2f0979,_0x281b05)[_0x1a06('0x24')](function(_0x411e5d){logger[_0x1a06('0x25')](_0x1a06('0x26'),_0x527d89,_0x1a06('0x27'));logger['debug'](_0x1a06('0x28'),_0x527d89,_0x1a06('0x27'),JSON[_0x1a06('0x29')](_0x411e5d));if(_0x411e5d[_0x1a06('0x2a')]){if(_0x411e5d[_0x1a06('0x2a')][_0x1a06('0x2b')]===0x1f4){logger['error'](_0x1a06('0x26'),_0x527d89,_0x411e5d[_0x1a06('0x2a')][_0x1a06('0x2c')]);return _0x2dd45b(_0x411e5d[_0x1a06('0x2a')][_0x1a06('0x2c')]);}logger['error'](_0x1a06('0x26'),_0x527d89,_0x411e5d[_0x1a06('0x2a')][_0x1a06('0x2c')]);return _0x58c908(_0x411e5d[_0x1a06('0x2a')][_0x1a06('0x2c')]);}else{logger['info'](_0x1a06('0x26'),_0x527d89,'request\x20sent');_0x58c908(_0x411e5d[_0x1a06('0x2d')]['message']);}})[_0x1a06('0x2e')](function(_0xb078de){logger[_0x1a06('0x2a')](_0x1a06('0x26'),_0x527d89,_0xb078de);_0x2dd45b(_0xb078de);});});}function respondWithStatusCode(_0x35ffa7,_0x8a55e8){_0x8a55e8=_0x8a55e8||0xcc;return function(_0x336b0f){if(_0x336b0f){return _0x35ffa7[_0x1a06('0x2f')](_0x8a55e8);}return _0x35ffa7[_0x1a06('0x30')](_0x8a55e8)[_0x1a06('0x31')]();};}function respondWithResult(_0x5c3dad,_0x319b31){_0x319b31=_0x319b31||0xc8;return function(_0x26bd71){if(_0x26bd71){return _0x5c3dad[_0x1a06('0x30')](_0x319b31)[_0x1a06('0x32')](_0x26bd71);}};}function respondWithFilteredResult(_0x401c83,_0x4ba9f7){return function(_0x258323){if(_0x258323){var _0x1cba8a=typeof _0x4ba9f7[_0x1a06('0x33')]==='undefined'&&typeof _0x4ba9f7[_0x1a06('0x34')]===_0x1a06('0x35');var _0x21adab=_0x258323['count'];var _0xeff454=_0x1cba8a?0x0:_0x4ba9f7[_0x1a06('0x33')];var _0x548caf=_0x1cba8a?_0x258323['count']:_0x4ba9f7[_0x1a06('0x33')]+_0x4ba9f7['limit'];var _0x56567a;if(_0x548caf>=_0x21adab){_0x548caf=_0x21adab;_0x56567a=0xc8;}else{_0x56567a=0xce;}_0x401c83[_0x1a06('0x30')](_0x56567a);return _0x401c83[_0x1a06('0x36')]('Content-Range',_0xeff454+'-'+_0x548caf+'/'+_0x21adab)['json'](_0x258323);}return null;};}function patchUpdates(_0x387ff5){return function(_0x1c8f93){try{jsonpatch[_0x1a06('0x37')](_0x1c8f93,_0x387ff5,!![]);}catch(_0x355542){return BPromise[_0x1a06('0x38')](_0x355542);}return _0x1c8f93[_0x1a06('0x39')]();};}function saveUpdates(_0x17646f,_0x3b52f3){return function(_0xca754c){if(_0xca754c){return _0xca754c[_0x1a06('0x3a')](_0x17646f)[_0x1a06('0x24')](function(_0x35d7c4){return _0x35d7c4;});}return null;};}function removeEntity(_0x2b3ad8,_0x499682){return function(_0x296021){if(_0x296021){return _0x296021[_0x1a06('0x3b')]()[_0x1a06('0x24')](function(){_0x2b3ad8['status'](0xcc)[_0x1a06('0x31')]();});}};}function handleEntityNotFound(_0x46d21c,_0x496fc9){return function(_0x4259df){if(!_0x4259df){_0x46d21c[_0x1a06('0x2f')](0x194);}return _0x4259df;};}function handleError(_0x6ed15f,_0x35dd2f){_0x35dd2f=_0x35dd2f||0x1f4;return function(_0xeedb5b){logger[_0x1a06('0x2a')](_0xeedb5b[_0x1a06('0x3c')]);if(_0xeedb5b['name']){delete _0xeedb5b[_0x1a06('0x3d')];}_0x6ed15f['status'](_0x35dd2f)[_0x1a06('0x3e')](_0xeedb5b);};}function getMustacheRender(_0x1e239d,_0x349227){return Mustache[_0x1a06('0x3f')](_0x1e239d,_['merge'](_0x349227['body'],{'contact':_0x349227[_0x1a06('0x40')],'message':_0x349227[_0x1a06('0x2c')],'agent':_0x349227[_0x1a06('0x41')],'interaction':_0x349227[_0x1a06('0x42')],'account':_0x349227[_0x1a06('0x43')]}))||'';}function getInteractionUsers(_0x5ef272,_0x1adc4d){return new BPromise(function(_0x2d6077,_0x501e05){try{if(_0x1adc4d[_0x5ef272['id']]){_0x5ef272[_0x1a06('0x44')]=_[_0x1a06('0x45')](_0x1adc4d[_0x5ef272['id']],function(_0x363e87){return{'id':_0x363e87['id'],'fullname':_0x363e87['fullname']};});}}catch(_0x427460){_0x501e05(_0x427460);}_0x2d6077(_0x5ef272);});}function getInteractionTags(_0x409502,_0xf608dc){return new BPromise(function(_0xa5930f,_0x24eaf4){try{if(_0x409502['TagIds']){_0x409502[_0x1a06('0x46')]=[];_0x409502[_0x1a06('0x47')]['split'](',')[_0x1a06('0x48')](function(_0xd31ec8){_0x409502[_0x1a06('0x46')][_0x1a06('0x49')](_0xf608dc[_0xd31ec8]);});}delete _0x409502[_0x1a06('0x47')];}catch(_0x2c66a3){_0x24eaf4(_0x2c66a3);}_0xa5930f(_0x409502);});}function updateChatInteraction(_0x29399a,_0x17a6d1,_0x3f8753){return new BPromise(function(_0xa3b1bc,_0x4ad190){return getInteractionUsers(_0x29399a,_0x3f8753)[_0x1a06('0x24')](function(_0x38cdd0){return getInteractionTags(_0x38cdd0,_0x17a6d1);})[_0x1a06('0x24')](function(_0x2a2d83){return getStateInteraction(_0x2a2d83);})[_0x1a06('0x24')](function(_0x482bee){_0xa3b1bc(_0x482bee);})[_0x1a06('0x2e')](function(_0x4bbe6e){_0x4ad190(_0x4bbe6e);});});}function getStateInteraction(_0x51b85b){return new BPromise(function(_0x4839ee){_0x51b85b[_0x1a06('0x4a')]=0x0;_0x51b85b[_0x1a06('0x4b')]=0x0;_0x51b85b[_0x1a06('0x4c')]=0x0;_0x51b85b[_0x1a06('0x4d')]=0x0;_0x51b85b[_0x1a06('0x4e')]=0x0;_0x51b85b[_0x1a06('0x4f')]=0x0;if(!_0x51b85b['closed']&&!_0x51b85b[_0x1a06('0x50')]){_0x51b85b['waiting']+=0x1;}if(!_0x51b85b['closed']&&_0x51b85b[_0x1a06('0x50')]){_0x51b85b['talking']+=0x1;if(_0x51b85b[_0x1a06('0x4a')]){_0x51b85b[_0x1a06('0x4a')]-=0x1;}}if(_0x51b85b[_0x1a06('0x51')]&&_0x51b85b['disposition']==='abandoned'){_0x51b85b[_0x1a06('0x4e')]+=0x1;if(_0x51b85b[_0x1a06('0x4a')]){_0x51b85b['waiting']-=0x1;}}else if(_0x51b85b[_0x1a06('0x51')]&&!_0x51b85b[_0x1a06('0x50')]&&_0x51b85b[_0x1a06('0x52')]){_0x51b85b['unmanaged']+=0x1;if(_0x51b85b[_0x1a06('0x4a')]){_0x51b85b['waiting']-=0x1;}}else if(_0x51b85b[_0x1a06('0x51')]&&_0x51b85b['UserId']){_0x51b85b['answered']+=0x1;if(_0x51b85b[_0x1a06('0x4b')]){_0x51b85b[_0x1a06('0x4b')]-=0x1;}}_0x51b85b['total']+=0x1;_0x4839ee(_0x51b85b);});}exports[_0x1a06('0x53')]=function(_0x452fae,_0x4e431d){var _0x42adc3={},_0x41b614={},_0x348d03={'count':0x0,'rows':[]};var _0x256d8f=_[_0x1a06('0x45')](db['ChatInteraction'][_0x1a06('0x54')],function(_0x39fd98){return{'name':_0x39fd98[_0x1a06('0x55')],'type':_0x39fd98[_0x1a06('0x56')][_0x1a06('0x57')]};});_0x41b614[_0x1a06('0x58')]=_[_0x1a06('0x45')](_0x256d8f,_0x1a06('0x3d'));_0x41b614[_0x1a06('0x59')]=_[_0x1a06('0x5a')](_0x452fae[_0x1a06('0x59')]);_0x41b614[_0x1a06('0x5b')]=_['intersection'](_0x41b614[_0x1a06('0x58')],_0x41b614[_0x1a06('0x59')]);_0x42adc3[_0x1a06('0x5c')]=_[_0x1a06('0x5d')](_0x41b614[_0x1a06('0x58')],qs['fields'](_0x452fae[_0x1a06('0x59')][_0x1a06('0x5e')]));_0x42adc3[_0x1a06('0x5c')]=_0x42adc3[_0x1a06('0x5c')]['length']?_0x42adc3[_0x1a06('0x5c')]:_0x41b614[_0x1a06('0x58')];if(!_0x452fae[_0x1a06('0x59')][_0x1a06('0x5f')](_0x1a06('0x60'))){_0x42adc3['limit']=qs[_0x1a06('0x34')](_0x452fae[_0x1a06('0x59')]['limit']);_0x42adc3['offset']=qs[_0x1a06('0x33')](_0x452fae['query']['offset']);}_0x42adc3[_0x1a06('0x61')]=qs[_0x1a06('0x62')](_0x452fae[_0x1a06('0x59')]['sort']);_0x42adc3[_0x1a06('0x63')]=qs['filters'](_['pick'](_0x452fae[_0x1a06('0x59')],_0x41b614[_0x1a06('0x5b')]),_0x256d8f);var _0x946fe9=[];var _0x427485=squel[_0x1a06('0x64')]()[_0x1a06('0x65')]('id')[_0x1a06('0x65')](_0x1a06('0x3d'))[_0x1a06('0x65')](_0x1a06('0x66'))['from'](_0x1a06('0x67'));var _0x259fac=squel[_0x1a06('0x64')]()['field'](_0x1a06('0x68'))['field'](_0x1a06('0x69'))['field'](_0x1a06('0x6a'))['from'](_0x1a06('0x6b'),'ui')[_0x1a06('0x6c')](_0x1a06('0x6d'),'u','u.id\x20=\x20ui.UserId');var _0x529140=squel['select']()[_0x1a06('0x6e')](_0x1a06('0x6f'),'i')[_0x1a06('0x6c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1a06('0x6c')](_0x1a06('0x6d'),'o',_0x1a06('0x70'))['left_join'](_0x1a06('0x71'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join']('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x1a06('0x6c')](_0x1a06('0x72'),'it','it.ChatInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x1a06('0x73'));var _0x4c55be=squel[_0x1a06('0x74')]();var _0x49bf7a=[];var _0x402219=squel['expr']();var _0x12bd22;if(_0x452fae[_0x1a06('0x59')][_0x1a06('0x75')]){_0x12bd22=as['parseSearch'](_0x452fae['query'][_0x1a06('0x75')]);var _0x3d8298=_0x12bd22[_0x1a06('0x76')];for(var _0x5a6c09=0x0;_0x5a6c09<_0x12bd22[_0x1a06('0x77')][_0x1a06('0x78')];_0x5a6c09++){var _0x2609dc=_0x12bd22[_0x1a06('0x77')][_0x5a6c09];var _0x2e5acd='i';var _0x28e0d1=_[_0x1a06('0x79')](_0x256d8f,[_0x1a06('0x3d'),_0x2609dc[_0x1a06('0x65')]]);if(!_0x28e0d1){switch(_0x2609dc[_0x1a06('0x65')]){case _0x1a06('0x7a'):if(_0x2609dc[_0x1a06('0x7b')]==0x1){_0x529140[_0x1a06('0x7c')]('`'+_0x2609dc['field']+_0x1a06('0x7d'));}else{_0x529140['having']('`'+_0x2609dc[_0x1a06('0x65')]+_0x1a06('0x7e'));}break;case'Contact':if(_0x2609dc['operator']===_0x1a06('0x7f')){if(_0x2609dc[_0x1a06('0x7b')]['split']('\x20')['length']>0x1){_0x4c55be[_0x3d8298](_0x1a06('0x80'),qs['getFullTextValue'](_0x2609dc[_0x1a06('0x7b')]),null);}else{var _0x2602b1='%'+_0x2609dc['value']+'%';_0x4c55be[_0x3d8298](_0x1a06('0x81'),_0x2602b1,_0x2602b1,_0x2602b1);}}else{_0x28e0d1=_[_0x1a06('0x79')](_0x256d8f,['name',_0x1a06('0x82')]);_0x2609dc[_0x1a06('0x65')]=_0x1a06('0x82');_0x4520df=as[_0x1a06('0x83')](_0x2e5acd,_0x28e0d1[_0x1a06('0x56')],_0x2609dc);_0x4c55be[_0x3d8298](_0x4520df['text'],_0x4520df[_0x1a06('0x7b')][_0x1a06('0x84')],_0x4520df[_0x1a06('0x7b')]['end']);}break;case _0x1a06('0x85'):var _0x17776c=_0x2609dc[_0x1a06('0x7b')]['split'](',')[_0x1a06('0x45')](function(_0x3526f2){return Number(_0x3526f2);});_0x17776c[_0x1a06('0x48')](function(_0x5de9bf){_0x402219['or'](_0x1a06('0x86'),'%,'+_0x5de9bf+',%');});_0x49bf7a=_[_0x1a06('0x87')](_0x49bf7a,_0x17776c);break;case _0x1a06('0x88'):if(_0x2609dc[_0x1a06('0x89')]==='$substring'){_0x4c55be[_0x3d8298](_0x1a06('0x8a'),'%'+_0x2609dc[_0x1a06('0x7b')]+'%',null);}else{_0x28e0d1=_[_0x1a06('0x79')](_0x256d8f,[_0x1a06('0x3d'),_0x1a06('0x50')]);_0x2609dc[_0x1a06('0x65')]='UserId';_0x4520df=as[_0x1a06('0x83')](_0x2e5acd,_0x28e0d1[_0x1a06('0x56')],_0x2609dc);_0x4c55be[_0x3d8298](_0x4520df[_0x1a06('0x8b')],_0x4520df[_0x1a06('0x7b')]['start'],_0x4520df[_0x1a06('0x7b')]['end']);}break;case'body':_0x4520df=as[_0x1a06('0x83')]('me',null,_0x2609dc);_0x4c55be[_0x3d8298](_0x4520df[_0x1a06('0x8b')],_0x4520df[_0x1a06('0x7b')][_0x1a06('0x84')],_0x4520df[_0x1a06('0x7b')][_0x1a06('0x31')]);break;}}else{var _0x4520df=as[_0x1a06('0x83')](_0x2e5acd,_0x28e0d1[_0x1a06('0x56')],_0x2609dc);_0x4c55be[_0x3d8298](_0x4520df[_0x1a06('0x8b')],_0x4520df[_0x1a06('0x7b')][_0x1a06('0x84')],_0x4520df[_0x1a06('0x7b')][_0x1a06('0x31')]);}}}else{var _0x62103f=_(_0x452fae[_0x1a06('0x59')])['keys']()['map'](function(_0x4b6d96){return _['some'](_0x256d8f,[_0x1a06('0x3d'),_0x4b6d96])?_0x4b6d96:undefined;})[_0x1a06('0x8c')]()['value']();if(!_[_0x1a06('0x8d')](_0x62103f)){_0x62103f[_0x1a06('0x48')](function(_0x433793){if(_0x433793===_0x1a06('0x8e')){_0x529140[_0x1a06('0x63')](_0x1a06('0x8f'),[]['concat'](_0x452fae[_0x1a06('0x59')][_0x433793]));}else if(_0x433793===_0x1a06('0x90')){var _0x109c5a=JSON[_0x1a06('0x91')](_0x452fae[_0x1a06('0x59')][_0x433793])[_0x1a06('0x92')];var _0x411057=JSON['parse'](_0x452fae[_0x1a06('0x59')][_0x433793])[_0x1a06('0x93')];_0x529140['where'](_0x1a06('0x94'),_0x109c5a,_0x411057);}else{if(_0x452fae[_0x1a06('0x59')][_0x433793]===_0x1a06('0x95')){_0x529140[_0x1a06('0x63')]('i.'+_0x433793+_0x1a06('0x96'));}else{_0x529140['where']('i.'+_0x433793+_0x1a06('0x97'),_0x452fae[_0x1a06('0x59')][_0x433793]);}}});}if(_0x452fae[_0x1a06('0x59')][_0x1a06('0x98')]){if(_0x452fae[_0x1a06('0x59')][_0x1a06('0x98')]==0x1){_0x529140[_0x1a06('0x7c')](_0x1a06('0x99'));}else{_0x529140[_0x1a06('0x7c')](_0x1a06('0x9a'));}}if(_0x452fae[_0x1a06('0x59')]['tag']){_0x49bf7a=_[_0x1a06('0x9b')](_0x452fae[_0x1a06('0x59')]['tag'])?_0x452fae['query']['tag']:new Array(_0x452fae[_0x1a06('0x59')][_0x1a06('0x9c')]);_0x49bf7a[_0x1a06('0x48')](function(_0x44cc1b){_0x402219['or'](_0x1a06('0x86'),'%,'+_0x44cc1b+',%');});}if(_0x452fae['query'][_0x1a06('0x9d')]){var _0x850cbe=_0x452fae[_0x1a06('0x59')]['filter'][_0x1a06('0x9e')]('\x5c','\x5c\x5c')[_0x1a06('0x9e')](/'/g,'\x27\x27');if(qs[_0x1a06('0x9f')](_0x850cbe)){_0x4c55be['or'](_0x1a06('0xa0'),_0x850cbe+'%');}else{_0x4c55be['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1a06('0xa1')](_0x850cbe))['or'](_0x1a06('0xa2'),_0x850cbe+'%');}}}_0x529140['where'](_0x4c55be);_0x529140[_0x1a06('0xa3')](_0x1a06('0xa4'));var _0x5b4fce={'type':db[_0x1a06('0xa5')][_0x1a06('0xa6')][_0x1a06('0xa7')],'raw':!![]};var _0xf9e91=_0x529140[_0x1a06('0xa8')]();_0xf9e91[_0x1a06('0x65')](_0x1a06('0xa4'));_0xf9e91['field'](_0x1a06('0xa9'),_0x1a06('0x7a'));if(_0x42adc3['order']){_0x42adc3[_0x1a06('0x61')][_0x1a06('0x48')](function(_0x899562){var _0x2a396d=_0x899562[0x0]===_0x1a06('0xaa')?_0x899562[0x0]:'i.'+_0x899562[0x0];_0x529140[_0x1a06('0x61')](_0x2a396d,_0x899562[0x1]===_0x1a06('0xab')?![]:!![]);});}if(!_[_0x1a06('0x8d')](_0x49bf7a)){_0x529140['having'](_0x402219);_0xf9e91[_0x1a06('0x63')](_0x1a06('0xac'),_0x49bf7a);}BPromise[_0x1a06('0xad')]()[_0x1a06('0x24')](function(){if(!_0x12bd22){if(_0x452fae[_0x1a06('0x59')][_0x1a06('0x8e')])return;_0xf9e91['where'](_0x1a06('0xae'));_0x529140['where'](_0x1a06('0xae'));return;}if(_0x452fae['user'][_0x1a06('0xaf')]!==_0x1a06('0x41'))return;return _0x452fae['user'][_0x1a06('0xb0')]({'attributes':['id'],'raw':!![]})[_0x1a06('0x24')](function(_0x5c848c){if(_[_0x1a06('0x8d')](_0x5c848c)){_0xf9e91[_0x1a06('0x63')]('i.ChatWebsiteId\x20IS\x20NULL');_0x529140['where'](_0x1a06('0xb1'));}else{_0xf9e91['where'](_0x1a06('0x8f'),_[_0x1a06('0x45')](_0x5c848c,'id'));_0x529140[_0x1a06('0x63')](_0x1a06('0x8f'),_['map'](_0x5c848c,'id'));}});})[_0x1a06('0x24')](function(){if(_0x452fae['user'][_0x1a06('0xaf')]===_0x1a06('0x41')&&!_0x12bd22&&!_0x452fae[_0x1a06('0x59')]['ChatWebsiteId'])return[];return db[_0x1a06('0xb2')][_0x1a06('0x59')](_0xf9e91[_0x1a06('0xb3')](),_0x5b4fce);})[_0x1a06('0x24')](function(_0x2a20b9){_0x348d03[_0x1a06('0xb4')]=_0x2a20b9[_0x1a06('0x78')];if(_0x348d03[_0x1a06('0xb4')]===0x0)return[];return db[_0x1a06('0xb2')][_0x1a06('0x59')](_0x427485[_0x1a06('0xb3')](),_0x5b4fce)[_0x1a06('0x24')](function(_0x4c4e2a){_0x946fe9=_[_0x1a06('0xb5')](_0x4c4e2a,'id');_0x5b4fce=_[_0x1a06('0xb6')](_0x5b4fce,{'model':db[_0x1a06('0xb7')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x452fae['query'][_0x1a06('0x5e')]){_0x42adc3[_0x1a06('0x5c')][_0x1a06('0x48')](function(_0x21bb85){_0x529140['field']('i.'+_0x21bb85);});}else{_0x529140[_0x1a06('0x65')](_0x1a06('0xa9'),'unreadMessages');_0x529140[_0x1a06('0x65')](_0x1a06('0xb8'),_0x1a06('0xb9'));_0x529140[_0x1a06('0x65')](_0x1a06('0xba'),_0x1a06('0xbb'));_0x529140[_0x1a06('0x65')](_0x1a06('0xbc'),_0x1a06('0xaa'));_0x529140['field'](_0x1a06('0xbd'));_0x529140[_0x1a06('0x65')]('c.firstName',_0x1a06('0xbe'));_0x529140[_0x1a06('0x65')](_0x1a06('0xbf'),'Contact.lastName');_0x529140['field'](_0x1a06('0xc0'),_0x1a06('0xc1'));_0x529140[_0x1a06('0x65')](_0x1a06('0xc2'),_0x1a06('0xc3'));_0x529140[_0x1a06('0x65')](_0x1a06('0xc4'),'Contact.mobile');_0x529140[_0x1a06('0x65')](_0x1a06('0xc5'),_0x1a06('0xc6'));_0x529140['field'](_0x1a06('0xc7'),_0x1a06('0xc8'));_0x529140[_0x1a06('0x65')](_0x1a06('0xc9'),_0x1a06('0xca'));_0x529140['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x42adc3[_0x1a06('0x34')])_0x529140[_0x1a06('0x34')](_0x42adc3[_0x1a06('0x34')]);if(_0x42adc3[_0x1a06('0x33')])_0x529140[_0x1a06('0x33')](_0x42adc3[_0x1a06('0x33')]);return db[_0x1a06('0xb2')][_0x1a06('0x59')](_0x529140['toString'](),_0x5b4fce);})['then'](function(_0x2d5c00){if(_0x2d5c00['length']>0x0)_0x259fac[_0x1a06('0x63')](_0x1a06('0xcb'),_[_0x1a06('0x45')](_0x2d5c00,'id'));return db[_0x1a06('0xb2')][_0x1a06('0x59')](_0x259fac[_0x1a06('0xb3')](),_0x5b4fce)['then'](function(_0x49a3ab){var _0x468e2f=_['groupBy'](_0x49a3ab,_0x1a06('0xcc'));var _0x390d2d=[];_0x2d5c00[_0x1a06('0x48')](function(_0x28f694){_0x390d2d['push'](updateChatInteraction(_0x28f694,_0x946fe9,_0x468e2f));});return BPromise[_0x1a06('0xcd')](_0x390d2d);});});})[_0x1a06('0x24')](function(_0x544e25){_0x348d03[_0x1a06('0xce')]=_0x544e25;return _0x348d03;})[_0x1a06('0x24')](respondWithFilteredResult(_0x4e431d,_0x42adc3))[_0x1a06('0x2e')](handleError(_0x4e431d,null));};exports[_0x1a06('0xcf')]=function(_0xda1d4b,_0x453d96){var _0x447138={'raw':![],'where':{'id':_0xda1d4b['params']['id']}},_0x3e9a17={};_0x3e9a17[_0x1a06('0x58')]=_[_0x1a06('0x5a')](db['ChatInteraction'][_0x1a06('0x54')]);_0x3e9a17[_0x1a06('0x59')]=_[_0x1a06('0x5a')](_0xda1d4b['query']);_0x3e9a17[_0x1a06('0x5b')]=_[_0x1a06('0x5d')](_0x3e9a17[_0x1a06('0x58')],_0x3e9a17[_0x1a06('0x59')]);_0x447138[_0x1a06('0x5c')]=_[_0x1a06('0x5d')](_0x3e9a17[_0x1a06('0x58')],qs['fields'](_0xda1d4b[_0x1a06('0x59')]['fields']));_0x447138[_0x1a06('0x5c')]=_0x447138['attributes'][_0x1a06('0x78')]?_0x447138[_0x1a06('0x5c')]:_0x3e9a17[_0x1a06('0x58')];if(_0xda1d4b['query'][_0x1a06('0xd0')]){_0x447138['include']=[{'all':!![]}];}_0x447138=_['merge']({},_0x447138,_0xda1d4b[_0x1a06('0xd1')]);return db['ChatInteraction'][_0x1a06('0x79')](_0x447138)[_0x1a06('0x24')](handleEntityNotFound(_0x453d96,null))[_0x1a06('0x24')](respondWithResult(_0x453d96,null))[_0x1a06('0x2e')](handleError(_0x453d96,null));};exports[_0x1a06('0xd2')]=function(_0x3328b0,_0x640c4f){return db[_0x1a06('0xb7')]['create'](_0x3328b0[_0x1a06('0xd3')],{})[_0x1a06('0x24')](respondWithResult(_0x640c4f,0xc9))['catch'](handleError(_0x640c4f,null));};exports[_0x1a06('0x3a')]=function(_0x38838c,_0x556e39){if(_0x38838c['body']['id']){delete _0x38838c[_0x1a06('0xd3')]['id'];}return db[_0x1a06('0xb7')][_0x1a06('0x79')]({'where':{'id':_0x38838c[_0x1a06('0xd4')]['id']}})[_0x1a06('0x24')](handleEntityNotFound(_0x556e39,null))['then'](saveUpdates(_0x38838c[_0x1a06('0xd3')],null))[_0x1a06('0x24')](respondWithResult(_0x556e39,null))[_0x1a06('0x2e')](handleError(_0x556e39,null));};exports['destroy']=function(_0x1bae4d,_0x2900a5){return db[_0x1a06('0xb7')][_0x1a06('0x79')]({'where':{'id':_0x1bae4d[_0x1a06('0xd4')]['id']}})[_0x1a06('0x24')](handleEntityNotFound(_0x2900a5,null))[_0x1a06('0x24')](removeEntity(_0x2900a5,null))[_0x1a06('0x2e')](handleError(_0x2900a5,null));};exports['describe']=function(_0x38c41b,_0xcc6c14){return db['ChatInteraction'][_0x1a06('0xd5')]()[_0x1a06('0x24')](respondWithResult(_0xcc6c14,null))[_0x1a06('0x2e')](handleError(_0xcc6c14,null));};exports[_0x1a06('0xd6')]=function(_0x224eaf,_0x3db1ea){var _0x2138ae=_0x224eaf['params']['id'];var _0x2675e7;var _0x5190aa;var _0x23e335;return db[_0x1a06('0xb7')][_0x1a06('0xd7')]({'where':{'id':_0x2138ae}})[_0x1a06('0x24')](function(_0x5d7f6f){_0x2675e7=_0x5d7f6f;return db[_0x1a06('0xd8')][_0x1a06('0xd7')]({'where':{'id':_0x5d7f6f['ChatWebsiteId']},'attributes':['id',_0x1a06('0xd9'),'vidaooEscalation',_0x1a06('0xda'),_0x1a06('0xdb'),_0x1a06('0xdc')],'raw':!![]});})[_0x1a06('0x24')](function(_0x1c39d2){if(_0x1c39d2&&_0x1c39d2[_0x1a06('0xd9')]&&_0x1c39d2['vidaooEscalation']){_0x5190aa=_0x1c39d2;var _0x45bc85={'interaction':{'id':_0x2138ae},'agent':{'id':_0x224eaf[_0x1a06('0xdd')]['id'],'name':_0x224eaf['user'][_0x1a06('0x3d')],'fullname':_0x224eaf[_0x1a06('0xdd')]['fullname'],'email':_0x224eaf[_0x1a06('0xdd')]['email']},'contact':_0x224eaf[_0x1a06('0xd3')]['contact'],'account':_0x224eaf[_0x1a06('0xd3')]['account']};var _0x31edde={'rejectUnauthorized':![],'method':_0x1a06('0xde'),'url':_0x1a06('0xdf'),'headers':{'X-APIKEY':_0x1c39d2[_0x1a06('0xd9')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x224eaf[_0x1a06('0xdd')][_0x1a06('0xe0')]],'buttons':null,'topic':_0x5190aa[_0x1a06('0xda')],'note':_[_0x1a06('0xe1')](_0x5190aa['vidaooNote'])?null:getMustacheRender(_0x5190aa[_0x1a06('0xdb')],_0x45bc85),'metadata':null},'redirect':_0x1a06('0xe2'),'json':!![]};try{if(!_[_0x1a06('0xe1')](_0x5190aa[_0x1a06('0xdc')])){var _0x206cb0=getMustacheRender(_0x5190aa['vidaooMetadata'],_0x45bc85);var _0x46bcf5=JSON[_0x1a06('0x91')](_0x206cb0);_0x31edde[_0x1a06('0xd3')][_0x1a06('0xe3')]=_0x46bcf5;}}catch(_0x4e499b){throw new db[(_0x1a06('0xa5'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x31edde);}else{throw new db[(_0x1a06('0xa5'))][(_0x1a06('0xe4'))](_0x1a06('0xe5'));}})[_0x1a06('0x24')](function(_0x1b2552){_0x23e335=_0x1b2552;if(_0x23e335['id']){var _0x597675={'body':_0x23e335[_0x1a06('0xe6')],'ChatWebsiteId':_0x5190aa['id'],'ChatInteractionId':_0x2675e7['id'],'direction':'out','UserId':_0x224eaf[_0x1a06('0xdd')]['id']};return db[_0x1a06('0xe7')][_0x1a06('0xd2')](_0x597675,{});}else{throw new db[(_0x1a06('0xa5'))][(_0x1a06('0xe4'))](_0x1a06('0xe8'));}})[_0x1a06('0x24')](function(){return _0x2675e7[_0x1a06('0xe9')]({'vidaooSessionId':_0x23e335['id']});})[_0x1a06('0x24')](respondWithResult(_0x3db1ea,null))[_0x1a06('0x2e')](handleError(_0x3db1ea,null));};exports[_0x1a06('0xea')]=function(_0x10a37b,_0x559843){if(_0x10a37b[_0x1a06('0xd3')]['id']){delete _0x10a37b['body']['id'];}return db[_0x1a06('0xb7')][_0x1a06('0x79')]({'where':{'id':_0x10a37b[_0x1a06('0xd4')]['id']},'include':[{'model':db['CmContact'],'as':_0x1a06('0xeb')}]})[_0x1a06('0x24')](handleEntityNotFound(_0x559843,null))[_0x1a06('0x24')](saveUpdates(_0x10a37b['body'],null))['then'](respondWithResult(_0x559843,null))[_0x1a06('0x2e')](handleError(_0x559843,null));};exports[_0x1a06('0xec')]=function(_0x2e9da2,_0x3c0c5f,_0x4f9978){if(_0x2e9da2[_0x1a06('0xd3')]['id']){delete _0x2e9da2[_0x1a06('0xd3')]['id'];}return db['ChatInteraction'][_0x1a06('0x79')]({'where':{'id':_0x2e9da2['params']['id']}})[_0x1a06('0x24')](function(_0x15f38d){if(!_0x15f38d){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x1a06('0xec'),0x194,_0x1a06('0xed'));_0x3c0c5f[_0x1a06('0x2f')](0x194);}else{if(_0x15f38d[_0x1a06('0x50')]){throw new db[(_0x1a06('0xa5'))][(_0x1a06('0xe4'))]('Interaction\x20already\x20assigned');}}return _0x15f38d;})[_0x1a06('0x24')](function(_0x17329a){if(_0x17329a){return _0x17329a[_0x1a06('0x3a')]({'closed':_0x2e9da2[_0x1a06('0xd3')][_0x1a06('0x51')],'disposition':_0x2e9da2['body'][_0x1a06('0x52')]})['then'](function(_0x4fdbdd){return _0x4fdbdd;});}})[_0x1a06('0x24')](function(_0x354b87){return respondWithRpcPromise('AbandonInteraction',_0x1a06('0xec'),_0x2e9da2[_0x1a06('0xd3')],client9004);})['then'](respondWithResult(_0x3c0c5f,null))[_0x1a06('0x2e')](handleError(_0x3c0c5f,null));};exports[_0x1a06('0xee')]=function(_0x56a527,_0x9449cd,_0x5e16e9){_0x56a527[_0x1a06('0xd3')][_0x1a06('0x3d')]=_0x56a527[_0x1a06('0xef')][_0x1a06('0xf0')];_0x56a527[_0x1a06('0xd3')][_0x1a06('0xf1')]=_0x56a527[_0x1a06('0xef')][_0x1a06('0xf2')];_0x56a527[_0x1a06('0xd3')][_0x1a06('0x56')]=_0x56a527[_0x1a06('0xef')]['mimetype'];return db[_0x1a06('0xf3')]['create'](_0x56a527['body'])[_0x1a06('0x24')](respondWithResult(_0x9449cd,0xc9))[_0x1a06('0x2e')](handleError(_0x9449cd,null));};exports['attachmentDownload']=function(_0x1f400c,_0x2cef96,_0x507d27){return db[_0x1a06('0xb7')][_0x1a06('0xd7')]({'where':{'id':_0x1f400c['params']['id']},'raw':!![]})[_0x1a06('0x24')](handleEntityNotFound(_0x2cef96,null))[_0x1a06('0x24')](function(_0x2b2bf8){if(_0x2b2bf8){if(_0x2b2bf8[_0x1a06('0x51')]){return _0x2cef96[_0x1a06('0x30')](0x193)[_0x1a06('0x32')]({'status':0x193,'message':_0x1a06('0xf4')});}return db[_0x1a06('0xf3')][_0x1a06('0xd7')]({'where':{'id':_0x1f400c[_0x1a06('0x59')][_0x1a06('0xf5')]},'raw':!![]})[_0x1a06('0x24')](handleEntityNotFound(_0x2cef96,null));}})[_0x1a06('0x24')](function(_0x1bf835){if(_0x1bf835){var _0x44f60e=_0x1bf835[_0x1a06('0xf6')]!==null;var _0x3e9d60=path[_0x1a06('0xf7')](config['root'],'server/files/attachments/');if(_0x44f60e){_0x3e9d60=path[_0x1a06('0xf7')](_0x3e9d60,_0x1a06('0xf8'));}var _0x353ba8=path['join'](_0x3e9d60,_0x1bf835[_0x1a06('0xf1')]);return _0x2cef96['download'](_0x353ba8);}})['catch'](handleError(_0x2cef96,null));};exports[_0x1a06('0xf9')]=function(_0x2ff915,_0x260519){var _0x465e6c=null;var _0x3a4498=null;var _0x3f3bd4=null;var _0x2cef06=null;if(_0x2ff915['body']['id']){delete _0x2ff915[_0x1a06('0xd3')]['id'];}if(_0x2ff915[_0x1a06('0xd3')][_0x1a06('0xfa')]){_0x2cef06=path[_0x1a06('0xf7')](config[_0x1a06('0xfb')],_0x1a06('0xfc'),util[_0x1a06('0xfd')]('transcript-%s.txt',Date['now']()));_0x2ff915['body'][_0x1a06('0xfe')]=_0x2cef06;}return db[_0x1a06('0xb7')][_0x1a06('0x79')]({'where':{'id':_0x2ff915[_0x1a06('0xd4')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x1a06('0xff'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x260519,null))[_0x1a06('0x24')](saveUpdates(_0x2ff915[_0x1a06('0xd3')],null))[_0x1a06('0x24')](function(_0x110d29){if(_0x110d29){_0x465e6c=_0x110d29;return db[_0x1a06('0xd8')][_0x1a06('0x79')]({'where':{'id':_0x465e6c[_0x1a06('0x8e')]}});}})[_0x1a06('0x24')](function(_0x5db4b6){if(_0x5db4b6){_0x3f3bd4=_0x5db4b6;return db['CmContact'][_0x1a06('0x79')]({'where':{'id':_0x465e6c[_0x1a06('0x82')]}});}})[_0x1a06('0x24')](function(_0x382055){if(_0x382055){_0x3a4498=_0x382055;if(_0x2cef06){var _0x17a153=null;for(var _0x237745=0x1;_0x237745<_0x465e6c[_0x1a06('0xff')][_0x1a06('0x78')];++_0x237745){_0x17a153=_0x465e6c[_0x1a06('0xff')][_0x237745];var _0x44e43a=_0x17a153[_0x1a06('0x50')]?util['format'](_0x1a06('0x100'),_0x3f3bd4[_0x1a06('0x101')],_0x17a153[_0x1a06('0x50')]):_0x1a06('0x102');var _0x1323b3=_0x2ff915[_0x1a06('0xd3')][_0x1a06('0x103')]||util[_0x1a06('0xfd')](_0x1a06('0x100'),_0x1a06('0x104'),_0x17a153[_0x1a06('0x82')]);switch(_0x3f3bd4[_0x1a06('0x105')]){case _0x1a06('0x106'):_0x44e43a=_0x17a153[_0x1a06('0x50')]?util[_0x1a06('0xfd')](_0x1a06('0x100'),_0x3f3bd4[_0x1a06('0x101')],_0x17a153[_0x1a06('0x50')]):_0x1a06('0x102');break;case _0x1a06('0x107'):_0x44e43a=_0x17a153[_0x1a06('0x50')]?_0x17a153['User']['alias']||_0x17a153[_0x1a06('0x88')][_0x1a06('0x108')]:_0x1a06('0x102');break;case _0x1a06('0x109'):_0x44e43a=_0x17a153[_0x1a06('0x50')]?_0x17a153['User'][_0x1a06('0x108')]:_0x1a06('0x102');break;default:_0x44e43a=_0x17a153[_0x1a06('0x50')]?util[_0x1a06('0xfd')](_0x1a06('0x100'),_0x3f3bd4[_0x1a06('0x101')],_0x17a153[_0x1a06('0x50')]):_0x1a06('0x102');}var _0x43d52c=util[_0x1a06('0xfd')](_0x1a06('0x10a'),moment(_0x17a153[_0x1a06('0x90')])[_0x1a06('0xfd')](_0x1a06('0x10b')),_0x17a153[_0x1a06('0x10c')]==='in'?_0x1323b3:_0x44e43a,_0x17a153['body']);if(!_0x17a153[_0x1a06('0x10d')]){fs['appendFileSync'](_0x2cef06,_0x43d52c);}}return db[_0x1a06('0x10e')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x1a06('0x10f')],'as':_0x1a06('0x110'),'raw':!![]}]});}}})[_0x1a06('0x24')](function(_0x1404b3){if(_0x1404b3&&_0x1404b3[_0x1a06('0x110')]&&_0x2ff915[_0x1a06('0xd3')]){var _0x2990f8={'tls':{'rejectUnauthorized':![]}};if(_0x1404b3[_0x1a06('0x110')][_0x1a06('0x111')]){_0x2990f8[_0x1a06('0x111')]=_0x1404b3[_0x1a06('0x110')][_0x1a06('0x111')];}else{_0x2990f8['host']=_0x1404b3[_0x1a06('0x110')][_0x1a06('0x112')];_0x2990f8[_0x1a06('0x113')]=_0x1404b3[_0x1a06('0x110')][_0x1a06('0x113')];_0x2990f8[_0x1a06('0x114')]=_0x1404b3[_0x1a06('0x110')][_0x1a06('0x114')];}if(_0x1404b3[_0x1a06('0x110')][_0x1a06('0x115')]){_0x2990f8[_0x1a06('0x116')]={'user':_0x1404b3[_0x1a06('0x110')]['user'],'pass':_0x1404b3[_0x1a06('0x110')][_0x1a06('0x117')]};}return respondWithRpcPromise('SendMail',_0x1a06('0x118'),{'account':_0x2990f8,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1404b3[_0x1a06('0x3d')],_0x1404b3[_0x1a06('0xe0')]||_0x1404b3[_0x1a06('0x110')][_0x1a06('0xdd')]),'to':_0x2ff915[_0x1a06('0xd3')]['mailTranscript'],'subject':_0x1a06('0x119'),'text':util[_0x1a06('0xfd')](_0x1a06('0x11a'),_0x2ff915['body'][_0x1a06('0xfa')]),'attachments':[{'path':_0x2cef06}]}})[_0x1a06('0x24')](function(){return _0x465e6c;})[_0x1a06('0x2e')](function(_0x2a4a73){console[_0x1a06('0x2a')](_0x2a4a73);});}else{return _0x465e6c;}})[_0x1a06('0x24')](respondWithStatusCode(_0x260519,0xc8))['catch'](handleError(_0x260519,null));};exports[_0x1a06('0x11b')]=function(_0x324445,_0x48070c,_0x1717ad){return db[_0x1a06('0xe7')]['find']({'where':{'id':_0x324445['params']['id']}})[_0x1a06('0x24')](handleEntityNotFound(_0x48070c,null))[_0x1a06('0x24')](function(_0x3a44d2){if(_0x3a44d2){return _0x3a44d2[_0x1a06('0x11b')](_0x324445[_0x1a06('0xd3')][_0x1a06('0x11c')],_[_0x1a06('0x11d')](_0x324445['body'],[_0x1a06('0x11c'),'id'])||{});}})['then'](respondWithResult(_0x48070c,null))['catch'](handleError(_0x48070c,null));};exports[_0x1a06('0x11e')]=function(_0x42c638,_0x2feeb9,_0x443f0e){var _0x125773={'raw':![],'where':{}};var _0x25b86f={};var _0x26ef9e={'count':0x0,'rows':[]};return db[_0x1a06('0xb7')][_0x1a06('0xd7')]({'where':{'id':_0x42c638[_0x1a06('0xd4')]['id']}})[_0x1a06('0x24')](handleEntityNotFound(_0x2feeb9,null))['then'](function(_0x2bc392){if(_0x2bc392){_0x25b86f[_0x1a06('0x58')]=_[_0x1a06('0x5a')](db[_0x1a06('0xe7')][_0x1a06('0x54')]);_0x25b86f['query']=_['keys'](_0x42c638[_0x1a06('0x59')]);_0x25b86f[_0x1a06('0x5b')]=_[_0x1a06('0x5d')](_0x25b86f[_0x1a06('0x58')],_0x25b86f[_0x1a06('0x59')]);_0x125773[_0x1a06('0x5c')]=_[_0x1a06('0x5d')](_0x25b86f[_0x1a06('0x58')],qs[_0x1a06('0x5e')](_0x42c638[_0x1a06('0x59')][_0x1a06('0x5e')]));_0x125773[_0x1a06('0x5c')]=_0x125773[_0x1a06('0x5c')][_0x1a06('0x78')]?_0x125773[_0x1a06('0x5c')]:_0x25b86f['model'];if(!_0x42c638[_0x1a06('0x59')][_0x1a06('0x5f')](_0x1a06('0x60'))){_0x125773[_0x1a06('0x34')]=qs[_0x1a06('0x34')](_0x42c638[_0x1a06('0x59')][_0x1a06('0x34')]);_0x125773[_0x1a06('0x33')]=qs[_0x1a06('0x33')](_0x42c638[_0x1a06('0x59')][_0x1a06('0x33')]);}_0x125773[_0x1a06('0x61')]=qs[_0x1a06('0x62')](_0x42c638[_0x1a06('0x59')][_0x1a06('0x62')]);_0x125773[_0x1a06('0x63')]=qs['filters'](_[_0x1a06('0x11f')](_0x42c638[_0x1a06('0x59')],_0x25b86f[_0x1a06('0x5b')]));_0x125773[_0x1a06('0x63')][_0x1a06('0xcc')]=_0x2bc392['id'];if(_0x42c638[_0x1a06('0x59')]['filter']){_0x125773['where']=_[_0x1a06('0xb6')](_0x125773[_0x1a06('0x63')],{'$or':_['map'](_0x125773[_0x1a06('0x5c')],function(_0x5b28e4){var _0x493b6e={};_0x493b6e[_0x5b28e4]={'$like':'%'+_0x42c638[_0x1a06('0x59')][_0x1a06('0x9d')]+'%'};return _0x493b6e;})});}if(_0x42c638[_0x1a06('0x59')][_0x1a06('0x92')]){var _0x1d4031=_0x42c638[_0x1a06('0x59')][_0x1a06('0x92')][_0x1a06('0x120')](',');var _0x471868={};_0x471868[_0x1d4031[0x0]]={'$gte':moment(_0x1d4031[0x1])[_0x1a06('0xfd')](_0x1a06('0x121'))};_0x125773[_0x1a06('0x63')]=_['merge'](_0x125773[_0x1a06('0x63')],_0x471868);}_0x125773=_[_0x1a06('0xb6')]({},_0x125773,_0x42c638[_0x1a06('0xd1')]);return db[_0x1a06('0xe7')][_0x1a06('0xb4')]({'where':_0x125773[_0x1a06('0x63')]})[_0x1a06('0x24')](function(_0x396c0f){_0x26ef9e[_0x1a06('0xb4')]=_0x396c0f;if(_0x42c638[_0x1a06('0x59')][_0x1a06('0xd0')]){_0x125773[_0x1a06('0x122')]=[{'all':!![]}];}return db[_0x1a06('0xe7')][_0x1a06('0x123')](_0x125773);})[_0x1a06('0x24')](function(_0x17d0c1){_0x26ef9e[_0x1a06('0xce')]=_0x17d0c1;return _0x26ef9e;});}})[_0x1a06('0x24')](respondWithFilteredResult(_0x2feeb9,_0x125773))[_0x1a06('0x2e')](handleError(_0x2feeb9,null));};exports[_0x1a06('0x124')]=function(_0x37dfc5,_0x27671d,_0x3750cb){var _0x23ba17={'where':{}},_0x491977={},_0x409a1e={'count':0x0,'rows':[]};return db[_0x1a06('0xb7')]['findOne']({'where':{'id':_0x37dfc5[_0x1a06('0xd4')]['id']}})['then'](handleEntityNotFound(_0x27671d,null))['then'](function(_0x2e7200){if(_0x2e7200){_0x491977[_0x1a06('0x58')]=_[_0x1a06('0x5a')](db[_0x1a06('0xe7')][_0x1a06('0x54')]);_0x491977[_0x1a06('0x59')]=_[_0x1a06('0x5a')](_0x37dfc5[_0x1a06('0x59')]);_0x491977['filters']=_[_0x1a06('0x5d')](_0x491977[_0x1a06('0x58')],_0x491977['query']);_0x23ba17[_0x1a06('0x5c')]=_[_0x1a06('0x5d')](_0x491977['model'],qs[_0x1a06('0x5e')](_0x37dfc5[_0x1a06('0x59')][_0x1a06('0x5e')]));_0x23ba17[_0x1a06('0x5c')]=_0x23ba17[_0x1a06('0x5c')][_0x1a06('0x78')]?_0x23ba17['attributes']:_0x491977[_0x1a06('0x58')];if(!_0x37dfc5['query']['hasOwnProperty']('nolimit')){_0x23ba17[_0x1a06('0x34')]=qs[_0x1a06('0x34')](_0x37dfc5[_0x1a06('0x59')][_0x1a06('0x34')]);_0x23ba17[_0x1a06('0x33')]=qs['offset'](_0x37dfc5[_0x1a06('0x59')][_0x1a06('0x33')]);}_0x23ba17['order']=qs['sort'](_0x37dfc5[_0x1a06('0x59')][_0x1a06('0x62')]);_0x23ba17[_0x1a06('0x63')]=qs[_0x1a06('0x5b')](_[_0x1a06('0x11f')](_0x37dfc5[_0x1a06('0x59')],_0x491977[_0x1a06('0x5b')]));_0x23ba17[_0x1a06('0x63')][_0x1a06('0xcc')]=_0x2e7200['id'];if(_0x37dfc5['query'][_0x1a06('0x9d')]){_0x23ba17[_0x1a06('0x63')]=_['merge'](_0x23ba17[_0x1a06('0x63')],{'$or':_['map'](_0x23ba17[_0x1a06('0x5c')],function(_0x17ad33){var _0x31e307={};_0x31e307[_0x17ad33]={'$like':'%'+_0x37dfc5[_0x1a06('0x59')][_0x1a06('0x9d')]+'%'};return _0x31e307;})});}_0x23ba17[_0x1a06('0x63')]['secret']=![];if(_0x37dfc5[_0x1a06('0x59')]['id']){_0x23ba17[_0x1a06('0x63')]['id']={'$gt':_0x37dfc5[_0x1a06('0x59')]['id']};}_0x23ba17=_[_0x1a06('0xb6')]({},_0x23ba17,_0x37dfc5[_0x1a06('0xd1')]);return db[_0x1a06('0xe7')]['count']({'where':_0x23ba17[_0x1a06('0x63')]})[_0x1a06('0x24')](function(_0xd74098){_0x409a1e[_0x1a06('0xb4')]=_0xd74098;_0x23ba17['include']=[];if(_0x37dfc5[_0x1a06('0x59')][_0x1a06('0x125')]){_0x23ba17[_0x1a06('0x122')][_0x1a06('0x49')]({'model':db[_0x1a06('0x88')],'as':'User','attributes':['id',_0x1a06('0x108'),_0x1a06('0x126')]});}if(_0x37dfc5[_0x1a06('0x59')][_0x1a06('0xd0')]){_0x23ba17[_0x1a06('0x122')]=[{'all':!![]}];}return db[_0x1a06('0xe7')][_0x1a06('0x123')](_0x23ba17);})[_0x1a06('0x24')](function(_0x31ea63){_0x409a1e[_0x1a06('0xce')]=_0x31ea63;return _0x409a1e;});}})[_0x1a06('0x24')](respondWithFilteredResult(_0x27671d,_0x23ba17))[_0x1a06('0x2e')](handleError(_0x27671d,null));};exports[_0x1a06('0x127')]=function(_0x3b7249,_0x45bf66,_0xa4f688){return db[_0x1a06('0xb7')][_0x1a06('0x79')]({'where':{'id':_0x3b7249[_0x1a06('0xd4')]['id']}})['then'](handleEntityNotFound(_0x45bf66,null))['then'](function(_0x4c5a19){if(_0x4c5a19){return _0x4c5a19['setTags'](_0x3b7249['body'][_0x1a06('0x11c')],_['omit'](_0x3b7249[_0x1a06('0xd3')],['ids','id'])||{})[_0x1a06('0x128')](function(){return db[_0x1a06('0x85')]['findAll']({'attributes':['id',_0x1a06('0x3d'),_0x1a06('0x66')],'where':{'id':_0x3b7249[_0x1a06('0xd3')][_0x1a06('0x11c')]}});})[_0x1a06('0x24')](function(_0x36c557){socket['emit']('chatInteractionTags:save',{'id':Number(_0x3b7249[_0x1a06('0xd4')]['id']),'tags':_0x36c557||[]});return{'id':Number(_0x3b7249['params']['id']),'tags':_0x36c557||[]};});}})[_0x1a06('0x24')](respondWithResult(_0x45bf66,null))[_0x1a06('0x2e')](handleError(_0x45bf66,null));};exports[_0x1a06('0x129')]=function(_0x55b37c,_0x1a027e,_0x57517c){return db[_0x1a06('0xb7')][_0x1a06('0x79')]({'where':{'id':_0x55b37c[_0x1a06('0xd4')]['id']}})[_0x1a06('0x24')](handleEntityNotFound(_0x1a027e,null))[_0x1a06('0x24')](function(_0x2c7078){if(_0x2c7078){return _0x2c7078[_0x1a06('0x129')](_0x55b37c[_0x1a06('0x59')][_0x1a06('0x11c')]);}})[_0x1a06('0x24')](respondWithStatusCode(_0x1a027e,null))[_0x1a06('0x2e')](handleError(_0x1a027e,null));};exports[_0x1a06('0x12a')]=function(_0x1f59de,_0x129413){var _0x5636b0=moment()[_0x1a06('0x12b')]()['toString']();var _0xfa4803=path[_0x1a06('0xf7')](config[_0x1a06('0xfb')],_0x1a06('0x12c'),_0x1a06('0x12d'),'tmp');var _0x3e656e=path[_0x1a06('0xf7')](config[_0x1a06('0xfb')],'server',_0x1a06('0x12d'),'attachments');var _0x456d85=path[_0x1a06('0xf7')](_0xfa4803,_0x5636b0);var _0x594fc4=util[_0x1a06('0xfd')]('transcript-%d-%s.zip',_0x1f59de[_0x1a06('0xd4')]['id'],_0x5636b0);var _0x37209e=path[_0x1a06('0xf7')](_0xfa4803,_0x594fc4);var _0xc7de2d=[];_0xc7de2d[_0x1a06('0x49')]({'model':db[_0x1a06('0x88')],'as':_0x1a06('0x88'),'attributes':['id',_0x1a06('0x108')],'raw':!![]});_0xc7de2d[_0x1a06('0x49')]({'model':db[_0x1a06('0x12e')],'as':'Contact','attributes':['id','firstName',_0x1a06('0x12f')],'raw':!![]});if(_0x1f59de[_0x1a06('0x59')]['attachments']){_0xc7de2d[_0x1a06('0x49')]({'model':db[_0x1a06('0xf3')],'as':_0x1a06('0xf3'),'raw':!![]});}var _0x294bcd=[{'model':db['ChatMessage'],'as':_0x1a06('0xff'),'attributes':['id',_0x1a06('0xd3'),_0x1a06('0x90'),_0x1a06('0x10c'),_0x1a06('0x10d'),_0x1a06('0x98')],'include':_0xc7de2d}];_0x294bcd[_0x1a06('0x49')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x1a06('0x3d')]});_0x294bcd[_0x1a06('0x49')]({'model':db[_0x1a06('0x88')],'as':_0x1a06('0x130'),'attributes':['id',_0x1a06('0x108')]});return db[_0x1a06('0xb7')]['find']({'where':{'id':_0x1f59de[_0x1a06('0xd4')]['id']},'include':_0x294bcd})[_0x1a06('0x24')](handleEntityNotFound(_0x129413,null))[_0x1a06('0x24')](function(_0x2540ec){if(_0x2540ec){var _0x264e26=_0x2540ec['get']({'plain':!![]});fs[_0x1a06('0x131')](_0x456d85);var _0x4f1196={'channel':_0x1a06('0x132'),'account':_0x264e26[_0x1a06('0x133')][_0x1a06('0x3d')],'agent':_0x264e26[_0x1a06('0x130')]?_0x264e26[_0x1a06('0x130')][_0x1a06('0x108')]:_0x1a06('0x134'),'createdAt':moment(_0x264e26[_0x1a06('0x90')])['format'](_0x1a06('0x121'))[_0x1a06('0xb3')](),'closedAt':_0x264e26['closed']?moment(_0x264e26['closedAt'])[_0x1a06('0xfd')](_0x1a06('0x121'))[_0x1a06('0xb3')]():'','disposition':_0x264e26['disposition'],'chatInfo':{'browser':_0x264e26['browserName'],'os':_0x264e26[_0x1a06('0x135')],'referer':_0x264e26[_0x1a06('0x136')],'customerIp':_0x264e26[_0x1a06('0x137')],'customerPort':_0x264e26['customerPort']?_0x264e26['customerPort']:_0x1a06('0x134')},'messages':_(_0x264e26[_0x1a06('0xff')])[_0x1a06('0x138')]()['filter']({'secret':![]})[_0x1a06('0x45')](function(_0xdf67){if(_0xdf67[_0x1a06('0xf3')]){var _0x57b20f=path[_0x1a06('0xf7')](_0x3e656e,_0xdf67[_0x1a06('0xf3')][_0x1a06('0xf1')]);if(fs[_0x1a06('0x139')](_0x57b20f)){fs[_0x1a06('0x13a')](_0x57b20f)[_0x1a06('0x13b')](fs[_0x1a06('0x13c')](path[_0x1a06('0xf7')](_0x456d85,_0xdf67['Attachment'][_0x1a06('0xf1')])));}}return{'date':moment(_0xdf67[_0x1a06('0x90')])[_0x1a06('0xfd')](_0x1a06('0x121'))['toString'](),'sender':_0xdf67[_0x1a06('0x10c')]==='out'?_0xdf67[_0x1a06('0x88')]?_0xdf67[_0x1a06('0x88')][_0x1a06('0x108')]:_0x1a06('0x102'):_0xdf67['Contact'][_0x1a06('0x13d')]+(_0xdf67[_0x1a06('0xeb')][_0x1a06('0x12f')]?'\x20'+_0xdf67[_0x1a06('0xeb')]['lastName']:''),'body':_0xdf67['Attachment']?_0xdf67[_0x1a06('0xf3')][_0x1a06('0xf1')]:_0xdf67[_0x1a06('0xd3')],'direction':_0xdf67['direction']===_0x1a06('0x13e')?'A':'C','secret':_0xdf67[_0x1a06('0x10d')],'read':_0xdf67['read'],'attachment':_0xdf67[_0x1a06('0xf3')]};})[_0x1a06('0x7b')]()};return ejs[_0x1a06('0x13f')](path['join'](config['root'],_0x1a06('0x12c'),'views',_0x1a06('0x140')),{'interaction':_0x4f1196})[_0x1a06('0x24')](function(_0x1b6951){var _0x539c44=path[_0x1a06('0xf7')](_0x456d85,_0x1a06('0x141')+_0x264e26['id']+'-'+_0x5636b0+'.pdf');var _0x3e9a72={'path':_0x539c44,'channel':_0x1a06('0x132'),'interactionId':_0x264e26['id']};return pdf[_0x1a06('0x142')](_0x1b6951,_0x3e9a72);})[_0x1a06('0x24')](function(){return new BPromise(function(_0x1789fd,_0x116cd9){zipdir(_0x456d85,{'saveTo':_0x37209e},function(_0x590233,_0x5678b2){if(_0x590233)return _0x116cd9(_0x590233);return _0x1789fd(_0x5678b2);});})[_0x1a06('0x24')](function(){return new BPromise(function(_0x66edf1,_0x35e645){rimraf(_0x456d85,function(_0x16a5da){if(_0x16a5da)_0x35e645(_0x16a5da);return _0x66edf1();});});})[_0x1a06('0x24')](function(){return _0x129413[_0x1a06('0x12a')](_0x37209e,_0x594fc4,function(_0x4d734a){if(_0x4d734a){console[_0x1a06('0x143')]('err',_0x4d734a);}else{fs[_0x1a06('0x144')](_0x37209e);}});});});}else{return _0x129413[_0x1a06('0x2f')](0xc8);}})[_0x1a06('0x2e')](handleError(_0x129413,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 170e0fd..2411a64 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 _0x9fb4=['update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','ChatMessage','setMaxListeners','save'];(function(_0x4bf591,_0x48b450){var _0x18f0df=function(_0x4754ea){while(--_0x4754ea){_0x4bf591['push'](_0x4bf591['shift']());}};_0x18f0df(++_0x48b450);}(_0x9fb4,0x113));var _0x49fb=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0x9fb4[_0xb1cf84];return _0x4bad2e;};'use strict';var EventEmitter=require(_0x49fb('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x49fb('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x49fb('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x49fb('0x3')](0x0);var events={'afterCreate':_0x49fb('0x4'),'afterUpdate':_0x49fb('0x5'),'afterDestroy':_0x49fb('0x6')};function emitEvent(_0x2f1f32){return function(_0x34baf1,_0x592b4a,_0x3d25d9){_0x34baf1[_0x49fb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x44e802){_0x34baf1[_0x49fb('0x8')](_0x49fb('0x9'),_0x44e802[_0x49fb('0xa')](function(_0x1f3834){return{'id':_0x1f3834['id']};}));return ChatMessage[_0x49fb('0xb')]({'where':{'ChatInteractionId':_0x34baf1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x49fb('0xc')](function(_0x10e3b2){_0x34baf1[_0x49fb('0x8')](_0x49fb('0xd'),_0x10e3b2[_0x49fb('0xe')]);ChatInteractionEvents[_0x49fb('0xf')](_0x2f1f32+':'+_0x34baf1['id'],_0x34baf1);ChatInteractionEvents[_0x49fb('0xf')](_0x2f1f32,_0x34baf1);_0x3d25d9(null);})[_0x49fb('0x10')](_0x3d25d9(null));};}for(var e in events){if(events[_0x49fb('0x11')](e)){var event=events[e];ChatInteraction[_0x49fb('0x12')](e,emitEvent(event));}}module[_0x49fb('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0xde47=['unreadMessages','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','remove','getUsers','Users','setDataValue'];(function(_0x2e8400,_0x1e3452){var _0x5f0a16=function(_0x5b3894){while(--_0x5b3894){_0x2e8400['push'](_0x2e8400['shift']());}};_0x5f0a16(++_0x1e3452);}(_0xde47,0x1a9));var _0x7de4=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xde47[_0xdeac17];return _0x33aabd;};'use strict';var EventEmitter=require(_0x7de4('0x0'));var ChatInteraction=require(_0x7de4('0x1'))['db'][_0x7de4('0x2')];var ChatMessage=require(_0x7de4('0x1'))['db'][_0x7de4('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7de4('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7de4('0x5')};function emitEvent(_0x2e074f){return function(_0x1d945e,_0x2d2288,_0x20c847){_0x1d945e[_0x7de4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x445a02){_0x1d945e['setDataValue'](_0x7de4('0x7'),_0x445a02['map'](function(_0x4433ca){return{'id':_0x4433ca['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1d945e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x40f467){_0x1d945e[_0x7de4('0x8')](_0x7de4('0x9'),_0x40f467['length']);ChatInteractionEvents[_0x7de4('0xa')](_0x2e074f+':'+_0x1d945e['id'],_0x1d945e);ChatInteractionEvents['emit'](_0x2e074f,_0x1d945e);_0x20c847(null);})[_0x7de4('0xb')](_0x20c847(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x7de4('0xc')](e,emitEvent(event));}}module[_0x7de4('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c45f4c2..ecf9767 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 _0x39db=['util','../../config/logger','moment','bluebird','request-promise','./chatInteraction.attributes','exports','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash'];(function(_0xaa62bc,_0xae360e){var _0x225a7a=function(_0x1364c8){while(--_0x1364c8){_0xaa62bc['push'](_0xaa62bc['shift']());}};_0x225a7a(++_0xae360e);}(_0x39db,0x141));var _0xb39d=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x39db[_0x47e7dd];return _0x38501f;};'use strict';var _=require(_0xb39d('0x0'));var util=require(_0xb39d('0x1'));var logger=require(_0xb39d('0x2'))('api');var moment=require(_0xb39d('0x3'));var BPromise=require(_0xb39d('0x4'));var rp=require(_0xb39d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb39d('0x6'));module[_0xb39d('0x7')]=function(_0x15ea03,_0xd7a4a4){return _0x15ea03['define']('ChatInteraction',attributes,{'tableName':_0xb39d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf93573,_0x3e9c25,_0x168080){if(_0xf93573[_0xb39d('0x9')](_0xb39d('0xa'))){_0xf93573['closedAt']=moment()[_0xb39d('0xb')](_0xb39d('0xc'));}_0x168080(null,_0xf93573);}},'charset':'utf8mb4','collate':_0xb39d('0xd')});}; \ No newline at end of file +var _0xfb57=['bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1529f2,_0x45ecfa){var _0x4189e8=function(_0x5879ce){while(--_0x5879ce){_0x1529f2['push'](_0x1529f2['shift']());}};_0x4189e8(++_0x45ecfa);}(_0xfb57,0x13f));var _0x7fb5=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xfb57[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x7fb5('0x0'));var util=require(_0x7fb5('0x1'));var logger=require(_0x7fb5('0x2'))(_0x7fb5('0x3'));var moment=require(_0x7fb5('0x4'));var BPromise=require(_0x7fb5('0x5'));var rp=require(_0x7fb5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fb5('0x7'));var config=require(_0x7fb5('0x8'));var attributes=require(_0x7fb5('0x9'));module[_0x7fb5('0xa')]=function(_0x4c494b,_0x4fab4f){return _0x4c494b[_0x7fb5('0xb')](_0x7fb5('0xc'),attributes,{'tableName':_0x7fb5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36a868,_0x59efbe,_0x350928){if(_0x36a868['changed'](_0x7fb5('0xe'))){_0x36a868['closedAt']=moment()[_0x7fb5('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x350928(null,_0x36a868);}},'charset':_0x7fb5('0x10'),'collate':_0x7fb5('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index ffcf0ee..6efee49 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 _0x558a=['rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','limit','AddTagsToChatInteraction','find','where','AddTags','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5a9199,_0x96b786){var _0x2c5cef=function(_0x546133){while(--_0x546133){_0x5a9199['push'](_0x5a9199['shift']());}};_0x2c5cef(++_0x96b786);}(_0x558a,0xde));var _0xa558=function(_0x59bad4,_0x504318){_0x59bad4=_0x59bad4-0x0;var _0x2b4fde=_0x558a[_0x59bad4];return _0x2b4fde;};'use strict';var _=require('lodash');var util=require(_0xa558('0x0'));var moment=require(_0xa558('0x1'));var BPromise=require('bluebird');var rs=require(_0xa558('0x2'));var fs=require('fs');var Redis=require(_0xa558('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa558('0x4'));var logger=require(_0xa558('0x5'))(_0xa558('0x6'));var config=require(_0xa558('0x7'));var jayson=require(_0xa558('0x8'));var client=jayson[_0xa558('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa558('0xa')](config[_0xa558('0xb')],{'host':_0xa558('0xc'),'port':0x18eb});var socket=require(_0xa558('0xd'))(new Redis(config[_0xa558('0xb')]));require('./chatInteraction.socket')[_0xa558('0xe')](socket);function respondWithRpcPromise(_0x2c9345,_0x5a5c3b,_0x34529c){return new BPromise(function(_0x133657,_0x1d1eb3){return client['request'](_0x2c9345,_0x34529c)[_0xa558('0xf')](function(_0x5546db){logger['info'](_0xa558('0x10'),_0x5a5c3b,_0xa558('0x11'));logger[_0xa558('0x12')](_0xa558('0x13'),_0x5a5c3b,_0xa558('0x11'),JSON[_0xa558('0x14')](_0x5546db));if(_0x5546db[_0xa558('0x15')]){if(_0x5546db[_0xa558('0x15')][_0xa558('0x16')]===0x1f4){logger['error'](_0xa558('0x10'),_0x5a5c3b,_0x5546db['error']['message']);return _0x1d1eb3(_0x5546db[_0xa558('0x15')][_0xa558('0x17')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5a5c3b,_0x5546db['error']['message']);return _0x133657(_0x5546db[_0xa558('0x15')][_0xa558('0x17')]);}else{logger[_0xa558('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5a5c3b,'request\x20sent');_0x133657(_0x5546db[_0xa558('0x19')][_0xa558('0x17')]);}})[_0xa558('0x1a')](function(_0x17584c){logger[_0xa558('0x15')](_0xa558('0x10'),_0x5a5c3b,_0x17584c);_0x1d1eb3(_0x17584c);});});}exports[_0xa558('0x1b')]=function(_0x3c7ab5){var _0x1e696c=this;return new Promise(function(_0x3ba962,_0x507b96){return db[_0xa558('0x1c')][_0xa558('0x1d')](_0x3c7ab5[_0xa558('0x1e')],{'raw':_0x3c7ab5['options']?_0x3c7ab5[_0xa558('0x1f')][_0xa558('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c7ab5[_0xa558('0x1f')]?_0x3c7ab5['options']['where']||null:null,'attributes':_0x3c7ab5[_0xa558('0x1f')]?_0x3c7ab5[_0xa558('0x1f')]['attributes']||null:null,'limit':_0x3c7ab5[_0xa558('0x1f')]?_0x3c7ab5['options'][_0xa558('0x21')]||null:null})[_0xa558('0xf')](function(_0x5bdb51){logger[_0xa558('0x18')](_0xa558('0x1b'),_0x3c7ab5);logger['debug']('UpdateChatInteraction',_0x3c7ab5,JSON[_0xa558('0x14')](_0x5bdb51));_0x3ba962(_0x5bdb51);})['catch'](function(_0x34628f){logger['error'](_0xa558('0x1b'),_0x34628f[_0xa558('0x17')],_0x3c7ab5);_0x507b96(_0x1e696c[_0xa558('0x15')](0x1f4,_0x34628f[_0xa558('0x17')]));});});};exports[_0xa558('0x22')]=function(_0x35e51b){return new Promise(function(_0x162e2e,_0x3515ab){return db[_0xa558('0x1c')][_0xa558('0x23')]({'where':_0x35e51b['options']?_0x35e51b[_0xa558('0x1f')][_0xa558('0x24')]||null:null})[_0xa558('0xf')](function(_0x43851f){if(_0x43851f){return _0x43851f['addTags'](_0x35e51b[_0xa558('0x1e')]['ids'],_['omit'](_0x35e51b[_0xa558('0x1e')],['ids','id'])||{});}})['spread'](function(_0x123051){logger[_0xa558('0x18')]('AddTags',_0x35e51b);logger[_0xa558('0x12')](_0xa558('0x25'),_0x35e51b,JSON[_0xa558('0x14')](_0x123051));_0x162e2e(_0x123051);})[_0xa558('0x1a')](function(_0x2aa431){logger[_0xa558('0x15')](_0xa558('0x25'),_0x2aa431[_0xa558('0x17')],_0x35e51b);_0x3515ab(_this['error'](0x1f4,_0x2aa431[_0xa558('0x17')]));});});}; \ No newline at end of file +var _0x0745=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatInteraction','update','body','options','raw','attributes','limit','UpdateChatInteraction','debug','find','where','addTags','ids','omit','AddTags','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0745,0x12c));var _0x5074=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0745[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x5074('0x0'));var moment=require(_0x5074('0x1'));var BPromise=require(_0x5074('0x2'));var rs=require(_0x5074('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5074('0x4'))['db'];var utils=require(_0x5074('0x5'));var logger=require(_0x5074('0x6'))(_0x5074('0x7'));var config=require(_0x5074('0x8'));var jayson=require(_0x5074('0x9'));var client=jayson[_0x5074('0xa')][_0x5074('0xb')]({'port':0x232a});config[_0x5074('0xc')]=_['defaults'](config[_0x5074('0xc')],{'host':_0x5074('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5074('0xc')]));require(_0x5074('0xe'))[_0x5074('0xf')](socket);function respondWithRpcPromise(_0x1555df,_0x27666a,_0x45e87a){return new BPromise(function(_0x45ed45,_0x5cc47b){return client[_0x5074('0x10')](_0x1555df,_0x45e87a)[_0x5074('0x11')](function(_0x1c03be){logger[_0x5074('0x12')](_0x5074('0x13'),_0x27666a,'request\x20sent');logger['debug'](_0x5074('0x14'),_0x27666a,_0x5074('0x15'),JSON[_0x5074('0x16')](_0x1c03be));if(_0x1c03be[_0x5074('0x17')]){if(_0x1c03be[_0x5074('0x17')][_0x5074('0x18')]===0x1f4){logger[_0x5074('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x27666a,_0x1c03be[_0x5074('0x17')][_0x5074('0x19')]);return _0x5cc47b(_0x1c03be['error'][_0x5074('0x19')]);}logger[_0x5074('0x17')](_0x5074('0x13'),_0x27666a,_0x1c03be[_0x5074('0x17')][_0x5074('0x19')]);return _0x45ed45(_0x1c03be[_0x5074('0x17')][_0x5074('0x19')]);}else{logger[_0x5074('0x12')](_0x5074('0x13'),_0x27666a,'request\x20sent');_0x45ed45(_0x1c03be[_0x5074('0x1a')]['message']);}})[_0x5074('0x1b')](function(_0x50617f){logger[_0x5074('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x27666a,_0x50617f);_0x5cc47b(_0x50617f);});});}exports['UpdateChatInteraction']=function(_0x22a9e5){var _0x3c57a2=this;return new Promise(function(_0x8976ae,_0x462069){return db[_0x5074('0x1c')][_0x5074('0x1d')](_0x22a9e5[_0x5074('0x1e')],{'raw':_0x22a9e5[_0x5074('0x1f')]?_0x22a9e5[_0x5074('0x1f')][_0x5074('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a9e5[_0x5074('0x1f')]?_0x22a9e5[_0x5074('0x1f')]['where']||null:null,'attributes':_0x22a9e5[_0x5074('0x1f')]?_0x22a9e5['options'][_0x5074('0x21')]||null:null,'limit':_0x22a9e5['options']?_0x22a9e5['options'][_0x5074('0x22')]||null:null})[_0x5074('0x11')](function(_0x1c51c8){logger[_0x5074('0x12')](_0x5074('0x23'),_0x22a9e5);logger[_0x5074('0x24')](_0x5074('0x23'),_0x22a9e5,JSON[_0x5074('0x16')](_0x1c51c8));_0x8976ae(_0x1c51c8);})[_0x5074('0x1b')](function(_0x4267b5){logger[_0x5074('0x17')]('UpdateChatInteraction',_0x4267b5['message'],_0x22a9e5);_0x462069(_0x3c57a2[_0x5074('0x17')](0x1f4,_0x4267b5[_0x5074('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x55e470){return new Promise(function(_0x1ad5e8,_0xac7548){return db[_0x5074('0x1c')][_0x5074('0x25')]({'where':_0x55e470[_0x5074('0x1f')]?_0x55e470['options'][_0x5074('0x26')]||null:null})[_0x5074('0x11')](function(_0x5a4fde){if(_0x5a4fde){return _0x5a4fde[_0x5074('0x27')](_0x55e470[_0x5074('0x1e')][_0x5074('0x28')],_[_0x5074('0x29')](_0x55e470[_0x5074('0x1e')],[_0x5074('0x28'),'id'])||{});}})['spread'](function(_0xfda978){logger[_0x5074('0x12')](_0x5074('0x2a'),_0x55e470);logger[_0x5074('0x24')](_0x5074('0x2a'),_0x55e470,JSON[_0x5074('0x16')](_0xfda978));_0x1ad5e8(_0xfda978);})[_0x5074('0x1b')](function(_0x91c06f){logger[_0x5074('0x17')](_0x5074('0x2a'),_0x91c06f[_0x5074('0x19')],_0x55e470);_0xac7548(_this[_0x5074('0x17')](0x1f4,_0x91c06f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c128409..da7effe 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 _0x8367=['./chatInteraction.events','save','remove','emit','register','chatInteraction:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8367,0xa2));var _0x7836=function(_0x3b0e76,_0x239221){_0x3b0e76=_0x3b0e76-0x0;var _0x1e4af4=_0x8367[_0x3b0e76];return _0x1e4af4;};'use strict';var ChatInteractionEvents=require(_0x7836('0x0'));var events=[_0x7836('0x1'),_0x7836('0x2'),'update'];function createListener(_0xac80f2,_0x2c811f){return function(_0x543252){_0x2c811f[_0x7836('0x3')](_0xac80f2,_0x543252);};}function removeListener(_0x101eb7,_0x5dffbb){return function(){ChatInteractionEvents['removeListener'](_0x101eb7,_0x5dffbb);};}exports[_0x7836('0x4')]=function(_0x12246d){for(var _0x4132be=0x0,_0x10685b=events['length'];_0x4132be<_0x10685b;_0x4132be++){var _0x36cf2d=events[_0x4132be];var _0x1ba296=createListener(_0x7836('0x5')+_0x36cf2d,_0x12246d);ChatInteractionEvents['on'](_0x36cf2d,_0x1ba296);}}; \ No newline at end of file +var _0xe84f=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','register'];(function(_0x46fae8,_0x4f06cf){var _0xe8c45d=function(_0x4e82c2){while(--_0x4e82c2){_0x46fae8['push'](_0x46fae8['shift']());}};_0xe8c45d(++_0x4f06cf);}(_0xe84f,0x190));var _0xfe84=function(_0x2d04b1,_0x3127f2){_0x2d04b1=_0x2d04b1-0x0;var _0xd7df28=_0xe84f[_0x2d04b1];return _0xd7df28;};'use strict';var ChatInteractionEvents=require(_0xfe84('0x0'));var events=[_0xfe84('0x1'),_0xfe84('0x2'),_0xfe84('0x3')];function createListener(_0x224953,_0x16af3f){return function(_0x142512){_0x16af3f[_0xfe84('0x4')](_0x224953,_0x142512);};}function removeListener(_0x312906,_0x331f24){return function(){ChatInteractionEvents['removeListener'](_0x312906,_0x331f24);};}exports[_0xfe84('0x5')]=function(_0x310230){for(var _0x55febf=0x0,_0x4000a0=events['length'];_0x55febf<_0x4000a0;_0x55febf++){var _0x39ae6d=events[_0x55febf];var _0x471e9b=createListener(_0xfe84('0x6')+_0x39ae6d,_0x310230);ChatInteractionEvents['on'](_0x39ae6d,_0x471e9b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 300e93a..514a268 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 _0xc003=['../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','now','/:id/attachment_upload','single','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','chatinteraction:update','update','/:id/custom_update','customUpdate','put','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5ca82d,_0x7d11a0){var _0x397661=function(_0x4ce955){while(--_0x4ce955){_0x5ca82d['push'](_0x5ca82d['shift']());}};_0x397661(++_0x7d11a0);}(_0xc003,0xc5));var _0x3c00=function(_0x30ff44,_0x143800){_0x30ff44=_0x30ff44-0x0;var _0x126c3c=_0xc003[_0x30ff44];return _0x126c3c;};'use strict';var multer=require(_0x3c00('0x0'));var util=require(_0x3c00('0x1'));var path=require(_0x3c00('0x2'));var timeout=require(_0x3c00('0x3'));var express=require(_0x3c00('0x4'));var router=express[_0x3c00('0x5')]();var fs_extra=require(_0x3c00('0x6'));var auth=require(_0x3c00('0x7'));var interaction=require(_0x3c00('0x8'));var config=require('../../config/environment');var controller=require(_0x3c00('0x9'));router['get']('/',auth[_0x3c00('0xa')](),controller[_0x3c00('0xb')]);router[_0x3c00('0xc')]('/describe',auth[_0x3c00('0xa')](),controller['describe']);router[_0x3c00('0xc')](_0x3c00('0xd'),auth[_0x3c00('0xe')](),controller[_0x3c00('0xf')]);router[_0x3c00('0xc')](_0x3c00('0x10'),auth[_0x3c00('0xe')](),controller[_0x3c00('0x11')]);router['get'](_0x3c00('0x12'),auth[_0x3c00('0xa')](),controller[_0x3c00('0x13')]);router[_0x3c00('0xc')]('/:id/my_messages',auth[_0x3c00('0xe')](),controller['getMyMessages']);router[_0x3c00('0xc')](_0x3c00('0x14'),auth[_0x3c00('0xa')](),controller[_0x3c00('0x15')]);router[_0x3c00('0x16')]('/',auth[_0x3c00('0xa')](),controller[_0x3c00('0x17')]);router[_0x3c00('0x16')](_0x3c00('0x18'),auth[_0x3c00('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x3c00('0x19')]({'destination':function(_0xa758a9,_0xadcd86,_0x4f05d7){_0x4f05d7(null,path[_0x3c00('0x1a')](config[_0x3c00('0x1b')],_0x3c00('0x1c')));},'filename':function(_0x1d2af8,_0x3a3183,_0x43ccb7){_0x43ccb7(null,util[_0x3c00('0x1d')]('%s-%s',Date[_0x3c00('0x1e')](),_0x3a3183['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3c00('0x16')](_0x3c00('0x1f'),upload[_0x3c00('0x20')]('file'),controller['attachmentUpload']);router[_0x3c00('0x16')](_0x3c00('0x12'),auth[_0x3c00('0xe')](),controller[_0x3c00('0x21')]);router[_0x3c00('0x16')](_0x3c00('0x22'),auth[_0x3c00('0xa')](),interaction[_0x3c00('0x23')](_0x3c00('0x24'),_0x3c00('0x25')),controller['addTags']);router['put'](_0x3c00('0xd'),auth[_0x3c00('0xa')](),interaction['tracked'](_0x3c00('0x24'),_0x3c00('0x26')),controller[_0x3c00('0x27')]);router['put'](_0x3c00('0x28'),controller[_0x3c00('0x29')]);router[_0x3c00('0x2a')](_0x3c00('0x2b'),auth[_0x3c00('0xe')](),controller['abandon']);router[_0x3c00('0x2a')](_0x3c00('0x2c'),controller[_0x3c00('0x2d')]);router[_0x3c00('0x2e')](_0x3c00('0xd'),auth[_0x3c00('0xa')](),interaction[_0x3c00('0x23')]('chat',_0x3c00('0x2f')),controller[_0x3c00('0x30')]);router[_0x3c00('0x2e')]('/:id/tags',auth[_0x3c00('0xa')](),controller[_0x3c00('0x31')]);module[_0x3c00('0x32')]=router; \ No newline at end of file +var _0x2d92=['/:id','chatinteraction:update','update','/:id/abandon','close','delete','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put'];(function(_0x3dc360,_0x300711){var _0x78df64=function(_0xd9e0d4){while(--_0xd9e0d4){_0x3dc360['push'](_0x3dc360['shift']());}};_0x78df64(++_0x300711);}(_0x2d92,0x9c));var _0x22d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d92[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x22d9('0x0'));var util=require(_0x22d9('0x1'));var path=require(_0x22d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x22d9('0x3'));var router=express[_0x22d9('0x4')]();var fs_extra=require(_0x22d9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x22d9('0x6'));var controller=require(_0x22d9('0x7'));router[_0x22d9('0x8')]('/',auth[_0x22d9('0x9')](),controller[_0x22d9('0xa')]);router[_0x22d9('0x8')](_0x22d9('0xb'),auth[_0x22d9('0x9')](),controller['describe']);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router['get']('/:id/attachment_download',auth[_0x22d9('0xc')](),controller[_0x22d9('0xd')]);router[_0x22d9('0x8')](_0x22d9('0xe'),auth[_0x22d9('0x9')](),controller[_0x22d9('0xf')]);router[_0x22d9('0x8')]('/:id/my_messages',auth[_0x22d9('0xc')](),controller[_0x22d9('0x10')]);router[_0x22d9('0x8')](_0x22d9('0x11'),auth['isAuthenticated'](),controller[_0x22d9('0x12')]);router[_0x22d9('0x13')]('/',auth[_0x22d9('0x9')](),controller[_0x22d9('0x14')]);router['post']('/:id/vidaoo',auth[_0x22d9('0x9')](),controller[_0x22d9('0x15')]);var upload=multer({'storage':multer[_0x22d9('0x16')]({'destination':function(_0x297c32,_0x194f98,_0x1e7557){_0x1e7557(null,path['join'](config[_0x22d9('0x17')],'server/files/attachments/'));},'filename':function(_0x56b2f2,_0xf55a2b,_0x133c77){_0x133c77(null,util[_0x22d9('0x18')](_0x22d9('0x19'),Date[_0x22d9('0x1a')](),_0xf55a2b[_0x22d9('0x1b')][_0x22d9('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x22d9('0x1d'),upload[_0x22d9('0x1e')](_0x22d9('0x1f')),controller[_0x22d9('0x20')]);router[_0x22d9('0x13')]('/:id/messages',auth[_0x22d9('0xc')](),controller[_0x22d9('0x21')]);router['post'](_0x22d9('0x22'),auth['isAuthenticated'](),interaction[_0x22d9('0x23')](_0x22d9('0x24'),_0x22d9('0x25')),controller[_0x22d9('0x26')]);router[_0x22d9('0x27')](_0x22d9('0x28'),auth[_0x22d9('0x9')](),interaction[_0x22d9('0x23')](_0x22d9('0x24'),_0x22d9('0x29')),controller[_0x22d9('0x2a')]);router[_0x22d9('0x27')]('/:id/custom_update',controller['customUpdate']);router[_0x22d9('0x27')](_0x22d9('0x2b'),auth['isChatInteractionAuthorized'](),controller['abandon']);router['put']('/:id/close',controller[_0x22d9('0x2c')]);router[_0x22d9('0x2d')]('/:id',auth[_0x22d9('0x9')](),interaction[_0x22d9('0x23')](_0x22d9('0x24'),'chatinteraction:destroy'),controller[_0x22d9('0x2e')]);router['delete'](_0x22d9('0x22'),auth[_0x22d9('0x9')](),controller[_0x22d9('0x2f')]);module[_0x22d9('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index cc53042..d1d4ff4 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 _0xd68d=['INTEGER','sequelize','TEXT','medium'];(function(_0x139dee,_0x598861){var _0x194876=function(_0x119e13){while(--_0x119e13){_0x139dee['push'](_0x139dee['shift']());}};_0x194876(++_0x598861);}(_0xd68d,0x1ed));var _0xdd68=function(_0x2e5201,_0x16ca50){_0x2e5201=_0x2e5201-0x0;var _0x375733=_0xd68d[_0x2e5201];return _0x375733;};'use strict';var Sequelize=require(_0xdd68('0x0'));module['exports']={'body':{'type':Sequelize[_0xdd68('0x1')](_0xdd68('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdd68('0x3')]}}; \ No newline at end of file +var _0xe26d=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x2471ca,_0xfbc1cd){var _0x561a14=function(_0x1e5438){while(--_0x1e5438){_0x2471ca['push'](_0x2471ca['shift']());}};_0x561a14(++_0xfbc1cd);}(_0xe26d,0x123));var _0xde26=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe26d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xde26('0x0'));module[_0xde26('0x1')]={'body':{'type':Sequelize[_0xde26('0x2')](_0xde26('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xde26('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ffb1200..c85359e 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 _0x103d=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','length','push','FromId','ToId','-createdAt','all','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0xf6aaa,_0x3d7d4b){var _0x1dc0ce=function(_0x539f46){while(--_0x539f46){_0xf6aaa['push'](_0xf6aaa['shift']());}};_0x1dc0ce(++_0x3d7d4b);}(_0x103d,0xc7));var _0xd103=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x103d[_0x5834bc];return _0x3e183a;};'use strict';var emlformat=require(_0xd103('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd103('0x1'));var rp=require(_0xd103('0x2'));var moment=require('moment');var BPromise=require(_0xd103('0x3'));var Mustache=require(_0xd103('0x4'));var util=require(_0xd103('0x5'));var path=require(_0xd103('0x6'));var sox=require('sox');var csv=require(_0xd103('0x7'));var ejs=require(_0xd103('0x8'));var fs=require('fs');var fs_extra=require(_0xd103('0x9'));var _=require('lodash');var squel=require(_0xd103('0xa'));var crypto=require(_0xd103('0xb'));var jsforce=require(_0xd103('0xc'));var deskjs=require(_0xd103('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd103('0xe'));var Papa=require(_0xd103('0xf'));var Redis=require(_0xd103('0x10'));var authService=require(_0xd103('0x11'));var qs=require(_0xd103('0x12'));var as=require(_0xd103('0x13'));var hardwareService=require(_0xd103('0x14'));var logger=require(_0xd103('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd103('0x16'));var licenseUtil=require(_0xd103('0x17'));var db=require(_0xd103('0x18'))['db'];config[_0xd103('0x19')]=_[_0xd103('0x1a')](config['redis'],{'host':_0xd103('0x1b'),'port':0x18eb});var socket=require(_0xd103('0x1c'))(new Redis(config[_0xd103('0x19')]));require(_0xd103('0x1d'))[_0xd103('0x1e')](socket);function respondWithStatusCode(_0x441c1a,_0x43a79c){_0x43a79c=_0x43a79c||0xcc;return function(_0x3883de){if(_0x3883de){return _0x441c1a[_0xd103('0x1f')](_0x43a79c);}return _0x441c1a['status'](_0x43a79c)[_0xd103('0x20')]();};}function respondWithResult(_0x21b82c,_0x339300){_0x339300=_0x339300||0xc8;return function(_0x16e493){if(_0x16e493){return _0x21b82c[_0xd103('0x21')](_0x339300)[_0xd103('0x22')](_0x16e493);}};}function respondWithFilteredResult(_0x58a394,_0x3a82c7){return function(_0x52ff95){if(_0x52ff95){var _0x52e4e4=typeof _0x3a82c7['offset']===_0xd103('0x23')&&typeof _0x3a82c7[_0xd103('0x24')]===_0xd103('0x23');var _0x26a50b=_0x52ff95[_0xd103('0x25')];var _0x3cfb64=_0x52e4e4?0x0:_0x3a82c7[_0xd103('0x26')];var _0x54dec3=_0x52e4e4?_0x52ff95[_0xd103('0x25')]:_0x3a82c7[_0xd103('0x26')]+_0x3a82c7[_0xd103('0x24')];var _0x19df9d;if(_0x54dec3>=_0x26a50b){_0x54dec3=_0x26a50b;_0x19df9d=0xc8;}else{_0x19df9d=0xce;}_0x58a394[_0xd103('0x21')](_0x19df9d);return _0x58a394[_0xd103('0x27')]('Content-Range',_0x3cfb64+'-'+_0x54dec3+'/'+_0x26a50b)['json'](_0x52ff95);}return null;};}function patchUpdates(_0x18f599){return function(_0x1ae50e){try{jsonpatch[_0xd103('0x28')](_0x1ae50e,_0x18f599,!![]);}catch(_0x532eaa){return BPromise[_0xd103('0x29')](_0x532eaa);}return _0x1ae50e[_0xd103('0x2a')]();};}function saveUpdates(_0x15ffda,_0xf55d2d){return function(_0x1c91ba){if(_0x1c91ba){return _0x1c91ba[_0xd103('0x2b')](_0x15ffda)[_0xd103('0x2c')](function(_0xc0cc2c){return _0xc0cc2c;});}return null;};}function removeEntity(_0x353c4b,_0x50a2aa){return function(_0x510d4b){if(_0x510d4b){return _0x510d4b[_0xd103('0x2d')]()['then'](function(){_0x353c4b[_0xd103('0x21')](0xcc)[_0xd103('0x20')]();});}};}function handleEntityNotFound(_0x2b0d73,_0x50d85b){return function(_0x468634){if(!_0x468634){_0x2b0d73[_0xd103('0x1f')](0x194);}return _0x468634;};}function handleError(_0x26cfbf,_0x5db012){_0x5db012=_0x5db012||0x1f4;return function(_0x4dad5f){logger[_0xd103('0x2e')](_0x4dad5f[_0xd103('0x2f')]);if(_0x4dad5f[_0xd103('0x30')]){delete _0x4dad5f['name'];}_0x26cfbf[_0xd103('0x21')](_0x5db012)['send'](_0x4dad5f);};}exports[_0xd103('0x31')]=function(_0x2a3e77,_0x3b7c62){var _0x3c2789={},_0xc2ad2f={},_0x49deec={'count':0x0,'rows':[]};var _0x226e54=_[_0xd103('0x32')](db[_0xd103('0x33')][_0xd103('0x34')],function(_0x7cf73){return{'name':_0x7cf73['fieldName'],'type':_0x7cf73[_0xd103('0x35')][_0xd103('0x36')]};});_0xc2ad2f[_0xd103('0x37')]=_[_0xd103('0x32')](_0x226e54,'name');_0xc2ad2f[_0xd103('0x38')]=_[_0xd103('0x39')](_0x2a3e77[_0xd103('0x38')]);_0xc2ad2f['filters']=_[_0xd103('0x3a')](_0xc2ad2f[_0xd103('0x37')],_0xc2ad2f['query']);_0x3c2789['attributes']=_[_0xd103('0x3a')](_0xc2ad2f[_0xd103('0x37')],qs[_0xd103('0x3b')](_0x2a3e77[_0xd103('0x38')]['fields']));_0x3c2789['attributes']=_0x3c2789[_0xd103('0x3c')]['length']?_0x3c2789[_0xd103('0x3c')]:_0xc2ad2f[_0xd103('0x37')];if(!_0x2a3e77[_0xd103('0x38')][_0xd103('0x3d')]('nolimit')){_0x3c2789['limit']=qs['limit'](_0x2a3e77[_0xd103('0x38')]['limit']);_0x3c2789['offset']=qs[_0xd103('0x26')](_0x2a3e77[_0xd103('0x38')][_0xd103('0x26')]);}_0x3c2789['order']=qs[_0xd103('0x3e')](_0x2a3e77[_0xd103('0x38')][_0xd103('0x3e')]);_0x3c2789[_0xd103('0x3f')]=qs[_0xd103('0x40')](_['pick'](_0x2a3e77[_0xd103('0x38')],_0xc2ad2f[_0xd103('0x40')]),_0x226e54);if(_0x2a3e77['query'][_0xd103('0x41')]){_0x3c2789[_0xd103('0x3f')]=_[_0xd103('0x42')](_0x3c2789['where'],{'$or':_[_0xd103('0x32')](_0x226e54,function(_0x1e8f98){if(_0x1e8f98[_0xd103('0x35')]!==_0xd103('0x43')){var _0x2e987b={};_0x2e987b[_0x1e8f98['name']]={'$like':'%'+_0x2a3e77[_0xd103('0x38')][_0xd103('0x41')]+'%'};return _0x2e987b;}})});}_0x3c2789=_['merge']({},_0x3c2789,_0x2a3e77[_0xd103('0x44')]);var _0x521824={'where':_0x3c2789[_0xd103('0x3f')]};return db[_0xd103('0x33')][_0xd103('0x25')](_0x521824)[_0xd103('0x2c')](function(_0x5d6ae5){_0x49deec[_0xd103('0x25')]=_0x5d6ae5;if(_0x2a3e77[_0xd103('0x38')]['includeAll']){_0x3c2789[_0xd103('0x45')]=[{'all':!![]}];}return db[_0xd103('0x33')][_0xd103('0x46')](_0x3c2789);})[_0xd103('0x2c')](function(_0x3a45eb){_0x49deec[_0xd103('0x47')]=_0x3a45eb;return _0x49deec;})[_0xd103('0x2c')](respondWithFilteredResult(_0x3b7c62,_0x3c2789))['catch'](handleError(_0x3b7c62,null));};exports['show']=function(_0x39a7d7,_0x1d17fd){var _0x5880b9={'raw':!![],'where':{'id':_0x39a7d7[_0xd103('0x48')]['id']}},_0xe34faa={};_0xe34faa['model']=_[_0xd103('0x39')](db[_0xd103('0x33')][_0xd103('0x34')]);_0xe34faa[_0xd103('0x38')]=_[_0xd103('0x39')](_0x39a7d7[_0xd103('0x38')]);_0xe34faa[_0xd103('0x40')]=_[_0xd103('0x3a')](_0xe34faa[_0xd103('0x37')],_0xe34faa[_0xd103('0x38')]);_0x5880b9['attributes']=_[_0xd103('0x3a')](_0xe34faa['model'],qs[_0xd103('0x3b')](_0x39a7d7[_0xd103('0x38')][_0xd103('0x3b')]));_0x5880b9[_0xd103('0x3c')]=_0x5880b9[_0xd103('0x3c')]['length']?_0x5880b9['attributes']:_0xe34faa[_0xd103('0x37')];if(_0x39a7d7[_0xd103('0x38')][_0xd103('0x49')]){_0x5880b9[_0xd103('0x45')]=[{'all':!![]}];}_0x5880b9=_[_0xd103('0x42')]({},_0x5880b9,_0x39a7d7[_0xd103('0x44')]);return db[_0xd103('0x33')][_0xd103('0x4a')](_0x5880b9)[_0xd103('0x2c')](handleEntityNotFound(_0x1d17fd,null))['then'](respondWithResult(_0x1d17fd,null))[_0xd103('0x4b')](handleError(_0x1d17fd,null));};exports[_0xd103('0x4c')]=function(_0xd1c107,_0x135450){return db['ChatInternalMessage']['create'](_0xd1c107[_0xd103('0x4d')],{})[_0xd103('0x2c')](respondWithResult(_0x135450,0xc9))['catch'](handleError(_0x135450,null));};exports['update']=function(_0x20e6f3,_0x59a5e2){if(_0x20e6f3[_0xd103('0x4d')]['id']){delete _0x20e6f3['body']['id'];}return db['ChatInternalMessage'][_0xd103('0x4a')]({'where':{'id':_0x20e6f3[_0xd103('0x48')]['id']}})[_0xd103('0x2c')](handleEntityNotFound(_0x59a5e2,null))[_0xd103('0x2c')](saveUpdates(_0x20e6f3[_0xd103('0x4d')],null))['then'](respondWithResult(_0x59a5e2,null))[_0xd103('0x4b')](handleError(_0x59a5e2,null));};exports[_0xd103('0x2d')]=function(_0x487a1d,_0x451197){return db[_0xd103('0x33')][_0xd103('0x4a')]({'where':{'id':_0x487a1d[_0xd103('0x48')]['id']}})[_0xd103('0x2c')](handleEntityNotFound(_0x451197,null))[_0xd103('0x2c')](removeEntity(_0x451197,null))['catch'](handleError(_0x451197,null));};exports[_0xd103('0x4e')]=function(_0x1aac7e,_0x501b68){return db[_0xd103('0x33')][_0xd103('0x4e')]()['then'](respondWithResult(_0x501b68,null))[_0xd103('0x4b')](handleError(_0x501b68,null));};function wrapUser(_0x23bf23){return function(_0x3b27ed){var _0x38990c=_0x23bf23[_0xd103('0x4f')]({'plain':!![]});_0x38990c[_0xd103('0x50')]=[];if(_0x3b27ed){_0x38990c[_0xd103('0x51')]=_0x3b27ed[_0xd103('0x52')];_0x38990c[_0xd103('0x53')]=_0x3b27ed;}else{_0x38990c[_0xd103('0x51')]=moment(0x0)[_0xd103('0x54')](_0xd103('0x55'));_0x38990c[_0xd103('0x53')]={};}return _0x38990c;};}exports[_0xd103('0x56')]=function(_0x59b80a,_0x1e71ac,_0x310907){var _0x47d279=[];return db['User'][_0xd103('0x46')]({'where':{'role':['agent',_0xd103('0x57'),_0xd103('0x58')]},'attributes':['id',_0xd103('0x59'),_0xd103('0x30'),_0xd103('0x5a'),_0xd103('0x5b'),_0xd103('0x5c'),_0xd103('0x5d'),_0xd103('0x5e'),_0xd103('0x5f'),_0xd103('0x60')],'order':qs[_0xd103('0x3e')](_0xd103('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0xd103('0x62'),'attributes':['id',_0xd103('0x30'),_0xd103('0x35')],'through':{'attributes':[]}}]})[_0xd103('0x2c')](function(_0x3dbbcb){if(_0x3dbbcb){var _0x36a65e=_0x59b80a[_0xd103('0x58')][_0xd103('0x4f')]({'plain':!![]});if(!_0x36a65e)throw new Error(_0xd103('0x63'));if(_0x36a65e[_0xd103('0x5a')]===_0xd103('0x58')){return db[_0xd103('0x64')][_0xd103('0x4a')]({'where':{'name':_0xd103('0x65'),'userProfileId':_0x36a65e[_0xd103('0x66')]},'raw':!![]})[_0xd103('0x2c')](function(_0x18f182){if(_0x18f182){if(_0x18f182[_0xd103('0x67')]===0x0){return db[_0xd103('0x68')][_0xd103('0x46')]({'where':{'sectionId':_0x18f182['id']},'raw':!![]})['then'](function(_0x2bd9e6){var _0x5ef027=[];if(_[_0xd103('0x69')](_0x2bd9e6)){_0x5ef027=_[_0xd103('0x41')](_0x3dbbcb,function(_0x5300fc){if(_0x5300fc[_0xd103('0x5a')]!==_0xd103('0x6a')){return _0x5300fc;}});return _0x5ef027;}else{for(var _0x539296=0x0;_0x539296<_0x3dbbcb[_0xd103('0x6b')];_0x539296++){var _0x258abc=_0x3dbbcb[_0x539296];if(_0x258abc[_0xd103('0x5a')]==='agent'){var _0xb923ad=_[_0xd103('0x4a')](_0x2bd9e6,function(_0x5be166){return _0x5be166['resourceId']===_0x258abc['id'];});if(_0xb923ad)_0x5ef027['push'](_0x258abc);}else{_0x5ef027[_0xd103('0x6c')](_0x258abc);}}return _0x5ef027;}});}else{return _0x3dbbcb;}}else{var _0xce26c4=_[_0xd103('0x41')](_0x3dbbcb,function(_0x15e968){if(_0x15e968[_0xd103('0x5a')]!==_0xd103('0x6a')){return _0x15e968;}});return _0xce26c4;}});}else{return _0x3dbbcb;}}})[_0xd103('0x2c')](function(_0x1b4d36){var _0x351973=[];if(_0x1b4d36){_0x47d279=_0x1b4d36;for(var _0x40b471=0x0;_0x40b471<_0x1b4d36[_0xd103('0x6b')];_0x40b471+=0x1){_0x47d279[_0x40b471][_0xd103('0x50')]=[];_0x351973[_0xd103('0x6c')](db[_0xd103('0x33')]['find']({'where':{'FromId':[_0x59b80a[_0xd103('0x58')]['id'],_0x1b4d36[_0x40b471]['id']],'ToId':[_0x59b80a['user']['id'],_0x1b4d36[_0x40b471]['id']],'ChatGroupId':null},'attributes':['id',_0xd103('0x52'),_0xd103('0x6d'),_0xd103('0x6e'),'read','body'],'order':qs[_0xd103('0x3e')](_0xd103('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd103('0x2c')](wrapUser(_0x1b4d36[_0x40b471])));}return BPromise[_0xd103('0x70')](_0x351973);}return[];})['then'](function(_0x1298ea){return{'rows':_0x1298ea,'count':_0x1298ea[_0xd103('0x6b')]};})[_0xd103('0x2c')](respondWithResult(_0x1e71ac,null))[_0xd103('0x4b')](handleError(_0x1e71ac,null));}; \ No newline at end of file +var _0x94bc=['autoAssociation','UserProfileResource','resourceId','push','messages','FromId','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./chatInternalMessage.socket','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','get','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','role','userpic','online','lastLoginAt','allowmessenger','VoiceQueue','UserProfileSection','userProfileId'];(function(_0x36ed9f,_0x57262c){var _0x4fedc4=function(_0x4048c7){while(--_0x4048c7){_0x36ed9f['push'](_0x36ed9f['shift']());}};_0x4fedc4(++_0x57262c);}(_0x94bc,0x136));var _0xc94b=function(_0x5de967,_0x515918){_0x5de967=_0x5de967-0x0;var _0x5b07a3=_0x94bc[_0x5de967];return _0x5b07a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc94b('0x0'));var zipdir=require(_0xc94b('0x1'));var jsonpatch=require(_0xc94b('0x2'));var rp=require(_0xc94b('0x3'));var moment=require(_0xc94b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc94b('0x5'));var path=require(_0xc94b('0x6'));var sox=require(_0xc94b('0x7'));var csv=require(_0xc94b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc94b('0x9'));var _=require(_0xc94b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc94b('0xb'));var deskjs=require(_0xc94b('0xc'));var toCsv=require(_0xc94b('0x8'));var querystring=require('querystring');var Papa=require(_0xc94b('0xd'));var Redis=require('ioredis');var authService=require(_0xc94b('0xe'));var qs=require(_0xc94b('0xf'));var as=require(_0xc94b('0x10'));var hardwareService=require(_0xc94b('0x11'));var logger=require(_0xc94b('0x12'))(_0xc94b('0x13'));var utils=require(_0xc94b('0x14'));var config=require(_0xc94b('0x15'));var licenseUtil=require(_0xc94b('0x16'));var db=require('../../mysqldb')['db'];config[_0xc94b('0x17')]=_[_0xc94b('0x18')](config[_0xc94b('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc94b('0x17')]));require(_0xc94b('0x19'))['register'](socket);function respondWithStatusCode(_0x17d5b2,_0xc99dbf){_0xc99dbf=_0xc99dbf||0xcc;return function(_0x2595a9){if(_0x2595a9){return _0x17d5b2['sendStatus'](_0xc99dbf);}return _0x17d5b2['status'](_0xc99dbf)[_0xc94b('0x1a')]();};}function respondWithResult(_0x3e22ba,_0x31e687){_0x31e687=_0x31e687||0xc8;return function(_0x559569){if(_0x559569){return _0x3e22ba['status'](_0x31e687)[_0xc94b('0x1b')](_0x559569);}};}function respondWithFilteredResult(_0x613f2a,_0x49f577){return function(_0x3f1840){if(_0x3f1840){var _0x44a2b2=typeof _0x49f577['offset']===_0xc94b('0x1c')&&typeof _0x49f577[_0xc94b('0x1d')]==='undefined';var _0x2ce57=_0x3f1840[_0xc94b('0x1e')];var _0xa1bafd=_0x44a2b2?0x0:_0x49f577[_0xc94b('0x1f')];var _0x238b84=_0x44a2b2?_0x3f1840[_0xc94b('0x1e')]:_0x49f577[_0xc94b('0x1f')]+_0x49f577[_0xc94b('0x1d')];var _0x4eafd4;if(_0x238b84>=_0x2ce57){_0x238b84=_0x2ce57;_0x4eafd4=0xc8;}else{_0x4eafd4=0xce;}_0x613f2a[_0xc94b('0x20')](_0x4eafd4);return _0x613f2a[_0xc94b('0x21')]('Content-Range',_0xa1bafd+'-'+_0x238b84+'/'+_0x2ce57)[_0xc94b('0x1b')](_0x3f1840);}return null;};}function patchUpdates(_0x1cd88f){return function(_0x2a21b9){try{jsonpatch[_0xc94b('0x22')](_0x2a21b9,_0x1cd88f,!![]);}catch(_0x44677e){return BPromise[_0xc94b('0x23')](_0x44677e);}return _0x2a21b9[_0xc94b('0x24')]();};}function saveUpdates(_0x1b7e44,_0x2a2ae2){return function(_0xd57223){if(_0xd57223){return _0xd57223[_0xc94b('0x25')](_0x1b7e44)[_0xc94b('0x26')](function(_0x577af5){return _0x577af5;});}return null;};}function removeEntity(_0x523d51,_0x10b5c8){return function(_0x321e20){if(_0x321e20){return _0x321e20['destroy']()['then'](function(){_0x523d51[_0xc94b('0x20')](0xcc)[_0xc94b('0x1a')]();});}};}function handleEntityNotFound(_0x15f051,_0xb57979){return function(_0x52ad32){if(!_0x52ad32){_0x15f051[_0xc94b('0x27')](0x194);}return _0x52ad32;};}function handleError(_0x30f068,_0x87f3b6){_0x87f3b6=_0x87f3b6||0x1f4;return function(_0x2e1e6a){logger['error'](_0x2e1e6a[_0xc94b('0x28')]);if(_0x2e1e6a[_0xc94b('0x29')]){delete _0x2e1e6a['name'];}_0x30f068[_0xc94b('0x20')](_0x87f3b6)[_0xc94b('0x2a')](_0x2e1e6a);};}exports[_0xc94b('0x2b')]=function(_0x58d300,_0x50c33b){var _0x5278c3={},_0x4098e5={},_0x31c996={'count':0x0,'rows':[]};var _0x448bcf=_[_0xc94b('0x2c')](db[_0xc94b('0x2d')][_0xc94b('0x2e')],function(_0x2583ba){return{'name':_0x2583ba[_0xc94b('0x2f')],'type':_0x2583ba['type']['key']};});_0x4098e5['model']=_[_0xc94b('0x2c')](_0x448bcf,_0xc94b('0x29'));_0x4098e5[_0xc94b('0x30')]=_[_0xc94b('0x31')](_0x58d300['query']);_0x4098e5[_0xc94b('0x32')]=_[_0xc94b('0x33')](_0x4098e5[_0xc94b('0x34')],_0x4098e5[_0xc94b('0x30')]);_0x5278c3['attributes']=_[_0xc94b('0x33')](_0x4098e5[_0xc94b('0x34')],qs[_0xc94b('0x35')](_0x58d300['query'][_0xc94b('0x35')]));_0x5278c3[_0xc94b('0x36')]=_0x5278c3[_0xc94b('0x36')][_0xc94b('0x37')]?_0x5278c3[_0xc94b('0x36')]:_0x4098e5[_0xc94b('0x34')];if(!_0x58d300[_0xc94b('0x30')][_0xc94b('0x38')](_0xc94b('0x39'))){_0x5278c3['limit']=qs[_0xc94b('0x1d')](_0x58d300[_0xc94b('0x30')][_0xc94b('0x1d')]);_0x5278c3[_0xc94b('0x1f')]=qs[_0xc94b('0x1f')](_0x58d300[_0xc94b('0x30')][_0xc94b('0x1f')]);}_0x5278c3[_0xc94b('0x3a')]=qs[_0xc94b('0x3b')](_0x58d300[_0xc94b('0x30')][_0xc94b('0x3b')]);_0x5278c3[_0xc94b('0x3c')]=qs['filters'](_['pick'](_0x58d300[_0xc94b('0x30')],_0x4098e5['filters']),_0x448bcf);if(_0x58d300[_0xc94b('0x30')][_0xc94b('0x3d')]){_0x5278c3[_0xc94b('0x3c')]=_[_0xc94b('0x3e')](_0x5278c3['where'],{'$or':_['map'](_0x448bcf,function(_0x2d0ed5){if(_0x2d0ed5[_0xc94b('0x3f')]!==_0xc94b('0x40')){var _0xae197={};_0xae197[_0x2d0ed5[_0xc94b('0x29')]]={'$like':'%'+_0x58d300[_0xc94b('0x30')][_0xc94b('0x3d')]+'%'};return _0xae197;}})});}_0x5278c3=_['merge']({},_0x5278c3,_0x58d300['options']);var _0x195fae={'where':_0x5278c3[_0xc94b('0x3c')]};return db[_0xc94b('0x2d')][_0xc94b('0x1e')](_0x195fae)[_0xc94b('0x26')](function(_0x5c1b31){_0x31c996['count']=_0x5c1b31;if(_0x58d300['query'][_0xc94b('0x41')]){_0x5278c3[_0xc94b('0x42')]=[{'all':!![]}];}return db[_0xc94b('0x2d')][_0xc94b('0x43')](_0x5278c3);})[_0xc94b('0x26')](function(_0x58fb27){_0x31c996[_0xc94b('0x44')]=_0x58fb27;return _0x31c996;})[_0xc94b('0x26')](respondWithFilteredResult(_0x50c33b,_0x5278c3))[_0xc94b('0x45')](handleError(_0x50c33b,null));};exports[_0xc94b('0x46')]=function(_0x3f0580,_0x1f58d9){var _0x534185={'raw':!![],'where':{'id':_0x3f0580[_0xc94b('0x47')]['id']}},_0x1d58be={};_0x1d58be[_0xc94b('0x34')]=_[_0xc94b('0x31')](db['ChatInternalMessage'][_0xc94b('0x2e')]);_0x1d58be[_0xc94b('0x30')]=_[_0xc94b('0x31')](_0x3f0580[_0xc94b('0x30')]);_0x1d58be[_0xc94b('0x32')]=_[_0xc94b('0x33')](_0x1d58be[_0xc94b('0x34')],_0x1d58be[_0xc94b('0x30')]);_0x534185[_0xc94b('0x36')]=_['intersection'](_0x1d58be[_0xc94b('0x34')],qs[_0xc94b('0x35')](_0x3f0580[_0xc94b('0x30')][_0xc94b('0x35')]));_0x534185[_0xc94b('0x36')]=_0x534185[_0xc94b('0x36')]['length']?_0x534185['attributes']:_0x1d58be[_0xc94b('0x34')];if(_0x3f0580['query']['includeAll']){_0x534185[_0xc94b('0x42')]=[{'all':!![]}];}_0x534185=_[_0xc94b('0x3e')]({},_0x534185,_0x3f0580[_0xc94b('0x48')]);return db['ChatInternalMessage']['find'](_0x534185)['then'](handleEntityNotFound(_0x1f58d9,null))[_0xc94b('0x26')](respondWithResult(_0x1f58d9,null))[_0xc94b('0x45')](handleError(_0x1f58d9,null));};exports[_0xc94b('0x49')]=function(_0x1334d8,_0x41114c){return db[_0xc94b('0x2d')][_0xc94b('0x49')](_0x1334d8[_0xc94b('0x4a')],{})['then'](respondWithResult(_0x41114c,0xc9))[_0xc94b('0x45')](handleError(_0x41114c,null));};exports[_0xc94b('0x25')]=function(_0x297cdb,_0x5a77a0){if(_0x297cdb[_0xc94b('0x4a')]['id']){delete _0x297cdb[_0xc94b('0x4a')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x297cdb[_0xc94b('0x47')]['id']}})[_0xc94b('0x26')](handleEntityNotFound(_0x5a77a0,null))[_0xc94b('0x26')](saveUpdates(_0x297cdb[_0xc94b('0x4a')],null))[_0xc94b('0x26')](respondWithResult(_0x5a77a0,null))[_0xc94b('0x45')](handleError(_0x5a77a0,null));};exports['destroy']=function(_0x16ac1e,_0x47048b){return db[_0xc94b('0x2d')][_0xc94b('0x4b')]({'where':{'id':_0x16ac1e[_0xc94b('0x47')]['id']}})[_0xc94b('0x26')](handleEntityNotFound(_0x47048b,null))['then'](removeEntity(_0x47048b,null))[_0xc94b('0x45')](handleError(_0x47048b,null));};exports[_0xc94b('0x4c')]=function(_0x175da6,_0xe42b37){return db['ChatInternalMessage']['describe']()[_0xc94b('0x26')](respondWithResult(_0xe42b37,null))[_0xc94b('0x45')](handleError(_0xe42b37,null));};function wrapUser(_0x53a411){return function(_0x5c4b76){var _0x15e1d6=_0x53a411[_0xc94b('0x4d')]({'plain':!![]});_0x15e1d6['messages']=[];if(_0x5c4b76){_0x15e1d6[_0xc94b('0x4e')]=_0x5c4b76['createdAt'];_0x15e1d6[_0xc94b('0x4f')]=_0x5c4b76;}else{_0x15e1d6[_0xc94b('0x4e')]=moment(0x0)[_0xc94b('0x50')](_0xc94b('0x51'));_0x15e1d6['lastMessage']={};}return _0x15e1d6;};}exports[_0xc94b('0x52')]=function(_0x3233d8,_0x420388,_0x3704b7){var _0x154921=[];return db['User']['findAll']({'where':{'role':[_0xc94b('0x53'),_0xc94b('0x54'),_0xc94b('0x55')]},'attributes':['id','fullname',_0xc94b('0x29'),_0xc94b('0x56'),_0xc94b('0x57'),'internal',_0xc94b('0x58'),_0xc94b('0x59'),_0xc94b('0x5a'),'showWebBar'],'order':qs[_0xc94b('0x3b')]('-online'),'include':[{'model':db[_0xc94b('0x5b')],'as':'VoiceQueues','attributes':['id',_0xc94b('0x29'),_0xc94b('0x3f')],'through':{'attributes':[]}}]})[_0xc94b('0x26')](function(_0x26f7de){if(_0x26f7de){var _0x326649=_0x3233d8['user'][_0xc94b('0x4d')]({'plain':!![]});if(!_0x326649)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x326649[_0xc94b('0x56')]===_0xc94b('0x55')){return db[_0xc94b('0x5c')][_0xc94b('0x4b')]({'where':{'name':'Agents','userProfileId':_0x326649[_0xc94b('0x5d')]},'raw':!![]})[_0xc94b('0x26')](function(_0x374273){if(_0x374273){if(_0x374273[_0xc94b('0x5e')]===0x0){return db[_0xc94b('0x5f')]['findAll']({'where':{'sectionId':_0x374273['id']},'raw':!![]})[_0xc94b('0x26')](function(_0x38420a){var _0x2f19be=[];if(_['isEmpty'](_0x38420a)){_0x2f19be=_[_0xc94b('0x3d')](_0x26f7de,function(_0x28b942){if(_0x28b942[_0xc94b('0x56')]!=='agent'){return _0x28b942;}});return _0x2f19be;}else{for(var _0x3a692d=0x0;_0x3a692d<_0x26f7de[_0xc94b('0x37')];_0x3a692d++){var _0x50129a=_0x26f7de[_0x3a692d];if(_0x50129a[_0xc94b('0x56')]==='agent'){var _0x5b31fe=_[_0xc94b('0x4b')](_0x38420a,function(_0x1588f1){return _0x1588f1[_0xc94b('0x60')]===_0x50129a['id'];});if(_0x5b31fe)_0x2f19be[_0xc94b('0x61')](_0x50129a);}else{_0x2f19be[_0xc94b('0x61')](_0x50129a);}}return _0x2f19be;}});}else{return _0x26f7de;}}else{var _0x2bf306=_[_0xc94b('0x3d')](_0x26f7de,function(_0x2746e3){if(_0x2746e3[_0xc94b('0x56')]!==_0xc94b('0x53')){return _0x2746e3;}});return _0x2bf306;}});}else{return _0x26f7de;}}})[_0xc94b('0x26')](function(_0x594060){var _0x59ce4e=[];if(_0x594060){_0x154921=_0x594060;for(var _0x4e13f0=0x0;_0x4e13f0<_0x594060['length'];_0x4e13f0+=0x1){_0x154921[_0x4e13f0][_0xc94b('0x62')]=[];_0x59ce4e[_0xc94b('0x61')](db[_0xc94b('0x2d')]['find']({'where':{'FromId':[_0x3233d8[_0xc94b('0x55')]['id'],_0x594060[_0x4e13f0]['id']],'ToId':[_0x3233d8[_0xc94b('0x55')]['id'],_0x594060[_0x4e13f0]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xc94b('0x63'),'ToId','read',_0xc94b('0x4a')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc94b('0x26')](wrapUser(_0x594060[_0x4e13f0])));}return BPromise[_0xc94b('0x64')](_0x59ce4e);}return[];})[_0xc94b('0x26')](function(_0x4fde1f){return{'rows':_0x4fde1f,'count':_0x4fde1f[_0xc94b('0x37')]};})[_0xc94b('0x26')](respondWithResult(_0x420388,null))[_0xc94b('0x45')](handleError(_0x420388,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2cc43b0..942a8ba 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 _0x2793=['remove','emit','exports','ChatInternalMessage'];(function(_0x50aef9,_0x196485){var _0x3d1f16=function(_0x3903dd){while(--_0x3903dd){_0x50aef9['push'](_0x50aef9['shift']());}};_0x3d1f16(++_0x196485);}(_0x2793,0x147));var _0x3279=function(_0x6b25ac,_0xe9fa01){_0x6b25ac=_0x6b25ac-0x0;var _0x4c84e9=_0x2793[_0x6b25ac];return _0x4c84e9;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x3279('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3279('0x1')};function emitEvent(_0x25c864){return function(_0x1cb72b,_0xd5b6da,_0x5d5b3a){ChatInternalMessageEvents[_0x3279('0x2')](_0x25c864+':'+_0x1cb72b['id'],_0x1cb72b);ChatInternalMessageEvents[_0x3279('0x2')](_0x25c864,_0x1cb72b);_0x5d5b3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3279('0x3')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc2ff=['events','../../mysqldb','ChatInternalMessage','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xc2ff,0x195));var _0xfc2f=function(_0x4735a0,_0x3c892b){_0x4735a0=_0x4735a0-0x0;var _0x27b931=_0xc2ff[_0x4735a0];return _0x27b931;};'use strict';var EventEmitter=require(_0xfc2f('0x0'));var ChatInternalMessage=require(_0xfc2f('0x1'))['db'][_0xfc2f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc2f('0x3'),'afterUpdate':_0xfc2f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37e9db){return function(_0x42a6c4,_0x17063e,_0x3719fa){ChatInternalMessageEvents[_0xfc2f('0x5')](_0x37e9db+':'+_0x42a6c4['id'],_0x42a6c4);ChatInternalMessageEvents[_0xfc2f('0x5')](_0x37e9db,_0x42a6c4);_0x3719fa(null);};}for(var e in events){if(events[_0xfc2f('0x6')](e)){var event=events[e];ChatInternalMessage[_0xfc2f('0x7')](e,emitEvent(event));}}module[_0xfc2f('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3d099a4..206807b 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 _0x0b8c=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x0b8c,0x13d));var _0xc0b8=function(_0x160662,_0x458682){_0x160662=_0x160662-0x0;var _0x4bd9cd=_0x0b8c[_0x160662];return _0x4bd9cd;};'use strict';var _=require(_0xc0b8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0b8('0x1'));var moment=require('moment');var BPromise=require(_0xc0b8('0x2'));var rp=require(_0xc0b8('0x3'));var fs=require('fs');var path=require(_0xc0b8('0x4'));var rimraf=require(_0xc0b8('0x5'));var config=require(_0xc0b8('0x6'));var attributes=require(_0xc0b8('0x7'));module[_0xc0b8('0x8')]=function(_0x42fd81,_0xc8e11a){return _0x42fd81[_0xc0b8('0x9')](_0xc0b8('0xa'),attributes,{'tableName':_0xc0b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc0b8('0xc'),'collate':_0xc0b8('0xd')});}; \ No newline at end of file +var _0xc64a=['utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x4653f2,_0x21dbcd){var _0x404e19=function(_0x5b7899){while(--_0x5b7899){_0x4653f2['push'](_0x4653f2['shift']());}};_0x404e19(++_0x21dbcd);}(_0xc64a,0x1ae));var _0xac64=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc64a[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xac64('0x0'));var util=require(_0xac64('0x1'));var logger=require('../../config/logger')(_0xac64('0x2'));var moment=require('moment');var BPromise=require(_0xac64('0x3'));var rp=require(_0xac64('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac64('0x5'));var attributes=require(_0xac64('0x6'));module[_0xac64('0x7')]=function(_0x1a4aa3,_0x3255e1){return _0x1a4aa3[_0xac64('0x8')](_0xac64('0x9'),attributes,{'tableName':_0xac64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac64('0xb'),'collate':_0xac64('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 983b3b0..b8945fd 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 _0xb328=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xb328,0xcc));var _0x8b32=function(_0x3dfbab,_0x3c72ab){_0x3dfbab=_0x3dfbab-0x0;var _0x5e5f9e=_0xb328[_0x3dfbab];return _0x5e5f9e;};'use strict';var _=require(_0x8b32('0x0'));var util=require(_0x8b32('0x1'));var moment=require(_0x8b32('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8b32('0x4'));var logger=require(_0x8b32('0x5'))('rpc');var config=require(_0x8b32('0x6'));var jayson=require(_0x8b32('0x7'));var client=jayson[_0x8b32('0x8')][_0x8b32('0x9')]({'port':0x232a});config[_0x8b32('0xa')]=_[_0x8b32('0xb')](config[_0x8b32('0xa')],{'host':_0x8b32('0xc'),'port':0x18eb});var socket=require(_0x8b32('0xd'))(new Redis(config['redis']));require(_0x8b32('0xe'))[_0x8b32('0xf')](socket);function respondWithRpcPromise(_0xe0b9ac,_0x4626ea,_0x3f8b02){return new BPromise(function(_0x2e15bc,_0x369685){return client[_0x8b32('0x10')](_0xe0b9ac,_0x3f8b02)[_0x8b32('0x11')](function(_0x6ee6f1){logger[_0x8b32('0x12')](_0x8b32('0x13'),_0x4626ea,_0x8b32('0x14'));logger[_0x8b32('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4626ea,_0x8b32('0x14'),JSON[_0x8b32('0x16')](_0x6ee6f1));if(_0x6ee6f1[_0x8b32('0x17')]){if(_0x6ee6f1['error'][_0x8b32('0x18')]===0x1f4){logger[_0x8b32('0x17')](_0x8b32('0x13'),_0x4626ea,_0x6ee6f1['error']['message']);return _0x369685(_0x6ee6f1[_0x8b32('0x17')][_0x8b32('0x19')]);}logger['error'](_0x8b32('0x13'),_0x4626ea,_0x6ee6f1[_0x8b32('0x17')][_0x8b32('0x19')]);return _0x2e15bc(_0x6ee6f1['error'][_0x8b32('0x19')]);}else{logger[_0x8b32('0x12')](_0x8b32('0x13'),_0x4626ea,_0x8b32('0x14'));_0x2e15bc(_0x6ee6f1[_0x8b32('0x1a')][_0x8b32('0x19')]);}})[_0x8b32('0x1b')](function(_0x21fba0){logger[_0x8b32('0x17')](_0x8b32('0x13'),_0x4626ea,_0x21fba0);_0x369685(_0x21fba0);});});} \ No newline at end of file +var _0x1500=['message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x10cd30,_0x4b81ff){var _0x3ddb1f=function(_0x31ed6e){while(--_0x31ed6e){_0x10cd30['push'](_0x10cd30['shift']());}};_0x3ddb1f(++_0x4b81ff);}(_0x1500,0x191));var _0x0150=function(_0x4ece98,_0x1e27fe){_0x4ece98=_0x4ece98-0x0;var _0x3ea267=_0x1500[_0x4ece98];return _0x3ea267;};'use strict';var _=require('lodash');var util=require(_0x0150('0x0'));var moment=require(_0x0150('0x1'));var BPromise=require('bluebird');var rs=require(_0x0150('0x2'));var fs=require('fs');var Redis=require(_0x0150('0x3'));var db=require(_0x0150('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0150('0x5'))('rpc');var config=require(_0x0150('0x6'));var jayson=require(_0x0150('0x7'));var client=jayson[_0x0150('0x8')][_0x0150('0x9')]({'port':0x232a});config[_0x0150('0xa')]=_[_0x0150('0xb')](config[_0x0150('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0150('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a7c48,_0x19eccc,_0x3b7892){return new BPromise(function(_0x480898,_0x5bc7ed){return client['request'](_0x2a7c48,_0x3b7892)[_0x0150('0xd')](function(_0x3a2c1a){logger[_0x0150('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x19eccc,_0x0150('0xf'));logger['debug'](_0x0150('0x10'),_0x19eccc,_0x0150('0xf'),JSON['stringify'](_0x3a2c1a));if(_0x3a2c1a[_0x0150('0x11')]){if(_0x3a2c1a['error']['code']===0x1f4){logger[_0x0150('0x11')](_0x0150('0x12'),_0x19eccc,_0x3a2c1a['error'][_0x0150('0x13')]);return _0x5bc7ed(_0x3a2c1a[_0x0150('0x11')][_0x0150('0x13')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x19eccc,_0x3a2c1a[_0x0150('0x11')][_0x0150('0x13')]);return _0x480898(_0x3a2c1a['error']['message']);}else{logger[_0x0150('0xe')](_0x0150('0x12'),_0x19eccc,_0x0150('0xf'));_0x480898(_0x3a2c1a['result'][_0x0150('0x13')]);}})[_0x0150('0x14')](function(_0x3d3d68){logger[_0x0150('0x11')](_0x0150('0x12'),_0x19eccc,_0x3d3d68);_0x5bc7ed(_0x3d3d68);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4ff625f..587deb9 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 _0x0cde=['register','length','./chatInternalMessage.events','save','remove','update','removeListener'];(function(_0x5de6c3,_0xed0683){var _0x56aef2=function(_0x369c6f){while(--_0x369c6f){_0x5de6c3['push'](_0x5de6c3['shift']());}};_0x56aef2(++_0xed0683);}(_0x0cde,0x160));var _0xe0cd=function(_0x4a69d2,_0x2a5b1c){_0x4a69d2=_0x4a69d2-0x0;var _0x1e526a=_0x0cde[_0x4a69d2];return _0x1e526a;};'use strict';var ChatInternalMessageEvents=require(_0xe0cd('0x0'));var events=[_0xe0cd('0x1'),_0xe0cd('0x2'),_0xe0cd('0x3')];function createListener(_0x62c92a,_0x3d75bb){return function(_0x5dddbc){_0x3d75bb['emit'](_0x62c92a,_0x5dddbc);};}function removeListener(_0x3a7956,_0x47f17c){return function(){ChatInternalMessageEvents[_0xe0cd('0x4')](_0x3a7956,_0x47f17c);};}exports[_0xe0cd('0x5')]=function(_0x2a2772){for(var _0x1cb633=0x0,_0x466f08=events[_0xe0cd('0x6')];_0x1cb633<_0x466f08;_0x1cb633++){var _0x114237=events[_0x1cb633];var _0x740481=createListener('chatInternalMessage:'+_0x114237,_0x2a2772);ChatInternalMessageEvents['on'](_0x114237,_0x740481);}}; \ No newline at end of file +var _0x0beb=['update','emit','removeListener','length','save','remove'];(function(_0x20fcb9,_0x9378f9){var _0x310541=function(_0x2cc9fa){while(--_0x2cc9fa){_0x20fcb9['push'](_0x20fcb9['shift']());}};_0x310541(++_0x9378f9);}(_0x0beb,0x64));var _0xb0be=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0beb[_0x8c43de];return _0xa6591b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xb0be('0x0'),_0xb0be('0x1'),_0xb0be('0x2')];function createListener(_0x4a5ea7,_0x249d8b){return function(_0x42e4ea){_0x249d8b[_0xb0be('0x3')](_0x4a5ea7,_0x42e4ea);};}function removeListener(_0x4d7d86,_0x9445bb){return function(){ChatInternalMessageEvents[_0xb0be('0x4')](_0x4d7d86,_0x9445bb);};}exports['register']=function(_0xb34aaf){for(var _0x2283dc=0x0,_0x38047b=events[_0xb0be('0x5')];_0x2283dc<_0x38047b;_0x2283dc++){var _0x3ef08e=events[_0x2283dc];var _0x45ac6c=createListener('chatInternalMessage:'+_0x3ef08e,_0xb34aaf);ChatInternalMessageEvents['on'](_0x3ef08e,_0x45ac6c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5554343..7b7a188 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 _0x7b6e=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','put'];(function(_0x1df3c2,_0x1d6965){var _0x14c889=function(_0x3219f0){while(--_0x3219f0){_0x1df3c2['push'](_0x1df3c2['shift']());}};_0x14c889(++_0x1d6965);}(_0x7b6e,0x15d));var _0xe7b6=function(_0x17e3c4,_0x821010){_0x17e3c4=_0x17e3c4-0x0;var _0x2211b9=_0x7b6e[_0x17e3c4];return _0x2211b9;};'use strict';var multer=require(_0xe7b6('0x0'));var util=require(_0xe7b6('0x1'));var path=require(_0xe7b6('0x2'));var timeout=require(_0xe7b6('0x3'));var express=require('express');var router=express[_0xe7b6('0x4')]();var fs_extra=require(_0xe7b6('0x5'));var auth=require(_0xe7b6('0x6'));var interaction=require(_0xe7b6('0x7'));var config=require(_0xe7b6('0x8'));var controller=require('./chatInternalMessage.controller');router[_0xe7b6('0x9')]('/',auth[_0xe7b6('0xa')](),controller[_0xe7b6('0xb')]);router[_0xe7b6('0x9')]('/describe',auth[_0xe7b6('0xa')](),controller[_0xe7b6('0xc')]);router[_0xe7b6('0x9')](_0xe7b6('0xd'),auth['isAuthenticated'](),controller[_0xe7b6('0xe')]);router[_0xe7b6('0x9')](_0xe7b6('0xf'),auth['isAuthenticated'](),controller[_0xe7b6('0x10')]);router[_0xe7b6('0x11')]('/',auth[_0xe7b6('0xa')](),controller['create']);router[_0xe7b6('0x12')]('/:id',controller[_0xe7b6('0x13')]);router[_0xe7b6('0x14')](_0xe7b6('0xf'),auth[_0xe7b6('0xa')](),controller[_0xe7b6('0x15')]);module[_0xe7b6('0x16')]=router; \ No newline at end of file +var _0xe885=['/users','/:id','show','isAuthenticated','create','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe'];(function(_0x44a4cd,_0xf7df2d){var _0x34b7db=function(_0x11ab4e){while(--_0x11ab4e){_0x44a4cd['push'](_0x44a4cd['shift']());}};_0x34b7db(++_0xf7df2d);}(_0xe885,0x1bc));var _0x5e88=function(_0x909083,_0x4f84a8){_0x909083=_0x909083-0x0;var _0x5a4a19=_0xe885[_0x909083];return _0x5a4a19;};'use strict';var multer=require(_0x5e88('0x0'));var util=require(_0x5e88('0x1'));var path=require('path');var timeout=require(_0x5e88('0x2'));var express=require(_0x5e88('0x3'));var router=express['Router']();var fs_extra=require(_0x5e88('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5e88('0x5'));var config=require(_0x5e88('0x6'));var controller=require(_0x5e88('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5e88('0x8')]);router[_0x5e88('0x9')](_0x5e88('0xa'),auth['isAuthenticated'](),controller[_0x5e88('0xb')]);router[_0x5e88('0x9')](_0x5e88('0xc'),auth['isAuthenticated'](),controller['getUsers']);router[_0x5e88('0x9')](_0x5e88('0xd'),auth['isAuthenticated'](),controller[_0x5e88('0xe')]);router['post']('/',auth[_0x5e88('0xf')](),controller[_0x5e88('0x10')]);router['put']('/:id',controller['update']);router[_0x5e88('0x11')](_0x5e88('0xd'),auth[_0x5e88('0xf')](),controller[_0x5e88('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 653b687..4b7a21b 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 _0xd509=['STRING','TEXT','medium','BOOLEAN','out'];(function(_0x1792ae,_0x3738a3){var _0x379871=function(_0x5d5195){while(--_0x5d5195){_0x1792ae['push'](_0x1792ae['shift']());}};_0x379871(++_0x3738a3);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x9d50('0x0')](_0x9d50('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x9d50('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9d50('0x3')),'defaultValue':_0x9d50('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x9d50('0x4')]},'providerResponse':{'type':Sequelize[_0x9d50('0x0')]}}; \ No newline at end of file +var _0x585e=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x36ee93,_0x502135){var _0x2a936c=function(_0xb6659c){while(--_0xb6659c){_0x36ee93['push'](_0x36ee93['shift']());}};_0x2a936c(++_0x502135);}(_0x585e,0x1c2));var _0xe585=function(_0x46ac62,_0x1124dd){_0x46ac62=_0x46ac62-0x0;var _0x935f5c=_0x585e[_0x46ac62];return _0x935f5c;};'use strict';var Sequelize=require(_0xe585('0x0'));module[_0xe585('0x1')]={'body':{'type':Sequelize[_0xe585('0x2')](_0xe585('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe585('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe585('0x5')),'defaultValue':_0xe585('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xe585('0x6')]},'providerResponse':{'type':Sequelize[_0xe585('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8f1f821..5d41e1e 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 _0x995d=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','internal','rejectmessage','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','send','index','map','ChatMessage','fieldName','type','model','query','filters','intersection','attributes','fields'];(function(_0x5c4691,_0x348823){var _0x4d8745=function(_0x34ea97){while(--_0x34ea97){_0x5c4691['push'](_0x5c4691['shift']());}};_0x4d8745(++_0x348823);}(_0x995d,0xc6));var _0xd995=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x995d[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0xd995('0x0'));var rimraf=require(_0xd995('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd995('0x2'));var rp=require('request-promise');var moment=require(_0xd995('0x3'));var BPromise=require(_0xd995('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd995('0x5'));var sox=require(_0xd995('0x6'));var csv=require(_0xd995('0x7'));var ejs=require(_0xd995('0x8'));var fs=require('fs');var fs_extra=require(_0xd995('0x9'));var _=require(_0xd995('0xa'));var squel=require('squel');var crypto=require(_0xd995('0xb'));var jsforce=require(_0xd995('0xc'));var deskjs=require(_0xd995('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd995('0xe'));var Papa=require(_0xd995('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd995('0x10'));var as=require(_0xd995('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd995('0x12'))(_0xd995('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd995('0x14'));var db=require('../../mysqldb')['db'];config[_0xd995('0x15')]=_[_0xd995('0x16')](config['redis'],{'host':_0xd995('0x17'),'port':0x18eb});var socket=require(_0xd995('0x18'))(new Redis(config[_0xd995('0x15')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xd995('0x19'));var client=jayson[_0xd995('0x1a')]['http']({'port':0x232c});var client9002=jayson['client'][_0xd995('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x19d2b3,_0xf2fb86,_0x2e5243,_0x279a9e){return new BPromise(function(_0x3d093b,_0x2f5518){var _0x4db916=_0x279a9e||client;return _0x4db916['request'](_0x19d2b3,_0x2e5243)['then'](function(_0x100934){logger[_0xd995('0x1c')](_0xd995('0x1d'),_0xf2fb86,'request\x20sent');logger[_0xd995('0x1e')](_0xd995('0x1f'),_0xf2fb86,'request\x20sent',JSON[_0xd995('0x20')](_0x100934));if(_0x100934[_0xd995('0x21')]){if(_0x100934['error']['code']===0x1f4){logger[_0xd995('0x21')](_0xd995('0x1d'),_0xf2fb86,_0x100934[_0xd995('0x21')]['message']);return _0x2f5518(_0x100934[_0xd995('0x21')][_0xd995('0x22')]);}logger[_0xd995('0x21')]('ChatMessage,\x20%s,\x20%s',_0xf2fb86,_0x100934[_0xd995('0x21')]['message']);return _0x3d093b(_0x100934[_0xd995('0x21')][_0xd995('0x22')]);}else{logger[_0xd995('0x1c')]('ChatMessage,\x20%s,\x20%s',_0xf2fb86,_0xd995('0x23'));_0x3d093b(_0x100934[_0xd995('0x24')]['message']);}})[_0xd995('0x25')](function(_0x57c119){logger['error'](_0xd995('0x1d'),_0xf2fb86,_0x57c119);_0x2f5518(_0x57c119);});});}function respondWithStatusCode(_0x44cd00,_0x29bf7a){_0x29bf7a=_0x29bf7a||0xcc;return function(_0x16658a){if(_0x16658a){return _0x44cd00[_0xd995('0x26')](_0x29bf7a);}return _0x44cd00[_0xd995('0x27')](_0x29bf7a)[_0xd995('0x28')]();};}function respondWithResult(_0x237808,_0xefcdfb){_0xefcdfb=_0xefcdfb||0xc8;return function(_0xd5cf5c){if(_0xd5cf5c){return _0x237808[_0xd995('0x27')](_0xefcdfb)['json'](_0xd5cf5c);}};}function respondWithFilteredResult(_0x3da293,_0x3c1828){return function(_0x16bb83){if(_0x16bb83){var _0x380146=typeof _0x3c1828[_0xd995('0x29')]==='undefined'&&typeof _0x3c1828[_0xd995('0x2a')]===_0xd995('0x2b');var _0x4d916a=_0x16bb83[_0xd995('0x2c')];var _0x1b9259=_0x380146?0x0:_0x3c1828[_0xd995('0x29')];var _0x5928bf=_0x380146?_0x16bb83['count']:_0x3c1828[_0xd995('0x29')]+_0x3c1828[_0xd995('0x2a')];var _0x3002b5;if(_0x5928bf>=_0x4d916a){_0x5928bf=_0x4d916a;_0x3002b5=0xc8;}else{_0x3002b5=0xce;}_0x3da293[_0xd995('0x27')](_0x3002b5);return _0x3da293[_0xd995('0x2d')](_0xd995('0x2e'),_0x1b9259+'-'+_0x5928bf+'/'+_0x4d916a)[_0xd995('0x2f')](_0x16bb83);}return null;};}function patchUpdates(_0x541940){return function(_0x53d27b){try{jsonpatch[_0xd995('0x30')](_0x53d27b,_0x541940,!![]);}catch(_0x17a802){return BPromise[_0xd995('0x31')](_0x17a802);}return _0x53d27b['save']();};}function saveUpdates(_0x395259,_0x5d06d1){return function(_0x9c9da){if(_0x9c9da){return _0x9c9da[_0xd995('0x32')](_0x395259)['then'](function(_0x211f8b){return _0x211f8b;});}return null;};}function removeEntity(_0x186b16,_0xac9a3b){return function(_0x4dd94b){if(_0x4dd94b){return _0x4dd94b['destroy']()[_0xd995('0x33')](function(){_0x186b16[_0xd995('0x27')](0xcc)[_0xd995('0x28')]();});}};}function handleEntityNotFound(_0x3c545b,_0x16ad9b){return function(_0x314d8c){if(!_0x314d8c){_0x3c545b['sendStatus'](0x194);}return _0x314d8c;};}function handleError(_0x3ce6a3,_0x3409ee){_0x3409ee=_0x3409ee||0x1f4;return function(_0x4267d3){logger[_0xd995('0x21')](_0x4267d3['stack']);if(_0x4267d3['name']){delete _0x4267d3['name'];}_0x3ce6a3['status'](_0x3409ee)[_0xd995('0x34')](_0x4267d3);};}exports[_0xd995('0x35')]=function(_0x494d17,_0x48a638){var _0x184e46={},_0x568994={},_0x58bcba={'count':0x0,'rows':[]};var _0x41d9ac=_[_0xd995('0x36')](db[_0xd995('0x37')]['rawAttributes'],function(_0x502caf){return{'name':_0x502caf[_0xd995('0x38')],'type':_0x502caf[_0xd995('0x39')]['key']};});_0x568994[_0xd995('0x3a')]=_[_0xd995('0x36')](_0x41d9ac,'name');_0x568994[_0xd995('0x3b')]=_['keys'](_0x494d17[_0xd995('0x3b')]);_0x568994[_0xd995('0x3c')]=_[_0xd995('0x3d')](_0x568994['model'],_0x568994[_0xd995('0x3b')]);_0x184e46[_0xd995('0x3e')]=_[_0xd995('0x3d')](_0x568994['model'],qs[_0xd995('0x3f')](_0x494d17[_0xd995('0x3b')][_0xd995('0x3f')]));_0x184e46[_0xd995('0x3e')]=_0x184e46[_0xd995('0x3e')][_0xd995('0x40')]?_0x184e46[_0xd995('0x3e')]:_0x568994['model'];if(!_0x494d17[_0xd995('0x3b')][_0xd995('0x41')](_0xd995('0x42'))){_0x184e46[_0xd995('0x2a')]=qs[_0xd995('0x2a')](_0x494d17[_0xd995('0x3b')][_0xd995('0x2a')]);_0x184e46[_0xd995('0x29')]=qs[_0xd995('0x29')](_0x494d17[_0xd995('0x3b')][_0xd995('0x29')]);}_0x184e46[_0xd995('0x43')]=qs[_0xd995('0x44')](_0x494d17[_0xd995('0x3b')][_0xd995('0x44')]);_0x184e46['where']=qs[_0xd995('0x3c')](_[_0xd995('0x45')](_0x494d17[_0xd995('0x3b')],_0x568994[_0xd995('0x3c')]),_0x41d9ac);if(_0x494d17['query'][_0xd995('0x46')]){_0x184e46[_0xd995('0x47')]=_[_0xd995('0x48')](_0x184e46[_0xd995('0x47')],{'$or':_[_0xd995('0x36')](_0x41d9ac,function(_0x1b5adc){if(_0x1b5adc['type']!==_0xd995('0x49')){var _0x33aabf={};_0x33aabf[_0x1b5adc[_0xd995('0x4a')]]={'$like':'%'+_0x494d17['query'][_0xd995('0x46')]+'%'};return _0x33aabf;}})});}_0x184e46=_[_0xd995('0x48')]({},_0x184e46,_0x494d17[_0xd995('0x4b')]);var _0xa3b593={'where':_0x184e46[_0xd995('0x47')]};return db[_0xd995('0x37')]['count'](_0xa3b593)[_0xd995('0x33')](function(_0x1c5453){_0x58bcba[_0xd995('0x2c')]=_0x1c5453;if(_0x494d17[_0xd995('0x3b')]['includeAll']){_0x184e46[_0xd995('0x4c')]=[{'all':!![]}];}return db['ChatMessage'][_0xd995('0x4d')](_0x184e46);})[_0xd995('0x33')](function(_0x414bea){_0x58bcba[_0xd995('0x4e')]=_0x414bea;return _0x58bcba;})['then'](respondWithFilteredResult(_0x48a638,_0x184e46))[_0xd995('0x25')](handleError(_0x48a638,null));};exports[_0xd995('0x4f')]=function(_0x117470,_0x231748){var _0x2deb14={'raw':!![],'where':{'id':_0x117470[_0xd995('0x50')]['id']}},_0x3d3bad={};_0x3d3bad[_0xd995('0x3a')]=_[_0xd995('0x51')](db[_0xd995('0x37')][_0xd995('0x52')]);_0x3d3bad[_0xd995('0x3b')]=_[_0xd995('0x51')](_0x117470[_0xd995('0x3b')]);_0x3d3bad[_0xd995('0x3c')]=_['intersection'](_0x3d3bad[_0xd995('0x3a')],_0x3d3bad[_0xd995('0x3b')]);_0x2deb14['attributes']=_[_0xd995('0x3d')](_0x3d3bad[_0xd995('0x3a')],qs[_0xd995('0x3f')](_0x117470[_0xd995('0x3b')]['fields']));_0x2deb14['attributes']=_0x2deb14[_0xd995('0x3e')][_0xd995('0x40')]?_0x2deb14[_0xd995('0x3e')]:_0x3d3bad[_0xd995('0x3a')];if(_0x117470['query'][_0xd995('0x53')]){_0x2deb14[_0xd995('0x4c')]=[{'all':!![]}];}_0x2deb14=_[_0xd995('0x48')]({},_0x2deb14,_0x117470['options']);return db[_0xd995('0x37')][_0xd995('0x54')](_0x2deb14)[_0xd995('0x33')](handleEntityNotFound(_0x231748,null))[_0xd995('0x33')](respondWithResult(_0x231748,null))[_0xd995('0x25')](handleError(_0x231748,null));};exports[_0xd995('0x55')]=function(_0x2fd728,_0x540cc7){return db[_0xd995('0x37')][_0xd995('0x55')](_0x2fd728[_0xd995('0x56')],{})[_0xd995('0x33')](respondWithResult(_0x540cc7,0xc9))[_0xd995('0x25')](handleError(_0x540cc7,null));};exports[_0xd995('0x32')]=function(_0x3b28f0,_0x3c0e45){if(_0x3b28f0[_0xd995('0x56')]['id']){delete _0x3b28f0[_0xd995('0x56')]['id'];}return db[_0xd995('0x37')][_0xd995('0x54')]({'where':{'id':_0x3b28f0[_0xd995('0x50')]['id']}})['then'](handleEntityNotFound(_0x3c0e45,null))['then'](saveUpdates(_0x3b28f0[_0xd995('0x56')],null))['then'](respondWithResult(_0x3c0e45,null))[_0xd995('0x25')](handleError(_0x3c0e45,null));};exports['destroy']=function(_0xb3a5ee,_0x51fafb){return db['ChatMessage']['find']({'where':{'id':_0xb3a5ee[_0xd995('0x50')]['id']}})[_0xd995('0x33')](handleEntityNotFound(_0x51fafb,null))['then'](removeEntity(_0x51fafb,null))[_0xd995('0x25')](handleError(_0x51fafb,null));};exports[_0xd995('0x57')]=function(_0x1d0fc3,_0x51d0b7){return db[_0xd995('0x37')]['describe']()[_0xd995('0x33')](respondWithResult(_0x51d0b7,null))['catch'](handleError(_0x51d0b7,null));};var interaction_log=require(_0xd995('0x12'))(_0xd995('0x58'));exports[_0xd995('0x59')]=function(_0x4b30da,_0x37803d,_0x507740){var _0x26d531={'agent':{},'channel':_0xd995('0x5a')};if(_0x4b30da[_0xd995('0x56')]['id']){delete _0x4b30da[_0xd995('0x56')]['id'];}_0x4b30da[_0xd995('0x56')][_0xd995('0x5b')]=!![];_0x4b30da[_0xd995('0x56')][_0xd995('0x5c')]=moment()[_0xd995('0x5d')](_0xd995('0x5e'));_0x4b30da['body']['UserId']=_0x4b30da[_0xd995('0x56')][_0xd995('0x5f')]||_0x4b30da[_0xd995('0x60')]['id'];_0x26d531[_0xd995('0x61')]['id']=_0x4b30da[_0xd995('0x56')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x4b30da[_0xd995('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37803d,null))['then'](saveUpdates(_0x4b30da['body'],null))[_0xd995('0x33')](function(_0x26f8d2){if(_0x26f8d2){_0x26d531['message']=_0x26f8d2[_0xd995('0x62')]({'plain':!![]});return db['ChatInteraction'][_0xd995('0x54')]({'where':{'id':_0x26f8d2[_0xd995('0x63')]}});}return null;})[_0xd995('0x33')](handleEntityNotFound(_0x37803d,null))['then'](function(_0x4de3dc){if(_0x4de3dc){return _0x4de3dc[_0xd995('0x32')]({'UserId':_0x4b30da['body']['UserId'],'read1stAt':_[_0xd995('0x64')](_0x4de3dc[_0xd995('0x65')])?moment()[_0xd995('0x5d')](_0xd995('0x5e')):undefined});}return null;})['then'](function(_0xd9f5a){if(_0xd9f5a){_0x26d531['interaction']=_0xd9f5a[_0xd995('0x62')]({'plain':!![]});interaction_log[_0xd995('0x1c')](_0xd995('0x66'),_0x4b30da['user']['id'],_0x4b30da[_0xd995('0x60')]['name'],_0x4b30da[_0xd995('0x60')][_0xd995('0x67')],_0x26d531[_0xd995('0x68')]['id'],_0x4b30da[_0xd995('0x56')]?JSON[_0xd995('0x20')](_0x4b30da[_0xd995('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0xd995('0x69'),_0x26d531);}return null;})[_0xd995('0x33')](function(_0xf061f0){var _0x16728c=_0xd995('0x6a')+_0xf061f0[_0xd995('0x22')][_0xd995('0x6b')];return db[_0xd995('0x6c')][_0xd995('0x3b')](_0x16728c,{'type':db[_0xd995('0x6d')][_0xd995('0x6e')][_0xd995('0x6f')],'raw':!![]})['then'](function(_0xefe774){return _0xefe774;});})[_0xd995('0x33')](function(_0x41c11a){if(_0x41c11a){_0x26d531[_0xd995('0x22')][_0xd995('0x70')]=_0x41c11a[0x0];if(!_0x4b30da[_0xd995('0x56')][_0xd995('0x5f')])return;return db[_0xd995('0x71')][_0xd995('0x54')]({'where':{'id':_0x4b30da[_0xd995('0x56')][_0xd995('0x5f')],'role':_0xd995('0x61')},'attributes':['id',_0xd995('0x4a'),_0xd995('0x72'),_0xd995('0x73'),'internal'],'raw':!![]});}return null;})[_0xd995('0x33')](function(_0xcfb040){if(!_0xcfb040)return null;_0x26d531[_0xd995('0x22')][_0xd995('0x61')]=_0xcfb040;return _0x26d531;})[_0xd995('0x33')](function(_0x62663){if(_0x62663){if(_0x4b30da['body'][_0xd995('0x74')]){_0x26d531['message'][_0xd995('0x75')]=util[_0xd995('0x5d')](_0xd995('0x76'),_0x4b30da['user'][_0xd995('0x4a')]);_0x26d531[_0xd995('0x22')][_0xd995('0x77')]=_0x26d531[_0xd995('0x77')];_0x26d531[_0xd995('0x22')][_0xd995('0x78')]=_0x26d531['channel'];_0x26d531[_0xd995('0x22')][_0xd995('0x79')]='accept';return respondWithRpcPromise(_0xd995('0x7a'),_0xd995('0x7a'),{'event':_0xd995('0x7b'),'message':_['merge'](_0x26d531[_0xd995('0x22')],JSON['parse'](_0x26d531[_0xd995('0x68')][_0xd995('0x7c')]))},client9002)['then'](function(){return _0x26d531;});}return _0x26d531;}return null;})[_0xd995('0x33')](respondWithResult(_0x37803d,null))[_0xd995('0x25')](handleError(_0x37803d,null));};var interaction_log=require(_0xd995('0x12'))('chat-interactions');exports['reject']=function(_0x54d980,_0x5ce67e,_0x30cb01){var _0x4039b8={'agent':{},'channel':_0xd995('0x5a')};if(_0x54d980[_0xd995('0x56')]['id']){delete _0x54d980[_0xd995('0x56')]['id'];}_0x54d980[_0xd995('0x56')][_0xd995('0x5f')]=_0x54d980['body'][_0xd995('0x5f')]||_0x54d980['user']['id'];_0x4039b8['agent']['id']=_0x54d980[_0xd995('0x56')][_0xd995('0x5f')];return db[_0xd995('0x37')][_0xd995('0x54')]({'where':{'id':_0x54d980[_0xd995('0x50')]['id'],'UserId':null}})[_0xd995('0x33')](handleEntityNotFound(_0x5ce67e,null))[_0xd995('0x33')](function(_0x225708){if(_0x225708){_0x4039b8['message']=_0x225708[_0xd995('0x62')]({'plain':!![]});return db[_0xd995('0x7d')][_0xd995('0x54')]({'where':{'id':_0x225708['ChatInteractionId']}});}return null;})[_0xd995('0x33')](handleEntityNotFound(_0x5ce67e,null))[_0xd995('0x33')](function(_0x4b325f){if(_0x4b325f){_0x4039b8[_0xd995('0x68')]=_0x4b325f[_0xd995('0x62')]({'plain':!![]});interaction_log[_0xd995('0x1c')](_0xd995('0x7e'),_0x54d980[_0xd995('0x60')]['id'],_0x54d980['user'][_0xd995('0x4a')],_0x54d980[_0xd995('0x60')][_0xd995('0x67')],_0x4039b8[_0xd995('0x68')]['id'],_0x54d980['body']?JSON[_0xd995('0x20')](_0x54d980[_0xd995('0x56')]):_0xd995('0x7f'));return respondWithRpcPromise('RejectMessage',_0xd995('0x80'),_0x4039b8);}return null;})[_0xd995('0x33')](function(_0x469adc){var _0x5b4c00='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x469adc['message'][_0xd995('0x6b')];return db[_0xd995('0x6c')][_0xd995('0x3b')](_0x5b4c00,{'type':db[_0xd995('0x6d')][_0xd995('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0xa07f8){return _0xa07f8;});})[_0xd995('0x33')](function(_0x441edf){if(_0x441edf){_0x4039b8[_0xd995('0x22')][_0xd995('0x70')]=_0x441edf[0x0];if(!_0x54d980[_0xd995('0x56')][_0xd995('0x5f')])return;return db[_0xd995('0x71')][_0xd995('0x54')]({'where':{'id':_0x54d980['body'][_0xd995('0x5f')],'role':_0xd995('0x61')},'attributes':['id',_0xd995('0x4a'),_0xd995('0x72'),'email',_0xd995('0x81')],'raw':!![]});}return null;})['then'](function(_0x4eb70c){if(!_0x4eb70c)return null;_0x4039b8[_0xd995('0x22')][_0xd995('0x61')]=_0x4eb70c;return _0x4039b8;})[_0xd995('0x33')](function(_0x4dfc30){if(_0x4dfc30){_0x4dfc30[_0xd995('0x22')][_0xd995('0x75')]=util['format'](_0xd995('0x76'),_0x54d980['user'][_0xd995('0x4a')]);_0x4dfc30[_0xd995('0x22')]['channel']=_0x4039b8['channel'];_0x4dfc30[_0xd995('0x22')][_0xd995('0x78')]=_0x4039b8[_0xd995('0x77')];_0x4dfc30['message'][_0xd995('0x79')]=_0xd995('0x31');respondWithRpcPromise(_0xd995('0x7a'),'EventManager',{'event':_0xd995('0x82'),'message':_[_0xd995('0x48')](_0x4039b8['message'],JSON['parse'](_0x4039b8[_0xd995('0x68')]['formData']))},client9002);return _0x4039b8;}return null;})[_0xd995('0x33')](respondWithResult(_0x5ce67e,null))[_0xd995('0x25')](handleError(_0x5ce67e,null));}; \ No newline at end of file +var _0x0a8a=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','index','ChatMessage','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','include','findAll','rows','params','length','includeAll','create','body','find','describe','chat-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','acceptMessage','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','motionChannel','event','EventManager','parse','formData','chat','ChatInteractionId','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xfab3ef,_0x36ef33){var _0x59de7a=function(_0x3654d1){while(--_0x3654d1){_0xfab3ef['push'](_0xfab3ef['shift']());}};_0x59de7a(++_0x36ef33);}(_0x0a8a,0xee));var _0xa0a8=function(_0x2a607c,_0x2c0ede){_0x2a607c=_0x2a607c-0x0;var _0x46f19a=_0x0a8a[_0x2a607c];return _0x46f19a;};'use strict';var emlformat=require(_0xa0a8('0x0'));var rimraf=require(_0xa0a8('0x1'));var zipdir=require(_0xa0a8('0x2'));var jsonpatch=require(_0xa0a8('0x3'));var rp=require(_0xa0a8('0x4'));var moment=require('moment');var BPromise=require(_0xa0a8('0x5'));var Mustache=require(_0xa0a8('0x6'));var util=require(_0xa0a8('0x7'));var path=require('path');var sox=require(_0xa0a8('0x8'));var csv=require(_0xa0a8('0x9'));var ejs=require(_0xa0a8('0xa'));var fs=require('fs');var fs_extra=require(_0xa0a8('0xb'));var _=require(_0xa0a8('0xc'));var squel=require(_0xa0a8('0xd'));var crypto=require(_0xa0a8('0xe'));var jsforce=require(_0xa0a8('0xf'));var deskjs=require(_0xa0a8('0x10'));var toCsv=require(_0xa0a8('0x9'));var querystring=require(_0xa0a8('0x11'));var Papa=require(_0xa0a8('0x12'));var Redis=require(_0xa0a8('0x13'));var authService=require(_0xa0a8('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xa0a8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0a8('0x16'))('api');var utils=require(_0xa0a8('0x17'));var config=require(_0xa0a8('0x18'));var licenseUtil=require(_0xa0a8('0x19'));var db=require(_0xa0a8('0x1a'))['db'];config['redis']=_[_0xa0a8('0x1b')](config[_0xa0a8('0x1c')],{'host':_0xa0a8('0x1d'),'port':0x18eb});var socket=require(_0xa0a8('0x1e'))(new Redis(config[_0xa0a8('0x1c')]));require(_0xa0a8('0x1f'))['register'](socket);var jayson=require(_0xa0a8('0x20'));var client=jayson['client'][_0xa0a8('0x21')]({'port':0x232c});var client9002=jayson[_0xa0a8('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e8071,_0x2a4cac,_0x314183,_0x1a114c){return new BPromise(function(_0x249c6a,_0x2bd500){var _0x160471=_0x1a114c||client;return _0x160471['request'](_0x2e8071,_0x314183)[_0xa0a8('0x23')](function(_0x431407){logger['info'](_0xa0a8('0x24'),_0x2a4cac,'request\x20sent');logger[_0xa0a8('0x25')](_0xa0a8('0x26'),_0x2a4cac,_0xa0a8('0x27'),JSON['stringify'](_0x431407));if(_0x431407['error']){if(_0x431407[_0xa0a8('0x28')]['code']===0x1f4){logger[_0xa0a8('0x28')](_0xa0a8('0x24'),_0x2a4cac,_0x431407[_0xa0a8('0x28')][_0xa0a8('0x29')]);return _0x2bd500(_0x431407[_0xa0a8('0x28')][_0xa0a8('0x29')]);}logger[_0xa0a8('0x28')](_0xa0a8('0x24'),_0x2a4cac,_0x431407[_0xa0a8('0x28')][_0xa0a8('0x29')]);return _0x249c6a(_0x431407[_0xa0a8('0x28')][_0xa0a8('0x29')]);}else{logger[_0xa0a8('0x2a')](_0xa0a8('0x24'),_0x2a4cac,_0xa0a8('0x27'));_0x249c6a(_0x431407['result'][_0xa0a8('0x29')]);}})[_0xa0a8('0x2b')](function(_0x59b526){logger[_0xa0a8('0x28')]('ChatMessage,\x20%s,\x20%s',_0x2a4cac,_0x59b526);_0x2bd500(_0x59b526);});});}function respondWithStatusCode(_0xc7d660,_0x4a63c6){_0x4a63c6=_0x4a63c6||0xcc;return function(_0x13e735){if(_0x13e735){return _0xc7d660[_0xa0a8('0x2c')](_0x4a63c6);}return _0xc7d660['status'](_0x4a63c6)[_0xa0a8('0x2d')]();};}function respondWithResult(_0x14569a,_0x3eaa36){_0x3eaa36=_0x3eaa36||0xc8;return function(_0xa3e19e){if(_0xa3e19e){return _0x14569a[_0xa0a8('0x2e')](_0x3eaa36)[_0xa0a8('0x2f')](_0xa3e19e);}};}function respondWithFilteredResult(_0x113284,_0x51e8d9){return function(_0x29965d){if(_0x29965d){var _0x44bfff=typeof _0x51e8d9[_0xa0a8('0x30')]===_0xa0a8('0x31')&&typeof _0x51e8d9['limit']===_0xa0a8('0x31');var _0x2c86ab=_0x29965d[_0xa0a8('0x32')];var _0x20586f=_0x44bfff?0x0:_0x51e8d9[_0xa0a8('0x30')];var _0x188ec8=_0x44bfff?_0x29965d[_0xa0a8('0x32')]:_0x51e8d9[_0xa0a8('0x30')]+_0x51e8d9[_0xa0a8('0x33')];var _0x4e0353;if(_0x188ec8>=_0x2c86ab){_0x188ec8=_0x2c86ab;_0x4e0353=0xc8;}else{_0x4e0353=0xce;}_0x113284[_0xa0a8('0x2e')](_0x4e0353);return _0x113284[_0xa0a8('0x34')](_0xa0a8('0x35'),_0x20586f+'-'+_0x188ec8+'/'+_0x2c86ab)['json'](_0x29965d);}return null;};}function patchUpdates(_0x5a964b){return function(_0x3a8e76){try{jsonpatch['apply'](_0x3a8e76,_0x5a964b,!![]);}catch(_0x2a11f7){return BPromise[_0xa0a8('0x36')](_0x2a11f7);}return _0x3a8e76[_0xa0a8('0x37')]();};}function saveUpdates(_0x456545,_0x849801){return function(_0x506c9b){if(_0x506c9b){return _0x506c9b[_0xa0a8('0x38')](_0x456545)[_0xa0a8('0x23')](function(_0x1be9f7){return _0x1be9f7;});}return null;};}function removeEntity(_0x1b8367,_0x1d19bb){return function(_0x30e996){if(_0x30e996){return _0x30e996[_0xa0a8('0x39')]()['then'](function(){_0x1b8367[_0xa0a8('0x2e')](0xcc)[_0xa0a8('0x2d')]();});}};}function handleEntityNotFound(_0x3bb556,_0x8dcf30){return function(_0x2719fc){if(!_0x2719fc){_0x3bb556[_0xa0a8('0x2c')](0x194);}return _0x2719fc;};}function handleError(_0x2b8a4f,_0x2c6e22){_0x2c6e22=_0x2c6e22||0x1f4;return function(_0x4b809d){logger[_0xa0a8('0x28')](_0x4b809d[_0xa0a8('0x3a')]);if(_0x4b809d['name']){delete _0x4b809d[_0xa0a8('0x3b')];}_0x2b8a4f[_0xa0a8('0x2e')](_0x2c6e22)['send'](_0x4b809d);};}exports[_0xa0a8('0x3c')]=function(_0x477604,_0x33515c){var _0x524a76={},_0x44eae9={},_0x1757c0={'count':0x0,'rows':[]};var _0x5404cf=_['map'](db[_0xa0a8('0x3d')][_0xa0a8('0x3e')],function(_0x3f23c6){return{'name':_0x3f23c6[_0xa0a8('0x3f')],'type':_0x3f23c6[_0xa0a8('0x40')]['key']};});_0x44eae9[_0xa0a8('0x41')]=_[_0xa0a8('0x42')](_0x5404cf,_0xa0a8('0x3b'));_0x44eae9[_0xa0a8('0x43')]=_[_0xa0a8('0x44')](_0x477604[_0xa0a8('0x43')]);_0x44eae9['filters']=_['intersection'](_0x44eae9[_0xa0a8('0x41')],_0x44eae9['query']);_0x524a76[_0xa0a8('0x45')]=_[_0xa0a8('0x46')](_0x44eae9[_0xa0a8('0x41')],qs['fields'](_0x477604[_0xa0a8('0x43')][_0xa0a8('0x47')]));_0x524a76[_0xa0a8('0x45')]=_0x524a76['attributes']['length']?_0x524a76[_0xa0a8('0x45')]:_0x44eae9[_0xa0a8('0x41')];if(!_0x477604[_0xa0a8('0x43')][_0xa0a8('0x48')](_0xa0a8('0x49'))){_0x524a76[_0xa0a8('0x33')]=qs[_0xa0a8('0x33')](_0x477604[_0xa0a8('0x43')][_0xa0a8('0x33')]);_0x524a76['offset']=qs['offset'](_0x477604[_0xa0a8('0x43')][_0xa0a8('0x30')]);}_0x524a76[_0xa0a8('0x4a')]=qs['sort'](_0x477604[_0xa0a8('0x43')]['sort']);_0x524a76[_0xa0a8('0x4b')]=qs[_0xa0a8('0x4c')](_[_0xa0a8('0x4d')](_0x477604[_0xa0a8('0x43')],_0x44eae9[_0xa0a8('0x4c')]),_0x5404cf);if(_0x477604['query'][_0xa0a8('0x4e')]){_0x524a76['where']=_[_0xa0a8('0x4f')](_0x524a76['where'],{'$or':_[_0xa0a8('0x42')](_0x5404cf,function(_0x2d5b08){if(_0x2d5b08[_0xa0a8('0x40')]!=='VIRTUAL'){var _0x41db7e={};_0x41db7e[_0x2d5b08[_0xa0a8('0x3b')]]={'$like':'%'+_0x477604[_0xa0a8('0x43')]['filter']+'%'};return _0x41db7e;}})});}_0x524a76=_[_0xa0a8('0x4f')]({},_0x524a76,_0x477604[_0xa0a8('0x50')]);var _0x23c391={'where':_0x524a76[_0xa0a8('0x4b')]};return db[_0xa0a8('0x3d')]['count'](_0x23c391)['then'](function(_0x849d9d){_0x1757c0['count']=_0x849d9d;if(_0x477604[_0xa0a8('0x43')]['includeAll']){_0x524a76[_0xa0a8('0x51')]=[{'all':!![]}];}return db['ChatMessage'][_0xa0a8('0x52')](_0x524a76);})[_0xa0a8('0x23')](function(_0x48dd7f){_0x1757c0[_0xa0a8('0x53')]=_0x48dd7f;return _0x1757c0;})[_0xa0a8('0x23')](respondWithFilteredResult(_0x33515c,_0x524a76))[_0xa0a8('0x2b')](handleError(_0x33515c,null));};exports['show']=function(_0x29e966,_0x35b938){var _0x2b106c={'raw':!![],'where':{'id':_0x29e966[_0xa0a8('0x54')]['id']}},_0x1e4094={};_0x1e4094[_0xa0a8('0x41')]=_['keys'](db[_0xa0a8('0x3d')][_0xa0a8('0x3e')]);_0x1e4094[_0xa0a8('0x43')]=_['keys'](_0x29e966[_0xa0a8('0x43')]);_0x1e4094[_0xa0a8('0x4c')]=_[_0xa0a8('0x46')](_0x1e4094[_0xa0a8('0x41')],_0x1e4094[_0xa0a8('0x43')]);_0x2b106c[_0xa0a8('0x45')]=_[_0xa0a8('0x46')](_0x1e4094[_0xa0a8('0x41')],qs['fields'](_0x29e966[_0xa0a8('0x43')][_0xa0a8('0x47')]));_0x2b106c[_0xa0a8('0x45')]=_0x2b106c['attributes'][_0xa0a8('0x55')]?_0x2b106c['attributes']:_0x1e4094[_0xa0a8('0x41')];if(_0x29e966[_0xa0a8('0x43')][_0xa0a8('0x56')]){_0x2b106c[_0xa0a8('0x51')]=[{'all':!![]}];}_0x2b106c=_['merge']({},_0x2b106c,_0x29e966[_0xa0a8('0x50')]);return db['ChatMessage']['find'](_0x2b106c)[_0xa0a8('0x23')](handleEntityNotFound(_0x35b938,null))[_0xa0a8('0x23')](respondWithResult(_0x35b938,null))[_0xa0a8('0x2b')](handleError(_0x35b938,null));};exports[_0xa0a8('0x57')]=function(_0x5cd022,_0x1cc445){return db['ChatMessage'][_0xa0a8('0x57')](_0x5cd022[_0xa0a8('0x58')],{})[_0xa0a8('0x23')](respondWithResult(_0x1cc445,0xc9))['catch'](handleError(_0x1cc445,null));};exports[_0xa0a8('0x38')]=function(_0x2c1402,_0x2b195e){if(_0x2c1402['body']['id']){delete _0x2c1402['body']['id'];}return db['ChatMessage'][_0xa0a8('0x59')]({'where':{'id':_0x2c1402[_0xa0a8('0x54')]['id']}})[_0xa0a8('0x23')](handleEntityNotFound(_0x2b195e,null))[_0xa0a8('0x23')](saveUpdates(_0x2c1402[_0xa0a8('0x58')],null))['then'](respondWithResult(_0x2b195e,null))[_0xa0a8('0x2b')](handleError(_0x2b195e,null));};exports[_0xa0a8('0x39')]=function(_0x5aef42,_0x11f82d){return db['ChatMessage'][_0xa0a8('0x59')]({'where':{'id':_0x5aef42[_0xa0a8('0x54')]['id']}})['then'](handleEntityNotFound(_0x11f82d,null))['then'](removeEntity(_0x11f82d,null))[_0xa0a8('0x2b')](handleError(_0x11f82d,null));};exports[_0xa0a8('0x5a')]=function(_0x9a922a,_0xb476aa){return db[_0xa0a8('0x3d')][_0xa0a8('0x5a')]()['then'](respondWithResult(_0xb476aa,null))[_0xa0a8('0x2b')](handleError(_0xb476aa,null));};var interaction_log=require(_0xa0a8('0x16'))(_0xa0a8('0x5b'));exports[_0xa0a8('0x5c')]=function(_0x1def63,_0x32a72a,_0x568bf5){var _0x3a8d84={'agent':{},'channel':'chat'};if(_0x1def63[_0xa0a8('0x58')]['id']){delete _0x1def63[_0xa0a8('0x58')]['id'];}_0x1def63[_0xa0a8('0x58')][_0xa0a8('0x5d')]=!![];_0x1def63[_0xa0a8('0x58')]['readAt']=moment()[_0xa0a8('0x5e')](_0xa0a8('0x5f'));_0x1def63[_0xa0a8('0x58')][_0xa0a8('0x60')]=_0x1def63[_0xa0a8('0x58')][_0xa0a8('0x60')]||_0x1def63['user']['id'];_0x3a8d84[_0xa0a8('0x61')]['id']=_0x1def63[_0xa0a8('0x58')][_0xa0a8('0x60')];return db[_0xa0a8('0x3d')][_0xa0a8('0x59')]({'where':{'id':_0x1def63[_0xa0a8('0x54')]['id'],'UserId':null}})[_0xa0a8('0x23')](handleEntityNotFound(_0x32a72a,null))[_0xa0a8('0x23')](saveUpdates(_0x1def63[_0xa0a8('0x58')],null))[_0xa0a8('0x23')](function(_0x694328){if(_0x694328){_0x3a8d84[_0xa0a8('0x29')]=_0x694328[_0xa0a8('0x62')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x694328['ChatInteractionId']}});}return null;})[_0xa0a8('0x23')](handleEntityNotFound(_0x32a72a,null))[_0xa0a8('0x23')](function(_0x12104c){if(_0x12104c){return _0x12104c[_0xa0a8('0x38')]({'UserId':_0x1def63[_0xa0a8('0x58')]['UserId'],'read1stAt':_[_0xa0a8('0x63')](_0x12104c[_0xa0a8('0x64')])?moment()['format'](_0xa0a8('0x5f')):undefined});}return null;})[_0xa0a8('0x23')](function(_0x46ba55){if(_0x46ba55){_0x3a8d84['interaction']=_0x46ba55[_0xa0a8('0x62')]({'plain':!![]});interaction_log[_0xa0a8('0x2a')](_0xa0a8('0x65'),_0x1def63['user']['id'],_0x1def63[_0xa0a8('0x66')][_0xa0a8('0x3b')],_0x1def63[_0xa0a8('0x66')][_0xa0a8('0x67')],_0x3a8d84[_0xa0a8('0x68')]['id'],_0x1def63[_0xa0a8('0x58')]?JSON[_0xa0a8('0x69')](_0x1def63[_0xa0a8('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0xa0a8('0x6a'),_0x3a8d84);}return null;})['then'](function(_0xeb8a84){var _0x55fa56='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xeb8a84[_0xa0a8('0x29')]['ContactId'];return db['sequelize'][_0xa0a8('0x43')](_0x55fa56,{'type':db['Sequelize'][_0xa0a8('0x6b')][_0xa0a8('0x6c')],'raw':!![]})['then'](function(_0x258731){return _0x258731;});})[_0xa0a8('0x23')](function(_0x195607){if(_0x195607){_0x3a8d84[_0xa0a8('0x29')][_0xa0a8('0x6d')]=_0x195607[0x0];if(!_0x1def63[_0xa0a8('0x58')][_0xa0a8('0x60')])return;return db[_0xa0a8('0x6e')][_0xa0a8('0x59')]({'where':{'id':_0x1def63['body'][_0xa0a8('0x60')],'role':_0xa0a8('0x61')},'attributes':['id',_0xa0a8('0x3b'),_0xa0a8('0x6f'),_0xa0a8('0x70'),'internal'],'raw':!![]});}return null;})[_0xa0a8('0x23')](function(_0x52a20f){if(!_0x52a20f)return null;_0x3a8d84[_0xa0a8('0x29')][_0xa0a8('0x61')]=_0x52a20f;return _0x3a8d84;})[_0xa0a8('0x23')](function(_0x175554){if(_0x175554){if(_0x1def63[_0xa0a8('0x58')][_0xa0a8('0x71')]){_0x3a8d84[_0xa0a8('0x29')][_0xa0a8('0x72')]=util[_0xa0a8('0x5e')]('SIP/%s',_0x1def63['user'][_0xa0a8('0x3b')]);_0x3a8d84[_0xa0a8('0x29')][_0xa0a8('0x73')]=_0x3a8d84[_0xa0a8('0x73')];_0x3a8d84[_0xa0a8('0x29')][_0xa0a8('0x74')]=_0x3a8d84[_0xa0a8('0x73')];_0x3a8d84[_0xa0a8('0x29')][_0xa0a8('0x75')]=_0xa0a8('0x5c');return respondWithRpcPromise(_0xa0a8('0x76'),_0xa0a8('0x76'),{'event':'acceptmessage','message':_[_0xa0a8('0x4f')](_0x3a8d84[_0xa0a8('0x29')],JSON[_0xa0a8('0x77')](_0x3a8d84[_0xa0a8('0x68')][_0xa0a8('0x78')]))},client9002)[_0xa0a8('0x23')](function(){return _0x3a8d84;});}return _0x3a8d84;}return null;})['then'](respondWithResult(_0x32a72a,null))[_0xa0a8('0x2b')](handleError(_0x32a72a,null));};var interaction_log=require(_0xa0a8('0x16'))(_0xa0a8('0x5b'));exports['reject']=function(_0x557926,_0x4f5f4f,_0x2b6579){var _0x4491f8={'agent':{},'channel':_0xa0a8('0x79')};if(_0x557926[_0xa0a8('0x58')]['id']){delete _0x557926[_0xa0a8('0x58')]['id'];}_0x557926[_0xa0a8('0x58')][_0xa0a8('0x60')]=_0x557926[_0xa0a8('0x58')][_0xa0a8('0x60')]||_0x557926[_0xa0a8('0x66')]['id'];_0x4491f8[_0xa0a8('0x61')]['id']=_0x557926[_0xa0a8('0x58')][_0xa0a8('0x60')];return db[_0xa0a8('0x3d')][_0xa0a8('0x59')]({'where':{'id':_0x557926[_0xa0a8('0x54')]['id'],'UserId':null}})[_0xa0a8('0x23')](handleEntityNotFound(_0x4f5f4f,null))[_0xa0a8('0x23')](function(_0x53c21a){if(_0x53c21a){_0x4491f8['message']=_0x53c21a[_0xa0a8('0x62')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x53c21a[_0xa0a8('0x7a')]}});}return null;})['then'](handleEntityNotFound(_0x4f5f4f,null))[_0xa0a8('0x23')](function(_0x3423c8){if(_0x3423c8){_0x4491f8[_0xa0a8('0x68')]=_0x3423c8[_0xa0a8('0x62')]({'plain':!![]});interaction_log[_0xa0a8('0x2a')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x557926[_0xa0a8('0x66')]['id'],_0x557926[_0xa0a8('0x66')][_0xa0a8('0x3b')],_0x557926[_0xa0a8('0x66')]['role'],_0x4491f8[_0xa0a8('0x68')]['id'],_0x557926[_0xa0a8('0x58')]?JSON[_0xa0a8('0x69')](_0x557926[_0xa0a8('0x58')]):_0xa0a8('0x7b'));return respondWithRpcPromise(_0xa0a8('0x7c'),_0xa0a8('0x7d'),_0x4491f8);}return null;})['then'](function(_0x4a2f52){var _0x52e2fa=_0xa0a8('0x7e')+_0x4a2f52['message'][_0xa0a8('0x7f')];return db[_0xa0a8('0x80')][_0xa0a8('0x43')](_0x52e2fa,{'type':db[_0xa0a8('0x81')]['QueryTypes'][_0xa0a8('0x6c')],'raw':!![]})['then'](function(_0x56df63){return _0x56df63;});})[_0xa0a8('0x23')](function(_0x56928f){if(_0x56928f){_0x4491f8[_0xa0a8('0x29')][_0xa0a8('0x6d')]=_0x56928f[0x0];if(!_0x557926[_0xa0a8('0x58')]['UserId'])return;return db[_0xa0a8('0x6e')]['find']({'where':{'id':_0x557926[_0xa0a8('0x58')][_0xa0a8('0x60')],'role':'agent'},'attributes':['id','name',_0xa0a8('0x6f'),_0xa0a8('0x70'),_0xa0a8('0x82')],'raw':!![]});}return null;})[_0xa0a8('0x23')](function(_0x11f9d9){if(!_0x11f9d9)return null;_0x4491f8[_0xa0a8('0x29')]['agent']=_0x11f9d9;return _0x4491f8;})[_0xa0a8('0x23')](function(_0x9bb737){if(_0x9bb737){_0x9bb737[_0xa0a8('0x29')]['interface']=util[_0xa0a8('0x5e')]('SIP/%s',_0x557926['user']['name']);_0x9bb737[_0xa0a8('0x29')]['channel']=_0x4491f8[_0xa0a8('0x73')];_0x9bb737[_0xa0a8('0x29')][_0xa0a8('0x74')]=_0x4491f8['channel'];_0x9bb737[_0xa0a8('0x29')][_0xa0a8('0x75')]='reject';respondWithRpcPromise(_0xa0a8('0x76'),'EventManager',{'event':_0xa0a8('0x83'),'message':_[_0xa0a8('0x4f')](_0x4491f8[_0xa0a8('0x29')],JSON[_0xa0a8('0x77')](_0x4491f8['interaction'][_0xa0a8('0x78')]))},client9002);return _0x4491f8;}return null;})[_0xa0a8('0x23')](respondWithResult(_0x4f5f4f,null))['catch'](handleError(_0x4f5f4f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b24110b..f2875fc 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 _0xff10=['hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x543cb2,_0x1ae3ff){var _0x59e643=function(_0x5610bc){while(--_0x5610bc){_0x543cb2['push'](_0x543cb2['shift']());}};_0x59e643(++_0x1ae3ff);}(_0xff10,0x1e3));var _0x0ff1=function(_0x37358a,_0x4f1d21){_0x37358a=_0x37358a-0x0;var _0x511fbc=_0xff10[_0x37358a];return _0x511fbc;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x0ff1('0x0'))['db'][_0x0ff1('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0ff1('0x2')](0x0);var events={'afterCreate':_0x0ff1('0x3'),'afterUpdate':_0x0ff1('0x4'),'afterDestroy':_0x0ff1('0x5')};function emitEvent(_0x1e3efe){return function(_0x3dde9f,_0x2980af,_0x1d40ff){ChatMessageEvents['emit'](_0x1e3efe+':'+_0x3dde9f['id'],_0x3dde9f);ChatMessageEvents[_0x0ff1('0x6')](_0x1e3efe,_0x3dde9f);_0x1d40ff(null);};}for(var e in events){if(events[_0x0ff1('0x7')](e)){var event=events[e];ChatMessage[_0x0ff1('0x8')](e,emitEvent(event));}}module[_0x0ff1('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x2c4b=['events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','hasOwnProperty','hook','exports'];(function(_0x1394a2,_0x533264){var _0x31dcd1=function(_0x58c693){while(--_0x58c693){_0x1394a2['push'](_0x1394a2['shift']());}};_0x31dcd1(++_0x533264);}(_0x2c4b,0x1c2));var _0xb2c4=function(_0x1911bc,_0x10c83e){_0x1911bc=_0x1911bc-0x0;var _0x51ec6c=_0x2c4b[_0x1911bc];return _0x51ec6c;};'use strict';var EventEmitter=require(_0xb2c4('0x0'));var ChatMessage=require(_0xb2c4('0x1'))['db'][_0xb2c4('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb2c4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb2c4('0x4'),'afterDestroy':_0xb2c4('0x5')};function emitEvent(_0x5d1f9){return function(_0x30faec,_0x3b883b,_0x4de247){ChatMessageEvents['emit'](_0x5d1f9+':'+_0x30faec['id'],_0x30faec);ChatMessageEvents['emit'](_0x5d1f9,_0x30faec);_0x4de247(null);};}for(var e in events){if(events[_0xb2c4('0x6')](e)){var event=events[e];ChatMessage[_0xb2c4('0x7')](e,emitEvent(event));}}module[_0xb2c4('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 392b3d1..6b47f84 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 _0xea04=['chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xea04,0x1d1));var _0x4ea0=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xea04[_0x2d126e];return _0xcb04d3;};'use strict';var _=require(_0x4ea0('0x0'));var util=require(_0x4ea0('0x1'));var logger=require(_0x4ea0('0x2'))(_0x4ea0('0x3'));var moment=require('moment');var BPromise=require(_0x4ea0('0x4'));var rp=require(_0x4ea0('0x5'));var fs=require('fs');var path=require(_0x4ea0('0x6'));var rimraf=require(_0x4ea0('0x7'));var config=require(_0x4ea0('0x8'));var attributes=require('./chatMessage.attributes');module[_0x4ea0('0x9')]=function(_0x34752d,_0x565e45){return _0x34752d[_0x4ea0('0xa')]('ChatMessage',attributes,{'tableName':_0x4ea0('0xb'),'paranoid':![],'indexes':[{'name':_0x4ea0('0xc'),'fields':[_0x4ea0('0xd')],'type':_0x4ea0('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ac837,_0x3650d4,_0x436299){var _0x142be1=_0x34752d['models'];var _0x26666e=_0x5ac837[_0x4ea0('0xf')]({'plain':!![]});if(_0x26666e[_0x4ea0('0x10')]['toLowerCase']()==='in'||_0x26666e[_0x4ea0('0x10')][_0x4ea0('0x11')]()===_0x4ea0('0x12')&&!_0x26666e['secret']&&!_[_0x4ea0('0x13')](_0x26666e[_0x4ea0('0x14')])){_0x142be1[_0x4ea0('0x15')][_0x4ea0('0x16')]({'where':{'id':_0x26666e[_0x4ea0('0x17')]}})[_0x4ea0('0x18')](function(_0x55077a){if(_0x55077a){_0x55077a['update']({'lastMsgAt':_0x26666e[_0x4ea0('0x19')],'lastMsgDirection':_0x26666e[_0x4ea0('0x10')][_0x4ea0('0x11')]()});}})['catch'](function(_0x38efa7){console[_0x4ea0('0x1a')](_0x38efa7);});}_0x436299();}},'charset':'utf8mb4','collate':_0x4ea0('0x1b')});}; \ No newline at end of file +var _0x8185=['FULLTEXT','get','toLowerCase','direction','out','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','request-promise','rimraf','../../config/environment','exports','ChatMessage','chat_messages','body'];(function(_0xe84685,_0x595534){var _0x140b52=function(_0x5b9890){while(--_0x5b9890){_0xe84685['push'](_0xe84685['shift']());}};_0x140b52(++_0x595534);}(_0x8185,0xc6));var _0x5818=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x8185[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5818('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5818('0x3'));var config=require(_0x5818('0x4'));var attributes=require('./chatMessage.attributes');module[_0x5818('0x5')]=function(_0xbc4a17,_0x378891){return _0xbc4a17['define'](_0x5818('0x6'),attributes,{'tableName':_0x5818('0x7'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x5818('0x8')],'type':_0x5818('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x395d47,_0x5b6dcb,_0x388eb9){var _0x38cdea=_0xbc4a17['models'];var _0x22d280=_0x395d47[_0x5818('0xa')]({'plain':!![]});if(_0x22d280['direction'][_0x5818('0xb')]()==='in'||_0x22d280[_0x5818('0xc')][_0x5818('0xb')]()===_0x5818('0xd')&&!_0x22d280['secret']&&!_['isNil'](_0x22d280[_0x5818('0xe')])){_0x38cdea[_0x5818('0xf')][_0x5818('0x10')]({'where':{'id':_0x22d280[_0x5818('0x11')]}})[_0x5818('0x12')](function(_0x237211){if(_0x237211){_0x237211[_0x5818('0x13')]({'lastMsgAt':_0x22d280[_0x5818('0x14')],'lastMsgDirection':_0x22d280['direction']['toLowerCase']()});}})[_0x5818('0x15')](function(_0x1e62cd){console['error'](_0x1e62cd);});}_0x388eb9();}},'charset':_0x5818('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 005ff2f..3d8d30f 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 _0x2e08=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw'];(function(_0x2d3f32,_0xb531aa){var _0x26ab09=function(_0x4256c2){while(--_0x4256c2){_0x2d3f32['push'](_0x2d3f32['shift']());}};_0x26ab09(++_0xb531aa);}(_0x2e08,0x1ad));var _0x82e0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2e08[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x82e0('0x0'));var util=require('util');var moment=require(_0x82e0('0x1'));var BPromise=require(_0x82e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82e0('0x3'));var db=require(_0x82e0('0x4'))['db'];var utils=require(_0x82e0('0x5'));var logger=require(_0x82e0('0x6'))(_0x82e0('0x7'));var config=require(_0x82e0('0x8'));var jayson=require(_0x82e0('0x9'));var client=jayson['client'][_0x82e0('0xa')]({'port':0x232a});config[_0x82e0('0xb')]=_[_0x82e0('0xc')](config[_0x82e0('0xb')],{'host':_0x82e0('0xd'),'port':0x18eb});var socket=require(_0x82e0('0xe'))(new Redis(config[_0x82e0('0xb')]));require(_0x82e0('0xf'))['register'](socket);function respondWithRpcPromise(_0x578ed5,_0x5d846c,_0x51718e){return new BPromise(function(_0x1b7487,_0x5dea7c){return client['request'](_0x578ed5,_0x51718e)[_0x82e0('0x10')](function(_0x5dd63e){logger[_0x82e0('0x11')](_0x82e0('0x12'),_0x5d846c,_0x82e0('0x13'));logger[_0x82e0('0x14')](_0x82e0('0x15'),_0x5d846c,_0x82e0('0x13'),JSON[_0x82e0('0x16')](_0x5dd63e));if(_0x5dd63e['error']){if(_0x5dd63e[_0x82e0('0x17')][_0x82e0('0x18')]===0x1f4){logger[_0x82e0('0x17')](_0x82e0('0x12'),_0x5d846c,_0x5dd63e['error'][_0x82e0('0x19')]);return _0x5dea7c(_0x5dd63e[_0x82e0('0x17')][_0x82e0('0x19')]);}logger[_0x82e0('0x17')](_0x82e0('0x12'),_0x5d846c,_0x5dd63e[_0x82e0('0x17')][_0x82e0('0x19')]);return _0x1b7487(_0x5dd63e[_0x82e0('0x17')]['message']);}else{logger['info'](_0x82e0('0x12'),_0x5d846c,_0x82e0('0x13'));_0x1b7487(_0x5dd63e[_0x82e0('0x1a')][_0x82e0('0x19')]);}})[_0x82e0('0x1b')](function(_0x47fa17){logger[_0x82e0('0x17')]('ChatMessage,\x20%s,\x20%s',_0x5d846c,_0x47fa17);_0x5dea7c(_0x47fa17);});});}exports[_0x82e0('0x1c')]=function(_0x464bbe){var _0x16033b=this;return new Promise(function(_0x167e5f,_0x4fc214){return db[_0x82e0('0x1d')][_0x82e0('0x1e')](_0x464bbe['body'],{'raw':_0x464bbe['options']?_0x464bbe[_0x82e0('0x1f')][_0x82e0('0x20')]===undefined?!![]:![]:!![]})[_0x82e0('0x10')](function(_0x4ceeff){logger[_0x82e0('0x11')](_0x82e0('0x1c'),_0x464bbe);logger['debug']('CreateChatMessage',_0x464bbe,JSON[_0x82e0('0x16')](_0x4ceeff));_0x167e5f(_0x4ceeff);})[_0x82e0('0x1b')](function(_0x2f48e9){logger[_0x82e0('0x17')](_0x82e0('0x1c'),_0x2f48e9[_0x82e0('0x19')],_0x464bbe);_0x4fc214(_0x16033b[_0x82e0('0x17')](0x1f4,_0x2f48e9[_0x82e0('0x19')]));});});}; \ No newline at end of file +var _0x2db5=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','create','body','options','CreateChatMessage','util','randomstring','../../mysqldb','../../config/logger'];(function(_0x22867f,_0x458cf6){var _0x277c48=function(_0x5352c9){while(--_0x5352c9){_0x22867f['push'](_0x22867f['shift']());}};_0x277c48(++_0x458cf6);}(_0x2db5,0x168));var _0x52db=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x2db5[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require('lodash');var util=require(_0x52db('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52db('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52db('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x52db('0x3'))('rpc');var config=require(_0x52db('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x52db('0x5')][_0x52db('0x6')]({'port':0x232a});config[_0x52db('0x7')]=_[_0x52db('0x8')](config[_0x52db('0x7')],{'host':_0x52db('0x9'),'port':0x18eb});var socket=require(_0x52db('0xa'))(new Redis(config[_0x52db('0x7')]));require(_0x52db('0xb'))['register'](socket);function respondWithRpcPromise(_0x282668,_0x30bd02,_0x5bb510){return new BPromise(function(_0x4813a0,_0x2d1801){return client[_0x52db('0xc')](_0x282668,_0x5bb510)[_0x52db('0xd')](function(_0x1a24b2){logger[_0x52db('0xe')](_0x52db('0xf'),_0x30bd02,'request\x20sent');logger[_0x52db('0x10')](_0x52db('0x11'),_0x30bd02,_0x52db('0x12'),JSON[_0x52db('0x13')](_0x1a24b2));if(_0x1a24b2['error']){if(_0x1a24b2[_0x52db('0x14')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x30bd02,_0x1a24b2[_0x52db('0x14')][_0x52db('0x15')]);return _0x2d1801(_0x1a24b2['error'][_0x52db('0x15')]);}logger[_0x52db('0x14')]('ChatMessage,\x20%s,\x20%s',_0x30bd02,_0x1a24b2[_0x52db('0x14')][_0x52db('0x15')]);return _0x4813a0(_0x1a24b2['error']['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x30bd02,'request\x20sent');_0x4813a0(_0x1a24b2[_0x52db('0x16')]['message']);}})[_0x52db('0x17')](function(_0x15876b){logger['error'](_0x52db('0xf'),_0x30bd02,_0x15876b);_0x2d1801(_0x15876b);});});}exports['CreateChatMessage']=function(_0x2ab8c1){var _0x15b870=this;return new Promise(function(_0x3afed4,_0xf3bd26){return db['ChatMessage'][_0x52db('0x18')](_0x2ab8c1[_0x52db('0x19')],{'raw':_0x2ab8c1[_0x52db('0x1a')]?_0x2ab8c1[_0x52db('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x52db('0xd')](function(_0x47034f){logger[_0x52db('0xe')](_0x52db('0x1b'),_0x2ab8c1);logger[_0x52db('0x10')](_0x52db('0x1b'),_0x2ab8c1,JSON[_0x52db('0x13')](_0x47034f));_0x3afed4(_0x47034f);})[_0x52db('0x17')](function(_0x3864ea){logger[_0x52db('0x14')](_0x52db('0x1b'),_0x3864ea[_0x52db('0x15')],_0x2ab8c1);_0xf3bd26(_0x15b870['error'](0x1f4,_0x3864ea[_0x52db('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 06314ca..ab4b763 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 _0x1d25=['register','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1d25,0xba));var _0x51d2=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0x1d25[_0x4cce65];return _0x4d1b45;};'use strict';var ChatMessageEvents=require(_0x51d2('0x0'));var events=[_0x51d2('0x1'),_0x51d2('0x2'),_0x51d2('0x3')];function createListener(_0x17f896,_0x5aac21){return function(_0x1b276e){_0x5aac21[_0x51d2('0x4')](_0x17f896,_0x1b276e);};}function removeListener(_0x4c93f2,_0x1f9fc8){return function(){ChatMessageEvents[_0x51d2('0x5')](_0x4c93f2,_0x1f9fc8);};}exports[_0x51d2('0x6')]=function(_0x407091){for(var _0x449fec=0x0,_0x2e6956=events['length'];_0x449fec<_0x2e6956;_0x449fec++){var _0x18e8a9=events[_0x449fec];var _0x5a6b5f=createListener(_0x51d2('0x7')+_0x18e8a9,_0x407091);ChatMessageEvents['on'](_0x18e8a9,_0x5a6b5f);}}; \ No newline at end of file +var _0xc949=['chatMessage:','./chatMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x5eabd8,_0x528881){var _0x516fff=function(_0x1dd206){while(--_0x1dd206){_0x5eabd8['push'](_0x5eabd8['shift']());}};_0x516fff(++_0x528881);}(_0xc949,0x181));var _0x9c94=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xc949[_0x92c450];return _0x2a9599;};'use strict';var ChatMessageEvents=require(_0x9c94('0x0'));var events=['save',_0x9c94('0x1'),_0x9c94('0x2')];function createListener(_0x209cd8,_0x27613f){return function(_0x54facf){_0x27613f[_0x9c94('0x3')](_0x209cd8,_0x54facf);};}function removeListener(_0x231762,_0x528a17){return function(){ChatMessageEvents[_0x9c94('0x4')](_0x231762,_0x528a17);};}exports[_0x9c94('0x5')]=function(_0x46d560){for(var _0x1357ac=0x0,_0x57fcd7=events[_0x9c94('0x6')];_0x1357ac<_0x57fcd7;_0x1357ac++){var _0x360e7b=events[_0x1357ac];var _0x25ecd0=createListener(_0x9c94('0x7')+_0x360e7b,_0x46d560);ChatMessageEvents['on'](_0x360e7b,_0x25ecd0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 5edc8d2..04cc122 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 _0x9d61=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x3cdc14,_0x4e660f){var _0x59576c=function(_0x522f9c){while(--_0x522f9c){_0x3cdc14['push'](_0x3cdc14['shift']());}};_0x59576c(++_0x4e660f);}(_0x9d61,0xef));var _0x19d6=function(_0x3d805b,_0x46fe6d){_0x3d805b=_0x3d805b-0x0;var _0x5ddaf6=_0x9d61[_0x3d805b];return _0x5ddaf6;};'use strict';var multer=require('multer');var util=require(_0x19d6('0x0'));var path=require(_0x19d6('0x1'));var timeout=require(_0x19d6('0x2'));var express=require(_0x19d6('0x3'));var router=express[_0x19d6('0x4')]();var fs_extra=require(_0x19d6('0x5'));var auth=require(_0x19d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x19d6('0x7'));var controller=require(_0x19d6('0x8'));router[_0x19d6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x19d6('0x9')]('/describe',auth[_0x19d6('0xa')](),controller[_0x19d6('0xb')]);router[_0x19d6('0x9')](_0x19d6('0xc'),auth[_0x19d6('0xa')](),controller[_0x19d6('0xd')]);router[_0x19d6('0xe')]('/',auth['isAuthenticated'](),interaction[_0x19d6('0xf')](_0x19d6('0x10'),'chatmessage:create'),controller[_0x19d6('0x11')]);router[_0x19d6('0x12')]('/:id',controller[_0x19d6('0x13')]);router['put'](_0x19d6('0x14'),auth['isAuthenticated'](),controller[_0x19d6('0x15')]);router[_0x19d6('0x12')](_0x19d6('0x16'),auth[_0x19d6('0xa')](),controller[_0x19d6('0x17')]);router[_0x19d6('0x18')](_0x19d6('0xc'),auth[_0x19d6('0xa')](),controller[_0x19d6('0x19')]);module[_0x19d6('0x1a')]=router; \ No newline at end of file +var _0x564a=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x5b0f2d,_0x1c4b73){var _0x5eb577=function(_0x1db0cf){while(--_0x1db0cf){_0x5b0f2d['push'](_0x5b0f2d['shift']());}};_0x5eb577(++_0x1c4b73);}(_0x564a,0x1b9));var _0xa564=function(_0x2de98d,_0x4e4d8a){_0x2de98d=_0x2de98d-0x0;var _0x2068aa=_0x564a[_0x2de98d];return _0x2068aa;};'use strict';var multer=require(_0xa564('0x0'));var util=require(_0xa564('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa564('0x2'));var router=express['Router']();var fs_extra=require(_0xa564('0x3'));var auth=require(_0xa564('0x4'));var interaction=require(_0xa564('0x5'));var config=require(_0xa564('0x6'));var controller=require('./chatMessage.controller');router[_0xa564('0x7')]('/',auth[_0xa564('0x8')](),controller[_0xa564('0x9')]);router[_0xa564('0x7')](_0xa564('0xa'),auth[_0xa564('0x8')](),controller[_0xa564('0xb')]);router[_0xa564('0x7')](_0xa564('0xc'),auth[_0xa564('0x8')](),controller[_0xa564('0xd')]);router[_0xa564('0xe')]('/',auth[_0xa564('0x8')](),interaction[_0xa564('0xf')](_0xa564('0x10'),_0xa564('0x11')),controller['create']);router['put'](_0xa564('0xc'),controller['update']);router[_0xa564('0x12')](_0xa564('0x13'),auth[_0xa564('0x8')](),controller[_0xa564('0x14')]);router[_0xa564('0x12')](_0xa564('0x15'),auth[_0xa564('0x8')](),controller[_0xa564('0x16')]);router[_0xa564('0x17')](_0xa564('0xc'),auth[_0xa564('0x8')](),controller[_0xa564('0x18')]);module[_0xa564('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index cefbcd5..3fea8d0 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(_0x5d93ba,_0x94099a){var _0x2a9700=function(_0x59349e){while(--_0x59349e){_0x5d93ba['push'](_0x5d93ba['shift']());}};_0x2a9700(++_0x94099a);}(_0xadb5,0xad));var _0x5adb=function(_0x1ef775,_0x3385cc){_0x1ef775=_0x1ef775-0x0;var _0x7d5bb5=_0xadb5[_0x1ef775];return _0x7d5bb5;};'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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x0b0e[_0x5d6270];return _0x168f26;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index a65b764..6390df5 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x124059,_0xbb6646){_0x124059=_0x124059-0x0;var _0x2ec940=_0x7a54[_0x124059];return _0x2ec940;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0xcdb486,_0x3acddd){var _0xff64cc=function(_0x2fec2a){while(--_0x2fec2a){_0xcdb486['push'](_0xcdb486['shift']());}};_0xff64cc(++_0x3acddd);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index a9c5983..4bc446c 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 _0x6f08=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','emit'];(function(_0x13d0e0,_0x2a661b){var _0x18deff=function(_0x396cd1){while(--_0x396cd1){_0x13d0e0['push'](_0x13d0e0['shift']());}};_0x18deff(++_0x2a661b);}(_0x6f08,0x9c));var _0x86f0=function(_0x133df4,_0x8e2c46){_0x133df4=_0x133df4-0x0;var _0xcd2945=_0x6f08[_0x133df4];return _0xcd2945;};'use strict';var EventEmitter=require(_0x86f0('0x0'));var ChatOfflineMessage=require(_0x86f0('0x1'))['db'][_0x86f0('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x86f0('0x3')](0x0);var events={'afterCreate':_0x86f0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x145e17){return function(_0x5bd276,_0x167900,_0x1a07a6){ChatOfflineMessageEvents[_0x86f0('0x5')](_0x145e17+':'+_0x5bd276['id'],_0x5bd276);ChatOfflineMessageEvents[_0x86f0('0x5')](_0x145e17,_0x5bd276);_0x1a07a6(null);};}for(var e in events){if(events[_0x86f0('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x86f0('0x7')](e,emitEvent(event));}}module[_0x86f0('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x71d8=['setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x743701,_0x3e67bb){var _0x5a141d=function(_0x4b198d){while(--_0x4b198d){_0x743701['push'](_0x743701['shift']());}};_0x5a141d(++_0x3e67bb);}(_0x71d8,0x8d));var _0x871d=function(_0x40de6f,_0x34678d){_0x40de6f=_0x40de6f-0x0;var _0x5504a4=_0x71d8[_0x40de6f];return _0x5504a4;};'use strict';var EventEmitter=require(_0x871d('0x0'));var ChatOfflineMessage=require(_0x871d('0x1'))['db'][_0x871d('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x871d('0x3')](0x0);var events={'afterCreate':_0x871d('0x4'),'afterUpdate':_0x871d('0x5'),'afterDestroy':_0x871d('0x6')};function emitEvent(_0x36c79b){return function(_0x2c0dbf,_0x3fbfb0,_0x5ae963){ChatOfflineMessageEvents[_0x871d('0x7')](_0x36c79b+':'+_0x2c0dbf['id'],_0x2c0dbf);ChatOfflineMessageEvents[_0x871d('0x7')](_0x36c79b,_0x2c0dbf);_0x5ae963(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x871d('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c2549cf..c5ebcaa 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 _0x2f57=['./chatOfflineMessage.attributes','exports','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x27a55b,_0x14515b){var _0x2858b1=function(_0x42cf4b){while(--_0x42cf4b){_0x27a55b['push'](_0x27a55b['shift']());}};_0x2858b1(++_0x14515b);}(_0x2f57,0x17c));var _0x72f5=function(_0x3daf10,_0x297173){_0x3daf10=_0x3daf10-0x0;var _0x52eab6=_0x2f57[_0x3daf10];return _0x52eab6;};'use strict';var attributes=require(_0x72f5('0x0'));module[_0x72f5('0x1')]=function(_0xc45d7b){return _0xc45d7b['define'](_0x72f5('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72f5('0x3'),'collate':_0x72f5('0x4')});}; \ No newline at end of file +var _0x19ff=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x19ff,0xb1));var _0xf19f=function(_0x25dc3a,_0x1680bf){_0x25dc3a=_0x25dc3a-0x0;var _0x308ae4=_0x19ff[_0x25dc3a];return _0x308ae4;};'use strict';var attributes=require(_0xf19f('0x0'));module[_0xf19f('0x1')]=function(_0x306752){return _0x306752[_0xf19f('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xf19f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf19f('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 246ae4d..919734a 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 _0xca1d=['../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','randomstring','../../mysqldb'];(function(_0x2c90d4,_0x5abd07){var _0x1cbdfc=function(_0x29ed88){while(--_0x29ed88){_0x2c90d4['push'](_0x2c90d4['shift']());}};_0x1cbdfc(++_0x5abd07);}(_0xca1d,0x73));var _0xdca1=function(_0x1cc8fa,_0x317251){_0x1cc8fa=_0x1cc8fa-0x0;var _0x253909=_0xca1d[_0x1cc8fa];return _0x253909;};'use strict';var _=require(_0xdca1('0x0'));var util=require('util');var moment=require(_0xdca1('0x1'));var BPromise=require('bluebird');var rs=require(_0xdca1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdca1('0x3'))['db'];var utils=require(_0xdca1('0x4'));var logger=require(_0xdca1('0x5'))('rpc');var config=require(_0xdca1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdca1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa1b001,_0x5da7ee,_0x40c56d){return new BPromise(function(_0x4d20be,_0x1907ad){return client[_0xdca1('0x8')](_0xa1b001,_0x40c56d)[_0xdca1('0x9')](function(_0x235744){logger[_0xdca1('0xa')](_0xdca1('0xb'),_0x5da7ee,_0xdca1('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5da7ee,_0xdca1('0xc'),JSON[_0xdca1('0xd')](_0x235744));if(_0x235744[_0xdca1('0xe')]){if(_0x235744[_0xdca1('0xe')]['code']===0x1f4){logger[_0xdca1('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5da7ee,_0x235744[_0xdca1('0xe')][_0xdca1('0xf')]);return _0x1907ad(_0x235744[_0xdca1('0xe')][_0xdca1('0xf')]);}logger[_0xdca1('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5da7ee,_0x235744['error'][_0xdca1('0xf')]);return _0x4d20be(_0x235744['error'][_0xdca1('0xf')]);}else{logger[_0xdca1('0xa')](_0xdca1('0xb'),_0x5da7ee,_0xdca1('0xc'));_0x4d20be(_0x235744[_0xdca1('0x10')][_0xdca1('0xf')]);}})['catch'](function(_0x187da2){logger[_0xdca1('0xe')](_0xdca1('0xb'),_0x5da7ee,_0x187da2);_0x1907ad(_0x187da2);});});} \ No newline at end of file +var _0x6dc0=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x57f59b,_0x42714b){var _0x5af741=function(_0x3b1029){while(--_0x3b1029){_0x57f59b['push'](_0x57f59b['shift']());}};_0x5af741(++_0x42714b);}(_0x6dc0,0x18c));var _0x06dc=function(_0x54f978,_0x3a6b7e){_0x54f978=_0x54f978-0x0;var _0x5d40b3=_0x6dc0[_0x54f978];return _0x5d40b3;};'use strict';var _=require(_0x06dc('0x0'));var util=require('util');var moment=require(_0x06dc('0x1'));var BPromise=require(_0x06dc('0x2'));var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x06dc('0x6'));var config=require(_0x06dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x8')][_0x06dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ac3b4,_0x1a34e5,_0x523fb5){return new BPromise(function(_0xeac52b,_0x428751){return client[_0x06dc('0xa')](_0x4ac3b4,_0x523fb5)[_0x06dc('0xb')](function(_0x4539c2){logger['info'](_0x06dc('0xc'),_0x1a34e5,'request\x20sent');logger[_0x06dc('0xd')](_0x06dc('0xe'),_0x1a34e5,'request\x20sent',JSON[_0x06dc('0xf')](_0x4539c2));if(_0x4539c2[_0x06dc('0x10')]){if(_0x4539c2[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error'](_0x06dc('0xc'),_0x1a34e5,_0x4539c2[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x428751(_0x4539c2[_0x06dc('0x10')][_0x06dc('0x12')]);}logger['error'](_0x06dc('0xc'),_0x1a34e5,_0x4539c2[_0x06dc('0x10')][_0x06dc('0x12')]);return _0xeac52b(_0x4539c2[_0x06dc('0x10')][_0x06dc('0x12')]);}else{logger[_0x06dc('0x13')](_0x06dc('0xc'),_0x1a34e5,'request\x20sent');_0xeac52b(_0x4539c2[_0x06dc('0x14')][_0x06dc('0x12')]);}})[_0x06dc('0x15')](function(_0x5bc9d9){logger[_0x06dc('0x10')](_0x06dc('0xc'),_0x1a34e5,_0x5bc9d9);_0x428751(_0x5bc9d9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 37470dc..b448c4d 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 _0xaba2=['describe','show','post','create','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaba2,0x121));var _0x2aba=function(_0x835816,_0x280a54){_0x835816=_0x835816-0x0;var _0x1f24b2=_0xaba2[_0x835816];return _0x1f24b2;};'use strict';var multer=require('multer');var util=require(_0x2aba('0x0'));var path=require('path');var timeout=require(_0x2aba('0x1'));var express=require(_0x2aba('0x2'));var router=express[_0x2aba('0x3')]();var fs_extra=require(_0x2aba('0x4'));var auth=require(_0x2aba('0x5'));var interaction=require(_0x2aba('0x6'));var config=require(_0x2aba('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x2aba('0x8')]('/',auth[_0x2aba('0x9')](),controller[_0x2aba('0xa')]);router[_0x2aba('0x8')]('/describe',auth[_0x2aba('0x9')](),controller[_0x2aba('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2aba('0xc')]);router[_0x2aba('0xd')]('/',auth[_0x2aba('0x9')](),controller[_0x2aba('0xe')]);router[_0x2aba('0xf')](_0x2aba('0x10'),auth[_0x2aba('0x9')](),controller[_0x2aba('0x11')]);router['delete'](_0x2aba('0x10'),auth[_0x2aba('0x9')](),controller[_0x2aba('0x12')]);module[_0x2aba('0x13')]=router; \ No newline at end of file +var _0xefea=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xefea,0x1b7));var _0xaefe=function(_0xb4faab,_0x75ad0a){_0xb4faab=_0xb4faab-0x0;var _0x169347=_0xefea[_0xb4faab];return _0x169347;};'use strict';var multer=require(_0xaefe('0x0'));var util=require(_0xaefe('0x1'));var path=require(_0xaefe('0x2'));var timeout=require(_0xaefe('0x3'));var express=require(_0xaefe('0x4'));var router=express['Router']();var fs_extra=require(_0xaefe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaefe('0x6'));var config=require(_0xaefe('0x7'));var controller=require(_0xaefe('0x8'));router[_0xaefe('0x9')]('/',auth[_0xaefe('0xa')](),controller[_0xaefe('0xb')]);router[_0xaefe('0x9')](_0xaefe('0xc'),auth[_0xaefe('0xa')](),controller[_0xaefe('0xd')]);router[_0xaefe('0x9')](_0xaefe('0xe'),auth[_0xaefe('0xa')](),controller[_0xaefe('0xf')]);router[_0xaefe('0x10')]('/',auth['isAuthenticated'](),controller[_0xaefe('0x11')]);router[_0xaefe('0x12')](_0xaefe('0xe'),auth[_0xaefe('0xa')](),controller[_0xaefe('0x13')]);router[_0xaefe('0x14')]('/:id',auth[_0xaefe('0xa')](),controller[_0xaefe('0x15')]);module[_0xaefe('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b9f35eb..d26017f 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 _0x4184=['timeout','exports'];(function(_0x1ffe50,_0x3070ff){var _0x4e5bf0=function(_0x4d6af8){while(--_0x4d6af8){_0x1ffe50['push'](_0x1ffe50['shift']());}};_0x4e5bf0(++_0x3070ff);}(_0x4184,0x18f));var _0x4418=function(_0x558bae,_0x387878){_0x558bae=_0x558bae-0x0;var _0x34cc15=_0x4184[_0x558bae];return _0x34cc15;};'use strict';var Sequelize=require('sequelize');module[_0x4418('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x4418('0x1')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdb78=['ENUM','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x44e372,_0x145cb8){var _0x48eedb=function(_0x316f3d){while(--_0x316f3d){_0x44e372['push'](_0x44e372['shift']());}};_0x48eedb(++_0x145cb8);}(_0xdb78,0xd5));var _0x8db7=function(_0x14fb9c,_0x28415b){_0x14fb9c=_0x14fb9c-0x0;var _0x20bb3c=_0xdb78[_0x14fb9c];return _0x20bb3c;};'use strict';var Sequelize=require(_0x8db7('0x0'));module[_0x8db7('0x1')]={'name':{'type':Sequelize[_0x8db7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8db7('0x3')](_0x8db7('0x4'),'timeout'),'defaultValue':_0x8db7('0x4')},'selector':{'type':Sequelize[_0x8db7('0x2')]},'timeout':{'type':Sequelize[_0x8db7('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 20b8b1e..21eb39c 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 _0x26d1=['stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','error'];(function(_0x521276,_0x4ea725){var _0x291e1f=function(_0x1153ab){while(--_0x1153ab){_0x521276['push'](_0x521276['shift']());}};_0x291e1f(++_0x4ea725);}(_0x26d1,0x8e));var _0x126d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x26d1[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x126d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x126d('0x1'));var jsonpatch=require(_0x126d('0x2'));var rp=require(_0x126d('0x3'));var moment=require(_0x126d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x126d('0x5'));var path=require('path');var sox=require(_0x126d('0x6'));var csv=require(_0x126d('0x7'));var ejs=require(_0x126d('0x8'));var fs=require('fs');var fs_extra=require(_0x126d('0x9'));var _=require(_0x126d('0xa'));var squel=require('squel');var crypto=require(_0x126d('0xb'));var jsforce=require(_0x126d('0xc'));var deskjs=require(_0x126d('0xd'));var toCsv=require(_0x126d('0x7'));var querystring=require(_0x126d('0xe'));var Papa=require(_0x126d('0xf'));var Redis=require(_0x126d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x126d('0x11'));var as=require(_0x126d('0x12'));var hardwareService=require(_0x126d('0x13'));var logger=require(_0x126d('0x14'))(_0x126d('0x15'));var utils=require('../../config/utils');var config=require(_0x126d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x126d('0x17'))['db'];function respondWithStatusCode(_0x2b755f,_0x455539){_0x455539=_0x455539||0xcc;return function(_0x55bf88){if(_0x55bf88){return _0x2b755f[_0x126d('0x18')](_0x455539);}return _0x2b755f[_0x126d('0x19')](_0x455539)[_0x126d('0x1a')]();};}function respondWithResult(_0x56c1e3,_0x5afc73){_0x5afc73=_0x5afc73||0xc8;return function(_0x2593c2){if(_0x2593c2){return _0x56c1e3[_0x126d('0x19')](_0x5afc73)[_0x126d('0x1b')](_0x2593c2);}};}function respondWithFilteredResult(_0x138223,_0x391eb2){return function(_0x2fa3c7){if(_0x2fa3c7){var _0x517b88=typeof _0x391eb2[_0x126d('0x1c')]==='undefined'&&typeof _0x391eb2[_0x126d('0x1d')]==='undefined';var _0x2915a4=_0x2fa3c7[_0x126d('0x1e')];var _0x55aa9d=_0x517b88?0x0:_0x391eb2[_0x126d('0x1c')];var _0x52d014=_0x517b88?_0x2fa3c7[_0x126d('0x1e')]:_0x391eb2['offset']+_0x391eb2['limit'];var _0x49bf93;if(_0x52d014>=_0x2915a4){_0x52d014=_0x2915a4;_0x49bf93=0xc8;}else{_0x49bf93=0xce;}_0x138223[_0x126d('0x19')](_0x49bf93);return _0x138223[_0x126d('0x1f')](_0x126d('0x20'),_0x55aa9d+'-'+_0x52d014+'/'+_0x2915a4)[_0x126d('0x1b')](_0x2fa3c7);}return null;};}function patchUpdates(_0x50ced7){return function(_0x1b64d8){try{jsonpatch[_0x126d('0x21')](_0x1b64d8,_0x50ced7,!![]);}catch(_0x50508e){return BPromise['reject'](_0x50508e);}return _0x1b64d8['save']();};}function saveUpdates(_0x1c2a07,_0x30593f){return function(_0x485d57){if(_0x485d57){return _0x485d57[_0x126d('0x22')](_0x1c2a07)[_0x126d('0x23')](function(_0x36603e){return _0x36603e;});}return null;};}function removeEntity(_0x307345,_0x4fd847){return function(_0x2ae562){if(_0x2ae562){return _0x2ae562[_0x126d('0x24')]()[_0x126d('0x23')](function(){_0x307345[_0x126d('0x19')](0xcc)[_0x126d('0x1a')]();});}};}function handleEntityNotFound(_0x2b1734,_0x55fb97){return function(_0x5e8f95){if(!_0x5e8f95){_0x2b1734[_0x126d('0x18')](0x194);}return _0x5e8f95;};}function handleError(_0x4d7b36,_0x5d8ad9){_0x5d8ad9=_0x5d8ad9||0x1f4;return function(_0x269588){logger[_0x126d('0x25')](_0x269588[_0x126d('0x26')]);if(_0x269588[_0x126d('0x27')]){delete _0x269588[_0x126d('0x27')];}_0x4d7b36[_0x126d('0x19')](_0x5d8ad9)[_0x126d('0x28')](_0x269588);};}exports[_0x126d('0x29')]=function(_0x26a6b9,_0x3f2c3d){var _0x288868={'raw':!![],'where':{'id':_0x26a6b9['params']['id']}},_0x12e553={};_0x12e553[_0x126d('0x2a')]=_[_0x126d('0x2b')](db[_0x126d('0x2c')][_0x126d('0x2d')]);_0x12e553[_0x126d('0x2e')]=_[_0x126d('0x2b')](_0x26a6b9[_0x126d('0x2e')]);_0x12e553[_0x126d('0x2f')]=_['intersection'](_0x12e553[_0x126d('0x2a')],_0x12e553[_0x126d('0x2e')]);_0x288868[_0x126d('0x30')]=_[_0x126d('0x31')](_0x12e553[_0x126d('0x2a')],qs[_0x126d('0x32')](_0x26a6b9['query'][_0x126d('0x32')]));_0x288868[_0x126d('0x30')]=_0x288868[_0x126d('0x30')][_0x126d('0x33')]?_0x288868[_0x126d('0x30')]:_0x12e553['model'];if(_0x26a6b9[_0x126d('0x2e')][_0x126d('0x34')]){_0x288868['include']=[{'all':!![]}];}_0x288868=_[_0x126d('0x35')]({},_0x288868,_0x26a6b9[_0x126d('0x36')]);return db[_0x126d('0x2c')][_0x126d('0x37')](_0x288868)[_0x126d('0x23')](handleEntityNotFound(_0x3f2c3d,null))[_0x126d('0x23')](respondWithResult(_0x3f2c3d,null))[_0x126d('0x38')](handleError(_0x3f2c3d,null));};exports['create']=function(_0x4e19ee,_0x322c91){return db[_0x126d('0x2c')][_0x126d('0x39')](_0x4e19ee[_0x126d('0x3a')],{})['then'](respondWithResult(_0x322c91,0xc9))[_0x126d('0x38')](handleError(_0x322c91,null));};exports[_0x126d('0x22')]=function(_0x16b61a,_0x10ee01){if(_0x16b61a[_0x126d('0x3a')]['id']){delete _0x16b61a[_0x126d('0x3a')]['id'];}return db['ChatProactiveAction'][_0x126d('0x37')]({'where':{'id':_0x16b61a[_0x126d('0x3b')]['id']}})[_0x126d('0x23')](handleEntityNotFound(_0x10ee01,null))[_0x126d('0x23')](saveUpdates(_0x16b61a[_0x126d('0x3a')],null))[_0x126d('0x23')](respondWithResult(_0x10ee01,null))['catch'](handleError(_0x10ee01,null));};exports[_0x126d('0x24')]=function(_0x13dffa,_0x1572bc){return db[_0x126d('0x2c')][_0x126d('0x37')]({'where':{'id':_0x13dffa['params']['id']}})[_0x126d('0x23')](handleEntityNotFound(_0x1572bc,null))[_0x126d('0x23')](removeEntity(_0x1572bc,null))['catch'](handleError(_0x1572bc,null));}; \ No newline at end of file +var _0x28e3=['reject','save','update','then','destroy','error','name','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x28e3,0x106));var _0x328e=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x28e3[_0x32b993];return _0x482780;};'use strict';var emlformat=require(_0x328e('0x0'));var rimraf=require(_0x328e('0x1'));var zipdir=require(_0x328e('0x2'));var jsonpatch=require(_0x328e('0x3'));var rp=require('request-promise');var moment=require(_0x328e('0x4'));var BPromise=require(_0x328e('0x5'));var Mustache=require(_0x328e('0x6'));var util=require(_0x328e('0x7'));var path=require(_0x328e('0x8'));var sox=require(_0x328e('0x9'));var csv=require(_0x328e('0xa'));var ejs=require(_0x328e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x328e('0xc'));var jsforce=require(_0x328e('0xd'));var deskjs=require(_0x328e('0xe'));var toCsv=require(_0x328e('0xa'));var querystring=require(_0x328e('0xf'));var Papa=require('papaparse');var Redis=require(_0x328e('0x10'));var authService=require(_0x328e('0x11'));var qs=require(_0x328e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x328e('0x13'));var utils=require(_0x328e('0x14'));var config=require(_0x328e('0x15'));var licenseUtil=require(_0x328e('0x16'));var db=require(_0x328e('0x17'))['db'];function respondWithStatusCode(_0x45cda0,_0x4699ec){_0x4699ec=_0x4699ec||0xcc;return function(_0x39338e){if(_0x39338e){return _0x45cda0[_0x328e('0x18')](_0x4699ec);}return _0x45cda0[_0x328e('0x19')](_0x4699ec)[_0x328e('0x1a')]();};}function respondWithResult(_0x4abd75,_0x89600b){_0x89600b=_0x89600b||0xc8;return function(_0x1cddc3){if(_0x1cddc3){return _0x4abd75[_0x328e('0x19')](_0x89600b)[_0x328e('0x1b')](_0x1cddc3);}};}function respondWithFilteredResult(_0x29f8bf,_0x397b16){return function(_0x2a8096){if(_0x2a8096){var _0x3c5b37=typeof _0x397b16[_0x328e('0x1c')]==='undefined'&&typeof _0x397b16[_0x328e('0x1d')]===_0x328e('0x1e');var _0x116f46=_0x2a8096[_0x328e('0x1f')];var _0xf69c0f=_0x3c5b37?0x0:_0x397b16[_0x328e('0x1c')];var _0x41a6bb=_0x3c5b37?_0x2a8096['count']:_0x397b16[_0x328e('0x1c')]+_0x397b16[_0x328e('0x1d')];var _0x448f5a;if(_0x41a6bb>=_0x116f46){_0x41a6bb=_0x116f46;_0x448f5a=0xc8;}else{_0x448f5a=0xce;}_0x29f8bf[_0x328e('0x19')](_0x448f5a);return _0x29f8bf[_0x328e('0x20')]('Content-Range',_0xf69c0f+'-'+_0x41a6bb+'/'+_0x116f46)[_0x328e('0x1b')](_0x2a8096);}return null;};}function patchUpdates(_0x1c5551){return function(_0x3d876b){try{jsonpatch['apply'](_0x3d876b,_0x1c5551,!![]);}catch(_0x35da3b){return BPromise[_0x328e('0x21')](_0x35da3b);}return _0x3d876b[_0x328e('0x22')]();};}function saveUpdates(_0x273b45,_0x233bd3){return function(_0x1c43f8){if(_0x1c43f8){return _0x1c43f8[_0x328e('0x23')](_0x273b45)[_0x328e('0x24')](function(_0x3878d7){return _0x3878d7;});}return null;};}function removeEntity(_0x5cbc7f,_0x4e1d4c){return function(_0x139ef3){if(_0x139ef3){return _0x139ef3[_0x328e('0x25')]()[_0x328e('0x24')](function(){_0x5cbc7f[_0x328e('0x19')](0xcc)[_0x328e('0x1a')]();});}};}function handleEntityNotFound(_0x4a62a8,_0x23fda2){return function(_0x48a854){if(!_0x48a854){_0x4a62a8[_0x328e('0x18')](0x194);}return _0x48a854;};}function handleError(_0x476b6a,_0x28da22){_0x28da22=_0x28da22||0x1f4;return function(_0x2fab5a){logger[_0x328e('0x26')](_0x2fab5a['stack']);if(_0x2fab5a['name']){delete _0x2fab5a[_0x328e('0x27')];}_0x476b6a['status'](_0x28da22)['send'](_0x2fab5a);};}exports[_0x328e('0x28')]=function(_0x270d58,_0x5873d1){var _0x232ec7={'raw':!![],'where':{'id':_0x270d58['params']['id']}},_0x1fdc4d={};_0x1fdc4d[_0x328e('0x29')]=_[_0x328e('0x2a')](db[_0x328e('0x2b')][_0x328e('0x2c')]);_0x1fdc4d[_0x328e('0x2d')]=_['keys'](_0x270d58[_0x328e('0x2d')]);_0x1fdc4d[_0x328e('0x2e')]=_[_0x328e('0x2f')](_0x1fdc4d[_0x328e('0x29')],_0x1fdc4d[_0x328e('0x2d')]);_0x232ec7[_0x328e('0x30')]=_[_0x328e('0x2f')](_0x1fdc4d[_0x328e('0x29')],qs[_0x328e('0x31')](_0x270d58['query']['fields']));_0x232ec7[_0x328e('0x30')]=_0x232ec7[_0x328e('0x30')]['length']?_0x232ec7['attributes']:_0x1fdc4d['model'];if(_0x270d58[_0x328e('0x2d')][_0x328e('0x32')]){_0x232ec7[_0x328e('0x33')]=[{'all':!![]}];}_0x232ec7=_[_0x328e('0x34')]({},_0x232ec7,_0x270d58[_0x328e('0x35')]);return db[_0x328e('0x2b')][_0x328e('0x36')](_0x232ec7)['then'](handleEntityNotFound(_0x5873d1,null))[_0x328e('0x24')](respondWithResult(_0x5873d1,null))['catch'](handleError(_0x5873d1,null));};exports['create']=function(_0x25f1ba,_0x479bda){return db[_0x328e('0x2b')][_0x328e('0x37')](_0x25f1ba[_0x328e('0x38')],{})['then'](respondWithResult(_0x479bda,0xc9))[_0x328e('0x39')](handleError(_0x479bda,null));};exports['update']=function(_0x2ba70c,_0x38ebdc){if(_0x2ba70c[_0x328e('0x38')]['id']){delete _0x2ba70c[_0x328e('0x38')]['id'];}return db['ChatProactiveAction'][_0x328e('0x36')]({'where':{'id':_0x2ba70c['params']['id']}})[_0x328e('0x24')](handleEntityNotFound(_0x38ebdc,null))['then'](saveUpdates(_0x2ba70c['body'],null))[_0x328e('0x24')](respondWithResult(_0x38ebdc,null))['catch'](handleError(_0x38ebdc,null));};exports[_0x328e('0x25')]=function(_0x3c8a91,_0x1892e0){return db[_0x328e('0x2b')]['find']({'where':{'id':_0x3c8a91[_0x328e('0x3a')]['id']}})[_0x328e('0x24')](handleEntityNotFound(_0x1892e0,null))[_0x328e('0x24')](removeEntity(_0x1892e0,null))[_0x328e('0x39')](handleError(_0x1892e0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0914ee7..6d620ff 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 _0x3b35=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash'];(function(_0x35f281,_0x29a43a){var _0x24fc38=function(_0x153bbc){while(--_0x153bbc){_0x35f281['push'](_0x35f281['shift']());}};_0x24fc38(++_0x29a43a);}(_0x3b35,0x16b));var _0x53b3=function(_0x177411,_0x1d7f65){_0x177411=_0x177411-0x0;var _0x228e40=_0x3b35[_0x177411];return _0x228e40;};'use strict';var _=require(_0x53b3('0x0'));var util=require(_0x53b3('0x1'));var logger=require(_0x53b3('0x2'))(_0x53b3('0x3'));var moment=require('moment');var BPromise=require(_0x53b3('0x4'));var rp=require(_0x53b3('0x5'));var fs=require('fs');var path=require(_0x53b3('0x6'));var rimraf=require(_0x53b3('0x7'));var config=require(_0x53b3('0x8'));var attributes=require(_0x53b3('0x9'));module[_0x53b3('0xa')]=function(_0x2cf15d,_0x5ac6e2){return _0x2cf15d[_0x53b3('0xb')](_0x53b3('0xc'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16ec=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c16c8,_0x55e700){var _0x341900=function(_0x3c2147){while(--_0x3c2147){_0x3c16c8['push'](_0x3c16c8['shift']());}};_0x341900(++_0x55e700);}(_0x16ec,0xf7));var _0xc16e=function(_0x43372b,_0x3b6502){_0x43372b=_0x43372b-0x0;var _0x436caa=_0x16ec[_0x43372b];return _0x436caa;};'use strict';var _=require(_0xc16e('0x0'));var util=require(_0xc16e('0x1'));var logger=require(_0xc16e('0x2'))(_0xc16e('0x3'));var moment=require(_0xc16e('0x4'));var BPromise=require(_0xc16e('0x5'));var rp=require(_0xc16e('0x6'));var fs=require('fs');var path=require(_0xc16e('0x7'));var rimraf=require(_0xc16e('0x8'));var config=require(_0xc16e('0x9'));var attributes=require(_0xc16e('0xa'));module[_0xc16e('0xb')]=function(_0x14086f,_0x3aad42){return _0x14086f[_0xc16e('0xc')](_0xc16e('0xd'),attributes,{'tableName':_0xc16e('0xe'),'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 0b8ba2b..c865d6e 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 _0xd804=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3b8e21,_0x382a4f){var _0x4aa19d=function(_0x4c91df){while(--_0x4c91df){_0x3b8e21['push'](_0x3b8e21['shift']());}};_0x4aa19d(++_0x382a4f);}(_0xd804,0xc5));var _0x4d80=function(_0xc971e4,_0x52e221){_0xc971e4=_0xc971e4-0x0;var _0x2a1649=_0xd804[_0xc971e4];return _0x2a1649;};'use strict';var _=require(_0x4d80('0x0'));var util=require(_0x4d80('0x1'));var moment=require(_0x4d80('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d80('0x3'));var fs=require('fs');var Redis=require(_0x4d80('0x4'));var db=require(_0x4d80('0x5'))['db'];var utils=require(_0x4d80('0x6'));var logger=require('../../config/logger')(_0x4d80('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d80('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2df209,_0x293237,_0x77efd9){return new BPromise(function(_0x1a4da5,_0x4e08df){return client[_0x4d80('0x9')](_0x2df209,_0x77efd9)[_0x4d80('0xa')](function(_0xf916e5){logger[_0x4d80('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x293237,_0x4d80('0xc'));logger[_0x4d80('0xd')](_0x4d80('0xe'),_0x293237,_0x4d80('0xc'),JSON[_0x4d80('0xf')](_0xf916e5));if(_0xf916e5['error']){if(_0xf916e5[_0x4d80('0x10')][_0x4d80('0x11')]===0x1f4){logger[_0x4d80('0x10')](_0x4d80('0x12'),_0x293237,_0xf916e5[_0x4d80('0x10')]['message']);return _0x4e08df(_0xf916e5[_0x4d80('0x10')][_0x4d80('0x13')]);}logger[_0x4d80('0x10')](_0x4d80('0x12'),_0x293237,_0xf916e5[_0x4d80('0x10')][_0x4d80('0x13')]);return _0x1a4da5(_0xf916e5['error']['message']);}else{logger[_0x4d80('0xb')](_0x4d80('0x12'),_0x293237,_0x4d80('0xc'));_0x1a4da5(_0xf916e5[_0x4d80('0x14')][_0x4d80('0x13')]);}})[_0x4d80('0x15')](function(_0x4fd90c){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x293237,_0x4fd90c);_0x4e08df(_0x4fd90c);});});} \ No newline at end of file +var _0x3685=['stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x3685,0x1aa));var _0x5368=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3685[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5368('0x0'));var util=require(_0x5368('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5368('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5368('0x3'))['db'];var utils=require(_0x5368('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5368('0x5'));var client=jayson[_0x5368('0x6')][_0x5368('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a379a,_0x516024,_0x9f14be){return new BPromise(function(_0x594bf7,_0x2ee81b){return client[_0x5368('0x8')](_0x1a379a,_0x9f14be)[_0x5368('0x9')](function(_0x3ea215){logger[_0x5368('0xa')](_0x5368('0xb'),_0x516024,_0x5368('0xc'));logger['debug'](_0x5368('0xd'),_0x516024,'request\x20sent',JSON[_0x5368('0xe')](_0x3ea215));if(_0x3ea215['error']){if(_0x3ea215[_0x5368('0xf')][_0x5368('0x10')]===0x1f4){logger[_0x5368('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x516024,_0x3ea215[_0x5368('0xf')]['message']);return _0x2ee81b(_0x3ea215[_0x5368('0xf')][_0x5368('0x11')]);}logger[_0x5368('0xf')](_0x5368('0xb'),_0x516024,_0x3ea215[_0x5368('0xf')][_0x5368('0x11')]);return _0x594bf7(_0x3ea215['error']['message']);}else{logger[_0x5368('0xa')](_0x5368('0xb'),_0x516024,_0x5368('0xc'));_0x594bf7(_0x3ea215[_0x5368('0x12')][_0x5368('0x11')]);}})[_0x5368('0x13')](function(_0xd0a9ca){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x516024,_0xd0a9ca);_0x2ee81b(_0xd0a9ca);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c8baf24..2c9bc58 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 _0xfdbd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x5059d9,_0x2d9c56){var _0x59d9c8=function(_0x15c243){while(--_0x15c243){_0x5059d9['push'](_0x5059d9['shift']());}};_0x59d9c8(++_0x2d9c56);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xfdbd[_0x40d8d7];return _0x3454cc;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get'](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xb')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller[_0xdfdb('0x10')]);module[_0xdfdb('0x11')]=router; \ No newline at end of file +var _0x326f=['../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3d3cd2,_0xe04f7){var _0xf8db8b=function(_0x2bcc34){while(--_0x2bcc34){_0x3d3cd2['push'](_0x3d3cd2['shift']());}};_0xf8db8b(++_0xe04f7);}(_0x326f,0xd1));var _0xf326=function(_0x181622,_0x4bff32){_0x181622=_0x181622-0x0;var _0xf8ec15=_0x326f[_0x181622];return _0xf8ec15;};'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')](_0xf326('0xa'),auth['isAuthenticated'](),controller[_0xf326('0xb')]);router[_0xf326('0xc')]('/',auth[_0xf326('0xd')](),controller[_0xf326('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xf')]);router[_0xf326('0x10')](_0xf326('0xa'),auth[_0xf326('0xd')](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f2b1d9a..0b36035 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 _0xf91f=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1bce05,_0x34a0ab){var _0x188b85=function(_0x46e8cb){while(--_0x46e8cb){_0x1bce05['push'](_0x1bce05['shift']());}};_0x188b85(++_0x34a0ab);}(_0xf91f,0x9f));var _0xff91=function(_0x449625,_0x1f1387){_0x449625=_0x449625-0x0;var _0x37c2b7=_0xf91f[_0x449625];return _0x37c2b7;};'use strict';var Sequelize=require(_0xff91('0x0'));module[_0xff91('0x1')]={'name':{'type':Sequelize[_0xff91('0x2')],'unique':_0xff91('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[_0xff91('0x4')](_0xff91('0x5'),_0xff91('0x6'),_0xff91('0x7'))}}; \ No newline at end of file +var _0x75b2=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x30d897,_0x7554fd){var _0x5a875c=function(_0x5c3968){while(--_0x5c3968){_0x30d897['push'](_0x30d897['shift']());}};_0x5a875c(++_0x7554fd);}(_0x75b2,0x150));var _0x275b=function(_0x4127cb,_0x508a52){_0x4127cb=_0x4127cb-0x0;var _0x2143af=_0x75b2[_0x4127cb];return _0x2143af;};'use strict';var Sequelize=require(_0x275b('0x0'));module[_0x275b('0x1')]={'name':{'type':Sequelize[_0x275b('0x2')],'unique':_0x275b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x275b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x275b('0x5')](_0x275b('0x6'),'beepall',_0x275b('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 12e9e47..838c8da 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 _0x3199=['Agents','voicePause','interface','sequelize','transaction','forEach','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','nolimit','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','info','debug','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','then','get','ChatQueues','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','pick','filter','VIRTUAL','options','includeAll','include','ChatQueue','rows','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','sort','merge','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids'];(function(_0x5498c9,_0x5492ba){var _0x7325c0=function(_0x54565d){while(--_0x54565d){_0x5498c9['push'](_0x5498c9['shift']());}};_0x7325c0(++_0x5492ba);}(_0x3199,0x14d));var _0x9319=function(_0x1a9cb7,_0x29d53a){_0x1a9cb7=_0x1a9cb7-0x0;var _0xdd724e=_0x3199[_0x1a9cb7];return _0xdd724e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9319('0x0'));var rp=require(_0x9319('0x1'));var moment=require(_0x9319('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9319('0x3'));var path=require('path');var sox=require(_0x9319('0x4'));var csv=require(_0x9319('0x5'));var ejs=require(_0x9319('0x6'));var fs=require('fs');var fs_extra=require(_0x9319('0x7'));var _=require(_0x9319('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9319('0x9'));var toCsv=require(_0x9319('0x5'));var querystring=require(_0x9319('0xa'));var Papa=require(_0x9319('0xb'));var Redis=require(_0x9319('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9319('0xd'));var hardwareService=require(_0x9319('0xe'));var logger=require(_0x9319('0xf'))(_0x9319('0x10'));var utils=require(_0x9319('0x11'));var config=require(_0x9319('0x12'));var licenseUtil=require(_0x9319('0x13'));var db=require(_0x9319('0x14'))['db'];config[_0x9319('0x15')]=_['defaults'](config[_0x9319('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x9319('0x16'))(new Redis(config[_0x9319('0x15')]));require(_0x9319('0x17'))[_0x9319('0x18')](socket);var jayson=require(_0x9319('0x19'));var client=jayson[_0x9319('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x156eaa,_0x37ab18,_0x52ae2a,_0x3ae268){return new BPromise(function(_0x7ab64,_0x1e11ec){var _0x297fe5=_0x3ae268||client;return _0x297fe5[_0x9319('0x1b')](_0x156eaa,_0x52ae2a)['then'](function(_0x159809){logger[_0x9319('0x1c')]('ChatQueue,\x20%s,\x20%s',_0x37ab18,'request\x20sent');logger[_0x9319('0x1d')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x37ab18,_0x9319('0x1e'),JSON[_0x9319('0x1f')](_0x159809));if(_0x159809[_0x9319('0x20')]){if(_0x159809['error']['code']===0x1f4){logger[_0x9319('0x20')](_0x9319('0x21'),_0x37ab18,_0x159809[_0x9319('0x20')][_0x9319('0x22')]);return _0x1e11ec(_0x159809[_0x9319('0x20')][_0x9319('0x22')]);}logger[_0x9319('0x20')](_0x9319('0x21'),_0x37ab18,_0x159809[_0x9319('0x20')][_0x9319('0x22')]);return _0x7ab64(_0x159809[_0x9319('0x20')][_0x9319('0x22')]);}else{logger[_0x9319('0x1c')](_0x9319('0x21'),_0x37ab18,_0x9319('0x1e'));_0x7ab64(_0x159809['result']['message']);}})[_0x9319('0x23')](function(_0x1300d6){logger[_0x9319('0x20')]('ChatQueue,\x20%s,\x20%s',_0x37ab18,_0x1300d6);_0x1e11ec(_0x1300d6);});});}function respondWithStatusCode(_0x51eede,_0x1ff838){_0x1ff838=_0x1ff838||0xcc;return function(_0x442a60){if(_0x442a60){return _0x51eede[_0x9319('0x24')](_0x1ff838);}return _0x51eede[_0x9319('0x25')](_0x1ff838)[_0x9319('0x26')]();};}function respondWithResult(_0x4aed03,_0x59ce04){_0x59ce04=_0x59ce04||0xc8;return function(_0x4bffca){if(_0x4bffca){return _0x4aed03[_0x9319('0x25')](_0x59ce04)[_0x9319('0x27')](_0x4bffca);}};}function respondWithFilteredResult(_0x3e51c1,_0x4f80a3){return function(_0x2cbdce){if(_0x2cbdce){var _0x1796fe=typeof _0x4f80a3['offset']===_0x9319('0x28')&&typeof _0x4f80a3[_0x9319('0x29')]===_0x9319('0x28');var _0x4687c4=_0x2cbdce['count'];var _0x95a1c5=_0x1796fe?0x0:_0x4f80a3[_0x9319('0x2a')];var _0xbf1023=_0x1796fe?_0x2cbdce[_0x9319('0x2b')]:_0x4f80a3[_0x9319('0x2a')]+_0x4f80a3[_0x9319('0x29')];var _0x4d814c;if(_0xbf1023>=_0x4687c4){_0xbf1023=_0x4687c4;_0x4d814c=0xc8;}else{_0x4d814c=0xce;}_0x3e51c1[_0x9319('0x25')](_0x4d814c);return _0x3e51c1[_0x9319('0x2c')](_0x9319('0x2d'),_0x95a1c5+'-'+_0xbf1023+'/'+_0x4687c4)[_0x9319('0x27')](_0x2cbdce);}return null;};}function patchUpdates(_0x2a54b9){return function(_0x586837){try{jsonpatch[_0x9319('0x2e')](_0x586837,_0x2a54b9,!![]);}catch(_0x13acad){return BPromise['reject'](_0x13acad);}return _0x586837[_0x9319('0x2f')]();};}function saveUpdates(_0x540615,_0x4a6a1b){return function(_0x191267){if(_0x191267){return _0x191267[_0x9319('0x30')](_0x540615)['then'](function(_0x354db8){return _0x354db8;});}return null;};}function removeEntity(_0x501945,_0x1a6359){return function(_0x4b5b1d){if(_0x4b5b1d){return _0x4b5b1d[_0x9319('0x31')]()[_0x9319('0x32')](function(){var _0x13b6a7=_0x4b5b1d[_0x9319('0x33')]({'plain':!![]});var _0x909fcc=_0x9319('0x34');return db[_0x9319('0x35')][_0x9319('0x31')]({'where':{'type':_0x909fcc,'resourceId':_0x13b6a7['id']}})[_0x9319('0x32')](function(){return _0x4b5b1d;});})[_0x9319('0x32')](function(){_0x501945[_0x9319('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaecafe,_0xc77a41){return function(_0x573bc6){if(!_0x573bc6){_0xaecafe[_0x9319('0x24')](0x194);}return _0x573bc6;};}function handleError(_0x3174ab,_0x964447){_0x964447=_0x964447||0x1f4;return function(_0x35cdfb){logger[_0x9319('0x20')](_0x35cdfb[_0x9319('0x36')]);if(_0x35cdfb['name']){delete _0x35cdfb[_0x9319('0x37')];}_0x3174ab[_0x9319('0x25')](_0x964447)[_0x9319('0x38')](_0x35cdfb);};}exports[_0x9319('0x39')]=function(_0x5af9b6,_0x472295){var _0x5321e8={},_0x43cbb4={},_0x55017d={'count':0x0,'rows':[]};var _0x4b6e48=_[_0x9319('0x3a')](db['ChatQueue'][_0x9319('0x3b')],function(_0x500a90){return{'name':_0x500a90[_0x9319('0x3c')],'type':_0x500a90[_0x9319('0x3d')][_0x9319('0x3e')]};});_0x43cbb4[_0x9319('0x3f')]=_['map'](_0x4b6e48,_0x9319('0x37'));_0x43cbb4[_0x9319('0x40')]=_[_0x9319('0x41')](_0x5af9b6[_0x9319('0x40')]);_0x43cbb4[_0x9319('0x42')]=_[_0x9319('0x43')](_0x43cbb4[_0x9319('0x3f')],_0x43cbb4[_0x9319('0x40')]);_0x5321e8[_0x9319('0x44')]=_[_0x9319('0x43')](_0x43cbb4[_0x9319('0x3f')],qs['fields'](_0x5af9b6[_0x9319('0x40')][_0x9319('0x45')]));_0x5321e8[_0x9319('0x44')]=_0x5321e8[_0x9319('0x44')][_0x9319('0x46')]?_0x5321e8[_0x9319('0x44')]:_0x43cbb4['model'];if(!_0x5af9b6[_0x9319('0x40')]['hasOwnProperty']('nolimit')){_0x5321e8[_0x9319('0x29')]=qs[_0x9319('0x29')](_0x5af9b6[_0x9319('0x40')][_0x9319('0x29')]);_0x5321e8[_0x9319('0x2a')]=qs['offset'](_0x5af9b6['query'][_0x9319('0x2a')]);}_0x5321e8[_0x9319('0x47')]=qs['sort'](_0x5af9b6['query']['sort']);_0x5321e8[_0x9319('0x48')]=qs['filters'](_[_0x9319('0x49')](_0x5af9b6['query'],_0x43cbb4['filters']),_0x4b6e48);if(_0x5af9b6[_0x9319('0x40')][_0x9319('0x4a')]){_0x5321e8[_0x9319('0x48')]=_['merge'](_0x5321e8[_0x9319('0x48')],{'$or':_['map'](_0x4b6e48,function(_0x5c43d6){if(_0x5c43d6[_0x9319('0x3d')]!==_0x9319('0x4b')){var _0x29ec75={};_0x29ec75[_0x5c43d6[_0x9319('0x37')]]={'$like':'%'+_0x5af9b6[_0x9319('0x40')][_0x9319('0x4a')]+'%'};return _0x29ec75;}})});}_0x5321e8=_['merge']({},_0x5321e8,_0x5af9b6[_0x9319('0x4c')]);var _0x46e4b5={'where':_0x5321e8[_0x9319('0x48')]};return db['ChatQueue'][_0x9319('0x2b')](_0x46e4b5)['then'](function(_0x39bfe5){_0x55017d[_0x9319('0x2b')]=_0x39bfe5;if(_0x5af9b6[_0x9319('0x40')][_0x9319('0x4d')]){_0x5321e8[_0x9319('0x4e')]=[{'all':!![]}];}return db[_0x9319('0x4f')]['findAll'](_0x5321e8);})['then'](function(_0x3e4209){_0x55017d[_0x9319('0x50')]=_0x3e4209;return _0x55017d;})[_0x9319('0x32')](respondWithFilteredResult(_0x472295,_0x5321e8))[_0x9319('0x23')](handleError(_0x472295,null));};exports['show']=function(_0x5a776e,_0x2df129){var _0x8de4b9={'raw':!![],'where':{'id':_0x5a776e[_0x9319('0x51')]['id']}},_0x2754dc={};_0x2754dc['model']=_['keys'](db['ChatQueue']['rawAttributes']);_0x2754dc[_0x9319('0x40')]=_[_0x9319('0x41')](_0x5a776e['query']);_0x2754dc[_0x9319('0x42')]=_[_0x9319('0x43')](_0x2754dc[_0x9319('0x3f')],_0x2754dc[_0x9319('0x40')]);_0x8de4b9[_0x9319('0x44')]=_[_0x9319('0x43')](_0x2754dc[_0x9319('0x3f')],qs[_0x9319('0x45')](_0x5a776e[_0x9319('0x40')][_0x9319('0x45')]));_0x8de4b9[_0x9319('0x44')]=_0x8de4b9[_0x9319('0x44')][_0x9319('0x46')]?_0x8de4b9['attributes']:_0x2754dc['model'];if(_0x5a776e[_0x9319('0x40')][_0x9319('0x4d')]){_0x8de4b9['include']=[{'all':!![]}];}_0x8de4b9=_['merge']({},_0x8de4b9,_0x5a776e[_0x9319('0x4c')]);return db[_0x9319('0x4f')][_0x9319('0x52')](_0x8de4b9)['then'](handleEntityNotFound(_0x2df129,null))[_0x9319('0x32')](respondWithResult(_0x2df129,null))[_0x9319('0x23')](handleError(_0x2df129,null));};exports[_0x9319('0x53')]=function(_0x548a96,_0x51f567){return db[_0x9319('0x4f')][_0x9319('0x53')](_0x548a96['body'],{})[_0x9319('0x32')](function(_0x3ad391){var _0x5be8b5=_0x548a96[_0x9319('0x54')][_0x9319('0x33')]({'plain':!![]});if(!_0x5be8b5)throw new Error(_0x9319('0x55'));if(_0x5be8b5[_0x9319('0x56')]==='user'){var _0x137fb9=_0x3ad391['get']({'plain':!![]});var _0x2a5eae=_0x9319('0x34');return db[_0x9319('0x57')][_0x9319('0x52')]({'where':{'name':_0x2a5eae,'userProfileId':_0x5be8b5[_0x9319('0x58')]},'raw':!![]})['then'](function(_0x3d80ae){if(_0x3d80ae&&_0x3d80ae[_0x9319('0x59')]===0x0){return db[_0x9319('0x35')][_0x9319('0x53')]({'name':_0x137fb9[_0x9319('0x37')],'resourceId':_0x137fb9['id'],'type':_0x3d80ae['name'],'sectionId':_0x3d80ae['id']},{})[_0x9319('0x32')](function(){return _0x3ad391;});}else{return _0x3ad391;}})['catch'](function(_0x370061){logger[_0x9319('0x20')](_0x9319('0x5a'),_0x370061);throw _0x370061;});}return _0x3ad391;})[_0x9319('0x32')](respondWithResult(_0x51f567,0xc9))['catch'](handleError(_0x51f567,null));};exports[_0x9319('0x30')]=function(_0x2ee7aa,_0x190ade){if(_0x2ee7aa[_0x9319('0x5b')]['id']){delete _0x2ee7aa[_0x9319('0x5b')]['id'];}return db[_0x9319('0x4f')][_0x9319('0x52')]({'where':{'id':_0x2ee7aa['params']['id']}})[_0x9319('0x32')](handleEntityNotFound(_0x190ade,null))[_0x9319('0x32')](saveUpdates(_0x2ee7aa[_0x9319('0x5b')],null))[_0x9319('0x32')](respondWithResult(_0x190ade,null))[_0x9319('0x23')](handleError(_0x190ade,null));};exports['destroy']=function(_0xf8f6c7,_0x53cbbf){return db[_0x9319('0x4f')][_0x9319('0x52')]({'where':{'id':_0xf8f6c7[_0x9319('0x51')]['id']}})[_0x9319('0x32')](handleEntityNotFound(_0x53cbbf,null))[_0x9319('0x32')](removeEntity(_0x53cbbf,null))[_0x9319('0x23')](handleError(_0x53cbbf,null));};exports[_0x9319('0x5c')]=function(_0x1b17be,_0x57f4d3){return db[_0x9319('0x4f')][_0x9319('0x5c')]()[_0x9319('0x32')](respondWithResult(_0x57f4d3,null))[_0x9319('0x23')](handleError(_0x57f4d3,null));};exports[_0x9319('0x5d')]=function(_0x3196c1,_0x3d2ee6,_0x57e701){var _0x4eae2b={'raw':!![],'where':{}},_0x566ba5={},_0x1288d9;return db[_0x9319('0x4f')][_0x9319('0x5e')]({'where':{'id':_0x3196c1['params']['id']}})[_0x9319('0x32')](handleEntityNotFound(_0x3d2ee6,null))[_0x9319('0x32')](function(_0x18211f){if(_0x18211f){_0x1288d9=_0x18211f['get']({'plain':!![]});_0x566ba5['model']=_[_0x9319('0x41')](db[_0x9319('0x5f')]['rawAttributes']);_0x566ba5[_0x9319('0x40')]=_['keys'](_0x3196c1['query']);_0x566ba5[_0x9319('0x42')]=_['intersection'](_0x566ba5[_0x9319('0x3f')],_0x566ba5[_0x9319('0x40')]);_0x4eae2b['attributes']=_[_0x9319('0x43')](_0x566ba5[_0x9319('0x3f')],qs[_0x9319('0x45')](_0x3196c1[_0x9319('0x40')][_0x9319('0x45')]));_0x4eae2b[_0x9319('0x44')]=_0x4eae2b[_0x9319('0x44')]['length']?_0x4eae2b[_0x9319('0x44')]:_0x566ba5[_0x9319('0x3f')];if(!_0x3196c1[_0x9319('0x40')][_0x9319('0x60')]('nolimit')){_0x4eae2b[_0x9319('0x29')]=qs[_0x9319('0x29')](_0x3196c1[_0x9319('0x40')][_0x9319('0x29')]);_0x4eae2b['offset']=qs[_0x9319('0x2a')](_0x3196c1['query'][_0x9319('0x2a')]);}_0x4eae2b['order']=qs[_0x9319('0x61')](_0x3196c1[_0x9319('0x40')][_0x9319('0x61')]);_0x4eae2b[_0x9319('0x48')]=qs[_0x9319('0x42')](_['pick'](_0x3196c1[_0x9319('0x40')],_0x566ba5[_0x9319('0x42')]));_0x4eae2b[_0x9319('0x48')]['ChatQueueId']=_0x18211f['id'];if(_0x3196c1[_0x9319('0x40')][_0x9319('0x4a')]){_0x4eae2b[_0x9319('0x48')]=_[_0x9319('0x62')](_0x4eae2b[_0x9319('0x48')],{'$or':_[_0x9319('0x3a')](_0x4eae2b[_0x9319('0x44')],function(_0x5f1cfc){var _0x6f0f23={};_0x6f0f23[_0x5f1cfc]={'$like':'%'+_0x3196c1[_0x9319('0x40')][_0x9319('0x4a')]+'%'};return _0x6f0f23;})});}_0x4eae2b=_[_0x9319('0x62')]({},_0x4eae2b,_0x3196c1['options']);return db['UserChatQueue'][_0x9319('0x63')](_0x4eae2b);}})[_0x9319('0x32')](function(_0x3ef8f2){if(_0x3ef8f2){return db[_0x9319('0x64')][_0x9319('0x65')]({'where':{'id':_[_0x9319('0x3a')](_0x3ef8f2,_0x9319('0x66')),'role':_0x9319('0x67')},'attributes':['id',_0x9319('0x37'),_0x9319('0x68'),_0x9319('0x69'),_0x9319('0x6a')]});}})['then'](function(_0x2457d5){if(_0x2457d5){return{'count':_0x2457d5[_0x9319('0x2b')],'rows':_[_0x9319('0x3a')](_0x2457d5['rows'],function(_0x4d9737){return{'membername':_0x4d9737[_0x9319('0x37')],'UserId':_0x4d9737['id'],'queue_name':_0x1288d9['name'],'ChatQueueId':_0x1288d9['id'],'interface':util[_0x9319('0x6b')](_0x9319('0x6c'),_0x9319('0x6d'),_0x4d9737[_0x9319('0x37')]),'penalty':0x0,'paused':_0x4d9737['chatPause'],'createdAt':_0x4d9737[_0x9319('0x6a')],'updatedAt':_0x4d9737[_0x9319('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9319('0x32')](respondWithFilteredResult(_0x3d2ee6,_0x4eae2b))[_0x9319('0x23')](handleError(_0x3d2ee6,null));};exports[_0x9319('0x6e')]=function(_0x1624eb,_0x28f8cd,_0x2424e1){var _0x751719={};var _0x1f0331={};var _0x19fbea;var _0x1d2fc6;return db['ChatQueue'][_0x9319('0x5e')]({'where':{'id':_0x1624eb[_0x9319('0x51')]['id']}})['then'](handleEntityNotFound(_0x28f8cd,null))['then'](function(_0x45c79b){if(_0x45c79b){_0x19fbea=_0x45c79b;_0x1f0331[_0x9319('0x3f')]=_[_0x9319('0x41')](db[_0x9319('0x6f')][_0x9319('0x3b')]);_0x1f0331[_0x9319('0x40')]=_[_0x9319('0x41')](_0x1624eb['query']);_0x1f0331[_0x9319('0x42')]=_[_0x9319('0x43')](_0x1f0331[_0x9319('0x3f')],_0x1f0331[_0x9319('0x40')]);_0x751719['attributes']=_[_0x9319('0x43')](_0x1f0331[_0x9319('0x3f')],qs[_0x9319('0x45')](_0x1624eb[_0x9319('0x40')]['fields']));_0x751719[_0x9319('0x44')]=_0x751719[_0x9319('0x44')][_0x9319('0x46')]?_0x751719[_0x9319('0x44')]:_0x1f0331['model'];_0x751719['order']=qs[_0x9319('0x61')](_0x1624eb['query'][_0x9319('0x61')]);_0x751719['where']=qs[_0x9319('0x42')](_[_0x9319('0x49')](_0x1624eb[_0x9319('0x40')],_0x1f0331[_0x9319('0x42')]));if(_0x1624eb[_0x9319('0x40')]['filter']){_0x751719[_0x9319('0x48')]=_[_0x9319('0x62')](_0x751719[_0x9319('0x48')],{'$or':_[_0x9319('0x3a')](_0x751719[_0x9319('0x44')],function(_0x1c39f0){var _0xa61009={};_0xa61009[_0x1c39f0]={'$like':'%'+_0x1624eb['query'][_0x9319('0x4a')]+'%'};return _0xa61009;})});}_0x751719=_['merge']({},_0x751719,_0x1624eb[_0x9319('0x4c')]);return _0x19fbea[_0x9319('0x6e')](_0x751719);}})['then'](function(_0x1011df){if(_0x1011df){_0x1d2fc6=_0x1011df['length'];if(!_0x1624eb[_0x9319('0x40')][_0x9319('0x60')]('nolimit')){_0x751719[_0x9319('0x29')]=qs[_0x9319('0x29')](_0x1624eb[_0x9319('0x40')][_0x9319('0x29')]);_0x751719[_0x9319('0x2a')]=qs['offset'](_0x1624eb[_0x9319('0x40')][_0x9319('0x2a')]);}return _0x19fbea['getTeams'](_0x751719);}})[_0x9319('0x32')](function(_0x4f360b){if(_0x4f360b){return _0x4f360b?{'count':_0x1d2fc6,'rows':_0x4f360b}:null;}})[_0x9319('0x32')](respondWithResult(_0x28f8cd,null))['catch'](handleError(_0x28f8cd,null));};exports[_0x9319('0x70')]=function(_0x95474d,_0x1443ae,_0x105028){var _0x4fc4a5=_0x95474d[_0x9319('0x5b')][_0x9319('0x71')];return db[_0x9319('0x6f')][_0x9319('0x63')]({'where':{'id':_0x4fc4a5},'attributes':['id'],'include':[{'model':db[_0x9319('0x64')],'as':_0x9319('0x72'),'attributes':['id',_0x9319('0x37'),'online',_0x9319('0x73'),_0x9319('0x74')],'raw':!![]}]})[_0x9319('0x32')](function(_0x4c6cb1){if(_0x4c6cb1){var _0x2b6f53=_['flatMap'](_0x4c6cb1,function(_0x2bf96a){var _0x58f11b=_0x2bf96a[_0x9319('0x33')]({'plain':!![]});return _0x58f11b['Agents'];});return db[_0x9319('0x4f')][_0x9319('0x52')]({'where':{'id':_0x95474d[_0x9319('0x51')]['id']}})[_0x9319('0x32')](function(_0x35d55a){return db[_0x9319('0x75')][_0x9319('0x76')](function(_0x19decf){return _0x35d55a[_0x9319('0x70')](_0x4fc4a5,{'transaction':_0x19decf})[_0x9319('0x32')](function(){return BPromise['each'](_0x2b6f53,function(_0x8486ee){return db[_0x9319('0x5f')]['findOrCreate']({'where':{'UserId':_0x8486ee['id'],'ChatQueueId':_0x95474d['params']['id']},'transaction':_0x19decf});});})['then'](function(){_0x2b6f53[_0x9319('0x77')](function(_0x2bd24f){socket['emit']('userChatQueue:save',{'UserId':_0x2bd24f['id'],'ChatQueueId':_0x35d55a['id']});});});});});}})[_0x9319('0x32')](respondWithStatusCode(_0x1443ae,null))[_0x9319('0x23')](handleError(_0x1443ae,null));};exports['removeTeams']=function(_0x5a1e28,_0x30d15f,_0x14841f){return db['Team'][_0x9319('0x63')]({'where':{'id':_0x5a1e28[_0x9319('0x40')][_0x9319('0x71')]},'attributes':['id'],'include':[{'model':db[_0x9319('0x64')],'as':_0x9319('0x72'),'attributes':['id'],'raw':!![]}]})[_0x9319('0x32')](handleEntityNotFound(_0x30d15f,null))[_0x9319('0x32')](function(_0x2d8b5b){var _0x48adfe=_[_0x9319('0x3a')](_0x2d8b5b,'id');var _0x3298c=[];var _0x2d6bd3=[];var _0x5708b4=squel['select']();_0x5708b4['field'](_0x9319('0x78'))['from'](_0x9319('0x79'),'tq')[_0x9319('0x7a')](_0x9319('0x7b'),'ut',_0x9319('0x7c'))[_0x9319('0x48')]('ChatQueueId\x20=\x20?',_0x5a1e28[_0x9319('0x51')]['id']);for(var _0x572a43=0x0;_0x572a43<_0x2d8b5b['length'];_0x572a43+=0x1){let _0x10ebe2=_0x2d8b5b[_0x572a43];for(var _0x151310=0x0;_0x151310<_0x10ebe2[_0x9319('0x72')][_0x9319('0x46')];_0x151310+=0x1){let _0x4121e4=_0x10ebe2[_0x9319('0x72')][_0x151310];var _0x5b5dbf=_0x5708b4[_0x9319('0x7d')]();_0x5b5dbf[_0x9319('0x48')](_0x9319('0x7e'),_0x4121e4['id']);_0x2d6bd3[_0x9319('0x7f')](db['sequelize'][_0x9319('0x40')](_0x5b5dbf[_0x9319('0x80')](),{'type':db[_0x9319('0x75')][_0x9319('0x81')][_0x9319('0x82')]})['then'](function(_0x166c77){if(_0x166c77[_0x9319('0x46')]===0x1){return _0x4121e4['id'];}else{var _0x3fbeca=_[_0x9319('0x83')](_[_0x9319('0x3a')](_0x166c77,_0x9319('0x84')),function(_0x1a3460){return _[_0x9319('0x85')](_0x48adfe,_0x1a3460);});if(_0x3fbeca){return _0x4121e4['id'];}}}));}}return BPromise[_0x9319('0x86')](_0x2d6bd3)[_0x9319('0x32')](function(_0x38ee00){_0x3298c=_(_0x3298c)[_0x9319('0x87')](_0x38ee00)[_0x9319('0x88')]()[_0x9319('0x89')]();return db['ChatQueue'][_0x9319('0x52')]({'where':{'id':_0x5a1e28[_0x9319('0x51')]['id']}})[_0x9319('0x32')](function(_0x231188){return db[_0x9319('0x75')][_0x9319('0x76')](function(_0x1b44e0){return _0x231188[_0x9319('0x8a')](_0x5a1e28[_0x9319('0x40')][_0x9319('0x71')],{'transaction':_0x1b44e0})['then'](function(){if(!_[_0x9319('0x8b')](_0x3298c)){return _0x231188[_0x9319('0x8c')](_0x3298c,{'transaction':_0x1b44e0});}})[_0x9319('0x32')](function(){_0x3298c[_0x9319('0x77')](function(_0x35afa4){socket[_0x9319('0x8d')]('userChatQueue:remove',{'UserId':_0x35afa4,'ChatQueueId':_0x231188['id']});});});});});});})[_0x9319('0x32')](respondWithStatusCode(_0x30d15f,null))[_0x9319('0x23')](handleError(_0x30d15f,null));};exports[_0x9319('0x8e')]=function(_0x401d9c,_0x3c7127,_0x3b0a9f){return db[_0x9319('0x4f')][_0x9319('0x52')]({'where':{'id':_0x401d9c[_0x9319('0x51')]['id']}})[_0x9319('0x32')](handleEntityNotFound(_0x3c7127,null))[_0x9319('0x32')](function(_0x3225fa){if(_0x3225fa){return _0x3225fa[_0x9319('0x8e')](_0x401d9c['body'][_0x9319('0x71')],_[_0x9319('0x8f')](_0x401d9c[_0x9319('0x5b')],[_0x9319('0x71'),'id'])||{})[_0x9319('0x90')](function(_0x2093ba){for(var _0x142f81=0x0;_0x142f81<_0x401d9c[_0x9319('0x5b')][_0x9319('0x71')][_0x9319('0x46')];_0x142f81+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x401d9c[_0x9319('0x5b')][_0x9319('0x71')][_0x142f81]),'ChatQueueId':Number(_0x401d9c['params']['id'])});}return _0x2093ba;});}})[_0x9319('0x32')](respondWithResult(_0x3c7127,null))['catch'](handleError(_0x3c7127,null));};exports['removeAgents']=function(_0x56c2a9,_0x195966,_0x3c1b40){return db['ChatQueue'][_0x9319('0x52')]({'where':{'id':_0x56c2a9[_0x9319('0x51')]['id']}})[_0x9319('0x32')](handleEntityNotFound(_0x195966,null))[_0x9319('0x32')](function(_0x318b76){if(_0x318b76){return _0x318b76[_0x9319('0x8c')](_0x56c2a9['query'][_0x9319('0x71')])[_0x9319('0x32')](function(){if(_[_0x9319('0x91')](_0x56c2a9['query'][_0x9319('0x71')])){for(var _0x265c45=0x0;_0x265c45<_0x56c2a9[_0x9319('0x40')][_0x9319('0x71')][_0x9319('0x46')];_0x265c45+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x56c2a9[_0x9319('0x40')][_0x9319('0x71')][_0x265c45]),'ChatQueueId':Number(_0x56c2a9[_0x9319('0x51')]['id'])});}}else{socket['emit'](_0x9319('0x92'),{'UserId':Number(_0x56c2a9[_0x9319('0x40')][_0x9319('0x71')]),'ChatQueueId':Number(_0x56c2a9[_0x9319('0x51')]['id'])});}});}})[_0x9319('0x32')](respondWithStatusCode(_0x195966,null))[_0x9319('0x23')](handleError(_0x195966,null));};exports[_0x9319('0x93')]=function(_0x3b53e3,_0x51aacb,_0x234e77){var _0x5347a7={};var _0x74b2bb={};var _0x3d0c3b;var _0x38d23f;return db['ChatQueue'][_0x9319('0x5e')]({'where':{'id':_0x3b53e3[_0x9319('0x51')]['id']}})['then'](handleEntityNotFound(_0x51aacb,null))['then'](function(_0x279ccd){if(_0x279ccd){_0x3d0c3b=_0x279ccd;_0x74b2bb[_0x9319('0x3f')]=_[_0x9319('0x41')](db['User']['rawAttributes']);_0x74b2bb['query']=_[_0x9319('0x41')](_0x3b53e3[_0x9319('0x40')]);_0x74b2bb[_0x9319('0x42')]=_[_0x9319('0x43')](_0x74b2bb['model'],_0x74b2bb[_0x9319('0x40')]);_0x5347a7[_0x9319('0x44')]=_[_0x9319('0x43')](_0x74b2bb[_0x9319('0x3f')],qs[_0x9319('0x45')](_0x3b53e3[_0x9319('0x40')][_0x9319('0x45')]));_0x5347a7[_0x9319('0x44')]=_0x5347a7[_0x9319('0x44')][_0x9319('0x46')]?_0x5347a7[_0x9319('0x44')]:_0x74b2bb['model'];_0x5347a7[_0x9319('0x47')]=qs[_0x9319('0x61')](_0x3b53e3[_0x9319('0x40')][_0x9319('0x61')]);_0x5347a7[_0x9319('0x48')]=qs[_0x9319('0x42')](_[_0x9319('0x49')](_0x3b53e3[_0x9319('0x40')],_0x74b2bb[_0x9319('0x42')]));if(_0x3b53e3[_0x9319('0x40')]['filter']){_0x5347a7[_0x9319('0x48')]=_[_0x9319('0x62')](_0x5347a7['where'],{'$or':_[_0x9319('0x3a')](_0x5347a7[_0x9319('0x44')],function(_0x23a91c){var _0x2980a3={};_0x2980a3[_0x23a91c]={'$like':'%'+_0x3b53e3[_0x9319('0x40')]['filter']+'%'};return _0x2980a3;})});}_0x5347a7=_[_0x9319('0x62')]({},_0x5347a7,_0x3b53e3[_0x9319('0x4c')]);return _0x3d0c3b[_0x9319('0x93')](_0x5347a7);}})[_0x9319('0x32')](function(_0x8bd107){if(_0x8bd107){_0x38d23f=_0x8bd107[_0x9319('0x46')];if(!_0x3b53e3[_0x9319('0x40')][_0x9319('0x60')](_0x9319('0x94'))){_0x5347a7[_0x9319('0x29')]=qs[_0x9319('0x29')](_0x3b53e3[_0x9319('0x40')][_0x9319('0x29')]);_0x5347a7[_0x9319('0x2a')]=qs[_0x9319('0x2a')](_0x3b53e3[_0x9319('0x40')][_0x9319('0x2a')]);}return _0x3d0c3b[_0x9319('0x93')](_0x5347a7);}})[_0x9319('0x32')](function(_0x5e8cf1){if(_0x5e8cf1){return _0x5e8cf1?{'count':_0x38d23f,'rows':_0x5e8cf1}:null;}})['then'](respondWithResult(_0x51aacb,null))['catch'](handleError(_0x51aacb,null));}; \ No newline at end of file +var _0x8f65=['Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','removeTeams','User','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','ids','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','userChatQueue:save','isArray','emit','getAgents','eml-format','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/logger','api','../../config/license/util','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','count','offset','limit','set','apply','save','destroy','get','UserProfileResource','sendStatus','stack','name','ChatQueue','fieldName','type','key','model','map','query','filters','attributes','intersection','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','rawAttributes','nolimit','ChatQueueId','UserChatQueue','UserId','chatPause','updatedAt','createdAt','format','SIP','getTeams'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0x8f65,0x15e));var _0x58f6=function(_0x229cf6,_0x5a68d3){_0x229cf6=_0x229cf6-0x0;var _0x2a3b7f=_0x8f65[_0x229cf6];return _0x2a3b7f;};'use strict';var emlformat=require(_0x58f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x58f6('0x1'));var rp=require(_0x58f6('0x2'));var moment=require(_0x58f6('0x3'));var BPromise=require(_0x58f6('0x4'));var Mustache=require(_0x58f6('0x5'));var util=require(_0x58f6('0x6'));var path=require(_0x58f6('0x7'));var sox=require(_0x58f6('0x8'));var csv=require(_0x58f6('0x9'));var ejs=require(_0x58f6('0xa'));var fs=require('fs');var fs_extra=require(_0x58f6('0xb'));var _=require(_0x58f6('0xc'));var squel=require(_0x58f6('0xd'));var crypto=require('crypto');var jsforce=require(_0x58f6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x58f6('0x9'));var querystring=require('querystring');var Papa=require(_0x58f6('0xf'));var Redis=require(_0x58f6('0x10'));var authService=require(_0x58f6('0x11'));var qs=require(_0x58f6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x58f6('0x13'))(_0x58f6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x58f6('0x15'));var db=require(_0x58f6('0x16'))['db'];config[_0x58f6('0x17')]=_['defaults'](config[_0x58f6('0x17')],{'host':_0x58f6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58f6('0x17')]));require(_0x58f6('0x19'))[_0x58f6('0x1a')](socket);var jayson=require(_0x58f6('0x1b'));var client=jayson[_0x58f6('0x1c')][_0x58f6('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x444bea,_0x24dff7,_0x4a31ef,_0xf7719f){return new BPromise(function(_0x5ed96b,_0x36033a){var _0x588be2=_0xf7719f||client;return _0x588be2['request'](_0x444bea,_0x4a31ef)[_0x58f6('0x1e')](function(_0x3e2c88){logger[_0x58f6('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x24dff7,_0x58f6('0x20'));logger['debug'](_0x58f6('0x21'),_0x24dff7,_0x58f6('0x20'),JSON[_0x58f6('0x22')](_0x3e2c88));if(_0x3e2c88['error']){if(_0x3e2c88[_0x58f6('0x23')][_0x58f6('0x24')]===0x1f4){logger[_0x58f6('0x23')](_0x58f6('0x25'),_0x24dff7,_0x3e2c88[_0x58f6('0x23')][_0x58f6('0x26')]);return _0x36033a(_0x3e2c88['error'][_0x58f6('0x26')]);}logger[_0x58f6('0x23')](_0x58f6('0x25'),_0x24dff7,_0x3e2c88[_0x58f6('0x23')][_0x58f6('0x26')]);return _0x5ed96b(_0x3e2c88[_0x58f6('0x23')][_0x58f6('0x26')]);}else{logger[_0x58f6('0x1f')](_0x58f6('0x25'),_0x24dff7,_0x58f6('0x20'));_0x5ed96b(_0x3e2c88[_0x58f6('0x27')][_0x58f6('0x26')]);}})[_0x58f6('0x28')](function(_0x39451d){logger[_0x58f6('0x23')](_0x58f6('0x25'),_0x24dff7,_0x39451d);_0x36033a(_0x39451d);});});}function respondWithStatusCode(_0x1ea454,_0x2886ef){_0x2886ef=_0x2886ef||0xcc;return function(_0x4210d6){if(_0x4210d6){return _0x1ea454['sendStatus'](_0x2886ef);}return _0x1ea454[_0x58f6('0x29')](_0x2886ef)[_0x58f6('0x2a')]();};}function respondWithResult(_0x55b087,_0x38d0be){_0x38d0be=_0x38d0be||0xc8;return function(_0x4aa29e){if(_0x4aa29e){return _0x55b087[_0x58f6('0x29')](_0x38d0be)[_0x58f6('0x2b')](_0x4aa29e);}};}function respondWithFilteredResult(_0x56aecf,_0x37fec3){return function(_0x43eca0){if(_0x43eca0){var _0x3a983e=typeof _0x37fec3['offset']===_0x58f6('0x2c')&&typeof _0x37fec3['limit']==='undefined';var _0x1e2248=_0x43eca0[_0x58f6('0x2d')];var _0x25c0f1=_0x3a983e?0x0:_0x37fec3[_0x58f6('0x2e')];var _0x11b547=_0x3a983e?_0x43eca0[_0x58f6('0x2d')]:_0x37fec3[_0x58f6('0x2e')]+_0x37fec3[_0x58f6('0x2f')];var _0x3a3acf;if(_0x11b547>=_0x1e2248){_0x11b547=_0x1e2248;_0x3a3acf=0xc8;}else{_0x3a3acf=0xce;}_0x56aecf[_0x58f6('0x29')](_0x3a3acf);return _0x56aecf[_0x58f6('0x30')]('Content-Range',_0x25c0f1+'-'+_0x11b547+'/'+_0x1e2248)[_0x58f6('0x2b')](_0x43eca0);}return null;};}function patchUpdates(_0x523b20){return function(_0x531c23){try{jsonpatch[_0x58f6('0x31')](_0x531c23,_0x523b20,!![]);}catch(_0x4851f9){return BPromise['reject'](_0x4851f9);}return _0x531c23[_0x58f6('0x32')]();};}function saveUpdates(_0x5466d8,_0x49ae02){return function(_0xdf80f0){if(_0xdf80f0){return _0xdf80f0['update'](_0x5466d8)[_0x58f6('0x1e')](function(_0x2a95fe){return _0x2a95fe;});}return null;};}function removeEntity(_0x48c985,_0x5c1e13){return function(_0xf71584){if(_0xf71584){return _0xf71584[_0x58f6('0x33')]()[_0x58f6('0x1e')](function(){var _0x232add=_0xf71584[_0x58f6('0x34')]({'plain':!![]});var _0x58f521='ChatQueues';return db[_0x58f6('0x35')][_0x58f6('0x33')]({'where':{'type':_0x58f521,'resourceId':_0x232add['id']}})[_0x58f6('0x1e')](function(){return _0xf71584;});})[_0x58f6('0x1e')](function(){_0x48c985['status'](0xcc)[_0x58f6('0x2a')]();});}};}function handleEntityNotFound(_0x2d1565,_0x108675){return function(_0x4eae04){if(!_0x4eae04){_0x2d1565[_0x58f6('0x36')](0x194);}return _0x4eae04;};}function handleError(_0x4d9b0b,_0x347270){_0x347270=_0x347270||0x1f4;return function(_0x1bc626){logger[_0x58f6('0x23')](_0x1bc626[_0x58f6('0x37')]);if(_0x1bc626[_0x58f6('0x38')]){delete _0x1bc626[_0x58f6('0x38')];}_0x4d9b0b[_0x58f6('0x29')](_0x347270)['send'](_0x1bc626);};}exports['index']=function(_0x564f84,_0x31d270){var _0x458469={},_0x5c4308={},_0x5cfd46={'count':0x0,'rows':[]};var _0x3d558b=_['map'](db[_0x58f6('0x39')]['rawAttributes'],function(_0xc55fc2){return{'name':_0xc55fc2[_0x58f6('0x3a')],'type':_0xc55fc2[_0x58f6('0x3b')][_0x58f6('0x3c')]};});_0x5c4308[_0x58f6('0x3d')]=_[_0x58f6('0x3e')](_0x3d558b,_0x58f6('0x38'));_0x5c4308[_0x58f6('0x3f')]=_['keys'](_0x564f84[_0x58f6('0x3f')]);_0x5c4308[_0x58f6('0x40')]=_['intersection'](_0x5c4308[_0x58f6('0x3d')],_0x5c4308[_0x58f6('0x3f')]);_0x458469[_0x58f6('0x41')]=_[_0x58f6('0x42')](_0x5c4308[_0x58f6('0x3d')],qs['fields'](_0x564f84[_0x58f6('0x3f')]['fields']));_0x458469[_0x58f6('0x41')]=_0x458469[_0x58f6('0x41')]['length']?_0x458469['attributes']:_0x5c4308[_0x58f6('0x3d')];if(!_0x564f84[_0x58f6('0x3f')][_0x58f6('0x43')]('nolimit')){_0x458469[_0x58f6('0x2f')]=qs['limit'](_0x564f84[_0x58f6('0x3f')][_0x58f6('0x2f')]);_0x458469[_0x58f6('0x2e')]=qs[_0x58f6('0x2e')](_0x564f84[_0x58f6('0x3f')][_0x58f6('0x2e')]);}_0x458469[_0x58f6('0x44')]=qs[_0x58f6('0x45')](_0x564f84[_0x58f6('0x3f')]['sort']);_0x458469['where']=qs[_0x58f6('0x40')](_[_0x58f6('0x46')](_0x564f84[_0x58f6('0x3f')],_0x5c4308[_0x58f6('0x40')]),_0x3d558b);if(_0x564f84[_0x58f6('0x3f')][_0x58f6('0x47')]){_0x458469[_0x58f6('0x48')]=_[_0x58f6('0x49')](_0x458469[_0x58f6('0x48')],{'$or':_[_0x58f6('0x3e')](_0x3d558b,function(_0x2c3d8a){if(_0x2c3d8a[_0x58f6('0x3b')]!==_0x58f6('0x4a')){var _0x2366f4={};_0x2366f4[_0x2c3d8a[_0x58f6('0x38')]]={'$like':'%'+_0x564f84[_0x58f6('0x3f')][_0x58f6('0x47')]+'%'};return _0x2366f4;}})});}_0x458469=_[_0x58f6('0x49')]({},_0x458469,_0x564f84[_0x58f6('0x4b')]);var _0x430db2={'where':_0x458469[_0x58f6('0x48')]};return db[_0x58f6('0x39')]['count'](_0x430db2)[_0x58f6('0x1e')](function(_0x16fadf){_0x5cfd46[_0x58f6('0x2d')]=_0x16fadf;if(_0x564f84[_0x58f6('0x3f')][_0x58f6('0x4c')]){_0x458469['include']=[{'all':!![]}];}return db[_0x58f6('0x39')][_0x58f6('0x4d')](_0x458469);})[_0x58f6('0x1e')](function(_0x37d652){_0x5cfd46[_0x58f6('0x4e')]=_0x37d652;return _0x5cfd46;})[_0x58f6('0x1e')](respondWithFilteredResult(_0x31d270,_0x458469))['catch'](handleError(_0x31d270,null));};exports[_0x58f6('0x4f')]=function(_0x5abe6f,_0x5b2ee0){var _0x32de4f={'raw':!![],'where':{'id':_0x5abe6f[_0x58f6('0x50')]['id']}},_0x54031a={};_0x54031a[_0x58f6('0x3d')]=_[_0x58f6('0x51')](db[_0x58f6('0x39')]['rawAttributes']);_0x54031a[_0x58f6('0x3f')]=_[_0x58f6('0x51')](_0x5abe6f[_0x58f6('0x3f')]);_0x54031a[_0x58f6('0x40')]=_[_0x58f6('0x42')](_0x54031a[_0x58f6('0x3d')],_0x54031a['query']);_0x32de4f[_0x58f6('0x41')]=_[_0x58f6('0x42')](_0x54031a[_0x58f6('0x3d')],qs[_0x58f6('0x52')](_0x5abe6f[_0x58f6('0x3f')][_0x58f6('0x52')]));_0x32de4f[_0x58f6('0x41')]=_0x32de4f['attributes'][_0x58f6('0x53')]?_0x32de4f[_0x58f6('0x41')]:_0x54031a[_0x58f6('0x3d')];if(_0x5abe6f['query'][_0x58f6('0x4c')]){_0x32de4f[_0x58f6('0x54')]=[{'all':!![]}];}_0x32de4f=_[_0x58f6('0x49')]({},_0x32de4f,_0x5abe6f[_0x58f6('0x4b')]);return db['ChatQueue'][_0x58f6('0x55')](_0x32de4f)[_0x58f6('0x1e')](handleEntityNotFound(_0x5b2ee0,null))[_0x58f6('0x1e')](respondWithResult(_0x5b2ee0,null))[_0x58f6('0x28')](handleError(_0x5b2ee0,null));};exports[_0x58f6('0x56')]=function(_0x416245,_0x30d4c6){return db[_0x58f6('0x39')][_0x58f6('0x56')](_0x416245[_0x58f6('0x57')],{})[_0x58f6('0x1e')](function(_0xdde841){var _0x239d0c=_0x416245[_0x58f6('0x58')]['get']({'plain':!![]});if(!_0x239d0c)throw new Error(_0x58f6('0x59'));if(_0x239d0c['role']===_0x58f6('0x58')){var _0x35c2dd=_0xdde841[_0x58f6('0x34')]({'plain':!![]});var _0x5ae710=_0x58f6('0x5a');return db[_0x58f6('0x5b')][_0x58f6('0x55')]({'where':{'name':_0x5ae710,'userProfileId':_0x239d0c['userProfileId']},'raw':!![]})[_0x58f6('0x1e')](function(_0x38879c){if(_0x38879c&&_0x38879c[_0x58f6('0x5c')]===0x0){return db[_0x58f6('0x35')][_0x58f6('0x56')]({'name':_0x35c2dd['name'],'resourceId':_0x35c2dd['id'],'type':_0x38879c[_0x58f6('0x38')],'sectionId':_0x38879c['id']},{})['then'](function(){return _0xdde841;});}else{return _0xdde841;}})[_0x58f6('0x28')](function(_0xf4d52d){logger['error'](_0x58f6('0x5d'),_0xf4d52d);throw _0xf4d52d;});}return _0xdde841;})[_0x58f6('0x1e')](respondWithResult(_0x30d4c6,0xc9))[_0x58f6('0x28')](handleError(_0x30d4c6,null));};exports[_0x58f6('0x5e')]=function(_0x9a0e11,_0x316a8c){if(_0x9a0e11[_0x58f6('0x57')]['id']){delete _0x9a0e11[_0x58f6('0x57')]['id'];}return db[_0x58f6('0x39')][_0x58f6('0x55')]({'where':{'id':_0x9a0e11[_0x58f6('0x50')]['id']}})[_0x58f6('0x1e')](handleEntityNotFound(_0x316a8c,null))[_0x58f6('0x1e')](saveUpdates(_0x9a0e11[_0x58f6('0x57')],null))[_0x58f6('0x1e')](respondWithResult(_0x316a8c,null))[_0x58f6('0x28')](handleError(_0x316a8c,null));};exports[_0x58f6('0x33')]=function(_0x5702cb,_0x5a6afd){return db[_0x58f6('0x39')][_0x58f6('0x55')]({'where':{'id':_0x5702cb[_0x58f6('0x50')]['id']}})[_0x58f6('0x1e')](handleEntityNotFound(_0x5a6afd,null))[_0x58f6('0x1e')](removeEntity(_0x5a6afd,null))[_0x58f6('0x28')](handleError(_0x5a6afd,null));};exports[_0x58f6('0x5f')]=function(_0x1e32c9,_0x23964a){return db[_0x58f6('0x39')][_0x58f6('0x5f')]()[_0x58f6('0x1e')](respondWithResult(_0x23964a,null))['catch'](handleError(_0x23964a,null));};exports[_0x58f6('0x60')]=function(_0x469b49,_0x29348a,_0x488174){var _0x289be7={'raw':!![],'where':{}},_0x48ea82={},_0x58c43e;return db['ChatQueue'][_0x58f6('0x61')]({'where':{'id':_0x469b49[_0x58f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x29348a,null))[_0x58f6('0x1e')](function(_0x308080){if(_0x308080){_0x58c43e=_0x308080[_0x58f6('0x34')]({'plain':!![]});_0x48ea82['model']=_['keys'](db['UserChatQueue'][_0x58f6('0x62')]);_0x48ea82[_0x58f6('0x3f')]=_[_0x58f6('0x51')](_0x469b49['query']);_0x48ea82[_0x58f6('0x40')]=_[_0x58f6('0x42')](_0x48ea82['model'],_0x48ea82[_0x58f6('0x3f')]);_0x289be7[_0x58f6('0x41')]=_[_0x58f6('0x42')](_0x48ea82['model'],qs[_0x58f6('0x52')](_0x469b49[_0x58f6('0x3f')]['fields']));_0x289be7[_0x58f6('0x41')]=_0x289be7['attributes']['length']?_0x289be7[_0x58f6('0x41')]:_0x48ea82[_0x58f6('0x3d')];if(!_0x469b49[_0x58f6('0x3f')][_0x58f6('0x43')](_0x58f6('0x63'))){_0x289be7['limit']=qs['limit'](_0x469b49[_0x58f6('0x3f')]['limit']);_0x289be7[_0x58f6('0x2e')]=qs[_0x58f6('0x2e')](_0x469b49[_0x58f6('0x3f')][_0x58f6('0x2e')]);}_0x289be7[_0x58f6('0x44')]=qs[_0x58f6('0x45')](_0x469b49['query'][_0x58f6('0x45')]);_0x289be7[_0x58f6('0x48')]=qs[_0x58f6('0x40')](_[_0x58f6('0x46')](_0x469b49['query'],_0x48ea82[_0x58f6('0x40')]));_0x289be7[_0x58f6('0x48')][_0x58f6('0x64')]=_0x308080['id'];if(_0x469b49['query'][_0x58f6('0x47')]){_0x289be7['where']=_[_0x58f6('0x49')](_0x289be7[_0x58f6('0x48')],{'$or':_[_0x58f6('0x3e')](_0x289be7[_0x58f6('0x41')],function(_0x3a455e){var _0x3c019d={};_0x3c019d[_0x3a455e]={'$like':'%'+_0x469b49[_0x58f6('0x3f')][_0x58f6('0x47')]+'%'};return _0x3c019d;})});}_0x289be7=_[_0x58f6('0x49')]({},_0x289be7,_0x469b49[_0x58f6('0x4b')]);return db[_0x58f6('0x65')][_0x58f6('0x4d')](_0x289be7);}})[_0x58f6('0x1e')](function(_0x44dfdf){if(_0x44dfdf){return db['User']['findAndCountAll']({'where':{'id':_[_0x58f6('0x3e')](_0x44dfdf,_0x58f6('0x66')),'role':'agent'},'attributes':['id',_0x58f6('0x38'),_0x58f6('0x67'),_0x58f6('0x68'),_0x58f6('0x69')]});}})[_0x58f6('0x1e')](function(_0x35b58b){if(_0x35b58b){return{'count':_0x35b58b['count'],'rows':_[_0x58f6('0x3e')](_0x35b58b[_0x58f6('0x4e')],function(_0x31b6e5){return{'membername':_0x31b6e5['name'],'UserId':_0x31b6e5['id'],'queue_name':_0x58c43e[_0x58f6('0x38')],'ChatQueueId':_0x58c43e['id'],'interface':util[_0x58f6('0x6a')]('%s/%s',_0x58f6('0x6b'),_0x31b6e5['name']),'penalty':0x0,'paused':_0x31b6e5['chatPause'],'createdAt':_0x31b6e5['createdAt'],'updatedAt':_0x31b6e5[_0x58f6('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x58f6('0x1e')](respondWithFilteredResult(_0x29348a,_0x289be7))[_0x58f6('0x28')](handleError(_0x29348a,null));};exports[_0x58f6('0x6c')]=function(_0x1db16e,_0x3f52d1,_0x829074){var _0x41e7d3={};var _0x18c3e8={};var _0xfe9ea8;var _0x2d7039;return db[_0x58f6('0x39')][_0x58f6('0x61')]({'where':{'id':_0x1db16e[_0x58f6('0x50')]['id']}})[_0x58f6('0x1e')](handleEntityNotFound(_0x3f52d1,null))[_0x58f6('0x1e')](function(_0x15f810){if(_0x15f810){_0xfe9ea8=_0x15f810;_0x18c3e8[_0x58f6('0x3d')]=_[_0x58f6('0x51')](db['Team'][_0x58f6('0x62')]);_0x18c3e8[_0x58f6('0x3f')]=_[_0x58f6('0x51')](_0x1db16e['query']);_0x18c3e8[_0x58f6('0x40')]=_[_0x58f6('0x42')](_0x18c3e8[_0x58f6('0x3d')],_0x18c3e8[_0x58f6('0x3f')]);_0x41e7d3[_0x58f6('0x41')]=_['intersection'](_0x18c3e8[_0x58f6('0x3d')],qs[_0x58f6('0x52')](_0x1db16e['query'][_0x58f6('0x52')]));_0x41e7d3[_0x58f6('0x41')]=_0x41e7d3[_0x58f6('0x41')][_0x58f6('0x53')]?_0x41e7d3['attributes']:_0x18c3e8[_0x58f6('0x3d')];_0x41e7d3[_0x58f6('0x44')]=qs['sort'](_0x1db16e[_0x58f6('0x3f')][_0x58f6('0x45')]);_0x41e7d3[_0x58f6('0x48')]=qs[_0x58f6('0x40')](_[_0x58f6('0x46')](_0x1db16e[_0x58f6('0x3f')],_0x18c3e8[_0x58f6('0x40')]));if(_0x1db16e[_0x58f6('0x3f')][_0x58f6('0x47')]){_0x41e7d3[_0x58f6('0x48')]=_[_0x58f6('0x49')](_0x41e7d3[_0x58f6('0x48')],{'$or':_[_0x58f6('0x3e')](_0x41e7d3[_0x58f6('0x41')],function(_0x2e2845){var _0x25f621={};_0x25f621[_0x2e2845]={'$like':'%'+_0x1db16e[_0x58f6('0x3f')][_0x58f6('0x47')]+'%'};return _0x25f621;})});}_0x41e7d3=_[_0x58f6('0x49')]({},_0x41e7d3,_0x1db16e[_0x58f6('0x4b')]);return _0xfe9ea8[_0x58f6('0x6c')](_0x41e7d3);}})['then'](function(_0x434e8a){if(_0x434e8a){_0x2d7039=_0x434e8a['length'];if(!_0x1db16e['query']['hasOwnProperty']('nolimit')){_0x41e7d3[_0x58f6('0x2f')]=qs['limit'](_0x1db16e[_0x58f6('0x3f')][_0x58f6('0x2f')]);_0x41e7d3[_0x58f6('0x2e')]=qs['offset'](_0x1db16e[_0x58f6('0x3f')][_0x58f6('0x2e')]);}return _0xfe9ea8[_0x58f6('0x6c')](_0x41e7d3);}})['then'](function(_0x2e11dd){if(_0x2e11dd){return _0x2e11dd?{'count':_0x2d7039,'rows':_0x2e11dd}:null;}})[_0x58f6('0x1e')](respondWithResult(_0x3f52d1,null))['catch'](handleError(_0x3f52d1,null));};exports['addTeams']=function(_0x536c77,_0x5c5cc0,_0x48e4c8){var _0xbc04d1=_0x536c77[_0x58f6('0x57')]['ids'];return db[_0x58f6('0x6d')][_0x58f6('0x4d')]({'where':{'id':_0xbc04d1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x58f6('0x6e'),'attributes':['id',_0x58f6('0x38'),_0x58f6('0x6f'),_0x58f6('0x70'),_0x58f6('0x71')],'raw':!![]}]})[_0x58f6('0x1e')](function(_0x44cd42){if(_0x44cd42){var _0x42acbe=_[_0x58f6('0x72')](_0x44cd42,function(_0xa9c3e7){var _0x4354af=_0xa9c3e7[_0x58f6('0x34')]({'plain':!![]});return _0x4354af[_0x58f6('0x6e')];});return db['ChatQueue']['find']({'where':{'id':_0x536c77[_0x58f6('0x50')]['id']}})[_0x58f6('0x1e')](function(_0xf644fd){return db[_0x58f6('0x73')][_0x58f6('0x74')](function(_0x39f443){return _0xf644fd[_0x58f6('0x75')](_0xbc04d1,{'transaction':_0x39f443})[_0x58f6('0x1e')](function(){return BPromise[_0x58f6('0x76')](_0x42acbe,function(_0x5f5403){return db['UserChatQueue'][_0x58f6('0x77')]({'where':{'UserId':_0x5f5403['id'],'ChatQueueId':_0x536c77[_0x58f6('0x50')]['id']},'transaction':_0x39f443});});})[_0x58f6('0x1e')](function(){_0x42acbe[_0x58f6('0x78')](function(_0x518673){socket['emit']('userChatQueue:save',{'UserId':_0x518673['id'],'ChatQueueId':_0xf644fd['id']});});});});});}})[_0x58f6('0x1e')](respondWithStatusCode(_0x5c5cc0,null))[_0x58f6('0x28')](handleError(_0x5c5cc0,null));};exports[_0x58f6('0x79')]=function(_0x55d2ac,_0x3e821c,_0x2c38a2){return db['Team'][_0x58f6('0x4d')]({'where':{'id':_0x55d2ac[_0x58f6('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x58f6('0x7a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x58f6('0x1e')](handleEntityNotFound(_0x3e821c,null))['then'](function(_0x467d3e){var _0x4a4948=_[_0x58f6('0x3e')](_0x467d3e,'id');var _0x267785=[];var _0x1de4bb=[];var _0x1c5957=squel[_0x58f6('0x7b')]();_0x1c5957[_0x58f6('0x7c')](_0x58f6('0x7d'))[_0x58f6('0x7e')](_0x58f6('0x7f'),'tq')[_0x58f6('0x80')]('user_has_teams','ut',_0x58f6('0x81'))[_0x58f6('0x48')](_0x58f6('0x82'),_0x55d2ac[_0x58f6('0x50')]['id']);for(var _0x24e041=0x0;_0x24e041<_0x467d3e[_0x58f6('0x53')];_0x24e041+=0x1){let _0x38829d=_0x467d3e[_0x24e041];for(var _0x4f8efc=0x0;_0x4f8efc<_0x38829d[_0x58f6('0x6e')]['length'];_0x4f8efc+=0x1){let _0x35e0ab=_0x38829d[_0x58f6('0x6e')][_0x4f8efc];var _0x2cc7d5=_0x1c5957[_0x58f6('0x83')]();_0x2cc7d5[_0x58f6('0x48')]('ut.UserId\x20=\x20?',_0x35e0ab['id']);_0x1de4bb[_0x58f6('0x84')](db['sequelize'][_0x58f6('0x3f')](_0x2cc7d5[_0x58f6('0x85')](),{'type':db[_0x58f6('0x73')][_0x58f6('0x86')][_0x58f6('0x87')]})[_0x58f6('0x1e')](function(_0x2a1eaf){if(_0x2a1eaf['length']===0x1){return _0x35e0ab['id'];}else{var _0x3a90a9=_[_0x58f6('0x88')](_[_0x58f6('0x3e')](_0x2a1eaf,_0x58f6('0x89')),function(_0x5080a1){return _[_0x58f6('0x8a')](_0x4a4948,_0x5080a1);});if(_0x3a90a9){return _0x35e0ab['id'];}}}));}}return BPromise[_0x58f6('0x8b')](_0x1de4bb)[_0x58f6('0x1e')](function(_0x12ff08){_0x267785=_(_0x267785)[_0x58f6('0x8c')](_0x12ff08)[_0x58f6('0x8d')]()[_0x58f6('0x8e')]();return db[_0x58f6('0x39')][_0x58f6('0x55')]({'where':{'id':_0x55d2ac[_0x58f6('0x50')]['id']}})[_0x58f6('0x1e')](function(_0x2b4960){return db['sequelize'][_0x58f6('0x74')](function(_0x281420){return _0x2b4960[_0x58f6('0x79')](_0x55d2ac['query'][_0x58f6('0x8f')],{'transaction':_0x281420})[_0x58f6('0x1e')](function(){if(!_[_0x58f6('0x90')](_0x267785)){return _0x2b4960[_0x58f6('0x91')](_0x267785,{'transaction':_0x281420});}})['then'](function(){_0x267785[_0x58f6('0x78')](function(_0x1f7bc9){socket['emit'](_0x58f6('0x92'),{'UserId':_0x1f7bc9,'ChatQueueId':_0x2b4960['id']});});});});});});})[_0x58f6('0x1e')](respondWithStatusCode(_0x3e821c,null))[_0x58f6('0x28')](handleError(_0x3e821c,null));};exports[_0x58f6('0x93')]=function(_0x501d3e,_0x16b6e4,_0x3cc108){return db[_0x58f6('0x39')][_0x58f6('0x55')]({'where':{'id':_0x501d3e[_0x58f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x16b6e4,null))['then'](function(_0x215c9b){if(_0x215c9b){return _0x215c9b['addAgents'](_0x501d3e['body'][_0x58f6('0x8f')],_['omit'](_0x501d3e[_0x58f6('0x57')],[_0x58f6('0x8f'),'id'])||{})[_0x58f6('0x94')](function(_0x473049){for(var _0x4bed5f=0x0;_0x4bed5f<_0x501d3e[_0x58f6('0x57')][_0x58f6('0x8f')]['length'];_0x4bed5f+=0x1){socket['emit'](_0x58f6('0x95'),{'UserId':Number(_0x501d3e[_0x58f6('0x57')][_0x58f6('0x8f')][_0x4bed5f]),'ChatQueueId':Number(_0x501d3e[_0x58f6('0x50')]['id'])});}return _0x473049;});}})[_0x58f6('0x1e')](respondWithResult(_0x16b6e4,null))['catch'](handleError(_0x16b6e4,null));};exports[_0x58f6('0x91')]=function(_0x16f7d0,_0x9c062c,_0x3e5d40){return db[_0x58f6('0x39')][_0x58f6('0x55')]({'where':{'id':_0x16f7d0[_0x58f6('0x50')]['id']}})[_0x58f6('0x1e')](handleEntityNotFound(_0x9c062c,null))[_0x58f6('0x1e')](function(_0x260fec){if(_0x260fec){return _0x260fec[_0x58f6('0x91')](_0x16f7d0[_0x58f6('0x3f')][_0x58f6('0x8f')])[_0x58f6('0x1e')](function(){if(_[_0x58f6('0x96')](_0x16f7d0[_0x58f6('0x3f')]['ids'])){for(var _0x2d8f62=0x0;_0x2d8f62<_0x16f7d0['query'][_0x58f6('0x8f')]['length'];_0x2d8f62+=0x1){socket[_0x58f6('0x97')](_0x58f6('0x92'),{'UserId':Number(_0x16f7d0['query'][_0x58f6('0x8f')][_0x2d8f62]),'ChatQueueId':Number(_0x16f7d0[_0x58f6('0x50')]['id'])});}}else{socket[_0x58f6('0x97')](_0x58f6('0x92'),{'UserId':Number(_0x16f7d0[_0x58f6('0x3f')]['ids']),'ChatQueueId':Number(_0x16f7d0[_0x58f6('0x50')]['id'])});}});}})[_0x58f6('0x1e')](respondWithStatusCode(_0x9c062c,null))[_0x58f6('0x28')](handleError(_0x9c062c,null));};exports[_0x58f6('0x98')]=function(_0x32c085,_0x6eaa52,_0x1c3d8e){var _0x405e98={};var _0x2dc9f0={};var _0x3910f5;var _0x55b080;return db['ChatQueue'][_0x58f6('0x61')]({'where':{'id':_0x32c085[_0x58f6('0x50')]['id']}})[_0x58f6('0x1e')](handleEntityNotFound(_0x6eaa52,null))[_0x58f6('0x1e')](function(_0x2a49c2){if(_0x2a49c2){_0x3910f5=_0x2a49c2;_0x2dc9f0[_0x58f6('0x3d')]=_[_0x58f6('0x51')](db[_0x58f6('0x7a')][_0x58f6('0x62')]);_0x2dc9f0[_0x58f6('0x3f')]=_[_0x58f6('0x51')](_0x32c085[_0x58f6('0x3f')]);_0x2dc9f0['filters']=_[_0x58f6('0x42')](_0x2dc9f0[_0x58f6('0x3d')],_0x2dc9f0[_0x58f6('0x3f')]);_0x405e98[_0x58f6('0x41')]=_[_0x58f6('0x42')](_0x2dc9f0[_0x58f6('0x3d')],qs[_0x58f6('0x52')](_0x32c085['query'][_0x58f6('0x52')]));_0x405e98[_0x58f6('0x41')]=_0x405e98[_0x58f6('0x41')][_0x58f6('0x53')]?_0x405e98[_0x58f6('0x41')]:_0x2dc9f0[_0x58f6('0x3d')];_0x405e98['order']=qs[_0x58f6('0x45')](_0x32c085['query'][_0x58f6('0x45')]);_0x405e98[_0x58f6('0x48')]=qs['filters'](_['pick'](_0x32c085[_0x58f6('0x3f')],_0x2dc9f0['filters']));if(_0x32c085[_0x58f6('0x3f')]['filter']){_0x405e98[_0x58f6('0x48')]=_[_0x58f6('0x49')](_0x405e98[_0x58f6('0x48')],{'$or':_[_0x58f6('0x3e')](_0x405e98[_0x58f6('0x41')],function(_0x4906fa){var _0x44f547={};_0x44f547[_0x4906fa]={'$like':'%'+_0x32c085[_0x58f6('0x3f')][_0x58f6('0x47')]+'%'};return _0x44f547;})});}_0x405e98=_['merge']({},_0x405e98,_0x32c085[_0x58f6('0x4b')]);return _0x3910f5[_0x58f6('0x98')](_0x405e98);}})[_0x58f6('0x1e')](function(_0x5eabc7){if(_0x5eabc7){_0x55b080=_0x5eabc7[_0x58f6('0x53')];if(!_0x32c085[_0x58f6('0x3f')][_0x58f6('0x43')](_0x58f6('0x63'))){_0x405e98[_0x58f6('0x2f')]=qs[_0x58f6('0x2f')](_0x32c085[_0x58f6('0x3f')]['limit']);_0x405e98[_0x58f6('0x2e')]=qs['offset'](_0x32c085[_0x58f6('0x3f')][_0x58f6('0x2e')]);}return _0x3910f5[_0x58f6('0x98')](_0x405e98);}})[_0x58f6('0x1e')](function(_0x3461ac){if(_0x3461ac){return _0x3461ac?{'count':_0x55b080,'rows':_0x3461ac}:null;}})[_0x58f6('0x1e')](respondWithResult(_0x6eaa52,null))[_0x58f6('0x28')](handleError(_0x6eaa52,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 20cdd20..819b57c 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 _0x5400=['exports','events','../../mysqldb','emit','hook'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x5400,0x15f));var _0x0540=function(_0x19c1c9,_0x238c89){_0x19c1c9=_0x19c1c9-0x0;var _0x1c64dd=_0x5400[_0x19c1c9];return _0x1c64dd;};'use strict';var EventEmitter=require(_0x0540('0x0'));var ChatQueue=require(_0x0540('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x388ed6){return function(_0x48b1bf,_0x5ea2b3,_0x4f5fb3){ChatQueueEvents[_0x0540('0x2')](_0x388ed6+':'+_0x48b1bf['id'],_0x48b1bf);ChatQueueEvents[_0x0540('0x2')](_0x388ed6,_0x48b1bf);_0x4f5fb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x0540('0x3')](e,emitEvent(event));}}module[_0x0540('0x4')]=ChatQueueEvents; \ No newline at end of file +var _0x1d18=['../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x1d18,0x10d));var _0x81d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d18[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x81d1('0x0'));var ChatQueue=require(_0x81d1('0x1'))['db'][_0x81d1('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x81d1('0x3')](0x0);var events={'afterCreate':_0x81d1('0x4'),'afterUpdate':'update','afterDestroy':_0x81d1('0x5')};function emitEvent(_0x486ff4){return function(_0x45bba6,_0x25d207,_0x5c62b3){ChatQueueEvents[_0x81d1('0x6')](_0x486ff4+':'+_0x45bba6['id'],_0x45bba6);ChatQueueEvents[_0x81d1('0x6')](_0x486ff4,_0x45bba6);_0x5c62b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x81d1('0x7')](e,emitEvent(event));}}module[_0x81d1('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7a254a3..f3aeec3 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 _0x0878=['ChatQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0xec7ddf,_0x41a30c){var _0x1145a6=function(_0x216256){while(--_0x216256){_0xec7ddf['push'](_0xec7ddf['shift']());}};_0x1145a6(++_0x41a30c);}(_0x0878,0x105));var _0x8087=function(_0x5cc834,_0x109903){_0x5cc834=_0x5cc834-0x0;var _0x5125b6=_0x0878[_0x5cc834];return _0x5125b6;};'use strict';var _=require(_0x8087('0x0'));var util=require(_0x8087('0x1'));var logger=require(_0x8087('0x2'))(_0x8087('0x3'));var moment=require(_0x8087('0x4'));var BPromise=require(_0x8087('0x5'));var rp=require(_0x8087('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8087('0x7'));var config=require(_0x8087('0x8'));var attributes=require(_0x8087('0x9'));module[_0x8087('0xa')]=function(_0x126cd0,_0x55c8ca){return _0x126cd0[_0x8087('0xb')](_0x8087('0xc'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x667c=['chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','ChatQueue'];(function(_0x305e84,_0x48ef99){var _0x4e38eb=function(_0x585143){while(--_0x585143){_0x305e84['push'](_0x305e84['shift']());}};_0x4e38eb(++_0x48ef99);}(_0x667c,0x141));var _0xc667=function(_0x507e29,_0x8897aa){_0x507e29=_0x507e29-0x0;var _0x4f1ef9=_0x667c[_0x507e29];return _0x4f1ef9;};'use strict';var _=require(_0xc667('0x0'));var util=require(_0xc667('0x1'));var logger=require(_0xc667('0x2'))(_0xc667('0x3'));var moment=require('moment');var BPromise=require(_0xc667('0x4'));var rp=require(_0xc667('0x5'));var fs=require('fs');var path=require(_0xc667('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0xc667('0x7')]=function(_0x54eeba,_0x34b4ee){return _0x54eeba['define'](_0xc667('0x8'),attributes,{'tableName':_0xc667('0x9'),'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 488a117..e48d348 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 _0x2e16=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueue','options','raw','where','attributes','limit','include','map','model','debug','GetChatQueue','catch','ShowChatQueue','lodash','randomstring','ioredis'];(function(_0x34d812,_0x36c464){var _0x1cd40b=function(_0x40b78d){while(--_0x40b78d){_0x34d812['push'](_0x34d812['shift']());}};_0x1cd40b(++_0x36c464);}(_0x2e16,0x8d));var _0x62e1=function(_0x3e9507,_0x111f53){_0x3e9507=_0x3e9507-0x0;var _0x2fb7df=_0x2e16[_0x3e9507];return _0x2fb7df;};'use strict';var _=require(_0x62e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x62e1('0x1'));var fs=require('fs');var Redis=require(_0x62e1('0x2'));var db=require(_0x62e1('0x3'))['db'];var utils=require(_0x62e1('0x4'));var logger=require('../../config/logger')(_0x62e1('0x5'));var config=require(_0x62e1('0x6'));var jayson=require(_0x62e1('0x7'));var client=jayson[_0x62e1('0x8')][_0x62e1('0x9')]({'port':0x232a});config[_0x62e1('0xa')]=_[_0x62e1('0xb')](config[_0x62e1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x62e1('0xc'))(new Redis(config[_0x62e1('0xa')]));require('./chatQueue.socket')[_0x62e1('0xd')](socket);function respondWithRpcPromise(_0x528ec6,_0x4f66e4,_0x2bd27c){return new BPromise(function(_0xbc14e4,_0x3d741f){return client[_0x62e1('0xe')](_0x528ec6,_0x2bd27c)[_0x62e1('0xf')](function(_0xab7486){logger[_0x62e1('0x10')](_0x62e1('0x11'),_0x4f66e4,_0x62e1('0x12'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4f66e4,_0x62e1('0x12'),JSON[_0x62e1('0x13')](_0xab7486));if(_0xab7486[_0x62e1('0x14')]){if(_0xab7486[_0x62e1('0x14')][_0x62e1('0x15')]===0x1f4){logger[_0x62e1('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4f66e4,_0xab7486[_0x62e1('0x14')][_0x62e1('0x16')]);return _0x3d741f(_0xab7486['error'][_0x62e1('0x16')]);}logger[_0x62e1('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4f66e4,_0xab7486[_0x62e1('0x14')][_0x62e1('0x16')]);return _0xbc14e4(_0xab7486['error'][_0x62e1('0x16')]);}else{logger['info'](_0x62e1('0x11'),_0x4f66e4,_0x62e1('0x12'));_0xbc14e4(_0xab7486['result']['message']);}})['catch'](function(_0x4d63a0){logger[_0x62e1('0x14')](_0x62e1('0x11'),_0x4f66e4,_0x4d63a0);_0x3d741f(_0x4d63a0);});});}exports['GetChatQueue']=function(_0x295f93){var _0x3bdf8e=this;return new Promise(function(_0x5d1142,_0x3a232a){return db[_0x62e1('0x17')]['findAll']({'raw':_0x295f93[_0x62e1('0x18')]?_0x295f93[_0x62e1('0x18')][_0x62e1('0x19')]===undefined?!![]:![]:!![],'where':_0x295f93['options']?_0x295f93[_0x62e1('0x18')][_0x62e1('0x1a')]||null:null,'attributes':_0x295f93[_0x62e1('0x18')]?_0x295f93[_0x62e1('0x18')][_0x62e1('0x1b')]||null:null,'limit':_0x295f93[_0x62e1('0x18')]?_0x295f93[_0x62e1('0x18')][_0x62e1('0x1c')]||null:null,'include':_0x295f93[_0x62e1('0x18')]?_0x295f93['options'][_0x62e1('0x1d')]?_['map'](_0x295f93[_0x62e1('0x18')][_0x62e1('0x1d')],function(_0xba9310){return{'model':db[_0xba9310['model']],'as':_0xba9310['as'],'attributes':_0xba9310[_0x62e1('0x1b')],'include':_0xba9310[_0x62e1('0x1d')]?_[_0x62e1('0x1e')](_0xba9310['include'],function(_0x563338){return{'model':db[_0x563338['model']],'as':_0x563338['as'],'attributes':_0x563338['attributes'],'include':_0x563338[_0x62e1('0x1d')]?_[_0x62e1('0x1e')](_0x563338[_0x62e1('0x1d')],function(_0x48cb73){return{'model':db[_0x48cb73[_0x62e1('0x1f')]],'as':_0x48cb73['as'],'attributes':_0x48cb73[_0x62e1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62e1('0xf')](function(_0x9b39f2){logger[_0x62e1('0x10')]('GetChatQueue',_0x295f93);logger[_0x62e1('0x20')](_0x62e1('0x21'),_0x295f93,JSON[_0x62e1('0x13')](_0x9b39f2));_0x5d1142(_0x9b39f2);})[_0x62e1('0x22')](function(_0x4482d8){logger['error'](_0x62e1('0x21'),_0x4482d8[_0x62e1('0x16')],_0x295f93);_0x3a232a(_0x3bdf8e[_0x62e1('0x14')](0x1f4,_0x4482d8[_0x62e1('0x16')]));});});};exports[_0x62e1('0x23')]=function(_0x4c0d52){var _0x24cdb5=this;return new Promise(function(_0x405981,_0x48cb78){return db[_0x62e1('0x17')]['find']({'raw':_0x4c0d52[_0x62e1('0x18')]?_0x4c0d52['options'][_0x62e1('0x19')]===undefined?!![]:![]:!![],'where':_0x4c0d52[_0x62e1('0x18')]?_0x4c0d52[_0x62e1('0x18')][_0x62e1('0x1a')]||null:null,'attributes':_0x4c0d52[_0x62e1('0x18')]?_0x4c0d52[_0x62e1('0x18')][_0x62e1('0x1b')]||null:null,'include':_0x4c0d52[_0x62e1('0x18')]?_0x4c0d52['options'][_0x62e1('0x1d')]?_[_0x62e1('0x1e')](_0x4c0d52['options'][_0x62e1('0x1d')],function(_0x421d76){return{'model':db[_0x421d76[_0x62e1('0x1f')]],'as':_0x421d76['as'],'attributes':_0x421d76[_0x62e1('0x1b')],'include':_0x421d76[_0x62e1('0x1d')]?_[_0x62e1('0x1e')](_0x421d76[_0x62e1('0x1d')],function(_0x5393c2){return{'model':db[_0x5393c2[_0x62e1('0x1f')]],'as':_0x5393c2['as'],'attributes':_0x5393c2[_0x62e1('0x1b')],'include':_0x5393c2[_0x62e1('0x1d')]?_['map'](_0x5393c2[_0x62e1('0x1d')],function(_0x4a5b91){return{'model':db[_0x4a5b91[_0x62e1('0x1f')]],'as':_0x4a5b91['as'],'attributes':_0x4a5b91[_0x62e1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e413){logger['info'](_0x62e1('0x23'),_0x4c0d52);logger[_0x62e1('0x20')]('ShowChatQueue',_0x4c0d52,JSON[_0x62e1('0x13')](_0x35e413));_0x405981(_0x35e413);})[_0x62e1('0x22')](function(_0x28a416){logger['error'](_0x62e1('0x23'),_0x28a416[_0x62e1('0x16')],_0x4c0d52);_0x48cb78(_0x24cdb5[_0x62e1('0x14')](0x1f4,_0x28a416[_0x62e1('0x16')]));});});}; \ No newline at end of file +var _0xf7a1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowChatQueue','find','lodash','util','moment'];(function(_0x3f30bb,_0x147ea7){var _0x370835=function(_0x459ff6){while(--_0x459ff6){_0x3f30bb['push'](_0x3f30bb['shift']());}};_0x370835(++_0x147ea7);}(_0xf7a1,0xed));var _0x1f7a=function(_0x1dfce3,_0x491d21){_0x1dfce3=_0x1dfce3-0x0;var _0x127504=_0xf7a1[_0x1dfce3];return _0x127504;};'use strict';var _=require(_0x1f7a('0x0'));var util=require(_0x1f7a('0x1'));var moment=require(_0x1f7a('0x2'));var BPromise=require(_0x1f7a('0x3'));var rs=require(_0x1f7a('0x4'));var fs=require('fs');var Redis=require(_0x1f7a('0x5'));var db=require(_0x1f7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f7a('0x7'))('rpc');var config=require(_0x1f7a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f7a('0x9')]({'port':0x232a});config[_0x1f7a('0xa')]=_[_0x1f7a('0xb')](config[_0x1f7a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f7a('0xc'))(new Redis(config[_0x1f7a('0xa')]));require(_0x1f7a('0xd'))[_0x1f7a('0xe')](socket);function respondWithRpcPromise(_0x5d357a,_0x527b0a,_0x4d0838){return new BPromise(function(_0x1cc3b8,_0xd2296){return client['request'](_0x5d357a,_0x4d0838)[_0x1f7a('0xf')](function(_0x57deac){logger[_0x1f7a('0x10')](_0x1f7a('0x11'),_0x527b0a,_0x1f7a('0x12'));logger[_0x1f7a('0x13')](_0x1f7a('0x14'),_0x527b0a,_0x1f7a('0x12'),JSON[_0x1f7a('0x15')](_0x57deac));if(_0x57deac[_0x1f7a('0x16')]){if(_0x57deac[_0x1f7a('0x16')][_0x1f7a('0x17')]===0x1f4){logger[_0x1f7a('0x16')](_0x1f7a('0x11'),_0x527b0a,_0x57deac[_0x1f7a('0x16')][_0x1f7a('0x18')]);return _0xd2296(_0x57deac[_0x1f7a('0x16')][_0x1f7a('0x18')]);}logger['error'](_0x1f7a('0x11'),_0x527b0a,_0x57deac[_0x1f7a('0x16')][_0x1f7a('0x18')]);return _0x1cc3b8(_0x57deac['error']['message']);}else{logger['info'](_0x1f7a('0x11'),_0x527b0a,_0x1f7a('0x12'));_0x1cc3b8(_0x57deac[_0x1f7a('0x19')]['message']);}})['catch'](function(_0x2998ab){logger[_0x1f7a('0x16')](_0x1f7a('0x11'),_0x527b0a,_0x2998ab);_0xd2296(_0x2998ab);});});}exports[_0x1f7a('0x1a')]=function(_0x4f1a32){var _0x33151b=this;return new Promise(function(_0x92fcc0,_0x68bd8e){return db[_0x1f7a('0x1b')][_0x1f7a('0x1c')]({'raw':_0x4f1a32['options']?_0x4f1a32['options'][_0x1f7a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f1a32[_0x1f7a('0x1e')]?_0x4f1a32[_0x1f7a('0x1e')][_0x1f7a('0x1f')]||null:null,'attributes':_0x4f1a32[_0x1f7a('0x1e')]?_0x4f1a32['options'][_0x1f7a('0x20')]||null:null,'limit':_0x4f1a32[_0x1f7a('0x1e')]?_0x4f1a32[_0x1f7a('0x1e')][_0x1f7a('0x21')]||null:null,'include':_0x4f1a32[_0x1f7a('0x1e')]?_0x4f1a32[_0x1f7a('0x1e')][_0x1f7a('0x22')]?_[_0x1f7a('0x23')](_0x4f1a32[_0x1f7a('0x1e')][_0x1f7a('0x22')],function(_0x112c6a){return{'model':db[_0x112c6a['model']],'as':_0x112c6a['as'],'attributes':_0x112c6a[_0x1f7a('0x20')],'include':_0x112c6a['include']?_['map'](_0x112c6a[_0x1f7a('0x22')],function(_0x4060ed){return{'model':db[_0x4060ed[_0x1f7a('0x24')]],'as':_0x4060ed['as'],'attributes':_0x4060ed['attributes'],'include':_0x4060ed['include']?_[_0x1f7a('0x23')](_0x4060ed[_0x1f7a('0x22')],function(_0x20d580){return{'model':db[_0x20d580[_0x1f7a('0x24')]],'as':_0x20d580['as'],'attributes':_0x20d580[_0x1f7a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f5add){logger['info'](_0x1f7a('0x1a'),_0x4f1a32);logger[_0x1f7a('0x13')](_0x1f7a('0x1a'),_0x4f1a32,JSON['stringify'](_0x5f5add));_0x92fcc0(_0x5f5add);})[_0x1f7a('0x25')](function(_0x25fe34){logger[_0x1f7a('0x16')](_0x1f7a('0x1a'),_0x25fe34[_0x1f7a('0x18')],_0x4f1a32);_0x68bd8e(_0x33151b[_0x1f7a('0x16')](0x1f4,_0x25fe34[_0x1f7a('0x18')]));});});};exports[_0x1f7a('0x26')]=function(_0x2d13b0){var _0x238b09=this;return new Promise(function(_0x4caf76,_0x2746e8){return db[_0x1f7a('0x1b')][_0x1f7a('0x27')]({'raw':_0x2d13b0[_0x1f7a('0x1e')]?_0x2d13b0[_0x1f7a('0x1e')][_0x1f7a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d13b0[_0x1f7a('0x1e')]?_0x2d13b0[_0x1f7a('0x1e')]['where']||null:null,'attributes':_0x2d13b0[_0x1f7a('0x1e')]?_0x2d13b0[_0x1f7a('0x1e')][_0x1f7a('0x20')]||null:null,'include':_0x2d13b0[_0x1f7a('0x1e')]?_0x2d13b0[_0x1f7a('0x1e')][_0x1f7a('0x22')]?_[_0x1f7a('0x23')](_0x2d13b0['options']['include'],function(_0x662a0a){return{'model':db[_0x662a0a[_0x1f7a('0x24')]],'as':_0x662a0a['as'],'attributes':_0x662a0a[_0x1f7a('0x20')],'include':_0x662a0a['include']?_[_0x1f7a('0x23')](_0x662a0a['include'],function(_0x378364){return{'model':db[_0x378364['model']],'as':_0x378364['as'],'attributes':_0x378364[_0x1f7a('0x20')],'include':_0x378364[_0x1f7a('0x22')]?_[_0x1f7a('0x23')](_0x378364[_0x1f7a('0x22')],function(_0x359936){return{'model':db[_0x359936[_0x1f7a('0x24')]],'as':_0x359936['as'],'attributes':_0x359936[_0x1f7a('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1f7a('0xf')](function(_0x25214d){logger[_0x1f7a('0x10')](_0x1f7a('0x26'),_0x2d13b0);logger[_0x1f7a('0x13')](_0x1f7a('0x26'),_0x2d13b0,JSON['stringify'](_0x25214d));_0x4caf76(_0x25214d);})[_0x1f7a('0x25')](function(_0x21de85){logger[_0x1f7a('0x16')](_0x1f7a('0x26'),_0x21de85[_0x1f7a('0x18')],_0x2d13b0);_0x2746e8(_0x238b09['error'](0x1f4,_0x21de85[_0x1f7a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 77a8268..dc30b94 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 _0x2dae=['remove','update','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x2e6ac8,_0x2803a7){var _0x359f61=function(_0x5c5edb){while(--_0x5c5edb){_0x2e6ac8['push'](_0x2e6ac8['shift']());}};_0x359f61(++_0x2803a7);}(_0x2dae,0xc3));var _0xe2da=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0x2dae[_0xf34b0a];return _0x5021e1;};'use strict';var ChatQueueEvents=require(_0xe2da('0x0'));var events=['save',_0xe2da('0x1'),_0xe2da('0x2')];function createListener(_0xcd0055,_0x167432){return function(_0x99b46f){_0x167432['emit'](_0xcd0055,_0x99b46f);};}function removeListener(_0x25b9f2,_0x439b5d){return function(){ChatQueueEvents[_0xe2da('0x3')](_0x25b9f2,_0x439b5d);};}exports[_0xe2da('0x4')]=function(_0x523c60){for(var _0x3e3e25=0x0,_0x89c70b=events[_0xe2da('0x5')];_0x3e3e25<_0x89c70b;_0x3e3e25++){var _0x2efbd8=events[_0x3e3e25];var _0x238da3=createListener(_0xe2da('0x6')+_0x2efbd8,_0x523c60);ChatQueueEvents['on'](_0x2efbd8,_0x238da3);}}; \ No newline at end of file +var _0x34e8=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x34e8,0x12c));var _0x834e=function(_0x52bc93,_0x20248e){_0x52bc93=_0x52bc93-0x0;var _0x1bf392=_0x34e8[_0x52bc93];return _0x1bf392;};'use strict';var ChatQueueEvents=require(_0x834e('0x0'));var events=[_0x834e('0x1'),_0x834e('0x2'),_0x834e('0x3')];function createListener(_0x530939,_0x832422){return function(_0x21e2e0){_0x832422[_0x834e('0x4')](_0x530939,_0x21e2e0);};}function removeListener(_0x31bf20,_0x289ef2){return function(){ChatQueueEvents[_0x834e('0x5')](_0x31bf20,_0x289ef2);};}exports[_0x834e('0x6')]=function(_0x4a2018){for(var _0x858aa1=0x0,_0x52056d=events[_0x834e('0x7')];_0x858aa1<_0x52056d;_0x858aa1++){var _0x3cc2e3=events[_0x858aa1];var _0x3a3ef6=createListener(_0x834e('0x8')+_0x3cc2e3,_0x4a2018);ChatQueueEvents['on'](_0x3cc2e3,_0x3a3ef6);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0ad7b2f..5d6a00c 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x203e08,_0x15d5c5){var _0x3a0493=function(_0x272f51){while(--_0x272f51){_0x203e08['push'](_0x203e08['shift']());}};_0x3a0493(++_0x15d5c5);}(_0xe14b,0x93));var _0xbe14=function(_0x2da8c2,_0x372428){_0x2da8c2=_0x2da8c2-0x0;var _0x230adb=_0xe14b[_0x2da8c2];return _0x230adb;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x2dc942,_0x583b72){var _0x5e89f5=function(_0x27bab4){while(--_0x27bab4){_0x2dc942['push'](_0x2dc942['shift']());}};_0x5e89f5(++_0x583b72);}(_0xe14b,0x93));var _0xbe14=function(_0x5804c8,_0x57af4d){_0x5804c8=_0x5804c8-0x0;var _0x33d432=_0xe14b[_0x5804c8];return _0x33d432;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c0feb84..145e696 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 _0x557b=['exports','STRING','DATE'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x557b,0x1b9));var _0xb557=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x557b[_0x278e3c];return _0x3e2d9b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb557('0x0')]={'uniqueid':{'type':Sequelize[_0xb557('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb557('0x1')]},'joinAt':{'type':Sequelize[_0xb557('0x2')]},'leaveAt':{'type':Sequelize[_0xb557('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb557('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe58a=['DATE','moment','STRING'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xe58a,0x115));var _0xae58=function(_0x375105,_0x3807ab){_0x375105=_0x375105-0x0;var _0x316092=_0xe58a[_0x375105];return _0x316092;};'use strict';var moment=require(_0xae58('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xae58('0x1')]},'joinAt':{'type':Sequelize[_0xae58('0x2')]},'leaveAt':{'type':Sequelize[_0xae58('0x2')]},'acceptAt':{'type':Sequelize[_0xae58('0x2')]},'exitAt':{'type':Sequelize[_0xae58('0x2')]},'reason':{'type':Sequelize[_0xae58('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6877842..8a8e481 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 _0x7f27=['body','describe','eml-format','rimraf','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatQueueReport','rawAttributes','type','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','fields','find','create'];(function(_0x36cecf,_0x4f952f){var _0x11bc23=function(_0x3d46da){while(--_0x3d46da){_0x36cecf['push'](_0x36cecf['shift']());}};_0x11bc23(++_0x4f952f);}(_0x7f27,0x12e));var _0x77f2=function(_0x437f10,_0x19556e){_0x437f10=_0x437f10-0x0;var _0x5a8640=_0x7f27[_0x437f10];return _0x5a8640;};'use strict';var emlformat=require(_0x77f2('0x0'));var rimraf=require(_0x77f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77f2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77f2('0x3'));var util=require(_0x77f2('0x4'));var path=require(_0x77f2('0x5'));var sox=require('sox');var csv=require(_0x77f2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77f2('0x7'));var _=require(_0x77f2('0x8'));var squel=require('squel');var crypto=require(_0x77f2('0x9'));var jsforce=require(_0x77f2('0xa'));var deskjs=require(_0x77f2('0xb'));var toCsv=require(_0x77f2('0x6'));var querystring=require('querystring');var Papa=require(_0x77f2('0xc'));var Redis=require(_0x77f2('0xd'));var authService=require(_0x77f2('0xe'));var qs=require(_0x77f2('0xf'));var as=require(_0x77f2('0x10'));var hardwareService=require(_0x77f2('0x11'));var logger=require(_0x77f2('0x12'))(_0x77f2('0x13'));var utils=require(_0x77f2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77f2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d9f74,_0x22b2fb){_0x22b2fb=_0x22b2fb||0xcc;return function(_0x2fda15){if(_0x2fda15){return _0x5d9f74[_0x77f2('0x16')](_0x22b2fb);}return _0x5d9f74[_0x77f2('0x17')](_0x22b2fb)[_0x77f2('0x18')]();};}function respondWithResult(_0x1ee66f,_0x4d5ab5){_0x4d5ab5=_0x4d5ab5||0xc8;return function(_0x330e80){if(_0x330e80){return _0x1ee66f[_0x77f2('0x17')](_0x4d5ab5)[_0x77f2('0x19')](_0x330e80);}};}function respondWithFilteredResult(_0x1c6edf,_0x178a9a){return function(_0xf437f2){if(_0xf437f2){var _0x64471d=typeof _0x178a9a[_0x77f2('0x1a')]===_0x77f2('0x1b')&&typeof _0x178a9a['limit']===_0x77f2('0x1b');var _0x528f02=_0xf437f2[_0x77f2('0x1c')];var _0xffdf18=_0x64471d?0x0:_0x178a9a[_0x77f2('0x1a')];var _0x4db73f=_0x64471d?_0xf437f2[_0x77f2('0x1c')]:_0x178a9a[_0x77f2('0x1a')]+_0x178a9a[_0x77f2('0x1d')];var _0x270ba7;if(_0x4db73f>=_0x528f02){_0x4db73f=_0x528f02;_0x270ba7=0xc8;}else{_0x270ba7=0xce;}_0x1c6edf[_0x77f2('0x17')](_0x270ba7);return _0x1c6edf[_0x77f2('0x1e')](_0x77f2('0x1f'),_0xffdf18+'-'+_0x4db73f+'/'+_0x528f02)[_0x77f2('0x19')](_0xf437f2);}return null;};}function patchUpdates(_0x3a8ce2){return function(_0x3c5848){try{jsonpatch[_0x77f2('0x20')](_0x3c5848,_0x3a8ce2,!![]);}catch(_0x460941){return BPromise[_0x77f2('0x21')](_0x460941);}return _0x3c5848[_0x77f2('0x22')]();};}function saveUpdates(_0x369eb1,_0x4a2599){return function(_0x3db6d2){if(_0x3db6d2){return _0x3db6d2[_0x77f2('0x23')](_0x369eb1)[_0x77f2('0x24')](function(_0x897e3c){return _0x897e3c;});}return null;};}function removeEntity(_0x1d30e4,_0x4970d7){return function(_0x2afa88){if(_0x2afa88){return _0x2afa88[_0x77f2('0x25')]()[_0x77f2('0x24')](function(){_0x1d30e4[_0x77f2('0x17')](0xcc)[_0x77f2('0x18')]();});}};}function handleEntityNotFound(_0x37fba4,_0x311e2b){return function(_0x42f510){if(!_0x42f510){_0x37fba4['sendStatus'](0x194);}return _0x42f510;};}function handleError(_0xc29e22,_0x427cab){_0x427cab=_0x427cab||0x1f4;return function(_0x256f8b){logger[_0x77f2('0x26')](_0x256f8b['stack']);if(_0x256f8b[_0x77f2('0x27')]){delete _0x256f8b[_0x77f2('0x27')];}_0xc29e22[_0x77f2('0x17')](_0x427cab)[_0x77f2('0x28')](_0x256f8b);};}exports[_0x77f2('0x29')]=function(_0x5a260f,_0x572121){var _0x57f467={},_0x341f63={},_0x4c173e={'count':0x0,'rows':[]};var _0x325af6=_[_0x77f2('0x2a')](db[_0x77f2('0x2b')][_0x77f2('0x2c')],function(_0x5402b2){return{'name':_0x5402b2['fieldName'],'type':_0x5402b2[_0x77f2('0x2d')]['key']};});_0x341f63[_0x77f2('0x2e')]=_[_0x77f2('0x2a')](_0x325af6,_0x77f2('0x27'));_0x341f63[_0x77f2('0x2f')]=_[_0x77f2('0x30')](_0x5a260f[_0x77f2('0x2f')]);_0x341f63[_0x77f2('0x31')]=_['intersection'](_0x341f63['model'],_0x341f63[_0x77f2('0x2f')]);_0x57f467[_0x77f2('0x32')]=_['intersection'](_0x341f63[_0x77f2('0x2e')],qs['fields'](_0x5a260f[_0x77f2('0x2f')]['fields']));_0x57f467['attributes']=_0x57f467['attributes'][_0x77f2('0x33')]?_0x57f467[_0x77f2('0x32')]:_0x341f63[_0x77f2('0x2e')];if(!_0x5a260f['query'][_0x77f2('0x34')](_0x77f2('0x35'))){_0x57f467['limit']=qs['limit'](_0x5a260f[_0x77f2('0x2f')][_0x77f2('0x1d')]);_0x57f467[_0x77f2('0x1a')]=qs[_0x77f2('0x1a')](_0x5a260f[_0x77f2('0x2f')][_0x77f2('0x1a')]);}_0x57f467[_0x77f2('0x36')]=qs[_0x77f2('0x37')](_0x5a260f[_0x77f2('0x2f')]['sort']);_0x57f467['where']=qs['filters'](_[_0x77f2('0x38')](_0x5a260f[_0x77f2('0x2f')],_0x341f63['filters']),_0x325af6);if(_0x5a260f[_0x77f2('0x2f')][_0x77f2('0x39')]){_0x57f467[_0x77f2('0x3a')]=_[_0x77f2('0x3b')](_0x57f467[_0x77f2('0x3a')],{'$or':_[_0x77f2('0x2a')](_0x325af6,function(_0x14de24){if(_0x14de24[_0x77f2('0x2d')]!==_0x77f2('0x3c')){var _0x3df75a={};_0x3df75a[_0x14de24[_0x77f2('0x27')]]={'$like':'%'+_0x5a260f[_0x77f2('0x2f')]['filter']+'%'};return _0x3df75a;}})});}_0x57f467=_['merge']({},_0x57f467,_0x5a260f[_0x77f2('0x3d')]);var _0x15b4d0={'where':_0x57f467[_0x77f2('0x3a')]};return db['ChatQueueReport'][_0x77f2('0x1c')](_0x15b4d0)[_0x77f2('0x24')](function(_0x194599){_0x4c173e['count']=_0x194599;if(_0x5a260f[_0x77f2('0x2f')][_0x77f2('0x3e')]){_0x57f467[_0x77f2('0x3f')]=[{'all':!![]}];}return db[_0x77f2('0x2b')][_0x77f2('0x40')](_0x57f467);})[_0x77f2('0x24')](function(_0x1207c1){_0x4c173e[_0x77f2('0x41')]=_0x1207c1;return _0x4c173e;})[_0x77f2('0x24')](respondWithFilteredResult(_0x572121,_0x57f467))[_0x77f2('0x42')](handleError(_0x572121,null));};exports[_0x77f2('0x43')]=function(_0x4fb849,_0x50d6db){var _0x3edbe1={'raw':!![],'where':{'id':_0x4fb849[_0x77f2('0x44')]['id']}},_0x12cb58={};_0x12cb58[_0x77f2('0x2e')]=_[_0x77f2('0x30')](db[_0x77f2('0x2b')][_0x77f2('0x2c')]);_0x12cb58['query']=_[_0x77f2('0x30')](_0x4fb849[_0x77f2('0x2f')]);_0x12cb58[_0x77f2('0x31')]=_[_0x77f2('0x45')](_0x12cb58[_0x77f2('0x2e')],_0x12cb58[_0x77f2('0x2f')]);_0x3edbe1[_0x77f2('0x32')]=_[_0x77f2('0x45')](_0x12cb58[_0x77f2('0x2e')],qs['fields'](_0x4fb849[_0x77f2('0x2f')][_0x77f2('0x46')]));_0x3edbe1[_0x77f2('0x32')]=_0x3edbe1[_0x77f2('0x32')][_0x77f2('0x33')]?_0x3edbe1[_0x77f2('0x32')]:_0x12cb58[_0x77f2('0x2e')];if(_0x4fb849[_0x77f2('0x2f')][_0x77f2('0x3e')]){_0x3edbe1[_0x77f2('0x3f')]=[{'all':!![]}];}_0x3edbe1=_[_0x77f2('0x3b')]({},_0x3edbe1,_0x4fb849[_0x77f2('0x3d')]);return db[_0x77f2('0x2b')][_0x77f2('0x47')](_0x3edbe1)[_0x77f2('0x24')](handleEntityNotFound(_0x50d6db,null))['then'](respondWithResult(_0x50d6db,null))[_0x77f2('0x42')](handleError(_0x50d6db,null));};exports[_0x77f2('0x48')]=function(_0x3ab443,_0x1b8afa){return db['ChatQueueReport'][_0x77f2('0x48')](_0x3ab443[_0x77f2('0x49')],{})[_0x77f2('0x24')](respondWithResult(_0x1b8afa,0xc9))['catch'](handleError(_0x1b8afa,null));};exports[_0x77f2('0x23')]=function(_0x2b50ac,_0x3156fb){if(_0x2b50ac[_0x77f2('0x49')]['id']){delete _0x2b50ac[_0x77f2('0x49')]['id'];}return db[_0x77f2('0x2b')][_0x77f2('0x47')]({'where':{'id':_0x2b50ac['params']['id']}})['then'](handleEntityNotFound(_0x3156fb,null))[_0x77f2('0x24')](saveUpdates(_0x2b50ac[_0x77f2('0x49')],null))[_0x77f2('0x24')](respondWithResult(_0x3156fb,null))[_0x77f2('0x42')](handleError(_0x3156fb,null));};exports[_0x77f2('0x25')]=function(_0xfa5b6a,_0x2a94ac){return db['ChatQueueReport'][_0x77f2('0x47')]({'where':{'id':_0xfa5b6a[_0x77f2('0x44')]['id']}})[_0x77f2('0x24')](handleEntityNotFound(_0x2a94ac,null))['then'](removeEntity(_0x2a94ac,null))['catch'](handleError(_0x2a94ac,null));};exports[_0x77f2('0x4a')]=function(_0x1a9883,_0x50e1c2){return db[_0x77f2('0x2b')][_0x77f2('0x4a')]()[_0x77f2('0x24')](respondWithResult(_0x50e1c2,null))[_0x77f2('0x42')](handleError(_0x50e1c2,null));}; \ No newline at end of file +var _0x905a=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','catch','create','body','find','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x905a,0xeb));var _0xa905=function(_0x19059c,_0x343ca8){_0x19059c=_0x19059c-0x0;var _0xf73ece=_0x905a[_0x19059c];return _0xf73ece;};'use strict';var emlformat=require(_0xa905('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa905('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa905('0x2'));var BPromise=require(_0xa905('0x3'));var Mustache=require(_0xa905('0x4'));var util=require(_0xa905('0x5'));var path=require(_0xa905('0x6'));var sox=require(_0xa905('0x7'));var csv=require(_0xa905('0x8'));var ejs=require(_0xa905('0x9'));var fs=require('fs');var fs_extra=require(_0xa905('0xa'));var _=require(_0xa905('0xb'));var squel=require(_0xa905('0xc'));var crypto=require(_0xa905('0xd'));var jsforce=require(_0xa905('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa905('0x8'));var querystring=require('querystring');var Papa=require(_0xa905('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa905('0x10'));var as=require(_0xa905('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa905('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa905('0x13'));var licenseUtil=require(_0xa905('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54e06c,_0x3272df){_0x3272df=_0x3272df||0xcc;return function(_0x1caa49){if(_0x1caa49){return _0x54e06c[_0xa905('0x15')](_0x3272df);}return _0x54e06c[_0xa905('0x16')](_0x3272df)[_0xa905('0x17')]();};}function respondWithResult(_0xbe0d64,_0x4c42a4){_0x4c42a4=_0x4c42a4||0xc8;return function(_0x3ec259){if(_0x3ec259){return _0xbe0d64['status'](_0x4c42a4)[_0xa905('0x18')](_0x3ec259);}};}function respondWithFilteredResult(_0x97332d,_0x5990c8){return function(_0x58341f){if(_0x58341f){var _0x5b7b12=typeof _0x5990c8[_0xa905('0x19')]===_0xa905('0x1a')&&typeof _0x5990c8[_0xa905('0x1b')]===_0xa905('0x1a');var _0x185c1c=_0x58341f[_0xa905('0x1c')];var _0x1439d5=_0x5b7b12?0x0:_0x5990c8[_0xa905('0x19')];var _0xa59b33=_0x5b7b12?_0x58341f[_0xa905('0x1c')]:_0x5990c8[_0xa905('0x19')]+_0x5990c8[_0xa905('0x1b')];var _0x56c09f;if(_0xa59b33>=_0x185c1c){_0xa59b33=_0x185c1c;_0x56c09f=0xc8;}else{_0x56c09f=0xce;}_0x97332d[_0xa905('0x16')](_0x56c09f);return _0x97332d[_0xa905('0x1d')](_0xa905('0x1e'),_0x1439d5+'-'+_0xa59b33+'/'+_0x185c1c)[_0xa905('0x18')](_0x58341f);}return null;};}function patchUpdates(_0x14930d){return function(_0x36e094){try{jsonpatch['apply'](_0x36e094,_0x14930d,!![]);}catch(_0x4194a8){return BPromise[_0xa905('0x1f')](_0x4194a8);}return _0x36e094[_0xa905('0x20')]();};}function saveUpdates(_0x3193ca,_0x5c4b50){return function(_0x1da420){if(_0x1da420){return _0x1da420[_0xa905('0x21')](_0x3193ca)[_0xa905('0x22')](function(_0x1689a5){return _0x1689a5;});}return null;};}function removeEntity(_0x50a44a,_0x53d476){return function(_0x23fb4e){if(_0x23fb4e){return _0x23fb4e[_0xa905('0x23')]()['then'](function(){_0x50a44a[_0xa905('0x16')](0xcc)[_0xa905('0x17')]();});}};}function handleEntityNotFound(_0x447f6c,_0x182967){return function(_0x59fb12){if(!_0x59fb12){_0x447f6c[_0xa905('0x15')](0x194);}return _0x59fb12;};}function handleError(_0x3ad10c,_0x4bed6e){_0x4bed6e=_0x4bed6e||0x1f4;return function(_0x3e3067){logger[_0xa905('0x24')](_0x3e3067[_0xa905('0x25')]);if(_0x3e3067[_0xa905('0x26')]){delete _0x3e3067[_0xa905('0x26')];}_0x3ad10c[_0xa905('0x16')](_0x4bed6e)[_0xa905('0x27')](_0x3e3067);};}exports['index']=function(_0x3f391d,_0x32cf90){var _0x38c35d={},_0x4071c0={},_0x2713db={'count':0x0,'rows':[]};var _0x5d99eb=_['map'](db[_0xa905('0x28')][_0xa905('0x29')],function(_0x951d2e){return{'name':_0x951d2e[_0xa905('0x2a')],'type':_0x951d2e['type'][_0xa905('0x2b')]};});_0x4071c0[_0xa905('0x2c')]=_[_0xa905('0x2d')](_0x5d99eb,_0xa905('0x26'));_0x4071c0[_0xa905('0x2e')]=_['keys'](_0x3f391d[_0xa905('0x2e')]);_0x4071c0[_0xa905('0x2f')]=_[_0xa905('0x30')](_0x4071c0[_0xa905('0x2c')],_0x4071c0[_0xa905('0x2e')]);_0x38c35d[_0xa905('0x31')]=_['intersection'](_0x4071c0[_0xa905('0x2c')],qs[_0xa905('0x32')](_0x3f391d[_0xa905('0x2e')][_0xa905('0x32')]));_0x38c35d[_0xa905('0x31')]=_0x38c35d['attributes'][_0xa905('0x33')]?_0x38c35d['attributes']:_0x4071c0[_0xa905('0x2c')];if(!_0x3f391d[_0xa905('0x2e')][_0xa905('0x34')](_0xa905('0x35'))){_0x38c35d['limit']=qs[_0xa905('0x1b')](_0x3f391d[_0xa905('0x2e')]['limit']);_0x38c35d[_0xa905('0x19')]=qs['offset'](_0x3f391d[_0xa905('0x2e')]['offset']);}_0x38c35d[_0xa905('0x36')]=qs['sort'](_0x3f391d[_0xa905('0x2e')][_0xa905('0x37')]);_0x38c35d[_0xa905('0x38')]=qs[_0xa905('0x2f')](_[_0xa905('0x39')](_0x3f391d[_0xa905('0x2e')],_0x4071c0[_0xa905('0x2f')]),_0x5d99eb);if(_0x3f391d[_0xa905('0x2e')][_0xa905('0x3a')]){_0x38c35d[_0xa905('0x38')]=_[_0xa905('0x3b')](_0x38c35d['where'],{'$or':_[_0xa905('0x2d')](_0x5d99eb,function(_0xe08a81){if(_0xe08a81['type']!==_0xa905('0x3c')){var _0x271c32={};_0x271c32[_0xe08a81['name']]={'$like':'%'+_0x3f391d[_0xa905('0x2e')][_0xa905('0x3a')]+'%'};return _0x271c32;}})});}_0x38c35d=_['merge']({},_0x38c35d,_0x3f391d[_0xa905('0x3d')]);var _0x4b22f9={'where':_0x38c35d[_0xa905('0x38')]};return db[_0xa905('0x28')]['count'](_0x4b22f9)[_0xa905('0x22')](function(_0x4a8f02){_0x2713db[_0xa905('0x1c')]=_0x4a8f02;if(_0x3f391d['query'][_0xa905('0x3e')]){_0x38c35d[_0xa905('0x3f')]=[{'all':!![]}];}return db[_0xa905('0x28')][_0xa905('0x40')](_0x38c35d);})[_0xa905('0x22')](function(_0x193edc){_0x2713db[_0xa905('0x41')]=_0x193edc;return _0x2713db;})[_0xa905('0x22')](respondWithFilteredResult(_0x32cf90,_0x38c35d))['catch'](handleError(_0x32cf90,null));};exports[_0xa905('0x42')]=function(_0x1e10a7,_0x5a44dc){var _0x274f7a={'raw':!![],'where':{'id':_0x1e10a7['params']['id']}},_0x1d6033={};_0x1d6033[_0xa905('0x2c')]=_[_0xa905('0x43')](db['ChatQueueReport'][_0xa905('0x29')]);_0x1d6033[_0xa905('0x2e')]=_[_0xa905('0x43')](_0x1e10a7[_0xa905('0x2e')]);_0x1d6033[_0xa905('0x2f')]=_[_0xa905('0x30')](_0x1d6033[_0xa905('0x2c')],_0x1d6033[_0xa905('0x2e')]);_0x274f7a[_0xa905('0x31')]=_[_0xa905('0x30')](_0x1d6033[_0xa905('0x2c')],qs['fields'](_0x1e10a7[_0xa905('0x2e')]['fields']));_0x274f7a['attributes']=_0x274f7a[_0xa905('0x31')]['length']?_0x274f7a[_0xa905('0x31')]:_0x1d6033['model'];if(_0x1e10a7['query'][_0xa905('0x3e')]){_0x274f7a['include']=[{'all':!![]}];}_0x274f7a=_[_0xa905('0x3b')]({},_0x274f7a,_0x1e10a7['options']);return db['ChatQueueReport']['find'](_0x274f7a)['then'](handleEntityNotFound(_0x5a44dc,null))[_0xa905('0x22')](respondWithResult(_0x5a44dc,null))[_0xa905('0x44')](handleError(_0x5a44dc,null));};exports[_0xa905('0x45')]=function(_0x2ca873,_0x5c9e8a){return db[_0xa905('0x28')]['create'](_0x2ca873['body'],{})[_0xa905('0x22')](respondWithResult(_0x5c9e8a,0xc9))[_0xa905('0x44')](handleError(_0x5c9e8a,null));};exports[_0xa905('0x21')]=function(_0x1e1089,_0x10e0b7){if(_0x1e1089[_0xa905('0x46')]['id']){delete _0x1e1089[_0xa905('0x46')]['id'];}return db[_0xa905('0x28')][_0xa905('0x47')]({'where':{'id':_0x1e1089[_0xa905('0x48')]['id']}})[_0xa905('0x22')](handleEntityNotFound(_0x10e0b7,null))[_0xa905('0x22')](saveUpdates(_0x1e1089[_0xa905('0x46')],null))[_0xa905('0x22')](respondWithResult(_0x10e0b7,null))[_0xa905('0x44')](handleError(_0x10e0b7,null));};exports[_0xa905('0x23')]=function(_0x29d44a,_0x2af289){return db[_0xa905('0x28')][_0xa905('0x47')]({'where':{'id':_0x29d44a[_0xa905('0x48')]['id']}})[_0xa905('0x22')](handleEntityNotFound(_0x2af289,null))[_0xa905('0x22')](removeEntity(_0x2af289,null))[_0xa905('0x44')](handleError(_0x2af289,null));};exports['describe']=function(_0x9d2c41,_0x3e32e6){return db['ChatQueueReport']['describe']()[_0xa905('0x22')](respondWithResult(_0x3e32e6,null))[_0xa905('0x44')](handleError(_0x3e32e6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 122dddc..d9b7b53 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x369fb6,_0x4702f6){var _0x58cfdb=function(_0x42be27){while(--_0x42be27){_0x369fb6['push'](_0x369fb6['shift']());}};_0x58cfdb(++_0x4702f6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0xb10b[_0x5b8646];return _0x363e4c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index f32231b..68587ff 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 _0x70de=['ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','debug','stringify','UpdateChatQueueReport','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x2fe1f8,_0x1eef7c){var _0xf9dc91=function(_0x2e51e0){while(--_0x2e51e0){_0x2fe1f8['push'](_0x2fe1f8['shift']());}};_0xf9dc91(++_0x1eef7c);}(_0x70de,0xb3));var _0xe70d=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x70de[_0x5f382f];return _0x3bb11b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe70d('0x0'));var BPromise=require('bluebird');var rs=require(_0xe70d('0x1'));var fs=require('fs');var Redis=require(_0xe70d('0x2'));var db=require(_0xe70d('0x3'))['db'];var utils=require(_0xe70d('0x4'));var logger=require('../../config/logger')(_0xe70d('0x5'));var config=require(_0xe70d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe70d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4110d0,_0x4e87de,_0x2f8642){return new BPromise(function(_0x35c75c,_0x28e73c){return client[_0xe70d('0x8')](_0x4110d0,_0x2f8642)[_0xe70d('0x9')](function(_0x446f6a){logger['info'](_0xe70d('0xa'),_0x4e87de,'request\x20sent');logger['debug'](_0xe70d('0xb'),_0x4e87de,'request\x20sent',JSON['stringify'](_0x446f6a));if(_0x446f6a[_0xe70d('0xc')]){if(_0x446f6a[_0xe70d('0xc')]['code']===0x1f4){logger[_0xe70d('0xc')](_0xe70d('0xa'),_0x4e87de,_0x446f6a[_0xe70d('0xc')][_0xe70d('0xd')]);return _0x28e73c(_0x446f6a[_0xe70d('0xc')][_0xe70d('0xd')]);}logger[_0xe70d('0xc')](_0xe70d('0xa'),_0x4e87de,_0x446f6a[_0xe70d('0xc')][_0xe70d('0xd')]);return _0x35c75c(_0x446f6a['error'][_0xe70d('0xd')]);}else{logger[_0xe70d('0xe')](_0xe70d('0xa'),_0x4e87de,_0xe70d('0xf'));_0x35c75c(_0x446f6a[_0xe70d('0x10')][_0xe70d('0xd')]);}})[_0xe70d('0x11')](function(_0x2b21a9){logger['error'](_0xe70d('0xa'),_0x4e87de,_0x2b21a9);_0x28e73c(_0x2b21a9);});});}exports[_0xe70d('0x12')]=function(_0x225ac9){var _0x1a3b43=this;return new Promise(function(_0x19dece,_0x43c7f8){return db[_0xe70d('0x13')][_0xe70d('0x14')](_0x225ac9['body'],{'raw':_0x225ac9['options']?_0x225ac9[_0xe70d('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x53548c){logger[_0xe70d('0xe')](_0xe70d('0x12'),_0x225ac9);logger[_0xe70d('0x16')](_0xe70d('0x12'),_0x225ac9,JSON[_0xe70d('0x17')](_0x53548c));_0x19dece(_0x53548c);})[_0xe70d('0x11')](function(_0x38b7a2){logger[_0xe70d('0xc')](_0xe70d('0x12'),_0x38b7a2['message'],_0x225ac9);_0x43c7f8(_0x1a3b43['error'](0x1f4,_0x38b7a2[_0xe70d('0xd')]));});});};exports[_0xe70d('0x18')]=function(_0x149504){var _0x25e332=this;return new Promise(function(_0x1ffe51,_0x5524ed){return db[_0xe70d('0x13')]['update'](_0x149504['body'],{'raw':_0x149504['options']?_0x149504[_0xe70d('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149504['options']?_0x149504[_0xe70d('0x15')]['where']||null:null,'attributes':_0x149504[_0xe70d('0x15')]?_0x149504[_0xe70d('0x15')][_0xe70d('0x19')]||null:null,'limit':_0x149504[_0xe70d('0x15')]?_0x149504[_0xe70d('0x15')][_0xe70d('0x1a')]||null:null})['then'](function(_0x486955){logger['info'](_0xe70d('0x18'),_0x149504);logger['debug'](_0xe70d('0x18'),_0x149504,JSON[_0xe70d('0x17')](_0x486955));_0x1ffe51(_0x486955);})[_0xe70d('0x11')](function(_0x3e21a2){logger[_0xe70d('0xc')](_0xe70d('0x18'),_0x3e21a2[_0xe70d('0xd')],_0x149504);_0x5524ed(_0x25e332[_0xe70d('0xc')](0x1f4,_0x3e21a2[_0xe70d('0xd')]));});});}; \ No newline at end of file +var _0xc1e4=['ChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','update','where','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateChatQueueReport'];(function(_0x229cd0,_0x2665cb){var _0x436329=function(_0x2fb4f1){while(--_0x2fb4f1){_0x229cd0['push'](_0x229cd0['shift']());}};_0x436329(++_0x2665cb);}(_0xc1e4,0x78));var _0x4c1e=function(_0x2a585e,_0x349c5a){_0x2a585e=_0x2a585e-0x0;var _0x11a9ac=_0xc1e4[_0x2a585e];return _0x11a9ac;};'use strict';var _=require(_0x4c1e('0x0'));var util=require(_0x4c1e('0x1'));var moment=require(_0x4c1e('0x2'));var BPromise=require(_0x4c1e('0x3'));var rs=require(_0x4c1e('0x4'));var fs=require('fs');var Redis=require(_0x4c1e('0x5'));var db=require(_0x4c1e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c1e('0x7'))('rpc');var config=require(_0x4c1e('0x8'));var jayson=require(_0x4c1e('0x9'));var client=jayson[_0x4c1e('0xa')][_0x4c1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22b210,_0x5288b6,_0x5e31d1){return new BPromise(function(_0x585f70,_0x3c1df8){return client[_0x4c1e('0xc')](_0x22b210,_0x5e31d1)['then'](function(_0x3f94e4){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x5288b6,_0x4c1e('0xd'));logger['debug'](_0x4c1e('0xe'),_0x5288b6,_0x4c1e('0xd'),JSON[_0x4c1e('0xf')](_0x3f94e4));if(_0x3f94e4[_0x4c1e('0x10')]){if(_0x3f94e4['error'][_0x4c1e('0x11')]===0x1f4){logger['error'](_0x4c1e('0x12'),_0x5288b6,_0x3f94e4['error']['message']);return _0x3c1df8(_0x3f94e4[_0x4c1e('0x10')][_0x4c1e('0x13')]);}logger['error'](_0x4c1e('0x12'),_0x5288b6,_0x3f94e4[_0x4c1e('0x10')][_0x4c1e('0x13')]);return _0x585f70(_0x3f94e4[_0x4c1e('0x10')][_0x4c1e('0x13')]);}else{logger[_0x4c1e('0x14')](_0x4c1e('0x12'),_0x5288b6,'request\x20sent');_0x585f70(_0x3f94e4[_0x4c1e('0x15')][_0x4c1e('0x13')]);}})[_0x4c1e('0x16')](function(_0x4536fb){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5288b6,_0x4536fb);_0x3c1df8(_0x4536fb);});});}exports[_0x4c1e('0x17')]=function(_0x557438){var _0x395557=this;return new Promise(function(_0x1bd866,_0x3be776){return db[_0x4c1e('0x18')][_0x4c1e('0x19')](_0x557438[_0x4c1e('0x1a')],{'raw':_0x557438[_0x4c1e('0x1b')]?_0x557438['options'][_0x4c1e('0x1c')]===undefined?!![]:![]:!![]})[_0x4c1e('0x1d')](function(_0x876586){logger[_0x4c1e('0x14')]('CreateChatQueueReport',_0x557438);logger['debug'](_0x4c1e('0x17'),_0x557438,JSON[_0x4c1e('0xf')](_0x876586));_0x1bd866(_0x876586);})[_0x4c1e('0x16')](function(_0x3fe88e){logger[_0x4c1e('0x10')](_0x4c1e('0x17'),_0x3fe88e[_0x4c1e('0x13')],_0x557438);_0x3be776(_0x395557[_0x4c1e('0x10')](0x1f4,_0x3fe88e[_0x4c1e('0x13')]));});});};exports[_0x4c1e('0x1e')]=function(_0x39e10a){var _0x18ab83=this;return new Promise(function(_0x5421a8,_0x1e1174){return db['ChatQueueReport'][_0x4c1e('0x1f')](_0x39e10a[_0x4c1e('0x1a')],{'raw':_0x39e10a[_0x4c1e('0x1b')]?_0x39e10a[_0x4c1e('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39e10a[_0x4c1e('0x1b')]?_0x39e10a[_0x4c1e('0x1b')][_0x4c1e('0x20')]||null:null,'attributes':_0x39e10a[_0x4c1e('0x1b')]?_0x39e10a[_0x4c1e('0x1b')][_0x4c1e('0x21')]||null:null,'limit':_0x39e10a['options']?_0x39e10a['options'][_0x4c1e('0x22')]||null:null})[_0x4c1e('0x1d')](function(_0x338ede){logger[_0x4c1e('0x14')](_0x4c1e('0x1e'),_0x39e10a);logger[_0x4c1e('0x23')](_0x4c1e('0x1e'),_0x39e10a,JSON['stringify'](_0x338ede));_0x5421a8(_0x338ede);})[_0x4c1e('0x16')](function(_0x498ce8){logger[_0x4c1e('0x10')](_0x4c1e('0x1e'),_0x498ce8[_0x4c1e('0x13')],_0x39e10a);_0x1e1174(_0x18ab83['error'](0x1f4,_0x498ce8[_0x4c1e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 48e97d4..76574a3 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 _0x40d0=['isAuthenticated','index','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x63662c,_0x1cfecb){var _0x274b68=function(_0x321537){while(--_0x321537){_0x63662c['push'](_0x63662c['shift']());}};_0x274b68(++_0x1cfecb);}(_0x40d0,0x89));var _0x040d=function(_0x45a356,_0x30f68f){_0x45a356=_0x45a356-0x0;var _0x52850b=_0x40d0[_0x45a356];return _0x52850b;};'use strict';var multer=require(_0x040d('0x0'));var util=require(_0x040d('0x1'));var path=require(_0x040d('0x2'));var timeout=require(_0x040d('0x3'));var express=require(_0x040d('0x4'));var router=express[_0x040d('0x5')]();var fs_extra=require(_0x040d('0x6'));var auth=require(_0x040d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x040d('0x8'));var controller=require('./chatQueueReport.controller');router[_0x040d('0x9')]('/',auth[_0x040d('0xa')](),controller[_0x040d('0xb')]);router[_0x040d('0x9')]('/describe',auth[_0x040d('0xa')](),controller[_0x040d('0xc')]);router[_0x040d('0x9')]('/:id',auth[_0x040d('0xa')](),controller[_0x040d('0xd')]);router[_0x040d('0xe')]('/',auth[_0x040d('0xa')](),controller[_0x040d('0xf')]);router[_0x040d('0x10')](_0x040d('0x11'),auth['isAuthenticated'](),controller[_0x040d('0x12')]);router['delete']('/:id',auth[_0x040d('0xa')](),controller[_0x040d('0x13')]);module[_0x040d('0x14')]=router; \ No newline at end of file +var _0x8d19=['describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d19,0x18f));var _0x98d1=function(_0x39fd11,_0x5d7883){_0x39fd11=_0x39fd11-0x0;var _0x302799=_0x8d19[_0x39fd11];return _0x302799;};'use strict';var multer=require(_0x98d1('0x0'));var util=require(_0x98d1('0x1'));var path=require(_0x98d1('0x2'));var timeout=require(_0x98d1('0x3'));var express=require(_0x98d1('0x4'));var router=express[_0x98d1('0x5')]();var fs_extra=require(_0x98d1('0x6'));var auth=require(_0x98d1('0x7'));var interaction=require(_0x98d1('0x8'));var config=require(_0x98d1('0x9'));var controller=require(_0x98d1('0xa'));router[_0x98d1('0xb')]('/',auth[_0x98d1('0xc')](),controller[_0x98d1('0xd')]);router[_0x98d1('0xb')](_0x98d1('0xe'),auth['isAuthenticated'](),controller[_0x98d1('0xf')]);router[_0x98d1('0xb')]('/:id',auth[_0x98d1('0xc')](),controller[_0x98d1('0x10')]);router[_0x98d1('0x11')]('/',auth[_0x98d1('0xc')](),controller[_0x98d1('0x12')]);router[_0x98d1('0x13')]('/:id',auth[_0x98d1('0xc')](),controller['update']);router['delete'](_0x98d1('0x14'),auth['isAuthenticated'](),controller[_0x98d1('0x15')]);module[_0x98d1('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index b806756..3cc0cd9 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5141a1,_0x509811){var _0x236ce1=function(_0x1505ef){while(--_0x1505ef){_0x5141a1['push'](_0x5141a1['shift']());}};_0x236ce1(++_0x509811);}(_0x008c,0x188));var _0xc008=function(_0x46066f,_0x23105c){_0x46066f=_0x46066f-0x0;var _0x411977=_0x008c[_0x46066f];return _0x411977;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x589c08,_0x264b33){var _0xc21d72=function(_0x33a9ea){while(--_0x33a9ea){_0x589c08['push'](_0x589c08['shift']());}};_0xc21d72(++_0x264b33);}(_0x34e8,0x12c));var _0x834e=function(_0x2a9235,_0x8ee5f6){_0x2a9235=_0x2a9235-0x0;var _0x11b7f3=_0x34e8[_0x2a9235];return _0x11b7f3;};'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 74da037..ba7c974 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 _0x918e=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','findAll','rows','catch','params','keys','filters','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x1a8192,_0x3453f2){var _0x131de2=function(_0x50ab1c){while(--_0x50ab1c){_0x1a8192['push'](_0x1a8192['shift']());}};_0x131de2(++_0x3453f2);}(_0x918e,0x173));var _0xe918=function(_0x412b85,_0x13cf8c){_0x412b85=_0x412b85-0x0;var _0x1bfb7c=_0x918e[_0x412b85];return _0x1bfb7c;};'use strict';var emlformat=require(_0xe918('0x0'));var rimraf=require(_0xe918('0x1'));var zipdir=require(_0xe918('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe918('0x3'));var moment=require(_0xe918('0x4'));var BPromise=require(_0xe918('0x5'));var Mustache=require(_0xe918('0x6'));var util=require(_0xe918('0x7'));var path=require(_0xe918('0x8'));var sox=require(_0xe918('0x9'));var csv=require(_0xe918('0xa'));var ejs=require(_0xe918('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe918('0xc'));var squel=require('squel');var crypto=require(_0xe918('0xd'));var jsforce=require(_0xe918('0xe'));var deskjs=require(_0xe918('0xf'));var toCsv=require(_0xe918('0xa'));var querystring=require(_0xe918('0x10'));var Papa=require(_0xe918('0x11'));var Redis=require(_0xe918('0x12'));var authService=require(_0xe918('0x13'));var qs=require(_0xe918('0x14'));var as=require(_0xe918('0x15'));var hardwareService=require(_0xe918('0x16'));var logger=require(_0xe918('0x17'))(_0xe918('0x18'));var utils=require(_0xe918('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe918('0x1a'));var db=require(_0xe918('0x1b'))['db'];function respondWithStatusCode(_0x34359c,_0x337fc6){_0x337fc6=_0x337fc6||0xcc;return function(_0x1e3718){if(_0x1e3718){return _0x34359c[_0xe918('0x1c')](_0x337fc6);}return _0x34359c['status'](_0x337fc6)[_0xe918('0x1d')]();};}function respondWithResult(_0x2436c4,_0x13f37e){_0x13f37e=_0x13f37e||0xc8;return function(_0x1120a9){if(_0x1120a9){return _0x2436c4[_0xe918('0x1e')](_0x13f37e)[_0xe918('0x1f')](_0x1120a9);}};}function respondWithFilteredResult(_0x4d88ac,_0x1f38ef){return function(_0x4a4233){if(_0x4a4233){var _0x1eb754=typeof _0x1f38ef[_0xe918('0x20')]===_0xe918('0x21')&&typeof _0x1f38ef[_0xe918('0x22')]===_0xe918('0x21');var _0x4f3ac7=_0x4a4233[_0xe918('0x23')];var _0x3d97f9=_0x1eb754?0x0:_0x1f38ef[_0xe918('0x20')];var _0x2c4116=_0x1eb754?_0x4a4233['count']:_0x1f38ef[_0xe918('0x20')]+_0x1f38ef[_0xe918('0x22')];var _0x2fccff;if(_0x2c4116>=_0x4f3ac7){_0x2c4116=_0x4f3ac7;_0x2fccff=0xc8;}else{_0x2fccff=0xce;}_0x4d88ac[_0xe918('0x1e')](_0x2fccff);return _0x4d88ac[_0xe918('0x24')](_0xe918('0x25'),_0x3d97f9+'-'+_0x2c4116+'/'+_0x4f3ac7)[_0xe918('0x1f')](_0x4a4233);}return null;};}function patchUpdates(_0x548f40){return function(_0x2b5874){try{jsonpatch[_0xe918('0x26')](_0x2b5874,_0x548f40,!![]);}catch(_0x31d593){return BPromise[_0xe918('0x27')](_0x31d593);}return _0x2b5874[_0xe918('0x28')]();};}function saveUpdates(_0x425dbc,_0xec955b){return function(_0x2c7c25){if(_0x2c7c25){return _0x2c7c25[_0xe918('0x29')](_0x425dbc)[_0xe918('0x2a')](function(_0x41d794){return _0x41d794;});}return null;};}function removeEntity(_0x4c66a3,_0x46fc75){return function(_0x52d0aa){if(_0x52d0aa){return _0x52d0aa[_0xe918('0x2b')]()[_0xe918('0x2a')](function(){_0x4c66a3[_0xe918('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd3bb,_0x15c72b){return function(_0x2c6730){if(!_0x2c6730){_0x2bd3bb['sendStatus'](0x194);}return _0x2c6730;};}function handleError(_0x17ace3,_0x17acb1){_0x17acb1=_0x17acb1||0x1f4;return function(_0x2400ae){logger[_0xe918('0x2c')](_0x2400ae[_0xe918('0x2d')]);if(_0x2400ae[_0xe918('0x2e')]){delete _0x2400ae['name'];}_0x17ace3['status'](_0x17acb1)['send'](_0x2400ae);};}exports[_0xe918('0x2f')]=function(_0x436514,_0x5d6922){var _0x3151f5={},_0x9972c4={},_0x949ee2={'count':0x0,'rows':[]};var _0x1007c7=_[_0xe918('0x30')](db[_0xe918('0x31')][_0xe918('0x32')],function(_0x1a79c2){return{'name':_0x1a79c2[_0xe918('0x33')],'type':_0x1a79c2['type'][_0xe918('0x34')]};});_0x9972c4[_0xe918('0x35')]=_[_0xe918('0x30')](_0x1007c7,_0xe918('0x2e'));_0x9972c4[_0xe918('0x36')]=_['keys'](_0x436514['query']);_0x9972c4['filters']=_[_0xe918('0x37')](_0x9972c4[_0xe918('0x35')],_0x9972c4[_0xe918('0x36')]);_0x3151f5['attributes']=_[_0xe918('0x37')](_0x9972c4['model'],qs[_0xe918('0x38')](_0x436514['query'][_0xe918('0x38')]));_0x3151f5[_0xe918('0x39')]=_0x3151f5['attributes'][_0xe918('0x3a')]?_0x3151f5[_0xe918('0x39')]:_0x9972c4['model'];if(!_0x436514[_0xe918('0x36')][_0xe918('0x3b')](_0xe918('0x3c'))){_0x3151f5[_0xe918('0x22')]=qs[_0xe918('0x22')](_0x436514[_0xe918('0x36')]['limit']);_0x3151f5[_0xe918('0x20')]=qs[_0xe918('0x20')](_0x436514['query'][_0xe918('0x20')]);}_0x3151f5[_0xe918('0x3d')]=qs['sort'](_0x436514['query'][_0xe918('0x3e')]);_0x3151f5[_0xe918('0x3f')]=qs['filters'](_[_0xe918('0x40')](_0x436514[_0xe918('0x36')],_0x9972c4['filters']),_0x1007c7);if(_0x436514['query'][_0xe918('0x41')]){_0x3151f5[_0xe918('0x3f')]=_['merge'](_0x3151f5[_0xe918('0x3f')],{'$or':_[_0xe918('0x30')](_0x1007c7,function(_0x122fb5){if(_0x122fb5[_0xe918('0x42')]!==_0xe918('0x43')){var _0x181413={};_0x181413[_0x122fb5['name']]={'$like':'%'+_0x436514[_0xe918('0x36')][_0xe918('0x41')]+'%'};return _0x181413;}})});}_0x3151f5=_[_0xe918('0x44')]({},_0x3151f5,_0x436514[_0xe918('0x45')]);var _0x428fc7={'where':_0x3151f5[_0xe918('0x3f')]};return db[_0xe918('0x31')][_0xe918('0x23')](_0x428fc7)[_0xe918('0x2a')](function(_0x45c59b){_0x949ee2[_0xe918('0x23')]=_0x45c59b;if(_0x436514['query']['includeAll']){_0x3151f5['include']=[{'all':!![]}];}return db[_0xe918('0x31')][_0xe918('0x46')](_0x3151f5);})[_0xe918('0x2a')](function(_0x1e0ffb){_0x949ee2[_0xe918('0x47')]=_0x1e0ffb;return _0x949ee2;})[_0xe918('0x2a')](respondWithFilteredResult(_0x5d6922,_0x3151f5))[_0xe918('0x48')](handleError(_0x5d6922,null));};exports['show']=function(_0x24da99,_0x278ac2){var _0x378b3d={'raw':!![],'where':{'id':_0x24da99[_0xe918('0x49')]['id']}},_0x423237={};_0x423237[_0xe918('0x35')]=_[_0xe918('0x4a')](db['ChatTransferReport'][_0xe918('0x32')]);_0x423237[_0xe918('0x36')]=_[_0xe918('0x4a')](_0x24da99[_0xe918('0x36')]);_0x423237[_0xe918('0x4b')]=_[_0xe918('0x37')](_0x423237[_0xe918('0x35')],_0x423237['query']);_0x378b3d['attributes']=_[_0xe918('0x37')](_0x423237['model'],qs[_0xe918('0x38')](_0x24da99[_0xe918('0x36')]['fields']));_0x378b3d[_0xe918('0x39')]=_0x378b3d[_0xe918('0x39')][_0xe918('0x3a')]?_0x378b3d[_0xe918('0x39')]:_0x423237[_0xe918('0x35')];if(_0x24da99[_0xe918('0x36')][_0xe918('0x4c')]){_0x378b3d['include']=[{'all':!![]}];}_0x378b3d=_[_0xe918('0x44')]({},_0x378b3d,_0x24da99[_0xe918('0x45')]);return db['ChatTransferReport'][_0xe918('0x4d')](_0x378b3d)['then'](handleEntityNotFound(_0x278ac2,null))[_0xe918('0x2a')](respondWithResult(_0x278ac2,null))[_0xe918('0x48')](handleError(_0x278ac2,null));};exports[_0xe918('0x4e')]=function(_0x22a79c,_0x4d7114){return db['ChatTransferReport'][_0xe918('0x4e')](_0x22a79c['body'],{})[_0xe918('0x2a')](respondWithResult(_0x4d7114,0xc9))['catch'](handleError(_0x4d7114,null));};exports[_0xe918('0x29')]=function(_0x45db35,_0x3408bd){if(_0x45db35[_0xe918('0x4f')]['id']){delete _0x45db35[_0xe918('0x4f')]['id'];}return db['ChatTransferReport'][_0xe918('0x4d')]({'where':{'id':_0x45db35[_0xe918('0x49')]['id']}})[_0xe918('0x2a')](handleEntityNotFound(_0x3408bd,null))[_0xe918('0x2a')](saveUpdates(_0x45db35[_0xe918('0x4f')],null))[_0xe918('0x2a')](respondWithResult(_0x3408bd,null))[_0xe918('0x48')](handleError(_0x3408bd,null));};exports['destroy']=function(_0x2c62c4,_0x3be432){return db['ChatTransferReport']['find']({'where':{'id':_0x2c62c4[_0xe918('0x49')]['id']}})[_0xe918('0x2a')](handleEntityNotFound(_0x3be432,null))[_0xe918('0x2a')](removeEntity(_0x3be432,null))['catch'](handleError(_0x3be432,null));};exports[_0xe918('0x50')]=function(_0x2a4fb4,_0x319ee8){return db[_0xe918('0x31')][_0xe918('0x50')]()[_0xe918('0x2a')](respondWithResult(_0x319ee8,null))[_0xe918('0x48')](handleError(_0x319ee8,null));}; \ No newline at end of file +var _0x43f2=['../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','length','options','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x448f9a,_0xc4f46){var _0x1ff030=function(_0x1b80da){while(--_0x1b80da){_0x448f9a['push'](_0x448f9a['shift']());}};_0x1ff030(++_0xc4f46);}(_0x43f2,0x7e));var _0x243f=function(_0x1fa3f2,_0x54c4c4){_0x1fa3f2=_0x1fa3f2-0x0;var _0x5932dc=_0x43f2[_0x1fa3f2];return _0x5932dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x243f('0x0'));var zipdir=require(_0x243f('0x1'));var jsonpatch=require(_0x243f('0x2'));var rp=require('request-promise');var moment=require(_0x243f('0x3'));var BPromise=require(_0x243f('0x4'));var Mustache=require('mustache');var util=require(_0x243f('0x5'));var path=require(_0x243f('0x6'));var sox=require(_0x243f('0x7'));var csv=require(_0x243f('0x8'));var ejs=require(_0x243f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x243f('0xa'));var squel=require('squel');var crypto=require(_0x243f('0xb'));var jsforce=require(_0x243f('0xc'));var deskjs=require(_0x243f('0xd'));var toCsv=require(_0x243f('0x8'));var querystring=require(_0x243f('0xe'));var Papa=require('papaparse');var Redis=require(_0x243f('0xf'));var authService=require(_0x243f('0x10'));var qs=require(_0x243f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x243f('0x12'))('api');var utils=require(_0x243f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x243f('0x14'));var db=require(_0x243f('0x15'))['db'];function respondWithStatusCode(_0x2c5120,_0x5db8c4){_0x5db8c4=_0x5db8c4||0xcc;return function(_0x12104a){if(_0x12104a){return _0x2c5120['sendStatus'](_0x5db8c4);}return _0x2c5120[_0x243f('0x16')](_0x5db8c4)[_0x243f('0x17')]();};}function respondWithResult(_0x36cb50,_0x167b9e){_0x167b9e=_0x167b9e||0xc8;return function(_0xd0906d){if(_0xd0906d){return _0x36cb50[_0x243f('0x16')](_0x167b9e)[_0x243f('0x18')](_0xd0906d);}};}function respondWithFilteredResult(_0x4c73f4,_0x1a4735){return function(_0x34958d){if(_0x34958d){var _0x111bbf=typeof _0x1a4735[_0x243f('0x19')]==='undefined'&&typeof _0x1a4735[_0x243f('0x1a')]===_0x243f('0x1b');var _0xca9ff9=_0x34958d[_0x243f('0x1c')];var _0x7102b2=_0x111bbf?0x0:_0x1a4735[_0x243f('0x19')];var _0x5afd18=_0x111bbf?_0x34958d[_0x243f('0x1c')]:_0x1a4735[_0x243f('0x19')]+_0x1a4735[_0x243f('0x1a')];var _0x560c21;if(_0x5afd18>=_0xca9ff9){_0x5afd18=_0xca9ff9;_0x560c21=0xc8;}else{_0x560c21=0xce;}_0x4c73f4['status'](_0x560c21);return _0x4c73f4[_0x243f('0x1d')](_0x243f('0x1e'),_0x7102b2+'-'+_0x5afd18+'/'+_0xca9ff9)['json'](_0x34958d);}return null;};}function patchUpdates(_0x4005e8){return function(_0x585442){try{jsonpatch[_0x243f('0x1f')](_0x585442,_0x4005e8,!![]);}catch(_0x109785){return BPromise[_0x243f('0x20')](_0x109785);}return _0x585442[_0x243f('0x21')]();};}function saveUpdates(_0x9ae02b,_0x3675d6){return function(_0x494063){if(_0x494063){return _0x494063[_0x243f('0x22')](_0x9ae02b)[_0x243f('0x23')](function(_0x1721fb){return _0x1721fb;});}return null;};}function removeEntity(_0x342ba1,_0x511025){return function(_0x5956bc){if(_0x5956bc){return _0x5956bc['destroy']()[_0x243f('0x23')](function(){_0x342ba1[_0x243f('0x16')](0xcc)[_0x243f('0x17')]();});}};}function handleEntityNotFound(_0x27681a,_0x24ca69){return function(_0x66e680){if(!_0x66e680){_0x27681a[_0x243f('0x24')](0x194);}return _0x66e680;};}function handleError(_0x32d891,_0x1edefb){_0x1edefb=_0x1edefb||0x1f4;return function(_0x2e1277){logger[_0x243f('0x25')](_0x2e1277['stack']);if(_0x2e1277['name']){delete _0x2e1277[_0x243f('0x26')];}_0x32d891[_0x243f('0x16')](_0x1edefb)['send'](_0x2e1277);};}exports[_0x243f('0x27')]=function(_0x424fea,_0x3d0587){var _0x28751f={},_0x3cc3ab={},_0x320846={'count':0x0,'rows':[]};var _0x3ee721=_[_0x243f('0x28')](db[_0x243f('0x29')][_0x243f('0x2a')],function(_0x3d8d42){return{'name':_0x3d8d42[_0x243f('0x2b')],'type':_0x3d8d42[_0x243f('0x2c')][_0x243f('0x2d')]};});_0x3cc3ab['model']=_[_0x243f('0x28')](_0x3ee721,_0x243f('0x26'));_0x3cc3ab[_0x243f('0x2e')]=_[_0x243f('0x2f')](_0x424fea[_0x243f('0x2e')]);_0x3cc3ab['filters']=_[_0x243f('0x30')](_0x3cc3ab[_0x243f('0x31')],_0x3cc3ab[_0x243f('0x2e')]);_0x28751f[_0x243f('0x32')]=_[_0x243f('0x30')](_0x3cc3ab['model'],qs[_0x243f('0x33')](_0x424fea[_0x243f('0x2e')][_0x243f('0x33')]));_0x28751f[_0x243f('0x32')]=_0x28751f[_0x243f('0x32')]['length']?_0x28751f[_0x243f('0x32')]:_0x3cc3ab[_0x243f('0x31')];if(!_0x424fea[_0x243f('0x2e')][_0x243f('0x34')](_0x243f('0x35'))){_0x28751f[_0x243f('0x1a')]=qs[_0x243f('0x1a')](_0x424fea[_0x243f('0x2e')]['limit']);_0x28751f['offset']=qs[_0x243f('0x19')](_0x424fea[_0x243f('0x2e')][_0x243f('0x19')]);}_0x28751f['order']=qs[_0x243f('0x36')](_0x424fea[_0x243f('0x2e')][_0x243f('0x36')]);_0x28751f[_0x243f('0x37')]=qs[_0x243f('0x38')](_[_0x243f('0x39')](_0x424fea['query'],_0x3cc3ab['filters']),_0x3ee721);if(_0x424fea[_0x243f('0x2e')][_0x243f('0x3a')]){_0x28751f[_0x243f('0x37')]=_[_0x243f('0x3b')](_0x28751f[_0x243f('0x37')],{'$or':_['map'](_0x3ee721,function(_0x1f379e){if(_0x1f379e[_0x243f('0x2c')]!==_0x243f('0x3c')){var _0x56ab8a={};_0x56ab8a[_0x1f379e[_0x243f('0x26')]]={'$like':'%'+_0x424fea[_0x243f('0x2e')][_0x243f('0x3a')]+'%'};return _0x56ab8a;}})});}_0x28751f=_['merge']({},_0x28751f,_0x424fea['options']);var _0xbbe74={'where':_0x28751f['where']};return db[_0x243f('0x29')]['count'](_0xbbe74)[_0x243f('0x23')](function(_0x5c6999){_0x320846[_0x243f('0x1c')]=_0x5c6999;if(_0x424fea[_0x243f('0x2e')][_0x243f('0x3d')]){_0x28751f[_0x243f('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x28751f);})['then'](function(_0x44cb3a){_0x320846[_0x243f('0x3f')]=_0x44cb3a;return _0x320846;})[_0x243f('0x23')](respondWithFilteredResult(_0x3d0587,_0x28751f))[_0x243f('0x40')](handleError(_0x3d0587,null));};exports['show']=function(_0x57e909,_0x25f6aa){var _0x245d34={'raw':!![],'where':{'id':_0x57e909[_0x243f('0x41')]['id']}},_0x2a36cf={};_0x2a36cf['model']=_['keys'](db['ChatTransferReport']['rawAttributes']);_0x2a36cf[_0x243f('0x2e')]=_[_0x243f('0x2f')](_0x57e909[_0x243f('0x2e')]);_0x2a36cf[_0x243f('0x38')]=_[_0x243f('0x30')](_0x2a36cf['model'],_0x2a36cf[_0x243f('0x2e')]);_0x245d34[_0x243f('0x32')]=_[_0x243f('0x30')](_0x2a36cf[_0x243f('0x31')],qs[_0x243f('0x33')](_0x57e909['query'][_0x243f('0x33')]));_0x245d34[_0x243f('0x32')]=_0x245d34[_0x243f('0x32')][_0x243f('0x42')]?_0x245d34[_0x243f('0x32')]:_0x2a36cf[_0x243f('0x31')];if(_0x57e909['query'][_0x243f('0x3d')]){_0x245d34[_0x243f('0x3e')]=[{'all':!![]}];}_0x245d34=_['merge']({},_0x245d34,_0x57e909[_0x243f('0x43')]);return db['ChatTransferReport']['find'](_0x245d34)[_0x243f('0x23')](handleEntityNotFound(_0x25f6aa,null))['then'](respondWithResult(_0x25f6aa,null))['catch'](handleError(_0x25f6aa,null));};exports[_0x243f('0x44')]=function(_0x1e8b49,_0x163e14){return db[_0x243f('0x29')][_0x243f('0x44')](_0x1e8b49['body'],{})[_0x243f('0x23')](respondWithResult(_0x163e14,0xc9))['catch'](handleError(_0x163e14,null));};exports[_0x243f('0x22')]=function(_0x345791,_0x249ca5){if(_0x345791['body']['id']){delete _0x345791[_0x243f('0x45')]['id'];}return db[_0x243f('0x29')]['find']({'where':{'id':_0x345791[_0x243f('0x41')]['id']}})['then'](handleEntityNotFound(_0x249ca5,null))[_0x243f('0x23')](saveUpdates(_0x345791[_0x243f('0x45')],null))[_0x243f('0x23')](respondWithResult(_0x249ca5,null))[_0x243f('0x40')](handleError(_0x249ca5,null));};exports[_0x243f('0x46')]=function(_0x2cee8d,_0x3d8f90){return db[_0x243f('0x29')][_0x243f('0x47')]({'where':{'id':_0x2cee8d[_0x243f('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d8f90,null))['then'](removeEntity(_0x3d8f90,null))[_0x243f('0x40')](handleError(_0x3d8f90,null));};exports['describe']=function(_0x28d4eb,_0x159c92){return db[_0x243f('0x29')][_0x243f('0x48')]()[_0x243f('0x23')](respondWithResult(_0x159c92,null))['catch'](handleError(_0x159c92,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 2caddb2..53adc6b 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 _0x48b8=['../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x519d1c,_0x1935a2){var _0x1662e4=function(_0x569df3){while(--_0x569df3){_0x519d1c['push'](_0x519d1c['shift']());}};_0x1662e4(++_0x1935a2);}(_0x48b8,0xb5));var _0x848b=function(_0x1a8d3c,_0x321276){_0x1a8d3c=_0x1a8d3c-0x0;var _0x2f4140=_0x48b8[_0x1a8d3c];return _0x2f4140;};'use strict';var _=require(_0x848b('0x0'));var util=require(_0x848b('0x1'));var logger=require(_0x848b('0x2'))('api');var moment=require(_0x848b('0x3'));var BPromise=require('bluebird');var rp=require(_0x848b('0x4'));var fs=require('fs');var path=require(_0x848b('0x5'));var rimraf=require('rimraf');var config=require(_0x848b('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x848b('0x7')]=function(_0x3472de,_0x20a9c7){return _0x3472de['define'](_0x848b('0x8'),attributes,{'tableName':_0x848b('0x9'),'paranoid':![],'indexes':[{'name':_0x848b('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8a9=['request-promise','path','./chatTransferReport.attributes','ChatTransferReport','report_chat_transfer','uniqueid','lodash','moment','bluebird'];(function(_0xacede0,_0x285b86){var _0x2296a3=function(_0x3debff){while(--_0x3debff){_0xacede0['push'](_0xacede0['shift']());}};_0x2296a3(++_0x285b86);}(_0xf8a9,0x138));var _0x9f8a=function(_0x2cb77c,_0x5ac8d7){_0x2cb77c=_0x2cb77c-0x0;var _0x562dc1=_0xf8a9[_0x2cb77c];return _0x562dc1;};'use strict';var _=require(_0x9f8a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9f8a('0x1'));var BPromise=require(_0x9f8a('0x2'));var rp=require(_0x9f8a('0x3'));var fs=require('fs');var path=require(_0x9f8a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f8a('0x5'));module['exports']=function(_0x530a3a,_0x298fa2){return _0x530a3a['define'](_0x9f8a('0x6'),attributes,{'tableName':_0x9f8a('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9f8a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ce64b91..94d3e85 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 _0x3051=['message','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x3051,0x17d));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1305('0x0'));var util=require(_0x1305('0x1'));var moment=require(_0x1305('0x2'));var BPromise=require(_0x1305('0x3'));var rs=require(_0x1305('0x4'));var fs=require('fs');var Redis=require(_0x1305('0x5'));var db=require(_0x1305('0x6'))['db'];var utils=require(_0x1305('0x7'));var logger=require('../../config/logger')(_0x1305('0x8'));var config=require(_0x1305('0x9'));var jayson=require(_0x1305('0xa'));var client=jayson[_0x1305('0xb')][_0x1305('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x883ffe,_0x3b8c84,_0x424d1d){return new BPromise(function(_0x3b3be9,_0x8775a4){return client[_0x1305('0xd')](_0x883ffe,_0x424d1d)['then'](function(_0x4ff389){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x3b8c84,'request\x20sent');logger[_0x1305('0xe')](_0x1305('0xf'),_0x3b8c84,'request\x20sent',JSON[_0x1305('0x10')](_0x4ff389));if(_0x4ff389[_0x1305('0x11')]){if(_0x4ff389[_0x1305('0x11')][_0x1305('0x12')]===0x1f4){logger[_0x1305('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3b8c84,_0x4ff389[_0x1305('0x11')][_0x1305('0x13')]);return _0x8775a4(_0x4ff389[_0x1305('0x11')]['message']);}logger[_0x1305('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3b8c84,_0x4ff389[_0x1305('0x11')][_0x1305('0x13')]);return _0x3b3be9(_0x4ff389['error'][_0x1305('0x13')]);}else{logger[_0x1305('0x14')](_0x1305('0x15'),_0x3b8c84,_0x1305('0x16'));_0x3b3be9(_0x4ff389[_0x1305('0x17')]['message']);}})[_0x1305('0x18')](function(_0x5e7791){logger[_0x1305('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3b8c84,_0x5e7791);_0x8775a4(_0x5e7791);});});} \ No newline at end of file +var _0x2785=['http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x47e9d5,_0xe21a96){var _0x1cff20=function(_0x1af5f1){while(--_0x1af5f1){_0x47e9d5['push'](_0x47e9d5['shift']());}};_0x1cff20(++_0xe21a96);}(_0x2785,0x1f1));var _0x5278=function(_0x276167,_0x21086e){_0x276167=_0x276167-0x0;var _0x27a866=_0x2785[_0x276167];return _0x27a866;};'use strict';var _=require(_0x5278('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5278('0x1'));var fs=require('fs');var Redis=require(_0x5278('0x2'));var db=require(_0x5278('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5278('0x4'))(_0x5278('0x5'));var config=require(_0x5278('0x6'));var jayson=require(_0x5278('0x7'));var client=jayson[_0x5278('0x8')][_0x5278('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x124021,_0x202c50,_0x30c1dc){return new BPromise(function(_0x276970,_0x11296d){return client[_0x5278('0xa')](_0x124021,_0x30c1dc)[_0x5278('0xb')](function(_0x499e3e){logger[_0x5278('0xc')](_0x5278('0xd'),_0x202c50,_0x5278('0xe'));logger[_0x5278('0xf')](_0x5278('0x10'),_0x202c50,_0x5278('0xe'),JSON[_0x5278('0x11')](_0x499e3e));if(_0x499e3e[_0x5278('0x12')]){if(_0x499e3e[_0x5278('0x12')]['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x202c50,_0x499e3e['error']['message']);return _0x11296d(_0x499e3e[_0x5278('0x12')][_0x5278('0x13')]);}logger[_0x5278('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x202c50,_0x499e3e[_0x5278('0x12')]['message']);return _0x276970(_0x499e3e[_0x5278('0x12')][_0x5278('0x13')]);}else{logger['info'](_0x5278('0xd'),_0x202c50,'request\x20sent');_0x276970(_0x499e3e[_0x5278('0x14')][_0x5278('0x13')]);}})[_0x5278('0x15')](function(_0x47fae6){logger[_0x5278('0x12')](_0x5278('0xd'),_0x202c50,_0x47fae6);_0x11296d(_0x47fae6);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f43f133..adcb42a 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 _0x59f0=['index','/describe','isAuthenticated','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0xe7c3f1,_0x12326f){var _0x1a0934=function(_0x2c3300){while(--_0x2c3300){_0xe7c3f1['push'](_0xe7c3f1['shift']());}};_0x1a0934(++_0x12326f);}(_0x59f0,0x1cc));var _0x059f=function(_0x526de6,_0x5a13a4){_0x526de6=_0x526de6-0x0;var _0x455a12=_0x59f0[_0x526de6];return _0x455a12;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x059f('0x0'));var timeout=require(_0x059f('0x1'));var express=require(_0x059f('0x2'));var router=express['Router']();var fs_extra=require(_0x059f('0x3'));var auth=require(_0x059f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x059f('0x5'));var controller=require(_0x059f('0x6'));router[_0x059f('0x7')]('/',auth['isAuthenticated'](),controller[_0x059f('0x8')]);router[_0x059f('0x7')](_0x059f('0x9'),auth[_0x059f('0xa')](),controller['describe']);router[_0x059f('0x7')](_0x059f('0xb'),auth[_0x059f('0xa')](),controller[_0x059f('0xc')]);router['post']('/',auth[_0x059f('0xa')](),controller['create']);router[_0x059f('0xd')](_0x059f('0xb'),auth[_0x059f('0xa')](),controller[_0x059f('0xe')]);router[_0x059f('0xf')](_0x059f('0xb'),auth[_0x059f('0xa')](),controller[_0x059f('0x10')]);module[_0x059f('0x11')]=router; \ No newline at end of file +var _0xc2fb=['post','create','put','/:id','update','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xc2fb,0x181));var _0xbc2f=function(_0x1a6ba3,_0x31b05f){_0x1a6ba3=_0x1a6ba3-0x0;var _0x205c97=_0xc2fb[_0x1a6ba3];return _0x205c97;};'use strict';var multer=require(_0xbc2f('0x0'));var util=require(_0xbc2f('0x1'));var path=require(_0xbc2f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbc2f('0x3'));var interaction=require(_0xbc2f('0x4'));var config=require(_0xbc2f('0x5'));var controller=require(_0xbc2f('0x6'));router['get']('/',auth[_0xbc2f('0x7')](),controller[_0xbc2f('0x8')]);router[_0xbc2f('0x9')](_0xbc2f('0xa'),auth[_0xbc2f('0x7')](),controller['describe']);router[_0xbc2f('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbc2f('0xb')]('/',auth['isAuthenticated'](),controller[_0xbc2f('0xc')]);router[_0xbc2f('0xd')](_0xbc2f('0xe'),auth[_0xbc2f('0x7')](),controller[_0xbc2f('0xf')]);router['delete'](_0xbc2f('0xe'),auth['isAuthenticated'](),controller[_0xbc2f('0x10')]);module[_0xbc2f('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6fd906c..3c3e3f1 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 _0xb440=['Comments','Leave\x20your\x20comments','getDataValue','offlineForm','parse','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','squared','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','name','text','input','onlineForm','setDataValue','stringify','textarea'];(function(_0x226097,_0x1a2762){var _0x3a343d=function(_0x120b32){while(--_0x120b32){_0x226097['push'](_0x226097['shift']());}};_0x3a343d(++_0x1a2762);}(_0xb440,0xa9));var _0x0b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb440[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0b44('0x0'));var rs=require(_0x0b44('0x1'));module[_0x0b44('0x2')]={'name':{'type':Sequelize[_0x0b44('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x0b44('0x3')],'allowNull':![],'unique':_0x0b44('0x4')},'description':{'type':Sequelize[_0x0b44('0x3')]},'mapKey':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x5')},'mapKeyOffline':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0b44('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0b44('0x3')],'allowNull':![],'defaultValue':_0x0b44('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0b44('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0b44('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0b44('0x3')]},'animation':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0b44('0xa')]('rounded',_0x0b44('0xb')),'defaultValue':_0x0b44('0xc')},'header_online':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0b44('0xd')},'offline_chat_button':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x0b44('0xf')},'download_transcript':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0b44('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0b44('0x11')]},'closingQuestion':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0b44('0x13')},'closingMessage':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x15')},'conditionAgreement':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x16')},'ratingType':{'type':Sequelize[_0x0b44('0xa')]('star',_0x0b44('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x0b44('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0b44('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0b44('0x18'),'type':_0x0b44('0x19'),'required':!![]},'props':{'title':_0x0b44('0x18'),'helpText':''}},{'type':_0x0b44('0x1a'),'props':{'title':_0x0b44('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x0b44('0x5'),'type':_0x0b44('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this['getDataValue'](_0x0b44('0x1b'))):{};},'set':function(_0x55a30c){return this[_0x0b44('0x1c')]('onlineForm',JSON[_0x0b44('0x1d')](_0x55a30c));}},'offlineForm':{'type':Sequelize[_0x0b44('0x11')],'defaultValue':function(){return JSON[_0x0b44('0x1d')]({'items':[{'type':_0x0b44('0x1a'),'props':{'title':_0x0b44('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x0b44('0x5'),'type':_0x0b44('0x5')},'variable':null},{'type':_0x0b44('0x1e'),'config':{'placeholder':_0x0b44('0x1f')},'props':{'title':'Comments','helpText':_0x0b44('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x0b44('0x21')](_0x0b44('0x22'))?JSON[_0x0b44('0x23')](this['getDataValue'](_0x0b44('0x22'))):{};},'set':function(_0x10a98c){return this[_0x0b44('0x1c')]('offlineForm',JSON[_0x0b44('0x1d')](_0x10a98c));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0b44('0x3')]},'forwardOffline':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0b44('0x3')]},'waitingTitle':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x24')},'waitingMessage':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x26')},'offlineMessageBody':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x27')},'skipUnmanaged':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x15')},'sendUnmanaged':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0b44('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0b44('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0b44('0x11')],'defaultValue':function(){return _0x0b44('0x28');}},'notificationSound':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x0b44('0x2b')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x0b44('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0b44('0x3')],'allowNull':![],'defaultValue':_0x0b44('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0b44('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':_0x0b44('0x2d')},'systemAvatar':{'type':Sequelize[_0x0b44('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0b44('0x2e'),'set':function(_0x395de6){if(!_0x395de6)this[_0x0b44('0x1c')](_0x0b44('0x2f'),null);this['setDataValue']('mandatoryDisposition',_0x395de6);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0b44('0x3')]},'vidaooTopic':{'type':Sequelize[_0x0b44('0x3')],'allowNull':![],'defaultValue':_0x0b44('0x30')},'vidaooNote':{'type':Sequelize[_0x0b44('0x3')],'defaultValue':function(){return _0x0b44('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x0b44('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0b44('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0b44('0x11')]}}; \ No newline at end of file +var _0x369d=['#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Skip','Feedback','star','stringify','input','text','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x369d,0x16b));var _0xd369=function(_0x1774bd,_0x3fedfb){_0x1774bd=_0x1774bd-0x0;var _0x3a28ab=_0x369d[_0x1774bd];return _0x3a28ab;};'use strict';var Sequelize=require(_0xd369('0x0'));var rs=require(_0xd369('0x1'));module[_0xd369('0x2')]={'name':{'type':Sequelize[_0xd369('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd369('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd369('0x3')],'allowNull':![],'defaultValue':_0xd369('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd369('0x3')],'allowNull':![],'defaultValue':_0xd369('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd369('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xd369('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd369('0xb')](_0xd369('0xc'),_0xd369('0xd')),'defaultValue':_0xd369('0xc')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0xe')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0xf')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0x10')},'header_offline':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x11')},'download_transcript':{'type':Sequelize[_0xd369('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd369('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x12')},'defaultWhiteLabel':{'type':Sequelize[_0xd369('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd369('0x13')]},'closingQuestion':{'type':Sequelize[_0xd369('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x15')},'noteTitle':{'type':Sequelize[_0xd369('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xd369('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x10')},'skipMessageButton':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0x17')},'ratingType':{'type':Sequelize[_0xd369('0xb')](_0xd369('0x18'),'thumb'),'defaultValue':_0xd369('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xd369('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd369('0x13')],'defaultValue':function(){return JSON[_0xd369('0x19')]({'items':[{'type':_0xd369('0x1a'),'variable':null,'config':{'placeholder':'name','type':_0xd369('0x1b'),'required':!![]},'props':{'title':_0xd369('0x1c'),'helpText':''}},{'type':_0xd369('0x1a'),'props':{'title':_0xd369('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd369('0x5'),'type':_0xd369('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd369('0x1d')](_0xd369('0x1e'))?JSON[_0xd369('0x1f')](this[_0xd369('0x1d')](_0xd369('0x1e'))):{};},'set':function(_0x715a98){return this[_0xd369('0x20')](_0xd369('0x1e'),JSON['stringify'](_0x715a98));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xd369('0x19')]({'items':[{'type':_0xd369('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd369('0x5'),'type':_0xd369('0x5')},'variable':null},{'type':_0xd369('0x21'),'config':{'placeholder':_0xd369('0x22')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xd369('0x1d')](_0xd369('0x23'))?JSON[_0xd369('0x1f')](this[_0xd369('0x1d')]('offlineForm')):{};},'set':function(_0x171b19){return this[_0xd369('0x20')](_0xd369('0x23'),JSON[_0xd369('0x19')](_0x171b19));}},'token':{'type':Sequelize[_0xd369('0x3')],'defaultValue':function(){return rs[_0xd369('0x24')]();}},'autoclose':{'type':Sequelize[_0xd369('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd369('0x3')]},'forwardOffline':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd369('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0x25')},'waitingMessage':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0x16')},'sendUnmanaged':{'type':Sequelize[_0xd369('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd369('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd369('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd369('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x2b')},'verticalAlignment':{'type':Sequelize[_0xd369('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xd369('0x2c')},'messagesAlignment':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x2d')},'defaultTitle':{'type':Sequelize[_0xd369('0x3')]},'customerAvatar':{'type':Sequelize[_0xd369('0x13')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd369('0x3')],'allowNull':![],'defaultValue':_0xd369('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd369('0x3')],'defaultValue':_0xd369('0x2f')},'systemAvatar':{'type':Sequelize[_0xd369('0x13')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd369('0x9')],'comment':_0xd369('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd369('0x31'),'set':function(_0x2d259a){if(!_0x2d259a)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xd369('0x20')](_0xd369('0x32'),_0x2d259a);}},'vidaooEscalation':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd369('0x3')]},'vidaooTopic':{'type':Sequelize[_0xd369('0x3')],'allowNull':![],'defaultValue':_0xd369('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xd369('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd369('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xd369('0x13')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0992989..199d822 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 _0xee24=['messageId','update','created','autoclose','close','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','findOne','Smtp','forwardOffline','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','originalname','mapValues','subjectOffline','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','labelText','textColor','backgroundColor','hideWhenOffline','addApplications','sequelize','Transaction','ISOLATION_LEVELS','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','ChatWebsite','includeAll','include','findAll','rows','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','params','describe','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','../../config/license/util','getLicense','custom','existsSync','root','server/files/images/logos/','download','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','notify','setUA','headers','user-agent','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','applications','Applications','orderBy','priority','asc','account','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0xee24,0x1a6));var _0x4ee2=function(_0x5b6293,_0x13b4d3){_0x5b6293=_0x5b6293-0x0;var _0x2ab78a=_0xee24[_0x5b6293];return _0x2ab78a;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x4ee2('0x0'));var util=require(_0x4ee2('0x1'));var path=require('path');var ejs=require(_0x4ee2('0x2'));var fs=require('fs');var fs_extra=require(_0x4ee2('0x3'));var _=require(_0x4ee2('0x4'));var querystring=require(_0x4ee2('0x5'));var Redis=require('ioredis');var qs=require(_0x4ee2('0x6'));var logger=require(_0x4ee2('0x7'))(_0x4ee2('0x8'));var config=require(_0x4ee2('0x9'));var db=require('../../mysqldb')['db'];config[_0x4ee2('0xa')]=_[_0x4ee2('0xb')](config[_0x4ee2('0xa')],{'host':_0x4ee2('0xc'),'port':0x18eb});var socket=require(_0x4ee2('0xd'))(new Redis(config[_0x4ee2('0xa')]));require(_0x4ee2('0xe'))[_0x4ee2('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0x4ee2('0x10')][_0x4ee2('0x11')]({'port':0x232c});var client9002=jayson[_0x4ee2('0x10')][_0x4ee2('0x11')]({'port':0x232a});var client9003=jayson[_0x4ee2('0x10')]['http']({'port':0x232b});var client9001=jayson[_0x4ee2('0x10')][_0x4ee2('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x111aeb,_0x322780,_0x51f09d,_0x1f7125){return new BPromise(function(_0x2e4f35,_0x665d4d){var _0x23c1c9=_0x1f7125||client;return _0x23c1c9['request'](_0x111aeb,_0x51f09d)['then'](function(_0x2357c5){logger[_0x4ee2('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x322780,_0x4ee2('0x13'));logger[_0x4ee2('0x14')](_0x4ee2('0x15'),_0x322780,_0x4ee2('0x13'),JSON[_0x4ee2('0x16')](_0x2357c5));if(_0x2357c5[_0x4ee2('0x17')]){if(_0x2357c5['error'][_0x4ee2('0x18')]===0x1f4){logger[_0x4ee2('0x17')](_0x4ee2('0x19'),_0x322780,_0x2357c5['error'][_0x4ee2('0x1a')]);return _0x665d4d(_0x2357c5[_0x4ee2('0x17')][_0x4ee2('0x1a')]);}logger[_0x4ee2('0x17')](_0x4ee2('0x19'),_0x322780,_0x2357c5[_0x4ee2('0x17')][_0x4ee2('0x1a')]);return _0x2e4f35(_0x2357c5[_0x4ee2('0x17')]['message']);}else{logger['info'](_0x4ee2('0x19'),_0x322780,'request\x20sent');_0x2e4f35(_0x2357c5[_0x4ee2('0x1b')][_0x4ee2('0x1a')]);}})[_0x4ee2('0x1c')](function(_0x416a78){logger[_0x4ee2('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x322780,_0x416a78);_0x665d4d(_0x416a78);});});}function respondWithStatusCode(_0x1d5037,_0x4d74a0){_0x4d74a0=_0x4d74a0||0xcc;return function(_0x1feac6){if(_0x1feac6){return _0x1d5037[_0x4ee2('0x1d')](_0x4d74a0);}return _0x1d5037[_0x4ee2('0x1e')](_0x4d74a0)[_0x4ee2('0x1f')]();};}function respondWithResult(_0x1ca982,_0x1f9750){_0x1f9750=_0x1f9750||0xc8;return function(_0x381b3c){if(_0x381b3c){return _0x1ca982['status'](_0x1f9750)[_0x4ee2('0x20')](_0x381b3c);}};}function respondWithFilteredResult(_0x5127b8,_0x58f27e){return function(_0xebd95f){if(_0xebd95f){var _0x291734=typeof _0x58f27e[_0x4ee2('0x21')]===_0x4ee2('0x22')&&typeof _0x58f27e[_0x4ee2('0x23')]==='undefined';var _0x50005e=_0xebd95f[_0x4ee2('0x24')];var _0x2a078f=_0x291734?0x0:_0x58f27e['offset'];var _0x2fe02a=_0x291734?_0xebd95f['count']:_0x58f27e['offset']+_0x58f27e['limit'];var _0x45dc43;if(_0x2fe02a>=_0x50005e){_0x2fe02a=_0x50005e;_0x45dc43=0xc8;}else{_0x45dc43=0xce;}_0x5127b8[_0x4ee2('0x1e')](_0x45dc43);return _0x5127b8['set'](_0x4ee2('0x25'),_0x2a078f+'-'+_0x2fe02a+'/'+_0x50005e)[_0x4ee2('0x20')](_0xebd95f);}return null;};}function saveUpdates(_0x52db7b){return function(_0xc7df80){if(_0xc7df80){return _0xc7df80['update'](_0x52db7b)[_0x4ee2('0x26')](function(_0x3a0881){return _0x3a0881;});}return null;};}function removeEntity(_0x1fea65){return function(_0x4da154){if(_0x4da154){return _0x4da154['destroy']()[_0x4ee2('0x26')](function(){var _0x14f164=_0x4da154[_0x4ee2('0x27')]({'plain':!![]});var _0x502465=_0x4ee2('0x28');return db[_0x4ee2('0x29')][_0x4ee2('0x2a')]({'where':{'type':_0x502465,'resourceId':_0x14f164['id']}})[_0x4ee2('0x26')](function(){return _0x4da154;});})[_0x4ee2('0x26')](function(){_0x1fea65[_0x4ee2('0x1e')](0xcc)[_0x4ee2('0x1f')]();});}};}function handleEntityNotFound(_0x250fc7){return function(_0x256bea){if(!_0x256bea){_0x250fc7[_0x4ee2('0x1d')](0x194);}return _0x256bea;};}function handleError(_0x3ecedb,_0x25db8f){_0x25db8f=_0x25db8f||0x1f4;return function(_0x5a758f){logger[_0x4ee2('0x17')](_0x5a758f[_0x4ee2('0x2b')]);if(_0x5a758f['name']){delete _0x5a758f[_0x4ee2('0x2c')];}_0x3ecedb[_0x4ee2('0x1e')](_0x25db8f)[_0x4ee2('0x2d')](_0x5a758f);};}exports[_0x4ee2('0x2e')]=function(_0x3f8416,_0x429a90){var _0x2c1308={'include':[{'model':db[_0x4ee2('0x2f')],'as':_0x4ee2('0x30')}]},_0x5b1c58={},_0x455258={'count':0x0,'rows':[]};var _0x59e885=_[_0x4ee2('0x31')](db['ChatWebsite'][_0x4ee2('0x32')],function(_0x3f833d){return{'name':_0x3f833d[_0x4ee2('0x33')],'type':_0x3f833d[_0x4ee2('0x34')][_0x4ee2('0x35')]};});_0x5b1c58[_0x4ee2('0x36')]=_['map'](_0x59e885,'name');_0x5b1c58[_0x4ee2('0x37')]=_[_0x4ee2('0x38')](_0x3f8416[_0x4ee2('0x37')]);_0x5b1c58[_0x4ee2('0x39')]=_[_0x4ee2('0x3a')](_0x5b1c58[_0x4ee2('0x36')],_0x5b1c58[_0x4ee2('0x37')]);_0x2c1308[_0x4ee2('0x3b')]=_[_0x4ee2('0x3a')](_0x5b1c58[_0x4ee2('0x36')],qs['fields'](_0x3f8416['query'][_0x4ee2('0x3c')]));_0x2c1308[_0x4ee2('0x3b')]=_0x2c1308[_0x4ee2('0x3b')]['length']?_0x2c1308[_0x4ee2('0x3b')]:_0x5b1c58[_0x4ee2('0x36')];if(!_0x3f8416[_0x4ee2('0x37')][_0x4ee2('0x3d')](_0x4ee2('0x3e'))){_0x2c1308[_0x4ee2('0x23')]=qs[_0x4ee2('0x23')](_0x3f8416[_0x4ee2('0x37')][_0x4ee2('0x23')]);_0x2c1308[_0x4ee2('0x21')]=qs['offset'](_0x3f8416['query'][_0x4ee2('0x21')]);}_0x2c1308[_0x4ee2('0x3f')]=qs[_0x4ee2('0x40')](_0x3f8416['query'][_0x4ee2('0x40')]);_0x2c1308['where']=qs[_0x4ee2('0x39')](_['pick'](_0x3f8416[_0x4ee2('0x37')],_0x5b1c58[_0x4ee2('0x39')]),_0x59e885);if(_0x3f8416[_0x4ee2('0x37')]['filter']){_0x2c1308[_0x4ee2('0x41')]=_['merge'](_0x2c1308[_0x4ee2('0x41')],{'$or':_[_0x4ee2('0x31')](_0x59e885,function(_0x2ba4a5){if(_0x2ba4a5[_0x4ee2('0x34')]!=='VIRTUAL'){var _0x28374e={};_0x28374e[_0x2ba4a5[_0x4ee2('0x2c')]]={'$like':'%'+_0x3f8416['query'][_0x4ee2('0x42')]+'%'};return _0x28374e;}})});}_0x2c1308=_['merge']({},_0x2c1308,_0x3f8416['options']);var _0x11cd7a={'where':_0x2c1308['where']};return db[_0x4ee2('0x43')]['count'](_0x11cd7a)[_0x4ee2('0x26')](function(_0x4641b8){_0x455258[_0x4ee2('0x24')]=_0x4641b8;if(_0x3f8416['query'][_0x4ee2('0x44')]){_0x2c1308[_0x4ee2('0x45')]=[{'all':!![]}];}return db[_0x4ee2('0x43')][_0x4ee2('0x46')](_0x2c1308);})[_0x4ee2('0x26')](function(_0x513354){_0x455258[_0x4ee2('0x47')]=_0x513354;return _0x455258;})[_0x4ee2('0x26')](respondWithFilteredResult(_0x429a90,_0x2c1308))['catch'](handleError(_0x429a90,null));};exports['show']=function(_0x253d0e,_0x54e734){var _0x4480f3={'raw':![],'where':{'id':_0x253d0e['params']['id']},'include':[{'model':db[_0x4ee2('0x2f')],'as':_0x4ee2('0x30')}]},_0x1117cf={};_0x1117cf[_0x4ee2('0x36')]=_['keys'](db[_0x4ee2('0x43')][_0x4ee2('0x32')]);_0x1117cf['query']=_['keys'](_0x253d0e['query']);_0x1117cf['filters']=_[_0x4ee2('0x3a')](_0x1117cf[_0x4ee2('0x36')],_0x1117cf['query']);_0x4480f3[_0x4ee2('0x3b')]=_[_0x4ee2('0x3a')](_0x1117cf[_0x4ee2('0x36')],qs[_0x4ee2('0x3c')](_0x253d0e[_0x4ee2('0x37')][_0x4ee2('0x3c')]));_0x4480f3[_0x4ee2('0x3b')]=_0x4480f3['attributes'][_0x4ee2('0x48')]?_0x4480f3['attributes']:_0x1117cf[_0x4ee2('0x36')];if(_0x253d0e[_0x4ee2('0x37')][_0x4ee2('0x44')]){_0x4480f3['include']=[{'all':!![]}];}_0x4480f3=_[_0x4ee2('0x49')]({},_0x4480f3,_0x253d0e[_0x4ee2('0x4a')]);return db[_0x4ee2('0x43')]['find'](_0x4480f3)['then'](handleEntityNotFound(_0x54e734,null))[_0x4ee2('0x26')](respondWithResult(_0x54e734,null))[_0x4ee2('0x1c')](handleError(_0x54e734,null));};exports[_0x4ee2('0x4b')]=function(_0x3df5b3,_0x5ee68c){return db[_0x4ee2('0x43')][_0x4ee2('0x4b')](_0x3df5b3[_0x4ee2('0x4c')],{})[_0x4ee2('0x26')](function(_0x14b634){var _0x47405f=_0x3df5b3[_0x4ee2('0x4d')][_0x4ee2('0x27')]({'plain':!![]});if(!_0x47405f)throw new Error(_0x4ee2('0x4e'));if(_0x47405f[_0x4ee2('0x4f')]===_0x4ee2('0x4d')){var _0x1a1021=_0x14b634['get']({'plain':!![]});var _0x59fb25=_0x4ee2('0x28');return db[_0x4ee2('0x50')][_0x4ee2('0x51')]({'where':{'name':_0x59fb25,'userProfileId':_0x47405f['userProfileId']},'raw':!![]})['then'](function(_0x325ff3){if(_0x325ff3&&_0x325ff3[_0x4ee2('0x52')]===0x0){return db[_0x4ee2('0x29')]['create']({'name':_0x1a1021[_0x4ee2('0x2c')],'resourceId':_0x1a1021['id'],'type':_0x325ff3[_0x4ee2('0x2c')],'sectionId':_0x325ff3['id']},{})[_0x4ee2('0x26')](function(){return _0x14b634;});}else{return _0x14b634;}})[_0x4ee2('0x1c')](function(_0x430dfc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x430dfc);throw _0x430dfc;});}return _0x14b634;})[_0x4ee2('0x26')](respondWithResult(_0x5ee68c,0xc9))[_0x4ee2('0x1c')](handleError(_0x5ee68c,null));};exports['update']=function(_0x3c4120,_0xdf70bd){if(_0x3c4120[_0x4ee2('0x4c')]['id']){delete _0x3c4120[_0x4ee2('0x4c')]['id'];}return db[_0x4ee2('0x43')]['find']({'where':{'id':_0x3c4120[_0x4ee2('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x4ee2('0x30')}]})[_0x4ee2('0x26')](handleEntityNotFound(_0xdf70bd,null))['then'](saveUpdates(_0x3c4120[_0x4ee2('0x4c')],null))[_0x4ee2('0x26')](respondWithResult(_0xdf70bd,null))[_0x4ee2('0x1c')](handleError(_0xdf70bd,null));};exports[_0x4ee2('0x2a')]=function(_0x592ce6,_0x360fc8){return db[_0x4ee2('0x43')]['find']({'where':{'id':_0x592ce6[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x360fc8,null))[_0x4ee2('0x26')](removeEntity(_0x360fc8,null))[_0x4ee2('0x1c')](handleError(_0x360fc8,null));};exports['describe']=function(_0x39a1b5,_0x3b3723){return db[_0x4ee2('0x43')][_0x4ee2('0x54')]()[_0x4ee2('0x26')](respondWithResult(_0x3b3723,null))[_0x4ee2('0x1c')](handleError(_0x3b3723,null));};exports['addDisposition']=function(_0x211e6d,_0x19d41b){if(_0x211e6d[_0x4ee2('0x4c')]['id']){delete _0x211e6d[_0x4ee2('0x4c')]['id'];}return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x211e6d[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x19d41b,null))['then'](function(_0x4a0b79){if(_0x4a0b79){_0x211e6d['body'][_0x4ee2('0x55')]=_0x4a0b79['id'];return db['Disposition'][_0x4ee2('0x4b')](_0x211e6d[_0x4ee2('0x4c')]);}})[_0x4ee2('0x26')](respondWithResult(_0x19d41b,null))['catch'](handleError(_0x19d41b,null));};exports['getDispositions']=function(_0x3d57d6,_0x2d0f3a){var _0x4217f9={'raw':![],'where':{}};var _0x373ad4={};var _0x1bfd79={'count':0x0,'rows':[]};return db[_0x4ee2('0x43')]['findOne']({'where':{'id':_0x3d57d6[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x2d0f3a,null))[_0x4ee2('0x26')](function(_0x4a1656){if(_0x4a1656){_0x373ad4[_0x4ee2('0x36')]=_[_0x4ee2('0x38')](db[_0x4ee2('0x56')][_0x4ee2('0x32')]);_0x373ad4[_0x4ee2('0x37')]=_['keys'](_0x3d57d6['query']);_0x373ad4[_0x4ee2('0x39')]=_['intersection'](_0x373ad4[_0x4ee2('0x36')],_0x373ad4['query']);_0x4217f9['attributes']=_[_0x4ee2('0x3a')](_0x373ad4[_0x4ee2('0x36')],qs['fields'](_0x3d57d6[_0x4ee2('0x37')]['fields']));_0x4217f9[_0x4ee2('0x3b')]=_0x4217f9[_0x4ee2('0x3b')][_0x4ee2('0x48')]?_0x4217f9['attributes']:_0x373ad4[_0x4ee2('0x36')];if(!_0x3d57d6[_0x4ee2('0x37')]['hasOwnProperty'](_0x4ee2('0x3e'))){_0x4217f9[_0x4ee2('0x23')]=qs[_0x4ee2('0x23')](_0x3d57d6[_0x4ee2('0x37')][_0x4ee2('0x23')]);_0x4217f9[_0x4ee2('0x21')]=qs[_0x4ee2('0x21')](_0x3d57d6['query']['offset']);}_0x4217f9[_0x4ee2('0x3f')]=qs[_0x4ee2('0x40')](_0x3d57d6[_0x4ee2('0x37')]['sort']);_0x4217f9[_0x4ee2('0x41')]=qs[_0x4ee2('0x39')](_['pick'](_0x3d57d6['query'],_0x373ad4[_0x4ee2('0x39')]));_0x4217f9['where'][_0x4ee2('0x55')]=_0x4a1656['id'];if(_0x3d57d6[_0x4ee2('0x37')]['filter']){_0x4217f9[_0x4ee2('0x41')]=_[_0x4ee2('0x49')](_0x4217f9[_0x4ee2('0x41')],{'$or':_[_0x4ee2('0x31')](_0x4217f9[_0x4ee2('0x3b')],function(_0x14abad){var _0x1e093a={};_0x1e093a[_0x14abad]={'$like':'%'+_0x3d57d6[_0x4ee2('0x37')][_0x4ee2('0x42')]+'%'};return _0x1e093a;})});}_0x4217f9=_[_0x4ee2('0x49')]({},_0x4217f9,_0x3d57d6[_0x4ee2('0x4a')]);return db[_0x4ee2('0x56')][_0x4ee2('0x24')]({'where':_0x4217f9[_0x4ee2('0x41')]})[_0x4ee2('0x26')](function(_0x421c65){_0x1bfd79[_0x4ee2('0x24')]=_0x421c65;if(_0x3d57d6[_0x4ee2('0x37')][_0x4ee2('0x44')]){_0x4217f9[_0x4ee2('0x45')]=[{'all':!![]}];}return db[_0x4ee2('0x56')][_0x4ee2('0x46')](_0x4217f9);})['then'](function(_0x4312b9){_0x1bfd79[_0x4ee2('0x47')]=_0x4312b9;return _0x1bfd79;});}})[_0x4ee2('0x26')](respondWithFilteredResult(_0x2d0f3a,_0x4217f9))[_0x4ee2('0x1c')](handleError(_0x2d0f3a,null));};exports[_0x4ee2('0x57')]=function(_0x373f35,_0x315a89){return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x373f35[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x315a89,null))[_0x4ee2('0x26')](function(_0x27de1d){if(_0x27de1d){return _0x27de1d[_0x4ee2('0x57')](_0x373f35['query'][_0x4ee2('0x58')]);}})[_0x4ee2('0x26')](respondWithStatusCode(_0x315a89,null))[_0x4ee2('0x1c')](handleError(_0x315a89,null));};exports[_0x4ee2('0x59')]=function(_0x327543,_0x3eb440){if(_0x327543[_0x4ee2('0x4c')]['id']){delete _0x327543[_0x4ee2('0x4c')]['id'];}return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x327543[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x3eb440,null))[_0x4ee2('0x26')](function(_0xac4561){if(_0xac4561){_0x327543['body']['ChatWebsiteId']=_0xac4561['id'];return db['CannedAnswer'][_0x4ee2('0x4b')](_0x327543[_0x4ee2('0x4c')]);}})[_0x4ee2('0x26')](respondWithResult(_0x3eb440,null))[_0x4ee2('0x1c')](handleError(_0x3eb440,null));};exports[_0x4ee2('0x5a')]=function(_0x123b2f,_0x2138c0){var _0x24bb46={'raw':![],'where':{}};var _0x41b2cd={};var _0x3a9a66={'count':0x0,'rows':[]};return db[_0x4ee2('0x43')]['findOne']({'where':{'id':_0x123b2f[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x2138c0,null))[_0x4ee2('0x26')](function(_0x43c331){if(_0x43c331){_0x41b2cd[_0x4ee2('0x36')]=_[_0x4ee2('0x38')](db[_0x4ee2('0x5b')][_0x4ee2('0x32')]);_0x41b2cd[_0x4ee2('0x37')]=_[_0x4ee2('0x38')](_0x123b2f[_0x4ee2('0x37')]);_0x41b2cd[_0x4ee2('0x39')]=_[_0x4ee2('0x3a')](_0x41b2cd[_0x4ee2('0x36')],_0x41b2cd[_0x4ee2('0x37')]);_0x24bb46[_0x4ee2('0x3b')]=_[_0x4ee2('0x3a')](_0x41b2cd[_0x4ee2('0x36')],qs[_0x4ee2('0x3c')](_0x123b2f['query'][_0x4ee2('0x3c')]));_0x24bb46[_0x4ee2('0x3b')]=_0x24bb46[_0x4ee2('0x3b')][_0x4ee2('0x48')]?_0x24bb46[_0x4ee2('0x3b')]:_0x41b2cd['model'];if(!_0x123b2f[_0x4ee2('0x37')][_0x4ee2('0x3d')](_0x4ee2('0x3e'))){_0x24bb46[_0x4ee2('0x23')]=qs['limit'](_0x123b2f[_0x4ee2('0x37')][_0x4ee2('0x23')]);_0x24bb46[_0x4ee2('0x21')]=qs['offset'](_0x123b2f[_0x4ee2('0x37')][_0x4ee2('0x21')]);}_0x24bb46[_0x4ee2('0x3f')]=qs[_0x4ee2('0x40')](_0x123b2f['query'][_0x4ee2('0x40')]);_0x24bb46[_0x4ee2('0x41')]=qs[_0x4ee2('0x39')](_[_0x4ee2('0x5c')](_0x123b2f[_0x4ee2('0x37')],_0x41b2cd[_0x4ee2('0x39')]));_0x24bb46[_0x4ee2('0x41')]['ChatWebsiteId']=_0x43c331['id'];if(_0x123b2f[_0x4ee2('0x37')][_0x4ee2('0x42')]){_0x24bb46[_0x4ee2('0x41')]=_[_0x4ee2('0x49')](_0x24bb46[_0x4ee2('0x41')],{'$or':_[_0x4ee2('0x31')](_0x24bb46['attributes'],function(_0x3769d1){var _0x1994e0={};_0x1994e0[_0x3769d1]={'$like':'%'+_0x123b2f[_0x4ee2('0x37')][_0x4ee2('0x42')]+'%'};return _0x1994e0;})});}_0x24bb46=_['merge']({},_0x24bb46,_0x123b2f[_0x4ee2('0x4a')]);return db['CannedAnswer']['count']({'where':_0x24bb46[_0x4ee2('0x41')]})['then'](function(_0x10ab57){_0x3a9a66[_0x4ee2('0x24')]=_0x10ab57;if(_0x123b2f['query'][_0x4ee2('0x44')]){_0x24bb46[_0x4ee2('0x45')]=[{'all':!![]}];}return db[_0x4ee2('0x5b')]['findAll'](_0x24bb46);})[_0x4ee2('0x26')](function(_0x2d5c17){_0x3a9a66[_0x4ee2('0x47')]=_0x2d5c17;return _0x3a9a66;});}})['then'](respondWithFilteredResult(_0x2138c0,_0x24bb46))[_0x4ee2('0x1c')](handleError(_0x2138c0,null));};exports[_0x4ee2('0x5d')]=function(_0x4f3344,_0x30347f){return db[_0x4ee2('0x43')]['find']({'where':{'id':_0x4f3344[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x30347f,null))[_0x4ee2('0x26')](function(_0x1d8341){if(_0x1d8341){return _0x1d8341[_0x4ee2('0x5d')](_0x4f3344[_0x4ee2('0x37')][_0x4ee2('0x58')]);}})[_0x4ee2('0x26')](respondWithStatusCode(_0x30347f,null))[_0x4ee2('0x1c')](handleError(_0x30347f,null));};exports[_0x4ee2('0x5e')]=function(_0x51ee21,_0x42663f){_0x51ee21[_0x4ee2('0x4c')][_0x4ee2('0x5f')]=_0x51ee21[_0x4ee2('0x60')][_0x4ee2('0x61')];return db['ChatWebsite'][_0x4ee2('0x51')]({'where':{'id':_0x51ee21[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x42663f,null))['then'](saveUpdates(_0x51ee21[_0x4ee2('0x4c')],null))['then'](respondWithResult(_0x42663f,null))[_0x4ee2('0x1c')](handleError(_0x42663f,null));};exports[_0x4ee2('0x62')]=function(_0x48f431,_0x13a431){_0x48f431[_0x4ee2('0x4c')][_0x4ee2('0x63')]=_0x48f431[_0x4ee2('0x60')]['filename'];return db[_0x4ee2('0x43')]['find']({'where':{'id':_0x48f431[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x13a431,null))[_0x4ee2('0x26')](saveUpdates(_0x48f431['body'],null))[_0x4ee2('0x26')](respondWithResult(_0x13a431,null))['catch'](handleError(_0x13a431,null));};exports[_0x4ee2('0x64')]=function(_0x31e4c1,_0x3fde30){_0x31e4c1[_0x4ee2('0x4c')][_0x4ee2('0x65')]=_0x31e4c1[_0x4ee2('0x60')][_0x4ee2('0x61')];return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x31e4c1[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x3fde30,null))['then'](saveUpdates(_0x31e4c1[_0x4ee2('0x4c')],null))[_0x4ee2('0x26')](respondWithResult(_0x3fde30,null))[_0x4ee2('0x1c')](handleError(_0x3fde30,null));};exports[_0x4ee2('0x66')]=function(_0x536290,_0x407229){_0x536290[_0x4ee2('0x4c')][_0x4ee2('0x67')]=_0x536290[_0x4ee2('0x60')][_0x4ee2('0x61')];return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x536290['params']['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x407229,null))['then'](saveUpdates(_0x536290[_0x4ee2('0x4c')],null))[_0x4ee2('0x26')](respondWithResult(_0x407229,null))[_0x4ee2('0x1c')](handleError(_0x407229,null));};exports[_0x4ee2('0x68')]=function(_0x2d4ac2,_0x5a7671){var _0x31a436=path[_0x4ee2('0x69')](config['root'],'server/files/images/logos/default_logo.svg');var _0x59fe80={'where':{'id':_0x2d4ac2['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x40d990=![];return require(_0x4ee2('0x6a'))[_0x4ee2('0x6b')]()[_0x4ee2('0x26')](function(_0x23dc9d){if(_0x23dc9d){_0x40d990=_0x23dc9d[_0x4ee2('0x6c')];}})[_0x4ee2('0x26')](function(){return db[_0x4ee2('0x43')][_0x4ee2('0x51')](_0x59fe80);})['then'](handleEntityNotFound(_0x5a7671,null))[_0x4ee2('0x26')](function(_0x23ce68){if(_0x23ce68){if(!_['isNil'](_0x23ce68[_0x4ee2('0x5f')])){if(fs[_0x4ee2('0x6d')](path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],'server/files/images/logos/',_0x23ce68[_0x4ee2('0x5f')]))&&_0x40d990){_0x31a436=path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],_0x4ee2('0x6f'),_0x23ce68['sitepic']);}}return _0x5a7671[_0x4ee2('0x70')](_0x31a436);}})[_0x4ee2('0x1c')](handleError(_0x5a7671,null));};exports['getAvatar']=function(_0x358a30,_0x3d1d35){var _0x14aec4=path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],'server/files/images/avatars/default_avatar.png');var _0x13f585={'where':{'id':_0x358a30[_0x4ee2('0x53')]['id']},'attributes':['id',_0x4ee2('0x63')],'raw':!![]};return db[_0x4ee2('0x43')][_0x4ee2('0x51')](_0x13f585)[_0x4ee2('0x26')](handleEntityNotFound(_0x3d1d35,null))[_0x4ee2('0x26')](function(_0x3421e7){if(_0x3421e7){if(!_[_0x4ee2('0x71')](_0x3421e7[_0x4ee2('0x63')])){if(fs[_0x4ee2('0x6d')](path[_0x4ee2('0x69')](config['root'],_0x4ee2('0x72'),_0x3421e7[_0x4ee2('0x63')]))){_0x14aec4=path['join'](config[_0x4ee2('0x6e')],_0x4ee2('0x72'),_0x3421e7[_0x4ee2('0x63')]);}}return _0x3d1d35[_0x4ee2('0x70')](_0x14aec4);}})[_0x4ee2('0x1c')](handleError(_0x3d1d35,null));};exports[_0x4ee2('0x73')]=function(_0x4bb70d,_0x5b93e6){var _0x2e4bec=path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],_0x4ee2('0x74'));var _0x33eadb={'where':{'id':_0x4bb70d[_0x4ee2('0x53')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x4ee2('0x43')]['find'](_0x33eadb)[_0x4ee2('0x26')](handleEntityNotFound(_0x5b93e6,null))[_0x4ee2('0x26')](function(_0x139446){if(_0x139446){if(!_['isNil'](_0x139446[_0x4ee2('0x65')])){if(fs['existsSync'](path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],_0x4ee2('0x72'),_0x139446['customerAvatar']))&&_0x139446['showCustomerAvatar']){_0x2e4bec=path['join'](config['root'],_0x4ee2('0x72'),_0x139446[_0x4ee2('0x65')]);}}return _0x5b93e6[_0x4ee2('0x70')](_0x2e4bec);}})['catch'](handleError(_0x5b93e6,null));};exports[_0x4ee2('0x75')]=function(_0x554191,_0x47a37a){var _0x158dcf=path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],'server/files/images/avatars/system_avatar.png');var _0x4a62de={'where':{'id':_0x554191[_0x4ee2('0x53')]['id']},'attributes':['id',_0x4ee2('0x67')],'raw':!![]};return db[_0x4ee2('0x43')][_0x4ee2('0x51')](_0x4a62de)[_0x4ee2('0x26')](handleEntityNotFound(_0x47a37a,null))[_0x4ee2('0x26')](function(_0x4e8af6){if(_0x4e8af6){if(!_['isNil'](_0x4e8af6[_0x4ee2('0x67')])){if(fs[_0x4ee2('0x6d')](path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],_0x4ee2('0x72'),_0x4e8af6[_0x4ee2('0x67')]))){_0x158dcf=path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],'server/files/images/avatars/',_0x4e8af6[_0x4ee2('0x67')]);}}return _0x47a37a[_0x4ee2('0x70')](_0x158dcf);}})[_0x4ee2('0x1c')](handleError(_0x47a37a,null));};exports[_0x4ee2('0x76')]=function(_0x3b97d1,_0x4b4c68){var _0x6eeda8=require('user-agent-parser');var _0x25276b=new _0x6eeda8();var _0x3c673e=_0x25276b[_0x4ee2('0x77')](_0x3b97d1[_0x4ee2('0x78')][_0x4ee2('0x79')])['getResult']();var _0x53ac13={'body':_0x3b97d1[_0x4ee2('0x4c')],'channel':_0x4ee2('0x7a')};var _0x121b70=[];var _0x1f16e2=[];var _0x4fc99f={};var _0x1df2b7=![];return db[_0x4ee2('0x7b')][_0x4ee2('0x54')]()[_0x4ee2('0x26')](function(_0x5515f8){if(!_0x5515f8){throw new db[(_0x4ee2('0x7c'))]['ValidationError'](_0x4ee2('0x7d'));}_0x121b70=_[_0x4ee2('0x7e')](_[_0x4ee2('0x38')](_0x5515f8),[_0x4ee2('0x7f'),_0x4ee2('0x80')]);_0x1f16e2=_[_0x4ee2('0x7e')](_[_0x4ee2('0x38')](_0x5515f8),['createdAt',_0x4ee2('0x80'),_0x4ee2('0x81'),_0x4ee2('0x82')]);if(_0x3b97d1[_0x4ee2('0x4c')]['id']){delete _0x3b97d1[_0x4ee2('0x4c')]['id'];}if(_[_0x4ee2('0x71')](_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x83')])){throw new db[(_0x4ee2('0x7c'))]['ValidationError'](_0x4ee2('0x84'));}if(_[_0x4ee2('0x71')](_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x4c')])||_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x4c')]===''){throw new db[(_0x4ee2('0x7c'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x85')])){throw new db[(_0x4ee2('0x7c'))][(_0x4ee2('0x86'))](_0x4ee2('0x87')+_0x1f16e2);}if(!_['includes'](_0x1f16e2,_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x85')])){throw new db[(_0x4ee2('0x7c'))][(_0x4ee2('0x86'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f16e2);}_0x4fc99f[_0x3b97d1['body'][_0x4ee2('0x85')]]=_0x3b97d1['body']['from'];})[_0x4ee2('0x26')](function(){return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x3b97d1[_0x4ee2('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x4ee2('0x88'),'include':[{'model':db[_0x4ee2('0x7b')],'as':_0x4ee2('0x89'),'where':_0x4fc99f,'limit':0x1,'order':[[_0x4ee2('0x80'),_0x4ee2('0x8a')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x4b4c68,null))[_0x4ee2('0x26')](function(_0x2358b4){if(_0x2358b4&&_0x2358b4['List']){_0x53ac13['account']=_0x2358b4;_0x53ac13[_0x4ee2('0x8b')]=_0x2358b4[_0x4ee2('0x8c')];_0x53ac13['list']=_0x2358b4[_0x4ee2('0x88')];_0x53ac13[_0x4ee2('0x8b')]=_[_0x4ee2('0x8d')](_0x53ac13[_0x4ee2('0x8b')],[_0x4ee2('0x8e')],[_0x4ee2('0x8f')]);if(_0x53ac13['account'][_0x4ee2('0x8c')]){delete _0x53ac13[_0x4ee2('0x90')][_0x4ee2('0x8c')];}if(_0x53ac13[_0x4ee2('0x90')]['List']&&_0x53ac13[_0x4ee2('0x90')][_0x4ee2('0x88')][_0x4ee2('0x89')]['length']){return _0x53ac13[_0x4ee2('0x90')]['List'][_0x4ee2('0x89')][0x0];}var _0x307db5=_[_0x4ee2('0xb')](_0x3b97d1[_0x4ee2('0x4c')],{'firstName':_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x83')],'ListId':_0x2358b4[_0x4ee2('0x82')]});_0x307db5[_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x85')]]=_0x3b97d1[_0x4ee2('0x4c')]['from'];return db['CmContact'][_0x4ee2('0x4b')](_0x307db5,{'fields':_0x121b70,'raw':!![]});}})[_0x4ee2('0x26')](handleEntityNotFound(_0x4b4c68,null))['then'](function(_0x5591a1){_0x53ac13[_0x4ee2('0x91')]=_0x5591a1;var _0x3788db=_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x92')];if(_0x3b97d1[_0x4ee2('0x78')]['cf-connecting-ip']){_0x3788db=_0x3b97d1[_0x4ee2('0x78')][_0x4ee2('0x93')];}else if(_0x3b97d1[_0x4ee2('0x78')]['x-forwarded-for']){_0x3788db=_[_0x4ee2('0x94')](_0x3b97d1[_0x4ee2('0x78')][_0x4ee2('0x95')][_0x4ee2('0x96')](','));}if(_0x5591a1){var _0x1f0841={'ContactId':_0x5591a1['id'],'ChatWebsiteId':_0x3b97d1[_0x4ee2('0x53')]['id'],'from':(_0x5591a1[_0x4ee2('0x97')]||'')+'\x20'+(_0x5591a1[_0x4ee2('0x98')]||''),'customerIp':_0x3788db,'customerPort':_0x3b97d1[_0x4ee2('0x78')][_0x4ee2('0x99')]?_0x3b97d1[_0x4ee2('0x78')][_0x4ee2('0x99')]:null,'referer':_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0x9a')],'browserName':_0x3c673e[_0x4ee2('0x9b')]['name']&&_0x3c673e['browser']['version']?util[_0x4ee2('0x9c')](_0x4ee2('0x9d'),_0x3c673e[_0x4ee2('0x9b')][_0x4ee2('0x2c')],_0x3c673e[_0x4ee2('0x9b')][_0x4ee2('0x9e')]):_0x4ee2('0x9f'),'browserVersion':_0x3c673e['browser']['version']||_0x4ee2('0x9f'),'osName':util[_0x4ee2('0x9c')](_0x4ee2('0x9d'),_0x3c673e['os'][_0x4ee2('0x2c')],_0x3c673e['os'][_0x4ee2('0x9e')]),'osVersion':_0x3c673e['os'][_0x4ee2('0x9e')],'deviceModel':_0x3c673e[_0x4ee2('0xa0')][_0x4ee2('0x36')]&&_0x3c673e[_0x4ee2('0xa0')][_0x4ee2('0xa1')]?util['format']('%s\x20%s\x20%s',_0x3c673e['device'][_0x4ee2('0x36')],_0x3c673e[_0x4ee2('0xa0')][_0x4ee2('0xa1')],_0x3c673e[_0x4ee2('0xa0')][_0x4ee2('0x34')]):null,'deviceVendor':_0x3c673e['device'][_0x4ee2('0xa1')],'deviceType':_0x3c673e[_0x4ee2('0xa0')]['type'],'formData':JSON['stringify'](_0x3b97d1[_0x4ee2('0x4c')])};var _0xd8ef45={'ChatWebsiteId':_0x3b97d1['params']['id'],'closed':![]};if(_0x3b97d1[_0x4ee2('0x4c')]['threadId']){_0xd8ef45[_0x4ee2('0xa2')]=_0x3b97d1['body'][_0x4ee2('0xa2')];return db[_0x4ee2('0xa3')]['find']({'where':_0xd8ef45})[_0x4ee2('0x26')](function(_0x29a528){if(_0x29a528){return[_0x29a528,![]];}_0x1f0841['threadId']=_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa2')];_0x1f0841[_0x4ee2('0xa4')]=_0x3b97d1['body']['externalUrl'];return db[_0x4ee2('0xa3')]['create'](_0x1f0841)['then'](function(_0x349709){return[_0x349709,!![]];});});}_0xd8ef45[_0x4ee2('0xa5')]=_0x5591a1['id'];if(_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa6')]&&_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa6')]['id']){_0xd8ef45['id']=_0x3b97d1['body'][_0x4ee2('0xa6')]['id'];return db['ChatInteraction']['find']({'where':_0xd8ef45})[_0x4ee2('0x26')](function(_0x48f896){if(_0x48f896){return[_0x48f896,![]];}return db[_0x4ee2('0xa3')][_0x4ee2('0x4b')](_0x1f0841)['then'](function(_0xcc2bad){return[_0xcc2bad,!![]];});});}return db[_0x4ee2('0xa3')][_0x4ee2('0x4b')](_0x1f0841)['then'](function(_0xc4505c){return[_0xc4505c,!![]];});}})[_0x4ee2('0xa7')](function(_0x4f2a6c,_0x2baf02){if(_0x4f2a6c){_0x1df2b7=_0x2baf02;if(!_0x2baf02){var _0xe63466={'from':(_0x53ac13[_0x4ee2('0x91')]['firstName']||'')+'\x20'+(_0x53ac13['contact'][_0x4ee2('0x98')]||'')};if(_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa2')]&&_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa8')]&&_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa2')]!=_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa8')]){_0xe63466[_0x4ee2('0xa2')]=_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xa8')];}return _0x4f2a6c[_0x4ee2('0xa9')](_0xe63466);}else{return _0x4f2a6c;}}})[_0x4ee2('0x26')](function(_0x510393){_0x53ac13['interaction']=_0x510393['get']({'plain':!![]});_0x53ac13[_0x4ee2('0xa6')][_0x4ee2('0xaa')]=_0x1df2b7;if(_0x53ac13[_0x4ee2('0xa6')]['created']){if(_0x53ac13[_0x4ee2('0x90')][_0x4ee2('0xab')]){_0x53ac13[_0x4ee2('0x8b')]['push']({'id':0x0,'priority':_0x53ac13[_0x4ee2('0x8b')][_0x4ee2('0x48')]+0x1,'app':_0x4ee2('0xac'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x4ee2('0xad')]['create']({'body':_0x3b97d1['body'][_0x4ee2('0x4c')],'ChatWebsiteId':_0x3b97d1[_0x4ee2('0x53')]['id'],'ChatInteractionId':_0x510393['id'],'direction':'in','ContactId':_0x53ac13[_0x4ee2('0x91')]['id'],'AttachmentId':_0x3b97d1[_0x4ee2('0x4c')][_0x4ee2('0xae')]});})['then'](function(_0x1ad056){_0x53ac13['message']=_0x1ad056;if(_0x53ac13['interaction']['UserId']){return db[_0x4ee2('0xaf')]['find']({'attributes':['id',_0x4ee2('0x2c')],'where':{'id':_0x53ac13[_0x4ee2('0xa6')][_0x4ee2('0xb0')]}})[_0x4ee2('0x26')](function(_0x1391f0){if(_0x1391f0){_0x53ac13[_0x4ee2('0x8b')][_0x4ee2('0xb1')]({'id':0x0,'priority':0x0,'app':_0x4ee2('0xb2'),'appdata':_0x1391f0[_0x4ee2('0x2c')]+','+(_0x53ac13[_0x4ee2('0x90')][_0x4ee2('0xb3')]||0xa),'interval':_0x4ee2('0xb4')});_0x53ac13['forcedOwnership']=!![];}return respondWithRpcPromise(_0x4ee2('0xb5'),_0x4ee2('0xb6'),_0x53ac13);});}return respondWithRpcPromise('Start',_0x4ee2('0xb6'),_0x53ac13);})['then'](function(_0x24a2b0){respondWithRpcPromise(_0x4ee2('0xb7'),_0x4ee2('0xb7'),{'event':_0x4ee2('0x76'),'message':_0x24a2b0},client9002);return _0x24a2b0;})[_0x4ee2('0x26')](respondWithResult(_0x4b4c68,null))[_0x4ee2('0x1c')](handleError(_0x4b4c68,null));};exports[_0x4ee2('0xb8')]=function(_0xc19783,_0x2c8afb){var _0x4ad9df,_0x3c68aa,_0x52038c;var _0x438597=[];var _0x2d3fa6={};var _0x201ee7=_0xc19783[_0x4ee2('0xb9')]||[];var _0x273639=[];var _0x13a423;return db[_0x4ee2('0x7b')][_0x4ee2('0x54')]()[_0x4ee2('0x26')](function(_0x4b0737){if(!_0x4b0737){throw new db['Sequelize']['ValidationError'](_0x4ee2('0x7d'));}_0x438597=_[_0x4ee2('0x7e')](_[_0x4ee2('0x38')](_0x4b0737),[_0x4ee2('0x7f'),_0x4ee2('0x80'),_0x4ee2('0x81'),'ListId']);if(_0xc19783['body']['id']){delete _0xc19783['body']['id'];}if(_[_0x4ee2('0x71')](_0xc19783[_0x4ee2('0x4c')][_0x4ee2('0x83')])){throw _0x2c8afb[_0x4ee2('0x1e')](0x1f4)[_0x4ee2('0x2d')](new db[(_0x4ee2('0x7c'))][(_0x4ee2('0x86'))]('from\x20is\x20mandatory'));}if(_[_0x4ee2('0x71')](_0xc19783['body'][_0x4ee2('0x4c')])||_0xc19783['body'][_0x4ee2('0x4c')]===''){throw _0x2c8afb['status'](0x1f4)[_0x4ee2('0x2d')](new db['Sequelize']['ValidationError'](_0x4ee2('0xba')));}if(_[_0x4ee2('0x71')](_0xc19783[_0x4ee2('0x4c')][_0x4ee2('0xbb')])){throw _0x2c8afb['status'](0x1f4)[_0x4ee2('0x2d')](new db[(_0x4ee2('0x7c'))][(_0x4ee2('0x86'))](_0x4ee2('0xbc')+_0x438597));}if(!_[_0x4ee2('0xbd')](_0x438597,_0xc19783['body'][_0x4ee2('0xbb')])){throw _0x2c8afb['status'](0x1f4)[_0x4ee2('0x2d')](new db[(_0x4ee2('0x7c'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x438597));}_0x2d3fa6[_0xc19783[_0x4ee2('0x4c')][_0x4ee2('0xbb')]]=_0xc19783[_0x4ee2('0x4c')][_0x4ee2('0x83')];})[_0x4ee2('0x26')](function(){return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0xc19783[_0x4ee2('0x53')]['id']},'include':[{'model':db[_0x4ee2('0xbe')],'as':'List'},{'model':db[_0x4ee2('0xbf')],'as':_0x4ee2('0xbf')}]});})['then'](handleEntityNotFound(_0x2c8afb,null))[_0x4ee2('0x26')](function(_0x373a14){if(_0x373a14&&_0x373a14[_0x4ee2('0x88')]){_0x3c68aa=_0x373a14;var _0x31d0e1=_[_0x4ee2('0xb')](_0xc19783[_0x4ee2('0x4c')],{'firstName':_0xc19783['body'][_0x4ee2('0x83')],'phone':_0xc19783['body'][_0x4ee2('0x83')],'ListId':_0x373a14['ListId']});_0x31d0e1[_0xc19783[_0x4ee2('0x4c')]['mapKeyOffline']]=_0xc19783[_0x4ee2('0x4c')]['from'];return db[_0x4ee2('0x7b')][_0x4ee2('0xc0')]({'where':_0x2d3fa6,'defaults':_0x31d0e1});}})[_0x4ee2('0xa7')](function(_0x2e13c2){if(_0x2e13c2){_0x52038c=_0x2e13c2;var _0xbf6c7d=fs['readFileSync'](path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],_0x4ee2('0xc1')),_0x4ee2('0xc2'));var _0x386f4c=ejs[_0x4ee2('0xc3')](_0xbf6c7d,{'body':_[_0x4ee2('0xc4')](_0xc19783[_0x4ee2('0x4c')][_0x4ee2('0x4c')]),'bodyTitle':_0x3c68aa[_0x4ee2('0xc5')]});return db[_0x4ee2('0xc6')]['create']({'body':_0x386f4c,'plainBody':htmlToText[_0x4ee2('0xc7')](_0x386f4c),'ContactId':_0x2e13c2['id'],'ChatWebsiteId':_0x3c68aa['id']});}})[_0x4ee2('0x26')](function(_0x491bbf){_0x13a423=_0x491bbf;if(_0x201ee7['length']){var _0x2a6c5a=_0x201ee7['map'](function(_0x2c6639){return{'name':_0x2c6639['originalname'],'basename':_0x2c6639['filename'],'type':_0x2c6639[_0x4ee2('0xc8')],'ChatOfflineMessageId':_0x491bbf['id']};});_0x273639=_0x2a6c5a['map'](_0x2a2096=>{var _0x5bc7a2={'filename':_0x2a2096[_0x4ee2('0x2c')],'path':path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],'server',_0x4ee2('0xb9'),_0x4ee2('0xc9'),_0x4ee2('0xca'),_0x2a2096[_0x4ee2('0xcb')])};return _0x5bc7a2;});if(!_0x3c68aa[_0x4ee2('0xcc')]){return db['sequelize'][_0x4ee2('0xcd')](function(_0x5b03df){return db[_0x4ee2('0xce')][_0x4ee2('0xcf')](_0x2a6c5a,{'transaction':_0x5b03df});});}}})[_0x4ee2('0x26')](function(){if(_0x13a423){_0x4ad9df=_0x13a423;return db[_0x4ee2('0xbf')][_0x4ee2('0xd0')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4ee2('0xd1'),'raw':!![]}]});}})[_0x4ee2('0x26')](function(_0x39d425){if(_0x39d425&&_0x39d425[_0x4ee2('0xd1')]&&_0x3c68aa[_0x4ee2('0xd2')]&&_0x3c68aa['forwardOfflineAddress']){var _0x24c7d3={'tls':{'rejectUnauthorized':![]}};if(_0x39d425[_0x4ee2('0xd1')][_0x4ee2('0xd3')]){_0x24c7d3['service']=_0x39d425[_0x4ee2('0xd1')][_0x4ee2('0xd3')];}else{_0x24c7d3['host']=_0x39d425[_0x4ee2('0xd1')][_0x4ee2('0xd4')];_0x24c7d3[_0x4ee2('0xd5')]=_0x39d425[_0x4ee2('0xd1')]['port'];_0x24c7d3[_0x4ee2('0xd6')]=_0x39d425[_0x4ee2('0xd1')][_0x4ee2('0xd6')];}if(_0x39d425['Smtp'][_0x4ee2('0xd7')]){_0x24c7d3[_0x4ee2('0xd8')]={'user':_0x39d425[_0x4ee2('0xd1')][_0x4ee2('0x4d')],'pass':_0x39d425['Smtp'][_0x4ee2('0xd9')]};}return respondWithRpcPromise(_0x4ee2('0xda'),_0x4ee2('0xdb'),{'account':_0x24c7d3,'message':{'from':util[_0x4ee2('0x9c')](_0x4ee2('0xdc'),_0x39d425['name'],_0x39d425[_0x4ee2('0xdd')]||_0x39d425[_0x4ee2('0xd1')][_0x4ee2('0x4d')]),'to':_0x3c68aa[_0x4ee2('0xde')],'subject':_0x3c68aa[_0x4ee2('0xdf')],'html':_0x4ad9df[_0x4ee2('0x4c')],'attachments':_0x273639}},client9003)[_0x4ee2('0x26')](function(){return _0x4ad9df;})[_0x4ee2('0x1c')](function(_0x71103a){console['error'](_0x71103a);});}})[_0x4ee2('0x26')](function(){if(_0x3c68aa&&_0x3c68aa[_0x4ee2('0xcc')]&&_0x3c68aa[_0x4ee2('0xe0')]){var _0x1ebe1d=[];if(_0x201ee7[_0x4ee2('0x48')]){_0x1ebe1d=_0x201ee7[_0x4ee2('0x31')](function(_0x3f0bc6){return{'name':_0x3f0bc6[_0x4ee2('0xe1')],'basename':_0x3f0bc6['filename'],'type':_0x3f0bc6['mimetype'],'ChatOfflineMessageId':_0x13a423['id']};});}var _0x164466;if(!_[_0x4ee2('0x71')](_0x3c68aa['subjectOffline'])){var _0x2d6774=_[_0x4ee2('0x31')](_0xc19783[_0x4ee2('0x4c')],function(_0x26c93c){return _0x26c93c;});var _0x41a9fa=_['toPairsIn'](_0x2d6774)[0x0];var _0x546d6f=_[_0x4ee2('0xe2')](_0x41a9fa,function(_0x19a947){return _0x19a947;});_0x164466=_0x546d6f[0x1][_0x3c68aa[_0x4ee2('0xe3')]];}var _0x1d5c75={'from':_0x52038c[_0x4ee2('0xdd')],'firstName':_0x52038c[_0x4ee2('0x97')],'lastName':_0x52038c[_0x4ee2('0x98')],'mapKey':_0x4ee2('0xdd'),'message':{'from':_0x52038c[_0x4ee2('0xdd')],'to':_0x3c68aa[_0x4ee2('0xbf')][_0x4ee2('0xdd')],'cc':'','subject':_[_0x4ee2('0x71')](_0x164466)?_0x3c68aa[_0x4ee2('0xdf')]:_0x164466,'messageId':'','sentAt':new Date(),'attach':_0x1ebe1d[_0x4ee2('0x48')],'attachments':_0x1ebe1d,'originChannel':'Chat','ChatWebsiteId':_0x3c68aa['id'],'ChatOfflineMessageId':_0x4ad9df['id'],'originTo':_0x3c68aa[_0x4ee2('0xbf')]['email']},'body':_0x4ad9df['body']};var _0x4bdb89={'account':{'id':_0x3c68aa[_0x4ee2('0xe0')]},'body':_0x1d5c75,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x4ee2('0xe4'),_0x4ee2('0xe5'),_0x4bdb89,client9001)[_0x4ee2('0x26')](function(){return _0x4ad9df;})['catch'](function(_0x458915){console['error'](_0x458915);});}return;})[_0x4ee2('0x26')](function(){if(_0x4ad9df){return _0x4ad9df;}})['then'](respondWithResult(_0x2c8afb,null))[_0x4ee2('0x1c')](function(_0xa395a0){console[_0x4ee2('0x17')](_0x4ee2('0x1c'),_0xa395a0);for(var _0x44ba1d of _0x201ee7){var _0x5974f5=path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],'server',_0x4ee2('0xb9'),_0x4ee2('0xc9'),_0x4ee2('0xca'),_0x44ba1d['filename']);fs_extra[_0x4ee2('0xe6')](_0x5974f5)['catch'](function(_0x3204a0){console[_0x4ee2('0x17')](_0x4ee2('0xe7'),_0x5974f5,_0x3204a0);});}});};exports['addInteraction']=function(_0x5c5352,_0x1d8a78){return db[_0x4ee2('0xa3')][_0x4ee2('0x51')]({'where':{'id':_0x5c5352[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x1d8a78,null))[_0x4ee2('0x26')](function(_0x2fe165){if(_0x2fe165){return _0x2fe165[_0x4ee2('0xe8')](_0x5c5352[_0x4ee2('0x4c')]['ids'],_[_0x4ee2('0xe9')](_0x5c5352[_0x4ee2('0x4c')],[_0x4ee2('0x58'),'id'])||{});}})[_0x4ee2('0x26')](respondWithResult(_0x1d8a78,null))[_0x4ee2('0x1c')](handleError(_0x1d8a78,null));};exports[_0x4ee2('0xea')]=function(_0xffb036,_0x4be1b7){var _0x59e316={'raw':![],'where':{}};var _0x3ba1cc={};var _0x2a99f2={'count':0x0,'rows':[]};return db[_0x4ee2('0x43')]['findOne']({'where':{'id':_0xffb036[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x4be1b7,null))[_0x4ee2('0x26')](function(_0x1805b0){if(_0x1805b0){_0x3ba1cc[_0x4ee2('0x36')]=_[_0x4ee2('0x38')](db['ChatInteraction'][_0x4ee2('0x32')]);_0x3ba1cc['query']=_[_0x4ee2('0x38')](_0xffb036['query']);_0x3ba1cc[_0x4ee2('0x39')]=_['intersection'](_0x3ba1cc[_0x4ee2('0x36')],_0x3ba1cc['query']);_0x59e316[_0x4ee2('0x3b')]=_[_0x4ee2('0x3a')](_0x3ba1cc['model'],qs['fields'](_0xffb036['query'][_0x4ee2('0x3c')]));_0x59e316['attributes']=_0x59e316[_0x4ee2('0x3b')][_0x4ee2('0x48')]?_0x59e316[_0x4ee2('0x3b')]:_0x3ba1cc['model'];if(!_0xffb036[_0x4ee2('0x37')][_0x4ee2('0x3d')]('nolimit')){_0x59e316[_0x4ee2('0x23')]=qs[_0x4ee2('0x23')](_0xffb036[_0x4ee2('0x37')][_0x4ee2('0x23')]);_0x59e316[_0x4ee2('0x21')]=qs[_0x4ee2('0x21')](_0xffb036['query'][_0x4ee2('0x21')]);}_0x59e316[_0x4ee2('0x3f')]=qs[_0x4ee2('0x40')](_0xffb036[_0x4ee2('0x37')]['sort']);_0x59e316['where']=qs['filters'](_[_0x4ee2('0x5c')](_0xffb036[_0x4ee2('0x37')],_0x3ba1cc[_0x4ee2('0x39')]));_0x59e316[_0x4ee2('0x41')][_0x4ee2('0x55')]=_0x1805b0['id'];if(_0xffb036[_0x4ee2('0x37')]['filter']){_0x59e316[_0x4ee2('0x41')]=_[_0x4ee2('0x49')](_0x59e316[_0x4ee2('0x41')],{'$or':_['map'](_0x59e316['attributes'],function(_0x1d104a){var _0x20f931={};_0x20f931[_0x1d104a]={'$like':'%'+_0xffb036[_0x4ee2('0x37')]['filter']+'%'};return _0x20f931;})});}_0x59e316=_[_0x4ee2('0x49')]({},_0x59e316,_0xffb036[_0x4ee2('0x4a')]);return db[_0x4ee2('0xa3')][_0x4ee2('0x24')]({'where':_0x59e316[_0x4ee2('0x41')]})['then'](function(_0x59eefe){_0x2a99f2['count']=_0x59eefe;if(_0xffb036[_0x4ee2('0x37')][_0x4ee2('0x44')]){_0x59e316[_0x4ee2('0x45')]=[{'model':db[_0x4ee2('0x7b')],'as':_0x4ee2('0xeb'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x4ee2('0x2c'),'fullname',_0x4ee2('0xec')],'required':![]},{'model':db[_0x4ee2('0xed')],'as':'Tags','attributes':['id',_0x4ee2('0x2c'),_0x4ee2('0xee')],'where':_0xffb036[_0x4ee2('0x37')][_0x4ee2('0xef')]?{'id':_0xffb036['query'][_0x4ee2('0xef')]}:undefined,'required':_0xffb036[_0x4ee2('0x37')][_0x4ee2('0xef')]?!![]:![]}];}return db[_0x4ee2('0xa3')][_0x4ee2('0x46')](_0x59e316);})[_0x4ee2('0x26')](function(_0x986929){_0x2a99f2['rows']=_0x986929;return _0x2a99f2;});}})['then'](respondWithFilteredResult(_0x4be1b7,_0x59e316))[_0x4ee2('0x1c')](handleError(_0x4be1b7,null));};function iftimePromise(_0x425319,_0x464d17){return respondWithRpcPromise(_0x4ee2('0xf0'),_0x4ee2('0xf1'),{'command':_0x464d17[_0x4ee2('0xf2')]?util['format'](_0x4ee2('0xf3'),_0x425319[_0x4ee2('0xf4')],_0x464d17[_0x4ee2('0xf2')]):util[_0x4ee2('0x9c')](_0x4ee2('0xf5'),_0x425319[_0x4ee2('0xf4')])},client9002)[_0x4ee2('0x26')](function(_0x572169){var _0x25433c=_0x572169&&_0x572169['indexOf'](_0x4ee2('0xf6'))>=0x0?!![]:![];logger[_0x4ee2('0x12')](_0x4ee2('0xf7'),_0x464d17['id'],_0x425319['id'],_0x425319[_0x4ee2('0xf4')],_0x25433c?_0x4ee2('0xf8'):'OFFLINE',_0x464d17['timezone']?_0x464d17[_0x4ee2('0xf2')]:_0x4ee2('0xf9'));return _0x25433c;})[_0x4ee2('0x1c')](function(_0x3f3b09){logger['error'](_0x4ee2('0xf7'),_0x464d17['id'],_0x425319['id'],_0x425319[_0x4ee2('0xf4')],util[_0x4ee2('0xfa')](_0x3f3b09,{'showHidden':![],'depth':null}),_0x464d17['timezone']?_0x464d17[_0x4ee2('0xf2')]:_0x4ee2('0xf9'));return![];});}exports[_0x4ee2('0xf1')]=function(_0x3e0189,_0x3e10b8){var _0x42ebb7=0x0;var _0x3da453=0x0;var _0x176f98=![];var _0x42d872;var _0x3ce758;return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x3e0189[_0x4ee2('0x53')]['id']},'include':[{'model':db[_0x4ee2('0xfb')],'as':_0x4ee2('0xfb'),'include':[{'model':db[_0x4ee2('0xfb')],'as':_0x4ee2('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x4ee2('0x26')](handleEntityNotFound(_0x3e10b8,null))['then'](function(_0x5d0e1b){if(_0x5d0e1b){_0x42d872=_0x5d0e1b;return _0x5d0e1b['getProactiveActions']({'raw':!![]});}})['then'](function(_0x4b7796){if(_0x42d872){if(_0x4b7796){_0x3ce758=_0x4b7796;}}return require(_0x4ee2('0x6a'))[_0x4ee2('0x6b')]();})[_0x4ee2('0x26')](function(_0x33c1bf){if(_0x33c1bf){_0x3da453=_0x33c1bf[_0x4ee2('0xfd')];_0x176f98=_0x33c1bf[_0x4ee2('0x6c')];}})[_0x4ee2('0x26')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x4ee2('0x26')](function(_0x2da13f){_0x42ebb7=_0x2da13f;if(_0x3da453&&_0x2da13f>_0x3da453){return db[_0x4ee2('0xfe')]['findOne']({'where':{'id':0x1}})[_0x4ee2('0x26')](function(_0x589046){if(_0x589046){_0x589046['increment'](_0x4ee2('0xff'));}});}})[_0x4ee2('0x26')](function(){if(_0x42d872[_0x4ee2('0xfb')]&&_0x42d872['Interval'][_0x4ee2('0xfc')]){var _0x202d22=[];for(var _0x5f18a0=0x0;_0x5f18a0<_0x42d872[_0x4ee2('0xfb')]['Intervals']['length'];_0x5f18a0++){var _0x2e74d3=_0x42d872[_0x4ee2('0xfb')][_0x4ee2('0xfc')][_0x5f18a0][_0x4ee2('0x27')]({'plain':!![]});_0x202d22[_0x4ee2('0x100')](iftimePromise(_0x2e74d3,_0x42d872));}return BPromise[_0x4ee2('0x101')](_0x202d22)['then'](function(_0x127be6){return _[_0x4ee2('0x102')](_0x127be6);});}else{return!![];}})['then'](function(_0xab588f){var _0x31f480=fs['readFileSync'](path[_0x4ee2('0x69')](config[_0x4ee2('0x6e')],_0x4ee2('0x103')),_0x4ee2('0xc2'));var _0x298f4a={'remote':_0x42d872[_0x4ee2('0x104')],'query':querystring[_0x4ee2('0x16')](_['merge'](_0x42d872[_0x4ee2('0x27')]({'plain':!![]}),{'customerIp':_0x3e0189[_0x4ee2('0x78')][_0x4ee2('0x95')]||_0x3e0189['headers'][_0x4ee2('0x105')]||_0x3e0189[_0x4ee2('0x106')][_0x4ee2('0x107')]||_0x3e0189['ip'],'referer':_0x3e0189[_0x4ee2('0x78')][_0x4ee2('0x9a')],'openedInteractions':_0x42ebb7,'maxInteractions':_0x3da453,'virtual':_0x176f98[_0x4ee2('0xfd')],'online':_0xab588f,'custom':_0x176f98}))[_0x4ee2('0x108')](/'/g,'\x5c\x27')};_0x3e10b8[_0x4ee2('0x2d')](ejs[_0x4ee2('0xc3')](Mustache[_0x4ee2('0xc3')](_0x31f480,_0x298f4a),{'proactiveActions':_0x3ce758,'alignment':_0x42d872['alignment'],'verticalAlignment':_0x42d872[_0x4ee2('0x109')],'div_color':_0x42d872[_0x4ee2('0xee')],'labelText':_0x42d872[_0x4ee2('0x10a')],'text_color':_0x42d872[_0x4ee2('0x10b')],'button_color':_0x42d872['color_button'],'background_color':_0x42d872[_0x4ee2('0x10c')],'hideWhenOffline':_0x42d872[_0x4ee2('0x10d')],'interval':_0x42d872['IntervalId']}));})[_0x4ee2('0x1c')](handleError(_0x3e10b8,null));};exports[_0x4ee2('0x10e')]=function(_0x242ba8,_0xf9574b){var _0x5af3be=_0x242ba8['params']['id'];var _0x33c93a=_0x242ba8[_0x4ee2('0x4c')];var _0x43e94c=0xc8;var _0x21273d=null;return db[_0x4ee2('0x10f')][_0x4ee2('0xcd')]({'isolationLevel':db[_0x4ee2('0x10f')][_0x4ee2('0x110')][_0x4ee2('0x111')]['READ_COMMITTED']},function(_0x38ad7b){return db[_0x4ee2('0x43')][_0x4ee2('0xd0')]({'where':{'id':_0x5af3be},'transaction':_0x38ad7b})[_0x4ee2('0x26')](function(_0x3664af){if(_0x3664af){return db['ChatApplication'][_0x4ee2('0x2a')]({'where':{'ChatWebsiteId':_0x5af3be},'transaction':_0x38ad7b})[_0x4ee2('0x26')](function(){var _0x123ca3=_[_0x4ee2('0x31')](_0x33c93a,function(_0x5d9fee){_0x5d9fee['ChatWebsiteId']=_0x5af3be;return _0x5d9fee;});return db['ChatApplication'][_0x4ee2('0xcf')](_0x123ca3,{'transaction':_0x38ad7b});});}else{_0x43e94c=0x194;_0x21273d=[];}});})[_0x4ee2('0x26')](function(){if(_0x43e94c!==0x194){return db[_0x4ee2('0x112')][_0x4ee2('0x113')]({'where':{'ChatWebsiteId':_0x5af3be},'order':_0x4ee2('0x8e')})['then'](function(_0x597b0d){_0x21273d=_0x597b0d;});}})[_0x4ee2('0x1c')](function(_0x42a88d){_0x43e94c=0x1f4;logger[_0x4ee2('0x17')](_0x42a88d[_0x4ee2('0x2b')]);if(_0x42a88d[_0x4ee2('0x2c')]){delete _0x42a88d['name'];}_0x21273d=_0x42a88d;})[_0x4ee2('0x114')](function(){if(_0x21273d===null){_0xf9574b['sendStatus'](_0x43e94c);}else{if(_0x43e94c===0x1f4){_0xf9574b[_0x4ee2('0x1e')](_0x43e94c)[_0x4ee2('0x2d')](_0x21273d);}else{_0xf9574b[_0x4ee2('0x1e')](_0x43e94c)[_0x4ee2('0x20')](_0x21273d);}}});};exports[_0x4ee2('0x115')]=function(_0x19a83d,_0x5dfc98){var _0x41fcc3={};var _0x1b5fb3={};var _0x3ac887;var _0x22a87e;return db[_0x4ee2('0x43')][_0x4ee2('0xd0')]({'where':{'id':_0x19a83d[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x5dfc98,null))['then'](function(_0x4718db){if(_0x4718db){_0x3ac887=_0x4718db;_0x1b5fb3['model']=_['keys'](db[_0x4ee2('0x112')][_0x4ee2('0x32')]);_0x1b5fb3[_0x4ee2('0x37')]=_['keys'](_0x19a83d['query']);_0x1b5fb3[_0x4ee2('0x39')]=_['intersection'](_0x1b5fb3[_0x4ee2('0x36')],_0x1b5fb3[_0x4ee2('0x37')]);_0x41fcc3[_0x4ee2('0x3b')]=_[_0x4ee2('0x3a')](_0x1b5fb3[_0x4ee2('0x36')],qs['fields'](_0x19a83d[_0x4ee2('0x37')]['fields']));_0x41fcc3[_0x4ee2('0x3b')]=_0x41fcc3[_0x4ee2('0x3b')][_0x4ee2('0x48')]?_0x41fcc3['attributes']:_0x1b5fb3[_0x4ee2('0x36')];_0x41fcc3['order']=qs[_0x4ee2('0x40')](_0x19a83d[_0x4ee2('0x37')][_0x4ee2('0x40')]);_0x41fcc3[_0x4ee2('0x41')]=qs[_0x4ee2('0x39')](_[_0x4ee2('0x5c')](_0x19a83d['query'],_0x1b5fb3[_0x4ee2('0x39')]));if(_0x19a83d['query']['filter']){_0x41fcc3[_0x4ee2('0x41')]=_['merge'](_0x41fcc3[_0x4ee2('0x41')],{'$or':_[_0x4ee2('0x31')](_0x41fcc3[_0x4ee2('0x3b')],function(_0x287ca3){var _0x26d57a={};_0x26d57a[_0x287ca3]={'$like':'%'+_0x19a83d[_0x4ee2('0x37')]['filter']+'%'};return _0x26d57a;})});}_0x41fcc3=_[_0x4ee2('0x49')]({},_0x41fcc3,_0x19a83d[_0x4ee2('0x4a')]);return _0x3ac887[_0x4ee2('0x115')](_0x41fcc3);}})[_0x4ee2('0x26')](function(_0x394f23){if(_0x394f23){_0x22a87e=_0x394f23[_0x4ee2('0x48')];if(!_0x19a83d['query'][_0x4ee2('0x3d')]('nolimit')){_0x41fcc3['limit']=qs['limit'](_0x19a83d['query'][_0x4ee2('0x23')]);_0x41fcc3['offset']=qs[_0x4ee2('0x21')](_0x19a83d[_0x4ee2('0x37')][_0x4ee2('0x21')]);}return _0x3ac887[_0x4ee2('0x115')](_0x41fcc3);}})['then'](function(_0x136864){if(_0x136864){return _0x136864?{'count':_0x22a87e,'rows':_0x136864}:null;}})[_0x4ee2('0x26')](respondWithResult(_0x5dfc98,null))[_0x4ee2('0x1c')](handleError(_0x5dfc98,null));};exports[_0x4ee2('0x116')]=function(_0x341c8b,_0x5814bd){return db[_0x4ee2('0x117')][_0x4ee2('0x51')]({'where':{'id':_0x341c8b[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x5814bd,null))[_0x4ee2('0x26')](function(_0x3eae02){if(_0x3eae02){return _0x3eae02[_0x4ee2('0x116')](_0x341c8b[_0x4ee2('0x4c')][_0x4ee2('0x58')],_[_0x4ee2('0xe9')](_0x341c8b['body'],[_0x4ee2('0x58'),'id'])||{});}})[_0x4ee2('0x26')](respondWithResult(_0x5814bd,null))[_0x4ee2('0x1c')](handleError(_0x5814bd,null));};exports['getProactiveActions']=function(_0xf7586f,_0x404160){var _0x3e7694={};var _0x2f6366={};var _0x363658;var _0x596d2c;return db[_0x4ee2('0x43')][_0x4ee2('0xd0')]({'where':{'id':_0xf7586f[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x404160,null))[_0x4ee2('0x26')](function(_0x460e3e){if(_0x460e3e){_0x363658=_0x460e3e;_0x2f6366[_0x4ee2('0x36')]=_[_0x4ee2('0x38')](db['ChatProactiveAction'][_0x4ee2('0x32')]);_0x2f6366[_0x4ee2('0x37')]=_[_0x4ee2('0x38')](_0xf7586f['query']);_0x2f6366[_0x4ee2('0x39')]=_[_0x4ee2('0x3a')](_0x2f6366['model'],_0x2f6366[_0x4ee2('0x37')]);_0x3e7694['attributes']=_['intersection'](_0x2f6366[_0x4ee2('0x36')],qs[_0x4ee2('0x3c')](_0xf7586f[_0x4ee2('0x37')]['fields']));_0x3e7694[_0x4ee2('0x3b')]=_0x3e7694['attributes'][_0x4ee2('0x48')]?_0x3e7694[_0x4ee2('0x3b')]:_0x2f6366[_0x4ee2('0x36')];_0x3e7694[_0x4ee2('0x3f')]=qs[_0x4ee2('0x40')](_0xf7586f['query'][_0x4ee2('0x40')]);_0x3e7694['where']=qs[_0x4ee2('0x39')](_[_0x4ee2('0x5c')](_0xf7586f['query'],_0x2f6366[_0x4ee2('0x39')]));if(_0xf7586f[_0x4ee2('0x37')][_0x4ee2('0x42')]){_0x3e7694[_0x4ee2('0x41')]=_['merge'](_0x3e7694[_0x4ee2('0x41')],{'$or':_[_0x4ee2('0x31')](_0x3e7694[_0x4ee2('0x3b')],function(_0x27ba4e){var _0x24f0b3={};_0x24f0b3[_0x27ba4e]={'$like':'%'+_0xf7586f[_0x4ee2('0x37')][_0x4ee2('0x42')]+'%'};return _0x24f0b3;})});}_0x3e7694=_[_0x4ee2('0x49')]({},_0x3e7694,_0xf7586f['options']);return _0x363658[_0x4ee2('0x118')](_0x3e7694);}})[_0x4ee2('0x26')](function(_0xce62f1){if(_0xce62f1){_0x596d2c=_0xce62f1[_0x4ee2('0x48')];if(!_0xf7586f[_0x4ee2('0x37')][_0x4ee2('0x3d')](_0x4ee2('0x3e'))){_0x3e7694['limit']=qs[_0x4ee2('0x23')](_0xf7586f['query'][_0x4ee2('0x23')]);_0x3e7694[_0x4ee2('0x21')]=qs[_0x4ee2('0x21')](_0xf7586f[_0x4ee2('0x37')][_0x4ee2('0x21')]);}return _0x363658[_0x4ee2('0x118')](_0x3e7694);}})[_0x4ee2('0x26')](function(_0x1fe01b){if(_0x1fe01b){return _0x1fe01b?{'count':_0x596d2c,'rows':_0x1fe01b}:null;}})[_0x4ee2('0x26')](respondWithResult(_0x404160,null))[_0x4ee2('0x1c')](handleError(_0x404160,null));};exports[_0x4ee2('0x119')]=function(_0x24c1fc,_0x1f386a){var _0x2d3950=_0x24c1fc[_0x4ee2('0x37')]['online']===_0x4ee2('0x11a')?'offlineForm':_0x4ee2('0x11b');return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'attributes':['id',_0x2d3950],'where':{'id':_0x24c1fc[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x1f386a,null))[_0x4ee2('0x26')](function(_0x43c585){if(_0x43c585){var _0x3590a3=_0x43c585[_0x2d3950];var _0xd98e1c=_0x3590a3&&_0x3590a3[_0x4ee2('0x11c')]?_0x3590a3[_0x4ee2('0x11c')]:[];_0x1f386a[_0x4ee2('0x2d')]({'fromKey':_[_0x4ee2('0x71')](_0x3590a3[_0x4ee2('0x11d')])?undefined:_0x3590a3[_0x4ee2('0x11d')],'count':_0xd98e1c[_0x4ee2('0x48')],'rows':_0xd98e1c});}})[_0x4ee2('0x1c')](handleError(_0x1f386a,null));};exports[_0x4ee2('0x11e')]=function(_0x2ac091,_0x4cab9c){var _0x3c3919={'raw':![],'where':{}};var _0xf134a5={};var _0x50bfd3={'count':0x0,'rows':[]};return db[_0x4ee2('0x43')][_0x4ee2('0xd0')]({'where':{'id':_0x2ac091['params']['id']}})['then'](handleEntityNotFound(_0x4cab9c,null))[_0x4ee2('0x26')](function(_0x8fb76a){if(_0x8fb76a){_0xf134a5[_0x4ee2('0x36')]=_[_0x4ee2('0x38')](db[_0x4ee2('0xc6')][_0x4ee2('0x32')]);_0xf134a5[_0x4ee2('0x37')]=_['keys'](_0x2ac091[_0x4ee2('0x37')]);_0xf134a5[_0x4ee2('0x39')]=_['intersection'](_0xf134a5[_0x4ee2('0x36')],_0xf134a5[_0x4ee2('0x37')]);_0x3c3919[_0x4ee2('0x3b')]=_[_0x4ee2('0x3a')](_0xf134a5['model'],qs['fields'](_0x2ac091['query'][_0x4ee2('0x3c')]));_0x3c3919[_0x4ee2('0x3b')]=_0x3c3919[_0x4ee2('0x3b')][_0x4ee2('0x48')]?_0x3c3919[_0x4ee2('0x3b')]:_0xf134a5[_0x4ee2('0x36')];if(!_0x2ac091[_0x4ee2('0x37')][_0x4ee2('0x3d')](_0x4ee2('0x3e'))){_0x3c3919[_0x4ee2('0x23')]=qs['limit'](_0x2ac091['query'][_0x4ee2('0x23')]);_0x3c3919[_0x4ee2('0x21')]=qs[_0x4ee2('0x21')](_0x2ac091[_0x4ee2('0x37')]['offset']);}_0x3c3919['order']=qs['sort'](_0x2ac091[_0x4ee2('0x37')]['sort']);_0x3c3919[_0x4ee2('0x41')]=qs['filters'](_[_0x4ee2('0x5c')](_0x2ac091[_0x4ee2('0x37')],_0xf134a5['filters']));_0x3c3919['where']['ChatWebsiteId']=_0x8fb76a['id'];if(_0x2ac091[_0x4ee2('0x37')][_0x4ee2('0x42')]){_0x3c3919['where']=_[_0x4ee2('0x49')](_0x3c3919[_0x4ee2('0x41')],{'$or':_[_0x4ee2('0x31')](_0x3c3919['attributes'],function(_0x1c3ffe){var _0x187790={};_0x187790[_0x1c3ffe]={'$like':'%'+_0x2ac091[_0x4ee2('0x37')][_0x4ee2('0x42')]+'%'};return _0x187790;})});}_0x3c3919=_[_0x4ee2('0x49')]({},_0x3c3919,_0x2ac091[_0x4ee2('0x4a')]);return db[_0x4ee2('0xc6')][_0x4ee2('0x24')]({'where':_0x3c3919[_0x4ee2('0x41')]})[_0x4ee2('0x26')](function(_0x3d3bb0){_0x50bfd3['count']=_0x3d3bb0;if(_0x2ac091[_0x4ee2('0x37')][_0x4ee2('0x44')]){_0x3c3919[_0x4ee2('0x45')]=[{'all':!![]}];}else{_0x3c3919[_0x4ee2('0x45')]=[{'model':db['CmContact'],'as':_0x4ee2('0xeb'),'required':![]},{'model':db[_0x4ee2('0xce')],'as':_0x4ee2('0x11f'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x3c3919);})[_0x4ee2('0x26')](function(_0x4a5fe1){_0x50bfd3['rows']=_0x4a5fe1;return _0x50bfd3;});}})[_0x4ee2('0x26')](respondWithFilteredResult(_0x4cab9c,_0x3c3919))[_0x4ee2('0x1c')](handleError(_0x4cab9c,null));};exports[_0x4ee2('0x120')]=function(_0x2e2d85,_0x3971aa){return db[_0x4ee2('0x43')][_0x4ee2('0x51')]({'where':{'id':_0x2e2d85[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x3971aa,null))[_0x4ee2('0x26')](function(_0x402f46){if(_0x402f46){return _0x402f46[_0x4ee2('0x120')](_0x2e2d85[_0x4ee2('0x4c')][_0x4ee2('0x58')],_[_0x4ee2('0xe9')](_0x2e2d85['body'],[_0x4ee2('0x58'),'id'])||{})[_0x4ee2('0xa7')](function(_0x1296ff){for(var _0xdfb870=0x0;_0xdfb870<_0x2e2d85[_0x4ee2('0x4c')]['ids'][_0x4ee2('0x48')];_0xdfb870+=0x1){socket[_0x4ee2('0x121')](_0x4ee2('0x122'),{'UserId':Number(_0x2e2d85[_0x4ee2('0x4c')][_0x4ee2('0x58')][_0xdfb870]),'ChatWebsiteId':Number(_0x2e2d85[_0x4ee2('0x53')]['id'])});}return _0x1296ff;});}})[_0x4ee2('0x26')](respondWithResult(_0x3971aa,null))[_0x4ee2('0x1c')](handleError(_0x3971aa,null));};exports[_0x4ee2('0x123')]=function(_0x1c331b,_0x257df4){return db['ChatWebsite'][_0x4ee2('0x51')]({'where':{'id':_0x1c331b[_0x4ee2('0x53')]['id']}})[_0x4ee2('0x26')](handleEntityNotFound(_0x257df4,null))['then'](function(_0x10acd8){if(_0x10acd8){return _0x10acd8[_0x4ee2('0x123')](_0x1c331b['query']['ids'])[_0x4ee2('0x26')](function(){if(_[_0x4ee2('0x124')](_0x1c331b['query'][_0x4ee2('0x58')])){for(var _0x3745f7=0x0;_0x3745f7<_0x1c331b[_0x4ee2('0x37')][_0x4ee2('0x58')][_0x4ee2('0x48')];_0x3745f7+=0x1){socket['emit'](_0x4ee2('0x125'),{'UserId':Number(_0x1c331b[_0x4ee2('0x37')][_0x4ee2('0x58')][_0x3745f7]),'ChatWebsiteId':Number(_0x1c331b[_0x4ee2('0x53')]['id'])});}}else{socket[_0x4ee2('0x121')](_0x4ee2('0x125'),{'UserId':Number(_0x1c331b[_0x4ee2('0x37')][_0x4ee2('0x58')]),'ChatWebsiteId':Number(_0x1c331b[_0x4ee2('0x53')]['id'])});}});}})[_0x4ee2('0x26')](respondWithStatusCode(_0x257df4,null))['catch'](handleError(_0x257df4,null));};exports[_0x4ee2('0x126')]=function(_0x1cdd2f,_0x3ca5db){var _0x44388f={};var _0x29ee5f={};var _0x3402ff;var _0x5c1eaa;return db[_0x4ee2('0x43')][_0x4ee2('0xd0')]({'where':{'id':_0x1cdd2f[_0x4ee2('0x53')]['id']}})['then'](handleEntityNotFound(_0x3ca5db,null))[_0x4ee2('0x26')](function(_0x4ed452){if(_0x4ed452){_0x3402ff=_0x4ed452;_0x29ee5f[_0x4ee2('0x36')]=_[_0x4ee2('0x38')](db[_0x4ee2('0xaf')][_0x4ee2('0x32')]);_0x29ee5f[_0x4ee2('0x37')]=_[_0x4ee2('0x38')](_0x1cdd2f['query']);_0x29ee5f['filters']=_[_0x4ee2('0x3a')](_0x29ee5f[_0x4ee2('0x36')],_0x29ee5f[_0x4ee2('0x37')]);_0x44388f['attributes']=_[_0x4ee2('0x3a')](_0x29ee5f['model'],qs[_0x4ee2('0x3c')](_0x1cdd2f['query']['fields']));_0x44388f[_0x4ee2('0x3b')]=_0x44388f[_0x4ee2('0x3b')][_0x4ee2('0x48')]?_0x44388f[_0x4ee2('0x3b')]:_0x29ee5f[_0x4ee2('0x36')];_0x44388f['order']=qs[_0x4ee2('0x40')](_0x1cdd2f[_0x4ee2('0x37')][_0x4ee2('0x40')]);_0x44388f['where']=qs[_0x4ee2('0x39')](_[_0x4ee2('0x5c')](_0x1cdd2f[_0x4ee2('0x37')],_0x29ee5f[_0x4ee2('0x39')]));if(_0x1cdd2f['query'][_0x4ee2('0x42')]){_0x44388f['where']=_['merge'](_0x44388f[_0x4ee2('0x41')],{'$or':_[_0x4ee2('0x31')](_0x44388f['attributes'],function(_0x4ee525){var _0x26b469={};_0x26b469[_0x4ee525]={'$like':'%'+_0x1cdd2f['query']['filter']+'%'};return _0x26b469;})});}_0x44388f=_[_0x4ee2('0x49')]({},_0x44388f,_0x1cdd2f[_0x4ee2('0x4a')]);return _0x3402ff[_0x4ee2('0x126')](_0x44388f);}})[_0x4ee2('0x26')](function(_0x349f94){if(_0x349f94){_0x5c1eaa=_0x349f94[_0x4ee2('0x48')];if(!_0x1cdd2f[_0x4ee2('0x37')][_0x4ee2('0x3d')](_0x4ee2('0x3e'))){_0x44388f[_0x4ee2('0x23')]=qs['limit'](_0x1cdd2f[_0x4ee2('0x37')]['limit']);_0x44388f[_0x4ee2('0x21')]=qs[_0x4ee2('0x21')](_0x1cdd2f[_0x4ee2('0x37')][_0x4ee2('0x21')]);}return _0x3402ff[_0x4ee2('0x126')](_0x44388f);}})[_0x4ee2('0x26')](function(_0x3c95a4){if(_0x3c95a4){return _0x3c95a4?{'count':_0x5c1eaa,'rows':_0x3c95a4}:null;}})[_0x4ee2('0x26')](respondWithResult(_0x3ca5db,null))[_0x4ee2('0x1c')](handleError(_0x3ca5db,null));}; \ No newline at end of file +var _0x12cc=['addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','../../config/license/util','getLicense','join','server/files/images/logos/','root','download','agentAvatar','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','setUA','headers','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','ListId','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','vendor','stringify','ChatInteraction','threadId','externalUrl','interaction','spread','firstName','created','autoclose','close','unmanaged','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','files','updatedAt','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','forwardOffline','service','host','port','secure','auth','pass','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','internal','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','custom','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','alignment','verticalAlignment','labelText','textColor','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','Attachments','findAll','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','util','path','ejs','fs-extra','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','type','options','includeAll','include','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','describe','Disposition','getDispositions','findOne','hasOwnProperty','pick','ChatWebsiteId','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers'];(function(_0x10f78d,_0x16760c){var _0x264298=function(_0x476e67){while(--_0x476e67){_0x10f78d['push'](_0x10f78d['shift']());}};_0x264298(++_0x16760c);}(_0x12cc,0xc2));var _0xc12c=function(_0x31a15b,_0x5b0cca){_0x31a15b=_0x31a15b-0x0;var _0x5925a4=_0x12cc[_0x31a15b];return _0x5925a4;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xc12c('0x0'));var util=require(_0xc12c('0x1'));var path=require(_0xc12c('0x2'));var ejs=require(_0xc12c('0x3'));var fs=require('fs');var fs_extra=require(_0xc12c('0x4'));var _=require('lodash');var querystring=require('querystring');var Redis=require(_0xc12c('0x5'));var qs=require(_0xc12c('0x6'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xc12c('0x7'))['db'];config[_0xc12c('0x8')]=_[_0xc12c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc12c('0xa'))(new Redis(config[_0xc12c('0x8')]));require(_0xc12c('0xb'))['register'](socket);var htmlToText=require(_0xc12c('0xc'));var jayson=require(_0xc12c('0xd'));var client=jayson[_0xc12c('0xe')]['http']({'port':0x232c});var client9002=jayson[_0xc12c('0xe')][_0xc12c('0xf')]({'port':0x232a});var client9003=jayson[_0xc12c('0xe')][_0xc12c('0xf')]({'port':0x232b});var client9001=jayson[_0xc12c('0xe')][_0xc12c('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x5f474d,_0x18dd8b,_0x103ea6,_0x126a25){return new BPromise(function(_0x54aa3e,_0x57bbf4){var _0x3e526e=_0x126a25||client;return _0x3e526e['request'](_0x5f474d,_0x103ea6)[_0xc12c('0x10')](function(_0x1a7627){logger['info'](_0xc12c('0x11'),_0x18dd8b,'request\x20sent');logger[_0xc12c('0x12')](_0xc12c('0x13'),_0x18dd8b,'request\x20sent',JSON['stringify'](_0x1a7627));if(_0x1a7627[_0xc12c('0x14')]){if(_0x1a7627[_0xc12c('0x14')]['code']===0x1f4){logger[_0xc12c('0x14')](_0xc12c('0x11'),_0x18dd8b,_0x1a7627[_0xc12c('0x14')][_0xc12c('0x15')]);return _0x57bbf4(_0x1a7627[_0xc12c('0x14')]['message']);}logger[_0xc12c('0x14')](_0xc12c('0x11'),_0x18dd8b,_0x1a7627[_0xc12c('0x14')]['message']);return _0x54aa3e(_0x1a7627[_0xc12c('0x14')][_0xc12c('0x15')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x18dd8b,'request\x20sent');_0x54aa3e(_0x1a7627[_0xc12c('0x16')][_0xc12c('0x15')]);}})[_0xc12c('0x17')](function(_0x2c718d){logger[_0xc12c('0x14')](_0xc12c('0x11'),_0x18dd8b,_0x2c718d);_0x57bbf4(_0x2c718d);});});}function respondWithStatusCode(_0x2b13db,_0x5f19ea){_0x5f19ea=_0x5f19ea||0xcc;return function(_0x4518a9){if(_0x4518a9){return _0x2b13db[_0xc12c('0x18')](_0x5f19ea);}return _0x2b13db[_0xc12c('0x19')](_0x5f19ea)[_0xc12c('0x1a')]();};}function respondWithResult(_0x41e5f7,_0x423bbd){_0x423bbd=_0x423bbd||0xc8;return function(_0x8e4d35){if(_0x8e4d35){return _0x41e5f7[_0xc12c('0x19')](_0x423bbd)[_0xc12c('0x1b')](_0x8e4d35);}};}function respondWithFilteredResult(_0x42d01c,_0x6552e7){return function(_0x8acdfc){if(_0x8acdfc){var _0xe5cee4=typeof _0x6552e7[_0xc12c('0x1c')]===_0xc12c('0x1d')&&typeof _0x6552e7['limit']==='undefined';var _0x148373=_0x8acdfc[_0xc12c('0x1e')];var _0x5b2e7e=_0xe5cee4?0x0:_0x6552e7[_0xc12c('0x1c')];var _0x39a976=_0xe5cee4?_0x8acdfc[_0xc12c('0x1e')]:_0x6552e7[_0xc12c('0x1c')]+_0x6552e7['limit'];var _0x9b77d6;if(_0x39a976>=_0x148373){_0x39a976=_0x148373;_0x9b77d6=0xc8;}else{_0x9b77d6=0xce;}_0x42d01c[_0xc12c('0x19')](_0x9b77d6);return _0x42d01c[_0xc12c('0x1f')](_0xc12c('0x20'),_0x5b2e7e+'-'+_0x39a976+'/'+_0x148373)['json'](_0x8acdfc);}return null;};}function saveUpdates(_0x57a566){return function(_0x51e763){if(_0x51e763){return _0x51e763[_0xc12c('0x21')](_0x57a566)[_0xc12c('0x10')](function(_0x8919a2){return _0x8919a2;});}return null;};}function removeEntity(_0x214d5e){return function(_0x550fc6){if(_0x550fc6){return _0x550fc6[_0xc12c('0x22')]()[_0xc12c('0x10')](function(){var _0x697b1f=_0x550fc6[_0xc12c('0x23')]({'plain':!![]});var _0x5e9aaf=_0xc12c('0x24');return db['UserProfileResource'][_0xc12c('0x22')]({'where':{'type':_0x5e9aaf,'resourceId':_0x697b1f['id']}})[_0xc12c('0x10')](function(){return _0x550fc6;});})[_0xc12c('0x10')](function(){_0x214d5e['status'](0xcc)[_0xc12c('0x1a')]();});}};}function handleEntityNotFound(_0x2d1ddb){return function(_0x14efa2){if(!_0x14efa2){_0x2d1ddb['sendStatus'](0x194);}return _0x14efa2;};}function handleError(_0x1109e1,_0x2852ef){_0x2852ef=_0x2852ef||0x1f4;return function(_0x4a1c9f){logger[_0xc12c('0x14')](_0x4a1c9f[_0xc12c('0x25')]);if(_0x4a1c9f['name']){delete _0x4a1c9f[_0xc12c('0x26')];}_0x1109e1['status'](_0x2852ef)['send'](_0x4a1c9f);};}exports[_0xc12c('0x27')]=function(_0x552711,_0x4ec490){var _0x491cf6={'include':[{'model':db[_0xc12c('0x28')],'as':_0xc12c('0x29')}]},_0x1598a3={},_0x2cfe41={'count':0x0,'rows':[]};var _0x42be6f=_[_0xc12c('0x2a')](db[_0xc12c('0x2b')][_0xc12c('0x2c')],function(_0x52ad79){return{'name':_0x52ad79[_0xc12c('0x2d')],'type':_0x52ad79['type'][_0xc12c('0x2e')]};});_0x1598a3['model']=_['map'](_0x42be6f,_0xc12c('0x26'));_0x1598a3[_0xc12c('0x2f')]=_[_0xc12c('0x30')](_0x552711[_0xc12c('0x2f')]);_0x1598a3[_0xc12c('0x31')]=_[_0xc12c('0x32')](_0x1598a3[_0xc12c('0x33')],_0x1598a3[_0xc12c('0x2f')]);_0x491cf6['attributes']=_[_0xc12c('0x32')](_0x1598a3['model'],qs[_0xc12c('0x34')](_0x552711[_0xc12c('0x2f')][_0xc12c('0x34')]));_0x491cf6[_0xc12c('0x35')]=_0x491cf6[_0xc12c('0x35')][_0xc12c('0x36')]?_0x491cf6[_0xc12c('0x35')]:_0x1598a3[_0xc12c('0x33')];if(!_0x552711['query']['hasOwnProperty'](_0xc12c('0x37'))){_0x491cf6[_0xc12c('0x38')]=qs[_0xc12c('0x38')](_0x552711[_0xc12c('0x2f')][_0xc12c('0x38')]);_0x491cf6['offset']=qs[_0xc12c('0x1c')](_0x552711['query'][_0xc12c('0x1c')]);}_0x491cf6[_0xc12c('0x39')]=qs[_0xc12c('0x3a')](_0x552711['query'][_0xc12c('0x3a')]);_0x491cf6[_0xc12c('0x3b')]=qs[_0xc12c('0x31')](_['pick'](_0x552711[_0xc12c('0x2f')],_0x1598a3[_0xc12c('0x31')]),_0x42be6f);if(_0x552711[_0xc12c('0x2f')][_0xc12c('0x3c')]){_0x491cf6['where']=_[_0xc12c('0x3d')](_0x491cf6[_0xc12c('0x3b')],{'$or':_[_0xc12c('0x2a')](_0x42be6f,function(_0x530a0a){if(_0x530a0a[_0xc12c('0x3e')]!=='VIRTUAL'){var _0x2cb7bd={};_0x2cb7bd[_0x530a0a[_0xc12c('0x26')]]={'$like':'%'+_0x552711[_0xc12c('0x2f')]['filter']+'%'};return _0x2cb7bd;}})});}_0x491cf6=_[_0xc12c('0x3d')]({},_0x491cf6,_0x552711[_0xc12c('0x3f')]);var _0x164add={'where':_0x491cf6[_0xc12c('0x3b')]};return db[_0xc12c('0x2b')][_0xc12c('0x1e')](_0x164add)['then'](function(_0x3adbfc){_0x2cfe41[_0xc12c('0x1e')]=_0x3adbfc;if(_0x552711[_0xc12c('0x2f')][_0xc12c('0x40')]){_0x491cf6[_0xc12c('0x41')]=[{'all':!![]}];}return db[_0xc12c('0x2b')]['findAll'](_0x491cf6);})[_0xc12c('0x10')](function(_0x50068b){_0x2cfe41[_0xc12c('0x42')]=_0x50068b;return _0x2cfe41;})[_0xc12c('0x10')](respondWithFilteredResult(_0x4ec490,_0x491cf6))[_0xc12c('0x17')](handleError(_0x4ec490,null));};exports[_0xc12c('0x43')]=function(_0x43a277,_0x515f60){var _0x1e4430={'raw':![],'where':{'id':_0x43a277[_0xc12c('0x44')]['id']},'include':[{'model':db[_0xc12c('0x28')],'as':'mandatoryDispositionPause'}]},_0x2af517={};_0x2af517[_0xc12c('0x33')]=_[_0xc12c('0x30')](db[_0xc12c('0x2b')][_0xc12c('0x2c')]);_0x2af517[_0xc12c('0x2f')]=_[_0xc12c('0x30')](_0x43a277[_0xc12c('0x2f')]);_0x2af517[_0xc12c('0x31')]=_['intersection'](_0x2af517[_0xc12c('0x33')],_0x2af517[_0xc12c('0x2f')]);_0x1e4430['attributes']=_[_0xc12c('0x32')](_0x2af517[_0xc12c('0x33')],qs[_0xc12c('0x34')](_0x43a277[_0xc12c('0x2f')][_0xc12c('0x34')]));_0x1e4430[_0xc12c('0x35')]=_0x1e4430[_0xc12c('0x35')][_0xc12c('0x36')]?_0x1e4430[_0xc12c('0x35')]:_0x2af517['model'];if(_0x43a277[_0xc12c('0x2f')][_0xc12c('0x40')]){_0x1e4430[_0xc12c('0x41')]=[{'all':!![]}];}_0x1e4430=_[_0xc12c('0x3d')]({},_0x1e4430,_0x43a277[_0xc12c('0x3f')]);return db[_0xc12c('0x2b')]['find'](_0x1e4430)[_0xc12c('0x10')](handleEntityNotFound(_0x515f60,null))[_0xc12c('0x10')](respondWithResult(_0x515f60,null))[_0xc12c('0x17')](handleError(_0x515f60,null));};exports[_0xc12c('0x45')]=function(_0x23bf9c,_0x9cc6dc){return db[_0xc12c('0x2b')][_0xc12c('0x45')](_0x23bf9c[_0xc12c('0x46')],{})[_0xc12c('0x10')](function(_0x2ab80c){var _0x1d0bfa=_0x23bf9c[_0xc12c('0x47')][_0xc12c('0x23')]({'plain':!![]});if(!_0x1d0bfa)throw new Error(_0xc12c('0x48'));if(_0x1d0bfa['role']==='user'){var _0x517b61=_0x2ab80c[_0xc12c('0x23')]({'plain':!![]});var _0x17c5f4='ChatWebsites';return db[_0xc12c('0x49')][_0xc12c('0x4a')]({'where':{'name':_0x17c5f4,'userProfileId':_0x1d0bfa['userProfileId']},'raw':!![]})[_0xc12c('0x10')](function(_0x3c0c70){if(_0x3c0c70&&_0x3c0c70[_0xc12c('0x4b')]===0x0){return db['UserProfileResource'][_0xc12c('0x45')]({'name':_0x517b61[_0xc12c('0x26')],'resourceId':_0x517b61['id'],'type':_0x3c0c70['name'],'sectionId':_0x3c0c70['id']},{})[_0xc12c('0x10')](function(){return _0x2ab80c;});}else{return _0x2ab80c;}})[_0xc12c('0x17')](function(_0x4ff65e){logger[_0xc12c('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ff65e);throw _0x4ff65e;});}return _0x2ab80c;})[_0xc12c('0x10')](respondWithResult(_0x9cc6dc,0xc9))[_0xc12c('0x17')](handleError(_0x9cc6dc,null));};exports[_0xc12c('0x21')]=function(_0x52a300,_0x3f7e42){if(_0x52a300[_0xc12c('0x46')]['id']){delete _0x52a300[_0xc12c('0x46')]['id'];}return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x52a300[_0xc12c('0x44')]['id']},'include':[{'model':db[_0xc12c('0x28')],'as':'mandatoryDispositionPause'}]})[_0xc12c('0x10')](handleEntityNotFound(_0x3f7e42,null))[_0xc12c('0x10')](saveUpdates(_0x52a300['body'],null))[_0xc12c('0x10')](respondWithResult(_0x3f7e42,null))[_0xc12c('0x17')](handleError(_0x3f7e42,null));};exports[_0xc12c('0x22')]=function(_0x50daf5,_0x4cf000){return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x50daf5[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x4cf000,null))[_0xc12c('0x10')](removeEntity(_0x4cf000,null))[_0xc12c('0x17')](handleError(_0x4cf000,null));};exports[_0xc12c('0x4c')]=function(_0x1667a9,_0x42dc72){return db[_0xc12c('0x2b')][_0xc12c('0x4c')]()[_0xc12c('0x10')](respondWithResult(_0x42dc72,null))[_0xc12c('0x17')](handleError(_0x42dc72,null));};exports['addDisposition']=function(_0x5f1beb,_0x13c642){if(_0x5f1beb['body']['id']){delete _0x5f1beb[_0xc12c('0x46')]['id'];}return db['ChatWebsite'][_0xc12c('0x4a')]({'where':{'id':_0x5f1beb['params']['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x13c642,null))['then'](function(_0x41c520){if(_0x41c520){_0x5f1beb[_0xc12c('0x46')]['ChatWebsiteId']=_0x41c520['id'];return db[_0xc12c('0x4d')]['create'](_0x5f1beb['body']);}})[_0xc12c('0x10')](respondWithResult(_0x13c642,null))[_0xc12c('0x17')](handleError(_0x13c642,null));};exports[_0xc12c('0x4e')]=function(_0x16f367,_0x25aae4){var _0x2af18e={'raw':![],'where':{}};var _0x572c71={};var _0x2d4b74={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc12c('0x4f')]({'where':{'id':_0x16f367['params']['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x25aae4,null))[_0xc12c('0x10')](function(_0x29f630){if(_0x29f630){_0x572c71[_0xc12c('0x33')]=_[_0xc12c('0x30')](db['Disposition'][_0xc12c('0x2c')]);_0x572c71['query']=_['keys'](_0x16f367['query']);_0x572c71[_0xc12c('0x31')]=_[_0xc12c('0x32')](_0x572c71[_0xc12c('0x33')],_0x572c71['query']);_0x2af18e[_0xc12c('0x35')]=_['intersection'](_0x572c71['model'],qs[_0xc12c('0x34')](_0x16f367['query'][_0xc12c('0x34')]));_0x2af18e[_0xc12c('0x35')]=_0x2af18e[_0xc12c('0x35')][_0xc12c('0x36')]?_0x2af18e['attributes']:_0x572c71['model'];if(!_0x16f367[_0xc12c('0x2f')][_0xc12c('0x50')](_0xc12c('0x37'))){_0x2af18e[_0xc12c('0x38')]=qs['limit'](_0x16f367[_0xc12c('0x2f')]['limit']);_0x2af18e[_0xc12c('0x1c')]=qs[_0xc12c('0x1c')](_0x16f367['query']['offset']);}_0x2af18e[_0xc12c('0x39')]=qs[_0xc12c('0x3a')](_0x16f367['query'][_0xc12c('0x3a')]);_0x2af18e['where']=qs['filters'](_[_0xc12c('0x51')](_0x16f367[_0xc12c('0x2f')],_0x572c71['filters']));_0x2af18e[_0xc12c('0x3b')][_0xc12c('0x52')]=_0x29f630['id'];if(_0x16f367[_0xc12c('0x2f')][_0xc12c('0x3c')]){_0x2af18e['where']=_[_0xc12c('0x3d')](_0x2af18e['where'],{'$or':_[_0xc12c('0x2a')](_0x2af18e['attributes'],function(_0xdca7b3){var _0x58e149={};_0x58e149[_0xdca7b3]={'$like':'%'+_0x16f367[_0xc12c('0x2f')][_0xc12c('0x3c')]+'%'};return _0x58e149;})});}_0x2af18e=_[_0xc12c('0x3d')]({},_0x2af18e,_0x16f367['options']);return db[_0xc12c('0x4d')][_0xc12c('0x1e')]({'where':_0x2af18e['where']})[_0xc12c('0x10')](function(_0xf81594){_0x2d4b74[_0xc12c('0x1e')]=_0xf81594;if(_0x16f367[_0xc12c('0x2f')]['includeAll']){_0x2af18e[_0xc12c('0x41')]=[{'all':!![]}];}return db[_0xc12c('0x4d')]['findAll'](_0x2af18e);})['then'](function(_0x154f20){_0x2d4b74[_0xc12c('0x42')]=_0x154f20;return _0x2d4b74;});}})['then'](respondWithFilteredResult(_0x25aae4,_0x2af18e))[_0xc12c('0x17')](handleError(_0x25aae4,null));};exports[_0xc12c('0x53')]=function(_0xe18233,_0xc00e0f){return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0xe18233[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0xc00e0f,null))[_0xc12c('0x10')](function(_0x4d935c){if(_0x4d935c){return _0x4d935c['removeDispositions'](_0xe18233['query'][_0xc12c('0x54')]);}})[_0xc12c('0x10')](respondWithStatusCode(_0xc00e0f,null))[_0xc12c('0x17')](handleError(_0xc00e0f,null));};exports['addAnswer']=function(_0x42edec,_0xf703ab){if(_0x42edec['body']['id']){delete _0x42edec[_0xc12c('0x46')]['id'];}return db[_0xc12c('0x2b')]['find']({'where':{'id':_0x42edec['params']['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0xf703ab,null))[_0xc12c('0x10')](function(_0x2ee298){if(_0x2ee298){_0x42edec[_0xc12c('0x46')][_0xc12c('0x52')]=_0x2ee298['id'];return db['CannedAnswer']['create'](_0x42edec['body']);}})[_0xc12c('0x10')](respondWithResult(_0xf703ab,null))[_0xc12c('0x17')](handleError(_0xf703ab,null));};exports[_0xc12c('0x55')]=function(_0x1939b6,_0x548fc2){var _0x2f0ef3={'raw':![],'where':{}};var _0x19df73={};var _0x1a418b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc12c('0x4f')]({'where':{'id':_0x1939b6['params']['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x548fc2,null))[_0xc12c('0x10')](function(_0x5c314e){if(_0x5c314e){_0x19df73[_0xc12c('0x33')]=_[_0xc12c('0x30')](db['CannedAnswer'][_0xc12c('0x2c')]);_0x19df73[_0xc12c('0x2f')]=_[_0xc12c('0x30')](_0x1939b6['query']);_0x19df73[_0xc12c('0x31')]=_['intersection'](_0x19df73[_0xc12c('0x33')],_0x19df73[_0xc12c('0x2f')]);_0x2f0ef3['attributes']=_['intersection'](_0x19df73['model'],qs['fields'](_0x1939b6[_0xc12c('0x2f')][_0xc12c('0x34')]));_0x2f0ef3[_0xc12c('0x35')]=_0x2f0ef3['attributes'][_0xc12c('0x36')]?_0x2f0ef3[_0xc12c('0x35')]:_0x19df73['model'];if(!_0x1939b6[_0xc12c('0x2f')][_0xc12c('0x50')](_0xc12c('0x37'))){_0x2f0ef3[_0xc12c('0x38')]=qs[_0xc12c('0x38')](_0x1939b6['query'][_0xc12c('0x38')]);_0x2f0ef3[_0xc12c('0x1c')]=qs[_0xc12c('0x1c')](_0x1939b6['query'][_0xc12c('0x1c')]);}_0x2f0ef3[_0xc12c('0x39')]=qs[_0xc12c('0x3a')](_0x1939b6[_0xc12c('0x2f')]['sort']);_0x2f0ef3['where']=qs[_0xc12c('0x31')](_[_0xc12c('0x51')](_0x1939b6[_0xc12c('0x2f')],_0x19df73['filters']));_0x2f0ef3['where'][_0xc12c('0x52')]=_0x5c314e['id'];if(_0x1939b6[_0xc12c('0x2f')]['filter']){_0x2f0ef3[_0xc12c('0x3b')]=_[_0xc12c('0x3d')](_0x2f0ef3['where'],{'$or':_[_0xc12c('0x2a')](_0x2f0ef3['attributes'],function(_0x3618f7){var _0x6551a1={};_0x6551a1[_0x3618f7]={'$like':'%'+_0x1939b6[_0xc12c('0x2f')][_0xc12c('0x3c')]+'%'};return _0x6551a1;})});}_0x2f0ef3=_[_0xc12c('0x3d')]({},_0x2f0ef3,_0x1939b6[_0xc12c('0x3f')]);return db[_0xc12c('0x56')][_0xc12c('0x1e')]({'where':_0x2f0ef3[_0xc12c('0x3b')]})['then'](function(_0x26e180){_0x1a418b[_0xc12c('0x1e')]=_0x26e180;if(_0x1939b6[_0xc12c('0x2f')][_0xc12c('0x40')]){_0x2f0ef3[_0xc12c('0x41')]=[{'all':!![]}];}return db[_0xc12c('0x56')]['findAll'](_0x2f0ef3);})['then'](function(_0x448e87){_0x1a418b[_0xc12c('0x42')]=_0x448e87;return _0x1a418b;});}})['then'](respondWithFilteredResult(_0x548fc2,_0x2f0ef3))['catch'](handleError(_0x548fc2,null));};exports[_0xc12c('0x57')]=function(_0x817af6,_0x1fe8dc){return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x817af6[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x1fe8dc,null))['then'](function(_0x57f464){if(_0x57f464){return _0x57f464['removeAnswers'](_0x817af6[_0xc12c('0x2f')][_0xc12c('0x54')]);}})[_0xc12c('0x10')](respondWithStatusCode(_0x1fe8dc,null))[_0xc12c('0x17')](handleError(_0x1fe8dc,null));};exports[_0xc12c('0x58')]=function(_0x514035,_0x5f2d5d){_0x514035[_0xc12c('0x46')][_0xc12c('0x59')]=_0x514035[_0xc12c('0x5a')][_0xc12c('0x5b')];return db[_0xc12c('0x2b')]['find']({'where':{'id':_0x514035[_0xc12c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f2d5d,null))['then'](saveUpdates(_0x514035[_0xc12c('0x46')],null))['then'](respondWithResult(_0x5f2d5d,null))[_0xc12c('0x17')](handleError(_0x5f2d5d,null));};exports[_0xc12c('0x5c')]=function(_0x4c2fc1,_0x2ae25f){_0x4c2fc1[_0xc12c('0x46')]['agentAvatar']=_0x4c2fc1['file'][_0xc12c('0x5b')];return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x4c2fc1[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x2ae25f,null))[_0xc12c('0x10')](saveUpdates(_0x4c2fc1['body'],null))[_0xc12c('0x10')](respondWithResult(_0x2ae25f,null))[_0xc12c('0x17')](handleError(_0x2ae25f,null));};exports[_0xc12c('0x5d')]=function(_0x22b7d2,_0x4481e7){_0x22b7d2[_0xc12c('0x46')][_0xc12c('0x5e')]=_0x22b7d2[_0xc12c('0x5a')][_0xc12c('0x5b')];return db['ChatWebsite'][_0xc12c('0x4a')]({'where':{'id':_0x22b7d2[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x4481e7,null))[_0xc12c('0x10')](saveUpdates(_0x22b7d2[_0xc12c('0x46')],null))[_0xc12c('0x10')](respondWithResult(_0x4481e7,null))[_0xc12c('0x17')](handleError(_0x4481e7,null));};exports[_0xc12c('0x5f')]=function(_0x265209,_0x46a137){_0x265209[_0xc12c('0x46')][_0xc12c('0x60')]=_0x265209[_0xc12c('0x5a')][_0xc12c('0x5b')];return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x265209[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x46a137,null))['then'](saveUpdates(_0x265209['body'],null))[_0xc12c('0x10')](respondWithResult(_0x46a137,null))[_0xc12c('0x17')](handleError(_0x46a137,null));};exports['getLogo']=function(_0xedb756,_0x300599){var _0x4a2514=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x255d36={'where':{'id':_0xedb756[_0xc12c('0x44')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0xfdd7a7=![];return require(_0xc12c('0x61'))[_0xc12c('0x62')]()['then'](function(_0x2a40a8){if(_0x2a40a8){_0xfdd7a7=_0x2a40a8['custom'];}})['then'](function(){return db['ChatWebsite'][_0xc12c('0x4a')](_0x255d36);})[_0xc12c('0x10')](handleEntityNotFound(_0x300599,null))[_0xc12c('0x10')](function(_0x5ec231){if(_0x5ec231){if(!_['isNil'](_0x5ec231[_0xc12c('0x59')])){if(fs['existsSync'](path[_0xc12c('0x63')](config['root'],_0xc12c('0x64'),_0x5ec231[_0xc12c('0x59')]))&&_0xfdd7a7){_0x4a2514=path['join'](config[_0xc12c('0x65')],_0xc12c('0x64'),_0x5ec231[_0xc12c('0x59')]);}}return _0x300599[_0xc12c('0x66')](_0x4a2514);}})['catch'](handleError(_0x300599,null));};exports['getAvatar']=function(_0x2857c8,_0x1ae54c){var _0x25d7d7=path[_0xc12c('0x63')](config[_0xc12c('0x65')],'server/files/images/avatars/default_avatar.png');var _0x3a886b={'where':{'id':_0x2857c8['params']['id']},'attributes':['id',_0xc12c('0x67')],'raw':!![]};return db['ChatWebsite'][_0xc12c('0x4a')](_0x3a886b)[_0xc12c('0x10')](handleEntityNotFound(_0x1ae54c,null))[_0xc12c('0x10')](function(_0x338ed0){if(_0x338ed0){if(!_[_0xc12c('0x68')](_0x338ed0['agentAvatar'])){if(fs[_0xc12c('0x69')](path[_0xc12c('0x63')](config['root'],'server/files/images/avatars/',_0x338ed0[_0xc12c('0x67')]))){_0x25d7d7=path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0x6a'),_0x338ed0[_0xc12c('0x67')]);}}return _0x1ae54c[_0xc12c('0x66')](_0x25d7d7);}})[_0xc12c('0x17')](handleError(_0x1ae54c,null));};exports[_0xc12c('0x6b')]=function(_0x25de8d,_0x21a4ed){var _0x3f3951=path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0x6c'));var _0x329f00={'where':{'id':_0x25de8d[_0xc12c('0x44')]['id']},'attributes':['id',_0xc12c('0x5e'),_0xc12c('0x6d')],'raw':!![]};return db[_0xc12c('0x2b')]['find'](_0x329f00)[_0xc12c('0x10')](handleEntityNotFound(_0x21a4ed,null))[_0xc12c('0x10')](function(_0x41233e){if(_0x41233e){if(!_[_0xc12c('0x68')](_0x41233e[_0xc12c('0x5e')])){if(fs['existsSync'](path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0x6a'),_0x41233e[_0xc12c('0x5e')]))&&_0x41233e['showCustomerAvatar']){_0x3f3951=path['join'](config[_0xc12c('0x65')],_0xc12c('0x6a'),_0x41233e['customerAvatar']);}}return _0x21a4ed[_0xc12c('0x66')](_0x3f3951);}})[_0xc12c('0x17')](handleError(_0x21a4ed,null));};exports[_0xc12c('0x6e')]=function(_0x5d04e1,_0x3314f2){var _0x2847e6=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0x9e3d77={'where':{'id':_0x5d04e1[_0xc12c('0x44')]['id']},'attributes':['id',_0xc12c('0x60')],'raw':!![]};return db[_0xc12c('0x2b')][_0xc12c('0x4a')](_0x9e3d77)['then'](handleEntityNotFound(_0x3314f2,null))[_0xc12c('0x10')](function(_0xb74c29){if(_0xb74c29){if(!_[_0xc12c('0x68')](_0xb74c29[_0xc12c('0x60')])){if(fs[_0xc12c('0x69')](path[_0xc12c('0x63')](config['root'],_0xc12c('0x6a'),_0xb74c29[_0xc12c('0x60')]))){_0x2847e6=path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0x6a'),_0xb74c29['systemAvatar']);}}return _0x3314f2[_0xc12c('0x66')](_0x2847e6);}})[_0xc12c('0x17')](handleError(_0x3314f2,null));};exports[_0xc12c('0x6f')]=function(_0x45976e,_0x1fbaba){var _0x5dfd43=require('user-agent-parser');var _0x54e153=new _0x5dfd43();var _0x3ba022=_0x54e153[_0xc12c('0x70')](_0x45976e[_0xc12c('0x71')]['user-agent'])[_0xc12c('0x72')]();var _0x284c20={'body':_0x45976e[_0xc12c('0x46')],'channel':_0xc12c('0x73')};var _0x55a3cd=[];var _0x4c19d2=[];var _0x325e4d={};var _0x3f9ba7=![];return db[_0xc12c('0x74')][_0xc12c('0x4c')]()[_0xc12c('0x10')](function(_0x1cd0ba){if(!_0x1cd0ba){throw new db[(_0xc12c('0x75'))]['ValidationError'](_0xc12c('0x76'));}_0x55a3cd=_[_0xc12c('0x77')](_[_0xc12c('0x30')](_0x1cd0ba),[_0xc12c('0x78'),'updatedAt']);_0x4c19d2=_['difference'](_[_0xc12c('0x30')](_0x1cd0ba),[_0xc12c('0x78'),'updatedAt',_0xc12c('0x79'),'ListId']);if(_0x45976e[_0xc12c('0x46')]['id']){delete _0x45976e['body']['id'];}if(_[_0xc12c('0x68')](_0x45976e[_0xc12c('0x46')]['from'])){throw new db[(_0xc12c('0x75'))][(_0xc12c('0x7a'))](_0xc12c('0x7b'));}if(_['isNil'](_0x45976e['body']['body'])||_0x45976e[_0xc12c('0x46')][_0xc12c('0x46')]===''){throw new db[(_0xc12c('0x75'))][(_0xc12c('0x7a'))](_0xc12c('0x7c'));}if(_[_0xc12c('0x68')](_0x45976e['body'][_0xc12c('0x7d')])){throw new db[(_0xc12c('0x75'))]['ValidationError'](_0xc12c('0x7e')+_0x4c19d2);}if(!_[_0xc12c('0x7f')](_0x4c19d2,_0x45976e[_0xc12c('0x46')][_0xc12c('0x7d')])){throw new db['Sequelize'][(_0xc12c('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c19d2);}_0x325e4d[_0x45976e[_0xc12c('0x46')][_0xc12c('0x7d')]]=_0x45976e['body'][_0xc12c('0x80')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x45976e[_0xc12c('0x44')]['id']},'include':[{'model':db[_0xc12c('0x81')],'as':_0xc12c('0x82'),'include':[{'model':db[_0xc12c('0x74')],'as':_0xc12c('0x83'),'where':_0x325e4d,'limit':0x1,'order':[['updatedAt',_0xc12c('0x84')]]}]},{'model':db[_0xc12c('0x85')],'as':_0xc12c('0x86')}]});})['then'](handleEntityNotFound(_0x1fbaba,null))[_0xc12c('0x10')](function(_0x4a2586){if(_0x4a2586&&_0x4a2586[_0xc12c('0x82')]){_0x284c20[_0xc12c('0x87')]=_0x4a2586;_0x284c20[_0xc12c('0x88')]=_0x4a2586[_0xc12c('0x86')];_0x284c20['list']=_0x4a2586[_0xc12c('0x82')];_0x284c20[_0xc12c('0x88')]=_[_0xc12c('0x89')](_0x284c20[_0xc12c('0x88')],[_0xc12c('0x8a')],[_0xc12c('0x8b')]);if(_0x284c20[_0xc12c('0x87')][_0xc12c('0x86')]){delete _0x284c20[_0xc12c('0x87')][_0xc12c('0x86')];}if(_0x284c20[_0xc12c('0x87')]['List']&&_0x284c20['account']['List'][_0xc12c('0x83')]['length']){return _0x284c20[_0xc12c('0x87')][_0xc12c('0x82')][_0xc12c('0x83')][0x0];}var _0x304b24=_[_0xc12c('0x9')](_0x45976e['body'],{'firstName':_0x45976e[_0xc12c('0x46')][_0xc12c('0x80')],'ListId':_0x4a2586[_0xc12c('0x8c')]});_0x304b24[_0x45976e[_0xc12c('0x46')]['mapKey']]=_0x45976e['body'][_0xc12c('0x80')];return db[_0xc12c('0x74')]['create'](_0x304b24,{'fields':_0x55a3cd,'raw':!![]});}})[_0xc12c('0x10')](handleEntityNotFound(_0x1fbaba,null))['then'](function(_0x372cad){_0x284c20[_0xc12c('0x8d')]=_0x372cad;var _0x141706=_0x45976e[_0xc12c('0x46')][_0xc12c('0x8e')];if(_0x45976e[_0xc12c('0x71')][_0xc12c('0x8f')]){_0x141706=_0x45976e['headers'][_0xc12c('0x8f')];}else if(_0x45976e[_0xc12c('0x71')]['x-forwarded-for']){_0x141706=_[_0xc12c('0x90')](_0x45976e[_0xc12c('0x71')][_0xc12c('0x91')][_0xc12c('0x92')](','));}if(_0x372cad){var _0x1a0c88={'ContactId':_0x372cad['id'],'ChatWebsiteId':_0x45976e[_0xc12c('0x44')]['id'],'from':(_0x372cad['firstName']||'')+'\x20'+(_0x372cad[_0xc12c('0x93')]||''),'customerIp':_0x141706,'customerPort':_0x45976e[_0xc12c('0x71')][_0xc12c('0x94')]?_0x45976e[_0xc12c('0x71')][_0xc12c('0x94')]:null,'referer':_0x45976e['body'][_0xc12c('0x95')],'browserName':_0x3ba022[_0xc12c('0x96')][_0xc12c('0x26')]&&_0x3ba022['browser']['version']?util['format'](_0xc12c('0x97'),_0x3ba022[_0xc12c('0x96')]['name'],_0x3ba022[_0xc12c('0x96')][_0xc12c('0x98')]):_0xc12c('0x99'),'browserVersion':_0x3ba022[_0xc12c('0x96')][_0xc12c('0x98')]||_0xc12c('0x99'),'osName':util[_0xc12c('0x9a')](_0xc12c('0x97'),_0x3ba022['os'][_0xc12c('0x26')],_0x3ba022['os'][_0xc12c('0x98')]),'osVersion':_0x3ba022['os'][_0xc12c('0x98')],'deviceModel':_0x3ba022['device'][_0xc12c('0x33')]&&_0x3ba022['device']['vendor']?util[_0xc12c('0x9a')]('%s\x20%s\x20%s',_0x3ba022[_0xc12c('0x9b')]['model'],_0x3ba022[_0xc12c('0x9b')][_0xc12c('0x9c')],_0x3ba022[_0xc12c('0x9b')][_0xc12c('0x3e')]):null,'deviceVendor':_0x3ba022['device'][_0xc12c('0x9c')],'deviceType':_0x3ba022[_0xc12c('0x9b')][_0xc12c('0x3e')],'formData':JSON[_0xc12c('0x9d')](_0x45976e[_0xc12c('0x46')])};var _0x5a26cd={'ChatWebsiteId':_0x45976e[_0xc12c('0x44')]['id'],'closed':![]};if(_0x45976e['body']['threadId']){_0x5a26cd['threadId']=_0x45976e[_0xc12c('0x46')]['threadId'];return db[_0xc12c('0x9e')][_0xc12c('0x4a')]({'where':_0x5a26cd})['then'](function(_0x2d4f2b){if(_0x2d4f2b){return[_0x2d4f2b,![]];}_0x1a0c88[_0xc12c('0x9f')]=_0x45976e[_0xc12c('0x46')][_0xc12c('0x9f')];_0x1a0c88['externalUrl']=_0x45976e['body'][_0xc12c('0xa0')];return db['ChatInteraction']['create'](_0x1a0c88)[_0xc12c('0x10')](function(_0x32f9f5){return[_0x32f9f5,!![]];});});}_0x5a26cd['ContactId']=_0x372cad['id'];if(_0x45976e[_0xc12c('0x46')]['interaction']&&_0x45976e[_0xc12c('0x46')][_0xc12c('0xa1')]['id']){_0x5a26cd['id']=_0x45976e[_0xc12c('0x46')][_0xc12c('0xa1')]['id'];return db[_0xc12c('0x9e')][_0xc12c('0x4a')]({'where':_0x5a26cd})[_0xc12c('0x10')](function(_0x4ae676){if(_0x4ae676){return[_0x4ae676,![]];}return db[_0xc12c('0x9e')][_0xc12c('0x45')](_0x1a0c88)[_0xc12c('0x10')](function(_0x1cf182){return[_0x1cf182,!![]];});});}return db[_0xc12c('0x9e')][_0xc12c('0x45')](_0x1a0c88)[_0xc12c('0x10')](function(_0x193bf1){return[_0x193bf1,!![]];});}})[_0xc12c('0xa2')](function(_0x796bec,_0x1e64d7){if(_0x796bec){_0x3f9ba7=_0x1e64d7;if(!_0x1e64d7){var _0x61c1e1={'from':(_0x284c20[_0xc12c('0x8d')][_0xc12c('0xa3')]||'')+'\x20'+(_0x284c20['contact'][_0xc12c('0x93')]||'')};if(_0x45976e[_0xc12c('0x46')][_0xc12c('0x9f')]&&_0x45976e[_0xc12c('0x46')]['messageId']&&_0x45976e['body'][_0xc12c('0x9f')]!=_0x45976e[_0xc12c('0x46')]['messageId']){_0x61c1e1[_0xc12c('0x9f')]=_0x45976e['body']['messageId'];}return _0x796bec[_0xc12c('0x21')](_0x61c1e1);}else{return _0x796bec;}}})['then'](function(_0x24a6b2){_0x284c20['interaction']=_0x24a6b2[_0xc12c('0x23')]({'plain':!![]});_0x284c20[_0xc12c('0xa1')]['created']=_0x3f9ba7;if(_0x284c20[_0xc12c('0xa1')][_0xc12c('0xa4')]){if(_0x284c20[_0xc12c('0x87')][_0xc12c('0xa5')]){_0x284c20['applications']['push']({'id':0x0,'priority':_0x284c20[_0xc12c('0x88')]['length']+0x1,'app':_0xc12c('0xa6'),'appdata':_0xc12c('0xa7'),'interval':'*,*,*,*'});}}return db[_0xc12c('0xa8')][_0xc12c('0x45')]({'body':_0x45976e[_0xc12c('0x46')][_0xc12c('0x46')],'ChatWebsiteId':_0x45976e['params']['id'],'ChatInteractionId':_0x24a6b2['id'],'direction':'in','ContactId':_0x284c20[_0xc12c('0x8d')]['id'],'AttachmentId':_0x45976e[_0xc12c('0x46')]['AttachmentId']});})[_0xc12c('0x10')](function(_0x473ecf){_0x284c20[_0xc12c('0x15')]=_0x473ecf;if(_0x284c20['interaction'][_0xc12c('0xa9')]){return db[_0xc12c('0xaa')][_0xc12c('0x4a')]({'attributes':['id','name'],'where':{'id':_0x284c20['interaction']['UserId']}})[_0xc12c('0x10')](function(_0x51ff6a){if(_0x51ff6a){_0x284c20[_0xc12c('0x88')][_0xc12c('0xab')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x51ff6a[_0xc12c('0x26')]+','+(_0x284c20['account'][_0xc12c('0xac')]||0xa),'interval':_0xc12c('0xad')});_0x284c20[_0xc12c('0xae')]=!![];}return respondWithRpcPromise(_0xc12c('0xaf'),_0xc12c('0xb0'),_0x284c20);});}return respondWithRpcPromise('Start','startRouting',_0x284c20);})[_0xc12c('0x10')](function(_0xea83e7){respondWithRpcPromise('EventManager','EventManager',{'event':_0xc12c('0x6f'),'message':_0xea83e7},client9002);return _0xea83e7;})[_0xc12c('0x10')](respondWithResult(_0x1fbaba,null))[_0xc12c('0x17')](handleError(_0x1fbaba,null));};exports['offline']=function(_0x3a11aa,_0xecde15){var _0x269e6e,_0x4ac794,_0x492584;var _0x3fae34=[];var _0x5647d6={};var _0x571bd4=_0x3a11aa[_0xc12c('0xb1')]||[];var _0x1037d9=[];var _0x47bab9;return db['CmContact'][_0xc12c('0x4c')]()[_0xc12c('0x10')](function(_0x404203){if(!_0x404203){throw new db[(_0xc12c('0x75'))][(_0xc12c('0x7a'))]('no\x20available\x20attributes');}_0x3fae34=_[_0xc12c('0x77')](_[_0xc12c('0x30')](_0x404203),[_0xc12c('0x78'),_0xc12c('0xb2'),_0xc12c('0x79'),'ListId']);if(_0x3a11aa[_0xc12c('0x46')]['id']){delete _0x3a11aa['body']['id'];}if(_[_0xc12c('0x68')](_0x3a11aa[_0xc12c('0x46')][_0xc12c('0x80')])){throw _0xecde15[_0xc12c('0x19')](0x1f4)['send'](new db[(_0xc12c('0x75'))][(_0xc12c('0x7a'))](_0xc12c('0x7b')));}if(_['isNil'](_0x3a11aa[_0xc12c('0x46')][_0xc12c('0x46')])||_0x3a11aa[_0xc12c('0x46')][_0xc12c('0x46')]===''){throw _0xecde15['status'](0x1f4)[_0xc12c('0xb3')](new db[(_0xc12c('0x75'))][(_0xc12c('0x7a'))](_0xc12c('0x7c')));}if(_['isNil'](_0x3a11aa[_0xc12c('0x46')][_0xc12c('0xb4')])){throw _0xecde15[_0xc12c('0x19')](0x1f4)[_0xc12c('0xb3')](new db['Sequelize'][(_0xc12c('0x7a'))](_0xc12c('0xb5')+_0x3fae34));}if(!_[_0xc12c('0x7f')](_0x3fae34,_0x3a11aa[_0xc12c('0x46')]['mapKeyOffline'])){throw _0xecde15['status'](0x1f4)[_0xc12c('0xb3')](new db[(_0xc12c('0x75'))][(_0xc12c('0x7a'))](_0xc12c('0xb6')+_0x3fae34));}_0x5647d6[_0x3a11aa[_0xc12c('0x46')][_0xc12c('0xb4')]]=_0x3a11aa[_0xc12c('0x46')][_0xc12c('0x80')];})[_0xc12c('0x10')](function(){return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x3a11aa[_0xc12c('0x44')]['id']},'include':[{'model':db[_0xc12c('0x81')],'as':_0xc12c('0x82')},{'model':db[_0xc12c('0xb7')],'as':_0xc12c('0xb7')}]});})[_0xc12c('0x10')](handleEntityNotFound(_0xecde15,null))[_0xc12c('0x10')](function(_0x42074c){if(_0x42074c&&_0x42074c[_0xc12c('0x82')]){_0x4ac794=_0x42074c;var _0x1f50db=_[_0xc12c('0x9')](_0x3a11aa[_0xc12c('0x46')],{'firstName':_0x3a11aa['body'][_0xc12c('0x80')],'phone':_0x3a11aa['body']['from'],'ListId':_0x42074c[_0xc12c('0x8c')]});_0x1f50db[_0x3a11aa[_0xc12c('0x46')][_0xc12c('0xb4')]]=_0x3a11aa[_0xc12c('0x46')][_0xc12c('0x80')];return db[_0xc12c('0x74')][_0xc12c('0xb8')]({'where':_0x5647d6,'defaults':_0x1f50db});}})[_0xc12c('0xa2')](function(_0x5eb70d){if(_0x5eb70d){_0x492584=_0x5eb70d;var _0x25690a=fs[_0xc12c('0xb9')](path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0xba')),'utf8');var _0x113b33=ejs[_0xc12c('0xbb')](_0x25690a,{'body':_[_0xc12c('0xbc')](_0x3a11aa[_0xc12c('0x46')][_0xc12c('0x46')]),'bodyTitle':_0x4ac794[_0xc12c('0xbd')]});return db[_0xc12c('0xbe')][_0xc12c('0x45')]({'body':_0x113b33,'plainBody':htmlToText['fromString'](_0x113b33),'ContactId':_0x5eb70d['id'],'ChatWebsiteId':_0x4ac794['id']});}})[_0xc12c('0x10')](function(_0x92c40b){_0x47bab9=_0x92c40b;if(_0x571bd4['length']){var _0x14faa0=_0x571bd4[_0xc12c('0x2a')](function(_0x20eee0){return{'name':_0x20eee0[_0xc12c('0xbf')],'basename':_0x20eee0[_0xc12c('0x5b')],'type':_0x20eee0[_0xc12c('0xc0')],'ChatOfflineMessageId':_0x92c40b['id']};});_0x1037d9=_0x14faa0['map'](_0x583e15=>{var _0x20205f={'filename':_0x583e15['name'],'path':path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0xc1'),_0xc12c('0xb1'),_0xc12c('0xc2'),'offline-chat',_0x583e15[_0xc12c('0xc3')])};return _0x20205f;});if(!_0x4ac794[_0xc12c('0xc4')]){return db[_0xc12c('0xc5')][_0xc12c('0xc6')](function(_0x11318c){return db['Attachment'][_0xc12c('0xc7')](_0x14faa0,{'transaction':_0x11318c});});}}})[_0xc12c('0x10')](function(){if(_0x47bab9){_0x269e6e=_0x47bab9;return db[_0xc12c('0xb7')][_0xc12c('0x4f')]({'where':{'active':!![]},'include':[{'model':db[_0xc12c('0xc8')],'as':_0xc12c('0xc9'),'raw':!![]}]});}})[_0xc12c('0x10')](function(_0x7c78e){if(_0x7c78e&&_0x7c78e[_0xc12c('0xc9')]&&_0x4ac794[_0xc12c('0xca')]&&_0x4ac794['forwardOfflineAddress']){var _0x3baa5e={'tls':{'rejectUnauthorized':![]}};if(_0x7c78e[_0xc12c('0xc9')][_0xc12c('0xcb')]){_0x3baa5e['service']=_0x7c78e[_0xc12c('0xc9')]['service'];}else{_0x3baa5e[_0xc12c('0xcc')]=_0x7c78e[_0xc12c('0xc9')]['host'];_0x3baa5e[_0xc12c('0xcd')]=_0x7c78e[_0xc12c('0xc9')]['port'];_0x3baa5e[_0xc12c('0xce')]=_0x7c78e[_0xc12c('0xc9')][_0xc12c('0xce')];}if(_0x7c78e[_0xc12c('0xc9')]['authentication']){_0x3baa5e[_0xc12c('0xcf')]={'user':_0x7c78e[_0xc12c('0xc9')][_0xc12c('0x47')],'pass':_0x7c78e[_0xc12c('0xc9')][_0xc12c('0xd0')]};}return respondWithRpcPromise(_0xc12c('0xd1'),_0xc12c('0xd2'),{'account':_0x3baa5e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x7c78e['name'],_0x7c78e[_0xc12c('0xd3')]||_0x7c78e['Smtp']['user']),'to':_0x4ac794[_0xc12c('0xd4')],'subject':_0x4ac794[_0xc12c('0xd5')],'html':_0x269e6e[_0xc12c('0x46')],'attachments':_0x1037d9}},client9003)[_0xc12c('0x10')](function(){return _0x269e6e;})[_0xc12c('0x17')](function(_0x4dd743){console[_0xc12c('0x14')](_0x4dd743);});}})[_0xc12c('0x10')](function(){if(_0x4ac794&&_0x4ac794['openNewInteraction']&&_0x4ac794[_0xc12c('0xd6')]){var _0x3308d7=[];if(_0x571bd4[_0xc12c('0x36')]){_0x3308d7=_0x571bd4[_0xc12c('0x2a')](function(_0x38c9d4){return{'name':_0x38c9d4['originalname'],'basename':_0x38c9d4['filename'],'type':_0x38c9d4[_0xc12c('0xc0')],'ChatOfflineMessageId':_0x47bab9['id']};});}var _0x20ecc7;if(!_[_0xc12c('0x68')](_0x4ac794[_0xc12c('0xd7')])){var _0x281153=_[_0xc12c('0x2a')](_0x3a11aa['body'],function(_0x47e8fe){return _0x47e8fe;});var _0xa3bcce=_['toPairsIn'](_0x281153)[0x0];var _0x2f70f6=_[_0xc12c('0xd8')](_0xa3bcce,function(_0xa96fa1){return _0xa96fa1;});_0x20ecc7=_0x2f70f6[0x1][_0x4ac794[_0xc12c('0xd7')]];}var _0x443f99={'from':_0x492584[_0xc12c('0xd3')],'firstName':_0x492584['firstName'],'lastName':_0x492584[_0xc12c('0x93')],'mapKey':'email','message':{'from':_0x492584[_0xc12c('0xd3')],'to':_0x4ac794[_0xc12c('0xb7')]['email'],'cc':'','subject':_[_0xc12c('0x68')](_0x20ecc7)?_0x4ac794[_0xc12c('0xd5')]:_0x20ecc7,'messageId':'','sentAt':new Date(),'attach':_0x3308d7[_0xc12c('0x36')],'attachments':_0x3308d7,'originChannel':_0xc12c('0xd9'),'ChatWebsiteId':_0x4ac794['id'],'ChatOfflineMessageId':_0x269e6e['id'],'originTo':_0x4ac794[_0xc12c('0xb7')][_0xc12c('0xd3')]},'body':_0x269e6e[_0xc12c('0x46')]};var _0x350525={'account':{'id':_0x4ac794[_0xc12c('0xd6')]},'body':_0x443f99,'log':_0xc12c('0xda')};return respondWithRpcPromise(_0xc12c('0xda'),_0xc12c('0xdb'),_0x350525,client9001)['then'](function(){return _0x269e6e;})[_0xc12c('0x17')](function(_0x52f36a){console[_0xc12c('0x14')](_0x52f36a);});}return;})[_0xc12c('0x10')](function(){if(_0x269e6e){return _0x269e6e;}})[_0xc12c('0x10')](respondWithResult(_0xecde15,null))[_0xc12c('0x17')](function(_0x240cda){console[_0xc12c('0x14')](_0xc12c('0x17'),_0x240cda);for(var _0x3a31d0 of _0x571bd4){var _0x99f88c=path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0xc1'),_0xc12c('0xb1'),_0xc12c('0xc2'),_0xc12c('0xdc'),_0x3a31d0[_0xc12c('0x5b')]);fs_extra[_0xc12c('0xdd')](_0x99f88c)['catch'](function(_0x2c642b){console['error'](_0xc12c('0xde'),_0x99f88c,_0x2c642b);});}});};exports[_0xc12c('0xdf')]=function(_0x58d1b8,_0x3da722){return db[_0xc12c('0x9e')][_0xc12c('0x4a')]({'where':{'id':_0x58d1b8[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x3da722,null))[_0xc12c('0x10')](function(_0x1fd859){if(_0x1fd859){return _0x1fd859[_0xc12c('0xdf')](_0x58d1b8[_0xc12c('0x46')][_0xc12c('0x54')],_[_0xc12c('0xe0')](_0x58d1b8[_0xc12c('0x46')],[_0xc12c('0x54'),'id'])||{});}})['then'](respondWithResult(_0x3da722,null))['catch'](handleError(_0x3da722,null));};exports['getInteractions']=function(_0x2209c5,_0x5668d8){var _0x1f3a20={'raw':![],'where':{}};var _0xae9dcb={};var _0x29ea47={'count':0x0,'rows':[]};return db[_0xc12c('0x2b')][_0xc12c('0x4f')]({'where':{'id':_0x2209c5[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x5668d8,null))[_0xc12c('0x10')](function(_0x4c67a1){if(_0x4c67a1){_0xae9dcb[_0xc12c('0x33')]=_[_0xc12c('0x30')](db['ChatInteraction'][_0xc12c('0x2c')]);_0xae9dcb[_0xc12c('0x2f')]=_[_0xc12c('0x30')](_0x2209c5[_0xc12c('0x2f')]);_0xae9dcb['filters']=_[_0xc12c('0x32')](_0xae9dcb['model'],_0xae9dcb['query']);_0x1f3a20[_0xc12c('0x35')]=_[_0xc12c('0x32')](_0xae9dcb[_0xc12c('0x33')],qs['fields'](_0x2209c5['query'][_0xc12c('0x34')]));_0x1f3a20['attributes']=_0x1f3a20[_0xc12c('0x35')][_0xc12c('0x36')]?_0x1f3a20[_0xc12c('0x35')]:_0xae9dcb[_0xc12c('0x33')];if(!_0x2209c5[_0xc12c('0x2f')][_0xc12c('0x50')](_0xc12c('0x37'))){_0x1f3a20[_0xc12c('0x38')]=qs[_0xc12c('0x38')](_0x2209c5[_0xc12c('0x2f')][_0xc12c('0x38')]);_0x1f3a20[_0xc12c('0x1c')]=qs[_0xc12c('0x1c')](_0x2209c5[_0xc12c('0x2f')][_0xc12c('0x1c')]);}_0x1f3a20[_0xc12c('0x39')]=qs[_0xc12c('0x3a')](_0x2209c5[_0xc12c('0x2f')][_0xc12c('0x3a')]);_0x1f3a20[_0xc12c('0x3b')]=qs[_0xc12c('0x31')](_[_0xc12c('0x51')](_0x2209c5[_0xc12c('0x2f')],_0xae9dcb['filters']));_0x1f3a20[_0xc12c('0x3b')]['ChatWebsiteId']=_0x4c67a1['id'];if(_0x2209c5[_0xc12c('0x2f')][_0xc12c('0x3c')]){_0x1f3a20[_0xc12c('0x3b')]=_['merge'](_0x1f3a20[_0xc12c('0x3b')],{'$or':_['map'](_0x1f3a20[_0xc12c('0x35')],function(_0x5a9b92){var _0xcdfd2e={};_0xcdfd2e[_0x5a9b92]={'$like':'%'+_0x2209c5[_0xc12c('0x2f')]['filter']+'%'};return _0xcdfd2e;})});}_0x1f3a20=_[_0xc12c('0x3d')]({},_0x1f3a20,_0x2209c5[_0xc12c('0x3f')]);return db['ChatInteraction'][_0xc12c('0x1e')]({'where':_0x1f3a20[_0xc12c('0x3b')]})[_0xc12c('0x10')](function(_0x1f85a8){_0x29ea47['count']=_0x1f85a8;if(_0x2209c5[_0xc12c('0x2f')][_0xc12c('0x40')]){_0x1f3a20[_0xc12c('0x41')]=[{'model':db[_0xc12c('0x74')],'as':_0xc12c('0xe1'),'required':![]},{'model':db[_0xc12c('0xaa')],'as':'Owner','attributes':[_0xc12c('0x26'),'fullname',_0xc12c('0xe2')],'required':![]},{'model':db['Tag'],'as':_0xc12c('0xe3'),'attributes':['id',_0xc12c('0x26'),_0xc12c('0xe4')],'where':_0x2209c5[_0xc12c('0x2f')]['tag']?{'id':_0x2209c5[_0xc12c('0x2f')][_0xc12c('0xe5')]}:undefined,'required':_0x2209c5[_0xc12c('0x2f')][_0xc12c('0xe5')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x1f3a20);})['then'](function(_0x41d994){_0x29ea47[_0xc12c('0x42')]=_0x41d994;return _0x29ea47;});}})['then'](respondWithFilteredResult(_0x5668d8,_0x1f3a20))[_0xc12c('0x17')](handleError(_0x5668d8,null));};function iftimePromise(_0x436dbe,_0x46fd3b){return respondWithRpcPromise('Command',_0xc12c('0xe6'),{'command':_0x46fd3b[_0xc12c('0xe7')]?util[_0xc12c('0x9a')]('iftime\x20%s,%s',_0x436dbe[_0xc12c('0xe8')],_0x46fd3b[_0xc12c('0xe7')]):util['format'](_0xc12c('0xe9'),_0x436dbe[_0xc12c('0xe8')])},client9002)['then'](function(_0x11d85d){var _0x1a0905=_0x11d85d&&_0x11d85d[_0xc12c('0xea')](_0xc12c('0xeb'))>=0x0?!![]:![];logger[_0xc12c('0xec')](_0xc12c('0xed'),_0x46fd3b['id'],_0x436dbe['id'],_0x436dbe[_0xc12c('0xe8')],_0x1a0905?_0xc12c('0xee'):_0xc12c('0xef'),_0x46fd3b[_0xc12c('0xe7')]?_0x46fd3b[_0xc12c('0xe7')]:_0xc12c('0xf0'));return _0x1a0905;})[_0xc12c('0x17')](function(_0x5d3234){logger[_0xc12c('0x14')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x46fd3b['id'],_0x436dbe['id'],_0x436dbe[_0xc12c('0xe8')],util['inspect'](_0x5d3234,{'showHidden':![],'depth':null}),_0x46fd3b[_0xc12c('0xe7')]?_0x46fd3b[_0xc12c('0xe7')]:_0xc12c('0xf0'));return![];});}exports[_0xc12c('0xe6')]=function(_0x551598,_0x9dfbd){var _0x433897=0x0;var _0x48e668=0x0;var _0x1d6b47=![];var _0x17650f;var _0x1f3534;return db['ChatWebsite']['find']({'where':{'id':_0x551598[_0xc12c('0x44')]['id']},'include':[{'model':db[_0xc12c('0xf1')],'as':_0xc12c('0xf1'),'include':[{'model':db[_0xc12c('0xf1')],'as':_0xc12c('0xf2'),'attributes':['id',_0xc12c('0xe8')],'raw':!![]}]}]})[_0xc12c('0x10')](handleEntityNotFound(_0x9dfbd,null))[_0xc12c('0x10')](function(_0x1a3e2f){if(_0x1a3e2f){_0x17650f=_0x1a3e2f;return _0x1a3e2f[_0xc12c('0xf3')]({'raw':!![]});}})['then'](function(_0x10842f){if(_0x17650f){if(_0x10842f){_0x1f3534=_0x10842f;}}return require(_0xc12c('0x61'))[_0xc12c('0x62')]();})['then'](function(_0x91ebe4){if(_0x91ebe4){_0x48e668=_0x91ebe4['virtual'];_0x1d6b47=_0x91ebe4[_0xc12c('0xf4')];}})[_0xc12c('0x10')](function(){return db['ChatInteraction'][_0xc12c('0x1e')]({'where':{'closed':![]}});})[_0xc12c('0x10')](function(_0x210e4c){_0x433897=_0x210e4c;if(_0x48e668&&_0x210e4c>_0x48e668){return db['License']['findOne']({'where':{'id':0x1}})[_0xc12c('0x10')](function(_0x280bc6){if(_0x280bc6){_0x280bc6[_0xc12c('0xf5')](_0xc12c('0xf6'));}});}})[_0xc12c('0x10')](function(){if(_0x17650f[_0xc12c('0xf1')]&&_0x17650f[_0xc12c('0xf1')]['Intervals']){var _0x2d12af=[];for(var _0x14c48d=0x0;_0x14c48d<_0x17650f[_0xc12c('0xf1')]['Intervals'][_0xc12c('0x36')];_0x14c48d++){var _0x56075e=_0x17650f[_0xc12c('0xf1')][_0xc12c('0xf2')][_0x14c48d][_0xc12c('0x23')]({'plain':!![]});_0x2d12af['push'](iftimePromise(_0x56075e,_0x17650f));}return BPromise[_0xc12c('0xf7')](_0x2d12af)[_0xc12c('0x10')](function(_0x44cecd){return _[_0xc12c('0xf8')](_0x44cecd);});}else{return!![];}})[_0xc12c('0x10')](function(_0x311432){var _0x46f54a=fs[_0xc12c('0xb9')](path[_0xc12c('0x63')](config[_0xc12c('0x65')],_0xc12c('0xf9')),'utf8');var _0x2ae8b0={'remote':_0x17650f[_0xc12c('0xfa')],'query':querystring[_0xc12c('0x9d')](_[_0xc12c('0x3d')](_0x17650f[_0xc12c('0x23')]({'plain':!![]}),{'customerIp':_0x551598[_0xc12c('0x71')][_0xc12c('0x91')]||_0x551598[_0xc12c('0x71')][_0xc12c('0xfb')]||_0x551598[_0xc12c('0xfc')]['remoteAddress']||_0x551598['ip'],'referer':_0x551598[_0xc12c('0x71')][_0xc12c('0x95')],'openedInteractions':_0x433897,'maxInteractions':_0x48e668,'virtual':_0x1d6b47['virtual'],'online':_0x311432,'custom':_0x1d6b47}))['replace'](/'/g,'\x5c\x27')};_0x9dfbd[_0xc12c('0xb3')](ejs['render'](Mustache['render'](_0x46f54a,_0x2ae8b0),{'proactiveActions':_0x1f3534,'alignment':_0x17650f[_0xc12c('0xfd')],'verticalAlignment':_0x17650f[_0xc12c('0xfe')],'div_color':_0x17650f[_0xc12c('0xe4')],'labelText':_0x17650f[_0xc12c('0xff')],'text_color':_0x17650f[_0xc12c('0x100')],'button_color':_0x17650f['color_button'],'background_color':_0x17650f['backgroundColor'],'hideWhenOffline':_0x17650f['hideWhenOffline'],'interval':_0x17650f[_0xc12c('0x101')]}));})[_0xc12c('0x17')](handleError(_0x9dfbd,null));};exports[_0xc12c('0x102')]=function(_0x59f5ac,_0x3b7dfb){var _0x51ee61=_0x59f5ac[_0xc12c('0x44')]['id'];var _0xca1c24=_0x59f5ac[_0xc12c('0x46')];var _0xe155cf=0xc8;var _0x3b1da2=null;return db[_0xc12c('0xc5')][_0xc12c('0xc6')]({'isolationLevel':db[_0xc12c('0xc5')][_0xc12c('0x103')][_0xc12c('0x104')][_0xc12c('0x105')]},function(_0xb2313d){return db[_0xc12c('0x2b')][_0xc12c('0x4f')]({'where':{'id':_0x51ee61},'transaction':_0xb2313d})[_0xc12c('0x10')](function(_0x28091c){if(_0x28091c){return db[_0xc12c('0x85')]['destroy']({'where':{'ChatWebsiteId':_0x51ee61},'transaction':_0xb2313d})[_0xc12c('0x10')](function(){var _0x1e44a7=_[_0xc12c('0x2a')](_0xca1c24,function(_0x2e811f){_0x2e811f['ChatWebsiteId']=_0x51ee61;return _0x2e811f;});return db[_0xc12c('0x85')][_0xc12c('0xc7')](_0x1e44a7,{'transaction':_0xb2313d});});}else{_0xe155cf=0x194;_0x3b1da2=[];}});})[_0xc12c('0x10')](function(){if(_0xe155cf!==0x194){return db[_0xc12c('0x85')][_0xc12c('0x106')]({'where':{'ChatWebsiteId':_0x51ee61},'order':'priority'})[_0xc12c('0x10')](function(_0x491049){_0x3b1da2=_0x491049;});}})[_0xc12c('0x17')](function(_0x3dddb1){_0xe155cf=0x1f4;logger[_0xc12c('0x14')](_0x3dddb1[_0xc12c('0x25')]);if(_0x3dddb1[_0xc12c('0x26')]){delete _0x3dddb1[_0xc12c('0x26')];}_0x3b1da2=_0x3dddb1;})[_0xc12c('0x107')](function(){if(_0x3b1da2===null){_0x3b7dfb[_0xc12c('0x18')](_0xe155cf);}else{if(_0xe155cf===0x1f4){_0x3b7dfb[_0xc12c('0x19')](_0xe155cf)['send'](_0x3b1da2);}else{_0x3b7dfb[_0xc12c('0x19')](_0xe155cf)[_0xc12c('0x1b')](_0x3b1da2);}}});};exports[_0xc12c('0x108')]=function(_0x17451f,_0x25cef5){var _0x5d92e7={};var _0x24e64e={};var _0xc9bd2;var _0x2b4bf1;return db['ChatWebsite'][_0xc12c('0x4f')]({'where':{'id':_0x17451f[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x25cef5,null))['then'](function(_0x5c025b){if(_0x5c025b){_0xc9bd2=_0x5c025b;_0x24e64e[_0xc12c('0x33')]=_[_0xc12c('0x30')](db[_0xc12c('0x85')]['rawAttributes']);_0x24e64e[_0xc12c('0x2f')]=_[_0xc12c('0x30')](_0x17451f[_0xc12c('0x2f')]);_0x24e64e['filters']=_[_0xc12c('0x32')](_0x24e64e[_0xc12c('0x33')],_0x24e64e['query']);_0x5d92e7[_0xc12c('0x35')]=_[_0xc12c('0x32')](_0x24e64e[_0xc12c('0x33')],qs[_0xc12c('0x34')](_0x17451f['query'][_0xc12c('0x34')]));_0x5d92e7[_0xc12c('0x35')]=_0x5d92e7['attributes'][_0xc12c('0x36')]?_0x5d92e7[_0xc12c('0x35')]:_0x24e64e['model'];_0x5d92e7[_0xc12c('0x39')]=qs[_0xc12c('0x3a')](_0x17451f['query']['sort']);_0x5d92e7[_0xc12c('0x3b')]=qs['filters'](_['pick'](_0x17451f[_0xc12c('0x2f')],_0x24e64e[_0xc12c('0x31')]));if(_0x17451f[_0xc12c('0x2f')]['filter']){_0x5d92e7['where']=_[_0xc12c('0x3d')](_0x5d92e7[_0xc12c('0x3b')],{'$or':_[_0xc12c('0x2a')](_0x5d92e7['attributes'],function(_0x40f898){var _0x4ef6a2={};_0x4ef6a2[_0x40f898]={'$like':'%'+_0x17451f[_0xc12c('0x2f')][_0xc12c('0x3c')]+'%'};return _0x4ef6a2;})});}_0x5d92e7=_[_0xc12c('0x3d')]({},_0x5d92e7,_0x17451f[_0xc12c('0x3f')]);return _0xc9bd2['getApplications'](_0x5d92e7);}})[_0xc12c('0x10')](function(_0x1bec6e){if(_0x1bec6e){_0x2b4bf1=_0x1bec6e[_0xc12c('0x36')];if(!_0x17451f[_0xc12c('0x2f')][_0xc12c('0x50')](_0xc12c('0x37'))){_0x5d92e7[_0xc12c('0x38')]=qs[_0xc12c('0x38')](_0x17451f['query'][_0xc12c('0x38')]);_0x5d92e7[_0xc12c('0x1c')]=qs[_0xc12c('0x1c')](_0x17451f[_0xc12c('0x2f')][_0xc12c('0x1c')]);}return _0xc9bd2[_0xc12c('0x108')](_0x5d92e7);}})['then'](function(_0x5853ec){if(_0x5853ec){return _0x5853ec?{'count':_0x2b4bf1,'rows':_0x5853ec}:null;}})['then'](respondWithResult(_0x25cef5,null))['catch'](handleError(_0x25cef5,null));};exports[_0xc12c('0x109')]=function(_0x473866,_0x73fdc){return db[_0xc12c('0x10a')][_0xc12c('0x4a')]({'where':{'id':_0x473866['params']['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x73fdc,null))['then'](function(_0x56e0ff){if(_0x56e0ff){return _0x56e0ff[_0xc12c('0x109')](_0x473866['body']['ids'],_['omit'](_0x473866[_0xc12c('0x46')],[_0xc12c('0x54'),'id'])||{});}})[_0xc12c('0x10')](respondWithResult(_0x73fdc,null))[_0xc12c('0x17')](handleError(_0x73fdc,null));};exports[_0xc12c('0xf3')]=function(_0x2833be,_0x37b49a){var _0x5e7521={};var _0x48b157={};var _0x2de13f;var _0x4547c4;return db[_0xc12c('0x2b')][_0xc12c('0x4f')]({'where':{'id':_0x2833be[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x37b49a,null))[_0xc12c('0x10')](function(_0x311464){if(_0x311464){_0x2de13f=_0x311464;_0x48b157[_0xc12c('0x33')]=_[_0xc12c('0x30')](db[_0xc12c('0x10b')]['rawAttributes']);_0x48b157[_0xc12c('0x2f')]=_[_0xc12c('0x30')](_0x2833be[_0xc12c('0x2f')]);_0x48b157[_0xc12c('0x31')]=_['intersection'](_0x48b157[_0xc12c('0x33')],_0x48b157['query']);_0x5e7521['attributes']=_['intersection'](_0x48b157[_0xc12c('0x33')],qs[_0xc12c('0x34')](_0x2833be[_0xc12c('0x2f')]['fields']));_0x5e7521[_0xc12c('0x35')]=_0x5e7521[_0xc12c('0x35')]['length']?_0x5e7521[_0xc12c('0x35')]:_0x48b157[_0xc12c('0x33')];_0x5e7521[_0xc12c('0x39')]=qs[_0xc12c('0x3a')](_0x2833be[_0xc12c('0x2f')][_0xc12c('0x3a')]);_0x5e7521[_0xc12c('0x3b')]=qs[_0xc12c('0x31')](_[_0xc12c('0x51')](_0x2833be['query'],_0x48b157[_0xc12c('0x31')]));if(_0x2833be['query']['filter']){_0x5e7521[_0xc12c('0x3b')]=_[_0xc12c('0x3d')](_0x5e7521[_0xc12c('0x3b')],{'$or':_[_0xc12c('0x2a')](_0x5e7521[_0xc12c('0x35')],function(_0x4df230){var _0x271e2d={};_0x271e2d[_0x4df230]={'$like':'%'+_0x2833be['query'][_0xc12c('0x3c')]+'%'};return _0x271e2d;})});}_0x5e7521=_[_0xc12c('0x3d')]({},_0x5e7521,_0x2833be[_0xc12c('0x3f')]);return _0x2de13f['getProactiveActions'](_0x5e7521);}})['then'](function(_0x48da31){if(_0x48da31){_0x4547c4=_0x48da31['length'];if(!_0x2833be['query'][_0xc12c('0x50')]('nolimit')){_0x5e7521['limit']=qs['limit'](_0x2833be[_0xc12c('0x2f')][_0xc12c('0x38')]);_0x5e7521['offset']=qs[_0xc12c('0x1c')](_0x2833be[_0xc12c('0x2f')][_0xc12c('0x1c')]);}return _0x2de13f['getProactiveActions'](_0x5e7521);}})[_0xc12c('0x10')](function(_0x10d26a){if(_0x10d26a){return _0x10d26a?{'count':_0x4547c4,'rows':_0x10d26a}:null;}})[_0xc12c('0x10')](respondWithResult(_0x37b49a,null))[_0xc12c('0x17')](handleError(_0x37b49a,null));};exports[_0xc12c('0x10c')]=function(_0x469563,_0x1c6276){var _0xce2505=_0x469563[_0xc12c('0x2f')][_0xc12c('0x10d')]==='false'?'offlineForm':_0xc12c('0x10e');return db['ChatWebsite'][_0xc12c('0x4a')]({'attributes':['id',_0xce2505],'where':{'id':_0x469563[_0xc12c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c6276,null))[_0xc12c('0x10')](function(_0x46023d){if(_0x46023d){var _0x39914e=_0x46023d[_0xce2505];var _0x400b0c=_0x39914e&&_0x39914e[_0xc12c('0x10f')]?_0x39914e[_0xc12c('0x10f')]:[];_0x1c6276[_0xc12c('0xb3')]({'fromKey':_['isNil'](_0x39914e['fromKey'])?undefined:_0x39914e[_0xc12c('0x110')],'count':_0x400b0c['length'],'rows':_0x400b0c});}})[_0xc12c('0x17')](handleError(_0x1c6276,null));};exports['getOfflineMessages']=function(_0x10f2c4,_0x489c18){var _0x58e915={'raw':![],'where':{}};var _0x14a25d={};var _0x19b34c={'count':0x0,'rows':[]};return db[_0xc12c('0x2b')]['findOne']({'where':{'id':_0x10f2c4[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x489c18,null))[_0xc12c('0x10')](function(_0x13ad60){if(_0x13ad60){_0x14a25d['model']=_[_0xc12c('0x30')](db[_0xc12c('0xbe')][_0xc12c('0x2c')]);_0x14a25d[_0xc12c('0x2f')]=_['keys'](_0x10f2c4['query']);_0x14a25d[_0xc12c('0x31')]=_[_0xc12c('0x32')](_0x14a25d['model'],_0x14a25d[_0xc12c('0x2f')]);_0x58e915['attributes']=_[_0xc12c('0x32')](_0x14a25d['model'],qs['fields'](_0x10f2c4[_0xc12c('0x2f')]['fields']));_0x58e915['attributes']=_0x58e915[_0xc12c('0x35')]['length']?_0x58e915[_0xc12c('0x35')]:_0x14a25d['model'];if(!_0x10f2c4[_0xc12c('0x2f')][_0xc12c('0x50')](_0xc12c('0x37'))){_0x58e915[_0xc12c('0x38')]=qs['limit'](_0x10f2c4[_0xc12c('0x2f')]['limit']);_0x58e915[_0xc12c('0x1c')]=qs[_0xc12c('0x1c')](_0x10f2c4[_0xc12c('0x2f')][_0xc12c('0x1c')]);}_0x58e915['order']=qs[_0xc12c('0x3a')](_0x10f2c4['query']['sort']);_0x58e915['where']=qs[_0xc12c('0x31')](_[_0xc12c('0x51')](_0x10f2c4[_0xc12c('0x2f')],_0x14a25d[_0xc12c('0x31')]));_0x58e915[_0xc12c('0x3b')][_0xc12c('0x52')]=_0x13ad60['id'];if(_0x10f2c4[_0xc12c('0x2f')][_0xc12c('0x3c')]){_0x58e915[_0xc12c('0x3b')]=_['merge'](_0x58e915[_0xc12c('0x3b')],{'$or':_[_0xc12c('0x2a')](_0x58e915[_0xc12c('0x35')],function(_0x2bbda2){var _0x4bb996={};_0x4bb996[_0x2bbda2]={'$like':'%'+_0x10f2c4[_0xc12c('0x2f')][_0xc12c('0x3c')]+'%'};return _0x4bb996;})});}_0x58e915=_[_0xc12c('0x3d')]({},_0x58e915,_0x10f2c4[_0xc12c('0x3f')]);return db[_0xc12c('0xbe')]['count']({'where':_0x58e915[_0xc12c('0x3b')]})[_0xc12c('0x10')](function(_0x2a42fe){_0x19b34c['count']=_0x2a42fe;if(_0x10f2c4[_0xc12c('0x2f')]['includeAll']){_0x58e915['include']=[{'all':!![]}];}else{_0x58e915[_0xc12c('0x41')]=[{'model':db[_0xc12c('0x74')],'as':_0xc12c('0xe1'),'required':![]},{'model':db['Attachment'],'as':_0xc12c('0x111'),'required':![]}];}return db[_0xc12c('0xbe')][_0xc12c('0x112')](_0x58e915);})[_0xc12c('0x10')](function(_0x55ead3){_0x19b34c[_0xc12c('0x42')]=_0x55ead3;return _0x19b34c;});}})['then'](respondWithFilteredResult(_0x489c18,_0x58e915))[_0xc12c('0x17')](handleError(_0x489c18,null));};exports[_0xc12c('0x113')]=function(_0x3d883d,_0xa97e76){return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x3d883d[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0xa97e76,null))['then'](function(_0x2b1145){if(_0x2b1145){return _0x2b1145[_0xc12c('0x113')](_0x3d883d['body'][_0xc12c('0x54')],_['omit'](_0x3d883d[_0xc12c('0x46')],[_0xc12c('0x54'),'id'])||{})[_0xc12c('0xa2')](function(_0x1b8e11){for(var _0x27212c=0x0;_0x27212c<_0x3d883d['body'][_0xc12c('0x54')][_0xc12c('0x36')];_0x27212c+=0x1){socket['emit'](_0xc12c('0x114'),{'UserId':Number(_0x3d883d[_0xc12c('0x46')][_0xc12c('0x54')][_0x27212c]),'ChatWebsiteId':Number(_0x3d883d['params']['id'])});}return _0x1b8e11;});}})[_0xc12c('0x10')](respondWithResult(_0xa97e76,null))[_0xc12c('0x17')](handleError(_0xa97e76,null));};exports[_0xc12c('0x115')]=function(_0x346f6b,_0x26e0f0){return db[_0xc12c('0x2b')][_0xc12c('0x4a')]({'where':{'id':_0x346f6b['params']['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x26e0f0,null))[_0xc12c('0x10')](function(_0x500e03){if(_0x500e03){return _0x500e03[_0xc12c('0x115')](_0x346f6b[_0xc12c('0x2f')][_0xc12c('0x54')])[_0xc12c('0x10')](function(){if(_[_0xc12c('0x116')](_0x346f6b[_0xc12c('0x2f')][_0xc12c('0x54')])){for(var _0x2332a8=0x0;_0x2332a8<_0x346f6b[_0xc12c('0x2f')][_0xc12c('0x54')][_0xc12c('0x36')];_0x2332a8+=0x1){socket['emit'](_0xc12c('0x117'),{'UserId':Number(_0x346f6b['query']['ids'][_0x2332a8]),'ChatWebsiteId':Number(_0x346f6b[_0xc12c('0x44')]['id'])});}}else{socket[_0xc12c('0x118')](_0xc12c('0x117'),{'UserId':Number(_0x346f6b[_0xc12c('0x2f')]['ids']),'ChatWebsiteId':Number(_0x346f6b['params']['id'])});}});}})[_0xc12c('0x10')](respondWithStatusCode(_0x26e0f0,null))['catch'](handleError(_0x26e0f0,null));};exports[_0xc12c('0x119')]=function(_0x473c7f,_0x1cd581){var _0x366027={};var _0x5e7424={};var _0x235e8e;var _0x66c769;return db['ChatWebsite'][_0xc12c('0x4f')]({'where':{'id':_0x473c7f[_0xc12c('0x44')]['id']}})[_0xc12c('0x10')](handleEntityNotFound(_0x1cd581,null))[_0xc12c('0x10')](function(_0x5c325c){if(_0x5c325c){_0x235e8e=_0x5c325c;_0x5e7424[_0xc12c('0x33')]=_[_0xc12c('0x30')](db[_0xc12c('0xaa')]['rawAttributes']);_0x5e7424[_0xc12c('0x2f')]=_[_0xc12c('0x30')](_0x473c7f['query']);_0x5e7424[_0xc12c('0x31')]=_[_0xc12c('0x32')](_0x5e7424[_0xc12c('0x33')],_0x5e7424[_0xc12c('0x2f')]);_0x366027['attributes']=_['intersection'](_0x5e7424[_0xc12c('0x33')],qs[_0xc12c('0x34')](_0x473c7f[_0xc12c('0x2f')][_0xc12c('0x34')]));_0x366027[_0xc12c('0x35')]=_0x366027[_0xc12c('0x35')][_0xc12c('0x36')]?_0x366027[_0xc12c('0x35')]:_0x5e7424['model'];_0x366027[_0xc12c('0x39')]=qs[_0xc12c('0x3a')](_0x473c7f[_0xc12c('0x2f')]['sort']);_0x366027[_0xc12c('0x3b')]=qs['filters'](_[_0xc12c('0x51')](_0x473c7f[_0xc12c('0x2f')],_0x5e7424[_0xc12c('0x31')]));if(_0x473c7f['query']['filter']){_0x366027['where']=_[_0xc12c('0x3d')](_0x366027[_0xc12c('0x3b')],{'$or':_[_0xc12c('0x2a')](_0x366027[_0xc12c('0x35')],function(_0x596255){var _0x519992={};_0x519992[_0x596255]={'$like':'%'+_0x473c7f[_0xc12c('0x2f')]['filter']+'%'};return _0x519992;})});}_0x366027=_[_0xc12c('0x3d')]({},_0x366027,_0x473c7f['options']);return _0x235e8e[_0xc12c('0x119')](_0x366027);}})[_0xc12c('0x10')](function(_0x97ad69){if(_0x97ad69){_0x66c769=_0x97ad69[_0xc12c('0x36')];if(!_0x473c7f[_0xc12c('0x2f')]['hasOwnProperty'](_0xc12c('0x37'))){_0x366027['limit']=qs[_0xc12c('0x38')](_0x473c7f['query'][_0xc12c('0x38')]);_0x366027['offset']=qs[_0xc12c('0x1c')](_0x473c7f[_0xc12c('0x2f')][_0xc12c('0x1c')]);}return _0x235e8e['getAgents'](_0x366027);}})[_0xc12c('0x10')](function(_0x251ed8){if(_0x251ed8){return _0x251ed8?{'count':_0x66c769,'rows':_0x251ed8}:null;}})['then'](respondWithResult(_0x1cd581,null))[_0xc12c('0x17')](handleError(_0x1cd581,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9bcf35b..6b7e1ea 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 _0xae1c=['hasOwnProperty','hook','exports','save','update','remove','emit'];(function(_0x1e2c73,_0x12cd55){var _0x46f8d5=function(_0xe5a2fd){while(--_0xe5a2fd){_0x1e2c73['push'](_0x1e2c73['shift']());}};_0x46f8d5(++_0x12cd55);}(_0xae1c,0xff));var _0xcae1=function(_0x21ba41,_0x4727db){_0x21ba41=_0x21ba41-0x0;var _0x293e00=_0xae1c[_0x21ba41];return _0x293e00;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcae1('0x0'),'afterUpdate':_0xcae1('0x1'),'afterDestroy':_0xcae1('0x2')};function emitEvent(_0x32bfaa){return function(_0x1d37db,_0x2b6b57,_0x3d11cb){ChatWebsiteEvents[_0xcae1('0x3')](_0x32bfaa+':'+_0x1d37db['id'],_0x1d37db);ChatWebsiteEvents[_0xcae1('0x3')](_0x32bfaa,_0x1d37db);_0x3d11cb(null);};}for(var e in events){if(events[_0xcae1('0x4')](e)){var event=events[e];ChatWebsite[_0xcae1('0x5')](e,emitEvent(event));}}module[_0xcae1('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7d9f=['save','remove','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x41407d,_0x4ca526){var _0x9c2cf1=function(_0x1cbfb6){while(--_0x1cbfb6){_0x41407d['push'](_0x41407d['shift']());}};_0x9c2cf1(++_0x4ca526);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x274d4b,_0x128681){_0x274d4b=_0x274d4b-0x0;var _0x1a1f03=_0x7d9f[_0x274d4b];return _0x1a1f03;};'use strict';var EventEmitter=require(_0xf7d9('0x0'));var ChatWebsite=require(_0xf7d9('0x1'))['db'][_0xf7d9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf7d9('0x3')](0x0);var events={'afterCreate':_0xf7d9('0x4'),'afterUpdate':'update','afterDestroy':_0xf7d9('0x5')};function emitEvent(_0x1051a9){return function(_0xd43b74,_0x159e95,_0x23cb4c){ChatWebsiteEvents['emit'](_0x1051a9+':'+_0xd43b74['id'],_0xd43b74);ChatWebsiteEvents['emit'](_0x1051a9,_0xd43b74);_0x23cb4c(null);};}for(var e in events){if(events[_0xf7d9('0x6')](e)){var event=events[e];ChatWebsite[_0xf7d9('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index c108120..7e46a9e 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 _0xb582=['moment','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','../../config/logger','api'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xb582,0x1cc));var _0x2b58=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb582[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b58('0x0'))(_0x2b58('0x1'));var moment=require(_0x2b58('0x2'));var BPromise=require(_0x2b58('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b58('0x4'));var rimraf=require(_0x2b58('0x5'));var config=require(_0x2b58('0x6'));var attributes=require(_0x2b58('0x7'));module[_0x2b58('0x8')]=function(_0x3ac6f4,_0x2d763c){return _0x3ac6f4[_0x2b58('0x9')]('ChatWebsite',attributes,{'tableName':_0x2b58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa60f=['bluebird','request-promise','path','./chatWebsite.attributes','exports','chat_websites','lodash','../../config/logger','api','moment'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xa60f,0x100));var _0xfa60=function(_0x474636,_0x36958e){_0x474636=_0x474636-0x0;var _0x554e6b=_0xa60f[_0x474636];return _0x554e6b;};'use strict';var _=require(_0xfa60('0x0'));var util=require('util');var logger=require(_0xfa60('0x1'))(_0xfa60('0x2'));var moment=require(_0xfa60('0x3'));var BPromise=require(_0xfa60('0x4'));var rp=require(_0xfa60('0x5'));var fs=require('fs');var path=require(_0xfa60('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa60('0x7'));module[_0xfa60('0x8')]=function(_0x28655e,_0x55f98e){return _0x28655e['define']('ChatWebsite',attributes,{'tableName':_0xfa60('0x9'),'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 9b14f89..48788fc 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 _0x234a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0xc7fc03,_0x3950a8){var _0x3d962a=function(_0x2bfa14){while(--_0x2bfa14){_0xc7fc03['push'](_0xc7fc03['shift']());}};_0x3d962a(++_0x3950a8);}(_0x234a,0x1db));var _0xa234=function(_0x43eb54,_0x35e944){_0x43eb54=_0x43eb54-0x0;var _0x3892ac=_0x234a[_0x43eb54];return _0x3892ac;};'use strict';var _=require(_0xa234('0x0'));var util=require(_0xa234('0x1'));var moment=require(_0xa234('0x2'));var BPromise=require(_0xa234('0x3'));var rs=require(_0xa234('0x4'));var fs=require('fs');var Redis=require(_0xa234('0x5'));var db=require(_0xa234('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa234('0x7'))(_0xa234('0x8'));var config=require(_0xa234('0x9'));var jayson=require(_0xa234('0xa'));var client=jayson[_0xa234('0xb')][_0xa234('0xc')]({'port':0x232a});config['redis']=_[_0xa234('0xd')](config[_0xa234('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa234('0xe')]));require('./chatWebsite.socket')[_0xa234('0xf')](socket);function respondWithRpcPromise(_0x193584,_0x14e283,_0x2a1d73){return new BPromise(function(_0x21096c,_0xdd8736){return client[_0xa234('0x10')](_0x193584,_0x2a1d73)[_0xa234('0x11')](function(_0x5cbca2){logger['info'](_0xa234('0x12'),_0x14e283,_0xa234('0x13'));logger[_0xa234('0x14')](_0xa234('0x15'),_0x14e283,'request\x20sent',JSON[_0xa234('0x16')](_0x5cbca2));if(_0x5cbca2[_0xa234('0x17')]){if(_0x5cbca2['error'][_0xa234('0x18')]===0x1f4){logger[_0xa234('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x14e283,_0x5cbca2['error'][_0xa234('0x19')]);return _0xdd8736(_0x5cbca2[_0xa234('0x17')][_0xa234('0x19')]);}logger[_0xa234('0x17')](_0xa234('0x12'),_0x14e283,_0x5cbca2['error'][_0xa234('0x19')]);return _0x21096c(_0x5cbca2[_0xa234('0x17')][_0xa234('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x14e283,_0xa234('0x13'));_0x21096c(_0x5cbca2[_0xa234('0x1a')][_0xa234('0x19')]);}})[_0xa234('0x1b')](function(_0x1c7edd){logger[_0xa234('0x17')](_0xa234('0x12'),_0x14e283,_0x1c7edd);_0xdd8736(_0x1c7edd);});});} \ No newline at end of file +var _0x0cac=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info'];(function(_0xa16075,_0x31ac3b){var _0x452281=function(_0x5d7665){while(--_0x5d7665){_0xa16075['push'](_0xa16075['shift']());}};_0x452281(++_0x31ac3b);}(_0x0cac,0x1de));var _0xc0ca=function(_0x14735c,_0x56c131){_0x14735c=_0x14735c-0x0;var _0x44e4f4=_0x0cac[_0x14735c];return _0x44e4f4;};'use strict';var _=require(_0xc0ca('0x0'));var util=require(_0xc0ca('0x1'));var moment=require(_0xc0ca('0x2'));var BPromise=require(_0xc0ca('0x3'));var rs=require(_0xc0ca('0x4'));var fs=require('fs');var Redis=require(_0xc0ca('0x5'));var db=require(_0xc0ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0ca('0x7'))(_0xc0ca('0x8'));var config=require(_0xc0ca('0x9'));var jayson=require(_0xc0ca('0xa'));var client=jayson[_0xc0ca('0xb')]['http']({'port':0x232a});config[_0xc0ca('0xc')]=_[_0xc0ca('0xd')](config[_0xc0ca('0xc')],{'host':_0xc0ca('0xe'),'port':0x18eb});var socket=require(_0xc0ca('0xf'))(new Redis(config[_0xc0ca('0xc')]));require(_0xc0ca('0x10'))['register'](socket);function respondWithRpcPromise(_0x53f326,_0x23164c,_0x3f5558){return new BPromise(function(_0x3eed2a,_0x20fe5e){return client[_0xc0ca('0x11')](_0x53f326,_0x3f5558)['then'](function(_0xd3e829){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x23164c,_0xc0ca('0x12'));logger['debug'](_0xc0ca('0x13'),_0x23164c,_0xc0ca('0x12'),JSON[_0xc0ca('0x14')](_0xd3e829));if(_0xd3e829[_0xc0ca('0x15')]){if(_0xd3e829['error'][_0xc0ca('0x16')]===0x1f4){logger[_0xc0ca('0x15')](_0xc0ca('0x17'),_0x23164c,_0xd3e829[_0xc0ca('0x15')][_0xc0ca('0x18')]);return _0x20fe5e(_0xd3e829[_0xc0ca('0x15')][_0xc0ca('0x18')]);}logger[_0xc0ca('0x15')](_0xc0ca('0x17'),_0x23164c,_0xd3e829[_0xc0ca('0x15')]['message']);return _0x3eed2a(_0xd3e829['error']['message']);}else{logger[_0xc0ca('0x19')](_0xc0ca('0x17'),_0x23164c,'request\x20sent');_0x3eed2a(_0xd3e829[_0xc0ca('0x1a')]['message']);}})[_0xc0ca('0x1b')](function(_0x243d53){logger[_0xc0ca('0x15')](_0xc0ca('0x17'),_0x23164c,_0x243d53);_0x20fe5e(_0x243d53);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8475d4d..9157420 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 _0x463b=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x463b,0x101));var _0xb463=function(_0x1f7e00,_0x1c9d00){_0x1f7e00=_0x1f7e00-0x0;var _0x3c5a23=_0x463b[_0x1f7e00];return _0x3c5a23;};'use strict';var ChatWebsiteEvents=require(_0xb463('0x0'));var events=[_0xb463('0x1'),_0xb463('0x2'),_0xb463('0x3')];function createListener(_0x29b477,_0x9c4435){return function(_0x4fc061){_0x9c4435[_0xb463('0x4')](_0x29b477,_0x4fc061);};}function removeListener(_0x4e336f,_0x479845){return function(){ChatWebsiteEvents[_0xb463('0x5')](_0x4e336f,_0x479845);};}exports[_0xb463('0x6')]=function(_0x3411f6){for(var _0x2bf0e3=0x0,_0x390360=events[_0xb463('0x7')];_0x2bf0e3<_0x390360;_0x2bf0e3++){var _0x50ead9=events[_0x2bf0e3];var _0x25dde5=createListener(_0xb463('0x8')+_0x50ead9,_0x3411f6);ChatWebsiteEvents['on'](_0x50ead9,_0x25dde5);}}; \ No newline at end of file +var _0x07cc=['length','./chatWebsite.events','save','update','emit','removeListener','register'];(function(_0xb09c2,_0x2a04d1){var _0x5ecc6b=function(_0x51e5f2){while(--_0x51e5f2){_0xb09c2['push'](_0xb09c2['shift']());}};_0x5ecc6b(++_0x2a04d1);}(_0x07cc,0xd3));var _0xc07c=function(_0x959539,_0x484a9e){_0x959539=_0x959539-0x0;var _0x30873a=_0x07cc[_0x959539];return _0x30873a;};'use strict';var ChatWebsiteEvents=require(_0xc07c('0x0'));var events=[_0xc07c('0x1'),'remove',_0xc07c('0x2')];function createListener(_0x1fb517,_0x1a6f30){return function(_0x4fb04e){_0x1a6f30[_0xc07c('0x3')](_0x1fb517,_0x4fb04e);};}function removeListener(_0xfdec23,_0x1ea051){return function(){ChatWebsiteEvents[_0xc07c('0x4')](_0xfdec23,_0x1ea051);};}exports[_0xc07c('0x5')]=function(_0x1a78c5){for(var _0x5a4a88=0x0,_0xd26bbe=events[_0xc07c('0x6')];_0x5a4a88<_0xd26bbe;_0x5a4a88++){var _0x237512=events[_0x5a4a88];var _0x36e27b=createListener('chatWebsite:'+_0x237512,_0x1a78c5);ChatWebsiteEvents['on'](_0x237512,_0x36e27b);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e9bd27f..6eb131c 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 _0xf01f=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','show','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','addAvatar','server/files/images/avatars/','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addInteraction','/:id/applications','addAgents','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x1c688b,_0x4df102){var _0x4d4577=function(_0x29a41b){while(--_0x29a41b){_0x1c688b['push'](_0x1c688b['shift']());}};_0x4d4577(++_0x4df102);}(_0xf01f,0xd3));var _0xff01=function(_0x2d789c,_0x366140){_0x2d789c=_0x2d789c-0x0;var _0xc5d1d5=_0xf01f[_0x2d789c];return _0xc5d1d5;};'use strict';var multer=require(_0xff01('0x0'));var util=require(_0xff01('0x1'));var path=require(_0xff01('0x2'));var timeout=require('connect-timeout');var express=require(_0xff01('0x3'));var router=express['Router']();var fs_extra=require(_0xff01('0x4'));var auth=require(_0xff01('0x5'));var interaction=require(_0xff01('0x6'));var config=require(_0xff01('0x7'));var controller=require(_0xff01('0x8'));router[_0xff01('0x9')]('/',auth[_0xff01('0xa')](),controller['index']);router[_0xff01('0x9')](_0xff01('0xb'),auth[_0xff01('0xa')](),controller[_0xff01('0xc')]);router[_0xff01('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xff01('0xd')]);router[_0xff01('0x9')]('/:id/dispositions',auth[_0xff01('0xa')](),controller['getDispositions']);router['get'](_0xff01('0xe'),auth[_0xff01('0xa')](),controller[_0xff01('0xf')]);router[_0xff01('0x9')](_0xff01('0x10'),controller[_0xff01('0x11')]);router[_0xff01('0x9')]('/:id/avatar',controller[_0xff01('0x12')]);router[_0xff01('0x9')](_0xff01('0x13'),controller['getCustomerAvatar']);router[_0xff01('0x9')](_0xff01('0x14'),controller[_0xff01('0x15')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0xff01('0x16')]);router['get'](_0xff01('0x17'),controller[_0xff01('0x18')]);router[_0xff01('0x9')]('/:id/applications',auth[_0xff01('0xa')](),controller[_0xff01('0x19')]);router[_0xff01('0x9')](_0xff01('0x1a'),auth[_0xff01('0xa')](),controller[_0xff01('0x1b')]);router[_0xff01('0x9')]('/:id/fields',controller[_0xff01('0x1c')]);router[_0xff01('0x9')]('/:id/offline_messages',auth[_0xff01('0xa')](),controller[_0xff01('0x1d')]);router[_0xff01('0x9')](_0xff01('0x1e'),auth[_0xff01('0xa')](),controller['getAgents']);router[_0xff01('0x1f')]('/',auth[_0xff01('0xa')](),controller[_0xff01('0x20')]);router[_0xff01('0x1f')]('/:id/dispositions',auth[_0xff01('0xa')](),controller[_0xff01('0x21')]);router[_0xff01('0x1f')](_0xff01('0xe'),auth[_0xff01('0xa')](),controller[_0xff01('0x22')]);var upload=multer({'storage':multer[_0xff01('0x23')]({'destination':function(_0x2f9f12,_0x2de305,_0x15c139){_0x15c139(null,path['join'](config[_0xff01('0x24')],_0xff01('0x25')));},'filename':function(_0x5b0d54,_0x46ed6a,_0x69b934){_0x69b934(null,util[_0xff01('0x26')](_0xff01('0x27'),Date[_0xff01('0x28')](),_0x46ed6a[_0xff01('0x29')]));}})});router[_0xff01('0x1f')](_0xff01('0x10'),upload[_0xff01('0x2a')](_0xff01('0x2b')),controller[_0xff01('0x2c')]);var upload=multer({'storage':multer[_0xff01('0x23')]({'destination':function(_0x2477c8,_0x4d6283,_0x55b655){_0x55b655(null,path[_0xff01('0x2d')](config[_0xff01('0x24')],'server/files/images/avatars/'));},'filename':function(_0xd9d330,_0x5f14b9,_0x3050fd){_0x3050fd(null,util[_0xff01('0x26')]('%s-%s',Date[_0xff01('0x28')](),_0x5f14b9['originalname']));}})});router[_0xff01('0x1f')]('/:id/avatar',upload[_0xff01('0x2a')](_0xff01('0x2b')),controller[_0xff01('0x2e')]);var upload=multer({'storage':multer[_0xff01('0x23')]({'destination':function(_0x41242a,_0xcfa602,_0x641537){_0x641537(null,path['join'](config[_0xff01('0x24')],_0xff01('0x2f')));},'filename':function(_0x1b3280,_0x2037e4,_0x1a2903){_0x1a2903(null,util[_0xff01('0x26')](_0xff01('0x27'),Date['now'](),_0x2037e4[_0xff01('0x29')]));}})});router['post'](_0xff01('0x13'),upload['single'](_0xff01('0x2b')),controller[_0xff01('0x30')]);var upload=multer({'storage':multer[_0xff01('0x23')]({'destination':function(_0x292075,_0x57728b,_0x5e2eb4){_0x5e2eb4(null,path[_0xff01('0x2d')](config[_0xff01('0x24')],'server/files/images/avatars/'));},'filename':function(_0x12c7be,_0x28c8cc,_0x805752){_0x805752(null,util[_0xff01('0x26')](_0xff01('0x27'),Date['now'](),_0x28c8cc['originalname']));}})});router[_0xff01('0x1f')]('/:id/system_avatar',upload[_0xff01('0x2a')]('file'),controller['addSystemAvatar']);router[_0xff01('0x1f')](_0xff01('0x31'),controller[_0xff01('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xff01('0x23')]({'destination':function(_0x1699d3,_0x2ad094,_0x43acd4){const _0xd6074f=path[_0xff01('0x2d')](config[_0xff01('0x24')],_0xff01('0x33'),_0xff01('0x34'),_0xff01('0x35'));fs_extra[_0xff01('0x36')](_0xd6074f,function(){_0x43acd4(null,_0xd6074f);});},'filename':function(_0x48a415,_0x4661fb,_0x343e6e){const _0x533783=_0x4661fb[_0xff01('0x29')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x23e2c0=path[_0xff01('0x37')](_0x533783);const _0x8c9e1b=Date['now']()+'-'+_0x533783[_0xff01('0x38')](_0x23e2c0,'')+_0x23e2c0;_0x343e6e(null,_0x8c9e1b);}})});router[_0xff01('0x1f')](_0xff01('0x39'),offlineUploadMulter[_0xff01('0x3a')](),controller[_0xff01('0x3b')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0xff01('0x3c')]);router[_0xff01('0x1f')](_0xff01('0x3d'),auth[_0xff01('0xa')](),controller['addApplications']);router[_0xff01('0x1f')](_0xff01('0x1a'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xff01('0x1f')](_0xff01('0x1e'),auth[_0xff01('0xa')](),controller[_0xff01('0x3e')]);router[_0xff01('0x3f')]('/:id',auth[_0xff01('0xa')](),controller[_0xff01('0x40')]);router[_0xff01('0x41')]('/:id',auth[_0xff01('0xa')](),controller['destroy']);router[_0xff01('0x41')](_0xff01('0x42'),auth['isAuthenticated'](),controller[_0xff01('0x43')]);router[_0xff01('0x41')](_0xff01('0xe'),auth[_0xff01('0xa')](),controller[_0xff01('0x44')]);router[_0xff01('0x41')](_0xff01('0x1e'),auth['isAuthenticated'](),controller[_0xff01('0x45')]);module[_0xff01('0x46')]=router; \ No newline at end of file +var _0xacba=['index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','%s-%s','addAvatar','format','addCustomerAvatar','addSystemAvatar','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xacba,0xd5));var _0xaacb=function(_0x597c94,_0x2a00ba){_0x597c94=_0x597c94-0x0;var _0x26258d=_0xacba[_0x597c94];return _0x26258d;};'use strict';var multer=require(_0xaacb('0x0'));var util=require(_0xaacb('0x1'));var path=require('path');var timeout=require(_0xaacb('0x2'));var express=require(_0xaacb('0x3'));var router=express[_0xaacb('0x4')]();var fs_extra=require(_0xaacb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaacb('0x6'));var config=require(_0xaacb('0x7'));var controller=require('./chatWebsite.controller');router['get']('/',auth[_0xaacb('0x8')](),controller[_0xaacb('0x9')]);router[_0xaacb('0xa')](_0xaacb('0xb'),auth[_0xaacb('0x8')](),controller[_0xaacb('0xc')]);router[_0xaacb('0xa')](_0xaacb('0xd'),auth['isAuthenticated'](),controller[_0xaacb('0xe')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xaacb('0xf')]);router[_0xaacb('0xa')](_0xaacb('0x10'),auth[_0xaacb('0x8')](),controller[_0xaacb('0x11')]);router[_0xaacb('0xa')](_0xaacb('0x12'),controller[_0xaacb('0x13')]);router[_0xaacb('0xa')](_0xaacb('0x14'),controller[_0xaacb('0x15')]);router[_0xaacb('0xa')](_0xaacb('0x16'),controller[_0xaacb('0x17')]);router['get'](_0xaacb('0x18'),controller[_0xaacb('0x19')]);router[_0xaacb('0xa')](_0xaacb('0x1a'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xaacb('0x1b'),controller[_0xaacb('0x1c')]);router[_0xaacb('0xa')]('/:id/applications',auth[_0xaacb('0x8')](),controller['getApplications']);router[_0xaacb('0xa')](_0xaacb('0x1d'),auth[_0xaacb('0x8')](),controller[_0xaacb('0x1e')]);router['get']('/:id/fields',controller['getFields']);router['get'](_0xaacb('0x1f'),auth['isAuthenticated'](),controller[_0xaacb('0x20')]);router[_0xaacb('0xa')](_0xaacb('0x21'),auth[_0xaacb('0x8')](),controller[_0xaacb('0x22')]);router[_0xaacb('0x23')]('/',auth['isAuthenticated'](),controller[_0xaacb('0x24')]);router[_0xaacb('0x23')]('/:id/dispositions',auth[_0xaacb('0x8')](),controller[_0xaacb('0x25')]);router[_0xaacb('0x23')]('/:id/canned_answers',auth[_0xaacb('0x8')](),controller[_0xaacb('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x33984f,_0x2bd2d5,_0x208f36){_0x208f36(null,path[_0xaacb('0x27')](config[_0xaacb('0x28')],_0xaacb('0x29')));},'filename':function(_0x4f8525,_0x249d0e,_0x3f4eb8){_0x3f4eb8(null,util['format']('%s-%s',Date[_0xaacb('0x2a')](),_0x249d0e[_0xaacb('0x2b')]));}})});router['post'](_0xaacb('0x12'),upload[_0xaacb('0x2c')](_0xaacb('0x2d')),controller[_0xaacb('0x2e')]);var upload=multer({'storage':multer[_0xaacb('0x2f')]({'destination':function(_0x5126ca,_0x139ff4,_0x14eaa2){_0x14eaa2(null,path[_0xaacb('0x27')](config[_0xaacb('0x28')],_0xaacb('0x30')));},'filename':function(_0x35bbfb,_0xcb0562,_0x5e0c2b){_0x5e0c2b(null,util['format'](_0xaacb('0x31'),Date[_0xaacb('0x2a')](),_0xcb0562[_0xaacb('0x2b')]));}})});router[_0xaacb('0x23')](_0xaacb('0x14'),upload[_0xaacb('0x2c')](_0xaacb('0x2d')),controller[_0xaacb('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xeca509,_0x2796d7,_0xecce27){_0xecce27(null,path['join'](config['root'],_0xaacb('0x30')));},'filename':function(_0xbe2467,_0x3f72f7,_0x234a3b){_0x234a3b(null,util[_0xaacb('0x33')]('%s-%s',Date[_0xaacb('0x2a')](),_0x3f72f7['originalname']));}})});router[_0xaacb('0x23')](_0xaacb('0x16'),upload[_0xaacb('0x2c')]('file'),controller[_0xaacb('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x171917,_0x400de7,_0x86dc28){_0x86dc28(null,path[_0xaacb('0x27')](config[_0xaacb('0x28')],_0xaacb('0x30')));},'filename':function(_0x246a6a,_0x525733,_0x5ac8ff){_0x5ac8ff(null,util[_0xaacb('0x33')](_0xaacb('0x31'),Date[_0xaacb('0x2a')](),_0x525733[_0xaacb('0x2b')]));}})});router[_0xaacb('0x23')](_0xaacb('0x18'),upload[_0xaacb('0x2c')]('file'),controller[_0xaacb('0x35')]);router[_0xaacb('0x23')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2ec3f2,_0x1263a9,_0x3eec42){const _0x34c8af=path[_0xaacb('0x27')](config[_0xaacb('0x28')],_0xaacb('0x36'),'attachments',_0xaacb('0x37'));fs_extra[_0xaacb('0x38')](_0x34c8af,function(){_0x3eec42(null,_0x34c8af);});},'filename':function(_0x34cd00,_0x4b52ab,_0x188ea0){const _0x257048=_0x4b52ab[_0xaacb('0x2b')][_0xaacb('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a213b=path[_0xaacb('0x3a')](_0x257048);const _0x5056a6=Date['now']()+'-'+_0x257048[_0xaacb('0x39')](_0x2a213b,'')+_0x2a213b;_0x188ea0(null,_0x5056a6);}})});router[_0xaacb('0x23')](_0xaacb('0x3b'),offlineUploadMulter[_0xaacb('0x3c')](),controller[_0xaacb('0x3d')]);router['post']('/:id/interactions',auth[_0xaacb('0x8')](),controller['addInteraction']);router[_0xaacb('0x23')]('/:id/applications',auth[_0xaacb('0x8')](),controller[_0xaacb('0x3e')]);router[_0xaacb('0x23')]('/:id/proactive_actions',auth[_0xaacb('0x8')](),controller[_0xaacb('0x3f')]);router[_0xaacb('0x23')]('/:id/users',auth[_0xaacb('0x8')](),controller[_0xaacb('0x40')]);router[_0xaacb('0x41')](_0xaacb('0xd'),auth['isAuthenticated'](),controller[_0xaacb('0x42')]);router[_0xaacb('0x43')](_0xaacb('0xd'),auth[_0xaacb('0x8')](),controller[_0xaacb('0x44')]);router[_0xaacb('0x43')](_0xaacb('0x45'),auth[_0xaacb('0x8')](),controller[_0xaacb('0x46')]);router[_0xaacb('0x43')]('/:id/canned_answers',auth[_0xaacb('0x8')](),controller[_0xaacb('0x47')]);router[_0xaacb('0x43')](_0xaacb('0x21'),auth['isAuthenticated'](),controller[_0xaacb('0x48')]);module[_0xaacb('0x49')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index fdd674d..0a56903 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 _0x37f6=['expressEndpoint','/client-logs','use','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','get','Client-Side\x20logger\x20not\x20found!'];(function(_0x595808,_0x2a5dd0){var _0x4db818=function(_0x560899){while(--_0x560899){_0x595808['push'](_0x595808['shift']());}};_0x4db818(++_0x2a5dd0);}(_0x37f6,0x19b));var _0x637f=function(_0x487131,_0x2c86e8){_0x487131=_0x487131-0x0;var _0xf320ff=_0x37f6[_0x487131];return _0xf320ff;};var beaverLogger=require(_0x637f('0x0'));var express=require('express');var auth=require(_0x637f('0x1'));var config=require(_0x637f('0x2'));var router=express[_0x637f('0x3')]();var isProduction=config[_0x637f('0x4')]==='production'||![];function clientSideLogs(_0x8c82c8,_0x4c138b,_0xad6aea){var _0x3172f1=_0x8c82c8['app'][_0x637f('0x5')]('client-side-logger');if(!_0x3172f1){throw new Error(_0x637f('0x6'));}return beaverLogger[_0x637f('0x7')]({'uri':_0x637f('0x8'),'logger':_0x3172f1,'enableCors':!isProduction})(_0x8c82c8,_0x4c138b,_0xad6aea);}router[_0x637f('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x637f('0xa')]=router; \ No newline at end of file +var _0x996f=['beaver-logger/server','express','../components/auth/service','../config/environment','Router','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0x44cad0,_0x229ce2){var _0x360e6f=function(_0x5a185e){while(--_0x5a185e){_0x44cad0['push'](_0x44cad0['shift']());}};_0x360e6f(++_0x229ce2);}(_0x996f,0x117));var _0xf996=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x996f[_0x17d9e3];return _0x14192d;};var beaverLogger=require(_0xf996('0x0'));var express=require(_0xf996('0x1'));var auth=require(_0xf996('0x2'));var config=require(_0xf996('0x3'));var router=express[_0xf996('0x4')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x473c7f,_0x16f0d6,_0x3c4ffb){var _0xb4cc40=_0x473c7f['app'][_0xf996('0x5')](_0xf996('0x6'));if(!_0xb4cc40){throw new Error(_0xf996('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0xf996('0x8'),'logger':_0xb4cc40,'enableCors':!isProduction})(_0x473c7f,_0x16f0d6,_0x3c4ffb);}router['use'](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 3e81f7f..83bd21a 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 _0x8477=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x8477,0x69));var _0x7847=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x8477[_0x2aee2f];return _0x19337f;};'use strict';var Sequelize=require(_0x7847('0x0'));module[_0x7847('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7847('0x2')](_0x7847('0x3'),'Google',_0x7847('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x7847('0x2')](_0x7847('0x5'),_0x7847('0x6'))},'data1':{'type':Sequelize[_0x7847('0x7')],'comment':_0x7847('0x8')},'data2':{'type':Sequelize[_0x7847('0x7')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x7847('0x7')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x7847('0x7')],'comment':_0x7847('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x7847('0xa')],'comment':_0x7847('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0x7847('0xc')}}; \ No newline at end of file +var _0x0eaa=['sequelize','STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x3f60ce,_0x28c636){var _0x191f4f=function(_0x113a79){while(--_0x113a79){_0x3f60ce['push'](_0x3f60ce['shift']());}};_0x191f4f(++_0x28c636);}(_0x0eaa,0x9c));var _0xa0ea=function(_0x21273e,_0x29e20f){_0x21273e=_0x21273e-0x0;var _0x380679=_0x0eaa[_0x21273e];return _0x380679;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module['exports']={'name':{'type':Sequelize[_0xa0ea('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa0ea('0x2')](_0xa0ea('0x3'),_0xa0ea('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa0ea('0x2')](_0xa0ea('0x5'),_0xa0ea('0x6'))},'data1':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x7')},'data2':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x8')},'data3':{'type':Sequelize[_0xa0ea('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x9')},'data5':{'type':Sequelize[_0xa0ea('0xa')],'comment':_0xa0ea('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xa0ea('0xa')],'comment':_0xa0ea('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 80c7c80..a7bb38e 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 _0x9fe7=['undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','padEnd','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','filters','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','from','state','base64','ascii','isValidIdToken','oauth2Claims','del','code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset'];(function(_0x256454,_0x13d265){var _0x26172b=function(_0xce4ef9){while(--_0xce4ef9){_0x256454['push'](_0x256454['shift']());}};_0x26172b(++_0x13d265);}(_0x9fe7,0x1cb));var _0x79fe=function(_0x15c663,_0x1d67fd){_0x15c663=_0x15c663-0x0;var _0x1cd1a7=_0x9fe7[_0x15c663];return _0x1cd1a7;};'use strict';var _=require('lodash');var Redis=require(_0x79fe('0x0'));var qs=require(_0x79fe('0x1'));var encryptor=require(_0x79fe('0x2'));var config=require(_0x79fe('0x3'));var logger=require(_0x79fe('0x4'))(_0x79fe('0x5'));var db=require(_0x79fe('0x6'))['db'];var oauth=require(_0x79fe('0x7'));config[_0x79fe('0x8')]=_[_0x79fe('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x79fe('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x79fe('0x8')]);function respondWithStatusCode(_0x29c60e,_0x2a4c3d){_0x2a4c3d=_0x2a4c3d||0xcc;return function(_0x3b03d7){if(_0x3b03d7){return _0x29c60e[_0x79fe('0xb')](_0x2a4c3d);}return _0x29c60e[_0x79fe('0xc')](_0x2a4c3d)[_0x79fe('0xd')]();};}function respondWithResult(_0x44a7d3,_0x4bdaea){_0x4bdaea=_0x4bdaea||0xc8;return function(_0xa7a57a){if(_0xa7a57a){return _0x44a7d3[_0x79fe('0xc')](_0x4bdaea)[_0x79fe('0xe')](_0xa7a57a);}};}function respondWithFilteredResult(_0x4911c7,_0x1b9182){return function(_0x2b7c7a){if(_0x2b7c7a){var _0x44d5d0=typeof _0x1b9182[_0x79fe('0xf')]===_0x79fe('0x10')&&typeof _0x1b9182[_0x79fe('0x11')]===_0x79fe('0x10');var _0x34230e=_0x2b7c7a[_0x79fe('0x12')];var _0x5e3925=_0x44d5d0?0x0:_0x1b9182[_0x79fe('0xf')];var _0x5637ab=_0x44d5d0?_0x2b7c7a[_0x79fe('0x12')]:_0x1b9182[_0x79fe('0xf')]+_0x1b9182[_0x79fe('0x11')];var _0x317440;if(_0x5637ab>=_0x34230e){_0x5637ab=_0x34230e;_0x317440=0xc8;}else{_0x317440=0xce;}_0x4911c7[_0x79fe('0xc')](_0x317440);return _0x4911c7['set'](_0x79fe('0x13'),_0x5e3925+'-'+_0x5637ab+'/'+_0x34230e)[_0x79fe('0xe')](_0x2b7c7a);}return null;};}function saveUpdates(_0x4c0151){return function(_0x6081e6){if(_0x6081e6){return _0x6081e6[_0x79fe('0x14')](_0x4c0151)[_0x79fe('0x15')](function(_0x47466e){return _0x47466e;});}return null;};}function removeEntity(_0x3bed71){return function(_0x1ee774){if(_0x1ee774){return _0x1ee774[_0x79fe('0x16')]()[_0x79fe('0x15')](function(){_0x3bed71[_0x79fe('0xc')](0xcc)[_0x79fe('0xd')]();});}};}function handleEntityNotFound(_0xff0a5c){return function(_0x4a3c71){if(!_0x4a3c71){_0xff0a5c['sendStatus'](0x194);}return _0x4a3c71;};}function handleError(_0x1b11f7,_0x48c920){_0x48c920=_0x48c920||0x1f4;return function(_0x98cf4c){logger[_0x79fe('0x17')](_0x98cf4c[_0x79fe('0x18')]);if(_0x98cf4c[_0x79fe('0x19')]){delete _0x98cf4c[_0x79fe('0x19')];}_0x1b11f7['status'](_0x48c920)[_0x79fe('0x1a')](_0x98cf4c);};}function maskClientSecret(_0x5be6f5){return _[_0x79fe('0x1b')](_0x5be6f5['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x4cb45e,_0x1ef7f8){var _0x2b92ce={},_0x3ca7c5={},_0x4da1a1={'count':0x0,'rows':[]};var _0x30c831=_['map'](db[_0x79fe('0x1c')][_0x79fe('0x1d')],function(_0x3b70dc){return{'name':_0x3b70dc[_0x79fe('0x1e')],'type':_0x3b70dc[_0x79fe('0x1f')][_0x79fe('0x20')]};});_0x3ca7c5[_0x79fe('0x21')]=_[_0x79fe('0x22')](_0x30c831,_0x79fe('0x19'));_0x3ca7c5[_0x79fe('0x23')]=_['keys'](_0x4cb45e['query']);_0x3ca7c5['filters']=_[_0x79fe('0x24')](_0x3ca7c5[_0x79fe('0x21')],_0x3ca7c5[_0x79fe('0x23')]);_0x2b92ce[_0x79fe('0x25')]=_[_0x79fe('0x24')](_0x3ca7c5[_0x79fe('0x21')],qs[_0x79fe('0x26')](_0x4cb45e[_0x79fe('0x23')][_0x79fe('0x26')]));_0x2b92ce['attributes']=_0x2b92ce[_0x79fe('0x25')][_0x79fe('0x27')]?_0x2b92ce[_0x79fe('0x25')]:_0x3ca7c5[_0x79fe('0x21')];if(!_0x4cb45e[_0x79fe('0x23')][_0x79fe('0x28')](_0x79fe('0x29'))){_0x2b92ce['limit']=qs[_0x79fe('0x11')](_0x4cb45e['query'][_0x79fe('0x11')]);_0x2b92ce[_0x79fe('0xf')]=qs[_0x79fe('0xf')](_0x4cb45e['query'][_0x79fe('0xf')]);}_0x2b92ce['order']=qs[_0x79fe('0x2a')](_0x4cb45e[_0x79fe('0x23')][_0x79fe('0x2a')]);_0x2b92ce[_0x79fe('0x2b')]=qs['filters'](_[_0x79fe('0x2c')](_0x4cb45e[_0x79fe('0x23')],_0x3ca7c5['filters']),_0x30c831);if(_0x4cb45e[_0x79fe('0x23')][_0x79fe('0x2d')]){_0x2b92ce['where']=_[_0x79fe('0x2e')](_0x2b92ce[_0x79fe('0x2b')],{'$or':_['map'](_0x30c831,function(_0x21842e){if(_0x21842e[_0x79fe('0x1f')]!==_0x79fe('0x2f')){var _0xc5c049={};_0xc5c049[_0x21842e[_0x79fe('0x19')]]={'$like':'%'+_0x4cb45e['query'][_0x79fe('0x2d')]+'%'};return _0xc5c049;}})});}_0x2b92ce=_['merge']({},_0x2b92ce,_0x4cb45e['options']);var _0x1b4064={'where':_0x2b92ce['where']};return db['CloudProvider'][_0x79fe('0x12')](_0x1b4064)[_0x79fe('0x15')](function(_0x353490){_0x4da1a1[_0x79fe('0x12')]=_0x353490;if(_0x4cb45e[_0x79fe('0x23')][_0x79fe('0x30')]){_0x2b92ce[_0x79fe('0x31')]=[{'all':!![]}];}return db[_0x79fe('0x1c')][_0x79fe('0x32')](_0x2b92ce);})['then'](function(_0x307127){_0x4da1a1['rows']=_[_0x79fe('0x22')](_0x307127,function(_0x38f037){if(_0x38f037[_0x79fe('0x33')]===_0x79fe('0x34')){var _0x44edfe=encryptor[_0x79fe('0x35')](_0x38f037[_0x79fe('0x36')]);_0x38f037[_0x79fe('0x36')]=maskClientSecret(_0x44edfe);}return _0x38f037;});return _0x4da1a1;})[_0x79fe('0x15')](respondWithFilteredResult(_0x1ef7f8,_0x2b92ce))[_0x79fe('0x37')](handleError(_0x1ef7f8,null));};exports[_0x79fe('0x38')]=function(_0x48e6b6,_0x42b889){var _0x3d6486={'raw':!![],'where':{'id':_0x48e6b6[_0x79fe('0x39')]['id']}},_0x806f8c={};_0x806f8c['model']=_['keys'](db['CloudProvider'][_0x79fe('0x1d')]);_0x806f8c[_0x79fe('0x23')]=_[_0x79fe('0x3a')](_0x48e6b6[_0x79fe('0x23')]);_0x806f8c[_0x79fe('0x3b')]=_[_0x79fe('0x24')](_0x806f8c['model'],_0x806f8c[_0x79fe('0x23')]);_0x3d6486[_0x79fe('0x25')]=_[_0x79fe('0x24')](_0x806f8c[_0x79fe('0x21')],qs[_0x79fe('0x26')](_0x48e6b6[_0x79fe('0x23')]['fields']));_0x3d6486[_0x79fe('0x25')]=_0x3d6486[_0x79fe('0x25')]['length']?_0x3d6486[_0x79fe('0x25')]:_0x806f8c[_0x79fe('0x21')];if(_0x48e6b6['query']['includeAll']){_0x3d6486[_0x79fe('0x31')]=[{'all':!![]}];}_0x3d6486=_['merge']({},_0x3d6486,_0x48e6b6[_0x79fe('0x3c')]);return db['CloudProvider'][_0x79fe('0x3d')](_0x3d6486)[_0x79fe('0x15')](handleEntityNotFound(_0x42b889,null))['then'](function(_0xef580f){if(_0xef580f['service']===_0x79fe('0x34')){var _0x1de438=encryptor[_0x79fe('0x35')](_0xef580f[_0x79fe('0x36')]);_0xef580f[_0x79fe('0x36')]=maskClientSecret(_0x1de438);}return _0xef580f;})[_0x79fe('0x15')](respondWithResult(_0x42b889,null))['catch'](handleError(_0x42b889,null));};exports[_0x79fe('0x3e')]=function(_0x44a388,_0x5b7674){if(!_0x44a388[_0x79fe('0x3f')]['name'])throw new Error(_0x79fe('0x40'));if(!_0x44a388[_0x79fe('0x3f')][_0x79fe('0x33')])throw new Error(_0x79fe('0x41'));var _0x20844d=db['CloudProvider'][_0x79fe('0x1d')][_0x79fe('0x33')]['values'];if(!_0x20844d[_0x79fe('0x42')](_0x44a388[_0x79fe('0x3f')][_0x79fe('0x33')]))throw new Error(_0x79fe('0x43')+_0x20844d[_0x79fe('0x44')](',\x20'));if(_0x44a388[_0x79fe('0x3f')][_0x79fe('0x33')]===_0x79fe('0x34')&&_0x44a388[_0x79fe('0x3f')][_0x79fe('0x36')]){_0x44a388[_0x79fe('0x3f')]['data3']=encryptor[_0x79fe('0x45')](_0x44a388['body'][_0x79fe('0x36')]);}return db['CloudProvider'][_0x79fe('0x3e')](_0x44a388['body'],{})[_0x79fe('0x15')](respondWithResult(_0x5b7674,0xc9))[_0x79fe('0x37')](handleError(_0x5b7674,null));};exports[_0x79fe('0x14')]=function(_0xc3c6a9,_0x666aa1){if(_0xc3c6a9['body']['id']){delete _0xc3c6a9[_0x79fe('0x3f')]['id'];}return db[_0x79fe('0x1c')][_0x79fe('0x3d')]({'where':{'id':_0xc3c6a9[_0x79fe('0x39')]['id']}})[_0x79fe('0x15')](handleEntityNotFound(_0x666aa1,null))[_0x79fe('0x15')](function(_0x469686){if(_0x469686[_0x79fe('0x33')]===_0x79fe('0x34')&&_0xc3c6a9[_0x79fe('0x3f')][_0x79fe('0x36')]){_0xc3c6a9['body'][_0x79fe('0x36')]=encryptor['encryptString'](_0xc3c6a9['body'][_0x79fe('0x36')]);}return _0x469686;})['then'](saveUpdates(_0xc3c6a9[_0x79fe('0x3f')],null))[_0x79fe('0x15')](respondWithResult(_0x666aa1,null))[_0x79fe('0x37')](handleError(_0x666aa1,null));};exports[_0x79fe('0x16')]=function(_0xc4f798,_0x165c65){return db[_0x79fe('0x1c')][_0x79fe('0x3d')]({'where':{'id':_0xc4f798['params']['id']}})[_0x79fe('0x15')](handleEntityNotFound(_0x165c65,null))['then'](removeEntity(_0x165c65,null))[_0x79fe('0x37')](handleError(_0x165c65,null));};exports[_0x79fe('0x46')]=function(_0x4b3cb7,_0x1e89dc){return db[_0x79fe('0x1c')][_0x79fe('0x47')]({'where':{'id':_0x4b3cb7[_0x79fe('0x39')]['id']},'raw':!![]})[_0x79fe('0x15')](function(_0x53dd6c){if(!_0x53dd6c)return _0x1e89dc['sendStatus'](0x194);return{'url':oauth[_0x79fe('0x48')](_0x53dd6c,_0x4b3cb7[_0x79fe('0x49')]['id'])};})[_0x79fe('0x15')](respondWithResult(_0x1e89dc,null))[_0x79fe('0x37')](handleError(_0x1e89dc,null));};exports['oauth2MicrosoftCallback']=function(_0x1a13f7,_0x5cc57e){var _0x25f5b9=_0x1a13f7[_0x79fe('0x3f')];var _0x531770;var _0x1fc46a;if(_0x25f5b9[_0x79fe('0x17')])throw _0x25f5b9;redis[_0x79fe('0x4a')](_0x25f5b9['state'])[_0x79fe('0x15')](function(_0x9ba262){if(!_0x9ba262)throw new Error(_0x79fe('0x4b'));_0x531770=JSON[_0x79fe('0x4c')](_0x9ba262);var _0x4def11=Buffer[_0x79fe('0x4d')](_0x25f5b9[_0x79fe('0x4e')],_0x79fe('0x4f'))['toString'](_0x79fe('0x50'));_0x1fc46a=JSON[_0x79fe('0x4c')](_0x4def11);if(!oauth[_0x79fe('0x51')](_0x25f5b9['id_token'],_0x531770[_0x79fe('0x52')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x79fe('0x53')](_0x25f5b9['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x25f5b9[_0x79fe('0x54')],_0x531770);})[_0x79fe('0x15')](function(_0x12eb4d){_0x531770[_0x79fe('0x55')]=_0x12eb4d['access_token'];_0x531770[_0x79fe('0x56')]=_0x12eb4d[_0x79fe('0x57')];return db[_0x79fe('0x1c')]['update']({'data5':_0x531770[_0x79fe('0x55')],'data6':_0x531770[_0x79fe('0x56')]},{'where':{'id':_0x531770['id']}});})[_0x79fe('0x15')](function(){oauth[_0x79fe('0x58')](_0x531770);socket['emit'](_0x79fe('0x59'),{'id':_0x1fc46a['id']});return;})['then'](respondWithStatusCode(_0x5cc57e,null))[_0x79fe('0x37')](function(_0x3573de){if(_0x1fc46a){socket[_0x79fe('0x5a')](_0x79fe('0x5b'),{'id':_0x1fc46a['id']});}if(!_0x531770){logger[_0x79fe('0x17')](_0x79fe('0x5c'),_0x3573de);return _0x5cc57e[_0x79fe('0xc')](0x1f4)[_0x79fe('0x1a')](_0x3573de[_0x79fe('0x5d')]);}logger[_0x79fe('0x17')](_0x79fe('0x5e'),_0x531770['id'],JSON['stringify'](_0x3573de));});}; \ No newline at end of file +var _0xa8e7=['message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','destroy','then','error','stack','name','send','slice','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','rows','service','decryptString','data3','catch','show','params','CloudProvider','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','join','MicrosoftAzure','encryptString','update','findOne','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:error'];(function(_0x32e320,_0x2ad238){var _0x1728d8=function(_0x15890c){while(--_0x15890c){_0x32e320['push'](_0x32e320['shift']());}};_0x1728d8(++_0x2ad238);}(_0xa8e7,0xbb));var _0x7a8e=function(_0x216948,_0xf6d435){_0x216948=_0x216948-0x0;var _0xeea7d8=_0xa8e7[_0x216948];return _0xeea7d8;};'use strict';var _=require(_0x7a8e('0x0'));var Redis=require('ioredis');var qs=require(_0x7a8e('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0x7a8e('0x2'));var logger=require(_0x7a8e('0x3'))(_0x7a8e('0x4'));var db=require(_0x7a8e('0x5'))['db'];var oauth=require(_0x7a8e('0x6'));config['redis']=_[_0x7a8e('0x7')](config[_0x7a8e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a8e('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x7a8e('0x8')]);function respondWithStatusCode(_0x11f81b,_0x18af3a){_0x18af3a=_0x18af3a||0xcc;return function(_0x12bbc2){if(_0x12bbc2){return _0x11f81b[_0x7a8e('0xa')](_0x18af3a);}return _0x11f81b[_0x7a8e('0xb')](_0x18af3a)[_0x7a8e('0xc')]();};}function respondWithResult(_0x5e5cc2,_0x460d0e){_0x460d0e=_0x460d0e||0xc8;return function(_0x587dda){if(_0x587dda){return _0x5e5cc2[_0x7a8e('0xb')](_0x460d0e)['json'](_0x587dda);}};}function respondWithFilteredResult(_0x14ef3b,_0x5d8fbe){return function(_0x4f41a1){if(_0x4f41a1){var _0x392cda=typeof _0x5d8fbe[_0x7a8e('0xd')]===_0x7a8e('0xe')&&typeof _0x5d8fbe[_0x7a8e('0xf')]===_0x7a8e('0xe');var _0x4330c6=_0x4f41a1[_0x7a8e('0x10')];var _0x4d9d1d=_0x392cda?0x0:_0x5d8fbe[_0x7a8e('0xd')];var _0x53227a=_0x392cda?_0x4f41a1[_0x7a8e('0x10')]:_0x5d8fbe['offset']+_0x5d8fbe['limit'];var _0x38ee9f;if(_0x53227a>=_0x4330c6){_0x53227a=_0x4330c6;_0x38ee9f=0xc8;}else{_0x38ee9f=0xce;}_0x14ef3b[_0x7a8e('0xb')](_0x38ee9f);return _0x14ef3b['set'](_0x7a8e('0x11'),_0x4d9d1d+'-'+_0x53227a+'/'+_0x4330c6)[_0x7a8e('0x12')](_0x4f41a1);}return null;};}function saveUpdates(_0x1183f7){return function(_0x5513fb){if(_0x5513fb){return _0x5513fb['update'](_0x1183f7)['then'](function(_0x3f8090){return _0x3f8090;});}return null;};}function removeEntity(_0x437c90){return function(_0x543b8b){if(_0x543b8b){return _0x543b8b[_0x7a8e('0x13')]()[_0x7a8e('0x14')](function(){_0x437c90[_0x7a8e('0xb')](0xcc)[_0x7a8e('0xc')]();});}};}function handleEntityNotFound(_0x2b6237){return function(_0x56beb1){if(!_0x56beb1){_0x2b6237['sendStatus'](0x194);}return _0x56beb1;};}function handleError(_0x9de9ad,_0x396606){_0x396606=_0x396606||0x1f4;return function(_0x3b3710){logger[_0x7a8e('0x15')](_0x3b3710[_0x7a8e('0x16')]);if(_0x3b3710[_0x7a8e('0x17')]){delete _0x3b3710[_0x7a8e('0x17')];}_0x9de9ad[_0x7a8e('0xb')](_0x396606)[_0x7a8e('0x18')](_0x3b3710);};}function maskClientSecret(_0x5da981){return _['padEnd'](_0x5da981[_0x7a8e('0x19')](0x0,0x3),0x14,'*');}exports[_0x7a8e('0x1a')]=function(_0x2743d3,_0x4b6f59){var _0x14b6d0={},_0x5d7eb0={},_0x683a5c={'count':0x0,'rows':[]};var _0xd9642a=_['map'](db['CloudProvider'][_0x7a8e('0x1b')],function(_0x547c96){return{'name':_0x547c96[_0x7a8e('0x1c')],'type':_0x547c96[_0x7a8e('0x1d')][_0x7a8e('0x1e')]};});_0x5d7eb0[_0x7a8e('0x1f')]=_[_0x7a8e('0x20')](_0xd9642a,_0x7a8e('0x17'));_0x5d7eb0[_0x7a8e('0x21')]=_[_0x7a8e('0x22')](_0x2743d3[_0x7a8e('0x21')]);_0x5d7eb0[_0x7a8e('0x23')]=_[_0x7a8e('0x24')](_0x5d7eb0[_0x7a8e('0x1f')],_0x5d7eb0[_0x7a8e('0x21')]);_0x14b6d0[_0x7a8e('0x25')]=_[_0x7a8e('0x24')](_0x5d7eb0[_0x7a8e('0x1f')],qs[_0x7a8e('0x26')](_0x2743d3['query']['fields']));_0x14b6d0[_0x7a8e('0x25')]=_0x14b6d0['attributes'][_0x7a8e('0x27')]?_0x14b6d0[_0x7a8e('0x25')]:_0x5d7eb0[_0x7a8e('0x1f')];if(!_0x2743d3[_0x7a8e('0x21')][_0x7a8e('0x28')](_0x7a8e('0x29'))){_0x14b6d0[_0x7a8e('0xf')]=qs['limit'](_0x2743d3['query']['limit']);_0x14b6d0[_0x7a8e('0xd')]=qs['offset'](_0x2743d3[_0x7a8e('0x21')]['offset']);}_0x14b6d0['order']=qs['sort'](_0x2743d3[_0x7a8e('0x21')][_0x7a8e('0x2a')]);_0x14b6d0['where']=qs[_0x7a8e('0x23')](_[_0x7a8e('0x2b')](_0x2743d3[_0x7a8e('0x21')],_0x5d7eb0[_0x7a8e('0x23')]),_0xd9642a);if(_0x2743d3[_0x7a8e('0x21')][_0x7a8e('0x2c')]){_0x14b6d0['where']=_[_0x7a8e('0x2d')](_0x14b6d0[_0x7a8e('0x2e')],{'$or':_['map'](_0xd9642a,function(_0x28bccd){if(_0x28bccd[_0x7a8e('0x1d')]!=='VIRTUAL'){var _0x3c062b={};_0x3c062b[_0x28bccd[_0x7a8e('0x17')]]={'$like':'%'+_0x2743d3[_0x7a8e('0x21')]['filter']+'%'};return _0x3c062b;}})});}_0x14b6d0=_['merge']({},_0x14b6d0,_0x2743d3['options']);var _0x2fc195={'where':_0x14b6d0[_0x7a8e('0x2e')]};return db['CloudProvider']['count'](_0x2fc195)[_0x7a8e('0x14')](function(_0x3d77c1){_0x683a5c[_0x7a8e('0x10')]=_0x3d77c1;if(_0x2743d3[_0x7a8e('0x21')][_0x7a8e('0x2f')]){_0x14b6d0[_0x7a8e('0x30')]=[{'all':!![]}];}return db['CloudProvider'][_0x7a8e('0x31')](_0x14b6d0);})[_0x7a8e('0x14')](function(_0xed8eec){_0x683a5c[_0x7a8e('0x32')]=_[_0x7a8e('0x20')](_0xed8eec,function(_0x521247){if(_0x521247[_0x7a8e('0x33')]==='MicrosoftAzure'){var _0x1c50bf=encryptor[_0x7a8e('0x34')](_0x521247[_0x7a8e('0x35')]);_0x521247[_0x7a8e('0x35')]=maskClientSecret(_0x1c50bf);}return _0x521247;});return _0x683a5c;})['then'](respondWithFilteredResult(_0x4b6f59,_0x14b6d0))[_0x7a8e('0x36')](handleError(_0x4b6f59,null));};exports[_0x7a8e('0x37')]=function(_0x1fae17,_0x1049b1){var _0x5116ca={'raw':!![],'where':{'id':_0x1fae17[_0x7a8e('0x38')]['id']}},_0x449c1b={};_0x449c1b[_0x7a8e('0x1f')]=_[_0x7a8e('0x22')](db[_0x7a8e('0x39')]['rawAttributes']);_0x449c1b['query']=_[_0x7a8e('0x22')](_0x1fae17[_0x7a8e('0x21')]);_0x449c1b[_0x7a8e('0x23')]=_['intersection'](_0x449c1b[_0x7a8e('0x1f')],_0x449c1b[_0x7a8e('0x21')]);_0x5116ca['attributes']=_[_0x7a8e('0x24')](_0x449c1b[_0x7a8e('0x1f')],qs['fields'](_0x1fae17['query'][_0x7a8e('0x26')]));_0x5116ca[_0x7a8e('0x25')]=_0x5116ca[_0x7a8e('0x25')][_0x7a8e('0x27')]?_0x5116ca[_0x7a8e('0x25')]:_0x449c1b[_0x7a8e('0x1f')];if(_0x1fae17[_0x7a8e('0x21')][_0x7a8e('0x2f')]){_0x5116ca['include']=[{'all':!![]}];}_0x5116ca=_[_0x7a8e('0x2d')]({},_0x5116ca,_0x1fae17[_0x7a8e('0x3a')]);return db[_0x7a8e('0x39')][_0x7a8e('0x3b')](_0x5116ca)[_0x7a8e('0x14')](handleEntityNotFound(_0x1049b1,null))[_0x7a8e('0x14')](function(_0x37c626){if(_0x37c626[_0x7a8e('0x33')]==='MicrosoftAzure'){var _0x3e2483=encryptor[_0x7a8e('0x34')](_0x37c626[_0x7a8e('0x35')]);_0x37c626[_0x7a8e('0x35')]=maskClientSecret(_0x3e2483);}return _0x37c626;})[_0x7a8e('0x14')](respondWithResult(_0x1049b1,null))[_0x7a8e('0x36')](handleError(_0x1049b1,null));};exports[_0x7a8e('0x3c')]=function(_0x1a4818,_0x9a589e){if(!_0x1a4818[_0x7a8e('0x3d')][_0x7a8e('0x17')])throw new Error(_0x7a8e('0x3e'));if(!_0x1a4818[_0x7a8e('0x3d')][_0x7a8e('0x33')])throw new Error(_0x7a8e('0x3f'));var _0x2c5609=db[_0x7a8e('0x39')][_0x7a8e('0x1b')]['service'][_0x7a8e('0x40')];if(!_0x2c5609[_0x7a8e('0x41')](_0x1a4818[_0x7a8e('0x3d')][_0x7a8e('0x33')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x2c5609[_0x7a8e('0x42')](',\x20'));if(_0x1a4818[_0x7a8e('0x3d')][_0x7a8e('0x33')]===_0x7a8e('0x43')&&_0x1a4818['body'][_0x7a8e('0x35')]){_0x1a4818[_0x7a8e('0x3d')][_0x7a8e('0x35')]=encryptor[_0x7a8e('0x44')](_0x1a4818[_0x7a8e('0x3d')]['data3']);}return db[_0x7a8e('0x39')][_0x7a8e('0x3c')](_0x1a4818[_0x7a8e('0x3d')],{})[_0x7a8e('0x14')](respondWithResult(_0x9a589e,0xc9))[_0x7a8e('0x36')](handleError(_0x9a589e,null));};exports[_0x7a8e('0x45')]=function(_0x30c612,_0x14258d){if(_0x30c612[_0x7a8e('0x3d')]['id']){delete _0x30c612[_0x7a8e('0x3d')]['id'];}return db[_0x7a8e('0x39')][_0x7a8e('0x3b')]({'where':{'id':_0x30c612['params']['id']}})[_0x7a8e('0x14')](handleEntityNotFound(_0x14258d,null))[_0x7a8e('0x14')](function(_0xa9174){if(_0xa9174[_0x7a8e('0x33')]===_0x7a8e('0x43')&&_0x30c612[_0x7a8e('0x3d')][_0x7a8e('0x35')]){_0x30c612[_0x7a8e('0x3d')]['data3']=encryptor[_0x7a8e('0x44')](_0x30c612['body'][_0x7a8e('0x35')]);}return _0xa9174;})['then'](saveUpdates(_0x30c612[_0x7a8e('0x3d')],null))['then'](respondWithResult(_0x14258d,null))[_0x7a8e('0x36')](handleError(_0x14258d,null));};exports[_0x7a8e('0x13')]=function(_0x49342f,_0x3c4e69){return db[_0x7a8e('0x39')][_0x7a8e('0x3b')]({'where':{'id':_0x49342f[_0x7a8e('0x38')]['id']}})[_0x7a8e('0x14')](handleEntityNotFound(_0x3c4e69,null))[_0x7a8e('0x14')](removeEntity(_0x3c4e69,null))['catch'](handleError(_0x3c4e69,null));};exports['oauth2MicrosoftAuthorize']=function(_0x3528bf,_0x3ece9c){return db[_0x7a8e('0x39')][_0x7a8e('0x46')]({'where':{'id':_0x3528bf['params']['id']},'raw':!![]})[_0x7a8e('0x14')](function(_0x31ccbc){if(!_0x31ccbc)return _0x3ece9c[_0x7a8e('0xa')](0x194);return{'url':oauth[_0x7a8e('0x47')](_0x31ccbc,_0x3528bf[_0x7a8e('0x48')]['id'])};})[_0x7a8e('0x14')](respondWithResult(_0x3ece9c,null))[_0x7a8e('0x36')](handleError(_0x3ece9c,null));};exports['oauth2MicrosoftCallback']=function(_0x2661a9,_0x5ed0a1){var _0x1bd797=_0x2661a9[_0x7a8e('0x3d')];var _0x2d84e8;var _0x395b06;if(_0x1bd797[_0x7a8e('0x15')])throw _0x1bd797;redis[_0x7a8e('0x49')](_0x1bd797['state'])['then'](function(_0x48b295){if(!_0x48b295)throw new Error(_0x7a8e('0x4a'));_0x2d84e8=JSON[_0x7a8e('0x4b')](_0x48b295);var _0x5f31bb=Buffer[_0x7a8e('0x4c')](_0x1bd797['state'],_0x7a8e('0x4d'))['toString']('ascii');_0x395b06=JSON['parse'](_0x5f31bb);if(!oauth[_0x7a8e('0x4e')](_0x1bd797['id_token'],_0x2d84e8[_0x7a8e('0x4f')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x7a8e('0x50')](_0x1bd797['state']);return oauth[_0x7a8e('0x51')](_0x1bd797['code'],_0x2d84e8);})['then'](function(_0xd542ce){_0x2d84e8['data5']=_0xd542ce[_0x7a8e('0x52')];_0x2d84e8[_0x7a8e('0x53')]=_0xd542ce[_0x7a8e('0x54')];return db[_0x7a8e('0x39')][_0x7a8e('0x45')]({'data5':_0x2d84e8[_0x7a8e('0x55')],'data6':_0x2d84e8[_0x7a8e('0x53')]},{'where':{'id':_0x2d84e8['id']}});})['then'](function(){oauth[_0x7a8e('0x56')](_0x2d84e8);socket[_0x7a8e('0x57')]('microsoftAuthorization:success',{'id':_0x395b06['id']});return;})[_0x7a8e('0x14')](respondWithStatusCode(_0x5ed0a1,null))[_0x7a8e('0x36')](function(_0x39ad2f){if(_0x395b06){socket[_0x7a8e('0x57')](_0x7a8e('0x58'),{'id':_0x395b06['id']});}if(!_0x2d84e8){logger[_0x7a8e('0x15')]('Invalid\x20authentication\x20state\x20parameter',_0x39ad2f);return _0x5ed0a1[_0x7a8e('0xb')](0x1f4)[_0x7a8e('0x18')](_0x39ad2f[_0x7a8e('0x59')]);}logger[_0x7a8e('0x15')](_0x7a8e('0x5a'),_0x2d84e8['id'],JSON[_0x7a8e('0x5b')](_0x39ad2f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 858151d..1422848 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 _0x255f=['../../config/environment','./cloudProvider.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x42a5df,_0x363535){var _0x1c7939=function(_0x3723bb){while(--_0x3723bb){_0x42a5df['push'](_0x42a5df['shift']());}};_0x1c7939(++_0x363535);}(_0x255f,0x185));var _0xf255=function(_0x4078f2,_0x1c4054){_0x4078f2=_0x4078f2-0x0;var _0xc72235=_0x255f[_0x4078f2];return _0xc72235;};'use strict';var _=require(_0xf255('0x0'));var util=require('util');var logger=require(_0xf255('0x1'))(_0xf255('0x2'));var moment=require(_0xf255('0x3'));var BPromise=require('bluebird');var rp=require(_0xf255('0x4'));var fs=require('fs');var path=require(_0xf255('0x5'));var rimraf=require(_0xf255('0x6'));var config=require(_0xf255('0x7'));var attributes=require(_0xf255('0x8'));module[_0xf255('0x9')]=function(_0xc1d19f,_0x5bbed0){return _0xc1d19f[_0xf255('0xa')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa23e=['cloud_providers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0xcb5d1,_0x453ddd){var _0x1fa45e=function(_0x1e2eb1){while(--_0x1e2eb1){_0xcb5d1['push'](_0xcb5d1['shift']());}};_0x1fa45e(++_0x453ddd);}(_0xa23e,0x1e1));var _0xea23=function(_0x298259,_0xeb3a87){_0x298259=_0x298259-0x0;var _0x2ffc2e=_0xa23e[_0x298259];return _0x2ffc2e;};'use strict';var _=require(_0xea23('0x0'));var util=require(_0xea23('0x1'));var logger=require(_0xea23('0x2'))('api');var moment=require(_0xea23('0x3'));var BPromise=require('bluebird');var rp=require(_0xea23('0x4'));var fs=require('fs');var path=require(_0xea23('0x5'));var rimraf=require(_0xea23('0x6'));var config=require('../../config/environment');var attributes=require(_0xea23('0x7'));module[_0xea23('0x8')]=function(_0x13e57d,_0x57f90c){return _0x13e57d[_0xea23('0x9')](_0xea23('0xa'),attributes,{'tableName':_0xea23('0xb'),'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 b730b2c..51bb291 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 _0x1acc=['lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','map','type','Dynamics365','data7','/.default','Outlook365','{TENANT_ID}','data2','code','from','stringify','toString','base64','randomBytes','hex','response_type','redirect_uri','form_post','scope','nonce','prompt','login','key','join','oauth2Claims','replace','oauth2/','data1','iss','issuer','aud','audience','isAfter','unix','resolve','data3','CloudProvider','then','refresh_token','data6','data4','decryptString','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','intervals','findAll','all','inspect','exports'];(function(_0x1c1747,_0x5ee61a){var _0x389ff3=function(_0x164bab){while(--_0x164bab){_0x1c1747['push'](_0x1c1747['shift']());}};_0x389ff3(++_0x5ee61a);}(_0x1acc,0x98));var _0xc1ac=function(_0x242e4b,_0x4fecfb){_0x242e4b=_0x242e4b-0x0;var _0x3e8438=_0x1acc[_0x242e4b];return _0x3e8438;};'use strict';var _=require(_0xc1ac('0x0'));var crypto=require('crypto');var jwt=require(_0xc1ac('0x1'));var moment=require(_0xc1ac('0x2'));var Redis=require(_0xc1ac('0x3'));var rp=require(_0xc1ac('0x4'));var util=require(_0xc1ac('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0xc1ac('0x6'));var logger=require('../../config/logger')(_0xc1ac('0x7'));var schedule=require(_0xc1ac('0x8'));var db=require(_0xc1ac('0x9'))['db'];config[_0xc1ac('0xa')]=_[_0xc1ac('0xb')](config[_0xc1ac('0xa')],{'host':_0xc1ac('0xc'),'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':[_0xc1ac('0xd'),_0xc1ac('0xe'),_0xc1ac('0xf'),'offline_access',_0xc1ac('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0xc1ac('0x11')],'Dynamics365':['openid',_0xc1ac('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0xc1ac('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xc1ac('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x12ccd9){var _0x1c96f4=_[_0xc1ac('0x15')](AZURE_AUTH_SCOPES[_0x12ccd9[_0xc1ac('0x16')]]);if(_0x12ccd9[_0xc1ac('0x16')]===_0xc1ac('0x17'))_0x1c96f4['push'](_0x12ccd9[_0xc1ac('0x18')]+_0xc1ac('0x19'));return _0x1c96f4['join']('\x20');}function getAccessTokenScope(_0x2ec098){if(_0x2ec098[_0xc1ac('0x16')]===_0xc1ac('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x2ec098[_0xc1ac('0x16')]===_0xc1ac('0x17'))return _0x2ec098[_0xc1ac('0x18')]+_0xc1ac('0x19');}function generateMicrosoftAuthorizationUrl(_0x53881a,_0x2d84aa){var _0x5ec7f2=MICROSOFT_AUTH_URL['replace'](_0xc1ac('0x1b'),_0x53881a[_0xc1ac('0x1c')]);var _0x494d56=[_0xc1ac('0x1d'),'id_token'];var _0x16f21a=Buffer[_0xc1ac('0x1e')](JSON[_0xc1ac('0x1f')]({'id':_0x2d84aa}))[_0xc1ac('0x20')](_0xc1ac('0x21'));var _0x704798=crypto[_0xc1ac('0x22')](0x10)[_0xc1ac('0x20')](_0xc1ac('0x23'));var _0x47dd66=getAuthorizationScopes(_0x53881a);var _0x1bc553=[{'key':'client_id','value':_0x53881a['data1']},{'key':_0xc1ac('0x24'),'value':encodeURIComponent(_0x494d56['join']('\x20'))},{'key':_0xc1ac('0x25'),'value':_0x53881a['data4']},{'key':'response_mode','value':_0xc1ac('0x26')},{'key':_0xc1ac('0x27'),'value':encodeURIComponent(_0x47dd66)},{'key':'state','value':_0x16f21a},{'key':_0xc1ac('0x28'),'value':_0x704798},{'key':_0xc1ac('0x29'),'value':_0xc1ac('0x2a')}];var _0x3031f9=_0x5ec7f2+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xc1ac('0x15')](_0x1bc553,function(_0x2fc770){return _0x2fc770[_0xc1ac('0x2b')]+'='+_0x2fc770['value'];})[_0xc1ac('0x2c')]('&');_0x53881a[_0xc1ac('0x2d')]={'issuer':_0x5ec7f2[_0xc1ac('0x2e')](_0xc1ac('0x2f'),''),'audience':_0x53881a[_0xc1ac('0x30')],'state':_0x16f21a,'nonce':_0x704798};redis['set'](_0x16f21a,JSON[_0xc1ac('0x1f')](_0x53881a));return _0x3031f9;}function isValidIdToken(_0x35b537,_0x1541f7){try{var _0x159f55=jwt['decode'](_0x35b537,{'complete':!![]});var _0x21bd0c=_0x159f55['payload'];if(_0x21bd0c[_0xc1ac('0x31')]!==_0x1541f7[_0xc1ac('0x32')])return![];if(_0x21bd0c[_0xc1ac('0x33')]!==_0x1541f7[_0xc1ac('0x34')])return![];if(_0x21bd0c['nonce']!==_0x1541f7[_0xc1ac('0x28')])return![];if(moment()[_0xc1ac('0x35')](moment[_0xc1ac('0x36')](_0x21bd0c['exp'])))return![];return!![];}catch(_0x4d4f8c){throw _0x4d4f8c;}}function refreshOauth2MicrosoftAccessToken(_0x632e71){return Promise[_0xc1ac('0x37')]()['then'](function(){if(_0x632e71[_0xc1ac('0x38')])return _0x632e71;return db[_0xc1ac('0x39')]['findOne']({'where':{'id':_0x632e71['id']},'raw':!![]});})[_0xc1ac('0x3a')](function(_0x3d9e68){var _0x231e76={'grant_type':_0xc1ac('0x3b'),'refresh_token':_0x3d9e68[_0xc1ac('0x3c')],'scope':getAccessTokenScope(_0x3d9e68),'redirect_uri':_0x3d9e68[_0xc1ac('0x3d')],'client_id':_0x3d9e68[_0xc1ac('0x30')],'client_secret':encryptor[_0xc1ac('0x3e')](_0x3d9e68[_0xc1ac('0x38')])};var _0x1a00a7={'method':_0xc1ac('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xc1ac('0x2e')](_0xc1ac('0x1b'),_0x3d9e68[_0xc1ac('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x231e76,'json':!![]};return rp(_0x1a00a7);})[_0xc1ac('0x3a')](function(_0x578c51){_0x632e71[_0xc1ac('0x40')]=_0x578c51[_0xc1ac('0x41')];_0x632e71['data6']=_0x578c51[_0xc1ac('0x3b')];return db['CloudProvider'][_0xc1ac('0x42')]({'data5':_0x632e71[_0xc1ac('0x40')],'data6':_0x632e71[_0xc1ac('0x3c')]},{'where':{'id':_0x632e71['id']}});})[_0xc1ac('0x3a')](function(){return _0x632e71;})[_0xc1ac('0x43')](function(_0x571204){logger[_0xc1ac('0x44')](_0xc1ac('0x45'),_0x632e71['id'],_0x571204);});}function getOauth2MicrosoftAccessToken(_0x5e48f4,_0x17645f){var _0x312ca9={'grant_type':'authorization_code','code':_0x5e48f4,'scope':getAccessTokenScope(_0x17645f),'redirect_uri':_0x17645f['data4'],'client_id':_0x17645f[_0xc1ac('0x30')],'client_secret':encryptor[_0xc1ac('0x3e')](_0x17645f[_0xc1ac('0x38')])};var _0x25dba0={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc1ac('0x2e')]('{TENANT_ID}',_0x17645f[_0xc1ac('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x312ca9,'json':!![]};return rp(_0x25dba0);}function startRefreshInterval(_0xbaf531){var _0x26d26b=schedule['intervals'];if(_0x26d26b[_0xbaf531['id']])clearInterval(_0x26d26b[_0xbaf531['id']]);_0x26d26b[_0xbaf531['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xc1ac('0x46')](this,{'id':_0xbaf531['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xc1ac('0x47')]=_0x26d26b;}function startAllRefreshIntervals(){return db[_0xc1ac('0x39')][_0xc1ac('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc1ac('0x3a')](function(_0x1acffc){var _0x247a0e=_0x1acffc[_0xc1ac('0x15')](function(_0x4671e5){return refreshOauth2MicrosoftAccessToken(_0x4671e5)[_0xc1ac('0x3a')](function(_0x55768b){startRefreshInterval(_0x55768b);});});return Promise[_0xc1ac('0x49')](_0x247a0e);})[_0xc1ac('0x43')](function(_0x19bae6){var _0x513a95=_0x19bae6?util[_0xc1ac('0x4a')](_0x19bae6,{'showHidden':![],'depth':null}):'';logger[_0xc1ac('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x513a95);});}module[_0xc1ac('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xce68=['{TENANT_ID}','intervals','bind','findAll','all','error','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','Dynamics365','push','data7','/.default','Outlook365','replace','data2','from','stringify','toString','hex','client_id','data1','redirect_uri','data4','scope','state','nonce','login','map','key','value','join','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','isAfter','unix','exp','then','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','access_token','update','data5','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code'];(function(_0x18f12c,_0x46e6d0){var _0x4f9382=function(_0x395bd3){while(--_0x395bd3){_0x18f12c['push'](_0x18f12c['shift']());}};_0x4f9382(++_0x46e6d0);}(_0xce68,0xa1));var _0x8ce6=function(_0x2b44ba,_0xa823cc){_0x2b44ba=_0x2b44ba-0x0;var _0xb20c1c=_0xce68[_0x2b44ba];return _0xb20c1c;};'use strict';var _=require(_0x8ce6('0x0'));var crypto=require(_0x8ce6('0x1'));var jwt=require(_0x8ce6('0x2'));var moment=require(_0x8ce6('0x3'));var Redis=require(_0x8ce6('0x4'));var rp=require(_0x8ce6('0x5'));var util=require(_0x8ce6('0x6'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x8ce6('0x7'))(_0x8ce6('0x8'));var schedule=require(_0x8ce6('0x9'));var db=require(_0x8ce6('0xa'))['db'];config['redis']=_[_0x8ce6('0xb')](config[_0x8ce6('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8ce6('0xc')]);var MICROSOFT_AUTH_URL=_0x8ce6('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8ce6('0xe'),_0x8ce6('0xf'),_0x8ce6('0x10'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All',_0x8ce6('0x11'),_0x8ce6('0x12')],'Dynamics365':[_0x8ce6('0xe'),_0x8ce6('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x8ce6('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x8ce6('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x44860b){var _0x328183=_['map'](AZURE_AUTH_SCOPES[_0x44860b[_0x8ce6('0x16')]]);if(_0x44860b[_0x8ce6('0x16')]===_0x8ce6('0x17'))_0x328183[_0x8ce6('0x18')](_0x44860b[_0x8ce6('0x19')]+_0x8ce6('0x1a'));return _0x328183['join']('\x20');}function getAccessTokenScope(_0x2efdb0){if(_0x2efdb0[_0x8ce6('0x16')]===_0x8ce6('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x2efdb0['type']===_0x8ce6('0x17'))return _0x2efdb0[_0x8ce6('0x19')]+_0x8ce6('0x1a');}function generateMicrosoftAuthorizationUrl(_0x1757c7,_0x38d71d){var _0x5a94fd=MICROSOFT_AUTH_URL[_0x8ce6('0x1c')]('{TENANT_ID}',_0x1757c7[_0x8ce6('0x1d')]);var _0x5c79bc=['code','id_token'];var _0x3aaec9=Buffer[_0x8ce6('0x1e')](JSON[_0x8ce6('0x1f')]({'id':_0x38d71d}))['toString']('base64');var _0x30c4bd=crypto['randomBytes'](0x10)[_0x8ce6('0x20')](_0x8ce6('0x21'));var _0x21805b=getAuthorizationScopes(_0x1757c7);var _0x3a7ba0=[{'key':_0x8ce6('0x22'),'value':_0x1757c7[_0x8ce6('0x23')]},{'key':'response_type','value':encodeURIComponent(_0x5c79bc['join']('\x20'))},{'key':_0x8ce6('0x24'),'value':_0x1757c7[_0x8ce6('0x25')]},{'key':'response_mode','value':'form_post'},{'key':_0x8ce6('0x26'),'value':encodeURIComponent(_0x21805b)},{'key':_0x8ce6('0x27'),'value':_0x3aaec9},{'key':_0x8ce6('0x28'),'value':_0x30c4bd},{'key':'prompt','value':_0x8ce6('0x29')}];var _0x3c6df3=_0x5a94fd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8ce6('0x2a')](_0x3a7ba0,function(_0x3ceb3b){return _0x3ceb3b[_0x8ce6('0x2b')]+'='+_0x3ceb3b[_0x8ce6('0x2c')];})[_0x8ce6('0x2d')]('&');_0x1757c7[_0x8ce6('0x2e')]={'issuer':_0x5a94fd[_0x8ce6('0x1c')](_0x8ce6('0x2f'),''),'audience':_0x1757c7[_0x8ce6('0x23')],'state':_0x3aaec9,'nonce':_0x30c4bd};redis[_0x8ce6('0x30')](_0x3aaec9,JSON[_0x8ce6('0x1f')](_0x1757c7));return _0x3c6df3;}function isValidIdToken(_0xdcc2d6,_0x24ed65){try{var _0x43e6ba=jwt[_0x8ce6('0x31')](_0xdcc2d6,{'complete':!![]});var _0x454802=_0x43e6ba[_0x8ce6('0x32')];if(_0x454802[_0x8ce6('0x33')]!==_0x24ed65[_0x8ce6('0x34')])return![];if(_0x454802[_0x8ce6('0x35')]!==_0x24ed65['audience'])return![];if(_0x454802[_0x8ce6('0x28')]!==_0x24ed65[_0x8ce6('0x28')])return![];if(moment()[_0x8ce6('0x36')](moment[_0x8ce6('0x37')](_0x454802[_0x8ce6('0x38')])))return![];return!![];}catch(_0x490933){throw _0x490933;}}function refreshOauth2MicrosoftAccessToken(_0x3530c0){return Promise['resolve']()[_0x8ce6('0x39')](function(){if(_0x3530c0['data3'])return _0x3530c0;return db[_0x8ce6('0x3a')][_0x8ce6('0x3b')]({'where':{'id':_0x3530c0['id']},'raw':!![]});})[_0x8ce6('0x39')](function(_0x152ab0){var _0x5d82b1={'grant_type':_0x8ce6('0x3c'),'refresh_token':_0x152ab0[_0x8ce6('0x3d')],'scope':getAccessTokenScope(_0x152ab0),'redirect_uri':_0x152ab0[_0x8ce6('0x25')],'client_id':_0x152ab0[_0x8ce6('0x23')],'client_secret':encryptor[_0x8ce6('0x3e')](_0x152ab0[_0x8ce6('0x3f')])};var _0x1a1f52={'method':_0x8ce6('0x40'),'uri':MICROSOFT_AUTH_URL[_0x8ce6('0x1c')]('{TENANT_ID}',_0x152ab0[_0x8ce6('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5d82b1,'json':!![]};return rp(_0x1a1f52);})[_0x8ce6('0x39')](function(_0x3a05f2){_0x3530c0['data5']=_0x3a05f2[_0x8ce6('0x41')];_0x3530c0[_0x8ce6('0x3d')]=_0x3a05f2['refresh_token'];return db['CloudProvider'][_0x8ce6('0x42')]({'data5':_0x3530c0[_0x8ce6('0x43')],'data6':_0x3530c0[_0x8ce6('0x3d')]},{'where':{'id':_0x3530c0['id']}});})[_0x8ce6('0x39')](function(){return _0x3530c0;})['catch'](function(_0x2bcc71){logger['error'](_0x8ce6('0x44'),_0x3530c0['id'],_0x2bcc71);});}function getOauth2MicrosoftAccessToken(_0x4ac5c3,_0x59c43c){var _0x332e20={'grant_type':_0x8ce6('0x45'),'code':_0x4ac5c3,'scope':getAccessTokenScope(_0x59c43c),'redirect_uri':_0x59c43c[_0x8ce6('0x25')],'client_id':_0x59c43c[_0x8ce6('0x23')],'client_secret':encryptor['decryptString'](_0x59c43c[_0x8ce6('0x3f')])};var _0x4005c2={'method':_0x8ce6('0x40'),'uri':MICROSOFT_AUTH_URL[_0x8ce6('0x1c')](_0x8ce6('0x46'),_0x59c43c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x332e20,'json':!![]};return rp(_0x4005c2);}function startRefreshInterval(_0x5709b8){var _0x59daa2=schedule[_0x8ce6('0x47')];if(_0x59daa2[_0x5709b8['id']])clearInterval(_0x59daa2[_0x5709b8['id']]);_0x59daa2[_0x5709b8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8ce6('0x48')](this,{'id':_0x5709b8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8ce6('0x47')]=_0x59daa2;}function startAllRefreshIntervals(){return db[_0x8ce6('0x3a')][_0x8ce6('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8ce6('0x39')](function(_0x16dc0c){var _0x11999e=_0x16dc0c['map'](function(_0x4bd0b9){return refreshOauth2MicrosoftAccessToken(_0x4bd0b9)['then'](function(_0x17327b){startRefreshInterval(_0x17327b);});});return Promise[_0x8ce6('0x4a')](_0x11999e);})['catch'](function(_0x243d64){var _0x3de3aa=_0x243d64?util['inspect'](_0x243d64,{'showHidden':![],'depth':null}):'';logger[_0x8ce6('0x4b')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3de3aa);});}module[_0x8ce6('0x4c')]={'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 31b2714..f6da2f5 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 _0xee87=['error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xee87,0x10d));var _0x7ee8=function(_0x1670a8,_0x2184c5){_0x1670a8=_0x1670a8-0x0;var _0x44e1a9=_0xee87[_0x1670a8];return _0x44e1a9;};'use strict';var _=require('lodash');var util=require(_0x7ee8('0x0'));var moment=require(_0x7ee8('0x1'));var BPromise=require(_0x7ee8('0x2'));var rs=require(_0x7ee8('0x3'));var fs=require('fs');var Redis=require(_0x7ee8('0x4'));var db=require(_0x7ee8('0x5'))['db'];var utils=require(_0x7ee8('0x6'));var logger=require(_0x7ee8('0x7'))(_0x7ee8('0x8'));var config=require(_0x7ee8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ee8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfed7,_0x4241bf,_0x2a9ea3){return new BPromise(function(_0x4275fc,_0x287224){return client['request'](_0x2dfed7,_0x2a9ea3)['then'](function(_0x3d984c){logger['info'](_0x7ee8('0xb'),_0x4241bf,_0x7ee8('0xc'));logger[_0x7ee8('0xd')](_0x7ee8('0xe'),_0x4241bf,_0x7ee8('0xc'),JSON[_0x7ee8('0xf')](_0x3d984c));if(_0x3d984c['error']){if(_0x3d984c['error'][_0x7ee8('0x10')]===0x1f4){logger[_0x7ee8('0x11')](_0x7ee8('0xb'),_0x4241bf,_0x3d984c[_0x7ee8('0x11')][_0x7ee8('0x12')]);return _0x287224(_0x3d984c[_0x7ee8('0x11')][_0x7ee8('0x12')]);}logger[_0x7ee8('0x11')](_0x7ee8('0xb'),_0x4241bf,_0x3d984c[_0x7ee8('0x11')][_0x7ee8('0x12')]);return _0x4275fc(_0x3d984c[_0x7ee8('0x11')][_0x7ee8('0x12')]);}else{logger[_0x7ee8('0x13')](_0x7ee8('0xb'),_0x4241bf,_0x7ee8('0xc'));_0x4275fc(_0x3d984c[_0x7ee8('0x14')][_0x7ee8('0x12')]);}})[_0x7ee8('0x15')](function(_0x3de0b8){logger[_0x7ee8('0x11')](_0x7ee8('0xb'),_0x4241bf,_0x3de0b8);_0x287224(_0x3de0b8);});});} \ No newline at end of file +var _0xe2cf=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x1520fb,_0x3e0f16){var _0x2ff6f9=function(_0x4a7b09){while(--_0x4a7b09){_0x1520fb['push'](_0x1520fb['shift']());}};_0x2ff6f9(++_0x3e0f16);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x5525a7,_0x3437c2){_0x5525a7=_0x5525a7-0x0;var _0x3503dc=_0xe2cf[_0x5525a7];return _0x3503dc;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('CloudProvider,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4dcc7cc..569b321 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a524a,_0x15c3c8){_0x4a524a=_0x4a524a-0x0;var _0x172f82=_0x5f2f[_0x4a524a];return _0x172f82;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x325073,_0x12ef03){var _0x114ad0=function(_0x3df1db){while(--_0x3df1db){_0x325073['push'](_0x325073['shift']());}};_0x114ad0(++_0x12ef03);}(_0xdb28,0x106));var _0x8db2=function(_0x18e1fe,_0x133ecf){_0x18e1fe=_0x18e1fe-0x0;var _0x2c0861=_0xdb28[_0x18e1fe];return _0x2c0861;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 355fe4f..c0b8671 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 _0xe86b=['name','sequelize','exports','STRING'];(function(_0x9f4380,_0xd3505c){var _0x8375a=function(_0x1e61f4){while(--_0x1e61f4){_0x9f4380['push'](_0x9f4380['shift']());}};_0x8375a(++_0xd3505c);}(_0xe86b,0x1c9));var _0xbe86=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe86b[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xbe86('0x0'));module[_0xbe86('0x1')]={'name':{'type':Sequelize[_0xbe86('0x2')],'unique':_0xbe86('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbe86('0x2')]},'companyId':{'type':Sequelize[_0xbe86('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbe86('0x2')]},'fax':{'type':Sequelize[_0xbe86('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xbe86('0x2')]},'postalCode':{'type':Sequelize[_0xbe86('0x2')]},'city':{'type':Sequelize[_0xbe86('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xbe86('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbe86('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xbe86('0x2')]},'sCity':{'type':Sequelize[_0xbe86('0x2')]},'sCountry':{'type':Sequelize[_0xbe86('0x2')]},'description':{'type':Sequelize[_0xbe86('0x2')]}}; \ No newline at end of file +var _0xb017=['sequelize','exports','STRING','name'];(function(_0x528396,_0x468b1b){var _0x5941dd=function(_0x2af6f9){while(--_0x2af6f9){_0x528396['push'](_0x528396['shift']());}};_0x5941dd(++_0x468b1b);}(_0xb017,0x178));var _0x7b01=function(_0x258e56,_0x173e54){_0x258e56=_0x258e56-0x0;var _0x459d1e=_0xb017[_0x258e56];return _0x459d1e;};'use strict';var Sequelize=require(_0x7b01('0x0'));module[_0x7b01('0x1')]={'name':{'type':Sequelize[_0x7b01('0x2')],'unique':_0x7b01('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7b01('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x7b01('0x2')]},'phone':{'type':Sequelize[_0x7b01('0x2')]},'fax':{'type':Sequelize[_0x7b01('0x2')]},'type':{'type':Sequelize[_0x7b01('0x2')]},'street':{'type':Sequelize[_0x7b01('0x2')]},'postalCode':{'type':Sequelize[_0x7b01('0x2')]},'city':{'type':Sequelize[_0x7b01('0x2')]},'country':{'type':Sequelize[_0x7b01('0x2')]},'email':{'type':Sequelize[_0x7b01('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7b01('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x7b01('0x2')]},'sCountry':{'type':Sequelize[_0x7b01('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 4b8802c..ac1406b 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 _0x64bc=['squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','error','name','send','index','describe','keys','query','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','filter','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','addContacts','CmContact','ids','omit','getContacts','findOne','rawAttributes','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash'];(function(_0x1217ba,_0x5a4279){var _0x384efc=function(_0x317313){while(--_0x317313){_0x1217ba['push'](_0x1217ba['shift']());}};_0x384efc(++_0x5a4279);}(_0x64bc,0xfa));var _0xc64b=function(_0x29ff6c,_0x28c51e){_0x29ff6c=_0x29ff6c-0x0;var _0x40c33d=_0x64bc[_0x29ff6c];return _0x40c33d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc64b('0x0'));var zipdir=require(_0xc64b('0x1'));var jsonpatch=require(_0xc64b('0x2'));var rp=require('request-promise');var moment=require(_0xc64b('0x3'));var BPromise=require(_0xc64b('0x4'));var Mustache=require('mustache');var util=require(_0xc64b('0x5'));var path=require(_0xc64b('0x6'));var sox=require(_0xc64b('0x7'));var csv=require('to-csv');var ejs=require(_0xc64b('0x8'));var fs=require('fs');var fs_extra=require(_0xc64b('0x9'));var _=require(_0xc64b('0xa'));var squel=require(_0xc64b('0xb'));var crypto=require(_0xc64b('0xc'));var jsforce=require(_0xc64b('0xd'));var deskjs=require(_0xc64b('0xe'));var toCsv=require(_0xc64b('0xf'));var querystring=require(_0xc64b('0x10'));var Papa=require('papaparse');var Redis=require(_0xc64b('0x11'));var authService=require(_0xc64b('0x12'));var qs=require(_0xc64b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc64b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc64b('0x15'));var licenseUtil=require(_0xc64b('0x16'));var db=require(_0xc64b('0x17'))['db'];function respondWithStatusCode(_0x226da8,_0x430b5f){_0x430b5f=_0x430b5f||0xcc;return function(_0x2e318e){if(_0x2e318e){return _0x226da8[_0xc64b('0x18')](_0x430b5f);}return _0x226da8[_0xc64b('0x19')](_0x430b5f)[_0xc64b('0x1a')]();};}function respondWithResult(_0x26c760,_0x3e8fd1){_0x3e8fd1=_0x3e8fd1||0xc8;return function(_0x279012){if(_0x279012){return _0x26c760[_0xc64b('0x19')](_0x3e8fd1)[_0xc64b('0x1b')](_0x279012);}};}function respondWithFilteredResult(_0x21a0fc,_0x4fb469){return function(_0x56211d){if(_0x56211d){var _0xfb0b57=typeof _0x4fb469[_0xc64b('0x1c')]==='undefined'&&typeof _0x4fb469[_0xc64b('0x1d')]===_0xc64b('0x1e');var _0x5d702e=_0x56211d[_0xc64b('0x1f')];var _0x473840=_0xfb0b57?0x0:_0x4fb469[_0xc64b('0x1c')];var _0x47ddb4=_0xfb0b57?_0x56211d[_0xc64b('0x1f')]:_0x4fb469['offset']+_0x4fb469['limit'];var _0x500383;if(_0x47ddb4>=_0x5d702e){_0x47ddb4=_0x5d702e;_0x500383=0xc8;}else{_0x500383=0xce;}_0x21a0fc[_0xc64b('0x19')](_0x500383);return _0x21a0fc[_0xc64b('0x20')](_0xc64b('0x21'),_0x473840+'-'+_0x47ddb4+'/'+_0x5d702e)[_0xc64b('0x1b')](_0x56211d);}return null;};}function patchUpdates(_0x2eb005){return function(_0x4ef7b2){try{jsonpatch[_0xc64b('0x22')](_0x4ef7b2,_0x2eb005,!![]);}catch(_0x4ad8cb){return BPromise[_0xc64b('0x23')](_0x4ad8cb);}return _0x4ef7b2[_0xc64b('0x24')]();};}function saveUpdates(_0x1d58d6,_0x1640db){return function(_0x398471){if(_0x398471){return _0x398471[_0xc64b('0x25')](_0x1d58d6)[_0xc64b('0x26')](function(_0x1e24c9){return _0x1e24c9;});}return null;};}function removeEntity(_0x3bd1b9,_0x3cdd5c){return function(_0x29230b){if(_0x29230b){return _0x29230b['destroy']()['then'](function(){var _0x3839d9=_0x29230b['get']({'plain':!![]});var _0x36e8fc='Companies';return db[_0xc64b('0x27')]['destroy']({'where':{'type':_0x36e8fc,'resourceId':_0x3839d9['id']}})['then'](function(){return _0x29230b;});})[_0xc64b('0x26')](function(){_0x3bd1b9['status'](0xcc)[_0xc64b('0x1a')]();});}};}function handleEntityNotFound(_0x3bb548,_0x129eb1){return function(_0x527793){if(!_0x527793){_0x3bb548[_0xc64b('0x18')](0x194);}return _0x527793;};}function handleError(_0x4f86c4,_0x2d9580){_0x2d9580=_0x2d9580||0x1f4;return function(_0x207202){logger[_0xc64b('0x28')](_0x207202['stack']);if(_0x207202[_0xc64b('0x29')]){delete _0x207202[_0xc64b('0x29')];}_0x4f86c4[_0xc64b('0x19')](_0x2d9580)[_0xc64b('0x2a')](_0x207202);};}exports[_0xc64b('0x2b')]=function(_0x375e70,_0x42a4ef){var _0x4fbabc={},_0x552534={},_0x298d05={'count':0x0,'rows':[]};return db['CmCompany'][_0xc64b('0x2c')]()[_0xc64b('0x26')](function(_0x119c39){_0x552534['model']=_[_0xc64b('0x2d')](_0x119c39);_0x552534[_0xc64b('0x2e')]=_['keys'](_0x375e70[_0xc64b('0x2e')]);_0x552534['filters']=_['intersection'](_0x552534[_0xc64b('0x2f')],_0x552534[_0xc64b('0x2e')]);_0x4fbabc['attributes']=_[_0xc64b('0x30')](_0x552534['model'],qs['fields'](_0x375e70['query']['fields']));_0x4fbabc[_0xc64b('0x31')]=_0x4fbabc[_0xc64b('0x31')][_0xc64b('0x32')]?_0x4fbabc[_0xc64b('0x31')]:_0x552534['model'];if(!_0x375e70['query'][_0xc64b('0x33')](_0xc64b('0x34'))){_0x4fbabc[_0xc64b('0x1d')]=qs[_0xc64b('0x1d')](_0x375e70[_0xc64b('0x2e')][_0xc64b('0x1d')]);_0x4fbabc['offset']=qs['offset'](_0x375e70[_0xc64b('0x2e')][_0xc64b('0x1c')]);}_0x4fbabc[_0xc64b('0x35')]=qs[_0xc64b('0x36')](_0x375e70[_0xc64b('0x2e')][_0xc64b('0x36')]);_0x4fbabc[_0xc64b('0x37')]=qs[_0xc64b('0x38')](_[_0xc64b('0x39')](_0x375e70['query'],_0x552534[_0xc64b('0x38')]),_0x119c39);if(_0x375e70['query']['filter']){_0x4fbabc['where']=_[_0xc64b('0x3a')](_0x4fbabc['where'],{'$or':_[_0xc64b('0x3b')](_0x4fbabc[_0xc64b('0x31')],function(_0x265e32){var _0x25fb97={};_0x25fb97[_0x265e32]={'$like':'%'+_0x375e70[_0xc64b('0x2e')][_0xc64b('0x3c')]+'%'};return _0x25fb97;})});}_0x4fbabc=_[_0xc64b('0x3a')]({},_0x4fbabc,_0x375e70[_0xc64b('0x3d')]);var _0x2042d6={'where':_0x4fbabc['where']};return db[_0xc64b('0x3e')]['count'](_0x2042d6)[_0xc64b('0x26')](function(_0x49e257){_0x298d05[_0xc64b('0x1f')]=_0x49e257;if(_0x375e70['query'][_0xc64b('0x3f')]){_0x4fbabc[_0xc64b('0x40')]=[{'all':!![]}];}return db[_0xc64b('0x3e')][_0xc64b('0x41')](_0x4fbabc);})[_0xc64b('0x26')](function(_0x38ab4f){_0x298d05[_0xc64b('0x42')]=_0x38ab4f;return _0x298d05;})[_0xc64b('0x26')](respondWithFilteredResult(_0x42a4ef,_0x4fbabc))[_0xc64b('0x43')](handleError(_0x42a4ef,null));})[_0xc64b('0x43')](handleError(_0x42a4ef,null));};exports[_0xc64b('0x44')]=function(_0x5de4d4,_0x38477a){var _0x4e7f3a={'raw':![],'where':{'id':_0x5de4d4[_0xc64b('0x45')]['id']}},_0x56fb87={};_0x56fb87[_0xc64b('0x2f')]=_[_0xc64b('0x2d')](db[_0xc64b('0x3e')]['rawAttributes']);_0x56fb87[_0xc64b('0x2e')]=_['keys'](_0x5de4d4[_0xc64b('0x2e')]);_0x56fb87[_0xc64b('0x38')]=_[_0xc64b('0x30')](_0x56fb87[_0xc64b('0x2f')],_0x56fb87['query']);_0x4e7f3a[_0xc64b('0x31')]=_[_0xc64b('0x30')](_0x56fb87[_0xc64b('0x2f')],qs[_0xc64b('0x46')](_0x5de4d4[_0xc64b('0x2e')][_0xc64b('0x46')]));_0x4e7f3a['attributes']=_0x4e7f3a['attributes'][_0xc64b('0x32')]?_0x4e7f3a[_0xc64b('0x31')]:_0x56fb87['model'];if(_0x5de4d4[_0xc64b('0x2e')][_0xc64b('0x3f')]){_0x4e7f3a['include']=[{'all':!![]}];}_0x4e7f3a=_[_0xc64b('0x3a')]({},_0x4e7f3a,_0x5de4d4[_0xc64b('0x3d')]);return db[_0xc64b('0x3e')][_0xc64b('0x47')](_0x4e7f3a)['then'](handleEntityNotFound(_0x38477a,null))[_0xc64b('0x26')](respondWithResult(_0x38477a,null))[_0xc64b('0x43')](handleError(_0x38477a,null));};exports[_0xc64b('0x48')]=function(_0x1f1c19,_0x2df6d0){return db[_0xc64b('0x3e')]['create'](_0x1f1c19[_0xc64b('0x49')],{})[_0xc64b('0x26')](function(_0x353d3d){var _0x33c14b=_0x1f1c19[_0xc64b('0x4a')][_0xc64b('0x4b')]({'plain':!![]});if(!_0x33c14b)throw new Error(_0xc64b('0x4c'));if(_0x33c14b[_0xc64b('0x4d')]===_0xc64b('0x4a')){var _0xdb1f3e=_0x353d3d['get']({'plain':!![]});var _0x416de7=_0xc64b('0x4e');return db[_0xc64b('0x4f')][_0xc64b('0x47')]({'where':{'name':_0x416de7,'userProfileId':_0x33c14b['userProfileId']},'raw':!![]})[_0xc64b('0x26')](function(_0x2a3871){if(_0x2a3871&&_0x2a3871['autoAssociation']===0x0){return db[_0xc64b('0x27')][_0xc64b('0x48')]({'name':_0xdb1f3e[_0xc64b('0x29')],'resourceId':_0xdb1f3e['id'],'type':_0x2a3871[_0xc64b('0x29')],'sectionId':_0x2a3871['id']},{})[_0xc64b('0x26')](function(){return _0x353d3d;});}else{return _0x353d3d;}})[_0xc64b('0x43')](function(_0x4bd4d8){logger[_0xc64b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bd4d8);throw _0x4bd4d8;});}return _0x353d3d;})[_0xc64b('0x26')](respondWithResult(_0x2df6d0,0xc9))[_0xc64b('0x43')](handleError(_0x2df6d0,null));};exports[_0xc64b('0x25')]=function(_0x58adf6,_0x353b60){if(_0x58adf6[_0xc64b('0x49')]['id']){delete _0x58adf6['body']['id'];}return db[_0xc64b('0x3e')][_0xc64b('0x47')]({'where':{'id':_0x58adf6[_0xc64b('0x45')]['id']}})[_0xc64b('0x26')](handleEntityNotFound(_0x353b60,null))['then'](saveUpdates(_0x58adf6[_0xc64b('0x49')],null))[_0xc64b('0x26')](respondWithResult(_0x353b60,null))[_0xc64b('0x43')](handleError(_0x353b60,null));};exports['destroy']=function(_0xc77ecb,_0x11cf51){return db[_0xc64b('0x3e')][_0xc64b('0x47')]({'where':{'id':_0xc77ecb[_0xc64b('0x45')]['id']}})[_0xc64b('0x26')](handleEntityNotFound(_0x11cf51,null))['then'](removeEntity(_0x11cf51,null))[_0xc64b('0x43')](handleError(_0x11cf51,null));};exports[_0xc64b('0x2c')]=function(_0x497429,_0x3f9645){return db['CmCompany'][_0xc64b('0x2c')]()[_0xc64b('0x26')](respondWithResult(_0x3f9645,null))['catch'](handleError(_0x3f9645,null));};exports[_0xc64b('0x50')]=function(_0x31aaef,_0x762592,_0x4bc2da){return db[_0xc64b('0x51')][_0xc64b('0x47')]({'where':{'id':_0x31aaef[_0xc64b('0x45')]['id']}})[_0xc64b('0x26')](handleEntityNotFound(_0x762592,null))['then'](function(_0x24240f){if(_0x24240f){return _0x24240f[_0xc64b('0x50')](_0x31aaef[_0xc64b('0x49')][_0xc64b('0x52')],_[_0xc64b('0x53')](_0x31aaef[_0xc64b('0x49')],[_0xc64b('0x52'),'id'])||{});}})['then'](respondWithResult(_0x762592,null))[_0xc64b('0x43')](handleError(_0x762592,null));};exports[_0xc64b('0x54')]=function(_0x2cc040,_0x67ce7f,_0x53289a){var _0x1e2ea1={};var _0x3f0c9e={};var _0x36881b;var _0x234cdc;return db[_0xc64b('0x3e')][_0xc64b('0x55')]({'where':{'id':_0x2cc040['params']['id']}})['then'](handleEntityNotFound(_0x67ce7f,null))[_0xc64b('0x26')](function(_0x2b38c7){if(_0x2b38c7){_0x36881b=_0x2b38c7;_0x3f0c9e[_0xc64b('0x2f')]=_[_0xc64b('0x2d')](db[_0xc64b('0x51')][_0xc64b('0x56')]);_0x3f0c9e['query']=_['keys'](_0x2cc040['query']);_0x3f0c9e[_0xc64b('0x38')]=_[_0xc64b('0x30')](_0x3f0c9e[_0xc64b('0x2f')],_0x3f0c9e[_0xc64b('0x2e')]);_0x1e2ea1[_0xc64b('0x31')]=_[_0xc64b('0x30')](_0x3f0c9e[_0xc64b('0x2f')],qs['fields'](_0x2cc040[_0xc64b('0x2e')]['fields']));_0x1e2ea1['attributes']=_0x1e2ea1[_0xc64b('0x31')][_0xc64b('0x32')]?_0x1e2ea1[_0xc64b('0x31')]:_0x3f0c9e[_0xc64b('0x2f')];_0x1e2ea1['order']=qs[_0xc64b('0x36')](_0x2cc040[_0xc64b('0x2e')][_0xc64b('0x36')]);_0x1e2ea1['where']=qs[_0xc64b('0x38')](_['pick'](_0x2cc040['query'],_0x3f0c9e['filters']));if(_0x2cc040[_0xc64b('0x2e')][_0xc64b('0x3c')]){_0x1e2ea1[_0xc64b('0x37')]=_[_0xc64b('0x3a')](_0x1e2ea1['where'],{'$or':_[_0xc64b('0x3b')](_0x1e2ea1[_0xc64b('0x31')],function(_0x5c727d){var _0x19299d={};_0x19299d[_0x5c727d]={'$like':'%'+_0x2cc040[_0xc64b('0x2e')][_0xc64b('0x3c')]+'%'};return _0x19299d;})});}_0x1e2ea1=_[_0xc64b('0x3a')]({},_0x1e2ea1,_0x2cc040[_0xc64b('0x3d')]);return _0x36881b[_0xc64b('0x54')](_0x1e2ea1);}})[_0xc64b('0x26')](function(_0x3a46dd){if(_0x3a46dd){_0x234cdc=_0x3a46dd['length'];if(!_0x2cc040['query'][_0xc64b('0x33')](_0xc64b('0x34'))){_0x1e2ea1[_0xc64b('0x1d')]=qs['limit'](_0x2cc040[_0xc64b('0x2e')]['limit']);_0x1e2ea1[_0xc64b('0x1c')]=qs[_0xc64b('0x1c')](_0x2cc040[_0xc64b('0x2e')][_0xc64b('0x1c')]);}return _0x36881b[_0xc64b('0x54')](_0x1e2ea1);}})['then'](function(_0x4430b5){if(_0x4430b5){return _0x4430b5?{'count':_0x234cdc,'rows':_0x4430b5}:null;}})[_0xc64b('0x26')](respondWithResult(_0x67ce7f,null))[_0xc64b('0x43')](handleError(_0x67ce7f,null));}; \ No newline at end of file +var _0x191e=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','omit','getContacts','findOne','CmContact','order','map','nolimit','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/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','Companies','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','rawAttributes','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x191e,0xc1));var _0xe191=function(_0x1443c4,_0x291ebe){_0x1443c4=_0x1443c4-0x0;var _0x493131=_0x191e[_0x1443c4];return _0x493131;};'use strict';var emlformat=require(_0xe191('0x0'));var rimraf=require(_0xe191('0x1'));var zipdir=require(_0xe191('0x2'));var jsonpatch=require(_0xe191('0x3'));var rp=require(_0xe191('0x4'));var moment=require(_0xe191('0x5'));var BPromise=require(_0xe191('0x6'));var Mustache=require(_0xe191('0x7'));var util=require('util');var path=require(_0xe191('0x8'));var sox=require(_0xe191('0x9'));var csv=require(_0xe191('0xa'));var ejs=require(_0xe191('0xb'));var fs=require('fs');var fs_extra=require(_0xe191('0xc'));var _=require(_0xe191('0xd'));var squel=require(_0xe191('0xe'));var crypto=require(_0xe191('0xf'));var jsforce=require(_0xe191('0x10'));var deskjs=require(_0xe191('0x11'));var toCsv=require(_0xe191('0xa'));var querystring=require(_0xe191('0x12'));var Papa=require(_0xe191('0x13'));var Redis=require(_0xe191('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe191('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe191('0x16'))(_0xe191('0x17'));var utils=require(_0xe191('0x18'));var config=require(_0xe191('0x19'));var licenseUtil=require(_0xe191('0x1a'));var db=require(_0xe191('0x1b'))['db'];function respondWithStatusCode(_0x3ad2c2,_0xc1b3ae){_0xc1b3ae=_0xc1b3ae||0xcc;return function(_0x22017f){if(_0x22017f){return _0x3ad2c2[_0xe191('0x1c')](_0xc1b3ae);}return _0x3ad2c2[_0xe191('0x1d')](_0xc1b3ae)[_0xe191('0x1e')]();};}function respondWithResult(_0xa2e321,_0x13b1b1){_0x13b1b1=_0x13b1b1||0xc8;return function(_0x57d2be){if(_0x57d2be){return _0xa2e321[_0xe191('0x1d')](_0x13b1b1)[_0xe191('0x1f')](_0x57d2be);}};}function respondWithFilteredResult(_0x1b8f5b,_0xd378ff){return function(_0x46f956){if(_0x46f956){var _0x2629aa=typeof _0xd378ff[_0xe191('0x20')]===_0xe191('0x21')&&typeof _0xd378ff[_0xe191('0x22')]==='undefined';var _0x187ab8=_0x46f956[_0xe191('0x23')];var _0x11970e=_0x2629aa?0x0:_0xd378ff['offset'];var _0x554b80=_0x2629aa?_0x46f956['count']:_0xd378ff['offset']+_0xd378ff[_0xe191('0x22')];var _0xdacc3b;if(_0x554b80>=_0x187ab8){_0x554b80=_0x187ab8;_0xdacc3b=0xc8;}else{_0xdacc3b=0xce;}_0x1b8f5b[_0xe191('0x1d')](_0xdacc3b);return _0x1b8f5b[_0xe191('0x24')]('Content-Range',_0x11970e+'-'+_0x554b80+'/'+_0x187ab8)[_0xe191('0x1f')](_0x46f956);}return null;};}function patchUpdates(_0x38d3b2){return function(_0x3f8723){try{jsonpatch['apply'](_0x3f8723,_0x38d3b2,!![]);}catch(_0x555d68){return BPromise[_0xe191('0x25')](_0x555d68);}return _0x3f8723[_0xe191('0x26')]();};}function saveUpdates(_0x22b4b9,_0x47a8a5){return function(_0x3e36a4){if(_0x3e36a4){return _0x3e36a4['update'](_0x22b4b9)[_0xe191('0x27')](function(_0x400cb2){return _0x400cb2;});}return null;};}function removeEntity(_0x3cafe9,_0x33ba4b){return function(_0x383436){if(_0x383436){return _0x383436[_0xe191('0x28')]()[_0xe191('0x27')](function(){var _0x2c0636=_0x383436[_0xe191('0x29')]({'plain':!![]});var _0x52904d=_0xe191('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x52904d,'resourceId':_0x2c0636['id']}})[_0xe191('0x27')](function(){return _0x383436;});})[_0xe191('0x27')](function(){_0x3cafe9[_0xe191('0x1d')](0xcc)[_0xe191('0x1e')]();});}};}function handleEntityNotFound(_0x5a3d16,_0x308020){return function(_0x39d312){if(!_0x39d312){_0x5a3d16[_0xe191('0x1c')](0x194);}return _0x39d312;};}function handleError(_0x49dea5,_0x43b79e){_0x43b79e=_0x43b79e||0x1f4;return function(_0x126058){logger[_0xe191('0x2b')](_0x126058[_0xe191('0x2c')]);if(_0x126058[_0xe191('0x2d')]){delete _0x126058['name'];}_0x49dea5['status'](_0x43b79e)[_0xe191('0x2e')](_0x126058);};}exports[_0xe191('0x2f')]=function(_0x196364,_0x5e2022){var _0x1e87b0={},_0x45efd4={},_0x4620cf={'count':0x0,'rows':[]};return db[_0xe191('0x30')][_0xe191('0x31')]()['then'](function(_0x456a33){_0x45efd4[_0xe191('0x32')]=_[_0xe191('0x33')](_0x456a33);_0x45efd4[_0xe191('0x34')]=_[_0xe191('0x33')](_0x196364['query']);_0x45efd4['filters']=_[_0xe191('0x35')](_0x45efd4[_0xe191('0x32')],_0x45efd4[_0xe191('0x34')]);_0x1e87b0[_0xe191('0x36')]=_[_0xe191('0x35')](_0x45efd4['model'],qs['fields'](_0x196364[_0xe191('0x34')]['fields']));_0x1e87b0[_0xe191('0x36')]=_0x1e87b0[_0xe191('0x36')][_0xe191('0x37')]?_0x1e87b0[_0xe191('0x36')]:_0x45efd4[_0xe191('0x32')];if(!_0x196364[_0xe191('0x34')][_0xe191('0x38')]('nolimit')){_0x1e87b0[_0xe191('0x22')]=qs[_0xe191('0x22')](_0x196364[_0xe191('0x34')][_0xe191('0x22')]);_0x1e87b0[_0xe191('0x20')]=qs[_0xe191('0x20')](_0x196364[_0xe191('0x34')]['offset']);}_0x1e87b0['order']=qs[_0xe191('0x39')](_0x196364[_0xe191('0x34')][_0xe191('0x39')]);_0x1e87b0[_0xe191('0x3a')]=qs[_0xe191('0x3b')](_[_0xe191('0x3c')](_0x196364[_0xe191('0x34')],_0x45efd4[_0xe191('0x3b')]),_0x456a33);if(_0x196364['query'][_0xe191('0x3d')]){_0x1e87b0[_0xe191('0x3a')]=_[_0xe191('0x3e')](_0x1e87b0[_0xe191('0x3a')],{'$or':_['map'](_0x1e87b0[_0xe191('0x36')],function(_0x178b89){var _0x45980a={};_0x45980a[_0x178b89]={'$like':'%'+_0x196364[_0xe191('0x34')][_0xe191('0x3d')]+'%'};return _0x45980a;})});}_0x1e87b0=_[_0xe191('0x3e')]({},_0x1e87b0,_0x196364[_0xe191('0x3f')]);var _0x21a350={'where':_0x1e87b0[_0xe191('0x3a')]};return db[_0xe191('0x30')][_0xe191('0x23')](_0x21a350)['then'](function(_0x2dcd1c){_0x4620cf[_0xe191('0x23')]=_0x2dcd1c;if(_0x196364[_0xe191('0x34')][_0xe191('0x40')]){_0x1e87b0[_0xe191('0x41')]=[{'all':!![]}];}return db[_0xe191('0x30')][_0xe191('0x42')](_0x1e87b0);})[_0xe191('0x27')](function(_0x425c21){_0x4620cf[_0xe191('0x43')]=_0x425c21;return _0x4620cf;})['then'](respondWithFilteredResult(_0x5e2022,_0x1e87b0))['catch'](handleError(_0x5e2022,null));})['catch'](handleError(_0x5e2022,null));};exports['show']=function(_0x35f3db,_0x465ee4){var _0x3135f7={'raw':![],'where':{'id':_0x35f3db['params']['id']}},_0x19e280={};_0x19e280[_0xe191('0x32')]=_['keys'](db['CmCompany'][_0xe191('0x44')]);_0x19e280['query']=_['keys'](_0x35f3db[_0xe191('0x34')]);_0x19e280[_0xe191('0x3b')]=_[_0xe191('0x35')](_0x19e280['model'],_0x19e280['query']);_0x3135f7[_0xe191('0x36')]=_[_0xe191('0x35')](_0x19e280[_0xe191('0x32')],qs['fields'](_0x35f3db['query'][_0xe191('0x45')]));_0x3135f7['attributes']=_0x3135f7['attributes'][_0xe191('0x37')]?_0x3135f7[_0xe191('0x36')]:_0x19e280[_0xe191('0x32')];if(_0x35f3db['query'][_0xe191('0x40')]){_0x3135f7['include']=[{'all':!![]}];}_0x3135f7=_[_0xe191('0x3e')]({},_0x3135f7,_0x35f3db[_0xe191('0x3f')]);return db[_0xe191('0x30')][_0xe191('0x46')](_0x3135f7)[_0xe191('0x27')](handleEntityNotFound(_0x465ee4,null))['then'](respondWithResult(_0x465ee4,null))[_0xe191('0x47')](handleError(_0x465ee4,null));};exports['create']=function(_0x3ce482,_0x555d79){return db[_0xe191('0x30')][_0xe191('0x48')](_0x3ce482[_0xe191('0x49')],{})[_0xe191('0x27')](function(_0x4ed0ae){var _0x537776=_0x3ce482[_0xe191('0x4a')][_0xe191('0x29')]({'plain':!![]});if(!_0x537776)throw new Error(_0xe191('0x4b'));if(_0x537776[_0xe191('0x4c')]===_0xe191('0x4a')){var _0x1931ea=_0x4ed0ae[_0xe191('0x29')]({'plain':!![]});var _0xe23641=_0xe191('0x2a');return db['UserProfileSection'][_0xe191('0x46')]({'where':{'name':_0xe23641,'userProfileId':_0x537776['userProfileId']},'raw':!![]})[_0xe191('0x27')](function(_0x1ed318){if(_0x1ed318&&_0x1ed318[_0xe191('0x4d')]===0x0){return db[_0xe191('0x4e')]['create']({'name':_0x1931ea[_0xe191('0x2d')],'resourceId':_0x1931ea['id'],'type':_0x1ed318[_0xe191('0x2d')],'sectionId':_0x1ed318['id']},{})[_0xe191('0x27')](function(){return _0x4ed0ae;});}else{return _0x4ed0ae;}})['catch'](function(_0x308cf5){logger[_0xe191('0x2b')](_0xe191('0x4f'),_0x308cf5);throw _0x308cf5;});}return _0x4ed0ae;})[_0xe191('0x27')](respondWithResult(_0x555d79,0xc9))[_0xe191('0x47')](handleError(_0x555d79,null));};exports['update']=function(_0x302ff2,_0x286f0a){if(_0x302ff2['body']['id']){delete _0x302ff2[_0xe191('0x49')]['id'];}return db[_0xe191('0x30')][_0xe191('0x46')]({'where':{'id':_0x302ff2[_0xe191('0x50')]['id']}})[_0xe191('0x27')](handleEntityNotFound(_0x286f0a,null))[_0xe191('0x27')](saveUpdates(_0x302ff2[_0xe191('0x49')],null))[_0xe191('0x27')](respondWithResult(_0x286f0a,null))[_0xe191('0x47')](handleError(_0x286f0a,null));};exports['destroy']=function(_0xdb339a,_0x260b22){return db[_0xe191('0x30')][_0xe191('0x46')]({'where':{'id':_0xdb339a['params']['id']}})[_0xe191('0x27')](handleEntityNotFound(_0x260b22,null))[_0xe191('0x27')](removeEntity(_0x260b22,null))['catch'](handleError(_0x260b22,null));};exports[_0xe191('0x31')]=function(_0x4da099,_0x1bcb40){return db[_0xe191('0x30')][_0xe191('0x31')]()[_0xe191('0x27')](respondWithResult(_0x1bcb40,null))[_0xe191('0x47')](handleError(_0x1bcb40,null));};exports[_0xe191('0x51')]=function(_0x31eac0,_0x15a25e,_0x3287b4){return db['CmContact'][_0xe191('0x46')]({'where':{'id':_0x31eac0['params']['id']}})[_0xe191('0x27')](handleEntityNotFound(_0x15a25e,null))[_0xe191('0x27')](function(_0x561003){if(_0x561003){return _0x561003[_0xe191('0x51')](_0x31eac0[_0xe191('0x49')][_0xe191('0x52')],_[_0xe191('0x53')](_0x31eac0[_0xe191('0x49')],['ids','id'])||{});}})[_0xe191('0x27')](respondWithResult(_0x15a25e,null))[_0xe191('0x47')](handleError(_0x15a25e,null));};exports[_0xe191('0x54')]=function(_0x4331e9,_0x34e2d6,_0x2dc04e){var _0xac1edc={};var _0x1a6f14={};var _0x24b5fe;var _0x284f25;return db[_0xe191('0x30')][_0xe191('0x55')]({'where':{'id':_0x4331e9[_0xe191('0x50')]['id']}})[_0xe191('0x27')](handleEntityNotFound(_0x34e2d6,null))[_0xe191('0x27')](function(_0x391c59){if(_0x391c59){_0x24b5fe=_0x391c59;_0x1a6f14[_0xe191('0x32')]=_[_0xe191('0x33')](db[_0xe191('0x56')][_0xe191('0x44')]);_0x1a6f14[_0xe191('0x34')]=_[_0xe191('0x33')](_0x4331e9[_0xe191('0x34')]);_0x1a6f14[_0xe191('0x3b')]=_['intersection'](_0x1a6f14[_0xe191('0x32')],_0x1a6f14[_0xe191('0x34')]);_0xac1edc[_0xe191('0x36')]=_[_0xe191('0x35')](_0x1a6f14[_0xe191('0x32')],qs['fields'](_0x4331e9[_0xe191('0x34')]['fields']));_0xac1edc['attributes']=_0xac1edc['attributes'][_0xe191('0x37')]?_0xac1edc['attributes']:_0x1a6f14[_0xe191('0x32')];_0xac1edc[_0xe191('0x57')]=qs[_0xe191('0x39')](_0x4331e9[_0xe191('0x34')][_0xe191('0x39')]);_0xac1edc[_0xe191('0x3a')]=qs[_0xe191('0x3b')](_['pick'](_0x4331e9[_0xe191('0x34')],_0x1a6f14[_0xe191('0x3b')]));if(_0x4331e9[_0xe191('0x34')][_0xe191('0x3d')]){_0xac1edc['where']=_[_0xe191('0x3e')](_0xac1edc[_0xe191('0x3a')],{'$or':_[_0xe191('0x58')](_0xac1edc[_0xe191('0x36')],function(_0x8b6426){var _0x384ef1={};_0x384ef1[_0x8b6426]={'$like':'%'+_0x4331e9[_0xe191('0x34')]['filter']+'%'};return _0x384ef1;})});}_0xac1edc=_[_0xe191('0x3e')]({},_0xac1edc,_0x4331e9['options']);return _0x24b5fe[_0xe191('0x54')](_0xac1edc);}})[_0xe191('0x27')](function(_0x484d8c){if(_0x484d8c){_0x284f25=_0x484d8c[_0xe191('0x37')];if(!_0x4331e9[_0xe191('0x34')][_0xe191('0x38')](_0xe191('0x59'))){_0xac1edc[_0xe191('0x22')]=qs[_0xe191('0x22')](_0x4331e9[_0xe191('0x34')][_0xe191('0x22')]);_0xac1edc['offset']=qs[_0xe191('0x20')](_0x4331e9['query'][_0xe191('0x20')]);}return _0x24b5fe[_0xe191('0x54')](_0xac1edc);}})[_0xe191('0x27')](function(_0x11cad2){if(_0x11cad2){return _0x11cad2?{'count':_0x284f25,'rows':_0x11cad2}:null;}})[_0xe191('0x27')](respondWithResult(_0x34e2d6,null))['catch'](handleError(_0x34e2d6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index ad20ede..e319ab2 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 _0x584b=['../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x584b,0xe2));var _0xb584=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x584b[_0xfbdff6];return _0x4cb9be;};'use strict';var _=require(_0xb584('0x0'));var util=require(_0xb584('0x1'));var logger=require('../../config/logger')(_0xb584('0x2'));var moment=require(_0xb584('0x3'));var BPromise=require(_0xb584('0x4'));var rp=require(_0xb584('0x5'));var fs=require('fs');var path=require(_0xb584('0x6'));var rimraf=require(_0xb584('0x7'));var config=require(_0xb584('0x8'));var attributes=require(_0xb584('0x9'));module[_0xb584('0xa')]=function(_0x2804a2,_0x312250){return _0x2804a2['define'](_0xb584('0xb'),attributes,{'tableName':_0xb584('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1757=['define','CmCompany','cm_companies','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x353ad2,_0x307542){var _0xe19cb3=function(_0x21d7d2){while(--_0x21d7d2){_0x353ad2['push'](_0x353ad2['shift']());}};_0xe19cb3(++_0x307542);}(_0x1757,0xf5));var _0x7175=function(_0x3b38e5,_0x1f625d){_0x3b38e5=_0x3b38e5-0x0;var _0x496518=_0x1757[_0x3b38e5];return _0x496518;};'use strict';var _=require(_0x7175('0x0'));var util=require(_0x7175('0x1'));var logger=require(_0x7175('0x2'))(_0x7175('0x3'));var moment=require('moment');var BPromise=require(_0x7175('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7175('0x5'));var rimraf=require(_0x7175('0x6'));var config=require(_0x7175('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x2cfd9c,_0x2de6ea){return _0x2cfd9c[_0x7175('0x8')](_0x7175('0x9'),attributes,{'tableName':_0x7175('0xa'),'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 ae1858b..a75819a 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 _0x257d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','message','error','result','catch','lodash','util'];(function(_0x11e82c,_0x4bbc77){var _0x4b3360=function(_0x28246a){while(--_0x28246a){_0x11e82c['push'](_0x11e82c['shift']());}};_0x4b3360(++_0x4bbc77);}(_0x257d,0xd0));var _0xd257=function(_0x9b343a,_0x1bb484){_0x9b343a=_0x9b343a-0x0;var _0x1f4f2b=_0x257d[_0x9b343a];return _0x1f4f2b;};'use strict';var _=require(_0xd257('0x0'));var util=require(_0xd257('0x1'));var moment=require(_0xd257('0x2'));var BPromise=require(_0xd257('0x3'));var rs=require(_0xd257('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd257('0x5'))['db'];var utils=require(_0xd257('0x6'));var logger=require(_0xd257('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd257('0x8')][_0xd257('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e8e02,_0x222fca,_0x134c4b){return new BPromise(function(_0x1a7354,_0x284cc4){return client[_0xd257('0xa')](_0x2e8e02,_0x134c4b)[_0xd257('0xb')](function(_0x583bd1){logger[_0xd257('0xc')](_0xd257('0xd'),_0x222fca,'request\x20sent');logger[_0xd257('0xe')](_0xd257('0xf'),_0x222fca,_0xd257('0x10'),JSON['stringify'](_0x583bd1));if(_0x583bd1['error']){if(_0x583bd1['error']['code']===0x1f4){logger['error'](_0xd257('0xd'),_0x222fca,_0x583bd1['error'][_0xd257('0x11')]);return _0x284cc4(_0x583bd1[_0xd257('0x12')][_0xd257('0x11')]);}logger[_0xd257('0x12')](_0xd257('0xd'),_0x222fca,_0x583bd1['error'][_0xd257('0x11')]);return _0x1a7354(_0x583bd1[_0xd257('0x12')][_0xd257('0x11')]);}else{logger[_0xd257('0xc')]('CmCompany,\x20%s,\x20%s',_0x222fca,_0xd257('0x10'));_0x1a7354(_0x583bd1[_0xd257('0x13')][_0xd257('0x11')]);}})[_0xd257('0x14')](function(_0x5ba8c7){logger[_0xd257('0x12')]('CmCompany,\x20%s,\x20%s',_0x222fca,_0x5ba8c7);_0x284cc4(_0x5ba8c7);});});} \ No newline at end of file +var _0x798d=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','catch','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x798d,0xba));var _0xd798=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x798d[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd798('0x0'));var BPromise=require(_0xd798('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd798('0x2'))['db'];var utils=require(_0xd798('0x3'));var logger=require('../../config/logger')(_0xd798('0x4'));var config=require(_0xd798('0x5'));var jayson=require(_0xd798('0x6'));var client=jayson[_0xd798('0x7')][_0xd798('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c9aba,_0x36f01f,_0x2786e9){return new BPromise(function(_0x25a6cf,_0x5cd513){return client[_0xd798('0x9')](_0x1c9aba,_0x2786e9)['then'](function(_0x58ad7d){logger[_0xd798('0xa')]('CmCompany,\x20%s,\x20%s',_0x36f01f,_0xd798('0xb'));logger['debug'](_0xd798('0xc'),_0x36f01f,_0xd798('0xb'),JSON[_0xd798('0xd')](_0x58ad7d));if(_0x58ad7d['error']){if(_0x58ad7d[_0xd798('0xe')][_0xd798('0xf')]===0x1f4){logger[_0xd798('0xe')](_0xd798('0x10'),_0x36f01f,_0x58ad7d[_0xd798('0xe')][_0xd798('0x11')]);return _0x5cd513(_0x58ad7d[_0xd798('0xe')][_0xd798('0x11')]);}logger[_0xd798('0xe')](_0xd798('0x10'),_0x36f01f,_0x58ad7d[_0xd798('0xe')][_0xd798('0x11')]);return _0x25a6cf(_0x58ad7d['error'][_0xd798('0x11')]);}else{logger[_0xd798('0xa')]('CmCompany,\x20%s,\x20%s',_0x36f01f,_0xd798('0xb'));_0x25a6cf(_0x58ad7d['result']['message']);}})[_0xd798('0x12')](function(_0x8420cc){logger['error'](_0xd798('0x10'),_0x36f01f,_0x8420cc);_0x5cd513(_0x8420cc);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1380617..70896c6 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 _0xedc0=['addContacts','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','isAuthenticated','/:id','show','/:id/contacts','post','create'];(function(_0x2d2949,_0x24c559){var _0x4bb11f=function(_0x2a75d7){while(--_0x2a75d7){_0x2d2949['push'](_0x2d2949['shift']());}};_0x4bb11f(++_0x24c559);}(_0xedc0,0xf5));var _0x0edc=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0xedc0[_0xa4f636];return _0x37e02a;};'use strict';var multer=require(_0x0edc('0x0'));var util=require('util');var path=require(_0x0edc('0x1'));var timeout=require(_0x0edc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0edc('0x3'));var auth=require(_0x0edc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0edc('0x5'));var controller=require(_0x0edc('0x6'));router[_0x0edc('0x7')]('/',auth['isAuthenticated'](),controller[_0x0edc('0x8')]);router['get']('/describe',auth[_0x0edc('0x9')](),controller['describe']);router[_0x0edc('0x7')](_0x0edc('0xa'),auth[_0x0edc('0x9')](),controller[_0x0edc('0xb')]);router[_0x0edc('0x7')](_0x0edc('0xc'),auth[_0x0edc('0x9')](),controller['getContacts']);router[_0x0edc('0xd')]('/',auth[_0x0edc('0x9')](),controller[_0x0edc('0xe')]);router[_0x0edc('0xd')](_0x0edc('0xc'),auth['isAuthenticated'](),controller[_0x0edc('0xf')]);router['put']('/:id',auth[_0x0edc('0x9')](),controller[_0x0edc('0x10')]);router[_0x0edc('0x11')](_0x0edc('0xa'),auth[_0x0edc('0x9')](),controller[_0x0edc('0x12')]);module[_0x0edc('0x13')]=router; \ No newline at end of file +var _0xfa00=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','post','/:id/contacts','put','update','delete','destroy','exports','multer','util'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xfa00,0x129));var _0x0fa0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfa00[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x0fa0('0x0'));var util=require(_0x0fa0('0x1'));var path=require(_0x0fa0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0fa0('0x3')]();var fs_extra=require(_0x0fa0('0x4'));var auth=require(_0x0fa0('0x5'));var interaction=require(_0x0fa0('0x6'));var config=require(_0x0fa0('0x7'));var controller=require('./cmCompany.controller');router[_0x0fa0('0x8')]('/',auth[_0x0fa0('0x9')](),controller[_0x0fa0('0xa')]);router[_0x0fa0('0x8')](_0x0fa0('0xb'),auth[_0x0fa0('0x9')](),controller[_0x0fa0('0xc')]);router[_0x0fa0('0x8')](_0x0fa0('0xd'),auth[_0x0fa0('0x9')](),controller[_0x0fa0('0xe')]);router['get']('/:id/contacts',auth[_0x0fa0('0x9')](),controller['getContacts']);router['post']('/',auth[_0x0fa0('0x9')](),controller[_0x0fa0('0xf')]);router[_0x0fa0('0x10')](_0x0fa0('0x11'),auth[_0x0fa0('0x9')](),controller['addContacts']);router[_0x0fa0('0x12')](_0x0fa0('0xd'),auth['isAuthenticated'](),controller[_0x0fa0('0x13')]);router[_0x0fa0('0x14')](_0x0fa0('0xd'),auth[_0x0fa0('0x9')](),controller[_0x0fa0('0x15')]);module[_0x0fa0('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 24b58be..33ee115 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 _0x5f66=['sequelize','STRING','INTEGER','DATE'];(function(_0xf6aec0,_0x51ffd6){var _0x59a51b=function(_0x57adc6){while(--_0x57adc6){_0xf6aec0['push'](_0xf6aec0['shift']());}};_0x59a51b(++_0x51ffd6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var Sequelize=require(_0x65f6('0x0'));module['exports']={'firstName':{'type':Sequelize[_0x65f6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x65f6('0x1')]},'street':{'type':Sequelize[_0x65f6('0x1')]},'postalCode':{'type':Sequelize[_0x65f6('0x1')]},'city':{'type':Sequelize[_0x65f6('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x65f6('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x65f6('0x1')]},'mobile':{'type':Sequelize[_0x65f6('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x65f6('0x1')]},'facebook':{'type':Sequelize[_0x65f6('0x1')]},'fb_data':{'type':Sequelize[_0x65f6('0x1')]},'twitter':{'type':Sequelize[_0x65f6('0x1')]},'skype':{'type':Sequelize[_0x65f6('0x1')]},'teams':{'type':Sequelize[_0x65f6('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x65f6('0x1')]},'telegram':{'type':Sequelize[_0x65f6('0x1')]},'UserId':{'type':Sequelize[_0x65f6('0x2')]},'priority':{'type':Sequelize[_0x65f6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x65f6('0x3')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x65f6('0x2')]}}; \ No newline at end of file +var _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x3a6c69,_0x3c1e13){var _0x26fd6a=function(_0x3d78d6){while(--_0x3d78d6){_0x3a6c69['push'](_0x3a6c69['shift']());}};_0x26fd6a(++_0x3c1e13);}(_0x0b0e,0x187));var _0xe0b0=function(_0x133296,_0xe8ff9a){_0x133296=_0x133296-0x0;var _0x193517=_0x0b0e[_0x133296];return _0x193517;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 362d2af..7ee2152 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 _0xdb9b=['dialTimezone','utcOffset','each','duplicates','$or','show','Tag','omit','format','cf_%d','timezones','$and','pickBy','isEmpty','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','merge','options','setTags','ids','getHoppers','includeAll','include','getHopperFinals','ContactId','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','json','pid','upload','createReadStream','parse','meta','import','binding','child_process','stringify','exit','getJourney','mail','chat','sms','fax','whatsapp','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','duration','note','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','createdAt','findAndCountAll','Website','Account','closed','closedAt','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','startCase','Interaction','flatten','slice','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','defaults','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','send','index','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','name','color','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','agent','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','fields','c.firstName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','columnName','displayName','findAll','custom','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappQueueReport'];(function(_0x2a31d1,_0x4a3e5a){var _0x59b150=function(_0x4c601e){while(--_0x4c601e){_0x2a31d1['push'](_0x2a31d1['shift']());}};_0x59b150(++_0x4a3e5a);}(_0xdb9b,0x72));var _0xbdb9=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xdb9b[_0x1035c1];return _0x308d67;};'use strict';var moment=require('moment');var BPromise=require(_0xbdb9('0x0'));var util=require(_0xbdb9('0x1'));var path=require(_0xbdb9('0x2'));var fs=require('fs');var _=require(_0xbdb9('0x3'));var squel=require(_0xbdb9('0x4'));var Papa=require(_0xbdb9('0x5'));var Redis=require(_0xbdb9('0x6'));var qs=require(_0xbdb9('0x7'));var as=require(_0xbdb9('0x8'));var logger=require('../../config/logger')('api');var config=require(_0xbdb9('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config['redis']=_[_0xbdb9('0xa')](config[_0xbdb9('0xb')],{'host':_0xbdb9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdb9('0xb')]));require(_0xbdb9('0xd'))[_0xbdb9('0xe')](socket);function respondWithResult(_0x30b41b,_0x902e1a){_0x902e1a=_0x902e1a||0xc8;return function(_0x1fb63f){if(_0x1fb63f){return _0x30b41b[_0xbdb9('0xf')](_0x902e1a)['json'](_0x1fb63f);}};}function respondWithFilteredResult(_0x24281c,_0x69fb63){return function(_0x1a08eb){if(_0x1a08eb){var _0x1e0a37=typeof _0x69fb63[_0xbdb9('0x10')]===_0xbdb9('0x11')&&typeof _0x69fb63[_0xbdb9('0x12')]===_0xbdb9('0x11');var _0x45fc5a=_0x1a08eb[_0xbdb9('0x13')];var _0x2f8090=_0x1e0a37?0x0:_0x69fb63[_0xbdb9('0x10')];var _0x26b04b=_0x1e0a37?_0x1a08eb['count']:_0x69fb63[_0xbdb9('0x10')]+_0x69fb63[_0xbdb9('0x12')];var _0xbb00cd;if(_0x26b04b>=_0x45fc5a){_0x26b04b=_0x45fc5a;_0xbb00cd=0xc8;}else{_0xbb00cd=0xce;}_0x24281c[_0xbdb9('0xf')](_0xbb00cd);return _0x24281c[_0xbdb9('0x14')](_0xbdb9('0x15'),_0x2f8090+'-'+_0x26b04b+'/'+_0x45fc5a)['json'](_0x1a08eb);}return null;};}function saveUpdates(_0x26e18c){return function(_0x441ead){if(_0x441ead){return _0x441ead[_0xbdb9('0x16')](_0x26e18c)[_0xbdb9('0x17')](function(_0x48ecb0){return _0x48ecb0;});}return null;};}function removeEntity(_0x3b53d5){return function(_0x25da47){if(_0x25da47){return _0x25da47[_0xbdb9('0x18')]()['then'](function(){_0x3b53d5['status'](0xcc)[_0xbdb9('0x19')]();});}};}function handleEntityNotFound(_0x4c25c0){return function(_0xc1048c){if(!_0xc1048c){_0x4c25c0[_0xbdb9('0x1a')](0x194);}return _0xc1048c;};}function handleError(_0x207a12,_0x5ad0ff){_0x5ad0ff=_0x5ad0ff||0x1f4;return function(_0x3b9ba2){logger[_0xbdb9('0x1b')](_0x3b9ba2['stack']);if(_0x3b9ba2['name']){delete _0x3b9ba2['name'];}_0x207a12['status'](_0x5ad0ff)[_0xbdb9('0x1c')](_0x3b9ba2);};}exports[_0xbdb9('0x1d')]=function(_0x2a4117,_0x2c41e2){var _0x3097da={},_0x286724={},_0x433d68={'count':0x0,'rows':[]};return db[_0xbdb9('0x1e')][_0xbdb9('0x1f')]()[_0xbdb9('0x17')](function(_0x136c00){var _0x11fe55=[];for(var _0x422991=0x0;_0x4229910x1){_0x5bf693['or'](_0xbdb9('0x61'),qs[_0xbdb9('0x62')](_0x35a142),null);}else{if(qs['isNumeric'](_0x35a142)){_0x5bf693['or']('c.id\x20LIKE\x20?',_0x35a142+'%');_0x5bf693['or'](_0xbdb9('0x63'),_0x35a142+'%');_0x5bf693['or'](_0xbdb9('0x64'),_0x35a142+'%');_0x5bf693['or'](_0xbdb9('0x65'),_0x35a142+'%');}else if(qs[_0xbdb9('0x66')](_0x35a142)){_0x5bf693['or'](_0xbdb9('0x67'),_0x35a142+'%');}else{_0x5bf693['or'](_0xbdb9('0x68'),'%'+_0x35a142+'%');_0x5bf693['or'](_0xbdb9('0x69'),'%'+_0x35a142+'%');_0x5bf693['or'](_0xbdb9('0x67'),'%'+_0x35a142+'%');}}}}_0x4363a9[_0xbdb9('0x41')](_0x5bf693);_0x4363a9[_0xbdb9('0x6a')](_0xbdb9('0x6b'));var _0x3b93a9={'type':db[_0xbdb9('0x6c')]['QueryTypes'][_0xbdb9('0x6d')],'raw':!![]};var _0x4e77bf=_0x4363a9[_0xbdb9('0x6e')]()[_0xbdb9('0x36')](_0xbdb9('0x6b'));if(_0x3097da[_0xbdb9('0x32')]){_0x3097da[_0xbdb9('0x32')][_0xbdb9('0x4b')](function(_0x168112){_0x4363a9[_0xbdb9('0x32')]('c.'+_0x168112[0x0],_0x168112[0x1]===_0xbdb9('0x6f')?![]:!![]);});}if(!_['isEmpty'](_0x1bfb3d)){_0x4363a9[_0xbdb9('0x70')](_0x5da2d6);_0x4e77bf[_0xbdb9('0x41')](_0xbdb9('0x71'),_0x1bfb3d);}BPromise[_0xbdb9('0x72')]()['then'](function(){if(!_0x53305a)return;if(_0x2a4117[_0xbdb9('0x73')]['role']!==_0xbdb9('0x74'))return;if(!_['some'](_0x53305a['conditions'],[_0xbdb9('0x36'),'User'])){return _0x2a4117[_0xbdb9('0x73')][_0xbdb9('0x75')]({'attributes':['id'],'raw':!![]})[_0xbdb9('0x17')](function(_0x1dbdc5){if(_['isEmpty'](_0x1dbdc5)){_0x4e77bf[_0xbdb9('0x41')](_0xbdb9('0x76'));_0x4363a9[_0xbdb9('0x41')](_0xbdb9('0x76'));}else{_0x4e77bf['where'](_0xbdb9('0x5a'),_[_0xbdb9('0x4a')](_0x1dbdc5,'id'));_0x4363a9[_0xbdb9('0x41')](_0xbdb9('0x5a'),_[_0xbdb9('0x4a')](_0x1dbdc5,'id'));}});}})[_0xbdb9('0x17')](function(){if(_0x2a4117[_0xbdb9('0x73')][_0xbdb9('0x77')]==='agent'&&!_0x53305a&&!_0x2a4117[_0xbdb9('0x2b')]['ListId'])return[];return db[_0xbdb9('0x78')]['query'](_0x4e77bf[_0xbdb9('0x79')](),_0x3b93a9);})[_0xbdb9('0x17')](function(_0x43dabb){_0x433d68['count']=_0x43dabb[_0xbdb9('0x2f')];if(_0x433d68[_0xbdb9('0x13')]===0x0)return[];return db[_0xbdb9('0x78')]['query'](_0x539674[_0xbdb9('0x79')](),_0x3b93a9)[_0xbdb9('0x17')](function(_0x4e7b9e){_0x41cb86=_[_0xbdb9('0x7a')](_0x4e7b9e,'id');_0x3b93a9=_['merge'](_0x3b93a9,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a4117['query'][_0xbdb9('0x7b')]){_0x3097da[_0xbdb9('0x2e')]['forEach'](function(_0x5d2ee6){_0x4363a9['field']('c.'+_0x5d2ee6);});}else{_0x4363a9['field']('c.id');_0x4363a9['field'](_0xbdb9('0x7c'));_0x4363a9[_0xbdb9('0x36')]('c.lastName');_0x4363a9[_0xbdb9('0x36')](_0xbdb9('0x7d'));_0x4363a9[_0xbdb9('0x36')](_0xbdb9('0x7e'));_0x4363a9['field'](_0xbdb9('0x7f'));_0x4363a9[_0xbdb9('0x36')](_0xbdb9('0x80'));_0x4363a9[_0xbdb9('0x36')](_0xbdb9('0x81'));_0x4363a9['field']('c.createdAt');_0x4363a9[_0xbdb9('0x36')](_0xbdb9('0x82'));_0x4363a9[_0xbdb9('0x36')](_0xbdb9('0x83'));_0x4363a9[_0xbdb9('0x36')](_0xbdb9('0x84'),_0xbdb9('0x85'));}if(_0x3097da[_0xbdb9('0x12')])_0x4363a9[_0xbdb9('0x12')](_0x3097da[_0xbdb9('0x12')]);if(_0x3097da[_0xbdb9('0x10')])_0x4363a9[_0xbdb9('0x10')](_0x3097da[_0xbdb9('0x10')]);return db['sequelize'][_0xbdb9('0x2b')](_0x4363a9[_0xbdb9('0x79')](),_0x3b93a9);});})[_0xbdb9('0x17')](function(_0x58501c){_0x58501c[_0xbdb9('0x4b')](function(_0xa51c37){if(_0xa51c37[_0xbdb9('0x85')]){_0xa51c37['Tags']=[];_0xa51c37[_0xbdb9('0x85')]['split'](',')[_0xbdb9('0x4b')](function(_0x9e7c1d){_0xa51c37[_0xbdb9('0x86')][_0xbdb9('0x23')](_0x41cb86[_0x9e7c1d]);});}delete _0xa51c37[_0xbdb9('0x85')];});_0x433d68[_0xbdb9('0x87')]=_0x58501c;return _0x433d68;})[_0xbdb9('0x17')](respondWithFilteredResult(_0x2c41e2,_0x3097da));})[_0xbdb9('0x88')](handleError(_0x2c41e2,null));};exports[_0xbdb9('0x18')]=function(_0x23be9e,_0x227c25){return db[_0xbdb9('0x1e')][_0xbdb9('0x48')]({'where':{'id':_0x23be9e[_0xbdb9('0x89')]['id']}})[_0xbdb9('0x17')](handleEntityNotFound(_0x227c25,null))[_0xbdb9('0x17')](removeEntity(_0x227c25,null))[_0xbdb9('0x88')](handleError(_0x227c25,null));};exports[_0xbdb9('0x1f')]=function(_0x3a72e6,_0x732888){return db[_0xbdb9('0x1e')][_0xbdb9('0x1f')]()[_0xbdb9('0x17')](function(_0x25618f){delete _0x25618f[_0xbdb9('0x8a')];for(var _0x1b7d58=0x0;_0x1b7d58=_0xc96b36){_0x77338f=_0xc96b36;_0x4fd577=0xc8;}else{_0x4fd577=0xce;}_0x4a279b[_0xd0f6('0xd')](_0x4fd577);return _0x4a279b[_0xd0f6('0x12')](_0xd0f6('0x13'),_0x2c9c2e+'-'+_0x77338f+'/'+_0xc96b36)[_0xd0f6('0xe')](_0x4f6206);}return null;};}function saveUpdates(_0x2654cf){return function(_0x18e08b){if(_0x18e08b){return _0x18e08b['update'](_0x2654cf)[_0xd0f6('0x14')](function(_0x4c5758){return _0x4c5758;});}return null;};}function removeEntity(_0x39c254){return function(_0x14face){if(_0x14face){return _0x14face[_0xd0f6('0x15')]()[_0xd0f6('0x14')](function(){_0x39c254[_0xd0f6('0xd')](0xcc)[_0xd0f6('0x16')]();});}};}function handleEntityNotFound(_0x24a54f){return function(_0x13267c){if(!_0x13267c){_0x24a54f[_0xd0f6('0x17')](0x194);}return _0x13267c;};}function handleError(_0x53f407,_0x424316){_0x424316=_0x424316||0x1f4;return function(_0x6c8e39){logger[_0xd0f6('0x18')](_0x6c8e39[_0xd0f6('0x19')]);if(_0x6c8e39[_0xd0f6('0x1a')]){delete _0x6c8e39[_0xd0f6('0x1a')];}_0x53f407[_0xd0f6('0xd')](_0x424316)['send'](_0x6c8e39);};}exports[_0xd0f6('0x1b')]=function(_0x489b87,_0x2f1eac){var _0x130bee={},_0x7b51c2={},_0x5da183={'count':0x0,'rows':[]};return db['CmContact'][_0xd0f6('0x1c')]()[_0xd0f6('0x14')](function(_0x25afb8){var _0x5d2ccb=[];for(var _0x116d82=0x0;_0x116d820x1){_0x14e906['or'](_0xd0f6('0x5d'),qs['getFullTextValue'](_0x4ef11e),null);}else{if(qs[_0xd0f6('0x5e')](_0x4ef11e)){_0x14e906['or'](_0xd0f6('0x5f'),_0x4ef11e+'%');_0x14e906['or']('c.phone\x20LIKE\x20?',_0x4ef11e+'%');_0x14e906['or'](_0xd0f6('0x60'),_0x4ef11e+'%');_0x14e906['or'](_0xd0f6('0x61'),_0x4ef11e+'%');}else if(qs['isEmail'](_0x4ef11e)){_0x14e906['or'](_0xd0f6('0x62'),_0x4ef11e+'%');}else{_0x14e906['or'](_0xd0f6('0x63'),'%'+_0x4ef11e+'%');_0x14e906['or']('c.lastName\x20LIKE\x20?','%'+_0x4ef11e+'%');_0x14e906['or'](_0xd0f6('0x62'),'%'+_0x4ef11e+'%');}}}}_0x497a29[_0xd0f6('0x3c')](_0x14e906);_0x497a29[_0xd0f6('0x64')](_0xd0f6('0x65'));var _0x212cb6={'type':db['Sequelize'][_0xd0f6('0x66')][_0xd0f6('0x67')],'raw':!![]};var _0x585b2f=_0x497a29[_0xd0f6('0x68')]()[_0xd0f6('0x30')](_0xd0f6('0x65'));if(_0x130bee[_0xd0f6('0x69')]){_0x130bee['order'][_0xd0f6('0x48')](function(_0x5b4323){_0x497a29['order']('c.'+_0x5b4323[0x0],_0x5b4323[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd0f6('0x54')](_0x2280e0)){_0x497a29[_0xd0f6('0x6a')](_0x47abf4);_0x585b2f['where'](_0xd0f6('0x6b'),_0x2280e0);}BPromise[_0xd0f6('0x6c')]()[_0xd0f6('0x14')](function(){if(!_0x5378f1)return;if(_0x489b87[_0xd0f6('0x6d')]['role']!==_0xd0f6('0x6e'))return;if(!_[_0xd0f6('0x6f')](_0x5378f1[_0xd0f6('0x42')],[_0xd0f6('0x30'),_0xd0f6('0x70')])){return _0x489b87['user'][_0xd0f6('0x71')]({'attributes':['id'],'raw':!![]})['then'](function(_0x168cf0){if(_[_0xd0f6('0x54')](_0x168cf0)){_0x585b2f[_0xd0f6('0x3c')](_0xd0f6('0x72'));_0x497a29[_0xd0f6('0x3c')](_0xd0f6('0x72'));}else{_0x585b2f[_0xd0f6('0x3c')](_0xd0f6('0x56'),_['map'](_0x168cf0,'id'));_0x497a29['where'](_0xd0f6('0x56'),_[_0xd0f6('0x47')](_0x168cf0,'id'));}});}})[_0xd0f6('0x14')](function(){if(_0x489b87[_0xd0f6('0x6d')]['role']==='agent'&&!_0x5378f1&&!_0x489b87[_0xd0f6('0x28')][_0xd0f6('0x55')])return[];return db['sequelize'][_0xd0f6('0x28')](_0x585b2f[_0xd0f6('0x73')](),_0x212cb6);})[_0xd0f6('0x14')](function(_0x2d23ae){_0x5da183[_0xd0f6('0x74')]=_0x2d23ae[_0xd0f6('0x1d')];if(_0x5da183[_0xd0f6('0x74')]===0x0)return[];return db[_0xd0f6('0x75')][_0xd0f6('0x28')](_0x2daa8f[_0xd0f6('0x73')](),_0x212cb6)[_0xd0f6('0x14')](function(_0x3b4c1b){_0x2c5b8d=_[_0xd0f6('0x76')](_0x3b4c1b,'id');_0x212cb6=_['merge'](_0x212cb6,{'model':db[_0xd0f6('0x77')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x489b87['query'][_0xd0f6('0x2b')]){_0x130bee[_0xd0f6('0x2c')][_0xd0f6('0x48')](function(_0x3e9387){_0x497a29['field']('c.'+_0x3e9387);});}else{_0x497a29['field']('c.id');_0x497a29['field'](_0xd0f6('0x78'));_0x497a29['field'](_0xd0f6('0x79'));_0x497a29[_0xd0f6('0x30')]('c.phone');_0x497a29[_0xd0f6('0x30')]('c.mobile');_0x497a29['field'](_0xd0f6('0x7a'));_0x497a29['field'](_0xd0f6('0x7b'));_0x497a29['field'](_0xd0f6('0x7c'));_0x497a29[_0xd0f6('0x30')]('c.createdAt');_0x497a29[_0xd0f6('0x30')](_0xd0f6('0x7d'));_0x497a29[_0xd0f6('0x30')](_0xd0f6('0x7e'));_0x497a29[_0xd0f6('0x30')](_0xd0f6('0x7f'),_0xd0f6('0x80'));}if(_0x130bee[_0xd0f6('0x10')])_0x497a29[_0xd0f6('0x10')](_0x130bee[_0xd0f6('0x10')]);if(_0x130bee[_0xd0f6('0xf')])_0x497a29[_0xd0f6('0xf')](_0x130bee['offset']);return db[_0xd0f6('0x75')][_0xd0f6('0x28')](_0x497a29[_0xd0f6('0x73')](),_0x212cb6);});})[_0xd0f6('0x14')](function(_0x65b147){_0x65b147[_0xd0f6('0x48')](function(_0x389c40){if(_0x389c40['TagIds']){_0x389c40['Tags']=[];_0x389c40['TagIds'][_0xd0f6('0x46')](',')[_0xd0f6('0x48')](function(_0x5bdb71){_0x389c40[_0xd0f6('0x81')][_0xd0f6('0x21')](_0x2c5b8d[_0x5bdb71]);});}delete _0x389c40[_0xd0f6('0x80')];});_0x5da183[_0xd0f6('0x82')]=_0x65b147;return _0x5da183;})[_0xd0f6('0x14')](respondWithFilteredResult(_0x2f1eac,_0x130bee));})[_0xd0f6('0x83')](handleError(_0x2f1eac,null));};exports['destroy']=function(_0x322d62,_0x22ff03){return db['CmContact']['find']({'where':{'id':_0x322d62[_0xd0f6('0x84')]['id']}})[_0xd0f6('0x14')](handleEntityNotFound(_0x22ff03,null))[_0xd0f6('0x14')](removeEntity(_0x22ff03,null))['catch'](handleError(_0x22ff03,null));};exports[_0xd0f6('0x1c')]=function(_0x268f67,_0x4379bc){return db['CmContact']['describe']()[_0xd0f6('0x14')](function(_0x1c069a){delete _0x1c069a[_0xd0f6('0x85')];for(var _0x463c24=0x0;_0x463c24{}\s\\|]/g,'-');_0x2fd2a5(null,util[_0xc783('0x24')](_0xc783('0x25'),path[_0xc783('0x26')](_0x14bf49[_0xc783('0x22')],path[_0xc783('0x27')](_0x14bf49[_0xc783('0x22')])),Date[_0xc783('0x28')](),path[_0xc783('0x27')](_0x14bf49['originalname'])));}})});router[_0xc783('0x1b')](_0xc783('0x29'),upload[_0xc783('0x2a')](_0xc783('0x2b')),controller[_0xc783('0x2c')]);var upload=multer({'storage':multer[_0xc783('0x1e')]({'destination':function(_0x36cf1f,_0x1094a7,_0x1622b3){_0x1622b3(null,path['join'](config['root'],_0xc783('0x21')));},'filename':function(_0x19e196,_0x4adcda,_0x4294cf){_0x4adcda['originalname']=_0x4adcda[_0xc783('0x22')][_0xc783('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4294cf(null,util[_0xc783('0x24')]('%s-%s%s',path[_0xc783('0x26')](_0x4adcda[_0xc783('0x22')],path[_0xc783('0x27')](_0x4adcda['originalname'])),Date[_0xc783('0x28')](),path[_0xc783('0x27')](_0x4adcda[_0xc783('0x22')])));}})});router['post'](_0xc783('0x2d'),upload['single']('file'),controller[_0xc783('0x2e')]);router['post'](_0xc783('0x2f'),auth[_0xc783('0xc')](),controller[_0xc783('0x30')]);router['put'](_0xc783('0x31'),auth[_0xc783('0xc')](),controller['update']);router[_0xc783('0x32')](_0xc783('0x31'),auth[_0xc783('0xc')](),controller['destroy']);module[_0xc783('0x33')]=router; \ No newline at end of file +var _0x033e=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/tags','getTags','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','getJourney','post','/merge','merge','create','/create_many','bulkCreate','join','root','server/files/tmp','originalname','format','%s-%s%s','basename','/csv','single','file','uploadCsv','diskStorage','replace','extname','/upload','upload','/upload/:id','import','put','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x033e,0x64));var _0xe033=function(_0x545888,_0x3e5f6a){_0x545888=_0x545888-0x0;var _0x2afd1b=_0x033e[_0x545888];return _0x2afd1b;};'use strict';var multer=require(_0xe033('0x0'));var util=require(_0xe033('0x1'));var path=require('path');var timeout=require(_0xe033('0x2'));var express=require(_0xe033('0x3'));var router=express[_0xe033('0x4')]();var fs_extra=require(_0xe033('0x5'));var auth=require(_0xe033('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe033('0x7'));var controller=require(_0xe033('0x8'));router[_0xe033('0x9')]('/',auth[_0xe033('0xa')](),controller['index']);router['get'](_0xe033('0xb'),auth[_0xe033('0xa')](),controller[_0xe033('0xc')]);router[_0xe033('0x9')](_0xe033('0xd'),auth[_0xe033('0xa')](),controller[_0xe033('0xe')]);router[_0xe033('0x9')](_0xe033('0xf'),auth[_0xe033('0xa')](),controller[_0xe033('0x10')]);router[_0xe033('0x9')]('/:id/hoppers',auth[_0xe033('0xa')](),controller['getHoppers']);router[_0xe033('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xe033('0x11')]);router[_0xe033('0x9')](_0xe033('0x12'),auth[_0xe033('0xa')](),controller['getHopperFinals']);router['get'](_0xe033('0x13'),auth['isAuthenticated'](),controller[_0xe033('0x14')]);router['get']('/:id/journey',auth['isAuthenticated'](),controller[_0xe033('0x15')]);router[_0xe033('0x16')](_0xe033('0x17'),auth[_0xe033('0xa')](),controller[_0xe033('0x18')]);router['post']('/',auth[_0xe033('0xa')](),controller[_0xe033('0x19')]);router[_0xe033('0x16')](_0xe033('0x1a'),auth[_0xe033('0xa')](),controller[_0xe033('0x1b')]);router[_0xe033('0x16')](_0xe033('0xf'),auth[_0xe033('0xa')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ac93e,_0x17db0d,_0x543123){_0x543123(null,path[_0xe033('0x1c')](config[_0xe033('0x1d')],_0xe033('0x1e')));},'filename':function(_0x448850,_0x342748,_0x33e1b7){_0x342748[_0xe033('0x1f')]=_0x342748['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e1b7(null,util[_0xe033('0x20')](_0xe033('0x21'),path[_0xe033('0x22')](_0x342748[_0xe033('0x1f')],path['extname'](_0x342748[_0xe033('0x1f')])),Date['now'](),path['extname'](_0x342748[_0xe033('0x1f')])));}})});router[_0xe033('0x16')](_0xe033('0x23'),upload[_0xe033('0x24')](_0xe033('0x25')),controller[_0xe033('0x26')]);var upload=multer({'storage':multer[_0xe033('0x27')]({'destination':function(_0x2c944b,_0x4b3e48,_0x419b00){_0x419b00(null,path['join'](config[_0xe033('0x1d')],'server/files/tmp'));},'filename':function(_0x45856b,_0x3494b8,_0x4ee4a6){_0x3494b8[_0xe033('0x1f')]=_0x3494b8[_0xe033('0x1f')][_0xe033('0x28')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ee4a6(null,util['format']('%s-%s%s',path[_0xe033('0x22')](_0x3494b8[_0xe033('0x1f')],path[_0xe033('0x29')](_0x3494b8[_0xe033('0x1f')])),Date['now'](),path['extname'](_0x3494b8['originalname'])));}})});router['post'](_0xe033('0x2a'),upload[_0xe033('0x24')](_0xe033('0x25')),controller[_0xe033('0x2b')]);router[_0xe033('0x16')](_0xe033('0x2c'),auth[_0xe033('0xa')](),controller[_0xe033('0x2d')]);router[_0xe033('0x2e')](_0xe033('0xd'),auth[_0xe033('0xa')](),controller[_0xe033('0x2f')]);router['delete']('/:id',auth[_0xe033('0xa')](),controller[_0xe033('0x30')]);module[_0xe033('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9724b2c..3724955 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 _0x6351=['TEXT','long','type','parse','values','isArray','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','setDataValue','alias','getDataValue','name','STRING'];(function(_0x41b29e,_0x34b288){var _0xacd517=function(_0x3318df){while(--_0x3318df){_0x41b29e['push'](_0x41b29e['shift']());}};_0xacd517(++_0x34b288);}(_0x6351,0x6f));var _0x1635=function(_0x470d13,_0x3f22fa){_0x470d13=_0x470d13-0x0;var _0x18cc32=_0x6351[_0x470d13];return _0x18cc32;};'use strict';var Sequelize=require(_0x1635('0x0'));var _=require('lodash');module[_0x1635('0x1')]={'name':{'type':Sequelize[_0x1635('0x2')],'get':function(_0xd53569){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5a2844){this[_0x1635('0x3')](_0x1635('0x4'),_0x5a2844?_0x5a2844:this[_0x1635('0x5')](_0x1635('0x6')));}},'type':{'type':Sequelize[_0x1635('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x1635('0x8')](_0x1635('0x9')),'get':function(){if(this[_0x1635('0x5')](_0x1635('0xa'))==='select'){return JSON[_0x1635('0xb')](this[_0x1635('0x5')](_0x1635('0xc')));}else{return this[_0x1635('0x5')](_0x1635('0xc'));}},'set':function(_0x1df972){if(Array[_0x1635('0xd')](_0x1df972)){this['setDataValue'](_0x1635('0xc'),JSON['stringify'](_0x1df972));}else{this['setDataValue'](_0x1635('0xc'),_0x1df972);}}},'required':{'type':Sequelize[_0x1635('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1635('0xf')](_0x1635('0x10'))}}; \ No newline at end of file +var _0xe00f=['isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','parse','values'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe00f,0x125));var _0xfe00=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xe00f[_0x36f47c];return _0x296c55;};'use strict';var Sequelize=require('sequelize');var _=require(_0xfe00('0x0'));module[_0xfe00('0x1')]={'name':{'type':Sequelize[_0xfe00('0x2')],'get':function(_0x42147d){return this['getDataValue'](_0xfe00('0x3'));}},'alias':{'type':Sequelize[_0xfe00('0x4')],'allowNull':![],'set':function(_0xcb03f0){this[_0xfe00('0x5')](_0xfe00('0x3'),_0xcb03f0?_0xcb03f0:this[_0xfe00('0x6')](_0xfe00('0x7')));}},'type':{'type':Sequelize[_0xfe00('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xfe00('0x8')](_0xfe00('0x9')),'get':function(){if(this[_0xfe00('0x6')](_0xfe00('0xa'))==='select'){return JSON[_0xfe00('0xb')](this[_0xfe00('0x6')](_0xfe00('0xc')));}else{return this[_0xfe00('0x6')](_0xfe00('0xc'));}},'set':function(_0x30b53d){if(Array[_0xfe00('0xd')](_0x30b53d)){this[_0xfe00('0x5')](_0xfe00('0xc'),JSON[_0xfe00('0xe')](_0x30b53d));}else{this[_0xfe00('0x5')](_0xfe00('0xc'),_0x30b53d);}}},'required':{'type':Sequelize[_0xfe00('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xfe00('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xfe00('0x10')](_0xfe00('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index ee67e20..26e1841 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 _0xda7f=['map','CmCustomField','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','keys','catch','body','find','params','create','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','then','end','error','stack','name','index'];(function(_0x1ab3c6,_0x22985e){var _0x40a65e=function(_0x535366){while(--_0x535366){_0x1ab3c6['push'](_0x1ab3c6['shift']());}};_0x40a65e(++_0x22985e);}(_0xda7f,0xdf));var _0xfda7=function(_0xaf2c0d,_0x39086c){_0xaf2c0d=_0xaf2c0d-0x0;var _0x119747=_0xda7f[_0xaf2c0d];return _0x119747;};'use strict';var emlformat=require(_0xfda7('0x0'));var rimraf=require(_0xfda7('0x1'));var zipdir=require(_0xfda7('0x2'));var jsonpatch=require(_0xfda7('0x3'));var rp=require(_0xfda7('0x4'));var moment=require(_0xfda7('0x5'));var BPromise=require(_0xfda7('0x6'));var Mustache=require(_0xfda7('0x7'));var util=require('util');var path=require(_0xfda7('0x8'));var sox=require('sox');var csv=require(_0xfda7('0x9'));var ejs=require(_0xfda7('0xa'));var fs=require('fs');var fs_extra=require(_0xfda7('0xb'));var _=require(_0xfda7('0xc'));var squel=require('squel');var crypto=require(_0xfda7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfda7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfda7('0xf'));var Papa=require('papaparse');var Redis=require(_0xfda7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfda7('0x11'));var as=require(_0xfda7('0x12'));var hardwareService=require(_0xfda7('0x13'));var logger=require(_0xfda7('0x14'))(_0xfda7('0x15'));var utils=require(_0xfda7('0x16'));var config=require(_0xfda7('0x17'));var licenseUtil=require(_0xfda7('0x18'));var db=require(_0xfda7('0x19'))['db'];function respondWithStatusCode(_0x38ae94,_0x75aef1){_0x75aef1=_0x75aef1||0xcc;return function(_0x270b34){if(_0x270b34){return _0x38ae94[_0xfda7('0x1a')](_0x75aef1);}return _0x38ae94[_0xfda7('0x1b')](_0x75aef1)['end']();};}function respondWithResult(_0x135e40,_0x52ffef){_0x52ffef=_0x52ffef||0xc8;return function(_0x2604f9){if(_0x2604f9){return _0x135e40[_0xfda7('0x1b')](_0x52ffef)[_0xfda7('0x1c')](_0x2604f9);}};}function respondWithFilteredResult(_0x46ee97,_0x1570a9){return function(_0x3d79fd){if(_0x3d79fd){var _0x1bd2a9=typeof _0x1570a9[_0xfda7('0x1d')]==='undefined'&&typeof _0x1570a9['limit']===_0xfda7('0x1e');var _0x54869d=_0x3d79fd[_0xfda7('0x1f')];var _0xe68c10=_0x1bd2a9?0x0:_0x1570a9['offset'];var _0x5cac89=_0x1bd2a9?_0x3d79fd['count']:_0x1570a9[_0xfda7('0x1d')]+_0x1570a9[_0xfda7('0x20')];var _0x436b72;if(_0x5cac89>=_0x54869d){_0x5cac89=_0x54869d;_0x436b72=0xc8;}else{_0x436b72=0xce;}_0x46ee97[_0xfda7('0x1b')](_0x436b72);return _0x46ee97['set'](_0xfda7('0x21'),_0xe68c10+'-'+_0x5cac89+'/'+_0x54869d)['json'](_0x3d79fd);}return null;};}function patchUpdates(_0x50872b){return function(_0x35fe27){try{jsonpatch[_0xfda7('0x22')](_0x35fe27,_0x50872b,!![]);}catch(_0xb1ae92){return BPromise['reject'](_0xb1ae92);}return _0x35fe27[_0xfda7('0x23')]();};}function saveUpdates(_0xb6dfc9,_0x168949){return function(_0x327d50){if(_0x327d50){return _0x327d50[_0xfda7('0x24')](_0xb6dfc9)['then'](function(_0x37151c){return _0x37151c;});}return null;};}function removeEntity(_0x35634d,_0x3a972){return function(_0x2ac4d9){if(_0x2ac4d9){return _0x2ac4d9[_0xfda7('0x25')]()[_0xfda7('0x26')](function(){_0x35634d[_0xfda7('0x1b')](0xcc)[_0xfda7('0x27')]();});}};}function handleEntityNotFound(_0x7cc9cd,_0x20912a){return function(_0x4fc357){if(!_0x4fc357){_0x7cc9cd[_0xfda7('0x1a')](0x194);}return _0x4fc357;};}function handleError(_0x1d8d5d,_0x171b6c){_0x171b6c=_0x171b6c||0x1f4;return function(_0x59ec29){logger[_0xfda7('0x28')](_0x59ec29[_0xfda7('0x29')]);if(_0x59ec29['name']){delete _0x59ec29[_0xfda7('0x2a')];}_0x1d8d5d[_0xfda7('0x1b')](_0x171b6c)['send'](_0x59ec29);};}exports[_0xfda7('0x2b')]=function(_0x4b32e9,_0x4ddea4){var _0x3fc3cd={},_0x261423={},_0x22a48e={'count':0x0,'rows':[]};var _0x3a9cf6=_[_0xfda7('0x2c')](db[_0xfda7('0x2d')][_0xfda7('0x2e')],function(_0x1eda5e){return{'name':_0x1eda5e[_0xfda7('0x2f')],'type':_0x1eda5e[_0xfda7('0x30')]['key']};});_0x261423['model']=_['differenceBy'](_[_0xfda7('0x2c')](_0x3a9cf6,'name'),['name']);_0x261423['query']=_['keys'](_0x4b32e9[_0xfda7('0x31')]);_0x261423[_0xfda7('0x32')]=_[_0xfda7('0x33')](_0x261423[_0xfda7('0x34')],_0x261423['query']);_0x3fc3cd[_0xfda7('0x35')]=_[_0xfda7('0x33')](_0x261423[_0xfda7('0x34')],qs['fields'](_0x4b32e9[_0xfda7('0x31')][_0xfda7('0x36')]));_0x3fc3cd[_0xfda7('0x35')]=_0x3fc3cd['attributes'][_0xfda7('0x37')]?_0x3fc3cd[_0xfda7('0x35')]:_0x261423[_0xfda7('0x34')];if(!_0x4b32e9[_0xfda7('0x31')][_0xfda7('0x38')](_0xfda7('0x39'))){_0x3fc3cd[_0xfda7('0x20')]=qs[_0xfda7('0x20')](_0x4b32e9['query']['limit']);_0x3fc3cd[_0xfda7('0x1d')]=qs['offset'](_0x4b32e9[_0xfda7('0x31')][_0xfda7('0x1d')]);}_0x3fc3cd[_0xfda7('0x3a')]=qs[_0xfda7('0x3b')](_0x4b32e9[_0xfda7('0x31')][_0xfda7('0x3b')]);_0x3fc3cd['where']=qs[_0xfda7('0x32')](_[_0xfda7('0x3c')](_0x4b32e9[_0xfda7('0x31')],_0x261423[_0xfda7('0x32')]),_0x3a9cf6);if(_0x4b32e9[_0xfda7('0x31')][_0xfda7('0x3d')]){_0x3fc3cd[_0xfda7('0x3e')]=_[_0xfda7('0x3f')](_0x3fc3cd[_0xfda7('0x3e')],{'$or':_[_0xfda7('0x2c')](_0x3a9cf6,function(_0x3a0622){if(_0x3a0622[_0xfda7('0x30')]!=='VIRTUAL'){var _0x5d68ff={};_0x5d68ff[_0x3a0622[_0xfda7('0x2a')]]={'$like':'%'+_0x4b32e9[_0xfda7('0x31')][_0xfda7('0x3d')]+'%'};return _0x5d68ff;}})});}_0x3fc3cd=_['merge']({},_0x3fc3cd,_0x4b32e9[_0xfda7('0x40')]);var _0x31a889={'where':_0x3fc3cd['where']};return db[_0xfda7('0x2d')][_0xfda7('0x1f')](_0x31a889)[_0xfda7('0x26')](function(_0x583bab){_0x22a48e[_0xfda7('0x1f')]=_0x583bab;if(_0x4b32e9[_0xfda7('0x31')][_0xfda7('0x41')]){_0x3fc3cd[_0xfda7('0x42')]=[{'all':!![]}];}return db[_0xfda7('0x2d')][_0xfda7('0x43')](_0x3fc3cd);})['then'](function(_0x3fa811){_0x22a48e[_0xfda7('0x44')]=_0x3fa811;return _0x22a48e;})[_0xfda7('0x26')](respondWithFilteredResult(_0x4ddea4,_0x3fc3cd))['catch'](handleError(_0x4ddea4,null));};exports[_0xfda7('0x45')]=function(_0x5533cd,_0x4656de){var _0x50622d={'raw':!![],'where':{'id':_0x5533cd['params']['id']}},_0x562b93={};_0x562b93[_0xfda7('0x34')]=_[_0xfda7('0x46')](db[_0xfda7('0x2d')]['rawAttributes']);_0x562b93[_0xfda7('0x31')]=_[_0xfda7('0x46')](_0x5533cd[_0xfda7('0x31')]);_0x562b93['filters']=_['intersection'](_0x562b93[_0xfda7('0x34')],_0x562b93[_0xfda7('0x31')]);_0x50622d[_0xfda7('0x35')]=_[_0xfda7('0x33')](_0x562b93[_0xfda7('0x34')],qs[_0xfda7('0x36')](_0x5533cd['query'][_0xfda7('0x36')]));_0x50622d[_0xfda7('0x35')]=_0x50622d[_0xfda7('0x35')][_0xfda7('0x37')]?_0x50622d[_0xfda7('0x35')]:_0x562b93[_0xfda7('0x34')];if(_0x5533cd['query'][_0xfda7('0x41')]){_0x50622d[_0xfda7('0x42')]=[{'all':!![]}];}_0x50622d=_[_0xfda7('0x3f')]({},_0x50622d,_0x5533cd[_0xfda7('0x40')]);return db[_0xfda7('0x2d')]['find'](_0x50622d)['then'](handleEntityNotFound(_0x4656de,null))['then'](respondWithResult(_0x4656de,null))[_0xfda7('0x47')](handleError(_0x4656de,null));};exports[_0xfda7('0x24')]=function(_0x3ebc03,_0xa885c2){if(_0x3ebc03[_0xfda7('0x48')]['id']){delete _0x3ebc03[_0xfda7('0x48')]['id'];}return db['CmCustomField'][_0xfda7('0x49')]({'where':{'id':_0x3ebc03[_0xfda7('0x4a')]['id']}})[_0xfda7('0x26')](handleEntityNotFound(_0xa885c2,null))['then'](saveUpdates(_0x3ebc03[_0xfda7('0x48')],null))[_0xfda7('0x26')](respondWithResult(_0xa885c2,null))[_0xfda7('0x47')](handleError(_0xa885c2,null));};exports[_0xfda7('0x25')]=function(_0x4e7220,_0x1f4a22){return db[_0xfda7('0x2d')]['find']({'where':{'id':_0x4e7220[_0xfda7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f4a22,null))[_0xfda7('0x26')](removeEntity(_0x1f4a22,null))[_0xfda7('0x47')](handleError(_0x1f4a22,null));};exports[_0xfda7('0x4b')]=function(_0x20eef7,_0x3ee8a6){var _0x49184f;return db['sequelize'][_0xfda7('0x4c')](function(_0x365776){return db['CmCustomField'][_0xfda7('0x4b')](_0x20eef7[_0xfda7('0x48')],{'transaction':_0x365776})['then'](function(_0xfa9b21){_0x49184f=_0xfa9b21;var _0xb6f5e7={'type':db[_0xfda7('0x4d')][_0xfda7('0x4e')],'transaction':_0x365776};switch(_0x20eef7['body']['type']){case _0xfda7('0x4f'):_0xb6f5e7[_0xfda7('0x30')]=db['Sequelize'][_0xfda7('0x4e')];break;case _0xfda7('0x50'):_0xb6f5e7['type']=db['Sequelize'][_0xfda7('0x51')];break;case'switch':_0xb6f5e7[_0xfda7('0x30')]=db['Sequelize'][_0xfda7('0x52')];_0xb6f5e7['defaultValue']=![];break;default:}return db[_0xfda7('0x53')][_0xfda7('0x54')][_0xfda7('0x55')](_0xfda7('0x56'),util[_0xfda7('0x57')](_0xfda7('0x58'),_0x49184f['id']),_0xb6f5e7);})[_0xfda7('0x26')](function(){return _0x49184f;});})[_0xfda7('0x26')](respondWithResult(_0x3ee8a6,0xc9))[_0xfda7('0x47')](handleError(_0x3ee8a6,null));}; \ No newline at end of file +var _0x4373=['switch','addColumn','cm_contacts','format','cf_%d','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','rows','catch','params','keys','fields','find','body','create','sequelize','transaction','Sequelize','type','text','TEXT','INTEGER'];(function(_0x23e5fd,_0x2c6da6){var _0xab592b=function(_0x75559a){while(--_0x75559a){_0x23e5fd['push'](_0x23e5fd['shift']());}};_0xab592b(++_0x2c6da6);}(_0x4373,0xfe));var _0x3437=function(_0x48590a,_0x5d442f){_0x48590a=_0x48590a-0x0;var _0x2446ea=_0x4373[_0x48590a];return _0x2446ea;};'use strict';var emlformat=require(_0x3437('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3437('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3437('0x2'));var Mustache=require(_0x3437('0x3'));var util=require(_0x3437('0x4'));var path=require(_0x3437('0x5'));var sox=require('sox');var csv=require(_0x3437('0x6'));var ejs=require(_0x3437('0x7'));var fs=require('fs');var fs_extra=require(_0x3437('0x8'));var _=require(_0x3437('0x9'));var squel=require(_0x3437('0xa'));var crypto=require(_0x3437('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3437('0x6'));var querystring=require(_0x3437('0xc'));var Papa=require('papaparse');var Redis=require(_0x3437('0xd'));var authService=require(_0x3437('0xe'));var qs=require(_0x3437('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3437('0x10'));var logger=require('../../config/logger')(_0x3437('0x11'));var utils=require('../../config/utils');var config=require(_0x3437('0x12'));var licenseUtil=require(_0x3437('0x13'));var db=require(_0x3437('0x14'))['db'];function respondWithStatusCode(_0x591dac,_0x4c9ae4){_0x4c9ae4=_0x4c9ae4||0xcc;return function(_0xbd1db7){if(_0xbd1db7){return _0x591dac[_0x3437('0x15')](_0x4c9ae4);}return _0x591dac['status'](_0x4c9ae4)['end']();};}function respondWithResult(_0x220314,_0x2cb114){_0x2cb114=_0x2cb114||0xc8;return function(_0x5cbe11){if(_0x5cbe11){return _0x220314[_0x3437('0x16')](_0x2cb114)['json'](_0x5cbe11);}};}function respondWithFilteredResult(_0x27eca1,_0x45fef8){return function(_0x557d95){if(_0x557d95){var _0x5620b1=typeof _0x45fef8[_0x3437('0x17')]===_0x3437('0x18')&&typeof _0x45fef8['limit']===_0x3437('0x18');var _0x7317c=_0x557d95[_0x3437('0x19')];var _0x40a644=_0x5620b1?0x0:_0x45fef8[_0x3437('0x17')];var _0x2ca559=_0x5620b1?_0x557d95['count']:_0x45fef8[_0x3437('0x17')]+_0x45fef8[_0x3437('0x1a')];var _0x52ed50;if(_0x2ca559>=_0x7317c){_0x2ca559=_0x7317c;_0x52ed50=0xc8;}else{_0x52ed50=0xce;}_0x27eca1[_0x3437('0x16')](_0x52ed50);return _0x27eca1[_0x3437('0x1b')](_0x3437('0x1c'),_0x40a644+'-'+_0x2ca559+'/'+_0x7317c)[_0x3437('0x1d')](_0x557d95);}return null;};}function patchUpdates(_0x273c83){return function(_0x25a4b8){try{jsonpatch[_0x3437('0x1e')](_0x25a4b8,_0x273c83,!![]);}catch(_0xea1b7a){return BPromise[_0x3437('0x1f')](_0xea1b7a);}return _0x25a4b8[_0x3437('0x20')]();};}function saveUpdates(_0x54f997,_0x1d43a3){return function(_0x813a35){if(_0x813a35){return _0x813a35[_0x3437('0x21')](_0x54f997)[_0x3437('0x22')](function(_0x4c17de){return _0x4c17de;});}return null;};}function removeEntity(_0x349bb2,_0x4f7618){return function(_0x18f620){if(_0x18f620){return _0x18f620[_0x3437('0x23')]()[_0x3437('0x22')](function(){_0x349bb2[_0x3437('0x16')](0xcc)[_0x3437('0x24')]();});}};}function handleEntityNotFound(_0x9cf0c0,_0x5cde36){return function(_0x2d01e8){if(!_0x2d01e8){_0x9cf0c0[_0x3437('0x15')](0x194);}return _0x2d01e8;};}function handleError(_0x44e759,_0x3f9463){_0x3f9463=_0x3f9463||0x1f4;return function(_0x4fe408){logger[_0x3437('0x25')](_0x4fe408[_0x3437('0x26')]);if(_0x4fe408[_0x3437('0x27')]){delete _0x4fe408[_0x3437('0x27')];}_0x44e759['status'](_0x3f9463)[_0x3437('0x28')](_0x4fe408);};}exports[_0x3437('0x29')]=function(_0x2f4a3b,_0x876740){var _0x3eb16d={},_0x348f4a={},_0x3e62dd={'count':0x0,'rows':[]};var _0x175faf=_[_0x3437('0x2a')](db[_0x3437('0x2b')][_0x3437('0x2c')],function(_0x377ec5){return{'name':_0x377ec5[_0x3437('0x2d')],'type':_0x377ec5['type'][_0x3437('0x2e')]};});_0x348f4a[_0x3437('0x2f')]=_[_0x3437('0x30')](_['map'](_0x175faf,_0x3437('0x27')),['name']);_0x348f4a[_0x3437('0x31')]=_['keys'](_0x2f4a3b['query']);_0x348f4a[_0x3437('0x32')]=_[_0x3437('0x33')](_0x348f4a['model'],_0x348f4a['query']);_0x3eb16d['attributes']=_['intersection'](_0x348f4a[_0x3437('0x2f')],qs['fields'](_0x2f4a3b[_0x3437('0x31')]['fields']));_0x3eb16d[_0x3437('0x34')]=_0x3eb16d['attributes'][_0x3437('0x35')]?_0x3eb16d['attributes']:_0x348f4a[_0x3437('0x2f')];if(!_0x2f4a3b['query'][_0x3437('0x36')](_0x3437('0x37'))){_0x3eb16d[_0x3437('0x1a')]=qs[_0x3437('0x1a')](_0x2f4a3b[_0x3437('0x31')][_0x3437('0x1a')]);_0x3eb16d[_0x3437('0x17')]=qs[_0x3437('0x17')](_0x2f4a3b[_0x3437('0x31')][_0x3437('0x17')]);}_0x3eb16d['order']=qs[_0x3437('0x38')](_0x2f4a3b[_0x3437('0x31')][_0x3437('0x38')]);_0x3eb16d[_0x3437('0x39')]=qs[_0x3437('0x32')](_[_0x3437('0x3a')](_0x2f4a3b[_0x3437('0x31')],_0x348f4a[_0x3437('0x32')]),_0x175faf);if(_0x2f4a3b[_0x3437('0x31')]['filter']){_0x3eb16d[_0x3437('0x39')]=_[_0x3437('0x3b')](_0x3eb16d['where'],{'$or':_[_0x3437('0x2a')](_0x175faf,function(_0x1bce58){if(_0x1bce58['type']!=='VIRTUAL'){var _0x109f2c={};_0x109f2c[_0x1bce58['name']]={'$like':'%'+_0x2f4a3b[_0x3437('0x31')]['filter']+'%'};return _0x109f2c;}})});}_0x3eb16d=_[_0x3437('0x3b')]({},_0x3eb16d,_0x2f4a3b['options']);var _0x5adcc1={'where':_0x3eb16d[_0x3437('0x39')]};return db[_0x3437('0x2b')]['count'](_0x5adcc1)[_0x3437('0x22')](function(_0x575c84){_0x3e62dd[_0x3437('0x19')]=_0x575c84;if(_0x2f4a3b[_0x3437('0x31')][_0x3437('0x3c')]){_0x3eb16d[_0x3437('0x3d')]=[{'all':!![]}];}return db[_0x3437('0x2b')][_0x3437('0x3e')](_0x3eb16d);})[_0x3437('0x22')](function(_0x421e84){_0x3e62dd[_0x3437('0x3f')]=_0x421e84;return _0x3e62dd;})[_0x3437('0x22')](respondWithFilteredResult(_0x876740,_0x3eb16d))[_0x3437('0x40')](handleError(_0x876740,null));};exports['show']=function(_0x5aecec,_0x171e7f){var _0x3279b4={'raw':!![],'where':{'id':_0x5aecec[_0x3437('0x41')]['id']}},_0x86aab5={};_0x86aab5['model']=_[_0x3437('0x42')](db[_0x3437('0x2b')][_0x3437('0x2c')]);_0x86aab5[_0x3437('0x31')]=_['keys'](_0x5aecec[_0x3437('0x31')]);_0x86aab5[_0x3437('0x32')]=_['intersection'](_0x86aab5[_0x3437('0x2f')],_0x86aab5[_0x3437('0x31')]);_0x3279b4[_0x3437('0x34')]=_[_0x3437('0x33')](_0x86aab5[_0x3437('0x2f')],qs[_0x3437('0x43')](_0x5aecec[_0x3437('0x31')]['fields']));_0x3279b4[_0x3437('0x34')]=_0x3279b4[_0x3437('0x34')][_0x3437('0x35')]?_0x3279b4[_0x3437('0x34')]:_0x86aab5[_0x3437('0x2f')];if(_0x5aecec[_0x3437('0x31')]['includeAll']){_0x3279b4[_0x3437('0x3d')]=[{'all':!![]}];}_0x3279b4=_['merge']({},_0x3279b4,_0x5aecec['options']);return db[_0x3437('0x2b')][_0x3437('0x44')](_0x3279b4)[_0x3437('0x22')](handleEntityNotFound(_0x171e7f,null))[_0x3437('0x22')](respondWithResult(_0x171e7f,null))[_0x3437('0x40')](handleError(_0x171e7f,null));};exports[_0x3437('0x21')]=function(_0x64f300,_0x13c780){if(_0x64f300[_0x3437('0x45')]['id']){delete _0x64f300['body']['id'];}return db[_0x3437('0x2b')][_0x3437('0x44')]({'where':{'id':_0x64f300[_0x3437('0x41')]['id']}})['then'](handleEntityNotFound(_0x13c780,null))[_0x3437('0x22')](saveUpdates(_0x64f300[_0x3437('0x45')],null))['then'](respondWithResult(_0x13c780,null))[_0x3437('0x40')](handleError(_0x13c780,null));};exports['destroy']=function(_0xa98775,_0x4863c4){return db[_0x3437('0x2b')][_0x3437('0x44')]({'where':{'id':_0xa98775['params']['id']}})[_0x3437('0x22')](handleEntityNotFound(_0x4863c4,null))[_0x3437('0x22')](removeEntity(_0x4863c4,null))['catch'](handleError(_0x4863c4,null));};exports[_0x3437('0x46')]=function(_0x146a7c,_0x522d89){var _0x581331;return db[_0x3437('0x47')][_0x3437('0x48')](function(_0x204cd1){return db[_0x3437('0x2b')][_0x3437('0x46')](_0x146a7c[_0x3437('0x45')],{'transaction':_0x204cd1})['then'](function(_0x5240d5){_0x581331=_0x5240d5;var _0x1b4438={'type':db[_0x3437('0x49')]['TEXT'],'transaction':_0x204cd1};switch(_0x146a7c[_0x3437('0x45')][_0x3437('0x4a')]){case _0x3437('0x4b'):_0x1b4438[_0x3437('0x4a')]=db[_0x3437('0x49')][_0x3437('0x4c')];break;case'number':_0x1b4438[_0x3437('0x4a')]=db[_0x3437('0x49')][_0x3437('0x4d')];break;case _0x3437('0x4e'):_0x1b4438[_0x3437('0x4a')]=db[_0x3437('0x49')]['BOOLEAN'];_0x1b4438['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x3437('0x4f')](_0x3437('0x50'),util[_0x3437('0x51')](_0x3437('0x52'),_0x581331['id']),_0x1b4438);})[_0x3437('0x22')](function(){return _0x581331;});})['then'](respondWithResult(_0x522d89,0xc9))['catch'](handleError(_0x522d89,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c54456a..e8cf936 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 _0x539f=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x56ecbc,_0x530310){var _0x343a25=function(_0x245599){while(--_0x245599){_0x56ecbc['push'](_0x56ecbc['shift']());}};_0x343a25(++_0x530310);}(_0x539f,0xd3));var _0xf539=function(_0x5770eb,_0x46ecfc){_0x5770eb=_0x5770eb-0x0;var _0x4f92d2=_0x539f[_0x5770eb];return _0x4f92d2;};'use strict';var _=require(_0xf539('0x0'));var util=require(_0xf539('0x1'));var logger=require(_0xf539('0x2'))(_0xf539('0x3'));var moment=require(_0xf539('0x4'));var BPromise=require(_0xf539('0x5'));var rp=require(_0xf539('0x6'));var fs=require('fs');var path=require(_0xf539('0x7'));var rimraf=require(_0xf539('0x8'));var config=require(_0xf539('0x9'));var attributes=require(_0xf539('0xa'));module['exports']=function(_0x11b2bc,_0x1ca3f5){return _0x11b2bc[_0xf539('0xb')](_0xf539('0xc'),attributes,{'tableName':_0xf539('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b99=['api','moment','path','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x46428f,_0x5c8d1a){var _0x33e3e0=function(_0x177778){while(--_0x177778){_0x46428f['push'](_0x46428f['shift']());}};_0x33e3e0(++_0x5c8d1a);}(_0x6b99,0xfa));var _0x96b9=function(_0x4acfd2,_0x5b9374){_0x4acfd2=_0x4acfd2-0x0;var _0x12afbe=_0x6b99[_0x4acfd2];return _0x12afbe;};'use strict';var _=require(_0x96b9('0x0'));var util=require(_0x96b9('0x1'));var logger=require(_0x96b9('0x2'))(_0x96b9('0x3'));var moment=require(_0x96b9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x96b9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x96b9('0x6'));module[_0x96b9('0x7')]=function(_0x59a21d,_0x1707bd){return _0x59a21d[_0x96b9('0x8')](_0x96b9('0x9'),attributes,{'tableName':_0x96b9('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 7676c4b..d6a6278 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 _0x5abf=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x39e144,_0x4b4847){var _0x5ba205=function(_0x4317d3){while(--_0x4317d3){_0x39e144['push'](_0x39e144['shift']());}};_0x5ba205(++_0x4b4847);}(_0x5abf,0x72));var _0xf5ab=function(_0x3e9582,_0x5ef882){_0x3e9582=_0x3e9582-0x0;var _0xdf59d7=_0x5abf[_0x3e9582];return _0xdf59d7;};'use strict';var _=require(_0xf5ab('0x0'));var util=require(_0xf5ab('0x1'));var moment=require(_0xf5ab('0x2'));var BPromise=require(_0xf5ab('0x3'));var rs=require(_0xf5ab('0x4'));var fs=require('fs');var Redis=require(_0xf5ab('0x5'));var db=require(_0xf5ab('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5ab('0x7'))(_0xf5ab('0x8'));var config=require(_0xf5ab('0x9'));var jayson=require(_0xf5ab('0xa'));var client=jayson[_0xf5ab('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb8bffc,_0x1a8cbc,_0x3062b4){return new BPromise(function(_0x4c068d,_0x1fef14){return client[_0xf5ab('0xc')](_0xb8bffc,_0x3062b4)['then'](function(_0x1d009c){logger['info'](_0xf5ab('0xd'),_0x1a8cbc,_0xf5ab('0xe'));logger[_0xf5ab('0xf')](_0xf5ab('0x10'),_0x1a8cbc,_0xf5ab('0xe'),JSON[_0xf5ab('0x11')](_0x1d009c));if(_0x1d009c[_0xf5ab('0x12')]){if(_0x1d009c[_0xf5ab('0x12')]['code']===0x1f4){logger['error'](_0xf5ab('0xd'),_0x1a8cbc,_0x1d009c[_0xf5ab('0x12')]['message']);return _0x1fef14(_0x1d009c['error']['message']);}logger[_0xf5ab('0x12')](_0xf5ab('0xd'),_0x1a8cbc,_0x1d009c[_0xf5ab('0x12')][_0xf5ab('0x13')]);return _0x4c068d(_0x1d009c[_0xf5ab('0x12')]['message']);}else{logger[_0xf5ab('0x14')](_0xf5ab('0xd'),_0x1a8cbc,'request\x20sent');_0x4c068d(_0x1d009c[_0xf5ab('0x15')][_0xf5ab('0x13')]);}})[_0xf5ab('0x16')](function(_0x2bd5ec){logger[_0xf5ab('0x12')](_0xf5ab('0xd'),_0x1a8cbc,_0x2bd5ec);_0x1fef14(_0x2bd5ec);});});} \ No newline at end of file +var _0xd6ac=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd6ac,0x1c7));var _0xcd6a=function(_0x1dcd08,_0x4041fc){_0x1dcd08=_0x1dcd08-0x0;var _0x45d17f=_0xd6ac[_0x1dcd08];return _0x45d17f;};'use strict';var _=require(_0xcd6a('0x0'));var util=require(_0xcd6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd6a('0x2'));var fs=require('fs');var Redis=require(_0xcd6a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd6a('0x4'));var logger=require(_0xcd6a('0x5'))(_0xcd6a('0x6'));var config=require(_0xcd6a('0x7'));var jayson=require(_0xcd6a('0x8'));var client=jayson[_0xcd6a('0x9')][_0xcd6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4138aa,_0x53810c,_0xad4626){return new BPromise(function(_0x2e0522,_0x10e581){return client['request'](_0x4138aa,_0xad4626)[_0xcd6a('0xb')](function(_0x14b2c6){logger[_0xcd6a('0xc')]('CmCustomField,\x20%s,\x20%s',_0x53810c,_0xcd6a('0xd'));logger[_0xcd6a('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x53810c,_0xcd6a('0xd'),JSON[_0xcd6a('0xf')](_0x14b2c6));if(_0x14b2c6[_0xcd6a('0x10')]){if(_0x14b2c6[_0xcd6a('0x10')][_0xcd6a('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x53810c,_0x14b2c6['error'][_0xcd6a('0x12')]);return _0x10e581(_0x14b2c6['error']['message']);}logger[_0xcd6a('0x10')](_0xcd6a('0x13'),_0x53810c,_0x14b2c6['error'][_0xcd6a('0x12')]);return _0x2e0522(_0x14b2c6[_0xcd6a('0x10')][_0xcd6a('0x12')]);}else{logger[_0xcd6a('0xc')]('CmCustomField,\x20%s,\x20%s',_0x53810c,'request\x20sent');_0x2e0522(_0x14b2c6[_0xcd6a('0x14')][_0xcd6a('0x12')]);}})[_0xcd6a('0x15')](function(_0xa32399){logger[_0xcd6a('0x10')](_0xcd6a('0x13'),_0x53810c,_0xa32399);_0x10e581(_0xa32399);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a0ff4ae..1b56085 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 _0x46a0=['isAuthenticated','post','create','put','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x46a0,0xe3));var _0x046a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46a0[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x046a('0x0'));var util=require('util');var path=require(_0x046a('0x1'));var timeout=require('connect-timeout');var express=require(_0x046a('0x2'));var router=express[_0x046a('0x3')]();var fs_extra=require(_0x046a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x046a('0x5'));var config=require(_0x046a('0x6'));var controller=require(_0x046a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x046a('0x8')]);router[_0x046a('0x9')](_0x046a('0xa'),auth[_0x046a('0xb')](),controller['show']);router[_0x046a('0xc')]('/',auth[_0x046a('0xb')](),controller[_0x046a('0xd')]);router[_0x046a('0xe')](_0x046a('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x046a('0xa'),auth[_0x046a('0xb')](),controller[_0x046a('0xf')]);module[_0x046a('0x10')]=router; \ No newline at end of file +var _0x5cd7=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cd7,0x102));var _0x75cd=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0x5cd7[_0x4ede04];return _0x49ccfc;};'use strict';var multer=require(_0x75cd('0x0'));var util=require('util');var path=require(_0x75cd('0x1'));var timeout=require(_0x75cd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x75cd('0x3'));var auth=require(_0x75cd('0x4'));var interaction=require(_0x75cd('0x5'));var config=require(_0x75cd('0x6'));var controller=require(_0x75cd('0x7'));router[_0x75cd('0x8')]('/',auth[_0x75cd('0x9')](),controller[_0x75cd('0xa')]);router[_0x75cd('0x8')]('/:id',auth[_0x75cd('0x9')](),controller[_0x75cd('0xb')]);router[_0x75cd('0xc')]('/',auth[_0x75cd('0x9')](),controller[_0x75cd('0xd')]);router[_0x75cd('0xe')](_0x75cd('0xf'),auth[_0x75cd('0x9')](),controller[_0x75cd('0x10')]);router[_0x75cd('0x11')]('/:id',auth[_0x75cd('0x9')](),controller['destroy']);module[_0x75cd('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 1d7cdbc..54329e5 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 _0x2ef3=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x45633d,_0x159a1c){_0x45633d=_0x45633d-0x0;var _0x4a852c=_0x2ef3[_0x45633d];return _0x4a852c;};'use strict';var moment=require(_0x32ef('0x0'));var Sequelize=require(_0x32ef('0x1'));module[_0x32ef('0x2')]={'phone':{'type':Sequelize[_0x32ef('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':moment()['format'](_0x32ef('0x6'))},'countbusyretry':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x32ef('0x7')](0x2)[_0x32ef('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x32ef('0x7')],'unique':_0x32ef('0x9')},'ListId':{'type':Sequelize[_0x32ef('0x7')],'unique':_0x32ef('0x9')},'UserId':{'type':Sequelize[_0x32ef('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x32ef('0x7')],'unique':_0x32ef('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x32ef('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xc2c7=['INTEGER','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x37fc42,_0x3703fb){var _0x20a573=function(_0x4fdead){while(--_0x4fdead){_0x37fc42['push'](_0x37fc42['shift']());}};_0x20a573(++_0x3703fb);}(_0xc2c7,0x134));var _0x7c2c=function(_0x56b3cf,_0x18dfbb){_0x56b3cf=_0x56b3cf-0x0;var _0x3090ef=_0xc2c7[_0x56b3cf];return _0x3090ef;};'use strict';var moment=require('moment');var Sequelize=require(_0x7c2c('0x0'));module[_0x7c2c('0x1')]={'phone':{'type':Sequelize[_0x7c2c('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x7c2c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7c2c('0x4')],'defaultValue':moment()[_0x7c2c('0x5')](_0x7c2c('0x6'))},'countbusyretry':{'type':Sequelize[_0x7c2c('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7c2c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7c2c('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7c2c('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7c2c('0x7')],'unique':_0x7c2c('0x8')},'ListId':{'type':Sequelize[_0x7c2c('0x7')],'unique':_0x7c2c('0x8')},'UserId':{'type':Sequelize[_0x7c2c('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7c2c('0x8')},'CampaignId':{'type':Sequelize[_0x7c2c('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x7c2c('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7c2c('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7c2c('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7c2c('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7c2c('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7c2c('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7c2c('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 3afa18c..a2b04b7 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 _0x0e35=['finally','CmHopperFinal','getPreview','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getPreviewRecall','getVoiceQueues','hopperId','findOne','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','stack','name','map','CmHopper','fieldName','type','model','keys','query','intersection','concat','filters','$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$notIn','$notLike','$notILike','$overlap','$any','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x0e35,0xc2));var _0x50e3=function(_0x4bb581,_0x147b65){_0x4bb581=_0x4bb581-0x0;var _0x5c0e36=_0x0e35[_0x4bb581];return _0x5c0e36;};'use strict';var emlformat=require(_0x50e3('0x0'));var rimraf=require(_0x50e3('0x1'));var zipdir=require(_0x50e3('0x2'));var jsonpatch=require(_0x50e3('0x3'));var rp=require(_0x50e3('0x4'));var moment=require(_0x50e3('0x5'));var BPromise=require(_0x50e3('0x6'));var Mustache=require(_0x50e3('0x7'));var util=require(_0x50e3('0x8'));var path=require(_0x50e3('0x9'));var sox=require('sox');var csv=require(_0x50e3('0xa'));var ejs=require(_0x50e3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x50e3('0xc'));var crypto=require(_0x50e3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x50e3('0xa'));var querystring=require(_0x50e3('0xe'));var Papa=require(_0x50e3('0xf'));var Redis=require(_0x50e3('0x10'));var authService=require(_0x50e3('0x11'));var qs=require(_0x50e3('0x12'));var as=require(_0x50e3('0x13'));var hardwareService=require(_0x50e3('0x14'));var logger=require(_0x50e3('0x15'))(_0x50e3('0x16'));var utils=require(_0x50e3('0x17'));var config=require(_0x50e3('0x18'));var shared=require(_0x50e3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x50e3('0x19'))['db'];function respondWithStatusCode(_0x102705,_0x1ec349){_0x1ec349=_0x1ec349||0xcc;return function(_0x9eb0c8){if(_0x9eb0c8){return _0x102705['sendStatus'](_0x1ec349);}return _0x102705[_0x50e3('0x1a')](_0x1ec349)[_0x50e3('0x1b')]();};}function respondWithResult(_0x4b4d6f,_0x43bb4d){_0x43bb4d=_0x43bb4d||0xc8;return function(_0x3f7cfa){if(_0x3f7cfa){return _0x4b4d6f[_0x50e3('0x1a')](_0x43bb4d)[_0x50e3('0x1c')](_0x3f7cfa);}};}function respondWithFilteredResult(_0x107f73,_0x5b020c){return function(_0x2aff1c){if(_0x2aff1c){var _0x5f44e1=typeof _0x5b020c[_0x50e3('0x1d')]===_0x50e3('0x1e')&&typeof _0x5b020c[_0x50e3('0x1f')]==='undefined';var _0x447a60=_0x2aff1c[_0x50e3('0x20')];var _0x1b4279=_0x5f44e1?0x0:_0x5b020c[_0x50e3('0x1d')];var _0x47ea2c=_0x5f44e1?_0x2aff1c['count']:_0x5b020c[_0x50e3('0x1d')]+_0x5b020c['limit'];var _0x3ffe22;if(_0x47ea2c>=_0x447a60){_0x47ea2c=_0x447a60;_0x3ffe22=0xc8;}else{_0x3ffe22=0xce;}_0x107f73[_0x50e3('0x1a')](_0x3ffe22);return _0x107f73['set']('Content-Range',_0x1b4279+'-'+_0x47ea2c+'/'+_0x447a60)[_0x50e3('0x1c')](_0x2aff1c);}return null;};}function patchUpdates(_0x29f6d9){return function(_0x4956d5){try{jsonpatch[_0x50e3('0x21')](_0x4956d5,_0x29f6d9,!![]);}catch(_0x410e19){return BPromise[_0x50e3('0x22')](_0x410e19);}return _0x4956d5[_0x50e3('0x23')]();};}function saveUpdates(_0x3fdd65,_0x164e11){return function(_0x499b07){if(_0x499b07){return _0x499b07[_0x50e3('0x24')](_0x3fdd65)[_0x50e3('0x25')](function(_0x37acdb){return _0x37acdb;});}return null;};}function removeEntity(_0x2ab8cb,_0x34c68c){return function(_0x283459){if(_0x283459){return _0x283459[_0x50e3('0x26')]()[_0x50e3('0x25')](function(){_0x2ab8cb['status'](0xcc)[_0x50e3('0x1b')]();});}};}function handleEntityNotFound(_0x576c7c,_0x14c06c){return function(_0x15bf54){if(!_0x15bf54){_0x576c7c[_0x50e3('0x27')](0x194);}return _0x15bf54;};}function handleError(_0x653486,_0x1162f1){_0x1162f1=_0x1162f1||0x1f4;return function(_0x4fce27){logger['error'](_0x4fce27[_0x50e3('0x28')]);if(_0x4fce27['name']){delete _0x4fce27[_0x50e3('0x29')];}_0x653486['status'](_0x1162f1)['send'](_0x4fce27);};}exports['index']=function(_0x455c5e,_0x169fd7){var _0x426b1d={},_0x131fa2={},_0xda5416={'count':0x0,'rows':[]};var _0x23a5f4=_[_0x50e3('0x2a')](db[_0x50e3('0x2b')]['rawAttributes'],function(_0x3ed213){return{'name':_0x3ed213[_0x50e3('0x2c')],'type':_0x3ed213[_0x50e3('0x2d')]['key']};});_0x131fa2[_0x50e3('0x2e')]=_[_0x50e3('0x2a')](_0x23a5f4,_0x50e3('0x29'));_0x131fa2['query']=_[_0x50e3('0x2f')](_0x455c5e[_0x50e3('0x30')]);_0x131fa2['filters']=_[_0x50e3('0x31')](_0x131fa2[_0x50e3('0x2e')],_0x131fa2[_0x50e3('0x30')]);_0x131fa2['filters']=_[_0x50e3('0x32')](_0x131fa2[_0x50e3('0x33')],[_0x50e3('0x34'),_0x50e3('0x35'),_0x50e3('0x36'),_0x50e3('0x37'),'$lt',_0x50e3('0x38'),_0x50e3('0x39'),_0x50e3('0x3a'),'$not',_0x50e3('0x3b'),_0x50e3('0x3c'),'$in',_0x50e3('0x3d'),'$like',_0x50e3('0x3e'),'$iLike',_0x50e3('0x3f'),'$like',_0x50e3('0x40'),'$contains','$contained',_0x50e3('0x41')]);_0x426b1d['attributes']=_[_0x50e3('0x31')](_0x131fa2[_0x50e3('0x2e')],qs[_0x50e3('0x42')](_0x455c5e[_0x50e3('0x30')][_0x50e3('0x42')]));_0x426b1d[_0x50e3('0x43')]=_0x426b1d[_0x50e3('0x43')][_0x50e3('0x44')]?_0x426b1d['attributes']:_0x131fa2[_0x50e3('0x2e')];if(!_0x455c5e[_0x50e3('0x30')]['hasOwnProperty'](_0x50e3('0x45'))){_0x426b1d[_0x50e3('0x1f')]=qs['limit'](_0x455c5e[_0x50e3('0x30')][_0x50e3('0x1f')]);_0x426b1d[_0x50e3('0x1d')]=qs[_0x50e3('0x1d')](_0x455c5e['query']['offset']);}_0x426b1d[_0x50e3('0x46')]=qs['sort'](_0x455c5e['query'][_0x50e3('0x47')]);_0x426b1d[_0x50e3('0x48')]=qs[_0x50e3('0x33')](_['pick'](_0x455c5e[_0x50e3('0x30')],_0x131fa2[_0x50e3('0x33')]),_0x23a5f4);if(_0x455c5e[_0x50e3('0x30')][_0x50e3('0x49')]){_0x426b1d['where']=_['merge'](_0x426b1d[_0x50e3('0x48')],{'$or':_[_0x50e3('0x2a')](_0x23a5f4,function(_0x46d2c2){if(_0x46d2c2[_0x50e3('0x2d')]!=='VIRTUAL'){var _0x4c5e05={};_0x4c5e05[_0x46d2c2[_0x50e3('0x29')]]={'$like':'%'+_0x455c5e[_0x50e3('0x30')][_0x50e3('0x49')]+'%'};return _0x4c5e05;}})});}_0x426b1d=_[_0x50e3('0x4a')]({},_0x426b1d,_0x455c5e[_0x50e3('0x4b')]);var _0x6e915f={'where':_0x426b1d[_0x50e3('0x48')]};return db[_0x50e3('0x2b')][_0x50e3('0x20')](_0x6e915f)[_0x50e3('0x25')](function(_0x1dfff0){_0xda5416[_0x50e3('0x20')]=_0x1dfff0;if(_0x455c5e[_0x50e3('0x30')]['includeAll']){_0x426b1d[_0x50e3('0x4c')]=[{'all':!![]}];}return db[_0x50e3('0x2b')][_0x50e3('0x4d')](_0x426b1d);})[_0x50e3('0x25')](function(_0x52e826){_0xda5416[_0x50e3('0x4e')]=_0x52e826;return _0xda5416;})[_0x50e3('0x25')](respondWithFilteredResult(_0x169fd7,_0x426b1d))[_0x50e3('0x4f')](handleError(_0x169fd7,null));};exports['show']=function(_0x27abb4,_0x1a4a3c){var _0x4f45a7={'raw':!![],'where':{'id':_0x27abb4[_0x50e3('0x50')]['id']}},_0x1e893b={};_0x1e893b[_0x50e3('0x2e')]=_[_0x50e3('0x2f')](db[_0x50e3('0x2b')][_0x50e3('0x51')]);_0x1e893b[_0x50e3('0x30')]=_[_0x50e3('0x2f')](_0x27abb4[_0x50e3('0x30')]);_0x1e893b[_0x50e3('0x33')]=_[_0x50e3('0x31')](_0x1e893b['model'],_0x1e893b[_0x50e3('0x30')]);_0x4f45a7[_0x50e3('0x43')]=_[_0x50e3('0x31')](_0x1e893b[_0x50e3('0x2e')],qs[_0x50e3('0x42')](_0x27abb4[_0x50e3('0x30')][_0x50e3('0x42')]));_0x4f45a7[_0x50e3('0x43')]=_0x4f45a7[_0x50e3('0x43')][_0x50e3('0x44')]?_0x4f45a7['attributes']:_0x1e893b[_0x50e3('0x2e')];if(_0x27abb4[_0x50e3('0x30')]['includeAll']){_0x4f45a7[_0x50e3('0x4c')]=[{'all':!![]}];}_0x4f45a7=_['merge']({},_0x4f45a7,_0x27abb4[_0x50e3('0x4b')]);return db[_0x50e3('0x2b')][_0x50e3('0x52')](_0x4f45a7)[_0x50e3('0x25')](handleEntityNotFound(_0x1a4a3c,null))[_0x50e3('0x25')](respondWithResult(_0x1a4a3c,null))['catch'](handleError(_0x1a4a3c,null));};exports['create']=function(_0xacbb90,_0xa1606b){return db['CmHopper'][_0x50e3('0x53')](_0xacbb90[_0x50e3('0x54')],{})[_0x50e3('0x25')](respondWithResult(_0xa1606b,0xc9))[_0x50e3('0x4f')](handleError(_0xa1606b,null));};exports['update']=function(_0x16decd,_0x551327){if(_0x16decd[_0x50e3('0x54')]['id']){delete _0x16decd['body']['id'];}return db[_0x50e3('0x2b')][_0x50e3('0x52')]({'where':{'id':_0x16decd[_0x50e3('0x50')]['id']}})[_0x50e3('0x25')](handleEntityNotFound(_0x551327,null))[_0x50e3('0x25')](saveUpdates(_0x16decd[_0x50e3('0x54')],null))[_0x50e3('0x25')](respondWithResult(_0x551327,null))[_0x50e3('0x4f')](handleError(_0x551327,null));};exports['describe']=function(_0x56128b,_0x8d075){return db['CmHopper'][_0x50e3('0x55')]()[_0x50e3('0x25')](respondWithResult(_0x8d075,null))[_0x50e3('0x4f')](handleError(_0x8d075,null));};exports['destroy']=function(_0x2ec5f0,_0x532d9c){var _0x5174c0;return db['CmHopper'][_0x50e3('0x52')]({'where':{'id':_0x2ec5f0[_0x50e3('0x50')]['id']}})[_0x50e3('0x25')](handleEntityNotFound(_0x532d9c,null))['then'](function(_0x171b6a){if(_0x171b6a){return _0x171b6a['destroy']()['then'](function(_0x180c25){return _0x180c25;});}})[_0x50e3('0x25')](function(_0x554a88){_0x5174c0=_0x554a88;if(_0x554a88){if(_0x554a88[_0x50e3('0x56')]||_0x554a88[_0x50e3('0x57')]){return db[_0x554a88[_0x50e3('0x56')]?_0x50e3('0x58'):_0x50e3('0x59')][_0x50e3('0x52')]({'where':{'id':_0x554a88[_0x50e3('0x56')]?_0x554a88[_0x50e3('0x56')]:_0x554a88[_0x50e3('0x57')]},'attributes':['id',_0x50e3('0x29')],'raw':!![]});}}})[_0x50e3('0x25')](function(_0x2b5b95){var _0x48c947={};if(_0x2b5b95){_[_0x50e3('0x4a')](_0x48c947,_['omit'](_0x5174c0[_0x50e3('0x5a')],[_0x50e3('0x5b'),'updatedAt','id']));_0x48c947[_0x50e3('0x5c')]=0x15;_0x48c947[_0x50e3('0x5d')]=_0x50e3('0x5e');_0x48c947[_0x50e3('0x5f')]=_0x2b5b95[_0x50e3('0x29')];_0x48c947[_0x50e3('0x60')]=_0x2ec5f0[_0x50e3('0x61')][_0x50e3('0x29')];_0x48c947[_0x50e3('0x62')]=_0x2ec5f0[_0x50e3('0x61')]['id'];_0x48c947['deleted']=!![];_0x48c947['deletedat']=moment()[_0x50e3('0x63')](_0x50e3('0x64'));_0x48c947[_0x50e3('0x65')]=_0x5174c0[_0x50e3('0x66')];_0x48c947[_0x50e3('0x67')]=_0x5174c0['VoiceQueueId']?_0x50e3('0x68'):_0x50e3('0x69');return db[_0x50e3('0x6a')][_0x50e3('0x52')]({'where':{'id':_0x48c947[_0x50e3('0x6b')]},'attributes':[_0x50e3('0x6c'),_0x50e3('0x6d')]})[_0x50e3('0x25')](function(_0x1f08f8){if(!_['isNil'](_0x532d9c)&&!_[_0x50e3('0x6e')](_0x1f08f8['firstName'])){_0x48c947['calleridname']=_0x1f08f8[_0x50e3('0x6c')];if(!_[_0x50e3('0x6e')](_0x1f08f8[_0x50e3('0x6d')])){_0x48c947[_0x50e3('0x6f')]+='\x20'+_0x1f08f8[_0x50e3('0x6d')];}}})[_0x50e3('0x70')](function(){return db[_0x50e3('0x71')]['create'](_0x48c947);});}})[_0x50e3('0x25')](function(){return _0x532d9c[_0x50e3('0x1a')](0xcc)[_0x50e3('0x1b')]();})[_0x50e3('0x4f')](handleError(_0x532d9c,null));};exports[_0x50e3('0x72')]=function(_0x22b865,_0x48f3cd,_0x4f44b0){var _0xb29ddf=[];return db['CmContact'][_0x50e3('0x55')]()[_0x50e3('0x25')](function(_0x5ad3a8){_0xb29ddf=_[_0x50e3('0x2f')](_0x5ad3a8);return _0x22b865[_0x50e3('0x61')]['getVoiceQueues']({'where':{'type':_0x50e3('0x73'),'dialActive':!![],'dialMethod':_0x50e3('0x74')},'attributes':['id','dialOrderByScheduledAt',_0x50e3('0x75')],'raw':!![]});})['then'](function(_0x3b22a0){if(_0x3b22a0&&_0x3b22a0[_0x50e3('0x44')]){return db[_0x50e3('0x76')][_0x50e3('0x77')](function(_0x502695){var _0x562dca={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x50e3('0x64'))},'VoiceQueueId':{'$in':_[_0x50e3('0x2a')](_0x3b22a0,'id')},'$or':[{'UserId':null},{'UserId':_0x22b865[_0x50e3('0x61')]['id']}]};var _0x54e8c1={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3b22a0)[_0x50e3('0x49')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0x50e3('0x78')]()},'$or':[{'UserId':null},{'UserId':_0x22b865[_0x50e3('0x61')]['id']}]};var _0x3d7ae8={'$or':[_0x562dca,_0x54e8c1]};var _0x166643=[];if(_0x22b865['body'][_0x50e3('0x79')]&&_0x22b865[_0x50e3('0x54')][_0x50e3('0x79')]===_0x50e3('0x7a')){if(!_[_0x50e3('0x7b')](_0x22b865[_0x50e3('0x54')][_0x50e3('0x7c')])){_0x3d7ae8['id']={'$in':_0x22b865['body'][_0x50e3('0x7c')]};}_0x166643=[[_0x50e3('0x7d'),'ASC'],[_0x50e3('0x7e'),_0x3b22a0[0x0][_0x50e3('0x7f')]===_0x50e3('0x80')?'DESC':_0x50e3('0x80')],db['sequelize']['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x50e3('0x81')]];}else{if(!_[_0x50e3('0x7b')](_0x22b865['body'][_0x50e3('0x7c')])){_0x3d7ae8['id']={'$notIn':_0x22b865[_0x50e3('0x54')]['hopperIds']};}_0x166643=[['priority','DESC'],[_0x50e3('0x7e'),_0x3b22a0[0x0][_0x50e3('0x7f')]],db['sequelize'][_0x50e3('0x82')](_0x50e3('0x83')),['id',_0x50e3('0x80')]];}return db[_0x50e3('0x2b')]['findOne']({'attributes':['id','scheduledat',_0x50e3('0x84')],'where':_0x3d7ae8,'order':_0x166643,'transaction':_0x502695,'lock':_0x502695['LOCK'][_0x50e3('0x85')],'include':[{'model':db[_0x50e3('0x6a')],'as':_0x50e3('0x86'),'attributes':_0xb29ddf,'include':[{'model':db[_0x50e3('0x87')],'as':_0x50e3('0x88'),'attributes':['id',_0x50e3('0x29')]}]},{'model':db[_0x50e3('0x89')],'as':'List','attributes':['id','name']},{'model':db[_0x50e3('0x58')],'as':_0x50e3('0x8a'),'attributes':['id',_0x50e3('0x29'),_0x50e3('0x8b')]}]})[_0x50e3('0x25')](function(_0x57d8d4){if(_0x57d8d4){return _0x57d8d4[_0x50e3('0x24')]({'UserId':_0x22b865[_0x50e3('0x61')]['id']},{'transaction':_0x502695});}});});}})[_0x50e3('0x25')](handleEntityNotFound(_0x48f3cd,null))['then'](respondWithResult(_0x48f3cd,null))['catch'](handleError(_0x48f3cd,null));};exports[_0x50e3('0x8c')]=function(_0x388591,_0x4b115f,_0x3e1b6f){var _0x33420c=[];return db[_0x50e3('0x6a')][_0x50e3('0x55')]()[_0x50e3('0x25')](function(_0x106102){_0x33420c=_['keys'](_0x106102);return _0x388591[_0x50e3('0x61')][_0x50e3('0x8d')]({'where':{'type':_0x50e3('0x73'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x50e3('0x75')],'raw':!![]});})[_0x50e3('0x25')](function(_0x254c2d){if(_0x254c2d&&_0x254c2d[_0x50e3('0x44')]){return db[_0x50e3('0x76')][_0x50e3('0x77')](function(_0x13dd52){var _0x532a70={'active':![],'recallme':!![],'id':_0x388591['body'][_0x50e3('0x8e')]};return db['CmHopper'][_0x50e3('0x8f')]({'attributes':['id','scheduledat',_0x50e3('0x84')],'where':_0x532a70,'transaction':_0x13dd52,'lock':_0x13dd52['LOCK']['UPDATE'],'include':[{'model':db[_0x50e3('0x6a')],'as':'Contact','attributes':_0x33420c,'include':[{'model':db['CmCompany'],'as':_0x50e3('0x88'),'attributes':['id',_0x50e3('0x29')]}]},{'model':db[_0x50e3('0x89')],'as':'List','attributes':['id','name']},{'model':db[_0x50e3('0x58')],'as':_0x50e3('0x8a'),'attributes':['id',_0x50e3('0x29'),'dialActive']}]})[_0x50e3('0x25')](function(_0x1de03c){if(_0x1de03c){return _0x1de03c['update']({'UserId':_0x388591[_0x50e3('0x61')]['id']},{'transaction':_0x13dd52});}});});}})[_0x50e3('0x25')](handleEntityNotFound(_0x4b115f,null))[_0x50e3('0x25')](respondWithResult(_0x4b115f,null))[_0x50e3('0x4f')](handleError(_0x4b115f,null));};exports['getOpenContacts']=function(_0x448140,_0x800a41,_0x2ef47f){return _0x448140[_0x50e3('0x61')][_0x50e3('0x8d')]({'where':{'type':_0x50e3('0x73'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x50e3('0x25')](function(_0x34cff7){if(_0x34cff7&&_0x34cff7[_0x50e3('0x44')]){return db['CmHopper'][_0x50e3('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x50e3('0x63')](_0x50e3('0x64'))},'VoiceQueueId':{'$in':_[_0x50e3('0x2a')](_0x34cff7,'id')},'$or':[{'UserId':null},{'UserId':_0x448140['user']['id']}]}});}return 0x0;})[_0x50e3('0x25')](function(_0x3a37f1){if(!_['isNil'](_0x3a37f1)&&_[_0x50e3('0x90')](_0x3a37f1)){return _0x800a41['status'](0xc8)[_0x50e3('0x1c')]({'contacts':_0x3a37f1});}else{logger[_0x50e3('0x91')](_0x50e3('0x92'),_0x50e3('0x93'),0x194,_0x50e3('0x94'));_0x800a41['sendStatus'](0x194);}})[_0x50e3('0x4f')](handleError(_0x800a41,null));};exports[_0x50e3('0x95')]=function(_0xaa377a,_0x3b30e9,_0x411c40){var _0x269eaf=shared[_0x50e3('0x96')];var _0x3ecb12=[];_['map'](_0x269eaf,function(_0x55a6ca){_0x3ecb12['push']({'id':_0x55a6ca[_0x50e3('0x29')],'name':_0x55a6ca[_0x50e3('0x29')],'utcOffset':_0x55a6ca[_0x50e3('0x97')]});});return _0x3b30e9[_0x50e3('0x1a')](0xc8)[_0x50e3('0x1c')]({'tz':_0x3ecb12});};exports[_0x50e3('0x98')]=function(_0x56d0f7,_0x510aa7,_0x229885){var _0x219f5c=shared[_0x50e3('0x96')];var _0x1cc24e={};if(!_[_0x50e3('0x6e')](_0x219f5c[_0x56d0f7[_0x50e3('0x54')]['id']]))_0x1cc24e=_0x219f5c[_0x56d0f7['body']['id']];return _0x510aa7[_0x50e3('0x1a')](0xc8)[_0x50e3('0x1c')](_0x1cc24e);}; \ No newline at end of file +var _0x2ceb=['map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','deleted','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','update','hopperId','recallme','getOpenContacts','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','timezones','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index'];(function(_0x5219aa,_0x357da6){var _0x479261=function(_0x552e4e){while(--_0x552e4e){_0x5219aa['push'](_0x5219aa['shift']());}};_0x479261(++_0x357da6);}(_0x2ceb,0x110));var _0xb2ce=function(_0x4b755a,_0x5b5ac7){_0x4b755a=_0x4b755a-0x0;var _0x11727e=_0x2ceb[_0x4b755a];return _0x11727e;};'use strict';var emlformat=require(_0xb2ce('0x0'));var rimraf=require(_0xb2ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2ce('0x2'));var rp=require(_0xb2ce('0x3'));var moment=require(_0xb2ce('0x4'));var BPromise=require(_0xb2ce('0x5'));var Mustache=require(_0xb2ce('0x6'));var util=require(_0xb2ce('0x7'));var path=require('path');var sox=require(_0xb2ce('0x8'));var csv=require(_0xb2ce('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2ce('0xa'));var _=require(_0xb2ce('0xb'));var squel=require('squel');var crypto=require(_0xb2ce('0xc'));var jsforce=require(_0xb2ce('0xd'));var deskjs=require(_0xb2ce('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb2ce('0xf'));var Redis=require(_0xb2ce('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb2ce('0x11'));var as=require(_0xb2ce('0x12'));var hardwareService=require(_0xb2ce('0x13'));var logger=require(_0xb2ce('0x14'))(_0xb2ce('0x15'));var utils=require(_0xb2ce('0x16'));var config=require('../../config/environment');var shared=require(_0xb2ce('0x17'));var licenseUtil=require(_0xb2ce('0x18'));var db=require(_0xb2ce('0x19'))['db'];function respondWithStatusCode(_0x2bad3c,_0x28c1de){_0x28c1de=_0x28c1de||0xcc;return function(_0x5f151c){if(_0x5f151c){return _0x2bad3c['sendStatus'](_0x28c1de);}return _0x2bad3c[_0xb2ce('0x1a')](_0x28c1de)[_0xb2ce('0x1b')]();};}function respondWithResult(_0x16fb1c,_0x1cc91e){_0x1cc91e=_0x1cc91e||0xc8;return function(_0x479ac){if(_0x479ac){return _0x16fb1c[_0xb2ce('0x1a')](_0x1cc91e)[_0xb2ce('0x1c')](_0x479ac);}};}function respondWithFilteredResult(_0x25a66b,_0x994130){return function(_0x227fae){if(_0x227fae){var _0x143569=typeof _0x994130[_0xb2ce('0x1d')]===_0xb2ce('0x1e')&&typeof _0x994130[_0xb2ce('0x1f')]===_0xb2ce('0x1e');var _0xd377ad=_0x227fae[_0xb2ce('0x20')];var _0x3f135e=_0x143569?0x0:_0x994130[_0xb2ce('0x1d')];var _0x3715d3=_0x143569?_0x227fae[_0xb2ce('0x20')]:_0x994130[_0xb2ce('0x1d')]+_0x994130[_0xb2ce('0x1f')];var _0x3e8877;if(_0x3715d3>=_0xd377ad){_0x3715d3=_0xd377ad;_0x3e8877=0xc8;}else{_0x3e8877=0xce;}_0x25a66b['status'](_0x3e8877);return _0x25a66b[_0xb2ce('0x21')](_0xb2ce('0x22'),_0x3f135e+'-'+_0x3715d3+'/'+_0xd377ad)['json'](_0x227fae);}return null;};}function patchUpdates(_0x1a4156){return function(_0x54b380){try{jsonpatch[_0xb2ce('0x23')](_0x54b380,_0x1a4156,!![]);}catch(_0x226a73){return BPromise[_0xb2ce('0x24')](_0x226a73);}return _0x54b380[_0xb2ce('0x25')]();};}function saveUpdates(_0x59d256,_0x50ebc9){return function(_0x2b9882){if(_0x2b9882){return _0x2b9882['update'](_0x59d256)[_0xb2ce('0x26')](function(_0x4feb6){return _0x4feb6;});}return null;};}function removeEntity(_0x534806,_0xfdbed0){return function(_0xf61e9a){if(_0xf61e9a){return _0xf61e9a[_0xb2ce('0x27')]()[_0xb2ce('0x26')](function(){_0x534806[_0xb2ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e541,_0x5d7058){return function(_0x2dc56e){if(!_0x2dc56e){_0x31e541['sendStatus'](0x194);}return _0x2dc56e;};}function handleError(_0x5894a8,_0x367e18){_0x367e18=_0x367e18||0x1f4;return function(_0x1b19c9){logger[_0xb2ce('0x28')](_0x1b19c9['stack']);if(_0x1b19c9[_0xb2ce('0x29')]){delete _0x1b19c9[_0xb2ce('0x29')];}_0x5894a8['status'](_0x367e18)[_0xb2ce('0x2a')](_0x1b19c9);};}exports[_0xb2ce('0x2b')]=function(_0x1d4918,_0x49c448){var _0x1add93={},_0x36d8e9={},_0x121c76={'count':0x0,'rows':[]};var _0x2360ab=_[_0xb2ce('0x2c')](db[_0xb2ce('0x2d')][_0xb2ce('0x2e')],function(_0x41ef31){return{'name':_0x41ef31[_0xb2ce('0x2f')],'type':_0x41ef31[_0xb2ce('0x30')][_0xb2ce('0x31')]};});_0x36d8e9[_0xb2ce('0x32')]=_['map'](_0x2360ab,_0xb2ce('0x29'));_0x36d8e9[_0xb2ce('0x33')]=_['keys'](_0x1d4918[_0xb2ce('0x33')]);_0x36d8e9[_0xb2ce('0x34')]=_[_0xb2ce('0x35')](_0x36d8e9[_0xb2ce('0x32')],_0x36d8e9['query']);_0x36d8e9[_0xb2ce('0x34')]=_[_0xb2ce('0x36')](_0x36d8e9[_0xb2ce('0x34')],[_0xb2ce('0x37'),_0xb2ce('0x38'),_0xb2ce('0x39'),'$gte',_0xb2ce('0x3a'),_0xb2ce('0x3b'),_0xb2ce('0x3c'),_0xb2ce('0x3d'),_0xb2ce('0x3e'),_0xb2ce('0x3f'),'$notBetween','$in',_0xb2ce('0x40'),_0xb2ce('0x41'),_0xb2ce('0x42'),_0xb2ce('0x43'),_0xb2ce('0x44'),_0xb2ce('0x41'),_0xb2ce('0x45'),_0xb2ce('0x46'),_0xb2ce('0x47'),_0xb2ce('0x48')]);_0x1add93['attributes']=_[_0xb2ce('0x35')](_0x36d8e9[_0xb2ce('0x32')],qs['fields'](_0x1d4918[_0xb2ce('0x33')][_0xb2ce('0x49')]));_0x1add93[_0xb2ce('0x4a')]=_0x1add93[_0xb2ce('0x4a')][_0xb2ce('0x4b')]?_0x1add93[_0xb2ce('0x4a')]:_0x36d8e9[_0xb2ce('0x32')];if(!_0x1d4918[_0xb2ce('0x33')][_0xb2ce('0x4c')]('nolimit')){_0x1add93[_0xb2ce('0x1f')]=qs['limit'](_0x1d4918[_0xb2ce('0x33')][_0xb2ce('0x1f')]);_0x1add93[_0xb2ce('0x1d')]=qs[_0xb2ce('0x1d')](_0x1d4918[_0xb2ce('0x33')][_0xb2ce('0x1d')]);}_0x1add93['order']=qs[_0xb2ce('0x4d')](_0x1d4918['query'][_0xb2ce('0x4d')]);_0x1add93[_0xb2ce('0x4e')]=qs[_0xb2ce('0x34')](_[_0xb2ce('0x4f')](_0x1d4918['query'],_0x36d8e9[_0xb2ce('0x34')]),_0x2360ab);if(_0x1d4918[_0xb2ce('0x33')]['filter']){_0x1add93[_0xb2ce('0x4e')]=_[_0xb2ce('0x50')](_0x1add93['where'],{'$or':_[_0xb2ce('0x2c')](_0x2360ab,function(_0x3787c1){if(_0x3787c1['type']!==_0xb2ce('0x51')){var _0x1ad94c={};_0x1ad94c[_0x3787c1[_0xb2ce('0x29')]]={'$like':'%'+_0x1d4918[_0xb2ce('0x33')][_0xb2ce('0x52')]+'%'};return _0x1ad94c;}})});}_0x1add93=_['merge']({},_0x1add93,_0x1d4918[_0xb2ce('0x53')]);var _0x131fef={'where':_0x1add93[_0xb2ce('0x4e')]};return db[_0xb2ce('0x2d')]['count'](_0x131fef)['then'](function(_0x28e1d8){_0x121c76['count']=_0x28e1d8;if(_0x1d4918[_0xb2ce('0x33')]['includeAll']){_0x1add93['include']=[{'all':!![]}];}return db[_0xb2ce('0x2d')][_0xb2ce('0x54')](_0x1add93);})[_0xb2ce('0x26')](function(_0x33ae7){_0x121c76[_0xb2ce('0x55')]=_0x33ae7;return _0x121c76;})[_0xb2ce('0x26')](respondWithFilteredResult(_0x49c448,_0x1add93))[_0xb2ce('0x56')](handleError(_0x49c448,null));};exports[_0xb2ce('0x57')]=function(_0x7b7a1e,_0x47f493){var _0x5bf160={'raw':!![],'where':{'id':_0x7b7a1e[_0xb2ce('0x58')]['id']}},_0x43f5ea={};_0x43f5ea['model']=_['keys'](db[_0xb2ce('0x2d')][_0xb2ce('0x2e')]);_0x43f5ea[_0xb2ce('0x33')]=_[_0xb2ce('0x59')](_0x7b7a1e[_0xb2ce('0x33')]);_0x43f5ea[_0xb2ce('0x34')]=_[_0xb2ce('0x35')](_0x43f5ea[_0xb2ce('0x32')],_0x43f5ea[_0xb2ce('0x33')]);_0x5bf160[_0xb2ce('0x4a')]=_[_0xb2ce('0x35')](_0x43f5ea[_0xb2ce('0x32')],qs[_0xb2ce('0x49')](_0x7b7a1e['query'][_0xb2ce('0x49')]));_0x5bf160['attributes']=_0x5bf160[_0xb2ce('0x4a')][_0xb2ce('0x4b')]?_0x5bf160[_0xb2ce('0x4a')]:_0x43f5ea[_0xb2ce('0x32')];if(_0x7b7a1e['query'][_0xb2ce('0x5a')]){_0x5bf160['include']=[{'all':!![]}];}_0x5bf160=_[_0xb2ce('0x50')]({},_0x5bf160,_0x7b7a1e[_0xb2ce('0x53')]);return db['CmHopper']['find'](_0x5bf160)[_0xb2ce('0x26')](handleEntityNotFound(_0x47f493,null))['then'](respondWithResult(_0x47f493,null))['catch'](handleError(_0x47f493,null));};exports['create']=function(_0x41f375,_0xed08e4){return db['CmHopper'][_0xb2ce('0x5b')](_0x41f375[_0xb2ce('0x5c')],{})[_0xb2ce('0x26')](respondWithResult(_0xed08e4,0xc9))[_0xb2ce('0x56')](handleError(_0xed08e4,null));};exports['update']=function(_0x2150e9,_0x1e0889){if(_0x2150e9[_0xb2ce('0x5c')]['id']){delete _0x2150e9[_0xb2ce('0x5c')]['id'];}return db[_0xb2ce('0x2d')][_0xb2ce('0x5d')]({'where':{'id':_0x2150e9[_0xb2ce('0x58')]['id']}})[_0xb2ce('0x26')](handleEntityNotFound(_0x1e0889,null))[_0xb2ce('0x26')](saveUpdates(_0x2150e9['body'],null))[_0xb2ce('0x26')](respondWithResult(_0x1e0889,null))[_0xb2ce('0x56')](handleError(_0x1e0889,null));};exports[_0xb2ce('0x5e')]=function(_0x3ae449,_0x103ed0){return db[_0xb2ce('0x2d')][_0xb2ce('0x5e')]()['then'](respondWithResult(_0x103ed0,null))[_0xb2ce('0x56')](handleError(_0x103ed0,null));};exports[_0xb2ce('0x27')]=function(_0xd1757,_0x1e6f70){var _0x314d43;return db['CmHopper']['find']({'where':{'id':_0xd1757[_0xb2ce('0x58')]['id']}})[_0xb2ce('0x26')](handleEntityNotFound(_0x1e6f70,null))[_0xb2ce('0x26')](function(_0x10b4ee){if(_0x10b4ee){return _0x10b4ee[_0xb2ce('0x27')]()[_0xb2ce('0x26')](function(_0x529d19){return _0x529d19;});}})[_0xb2ce('0x26')](function(_0x2560d9){_0x314d43=_0x2560d9;if(_0x2560d9){if(_0x2560d9[_0xb2ce('0x5f')]||_0x2560d9[_0xb2ce('0x60')]){return db[_0x2560d9[_0xb2ce('0x5f')]?_0xb2ce('0x61'):_0xb2ce('0x62')][_0xb2ce('0x5d')]({'where':{'id':_0x2560d9['VoiceQueueId']?_0x2560d9['VoiceQueueId']:_0x2560d9[_0xb2ce('0x60')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x17e13b){var _0x509a94={};if(_0x17e13b){_[_0xb2ce('0x50')](_0x509a94,_[_0xb2ce('0x63')](_0x314d43[_0xb2ce('0x64')],[_0xb2ce('0x65'),'updatedAt','id']));_0x509a94[_0xb2ce('0x66')]=0x15;_0x509a94['statedesc']=_0xb2ce('0x67');_0x509a94['campaign']=_0x17e13b[_0xb2ce('0x29')];_0x509a94['membername']=_0xd1757[_0xb2ce('0x68')][_0xb2ce('0x29')];_0x509a94[_0xb2ce('0x69')]=_0xd1757[_0xb2ce('0x68')]['id'];_0x509a94[_0xb2ce('0x67')]=!![];_0x509a94['deletedat']=moment()[_0xb2ce('0x6a')](_0xb2ce('0x6b'));_0x509a94['calleridnum']=_0x314d43[_0xb2ce('0x6c')];_0x509a94[_0xb2ce('0x6d')]=_0x314d43[_0xb2ce('0x5f')]?_0xb2ce('0x6e'):'ivr';return db[_0xb2ce('0x6f')]['find']({'where':{'id':_0x509a94[_0xb2ce('0x70')]},'attributes':[_0xb2ce('0x71'),'lastName']})[_0xb2ce('0x26')](function(_0x378033){if(!_['isNil'](_0x1e6f70)&&!_[_0xb2ce('0x72')](_0x378033[_0xb2ce('0x71')])){_0x509a94[_0xb2ce('0x73')]=_0x378033[_0xb2ce('0x71')];if(!_[_0xb2ce('0x72')](_0x378033[_0xb2ce('0x74')])){_0x509a94[_0xb2ce('0x73')]+='\x20'+_0x378033[_0xb2ce('0x74')];}}})[_0xb2ce('0x75')](function(){return db[_0xb2ce('0x76')][_0xb2ce('0x5b')](_0x509a94);});}})[_0xb2ce('0x26')](function(){return _0x1e6f70[_0xb2ce('0x1a')](0xcc)['end']();})[_0xb2ce('0x56')](handleError(_0x1e6f70,null));};exports[_0xb2ce('0x77')]=function(_0x3374a3,_0x150694,_0x565072){var _0x404473=[];return db['CmContact']['describe']()[_0xb2ce('0x26')](function(_0x46fdeb){_0x404473=_[_0xb2ce('0x59')](_0x46fdeb);return _0x3374a3['user'][_0xb2ce('0x78')]({'where':{'type':_0xb2ce('0x79'),'dialActive':!![],'dialMethod':_0xb2ce('0x7a')},'attributes':['id',_0xb2ce('0x7b'),_0xb2ce('0x7c')],'raw':!![]});})[_0xb2ce('0x26')](function(_0x37690b){if(_0x37690b&&_0x37690b['length']){return db[_0xb2ce('0x7d')]['transaction'](function(_0x42ab1f){var _0x837c50={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xb2ce('0x6b'))},'VoiceQueueId':{'$in':_[_0xb2ce('0x2c')](_0x37690b,'id')},'$or':[{'UserId':null},{'UserId':_0x3374a3['user']['id']}]};var _0x2c66f4={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x37690b)[_0xb2ce('0x52')]([_0xb2ce('0x7c'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3374a3[_0xb2ce('0x68')]['id']}]};var _0x401126={'$or':[_0x837c50,_0x2c66f4]};var _0x5b2c77=[];if(_0x3374a3['body'][_0xb2ce('0x7e')]&&_0x3374a3['body'][_0xb2ce('0x7e')]===_0xb2ce('0x7f')){if(!_[_0xb2ce('0x80')](_0x3374a3[_0xb2ce('0x5c')][_0xb2ce('0x81')])){_0x401126['id']={'$in':_0x3374a3[_0xb2ce('0x5c')][_0xb2ce('0x81')]};}_0x5b2c77=[[_0xb2ce('0x82'),_0xb2ce('0x83')],[_0xb2ce('0x84'),_0x37690b[0x0][_0xb2ce('0x7b')]==='ASC'?'DESC':_0xb2ce('0x83')],db[_0xb2ce('0x7d')]['literal'](_0xb2ce('0x85')),['id',_0xb2ce('0x86')]];}else{if(!_[_0xb2ce('0x80')](_0x3374a3[_0xb2ce('0x5c')][_0xb2ce('0x81')])){_0x401126['id']={'$notIn':_0x3374a3['body'][_0xb2ce('0x81')]};}_0x5b2c77=[[_0xb2ce('0x82'),_0xb2ce('0x86')],['scheduledAt',_0x37690b[0x0][_0xb2ce('0x7b')]],db[_0xb2ce('0x7d')][_0xb2ce('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0xb2ce('0x2d')][_0xb2ce('0x88')]({'attributes':['id',_0xb2ce('0x89'),'recallme'],'where':_0x401126,'order':_0x5b2c77,'transaction':_0x42ab1f,'lock':_0x42ab1f[_0xb2ce('0x8a')][_0xb2ce('0x8b')],'include':[{'model':db[_0xb2ce('0x6f')],'as':_0xb2ce('0x8c'),'attributes':_0x404473,'include':[{'model':db[_0xb2ce('0x8d')],'as':_0xb2ce('0x8e'),'attributes':['id',_0xb2ce('0x29')]}]},{'model':db[_0xb2ce('0x8f')],'as':_0xb2ce('0x90'),'attributes':['id','name']},{'model':db[_0xb2ce('0x61')],'as':_0xb2ce('0x91'),'attributes':['id',_0xb2ce('0x29'),_0xb2ce('0x92')]}]})['then'](function(_0x1052a5){if(_0x1052a5){return _0x1052a5[_0xb2ce('0x93')]({'UserId':_0x3374a3[_0xb2ce('0x68')]['id']},{'transaction':_0x42ab1f});}});});}})['then'](handleEntityNotFound(_0x150694,null))[_0xb2ce('0x26')](respondWithResult(_0x150694,null))[_0xb2ce('0x56')](handleError(_0x150694,null));};exports['getPreviewRecall']=function(_0x567baa,_0x4e3a19,_0x3750ae){var _0xfb39c=[];return db[_0xb2ce('0x6f')][_0xb2ce('0x5e')]()[_0xb2ce('0x26')](function(_0x334e3a){_0xfb39c=_['keys'](_0x334e3a);return _0x567baa[_0xb2ce('0x68')]['getVoiceQueues']({'where':{'type':_0xb2ce('0x79'),'dialActive':!![],'dialMethod':_0xb2ce('0x7a')},'attributes':['id',_0xb2ce('0x7b'),_0xb2ce('0x7c')],'raw':!![]});})[_0xb2ce('0x26')](function(_0x502024){if(_0x502024&&_0x502024[_0xb2ce('0x4b')]){return db[_0xb2ce('0x7d')]['transaction'](function(_0x3eb80e){var _0x25bd15={'active':![],'recallme':!![],'id':_0x567baa[_0xb2ce('0x5c')][_0xb2ce('0x94')]};return db[_0xb2ce('0x2d')][_0xb2ce('0x88')]({'attributes':['id',_0xb2ce('0x89'),_0xb2ce('0x95')],'where':_0x25bd15,'transaction':_0x3eb80e,'lock':_0x3eb80e[_0xb2ce('0x8a')][_0xb2ce('0x8b')],'include':[{'model':db[_0xb2ce('0x6f')],'as':_0xb2ce('0x8c'),'attributes':_0xfb39c,'include':[{'model':db[_0xb2ce('0x8d')],'as':_0xb2ce('0x8e'),'attributes':['id',_0xb2ce('0x29')]}]},{'model':db[_0xb2ce('0x8f')],'as':_0xb2ce('0x90'),'attributes':['id',_0xb2ce('0x29')]},{'model':db[_0xb2ce('0x61')],'as':'Queue','attributes':['id',_0xb2ce('0x29'),_0xb2ce('0x92')]}]})[_0xb2ce('0x26')](function(_0x69f164){if(_0x69f164){return _0x69f164['update']({'UserId':_0x567baa[_0xb2ce('0x68')]['id']},{'transaction':_0x3eb80e});}});});}})['then'](handleEntityNotFound(_0x4e3a19,null))['then'](respondWithResult(_0x4e3a19,null))[_0xb2ce('0x56')](handleError(_0x4e3a19,null));};exports[_0xb2ce('0x96')]=function(_0x31ac90,_0x2ebef9,_0x2fee33){return _0x31ac90[_0xb2ce('0x68')][_0xb2ce('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xb2ce('0x26')](function(_0x2f7363){if(_0x2f7363&&_0x2f7363['length']){return db[_0xb2ce('0x2d')][_0xb2ce('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb2ce('0x6a')](_0xb2ce('0x6b'))},'VoiceQueueId':{'$in':_[_0xb2ce('0x2c')](_0x2f7363,'id')},'$or':[{'UserId':null},{'UserId':_0x31ac90['user']['id']}]}});}return 0x0;})['then'](function(_0x4a0e41){if(!_['isNil'](_0x4a0e41)&&_['isNumber'](_0x4a0e41)){return _0x2ebef9[_0xb2ce('0x1a')](0xc8)['json']({'contacts':_0x4a0e41});}else{logger[_0xb2ce('0x28')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xb2ce('0x96'),0x194,_0xb2ce('0x97'));_0x2ebef9[_0xb2ce('0x98')](0x194);}})[_0xb2ce('0x56')](handleError(_0x2ebef9,null));};exports[_0xb2ce('0x99')]=function(_0x3b4327,_0x5405a3,_0x347ddb){var _0x568c71=shared['timezones'];var _0x25102d=[];_['map'](_0x568c71,function(_0x578534){_0x25102d[_0xb2ce('0x9a')]({'id':_0x578534[_0xb2ce('0x29')],'name':_0x578534[_0xb2ce('0x29')],'utcOffset':_0x578534[_0xb2ce('0x9b')]});});return _0x5405a3[_0xb2ce('0x1a')](0xc8)[_0xb2ce('0x1c')]({'tz':_0x25102d});};exports[_0xb2ce('0x9c')]=function(_0x2c2e86,_0x25c9ac,_0x14086a){var _0x3a1d68=shared[_0xb2ce('0x9d')];var _0x400eee={};if(!_[_0xb2ce('0x72')](_0x3a1d68[_0x2c2e86['body']['id']]))_0x400eee=_0x3a1d68[_0x2c2e86[_0xb2ce('0x5c')]['id']];return _0x25c9ac[_0xb2ce('0x1a')](0xc8)['json'](_0x400eee);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7f5c9be..9b659a6 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 _0x90b1=['priority','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x90b1,0x1bb));var _0x190b=function(_0x30a446,_0x17a06c){_0x30a446=_0x30a446-0x0;var _0x182f93=_0x90b1[_0x30a446];return _0x182f93;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xa')]},{'name':_0x190b('0xb'),'fields':['phone']},{'name':_0x190b('0xc'),'fields':[_0x190b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0xfae7ae,_0x3e1fa3){var _0x31e5dc=function(_0xc299b9){while(--_0xc299b9){_0xfae7ae['push'](_0xfae7ae['shift']());}};_0x31e5dc(++_0x3e1fa3);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x86d3('0x9')]},{'name':_0x86d3('0xa'),'fields':[_0x86d3('0xa')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index a30cf37..f7a157d 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 _0x4792=['DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','UPDATE','Contact','keys','User','Agent','name','voicePause','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','create','destroy','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','CmList','List','\x20MINUTE','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','then','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','findAll','options','where','attributes','limit','include','map','model','info','GetCmHopper','debug','ShowCmHopper','CmHopper','find','raw','CreateCmHopper','body','UpdateCmHopper','update','active'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4792,0x86));var _0x2479=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x4792[_0xf73c09];return _0xa8923c;};'use strict';var _=require('lodash');var util=require(_0x2479('0x0'));var moment=require(_0x2479('0x1'));var BPromise=require(_0x2479('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2479('0x3'));var db=require(_0x2479('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2479('0x5'))(_0x2479('0x6'));var config=require(_0x2479('0x7'));var jayson=require(_0x2479('0x8'));const {validateExpressRequest}=require(_0x2479('0x9'));var client=jayson[_0x2479('0xa')][_0x2479('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2274ee,_0x215644,_0x4e91ab){return new BPromise(function(_0x8635ec,_0x559916){return client['request'](_0x2274ee,_0x4e91ab)[_0x2479('0xc')](function(_0xfee13a){logger['info'](_0x2479('0xd'),_0x215644,'request\x20sent');logger['debug'](_0x2479('0xe'),_0x215644,'request\x20sent',JSON[_0x2479('0xf')](_0xfee13a));if(_0xfee13a[_0x2479('0x10')]){if(_0xfee13a['error'][_0x2479('0x11')]===0x1f4){logger[_0x2479('0x10')](_0x2479('0xd'),_0x215644,_0xfee13a[_0x2479('0x10')][_0x2479('0x12')]);return _0x559916(_0xfee13a[_0x2479('0x10')][_0x2479('0x12')]);}logger['error'](_0x2479('0xd'),_0x215644,_0xfee13a[_0x2479('0x10')]['message']);return _0x8635ec(_0xfee13a[_0x2479('0x10')]['message']);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x215644,_0x2479('0x13'));_0x8635ec(_0xfee13a[_0x2479('0x14')][_0x2479('0x12')]);}})[_0x2479('0x15')](function(_0x2adff1){logger[_0x2479('0x10')]('CmHopper,\x20%s,\x20%s',_0x215644,_0x2adff1);_0x559916(_0x2adff1);});});}exports['GetCmHopper']=function(_0xc2315){var _0x2dad30=this;return new Promise(function(_0x44aceb,_0x2998c5){return db['CmHopper'][_0x2479('0x16')]({'raw':_0xc2315[_0x2479('0x17')]?_0xc2315['options']['raw']===undefined?!![]:![]:!![],'where':_0xc2315['options']?_0xc2315['options'][_0x2479('0x18')]||null:null,'attributes':_0xc2315['options']?_0xc2315[_0x2479('0x17')][_0x2479('0x19')]||null:null,'limit':_0xc2315[_0x2479('0x17')]?_0xc2315[_0x2479('0x17')][_0x2479('0x1a')]||null:null,'include':_0xc2315[_0x2479('0x17')]?_0xc2315[_0x2479('0x17')][_0x2479('0x1b')]?_[_0x2479('0x1c')](_0xc2315['options'][_0x2479('0x1b')],function(_0x1b2fd8){return{'model':db[_0x1b2fd8[_0x2479('0x1d')]],'as':_0x1b2fd8['as'],'attributes':_0x1b2fd8['attributes'],'include':_0x1b2fd8[_0x2479('0x1b')]?_['map'](_0x1b2fd8[_0x2479('0x1b')],function(_0x3351f9){return{'model':db[_0x3351f9[_0x2479('0x1d')]],'as':_0x3351f9['as'],'attributes':_0x3351f9['attributes'],'include':_0x3351f9[_0x2479('0x1b')]?_['map'](_0x3351f9[_0x2479('0x1b')],function(_0x22f8fe){return{'model':db[_0x22f8fe[_0x2479('0x1d')]],'as':_0x22f8fe['as'],'attributes':_0x22f8fe[_0x2479('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2479('0xc')](function(_0x1da4fa){logger[_0x2479('0x1e')](_0x2479('0x1f'),_0xc2315);logger[_0x2479('0x20')](_0x2479('0x1f'),_0xc2315,JSON['stringify'](_0x1da4fa));_0x44aceb(_0x1da4fa);})['catch'](function(_0x3fe1ad){logger[_0x2479('0x10')](_0x2479('0x1f'),_0x3fe1ad['message'],_0xc2315);_0x2998c5(_0x2dad30[_0x2479('0x10')](0x1f4,_0x3fe1ad[_0x2479('0x12')]));});});};exports[_0x2479('0x21')]=function(_0x4a2fff){var _0x39319d=this;return new Promise(function(_0x2ca1c0,_0x408d4b){return db[_0x2479('0x22')][_0x2479('0x23')]({'raw':_0x4a2fff['options']?_0x4a2fff[_0x2479('0x17')][_0x2479('0x24')]===undefined?!![]:![]:!![],'where':_0x4a2fff['options']?_0x4a2fff['options']['where']||null:null,'attributes':_0x4a2fff[_0x2479('0x17')]?_0x4a2fff[_0x2479('0x17')][_0x2479('0x19')]||null:null,'include':_0x4a2fff['options']?_0x4a2fff[_0x2479('0x17')][_0x2479('0x1b')]?_[_0x2479('0x1c')](_0x4a2fff[_0x2479('0x17')]['include'],function(_0x1cc536){return{'model':db[_0x1cc536[_0x2479('0x1d')]],'as':_0x1cc536['as'],'attributes':_0x1cc536[_0x2479('0x19')],'include':_0x1cc536[_0x2479('0x1b')]?_[_0x2479('0x1c')](_0x1cc536[_0x2479('0x1b')],function(_0x10144e){return{'model':db[_0x10144e['model']],'as':_0x10144e['as'],'attributes':_0x10144e['attributes'],'include':_0x10144e['include']?_['map'](_0x10144e['include'],function(_0x144871){return{'model':db[_0x144871[_0x2479('0x1d')]],'as':_0x144871['as'],'attributes':_0x144871[_0x2479('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fdfc1){logger[_0x2479('0x1e')](_0x2479('0x21'),_0x4a2fff);logger[_0x2479('0x20')](_0x2479('0x21'),_0x4a2fff,JSON[_0x2479('0xf')](_0x1fdfc1));_0x2ca1c0(_0x1fdfc1);})[_0x2479('0x15')](function(_0x200dc9){logger[_0x2479('0x10')](_0x2479('0x21'),_0x200dc9[_0x2479('0x12')],_0x4a2fff);_0x408d4b(_0x39319d[_0x2479('0x10')](0x1f4,_0x200dc9['message']));});});};exports[_0x2479('0x25')]=function(_0x374d6f){var _0x364b07=this;return new Promise(function(_0x2623ec,_0x1bc7df){return db[_0x2479('0x22')]['create'](_0x374d6f[_0x2479('0x26')],{'raw':_0x374d6f['options']?_0x374d6f[_0x2479('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2479('0xc')](function(_0x28dd0f){logger[_0x2479('0x1e')](_0x2479('0x25'),_0x374d6f);logger[_0x2479('0x20')](_0x2479('0x25'),_0x374d6f,JSON[_0x2479('0xf')](_0x28dd0f));_0x2623ec(_0x28dd0f);})[_0x2479('0x15')](function(_0x548ba8){logger['error'](_0x2479('0x25'),_0x548ba8[_0x2479('0x12')],_0x374d6f);_0x1bc7df(_0x364b07[_0x2479('0x10')](0x1f4,_0x548ba8['message']));});});};exports[_0x2479('0x27')]=function(_0x22a7e9){var _0x38782f=this;return new Promise(function(_0x563ffb,_0x426562){return db[_0x2479('0x22')][_0x2479('0x28')](_0x22a7e9[_0x2479('0x26')],{'raw':_0x22a7e9[_0x2479('0x17')]?_0x22a7e9['options'][_0x2479('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a7e9[_0x2479('0x17')]?_0x22a7e9[_0x2479('0x17')][_0x2479('0x18')]||null:null,'attributes':_0x22a7e9[_0x2479('0x17')]?_0x22a7e9[_0x2479('0x17')][_0x2479('0x19')]||null:null,'limit':_0x22a7e9[_0x2479('0x17')]?_0x22a7e9[_0x2479('0x17')][_0x2479('0x1a')]||null:null})['then'](function(_0x97e5b6){logger['info'](_0x2479('0x27'),_0x22a7e9);logger[_0x2479('0x1e')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x2479('0xf')](_0x22a7e9[_0x2479('0x17')]['where']),_0x22a7e9[_0x2479('0x26')][_0x2479('0x29')]);logger[_0x2479('0x20')](_0x2479('0x27'),_0x22a7e9,JSON[_0x2479('0xf')](_0x97e5b6));_0x563ffb(_0x97e5b6);})[_0x2479('0x15')](function(_0x5e6029){logger[_0x2479('0x10')](_0x2479('0x27'),_0x5e6029[_0x2479('0x12')],_0x22a7e9);_0x426562(_0x38782f['error'](0x1f4,_0x5e6029['message']));});});};exports['DestroyCmHopper']=function(_0x2064de){var _0x1692e5=this;return new Promise(function(_0x41d50d,_0x4c4b68){return db[_0x2479('0x22')]['destroy']({'where':_0x2064de[_0x2479('0x17')]?_0x2064de[_0x2479('0x17')][_0x2479('0x18')]||null:null})[_0x2479('0xc')](function(_0x20ba6d){logger['info'](_0x2479('0x2a'),_0x2064de);logger[_0x2479('0x20')]('DestroyCmHopper',_0x2064de,JSON[_0x2479('0xf')](_0x20ba6d));_0x41d50d(_0x20ba6d);})[_0x2479('0x15')](function(_0x1446b9){logger['error'](_0x2479('0x2a'),_0x1446b9[_0x2479('0x12')],_0x2064de);_0x4c4b68(_0x1692e5[_0x2479('0x10')](0x1f4,_0x1446b9['message']));});});};exports[_0x2479('0x2b')]=function(_0x2c00b0){var _0x12be05=this;return new Promise(function(_0xcfcf32,_0x1f561b){return db[_0x2479('0x2c')][_0x2479('0x2d')]()['then'](function(_0x4a42e7){return db[_0x2479('0x2e')][_0x2479('0x2f')](function(_0x17f061){return db[_0x2479('0x22')][_0x2479('0x16')]({'where':_0x2c00b0['options']?_0x2c00b0[_0x2479('0x17')][_0x2479('0x18')]||null:null,'attributes':_0x2c00b0[_0x2479('0x17')]?_0x2c00b0['options'][_0x2479('0x19')]||null:null,'limit':_0x2c00b0[_0x2479('0x17')]?_0x2c00b0[_0x2479('0x17')][_0x2479('0x1a')]||null:null,'order':_0x2c00b0[_0x2479('0x17')]?_0x2c00b0[_0x2479('0x17')][_0x2479('0x30')]||null:null,'transaction':_0x17f061,'lock':_0x17f061['LOCK'][_0x2479('0x31')],'include':[{'model':db[_0x2479('0x2c')],'as':_0x2479('0x32'),'attributes':_[_0x2479('0x33')](_0x4a42e7)},{'model':db[_0x2479('0x34')],'as':_0x2479('0x35'),'attributes':['id',_0x2479('0x36'),_0x2479('0x37')]}]})[_0x2479('0xc')](function(_0x39b659){var _0x36b431=[];var _0x3d9807=[];for(var _0x2bbef7=0x0;_0x2bbef7<_0x39b659['length'];_0x2bbef7+=0x1){var _0x4f3bc3=_0x39b659[_0x2bbef7]['UserId'];if(_0x4f3bc3===null){_0x36b431[_0x2479('0x38')](_0x39b659[_0x2bbef7][_0x2479('0x28')](_0x2c00b0[_0x2479('0x26')],{'transaction':_0x17f061}));}else if(!_0x3d9807['includes'](_0x4f3bc3)){_0x3d9807[_0x2479('0x38')](_0x4f3bc3);_0x36b431[_0x2479('0x38')](_0x39b659[_0x2bbef7]['update'](_0x2c00b0[_0x2479('0x26')],{'transaction':_0x17f061}));}}return BPromise[_0x2479('0x39')](_0x36b431);});})[_0x2479('0xc')](function(_0x303b2b){logger['info']('GetContactDialer',_0x2c00b0);if(_0x303b2b[_0x2479('0x3a')]>0x0){logger[_0x2479('0x1e')](_0x2479('0x3b'),_0x303b2b[0x0]['dataValues']['id'],_0x303b2b[0x0][_0x2479('0x3c')][_0x2479('0x3d')],_0x303b2b[0x0]['dataValues']['active']);}logger['debug'](_0x2479('0x2b'),_0x2c00b0,JSON[_0x2479('0xf')](_0x303b2b));_0xcfcf32(_0x303b2b);})[_0x2479('0x15')](function(_0x3e268c){logger[_0x2479('0x10')](_0x2479('0x2b'),_0x3e268c[_0x2479('0x12')],_0x2c00b0);_0x1f561b(_0x12be05[_0x2479('0x10')](0x1f4,_0x3e268c['message']));});});});};exports[_0x2479('0x3e')]=function(_0x490649){var _0x505f2d=this;return new Promise(function(_0x3374d1,_0x4885dd){return db[_0x2479('0x2e')][_0x2479('0x2f')](function(_0x3065b7){return db['CmHopperFinal'][_0x2479('0x3f')](_0x490649['body'],{'raw':_0x490649[_0x2479('0x17')]?_0x490649['options'][_0x2479('0x24')]===undefined?!![]:![]:!![],'transaction':_0x3065b7})[_0x2479('0xc')](function(){logger[_0x2479('0x1e')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x490649[_0x2479('0x17')][_0x2479('0x18')]),_0x490649[_0x2479('0x17')]['where'][_0x2479('0x29')]);return db[_0x2479('0x22')][_0x2479('0x40')]({'where':_0x490649[_0x2479('0x17')]?_0x490649[_0x2479('0x17')][_0x2479('0x18')]||null:null,'transaction':_0x3065b7});});})[_0x2479('0xc')](function(_0x392d82){logger[_0x2479('0x1e')](_0x2479('0x3e'),_0x490649);logger[_0x2479('0x20')]('MoveContactManagedDialer',_0x490649,JSON[_0x2479('0xf')](_0x392d82));_0x3374d1(_0x392d82);})[_0x2479('0x15')](function(_0xa0141d){logger['error']('MoveContactManagedDialer',_0xa0141d[_0x2479('0x12')],_0x490649);_0x4885dd(_0x505f2d[_0x2479('0x10')](0x1f4,_0xa0141d[_0x2479('0x12')]));});});};exports[_0x2479('0x41')]=function(_0x1ad14b){var _0x403141=this;return new Promise(function(_0x4572a8,_0x2e4889){return db[_0x2479('0x22')][_0x2479('0x16')]({'raw':_0x1ad14b['options']?_0x1ad14b[_0x2479('0x17')][_0x2479('0x24')]===undefined?!![]:![]:!![],'where':_0x1ad14b['options']?_0x1ad14b['options'][_0x2479('0x18')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2479('0x42'),db[_0x2479('0x2e')]['fn']('IF',db[_0x2479('0x2e')][_0x2479('0x43')]('`scheduledat`\x20>=\x20'+util[_0x2479('0x44')]('\x22%s\x22',moment()['format'](_0x2479('0x45')))+_0x2479('0x46')))),_0x2479('0x47')]]})[_0x2479('0xc')](function(_0x31ed19){logger[_0x2479('0x1e')](_0x2479('0x41'),_0x1ad14b);logger['debug']('CountReScheduled',_0x1ad14b,JSON[_0x2479('0xf')](_0x31ed19));_0x4572a8(_0x31ed19);})[_0x2479('0x15')](function(_0x3189cf){logger['error']('CountReScheduled',_0x3189cf[_0x2479('0x12')],_0x1ad14b);_0x2e4889(_0x403141[_0x2479('0x10')](0x1f4,_0x3189cf['message']));});});};exports[_0x2479('0x48')]=function(_0x4a9ddc){var _0x3d48d7=this;return new Promise(function(_0x5a892d,_0x2f6a01){return db[_0x2479('0x2c')][_0x2479('0x2d')]()[_0x2479('0xc')](function(_0x5844c5){return db[_0x2479('0x2e')]['transaction'](function(_0x474820){return db[_0x2479('0x22')][_0x2479('0x16')]({'where':_0x4a9ddc[_0x2479('0x17')]?_0x4a9ddc['options']['where']||null:null,'attributes':_0x4a9ddc['options']?_0x4a9ddc[_0x2479('0x17')][_0x2479('0x19')]||null:null,'limit':0x1,'order':_0x4a9ddc['options']?_0x4a9ddc[_0x2479('0x17')][_0x2479('0x30')]||null:null,'group':db[_0x2479('0x22')][_0x2479('0x49')],'transaction':_0x474820,'lock':_0x474820[_0x2479('0x4a')][_0x2479('0x31')],'include':_0x4a9ddc[_0x2479('0x17')]?_0x4a9ddc[_0x2479('0x17')][_0x2479('0x1b')]?_[_0x2479('0x1c')](_0x4a9ddc[_0x2479('0x17')][_0x2479('0x1b')],function(_0x5ed008){return{'model':db[_0x5ed008[_0x2479('0x1d')]],'as':_0x5ed008['as'],'attributes':_0x5ed008[_0x2479('0x19')],'include':_0x5ed008[_0x2479('0x1b')]?_[_0x2479('0x1c')](_0x5ed008[_0x2479('0x1b')],function(_0x30e3f9){return{'model':db[_0x30e3f9['model']],'as':_0x30e3f9['as'],'attributes':_0x30e3f9['attributes'],'include':_0x30e3f9['include']?_[_0x2479('0x1c')](_0x30e3f9[_0x2479('0x1b')],function(_0x4e88fa){return{'model':db[_0x4e88fa['model']],'as':_0x4e88fa['as'],'attributes':_0x4e88fa[_0x2479('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2479('0xc')](function(_0x1c2e0c){var _0x1b4eff=[];for(var _0x9b12=0x0;_0x9b12<_0x1c2e0c[_0x2479('0x3a')];_0x9b12+=0x1){_0x1b4eff['push'](_0x1c2e0c[_0x9b12][_0x2479('0x28')](_0x4a9ddc[_0x2479('0x26')],{'transaction':_0x474820}));}return BPromise['all'](_0x1b4eff);});})['then'](function(_0x173dbe){logger[_0x2479('0x1e')](_0x2479('0x48'),_0x4a9ddc);logger[_0x2479('0x20')](_0x2479('0x48'),_0x4a9ddc,JSON[_0x2479('0xf')](_0x173dbe));_0x5a892d(_0x173dbe);})['catch'](function(_0x252984){logger[_0x2479('0x10')](_0x2479('0x48'),_0x252984[_0x2479('0x12')],_0x4a9ddc);_0x2f6a01(_0x3d48d7[_0x2479('0x10')](0x1f4,_0x252984[_0x2479('0x12')]));});});});};exports[_0x2479('0x4b')]=function(_0x209e59){var _0x38a548=this;return new Promise(function(_0x60873f,_0x181752){db[_0x2479('0x2c')][_0x2479('0x2d')]()[_0x2479('0xc')](function(_0x1b7311){return db[_0x2479('0x22')]['findAll']({'raw':_0x209e59['options']?_0x209e59[_0x2479('0x17')][_0x2479('0x24')]===undefined?!![]:![]:!![],'where':_0x209e59[_0x2479('0x17')]?_0x209e59[_0x2479('0x17')][_0x2479('0x18')]||null:null,'attributes':_0x209e59[_0x2479('0x17')]?_0x209e59[_0x2479('0x17')]['attributes']||null:null,'limit':_0x209e59[_0x2479('0x17')]?_0x209e59[_0x2479('0x17')][_0x2479('0x1a')]||null:null,'include':_0x209e59[_0x2479('0x17')]?_0x209e59['options'][_0x2479('0x1b')]?_[_0x2479('0x1c')](_0x209e59['options'][_0x2479('0x1b')],function(_0x54842f){return{'model':db[_0x54842f['model']],'as':_0x54842f['as'],'attributes':_0x54842f['as']==='Contact'?_['keys'](_0x1b7311):_0x54842f[_0x2479('0x19')],'include':_0x54842f[_0x2479('0x1b')]?_['map'](_0x54842f['include'],function(_0x24750e){return{'model':db[_0x24750e[_0x2479('0x1d')]],'as':_0x24750e['as'],'attributes':_0x24750e[_0x2479('0x19')],'include':_0x24750e[_0x2479('0x1b')]?_[_0x2479('0x1c')](_0x24750e[_0x2479('0x1b')],function(_0x512f1a){return{'model':db[_0x512f1a[_0x2479('0x1d')]],'as':_0x512f1a['as'],'attributes':_0x512f1a[_0x2479('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2479('0xc')](function(_0x332fc6){logger[_0x2479('0x1e')](_0x2479('0x1f'),_0x209e59);logger[_0x2479('0x20')](_0x2479('0x1f'),_0x209e59,JSON[_0x2479('0xf')](_0x332fc6));_0x60873f(_0x332fc6);})['catch'](function(_0x42aa22){logger['error']('GetCmHopper',_0x42aa22[_0x2479('0x12')],_0x209e59);_0x181752(_0x38a548[_0x2479('0x10')](0x1f4,_0x42aa22[_0x2479('0x12')]));});});});};exports['GetContactByPhone']=function(_0x599063){var _0x526b5a=this;return new Promise(function(_0x19ad36,_0x39c45d){return db[_0x2479('0x2c')][_0x2479('0x4c')]({'raw':!![],'where':{'phone':_0x599063[_0x2479('0x17')][_0x2479('0x18')][_0x2479('0x4d')]},'attributes':['id',_0x2479('0x4e')],'order':[['id',_0x2479('0x4f')]]})['then'](function(_0x3b8479){logger[_0x2479('0x1e')]('getContactByPhone',_0x599063);logger[_0x2479('0x20')](_0x2479('0x50'),_0x599063,JSON[_0x2479('0xf')](_0x3b8479));_0x19ad36(_0x3b8479);})[_0x2479('0x15')](function(_0x4bbebe){logger[_0x2479('0x10')](_0x2479('0x50'),_0x4bbebe['message'],_0x599063);_0x39c45d(_0x526b5a['error'](0x1f4,_0x4bbebe[_0x2479('0x12')]));});});};exports[_0x2479('0x51')]=function(_0x2b2921){var _0x4af418=this;return new Promise(function(_0x336ae3,_0x3cd8b6){return db[_0x2479('0x2e')]['transaction'](function(_0x26e1b1){return db['CmHopper']['update']({'active':![]},{'where':{},'transaction':_0x26e1b1})[_0x2479('0xc')](function(_0x3de32f){logger[_0x2479('0x1e')](_0x2479('0x51'),_0x2b2921);logger[_0x2479('0x20')](_0x2479('0x51'),_0x2b2921,JSON[_0x2479('0xf')](_0x3de32f));_0x336ae3(_0x3de32f);})[_0x2479('0x15')](function(_0x45182b){logger['error'](_0x2479('0x51'),_0x45182b[_0x2479('0x12')],_0x2b2921);_0x3cd8b6(_0x4af418[_0x2479('0x10')](0x1f4,_0x45182b[_0x2479('0x12')]));});});});};exports[_0x2479('0x52')]=function(_0x2ecd93){var _0x5eb4fe=this;var _0x2e2ec0=_0x2ecd93[_0x2479('0x26')][_0x2479('0x18')]['voiceQueueId'];var _0x3945c2=_0x2ecd93[_0x2479('0x26')][_0x2479('0x18')][_0x2479('0x53')];return new Promise(function(_0x7871a,_0x243d83){return db[_0x2479('0x22')][_0x2479('0x16')]({'where':{'voiceQueueId':_0x2e2ec0,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0x2479('0x54')+_0x3945c2+'\x20MINUTE')}},'include':[{'model':db[_0x2479('0x2c')],'as':_0x2479('0x32')},{'model':db[_0x2479('0x34')],'as':_0x2479('0x35'),'attributes':['id',_0x2479('0x36'),_0x2479('0x37')]},{'model':db[_0x2479('0x55')],'as':_0x2479('0x56')}]})[_0x2479('0xc')](function(_0x4a9927){return db['sequelize'][_0x2479('0x2f')](function(_0x3147ea){return db[_0x2479('0x22')][_0x2479('0x28')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x2e2ec0,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0x2479('0x43')]('NOW()\x20+\x20INTERVAL\x20'+_0x3945c2+_0x2479('0x57'))}},'transaction':_0x3147ea})[_0x2479('0xc')](function(_0x5174af){_0x7871a(_0x4a9927);})[_0x2479('0x15')](function(_0x45dc89){logger['error'](_0x2479('0x52'),_0x45dc89[_0x2479('0x12')],_0x2ecd93);_0x243d83(validateExpressRequest);});});})[_0x2479('0x15')](function(_0xfe01c8){logger[_0x2479('0x10')]('CmHopperHandlePreviewRecallNotifications',_0xfe01c8['message'],_0x2ecd93);_0x243d83(_0x5eb4fe[_0x2479('0x10')](0x1f4,_0xfe01c8[_0x2479('0x12')]));});});}; \ No newline at end of file +var _0xf9b7=['includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','UserId','update','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','twilio/lib/webhooks/webhooks','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','ShowCmHopper','CreateCmHopper','create','body','raw','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push'];(function(_0x315221,_0xbd1cf0){var _0x1f441c=function(_0xae89a9){while(--_0xae89a9){_0x315221['push'](_0x315221['shift']());}};_0x1f441c(++_0xbd1cf0);}(_0xf9b7,0x121));var _0x7f9b=function(_0x329693,_0x5902b8){_0x329693=_0x329693-0x0;var _0xa1d2c0=_0xf9b7[_0x329693];return _0xa1d2c0;};'use strict';var _=require(_0x7f9b('0x0'));var util=require(_0x7f9b('0x1'));var moment=require(_0x7f9b('0x2'));var BPromise=require(_0x7f9b('0x3'));var rs=require(_0x7f9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f9b('0x5'))['db'];var utils=require(_0x7f9b('0x6'));var logger=require(_0x7f9b('0x7'))(_0x7f9b('0x8'));var config=require(_0x7f9b('0x9'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0x7f9b('0xa'));var client=jayson['client'][_0x7f9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xde36b1,_0x1a37d1,_0x3dd587){return new BPromise(function(_0xb755ca,_0x27b40a){return client['request'](_0xde36b1,_0x3dd587)[_0x7f9b('0xc')](function(_0x35c195){logger[_0x7f9b('0xd')](_0x7f9b('0xe'),_0x1a37d1,_0x7f9b('0xf'));logger[_0x7f9b('0x10')](_0x7f9b('0x11'),_0x1a37d1,_0x7f9b('0xf'),JSON[_0x7f9b('0x12')](_0x35c195));if(_0x35c195['error']){if(_0x35c195['error'][_0x7f9b('0x13')]===0x1f4){logger[_0x7f9b('0x14')](_0x7f9b('0xe'),_0x1a37d1,_0x35c195[_0x7f9b('0x14')][_0x7f9b('0x15')]);return _0x27b40a(_0x35c195[_0x7f9b('0x14')][_0x7f9b('0x15')]);}logger['error'](_0x7f9b('0xe'),_0x1a37d1,_0x35c195[_0x7f9b('0x14')][_0x7f9b('0x15')]);return _0xb755ca(_0x35c195[_0x7f9b('0x14')][_0x7f9b('0x15')]);}else{logger[_0x7f9b('0xd')](_0x7f9b('0xe'),_0x1a37d1,_0x7f9b('0xf'));_0xb755ca(_0x35c195[_0x7f9b('0x16')][_0x7f9b('0x15')]);}})[_0x7f9b('0x17')](function(_0x523eab){logger[_0x7f9b('0x14')](_0x7f9b('0xe'),_0x1a37d1,_0x523eab);_0x27b40a(_0x523eab);});});}exports[_0x7f9b('0x18')]=function(_0x159757){var _0x3ce00d=this;return new Promise(function(_0x817887,_0x2defdf){return db[_0x7f9b('0x19')][_0x7f9b('0x1a')]({'raw':_0x159757[_0x7f9b('0x1b')]?_0x159757['options']['raw']===undefined?!![]:![]:!![],'where':_0x159757[_0x7f9b('0x1b')]?_0x159757[_0x7f9b('0x1b')][_0x7f9b('0x1c')]||null:null,'attributes':_0x159757[_0x7f9b('0x1b')]?_0x159757['options'][_0x7f9b('0x1d')]||null:null,'limit':_0x159757[_0x7f9b('0x1b')]?_0x159757[_0x7f9b('0x1b')][_0x7f9b('0x1e')]||null:null,'include':_0x159757['options']?_0x159757['options'][_0x7f9b('0x1f')]?_[_0x7f9b('0x20')](_0x159757[_0x7f9b('0x1b')][_0x7f9b('0x1f')],function(_0x2ab6af){return{'model':db[_0x2ab6af['model']],'as':_0x2ab6af['as'],'attributes':_0x2ab6af['attributes'],'include':_0x2ab6af[_0x7f9b('0x1f')]?_[_0x7f9b('0x20')](_0x2ab6af[_0x7f9b('0x1f')],function(_0x3c8fb3){return{'model':db[_0x3c8fb3[_0x7f9b('0x21')]],'as':_0x3c8fb3['as'],'attributes':_0x3c8fb3[_0x7f9b('0x1d')],'include':_0x3c8fb3[_0x7f9b('0x1f')]?_['map'](_0x3c8fb3[_0x7f9b('0x1f')],function(_0x40aebf){return{'model':db[_0x40aebf[_0x7f9b('0x21')]],'as':_0x40aebf['as'],'attributes':_0x40aebf[_0x7f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7f9b('0xc')](function(_0x3e40ef){logger[_0x7f9b('0xd')](_0x7f9b('0x18'),_0x159757);logger[_0x7f9b('0x10')](_0x7f9b('0x18'),_0x159757,JSON[_0x7f9b('0x12')](_0x3e40ef));_0x817887(_0x3e40ef);})[_0x7f9b('0x17')](function(_0x1e4b6f){logger[_0x7f9b('0x14')](_0x7f9b('0x18'),_0x1e4b6f[_0x7f9b('0x15')],_0x159757);_0x2defdf(_0x3ce00d['error'](0x1f4,_0x1e4b6f['message']));});});};exports[_0x7f9b('0x22')]=function(_0x4e1356){var _0x256e7e=this;return new Promise(function(_0x35bc99,_0x423696){return db[_0x7f9b('0x19')]['find']({'raw':_0x4e1356[_0x7f9b('0x1b')]?_0x4e1356[_0x7f9b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4e1356[_0x7f9b('0x1b')]?_0x4e1356[_0x7f9b('0x1b')][_0x7f9b('0x1c')]||null:null,'attributes':_0x4e1356['options']?_0x4e1356['options'][_0x7f9b('0x1d')]||null:null,'include':_0x4e1356[_0x7f9b('0x1b')]?_0x4e1356[_0x7f9b('0x1b')][_0x7f9b('0x1f')]?_['map'](_0x4e1356[_0x7f9b('0x1b')][_0x7f9b('0x1f')],function(_0x23f6ad){return{'model':db[_0x23f6ad[_0x7f9b('0x21')]],'as':_0x23f6ad['as'],'attributes':_0x23f6ad[_0x7f9b('0x1d')],'include':_0x23f6ad[_0x7f9b('0x1f')]?_['map'](_0x23f6ad[_0x7f9b('0x1f')],function(_0x52ddd9){return{'model':db[_0x52ddd9[_0x7f9b('0x21')]],'as':_0x52ddd9['as'],'attributes':_0x52ddd9['attributes'],'include':_0x52ddd9['include']?_[_0x7f9b('0x20')](_0x52ddd9[_0x7f9b('0x1f')],function(_0x12d49f){return{'model':db[_0x12d49f[_0x7f9b('0x21')]],'as':_0x12d49f['as'],'attributes':_0x12d49f[_0x7f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7f9b('0xc')](function(_0x25436f){logger['info'](_0x7f9b('0x22'),_0x4e1356);logger[_0x7f9b('0x10')]('ShowCmHopper',_0x4e1356,JSON[_0x7f9b('0x12')](_0x25436f));_0x35bc99(_0x25436f);})[_0x7f9b('0x17')](function(_0x2a4fb6){logger[_0x7f9b('0x14')](_0x7f9b('0x22'),_0x2a4fb6[_0x7f9b('0x15')],_0x4e1356);_0x423696(_0x256e7e['error'](0x1f4,_0x2a4fb6[_0x7f9b('0x15')]));});});};exports[_0x7f9b('0x23')]=function(_0x5d1ce3){var _0x3ec2c0=this;return new Promise(function(_0x90e42c,_0x460496){return db[_0x7f9b('0x19')][_0x7f9b('0x24')](_0x5d1ce3[_0x7f9b('0x25')],{'raw':_0x5d1ce3[_0x7f9b('0x1b')]?_0x5d1ce3[_0x7f9b('0x1b')][_0x7f9b('0x26')]===undefined?!![]:![]:!![]})[_0x7f9b('0xc')](function(_0x2c2963){logger['info'](_0x7f9b('0x23'),_0x5d1ce3);logger[_0x7f9b('0x10')](_0x7f9b('0x23'),_0x5d1ce3,JSON['stringify'](_0x2c2963));_0x90e42c(_0x2c2963);})[_0x7f9b('0x17')](function(_0x351c53){logger[_0x7f9b('0x14')](_0x7f9b('0x23'),_0x351c53[_0x7f9b('0x15')],_0x5d1ce3);_0x460496(_0x3ec2c0['error'](0x1f4,_0x351c53[_0x7f9b('0x15')]));});});};exports['UpdateCmHopper']=function(_0x3ef69e){var _0x4d4a4c=this;return new Promise(function(_0x390537,_0x2668cd){return db[_0x7f9b('0x19')]['update'](_0x3ef69e['body'],{'raw':_0x3ef69e['options']?_0x3ef69e[_0x7f9b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef69e[_0x7f9b('0x1b')]?_0x3ef69e[_0x7f9b('0x1b')][_0x7f9b('0x1c')]||null:null,'attributes':_0x3ef69e[_0x7f9b('0x1b')]?_0x3ef69e[_0x7f9b('0x1b')][_0x7f9b('0x1d')]||null:null,'limit':_0x3ef69e[_0x7f9b('0x1b')]?_0x3ef69e['options']['limit']||null:null})[_0x7f9b('0xc')](function(_0x2711ea){logger['info'](_0x7f9b('0x27'),_0x3ef69e);logger[_0x7f9b('0xd')](_0x7f9b('0x28'),JSON[_0x7f9b('0x12')](_0x3ef69e[_0x7f9b('0x1b')][_0x7f9b('0x1c')]),_0x3ef69e[_0x7f9b('0x25')][_0x7f9b('0x29')]);logger[_0x7f9b('0x10')](_0x7f9b('0x27'),_0x3ef69e,JSON['stringify'](_0x2711ea));_0x390537(_0x2711ea);})[_0x7f9b('0x17')](function(_0x3e5a96){logger[_0x7f9b('0x14')](_0x7f9b('0x27'),_0x3e5a96[_0x7f9b('0x15')],_0x3ef69e);_0x2668cd(_0x4d4a4c['error'](0x1f4,_0x3e5a96[_0x7f9b('0x15')]));});});};exports[_0x7f9b('0x2a')]=function(_0x34c461){var _0x9f1c96=this;return new Promise(function(_0x41c1e4,_0x3759eb){return db[_0x7f9b('0x19')][_0x7f9b('0x2b')]({'where':_0x34c461[_0x7f9b('0x1b')]?_0x34c461[_0x7f9b('0x1b')][_0x7f9b('0x1c')]||null:null})['then'](function(_0x55d93a){logger[_0x7f9b('0xd')]('DestroyCmHopper',_0x34c461);logger[_0x7f9b('0x10')](_0x7f9b('0x2a'),_0x34c461,JSON[_0x7f9b('0x12')](_0x55d93a));_0x41c1e4(_0x55d93a);})[_0x7f9b('0x17')](function(_0x293ded){logger[_0x7f9b('0x14')]('DestroyCmHopper',_0x293ded[_0x7f9b('0x15')],_0x34c461);_0x3759eb(_0x9f1c96[_0x7f9b('0x14')](0x1f4,_0x293ded[_0x7f9b('0x15')]));});});};exports[_0x7f9b('0x2c')]=function(_0x8b60){var _0x141721=this;return new Promise(function(_0x8198dc,_0x49a50b){return db[_0x7f9b('0x2d')][_0x7f9b('0x2e')]()[_0x7f9b('0xc')](function(_0x18d051){return db['sequelize'][_0x7f9b('0x2f')](function(_0x5230a8){return db['CmHopper'][_0x7f9b('0x1a')]({'where':_0x8b60[_0x7f9b('0x1b')]?_0x8b60['options'][_0x7f9b('0x1c')]||null:null,'attributes':_0x8b60['options']?_0x8b60[_0x7f9b('0x1b')]['attributes']||null:null,'limit':_0x8b60['options']?_0x8b60['options'][_0x7f9b('0x1e')]||null:null,'order':_0x8b60['options']?_0x8b60['options'][_0x7f9b('0x30')]||null:null,'transaction':_0x5230a8,'lock':_0x5230a8[_0x7f9b('0x31')][_0x7f9b('0x32')],'include':[{'model':db[_0x7f9b('0x2d')],'as':_0x7f9b('0x33'),'attributes':_[_0x7f9b('0x34')](_0x18d051)},{'model':db[_0x7f9b('0x35')],'as':_0x7f9b('0x36'),'attributes':['id',_0x7f9b('0x37'),_0x7f9b('0x38')]}]})[_0x7f9b('0xc')](function(_0x4426ce){var _0x2b39f3=[];var _0x5e43da=[];for(var _0x3d95d2=0x0;_0x3d95d2<_0x4426ce[_0x7f9b('0x39')];_0x3d95d2+=0x1){var _0xb0b6d=_0x4426ce[_0x3d95d2]['UserId'];if(_0xb0b6d===null){_0x2b39f3[_0x7f9b('0x3a')](_0x4426ce[_0x3d95d2]['update'](_0x8b60[_0x7f9b('0x25')],{'transaction':_0x5230a8}));}else if(!_0x5e43da[_0x7f9b('0x3b')](_0xb0b6d)){_0x5e43da['push'](_0xb0b6d);_0x2b39f3[_0x7f9b('0x3a')](_0x4426ce[_0x3d95d2]['update'](_0x8b60[_0x7f9b('0x25')],{'transaction':_0x5230a8}));}}return BPromise[_0x7f9b('0x3c')](_0x2b39f3);});})['then'](function(_0x4f7a60){logger['info'](_0x7f9b('0x2c'),_0x8b60);if(_0x4f7a60[_0x7f9b('0x39')]>0x0){logger[_0x7f9b('0xd')](_0x7f9b('0x3d'),_0x4f7a60[0x0][_0x7f9b('0x3e')]['id'],_0x4f7a60[0x0]['dataValues'][_0x7f9b('0x3f')],_0x4f7a60[0x0][_0x7f9b('0x3e')][_0x7f9b('0x29')]);}logger[_0x7f9b('0x10')](_0x7f9b('0x2c'),_0x8b60,JSON[_0x7f9b('0x12')](_0x4f7a60));_0x8198dc(_0x4f7a60);})[_0x7f9b('0x17')](function(_0x35b6e0){logger[_0x7f9b('0x14')]('GetContactDialer',_0x35b6e0[_0x7f9b('0x15')],_0x8b60);_0x49a50b(_0x141721['error'](0x1f4,_0x35b6e0[_0x7f9b('0x15')]));});});});};exports[_0x7f9b('0x40')]=function(_0x303e1b){var _0x230a91=this;return new Promise(function(_0x3dec69,_0x146bfa){return db['sequelize']['transaction'](function(_0x2f8ba2){return db[_0x7f9b('0x41')][_0x7f9b('0x24')](_0x303e1b[_0x7f9b('0x25')],{'raw':_0x303e1b[_0x7f9b('0x1b')]?_0x303e1b[_0x7f9b('0x1b')][_0x7f9b('0x26')]===undefined?!![]:![]:!![],'transaction':_0x2f8ba2})[_0x7f9b('0xc')](function(){logger['info'](_0x7f9b('0x42'),JSON[_0x7f9b('0x12')](_0x303e1b[_0x7f9b('0x1b')][_0x7f9b('0x1c')]),_0x303e1b[_0x7f9b('0x1b')][_0x7f9b('0x1c')][_0x7f9b('0x29')]);return db[_0x7f9b('0x19')][_0x7f9b('0x2b')]({'where':_0x303e1b[_0x7f9b('0x1b')]?_0x303e1b['options'][_0x7f9b('0x1c')]||null:null,'transaction':_0x2f8ba2});});})['then'](function(_0x124292){logger[_0x7f9b('0xd')](_0x7f9b('0x40'),_0x303e1b);logger['debug'](_0x7f9b('0x40'),_0x303e1b,JSON[_0x7f9b('0x12')](_0x124292));_0x3dec69(_0x124292);})[_0x7f9b('0x17')](function(_0x16663d){logger[_0x7f9b('0x14')](_0x7f9b('0x40'),_0x16663d['message'],_0x303e1b);_0x146bfa(_0x230a91[_0x7f9b('0x14')](0x1f4,_0x16663d['message']));});});};exports[_0x7f9b('0x43')]=function(_0x441e02){var _0xd6abb0=this;return new Promise(function(_0x404b13,_0x188500){return db[_0x7f9b('0x19')]['findAll']({'raw':_0x441e02['options']?_0x441e02['options'][_0x7f9b('0x26')]===undefined?!![]:![]:!![],'where':_0x441e02['options']?_0x441e02[_0x7f9b('0x1b')][_0x7f9b('0x1c')]||null:null,'attributes':[[db[_0x7f9b('0x44')]['fn']('COUNT',db[_0x7f9b('0x44')]['fn']('IF',db[_0x7f9b('0x44')][_0x7f9b('0x45')](_0x7f9b('0x46')+util['format'](_0x7f9b('0x47'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x7f9b('0x48')))),'contactsRescheduled']]})['then'](function(_0x332c78){logger['info'](_0x7f9b('0x43'),_0x441e02);logger[_0x7f9b('0x10')]('CountReScheduled',_0x441e02,JSON['stringify'](_0x332c78));_0x404b13(_0x332c78);})[_0x7f9b('0x17')](function(_0x2ce6e0){logger[_0x7f9b('0x14')]('CountReScheduled',_0x2ce6e0['message'],_0x441e02);_0x188500(_0xd6abb0[_0x7f9b('0x14')](0x1f4,_0x2ce6e0[_0x7f9b('0x15')]));});});};exports[_0x7f9b('0x49')]=function(_0x33c98b){var _0x40b3f4=this;return new Promise(function(_0x537da5,_0x5ba9c2){return db[_0x7f9b('0x2d')]['describe']()[_0x7f9b('0xc')](function(_0x30864f){return db[_0x7f9b('0x44')][_0x7f9b('0x2f')](function(_0x19251a){return db[_0x7f9b('0x19')][_0x7f9b('0x1a')]({'where':_0x33c98b[_0x7f9b('0x1b')]?_0x33c98b['options'][_0x7f9b('0x1c')]||null:null,'attributes':_0x33c98b[_0x7f9b('0x1b')]?_0x33c98b['options'][_0x7f9b('0x1d')]||null:null,'limit':0x1,'order':_0x33c98b[_0x7f9b('0x1b')]?_0x33c98b[_0x7f9b('0x1b')]['order']||null:null,'group':db[_0x7f9b('0x19')][_0x7f9b('0x4a')],'transaction':_0x19251a,'lock':_0x19251a['LOCK'][_0x7f9b('0x32')],'include':_0x33c98b[_0x7f9b('0x1b')]?_0x33c98b[_0x7f9b('0x1b')]['include']?_['map'](_0x33c98b[_0x7f9b('0x1b')][_0x7f9b('0x1f')],function(_0x2bb9ed){return{'model':db[_0x2bb9ed['model']],'as':_0x2bb9ed['as'],'attributes':_0x2bb9ed[_0x7f9b('0x1d')],'include':_0x2bb9ed[_0x7f9b('0x1f')]?_['map'](_0x2bb9ed[_0x7f9b('0x1f')],function(_0x323401){return{'model':db[_0x323401['model']],'as':_0x323401['as'],'attributes':_0x323401[_0x7f9b('0x1d')],'include':_0x323401[_0x7f9b('0x1f')]?_['map'](_0x323401['include'],function(_0x1afc4b){return{'model':db[_0x1afc4b[_0x7f9b('0x21')]],'as':_0x1afc4b['as'],'attributes':_0x1afc4b[_0x7f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7f9b('0xc')](function(_0x448459){var _0x1c0402=[];for(var _0x2ca123=0x0;_0x2ca123<_0x448459[_0x7f9b('0x39')];_0x2ca123+=0x1){_0x1c0402['push'](_0x448459[_0x2ca123][_0x7f9b('0x4b')](_0x33c98b[_0x7f9b('0x25')],{'transaction':_0x19251a}));}return BPromise[_0x7f9b('0x3c')](_0x1c0402);});})['then'](function(_0x141bb2){logger[_0x7f9b('0xd')](_0x7f9b('0x49'),_0x33c98b);logger['debug'](_0x7f9b('0x49'),_0x33c98b,JSON[_0x7f9b('0x12')](_0x141bb2));_0x537da5(_0x141bb2);})[_0x7f9b('0x17')](function(_0x5b151b){logger[_0x7f9b('0x14')]('GetContactRecallMe',_0x5b151b[_0x7f9b('0x15')],_0x33c98b);_0x5ba9c2(_0x40b3f4[_0x7f9b('0x14')](0x1f4,_0x5b151b[_0x7f9b('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x177aad){var _0x17a04=this;return new Promise(function(_0x3c6615,_0xfa57e3){db[_0x7f9b('0x2d')]['describe']()[_0x7f9b('0xc')](function(_0x5dd679){return db[_0x7f9b('0x19')][_0x7f9b('0x1a')]({'raw':_0x177aad[_0x7f9b('0x1b')]?_0x177aad[_0x7f9b('0x1b')][_0x7f9b('0x26')]===undefined?!![]:![]:!![],'where':_0x177aad['options']?_0x177aad[_0x7f9b('0x1b')][_0x7f9b('0x1c')]||null:null,'attributes':_0x177aad['options']?_0x177aad[_0x7f9b('0x1b')][_0x7f9b('0x1d')]||null:null,'limit':_0x177aad[_0x7f9b('0x1b')]?_0x177aad[_0x7f9b('0x1b')]['limit']||null:null,'include':_0x177aad['options']?_0x177aad[_0x7f9b('0x1b')][_0x7f9b('0x1f')]?_[_0x7f9b('0x20')](_0x177aad['options'][_0x7f9b('0x1f')],function(_0x201efb){return{'model':db[_0x201efb[_0x7f9b('0x21')]],'as':_0x201efb['as'],'attributes':_0x201efb['as']===_0x7f9b('0x33')?_['keys'](_0x5dd679):_0x201efb[_0x7f9b('0x1d')],'include':_0x201efb[_0x7f9b('0x1f')]?_['map'](_0x201efb[_0x7f9b('0x1f')],function(_0x5ab038){return{'model':db[_0x5ab038[_0x7f9b('0x21')]],'as':_0x5ab038['as'],'attributes':_0x5ab038[_0x7f9b('0x1d')],'include':_0x5ab038[_0x7f9b('0x1f')]?_[_0x7f9b('0x20')](_0x5ab038[_0x7f9b('0x1f')],function(_0x19fd2c){return{'model':db[_0x19fd2c[_0x7f9b('0x21')]],'as':_0x19fd2c['as'],'attributes':_0x19fd2c[_0x7f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7f9b('0xc')](function(_0x10bc04){logger[_0x7f9b('0xd')](_0x7f9b('0x18'),_0x177aad);logger[_0x7f9b('0x10')](_0x7f9b('0x18'),_0x177aad,JSON[_0x7f9b('0x12')](_0x10bc04));_0x3c6615(_0x10bc04);})[_0x7f9b('0x17')](function(_0x2e7d09){logger[_0x7f9b('0x14')](_0x7f9b('0x18'),_0x2e7d09[_0x7f9b('0x15')],_0x177aad);_0xfa57e3(_0x17a04[_0x7f9b('0x14')](0x1f4,_0x2e7d09[_0x7f9b('0x15')]));});});});};exports[_0x7f9b('0x4c')]=function(_0x5b3d7f){var _0x311e1c=this;return new Promise(function(_0x10e70d,_0x4e0bd4){return db[_0x7f9b('0x2d')][_0x7f9b('0x4d')]({'raw':!![],'where':{'phone':_0x5b3d7f[_0x7f9b('0x1b')][_0x7f9b('0x1c')]['phone']},'attributes':['id',_0x7f9b('0x4e')],'order':[['id',_0x7f9b('0x4f')]]})[_0x7f9b('0xc')](function(_0x139ae5){logger[_0x7f9b('0xd')](_0x7f9b('0x50'),_0x5b3d7f);logger['debug'](_0x7f9b('0x50'),_0x5b3d7f,JSON[_0x7f9b('0x12')](_0x139ae5));_0x10e70d(_0x139ae5);})[_0x7f9b('0x17')](function(_0x5b405a){logger[_0x7f9b('0x14')](_0x7f9b('0x50'),_0x5b405a['message'],_0x5b3d7f);_0x4e0bd4(_0x311e1c[_0x7f9b('0x14')](0x1f4,_0x5b405a[_0x7f9b('0x15')]));});});};exports[_0x7f9b('0x51')]=function(_0x7300ad){var _0xfc530a=this;return new Promise(function(_0x4add4e,_0x314b91){return db['sequelize'][_0x7f9b('0x2f')](function(_0x54a20e){return db[_0x7f9b('0x19')]['update']({'active':![]},{'where':{},'transaction':_0x54a20e})[_0x7f9b('0xc')](function(_0x29545d){logger[_0x7f9b('0xd')](_0x7f9b('0x51'),_0x7300ad);logger[_0x7f9b('0x10')]('ResetActiveCalls',_0x7300ad,JSON['stringify'](_0x29545d));_0x4add4e(_0x29545d);})[_0x7f9b('0x17')](function(_0x40b174){logger[_0x7f9b('0x14')]('ResetActiveCalls',_0x40b174[_0x7f9b('0x15')],_0x7300ad);_0x314b91(_0xfc530a['error'](0x1f4,_0x40b174[_0x7f9b('0x15')]));});});});};exports[_0x7f9b('0x52')]=function(_0x36ff9c){var _0x584151=this;var _0xdc4696=_0x36ff9c['body'][_0x7f9b('0x1c')][_0x7f9b('0x53')];var _0x380f90=_0x36ff9c['body'][_0x7f9b('0x1c')][_0x7f9b('0x54')];return new Promise(function(_0x2e819e,_0x532b5c){return db[_0x7f9b('0x19')][_0x7f9b('0x1a')]({'where':{'voiceQueueId':_0xdc4696,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x7f9b('0x44')]['literal'](_0x7f9b('0x55')+_0x380f90+_0x7f9b('0x56'))}},'include':[{'model':db[_0x7f9b('0x2d')],'as':'Contact'},{'model':db[_0x7f9b('0x35')],'as':_0x7f9b('0x36'),'attributes':['id',_0x7f9b('0x37'),_0x7f9b('0x38')]},{'model':db['CmList'],'as':'List'}]})['then'](function(_0x174f6b){return db['sequelize'][_0x7f9b('0x2f')](function(_0x3a9092){return db[_0x7f9b('0x19')][_0x7f9b('0x4b')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0xdc4696,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x7f9b('0x44')][_0x7f9b('0x45')](_0x7f9b('0x55')+_0x380f90+'\x20MINUTE')}},'transaction':_0x3a9092})[_0x7f9b('0xc')](function(_0x136e5e){_0x2e819e(_0x174f6b);})['catch'](function(_0x4732b5){logger[_0x7f9b('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x4732b5['message'],_0x36ff9c);_0x532b5c(validateExpressRequest);});});})['catch'](function(_0x164d13){logger[_0x7f9b('0x14')](_0x7f9b('0x52'),_0x164d13[_0x7f9b('0x15')],_0x36ff9c);_0x532b5c(_0x584151[_0x7f9b('0x14')](0x1f4,_0x164d13[_0x7f9b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5f59288..f0232e6 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 _0xfd7f=['getPreviewRecall','delete','destroy','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','/timezones','getTimezones','/:id','show','post','create','/preview','getPreview','/timezone','getTimezone','/previewrecall'];(function(_0x34947a,_0x38832c){var _0x29482a=function(_0x643427){while(--_0x643427){_0x34947a['push'](_0x34947a['shift']());}};_0x29482a(++_0x38832c);}(_0xfd7f,0xba));var _0xffd7=function(_0x540fad,_0x5874e5){_0x540fad=_0x540fad-0x0;var _0x8508a2=_0xfd7f[_0x540fad];return _0x8508a2;};'use strict';var multer=require('multer');var util=require(_0xffd7('0x0'));var path=require(_0xffd7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xffd7('0x2'));var interaction=require(_0xffd7('0x3'));var config=require(_0xffd7('0x4'));var controller=require(_0xffd7('0x5'));router[_0xffd7('0x6')]('/',auth[_0xffd7('0x7')](),controller[_0xffd7('0x8')]);router[_0xffd7('0x6')](_0xffd7('0x9'),auth[_0xffd7('0x7')](),controller['describe']);router[_0xffd7('0x6')](_0xffd7('0xa'),auth[_0xffd7('0x7')](),controller['getOpenContacts']);router[_0xffd7('0x6')](_0xffd7('0xb'),auth['isAuthenticated'](),controller[_0xffd7('0xc')]);router[_0xffd7('0x6')](_0xffd7('0xd'),auth[_0xffd7('0x7')](),controller[_0xffd7('0xe')]);router[_0xffd7('0xf')]('/',auth[_0xffd7('0x7')](),controller[_0xffd7('0x10')]);router['post'](_0xffd7('0x11'),auth['isAuthenticated'](),controller[_0xffd7('0x12')]);router['post'](_0xffd7('0x13'),auth[_0xffd7('0x7')](),controller[_0xffd7('0x14')]);router['post'](_0xffd7('0x15'),auth['isAuthenticated'](),controller[_0xffd7('0x16')]);router['put'](_0xffd7('0xd'),auth[_0xffd7('0x7')](),controller['update']);router[_0xffd7('0x17')](_0xffd7('0xd'),auth['isAuthenticated'](),controller[_0xffd7('0x18')]);module[_0xffd7('0x19')]=router; \ No newline at end of file +var _0x1d20=['put','update','delete','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','get','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','post','/preview','getPreview','getTimezone','/previewrecall','getPreviewRecall'];(function(_0x1521be,_0x34aa83){var _0x156a8e=function(_0x1b803c){while(--_0x1b803c){_0x1521be['push'](_0x1521be['shift']());}};_0x156a8e(++_0x34aa83);}(_0x1d20,0x121));var _0x01d2=function(_0x539802,_0x226adb){_0x539802=_0x539802-0x0;var _0x5df489=_0x1d20[_0x539802];return _0x5df489;};'use strict';var multer=require(_0x01d2('0x0'));var util=require(_0x01d2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x01d2('0x2'));var router=express['Router']();var fs_extra=require(_0x01d2('0x3'));var auth=require(_0x01d2('0x4'));var interaction=require(_0x01d2('0x5'));var config=require(_0x01d2('0x6'));var controller=require(_0x01d2('0x7'));router['get']('/',auth[_0x01d2('0x8')](),controller['index']);router[_0x01d2('0x9')](_0x01d2('0xa'),auth[_0x01d2('0x8')](),controller[_0x01d2('0xb')]);router[_0x01d2('0x9')](_0x01d2('0xc'),auth[_0x01d2('0x8')](),controller[_0x01d2('0xd')]);router['get']('/timezones',auth[_0x01d2('0x8')](),controller[_0x01d2('0xe')]);router[_0x01d2('0x9')](_0x01d2('0xf'),auth[_0x01d2('0x8')](),controller[_0x01d2('0x10')]);router[_0x01d2('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x01d2('0x11')](_0x01d2('0x12'),auth['isAuthenticated'](),controller[_0x01d2('0x13')]);router[_0x01d2('0x11')]('/timezone',auth[_0x01d2('0x8')](),controller[_0x01d2('0x14')]);router['post'](_0x01d2('0x15'),auth[_0x01d2('0x8')](),controller[_0x01d2('0x16')]);router[_0x01d2('0x17')](_0x01d2('0xf'),auth[_0x01d2('0x8')](),controller[_0x01d2('0x18')]);router[_0x01d2('0x19')](_0x01d2('0xf'),auth[_0x01d2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b72b800..9302ecd 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 _0x4e3e=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x4e3e,0x139));var _0xe4e3=function(_0x1a268f,_0x2f4759){_0x1a268f=_0x1a268f-0x0;var _0x63fe77=_0x4e3e[_0x1a268f];return _0x63fe77;};'use strict';var moment=require(_0xe4e3('0x0'));var Sequelize=require('sequelize');module[_0xe4e3('0x1')]={'phone':{'type':Sequelize[_0xe4e3('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe4e3('0x3')],'unique':_0xe4e3('0x4')},'ListId':{'type':Sequelize[_0xe4e3('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xe4e3('0x3')],'unique':_0xe4e3('0x4')}}; \ No newline at end of file +var _0xfa23=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x891b81,_0xfbb107){var _0x585932=function(_0x18e04d){while(--_0x18e04d){_0x891b81['push'](_0x891b81['shift']());}};_0x585932(++_0xfbb107);}(_0xfa23,0x1d5));var _0x3fa2=function(_0x21235e,_0x3b40e3){_0x21235e=_0x21235e-0x0;var _0x479e51=_0xfa23[_0x21235e];return _0x479e51;};'use strict';var moment=require(_0x3fa2('0x0'));var Sequelize=require('sequelize');module[_0x3fa2('0x1')]={'phone':{'type':Sequelize[_0x3fa2('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3fa2('0x3')],'unique':_0x3fa2('0x4')},'ListId':{'type':Sequelize[_0x3fa2('0x3')],'unique':_0x3fa2('0x4')},'VoiceQueueId':{'type':Sequelize[_0x3fa2('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ff69137..0e2a9a0 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 _0x27ee=['include','findAll','rows','catch','show','params','keys','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll'];(function(_0x190a66,_0x335028){var _0x7e237a=function(_0x4ea6bb){while(--_0x4ea6bb){_0x190a66['push'](_0x190a66['shift']());}};_0x7e237a(++_0x335028);}(_0x27ee,0x195));var _0xe27e=function(_0x13bd33,_0x50aa70){_0x13bd33=_0x13bd33-0x0;var _0x5a12ac=_0x27ee[_0x13bd33];return _0x5a12ac;};'use strict';var emlformat=require(_0xe27e('0x0'));var rimraf=require(_0xe27e('0x1'));var zipdir=require(_0xe27e('0x2'));var jsonpatch=require(_0xe27e('0x3'));var rp=require(_0xe27e('0x4'));var moment=require(_0xe27e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe27e('0x6'));var util=require(_0xe27e('0x7'));var path=require('path');var sox=require(_0xe27e('0x8'));var csv=require(_0xe27e('0x9'));var ejs=require(_0xe27e('0xa'));var fs=require('fs');var fs_extra=require(_0xe27e('0xb'));var _=require(_0xe27e('0xc'));var squel=require('squel');var crypto=require(_0xe27e('0xd'));var jsforce=require(_0xe27e('0xe'));var deskjs=require(_0xe27e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe27e('0x10'));var Papa=require(_0xe27e('0x11'));var Redis=require(_0xe27e('0x12'));var authService=require(_0xe27e('0x13'));var qs=require(_0xe27e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe27e('0x15'))(_0xe27e('0x16'));var utils=require(_0xe27e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe27e('0x18'));var db=require(_0xe27e('0x19'))['db'];function respondWithStatusCode(_0x33761b,_0xf869a3){_0xf869a3=_0xf869a3||0xcc;return function(_0x3bbef7){if(_0x3bbef7){return _0x33761b[_0xe27e('0x1a')](_0xf869a3);}return _0x33761b[_0xe27e('0x1b')](_0xf869a3)[_0xe27e('0x1c')]();};}function respondWithResult(_0x42aba4,_0x1b900c){_0x1b900c=_0x1b900c||0xc8;return function(_0x56f35c){if(_0x56f35c){return _0x42aba4[_0xe27e('0x1b')](_0x1b900c)['json'](_0x56f35c);}};}function respondWithFilteredResult(_0x594ba1,_0x22ab7b){return function(_0x185110){if(_0x185110){var _0x4662bd=typeof _0x22ab7b['offset']===_0xe27e('0x1d')&&typeof _0x22ab7b[_0xe27e('0x1e')]==='undefined';var _0x562862=_0x185110['count'];var _0x12c88b=_0x4662bd?0x0:_0x22ab7b[_0xe27e('0x1f')];var _0x75a3e6=_0x4662bd?_0x185110[_0xe27e('0x20')]:_0x22ab7b[_0xe27e('0x1f')]+_0x22ab7b[_0xe27e('0x1e')];var _0x45aee2;if(_0x75a3e6>=_0x562862){_0x75a3e6=_0x562862;_0x45aee2=0xc8;}else{_0x45aee2=0xce;}_0x594ba1[_0xe27e('0x1b')](_0x45aee2);return _0x594ba1[_0xe27e('0x21')](_0xe27e('0x22'),_0x12c88b+'-'+_0x75a3e6+'/'+_0x562862)[_0xe27e('0x23')](_0x185110);}return null;};}function patchUpdates(_0x326ecb){return function(_0x26acf0){try{jsonpatch['apply'](_0x26acf0,_0x326ecb,!![]);}catch(_0x3212ad){return BPromise[_0xe27e('0x24')](_0x3212ad);}return _0x26acf0[_0xe27e('0x25')]();};}function saveUpdates(_0x58b60b,_0x4c491e){return function(_0x315ed3){if(_0x315ed3){return _0x315ed3[_0xe27e('0x26')](_0x58b60b)[_0xe27e('0x27')](function(_0x2d9196){return _0x2d9196;});}return null;};}function removeEntity(_0x1ab7cb,_0x3085ab){return function(_0x380599){if(_0x380599){return _0x380599[_0xe27e('0x28')]()['then'](function(){_0x1ab7cb[_0xe27e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c6d3,_0x2fa9ce){return function(_0x393858){if(!_0x393858){_0x37c6d3[_0xe27e('0x1a')](0x194);}return _0x393858;};}function handleError(_0x2d0441,_0x107abc){_0x107abc=_0x107abc||0x1f4;return function(_0x5c6ee8){logger[_0xe27e('0x29')](_0x5c6ee8[_0xe27e('0x2a')]);if(_0x5c6ee8[_0xe27e('0x2b')]){delete _0x5c6ee8[_0xe27e('0x2b')];}_0x2d0441[_0xe27e('0x1b')](_0x107abc)['send'](_0x5c6ee8);};}exports[_0xe27e('0x2c')]=function(_0x4162fa,_0x5ce98d){var _0x6d910e={},_0xcd13bb={},_0xe2684f={'count':0x0,'rows':[]};var _0x5b3056=_['map'](db[_0xe27e('0x2d')][_0xe27e('0x2e')],function(_0x2b25fc){return{'name':_0x2b25fc[_0xe27e('0x2f')],'type':_0x2b25fc[_0xe27e('0x30')][_0xe27e('0x31')]};});_0xcd13bb[_0xe27e('0x32')]=_[_0xe27e('0x33')](_0x5b3056,'name');_0xcd13bb[_0xe27e('0x34')]=_['keys'](_0x4162fa['query']);_0xcd13bb[_0xe27e('0x35')]=_[_0xe27e('0x36')](_0xcd13bb[_0xe27e('0x32')],_0xcd13bb[_0xe27e('0x34')]);_0x6d910e[_0xe27e('0x37')]=_[_0xe27e('0x36')](_0xcd13bb[_0xe27e('0x32')],qs['fields'](_0x4162fa[_0xe27e('0x34')][_0xe27e('0x38')]));_0x6d910e[_0xe27e('0x37')]=_0x6d910e[_0xe27e('0x37')][_0xe27e('0x39')]?_0x6d910e['attributes']:_0xcd13bb[_0xe27e('0x32')];if(!_0x4162fa[_0xe27e('0x34')][_0xe27e('0x3a')](_0xe27e('0x3b'))){_0x6d910e[_0xe27e('0x1e')]=qs[_0xe27e('0x1e')](_0x4162fa[_0xe27e('0x34')][_0xe27e('0x1e')]);_0x6d910e[_0xe27e('0x1f')]=qs['offset'](_0x4162fa['query']['offset']);}_0x6d910e[_0xe27e('0x3c')]=qs[_0xe27e('0x3d')](_0x4162fa[_0xe27e('0x34')][_0xe27e('0x3d')]);_0x6d910e['where']=qs['filters'](_[_0xe27e('0x3e')](_0x4162fa[_0xe27e('0x34')],_0xcd13bb[_0xe27e('0x35')]),_0x5b3056);if(_0x4162fa['query'][_0xe27e('0x3f')]){_0x6d910e['where']=_[_0xe27e('0x40')](_0x6d910e['where'],{'$or':_[_0xe27e('0x33')](_0x5b3056,function(_0x4374b6){if(_0x4374b6['type']!==_0xe27e('0x41')){var _0x2a4848={};_0x2a4848[_0x4374b6[_0xe27e('0x2b')]]={'$like':'%'+_0x4162fa[_0xe27e('0x34')][_0xe27e('0x3f')]+'%'};return _0x2a4848;}})});}_0x6d910e=_[_0xe27e('0x40')]({},_0x6d910e,_0x4162fa[_0xe27e('0x42')]);var _0x3847c9={'where':_0x6d910e[_0xe27e('0x43')]};return db[_0xe27e('0x2d')][_0xe27e('0x20')](_0x3847c9)[_0xe27e('0x27')](function(_0x295fa7){_0xe2684f[_0xe27e('0x20')]=_0x295fa7;if(_0x4162fa['query'][_0xe27e('0x44')]){_0x6d910e[_0xe27e('0x45')]=[{'all':!![]}];}return db[_0xe27e('0x2d')][_0xe27e('0x46')](_0x6d910e);})[_0xe27e('0x27')](function(_0x3d1098){_0xe2684f[_0xe27e('0x47')]=_0x3d1098;return _0xe2684f;})['then'](respondWithFilteredResult(_0x5ce98d,_0x6d910e))[_0xe27e('0x48')](handleError(_0x5ce98d,null));};exports[_0xe27e('0x49')]=function(_0x5ef7bc,_0x24333b){var _0x207675={'raw':!![],'where':{'id':_0x5ef7bc[_0xe27e('0x4a')]['id']}},_0x241720={};_0x241720[_0xe27e('0x32')]=_['keys'](db[_0xe27e('0x2d')][_0xe27e('0x2e')]);_0x241720[_0xe27e('0x34')]=_[_0xe27e('0x4b')](_0x5ef7bc[_0xe27e('0x34')]);_0x241720[_0xe27e('0x35')]=_[_0xe27e('0x36')](_0x241720['model'],_0x241720[_0xe27e('0x34')]);_0x207675['attributes']=_['intersection'](_0x241720[_0xe27e('0x32')],qs[_0xe27e('0x38')](_0x5ef7bc[_0xe27e('0x34')][_0xe27e('0x38')]));_0x207675[_0xe27e('0x37')]=_0x207675[_0xe27e('0x37')][_0xe27e('0x39')]?_0x207675['attributes']:_0x241720['model'];if(_0x5ef7bc[_0xe27e('0x34')][_0xe27e('0x44')]){_0x207675[_0xe27e('0x45')]=[{'all':!![]}];}_0x207675=_[_0xe27e('0x40')]({},_0x207675,_0x5ef7bc['options']);return db[_0xe27e('0x2d')]['find'](_0x207675)[_0xe27e('0x27')](handleEntityNotFound(_0x24333b,null))[_0xe27e('0x27')](respondWithResult(_0x24333b,null))[_0xe27e('0x48')](handleError(_0x24333b,null));};exports[_0xe27e('0x26')]=function(_0xee13f6,_0x53e61a){if(_0xee13f6[_0xe27e('0x4c')]['id']){delete _0xee13f6[_0xe27e('0x4c')]['id'];}return db[_0xe27e('0x2d')]['find']({'where':{'id':_0xee13f6[_0xe27e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53e61a,null))[_0xe27e('0x27')](saveUpdates(_0xee13f6[_0xe27e('0x4c')],null))[_0xe27e('0x27')](respondWithResult(_0x53e61a,null))[_0xe27e('0x48')](handleError(_0x53e61a,null));};exports[_0xe27e('0x28')]=function(_0x46b236,_0x196ee2){return db[_0xe27e('0x2d')][_0xe27e('0x4d')]({'where':{'id':_0x46b236[_0xe27e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x196ee2,null))[_0xe27e('0x27')](removeEntity(_0x196ee2,null))['catch'](handleError(_0x196ee2,null));};exports[_0xe27e('0x4e')]=function(_0xdf9b59,_0x2b0e9e){return db[_0xe27e('0x2d')][_0xe27e('0x4e')]()['then'](respondWithResult(_0x2b0e9e,null))[_0xe27e('0x48')](handleError(_0x2b0e9e,null));}; \ No newline at end of file +var _0xbcff=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','then','destroy','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','rows','params','keys','find','catch','update','body','describe','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x2f8ba1,_0x4469b7){var _0xe6ab30=function(_0x229f11){while(--_0x229f11){_0x2f8ba1['push'](_0x2f8ba1['shift']());}};_0xe6ab30(++_0x4469b7);}(_0xbcff,0xbb));var _0xfbcf=function(_0xed8517,_0x264ec0){_0xed8517=_0xed8517-0x0;var _0x34d5f3=_0xbcff[_0xed8517];return _0x34d5f3;};'use strict';var emlformat=require(_0xfbcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbcf('0x2'));var moment=require(_0xfbcf('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfbcf('0x4'));var path=require(_0xfbcf('0x5'));var sox=require('sox');var csv=require(_0xfbcf('0x6'));var ejs=require(_0xfbcf('0x7'));var fs=require('fs');var fs_extra=require(_0xfbcf('0x8'));var _=require(_0xfbcf('0x9'));var squel=require(_0xfbcf('0xa'));var crypto=require(_0xfbcf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfbcf('0xc'));var toCsv=require(_0xfbcf('0x6'));var querystring=require(_0xfbcf('0xd'));var Papa=require('papaparse');var Redis=require(_0xfbcf('0xe'));var authService=require(_0xfbcf('0xf'));var qs=require(_0xfbcf('0x10'));var as=require(_0xfbcf('0x11'));var hardwareService=require(_0xfbcf('0x12'));var logger=require(_0xfbcf('0x13'))(_0xfbcf('0x14'));var utils=require('../../config/utils');var config=require(_0xfbcf('0x15'));var licenseUtil=require(_0xfbcf('0x16'));var db=require(_0xfbcf('0x17'))['db'];function respondWithStatusCode(_0x3d1619,_0x94e221){_0x94e221=_0x94e221||0xcc;return function(_0x18c4a4){if(_0x18c4a4){return _0x3d1619[_0xfbcf('0x18')](_0x94e221);}return _0x3d1619[_0xfbcf('0x19')](_0x94e221)[_0xfbcf('0x1a')]();};}function respondWithResult(_0x5b7993,_0x8e23a9){_0x8e23a9=_0x8e23a9||0xc8;return function(_0x3c79b0){if(_0x3c79b0){return _0x5b7993['status'](_0x8e23a9)['json'](_0x3c79b0);}};}function respondWithFilteredResult(_0x5bcfec,_0x2176d7){return function(_0x19bd39){if(_0x19bd39){var _0x3257e6=typeof _0x2176d7[_0xfbcf('0x1b')]===_0xfbcf('0x1c')&&typeof _0x2176d7[_0xfbcf('0x1d')]===_0xfbcf('0x1c');var _0x73473c=_0x19bd39[_0xfbcf('0x1e')];var _0x247fbc=_0x3257e6?0x0:_0x2176d7[_0xfbcf('0x1b')];var _0x280a3f=_0x3257e6?_0x19bd39[_0xfbcf('0x1e')]:_0x2176d7['offset']+_0x2176d7[_0xfbcf('0x1d')];var _0x4ae505;if(_0x280a3f>=_0x73473c){_0x280a3f=_0x73473c;_0x4ae505=0xc8;}else{_0x4ae505=0xce;}_0x5bcfec['status'](_0x4ae505);return _0x5bcfec['set']('Content-Range',_0x247fbc+'-'+_0x280a3f+'/'+_0x73473c)[_0xfbcf('0x1f')](_0x19bd39);}return null;};}function patchUpdates(_0x5b1919){return function(_0x41946a){try{jsonpatch[_0xfbcf('0x20')](_0x41946a,_0x5b1919,!![]);}catch(_0x5cb2c6){return BPromise[_0xfbcf('0x21')](_0x5cb2c6);}return _0x41946a[_0xfbcf('0x22')]();};}function saveUpdates(_0x4d3820,_0x46c7fe){return function(_0x5be3da){if(_0x5be3da){return _0x5be3da['update'](_0x4d3820)[_0xfbcf('0x23')](function(_0x404001){return _0x404001;});}return null;};}function removeEntity(_0x57d24a,_0x1a8dbb){return function(_0x86d7e0){if(_0x86d7e0){return _0x86d7e0[_0xfbcf('0x24')]()[_0xfbcf('0x23')](function(){_0x57d24a[_0xfbcf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484ab5,_0x2abdde){return function(_0x4361fa){if(!_0x4361fa){_0x484ab5[_0xfbcf('0x18')](0x194);}return _0x4361fa;};}function handleError(_0x4edab3,_0x20e56e){_0x20e56e=_0x20e56e||0x1f4;return function(_0x281b38){logger['error'](_0x281b38['stack']);if(_0x281b38['name']){delete _0x281b38['name'];}_0x4edab3[_0xfbcf('0x19')](_0x20e56e)[_0xfbcf('0x25')](_0x281b38);};}exports[_0xfbcf('0x26')]=function(_0x3a8573,_0x2ac7ac){var _0x4e62b7={},_0x53d815={},_0xf29c9f={'count':0x0,'rows':[]};var _0x4f008d=_[_0xfbcf('0x27')](db[_0xfbcf('0x28')][_0xfbcf('0x29')],function(_0x48816e){return{'name':_0x48816e[_0xfbcf('0x2a')],'type':_0x48816e[_0xfbcf('0x2b')][_0xfbcf('0x2c')]};});_0x53d815[_0xfbcf('0x2d')]=_[_0xfbcf('0x27')](_0x4f008d,'name');_0x53d815[_0xfbcf('0x2e')]=_['keys'](_0x3a8573[_0xfbcf('0x2e')]);_0x53d815[_0xfbcf('0x2f')]=_['intersection'](_0x53d815[_0xfbcf('0x2d')],_0x53d815[_0xfbcf('0x2e')]);_0x4e62b7[_0xfbcf('0x30')]=_[_0xfbcf('0x31')](_0x53d815[_0xfbcf('0x2d')],qs[_0xfbcf('0x32')](_0x3a8573['query'][_0xfbcf('0x32')]));_0x4e62b7[_0xfbcf('0x30')]=_0x4e62b7['attributes'][_0xfbcf('0x33')]?_0x4e62b7[_0xfbcf('0x30')]:_0x53d815[_0xfbcf('0x2d')];if(!_0x3a8573[_0xfbcf('0x2e')]['hasOwnProperty']('nolimit')){_0x4e62b7[_0xfbcf('0x1d')]=qs[_0xfbcf('0x1d')](_0x3a8573[_0xfbcf('0x2e')][_0xfbcf('0x1d')]);_0x4e62b7['offset']=qs['offset'](_0x3a8573[_0xfbcf('0x2e')]['offset']);}_0x4e62b7[_0xfbcf('0x34')]=qs['sort'](_0x3a8573[_0xfbcf('0x2e')]['sort']);_0x4e62b7[_0xfbcf('0x35')]=qs[_0xfbcf('0x2f')](_[_0xfbcf('0x36')](_0x3a8573['query'],_0x53d815[_0xfbcf('0x2f')]),_0x4f008d);if(_0x3a8573['query'][_0xfbcf('0x37')]){_0x4e62b7[_0xfbcf('0x35')]=_[_0xfbcf('0x38')](_0x4e62b7[_0xfbcf('0x35')],{'$or':_[_0xfbcf('0x27')](_0x4f008d,function(_0x50ddd5){if(_0x50ddd5[_0xfbcf('0x2b')]!==_0xfbcf('0x39')){var _0x275eec={};_0x275eec[_0x50ddd5[_0xfbcf('0x3a')]]={'$like':'%'+_0x3a8573[_0xfbcf('0x2e')][_0xfbcf('0x37')]+'%'};return _0x275eec;}})});}_0x4e62b7=_[_0xfbcf('0x38')]({},_0x4e62b7,_0x3a8573[_0xfbcf('0x3b')]);var _0x5e63f0={'where':_0x4e62b7[_0xfbcf('0x35')]};return db[_0xfbcf('0x28')]['count'](_0x5e63f0)[_0xfbcf('0x23')](function(_0x40a1a3){_0xf29c9f[_0xfbcf('0x1e')]=_0x40a1a3;if(_0x3a8573[_0xfbcf('0x2e')][_0xfbcf('0x3c')]){_0x4e62b7[_0xfbcf('0x3d')]=[{'all':!![]}];}return db[_0xfbcf('0x28')]['findAll'](_0x4e62b7);})[_0xfbcf('0x23')](function(_0x2ab74c){_0xf29c9f[_0xfbcf('0x3e')]=_0x2ab74c;return _0xf29c9f;})[_0xfbcf('0x23')](respondWithFilteredResult(_0x2ac7ac,_0x4e62b7))['catch'](handleError(_0x2ac7ac,null));};exports['show']=function(_0x518f48,_0x27670e){var _0x472fef={'raw':!![],'where':{'id':_0x518f48[_0xfbcf('0x3f')]['id']}},_0x565f84={};_0x565f84[_0xfbcf('0x2d')]=_['keys'](db['CmHopperBlack'][_0xfbcf('0x29')]);_0x565f84[_0xfbcf('0x2e')]=_[_0xfbcf('0x40')](_0x518f48[_0xfbcf('0x2e')]);_0x565f84['filters']=_[_0xfbcf('0x31')](_0x565f84[_0xfbcf('0x2d')],_0x565f84[_0xfbcf('0x2e')]);_0x472fef[_0xfbcf('0x30')]=_[_0xfbcf('0x31')](_0x565f84[_0xfbcf('0x2d')],qs[_0xfbcf('0x32')](_0x518f48[_0xfbcf('0x2e')]['fields']));_0x472fef[_0xfbcf('0x30')]=_0x472fef['attributes'][_0xfbcf('0x33')]?_0x472fef[_0xfbcf('0x30')]:_0x565f84[_0xfbcf('0x2d')];if(_0x518f48[_0xfbcf('0x2e')][_0xfbcf('0x3c')]){_0x472fef[_0xfbcf('0x3d')]=[{'all':!![]}];}_0x472fef=_['merge']({},_0x472fef,_0x518f48[_0xfbcf('0x3b')]);return db[_0xfbcf('0x28')][_0xfbcf('0x41')](_0x472fef)['then'](handleEntityNotFound(_0x27670e,null))['then'](respondWithResult(_0x27670e,null))[_0xfbcf('0x42')](handleError(_0x27670e,null));};exports[_0xfbcf('0x43')]=function(_0x3a324c,_0x26bca6){if(_0x3a324c[_0xfbcf('0x44')]['id']){delete _0x3a324c['body']['id'];}return db[_0xfbcf('0x28')][_0xfbcf('0x41')]({'where':{'id':_0x3a324c[_0xfbcf('0x3f')]['id']}})[_0xfbcf('0x23')](handleEntityNotFound(_0x26bca6,null))[_0xfbcf('0x23')](saveUpdates(_0x3a324c['body'],null))[_0xfbcf('0x23')](respondWithResult(_0x26bca6,null))[_0xfbcf('0x42')](handleError(_0x26bca6,null));};exports[_0xfbcf('0x24')]=function(_0x4a454c,_0x6e7845){return db['CmHopperBlack']['find']({'where':{'id':_0x4a454c['params']['id']}})[_0xfbcf('0x23')](handleEntityNotFound(_0x6e7845,null))[_0xfbcf('0x23')](removeEntity(_0x6e7845,null))[_0xfbcf('0x42')](handleError(_0x6e7845,null));};exports[_0xfbcf('0x45')]=function(_0x519aac,_0x303549){return db[_0xfbcf('0x28')]['describe']()[_0xfbcf('0x23')](respondWithResult(_0x303549,null))[_0xfbcf('0x42')](handleError(_0x303549,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1be5f1d..eab642d 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 _0x9d08=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util'];(function(_0x256f55,_0x5c70b2){var _0xf8026f=function(_0x55c15c){while(--_0x55c15c){_0x256f55['push'](_0x256f55['shift']());}};_0xf8026f(++_0x5c70b2);}(_0x9d08,0x173));var _0x89d0=function(_0x287c03,_0xc80092){_0x287c03=_0x287c03-0x0;var _0x2cd3e0=_0x9d08[_0x287c03];return _0x2cd3e0;};'use strict';var _=require('lodash');var util=require(_0x89d0('0x0'));var logger=require(_0x89d0('0x1'))('api');var moment=require(_0x89d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x89d0('0x3'));var fs=require('fs');var path=require(_0x89d0('0x4'));var rimraf=require(_0x89d0('0x5'));var config=require(_0x89d0('0x6'));var attributes=require(_0x89d0('0x7'));module[_0x89d0('0x8')]=function(_0x475d6c,_0x37c943){return _0x475d6c[_0x89d0('0x9')](_0x89d0('0xa'),attributes,{'tableName':_0x89d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe47e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xe47e,0x1a0));var _0xee47=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0xe47e[_0x29632e];return _0x426e04;};'use strict';var _=require('lodash');var util=require(_0xee47('0x0'));var logger=require(_0xee47('0x1'))(_0xee47('0x2'));var moment=require(_0xee47('0x3'));var BPromise=require(_0xee47('0x4'));var rp=require(_0xee47('0x5'));var fs=require('fs');var path=require(_0xee47('0x6'));var rimraf=require(_0xee47('0x7'));var config=require('../../config/environment');var attributes=require(_0xee47('0x8'));module[_0xee47('0x9')]=function(_0x1554c0,_0x49a95d){return _0x1554c0[_0xee47('0xa')](_0xee47('0xb'),attributes,{'tableName':_0xee47('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 8623ad0..1c321e5 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 _0xe312=['debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','options','where','include','map','attributes','then','catch','update','body','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0xca67f4,_0x415463){var _0x5386d0=function(_0x4ff731){while(--_0x4ff731){_0xca67f4['push'](_0xca67f4['shift']());}};_0x5386d0(++_0x415463);}(_0xe312,0x16c));var _0x2e31=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xe312[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x2e31('0x0'));var util=require('util');var moment=require(_0x2e31('0x1'));var BPromise=require(_0x2e31('0x2'));var rs=require(_0x2e31('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e31('0x4'))['db'];var utils=require(_0x2e31('0x5'));var logger=require(_0x2e31('0x6'))(_0x2e31('0x7'));var config=require(_0x2e31('0x8'));var jayson=require(_0x2e31('0x9'));var client=jayson[_0x2e31('0xa')][_0x2e31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2350de,_0x428135,_0x969c47){return new BPromise(function(_0x42c59f,_0x21ad3f){return client[_0x2e31('0xc')](_0x2350de,_0x969c47)['then'](function(_0x14531f){logger[_0x2e31('0xd')](_0x2e31('0xe'),_0x428135,_0x2e31('0xf'));logger[_0x2e31('0x10')](_0x2e31('0x11'),_0x428135,'request\x20sent',JSON[_0x2e31('0x12')](_0x14531f));if(_0x14531f['error']){if(_0x14531f[_0x2e31('0x13')][_0x2e31('0x14')]===0x1f4){logger['error'](_0x2e31('0xe'),_0x428135,_0x14531f[_0x2e31('0x13')][_0x2e31('0x15')]);return _0x21ad3f(_0x14531f['error'][_0x2e31('0x15')]);}logger[_0x2e31('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x428135,_0x14531f[_0x2e31('0x13')][_0x2e31('0x15')]);return _0x42c59f(_0x14531f[_0x2e31('0x13')][_0x2e31('0x15')]);}else{logger[_0x2e31('0xd')](_0x2e31('0xe'),_0x428135,_0x2e31('0xf'));_0x42c59f(_0x14531f[_0x2e31('0x16')]['message']);}})['catch'](function(_0x511ca1){logger[_0x2e31('0x13')](_0x2e31('0xe'),_0x428135,_0x511ca1);_0x21ad3f(_0x511ca1);});});}exports[_0x2e31('0x17')]=function(_0x57450c){var _0x1b1e72=this;return new Promise(function(_0x590a7d,_0x827d0f){return db[_0x2e31('0x18')]['findAll']({'raw':_0x57450c['options']?_0x57450c[_0x2e31('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x57450c[_0x2e31('0x19')]?_0x57450c['options'][_0x2e31('0x1a')]||null:null,'attributes':_0x57450c[_0x2e31('0x19')]?_0x57450c[_0x2e31('0x19')]['attributes']||null:null,'limit':_0x57450c[_0x2e31('0x19')]?_0x57450c[_0x2e31('0x19')]['limit']||null:null,'include':_0x57450c[_0x2e31('0x19')]?_0x57450c[_0x2e31('0x19')][_0x2e31('0x1b')]?_[_0x2e31('0x1c')](_0x57450c['options']['include'],function(_0x5c1290){return{'model':db[_0x5c1290['model']],'as':_0x5c1290['as'],'attributes':_0x5c1290[_0x2e31('0x1d')],'include':_0x5c1290[_0x2e31('0x1b')]?_[_0x2e31('0x1c')](_0x5c1290['include'],function(_0x220a34){return{'model':db[_0x220a34['model']],'as':_0x220a34['as'],'attributes':_0x220a34[_0x2e31('0x1d')],'include':_0x220a34[_0x2e31('0x1b')]?_[_0x2e31('0x1c')](_0x220a34[_0x2e31('0x1b')],function(_0x545e66){return{'model':db[_0x545e66['model']],'as':_0x545e66['as'],'attributes':_0x545e66['attributes']};}):[]};}):[]};}):[]:[]})[_0x2e31('0x1e')](function(_0x4f1d6f){logger[_0x2e31('0xd')](_0x2e31('0x17'),_0x57450c);logger[_0x2e31('0x10')](_0x2e31('0x17'),_0x57450c,JSON['stringify'](_0x4f1d6f));_0x590a7d(_0x4f1d6f);})[_0x2e31('0x1f')](function(_0x528327){logger['error'](_0x2e31('0x17'),_0x528327[_0x2e31('0x15')],_0x57450c);_0x827d0f(_0x1b1e72['error'](0x1f4,_0x528327[_0x2e31('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x3fff77){var _0x2af3ce=this;return new Promise(function(_0x542115,_0x403c13){return db[_0x2e31('0x18')][_0x2e31('0x20')](_0x3fff77[_0x2e31('0x21')],{'raw':_0x3fff77[_0x2e31('0x19')]?_0x3fff77[_0x2e31('0x19')][_0x2e31('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff77[_0x2e31('0x19')]?_0x3fff77[_0x2e31('0x19')][_0x2e31('0x1a')]||null:null,'attributes':_0x3fff77[_0x2e31('0x19')]?_0x3fff77[_0x2e31('0x19')][_0x2e31('0x1d')]||null:null,'limit':_0x3fff77[_0x2e31('0x19')]?_0x3fff77[_0x2e31('0x19')]['limit']||null:null})[_0x2e31('0x1e')](function(_0x28c59e){logger[_0x2e31('0xd')](_0x2e31('0x23'),_0x3fff77);logger[_0x2e31('0x10')]('UpdateCmHopperBlack',_0x3fff77,JSON[_0x2e31('0x12')](_0x28c59e));_0x542115(_0x28c59e);})[_0x2e31('0x1f')](function(_0x16a9b5){logger[_0x2e31('0x13')](_0x2e31('0x23'),_0x16a9b5['message'],_0x3fff77);_0x403c13(_0x2af3ce[_0x2e31('0x13')](0x1f4,_0x16a9b5['message']));});});};exports[_0x2e31('0x24')]=function(_0x378005){var _0x22fce6=this;return new Promise(function(_0x778f9d,_0x51e8b5){return db[_0x2e31('0x18')][_0x2e31('0x25')]({'where':_0x378005[_0x2e31('0x19')]?_0x378005[_0x2e31('0x19')][_0x2e31('0x1a')]||null:null})[_0x2e31('0x1e')](function(_0x3cbf8b){logger[_0x2e31('0xd')](_0x2e31('0x24'),_0x378005);logger[_0x2e31('0x10')]('DestroyCmHopperBlack',_0x378005,JSON[_0x2e31('0x12')](_0x3cbf8b));_0x778f9d(_0x3cbf8b);})[_0x2e31('0x1f')](function(_0x1e19f5){logger[_0x2e31('0x13')](_0x2e31('0x24'),_0x1e19f5['message'],_0x378005);_0x51e8b5(_0x22fce6[_0x2e31('0x13')](0x1f4,_0x1e19f5[_0x2e31('0x15')]));});});}; \ No newline at end of file +var _0x4b76=['client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','include','map','model','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f993a,_0x3a7c86){var _0x4c68f1=function(_0x5df789){while(--_0x5df789){_0x2f993a['push'](_0x2f993a['shift']());}};_0x4c68f1(++_0x3a7c86);}(_0x4b76,0x116));var _0x64b7=function(_0x4a0bac,_0xca6586){_0x4a0bac=_0x4a0bac-0x0;var _0x390517=_0x4b76[_0x4a0bac];return _0x390517;};'use strict';var _=require(_0x64b7('0x0'));var util=require(_0x64b7('0x1'));var moment=require('moment');var BPromise=require(_0x64b7('0x2'));var rs=require(_0x64b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64b7('0x4'))['db'];var utils=require(_0x64b7('0x5'));var logger=require(_0x64b7('0x6'))(_0x64b7('0x7'));var config=require(_0x64b7('0x8'));var jayson=require(_0x64b7('0x9'));var client=jayson[_0x64b7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554740,_0x592366,_0x497c85){return new BPromise(function(_0x597571,_0x5511d8){return client[_0x64b7('0xb')](_0x554740,_0x497c85)[_0x64b7('0xc')](function(_0xb92e12){logger[_0x64b7('0xd')](_0x64b7('0xe'),_0x592366,'request\x20sent');logger[_0x64b7('0xf')](_0x64b7('0x10'),_0x592366,_0x64b7('0x11'),JSON[_0x64b7('0x12')](_0xb92e12));if(_0xb92e12[_0x64b7('0x13')]){if(_0xb92e12['error'][_0x64b7('0x14')]===0x1f4){logger[_0x64b7('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x592366,_0xb92e12['error'][_0x64b7('0x15')]);return _0x5511d8(_0xb92e12['error'][_0x64b7('0x15')]);}logger[_0x64b7('0x13')](_0x64b7('0xe'),_0x592366,_0xb92e12['error'][_0x64b7('0x15')]);return _0x597571(_0xb92e12[_0x64b7('0x13')][_0x64b7('0x15')]);}else{logger[_0x64b7('0xd')](_0x64b7('0xe'),_0x592366,_0x64b7('0x11'));_0x597571(_0xb92e12['result'][_0x64b7('0x15')]);}})[_0x64b7('0x16')](function(_0xf06771){logger[_0x64b7('0x13')](_0x64b7('0xe'),_0x592366,_0xf06771);_0x5511d8(_0xf06771);});});}exports[_0x64b7('0x17')]=function(_0x13c897){var _0x41ddab=this;return new Promise(function(_0x3da077,_0x3f82aa){return db[_0x64b7('0x18')]['findAll']({'raw':_0x13c897['options']?_0x13c897[_0x64b7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x13c897[_0x64b7('0x19')]?_0x13c897[_0x64b7('0x19')][_0x64b7('0x1a')]||null:null,'attributes':_0x13c897[_0x64b7('0x19')]?_0x13c897[_0x64b7('0x19')][_0x64b7('0x1b')]||null:null,'limit':_0x13c897[_0x64b7('0x19')]?_0x13c897['options']['limit']||null:null,'include':_0x13c897[_0x64b7('0x19')]?_0x13c897[_0x64b7('0x19')][_0x64b7('0x1c')]?_[_0x64b7('0x1d')](_0x13c897[_0x64b7('0x19')]['include'],function(_0x15e585){return{'model':db[_0x15e585[_0x64b7('0x1e')]],'as':_0x15e585['as'],'attributes':_0x15e585[_0x64b7('0x1b')],'include':_0x15e585[_0x64b7('0x1c')]?_[_0x64b7('0x1d')](_0x15e585[_0x64b7('0x1c')],function(_0x565a40){return{'model':db[_0x565a40[_0x64b7('0x1e')]],'as':_0x565a40['as'],'attributes':_0x565a40[_0x64b7('0x1b')],'include':_0x565a40[_0x64b7('0x1c')]?_[_0x64b7('0x1d')](_0x565a40[_0x64b7('0x1c')],function(_0xca9645){return{'model':db[_0xca9645[_0x64b7('0x1e')]],'as':_0xca9645['as'],'attributes':_0xca9645['attributes']};}):[]};}):[]};}):[]:[]})[_0x64b7('0xc')](function(_0x40a3d7){logger['info'](_0x64b7('0x17'),_0x13c897);logger[_0x64b7('0xf')](_0x64b7('0x17'),_0x13c897,JSON[_0x64b7('0x12')](_0x40a3d7));_0x3da077(_0x40a3d7);})[_0x64b7('0x16')](function(_0x15ad65){logger['error'](_0x64b7('0x17'),_0x15ad65['message'],_0x13c897);_0x3f82aa(_0x41ddab[_0x64b7('0x13')](0x1f4,_0x15ad65[_0x64b7('0x15')]));});});};exports[_0x64b7('0x1f')]=function(_0x467c7c){var _0x2fee05=this;return new Promise(function(_0x5eec92,_0x17f0e0){return db[_0x64b7('0x18')][_0x64b7('0x20')](_0x467c7c[_0x64b7('0x21')],{'raw':_0x467c7c[_0x64b7('0x19')]?_0x467c7c[_0x64b7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x467c7c[_0x64b7('0x19')]?_0x467c7c[_0x64b7('0x19')][_0x64b7('0x1a')]||null:null,'attributes':_0x467c7c['options']?_0x467c7c[_0x64b7('0x19')][_0x64b7('0x1b')]||null:null,'limit':_0x467c7c['options']?_0x467c7c[_0x64b7('0x19')][_0x64b7('0x22')]||null:null})[_0x64b7('0xc')](function(_0x2b685b){logger['info'](_0x64b7('0x1f'),_0x467c7c);logger[_0x64b7('0xf')](_0x64b7('0x1f'),_0x467c7c,JSON[_0x64b7('0x12')](_0x2b685b));_0x5eec92(_0x2b685b);})[_0x64b7('0x16')](function(_0x3a0015){logger[_0x64b7('0x13')](_0x64b7('0x1f'),_0x3a0015[_0x64b7('0x15')],_0x467c7c);_0x17f0e0(_0x2fee05[_0x64b7('0x13')](0x1f4,_0x3a0015[_0x64b7('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x24fcd7){var _0x147107=this;return new Promise(function(_0x34f518,_0x409a6a){return db[_0x64b7('0x18')]['destroy']({'where':_0x24fcd7[_0x64b7('0x19')]?_0x24fcd7[_0x64b7('0x19')]['where']||null:null})[_0x64b7('0xc')](function(_0x3a1db7){logger[_0x64b7('0xd')]('DestroyCmHopperBlack',_0x24fcd7);logger[_0x64b7('0xf')](_0x64b7('0x23'),_0x24fcd7,JSON[_0x64b7('0x12')](_0x3a1db7));_0x34f518(_0x3a1db7);})[_0x64b7('0x16')](function(_0x37bdd0){logger[_0x64b7('0x13')]('DestroyCmHopperBlack',_0x37bdd0[_0x64b7('0x15')],_0x24fcd7);_0x409a6a(_0x147107['error'](0x1f4,_0x37bdd0['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a7ef073..be1c6e5 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 _0xba34=['./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x56291c,_0x4fac86){var _0x60b7c8=function(_0x6466d1){while(--_0x6466d1){_0x56291c['push'](_0x56291c['shift']());}};_0x60b7c8(++_0x4fac86);}(_0xba34,0x119));var _0x4ba3=function(_0x453d2a,_0x2cd872){_0x453d2a=_0x453d2a-0x0;var _0x2046ec=_0xba34[_0x453d2a];return _0x2046ec;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc2c7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','update','delete'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xc2c7,0x134));var _0x7c2c=function(_0x20073b,_0x224def){_0x20073b=_0x20073b-0x0;var _0x47954e=_0xc2c7[_0x20073b];return _0x47954e;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['put'](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);module[_0x7c2c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e5ec737..f13b18e 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 _0x0d01=['DATE','STRING','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0x2006f1,_0x40078e){var _0xc9d945=function(_0x2e1f23){while(--_0x2e1f23){_0x2006f1['push'](_0x2006f1['shift']());}};_0xc9d945(++_0x40078e);}(_0x0d01,0x1d0));var _0x10d0=function(_0x50356f,_0x304f2f){_0x50356f=_0x50356f-0x0;var _0x543d33=_0x0d01[_0x50356f];return _0x543d33;};'use strict';var Sequelize=require(_0x10d0('0x0'));var moment=require(_0x10d0('0x1'));module[_0x10d0('0x2')]={'state':{'type':Sequelize[_0x10d0('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x10d0('0x4')]},'countbusyretry':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x10d0('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x10d0('0x5')]},'originatecalleridname':{'type':Sequelize[_0x10d0('0x5')]},'calleridnum':{'type':Sequelize[_0x10d0('0x5')]},'calleridname':{'type':Sequelize[_0x10d0('0x5')]},'starttime':{'type':Sequelize[_0x10d0('0x4')]},'responsetime':{'type':Sequelize[_0x10d0('0x4')]},'answertime':{'type':Sequelize[_0x10d0('0x4')]},'droptime':{'type':Sequelize[_0x10d0('0x4')]},'endtime':{'type':Sequelize[_0x10d0('0x4')]},'ringtime':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x10d0('0x5')]},'campaigntype':{'type':Sequelize[_0x10d0('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x10d0('0x5')]},'thirdDisposition':{'type':Sequelize[_0x10d0('0x5')]},'dispositionat':{'type':Sequelize[_0x10d0('0x4')],'set':function(_0x21112c){var _0x27e197=this[_0x10d0('0x6')](_0x10d0('0x7'));if(_0x27e197&&_0x21112c){this[_0x10d0('0x8')](_0x10d0('0x9'),moment(_0x21112c)['diff'](moment(_0x27e197),_0x10d0('0xa')));}return this['setDataValue'](_0x10d0('0xb'),_0x21112c);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x10d0('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x10d0('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x10d0('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x10d0('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x10d0('0x4')]},'recallme':{'type':Sequelize[_0x10d0('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x10d0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2a8f=['dispositionat','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','setDataValue','followuptime','diff','seconds'];(function(_0x19d15b,_0x4acc01){var _0x45d084=function(_0x516302){while(--_0x516302){_0x19d15b['push'](_0x19d15b['shift']());}};_0x45d084(++_0x4acc01);}(_0x2a8f,0x16d));var _0xf2a8=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x2a8f[_0x10791d];return _0x1b4f9c;};'use strict';var Sequelize=require(_0xf2a8('0x0'));var moment=require('moment');module[_0xf2a8('0x1')]={'state':{'type':Sequelize[_0xf2a8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf2a8('0x3')]},'scheduledat':{'type':Sequelize[_0xf2a8('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf2a8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf2a8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf2a8('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf2a8('0x3')]},'calleridnum':{'type':Sequelize[_0xf2a8('0x3')]},'calleridname':{'type':Sequelize[_0xf2a8('0x3')]},'starttime':{'type':Sequelize[_0xf2a8('0x4')]},'responsetime':{'type':Sequelize[_0xf2a8('0x4')]},'answertime':{'type':Sequelize[_0xf2a8('0x4')]},'droptime':{'type':Sequelize[_0xf2a8('0x4')]},'endtime':{'type':Sequelize[_0xf2a8('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xf2a8('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf2a8('0x3')]},'reason':{'type':Sequelize[_0xf2a8('0x3')]},'disposition':{'type':Sequelize[_0xf2a8('0x3')]},'secondDisposition':{'type':Sequelize[_0xf2a8('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xf2a8('0x4')],'set':function(_0x38742c){var _0x3c6e9b=this['getDataValue']('endtime');if(_0x3c6e9b&&_0x38742c){this[_0xf2a8('0x5')](_0xf2a8('0x6'),moment(_0x38742c)[_0xf2a8('0x7')](moment(_0x3c6e9b),_0xf2a8('0x8')));}return this['setDataValue'](_0xf2a8('0x9'),_0x38742c);}},'amd':{'type':Sequelize[_0xf2a8('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf2a8('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf2a8('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf2a8('0x4')]},'callback':{'type':Sequelize[_0xf2a8('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf2a8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf2a8('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf2a8('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xf2a8('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf2a8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index f506dc7..564a588 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 _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x814b,0x1a2));var _0xb814=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x814b[_0x3a2a3c];return _0x50ac9a;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file +var _0x9536=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x122c1a,_0x24f7b7){var _0x158dd6=function(_0x30afca){while(--_0x30afca){_0x122c1a['push'](_0x122c1a['shift']());}};_0x158dd6(++_0x24f7b7);}(_0x9536,0x179));var _0x6953=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x9536[_0x56fe98];return _0x212f4f;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8ff2d3d..07d8d8b 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 _0xebb1=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment'];(function(_0x1b219c,_0x5a7cd4){var _0x2d15ac=function(_0x498a86){while(--_0x498a86){_0x1b219c['push'](_0x1b219c['shift']());}};_0x2d15ac(++_0x5a7cd4);}(_0xebb1,0x7e));var _0x1ebb=function(_0x379cc7,_0x1273a3){_0x379cc7=_0x379cc7-0x0;var _0x275a0e=_0xebb1[_0x379cc7];return _0x275a0e;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var logger=require('../../config/logger')(_0x1ebb('0x2'));var moment=require(_0x1ebb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1ebb('0x4'));var config=require(_0x1ebb('0x5'));var attributes=require(_0x1ebb('0x6'));module[_0x1ebb('0x7')]=function(_0x37b8f6,_0x409651){return _0x37b8f6[_0x1ebb('0x8')](_0x1ebb('0x9'),attributes,{'tableName':_0x1ebb('0xa'),'paranoid':![],'indexes':[{'name':_0x1ebb('0xb'),'fields':[_0x1ebb('0xb')]},{'name':_0x1ebb('0xc'),'fields':[_0x1ebb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb316=['util','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','uniqueid','lodash'];(function(_0x52037d,_0x925f20){var _0x3b0c1c=function(_0x4e4665){while(--_0x4e4665){_0x52037d['push'](_0x52037d['shift']());}};_0x3b0c1c(++_0x925f20);}(_0xb316,0x110));var _0x6b31=function(_0x4de09a,_0x3c7114){_0x4de09a=_0x4de09a-0x0;var _0x3878db=_0xb316[_0x4de09a];return _0x3878db;};'use strict';var _=require(_0x6b31('0x0'));var util=require(_0x6b31('0x1'));var logger=require('../../config/logger')(_0x6b31('0x2'));var moment=require(_0x6b31('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b31('0x4'));var fs=require('fs');var path=require(_0x6b31('0x5'));var rimraf=require(_0x6b31('0x6'));var config=require(_0x6b31('0x7'));var attributes=require(_0x6b31('0x8'));module[_0x6b31('0x9')]=function(_0x3465f6,_0xcdc1be){return _0x3465f6['define'](_0x6b31('0xa'),attributes,{'tableName':_0x6b31('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x6b31('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d360afa..a13c86a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1313f1,_0x1e8187){var _0x4d6707=function(_0x3233e9){while(--_0x3233e9){_0x1313f1['push'](_0x1313f1['shift']());}};_0x4d6707(++_0x1e8187);}(_0x7a54,0x106));var _0x47a5=function(_0x39d105,_0x439256){_0x39d105=_0x39d105-0x0;var _0x5bf27d=_0x7a54[_0x39d105];return _0x5bf27d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x39160b,_0x300a88){var _0x463637=function(_0x47e03b){while(--_0x47e03b){_0x39160b['push'](_0x39160b['shift']());}};_0x463637(++_0x300a88);}(_0xb10b,0x12a));var _0xbb10=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xb10b[_0x33554b];return _0x256954;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 1d164f8..6370e3b 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 _0xda28=['../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda28,0xfd));var _0x8da2=function(_0x2a9b3b,_0x426d77){_0x2a9b3b=_0x2a9b3b-0x0;var _0x43c368=_0xda28[_0x2a9b3b];return _0x43c368;};'use strict';var multer=require(_0x8da2('0x0'));var util=require(_0x8da2('0x1'));var path=require(_0x8da2('0x2'));var timeout=require(_0x8da2('0x3'));var express=require(_0x8da2('0x4'));var router=express['Router']();var fs_extra=require(_0x8da2('0x5'));var auth=require(_0x8da2('0x6'));var interaction=require(_0x8da2('0x7'));var config=require(_0x8da2('0x8'));var controller=require(_0x8da2('0x9'));router[_0x8da2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8da2('0xb')]);router['get'](_0x8da2('0xc'),auth[_0x8da2('0xd')](),controller['describe']);router[_0x8da2('0xa')]('/:id',auth[_0x8da2('0xd')](),controller[_0x8da2('0xe')]);router[_0x8da2('0xa')](_0x8da2('0xf'),auth['isAuthenticated'](),controller[_0x8da2('0x10')]);router['get'](_0x8da2('0x11'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x12')]);router['post'](_0x8da2('0x13'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x14')]);router[_0x8da2('0x15')](_0x8da2('0x16'),auth['isAuthenticated'](),controller[_0x8da2('0x17')]);router['post'](_0x8da2('0x18'),auth[_0x8da2('0xd')](),controller['checkContactHopper']);router[_0x8da2('0x19')](_0x8da2('0x1a'),auth[_0x8da2('0xd')](),controller[_0x8da2('0x1b')]);module[_0x8da2('0x1c')]=router; \ No newline at end of file +var _0x17bb=['update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x17bb,0x188));var _0xb17b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x17bb[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xb17b('0x0'));var util=require(_0xb17b('0x1'));var path=require(_0xb17b('0x2'));var timeout=require(_0xb17b('0x3'));var express=require(_0xb17b('0x4'));var router=express[_0xb17b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb17b('0x6'));var interaction=require(_0xb17b('0x7'));var config=require(_0xb17b('0x8'));var controller=require(_0xb17b('0x9'));router['get']('/',auth[_0xb17b('0xa')](),controller['index']);router[_0xb17b('0xb')](_0xb17b('0xc'),auth[_0xb17b('0xa')](),controller['describe']);router[_0xb17b('0xb')](_0xb17b('0xd'),auth[_0xb17b('0xa')](),controller[_0xb17b('0xe')]);router[_0xb17b('0xb')](_0xb17b('0xf'),auth[_0xb17b('0xa')](),controller[_0xb17b('0x10')]);router[_0xb17b('0xb')]('/campaign/countAttributes/:id',auth[_0xb17b('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xb17b('0x11')](_0xb17b('0x12'),auth[_0xb17b('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0xb17b('0x13'),auth[_0xb17b('0xa')](),controller[_0xb17b('0x14')]);router[_0xb17b('0x11')](_0xb17b('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb17b('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 29dd341..64b9db4 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 _0x3c03=['sequelize','DATE','INTEGER','STRING','BOOLEAN'];(function(_0x512d86,_0x3165f3){var _0x4873f3=function(_0x2987e7){while(--_0x2987e7){_0x512d86['push'](_0x512d86['shift']());}};_0x4873f3(++_0x3165f3);}(_0x3c03,0x16d));var _0x33c0=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x3c03[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require(_0x33c0('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x33c0('0x1')]},'countbusyretry':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x33c0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x33c0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x33c0('0x3')]},'calleridnum':{'type':Sequelize[_0x33c0('0x3')]},'calleridname':{'type':Sequelize[_0x33c0('0x3')]},'starttime':{'type':Sequelize[_0x33c0('0x1')]},'responsetime':{'type':Sequelize[_0x33c0('0x1')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x33c0('0x1')]},'endtime':{'type':Sequelize[_0x33c0('0x1')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x33c0('0x3')]},'campaign':{'type':Sequelize[_0x33c0('0x3')]},'campaigntype':{'type':Sequelize[_0x33c0('0x3')]},'membername':{'type':Sequelize[_0x33c0('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x33c0('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x33c0('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x33c0('0x1')]},'edited':{'type':Sequelize[_0x33c0('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x33c0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x33c0('0x3')]}}; \ No newline at end of file +var _0x5836=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x1375c8,_0xf1e51d){var _0x17acc6=function(_0x15e097){while(--_0x15e097){_0x1375c8['push'](_0x1375c8['shift']());}};_0x17acc6(++_0xf1e51d);}(_0x5836,0x12c));var _0x6583=function(_0x3b1106,_0x4bd523){_0x3b1106=_0x3b1106-0x0;var _0x1fbeef=_0x5836[_0x3b1106];return _0x1fbeef;};'use strict';var Sequelize=require(_0x6583('0x0'));module['exports']={'state':{'type':Sequelize[_0x6583('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6583('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6583('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6583('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6583('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6583('0x2')]},'starttime':{'type':Sequelize[_0x6583('0x3')]},'responsetime':{'type':Sequelize[_0x6583('0x3')]},'answertime':{'type':Sequelize[_0x6583('0x3')]},'droptime':{'type':Sequelize[_0x6583('0x3')]},'endtime':{'type':Sequelize[_0x6583('0x3')]},'ringtime':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6583('0x2')]},'campaigntype':{'type':Sequelize[_0x6583('0x2')]},'membername':{'type':Sequelize[_0x6583('0x2')]},'reason':{'type':Sequelize[_0x6583('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6583('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6583('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6583('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6583('0x3')]},'recallme':{'type':Sequelize[_0x6583('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6583('0x3')]},'edited':{'type':Sequelize[_0x6583('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6583('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6583('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index bd9515b..ca83072 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 _0x6026=['show','params','length','include','find','create','body','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','fields','attributes','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','catch'];(function(_0x599a17,_0x24d1a9){var _0x5458bc=function(_0x407ec8){while(--_0x407ec8){_0x599a17['push'](_0x599a17['shift']());}};_0x5458bc(++_0x24d1a9);}(_0x6026,0x141));var _0x6602=function(_0x1c4545,_0x57e61e){_0x1c4545=_0x1c4545-0x0;var _0x341826=_0x6026[_0x1c4545];return _0x341826;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6602('0x0'));var zipdir=require(_0x6602('0x1'));var jsonpatch=require(_0x6602('0x2'));var rp=require(_0x6602('0x3'));var moment=require('moment');var BPromise=require(_0x6602('0x4'));var Mustache=require(_0x6602('0x5'));var util=require(_0x6602('0x6'));var path=require(_0x6602('0x7'));var sox=require(_0x6602('0x8'));var csv=require(_0x6602('0x9'));var ejs=require(_0x6602('0xa'));var fs=require('fs');var fs_extra=require(_0x6602('0xb'));var _=require(_0x6602('0xc'));var squel=require(_0x6602('0xd'));var crypto=require('crypto');var jsforce=require(_0x6602('0xe'));var deskjs=require(_0x6602('0xf'));var toCsv=require(_0x6602('0x9'));var querystring=require(_0x6602('0x10'));var Papa=require(_0x6602('0x11'));var Redis=require(_0x6602('0x12'));var authService=require(_0x6602('0x13'));var qs=require(_0x6602('0x14'));var as=require(_0x6602('0x15'));var hardwareService=require(_0x6602('0x16'));var logger=require(_0x6602('0x17'))('api');var utils=require(_0x6602('0x18'));var config=require(_0x6602('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6602('0x1a'))['db'];function respondWithStatusCode(_0x2c1f4e,_0xdeb800){_0xdeb800=_0xdeb800||0xcc;return function(_0x4668c9){if(_0x4668c9){return _0x2c1f4e['sendStatus'](_0xdeb800);}return _0x2c1f4e[_0x6602('0x1b')](_0xdeb800)[_0x6602('0x1c')]();};}function respondWithResult(_0x3cd05a,_0x5b9854){_0x5b9854=_0x5b9854||0xc8;return function(_0x43e2da){if(_0x43e2da){return _0x3cd05a[_0x6602('0x1b')](_0x5b9854)[_0x6602('0x1d')](_0x43e2da);}};}function respondWithFilteredResult(_0xc07a67,_0x1f181){return function(_0x2a7407){if(_0x2a7407){var _0x2c86d5=typeof _0x1f181[_0x6602('0x1e')]===_0x6602('0x1f')&&typeof _0x1f181[_0x6602('0x20')]==='undefined';var _0x1576b5=_0x2a7407[_0x6602('0x21')];var _0x4da01f=_0x2c86d5?0x0:_0x1f181[_0x6602('0x1e')];var _0x253ae2=_0x2c86d5?_0x2a7407[_0x6602('0x21')]:_0x1f181[_0x6602('0x1e')]+_0x1f181[_0x6602('0x20')];var _0x3e6cdd;if(_0x253ae2>=_0x1576b5){_0x253ae2=_0x1576b5;_0x3e6cdd=0xc8;}else{_0x3e6cdd=0xce;}_0xc07a67[_0x6602('0x1b')](_0x3e6cdd);return _0xc07a67[_0x6602('0x22')]('Content-Range',_0x4da01f+'-'+_0x253ae2+'/'+_0x1576b5)[_0x6602('0x1d')](_0x2a7407);}return null;};}function patchUpdates(_0x25f0a4){return function(_0xc28ec){try{jsonpatch[_0x6602('0x23')](_0xc28ec,_0x25f0a4,!![]);}catch(_0x1d5c90){return BPromise[_0x6602('0x24')](_0x1d5c90);}return _0xc28ec[_0x6602('0x25')]();};}function saveUpdates(_0x4b6bd7,_0x5639c6){return function(_0x5a0860){if(_0x5a0860){return _0x5a0860[_0x6602('0x26')](_0x4b6bd7)['then'](function(_0x4b58c1){return _0x4b58c1;});}return null;};}function removeEntity(_0x2abb95,_0x5f4b16){return function(_0x32db36){if(_0x32db36){return _0x32db36['destroy']()[_0x6602('0x27')](function(){_0x2abb95[_0x6602('0x1b')](0xcc)[_0x6602('0x1c')]();});}};}function handleEntityNotFound(_0xf2c75,_0x2938f6){return function(_0x8ec72f){if(!_0x8ec72f){_0xf2c75[_0x6602('0x28')](0x194);}return _0x8ec72f;};}function handleError(_0x5e7971,_0xd69554){_0xd69554=_0xd69554||0x1f4;return function(_0x7b813f){logger[_0x6602('0x29')](_0x7b813f[_0x6602('0x2a')]);if(_0x7b813f['name']){delete _0x7b813f[_0x6602('0x2b')];}_0x5e7971[_0x6602('0x1b')](_0xd69554)[_0x6602('0x2c')](_0x7b813f);};}exports['index']=function(_0x5c8b57,_0x651d4){var _0x53afe7={},_0x3477d2={},_0x207b34={'count':0x0,'rows':[]};var _0x3a12cb=_['map'](db['CmHopperHistory'][_0x6602('0x2d')],function(_0x52098a){return{'name':_0x52098a[_0x6602('0x2e')],'type':_0x52098a[_0x6602('0x2f')][_0x6602('0x30')]};});_0x3477d2['model']=_[_0x6602('0x31')](_0x3a12cb,'name');_0x3477d2['query']=_[_0x6602('0x32')](_0x5c8b57[_0x6602('0x33')]);_0x3477d2[_0x6602('0x34')]=_['intersection'](_0x3477d2['model'],_0x3477d2[_0x6602('0x33')]);_0x53afe7['attributes']=_[_0x6602('0x35')](_0x3477d2['model'],qs[_0x6602('0x36')](_0x5c8b57[_0x6602('0x33')]['fields']));_0x53afe7[_0x6602('0x37')]=_0x53afe7[_0x6602('0x37')]['length']?_0x53afe7['attributes']:_0x3477d2[_0x6602('0x38')];if(!_0x5c8b57[_0x6602('0x33')][_0x6602('0x39')]('nolimit')){_0x53afe7[_0x6602('0x20')]=qs[_0x6602('0x20')](_0x5c8b57[_0x6602('0x33')]['limit']);_0x53afe7[_0x6602('0x1e')]=qs[_0x6602('0x1e')](_0x5c8b57[_0x6602('0x33')][_0x6602('0x1e')]);}_0x53afe7[_0x6602('0x3a')]=qs[_0x6602('0x3b')](_0x5c8b57[_0x6602('0x33')][_0x6602('0x3b')]);_0x53afe7[_0x6602('0x3c')]=qs['filters'](_[_0x6602('0x3d')](_0x5c8b57[_0x6602('0x33')],_0x3477d2['filters']),_0x3a12cb);if(_0x5c8b57[_0x6602('0x33')][_0x6602('0x3e')]){_0x53afe7[_0x6602('0x3c')]=_[_0x6602('0x3f')](_0x53afe7['where'],{'$or':_[_0x6602('0x31')](_0x3a12cb,function(_0x3e5f1d){if(_0x3e5f1d[_0x6602('0x2f')]!==_0x6602('0x40')){var _0x18e6a9={};_0x18e6a9[_0x3e5f1d[_0x6602('0x2b')]]={'$like':'%'+_0x5c8b57['query'][_0x6602('0x3e')]+'%'};return _0x18e6a9;}})});}_0x53afe7=_['merge']({},_0x53afe7,_0x5c8b57[_0x6602('0x41')]);var _0x50fe4f={'where':_0x53afe7[_0x6602('0x3c')]};return db[_0x6602('0x42')][_0x6602('0x21')](_0x50fe4f)[_0x6602('0x27')](function(_0x189f4b){_0x207b34['count']=_0x189f4b;if(_0x5c8b57[_0x6602('0x33')][_0x6602('0x43')]){_0x53afe7['include']=[{'all':!![]}];}return db[_0x6602('0x42')]['findAll'](_0x53afe7);})['then'](function(_0x5f5213){_0x207b34['rows']=_0x5f5213;return _0x207b34;})['then'](respondWithFilteredResult(_0x651d4,_0x53afe7))[_0x6602('0x44')](handleError(_0x651d4,null));};exports[_0x6602('0x45')]=function(_0x3c2d42,_0x261174){var _0x5aadae={'raw':!![],'where':{'id':_0x3c2d42[_0x6602('0x46')]['id']}},_0x208cc6={};_0x208cc6['model']=_[_0x6602('0x32')](db['CmHopperHistory'][_0x6602('0x2d')]);_0x208cc6[_0x6602('0x33')]=_['keys'](_0x3c2d42['query']);_0x208cc6[_0x6602('0x34')]=_[_0x6602('0x35')](_0x208cc6[_0x6602('0x38')],_0x208cc6[_0x6602('0x33')]);_0x5aadae[_0x6602('0x37')]=_[_0x6602('0x35')](_0x208cc6[_0x6602('0x38')],qs[_0x6602('0x36')](_0x3c2d42[_0x6602('0x33')][_0x6602('0x36')]));_0x5aadae[_0x6602('0x37')]=_0x5aadae[_0x6602('0x37')][_0x6602('0x47')]?_0x5aadae[_0x6602('0x37')]:_0x208cc6['model'];if(_0x3c2d42[_0x6602('0x33')]['includeAll']){_0x5aadae[_0x6602('0x48')]=[{'all':!![]}];}_0x5aadae=_['merge']({},_0x5aadae,_0x3c2d42['options']);return db[_0x6602('0x42')][_0x6602('0x49')](_0x5aadae)[_0x6602('0x27')](handleEntityNotFound(_0x261174,null))['then'](respondWithResult(_0x261174,null))[_0x6602('0x44')](handleError(_0x261174,null));};exports['create']=function(_0x5ed356,_0x243c37){return db[_0x6602('0x42')][_0x6602('0x4a')](_0x5ed356[_0x6602('0x4b')],{})[_0x6602('0x27')](respondWithResult(_0x243c37,0xc9))[_0x6602('0x44')](handleError(_0x243c37,null));};exports[_0x6602('0x4c')]=function(_0x58e188,_0x2fd95f){return db['CmHopperHistory'][_0x6602('0x4c')]()[_0x6602('0x27')](respondWithResult(_0x2fd95f,null))[_0x6602('0x44')](handleError(_0x2fd95f,null));};exports['update']=function(_0x428c61,_0x459ada){if(_0x428c61[_0x6602('0x4b')][_0x6602('0x4d')]){delete _0x428c61[_0x6602('0x4b')]['uniqueid'];}return db[_0x6602('0x42')]['find']({'where':{'uniqueid':_0x428c61[_0x6602('0x46')]['id']}})['then'](handleEntityNotFound(_0x459ada,null))[_0x6602('0x27')](saveUpdates(_0x428c61[_0x6602('0x4b')],null))[_0x6602('0x27')](respondWithResult(_0x459ada,null))['catch'](handleError(_0x459ada,null));}; \ No newline at end of file +var _0x1bfb=['mustache','util','sox','to-csv','ejs','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','json','offset','undefined','count','limit','Content-Range','apply','then','destroy','end','error','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','keys','find','create','catch','update','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x10d1bf,_0x3b6413){var _0x305c6e=function(_0xc3c60e){while(--_0xc3c60e){_0x10d1bf['push'](_0x10d1bf['shift']());}};_0x305c6e(++_0x3b6413);}(_0x1bfb,0x90));var _0xb1bf=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x1bfb[_0x1b5aea];return _0x51cae9;};'use strict';var emlformat=require(_0xb1bf('0x0'));var rimraf=require(_0xb1bf('0x1'));var zipdir=require(_0xb1bf('0x2'));var jsonpatch=require(_0xb1bf('0x3'));var rp=require(_0xb1bf('0x4'));var moment=require(_0xb1bf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb1bf('0x6'));var util=require(_0xb1bf('0x7'));var path=require('path');var sox=require(_0xb1bf('0x8'));var csv=require(_0xb1bf('0x9'));var ejs=require(_0xb1bf('0xa'));var fs=require('fs');var fs_extra=require(_0xb1bf('0xb'));var _=require(_0xb1bf('0xc'));var squel=require(_0xb1bf('0xd'));var crypto=require(_0xb1bf('0xe'));var jsforce=require(_0xb1bf('0xf'));var deskjs=require(_0xb1bf('0x10'));var toCsv=require(_0xb1bf('0x9'));var querystring=require(_0xb1bf('0x11'));var Papa=require(_0xb1bf('0x12'));var Redis=require('ioredis');var authService=require(_0xb1bf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb1bf('0x14'));var hardwareService=require(_0xb1bf('0x15'));var logger=require(_0xb1bf('0x16'))(_0xb1bf('0x17'));var utils=require(_0xb1bf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb1bf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c485,_0x2e22cb){_0x2e22cb=_0x2e22cb||0xcc;return function(_0x1e5556){if(_0x1e5556){return _0x13c485[_0xb1bf('0x1a')](_0x2e22cb);}return _0x13c485['status'](_0x2e22cb)['end']();};}function respondWithResult(_0x2e906d,_0x17703f){_0x17703f=_0x17703f||0xc8;return function(_0x12d366){if(_0x12d366){return _0x2e906d[_0xb1bf('0x1b')](_0x17703f)[_0xb1bf('0x1c')](_0x12d366);}};}function respondWithFilteredResult(_0x590d52,_0x15401a){return function(_0x57f72f){if(_0x57f72f){var _0x53aee9=typeof _0x15401a[_0xb1bf('0x1d')]==='undefined'&&typeof _0x15401a['limit']===_0xb1bf('0x1e');var _0x386a3d=_0x57f72f[_0xb1bf('0x1f')];var _0x4af09c=_0x53aee9?0x0:_0x15401a['offset'];var _0x2f3a81=_0x53aee9?_0x57f72f[_0xb1bf('0x1f')]:_0x15401a[_0xb1bf('0x1d')]+_0x15401a[_0xb1bf('0x20')];var _0x4834dc;if(_0x2f3a81>=_0x386a3d){_0x2f3a81=_0x386a3d;_0x4834dc=0xc8;}else{_0x4834dc=0xce;}_0x590d52['status'](_0x4834dc);return _0x590d52['set'](_0xb1bf('0x21'),_0x4af09c+'-'+_0x2f3a81+'/'+_0x386a3d)[_0xb1bf('0x1c')](_0x57f72f);}return null;};}function patchUpdates(_0x35e41c){return function(_0x3f4eb4){try{jsonpatch[_0xb1bf('0x22')](_0x3f4eb4,_0x35e41c,!![]);}catch(_0xbdf696){return BPromise['reject'](_0xbdf696);}return _0x3f4eb4['save']();};}function saveUpdates(_0x5e9ac9,_0x39cc1d){return function(_0x5def98){if(_0x5def98){return _0x5def98['update'](_0x5e9ac9)[_0xb1bf('0x23')](function(_0x50d19b){return _0x50d19b;});}return null;};}function removeEntity(_0x426100,_0x4dae88){return function(_0x1c0a53){if(_0x1c0a53){return _0x1c0a53[_0xb1bf('0x24')]()[_0xb1bf('0x23')](function(){_0x426100[_0xb1bf('0x1b')](0xcc)[_0xb1bf('0x25')]();});}};}function handleEntityNotFound(_0x1d144f,_0x3af66c){return function(_0x338fc4){if(!_0x338fc4){_0x1d144f[_0xb1bf('0x1a')](0x194);}return _0x338fc4;};}function handleError(_0x255f16,_0x18032c){_0x18032c=_0x18032c||0x1f4;return function(_0x2c5cc6){logger[_0xb1bf('0x26')](_0x2c5cc6['stack']);if(_0x2c5cc6[_0xb1bf('0x27')]){delete _0x2c5cc6[_0xb1bf('0x27')];}_0x255f16['status'](_0x18032c)[_0xb1bf('0x28')](_0x2c5cc6);};}exports['index']=function(_0x5c38fe,_0x8658f1){var _0x4a0b1e={},_0x5aaeb0={},_0x402b1d={'count':0x0,'rows':[]};var _0x1950fb=_[_0xb1bf('0x29')](db[_0xb1bf('0x2a')][_0xb1bf('0x2b')],function(_0x155299){return{'name':_0x155299[_0xb1bf('0x2c')],'type':_0x155299[_0xb1bf('0x2d')][_0xb1bf('0x2e')]};});_0x5aaeb0[_0xb1bf('0x2f')]=_[_0xb1bf('0x29')](_0x1950fb,_0xb1bf('0x27'));_0x5aaeb0[_0xb1bf('0x30')]=_['keys'](_0x5c38fe['query']);_0x5aaeb0['filters']=_[_0xb1bf('0x31')](_0x5aaeb0[_0xb1bf('0x2f')],_0x5aaeb0[_0xb1bf('0x30')]);_0x4a0b1e['attributes']=_[_0xb1bf('0x31')](_0x5aaeb0['model'],qs[_0xb1bf('0x32')](_0x5c38fe[_0xb1bf('0x30')]['fields']));_0x4a0b1e['attributes']=_0x4a0b1e[_0xb1bf('0x33')][_0xb1bf('0x34')]?_0x4a0b1e[_0xb1bf('0x33')]:_0x5aaeb0[_0xb1bf('0x2f')];if(!_0x5c38fe['query'][_0xb1bf('0x35')]('nolimit')){_0x4a0b1e['limit']=qs[_0xb1bf('0x20')](_0x5c38fe[_0xb1bf('0x30')][_0xb1bf('0x20')]);_0x4a0b1e['offset']=qs['offset'](_0x5c38fe[_0xb1bf('0x30')][_0xb1bf('0x1d')]);}_0x4a0b1e[_0xb1bf('0x36')]=qs[_0xb1bf('0x37')](_0x5c38fe[_0xb1bf('0x30')]['sort']);_0x4a0b1e[_0xb1bf('0x38')]=qs[_0xb1bf('0x39')](_[_0xb1bf('0x3a')](_0x5c38fe[_0xb1bf('0x30')],_0x5aaeb0[_0xb1bf('0x39')]),_0x1950fb);if(_0x5c38fe[_0xb1bf('0x30')]['filter']){_0x4a0b1e['where']=_[_0xb1bf('0x3b')](_0x4a0b1e[_0xb1bf('0x38')],{'$or':_[_0xb1bf('0x29')](_0x1950fb,function(_0x44175e){if(_0x44175e[_0xb1bf('0x2d')]!==_0xb1bf('0x3c')){var _0x2098f9={};_0x2098f9[_0x44175e[_0xb1bf('0x27')]]={'$like':'%'+_0x5c38fe[_0xb1bf('0x30')][_0xb1bf('0x3d')]+'%'};return _0x2098f9;}})});}_0x4a0b1e=_[_0xb1bf('0x3b')]({},_0x4a0b1e,_0x5c38fe[_0xb1bf('0x3e')]);var _0x31b779={'where':_0x4a0b1e[_0xb1bf('0x38')]};return db[_0xb1bf('0x2a')][_0xb1bf('0x1f')](_0x31b779)['then'](function(_0x30460e){_0x402b1d['count']=_0x30460e;if(_0x5c38fe[_0xb1bf('0x30')][_0xb1bf('0x3f')]){_0x4a0b1e[_0xb1bf('0x40')]=[{'all':!![]}];}return db[_0xb1bf('0x2a')]['findAll'](_0x4a0b1e);})[_0xb1bf('0x23')](function(_0x2f013b){_0x402b1d[_0xb1bf('0x41')]=_0x2f013b;return _0x402b1d;})[_0xb1bf('0x23')](respondWithFilteredResult(_0x8658f1,_0x4a0b1e))['catch'](handleError(_0x8658f1,null));};exports[_0xb1bf('0x42')]=function(_0x20462e,_0x48ab57){var _0x5440cd={'raw':!![],'where':{'id':_0x20462e[_0xb1bf('0x43')]['id']}},_0x28972a={};_0x28972a[_0xb1bf('0x2f')]=_[_0xb1bf('0x44')](db[_0xb1bf('0x2a')][_0xb1bf('0x2b')]);_0x28972a[_0xb1bf('0x30')]=_[_0xb1bf('0x44')](_0x20462e['query']);_0x28972a[_0xb1bf('0x39')]=_[_0xb1bf('0x31')](_0x28972a['model'],_0x28972a['query']);_0x5440cd['attributes']=_[_0xb1bf('0x31')](_0x28972a[_0xb1bf('0x2f')],qs[_0xb1bf('0x32')](_0x20462e[_0xb1bf('0x30')][_0xb1bf('0x32')]));_0x5440cd[_0xb1bf('0x33')]=_0x5440cd['attributes'][_0xb1bf('0x34')]?_0x5440cd[_0xb1bf('0x33')]:_0x28972a[_0xb1bf('0x2f')];if(_0x20462e[_0xb1bf('0x30')]['includeAll']){_0x5440cd[_0xb1bf('0x40')]=[{'all':!![]}];}_0x5440cd=_[_0xb1bf('0x3b')]({},_0x5440cd,_0x20462e[_0xb1bf('0x3e')]);return db[_0xb1bf('0x2a')][_0xb1bf('0x45')](_0x5440cd)['then'](handleEntityNotFound(_0x48ab57,null))[_0xb1bf('0x23')](respondWithResult(_0x48ab57,null))['catch'](handleError(_0x48ab57,null));};exports[_0xb1bf('0x46')]=function(_0x5679b0,_0x1b4efc){return db[_0xb1bf('0x2a')][_0xb1bf('0x46')](_0x5679b0['body'],{})[_0xb1bf('0x23')](respondWithResult(_0x1b4efc,0xc9))[_0xb1bf('0x47')](handleError(_0x1b4efc,null));};exports['describe']=function(_0x668226,_0x2d7826){return db[_0xb1bf('0x2a')]['describe']()[_0xb1bf('0x23')](respondWithResult(_0x2d7826,null))[_0xb1bf('0x47')](handleError(_0x2d7826,null));};exports[_0xb1bf('0x48')]=function(_0x36a2a1,_0x6bd996){if(_0x36a2a1[_0xb1bf('0x49')][_0xb1bf('0x4a')]){delete _0x36a2a1[_0xb1bf('0x49')][_0xb1bf('0x4a')];}return db[_0xb1bf('0x2a')][_0xb1bf('0x45')]({'where':{'uniqueid':_0x36a2a1['params']['id']}})[_0xb1bf('0x23')](handleEntityNotFound(_0x6bd996,null))[_0xb1bf('0x23')](saveUpdates(_0x36a2a1[_0xb1bf('0x49')],null))['then'](respondWithResult(_0x6bd996,null))[_0xb1bf('0x47')](handleError(_0x6bd996,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0937bfd..5eb7b2d 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 _0xb6a6=['lodash','util','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x5a63cc,_0x581f18){var _0x5ac4d1=function(_0x365e59){while(--_0x365e59){_0x5a63cc['push'](_0x5a63cc['shift']());}};_0x5ac4d1(++_0x581f18);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x2613c3,_0x1e19f0){_0x2613c3=_0x2613c3-0x0;var _0x926d91=_0xb6a6[_0x2613c3];return _0x926d91;};'use strict';var _=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b6a('0x2'));var BPromise=require(_0x6b6a('0x3'));var rp=require(_0x6b6a('0x4'));var fs=require('fs');var path=require(_0x6b6a('0x5'));var rimraf=require(_0x6b6a('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b6a('0x7'));module[_0x6b6a('0x8')]=function(_0xeb6021,_0x5f4e11){return _0xeb6021[_0x6b6a('0x9')](_0x6b6a('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x6b6a('0xb'),'fields':[_0x6b6a('0xb')]},{'name':'uniqueid','fields':[_0x6b6a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x471a=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x164a5c,_0x213be3){var _0x17e9e0=function(_0x5c192d){while(--_0x5c192d){_0x164a5c['push'](_0x164a5c['shift']());}};_0x17e9e0(++_0x213be3);}(_0x471a,0x18d));var _0xa471=function(_0x2af276,_0xb15ec5){_0x2af276=_0x2af276-0x0;var _0x4c586e=_0x471a[_0x2af276];return _0x4c586e;};'use strict';var _=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var logger=require(_0xa471('0x2'))('api');var moment=require(_0xa471('0x3'));var BPromise=require(_0xa471('0x4'));var rp=require(_0xa471('0x5'));var fs=require('fs');var path=require(_0xa471('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xa471('0x7')]=function(_0x4de28a,_0x4942a0){return _0x4de28a['define'](_0xa471('0x8'),attributes,{'tableName':_0xa471('0x9'),'paranoid':![],'indexes':[{'name':_0xa471('0xa'),'fields':['endtime']},{'name':_0xa471('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 06ef09e..518fdb2 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 _0x19ea=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperHistory','create','options','raw','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x19ea,0xfe));var _0xa19e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x19ea[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xa19e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa19e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19e('0x2'));var db=require(_0xa19e('0x3'))['db'];var utils=require(_0xa19e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa19e('0x5'));var jayson=require(_0xa19e('0x6'));var client=jayson[_0xa19e('0x7')][_0xa19e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1087e7,_0x30fd4a,_0x336e23){return new BPromise(function(_0x1867cb,_0x44e468){return client[_0xa19e('0x9')](_0x1087e7,_0x336e23)[_0xa19e('0xa')](function(_0x59b907){logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));logger[_0xa19e('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x30fd4a,_0xa19e('0xd'),JSON[_0xa19e('0xf')](_0x59b907));if(_0x59b907[_0xa19e('0x10')]){if(_0x59b907['error'][_0xa19e('0x11')]===0x1f4){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x44e468(_0x59b907['error'][_0xa19e('0x12')]);}logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);return _0x1867cb(_0x59b907[_0xa19e('0x10')][_0xa19e('0x12')]);}else{logger[_0xa19e('0xb')](_0xa19e('0xc'),_0x30fd4a,_0xa19e('0xd'));_0x1867cb(_0x59b907[_0xa19e('0x13')]['message']);}})[_0xa19e('0x14')](function(_0x34066a){logger[_0xa19e('0x10')](_0xa19e('0xc'),_0x30fd4a,_0x34066a);_0x44e468(_0x34066a);});});}exports[_0xa19e('0x15')]=function(_0x38e398){var _0x1f37c4=this;return new Promise(function(_0x530a75,_0xd3e0ff){return db['CmHopperHistory'][_0xa19e('0x16')](_0x38e398['body'],{'raw':_0x38e398['options']?_0x38e398[_0xa19e('0x17')][_0xa19e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1cb9f9){logger[_0xa19e('0xb')](_0xa19e('0x15'),_0x38e398);logger[_0xa19e('0xe')]('CreateCmHopperHistory',_0x38e398,JSON[_0xa19e('0xf')](_0x1cb9f9));_0x530a75(_0x1cb9f9);})[_0xa19e('0x14')](function(_0x105874){logger[_0xa19e('0x10')](_0xa19e('0x15'),_0x105874[_0xa19e('0x12')],_0x38e398);_0xd3e0ff(_0x1f37c4[_0xa19e('0x10')](0x1f4,_0x105874[_0xa19e('0x12')]));});});};exports[_0xa19e('0x19')]=function(_0x536386){var _0x466a55=this;return new Promise(function(_0x26dfd6,_0x504437){return db[_0xa19e('0x1a')][_0xa19e('0x1b')]({'raw':_0x536386['options']?_0x536386[_0xa19e('0x17')][_0xa19e('0x18')]===undefined?!![]:![]:!![],'where':_0x536386['options']?_0x536386[_0xa19e('0x17')][_0xa19e('0x1c')]||null:null,'attributes':[[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')][_0xa19e('0x1f')]('id')),_0xa19e('0x20')],[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x22')))),_0xa19e('0x23')],[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x26'),db['sequelize']['fn']('IF',db[_0xa19e('0x1d')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xa19e('0x27')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x28')))),'predictiveIntervalAvgTalktime']]})[_0xa19e('0xa')](function(_0x3f959c){logger[_0xa19e('0xb')](_0xa19e('0x19'),_0x536386);logger[_0xa19e('0xe')](_0xa19e('0x19'),_0x536386,JSON['stringify'](_0x3f959c));_0x26dfd6(_0x3f959c);})[_0xa19e('0x14')](function(_0x434081){logger['error'](_0xa19e('0x19'),_0x434081[_0xa19e('0x12')],_0x536386);_0x504437(_0x466a55[_0xa19e('0x10')](0x1f4,_0x434081['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x130f4d){var _0x4e3219=this;return new Promise(function(_0x2d41cc,_0x13b2f8){return db[_0xa19e('0x1a')][_0xa19e('0x1b')]({'raw':_0x130f4d['options']?_0x130f4d[_0xa19e('0x17')][_0xa19e('0x18')]===undefined?!![]:![]:!![],'where':_0x130f4d['options']?_0x130f4d[_0xa19e('0x17')]['where']||null:null,'attributes':[[_0xa19e('0x29'),_0xa19e('0x2a')],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xa19e('0x2b')],[db[_0xa19e('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xa19e('0x2c')],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x22')))),_0xa19e('0x2d')],[db['sequelize']['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x2e')))),'outboundBusyCallsDay'],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')]['literal'](_0xa19e('0x2f')))),_0xa19e('0x30')],[db['sequelize']['fn'](_0xa19e('0x1e'),db['sequelize']['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x31')))),_0xa19e('0x32')],[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')]['literal'](_0xa19e('0x33')))),_0xa19e('0x34')],[db['sequelize']['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa19e('0x35')],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0xa19e('0x36')],[db['sequelize']['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x37')))),'outboundOriginateFailureCallsDay'],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db['sequelize'][_0xa19e('0x21')](_0xa19e('0x38')))),_0xa19e('0x39')],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0xa19e('0x39')],[db[_0xa19e('0x1d')]['fn']('COUNT',db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x3b')))),'outboundReCallsDay']],'group':['campaign']})[_0xa19e('0xa')](function(_0x239a3b){logger['info'](_0xa19e('0x3c'),_0x130f4d);logger[_0xa19e('0xe')]('GetVoiceQueueHopperHistory',_0x130f4d,JSON[_0xa19e('0xf')](_0x239a3b));_0x2d41cc(_0x239a3b);})[_0xa19e('0x14')](function(_0x44a946){logger[_0xa19e('0x10')](_0xa19e('0x3c'),_0x44a946[_0xa19e('0x12')],_0x130f4d);_0x13b2f8(_0x4e3219[_0xa19e('0x10')](0x1f4,_0x44a946[_0xa19e('0x12')]));});});};exports[_0xa19e('0x3d')]=function(_0x248e0f){var _0x39eb06=this;return new Promise(function(_0x479b09,_0x520af6){return db[_0xa19e('0x1a')][_0xa19e('0x1b')]({'raw':_0x248e0f[_0xa19e('0x17')]?_0x248e0f['options']['raw']===undefined?!![]:![]:!![],'where':_0x248e0f['options']?_0x248e0f[_0xa19e('0x17')]['where']||null:null,'attributes':[[_0xa19e('0x29'),_0xa19e('0x2a')],[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x1e'),db['sequelize'][_0xa19e('0x1f')]('id')),_0xa19e('0x3e')],[db[_0xa19e('0x1d')]['fn'](_0xa19e('0x1e'),db[_0xa19e('0x1d')]['fn']('IF',db[_0xa19e('0x1d')][_0xa19e('0x21')](_0xa19e('0x22')))),_0xa19e('0x3f')]],'group':[_0xa19e('0x29')]})[_0xa19e('0xa')](function(_0xae7dbc){logger[_0xa19e('0xb')](_0xa19e('0x3d'),_0x248e0f);logger[_0xa19e('0xe')](_0xa19e('0x3d'),_0x248e0f,JSON[_0xa19e('0xf')](_0xae7dbc));_0x479b09(_0xae7dbc);})['catch'](function(_0xf4988d){logger[_0xa19e('0x10')]('GetCampaignHopperHistory',_0xf4988d[_0xa19e('0x12')],_0x248e0f);_0x520af6(_0x39eb06['error'](0x1f4,_0xf4988d['message']));});});}; \ No newline at end of file +var _0xa641=['result','catch','CreateCmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5247e2,_0x179d9c){var _0x45b4d6=function(_0x5ec43b){while(--_0x5ec43b){_0x5247e2['push'](_0x5247e2['shift']());}};_0x45b4d6(++_0x179d9c);}(_0xa641,0x188));var _0x1a64=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xa641[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x1a64('0x0'));var util=require(_0x1a64('0x1'));var moment=require(_0x1a64('0x2'));var BPromise=require(_0x1a64('0x3'));var rs=require(_0x1a64('0x4'));var fs=require('fs');var Redis=require(_0x1a64('0x5'));var db=require(_0x1a64('0x6'))['db'];var utils=require(_0x1a64('0x7'));var logger=require(_0x1a64('0x8'))(_0x1a64('0x9'));var config=require(_0x1a64('0xa'));var jayson=require(_0x1a64('0xb'));var client=jayson[_0x1a64('0xc')][_0x1a64('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ece15,_0x57137f,_0x4c6fd3){return new BPromise(function(_0x17e497,_0x1357d2){return client['request'](_0x2ece15,_0x4c6fd3)[_0x1a64('0xe')](function(_0x48e5d9){logger[_0x1a64('0xf')](_0x1a64('0x10'),_0x57137f,_0x1a64('0x11'));logger[_0x1a64('0x12')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x57137f,'request\x20sent',JSON['stringify'](_0x48e5d9));if(_0x48e5d9['error']){if(_0x48e5d9[_0x1a64('0x13')][_0x1a64('0x14')]===0x1f4){logger[_0x1a64('0x13')](_0x1a64('0x10'),_0x57137f,_0x48e5d9[_0x1a64('0x13')][_0x1a64('0x15')]);return _0x1357d2(_0x48e5d9['error']['message']);}logger[_0x1a64('0x13')](_0x1a64('0x10'),_0x57137f,_0x48e5d9[_0x1a64('0x13')][_0x1a64('0x15')]);return _0x17e497(_0x48e5d9[_0x1a64('0x13')]['message']);}else{logger[_0x1a64('0xf')](_0x1a64('0x10'),_0x57137f,_0x1a64('0x11'));_0x17e497(_0x48e5d9[_0x1a64('0x16')]['message']);}})[_0x1a64('0x17')](function(_0x362d83){logger[_0x1a64('0x13')](_0x1a64('0x10'),_0x57137f,_0x362d83);_0x1357d2(_0x362d83);});});}exports[_0x1a64('0x18')]=function(_0x2d6552){var _0x55b389=this;return new Promise(function(_0x1a3b11,_0x247c0c){return db['CmHopperHistory'][_0x1a64('0x19')](_0x2d6552[_0x1a64('0x1a')],{'raw':_0x2d6552['options']?_0x2d6552[_0x1a64('0x1b')][_0x1a64('0x1c')]===undefined?!![]:![]:!![]})[_0x1a64('0xe')](function(_0x1a030d){logger[_0x1a64('0xf')](_0x1a64('0x18'),_0x2d6552);logger[_0x1a64('0x12')](_0x1a64('0x18'),_0x2d6552,JSON[_0x1a64('0x1d')](_0x1a030d));_0x1a3b11(_0x1a030d);})[_0x1a64('0x17')](function(_0x5c9f10){logger['error'](_0x1a64('0x18'),_0x5c9f10[_0x1a64('0x15')],_0x2d6552);_0x247c0c(_0x55b389['error'](0x1f4,_0x5c9f10[_0x1a64('0x15')]));});});};exports[_0x1a64('0x1e')]=function(_0x481bc0){var _0x286540=this;return new Promise(function(_0x38e08e,_0x1aa732){return db[_0x1a64('0x1f')][_0x1a64('0x20')]({'raw':_0x481bc0[_0x1a64('0x1b')]?_0x481bc0['options']['raw']===undefined?!![]:![]:!![],'where':_0x481bc0[_0x1a64('0x1b')]?_0x481bc0['options'][_0x1a64('0x21')]||null:null,'attributes':[[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')][_0x1a64('0x24')]('id')),_0x1a64('0x25')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db['sequelize']['fn']('IF',db[_0x1a64('0x22')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1a64('0x22')]['fn']('COUNT',db[_0x1a64('0x22')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x1a64('0x27')],[db['sequelize']['fn']('AVG',db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x28')))),_0x1a64('0x29')],[db['sequelize']['fn'](_0x1a64('0x2a'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x2b')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x1ccd34){logger[_0x1a64('0xf')](_0x1a64('0x1e'),_0x481bc0);logger[_0x1a64('0x12')](_0x1a64('0x1e'),_0x481bc0,JSON['stringify'](_0x1ccd34));_0x38e08e(_0x1ccd34);})[_0x1a64('0x17')](function(_0xe590d3){logger[_0x1a64('0x13')](_0x1a64('0x1e'),_0xe590d3['message'],_0x481bc0);_0x1aa732(_0x286540[_0x1a64('0x13')](0x1f4,_0xe590d3[_0x1a64('0x15')]));});});};exports[_0x1a64('0x2c')]=function(_0x3a145b){var _0x3a033c=this;return new Promise(function(_0x504d8b,_0x48b0eb){return db[_0x1a64('0x1f')][_0x1a64('0x20')]({'raw':_0x3a145b[_0x1a64('0x1b')]?_0x3a145b['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a145b['options']?_0x3a145b[_0x1a64('0x1b')][_0x1a64('0x21')]||null:null,'attributes':[[_0x1a64('0x2d'),_0x1a64('0x2e')],[db[_0x1a64('0x22')]['fn']('COUNT',db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x2f')))),_0x1a64('0x30')],[db[_0x1a64('0x22')]['fn']('COUNT',db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x1a64('0x22')]['fn']('COUNT',db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0x1a64('0x32')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')]('`state`\x20=\x205,\x201,\x20null'))),_0x1a64('0x33')],[db['sequelize']['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db['sequelize'][_0x1a64('0x26')]('`state`\x20=\x208,\x201,\x20null'))),_0x1a64('0x34')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1a64('0x35')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0x1a64('0x22')]['fn']('COUNT',db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x37')))),_0x1a64('0x38')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db['sequelize']['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x39')))),_0x1a64('0x3a')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x1a64('0x3b')],[db['sequelize']['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')]('`state`\x20=\x2018,\x201,\x20null'))),_0x1a64('0x3c')],[db['sequelize']['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x3d')))),_0x1a64('0x3e')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db['sequelize']['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x3f')))),_0x1a64('0x3c')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x1a64('0x40')]],'group':[_0x1a64('0x2d')]})[_0x1a64('0xe')](function(_0x2ae6a6){logger[_0x1a64('0xf')](_0x1a64('0x2c'),_0x3a145b);logger[_0x1a64('0x12')](_0x1a64('0x2c'),_0x3a145b,JSON[_0x1a64('0x1d')](_0x2ae6a6));_0x504d8b(_0x2ae6a6);})[_0x1a64('0x17')](function(_0x27754d){logger[_0x1a64('0x13')](_0x1a64('0x2c'),_0x27754d[_0x1a64('0x15')],_0x3a145b);_0x48b0eb(_0x3a033c[_0x1a64('0x13')](0x1f4,_0x27754d['message']));});});};exports[_0x1a64('0x41')]=function(_0x1273ab){var _0x538547=this;return new Promise(function(_0x129553,_0xd6a7e0){return db[_0x1a64('0x1f')][_0x1a64('0x20')]({'raw':_0x1273ab['options']?_0x1273ab[_0x1a64('0x1b')][_0x1a64('0x1c')]===undefined?!![]:![]:!![],'where':_0x1273ab[_0x1a64('0x1b')]?_0x1273ab['options'][_0x1a64('0x21')]||null:null,'attributes':[[_0x1a64('0x2d'),_0x1a64('0x2e')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db['sequelize'][_0x1a64('0x24')]('id')),_0x1a64('0x42')],[db[_0x1a64('0x22')]['fn'](_0x1a64('0x23'),db[_0x1a64('0x22')]['fn']('IF',db[_0x1a64('0x22')][_0x1a64('0x26')](_0x1a64('0x43')))),_0x1a64('0x44')]],'group':[_0x1a64('0x2d')]})['then'](function(_0x48934d){logger[_0x1a64('0xf')](_0x1a64('0x41'),_0x1273ab);logger[_0x1a64('0x12')](_0x1a64('0x41'),_0x1273ab,JSON[_0x1a64('0x1d')](_0x48934d));_0x129553(_0x48934d);})[_0x1a64('0x17')](function(_0x286be7){logger[_0x1a64('0x13')](_0x1a64('0x41'),_0x286be7[_0x1a64('0x15')],_0x1273ab);_0xd6a7e0(_0x538547[_0x1a64('0x13')](0x1f4,_0x286be7[_0x1a64('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 3c868c2..fbedd8f 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 _0xfea9=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0xfea9,0x1d2));var _0x9fea=function(_0x16d1c4,_0x57610d){_0x16d1c4=_0x16d1c4-0x0;var _0x584b12=_0xfea9[_0x16d1c4];return _0x584b12;};'use strict';var multer=require(_0x9fea('0x0'));var util=require(_0x9fea('0x1'));var path=require(_0x9fea('0x2'));var timeout=require(_0x9fea('0x3'));var express=require(_0x9fea('0x4'));var router=express['Router']();var fs_extra=require(_0x9fea('0x5'));var auth=require(_0x9fea('0x6'));var interaction=require(_0x9fea('0x7'));var config=require(_0x9fea('0x8'));var controller=require(_0x9fea('0x9'));router[_0x9fea('0xa')]('/',auth[_0x9fea('0xb')](),controller[_0x9fea('0xc')]);router[_0x9fea('0xa')](_0x9fea('0xd'),auth[_0x9fea('0xb')](),controller['describe']);router[_0x9fea('0xa')](_0x9fea('0xe'),auth['isAuthenticated'](),controller[_0x9fea('0xf')]);router[_0x9fea('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9fea('0x11')](_0x9fea('0xe'),auth[_0x9fea('0xb')](),controller['update']);module[_0x9fea('0x12')]=router; \ No newline at end of file +var _0xaaa2=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','exports','multer','util'];(function(_0x45b900,_0x2d7019){var _0x40233d=function(_0xafe74f){while(--_0xafe74f){_0x45b900['push'](_0x45b900['shift']());}};_0x40233d(++_0x2d7019);}(_0xaaa2,0x152));var _0x2aaa=function(_0x30abb6,_0x48e934){_0x30abb6=_0x30abb6-0x0;var _0x13d60e=_0xaaa2[_0x30abb6];return _0x13d60e;};'use strict';var multer=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var path=require('path');var timeout=require(_0x2aaa('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2aaa('0x3'));var interaction=require(_0x2aaa('0x4'));var config=require(_0x2aaa('0x5'));var controller=require(_0x2aaa('0x6'));router[_0x2aaa('0x7')]('/',auth[_0x2aaa('0x8')](),controller[_0x2aaa('0x9')]);router[_0x2aaa('0x7')](_0x2aaa('0xa'),auth[_0x2aaa('0x8')](),controller[_0x2aaa('0xb')]);router[_0x2aaa('0x7')](_0x2aaa('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2aaa('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2aaa('0xe')](_0x2aaa('0xc'),auth[_0x2aaa('0x8')](),controller[_0x2aaa('0xf')]);module[_0x2aaa('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 c1afe37..f6aab1b 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 _0x2a3a=['exports','STRING','name','sequelize'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x13ce45,_0x5ce14d){_0x13ce45=_0x13ce45-0x0;var _0x537aab=_0x2a3a[_0x13ce45];return _0x537aab;};'use strict';var Sequelize=require(_0xa2a3('0x0'));module[_0xa2a3('0x1')]={'name':{'type':Sequelize[_0xa2a3('0x2')],'unique':_0xa2a3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2a3('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0f89=['sequelize','exports','STRING'];(function(_0x230f85,_0x2082cc){var _0x173b59=function(_0xe0c212){while(--_0xe0c212){_0x230f85['push'](_0x230f85['shift']());}};_0x173b59(++_0x2082cc);}(_0x0f89,0x111));var _0x90f8=function(_0x321679,_0x1549d5){_0x321679=_0x321679-0x0;var _0x54ccca=_0x0f89[_0x321679];return _0x54ccca;};'use strict';var Sequelize=require(_0x90f8('0x0'));module[_0x90f8('0x1')]={'name':{'type':Sequelize[_0x90f8('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x90f8('0x2')]},'dialPrefix':{'type':Sequelize[_0x90f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 91c61e2..f036710 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 _0x4b6a=['addAgents','emit','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','CmList','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','pick','Disposition','findAll','removeDispositions','CmContact','isArray','tags','join','push','each','omit','ids','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','queryInterface','addColumn','cm_contacts','cf_%s','findOne','findAndCountAll'];(function(_0x43c31e,_0x55a4f1){var _0xc24288=function(_0x55211f){while(--_0x55211f){_0x43c31e['push'](_0x43c31e['shift']());}};_0xc24288(++_0x55a4f1);}(_0x4b6a,0x193));var _0xa4b6=function(_0x48e278,_0x585b01){_0x48e278=_0x48e278-0x0;var _0x39d30c=_0x4b6a[_0x48e278];return _0x39d30c;};'use strict';var emlformat=require(_0xa4b6('0x0'));var rimraf=require(_0xa4b6('0x1'));var zipdir=require(_0xa4b6('0x2'));var jsonpatch=require(_0xa4b6('0x3'));var rp=require(_0xa4b6('0x4'));var moment=require(_0xa4b6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4b6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa4b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa4b6('0x8'));var _=require(_0xa4b6('0x9'));var squel=require(_0xa4b6('0xa'));var crypto=require(_0xa4b6('0xb'));var jsforce=require(_0xa4b6('0xc'));var deskjs=require(_0xa4b6('0xd'));var toCsv=require(_0xa4b6('0x7'));var querystring=require(_0xa4b6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4b6('0xf'));var logger=require(_0xa4b6('0x10'))(_0xa4b6('0x11'));var utils=require(_0xa4b6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa4b6('0x13')]=_[_0xa4b6('0x14')](config[_0xa4b6('0x13')],{'host':_0xa4b6('0x15'),'port':0x18eb});var socket=require(_0xa4b6('0x16'))(new Redis(config[_0xa4b6('0x13')]));require(_0xa4b6('0x17'))[_0xa4b6('0x18')](socket);function respondWithStatusCode(_0x2faae4,_0x1df3d3){_0x1df3d3=_0x1df3d3||0xcc;return function(_0x29f891){if(_0x29f891){return _0x2faae4[_0xa4b6('0x19')](_0x1df3d3);}return _0x2faae4[_0xa4b6('0x1a')](_0x1df3d3)[_0xa4b6('0x1b')]();};}function respondWithResult(_0x40b557,_0x1d99ef){_0x1d99ef=_0x1d99ef||0xc8;return function(_0x2e0e9a){if(_0x2e0e9a){return _0x40b557['status'](_0x1d99ef)['json'](_0x2e0e9a);}};}function respondWithFilteredResult(_0x1b7f5e,_0x1140d4){return function(_0x3c9374){if(_0x3c9374){var _0x47f6d9=typeof _0x1140d4[_0xa4b6('0x1c')]===_0xa4b6('0x1d')&&typeof _0x1140d4[_0xa4b6('0x1e')]===_0xa4b6('0x1d');var _0x4d8cf9=_0x3c9374['count'];var _0x2875aa=_0x47f6d9?0x0:_0x1140d4[_0xa4b6('0x1c')];var _0x3ec64e=_0x47f6d9?_0x3c9374[_0xa4b6('0x1f')]:_0x1140d4[_0xa4b6('0x1c')]+_0x1140d4[_0xa4b6('0x1e')];var _0x332a5c;if(_0x3ec64e>=_0x4d8cf9){_0x3ec64e=_0x4d8cf9;_0x332a5c=0xc8;}else{_0x332a5c=0xce;}_0x1b7f5e['status'](_0x332a5c);return _0x1b7f5e[_0xa4b6('0x20')](_0xa4b6('0x21'),_0x2875aa+'-'+_0x3ec64e+'/'+_0x4d8cf9)[_0xa4b6('0x22')](_0x3c9374);}return null;};}function patchUpdates(_0x5f4535){return function(_0x25adf8){try{jsonpatch[_0xa4b6('0x23')](_0x25adf8,_0x5f4535,!![]);}catch(_0x21d5da){return BPromise[_0xa4b6('0x24')](_0x21d5da);}return _0x25adf8[_0xa4b6('0x25')]();};}function saveUpdates(_0x31b7f4,_0x3ba108){return function(_0x5e7c70){if(_0x5e7c70){return _0x5e7c70[_0xa4b6('0x26')](_0x31b7f4)[_0xa4b6('0x27')](function(_0x5bedde){return _0x5bedde;});}return null;};}function removeEntity(_0x130a61,_0x5dde9d){return function(_0xf9ca78){if(_0xf9ca78){return _0xf9ca78['destroy']()['then'](function(){var _0x102fc3=_0xf9ca78[_0xa4b6('0x28')]({'plain':!![]});var _0x40b5d0=_0xa4b6('0x29');return db[_0xa4b6('0x2a')][_0xa4b6('0x2b')]({'where':{'type':_0x40b5d0,'resourceId':_0x102fc3['id']}})[_0xa4b6('0x27')](function(){return _0xf9ca78;});})[_0xa4b6('0x27')](function(){_0x130a61[_0xa4b6('0x1a')](0xcc)[_0xa4b6('0x1b')]();});}};}function handleEntityNotFound(_0xa708,_0x3fa095){return function(_0x50c169){if(!_0x50c169){_0xa708['sendStatus'](0x194);}return _0x50c169;};}function handleError(_0x35778e,_0x858a16){_0x858a16=_0x858a16||0x1f4;return function(_0x35397e){logger[_0xa4b6('0x2c')](_0x35397e[_0xa4b6('0x2d')]);if(_0x35397e['name']){delete _0x35397e[_0xa4b6('0x2e')];}_0x35778e['status'](_0x858a16)[_0xa4b6('0x2f')](_0x35397e);};}exports[_0xa4b6('0x30')]=function(_0x41c0e1,_0x1e9f1e){var _0x21477c={},_0x231769={},_0x27f465={'count':0x0,'rows':[]};var _0x1e048b=_[_0xa4b6('0x31')](db['CmList'][_0xa4b6('0x32')],function(_0x28aeb5){return{'name':_0x28aeb5[_0xa4b6('0x33')],'type':_0x28aeb5[_0xa4b6('0x34')]['key']};});_0x231769[_0xa4b6('0x35')]=_[_0xa4b6('0x31')](_0x1e048b,'name');_0x231769['query']=_[_0xa4b6('0x36')](_0x41c0e1[_0xa4b6('0x37')]);_0x231769[_0xa4b6('0x38')]=_[_0xa4b6('0x39')](_0x231769[_0xa4b6('0x35')],_0x231769[_0xa4b6('0x37')]);_0x21477c[_0xa4b6('0x3a')]=_[_0xa4b6('0x39')](_0x231769[_0xa4b6('0x35')],qs[_0xa4b6('0x3b')](_0x41c0e1[_0xa4b6('0x37')][_0xa4b6('0x3b')]));_0x21477c[_0xa4b6('0x3a')]=_0x21477c[_0xa4b6('0x3a')][_0xa4b6('0x3c')]?_0x21477c[_0xa4b6('0x3a')]:_0x231769[_0xa4b6('0x35')];if(!_0x41c0e1['query'][_0xa4b6('0x3d')](_0xa4b6('0x3e'))){_0x21477c[_0xa4b6('0x1e')]=qs[_0xa4b6('0x1e')](_0x41c0e1[_0xa4b6('0x37')][_0xa4b6('0x1e')]);_0x21477c[_0xa4b6('0x1c')]=qs[_0xa4b6('0x1c')](_0x41c0e1['query']['offset']);}_0x21477c[_0xa4b6('0x3f')]=qs['sort'](_0x41c0e1[_0xa4b6('0x37')][_0xa4b6('0x40')]);_0x21477c['where']=qs[_0xa4b6('0x38')](_['pick'](_0x41c0e1[_0xa4b6('0x37')],_0x231769['filters']),_0x1e048b);if(_0x41c0e1[_0xa4b6('0x37')][_0xa4b6('0x41')]){_0x21477c[_0xa4b6('0x42')]=_[_0xa4b6('0x43')](_0x21477c[_0xa4b6('0x42')],{'$or':_['map'](_0x1e048b,function(_0x4c75f7){if(_0x4c75f7[_0xa4b6('0x34')]!=='VIRTUAL'){var _0x996ea={};_0x996ea[_0x4c75f7['name']]={'$like':'%'+_0x41c0e1[_0xa4b6('0x37')][_0xa4b6('0x41')]+'%'};return _0x996ea;}})});}_0x21477c=_['merge']({},_0x21477c,_0x41c0e1[_0xa4b6('0x44')]);var _0x143adf={'where':_0x21477c[_0xa4b6('0x42')]};return db[_0xa4b6('0x45')]['count'](_0x143adf)[_0xa4b6('0x27')](function(_0x2e92c0){_0x27f465[_0xa4b6('0x1f')]=_0x2e92c0;if(_0x41c0e1['query'][_0xa4b6('0x46')]){_0x21477c[_0xa4b6('0x47')]=[{'all':!![]}];}return db[_0xa4b6('0x45')]['findAll'](_0x21477c);})[_0xa4b6('0x27')](function(_0xf88b4b){_0x27f465[_0xa4b6('0x48')]=_0xf88b4b;return _0x27f465;})[_0xa4b6('0x27')](respondWithFilteredResult(_0x1e9f1e,_0x21477c))[_0xa4b6('0x49')](handleError(_0x1e9f1e,null));};exports[_0xa4b6('0x4a')]=function(_0x22841c,_0x1a6cb3){var _0x81339a={'raw':![],'where':{'id':_0x22841c[_0xa4b6('0x4b')]['id']}},_0x4b8583={};_0x4b8583['model']=_[_0xa4b6('0x36')](db[_0xa4b6('0x45')][_0xa4b6('0x32')]);_0x4b8583[_0xa4b6('0x37')]=_[_0xa4b6('0x36')](_0x22841c[_0xa4b6('0x37')]);_0x4b8583['filters']=_['intersection'](_0x4b8583[_0xa4b6('0x35')],_0x4b8583[_0xa4b6('0x37')]);_0x81339a['attributes']=_[_0xa4b6('0x39')](_0x4b8583[_0xa4b6('0x35')],qs[_0xa4b6('0x3b')](_0x22841c[_0xa4b6('0x37')][_0xa4b6('0x3b')]));_0x81339a[_0xa4b6('0x3a')]=_0x81339a[_0xa4b6('0x3a')][_0xa4b6('0x3c')]?_0x81339a[_0xa4b6('0x3a')]:_0x4b8583[_0xa4b6('0x35')];if(_0x22841c[_0xa4b6('0x37')][_0xa4b6('0x46')]){_0x81339a['include']=[{'all':!![]}];}_0x81339a=_[_0xa4b6('0x43')]({},_0x81339a,_0x22841c[_0xa4b6('0x44')]);return db['CmList'][_0xa4b6('0x4c')](_0x81339a)[_0xa4b6('0x27')](handleEntityNotFound(_0x1a6cb3,null))['then'](respondWithResult(_0x1a6cb3,null))[_0xa4b6('0x49')](handleError(_0x1a6cb3,null));};exports[_0xa4b6('0x4d')]=function(_0x3e0c3a,_0xb67370){return db[_0xa4b6('0x45')][_0xa4b6('0x4d')](_0x3e0c3a[_0xa4b6('0x4e')],{})['then'](function(_0x357154){var _0x54a177=_0x3e0c3a[_0xa4b6('0x4f')][_0xa4b6('0x28')]({'plain':!![]});if(!_0x54a177)throw new Error(_0xa4b6('0x50'));if(_0x54a177[_0xa4b6('0x51')]===_0xa4b6('0x4f')){var _0xa79c38=_0x357154[_0xa4b6('0x28')]({'plain':!![]});var _0x2d6ad9='Lists';return db[_0xa4b6('0x52')][_0xa4b6('0x4c')]({'where':{'name':_0x2d6ad9,'userProfileId':_0x54a177['userProfileId']},'raw':!![]})[_0xa4b6('0x27')](function(_0x3e07ac){if(_0x3e07ac&&_0x3e07ac['autoAssociation']===0x0){return db[_0xa4b6('0x2a')][_0xa4b6('0x4d')]({'name':_0xa79c38[_0xa4b6('0x2e')],'resourceId':_0xa79c38['id'],'type':_0x3e07ac[_0xa4b6('0x2e')],'sectionId':_0x3e07ac['id']},{})[_0xa4b6('0x27')](function(){return _0x357154;});}else{return _0x357154;}})[_0xa4b6('0x49')](function(_0x12cccd){logger['error'](_0xa4b6('0x53'),_0x12cccd);throw _0x12cccd;});}return _0x357154;})['then'](respondWithResult(_0xb67370,0xc9))[_0xa4b6('0x49')](handleError(_0xb67370,null));};exports['update']=function(_0x3d1ae0,_0x305fb5){if(_0x3d1ae0['body']['id']){delete _0x3d1ae0[_0xa4b6('0x4e')]['id'];}return db[_0xa4b6('0x45')][_0xa4b6('0x4c')]({'where':{'id':_0x3d1ae0['params']['id']}})['then'](handleEntityNotFound(_0x305fb5,null))[_0xa4b6('0x27')](saveUpdates(_0x3d1ae0[_0xa4b6('0x4e')],null))['then'](respondWithResult(_0x305fb5,null))[_0xa4b6('0x49')](handleError(_0x305fb5,null));};exports[_0xa4b6('0x2b')]=function(_0x4460f1,_0x31b44e){return db[_0xa4b6('0x45')][_0xa4b6('0x4c')]({'where':{'id':_0x4460f1[_0xa4b6('0x4b')]['id']}})[_0xa4b6('0x27')](handleEntityNotFound(_0x31b44e,null))['then'](removeEntity(_0x31b44e,null))['catch'](handleError(_0x31b44e,null));};exports['describe']=function(_0x498280,_0x5c7c49){return db[_0xa4b6('0x45')]['describe']()[_0xa4b6('0x27')](respondWithResult(_0x5c7c49,null))[_0xa4b6('0x49')](handleError(_0x5c7c49,null));};exports[_0xa4b6('0x54')]=function(_0x66fe38,_0x1f300a,_0x19d6f3){if(_0x66fe38[_0xa4b6('0x4e')]['id']){delete _0x66fe38[_0xa4b6('0x4e')]['id'];}return db[_0xa4b6('0x45')][_0xa4b6('0x4c')]({'where':{'id':_0x66fe38[_0xa4b6('0x4b')]['id']}})[_0xa4b6('0x27')](handleEntityNotFound(_0x1f300a,null))[_0xa4b6('0x27')](function(_0x3426e9){if(_0x3426e9){_0x66fe38[_0xa4b6('0x4e')][_0xa4b6('0x55')]=_0x3426e9['id'];return db['Disposition'][_0xa4b6('0x4d')](_0x66fe38[_0xa4b6('0x4e')]);}})[_0xa4b6('0x27')](respondWithResult(_0x1f300a,null))[_0xa4b6('0x49')](handleError(_0x1f300a,null));};exports['getDispositions']=function(_0x2751e9,_0x3fd39d,_0x256e17){var _0x461044={'raw':![],'where':{}};var _0x124bb0={};var _0xb33b2d={'count':0x0,'rows':[]};return db[_0xa4b6('0x45')]['findOne']({'where':{'id':_0x2751e9[_0xa4b6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3fd39d,null))['then'](function(_0x1280c3){if(_0x1280c3){_0x124bb0[_0xa4b6('0x35')]=_[_0xa4b6('0x36')](db['Disposition'][_0xa4b6('0x32')]);_0x124bb0['query']=_[_0xa4b6('0x36')](_0x2751e9[_0xa4b6('0x37')]);_0x124bb0[_0xa4b6('0x38')]=_['intersection'](_0x124bb0['model'],_0x124bb0[_0xa4b6('0x37')]);_0x461044['attributes']=_[_0xa4b6('0x39')](_0x124bb0[_0xa4b6('0x35')],qs[_0xa4b6('0x3b')](_0x2751e9[_0xa4b6('0x37')][_0xa4b6('0x3b')]));_0x461044[_0xa4b6('0x3a')]=_0x461044['attributes'][_0xa4b6('0x3c')]?_0x461044[_0xa4b6('0x3a')]:_0x124bb0['model'];if(!_0x2751e9[_0xa4b6('0x37')][_0xa4b6('0x3d')]('nolimit')){_0x461044[_0xa4b6('0x1e')]=qs[_0xa4b6('0x1e')](_0x2751e9[_0xa4b6('0x37')]['limit']);_0x461044[_0xa4b6('0x1c')]=qs[_0xa4b6('0x1c')](_0x2751e9[_0xa4b6('0x37')]['offset']);}_0x461044[_0xa4b6('0x3f')]=qs[_0xa4b6('0x40')](_0x2751e9[_0xa4b6('0x37')]['sort']);_0x461044[_0xa4b6('0x42')]=qs[_0xa4b6('0x38')](_[_0xa4b6('0x56')](_0x2751e9[_0xa4b6('0x37')],_0x124bb0['filters']));_0x461044[_0xa4b6('0x42')][_0xa4b6('0x55')]=_0x1280c3['id'];if(_0x2751e9[_0xa4b6('0x37')][_0xa4b6('0x41')]){_0x461044[_0xa4b6('0x42')]=_[_0xa4b6('0x43')](_0x461044[_0xa4b6('0x42')],{'$or':_['map'](_0x461044['attributes'],function(_0x67c53){var _0x34833e={};_0x34833e[_0x67c53]={'$like':'%'+_0x2751e9[_0xa4b6('0x37')][_0xa4b6('0x41')]+'%'};return _0x34833e;})});}_0x461044=_[_0xa4b6('0x43')]({},_0x461044,_0x2751e9['options']);return db['Disposition'][_0xa4b6('0x1f')]({'where':_0x461044[_0xa4b6('0x42')]})['then'](function(_0x38ae3f){_0xb33b2d['count']=_0x38ae3f;if(_0x2751e9[_0xa4b6('0x37')][_0xa4b6('0x46')]){_0x461044[_0xa4b6('0x47')]=[{'all':!![]}];}return db[_0xa4b6('0x57')][_0xa4b6('0x58')](_0x461044);})['then'](function(_0x198e23){_0xb33b2d[_0xa4b6('0x48')]=_0x198e23;return _0xb33b2d;});}})['then'](respondWithFilteredResult(_0x3fd39d,_0x461044))['catch'](handleError(_0x3fd39d,null));};exports[_0xa4b6('0x59')]=function(_0x149a1a,_0x561f7d,_0x4d3735){return db[_0xa4b6('0x45')][_0xa4b6('0x4c')]({'where':{'id':_0x149a1a[_0xa4b6('0x4b')]['id']}})[_0xa4b6('0x27')](handleEntityNotFound(_0x561f7d,null))[_0xa4b6('0x27')](function(_0x202dd9){if(_0x202dd9){return _0x202dd9[_0xa4b6('0x59')](_0x149a1a[_0xa4b6('0x37')]['ids']);}})[_0xa4b6('0x27')](respondWithStatusCode(_0x561f7d,null))[_0xa4b6('0x49')](handleError(_0x561f7d,null));};exports['addContacts']=function(_0x3f645c,_0x38b3b9,_0x11a22f){return db[_0xa4b6('0x45')]['find']({'where':{'id':_0x3f645c['params']['id']}})['then'](handleEntityNotFound(_0x38b3b9,null))['then'](function(_0x2f76b9){if(_0x2f76b9){var _0x1c3ca5=[];var _0x195c66={'success':[],'errors':[]};return db[_0xa4b6('0x5a')]['describe']()[_0xa4b6('0x27')](function(_0xb251b2){if(_0x3f645c[_0xa4b6('0x4e')]['tags']&&_[_0xa4b6('0x5b')](_0x3f645c[_0xa4b6('0x4e')]['tags'])){if(_0x3f645c[_0xa4b6('0x4e')][_0xa4b6('0x5c')][_0xa4b6('0x3c')]){_0x3f645c[_0xa4b6('0x4e')][_0xa4b6('0x5c')]=_0x3f645c[_0xa4b6('0x4e')][_0xa4b6('0x5c')][_0xa4b6('0x5d')](';')+';';}else{_0x3f645c[_0xa4b6('0x4e')]['tags']=null;}}else{_0x3f645c[_0xa4b6('0x4e')][_0xa4b6('0x5c')]=null;}if(_0x3f645c[_0xa4b6('0x4e')]&&_[_0xa4b6('0x5b')](_0x3f645c[_0xa4b6('0x4e')])){for(var _0xd10834=0x0;_0xd10834<_0x3f645c[_0xa4b6('0x4e')]['length'];_0xd10834+=0x1){_0x3f645c['body'][_0xd10834]['ListId']=_0x3f645c[_0xa4b6('0x4b')]['id'];_0x1c3ca5[_0xa4b6('0x5e')](_0x3f645c[_0xa4b6('0x4e')][_0xd10834]);}return BPromise[_0xa4b6('0x5f')](_0x1c3ca5,function(_0x1f75aa){return db[_0xa4b6('0x5a')][_0xa4b6('0x4d')](_[_0xa4b6('0x60')](_0x1f75aa,[_0xa4b6('0x61'),'id'])||{},{'fields':_[_0xa4b6('0x36')](_0xb251b2),'raw':!![]})[_0xa4b6('0x27')](function(_0x583c49){_0x195c66['success'][_0xa4b6('0x5e')](_0x583c49[_0xa4b6('0x62')]);})[_0xa4b6('0x49')](function(_0xcddde0){_0x195c66[_0xa4b6('0x63')][_0xa4b6('0x5e')]({'data':_0x1f75aa,'error':_0xcddde0[_0xa4b6('0x64')]});});})['then'](function(_0x80ba35){return _0x195c66;})[_0xa4b6('0x49')](function(_0x5455c1){return _0x5455c1;});}else{_0x38b3b9[_0xa4b6('0x1a')](0x190)[_0xa4b6('0x22')]({'message':_0xa4b6('0x65')});}});}})[_0xa4b6('0x27')](respondWithResult(_0x38b3b9,null))[_0xa4b6('0x49')](handleError(_0x38b3b9,null));};exports[_0xa4b6('0x66')]=function(_0x2f89e3,_0x435777,_0x4f4cb5){var _0x539cd1;return db[_0xa4b6('0x45')][_0xa4b6('0x4c')]({'where':{'id':_0x2f89e3['params']['id']},'include':[{'model':db[_0xa4b6('0x67')],'as':_0xa4b6('0x68')}]})[_0xa4b6('0x27')](handleEntityNotFound(_0x435777,null))[_0xa4b6('0x27')](function(_0x5b8047){if(_0x5b8047){_0x539cd1=_0x5b8047;return db[_0xa4b6('0x5a')][_0xa4b6('0x32')];}})['then'](function(_0x59ce2d){if(_0x59ce2d){var _0x4b24fe={};var _0x2b012c={};_0x2b012c[_0xa4b6('0x35')]=_[_0xa4b6('0x69')](_[_0xa4b6('0x36')](_0x59ce2d),_[_0xa4b6('0x31')](_0x539cd1[_0xa4b6('0x68')],function(_0x21af35){return util[_0xa4b6('0x6a')](_0xa4b6('0x6b'),_0x21af35['id']);}));_0x2b012c[_0xa4b6('0x37')]=_[_0xa4b6('0x36')](_0x2f89e3['query']);_0x2b012c[_0xa4b6('0x38')]=_[_0xa4b6('0x39')](_0x2b012c[_0xa4b6('0x35')],_0x2b012c[_0xa4b6('0x37')]);_0x4b24fe[_0xa4b6('0x3a')]=_['intersection'](_0x2b012c['model'],qs[_0xa4b6('0x3b')](_0x2f89e3[_0xa4b6('0x37')][_0xa4b6('0x3b')]));_0x4b24fe[_0xa4b6('0x3a')]=_0x4b24fe[_0xa4b6('0x3a')][_0xa4b6('0x3c')]?_0x4b24fe[_0xa4b6('0x3a')]:_0x2b012c[_0xa4b6('0x35')];if(!_0x2f89e3[_0xa4b6('0x37')][_0xa4b6('0x3d')](_0xa4b6('0x3e'))){_0x4b24fe[_0xa4b6('0x1e')]=qs[_0xa4b6('0x1e')](_0x2f89e3[_0xa4b6('0x37')][_0xa4b6('0x1e')]);_0x4b24fe[_0xa4b6('0x1c')]=qs[_0xa4b6('0x1c')](_0x2f89e3[_0xa4b6('0x37')]['offset']);}_0x4b24fe[_0xa4b6('0x3f')]=qs[_0xa4b6('0x40')](_0x2f89e3['query'][_0xa4b6('0x40')]);_0x4b24fe['where']=qs[_0xa4b6('0x38')](_[_0xa4b6('0x56')](_0x2f89e3['query'],_0x2b012c[_0xa4b6('0x38')]));_0x4b24fe['raw']=!![];if(_0x2f89e3[_0xa4b6('0x37')]['filter']){_0x4b24fe[_0xa4b6('0x42')]=_[_0xa4b6('0x43')](_0x4b24fe['where'],{'$or':_['map'](_0x4b24fe[_0xa4b6('0x3a')],function(_0x2c7ce1){var _0x4249aa={};_0x4249aa[_0x2c7ce1]={'$like':'%'+_0x2f89e3['query'][_0xa4b6('0x41')]+'%'};return _0x4249aa;})});}_0x4b24fe=_[_0xa4b6('0x43')]({},_0x4b24fe,_0x2f89e3['options']);return _0x539cd1[_0xa4b6('0x66')](_0x4b24fe);}})[_0xa4b6('0x27')](respondWithResult(_0x435777,null))[_0xa4b6('0x49')](handleError(_0x435777,null));};exports[_0xa4b6('0x6c')]=function(_0x1489bb,_0x56cb1f,_0x13b0ba){var _0x8f73e5;return db[_0xa4b6('0x45')][_0xa4b6('0x4c')]({'where':{'id':_0x1489bb['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xa4b6('0x68')}]})[_0xa4b6('0x27')](handleEntityNotFound(_0x56cb1f,null))[_0xa4b6('0x27')](function(_0xce8ef9){if(_0xce8ef9){_0x8f73e5=_0xce8ef9;return db[_0xa4b6('0x5a')][_0xa4b6('0x32')];}})[_0xa4b6('0x27')](function(_0x368763){if(_0x368763){var _0x2ec4a5={};var _0x5ec857={};_0x5ec857[_0xa4b6('0x35')]=_[_0xa4b6('0x69')](_[_0xa4b6('0x36')](_0x368763),_[_0xa4b6('0x31')](_0x8f73e5[_0xa4b6('0x68')],function(_0x58867e){return util[_0xa4b6('0x6a')](_0xa4b6('0x6b'),_0x58867e['id']);}));_0x5ec857['query']=_[_0xa4b6('0x36')](_0x1489bb[_0xa4b6('0x37')]);_0x5ec857[_0xa4b6('0x38')]=_[_0xa4b6('0x39')](_0x5ec857['model'],_0x5ec857['query']);_0x2ec4a5['attributes']=_[_0xa4b6('0x39')](_0x5ec857[_0xa4b6('0x35')],qs[_0xa4b6('0x3b')](_0x1489bb['query'][_0xa4b6('0x3b')]));_0x2ec4a5['attributes']=_0x2ec4a5['attributes'][_0xa4b6('0x3c')]?_0x2ec4a5[_0xa4b6('0x3a')]:_0x5ec857[_0xa4b6('0x35')];if(!_0x1489bb[_0xa4b6('0x37')][_0xa4b6('0x3d')](_0xa4b6('0x3e'))){_0x2ec4a5[_0xa4b6('0x1e')]=qs['limit'](_0x1489bb[_0xa4b6('0x37')][_0xa4b6('0x1e')]);_0x2ec4a5[_0xa4b6('0x1c')]=qs['offset'](_0x1489bb[_0xa4b6('0x37')][_0xa4b6('0x1c')]);}_0x2ec4a5[_0xa4b6('0x3f')]=qs['sort'](_0x1489bb[_0xa4b6('0x37')][_0xa4b6('0x40')]);_0x2ec4a5[_0xa4b6('0x42')]=qs[_0xa4b6('0x38')](_[_0xa4b6('0x56')](_0x1489bb['query'],_0x5ec857[_0xa4b6('0x38')]));_0x2ec4a5['raw']=!![];if(_0x1489bb[_0xa4b6('0x37')][_0xa4b6('0x41')]){_0x2ec4a5[_0xa4b6('0x42')]=_[_0xa4b6('0x43')](_0x2ec4a5['where'],{'$or':_[_0xa4b6('0x31')](_0x2ec4a5[_0xa4b6('0x3a')],function(_0xd600e4){var _0x2ba1e7={};_0x2ba1e7[_0xd600e4]={'$like':'%'+_0x1489bb[_0xa4b6('0x37')][_0xa4b6('0x41')]+'%'};return _0x2ba1e7;})});}_0x2ec4a5=_[_0xa4b6('0x43')]({},_0x2ec4a5,_0x1489bb['options']);return _0x8f73e5[_0xa4b6('0x66')](_0x2ec4a5);}})[_0xa4b6('0x27')](function(_0x12d610){if(!_['isEmpty'](_0x12d610)){var _0x13822c=toCsv(_0x12d610);var _0x32e8c1=Date['now']();fs[_0xa4b6('0x6d')](util['format'](_0xa4b6('0x6e'),_0x8f73e5['id'],_0x32e8c1),_0x13822c);_0x56cb1f[_0xa4b6('0x6f')](_0xa4b6('0x70'),'attachment;\x20filename='+util['format']('list_%d_%s.csv',_0x8f73e5['id'],_0x32e8c1));_0x56cb1f[_0xa4b6('0x6f')](_0xa4b6('0x71'),'text/csv');return _0x56cb1f[_0xa4b6('0x72')](util[_0xa4b6('0x6a')]('/tmp/list_%d_%s.csv',_0x8f73e5['id'],_0x32e8c1));}else{return _0x56cb1f[_0xa4b6('0x19')](0xcc);}})[_0xa4b6('0x49')](handleError(_0x56cb1f,null));};exports['addCustomField']=function(_0xa5a4d0,_0x35cd88,_0x486879){var _0x30b403;delete _0xa5a4d0['body']['id'];return db[_0xa4b6('0x45')]['findOne']({'where':{'id':_0xa5a4d0[_0xa4b6('0x4b')]['id']}})[_0xa4b6('0x27')](handleEntityNotFound(_0x35cd88,null))[_0xa4b6('0x27')](function(_0x2cd9c9){if(_0x2cd9c9){return db[_0xa4b6('0x73')][_0xa4b6('0x74')](function(_0x2b462a){return db['CmCustomField'][_0xa4b6('0x4d')](_0xa5a4d0[_0xa4b6('0x4e')],{'transaction':_0x2b462a})['then'](function(_0x343dd3){_0x30b403=_0x343dd3;return _0x2cd9c9[_0xa4b6('0x75')](_0x343dd3,{'transaction':_0x2b462a});})[_0xa4b6('0x27')](function(){var _0x3e004c={'type':db[_0xa4b6('0x76')][_0xa4b6('0x77')],'transaction':_0x2b462a};switch(_0xa5a4d0['body'][_0xa4b6('0x34')]){case'text':_0x3e004c[_0xa4b6('0x34')]=db[_0xa4b6('0x76')][_0xa4b6('0x77')];break;case _0xa4b6('0x78'):_0x3e004c[_0xa4b6('0x34')]=db['Sequelize'][_0xa4b6('0x79')];break;case _0xa4b6('0x7a'):_0x3e004c['type']=db[_0xa4b6('0x76')]['BOOLEAN'];_0x3e004c['defaultValue']=![];break;default:}return db['sequelize'][_0xa4b6('0x7b')][_0xa4b6('0x7c')](_0xa4b6('0x7d'),util['format'](_0xa4b6('0x7e'),_0x30b403['id']),_0x3e004c);})['then'](function(){return _0x30b403;});});}})[_0xa4b6('0x27')](respondWithResult(_0x35cd88,null))['catch'](handleError(_0x35cd88,null));};exports['getCustomFields']=function(_0x43ccb3,_0x2ed6ed,_0xb71ddb){var _0x5e4028={};var _0x255f99={};var _0x3701af;var _0x820d25;return db['CmList'][_0xa4b6('0x7f')]({'where':{'id':_0x43ccb3[_0xa4b6('0x4b')]['id']}})[_0xa4b6('0x27')](handleEntityNotFound(_0x2ed6ed,null))[_0xa4b6('0x27')](function(_0x5d36ec){if(_0x5d36ec){_0x3701af=_0x5d36ec;_0x255f99[_0xa4b6('0x35')]=_['keys'](db[_0xa4b6('0x67')][_0xa4b6('0x32')]);_0x255f99[_0xa4b6('0x37')]=_[_0xa4b6('0x36')](_0x43ccb3[_0xa4b6('0x37')]);_0x255f99['filters']=_['intersection'](_0x255f99[_0xa4b6('0x35')],_0x255f99[_0xa4b6('0x37')]);_0x5e4028['attributes']=_[_0xa4b6('0x39')](_0x255f99[_0xa4b6('0x35')],qs['fields'](_0x43ccb3['query'][_0xa4b6('0x3b')]));_0x5e4028['attributes']=_0x5e4028[_0xa4b6('0x3a')][_0xa4b6('0x3c')]?_0x5e4028['attributes']:_0x255f99['model'];_0x5e4028[_0xa4b6('0x3f')]=qs[_0xa4b6('0x40')](_0x43ccb3['query']['sort']);_0x5e4028[_0xa4b6('0x42')]=qs['filters'](_[_0xa4b6('0x56')](_0x43ccb3[_0xa4b6('0x37')],_0x255f99[_0xa4b6('0x38')]));_0x5e4028[_0xa4b6('0x42')]=_[_0xa4b6('0x43')](_0x5e4028[_0xa4b6('0x42')],{'$or':[{'ListId':_0x5d36ec['id']},{'ListId':null}]});if(_0x43ccb3['query'][_0xa4b6('0x41')]){_0x5e4028[_0xa4b6('0x42')]=_[_0xa4b6('0x43')](_0x5e4028['where'],{'$or':_[_0xa4b6('0x31')](_0x5e4028[_0xa4b6('0x3a')],function(_0x20e73a){var _0x292c89={};_0x292c89[_0x20e73a]={'$like':'%'+_0x43ccb3[_0xa4b6('0x37')][_0xa4b6('0x41')]+'%'};return _0x292c89;})});}_0x5e4028=_[_0xa4b6('0x43')]({},_0x5e4028,_0x43ccb3['options']);return db[_0xa4b6('0x67')][_0xa4b6('0x80')](_0x5e4028);}})[_0xa4b6('0x27')](respondWithResult(_0x2ed6ed,null))[_0xa4b6('0x49')](handleError(_0x2ed6ed,null));};exports['addAgents']=function(_0x3eee3e,_0x2717ba,_0x2575ce){return db['CmList'][_0xa4b6('0x4c')]({'where':{'id':_0x3eee3e['params']['id']}})['then'](handleEntityNotFound(_0x2717ba,null))[_0xa4b6('0x27')](function(_0x476d53){if(_0x476d53){return _0x476d53[_0xa4b6('0x81')](_0x3eee3e[_0xa4b6('0x4e')][_0xa4b6('0x61')],_[_0xa4b6('0x60')](_0x3eee3e[_0xa4b6('0x4e')],[_0xa4b6('0x61'),'id'])||{})['spread'](function(_0x1d5e49){for(var _0x5f0372=0x0;_0x5f0372<_0x3eee3e['body'][_0xa4b6('0x61')][_0xa4b6('0x3c')];_0x5f0372+=0x1){socket[_0xa4b6('0x82')]('userCmList:save',{'UserId':Number(_0x3eee3e[_0xa4b6('0x4e')][_0xa4b6('0x61')][_0x5f0372]),'CmListId':Number(_0x3eee3e[_0xa4b6('0x4b')]['id'])});}return _0x1d5e49;});}})[_0xa4b6('0x27')](respondWithResult(_0x2717ba,null))['catch'](handleError(_0x2717ba,null));};exports[_0xa4b6('0x83')]=function(_0x5d405c,_0x4e3a0a,_0x29e8ff){return db[_0xa4b6('0x45')][_0xa4b6('0x4c')]({'where':{'id':_0x5d405c[_0xa4b6('0x4b')]['id']}})[_0xa4b6('0x27')](handleEntityNotFound(_0x4e3a0a,null))[_0xa4b6('0x27')](function(_0x4b9a1b){if(_0x4b9a1b){return _0x4b9a1b[_0xa4b6('0x83')](_0x5d405c[_0xa4b6('0x37')][_0xa4b6('0x61')])[_0xa4b6('0x27')](function(){if(_['isArray'](_0x5d405c['query']['ids'])){for(var _0x8ace4e=0x0;_0x8ace4e<_0x5d405c['query'][_0xa4b6('0x61')][_0xa4b6('0x3c')];_0x8ace4e+=0x1){socket[_0xa4b6('0x82')]('userCmList:remove',{'UserId':Number(_0x5d405c[_0xa4b6('0x37')]['ids'][_0x8ace4e]),'CmListId':Number(_0x5d405c[_0xa4b6('0x4b')]['id'])});}}else{socket[_0xa4b6('0x82')]('userCmList:remove',{'UserId':Number(_0x5d405c['query']['ids']),'CmListId':Number(_0x5d405c['params']['id'])});}});}})[_0xa4b6('0x27')](respondWithStatusCode(_0x4e3a0a,null))[_0xa4b6('0x49')](handleError(_0x4e3a0a,null));};exports['getAgents']=function(_0xdcd3a2,_0x4fa3ac,_0x5e2f16){var _0x562e57={};var _0x3e473e={};var _0x4277ed;var _0x102220;return db['CmList'][_0xa4b6('0x7f')]({'where':{'id':_0xdcd3a2['params']['id']}})[_0xa4b6('0x27')](handleEntityNotFound(_0x4fa3ac,null))[_0xa4b6('0x27')](function(_0x150725){if(_0x150725){_0x4277ed=_0x150725;_0x3e473e[_0xa4b6('0x35')]=_[_0xa4b6('0x36')](db['User'][_0xa4b6('0x32')]);_0x3e473e[_0xa4b6('0x37')]=_[_0xa4b6('0x36')](_0xdcd3a2['query']);_0x3e473e['filters']=_[_0xa4b6('0x39')](_0x3e473e[_0xa4b6('0x35')],_0x3e473e['query']);_0x562e57[_0xa4b6('0x3a')]=_[_0xa4b6('0x39')](_0x3e473e[_0xa4b6('0x35')],qs['fields'](_0xdcd3a2[_0xa4b6('0x37')]['fields']));_0x562e57['attributes']=_0x562e57[_0xa4b6('0x3a')][_0xa4b6('0x3c')]?_0x562e57['attributes']:_0x3e473e[_0xa4b6('0x35')];_0x562e57[_0xa4b6('0x3f')]=qs['sort'](_0xdcd3a2[_0xa4b6('0x37')][_0xa4b6('0x40')]);_0x562e57[_0xa4b6('0x42')]=qs[_0xa4b6('0x38')](_[_0xa4b6('0x56')](_0xdcd3a2[_0xa4b6('0x37')],_0x3e473e[_0xa4b6('0x38')]));if(_0xdcd3a2['query']['filter']){_0x562e57['where']=_['merge'](_0x562e57[_0xa4b6('0x42')],{'$or':_[_0xa4b6('0x31')](_0x562e57[_0xa4b6('0x3a')],function(_0x300d7c){var _0x5d82e0={};_0x5d82e0[_0x300d7c]={'$like':'%'+_0xdcd3a2[_0xa4b6('0x37')][_0xa4b6('0x41')]+'%'};return _0x5d82e0;})});}_0x562e57=_[_0xa4b6('0x43')]({},_0x562e57,_0xdcd3a2['options']);return _0x4277ed[_0xa4b6('0x84')](_0x562e57);}})[_0xa4b6('0x27')](function(_0x2791a6){if(_0x2791a6){_0x102220=_0x2791a6['length'];if(!_0xdcd3a2[_0xa4b6('0x37')][_0xa4b6('0x3d')]('nolimit')){_0x562e57['limit']=qs['limit'](_0xdcd3a2[_0xa4b6('0x37')][_0xa4b6('0x1e')]);_0x562e57[_0xa4b6('0x1c')]=qs[_0xa4b6('0x1c')](_0xdcd3a2[_0xa4b6('0x37')]['offset']);}return _0x4277ed[_0xa4b6('0x84')](_0x562e57);}})[_0xa4b6('0x27')](function(_0x1b048a){if(_0x1b048a){return _0x1b048a?{'count':_0x102220,'rows':_0x1b048a}:null;}})[_0xa4b6('0x27')](respondWithResult(_0x4fa3ac,null))[_0xa4b6('0x49')](handleError(_0x4fa3ac,null));}; \ No newline at end of file +var _0x6e46=['reject','update','then','destroy','get','Lists','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','filters','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','isEmpty','now','format','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6e46,0x188));var _0x66e4=function(_0x341cd1,_0x11bde8){_0x341cd1=_0x341cd1-0x0;var _0x3516cb=_0x6e46[_0x341cd1];return _0x3516cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66e4('0x0'));var zipdir=require(_0x66e4('0x1'));var jsonpatch=require(_0x66e4('0x2'));var rp=require(_0x66e4('0x3'));var moment=require('moment');var BPromise=require(_0x66e4('0x4'));var Mustache=require(_0x66e4('0x5'));var util=require(_0x66e4('0x6'));var path=require(_0x66e4('0x7'));var sox=require(_0x66e4('0x8'));var csv=require('to-csv');var ejs=require(_0x66e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66e4('0xa'));var squel=require('squel');var crypto=require(_0x66e4('0xb'));var jsforce=require(_0x66e4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x66e4('0xd'));var Papa=require(_0x66e4('0xe'));var Redis=require(_0x66e4('0xf'));var authService=require(_0x66e4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x66e4('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x66e4('0x12')]=_[_0x66e4('0x13')](config[_0x66e4('0x12')],{'host':_0x66e4('0x14'),'port':0x18eb});var socket=require(_0x66e4('0x15'))(new Redis(config[_0x66e4('0x12')]));require('./cmList.socket')[_0x66e4('0x16')](socket);function respondWithStatusCode(_0x5008f9,_0x4a440b){_0x4a440b=_0x4a440b||0xcc;return function(_0x2171f3){if(_0x2171f3){return _0x5008f9[_0x66e4('0x17')](_0x4a440b);}return _0x5008f9[_0x66e4('0x18')](_0x4a440b)['end']();};}function respondWithResult(_0x2d4006,_0x3d4a8d){_0x3d4a8d=_0x3d4a8d||0xc8;return function(_0x16b6d6){if(_0x16b6d6){return _0x2d4006['status'](_0x3d4a8d)[_0x66e4('0x19')](_0x16b6d6);}};}function respondWithFilteredResult(_0x14fc6b,_0x4479e9){return function(_0x2b4a0d){if(_0x2b4a0d){var _0x2387e1=typeof _0x4479e9[_0x66e4('0x1a')]==='undefined'&&typeof _0x4479e9[_0x66e4('0x1b')]===_0x66e4('0x1c');var _0x3e08c0=_0x2b4a0d['count'];var _0x56c573=_0x2387e1?0x0:_0x4479e9[_0x66e4('0x1a')];var _0x216f1d=_0x2387e1?_0x2b4a0d[_0x66e4('0x1d')]:_0x4479e9['offset']+_0x4479e9[_0x66e4('0x1b')];var _0x3e802f;if(_0x216f1d>=_0x3e08c0){_0x216f1d=_0x3e08c0;_0x3e802f=0xc8;}else{_0x3e802f=0xce;}_0x14fc6b[_0x66e4('0x18')](_0x3e802f);return _0x14fc6b['set'](_0x66e4('0x1e'),_0x56c573+'-'+_0x216f1d+'/'+_0x3e08c0)[_0x66e4('0x19')](_0x2b4a0d);}return null;};}function patchUpdates(_0x26ab73){return function(_0x48319f){try{jsonpatch['apply'](_0x48319f,_0x26ab73,!![]);}catch(_0x108971){return BPromise[_0x66e4('0x1f')](_0x108971);}return _0x48319f['save']();};}function saveUpdates(_0x176d2a,_0x48c618){return function(_0x344928){if(_0x344928){return _0x344928[_0x66e4('0x20')](_0x176d2a)[_0x66e4('0x21')](function(_0x228617){return _0x228617;});}return null;};}function removeEntity(_0x5bec5a,_0x35ef2f){return function(_0x51c080){if(_0x51c080){return _0x51c080[_0x66e4('0x22')]()[_0x66e4('0x21')](function(){var _0x348e57=_0x51c080[_0x66e4('0x23')]({'plain':!![]});var _0x63cff4=_0x66e4('0x24');return db['UserProfileResource'][_0x66e4('0x22')]({'where':{'type':_0x63cff4,'resourceId':_0x348e57['id']}})['then'](function(){return _0x51c080;});})[_0x66e4('0x21')](function(){_0x5bec5a[_0x66e4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x192bf3,_0x327eea){return function(_0x404111){if(!_0x404111){_0x192bf3['sendStatus'](0x194);}return _0x404111;};}function handleError(_0x39296f,_0x5f1589){_0x5f1589=_0x5f1589||0x1f4;return function(_0x128b28){logger[_0x66e4('0x25')](_0x128b28[_0x66e4('0x26')]);if(_0x128b28[_0x66e4('0x27')]){delete _0x128b28[_0x66e4('0x27')];}_0x39296f[_0x66e4('0x18')](_0x5f1589)[_0x66e4('0x28')](_0x128b28);};}exports[_0x66e4('0x29')]=function(_0x2e9ee6,_0x4c5930){var _0x1619eb={},_0x20d719={},_0x48a1e3={'count':0x0,'rows':[]};var _0x31ecef=_[_0x66e4('0x2a')](db[_0x66e4('0x2b')][_0x66e4('0x2c')],function(_0x2f1633){return{'name':_0x2f1633[_0x66e4('0x2d')],'type':_0x2f1633[_0x66e4('0x2e')][_0x66e4('0x2f')]};});_0x20d719[_0x66e4('0x30')]=_[_0x66e4('0x2a')](_0x31ecef,_0x66e4('0x27'));_0x20d719[_0x66e4('0x31')]=_[_0x66e4('0x32')](_0x2e9ee6[_0x66e4('0x31')]);_0x20d719['filters']=_[_0x66e4('0x33')](_0x20d719[_0x66e4('0x30')],_0x20d719[_0x66e4('0x31')]);_0x1619eb[_0x66e4('0x34')]=_[_0x66e4('0x33')](_0x20d719[_0x66e4('0x30')],qs[_0x66e4('0x35')](_0x2e9ee6[_0x66e4('0x31')][_0x66e4('0x35')]));_0x1619eb[_0x66e4('0x34')]=_0x1619eb[_0x66e4('0x34')][_0x66e4('0x36')]?_0x1619eb[_0x66e4('0x34')]:_0x20d719[_0x66e4('0x30')];if(!_0x2e9ee6[_0x66e4('0x31')]['hasOwnProperty'](_0x66e4('0x37'))){_0x1619eb['limit']=qs[_0x66e4('0x1b')](_0x2e9ee6[_0x66e4('0x31')][_0x66e4('0x1b')]);_0x1619eb['offset']=qs[_0x66e4('0x1a')](_0x2e9ee6['query'][_0x66e4('0x1a')]);}_0x1619eb[_0x66e4('0x38')]=qs[_0x66e4('0x39')](_0x2e9ee6[_0x66e4('0x31')][_0x66e4('0x39')]);_0x1619eb[_0x66e4('0x3a')]=qs['filters'](_['pick'](_0x2e9ee6[_0x66e4('0x31')],_0x20d719['filters']),_0x31ecef);if(_0x2e9ee6[_0x66e4('0x31')][_0x66e4('0x3b')]){_0x1619eb[_0x66e4('0x3a')]=_[_0x66e4('0x3c')](_0x1619eb[_0x66e4('0x3a')],{'$or':_[_0x66e4('0x2a')](_0x31ecef,function(_0x338c19){if(_0x338c19[_0x66e4('0x2e')]!=='VIRTUAL'){var _0x25af17={};_0x25af17[_0x338c19['name']]={'$like':'%'+_0x2e9ee6['query'][_0x66e4('0x3b')]+'%'};return _0x25af17;}})});}_0x1619eb=_[_0x66e4('0x3c')]({},_0x1619eb,_0x2e9ee6[_0x66e4('0x3d')]);var _0x29a565={'where':_0x1619eb[_0x66e4('0x3a')]};return db[_0x66e4('0x2b')][_0x66e4('0x1d')](_0x29a565)[_0x66e4('0x21')](function(_0x17a8d0){_0x48a1e3['count']=_0x17a8d0;if(_0x2e9ee6[_0x66e4('0x31')][_0x66e4('0x3e')]){_0x1619eb[_0x66e4('0x3f')]=[{'all':!![]}];}return db['CmList'][_0x66e4('0x40')](_0x1619eb);})[_0x66e4('0x21')](function(_0x5164f2){_0x48a1e3[_0x66e4('0x41')]=_0x5164f2;return _0x48a1e3;})[_0x66e4('0x21')](respondWithFilteredResult(_0x4c5930,_0x1619eb))['catch'](handleError(_0x4c5930,null));};exports[_0x66e4('0x42')]=function(_0x2fb6f5,_0x136cec){var _0x31fceb={'raw':![],'where':{'id':_0x2fb6f5['params']['id']}},_0x318ed5={};_0x318ed5[_0x66e4('0x30')]=_['keys'](db[_0x66e4('0x2b')][_0x66e4('0x2c')]);_0x318ed5[_0x66e4('0x31')]=_['keys'](_0x2fb6f5['query']);_0x318ed5[_0x66e4('0x43')]=_[_0x66e4('0x33')](_0x318ed5[_0x66e4('0x30')],_0x318ed5[_0x66e4('0x31')]);_0x31fceb[_0x66e4('0x34')]=_['intersection'](_0x318ed5[_0x66e4('0x30')],qs[_0x66e4('0x35')](_0x2fb6f5[_0x66e4('0x31')]['fields']));_0x31fceb[_0x66e4('0x34')]=_0x31fceb[_0x66e4('0x34')][_0x66e4('0x36')]?_0x31fceb[_0x66e4('0x34')]:_0x318ed5[_0x66e4('0x30')];if(_0x2fb6f5['query'][_0x66e4('0x3e')]){_0x31fceb[_0x66e4('0x3f')]=[{'all':!![]}];}_0x31fceb=_[_0x66e4('0x3c')]({},_0x31fceb,_0x2fb6f5['options']);return db[_0x66e4('0x2b')][_0x66e4('0x44')](_0x31fceb)['then'](handleEntityNotFound(_0x136cec,null))['then'](respondWithResult(_0x136cec,null))[_0x66e4('0x45')](handleError(_0x136cec,null));};exports[_0x66e4('0x46')]=function(_0xd53106,_0x46bb57){return db['CmList'][_0x66e4('0x46')](_0xd53106[_0x66e4('0x47')],{})['then'](function(_0x2ee37f){var _0x47c275=_0xd53106[_0x66e4('0x48')][_0x66e4('0x23')]({'plain':!![]});if(!_0x47c275)throw new Error(_0x66e4('0x49'));if(_0x47c275['role']===_0x66e4('0x48')){var _0x3f3761=_0x2ee37f[_0x66e4('0x23')]({'plain':!![]});var _0x59c866=_0x66e4('0x24');return db['UserProfileSection'][_0x66e4('0x44')]({'where':{'name':_0x59c866,'userProfileId':_0x47c275[_0x66e4('0x4a')]},'raw':!![]})[_0x66e4('0x21')](function(_0x479fbb){if(_0x479fbb&&_0x479fbb[_0x66e4('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f3761['name'],'resourceId':_0x3f3761['id'],'type':_0x479fbb[_0x66e4('0x27')],'sectionId':_0x479fbb['id']},{})[_0x66e4('0x21')](function(){return _0x2ee37f;});}else{return _0x2ee37f;}})['catch'](function(_0xfd7d57){logger['error'](_0x66e4('0x4c'),_0xfd7d57);throw _0xfd7d57;});}return _0x2ee37f;})[_0x66e4('0x21')](respondWithResult(_0x46bb57,0xc9))[_0x66e4('0x45')](handleError(_0x46bb57,null));};exports[_0x66e4('0x20')]=function(_0x552f62,_0x3eb31d){if(_0x552f62['body']['id']){delete _0x552f62[_0x66e4('0x47')]['id'];}return db['CmList'][_0x66e4('0x44')]({'where':{'id':_0x552f62[_0x66e4('0x4d')]['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x3eb31d,null))['then'](saveUpdates(_0x552f62[_0x66e4('0x47')],null))[_0x66e4('0x21')](respondWithResult(_0x3eb31d,null))[_0x66e4('0x45')](handleError(_0x3eb31d,null));};exports['destroy']=function(_0x38cafa,_0x5d5e66){return db[_0x66e4('0x2b')][_0x66e4('0x44')]({'where':{'id':_0x38cafa[_0x66e4('0x4d')]['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x5d5e66,null))[_0x66e4('0x21')](removeEntity(_0x5d5e66,null))['catch'](handleError(_0x5d5e66,null));};exports[_0x66e4('0x4e')]=function(_0x7f450e,_0x4ac630){return db[_0x66e4('0x2b')][_0x66e4('0x4e')]()[_0x66e4('0x21')](respondWithResult(_0x4ac630,null))[_0x66e4('0x45')](handleError(_0x4ac630,null));};exports[_0x66e4('0x4f')]=function(_0x542942,_0x2e1abd,_0x17e5cd){if(_0x542942['body']['id']){delete _0x542942[_0x66e4('0x47')]['id'];}return db[_0x66e4('0x2b')]['find']({'where':{'id':_0x542942[_0x66e4('0x4d')]['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x2e1abd,null))['then'](function(_0x4063fb){if(_0x4063fb){_0x542942[_0x66e4('0x47')][_0x66e4('0x50')]=_0x4063fb['id'];return db[_0x66e4('0x51')][_0x66e4('0x46')](_0x542942[_0x66e4('0x47')]);}})[_0x66e4('0x21')](respondWithResult(_0x2e1abd,null))[_0x66e4('0x45')](handleError(_0x2e1abd,null));};exports[_0x66e4('0x52')]=function(_0x3c871d,_0x1b2b56,_0xf71e88){var _0x510358={'raw':![],'where':{}};var _0x166fa8={};var _0x2b5aa6={'count':0x0,'rows':[]};return db['CmList'][_0x66e4('0x53')]({'where':{'id':_0x3c871d['params']['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x1b2b56,null))[_0x66e4('0x21')](function(_0x398dd6){if(_0x398dd6){_0x166fa8[_0x66e4('0x30')]=_['keys'](db[_0x66e4('0x51')][_0x66e4('0x2c')]);_0x166fa8[_0x66e4('0x31')]=_['keys'](_0x3c871d['query']);_0x166fa8[_0x66e4('0x43')]=_['intersection'](_0x166fa8[_0x66e4('0x30')],_0x166fa8[_0x66e4('0x31')]);_0x510358[_0x66e4('0x34')]=_[_0x66e4('0x33')](_0x166fa8[_0x66e4('0x30')],qs[_0x66e4('0x35')](_0x3c871d[_0x66e4('0x31')]['fields']));_0x510358[_0x66e4('0x34')]=_0x510358[_0x66e4('0x34')]['length']?_0x510358[_0x66e4('0x34')]:_0x166fa8['model'];if(!_0x3c871d[_0x66e4('0x31')][_0x66e4('0x54')](_0x66e4('0x37'))){_0x510358[_0x66e4('0x1b')]=qs[_0x66e4('0x1b')](_0x3c871d[_0x66e4('0x31')][_0x66e4('0x1b')]);_0x510358[_0x66e4('0x1a')]=qs[_0x66e4('0x1a')](_0x3c871d['query'][_0x66e4('0x1a')]);}_0x510358[_0x66e4('0x38')]=qs[_0x66e4('0x39')](_0x3c871d['query']['sort']);_0x510358[_0x66e4('0x3a')]=qs['filters'](_[_0x66e4('0x55')](_0x3c871d[_0x66e4('0x31')],_0x166fa8[_0x66e4('0x43')]));_0x510358[_0x66e4('0x3a')][_0x66e4('0x50')]=_0x398dd6['id'];if(_0x3c871d['query'][_0x66e4('0x3b')]){_0x510358[_0x66e4('0x3a')]=_[_0x66e4('0x3c')](_0x510358['where'],{'$or':_[_0x66e4('0x2a')](_0x510358[_0x66e4('0x34')],function(_0x27c8f7){var _0x5a74f6={};_0x5a74f6[_0x27c8f7]={'$like':'%'+_0x3c871d['query']['filter']+'%'};return _0x5a74f6;})});}_0x510358=_[_0x66e4('0x3c')]({},_0x510358,_0x3c871d[_0x66e4('0x3d')]);return db['Disposition'][_0x66e4('0x1d')]({'where':_0x510358['where']})[_0x66e4('0x21')](function(_0x3e849b){_0x2b5aa6[_0x66e4('0x1d')]=_0x3e849b;if(_0x3c871d[_0x66e4('0x31')][_0x66e4('0x3e')]){_0x510358[_0x66e4('0x3f')]=[{'all':!![]}];}return db[_0x66e4('0x51')][_0x66e4('0x40')](_0x510358);})['then'](function(_0x1ef7c8){_0x2b5aa6[_0x66e4('0x41')]=_0x1ef7c8;return _0x2b5aa6;});}})[_0x66e4('0x21')](respondWithFilteredResult(_0x1b2b56,_0x510358))[_0x66e4('0x45')](handleError(_0x1b2b56,null));};exports[_0x66e4('0x56')]=function(_0x4b2b27,_0x1ed6bb,_0xe9133b){return db['CmList'][_0x66e4('0x44')]({'where':{'id':_0x4b2b27[_0x66e4('0x4d')]['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x1ed6bb,null))[_0x66e4('0x21')](function(_0x3baa95){if(_0x3baa95){return _0x3baa95[_0x66e4('0x56')](_0x4b2b27[_0x66e4('0x31')][_0x66e4('0x57')]);}})[_0x66e4('0x21')](respondWithStatusCode(_0x1ed6bb,null))[_0x66e4('0x45')](handleError(_0x1ed6bb,null));};exports[_0x66e4('0x58')]=function(_0xdcd80b,_0x1bd65b,_0x412ce5){return db['CmList'][_0x66e4('0x44')]({'where':{'id':_0xdcd80b['params']['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x1bd65b,null))[_0x66e4('0x21')](function(_0x170707){if(_0x170707){var _0x518b9e=[];var _0x1d2210={'success':[],'errors':[]};return db[_0x66e4('0x59')][_0x66e4('0x4e')]()['then'](function(_0x1c10e3){if(_0xdcd80b['body'][_0x66e4('0x5a')]&&_[_0x66e4('0x5b')](_0xdcd80b[_0x66e4('0x47')]['tags'])){if(_0xdcd80b['body'][_0x66e4('0x5a')][_0x66e4('0x36')]){_0xdcd80b[_0x66e4('0x47')][_0x66e4('0x5a')]=_0xdcd80b[_0x66e4('0x47')][_0x66e4('0x5a')][_0x66e4('0x5c')](';')+';';}else{_0xdcd80b['body'][_0x66e4('0x5a')]=null;}}else{_0xdcd80b['body'][_0x66e4('0x5a')]=null;}if(_0xdcd80b[_0x66e4('0x47')]&&_[_0x66e4('0x5b')](_0xdcd80b[_0x66e4('0x47')])){for(var _0x467f38=0x0;_0x467f38<_0xdcd80b[_0x66e4('0x47')][_0x66e4('0x36')];_0x467f38+=0x1){_0xdcd80b['body'][_0x467f38][_0x66e4('0x50')]=_0xdcd80b[_0x66e4('0x4d')]['id'];_0x518b9e[_0x66e4('0x5d')](_0xdcd80b['body'][_0x467f38]);}return BPromise[_0x66e4('0x5e')](_0x518b9e,function(_0x291248){return db[_0x66e4('0x59')]['create'](_[_0x66e4('0x5f')](_0x291248,['ids','id'])||{},{'fields':_[_0x66e4('0x32')](_0x1c10e3),'raw':!![]})[_0x66e4('0x21')](function(_0x812abf){_0x1d2210['success'][_0x66e4('0x5d')](_0x812abf[_0x66e4('0x60')]);})['catch'](function(_0x18f6ff){_0x1d2210[_0x66e4('0x61')][_0x66e4('0x5d')]({'data':_0x291248,'error':_0x18f6ff[_0x66e4('0x62')]});});})['then'](function(_0x14aa7c){return _0x1d2210;})['catch'](function(_0x443866){return _0x443866;});}else{_0x1bd65b['status'](0x190)[_0x66e4('0x19')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x66e4('0x21')](respondWithResult(_0x1bd65b,null))[_0x66e4('0x45')](handleError(_0x1bd65b,null));};exports[_0x66e4('0x63')]=function(_0x2b5600,_0x2dfa2f,_0x3fc1df){var _0x5d8b13;return db['CmList']['find']({'where':{'id':_0x2b5600[_0x66e4('0x4d')]['id']},'include':[{'model':db[_0x66e4('0x64')],'as':_0x66e4('0x65')}]})[_0x66e4('0x21')](handleEntityNotFound(_0x2dfa2f,null))[_0x66e4('0x21')](function(_0x3029a6){if(_0x3029a6){_0x5d8b13=_0x3029a6;return db[_0x66e4('0x59')][_0x66e4('0x2c')];}})[_0x66e4('0x21')](function(_0x336a4e){if(_0x336a4e){var _0x33da20={};var _0x255a5a={};_0x255a5a[_0x66e4('0x30')]=_[_0x66e4('0x66')](_['keys'](_0x336a4e),_[_0x66e4('0x2a')](_0x5d8b13['CustomFields'],function(_0x10ec10){return util['format'](_0x66e4('0x67'),_0x10ec10['id']);}));_0x255a5a[_0x66e4('0x31')]=_[_0x66e4('0x32')](_0x2b5600[_0x66e4('0x31')]);_0x255a5a[_0x66e4('0x43')]=_[_0x66e4('0x33')](_0x255a5a[_0x66e4('0x30')],_0x255a5a[_0x66e4('0x31')]);_0x33da20[_0x66e4('0x34')]=_['intersection'](_0x255a5a[_0x66e4('0x30')],qs['fields'](_0x2b5600[_0x66e4('0x31')]['fields']));_0x33da20[_0x66e4('0x34')]=_0x33da20[_0x66e4('0x34')][_0x66e4('0x36')]?_0x33da20[_0x66e4('0x34')]:_0x255a5a[_0x66e4('0x30')];if(!_0x2b5600[_0x66e4('0x31')][_0x66e4('0x54')]('nolimit')){_0x33da20[_0x66e4('0x1b')]=qs[_0x66e4('0x1b')](_0x2b5600[_0x66e4('0x31')][_0x66e4('0x1b')]);_0x33da20['offset']=qs[_0x66e4('0x1a')](_0x2b5600[_0x66e4('0x31')]['offset']);}_0x33da20[_0x66e4('0x38')]=qs[_0x66e4('0x39')](_0x2b5600['query']['sort']);_0x33da20[_0x66e4('0x3a')]=qs[_0x66e4('0x43')](_[_0x66e4('0x55')](_0x2b5600[_0x66e4('0x31')],_0x255a5a[_0x66e4('0x43')]));_0x33da20[_0x66e4('0x68')]=!![];if(_0x2b5600[_0x66e4('0x31')]['filter']){_0x33da20[_0x66e4('0x3a')]=_[_0x66e4('0x3c')](_0x33da20[_0x66e4('0x3a')],{'$or':_[_0x66e4('0x2a')](_0x33da20[_0x66e4('0x34')],function(_0x37a9d8){var _0x43dcd4={};_0x43dcd4[_0x37a9d8]={'$like':'%'+_0x2b5600[_0x66e4('0x31')][_0x66e4('0x3b')]+'%'};return _0x43dcd4;})});}_0x33da20=_[_0x66e4('0x3c')]({},_0x33da20,_0x2b5600[_0x66e4('0x3d')]);return _0x5d8b13[_0x66e4('0x63')](_0x33da20);}})[_0x66e4('0x21')](respondWithResult(_0x2dfa2f,null))['catch'](handleError(_0x2dfa2f,null));};exports[_0x66e4('0x69')]=function(_0x8ee05a,_0x1efab3,_0x10fbe3){var _0x3a0660;return db[_0x66e4('0x2b')][_0x66e4('0x44')]({'where':{'id':_0x8ee05a[_0x66e4('0x4d')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x66e4('0x65')}]})[_0x66e4('0x21')](handleEntityNotFound(_0x1efab3,null))[_0x66e4('0x21')](function(_0x164c63){if(_0x164c63){_0x3a0660=_0x164c63;return db[_0x66e4('0x59')][_0x66e4('0x2c')];}})[_0x66e4('0x21')](function(_0x514833){if(_0x514833){var _0x5143d0={};var _0x2b8283={};_0x2b8283[_0x66e4('0x30')]=_[_0x66e4('0x66')](_[_0x66e4('0x32')](_0x514833),_['map'](_0x3a0660[_0x66e4('0x65')],function(_0x3ffea0){return util['format'](_0x66e4('0x67'),_0x3ffea0['id']);}));_0x2b8283[_0x66e4('0x31')]=_[_0x66e4('0x32')](_0x8ee05a['query']);_0x2b8283[_0x66e4('0x43')]=_[_0x66e4('0x33')](_0x2b8283['model'],_0x2b8283[_0x66e4('0x31')]);_0x5143d0[_0x66e4('0x34')]=_['intersection'](_0x2b8283['model'],qs[_0x66e4('0x35')](_0x8ee05a['query'][_0x66e4('0x35')]));_0x5143d0[_0x66e4('0x34')]=_0x5143d0[_0x66e4('0x34')]['length']?_0x5143d0['attributes']:_0x2b8283[_0x66e4('0x30')];if(!_0x8ee05a['query'][_0x66e4('0x54')]('nolimit')){_0x5143d0[_0x66e4('0x1b')]=qs[_0x66e4('0x1b')](_0x8ee05a[_0x66e4('0x31')][_0x66e4('0x1b')]);_0x5143d0[_0x66e4('0x1a')]=qs[_0x66e4('0x1a')](_0x8ee05a[_0x66e4('0x31')][_0x66e4('0x1a')]);}_0x5143d0['order']=qs[_0x66e4('0x39')](_0x8ee05a[_0x66e4('0x31')][_0x66e4('0x39')]);_0x5143d0[_0x66e4('0x3a')]=qs[_0x66e4('0x43')](_[_0x66e4('0x55')](_0x8ee05a['query'],_0x2b8283[_0x66e4('0x43')]));_0x5143d0[_0x66e4('0x68')]=!![];if(_0x8ee05a[_0x66e4('0x31')]['filter']){_0x5143d0[_0x66e4('0x3a')]=_[_0x66e4('0x3c')](_0x5143d0['where'],{'$or':_[_0x66e4('0x2a')](_0x5143d0['attributes'],function(_0xe7593){var _0x36a467={};_0x36a467[_0xe7593]={'$like':'%'+_0x8ee05a['query'][_0x66e4('0x3b')]+'%'};return _0x36a467;})});}_0x5143d0=_[_0x66e4('0x3c')]({},_0x5143d0,_0x8ee05a['options']);return _0x3a0660[_0x66e4('0x63')](_0x5143d0);}})[_0x66e4('0x21')](function(_0x402338){if(!_[_0x66e4('0x6a')](_0x402338)){var _0x2a771=toCsv(_0x402338);var _0xbb2c33=Date[_0x66e4('0x6b')]();fs['writeFileSync'](util[_0x66e4('0x6c')]('/tmp/list_%d_%s.csv',_0x3a0660['id'],_0xbb2c33),_0x2a771);_0x1efab3[_0x66e4('0x6d')](_0x66e4('0x6e'),_0x66e4('0x6f')+util['format'](_0x66e4('0x70'),_0x3a0660['id'],_0xbb2c33));_0x1efab3[_0x66e4('0x6d')](_0x66e4('0x71'),_0x66e4('0x72'));return _0x1efab3[_0x66e4('0x73')](util[_0x66e4('0x6c')](_0x66e4('0x74'),_0x3a0660['id'],_0xbb2c33));}else{return _0x1efab3[_0x66e4('0x17')](0xcc);}})[_0x66e4('0x45')](handleError(_0x1efab3,null));};exports[_0x66e4('0x75')]=function(_0x4c002d,_0x539b3b,_0x378200){var _0x53908c;delete _0x4c002d[_0x66e4('0x47')]['id'];return db['CmList'][_0x66e4('0x53')]({'where':{'id':_0x4c002d['params']['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x539b3b,null))[_0x66e4('0x21')](function(_0x48f060){if(_0x48f060){return db[_0x66e4('0x76')][_0x66e4('0x77')](function(_0x60d12e){return db[_0x66e4('0x64')]['create'](_0x4c002d[_0x66e4('0x47')],{'transaction':_0x60d12e})[_0x66e4('0x21')](function(_0x48cb6c){_0x53908c=_0x48cb6c;return _0x48f060[_0x66e4('0x78')](_0x48cb6c,{'transaction':_0x60d12e});})[_0x66e4('0x21')](function(){var _0xcc623c={'type':db[_0x66e4('0x79')]['TEXT'],'transaction':_0x60d12e};switch(_0x4c002d[_0x66e4('0x47')][_0x66e4('0x2e')]){case _0x66e4('0x7a'):_0xcc623c['type']=db[_0x66e4('0x79')][_0x66e4('0x7b')];break;case _0x66e4('0x7c'):_0xcc623c[_0x66e4('0x2e')]=db[_0x66e4('0x79')][_0x66e4('0x7d')];break;case _0x66e4('0x7e'):_0xcc623c['type']=db[_0x66e4('0x79')][_0x66e4('0x7f')];_0xcc623c[_0x66e4('0x80')]=![];break;default:}return db[_0x66e4('0x76')][_0x66e4('0x81')]['addColumn'](_0x66e4('0x82'),util['format'](_0x66e4('0x83'),_0x53908c['id']),_0xcc623c);})[_0x66e4('0x21')](function(){return _0x53908c;});});}})[_0x66e4('0x21')](respondWithResult(_0x539b3b,null))['catch'](handleError(_0x539b3b,null));};exports[_0x66e4('0x84')]=function(_0x284864,_0xbbff02,_0x888273){var _0x5bc0e9={};var _0xda83b9={};var _0x5a58ec;var _0x54e5ec;return db[_0x66e4('0x2b')][_0x66e4('0x53')]({'where':{'id':_0x284864[_0x66e4('0x4d')]['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0xbbff02,null))[_0x66e4('0x21')](function(_0xae6239){if(_0xae6239){_0x5a58ec=_0xae6239;_0xda83b9['model']=_['keys'](db[_0x66e4('0x64')][_0x66e4('0x2c')]);_0xda83b9[_0x66e4('0x31')]=_['keys'](_0x284864['query']);_0xda83b9[_0x66e4('0x43')]=_[_0x66e4('0x33')](_0xda83b9[_0x66e4('0x30')],_0xda83b9['query']);_0x5bc0e9[_0x66e4('0x34')]=_[_0x66e4('0x33')](_0xda83b9[_0x66e4('0x30')],qs[_0x66e4('0x35')](_0x284864[_0x66e4('0x31')][_0x66e4('0x35')]));_0x5bc0e9[_0x66e4('0x34')]=_0x5bc0e9['attributes']['length']?_0x5bc0e9[_0x66e4('0x34')]:_0xda83b9[_0x66e4('0x30')];_0x5bc0e9[_0x66e4('0x38')]=qs['sort'](_0x284864[_0x66e4('0x31')][_0x66e4('0x39')]);_0x5bc0e9['where']=qs[_0x66e4('0x43')](_[_0x66e4('0x55')](_0x284864[_0x66e4('0x31')],_0xda83b9[_0x66e4('0x43')]));_0x5bc0e9[_0x66e4('0x3a')]=_['merge'](_0x5bc0e9['where'],{'$or':[{'ListId':_0xae6239['id']},{'ListId':null}]});if(_0x284864[_0x66e4('0x31')][_0x66e4('0x3b')]){_0x5bc0e9[_0x66e4('0x3a')]=_['merge'](_0x5bc0e9[_0x66e4('0x3a')],{'$or':_[_0x66e4('0x2a')](_0x5bc0e9[_0x66e4('0x34')],function(_0x9fb791){var _0x9e1153={};_0x9e1153[_0x9fb791]={'$like':'%'+_0x284864['query'][_0x66e4('0x3b')]+'%'};return _0x9e1153;})});}_0x5bc0e9=_[_0x66e4('0x3c')]({},_0x5bc0e9,_0x284864[_0x66e4('0x3d')]);return db[_0x66e4('0x64')][_0x66e4('0x85')](_0x5bc0e9);}})[_0x66e4('0x21')](respondWithResult(_0xbbff02,null))[_0x66e4('0x45')](handleError(_0xbbff02,null));};exports[_0x66e4('0x86')]=function(_0x3499ba,_0x503d15,_0x99b716){return db[_0x66e4('0x2b')]['find']({'where':{'id':_0x3499ba['params']['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x503d15,null))[_0x66e4('0x21')](function(_0x10f3dc){if(_0x10f3dc){return _0x10f3dc[_0x66e4('0x86')](_0x3499ba[_0x66e4('0x47')][_0x66e4('0x57')],_[_0x66e4('0x5f')](_0x3499ba[_0x66e4('0x47')],[_0x66e4('0x57'),'id'])||{})[_0x66e4('0x87')](function(_0x17dc1b){for(var _0x2f8d07=0x0;_0x2f8d07<_0x3499ba[_0x66e4('0x47')]['ids'][_0x66e4('0x36')];_0x2f8d07+=0x1){socket[_0x66e4('0x88')]('userCmList:save',{'UserId':Number(_0x3499ba[_0x66e4('0x47')][_0x66e4('0x57')][_0x2f8d07]),'CmListId':Number(_0x3499ba['params']['id'])});}return _0x17dc1b;});}})['then'](respondWithResult(_0x503d15,null))[_0x66e4('0x45')](handleError(_0x503d15,null));};exports['removeAgents']=function(_0x510daa,_0x3d9a78,_0x1c80a5){return db['CmList'][_0x66e4('0x44')]({'where':{'id':_0x510daa[_0x66e4('0x4d')]['id']}})[_0x66e4('0x21')](handleEntityNotFound(_0x3d9a78,null))[_0x66e4('0x21')](function(_0x5c9eab){if(_0x5c9eab){return _0x5c9eab[_0x66e4('0x89')](_0x510daa['query'][_0x66e4('0x57')])[_0x66e4('0x21')](function(){if(_[_0x66e4('0x5b')](_0x510daa['query'][_0x66e4('0x57')])){for(var _0x1e93f5=0x0;_0x1e93f5<_0x510daa[_0x66e4('0x31')][_0x66e4('0x57')][_0x66e4('0x36')];_0x1e93f5+=0x1){socket[_0x66e4('0x88')](_0x66e4('0x8a'),{'UserId':Number(_0x510daa[_0x66e4('0x31')][_0x66e4('0x57')][_0x1e93f5]),'CmListId':Number(_0x510daa[_0x66e4('0x4d')]['id'])});}}else{socket[_0x66e4('0x88')](_0x66e4('0x8a'),{'UserId':Number(_0x510daa['query'][_0x66e4('0x57')]),'CmListId':Number(_0x510daa[_0x66e4('0x4d')]['id'])});}});}})[_0x66e4('0x21')](respondWithStatusCode(_0x3d9a78,null))[_0x66e4('0x45')](handleError(_0x3d9a78,null));};exports[_0x66e4('0x8b')]=function(_0x460997,_0x1e6e22,_0x39f7c9){var _0x4055ec={};var _0x25ec12={};var _0x1691c4;var _0x5d13be;return db[_0x66e4('0x2b')]['findOne']({'where':{'id':_0x460997[_0x66e4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e6e22,null))['then'](function(_0x56d479){if(_0x56d479){_0x1691c4=_0x56d479;_0x25ec12[_0x66e4('0x30')]=_[_0x66e4('0x32')](db[_0x66e4('0x8c')][_0x66e4('0x2c')]);_0x25ec12['query']=_[_0x66e4('0x32')](_0x460997[_0x66e4('0x31')]);_0x25ec12[_0x66e4('0x43')]=_[_0x66e4('0x33')](_0x25ec12[_0x66e4('0x30')],_0x25ec12['query']);_0x4055ec['attributes']=_[_0x66e4('0x33')](_0x25ec12['model'],qs[_0x66e4('0x35')](_0x460997[_0x66e4('0x31')][_0x66e4('0x35')]));_0x4055ec[_0x66e4('0x34')]=_0x4055ec[_0x66e4('0x34')]['length']?_0x4055ec['attributes']:_0x25ec12[_0x66e4('0x30')];_0x4055ec['order']=qs[_0x66e4('0x39')](_0x460997[_0x66e4('0x31')][_0x66e4('0x39')]);_0x4055ec[_0x66e4('0x3a')]=qs[_0x66e4('0x43')](_[_0x66e4('0x55')](_0x460997[_0x66e4('0x31')],_0x25ec12[_0x66e4('0x43')]));if(_0x460997[_0x66e4('0x31')][_0x66e4('0x3b')]){_0x4055ec[_0x66e4('0x3a')]=_['merge'](_0x4055ec[_0x66e4('0x3a')],{'$or':_[_0x66e4('0x2a')](_0x4055ec[_0x66e4('0x34')],function(_0x248874){var _0x1dc9b0={};_0x1dc9b0[_0x248874]={'$like':'%'+_0x460997[_0x66e4('0x31')][_0x66e4('0x3b')]+'%'};return _0x1dc9b0;})});}_0x4055ec=_[_0x66e4('0x3c')]({},_0x4055ec,_0x460997[_0x66e4('0x3d')]);return _0x1691c4['getAgents'](_0x4055ec);}})[_0x66e4('0x21')](function(_0x681a44){if(_0x681a44){_0x5d13be=_0x681a44[_0x66e4('0x36')];if(!_0x460997[_0x66e4('0x31')]['hasOwnProperty'](_0x66e4('0x37'))){_0x4055ec[_0x66e4('0x1b')]=qs[_0x66e4('0x1b')](_0x460997[_0x66e4('0x31')][_0x66e4('0x1b')]);_0x4055ec[_0x66e4('0x1a')]=qs[_0x66e4('0x1a')](_0x460997[_0x66e4('0x31')][_0x66e4('0x1a')]);}return _0x1691c4[_0x66e4('0x8b')](_0x4055ec);}})[_0x66e4('0x21')](function(_0x1efa92){if(_0x1efa92){return _0x1efa92?{'count':_0x5d13be,'rows':_0x1efa92}:null;}})[_0x66e4('0x21')](respondWithResult(_0x1e6e22,null))['catch'](handleError(_0x1e6e22,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6b5c978..0dfaa96 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0xb045d2,_0x258206){var _0x577872=function(_0x47317c){while(--_0x47317c){_0xb045d2['push'](_0xb045d2['shift']());}};_0x577872(++_0x258206);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x4f2d40,_0x2b76f8){var _0x227027=function(_0x57d2a4){while(--_0x57d2a4){_0x4f2d40['push'](_0x4f2d40['shift']());}};_0x227027(++_0x2b76f8);}(_0x814b,0x1a2));var _0xb814=function(_0x11cbb5,_0x390441){_0x11cbb5=_0x11cbb5-0x0;var _0x54b8d3=_0x814b[_0x11cbb5];return _0x54b8d3;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5b9807f..aca287d 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x58eeba,_0x522237){var _0xe5c3b6=function(_0x207e29){while(--_0x207e29){_0x58eeba['push'](_0x58eeba['shift']());}};_0xe5c3b6(++_0x522237);}(_0xe706,0xa3));var _0x6e70=function(_0x259cad,_0x3dae11){_0x259cad=_0x259cad-0x0;var _0x4e6a68=_0xe706[_0x259cad];return _0x4e6a68;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2750=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2c7d54,_0xec553f){var _0x190e31=function(_0x5e3d20){while(--_0x5e3d20){_0x2c7d54['push'](_0x2c7d54['shift']());}};_0x190e31(++_0xec553f);}(_0x2750,0x13b));var _0x0275=function(_0x5c3dca,_0x406e60){_0x5c3dca=_0x5c3dca-0x0;var _0x3e2ebe=_0x2750[_0x5c3dca];return _0x3e2ebe;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 1b5cf9e..9a5ddbd 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 _0xd082=['CmList,\x20%s,\x20%s','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x1c970c,_0x69071b){var _0x58405e=function(_0x571665){while(--_0x571665){_0x1c970c['push'](_0x1c970c['shift']());}};_0x58405e(++_0x69071b);}(_0xd082,0x189));var _0x2d08=function(_0x23fad4,_0x3dd73c){_0x23fad4=_0x23fad4-0x0;var _0x97dcbc=_0xd082[_0x23fad4];return _0x97dcbc;};'use strict';var _=require('lodash');var util=require(_0x2d08('0x0'));var moment=require(_0x2d08('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d08('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d08('0x3'));var logger=require(_0x2d08('0x4'))('rpc');var config=require(_0x2d08('0x5'));var jayson=require(_0x2d08('0x6'));var client=jayson[_0x2d08('0x7')][_0x2d08('0x8')]({'port':0x232a});config[_0x2d08('0x9')]=_[_0x2d08('0xa')](config['redis'],{'host':_0x2d08('0xb'),'port':0x18eb});var socket=require(_0x2d08('0xc'))(new Redis(config[_0x2d08('0x9')]));require(_0x2d08('0xd'))[_0x2d08('0xe')](socket);function respondWithRpcPromise(_0x716cf9,_0x393c58,_0x1d72cf){return new BPromise(function(_0x576dba,_0x1027f9){return client['request'](_0x716cf9,_0x1d72cf)[_0x2d08('0xf')](function(_0x8b02ac){logger[_0x2d08('0x10')]('CmList,\x20%s,\x20%s',_0x393c58,_0x2d08('0x11'));logger[_0x2d08('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x393c58,_0x2d08('0x11'),JSON[_0x2d08('0x13')](_0x8b02ac));if(_0x8b02ac[_0x2d08('0x14')]){if(_0x8b02ac[_0x2d08('0x14')][_0x2d08('0x15')]===0x1f4){logger[_0x2d08('0x14')]('CmList,\x20%s,\x20%s',_0x393c58,_0x8b02ac[_0x2d08('0x14')][_0x2d08('0x16')]);return _0x1027f9(_0x8b02ac[_0x2d08('0x14')][_0x2d08('0x16')]);}logger['error'](_0x2d08('0x17'),_0x393c58,_0x8b02ac[_0x2d08('0x14')][_0x2d08('0x16')]);return _0x576dba(_0x8b02ac[_0x2d08('0x14')]['message']);}else{logger[_0x2d08('0x10')](_0x2d08('0x17'),_0x393c58,_0x2d08('0x11'));_0x576dba(_0x8b02ac[_0x2d08('0x18')]['message']);}})[_0x2d08('0x19')](function(_0x55765c){logger[_0x2d08('0x14')](_0x2d08('0x17'),_0x393c58,_0x55765c);_0x1027f9(_0x55765c);});});} \ No newline at end of file +var _0xde88=['CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','client','http','defaults','redis','localhost','./cmList.socket','register','request','then'];(function(_0x5121a7,_0xd7c475){var _0x168826=function(_0x4da782){while(--_0x4da782){_0x5121a7['push'](_0x5121a7['shift']());}};_0x168826(++_0xd7c475);}(_0xde88,0xe1));var _0x8de8=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0xde88[_0x4b4b0e];return _0x4c2d91;};'use strict';var _=require(_0x8de8('0x0'));var util=require(_0x8de8('0x1'));var moment=require('moment');var BPromise=require(_0x8de8('0x2'));var rs=require(_0x8de8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8de8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8de8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8de8('0x6')][_0x8de8('0x7')]({'port':0x232a});config['redis']=_[_0x8de8('0x8')](config[_0x8de8('0x9')],{'host':_0x8de8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8de8('0x9')]));require(_0x8de8('0xb'))[_0x8de8('0xc')](socket);function respondWithRpcPromise(_0x311e28,_0x402d00,_0x3ad9ee){return new BPromise(function(_0x42abd3,_0x33ec94){return client[_0x8de8('0xd')](_0x311e28,_0x3ad9ee)[_0x8de8('0xe')](function(_0x228faf){logger['info'](_0x8de8('0xf'),_0x402d00,_0x8de8('0x10'));logger[_0x8de8('0x11')](_0x8de8('0x12'),_0x402d00,'request\x20sent',JSON[_0x8de8('0x13')](_0x228faf));if(_0x228faf[_0x8de8('0x14')]){if(_0x228faf[_0x8de8('0x14')][_0x8de8('0x15')]===0x1f4){logger[_0x8de8('0x14')](_0x8de8('0xf'),_0x402d00,_0x228faf[_0x8de8('0x14')][_0x8de8('0x16')]);return _0x33ec94(_0x228faf[_0x8de8('0x14')]['message']);}logger['error']('CmList,\x20%s,\x20%s',_0x402d00,_0x228faf[_0x8de8('0x14')][_0x8de8('0x16')]);return _0x42abd3(_0x228faf['error'][_0x8de8('0x16')]);}else{logger['info'](_0x8de8('0xf'),_0x402d00,_0x8de8('0x10'));_0x42abd3(_0x228faf['result']['message']);}})[_0x8de8('0x17')](function(_0x60c266){logger[_0x8de8('0x14')]('CmList,\x20%s,\x20%s',_0x402d00,_0x60c266);_0x33ec94(_0x60c266);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 649e476..0e5176f 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 _0xbd21=['emit','removeListener','length','cmList:','update'];(function(_0x1226b3,_0x2e39c1){var _0x119703=function(_0x2f4e8a){while(--_0x2f4e8a){_0x1226b3['push'](_0x1226b3['shift']());}};_0x119703(++_0x2e39c1);}(_0xbd21,0xd1));var _0x1bd2=function(_0x55fa8d,_0x162083){_0x55fa8d=_0x55fa8d-0x0;var _0x34592e=_0xbd21[_0x55fa8d];return _0x34592e;};'use strict';var CmListEvents=require('./cmList.events');var events=['save','remove',_0x1bd2('0x0')];function createListener(_0x14537d,_0x3faac8){return function(_0x1ac5dd){_0x3faac8[_0x1bd2('0x1')](_0x14537d,_0x1ac5dd);};}function removeListener(_0x13ae9d,_0x4f18f7){return function(){CmListEvents[_0x1bd2('0x2')](_0x13ae9d,_0x4f18f7);};}exports['register']=function(_0x2f99b1){for(var _0x543849=0x0,_0x58f964=events[_0x1bd2('0x3')];_0x543849<_0x58f964;_0x543849++){var _0x3a4aca=events[_0x543849];var _0x28ae32=createListener(_0x1bd2('0x4')+_0x3a4aca,_0x2f99b1);CmListEvents['on'](_0x3a4aca,_0x28ae32);}}; \ No newline at end of file +var _0xf222=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x313e62,_0x51d3a1){var _0x568cdc=function(_0x3120fc){while(--_0x3120fc){_0x313e62['push'](_0x313e62['shift']());}};_0x568cdc(++_0x51d3a1);}(_0xf222,0x11e));var _0x2f22=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf222[_0x14add3];return _0x4a174f;};'use strict';var CmListEvents=require(_0x2f22('0x0'));var events=[_0x2f22('0x1'),_0x2f22('0x2'),_0x2f22('0x3')];function createListener(_0xa7b9e8,_0xbed85f){return function(_0x3e0256){_0xbed85f[_0x2f22('0x4')](_0xa7b9e8,_0x3e0256);};}function removeListener(_0x13ed7e,_0x2a52b5){return function(){CmListEvents[_0x2f22('0x5')](_0x13ed7e,_0x2a52b5);};}exports[_0x2f22('0x6')]=function(_0x3fbdff){for(var _0x1ae425=0x0,_0x698f05=events[_0x2f22('0x7')];_0x1ae425<_0x698f05;_0x1ae425++){var _0x52c934=events[_0x1ae425];var _0xd3ba0f=createListener(_0x2f22('0x8')+_0x52c934,_0x3fbdff);CmListEvents['on'](_0x52c934,_0xd3ba0f);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ab68265..ad617c5 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 _0xae7e=['/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','create','post','addDisposition','addContacts','/:id/users','addAgents','put','update','delete','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae7e,0x145));var _0xeae7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xae7e[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xeae7('0x0'));var path=require(_0xeae7('0x1'));var timeout=require(_0xeae7('0x2'));var express=require(_0xeae7('0x3'));var router=express['Router']();var fs_extra=require(_0xeae7('0x4'));var auth=require(_0xeae7('0x5'));var interaction=require(_0xeae7('0x6'));var config=require(_0xeae7('0x7'));var controller=require(_0xeae7('0x8'));router[_0xeae7('0x9')]('/',auth['isAuthenticated'](),controller[_0xeae7('0xa')]);router[_0xeae7('0x9')](_0xeae7('0xb'),auth[_0xeae7('0xc')](),controller['describe']);router[_0xeae7('0x9')](_0xeae7('0xd'),auth[_0xeae7('0xc')](),controller[_0xeae7('0xe')]);router[_0xeae7('0x9')](_0xeae7('0xf'),auth['isAuthenticated'](),controller[_0xeae7('0x10')]);router[_0xeae7('0x9')](_0xeae7('0x11'),auth[_0xeae7('0xc')](),controller[_0xeae7('0x12')]);router[_0xeae7('0x9')](_0xeae7('0x13'),auth[_0xeae7('0xc')](),controller[_0xeae7('0x14')]);router[_0xeae7('0x9')](_0xeae7('0x15'),auth[_0xeae7('0xc')](),controller[_0xeae7('0x16')]);router[_0xeae7('0x9')]('/:id/users',auth[_0xeae7('0xc')](),controller['getAgents']);router['post']('/',auth[_0xeae7('0xc')](),controller[_0xeae7('0x17')]);router[_0xeae7('0x18')](_0xeae7('0xf'),auth['isAuthenticated'](),controller[_0xeae7('0x19')]);router['post'](_0xeae7('0x11'),auth[_0xeae7('0xc')](),controller[_0xeae7('0x1a')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router[_0xeae7('0x18')](_0xeae7('0x1b'),auth['isAuthenticated'](),controller[_0xeae7('0x1c')]);router[_0xeae7('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xeae7('0x1e')]);router[_0xeae7('0x1f')](_0xeae7('0xd'),auth[_0xeae7('0xc')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xeae7('0xc')](),controller['removeDispositions']);router[_0xeae7('0x1f')](_0xeae7('0x1b'),auth[_0xeae7('0xc')](),controller[_0xeae7('0x20')]);module[_0xeae7('0x21')]=router; \ No newline at end of file +var _0x2623=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','put','destroy','delete','removeAgents','exports','multer'];(function(_0x54ac1b,_0x291232){var _0x47524f=function(_0x137fad){while(--_0x137fad){_0x54ac1b['push'](_0x54ac1b['shift']());}};_0x47524f(++_0x291232);}(_0x2623,0x13a));var _0x3262=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0x2623[_0x350aeb];return _0x3c5273;};'use strict';var multer=require(_0x3262('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3262('0x1'));var express=require(_0x3262('0x2'));var router=express[_0x3262('0x3')]();var fs_extra=require(_0x3262('0x4'));var auth=require(_0x3262('0x5'));var interaction=require(_0x3262('0x6'));var config=require(_0x3262('0x7'));var controller=require('./cmList.controller');router[_0x3262('0x8')]('/',auth['isAuthenticated'](),controller[_0x3262('0x9')]);router['get'](_0x3262('0xa'),auth[_0x3262('0xb')](),controller[_0x3262('0xc')]);router['get'](_0x3262('0xd'),auth[_0x3262('0xb')](),controller[_0x3262('0xe')]);router[_0x3262('0x8')](_0x3262('0xf'),auth['isAuthenticated'](),controller[_0x3262('0x10')]);router[_0x3262('0x8')](_0x3262('0x11'),auth[_0x3262('0xb')](),controller[_0x3262('0x12')]);router['get'](_0x3262('0x13'),auth['isAuthenticated'](),controller[_0x3262('0x14')]);router[_0x3262('0x8')](_0x3262('0x15'),auth[_0x3262('0xb')](),controller[_0x3262('0x16')]);router[_0x3262('0x8')](_0x3262('0x17'),auth['isAuthenticated'](),controller[_0x3262('0x18')]);router[_0x3262('0x19')]('/',auth[_0x3262('0xb')](),controller[_0x3262('0x1a')]);router[_0x3262('0x19')](_0x3262('0xf'),auth[_0x3262('0xb')](),controller[_0x3262('0x1b')]);router[_0x3262('0x19')](_0x3262('0x11'),auth[_0x3262('0xb')](),controller[_0x3262('0x1c')]);router[_0x3262('0x19')](_0x3262('0x15'),auth['isAuthenticated'](),controller[_0x3262('0x1d')]);router[_0x3262('0x19')](_0x3262('0x17'),auth[_0x3262('0xb')](),controller['addAgents']);router[_0x3262('0x1e')](_0x3262('0xd'),auth[_0x3262('0xb')](),controller['update']);router['delete'](_0x3262('0xd'),auth['isAuthenticated'](),controller[_0x3262('0x1f')]);router[_0x3262('0x20')](_0x3262('0xf'),auth[_0x3262('0xb')](),controller['removeDispositions']);router[_0x3262('0x20')](_0x3262('0x17'),auth[_0x3262('0xb')](),controller[_0x3262('0x21')]);module[_0x3262('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 617cdb5..e58e67d 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 _0x1297=['STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x545af5,_0x51f4b6){var _0x5245e3=function(_0x2d3db5){while(--_0x2d3db5){_0x545af5['push'](_0x545af5['shift']());}};_0x5245e3(++_0x51f4b6);}(_0x1297,0x9c));var _0x7129=function(_0x30c1ee,_0x6c1de0){_0x30c1ee=_0x30c1ee-0x0;var _0x5d4c8e=_0x1297[_0x30c1ee];return _0x5d4c8e;};'use strict';var Sequelize=require(_0x7129('0x0'));module[_0x7129('0x1')]={'name':{'type':Sequelize[_0x7129('0x2')],'get':function(_0x1df1cc){return this[_0x7129('0x3')]('field');}},'field':{'type':Sequelize[_0x7129('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7129('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xf4a1=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x47d47a,_0x1061fb){var _0x1f37ed=function(_0x1ed27a){while(--_0x1ed27a){_0x47d47a['push'](_0x47d47a['shift']());}};_0x1f37ed(++_0x1061fb);}(_0xf4a1,0x11f));var _0x1f4a=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xf4a1[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x1f4a('0x0'));module[_0x1f4a('0x1')]={'name':{'type':Sequelize[_0x1f4a('0x2')],'get':function(_0x2fdf88){return this[_0x1f4a('0x3')](_0x1f4a('0x4'));}},'field':{'type':Sequelize[_0x1f4a('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x1f4a('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 c0adffc..67d1946 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(_0x131c56,_0x13a06e){var _0x11260a=function(_0x3f960c){while(--_0x3f960c){_0x131c56['push'](_0x131c56['shift']());}};_0x11260a(++_0x13a06e);}(_0x7a54,0x106));var _0x47a5=function(_0x5c0bfb,_0x5127ad){_0x5c0bfb=_0x5c0bfb-0x0;var _0x25a230=_0x7a54[_0x5c0bfb];return _0x25a230;};'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(_0x32e3d5,_0x3c473d){var _0x2aeee7=function(_0x1a6e17){while(--_0x1a6e17){_0x32e3d5['push'](_0x32e3d5['shift']());}};_0x2aeee7(++_0x3c473d);}(_0x7a54,0x106));var _0x47a5=function(_0x486a9a,_0x11857e){_0x486a9a=_0x486a9a-0x0;var _0x2b0175=_0x7a54[_0x486a9a];return _0x2b0175;};'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 1cee7fc..29ec10f 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 _0x4de4=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4de4,0x15f));var _0x44de=function(_0x55c612,_0x2d1eaf){_0x55c612=_0x55c612-0x0;var _0x27bc76=_0x4de4[_0x55c612];return _0x27bc76;};'use strict';var _=require(_0x44de('0x0'));var util=require(_0x44de('0x1'));var logger=require(_0x44de('0x2'))(_0x44de('0x3'));var moment=require('moment');var BPromise=require(_0x44de('0x4'));var rp=require(_0x44de('0x5'));var fs=require('fs');var path=require(_0x44de('0x6'));var rimraf=require(_0x44de('0x7'));var config=require('../../config/environment');var attributes=require(_0x44de('0x8'));module[_0x44de('0x9')]=function(_0x5393bc,_0x52d09e){return _0x5393bc[_0x44de('0xa')](_0x44de('0xb'),attributes,{'tableName':_0x44de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab6d=['util','api','moment','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0xab6d,0x18b));var _0xdab6=function(_0x40164c,_0x248718){_0x40164c=_0x40164c-0x0;var _0x57903b=_0xab6d[_0x40164c];return _0x57903b;};'use strict';var _=require(_0xdab6('0x0'));var util=require(_0xdab6('0x1'));var logger=require('../../config/logger')(_0xdab6('0x2'));var moment=require(_0xdab6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdab6('0x4'));var rimraf=require(_0xdab6('0x5'));var config=require(_0xdab6('0x6'));var attributes=require(_0xdab6('0x7'));module[_0xdab6('0x8')]=function(_0x16f107,_0x1c867b){return _0x16f107['define'](_0xdab6('0x9'),attributes,{'tableName':_0xdab6('0xa'),'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 fe755c0..f834afa 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 _0xfcc3=['client','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4589fd,_0x4c6f26){var _0x44084b=function(_0x1eeabd){while(--_0x1eeabd){_0x4589fd['push'](_0x4589fd['shift']());}};_0x44084b(++_0x4c6f26);}(_0xfcc3,0x1db));var _0x3fcc=function(_0x15f0a6,_0x1a5039){_0x15f0a6=_0x15f0a6-0x0;var _0x2c825e=_0xfcc3[_0x15f0a6];return _0x2c825e;};'use strict';var _=require(_0x3fcc('0x0'));var util=require('util');var moment=require(_0x3fcc('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fcc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fcc('0x3'))['db'];var utils=require(_0x3fcc('0x4'));var logger=require(_0x3fcc('0x5'))(_0x3fcc('0x6'));var config=require(_0x3fcc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3fcc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x299f98,_0x1cccc5,_0x1bac97){return new BPromise(function(_0x1b6d67,_0x3cbcba){return client['request'](_0x299f98,_0x1bac97)[_0x3fcc('0x9')](function(_0x4824b2){logger[_0x3fcc('0xa')]('Condition,\x20%s,\x20%s',_0x1cccc5,'request\x20sent');logger[_0x3fcc('0xb')](_0x3fcc('0xc'),_0x1cccc5,'request\x20sent',JSON[_0x3fcc('0xd')](_0x4824b2));if(_0x4824b2[_0x3fcc('0xe')]){if(_0x4824b2[_0x3fcc('0xe')][_0x3fcc('0xf')]===0x1f4){logger[_0x3fcc('0xe')](_0x3fcc('0x10'),_0x1cccc5,_0x4824b2[_0x3fcc('0xe')][_0x3fcc('0x11')]);return _0x3cbcba(_0x4824b2[_0x3fcc('0xe')][_0x3fcc('0x11')]);}logger['error'](_0x3fcc('0x10'),_0x1cccc5,_0x4824b2[_0x3fcc('0xe')][_0x3fcc('0x11')]);return _0x1b6d67(_0x4824b2[_0x3fcc('0xe')]['message']);}else{logger[_0x3fcc('0xa')](_0x3fcc('0x10'),_0x1cccc5,_0x3fcc('0x12'));_0x1b6d67(_0x4824b2[_0x3fcc('0x13')]['message']);}})[_0x3fcc('0x14')](function(_0x1f8997){logger[_0x3fcc('0xe')](_0x3fcc('0x10'),_0x1cccc5,_0x1f8997);_0x3cbcba(_0x1f8997);});});} \ No newline at end of file +var _0x409b=['http','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','Condition,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x1e7667,_0x1e7c6d){var _0x107edc=function(_0x17356b){while(--_0x17356b){_0x1e7667['push'](_0x1e7667['shift']());}};_0x107edc(++_0x1e7c6d);}(_0x409b,0x123));var _0xb409=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x409b[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0xb409('0x0'));var util=require(_0xb409('0x1'));var moment=require(_0xb409('0x2'));var BPromise=require(_0xb409('0x3'));var rs=require(_0xb409('0x4'));var fs=require('fs');var Redis=require(_0xb409('0x5'));var db=require(_0xb409('0x6'))['db'];var utils=require(_0xb409('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb409('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb409('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x259546,_0x3f7fa7,_0x212c60){return new BPromise(function(_0x2df88f,_0x9a59aa){return client['request'](_0x259546,_0x212c60)[_0xb409('0xa')](function(_0x3c999c){logger['info']('Condition,\x20%s,\x20%s',_0x3f7fa7,_0xb409('0xb'));logger[_0xb409('0xc')](_0xb409('0xd'),_0x3f7fa7,_0xb409('0xb'),JSON[_0xb409('0xe')](_0x3c999c));if(_0x3c999c[_0xb409('0xf')]){if(_0x3c999c[_0xb409('0xf')]['code']===0x1f4){logger['error'](_0xb409('0x10'),_0x3f7fa7,_0x3c999c[_0xb409('0xf')][_0xb409('0x11')]);return _0x9a59aa(_0x3c999c['error']['message']);}logger[_0xb409('0xf')](_0xb409('0x10'),_0x3f7fa7,_0x3c999c[_0xb409('0xf')][_0xb409('0x11')]);return _0x2df88f(_0x3c999c[_0xb409('0xf')][_0xb409('0x11')]);}else{logger[_0xb409('0x12')]('Condition,\x20%s,\x20%s',_0x3f7fa7,_0xb409('0xb'));_0x2df88f(_0x3c999c['result'][_0xb409('0x11')]);}})[_0xb409('0x13')](function(_0x427c61){logger[_0xb409('0xf')](_0xb409('0x10'),_0x3f7fa7,_0x427c61);_0x9a59aa(_0x427c61);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4f41866..1ec3ea2 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 _0xdbb3=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','update'];(function(_0x35569e,_0x3d8716){var _0x5ca6af=function(_0x37b030){while(--_0x37b030){_0x35569e['push'](_0x35569e['shift']());}};_0x5ca6af(++_0x3d8716);}(_0xdbb3,0xb7));var _0x3dbb=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xdbb3[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0x3dbb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3dbb('0x1'));var express=require(_0x3dbb('0x2'));var router=express[_0x3dbb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3dbb('0x4'));var interaction=require(_0x3dbb('0x5'));var config=require(_0x3dbb('0x6'));var controller=require('./condition.controller');router['put']('/:id',auth[_0x3dbb('0x7')](),controller[_0x3dbb('0x8')]);router[_0x3dbb('0x9')]('/:id',auth[_0x3dbb('0x7')](),controller[_0x3dbb('0xa')]);module[_0x3dbb('0xb')]=router; \ No newline at end of file +var _0x987e=['/:id','update','isAuthenticated','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./condition.controller','put'];(function(_0x51a579,_0x42f80a){var _0x55f849=function(_0x1d27f9){while(--_0x1d27f9){_0x51a579['push'](_0x51a579['shift']());}};_0x55f849(++_0x42f80a);}(_0x987e,0xfb));var _0xe987=function(_0x3323dd,_0x1a18eb){_0x3323dd=_0x3323dd-0x0;var _0x4b6fdc=_0x987e[_0x3323dd];return _0x4b6fdc;};'use strict';var multer=require(_0xe987('0x0'));var util=require(_0xe987('0x1'));var path=require('path');var timeout=require(_0xe987('0x2'));var express=require(_0xe987('0x3'));var router=express[_0xe987('0x4')]();var fs_extra=require(_0xe987('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe987('0x6'));var controller=require(_0xe987('0x7'));router[_0xe987('0x8')](_0xe987('0x9'),auth['isAuthenticated'](),controller[_0xe987('0xa')]);router['delete'](_0xe987('0x9'),auth[_0xe987('0xb')](),controller[_0xe987('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ab58cba..6194f68 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 _0xb7e7=['STRING','sequelize'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xb7e7,0x121));var _0x7b7e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb7e7[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7957543..4e23450 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 _0xc71f=['defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','get','CustomDashboards','error','stack','name','send','map','Dashboard','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','clone','omit','createdAt','updatedAt','body','UserProfileSection','userProfileId','autoAssociation','update','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','filter','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x34fa37,_0x589eb5){var _0x5cce25=function(_0x4ab816){while(--_0x4ab816){_0x34fa37['push'](_0x34fa37['shift']());}};_0x5cce25(++_0x589eb5);}(_0xc71f,0x178));var _0xfc71=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0xc71f[_0x156a0d];return _0x98a9ba;};'use strict';var emlformat=require(_0xfc71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc71('0x1'));var jsonpatch=require(_0xfc71('0x2'));var rp=require(_0xfc71('0x3'));var moment=require(_0xfc71('0x4'));var BPromise=require(_0xfc71('0x5'));var Mustache=require(_0xfc71('0x6'));var util=require('util');var path=require(_0xfc71('0x7'));var sox=require('sox');var csv=require(_0xfc71('0x8'));var ejs=require(_0xfc71('0x9'));var fs=require('fs');var fs_extra=require(_0xfc71('0xa'));var _=require(_0xfc71('0xb'));var squel=require('squel');var crypto=require(_0xfc71('0xc'));var jsforce=require(_0xfc71('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc71('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc71('0xf'));var qs=require(_0xfc71('0x10'));var as=require(_0xfc71('0x11'));var hardwareService=require(_0xfc71('0x12'));var logger=require(_0xfc71('0x13'))(_0xfc71('0x14'));var utils=require(_0xfc71('0x15'));var config=require(_0xfc71('0x16'));var licenseUtil=require(_0xfc71('0x17'));var db=require(_0xfc71('0x18'))['db'];config[_0xfc71('0x19')]=_[_0xfc71('0x1a')](config[_0xfc71('0x19')],{'host':_0xfc71('0x1b'),'port':0x18eb});var socket=require(_0xfc71('0x1c'))(new Redis(config[_0xfc71('0x19')]));require(_0xfc71('0x1d'))[_0xfc71('0x1e')](socket);function respondWithStatusCode(_0x31d7ec,_0x59b62e){_0x59b62e=_0x59b62e||0xcc;return function(_0x48fb36){if(_0x48fb36){return _0x31d7ec[_0xfc71('0x1f')](_0x59b62e);}return _0x31d7ec[_0xfc71('0x20')](_0x59b62e)[_0xfc71('0x21')]();};}function respondWithResult(_0x31f418,_0x253b18){_0x253b18=_0x253b18||0xc8;return function(_0x5c4abc){if(_0x5c4abc){return _0x31f418[_0xfc71('0x20')](_0x253b18)['json'](_0x5c4abc);}};}function respondWithFilteredResult(_0x1702b2,_0x176b7c){return function(_0x2f831d){if(_0x2f831d){var _0x5d8f87=typeof _0x176b7c[_0xfc71('0x22')]===_0xfc71('0x23')&&typeof _0x176b7c['limit']===_0xfc71('0x23');var _0x2c6b8d=_0x2f831d[_0xfc71('0x24')];var _0x11fc42=_0x5d8f87?0x0:_0x176b7c[_0xfc71('0x22')];var _0x2d2715=_0x5d8f87?_0x2f831d['count']:_0x176b7c['offset']+_0x176b7c[_0xfc71('0x25')];var _0x43c3d0;if(_0x2d2715>=_0x2c6b8d){_0x2d2715=_0x2c6b8d;_0x43c3d0=0xc8;}else{_0x43c3d0=0xce;}_0x1702b2[_0xfc71('0x20')](_0x43c3d0);return _0x1702b2[_0xfc71('0x26')](_0xfc71('0x27'),_0x11fc42+'-'+_0x2d2715+'/'+_0x2c6b8d)[_0xfc71('0x28')](_0x2f831d);}return null;};}function patchUpdates(_0x165d33){return function(_0x30fce6){try{jsonpatch[_0xfc71('0x29')](_0x30fce6,_0x165d33,!![]);}catch(_0x93c0e4){return BPromise[_0xfc71('0x2a')](_0x93c0e4);}return _0x30fce6[_0xfc71('0x2b')]();};}function saveUpdates(_0x11288b,_0x3f6e8a){return function(_0x15a75a){if(_0x15a75a){return _0x15a75a['update'](_0x11288b)['then'](function(_0x2d7bbd){return _0x2d7bbd;});}return null;};}function removeEntity(_0x3f4e7d,_0x209ef7){return function(_0x247695){if(_0x247695){return _0x247695[_0xfc71('0x2c')]()[_0xfc71('0x2d')](function(){var _0x354194=_0x247695[_0xfc71('0x2e')]({'plain':!![]});var _0x13cbb0=_0xfc71('0x2f');return db['UserProfileResource'][_0xfc71('0x2c')]({'where':{'type':_0x13cbb0,'resourceId':_0x354194['id']}})[_0xfc71('0x2d')](function(){return _0x247695;});})[_0xfc71('0x2d')](function(){_0x3f4e7d[_0xfc71('0x20')](0xcc)[_0xfc71('0x21')]();});}};}function handleEntityNotFound(_0x36016c,_0x1c4621){return function(_0x497612){if(!_0x497612){_0x36016c[_0xfc71('0x1f')](0x194);}return _0x497612;};}function handleError(_0x11a039,_0x3c594a){_0x3c594a=_0x3c594a||0x1f4;return function(_0x2618bc){logger[_0xfc71('0x30')](_0x2618bc[_0xfc71('0x31')]);if(_0x2618bc[_0xfc71('0x32')]){delete _0x2618bc[_0xfc71('0x32')];}_0x11a039[_0xfc71('0x20')](_0x3c594a)[_0xfc71('0x33')](_0x2618bc);};}exports['index']=function(_0x4da588,_0x94b597){var _0x1be7ac={},_0x5b8660={},_0x1bdad2={'count':0x0,'rows':[]};var _0x187436=_[_0xfc71('0x34')](db[_0xfc71('0x35')][_0xfc71('0x36')],function(_0x15e0d0){return{'name':_0x15e0d0['fieldName'],'type':_0x15e0d0[_0xfc71('0x37')][_0xfc71('0x38')]};});_0x5b8660['model']=_[_0xfc71('0x34')](_0x187436,_0xfc71('0x32'));_0x5b8660['query']=_[_0xfc71('0x39')](_0x4da588[_0xfc71('0x3a')]);_0x5b8660[_0xfc71('0x3b')]=_[_0xfc71('0x3c')](_0x5b8660['model'],_0x5b8660['query']);_0x1be7ac[_0xfc71('0x3d')]=_[_0xfc71('0x3c')](_0x5b8660[_0xfc71('0x3e')],qs[_0xfc71('0x3f')](_0x4da588[_0xfc71('0x3a')][_0xfc71('0x3f')]));_0x1be7ac['attributes']=_0x1be7ac['attributes'][_0xfc71('0x40')]?_0x1be7ac[_0xfc71('0x3d')]:_0x5b8660['model'];if(!_0x4da588[_0xfc71('0x3a')]['hasOwnProperty'](_0xfc71('0x41'))){_0x1be7ac[_0xfc71('0x25')]=qs['limit'](_0x4da588[_0xfc71('0x3a')]['limit']);_0x1be7ac[_0xfc71('0x22')]=qs['offset'](_0x4da588[_0xfc71('0x3a')][_0xfc71('0x22')]);}_0x1be7ac[_0xfc71('0x42')]=qs[_0xfc71('0x43')](_0x4da588['query'][_0xfc71('0x43')]);_0x1be7ac[_0xfc71('0x44')]=qs['filters'](_[_0xfc71('0x45')](_0x4da588[_0xfc71('0x3a')],_0x5b8660[_0xfc71('0x3b')]),_0x187436);if(_0x4da588[_0xfc71('0x3a')]['filter']){_0x1be7ac[_0xfc71('0x44')]=_[_0xfc71('0x46')](_0x1be7ac[_0xfc71('0x44')],{'$or':_[_0xfc71('0x34')](_0x187436,function(_0x3636dd){if(_0x3636dd[_0xfc71('0x37')]!==_0xfc71('0x47')){var _0x35ad77={};_0x35ad77[_0x3636dd[_0xfc71('0x32')]]={'$like':'%'+_0x4da588[_0xfc71('0x3a')]['filter']+'%'};return _0x35ad77;}})});}_0x1be7ac=_[_0xfc71('0x46')]({},_0x1be7ac,_0x4da588[_0xfc71('0x48')]);var _0x545da8={'where':_0x1be7ac[_0xfc71('0x44')]};return db[_0xfc71('0x35')][_0xfc71('0x24')](_0x545da8)[_0xfc71('0x2d')](function(_0x59f087){_0x1bdad2[_0xfc71('0x24')]=_0x59f087;if(_0x4da588[_0xfc71('0x3a')][_0xfc71('0x49')]){_0x1be7ac['include']=[{'all':!![]}];}return db[_0xfc71('0x35')]['findAll'](_0x1be7ac);})[_0xfc71('0x2d')](function(_0x3117a6){_0x1bdad2[_0xfc71('0x4a')]=_0x3117a6;return _0x1bdad2;})[_0xfc71('0x2d')](respondWithFilteredResult(_0x94b597,_0x1be7ac))[_0xfc71('0x4b')](handleError(_0x94b597,null));};exports[_0xfc71('0x4c')]=function(_0x329b05,_0x211209){var _0x2f765a={'raw':![],'where':{'id':_0x329b05[_0xfc71('0x4d')]['id']}},_0x7903e9={};_0x7903e9[_0xfc71('0x3e')]=_[_0xfc71('0x39')](db[_0xfc71('0x35')][_0xfc71('0x36')]);_0x7903e9[_0xfc71('0x3a')]=_[_0xfc71('0x39')](_0x329b05[_0xfc71('0x3a')]);_0x7903e9[_0xfc71('0x3b')]=_['intersection'](_0x7903e9[_0xfc71('0x3e')],_0x7903e9[_0xfc71('0x3a')]);_0x2f765a['attributes']=_[_0xfc71('0x3c')](_0x7903e9[_0xfc71('0x3e')],qs[_0xfc71('0x3f')](_0x329b05[_0xfc71('0x3a')][_0xfc71('0x3f')]));_0x2f765a[_0xfc71('0x3d')]=_0x2f765a[_0xfc71('0x3d')][_0xfc71('0x40')]?_0x2f765a['attributes']:_0x7903e9[_0xfc71('0x3e')];if(_0x329b05['query']['includeAll']){_0x2f765a[_0xfc71('0x4e')]=[{'all':!![]}];}_0x2f765a=_['merge']({},_0x2f765a,_0x329b05['options']);return db[_0xfc71('0x35')][_0xfc71('0x4f')](_0x2f765a)[_0xfc71('0x2d')](handleEntityNotFound(_0x211209,null))[_0xfc71('0x2d')](respondWithResult(_0x211209,null))['catch'](handleError(_0x211209,null));};exports[_0xfc71('0x50')]=function(_0x4b39ef,_0x15dca9){return db[_0xfc71('0x35')][_0xfc71('0x50')](_0x4b39ef['body'],{})['then'](function(_0xd3865b){var _0x50d256=_0x4b39ef[_0xfc71('0x51')][_0xfc71('0x2e')]({'plain':!![]});if(!_0x50d256)throw new Error(_0xfc71('0x52'));if(_0x50d256[_0xfc71('0x53')]===_0xfc71('0x51')){var _0x1a932b=_0xd3865b['get']({'plain':!![]});var _0x620d10=_0xfc71('0x2f');return db['UserProfileSection'][_0xfc71('0x4f')]({'where':{'name':_0x620d10,'userProfileId':_0x50d256['userProfileId']},'raw':!![]})[_0xfc71('0x2d')](function(_0x7497a1){if(_0x7497a1&&_0x7497a1['autoAssociation']===0x0){return db['UserProfileResource'][_0xfc71('0x50')]({'name':_0x1a932b[_0xfc71('0x32')],'resourceId':_0x1a932b['id'],'type':_0x7497a1[_0xfc71('0x32')],'sectionId':_0x7497a1['id']},{})[_0xfc71('0x2d')](function(){return _0xd3865b;});}else{return _0xd3865b;}})[_0xfc71('0x4b')](function(_0x404987){logger[_0xfc71('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x404987);throw _0x404987;});}return _0xd3865b;})[_0xfc71('0x2d')](respondWithResult(_0x15dca9,0xc9))[_0xfc71('0x4b')](handleError(_0x15dca9,null));};exports[_0xfc71('0x54')]=function(_0x440ad8,_0x2a666a){var _0x419bb6={'where':{'id':_0x440ad8['params']['id']}},_0x5ca51={};_0x5ca51['model']=_[_0xfc71('0x39')](db[_0xfc71('0x35')]['rawAttributes']);_0x419bb6[_0xfc71('0x3d')]=_[_0xfc71('0x3c')](_0x5ca51['model'],qs[_0xfc71('0x3f')](_0x440ad8['query']['fields']));_0x419bb6[_0xfc71('0x3d')]=_0x419bb6[_0xfc71('0x3d')][_0xfc71('0x40')]?_0x419bb6[_0xfc71('0x3d')]:_0x5ca51['model'];if(_0x440ad8[_0xfc71('0x3a')][_0xfc71('0x49')]){_0x419bb6[_0xfc71('0x4e')]=[{'all':!![]}];}_0x419bb6=_[_0xfc71('0x46')]({},_0x419bb6,_0x440ad8[_0xfc71('0x48')]);return db['Dashboard']['find'](_0x419bb6)[_0xfc71('0x2d')](handleEntityNotFound(_0x2a666a,null))[_0xfc71('0x2d')](function(_0x14f780){if(_0x14f780){var _0x682c1=_0x14f780[_0xfc71('0x2e')]({'plain':!![]});_0x682c1=qs[_0xfc71('0x55')](_0x682c1,['id',_0xfc71('0x56'),_0xfc71('0x57')]);_0x440ad8['body']=_[_0xfc71('0x55')](_0x440ad8[_0xfc71('0x58')],['id',_0xfc71('0x56'),_0xfc71('0x57')]);return db[_0xfc71('0x35')][_0xfc71('0x50')](_[_0xfc71('0x46')](_0x682c1,_0x440ad8[_0xfc71('0x58')]),{'include':_0x440ad8['query'][_0xfc71('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x196763){var _0x2b655a=_0x440ad8['user'][_0xfc71('0x2e')]({'plain':!![]});if(!_0x2b655a)throw new Error(_0xfc71('0x52'));if(_0x2b655a[_0xfc71('0x53')]===_0xfc71('0x51')){var _0x1ed119=_0x196763[_0xfc71('0x2e')]({'plain':!![]});var _0x464bf7=_0xfc71('0x2f');return db[_0xfc71('0x59')]['find']({'where':{'name':_0x464bf7,'userProfileId':_0x2b655a[_0xfc71('0x5a')]},'raw':!![]})['then'](function(_0x5aaab8){if(_0x5aaab8&&_0x5aaab8[_0xfc71('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ed119['name'],'resourceId':_0x1ed119['id'],'type':_0x5aaab8[_0xfc71('0x32')],'sectionId':_0x5aaab8['id']},{})[_0xfc71('0x2d')](function(){return _0x196763;});}else{return _0x196763;}})[_0xfc71('0x4b')](function(_0x425d0d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x425d0d);throw _0x425d0d;});}return _0x196763;});}})[_0xfc71('0x2d')](respondWithResult(_0x2a666a,0xc9))['catch'](handleError(_0x2a666a,null));};exports[_0xfc71('0x5c')]=function(_0x34414b,_0x3a0b71){if(_0x34414b[_0xfc71('0x58')]['id']){delete _0x34414b[_0xfc71('0x58')]['id'];}return db[_0xfc71('0x35')][_0xfc71('0x4f')]({'where':{'id':_0x34414b[_0xfc71('0x4d')]['id']}})[_0xfc71('0x2d')](handleEntityNotFound(_0x3a0b71,null))[_0xfc71('0x2d')](saveUpdates(_0x34414b[_0xfc71('0x58')],null))[_0xfc71('0x2d')](respondWithResult(_0x3a0b71,null))[_0xfc71('0x4b')](handleError(_0x3a0b71,null));};exports[_0xfc71('0x2c')]=function(_0x2ac234,_0x6a1f1c){return db[_0xfc71('0x35')]['find']({'where':{'id':_0x2ac234[_0xfc71('0x4d')]['id']}})[_0xfc71('0x2d')](handleEntityNotFound(_0x6a1f1c,null))[_0xfc71('0x2d')](removeEntity(_0x6a1f1c,null))['catch'](handleError(_0x6a1f1c,null));};function widgetAttributes(_0x1c5462){try{switch(_0x1c5462[_0xfc71('0x37')]){case _0xfc71('0x5d'):return[{'name':_0xfc71('0x5e'),'value':_0x1c5462[_0xfc71('0x5e')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x0]?_0x1c5462[_0xfc71('0x5f')][0x0][_0xfc71('0x60')]:undefined)||'https://'}];case _0xfc71('0x61'):return[{'name':_0xfc71('0x62'),'value':_0x1c5462[_0xfc71('0x62')]||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x0]?_0x1c5462[_0xfc71('0x5f')][0x0][_0xfc71('0x60')]:undefined)||''}];case _0xfc71('0x63'):return[{'name':'attrHourFormat','value':_0x1c5462[_0xfc71('0x64')]||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x0]?_0x1c5462[_0xfc71('0x5f')][0x0][_0xfc71('0x60')]:undefined)||_0xfc71('0x65')},{'name':_0xfc71('0x66'),'value':_0x1c5462[_0xfc71('0x66')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462['attrs'][0x1]?_0x1c5462['attrs'][0x1][_0xfc71('0x60')]:undefined)||_0xfc71('0x67')},{'name':'attrFontSize','value':_0x1c5462[_0xfc71('0x68')]||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x2]?_0x1c5462[_0xfc71('0x5f')][0x2][_0xfc71('0x60')]:undefined)||0xc}];case _0xfc71('0x69'):return[{'name':_0xfc71('0x6a'),'value':_0x1c5462[_0xfc71('0x6a')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x0]?_0x1c5462[_0xfc71('0x5f')][0x0][_0xfc71('0x60')]:undefined)||_0xfc71('0x6b')},{'name':_0xfc71('0x6c'),'value':_0x1c5462[_0xfc71('0x6c')]||(_0x1c5462['attrs']&&_0x1c5462['attrs'][0x1]?_0x1c5462[_0xfc71('0x5f')][0x1][_0xfc71('0x60')]:undefined)||[]},{'name':_0xfc71('0x68'),'value':_0x1c5462[_0xfc71('0x68')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462['attrs'][0x2]?_0x1c5462[_0xfc71('0x5f')][0x2][_0xfc71('0x60')]:undefined)||0x14},{'name':_0xfc71('0x6d'),'value':_0x1c5462['attrChannel']||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x3]?_0x1c5462[_0xfc71('0x5f')][0x3]['value']:undefined)||_0xfc71('0x6e')},{'name':'attrEmailAccounts','value':_0x1c5462[_0xfc71('0x6f')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x4]?_0x1c5462[_0xfc71('0x5f')][0x4][_0xfc71('0x60')]:undefined)||''},{'name':_0xfc71('0x70'),'value':_0x1c5462['attrFaxAccounts']||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x5]?_0x1c5462[_0xfc71('0x5f')][0x5][_0xfc71('0x60')]:undefined)||''},{'name':_0xfc71('0x71'),'value':_0x1c5462[_0xfc71('0x71')]||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x6]?_0x1c5462[_0xfc71('0x5f')][0x6]['value']:undefined)||''},{'name':_0xfc71('0x72'),'value':_0x1c5462['attrOpenchannelAccounts']||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x7]?_0x1c5462[_0xfc71('0x5f')][0x7][_0xfc71('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1c5462[_0xfc71('0x73')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x8]?_0x1c5462['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x1c5462[_0xfc71('0x74')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x9]?_0x1c5462['attrs'][0x9][_0xfc71('0x60')]:undefined)||''}];case _0xfc71('0x75'):case'pie-chart':return[{'name':_0xfc71('0x76'),'value':_0x1c5462[_0xfc71('0x76')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x0]?_0x1c5462[_0xfc71('0x5f')][0x0][_0xfc71('0x60')]:undefined)||_0xfc71('0x6b')},{'name':_0xfc71('0x77'),'value':_0x1c5462['attrSerie2']||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x1]?_0x1c5462['attrs'][0x1][_0xfc71('0x60')]:undefined)||null},{'name':_0xfc71('0x78'),'value':_0x1c5462[_0xfc71('0x78')]||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x2]?_0x1c5462['attrs'][0x2][_0xfc71('0x60')]:undefined)||null},{'name':_0xfc71('0x6c'),'value':_0x1c5462[_0xfc71('0x6c')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x3]?_0x1c5462['attrs'][0x3]['value']:undefined)||[]},{'name':_0xfc71('0x6d'),'value':_0x1c5462[_0xfc71('0x6d')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x4]?_0x1c5462['attrs'][0x4][_0xfc71('0x60')]:undefined)||_0xfc71('0x6e')},{'name':_0xfc71('0x6f'),'value':_0x1c5462['attrEmailAccounts']||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x5]?_0x1c5462[_0xfc71('0x5f')][0x5][_0xfc71('0x60')]:undefined)||''},{'name':_0xfc71('0x70'),'value':_0x1c5462[_0xfc71('0x70')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462['attrs'][0x6]?_0x1c5462[_0xfc71('0x5f')][0x6]['value']:undefined)||''},{'name':_0xfc71('0x71'),'value':_0x1c5462[_0xfc71('0x71')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x7]?_0x1c5462[_0xfc71('0x5f')][0x7]['value']:undefined)||''},{'name':_0xfc71('0x72'),'value':_0x1c5462['attrOpenchannelAccounts']||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x8]?_0x1c5462[_0xfc71('0x5f')][0x8][_0xfc71('0x60')]:undefined)||''},{'name':_0xfc71('0x73'),'value':_0x1c5462[_0xfc71('0x73')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x9]?_0x1c5462[_0xfc71('0x5f')][0x9][_0xfc71('0x60')]:undefined)||''},{'name':_0xfc71('0x74'),'value':_0x1c5462[_0xfc71('0x74')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0xa]?_0x1c5462['attrs'][0xa][_0xfc71('0x60')]:undefined)||''}];case _0xfc71('0x79'):return[{'name':_0xfc71('0x7a'),'type':_0x1c5462[_0xfc71('0x7b')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x0]?_0x1c5462[_0xfc71('0x5f')][0x0]['type']:undefined)||null,'value':_0x1c5462[_0xfc71('0x7a')]||(_0x1c5462[_0xfc71('0x5f')]&&_0x1c5462[_0xfc71('0x5f')][0x0]?_0x1c5462[_0xfc71('0x5f')][0x0][_0xfc71('0x60')]:undefined)||null},{'name':_0xfc71('0x7c'),'value':_0x1c5462[_0xfc71('0x7c')]||(_0x1c5462['attrs']&&_0x1c5462[_0xfc71('0x5f')][0x1]?_0x1c5462[_0xfc71('0x5f')][0x1][_0xfc71('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x36fe32){logger[_0xfc71('0x30')](_0xfc71('0x7d'),JSON[_0xfc71('0x7e')](_0x36fe32));return[];}}exports[_0xfc71('0x7f')]=function(_0x29aac5,_0x1a88b7,_0x26a045){if(_0x29aac5[_0xfc71('0x58')]['id']){delete _0x29aac5[_0xfc71('0x58')]['id'];}return db['Dashboard'][_0xfc71('0x4f')]({'where':{'id':_0x29aac5[_0xfc71('0x4d')]['id']}})[_0xfc71('0x2d')](handleEntityNotFound(_0x1a88b7,null))['then'](function(_0x22ec29){if(_0x22ec29){_0x29aac5[_0xfc71('0x58')][_0xfc71('0x80')]=_0x22ec29['id'];_0x29aac5['body'][_0xfc71('0x5f')]=widgetAttributes(_0x29aac5['body']);return db[_0xfc71('0x81')][_0xfc71('0x50')](_0x29aac5[_0xfc71('0x58')]);}})['then'](respondWithResult(_0x1a88b7,null))[_0xfc71('0x4b')](handleError(_0x1a88b7,null));};exports[_0xfc71('0x82')]=function(_0x5970f4,_0x353c9d,_0x374868){var _0x54196b={};var _0x5ab321={};var _0x54fa73;var _0x4cada9;return db[_0xfc71('0x35')][_0xfc71('0x83')]({'where':{'id':_0x5970f4[_0xfc71('0x4d')]['id']}})[_0xfc71('0x2d')](handleEntityNotFound(_0x353c9d,null))[_0xfc71('0x2d')](function(_0x3c17ea){if(_0x3c17ea){_0x54fa73=_0x3c17ea;_0x5ab321[_0xfc71('0x3e')]=_[_0xfc71('0x39')](db[_0xfc71('0x81')][_0xfc71('0x36')]);_0x5ab321[_0xfc71('0x3a')]=_[_0xfc71('0x39')](_0x5970f4[_0xfc71('0x3a')]);_0x5ab321[_0xfc71('0x3b')]=_[_0xfc71('0x3c')](_0x5ab321[_0xfc71('0x3e')],_0x5ab321[_0xfc71('0x3a')]);_0x54196b['attributes']=_[_0xfc71('0x3c')](_0x5ab321[_0xfc71('0x3e')],qs[_0xfc71('0x3f')](_0x5970f4[_0xfc71('0x3a')]['fields']));_0x54196b[_0xfc71('0x3d')]=_0x54196b[_0xfc71('0x3d')]['length']?_0x54196b[_0xfc71('0x3d')]:_0x5ab321[_0xfc71('0x3e')];_0x54196b[_0xfc71('0x42')]=qs[_0xfc71('0x43')](_0x5970f4[_0xfc71('0x3a')][_0xfc71('0x43')]);_0x54196b[_0xfc71('0x44')]=qs[_0xfc71('0x3b')](_[_0xfc71('0x45')](_0x5970f4[_0xfc71('0x3a')],_0x5ab321[_0xfc71('0x3b')]));if(_0x5970f4[_0xfc71('0x3a')][_0xfc71('0x84')]){_0x54196b[_0xfc71('0x44')]=_[_0xfc71('0x46')](_0x54196b[_0xfc71('0x44')],{'$or':_[_0xfc71('0x34')](_0x54196b[_0xfc71('0x3d')],function(_0x470c4f){var _0x3ef9dc={};_0x3ef9dc[_0x470c4f]={'$like':'%'+_0x5970f4[_0xfc71('0x3a')]['filter']+'%'};return _0x3ef9dc;})});}_0x54196b=_[_0xfc71('0x46')]({},_0x54196b,_0x5970f4[_0xfc71('0x48')]);return _0x54fa73['getItems'](_0x54196b);}})[_0xfc71('0x2d')](function(_0x4eac23){if(_0x4eac23){_0x4cada9=_0x4eac23['length'];if(!_0x5970f4[_0xfc71('0x3a')][_0xfc71('0x85')](_0xfc71('0x41'))){_0x54196b[_0xfc71('0x25')]=qs[_0xfc71('0x25')](_0x5970f4[_0xfc71('0x3a')]['limit']);_0x54196b[_0xfc71('0x22')]=qs[_0xfc71('0x22')](_0x5970f4['query']['offset']);}return _0x54fa73[_0xfc71('0x82')](_0x54196b);}})[_0xfc71('0x2d')](function(_0x1fb1c0){if(_0x1fb1c0){return _0x1fb1c0?{'count':_0x4cada9,'rows':_0x1fb1c0}:null;}})[_0xfc71('0x2d')](respondWithResult(_0x353c9d,null))[_0xfc71('0x4b')](handleError(_0x353c9d,null));}; \ No newline at end of file +var _0xf719=['to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./dashboard.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','user','role','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','getItems','findOne','DashboardItem','order','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox'];(function(_0x36c6f4,_0x27ea73){var _0x3517fa=function(_0xf66780){while(--_0xf66780){_0x36c6f4['push'](_0x36c6f4['shift']());}};_0x3517fa(++_0x27ea73);}(_0xf719,0xf7));var _0x9f71=function(_0x2abec0,_0x480ff3){_0x2abec0=_0x2abec0-0x0;var _0x4bf548=_0xf719[_0x2abec0];return _0x4bf548;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f71('0x0'));var zipdir=require(_0x9f71('0x1'));var jsonpatch=require(_0x9f71('0x2'));var rp=require(_0x9f71('0x3'));var moment=require(_0x9f71('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9f71('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9f71('0x6'));var csv=require(_0x9f71('0x7'));var ejs=require(_0x9f71('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f71('0x9'));var squel=require(_0x9f71('0xa'));var crypto=require('crypto');var jsforce=require(_0x9f71('0xb'));var deskjs=require(_0x9f71('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f71('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9f71('0xe'));var as=require(_0x9f71('0xf'));var hardwareService=require(_0x9f71('0x10'));var logger=require(_0x9f71('0x11'))(_0x9f71('0x12'));var utils=require('../../config/utils');var config=require(_0x9f71('0x13'));var licenseUtil=require(_0x9f71('0x14'));var db=require(_0x9f71('0x15'))['db'];config[_0x9f71('0x16')]=_['defaults'](config[_0x9f71('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f71('0x16')]));require(_0x9f71('0x17'))[_0x9f71('0x18')](socket);function respondWithStatusCode(_0x23d809,_0x5ca89f){_0x5ca89f=_0x5ca89f||0xcc;return function(_0x44f06b){if(_0x44f06b){return _0x23d809['sendStatus'](_0x5ca89f);}return _0x23d809['status'](_0x5ca89f)[_0x9f71('0x19')]();};}function respondWithResult(_0x4885b1,_0x165188){_0x165188=_0x165188||0xc8;return function(_0x138c6a){if(_0x138c6a){return _0x4885b1[_0x9f71('0x1a')](_0x165188)[_0x9f71('0x1b')](_0x138c6a);}};}function respondWithFilteredResult(_0x109290,_0x5db10a){return function(_0x4c7870){if(_0x4c7870){var _0x3c5cd6=typeof _0x5db10a[_0x9f71('0x1c')]===_0x9f71('0x1d')&&typeof _0x5db10a['limit']==='undefined';var _0x40174b=_0x4c7870['count'];var _0x171c23=_0x3c5cd6?0x0:_0x5db10a[_0x9f71('0x1c')];var _0x25ffb7=_0x3c5cd6?_0x4c7870[_0x9f71('0x1e')]:_0x5db10a[_0x9f71('0x1c')]+_0x5db10a[_0x9f71('0x1f')];var _0x1b5429;if(_0x25ffb7>=_0x40174b){_0x25ffb7=_0x40174b;_0x1b5429=0xc8;}else{_0x1b5429=0xce;}_0x109290['status'](_0x1b5429);return _0x109290[_0x9f71('0x20')](_0x9f71('0x21'),_0x171c23+'-'+_0x25ffb7+'/'+_0x40174b)['json'](_0x4c7870);}return null;};}function patchUpdates(_0x2438c8){return function(_0x31a9a2){try{jsonpatch['apply'](_0x31a9a2,_0x2438c8,!![]);}catch(_0x47dd40){return BPromise['reject'](_0x47dd40);}return _0x31a9a2[_0x9f71('0x22')]();};}function saveUpdates(_0x3b5230,_0x5570be){return function(_0x2382bf){if(_0x2382bf){return _0x2382bf['update'](_0x3b5230)[_0x9f71('0x23')](function(_0xf41810){return _0xf41810;});}return null;};}function removeEntity(_0x227033,_0x3f71d9){return function(_0x599306){if(_0x599306){return _0x599306[_0x9f71('0x24')]()[_0x9f71('0x23')](function(){var _0x2a0b87=_0x599306[_0x9f71('0x25')]({'plain':!![]});var _0x26fd57='CustomDashboards';return db[_0x9f71('0x26')]['destroy']({'where':{'type':_0x26fd57,'resourceId':_0x2a0b87['id']}})[_0x9f71('0x23')](function(){return _0x599306;});})[_0x9f71('0x23')](function(){_0x227033[_0x9f71('0x1a')](0xcc)[_0x9f71('0x19')]();});}};}function handleEntityNotFound(_0x27b44d,_0x12e4c9){return function(_0x706ec){if(!_0x706ec){_0x27b44d[_0x9f71('0x27')](0x194);}return _0x706ec;};}function handleError(_0x4ae9df,_0x5b1949){_0x5b1949=_0x5b1949||0x1f4;return function(_0x542920){logger['error'](_0x542920[_0x9f71('0x28')]);if(_0x542920[_0x9f71('0x29')]){delete _0x542920[_0x9f71('0x29')];}_0x4ae9df['status'](_0x5b1949)[_0x9f71('0x2a')](_0x542920);};}exports[_0x9f71('0x2b')]=function(_0xd46f2e,_0x131f6c){var _0x349638={},_0x3d1b07={},_0x5c2feb={'count':0x0,'rows':[]};var _0x208090=_[_0x9f71('0x2c')](db['Dashboard'][_0x9f71('0x2d')],function(_0x1273fb){return{'name':_0x1273fb['fieldName'],'type':_0x1273fb[_0x9f71('0x2e')][_0x9f71('0x2f')]};});_0x3d1b07[_0x9f71('0x30')]=_[_0x9f71('0x2c')](_0x208090,_0x9f71('0x29'));_0x3d1b07[_0x9f71('0x31')]=_[_0x9f71('0x32')](_0xd46f2e[_0x9f71('0x31')]);_0x3d1b07[_0x9f71('0x33')]=_['intersection'](_0x3d1b07[_0x9f71('0x30')],_0x3d1b07[_0x9f71('0x31')]);_0x349638[_0x9f71('0x34')]=_[_0x9f71('0x35')](_0x3d1b07[_0x9f71('0x30')],qs[_0x9f71('0x36')](_0xd46f2e[_0x9f71('0x31')][_0x9f71('0x36')]));_0x349638[_0x9f71('0x34')]=_0x349638[_0x9f71('0x34')][_0x9f71('0x37')]?_0x349638[_0x9f71('0x34')]:_0x3d1b07['model'];if(!_0xd46f2e['query'][_0x9f71('0x38')](_0x9f71('0x39'))){_0x349638[_0x9f71('0x1f')]=qs[_0x9f71('0x1f')](_0xd46f2e[_0x9f71('0x31')][_0x9f71('0x1f')]);_0x349638[_0x9f71('0x1c')]=qs[_0x9f71('0x1c')](_0xd46f2e['query'][_0x9f71('0x1c')]);}_0x349638['order']=qs[_0x9f71('0x3a')](_0xd46f2e[_0x9f71('0x31')][_0x9f71('0x3a')]);_0x349638[_0x9f71('0x3b')]=qs[_0x9f71('0x33')](_['pick'](_0xd46f2e[_0x9f71('0x31')],_0x3d1b07[_0x9f71('0x33')]),_0x208090);if(_0xd46f2e[_0x9f71('0x31')][_0x9f71('0x3c')]){_0x349638[_0x9f71('0x3b')]=_[_0x9f71('0x3d')](_0x349638['where'],{'$or':_[_0x9f71('0x2c')](_0x208090,function(_0x2a6bed){if(_0x2a6bed['type']!==_0x9f71('0x3e')){var _0x4dff39={};_0x4dff39[_0x2a6bed['name']]={'$like':'%'+_0xd46f2e['query'][_0x9f71('0x3c')]+'%'};return _0x4dff39;}})});}_0x349638=_[_0x9f71('0x3d')]({},_0x349638,_0xd46f2e[_0x9f71('0x3f')]);var _0x4665b5={'where':_0x349638[_0x9f71('0x3b')]};return db[_0x9f71('0x40')][_0x9f71('0x1e')](_0x4665b5)[_0x9f71('0x23')](function(_0x40bae4){_0x5c2feb[_0x9f71('0x1e')]=_0x40bae4;if(_0xd46f2e['query'][_0x9f71('0x41')]){_0x349638[_0x9f71('0x42')]=[{'all':!![]}];}return db['Dashboard'][_0x9f71('0x43')](_0x349638);})[_0x9f71('0x23')](function(_0x21f2d2){_0x5c2feb['rows']=_0x21f2d2;return _0x5c2feb;})[_0x9f71('0x23')](respondWithFilteredResult(_0x131f6c,_0x349638))[_0x9f71('0x44')](handleError(_0x131f6c,null));};exports[_0x9f71('0x45')]=function(_0x36135d,_0x38e832){var _0x42058c={'raw':![],'where':{'id':_0x36135d[_0x9f71('0x46')]['id']}},_0x3022ce={};_0x3022ce[_0x9f71('0x30')]=_[_0x9f71('0x32')](db[_0x9f71('0x40')][_0x9f71('0x2d')]);_0x3022ce[_0x9f71('0x31')]=_['keys'](_0x36135d[_0x9f71('0x31')]);_0x3022ce[_0x9f71('0x33')]=_[_0x9f71('0x35')](_0x3022ce[_0x9f71('0x30')],_0x3022ce[_0x9f71('0x31')]);_0x42058c[_0x9f71('0x34')]=_[_0x9f71('0x35')](_0x3022ce[_0x9f71('0x30')],qs[_0x9f71('0x36')](_0x36135d[_0x9f71('0x31')]['fields']));_0x42058c[_0x9f71('0x34')]=_0x42058c[_0x9f71('0x34')]['length']?_0x42058c[_0x9f71('0x34')]:_0x3022ce['model'];if(_0x36135d[_0x9f71('0x31')][_0x9f71('0x41')]){_0x42058c[_0x9f71('0x42')]=[{'all':!![]}];}_0x42058c=_[_0x9f71('0x3d')]({},_0x42058c,_0x36135d[_0x9f71('0x3f')]);return db[_0x9f71('0x40')][_0x9f71('0x47')](_0x42058c)[_0x9f71('0x23')](handleEntityNotFound(_0x38e832,null))[_0x9f71('0x23')](respondWithResult(_0x38e832,null))['catch'](handleError(_0x38e832,null));};exports[_0x9f71('0x48')]=function(_0x2e91d1,_0x4e415c){return db[_0x9f71('0x40')]['create'](_0x2e91d1['body'],{})[_0x9f71('0x23')](function(_0x14d608){var _0x31b949=_0x2e91d1['user'][_0x9f71('0x25')]({'plain':!![]});if(!_0x31b949)throw new Error(_0x9f71('0x49'));if(_0x31b949['role']==='user'){var _0x5145ce=_0x14d608[_0x9f71('0x25')]({'plain':!![]});var _0x19a71c=_0x9f71('0x4a');return db['UserProfileSection'][_0x9f71('0x47')]({'where':{'name':_0x19a71c,'userProfileId':_0x31b949[_0x9f71('0x4b')]},'raw':!![]})['then'](function(_0x50d3dd){if(_0x50d3dd&&_0x50d3dd[_0x9f71('0x4c')]===0x0){return db[_0x9f71('0x26')][_0x9f71('0x48')]({'name':_0x5145ce['name'],'resourceId':_0x5145ce['id'],'type':_0x50d3dd['name'],'sectionId':_0x50d3dd['id']},{})[_0x9f71('0x23')](function(){return _0x14d608;});}else{return _0x14d608;}})[_0x9f71('0x44')](function(_0x3a3de6){logger[_0x9f71('0x4d')](_0x9f71('0x4e'),_0x3a3de6);throw _0x3a3de6;});}return _0x14d608;})[_0x9f71('0x23')](respondWithResult(_0x4e415c,0xc9))[_0x9f71('0x44')](handleError(_0x4e415c,null));};exports[_0x9f71('0x4f')]=function(_0x162beb,_0x5707c1){var _0x31089f={'where':{'id':_0x162beb[_0x9f71('0x46')]['id']}},_0x4a76fb={};_0x4a76fb[_0x9f71('0x30')]=_[_0x9f71('0x32')](db[_0x9f71('0x40')][_0x9f71('0x2d')]);_0x31089f[_0x9f71('0x34')]=_[_0x9f71('0x35')](_0x4a76fb[_0x9f71('0x30')],qs['fields'](_0x162beb[_0x9f71('0x31')][_0x9f71('0x36')]));_0x31089f[_0x9f71('0x34')]=_0x31089f[_0x9f71('0x34')][_0x9f71('0x37')]?_0x31089f[_0x9f71('0x34')]:_0x4a76fb[_0x9f71('0x30')];if(_0x162beb[_0x9f71('0x31')][_0x9f71('0x41')]){_0x31089f[_0x9f71('0x42')]=[{'all':!![]}];}_0x31089f=_[_0x9f71('0x3d')]({},_0x31089f,_0x162beb['options']);return db['Dashboard'][_0x9f71('0x47')](_0x31089f)['then'](handleEntityNotFound(_0x5707c1,null))[_0x9f71('0x23')](function(_0x13ecaa){if(_0x13ecaa){var _0x1775b5=_0x13ecaa[_0x9f71('0x25')]({'plain':!![]});_0x1775b5=qs[_0x9f71('0x50')](_0x1775b5,['id',_0x9f71('0x51'),_0x9f71('0x52')]);_0x162beb[_0x9f71('0x53')]=_['omit'](_0x162beb[_0x9f71('0x53')],['id',_0x9f71('0x51'),_0x9f71('0x52')]);return db['Dashboard'][_0x9f71('0x48')](_[_0x9f71('0x3d')](_0x1775b5,_0x162beb[_0x9f71('0x53')]),{'include':_0x162beb[_0x9f71('0x31')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xf41afb){var _0x46df5d=_0x162beb[_0x9f71('0x54')][_0x9f71('0x25')]({'plain':!![]});if(!_0x46df5d)throw new Error(_0x9f71('0x49'));if(_0x46df5d[_0x9f71('0x55')]==='user'){var _0x4fbe29=_0xf41afb[_0x9f71('0x25')]({'plain':!![]});var _0x1e7dc8=_0x9f71('0x4a');return db['UserProfileSection'][_0x9f71('0x47')]({'where':{'name':_0x1e7dc8,'userProfileId':_0x46df5d[_0x9f71('0x4b')]},'raw':!![]})[_0x9f71('0x23')](function(_0x4e0e6e){if(_0x4e0e6e&&_0x4e0e6e['autoAssociation']===0x0){return db[_0x9f71('0x26')][_0x9f71('0x48')]({'name':_0x4fbe29[_0x9f71('0x29')],'resourceId':_0x4fbe29['id'],'type':_0x4e0e6e[_0x9f71('0x29')],'sectionId':_0x4e0e6e['id']},{})[_0x9f71('0x23')](function(){return _0xf41afb;});}else{return _0xf41afb;}})[_0x9f71('0x44')](function(_0x456e23){logger[_0x9f71('0x4d')](_0x9f71('0x4e'),_0x456e23);throw _0x456e23;});}return _0xf41afb;});}})[_0x9f71('0x23')](respondWithResult(_0x5707c1,0xc9))[_0x9f71('0x44')](handleError(_0x5707c1,null));};exports[_0x9f71('0x56')]=function(_0x13afe9,_0x524660){if(_0x13afe9[_0x9f71('0x53')]['id']){delete _0x13afe9[_0x9f71('0x53')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x13afe9[_0x9f71('0x46')]['id']}})[_0x9f71('0x23')](handleEntityNotFound(_0x524660,null))['then'](saveUpdates(_0x13afe9['body'],null))['then'](respondWithResult(_0x524660,null))['catch'](handleError(_0x524660,null));};exports[_0x9f71('0x24')]=function(_0x22a128,_0x266878){return db[_0x9f71('0x40')][_0x9f71('0x47')]({'where':{'id':_0x22a128['params']['id']}})[_0x9f71('0x23')](handleEntityNotFound(_0x266878,null))[_0x9f71('0x23')](removeEntity(_0x266878,null))[_0x9f71('0x44')](handleError(_0x266878,null));};function widgetAttributes(_0x297846){try{switch(_0x297846[_0x9f71('0x2e')]){case _0x9f71('0x57'):return[{'name':_0x9f71('0x58'),'value':_0x297846[_0x9f71('0x58')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x0]?_0x297846['attrs'][0x0][_0x9f71('0x5a')]:undefined)||_0x9f71('0x5b')}];case _0x9f71('0x5c'):return[{'name':_0x9f71('0x5d'),'value':_0x297846['attrPath']||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x0]?_0x297846[_0x9f71('0x59')][0x0][_0x9f71('0x5a')]:undefined)||''}];case _0x9f71('0x5e'):return[{'name':_0x9f71('0x5f'),'value':_0x297846[_0x9f71('0x5f')]||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x0]?_0x297846[_0x9f71('0x59')][0x0]['value']:undefined)||_0x9f71('0x60')},{'name':_0x9f71('0x61'),'value':_0x297846[_0x9f71('0x61')]||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x1]?_0x297846[_0x9f71('0x59')][0x1][_0x9f71('0x5a')]:undefined)||_0x9f71('0x62')},{'name':_0x9f71('0x63'),'value':_0x297846['attrFontSize']||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x2]?_0x297846['attrs'][0x2][_0x9f71('0x5a')]:undefined)||0xc}];case _0x9f71('0x64'):return[{'name':_0x9f71('0x65'),'value':_0x297846[_0x9f71('0x65')]||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x0]?_0x297846[_0x9f71('0x59')][0x0][_0x9f71('0x5a')]:undefined)||'total'},{'name':_0x9f71('0x66'),'value':_0x297846[_0x9f71('0x66')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x1]?_0x297846[_0x9f71('0x59')][0x1][_0x9f71('0x5a')]:undefined)||[]},{'name':_0x9f71('0x63'),'value':_0x297846[_0x9f71('0x63')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x2]?_0x297846[_0x9f71('0x59')][0x2]['value']:undefined)||0x14},{'name':_0x9f71('0x67'),'value':_0x297846[_0x9f71('0x67')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x3]?_0x297846['attrs'][0x3][_0x9f71('0x5a')]:undefined)||_0x9f71('0x68')},{'name':_0x9f71('0x69'),'value':_0x297846[_0x9f71('0x69')]||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x4]?_0x297846[_0x9f71('0x59')][0x4][_0x9f71('0x5a')]:undefined)||''},{'name':_0x9f71('0x6a'),'value':_0x297846['attrFaxAccounts']||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x5]?_0x297846[_0x9f71('0x59')][0x5]['value']:undefined)||''},{'name':_0x9f71('0x6b'),'value':_0x297846['attrSmsAccounts']||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x6]?_0x297846['attrs'][0x6]['value']:undefined)||''},{'name':_0x9f71('0x6c'),'value':_0x297846[_0x9f71('0x6c')]||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x7]?_0x297846['attrs'][0x7][_0x9f71('0x5a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x297846[_0x9f71('0x6d')]||(_0x297846[_0x9f71('0x59')]&&_0x297846['attrs'][0x8]?_0x297846[_0x9f71('0x59')][0x8][_0x9f71('0x5a')]:undefined)||''},{'name':_0x9f71('0x6e'),'value':_0x297846[_0x9f71('0x6e')]||(_0x297846['attrs']&&_0x297846['attrs'][0x9]?_0x297846[_0x9f71('0x59')][0x9][_0x9f71('0x5a')]:undefined)||''}];case _0x9f71('0x6f'):case'pie-chart':return[{'name':_0x9f71('0x70'),'value':_0x297846[_0x9f71('0x70')]||(_0x297846[_0x9f71('0x59')]&&_0x297846['attrs'][0x0]?_0x297846['attrs'][0x0][_0x9f71('0x5a')]:undefined)||_0x9f71('0x71')},{'name':_0x9f71('0x72'),'value':_0x297846['attrSerie2']||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x1]?_0x297846[_0x9f71('0x59')][0x1][_0x9f71('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0x297846[_0x9f71('0x73')]||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x2]?_0x297846[_0x9f71('0x59')][0x2][_0x9f71('0x5a')]:undefined)||null},{'name':_0x9f71('0x66'),'value':_0x297846[_0x9f71('0x66')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x3]?_0x297846[_0x9f71('0x59')][0x3][_0x9f71('0x5a')]:undefined)||[]},{'name':_0x9f71('0x67'),'value':_0x297846[_0x9f71('0x67')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x4]?_0x297846[_0x9f71('0x59')][0x4][_0x9f71('0x5a')]:undefined)||'voice'},{'name':_0x9f71('0x69'),'value':_0x297846[_0x9f71('0x69')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x5]?_0x297846[_0x9f71('0x59')][0x5][_0x9f71('0x5a')]:undefined)||''},{'name':_0x9f71('0x6a'),'value':_0x297846[_0x9f71('0x6a')]||(_0x297846['attrs']&&_0x297846[_0x9f71('0x59')][0x6]?_0x297846['attrs'][0x6][_0x9f71('0x5a')]:undefined)||''},{'name':_0x9f71('0x6b'),'value':_0x297846[_0x9f71('0x6b')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x7]?_0x297846[_0x9f71('0x59')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x297846[_0x9f71('0x6c')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x8]?_0x297846[_0x9f71('0x59')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x297846[_0x9f71('0x6d')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x9]?_0x297846[_0x9f71('0x59')][0x9][_0x9f71('0x5a')]:undefined)||''},{'name':'attrChatWebsites','value':_0x297846['attrChatWebsites']||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0xa]?_0x297846[_0x9f71('0x59')][0xa][_0x9f71('0x5a')]:undefined)||''}];case _0x9f71('0x74'):return[{'name':_0x9f71('0x75'),'type':_0x297846[_0x9f71('0x76')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x0]?_0x297846[_0x9f71('0x59')][0x0][_0x9f71('0x2e')]:undefined)||null,'value':_0x297846['attrReport']||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x0]?_0x297846[_0x9f71('0x59')][0x0][_0x9f71('0x5a')]:undefined)||null},{'name':_0x9f71('0x77'),'value':_0x297846[_0x9f71('0x77')]||(_0x297846[_0x9f71('0x59')]&&_0x297846[_0x9f71('0x59')][0x1]?_0x297846[_0x9f71('0x59')][0x1][_0x9f71('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x45bb6b){logger[_0x9f71('0x4d')](_0x9f71('0x78'),JSON['stringify'](_0x45bb6b));return[];}}exports['addItem']=function(_0x384623,_0x1fa8e2,_0x3cda4f){if(_0x384623[_0x9f71('0x53')]['id']){delete _0x384623[_0x9f71('0x53')]['id'];}return db[_0x9f71('0x40')][_0x9f71('0x47')]({'where':{'id':_0x384623['params']['id']}})['then'](handleEntityNotFound(_0x1fa8e2,null))[_0x9f71('0x23')](function(_0x5e4717){if(_0x5e4717){_0x384623['body'][_0x9f71('0x79')]=_0x5e4717['id'];_0x384623['body'][_0x9f71('0x59')]=widgetAttributes(_0x384623[_0x9f71('0x53')]);return db['DashboardItem'][_0x9f71('0x48')](_0x384623[_0x9f71('0x53')]);}})[_0x9f71('0x23')](respondWithResult(_0x1fa8e2,null))[_0x9f71('0x44')](handleError(_0x1fa8e2,null));};exports[_0x9f71('0x7a')]=function(_0x59381f,_0x345efb,_0x196771){var _0x425457={};var _0x93ce99={};var _0x2675dd;var _0x7888b2;return db['Dashboard'][_0x9f71('0x7b')]({'where':{'id':_0x59381f['params']['id']}})[_0x9f71('0x23')](handleEntityNotFound(_0x345efb,null))[_0x9f71('0x23')](function(_0x5e6b2c){if(_0x5e6b2c){_0x2675dd=_0x5e6b2c;_0x93ce99['model']=_['keys'](db[_0x9f71('0x7c')]['rawAttributes']);_0x93ce99[_0x9f71('0x31')]=_['keys'](_0x59381f['query']);_0x93ce99[_0x9f71('0x33')]=_[_0x9f71('0x35')](_0x93ce99['model'],_0x93ce99[_0x9f71('0x31')]);_0x425457['attributes']=_[_0x9f71('0x35')](_0x93ce99[_0x9f71('0x30')],qs['fields'](_0x59381f[_0x9f71('0x31')][_0x9f71('0x36')]));_0x425457[_0x9f71('0x34')]=_0x425457[_0x9f71('0x34')][_0x9f71('0x37')]?_0x425457[_0x9f71('0x34')]:_0x93ce99['model'];_0x425457[_0x9f71('0x7d')]=qs[_0x9f71('0x3a')](_0x59381f[_0x9f71('0x31')][_0x9f71('0x3a')]);_0x425457[_0x9f71('0x3b')]=qs[_0x9f71('0x33')](_[_0x9f71('0x7e')](_0x59381f['query'],_0x93ce99[_0x9f71('0x33')]));if(_0x59381f[_0x9f71('0x31')]['filter']){_0x425457[_0x9f71('0x3b')]=_[_0x9f71('0x3d')](_0x425457['where'],{'$or':_['map'](_0x425457[_0x9f71('0x34')],function(_0x2f88c2){var _0x4f96ef={};_0x4f96ef[_0x2f88c2]={'$like':'%'+_0x59381f[_0x9f71('0x31')]['filter']+'%'};return _0x4f96ef;})});}_0x425457=_['merge']({},_0x425457,_0x59381f[_0x9f71('0x3f')]);return _0x2675dd['getItems'](_0x425457);}})['then'](function(_0xcc2c9b){if(_0xcc2c9b){_0x7888b2=_0xcc2c9b['length'];if(!_0x59381f['query'][_0x9f71('0x38')]('nolimit')){_0x425457['limit']=qs[_0x9f71('0x1f')](_0x59381f[_0x9f71('0x31')][_0x9f71('0x1f')]);_0x425457[_0x9f71('0x1c')]=qs[_0x9f71('0x1c')](_0x59381f['query'][_0x9f71('0x1c')]);}return _0x2675dd['getItems'](_0x425457);}})[_0x9f71('0x23')](function(_0x1e6026){if(_0x1e6026){return _0x1e6026?{'count':_0x7888b2,'rows':_0x1e6026}:null;}})[_0x9f71('0x23')](respondWithResult(_0x345efb,null))[_0x9f71('0x44')](handleError(_0x345efb,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 30ccc5a..f3f9223 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 _0x0bdb=['update','remove','emit','hook','events','../../mysqldb','Dashboard'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x0bdb,0x162));var _0xb0bd=function(_0x35f85f,_0x3e6bac){_0x35f85f=_0x35f85f-0x0;var _0x2fcb59=_0x0bdb[_0x35f85f];return _0x2fcb59;};'use strict';var EventEmitter=require(_0xb0bd('0x0'));var Dashboard=require(_0xb0bd('0x1'))['db'][_0xb0bd('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb0bd('0x3'),'afterDestroy':_0xb0bd('0x4')};function emitEvent(_0x5a2a52){return function(_0x9c17e3,_0x481618,_0x19cba2){DashboardEvents[_0xb0bd('0x5')](_0x5a2a52+':'+_0x9c17e3['id'],_0x9c17e3);DashboardEvents[_0xb0bd('0x5')](_0x5a2a52,_0x9c17e3);_0x19cba2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xb0bd('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x1cc6=['hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x1cc6,0x174));var _0x61cc=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x1cc6[_0x58e469];return _0x4c01c5;};'use strict';var EventEmitter=require(_0x61cc('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x61cc('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x61cc('0x2')](0x0);var events={'afterCreate':_0x61cc('0x3'),'afterUpdate':'update','afterDestroy':_0x61cc('0x4')};function emitEvent(_0x29c52c){return function(_0x3443b9,_0x4adf76,_0x1d7e04){DashboardEvents[_0x61cc('0x5')](_0x29c52c+':'+_0x3443b9['id'],_0x3443b9);DashboardEvents[_0x61cc('0x5')](_0x29c52c,_0x3443b9);_0x1d7e04(null);};}for(var e in events){if(events[_0x61cc('0x6')](e)){var event=events[e];Dashboard[_0x61cc('0x7')](e,emitEvent(event));}}module[_0x61cc('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index cf9a2c7..4c967d0 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 _0xd7d3=['./dashboard.attributes','Dashboard','dashboards','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x3440b1,_0x5d9ae8){var _0x18525a=function(_0x1a578c){while(--_0x1a578c){_0x3440b1['push'](_0x3440b1['shift']());}};_0x18525a(++_0x5d9ae8);}(_0xd7d3,0x67));var _0x3d7d=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0xd7d3[_0x4e4519];return _0x340044;};'use strict';var _=require(_0x3d7d('0x0'));var util=require(_0x3d7d('0x1'));var logger=require('../../config/logger')(_0x3d7d('0x2'));var moment=require(_0x3d7d('0x3'));var BPromise=require(_0x3d7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3d7d('0x5'));var config=require(_0x3d7d('0x6'));var attributes=require(_0x3d7d('0x7'));module['exports']=function(_0x193bd5,_0x155293){return _0x193bd5['define'](_0x3d7d('0x8'),attributes,{'tableName':_0x3d7d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9354=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash'];(function(_0x53c052,_0x2d5a6e){var _0x8b5de1=function(_0x39e946){while(--_0x39e946){_0x53c052['push'](_0x53c052['shift']());}};_0x8b5de1(++_0x2d5a6e);}(_0x9354,0x74));var _0x4935=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x9354[_0x2468b5];return _0x1056e4;};'use strict';var _=require(_0x4935('0x0'));var util=require(_0x4935('0x1'));var logger=require(_0x4935('0x2'))(_0x4935('0x3'));var moment=require('moment');var BPromise=require(_0x4935('0x4'));var rp=require(_0x4935('0x5'));var fs=require('fs');var path=require(_0x4935('0x6'));var rimraf=require(_0x4935('0x7'));var config=require(_0x4935('0x8'));var attributes=require(_0x4935('0x9'));module[_0x4935('0xa')]=function(_0x1da11c,_0x32c9ec){return _0x1da11c[_0x4935('0xb')]('Dashboard',attributes,{'tableName':_0x4935('0xc'),'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 efa6e94..2b8f847 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 _0xeb17=['request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x14197c,_0x561b54){var _0xf9c06a=function(_0x2bd2d9){while(--_0x2bd2d9){_0x14197c['push'](_0x14197c['shift']());}};_0xf9c06a(++_0x561b54);}(_0xeb17,0xe4));var _0x7eb1=function(_0xef5013,_0x14f9ca){_0xef5013=_0xef5013-0x0;var _0x1d4fbb=_0xeb17[_0xef5013];return _0x1d4fbb;};'use strict';var _=require(_0x7eb1('0x0'));var util=require(_0x7eb1('0x1'));var moment=require(_0x7eb1('0x2'));var BPromise=require(_0x7eb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7eb1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7eb1('0x5'))('rpc');var config=require(_0x7eb1('0x6'));var jayson=require(_0x7eb1('0x7'));var client=jayson[_0x7eb1('0x8')][_0x7eb1('0x9')]({'port':0x232a});config[_0x7eb1('0xa')]=_[_0x7eb1('0xb')](config['redis'],{'host':_0x7eb1('0xc'),'port':0x18eb});var socket=require(_0x7eb1('0xd'))(new Redis(config[_0x7eb1('0xa')]));require('./dashboard.socket')[_0x7eb1('0xe')](socket);function respondWithRpcPromise(_0x29cb17,_0x110b3c,_0x5597d1){return new BPromise(function(_0x148300,_0x499f43){return client[_0x7eb1('0xf')](_0x29cb17,_0x5597d1)[_0x7eb1('0x10')](function(_0x401b06){logger[_0x7eb1('0x11')](_0x7eb1('0x12'),_0x110b3c,_0x7eb1('0x13'));logger[_0x7eb1('0x14')](_0x7eb1('0x15'),_0x110b3c,'request\x20sent',JSON[_0x7eb1('0x16')](_0x401b06));if(_0x401b06[_0x7eb1('0x17')]){if(_0x401b06['error'][_0x7eb1('0x18')]===0x1f4){logger[_0x7eb1('0x17')](_0x7eb1('0x12'),_0x110b3c,_0x401b06[_0x7eb1('0x17')][_0x7eb1('0x19')]);return _0x499f43(_0x401b06[_0x7eb1('0x17')][_0x7eb1('0x19')]);}logger[_0x7eb1('0x17')](_0x7eb1('0x12'),_0x110b3c,_0x401b06['error'][_0x7eb1('0x19')]);return _0x148300(_0x401b06[_0x7eb1('0x17')][_0x7eb1('0x19')]);}else{logger['info'](_0x7eb1('0x12'),_0x110b3c,_0x7eb1('0x13'));_0x148300(_0x401b06[_0x7eb1('0x1a')][_0x7eb1('0x19')]);}})['catch'](function(_0x2d6d91){logger[_0x7eb1('0x17')](_0x7eb1('0x12'),_0x110b3c,_0x2d6d91);_0x499f43(_0x2d6d91);});});} \ No newline at end of file +var _0x9684=['request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s'];(function(_0x5d26a7,_0x3cdfe1){var _0x1d9b46=function(_0xdd9073){while(--_0xdd9073){_0x5d26a7['push'](_0x5d26a7['shift']());}};_0x1d9b46(++_0x3cdfe1);}(_0x9684,0xf0));var _0x4968=function(_0x209ba4,_0x5d44aa){_0x209ba4=_0x209ba4-0x0;var _0x53cc17=_0x9684[_0x209ba4];return _0x53cc17;};'use strict';var _=require('lodash');var util=require(_0x4968('0x0'));var moment=require(_0x4968('0x1'));var BPromise=require(_0x4968('0x2'));var rs=require(_0x4968('0x3'));var fs=require('fs');var Redis=require(_0x4968('0x4'));var db=require(_0x4968('0x5'))['db'];var utils=require(_0x4968('0x6'));var logger=require(_0x4968('0x7'))(_0x4968('0x8'));var config=require(_0x4968('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4968('0xa')]({'port':0x232a});config[_0x4968('0xb')]=_[_0x4968('0xc')](config[_0x4968('0xb')],{'host':_0x4968('0xd'),'port':0x18eb});var socket=require(_0x4968('0xe'))(new Redis(config['redis']));require(_0x4968('0xf'))[_0x4968('0x10')](socket);function respondWithRpcPromise(_0x5ab0c4,_0x5474e8,_0x1a9f3d){return new BPromise(function(_0x182bba,_0x3798f8){return client[_0x4968('0x11')](_0x5ab0c4,_0x1a9f3d)['then'](function(_0x1f102a){logger[_0x4968('0x12')](_0x4968('0x13'),_0x5474e8,_0x4968('0x14'));logger[_0x4968('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5474e8,'request\x20sent',JSON[_0x4968('0x16')](_0x1f102a));if(_0x1f102a[_0x4968('0x17')]){if(_0x1f102a['error'][_0x4968('0x18')]===0x1f4){logger[_0x4968('0x17')]('Dashboard,\x20%s,\x20%s',_0x5474e8,_0x1f102a[_0x4968('0x17')][_0x4968('0x19')]);return _0x3798f8(_0x1f102a[_0x4968('0x17')]['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x5474e8,_0x1f102a[_0x4968('0x17')][_0x4968('0x19')]);return _0x182bba(_0x1f102a[_0x4968('0x17')][_0x4968('0x19')]);}else{logger[_0x4968('0x12')](_0x4968('0x13'),_0x5474e8,'request\x20sent');_0x182bba(_0x1f102a['result'][_0x4968('0x19')]);}})['catch'](function(_0x8a12d5){logger[_0x4968('0x17')](_0x4968('0x13'),_0x5474e8,_0x8a12d5);_0x3798f8(_0x8a12d5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 29510ca..6d8b16c 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 _0x20ae=['remove','update','emit','removeListener','register','dashboard:'];(function(_0x5a3ba1,_0x3ddc79){var _0x21ac58=function(_0x59d09c){while(--_0x59d09c){_0x5a3ba1['push'](_0x5a3ba1['shift']());}};_0x21ac58(++_0x3ddc79);}(_0x20ae,0x6c));var _0xe20a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x20ae[_0x1d1779];return _0x2377e9;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xe20a('0x0'),_0xe20a('0x1')];function createListener(_0x34f211,_0x1766c5){return function(_0x1fc4fe){_0x1766c5[_0xe20a('0x2')](_0x34f211,_0x1fc4fe);};}function removeListener(_0x82904a,_0x3b86bf){return function(){DashboardEvents[_0xe20a('0x3')](_0x82904a,_0x3b86bf);};}exports[_0xe20a('0x4')]=function(_0x22ce3a){for(var _0x2ec28d=0x0,_0x51b562=events['length'];_0x2ec28d<_0x51b562;_0x2ec28d++){var _0x11306e=events[_0x2ec28d];var _0x485b29=createListener(_0xe20a('0x5')+_0x11306e,_0x22ce3a);DashboardEvents['on'](_0x11306e,_0x485b29);}}; \ No newline at end of file +var _0x069d=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove','update'];(function(_0x5058bd,_0x4cc586){var _0x11dc85=function(_0x3dfe2e){while(--_0x3dfe2e){_0x5058bd['push'](_0x5058bd['shift']());}};_0x11dc85(++_0x4cc586);}(_0x069d,0x9e));var _0xd069=function(_0x2138f5,_0x36f341){_0x2138f5=_0x2138f5-0x0;var _0x4fd574=_0x069d[_0x2138f5];return _0x4fd574;};'use strict';var DashboardEvents=require(_0xd069('0x0'));var events=[_0xd069('0x1'),_0xd069('0x2'),_0xd069('0x3')];function createListener(_0x29585e,_0x47b7b9){return function(_0x40d9ce){_0x47b7b9[_0xd069('0x4')](_0x29585e,_0x40d9ce);};}function removeListener(_0xba338a,_0x5df2b1){return function(){DashboardEvents[_0xd069('0x5')](_0xba338a,_0x5df2b1);};}exports[_0xd069('0x6')]=function(_0x395200){for(var _0x1cdf2d=0x0,_0x1d655e=events[_0xd069('0x7')];_0x1cdf2d<_0x1d655e;_0x1cdf2d++){var _0x35b92f=events[_0x1cdf2d];var _0x5f3dcc=createListener(_0xd069('0x8')+_0x35b92f,_0x395200);DashboardEvents['on'](_0x35b92f,_0x5f3dcc);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d8a4e90..4f443b5 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 _0x25e7=['./dashboard.controller','get','isAuthenticated','/:id','/:id/items','getItems','post','/:id/clone','clone','put','update','delete','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25e7,0x1bc));var _0x725e=function(_0x103762,_0x39d529){_0x103762=_0x103762-0x0;var _0x24844e=_0x25e7[_0x103762];return _0x24844e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x725e('0x0'));var timeout=require('connect-timeout');var express=require(_0x725e('0x1'));var router=express[_0x725e('0x2')]();var fs_extra=require(_0x725e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x725e('0x4'));var config=require(_0x725e('0x5'));var controller=require(_0x725e('0x6'));router[_0x725e('0x7')]('/',auth[_0x725e('0x8')](),controller['index']);router['get'](_0x725e('0x9'),auth[_0x725e('0x8')](),controller['show']);router[_0x725e('0x7')](_0x725e('0xa'),auth[_0x725e('0x8')](),controller[_0x725e('0xb')]);router[_0x725e('0xc')]('/',auth[_0x725e('0x8')](),controller['create']);router[_0x725e('0xc')](_0x725e('0xd'),auth[_0x725e('0x8')](),controller[_0x725e('0xe')]);router[_0x725e('0xc')](_0x725e('0xa'),auth[_0x725e('0x8')](),controller['addItem']);router[_0x725e('0xf')](_0x725e('0x9'),auth[_0x725e('0x8')](),controller[_0x725e('0x10')]);router[_0x725e('0x11')](_0x725e('0x9'),auth[_0x725e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xae02=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','show','/:id/items','getItems','create','post','/:id/clone','clone','put','update','/:id','multer','util','path'];(function(_0x23a6a5,_0x4fe357){var _0x51a54d=function(_0x546f9e){while(--_0x546f9e){_0x23a6a5['push'](_0x23a6a5['shift']());}};_0x51a54d(++_0x4fe357);}(_0xae02,0x184));var _0x2ae0=function(_0x152e09,_0x3b2289){_0x152e09=_0x152e09-0x0;var _0x3b552d=_0xae02[_0x152e09];return _0x3b552d;};'use strict';var multer=require(_0x2ae0('0x0'));var util=require(_0x2ae0('0x1'));var path=require(_0x2ae0('0x2'));var timeout=require(_0x2ae0('0x3'));var express=require(_0x2ae0('0x4'));var router=express['Router']();var fs_extra=require(_0x2ae0('0x5'));var auth=require(_0x2ae0('0x6'));var interaction=require(_0x2ae0('0x7'));var config=require(_0x2ae0('0x8'));var controller=require(_0x2ae0('0x9'));router['get']('/',auth[_0x2ae0('0xa')](),controller[_0x2ae0('0xb')]);router[_0x2ae0('0xc')]('/:id',auth[_0x2ae0('0xa')](),controller[_0x2ae0('0xd')]);router[_0x2ae0('0xc')](_0x2ae0('0xe'),auth[_0x2ae0('0xa')](),controller[_0x2ae0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2ae0('0x10')]);router[_0x2ae0('0x11')](_0x2ae0('0x12'),auth[_0x2ae0('0xa')](),controller[_0x2ae0('0x13')]);router[_0x2ae0('0x11')](_0x2ae0('0xe'),auth[_0x2ae0('0xa')](),controller['addItem']);router[_0x2ae0('0x14')]('/:id',auth[_0x2ae0('0xa')](),controller[_0x2ae0('0x15')]);router['delete'](_0x2ae0('0x16'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4af8226..ff2eff6 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 _0xf61e=['TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x873cde,_0xaa7694){var _0x1a6884=function(_0x7fe4db){while(--_0x7fe4db){_0x873cde['push'](_0x873cde['shift']());}};_0x1a6884(++_0xaa7694);}(_0xf61e,0x191));var _0xef61=function(_0x312f4e,_0x495be1){_0x312f4e=_0x312f4e-0x0;var _0x49d2df=_0xf61e[_0x312f4e];return _0x49d2df;};'use strict';var Sequelize=require(_0xef61('0x0'));var squel=require(_0xef61('0x1'));var _=require(_0xef61('0x2'));module[_0xef61('0x3')]={'title':{'type':Sequelize[_0xef61('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xef61('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xef61('0x5')](_0xef61('0x6')),'get':function(){try{return JSON[_0xef61('0x7')](this[_0xef61('0x8')](_0xef61('0x9')));}catch(_0x45a18d){return[];}},'set':function(_0x5b00b2){try{this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify'](_0x5b00b2));}catch(_0x2242a7){this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xef61('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xef61('0xb')]},'col':{'type':Sequelize[_0xef61('0xb')]},'background':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xef61('0x4')]},'titleFontSize':{'type':Sequelize[_0xef61('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x5be0d0,_0x4ea9e0){var _0x22066b=function(_0x1ed28a){while(--_0x1ed28a){_0x5be0d0['push'](_0x5be0d0['shift']());}};_0x22066b(++_0x4ea9e0);}(_0x5fab,0x177));var _0xb5fa=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x5fab[_0x352d28];return _0x387d7e;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'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 bd99eb0..f3ae87f 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 _0xcaaf=['attrSerie3','voice','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','end','stack','name','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','options','DashboardItem','find','catch','params','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0xcaaf,0x66));var _0xfcaa=function(_0x24dd52,_0x9a3eb9){_0x24dd52=_0x24dd52-0x0;var _0x26fc53=_0xcaaf[_0x24dd52];return _0x26fc53;};'use strict';var emlformat=require(_0xfcaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcaa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcaa('0x2'));var BPromise=require(_0xfcaa('0x3'));var Mustache=require('mustache');var util=require(_0xfcaa('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xfcaa('0x5'));var ejs=require(_0xfcaa('0x6'));var fs=require('fs');var fs_extra=require(_0xfcaa('0x7'));var _=require(_0xfcaa('0x8'));var squel=require(_0xfcaa('0x9'));var crypto=require(_0xfcaa('0xa'));var jsforce=require(_0xfcaa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfcaa('0x5'));var querystring=require('querystring');var Papa=require(_0xfcaa('0xc'));var Redis=require('ioredis');var authService=require(_0xfcaa('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcaa('0xe'));var logger=require('../../config/logger')(_0xfcaa('0xf'));var utils=require(_0xfcaa('0x10'));var config=require(_0xfcaa('0x11'));var licenseUtil=require(_0xfcaa('0x12'));var db=require(_0xfcaa('0x13'))['db'];config[_0xfcaa('0x14')]=_[_0xfcaa('0x15')](config[_0xfcaa('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcaa('0x16'))(new Redis(config[_0xfcaa('0x14')]));require(_0xfcaa('0x17'))[_0xfcaa('0x18')](socket);function respondWithStatusCode(_0x521fff,_0x2810d5){_0x2810d5=_0x2810d5||0xcc;return function(_0x26328d){if(_0x26328d){return _0x521fff[_0xfcaa('0x19')](_0x2810d5);}return _0x521fff[_0xfcaa('0x1a')](_0x2810d5)['end']();};}function respondWithResult(_0x10e7e7,_0x2dbc14){_0x2dbc14=_0x2dbc14||0xc8;return function(_0x218c64){if(_0x218c64){return _0x10e7e7['status'](_0x2dbc14)[_0xfcaa('0x1b')](_0x218c64);}};}function respondWithFilteredResult(_0x13517d,_0x5c0705){return function(_0x4202dc){if(_0x4202dc){var _0x5c0277=typeof _0x5c0705['offset']===_0xfcaa('0x1c')&&typeof _0x5c0705[_0xfcaa('0x1d')]===_0xfcaa('0x1c');var _0xa4df1=_0x4202dc[_0xfcaa('0x1e')];var _0x4566e1=_0x5c0277?0x0:_0x5c0705[_0xfcaa('0x1f')];var _0x1d5a9e=_0x5c0277?_0x4202dc[_0xfcaa('0x1e')]:_0x5c0705[_0xfcaa('0x1f')]+_0x5c0705['limit'];var _0x36791f;if(_0x1d5a9e>=_0xa4df1){_0x1d5a9e=_0xa4df1;_0x36791f=0xc8;}else{_0x36791f=0xce;}_0x13517d[_0xfcaa('0x1a')](_0x36791f);return _0x13517d[_0xfcaa('0x20')](_0xfcaa('0x21'),_0x4566e1+'-'+_0x1d5a9e+'/'+_0xa4df1)[_0xfcaa('0x1b')](_0x4202dc);}return null;};}function patchUpdates(_0x4416ed){return function(_0xf59b30){try{jsonpatch[_0xfcaa('0x22')](_0xf59b30,_0x4416ed,!![]);}catch(_0x653ca8){return BPromise['reject'](_0x653ca8);}return _0xf59b30[_0xfcaa('0x23')]();};}function saveUpdates(_0x1526d9,_0x43da7f){return function(_0x592858){if(_0x592858){return _0x592858[_0xfcaa('0x24')](_0x1526d9)['then'](function(_0x4642bb){return _0x4642bb;});}return null;};}function removeEntity(_0x2209d8,_0x3dc1d4){return function(_0x2c868a){if(_0x2c868a){return _0x2c868a[_0xfcaa('0x25')]()[_0xfcaa('0x26')](function(){_0x2209d8[_0xfcaa('0x1a')](0xcc)[_0xfcaa('0x27')]();});}};}function handleEntityNotFound(_0x3ba17e,_0x55e09a){return function(_0x55f9c9){if(!_0x55f9c9){_0x3ba17e['sendStatus'](0x194);}return _0x55f9c9;};}function handleError(_0x489390,_0x51171d){_0x51171d=_0x51171d||0x1f4;return function(_0x31bd3a){logger['error'](_0x31bd3a[_0xfcaa('0x28')]);if(_0x31bd3a[_0xfcaa('0x29')]){delete _0x31bd3a['name'];}_0x489390[_0xfcaa('0x1a')](_0x51171d)['send'](_0x31bd3a);};}exports['show']=function(_0x137877,_0x33a478){var _0x37bc0f={'raw':![],'where':{'id':_0x137877['params']['id']}},_0x1c538f={};_0x1c538f[_0xfcaa('0x2a')]=_[_0xfcaa('0x2b')](db['DashboardItem'][_0xfcaa('0x2c')]);_0x1c538f[_0xfcaa('0x2d')]=_[_0xfcaa('0x2b')](_0x137877[_0xfcaa('0x2d')]);_0x1c538f[_0xfcaa('0x2e')]=_[_0xfcaa('0x2f')](_0x1c538f['model'],_0x1c538f[_0xfcaa('0x2d')]);_0x37bc0f[_0xfcaa('0x30')]=_[_0xfcaa('0x2f')](_0x1c538f[_0xfcaa('0x2a')],qs['fields'](_0x137877[_0xfcaa('0x2d')]['fields']));_0x37bc0f[_0xfcaa('0x30')]=_0x37bc0f['attributes'][_0xfcaa('0x31')]?_0x37bc0f[_0xfcaa('0x30')]:_0x1c538f[_0xfcaa('0x2a')];if(_0x137877[_0xfcaa('0x2d')][_0xfcaa('0x32')]){_0x37bc0f[_0xfcaa('0x33')]=[{'all':!![]}];}_0x37bc0f=_['merge']({},_0x37bc0f,_0x137877[_0xfcaa('0x34')]);return db[_0xfcaa('0x35')][_0xfcaa('0x36')](_0x37bc0f)[_0xfcaa('0x26')](handleEntityNotFound(_0x33a478,null))[_0xfcaa('0x26')](respondWithResult(_0x33a478,null))[_0xfcaa('0x37')](handleError(_0x33a478,null));};exports[_0xfcaa('0x25')]=function(_0x1ff1f3,_0xa35d43){return db[_0xfcaa('0x35')][_0xfcaa('0x36')]({'where':{'id':_0x1ff1f3[_0xfcaa('0x38')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0xa35d43,null))[_0xfcaa('0x26')](removeEntity(_0xa35d43,null))['catch'](handleError(_0xa35d43,null));};function widgetAttributes(_0x515255){try{switch(_0x515255[_0xfcaa('0x39')]){case'iframe':return[{'name':_0xfcaa('0x3a'),'value':_0x515255['attrUrl']||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x0]?_0x515255[_0xfcaa('0x3b')][0x0][_0xfcaa('0x3c')]:undefined)||_0xfcaa('0x3d')}];case _0xfcaa('0x3e'):return[{'name':_0xfcaa('0x3f'),'value':_0x515255[_0xfcaa('0x3f')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x0]?_0x515255['attrs'][0x0][_0xfcaa('0x3c')]:undefined)||''}];case _0xfcaa('0x40'):return[{'name':_0xfcaa('0x41'),'value':_0x515255['attrHourFormat']||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x0]?_0x515255[_0xfcaa('0x3b')][0x0][_0xfcaa('0x3c')]:undefined)||_0xfcaa('0x42')},{'name':'attrTimezone','value':_0x515255[_0xfcaa('0x43')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x1]?_0x515255[_0xfcaa('0x3b')][0x1][_0xfcaa('0x3c')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x515255[_0xfcaa('0x44')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x2]?_0x515255[_0xfcaa('0x3b')][0x2][_0xfcaa('0x3c')]:undefined)||0xc}];case'counter':return[{'name':_0xfcaa('0x45'),'value':_0x515255[_0xfcaa('0x45')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x0]?_0x515255['attrs'][0x0][_0xfcaa('0x3c')]:undefined)||_0xfcaa('0x46')},{'name':'attrVoiceQueues','value':_0x515255[_0xfcaa('0x47')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x1]?_0x515255[_0xfcaa('0x3b')][0x1][_0xfcaa('0x3c')]:undefined)||[]},{'name':'attrFontSize','value':_0x515255[_0xfcaa('0x44')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x2]?_0x515255[_0xfcaa('0x3b')][0x2][_0xfcaa('0x3c')]:undefined)||0x14},{'name':_0xfcaa('0x48'),'value':_0x515255[_0xfcaa('0x48')]||(_0x515255['attrs']&&_0x515255[_0xfcaa('0x3b')][0x3]?_0x515255['attrs'][0x3][_0xfcaa('0x3c')]:undefined)||'voice'},{'name':_0xfcaa('0x49'),'value':_0x515255['attrEmailAccounts']||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x4]?_0x515255[_0xfcaa('0x3b')][0x4][_0xfcaa('0x3c')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x515255[_0xfcaa('0x4a')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x5]?_0x515255[_0xfcaa('0x3b')][0x5][_0xfcaa('0x3c')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x515255[_0xfcaa('0x4b')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x6]?_0x515255[_0xfcaa('0x3b')][0x6][_0xfcaa('0x3c')]:undefined)||''},{'name':_0xfcaa('0x4c'),'value':_0x515255[_0xfcaa('0x4c')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x7]?_0x515255['attrs'][0x7]['value']:undefined)||''},{'name':_0xfcaa('0x4d'),'value':_0x515255['attrWhatsappAccounts']||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x8]?_0x515255[_0xfcaa('0x3b')][0x8][_0xfcaa('0x3c')]:undefined)||''},{'name':_0xfcaa('0x4e'),'value':_0x515255[_0xfcaa('0x4e')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x9]?_0x515255['attrs'][0x9][_0xfcaa('0x3c')]:undefined)||''}];case'multibar-chart':case _0xfcaa('0x4f'):return[{'name':_0xfcaa('0x50'),'value':_0x515255[_0xfcaa('0x50')]||(_0x515255['attrs']&&_0x515255[_0xfcaa('0x3b')][0x0]?_0x515255[_0xfcaa('0x3b')][0x0][_0xfcaa('0x3c')]:undefined)||'total'},{'name':_0xfcaa('0x51'),'value':_0x515255['attrSerie2']||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x1]?_0x515255[_0xfcaa('0x3b')][0x1][_0xfcaa('0x3c')]:undefined)||null},{'name':_0xfcaa('0x52'),'value':_0x515255[_0xfcaa('0x52')]||(_0x515255['attrs']&&_0x515255[_0xfcaa('0x3b')][0x2]?_0x515255[_0xfcaa('0x3b')][0x2]['value']:undefined)||null},{'name':_0xfcaa('0x47'),'value':_0x515255[_0xfcaa('0x47')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x3]?_0x515255['attrs'][0x3][_0xfcaa('0x3c')]:undefined)||[]},{'name':_0xfcaa('0x48'),'value':_0x515255[_0xfcaa('0x48')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x4]?_0x515255[_0xfcaa('0x3b')][0x4]['value']:undefined)||_0xfcaa('0x53')},{'name':_0xfcaa('0x49'),'value':_0x515255['attrEmailAccounts']||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x5]?_0x515255['attrs'][0x5][_0xfcaa('0x3c')]:undefined)||''},{'name':_0xfcaa('0x4a'),'value':_0x515255[_0xfcaa('0x4a')]||(_0x515255['attrs']&&_0x515255['attrs'][0x6]?_0x515255[_0xfcaa('0x3b')][0x6][_0xfcaa('0x3c')]:undefined)||''},{'name':_0xfcaa('0x4b'),'value':_0x515255['attrSmsAccounts']||(_0x515255['attrs']&&_0x515255[_0xfcaa('0x3b')][0x7]?_0x515255[_0xfcaa('0x3b')][0x7][_0xfcaa('0x3c')]:undefined)||''},{'name':_0xfcaa('0x4c'),'value':_0x515255[_0xfcaa('0x4c')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255['attrs'][0x8]?_0x515255['attrs'][0x8][_0xfcaa('0x3c')]:undefined)||''},{'name':_0xfcaa('0x4d'),'value':_0x515255[_0xfcaa('0x4d')]||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0x9]?_0x515255[_0xfcaa('0x3b')][0x9][_0xfcaa('0x3c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x515255['attrChatWebsites']||(_0x515255[_0xfcaa('0x3b')]&&_0x515255[_0xfcaa('0x3b')][0xa]?_0x515255['attrs'][0xa][_0xfcaa('0x3c')]:undefined)||''}];case'web-report':return[{'name':_0xfcaa('0x54'),'type':_0x515255[_0xfcaa('0x55')]||(_0x515255['attrs']&&_0x515255[_0xfcaa('0x3b')][0x0]?_0x515255[_0xfcaa('0x3b')][0x0]['type']:undefined)||null,'value':_0x515255[_0xfcaa('0x54')]||(_0x515255['attrs']&&_0x515255[_0xfcaa('0x3b')][0x0]?_0x515255[_0xfcaa('0x3b')][0x0]['value']:undefined)||null},{'name':_0xfcaa('0x56'),'value':_0x515255[_0xfcaa('0x56')]||(_0x515255['attrs']&&_0x515255[_0xfcaa('0x3b')][0x1]?_0x515255[_0xfcaa('0x3b')][0x1][_0xfcaa('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x368557){logger[_0xfcaa('0x57')](_0xfcaa('0x58'),JSON[_0xfcaa('0x59')](_0x368557));return[];}}exports[_0xfcaa('0x5a')]=function(_0x66ee82,_0x3372e0){if(_0x66ee82['body']){_0x66ee82[_0xfcaa('0x5b')][_0xfcaa('0x3b')]=widgetAttributes(_0x66ee82[_0xfcaa('0x5b')]);}return db[_0xfcaa('0x35')][_0xfcaa('0x5a')](_0x66ee82[_0xfcaa('0x5b')],{})[_0xfcaa('0x26')](respondWithResult(_0x3372e0,0xc9))[_0xfcaa('0x37')](handleError(_0x3372e0,null));};exports[_0xfcaa('0x24')]=function(_0x29ce85,_0x4eb1b5){if(_0x29ce85[_0xfcaa('0x5b')]['id']){delete _0x29ce85[_0xfcaa('0x5b')]['id'];}_0x29ce85[_0xfcaa('0x5b')][_0xfcaa('0x3b')]=widgetAttributes(_0x29ce85[_0xfcaa('0x5b')]);return db[_0xfcaa('0x35')][_0xfcaa('0x36')]({'where':{'id':_0x29ce85[_0xfcaa('0x38')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x4eb1b5,null))[_0xfcaa('0x26')](saveUpdates(_0x29ce85[_0xfcaa('0x5b')],null))['then'](respondWithResult(_0x4eb1b5,null))['catch'](handleError(_0x4eb1b5,null));}; \ No newline at end of file +var _0x1c75=['attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','DashboardItem','find','catch','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x3979a8,_0x22f273){var _0x438159=function(_0x2cb0c3){while(--_0x2cb0c3){_0x3979a8['push'](_0x3979a8['shift']());}};_0x438159(++_0x22f273);}(_0x1c75,0xce));var _0x51c7=function(_0x508c0a,_0x1bcd5e){_0x508c0a=_0x508c0a-0x0;var _0x1c19b7=_0x1c75[_0x508c0a];return _0x1c19b7;};'use strict';var emlformat=require(_0x51c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51c7('0x1'));var moment=require(_0x51c7('0x2'));var BPromise=require(_0x51c7('0x3'));var Mustache=require(_0x51c7('0x4'));var util=require(_0x51c7('0x5'));var path=require(_0x51c7('0x6'));var sox=require(_0x51c7('0x7'));var csv=require(_0x51c7('0x8'));var ejs=require(_0x51c7('0x9'));var fs=require('fs');var fs_extra=require(_0x51c7('0xa'));var _=require(_0x51c7('0xb'));var squel=require('squel');var crypto=require(_0x51c7('0xc'));var jsforce=require(_0x51c7('0xd'));var deskjs=require(_0x51c7('0xe'));var toCsv=require(_0x51c7('0x8'));var querystring=require('querystring');var Papa=require(_0x51c7('0xf'));var Redis=require('ioredis');var authService=require(_0x51c7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51c7('0x11'));var hardwareService=require(_0x51c7('0x12'));var logger=require('../../config/logger')(_0x51c7('0x13'));var utils=require(_0x51c7('0x14'));var config=require(_0x51c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x51c7('0x16')](config[_0x51c7('0x17')],{'host':_0x51c7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51c7('0x17')]));require('./dashboardItem.socket')[_0x51c7('0x19')](socket);function respondWithStatusCode(_0x5a5ea9,_0x2e54af){_0x2e54af=_0x2e54af||0xcc;return function(_0x48f08a){if(_0x48f08a){return _0x5a5ea9[_0x51c7('0x1a')](_0x2e54af);}return _0x5a5ea9[_0x51c7('0x1b')](_0x2e54af)[_0x51c7('0x1c')]();};}function respondWithResult(_0x39da99,_0x521d8a){_0x521d8a=_0x521d8a||0xc8;return function(_0x177e14){if(_0x177e14){return _0x39da99[_0x51c7('0x1b')](_0x521d8a)[_0x51c7('0x1d')](_0x177e14);}};}function respondWithFilteredResult(_0x3079b7,_0x209ab3){return function(_0x36b29a){if(_0x36b29a){var _0x4a64e4=typeof _0x209ab3[_0x51c7('0x1e')]===_0x51c7('0x1f')&&typeof _0x209ab3[_0x51c7('0x20')]==='undefined';var _0x3c1f43=_0x36b29a[_0x51c7('0x21')];var _0x51f751=_0x4a64e4?0x0:_0x209ab3['offset'];var _0x1fa9d5=_0x4a64e4?_0x36b29a[_0x51c7('0x21')]:_0x209ab3[_0x51c7('0x1e')]+_0x209ab3[_0x51c7('0x20')];var _0x4072b9;if(_0x1fa9d5>=_0x3c1f43){_0x1fa9d5=_0x3c1f43;_0x4072b9=0xc8;}else{_0x4072b9=0xce;}_0x3079b7[_0x51c7('0x1b')](_0x4072b9);return _0x3079b7[_0x51c7('0x22')]('Content-Range',_0x51f751+'-'+_0x1fa9d5+'/'+_0x3c1f43)[_0x51c7('0x1d')](_0x36b29a);}return null;};}function patchUpdates(_0x11c83d){return function(_0x4e0108){try{jsonpatch[_0x51c7('0x23')](_0x4e0108,_0x11c83d,!![]);}catch(_0x48b259){return BPromise[_0x51c7('0x24')](_0x48b259);}return _0x4e0108[_0x51c7('0x25')]();};}function saveUpdates(_0x414de0,_0x48e6e6){return function(_0x11f01f){if(_0x11f01f){return _0x11f01f[_0x51c7('0x26')](_0x414de0)[_0x51c7('0x27')](function(_0x13a3ad){return _0x13a3ad;});}return null;};}function removeEntity(_0x44de99,_0x1c3935){return function(_0x57fe70){if(_0x57fe70){return _0x57fe70[_0x51c7('0x28')]()['then'](function(){_0x44de99[_0x51c7('0x1b')](0xcc)[_0x51c7('0x1c')]();});}};}function handleEntityNotFound(_0x331ad9,_0x1c29fb){return function(_0x375a70){if(!_0x375a70){_0x331ad9[_0x51c7('0x1a')](0x194);}return _0x375a70;};}function handleError(_0x32ac6e,_0x198465){_0x198465=_0x198465||0x1f4;return function(_0x42745b){logger[_0x51c7('0x29')](_0x42745b[_0x51c7('0x2a')]);if(_0x42745b[_0x51c7('0x2b')]){delete _0x42745b['name'];}_0x32ac6e[_0x51c7('0x1b')](_0x198465)[_0x51c7('0x2c')](_0x42745b);};}exports[_0x51c7('0x2d')]=function(_0x2eebb4,_0x588fbb){var _0x21ff27={'raw':![],'where':{'id':_0x2eebb4[_0x51c7('0x2e')]['id']}},_0x5e90bc={};_0x5e90bc[_0x51c7('0x2f')]=_[_0x51c7('0x30')](db['DashboardItem'][_0x51c7('0x31')]);_0x5e90bc['query']=_[_0x51c7('0x30')](_0x2eebb4[_0x51c7('0x32')]);_0x5e90bc[_0x51c7('0x33')]=_[_0x51c7('0x34')](_0x5e90bc[_0x51c7('0x2f')],_0x5e90bc[_0x51c7('0x32')]);_0x21ff27[_0x51c7('0x35')]=_[_0x51c7('0x34')](_0x5e90bc[_0x51c7('0x2f')],qs[_0x51c7('0x36')](_0x2eebb4['query'][_0x51c7('0x36')]));_0x21ff27['attributes']=_0x21ff27[_0x51c7('0x35')][_0x51c7('0x37')]?_0x21ff27['attributes']:_0x5e90bc[_0x51c7('0x2f')];if(_0x2eebb4[_0x51c7('0x32')][_0x51c7('0x38')]){_0x21ff27[_0x51c7('0x39')]=[{'all':!![]}];}_0x21ff27=_['merge']({},_0x21ff27,_0x2eebb4[_0x51c7('0x3a')]);return db[_0x51c7('0x3b')][_0x51c7('0x3c')](_0x21ff27)[_0x51c7('0x27')](handleEntityNotFound(_0x588fbb,null))['then'](respondWithResult(_0x588fbb,null))[_0x51c7('0x3d')](handleError(_0x588fbb,null));};exports[_0x51c7('0x28')]=function(_0x13fa10,_0x39ba1e){return db[_0x51c7('0x3b')]['find']({'where':{'id':_0x13fa10[_0x51c7('0x2e')]['id']}})['then'](handleEntityNotFound(_0x39ba1e,null))[_0x51c7('0x27')](removeEntity(_0x39ba1e,null))['catch'](handleError(_0x39ba1e,null));};function widgetAttributes(_0x12f54c){try{switch(_0x12f54c[_0x51c7('0x3e')]){case'iframe':return[{'name':_0x51c7('0x3f'),'value':_0x12f54c[_0x51c7('0x3f')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c['attrs'][0x0]['value']:undefined)||_0x51c7('0x41')}];case _0x51c7('0x42'):return[{'name':_0x51c7('0x43'),'value':_0x12f54c[_0x51c7('0x43')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c['attrs'][0x0][_0x51c7('0x44')]:undefined)||''}];case _0x51c7('0x45'):return[{'name':_0x51c7('0x46'),'value':_0x12f54c[_0x51c7('0x46')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x47')},{'name':_0x51c7('0x48'),'value':_0x12f54c[_0x51c7('0x48')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||'0.00'},{'name':_0x51c7('0x49'),'value':_0x12f54c[_0x51c7('0x49')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||0xc}];case _0x51c7('0x4a'):return[{'name':_0x51c7('0x4b'),'value':_0x12f54c[_0x51c7('0x4b')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x0]?_0x12f54c['attrs'][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x4c')},{'name':_0x51c7('0x4d'),'value':_0x12f54c[_0x51c7('0x4d')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||[]},{'name':_0x51c7('0x49'),'value':_0x12f54c['attrFontSize']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x12f54c[_0x51c7('0x4e')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x3]?_0x12f54c[_0x51c7('0x40')][0x3][_0x51c7('0x44')]:undefined)||_0x51c7('0x4f')},{'name':'attrEmailAccounts','value':_0x12f54c['attrEmailAccounts']||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x4]?_0x12f54c[_0x51c7('0x40')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x12f54c['attrFaxAccounts']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x5]?_0x12f54c[_0x51c7('0x40')][0x5][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x50'),'value':_0x12f54c[_0x51c7('0x50')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x6]?_0x12f54c[_0x51c7('0x40')][0x6][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x51'),'value':_0x12f54c[_0x51c7('0x51')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x7]?_0x12f54c[_0x51c7('0x40')][0x7]['value']:undefined)||''},{'name':_0x51c7('0x52'),'value':_0x12f54c[_0x51c7('0x52')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x8]?_0x12f54c[_0x51c7('0x40')][0x8]['value']:undefined)||''},{'name':_0x51c7('0x53'),'value':_0x12f54c[_0x51c7('0x53')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x9]?_0x12f54c[_0x51c7('0x40')][0x9][_0x51c7('0x44')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x51c7('0x54'),'value':_0x12f54c[_0x51c7('0x54')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x4c')},{'name':_0x51c7('0x55'),'value':_0x12f54c[_0x51c7('0x55')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||null},{'name':_0x51c7('0x56'),'value':_0x12f54c[_0x51c7('0x56')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x12f54c['attrVoiceQueues']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x3]?_0x12f54c[_0x51c7('0x40')][0x3][_0x51c7('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x12f54c[_0x51c7('0x4e')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x4]?_0x12f54c[_0x51c7('0x40')][0x4][_0x51c7('0x44')]:undefined)||'voice'},{'name':_0x51c7('0x57'),'value':_0x12f54c[_0x51c7('0x57')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x5]?_0x12f54c['attrs'][0x5]['value']:undefined)||''},{'name':_0x51c7('0x58'),'value':_0x12f54c[_0x51c7('0x58')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x6]?_0x12f54c[_0x51c7('0x40')][0x6][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x50'),'value':_0x12f54c[_0x51c7('0x50')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x7]?_0x12f54c['attrs'][0x7]['value']:undefined)||''},{'name':_0x51c7('0x51'),'value':_0x12f54c['attrOpenchannelAccounts']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x8]?_0x12f54c[_0x51c7('0x40')][0x8][_0x51c7('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x12f54c[_0x51c7('0x52')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x9]?_0x12f54c['attrs'][0x9][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x53'),'value':_0x12f54c['attrChatWebsites']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0xa]?_0x12f54c[_0x51c7('0x40')][0xa]['value']:undefined)||''}];case _0x51c7('0x59'):return[{'name':_0x51c7('0x5a'),'type':_0x12f54c[_0x51c7('0x5b')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x3e')]:undefined)||null,'value':_0x12f54c[_0x51c7('0x5a')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||null},{'name':_0x51c7('0x5c'),'value':_0x12f54c[_0x51c7('0x5c')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x1]?_0x12f54c['attrs'][0x1][_0x51c7('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3dabf1){logger[_0x51c7('0x29')]('widgetAttributes:\x20%s',JSON[_0x51c7('0x5d')](_0x3dabf1));return[];}}exports[_0x51c7('0x5e')]=function(_0x354a96,_0x5470b7){if(_0x354a96[_0x51c7('0x5f')]){_0x354a96['body'][_0x51c7('0x40')]=widgetAttributes(_0x354a96[_0x51c7('0x5f')]);}return db['DashboardItem']['create'](_0x354a96['body'],{})[_0x51c7('0x27')](respondWithResult(_0x5470b7,0xc9))[_0x51c7('0x3d')](handleError(_0x5470b7,null));};exports[_0x51c7('0x26')]=function(_0x175bd1,_0x438e7f){if(_0x175bd1[_0x51c7('0x5f')]['id']){delete _0x175bd1[_0x51c7('0x5f')]['id'];}_0x175bd1[_0x51c7('0x5f')][_0x51c7('0x40')]=widgetAttributes(_0x175bd1['body']);return db[_0x51c7('0x3b')][_0x51c7('0x3c')]({'where':{'id':_0x175bd1['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x438e7f,null))[_0x51c7('0x27')](saveUpdates(_0x175bd1[_0x51c7('0x5f')],null))['then'](respondWithResult(_0x438e7f,null))[_0x51c7('0x3d')](handleError(_0x438e7f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d2497b1..533dceb 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 _0xeb36=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x1121c6,_0x4b400d){var _0x207280=function(_0x8347ba){while(--_0x8347ba){_0x1121c6['push'](_0x1121c6['shift']());}};_0x207280(++_0x4b400d);}(_0xeb36,0x119));var _0x6eb3=function(_0x5e2c13,_0x31e077){_0x5e2c13=_0x5e2c13-0x0;var _0x3ab81d=_0xeb36[_0x5e2c13];return _0x3ab81d;};'use strict';var EventEmitter=require(_0x6eb3('0x0'));var DashboardItem=require(_0x6eb3('0x1'))['db'][_0x6eb3('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6eb3('0x3')](0x0);var events={'afterCreate':_0x6eb3('0x4'),'afterUpdate':_0x6eb3('0x5'),'afterDestroy':_0x6eb3('0x6')};function emitEvent(_0x4bc5b1){return function(_0x5dc2e4,_0x4dc0be,_0x5a42f4){DashboardItemEvents[_0x6eb3('0x7')](_0x4bc5b1+':'+_0x5dc2e4['id'],_0x5dc2e4);DashboardItemEvents[_0x6eb3('0x7')](_0x4bc5b1,_0x5dc2e4);_0x5a42f4(null);};}for(var e in events){if(events[_0x6eb3('0x8')](e)){var event=events[e];DashboardItem[_0x6eb3('0x9')](e,emitEvent(event));}}module[_0x6eb3('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x9693=['DashboardItem','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x1328b7,_0x4b3909){var _0x16d6d1=function(_0x1acebf){while(--_0x1acebf){_0x1328b7['push'](_0x1328b7['shift']());}};_0x16d6d1(++_0x4b3909);}(_0x9693,0xe8));var _0x3969=function(_0xdb9f53,_0x432fb4){_0xdb9f53=_0xdb9f53-0x0;var _0x2e9213=_0x9693[_0xdb9f53];return _0x2e9213;};'use strict';var EventEmitter=require(_0x3969('0x0'));var DashboardItem=require(_0x3969('0x1'))['db'][_0x3969('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x3969('0x3')](0x0);var events={'afterCreate':_0x3969('0x4'),'afterUpdate':'update','afterDestroy':_0x3969('0x5')};function emitEvent(_0x15b2cc){return function(_0x41e336,_0x1a9bfd,_0x24c055){DashboardItemEvents[_0x3969('0x6')](_0x15b2cc+':'+_0x41e336['id'],_0x41e336);DashboardItemEvents['emit'](_0x15b2cc,_0x41e336);_0x24c055(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x3969('0x7')](e,emitEvent(event));}}module[_0x3969('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6f77334..22cce62 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 _0x5ccf=['define','DashboardItem','dashboard_items','util','api','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes'];(function(_0x3a14be,_0x44e5c2){var _0x307481=function(_0x561718){while(--_0x561718){_0x3a14be['push'](_0x3a14be['shift']());}};_0x307481(++_0x44e5c2);}(_0x5ccf,0xe9));var _0xf5cc=function(_0x265972,_0x1de3be){_0x265972=_0x265972-0x0;var _0x59cb78=_0x5ccf[_0x265972];return _0x59cb78;};'use strict';var _=require('lodash');var util=require(_0xf5cc('0x0'));var logger=require('../../config/logger')(_0xf5cc('0x1'));var moment=require('moment');var BPromise=require(_0xf5cc('0x2'));var rp=require(_0xf5cc('0x3'));var fs=require('fs');var path=require(_0xf5cc('0x4'));var rimraf=require('rimraf');var config=require(_0xf5cc('0x5'));var attributes=require(_0xf5cc('0x6'));module['exports']=function(_0x3fdd28,_0xec43ea){return _0x3fdd28[_0xf5cc('0x7')](_0xf5cc('0x8'),attributes,{'tableName':_0xf5cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0d3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','../../config/logger'];(function(_0x5307f1,_0x66442d){var _0x212ae1=function(_0x471731){while(--_0x471731){_0x5307f1['push'](_0x5307f1['shift']());}};_0x212ae1(++_0x66442d);}(_0xc0d3,0x107));var _0x3c0d=function(_0x33267c,_0x181af9){_0x33267c=_0x33267c-0x0;var _0x3f9258=_0xc0d3[_0x33267c];return _0x3f9258;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c0d('0x0'))(_0x3c0d('0x1'));var moment=require(_0x3c0d('0x2'));var BPromise=require(_0x3c0d('0x3'));var rp=require(_0x3c0d('0x4'));var fs=require('fs');var path=require(_0x3c0d('0x5'));var rimraf=require(_0x3c0d('0x6'));var config=require(_0x3c0d('0x7'));var attributes=require(_0x3c0d('0x8'));module[_0x3c0d('0x9')]=function(_0x3ec1b6,_0x179784){return _0x3ec1b6[_0x3c0d('0xa')]('DashboardItem',attributes,{'tableName':_0x3c0d('0xb'),'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 6242180..2f240b1 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 _0xef08=['DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','info'];(function(_0xa20d3d,_0x26685c){var _0x292aed=function(_0x36ce14){while(--_0x36ce14){_0xa20d3d['push'](_0xa20d3d['shift']());}};_0x292aed(++_0x26685c);}(_0xef08,0xe1));var _0x8ef0=function(_0x247211,_0x21b33d){_0x247211=_0x247211-0x0;var _0x1d2ec3=_0xef08[_0x247211];return _0x1d2ec3;};'use strict';var _=require('lodash');var util=require(_0x8ef0('0x0'));var moment=require(_0x8ef0('0x1'));var BPromise=require(_0x8ef0('0x2'));var rs=require(_0x8ef0('0x3'));var fs=require('fs');var Redis=require(_0x8ef0('0x4'));var db=require(_0x8ef0('0x5'))['db'];var utils=require(_0x8ef0('0x6'));var logger=require(_0x8ef0('0x7'))(_0x8ef0('0x8'));var config=require(_0x8ef0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8ef0('0xa')][_0x8ef0('0xb')]({'port':0x232a});config[_0x8ef0('0xc')]=_['defaults'](config['redis'],{'host':_0x8ef0('0xd'),'port':0x18eb});var socket=require(_0x8ef0('0xe'))(new Redis(config[_0x8ef0('0xc')]));require(_0x8ef0('0xf'))['register'](socket);function respondWithRpcPromise(_0x13f228,_0x48379c,_0x4414b9){return new BPromise(function(_0x1c6bac,_0x50ae31){return client[_0x8ef0('0x10')](_0x13f228,_0x4414b9)['then'](function(_0x50b840){logger[_0x8ef0('0x11')](_0x8ef0('0x12'),_0x48379c,_0x8ef0('0x13'));logger['debug'](_0x8ef0('0x14'),_0x48379c,'request\x20sent',JSON[_0x8ef0('0x15')](_0x50b840));if(_0x50b840[_0x8ef0('0x16')]){if(_0x50b840[_0x8ef0('0x16')][_0x8ef0('0x17')]===0x1f4){logger[_0x8ef0('0x16')]('DashboardItem,\x20%s,\x20%s',_0x48379c,_0x50b840[_0x8ef0('0x16')][_0x8ef0('0x18')]);return _0x50ae31(_0x50b840[_0x8ef0('0x16')]['message']);}logger[_0x8ef0('0x16')](_0x8ef0('0x12'),_0x48379c,_0x50b840[_0x8ef0('0x16')][_0x8ef0('0x18')]);return _0x1c6bac(_0x50b840[_0x8ef0('0x16')][_0x8ef0('0x18')]);}else{logger[_0x8ef0('0x11')](_0x8ef0('0x12'),_0x48379c,_0x8ef0('0x13'));_0x1c6bac(_0x50b840[_0x8ef0('0x19')][_0x8ef0('0x18')]);}})[_0x8ef0('0x1a')](function(_0x39dfa5){logger[_0x8ef0('0x16')]('DashboardItem,\x20%s,\x20%s',_0x48379c,_0x39dfa5);_0x50ae31(_0x39dfa5);});});} \ No newline at end of file +var _0x23fb=['request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./dashboardItem.socket'];(function(_0x24b5d8,_0x203128){var _0x54908d=function(_0x3b0db0){while(--_0x3b0db0){_0x24b5d8['push'](_0x24b5d8['shift']());}};_0x54908d(++_0x203128);}(_0x23fb,0x151));var _0xb23f=function(_0x3e8426,_0x49a842){_0x3e8426=_0x3e8426-0x0;var _0x874e2e=_0x23fb[_0x3e8426];return _0x874e2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb23f('0x0'));var BPromise=require(_0xb23f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb23f('0x2'));var db=require(_0xb23f('0x3'))['db'];var utils=require(_0xb23f('0x4'));var logger=require(_0xb23f('0x5'))(_0xb23f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb23f('0x7')][_0xb23f('0x8')]({'port':0x232a});config[_0xb23f('0x9')]=_[_0xb23f('0xa')](config['redis'],{'host':_0xb23f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb23f('0x9')]));require(_0xb23f('0xc'))['register'](socket);function respondWithRpcPromise(_0x13c56d,_0x1c3633,_0x4979b0){return new BPromise(function(_0x3339e,_0x5572b4){return client[_0xb23f('0xd')](_0x13c56d,_0x4979b0)['then'](function(_0x26d6e2){logger[_0xb23f('0xe')](_0xb23f('0xf'),_0x1c3633,_0xb23f('0x10'));logger[_0xb23f('0x11')](_0xb23f('0x12'),_0x1c3633,_0xb23f('0x10'),JSON[_0xb23f('0x13')](_0x26d6e2));if(_0x26d6e2[_0xb23f('0x14')]){if(_0x26d6e2[_0xb23f('0x14')][_0xb23f('0x15')]===0x1f4){logger[_0xb23f('0x14')](_0xb23f('0xf'),_0x1c3633,_0x26d6e2['error'][_0xb23f('0x16')]);return _0x5572b4(_0x26d6e2['error']['message']);}logger[_0xb23f('0x14')](_0xb23f('0xf'),_0x1c3633,_0x26d6e2['error'][_0xb23f('0x16')]);return _0x3339e(_0x26d6e2[_0xb23f('0x14')][_0xb23f('0x16')]);}else{logger['info'](_0xb23f('0xf'),_0x1c3633,_0xb23f('0x10'));_0x3339e(_0x26d6e2[_0xb23f('0x17')][_0xb23f('0x16')]);}})[_0xb23f('0x18')](function(_0xc055){logger[_0xb23f('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1c3633,_0xc055);_0x5572b4(_0xc055);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 93f5fde..3ff94c5 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 _0xcaa0=['dashboardItem:','./dashboardItem.events','remove','emit','register','length'];(function(_0x1caf6b,_0xabab6c){var _0x59b103=function(_0x417a0c){while(--_0x417a0c){_0x1caf6b['push'](_0x1caf6b['shift']());}};_0x59b103(++_0xabab6c);}(_0xcaa0,0x199));var _0x0caa=function(_0x5690a4,_0x572d64){_0x5690a4=_0x5690a4-0x0;var _0x170f91=_0xcaa0[_0x5690a4];return _0x170f91;};'use strict';var DashboardItemEvents=require(_0x0caa('0x0'));var events=['save',_0x0caa('0x1'),'update'];function createListener(_0x55efc1,_0x53e531){return function(_0x96f301){_0x53e531[_0x0caa('0x2')](_0x55efc1,_0x96f301);};}function removeListener(_0x1b4379,_0x296ca8){return function(){DashboardItemEvents['removeListener'](_0x1b4379,_0x296ca8);};}exports[_0x0caa('0x3')]=function(_0x28b4cc){for(var _0x31b7e5=0x0,_0x36cf78=events[_0x0caa('0x4')];_0x31b7e5<_0x36cf78;_0x31b7e5++){var _0x230e78=events[_0x31b7e5];var _0x30b926=createListener(_0x0caa('0x5')+_0x230e78,_0x28b4cc);DashboardItemEvents['on'](_0x230e78,_0x30b926);}}; \ No newline at end of file +var _0x272a=['update','emit','removeListener','register','length','./dashboardItem.events','save','remove'];(function(_0x56007e,_0x14b813){var _0x192962=function(_0x4949d1){while(--_0x4949d1){_0x56007e['push'](_0x56007e['shift']());}};_0x192962(++_0x14b813);}(_0x272a,0x1d5));var _0xa272=function(_0x229a1e,_0x37eb46){_0x229a1e=_0x229a1e-0x0;var _0x2eaca0=_0x272a[_0x229a1e];return _0x2eaca0;};'use strict';var DashboardItemEvents=require(_0xa272('0x0'));var events=[_0xa272('0x1'),_0xa272('0x2'),_0xa272('0x3')];function createListener(_0x4a77e8,_0x4af217){return function(_0x236a74){_0x4af217[_0xa272('0x4')](_0x4a77e8,_0x236a74);};}function removeListener(_0x449149,_0x24f331){return function(){DashboardItemEvents[_0xa272('0x5')](_0x449149,_0x24f331);};}exports[_0xa272('0x6')]=function(_0x1091f0){for(var _0x4144b7=0x0,_0x59f808=events[_0xa272('0x7')];_0x4144b7<_0x59f808;_0x4144b7++){var _0x4a25d3=events[_0x4144b7];var _0x1c2b92=createListener('dashboardItem:'+_0x4a25d3,_0x1091f0);DashboardItemEvents['on'](_0x4a25d3,_0x1c2b92);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 6fc3bea..35eee7d 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 _0x7b67=['create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0x4660b9,_0x172664){var _0x3d0b6b=function(_0x3632e1){while(--_0x3632e1){_0x4660b9['push'](_0x4660b9['shift']());}};_0x3d0b6b(++_0x172664);}(_0x7b67,0x1d1));var _0x77b6=function(_0x58e86f,_0x5ec7d7){_0x58e86f=_0x58e86f-0x0;var _0x207c08=_0x7b67[_0x58e86f];return _0x207c08;};'use strict';var multer=require('multer');var util=require(_0x77b6('0x0'));var path=require('path');var timeout=require(_0x77b6('0x1'));var express=require(_0x77b6('0x2'));var router=express[_0x77b6('0x3')]();var fs_extra=require(_0x77b6('0x4'));var auth=require(_0x77b6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x77b6('0x6'));router[_0x77b6('0x7')](_0x77b6('0x8'),auth[_0x77b6('0x9')](),controller[_0x77b6('0xa')]);router['post']('/',auth[_0x77b6('0x9')](),controller[_0x77b6('0xb')]);router[_0x77b6('0xc')](_0x77b6('0x8'),auth[_0x77b6('0x9')](),controller[_0x77b6('0xd')]);router[_0x77b6('0xe')](_0x77b6('0x8'),auth[_0x77b6('0x9')](),controller[_0x77b6('0xf')]);module[_0x77b6('0x10')]=router; \ No newline at end of file +var _0x4b79=['update','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','./dashboardItem.controller','get','isAuthenticated','post','put','/:id'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4b79,0xb7));var _0x94b7=function(_0x2fc868,_0x420c59){_0x2fc868=_0x2fc868-0x0;var _0x2f0f85=_0x4b79[_0x2fc868];return _0x2f0f85;};'use strict';var multer=require(_0x94b7('0x0'));var util=require(_0x94b7('0x1'));var path=require(_0x94b7('0x2'));var timeout=require('connect-timeout');var express=require(_0x94b7('0x3'));var router=express['Router']();var fs_extra=require(_0x94b7('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x94b7('0x5'));var controller=require(_0x94b7('0x6'));router[_0x94b7('0x7')]('/:id',auth[_0x94b7('0x8')](),controller['show']);router[_0x94b7('0x9')]('/',auth[_0x94b7('0x8')](),controller['create']);router[_0x94b7('0xa')](_0x94b7('0xb'),auth[_0x94b7('0x8')](),controller[_0x94b7('0xc')]);router['delete'](_0x94b7('0xb'),auth[_0x94b7('0x8')](),controller[_0x94b7('0xd')]);module[_0x94b7('0xe')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 9cb7de9..004e4f4 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 _0xe0be=['third','STRING','sequelize','exports','ENUM','first'];(function(_0x35448e,_0x4fbd81){var _0x496b9e=function(_0x4623e7){while(--_0x4623e7){_0x35448e['push'](_0x35448e['shift']());}};_0x496b9e(++_0x4fbd81);}(_0xe0be,0x194));var _0xee0b=function(_0x568668,_0x41a809){_0x568668=_0x568668-0x0;var _0x3c98e0=_0xe0be[_0x568668];return _0x3c98e0;};'use strict';var Sequelize=require(_0xee0b('0x0'));module[_0xee0b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xee0b('0x2')](_0xee0b('0x3'),'second',_0xee0b('0x4')),'allowNull':![],'defaultValue':_0xee0b('0x3')},'description':{'type':Sequelize[_0xee0b('0x5')]}}; \ No newline at end of file +var _0x3702=['first','second','third','sequelize','STRING'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x3702,0xd0));var _0x2370=function(_0x80ff6,_0x29cb6d){_0x80ff6=_0x80ff6-0x0;var _0x1084a8=_0x3702[_0x80ff6];return _0x1084a8;};'use strict';var Sequelize=require(_0x2370('0x0'));module['exports']={'name':{'type':Sequelize[_0x2370('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x2370('0x2'),_0x2370('0x3'),_0x2370('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x2370('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ed101b9..d9ae99f 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 _0x3dd2=['squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x5b830e,_0x4c6030){var _0x273171=function(_0x217cb4){while(--_0x217cb4){_0x5b830e['push'](_0x5b830e['shift']());}};_0x273171(++_0x4c6030);}(_0x3dd2,0x93));var _0x23dd=function(_0x309a18,_0x383a89){_0x309a18=_0x309a18-0x0;var _0x4733ba=_0x3dd2[_0x309a18];return _0x4733ba;};'use strict';var emlformat=require(_0x23dd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x23dd('0x1'));var rp=require(_0x23dd('0x2'));var moment=require(_0x23dd('0x3'));var BPromise=require(_0x23dd('0x4'));var Mustache=require(_0x23dd('0x5'));var util=require('util');var path=require(_0x23dd('0x6'));var sox=require(_0x23dd('0x7'));var csv=require(_0x23dd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x23dd('0x9'));var crypto=require(_0x23dd('0xa'));var jsforce=require(_0x23dd('0xb'));var deskjs=require(_0x23dd('0xc'));var toCsv=require(_0x23dd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x23dd('0xd'));var qs=require(_0x23dd('0xe'));var as=require(_0x23dd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23dd('0x10'))(_0x23dd('0x11'));var utils=require(_0x23dd('0x12'));var config=require(_0x23dd('0x13'));var licenseUtil=require(_0x23dd('0x14'));var db=require(_0x23dd('0x15'))['db'];function respondWithStatusCode(_0x16e0c4,_0xd6cb6e){_0xd6cb6e=_0xd6cb6e||0xcc;return function(_0x22cad3){if(_0x22cad3){return _0x16e0c4[_0x23dd('0x16')](_0xd6cb6e);}return _0x16e0c4[_0x23dd('0x17')](_0xd6cb6e)[_0x23dd('0x18')]();};}function respondWithResult(_0xf5fe51,_0x39999d){_0x39999d=_0x39999d||0xc8;return function(_0x15c154){if(_0x15c154){return _0xf5fe51[_0x23dd('0x17')](_0x39999d)['json'](_0x15c154);}};}function respondWithFilteredResult(_0x214c3b,_0x3d14bc){return function(_0x29a8ef){if(_0x29a8ef){var _0x30f544=typeof _0x3d14bc[_0x23dd('0x19')]==='undefined'&&typeof _0x3d14bc[_0x23dd('0x1a')]==='undefined';var _0x4381c6=_0x29a8ef[_0x23dd('0x1b')];var _0x3bc925=_0x30f544?0x0:_0x3d14bc[_0x23dd('0x19')];var _0x9c2bbf=_0x30f544?_0x29a8ef[_0x23dd('0x1b')]:_0x3d14bc[_0x23dd('0x19')]+_0x3d14bc['limit'];var _0xb0336e;if(_0x9c2bbf>=_0x4381c6){_0x9c2bbf=_0x4381c6;_0xb0336e=0xc8;}else{_0xb0336e=0xce;}_0x214c3b[_0x23dd('0x17')](_0xb0336e);return _0x214c3b[_0x23dd('0x1c')]('Content-Range',_0x3bc925+'-'+_0x9c2bbf+'/'+_0x4381c6)['json'](_0x29a8ef);}return null;};}function patchUpdates(_0x358825){return function(_0x5ed012){try{jsonpatch[_0x23dd('0x1d')](_0x5ed012,_0x358825,!![]);}catch(_0x5ef89f){return BPromise[_0x23dd('0x1e')](_0x5ef89f);}return _0x5ed012[_0x23dd('0x1f')]();};}function saveUpdates(_0xc4557d,_0x12a37a){return function(_0x3131b9){if(_0x3131b9){return _0x3131b9[_0x23dd('0x20')](_0xc4557d)[_0x23dd('0x21')](function(_0x128965){return _0x128965;});}return null;};}function removeEntity(_0x20c911,_0x2178b2){return function(_0x3f557e){if(_0x3f557e){return _0x3f557e[_0x23dd('0x22')]()[_0x23dd('0x21')](function(){var _0x40f681=_0x3f557e[_0x23dd('0x23')]({'plain':!![]});var _0x4a8475=_0x23dd('0x24');return db[_0x23dd('0x25')]['destroy']({'where':{'type':_0x4a8475,'resourceId':_0x40f681['id']}})['then'](function(){return _0x3f557e;});})[_0x23dd('0x21')](function(){_0x20c911[_0x23dd('0x17')](0xcc)[_0x23dd('0x18')]();});}};}function handleEntityNotFound(_0x3cf79c,_0x4aa6eb){return function(_0x3cf514){if(!_0x3cf514){_0x3cf79c[_0x23dd('0x16')](0x194);}return _0x3cf514;};}function handleError(_0x512bd2,_0x375638){_0x375638=_0x375638||0x1f4;return function(_0x29622b){logger[_0x23dd('0x26')](_0x29622b[_0x23dd('0x27')]);if(_0x29622b[_0x23dd('0x28')]){delete _0x29622b[_0x23dd('0x28')];}_0x512bd2[_0x23dd('0x17')](_0x375638)[_0x23dd('0x29')](_0x29622b);};}exports[_0x23dd('0x2a')]=function(_0x1a396f,_0x50bfe2){var _0x75606f={},_0xe61167={},_0xa22097={'count':0x0,'rows':[]};var _0x595b70=_[_0x23dd('0x2b')](db[_0x23dd('0x2c')][_0x23dd('0x2d')],function(_0x379af2){return{'name':_0x379af2[_0x23dd('0x2e')],'type':_0x379af2[_0x23dd('0x2f')]['key']};});_0xe61167['model']=_[_0x23dd('0x2b')](_0x595b70,_0x23dd('0x28'));_0xe61167[_0x23dd('0x30')]=_[_0x23dd('0x31')](_0x1a396f[_0x23dd('0x30')]);_0xe61167[_0x23dd('0x32')]=_[_0x23dd('0x33')](_0xe61167[_0x23dd('0x34')],_0xe61167['query']);_0x75606f[_0x23dd('0x35')]=_['intersection'](_0xe61167[_0x23dd('0x34')],qs[_0x23dd('0x36')](_0x1a396f[_0x23dd('0x30')][_0x23dd('0x36')]));_0x75606f[_0x23dd('0x35')]=_0x75606f[_0x23dd('0x35')][_0x23dd('0x37')]?_0x75606f[_0x23dd('0x35')]:_0xe61167[_0x23dd('0x34')];if(!_0x1a396f[_0x23dd('0x30')][_0x23dd('0x38')](_0x23dd('0x39'))){_0x75606f[_0x23dd('0x1a')]=qs[_0x23dd('0x1a')](_0x1a396f['query'][_0x23dd('0x1a')]);_0x75606f[_0x23dd('0x19')]=qs['offset'](_0x1a396f['query'][_0x23dd('0x19')]);}_0x75606f['order']=qs['sort'](_0x1a396f['query']['sort']);_0x75606f[_0x23dd('0x3a')]=qs[_0x23dd('0x32')](_[_0x23dd('0x3b')](_0x1a396f[_0x23dd('0x30')],_0xe61167[_0x23dd('0x32')]),_0x595b70);if(_0x1a396f[_0x23dd('0x30')][_0x23dd('0x3c')]){_0x75606f['where']=_[_0x23dd('0x3d')](_0x75606f[_0x23dd('0x3a')],{'$or':_[_0x23dd('0x2b')](_0x595b70,function(_0x4e22c1){if(_0x4e22c1[_0x23dd('0x2f')]!==_0x23dd('0x3e')){var _0x5b8a9f={};_0x5b8a9f[_0x4e22c1['name']]={'$like':'%'+_0x1a396f[_0x23dd('0x30')][_0x23dd('0x3c')]+'%'};return _0x5b8a9f;}})});}_0x75606f=_[_0x23dd('0x3d')]({},_0x75606f,_0x1a396f[_0x23dd('0x3f')]);var _0x58bde3={'where':_0x75606f['where']};return db[_0x23dd('0x2c')][_0x23dd('0x1b')](_0x58bde3)[_0x23dd('0x21')](function(_0x8ebcf2){_0xa22097[_0x23dd('0x1b')]=_0x8ebcf2;if(_0x1a396f[_0x23dd('0x30')][_0x23dd('0x40')]){_0x75606f[_0x23dd('0x41')]=[{'all':!![]}];}return db[_0x23dd('0x2c')][_0x23dd('0x42')](_0x75606f);})[_0x23dd('0x21')](function(_0x36c912){_0xa22097[_0x23dd('0x43')]=_0x36c912;return _0xa22097;})['then'](respondWithFilteredResult(_0x50bfe2,_0x75606f))[_0x23dd('0x44')](handleError(_0x50bfe2,null));};exports[_0x23dd('0x45')]=function(_0x19b7ac,_0xe84b29){var _0x42eae4={'raw':!![],'where':{'id':_0x19b7ac[_0x23dd('0x46')]['id']}},_0x584ec0={};_0x584ec0['model']=_[_0x23dd('0x31')](db[_0x23dd('0x2c')][_0x23dd('0x2d')]);_0x584ec0[_0x23dd('0x30')]=_[_0x23dd('0x31')](_0x19b7ac[_0x23dd('0x30')]);_0x584ec0[_0x23dd('0x32')]=_[_0x23dd('0x33')](_0x584ec0['model'],_0x584ec0[_0x23dd('0x30')]);_0x42eae4[_0x23dd('0x35')]=_['intersection'](_0x584ec0[_0x23dd('0x34')],qs[_0x23dd('0x36')](_0x19b7ac[_0x23dd('0x30')][_0x23dd('0x36')]));_0x42eae4[_0x23dd('0x35')]=_0x42eae4[_0x23dd('0x35')][_0x23dd('0x37')]?_0x42eae4[_0x23dd('0x35')]:_0x584ec0[_0x23dd('0x34')];if(_0x19b7ac[_0x23dd('0x30')][_0x23dd('0x40')]){_0x42eae4[_0x23dd('0x41')]=[{'all':!![]}];}_0x42eae4=_['merge']({},_0x42eae4,_0x19b7ac[_0x23dd('0x3f')]);return db[_0x23dd('0x2c')][_0x23dd('0x47')](_0x42eae4)[_0x23dd('0x21')](handleEntityNotFound(_0xe84b29,null))[_0x23dd('0x21')](respondWithResult(_0xe84b29,null))['catch'](handleError(_0xe84b29,null));};exports['create']=function(_0x29b310,_0x2b5ae1){return db['Disposition'][_0x23dd('0x48')](_0x29b310['body'],{})[_0x23dd('0x21')](function(_0x1c2fc2){var _0x3062c6=_0x29b310[_0x23dd('0x49')][_0x23dd('0x23')]({'plain':!![]});if(!_0x3062c6)throw new Error(_0x23dd('0x4a'));if(_0x3062c6['role']===_0x23dd('0x49')){var _0x48f982=_0x1c2fc2['get']({'plain':!![]});var _0x458e44='Dispositions';return db['UserProfileSection'][_0x23dd('0x47')]({'where':{'name':_0x458e44,'userProfileId':_0x3062c6['userProfileId']},'raw':!![]})[_0x23dd('0x21')](function(_0x1aa2c7){if(_0x1aa2c7&&_0x1aa2c7[_0x23dd('0x4b')]===0x0){return db['UserProfileResource'][_0x23dd('0x48')]({'name':_0x48f982['name'],'resourceId':_0x48f982['id'],'type':_0x1aa2c7['name'],'sectionId':_0x1aa2c7['id']},{})[_0x23dd('0x21')](function(){return _0x1c2fc2;});}else{return _0x1c2fc2;}})[_0x23dd('0x44')](function(_0x5b1405){logger[_0x23dd('0x26')](_0x23dd('0x4c'),_0x5b1405);throw _0x5b1405;});}return _0x1c2fc2;})[_0x23dd('0x21')](respondWithResult(_0x2b5ae1,0xc9))[_0x23dd('0x44')](handleError(_0x2b5ae1,null));};exports[_0x23dd('0x20')]=function(_0x4ada20,_0x2c6b8a){if(_0x4ada20['body']['id']){delete _0x4ada20['body']['id'];}return db[_0x23dd('0x2c')][_0x23dd('0x47')]({'where':{'id':_0x4ada20[_0x23dd('0x46')]['id']}})[_0x23dd('0x21')](handleEntityNotFound(_0x2c6b8a,null))[_0x23dd('0x21')](saveUpdates(_0x4ada20[_0x23dd('0x4d')],null))['then'](respondWithResult(_0x2c6b8a,null))['catch'](handleError(_0x2c6b8a,null));};exports[_0x23dd('0x22')]=function(_0x10895d,_0x52f36b){return db['Disposition'][_0x23dd('0x47')]({'where':{'id':_0x10895d['params']['id']}})[_0x23dd('0x21')](handleEntityNotFound(_0x52f36b,null))[_0x23dd('0x21')](removeEntity(_0x52f36b,null))[_0x23dd('0x44')](handleError(_0x52f36b,null));}; \ No newline at end of file +var _0x8149=['rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','catch','eml-format','rimraf','fast-json-patch','request-promise','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','name','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x3993df,_0x2b7088){var _0x313ad3=function(_0x1a6476){while(--_0x1a6476){_0x3993df['push'](_0x3993df['shift']());}};_0x313ad3(++_0x2b7088);}(_0x8149,0x1a3));var _0x9814=function(_0x13899b,_0x4c90fa){_0x13899b=_0x13899b-0x0;var _0x478a0d=_0x8149[_0x13899b];return _0x478a0d;};'use strict';var emlformat=require(_0x9814('0x0'));var rimraf=require(_0x9814('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9814('0x2'));var rp=require(_0x9814('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9814('0x4'));var path=require(_0x9814('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9814('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9814('0x7'));var crypto=require(_0x9814('0x8'));var jsforce=require(_0x9814('0x9'));var deskjs=require(_0x9814('0xa'));var toCsv=require(_0x9814('0xb'));var querystring=require('querystring');var Papa=require(_0x9814('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9814('0xd'));var as=require(_0x9814('0xe'));var hardwareService=require(_0x9814('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9814('0x10'));var config=require(_0x9814('0x11'));var licenseUtil=require(_0x9814('0x12'));var db=require(_0x9814('0x13'))['db'];function respondWithStatusCode(_0x4b9ef9,_0x20c6e8){_0x20c6e8=_0x20c6e8||0xcc;return function(_0x3c721c){if(_0x3c721c){return _0x4b9ef9[_0x9814('0x14')](_0x20c6e8);}return _0x4b9ef9[_0x9814('0x15')](_0x20c6e8)[_0x9814('0x16')]();};}function respondWithResult(_0x3e2527,_0x2fe1eb){_0x2fe1eb=_0x2fe1eb||0xc8;return function(_0x465838){if(_0x465838){return _0x3e2527['status'](_0x2fe1eb)[_0x9814('0x17')](_0x465838);}};}function respondWithFilteredResult(_0x46392f,_0xb37df9){return function(_0x4e61a1){if(_0x4e61a1){var _0x102b24=typeof _0xb37df9['offset']===_0x9814('0x18')&&typeof _0xb37df9['limit']===_0x9814('0x18');var _0x4db57c=_0x4e61a1[_0x9814('0x19')];var _0xf9b543=_0x102b24?0x0:_0xb37df9[_0x9814('0x1a')];var _0x305f74=_0x102b24?_0x4e61a1['count']:_0xb37df9[_0x9814('0x1a')]+_0xb37df9[_0x9814('0x1b')];var _0x498479;if(_0x305f74>=_0x4db57c){_0x305f74=_0x4db57c;_0x498479=0xc8;}else{_0x498479=0xce;}_0x46392f[_0x9814('0x15')](_0x498479);return _0x46392f[_0x9814('0x1c')](_0x9814('0x1d'),_0xf9b543+'-'+_0x305f74+'/'+_0x4db57c)[_0x9814('0x17')](_0x4e61a1);}return null;};}function patchUpdates(_0x59f1e2){return function(_0x551c5d){try{jsonpatch['apply'](_0x551c5d,_0x59f1e2,!![]);}catch(_0x50fbcc){return BPromise[_0x9814('0x1e')](_0x50fbcc);}return _0x551c5d[_0x9814('0x1f')]();};}function saveUpdates(_0x4c956a,_0xe099d8){return function(_0x581f5f){if(_0x581f5f){return _0x581f5f[_0x9814('0x20')](_0x4c956a)[_0x9814('0x21')](function(_0x10f2ab){return _0x10f2ab;});}return null;};}function removeEntity(_0x158ca1,_0x4e3e06){return function(_0x4eef7d){if(_0x4eef7d){return _0x4eef7d[_0x9814('0x22')]()[_0x9814('0x21')](function(){var _0x526167=_0x4eef7d[_0x9814('0x23')]({'plain':!![]});var _0x1bcd62=_0x9814('0x24');return db[_0x9814('0x25')]['destroy']({'where':{'type':_0x1bcd62,'resourceId':_0x526167['id']}})[_0x9814('0x21')](function(){return _0x4eef7d;});})[_0x9814('0x21')](function(){_0x158ca1[_0x9814('0x15')](0xcc)[_0x9814('0x16')]();});}};}function handleEntityNotFound(_0x8e4fc9,_0x5e895e){return function(_0xed8d68){if(!_0xed8d68){_0x8e4fc9[_0x9814('0x14')](0x194);}return _0xed8d68;};}function handleError(_0x444d62,_0x1df621){_0x1df621=_0x1df621||0x1f4;return function(_0x3011eb){logger['error'](_0x3011eb['stack']);if(_0x3011eb[_0x9814('0x26')]){delete _0x3011eb[_0x9814('0x26')];}_0x444d62[_0x9814('0x15')](_0x1df621)['send'](_0x3011eb);};}exports[_0x9814('0x27')]=function(_0x59cb33,_0x3890f1){var _0x480fc9={},_0x233e3d={},_0x1ccc33={'count':0x0,'rows':[]};var _0x4ba54e=_[_0x9814('0x28')](db[_0x9814('0x29')][_0x9814('0x2a')],function(_0x598a8f){return{'name':_0x598a8f[_0x9814('0x2b')],'type':_0x598a8f[_0x9814('0x2c')][_0x9814('0x2d')]};});_0x233e3d['model']=_[_0x9814('0x28')](_0x4ba54e,_0x9814('0x26'));_0x233e3d[_0x9814('0x2e')]=_[_0x9814('0x2f')](_0x59cb33['query']);_0x233e3d[_0x9814('0x30')]=_['intersection'](_0x233e3d['model'],_0x233e3d[_0x9814('0x2e')]);_0x480fc9[_0x9814('0x31')]=_[_0x9814('0x32')](_0x233e3d[_0x9814('0x33')],qs['fields'](_0x59cb33['query'][_0x9814('0x34')]));_0x480fc9[_0x9814('0x31')]=_0x480fc9['attributes'][_0x9814('0x35')]?_0x480fc9[_0x9814('0x31')]:_0x233e3d['model'];if(!_0x59cb33[_0x9814('0x2e')][_0x9814('0x36')](_0x9814('0x37'))){_0x480fc9['limit']=qs['limit'](_0x59cb33[_0x9814('0x2e')]['limit']);_0x480fc9[_0x9814('0x1a')]=qs[_0x9814('0x1a')](_0x59cb33[_0x9814('0x2e')][_0x9814('0x1a')]);}_0x480fc9[_0x9814('0x38')]=qs[_0x9814('0x39')](_0x59cb33[_0x9814('0x2e')][_0x9814('0x39')]);_0x480fc9[_0x9814('0x3a')]=qs[_0x9814('0x30')](_[_0x9814('0x3b')](_0x59cb33[_0x9814('0x2e')],_0x233e3d[_0x9814('0x30')]),_0x4ba54e);if(_0x59cb33[_0x9814('0x2e')]['filter']){_0x480fc9[_0x9814('0x3a')]=_[_0x9814('0x3c')](_0x480fc9['where'],{'$or':_[_0x9814('0x28')](_0x4ba54e,function(_0x260900){if(_0x260900['type']!==_0x9814('0x3d')){var _0x4a710b={};_0x4a710b[_0x260900[_0x9814('0x26')]]={'$like':'%'+_0x59cb33[_0x9814('0x2e')][_0x9814('0x3e')]+'%'};return _0x4a710b;}})});}_0x480fc9=_[_0x9814('0x3c')]({},_0x480fc9,_0x59cb33[_0x9814('0x3f')]);var _0x10a4cf={'where':_0x480fc9[_0x9814('0x3a')]};return db['Disposition'][_0x9814('0x19')](_0x10a4cf)[_0x9814('0x21')](function(_0x1b01ac){_0x1ccc33['count']=_0x1b01ac;if(_0x59cb33[_0x9814('0x2e')][_0x9814('0x40')]){_0x480fc9[_0x9814('0x41')]=[{'all':!![]}];}return db[_0x9814('0x29')][_0x9814('0x42')](_0x480fc9);})['then'](function(_0x1c6b92){_0x1ccc33[_0x9814('0x43')]=_0x1c6b92;return _0x1ccc33;})[_0x9814('0x21')](respondWithFilteredResult(_0x3890f1,_0x480fc9))['catch'](handleError(_0x3890f1,null));};exports[_0x9814('0x44')]=function(_0x3d2597,_0x322854){var _0x2ca602={'raw':!![],'where':{'id':_0x3d2597[_0x9814('0x45')]['id']}},_0x35aa62={};_0x35aa62[_0x9814('0x33')]=_[_0x9814('0x2f')](db[_0x9814('0x29')]['rawAttributes']);_0x35aa62['query']=_[_0x9814('0x2f')](_0x3d2597[_0x9814('0x2e')]);_0x35aa62[_0x9814('0x30')]=_[_0x9814('0x32')](_0x35aa62[_0x9814('0x33')],_0x35aa62[_0x9814('0x2e')]);_0x2ca602[_0x9814('0x31')]=_[_0x9814('0x32')](_0x35aa62['model'],qs[_0x9814('0x34')](_0x3d2597[_0x9814('0x2e')][_0x9814('0x34')]));_0x2ca602['attributes']=_0x2ca602[_0x9814('0x31')][_0x9814('0x35')]?_0x2ca602[_0x9814('0x31')]:_0x35aa62[_0x9814('0x33')];if(_0x3d2597[_0x9814('0x2e')][_0x9814('0x40')]){_0x2ca602[_0x9814('0x41')]=[{'all':!![]}];}_0x2ca602=_[_0x9814('0x3c')]({},_0x2ca602,_0x3d2597[_0x9814('0x3f')]);return db['Disposition'][_0x9814('0x46')](_0x2ca602)['then'](handleEntityNotFound(_0x322854,null))[_0x9814('0x21')](respondWithResult(_0x322854,null))['catch'](handleError(_0x322854,null));};exports[_0x9814('0x47')]=function(_0x3a7635,_0xc0b647){return db[_0x9814('0x29')][_0x9814('0x47')](_0x3a7635[_0x9814('0x48')],{})[_0x9814('0x21')](function(_0x313bb9){var _0x5948f3=_0x3a7635[_0x9814('0x49')][_0x9814('0x23')]({'plain':!![]});if(!_0x5948f3)throw new Error(_0x9814('0x4a'));if(_0x5948f3[_0x9814('0x4b')]===_0x9814('0x49')){var _0x50e797=_0x313bb9[_0x9814('0x23')]({'plain':!![]});var _0x4aaf8a=_0x9814('0x24');return db[_0x9814('0x4c')][_0x9814('0x46')]({'where':{'name':_0x4aaf8a,'userProfileId':_0x5948f3[_0x9814('0x4d')]},'raw':!![]})[_0x9814('0x21')](function(_0x360309){if(_0x360309&&_0x360309[_0x9814('0x4e')]===0x0){return db[_0x9814('0x25')][_0x9814('0x47')]({'name':_0x50e797[_0x9814('0x26')],'resourceId':_0x50e797['id'],'type':_0x360309[_0x9814('0x26')],'sectionId':_0x360309['id']},{})['then'](function(){return _0x313bb9;});}else{return _0x313bb9;}})['catch'](function(_0xe37ab6){logger[_0x9814('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe37ab6);throw _0xe37ab6;});}return _0x313bb9;})['then'](respondWithResult(_0xc0b647,0xc9))[_0x9814('0x50')](handleError(_0xc0b647,null));};exports[_0x9814('0x20')]=function(_0x19d704,_0x37f1df){if(_0x19d704[_0x9814('0x48')]['id']){delete _0x19d704[_0x9814('0x48')]['id'];}return db['Disposition']['find']({'where':{'id':_0x19d704[_0x9814('0x45')]['id']}})[_0x9814('0x21')](handleEntityNotFound(_0x37f1df,null))[_0x9814('0x21')](saveUpdates(_0x19d704['body'],null))[_0x9814('0x21')](respondWithResult(_0x37f1df,null))['catch'](handleError(_0x37f1df,null));};exports[_0x9814('0x22')]=function(_0x4174a5,_0x1bf1ac){return db[_0x9814('0x29')][_0x9814('0x46')]({'where':{'id':_0x4174a5[_0x9814('0x45')]['id']}})[_0x9814('0x21')](handleEntityNotFound(_0x1bf1ac,null))[_0x9814('0x21')](removeEntity(_0x1bf1ac,null))[_0x9814('0x50')](handleError(_0x1bf1ac,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 730a6ae..0c44030 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 _0x2665=['./disposition.attributes','define','Disposition','name_voice','name','name_chat','ChatWebsiteId','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2665,0x77));var _0x5266=function(_0x253196,_0x1bdd63){_0x253196=_0x253196-0x0;var _0x4b47e9=_0x2665[_0x253196];return _0x4b47e9;};'use strict';var _=require(_0x5266('0x0'));var util=require(_0x5266('0x1'));var logger=require('../../config/logger')(_0x5266('0x2'));var moment=require(_0x5266('0x3'));var BPromise=require(_0x5266('0x4'));var rp=require(_0x5266('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5266('0x6'));var config=require('../../config/environment');var attributes=require(_0x5266('0x7'));module['exports']=function(_0x3e4a41,_0x6b1661){return _0x3e4a41[_0x5266('0x8')](_0x5266('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x5266('0xa'),'fields':[_0x5266('0xb'),'ListId']},{'unique':!![],'name':_0x5266('0xc'),'fields':[_0x5266('0xb'),_0x5266('0xd')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x5266('0xb'),_0x5266('0xe')]},{'unique':!![],'name':'name_openchannel','fields':[_0x5266('0xb'),_0x5266('0xf')]},{'unique':!![],'name':_0x5266('0x10'),'fields':['name',_0x5266('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd018=['name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define'];(function(_0x212579,_0xdb4d5a){var _0x55d50e=function(_0x38fa1d){while(--_0x38fa1d){_0x212579['push'](_0x212579['shift']());}};_0x55d50e(++_0xdb4d5a);}(_0xd018,0xda));var _0x8d01=function(_0x49e5e4,_0x2bc557){_0x49e5e4=_0x49e5e4-0x0;var _0x2380a8=_0xd018[_0x49e5e4];return _0x2380a8;};'use strict';var _=require(_0x8d01('0x0'));var util=require(_0x8d01('0x1'));var logger=require('../../config/logger')(_0x8d01('0x2'));var moment=require(_0x8d01('0x3'));var BPromise=require(_0x8d01('0x4'));var rp=require(_0x8d01('0x5'));var fs=require('fs');var path=require(_0x8d01('0x6'));var rimraf=require(_0x8d01('0x7'));var config=require(_0x8d01('0x8'));var attributes=require(_0x8d01('0x9'));module[_0x8d01('0xa')]=function(_0x1afa1d,_0x56be1c){return _0x1afa1d[_0x8d01('0xb')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x8d01('0xc'),'fields':[_0x8d01('0xd'),'ListId']},{'unique':!![],'name':_0x8d01('0xe'),'fields':[_0x8d01('0xd'),_0x8d01('0xf')]},{'unique':!![],'name':_0x8d01('0x10'),'fields':['name',_0x8d01('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x8d01('0xd'),_0x8d01('0x12')]},{'unique':!![],'name':_0x8d01('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x8d01('0x14'),'fields':[_0x8d01('0xd'),_0x8d01('0x15')]},{'unique':!![],'name':_0x8d01('0x16'),'fields':[_0x8d01('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 63ebf7e..80d6da6 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(_0x2b4c14,_0x2de8ac){var _0x4a559d=function(_0x58e187){while(--_0x58e187){_0x2b4c14['push'](_0x2b4c14['shift']());}};_0x4a559d(++_0x2de8ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x241ba4,_0x16f51c){var _0x252299=function(_0x2f95dc){while(--_0x2f95dc){_0x241ba4['push'](_0x241ba4['shift']());}};_0x252299(++_0x16f51c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 3855aa8..c3fef49 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 _0x4ff4=['get','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','index'];(function(_0xfa1329,_0x45b230){var _0x466317=function(_0xafbff7){while(--_0xafbff7){_0xfa1329['push'](_0xfa1329['shift']());}};_0x466317(++_0x45b230);}(_0x4ff4,0x184));var _0x44ff=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x4ff4[_0x4fc421];return _0x8c6d63;};'use strict';var multer=require(_0x44ff('0x0'));var util=require(_0x44ff('0x1'));var path=require(_0x44ff('0x2'));var timeout=require(_0x44ff('0x3'));var express=require('express');var router=express[_0x44ff('0x4')]();var fs_extra=require(_0x44ff('0x5'));var auth=require(_0x44ff('0x6'));var interaction=require(_0x44ff('0x7'));var config=require('../../config/environment');var controller=require(_0x44ff('0x8'));router['get']('/',auth[_0x44ff('0x9')](),controller[_0x44ff('0xa')]);router[_0x44ff('0xb')]('/:id',auth[_0x44ff('0x9')](),controller['show']);router[_0x44ff('0xc')]('/',auth[_0x44ff('0x9')](),controller[_0x44ff('0xd')]);router[_0x44ff('0xe')]('/:id',auth[_0x44ff('0x9')](),controller[_0x44ff('0xf')]);router[_0x44ff('0x10')](_0x44ff('0x11'),auth['isAuthenticated'](),controller[_0x44ff('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd853=['show','post','create','/:id','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','index','isAuthenticated'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0xd853,0xe7));var _0x3d85=function(_0x17c012,_0x581e0d){_0x17c012=_0x17c012-0x0;var _0x19e62c=_0xd853[_0x17c012];return _0x19e62c;};'use strict';var multer=require(_0x3d85('0x0'));var util=require(_0x3d85('0x1'));var path=require('path');var timeout=require(_0x3d85('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d85('0x3'));var interaction=require(_0x3d85('0x4'));var config=require('../../config/environment');var controller=require(_0x3d85('0x5'));router[_0x3d85('0x6')]('/',auth['isAuthenticated'](),controller[_0x3d85('0x7')]);router[_0x3d85('0x6')]('/:id',auth[_0x3d85('0x8')](),controller[_0x3d85('0x9')]);router[_0x3d85('0xa')]('/',auth[_0x3d85('0x8')](),controller[_0x3d85('0xb')]);router['put'](_0x3d85('0xc'),auth[_0x3d85('0x8')](),controller[_0x3d85('0xd')]);router[_0x3d85('0xe')](_0x3d85('0xc'),auth[_0x3d85('0x8')](),controller['destroy']);module[_0x3d85('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index cc1a6c1..c3884bb 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 _0x9617=['4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400'];(function(_0x40b159,_0x1fb16f){var _0x56f35c=function(_0x4b7108){while(--_0x4b7108){_0x40b159['push'](_0x40b159['shift']());}};_0x56f35c(++_0x1fb16f);}(_0x9617,0x172));var _0x7961=function(_0x4ec243,_0x3b3975){_0x4ec243=_0x4ec243-0x0;var _0x58aa54=_0x9617[_0x4ec243];return _0x58aa54;};'use strict';var Sequelize=require(_0x7961('0x0'));module[_0x7961('0x1')]={'name':{'type':Sequelize[_0x7961('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7961('0x2')]},'ecm':{'type':Sequelize[_0x7961('0x3')](_0x7961('0x4'),'no'),'defaultValue':_0x7961('0x4')},'headerinfo':{'type':Sequelize[_0x7961('0x2')],'defaultValue':_0x7961('0x5')},'localstationid':{'type':Sequelize[_0x7961('0x2')],'unique':_0x7961('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x7961('0x7'),_0x7961('0x8'),_0x7961('0x9'),_0x7961('0xa'),_0x7961('0xb'),'14400'),'defaultValue':_0x7961('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x7961('0x7'),_0x7961('0x8'),'7200',_0x7961('0xa'),'12000',_0x7961('0xc')),'defaultValue':_0x7961('0xc')},'modem':{'type':Sequelize[_0x7961('0x2')],'defaultValue':_0x7961('0xd')},'gateway':{'type':Sequelize[_0x7961('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7961('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7961('0x3')](_0x7961('0xf'),_0x7961('0x10'),_0x7961('0x11'),_0x7961('0x12')),'defaultValue':_0x7961('0xf')},'key':{'type':Sequelize[_0x7961('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7961('0x13')],'defaultValue':function(){return _0x7961('0x14');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7961('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7961('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7961('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7961('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7961('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7961('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x7961('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x7961('0x15')],'defaultValue':![],'comment':_0x7961('0x17'),'set':function(_0x323002){if(!_0x323002)this[_0x7961('0x18')](_0x7961('0x19'),null);this[_0x7961('0x18')](_0x7961('0x1a'),_0x323002);}}}; \ No newline at end of file +var _0x28fd=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','9600','14400','v17,v27,v29','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x519bc9,_0xc0eac4){var _0xd3e989=function(_0x4d6507){while(--_0x4d6507){_0x519bc9['push'](_0x519bc9['shift']());}};_0xd3e989(++_0xc0eac4);}(_0x28fd,0x196));var _0xd28f=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0x28fd[_0x473b41];return _0x4e521d;};'use strict';var Sequelize=require(_0xd28f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd28f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd28f('0x1')]},'ecm':{'type':Sequelize[_0xd28f('0x2')](_0xd28f('0x3'),'no'),'defaultValue':_0xd28f('0x3')},'headerinfo':{'type':Sequelize[_0xd28f('0x1')],'defaultValue':_0xd28f('0x4')},'localstationid':{'type':Sequelize[_0xd28f('0x1')],'unique':_0xd28f('0x5')},'minrate':{'type':Sequelize[_0xd28f('0x2')](_0xd28f('0x6'),_0xd28f('0x7'),_0xd28f('0x8'),'9600',_0xd28f('0x9'),'14400'),'defaultValue':_0xd28f('0x7')},'maxrate':{'type':Sequelize[_0xd28f('0x2')](_0xd28f('0x6'),_0xd28f('0x7'),'7200',_0xd28f('0xa'),_0xd28f('0x9'),_0xd28f('0xb')),'defaultValue':_0xd28f('0xb')},'modem':{'type':Sequelize[_0xd28f('0x1')],'defaultValue':_0xd28f('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xd28f('0xd'),'IAX',_0xd28f('0xe'),_0xd28f('0xf')),'defaultValue':_0xd28f('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd28f('0x10')],'defaultValue':function(){return _0xd28f('0x11');}},'notificationSound':{'type':Sequelize[_0xd28f('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd28f('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd28f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd28f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd28f('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xd28f('0x12')],'defaultValue':![],'comment':_0xd28f('0x15'),'set':function(_0x4ee69e){if(!_0x4ee69e)this[_0xd28f('0x16')]('mandatoryDispositionPauseId',null);this[_0xd28f('0x16')](_0xd28f('0x17'),_0x4ee69e);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ca02756..f68a844 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 _0xbcaf=['fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','getAnswers','CannedAnswer','include','removeAnswers','addInteraction','FaxInteraction','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','sendStatus','getApplications','context','app','description','appdata','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','maxrate','modem','t38timeout','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','VoiceExtension','updateAccountApplications','omit','updatedAt','findById','getMessages','FaxMessage','$gte','split','send','CmList','List','DESC','attachments','join','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','defaults','ListId','List\x20not\x20found','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes'];(function(_0x227097,_0x11a31a){var _0xd1e019=function(_0x5c9047){while(--_0x5c9047){_0x227097['push'](_0x227097['shift']());}};_0xd1e019(++_0x11a31a);}(_0xbcaf,0x80));var _0xfbca=function(_0x5c727c,_0x5ed2dc){_0x5c727c=_0x5c727c-0x0;var _0x3f11de=_0xbcaf[_0x5c727c];return _0x3f11de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbca('0x0'));var zipdir=require(_0xfbca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbca('0x2'));var moment=require(_0xfbca('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfbca('0x4'));var sox=require(_0xfbca('0x5'));var csv=require(_0xfbca('0x6'));var ejs=require(_0xfbca('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbca('0x8'));var squel=require(_0xfbca('0x9'));var crypto=require(_0xfbca('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfbca('0x6'));var querystring=require(_0xfbca('0xb'));var Papa=require(_0xfbca('0xc'));var Redis=require(_0xfbca('0xd'));var authService=require(_0xfbca('0xe'));var qs=require(_0xfbca('0xf'));var as=require(_0xfbca('0x10'));var hardwareService=require(_0xfbca('0x11'));var logger=require(_0xfbca('0x12'))('api');var utils=require(_0xfbca('0x13'));var config=require(_0xfbca('0x14'));var licenseUtil=require(_0xfbca('0x15'));var db=require('../../mysqldb')['db'];config[_0xfbca('0x16')]=_['defaults'](config[_0xfbca('0x16')],{'host':_0xfbca('0x17'),'port':0x18eb});var socket=require(_0xfbca('0x18'))(new Redis(config[_0xfbca('0x16')]));require(_0xfbca('0x19'))['register'](socket);var jayson=require(_0xfbca('0x1a'));var client=jayson[_0xfbca('0x1b')][_0xfbca('0x1c')]({'port':0x232c});var client9002=jayson[_0xfbca('0x1b')][_0xfbca('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1686eb,_0x7244b1,_0x183202,_0x217a99){return new BPromise(function(_0x464de6,_0x417910){var _0x5dac8f=_0x217a99||client;return _0x5dac8f[_0xfbca('0x1d')](_0x1686eb,_0x183202)[_0xfbca('0x1e')](function(_0x28ce37){logger['info'](_0xfbca('0x1f'),_0x7244b1,_0xfbca('0x20'));logger[_0xfbca('0x21')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x7244b1,_0xfbca('0x20'),JSON['stringify'](_0x28ce37));if(_0x28ce37[_0xfbca('0x22')]){if(_0x28ce37[_0xfbca('0x22')][_0xfbca('0x23')]===0x1f4){logger[_0xfbca('0x22')](_0xfbca('0x1f'),_0x7244b1,_0x28ce37[_0xfbca('0x22')]['message']);return _0x417910(_0x28ce37['error']['message']);}logger[_0xfbca('0x22')]('FaxAccount,\x20%s,\x20%s',_0x7244b1,_0x28ce37['error']['message']);return _0x464de6(_0x28ce37['error'][_0xfbca('0x24')]);}else{logger[_0xfbca('0x25')](_0xfbca('0x1f'),_0x7244b1,_0xfbca('0x20'));_0x464de6(_0x28ce37['result'][_0xfbca('0x24')]);}})['catch'](function(_0x2e7849){logger['error'](_0xfbca('0x1f'),_0x7244b1,_0x2e7849);_0x417910(_0x2e7849);});});}function respondWithStatusCode(_0x1bb8ea,_0x1b0ea4){_0x1b0ea4=_0x1b0ea4||0xcc;return function(_0x2190a9){if(_0x2190a9){return _0x1bb8ea['sendStatus'](_0x1b0ea4);}return _0x1bb8ea[_0xfbca('0x26')](_0x1b0ea4)[_0xfbca('0x27')]();};}function respondWithResult(_0x298d69,_0x30e4c7){_0x30e4c7=_0x30e4c7||0xc8;return function(_0xafd75b){if(_0xafd75b){return _0x298d69['status'](_0x30e4c7)[_0xfbca('0x28')](_0xafd75b);}};}function respondWithFilteredResult(_0x229e59,_0x255083){return function(_0xda7470){if(_0xda7470){var _0x10ddc5=typeof _0x255083['offset']===_0xfbca('0x29')&&typeof _0x255083['limit']===_0xfbca('0x29');var _0x1ed2d7=_0xda7470[_0xfbca('0x2a')];var _0x32c26c=_0x10ddc5?0x0:_0x255083['offset'];var _0x5c4722=_0x10ddc5?_0xda7470[_0xfbca('0x2a')]:_0x255083[_0xfbca('0x2b')]+_0x255083[_0xfbca('0x2c')];var _0x46e84a;if(_0x5c4722>=_0x1ed2d7){_0x5c4722=_0x1ed2d7;_0x46e84a=0xc8;}else{_0x46e84a=0xce;}_0x229e59[_0xfbca('0x26')](_0x46e84a);return _0x229e59[_0xfbca('0x2d')](_0xfbca('0x2e'),_0x32c26c+'-'+_0x5c4722+'/'+_0x1ed2d7)[_0xfbca('0x28')](_0xda7470);}return null;};}function patchUpdates(_0x5ad6ca){return function(_0x32b720){try{jsonpatch[_0xfbca('0x2f')](_0x32b720,_0x5ad6ca,!![]);}catch(_0x363af0){return BPromise[_0xfbca('0x30')](_0x363af0);}return _0x32b720[_0xfbca('0x31')]();};}function saveUpdates(_0x2fd116,_0x18d509){return function(_0x259ed8){if(_0x259ed8){return _0x259ed8[_0xfbca('0x32')](_0x2fd116)[_0xfbca('0x1e')](function(_0x5c7d6e){return _0x5c7d6e;});}return null;};}function removeEntity(_0x4f4650,_0x53a53e){return function(_0x2b5251){if(_0x2b5251){return _0x2b5251[_0xfbca('0x33')]()[_0xfbca('0x1e')](function(){var _0x1fb52b=_0x2b5251['get']({'plain':!![]});var _0x5564ae=_0xfbca('0x34');return db['UserProfileResource'][_0xfbca('0x33')]({'where':{'type':_0x5564ae,'resourceId':_0x1fb52b['id']}})[_0xfbca('0x1e')](function(){return _0x2b5251;});})['then'](function(){_0x4f4650['status'](0xcc)[_0xfbca('0x27')]();});}};}function handleEntityNotFound(_0x31de6c,_0x3e44f9){return function(_0xba3b1){if(!_0xba3b1){_0x31de6c['sendStatus'](0x194);}return _0xba3b1;};}function handleError(_0x373e00,_0x3e38f0){_0x3e38f0=_0x3e38f0||0x1f4;return function(_0x420830){logger[_0xfbca('0x22')](_0x420830[_0xfbca('0x35')]);if(_0x420830[_0xfbca('0x36')]){delete _0x420830[_0xfbca('0x36')];}_0x373e00[_0xfbca('0x26')](_0x3e38f0)['send'](_0x420830);};}exports[_0xfbca('0x37')]=function(_0x4e0503,_0x5c72b8){var _0x491aa5={'include':[{'model':db[_0xfbca('0x38')],'as':_0xfbca('0x39')}]},_0x28f897={},_0x45e3a1={'count':0x0,'rows':[]};var _0x1ad0b5=_[_0xfbca('0x3a')](db[_0xfbca('0x3b')][_0xfbca('0x3c')],function(_0x41e007){return{'name':_0x41e007[_0xfbca('0x3d')],'type':_0x41e007[_0xfbca('0x3e')][_0xfbca('0x3f')]};});_0x28f897[_0xfbca('0x40')]=_['map'](_0x1ad0b5,_0xfbca('0x36'));_0x28f897[_0xfbca('0x41')]=_[_0xfbca('0x42')](_0x4e0503['query']);_0x28f897['filters']=_['intersection'](_0x28f897[_0xfbca('0x40')],_0x28f897[_0xfbca('0x41')]);_0x491aa5[_0xfbca('0x43')]=_[_0xfbca('0x44')](_0x28f897[_0xfbca('0x40')],qs[_0xfbca('0x45')](_0x4e0503[_0xfbca('0x41')]['fields']));_0x491aa5[_0xfbca('0x43')]=_0x491aa5['attributes'][_0xfbca('0x46')]?_0x491aa5[_0xfbca('0x43')]:_0x28f897[_0xfbca('0x40')];if(!_0x4e0503[_0xfbca('0x41')][_0xfbca('0x47')](_0xfbca('0x48'))){_0x491aa5[_0xfbca('0x2c')]=qs['limit'](_0x4e0503[_0xfbca('0x41')][_0xfbca('0x2c')]);_0x491aa5[_0xfbca('0x2b')]=qs[_0xfbca('0x2b')](_0x4e0503[_0xfbca('0x41')]['offset']);}_0x491aa5[_0xfbca('0x49')]=qs[_0xfbca('0x4a')](_0x4e0503[_0xfbca('0x41')]['sort']);_0x491aa5['where']=qs[_0xfbca('0x4b')](_[_0xfbca('0x4c')](_0x4e0503['query'],_0x28f897[_0xfbca('0x4b')]),_0x1ad0b5);if(_0x4e0503['query'][_0xfbca('0x4d')]){_0x491aa5[_0xfbca('0x4e')]=_[_0xfbca('0x4f')](_0x491aa5['where'],{'$or':_[_0xfbca('0x3a')](_0x1ad0b5,function(_0x44745d){if(_0x44745d[_0xfbca('0x3e')]!==_0xfbca('0x50')){var _0x5134a3={};_0x5134a3[_0x44745d[_0xfbca('0x36')]]={'$like':'%'+_0x4e0503['query'][_0xfbca('0x4d')]+'%'};return _0x5134a3;}})});}_0x491aa5=_[_0xfbca('0x4f')]({},_0x491aa5,_0x4e0503[_0xfbca('0x51')]);var _0x138184={'where':_0x491aa5[_0xfbca('0x4e')]};return db[_0xfbca('0x3b')]['count'](_0x138184)[_0xfbca('0x1e')](function(_0x523b5b){_0x45e3a1['count']=_0x523b5b;if(_0x4e0503['query'][_0xfbca('0x52')]){_0x491aa5['include']=[{'all':!![]}];}return db[_0xfbca('0x3b')][_0xfbca('0x53')](_0x491aa5);})[_0xfbca('0x1e')](function(_0x4bbe99){_0x45e3a1[_0xfbca('0x54')]=_0x4bbe99;return _0x45e3a1;})[_0xfbca('0x1e')](respondWithFilteredResult(_0x5c72b8,_0x491aa5))[_0xfbca('0x55')](handleError(_0x5c72b8,null));};exports['show']=function(_0x3e610b,_0x357c18){var _0x5dd121={'raw':![],'where':{'id':_0x3e610b[_0xfbca('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x37f529={};_0x37f529[_0xfbca('0x40')]=_[_0xfbca('0x42')](db[_0xfbca('0x3b')][_0xfbca('0x3c')]);_0x37f529['query']=_[_0xfbca('0x42')](_0x3e610b[_0xfbca('0x41')]);_0x37f529['filters']=_[_0xfbca('0x44')](_0x37f529[_0xfbca('0x40')],_0x37f529[_0xfbca('0x41')]);_0x5dd121[_0xfbca('0x43')]=_[_0xfbca('0x44')](_0x37f529[_0xfbca('0x40')],qs[_0xfbca('0x45')](_0x3e610b['query'][_0xfbca('0x45')]));_0x5dd121['attributes']=_0x5dd121[_0xfbca('0x43')][_0xfbca('0x46')]?_0x5dd121[_0xfbca('0x43')]:_0x37f529[_0xfbca('0x40')];if(_0x3e610b['query'][_0xfbca('0x52')]){_0x5dd121['include']=[{'all':!![]}];}_0x5dd121=_[_0xfbca('0x4f')]({},_0x5dd121,_0x3e610b['options']);return db[_0xfbca('0x3b')][_0xfbca('0x57')](_0x5dd121)['then'](handleEntityNotFound(_0x357c18,null))['then'](respondWithResult(_0x357c18,null))['catch'](handleError(_0x357c18,null));};exports[_0xfbca('0x58')]=function(_0x134bb1,_0x503b1e){return db['FaxAccount'][_0xfbca('0x58')](_0x134bb1['body'],{})[_0xfbca('0x1e')](function(_0x48578c){var _0x4a2348=_0x134bb1[_0xfbca('0x59')][_0xfbca('0x5a')]({'plain':!![]});if(!_0x4a2348)throw new Error(_0xfbca('0x5b'));if(_0x4a2348[_0xfbca('0x5c')]==='user'){var _0x28dedb=_0x48578c['get']({'plain':!![]});var _0x234940='FaxAccounts';return db[_0xfbca('0x5d')][_0xfbca('0x57')]({'where':{'name':_0x234940,'userProfileId':_0x4a2348[_0xfbca('0x5e')]},'raw':!![]})[_0xfbca('0x1e')](function(_0x5cee7d){if(_0x5cee7d&&_0x5cee7d['autoAssociation']===0x0){return db['UserProfileResource'][_0xfbca('0x58')]({'name':_0x28dedb[_0xfbca('0x36')],'resourceId':_0x28dedb['id'],'type':_0x5cee7d[_0xfbca('0x36')],'sectionId':_0x5cee7d['id']},{})[_0xfbca('0x1e')](function(){return _0x48578c;});}else{return _0x48578c;}})[_0xfbca('0x55')](function(_0xe8095b){logger[_0xfbca('0x22')](_0xfbca('0x5f'),_0xe8095b);throw _0xe8095b;});}return _0x48578c;})['then'](respondWithResult(_0x503b1e,0xc9))['catch'](handleError(_0x503b1e,null));};exports[_0xfbca('0x32')]=function(_0x4c9fe1,_0x1651e4){if(_0x4c9fe1[_0xfbca('0x60')]['id']){delete _0x4c9fe1[_0xfbca('0x60')]['id'];}return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x4c9fe1['params']['id']},'include':[{'model':db[_0xfbca('0x38')],'as':_0xfbca('0x39')}]})[_0xfbca('0x1e')](handleEntityNotFound(_0x1651e4,null))['then'](saveUpdates(_0x4c9fe1[_0xfbca('0x60')],null))[_0xfbca('0x1e')](respondWithResult(_0x1651e4,null))[_0xfbca('0x55')](handleError(_0x1651e4,null));};exports[_0xfbca('0x33')]=function(_0x542c4d,_0x28cefe){return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x542c4d[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x28cefe,null))['then'](removeEntity(_0x28cefe,null))['catch'](handleError(_0x28cefe,null));};exports[_0xfbca('0x61')]=function(_0x283d6b,_0x5b3920){return db[_0xfbca('0x3b')][_0xfbca('0x61')]()['then'](respondWithResult(_0x5b3920,null))[_0xfbca('0x55')](handleError(_0x5b3920,null));};exports[_0xfbca('0x62')]=function(_0x42acc7,_0x19cb4c,_0x2b2150){if(_0x42acc7[_0xfbca('0x60')]['id']){delete _0x42acc7[_0xfbca('0x60')]['id'];}return db[_0xfbca('0x3b')]['find']({'where':{'id':_0x42acc7[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x19cb4c,null))[_0xfbca('0x1e')](function(_0x2d6596){if(_0x2d6596){_0x42acc7[_0xfbca('0x60')][_0xfbca('0x63')]=_0x2d6596['id'];return db['Disposition'][_0xfbca('0x58')](_0x42acc7[_0xfbca('0x60')]);}})[_0xfbca('0x1e')](respondWithResult(_0x19cb4c,null))[_0xfbca('0x55')](handleError(_0x19cb4c,null));};exports[_0xfbca('0x64')]=function(_0x2175d6,_0x15d0e3,_0x49592e){var _0x3f902d={'raw':![],'where':{}};var _0x27bab9={};var _0x202b97={'count':0x0,'rows':[]};return db[_0xfbca('0x3b')][_0xfbca('0x65')]({'where':{'id':_0x2175d6[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x15d0e3,null))[_0xfbca('0x1e')](function(_0x1a2ad7){if(_0x1a2ad7){_0x27bab9[_0xfbca('0x40')]=_['keys'](db[_0xfbca('0x66')][_0xfbca('0x3c')]);_0x27bab9[_0xfbca('0x41')]=_['keys'](_0x2175d6[_0xfbca('0x41')]);_0x27bab9[_0xfbca('0x4b')]=_[_0xfbca('0x44')](_0x27bab9[_0xfbca('0x40')],_0x27bab9['query']);_0x3f902d[_0xfbca('0x43')]=_[_0xfbca('0x44')](_0x27bab9[_0xfbca('0x40')],qs[_0xfbca('0x45')](_0x2175d6[_0xfbca('0x41')]['fields']));_0x3f902d[_0xfbca('0x43')]=_0x3f902d[_0xfbca('0x43')][_0xfbca('0x46')]?_0x3f902d[_0xfbca('0x43')]:_0x27bab9[_0xfbca('0x40')];if(!_0x2175d6[_0xfbca('0x41')]['hasOwnProperty']('nolimit')){_0x3f902d['limit']=qs['limit'](_0x2175d6['query'][_0xfbca('0x2c')]);_0x3f902d[_0xfbca('0x2b')]=qs[_0xfbca('0x2b')](_0x2175d6[_0xfbca('0x41')][_0xfbca('0x2b')]);}_0x3f902d[_0xfbca('0x49')]=qs['sort'](_0x2175d6[_0xfbca('0x41')]['sort']);_0x3f902d[_0xfbca('0x4e')]=qs[_0xfbca('0x4b')](_['pick'](_0x2175d6[_0xfbca('0x41')],_0x27bab9['filters']));_0x3f902d[_0xfbca('0x4e')]['FaxAccountId']=_0x1a2ad7['id'];if(_0x2175d6['query']['filter']){_0x3f902d[_0xfbca('0x4e')]=_['merge'](_0x3f902d[_0xfbca('0x4e')],{'$or':_[_0xfbca('0x3a')](_0x3f902d[_0xfbca('0x43')],function(_0x13ae6f){var _0xc64829={};_0xc64829[_0x13ae6f]={'$like':'%'+_0x2175d6['query'][_0xfbca('0x4d')]+'%'};return _0xc64829;})});}_0x3f902d=_[_0xfbca('0x4f')]({},_0x3f902d,_0x2175d6[_0xfbca('0x51')]);return db[_0xfbca('0x66')]['count']({'where':_0x3f902d[_0xfbca('0x4e')]})[_0xfbca('0x1e')](function(_0x55ecc8){_0x202b97[_0xfbca('0x2a')]=_0x55ecc8;if(_0x2175d6[_0xfbca('0x41')]['includeAll']){_0x3f902d['include']=[{'all':!![]}];}return db[_0xfbca('0x66')][_0xfbca('0x53')](_0x3f902d);})[_0xfbca('0x1e')](function(_0xa3c10b){_0x202b97[_0xfbca('0x54')]=_0xa3c10b;return _0x202b97;});}})[_0xfbca('0x1e')](respondWithFilteredResult(_0x15d0e3,_0x3f902d))[_0xfbca('0x55')](handleError(_0x15d0e3,null));};exports[_0xfbca('0x67')]=function(_0x30c7e5,_0x2ae6df,_0x3385dd){return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x30c7e5[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x2ae6df,null))['then'](function(_0x3528d1){if(_0x3528d1){return _0x3528d1[_0xfbca('0x67')](_0x30c7e5[_0xfbca('0x41')][_0xfbca('0x68')]);}})['then'](respondWithStatusCode(_0x2ae6df,null))[_0xfbca('0x55')](handleError(_0x2ae6df,null));};exports['addAnswer']=function(_0x350239,_0x12599b,_0x5e9525){if(_0x350239[_0xfbca('0x60')]['id']){delete _0x350239[_0xfbca('0x60')]['id'];}return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x350239[_0xfbca('0x56')]['id']}})['then'](handleEntityNotFound(_0x12599b,null))[_0xfbca('0x1e')](function(_0x1c6063){if(_0x1c6063){_0x350239['body'][_0xfbca('0x63')]=_0x1c6063['id'];return db['CannedAnswer'][_0xfbca('0x58')](_0x350239[_0xfbca('0x60')]);}})[_0xfbca('0x1e')](respondWithResult(_0x12599b,null))[_0xfbca('0x55')](handleError(_0x12599b,null));};exports[_0xfbca('0x69')]=function(_0x576a3c,_0x5782a7,_0x3a8e85){var _0x4cbf9c={'raw':![],'where':{}};var _0x128ffe={};var _0xca306={'count':0x0,'rows':[]};return db[_0xfbca('0x3b')][_0xfbca('0x65')]({'where':{'id':_0x576a3c[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x5782a7,null))[_0xfbca('0x1e')](function(_0xcdea77){if(_0xcdea77){_0x128ffe['model']=_['keys'](db['CannedAnswer'][_0xfbca('0x3c')]);_0x128ffe[_0xfbca('0x41')]=_['keys'](_0x576a3c[_0xfbca('0x41')]);_0x128ffe[_0xfbca('0x4b')]=_[_0xfbca('0x44')](_0x128ffe[_0xfbca('0x40')],_0x128ffe[_0xfbca('0x41')]);_0x4cbf9c['attributes']=_['intersection'](_0x128ffe[_0xfbca('0x40')],qs['fields'](_0x576a3c[_0xfbca('0x41')][_0xfbca('0x45')]));_0x4cbf9c[_0xfbca('0x43')]=_0x4cbf9c['attributes']['length']?_0x4cbf9c[_0xfbca('0x43')]:_0x128ffe[_0xfbca('0x40')];if(!_0x576a3c[_0xfbca('0x41')]['hasOwnProperty']('nolimit')){_0x4cbf9c['limit']=qs[_0xfbca('0x2c')](_0x576a3c[_0xfbca('0x41')]['limit']);_0x4cbf9c[_0xfbca('0x2b')]=qs[_0xfbca('0x2b')](_0x576a3c[_0xfbca('0x41')][_0xfbca('0x2b')]);}_0x4cbf9c['order']=qs[_0xfbca('0x4a')](_0x576a3c[_0xfbca('0x41')][_0xfbca('0x4a')]);_0x4cbf9c[_0xfbca('0x4e')]=qs['filters'](_[_0xfbca('0x4c')](_0x576a3c['query'],_0x128ffe[_0xfbca('0x4b')]));_0x4cbf9c[_0xfbca('0x4e')][_0xfbca('0x63')]=_0xcdea77['id'];if(_0x576a3c[_0xfbca('0x41')]['filter']){_0x4cbf9c[_0xfbca('0x4e')]=_['merge'](_0x4cbf9c[_0xfbca('0x4e')],{'$or':_['map'](_0x4cbf9c['attributes'],function(_0x3d8a22){var _0x3cb8b6={};_0x3cb8b6[_0x3d8a22]={'$like':'%'+_0x576a3c['query'][_0xfbca('0x4d')]+'%'};return _0x3cb8b6;})});}_0x4cbf9c=_['merge']({},_0x4cbf9c,_0x576a3c[_0xfbca('0x51')]);return db[_0xfbca('0x6a')][_0xfbca('0x2a')]({'where':_0x4cbf9c[_0xfbca('0x4e')]})[_0xfbca('0x1e')](function(_0x273917){_0xca306[_0xfbca('0x2a')]=_0x273917;if(_0x576a3c[_0xfbca('0x41')]['includeAll']){_0x4cbf9c[_0xfbca('0x6b')]=[{'all':!![]}];}return db[_0xfbca('0x6a')][_0xfbca('0x53')](_0x4cbf9c);})[_0xfbca('0x1e')](function(_0x528c0f){_0xca306[_0xfbca('0x54')]=_0x528c0f;return _0xca306;});}})[_0xfbca('0x1e')](respondWithFilteredResult(_0x5782a7,_0x4cbf9c))['catch'](handleError(_0x5782a7,null));};exports[_0xfbca('0x6c')]=function(_0x5e0ce1,_0xec258e,_0x16e501){return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x5e0ce1[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0xec258e,null))[_0xfbca('0x1e')](function(_0x134555){if(_0x134555){return _0x134555[_0xfbca('0x6c')](_0x5e0ce1[_0xfbca('0x41')][_0xfbca('0x68')]);}})[_0xfbca('0x1e')](respondWithStatusCode(_0xec258e,null))['catch'](handleError(_0xec258e,null));};exports[_0xfbca('0x6d')]=function(_0x4025d5,_0x2ee0fd,_0x1df42b){return db[_0xfbca('0x6e')]['find']({'where':{'id':_0x4025d5['params']['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x2ee0fd,null))['then'](function(_0x3fa3a4){if(_0x3fa3a4){return _0x3fa3a4['addInteraction'](_0x4025d5[_0xfbca('0x60')][_0xfbca('0x68')],_['omit'](_0x4025d5[_0xfbca('0x60')],[_0xfbca('0x68'),'id'])||{});}})[_0xfbca('0x1e')](respondWithResult(_0x2ee0fd,null))[_0xfbca('0x55')](handleError(_0x2ee0fd,null));};exports['getInteractions']=function(_0x30e231,_0x3d1f9b,_0x584ead){var _0xbfebf8={'raw':![],'where':{}};var _0x51a0b2={};var _0xc056b2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xfbca('0x65')]({'where':{'id':_0x30e231[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x3d1f9b,null))['then'](function(_0x5afddd){if(_0x5afddd){_0x51a0b2[_0xfbca('0x40')]=_['keys'](db[_0xfbca('0x6e')]['rawAttributes']);_0x51a0b2['query']=_[_0xfbca('0x42')](_0x30e231['query']);_0x51a0b2[_0xfbca('0x4b')]=_[_0xfbca('0x44')](_0x51a0b2[_0xfbca('0x40')],_0x51a0b2[_0xfbca('0x41')]);_0xbfebf8[_0xfbca('0x43')]=_['intersection'](_0x51a0b2[_0xfbca('0x40')],qs[_0xfbca('0x45')](_0x30e231[_0xfbca('0x41')]['fields']));_0xbfebf8[_0xfbca('0x43')]=_0xbfebf8['attributes']['length']?_0xbfebf8['attributes']:_0x51a0b2[_0xfbca('0x40')];if(!_0x30e231[_0xfbca('0x41')][_0xfbca('0x47')]('nolimit')){_0xbfebf8['limit']=qs[_0xfbca('0x2c')](_0x30e231[_0xfbca('0x41')]['limit']);_0xbfebf8[_0xfbca('0x2b')]=qs[_0xfbca('0x2b')](_0x30e231[_0xfbca('0x41')][_0xfbca('0x2b')]);}_0xbfebf8[_0xfbca('0x49')]=qs['sort'](_0x30e231[_0xfbca('0x41')]['sort']);_0xbfebf8[_0xfbca('0x4e')]=qs[_0xfbca('0x4b')](_[_0xfbca('0x4c')](_0x30e231['query'],_0x51a0b2[_0xfbca('0x4b')]));_0xbfebf8[_0xfbca('0x4e')]['FaxAccountId']=_0x5afddd['id'];if(_0x30e231[_0xfbca('0x41')]['filter']){_0xbfebf8[_0xfbca('0x4e')]=_[_0xfbca('0x4f')](_0xbfebf8[_0xfbca('0x4e')],{'$or':_[_0xfbca('0x3a')](_0xbfebf8['attributes'],function(_0x3119bf){var _0x225613={};_0x225613[_0x3119bf]={'$like':'%'+_0x30e231[_0xfbca('0x41')][_0xfbca('0x4d')]+'%'};return _0x225613;})});}_0xbfebf8=_['merge']({},_0xbfebf8,_0x30e231[_0xfbca('0x51')]);return db[_0xfbca('0x6e')][_0xfbca('0x2a')]({'where':_0xbfebf8['where']})[_0xfbca('0x1e')](function(_0x775647){_0xc056b2[_0xfbca('0x2a')]=_0x775647;if(_0x30e231[_0xfbca('0x41')]['includeAll']){_0xbfebf8[_0xfbca('0x6b')]=[{'model':db[_0xfbca('0x6f')],'as':_0xfbca('0x70'),'required':![]},{'model':db['User'],'as':_0xfbca('0x71'),'attributes':[_0xfbca('0x36'),_0xfbca('0x72'),_0xfbca('0x73')],'required':![]},{'model':db[_0xfbca('0x74')],'as':_0xfbca('0x75'),'attributes':['id',_0xfbca('0x36'),_0xfbca('0x76')],'where':_0x30e231['query'][_0xfbca('0x77')]?{'id':_0x30e231[_0xfbca('0x41')][_0xfbca('0x77')]}:undefined,'required':_0x30e231['query'][_0xfbca('0x77')]?!![]:![]}];}return db[_0xfbca('0x6e')][_0xfbca('0x53')](_0xbfebf8);})[_0xfbca('0x1e')](function(_0x1d1df2){_0xc056b2['rows']=_0x1d1df2;return _0xc056b2;});}})['then'](respondWithFilteredResult(_0x3d1f9b,_0xbfebf8))[_0xfbca('0x55')](handleError(_0x3d1f9b,null));};exports['addApplications']=function(_0x2fe472,_0x425318){var _0x539434=_0x2fe472[_0xfbca('0x56')]['id'];var _0x49cdaf=_0x2fe472[_0xfbca('0x60')];var _0x48919d=0xc8;var _0x7b75c5=null;return db[_0xfbca('0x78')][_0xfbca('0x79')]({'isolationLevel':db[_0xfbca('0x78')][_0xfbca('0x7a')][_0xfbca('0x7b')][_0xfbca('0x7c')]},function(_0x37ed36){return db[_0xfbca('0x3b')]['findOne']({'where':{'id':_0x539434},'transaction':_0x37ed36})[_0xfbca('0x1e')](function(_0x456693){if(_0x456693){return db[_0xfbca('0x7d')]['destroy']({'where':{'FaxAccountId':_0x539434},'transaction':_0x37ed36})[_0xfbca('0x1e')](function(){var _0xfc69c3=_[_0xfbca('0x3a')](_0x49cdaf,function(_0x3ea650){_0x3ea650['FaxAccountId']=_0x539434;return _0x3ea650;});return db['FaxApplication'][_0xfbca('0x7e')](_0xfc69c3,{'transaction':_0x37ed36});});}else{_0x48919d=0x194;_0x7b75c5=[];}});})[_0xfbca('0x1e')](function(){if(_0x48919d!==0x194){return db['FaxApplication'][_0xfbca('0x7f')]({'where':{'FaxAccountId':_0x539434},'order':_0xfbca('0x80')})[_0xfbca('0x1e')](function(_0x298898){_0x7b75c5=_0x298898;});}})['catch'](function(_0x58d21b){_0x48919d=0x1f4;logger[_0xfbca('0x22')](_0x58d21b[_0xfbca('0x35')]);if(_0x58d21b[_0xfbca('0x36')]){delete _0x58d21b[_0xfbca('0x36')];}_0x7b75c5=_0x58d21b;})[_0xfbca('0x81')](function(){if(_0x7b75c5===null){_0x425318[_0xfbca('0x82')](_0x48919d);}else{if(_0x48919d===0x1f4){_0x425318[_0xfbca('0x26')](_0x48919d)['send'](_0x7b75c5);}else{_0x425318[_0xfbca('0x26')](_0x48919d)[_0xfbca('0x28')](_0x7b75c5);}}});};exports[_0xfbca('0x83')]=function(_0x1d31ba,_0x5234a5,_0x55c369){var _0x3d6b79={};var _0xfa5d6e={};var _0x325d4b;var _0xd3ab7d;return db[_0xfbca('0x3b')][_0xfbca('0x65')]({'where':{'id':_0x1d31ba[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x5234a5,null))[_0xfbca('0x1e')](function(_0x590fd3){if(_0x590fd3){_0x325d4b=_0x590fd3;_0xfa5d6e[_0xfbca('0x40')]=_[_0xfbca('0x42')](db[_0xfbca('0x7d')][_0xfbca('0x3c')]);_0xfa5d6e[_0xfbca('0x41')]=_['keys'](_0x1d31ba['query']);_0xfa5d6e[_0xfbca('0x4b')]=_[_0xfbca('0x44')](_0xfa5d6e[_0xfbca('0x40')],_0xfa5d6e['query']);_0x3d6b79['attributes']=_[_0xfbca('0x44')](_0xfa5d6e[_0xfbca('0x40')],qs[_0xfbca('0x45')](_0x1d31ba[_0xfbca('0x41')][_0xfbca('0x45')]));_0x3d6b79[_0xfbca('0x43')]=_0x3d6b79[_0xfbca('0x43')][_0xfbca('0x46')]?_0x3d6b79[_0xfbca('0x43')]:_0xfa5d6e['model'];_0x3d6b79[_0xfbca('0x49')]=qs[_0xfbca('0x4a')](_0x1d31ba[_0xfbca('0x41')][_0xfbca('0x4a')]);_0x3d6b79['where']=qs[_0xfbca('0x4b')](_[_0xfbca('0x4c')](_0x1d31ba[_0xfbca('0x41')],_0xfa5d6e[_0xfbca('0x4b')]));if(_0x1d31ba['query'][_0xfbca('0x4d')]){_0x3d6b79[_0xfbca('0x4e')]=_[_0xfbca('0x4f')](_0x3d6b79[_0xfbca('0x4e')],{'$or':_['map'](_0x3d6b79[_0xfbca('0x43')],function(_0x13ee9a){var _0x3b8178={};_0x3b8178[_0x13ee9a]={'$like':'%'+_0x1d31ba['query']['filter']+'%'};return _0x3b8178;})});}_0x3d6b79=_[_0xfbca('0x4f')]({},_0x3d6b79,_0x1d31ba['options']);return _0x325d4b[_0xfbca('0x83')](_0x3d6b79);}})['then'](function(_0xb31cd8){if(_0xb31cd8){_0xd3ab7d=_0xb31cd8[_0xfbca('0x46')];if(!_0x1d31ba[_0xfbca('0x41')][_0xfbca('0x47')](_0xfbca('0x48'))){_0x3d6b79['limit']=qs[_0xfbca('0x2c')](_0x1d31ba[_0xfbca('0x41')][_0xfbca('0x2c')]);_0x3d6b79['offset']=qs['offset'](_0x1d31ba[_0xfbca('0x41')][_0xfbca('0x2b')]);}return _0x325d4b[_0xfbca('0x83')](_0x3d6b79);}})[_0xfbca('0x1e')](function(_0x242b0b){if(_0x242b0b){return _0x242b0b?{'count':_0xd3ab7d,'rows':_0x242b0b}:null;}})['then'](respondWithResult(_0x5234a5,null))[_0xfbca('0x55')](handleError(_0x5234a5,null));};function Extension(_0x31c16f,_0x342d14,_0x4c5c47,_0x4fe9c0){this[_0xfbca('0x84')]='from-voip-provider';this['exten']=_0x31c16f['localstationid'];this[_0xfbca('0x85')]=_0x4fe9c0;this[_0xfbca('0x3e')]='system';this[_0xfbca('0x86')]='Fax\x20Extension';this[_0xfbca('0x63')]=_0x31c16f['id'];this['priority']=_0x342d14;this[_0xfbca('0x87')]=_0x4c5c47;}function createExtensionsReciveFax(_0x318254){var _0x4bbb3f=0x1;var _0xb08871=[];_0xb08871[_0xfbca('0x88')](new Extension(_0x318254,_0x4bbb3f,'','Answer'));_0x4bbb3f+=0x1;_0xb08871[_0xfbca('0x88')](new Extension(_0x318254,_0x4bbb3f,_0xfbca('0x89'),_0xfbca('0x8a')));_0x4bbb3f+=0x1;for(var _0x112d2b in _0x318254){if(_0x318254['hasOwnProperty'](_0x112d2b)&&(_0x112d2b===_0xfbca('0x8b')||_0x112d2b===_0xfbca('0x8c')||_0x112d2b===_0xfbca('0x8d')||_0x112d2b===_0xfbca('0x8e')||_0x112d2b==='headerinfo'||_0x112d2b===_0xfbca('0x8f')||_0x112d2b==='minrate'||_0x112d2b===_0xfbca('0x90')||_0x112d2b===_0xfbca('0x91'))){_0xb08871[_0xfbca('0x88')](new Extension(_0x318254,_0x4bbb3f,'FAXOPT('+_0x112d2b+')='+_0x318254[_0x112d2b],_0xfbca('0x8a')));_0x4bbb3f+=0x1;}}_0xb08871[_0xfbca('0x88')](new Extension(_0x318254,_0x4bbb3f,'6',_0xfbca('0x92')));_0x4bbb3f+=0x1;_0xb08871[_0xfbca('0x88')](new Extension(_0x318254,_0x4bbb3f,_0xfbca('0x93'),_0xfbca('0x94')));_0x4bbb3f=0x0;return _0xb08871;}exports['addAccountApplications']=function(_0x32ec03,_0x30f0ef,_0x4f4d74){var _0x42d53c;return db['sequelize'][_0xfbca('0x79')](function(_0x2b8515){return db['FaxAccount']['create'](_0x32ec03[_0xfbca('0x60')],{'transaction':_0x2b8515})[_0xfbca('0x1e')](function(_0x1e6db7){_0x42d53c=_0x1e6db7['get']({'plain':!![]});return db[_0xfbca('0x95')][_0xfbca('0x7e')](createExtensionsReciveFax(_0x42d53c),{'transaction':_0x2b8515});});})[_0xfbca('0x1e')](function(){return _0x42d53c;})[_0xfbca('0x1e')](respondWithResult(_0x30f0ef,null))[_0xfbca('0x55')](handleError(_0x30f0ef,null));};exports[_0xfbca('0x96')]=function(_0x4cb111,_0x345d31,_0x51c987){var _0x513fc3;return db[_0xfbca('0x78')][_0xfbca('0x79')](function(_0x47cde4){return db[_0xfbca('0x3b')][_0xfbca('0x32')](_0x4cb111[_0xfbca('0x60')],{'where':{'id':_0x4cb111[_0xfbca('0x60')]['id']},'transaction':_0x47cde4})[_0xfbca('0x1e')](function(_0x4ad82a){return db['VoiceExtension'][_0xfbca('0x33')]({'where':{'FaxAccountId':_0x4cb111[_0xfbca('0x60')]['id']},'transaction':_0x47cde4})[_0xfbca('0x1e')](function(_0x4c8596){return db['VoiceExtension'][_0xfbca('0x7e')](createExtensionsReciveFax(_[_0xfbca('0x97')](_0x4cb111[_0xfbca('0x60')],['tech','key','createdAt',_0xfbca('0x98'),'TrunkId','ListId'])),{'transaction':_0x47cde4});});});})['then'](function(){return db[_0xfbca('0x3b')][_0xfbca('0x99')](_0x4cb111[_0xfbca('0x60')]['id']);})['then'](respondWithResult(_0x345d31,null))[_0xfbca('0x55')](handleError(_0x345d31,null));};exports[_0xfbca('0x9a')]=function(_0x484475,_0x14d284,_0x5dcfa8){var _0x430114={'raw':!![],'where':{}};var _0xcea70f={};var _0x1950bd={'count':0x0,'rows':[]};return db[_0xfbca('0x3b')][_0xfbca('0x65')]({'where':{'id':_0x484475[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x14d284,null))[_0xfbca('0x1e')](function(_0xb26b6e){if(_0xb26b6e){_0xcea70f[_0xfbca('0x40')]=_[_0xfbca('0x42')](db[_0xfbca('0x9b')][_0xfbca('0x3c')]);_0xcea70f[_0xfbca('0x41')]=_[_0xfbca('0x42')](_0x484475['query']);_0xcea70f[_0xfbca('0x4b')]=_[_0xfbca('0x44')](_0xcea70f['model'],_0xcea70f[_0xfbca('0x41')]);_0x430114[_0xfbca('0x43')]=_['intersection'](_0xcea70f[_0xfbca('0x40')],qs['fields'](_0x484475[_0xfbca('0x41')][_0xfbca('0x45')]));_0x430114[_0xfbca('0x43')]=_0x430114[_0xfbca('0x43')][_0xfbca('0x46')]?_0x430114[_0xfbca('0x43')]:_0xcea70f[_0xfbca('0x40')];if(!_0x484475[_0xfbca('0x41')]['hasOwnProperty']('nolimit')){_0x430114[_0xfbca('0x2c')]=qs[_0xfbca('0x2c')](_0x484475[_0xfbca('0x41')]['limit']);_0x430114[_0xfbca('0x2b')]=qs[_0xfbca('0x2b')](_0x484475['query'][_0xfbca('0x2b')]);}_0x430114[_0xfbca('0x49')]=qs['sort'](_0x484475[_0xfbca('0x41')][_0xfbca('0x4a')]);_0x430114['where']=qs['filters'](_[_0xfbca('0x4c')](_0x484475[_0xfbca('0x41')],_0xcea70f[_0xfbca('0x4b')]));_0x430114[_0xfbca('0x4e')]['FaxAccountId']=_0xb26b6e['id'];if(_0x484475[_0xfbca('0x41')][_0xfbca('0x4d')]){_0x430114[_0xfbca('0x4e')]=_['merge'](_0x430114[_0xfbca('0x4e')],{'$or':_[_0xfbca('0x3a')](_0x430114[_0xfbca('0x43')],function(_0x53f59f){var _0x493c24={};_0x493c24[_0x53f59f]={'$like':'%'+_0x484475[_0xfbca('0x41')][_0xfbca('0x4d')]+'%'};return _0x493c24;})});}if(_0x484475[_0xfbca('0x41')]['$gte']){var _0x426d5e=_0x484475['query'][_0xfbca('0x9c')][_0xfbca('0x9d')](',');var _0x322396={};_0x322396[_0x426d5e[0x0]]={'$gte':moment(_0x426d5e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x430114[_0xfbca('0x4e')]=_[_0xfbca('0x4f')](_0x430114[_0xfbca('0x4e')],_0x322396);}_0x430114=_[_0xfbca('0x4f')]({},_0x430114,_0x484475[_0xfbca('0x51')]);return db[_0xfbca('0x9b')][_0xfbca('0x2a')]({'where':_0x430114[_0xfbca('0x4e')]})['then'](function(_0x38ef9e){_0x1950bd['count']=_0x38ef9e;if(_0x484475[_0xfbca('0x41')][_0xfbca('0x52')]){_0x430114[_0xfbca('0x6b')]=[{'all':!![]}];}return db[_0xfbca('0x9b')][_0xfbca('0x53')](_0x430114);})['then'](function(_0x3bf232){_0x1950bd[_0xfbca('0x54')]=_0x3bf232;return _0x1950bd;});}})[_0xfbca('0x1e')](respondWithFilteredResult(_0x14d284,_0x430114))[_0xfbca('0x55')](handleError(_0x14d284,null));};exports[_0xfbca('0x9e')]=function(_0x1737bd,_0x24f759,_0x7d20d){var _0x15773e,_0x46d7fe={},_0x1f29a0;if(_0x1737bd[_0xfbca('0x60')]['to']){_0x1f29a0=_0x1737bd['body']['to'][0x0];}return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x1737bd[_0xfbca('0x56')]['id']},'include':[{'model':db[_0xfbca('0x9f')],'as':_0xfbca('0xa0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x1f29a0},'limit':0x1,'order':[['updatedAt',_0xfbca('0xa1')]]}]}]})[_0xfbca('0x1e')](handleEntityNotFound(_0x24f759,null))[_0xfbca('0x1e')](function(_0x20b829){_0x15773e=_0x20b829;if(_0x1737bd['body']['attachments']&&_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][_0xfbca('0x46')]){for(var _0x2c0a45=0x0;_0x2c0a45<_0x1737bd['body']['attachments']['length'];_0x2c0a45+=0x1){_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][_0x2c0a45]={'filename':_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][_0x2c0a45][_0xfbca('0x36')],'id':_0x1737bd[_0xfbca('0x60')]['attachments'][_0x2c0a45]['id'],'path':path[_0xfbca('0xa3')](config['root'],'server/files/attachments',_0x1737bd['body'][_0xfbca('0xa2')][_0x2c0a45][_0xfbca('0xa4')])};}}return respondWithRpcPromise(_0xfbca('0xa5'),_0xfbca('0xa5'),{'FaxAccountId':_['isNil'](_0x1737bd[_0xfbca('0x56')]['id'])?undefined:_0x1737bd[_0xfbca('0x56')]['id'],'path':_['isNil'](_0x1737bd['body'][_0xfbca('0xa2')][0x0][_0xfbca('0x4')])?undefined:_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][0x0][_0xfbca('0x4')],'fax':_['isNil'](_0x1737bd[_0xfbca('0x60')]['to'][0x0])?undefined:_0x1737bd[_0xfbca('0x60')]['to'][0x0]},client9002);})[_0xfbca('0x1e')](function(){if(_0x15773e){if(_[_0xfbca('0xa6')](_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa7')])){_0x1737bd['body'][_0xfbca('0xa7')]=util[_0xfbca('0xa8')](_0xfbca('0xa9'),_0x15773e['name'],_0x15773e[_0xfbca('0xaa')]);}if(_0x15773e[_0xfbca('0xa0')]){if(_0x15773e['List'][_0xfbca('0xab')][_0xfbca('0x46')]){return _0x15773e[_0xfbca('0xa0')][_0xfbca('0xab')][0x0];}else{return db[_0xfbca('0x6f')]['create'](_[_0xfbca('0xac')](_0x1737bd[_0xfbca('0x60')],{'firstName':_0x1737bd[_0xfbca('0x60')]['to'][0x0],'phone':_0x1737bd['body']['to'][0x0],'fax':_0x1737bd['body']['to'][0x0],'ListId':_0x15773e[_0xfbca('0xad')]}));}}else{throw new Error(_0xfbca('0xae'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xfbca('0x1e')](function(_0x1a5fc0){if(_0x1a5fc0){return db['FaxInteraction'][_0xfbca('0x57')]({'where':{'ContactId':_0x1a5fc0['id'],'closed':![],'FaxAccountId':_0x15773e['id']}})[_0xfbca('0x1e')](function(_0x1b118e){if(_0x1b118e){return[_0x1b118e,![]];}return db['FaxInteraction'][_0xfbca('0x58')]({'UserId':_0x1737bd[_0xfbca('0x59')]['id'],'ContactId':_0x1a5fc0['id'],'FaxAccountId':_0x15773e['id'],'fax':_0x1737bd[_0xfbca('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xfbca('0x4f')](_0x1737bd[_0xfbca('0x60')],{'read':![],'body':_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][0x0][_0xfbca('0xaf')],'FaxAccountId':_0x15773e['id'],'UserId':_0x1737bd[_0xfbca('0x59')]['id'],'ContactId':_0x1a5fc0['id'],'AttachmentId':_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][0x0]['id']})]},{'include':[{'model':db[_0xfbca('0x9b')],'as':_0xfbca('0xb0')}]})[_0xfbca('0x1e')](function(_0x516b8a){return[_0x516b8a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xfbca('0xb1')](function(_0x100fce,_0x44b064){if(_0x44b064){return _0x100fce;}return db[_0xfbca('0x9b')][_0xfbca('0x58')]({'direction':_0xfbca('0xb2'),'read':![],'body':_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][0x0]['filename'],'FaxAccountId':_0x15773e['id'],'FaxInteractionId':_0x100fce['id'],'UserId':_0x1737bd[_0xfbca('0x59')]['id'],'ContactId':_0x100fce[_0xfbca('0xb3')],'AttachmentId':_0x1737bd[_0xfbca('0x60')]['attachments'][0x0]['id']})['then'](function(_0x48dce8){_0x100fce[_0xfbca('0xb4')]['Messages']=[];_0x100fce[_0xfbca('0xb4')][_0xfbca('0xb0')][_0xfbca('0x88')](_0x48dce8['dataValues']);return _0x100fce;});})[_0xfbca('0x1e')](function(_0x257341){respondWithRpcPromise(_0xfbca('0xb5'),'SendFax',{'FaxAccountId':_['isNil'](_0x1737bd[_0xfbca('0x56')]['id'])?undefined:_0x1737bd[_0xfbca('0x56')]['id'],'path':_[_0xfbca('0xa6')](_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][0x0][_0xfbca('0x4')])?undefined:_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][0x0][_0xfbca('0x4')],'fax':_['isNil'](_0x1737bd['body']['to'][0x0])?undefined:_0x1737bd['body']['to'][0x0],'AttachmentId':_0x1737bd[_0xfbca('0x60')][_0xfbca('0xa2')][0x0]['id']},client9002)['then'](function(_0x2d22cf){logger['info'](_0xfbca('0xb6'),_0x2d22cf);})[_0xfbca('0x55')](function(_0x2bc839){logger[_0xfbca('0x25')](_0xfbca('0xb6'),_0x2bc839);});return _0x257341;})['then'](respondWithResult(_0x24f759,null))[_0xfbca('0x55')](handleError(_0x24f759,null));};exports['addAgents']=function(_0x1bc7fe,_0x5213d7,_0xd605fd){return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x1bc7fe['params']['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x5213d7,null))[_0xfbca('0x1e')](function(_0x2a0cd7){if(_0x2a0cd7){return _0x2a0cd7[_0xfbca('0xb7')](_0x1bc7fe['body']['ids'],_[_0xfbca('0x97')](_0x1bc7fe['body'],[_0xfbca('0x68'),'id'])||{})[_0xfbca('0xb1')](function(_0x5e0972){for(var _0x48bac3=0x0;_0x48bac3<_0x1bc7fe['body']['ids'][_0xfbca('0x46')];_0x48bac3+=0x1){socket[_0xfbca('0xb8')](_0xfbca('0xb9'),{'UserId':Number(_0x1bc7fe[_0xfbca('0x60')][_0xfbca('0x68')][_0x48bac3]),'FaxAccountId':Number(_0x1bc7fe['params']['id'])});}return _0x5e0972;});}})[_0xfbca('0x1e')](respondWithResult(_0x5213d7,null))[_0xfbca('0x55')](handleError(_0x5213d7,null));};exports[_0xfbca('0xba')]=function(_0x3a6074,_0x40bfe1,_0x2316cc){return db[_0xfbca('0x3b')][_0xfbca('0x57')]({'where':{'id':_0x3a6074[_0xfbca('0x56')]['id']}})[_0xfbca('0x1e')](handleEntityNotFound(_0x40bfe1,null))[_0xfbca('0x1e')](function(_0x178d83){if(_0x178d83){return _0x178d83[_0xfbca('0xba')](_0x3a6074['query'][_0xfbca('0x68')])[_0xfbca('0x1e')](function(){if(_[_0xfbca('0xbb')](_0x3a6074[_0xfbca('0x41')][_0xfbca('0x68')])){for(var _0x2c5583=0x0;_0x2c5583<_0x3a6074[_0xfbca('0x41')][_0xfbca('0x68')][_0xfbca('0x46')];_0x2c5583+=0x1){socket[_0xfbca('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0x3a6074[_0xfbca('0x41')]['ids'][_0x2c5583]),'FaxAccountId':Number(_0x3a6074[_0xfbca('0x56')]['id'])});}}else{socket[_0xfbca('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0x3a6074['query'][_0xfbca('0x68')]),'FaxAccountId':Number(_0x3a6074[_0xfbca('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x40bfe1,null))['catch'](handleError(_0x40bfe1,null));};exports[_0xfbca('0xbc')]=function(_0x521339,_0x32cbd8,_0x323566){var _0x2d4716={};var _0x54aab4={};var _0x1d60e2;var _0x2af1e4;return db[_0xfbca('0x3b')]['findOne']({'where':{'id':_0x521339['params']['id']}})['then'](handleEntityNotFound(_0x32cbd8,null))[_0xfbca('0x1e')](function(_0x5a0970){if(_0x5a0970){_0x1d60e2=_0x5a0970;_0x54aab4[_0xfbca('0x40')]=_[_0xfbca('0x42')](db['User'][_0xfbca('0x3c')]);_0x54aab4[_0xfbca('0x41')]=_[_0xfbca('0x42')](_0x521339[_0xfbca('0x41')]);_0x54aab4[_0xfbca('0x4b')]=_[_0xfbca('0x44')](_0x54aab4[_0xfbca('0x40')],_0x54aab4[_0xfbca('0x41')]);_0x2d4716['attributes']=_[_0xfbca('0x44')](_0x54aab4['model'],qs[_0xfbca('0x45')](_0x521339['query']['fields']));_0x2d4716[_0xfbca('0x43')]=_0x2d4716[_0xfbca('0x43')][_0xfbca('0x46')]?_0x2d4716[_0xfbca('0x43')]:_0x54aab4[_0xfbca('0x40')];_0x2d4716[_0xfbca('0x49')]=qs[_0xfbca('0x4a')](_0x521339[_0xfbca('0x41')]['sort']);_0x2d4716[_0xfbca('0x4e')]=qs[_0xfbca('0x4b')](_[_0xfbca('0x4c')](_0x521339[_0xfbca('0x41')],_0x54aab4[_0xfbca('0x4b')]));if(_0x521339['query'][_0xfbca('0x4d')]){_0x2d4716[_0xfbca('0x4e')]=_[_0xfbca('0x4f')](_0x2d4716[_0xfbca('0x4e')],{'$or':_[_0xfbca('0x3a')](_0x2d4716[_0xfbca('0x43')],function(_0x4483ac){var _0x124e61={};_0x124e61[_0x4483ac]={'$like':'%'+_0x521339['query'][_0xfbca('0x4d')]+'%'};return _0x124e61;})});}_0x2d4716=_[_0xfbca('0x4f')]({},_0x2d4716,_0x521339[_0xfbca('0x51')]);return _0x1d60e2[_0xfbca('0xbc')](_0x2d4716);}})['then'](function(_0x2ef97a){if(_0x2ef97a){_0x2af1e4=_0x2ef97a[_0xfbca('0x46')];if(!_0x521339['query'][_0xfbca('0x47')](_0xfbca('0x48'))){_0x2d4716['limit']=qs[_0xfbca('0x2c')](_0x521339[_0xfbca('0x41')][_0xfbca('0x2c')]);_0x2d4716[_0xfbca('0x2b')]=qs[_0xfbca('0x2b')](_0x521339['query'][_0xfbca('0x2b')]);}return _0x1d60e2[_0xfbca('0xbc')](_0x2d4716);}})[_0xfbca('0x1e')](function(_0x5af93f){if(_0x5af93f){return _0x5af93f?{'count':_0x2af1e4,'rows':_0x5af93f}:null;}})[_0xfbca('0x1e')](respondWithResult(_0x32cbd8,null))['catch'](handleError(_0x32cbd8,null));}; \ No newline at end of file +var _0xadc2=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','find','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','sendStatus','getApplications','context','from-voip-provider','app','system','Fax\x20Extension','priority','appdata','push','Answer','Set','ecm','localstationid','gateway','headerinfo','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','VoiceExtension','updateAccountApplications','bulkCreate','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','FaxMessage','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List','CmContact','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','FaxAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0xadc2,0x65));var _0x2adc=function(_0x40e5d9,_0x2efa59){_0x40e5d9=_0x40e5d9-0x0;var _0x683a15=_0xadc2[_0x40e5d9];return _0x683a15;};'use strict';var emlformat=require(_0x2adc('0x0'));var rimraf=require(_0x2adc('0x1'));var zipdir=require(_0x2adc('0x2'));var jsonpatch=require(_0x2adc('0x3'));var rp=require(_0x2adc('0x4'));var moment=require(_0x2adc('0x5'));var BPromise=require(_0x2adc('0x6'));var Mustache=require('mustache');var util=require(_0x2adc('0x7'));var path=require(_0x2adc('0x8'));var sox=require('sox');var csv=require(_0x2adc('0x9'));var ejs=require(_0x2adc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2adc('0xb'));var squel=require(_0x2adc('0xc'));var crypto=require(_0x2adc('0xd'));var jsforce=require(_0x2adc('0xe'));var deskjs=require(_0x2adc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2adc('0x10'));var Papa=require(_0x2adc('0x11'));var Redis=require('ioredis');var authService=require(_0x2adc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2adc('0x13'));var hardwareService=require(_0x2adc('0x14'));var logger=require(_0x2adc('0x15'))(_0x2adc('0x16'));var utils=require('../../config/utils');var config=require(_0x2adc('0x17'));var licenseUtil=require(_0x2adc('0x18'));var db=require('../../mysqldb')['db'];config[_0x2adc('0x19')]=_[_0x2adc('0x1a')](config[_0x2adc('0x19')],{'host':_0x2adc('0x1b'),'port':0x18eb});var socket=require(_0x2adc('0x1c'))(new Redis(config[_0x2adc('0x19')]));require(_0x2adc('0x1d'))[_0x2adc('0x1e')](socket);var jayson=require(_0x2adc('0x1f'));var client=jayson[_0x2adc('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x2adc('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x311af5,_0x2c1be6,_0x119fe0,_0x2f4274){return new BPromise(function(_0x5f6068,_0x216adb){var _0x10388e=_0x2f4274||client;return _0x10388e['request'](_0x311af5,_0x119fe0)[_0x2adc('0x21')](function(_0x4e274e){logger[_0x2adc('0x22')]('FaxAccount,\x20%s,\x20%s',_0x2c1be6,_0x2adc('0x23'));logger[_0x2adc('0x24')](_0x2adc('0x25'),_0x2c1be6,_0x2adc('0x23'),JSON[_0x2adc('0x26')](_0x4e274e));if(_0x4e274e[_0x2adc('0x27')]){if(_0x4e274e['error'][_0x2adc('0x28')]===0x1f4){logger['error'](_0x2adc('0x29'),_0x2c1be6,_0x4e274e['error'][_0x2adc('0x2a')]);return _0x216adb(_0x4e274e['error'][_0x2adc('0x2a')]);}logger[_0x2adc('0x27')](_0x2adc('0x29'),_0x2c1be6,_0x4e274e[_0x2adc('0x27')][_0x2adc('0x2a')]);return _0x5f6068(_0x4e274e[_0x2adc('0x27')][_0x2adc('0x2a')]);}else{logger[_0x2adc('0x22')](_0x2adc('0x29'),_0x2c1be6,_0x2adc('0x23'));_0x5f6068(_0x4e274e[_0x2adc('0x2b')][_0x2adc('0x2a')]);}})[_0x2adc('0x2c')](function(_0x154ff0){logger[_0x2adc('0x27')](_0x2adc('0x29'),_0x2c1be6,_0x154ff0);_0x216adb(_0x154ff0);});});}function respondWithStatusCode(_0x1a653b,_0x2c8914){_0x2c8914=_0x2c8914||0xcc;return function(_0x2741a3){if(_0x2741a3){return _0x1a653b['sendStatus'](_0x2c8914);}return _0x1a653b['status'](_0x2c8914)[_0x2adc('0x2d')]();};}function respondWithResult(_0x352913,_0x5433a2){_0x5433a2=_0x5433a2||0xc8;return function(_0x5df6b2){if(_0x5df6b2){return _0x352913[_0x2adc('0x2e')](_0x5433a2)[_0x2adc('0x2f')](_0x5df6b2);}};}function respondWithFilteredResult(_0x154f8e,_0x16e85d){return function(_0x3236a6){if(_0x3236a6){var _0x54932b=typeof _0x16e85d[_0x2adc('0x30')]===_0x2adc('0x31')&&typeof _0x16e85d['limit']===_0x2adc('0x31');var _0x168c75=_0x3236a6['count'];var _0x33e7b8=_0x54932b?0x0:_0x16e85d[_0x2adc('0x30')];var _0x5d7342=_0x54932b?_0x3236a6[_0x2adc('0x32')]:_0x16e85d[_0x2adc('0x30')]+_0x16e85d[_0x2adc('0x33')];var _0x5e2dfb;if(_0x5d7342>=_0x168c75){_0x5d7342=_0x168c75;_0x5e2dfb=0xc8;}else{_0x5e2dfb=0xce;}_0x154f8e[_0x2adc('0x2e')](_0x5e2dfb);return _0x154f8e[_0x2adc('0x34')](_0x2adc('0x35'),_0x33e7b8+'-'+_0x5d7342+'/'+_0x168c75)[_0x2adc('0x2f')](_0x3236a6);}return null;};}function patchUpdates(_0x45fd6b){return function(_0xa593d0){try{jsonpatch[_0x2adc('0x36')](_0xa593d0,_0x45fd6b,!![]);}catch(_0xac0bfd){return BPromise[_0x2adc('0x37')](_0xac0bfd);}return _0xa593d0[_0x2adc('0x38')]();};}function saveUpdates(_0x4240b2,_0x1e1c22){return function(_0x3a433d){if(_0x3a433d){return _0x3a433d['update'](_0x4240b2)[_0x2adc('0x21')](function(_0x1c849e){return _0x1c849e;});}return null;};}function removeEntity(_0x8527cf,_0x5906c0){return function(_0x40f56c){if(_0x40f56c){return _0x40f56c[_0x2adc('0x39')]()['then'](function(){var _0x800aa0=_0x40f56c['get']({'plain':!![]});var _0x1f2956=_0x2adc('0x3a');return db[_0x2adc('0x3b')][_0x2adc('0x39')]({'where':{'type':_0x1f2956,'resourceId':_0x800aa0['id']}})[_0x2adc('0x21')](function(){return _0x40f56c;});})[_0x2adc('0x21')](function(){_0x8527cf[_0x2adc('0x2e')](0xcc)[_0x2adc('0x2d')]();});}};}function handleEntityNotFound(_0x483575,_0xa5f159){return function(_0x2ffd35){if(!_0x2ffd35){_0x483575['sendStatus'](0x194);}return _0x2ffd35;};}function handleError(_0x3a8fe7,_0x8bb8ca){_0x8bb8ca=_0x8bb8ca||0x1f4;return function(_0x93b3f4){logger[_0x2adc('0x27')](_0x93b3f4[_0x2adc('0x3c')]);if(_0x93b3f4[_0x2adc('0x3d')]){delete _0x93b3f4['name'];}_0x3a8fe7['status'](_0x8bb8ca)[_0x2adc('0x3e')](_0x93b3f4);};}exports['index']=function(_0x3e0fcd,_0x5a09ae){var _0x29607c={'include':[{'model':db['Pause'],'as':_0x2adc('0x3f')}]},_0x345e9f={},_0x20b6a4={'count':0x0,'rows':[]};var _0x643485=_[_0x2adc('0x40')](db[_0x2adc('0x41')][_0x2adc('0x42')],function(_0x53d31a){return{'name':_0x53d31a[_0x2adc('0x43')],'type':_0x53d31a[_0x2adc('0x44')][_0x2adc('0x45')]};});_0x345e9f[_0x2adc('0x46')]=_[_0x2adc('0x40')](_0x643485,_0x2adc('0x3d'));_0x345e9f['query']=_[_0x2adc('0x47')](_0x3e0fcd[_0x2adc('0x48')]);_0x345e9f[_0x2adc('0x49')]=_[_0x2adc('0x4a')](_0x345e9f['model'],_0x345e9f[_0x2adc('0x48')]);_0x29607c['attributes']=_['intersection'](_0x345e9f[_0x2adc('0x46')],qs[_0x2adc('0x4b')](_0x3e0fcd[_0x2adc('0x48')]['fields']));_0x29607c['attributes']=_0x29607c[_0x2adc('0x4c')][_0x2adc('0x4d')]?_0x29607c[_0x2adc('0x4c')]:_0x345e9f[_0x2adc('0x46')];if(!_0x3e0fcd['query'][_0x2adc('0x4e')]('nolimit')){_0x29607c[_0x2adc('0x33')]=qs[_0x2adc('0x33')](_0x3e0fcd[_0x2adc('0x48')][_0x2adc('0x33')]);_0x29607c['offset']=qs['offset'](_0x3e0fcd[_0x2adc('0x48')][_0x2adc('0x30')]);}_0x29607c[_0x2adc('0x4f')]=qs[_0x2adc('0x50')](_0x3e0fcd[_0x2adc('0x48')][_0x2adc('0x50')]);_0x29607c['where']=qs['filters'](_['pick'](_0x3e0fcd['query'],_0x345e9f['filters']),_0x643485);if(_0x3e0fcd[_0x2adc('0x48')][_0x2adc('0x51')]){_0x29607c[_0x2adc('0x52')]=_[_0x2adc('0x53')](_0x29607c[_0x2adc('0x52')],{'$or':_[_0x2adc('0x40')](_0x643485,function(_0x51ef47){if(_0x51ef47['type']!==_0x2adc('0x54')){var _0x4c215e={};_0x4c215e[_0x51ef47['name']]={'$like':'%'+_0x3e0fcd['query'][_0x2adc('0x51')]+'%'};return _0x4c215e;}})});}_0x29607c=_[_0x2adc('0x53')]({},_0x29607c,_0x3e0fcd[_0x2adc('0x55')]);var _0x1d7e28={'where':_0x29607c[_0x2adc('0x52')]};return db[_0x2adc('0x41')][_0x2adc('0x32')](_0x1d7e28)[_0x2adc('0x21')](function(_0x283450){_0x20b6a4['count']=_0x283450;if(_0x3e0fcd['query'][_0x2adc('0x56')]){_0x29607c[_0x2adc('0x57')]=[{'all':!![]}];}return db[_0x2adc('0x41')][_0x2adc('0x58')](_0x29607c);})[_0x2adc('0x21')](function(_0x833aef){_0x20b6a4[_0x2adc('0x59')]=_0x833aef;return _0x20b6a4;})[_0x2adc('0x21')](respondWithFilteredResult(_0x5a09ae,_0x29607c))['catch'](handleError(_0x5a09ae,null));};exports[_0x2adc('0x5a')]=function(_0x433354,_0x56e2b9){var _0x1101ff={'raw':![],'where':{'id':_0x433354[_0x2adc('0x5b')]['id']},'include':[{'model':db[_0x2adc('0x5c')],'as':'mandatoryDispositionPause'}]},_0x5c39e4={};_0x5c39e4[_0x2adc('0x46')]=_[_0x2adc('0x47')](db['FaxAccount'][_0x2adc('0x42')]);_0x5c39e4[_0x2adc('0x48')]=_['keys'](_0x433354[_0x2adc('0x48')]);_0x5c39e4[_0x2adc('0x49')]=_[_0x2adc('0x4a')](_0x5c39e4[_0x2adc('0x46')],_0x5c39e4[_0x2adc('0x48')]);_0x1101ff[_0x2adc('0x4c')]=_[_0x2adc('0x4a')](_0x5c39e4[_0x2adc('0x46')],qs[_0x2adc('0x4b')](_0x433354[_0x2adc('0x48')][_0x2adc('0x4b')]));_0x1101ff[_0x2adc('0x4c')]=_0x1101ff['attributes'][_0x2adc('0x4d')]?_0x1101ff[_0x2adc('0x4c')]:_0x5c39e4[_0x2adc('0x46')];if(_0x433354['query'][_0x2adc('0x56')]){_0x1101ff[_0x2adc('0x57')]=[{'all':!![]}];}_0x1101ff=_[_0x2adc('0x53')]({},_0x1101ff,_0x433354[_0x2adc('0x55')]);return db[_0x2adc('0x41')]['find'](_0x1101ff)[_0x2adc('0x21')](handleEntityNotFound(_0x56e2b9,null))[_0x2adc('0x21')](respondWithResult(_0x56e2b9,null))['catch'](handleError(_0x56e2b9,null));};exports[_0x2adc('0x5d')]=function(_0x1d6efd,_0x10b192){return db[_0x2adc('0x41')][_0x2adc('0x5d')](_0x1d6efd[_0x2adc('0x5e')],{})['then'](function(_0x3da57c){var _0x1f65c0=_0x1d6efd['user'][_0x2adc('0x5f')]({'plain':!![]});if(!_0x1f65c0)throw new Error(_0x2adc('0x60'));if(_0x1f65c0['role']===_0x2adc('0x61')){var _0x141093=_0x3da57c[_0x2adc('0x5f')]({'plain':!![]});var _0xbeaffd=_0x2adc('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0xbeaffd,'userProfileId':_0x1f65c0['userProfileId']},'raw':!![]})[_0x2adc('0x21')](function(_0x29a2ba){if(_0x29a2ba&&_0x29a2ba[_0x2adc('0x62')]===0x0){return db[_0x2adc('0x3b')][_0x2adc('0x5d')]({'name':_0x141093['name'],'resourceId':_0x141093['id'],'type':_0x29a2ba[_0x2adc('0x3d')],'sectionId':_0x29a2ba['id']},{})[_0x2adc('0x21')](function(){return _0x3da57c;});}else{return _0x3da57c;}})[_0x2adc('0x2c')](function(_0x349a22){logger[_0x2adc('0x27')](_0x2adc('0x63'),_0x349a22);throw _0x349a22;});}return _0x3da57c;})[_0x2adc('0x21')](respondWithResult(_0x10b192,0xc9))['catch'](handleError(_0x10b192,null));};exports[_0x2adc('0x64')]=function(_0x1596ae,_0x5a6f91){if(_0x1596ae[_0x2adc('0x5e')]['id']){delete _0x1596ae[_0x2adc('0x5e')]['id'];}return db[_0x2adc('0x41')]['find']({'where':{'id':_0x1596ae[_0x2adc('0x5b')]['id']},'include':[{'model':db[_0x2adc('0x5c')],'as':_0x2adc('0x3f')}]})[_0x2adc('0x21')](handleEntityNotFound(_0x5a6f91,null))[_0x2adc('0x21')](saveUpdates(_0x1596ae[_0x2adc('0x5e')],null))[_0x2adc('0x21')](respondWithResult(_0x5a6f91,null))['catch'](handleError(_0x5a6f91,null));};exports[_0x2adc('0x39')]=function(_0x51801c,_0x3acdf0){return db[_0x2adc('0x41')]['find']({'where':{'id':_0x51801c[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x3acdf0,null))[_0x2adc('0x21')](removeEntity(_0x3acdf0,null))[_0x2adc('0x2c')](handleError(_0x3acdf0,null));};exports[_0x2adc('0x65')]=function(_0x50bb07,_0x311eb5){return db['FaxAccount'][_0x2adc('0x65')]()['then'](respondWithResult(_0x311eb5,null))[_0x2adc('0x2c')](handleError(_0x311eb5,null));};exports[_0x2adc('0x66')]=function(_0x55c96a,_0x26b62e,_0x470b4c){if(_0x55c96a[_0x2adc('0x5e')]['id']){delete _0x55c96a[_0x2adc('0x5e')]['id'];}return db[_0x2adc('0x41')]['find']({'where':{'id':_0x55c96a[_0x2adc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x26b62e,null))[_0x2adc('0x21')](function(_0x56eb29){if(_0x56eb29){_0x55c96a[_0x2adc('0x5e')][_0x2adc('0x67')]=_0x56eb29['id'];return db[_0x2adc('0x68')][_0x2adc('0x5d')](_0x55c96a[_0x2adc('0x5e')]);}})[_0x2adc('0x21')](respondWithResult(_0x26b62e,null))[_0x2adc('0x2c')](handleError(_0x26b62e,null));};exports[_0x2adc('0x69')]=function(_0x2a217e,_0x1d6269,_0x342fa5){var _0x17254f={'raw':![],'where':{}};var _0x593eae={};var _0x26c16b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2adc('0x6a')]({'where':{'id':_0x2a217e[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x1d6269,null))[_0x2adc('0x21')](function(_0x1d7def){if(_0x1d7def){_0x593eae[_0x2adc('0x46')]=_[_0x2adc('0x47')](db[_0x2adc('0x68')]['rawAttributes']);_0x593eae[_0x2adc('0x48')]=_[_0x2adc('0x47')](_0x2a217e[_0x2adc('0x48')]);_0x593eae[_0x2adc('0x49')]=_['intersection'](_0x593eae[_0x2adc('0x46')],_0x593eae[_0x2adc('0x48')]);_0x17254f['attributes']=_[_0x2adc('0x4a')](_0x593eae[_0x2adc('0x46')],qs['fields'](_0x2a217e[_0x2adc('0x48')][_0x2adc('0x4b')]));_0x17254f[_0x2adc('0x4c')]=_0x17254f['attributes'][_0x2adc('0x4d')]?_0x17254f['attributes']:_0x593eae[_0x2adc('0x46')];if(!_0x2a217e[_0x2adc('0x48')][_0x2adc('0x4e')]('nolimit')){_0x17254f['limit']=qs[_0x2adc('0x33')](_0x2a217e['query'][_0x2adc('0x33')]);_0x17254f[_0x2adc('0x30')]=qs[_0x2adc('0x30')](_0x2a217e[_0x2adc('0x48')][_0x2adc('0x30')]);}_0x17254f['order']=qs['sort'](_0x2a217e[_0x2adc('0x48')][_0x2adc('0x50')]);_0x17254f['where']=qs[_0x2adc('0x49')](_[_0x2adc('0x6b')](_0x2a217e[_0x2adc('0x48')],_0x593eae['filters']));_0x17254f[_0x2adc('0x52')][_0x2adc('0x67')]=_0x1d7def['id'];if(_0x2a217e[_0x2adc('0x48')][_0x2adc('0x51')]){_0x17254f[_0x2adc('0x52')]=_[_0x2adc('0x53')](_0x17254f[_0x2adc('0x52')],{'$or':_[_0x2adc('0x40')](_0x17254f[_0x2adc('0x4c')],function(_0x5bf014){var _0x2724c8={};_0x2724c8[_0x5bf014]={'$like':'%'+_0x2a217e[_0x2adc('0x48')][_0x2adc('0x51')]+'%'};return _0x2724c8;})});}_0x17254f=_['merge']({},_0x17254f,_0x2a217e[_0x2adc('0x55')]);return db['Disposition'][_0x2adc('0x32')]({'where':_0x17254f[_0x2adc('0x52')]})[_0x2adc('0x21')](function(_0x2ff144){_0x26c16b['count']=_0x2ff144;if(_0x2a217e[_0x2adc('0x48')][_0x2adc('0x56')]){_0x17254f[_0x2adc('0x57')]=[{'all':!![]}];}return db[_0x2adc('0x68')]['findAll'](_0x17254f);})[_0x2adc('0x21')](function(_0x48b479){_0x26c16b[_0x2adc('0x59')]=_0x48b479;return _0x26c16b;});}})['then'](respondWithFilteredResult(_0x1d6269,_0x17254f))[_0x2adc('0x2c')](handleError(_0x1d6269,null));};exports['removeDispositions']=function(_0x115118,_0x25fe20,_0x123e9b){return db[_0x2adc('0x41')][_0x2adc('0x6c')]({'where':{'id':_0x115118[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x25fe20,null))[_0x2adc('0x21')](function(_0x181cf5){if(_0x181cf5){return _0x181cf5[_0x2adc('0x6d')](_0x115118['query'][_0x2adc('0x6e')]);}})['then'](respondWithStatusCode(_0x25fe20,null))[_0x2adc('0x2c')](handleError(_0x25fe20,null));};exports[_0x2adc('0x6f')]=function(_0x2d429a,_0x34e7f5,_0x2a1c4e){if(_0x2d429a['body']['id']){delete _0x2d429a[_0x2adc('0x5e')]['id'];}return db[_0x2adc('0x41')][_0x2adc('0x6c')]({'where':{'id':_0x2d429a[_0x2adc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x34e7f5,null))[_0x2adc('0x21')](function(_0xecfcb0){if(_0xecfcb0){_0x2d429a[_0x2adc('0x5e')][_0x2adc('0x67')]=_0xecfcb0['id'];return db['CannedAnswer']['create'](_0x2d429a[_0x2adc('0x5e')]);}})['then'](respondWithResult(_0x34e7f5,null))[_0x2adc('0x2c')](handleError(_0x34e7f5,null));};exports[_0x2adc('0x70')]=function(_0x5f28d3,_0x40f369,_0x36132f){var _0x1f141c={'raw':![],'where':{}};var _0x34ec8d={};var _0x1d0a37={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2adc('0x6a')]({'where':{'id':_0x5f28d3[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x40f369,null))[_0x2adc('0x21')](function(_0x48c743){if(_0x48c743){_0x34ec8d[_0x2adc('0x46')]=_[_0x2adc('0x47')](db[_0x2adc('0x71')][_0x2adc('0x42')]);_0x34ec8d[_0x2adc('0x48')]=_['keys'](_0x5f28d3[_0x2adc('0x48')]);_0x34ec8d[_0x2adc('0x49')]=_['intersection'](_0x34ec8d[_0x2adc('0x46')],_0x34ec8d[_0x2adc('0x48')]);_0x1f141c[_0x2adc('0x4c')]=_['intersection'](_0x34ec8d[_0x2adc('0x46')],qs[_0x2adc('0x4b')](_0x5f28d3[_0x2adc('0x48')][_0x2adc('0x4b')]));_0x1f141c[_0x2adc('0x4c')]=_0x1f141c['attributes'][_0x2adc('0x4d')]?_0x1f141c[_0x2adc('0x4c')]:_0x34ec8d['model'];if(!_0x5f28d3[_0x2adc('0x48')][_0x2adc('0x4e')]('nolimit')){_0x1f141c['limit']=qs[_0x2adc('0x33')](_0x5f28d3['query'][_0x2adc('0x33')]);_0x1f141c['offset']=qs[_0x2adc('0x30')](_0x5f28d3[_0x2adc('0x48')][_0x2adc('0x30')]);}_0x1f141c[_0x2adc('0x4f')]=qs[_0x2adc('0x50')](_0x5f28d3['query'][_0x2adc('0x50')]);_0x1f141c[_0x2adc('0x52')]=qs[_0x2adc('0x49')](_[_0x2adc('0x6b')](_0x5f28d3[_0x2adc('0x48')],_0x34ec8d['filters']));_0x1f141c['where'][_0x2adc('0x67')]=_0x48c743['id'];if(_0x5f28d3[_0x2adc('0x48')]['filter']){_0x1f141c['where']=_[_0x2adc('0x53')](_0x1f141c[_0x2adc('0x52')],{'$or':_['map'](_0x1f141c[_0x2adc('0x4c')],function(_0x11a28a){var _0xf1f371={};_0xf1f371[_0x11a28a]={'$like':'%'+_0x5f28d3[_0x2adc('0x48')][_0x2adc('0x51')]+'%'};return _0xf1f371;})});}_0x1f141c=_[_0x2adc('0x53')]({},_0x1f141c,_0x5f28d3[_0x2adc('0x55')]);return db['CannedAnswer']['count']({'where':_0x1f141c[_0x2adc('0x52')]})[_0x2adc('0x21')](function(_0x566739){_0x1d0a37[_0x2adc('0x32')]=_0x566739;if(_0x5f28d3[_0x2adc('0x48')]['includeAll']){_0x1f141c[_0x2adc('0x57')]=[{'all':!![]}];}return db[_0x2adc('0x71')][_0x2adc('0x58')](_0x1f141c);})['then'](function(_0x3be69e){_0x1d0a37[_0x2adc('0x59')]=_0x3be69e;return _0x1d0a37;});}})[_0x2adc('0x21')](respondWithFilteredResult(_0x40f369,_0x1f141c))[_0x2adc('0x2c')](handleError(_0x40f369,null));};exports[_0x2adc('0x72')]=function(_0x2e1b8c,_0x133d91,_0x2f2476){return db[_0x2adc('0x41')][_0x2adc('0x6c')]({'where':{'id':_0x2e1b8c[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x133d91,null))['then'](function(_0x1a53ff){if(_0x1a53ff){return _0x1a53ff[_0x2adc('0x72')](_0x2e1b8c['query']['ids']);}})['then'](respondWithStatusCode(_0x133d91,null))['catch'](handleError(_0x133d91,null));};exports[_0x2adc('0x73')]=function(_0x1bb5b4,_0xcd95cd,_0xb0ec3){return db[_0x2adc('0x74')][_0x2adc('0x6c')]({'where':{'id':_0x1bb5b4[_0x2adc('0x5b')]['id']}})['then'](handleEntityNotFound(_0xcd95cd,null))[_0x2adc('0x21')](function(_0x2cd15f){if(_0x2cd15f){return _0x2cd15f[_0x2adc('0x73')](_0x1bb5b4[_0x2adc('0x5e')][_0x2adc('0x6e')],_['omit'](_0x1bb5b4[_0x2adc('0x5e')],[_0x2adc('0x6e'),'id'])||{});}})[_0x2adc('0x21')](respondWithResult(_0xcd95cd,null))[_0x2adc('0x2c')](handleError(_0xcd95cd,null));};exports['getInteractions']=function(_0x413a10,_0x3ccc02,_0x31b2f0){var _0x3c1675={'raw':![],'where':{}};var _0x4b17d1={};var _0x480223={'count':0x0,'rows':[]};return db[_0x2adc('0x41')][_0x2adc('0x6a')]({'where':{'id':_0x413a10[_0x2adc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3ccc02,null))[_0x2adc('0x21')](function(_0x4533ca){if(_0x4533ca){_0x4b17d1[_0x2adc('0x46')]=_['keys'](db[_0x2adc('0x74')][_0x2adc('0x42')]);_0x4b17d1['query']=_[_0x2adc('0x47')](_0x413a10['query']);_0x4b17d1[_0x2adc('0x49')]=_[_0x2adc('0x4a')](_0x4b17d1[_0x2adc('0x46')],_0x4b17d1[_0x2adc('0x48')]);_0x3c1675[_0x2adc('0x4c')]=_['intersection'](_0x4b17d1[_0x2adc('0x46')],qs['fields'](_0x413a10[_0x2adc('0x48')]['fields']));_0x3c1675['attributes']=_0x3c1675[_0x2adc('0x4c')][_0x2adc('0x4d')]?_0x3c1675[_0x2adc('0x4c')]:_0x4b17d1[_0x2adc('0x46')];if(!_0x413a10['query']['hasOwnProperty']('nolimit')){_0x3c1675['limit']=qs['limit'](_0x413a10[_0x2adc('0x48')][_0x2adc('0x33')]);_0x3c1675[_0x2adc('0x30')]=qs[_0x2adc('0x30')](_0x413a10[_0x2adc('0x48')]['offset']);}_0x3c1675[_0x2adc('0x4f')]=qs[_0x2adc('0x50')](_0x413a10[_0x2adc('0x48')][_0x2adc('0x50')]);_0x3c1675[_0x2adc('0x52')]=qs[_0x2adc('0x49')](_[_0x2adc('0x6b')](_0x413a10[_0x2adc('0x48')],_0x4b17d1['filters']));_0x3c1675['where'][_0x2adc('0x67')]=_0x4533ca['id'];if(_0x413a10[_0x2adc('0x48')][_0x2adc('0x51')]){_0x3c1675[_0x2adc('0x52')]=_[_0x2adc('0x53')](_0x3c1675[_0x2adc('0x52')],{'$or':_[_0x2adc('0x40')](_0x3c1675['attributes'],function(_0x4aac7f){var _0x4baf7e={};_0x4baf7e[_0x4aac7f]={'$like':'%'+_0x413a10['query']['filter']+'%'};return _0x4baf7e;})});}_0x3c1675=_[_0x2adc('0x53')]({},_0x3c1675,_0x413a10[_0x2adc('0x55')]);return db[_0x2adc('0x74')]['count']({'where':_0x3c1675[_0x2adc('0x52')]})[_0x2adc('0x21')](function(_0x412431){_0x480223['count']=_0x412431;if(_0x413a10[_0x2adc('0x48')][_0x2adc('0x56')]){_0x3c1675[_0x2adc('0x57')]=[{'model':db['CmContact'],'as':_0x2adc('0x75'),'required':![]},{'model':db[_0x2adc('0x76')],'as':_0x2adc('0x77'),'attributes':[_0x2adc('0x3d'),_0x2adc('0x78'),_0x2adc('0x79')],'required':![]},{'model':db[_0x2adc('0x7a')],'as':'Tags','attributes':['id','name',_0x2adc('0x7b')],'where':_0x413a10['query'][_0x2adc('0x7c')]?{'id':_0x413a10['query'][_0x2adc('0x7c')]}:undefined,'required':_0x413a10[_0x2adc('0x48')][_0x2adc('0x7c')]?!![]:![]}];}return db[_0x2adc('0x74')][_0x2adc('0x58')](_0x3c1675);})[_0x2adc('0x21')](function(_0x40bc7a){_0x480223['rows']=_0x40bc7a;return _0x480223;});}})['then'](respondWithFilteredResult(_0x3ccc02,_0x3c1675))['catch'](handleError(_0x3ccc02,null));};exports[_0x2adc('0x7d')]=function(_0x1ae29a,_0x5e3287){var _0x5d3b16=_0x1ae29a['params']['id'];var _0x13ab3b=_0x1ae29a[_0x2adc('0x5e')];var _0x3a4d0b=0xc8;var _0x22f0ac=null;return db[_0x2adc('0x7e')][_0x2adc('0x7f')]({'isolationLevel':db[_0x2adc('0x7e')]['Transaction'][_0x2adc('0x80')][_0x2adc('0x81')]},function(_0x23fc0c){return db['FaxAccount'][_0x2adc('0x6a')]({'where':{'id':_0x5d3b16},'transaction':_0x23fc0c})[_0x2adc('0x21')](function(_0x3c5108){if(_0x3c5108){return db[_0x2adc('0x82')][_0x2adc('0x39')]({'where':{'FaxAccountId':_0x5d3b16},'transaction':_0x23fc0c})[_0x2adc('0x21')](function(){var _0x3ac65c=_[_0x2adc('0x40')](_0x13ab3b,function(_0x4946c8){_0x4946c8[_0x2adc('0x67')]=_0x5d3b16;return _0x4946c8;});return db[_0x2adc('0x82')]['bulkCreate'](_0x3ac65c,{'transaction':_0x23fc0c});});}else{_0x3a4d0b=0x194;_0x22f0ac=[];}});})[_0x2adc('0x21')](function(){if(_0x3a4d0b!==0x194){return db[_0x2adc('0x82')][_0x2adc('0x83')]({'where':{'FaxAccountId':_0x5d3b16},'order':'priority'})['then'](function(_0x220c22){_0x22f0ac=_0x220c22;});}})[_0x2adc('0x2c')](function(_0x4ceb51){_0x3a4d0b=0x1f4;logger[_0x2adc('0x27')](_0x4ceb51['stack']);if(_0x4ceb51[_0x2adc('0x3d')]){delete _0x4ceb51['name'];}_0x22f0ac=_0x4ceb51;})[_0x2adc('0x84')](function(){if(_0x22f0ac===null){_0x5e3287[_0x2adc('0x85')](_0x3a4d0b);}else{if(_0x3a4d0b===0x1f4){_0x5e3287['status'](_0x3a4d0b)[_0x2adc('0x3e')](_0x22f0ac);}else{_0x5e3287[_0x2adc('0x2e')](_0x3a4d0b)[_0x2adc('0x2f')](_0x22f0ac);}}});};exports[_0x2adc('0x86')]=function(_0x2094e4,_0x344ee7,_0x180a5e){var _0xa9f726={};var _0x2ff233={};var _0x14144a;var _0x46965e;return db[_0x2adc('0x41')][_0x2adc('0x6a')]({'where':{'id':_0x2094e4[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x344ee7,null))[_0x2adc('0x21')](function(_0x2d1809){if(_0x2d1809){_0x14144a=_0x2d1809;_0x2ff233[_0x2adc('0x46')]=_[_0x2adc('0x47')](db[_0x2adc('0x82')][_0x2adc('0x42')]);_0x2ff233[_0x2adc('0x48')]=_[_0x2adc('0x47')](_0x2094e4[_0x2adc('0x48')]);_0x2ff233[_0x2adc('0x49')]=_[_0x2adc('0x4a')](_0x2ff233[_0x2adc('0x46')],_0x2ff233[_0x2adc('0x48')]);_0xa9f726['attributes']=_[_0x2adc('0x4a')](_0x2ff233[_0x2adc('0x46')],qs['fields'](_0x2094e4['query']['fields']));_0xa9f726[_0x2adc('0x4c')]=_0xa9f726[_0x2adc('0x4c')][_0x2adc('0x4d')]?_0xa9f726['attributes']:_0x2ff233[_0x2adc('0x46')];_0xa9f726[_0x2adc('0x4f')]=qs['sort'](_0x2094e4[_0x2adc('0x48')][_0x2adc('0x50')]);_0xa9f726[_0x2adc('0x52')]=qs[_0x2adc('0x49')](_['pick'](_0x2094e4['query'],_0x2ff233[_0x2adc('0x49')]));if(_0x2094e4['query'][_0x2adc('0x51')]){_0xa9f726[_0x2adc('0x52')]=_[_0x2adc('0x53')](_0xa9f726[_0x2adc('0x52')],{'$or':_[_0x2adc('0x40')](_0xa9f726[_0x2adc('0x4c')],function(_0x171df1){var _0x3e3d22={};_0x3e3d22[_0x171df1]={'$like':'%'+_0x2094e4['query'][_0x2adc('0x51')]+'%'};return _0x3e3d22;})});}_0xa9f726=_['merge']({},_0xa9f726,_0x2094e4[_0x2adc('0x55')]);return _0x14144a['getApplications'](_0xa9f726);}})['then'](function(_0x312a05){if(_0x312a05){_0x46965e=_0x312a05['length'];if(!_0x2094e4[_0x2adc('0x48')][_0x2adc('0x4e')]('nolimit')){_0xa9f726[_0x2adc('0x33')]=qs[_0x2adc('0x33')](_0x2094e4[_0x2adc('0x48')]['limit']);_0xa9f726['offset']=qs['offset'](_0x2094e4[_0x2adc('0x48')][_0x2adc('0x30')]);}return _0x14144a['getApplications'](_0xa9f726);}})[_0x2adc('0x21')](function(_0x32758f){if(_0x32758f){return _0x32758f?{'count':_0x46965e,'rows':_0x32758f}:null;}})[_0x2adc('0x21')](respondWithResult(_0x344ee7,null))['catch'](handleError(_0x344ee7,null));};function Extension(_0x46e36b,_0x2c26a4,_0x2e3f14,_0x4d47b8){this[_0x2adc('0x87')]=_0x2adc('0x88');this['exten']=_0x46e36b['localstationid'];this[_0x2adc('0x89')]=_0x4d47b8;this[_0x2adc('0x44')]=_0x2adc('0x8a');this['description']=_0x2adc('0x8b');this[_0x2adc('0x67')]=_0x46e36b['id'];this[_0x2adc('0x8c')]=_0x2c26a4;this[_0x2adc('0x8d')]=_0x2e3f14;}function createExtensionsReciveFax(_0x2eb1b3){var _0xc41a3e=0x1;var _0x228ab2=[];_0x228ab2[_0x2adc('0x8e')](new Extension(_0x2eb1b3,_0xc41a3e,'',_0x2adc('0x8f')));_0xc41a3e+=0x1;_0x228ab2[_0x2adc('0x8e')](new Extension(_0x2eb1b3,_0xc41a3e,'CDR(type)=inbound-fax',_0x2adc('0x90')));_0xc41a3e+=0x1;for(var _0x105eaa in _0x2eb1b3){if(_0x2eb1b3[_0x2adc('0x4e')](_0x105eaa)&&(_0x105eaa===_0x2adc('0x91')||_0x105eaa===_0x2adc('0x92')||_0x105eaa===_0x2adc('0x93')||_0x105eaa==='faxdetect'||_0x105eaa===_0x2adc('0x94')||_0x105eaa==='maxrate'||_0x105eaa==='minrate'||_0x105eaa===_0x2adc('0x95')||_0x105eaa==='t38timeout')){_0x228ab2[_0x2adc('0x8e')](new Extension(_0x2eb1b3,_0xc41a3e,'FAXOPT('+_0x105eaa+')='+_0x2eb1b3[_0x105eaa],'Set'));_0xc41a3e+=0x1;}}_0x228ab2[_0x2adc('0x8e')](new Extension(_0x2eb1b3,_0xc41a3e,'6',_0x2adc('0x96')));_0xc41a3e+=0x1;_0x228ab2['push'](new Extension(_0x2eb1b3,_0xc41a3e,_0x2adc('0x97'),_0x2adc('0x98')));_0xc41a3e=0x0;return _0x228ab2;}exports['addAccountApplications']=function(_0x53cc9e,_0x1185f3,_0x41a9fc){var _0x5a5178;return db[_0x2adc('0x7e')][_0x2adc('0x7f')](function(_0x1a7ad1){return db[_0x2adc('0x41')][_0x2adc('0x5d')](_0x53cc9e['body'],{'transaction':_0x1a7ad1})[_0x2adc('0x21')](function(_0xf0a47b){_0x5a5178=_0xf0a47b['get']({'plain':!![]});return db[_0x2adc('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x5a5178),{'transaction':_0x1a7ad1});});})['then'](function(){return _0x5a5178;})[_0x2adc('0x21')](respondWithResult(_0x1185f3,null))[_0x2adc('0x2c')](handleError(_0x1185f3,null));};exports[_0x2adc('0x9a')]=function(_0x1c0f15,_0xd06cd0,_0x439e60){var _0x410225;return db[_0x2adc('0x7e')]['transaction'](function(_0x14b258){return db[_0x2adc('0x41')][_0x2adc('0x64')](_0x1c0f15[_0x2adc('0x5e')],{'where':{'id':_0x1c0f15[_0x2adc('0x5e')]['id']},'transaction':_0x14b258})[_0x2adc('0x21')](function(_0x3f63ba){return db['VoiceExtension'][_0x2adc('0x39')]({'where':{'FaxAccountId':_0x1c0f15[_0x2adc('0x5e')]['id']},'transaction':_0x14b258})[_0x2adc('0x21')](function(_0x182b95){return db[_0x2adc('0x99')][_0x2adc('0x9b')](createExtensionsReciveFax(_['omit'](_0x1c0f15[_0x2adc('0x5e')],['tech',_0x2adc('0x45'),_0x2adc('0x9c'),_0x2adc('0x9d'),_0x2adc('0x9e'),'ListId'])),{'transaction':_0x14b258});});});})['then'](function(){return db[_0x2adc('0x41')][_0x2adc('0x9f')](_0x1c0f15[_0x2adc('0x5e')]['id']);})['then'](respondWithResult(_0xd06cd0,null))[_0x2adc('0x2c')](handleError(_0xd06cd0,null));};exports[_0x2adc('0xa0')]=function(_0xd903a8,_0x7e56aa,_0x561a09){var _0x2e9a93={'raw':!![],'where':{}};var _0x8768f1={};var _0x45c91f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2adc('0x6a')]({'where':{'id':_0xd903a8['params']['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x7e56aa,null))[_0x2adc('0x21')](function(_0x4068d7){if(_0x4068d7){_0x8768f1[_0x2adc('0x46')]=_[_0x2adc('0x47')](db['FaxMessage']['rawAttributes']);_0x8768f1[_0x2adc('0x48')]=_['keys'](_0xd903a8[_0x2adc('0x48')]);_0x8768f1[_0x2adc('0x49')]=_[_0x2adc('0x4a')](_0x8768f1[_0x2adc('0x46')],_0x8768f1['query']);_0x2e9a93[_0x2adc('0x4c')]=_[_0x2adc('0x4a')](_0x8768f1[_0x2adc('0x46')],qs['fields'](_0xd903a8[_0x2adc('0x48')][_0x2adc('0x4b')]));_0x2e9a93[_0x2adc('0x4c')]=_0x2e9a93[_0x2adc('0x4c')]['length']?_0x2e9a93[_0x2adc('0x4c')]:_0x8768f1[_0x2adc('0x46')];if(!_0xd903a8[_0x2adc('0x48')][_0x2adc('0x4e')]('nolimit')){_0x2e9a93[_0x2adc('0x33')]=qs[_0x2adc('0x33')](_0xd903a8[_0x2adc('0x48')][_0x2adc('0x33')]);_0x2e9a93[_0x2adc('0x30')]=qs['offset'](_0xd903a8['query'][_0x2adc('0x30')]);}_0x2e9a93[_0x2adc('0x4f')]=qs['sort'](_0xd903a8[_0x2adc('0x48')][_0x2adc('0x50')]);_0x2e9a93[_0x2adc('0x52')]=qs['filters'](_[_0x2adc('0x6b')](_0xd903a8['query'],_0x8768f1['filters']));_0x2e9a93[_0x2adc('0x52')][_0x2adc('0x67')]=_0x4068d7['id'];if(_0xd903a8['query'][_0x2adc('0x51')]){_0x2e9a93[_0x2adc('0x52')]=_['merge'](_0x2e9a93[_0x2adc('0x52')],{'$or':_[_0x2adc('0x40')](_0x2e9a93[_0x2adc('0x4c')],function(_0x3c2202){var _0x501b3e={};_0x501b3e[_0x3c2202]={'$like':'%'+_0xd903a8[_0x2adc('0x48')][_0x2adc('0x51')]+'%'};return _0x501b3e;})});}if(_0xd903a8[_0x2adc('0x48')][_0x2adc('0xa1')]){var _0x268914=_0xd903a8[_0x2adc('0x48')]['$gte'][_0x2adc('0xa2')](',');var _0x6db5d5={};_0x6db5d5[_0x268914[0x0]]={'$gte':moment(_0x268914[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2e9a93[_0x2adc('0x52')]=_['merge'](_0x2e9a93[_0x2adc('0x52')],_0x6db5d5);}_0x2e9a93=_[_0x2adc('0x53')]({},_0x2e9a93,_0xd903a8[_0x2adc('0x55')]);return db[_0x2adc('0xa3')][_0x2adc('0x32')]({'where':_0x2e9a93[_0x2adc('0x52')]})['then'](function(_0x29b040){_0x45c91f[_0x2adc('0x32')]=_0x29b040;if(_0xd903a8[_0x2adc('0x48')][_0x2adc('0x56')]){_0x2e9a93[_0x2adc('0x57')]=[{'all':!![]}];}return db[_0x2adc('0xa3')][_0x2adc('0x58')](_0x2e9a93);})[_0x2adc('0x21')](function(_0xf777a6){_0x45c91f[_0x2adc('0x59')]=_0xf777a6;return _0x45c91f;});}})[_0x2adc('0x21')](respondWithFilteredResult(_0x7e56aa,_0x2e9a93))[_0x2adc('0x2c')](handleError(_0x7e56aa,null));};exports[_0x2adc('0x3e')]=function(_0x2fd5b7,_0x49a0bb,_0x58b47a){var _0x2fe3f1,_0x6d5396={},_0x3692c7;if(_0x2fd5b7['body']['to']){_0x3692c7=_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x2adc('0x6c')]({'where':{'id':_0x2fd5b7[_0x2adc('0x5b')]['id']},'include':[{'model':db[_0x2adc('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0x2adc('0xa5'),'where':{'fax':_0x3692c7},'limit':0x1,'order':[['updatedAt',_0x2adc('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x49a0bb,null))[_0x2adc('0x21')](function(_0x248a2d){_0x2fe3f1=_0x248a2d;if(_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')]&&_0x2fd5b7[_0x2adc('0x5e')]['attachments'][_0x2adc('0x4d')]){for(var _0x3a446e=0x0;_0x3a446e<_0x2fd5b7[_0x2adc('0x5e')]['attachments'][_0x2adc('0x4d')];_0x3a446e+=0x1){_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')][_0x3a446e]={'filename':_0x2fd5b7['body'][_0x2adc('0xa7')][_0x3a446e][_0x2adc('0x3d')],'id':_0x2fd5b7[_0x2adc('0x5e')]['attachments'][_0x3a446e]['id'],'path':path[_0x2adc('0xa8')](config[_0x2adc('0xa9')],_0x2adc('0xaa'),_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')][_0x3a446e][_0x2adc('0xab')])};}}return respondWithRpcPromise(_0x2adc('0xac'),_0x2adc('0xac'),{'FaxAccountId':_['isNil'](_0x2fd5b7[_0x2adc('0x5b')]['id'])?undefined:_0x2fd5b7[_0x2adc('0x5b')]['id'],'path':_[_0x2adc('0xad')](_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')][0x0]['path'])?undefined:_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')][0x0]['path'],'fax':_['isNil'](_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0])?undefined:_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0]},client9002);})[_0x2adc('0x21')](function(){if(_0x2fe3f1){if(_[_0x2adc('0xad')](_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xae')])){_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xae')]=util[_0x2adc('0xaf')](_0x2adc('0xb0'),_0x2fe3f1[_0x2adc('0x3d')],_0x2fe3f1[_0x2adc('0xb1')]);}if(_0x2fe3f1[_0x2adc('0xb2')]){if(_0x2fe3f1[_0x2adc('0xb2')][_0x2adc('0xa5')][_0x2adc('0x4d')]){return _0x2fe3f1['List'][_0x2adc('0xa5')][0x0];}else{return db[_0x2adc('0xb3')][_0x2adc('0x5d')](_[_0x2adc('0x1a')](_0x2fd5b7[_0x2adc('0x5e')],{'firstName':_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0],'phone':_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0],'fax':_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0],'ListId':_0x2fe3f1[_0x2adc('0xb4')]}));}}else{throw new Error(_0x2adc('0xb5'));}}else{throw new Error(_0x2adc('0xb6'));}})[_0x2adc('0x21')](function(_0x275fee){if(_0x275fee){return db[_0x2adc('0x74')][_0x2adc('0x6c')]({'where':{'ContactId':_0x275fee['id'],'closed':![],'FaxAccountId':_0x2fe3f1['id']}})[_0x2adc('0x21')](function(_0x3fde41){if(_0x3fde41){return[_0x3fde41,![]];}return db['FaxInteraction'][_0x2adc('0x5d')]({'UserId':_0x2fd5b7[_0x2adc('0x61')]['id'],'ContactId':_0x275fee['id'],'FaxAccountId':_0x2fe3f1['id'],'fax':_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x2adc('0x53')](_0x2fd5b7[_0x2adc('0x5e')],{'read':![],'body':_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')][0x0][_0x2adc('0xb7')],'FaxAccountId':_0x2fe3f1['id'],'UserId':_0x2fd5b7[_0x2adc('0x61')]['id'],'ContactId':_0x275fee['id'],'AttachmentId':_0x2fd5b7[_0x2adc('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x2adc('0xa3')],'as':_0x2adc('0xb8')}]})['then'](function(_0x2373bc){return[_0x2373bc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2adc('0xb9')](function(_0x42f346,_0x2acdae){if(_0x2acdae){return _0x42f346;}return db[_0x2adc('0xa3')]['create']({'direction':_0x2adc('0xba'),'read':![],'body':_0x2fd5b7[_0x2adc('0x5e')]['attachments'][0x0][_0x2adc('0xb7')],'FaxAccountId':_0x2fe3f1['id'],'FaxInteractionId':_0x42f346['id'],'UserId':_0x2fd5b7[_0x2adc('0x61')]['id'],'ContactId':_0x42f346[_0x2adc('0xbb')],'AttachmentId':_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')][0x0]['id']})[_0x2adc('0x21')](function(_0xe1869d){_0x42f346[_0x2adc('0xbc')][_0x2adc('0xb8')]=[];_0x42f346[_0x2adc('0xbc')]['Messages'][_0x2adc('0x8e')](_0xe1869d[_0x2adc('0xbc')]);return _0x42f346;});})[_0x2adc('0x21')](function(_0x2759db){respondWithRpcPromise(_0x2adc('0xbd'),_0x2adc('0xbd'),{'FaxAccountId':_['isNil'](_0x2fd5b7[_0x2adc('0x5b')]['id'])?undefined:_0x2fd5b7[_0x2adc('0x5b')]['id'],'path':_[_0x2adc('0xad')](_0x2fd5b7[_0x2adc('0x5e')]['attachments'][0x0]['path'])?undefined:_0x2fd5b7[_0x2adc('0x5e')][_0x2adc('0xa7')][0x0][_0x2adc('0x8')],'fax':_[_0x2adc('0xad')](_0x2fd5b7[_0x2adc('0x5e')]['to'][0x0])?undefined:_0x2fd5b7['body']['to'][0x0],'AttachmentId':_0x2fd5b7['body'][_0x2adc('0xa7')][0x0]['id']},client9002)[_0x2adc('0x21')](function(_0x3683e7){logger[_0x2adc('0x22')]('SendFaxRpc,\x20%s',_0x3683e7);})['catch'](function(_0x26c29c){logger[_0x2adc('0x22')](_0x2adc('0xbe'),_0x26c29c);});return _0x2759db;})[_0x2adc('0x21')](respondWithResult(_0x49a0bb,null))[_0x2adc('0x2c')](handleError(_0x49a0bb,null));};exports['addAgents']=function(_0x13e134,_0x2f5c74,_0x311eda){return db[_0x2adc('0x41')][_0x2adc('0x6c')]({'where':{'id':_0x13e134[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x2f5c74,null))['then'](function(_0x5ed87a){if(_0x5ed87a){return _0x5ed87a[_0x2adc('0xbf')](_0x13e134[_0x2adc('0x5e')][_0x2adc('0x6e')],_[_0x2adc('0xc0')](_0x13e134[_0x2adc('0x5e')],[_0x2adc('0x6e'),'id'])||{})[_0x2adc('0xb9')](function(_0x2a38ad){for(var _0x494b24=0x0;_0x494b24<_0x13e134[_0x2adc('0x5e')][_0x2adc('0x6e')][_0x2adc('0x4d')];_0x494b24+=0x1){socket[_0x2adc('0xc1')](_0x2adc('0xc2'),{'UserId':Number(_0x13e134[_0x2adc('0x5e')][_0x2adc('0x6e')][_0x494b24]),'FaxAccountId':Number(_0x13e134[_0x2adc('0x5b')]['id'])});}return _0x2a38ad;});}})[_0x2adc('0x21')](respondWithResult(_0x2f5c74,null))[_0x2adc('0x2c')](handleError(_0x2f5c74,null));};exports['removeAgents']=function(_0x27baa3,_0x4e3398,_0x3cd2e1){return db[_0x2adc('0x41')][_0x2adc('0x6c')]({'where':{'id':_0x27baa3[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x4e3398,null))[_0x2adc('0x21')](function(_0x36a09d){if(_0x36a09d){return _0x36a09d[_0x2adc('0xc3')](_0x27baa3[_0x2adc('0x48')][_0x2adc('0x6e')])[_0x2adc('0x21')](function(){if(_['isArray'](_0x27baa3[_0x2adc('0x48')]['ids'])){for(var _0x21bc9b=0x0;_0x21bc9b<_0x27baa3['query'][_0x2adc('0x6e')][_0x2adc('0x4d')];_0x21bc9b+=0x1){socket[_0x2adc('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x27baa3[_0x2adc('0x48')][_0x2adc('0x6e')][_0x21bc9b]),'FaxAccountId':Number(_0x27baa3[_0x2adc('0x5b')]['id'])});}}else{socket['emit'](_0x2adc('0xc4'),{'UserId':Number(_0x27baa3['query'][_0x2adc('0x6e')]),'FaxAccountId':Number(_0x27baa3[_0x2adc('0x5b')]['id'])});}});}})[_0x2adc('0x21')](respondWithStatusCode(_0x4e3398,null))[_0x2adc('0x2c')](handleError(_0x4e3398,null));};exports[_0x2adc('0xc5')]=function(_0x2172a2,_0x1496f2,_0x33e2e9){var _0x3d8a18={};var _0x12f2e4={};var _0x3467d5;var _0x267861;return db['FaxAccount'][_0x2adc('0x6a')]({'where':{'id':_0x2172a2[_0x2adc('0x5b')]['id']}})[_0x2adc('0x21')](handleEntityNotFound(_0x1496f2,null))['then'](function(_0x1cc843){if(_0x1cc843){_0x3467d5=_0x1cc843;_0x12f2e4[_0x2adc('0x46')]=_[_0x2adc('0x47')](db[_0x2adc('0x76')][_0x2adc('0x42')]);_0x12f2e4[_0x2adc('0x48')]=_[_0x2adc('0x47')](_0x2172a2[_0x2adc('0x48')]);_0x12f2e4[_0x2adc('0x49')]=_[_0x2adc('0x4a')](_0x12f2e4[_0x2adc('0x46')],_0x12f2e4[_0x2adc('0x48')]);_0x3d8a18['attributes']=_[_0x2adc('0x4a')](_0x12f2e4['model'],qs[_0x2adc('0x4b')](_0x2172a2[_0x2adc('0x48')][_0x2adc('0x4b')]));_0x3d8a18[_0x2adc('0x4c')]=_0x3d8a18[_0x2adc('0x4c')]['length']?_0x3d8a18[_0x2adc('0x4c')]:_0x12f2e4[_0x2adc('0x46')];_0x3d8a18['order']=qs[_0x2adc('0x50')](_0x2172a2['query'][_0x2adc('0x50')]);_0x3d8a18[_0x2adc('0x52')]=qs['filters'](_[_0x2adc('0x6b')](_0x2172a2[_0x2adc('0x48')],_0x12f2e4[_0x2adc('0x49')]));if(_0x2172a2[_0x2adc('0x48')][_0x2adc('0x51')]){_0x3d8a18[_0x2adc('0x52')]=_[_0x2adc('0x53')](_0x3d8a18['where'],{'$or':_[_0x2adc('0x40')](_0x3d8a18[_0x2adc('0x4c')],function(_0x2da1f9){var _0x2bd185={};_0x2bd185[_0x2da1f9]={'$like':'%'+_0x2172a2['query'][_0x2adc('0x51')]+'%'};return _0x2bd185;})});}_0x3d8a18=_[_0x2adc('0x53')]({},_0x3d8a18,_0x2172a2[_0x2adc('0x55')]);return _0x3467d5[_0x2adc('0xc5')](_0x3d8a18);}})[_0x2adc('0x21')](function(_0x10e825){if(_0x10e825){_0x267861=_0x10e825[_0x2adc('0x4d')];if(!_0x2172a2[_0x2adc('0x48')][_0x2adc('0x4e')](_0x2adc('0xc6'))){_0x3d8a18[_0x2adc('0x33')]=qs['limit'](_0x2172a2[_0x2adc('0x48')][_0x2adc('0x33')]);_0x3d8a18[_0x2adc('0x30')]=qs[_0x2adc('0x30')](_0x2172a2['query'][_0x2adc('0x30')]);}return _0x3467d5[_0x2adc('0xc5')](_0x3d8a18);}})['then'](function(_0x4ac4de){if(_0x4ac4de){return _0x4ac4de?{'count':_0x267861,'rows':_0x4ac4de}:null;}})[_0x2adc('0x21')](respondWithResult(_0x1496f2,null))[_0x2adc('0x2c')](handleError(_0x1496f2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 0af04b7..268fbb2 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 _0x3c2f=['exports','events','FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2035a1,_0x3f9be6){var _0x4b10c7=function(_0x2a81a4){while(--_0x2a81a4){_0x2035a1['push'](_0x2035a1['shift']());}};_0x4b10c7(++_0x3f9be6);}(_0x3c2f,0x191));var _0xf3c2=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x3c2f[_0x41f2f5];return _0x3d49f1;};'use strict';var EventEmitter=require(_0xf3c2('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xf3c2('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf3c2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf3c2('0x3'),'afterDestroy':_0xf3c2('0x4')};function emitEvent(_0x405602){return function(_0x494d2f,_0x457e5a,_0x8373dc){FaxAccountEvents['emit'](_0x405602+':'+_0x494d2f['id'],_0x494d2f);FaxAccountEvents[_0xf3c2('0x5')](_0x405602,_0x494d2f);_0x8373dc(null);};}for(var e in events){if(events[_0xf3c2('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xf3c2('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xa7fb=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa7fb,0xf6));var _0xba7f=function(_0x19fb9f,_0x2e105c){_0x19fb9f=_0x19fb9f-0x0;var _0x16ce95=_0xa7fb[_0x19fb9f];return _0x16ce95;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xba7f('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xba7f('0x1')](0x0);var events={'afterCreate':_0xba7f('0x2'),'afterUpdate':_0xba7f('0x3'),'afterDestroy':_0xba7f('0x4')};function emitEvent(_0x1497e1){return function(_0x2a7569,_0x183697,_0x223e8a){FaxAccountEvents['emit'](_0x1497e1+':'+_0x2a7569['id'],_0x2a7569);FaxAccountEvents[_0xba7f('0x5')](_0x1497e1,_0x2a7569);_0x223e8a(null);};}for(var e in events){if(events[_0xba7f('0x6')](e)){var event=events[e];FaxAccount[_0xba7f('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b16e907..8b8003e 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 _0x0e0b=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','fax_accounts','lodash','util'];(function(_0x20ae3b,_0x23a21c){var _0x391475=function(_0x590776){while(--_0x590776){_0x20ae3b['push'](_0x20ae3b['shift']());}};_0x391475(++_0x23a21c);}(_0x0e0b,0x111));var _0xb0e0=function(_0x32bce8,_0x54f965){_0x32bce8=_0x32bce8-0x0;var _0x38badc=_0x0e0b[_0x32bce8];return _0x38badc;};'use strict';var _=require(_0xb0e0('0x0'));var util=require(_0xb0e0('0x1'));var logger=require(_0xb0e0('0x2'))(_0xb0e0('0x3'));var moment=require('moment');var BPromise=require(_0xb0e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0e0('0x5'));var rimraf=require(_0xb0e0('0x6'));var config=require(_0xb0e0('0x7'));var attributes=require('./faxAccount.attributes');module[_0xb0e0('0x8')]=function(_0x32be85,_0x14a097){return _0x32be85[_0xb0e0('0x9')]('FaxAccount',attributes,{'tableName':_0xb0e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3517=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define'];(function(_0x3fc2aa,_0x9fe32d){var _0x14a69a=function(_0x255333){while(--_0x255333){_0x3fc2aa['push'](_0x3fc2aa['shift']());}};_0x14a69a(++_0x9fe32d);}(_0x3517,0x1d4));var _0x7351=function(_0x562f51,_0x155f4d){_0x562f51=_0x562f51-0x0;var _0x43131c=_0x3517[_0x562f51];return _0x43131c;};'use strict';var _=require(_0x7351('0x0'));var util=require(_0x7351('0x1'));var logger=require(_0x7351('0x2'))(_0x7351('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7351('0x4'));var rimraf=require(_0x7351('0x5'));var config=require(_0x7351('0x6'));var attributes=require('./faxAccount.attributes');module[_0x7351('0x7')]=function(_0x3bb70c,_0x6f01d2){return _0x3bb70c[_0x7351('0x8')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 7c2ca66..b076616 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 _0x424e=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','CmContact','Contacts','DESC','FaxApplication','get','account','applications','list','orderBy','priority','asc','Applications','length','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','interaction','ContactId','AttachmentId','User','name','UserId','unshift','agent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','ValidationError','no\x20available\x20attributes','updatedAt','difference','keys','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x424e,0x14b));var _0xe424=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x424e[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0xe424('0x0'));var util=require(_0xe424('0x1'));var moment=require(_0xe424('0x2'));var BPromise=require(_0xe424('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe424('0x4'));var db=require(_0xe424('0x5'))['db'];var utils=require(_0xe424('0x6'));var logger=require(_0xe424('0x7'))(_0xe424('0x8'));var config=require(_0xe424('0x9'));var jayson=require(_0xe424('0xa'));var client=jayson[_0xe424('0xb')]['http']({'port':0x232c});config['redis']=_[_0xe424('0xc')](config[_0xe424('0xd')],{'host':_0xe424('0xe'),'port':0x18eb});var socket=require(_0xe424('0xf'))(new Redis(config[_0xe424('0xd')]));require(_0xe424('0x10'))[_0xe424('0x11')](socket);function respondWithRpcPromise(_0x5f504a,_0x5dc8bc,_0x4c38f2){return new BPromise(function(_0x4363d1,_0x149a05){return client[_0xe424('0x12')](_0x5f504a,_0x4c38f2)[_0xe424('0x13')](function(_0x5cb996){logger[_0xe424('0x14')](_0xe424('0x15'),_0x5dc8bc,_0xe424('0x16'));logger[_0xe424('0x17')](_0xe424('0x18'),_0x5dc8bc,_0xe424('0x16'),JSON[_0xe424('0x19')](_0x5cb996));if(_0x5cb996['error']){if(_0x5cb996[_0xe424('0x1a')][_0xe424('0x1b')]===0x1f4){logger[_0xe424('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x5dc8bc,_0x5cb996[_0xe424('0x1a')]['message']);return _0x149a05(_0x5cb996[_0xe424('0x1a')][_0xe424('0x1c')]);}logger[_0xe424('0x1a')](_0xe424('0x15'),_0x5dc8bc,_0x5cb996[_0xe424('0x1a')][_0xe424('0x1c')]);return _0x4363d1(_0x5cb996[_0xe424('0x1a')]['message']);}else{logger[_0xe424('0x14')](_0xe424('0x15'),_0x5dc8bc,'request\x20sent');_0x4363d1(_0x5cb996[_0xe424('0x1d')][_0xe424('0x1c')]);}})[_0xe424('0x1e')](function(_0x59475e){logger[_0xe424('0x1a')](_0xe424('0x15'),_0x5dc8bc,_0x59475e);_0x149a05(_0x59475e);});});}exports[_0xe424('0x1f')]=function(_0x157075){var _0x33e2ce=this;return new Promise(function(_0x143364,_0x4e9f4d){return db[_0xe424('0x20')][_0xe424('0x21')]({'raw':_0x157075['options']?_0x157075[_0xe424('0x22')][_0xe424('0x23')]===undefined?!![]:![]:!![],'where':_0x157075['options']?_0x157075['options'][_0xe424('0x24')]||null:null,'attributes':_0x157075[_0xe424('0x22')]?_0x157075['options'][_0xe424('0x25')]||null:null,'limit':_0x157075[_0xe424('0x22')]?_0x157075['options'][_0xe424('0x26')]||null:null,'include':_0x157075[_0xe424('0x22')]?_0x157075[_0xe424('0x22')][_0xe424('0x27')]?_['map'](_0x157075[_0xe424('0x22')][_0xe424('0x27')],function(_0x14158d){return{'model':db[_0x14158d[_0xe424('0x28')]],'as':_0x14158d['as'],'attributes':_0x14158d[_0xe424('0x25')],'include':_0x14158d[_0xe424('0x27')]?_['map'](_0x14158d['include'],function(_0x129313){return{'model':db[_0x129313[_0xe424('0x28')]],'as':_0x129313['as'],'attributes':_0x129313[_0xe424('0x25')],'include':_0x129313[_0xe424('0x27')]?_[_0xe424('0x29')](_0x129313[_0xe424('0x27')],function(_0x2205e6){return{'model':db[_0x2205e6[_0xe424('0x28')]],'as':_0x2205e6['as'],'attributes':_0x2205e6[_0xe424('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b6560){logger[_0xe424('0x14')](_0xe424('0x1f'),_0x157075);logger[_0xe424('0x17')](_0xe424('0x1f'),_0x157075,JSON[_0xe424('0x19')](_0x5b6560));_0x143364(_0x5b6560);})[_0xe424('0x1e')](function(_0x4dc093){logger[_0xe424('0x1a')]('GetFaxAccount',_0x4dc093[_0xe424('0x1c')],_0x157075);_0x4e9f4d(_0x33e2ce[_0xe424('0x1a')](0x1f4,_0x4dc093[_0xe424('0x1c')]));});});};exports[_0xe424('0x2a')]=function(_0x4844cd,_0x324016,_0x50fb96){var _0x61941=this;return new Promise(function(_0x1a41a0,_0x3ce5be){var _0x17ff70={'body':_0x4844cd[_0xe424('0x2b')],'channel':_0xe424('0x2c')};var _0x33d84a=[];var _0x5cbe3f=[];var _0xf7c2dc={};return db['CmContact']['describe']()[_0xe424('0x13')](function(_0x4e7504){if(!_0x4e7504){throw new db['Sequelize'][(_0xe424('0x2d'))](_0xe424('0x2e'));}_0x33d84a=_['difference'](_['keys'](_0x4e7504),['createdAt',_0xe424('0x2f')]);_0x5cbe3f=_[_0xe424('0x30')](_[_0xe424('0x31')](_0x4e7504),[_0xe424('0x32'),'updatedAt',_0xe424('0x33'),_0xe424('0x34')]);if(_0x4844cd[_0xe424('0x2b')]['id']){delete _0x4844cd[_0xe424('0x2b')]['id'];}if(_['isNil'](_0x4844cd[_0xe424('0x2b')][_0xe424('0x35')])){throw new db[(_0xe424('0x36'))][(_0xe424('0x2d'))](_0xe424('0x37'));}if(_[_0xe424('0x38')](_0x4844cd[_0xe424('0x2b')][_0xe424('0x2b')])||_0x4844cd[_0xe424('0x2b')][_0xe424('0x2b')]===''){throw new db[(_0xe424('0x36'))][(_0xe424('0x2d'))](_0xe424('0x39'));}if(_[_0xe424('0x38')](_0x4844cd['body']['mapKey'])){throw new db[(_0xe424('0x36'))][(_0xe424('0x2d'))](_0xe424('0x3a')+_0x5cbe3f);}if(!_[_0xe424('0x3b')](_0x5cbe3f,_0x4844cd[_0xe424('0x2b')][_0xe424('0x3c')])){throw new db[(_0xe424('0x36'))][(_0xe424('0x2d'))](_0xe424('0x3d')+_0x5cbe3f);}_0xf7c2dc[_0x4844cd[_0xe424('0x2b')]['mapKey']]=_0x4844cd[_0xe424('0x2b')][_0xe424('0x35')];})[_0xe424('0x13')](function(){return db[_0xe424('0x20')][_0xe424('0x3e')]({'where':{'id':_0x4844cd['account']['id']},'include':[{'model':db[_0xe424('0x3f')],'as':_0xe424('0x40'),'include':[{'model':db[_0xe424('0x41')],'as':_0xe424('0x42'),'where':_0xf7c2dc,'limit':0x1,'order':[[_0xe424('0x2f'),_0xe424('0x43')]]}]},{'model':db[_0xe424('0x44')],'as':'Applications'}]});})[_0xe424('0x13')](function(_0x24fc6c){if(_0x24fc6c&&_0x24fc6c['List']){var _0x2411e9=_0x24fc6c[_0xe424('0x45')]({'plain':!![]});_0x17ff70[_0xe424('0x46')]=_0x2411e9;_0x17ff70[_0xe424('0x47')]=_0x2411e9['Applications'];_0x17ff70[_0xe424('0x48')]=_0x2411e9[_0xe424('0x40')];_0x17ff70[_0xe424('0x47')]=_[_0xe424('0x49')](_0x17ff70[_0xe424('0x47')],[_0xe424('0x4a')],[_0xe424('0x4b')]);if(_0x17ff70[_0xe424('0x46')][_0xe424('0x4c')]){delete _0x17ff70[_0xe424('0x46')][_0xe424('0x4c')];}if(_0x17ff70['account']['List']&&_0x17ff70[_0xe424('0x46')][_0xe424('0x40')][_0xe424('0x42')][_0xe424('0x4d')]){return _0x17ff70[_0xe424('0x46')][_0xe424('0x40')][_0xe424('0x42')][0x0];}var _0x602610=_[_0xe424('0xc')](_0x4844cd[_0xe424('0x2b')],{'firstName':_0x4844cd['body'][_0xe424('0x35')],'ListId':_0x2411e9[_0xe424('0x34')]});_0x602610[_0x4844cd[_0xe424('0x2b')]['mapKey']]=_0x4844cd[_0xe424('0x2b')][_0xe424('0x35')];return db[_0xe424('0x41')]['create'](_0x602610,{'fields':_0x33d84a,'raw':!![]});}})[_0xe424('0x13')](function(_0x13c9ab){_0x17ff70[_0xe424('0x4e')]=_0x13c9ab;if(_0x13c9ab){var _0x2ddd35={'ContactId':_0x13c9ab['id'],'FaxAccountId':_0x4844cd[_0xe424('0x46')]['id'],'fax':_0x13c9ab[_0xe424('0x2c')]};return db[_0xe424('0x4f')][_0xe424('0x3e')]({'where':{'ContactId':_0x13c9ab['id'],'closed':![],'FaxAccountId':_0x4844cd[_0xe424('0x46')]['id']}})[_0xe424('0x13')](function(_0x550e66){if(_0x550e66){return[_0x550e66,![]];}return db[_0xe424('0x4f')]['create'](_0x2ddd35)[_0xe424('0x13')](function(_0x5be10d){return[_0x5be10d,!![]];});});}else{throw new Error(_0xe424('0x50'));}})[_0xe424('0x51')](function(_0x337271,_0x2d0d94){var _0x61728c=_0x337271[_0xe424('0x45')]({'plain':!![]});if(_0x2d0d94){if(_0x17ff70['account'][_0xe424('0x52')]){_0x17ff70[_0xe424('0x47')][_0xe424('0x53')]({'id':0x0,'priority':_0x17ff70[_0xe424('0x47')][_0xe424('0x4d')]+0x1,'app':_0xe424('0x54'),'appdata':_0xe424('0x55'),'interval':'*,*,*,*'});}_0x61728c[_0xe424('0x56')]=!![];}else{_0x61728c[_0xe424('0x56')]=![];}_0x17ff70[_0xe424('0x57')]=_0x61728c;return db['FaxMessage']['create']({'body':_0x4844cd[_0xe424('0x2b')][_0xe424('0x2b')],'FaxAccountId':_0x4844cd[_0xe424('0x46')]['id'],'FaxInteractionId':_0x337271['id'],'direction':'in','ContactId':_0x337271[_0xe424('0x58')],'AttachmentId':_0x4844cd[_0xe424('0x2b')][_0xe424('0x59')]});})[_0xe424('0x13')](function(_0x2ece76){_0x17ff70[_0xe424('0x1c')]=_0x2ece76;if(_0x17ff70['interaction']['UserId']){return db[_0xe424('0x5a')][_0xe424('0x3e')]({'attributes':['id',_0xe424('0x5b')],'where':{'id':_0x17ff70[_0xe424('0x57')][_0xe424('0x5c')]}})[_0xe424('0x13')](function(_0x2c8a6b){if(_0x2c8a6b){_0x17ff70[_0xe424('0x47')][_0xe424('0x5d')]({'id':0x0,'priority':0x0,'app':_0xe424('0x5e'),'appdata':_0x2c8a6b[_0xe424('0x5b')]+','+(_0x17ff70[_0xe424('0x46')]['waitForTheAssignedAgent']||0xa),'interval':_0xe424('0x5f')});}return respondWithRpcPromise(_0xe424('0x60'),_0xe424('0x61'),_0x17ff70);});}return respondWithRpcPromise(_0xe424('0x60'),_0xe424('0x61'),_0x17ff70);})['then'](function(_0x47cb8f){_0x1a41a0(_0x47cb8f);})[_0xe424('0x1e')](function(_0x575a45){_0x3ce5be(_0x61941['error'](0x1f4,_0x575a45[_0xe424('0x1c')]));});});}; \ No newline at end of file +var _0x7c19=['Contact\x20not\x20found','get','push','length','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','raw','options','where','include','map','model','attributes','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','FaxApplication','Applications','applications','list','orderBy','asc','Contacts','defaults','create'];(function(_0x2792b0,_0x31b3ed){var _0x5cab5d=function(_0xa4b5b3){while(--_0xa4b5b3){_0x2792b0['push'](_0x2792b0['shift']());}};_0x5cab5d(++_0x31b3ed);}(_0x7c19,0x69));var _0x97c1=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x7c19[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0x97c1('0x0'));var util=require(_0x97c1('0x1'));var moment=require(_0x97c1('0x2'));var BPromise=require(_0x97c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97c1('0x4'));var db=require(_0x97c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x97c1('0x6'))(_0x97c1('0x7'));var config=require(_0x97c1('0x8'));var jayson=require(_0x97c1('0x9'));var client=jayson['client']['http']({'port':0x232c});config[_0x97c1('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x97c1('0xb'))(new Redis(config['redis']));require(_0x97c1('0xc'))[_0x97c1('0xd')](socket);function respondWithRpcPromise(_0xd6b5a2,_0x25dd7a,_0x4df451){return new BPromise(function(_0x185e57,_0x5c8a58){return client['request'](_0xd6b5a2,_0x4df451)[_0x97c1('0xe')](function(_0x1a1d0c){logger['info'](_0x97c1('0xf'),_0x25dd7a,_0x97c1('0x10'));logger[_0x97c1('0x11')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x25dd7a,_0x97c1('0x10'),JSON['stringify'](_0x1a1d0c));if(_0x1a1d0c['error']){if(_0x1a1d0c[_0x97c1('0x12')][_0x97c1('0x13')]===0x1f4){logger[_0x97c1('0x12')](_0x97c1('0xf'),_0x25dd7a,_0x1a1d0c[_0x97c1('0x12')][_0x97c1('0x14')]);return _0x5c8a58(_0x1a1d0c[_0x97c1('0x12')][_0x97c1('0x14')]);}logger['error'](_0x97c1('0xf'),_0x25dd7a,_0x1a1d0c[_0x97c1('0x12')][_0x97c1('0x14')]);return _0x185e57(_0x1a1d0c['error'][_0x97c1('0x14')]);}else{logger[_0x97c1('0x15')]('FaxAccount,\x20%s,\x20%s',_0x25dd7a,_0x97c1('0x10'));_0x185e57(_0x1a1d0c[_0x97c1('0x16')][_0x97c1('0x14')]);}})[_0x97c1('0x17')](function(_0x1e5b9a){logger[_0x97c1('0x12')]('FaxAccount,\x20%s,\x20%s',_0x25dd7a,_0x1e5b9a);_0x5c8a58(_0x1e5b9a);});});}exports[_0x97c1('0x18')]=function(_0x514ec4){var _0x2229ce=this;return new Promise(function(_0xce196b,_0x188dba){return db[_0x97c1('0x19')][_0x97c1('0x1a')]({'raw':_0x514ec4['options']?_0x514ec4['options'][_0x97c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x514ec4['options']?_0x514ec4[_0x97c1('0x1c')][_0x97c1('0x1d')]||null:null,'attributes':_0x514ec4[_0x97c1('0x1c')]?_0x514ec4[_0x97c1('0x1c')]['attributes']||null:null,'limit':_0x514ec4['options']?_0x514ec4[_0x97c1('0x1c')]['limit']||null:null,'include':_0x514ec4[_0x97c1('0x1c')]?_0x514ec4[_0x97c1('0x1c')][_0x97c1('0x1e')]?_[_0x97c1('0x1f')](_0x514ec4['options'][_0x97c1('0x1e')],function(_0x268ec9){return{'model':db[_0x268ec9[_0x97c1('0x20')]],'as':_0x268ec9['as'],'attributes':_0x268ec9[_0x97c1('0x21')],'include':_0x268ec9[_0x97c1('0x1e')]?_[_0x97c1('0x1f')](_0x268ec9[_0x97c1('0x1e')],function(_0x11ba9a){return{'model':db[_0x11ba9a['model']],'as':_0x11ba9a['as'],'attributes':_0x11ba9a[_0x97c1('0x21')],'include':_0x11ba9a[_0x97c1('0x1e')]?_[_0x97c1('0x1f')](_0x11ba9a[_0x97c1('0x1e')],function(_0x25218d){return{'model':db[_0x25218d['model']],'as':_0x25218d['as'],'attributes':_0x25218d[_0x97c1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x97c1('0xe')](function(_0x44fb74){logger[_0x97c1('0x15')](_0x97c1('0x18'),_0x514ec4);logger[_0x97c1('0x11')](_0x97c1('0x18'),_0x514ec4,JSON['stringify'](_0x44fb74));_0xce196b(_0x44fb74);})[_0x97c1('0x17')](function(_0x341a22){logger[_0x97c1('0x12')](_0x97c1('0x18'),_0x341a22['message'],_0x514ec4);_0x188dba(_0x2229ce[_0x97c1('0x12')](0x1f4,_0x341a22[_0x97c1('0x14')]));});});};exports['NotifyFaxAccount']=function(_0x41fbf9,_0x332f41,_0x277b77){var _0x56c5c4=this;return new Promise(function(_0x465df2,_0x31f518){var _0x277d31={'body':_0x41fbf9[_0x97c1('0x22')],'channel':_0x97c1('0x23')};var _0x3454c1=[];var _0x2623ca=[];var _0x5c53fe={};return db[_0x97c1('0x24')][_0x97c1('0x25')]()[_0x97c1('0xe')](function(_0x1cdf82){if(!_0x1cdf82){throw new db[(_0x97c1('0x26'))][(_0x97c1('0x27'))](_0x97c1('0x28'));}_0x3454c1=_[_0x97c1('0x29')](_[_0x97c1('0x2a')](_0x1cdf82),[_0x97c1('0x2b'),'updatedAt']);_0x2623ca=_['difference'](_[_0x97c1('0x2a')](_0x1cdf82),[_0x97c1('0x2b'),'updatedAt',_0x97c1('0x2c'),'ListId']);if(_0x41fbf9[_0x97c1('0x22')]['id']){delete _0x41fbf9[_0x97c1('0x22')]['id'];}if(_[_0x97c1('0x2d')](_0x41fbf9['body'][_0x97c1('0x2e')])){throw new db[(_0x97c1('0x26'))][(_0x97c1('0x27'))](_0x97c1('0x2f'));}if(_[_0x97c1('0x2d')](_0x41fbf9[_0x97c1('0x22')][_0x97c1('0x22')])||_0x41fbf9[_0x97c1('0x22')][_0x97c1('0x22')]===''){throw new db[(_0x97c1('0x26'))][(_0x97c1('0x27'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x97c1('0x2d')](_0x41fbf9[_0x97c1('0x22')][_0x97c1('0x30')])){throw new db['Sequelize'][(_0x97c1('0x27'))](_0x97c1('0x31')+_0x2623ca);}if(!_[_0x97c1('0x32')](_0x2623ca,_0x41fbf9[_0x97c1('0x22')][_0x97c1('0x30')])){throw new db['Sequelize'][(_0x97c1('0x27'))](_0x97c1('0x33')+_0x2623ca);}_0x5c53fe[_0x41fbf9[_0x97c1('0x22')][_0x97c1('0x30')]]=_0x41fbf9[_0x97c1('0x22')][_0x97c1('0x2e')];})['then'](function(){return db['FaxAccount'][_0x97c1('0x34')]({'where':{'id':_0x41fbf9[_0x97c1('0x35')]['id']},'include':[{'model':db[_0x97c1('0x36')],'as':_0x97c1('0x37'),'include':[{'model':db[_0x97c1('0x24')],'as':'Contacts','where':_0x5c53fe,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x97c1('0x38')],'as':_0x97c1('0x39')}]});})[_0x97c1('0xe')](function(_0x45cb7e){if(_0x45cb7e&&_0x45cb7e[_0x97c1('0x37')]){var _0x5569c8=_0x45cb7e['get']({'plain':!![]});_0x277d31[_0x97c1('0x35')]=_0x5569c8;_0x277d31[_0x97c1('0x3a')]=_0x5569c8[_0x97c1('0x39')];_0x277d31[_0x97c1('0x3b')]=_0x5569c8['List'];_0x277d31[_0x97c1('0x3a')]=_[_0x97c1('0x3c')](_0x277d31[_0x97c1('0x3a')],['priority'],[_0x97c1('0x3d')]);if(_0x277d31[_0x97c1('0x35')]['Applications']){delete _0x277d31[_0x97c1('0x35')][_0x97c1('0x39')];}if(_0x277d31[_0x97c1('0x35')]['List']&&_0x277d31[_0x97c1('0x35')][_0x97c1('0x37')][_0x97c1('0x3e')]['length']){return _0x277d31[_0x97c1('0x35')][_0x97c1('0x37')][_0x97c1('0x3e')][0x0];}var _0x40ba02=_[_0x97c1('0x3f')](_0x41fbf9[_0x97c1('0x22')],{'firstName':_0x41fbf9[_0x97c1('0x22')]['from'],'ListId':_0x5569c8['ListId']});_0x40ba02[_0x41fbf9['body']['mapKey']]=_0x41fbf9['body'][_0x97c1('0x2e')];return db[_0x97c1('0x24')][_0x97c1('0x40')](_0x40ba02,{'fields':_0x3454c1,'raw':!![]});}})[_0x97c1('0xe')](function(_0x1574da){_0x277d31['contact']=_0x1574da;if(_0x1574da){var _0xabd9cd={'ContactId':_0x1574da['id'],'FaxAccountId':_0x41fbf9[_0x97c1('0x35')]['id'],'fax':_0x1574da[_0x97c1('0x23')]};return db['FaxInteraction'][_0x97c1('0x34')]({'where':{'ContactId':_0x1574da['id'],'closed':![],'FaxAccountId':_0x41fbf9[_0x97c1('0x35')]['id']}})[_0x97c1('0xe')](function(_0x311cf2){if(_0x311cf2){return[_0x311cf2,![]];}return db['FaxInteraction'][_0x97c1('0x40')](_0xabd9cd)[_0x97c1('0xe')](function(_0x354fc0){return[_0x354fc0,!![]];});});}else{throw new Error(_0x97c1('0x41'));}})['spread'](function(_0x445658,_0x219950){var _0x5050ad=_0x445658[_0x97c1('0x42')]({'plain':!![]});if(_0x219950){if(_0x277d31[_0x97c1('0x35')]['autoclose']){_0x277d31[_0x97c1('0x3a')][_0x97c1('0x43')]({'id':0x0,'priority':_0x277d31[_0x97c1('0x3a')][_0x97c1('0x44')]+0x1,'app':_0x97c1('0x45'),'appdata':_0x97c1('0x46'),'interval':_0x97c1('0x47')});}_0x5050ad[_0x97c1('0x48')]=!![];}else{_0x5050ad[_0x97c1('0x48')]=![];}_0x277d31['interaction']=_0x5050ad;return db[_0x97c1('0x49')]['create']({'body':_0x41fbf9[_0x97c1('0x22')]['body'],'FaxAccountId':_0x41fbf9['account']['id'],'FaxInteractionId':_0x445658['id'],'direction':'in','ContactId':_0x445658[_0x97c1('0x4a')],'AttachmentId':_0x41fbf9[_0x97c1('0x22')][_0x97c1('0x4b')]});})[_0x97c1('0xe')](function(_0x394fc1){_0x277d31[_0x97c1('0x14')]=_0x394fc1;if(_0x277d31[_0x97c1('0x4c')][_0x97c1('0x4d')]){return db[_0x97c1('0x4e')][_0x97c1('0x34')]({'attributes':['id','name'],'where':{'id':_0x277d31['interaction'][_0x97c1('0x4d')]}})[_0x97c1('0xe')](function(_0x224aa7){if(_0x224aa7){_0x277d31[_0x97c1('0x3a')][_0x97c1('0x4f')]({'id':0x0,'priority':0x0,'app':_0x97c1('0x50'),'appdata':_0x224aa7[_0x97c1('0x51')]+','+(_0x277d31[_0x97c1('0x35')][_0x97c1('0x52')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x97c1('0x53'),_0x97c1('0x54'),_0x277d31);});}return respondWithRpcPromise(_0x97c1('0x53'),_0x97c1('0x54'),_0x277d31);})['then'](function(_0x4c8f2a){_0x465df2(_0x4c8f2a);})[_0x97c1('0x17')](function(_0x1f8b3e){_0x31f518(_0x56c5c4[_0x97c1('0x12')](0x1f4,_0x1f8b3e[_0x97c1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ef9329a..cc3a032 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 _0xd488=['save','remove','removeListener','length','faxAccount:','./faxAccount.events'];(function(_0x142a07,_0x251e3c){var _0x101b6d=function(_0xcc9433){while(--_0xcc9433){_0x142a07['push'](_0x142a07['shift']());}};_0x101b6d(++_0x251e3c);}(_0xd488,0xd7));var _0x8d48=function(_0xd6a568,_0x4d39e9){_0xd6a568=_0xd6a568-0x0;var _0x56e5ab=_0xd488[_0xd6a568];return _0x56e5ab;};'use strict';var FaxAccountEvents=require(_0x8d48('0x0'));var events=[_0x8d48('0x1'),_0x8d48('0x2'),'update'];function createListener(_0x2058ae,_0x1a5801){return function(_0xe64f0c){_0x1a5801['emit'](_0x2058ae,_0xe64f0c);};}function removeListener(_0xb89226,_0x3cb2fb){return function(){FaxAccountEvents[_0x8d48('0x3')](_0xb89226,_0x3cb2fb);};}exports['register']=function(_0x11bfb9){for(var _0x575ee9=0x0,_0x25f590=events[_0x8d48('0x4')];_0x575ee9<_0x25f590;_0x575ee9++){var _0x2c9044=events[_0x575ee9];var _0x545c49=createListener(_0x8d48('0x5')+_0x2c9044,_0x11bfb9);FaxAccountEvents['on'](_0x2c9044,_0x545c49);}}; \ No newline at end of file +var _0xa4e9=['./faxAccount.events','save','remove','emit','removeListener','register','faxAccount:'];(function(_0x59ad91,_0x18e334){var _0x2b0043=function(_0x14a35b){while(--_0x14a35b){_0x59ad91['push'](_0x59ad91['shift']());}};_0x2b0043(++_0x18e334);}(_0xa4e9,0x12d));var _0x9a4e=function(_0x21af07,_0x5d5a49){_0x21af07=_0x21af07-0x0;var _0x1fb729=_0xa4e9[_0x21af07];return _0x1fb729;};'use strict';var FaxAccountEvents=require(_0x9a4e('0x0'));var events=[_0x9a4e('0x1'),_0x9a4e('0x2'),'update'];function createListener(_0x1015e6,_0x5930b5){return function(_0x52f6ce){_0x5930b5[_0x9a4e('0x3')](_0x1015e6,_0x52f6ce);};}function removeListener(_0xf91648,_0x42d7ce){return function(){FaxAccountEvents[_0x9a4e('0x4')](_0xf91648,_0x42d7ce);};}exports[_0x9a4e('0x5')]=function(_0x4efa3a){for(var _0x3e72e9=0x0,_0x3433e9=events['length'];_0x3e72e9<_0x3433e9;_0x3e72e9++){var _0x2f2dcb=events[_0x3e72e9];var _0x5b42ca=createListener(_0x9a4e('0x6')+_0x2f2dcb,_0x4efa3a);FaxAccountEvents['on'](_0x2f2dcb,_0x5b42ca);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 280d438..4a9f54f 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(_0x30e6f1,_0x1a21e0){var _0x37a27e=function(_0x27490f){while(--_0x27490f){_0x30e6f1['push'](_0x30e6f1['shift']());}};_0x37a27e(++_0x1a21e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x5b7449,_0x195288){var _0x41a13c=function(_0x5ad0e0){while(--_0x5ad0e0){_0x5b7449['push'](_0x5b7449['shift']());}};_0x41a13c(++_0x195288);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 bb72966..f13da61 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 _0x5f7d=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x55e22a,_0x189244){var _0x8949e0=function(_0x47a719){while(--_0x47a719){_0x55e22a['push'](_0x55e22a['shift']());}};_0x8949e0(++_0x189244);}(_0x5f7d,0x1c3));var _0xd5f7=function(_0x4dc00b,_0x229642){_0x4dc00b=_0x4dc00b-0x0;var _0x38a107=_0x5f7d[_0x4dc00b];return _0x38a107;};'use strict';var Sequelize=require(_0xd5f7('0x0'));module[_0xd5f7('0x1')]={'priority':{'type':Sequelize[_0xd5f7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd5f7('0x3')],'allowNull':![],'defaultValue':_0xd5f7('0x4')},'appdata':{'type':Sequelize[_0xd5f7('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd5f7('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xcedb=['exports','INTEGER','STRING'];(function(_0x4c5b19,_0x4d16ac){var _0x245588=function(_0x7e72b2){while(--_0x7e72b2){_0x4c5b19['push'](_0x4c5b19['shift']());}};_0x245588(++_0x4d16ac);}(_0xcedb,0x13e));var _0xbced=function(_0x5a32a1,_0x5ac832){_0x5a32a1=_0x5a32a1-0x0;var _0x4d3d14=_0xcedb[_0x5a32a1];return _0x4d3d14;};'use strict';var Sequelize=require('sequelize');module[_0xbced('0x0')]={'priority':{'type':Sequelize[_0xbced('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbced('0x2')]},'interval':{'type':Sequelize[_0xbced('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 46ebce8..a8483d6 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 _0x3c67=['then','destroy','stack','name','send','FaxApplication','rawAttributes','fieldName','type','key','filters','intersection','attributes','model','query','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update'];(function(_0x5118ed,_0x3cb253){var _0x451418=function(_0x15a863){while(--_0x15a863){_0x5118ed['push'](_0x5118ed['shift']());}};_0x451418(++_0x3cb253);}(_0x3c67,0x150));var _0x73c6=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x3c67[_0x2235bf];return _0x4c3a64;};'use strict';var emlformat=require(_0x73c6('0x0'));var rimraf=require(_0x73c6('0x1'));var zipdir=require(_0x73c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73c6('0x3'));var moment=require(_0x73c6('0x4'));var BPromise=require(_0x73c6('0x5'));var Mustache=require(_0x73c6('0x6'));var util=require(_0x73c6('0x7'));var path=require(_0x73c6('0x8'));var sox=require(_0x73c6('0x9'));var csv=require(_0x73c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x73c6('0xb'));var _=require('lodash');var squel=require(_0x73c6('0xc'));var crypto=require(_0x73c6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x73c6('0xe'));var toCsv=require(_0x73c6('0xa'));var querystring=require(_0x73c6('0xf'));var Papa=require('papaparse');var Redis=require(_0x73c6('0x10'));var authService=require(_0x73c6('0x11'));var qs=require(_0x73c6('0x12'));var as=require(_0x73c6('0x13'));var hardwareService=require(_0x73c6('0x14'));var logger=require(_0x73c6('0x15'))(_0x73c6('0x16'));var utils=require(_0x73c6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x73c6('0x18'));var db=require(_0x73c6('0x19'))['db'];function respondWithStatusCode(_0x5ee147,_0x28f57d){_0x28f57d=_0x28f57d||0xcc;return function(_0x131471){if(_0x131471){return _0x5ee147[_0x73c6('0x1a')](_0x28f57d);}return _0x5ee147[_0x73c6('0x1b')](_0x28f57d)[_0x73c6('0x1c')]();};}function respondWithResult(_0x565c94,_0x5533d6){_0x5533d6=_0x5533d6||0xc8;return function(_0x1cbae6){if(_0x1cbae6){return _0x565c94['status'](_0x5533d6)['json'](_0x1cbae6);}};}function respondWithFilteredResult(_0x46d68b,_0x574d1b){return function(_0x4905a2){if(_0x4905a2){var _0x102b6a=typeof _0x574d1b[_0x73c6('0x1d')]===_0x73c6('0x1e')&&typeof _0x574d1b[_0x73c6('0x1f')]===_0x73c6('0x1e');var _0xdfeda2=_0x4905a2[_0x73c6('0x20')];var _0x523992=_0x102b6a?0x0:_0x574d1b[_0x73c6('0x1d')];var _0x4f40f3=_0x102b6a?_0x4905a2[_0x73c6('0x20')]:_0x574d1b[_0x73c6('0x1d')]+_0x574d1b[_0x73c6('0x1f')];var _0x118df1;if(_0x4f40f3>=_0xdfeda2){_0x4f40f3=_0xdfeda2;_0x118df1=0xc8;}else{_0x118df1=0xce;}_0x46d68b['status'](_0x118df1);return _0x46d68b[_0x73c6('0x21')]('Content-Range',_0x523992+'-'+_0x4f40f3+'/'+_0xdfeda2)[_0x73c6('0x22')](_0x4905a2);}return null;};}function patchUpdates(_0x3eaee3){return function(_0x1320a3){try{jsonpatch[_0x73c6('0x23')](_0x1320a3,_0x3eaee3,!![]);}catch(_0x3db78c){return BPromise[_0x73c6('0x24')](_0x3db78c);}return _0x1320a3[_0x73c6('0x25')]();};}function saveUpdates(_0x2546a9,_0x28ac58){return function(_0x1c1fcd){if(_0x1c1fcd){return _0x1c1fcd[_0x73c6('0x26')](_0x2546a9)[_0x73c6('0x27')](function(_0x143278){return _0x143278;});}return null;};}function removeEntity(_0x27e35d,_0x1cad12){return function(_0x342329){if(_0x342329){return _0x342329[_0x73c6('0x28')]()[_0x73c6('0x27')](function(){_0x27e35d[_0x73c6('0x1b')](0xcc)[_0x73c6('0x1c')]();});}};}function handleEntityNotFound(_0x1fd45a,_0x370a69){return function(_0x1c5fc9){if(!_0x1c5fc9){_0x1fd45a[_0x73c6('0x1a')](0x194);}return _0x1c5fc9;};}function handleError(_0x53912b,_0x556fe6){_0x556fe6=_0x556fe6||0x1f4;return function(_0x3637d4){logger['error'](_0x3637d4[_0x73c6('0x29')]);if(_0x3637d4[_0x73c6('0x2a')]){delete _0x3637d4['name'];}_0x53912b[_0x73c6('0x1b')](_0x556fe6)[_0x73c6('0x2b')](_0x3637d4);};}exports['index']=function(_0x2805bd,_0x184345){var _0x37891d={},_0x5cbf73={},_0x5533a0={'count':0x0,'rows':[]};var _0x55400d=_['map'](db[_0x73c6('0x2c')][_0x73c6('0x2d')],function(_0x4ce1cf){return{'name':_0x4ce1cf[_0x73c6('0x2e')],'type':_0x4ce1cf[_0x73c6('0x2f')][_0x73c6('0x30')]};});_0x5cbf73['model']=_['map'](_0x55400d,_0x73c6('0x2a'));_0x5cbf73['query']=_['keys'](_0x2805bd['query']);_0x5cbf73[_0x73c6('0x31')]=_[_0x73c6('0x32')](_0x5cbf73['model'],_0x5cbf73['query']);_0x37891d[_0x73c6('0x33')]=_['intersection'](_0x5cbf73[_0x73c6('0x34')],qs['fields'](_0x2805bd[_0x73c6('0x35')][_0x73c6('0x36')]));_0x37891d[_0x73c6('0x33')]=_0x37891d[_0x73c6('0x33')][_0x73c6('0x37')]?_0x37891d[_0x73c6('0x33')]:_0x5cbf73[_0x73c6('0x34')];if(!_0x2805bd[_0x73c6('0x35')]['hasOwnProperty'](_0x73c6('0x38'))){_0x37891d[_0x73c6('0x1f')]=qs['limit'](_0x2805bd['query'][_0x73c6('0x1f')]);_0x37891d[_0x73c6('0x1d')]=qs[_0x73c6('0x1d')](_0x2805bd[_0x73c6('0x35')][_0x73c6('0x1d')]);}_0x37891d[_0x73c6('0x39')]=qs['sort'](_0x2805bd[_0x73c6('0x35')][_0x73c6('0x3a')]);_0x37891d[_0x73c6('0x3b')]=qs[_0x73c6('0x31')](_['pick'](_0x2805bd[_0x73c6('0x35')],_0x5cbf73[_0x73c6('0x31')]),_0x55400d);if(_0x2805bd[_0x73c6('0x35')][_0x73c6('0x3c')]){_0x37891d[_0x73c6('0x3b')]=_[_0x73c6('0x3d')](_0x37891d['where'],{'$or':_[_0x73c6('0x3e')](_0x55400d,function(_0x4299bd){if(_0x4299bd[_0x73c6('0x2f')]!==_0x73c6('0x3f')){var _0x14ac0f={};_0x14ac0f[_0x4299bd[_0x73c6('0x2a')]]={'$like':'%'+_0x2805bd[_0x73c6('0x35')][_0x73c6('0x3c')]+'%'};return _0x14ac0f;}})});}_0x37891d=_[_0x73c6('0x3d')]({},_0x37891d,_0x2805bd[_0x73c6('0x40')]);var _0x38db77={'where':_0x37891d[_0x73c6('0x3b')]};return db[_0x73c6('0x2c')]['count'](_0x38db77)[_0x73c6('0x27')](function(_0x1ec410){_0x5533a0[_0x73c6('0x20')]=_0x1ec410;if(_0x2805bd[_0x73c6('0x35')][_0x73c6('0x41')]){_0x37891d[_0x73c6('0x42')]=[{'all':!![]}];}return db[_0x73c6('0x2c')][_0x73c6('0x43')](_0x37891d);})[_0x73c6('0x27')](function(_0x5107d7){_0x5533a0['rows']=_0x5107d7;return _0x5533a0;})[_0x73c6('0x27')](respondWithFilteredResult(_0x184345,_0x37891d))[_0x73c6('0x44')](handleError(_0x184345,null));};exports[_0x73c6('0x45')]=function(_0x19a9e3,_0x4f003f){var _0x43414b={'raw':!![],'where':{'id':_0x19a9e3[_0x73c6('0x46')]['id']}},_0x31ba5d={};_0x31ba5d[_0x73c6('0x34')]=_['keys'](db['FaxApplication'][_0x73c6('0x2d')]);_0x31ba5d[_0x73c6('0x35')]=_[_0x73c6('0x47')](_0x19a9e3[_0x73c6('0x35')]);_0x31ba5d[_0x73c6('0x31')]=_['intersection'](_0x31ba5d['model'],_0x31ba5d['query']);_0x43414b['attributes']=_[_0x73c6('0x32')](_0x31ba5d['model'],qs[_0x73c6('0x36')](_0x19a9e3[_0x73c6('0x35')]['fields']));_0x43414b[_0x73c6('0x33')]=_0x43414b[_0x73c6('0x33')][_0x73c6('0x37')]?_0x43414b['attributes']:_0x31ba5d[_0x73c6('0x34')];if(_0x19a9e3[_0x73c6('0x35')][_0x73c6('0x41')]){_0x43414b['include']=[{'all':!![]}];}_0x43414b=_[_0x73c6('0x3d')]({},_0x43414b,_0x19a9e3[_0x73c6('0x40')]);return db[_0x73c6('0x2c')][_0x73c6('0x48')](_0x43414b)[_0x73c6('0x27')](handleEntityNotFound(_0x4f003f,null))[_0x73c6('0x27')](respondWithResult(_0x4f003f,null))['catch'](handleError(_0x4f003f,null));};exports[_0x73c6('0x49')]=function(_0x4e0d6c,_0x1e0a26){return db[_0x73c6('0x2c')][_0x73c6('0x49')](_0x4e0d6c[_0x73c6('0x4a')],{})[_0x73c6('0x27')](respondWithResult(_0x1e0a26,0xc9))[_0x73c6('0x44')](handleError(_0x1e0a26,null));};exports['update']=function(_0x9f559,_0xaee8e5){if(_0x9f559[_0x73c6('0x4a')]['id']){delete _0x9f559['body']['id'];}return db[_0x73c6('0x2c')][_0x73c6('0x48')]({'where':{'id':_0x9f559['params']['id']}})[_0x73c6('0x27')](handleEntityNotFound(_0xaee8e5,null))[_0x73c6('0x27')](saveUpdates(_0x9f559[_0x73c6('0x4a')],null))[_0x73c6('0x27')](respondWithResult(_0xaee8e5,null))[_0x73c6('0x44')](handleError(_0xaee8e5,null));};exports['destroy']=function(_0xee46ac,_0x3c6b2b){return db['FaxApplication'][_0x73c6('0x48')]({'where':{'id':_0xee46ac[_0x73c6('0x46')]['id']}})[_0x73c6('0x27')](handleEntityNotFound(_0x3c6b2b,null))['then'](removeEntity(_0x3c6b2b,null))[_0x73c6('0x44')](handleError(_0x3c6b2b,null));}; \ No newline at end of file +var _0x6948=['name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','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','end','json','offset','limit','count','set','Content-Range','reject','update','destroy','then','error','stack'];(function(_0x2b9316,_0x26a84f){var _0x27fc1d=function(_0x18ca01){while(--_0x18ca01){_0x2b9316['push'](_0x2b9316['shift']());}};_0x27fc1d(++_0x26a84f);}(_0x6948,0x153));var _0x8694=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6948[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8694('0x0'));var zipdir=require(_0x8694('0x1'));var jsonpatch=require(_0x8694('0x2'));var rp=require(_0x8694('0x3'));var moment=require(_0x8694('0x4'));var BPromise=require(_0x8694('0x5'));var Mustache=require(_0x8694('0x6'));var util=require(_0x8694('0x7'));var path=require(_0x8694('0x8'));var sox=require(_0x8694('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8694('0xa'));var _=require(_0x8694('0xb'));var squel=require(_0x8694('0xc'));var crypto=require(_0x8694('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8694('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8694('0xf'));var Redis=require(_0x8694('0x10'));var authService=require(_0x8694('0x11'));var qs=require(_0x8694('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8694('0x13'));var logger=require(_0x8694('0x14'))(_0x8694('0x15'));var utils=require(_0x8694('0x16'));var config=require(_0x8694('0x17'));var licenseUtil=require(_0x8694('0x18'));var db=require(_0x8694('0x19'))['db'];function respondWithStatusCode(_0x45a10a,_0x2c6ac1){_0x2c6ac1=_0x2c6ac1||0xcc;return function(_0x4f2d5e){if(_0x4f2d5e){return _0x45a10a[_0x8694('0x1a')](_0x2c6ac1);}return _0x45a10a[_0x8694('0x1b')](_0x2c6ac1)[_0x8694('0x1c')]();};}function respondWithResult(_0x20ffe9,_0x332bd2){_0x332bd2=_0x332bd2||0xc8;return function(_0x1447ce){if(_0x1447ce){return _0x20ffe9[_0x8694('0x1b')](_0x332bd2)[_0x8694('0x1d')](_0x1447ce);}};}function respondWithFilteredResult(_0x34a5d3,_0x4c486c){return function(_0xb9877a){if(_0xb9877a){var _0x641941=typeof _0x4c486c[_0x8694('0x1e')]==='undefined'&&typeof _0x4c486c[_0x8694('0x1f')]==='undefined';var _0x635477=_0xb9877a[_0x8694('0x20')];var _0x1e4ab7=_0x641941?0x0:_0x4c486c[_0x8694('0x1e')];var _0x4d950a=_0x641941?_0xb9877a['count']:_0x4c486c[_0x8694('0x1e')]+_0x4c486c['limit'];var _0x2198cc;if(_0x4d950a>=_0x635477){_0x4d950a=_0x635477;_0x2198cc=0xc8;}else{_0x2198cc=0xce;}_0x34a5d3[_0x8694('0x1b')](_0x2198cc);return _0x34a5d3[_0x8694('0x21')](_0x8694('0x22'),_0x1e4ab7+'-'+_0x4d950a+'/'+_0x635477)[_0x8694('0x1d')](_0xb9877a);}return null;};}function patchUpdates(_0x587044){return function(_0x326f2d){try{jsonpatch['apply'](_0x326f2d,_0x587044,!![]);}catch(_0x5c6d79){return BPromise[_0x8694('0x23')](_0x5c6d79);}return _0x326f2d['save']();};}function saveUpdates(_0x11874b,_0x3683a9){return function(_0xbcc75b){if(_0xbcc75b){return _0xbcc75b[_0x8694('0x24')](_0x11874b)['then'](function(_0x2927ac){return _0x2927ac;});}return null;};}function removeEntity(_0x15f391,_0x589e3c){return function(_0x1d1bf8){if(_0x1d1bf8){return _0x1d1bf8[_0x8694('0x25')]()[_0x8694('0x26')](function(){_0x15f391['status'](0xcc)[_0x8694('0x1c')]();});}};}function handleEntityNotFound(_0x44ff1f,_0x38c43c){return function(_0x101c93){if(!_0x101c93){_0x44ff1f[_0x8694('0x1a')](0x194);}return _0x101c93;};}function handleError(_0x2e300e,_0x1b8380){_0x1b8380=_0x1b8380||0x1f4;return function(_0x4fa651){logger[_0x8694('0x27')](_0x4fa651[_0x8694('0x28')]);if(_0x4fa651[_0x8694('0x29')]){delete _0x4fa651['name'];}_0x2e300e[_0x8694('0x1b')](_0x1b8380)[_0x8694('0x2a')](_0x4fa651);};}exports[_0x8694('0x2b')]=function(_0x4a5ef5,_0x378aff){var _0x46600f={},_0x2f9fe4={},_0x3bc998={'count':0x0,'rows':[]};var _0x1f6b50=_[_0x8694('0x2c')](db[_0x8694('0x2d')][_0x8694('0x2e')],function(_0x284231){return{'name':_0x284231[_0x8694('0x2f')],'type':_0x284231[_0x8694('0x30')][_0x8694('0x31')]};});_0x2f9fe4[_0x8694('0x32')]=_[_0x8694('0x2c')](_0x1f6b50,_0x8694('0x29'));_0x2f9fe4[_0x8694('0x33')]=_[_0x8694('0x34')](_0x4a5ef5[_0x8694('0x33')]);_0x2f9fe4['filters']=_[_0x8694('0x35')](_0x2f9fe4['model'],_0x2f9fe4[_0x8694('0x33')]);_0x46600f[_0x8694('0x36')]=_[_0x8694('0x35')](_0x2f9fe4['model'],qs[_0x8694('0x37')](_0x4a5ef5['query'][_0x8694('0x37')]));_0x46600f[_0x8694('0x36')]=_0x46600f['attributes'][_0x8694('0x38')]?_0x46600f['attributes']:_0x2f9fe4[_0x8694('0x32')];if(!_0x4a5ef5[_0x8694('0x33')][_0x8694('0x39')](_0x8694('0x3a'))){_0x46600f[_0x8694('0x1f')]=qs[_0x8694('0x1f')](_0x4a5ef5[_0x8694('0x33')][_0x8694('0x1f')]);_0x46600f[_0x8694('0x1e')]=qs[_0x8694('0x1e')](_0x4a5ef5[_0x8694('0x33')][_0x8694('0x1e')]);}_0x46600f[_0x8694('0x3b')]=qs[_0x8694('0x3c')](_0x4a5ef5[_0x8694('0x33')]['sort']);_0x46600f[_0x8694('0x3d')]=qs[_0x8694('0x3e')](_['pick'](_0x4a5ef5[_0x8694('0x33')],_0x2f9fe4[_0x8694('0x3e')]),_0x1f6b50);if(_0x4a5ef5['query'][_0x8694('0x3f')]){_0x46600f['where']=_['merge'](_0x46600f[_0x8694('0x3d')],{'$or':_[_0x8694('0x2c')](_0x1f6b50,function(_0x23cb97){if(_0x23cb97[_0x8694('0x30')]!=='VIRTUAL'){var _0x2645da={};_0x2645da[_0x23cb97[_0x8694('0x29')]]={'$like':'%'+_0x4a5ef5[_0x8694('0x33')]['filter']+'%'};return _0x2645da;}})});}_0x46600f=_['merge']({},_0x46600f,_0x4a5ef5[_0x8694('0x40')]);var _0x33749b={'where':_0x46600f['where']};return db['FaxApplication'][_0x8694('0x20')](_0x33749b)[_0x8694('0x26')](function(_0x3c6a0f){_0x3bc998[_0x8694('0x20')]=_0x3c6a0f;if(_0x4a5ef5[_0x8694('0x33')][_0x8694('0x41')]){_0x46600f[_0x8694('0x42')]=[{'all':!![]}];}return db[_0x8694('0x2d')][_0x8694('0x43')](_0x46600f);})['then'](function(_0x34fff8){_0x3bc998[_0x8694('0x44')]=_0x34fff8;return _0x3bc998;})[_0x8694('0x26')](respondWithFilteredResult(_0x378aff,_0x46600f))[_0x8694('0x45')](handleError(_0x378aff,null));};exports[_0x8694('0x46')]=function(_0x327479,_0x5f5558){var _0x5825c9={'raw':!![],'where':{'id':_0x327479[_0x8694('0x47')]['id']}},_0xfd52c={};_0xfd52c[_0x8694('0x32')]=_[_0x8694('0x34')](db[_0x8694('0x2d')][_0x8694('0x2e')]);_0xfd52c[_0x8694('0x33')]=_[_0x8694('0x34')](_0x327479[_0x8694('0x33')]);_0xfd52c[_0x8694('0x3e')]=_[_0x8694('0x35')](_0xfd52c['model'],_0xfd52c['query']);_0x5825c9[_0x8694('0x36')]=_[_0x8694('0x35')](_0xfd52c['model'],qs['fields'](_0x327479[_0x8694('0x33')]['fields']));_0x5825c9[_0x8694('0x36')]=_0x5825c9[_0x8694('0x36')]['length']?_0x5825c9[_0x8694('0x36')]:_0xfd52c[_0x8694('0x32')];if(_0x327479[_0x8694('0x33')][_0x8694('0x41')]){_0x5825c9[_0x8694('0x42')]=[{'all':!![]}];}_0x5825c9=_[_0x8694('0x48')]({},_0x5825c9,_0x327479[_0x8694('0x40')]);return db[_0x8694('0x2d')]['find'](_0x5825c9)[_0x8694('0x26')](handleEntityNotFound(_0x5f5558,null))[_0x8694('0x26')](respondWithResult(_0x5f5558,null))[_0x8694('0x45')](handleError(_0x5f5558,null));};exports[_0x8694('0x49')]=function(_0x4f24b1,_0x48a5d6){return db[_0x8694('0x2d')][_0x8694('0x49')](_0x4f24b1[_0x8694('0x4a')],{})[_0x8694('0x26')](respondWithResult(_0x48a5d6,0xc9))['catch'](handleError(_0x48a5d6,null));};exports['update']=function(_0x124565,_0x519eeb){if(_0x124565[_0x8694('0x4a')]['id']){delete _0x124565[_0x8694('0x4a')]['id'];}return db[_0x8694('0x2d')][_0x8694('0x4b')]({'where':{'id':_0x124565[_0x8694('0x47')]['id']}})[_0x8694('0x26')](handleEntityNotFound(_0x519eeb,null))[_0x8694('0x26')](saveUpdates(_0x124565[_0x8694('0x4a')],null))[_0x8694('0x26')](respondWithResult(_0x519eeb,null))[_0x8694('0x45')](handleError(_0x519eeb,null));};exports[_0x8694('0x25')]=function(_0x4f9d3c,_0x9187f1){return db[_0x8694('0x2d')][_0x8694('0x4b')]({'where':{'id':_0x4f9d3c[_0x8694('0x47')]['id']}})[_0x8694('0x26')](handleEntityNotFound(_0x9187f1,null))[_0x8694('0x26')](removeEntity(_0x9187f1,null))['catch'](handleError(_0x9187f1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bb57134..0d6959b 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 _0x53f6=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x53f6,0xf5));var _0x653f=function(_0x5887ec,_0x504c12){_0x5887ec=_0x5887ec-0x0;var _0x23b637=_0x53f6[_0x5887ec];return _0x23b637;};'use strict';var _=require(_0x653f('0x0'));var util=require(_0x653f('0x1'));var logger=require(_0x653f('0x2'))(_0x653f('0x3'));var moment=require(_0x653f('0x4'));var BPromise=require(_0x653f('0x5'));var rp=require(_0x653f('0x6'));var fs=require('fs');var path=require(_0x653f('0x7'));var rimraf=require(_0x653f('0x8'));var config=require(_0x653f('0x9'));var attributes=require(_0x653f('0xa'));module[_0x653f('0xb')]=function(_0x5d1cc1,_0x191098){return _0x5d1cc1[_0x653f('0xc')]('FaxApplication',attributes,{'tableName':_0x653f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x07b1=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x07b1,0x7e));var _0x107b=function(_0x3f49eb,_0x7a6565){_0x3f49eb=_0x3f49eb-0x0;var _0x4a297d=_0x07b1[_0x3f49eb];return _0x4a297d;};'use strict';var _=require(_0x107b('0x0'));var util=require('util');var logger=require(_0x107b('0x1'))(_0x107b('0x2'));var moment=require(_0x107b('0x3'));var BPromise=require('bluebird');var rp=require(_0x107b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x107b('0x5'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x107b('0x6')]=function(_0x3f786e,_0x7cc2d2){return _0x3f786e[_0x107b('0x7')](_0x107b('0x8'),attributes,{'tableName':_0x107b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x107b('0xa'),'collate':_0x107b('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c2da72d..549012b 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 _0x0f17=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','FaxApplication','update','body','raw','options','where','attributes','limit','UpdateFaxApplication','stringify','lodash','moment','bluebird','randomstring'];(function(_0x28933e,_0x49776e){var _0x3b5e37=function(_0x1c11c6){while(--_0x1c11c6){_0x28933e['push'](_0x28933e['shift']());}};_0x3b5e37(++_0x49776e);}(_0x0f17,0x18f));var _0x70f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f17[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70f1('0x0'));var util=require('util');var moment=require(_0x70f1('0x1'));var BPromise=require(_0x70f1('0x2'));var rs=require(_0x70f1('0x3'));var fs=require('fs');var Redis=require(_0x70f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x70f1('0x5'));var logger=require('../../config/logger')(_0x70f1('0x6'));var config=require(_0x70f1('0x7'));var jayson=require(_0x70f1('0x8'));var client=jayson['client'][_0x70f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x387392,_0x117fd1,_0x20de1e){return new BPromise(function(_0x874ad7,_0x493282){return client[_0x70f1('0xa')](_0x387392,_0x20de1e)[_0x70f1('0xb')](function(_0x58f022){logger[_0x70f1('0xc')](_0x70f1('0xd'),_0x117fd1,'request\x20sent');logger[_0x70f1('0xe')](_0x70f1('0xf'),_0x117fd1,'request\x20sent',JSON['stringify'](_0x58f022));if(_0x58f022[_0x70f1('0x10')]){if(_0x58f022[_0x70f1('0x10')][_0x70f1('0x11')]===0x1f4){logger['error'](_0x70f1('0xd'),_0x117fd1,_0x58f022[_0x70f1('0x10')][_0x70f1('0x12')]);return _0x493282(_0x58f022['error'][_0x70f1('0x12')]);}logger[_0x70f1('0x10')](_0x70f1('0xd'),_0x117fd1,_0x58f022[_0x70f1('0x10')][_0x70f1('0x12')]);return _0x874ad7(_0x58f022[_0x70f1('0x10')][_0x70f1('0x12')]);}else{logger[_0x70f1('0xc')](_0x70f1('0xd'),_0x117fd1,_0x70f1('0x13'));_0x874ad7(_0x58f022[_0x70f1('0x14')][_0x70f1('0x12')]);}})['catch'](function(_0x2f2710){logger[_0x70f1('0x10')](_0x70f1('0xd'),_0x117fd1,_0x2f2710);_0x493282(_0x2f2710);});});}exports['UpdateFaxApplication']=function(_0x37f90b){var _0x10cdd3=this;return new Promise(function(_0xe6bf2f,_0x52e055){return db[_0x70f1('0x15')][_0x70f1('0x16')](_0x37f90b[_0x70f1('0x17')],{'raw':_0x37f90b['options']?_0x37f90b['options'][_0x70f1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37f90b[_0x70f1('0x19')]?_0x37f90b[_0x70f1('0x19')][_0x70f1('0x1a')]||null:null,'attributes':_0x37f90b['options']?_0x37f90b['options'][_0x70f1('0x1b')]||null:null,'limit':_0x37f90b[_0x70f1('0x19')]?_0x37f90b[_0x70f1('0x19')][_0x70f1('0x1c')]||null:null})['then'](function(_0x3c0c52){logger[_0x70f1('0xc')](_0x70f1('0x1d'),_0x37f90b);logger[_0x70f1('0xe')](_0x70f1('0x1d'),_0x37f90b,JSON[_0x70f1('0x1e')](_0x3c0c52));_0xe6bf2f(_0x3c0c52);})['catch'](function(_0xef3afb){logger[_0x70f1('0x10')](_0x70f1('0x1d'),_0xef3afb[_0x70f1('0x12')],_0x37f90b);_0x52e055(_0x10cdd3[_0x70f1('0x10')](0x1f4,_0xef3afb[_0x70f1('0x12')]));});});}; \ No newline at end of file +var _0xba4e=['info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','FaxApplication','body','options','raw','where','limit','UpdateFaxApplication','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xfdb5fc,_0x9b7667){var _0x2a4826=function(_0x3e6981){while(--_0x3e6981){_0xfdb5fc['push'](_0xfdb5fc['shift']());}};_0x2a4826(++_0x9b7667);}(_0xba4e,0x67));var _0xeba4=function(_0x291ec3,_0x2f19a7){_0x291ec3=_0x291ec3-0x0;var _0x423b99=_0xba4e[_0x291ec3];return _0x423b99;};'use strict';var _=require(_0xeba4('0x0'));var util=require(_0xeba4('0x1'));var moment=require('moment');var BPromise=require(_0xeba4('0x2'));var rs=require(_0xeba4('0x3'));var fs=require('fs');var Redis=require(_0xeba4('0x4'));var db=require(_0xeba4('0x5'))['db'];var utils=require(_0xeba4('0x6'));var logger=require('../../config/logger')(_0xeba4('0x7'));var config=require(_0xeba4('0x8'));var jayson=require(_0xeba4('0x9'));var client=jayson['client'][_0xeba4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5068c8,_0x21ee86,_0x3c3490){return new BPromise(function(_0x591550,_0x5a234d){return client[_0xeba4('0xb')](_0x5068c8,_0x3c3490)[_0xeba4('0xc')](function(_0x236c0c){logger[_0xeba4('0xd')]('FaxApplication,\x20%s,\x20%s',_0x21ee86,_0xeba4('0xe'));logger['debug'](_0xeba4('0xf'),_0x21ee86,_0xeba4('0xe'),JSON[_0xeba4('0x10')](_0x236c0c));if(_0x236c0c['error']){if(_0x236c0c[_0xeba4('0x11')]['code']===0x1f4){logger[_0xeba4('0x11')](_0xeba4('0x12'),_0x21ee86,_0x236c0c[_0xeba4('0x11')][_0xeba4('0x13')]);return _0x5a234d(_0x236c0c[_0xeba4('0x11')]['message']);}logger[_0xeba4('0x11')](_0xeba4('0x12'),_0x21ee86,_0x236c0c[_0xeba4('0x11')][_0xeba4('0x13')]);return _0x591550(_0x236c0c['error'][_0xeba4('0x13')]);}else{logger['info'](_0xeba4('0x12'),_0x21ee86,'request\x20sent');_0x591550(_0x236c0c['result'][_0xeba4('0x13')]);}})['catch'](function(_0x486860){logger[_0xeba4('0x11')](_0xeba4('0x12'),_0x21ee86,_0x486860);_0x5a234d(_0x486860);});});}exports['UpdateFaxApplication']=function(_0xdb2147){var _0x4896df=this;return new Promise(function(_0x28e3c6,_0x59b728){return db[_0xeba4('0x14')]['update'](_0xdb2147[_0xeba4('0x15')],{'raw':_0xdb2147[_0xeba4('0x16')]?_0xdb2147['options'][_0xeba4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdb2147[_0xeba4('0x16')]?_0xdb2147[_0xeba4('0x16')][_0xeba4('0x18')]||null:null,'attributes':_0xdb2147[_0xeba4('0x16')]?_0xdb2147[_0xeba4('0x16')]['attributes']||null:null,'limit':_0xdb2147['options']?_0xdb2147[_0xeba4('0x16')][_0xeba4('0x19')]||null:null})[_0xeba4('0xc')](function(_0x102da7){logger[_0xeba4('0xd')](_0xeba4('0x1a'),_0xdb2147);logger[_0xeba4('0x1b')](_0xeba4('0x1a'),_0xdb2147,JSON[_0xeba4('0x10')](_0x102da7));_0x28e3c6(_0x102da7);})[_0xeba4('0x1c')](function(_0x22792c){logger[_0xeba4('0x11')](_0xeba4('0x1a'),_0x22792c['message'],_0xdb2147);_0x59b728(_0x4896df['error'](0x1f4,_0x22792c[_0xeba4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 42893e5..4c7bb67 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0xea3bfc,_0x6ecba8){var _0x46abd6=function(_0x2f544c){while(--_0x2f544c){_0xea3bfc['push'](_0xea3bfc['shift']());}};_0x46abd6(++_0x6ecba8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'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('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0xf7b4=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','connect-timeout'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4ae147,_0x48202e){_0x4ae147=_0x4ae147-0x0;var _0x49c225=_0xf7b4[_0x4ae147];return _0x49c225;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x8')](),controller['create']);router[_0x4f7b('0xd')](_0x4f7b('0xa'),auth['isAuthenticated'](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 6fdf91b..a98075e 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 _0x2ff5=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x4e0dfa,_0x508253){var _0x827bb9=function(_0x4567ea){while(--_0x4567ea){_0x4e0dfa['push'](_0x4e0dfa['shift']());}};_0x827bb9(++_0x508253);}(_0x2ff5,0x11d));var _0x52ff=function(_0x333e53,_0x1da09b){_0x333e53=_0x333e53-0x0;var _0x9f6712=_0x2ff5[_0x333e53];return _0x9f6712;};'use strict';var Sequelize=require(_0x52ff('0x0'));module['exports']={'closed':{'type':Sequelize[_0x52ff('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x52ff('0x2')]},'disposition':{'type':Sequelize[_0x52ff('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x52ff('0x3')]},'note':{'type':Sequelize[_0x52ff('0x3')]},'read1stAt':{'type':Sequelize[_0x52ff('0x2')]},'fax':{'type':Sequelize[_0x52ff('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x52ff('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x52ff('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x52ff('0x4')]('in',_0x52ff('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6ce7=['sequelize','exports','STRING','DATE','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ce7,0x102));var _0x76ce=function(_0xd063c5,_0x26a05b){_0xd063c5=_0xd063c5-0x0;var _0x35d0e7=_0x6ce7[_0xd063c5];return _0x35d0e7;};'use strict';var Sequelize=require(_0x76ce('0x0'));module[_0x76ce('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x76ce('0x2')]},'thirdDisposition':{'type':Sequelize[_0x76ce('0x2')]},'note':{'type':Sequelize[_0x76ce('0x2')]},'read1stAt':{'type':Sequelize[_0x76ce('0x3')]},'fax':{'type':Sequelize[_0x76ce('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x76ce('0x4')]('in',_0x76ce('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x76ce('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 8607cf7..72faa89 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 _0x4dbd=['join','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','waiting','answered','total','closed','UserId','talking','unmanaged','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','select','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','unreadMessages','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','params','intersection','includeAll','include','options','create','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp'];(function(_0x232475,_0x219f54){var _0x42bb32=function(_0x4188d7){while(--_0x4188d7){_0x232475['push'](_0x232475['shift']());}};_0x42bb32(++_0x219f54);}(_0x4dbd,0xf5));var _0xd4db=function(_0x1d67ba,_0x2b0e1b){_0x1d67ba=_0x1d67ba-0x0;var _0x5200d8=_0x4dbd[_0x1d67ba];return _0x5200d8;};'use strict';var emlformat=require(_0xd4db('0x0'));var rimraf=require(_0xd4db('0x1'));var zipdir=require(_0xd4db('0x2'));var jsonpatch=require(_0xd4db('0x3'));var rp=require(_0xd4db('0x4'));var moment=require(_0xd4db('0x5'));var BPromise=require(_0xd4db('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd4db('0x7'));var sox=require(_0xd4db('0x8'));var csv=require(_0xd4db('0x9'));var ejs=require(_0xd4db('0xa'));var fs=require('fs');var fs_extra=require(_0xd4db('0xb'));var _=require('lodash');var squel=require(_0xd4db('0xc'));var crypto=require(_0xd4db('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd4db('0xe'));var toCsv=require(_0xd4db('0x9'));var querystring=require('querystring');var Papa=require(_0xd4db('0xf'));var Redis=require(_0xd4db('0x10'));var authService=require(_0xd4db('0x11'));var qs=require(_0xd4db('0x12'));var as=require(_0xd4db('0x13'));var hardwareService=require(_0xd4db('0x14'));var logger=require(_0xd4db('0x15'))(_0xd4db('0x16'));var utils=require(_0xd4db('0x17'));var config=require(_0xd4db('0x18'));var licenseUtil=require(_0xd4db('0x19'));var db=require(_0xd4db('0x1a'))['db'];config[_0xd4db('0x1b')]=_['defaults'](config[_0xd4db('0x1b')],{'host':_0xd4db('0x1c'),'port':0x18eb});var socket=require(_0xd4db('0x1d'))(new Redis(config[_0xd4db('0x1b')]));require(_0xd4db('0x1e'))[_0xd4db('0x1f')](socket);function respondWithStatusCode(_0xd3dd66,_0x37be26){_0x37be26=_0x37be26||0xcc;return function(_0x11d18f){if(_0x11d18f){return _0xd3dd66[_0xd4db('0x20')](_0x37be26);}return _0xd3dd66[_0xd4db('0x21')](_0x37be26)[_0xd4db('0x22')]();};}function respondWithResult(_0x3a7481,_0x23faf4){_0x23faf4=_0x23faf4||0xc8;return function(_0x1e109d){if(_0x1e109d){return _0x3a7481[_0xd4db('0x21')](_0x23faf4)['json'](_0x1e109d);}};}function respondWithFilteredResult(_0xd3eccf,_0x3ab2cb){return function(_0x41804d){if(_0x41804d){var _0x1ba146=typeof _0x3ab2cb[_0xd4db('0x23')]==='undefined'&&typeof _0x3ab2cb[_0xd4db('0x24')]===_0xd4db('0x25');var _0x133e06=_0x41804d[_0xd4db('0x26')];var _0x403dae=_0x1ba146?0x0:_0x3ab2cb[_0xd4db('0x23')];var _0xc78898=_0x1ba146?_0x41804d['count']:_0x3ab2cb['offset']+_0x3ab2cb[_0xd4db('0x24')];var _0xfc4703;if(_0xc78898>=_0x133e06){_0xc78898=_0x133e06;_0xfc4703=0xc8;}else{_0xfc4703=0xce;}_0xd3eccf[_0xd4db('0x21')](_0xfc4703);return _0xd3eccf[_0xd4db('0x27')](_0xd4db('0x28'),_0x403dae+'-'+_0xc78898+'/'+_0x133e06)[_0xd4db('0x29')](_0x41804d);}return null;};}function patchUpdates(_0x1713de){return function(_0xd33d47){try{jsonpatch['apply'](_0xd33d47,_0x1713de,!![]);}catch(_0x45c816){return BPromise[_0xd4db('0x2a')](_0x45c816);}return _0xd33d47[_0xd4db('0x2b')]();};}function saveUpdates(_0x44f67d,_0x82f551){return function(_0x4572e8){if(_0x4572e8){return _0x4572e8['update'](_0x44f67d)[_0xd4db('0x2c')](function(_0x42c92b){return _0x42c92b;});}return null;};}function removeEntity(_0x969a13,_0x749055){return function(_0x4b115b){if(_0x4b115b){return _0x4b115b[_0xd4db('0x2d')]()[_0xd4db('0x2c')](function(){_0x969a13[_0xd4db('0x21')](0xcc)[_0xd4db('0x22')]();});}};}function handleEntityNotFound(_0x4151ee,_0x5158ff){return function(_0x46791f){if(!_0x46791f){_0x4151ee[_0xd4db('0x20')](0x194);}return _0x46791f;};}function handleError(_0x2e9f93,_0x144f5a){_0x144f5a=_0x144f5a||0x1f4;return function(_0x16eccb){logger[_0xd4db('0x2e')](_0x16eccb[_0xd4db('0x2f')]);if(_0x16eccb['name']){delete _0x16eccb[_0xd4db('0x30')];}_0x2e9f93[_0xd4db('0x21')](_0x144f5a)[_0xd4db('0x31')](_0x16eccb);};}function getInteractionUsers(_0x4a7879,_0x465a48){return new BPromise(function(_0x1409ca,_0x209076){try{if(_0x465a48[_0x4a7879['id']]){_0x4a7879[_0xd4db('0x32')]=_[_0xd4db('0x33')](_0x465a48[_0x4a7879['id']],function(_0x5ce1ad){return{'id':_0x5ce1ad['id'],'fullname':_0x5ce1ad[_0xd4db('0x34')]};});}}catch(_0xe7c5b){_0x209076(_0xe7c5b);}_0x1409ca(_0x4a7879);});}function getInteractionTags(_0x543fab,_0x36d971){return new BPromise(function(_0x3f2b8c,_0x27ca52){try{if(_0x543fab[_0xd4db('0x35')]){_0x543fab['Tags']=[];_0x543fab['TagIds'][_0xd4db('0x36')](',')[_0xd4db('0x37')](function(_0x297d00){_0x543fab[_0xd4db('0x38')][_0xd4db('0x39')](_0x36d971[_0x297d00]);});}delete _0x543fab[_0xd4db('0x35')];}catch(_0x59c34c){_0x27ca52(_0x59c34c);}_0x3f2b8c(_0x543fab);});}function updateFaxInteraction(_0x392e6c,_0x32a4e9,_0x26c2cc){return new BPromise(function(_0xc49d2a,_0x4f2944){return getInteractionUsers(_0x392e6c,_0x26c2cc)[_0xd4db('0x2c')](function(_0x14dcdf){return getInteractionTags(_0x14dcdf,_0x32a4e9);})[_0xd4db('0x2c')](function(_0x42e080){return getStateInteraction(_0x42e080);})['then'](function(_0x460ea2){_0xc49d2a(_0x460ea2);})[_0xd4db('0x3a')](function(_0x493cd6){_0x4f2944(_0x493cd6);});});}function getStateInteraction(_0x5c7f9a){return new BPromise(function(_0x57e639){_0x5c7f9a[_0xd4db('0x3b')]=0x0;_0x5c7f9a['talking']=0x0;_0x5c7f9a[_0xd4db('0x3c')]=0x0;_0x5c7f9a['unmanaged']=0x0;_0x5c7f9a[_0xd4db('0x3d')]=0x0;if(!_0x5c7f9a[_0xd4db('0x3e')]&&!_0x5c7f9a[_0xd4db('0x3f')]){_0x5c7f9a[_0xd4db('0x3b')]+=0x1;}if(!_0x5c7f9a[_0xd4db('0x3e')]&&_0x5c7f9a[_0xd4db('0x3f')]){_0x5c7f9a[_0xd4db('0x40')]+=0x1;if(_0x5c7f9a[_0xd4db('0x3b')]){_0x5c7f9a[_0xd4db('0x3b')]-=0x1;}}if(_0x5c7f9a[_0xd4db('0x3e')]&&_0x5c7f9a[_0xd4db('0x3f')]){_0x5c7f9a[_0xd4db('0x3c')]+=0x1;if(_0x5c7f9a[_0xd4db('0x40')]){_0x5c7f9a[_0xd4db('0x40')]-=0x1;}}if(_0x5c7f9a[_0xd4db('0x3e')]&&!_0x5c7f9a['UserId']){_0x5c7f9a[_0xd4db('0x41')]+=0x1;if(_0x5c7f9a[_0xd4db('0x3b')]){_0x5c7f9a[_0xd4db('0x3b')]-=0x1;}}_0x5c7f9a[_0xd4db('0x3d')]+=0x1;_0x57e639(_0x5c7f9a);});}exports[_0xd4db('0x42')]=function(_0x342386,_0x236b6f){var _0x6d1dd2={},_0x2c7999={},_0x2e56d1={'count':0x0,'rows':[]};var _0x15a0af=_[_0xd4db('0x33')](db[_0xd4db('0x43')][_0xd4db('0x44')],function(_0x54e8b1){return{'name':_0x54e8b1[_0xd4db('0x45')],'type':_0x54e8b1[_0xd4db('0x46')][_0xd4db('0x47')]};});_0x2c7999[_0xd4db('0x48')]=_['map'](_0x15a0af,_0xd4db('0x30'));_0x2c7999[_0xd4db('0x49')]=_[_0xd4db('0x4a')](_0x342386[_0xd4db('0x49')]);_0x2c7999['filters']=_['intersection'](_0x2c7999[_0xd4db('0x48')],_0x2c7999[_0xd4db('0x49')]);_0x6d1dd2[_0xd4db('0x4b')]=_['intersection'](_0x2c7999['model'],qs['fields'](_0x342386['query'][_0xd4db('0x4c')]));_0x6d1dd2[_0xd4db('0x4b')]=_0x6d1dd2[_0xd4db('0x4b')][_0xd4db('0x4d')]?_0x6d1dd2['attributes']:_0x2c7999[_0xd4db('0x48')];if(!_0x342386['query'][_0xd4db('0x4e')](_0xd4db('0x4f'))){_0x6d1dd2[_0xd4db('0x24')]=qs['limit'](_0x342386['query'][_0xd4db('0x24')]);_0x6d1dd2[_0xd4db('0x23')]=qs[_0xd4db('0x23')](_0x342386[_0xd4db('0x49')][_0xd4db('0x23')]);}_0x6d1dd2[_0xd4db('0x50')]=qs[_0xd4db('0x51')](_0x342386['query'][_0xd4db('0x51')]);_0x6d1dd2[_0xd4db('0x52')]=qs[_0xd4db('0x53')](_['pick'](_0x342386['query'],_0x2c7999[_0xd4db('0x53')]),_0x15a0af);var _0x38c1bd=[];var _0x264a04=squel['select']()[_0xd4db('0x54')]('id')['field'](_0xd4db('0x30'))[_0xd4db('0x54')](_0xd4db('0x55'))['from'](_0xd4db('0x56'));var _0x14765c=squel['select']()['field'](_0xd4db('0x57'))[_0xd4db('0x54')](_0xd4db('0x58'))['field'](_0xd4db('0x59'))[_0xd4db('0x5a')](_0xd4db('0x5b'),'ui')['left_join'](_0xd4db('0x5c'),'u',_0xd4db('0x5d'));var _0x7fd9f8=squel[_0xd4db('0x5e')]()[_0xd4db('0x5a')]('fax_interactions','i')[_0xd4db('0x5f')](_0xd4db('0x60'),'c',_0xd4db('0x61'))[_0xd4db('0x5f')]('users','o',_0xd4db('0x62'))[_0xd4db('0x5f')](_0xd4db('0x63'),'a',_0xd4db('0x64'))[_0xd4db('0x5f')](_0xd4db('0x65'),'me',_0xd4db('0x66'))[_0xd4db('0x5f')](_0xd4db('0x67'),'it',_0xd4db('0x68'))[_0xd4db('0x5f')](_0xd4db('0x56'),'t',_0xd4db('0x69'));var _0x5add37=squel[_0xd4db('0x6a')]();var _0x2f17e0=[];var _0xe0686=squel[_0xd4db('0x6a')]();var _0x588c3a;if(_0x342386[_0xd4db('0x49')][_0xd4db('0x6b')]){_0x588c3a=as[_0xd4db('0x6c')](_0x342386[_0xd4db('0x49')][_0xd4db('0x6b')]);var _0xc8fedb=_0x588c3a[_0xd4db('0x6d')];for(var _0x1d9425=0x0;_0x1d9425<_0x588c3a[_0xd4db('0x6e')][_0xd4db('0x4d')];_0x1d9425++){var _0x53eb9f=_0x588c3a[_0xd4db('0x6e')][_0x1d9425];var _0x2d1cf2='i';var _0x29ffcb=_['find'](_0x15a0af,[_0xd4db('0x30'),_0x53eb9f[_0xd4db('0x54')]]);if(!_0x29ffcb){switch(_0x53eb9f['field']){case'unreadMessages':if(_0x53eb9f['value']==0x1){_0x7fd9f8[_0xd4db('0x6f')]('`'+_0x53eb9f[_0xd4db('0x54')]+'`\x20=\x200');}else{_0x7fd9f8[_0xd4db('0x6f')]('`'+_0x53eb9f[_0xd4db('0x54')]+_0xd4db('0x70'));}break;case'Contact':if(_0x53eb9f[_0xd4db('0x71')]===_0xd4db('0x72')){if(_0x53eb9f[_0xd4db('0x73')]['split']('\x20')['length']>0x1){_0x5add37[_0xc8fedb](_0xd4db('0x74'),qs[_0xd4db('0x75')](_0x53eb9f[_0xd4db('0x73')]),null);}else{var _0x49c4ea='%'+_0x53eb9f[_0xd4db('0x73')]+'%';_0x5add37[_0xc8fedb](_0xd4db('0x76'),_0x49c4ea,_0x49c4ea,_0x49c4ea);}}else{_0x29ffcb=_[_0xd4db('0x77')](_0x15a0af,[_0xd4db('0x30'),_0xd4db('0x78')]);_0x53eb9f[_0xd4db('0x54')]=_0xd4db('0x78');_0x4a5b31=as[_0xd4db('0x79')](_0x2d1cf2,_0x29ffcb[_0xd4db('0x46')],_0x53eb9f);_0x5add37[_0xc8fedb](_0x4a5b31[_0xd4db('0x7a')],_0x4a5b31[_0xd4db('0x73')]['start'],_0x4a5b31['value'][_0xd4db('0x22')]);}break;case _0xd4db('0x7b'):var _0x8dd9d1=_0x53eb9f[_0xd4db('0x73')][_0xd4db('0x36')](',')[_0xd4db('0x33')](function(_0x1d42fd){return Number(_0x1d42fd);});_0x8dd9d1[_0xd4db('0x37')](function(_0x38b202){_0xe0686['or'](_0xd4db('0x7c'),'%,'+_0x38b202+',%');});_0x2f17e0=_['union'](_0x2f17e0,_0x8dd9d1);break;case _0xd4db('0x7d'):if(_0x53eb9f[_0xd4db('0x71')]===_0xd4db('0x72')){_0x5add37[_0xc8fedb](_0xd4db('0x7e'),'%'+_0x53eb9f[_0xd4db('0x73')]+'%',null);}else{_0x29ffcb=_[_0xd4db('0x77')](_0x15a0af,[_0xd4db('0x30'),_0xd4db('0x3f')]);_0x53eb9f['field']=_0xd4db('0x3f');_0x4a5b31=as[_0xd4db('0x79')](_0x2d1cf2,_0x29ffcb[_0xd4db('0x46')],_0x53eb9f);_0x5add37[_0xc8fedb](_0x4a5b31[_0xd4db('0x7a')],_0x4a5b31[_0xd4db('0x73')]['start'],_0x4a5b31[_0xd4db('0x73')][_0xd4db('0x22')]);}break;case _0xd4db('0x7f'):_0x4a5b31=as[_0xd4db('0x79')]('me',null,_0x53eb9f);_0x5add37[_0xc8fedb](_0x4a5b31[_0xd4db('0x7a')],_0x4a5b31[_0xd4db('0x73')][_0xd4db('0x80')],_0x4a5b31[_0xd4db('0x73')][_0xd4db('0x22')]);break;}}else{var _0x4a5b31=as[_0xd4db('0x79')](_0x2d1cf2,_0x29ffcb[_0xd4db('0x46')],_0x53eb9f);_0x5add37[_0xc8fedb](_0x4a5b31['text'],_0x4a5b31[_0xd4db('0x73')][_0xd4db('0x80')],_0x4a5b31[_0xd4db('0x73')][_0xd4db('0x22')]);}}}else{var _0x3aaebc=_(_0x342386[_0xd4db('0x49')])[_0xd4db('0x4a')]()[_0xd4db('0x33')](function(_0x5ef6b2){return _[_0xd4db('0x81')](_0x15a0af,['name',_0x5ef6b2])?_0x5ef6b2:undefined;})['compact']()[_0xd4db('0x73')]();if(!_[_0xd4db('0x82')](_0x3aaebc)){_0x3aaebc['forEach'](function(_0x24c74e){if(_0x24c74e===_0xd4db('0x83')){_0x7fd9f8[_0xd4db('0x52')](_0xd4db('0x84'),[]['concat'](_0x342386['query'][_0x24c74e]));}else if(_0x24c74e===_0xd4db('0x85')){var _0xff86ce=JSON['parse'](_0x342386['query'][_0x24c74e])['$gte'];var _0x4fa416=JSON[_0xd4db('0x86')](_0x342386[_0xd4db('0x49')][_0x24c74e])[_0xd4db('0x87')];_0x7fd9f8['where'](_0xd4db('0x88'),_0xff86ce,_0x4fa416);}else{if(_0x342386['query'][_0x24c74e]==='null'){_0x7fd9f8[_0xd4db('0x52')]('i.'+_0x24c74e+_0xd4db('0x89'));}else{_0x7fd9f8[_0xd4db('0x52')]('i.'+_0x24c74e+_0xd4db('0x8a'),_0x342386[_0xd4db('0x49')][_0x24c74e]);}}});}if(_0x342386[_0xd4db('0x49')]['read']){if(_0x342386[_0xd4db('0x49')][_0xd4db('0x8b')]==0x1){_0x7fd9f8[_0xd4db('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x7fd9f8[_0xd4db('0x6f')](_0xd4db('0x8c'));}}if(_0x342386[_0xd4db('0x49')][_0xd4db('0x8d')]){_0x2f17e0=_[_0xd4db('0x8e')](_0x342386[_0xd4db('0x49')]['tag'])?_0x342386[_0xd4db('0x49')][_0xd4db('0x8d')]:new Array(_0x342386[_0xd4db('0x49')]['tag']);_0x2f17e0['forEach'](function(_0x5d09c7){_0xe0686['or'](_0xd4db('0x7c'),'%,'+_0x5d09c7+',%');});}if(_0x342386[_0xd4db('0x49')][_0xd4db('0x8f')]){var _0x47abcc=_0x342386[_0xd4db('0x49')][_0xd4db('0x8f')][_0xd4db('0x90')]('\x5c','\x5c\x5c')[_0xd4db('0x90')](/'/g,'\x27\x27');if(qs[_0xd4db('0x91')](_0x47abcc)){_0x5add37['or'](_0xd4db('0x92'),_0x47abcc+'%')['or'](_0xd4db('0x93'),_0x47abcc+'%');}_0x5add37['or'](_0xd4db('0x94'),_0x47abcc+'%');}}_0x7fd9f8[_0xd4db('0x52')](_0x5add37);_0x7fd9f8[_0xd4db('0x95')]('i.id');var _0x3f6dba={'type':db[_0xd4db('0x96')][_0xd4db('0x97')][_0xd4db('0x98')],'raw':!![]};var _0x789dbf=_0x7fd9f8[_0xd4db('0x99')]();_0x789dbf[_0xd4db('0x54')](_0xd4db('0x9a'));_0x789dbf[_0xd4db('0x54')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd4db('0x9b'));if(_0x6d1dd2[_0xd4db('0x50')]){_0x6d1dd2[_0xd4db('0x50')][_0xd4db('0x37')](function(_0x4e167d){var _0x2e0f44=_0x4e167d[0x0]==='contactName'?_0x4e167d[0x0]:'i.'+_0x4e167d[0x0];_0x7fd9f8['order'](_0x2e0f44,_0x4e167d[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd4db('0x82')](_0x2f17e0)){_0x7fd9f8['having'](_0xe0686);_0x789dbf[_0xd4db('0x52')](_0xd4db('0x9c'),_0x2f17e0);}BPromise[_0xd4db('0x9d')]()[_0xd4db('0x2c')](function(){if(!_0x588c3a){if(_0x342386['query'][_0xd4db('0x83')])return;_0x789dbf[_0xd4db('0x52')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x7fd9f8[_0xd4db('0x52')](_0xd4db('0x9e'));return;}if(_0x342386[_0xd4db('0x9f')][_0xd4db('0xa0')]!=='agent')return;return _0x342386[_0xd4db('0x9f')][_0xd4db('0xa1')]({'attributes':['id'],'raw':!![]})[_0xd4db('0x2c')](function(_0x47dc97){if(_['isEmpty'](_0x47dc97)){_0x789dbf['where'](_0xd4db('0xa2'));_0x7fd9f8[_0xd4db('0x52')](_0xd4db('0xa2'));}else{_0x789dbf[_0xd4db('0x52')](_0xd4db('0x84'),_[_0xd4db('0x33')](_0x47dc97,'id'));_0x7fd9f8['where'](_0xd4db('0x84'),_[_0xd4db('0x33')](_0x47dc97,'id'));}});})[_0xd4db('0x2c')](function(){if(_0x342386[_0xd4db('0x9f')][_0xd4db('0xa0')]==='agent'&&!_0x588c3a&&!_0x342386['query']['FaxAccountId'])return[];return db[_0xd4db('0xa3')][_0xd4db('0x49')](_0x789dbf[_0xd4db('0xa4')](),_0x3f6dba);})[_0xd4db('0x2c')](function(_0xeef64){_0x2e56d1[_0xd4db('0x26')]=_0xeef64[_0xd4db('0x4d')];if(_0x2e56d1[_0xd4db('0x26')]===0x0)return[];return db['sequelize'][_0xd4db('0x49')](_0x264a04[_0xd4db('0xa4')](),_0x3f6dba)[_0xd4db('0x2c')](function(_0x2f8e92){_0x38c1bd=_[_0xd4db('0xa5')](_0x2f8e92,'id');_0x3f6dba=_[_0xd4db('0xa6')](_0x3f6dba,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x342386['query'][_0xd4db('0x4c')]){_0x6d1dd2[_0xd4db('0x4b')]['forEach'](function(_0x26bea8){_0x7fd9f8[_0xd4db('0x54')]('i.'+_0x26bea8);});}else{_0x7fd9f8[_0xd4db('0x54')](_0xd4db('0xa7'),_0xd4db('0x9b'));_0x7fd9f8['field'](_0xd4db('0xa8'),_0xd4db('0xa9'));_0x7fd9f8['field']('a.mandatoryDisposition',_0xd4db('0xaa'));_0x7fd9f8[_0xd4db('0x54')]('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',_0xd4db('0xab'));_0x7fd9f8[_0xd4db('0x54')](_0xd4db('0xac'));_0x7fd9f8[_0xd4db('0x54')]('c.firstName',_0xd4db('0xad'));_0x7fd9f8[_0xd4db('0x54')](_0xd4db('0xae'),_0xd4db('0xaf'));_0x7fd9f8[_0xd4db('0x54')]('c.email',_0xd4db('0xb0'));_0x7fd9f8[_0xd4db('0x54')](_0xd4db('0xb1'),_0xd4db('0xb2'));_0x7fd9f8[_0xd4db('0x54')]('c.mobile',_0xd4db('0xb3'));_0x7fd9f8[_0xd4db('0x54')](_0xd4db('0xb4'),_0xd4db('0xb5'));_0x7fd9f8['field']('o.fullname','Owner.fullname');_0x7fd9f8[_0xd4db('0x54')]('o.internal','Owner.internal');_0x7fd9f8[_0xd4db('0x54')](_0xd4db('0xb6'),'TagIds');}if(_0x6d1dd2[_0xd4db('0x24')])_0x7fd9f8['limit'](_0x6d1dd2[_0xd4db('0x24')]);if(_0x6d1dd2[_0xd4db('0x23')])_0x7fd9f8[_0xd4db('0x23')](_0x6d1dd2[_0xd4db('0x23')]);return db['sequelize']['query'](_0x7fd9f8[_0xd4db('0xa4')](),_0x3f6dba);})[_0xd4db('0x2c')](function(_0x42b388){if(_0x42b388[_0xd4db('0x4d')]>0x0)_0x14765c['where']('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x42b388,'id'));return db[_0xd4db('0xa3')]['query'](_0x14765c[_0xd4db('0xa4')](),_0x3f6dba)[_0xd4db('0x2c')](function(_0x202863){var _0x4c48c0=_[_0xd4db('0xb7')](_0x202863,_0xd4db('0xb8'));var _0x70088d=[];_0x42b388[_0xd4db('0x37')](function(_0x49491b){_0x70088d[_0xd4db('0x39')](updateFaxInteraction(_0x49491b,_0x38c1bd,_0x4c48c0));});return BPromise[_0xd4db('0xb9')](_0x70088d);});});})['then'](function(_0x144ea2){_0x2e56d1[_0xd4db('0xba')]=_0x144ea2;return _0x2e56d1;})[_0xd4db('0x2c')](respondWithFilteredResult(_0x236b6f,_0x6d1dd2))[_0xd4db('0x3a')](handleError(_0x236b6f,null));};exports['show']=function(_0x35d3df,_0x302b11){var _0xe22a29={'raw':![],'where':{'id':_0x35d3df[_0xd4db('0xbb')]['id']}},_0x2428a4={};_0x2428a4[_0xd4db('0x48')]=_['keys'](db[_0xd4db('0x43')]['rawAttributes']);_0x2428a4[_0xd4db('0x49')]=_['keys'](_0x35d3df[_0xd4db('0x49')]);_0x2428a4[_0xd4db('0x53')]=_[_0xd4db('0xbc')](_0x2428a4['model'],_0x2428a4[_0xd4db('0x49')]);_0xe22a29[_0xd4db('0x4b')]=_[_0xd4db('0xbc')](_0x2428a4[_0xd4db('0x48')],qs[_0xd4db('0x4c')](_0x35d3df['query']['fields']));_0xe22a29[_0xd4db('0x4b')]=_0xe22a29['attributes'][_0xd4db('0x4d')]?_0xe22a29[_0xd4db('0x4b')]:_0x2428a4['model'];if(_0x35d3df[_0xd4db('0x49')][_0xd4db('0xbd')]){_0xe22a29[_0xd4db('0xbe')]=[{'all':!![]}];}_0xe22a29=_[_0xd4db('0xa6')]({},_0xe22a29,_0x35d3df[_0xd4db('0xbf')]);return db[_0xd4db('0x43')][_0xd4db('0x77')](_0xe22a29)['then'](handleEntityNotFound(_0x302b11,null))[_0xd4db('0x2c')](respondWithResult(_0x302b11,null))[_0xd4db('0x3a')](handleError(_0x302b11,null));};exports[_0xd4db('0xc0')]=function(_0x3fdb35,_0x3675fe){return db[_0xd4db('0x43')][_0xd4db('0xc0')](_0x3fdb35[_0xd4db('0x7f')],{})[_0xd4db('0x2c')](respondWithResult(_0x3675fe,0xc9))['catch'](handleError(_0x3675fe,null));};exports[_0xd4db('0xc1')]=function(_0xcc7602,_0x266be4){if(_0xcc7602['body']['id']){delete _0xcc7602['body']['id'];}return db[_0xd4db('0x43')]['find']({'where':{'id':_0xcc7602[_0xd4db('0xbb')]['id']}})['then'](handleEntityNotFound(_0x266be4,null))[_0xd4db('0x2c')](saveUpdates(_0xcc7602[_0xd4db('0x7f')],null))[_0xd4db('0x2c')](respondWithResult(_0x266be4,null))[_0xd4db('0x3a')](handleError(_0x266be4,null));};exports[_0xd4db('0x2d')]=function(_0x4071e8,_0x2063be){return db[_0xd4db('0x43')][_0xd4db('0x77')]({'where':{'id':_0x4071e8[_0xd4db('0xbb')]['id']}})[_0xd4db('0x2c')](handleEntityNotFound(_0x2063be,null))[_0xd4db('0x2c')](removeEntity(_0x2063be,null))[_0xd4db('0x3a')](handleError(_0x2063be,null));};exports['describe']=function(_0x1bde5a,_0x575ecd){return db['FaxInteraction'][_0xd4db('0xc2')]()[_0xd4db('0x2c')](respondWithResult(_0x575ecd,null))[_0xd4db('0x3a')](handleError(_0x575ecd,null));};exports[_0xd4db('0xc3')]=function(_0x1260f6,_0x402b40,_0xe6fe18){return db[_0xd4db('0xc4')][_0xd4db('0x77')]({'where':{'id':_0x1260f6[_0xd4db('0xbb')]['id']}})['then'](handleEntityNotFound(_0x402b40,null))[_0xd4db('0x2c')](function(_0x2cef07){if(_0x2cef07){return _0x2cef07['addMessage'](_0x1260f6[_0xd4db('0x7f')]['ids'],_[_0xd4db('0xc5')](_0x1260f6[_0xd4db('0x7f')],[_0xd4db('0xc6'),'id'])||{});}})[_0xd4db('0x2c')](respondWithResult(_0x402b40,null))['catch'](handleError(_0x402b40,null));};exports[_0xd4db('0xc7')]=function(_0x383680,_0x51a69a,_0x33c844){var _0x13ef1f={'raw':![],'where':{}};var _0x49cbe8={};var _0x11180d={'count':0x0,'rows':[]};return db[_0xd4db('0x43')][_0xd4db('0xc8')]({'where':{'id':_0x383680[_0xd4db('0xbb')]['id']}})[_0xd4db('0x2c')](handleEntityNotFound(_0x51a69a,null))[_0xd4db('0x2c')](function(_0x1f5c4a){if(_0x1f5c4a){_0x49cbe8[_0xd4db('0x48')]=_['keys'](db[_0xd4db('0xc4')][_0xd4db('0x44')]);_0x49cbe8[_0xd4db('0x49')]=_['keys'](_0x383680['query']);_0x49cbe8[_0xd4db('0x53')]=_[_0xd4db('0xbc')](_0x49cbe8['model'],_0x49cbe8[_0xd4db('0x49')]);_0x13ef1f['attributes']=_['intersection'](_0x49cbe8[_0xd4db('0x48')],qs[_0xd4db('0x4c')](_0x383680['query'][_0xd4db('0x4c')]));_0x13ef1f['attributes']=_0x13ef1f[_0xd4db('0x4b')][_0xd4db('0x4d')]?_0x13ef1f[_0xd4db('0x4b')]:_0x49cbe8[_0xd4db('0x48')];if(!_0x383680['query'][_0xd4db('0x4e')](_0xd4db('0x4f'))){_0x13ef1f[_0xd4db('0x24')]=qs[_0xd4db('0x24')](_0x383680[_0xd4db('0x49')][_0xd4db('0x24')]);_0x13ef1f[_0xd4db('0x23')]=qs[_0xd4db('0x23')](_0x383680['query'][_0xd4db('0x23')]);}_0x13ef1f[_0xd4db('0x50')]=qs[_0xd4db('0x51')](_0x383680[_0xd4db('0x49')][_0xd4db('0x51')]);_0x13ef1f[_0xd4db('0x52')]=qs[_0xd4db('0x53')](_[_0xd4db('0xc9')](_0x383680[_0xd4db('0x49')],_0x49cbe8[_0xd4db('0x53')]));_0x13ef1f[_0xd4db('0x52')][_0xd4db('0xb8')]=_0x1f5c4a['id'];if(_0x383680[_0xd4db('0x49')]['filter']){_0x13ef1f[_0xd4db('0x52')]=_[_0xd4db('0xa6')](_0x13ef1f['where'],{'$or':_[_0xd4db('0x33')](_0x13ef1f[_0xd4db('0x4b')],function(_0x58ef48){var _0x1a141c={};_0x1a141c[_0x58ef48]={'$like':'%'+_0x383680['query'][_0xd4db('0x8f')]+'%'};return _0x1a141c;})});}if(_0x383680['query'][_0xd4db('0xca')]){var _0x2a8d97=_0x383680[_0xd4db('0x49')]['$gte'][_0xd4db('0x36')](',');var _0x5988ca={};_0x5988ca[_0x2a8d97[0x0]]={'$gte':moment(_0x2a8d97[0x1])[_0xd4db('0xcb')](_0xd4db('0xcc'))};_0x13ef1f[_0xd4db('0x52')]=_['merge'](_0x13ef1f['where'],_0x5988ca);}_0x13ef1f=_[_0xd4db('0xa6')]({},_0x13ef1f,_0x383680['options']);return db[_0xd4db('0xc4')][_0xd4db('0x26')]({'where':_0x13ef1f[_0xd4db('0x52')]})[_0xd4db('0x2c')](function(_0x13b39b){_0x11180d[_0xd4db('0x26')]=_0x13b39b;if(_0x383680[_0xd4db('0x49')][_0xd4db('0xbd')]){_0x13ef1f[_0xd4db('0xbe')]=[{'all':!![]}];}return db[_0xd4db('0xc4')][_0xd4db('0xcd')](_0x13ef1f);})[_0xd4db('0x2c')](function(_0x2ec4b4){_0x11180d['rows']=_0x2ec4b4;return _0x11180d;});}})[_0xd4db('0x2c')](respondWithFilteredResult(_0x51a69a,_0x13ef1f))[_0xd4db('0x3a')](handleError(_0x51a69a,null));};exports['addTags']=function(_0x15d93c,_0x1f84f6,_0x4499e2){return db[_0xd4db('0x43')][_0xd4db('0x77')]({'where':{'id':_0x15d93c['params']['id']}})[_0xd4db('0x2c')](handleEntityNotFound(_0x1f84f6,null))['then'](function(_0x597bf2){if(_0x597bf2){return _0x597bf2[_0xd4db('0xce')](_0x15d93c['body'][_0xd4db('0xc6')],_[_0xd4db('0xc5')](_0x15d93c['body'],[_0xd4db('0xc6'),'id'])||{})[_0xd4db('0xcf')](function(){return db['Tag'][_0xd4db('0xcd')]({'attributes':['id',_0xd4db('0x30'),_0xd4db('0x55')],'where':{'id':_0x15d93c[_0xd4db('0x7f')][_0xd4db('0xc6')]}});})[_0xd4db('0x2c')](function(_0x551571){socket[_0xd4db('0xd0')](_0xd4db('0xd1'),{'id':Number(_0x15d93c[_0xd4db('0xbb')]['id']),'tags':_0x551571||[]});return{'id':Number(_0x15d93c['params']['id']),'tags':_0x551571||[]};});}})[_0xd4db('0x2c')](respondWithResult(_0x1f84f6,null))[_0xd4db('0x3a')](handleError(_0x1f84f6,null));};exports['removeTags']=function(_0x2db74e,_0xadacfe,_0x51cf29){return db[_0xd4db('0x43')][_0xd4db('0x77')]({'where':{'id':_0x2db74e['params']['id']}})[_0xd4db('0x2c')](handleEntityNotFound(_0xadacfe,null))[_0xd4db('0x2c')](function(_0x414c7f){if(_0x414c7f){return _0x414c7f[_0xd4db('0xd2')](_0x2db74e['query'][_0xd4db('0xc6')]);}})[_0xd4db('0x2c')](respondWithStatusCode(_0xadacfe,null))[_0xd4db('0x3a')](handleError(_0xadacfe,null));};exports[_0xd4db('0xd3')]=function(_0x3a6618,_0x949b2b){var _0x4e90d2=moment()[_0xd4db('0xd4')]()['toString']();var _0x137db1=path['join'](config[_0xd4db('0xd5')],_0xd4db('0xd6'),_0xd4db('0xd7'),_0xd4db('0xd8'));var _0x580956=path[_0xd4db('0xd9')](config['root'],'server',_0xd4db('0xd7'),_0xd4db('0xda'));var _0x1d7c69=path[_0xd4db('0xd9')](_0x137db1,_0x4e90d2);var _0x1ce824=util['format'](_0xd4db('0xdb'),_0x3a6618[_0xd4db('0xbb')]['id'],_0x4e90d2);var _0x131027=path[_0xd4db('0xd9')](_0x137db1,_0x1ce824);var _0x25ae6f=[];_0x25ae6f[_0xd4db('0x39')]({'model':db[_0xd4db('0xdc')],'as':'Attachment','raw':!![]});var _0x2cb242=[{'model':db[_0xd4db('0xc4')],'as':_0xd4db('0xdd'),'attributes':['id',_0xd4db('0x7f'),_0xd4db('0x85')],'include':_0x25ae6f}];return db[_0xd4db('0x43')][_0xd4db('0x77')]({'where':{'id':_0x3a6618[_0xd4db('0xbb')]['id']},'include':_0x2cb242})['then'](handleEntityNotFound(_0x949b2b,null))[_0xd4db('0x2c')](function(_0x320e24){if(_0x320e24&&_0x320e24['Messages']){var _0xda752a=_0x320e24[_0xd4db('0xde')]({'plain':!![]});fs[_0xd4db('0xdf')](_0x1d7c69);for(var _0x518380=0x0;_0x518380<_0xda752a[_0xd4db('0xdd')][_0xd4db('0x4d')];_0x518380++){var _0x2c4eb8=_0xda752a['Messages'][_0x518380][_0xd4db('0xdc')];if(_0x2c4eb8){var _0x334568=path[_0xd4db('0xd9')](_0x580956,_0x2c4eb8[_0xd4db('0xe0')]);if(fs[_0xd4db('0xe1')](_0x334568)){fs[_0xd4db('0xe2')](_0x334568)[_0xd4db('0xe3')](fs['createWriteStream'](path[_0xd4db('0xd9')](_0x1d7c69,_0x2c4eb8[_0xd4db('0xe0')])));}}}return BPromise[_0xd4db('0x9d')]()[_0xd4db('0x2c')](function(){return new BPromise(function(_0x2b287e,_0x2d8a96){zipdir(_0x1d7c69,{'saveTo':_0x131027},function(_0x540453,_0x1dd06b){if(_0x540453)return _0x2d8a96(_0x540453);return _0x2b287e(_0x1dd06b);});})[_0xd4db('0x2c')](function(){return new BPromise(function(_0xbd33e5,_0x2332b4){rimraf(_0x1d7c69,function(_0x188db2){if(_0x188db2)_0x2332b4(_0x188db2);return _0xbd33e5();});});})[_0xd4db('0x2c')](function(){return _0x949b2b[_0xd4db('0xd3')](_0x131027,_0x1ce824,function(_0x16fd10){if(_0x16fd10){console[_0xd4db('0xe4')](_0xd4db('0xe5'),_0x16fd10);}else{fs[_0xd4db('0xe6')](_0x131027);}});});});}else{return _0x949b2b['sendStatus'](0xc8);}})[_0xd4db('0x3a')](handleError(_0x949b2b,null));}; \ No newline at end of file +var _0xe281=['c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','include','merge','create','destroy','params','describe','addMessage','ids','getMessages','findOne','FaxMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','setTags','omit','findAll','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Messages','get','mkdirSync','Attachment','existsSync','pipe','createWriteStream','basename','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','offset','undefined','count','status','set','Content-Range','json','reject','save','update','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','then','catch','waiting','unmanaged','total','closed','UserId','answered','talking','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','FaxAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName'];(function(_0x4a3ee3,_0x304512){var _0x56d16d=function(_0x280251){while(--_0x280251){_0x4a3ee3['push'](_0x4a3ee3['shift']());}};_0x56d16d(++_0x304512);}(_0xe281,0x1f0));var _0x1e28=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe281[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x1e28('0x0'));var rimraf=require(_0x1e28('0x1'));var zipdir=require(_0x1e28('0x2'));var jsonpatch=require(_0x1e28('0x3'));var rp=require(_0x1e28('0x4'));var moment=require(_0x1e28('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1e28('0x6'));var util=require('util');var path=require(_0x1e28('0x7'));var sox=require('sox');var csv=require(_0x1e28('0x8'));var ejs=require(_0x1e28('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e28('0xa'));var squel=require(_0x1e28('0xb'));var crypto=require(_0x1e28('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e28('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1e28('0xe'));var as=require(_0x1e28('0xf'));var hardwareService=require(_0x1e28('0x10'));var logger=require(_0x1e28('0x11'))('api');var utils=require(_0x1e28('0x12'));var config=require(_0x1e28('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e28('0x14'))['db'];config['redis']=_[_0x1e28('0x15')](config[_0x1e28('0x16')],{'host':_0x1e28('0x17'),'port':0x18eb});var socket=require(_0x1e28('0x18'))(new Redis(config['redis']));require(_0x1e28('0x19'))['register'](socket);function respondWithStatusCode(_0x45b9ae,_0x1b4e3b){_0x1b4e3b=_0x1b4e3b||0xcc;return function(_0x5421fa){if(_0x5421fa){return _0x45b9ae[_0x1e28('0x1a')](_0x1b4e3b);}return _0x45b9ae['status'](_0x1b4e3b)[_0x1e28('0x1b')]();};}function respondWithResult(_0x35abf5,_0x459de5){_0x459de5=_0x459de5||0xc8;return function(_0x2116be){if(_0x2116be){return _0x35abf5['status'](_0x459de5)['json'](_0x2116be);}};}function respondWithFilteredResult(_0x296e0e,_0x275a21){return function(_0x186597){if(_0x186597){var _0x374dcb=typeof _0x275a21[_0x1e28('0x1c')]===_0x1e28('0x1d')&&typeof _0x275a21['limit']===_0x1e28('0x1d');var _0x29ea29=_0x186597[_0x1e28('0x1e')];var _0x3f0b9f=_0x374dcb?0x0:_0x275a21[_0x1e28('0x1c')];var _0x3148b7=_0x374dcb?_0x186597['count']:_0x275a21[_0x1e28('0x1c')]+_0x275a21['limit'];var _0xf9942b;if(_0x3148b7>=_0x29ea29){_0x3148b7=_0x29ea29;_0xf9942b=0xc8;}else{_0xf9942b=0xce;}_0x296e0e[_0x1e28('0x1f')](_0xf9942b);return _0x296e0e[_0x1e28('0x20')](_0x1e28('0x21'),_0x3f0b9f+'-'+_0x3148b7+'/'+_0x29ea29)[_0x1e28('0x22')](_0x186597);}return null;};}function patchUpdates(_0x1c41b1){return function(_0x3a9325){try{jsonpatch['apply'](_0x3a9325,_0x1c41b1,!![]);}catch(_0x2a5c84){return BPromise[_0x1e28('0x23')](_0x2a5c84);}return _0x3a9325[_0x1e28('0x24')]();};}function saveUpdates(_0x2b13b6,_0xf3ad92){return function(_0x13dc78){if(_0x13dc78){return _0x13dc78[_0x1e28('0x25')](_0x2b13b6)['then'](function(_0x2152e3){return _0x2152e3;});}return null;};}function removeEntity(_0x10ff41,_0x46f9df){return function(_0x1b314f){if(_0x1b314f){return _0x1b314f['destroy']()['then'](function(){_0x10ff41[_0x1e28('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x473c66,_0x47ba76){return function(_0x816027){if(!_0x816027){_0x473c66[_0x1e28('0x1a')](0x194);}return _0x816027;};}function handleError(_0x319d60,_0x299963){_0x299963=_0x299963||0x1f4;return function(_0x51132d){logger[_0x1e28('0x26')](_0x51132d[_0x1e28('0x27')]);if(_0x51132d[_0x1e28('0x28')]){delete _0x51132d[_0x1e28('0x28')];}_0x319d60[_0x1e28('0x1f')](_0x299963)['send'](_0x51132d);};}function getInteractionUsers(_0x25cb71,_0xa44177){return new BPromise(function(_0x319e31,_0xdb56d1){try{if(_0xa44177[_0x25cb71['id']]){_0x25cb71[_0x1e28('0x29')]=_[_0x1e28('0x2a')](_0xa44177[_0x25cb71['id']],function(_0x13a06a){return{'id':_0x13a06a['id'],'fullname':_0x13a06a[_0x1e28('0x2b')]};});}}catch(_0x31ee90){_0xdb56d1(_0x31ee90);}_0x319e31(_0x25cb71);});}function getInteractionTags(_0x28e539,_0x358408){return new BPromise(function(_0x2f2b92,_0xf8c2e7){try{if(_0x28e539[_0x1e28('0x2c')]){_0x28e539[_0x1e28('0x2d')]=[];_0x28e539[_0x1e28('0x2c')][_0x1e28('0x2e')](',')[_0x1e28('0x2f')](function(_0x5df8b9){_0x28e539['Tags'][_0x1e28('0x30')](_0x358408[_0x5df8b9]);});}delete _0x28e539[_0x1e28('0x2c')];}catch(_0x4cb752){_0xf8c2e7(_0x4cb752);}_0x2f2b92(_0x28e539);});}function updateFaxInteraction(_0x395c3d,_0x3d2e9c,_0x5b25ca){return new BPromise(function(_0x57642a,_0x5a090a){return getInteractionUsers(_0x395c3d,_0x5b25ca)['then'](function(_0x4bd560){return getInteractionTags(_0x4bd560,_0x3d2e9c);})['then'](function(_0x4cb593){return getStateInteraction(_0x4cb593);})[_0x1e28('0x31')](function(_0x96cc25){_0x57642a(_0x96cc25);})[_0x1e28('0x32')](function(_0x5ac1d7){_0x5a090a(_0x5ac1d7);});});}function getStateInteraction(_0x10db0e){return new BPromise(function(_0x999eb9){_0x10db0e[_0x1e28('0x33')]=0x0;_0x10db0e['talking']=0x0;_0x10db0e['answered']=0x0;_0x10db0e[_0x1e28('0x34')]=0x0;_0x10db0e[_0x1e28('0x35')]=0x0;if(!_0x10db0e[_0x1e28('0x36')]&&!_0x10db0e[_0x1e28('0x37')]){_0x10db0e[_0x1e28('0x33')]+=0x1;}if(!_0x10db0e[_0x1e28('0x36')]&&_0x10db0e[_0x1e28('0x37')]){_0x10db0e['talking']+=0x1;if(_0x10db0e[_0x1e28('0x33')]){_0x10db0e[_0x1e28('0x33')]-=0x1;}}if(_0x10db0e[_0x1e28('0x36')]&&_0x10db0e['UserId']){_0x10db0e[_0x1e28('0x38')]+=0x1;if(_0x10db0e['talking']){_0x10db0e[_0x1e28('0x39')]-=0x1;}}if(_0x10db0e[_0x1e28('0x36')]&&!_0x10db0e['UserId']){_0x10db0e['unmanaged']+=0x1;if(_0x10db0e[_0x1e28('0x33')]){_0x10db0e[_0x1e28('0x33')]-=0x1;}}_0x10db0e[_0x1e28('0x35')]+=0x1;_0x999eb9(_0x10db0e);});}exports[_0x1e28('0x3a')]=function(_0x4c15ce,_0x195982){var _0x1bec1d={},_0x309408={},_0x5ca475={'count':0x0,'rows':[]};var _0x156cf6=_[_0x1e28('0x2a')](db[_0x1e28('0x3b')][_0x1e28('0x3c')],function(_0x215929){return{'name':_0x215929[_0x1e28('0x3d')],'type':_0x215929[_0x1e28('0x3e')][_0x1e28('0x3f')]};});_0x309408[_0x1e28('0x40')]=_[_0x1e28('0x2a')](_0x156cf6,'name');_0x309408[_0x1e28('0x41')]=_[_0x1e28('0x42')](_0x4c15ce['query']);_0x309408[_0x1e28('0x43')]=_['intersection'](_0x309408[_0x1e28('0x40')],_0x309408['query']);_0x1bec1d[_0x1e28('0x44')]=_[_0x1e28('0x45')](_0x309408[_0x1e28('0x40')],qs[_0x1e28('0x46')](_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x46')]));_0x1bec1d[_0x1e28('0x44')]=_0x1bec1d[_0x1e28('0x44')][_0x1e28('0x47')]?_0x1bec1d[_0x1e28('0x44')]:_0x309408[_0x1e28('0x40')];if(!_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x48')]('nolimit')){_0x1bec1d['limit']=qs[_0x1e28('0x49')](_0x4c15ce['query'][_0x1e28('0x49')]);_0x1bec1d[_0x1e28('0x1c')]=qs[_0x1e28('0x1c')](_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x1c')]);}_0x1bec1d[_0x1e28('0x4a')]=qs[_0x1e28('0x4b')](_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x4b')]);_0x1bec1d[_0x1e28('0x4c')]=qs['filters'](_[_0x1e28('0x4d')](_0x4c15ce[_0x1e28('0x41')],_0x309408['filters']),_0x156cf6);var _0x54e7df=[];var _0x2dad2e=squel[_0x1e28('0x4e')]()[_0x1e28('0x4f')]('id')[_0x1e28('0x4f')](_0x1e28('0x28'))[_0x1e28('0x4f')](_0x1e28('0x50'))[_0x1e28('0x51')](_0x1e28('0x52'));var _0x239442=squel[_0x1e28('0x4e')]()['field']('u.id')['field'](_0x1e28('0x53'))[_0x1e28('0x4f')](_0x1e28('0x54'))[_0x1e28('0x51')](_0x1e28('0x55'),'ui')[_0x1e28('0x56')](_0x1e28('0x57'),'u',_0x1e28('0x58'));var _0x33e061=squel[_0x1e28('0x4e')]()[_0x1e28('0x51')]('fax_interactions','i')[_0x1e28('0x56')](_0x1e28('0x59'),'c',_0x1e28('0x5a'))[_0x1e28('0x56')](_0x1e28('0x57'),'o','o.id\x20=\x20i.UserId')[_0x1e28('0x56')]('fax_accounts','a',_0x1e28('0x5b'))[_0x1e28('0x56')](_0x1e28('0x5c'),'me',_0x1e28('0x5d'))[_0x1e28('0x56')](_0x1e28('0x5e'),'it',_0x1e28('0x5f'))[_0x1e28('0x56')](_0x1e28('0x52'),'t',_0x1e28('0x60'));var _0x108329=squel[_0x1e28('0x61')]();var _0x309cdd=[];var _0x3aa693=squel[_0x1e28('0x61')]();var _0x5d4509;if(_0x4c15ce['query'][_0x1e28('0x62')]){_0x5d4509=as[_0x1e28('0x63')](_0x4c15ce['query'][_0x1e28('0x62')]);var _0x299796=_0x5d4509['sqlOperator'];for(var _0x1096e5=0x0;_0x1096e5<_0x5d4509[_0x1e28('0x64')][_0x1e28('0x47')];_0x1096e5++){var _0x2af4bb=_0x5d4509[_0x1e28('0x64')][_0x1096e5];var _0x23f9f8='i';var _0x1b6b39=_[_0x1e28('0x65')](_0x156cf6,[_0x1e28('0x28'),_0x2af4bb[_0x1e28('0x4f')]]);if(!_0x1b6b39){switch(_0x2af4bb[_0x1e28('0x4f')]){case _0x1e28('0x66'):if(_0x2af4bb[_0x1e28('0x67')]==0x1){_0x33e061[_0x1e28('0x68')]('`'+_0x2af4bb[_0x1e28('0x4f')]+'`\x20=\x200');}else{_0x33e061[_0x1e28('0x68')]('`'+_0x2af4bb[_0x1e28('0x4f')]+_0x1e28('0x69'));}break;case _0x1e28('0x6a'):if(_0x2af4bb[_0x1e28('0x6b')]===_0x1e28('0x6c')){if(_0x2af4bb[_0x1e28('0x67')][_0x1e28('0x2e')]('\x20')[_0x1e28('0x47')]>0x1){_0x108329[_0x299796](_0x1e28('0x6d'),qs[_0x1e28('0x6e')](_0x2af4bb[_0x1e28('0x67')]),null);}else{var _0x48d6aa='%'+_0x2af4bb['value']+'%';_0x108329[_0x299796]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x48d6aa,_0x48d6aa,_0x48d6aa);}}else{_0x1b6b39=_[_0x1e28('0x65')](_0x156cf6,[_0x1e28('0x28'),'ContactId']);_0x2af4bb[_0x1e28('0x4f')]=_0x1e28('0x6f');_0x57a82f=as[_0x1e28('0x70')](_0x23f9f8,_0x1b6b39[_0x1e28('0x3e')],_0x2af4bb);_0x108329[_0x299796](_0x57a82f[_0x1e28('0x71')],_0x57a82f[_0x1e28('0x67')][_0x1e28('0x72')],_0x57a82f[_0x1e28('0x67')]['end']);}break;case _0x1e28('0x73'):var _0x94b807=_0x2af4bb['value'][_0x1e28('0x2e')](',')[_0x1e28('0x2a')](function(_0x43addd){return Number(_0x43addd);});_0x94b807['forEach'](function(_0x41158a){_0x3aa693['or'](_0x1e28('0x74'),'%,'+_0x41158a+',%');});_0x309cdd=_[_0x1e28('0x75')](_0x309cdd,_0x94b807);break;case'User':if(_0x2af4bb[_0x1e28('0x6b')]===_0x1e28('0x6c')){_0x108329[_0x299796](_0x1e28('0x76'),'%'+_0x2af4bb['value']+'%',null);}else{_0x1b6b39=_['find'](_0x156cf6,[_0x1e28('0x28'),_0x1e28('0x37')]);_0x2af4bb[_0x1e28('0x4f')]=_0x1e28('0x37');_0x57a82f=as['buildExpression'](_0x23f9f8,_0x1b6b39[_0x1e28('0x3e')],_0x2af4bb);_0x108329[_0x299796](_0x57a82f[_0x1e28('0x71')],_0x57a82f[_0x1e28('0x67')][_0x1e28('0x72')],_0x57a82f[_0x1e28('0x67')][_0x1e28('0x1b')]);}break;case _0x1e28('0x77'):_0x57a82f=as[_0x1e28('0x70')]('me',null,_0x2af4bb);_0x108329[_0x299796](_0x57a82f[_0x1e28('0x71')],_0x57a82f[_0x1e28('0x67')][_0x1e28('0x72')],_0x57a82f[_0x1e28('0x67')][_0x1e28('0x1b')]);break;}}else{var _0x57a82f=as[_0x1e28('0x70')](_0x23f9f8,_0x1b6b39[_0x1e28('0x3e')],_0x2af4bb);_0x108329[_0x299796](_0x57a82f[_0x1e28('0x71')],_0x57a82f[_0x1e28('0x67')][_0x1e28('0x72')],_0x57a82f[_0x1e28('0x67')][_0x1e28('0x1b')]);}}}else{var _0x28623f=_(_0x4c15ce[_0x1e28('0x41')])[_0x1e28('0x42')]()[_0x1e28('0x2a')](function(_0x404975){return _[_0x1e28('0x78')](_0x156cf6,[_0x1e28('0x28'),_0x404975])?_0x404975:undefined;})['compact']()[_0x1e28('0x67')]();if(!_['isEmpty'](_0x28623f)){_0x28623f[_0x1e28('0x2f')](function(_0x273e91){if(_0x273e91===_0x1e28('0x79')){_0x33e061[_0x1e28('0x4c')]('i.FaxAccountId\x20IN\x20?',[][_0x1e28('0x7a')](_0x4c15ce['query'][_0x273e91]));}else if(_0x273e91===_0x1e28('0x7b')){var _0x303d6c=JSON['parse'](_0x4c15ce[_0x1e28('0x41')][_0x273e91])[_0x1e28('0x7c')];var _0x13481c=JSON[_0x1e28('0x7d')](_0x4c15ce[_0x1e28('0x41')][_0x273e91])[_0x1e28('0x7e')];_0x33e061['where'](_0x1e28('0x7f'),_0x303d6c,_0x13481c);}else{if(_0x4c15ce['query'][_0x273e91]==='null'){_0x33e061[_0x1e28('0x4c')]('i.'+_0x273e91+_0x1e28('0x80'));}else{_0x33e061[_0x1e28('0x4c')]('i.'+_0x273e91+_0x1e28('0x81'),_0x4c15ce[_0x1e28('0x41')][_0x273e91]);}}});}if(_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x82')]){if(_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x82')]==0x1){_0x33e061[_0x1e28('0x68')](_0x1e28('0x83'));}else{_0x33e061['having'](_0x1e28('0x84'));}}if(_0x4c15ce['query'][_0x1e28('0x85')]){_0x309cdd=_[_0x1e28('0x86')](_0x4c15ce['query'][_0x1e28('0x85')])?_0x4c15ce['query'][_0x1e28('0x85')]:new Array(_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x85')]);_0x309cdd[_0x1e28('0x2f')](function(_0x596701){_0x3aa693['or'](_0x1e28('0x74'),'%,'+_0x596701+',%');});}if(_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x87')]){var _0x5442c4=_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x87')]['replace']('\x5c','\x5c\x5c')[_0x1e28('0x88')](/'/g,'\x27\x27');if(qs[_0x1e28('0x89')](_0x5442c4)){_0x108329['or'](_0x1e28('0x8a'),_0x5442c4+'%')['or'](_0x1e28('0x8b'),_0x5442c4+'%');}_0x108329['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5442c4+'%');}}_0x33e061['where'](_0x108329);_0x33e061[_0x1e28('0x8c')](_0x1e28('0x8d'));var _0x279d80={'type':db['Sequelize'][_0x1e28('0x8e')][_0x1e28('0x8f')],'raw':!![]};var _0x333d57=_0x33e061['clone']();_0x333d57['field'](_0x1e28('0x8d'));_0x333d57[_0x1e28('0x4f')](_0x1e28('0x90'),_0x1e28('0x66'));if(_0x1bec1d[_0x1e28('0x4a')]){_0x1bec1d['order']['forEach'](function(_0x3556ac){var _0x9274=_0x3556ac[0x0]===_0x1e28('0x91')?_0x3556ac[0x0]:'i.'+_0x3556ac[0x0];_0x33e061[_0x1e28('0x4a')](_0x9274,_0x3556ac[0x1]===_0x1e28('0x92')?![]:!![]);});}if(!_[_0x1e28('0x93')](_0x309cdd)){_0x33e061[_0x1e28('0x68')](_0x3aa693);_0x333d57[_0x1e28('0x4c')](_0x1e28('0x94'),_0x309cdd);}BPromise[_0x1e28('0x95')]()['then'](function(){if(!_0x5d4509){if(_0x4c15ce['query'][_0x1e28('0x79')])return;_0x333d57[_0x1e28('0x4c')](_0x1e28('0x96'));_0x33e061[_0x1e28('0x4c')](_0x1e28('0x96'));return;}if(_0x4c15ce[_0x1e28('0x97')][_0x1e28('0x98')]!==_0x1e28('0x99'))return;return _0x4c15ce[_0x1e28('0x97')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x1e28('0x31')](function(_0x31a24f){if(_[_0x1e28('0x93')](_0x31a24f)){_0x333d57[_0x1e28('0x4c')](_0x1e28('0x9a'));_0x33e061[_0x1e28('0x4c')](_0x1e28('0x9a'));}else{_0x333d57[_0x1e28('0x4c')]('i.FaxAccountId\x20IN\x20?',_[_0x1e28('0x2a')](_0x31a24f,'id'));_0x33e061[_0x1e28('0x4c')](_0x1e28('0x9b'),_[_0x1e28('0x2a')](_0x31a24f,'id'));}});})[_0x1e28('0x31')](function(){if(_0x4c15ce[_0x1e28('0x97')][_0x1e28('0x98')]===_0x1e28('0x99')&&!_0x5d4509&&!_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x79')])return[];return db[_0x1e28('0x9c')]['query'](_0x333d57[_0x1e28('0x9d')](),_0x279d80);})[_0x1e28('0x31')](function(_0x594b3a){_0x5ca475[_0x1e28('0x1e')]=_0x594b3a[_0x1e28('0x47')];if(_0x5ca475[_0x1e28('0x1e')]===0x0)return[];return db['sequelize'][_0x1e28('0x41')](_0x2dad2e[_0x1e28('0x9d')](),_0x279d80)[_0x1e28('0x31')](function(_0x4780bb){_0x54e7df=_['keyBy'](_0x4780bb,'id');_0x279d80=_['merge'](_0x279d80,{'model':db[_0x1e28('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c15ce[_0x1e28('0x41')][_0x1e28('0x46')]){_0x1bec1d[_0x1e28('0x44')][_0x1e28('0x2f')](function(_0x5852f2){_0x33e061['field']('i.'+_0x5852f2);});}else{_0x33e061['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1e28('0x66'));_0x33e061[_0x1e28('0x4f')](_0x1e28('0x9e'),'Account.key');_0x33e061[_0x1e28('0x4f')](_0x1e28('0x9f'),'Account.mandatoryDisposition');_0x33e061[_0x1e28('0x4f')](_0x1e28('0xa0'),_0x1e28('0x91'));_0x33e061[_0x1e28('0x4f')]('i.*');_0x33e061[_0x1e28('0x4f')](_0x1e28('0xa1'),_0x1e28('0xa2'));_0x33e061[_0x1e28('0x4f')]('c.lastName',_0x1e28('0xa3'));_0x33e061[_0x1e28('0x4f')](_0x1e28('0xa4'),_0x1e28('0xa5'));_0x33e061['field'](_0x1e28('0xa6'),_0x1e28('0xa7'));_0x33e061['field'](_0x1e28('0xa8'),_0x1e28('0xa9'));_0x33e061[_0x1e28('0x4f')]('c.fax',_0x1e28('0xaa'));_0x33e061[_0x1e28('0x4f')](_0x1e28('0xab'),_0x1e28('0xac'));_0x33e061[_0x1e28('0x4f')]('o.internal','Owner.internal');_0x33e061['field'](_0x1e28('0xad'),_0x1e28('0x2c'));}if(_0x1bec1d[_0x1e28('0x49')])_0x33e061['limit'](_0x1bec1d[_0x1e28('0x49')]);if(_0x1bec1d[_0x1e28('0x1c')])_0x33e061[_0x1e28('0x1c')](_0x1bec1d['offset']);return db[_0x1e28('0x9c')][_0x1e28('0x41')](_0x33e061[_0x1e28('0x9d')](),_0x279d80);})[_0x1e28('0x31')](function(_0x32e78a){if(_0x32e78a['length']>0x0)_0x239442[_0x1e28('0x4c')](_0x1e28('0xae'),_['map'](_0x32e78a,'id'));return db[_0x1e28('0x9c')][_0x1e28('0x41')](_0x239442[_0x1e28('0x9d')](),_0x279d80)[_0x1e28('0x31')](function(_0x4f379e){var _0x569f13=_[_0x1e28('0xaf')](_0x4f379e,_0x1e28('0xb0'));var _0xf05c40=[];_0x32e78a[_0x1e28('0x2f')](function(_0x42688f){_0xf05c40['push'](updateFaxInteraction(_0x42688f,_0x54e7df,_0x569f13));});return BPromise[_0x1e28('0xb1')](_0xf05c40);});});})[_0x1e28('0x31')](function(_0xe274ff){_0x5ca475['rows']=_0xe274ff;return _0x5ca475;})[_0x1e28('0x31')](respondWithFilteredResult(_0x195982,_0x1bec1d))[_0x1e28('0x32')](handleError(_0x195982,null));};exports[_0x1e28('0xb2')]=function(_0x445abb,_0x26975d){var _0x379a79={'raw':![],'where':{'id':_0x445abb['params']['id']}},_0x26aefb={};_0x26aefb[_0x1e28('0x40')]=_[_0x1e28('0x42')](db[_0x1e28('0x3b')][_0x1e28('0x3c')]);_0x26aefb[_0x1e28('0x41')]=_[_0x1e28('0x42')](_0x445abb[_0x1e28('0x41')]);_0x26aefb[_0x1e28('0x43')]=_[_0x1e28('0x45')](_0x26aefb['model'],_0x26aefb[_0x1e28('0x41')]);_0x379a79[_0x1e28('0x44')]=_[_0x1e28('0x45')](_0x26aefb[_0x1e28('0x40')],qs[_0x1e28('0x46')](_0x445abb[_0x1e28('0x41')][_0x1e28('0x46')]));_0x379a79[_0x1e28('0x44')]=_0x379a79[_0x1e28('0x44')][_0x1e28('0x47')]?_0x379a79[_0x1e28('0x44')]:_0x26aefb[_0x1e28('0x40')];if(_0x445abb[_0x1e28('0x41')]['includeAll']){_0x379a79[_0x1e28('0xb3')]=[{'all':!![]}];}_0x379a79=_[_0x1e28('0xb4')]({},_0x379a79,_0x445abb['options']);return db[_0x1e28('0x3b')][_0x1e28('0x65')](_0x379a79)[_0x1e28('0x31')](handleEntityNotFound(_0x26975d,null))['then'](respondWithResult(_0x26975d,null))[_0x1e28('0x32')](handleError(_0x26975d,null));};exports[_0x1e28('0xb5')]=function(_0x2fca16,_0x231c5b){return db['FaxInteraction'][_0x1e28('0xb5')](_0x2fca16[_0x1e28('0x77')],{})[_0x1e28('0x31')](respondWithResult(_0x231c5b,0xc9))[_0x1e28('0x32')](handleError(_0x231c5b,null));};exports['update']=function(_0x54d8d6,_0x5ed646){if(_0x54d8d6[_0x1e28('0x77')]['id']){delete _0x54d8d6[_0x1e28('0x77')]['id'];}return db[_0x1e28('0x3b')][_0x1e28('0x65')]({'where':{'id':_0x54d8d6['params']['id']}})[_0x1e28('0x31')](handleEntityNotFound(_0x5ed646,null))['then'](saveUpdates(_0x54d8d6['body'],null))[_0x1e28('0x31')](respondWithResult(_0x5ed646,null))['catch'](handleError(_0x5ed646,null));};exports[_0x1e28('0xb6')]=function(_0x4ee73f,_0x543f46){return db[_0x1e28('0x3b')][_0x1e28('0x65')]({'where':{'id':_0x4ee73f[_0x1e28('0xb7')]['id']}})[_0x1e28('0x31')](handleEntityNotFound(_0x543f46,null))[_0x1e28('0x31')](removeEntity(_0x543f46,null))[_0x1e28('0x32')](handleError(_0x543f46,null));};exports['describe']=function(_0xe04635,_0x4a1f32){return db[_0x1e28('0x3b')][_0x1e28('0xb8')]()[_0x1e28('0x31')](respondWithResult(_0x4a1f32,null))['catch'](handleError(_0x4a1f32,null));};exports['addMessage']=function(_0x20578f,_0x174467,_0x10dccc){return db['FaxMessage'][_0x1e28('0x65')]({'where':{'id':_0x20578f[_0x1e28('0xb7')]['id']}})['then'](handleEntityNotFound(_0x174467,null))[_0x1e28('0x31')](function(_0xbb8e7){if(_0xbb8e7){return _0xbb8e7[_0x1e28('0xb9')](_0x20578f[_0x1e28('0x77')][_0x1e28('0xba')],_['omit'](_0x20578f[_0x1e28('0x77')],[_0x1e28('0xba'),'id'])||{});}})[_0x1e28('0x31')](respondWithResult(_0x174467,null))[_0x1e28('0x32')](handleError(_0x174467,null));};exports[_0x1e28('0xbb')]=function(_0x402906,_0x56ba67,_0x388d1a){var _0x33d2d1={'raw':![],'where':{}};var _0xfabab6={};var _0x2dd1b5={'count':0x0,'rows':[]};return db[_0x1e28('0x3b')][_0x1e28('0xbc')]({'where':{'id':_0x402906['params']['id']}})['then'](handleEntityNotFound(_0x56ba67,null))[_0x1e28('0x31')](function(_0x48d4ef){if(_0x48d4ef){_0xfabab6[_0x1e28('0x40')]=_[_0x1e28('0x42')](db[_0x1e28('0xbd')]['rawAttributes']);_0xfabab6[_0x1e28('0x41')]=_[_0x1e28('0x42')](_0x402906[_0x1e28('0x41')]);_0xfabab6[_0x1e28('0x43')]=_[_0x1e28('0x45')](_0xfabab6[_0x1e28('0x40')],_0xfabab6['query']);_0x33d2d1[_0x1e28('0x44')]=_[_0x1e28('0x45')](_0xfabab6[_0x1e28('0x40')],qs[_0x1e28('0x46')](_0x402906['query'][_0x1e28('0x46')]));_0x33d2d1[_0x1e28('0x44')]=_0x33d2d1[_0x1e28('0x44')][_0x1e28('0x47')]?_0x33d2d1[_0x1e28('0x44')]:_0xfabab6['model'];if(!_0x402906[_0x1e28('0x41')][_0x1e28('0x48')](_0x1e28('0xbe'))){_0x33d2d1['limit']=qs['limit'](_0x402906['query'][_0x1e28('0x49')]);_0x33d2d1['offset']=qs[_0x1e28('0x1c')](_0x402906[_0x1e28('0x41')][_0x1e28('0x1c')]);}_0x33d2d1[_0x1e28('0x4a')]=qs[_0x1e28('0x4b')](_0x402906['query'][_0x1e28('0x4b')]);_0x33d2d1['where']=qs['filters'](_[_0x1e28('0x4d')](_0x402906[_0x1e28('0x41')],_0xfabab6[_0x1e28('0x43')]));_0x33d2d1[_0x1e28('0x4c')]['FaxInteractionId']=_0x48d4ef['id'];if(_0x402906['query'][_0x1e28('0x87')]){_0x33d2d1[_0x1e28('0x4c')]=_['merge'](_0x33d2d1[_0x1e28('0x4c')],{'$or':_[_0x1e28('0x2a')](_0x33d2d1['attributes'],function(_0x1b77d7){var _0xb49e8f={};_0xb49e8f[_0x1b77d7]={'$like':'%'+_0x402906['query']['filter']+'%'};return _0xb49e8f;})});}if(_0x402906[_0x1e28('0x41')]['$gte']){var _0xe1a6a4=_0x402906[_0x1e28('0x41')][_0x1e28('0x7c')][_0x1e28('0x2e')](',');var _0x1ed35b={};_0x1ed35b[_0xe1a6a4[0x0]]={'$gte':moment(_0xe1a6a4[0x1])[_0x1e28('0xbf')](_0x1e28('0xc0'))};_0x33d2d1[_0x1e28('0x4c')]=_[_0x1e28('0xb4')](_0x33d2d1[_0x1e28('0x4c')],_0x1ed35b);}_0x33d2d1=_[_0x1e28('0xb4')]({},_0x33d2d1,_0x402906[_0x1e28('0xc1')]);return db[_0x1e28('0xbd')][_0x1e28('0x1e')]({'where':_0x33d2d1[_0x1e28('0x4c')]})[_0x1e28('0x31')](function(_0x5b49e0){_0x2dd1b5[_0x1e28('0x1e')]=_0x5b49e0;if(_0x402906['query'][_0x1e28('0xc2')]){_0x33d2d1['include']=[{'all':!![]}];}return db[_0x1e28('0xbd')]['findAll'](_0x33d2d1);})[_0x1e28('0x31')](function(_0x5ca09b){_0x2dd1b5[_0x1e28('0xc3')]=_0x5ca09b;return _0x2dd1b5;});}})['then'](respondWithFilteredResult(_0x56ba67,_0x33d2d1))[_0x1e28('0x32')](handleError(_0x56ba67,null));};exports['addTags']=function(_0x4735dc,_0x173ba7,_0x7c9477){return db[_0x1e28('0x3b')]['find']({'where':{'id':_0x4735dc[_0x1e28('0xb7')]['id']}})[_0x1e28('0x31')](handleEntityNotFound(_0x173ba7,null))[_0x1e28('0x31')](function(_0x185300){if(_0x185300){return _0x185300[_0x1e28('0xc4')](_0x4735dc[_0x1e28('0x77')][_0x1e28('0xba')],_[_0x1e28('0xc5')](_0x4735dc[_0x1e28('0x77')],[_0x1e28('0xba'),'id'])||{})['spread'](function(){return db['Tag'][_0x1e28('0xc6')]({'attributes':['id',_0x1e28('0x28'),_0x1e28('0x50')],'where':{'id':_0x4735dc['body'][_0x1e28('0xba')]}});})[_0x1e28('0x31')](function(_0x286262){socket[_0x1e28('0xc7')](_0x1e28('0xc8'),{'id':Number(_0x4735dc[_0x1e28('0xb7')]['id']),'tags':_0x286262||[]});return{'id':Number(_0x4735dc[_0x1e28('0xb7')]['id']),'tags':_0x286262||[]};});}})['then'](respondWithResult(_0x173ba7,null))['catch'](handleError(_0x173ba7,null));};exports[_0x1e28('0xc9')]=function(_0x4e6f8d,_0x35f1f1,_0x11efac){return db[_0x1e28('0x3b')][_0x1e28('0x65')]({'where':{'id':_0x4e6f8d[_0x1e28('0xb7')]['id']}})[_0x1e28('0x31')](handleEntityNotFound(_0x35f1f1,null))[_0x1e28('0x31')](function(_0x325346){if(_0x325346){return _0x325346[_0x1e28('0xc9')](_0x4e6f8d['query'][_0x1e28('0xba')]);}})[_0x1e28('0x31')](respondWithStatusCode(_0x35f1f1,null))[_0x1e28('0x32')](handleError(_0x35f1f1,null));};exports[_0x1e28('0xca')]=function(_0x385d92,_0x192398){var _0x53eb59=moment()['unix']()['toString']();var _0x5c6de3=path[_0x1e28('0xcb')](config[_0x1e28('0xcc')],_0x1e28('0xcd'),_0x1e28('0xce'),_0x1e28('0xcf'));var _0x4d88c5=path[_0x1e28('0xcb')](config[_0x1e28('0xcc')],_0x1e28('0xcd'),_0x1e28('0xce'),_0x1e28('0xd0'));var _0x4bee19=path[_0x1e28('0xcb')](_0x5c6de3,_0x53eb59);var _0x390ae6=util[_0x1e28('0xbf')](_0x1e28('0xd1'),_0x385d92[_0x1e28('0xb7')]['id'],_0x53eb59);var _0x57f176=path[_0x1e28('0xcb')](_0x5c6de3,_0x390ae6);var _0x4f55c5=[];_0x4f55c5[_0x1e28('0x30')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x153fe1=[{'model':db[_0x1e28('0xbd')],'as':_0x1e28('0xd2'),'attributes':['id','body',_0x1e28('0x7b')],'include':_0x4f55c5}];return db[_0x1e28('0x3b')][_0x1e28('0x65')]({'where':{'id':_0x385d92[_0x1e28('0xb7')]['id']},'include':_0x153fe1})['then'](handleEntityNotFound(_0x192398,null))[_0x1e28('0x31')](function(_0x453a8a){if(_0x453a8a&&_0x453a8a[_0x1e28('0xd2')]){var _0x3059a8=_0x453a8a[_0x1e28('0xd3')]({'plain':!![]});fs[_0x1e28('0xd4')](_0x4bee19);for(var _0x18bd11=0x0;_0x18bd11<_0x3059a8['Messages'][_0x1e28('0x47')];_0x18bd11++){var _0x3a567b=_0x3059a8[_0x1e28('0xd2')][_0x18bd11][_0x1e28('0xd5')];if(_0x3a567b){var _0xa4e8ff=path[_0x1e28('0xcb')](_0x4d88c5,_0x3a567b['basename']);if(fs[_0x1e28('0xd6')](_0xa4e8ff)){fs['createReadStream'](_0xa4e8ff)[_0x1e28('0xd7')](fs[_0x1e28('0xd8')](path[_0x1e28('0xcb')](_0x4bee19,_0x3a567b[_0x1e28('0xd9')])));}}}return BPromise[_0x1e28('0x95')]()[_0x1e28('0x31')](function(){return new BPromise(function(_0x2eb24a,_0x46f721){zipdir(_0x4bee19,{'saveTo':_0x57f176},function(_0x2fdc8f,_0x495c7f){if(_0x2fdc8f)return _0x46f721(_0x2fdc8f);return _0x2eb24a(_0x495c7f);});})['then'](function(){return new BPromise(function(_0x2f60c9,_0x2dea15){rimraf(_0x4bee19,function(_0x2d8ebb){if(_0x2d8ebb)_0x2dea15(_0x2d8ebb);return _0x2f60c9();});});})[_0x1e28('0x31')](function(){return _0x192398[_0x1e28('0xca')](_0x57f176,_0x390ae6,function(_0x354188){if(_0x354188){console['log'](_0x1e28('0xda'),_0x354188);}else{fs[_0x1e28('0xdb')](_0x57f176);}});});});}else{return _0x192398[_0x1e28('0x1a')](0xc8);}})['catch'](handleError(_0x192398,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a9cfef5..11508dc 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 _0xfab8=['setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','then'];(function(_0x9eae4f,_0x8e6916){var _0x393ec5=function(_0x47fafa){while(--_0x47fafa){_0x9eae4f['push'](_0x9eae4f['shift']());}};_0x393ec5(++_0x8e6916);}(_0xfab8,0x91));var _0x8fab=function(_0x225ddd,_0x4c55a5){_0x225ddd=_0x225ddd-0x0;var _0x476e26=_0xfab8[_0x225ddd];return _0x476e26;};'use strict';var EventEmitter=require(_0x8fab('0x0'));var FaxInteraction=require(_0x8fab('0x1'))['db'][_0x8fab('0x2')];var FaxMessage=require(_0x8fab('0x1'))['db'][_0x8fab('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8fab('0x4')](0x0);var events={'afterCreate':_0x8fab('0x5'),'afterUpdate':_0x8fab('0x6'),'afterDestroy':'remove'};function emitEvent(_0x3bdf12){return function(_0x57e85f,_0x4344d6,_0x15245a){_0x57e85f['getUsers']({'attributes':['id'],'raw':!![]})[_0x8fab('0x7')](function(_0x2810cb){_0x57e85f[_0x8fab('0x8')]('Users',_0x2810cb[_0x8fab('0x9')](function(_0x493097){return{'id':_0x493097['id']};}));return FaxMessage[_0x8fab('0xa')]({'where':{'FaxInteractionId':_0x57e85f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8fab('0x7')](function(_0x512d02){_0x57e85f['setDataValue']('unreadMessages',_0x512d02[_0x8fab('0xb')]);FaxInteractionEvents['emit'](_0x3bdf12+':'+_0x57e85f['id'],_0x57e85f);FaxInteractionEvents[_0x8fab('0xc')](_0x3bdf12,_0x57e85f);_0x15245a(null);})[_0x8fab('0xd')](_0x15245a(null));};}for(var e in events){if(events[_0x8fab('0xe')](e)){var event=events[e];FaxInteraction[_0x8fab('0xf')](e,emitEvent(event));}}module[_0x8fab('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x5de7=['hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','save','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x5de7,0x1b3));var _0x75de=function(_0xa4a1d2,_0x31d60e){_0xa4a1d2=_0xa4a1d2-0x0;var _0x4faadb=_0x5de7[_0xa4a1d2];return _0x4faadb;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x75de('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x75de('0x0'))['db'][_0x75de('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75de('0x2'),'afterUpdate':_0x75de('0x3'),'afterDestroy':_0x75de('0x4')};function emitEvent(_0x5b544d){return function(_0x54ff03,_0x1cc7d5,_0xe7d8f6){_0x54ff03[_0x75de('0x5')]({'attributes':['id'],'raw':!![]})[_0x75de('0x6')](function(_0xcc141d){_0x54ff03[_0x75de('0x7')]('Users',_0xcc141d['map'](function(_0x510660){return{'id':_0x510660['id']};}));return FaxMessage[_0x75de('0x8')]({'where':{'FaxInteractionId':_0x54ff03['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x480ca2){_0x54ff03[_0x75de('0x7')](_0x75de('0x9'),_0x480ca2[_0x75de('0xa')]);FaxInteractionEvents['emit'](_0x5b544d+':'+_0x54ff03['id'],_0x54ff03);FaxInteractionEvents[_0x75de('0xb')](_0x5b544d,_0x54ff03);_0xe7d8f6(null);})[_0x75de('0xc')](_0xe7d8f6(null));};}for(var e in events){if(events[_0x75de('0xd')](e)){var event=events[e];FaxInteraction[_0x75de('0xe')](e,emitEvent(event));}}module[_0x75de('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 10bb285..7cdb9e8 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 _0xac19=['bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac19,0x11d));var _0x9ac1=function(_0x1881ac,_0x57ecf4){_0x1881ac=_0x1881ac-0x0;var _0x3b966e=_0xac19[_0x1881ac];return _0x3b966e;};'use strict';var _=require(_0x9ac1('0x0'));var util=require(_0x9ac1('0x1'));var logger=require('../../config/logger')(_0x9ac1('0x2'));var moment=require(_0x9ac1('0x3'));var BPromise=require(_0x9ac1('0x4'));var rp=require(_0x9ac1('0x5'));var fs=require('fs');var path=require(_0x9ac1('0x6'));var rimraf=require('rimraf');var config=require(_0x9ac1('0x7'));var attributes=require(_0x9ac1('0x8'));module[_0x9ac1('0x9')]=function(_0x4cf2c2,_0x43e2f4){return _0x4cf2c2[_0x9ac1('0xa')](_0x9ac1('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x96748c,_0x1422b9,_0x36ad17){if(_0x96748c[_0x9ac1('0xc')](_0x9ac1('0xd'))){_0x96748c[_0x9ac1('0xe')]=moment()[_0x9ac1('0xf')](_0x9ac1('0x10'));}_0x36ad17(null,_0x96748c);}}});}; \ No newline at end of file +var _0xa99c=['path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa99c,0x15a));var _0xca99=function(_0x3002cd,_0x44944a){_0x3002cd=_0x3002cd-0x0;var _0x24cf78=_0xa99c[_0x3002cd];return _0x24cf78;};'use strict';var _=require(_0xca99('0x0'));var util=require(_0xca99('0x1'));var logger=require('../../config/logger')(_0xca99('0x2'));var moment=require(_0xca99('0x3'));var BPromise=require(_0xca99('0x4'));var rp=require(_0xca99('0x5'));var fs=require('fs');var path=require(_0xca99('0x6'));var rimraf=require('rimraf');var config=require(_0xca99('0x7'));var attributes=require(_0xca99('0x8'));module[_0xca99('0x9')]=function(_0x559665,_0x243187){return _0x559665[_0xca99('0xa')](_0xca99('0xb'),attributes,{'tableName':_0xca99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d79d8,_0x9208ea,_0x4a55ab){if(_0x3d79d8[_0xca99('0xd')]('closed')){_0x3d79d8[_0xca99('0xe')]=moment()[_0xca99('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4a55ab(null,_0x3d79d8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7926e69..c21d546 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 _0x6266=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','AddTagsToFaxInteraction','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring'];(function(_0x5ed8f8,_0x245c75){var _0x1eddd2=function(_0x17c56b){while(--_0x17c56b){_0x5ed8f8['push'](_0x5ed8f8['shift']());}};_0x1eddd2(++_0x245c75);}(_0x6266,0xa8));var _0x6626=function(_0x5753d0,_0x223cfc){_0x5753d0=_0x5753d0-0x0;var _0x935940=_0x6266[_0x5753d0];return _0x935940;};'use strict';var _=require('lodash');var util=require(_0x6626('0x0'));var moment=require(_0x6626('0x1'));var BPromise=require(_0x6626('0x2'));var rs=require(_0x6626('0x3'));var fs=require('fs');var Redis=require(_0x6626('0x4'));var db=require(_0x6626('0x5'))['db'];var utils=require(_0x6626('0x6'));var logger=require(_0x6626('0x7'))(_0x6626('0x8'));var config=require(_0x6626('0x9'));var jayson=require(_0x6626('0xa'));var client=jayson[_0x6626('0xb')][_0x6626('0xc')]({'port':0x232a});config[_0x6626('0xd')]=_[_0x6626('0xe')](config[_0x6626('0xd')],{'host':_0x6626('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6626('0xd')]));require(_0x6626('0x10'))[_0x6626('0x11')](socket);function respondWithRpcPromise(_0xf64701,_0x1f8df9,_0x52a84c){return new BPromise(function(_0x35665e,_0x1bfc21){return client['request'](_0xf64701,_0x52a84c)[_0x6626('0x12')](function(_0x32f363){logger[_0x6626('0x13')](_0x6626('0x14'),_0x1f8df9,_0x6626('0x15'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1f8df9,_0x6626('0x15'),JSON['stringify'](_0x32f363));if(_0x32f363['error']){if(_0x32f363[_0x6626('0x16')][_0x6626('0x17')]===0x1f4){logger['error'](_0x6626('0x14'),_0x1f8df9,_0x32f363[_0x6626('0x16')][_0x6626('0x18')]);return _0x1bfc21(_0x32f363[_0x6626('0x16')][_0x6626('0x18')]);}logger[_0x6626('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1f8df9,_0x32f363[_0x6626('0x16')]['message']);return _0x35665e(_0x32f363[_0x6626('0x16')][_0x6626('0x18')]);}else{logger[_0x6626('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x1f8df9,_0x6626('0x15'));_0x35665e(_0x32f363[_0x6626('0x19')][_0x6626('0x18')]);}})[_0x6626('0x1a')](function(_0x417a02){logger[_0x6626('0x16')](_0x6626('0x14'),_0x1f8df9,_0x417a02);_0x1bfc21(_0x417a02);});});}exports[_0x6626('0x1b')]=function(_0x205102){var _0x537211=this;return new Promise(function(_0x565a93,_0x4284db){return db[_0x6626('0x1c')][_0x6626('0x1d')](_0x205102[_0x6626('0x1e')],{'raw':_0x205102[_0x6626('0x1f')]?_0x205102[_0x6626('0x1f')][_0x6626('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x205102['options']?_0x205102[_0x6626('0x1f')][_0x6626('0x21')]||null:null,'attributes':_0x205102['options']?_0x205102['options'][_0x6626('0x22')]||null:null,'limit':_0x205102[_0x6626('0x1f')]?_0x205102[_0x6626('0x1f')][_0x6626('0x23')]||null:null})[_0x6626('0x12')](function(_0x3d862a){logger['info'](_0x6626('0x1b'),_0x205102);logger[_0x6626('0x24')](_0x6626('0x1b'),_0x205102,JSON[_0x6626('0x25')](_0x3d862a));_0x565a93(_0x3d862a);})[_0x6626('0x1a')](function(_0x29259f){logger[_0x6626('0x16')]('UpdateFaxInteraction',_0x29259f[_0x6626('0x18')],_0x205102);_0x4284db(_0x537211[_0x6626('0x16')](0x1f4,_0x29259f[_0x6626('0x18')]));});});};exports[_0x6626('0x26')]=function(_0x4c2913){return new Promise(function(_0x2f4cdb,_0x59d938){return db[_0x6626('0x1c')]['find']({'where':_0x4c2913[_0x6626('0x1f')]?_0x4c2913['options']['where']||null:null})['then'](function(_0x273d75){if(_0x273d75){return _0x273d75[_0x6626('0x27')](_0x4c2913[_0x6626('0x1e')][_0x6626('0x28')],_['omit'](_0x4c2913[_0x6626('0x1e')],[_0x6626('0x28'),'id'])||{});}})[_0x6626('0x29')](function(_0x3905e6){logger[_0x6626('0x13')]('AddTags',_0x4c2913);logger[_0x6626('0x24')](_0x6626('0x2a'),_0x4c2913,JSON[_0x6626('0x25')](_0x3905e6));_0x2f4cdb(_0x3905e6);})[_0x6626('0x1a')](function(_0x5715f9){logger[_0x6626('0x16')](_0x6626('0x2a'),_0x5715f9['message'],_0x4c2913);_0x59d938(_this[_0x6626('0x16')](0x1f4,_0x5715f9[_0x6626('0x18')]));});});}; \ No newline at end of file +var _0x6a71=['options','raw','limit','AddTagsToFaxInteraction','FaxInteraction','where','omit','ids','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','body'];(function(_0x3ab5a6,_0xab629e){var _0x390cb0=function(_0x15c3b2){while(--_0x15c3b2){_0x3ab5a6['push'](_0x3ab5a6['shift']());}};_0x390cb0(++_0xab629e);}(_0x6a71,0xc7));var _0x16a7=function(_0x3afb80,_0x1bd4b2){_0x3afb80=_0x3afb80-0x0;var _0x2094fd=_0x6a71[_0x3afb80];return _0x2094fd;};'use strict';var _=require('lodash');var util=require(_0x16a7('0x0'));var moment=require(_0x16a7('0x1'));var BPromise=require(_0x16a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16a7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x16a7('0x4'));var logger=require(_0x16a7('0x5'))(_0x16a7('0x6'));var config=require(_0x16a7('0x7'));var jayson=require(_0x16a7('0x8'));var client=jayson[_0x16a7('0x9')][_0x16a7('0xa')]({'port':0x232a});config['redis']=_[_0x16a7('0xb')](config[_0x16a7('0xc')],{'host':_0x16a7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x16a7('0xc')]));require('./faxInteraction.socket')[_0x16a7('0xe')](socket);function respondWithRpcPromise(_0x52ae7d,_0x3f7fed,_0x443ad5){return new BPromise(function(_0x1923fe,_0x2991de){return client['request'](_0x52ae7d,_0x443ad5)[_0x16a7('0xf')](function(_0x2767ef){logger[_0x16a7('0x10')](_0x16a7('0x11'),_0x3f7fed,_0x16a7('0x12'));logger['debug'](_0x16a7('0x13'),_0x3f7fed,_0x16a7('0x12'),JSON[_0x16a7('0x14')](_0x2767ef));if(_0x2767ef[_0x16a7('0x15')]){if(_0x2767ef[_0x16a7('0x15')][_0x16a7('0x16')]===0x1f4){logger[_0x16a7('0x15')](_0x16a7('0x11'),_0x3f7fed,_0x2767ef[_0x16a7('0x15')][_0x16a7('0x17')]);return _0x2991de(_0x2767ef[_0x16a7('0x15')][_0x16a7('0x17')]);}logger[_0x16a7('0x15')](_0x16a7('0x11'),_0x3f7fed,_0x2767ef[_0x16a7('0x15')]['message']);return _0x1923fe(_0x2767ef[_0x16a7('0x15')][_0x16a7('0x17')]);}else{logger[_0x16a7('0x10')](_0x16a7('0x11'),_0x3f7fed,_0x16a7('0x12'));_0x1923fe(_0x2767ef[_0x16a7('0x18')][_0x16a7('0x17')]);}})[_0x16a7('0x19')](function(_0x4ea029){logger[_0x16a7('0x15')](_0x16a7('0x11'),_0x3f7fed,_0x4ea029);_0x2991de(_0x4ea029);});});}exports[_0x16a7('0x1a')]=function(_0x1ec162){var _0x1b2bec=this;return new Promise(function(_0x2e0e8c,_0x36d02c){return db['FaxInteraction'][_0x16a7('0x1b')](_0x1ec162[_0x16a7('0x1c')],{'raw':_0x1ec162[_0x16a7('0x1d')]?_0x1ec162[_0x16a7('0x1d')][_0x16a7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec162['options']?_0x1ec162[_0x16a7('0x1d')]['where']||null:null,'attributes':_0x1ec162[_0x16a7('0x1d')]?_0x1ec162[_0x16a7('0x1d')]['attributes']||null:null,'limit':_0x1ec162['options']?_0x1ec162['options'][_0x16a7('0x1f')]||null:null})[_0x16a7('0xf')](function(_0x184ded){logger[_0x16a7('0x10')]('UpdateFaxInteraction',_0x1ec162);logger['debug']('UpdateFaxInteraction',_0x1ec162,JSON['stringify'](_0x184ded));_0x2e0e8c(_0x184ded);})[_0x16a7('0x19')](function(_0x2a2787){logger[_0x16a7('0x15')](_0x16a7('0x1a'),_0x2a2787[_0x16a7('0x17')],_0x1ec162);_0x36d02c(_0x1b2bec['error'](0x1f4,_0x2a2787[_0x16a7('0x17')]));});});};exports[_0x16a7('0x20')]=function(_0x82ab60){return new Promise(function(_0x28364d,_0x2b4439){return db[_0x16a7('0x21')]['find']({'where':_0x82ab60[_0x16a7('0x1d')]?_0x82ab60['options'][_0x16a7('0x22')]||null:null})[_0x16a7('0xf')](function(_0x2ec89f){if(_0x2ec89f){return _0x2ec89f['addTags'](_0x82ab60[_0x16a7('0x1c')]['ids'],_[_0x16a7('0x23')](_0x82ab60[_0x16a7('0x1c')],[_0x16a7('0x24'),'id'])||{});}})['spread'](function(_0x431503){logger[_0x16a7('0x10')](_0x16a7('0x25'),_0x82ab60);logger['debug'](_0x16a7('0x25'),_0x82ab60,JSON[_0x16a7('0x14')](_0x431503));_0x28364d(_0x431503);})[_0x16a7('0x19')](function(_0x480d84){logger[_0x16a7('0x15')]('AddTags',_0x480d84['message'],_0x82ab60);_0x2b4439(_this['error'](0x1f4,_0x480d84['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 22b843f..d4e2e52 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 _0x1138=['update','emit','removeListener','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x3c444d,_0x23dfd4){var _0x649c0c=function(_0x2043fb){while(--_0x2043fb){_0x3c444d['push'](_0x3c444d['shift']());}};_0x649c0c(++_0x23dfd4);}(_0x1138,0xa5));var _0x8113=function(_0x242c29,_0x59918e){_0x242c29=_0x242c29-0x0;var _0x5a3eb4=_0x1138[_0x242c29];return _0x5a3eb4;};'use strict';var FaxInteractionEvents=require(_0x8113('0x0'));var events=[_0x8113('0x1'),_0x8113('0x2'),_0x8113('0x3')];function createListener(_0x45ac98,_0x1a7172){return function(_0x3b9e35){_0x1a7172[_0x8113('0x4')](_0x45ac98,_0x3b9e35);};}function removeListener(_0x42279b,_0x1a83c2){return function(){FaxInteractionEvents[_0x8113('0x5')](_0x42279b,_0x1a83c2);};}exports[_0x8113('0x6')]=function(_0x4e9a8e){for(var _0x22ca1c=0x0,_0x44e51b=events['length'];_0x22ca1c<_0x44e51b;_0x22ca1c++){var _0x2b5724=events[_0x22ca1c];var _0x11cf66=createListener(_0x8113('0x7')+_0x2b5724,_0x4e9a8e);FaxInteractionEvents['on'](_0x2b5724,_0x11cf66);}}; \ No newline at end of file +var _0x86dc=['./faxInteraction.events','save','update','emit','removeListener','length','faxInteraction:'];(function(_0x824df6,_0x3359a0){var _0x3e5401=function(_0x383a7a){while(--_0x383a7a){_0x824df6['push'](_0x824df6['shift']());}};_0x3e5401(++_0x3359a0);}(_0x86dc,0xb6));var _0xc86d=function(_0xd15f53,_0x2588a){_0xd15f53=_0xd15f53-0x0;var _0x127bcb=_0x86dc[_0xd15f53];return _0x127bcb;};'use strict';var FaxInteractionEvents=require(_0xc86d('0x0'));var events=[_0xc86d('0x1'),'remove',_0xc86d('0x2')];function createListener(_0xaf388e,_0x14323f){return function(_0x221d7d){_0x14323f[_0xc86d('0x3')](_0xaf388e,_0x221d7d);};}function removeListener(_0xf07b22,_0x4e3bbf){return function(){FaxInteractionEvents[_0xc86d('0x4')](_0xf07b22,_0x4e3bbf);};}exports['register']=function(_0x2d80a7){for(var _0x115123=0x0,_0x1a952d=events[_0xc86d('0x5')];_0x115123<_0x1a952d;_0x115123++){var _0x33298a=events[_0x115123];var _0x4947f3=createListener(_0xc86d('0x6')+_0x33298a,_0x2d80a7);FaxInteractionEvents['on'](_0x33298a,_0x4947f3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 305cb00..452efd9 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 _0xb743=['delete','faxinteraction:destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','update'];(function(_0x4e574f,_0x427025){var _0x3f05fa=function(_0x56bf9f){while(--_0x56bf9f){_0x4e574f['push'](_0x4e574f['shift']());}};_0x3f05fa(++_0x427025);}(_0xb743,0x72));var _0x3b74=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xb743[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x3b74('0x0'));var util=require('util');var path=require(_0x3b74('0x1'));var timeout=require(_0x3b74('0x2'));var express=require('express');var router=express[_0x3b74('0x3')]();var fs_extra=require(_0x3b74('0x4'));var auth=require(_0x3b74('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3b74('0x6'));router[_0x3b74('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b74('0x8')]);router['get'](_0x3b74('0x9'),auth['isAuthenticated'](),controller[_0x3b74('0xa')]);router[_0x3b74('0x7')](_0x3b74('0xb'),auth[_0x3b74('0xc')](),controller[_0x3b74('0xd')]);router[_0x3b74('0x7')](_0x3b74('0xe'),auth[_0x3b74('0xc')](),controller['getMessages']);router[_0x3b74('0x7')](_0x3b74('0xf'),auth[_0x3b74('0xc')](),controller[_0x3b74('0x10')]);router[_0x3b74('0x11')]('/',auth[_0x3b74('0xc')](),controller[_0x3b74('0x12')]);router['post'](_0x3b74('0xe'),auth['isAuthenticated'](),controller[_0x3b74('0x13')]);router[_0x3b74('0x11')](_0x3b74('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x3b74('0x15'),_0x3b74('0x16')),controller[_0x3b74('0x17')]);router[_0x3b74('0x18')]('/:id',auth[_0x3b74('0xc')](),interaction['tracked'](_0x3b74('0x15'),'faxinteraction:update'),controller[_0x3b74('0x19')]);router[_0x3b74('0x1a')](_0x3b74('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x3b74('0x15'),_0x3b74('0x1b')),controller['destroy']);router['delete'](_0x3b74('0x14'),auth[_0x3b74('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x29f3=['show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x29f3,0x1c3));var _0x329f=function(_0x1a161b,_0x4d3ffb){_0x1a161b=_0x1a161b-0x0;var _0x3e7d80=_0x29f3[_0x1a161b];return _0x3e7d80;};'use strict';var multer=require(_0x329f('0x0'));var util=require(_0x329f('0x1'));var path=require(_0x329f('0x2'));var timeout=require('connect-timeout');var express=require(_0x329f('0x3'));var router=express[_0x329f('0x4')]();var fs_extra=require(_0x329f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x329f('0x6'));var config=require(_0x329f('0x7'));var controller=require(_0x329f('0x8'));router[_0x329f('0x9')]('/',auth[_0x329f('0xa')](),controller[_0x329f('0xb')]);router['get'](_0x329f('0xc'),auth[_0x329f('0xa')](),controller['describe']);router[_0x329f('0x9')](_0x329f('0xd'),auth['isAuthenticated'](),controller[_0x329f('0xe')]);router[_0x329f('0x9')](_0x329f('0xf'),auth[_0x329f('0xa')](),controller['getMessages']);router['get'](_0x329f('0x10'),auth[_0x329f('0xa')](),controller[_0x329f('0x11')]);router[_0x329f('0x12')]('/',auth[_0x329f('0xa')](),controller[_0x329f('0x13')]);router[_0x329f('0x12')](_0x329f('0xf'),auth[_0x329f('0xa')](),controller[_0x329f('0x14')]);router['post']('/:id/tags',auth[_0x329f('0xa')](),interaction[_0x329f('0x15')](_0x329f('0x16'),_0x329f('0x17')),controller['addTags']);router[_0x329f('0x18')](_0x329f('0xd'),auth[_0x329f('0xa')](),interaction['tracked']('fax',_0x329f('0x19')),controller[_0x329f('0x1a')]);router[_0x329f('0x1b')](_0x329f('0xd'),auth[_0x329f('0xa')](),interaction[_0x329f('0x15')](_0x329f('0x16'),'faxinteraction:destroy'),controller[_0x329f('0x1c')]);router[_0x329f('0x1b')]('/:id/tags',auth['isAuthenticated'](),controller[_0x329f('0x1d')]);module[_0x329f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b927d9f..05646d8 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 _0x0eaa=['BOOLEAN','ENUM','out','TEXT','DATE','sequelize','exports'];(function(_0x1429a8,_0x7020b3){var _0x1f89ac=function(_0x17354f){while(--_0x17354f){_0x1429a8['push'](_0x1429a8['shift']());}};_0x1f89ac(++_0x7020b3);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0xab67c4,_0x153d74){_0xab67c4=_0xab67c4-0x0;var _0x915d55=_0x0eaa[_0xab67c4];return _0x915d55;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module[_0xa0ea('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa0ea('0x3')]('in','out'),'defaultValue':_0xa0ea('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa0ea('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa0ea('0x6')]}}; \ No newline at end of file +var _0x87f8=['out','TEXT','DATE','medium','BOOLEAN'];(function(_0x5d4ca7,_0x19113b){var _0x3efc03=function(_0x59675b){while(--_0x59675b){_0x5d4ca7['push'](_0x5d4ca7['shift']());}};_0x3efc03(++_0x19113b);}(_0x87f8,0x152));var _0x887f=function(_0x379b63,_0x36eea6){_0x379b63=_0x379b63-0x0;var _0x2193f5=_0x87f8[_0x379b63];return _0x2193f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x887f('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x887f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x887f('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x887f('0x3')],'defaultValue':null},'readAt':{'type':Sequelize[_0x887f('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1fc38b7..847b1b8 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 _0x2630=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','rows','show','params','rawAttributes','keys','includeAll','include','options','body','find','describe','fax-interactions','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','channel','motionChannel','accept','EventManager','acceptmessage','RejectMessage','rejectMessage','fullname','email','SIP/%s','event','rejectmessage','create','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','attachments','Attachment','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x2630,0x1ac));var _0x0263=function(_0x41879f,_0x4d5137){_0x41879f=_0x41879f-0x0;var _0x448af2=_0x2630[_0x41879f];return _0x448af2;};'use strict';var emlformat=require(_0x0263('0x0'));var rimraf=require(_0x0263('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0263('0x2'));var rp=require(_0x0263('0x3'));var moment=require(_0x0263('0x4'));var BPromise=require(_0x0263('0x5'));var Mustache=require(_0x0263('0x6'));var util=require(_0x0263('0x7'));var path=require(_0x0263('0x8'));var sox=require(_0x0263('0x9'));var csv=require('to-csv');var ejs=require(_0x0263('0xa'));var fs=require('fs');var fs_extra=require(_0x0263('0xb'));var _=require(_0x0263('0xc'));var squel=require('squel');var crypto=require(_0x0263('0xd'));var jsforce=require(_0x0263('0xe'));var deskjs=require(_0x0263('0xf'));var toCsv=require(_0x0263('0x10'));var querystring=require(_0x0263('0x11'));var Papa=require(_0x0263('0x12'));var Redis=require(_0x0263('0x13'));var authService=require(_0x0263('0x14'));var qs=require(_0x0263('0x15'));var as=require(_0x0263('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0263('0x17'))(_0x0263('0x18'));var utils=require(_0x0263('0x19'));var config=require(_0x0263('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0263('0x1b')]=_[_0x0263('0x1c')](config[_0x0263('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0263('0x1b')]));require(_0x0263('0x1d'))[_0x0263('0x1e')](socket);var jayson=require(_0x0263('0x1f'));var client=jayson[_0x0263('0x20')][_0x0263('0x21')]({'port':0x232c});var client9002=jayson[_0x0263('0x20')][_0x0263('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2cbf08,_0x5343e9,_0x1285ce,_0x4933f5){return new BPromise(function(_0x47399b,_0x3fee4a){var _0x40b9d7=_0x4933f5||client;return _0x40b9d7[_0x0263('0x22')](_0x2cbf08,_0x1285ce)[_0x0263('0x23')](function(_0xba880a){logger[_0x0263('0x24')](_0x0263('0x25'),_0x5343e9,_0x0263('0x26'));logger[_0x0263('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5343e9,'request\x20sent',JSON[_0x0263('0x28')](_0xba880a));if(_0xba880a[_0x0263('0x29')]){if(_0xba880a[_0x0263('0x29')][_0x0263('0x2a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5343e9,_0xba880a[_0x0263('0x29')]['message']);return _0x3fee4a(_0xba880a[_0x0263('0x29')][_0x0263('0x2b')]);}logger[_0x0263('0x29')](_0x0263('0x25'),_0x5343e9,_0xba880a[_0x0263('0x29')]['message']);return _0x47399b(_0xba880a['error'][_0x0263('0x2b')]);}else{logger[_0x0263('0x24')](_0x0263('0x25'),_0x5343e9,'request\x20sent');_0x47399b(_0xba880a[_0x0263('0x2c')][_0x0263('0x2b')]);}})[_0x0263('0x2d')](function(_0x929857){logger['error'](_0x0263('0x25'),_0x5343e9,_0x929857);_0x3fee4a(_0x929857);});});}function respondWithStatusCode(_0x539cb5,_0x4cc1c9){_0x4cc1c9=_0x4cc1c9||0xcc;return function(_0x1085a1){if(_0x1085a1){return _0x539cb5[_0x0263('0x2e')](_0x4cc1c9);}return _0x539cb5[_0x0263('0x2f')](_0x4cc1c9)[_0x0263('0x30')]();};}function respondWithResult(_0x20057a,_0x37f8bf){_0x37f8bf=_0x37f8bf||0xc8;return function(_0x3bf803){if(_0x3bf803){return _0x20057a[_0x0263('0x2f')](_0x37f8bf)[_0x0263('0x31')](_0x3bf803);}};}function respondWithFilteredResult(_0x55e872,_0x50025c){return function(_0x145cc8){if(_0x145cc8){var _0x258ae0=typeof _0x50025c[_0x0263('0x32')]==='undefined'&&typeof _0x50025c[_0x0263('0x33')]===_0x0263('0x34');var _0x5ac2fd=_0x145cc8['count'];var _0x3e2e69=_0x258ae0?0x0:_0x50025c['offset'];var _0xfa9785=_0x258ae0?_0x145cc8[_0x0263('0x35')]:_0x50025c[_0x0263('0x32')]+_0x50025c[_0x0263('0x33')];var _0x111104;if(_0xfa9785>=_0x5ac2fd){_0xfa9785=_0x5ac2fd;_0x111104=0xc8;}else{_0x111104=0xce;}_0x55e872['status'](_0x111104);return _0x55e872[_0x0263('0x36')](_0x0263('0x37'),_0x3e2e69+'-'+_0xfa9785+'/'+_0x5ac2fd)['json'](_0x145cc8);}return null;};}function patchUpdates(_0x6c4826){return function(_0x3c1227){try{jsonpatch['apply'](_0x3c1227,_0x6c4826,!![]);}catch(_0x189414){return BPromise[_0x0263('0x38')](_0x189414);}return _0x3c1227[_0x0263('0x39')]();};}function saveUpdates(_0x25c8dd,_0x2f1300){return function(_0x2f9606){if(_0x2f9606){return _0x2f9606[_0x0263('0x3a')](_0x25c8dd)[_0x0263('0x23')](function(_0x545435){return _0x545435;});}return null;};}function removeEntity(_0x542ca3,_0x593a48){return function(_0x32ec45){if(_0x32ec45){return _0x32ec45[_0x0263('0x3b')]()[_0x0263('0x23')](function(){_0x542ca3[_0x0263('0x2f')](0xcc)[_0x0263('0x30')]();});}};}function handleEntityNotFound(_0x12c233,_0x4f6855){return function(_0x139c3a){if(!_0x139c3a){_0x12c233[_0x0263('0x2e')](0x194);}return _0x139c3a;};}function handleError(_0x2deb67,_0x4e7158){_0x4e7158=_0x4e7158||0x1f4;return function(_0x85576e){logger[_0x0263('0x29')](_0x85576e[_0x0263('0x3c')]);if(_0x85576e['name']){delete _0x85576e[_0x0263('0x3d')];}_0x2deb67[_0x0263('0x2f')](_0x4e7158)[_0x0263('0x3e')](_0x85576e);};}exports[_0x0263('0x3f')]=function(_0xc06bd8,_0x358272){var _0x3b6978={},_0x433061={},_0x17eb08={'count':0x0,'rows':[]};var _0x8dffbf=_[_0x0263('0x40')](db[_0x0263('0x41')]['rawAttributes'],function(_0xc572d1){return{'name':_0xc572d1[_0x0263('0x42')],'type':_0xc572d1['type'][_0x0263('0x43')]};});_0x433061[_0x0263('0x44')]=_[_0x0263('0x40')](_0x8dffbf,_0x0263('0x3d'));_0x433061[_0x0263('0x45')]=_['keys'](_0xc06bd8['query']);_0x433061[_0x0263('0x46')]=_['intersection'](_0x433061['model'],_0x433061['query']);_0x3b6978[_0x0263('0x47')]=_[_0x0263('0x48')](_0x433061[_0x0263('0x44')],qs[_0x0263('0x49')](_0xc06bd8[_0x0263('0x45')][_0x0263('0x49')]));_0x3b6978[_0x0263('0x47')]=_0x3b6978[_0x0263('0x47')][_0x0263('0x4a')]?_0x3b6978[_0x0263('0x47')]:_0x433061[_0x0263('0x44')];if(!_0xc06bd8[_0x0263('0x45')][_0x0263('0x4b')](_0x0263('0x4c'))){_0x3b6978[_0x0263('0x33')]=qs[_0x0263('0x33')](_0xc06bd8[_0x0263('0x45')]['limit']);_0x3b6978['offset']=qs[_0x0263('0x32')](_0xc06bd8['query'][_0x0263('0x32')]);}_0x3b6978[_0x0263('0x4d')]=qs[_0x0263('0x4e')](_0xc06bd8[_0x0263('0x45')][_0x0263('0x4e')]);_0x3b6978[_0x0263('0x4f')]=qs[_0x0263('0x46')](_[_0x0263('0x50')](_0xc06bd8[_0x0263('0x45')],_0x433061['filters']),_0x8dffbf);if(_0xc06bd8[_0x0263('0x45')][_0x0263('0x51')]){_0x3b6978[_0x0263('0x4f')]=_['merge'](_0x3b6978[_0x0263('0x4f')],{'$or':_[_0x0263('0x40')](_0x8dffbf,function(_0x3cea81){if(_0x3cea81[_0x0263('0x52')]!==_0x0263('0x53')){var _0x5c0fe0={};_0x5c0fe0[_0x3cea81[_0x0263('0x3d')]]={'$like':'%'+_0xc06bd8['query'][_0x0263('0x51')]+'%'};return _0x5c0fe0;}})});}_0x3b6978=_[_0x0263('0x54')]({},_0x3b6978,_0xc06bd8['options']);var _0x1845bc={'where':_0x3b6978[_0x0263('0x4f')]};return db[_0x0263('0x41')][_0x0263('0x35')](_0x1845bc)[_0x0263('0x23')](function(_0x404afa){_0x17eb08[_0x0263('0x35')]=_0x404afa;if(_0xc06bd8[_0x0263('0x45')]['includeAll']){_0x3b6978['include']=[{'all':!![]}];}return db[_0x0263('0x41')]['findAll'](_0x3b6978);})['then'](function(_0x4ad7a8){_0x17eb08[_0x0263('0x55')]=_0x4ad7a8;return _0x17eb08;})[_0x0263('0x23')](respondWithFilteredResult(_0x358272,_0x3b6978))[_0x0263('0x2d')](handleError(_0x358272,null));};exports[_0x0263('0x56')]=function(_0x27e3a9,_0x1f9111){var _0x180ae3={'raw':!![],'where':{'id':_0x27e3a9[_0x0263('0x57')]['id']}},_0x57af0d={};_0x57af0d[_0x0263('0x44')]=_['keys'](db[_0x0263('0x41')][_0x0263('0x58')]);_0x57af0d[_0x0263('0x45')]=_[_0x0263('0x59')](_0x27e3a9[_0x0263('0x45')]);_0x57af0d[_0x0263('0x46')]=_['intersection'](_0x57af0d[_0x0263('0x44')],_0x57af0d['query']);_0x180ae3[_0x0263('0x47')]=_[_0x0263('0x48')](_0x57af0d[_0x0263('0x44')],qs[_0x0263('0x49')](_0x27e3a9['query']['fields']));_0x180ae3[_0x0263('0x47')]=_0x180ae3[_0x0263('0x47')][_0x0263('0x4a')]?_0x180ae3[_0x0263('0x47')]:_0x57af0d[_0x0263('0x44')];if(_0x27e3a9['query'][_0x0263('0x5a')]){_0x180ae3[_0x0263('0x5b')]=[{'all':!![]}];}_0x180ae3=_[_0x0263('0x54')]({},_0x180ae3,_0x27e3a9[_0x0263('0x5c')]);return db[_0x0263('0x41')]['find'](_0x180ae3)[_0x0263('0x23')](handleEntityNotFound(_0x1f9111,null))[_0x0263('0x23')](respondWithResult(_0x1f9111,null))[_0x0263('0x2d')](handleError(_0x1f9111,null));};exports[_0x0263('0x3a')]=function(_0x3c9383,_0x5ca6b3){if(_0x3c9383[_0x0263('0x5d')]['id']){delete _0x3c9383['body']['id'];}return db[_0x0263('0x41')][_0x0263('0x5e')]({'where':{'id':_0x3c9383[_0x0263('0x57')]['id']}})[_0x0263('0x23')](handleEntityNotFound(_0x5ca6b3,null))[_0x0263('0x23')](saveUpdates(_0x3c9383[_0x0263('0x5d')],null))[_0x0263('0x23')](respondWithResult(_0x5ca6b3,null))[_0x0263('0x2d')](handleError(_0x5ca6b3,null));};exports[_0x0263('0x3b')]=function(_0x3a1d53,_0x47c230){return db['FaxMessage'][_0x0263('0x5e')]({'where':{'id':_0x3a1d53['params']['id']}})['then'](handleEntityNotFound(_0x47c230,null))[_0x0263('0x23')](removeEntity(_0x47c230,null))[_0x0263('0x2d')](handleError(_0x47c230,null));};exports[_0x0263('0x5f')]=function(_0x45bc6e,_0x384712){return db[_0x0263('0x41')][_0x0263('0x5f')]()[_0x0263('0x23')](respondWithResult(_0x384712,null))['catch'](handleError(_0x384712,null));};var interaction_log=require(_0x0263('0x17'))(_0x0263('0x60'));exports['accept']=function(_0x3c189b,_0x2e2d42,_0xb0978a){var _0x20eb5d={'agent':{},'channel':_0x0263('0x61')};if(_0x3c189b[_0x0263('0x5d')]['id']){delete _0x3c189b[_0x0263('0x5d')]['id'];}_0x3c189b[_0x0263('0x5d')]['read']=!![];_0x3c189b[_0x0263('0x5d')]['readAt']=moment()[_0x0263('0x62')](_0x0263('0x63'));_0x3c189b[_0x0263('0x5d')][_0x0263('0x64')]=_0x3c189b[_0x0263('0x5d')][_0x0263('0x64')]||_0x3c189b[_0x0263('0x65')]['id'];_0x20eb5d[_0x0263('0x66')]['id']=_0x3c189b[_0x0263('0x5d')][_0x0263('0x64')];return db['FaxMessage'][_0x0263('0x5e')]({'where':{'id':_0x3c189b[_0x0263('0x57')]['id'],'UserId':null}})[_0x0263('0x23')](handleEntityNotFound(_0x2e2d42,null))[_0x0263('0x23')](saveUpdates(_0x3c189b[_0x0263('0x5d')],null))[_0x0263('0x23')](function(_0x5620d6){if(_0x5620d6){_0x20eb5d[_0x0263('0x2b')]=_0x5620d6[_0x0263('0x67')]({'plain':!![]});return db[_0x0263('0x68')]['find']({'where':{'id':_0x5620d6[_0x0263('0x69')]}});}return null;})[_0x0263('0x23')](handleEntityNotFound(_0x2e2d42,null))['then'](function(_0x212d48){if(_0x212d48){return _0x212d48['update']({'UserId':_0x3c189b[_0x0263('0x5d')][_0x0263('0x64')],'read1stAt':_[_0x0263('0x6a')](_0x212d48[_0x0263('0x6b')])?moment()[_0x0263('0x62')](_0x0263('0x63')):undefined});}return null;})['then'](function(_0x5e029b){if(_0x5e029b){_0x20eb5d[_0x0263('0x6c')]=_0x5e029b[_0x0263('0x67')]({'plain':!![]});interaction_log[_0x0263('0x24')](_0x0263('0x6d'),_0x3c189b[_0x0263('0x65')]['id'],_0x3c189b[_0x0263('0x65')]['name'],_0x3c189b[_0x0263('0x65')][_0x0263('0x6e')],_0x20eb5d[_0x0263('0x6c')]['id'],_0x3c189b[_0x0263('0x5d')]?JSON[_0x0263('0x28')](_0x3c189b['body']):_0x0263('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x20eb5d);}return null;})[_0x0263('0x23')](function(_0x294f2b){var _0xd56271=_0x0263('0x70')+_0x294f2b[_0x0263('0x2b')][_0x0263('0x71')];return db[_0x0263('0x72')][_0x0263('0x45')](_0xd56271,{'type':db[_0x0263('0x73')][_0x0263('0x74')][_0x0263('0x75')],'raw':!![]})[_0x0263('0x23')](function(_0x5c4f42){return _0x5c4f42;});})[_0x0263('0x23')](function(_0x4a9a7d){if(_0x4a9a7d){_0x20eb5d['message'][_0x0263('0x76')]=_0x4a9a7d[0x0];if(!_0x3c189b[_0x0263('0x5d')][_0x0263('0x64')])return;return db[_0x0263('0x77')][_0x0263('0x5e')]({'where':{'id':_0x3c189b[_0x0263('0x5d')][_0x0263('0x64')],'role':_0x0263('0x66')},'attributes':['id',_0x0263('0x3d'),'fullname','email',_0x0263('0x78')],'raw':!![]});}return null;})['then'](function(_0x5e8d85){if(!_0x5e8d85)return null;_0x20eb5d[_0x0263('0x2b')][_0x0263('0x66')]=_0x5e8d85;return _0x20eb5d;})[_0x0263('0x23')](function(_0xf3eec3){if(_0xf3eec3){if(_0x3c189b[_0x0263('0x5d')][_0x0263('0x79')]){_0x20eb5d[_0x0263('0x2b')][_0x0263('0x7a')]=util[_0x0263('0x62')]('SIP/%s',_0x3c189b['user'][_0x0263('0x3d')]);_0x20eb5d[_0x0263('0x2b')][_0x0263('0x7b')]=_0x20eb5d[_0x0263('0x7b')];_0x20eb5d[_0x0263('0x2b')][_0x0263('0x7c')]=_0x20eb5d[_0x0263('0x7b')];_0x20eb5d[_0x0263('0x2b')]['event']=_0x0263('0x7d');return respondWithRpcPromise(_0x0263('0x7e'),_0x0263('0x7e'),{'event':_0x0263('0x7f'),'message':_0x20eb5d['message']},client9002)[_0x0263('0x23')](function(){return _0x20eb5d;});}return _0x20eb5d;}return null;})[_0x0263('0x23')](respondWithResult(_0x2e2d42,null))[_0x0263('0x2d')](handleError(_0x2e2d42,null));};var interaction_log=require(_0x0263('0x17'))('fax-interactions');exports[_0x0263('0x38')]=function(_0x5ecd83,_0x3ccc48,_0x18b31c){var _0x3bc71d={'agent':{},'channel':'fax'};if(_0x5ecd83[_0x0263('0x5d')]['id']){delete _0x5ecd83['body']['id'];}_0x5ecd83[_0x0263('0x5d')]['UserId']=_0x5ecd83[_0x0263('0x5d')]['UserId']||_0x5ecd83['user']['id'];_0x3bc71d['agent']['id']=_0x5ecd83[_0x0263('0x5d')]['UserId'];return db[_0x0263('0x41')][_0x0263('0x5e')]({'where':{'id':_0x5ecd83[_0x0263('0x57')]['id'],'UserId':null}})[_0x0263('0x23')](handleEntityNotFound(_0x3ccc48,null))['then'](function(_0x108f8c){if(_0x108f8c){_0x3bc71d[_0x0263('0x2b')]=_0x108f8c[_0x0263('0x67')]({'plain':!![]});return db[_0x0263('0x68')]['find']({'where':{'id':_0x108f8c[_0x0263('0x69')]}});}return null;})[_0x0263('0x23')](handleEntityNotFound(_0x3ccc48,null))['then'](function(_0x2924c2){if(_0x2924c2){_0x3bc71d[_0x0263('0x6c')]=_0x2924c2[_0x0263('0x67')]({'plain':!![]});interaction_log[_0x0263('0x24')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5ecd83[_0x0263('0x65')]['id'],_0x5ecd83['user'][_0x0263('0x3d')],_0x5ecd83['user'][_0x0263('0x6e')],_0x3bc71d[_0x0263('0x6c')]['id'],_0x5ecd83['body']?JSON[_0x0263('0x28')](_0x5ecd83[_0x0263('0x5d')]):'null');return respondWithRpcPromise(_0x0263('0x80'),_0x0263('0x81'),_0x3bc71d);}return null;})[_0x0263('0x23')](function(_0x3465ce){var _0x3af826=_0x0263('0x70')+_0x3465ce['message']['ContactId'];return db['sequelize'][_0x0263('0x45')](_0x3af826,{'type':db['Sequelize'][_0x0263('0x74')]['SELECT'],'raw':!![]})[_0x0263('0x23')](function(_0x32f359){return _0x32f359;});})[_0x0263('0x23')](function(_0x2c1e5b){if(_0x2c1e5b){_0x3bc71d[_0x0263('0x2b')]['contact']=_0x2c1e5b[0x0];if(!_0x5ecd83[_0x0263('0x5d')][_0x0263('0x64')])return;return db['User'][_0x0263('0x5e')]({'where':{'id':_0x5ecd83[_0x0263('0x5d')][_0x0263('0x64')],'role':_0x0263('0x66')},'attributes':['id',_0x0263('0x3d'),_0x0263('0x82'),_0x0263('0x83'),_0x0263('0x78')],'raw':!![]});}return null;})[_0x0263('0x23')](function(_0x1f7228){if(!_0x1f7228)return null;_0x3bc71d['message'][_0x0263('0x66')]=_0x1f7228;return _0x3bc71d;})[_0x0263('0x23')](function(_0x511c84){if(_0x511c84){_0x511c84[_0x0263('0x2b')]['interface']=util['format'](_0x0263('0x84'),_0x5ecd83[_0x0263('0x65')][_0x0263('0x3d')]);_0x511c84['message'][_0x0263('0x7b')]=_0x3bc71d[_0x0263('0x7b')];_0x511c84[_0x0263('0x2b')][_0x0263('0x7c')]=_0x3bc71d[_0x0263('0x7b')];_0x511c84[_0x0263('0x2b')][_0x0263('0x85')]='reject';respondWithRpcPromise(_0x0263('0x7e'),'EventManager',{'event':_0x0263('0x86'),'message':_0x511c84[_0x0263('0x2b')]},client9002);return _0x3bc71d;}return null;})[_0x0263('0x23')](respondWithResult(_0x3ccc48,null))['catch'](handleError(_0x3ccc48,null));};exports[_0x0263('0x87')]=function(_0x32cb65,_0x4f7fe0){var _0x161db9;return db[_0x0263('0x41')][_0x0263('0x87')](_0x32cb65[_0x0263('0x5d')],{})[_0x0263('0x23')](function(_0x262768){_0x161db9=_0x262768;return db['CmContact'][_0x0263('0x88')]({'where':{'id':_0x161db9[_0x0263('0x71')]}});})[_0x0263('0x23')](function(_0x3e8a51){if(_[_0x0263('0x6a')](_0x3e8a51)){return;}else{_0x161db9[_0x0263('0x61')]=_0x3e8a51[_0x0263('0x61')];return db['Attachment'][_0x0263('0x88')]({'where':{'id':_0x161db9['AttachmentId']}});}})[_0x0263('0x23')](function(_0x34c9bb){return respondWithRpcPromise(_0x0263('0x89'),_0x0263('0x89'),{'FaxAccountId':_[_0x0263('0x6a')](_0x32cb65[_0x0263('0x5d')])?undefined:_0x32cb65[_0x0263('0x5d')][_0x0263('0x8a')],'path':_[_0x0263('0x6a')](_0x34c9bb)?undefined:util['format'](_0x0263('0x8b'),_0x34c9bb[_0x0263('0x8c')]),'fax':_['isNil'](_0x161db9[_0x0263('0x61')])?undefined:_0x161db9[_0x0263('0x61')],'AttachmentId':_0x161db9[_0x0263('0x8d')]},client9002);})[_0x0263('0x23')](respondWithResult(_0x4f7fe0,0xc9))[_0x0263('0x2d')](handleError(_0x4f7fe0,null));};exports[_0x0263('0x8e')]=function(_0x311bed,_0x33ade1){var _0x1f9224=path[_0x0263('0x8f')](config[_0x0263('0x90')],_0x0263('0x91'),'files',_0x0263('0x92'));return db['FaxMessage'][_0x0263('0x5e')]({'where':{'id':_0x311bed[_0x0263('0x57')]['id']},'include':[{'model':db[_0x0263('0x93')],'as':_0x0263('0x93')}]})[_0x0263('0x23')](handleEntityNotFound(_0x33ade1,null))[_0x0263('0x23')](function(_0x140edd){if(_0x140edd){return _0x33ade1[_0x0263('0x8e')](path[_0x0263('0x8f')](_0x1f9224,_0x140edd[_0x0263('0x93')][_0x0263('0x8c')]));}})[_0x0263('0x2d')](handleError(_0x33ade1,null));}; \ No newline at end of file +var _0xd29a=['Sequelize','fullname','reject','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','server','files','attachments','join','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage'];(function(_0x2d84fb,_0x2de3f0){var _0x347a73=function(_0x406041){while(--_0x406041){_0x2d84fb['push'](_0x2d84fb['shift']());}};_0x347a73(++_0x2de3f0);}(_0xd29a,0x12f));var _0xad29=function(_0x121e06,_0x59fef9){_0x121e06=_0x121e06-0x0;var _0x2cf644=_0xd29a[_0x121e06];return _0x2cf644;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad29('0x0'));var zipdir=require(_0xad29('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad29('0x2'));var moment=require(_0xad29('0x3'));var BPromise=require(_0xad29('0x4'));var Mustache=require(_0xad29('0x5'));var util=require('util');var path=require(_0xad29('0x6'));var sox=require('sox');var csv=require(_0xad29('0x7'));var ejs=require(_0xad29('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad29('0x9'));var squel=require('squel');var crypto=require(_0xad29('0xa'));var jsforce=require(_0xad29('0xb'));var deskjs=require(_0xad29('0xc'));var toCsv=require(_0xad29('0x7'));var querystring=require(_0xad29('0xd'));var Papa=require('papaparse');var Redis=require(_0xad29('0xe'));var authService=require(_0xad29('0xf'));var qs=require(_0xad29('0x10'));var as=require(_0xad29('0x11'));var hardwareService=require(_0xad29('0x12'));var logger=require(_0xad29('0x13'))('api');var utils=require(_0xad29('0x14'));var config=require(_0xad29('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xad29('0x16'))['db'];config[_0xad29('0x17')]=_[_0xad29('0x18')](config[_0xad29('0x17')],{'host':_0xad29('0x19'),'port':0x18eb});var socket=require(_0xad29('0x1a'))(new Redis(config[_0xad29('0x17')]));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xad29('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0xad29('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x258295,_0x56234f,_0x4c2f4d,_0x528104){return new BPromise(function(_0x1016d0,_0x51f2a4){var _0x3ec530=_0x528104||client;return _0x3ec530[_0xad29('0x1d')](_0x258295,_0x4c2f4d)['then'](function(_0x54f622){logger[_0xad29('0x1e')](_0xad29('0x1f'),_0x56234f,_0xad29('0x20'));logger[_0xad29('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x56234f,'request\x20sent',JSON[_0xad29('0x22')](_0x54f622));if(_0x54f622[_0xad29('0x23')]){if(_0x54f622[_0xad29('0x23')][_0xad29('0x24')]===0x1f4){logger[_0xad29('0x23')](_0xad29('0x1f'),_0x56234f,_0x54f622['error'][_0xad29('0x25')]);return _0x51f2a4(_0x54f622[_0xad29('0x23')][_0xad29('0x25')]);}logger['error'](_0xad29('0x1f'),_0x56234f,_0x54f622[_0xad29('0x23')][_0xad29('0x25')]);return _0x1016d0(_0x54f622['error'][_0xad29('0x25')]);}else{logger['info'](_0xad29('0x1f'),_0x56234f,_0xad29('0x20'));_0x1016d0(_0x54f622[_0xad29('0x26')][_0xad29('0x25')]);}})['catch'](function(_0x1d8f0c){logger[_0xad29('0x23')]('FaxMessage,\x20%s,\x20%s',_0x56234f,_0x1d8f0c);_0x51f2a4(_0x1d8f0c);});});}function respondWithStatusCode(_0x97720c,_0x8d5c19){_0x8d5c19=_0x8d5c19||0xcc;return function(_0x14fd4c){if(_0x14fd4c){return _0x97720c[_0xad29('0x27')](_0x8d5c19);}return _0x97720c[_0xad29('0x28')](_0x8d5c19)[_0xad29('0x29')]();};}function respondWithResult(_0x11f77a,_0x33f460){_0x33f460=_0x33f460||0xc8;return function(_0x18b6d8){if(_0x18b6d8){return _0x11f77a['status'](_0x33f460)['json'](_0x18b6d8);}};}function respondWithFilteredResult(_0x1ef716,_0x31ddff){return function(_0x9849dd){if(_0x9849dd){var _0x204e82=typeof _0x31ddff[_0xad29('0x2a')]===_0xad29('0x2b')&&typeof _0x31ddff[_0xad29('0x2c')]===_0xad29('0x2b');var _0x16423b=_0x9849dd[_0xad29('0x2d')];var _0x65e73f=_0x204e82?0x0:_0x31ddff['offset'];var _0x19ad25=_0x204e82?_0x9849dd[_0xad29('0x2d')]:_0x31ddff[_0xad29('0x2a')]+_0x31ddff[_0xad29('0x2c')];var _0x2b594e;if(_0x19ad25>=_0x16423b){_0x19ad25=_0x16423b;_0x2b594e=0xc8;}else{_0x2b594e=0xce;}_0x1ef716[_0xad29('0x28')](_0x2b594e);return _0x1ef716[_0xad29('0x2e')](_0xad29('0x2f'),_0x65e73f+'-'+_0x19ad25+'/'+_0x16423b)[_0xad29('0x30')](_0x9849dd);}return null;};}function patchUpdates(_0x5f41d1){return function(_0x437bb0){try{jsonpatch[_0xad29('0x31')](_0x437bb0,_0x5f41d1,!![]);}catch(_0xee4be0){return BPromise['reject'](_0xee4be0);}return _0x437bb0[_0xad29('0x32')]();};}function saveUpdates(_0x564caf,_0x12534e){return function(_0x33968f){if(_0x33968f){return _0x33968f[_0xad29('0x33')](_0x564caf)[_0xad29('0x34')](function(_0x12c2c5){return _0x12c2c5;});}return null;};}function removeEntity(_0xeb38cc,_0x2b5760){return function(_0x2d9000){if(_0x2d9000){return _0x2d9000[_0xad29('0x35')]()['then'](function(){_0xeb38cc[_0xad29('0x28')](0xcc)[_0xad29('0x29')]();});}};}function handleEntityNotFound(_0x2a2c98,_0x255ee3){return function(_0x62c989){if(!_0x62c989){_0x2a2c98[_0xad29('0x27')](0x194);}return _0x62c989;};}function handleError(_0x271c6e,_0x318eb4){_0x318eb4=_0x318eb4||0x1f4;return function(_0x169bb2){logger[_0xad29('0x23')](_0x169bb2[_0xad29('0x36')]);if(_0x169bb2[_0xad29('0x37')]){delete _0x169bb2[_0xad29('0x37')];}_0x271c6e[_0xad29('0x28')](_0x318eb4)[_0xad29('0x38')](_0x169bb2);};}exports[_0xad29('0x39')]=function(_0x3a02ae,_0x1f3759){var _0x5ae981={},_0x332b18={},_0xa451f={'count':0x0,'rows':[]};var _0x7c1b4=_[_0xad29('0x3a')](db[_0xad29('0x3b')][_0xad29('0x3c')],function(_0x3d5481){return{'name':_0x3d5481[_0xad29('0x3d')],'type':_0x3d5481[_0xad29('0x3e')][_0xad29('0x3f')]};});_0x332b18[_0xad29('0x40')]=_['map'](_0x7c1b4,_0xad29('0x37'));_0x332b18[_0xad29('0x41')]=_[_0xad29('0x42')](_0x3a02ae['query']);_0x332b18[_0xad29('0x43')]=_[_0xad29('0x44')](_0x332b18[_0xad29('0x40')],_0x332b18[_0xad29('0x41')]);_0x5ae981[_0xad29('0x45')]=_[_0xad29('0x44')](_0x332b18['model'],qs[_0xad29('0x46')](_0x3a02ae[_0xad29('0x41')]['fields']));_0x5ae981[_0xad29('0x45')]=_0x5ae981[_0xad29('0x45')]['length']?_0x5ae981[_0xad29('0x45')]:_0x332b18[_0xad29('0x40')];if(!_0x3a02ae['query'][_0xad29('0x47')]('nolimit')){_0x5ae981[_0xad29('0x2c')]=qs[_0xad29('0x2c')](_0x3a02ae['query'][_0xad29('0x2c')]);_0x5ae981['offset']=qs['offset'](_0x3a02ae[_0xad29('0x41')][_0xad29('0x2a')]);}_0x5ae981[_0xad29('0x48')]=qs[_0xad29('0x49')](_0x3a02ae[_0xad29('0x41')][_0xad29('0x49')]);_0x5ae981[_0xad29('0x4a')]=qs[_0xad29('0x43')](_[_0xad29('0x4b')](_0x3a02ae[_0xad29('0x41')],_0x332b18[_0xad29('0x43')]),_0x7c1b4);if(_0x3a02ae['query'][_0xad29('0x4c')]){_0x5ae981[_0xad29('0x4a')]=_[_0xad29('0x4d')](_0x5ae981['where'],{'$or':_[_0xad29('0x3a')](_0x7c1b4,function(_0x3ce95c){if(_0x3ce95c[_0xad29('0x3e')]!=='VIRTUAL'){var _0xdf2d2e={};_0xdf2d2e[_0x3ce95c[_0xad29('0x37')]]={'$like':'%'+_0x3a02ae[_0xad29('0x41')][_0xad29('0x4c')]+'%'};return _0xdf2d2e;}})});}_0x5ae981=_[_0xad29('0x4d')]({},_0x5ae981,_0x3a02ae[_0xad29('0x4e')]);var _0x23b709={'where':_0x5ae981[_0xad29('0x4a')]};return db[_0xad29('0x3b')][_0xad29('0x2d')](_0x23b709)[_0xad29('0x34')](function(_0x25fd28){_0xa451f[_0xad29('0x2d')]=_0x25fd28;if(_0x3a02ae[_0xad29('0x41')]['includeAll']){_0x5ae981[_0xad29('0x4f')]=[{'all':!![]}];}return db[_0xad29('0x3b')][_0xad29('0x50')](_0x5ae981);})['then'](function(_0x2c30cf){_0xa451f[_0xad29('0x51')]=_0x2c30cf;return _0xa451f;})[_0xad29('0x34')](respondWithFilteredResult(_0x1f3759,_0x5ae981))[_0xad29('0x52')](handleError(_0x1f3759,null));};exports[_0xad29('0x53')]=function(_0x2d6d78,_0xe76090){var _0x5ac9d2={'raw':!![],'where':{'id':_0x2d6d78[_0xad29('0x54')]['id']}},_0x8c0878={};_0x8c0878[_0xad29('0x40')]=_[_0xad29('0x42')](db[_0xad29('0x3b')][_0xad29('0x3c')]);_0x8c0878[_0xad29('0x41')]=_[_0xad29('0x42')](_0x2d6d78['query']);_0x8c0878[_0xad29('0x43')]=_[_0xad29('0x44')](_0x8c0878[_0xad29('0x40')],_0x8c0878[_0xad29('0x41')]);_0x5ac9d2['attributes']=_[_0xad29('0x44')](_0x8c0878[_0xad29('0x40')],qs[_0xad29('0x46')](_0x2d6d78['query']['fields']));_0x5ac9d2[_0xad29('0x45')]=_0x5ac9d2[_0xad29('0x45')][_0xad29('0x55')]?_0x5ac9d2[_0xad29('0x45')]:_0x8c0878[_0xad29('0x40')];if(_0x2d6d78[_0xad29('0x41')]['includeAll']){_0x5ac9d2[_0xad29('0x4f')]=[{'all':!![]}];}_0x5ac9d2=_[_0xad29('0x4d')]({},_0x5ac9d2,_0x2d6d78[_0xad29('0x4e')]);return db['FaxMessage'][_0xad29('0x56')](_0x5ac9d2)[_0xad29('0x34')](handleEntityNotFound(_0xe76090,null))[_0xad29('0x34')](respondWithResult(_0xe76090,null))[_0xad29('0x52')](handleError(_0xe76090,null));};exports[_0xad29('0x33')]=function(_0x12e560,_0x26b7a7){if(_0x12e560[_0xad29('0x57')]['id']){delete _0x12e560[_0xad29('0x57')]['id'];}return db[_0xad29('0x3b')][_0xad29('0x56')]({'where':{'id':_0x12e560[_0xad29('0x54')]['id']}})['then'](handleEntityNotFound(_0x26b7a7,null))[_0xad29('0x34')](saveUpdates(_0x12e560[_0xad29('0x57')],null))[_0xad29('0x34')](respondWithResult(_0x26b7a7,null))['catch'](handleError(_0x26b7a7,null));};exports[_0xad29('0x35')]=function(_0x30a9f2,_0x530a97){return db[_0xad29('0x3b')][_0xad29('0x56')]({'where':{'id':_0x30a9f2[_0xad29('0x54')]['id']}})['then'](handleEntityNotFound(_0x530a97,null))[_0xad29('0x34')](removeEntity(_0x530a97,null))[_0xad29('0x52')](handleError(_0x530a97,null));};exports[_0xad29('0x58')]=function(_0x429a86,_0x459b7e){return db[_0xad29('0x3b')][_0xad29('0x58')]()[_0xad29('0x34')](respondWithResult(_0x459b7e,null))[_0xad29('0x52')](handleError(_0x459b7e,null));};var interaction_log=require('../../config/logger')(_0xad29('0x59'));exports[_0xad29('0x5a')]=function(_0x142f14,_0x50f30d,_0xe33072){var _0x2ba392={'agent':{},'channel':_0xad29('0x5b')};if(_0x142f14[_0xad29('0x57')]['id']){delete _0x142f14[_0xad29('0x57')]['id'];}_0x142f14[_0xad29('0x57')][_0xad29('0x5c')]=!![];_0x142f14[_0xad29('0x57')][_0xad29('0x5d')]=moment()[_0xad29('0x5e')](_0xad29('0x5f'));_0x142f14[_0xad29('0x57')][_0xad29('0x60')]=_0x142f14[_0xad29('0x57')][_0xad29('0x60')]||_0x142f14[_0xad29('0x61')]['id'];_0x2ba392[_0xad29('0x62')]['id']=_0x142f14[_0xad29('0x57')][_0xad29('0x60')];return db[_0xad29('0x3b')][_0xad29('0x56')]({'where':{'id':_0x142f14[_0xad29('0x54')]['id'],'UserId':null}})[_0xad29('0x34')](handleEntityNotFound(_0x50f30d,null))['then'](saveUpdates(_0x142f14[_0xad29('0x57')],null))[_0xad29('0x34')](function(_0x35d884){if(_0x35d884){_0x2ba392['message']=_0x35d884[_0xad29('0x63')]({'plain':!![]});return db[_0xad29('0x64')]['find']({'where':{'id':_0x35d884['FaxInteractionId']}});}return null;})[_0xad29('0x34')](handleEntityNotFound(_0x50f30d,null))['then'](function(_0x49105b){if(_0x49105b){return _0x49105b[_0xad29('0x33')]({'UserId':_0x142f14[_0xad29('0x57')][_0xad29('0x60')],'read1stAt':_[_0xad29('0x65')](_0x49105b[_0xad29('0x66')])?moment()[_0xad29('0x5e')](_0xad29('0x5f')):undefined});}return null;})[_0xad29('0x34')](function(_0x5664d2){if(_0x5664d2){_0x2ba392[_0xad29('0x67')]=_0x5664d2['get']({'plain':!![]});interaction_log[_0xad29('0x1e')](_0xad29('0x68'),_0x142f14[_0xad29('0x61')]['id'],_0x142f14[_0xad29('0x61')][_0xad29('0x37')],_0x142f14['user'][_0xad29('0x69')],_0x2ba392[_0xad29('0x67')]['id'],_0x142f14[_0xad29('0x57')]?JSON[_0xad29('0x22')](_0x142f14[_0xad29('0x57')]):_0xad29('0x6a'));return respondWithRpcPromise(_0xad29('0x6b'),'acceptMessage',_0x2ba392);}return null;})[_0xad29('0x34')](function(_0x28b859){var _0x285ca7=_0xad29('0x6c')+_0x28b859[_0xad29('0x25')][_0xad29('0x6d')];return db[_0xad29('0x6e')][_0xad29('0x41')](_0x285ca7,{'type':db['Sequelize'][_0xad29('0x6f')][_0xad29('0x70')],'raw':!![]})['then'](function(_0x18e569){return _0x18e569;});})['then'](function(_0x157960){if(_0x157960){_0x2ba392[_0xad29('0x25')][_0xad29('0x71')]=_0x157960[0x0];if(!_0x142f14[_0xad29('0x57')]['UserId'])return;return db[_0xad29('0x72')][_0xad29('0x56')]({'where':{'id':_0x142f14['body']['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0xad29('0x73'),_0xad29('0x74')],'raw':!![]});}return null;})[_0xad29('0x34')](function(_0x5d3364){if(!_0x5d3364)return null;_0x2ba392[_0xad29('0x25')][_0xad29('0x62')]=_0x5d3364;return _0x2ba392;})[_0xad29('0x34')](function(_0x4920a0){if(_0x4920a0){if(_0x142f14[_0xad29('0x57')]['manual']){_0x2ba392[_0xad29('0x25')][_0xad29('0x75')]=util['format'](_0xad29('0x76'),_0x142f14[_0xad29('0x61')][_0xad29('0x37')]);_0x2ba392[_0xad29('0x25')][_0xad29('0x77')]=_0x2ba392[_0xad29('0x77')];_0x2ba392[_0xad29('0x25')][_0xad29('0x78')]=_0x2ba392[_0xad29('0x77')];_0x2ba392[_0xad29('0x25')][_0xad29('0x79')]='accept';return respondWithRpcPromise('EventManager',_0xad29('0x7a'),{'event':'acceptmessage','message':_0x2ba392[_0xad29('0x25')]},client9002)[_0xad29('0x34')](function(){return _0x2ba392;});}return _0x2ba392;}return null;})[_0xad29('0x34')](respondWithResult(_0x50f30d,null))[_0xad29('0x52')](handleError(_0x50f30d,null));};var interaction_log=require(_0xad29('0x13'))(_0xad29('0x59'));exports['reject']=function(_0x181da3,_0x11e054,_0x1edd96){var _0x436162={'agent':{},'channel':_0xad29('0x5b')};if(_0x181da3[_0xad29('0x57')]['id']){delete _0x181da3[_0xad29('0x57')]['id'];}_0x181da3[_0xad29('0x57')][_0xad29('0x60')]=_0x181da3['body'][_0xad29('0x60')]||_0x181da3['user']['id'];_0x436162[_0xad29('0x62')]['id']=_0x181da3['body']['UserId'];return db['FaxMessage'][_0xad29('0x56')]({'where':{'id':_0x181da3['params']['id'],'UserId':null}})[_0xad29('0x34')](handleEntityNotFound(_0x11e054,null))[_0xad29('0x34')](function(_0x414366){if(_0x414366){_0x436162[_0xad29('0x25')]=_0x414366[_0xad29('0x63')]({'plain':!![]});return db[_0xad29('0x64')][_0xad29('0x56')]({'where':{'id':_0x414366[_0xad29('0x7b')]}});}return null;})[_0xad29('0x34')](handleEntityNotFound(_0x11e054,null))[_0xad29('0x34')](function(_0x1feec7){if(_0x1feec7){_0x436162['interaction']=_0x1feec7[_0xad29('0x63')]({'plain':!![]});interaction_log[_0xad29('0x1e')](_0xad29('0x7c'),_0x181da3['user']['id'],_0x181da3['user'][_0xad29('0x37')],_0x181da3[_0xad29('0x61')][_0xad29('0x69')],_0x436162['interaction']['id'],_0x181da3[_0xad29('0x57')]?JSON[_0xad29('0x22')](_0x181da3[_0xad29('0x57')]):_0xad29('0x6a'));return respondWithRpcPromise('RejectMessage',_0xad29('0x7d'),_0x436162);}return null;})[_0xad29('0x34')](function(_0x5367ce){var _0x234997='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5367ce[_0xad29('0x25')][_0xad29('0x6d')];return db[_0xad29('0x6e')][_0xad29('0x41')](_0x234997,{'type':db[_0xad29('0x7e')][_0xad29('0x6f')]['SELECT'],'raw':!![]})[_0xad29('0x34')](function(_0x451caf){return _0x451caf;});})[_0xad29('0x34')](function(_0x51130f){if(_0x51130f){_0x436162[_0xad29('0x25')][_0xad29('0x71')]=_0x51130f[0x0];if(!_0x181da3['body'][_0xad29('0x60')])return;return db['User']['find']({'where':{'id':_0x181da3[_0xad29('0x57')][_0xad29('0x60')],'role':_0xad29('0x62')},'attributes':['id','name',_0xad29('0x7f'),'email',_0xad29('0x74')],'raw':!![]});}return null;})[_0xad29('0x34')](function(_0x5d845a){if(!_0x5d845a)return null;_0x436162['message'][_0xad29('0x62')]=_0x5d845a;return _0x436162;})['then'](function(_0x2b1db9){if(_0x2b1db9){_0x2b1db9[_0xad29('0x25')][_0xad29('0x75')]=util[_0xad29('0x5e')]('SIP/%s',_0x181da3[_0xad29('0x61')][_0xad29('0x37')]);_0x2b1db9[_0xad29('0x25')][_0xad29('0x77')]=_0x436162[_0xad29('0x77')];_0x2b1db9[_0xad29('0x25')][_0xad29('0x78')]=_0x436162[_0xad29('0x77')];_0x2b1db9[_0xad29('0x25')][_0xad29('0x79')]=_0xad29('0x80');respondWithRpcPromise(_0xad29('0x7a'),_0xad29('0x7a'),{'event':_0xad29('0x81'),'message':_0x2b1db9['message']},client9002);return _0x436162;}return null;})[_0xad29('0x34')](respondWithResult(_0x11e054,null))[_0xad29('0x52')](handleError(_0x11e054,null));};exports[_0xad29('0x82')]=function(_0x20db8e,_0x1ac104){var _0x24faca;return db['FaxMessage'][_0xad29('0x82')](_0x20db8e[_0xad29('0x57')],{})['then'](function(_0x59c15e){_0x24faca=_0x59c15e;return db['CmContact'][_0xad29('0x83')]({'where':{'id':_0x24faca['ContactId']}});})[_0xad29('0x34')](function(_0x580854){if(_[_0xad29('0x65')](_0x580854)){return;}else{_0x24faca[_0xad29('0x5b')]=_0x580854['fax'];return db[_0xad29('0x84')][_0xad29('0x83')]({'where':{'id':_0x24faca[_0xad29('0x85')]}});}})[_0xad29('0x34')](function(_0x129128){return respondWithRpcPromise(_0xad29('0x86'),_0xad29('0x86'),{'FaxAccountId':_['isNil'](_0x20db8e[_0xad29('0x57')])?undefined:_0x20db8e[_0xad29('0x57')][_0xad29('0x87')],'path':_[_0xad29('0x65')](_0x129128)?undefined:util[_0xad29('0x5e')](_0xad29('0x88'),_0x129128['basename']),'fax':_[_0xad29('0x65')](_0x24faca[_0xad29('0x5b')])?undefined:_0x24faca[_0xad29('0x5b')],'AttachmentId':_0x24faca[_0xad29('0x85')]},client9002);})[_0xad29('0x34')](respondWithResult(_0x1ac104,0xc9))['catch'](handleError(_0x1ac104,null));};exports[_0xad29('0x89')]=function(_0x12c186,_0x346136){var _0x4ab186=path['join'](config[_0xad29('0x8a')],_0xad29('0x8b'),_0xad29('0x8c'),_0xad29('0x8d'));return db['FaxMessage'][_0xad29('0x56')]({'where':{'id':_0x12c186[_0xad29('0x54')]['id']},'include':[{'model':db['Attachment'],'as':_0xad29('0x84')}]})['then'](handleEntityNotFound(_0x346136,null))['then'](function(_0x465f9b){if(_0x465f9b){return _0x346136[_0xad29('0x89')](path[_0xad29('0x8e')](_0x4ab186,_0x465f9b['Attachment']['basename']));}})[_0xad29('0x52')](handleError(_0x346136,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1b5168b..f23ad0f 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 _0xba6f=['update','remove','emit','hasOwnProperty','hook','events','FaxMessage','setMaxListeners','save'];(function(_0x575c05,_0x5acbc3){var _0x4bbfd6=function(_0x3f8885){while(--_0x3f8885){_0x575c05['push'](_0x575c05['shift']());}};_0x4bbfd6(++_0x5acbc3);}(_0xba6f,0x1d0));var _0xfba6=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xba6f[_0x5c6994];return _0x1d5c84;};'use strict';var EventEmitter=require(_0xfba6('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xfba6('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xfba6('0x2')](0x0);var events={'afterCreate':_0xfba6('0x3'),'afterUpdate':_0xfba6('0x4'),'afterDestroy':_0xfba6('0x5')};function emitEvent(_0x2c6e98){return function(_0x3b4dda,_0x3d2803,_0x1bbeb5){FaxMessageEvents[_0xfba6('0x6')](_0x2c6e98+':'+_0x3b4dda['id'],_0x3b4dda);FaxMessageEvents[_0xfba6('0x6')](_0x2c6e98,_0x3b4dda);_0x1bbeb5(null);};}for(var e in events){if(events[_0xfba6('0x7')](e)){var event=events[e];FaxMessage[_0xfba6('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xf0f4=['hasOwnProperty','exports','../../mysqldb','save','update','emit'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xf0f4,0x182));var _0x4f0f=function(_0x2d9b31,_0x22393b){_0x2d9b31=_0x2d9b31-0x0;var _0x534d1b=_0xf0f4[_0x2d9b31];return _0x534d1b;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x4f0f('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4f0f('0x1'),'afterUpdate':_0x4f0f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2cefe){return function(_0x420159,_0x1f6cdb,_0x130ab2){FaxMessageEvents[_0x4f0f('0x3')](_0x2cefe+':'+_0x420159['id'],_0x420159);FaxMessageEvents[_0x4f0f('0x3')](_0x2cefe,_0x420159);_0x130ab2(null);};}for(var e in events){if(events[_0x4f0f('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x4f0f('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 3991fa9..5ddb1c4 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 _0xbb4c=['FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body'];(function(_0x328c19,_0x718e82){var _0x1d748e=function(_0x58fa04){while(--_0x58fa04){_0x328c19['push'](_0x328c19['shift']());}};_0x1d748e(++_0x718e82);}(_0xbb4c,0x6a));var _0xcbb4=function(_0xfe7ed4,_0x5d9262){_0xfe7ed4=_0xfe7ed4-0x0;var _0x35f3c5=_0xbb4c[_0xfe7ed4];return _0x35f3c5;};'use strict';var _=require(_0xcbb4('0x0'));var util=require(_0xcbb4('0x1'));var logger=require('../../config/logger')(_0xcbb4('0x2'));var moment=require(_0xcbb4('0x3'));var BPromise=require(_0xcbb4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbb4('0x5'));var rimraf=require(_0xcbb4('0x6'));var config=require(_0xcbb4('0x7'));var attributes=require(_0xcbb4('0x8'));module[_0xcbb4('0x9')]=function(_0x32af90,_0x36ee28){return _0x32af90[_0xcbb4('0xa')]('FaxMessage',attributes,{'tableName':_0xcbb4('0xb'),'paranoid':![],'indexes':[{'name':_0xcbb4('0xc'),'fields':[_0xcbb4('0xd')],'type':_0xcbb4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x360e1a,_0x50f557,_0x847c7c){var _0x4fde66=_0x32af90[_0xcbb4('0xf')];var _0x3c422a=_0x360e1a[_0xcbb4('0x10')]({'plain':!![]});if(_0x3c422a[_0xcbb4('0x11')][_0xcbb4('0x12')]()==='in'||_0x3c422a[_0xcbb4('0x11')]['toLowerCase']()===_0xcbb4('0x13')&&!_0x3c422a[_0xcbb4('0x14')]&&!_['isNil'](_0x3c422a[_0xcbb4('0x15')])){_0x4fde66[_0xcbb4('0x16')][_0xcbb4('0x17')]({'where':{'id':_0x3c422a[_0xcbb4('0x18')]}})[_0xcbb4('0x19')](function(_0x2ba25f){if(_0x2ba25f){_0x2ba25f[_0xcbb4('0x1a')]({'lastMsgAt':_0x3c422a[_0xcbb4('0x1b')],'lastMsgDirection':_0x3c422a[_0xcbb4('0x11')][_0xcbb4('0x12')]()});}})[_0xcbb4('0x1c')](function(_0x2ad477){console[_0xcbb4('0x1d')](_0x2ad477);});}_0x847c7c();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbda7=['toLowerCase','direction','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','../../config/logger','moment','bluebird','path','rimraf','FaxMessage','fax_messages','body','FULLTEXT','models','get'];(function(_0x4be930,_0x911fbf){var _0x5cdfda=function(_0x391889){while(--_0x391889){_0x4be930['push'](_0x4be930['shift']());}};_0x5cdfda(++_0x911fbf);}(_0xbda7,0x145));var _0x7bda=function(_0x516033,_0x5a8cdf){_0x516033=_0x516033-0x0;var _0x3280a5=_0xbda7[_0x516033];return _0x3280a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7bda('0x0'))('api');var moment=require(_0x7bda('0x1'));var BPromise=require(_0x7bda('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bda('0x3'));var rimraf=require(_0x7bda('0x4'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x172afa,_0x45cd5f){return _0x172afa['define'](_0x7bda('0x5'),attributes,{'tableName':_0x7bda('0x6'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x7bda('0x7')],'type':_0x7bda('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x534df0,_0x331022,_0x3e6f06){var _0x4b3a5b=_0x172afa[_0x7bda('0x9')];var _0x5ca733=_0x534df0[_0x7bda('0xa')]({'plain':!![]});if(_0x5ca733['direction'][_0x7bda('0xb')]()==='in'||_0x5ca733[_0x7bda('0xc')][_0x7bda('0xb')]()===_0x7bda('0xd')&&!_0x5ca733['secret']&&!_[_0x7bda('0xe')](_0x5ca733[_0x7bda('0xf')])){_0x4b3a5b[_0x7bda('0x10')][_0x7bda('0x11')]({'where':{'id':_0x5ca733[_0x7bda('0x12')]}})[_0x7bda('0x13')](function(_0x1acea8){if(_0x1acea8){_0x1acea8[_0x7bda('0x14')]({'lastMsgAt':_0x5ca733[_0x7bda('0x15')],'lastMsgDirection':_0x5ca733['direction'][_0x7bda('0xb')]()});}})[_0x7bda('0x16')](function(_0x198378){console[_0x7bda('0x17')](_0x198378);});}_0x3e6f06();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index adabb18..7685cc1 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 _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(_0x2cabc8,_0x22bb32){var _0x10556a=function(_0x538364){while(--_0x538364){_0x2cabc8['push'](_0x2cabc8['shift']());}};_0x10556a(++_0x22bb32);}(_0x81bd,0x7c));var _0xd81b=function(_0x4077df,_0x10621c){_0x4077df=_0x4077df-0x0;var _0x57aeff=_0x81bd[_0x4077df];return _0x57aeff;};'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 +var _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x2d5cd8,_0x288cf9){var _0x23323c=function(_0x2ea08d){while(--_0x2ea08d){_0x2d5cd8['push'](_0x2d5cd8['shift']());}};_0x23323c(++_0x288cf9);}(_0xac31,0xca));var _0x1ac3=function(_0x4f8a5d,_0x8ccd73){_0x4f8a5d=_0x4f8a5d-0x0;var _0x49a132=_0xac31[_0x4f8a5d];return _0x49a132;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 97fefaa..07a350b 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 _0xa5da=['emit','register','length','faxMessage:','save','remove','update'];(function(_0xf36a22,_0x1fc68d){var _0x5c6ef3=function(_0x12a1bd){while(--_0x12a1bd){_0xf36a22['push'](_0xf36a22['shift']());}};_0x5c6ef3(++_0x1fc68d);}(_0xa5da,0xf2));var _0xaa5d=function(_0x5634ad,_0x324930){_0x5634ad=_0x5634ad-0x0;var _0x5d0d29=_0xa5da[_0x5634ad];return _0x5d0d29;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xaa5d('0x0'),_0xaa5d('0x1'),_0xaa5d('0x2')];function createListener(_0x230713,_0x5b9dfa){return function(_0x3224d2){_0x5b9dfa[_0xaa5d('0x3')](_0x230713,_0x3224d2);};}function removeListener(_0x565c2c,_0x591358){return function(){FaxMessageEvents['removeListener'](_0x565c2c,_0x591358);};}exports[_0xaa5d('0x4')]=function(_0x53d40d){for(var _0x2135d6=0x0,_0x3ba50a=events[_0xaa5d('0x5')];_0x2135d6<_0x3ba50a;_0x2135d6++){var _0x5b8333=events[_0x2135d6];var _0x3c5868=createListener(_0xaa5d('0x6')+_0x5b8333,_0x53d40d);FaxMessageEvents['on'](_0x5b8333,_0x3c5868);}}; \ No newline at end of file +var _0x751e=['emit','register','length','./faxMessage.events','remove','update'];(function(_0x4d8314,_0x244be4){var _0x2962bc=function(_0x28a1bb){while(--_0x28a1bb){_0x4d8314['push'](_0x4d8314['shift']());}};_0x2962bc(++_0x244be4);}(_0x751e,0x7b));var _0xe751=function(_0x186888,_0x569607){_0x186888=_0x186888-0x0;var _0x2e37c0=_0x751e[_0x186888];return _0x2e37c0;};'use strict';var FaxMessageEvents=require(_0xe751('0x0'));var events=['save',_0xe751('0x1'),_0xe751('0x2')];function createListener(_0x46099c,_0x4752df){return function(_0x4d8bc4){_0x4752df[_0xe751('0x3')](_0x46099c,_0x4d8bc4);};}function removeListener(_0x55208f,_0x1e32b8){return function(){FaxMessageEvents['removeListener'](_0x55208f,_0x1e32b8);};}exports[_0xe751('0x4')]=function(_0x347f00){for(var _0xfd6d28=0x0,_0x401a36=events[_0xe751('0x5')];_0xfd6d28<_0x401a36;_0xfd6d28++){var _0x51265e=events[_0xfd6d28];var _0x24b510=createListener('faxMessage:'+_0x51265e,_0x347f00);FaxMessageEvents['on'](_0x51265e,_0x24b510);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0bb6918..bf82a63 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 _0x22fb=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','update','put','/:id/accept','accept','delete'];(function(_0x7cf586,_0xd0ff06){var _0x3c38a4=function(_0x509822){while(--_0x509822){_0x7cf586['push'](_0x7cf586['shift']());}};_0x3c38a4(++_0xd0ff06);}(_0x22fb,0x192));var _0xb22f=function(_0x370f66,_0x51352a){_0x370f66=_0x370f66-0x0;var _0x45ae66=_0x22fb[_0x370f66];return _0x45ae66;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0x7')](_0xb22f('0xe'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')]('/',auth[_0xb22f('0x8')](),interaction['tracked']('fax','faxmessage:create'),controller[_0xb22f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb22f('0x12')]);router[_0xb22f('0x13')](_0xb22f('0x14'),auth[_0xb22f('0x8')](),controller[_0xb22f('0x15')]);router[_0xb22f('0x13')]('/:id/reject',auth[_0xb22f('0x8')](),controller['reject']);router[_0xb22f('0x16')]('/:id',auth[_0xb22f('0x8')](),controller[_0xb22f('0x17')]);module[_0xb22f('0x18')]=router; \ No newline at end of file +var _0xae60=['/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','/:id/accept'];(function(_0x3c504c,_0x3a4db8){var _0x158f6c=function(_0x56edc3){while(--_0x56edc3){_0x3c504c['push'](_0x3c504c['shift']());}};_0x158f6c(++_0x3a4db8);}(_0xae60,0x1c7));var _0x0ae6=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xae60[_0x1a7846];return _0x48049;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ae6('0x3'));var router=express[_0x0ae6('0x4')]();var fs_extra=require(_0x0ae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var controller=require('./faxMessage.controller');router[_0x0ae6('0x8')]('/',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xa')]);router[_0x0ae6('0x8')](_0x0ae6('0xb'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xc')]);router[_0x0ae6('0x8')]('/:id',auth[_0x0ae6('0x9')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x8')](_0x0ae6('0xe'),auth['isAuthenticated'](),controller[_0x0ae6('0xf')]);router[_0x0ae6('0x10')]('/',auth[_0x0ae6('0x9')](),interaction[_0x0ae6('0x11')](_0x0ae6('0x12'),_0x0ae6('0x13')),controller[_0x0ae6('0x14')]);router[_0x0ae6('0x15')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x17')]);router[_0x0ae6('0x15')](_0x0ae6('0x18'),auth[_0x0ae6('0x9')](),controller['accept']);router[_0x0ae6('0x15')](_0x0ae6('0x19'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1a')]);router[_0x0ae6('0x1b')](_0x0ae6('0x16'),auth[_0x0ae6('0x9')](),controller[_0x0ae6('0x1c')]);module[_0x0ae6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5d92822..fcf0136 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 _0xfff8=['beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xfff8,0xe2));var _0x8fff=function(_0x495225,_0x252b51){_0x495225=_0x495225-0x0;var _0x1e1809=_0xfff8[_0x495225];return _0x1e1809;};'use strict';var Sequelize=require(_0x8fff('0x0'));module[_0x8fff('0x1')]={'name':{'type':Sequelize[_0x8fff('0x2')],'unique':_0x8fff('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8fff('0x4')]('rrmemory',_0x8fff('0x5'),_0x8fff('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa8ae=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa8ae,0x94));var _0xea8a=function(_0x56e1e2,_0x487fed){_0x56e1e2=_0x56e1e2-0x0;var _0x483c77=_0xa8ae[_0x56e1e2];return _0x483c77;};'use strict';var Sequelize=require(_0xea8a('0x0'));module[_0xea8a('0x1')]={'name':{'type':Sequelize[_0xea8a('0x2')],'unique':_0xea8a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea8a('0x2')]},'timeout':{'type':Sequelize[_0xea8a('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea8a('0x5')](_0xea8a('0x6'),_0xea8a('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xea8a('0x4')],'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 1406830..4adfb42 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 _0x94cc=['sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','get','FaxQueues','UserProfileResource','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','FaxQueue','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','pick','FaxQueueId','User','UserId','agent','faxPause','updatedAt','format','SIP','createdAt','Team','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x94cc,0x18b));var _0xc94c=function(_0x241aef,_0x53a959){_0x241aef=_0x241aef-0x0;var _0x21cde1=_0x94cc[_0x241aef];return _0x21cde1;};'use strict';var emlformat=require(_0xc94c('0x0'));var rimraf=require(_0xc94c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc94c('0x2'));var rp=require(_0xc94c('0x3'));var moment=require(_0xc94c('0x4'));var BPromise=require(_0xc94c('0x5'));var Mustache=require('mustache');var util=require(_0xc94c('0x6'));var path=require(_0xc94c('0x7'));var sox=require(_0xc94c('0x8'));var csv=require(_0xc94c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc94c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc94c('0xb'));var jsforce=require(_0xc94c('0xc'));var deskjs=require(_0xc94c('0xd'));var toCsv=require(_0xc94c('0x9'));var querystring=require('querystring');var Papa=require(_0xc94c('0xe'));var Redis=require('ioredis');var authService=require(_0xc94c('0xf'));var qs=require(_0xc94c('0x10'));var as=require(_0xc94c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc94c('0x12'))(_0xc94c('0x13'));var utils=require('../../config/utils');var config=require(_0xc94c('0x14'));var licenseUtil=require(_0xc94c('0x15'));var db=require(_0xc94c('0x16'))['db'];config[_0xc94c('0x17')]=_[_0xc94c('0x18')](config[_0xc94c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc94c('0x19'))(new Redis(config[_0xc94c('0x17')]));require(_0xc94c('0x1a'))[_0xc94c('0x1b')](socket);function respondWithStatusCode(_0x453570,_0x399d72){_0x399d72=_0x399d72||0xcc;return function(_0x17144b){if(_0x17144b){return _0x453570[_0xc94c('0x1c')](_0x399d72);}return _0x453570['status'](_0x399d72)['end']();};}function respondWithResult(_0x4bac93,_0x14be00){_0x14be00=_0x14be00||0xc8;return function(_0x1c0e90){if(_0x1c0e90){return _0x4bac93['status'](_0x14be00)[_0xc94c('0x1d')](_0x1c0e90);}};}function respondWithFilteredResult(_0x26bdce,_0x120ba6){return function(_0x4e83fb){if(_0x4e83fb){var _0x2552ee=typeof _0x120ba6[_0xc94c('0x1e')]===_0xc94c('0x1f')&&typeof _0x120ba6['limit']==='undefined';var _0x3c9a1f=_0x4e83fb[_0xc94c('0x20')];var _0x4c18cd=_0x2552ee?0x0:_0x120ba6['offset'];var _0x322821=_0x2552ee?_0x4e83fb[_0xc94c('0x20')]:_0x120ba6[_0xc94c('0x1e')]+_0x120ba6[_0xc94c('0x21')];var _0x3696c6;if(_0x322821>=_0x3c9a1f){_0x322821=_0x3c9a1f;_0x3696c6=0xc8;}else{_0x3696c6=0xce;}_0x26bdce[_0xc94c('0x22')](_0x3696c6);return _0x26bdce[_0xc94c('0x23')](_0xc94c('0x24'),_0x4c18cd+'-'+_0x322821+'/'+_0x3c9a1f)['json'](_0x4e83fb);}return null;};}function patchUpdates(_0x137d97){return function(_0x226230){try{jsonpatch[_0xc94c('0x25')](_0x226230,_0x137d97,!![]);}catch(_0x31cac8){return BPromise[_0xc94c('0x26')](_0x31cac8);}return _0x226230['save']();};}function saveUpdates(_0x50fef6,_0x48a67c){return function(_0x5de391){if(_0x5de391){return _0x5de391[_0xc94c('0x27')](_0x50fef6)['then'](function(_0x1b1c81){return _0x1b1c81;});}return null;};}function removeEntity(_0x5d54a9,_0xea7885){return function(_0x476ea5){if(_0x476ea5){return _0x476ea5['destroy']()['then'](function(){var _0x54d797=_0x476ea5[_0xc94c('0x28')]({'plain':!![]});var _0x3c3588=_0xc94c('0x29');return db[_0xc94c('0x2a')][_0xc94c('0x2b')]({'where':{'type':_0x3c3588,'resourceId':_0x54d797['id']}})[_0xc94c('0x2c')](function(){return _0x476ea5;});})['then'](function(){_0x5d54a9[_0xc94c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26471,_0x122634){return function(_0x2d47df){if(!_0x2d47df){_0x26471[_0xc94c('0x1c')](0x194);}return _0x2d47df;};}function handleError(_0x50e6ff,_0x32d844){_0x32d844=_0x32d844||0x1f4;return function(_0x271264){logger[_0xc94c('0x2d')](_0x271264[_0xc94c('0x2e')]);if(_0x271264['name']){delete _0x271264[_0xc94c('0x2f')];}_0x50e6ff[_0xc94c('0x22')](_0x32d844)[_0xc94c('0x30')](_0x271264);};}exports[_0xc94c('0x31')]=function(_0x2555a8,_0x48a3ff){var _0x417b55={},_0x21fb64={},_0x439133={'count':0x0,'rows':[]};var _0x3f5286=_[_0xc94c('0x32')](db['FaxQueue'][_0xc94c('0x33')],function(_0xde1ceb){return{'name':_0xde1ceb[_0xc94c('0x34')],'type':_0xde1ceb[_0xc94c('0x35')][_0xc94c('0x36')]};});_0x21fb64[_0xc94c('0x37')]=_[_0xc94c('0x32')](_0x3f5286,'name');_0x21fb64[_0xc94c('0x38')]=_[_0xc94c('0x39')](_0x2555a8[_0xc94c('0x38')]);_0x21fb64['filters']=_[_0xc94c('0x3a')](_0x21fb64[_0xc94c('0x37')],_0x21fb64['query']);_0x417b55[_0xc94c('0x3b')]=_[_0xc94c('0x3a')](_0x21fb64[_0xc94c('0x37')],qs[_0xc94c('0x3c')](_0x2555a8[_0xc94c('0x38')][_0xc94c('0x3c')]));_0x417b55[_0xc94c('0x3b')]=_0x417b55['attributes'][_0xc94c('0x3d')]?_0x417b55[_0xc94c('0x3b')]:_0x21fb64[_0xc94c('0x37')];if(!_0x2555a8[_0xc94c('0x38')][_0xc94c('0x3e')](_0xc94c('0x3f'))){_0x417b55[_0xc94c('0x21')]=qs[_0xc94c('0x21')](_0x2555a8[_0xc94c('0x38')][_0xc94c('0x21')]);_0x417b55['offset']=qs['offset'](_0x2555a8[_0xc94c('0x38')][_0xc94c('0x1e')]);}_0x417b55[_0xc94c('0x40')]=qs[_0xc94c('0x41')](_0x2555a8[_0xc94c('0x38')][_0xc94c('0x41')]);_0x417b55[_0xc94c('0x42')]=qs[_0xc94c('0x43')](_['pick'](_0x2555a8[_0xc94c('0x38')],_0x21fb64[_0xc94c('0x43')]),_0x3f5286);if(_0x2555a8[_0xc94c('0x38')][_0xc94c('0x44')]){_0x417b55[_0xc94c('0x42')]=_['merge'](_0x417b55[_0xc94c('0x42')],{'$or':_[_0xc94c('0x32')](_0x3f5286,function(_0x2d98ea){if(_0x2d98ea[_0xc94c('0x35')]!==_0xc94c('0x45')){var _0x568f0d={};_0x568f0d[_0x2d98ea[_0xc94c('0x2f')]]={'$like':'%'+_0x2555a8[_0xc94c('0x38')][_0xc94c('0x44')]+'%'};return _0x568f0d;}})});}_0x417b55=_[_0xc94c('0x46')]({},_0x417b55,_0x2555a8[_0xc94c('0x47')]);var _0x3e59da={'where':_0x417b55['where']};return db['FaxQueue']['count'](_0x3e59da)[_0xc94c('0x2c')](function(_0xd82325){_0x439133[_0xc94c('0x20')]=_0xd82325;if(_0x2555a8[_0xc94c('0x38')][_0xc94c('0x48')]){_0x417b55[_0xc94c('0x49')]=[{'all':!![]}];}return db[_0xc94c('0x4a')][_0xc94c('0x4b')](_0x417b55);})[_0xc94c('0x2c')](function(_0x186dc0){_0x439133['rows']=_0x186dc0;return _0x439133;})[_0xc94c('0x2c')](respondWithFilteredResult(_0x48a3ff,_0x417b55))[_0xc94c('0x4c')](handleError(_0x48a3ff,null));};exports[_0xc94c('0x4d')]=function(_0x376c19,_0x2e1b15){var _0x53abcf={'raw':!![],'where':{'id':_0x376c19[_0xc94c('0x4e')]['id']}},_0x2d7b89={};_0x2d7b89[_0xc94c('0x37')]=_[_0xc94c('0x39')](db[_0xc94c('0x4a')][_0xc94c('0x33')]);_0x2d7b89[_0xc94c('0x38')]=_[_0xc94c('0x39')](_0x376c19[_0xc94c('0x38')]);_0x2d7b89[_0xc94c('0x43')]=_[_0xc94c('0x3a')](_0x2d7b89['model'],_0x2d7b89[_0xc94c('0x38')]);_0x53abcf[_0xc94c('0x3b')]=_[_0xc94c('0x3a')](_0x2d7b89[_0xc94c('0x37')],qs[_0xc94c('0x3c')](_0x376c19[_0xc94c('0x38')][_0xc94c('0x3c')]));_0x53abcf[_0xc94c('0x3b')]=_0x53abcf['attributes'][_0xc94c('0x3d')]?_0x53abcf[_0xc94c('0x3b')]:_0x2d7b89[_0xc94c('0x37')];if(_0x376c19[_0xc94c('0x38')][_0xc94c('0x48')]){_0x53abcf['include']=[{'all':!![]}];}_0x53abcf=_['merge']({},_0x53abcf,_0x376c19['options']);return db[_0xc94c('0x4a')][_0xc94c('0x4f')](_0x53abcf)[_0xc94c('0x2c')](handleEntityNotFound(_0x2e1b15,null))[_0xc94c('0x2c')](respondWithResult(_0x2e1b15,null))[_0xc94c('0x4c')](handleError(_0x2e1b15,null));};exports[_0xc94c('0x50')]=function(_0x34948a,_0x33f993){return db[_0xc94c('0x4a')][_0xc94c('0x50')](_0x34948a[_0xc94c('0x51')],{})[_0xc94c('0x2c')](function(_0x4ca06d){var _0x3059dc=_0x34948a[_0xc94c('0x52')]['get']({'plain':!![]});if(!_0x3059dc)throw new Error(_0xc94c('0x53'));if(_0x3059dc[_0xc94c('0x54')]==='user'){var _0x13a9b4=_0x4ca06d[_0xc94c('0x28')]({'plain':!![]});var _0x52bd8f=_0xc94c('0x29');return db[_0xc94c('0x55')][_0xc94c('0x4f')]({'where':{'name':_0x52bd8f,'userProfileId':_0x3059dc[_0xc94c('0x56')]},'raw':!![]})[_0xc94c('0x2c')](function(_0x5ec3ad){if(_0x5ec3ad&&_0x5ec3ad['autoAssociation']===0x0){return db[_0xc94c('0x2a')]['create']({'name':_0x13a9b4[_0xc94c('0x2f')],'resourceId':_0x13a9b4['id'],'type':_0x5ec3ad[_0xc94c('0x2f')],'sectionId':_0x5ec3ad['id']},{})[_0xc94c('0x2c')](function(){return _0x4ca06d;});}else{return _0x4ca06d;}})[_0xc94c('0x4c')](function(_0x528ce2){logger[_0xc94c('0x2d')](_0xc94c('0x57'),_0x528ce2);throw _0x528ce2;});}return _0x4ca06d;})[_0xc94c('0x2c')](respondWithResult(_0x33f993,0xc9))['catch'](handleError(_0x33f993,null));};exports[_0xc94c('0x27')]=function(_0xb92064,_0x199cfd){if(_0xb92064[_0xc94c('0x51')]['id']){delete _0xb92064[_0xc94c('0x51')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0xb92064[_0xc94c('0x4e')]['id']}})[_0xc94c('0x2c')](handleEntityNotFound(_0x199cfd,null))[_0xc94c('0x2c')](saveUpdates(_0xb92064[_0xc94c('0x51')],null))[_0xc94c('0x2c')](respondWithResult(_0x199cfd,null))[_0xc94c('0x4c')](handleError(_0x199cfd,null));};exports[_0xc94c('0x2b')]=function(_0x25a0f5,_0x58959e){return db[_0xc94c('0x4a')][_0xc94c('0x4f')]({'where':{'id':_0x25a0f5[_0xc94c('0x4e')]['id']}})[_0xc94c('0x2c')](handleEntityNotFound(_0x58959e,null))[_0xc94c('0x2c')](removeEntity(_0x58959e,null))[_0xc94c('0x4c')](handleError(_0x58959e,null));};exports[_0xc94c('0x58')]=function(_0x21d0eb,_0x515b82){return db['FaxQueue']['describe']()['then'](respondWithResult(_0x515b82,null))[_0xc94c('0x4c')](handleError(_0x515b82,null));};exports[_0xc94c('0x59')]=function(_0x15164d,_0x142266,_0x386506){var _0x11ef75={'raw':!![],'where':{}},_0x59826e={},_0x246fa3;return db[_0xc94c('0x4a')][_0xc94c('0x5a')]({'where':{'id':_0x15164d[_0xc94c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x142266,null))['then'](function(_0x5300b0){if(_0x5300b0){_0x246fa3=_0x5300b0[_0xc94c('0x28')]({'plain':!![]});_0x59826e['model']=_[_0xc94c('0x39')](db[_0xc94c('0x5b')]['rawAttributes']);_0x59826e[_0xc94c('0x38')]=_[_0xc94c('0x39')](_0x15164d['query']);_0x59826e[_0xc94c('0x43')]=_[_0xc94c('0x3a')](_0x59826e[_0xc94c('0x37')],_0x59826e[_0xc94c('0x38')]);_0x11ef75[_0xc94c('0x3b')]=_[_0xc94c('0x3a')](_0x59826e['model'],qs[_0xc94c('0x3c')](_0x15164d[_0xc94c('0x38')][_0xc94c('0x3c')]));_0x11ef75['attributes']=_0x11ef75['attributes'][_0xc94c('0x3d')]?_0x11ef75[_0xc94c('0x3b')]:_0x59826e[_0xc94c('0x37')];if(!_0x15164d[_0xc94c('0x38')][_0xc94c('0x3e')](_0xc94c('0x3f'))){_0x11ef75[_0xc94c('0x21')]=qs['limit'](_0x15164d[_0xc94c('0x38')][_0xc94c('0x21')]);_0x11ef75[_0xc94c('0x1e')]=qs['offset'](_0x15164d[_0xc94c('0x38')][_0xc94c('0x1e')]);}_0x11ef75[_0xc94c('0x40')]=qs[_0xc94c('0x41')](_0x15164d['query'][_0xc94c('0x41')]);_0x11ef75[_0xc94c('0x42')]=qs[_0xc94c('0x43')](_[_0xc94c('0x5c')](_0x15164d[_0xc94c('0x38')],_0x59826e[_0xc94c('0x43')]));_0x11ef75[_0xc94c('0x42')][_0xc94c('0x5d')]=_0x5300b0['id'];if(_0x15164d[_0xc94c('0x38')][_0xc94c('0x44')]){_0x11ef75[_0xc94c('0x42')]=_[_0xc94c('0x46')](_0x11ef75[_0xc94c('0x42')],{'$or':_['map'](_0x11ef75[_0xc94c('0x3b')],function(_0x337895){var _0x44cc3d={};_0x44cc3d[_0x337895]={'$like':'%'+_0x15164d[_0xc94c('0x38')]['filter']+'%'};return _0x44cc3d;})});}_0x11ef75=_['merge']({},_0x11ef75,_0x15164d[_0xc94c('0x47')]);return db[_0xc94c('0x5b')][_0xc94c('0x4b')](_0x11ef75);}})[_0xc94c('0x2c')](function(_0x586d33){if(_0x586d33){return db[_0xc94c('0x5e')]['findAndCountAll']({'where':{'id':_[_0xc94c('0x32')](_0x586d33,_0xc94c('0x5f')),'role':_0xc94c('0x60')},'attributes':['id',_0xc94c('0x2f'),_0xc94c('0x61'),_0xc94c('0x62'),'createdAt']});}})['then'](function(_0x137b3e){if(_0x137b3e){return{'count':_0x137b3e['count'],'rows':_[_0xc94c('0x32')](_0x137b3e['rows'],function(_0x18d981){return{'membername':_0x18d981['name'],'UserId':_0x18d981['id'],'queue_name':_0x246fa3['name'],'FaxQueueId':_0x246fa3['id'],'interface':util[_0xc94c('0x63')]('%s/%s',_0xc94c('0x64'),_0x18d981[_0xc94c('0x2f')]),'penalty':0x0,'paused':_0x18d981[_0xc94c('0x61')],'createdAt':_0x18d981[_0xc94c('0x65')],'updatedAt':_0x18d981[_0xc94c('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc94c('0x2c')](respondWithFilteredResult(_0x142266,_0x11ef75))['catch'](handleError(_0x142266,null));};exports['getTeams']=function(_0x33f2cf,_0x4c4819,_0x55e45b){var _0x5217a8={};var _0x2ec807={};var _0x187ca2;var _0x5a016d;return db['FaxQueue'][_0xc94c('0x5a')]({'where':{'id':_0x33f2cf[_0xc94c('0x4e')]['id']}})[_0xc94c('0x2c')](handleEntityNotFound(_0x4c4819,null))[_0xc94c('0x2c')](function(_0x393ca6){if(_0x393ca6){_0x187ca2=_0x393ca6;_0x2ec807[_0xc94c('0x37')]=_[_0xc94c('0x39')](db[_0xc94c('0x66')]['rawAttributes']);_0x2ec807[_0xc94c('0x38')]=_['keys'](_0x33f2cf[_0xc94c('0x38')]);_0x2ec807[_0xc94c('0x43')]=_[_0xc94c('0x3a')](_0x2ec807['model'],_0x2ec807[_0xc94c('0x38')]);_0x5217a8['attributes']=_[_0xc94c('0x3a')](_0x2ec807['model'],qs[_0xc94c('0x3c')](_0x33f2cf[_0xc94c('0x38')][_0xc94c('0x3c')]));_0x5217a8['attributes']=_0x5217a8[_0xc94c('0x3b')][_0xc94c('0x3d')]?_0x5217a8['attributes']:_0x2ec807[_0xc94c('0x37')];_0x5217a8[_0xc94c('0x40')]=qs[_0xc94c('0x41')](_0x33f2cf[_0xc94c('0x38')][_0xc94c('0x41')]);_0x5217a8[_0xc94c('0x42')]=qs[_0xc94c('0x43')](_['pick'](_0x33f2cf[_0xc94c('0x38')],_0x2ec807[_0xc94c('0x43')]));if(_0x33f2cf['query'][_0xc94c('0x44')]){_0x5217a8[_0xc94c('0x42')]=_['merge'](_0x5217a8['where'],{'$or':_['map'](_0x5217a8[_0xc94c('0x3b')],function(_0x2037ca){var _0x583e1a={};_0x583e1a[_0x2037ca]={'$like':'%'+_0x33f2cf[_0xc94c('0x38')]['filter']+'%'};return _0x583e1a;})});}_0x5217a8=_[_0xc94c('0x46')]({},_0x5217a8,_0x33f2cf[_0xc94c('0x47')]);return _0x187ca2[_0xc94c('0x67')](_0x5217a8);}})[_0xc94c('0x2c')](function(_0x364a5c){if(_0x364a5c){_0x5a016d=_0x364a5c['length'];if(!_0x33f2cf['query'][_0xc94c('0x3e')](_0xc94c('0x3f'))){_0x5217a8[_0xc94c('0x21')]=qs[_0xc94c('0x21')](_0x33f2cf['query']['limit']);_0x5217a8[_0xc94c('0x1e')]=qs[_0xc94c('0x1e')](_0x33f2cf[_0xc94c('0x38')][_0xc94c('0x1e')]);}return _0x187ca2['getTeams'](_0x5217a8);}})[_0xc94c('0x2c')](function(_0x3f0cc2){if(_0x3f0cc2){return _0x3f0cc2?{'count':_0x5a016d,'rows':_0x3f0cc2}:null;}})['then'](respondWithResult(_0x4c4819,null))[_0xc94c('0x4c')](handleError(_0x4c4819,null));};exports[_0xc94c('0x68')]=function(_0x571be8,_0x379928,_0x2754ac){var _0x5494fd=_0x571be8[_0xc94c('0x51')][_0xc94c('0x69')];return db[_0xc94c('0x66')][_0xc94c('0x4b')]({'where':{'id':_0x5494fd},'attributes':['id'],'include':[{'model':db[_0xc94c('0x5e')],'as':'Agents','attributes':['id',_0xc94c('0x2f'),'online',_0xc94c('0x6a'),_0xc94c('0x6b')],'raw':!![]}]})['then'](function(_0x55438c){if(_0x55438c){var _0x1bb710=_[_0xc94c('0x6c')](_0x55438c,function(_0x509dcd){var _0x2b0a5b=_0x509dcd[_0xc94c('0x28')]({'plain':!![]});return _0x2b0a5b[_0xc94c('0x6d')];});return db[_0xc94c('0x4a')][_0xc94c('0x4f')]({'where':{'id':_0x571be8['params']['id']}})['then'](function(_0x2ac3f2){return db[_0xc94c('0x6e')][_0xc94c('0x6f')](function(_0x3fbfeb){return _0x2ac3f2['addTeams'](_0x5494fd,{'transaction':_0x3fbfeb})[_0xc94c('0x2c')](function(){return BPromise[_0xc94c('0x70')](_0x1bb710,function(_0x24953f){return db['UserFaxQueue'][_0xc94c('0x71')]({'where':{'UserId':_0x24953f['id'],'FaxQueueId':_0x571be8[_0xc94c('0x4e')]['id']},'transaction':_0x3fbfeb});});})[_0xc94c('0x2c')](function(){_0x1bb710[_0xc94c('0x72')](function(_0x32e49c){socket[_0xc94c('0x73')](_0xc94c('0x74'),{'UserId':_0x32e49c['id'],'FaxQueueId':_0x2ac3f2['id']});});});});});}})['then'](respondWithStatusCode(_0x379928,null))['catch'](handleError(_0x379928,null));};exports[_0xc94c('0x75')]=function(_0x1dcf73,_0x56cc90,_0x369a05){return db[_0xc94c('0x66')][_0xc94c('0x4b')]({'where':{'id':_0x1dcf73['query'][_0xc94c('0x69')]},'attributes':['id'],'include':[{'model':db[_0xc94c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc94c('0x2c')](handleEntityNotFound(_0x56cc90,null))[_0xc94c('0x2c')](function(_0xe2712a){var _0x55558c=_[_0xc94c('0x32')](_0xe2712a,'id');var _0x3e2fde=[];var _0x2521ca=[];var _0x508efd=squel[_0xc94c('0x76')]();_0x508efd[_0xc94c('0x77')](_0xc94c('0x78'))[_0xc94c('0x79')](_0xc94c('0x7a'),'tq')['join'](_0xc94c('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc94c('0x7c'),_0x1dcf73[_0xc94c('0x4e')]['id']);for(var _0x4b671f=0x0;_0x4b671f<_0xe2712a[_0xc94c('0x3d')];_0x4b671f+=0x1){let _0x3b8ed8=_0xe2712a[_0x4b671f];for(var _0x36af38=0x0;_0x36af38<_0x3b8ed8[_0xc94c('0x6d')][_0xc94c('0x3d')];_0x36af38+=0x1){let _0x3dc22d=_0x3b8ed8[_0xc94c('0x6d')][_0x36af38];var _0x1533bb=_0x508efd[_0xc94c('0x7d')]();_0x1533bb[_0xc94c('0x42')](_0xc94c('0x7e'),_0x3dc22d['id']);_0x2521ca[_0xc94c('0x7f')](db['sequelize'][_0xc94c('0x38')](_0x1533bb[_0xc94c('0x80')](),{'type':db[_0xc94c('0x6e')][_0xc94c('0x81')]['SELECT']})[_0xc94c('0x2c')](function(_0x170079){if(_0x170079[_0xc94c('0x3d')]===0x1){return _0x3dc22d['id'];}else{var _0x3e520d=_['every'](_[_0xc94c('0x32')](_0x170079,_0xc94c('0x82')),function(_0x60d15e){return _['includes'](_0x55558c,_0x60d15e);});if(_0x3e520d){return _0x3dc22d['id'];}}}));}}return BPromise[_0xc94c('0x83')](_0x2521ca)[_0xc94c('0x2c')](function(_0xa0bac9){_0x3e2fde=_(_0x3e2fde)['union'](_0xa0bac9)[_0xc94c('0x84')]()[_0xc94c('0x85')]();return db[_0xc94c('0x4a')][_0xc94c('0x4f')]({'where':{'id':_0x1dcf73[_0xc94c('0x4e')]['id']}})['then'](function(_0x4af557){return db[_0xc94c('0x6e')][_0xc94c('0x6f')](function(_0x19ecf1){return _0x4af557['removeTeams'](_0x1dcf73[_0xc94c('0x38')]['ids'],{'transaction':_0x19ecf1})['then'](function(){if(!_[_0xc94c('0x86')](_0x3e2fde)){return _0x4af557[_0xc94c('0x87')](_0x3e2fde,{'transaction':_0x19ecf1});}})[_0xc94c('0x2c')](function(){_0x3e2fde[_0xc94c('0x72')](function(_0x52f541){socket[_0xc94c('0x73')](_0xc94c('0x88'),{'UserId':_0x52f541,'FaxQueueId':_0x4af557['id']});});});});});});})[_0xc94c('0x2c')](respondWithStatusCode(_0x56cc90,null))[_0xc94c('0x4c')](handleError(_0x56cc90,null));};exports['addAgents']=function(_0x404d69,_0xe390dc,_0x32ffae){return db[_0xc94c('0x4a')][_0xc94c('0x4f')]({'where':{'id':_0x404d69[_0xc94c('0x4e')]['id']}})[_0xc94c('0x2c')](handleEntityNotFound(_0xe390dc,null))['then'](function(_0x5524a8){if(_0x5524a8){return _0x5524a8[_0xc94c('0x89')](_0x404d69['body'][_0xc94c('0x69')],_['omit'](_0x404d69[_0xc94c('0x51')],[_0xc94c('0x69'),'id'])||{})[_0xc94c('0x8a')](function(_0x93eaac){for(var _0x28e9f9=0x0;_0x28e9f9<_0x404d69['body']['ids']['length'];_0x28e9f9+=0x1){socket[_0xc94c('0x73')]('userFaxQueue:save',{'UserId':Number(_0x404d69[_0xc94c('0x51')][_0xc94c('0x69')][_0x28e9f9]),'FaxQueueId':Number(_0x404d69[_0xc94c('0x4e')]['id'])});}return _0x93eaac;});}})[_0xc94c('0x2c')](respondWithResult(_0xe390dc,null))[_0xc94c('0x4c')](handleError(_0xe390dc,null));};exports[_0xc94c('0x87')]=function(_0x3bf514,_0x258bcb,_0x31875d){return db[_0xc94c('0x4a')][_0xc94c('0x4f')]({'where':{'id':_0x3bf514['params']['id']}})['then'](handleEntityNotFound(_0x258bcb,null))[_0xc94c('0x2c')](function(_0x4b2c28){if(_0x4b2c28){return _0x4b2c28[_0xc94c('0x87')](_0x3bf514[_0xc94c('0x38')][_0xc94c('0x69')])[_0xc94c('0x2c')](function(){if(_[_0xc94c('0x8b')](_0x3bf514[_0xc94c('0x38')][_0xc94c('0x69')])){for(var _0x1ca1f1=0x0;_0x1ca1f1<_0x3bf514['query']['ids'][_0xc94c('0x3d')];_0x1ca1f1+=0x1){socket[_0xc94c('0x73')](_0xc94c('0x88'),{'UserId':Number(_0x3bf514[_0xc94c('0x38')]['ids'][_0x1ca1f1]),'FaxQueueId':Number(_0x3bf514[_0xc94c('0x4e')]['id'])});}}else{socket[_0xc94c('0x73')](_0xc94c('0x88'),{'UserId':Number(_0x3bf514['query']['ids']),'FaxQueueId':Number(_0x3bf514[_0xc94c('0x4e')]['id'])});}});}})[_0xc94c('0x2c')](respondWithStatusCode(_0x258bcb,null))[_0xc94c('0x4c')](handleError(_0x258bcb,null));};exports['getAgents']=function(_0x156673,_0x1352f6,_0x5251d0){var _0x993b72={};var _0x9c8414={};var _0x229e61;var _0x398b79;return db[_0xc94c('0x4a')][_0xc94c('0x5a')]({'where':{'id':_0x156673[_0xc94c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1352f6,null))[_0xc94c('0x2c')](function(_0x4d770c){if(_0x4d770c){_0x229e61=_0x4d770c;_0x9c8414[_0xc94c('0x37')]=_[_0xc94c('0x39')](db[_0xc94c('0x5e')][_0xc94c('0x33')]);_0x9c8414[_0xc94c('0x38')]=_[_0xc94c('0x39')](_0x156673[_0xc94c('0x38')]);_0x9c8414[_0xc94c('0x43')]=_[_0xc94c('0x3a')](_0x9c8414['model'],_0x9c8414[_0xc94c('0x38')]);_0x993b72['attributes']=_[_0xc94c('0x3a')](_0x9c8414[_0xc94c('0x37')],qs[_0xc94c('0x3c')](_0x156673[_0xc94c('0x38')][_0xc94c('0x3c')]));_0x993b72[_0xc94c('0x3b')]=_0x993b72[_0xc94c('0x3b')][_0xc94c('0x3d')]?_0x993b72['attributes']:_0x9c8414['model'];_0x993b72[_0xc94c('0x40')]=qs[_0xc94c('0x41')](_0x156673[_0xc94c('0x38')][_0xc94c('0x41')]);_0x993b72['where']=qs[_0xc94c('0x43')](_[_0xc94c('0x5c')](_0x156673[_0xc94c('0x38')],_0x9c8414['filters']));if(_0x156673[_0xc94c('0x38')][_0xc94c('0x44')]){_0x993b72[_0xc94c('0x42')]=_[_0xc94c('0x46')](_0x993b72['where'],{'$or':_[_0xc94c('0x32')](_0x993b72[_0xc94c('0x3b')],function(_0x508acc){var _0x1f3a2e={};_0x1f3a2e[_0x508acc]={'$like':'%'+_0x156673['query'][_0xc94c('0x44')]+'%'};return _0x1f3a2e;})});}_0x993b72=_[_0xc94c('0x46')]({},_0x993b72,_0x156673[_0xc94c('0x47')]);return _0x229e61['getAgents'](_0x993b72);}})[_0xc94c('0x2c')](function(_0x159841){if(_0x159841){_0x398b79=_0x159841[_0xc94c('0x3d')];if(!_0x156673[_0xc94c('0x38')][_0xc94c('0x3e')](_0xc94c('0x3f'))){_0x993b72[_0xc94c('0x21')]=qs[_0xc94c('0x21')](_0x156673[_0xc94c('0x38')][_0xc94c('0x21')]);_0x993b72[_0xc94c('0x1e')]=qs['offset'](_0x156673[_0xc94c('0x38')][_0xc94c('0x1e')]);}return _0x229e61[_0xc94c('0x8c')](_0x993b72);}})[_0xc94c('0x2c')](function(_0x23973e){if(_0x23973e){return _0x23973e?{'count':_0x398b79,'rows':_0x23973e}:null;}})[_0xc94c('0x2c')](respondWithResult(_0x1352f6,null))[_0xc94c('0x4c')](handleError(_0x1352f6,null));}; \ No newline at end of file +var _0xd6e7=['addAgents','removeAgents','isArray','getAgents','rimraf','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','getMembers','findOne','keys','UserFaxQueue','pick','User','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','flatMap','transaction','each','forEach','emit','userFaxQueue:save','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userFaxQueue:remove'];(function(_0x797add,_0x58a4c9){var _0x4cccfa=function(_0x5da3de){while(--_0x5da3de){_0x797add['push'](_0x797add['shift']());}};_0x4cccfa(++_0x58a4c9);}(_0xd6e7,0x193));var _0x7d6e=function(_0x5e5882,_0x699de4){_0x5e5882=_0x5e5882-0x0;var _0x3ea2dc=_0xd6e7[_0x5e5882];return _0x3ea2dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d6e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d6e('0x1'));var Mustache=require(_0x7d6e('0x2'));var util=require(_0x7d6e('0x3'));var path=require(_0x7d6e('0x4'));var sox=require(_0x7d6e('0x5'));var csv=require('to-csv');var ejs=require(_0x7d6e('0x6'));var fs=require('fs');var fs_extra=require(_0x7d6e('0x7'));var _=require(_0x7d6e('0x8'));var squel=require('squel');var crypto=require(_0x7d6e('0x9'));var jsforce=require(_0x7d6e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7d6e('0xb'));var querystring=require('querystring');var Papa=require(_0x7d6e('0xc'));var Redis=require(_0x7d6e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d6e('0xe'));var hardwareService=require(_0x7d6e('0xf'));var logger=require(_0x7d6e('0x10'))(_0x7d6e('0x11'));var utils=require(_0x7d6e('0x12'));var config=require(_0x7d6e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d6e('0x14'))['db'];config[_0x7d6e('0x15')]=_['defaults'](config[_0x7d6e('0x15')],{'host':_0x7d6e('0x16'),'port':0x18eb});var socket=require(_0x7d6e('0x17'))(new Redis(config[_0x7d6e('0x15')]));require(_0x7d6e('0x18'))[_0x7d6e('0x19')](socket);function respondWithStatusCode(_0xf8ede6,_0xfbc25b){_0xfbc25b=_0xfbc25b||0xcc;return function(_0x17eb5b){if(_0x17eb5b){return _0xf8ede6[_0x7d6e('0x1a')](_0xfbc25b);}return _0xf8ede6[_0x7d6e('0x1b')](_0xfbc25b)[_0x7d6e('0x1c')]();};}function respondWithResult(_0x1bc0e6,_0x3151f9){_0x3151f9=_0x3151f9||0xc8;return function(_0x294900){if(_0x294900){return _0x1bc0e6[_0x7d6e('0x1b')](_0x3151f9)[_0x7d6e('0x1d')](_0x294900);}};}function respondWithFilteredResult(_0x18a97a,_0x5cc247){return function(_0x511be0){if(_0x511be0){var _0x53129d=typeof _0x5cc247[_0x7d6e('0x1e')]===_0x7d6e('0x1f')&&typeof _0x5cc247['limit']==='undefined';var _0x3067d1=_0x511be0[_0x7d6e('0x20')];var _0x159d6e=_0x53129d?0x0:_0x5cc247[_0x7d6e('0x1e')];var _0x36477f=_0x53129d?_0x511be0[_0x7d6e('0x20')]:_0x5cc247[_0x7d6e('0x1e')]+_0x5cc247[_0x7d6e('0x21')];var _0x4750a7;if(_0x36477f>=_0x3067d1){_0x36477f=_0x3067d1;_0x4750a7=0xc8;}else{_0x4750a7=0xce;}_0x18a97a[_0x7d6e('0x1b')](_0x4750a7);return _0x18a97a[_0x7d6e('0x22')]('Content-Range',_0x159d6e+'-'+_0x36477f+'/'+_0x3067d1)[_0x7d6e('0x1d')](_0x511be0);}return null;};}function patchUpdates(_0xca7f46){return function(_0xbd2b03){try{jsonpatch[_0x7d6e('0x23')](_0xbd2b03,_0xca7f46,!![]);}catch(_0x24eabc){return BPromise['reject'](_0x24eabc);}return _0xbd2b03[_0x7d6e('0x24')]();};}function saveUpdates(_0x1522a8,_0x1d69d9){return function(_0x4e9f1c){if(_0x4e9f1c){return _0x4e9f1c[_0x7d6e('0x25')](_0x1522a8)[_0x7d6e('0x26')](function(_0x12cee4){return _0x12cee4;});}return null;};}function removeEntity(_0x438802,_0x55f8f9){return function(_0x4b0e2f){if(_0x4b0e2f){return _0x4b0e2f[_0x7d6e('0x27')]()[_0x7d6e('0x26')](function(){var _0x173edd=_0x4b0e2f[_0x7d6e('0x28')]({'plain':!![]});var _0x20c67d=_0x7d6e('0x29');return db[_0x7d6e('0x2a')][_0x7d6e('0x27')]({'where':{'type':_0x20c67d,'resourceId':_0x173edd['id']}})[_0x7d6e('0x26')](function(){return _0x4b0e2f;});})[_0x7d6e('0x26')](function(){_0x438802[_0x7d6e('0x1b')](0xcc)[_0x7d6e('0x1c')]();});}};}function handleEntityNotFound(_0xe98019,_0xbba3fe){return function(_0x5b6969){if(!_0x5b6969){_0xe98019[_0x7d6e('0x1a')](0x194);}return _0x5b6969;};}function handleError(_0xaea668,_0xf1ebf6){_0xf1ebf6=_0xf1ebf6||0x1f4;return function(_0x2594df){logger[_0x7d6e('0x2b')](_0x2594df['stack']);if(_0x2594df[_0x7d6e('0x2c')]){delete _0x2594df[_0x7d6e('0x2c')];}_0xaea668[_0x7d6e('0x1b')](_0xf1ebf6)[_0x7d6e('0x2d')](_0x2594df);};}exports[_0x7d6e('0x2e')]=function(_0x3d43ca,_0xb9e009){var _0xe8bec6={},_0x140231={},_0x393794={'count':0x0,'rows':[]};var _0x399884=_[_0x7d6e('0x2f')](db[_0x7d6e('0x30')][_0x7d6e('0x31')],function(_0x1d87f1){return{'name':_0x1d87f1[_0x7d6e('0x32')],'type':_0x1d87f1[_0x7d6e('0x33')][_0x7d6e('0x34')]};});_0x140231[_0x7d6e('0x35')]=_[_0x7d6e('0x2f')](_0x399884,_0x7d6e('0x2c'));_0x140231['query']=_['keys'](_0x3d43ca[_0x7d6e('0x36')]);_0x140231['filters']=_[_0x7d6e('0x37')](_0x140231[_0x7d6e('0x35')],_0x140231[_0x7d6e('0x36')]);_0xe8bec6[_0x7d6e('0x38')]=_['intersection'](_0x140231[_0x7d6e('0x35')],qs[_0x7d6e('0x39')](_0x3d43ca[_0x7d6e('0x36')]['fields']));_0xe8bec6['attributes']=_0xe8bec6[_0x7d6e('0x38')][_0x7d6e('0x3a')]?_0xe8bec6[_0x7d6e('0x38')]:_0x140231[_0x7d6e('0x35')];if(!_0x3d43ca[_0x7d6e('0x36')][_0x7d6e('0x3b')](_0x7d6e('0x3c'))){_0xe8bec6[_0x7d6e('0x21')]=qs[_0x7d6e('0x21')](_0x3d43ca['query'][_0x7d6e('0x21')]);_0xe8bec6[_0x7d6e('0x1e')]=qs[_0x7d6e('0x1e')](_0x3d43ca[_0x7d6e('0x36')][_0x7d6e('0x1e')]);}_0xe8bec6['order']=qs['sort'](_0x3d43ca['query'][_0x7d6e('0x3d')]);_0xe8bec6[_0x7d6e('0x3e')]=qs[_0x7d6e('0x3f')](_['pick'](_0x3d43ca[_0x7d6e('0x36')],_0x140231[_0x7d6e('0x3f')]),_0x399884);if(_0x3d43ca[_0x7d6e('0x36')][_0x7d6e('0x40')]){_0xe8bec6[_0x7d6e('0x3e')]=_['merge'](_0xe8bec6[_0x7d6e('0x3e')],{'$or':_[_0x7d6e('0x2f')](_0x399884,function(_0x585dd6){if(_0x585dd6[_0x7d6e('0x33')]!==_0x7d6e('0x41')){var _0xc117b8={};_0xc117b8[_0x585dd6[_0x7d6e('0x2c')]]={'$like':'%'+_0x3d43ca[_0x7d6e('0x36')][_0x7d6e('0x40')]+'%'};return _0xc117b8;}})});}_0xe8bec6=_[_0x7d6e('0x42')]({},_0xe8bec6,_0x3d43ca[_0x7d6e('0x43')]);var _0x1e3261={'where':_0xe8bec6['where']};return db['FaxQueue'][_0x7d6e('0x20')](_0x1e3261)[_0x7d6e('0x26')](function(_0x43d123){_0x393794[_0x7d6e('0x20')]=_0x43d123;if(_0x3d43ca[_0x7d6e('0x36')][_0x7d6e('0x44')]){_0xe8bec6[_0x7d6e('0x45')]=[{'all':!![]}];}return db[_0x7d6e('0x30')][_0x7d6e('0x46')](_0xe8bec6);})[_0x7d6e('0x26')](function(_0x2e88b6){_0x393794[_0x7d6e('0x47')]=_0x2e88b6;return _0x393794;})['then'](respondWithFilteredResult(_0xb9e009,_0xe8bec6))[_0x7d6e('0x48')](handleError(_0xb9e009,null));};exports[_0x7d6e('0x49')]=function(_0x70495b,_0x141c12){var _0x2b2f70={'raw':!![],'where':{'id':_0x70495b[_0x7d6e('0x4a')]['id']}},_0x2559be={};_0x2559be[_0x7d6e('0x35')]=_['keys'](db[_0x7d6e('0x30')][_0x7d6e('0x31')]);_0x2559be[_0x7d6e('0x36')]=_['keys'](_0x70495b[_0x7d6e('0x36')]);_0x2559be[_0x7d6e('0x3f')]=_[_0x7d6e('0x37')](_0x2559be['model'],_0x2559be[_0x7d6e('0x36')]);_0x2b2f70[_0x7d6e('0x38')]=_['intersection'](_0x2559be['model'],qs[_0x7d6e('0x39')](_0x70495b[_0x7d6e('0x36')][_0x7d6e('0x39')]));_0x2b2f70[_0x7d6e('0x38')]=_0x2b2f70[_0x7d6e('0x38')]['length']?_0x2b2f70[_0x7d6e('0x38')]:_0x2559be['model'];if(_0x70495b[_0x7d6e('0x36')][_0x7d6e('0x44')]){_0x2b2f70[_0x7d6e('0x45')]=[{'all':!![]}];}_0x2b2f70=_['merge']({},_0x2b2f70,_0x70495b[_0x7d6e('0x43')]);return db[_0x7d6e('0x30')][_0x7d6e('0x4b')](_0x2b2f70)[_0x7d6e('0x26')](handleEntityNotFound(_0x141c12,null))[_0x7d6e('0x26')](respondWithResult(_0x141c12,null))[_0x7d6e('0x48')](handleError(_0x141c12,null));};exports['create']=function(_0xe19f21,_0x57b8a0){return db[_0x7d6e('0x30')][_0x7d6e('0x4c')](_0xe19f21['body'],{})[_0x7d6e('0x26')](function(_0x15fd85){var _0x3cd016=_0xe19f21[_0x7d6e('0x4d')][_0x7d6e('0x28')]({'plain':!![]});if(!_0x3cd016)throw new Error(_0x7d6e('0x4e'));if(_0x3cd016[_0x7d6e('0x4f')]===_0x7d6e('0x4d')){var _0x1af4ec=_0x15fd85[_0x7d6e('0x28')]({'plain':!![]});var _0x2d45b4=_0x7d6e('0x29');return db[_0x7d6e('0x50')][_0x7d6e('0x4b')]({'where':{'name':_0x2d45b4,'userProfileId':_0x3cd016[_0x7d6e('0x51')]},'raw':!![]})[_0x7d6e('0x26')](function(_0x18796b){if(_0x18796b&&_0x18796b[_0x7d6e('0x52')]===0x0){return db[_0x7d6e('0x2a')]['create']({'name':_0x1af4ec[_0x7d6e('0x2c')],'resourceId':_0x1af4ec['id'],'type':_0x18796b[_0x7d6e('0x2c')],'sectionId':_0x18796b['id']},{})[_0x7d6e('0x26')](function(){return _0x15fd85;});}else{return _0x15fd85;}})[_0x7d6e('0x48')](function(_0x3367b5){logger[_0x7d6e('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3367b5);throw _0x3367b5;});}return _0x15fd85;})['then'](respondWithResult(_0x57b8a0,0xc9))[_0x7d6e('0x48')](handleError(_0x57b8a0,null));};exports['update']=function(_0x974a65,_0x12285b){if(_0x974a65[_0x7d6e('0x53')]['id']){delete _0x974a65[_0x7d6e('0x53')]['id'];}return db[_0x7d6e('0x30')][_0x7d6e('0x4b')]({'where':{'id':_0x974a65[_0x7d6e('0x4a')]['id']}})[_0x7d6e('0x26')](handleEntityNotFound(_0x12285b,null))[_0x7d6e('0x26')](saveUpdates(_0x974a65['body'],null))[_0x7d6e('0x26')](respondWithResult(_0x12285b,null))['catch'](handleError(_0x12285b,null));};exports[_0x7d6e('0x27')]=function(_0x40eb5b,_0x115247){return db[_0x7d6e('0x30')][_0x7d6e('0x4b')]({'where':{'id':_0x40eb5b['params']['id']}})['then'](handleEntityNotFound(_0x115247,null))[_0x7d6e('0x26')](removeEntity(_0x115247,null))[_0x7d6e('0x48')](handleError(_0x115247,null));};exports['describe']=function(_0x538f2b,_0x2f5422){return db[_0x7d6e('0x30')]['describe']()[_0x7d6e('0x26')](respondWithResult(_0x2f5422,null))[_0x7d6e('0x48')](handleError(_0x2f5422,null));};exports[_0x7d6e('0x54')]=function(_0x5d150a,_0x4aefe1,_0x543b1e){var _0x115f75={'raw':!![],'where':{}},_0x33ae60={},_0xe12619;return db[_0x7d6e('0x30')][_0x7d6e('0x55')]({'where':{'id':_0x5d150a[_0x7d6e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aefe1,null))['then'](function(_0x2c387c){if(_0x2c387c){_0xe12619=_0x2c387c[_0x7d6e('0x28')]({'plain':!![]});_0x33ae60['model']=_[_0x7d6e('0x56')](db[_0x7d6e('0x57')][_0x7d6e('0x31')]);_0x33ae60[_0x7d6e('0x36')]=_[_0x7d6e('0x56')](_0x5d150a[_0x7d6e('0x36')]);_0x33ae60[_0x7d6e('0x3f')]=_[_0x7d6e('0x37')](_0x33ae60[_0x7d6e('0x35')],_0x33ae60[_0x7d6e('0x36')]);_0x115f75['attributes']=_[_0x7d6e('0x37')](_0x33ae60[_0x7d6e('0x35')],qs[_0x7d6e('0x39')](_0x5d150a[_0x7d6e('0x36')][_0x7d6e('0x39')]));_0x115f75['attributes']=_0x115f75[_0x7d6e('0x38')][_0x7d6e('0x3a')]?_0x115f75[_0x7d6e('0x38')]:_0x33ae60[_0x7d6e('0x35')];if(!_0x5d150a[_0x7d6e('0x36')][_0x7d6e('0x3b')]('nolimit')){_0x115f75['limit']=qs[_0x7d6e('0x21')](_0x5d150a[_0x7d6e('0x36')][_0x7d6e('0x21')]);_0x115f75[_0x7d6e('0x1e')]=qs[_0x7d6e('0x1e')](_0x5d150a['query']['offset']);}_0x115f75['order']=qs['sort'](_0x5d150a[_0x7d6e('0x36')]['sort']);_0x115f75[_0x7d6e('0x3e')]=qs[_0x7d6e('0x3f')](_[_0x7d6e('0x58')](_0x5d150a[_0x7d6e('0x36')],_0x33ae60[_0x7d6e('0x3f')]));_0x115f75[_0x7d6e('0x3e')]['FaxQueueId']=_0x2c387c['id'];if(_0x5d150a[_0x7d6e('0x36')][_0x7d6e('0x40')]){_0x115f75[_0x7d6e('0x3e')]=_['merge'](_0x115f75[_0x7d6e('0x3e')],{'$or':_[_0x7d6e('0x2f')](_0x115f75[_0x7d6e('0x38')],function(_0x1c9887){var _0x467137={};_0x467137[_0x1c9887]={'$like':'%'+_0x5d150a['query'][_0x7d6e('0x40')]+'%'};return _0x467137;})});}_0x115f75=_[_0x7d6e('0x42')]({},_0x115f75,_0x5d150a[_0x7d6e('0x43')]);return db[_0x7d6e('0x57')][_0x7d6e('0x46')](_0x115f75);}})[_0x7d6e('0x26')](function(_0x1f873d){if(_0x1f873d){return db[_0x7d6e('0x59')]['findAndCountAll']({'where':{'id':_['map'](_0x1f873d,'UserId'),'role':'agent'},'attributes':['id',_0x7d6e('0x2c'),_0x7d6e('0x5a'),_0x7d6e('0x5b'),_0x7d6e('0x5c')]});}})[_0x7d6e('0x26')](function(_0x2204d9){if(_0x2204d9){return{'count':_0x2204d9[_0x7d6e('0x20')],'rows':_[_0x7d6e('0x2f')](_0x2204d9['rows'],function(_0x5a4e79){return{'membername':_0x5a4e79[_0x7d6e('0x2c')],'UserId':_0x5a4e79['id'],'queue_name':_0xe12619[_0x7d6e('0x2c')],'FaxQueueId':_0xe12619['id'],'interface':util[_0x7d6e('0x5d')]('%s/%s',_0x7d6e('0x5e'),_0x5a4e79['name']),'penalty':0x0,'paused':_0x5a4e79['faxPause'],'createdAt':_0x5a4e79[_0x7d6e('0x5c')],'updatedAt':_0x5a4e79[_0x7d6e('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7d6e('0x26')](respondWithFilteredResult(_0x4aefe1,_0x115f75))[_0x7d6e('0x48')](handleError(_0x4aefe1,null));};exports[_0x7d6e('0x5f')]=function(_0x51cbea,_0x249708,_0x450d86){var _0x21967b={};var _0x3bb6ea={};var _0x20d149;var _0x178a79;return db[_0x7d6e('0x30')][_0x7d6e('0x55')]({'where':{'id':_0x51cbea['params']['id']}})['then'](handleEntityNotFound(_0x249708,null))['then'](function(_0x1ae6c0){if(_0x1ae6c0){_0x20d149=_0x1ae6c0;_0x3bb6ea[_0x7d6e('0x35')]=_[_0x7d6e('0x56')](db[_0x7d6e('0x60')][_0x7d6e('0x31')]);_0x3bb6ea[_0x7d6e('0x36')]=_[_0x7d6e('0x56')](_0x51cbea['query']);_0x3bb6ea['filters']=_[_0x7d6e('0x37')](_0x3bb6ea[_0x7d6e('0x35')],_0x3bb6ea[_0x7d6e('0x36')]);_0x21967b['attributes']=_[_0x7d6e('0x37')](_0x3bb6ea[_0x7d6e('0x35')],qs[_0x7d6e('0x39')](_0x51cbea[_0x7d6e('0x36')][_0x7d6e('0x39')]));_0x21967b[_0x7d6e('0x38')]=_0x21967b[_0x7d6e('0x38')][_0x7d6e('0x3a')]?_0x21967b[_0x7d6e('0x38')]:_0x3bb6ea['model'];_0x21967b[_0x7d6e('0x61')]=qs['sort'](_0x51cbea[_0x7d6e('0x36')][_0x7d6e('0x3d')]);_0x21967b[_0x7d6e('0x3e')]=qs['filters'](_[_0x7d6e('0x58')](_0x51cbea[_0x7d6e('0x36')],_0x3bb6ea[_0x7d6e('0x3f')]));if(_0x51cbea[_0x7d6e('0x36')][_0x7d6e('0x40')]){_0x21967b[_0x7d6e('0x3e')]=_[_0x7d6e('0x42')](_0x21967b[_0x7d6e('0x3e')],{'$or':_['map'](_0x21967b[_0x7d6e('0x38')],function(_0x15e63c){var _0x44d01a={};_0x44d01a[_0x15e63c]={'$like':'%'+_0x51cbea[_0x7d6e('0x36')][_0x7d6e('0x40')]+'%'};return _0x44d01a;})});}_0x21967b=_['merge']({},_0x21967b,_0x51cbea[_0x7d6e('0x43')]);return _0x20d149[_0x7d6e('0x5f')](_0x21967b);}})[_0x7d6e('0x26')](function(_0x44ddae){if(_0x44ddae){_0x178a79=_0x44ddae[_0x7d6e('0x3a')];if(!_0x51cbea[_0x7d6e('0x36')][_0x7d6e('0x3b')](_0x7d6e('0x3c'))){_0x21967b[_0x7d6e('0x21')]=qs[_0x7d6e('0x21')](_0x51cbea[_0x7d6e('0x36')][_0x7d6e('0x21')]);_0x21967b[_0x7d6e('0x1e')]=qs[_0x7d6e('0x1e')](_0x51cbea[_0x7d6e('0x36')][_0x7d6e('0x1e')]);}return _0x20d149['getTeams'](_0x21967b);}})['then'](function(_0x33f9ee){if(_0x33f9ee){return _0x33f9ee?{'count':_0x178a79,'rows':_0x33f9ee}:null;}})[_0x7d6e('0x26')](respondWithResult(_0x249708,null))['catch'](handleError(_0x249708,null));};exports[_0x7d6e('0x62')]=function(_0x4e1547,_0x5da490,_0xf520cf){var _0x15a1b3=_0x4e1547[_0x7d6e('0x53')][_0x7d6e('0x63')];return db[_0x7d6e('0x60')][_0x7d6e('0x46')]({'where':{'id':_0x15a1b3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d6e('0x64'),'attributes':['id',_0x7d6e('0x2c'),_0x7d6e('0x65'),_0x7d6e('0x66'),'interface'],'raw':!![]}]})['then'](function(_0x54a398){if(_0x54a398){var _0x2bcd69=_[_0x7d6e('0x67')](_0x54a398,function(_0x5ecaaf){var _0x2f27ef=_0x5ecaaf[_0x7d6e('0x28')]({'plain':!![]});return _0x2f27ef[_0x7d6e('0x64')];});return db[_0x7d6e('0x30')]['find']({'where':{'id':_0x4e1547[_0x7d6e('0x4a')]['id']}})[_0x7d6e('0x26')](function(_0x5b987e){return db['sequelize'][_0x7d6e('0x68')](function(_0x2463f0){return _0x5b987e[_0x7d6e('0x62')](_0x15a1b3,{'transaction':_0x2463f0})[_0x7d6e('0x26')](function(){return BPromise[_0x7d6e('0x69')](_0x2bcd69,function(_0x51030b){return db[_0x7d6e('0x57')]['findOrCreate']({'where':{'UserId':_0x51030b['id'],'FaxQueueId':_0x4e1547[_0x7d6e('0x4a')]['id']},'transaction':_0x2463f0});});})[_0x7d6e('0x26')](function(){_0x2bcd69[_0x7d6e('0x6a')](function(_0x2380ce){socket[_0x7d6e('0x6b')](_0x7d6e('0x6c'),{'UserId':_0x2380ce['id'],'FaxQueueId':_0x5b987e['id']});});});});});}})[_0x7d6e('0x26')](respondWithStatusCode(_0x5da490,null))[_0x7d6e('0x48')](handleError(_0x5da490,null));};exports['removeTeams']=function(_0x179c0a,_0x2a056e,_0x1ad5b6){return db[_0x7d6e('0x60')][_0x7d6e('0x46')]({'where':{'id':_0x179c0a[_0x7d6e('0x36')][_0x7d6e('0x63')]},'attributes':['id'],'include':[{'model':db[_0x7d6e('0x59')],'as':_0x7d6e('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a056e,null))['then'](function(_0x276e12){var _0x3cc6d9=_['map'](_0x276e12,'id');var _0x1589c2=[];var _0x6f6879=[];var _0x9fe13c=squel[_0x7d6e('0x6d')]();_0x9fe13c[_0x7d6e('0x6e')]('tq.TeamId')[_0x7d6e('0x6f')]('team_has_fax_queues','tq')[_0x7d6e('0x70')]('user_has_teams','ut',_0x7d6e('0x71'))[_0x7d6e('0x3e')](_0x7d6e('0x72'),_0x179c0a['params']['id']);for(var _0x496d92=0x0;_0x496d92<_0x276e12['length'];_0x496d92+=0x1){let _0x14883a=_0x276e12[_0x496d92];for(var _0x3fbfc5=0x0;_0x3fbfc5<_0x14883a['Agents'][_0x7d6e('0x3a')];_0x3fbfc5+=0x1){let _0x2d8316=_0x14883a[_0x7d6e('0x64')][_0x3fbfc5];var _0x235d1a=_0x9fe13c[_0x7d6e('0x73')]();_0x235d1a[_0x7d6e('0x3e')]('ut.UserId\x20=\x20?',_0x2d8316['id']);_0x6f6879[_0x7d6e('0x74')](db['sequelize'][_0x7d6e('0x36')](_0x235d1a['toString'](),{'type':db[_0x7d6e('0x75')][_0x7d6e('0x76')]['SELECT']})['then'](function(_0x34c8d0){if(_0x34c8d0[_0x7d6e('0x3a')]===0x1){return _0x2d8316['id'];}else{var _0x9c274e=_[_0x7d6e('0x77')](_[_0x7d6e('0x2f')](_0x34c8d0,_0x7d6e('0x78')),function(_0x2ebe5b){return _[_0x7d6e('0x79')](_0x3cc6d9,_0x2ebe5b);});if(_0x9c274e){return _0x2d8316['id'];}}}));}}return BPromise[_0x7d6e('0x7a')](_0x6f6879)[_0x7d6e('0x26')](function(_0x377d5d){_0x1589c2=_(_0x1589c2)[_0x7d6e('0x7b')](_0x377d5d)[_0x7d6e('0x7c')]()[_0x7d6e('0x7d')]();return db[_0x7d6e('0x30')]['find']({'where':{'id':_0x179c0a[_0x7d6e('0x4a')]['id']}})[_0x7d6e('0x26')](function(_0x4a173a){return db[_0x7d6e('0x75')]['transaction'](function(_0xb596d){return _0x4a173a[_0x7d6e('0x7e')](_0x179c0a[_0x7d6e('0x36')][_0x7d6e('0x63')],{'transaction':_0xb596d})[_0x7d6e('0x26')](function(){if(!_[_0x7d6e('0x7f')](_0x1589c2)){return _0x4a173a['removeAgents'](_0x1589c2,{'transaction':_0xb596d});}})[_0x7d6e('0x26')](function(){_0x1589c2[_0x7d6e('0x6a')](function(_0x5b293d){socket['emit'](_0x7d6e('0x80'),{'UserId':_0x5b293d,'FaxQueueId':_0x4a173a['id']});});});});});});})['then'](respondWithStatusCode(_0x2a056e,null))[_0x7d6e('0x48')](handleError(_0x2a056e,null));};exports[_0x7d6e('0x81')]=function(_0x6d9f37,_0x8ccd13,_0x1acf3f){return db[_0x7d6e('0x30')][_0x7d6e('0x4b')]({'where':{'id':_0x6d9f37[_0x7d6e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x8ccd13,null))[_0x7d6e('0x26')](function(_0x3d60eb){if(_0x3d60eb){return _0x3d60eb[_0x7d6e('0x81')](_0x6d9f37[_0x7d6e('0x53')]['ids'],_['omit'](_0x6d9f37[_0x7d6e('0x53')],[_0x7d6e('0x63'),'id'])||{})['spread'](function(_0x50caa1){for(var _0x3be892=0x0;_0x3be892<_0x6d9f37[_0x7d6e('0x53')][_0x7d6e('0x63')][_0x7d6e('0x3a')];_0x3be892+=0x1){socket[_0x7d6e('0x6b')](_0x7d6e('0x6c'),{'UserId':Number(_0x6d9f37['body'][_0x7d6e('0x63')][_0x3be892]),'FaxQueueId':Number(_0x6d9f37[_0x7d6e('0x4a')]['id'])});}return _0x50caa1;});}})[_0x7d6e('0x26')](respondWithResult(_0x8ccd13,null))[_0x7d6e('0x48')](handleError(_0x8ccd13,null));};exports[_0x7d6e('0x82')]=function(_0x9d5f62,_0x349621,_0x2abaad){return db[_0x7d6e('0x30')]['find']({'where':{'id':_0x9d5f62['params']['id']}})['then'](handleEntityNotFound(_0x349621,null))[_0x7d6e('0x26')](function(_0xf43d23){if(_0xf43d23){return _0xf43d23['removeAgents'](_0x9d5f62[_0x7d6e('0x36')][_0x7d6e('0x63')])[_0x7d6e('0x26')](function(){if(_[_0x7d6e('0x83')](_0x9d5f62['query'][_0x7d6e('0x63')])){for(var _0x1812c9=0x0;_0x1812c9<_0x9d5f62['query']['ids'][_0x7d6e('0x3a')];_0x1812c9+=0x1){socket[_0x7d6e('0x6b')](_0x7d6e('0x80'),{'UserId':Number(_0x9d5f62[_0x7d6e('0x36')]['ids'][_0x1812c9]),'FaxQueueId':Number(_0x9d5f62[_0x7d6e('0x4a')]['id'])});}}else{socket['emit'](_0x7d6e('0x80'),{'UserId':Number(_0x9d5f62[_0x7d6e('0x36')]['ids']),'FaxQueueId':Number(_0x9d5f62[_0x7d6e('0x4a')]['id'])});}});}})[_0x7d6e('0x26')](respondWithStatusCode(_0x349621,null))[_0x7d6e('0x48')](handleError(_0x349621,null));};exports[_0x7d6e('0x84')]=function(_0x2b4d16,_0x35186c,_0x1c921e){var _0x298adf={};var _0x7a3323={};var _0x172138;var _0x38f78e;return db[_0x7d6e('0x30')][_0x7d6e('0x55')]({'where':{'id':_0x2b4d16[_0x7d6e('0x4a')]['id']}})[_0x7d6e('0x26')](handleEntityNotFound(_0x35186c,null))[_0x7d6e('0x26')](function(_0x3437f6){if(_0x3437f6){_0x172138=_0x3437f6;_0x7a3323[_0x7d6e('0x35')]=_[_0x7d6e('0x56')](db[_0x7d6e('0x59')][_0x7d6e('0x31')]);_0x7a3323[_0x7d6e('0x36')]=_[_0x7d6e('0x56')](_0x2b4d16[_0x7d6e('0x36')]);_0x7a3323['filters']=_[_0x7d6e('0x37')](_0x7a3323[_0x7d6e('0x35')],_0x7a3323['query']);_0x298adf[_0x7d6e('0x38')]=_['intersection'](_0x7a3323[_0x7d6e('0x35')],qs['fields'](_0x2b4d16[_0x7d6e('0x36')][_0x7d6e('0x39')]));_0x298adf[_0x7d6e('0x38')]=_0x298adf[_0x7d6e('0x38')][_0x7d6e('0x3a')]?_0x298adf['attributes']:_0x7a3323['model'];_0x298adf['order']=qs[_0x7d6e('0x3d')](_0x2b4d16[_0x7d6e('0x36')]['sort']);_0x298adf['where']=qs['filters'](_[_0x7d6e('0x58')](_0x2b4d16[_0x7d6e('0x36')],_0x7a3323[_0x7d6e('0x3f')]));if(_0x2b4d16[_0x7d6e('0x36')]['filter']){_0x298adf[_0x7d6e('0x3e')]=_[_0x7d6e('0x42')](_0x298adf[_0x7d6e('0x3e')],{'$or':_['map'](_0x298adf[_0x7d6e('0x38')],function(_0x21600d){var _0x36a2fe={};_0x36a2fe[_0x21600d]={'$like':'%'+_0x2b4d16[_0x7d6e('0x36')][_0x7d6e('0x40')]+'%'};return _0x36a2fe;})});}_0x298adf=_[_0x7d6e('0x42')]({},_0x298adf,_0x2b4d16[_0x7d6e('0x43')]);return _0x172138[_0x7d6e('0x84')](_0x298adf);}})[_0x7d6e('0x26')](function(_0x3cdab8){if(_0x3cdab8){_0x38f78e=_0x3cdab8[_0x7d6e('0x3a')];if(!_0x2b4d16['query']['hasOwnProperty'](_0x7d6e('0x3c'))){_0x298adf[_0x7d6e('0x21')]=qs[_0x7d6e('0x21')](_0x2b4d16[_0x7d6e('0x36')][_0x7d6e('0x21')]);_0x298adf[_0x7d6e('0x1e')]=qs[_0x7d6e('0x1e')](_0x2b4d16[_0x7d6e('0x36')][_0x7d6e('0x1e')]);}return _0x172138[_0x7d6e('0x84')](_0x298adf);}})['then'](function(_0x53d426){if(_0x53d426){return _0x53d426?{'count':_0x38f78e,'rows':_0x53d426}:null;}})[_0x7d6e('0x26')](respondWithResult(_0x35186c,null))[_0x7d6e('0x48')](handleError(_0x35186c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index cd391af..62ba20f 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 _0xe99a=['FaxQueue','setMaxListeners','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0xe99a,0x1e4));var _0xae99=function(_0x52f3ac,_0x54b711){_0x52f3ac=_0x52f3ac-0x0;var _0x7d365d=_0xe99a[_0x52f3ac];return _0x7d365d;};'use strict';var EventEmitter=require(_0xae99('0x0'));var FaxQueue=require(_0xae99('0x1'))['db'][_0xae99('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xae99('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae99('0x4'),'afterDestroy':_0xae99('0x5')};function emitEvent(_0x45b501){return function(_0x486c51,_0x2ea001,_0x3b9998){FaxQueueEvents['emit'](_0x45b501+':'+_0x486c51['id'],_0x486c51);FaxQueueEvents['emit'](_0x45b501,_0x486c51);_0x3b9998(null);};}for(var e in events){if(events[_0xae99('0x6')](e)){var event=events[e];FaxQueue[_0xae99('0x7')](e,emitEvent(event));}}module[_0xae99('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x3a24=['exports','events','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x202394,_0x14f2d4){var _0x51939f=function(_0x55f3c0){while(--_0x55f3c0){_0x202394['push'](_0x202394['shift']());}};_0x51939f(++_0x14f2d4);}(_0x3a24,0x13c));var _0x43a2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x3a24[_0x556927];return _0x5f1235;};'use strict';var EventEmitter=require(_0x43a2('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x43a2('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x43a2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x43a2('0x3'),'afterDestroy':_0x43a2('0x4')};function emitEvent(_0x322fc3){return function(_0x2c52d2,_0x1e7255,_0x331353){FaxQueueEvents['emit'](_0x322fc3+':'+_0x2c52d2['id'],_0x2c52d2);FaxQueueEvents[_0x43a2('0x5')](_0x322fc3,_0x2c52d2);_0x331353(null);};}for(var e in events){if(events[_0x43a2('0x6')](e)){var event=events[e];FaxQueue[_0x43a2('0x7')](e,emitEvent(event));}}module[_0x43a2('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 b97f871..cef1df6 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 _0x34ae=['api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger'];(function(_0x3ff835,_0x438eed){var _0xf222e5=function(_0x1a23a0){while(--_0x1a23a0){_0x3ff835['push'](_0x3ff835['shift']());}};_0xf222e5(++_0x438eed);}(_0x34ae,0x1c4));var _0xe34a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34ae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe34a('0x0'));var util=require(_0xe34a('0x1'));var logger=require(_0xe34a('0x2'))(_0xe34a('0x3'));var moment=require(_0xe34a('0x4'));var BPromise=require(_0xe34a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe34a('0x6'));var rimraf=require(_0xe34a('0x7'));var config=require(_0xe34a('0x8'));var attributes=require(_0xe34a('0x9'));module[_0xe34a('0xa')]=function(_0x22dccd,_0x503584){return _0x22dccd['define'](_0xe34a('0xb'),attributes,{'tableName':_0xe34a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86af=['path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','lodash','api','moment','bluebird'];(function(_0x3e5db6,_0x3088a2){var _0x20a7d3=function(_0x206923){while(--_0x206923){_0x3e5db6['push'](_0x3e5db6['shift']());}};_0x20a7d3(++_0x3088a2);}(_0x86af,0xf6));var _0xf86a=function(_0x11026e,_0x164422){_0x11026e=_0x11026e-0x0;var _0x334d99=_0x86af[_0x11026e];return _0x334d99;};'use strict';var _=require(_0xf86a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf86a('0x1'));var moment=require(_0xf86a('0x2'));var BPromise=require(_0xf86a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf86a('0x4'));var rimraf=require(_0xf86a('0x5'));var config=require(_0xf86a('0x6'));var attributes=require(_0xf86a('0x7'));module['exports']=function(_0x1ae982,_0x101a4c){return _0x1ae982[_0xf86a('0x8')](_0xf86a('0x9'),attributes,{'tableName':'fax_queues','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 10c2205..0787439 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 _0x3c4c=['http','redis','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','attributes','limit','include','model','map','then','GetFaxQueue','ShowFaxQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11f56c,_0x568501){var _0x928104=function(_0x3d5a9d){while(--_0x3d5a9d){_0x11f56c['push'](_0x11f56c['shift']());}};_0x928104(++_0x568501);}(_0x3c4c,0x6c));var _0xc3c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3c4c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc3c4('0x0'));var util=require(_0xc3c4('0x1'));var moment=require(_0xc3c4('0x2'));var BPromise=require(_0xc3c4('0x3'));var rs=require(_0xc3c4('0x4'));var fs=require('fs');var Redis=require(_0xc3c4('0x5'));var db=require(_0xc3c4('0x6'))['db'];var utils=require(_0xc3c4('0x7'));var logger=require(_0xc3c4('0x8'))(_0xc3c4('0x9'));var config=require(_0xc3c4('0xa'));var jayson=require(_0xc3c4('0xb'));var client=jayson['client'][_0xc3c4('0xc')]({'port':0x232a});config[_0xc3c4('0xd')]=_['defaults'](config[_0xc3c4('0xd')],{'host':_0xc3c4('0xe'),'port':0x18eb});var socket=require(_0xc3c4('0xf'))(new Redis(config[_0xc3c4('0xd')]));require('./faxQueue.socket')[_0xc3c4('0x10')](socket);function respondWithRpcPromise(_0x47c505,_0x2ea001,_0x8dfe8c){return new BPromise(function(_0x457f8e,_0x3d4448){return client[_0xc3c4('0x11')](_0x47c505,_0x8dfe8c)['then'](function(_0xe73e38){logger[_0xc3c4('0x12')](_0xc3c4('0x13'),_0x2ea001,_0xc3c4('0x14'));logger[_0xc3c4('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2ea001,_0xc3c4('0x14'),JSON[_0xc3c4('0x16')](_0xe73e38));if(_0xe73e38[_0xc3c4('0x17')]){if(_0xe73e38[_0xc3c4('0x17')][_0xc3c4('0x18')]===0x1f4){logger[_0xc3c4('0x17')]('FaxQueue,\x20%s,\x20%s',_0x2ea001,_0xe73e38['error']['message']);return _0x3d4448(_0xe73e38[_0xc3c4('0x17')][_0xc3c4('0x19')]);}logger[_0xc3c4('0x17')]('FaxQueue,\x20%s,\x20%s',_0x2ea001,_0xe73e38[_0xc3c4('0x17')][_0xc3c4('0x19')]);return _0x457f8e(_0xe73e38['error'][_0xc3c4('0x19')]);}else{logger[_0xc3c4('0x12')]('FaxQueue,\x20%s,\x20%s',_0x2ea001,_0xc3c4('0x14'));_0x457f8e(_0xe73e38[_0xc3c4('0x1a')][_0xc3c4('0x19')]);}})[_0xc3c4('0x1b')](function(_0x243840){logger[_0xc3c4('0x17')](_0xc3c4('0x13'),_0x2ea001,_0x243840);_0x3d4448(_0x243840);});});}exports['GetFaxQueue']=function(_0x7bc501){var _0x579485=this;return new Promise(function(_0x323081,_0x2453d7){return db['FaxQueue']['findAll']({'raw':_0x7bc501['options']?_0x7bc501[_0xc3c4('0x1c')][_0xc3c4('0x1d')]===undefined?!![]:![]:!![],'where':_0x7bc501[_0xc3c4('0x1c')]?_0x7bc501[_0xc3c4('0x1c')]['where']||null:null,'attributes':_0x7bc501[_0xc3c4('0x1c')]?_0x7bc501[_0xc3c4('0x1c')][_0xc3c4('0x1e')]||null:null,'limit':_0x7bc501[_0xc3c4('0x1c')]?_0x7bc501[_0xc3c4('0x1c')][_0xc3c4('0x1f')]||null:null,'include':_0x7bc501['options']?_0x7bc501[_0xc3c4('0x1c')][_0xc3c4('0x20')]?_['map'](_0x7bc501[_0xc3c4('0x1c')]['include'],function(_0x5bca5c){return{'model':db[_0x5bca5c[_0xc3c4('0x21')]],'as':_0x5bca5c['as'],'attributes':_0x5bca5c[_0xc3c4('0x1e')],'include':_0x5bca5c[_0xc3c4('0x20')]?_[_0xc3c4('0x22')](_0x5bca5c[_0xc3c4('0x20')],function(_0x10e132){return{'model':db[_0x10e132[_0xc3c4('0x21')]],'as':_0x10e132['as'],'attributes':_0x10e132[_0xc3c4('0x1e')],'include':_0x10e132['include']?_[_0xc3c4('0x22')](_0x10e132[_0xc3c4('0x20')],function(_0x2e360f){return{'model':db[_0x2e360f[_0xc3c4('0x21')]],'as':_0x2e360f['as'],'attributes':_0x2e360f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3c4('0x23')](function(_0x120fb3){logger['info'](_0xc3c4('0x24'),_0x7bc501);logger[_0xc3c4('0x15')](_0xc3c4('0x24'),_0x7bc501,JSON[_0xc3c4('0x16')](_0x120fb3));_0x323081(_0x120fb3);})['catch'](function(_0x4d3ed0){logger['error'](_0xc3c4('0x24'),_0x4d3ed0[_0xc3c4('0x19')],_0x7bc501);_0x2453d7(_0x579485[_0xc3c4('0x17')](0x1f4,_0x4d3ed0[_0xc3c4('0x19')]));});});};exports[_0xc3c4('0x25')]=function(_0x23373c){var _0x1dd553=this;return new Promise(function(_0x3f78c4,_0x284d1b){return db['FaxQueue'][_0xc3c4('0x26')]({'raw':_0x23373c[_0xc3c4('0x1c')]?_0x23373c[_0xc3c4('0x1c')][_0xc3c4('0x1d')]===undefined?!![]:![]:!![],'where':_0x23373c[_0xc3c4('0x1c')]?_0x23373c[_0xc3c4('0x1c')][_0xc3c4('0x27')]||null:null,'attributes':_0x23373c[_0xc3c4('0x1c')]?_0x23373c['options'][_0xc3c4('0x1e')]||null:null,'include':_0x23373c[_0xc3c4('0x1c')]?_0x23373c['options'][_0xc3c4('0x20')]?_[_0xc3c4('0x22')](_0x23373c['options'][_0xc3c4('0x20')],function(_0x2bf984){return{'model':db[_0x2bf984[_0xc3c4('0x21')]],'as':_0x2bf984['as'],'attributes':_0x2bf984[_0xc3c4('0x1e')],'include':_0x2bf984[_0xc3c4('0x20')]?_[_0xc3c4('0x22')](_0x2bf984[_0xc3c4('0x20')],function(_0x4a6370){return{'model':db[_0x4a6370[_0xc3c4('0x21')]],'as':_0x4a6370['as'],'attributes':_0x4a6370[_0xc3c4('0x1e')],'include':_0x4a6370[_0xc3c4('0x20')]?_['map'](_0x4a6370[_0xc3c4('0x20')],function(_0x11a9de){return{'model':db[_0x11a9de[_0xc3c4('0x21')]],'as':_0x11a9de['as'],'attributes':_0x11a9de[_0xc3c4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc3c4('0x23')](function(_0xf8ae43){logger['info'](_0xc3c4('0x25'),_0x23373c);logger[_0xc3c4('0x15')](_0xc3c4('0x25'),_0x23373c,JSON[_0xc3c4('0x16')](_0xf8ae43));_0x3f78c4(_0xf8ae43);})[_0xc3c4('0x1b')](function(_0x558314){logger['error']('ShowFaxQueue',_0x558314[_0xc3c4('0x19')],_0x23373c);_0x284d1b(_0x1dd553[_0xc3c4('0x17')](0x1f4,_0x558314[_0xc3c4('0x19')]));});});}; \ No newline at end of file +var _0x99f9=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','options','raw','where','attributes','limit','map','include','model','GetFaxQueue','catch','ShowFaxQueue','FaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x99f9,0xbd));var _0x999f=function(_0x258d19,_0x578509){_0x258d19=_0x258d19-0x0;var _0x5aa9b7=_0x99f9[_0x258d19];return _0x5aa9b7;};'use strict';var _=require(_0x999f('0x0'));var util=require(_0x999f('0x1'));var moment=require(_0x999f('0x2'));var BPromise=require(_0x999f('0x3'));var rs=require(_0x999f('0x4'));var fs=require('fs');var Redis=require(_0x999f('0x5'));var db=require(_0x999f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x999f('0x7'));var jayson=require(_0x999f('0x8'));var client=jayson[_0x999f('0x9')][_0x999f('0xa')]({'port':0x232a});config[_0x999f('0xb')]=_[_0x999f('0xc')](config[_0x999f('0xb')],{'host':_0x999f('0xd'),'port':0x18eb});var socket=require(_0x999f('0xe'))(new Redis(config[_0x999f('0xb')]));require(_0x999f('0xf'))[_0x999f('0x10')](socket);function respondWithRpcPromise(_0x129ee3,_0x29fc79,_0x1f7698){return new BPromise(function(_0x3474fd,_0x1ea2ea){return client[_0x999f('0x11')](_0x129ee3,_0x1f7698)[_0x999f('0x12')](function(_0x49c004){logger[_0x999f('0x13')](_0x999f('0x14'),_0x29fc79,'request\x20sent');logger[_0x999f('0x15')](_0x999f('0x16'),_0x29fc79,'request\x20sent',JSON[_0x999f('0x17')](_0x49c004));if(_0x49c004[_0x999f('0x18')]){if(_0x49c004[_0x999f('0x18')][_0x999f('0x19')]===0x1f4){logger['error'](_0x999f('0x14'),_0x29fc79,_0x49c004['error'][_0x999f('0x1a')]);return _0x1ea2ea(_0x49c004[_0x999f('0x18')][_0x999f('0x1a')]);}logger[_0x999f('0x18')]('FaxQueue,\x20%s,\x20%s',_0x29fc79,_0x49c004[_0x999f('0x18')]['message']);return _0x3474fd(_0x49c004[_0x999f('0x18')][_0x999f('0x1a')]);}else{logger[_0x999f('0x13')](_0x999f('0x14'),_0x29fc79,_0x999f('0x1b'));_0x3474fd(_0x49c004[_0x999f('0x1c')]['message']);}})['catch'](function(_0x218daa){logger[_0x999f('0x18')](_0x999f('0x14'),_0x29fc79,_0x218daa);_0x1ea2ea(_0x218daa);});});}exports['GetFaxQueue']=function(_0x1b771a){var _0x52b0e5=this;return new Promise(function(_0x225678,_0x151ae7){return db['FaxQueue']['findAll']({'raw':_0x1b771a[_0x999f('0x1d')]?_0x1b771a[_0x999f('0x1d')][_0x999f('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b771a['options']?_0x1b771a[_0x999f('0x1d')][_0x999f('0x1f')]||null:null,'attributes':_0x1b771a['options']?_0x1b771a[_0x999f('0x1d')][_0x999f('0x20')]||null:null,'limit':_0x1b771a[_0x999f('0x1d')]?_0x1b771a[_0x999f('0x1d')][_0x999f('0x21')]||null:null,'include':_0x1b771a['options']?_0x1b771a[_0x999f('0x1d')]['include']?_[_0x999f('0x22')](_0x1b771a[_0x999f('0x1d')][_0x999f('0x23')],function(_0x47088a){return{'model':db[_0x47088a[_0x999f('0x24')]],'as':_0x47088a['as'],'attributes':_0x47088a[_0x999f('0x20')],'include':_0x47088a[_0x999f('0x23')]?_[_0x999f('0x22')](_0x47088a[_0x999f('0x23')],function(_0x3dbfc9){return{'model':db[_0x3dbfc9[_0x999f('0x24')]],'as':_0x3dbfc9['as'],'attributes':_0x3dbfc9[_0x999f('0x20')],'include':_0x3dbfc9[_0x999f('0x23')]?_[_0x999f('0x22')](_0x3dbfc9['include'],function(_0x1ae218){return{'model':db[_0x1ae218['model']],'as':_0x1ae218['as'],'attributes':_0x1ae218[_0x999f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x999f('0x12')](function(_0x55fc91){logger[_0x999f('0x13')](_0x999f('0x25'),_0x1b771a);logger['debug'](_0x999f('0x25'),_0x1b771a,JSON['stringify'](_0x55fc91));_0x225678(_0x55fc91);})[_0x999f('0x26')](function(_0x5b2906){logger[_0x999f('0x18')](_0x999f('0x25'),_0x5b2906[_0x999f('0x1a')],_0x1b771a);_0x151ae7(_0x52b0e5[_0x999f('0x18')](0x1f4,_0x5b2906[_0x999f('0x1a')]));});});};exports[_0x999f('0x27')]=function(_0xb9cf9f){var _0x211c49=this;return new Promise(function(_0x366645,_0x3b1200){return db[_0x999f('0x28')][_0x999f('0x29')]({'raw':_0xb9cf9f[_0x999f('0x1d')]?_0xb9cf9f['options'][_0x999f('0x1e')]===undefined?!![]:![]:!![],'where':_0xb9cf9f['options']?_0xb9cf9f['options'][_0x999f('0x1f')]||null:null,'attributes':_0xb9cf9f[_0x999f('0x1d')]?_0xb9cf9f['options'][_0x999f('0x20')]||null:null,'include':_0xb9cf9f[_0x999f('0x1d')]?_0xb9cf9f[_0x999f('0x1d')][_0x999f('0x23')]?_[_0x999f('0x22')](_0xb9cf9f[_0x999f('0x1d')][_0x999f('0x23')],function(_0x3113e1){return{'model':db[_0x3113e1[_0x999f('0x24')]],'as':_0x3113e1['as'],'attributes':_0x3113e1['attributes'],'include':_0x3113e1['include']?_[_0x999f('0x22')](_0x3113e1['include'],function(_0x2aa44d){return{'model':db[_0x2aa44d[_0x999f('0x24')]],'as':_0x2aa44d['as'],'attributes':_0x2aa44d['attributes'],'include':_0x2aa44d['include']?_['map'](_0x2aa44d[_0x999f('0x23')],function(_0x1cd021){return{'model':db[_0x1cd021[_0x999f('0x24')]],'as':_0x1cd021['as'],'attributes':_0x1cd021[_0x999f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x999f('0x12')](function(_0x5dc34a){logger[_0x999f('0x13')](_0x999f('0x27'),_0xb9cf9f);logger[_0x999f('0x15')](_0x999f('0x27'),_0xb9cf9f,JSON[_0x999f('0x17')](_0x5dc34a));_0x366645(_0x5dc34a);})[_0x999f('0x26')](function(_0x391e39){logger['error']('ShowFaxQueue',_0x391e39[_0x999f('0x1a')],_0xb9cf9f);_0x3b1200(_0x211c49[_0x999f('0x18')](0x1f4,_0x391e39[_0x999f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e190d42..158e974 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 _0x3792=['emit','removeListener','register','length','faxQueue:','remove','update'];(function(_0x123708,_0x656a8d){var _0x854b84=function(_0x25809d){while(--_0x25809d){_0x123708['push'](_0x123708['shift']());}};_0x854b84(++_0x656a8d);}(_0x3792,0x9f));var _0x2379=function(_0x554088,_0x523393){_0x554088=_0x554088-0x0;var _0x52e5f3=_0x3792[_0x554088];return _0x52e5f3;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x2379('0x0'),_0x2379('0x1')];function createListener(_0x8a3114,_0x35b929){return function(_0x33f2b0){_0x35b929[_0x2379('0x2')](_0x8a3114,_0x33f2b0);};}function removeListener(_0x37d0db,_0x1ab342){return function(){FaxQueueEvents[_0x2379('0x3')](_0x37d0db,_0x1ab342);};}exports[_0x2379('0x4')]=function(_0x46f846){for(var _0x1c600c=0x0,_0x112ce8=events[_0x2379('0x5')];_0x1c600c<_0x112ce8;_0x1c600c++){var _0x161ec0=events[_0x1c600c];var _0x8d08f5=createListener(_0x2379('0x6')+_0x161ec0,_0x46f846);FaxQueueEvents['on'](_0x161ec0,_0x8d08f5);}}; \ No newline at end of file +var _0x979e=['update','emit','register','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x979e,0x195));var _0xe979=function(_0x210d3c,_0x30b484){_0x210d3c=_0x210d3c-0x0;var _0x1a16b3=_0x979e[_0x210d3c];return _0x1a16b3;};'use strict';var FaxQueueEvents=require(_0xe979('0x0'));var events=[_0xe979('0x1'),_0xe979('0x2'),_0xe979('0x3')];function createListener(_0x5ce889,_0x10fb90){return function(_0x47321a){_0x10fb90[_0xe979('0x4')](_0x5ce889,_0x47321a);};}function removeListener(_0x3b4b06,_0x2d62dd){return function(){FaxQueueEvents['removeListener'](_0x3b4b06,_0x2d62dd);};}exports[_0xe979('0x5')]=function(_0x580e20){for(var _0x1a0d35=0x0,_0x13a9ee=events[_0xe979('0x6')];_0x1a0d35<_0x13a9ee;_0x1a0d35++){var _0xc63524=events[_0x1a0d35];var _0xc79c06=createListener(_0xe979('0x7')+_0xc63524,_0x580e20);FaxQueueEvents['on'](_0xc63524,_0xc79c06);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index fa96c27..2fa1e54 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 _0xdfa0=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xdfa0,0x69));var _0x0dfa=function(_0x52fca4,_0x1f6ca8){_0x52fca4=_0x52fca4-0x0;var _0x2829f1=_0xdfa0[_0x52fca4];return _0x2829f1;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var fs_extra=require(_0x0dfa('0x4'));var auth=require(_0x0dfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dfa('0x6'));var controller=require('./faxQueue.controller');router[_0x0dfa('0x7')]('/',auth[_0x0dfa('0x8')](),controller['index']);router[_0x0dfa('0x7')](_0x0dfa('0x9'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0x7')]('/:id',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xb')]);router[_0x0dfa('0x7')]('/:id/members',auth[_0x0dfa('0x8')](),controller['getMembers']);router[_0x0dfa('0x7')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller['getTeams']);router[_0x0dfa('0x7')](_0x0dfa('0xd'),auth['isAuthenticated'](),controller[_0x0dfa('0xe')]);router[_0x0dfa('0xf')]('/',auth['isAuthenticated'](),controller[_0x0dfa('0x10')]);router[_0x0dfa('0xf')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x11')]);router[_0x0dfa('0xf')]('/:id/users',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x12')]);router[_0x0dfa('0x13')](_0x0dfa('0x14'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x15')]);router[_0x0dfa('0x16')](_0x0dfa('0x14'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x17')]);router[_0x0dfa('0x16')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x18')]);router[_0x0dfa('0x16')]('/:id/users',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x19')]);module[_0x0dfa('0x1a')]=router; \ No newline at end of file +var _0xa46e=['post','addTeams','addAgents','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xa46e,0x8a));var _0xea46=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xa46e[_0x5d9867];return _0x7d2118;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./faxQueue.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/describe',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['show']);router['get']('/:id/members',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['get'](_0xea46('0xd'),auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router['get'](_0xea46('0xf'),auth[_0xea46('0x9')](),controller['getAgents']);router[_0xea46('0x10')]('/',auth[_0xea46('0x9')](),controller['create']);router[_0xea46('0x10')]('/:id/teams',auth[_0xea46('0x9')](),controller[_0xea46('0x11')]);router[_0xea46('0x10')](_0xea46('0xf'),auth[_0xea46('0x9')](),controller[_0xea46('0x12')]);router[_0xea46('0x13')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['update']);router[_0xea46('0x14')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['destroy']);router['delete'](_0xea46('0xd'),auth[_0xea46('0x9')](),controller['removeTeams']);router['delete'](_0xea46('0xf'),auth[_0xea46('0x9')](),controller['removeAgents']);module[_0xea46('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index bc89c29..9a01fa7 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 _0x9493=['DATE','moment','sequelize','STRING'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x9493,0x159));var _0x3949=function(_0x35e4de,_0x1c063a){_0x35e4de=_0x35e4de-0x0;var _0x428278=_0x9493[_0x35e4de];return _0x428278;};'use strict';var moment=require(_0x3949('0x0'));var Sequelize=require(_0x3949('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3949('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3949('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3949('0x3')]},'acceptAt':{'type':Sequelize[_0x3949('0x3')]},'exitAt':{'type':Sequelize[_0x3949('0x3')]},'reason':{'type':Sequelize[_0x3949('0x2')]}}; \ No newline at end of file +var _0x4605=['DATE','sequelize','exports','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4605,0xb5));var _0x5460=function(_0x2aa91d,_0x1b4ef5){_0x2aa91d=_0x2aa91d-0x0;var _0x204079=_0x4605[_0x2aa91d];return _0x204079;};'use strict';var moment=require('moment');var Sequelize=require(_0x5460('0x0'));module[_0x5460('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5460('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5460('0x3')]},'acceptAt':{'type':Sequelize[_0x5460('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index dda3f0f..755b296 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 _0x207d=['destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x3255fd,_0x40b9e0){var _0x4bdc99=function(_0x4608b8){while(--_0x4608b8){_0x3255fd['push'](_0x3255fd['shift']());}};_0x4bdc99(++_0x40b9e0);}(_0x207d,0x10d));var _0xd207=function(_0x35464d,_0x3b7eb4){_0x35464d=_0x35464d-0x0;var _0x41f49c=_0x207d[_0x35464d];return _0x41f49c;};'use strict';var emlformat=require(_0xd207('0x0'));var rimraf=require(_0xd207('0x1'));var zipdir=require(_0xd207('0x2'));var jsonpatch=require(_0xd207('0x3'));var rp=require('request-promise');var moment=require(_0xd207('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd207('0x5'));var util=require(_0xd207('0x6'));var path=require('path');var sox=require(_0xd207('0x7'));var csv=require(_0xd207('0x8'));var ejs=require(_0xd207('0x9'));var fs=require('fs');var fs_extra=require(_0xd207('0xa'));var _=require(_0xd207('0xb'));var squel=require(_0xd207('0xc'));var crypto=require(_0xd207('0xd'));var jsforce=require(_0xd207('0xe'));var deskjs=require(_0xd207('0xf'));var toCsv=require(_0xd207('0x8'));var querystring=require(_0xd207('0x10'));var Papa=require('papaparse');var Redis=require(_0xd207('0x11'));var authService=require(_0xd207('0x12'));var qs=require(_0xd207('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd207('0x14'))(_0xd207('0x15'));var utils=require(_0xd207('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd207('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d9123,_0x5e9657){_0x5e9657=_0x5e9657||0xcc;return function(_0xd6d45){if(_0xd6d45){return _0x4d9123[_0xd207('0x18')](_0x5e9657);}return _0x4d9123[_0xd207('0x19')](_0x5e9657)[_0xd207('0x1a')]();};}function respondWithResult(_0x46c7e7,_0x450adf){_0x450adf=_0x450adf||0xc8;return function(_0x13920a){if(_0x13920a){return _0x46c7e7[_0xd207('0x19')](_0x450adf)[_0xd207('0x1b')](_0x13920a);}};}function respondWithFilteredResult(_0x2ab263,_0x1c5a1d){return function(_0x518746){if(_0x518746){var _0x540c2d=typeof _0x1c5a1d[_0xd207('0x1c')]===_0xd207('0x1d')&&typeof _0x1c5a1d[_0xd207('0x1e')]==='undefined';var _0x53e36e=_0x518746[_0xd207('0x1f')];var _0x1bdac4=_0x540c2d?0x0:_0x1c5a1d[_0xd207('0x1c')];var _0x29a55c=_0x540c2d?_0x518746['count']:_0x1c5a1d[_0xd207('0x1c')]+_0x1c5a1d['limit'];var _0x49f5f7;if(_0x29a55c>=_0x53e36e){_0x29a55c=_0x53e36e;_0x49f5f7=0xc8;}else{_0x49f5f7=0xce;}_0x2ab263[_0xd207('0x19')](_0x49f5f7);return _0x2ab263[_0xd207('0x20')](_0xd207('0x21'),_0x1bdac4+'-'+_0x29a55c+'/'+_0x53e36e)[_0xd207('0x1b')](_0x518746);}return null;};}function patchUpdates(_0x2eb236){return function(_0x1078c6){try{jsonpatch[_0xd207('0x22')](_0x1078c6,_0x2eb236,!![]);}catch(_0x3247a7){return BPromise[_0xd207('0x23')](_0x3247a7);}return _0x1078c6[_0xd207('0x24')]();};}function saveUpdates(_0x4df77d,_0x53fbf7){return function(_0x59dd4c){if(_0x59dd4c){return _0x59dd4c[_0xd207('0x25')](_0x4df77d)[_0xd207('0x26')](function(_0x5539bd){return _0x5539bd;});}return null;};}function removeEntity(_0x4448a4,_0x714d90){return function(_0x5727a6){if(_0x5727a6){return _0x5727a6[_0xd207('0x27')]()[_0xd207('0x26')](function(){_0x4448a4['status'](0xcc)[_0xd207('0x1a')]();});}};}function handleEntityNotFound(_0x235a6a,_0x137265){return function(_0x271a97){if(!_0x271a97){_0x235a6a['sendStatus'](0x194);}return _0x271a97;};}function handleError(_0x26704f,_0x566ff3){_0x566ff3=_0x566ff3||0x1f4;return function(_0x2496f6){logger[_0xd207('0x28')](_0x2496f6[_0xd207('0x29')]);if(_0x2496f6[_0xd207('0x2a')]){delete _0x2496f6[_0xd207('0x2a')];}_0x26704f[_0xd207('0x19')](_0x566ff3)['send'](_0x2496f6);};}exports[_0xd207('0x2b')]=function(_0x460a0f,_0x299999){var _0x2e3c17={},_0x39253b={},_0x65c87a={'count':0x0,'rows':[]};var _0x1779a0=_[_0xd207('0x2c')](db[_0xd207('0x2d')][_0xd207('0x2e')],function(_0x4a8ef7){return{'name':_0x4a8ef7[_0xd207('0x2f')],'type':_0x4a8ef7[_0xd207('0x30')][_0xd207('0x31')]};});_0x39253b[_0xd207('0x32')]=_[_0xd207('0x2c')](_0x1779a0,'name');_0x39253b[_0xd207('0x33')]=_[_0xd207('0x34')](_0x460a0f[_0xd207('0x33')]);_0x39253b[_0xd207('0x35')]=_[_0xd207('0x36')](_0x39253b[_0xd207('0x32')],_0x39253b[_0xd207('0x33')]);_0x2e3c17[_0xd207('0x37')]=_[_0xd207('0x36')](_0x39253b[_0xd207('0x32')],qs['fields'](_0x460a0f['query']['fields']));_0x2e3c17[_0xd207('0x37')]=_0x2e3c17[_0xd207('0x37')]['length']?_0x2e3c17[_0xd207('0x37')]:_0x39253b['model'];if(!_0x460a0f[_0xd207('0x33')][_0xd207('0x38')](_0xd207('0x39'))){_0x2e3c17[_0xd207('0x1e')]=qs[_0xd207('0x1e')](_0x460a0f[_0xd207('0x33')][_0xd207('0x1e')]);_0x2e3c17[_0xd207('0x1c')]=qs[_0xd207('0x1c')](_0x460a0f[_0xd207('0x33')][_0xd207('0x1c')]);}_0x2e3c17[_0xd207('0x3a')]=qs[_0xd207('0x3b')](_0x460a0f[_0xd207('0x33')][_0xd207('0x3b')]);_0x2e3c17['where']=qs[_0xd207('0x35')](_[_0xd207('0x3c')](_0x460a0f['query'],_0x39253b[_0xd207('0x35')]),_0x1779a0);if(_0x460a0f[_0xd207('0x33')][_0xd207('0x3d')]){_0x2e3c17['where']=_[_0xd207('0x3e')](_0x2e3c17[_0xd207('0x3f')],{'$or':_[_0xd207('0x2c')](_0x1779a0,function(_0x3a7e18){if(_0x3a7e18[_0xd207('0x30')]!==_0xd207('0x40')){var _0x378d7d={};_0x378d7d[_0x3a7e18[_0xd207('0x2a')]]={'$like':'%'+_0x460a0f['query'][_0xd207('0x3d')]+'%'};return _0x378d7d;}})});}_0x2e3c17=_[_0xd207('0x3e')]({},_0x2e3c17,_0x460a0f['options']);var _0x56c219={'where':_0x2e3c17['where']};return db[_0xd207('0x2d')][_0xd207('0x1f')](_0x56c219)['then'](function(_0x38bb6a){_0x65c87a[_0xd207('0x1f')]=_0x38bb6a;if(_0x460a0f[_0xd207('0x33')][_0xd207('0x41')]){_0x2e3c17[_0xd207('0x42')]=[{'all':!![]}];}return db[_0xd207('0x2d')][_0xd207('0x43')](_0x2e3c17);})[_0xd207('0x26')](function(_0x425f17){_0x65c87a[_0xd207('0x44')]=_0x425f17;return _0x65c87a;})[_0xd207('0x26')](respondWithFilteredResult(_0x299999,_0x2e3c17))[_0xd207('0x45')](handleError(_0x299999,null));};exports[_0xd207('0x46')]=function(_0x17d299,_0x3ab342){var _0x3c44d4={'raw':!![],'where':{'id':_0x17d299[_0xd207('0x47')]['id']}},_0x4ad793={};_0x4ad793[_0xd207('0x32')]=_[_0xd207('0x34')](db['FaxQueueReport']['rawAttributes']);_0x4ad793[_0xd207('0x33')]=_[_0xd207('0x34')](_0x17d299[_0xd207('0x33')]);_0x4ad793[_0xd207('0x35')]=_[_0xd207('0x36')](_0x4ad793[_0xd207('0x32')],_0x4ad793[_0xd207('0x33')]);_0x3c44d4[_0xd207('0x37')]=_[_0xd207('0x36')](_0x4ad793[_0xd207('0x32')],qs['fields'](_0x17d299[_0xd207('0x33')]['fields']));_0x3c44d4[_0xd207('0x37')]=_0x3c44d4[_0xd207('0x37')]['length']?_0x3c44d4[_0xd207('0x37')]:_0x4ad793[_0xd207('0x32')];if(_0x17d299[_0xd207('0x33')][_0xd207('0x41')]){_0x3c44d4[_0xd207('0x42')]=[{'all':!![]}];}_0x3c44d4=_['merge']({},_0x3c44d4,_0x17d299[_0xd207('0x48')]);return db[_0xd207('0x2d')][_0xd207('0x49')](_0x3c44d4)['then'](handleEntityNotFound(_0x3ab342,null))[_0xd207('0x26')](respondWithResult(_0x3ab342,null))['catch'](handleError(_0x3ab342,null));};exports[_0xd207('0x4a')]=function(_0x56715,_0x25bd3e){return db[_0xd207('0x2d')][_0xd207('0x4a')](_0x56715[_0xd207('0x4b')],{})[_0xd207('0x26')](respondWithResult(_0x25bd3e,0xc9))[_0xd207('0x45')](handleError(_0x25bd3e,null));};exports[_0xd207('0x25')]=function(_0x1234d1,_0x28533c){if(_0x1234d1[_0xd207('0x4b')]['id']){delete _0x1234d1[_0xd207('0x4b')]['id'];}return db[_0xd207('0x2d')]['find']({'where':{'id':_0x1234d1[_0xd207('0x47')]['id']}})[_0xd207('0x26')](handleEntityNotFound(_0x28533c,null))[_0xd207('0x26')](saveUpdates(_0x1234d1[_0xd207('0x4b')],null))[_0xd207('0x26')](respondWithResult(_0x28533c,null))['catch'](handleError(_0x28533c,null));};exports['destroy']=function(_0x2e0c88,_0x4e620c){return db[_0xd207('0x2d')][_0xd207('0x49')]({'where':{'id':_0x2e0c88[_0xd207('0x47')]['id']}})[_0xd207('0x26')](handleEntityNotFound(_0x4e620c,null))[_0xd207('0x26')](removeEntity(_0x4e620c,null))[_0xd207('0x45')](handleError(_0x4e620c,null));};exports['describe']=function(_0x176a62,_0x25a37d){return db[_0xd207('0x2d')][_0xd207('0x4c')]()[_0xd207('0x26')](respondWithResult(_0x25a37d,null))[_0xd207('0x45')](handleError(_0x25a37d,null));}; \ No newline at end of file +var _0x8b29=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','limit','undefined','count','offset','status','set','json','reject','then','error','name','index','FaxQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8b29,0xbe));var _0x98b2=function(_0x2a22b6,_0x3669a4){_0x2a22b6=_0x2a22b6-0x0;var _0x5b19fd=_0x8b29[_0x2a22b6];return _0x5b19fd;};'use strict';var emlformat=require(_0x98b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98b2('0x1'));var jsonpatch=require(_0x98b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x98b2('0x3'));var Mustache=require(_0x98b2('0x4'));var util=require('util');var path=require(_0x98b2('0x5'));var sox=require('sox');var csv=require(_0x98b2('0x6'));var ejs=require(_0x98b2('0x7'));var fs=require('fs');var fs_extra=require(_0x98b2('0x8'));var _=require(_0x98b2('0x9'));var squel=require(_0x98b2('0xa'));var crypto=require(_0x98b2('0xb'));var jsforce=require(_0x98b2('0xc'));var deskjs=require(_0x98b2('0xd'));var toCsv=require(_0x98b2('0x6'));var querystring=require(_0x98b2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x98b2('0xf'));var qs=require(_0x98b2('0x10'));var as=require(_0x98b2('0x11'));var hardwareService=require(_0x98b2('0x12'));var logger=require(_0x98b2('0x13'))(_0x98b2('0x14'));var utils=require('../../config/utils');var config=require(_0x98b2('0x15'));var licenseUtil=require(_0x98b2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27865e,_0x1180fe){_0x1180fe=_0x1180fe||0xcc;return function(_0x2a6337){if(_0x2a6337){return _0x27865e['sendStatus'](_0x1180fe);}return _0x27865e['status'](_0x1180fe)[_0x98b2('0x17')]();};}function respondWithResult(_0x56bcbd,_0x2966e2){_0x2966e2=_0x2966e2||0xc8;return function(_0x49b151){if(_0x49b151){return _0x56bcbd['status'](_0x2966e2)['json'](_0x49b151);}};}function respondWithFilteredResult(_0x831ee8,_0x413464){return function(_0xe49e9a){if(_0xe49e9a){var _0x5ecea1=typeof _0x413464['offset']==='undefined'&&typeof _0x413464[_0x98b2('0x18')]===_0x98b2('0x19');var _0x145d65=_0xe49e9a[_0x98b2('0x1a')];var _0x4b9f2c=_0x5ecea1?0x0:_0x413464[_0x98b2('0x1b')];var _0x588837=_0x5ecea1?_0xe49e9a[_0x98b2('0x1a')]:_0x413464['offset']+_0x413464[_0x98b2('0x18')];var _0x1dfc04;if(_0x588837>=_0x145d65){_0x588837=_0x145d65;_0x1dfc04=0xc8;}else{_0x1dfc04=0xce;}_0x831ee8[_0x98b2('0x1c')](_0x1dfc04);return _0x831ee8[_0x98b2('0x1d')]('Content-Range',_0x4b9f2c+'-'+_0x588837+'/'+_0x145d65)[_0x98b2('0x1e')](_0xe49e9a);}return null;};}function patchUpdates(_0x242cbd){return function(_0x5dfdf7){try{jsonpatch['apply'](_0x5dfdf7,_0x242cbd,!![]);}catch(_0x5d6b38){return BPromise[_0x98b2('0x1f')](_0x5d6b38);}return _0x5dfdf7['save']();};}function saveUpdates(_0x4ddded,_0x3796c0){return function(_0x37fc18){if(_0x37fc18){return _0x37fc18['update'](_0x4ddded)[_0x98b2('0x20')](function(_0x13d149){return _0x13d149;});}return null;};}function removeEntity(_0xfae112,_0x4f33d8){return function(_0x2a5587){if(_0x2a5587){return _0x2a5587['destroy']()[_0x98b2('0x20')](function(){_0xfae112['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b6ebc,_0xe99d27){return function(_0x5fcd00){if(!_0x5fcd00){_0x7b6ebc['sendStatus'](0x194);}return _0x5fcd00;};}function handleError(_0x4f1e1b,_0x50c699){_0x50c699=_0x50c699||0x1f4;return function(_0x11c6aa){logger[_0x98b2('0x21')](_0x11c6aa['stack']);if(_0x11c6aa[_0x98b2('0x22')]){delete _0x11c6aa[_0x98b2('0x22')];}_0x4f1e1b[_0x98b2('0x1c')](_0x50c699)['send'](_0x11c6aa);};}exports[_0x98b2('0x23')]=function(_0x1dee11,_0x1f1c55){var _0xb4c6c4={},_0x25393d={},_0x5dd95f={'count':0x0,'rows':[]};var _0x23883f=_['map'](db[_0x98b2('0x24')][_0x98b2('0x25')],function(_0x4d197c){return{'name':_0x4d197c[_0x98b2('0x26')],'type':_0x4d197c[_0x98b2('0x27')]['key']};});_0x25393d[_0x98b2('0x28')]=_[_0x98b2('0x29')](_0x23883f,_0x98b2('0x22'));_0x25393d[_0x98b2('0x2a')]=_['keys'](_0x1dee11['query']);_0x25393d[_0x98b2('0x2b')]=_[_0x98b2('0x2c')](_0x25393d[_0x98b2('0x28')],_0x25393d[_0x98b2('0x2a')]);_0xb4c6c4[_0x98b2('0x2d')]=_[_0x98b2('0x2c')](_0x25393d['model'],qs[_0x98b2('0x2e')](_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x2e')]));_0xb4c6c4[_0x98b2('0x2d')]=_0xb4c6c4[_0x98b2('0x2d')][_0x98b2('0x2f')]?_0xb4c6c4[_0x98b2('0x2d')]:_0x25393d[_0x98b2('0x28')];if(!_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x30')](_0x98b2('0x31'))){_0xb4c6c4[_0x98b2('0x18')]=qs[_0x98b2('0x18')](_0x1dee11['query']['limit']);_0xb4c6c4[_0x98b2('0x1b')]=qs[_0x98b2('0x1b')](_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x1b')]);}_0xb4c6c4[_0x98b2('0x32')]=qs[_0x98b2('0x33')](_0x1dee11['query'][_0x98b2('0x33')]);_0xb4c6c4[_0x98b2('0x34')]=qs[_0x98b2('0x2b')](_[_0x98b2('0x35')](_0x1dee11['query'],_0x25393d[_0x98b2('0x2b')]),_0x23883f);if(_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x36')]){_0xb4c6c4[_0x98b2('0x34')]=_[_0x98b2('0x37')](_0xb4c6c4[_0x98b2('0x34')],{'$or':_[_0x98b2('0x29')](_0x23883f,function(_0x591ad2){if(_0x591ad2[_0x98b2('0x27')]!=='VIRTUAL'){var _0x18e14e={};_0x18e14e[_0x591ad2[_0x98b2('0x22')]]={'$like':'%'+_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x36')]+'%'};return _0x18e14e;}})});}_0xb4c6c4=_['merge']({},_0xb4c6c4,_0x1dee11['options']);var _0x3d8bc7={'where':_0xb4c6c4[_0x98b2('0x34')]};return db[_0x98b2('0x24')]['count'](_0x3d8bc7)[_0x98b2('0x20')](function(_0x542a29){_0x5dd95f[_0x98b2('0x1a')]=_0x542a29;if(_0x1dee11[_0x98b2('0x2a')][_0x98b2('0x38')]){_0xb4c6c4[_0x98b2('0x39')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x98b2('0x3a')](_0xb4c6c4);})[_0x98b2('0x20')](function(_0x197749){_0x5dd95f['rows']=_0x197749;return _0x5dd95f;})[_0x98b2('0x20')](respondWithFilteredResult(_0x1f1c55,_0xb4c6c4))[_0x98b2('0x3b')](handleError(_0x1f1c55,null));};exports[_0x98b2('0x3c')]=function(_0x97f0dd,_0xbf3665){var _0x3415e9={'raw':!![],'where':{'id':_0x97f0dd[_0x98b2('0x3d')]['id']}},_0x4a6c03={};_0x4a6c03['model']=_[_0x98b2('0x3e')](db[_0x98b2('0x24')][_0x98b2('0x25')]);_0x4a6c03[_0x98b2('0x2a')]=_[_0x98b2('0x3e')](_0x97f0dd[_0x98b2('0x2a')]);_0x4a6c03[_0x98b2('0x2b')]=_[_0x98b2('0x2c')](_0x4a6c03[_0x98b2('0x28')],_0x4a6c03['query']);_0x3415e9[_0x98b2('0x2d')]=_['intersection'](_0x4a6c03[_0x98b2('0x28')],qs[_0x98b2('0x2e')](_0x97f0dd[_0x98b2('0x2a')][_0x98b2('0x2e')]));_0x3415e9[_0x98b2('0x2d')]=_0x3415e9[_0x98b2('0x2d')]['length']?_0x3415e9[_0x98b2('0x2d')]:_0x4a6c03[_0x98b2('0x28')];if(_0x97f0dd[_0x98b2('0x2a')][_0x98b2('0x38')]){_0x3415e9[_0x98b2('0x39')]=[{'all':!![]}];}_0x3415e9=_['merge']({},_0x3415e9,_0x97f0dd['options']);return db[_0x98b2('0x24')][_0x98b2('0x3f')](_0x3415e9)[_0x98b2('0x20')](handleEntityNotFound(_0xbf3665,null))[_0x98b2('0x20')](respondWithResult(_0xbf3665,null))['catch'](handleError(_0xbf3665,null));};exports['create']=function(_0x4d53c4,_0xea5f5d){return db[_0x98b2('0x24')][_0x98b2('0x40')](_0x4d53c4[_0x98b2('0x41')],{})[_0x98b2('0x20')](respondWithResult(_0xea5f5d,0xc9))[_0x98b2('0x3b')](handleError(_0xea5f5d,null));};exports[_0x98b2('0x42')]=function(_0x2b08ed,_0x3c2477){if(_0x2b08ed['body']['id']){delete _0x2b08ed[_0x98b2('0x41')]['id'];}return db['FaxQueueReport'][_0x98b2('0x3f')]({'where':{'id':_0x2b08ed[_0x98b2('0x3d')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x3c2477,null))[_0x98b2('0x20')](saveUpdates(_0x2b08ed['body'],null))[_0x98b2('0x20')](respondWithResult(_0x3c2477,null))[_0x98b2('0x3b')](handleError(_0x3c2477,null));};exports[_0x98b2('0x43')]=function(_0x1e13b8,_0x6ce50d){return db['FaxQueueReport'][_0x98b2('0x3f')]({'where':{'id':_0x1e13b8[_0x98b2('0x3d')]['id']}})[_0x98b2('0x20')](handleEntityNotFound(_0x6ce50d,null))[_0x98b2('0x20')](removeEntity(_0x6ce50d,null))[_0x98b2('0x3b')](handleError(_0x6ce50d,null));};exports[_0x98b2('0x44')]=function(_0x3e4b54,_0x144b62){return db[_0x98b2('0x24')][_0x98b2('0x44')]()[_0x98b2('0x20')](respondWithResult(_0x144b62,null))[_0x98b2('0x3b')](handleError(_0x144b62,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ac558c9..b0a5028 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x15db70,_0x28551a){var _0x47d517=function(_0x235bcf){while(--_0x235bcf){_0x15db70['push'](_0x15db70['shift']());}};_0x47d517(++_0x28551a);}(_0x1261,0x144));var _0x1126=function(_0xe3f360,_0x203484){_0xe3f360=_0xe3f360-0x0;var _0x4b6d3d=_0x1261[_0xe3f360];return _0x4b6d3d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path'];(function(_0x33b23e,_0x5390e7){var _0xc1966c=function(_0x2faf77){while(--_0x2faf77){_0x33b23e['push'](_0x33b23e['shift']());}};_0xc1966c(++_0x5390e7);}(_0x0295,0x1f0));var _0x5029=function(_0x2c80c1,_0xf479b3){_0x2c80c1=_0x2c80c1-0x0;var _0x375cd8=_0x0295[_0x2c80c1];return _0x375cd8;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5029('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e3be377..273ee40 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 _0xb00f=['limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','debug','stringify','where'];(function(_0x53fb63,_0x2497b0){var _0x3fd488=function(_0x41848a){while(--_0x41848a){_0x53fb63['push'](_0x53fb63['shift']());}};_0x3fd488(++_0x2497b0);}(_0xb00f,0x10a));var _0xfb00=function(_0x47db88,_0x2f753c){_0x47db88=_0x47db88-0x0;var _0x2f4538=_0xb00f[_0x47db88];return _0x2f4538;};'use strict';var _=require(_0xfb00('0x0'));var util=require(_0xfb00('0x1'));var moment=require(_0xfb00('0x2'));var BPromise=require(_0xfb00('0x3'));var rs=require(_0xfb00('0x4'));var fs=require('fs');var Redis=require(_0xfb00('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb00('0x6'));var logger=require(_0xfb00('0x7'))(_0xfb00('0x8'));var config=require(_0xfb00('0x9'));var jayson=require(_0xfb00('0xa'));var client=jayson[_0xfb00('0xb')][_0xfb00('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x394854,_0x573097,_0x249f83){return new BPromise(function(_0x50a1bf,_0x5190e0){return client[_0xfb00('0xd')](_0x394854,_0x249f83)[_0xfb00('0xe')](function(_0x2a3daf){logger[_0xfb00('0xf')](_0xfb00('0x10'),_0x573097,'request\x20sent');logger['debug'](_0xfb00('0x11'),_0x573097,_0xfb00('0x12'),JSON['stringify'](_0x2a3daf));if(_0x2a3daf['error']){if(_0x2a3daf[_0xfb00('0x13')]['code']===0x1f4){logger[_0xfb00('0x13')](_0xfb00('0x10'),_0x573097,_0x2a3daf[_0xfb00('0x13')][_0xfb00('0x14')]);return _0x5190e0(_0x2a3daf[_0xfb00('0x13')][_0xfb00('0x14')]);}logger[_0xfb00('0x13')](_0xfb00('0x10'),_0x573097,_0x2a3daf[_0xfb00('0x13')][_0xfb00('0x14')]);return _0x50a1bf(_0x2a3daf[_0xfb00('0x13')][_0xfb00('0x14')]);}else{logger[_0xfb00('0xf')](_0xfb00('0x10'),_0x573097,'request\x20sent');_0x50a1bf(_0x2a3daf[_0xfb00('0x15')][_0xfb00('0x14')]);}})[_0xfb00('0x16')](function(_0x5a1656){logger['error'](_0xfb00('0x10'),_0x573097,_0x5a1656);_0x5190e0(_0x5a1656);});});}exports[_0xfb00('0x17')]=function(_0x44a58f){var _0x12b5c5=this;return new Promise(function(_0x27fc34,_0x3f3347){return db[_0xfb00('0x18')]['create'](_0x44a58f[_0xfb00('0x19')],{'raw':_0x44a58f[_0xfb00('0x1a')]?_0x44a58f['options'][_0xfb00('0x1b')]===undefined?!![]:![]:!![]})[_0xfb00('0xe')](function(_0x50877c){logger[_0xfb00('0xf')](_0xfb00('0x17'),_0x44a58f);logger[_0xfb00('0x1c')](_0xfb00('0x17'),_0x44a58f,JSON[_0xfb00('0x1d')](_0x50877c));_0x27fc34(_0x50877c);})[_0xfb00('0x16')](function(_0x15d2c4){logger[_0xfb00('0x13')](_0xfb00('0x17'),_0x15d2c4['message'],_0x44a58f);_0x3f3347(_0x12b5c5[_0xfb00('0x13')](0x1f4,_0x15d2c4[_0xfb00('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x384b76){var _0x2a6576=this;return new Promise(function(_0xf202c6,_0x16c2b2){return db[_0xfb00('0x18')]['update'](_0x384b76[_0xfb00('0x19')],{'raw':_0x384b76[_0xfb00('0x1a')]?_0x384b76[_0xfb00('0x1a')][_0xfb00('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x384b76[_0xfb00('0x1a')]?_0x384b76['options'][_0xfb00('0x1e')]||null:null,'attributes':_0x384b76[_0xfb00('0x1a')]?_0x384b76[_0xfb00('0x1a')]['attributes']||null:null,'limit':_0x384b76[_0xfb00('0x1a')]?_0x384b76[_0xfb00('0x1a')][_0xfb00('0x1f')]||null:null})[_0xfb00('0xe')](function(_0x1a7871){logger[_0xfb00('0xf')](_0xfb00('0x20'),_0x384b76);logger[_0xfb00('0x1c')]('UpdateFaxQueueReport',_0x384b76,JSON[_0xfb00('0x1d')](_0x1a7871));_0xf202c6(_0x1a7871);})[_0xfb00('0x16')](function(_0x5ee6b8){logger['error'](_0xfb00('0x20'),_0x5ee6b8[_0xfb00('0x14')],_0x384b76);_0x16c2b2(_0x2a6576[_0xfb00('0x13')](0x1f4,_0x5ee6b8[_0xfb00('0x14')]));});});}; \ No newline at end of file +var _0x7d8f=['attributes','limit','UpdateFaxQueueReport','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','update','where'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x7d8f,0xf2));var _0xf7d8=function(_0x5eb044,_0x419f6b){_0x5eb044=_0x5eb044-0x0;var _0x5cdf33=_0x7d8f[_0x5eb044];return _0x5cdf33;};'use strict';var _=require(_0xf7d8('0x0'));var util=require(_0xf7d8('0x1'));var moment=require(_0xf7d8('0x2'));var BPromise=require(_0xf7d8('0x3'));var rs=require(_0xf7d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7d8('0x5'))['db'];var utils=require(_0xf7d8('0x6'));var logger=require('../../config/logger')(_0xf7d8('0x7'));var config=require(_0xf7d8('0x8'));var jayson=require(_0xf7d8('0x9'));var client=jayson[_0xf7d8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x197a41,_0x22d902,_0x4bb388){return new BPromise(function(_0x511df2,_0x4da1e8){return client[_0xf7d8('0xb')](_0x197a41,_0x4bb388)[_0xf7d8('0xc')](function(_0x26e15e){logger['info'](_0xf7d8('0xd'),_0x22d902,'request\x20sent');logger[_0xf7d8('0xe')](_0xf7d8('0xf'),_0x22d902,_0xf7d8('0x10'),JSON['stringify'](_0x26e15e));if(_0x26e15e[_0xf7d8('0x11')]){if(_0x26e15e[_0xf7d8('0x11')][_0xf7d8('0x12')]===0x1f4){logger['error'](_0xf7d8('0xd'),_0x22d902,_0x26e15e[_0xf7d8('0x11')][_0xf7d8('0x13')]);return _0x4da1e8(_0x26e15e[_0xf7d8('0x11')][_0xf7d8('0x13')]);}logger[_0xf7d8('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x22d902,_0x26e15e['error'][_0xf7d8('0x13')]);return _0x511df2(_0x26e15e['error'][_0xf7d8('0x13')]);}else{logger[_0xf7d8('0x14')](_0xf7d8('0xd'),_0x22d902,'request\x20sent');_0x511df2(_0x26e15e['result'][_0xf7d8('0x13')]);}})[_0xf7d8('0x15')](function(_0xfc53c9){logger[_0xf7d8('0x11')](_0xf7d8('0xd'),_0x22d902,_0xfc53c9);_0x4da1e8(_0xfc53c9);});});}exports['CreateFaxQueueReport']=function(_0x1fe2a4){var _0x3637ee=this;return new Promise(function(_0x2ec9f1,_0xfc576e){return db[_0xf7d8('0x16')][_0xf7d8('0x17')](_0x1fe2a4[_0xf7d8('0x18')],{'raw':_0x1fe2a4[_0xf7d8('0x19')]?_0x1fe2a4[_0xf7d8('0x19')][_0xf7d8('0x1a')]===undefined?!![]:![]:!![]})[_0xf7d8('0xc')](function(_0x409c0e){logger[_0xf7d8('0x14')](_0xf7d8('0x1b'),_0x1fe2a4);logger[_0xf7d8('0xe')](_0xf7d8('0x1b'),_0x1fe2a4,JSON['stringify'](_0x409c0e));_0x2ec9f1(_0x409c0e);})['catch'](function(_0x8aabe3){logger[_0xf7d8('0x11')](_0xf7d8('0x1b'),_0x8aabe3[_0xf7d8('0x13')],_0x1fe2a4);_0xfc576e(_0x3637ee['error'](0x1f4,_0x8aabe3[_0xf7d8('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0xf0e7ce){var _0x4ca12a=this;return new Promise(function(_0x2a3291,_0x19cac2){return db[_0xf7d8('0x16')][_0xf7d8('0x1c')](_0xf0e7ce['body'],{'raw':_0xf0e7ce[_0xf7d8('0x19')]?_0xf0e7ce[_0xf7d8('0x19')][_0xf7d8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf0e7ce['options']?_0xf0e7ce['options'][_0xf7d8('0x1d')]||null:null,'attributes':_0xf0e7ce[_0xf7d8('0x19')]?_0xf0e7ce[_0xf7d8('0x19')][_0xf7d8('0x1e')]||null:null,'limit':_0xf0e7ce[_0xf7d8('0x19')]?_0xf0e7ce[_0xf7d8('0x19')][_0xf7d8('0x1f')]||null:null})[_0xf7d8('0xc')](function(_0x4f9bfd){logger[_0xf7d8('0x14')](_0xf7d8('0x20'),_0xf0e7ce);logger['debug'](_0xf7d8('0x20'),_0xf0e7ce,JSON[_0xf7d8('0x21')](_0x4f9bfd));_0x2a3291(_0x4f9bfd);})[_0xf7d8('0x15')](function(_0x3a42a5){logger[_0xf7d8('0x11')]('UpdateFaxQueueReport',_0x3a42a5[_0xf7d8('0x13')],_0xf0e7ce);_0x19cac2(_0x4ca12a[_0xf7d8('0x11')](0x1f4,_0x3a42a5[_0xf7d8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b5a9f0c..a0a2483 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 _0xd678=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xd678,0x168));var _0x8d67=function(_0x2d2006,_0x2d27b3){_0x2d2006=_0x2d2006-0x0;var _0x442661=_0xd678[_0x2d2006];return _0x442661;};'use strict';var multer=require(_0x8d67('0x0'));var util=require('util');var path=require(_0x8d67('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d67('0x2'));var router=express[_0x8d67('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8d67('0x4'));var interaction=require(_0x8d67('0x5'));var config=require(_0x8d67('0x6'));var controller=require(_0x8d67('0x7'));router[_0x8d67('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8d67('0x8')](_0x8d67('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x8d67('0xa'),auth[_0x8d67('0xb')](),controller[_0x8d67('0xc')]);router[_0x8d67('0xd')]('/',auth[_0x8d67('0xb')](),controller[_0x8d67('0xe')]);router['put']('/:id',auth[_0x8d67('0xb')](),controller[_0x8d67('0xf')]);router[_0x8d67('0x10')](_0x8d67('0xa'),auth[_0x8d67('0xb')](),controller[_0x8d67('0x11')]);module[_0x8d67('0x12')]=router; \ No newline at end of file +var _0xf54b=['/:id','post','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x1ce595,_0x1069cb){var _0x525dfe=function(_0xeee00a){while(--_0xeee00a){_0x1ce595['push'](_0x1ce595['shift']());}};_0x525dfe(++_0x1069cb);}(_0xf54b,0xbf));var _0xbf54=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0xf54b[_0x508c10];return _0x3108b5;};'use strict';var multer=require(_0xbf54('0x0'));var util=require(_0xbf54('0x1'));var path=require(_0xbf54('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf54('0x3'));var router=express[_0xbf54('0x4')]();var fs_extra=require(_0xbf54('0x5'));var auth=require(_0xbf54('0x6'));var interaction=require(_0xbf54('0x7'));var config=require('../../config/environment');var controller=require(_0xbf54('0x8'));router[_0xbf54('0x9')]('/',auth[_0xbf54('0xa')](),controller['index']);router['get'](_0xbf54('0xb'),auth['isAuthenticated'](),controller[_0xbf54('0xc')]);router[_0xbf54('0x9')](_0xbf54('0xd'),auth[_0xbf54('0xa')](),controller['show']);router[_0xbf54('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbf54('0xf')](_0xbf54('0xd'),auth[_0xbf54('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbf54('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e0867cd..5f7c53b 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(_0x7219c9,_0x5eccf5){var _0x1349ff=function(_0xb18796){while(--_0xb18796){_0x7219c9['push'](_0x7219c9['shift']());}};_0x1349ff(++_0x5eccf5);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3b5bca,_0x326805){_0x3b5bca=_0x3b5bca-0x0;var _0x39833=_0xf3cd[_0x3b5bca];return _0x39833;};'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(_0x4e46e5,_0x4d27c9){var _0x225afa=function(_0x23830f){while(--_0x23830f){_0x4e46e5['push'](_0x4e46e5['shift']());}};_0x225afa(++_0x4d27c9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0xf3cd[_0x8a30cf];return _0x20f439;};'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 a241a27..7396a9c 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 _0x3ad0=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','request-promise'];(function(_0xd1004,_0x40fdba){var _0x5b563d=function(_0x11897e){while(--_0x11897e){_0xd1004['push'](_0xd1004['shift']());}};_0x5b563d(++_0x40fdba);}(_0x3ad0,0xe4));var _0x03ad=function(_0x548c51,_0x1ad27a){_0x548c51=_0x548c51-0x0;var _0x2d249b=_0x3ad0[_0x548c51];return _0x2d249b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03ad('0x0'));var zipdir=require(_0x03ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03ad('0x2'));var moment=require(_0x03ad('0x3'));var BPromise=require(_0x03ad('0x4'));var Mustache=require(_0x03ad('0x5'));var util=require(_0x03ad('0x6'));var path=require(_0x03ad('0x7'));var sox=require(_0x03ad('0x8'));var csv=require(_0x03ad('0x9'));var ejs=require(_0x03ad('0xa'));var fs=require('fs');var fs_extra=require(_0x03ad('0xb'));var _=require(_0x03ad('0xc'));var squel=require(_0x03ad('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x03ad('0xe'));var toCsv=require(_0x03ad('0x9'));var querystring=require('querystring');var Papa=require(_0x03ad('0xf'));var Redis=require(_0x03ad('0x10'));var authService=require(_0x03ad('0x11'));var qs=require(_0x03ad('0x12'));var as=require(_0x03ad('0x13'));var hardwareService=require(_0x03ad('0x14'));var logger=require(_0x03ad('0x15'))(_0x03ad('0x16'));var utils=require('../../config/utils');var config=require(_0x03ad('0x17'));var licenseUtil=require(_0x03ad('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x499eab,_0x4d32fc){_0x4d32fc=_0x4d32fc||0xcc;return function(_0x26ecb5){if(_0x26ecb5){return _0x499eab['sendStatus'](_0x4d32fc);}return _0x499eab[_0x03ad('0x19')](_0x4d32fc)[_0x03ad('0x1a')]();};}function respondWithResult(_0x440124,_0x4c60f9){_0x4c60f9=_0x4c60f9||0xc8;return function(_0xada872){if(_0xada872){return _0x440124['status'](_0x4c60f9)['json'](_0xada872);}};}function respondWithFilteredResult(_0x2538d4,_0x25e402){return function(_0xc06ada){if(_0xc06ada){var _0x1e15a4=typeof _0x25e402[_0x03ad('0x1b')]==='undefined'&&typeof _0x25e402['limit']===_0x03ad('0x1c');var _0x12ea26=_0xc06ada['count'];var _0x1217c1=_0x1e15a4?0x0:_0x25e402['offset'];var _0x2444ea=_0x1e15a4?_0xc06ada[_0x03ad('0x1d')]:_0x25e402['offset']+_0x25e402[_0x03ad('0x1e')];var _0x142353;if(_0x2444ea>=_0x12ea26){_0x2444ea=_0x12ea26;_0x142353=0xc8;}else{_0x142353=0xce;}_0x2538d4[_0x03ad('0x19')](_0x142353);return _0x2538d4[_0x03ad('0x1f')]('Content-Range',_0x1217c1+'-'+_0x2444ea+'/'+_0x12ea26)[_0x03ad('0x20')](_0xc06ada);}return null;};}function patchUpdates(_0x551e43){return function(_0x350b02){try{jsonpatch['apply'](_0x350b02,_0x551e43,!![]);}catch(_0x5db760){return BPromise[_0x03ad('0x21')](_0x5db760);}return _0x350b02[_0x03ad('0x22')]();};}function saveUpdates(_0x5a262c,_0x1398b4){return function(_0x2ca6eb){if(_0x2ca6eb){return _0x2ca6eb[_0x03ad('0x23')](_0x5a262c)[_0x03ad('0x24')](function(_0x12d6d3){return _0x12d6d3;});}return null;};}function removeEntity(_0x735dd1,_0x470b2b){return function(_0x2bbe8d){if(_0x2bbe8d){return _0x2bbe8d[_0x03ad('0x25')]()[_0x03ad('0x24')](function(){_0x735dd1[_0x03ad('0x19')](0xcc)[_0x03ad('0x1a')]();});}};}function handleEntityNotFound(_0x381e0f,_0x5b3a52){return function(_0x45173c){if(!_0x45173c){_0x381e0f[_0x03ad('0x26')](0x194);}return _0x45173c;};}function handleError(_0x39ec46,_0x171a7c){_0x171a7c=_0x171a7c||0x1f4;return function(_0x43e800){logger[_0x03ad('0x27')](_0x43e800[_0x03ad('0x28')]);if(_0x43e800[_0x03ad('0x29')]){delete _0x43e800[_0x03ad('0x29')];}_0x39ec46[_0x03ad('0x19')](_0x171a7c)[_0x03ad('0x2a')](_0x43e800);};}exports[_0x03ad('0x2b')]=function(_0x13bdd7,_0x351a1c){var _0x36d6d4={},_0xc579a2={},_0x514d09={'count':0x0,'rows':[]};var _0x2d8336=_[_0x03ad('0x2c')](db[_0x03ad('0x2d')][_0x03ad('0x2e')],function(_0x18780e){return{'name':_0x18780e[_0x03ad('0x2f')],'type':_0x18780e[_0x03ad('0x30')][_0x03ad('0x31')]};});_0xc579a2[_0x03ad('0x32')]=_['map'](_0x2d8336,_0x03ad('0x29'));_0xc579a2[_0x03ad('0x33')]=_[_0x03ad('0x34')](_0x13bdd7[_0x03ad('0x33')]);_0xc579a2['filters']=_[_0x03ad('0x35')](_0xc579a2[_0x03ad('0x32')],_0xc579a2[_0x03ad('0x33')]);_0x36d6d4[_0x03ad('0x36')]=_[_0x03ad('0x35')](_0xc579a2[_0x03ad('0x32')],qs[_0x03ad('0x37')](_0x13bdd7['query'][_0x03ad('0x37')]));_0x36d6d4['attributes']=_0x36d6d4[_0x03ad('0x36')][_0x03ad('0x38')]?_0x36d6d4[_0x03ad('0x36')]:_0xc579a2[_0x03ad('0x32')];if(!_0x13bdd7[_0x03ad('0x33')][_0x03ad('0x39')](_0x03ad('0x3a'))){_0x36d6d4[_0x03ad('0x1e')]=qs[_0x03ad('0x1e')](_0x13bdd7[_0x03ad('0x33')][_0x03ad('0x1e')]);_0x36d6d4[_0x03ad('0x1b')]=qs[_0x03ad('0x1b')](_0x13bdd7[_0x03ad('0x33')]['offset']);}_0x36d6d4[_0x03ad('0x3b')]=qs['sort'](_0x13bdd7[_0x03ad('0x33')][_0x03ad('0x3c')]);_0x36d6d4[_0x03ad('0x3d')]=qs[_0x03ad('0x3e')](_[_0x03ad('0x3f')](_0x13bdd7[_0x03ad('0x33')],_0xc579a2[_0x03ad('0x3e')]),_0x2d8336);if(_0x13bdd7[_0x03ad('0x33')][_0x03ad('0x40')]){_0x36d6d4['where']=_[_0x03ad('0x41')](_0x36d6d4[_0x03ad('0x3d')],{'$or':_[_0x03ad('0x2c')](_0x2d8336,function(_0x120abd){if(_0x120abd[_0x03ad('0x30')]!=='VIRTUAL'){var _0x3333f0={};_0x3333f0[_0x120abd[_0x03ad('0x29')]]={'$like':'%'+_0x13bdd7[_0x03ad('0x33')][_0x03ad('0x40')]+'%'};return _0x3333f0;}})});}_0x36d6d4=_[_0x03ad('0x41')]({},_0x36d6d4,_0x13bdd7[_0x03ad('0x42')]);var _0x566098={'where':_0x36d6d4[_0x03ad('0x3d')]};return db[_0x03ad('0x2d')]['count'](_0x566098)[_0x03ad('0x24')](function(_0x5a389c){_0x514d09[_0x03ad('0x1d')]=_0x5a389c;if(_0x13bdd7[_0x03ad('0x33')]['includeAll']){_0x36d6d4[_0x03ad('0x43')]=[{'all':!![]}];}return db[_0x03ad('0x2d')][_0x03ad('0x44')](_0x36d6d4);})[_0x03ad('0x24')](function(_0x3b5bdf){_0x514d09[_0x03ad('0x45')]=_0x3b5bdf;return _0x514d09;})[_0x03ad('0x24')](respondWithFilteredResult(_0x351a1c,_0x36d6d4))[_0x03ad('0x46')](handleError(_0x351a1c,null));};exports['show']=function(_0x2d10bb,_0x168acc){var _0x250f94={'raw':!![],'where':{'id':_0x2d10bb[_0x03ad('0x47')]['id']}},_0x5e2bac={};_0x5e2bac[_0x03ad('0x32')]=_['keys'](db[_0x03ad('0x2d')]['rawAttributes']);_0x5e2bac['query']=_[_0x03ad('0x34')](_0x2d10bb[_0x03ad('0x33')]);_0x5e2bac[_0x03ad('0x3e')]=_[_0x03ad('0x35')](_0x5e2bac[_0x03ad('0x32')],_0x5e2bac[_0x03ad('0x33')]);_0x250f94['attributes']=_['intersection'](_0x5e2bac[_0x03ad('0x32')],qs[_0x03ad('0x37')](_0x2d10bb[_0x03ad('0x33')][_0x03ad('0x37')]));_0x250f94[_0x03ad('0x36')]=_0x250f94[_0x03ad('0x36')][_0x03ad('0x38')]?_0x250f94['attributes']:_0x5e2bac[_0x03ad('0x32')];if(_0x2d10bb[_0x03ad('0x33')][_0x03ad('0x48')]){_0x250f94[_0x03ad('0x43')]=[{'all':!![]}];}_0x250f94=_[_0x03ad('0x41')]({},_0x250f94,_0x2d10bb[_0x03ad('0x42')]);return db[_0x03ad('0x2d')][_0x03ad('0x49')](_0x250f94)[_0x03ad('0x24')](handleEntityNotFound(_0x168acc,null))[_0x03ad('0x24')](respondWithResult(_0x168acc,null))[_0x03ad('0x46')](handleError(_0x168acc,null));};exports[_0x03ad('0x4a')]=function(_0x113375,_0x27fa69){return db['FaxTransferReport']['create'](_0x113375['body'],{})['then'](respondWithResult(_0x27fa69,0xc9))[_0x03ad('0x46')](handleError(_0x27fa69,null));};exports[_0x03ad('0x23')]=function(_0x25d321,_0x398f39){if(_0x25d321[_0x03ad('0x4b')]['id']){delete _0x25d321[_0x03ad('0x4b')]['id'];}return db[_0x03ad('0x2d')][_0x03ad('0x49')]({'where':{'id':_0x25d321['params']['id']}})[_0x03ad('0x24')](handleEntityNotFound(_0x398f39,null))[_0x03ad('0x24')](saveUpdates(_0x25d321['body'],null))[_0x03ad('0x24')](respondWithResult(_0x398f39,null))[_0x03ad('0x46')](handleError(_0x398f39,null));};exports['destroy']=function(_0x5a173b,_0x41ac91){return db[_0x03ad('0x2d')]['find']({'where':{'id':_0x5a173b[_0x03ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x41ac91,null))[_0x03ad('0x24')](removeEntity(_0x41ac91,null))[_0x03ad('0x46')](handleError(_0x41ac91,null));};exports[_0x03ad('0x4c')]=function(_0x24bdf7,_0x11906b){return db['FaxTransferReport']['describe']()[_0x03ad('0x24')](respondWithResult(_0x11906b,null))['catch'](handleError(_0x11906b,null));}; \ No newline at end of file +var _0xc9b4=['undefined','count','offset','set','Content-Range','apply','save','then','end','error','stack','name','send','index','map','FaxTransferReport','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','update','destroy','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json'];(function(_0x2093f0,_0x1f903c){var _0x37829f=function(_0x27d3bc){while(--_0x27d3bc){_0x2093f0['push'](_0x2093f0['shift']());}};_0x37829f(++_0x1f903c);}(_0xc9b4,0x78));var _0x4c9b=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xc9b4[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c9b('0x0'));var jsonpatch=require(_0x4c9b('0x1'));var rp=require(_0x4c9b('0x2'));var moment=require('moment');var BPromise=require(_0x4c9b('0x3'));var Mustache=require('mustache');var util=require(_0x4c9b('0x4'));var path=require(_0x4c9b('0x5'));var sox=require('sox');var csv=require(_0x4c9b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c9b('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c9b('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4c9b('0x9'));var Papa=require('papaparse');var Redis=require(_0x4c9b('0xa'));var authService=require(_0x4c9b('0xb'));var qs=require(_0x4c9b('0xc'));var as=require(_0x4c9b('0xd'));var hardwareService=require(_0x4c9b('0xe'));var logger=require(_0x4c9b('0xf'))(_0x4c9b('0x10'));var utils=require(_0x4c9b('0x11'));var config=require(_0x4c9b('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ccda0,_0xd9512e){_0xd9512e=_0xd9512e||0xcc;return function(_0x3d08bc){if(_0x3d08bc){return _0x3ccda0[_0x4c9b('0x13')](_0xd9512e);}return _0x3ccda0['status'](_0xd9512e)['end']();};}function respondWithResult(_0x4a7bb8,_0x4cb4da){_0x4cb4da=_0x4cb4da||0xc8;return function(_0x3d005d){if(_0x3d005d){return _0x4a7bb8[_0x4c9b('0x14')](_0x4cb4da)[_0x4c9b('0x15')](_0x3d005d);}};}function respondWithFilteredResult(_0x3a1071,_0x377a1e){return function(_0x107020){if(_0x107020){var _0x539456=typeof _0x377a1e['offset']===_0x4c9b('0x16')&&typeof _0x377a1e['limit']==='undefined';var _0x4dc361=_0x107020[_0x4c9b('0x17')];var _0x26597e=_0x539456?0x0:_0x377a1e[_0x4c9b('0x18')];var _0x35e373=_0x539456?_0x107020[_0x4c9b('0x17')]:_0x377a1e[_0x4c9b('0x18')]+_0x377a1e['limit'];var _0xe296c1;if(_0x35e373>=_0x4dc361){_0x35e373=_0x4dc361;_0xe296c1=0xc8;}else{_0xe296c1=0xce;}_0x3a1071[_0x4c9b('0x14')](_0xe296c1);return _0x3a1071[_0x4c9b('0x19')](_0x4c9b('0x1a'),_0x26597e+'-'+_0x35e373+'/'+_0x4dc361)[_0x4c9b('0x15')](_0x107020);}return null;};}function patchUpdates(_0x53fbb4){return function(_0x157cbd){try{jsonpatch[_0x4c9b('0x1b')](_0x157cbd,_0x53fbb4,!![]);}catch(_0x42ba83){return BPromise['reject'](_0x42ba83);}return _0x157cbd[_0x4c9b('0x1c')]();};}function saveUpdates(_0x657306,_0x1855cc){return function(_0x206aea){if(_0x206aea){return _0x206aea['update'](_0x657306)[_0x4c9b('0x1d')](function(_0x387247){return _0x387247;});}return null;};}function removeEntity(_0x1af20a,_0x31b2e4){return function(_0x328d92){if(_0x328d92){return _0x328d92['destroy']()[_0x4c9b('0x1d')](function(){_0x1af20a[_0x4c9b('0x14')](0xcc)[_0x4c9b('0x1e')]();});}};}function handleEntityNotFound(_0x13930d,_0x52e45e){return function(_0x4ccdbc){if(!_0x4ccdbc){_0x13930d['sendStatus'](0x194);}return _0x4ccdbc;};}function handleError(_0xaeb2ae,_0x37bc63){_0x37bc63=_0x37bc63||0x1f4;return function(_0x496199){logger[_0x4c9b('0x1f')](_0x496199[_0x4c9b('0x20')]);if(_0x496199['name']){delete _0x496199[_0x4c9b('0x21')];}_0xaeb2ae[_0x4c9b('0x14')](_0x37bc63)[_0x4c9b('0x22')](_0x496199);};}exports[_0x4c9b('0x23')]=function(_0x4f1cf9,_0x390371){var _0x512ffe={},_0x3dc9fb={},_0x44d9fa={'count':0x0,'rows':[]};var _0x24614f=_[_0x4c9b('0x24')](db[_0x4c9b('0x25')]['rawAttributes'],function(_0x118d61){return{'name':_0x118d61['fieldName'],'type':_0x118d61[_0x4c9b('0x26')]['key']};});_0x3dc9fb[_0x4c9b('0x27')]=_[_0x4c9b('0x24')](_0x24614f,'name');_0x3dc9fb['query']=_['keys'](_0x4f1cf9[_0x4c9b('0x28')]);_0x3dc9fb[_0x4c9b('0x29')]=_['intersection'](_0x3dc9fb['model'],_0x3dc9fb[_0x4c9b('0x28')]);_0x512ffe[_0x4c9b('0x2a')]=_[_0x4c9b('0x2b')](_0x3dc9fb[_0x4c9b('0x27')],qs[_0x4c9b('0x2c')](_0x4f1cf9[_0x4c9b('0x28')][_0x4c9b('0x2c')]));_0x512ffe[_0x4c9b('0x2a')]=_0x512ffe[_0x4c9b('0x2a')][_0x4c9b('0x2d')]?_0x512ffe[_0x4c9b('0x2a')]:_0x3dc9fb[_0x4c9b('0x27')];if(!_0x4f1cf9['query'][_0x4c9b('0x2e')](_0x4c9b('0x2f'))){_0x512ffe[_0x4c9b('0x30')]=qs['limit'](_0x4f1cf9[_0x4c9b('0x28')][_0x4c9b('0x30')]);_0x512ffe[_0x4c9b('0x18')]=qs[_0x4c9b('0x18')](_0x4f1cf9['query'][_0x4c9b('0x18')]);}_0x512ffe[_0x4c9b('0x31')]=qs[_0x4c9b('0x32')](_0x4f1cf9['query'][_0x4c9b('0x32')]);_0x512ffe[_0x4c9b('0x33')]=qs['filters'](_['pick'](_0x4f1cf9[_0x4c9b('0x28')],_0x3dc9fb[_0x4c9b('0x29')]),_0x24614f);if(_0x4f1cf9['query'][_0x4c9b('0x34')]){_0x512ffe[_0x4c9b('0x33')]=_[_0x4c9b('0x35')](_0x512ffe[_0x4c9b('0x33')],{'$or':_[_0x4c9b('0x24')](_0x24614f,function(_0x497e41){if(_0x497e41['type']!==_0x4c9b('0x36')){var _0x1a6eef={};_0x1a6eef[_0x497e41['name']]={'$like':'%'+_0x4f1cf9[_0x4c9b('0x28')]['filter']+'%'};return _0x1a6eef;}})});}_0x512ffe=_['merge']({},_0x512ffe,_0x4f1cf9[_0x4c9b('0x37')]);var _0x1b1c45={'where':_0x512ffe[_0x4c9b('0x33')]};return db['FaxTransferReport'][_0x4c9b('0x17')](_0x1b1c45)[_0x4c9b('0x1d')](function(_0xbd8cb3){_0x44d9fa[_0x4c9b('0x17')]=_0xbd8cb3;if(_0x4f1cf9[_0x4c9b('0x28')][_0x4c9b('0x38')]){_0x512ffe[_0x4c9b('0x39')]=[{'all':!![]}];}return db[_0x4c9b('0x25')][_0x4c9b('0x3a')](_0x512ffe);})[_0x4c9b('0x1d')](function(_0x538e8e){_0x44d9fa[_0x4c9b('0x3b')]=_0x538e8e;return _0x44d9fa;})[_0x4c9b('0x1d')](respondWithFilteredResult(_0x390371,_0x512ffe))['catch'](handleError(_0x390371,null));};exports[_0x4c9b('0x3c')]=function(_0x536e6a,_0x418f9c){var _0x5570b1={'raw':!![],'where':{'id':_0x536e6a[_0x4c9b('0x3d')]['id']}},_0x92cbdd={};_0x92cbdd[_0x4c9b('0x27')]=_[_0x4c9b('0x3e')](db['FaxTransferReport'][_0x4c9b('0x3f')]);_0x92cbdd[_0x4c9b('0x28')]=_[_0x4c9b('0x3e')](_0x536e6a[_0x4c9b('0x28')]);_0x92cbdd[_0x4c9b('0x29')]=_[_0x4c9b('0x2b')](_0x92cbdd['model'],_0x92cbdd[_0x4c9b('0x28')]);_0x5570b1[_0x4c9b('0x2a')]=_[_0x4c9b('0x2b')](_0x92cbdd[_0x4c9b('0x27')],qs['fields'](_0x536e6a[_0x4c9b('0x28')]['fields']));_0x5570b1[_0x4c9b('0x2a')]=_0x5570b1[_0x4c9b('0x2a')][_0x4c9b('0x2d')]?_0x5570b1[_0x4c9b('0x2a')]:_0x92cbdd['model'];if(_0x536e6a[_0x4c9b('0x28')][_0x4c9b('0x38')]){_0x5570b1[_0x4c9b('0x39')]=[{'all':!![]}];}_0x5570b1=_[_0x4c9b('0x35')]({},_0x5570b1,_0x536e6a[_0x4c9b('0x37')]);return db['FaxTransferReport'][_0x4c9b('0x40')](_0x5570b1)[_0x4c9b('0x1d')](handleEntityNotFound(_0x418f9c,null))[_0x4c9b('0x1d')](respondWithResult(_0x418f9c,null))[_0x4c9b('0x41')](handleError(_0x418f9c,null));};exports[_0x4c9b('0x42')]=function(_0x19766f,_0x359067){return db['FaxTransferReport'][_0x4c9b('0x42')](_0x19766f[_0x4c9b('0x43')],{})[_0x4c9b('0x1d')](respondWithResult(_0x359067,0xc9))[_0x4c9b('0x41')](handleError(_0x359067,null));};exports[_0x4c9b('0x44')]=function(_0x91bb12,_0x395e40){if(_0x91bb12['body']['id']){delete _0x91bb12[_0x4c9b('0x43')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x91bb12[_0x4c9b('0x3d')]['id']}})[_0x4c9b('0x1d')](handleEntityNotFound(_0x395e40,null))[_0x4c9b('0x1d')](saveUpdates(_0x91bb12['body'],null))['then'](respondWithResult(_0x395e40,null))[_0x4c9b('0x41')](handleError(_0x395e40,null));};exports[_0x4c9b('0x45')]=function(_0x2cd5d6,_0xa88b07){return db[_0x4c9b('0x25')][_0x4c9b('0x40')]({'where':{'id':_0x2cd5d6[_0x4c9b('0x3d')]['id']}})['then'](handleEntityNotFound(_0xa88b07,null))['then'](removeEntity(_0xa88b07,null))['catch'](handleError(_0xa88b07,null));};exports[_0x4c9b('0x46')]=function(_0xd9b641,_0x54904e){return db[_0x4c9b('0x25')][_0x4c9b('0x46')]()[_0x4c9b('0x1d')](respondWithResult(_0x54904e,null))[_0x4c9b('0x41')](handleError(_0x54904e,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2189ee7..878adc3 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 _0xa8ae=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0xb75639,_0x17599d){var _0x3d3497=function(_0xcc9640){while(--_0xcc9640){_0xb75639['push'](_0xb75639['shift']());}};_0x3d3497(++_0x17599d);}(_0xa8ae,0x94));var _0xea8a=function(_0x11d5fb,_0x299395){_0x11d5fb=_0x11d5fb-0x0;var _0x339a0d=_0xa8ae[_0x11d5fb];return _0x339a0d;};'use strict';var _=require(_0xea8a('0x0'));var util=require(_0xea8a('0x1'));var logger=require(_0xea8a('0x2'))(_0xea8a('0x3'));var moment=require(_0xea8a('0x4'));var BPromise=require(_0xea8a('0x5'));var rp=require(_0xea8a('0x6'));var fs=require('fs');var path=require(_0xea8a('0x7'));var rimraf=require(_0xea8a('0x8'));var config=require('../../config/environment');var attributes=require(_0xea8a('0x9'));module[_0xea8a('0xa')]=function(_0x4921d1,_0x56aa79){return _0x4921d1[_0xea8a('0xb')](_0xea8a('0xc'),attributes,{'tableName':_0xea8a('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xea8a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa71a=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','FaxTransferReport','report_fax_transfer','lodash'];(function(_0xfef9e1,_0x571e5a){var _0x278f3d=function(_0x433ee6){while(--_0x433ee6){_0xfef9e1['push'](_0xfef9e1['shift']());}};_0x278f3d(++_0x571e5a);}(_0xa71a,0xf1));var _0xaa71=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa71a[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xaa71('0x0'));var util=require(_0xaa71('0x1'));var logger=require(_0xaa71('0x2'))(_0xaa71('0x3'));var moment=require('moment');var BPromise=require(_0xaa71('0x4'));var rp=require(_0xaa71('0x5'));var fs=require('fs');var path=require(_0xaa71('0x6'));var rimraf=require('rimraf');var config=require(_0xaa71('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xaa71('0x8')]=function(_0x2f476b,_0x1f07bd){return _0x2f476b['define'](_0xaa71('0x9'),attributes,{'tableName':_0xaa71('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b61dce5..7c06dbb 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 _0xe78e=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','then'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe78e,0xee));var _0xee78=function(_0x455a69,_0x16e659){_0x455a69=_0x455a69-0x0;var _0x3b74e2=_0xe78e[_0x455a69];return _0x3b74e2;};'use strict';var _=require(_0xee78('0x0'));var util=require('util');var moment=require(_0xee78('0x1'));var BPromise=require('bluebird');var rs=require(_0xee78('0x2'));var fs=require('fs');var Redis=require(_0xee78('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xee78('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xee78('0x5'));var jayson=require(_0xee78('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7600,_0x4cef60,_0xe85984){return new BPromise(function(_0x2207ea,_0x22a943){return client[_0xee78('0x7')](_0x3c7600,_0xe85984)[_0xee78('0x8')](function(_0x54f083){logger[_0xee78('0x9')](_0xee78('0xa'),_0x4cef60,_0xee78('0xb'));logger['debug'](_0xee78('0xc'),_0x4cef60,_0xee78('0xb'),JSON[_0xee78('0xd')](_0x54f083));if(_0x54f083[_0xee78('0xe')]){if(_0x54f083['error'][_0xee78('0xf')]===0x1f4){logger[_0xee78('0xe')](_0xee78('0xa'),_0x4cef60,_0x54f083['error'][_0xee78('0x10')]);return _0x22a943(_0x54f083[_0xee78('0xe')][_0xee78('0x10')]);}logger[_0xee78('0xe')](_0xee78('0xa'),_0x4cef60,_0x54f083[_0xee78('0xe')][_0xee78('0x10')]);return _0x2207ea(_0x54f083[_0xee78('0xe')][_0xee78('0x10')]);}else{logger['info'](_0xee78('0xa'),_0x4cef60,'request\x20sent');_0x2207ea(_0x54f083[_0xee78('0x11')]['message']);}})[_0xee78('0x12')](function(_0x25186e){logger[_0xee78('0xe')](_0xee78('0xa'),_0x4cef60,_0x25186e);_0x22a943(_0x25186e);});});} \ No newline at end of file +var _0x1226=['code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xad4e44,_0x102755){var _0x3364f9=function(_0xcdf63f){while(--_0xcdf63f){_0xad4e44['push'](_0xad4e44['shift']());}};_0x3364f9(++_0x102755);}(_0x1226,0x191));var _0x6122=function(_0x4ae0d9,_0x21cd90){_0x4ae0d9=_0x4ae0d9-0x0;var _0x2bba53=_0x1226[_0x4ae0d9];return _0x2bba53;};'use strict';var _=require(_0x6122('0x0'));var util=require(_0x6122('0x1'));var moment=require(_0x6122('0x2'));var BPromise=require('bluebird');var rs=require(_0x6122('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6122('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6122('0x5'));var jayson=require(_0x6122('0x6'));var client=jayson[_0x6122('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49ae46,_0x23e44d,_0x1cb796){return new BPromise(function(_0x1793c3,_0x23d381){return client['request'](_0x49ae46,_0x1cb796)['then'](function(_0x3380f3){logger[_0x6122('0x8')]('FaxTransferReport,\x20%s,\x20%s',_0x23e44d,_0x6122('0x9'));logger[_0x6122('0xa')](_0x6122('0xb'),_0x23e44d,_0x6122('0x9'),JSON['stringify'](_0x3380f3));if(_0x3380f3[_0x6122('0xc')]){if(_0x3380f3[_0x6122('0xc')][_0x6122('0xd')]===0x1f4){logger[_0x6122('0xc')](_0x6122('0xe'),_0x23e44d,_0x3380f3[_0x6122('0xc')][_0x6122('0xf')]);return _0x23d381(_0x3380f3['error'][_0x6122('0xf')]);}logger[_0x6122('0xc')](_0x6122('0xe'),_0x23e44d,_0x3380f3['error'][_0x6122('0xf')]);return _0x1793c3(_0x3380f3[_0x6122('0xc')][_0x6122('0xf')]);}else{logger[_0x6122('0x8')]('FaxTransferReport,\x20%s,\x20%s',_0x23e44d,'request\x20sent');_0x1793c3(_0x3380f3[_0x6122('0x10')][_0x6122('0xf')]);}})[_0x6122('0x11')](function(_0x2c1768){logger[_0x6122('0xc')](_0x6122('0xe'),_0x23e44d,_0x2c1768);_0x23d381(_0x2c1768);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 29d480a..1d92d27 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 _0x96fc=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','multer','util'];(function(_0x903334,_0xcf892c){var _0x33319e=function(_0x3cf2f8){while(--_0x3cf2f8){_0x903334['push'](_0x903334['shift']());}};_0x33319e(++_0xcf892c);}(_0x96fc,0x12e));var _0xc96f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x96fc[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xc96f('0x0'));var util=require(_0xc96f('0x1'));var path=require(_0xc96f('0x2'));var timeout=require(_0xc96f('0x3'));var express=require('express');var router=express[_0xc96f('0x4')]();var fs_extra=require(_0xc96f('0x5'));var auth=require(_0xc96f('0x6'));var interaction=require(_0xc96f('0x7'));var config=require('../../config/environment');var controller=require(_0xc96f('0x8'));router[_0xc96f('0x9')]('/',auth[_0xc96f('0xa')](),controller[_0xc96f('0xb')]);router[_0xc96f('0x9')](_0xc96f('0xc'),auth[_0xc96f('0xa')](),controller[_0xc96f('0xd')]);router['get'](_0xc96f('0xe'),auth[_0xc96f('0xa')](),controller[_0xc96f('0xf')]);router[_0xc96f('0x10')]('/',auth[_0xc96f('0xa')](),controller['create']);router[_0xc96f('0x11')](_0xc96f('0xe'),auth[_0xc96f('0xa')](),controller[_0xc96f('0x12')]);router['delete'](_0xc96f('0xe'),auth[_0xc96f('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc31c=['/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x48325f,_0x33154b){var _0x833ee1=function(_0x3ca6ff){while(--_0x3ca6ff){_0x48325f['push'](_0x48325f['shift']());}};_0x833ee1(++_0x33154b);}(_0xc31c,0x184));var _0xcc31=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc31c[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0xcc31('0x0'));var path=require(_0xcc31('0x1'));var timeout=require(_0xcc31('0x2'));var express=require('express');var router=express[_0xcc31('0x3')]();var fs_extra=require(_0xcc31('0x4'));var auth=require(_0xcc31('0x5'));var interaction=require(_0xcc31('0x6'));var config=require('../../config/environment');var controller=require(_0xcc31('0x7'));router[_0xcc31('0x8')]('/',auth[_0xcc31('0x9')](),controller[_0xcc31('0xa')]);router[_0xcc31('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xcc31('0xb')]);router['get'](_0xcc31('0xc'),auth[_0xcc31('0x9')](),controller[_0xcc31('0xd')]);router[_0xcc31('0xe')]('/',auth[_0xcc31('0x9')](),controller[_0xcc31('0xf')]);router[_0xcc31('0x10')]('/:id',auth[_0xcc31('0x9')](),controller[_0xcc31('0x11')]);router[_0xcc31('0x12')]('/:id',auth[_0xcc31('0x9')](),controller['destroy']);module[_0xcc31('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 603be98..2e40104 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 _0x050d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports'];(function(_0x53672f,_0x420d8e){var _0xc50c93=function(_0x38807a){while(--_0x38807a){_0x53672f['push'](_0x53672f['shift']());}};_0xc50c93(++_0x420d8e);}(_0x050d,0x68));var _0xd050=function(_0x2c8390,_0x2361c2){_0x2c8390=_0x2c8390-0x0;var _0x48c47d=_0x050d[_0x2c8390];return _0x48c47d;};'use strict';var multer=require(_0xd050('0x0'));var util=require(_0xd050('0x1'));var path=require(_0xd050('0x2'));var timeout=require(_0xd050('0x3'));var express=require(_0xd050('0x4'));var router=express[_0xd050('0x5')]();var fs_extra=require(_0xd050('0x6'));var auth=require(_0xd050('0x7'));var interaction=require(_0xd050('0x8'));var config=require(_0xd050('0x9'));var controller=require(_0xd050('0xa'));router[_0xd050('0xb')]('/',auth[_0xd050('0xc')](),controller[_0xd050('0xd')]);router[_0xd050('0xb')]('/:id',auth[_0xd050('0xc')](),controller[_0xd050('0xe')]);router[_0xd050('0xb')](_0xd050('0xf'),auth[_0xd050('0xc')](),controller[_0xd050('0x10')]);router[_0xd050('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd050('0x11')]);router[_0xd050('0x12')]('/',auth[_0xd050('0xc')](),controller[_0xd050('0x13')]);router[_0xd050('0x12')](_0xd050('0xf'),auth[_0xd050('0xc')](),controller[_0xd050('0x14')]);router[_0xd050('0x15')](_0xd050('0x16'),auth[_0xd050('0xc')](),controller[_0xd050('0x17')]);router['delete'](_0xd050('0x16'),auth[_0xd050('0xc')](),controller[_0xd050('0x18')]);module[_0xd050('0x19')]=router; \ No newline at end of file +var _0xd6d3=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','show','/:id/configurations','getConfigurations','get','/:id/fields','post','create','addConfiguration','/:id','update'];(function(_0x16292a,_0x53efe1){var _0x58245c=function(_0x3cc96d){while(--_0x3cc96d){_0x16292a['push'](_0x16292a['shift']());}};_0x58245c(++_0x53efe1);}(_0xd6d3,0x163));var _0x3d6d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd6d3[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x3d6d('0x0'));var util=require(_0x3d6d('0x1'));var path=require('path');var timeout=require(_0x3d6d('0x2'));var express=require('express');var router=express[_0x3d6d('0x3')]();var fs_extra=require(_0x3d6d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3d6d('0x5'));var controller=require(_0x3d6d('0x6'));router['get']('/',auth[_0x3d6d('0x7')](),controller[_0x3d6d('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3d6d('0x9')]);router['get'](_0x3d6d('0xa'),auth['isAuthenticated'](),controller[_0x3d6d('0xb')]);router[_0x3d6d('0xc')](_0x3d6d('0xd'),auth[_0x3d6d('0x7')](),controller['getFields']);router[_0x3d6d('0xe')]('/',auth[_0x3d6d('0x7')](),controller[_0x3d6d('0xf')]);router[_0x3d6d('0xe')](_0x3d6d('0xa'),auth[_0x3d6d('0x7')](),controller[_0x3d6d('0x10')]);router['put'](_0x3d6d('0x11'),auth[_0x3d6d('0x7')](),controller[_0x3d6d('0x12')]);router[_0x3d6d('0x13')](_0x3d6d('0x11'),auth['isAuthenticated'](),controller[_0x3d6d('0x14')]);module[_0x3d6d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5b03fa0..de1d975 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 _0xb81a=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x15f11f,_0x1188e8){var _0x566797=function(_0x5a5650){while(--_0x5a5650){_0x15f11f['push'](_0x15f11f['shift']());}};_0x566797(++_0x1188e8);}(_0xb81a,0x193));var _0xab81=function(_0x4ee886,_0x5e69d0){_0x4ee886=_0x4ee886-0x0;var _0x4fb719=_0xb81a[_0x4ee886];return _0x4fb719;};'use strict';var Sequelize=require(_0xab81('0x0'));module[_0xab81('0x1')]={'name':{'type':Sequelize[_0xab81('0x2')]},'description':{'type':Sequelize[_0xab81('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xab81('0x3')](_0xab81('0x4')),'defaultValue':_0xab81('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xab81('0x2')]},'token':{'type':Sequelize[_0xab81('0x2')]},'tokenSecret':{'type':Sequelize[_0xab81('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xab81('0x3')](_0xab81('0x5'),_0xab81('0x6')),'defaultValue':_0xab81('0x5')}}; \ No newline at end of file +var _0x28ee=['basic','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x28ee,0x170));var _0xe28e=function(_0x583ba8,_0x40bb0d){_0x583ba8=_0x583ba8-0x0;var _0x515683=_0x28ee[_0x583ba8];return _0x515683;};'use strict';var Sequelize=require(_0xe28e('0x0'));module[_0xe28e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe28e('0x2')]},'username':{'type':Sequelize[_0xe28e('0x2')]},'remoteUri':{'type':Sequelize[_0xe28e('0x2')]},'authType':{'type':Sequelize[_0xe28e('0x3')](_0xe28e('0x4')),'defaultValue':_0xe28e('0x4')},'password':{'type':Sequelize[_0xe28e('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xe28e('0x2')]},'serverUrl':{'type':Sequelize[_0xe28e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe28e('0x3')]('integrationTab','newTab'),'defaultValue':_0xe28e('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a1d50a1..a556d36 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 _0x14be=['undefined','count','apply','reject','save','update','destroy','then','error','stack','name','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','options','findAll','rows','catch','show','params','fields','includeAll','include','merge','find','create','body','findOne','order','pick','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','password','consumerSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','%s:%s','username','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x14be,0xb6));var _0xe14b=function(_0x4ec29f,_0x7d1c9){_0x4ec29f=_0x4ec29f-0x0;var _0x269c13=_0x14be[_0x4ec29f];return _0x269c13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe14b('0x0'));var zipdir=require(_0xe14b('0x1'));var jsonpatch=require(_0xe14b('0x2'));var rp=require(_0xe14b('0x3'));var moment=require(_0xe14b('0x4'));var BPromise=require(_0xe14b('0x5'));var Mustache=require(_0xe14b('0x6'));var util=require(_0xe14b('0x7'));var path=require('path');var sox=require(_0xe14b('0x8'));var csv=require('to-csv');var ejs=require(_0xe14b('0x9'));var fs=require('fs');var fs_extra=require(_0xe14b('0xa'));var _=require(_0xe14b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe14b('0xc'));var toCsv=require(_0xe14b('0xd'));var querystring=require(_0xe14b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe14b('0xf'));var qs=require(_0xe14b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe14b('0x11'));var config=require(_0xe14b('0x12'));var licenseUtil=require(_0xe14b('0x13'));var db=require(_0xe14b('0x14'))['db'];var integrations=require(_0xe14b('0x15'));function respondWithStatusCode(_0x29b19b,_0x1c5b1f){_0x1c5b1f=_0x1c5b1f||0xcc;return function(_0x4341a5){if(_0x4341a5){return _0x29b19b[_0xe14b('0x16')](_0x1c5b1f);}return _0x29b19b[_0xe14b('0x17')](_0x1c5b1f)['end']();};}function respondWithResult(_0xe57012,_0x388765){_0x388765=_0x388765||0xc8;return function(_0x59b157){if(_0x59b157){return _0xe57012['status'](_0x388765)[_0xe14b('0x18')](_0x59b157);}};}function respondWithFilteredResult(_0x5071c7,_0x3b63c1){return function(_0xaf4998){if(_0xaf4998){var _0x494cd0=typeof _0x3b63c1[_0xe14b('0x19')]==='undefined'&&typeof _0x3b63c1['limit']===_0xe14b('0x1a');var _0x2ad8b3=_0xaf4998[_0xe14b('0x1b')];var _0x3c1c29=_0x494cd0?0x0:_0x3b63c1[_0xe14b('0x19')];var _0x33da19=_0x494cd0?_0xaf4998[_0xe14b('0x1b')]:_0x3b63c1['offset']+_0x3b63c1['limit'];var _0x3c954e;if(_0x33da19>=_0x2ad8b3){_0x33da19=_0x2ad8b3;_0x3c954e=0xc8;}else{_0x3c954e=0xce;}_0x5071c7[_0xe14b('0x17')](_0x3c954e);return _0x5071c7['set']('Content-Range',_0x3c1c29+'-'+_0x33da19+'/'+_0x2ad8b3)[_0xe14b('0x18')](_0xaf4998);}return null;};}function patchUpdates(_0x492bd2){return function(_0x518b09){try{jsonpatch[_0xe14b('0x1c')](_0x518b09,_0x492bd2,!![]);}catch(_0x5d688b){return BPromise[_0xe14b('0x1d')](_0x5d688b);}return _0x518b09[_0xe14b('0x1e')]();};}function saveUpdates(_0x18d442,_0x2d04e4){return function(_0x491a4e){if(_0x491a4e){return _0x491a4e[_0xe14b('0x1f')](_0x18d442)['then'](function(_0x113639){return _0x113639;});}return null;};}function removeEntity(_0x1938aa,_0x957108){return function(_0x48299f){if(_0x48299f){return _0x48299f[_0xe14b('0x20')]()[_0xe14b('0x21')](function(){_0x1938aa[_0xe14b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22376d,_0x57fd33){return function(_0x46fbb1){if(!_0x46fbb1){_0x22376d['sendStatus'](0x194);}return _0x46fbb1;};}function handleError(_0x464682,_0x2e1677){_0x2e1677=_0x2e1677||0x1f4;return function(_0x353d73){logger[_0xe14b('0x22')](_0x353d73[_0xe14b('0x23')]);if(_0x353d73[_0xe14b('0x24')]){delete _0x353d73['name'];}_0x464682[_0xe14b('0x17')](_0x2e1677)['send'](_0x353d73);};}exports[_0xe14b('0x25')]=function(_0x5cd484,_0x47a55c){var _0x1b9f39={},_0xc4576d={},_0x4712d2={'count':0x0,'rows':[]};var _0x214b80=_['map'](db[_0xe14b('0x26')][_0xe14b('0x27')],function(_0x68d862){return{'name':_0x68d862[_0xe14b('0x28')],'type':_0x68d862[_0xe14b('0x29')][_0xe14b('0x2a')]};});_0xc4576d[_0xe14b('0x2b')]=_[_0xe14b('0x2c')](_0x214b80,'name');_0xc4576d[_0xe14b('0x2d')]=_[_0xe14b('0x2e')](_0x5cd484[_0xe14b('0x2d')]);_0xc4576d[_0xe14b('0x2f')]=_['intersection'](_0xc4576d[_0xe14b('0x2b')],_0xc4576d[_0xe14b('0x2d')]);_0x1b9f39['attributes']=_[_0xe14b('0x30')](_0xc4576d[_0xe14b('0x2b')],qs['fields'](_0x5cd484[_0xe14b('0x2d')]['fields']));_0x1b9f39[_0xe14b('0x31')]=_0x1b9f39[_0xe14b('0x31')][_0xe14b('0x32')]?_0x1b9f39['attributes']:_0xc4576d[_0xe14b('0x2b')];if(!_0x5cd484['query'][_0xe14b('0x33')](_0xe14b('0x34'))){_0x1b9f39[_0xe14b('0x35')]=qs[_0xe14b('0x35')](_0x5cd484[_0xe14b('0x2d')]['limit']);_0x1b9f39[_0xe14b('0x19')]=qs[_0xe14b('0x19')](_0x5cd484['query']['offset']);}_0x1b9f39['order']=qs[_0xe14b('0x36')](_0x5cd484[_0xe14b('0x2d')][_0xe14b('0x36')]);_0x1b9f39[_0xe14b('0x37')]=qs['filters'](_['pick'](_0x5cd484[_0xe14b('0x2d')],_0xc4576d['filters']),_0x214b80);if(_0x5cd484[_0xe14b('0x2d')][_0xe14b('0x38')]){_0x1b9f39[_0xe14b('0x37')]=_['merge'](_0x1b9f39[_0xe14b('0x37')],{'$or':_[_0xe14b('0x2c')](_0x214b80,function(_0x11c8bc){if(_0x11c8bc[_0xe14b('0x29')]!==_0xe14b('0x39')){var _0x197e4a={};_0x197e4a[_0x11c8bc[_0xe14b('0x24')]]={'$like':'%'+_0x5cd484['query']['filter']+'%'};return _0x197e4a;}})});}_0x1b9f39=_['merge']({},_0x1b9f39,_0x5cd484[_0xe14b('0x3a')]);var _0x11b448={'where':_0x1b9f39[_0xe14b('0x37')]};return db['DeskAccount'][_0xe14b('0x1b')](_0x11b448)[_0xe14b('0x21')](function(_0x1d976b){_0x4712d2['count']=_0x1d976b;if(_0x5cd484[_0xe14b('0x2d')]['includeAll']){_0x1b9f39['include']=[{'all':!![]}];}return db[_0xe14b('0x26')][_0xe14b('0x3b')](_0x1b9f39);})[_0xe14b('0x21')](function(_0x5861c6){_0x4712d2[_0xe14b('0x3c')]=_0x5861c6;return _0x4712d2;})[_0xe14b('0x21')](respondWithFilteredResult(_0x47a55c,_0x1b9f39))[_0xe14b('0x3d')](handleError(_0x47a55c,null));};exports[_0xe14b('0x3e')]=function(_0x4dcd11,_0x1216c1){var _0x2519ee={'raw':![],'where':{'id':_0x4dcd11[_0xe14b('0x3f')]['id']}},_0x8032d5={};_0x8032d5[_0xe14b('0x2b')]=_[_0xe14b('0x2e')](db[_0xe14b('0x26')][_0xe14b('0x27')]);_0x8032d5[_0xe14b('0x2d')]=_[_0xe14b('0x2e')](_0x4dcd11[_0xe14b('0x2d')]);_0x8032d5['filters']=_['intersection'](_0x8032d5['model'],_0x8032d5[_0xe14b('0x2d')]);_0x2519ee[_0xe14b('0x31')]=_[_0xe14b('0x30')](_0x8032d5['model'],qs[_0xe14b('0x40')](_0x4dcd11['query']['fields']));_0x2519ee[_0xe14b('0x31')]=_0x2519ee[_0xe14b('0x31')]['length']?_0x2519ee['attributes']:_0x8032d5['model'];if(_0x4dcd11[_0xe14b('0x2d')][_0xe14b('0x41')]){_0x2519ee[_0xe14b('0x42')]=[{'all':!![]}];}_0x2519ee=_[_0xe14b('0x43')]({},_0x2519ee,_0x4dcd11[_0xe14b('0x3a')]);return db[_0xe14b('0x26')][_0xe14b('0x44')](_0x2519ee)['then'](handleEntityNotFound(_0x1216c1,null))[_0xe14b('0x21')](respondWithResult(_0x1216c1,null))[_0xe14b('0x3d')](handleError(_0x1216c1,null));};exports[_0xe14b('0x45')]=function(_0x574e1a,_0x4d1736){return db[_0xe14b('0x26')][_0xe14b('0x45')](_0x574e1a[_0xe14b('0x46')],{})[_0xe14b('0x21')](respondWithResult(_0x4d1736,0xc9))[_0xe14b('0x3d')](handleError(_0x4d1736,null));};exports[_0xe14b('0x1f')]=function(_0xbba077,_0x597f6b){if(_0xbba077[_0xe14b('0x46')]['id']){delete _0xbba077[_0xe14b('0x46')]['id'];}return db[_0xe14b('0x26')]['find']({'where':{'id':_0xbba077[_0xe14b('0x3f')]['id']}})[_0xe14b('0x21')](handleEntityNotFound(_0x597f6b,null))['then'](saveUpdates(_0xbba077[_0xe14b('0x46')],null))[_0xe14b('0x21')](respondWithResult(_0x597f6b,null))['catch'](handleError(_0x597f6b,null));};exports[_0xe14b('0x20')]=function(_0x2101a8,_0xe8c766){return db[_0xe14b('0x26')][_0xe14b('0x44')]({'where':{'id':_0x2101a8[_0xe14b('0x3f')]['id']}})[_0xe14b('0x21')](handleEntityNotFound(_0xe8c766,null))[_0xe14b('0x21')](removeEntity(_0xe8c766,null))[_0xe14b('0x3d')](handleError(_0xe8c766,null));};exports['getConfigurations']=function(_0x159e04,_0x2228f9,_0x3560f4){var _0x2b12f4={};var _0xe6e3b2={};var _0x125ea1;var _0x2e1354;return db[_0xe14b('0x26')][_0xe14b('0x47')]({'where':{'id':_0x159e04['params']['id']}})[_0xe14b('0x21')](handleEntityNotFound(_0x2228f9,null))[_0xe14b('0x21')](function(_0x5bacad){if(_0x5bacad){_0x125ea1=_0x5bacad;_0xe6e3b2[_0xe14b('0x2b')]=_[_0xe14b('0x2e')](db['DeskConfiguration'][_0xe14b('0x27')]);_0xe6e3b2[_0xe14b('0x2d')]=_['keys'](_0x159e04[_0xe14b('0x2d')]);_0xe6e3b2['filters']=_[_0xe14b('0x30')](_0xe6e3b2['model'],_0xe6e3b2[_0xe14b('0x2d')]);_0x2b12f4['attributes']=_[_0xe14b('0x30')](_0xe6e3b2[_0xe14b('0x2b')],qs['fields'](_0x159e04[_0xe14b('0x2d')][_0xe14b('0x40')]));_0x2b12f4[_0xe14b('0x31')]=_0x2b12f4['attributes'][_0xe14b('0x32')]?_0x2b12f4[_0xe14b('0x31')]:_0xe6e3b2['model'];_0x2b12f4[_0xe14b('0x48')]=qs[_0xe14b('0x36')](_0x159e04[_0xe14b('0x2d')][_0xe14b('0x36')]);_0x2b12f4[_0xe14b('0x37')]=qs[_0xe14b('0x2f')](_[_0xe14b('0x49')](_0x159e04[_0xe14b('0x2d')],_0xe6e3b2[_0xe14b('0x2f')]));if(_0x159e04[_0xe14b('0x2d')][_0xe14b('0x38')]){_0x2b12f4['where']=_[_0xe14b('0x43')](_0x2b12f4[_0xe14b('0x37')],{'$or':_[_0xe14b('0x2c')](_0x2b12f4[_0xe14b('0x31')],function(_0x2d1ef1){var _0xb12a8={};_0xb12a8[_0x2d1ef1]={'$like':'%'+_0x159e04[_0xe14b('0x2d')][_0xe14b('0x38')]+'%'};return _0xb12a8;})});}_0x2b12f4=_['merge']({},_0x2b12f4,_0x159e04['options']);return _0x125ea1[_0xe14b('0x4a')](_0x2b12f4);}})[_0xe14b('0x21')](function(_0x173678){if(_0x173678){_0x2e1354=_0x173678[_0xe14b('0x32')];if(!_0x159e04[_0xe14b('0x2d')][_0xe14b('0x33')](_0xe14b('0x34'))){_0x2b12f4[_0xe14b('0x35')]=qs[_0xe14b('0x35')](_0x159e04[_0xe14b('0x2d')][_0xe14b('0x35')]);_0x2b12f4[_0xe14b('0x19')]=qs[_0xe14b('0x19')](_0x159e04[_0xe14b('0x2d')]['offset']);}return _0x125ea1[_0xe14b('0x4a')](_0x2b12f4);}})[_0xe14b('0x21')](function(_0x321ed9){if(_0x321ed9){return _0x321ed9?{'count':_0x2e1354,'rows':_0x321ed9}:null;}})[_0xe14b('0x21')](respondWithResult(_0x2228f9,null))['catch'](handleError(_0x2228f9,null));};exports[_0xe14b('0x4b')]=function(_0x4f9c08,_0x49727a,_0x382bfb){if(_0x4f9c08[_0xe14b('0x46')]['id']){delete _0x4f9c08['body']['id'];}return db[_0xe14b('0x26')][_0xe14b('0x47')]({'where':{'id':_0x4f9c08['params']['id']}})[_0xe14b('0x21')](handleEntityNotFound(_0x49727a,null))['then'](function(_0x3a2508){if(_0x3a2508){_0x4f9c08[_0xe14b('0x46')][_0xe14b('0x4c')]=_0x3a2508['id'];_0x4f9c08[_0xe14b('0x46')][_0xe14b('0x4d')]=integrations['getSubjects'](_0x4f9c08[_0xe14b('0x46')]['channel'],_0x4f9c08[_0xe14b('0x46')][_0xe14b('0x29')]);_0x4f9c08[_0xe14b('0x46')][_0xe14b('0x4e')]=integrations['getDescriptions'](_0x4f9c08['body']['channel'],_0x4f9c08[_0xe14b('0x46')]['type']);return db[_0xe14b('0x4f')][_0xe14b('0x45')](_0x4f9c08[_0xe14b('0x46')],{'include':[{'model':db[_0xe14b('0x50')],'as':_0xe14b('0x4d')},{'model':db[_0xe14b('0x50')],'as':_0xe14b('0x4e')}]});}return null;})[_0xe14b('0x21')](respondWithResult(_0x49727a,null))['catch'](handleError(_0x49727a,null));};exports[_0xe14b('0x51')]=function(_0x3d6c66,_0xe9ddb3,_0x4afd27){var _0x4f4ea1=[{'name':_0xe14b('0x52'),'label':_0xe14b('0x52'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2bcb95='';return db['DeskAccount'][_0xe14b('0x47')]({'where':{'id':_0x3d6c66[_0xe14b('0x3f')]['id']},'attributes':['id',_0xe14b('0x53'),_0xe14b('0x54'),'username',_0xe14b('0x55'),'consumerKey',_0xe14b('0x56'),'token','tokenSecret']})[_0xe14b('0x21')](handleEntityNotFound(_0xe9ddb3,null))[_0xe14b('0x21')](function(_0x39611d){if(_0x39611d){_0x2bcb95=_0x39611d[_0xe14b('0x53')];var _0x4b5ed2=_0x2bcb95[_0xe14b('0x57')](-0x1);if(_0x4b5ed2==='/'){_0x2bcb95=_0x2bcb95[_0xe14b('0x58')](0x0,_0x2bcb95[_0xe14b('0x59')](_0x4b5ed2));}var _0x2e1321={'method':'GET','uri':util[_0xe14b('0x5a')](_0xe14b('0x5b'),_0x2bcb95),'headers':{'Content-Type':_0xe14b('0x5c'),'Accept':_0xe14b('0x5c')},'json':!![]};if(_0x39611d[_0xe14b('0x54')]===_0xe14b('0x5d')){_0x2e1321[_0xe14b('0x5e')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util[_0xe14b('0x5a')](_0xe14b('0x5f'),_0x39611d[_0xe14b('0x60')],_0x39611d[_0xe14b('0x55')]))['toString']('base64'));}return rp(_0x2e1321)[_0xe14b('0x21')](function(_0x5f4ef6){return _0x4f4ea1['concat'](_[_0xe14b('0x2c')](_0x5f4ef6[_0xe14b('0x61')][_0xe14b('0x62')],function(_0x2b05f0){return{'id':_0x2b05f0['name'],'name':_0x2b05f0[_0xe14b('0x24')],'type':_0x2b05f0['type'],'active':_0x2b05f0['active'],'label':_0x2b05f0[_0xe14b('0x63')],'custom':!![]};}));});}})['then'](function(_0x3c599e){return{'count':_0x3c599e[_0xe14b('0x32')],'rows':_0x3c599e};})['then'](respondWithResult(_0xe9ddb3,null))[_0xe14b('0x3d')](function(_0x1ff0c2){var _0x279d1a=_0x3d6c66[_0xe14b('0x2d')][_0xe14b('0x64')]?0x1f4:_0x1ff0c2[_0xe14b('0x65')]||0x1f4;logger[_0xe14b('0x22')](_0xe14b('0x66'),_0xe14b('0x51'),_0x279d1a,JSON['stringify'](_0x1ff0c2));delete _0x1ff0c2[_0xe14b('0x24')];if(_0x279d1a===0x191){_0x279d1a=0x190;}_0xe9ddb3[_0xe14b('0x17')](_0x279d1a)[_0xe14b('0x67')](_0x3d6c66[_0xe14b('0x2d')][_0xe14b('0x64')]?{'message':'Wrong\x20credentials','statusCode':_0x1ff0c2[_0xe14b('0x65')]}:_0x1ff0c2);});}; \ No newline at end of file +var _0x3849=['nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','getConfigurations','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','Descriptions','DeskConfiguration','DeskField','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','format','application/json','basic','Basic\x20%s','%s:%s','concat','_embedded','entries','active','label','test','statusCode','error','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','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','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','index','map','DeskAccount','fieldName','type','model','query','keys','intersection','attributes','fields'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3849,0x1f3));var _0x9384=function(_0x22541c,_0x5e7c24){_0x22541c=_0x22541c-0x0;var _0x2c5667=_0x3849[_0x22541c];return _0x2c5667;};'use strict';var emlformat=require(_0x9384('0x0'));var rimraf=require(_0x9384('0x1'));var zipdir=require(_0x9384('0x2'));var jsonpatch=require(_0x9384('0x3'));var rp=require(_0x9384('0x4'));var moment=require(_0x9384('0x5'));var BPromise=require(_0x9384('0x6'));var Mustache=require('mustache');var util=require(_0x9384('0x7'));var path=require(_0x9384('0x8'));var sox=require(_0x9384('0x9'));var csv=require(_0x9384('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9384('0xb'));var squel=require(_0x9384('0xc'));var crypto=require(_0x9384('0xd'));var jsforce=require(_0x9384('0xe'));var deskjs=require(_0x9384('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9384('0x10'));var Papa=require(_0x9384('0x11'));var Redis=require(_0x9384('0x12'));var authService=require(_0x9384('0x13'));var qs=require(_0x9384('0x14'));var as=require(_0x9384('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9384('0x16'));var utils=require('../../config/utils');var config=require(_0x9384('0x17'));var licenseUtil=require(_0x9384('0x18'));var db=require(_0x9384('0x19'))['db'];var integrations=require(_0x9384('0x1a'));function respondWithStatusCode(_0x46124d,_0x1ea5e6){_0x1ea5e6=_0x1ea5e6||0xcc;return function(_0xb3c9e9){if(_0xb3c9e9){return _0x46124d[_0x9384('0x1b')](_0x1ea5e6);}return _0x46124d['status'](_0x1ea5e6)[_0x9384('0x1c')]();};}function respondWithResult(_0x155381,_0x133ff2){_0x133ff2=_0x133ff2||0xc8;return function(_0x414562){if(_0x414562){return _0x155381[_0x9384('0x1d')](_0x133ff2)['json'](_0x414562);}};}function respondWithFilteredResult(_0x796630,_0x1feb7d){return function(_0x46dde9){if(_0x46dde9){var _0x36fb5d=typeof _0x1feb7d[_0x9384('0x1e')]==='undefined'&&typeof _0x1feb7d[_0x9384('0x1f')]===_0x9384('0x20');var _0x2d2c53=_0x46dde9[_0x9384('0x21')];var _0x3ac0b7=_0x36fb5d?0x0:_0x1feb7d[_0x9384('0x1e')];var _0x1f658f=_0x36fb5d?_0x46dde9['count']:_0x1feb7d['offset']+_0x1feb7d[_0x9384('0x1f')];var _0x58e597;if(_0x1f658f>=_0x2d2c53){_0x1f658f=_0x2d2c53;_0x58e597=0xc8;}else{_0x58e597=0xce;}_0x796630[_0x9384('0x1d')](_0x58e597);return _0x796630[_0x9384('0x22')](_0x9384('0x23'),_0x3ac0b7+'-'+_0x1f658f+'/'+_0x2d2c53)[_0x9384('0x24')](_0x46dde9);}return null;};}function patchUpdates(_0x346e4d){return function(_0x17669b){try{jsonpatch['apply'](_0x17669b,_0x346e4d,!![]);}catch(_0x31cec6){return BPromise[_0x9384('0x25')](_0x31cec6);}return _0x17669b[_0x9384('0x26')]();};}function saveUpdates(_0x13cd94,_0x4f60ac){return function(_0x3659b6){if(_0x3659b6){return _0x3659b6[_0x9384('0x27')](_0x13cd94)['then'](function(_0x6494){return _0x6494;});}return null;};}function removeEntity(_0x33295e,_0x1d36dc){return function(_0x2a9eff){if(_0x2a9eff){return _0x2a9eff[_0x9384('0x28')]()[_0x9384('0x29')](function(){_0x33295e['status'](0xcc)[_0x9384('0x1c')]();});}};}function handleEntityNotFound(_0x5bd5f6,_0x322389){return function(_0xe8dcfe){if(!_0xe8dcfe){_0x5bd5f6[_0x9384('0x1b')](0x194);}return _0xe8dcfe;};}function handleError(_0x36289b,_0x3db406){_0x3db406=_0x3db406||0x1f4;return function(_0x10a26f){logger['error'](_0x10a26f[_0x9384('0x2a')]);if(_0x10a26f[_0x9384('0x2b')]){delete _0x10a26f[_0x9384('0x2b')];}_0x36289b[_0x9384('0x1d')](_0x3db406)[_0x9384('0x2c')](_0x10a26f);};}exports[_0x9384('0x2d')]=function(_0x4e3ddc,_0x4221ee){var _0x3cecd3={},_0x4b19be={},_0x5324f5={'count':0x0,'rows':[]};var _0x13d54b=_[_0x9384('0x2e')](db[_0x9384('0x2f')]['rawAttributes'],function(_0x3f24b8){return{'name':_0x3f24b8[_0x9384('0x30')],'type':_0x3f24b8[_0x9384('0x31')]['key']};});_0x4b19be[_0x9384('0x32')]=_[_0x9384('0x2e')](_0x13d54b,_0x9384('0x2b'));_0x4b19be[_0x9384('0x33')]=_[_0x9384('0x34')](_0x4e3ddc['query']);_0x4b19be['filters']=_[_0x9384('0x35')](_0x4b19be[_0x9384('0x32')],_0x4b19be[_0x9384('0x33')]);_0x3cecd3[_0x9384('0x36')]=_['intersection'](_0x4b19be['model'],qs[_0x9384('0x37')](_0x4e3ddc[_0x9384('0x33')]['fields']));_0x3cecd3[_0x9384('0x36')]=_0x3cecd3[_0x9384('0x36')]['length']?_0x3cecd3[_0x9384('0x36')]:_0x4b19be['model'];if(!_0x4e3ddc['query']['hasOwnProperty'](_0x9384('0x38'))){_0x3cecd3[_0x9384('0x1f')]=qs[_0x9384('0x1f')](_0x4e3ddc[_0x9384('0x33')][_0x9384('0x1f')]);_0x3cecd3[_0x9384('0x1e')]=qs[_0x9384('0x1e')](_0x4e3ddc[_0x9384('0x33')]['offset']);}_0x3cecd3[_0x9384('0x39')]=qs['sort'](_0x4e3ddc['query'][_0x9384('0x3a')]);_0x3cecd3['where']=qs['filters'](_[_0x9384('0x3b')](_0x4e3ddc[_0x9384('0x33')],_0x4b19be[_0x9384('0x3c')]),_0x13d54b);if(_0x4e3ddc[_0x9384('0x33')][_0x9384('0x3d')]){_0x3cecd3[_0x9384('0x3e')]=_[_0x9384('0x3f')](_0x3cecd3[_0x9384('0x3e')],{'$or':_[_0x9384('0x2e')](_0x13d54b,function(_0x3c097c){if(_0x3c097c['type']!==_0x9384('0x40')){var _0x108694={};_0x108694[_0x3c097c['name']]={'$like':'%'+_0x4e3ddc[_0x9384('0x33')]['filter']+'%'};return _0x108694;}})});}_0x3cecd3=_[_0x9384('0x3f')]({},_0x3cecd3,_0x4e3ddc[_0x9384('0x41')]);var _0x5d47b7={'where':_0x3cecd3[_0x9384('0x3e')]};return db[_0x9384('0x2f')][_0x9384('0x21')](_0x5d47b7)[_0x9384('0x29')](function(_0x226e49){_0x5324f5[_0x9384('0x21')]=_0x226e49;if(_0x4e3ddc[_0x9384('0x33')][_0x9384('0x42')]){_0x3cecd3[_0x9384('0x43')]=[{'all':!![]}];}return db[_0x9384('0x2f')]['findAll'](_0x3cecd3);})[_0x9384('0x29')](function(_0x37ca16){_0x5324f5[_0x9384('0x44')]=_0x37ca16;return _0x5324f5;})[_0x9384('0x29')](respondWithFilteredResult(_0x4221ee,_0x3cecd3))[_0x9384('0x45')](handleError(_0x4221ee,null));};exports[_0x9384('0x46')]=function(_0xaa83c8,_0x3c5094){var _0x207f38={'raw':![],'where':{'id':_0xaa83c8[_0x9384('0x47')]['id']}},_0x142afc={};_0x142afc[_0x9384('0x32')]=_['keys'](db['DeskAccount'][_0x9384('0x48')]);_0x142afc[_0x9384('0x33')]=_['keys'](_0xaa83c8[_0x9384('0x33')]);_0x142afc[_0x9384('0x3c')]=_[_0x9384('0x35')](_0x142afc[_0x9384('0x32')],_0x142afc[_0x9384('0x33')]);_0x207f38[_0x9384('0x36')]=_[_0x9384('0x35')](_0x142afc[_0x9384('0x32')],qs['fields'](_0xaa83c8[_0x9384('0x33')][_0x9384('0x37')]));_0x207f38[_0x9384('0x36')]=_0x207f38['attributes'][_0x9384('0x49')]?_0x207f38['attributes']:_0x142afc['model'];if(_0xaa83c8['query'][_0x9384('0x42')]){_0x207f38[_0x9384('0x43')]=[{'all':!![]}];}_0x207f38=_[_0x9384('0x3f')]({},_0x207f38,_0xaa83c8[_0x9384('0x41')]);return db[_0x9384('0x2f')][_0x9384('0x4a')](_0x207f38)[_0x9384('0x29')](handleEntityNotFound(_0x3c5094,null))[_0x9384('0x29')](respondWithResult(_0x3c5094,null))[_0x9384('0x45')](handleError(_0x3c5094,null));};exports[_0x9384('0x4b')]=function(_0x1106b7,_0x301e03){return db[_0x9384('0x2f')][_0x9384('0x4b')](_0x1106b7[_0x9384('0x4c')],{})[_0x9384('0x29')](respondWithResult(_0x301e03,0xc9))[_0x9384('0x45')](handleError(_0x301e03,null));};exports[_0x9384('0x27')]=function(_0x1c3141,_0xfa1ba3){if(_0x1c3141[_0x9384('0x4c')]['id']){delete _0x1c3141[_0x9384('0x4c')]['id'];}return db['DeskAccount'][_0x9384('0x4a')]({'where':{'id':_0x1c3141[_0x9384('0x47')]['id']}})[_0x9384('0x29')](handleEntityNotFound(_0xfa1ba3,null))[_0x9384('0x29')](saveUpdates(_0x1c3141[_0x9384('0x4c')],null))[_0x9384('0x29')](respondWithResult(_0xfa1ba3,null))['catch'](handleError(_0xfa1ba3,null));};exports['destroy']=function(_0x110544,_0x36252e){return db[_0x9384('0x2f')][_0x9384('0x4a')]({'where':{'id':_0x110544['params']['id']}})[_0x9384('0x29')](handleEntityNotFound(_0x36252e,null))['then'](removeEntity(_0x36252e,null))[_0x9384('0x45')](handleError(_0x36252e,null));};exports[_0x9384('0x4d')]=function(_0x427a88,_0x32b389,_0x1f9975){var _0x330ac0={};var _0xfb530d={};var _0x1f3ec9;var _0xb3c956;return db[_0x9384('0x2f')]['findOne']({'where':{'id':_0x427a88[_0x9384('0x47')]['id']}})[_0x9384('0x29')](handleEntityNotFound(_0x32b389,null))[_0x9384('0x29')](function(_0x1fbdac){if(_0x1fbdac){_0x1f3ec9=_0x1fbdac;_0xfb530d[_0x9384('0x32')]=_[_0x9384('0x34')](db['DeskConfiguration'][_0x9384('0x48')]);_0xfb530d[_0x9384('0x33')]=_['keys'](_0x427a88[_0x9384('0x33')]);_0xfb530d[_0x9384('0x3c')]=_[_0x9384('0x35')](_0xfb530d[_0x9384('0x32')],_0xfb530d[_0x9384('0x33')]);_0x330ac0[_0x9384('0x36')]=_[_0x9384('0x35')](_0xfb530d[_0x9384('0x32')],qs[_0x9384('0x37')](_0x427a88[_0x9384('0x33')][_0x9384('0x37')]));_0x330ac0[_0x9384('0x36')]=_0x330ac0['attributes'][_0x9384('0x49')]?_0x330ac0['attributes']:_0xfb530d['model'];_0x330ac0[_0x9384('0x39')]=qs['sort'](_0x427a88[_0x9384('0x33')][_0x9384('0x3a')]);_0x330ac0['where']=qs['filters'](_[_0x9384('0x3b')](_0x427a88[_0x9384('0x33')],_0xfb530d[_0x9384('0x3c')]));if(_0x427a88[_0x9384('0x33')]['filter']){_0x330ac0['where']=_[_0x9384('0x3f')](_0x330ac0['where'],{'$or':_[_0x9384('0x2e')](_0x330ac0['attributes'],function(_0xa89544){var _0x53e187={};_0x53e187[_0xa89544]={'$like':'%'+_0x427a88['query'][_0x9384('0x3d')]+'%'};return _0x53e187;})});}_0x330ac0=_[_0x9384('0x3f')]({},_0x330ac0,_0x427a88[_0x9384('0x41')]);return _0x1f3ec9[_0x9384('0x4d')](_0x330ac0);}})[_0x9384('0x29')](function(_0x1e27a0){if(_0x1e27a0){_0xb3c956=_0x1e27a0[_0x9384('0x49')];if(!_0x427a88[_0x9384('0x33')][_0x9384('0x4e')](_0x9384('0x38'))){_0x330ac0['limit']=qs[_0x9384('0x1f')](_0x427a88['query'][_0x9384('0x1f')]);_0x330ac0['offset']=qs['offset'](_0x427a88['query']['offset']);}return _0x1f3ec9[_0x9384('0x4d')](_0x330ac0);}})['then'](function(_0x241406){if(_0x241406){return _0x241406?{'count':_0xb3c956,'rows':_0x241406}:null;}})['then'](respondWithResult(_0x32b389,null))[_0x9384('0x45')](handleError(_0x32b389,null));};exports['addConfiguration']=function(_0x2429e7,_0x22fe9a,_0x40e539){if(_0x2429e7[_0x9384('0x4c')]['id']){delete _0x2429e7[_0x9384('0x4c')]['id'];}return db[_0x9384('0x2f')][_0x9384('0x4f')]({'where':{'id':_0x2429e7[_0x9384('0x47')]['id']}})['then'](handleEntityNotFound(_0x22fe9a,null))[_0x9384('0x29')](function(_0x5c3ea9){if(_0x5c3ea9){_0x2429e7[_0x9384('0x4c')][_0x9384('0x50')]=_0x5c3ea9['id'];_0x2429e7[_0x9384('0x4c')][_0x9384('0x51')]=integrations[_0x9384('0x52')](_0x2429e7['body']['channel'],_0x2429e7[_0x9384('0x4c')][_0x9384('0x31')]);_0x2429e7[_0x9384('0x4c')][_0x9384('0x53')]=integrations['getDescriptions'](_0x2429e7['body']['channel'],_0x2429e7[_0x9384('0x4c')][_0x9384('0x31')]);return db[_0x9384('0x54')][_0x9384('0x4b')](_0x2429e7[_0x9384('0x4c')],{'include':[{'model':db['DeskField'],'as':_0x9384('0x51')},{'model':db[_0x9384('0x55')],'as':_0x9384('0x53')}]});}return null;})[_0x9384('0x29')](respondWithResult(_0x22fe9a,null))[_0x9384('0x45')](handleError(_0x22fe9a,null));};exports['getFields']=function(_0x2c08ff,_0x4ad5cc,_0x579644){var _0x234462=[{'name':'priority','label':_0x9384('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 _0x15e8b4='';return db[_0x9384('0x2f')][_0x9384('0x4f')]({'where':{'id':_0x2c08ff[_0x9384('0x47')]['id']},'attributes':['id',_0x9384('0x57'),'authType',_0x9384('0x58'),_0x9384('0x59'),_0x9384('0x5a'),_0x9384('0x5b'),'token',_0x9384('0x5c')]})[_0x9384('0x29')](handleEntityNotFound(_0x4ad5cc,null))[_0x9384('0x29')](function(_0x580fe1){if(_0x580fe1){_0x15e8b4=_0x580fe1[_0x9384('0x57')];var _0x44317f=_0x15e8b4[_0x9384('0x5d')](-0x1);if(_0x44317f==='/'){_0x15e8b4=_0x15e8b4[_0x9384('0x5e')](0x0,_0x15e8b4['lastIndexOf'](_0x44317f));}var _0x1a0651={'method':'GET','uri':util[_0x9384('0x5f')]('%s/custom_fields',_0x15e8b4),'headers':{'Content-Type':_0x9384('0x60'),'Accept':_0x9384('0x60')},'json':!![]};if(_0x580fe1['authType']===_0x9384('0x61')){_0x1a0651['headers']['Authorization']=util[_0x9384('0x5f')](_0x9384('0x62'),new Buffer(util[_0x9384('0x5f')](_0x9384('0x63'),_0x580fe1[_0x9384('0x58')],_0x580fe1[_0x9384('0x59')]))['toString']('base64'));}return rp(_0x1a0651)[_0x9384('0x29')](function(_0x3d9658){return _0x234462[_0x9384('0x64')](_[_0x9384('0x2e')](_0x3d9658[_0x9384('0x65')][_0x9384('0x66')],function(_0x3d77f6){return{'id':_0x3d77f6[_0x9384('0x2b')],'name':_0x3d77f6[_0x9384('0x2b')],'type':_0x3d77f6['type'],'active':_0x3d77f6[_0x9384('0x67')],'label':_0x3d77f6[_0x9384('0x68')],'custom':!![]};}));});}})[_0x9384('0x29')](function(_0x2f6db0){return{'count':_0x2f6db0[_0x9384('0x49')],'rows':_0x2f6db0};})['then'](respondWithResult(_0x4ad5cc,null))[_0x9384('0x45')](function(_0x406a3e){var _0x16c703=_0x2c08ff[_0x9384('0x33')][_0x9384('0x69')]?0x1f4:_0x406a3e[_0x9384('0x6a')]||0x1f4;logger[_0x9384('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0x9384('0x6c'),_0x16c703,JSON[_0x9384('0x6d')](_0x406a3e));delete _0x406a3e[_0x9384('0x2b')];if(_0x16c703===0x191){_0x16c703=0x190;}_0x4ad5cc['status'](_0x16c703)[_0x9384('0x2c')](_0x2c08ff[_0x9384('0x33')][_0x9384('0x69')]?{'message':_0x9384('0x6e'),'statusCode':_0x406a3e[_0x9384('0x6a')]}:_0x406a3e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 69bb34d..1d1f28b 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 _0xfafc=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5646df,_0x13bc73){var _0x149b98=function(_0x46ada3){while(--_0x46ada3){_0x5646df['push'](_0x5646df['shift']());}};_0x149b98(++_0x13bc73);}(_0xfafc,0x11a));var _0xcfaf=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xfafc[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require(_0xcfaf('0x0'));var util=require('util');var logger=require(_0xcfaf('0x1'))(_0xcfaf('0x2'));var moment=require(_0xcfaf('0x3'));var BPromise=require(_0xcfaf('0x4'));var rp=require(_0xcfaf('0x5'));var fs=require('fs');var path=require(_0xcfaf('0x6'));var rimraf=require(_0xcfaf('0x7'));var config=require(_0xcfaf('0x8'));var attributes=require(_0xcfaf('0x9'));var integrations=require(_0xcfaf('0xa'));module['exports']=function(_0x42718d,_0x3c2fc2){return _0x42718d[_0xcfaf('0xb')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1e1=['moment','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','../../config/logger'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xd1e1,0xf8));var _0x1d1e=function(_0x160e9a,_0x568c91){_0x160e9a=_0x160e9a-0x0;var _0x4cc6e5=_0xd1e1[_0x160e9a];return _0x4cc6e5;};'use strict';var _=require(_0x1d1e('0x0'));var util=require('util');var logger=require(_0x1d1e('0x1'))('api');var moment=require(_0x1d1e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1d1e('0x3'));var config=require(_0x1d1e('0x4'));var attributes=require(_0x1d1e('0x5'));var integrations=require(_0x1d1e('0x6'));module['exports']=function(_0x433ce2,_0x19f340){return _0x433ce2[_0x1d1e('0x7')](_0x1d1e('0x8'),attributes,{'tableName':_0x1d1e('0x9'),'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 6582f6e..442385b 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 _0xef5e=['attributes','include','map','model','debug','ShowDeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where'];(function(_0xbd551,_0x4e1857){var _0x49601e=function(_0x495fdc){while(--_0x495fdc){_0xbd551['push'](_0xbd551['shift']());}};_0x49601e(++_0x4e1857);}(_0xef5e,0x11d));var _0xeef5=function(_0x4a1afe,_0xecc212){_0x4a1afe=_0x4a1afe-0x0;var _0x14c420=_0xef5e[_0x4a1afe];return _0x14c420;};'use strict';var _=require('lodash');var util=require(_0xeef5('0x0'));var moment=require('moment');var BPromise=require(_0xeef5('0x1'));var rs=require(_0xeef5('0x2'));var fs=require('fs');var Redis=require(_0xeef5('0x3'));var db=require(_0xeef5('0x4'))['db'];var utils=require(_0xeef5('0x5'));var logger=require(_0xeef5('0x6'))(_0xeef5('0x7'));var config=require(_0xeef5('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2132f3,_0x1e3e0a,_0x53ead1){return new BPromise(function(_0x5c0a30,_0x441859){return client[_0xeef5('0x9')](_0x2132f3,_0x53ead1)[_0xeef5('0xa')](function(_0x5ef126){logger[_0xeef5('0xb')](_0xeef5('0xc'),_0x1e3e0a,'request\x20sent');logger['debug'](_0xeef5('0xd'),_0x1e3e0a,_0xeef5('0xe'),JSON['stringify'](_0x5ef126));if(_0x5ef126['error']){if(_0x5ef126[_0xeef5('0xf')][_0xeef5('0x10')]===0x1f4){logger['error'](_0xeef5('0xc'),_0x1e3e0a,_0x5ef126[_0xeef5('0xf')][_0xeef5('0x11')]);return _0x441859(_0x5ef126[_0xeef5('0xf')]['message']);}logger['error'](_0xeef5('0xc'),_0x1e3e0a,_0x5ef126[_0xeef5('0xf')][_0xeef5('0x11')]);return _0x5c0a30(_0x5ef126[_0xeef5('0xf')][_0xeef5('0x11')]);}else{logger[_0xeef5('0xb')](_0xeef5('0xc'),_0x1e3e0a,'request\x20sent');_0x5c0a30(_0x5ef126[_0xeef5('0x12')][_0xeef5('0x11')]);}})[_0xeef5('0x13')](function(_0x18c303){logger['error']('DeskAccount,\x20%s,\x20%s',_0x1e3e0a,_0x18c303);_0x441859(_0x18c303);});});}exports[_0xeef5('0x14')]=function(_0x315829){var _0x52c5a8=this;return new Promise(function(_0x1c584c,_0xe7f064){return db[_0xeef5('0x15')]['findAll']({'raw':_0x315829[_0xeef5('0x16')]?_0x315829[_0xeef5('0x16')][_0xeef5('0x17')]===undefined?!![]:![]:!![],'where':_0x315829['options']?_0x315829[_0xeef5('0x16')][_0xeef5('0x18')]||null:null,'attributes':_0x315829[_0xeef5('0x16')]?_0x315829['options'][_0xeef5('0x19')]||null:null,'limit':_0x315829[_0xeef5('0x16')]?_0x315829[_0xeef5('0x16')]['limit']||null:null,'include':_0x315829[_0xeef5('0x16')]?_0x315829[_0xeef5('0x16')][_0xeef5('0x1a')]?_[_0xeef5('0x1b')](_0x315829[_0xeef5('0x16')][_0xeef5('0x1a')],function(_0x25de8e){return{'model':db[_0x25de8e[_0xeef5('0x1c')]],'as':_0x25de8e['as'],'attributes':_0x25de8e['attributes'],'include':_0x25de8e[_0xeef5('0x1a')]?_['map'](_0x25de8e[_0xeef5('0x1a')],function(_0x3c4423){return{'model':db[_0x3c4423[_0xeef5('0x1c')]],'as':_0x3c4423['as'],'attributes':_0x3c4423[_0xeef5('0x19')],'include':_0x3c4423[_0xeef5('0x1a')]?_['map'](_0x3c4423['include'],function(_0x49a262){return{'model':db[_0x49a262[_0xeef5('0x1c')]],'as':_0x49a262['as'],'attributes':_0x49a262[_0xeef5('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeef5('0xa')](function(_0xce829c){logger[_0xeef5('0xb')](_0xeef5('0x14'),_0x315829);logger[_0xeef5('0x1d')]('GetDeskAccount',_0x315829,JSON['stringify'](_0xce829c));_0x1c584c(_0xce829c);})[_0xeef5('0x13')](function(_0x2053d7){logger[_0xeef5('0xf')](_0xeef5('0x14'),_0x2053d7[_0xeef5('0x11')],_0x315829);_0xe7f064(_0x52c5a8['error'](0x1f4,_0x2053d7[_0xeef5('0x11')]));});});};exports[_0xeef5('0x1e')]=function(_0x335972){var _0x3bf3b2=this;return new Promise(function(_0x5eefed,_0xde6399){return db[_0xeef5('0x15')]['find']({'raw':_0x335972[_0xeef5('0x16')]?_0x335972[_0xeef5('0x16')][_0xeef5('0x17')]===undefined?!![]:![]:!![],'where':_0x335972[_0xeef5('0x16')]?_0x335972[_0xeef5('0x16')][_0xeef5('0x18')]||null:null,'attributes':_0x335972[_0xeef5('0x16')]?_0x335972[_0xeef5('0x16')]['attributes']||null:null,'include':_0x335972[_0xeef5('0x16')]?_0x335972[_0xeef5('0x16')]['include']?_['map'](_0x335972[_0xeef5('0x16')][_0xeef5('0x1a')],function(_0x3e53eb){return{'model':db[_0x3e53eb[_0xeef5('0x1c')]],'as':_0x3e53eb['as'],'attributes':_0x3e53eb['attributes'],'include':_0x3e53eb[_0xeef5('0x1a')]?_[_0xeef5('0x1b')](_0x3e53eb[_0xeef5('0x1a')],function(_0x64ee0c){return{'model':db[_0x64ee0c[_0xeef5('0x1c')]],'as':_0x64ee0c['as'],'attributes':_0x64ee0c['attributes'],'include':_0x64ee0c[_0xeef5('0x1a')]?_['map'](_0x64ee0c[_0xeef5('0x1a')],function(_0x4d352d){return{'model':db[_0x4d352d[_0xeef5('0x1c')]],'as':_0x4d352d['as'],'attributes':_0x4d352d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x199725){logger[_0xeef5('0xb')](_0xeef5('0x1e'),_0x335972);logger[_0xeef5('0x1d')](_0xeef5('0x1e'),_0x335972,JSON['stringify'](_0x199725));_0x5eefed(_0x199725);})[_0xeef5('0x13')](function(_0x28b7e9){logger[_0xeef5('0xf')](_0xeef5('0x1e'),_0x28b7e9[_0xeef5('0x11')],_0x335972);_0xde6399(_0x3bf3b2['error'](0x1f4,_0x28b7e9[_0xeef5('0x11')]));});});}; \ No newline at end of file +var _0xacfc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowDeskAccount','find','lodash','util','moment','bluebird'];(function(_0x190003,_0x2056c2){var _0x366d65=function(_0x34edb9){while(--_0x34edb9){_0x190003['push'](_0x190003['shift']());}};_0x366d65(++_0x2056c2);}(_0xacfc,0x1a0));var _0xcacf=function(_0x30af23,_0xdcd638){_0x30af23=_0x30af23-0x0;var _0xc1794=_0xacfc[_0x30af23];return _0xc1794;};'use strict';var _=require(_0xcacf('0x0'));var util=require(_0xcacf('0x1'));var moment=require(_0xcacf('0x2'));var BPromise=require(_0xcacf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcacf('0x4'));var db=require(_0xcacf('0x5'))['db'];var utils=require(_0xcacf('0x6'));var logger=require(_0xcacf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcacf('0x8'));var client=jayson['client'][_0xcacf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fe986,_0x34c311,_0xa22624){return new BPromise(function(_0x4c25e6,_0x5c6da1){return client[_0xcacf('0xa')](_0x2fe986,_0xa22624)[_0xcacf('0xb')](function(_0x385d0a){logger[_0xcacf('0xc')](_0xcacf('0xd'),_0x34c311,_0xcacf('0xe'));logger[_0xcacf('0xf')](_0xcacf('0x10'),_0x34c311,_0xcacf('0xe'),JSON[_0xcacf('0x11')](_0x385d0a));if(_0x385d0a[_0xcacf('0x12')]){if(_0x385d0a[_0xcacf('0x12')][_0xcacf('0x13')]===0x1f4){logger[_0xcacf('0x12')](_0xcacf('0xd'),_0x34c311,_0x385d0a[_0xcacf('0x12')][_0xcacf('0x14')]);return _0x5c6da1(_0x385d0a[_0xcacf('0x12')][_0xcacf('0x14')]);}logger[_0xcacf('0x12')](_0xcacf('0xd'),_0x34c311,_0x385d0a[_0xcacf('0x12')][_0xcacf('0x14')]);return _0x4c25e6(_0x385d0a[_0xcacf('0x12')]['message']);}else{logger['info'](_0xcacf('0xd'),_0x34c311,'request\x20sent');_0x4c25e6(_0x385d0a['result'][_0xcacf('0x14')]);}})[_0xcacf('0x15')](function(_0x45152e){logger[_0xcacf('0x12')](_0xcacf('0xd'),_0x34c311,_0x45152e);_0x5c6da1(_0x45152e);});});}exports[_0xcacf('0x16')]=function(_0x5da3fc){var _0x3d6791=this;return new Promise(function(_0x4c8441,_0x3c8ba7){return db[_0xcacf('0x17')][_0xcacf('0x18')]({'raw':_0x5da3fc[_0xcacf('0x19')]?_0x5da3fc[_0xcacf('0x19')][_0xcacf('0x1a')]===undefined?!![]:![]:!![],'where':_0x5da3fc[_0xcacf('0x19')]?_0x5da3fc['options'][_0xcacf('0x1b')]||null:null,'attributes':_0x5da3fc[_0xcacf('0x19')]?_0x5da3fc[_0xcacf('0x19')][_0xcacf('0x1c')]||null:null,'limit':_0x5da3fc['options']?_0x5da3fc[_0xcacf('0x19')][_0xcacf('0x1d')]||null:null,'include':_0x5da3fc['options']?_0x5da3fc[_0xcacf('0x19')]['include']?_[_0xcacf('0x1e')](_0x5da3fc['options'][_0xcacf('0x1f')],function(_0x620f96){return{'model':db[_0x620f96['model']],'as':_0x620f96['as'],'attributes':_0x620f96[_0xcacf('0x1c')],'include':_0x620f96[_0xcacf('0x1f')]?_[_0xcacf('0x1e')](_0x620f96[_0xcacf('0x1f')],function(_0x255faf){return{'model':db[_0x255faf['model']],'as':_0x255faf['as'],'attributes':_0x255faf[_0xcacf('0x1c')],'include':_0x255faf[_0xcacf('0x1f')]?_[_0xcacf('0x1e')](_0x255faf['include'],function(_0x56c3a2){return{'model':db[_0x56c3a2[_0xcacf('0x20')]],'as':_0x56c3a2['as'],'attributes':_0x56c3a2[_0xcacf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcacf('0xb')](function(_0x1bdd1e){logger[_0xcacf('0xc')](_0xcacf('0x16'),_0x5da3fc);logger[_0xcacf('0xf')](_0xcacf('0x16'),_0x5da3fc,JSON['stringify'](_0x1bdd1e));_0x4c8441(_0x1bdd1e);})[_0xcacf('0x15')](function(_0x10ae66){logger['error'](_0xcacf('0x16'),_0x10ae66[_0xcacf('0x14')],_0x5da3fc);_0x3c8ba7(_0x3d6791[_0xcacf('0x12')](0x1f4,_0x10ae66[_0xcacf('0x14')]));});});};exports[_0xcacf('0x21')]=function(_0x499f32){var _0x35b179=this;return new Promise(function(_0xe15791,_0x489e69){return db[_0xcacf('0x17')][_0xcacf('0x22')]({'raw':_0x499f32['options']?_0x499f32[_0xcacf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x499f32[_0xcacf('0x19')]?_0x499f32[_0xcacf('0x19')][_0xcacf('0x1b')]||null:null,'attributes':_0x499f32['options']?_0x499f32[_0xcacf('0x19')]['attributes']||null:null,'include':_0x499f32[_0xcacf('0x19')]?_0x499f32['options'][_0xcacf('0x1f')]?_[_0xcacf('0x1e')](_0x499f32['options']['include'],function(_0x5e40cf){return{'model':db[_0x5e40cf[_0xcacf('0x20')]],'as':_0x5e40cf['as'],'attributes':_0x5e40cf[_0xcacf('0x1c')],'include':_0x5e40cf[_0xcacf('0x1f')]?_['map'](_0x5e40cf['include'],function(_0x16a27f){return{'model':db[_0x16a27f['model']],'as':_0x16a27f['as'],'attributes':_0x16a27f['attributes'],'include':_0x16a27f[_0xcacf('0x1f')]?_['map'](_0x16a27f[_0xcacf('0x1f')],function(_0x5ebbf9){return{'model':db[_0x5ebbf9[_0xcacf('0x20')]],'as':_0x5ebbf9['as'],'attributes':_0x5ebbf9[_0xcacf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcacf('0xb')](function(_0x567175){logger[_0xcacf('0xc')](_0xcacf('0x21'),_0x499f32);logger[_0xcacf('0xf')]('ShowDeskAccount',_0x499f32,JSON[_0xcacf('0x11')](_0x567175));_0xe15791(_0x567175);})[_0xcacf('0x15')](function(_0x1b37cd){logger[_0xcacf('0x12')]('ShowDeskAccount',_0x1b37cd[_0xcacf('0x14')],_0x499f32);_0x489e69(_0x35b179['error'](0x1f4,_0x1b37cd[_0xcacf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e6acb6c..3ba4908 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2612cb,_0x3c9c22){var _0x1adcbe=function(_0x4d5038){while(--_0x4d5038){_0x2612cb['push'](_0x2612cb['shift']());}};_0x1adcbe(++_0x3c9c22);}(_0x008c,0x188));var _0xc008=function(_0x26d034,_0x2c22db){_0x26d034=_0x26d034-0x0;var _0x3015aa=_0x008c[_0x26d034];return _0x3015aa;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x72b3b9,_0x508c5b){var _0x2c5b94=function(_0x3f8919){while(--_0x3f8919){_0x72b3b9['push'](_0x72b3b9['shift']());}};_0x2c5b94(++_0x508c5b);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a890d,_0x46907b){_0x4a890d=_0x4a890d-0x0;var _0x20cc08=_0xedd9[_0x4a890d];return _0x20cc08;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a64c5d1..62f2ffc 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 _0x2c23=['sequelize'];(function(_0x8cab29,_0x45c9b5){var _0x2c1a94=function(_0x27d649){while(--_0x27d649){_0x8cab29['push'](_0x8cab29['shift']());}};_0x2c1a94(++_0x45c9b5);}(_0x2c23,0x1be));var _0x32c2=function(_0x36958,_0x28eaa6){_0x36958=_0x36958-0x0;var _0x401eec=_0x2c23[_0x36958];return _0x401eec;};'use strict';var Sequelize=require(_0x32c2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa537=['sequelize','STRING'];(function(_0x44c1e4,_0xdb06e3){var _0x43864a=function(_0x453d92){while(--_0x453d92){_0x44c1e4['push'](_0x44c1e4['shift']());}};_0x43864a(++_0xdb06e3);}(_0xa537,0xa4));var _0x7a53=function(_0x8cada1,_0x5503aa){_0x8cada1=_0x8cada1-0x0;var _0x145641=_0xa537[_0x8cada1];return _0x145641;};'use strict';var Sequelize=require(_0x7a53('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a53('0x1')]},'description':{'type':Sequelize[_0x7a53('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2980d1c..640b3dc 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 _0x7a15=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','then','rows','catch','show','params','fields','include','find','create','body','findOne','pick','getFields','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x57cdaf,_0x3568fb){var _0x2d851a=function(_0x8be468){while(--_0x8be468){_0x57cdaf['push'](_0x57cdaf['shift']());}};_0x2d851a(++_0x3568fb);}(_0x7a15,0x1de));var _0x57a1=function(_0x20eb03,_0x520fd8){_0x20eb03=_0x20eb03-0x0;var _0x370263=_0x7a15[_0x20eb03];return _0x370263;};'use strict';var emlformat=require(_0x57a1('0x0'));var rimraf=require(_0x57a1('0x1'));var zipdir=require(_0x57a1('0x2'));var jsonpatch=require(_0x57a1('0x3'));var rp=require(_0x57a1('0x4'));var moment=require(_0x57a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x57a1('0x6'));var util=require(_0x57a1('0x7'));var path=require(_0x57a1('0x8'));var sox=require(_0x57a1('0x9'));var csv=require('to-csv');var ejs=require(_0x57a1('0xa'));var fs=require('fs');var fs_extra=require(_0x57a1('0xb'));var _=require(_0x57a1('0xc'));var squel=require(_0x57a1('0xd'));var crypto=require(_0x57a1('0xe'));var jsforce=require(_0x57a1('0xf'));var deskjs=require(_0x57a1('0x10'));var toCsv=require(_0x57a1('0x11'));var querystring=require(_0x57a1('0x12'));var Papa=require(_0x57a1('0x13'));var Redis=require(_0x57a1('0x14'));var authService=require(_0x57a1('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57a1('0x16'));var logger=require(_0x57a1('0x17'))(_0x57a1('0x18'));var utils=require(_0x57a1('0x19'));var config=require(_0x57a1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x57a1('0x1b'))['db'];function respondWithStatusCode(_0x424464,_0xfc1b1e){_0xfc1b1e=_0xfc1b1e||0xcc;return function(_0x5cac74){if(_0x5cac74){return _0x424464[_0x57a1('0x1c')](_0xfc1b1e);}return _0x424464['status'](_0xfc1b1e)[_0x57a1('0x1d')]();};}function respondWithResult(_0x413daa,_0x264cdd){_0x264cdd=_0x264cdd||0xc8;return function(_0x208e12){if(_0x208e12){return _0x413daa['status'](_0x264cdd)[_0x57a1('0x1e')](_0x208e12);}};}function respondWithFilteredResult(_0x8df3e,_0x17705f){return function(_0x177e3e){if(_0x177e3e){var _0x2786a1=typeof _0x17705f[_0x57a1('0x1f')]===_0x57a1('0x20')&&typeof _0x17705f['limit']===_0x57a1('0x20');var _0x37bbfc=_0x177e3e[_0x57a1('0x21')];var _0x518428=_0x2786a1?0x0:_0x17705f['offset'];var _0x326e88=_0x2786a1?_0x177e3e[_0x57a1('0x21')]:_0x17705f[_0x57a1('0x1f')]+_0x17705f[_0x57a1('0x22')];var _0x5bf57b;if(_0x326e88>=_0x37bbfc){_0x326e88=_0x37bbfc;_0x5bf57b=0xc8;}else{_0x5bf57b=0xce;}_0x8df3e[_0x57a1('0x23')](_0x5bf57b);return _0x8df3e[_0x57a1('0x24')](_0x57a1('0x25'),_0x518428+'-'+_0x326e88+'/'+_0x37bbfc)['json'](_0x177e3e);}return null;};}function patchUpdates(_0x548866){return function(_0x5690e1){try{jsonpatch[_0x57a1('0x26')](_0x5690e1,_0x548866,!![]);}catch(_0x514c4e){return BPromise[_0x57a1('0x27')](_0x514c4e);}return _0x5690e1[_0x57a1('0x28')]();};}function saveUpdates(_0x4393c2,_0x43fa59){return function(_0xab3e7){if(_0xab3e7){return _0xab3e7['update'](_0x4393c2)['then'](function(_0x29edcd){return _0x29edcd;});}return null;};}function removeEntity(_0x336325,_0x4d3fdf){return function(_0x3448fe){if(_0x3448fe){return _0x3448fe[_0x57a1('0x29')]()['then'](function(){_0x336325[_0x57a1('0x23')](0xcc)[_0x57a1('0x1d')]();});}};}function handleEntityNotFound(_0x1b821c,_0x59f413){return function(_0x1fb3f8){if(!_0x1fb3f8){_0x1b821c[_0x57a1('0x1c')](0x194);}return _0x1fb3f8;};}function handleError(_0x3c3681,_0x16776c){_0x16776c=_0x16776c||0x1f4;return function(_0x534510){logger[_0x57a1('0x2a')](_0x534510[_0x57a1('0x2b')]);if(_0x534510[_0x57a1('0x2c')]){delete _0x534510[_0x57a1('0x2c')];}_0x3c3681[_0x57a1('0x23')](_0x16776c)[_0x57a1('0x2d')](_0x534510);};}exports[_0x57a1('0x2e')]=function(_0x3d9564,_0x36f076){var _0x3d37cc={},_0x29545f={},_0x2ad07c={'count':0x0,'rows':[]};var _0x27ba38=_[_0x57a1('0x2f')](db[_0x57a1('0x30')][_0x57a1('0x31')],function(_0x35c316){return{'name':_0x35c316[_0x57a1('0x32')],'type':_0x35c316[_0x57a1('0x33')][_0x57a1('0x34')]};});_0x29545f[_0x57a1('0x35')]=_[_0x57a1('0x2f')](_0x27ba38,_0x57a1('0x2c'));_0x29545f[_0x57a1('0x36')]=_[_0x57a1('0x37')](_0x3d9564['query']);_0x29545f[_0x57a1('0x38')]=_[_0x57a1('0x39')](_0x29545f[_0x57a1('0x35')],_0x29545f['query']);_0x3d37cc[_0x57a1('0x3a')]=_[_0x57a1('0x39')](_0x29545f['model'],qs['fields'](_0x3d9564[_0x57a1('0x36')]['fields']));_0x3d37cc[_0x57a1('0x3a')]=_0x3d37cc['attributes'][_0x57a1('0x3b')]?_0x3d37cc['attributes']:_0x29545f[_0x57a1('0x35')];if(!_0x3d9564['query'][_0x57a1('0x3c')](_0x57a1('0x3d'))){_0x3d37cc[_0x57a1('0x22')]=qs[_0x57a1('0x22')](_0x3d9564[_0x57a1('0x36')]['limit']);_0x3d37cc['offset']=qs['offset'](_0x3d9564['query'][_0x57a1('0x1f')]);}_0x3d37cc[_0x57a1('0x3e')]=qs[_0x57a1('0x3f')](_0x3d9564['query'][_0x57a1('0x3f')]);_0x3d37cc[_0x57a1('0x40')]=qs['filters'](_['pick'](_0x3d9564[_0x57a1('0x36')],_0x29545f[_0x57a1('0x38')]),_0x27ba38);if(_0x3d9564[_0x57a1('0x36')][_0x57a1('0x41')]){_0x3d37cc[_0x57a1('0x40')]=_['merge'](_0x3d37cc['where'],{'$or':_[_0x57a1('0x2f')](_0x27ba38,function(_0x37e4e4){if(_0x37e4e4[_0x57a1('0x33')]!==_0x57a1('0x42')){var _0x41e76b={};_0x41e76b[_0x37e4e4[_0x57a1('0x2c')]]={'$like':'%'+_0x3d9564['query'][_0x57a1('0x41')]+'%'};return _0x41e76b;}})});}_0x3d37cc=_[_0x57a1('0x43')]({},_0x3d37cc,_0x3d9564[_0x57a1('0x44')]);var _0x4fcc03={'where':_0x3d37cc[_0x57a1('0x40')]};return db[_0x57a1('0x30')][_0x57a1('0x21')](_0x4fcc03)['then'](function(_0x35ae4a){_0x2ad07c[_0x57a1('0x21')]=_0x35ae4a;if(_0x3d9564['query'][_0x57a1('0x45')]){_0x3d37cc['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x3d37cc);})[_0x57a1('0x46')](function(_0x5bb285){_0x2ad07c[_0x57a1('0x47')]=_0x5bb285;return _0x2ad07c;})['then'](respondWithFilteredResult(_0x36f076,_0x3d37cc))[_0x57a1('0x48')](handleError(_0x36f076,null));};exports[_0x57a1('0x49')]=function(_0x18df65,_0x38c3a0){var _0x5cba5d={'raw':![],'where':{'id':_0x18df65[_0x57a1('0x4a')]['id']}},_0x4feb11={};_0x4feb11[_0x57a1('0x35')]=_['keys'](db[_0x57a1('0x30')][_0x57a1('0x31')]);_0x4feb11['query']=_[_0x57a1('0x37')](_0x18df65[_0x57a1('0x36')]);_0x4feb11[_0x57a1('0x38')]=_[_0x57a1('0x39')](_0x4feb11[_0x57a1('0x35')],_0x4feb11[_0x57a1('0x36')]);_0x5cba5d['attributes']=_[_0x57a1('0x39')](_0x4feb11[_0x57a1('0x35')],qs[_0x57a1('0x4b')](_0x18df65[_0x57a1('0x36')][_0x57a1('0x4b')]));_0x5cba5d['attributes']=_0x5cba5d[_0x57a1('0x3a')][_0x57a1('0x3b')]?_0x5cba5d[_0x57a1('0x3a')]:_0x4feb11['model'];if(_0x18df65[_0x57a1('0x36')]['includeAll']){_0x5cba5d[_0x57a1('0x4c')]=[{'all':!![]}];}_0x5cba5d=_[_0x57a1('0x43')]({},_0x5cba5d,_0x18df65[_0x57a1('0x44')]);return db[_0x57a1('0x30')][_0x57a1('0x4d')](_0x5cba5d)[_0x57a1('0x46')](handleEntityNotFound(_0x38c3a0,null))[_0x57a1('0x46')](respondWithResult(_0x38c3a0,null))[_0x57a1('0x48')](handleError(_0x38c3a0,null));};exports[_0x57a1('0x4e')]=function(_0x44202c,_0x4fbeca){return db['DeskConfiguration'][_0x57a1('0x4e')](_0x44202c[_0x57a1('0x4f')],{})['then'](respondWithResult(_0x4fbeca,0xc9))[_0x57a1('0x48')](handleError(_0x4fbeca,null));};exports['update']=function(_0x728ea4,_0x31fc0e){if(_0x728ea4[_0x57a1('0x4f')]['id']){delete _0x728ea4[_0x57a1('0x4f')]['id'];}return db['DeskConfiguration'][_0x57a1('0x4d')]({'where':{'id':_0x728ea4[_0x57a1('0x4a')]['id']}})[_0x57a1('0x46')](handleEntityNotFound(_0x31fc0e,null))['then'](saveUpdates(_0x728ea4[_0x57a1('0x4f')],null))[_0x57a1('0x46')](respondWithResult(_0x31fc0e,null))[_0x57a1('0x48')](handleError(_0x31fc0e,null));};exports['destroy']=function(_0x109d64,_0x546fc0){return db['DeskConfiguration'][_0x57a1('0x4d')]({'where':{'id':_0x109d64[_0x57a1('0x4a')]['id']}})[_0x57a1('0x46')](handleEntityNotFound(_0x546fc0,null))['then'](removeEntity(_0x546fc0,null))[_0x57a1('0x48')](handleError(_0x546fc0,null));};exports['getFields']=function(_0x469384,_0x2016c4,_0x17a035){var _0x3963bd={};var _0x4325f8={};var _0x3b5c51;var _0x10d0ac;return db['DeskConfiguration'][_0x57a1('0x50')]({'where':{'id':_0x469384['params']['id']}})[_0x57a1('0x46')](handleEntityNotFound(_0x2016c4,null))['then'](function(_0xf09bdf){if(_0xf09bdf){_0x3b5c51=_0xf09bdf;_0x4325f8[_0x57a1('0x35')]=_[_0x57a1('0x37')](db['DeskField'][_0x57a1('0x31')]);_0x4325f8[_0x57a1('0x36')]=_[_0x57a1('0x37')](_0x469384['query']);_0x4325f8[_0x57a1('0x38')]=_[_0x57a1('0x39')](_0x4325f8[_0x57a1('0x35')],_0x4325f8[_0x57a1('0x36')]);_0x3963bd[_0x57a1('0x3a')]=_['intersection'](_0x4325f8[_0x57a1('0x35')],qs[_0x57a1('0x4b')](_0x469384['query'][_0x57a1('0x4b')]));_0x3963bd[_0x57a1('0x3a')]=_0x3963bd['attributes'][_0x57a1('0x3b')]?_0x3963bd['attributes']:_0x4325f8[_0x57a1('0x35')];_0x3963bd[_0x57a1('0x3e')]=qs[_0x57a1('0x3f')](_0x469384['query'][_0x57a1('0x3f')]);_0x3963bd['where']=qs[_0x57a1('0x38')](_[_0x57a1('0x51')](_0x469384['query'],_0x4325f8[_0x57a1('0x38')]));if(_0x469384[_0x57a1('0x36')][_0x57a1('0x41')]){_0x3963bd[_0x57a1('0x40')]=_['merge'](_0x3963bd[_0x57a1('0x40')],{'$or':_['map'](_0x3963bd['attributes'],function(_0x23fe28){var _0x1480e1={};_0x1480e1[_0x23fe28]={'$like':'%'+_0x469384[_0x57a1('0x36')][_0x57a1('0x41')]+'%'};return _0x1480e1;})});}_0x3963bd=_[_0x57a1('0x43')]({},_0x3963bd,_0x469384[_0x57a1('0x44')]);return _0x3b5c51[_0x57a1('0x52')](_0x3963bd);}})[_0x57a1('0x46')](function(_0xf8594f){if(_0xf8594f){_0x10d0ac=_0xf8594f['length'];if(!_0x469384[_0x57a1('0x36')][_0x57a1('0x3c')]('nolimit')){_0x3963bd['limit']=qs[_0x57a1('0x22')](_0x469384[_0x57a1('0x36')][_0x57a1('0x22')]);_0x3963bd[_0x57a1('0x1f')]=qs[_0x57a1('0x1f')](_0x469384[_0x57a1('0x36')][_0x57a1('0x1f')]);}return _0x3b5c51[_0x57a1('0x52')](_0x3963bd);}})[_0x57a1('0x46')](function(_0x197e56){if(_0x197e56){return _0x197e56?{'count':_0x10d0ac,'rows':_0x197e56}:null;}})['then'](respondWithResult(_0x2016c4,null))[_0x57a1('0x48')](handleError(_0x2016c4,null));};exports['getSubjects']=function(_0x462309,_0x526dce,_0x42e20e){var _0x498cdc={};var _0x3e5179={};var _0x18a888;var _0x4ac204;return db[_0x57a1('0x30')][_0x57a1('0x50')]({'where':{'id':_0x462309[_0x57a1('0x4a')]['id']}})[_0x57a1('0x46')](handleEntityNotFound(_0x526dce,null))[_0x57a1('0x46')](function(_0x4647ca){if(_0x4647ca){_0x18a888=_0x4647ca;_0x3e5179[_0x57a1('0x35')]=_[_0x57a1('0x37')](db[_0x57a1('0x53')][_0x57a1('0x31')]);_0x3e5179['query']=_[_0x57a1('0x37')](_0x462309[_0x57a1('0x36')]);_0x3e5179['filters']=_[_0x57a1('0x39')](_0x3e5179[_0x57a1('0x35')],_0x3e5179[_0x57a1('0x36')]);_0x498cdc['attributes']=_['intersection'](_0x3e5179[_0x57a1('0x35')],qs[_0x57a1('0x4b')](_0x462309['query'][_0x57a1('0x4b')]));_0x498cdc[_0x57a1('0x3a')]=_0x498cdc[_0x57a1('0x3a')][_0x57a1('0x3b')]?_0x498cdc[_0x57a1('0x3a')]:_0x3e5179[_0x57a1('0x35')];_0x498cdc[_0x57a1('0x3e')]=qs[_0x57a1('0x3f')](_0x462309[_0x57a1('0x36')][_0x57a1('0x3f')]);_0x498cdc['where']=qs[_0x57a1('0x38')](_['pick'](_0x462309['query'],_0x3e5179[_0x57a1('0x38')]));if(_0x462309[_0x57a1('0x36')][_0x57a1('0x41')]){_0x498cdc['where']=_[_0x57a1('0x43')](_0x498cdc['where'],{'$or':_[_0x57a1('0x2f')](_0x498cdc[_0x57a1('0x3a')],function(_0x6cdd08){var _0x5b5f72={};_0x5b5f72[_0x6cdd08]={'$like':'%'+_0x462309[_0x57a1('0x36')][_0x57a1('0x41')]+'%'};return _0x5b5f72;})});}_0x498cdc=_['merge']({},_0x498cdc,_0x462309['options']);return _0x18a888[_0x57a1('0x54')](_0x498cdc);}})[_0x57a1('0x46')](function(_0x2c1c07){if(_0x2c1c07){_0x4ac204=_0x2c1c07[_0x57a1('0x3b')];if(!_0x462309[_0x57a1('0x36')][_0x57a1('0x3c')](_0x57a1('0x3d'))){_0x498cdc['limit']=qs[_0x57a1('0x22')](_0x462309[_0x57a1('0x36')]['limit']);_0x498cdc[_0x57a1('0x1f')]=qs[_0x57a1('0x1f')](_0x462309[_0x57a1('0x36')][_0x57a1('0x1f')]);}return _0x18a888['getSubjects'](_0x498cdc);}})[_0x57a1('0x46')](function(_0x3b998d){if(_0x3b998d){return _0x3b998d?{'count':_0x4ac204,'rows':_0x3b998d}:null;}})[_0x57a1('0x46')](respondWithResult(_0x526dce,null))['catch'](handleError(_0x526dce,null));};exports[_0x57a1('0x55')]=function(_0x26e1c7,_0x27a242,_0x33ea0e){var _0x51f277={};var _0x36a822={};var _0x2ba5e8;var _0x355a65;return db[_0x57a1('0x30')][_0x57a1('0x50')]({'where':{'id':_0x26e1c7[_0x57a1('0x4a')]['id']}})[_0x57a1('0x46')](handleEntityNotFound(_0x27a242,null))[_0x57a1('0x46')](function(_0x4f6f60){if(_0x4f6f60){_0x2ba5e8=_0x4f6f60;_0x36a822['model']=_[_0x57a1('0x37')](db['DeskField'][_0x57a1('0x31')]);_0x36a822[_0x57a1('0x36')]=_['keys'](_0x26e1c7['query']);_0x36a822[_0x57a1('0x38')]=_[_0x57a1('0x39')](_0x36a822[_0x57a1('0x35')],_0x36a822[_0x57a1('0x36')]);_0x51f277[_0x57a1('0x3a')]=_['intersection'](_0x36a822[_0x57a1('0x35')],qs['fields'](_0x26e1c7[_0x57a1('0x36')][_0x57a1('0x4b')]));_0x51f277['attributes']=_0x51f277[_0x57a1('0x3a')]['length']?_0x51f277['attributes']:_0x36a822[_0x57a1('0x35')];_0x51f277[_0x57a1('0x3e')]=qs[_0x57a1('0x3f')](_0x26e1c7[_0x57a1('0x36')]['sort']);_0x51f277['where']=qs['filters'](_['pick'](_0x26e1c7[_0x57a1('0x36')],_0x36a822[_0x57a1('0x38')]));if(_0x26e1c7['query']['filter']){_0x51f277[_0x57a1('0x40')]=_[_0x57a1('0x43')](_0x51f277[_0x57a1('0x40')],{'$or':_[_0x57a1('0x2f')](_0x51f277[_0x57a1('0x3a')],function(_0x50116d){var _0x50fe54={};_0x50fe54[_0x50116d]={'$like':'%'+_0x26e1c7[_0x57a1('0x36')][_0x57a1('0x41')]+'%'};return _0x50fe54;})});}_0x51f277=_[_0x57a1('0x43')]({},_0x51f277,_0x26e1c7[_0x57a1('0x44')]);return _0x2ba5e8['getDescriptions'](_0x51f277);}})[_0x57a1('0x46')](function(_0x5a1ccd){if(_0x5a1ccd){_0x355a65=_0x5a1ccd[_0x57a1('0x3b')];if(!_0x26e1c7[_0x57a1('0x36')]['hasOwnProperty'](_0x57a1('0x3d'))){_0x51f277[_0x57a1('0x22')]=qs['limit'](_0x26e1c7[_0x57a1('0x36')][_0x57a1('0x22')]);_0x51f277[_0x57a1('0x1f')]=qs[_0x57a1('0x1f')](_0x26e1c7['query'][_0x57a1('0x1f')]);}return _0x2ba5e8[_0x57a1('0x55')](_0x51f277);}})[_0x57a1('0x46')](function(_0x4453c4){if(_0x4453c4){return _0x4453c4?{'count':_0x355a65,'rows':_0x4453c4}:null;}})[_0x57a1('0x46')](respondWithResult(_0x27a242,null))[_0x57a1('0x48')](handleError(_0x27a242,null));};exports['getTags']=function(_0x3de5c6,_0x28d5a1,_0x469c98){var _0x4d7699={};var _0x10e7c0={};var _0x5d44dd;var _0x2338b5;return db[_0x57a1('0x30')][_0x57a1('0x50')]({'where':{'id':_0x3de5c6['params']['id']}})[_0x57a1('0x46')](handleEntityNotFound(_0x28d5a1,null))[_0x57a1('0x46')](function(_0x59c9a0){if(_0x59c9a0){_0x5d44dd=_0x59c9a0;_0x10e7c0['model']=_[_0x57a1('0x37')](db[_0x57a1('0x56')]['rawAttributes']);_0x10e7c0['query']=_[_0x57a1('0x37')](_0x3de5c6[_0x57a1('0x36')]);_0x10e7c0[_0x57a1('0x38')]=_[_0x57a1('0x39')](_0x10e7c0[_0x57a1('0x35')],_0x10e7c0['query']);_0x4d7699[_0x57a1('0x3a')]=_[_0x57a1('0x39')](_0x10e7c0[_0x57a1('0x35')],qs['fields'](_0x3de5c6['query'][_0x57a1('0x4b')]));_0x4d7699[_0x57a1('0x3a')]=_0x4d7699[_0x57a1('0x3a')]['length']?_0x4d7699[_0x57a1('0x3a')]:_0x10e7c0['model'];_0x4d7699[_0x57a1('0x3e')]=qs['sort'](_0x3de5c6[_0x57a1('0x36')][_0x57a1('0x3f')]);_0x4d7699['where']=qs[_0x57a1('0x38')](_[_0x57a1('0x51')](_0x3de5c6[_0x57a1('0x36')],_0x10e7c0[_0x57a1('0x38')]));if(_0x3de5c6[_0x57a1('0x36')][_0x57a1('0x41')]){_0x4d7699[_0x57a1('0x40')]=_[_0x57a1('0x43')](_0x4d7699['where'],{'$or':_[_0x57a1('0x2f')](_0x4d7699['attributes'],function(_0x1595bd){var _0x372005={};_0x372005[_0x1595bd]={'$like':'%'+_0x3de5c6[_0x57a1('0x36')][_0x57a1('0x41')]+'%'};return _0x372005;})});}_0x4d7699=_[_0x57a1('0x43')]({},_0x4d7699,_0x3de5c6['options']);return _0x5d44dd[_0x57a1('0x57')](_0x4d7699);}})[_0x57a1('0x46')](function(_0x524d07){if(_0x524d07){_0x2338b5=_0x524d07[_0x57a1('0x3b')];if(!_0x3de5c6[_0x57a1('0x36')]['hasOwnProperty'](_0x57a1('0x3d'))){_0x4d7699[_0x57a1('0x22')]=qs[_0x57a1('0x22')](_0x3de5c6[_0x57a1('0x36')][_0x57a1('0x22')]);_0x4d7699['offset']=qs['offset'](_0x3de5c6['query'][_0x57a1('0x1f')]);}return _0x5d44dd[_0x57a1('0x57')](_0x4d7699);}})[_0x57a1('0x46')](function(_0x2cc17d){if(_0x2cc17d){return _0x2cc17d?{'count':_0x2338b5,'rows':_0x2cc17d}:null;}})[_0x57a1('0x46')](respondWithResult(_0x28d5a1,null))[_0x57a1('0x48')](handleError(_0x28d5a1,null));};exports[_0x57a1('0x58')]=function(_0x5492bf,_0x299e29,_0x3c5d9b){if(_0x5492bf[_0x57a1('0x4f')]['id']){delete _0x5492bf[_0x57a1('0x4f')]['id'];}return db[_0x57a1('0x30')][_0x57a1('0x50')]({'where':{'id':_0x5492bf[_0x57a1('0x4a')]['id']}})[_0x57a1('0x46')](handleEntityNotFound(_0x299e29,null))[_0x57a1('0x46')](function(_0x267a3f){if(_0x267a3f){return _0x267a3f[_0x57a1('0x58')](_0x5492bf[_0x57a1('0x4f')]['ids']||[]);}return null;})[_0x57a1('0x46')](respondWithResult(_0x299e29,null))['catch'](handleError(_0x299e29,null));}; \ No newline at end of file +var _0x56e2=['request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','keys','length','find','create','body','params','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4e3b15,_0x3afe85){var _0x32a973=function(_0xa49b98){while(--_0xa49b98){_0x4e3b15['push'](_0x4e3b15['shift']());}};_0x32a973(++_0x3afe85);}(_0x56e2,0x1d6));var _0x256e=function(_0x449d6a,_0x5138f2){_0x449d6a=_0x449d6a-0x0;var _0x420099=_0x56e2[_0x449d6a];return _0x420099;};'use strict';var emlformat=require(_0x256e('0x0'));var rimraf=require(_0x256e('0x1'));var zipdir=require(_0x256e('0x2'));var jsonpatch=require(_0x256e('0x3'));var rp=require(_0x256e('0x4'));var moment=require(_0x256e('0x5'));var BPromise=require(_0x256e('0x6'));var Mustache=require('mustache');var util=require(_0x256e('0x7'));var path=require(_0x256e('0x8'));var sox=require(_0x256e('0x9'));var csv=require('to-csv');var ejs=require(_0x256e('0xa'));var fs=require('fs');var fs_extra=require(_0x256e('0xb'));var _=require(_0x256e('0xc'));var squel=require(_0x256e('0xd'));var crypto=require(_0x256e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x256e('0xf'));var querystring=require(_0x256e('0x10'));var Papa=require(_0x256e('0x11'));var Redis=require(_0x256e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x256e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x256e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x256e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x256e('0x16'));var db=require(_0x256e('0x17'))['db'];function respondWithStatusCode(_0x5a88f6,_0x5eef26){_0x5eef26=_0x5eef26||0xcc;return function(_0x28b369){if(_0x28b369){return _0x5a88f6[_0x256e('0x18')](_0x5eef26);}return _0x5a88f6[_0x256e('0x19')](_0x5eef26)[_0x256e('0x1a')]();};}function respondWithResult(_0x43f6a8,_0x40c3bd){_0x40c3bd=_0x40c3bd||0xc8;return function(_0x5dfa7f){if(_0x5dfa7f){return _0x43f6a8['status'](_0x40c3bd)[_0x256e('0x1b')](_0x5dfa7f);}};}function respondWithFilteredResult(_0x340d65,_0x43a983){return function(_0x58bb30){if(_0x58bb30){var _0x41432d=typeof _0x43a983[_0x256e('0x1c')]===_0x256e('0x1d')&&typeof _0x43a983[_0x256e('0x1e')]==='undefined';var _0x5a590e=_0x58bb30[_0x256e('0x1f')];var _0x3a8669=_0x41432d?0x0:_0x43a983[_0x256e('0x1c')];var _0x32dcc4=_0x41432d?_0x58bb30['count']:_0x43a983[_0x256e('0x1c')]+_0x43a983[_0x256e('0x1e')];var _0x1fff9c;if(_0x32dcc4>=_0x5a590e){_0x32dcc4=_0x5a590e;_0x1fff9c=0xc8;}else{_0x1fff9c=0xce;}_0x340d65[_0x256e('0x19')](_0x1fff9c);return _0x340d65[_0x256e('0x20')]('Content-Range',_0x3a8669+'-'+_0x32dcc4+'/'+_0x5a590e)[_0x256e('0x1b')](_0x58bb30);}return null;};}function patchUpdates(_0x4f8813){return function(_0x534853){try{jsonpatch['apply'](_0x534853,_0x4f8813,!![]);}catch(_0x17704e){return BPromise['reject'](_0x17704e);}return _0x534853[_0x256e('0x21')]();};}function saveUpdates(_0x185c5a,_0x5a5376){return function(_0x14fd22){if(_0x14fd22){return _0x14fd22[_0x256e('0x22')](_0x185c5a)[_0x256e('0x23')](function(_0x31665a){return _0x31665a;});}return null;};}function removeEntity(_0x20b555,_0x5005e6){return function(_0x390bfc){if(_0x390bfc){return _0x390bfc[_0x256e('0x24')]()[_0x256e('0x23')](function(){_0x20b555['status'](0xcc)[_0x256e('0x1a')]();});}};}function handleEntityNotFound(_0xb9e06c,_0x1536be){return function(_0x2ffd96){if(!_0x2ffd96){_0xb9e06c[_0x256e('0x18')](0x194);}return _0x2ffd96;};}function handleError(_0x250188,_0x530ce7){_0x530ce7=_0x530ce7||0x1f4;return function(_0x2aed17){logger[_0x256e('0x25')](_0x2aed17[_0x256e('0x26')]);if(_0x2aed17[_0x256e('0x27')]){delete _0x2aed17[_0x256e('0x27')];}_0x250188[_0x256e('0x19')](_0x530ce7)[_0x256e('0x28')](_0x2aed17);};}exports[_0x256e('0x29')]=function(_0x518d43,_0x2f1a01){var _0x35cf01={},_0x30d899={},_0x32b293={'count':0x0,'rows':[]};var _0x10a493=_[_0x256e('0x2a')](db[_0x256e('0x2b')][_0x256e('0x2c')],function(_0x2beff4){return{'name':_0x2beff4['fieldName'],'type':_0x2beff4[_0x256e('0x2d')]['key']};});_0x30d899[_0x256e('0x2e')]=_[_0x256e('0x2a')](_0x10a493,_0x256e('0x27'));_0x30d899[_0x256e('0x2f')]=_['keys'](_0x518d43[_0x256e('0x2f')]);_0x30d899[_0x256e('0x30')]=_['intersection'](_0x30d899[_0x256e('0x2e')],_0x30d899[_0x256e('0x2f')]);_0x35cf01[_0x256e('0x31')]=_[_0x256e('0x32')](_0x30d899[_0x256e('0x2e')],qs['fields'](_0x518d43[_0x256e('0x2f')][_0x256e('0x33')]));_0x35cf01[_0x256e('0x31')]=_0x35cf01['attributes']['length']?_0x35cf01[_0x256e('0x31')]:_0x30d899['model'];if(!_0x518d43[_0x256e('0x2f')][_0x256e('0x34')]('nolimit')){_0x35cf01['limit']=qs['limit'](_0x518d43[_0x256e('0x2f')][_0x256e('0x1e')]);_0x35cf01[_0x256e('0x1c')]=qs['offset'](_0x518d43[_0x256e('0x2f')][_0x256e('0x1c')]);}_0x35cf01[_0x256e('0x35')]=qs[_0x256e('0x36')](_0x518d43['query']['sort']);_0x35cf01[_0x256e('0x37')]=qs[_0x256e('0x30')](_[_0x256e('0x38')](_0x518d43['query'],_0x30d899[_0x256e('0x30')]),_0x10a493);if(_0x518d43['query'][_0x256e('0x39')]){_0x35cf01[_0x256e('0x37')]=_[_0x256e('0x3a')](_0x35cf01[_0x256e('0x37')],{'$or':_['map'](_0x10a493,function(_0x46fc2e){if(_0x46fc2e[_0x256e('0x2d')]!==_0x256e('0x3b')){var _0x27ae70={};_0x27ae70[_0x46fc2e[_0x256e('0x27')]]={'$like':'%'+_0x518d43[_0x256e('0x2f')]['filter']+'%'};return _0x27ae70;}})});}_0x35cf01=_[_0x256e('0x3a')]({},_0x35cf01,_0x518d43[_0x256e('0x3c')]);var _0x3cc949={'where':_0x35cf01[_0x256e('0x37')]};return db['DeskConfiguration']['count'](_0x3cc949)[_0x256e('0x23')](function(_0x4e1910){_0x32b293['count']=_0x4e1910;if(_0x518d43[_0x256e('0x2f')][_0x256e('0x3d')]){_0x35cf01['include']=[{'all':!![]}];}return db[_0x256e('0x2b')]['findAll'](_0x35cf01);})['then'](function(_0x19ff03){_0x32b293[_0x256e('0x3e')]=_0x19ff03;return _0x32b293;})[_0x256e('0x23')](respondWithFilteredResult(_0x2f1a01,_0x35cf01))[_0x256e('0x3f')](handleError(_0x2f1a01,null));};exports[_0x256e('0x40')]=function(_0x4f7083,_0x139a1f){var _0x290835={'raw':![],'where':{'id':_0x4f7083['params']['id']}},_0x1aa86f={};_0x1aa86f[_0x256e('0x2e')]=_[_0x256e('0x41')](db[_0x256e('0x2b')][_0x256e('0x2c')]);_0x1aa86f['query']=_[_0x256e('0x41')](_0x4f7083[_0x256e('0x2f')]);_0x1aa86f[_0x256e('0x30')]=_['intersection'](_0x1aa86f[_0x256e('0x2e')],_0x1aa86f[_0x256e('0x2f')]);_0x290835['attributes']=_['intersection'](_0x1aa86f[_0x256e('0x2e')],qs[_0x256e('0x33')](_0x4f7083[_0x256e('0x2f')]['fields']));_0x290835['attributes']=_0x290835[_0x256e('0x31')][_0x256e('0x42')]?_0x290835[_0x256e('0x31')]:_0x1aa86f[_0x256e('0x2e')];if(_0x4f7083[_0x256e('0x2f')]['includeAll']){_0x290835['include']=[{'all':!![]}];}_0x290835=_[_0x256e('0x3a')]({},_0x290835,_0x4f7083[_0x256e('0x3c')]);return db[_0x256e('0x2b')][_0x256e('0x43')](_0x290835)[_0x256e('0x23')](handleEntityNotFound(_0x139a1f,null))[_0x256e('0x23')](respondWithResult(_0x139a1f,null))['catch'](handleError(_0x139a1f,null));};exports[_0x256e('0x44')]=function(_0x42688b,_0x21ad2a){return db[_0x256e('0x2b')][_0x256e('0x44')](_0x42688b[_0x256e('0x45')],{})[_0x256e('0x23')](respondWithResult(_0x21ad2a,0xc9))[_0x256e('0x3f')](handleError(_0x21ad2a,null));};exports[_0x256e('0x22')]=function(_0x241e0e,_0x326586){if(_0x241e0e[_0x256e('0x45')]['id']){delete _0x241e0e[_0x256e('0x45')]['id'];}return db[_0x256e('0x2b')][_0x256e('0x43')]({'where':{'id':_0x241e0e[_0x256e('0x46')]['id']}})['then'](handleEntityNotFound(_0x326586,null))['then'](saveUpdates(_0x241e0e[_0x256e('0x45')],null))['then'](respondWithResult(_0x326586,null))[_0x256e('0x3f')](handleError(_0x326586,null));};exports[_0x256e('0x24')]=function(_0x2bbeb3,_0x4074e9){return db[_0x256e('0x2b')][_0x256e('0x43')]({'where':{'id':_0x2bbeb3[_0x256e('0x46')]['id']}})[_0x256e('0x23')](handleEntityNotFound(_0x4074e9,null))[_0x256e('0x23')](removeEntity(_0x4074e9,null))[_0x256e('0x3f')](handleError(_0x4074e9,null));};exports[_0x256e('0x47')]=function(_0x2c4745,_0xb48bba,_0x44ca8a){var _0x753264={};var _0x1a0868={};var _0x364d1f;var _0x2f49ab;return db['DeskConfiguration'][_0x256e('0x48')]({'where':{'id':_0x2c4745['params']['id']}})[_0x256e('0x23')](handleEntityNotFound(_0xb48bba,null))['then'](function(_0x48da2b){if(_0x48da2b){_0x364d1f=_0x48da2b;_0x1a0868[_0x256e('0x2e')]=_[_0x256e('0x41')](db[_0x256e('0x49')][_0x256e('0x2c')]);_0x1a0868[_0x256e('0x2f')]=_['keys'](_0x2c4745[_0x256e('0x2f')]);_0x1a0868[_0x256e('0x30')]=_[_0x256e('0x32')](_0x1a0868['model'],_0x1a0868[_0x256e('0x2f')]);_0x753264[_0x256e('0x31')]=_[_0x256e('0x32')](_0x1a0868[_0x256e('0x2e')],qs[_0x256e('0x33')](_0x2c4745[_0x256e('0x2f')][_0x256e('0x33')]));_0x753264[_0x256e('0x31')]=_0x753264[_0x256e('0x31')][_0x256e('0x42')]?_0x753264[_0x256e('0x31')]:_0x1a0868['model'];_0x753264[_0x256e('0x35')]=qs[_0x256e('0x36')](_0x2c4745[_0x256e('0x2f')][_0x256e('0x36')]);_0x753264[_0x256e('0x37')]=qs['filters'](_[_0x256e('0x38')](_0x2c4745[_0x256e('0x2f')],_0x1a0868[_0x256e('0x30')]));if(_0x2c4745['query']['filter']){_0x753264[_0x256e('0x37')]=_[_0x256e('0x3a')](_0x753264[_0x256e('0x37')],{'$or':_[_0x256e('0x2a')](_0x753264[_0x256e('0x31')],function(_0xaf3e25){var _0x471221={};_0x471221[_0xaf3e25]={'$like':'%'+_0x2c4745['query'][_0x256e('0x39')]+'%'};return _0x471221;})});}_0x753264=_[_0x256e('0x3a')]({},_0x753264,_0x2c4745[_0x256e('0x3c')]);return _0x364d1f[_0x256e('0x47')](_0x753264);}})['then'](function(_0x4ac392){if(_0x4ac392){_0x2f49ab=_0x4ac392[_0x256e('0x42')];if(!_0x2c4745['query'][_0x256e('0x34')](_0x256e('0x4a'))){_0x753264[_0x256e('0x1e')]=qs[_0x256e('0x1e')](_0x2c4745[_0x256e('0x2f')]['limit']);_0x753264['offset']=qs[_0x256e('0x1c')](_0x2c4745[_0x256e('0x2f')]['offset']);}return _0x364d1f['getFields'](_0x753264);}})['then'](function(_0x35bea3){if(_0x35bea3){return _0x35bea3?{'count':_0x2f49ab,'rows':_0x35bea3}:null;}})[_0x256e('0x23')](respondWithResult(_0xb48bba,null))['catch'](handleError(_0xb48bba,null));};exports[_0x256e('0x4b')]=function(_0x6c1245,_0x3a4312,_0x2b8e5f){var _0x541058={};var _0x4a349c={};var _0x520ac0;var _0x3aeec4;return db[_0x256e('0x2b')][_0x256e('0x48')]({'where':{'id':_0x6c1245[_0x256e('0x46')]['id']}})[_0x256e('0x23')](handleEntityNotFound(_0x3a4312,null))[_0x256e('0x23')](function(_0x350f9d){if(_0x350f9d){_0x520ac0=_0x350f9d;_0x4a349c[_0x256e('0x2e')]=_[_0x256e('0x41')](db[_0x256e('0x49')][_0x256e('0x2c')]);_0x4a349c[_0x256e('0x2f')]=_[_0x256e('0x41')](_0x6c1245[_0x256e('0x2f')]);_0x4a349c[_0x256e('0x30')]=_['intersection'](_0x4a349c[_0x256e('0x2e')],_0x4a349c[_0x256e('0x2f')]);_0x541058[_0x256e('0x31')]=_[_0x256e('0x32')](_0x4a349c[_0x256e('0x2e')],qs[_0x256e('0x33')](_0x6c1245[_0x256e('0x2f')][_0x256e('0x33')]));_0x541058[_0x256e('0x31')]=_0x541058['attributes']['length']?_0x541058['attributes']:_0x4a349c[_0x256e('0x2e')];_0x541058[_0x256e('0x35')]=qs[_0x256e('0x36')](_0x6c1245[_0x256e('0x2f')][_0x256e('0x36')]);_0x541058[_0x256e('0x37')]=qs['filters'](_[_0x256e('0x38')](_0x6c1245[_0x256e('0x2f')],_0x4a349c[_0x256e('0x30')]));if(_0x6c1245[_0x256e('0x2f')]['filter']){_0x541058[_0x256e('0x37')]=_[_0x256e('0x3a')](_0x541058['where'],{'$or':_[_0x256e('0x2a')](_0x541058['attributes'],function(_0x22c834){var _0x555543={};_0x555543[_0x22c834]={'$like':'%'+_0x6c1245[_0x256e('0x2f')]['filter']+'%'};return _0x555543;})});}_0x541058=_[_0x256e('0x3a')]({},_0x541058,_0x6c1245[_0x256e('0x3c')]);return _0x520ac0['getSubjects'](_0x541058);}})[_0x256e('0x23')](function(_0x3280d2){if(_0x3280d2){_0x3aeec4=_0x3280d2[_0x256e('0x42')];if(!_0x6c1245['query'][_0x256e('0x34')]('nolimit')){_0x541058['limit']=qs[_0x256e('0x1e')](_0x6c1245['query']['limit']);_0x541058['offset']=qs[_0x256e('0x1c')](_0x6c1245[_0x256e('0x2f')][_0x256e('0x1c')]);}return _0x520ac0[_0x256e('0x4b')](_0x541058);}})['then'](function(_0x5d58ac){if(_0x5d58ac){return _0x5d58ac?{'count':_0x3aeec4,'rows':_0x5d58ac}:null;}})[_0x256e('0x23')](respondWithResult(_0x3a4312,null))[_0x256e('0x3f')](handleError(_0x3a4312,null));};exports['getDescriptions']=function(_0x41bdcd,_0x4ea089,_0x1b20eb){var _0x4dc141={};var _0x162302={};var _0x58818b;var _0x2c4dc1;return db['DeskConfiguration'][_0x256e('0x48')]({'where':{'id':_0x41bdcd[_0x256e('0x46')]['id']}})[_0x256e('0x23')](handleEntityNotFound(_0x4ea089,null))[_0x256e('0x23')](function(_0x2b6c43){if(_0x2b6c43){_0x58818b=_0x2b6c43;_0x162302[_0x256e('0x2e')]=_[_0x256e('0x41')](db[_0x256e('0x49')][_0x256e('0x2c')]);_0x162302[_0x256e('0x2f')]=_['keys'](_0x41bdcd[_0x256e('0x2f')]);_0x162302[_0x256e('0x30')]=_[_0x256e('0x32')](_0x162302[_0x256e('0x2e')],_0x162302[_0x256e('0x2f')]);_0x4dc141['attributes']=_[_0x256e('0x32')](_0x162302[_0x256e('0x2e')],qs[_0x256e('0x33')](_0x41bdcd['query']['fields']));_0x4dc141[_0x256e('0x31')]=_0x4dc141[_0x256e('0x31')][_0x256e('0x42')]?_0x4dc141[_0x256e('0x31')]:_0x162302[_0x256e('0x2e')];_0x4dc141[_0x256e('0x35')]=qs[_0x256e('0x36')](_0x41bdcd[_0x256e('0x2f')]['sort']);_0x4dc141[_0x256e('0x37')]=qs[_0x256e('0x30')](_['pick'](_0x41bdcd[_0x256e('0x2f')],_0x162302['filters']));if(_0x41bdcd[_0x256e('0x2f')][_0x256e('0x39')]){_0x4dc141['where']=_[_0x256e('0x3a')](_0x4dc141[_0x256e('0x37')],{'$or':_[_0x256e('0x2a')](_0x4dc141[_0x256e('0x31')],function(_0x37f60a){var _0xea3e4b={};_0xea3e4b[_0x37f60a]={'$like':'%'+_0x41bdcd[_0x256e('0x2f')][_0x256e('0x39')]+'%'};return _0xea3e4b;})});}_0x4dc141=_['merge']({},_0x4dc141,_0x41bdcd[_0x256e('0x3c')]);return _0x58818b[_0x256e('0x4c')](_0x4dc141);}})[_0x256e('0x23')](function(_0x5c06b8){if(_0x5c06b8){_0x2c4dc1=_0x5c06b8[_0x256e('0x42')];if(!_0x41bdcd[_0x256e('0x2f')][_0x256e('0x34')](_0x256e('0x4a'))){_0x4dc141[_0x256e('0x1e')]=qs[_0x256e('0x1e')](_0x41bdcd[_0x256e('0x2f')][_0x256e('0x1e')]);_0x4dc141[_0x256e('0x1c')]=qs['offset'](_0x41bdcd[_0x256e('0x2f')]['offset']);}return _0x58818b[_0x256e('0x4c')](_0x4dc141);}})[_0x256e('0x23')](function(_0x3f8373){if(_0x3f8373){return _0x3f8373?{'count':_0x2c4dc1,'rows':_0x3f8373}:null;}})['then'](respondWithResult(_0x4ea089,null))[_0x256e('0x3f')](handleError(_0x4ea089,null));};exports[_0x256e('0x4d')]=function(_0x2c71f9,_0x5efec8,_0x47b109){var _0xf4ec9c={};var _0x2e2cb6={};var _0x297daf;var _0x34a9b1;return db[_0x256e('0x2b')][_0x256e('0x48')]({'where':{'id':_0x2c71f9[_0x256e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5efec8,null))[_0x256e('0x23')](function(_0x1ceb0d){if(_0x1ceb0d){_0x297daf=_0x1ceb0d;_0x2e2cb6[_0x256e('0x2e')]=_[_0x256e('0x41')](db['Tag'][_0x256e('0x2c')]);_0x2e2cb6[_0x256e('0x2f')]=_[_0x256e('0x41')](_0x2c71f9['query']);_0x2e2cb6['filters']=_[_0x256e('0x32')](_0x2e2cb6[_0x256e('0x2e')],_0x2e2cb6[_0x256e('0x2f')]);_0xf4ec9c[_0x256e('0x31')]=_[_0x256e('0x32')](_0x2e2cb6[_0x256e('0x2e')],qs[_0x256e('0x33')](_0x2c71f9['query'][_0x256e('0x33')]));_0xf4ec9c[_0x256e('0x31')]=_0xf4ec9c[_0x256e('0x31')]['length']?_0xf4ec9c[_0x256e('0x31')]:_0x2e2cb6[_0x256e('0x2e')];_0xf4ec9c[_0x256e('0x35')]=qs[_0x256e('0x36')](_0x2c71f9[_0x256e('0x2f')][_0x256e('0x36')]);_0xf4ec9c['where']=qs[_0x256e('0x30')](_[_0x256e('0x38')](_0x2c71f9['query'],_0x2e2cb6['filters']));if(_0x2c71f9[_0x256e('0x2f')][_0x256e('0x39')]){_0xf4ec9c['where']=_[_0x256e('0x3a')](_0xf4ec9c[_0x256e('0x37')],{'$or':_['map'](_0xf4ec9c['attributes'],function(_0x18f2dd){var _0x175928={};_0x175928[_0x18f2dd]={'$like':'%'+_0x2c71f9[_0x256e('0x2f')][_0x256e('0x39')]+'%'};return _0x175928;})});}_0xf4ec9c=_[_0x256e('0x3a')]({},_0xf4ec9c,_0x2c71f9['options']);return _0x297daf['getTags'](_0xf4ec9c);}})[_0x256e('0x23')](function(_0x32a9e3){if(_0x32a9e3){_0x34a9b1=_0x32a9e3[_0x256e('0x42')];if(!_0x2c71f9[_0x256e('0x2f')][_0x256e('0x34')]('nolimit')){_0xf4ec9c[_0x256e('0x1e')]=qs[_0x256e('0x1e')](_0x2c71f9[_0x256e('0x2f')][_0x256e('0x1e')]);_0xf4ec9c[_0x256e('0x1c')]=qs[_0x256e('0x1c')](_0x2c71f9['query'][_0x256e('0x1c')]);}return _0x297daf[_0x256e('0x4d')](_0xf4ec9c);}})[_0x256e('0x23')](function(_0x5560ec){if(_0x5560ec){return _0x5560ec?{'count':_0x34a9b1,'rows':_0x5560ec}:null;}})[_0x256e('0x23')](respondWithResult(_0x5efec8,null))[_0x256e('0x3f')](handleError(_0x5efec8,null));};exports[_0x256e('0x4e')]=function(_0x56d634,_0x33d816,_0x4fcc6b){if(_0x56d634[_0x256e('0x45')]['id']){delete _0x56d634[_0x256e('0x45')]['id'];}return db['DeskConfiguration'][_0x256e('0x48')]({'where':{'id':_0x56d634[_0x256e('0x46')]['id']}})[_0x256e('0x23')](handleEntityNotFound(_0x33d816,null))[_0x256e('0x23')](function(_0x13d1a){if(_0x13d1a){return _0x13d1a[_0x256e('0x4e')](_0x56d634[_0x256e('0x45')]['ids']||[]);}return null;})[_0x256e('0x23')](respondWithResult(_0x33d816,null))[_0x256e('0x3f')](handleError(_0x33d816,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1106183..07e2265 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 _0x009f=['request-promise','path','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x19cd54,_0x391809){var _0x3fcfca=function(_0x2dfcdd){while(--_0x2dfcdd){_0x19cd54['push'](_0x19cd54['shift']());}};_0x3fcfca(++_0x391809);}(_0x009f,0x194));var _0xf009=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x009f[_0x284807];return _0x50c774;};'use strict';var _=require(_0xf009('0x0'));var util=require(_0xf009('0x1'));var logger=require(_0xf009('0x2'))('api');var moment=require(_0xf009('0x3'));var BPromise=require('bluebird');var rp=require(_0xf009('0x4'));var fs=require('fs');var path=require(_0xf009('0x5'));var rimraf=require(_0xf009('0x6'));var config=require(_0xf009('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xf009('0x8')]=function(_0x42e0ea,_0xad16ce){return _0x42e0ea[_0xf009('0x9')](_0xf009('0xa'),attributes,{'tableName':_0xf009('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70ef=['../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x49540e,_0x304431){var _0x556943=function(_0x1ede1c){while(--_0x1ede1c){_0x49540e['push'](_0x49540e['shift']());}};_0x556943(++_0x304431);}(_0x70ef,0x88));var _0xf70e=function(_0x5f52dc,_0x93e5cf){_0x5f52dc=_0x5f52dc-0x0;var _0x3a87e2=_0x70ef[_0x5f52dc];return _0x3a87e2;};'use strict';var _=require(_0xf70e('0x0'));var util=require(_0xf70e('0x1'));var logger=require(_0xf70e('0x2'))('api');var moment=require(_0xf70e('0x3'));var BPromise=require(_0xf70e('0x4'));var rp=require(_0xf70e('0x5'));var fs=require('fs');var path=require(_0xf70e('0x6'));var rimraf=require(_0xf70e('0x7'));var config=require(_0xf70e('0x8'));var attributes=require(_0xf70e('0x9'));module[_0xf70e('0xa')]=function(_0x3b7b78,_0x5ac8de){return _0x3b7b78['define']('DeskConfiguration',attributes,{'tableName':_0xf70e('0xb'),'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 20fd77e..03c7791 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 _0x1b97=['request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x1b97,0x15c));var _0x71b9=function(_0x19f86a,_0x341491){_0x19f86a=_0x19f86a-0x0;var _0x50a9f6=_0x1b97[_0x19f86a];return _0x50a9f6;};'use strict';var _=require(_0x71b9('0x0'));var util=require(_0x71b9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71b9('0x2'));var fs=require('fs');var Redis=require(_0x71b9('0x3'));var db=require(_0x71b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x71b9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x71b9('0x6'));var client=jayson[_0x71b9('0x7')][_0x71b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cb08b,_0x5c1a12,_0x4b13f9){return new BPromise(function(_0x5e31ca,_0x18f4ea){return client[_0x71b9('0x9')](_0x5cb08b,_0x4b13f9)[_0x71b9('0xa')](function(_0x219a3b){logger[_0x71b9('0xb')](_0x71b9('0xc'),_0x5c1a12,_0x71b9('0xd'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c1a12,'request\x20sent',JSON[_0x71b9('0xe')](_0x219a3b));if(_0x219a3b[_0x71b9('0xf')]){if(_0x219a3b['error'][_0x71b9('0x10')]===0x1f4){logger[_0x71b9('0xf')](_0x71b9('0xc'),_0x5c1a12,_0x219a3b[_0x71b9('0xf')][_0x71b9('0x11')]);return _0x18f4ea(_0x219a3b[_0x71b9('0xf')][_0x71b9('0x11')]);}logger[_0x71b9('0xf')](_0x71b9('0xc'),_0x5c1a12,_0x219a3b['error'][_0x71b9('0x11')]);return _0x5e31ca(_0x219a3b[_0x71b9('0xf')][_0x71b9('0x11')]);}else{logger[_0x71b9('0xb')](_0x71b9('0xc'),_0x5c1a12,'request\x20sent');_0x5e31ca(_0x219a3b['result'][_0x71b9('0x11')]);}})[_0x71b9('0x12')](function(_0x165169){logger[_0x71b9('0xf')](_0x71b9('0xc'),_0x5c1a12,_0x165169);_0x18f4ea(_0x165169);});});} \ No newline at end of file +var _0x2515=['http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x3f7101,_0x3af08b){var _0x1a30a0=function(_0x750e5b){while(--_0x750e5b){_0x3f7101['push'](_0x3f7101['shift']());}};_0x1a30a0(++_0x3af08b);}(_0x2515,0x1c2));var _0x5251=function(_0x34350d,_0x1f242e){_0x34350d=_0x34350d-0x0;var _0x3dd678=_0x2515[_0x34350d];return _0x3dd678;};'use strict';var _=require(_0x5251('0x0'));var util=require(_0x5251('0x1'));var moment=require('moment');var BPromise=require(_0x5251('0x2'));var rs=require(_0x5251('0x3'));var fs=require('fs');var Redis=require(_0x5251('0x4'));var db=require(_0x5251('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5251('0x6'))(_0x5251('0x7'));var config=require('../../config/environment');var jayson=require(_0x5251('0x8'));var client=jayson[_0x5251('0x9')][_0x5251('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f4749,_0x107910,_0x213cf2){return new BPromise(function(_0x245d3b,_0x3ca93a){return client[_0x5251('0xb')](_0x3f4749,_0x213cf2)[_0x5251('0xc')](function(_0x2bec99){logger[_0x5251('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x107910,_0x5251('0xe'));logger[_0x5251('0xf')](_0x5251('0x10'),_0x107910,'request\x20sent',JSON[_0x5251('0x11')](_0x2bec99));if(_0x2bec99[_0x5251('0x12')]){if(_0x2bec99[_0x5251('0x12')][_0x5251('0x13')]===0x1f4){logger[_0x5251('0x12')](_0x5251('0x14'),_0x107910,_0x2bec99[_0x5251('0x12')][_0x5251('0x15')]);return _0x3ca93a(_0x2bec99[_0x5251('0x12')][_0x5251('0x15')]);}logger[_0x5251('0x12')](_0x5251('0x14'),_0x107910,_0x2bec99[_0x5251('0x12')][_0x5251('0x15')]);return _0x245d3b(_0x2bec99[_0x5251('0x12')][_0x5251('0x15')]);}else{logger[_0x5251('0xd')](_0x5251('0x14'),_0x107910,_0x5251('0xe'));_0x245d3b(_0x2bec99['result'][_0x5251('0x15')]);}})[_0x5251('0x16')](function(_0xc28aae){logger[_0x5251('0x12')](_0x5251('0x14'),_0x107910,_0xc28aae);_0x3ca93a(_0xc28aae);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4ea8a32..f694991 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 _0x4f9a=['show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4f9a,0xd1));var _0xa4f9=function(_0x19ccf8,_0x8570be){_0x19ccf8=_0x19ccf8-0x0;var _0x19aadd=_0x4f9a[_0x19ccf8];return _0x19aadd;};'use strict';var multer=require('multer');var util=require(_0xa4f9('0x0'));var path=require(_0xa4f9('0x1'));var timeout=require(_0xa4f9('0x2'));var express=require(_0xa4f9('0x3'));var router=express['Router']();var fs_extra=require(_0xa4f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa4f9('0x5'));var config=require(_0xa4f9('0x6'));var controller=require(_0xa4f9('0x7'));router[_0xa4f9('0x8')]('/',auth[_0xa4f9('0x9')](),controller[_0xa4f9('0xa')]);router[_0xa4f9('0x8')]('/:id',auth[_0xa4f9('0x9')](),controller[_0xa4f9('0xb')]);router[_0xa4f9('0xc')]('/',auth['isAuthenticated'](),controller[_0xa4f9('0xd')]);router[_0xa4f9('0xe')](_0xa4f9('0xf'),auth[_0xa4f9('0x9')](),controller[_0xa4f9('0x10')]);router[_0xa4f9('0x11')](_0xa4f9('0xf'),auth[_0xa4f9('0x9')](),controller[_0xa4f9('0x12')]);module[_0xa4f9('0x13')]=router; \ No newline at end of file +var _0x7e70=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','exports'];(function(_0x3879da,_0x3d36fc){var _0x4f9af7=function(_0x477e82){while(--_0x477e82){_0x3879da['push'](_0x3879da['shift']());}};_0x4f9af7(++_0x3d36fc);}(_0x7e70,0x98));var _0x07e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e70[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x07e7('0x0'));var path=require(_0x07e7('0x1'));var timeout=require(_0x07e7('0x2'));var express=require(_0x07e7('0x3'));var router=express[_0x07e7('0x4')]();var fs_extra=require(_0x07e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x07e7('0x6'));var config=require(_0x07e7('0x7'));var controller=require(_0x07e7('0x8'));router[_0x07e7('0x9')]('/',auth['isAuthenticated'](),controller[_0x07e7('0xa')]);router['get']('/:id',auth[_0x07e7('0xb')](),controller[_0x07e7('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x07e7('0xd')]);router[_0x07e7('0xe')](_0x07e7('0xf'),auth[_0x07e7('0xb')](),controller[_0x07e7('0x10')]);router[_0x07e7('0x11')]('/:id',auth[_0x07e7('0xb')](),controller['destroy']);module[_0x07e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3292d79..d9ee724 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 _0x43d9=['STRING','customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0x51b169,_0x5efbc2){var _0x12605a=function(_0x570f5e){while(--_0x570f5e){_0x51b169['push'](_0x51b169['shift']());}};_0x12605a(++_0x5efbc2);}(_0x43d9,0x7b));var _0x943d=function(_0x4f6141,_0x455e86){_0x4f6141=_0x4f6141-0x0;var _0x47501b=_0x43d9[_0x4f6141];return _0x47501b;};'use strict';var Sequelize=require('sequelize');module[_0x943d('0x0')]={'type':{'type':Sequelize[_0x943d('0x1')](_0x943d('0x2'),_0x943d('0x3'),'customVariable',_0x943d('0x4'),'picklist'),'defaultValue':_0x943d('0x2')},'content':{'type':Sequelize[_0x943d('0x5')]},'key':{'type':Sequelize[_0x943d('0x5')]},'keyType':{'type':Sequelize[_0x943d('0x1')]('string',_0x943d('0x3'),_0x943d('0x6'))},'keyContent':{'type':Sequelize[_0x943d('0x5')]},'idField':{'type':Sequelize[_0x943d('0x5')]},'nameField':{'type':Sequelize[_0x943d('0x5')]},'customField':{'type':Sequelize[_0x943d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x943d('0x5')]}}; \ No newline at end of file +var _0x9eef=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x4a274e,_0x2d11bf){var _0xc326ff=function(_0x300665){while(--_0x300665){_0x4a274e['push'](_0x4a274e['shift']());}};_0xc326ff(++_0x2d11bf);}(_0x9eef,0x18e));var _0xf9ee=function(_0x2d96f1,_0xa647e4){_0x2d96f1=_0x2d96f1-0x0;var _0x41a5b0=_0x9eef[_0x2d96f1];return _0x41a5b0;};'use strict';var Sequelize=require(_0xf9ee('0x0'));module['exports']={'type':{'type':Sequelize[_0xf9ee('0x1')](_0xf9ee('0x2'),_0xf9ee('0x3'),_0xf9ee('0x4'),_0xf9ee('0x5'),_0xf9ee('0x6')),'defaultValue':_0xf9ee('0x2')},'content':{'type':Sequelize[_0xf9ee('0x7')]},'key':{'type':Sequelize[_0xf9ee('0x7')]},'keyType':{'type':Sequelize[_0xf9ee('0x1')](_0xf9ee('0x2'),_0xf9ee('0x3'),_0xf9ee('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf9ee('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf9ee('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 221bd70..5d9e480 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 _0x3144=['model','map','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','DeskField','includeAll','findAll','rows','params','include','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','send','index','rawAttributes','fieldName','type'];(function(_0x28ee57,_0x370a11){var _0x109be6=function(_0x547de9){while(--_0x547de9){_0x28ee57['push'](_0x28ee57['shift']());}};_0x109be6(++_0x370a11);}(_0x3144,0x17c));var _0x4314=function(_0x1d8130,_0xcbfa41){_0x1d8130=_0x1d8130-0x0;var _0x3fe033=_0x3144[_0x1d8130];return _0x3fe033;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4314('0x0'));var zipdir=require(_0x4314('0x1'));var jsonpatch=require(_0x4314('0x2'));var rp=require('request-promise');var moment=require(_0x4314('0x3'));var BPromise=require(_0x4314('0x4'));var Mustache=require(_0x4314('0x5'));var util=require(_0x4314('0x6'));var path=require('path');var sox=require(_0x4314('0x7'));var csv=require(_0x4314('0x8'));var ejs=require(_0x4314('0x9'));var fs=require('fs');var fs_extra=require(_0x4314('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4314('0xb'));var deskjs=require(_0x4314('0xc'));var toCsv=require(_0x4314('0x8'));var querystring=require(_0x4314('0xd'));var Papa=require(_0x4314('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4314('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4314('0x10'));var utils=require(_0x4314('0x11'));var config=require(_0x4314('0x12'));var licenseUtil=require(_0x4314('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34856a,_0x2cde61){_0x2cde61=_0x2cde61||0xcc;return function(_0xb5b930){if(_0xb5b930){return _0x34856a['sendStatus'](_0x2cde61);}return _0x34856a[_0x4314('0x14')](_0x2cde61)[_0x4314('0x15')]();};}function respondWithResult(_0x5c1fdb,_0xa9ea18){_0xa9ea18=_0xa9ea18||0xc8;return function(_0x45d6f0){if(_0x45d6f0){return _0x5c1fdb['status'](_0xa9ea18)[_0x4314('0x16')](_0x45d6f0);}};}function respondWithFilteredResult(_0x5acd8e,_0x479af0){return function(_0x3b6f75){if(_0x3b6f75){var _0x1d73a5=typeof _0x479af0[_0x4314('0x17')]==='undefined'&&typeof _0x479af0[_0x4314('0x18')]===_0x4314('0x19');var _0x2ca78d=_0x3b6f75[_0x4314('0x1a')];var _0x5b5898=_0x1d73a5?0x0:_0x479af0['offset'];var _0x444e8a=_0x1d73a5?_0x3b6f75[_0x4314('0x1a')]:_0x479af0[_0x4314('0x17')]+_0x479af0['limit'];var _0x4f75ee;if(_0x444e8a>=_0x2ca78d){_0x444e8a=_0x2ca78d;_0x4f75ee=0xc8;}else{_0x4f75ee=0xce;}_0x5acd8e['status'](_0x4f75ee);return _0x5acd8e['set'](_0x4314('0x1b'),_0x5b5898+'-'+_0x444e8a+'/'+_0x2ca78d)[_0x4314('0x16')](_0x3b6f75);}return null;};}function patchUpdates(_0x10aaae){return function(_0x4097e9){try{jsonpatch[_0x4314('0x1c')](_0x4097e9,_0x10aaae,!![]);}catch(_0x25419e){return BPromise[_0x4314('0x1d')](_0x25419e);}return _0x4097e9['save']();};}function saveUpdates(_0x2b900e,_0x432b29){return function(_0x37e345){if(_0x37e345){return _0x37e345[_0x4314('0x1e')](_0x2b900e)['then'](function(_0x43e2db){return _0x43e2db;});}return null;};}function removeEntity(_0x3bcd6d,_0x296ffa){return function(_0xd4dfa7){if(_0xd4dfa7){return _0xd4dfa7[_0x4314('0x1f')]()[_0x4314('0x20')](function(){_0x3bcd6d[_0x4314('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38908a,_0x5b2ecb){return function(_0x40e45b){if(!_0x40e45b){_0x38908a[_0x4314('0x21')](0x194);}return _0x40e45b;};}function handleError(_0x1c1653,_0x13bb00){_0x13bb00=_0x13bb00||0x1f4;return function(_0x289ec2){logger['error'](_0x289ec2[_0x4314('0x22')]);if(_0x289ec2['name']){delete _0x289ec2['name'];}_0x1c1653[_0x4314('0x14')](_0x13bb00)[_0x4314('0x23')](_0x289ec2);};}exports[_0x4314('0x24')]=function(_0x11a774,_0x4c93e0){var _0xa79e3b={},_0x3beb5a={},_0x2ae5e2={'count':0x0,'rows':[]};var _0x5ab770=_['map'](db['DeskField'][_0x4314('0x25')],function(_0x1797c6){return{'name':_0x1797c6[_0x4314('0x26')],'type':_0x1797c6[_0x4314('0x27')]['key']};});_0x3beb5a[_0x4314('0x28')]=_[_0x4314('0x29')](_0x5ab770,_0x4314('0x2a'));_0x3beb5a[_0x4314('0x2b')]=_[_0x4314('0x2c')](_0x11a774[_0x4314('0x2b')]);_0x3beb5a['filters']=_[_0x4314('0x2d')](_0x3beb5a[_0x4314('0x28')],_0x3beb5a['query']);_0xa79e3b['attributes']=_['intersection'](_0x3beb5a[_0x4314('0x28')],qs[_0x4314('0x2e')](_0x11a774[_0x4314('0x2b')][_0x4314('0x2e')]));_0xa79e3b[_0x4314('0x2f')]=_0xa79e3b[_0x4314('0x2f')][_0x4314('0x30')]?_0xa79e3b[_0x4314('0x2f')]:_0x3beb5a[_0x4314('0x28')];if(!_0x11a774[_0x4314('0x2b')][_0x4314('0x31')](_0x4314('0x32'))){_0xa79e3b[_0x4314('0x18')]=qs[_0x4314('0x18')](_0x11a774['query'][_0x4314('0x18')]);_0xa79e3b[_0x4314('0x17')]=qs['offset'](_0x11a774['query'][_0x4314('0x17')]);}_0xa79e3b[_0x4314('0x33')]=qs[_0x4314('0x34')](_0x11a774[_0x4314('0x2b')][_0x4314('0x34')]);_0xa79e3b[_0x4314('0x35')]=qs[_0x4314('0x36')](_[_0x4314('0x37')](_0x11a774[_0x4314('0x2b')],_0x3beb5a['filters']),_0x5ab770);if(_0x11a774['query'][_0x4314('0x38')]){_0xa79e3b['where']=_[_0x4314('0x39')](_0xa79e3b[_0x4314('0x35')],{'$or':_[_0x4314('0x29')](_0x5ab770,function(_0xb1c949){if(_0xb1c949[_0x4314('0x27')]!==_0x4314('0x3a')){var _0x412b34={};_0x412b34[_0xb1c949[_0x4314('0x2a')]]={'$like':'%'+_0x11a774[_0x4314('0x2b')][_0x4314('0x38')]+'%'};return _0x412b34;}})});}_0xa79e3b=_['merge']({},_0xa79e3b,_0x11a774['options']);var _0x47bde4={'where':_0xa79e3b[_0x4314('0x35')]};return db[_0x4314('0x3b')][_0x4314('0x1a')](_0x47bde4)[_0x4314('0x20')](function(_0x2c965f){_0x2ae5e2['count']=_0x2c965f;if(_0x11a774[_0x4314('0x2b')][_0x4314('0x3c')]){_0xa79e3b['include']=[{'all':!![]}];}return db[_0x4314('0x3b')][_0x4314('0x3d')](_0xa79e3b);})[_0x4314('0x20')](function(_0x14639d){_0x2ae5e2[_0x4314('0x3e')]=_0x14639d;return _0x2ae5e2;})[_0x4314('0x20')](respondWithFilteredResult(_0x4c93e0,_0xa79e3b))['catch'](handleError(_0x4c93e0,null));};exports['show']=function(_0x29ef00,_0x2b8cb6){var _0x5f3e2c={'raw':!![],'where':{'id':_0x29ef00[_0x4314('0x3f')]['id']}},_0xf731f0={};_0xf731f0['model']=_[_0x4314('0x2c')](db[_0x4314('0x3b')][_0x4314('0x25')]);_0xf731f0[_0x4314('0x2b')]=_[_0x4314('0x2c')](_0x29ef00[_0x4314('0x2b')]);_0xf731f0[_0x4314('0x36')]=_[_0x4314('0x2d')](_0xf731f0[_0x4314('0x28')],_0xf731f0[_0x4314('0x2b')]);_0x5f3e2c[_0x4314('0x2f')]=_[_0x4314('0x2d')](_0xf731f0[_0x4314('0x28')],qs['fields'](_0x29ef00['query'][_0x4314('0x2e')]));_0x5f3e2c['attributes']=_0x5f3e2c[_0x4314('0x2f')][_0x4314('0x30')]?_0x5f3e2c[_0x4314('0x2f')]:_0xf731f0[_0x4314('0x28')];if(_0x29ef00[_0x4314('0x2b')][_0x4314('0x3c')]){_0x5f3e2c[_0x4314('0x40')]=[{'all':!![]}];}_0x5f3e2c=_[_0x4314('0x39')]({},_0x5f3e2c,_0x29ef00[_0x4314('0x41')]);return db['DeskField'][_0x4314('0x42')](_0x5f3e2c)[_0x4314('0x20')](handleEntityNotFound(_0x2b8cb6,null))['then'](respondWithResult(_0x2b8cb6,null))[_0x4314('0x43')](handleError(_0x2b8cb6,null));};exports[_0x4314('0x44')]=function(_0x35e918,_0x24d7f6){return db['DeskField'][_0x4314('0x44')](_0x35e918[_0x4314('0x45')],{})[_0x4314('0x20')](respondWithResult(_0x24d7f6,0xc9))['catch'](handleError(_0x24d7f6,null));};exports[_0x4314('0x1e')]=function(_0x51b7cf,_0x5ab34f){if(_0x51b7cf[_0x4314('0x45')]['id']){delete _0x51b7cf['body']['id'];}return db[_0x4314('0x3b')][_0x4314('0x42')]({'where':{'id':_0x51b7cf[_0x4314('0x3f')]['id']}})[_0x4314('0x20')](handleEntityNotFound(_0x5ab34f,null))[_0x4314('0x20')](saveUpdates(_0x51b7cf['body'],null))[_0x4314('0x20')](respondWithResult(_0x5ab34f,null))[_0x4314('0x43')](handleError(_0x5ab34f,null));};exports[_0x4314('0x1f')]=function(_0x1f52e2,_0x81d02e){return db[_0x4314('0x3b')][_0x4314('0x42')]({'where':{'id':_0x1f52e2[_0x4314('0x3f')]['id']}})[_0x4314('0x20')](handleEntityNotFound(_0x81d02e,null))[_0x4314('0x20')](removeEntity(_0x81d02e,null))['catch'](handleError(_0x81d02e,null));}; \ No newline at end of file +var _0xccd4=['options','includeAll','findAll','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3a16d4,_0x23ecda){var _0x31ea9c=function(_0x35fea8){while(--_0x35fea8){_0x3a16d4['push'](_0x3a16d4['shift']());}};_0x31ea9c(++_0x23ecda);}(_0xccd4,0xa4));var _0x4ccd=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xccd4[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0x4ccd('0x0'));var rimraf=require(_0x4ccd('0x1'));var zipdir=require(_0x4ccd('0x2'));var jsonpatch=require(_0x4ccd('0x3'));var rp=require(_0x4ccd('0x4'));var moment=require(_0x4ccd('0x5'));var BPromise=require(_0x4ccd('0x6'));var Mustache=require(_0x4ccd('0x7'));var util=require(_0x4ccd('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ccd('0x9'));var fs=require('fs');var fs_extra=require(_0x4ccd('0xa'));var _=require(_0x4ccd('0xb'));var squel=require(_0x4ccd('0xc'));var crypto=require(_0x4ccd('0xd'));var jsforce=require(_0x4ccd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4ccd('0xf'));var querystring=require(_0x4ccd('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ccd('0x11'));var qs=require(_0x4ccd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ccd('0x13'));var logger=require(_0x4ccd('0x14'))(_0x4ccd('0x15'));var utils=require(_0x4ccd('0x16'));var config=require(_0x4ccd('0x17'));var licenseUtil=require(_0x4ccd('0x18'));var db=require(_0x4ccd('0x19'))['db'];function respondWithStatusCode(_0x57bc32,_0x423336){_0x423336=_0x423336||0xcc;return function(_0x22fef4){if(_0x22fef4){return _0x57bc32[_0x4ccd('0x1a')](_0x423336);}return _0x57bc32[_0x4ccd('0x1b')](_0x423336)[_0x4ccd('0x1c')]();};}function respondWithResult(_0x46be83,_0x32f3cf){_0x32f3cf=_0x32f3cf||0xc8;return function(_0x3784ad){if(_0x3784ad){return _0x46be83[_0x4ccd('0x1b')](_0x32f3cf)[_0x4ccd('0x1d')](_0x3784ad);}};}function respondWithFilteredResult(_0x29643b,_0x4d4c9a){return function(_0x27dcfa){if(_0x27dcfa){var _0xf338b7=typeof _0x4d4c9a[_0x4ccd('0x1e')]===_0x4ccd('0x1f')&&typeof _0x4d4c9a[_0x4ccd('0x20')]==='undefined';var _0x31688d=_0x27dcfa['count'];var _0x5615d8=_0xf338b7?0x0:_0x4d4c9a[_0x4ccd('0x1e')];var _0x1047c8=_0xf338b7?_0x27dcfa[_0x4ccd('0x21')]:_0x4d4c9a[_0x4ccd('0x1e')]+_0x4d4c9a[_0x4ccd('0x20')];var _0x33df51;if(_0x1047c8>=_0x31688d){_0x1047c8=_0x31688d;_0x33df51=0xc8;}else{_0x33df51=0xce;}_0x29643b[_0x4ccd('0x1b')](_0x33df51);return _0x29643b[_0x4ccd('0x22')](_0x4ccd('0x23'),_0x5615d8+'-'+_0x1047c8+'/'+_0x31688d)[_0x4ccd('0x1d')](_0x27dcfa);}return null;};}function patchUpdates(_0x98b4e0){return function(_0x33febc){try{jsonpatch[_0x4ccd('0x24')](_0x33febc,_0x98b4e0,!![]);}catch(_0x738204){return BPromise['reject'](_0x738204);}return _0x33febc[_0x4ccd('0x25')]();};}function saveUpdates(_0x1bf1b2,_0x4074dc){return function(_0x1a608d){if(_0x1a608d){return _0x1a608d[_0x4ccd('0x26')](_0x1bf1b2)[_0x4ccd('0x27')](function(_0x55b766){return _0x55b766;});}return null;};}function removeEntity(_0x35af9b,_0x4efa54){return function(_0x464501){if(_0x464501){return _0x464501[_0x4ccd('0x28')]()[_0x4ccd('0x27')](function(){_0x35af9b[_0x4ccd('0x1b')](0xcc)[_0x4ccd('0x1c')]();});}};}function handleEntityNotFound(_0xd54f92,_0x7468d3){return function(_0x1096cf){if(!_0x1096cf){_0xd54f92[_0x4ccd('0x1a')](0x194);}return _0x1096cf;};}function handleError(_0x48a901,_0x3cc085){_0x3cc085=_0x3cc085||0x1f4;return function(_0x208605){logger['error'](_0x208605[_0x4ccd('0x29')]);if(_0x208605[_0x4ccd('0x2a')]){delete _0x208605['name'];}_0x48a901['status'](_0x3cc085)[_0x4ccd('0x2b')](_0x208605);};}exports['index']=function(_0x469bf8,_0x25f4cc){var _0x490712={},_0x4dfdc0={},_0x462cc2={'count':0x0,'rows':[]};var _0x7a8173=_[_0x4ccd('0x2c')](db[_0x4ccd('0x2d')][_0x4ccd('0x2e')],function(_0x252067){return{'name':_0x252067[_0x4ccd('0x2f')],'type':_0x252067[_0x4ccd('0x30')][_0x4ccd('0x31')]};});_0x4dfdc0[_0x4ccd('0x32')]=_[_0x4ccd('0x2c')](_0x7a8173,_0x4ccd('0x2a'));_0x4dfdc0[_0x4ccd('0x33')]=_[_0x4ccd('0x34')](_0x469bf8[_0x4ccd('0x33')]);_0x4dfdc0[_0x4ccd('0x35')]=_['intersection'](_0x4dfdc0[_0x4ccd('0x32')],_0x4dfdc0[_0x4ccd('0x33')]);_0x490712[_0x4ccd('0x36')]=_[_0x4ccd('0x37')](_0x4dfdc0[_0x4ccd('0x32')],qs[_0x4ccd('0x38')](_0x469bf8[_0x4ccd('0x33')]['fields']));_0x490712[_0x4ccd('0x36')]=_0x490712[_0x4ccd('0x36')][_0x4ccd('0x39')]?_0x490712[_0x4ccd('0x36')]:_0x4dfdc0['model'];if(!_0x469bf8[_0x4ccd('0x33')][_0x4ccd('0x3a')](_0x4ccd('0x3b'))){_0x490712[_0x4ccd('0x20')]=qs[_0x4ccd('0x20')](_0x469bf8[_0x4ccd('0x33')][_0x4ccd('0x20')]);_0x490712[_0x4ccd('0x1e')]=qs[_0x4ccd('0x1e')](_0x469bf8[_0x4ccd('0x33')][_0x4ccd('0x1e')]);}_0x490712[_0x4ccd('0x3c')]=qs[_0x4ccd('0x3d')](_0x469bf8['query']['sort']);_0x490712[_0x4ccd('0x3e')]=qs['filters'](_[_0x4ccd('0x3f')](_0x469bf8[_0x4ccd('0x33')],_0x4dfdc0[_0x4ccd('0x35')]),_0x7a8173);if(_0x469bf8[_0x4ccd('0x33')][_0x4ccd('0x40')]){_0x490712[_0x4ccd('0x3e')]=_[_0x4ccd('0x41')](_0x490712[_0x4ccd('0x3e')],{'$or':_['map'](_0x7a8173,function(_0x14b3e5){if(_0x14b3e5[_0x4ccd('0x30')]!==_0x4ccd('0x42')){var _0x5cb985={};_0x5cb985[_0x14b3e5['name']]={'$like':'%'+_0x469bf8[_0x4ccd('0x33')][_0x4ccd('0x40')]+'%'};return _0x5cb985;}})});}_0x490712=_['merge']({},_0x490712,_0x469bf8[_0x4ccd('0x43')]);var _0x53907c={'where':_0x490712['where']};return db[_0x4ccd('0x2d')][_0x4ccd('0x21')](_0x53907c)[_0x4ccd('0x27')](function(_0x1af1d9){_0x462cc2[_0x4ccd('0x21')]=_0x1af1d9;if(_0x469bf8['query'][_0x4ccd('0x44')]){_0x490712['include']=[{'all':!![]}];}return db[_0x4ccd('0x2d')][_0x4ccd('0x45')](_0x490712);})[_0x4ccd('0x27')](function(_0x1f57e7){_0x462cc2['rows']=_0x1f57e7;return _0x462cc2;})[_0x4ccd('0x27')](respondWithFilteredResult(_0x25f4cc,_0x490712))['catch'](handleError(_0x25f4cc,null));};exports[_0x4ccd('0x46')]=function(_0x121f0e,_0x2de907){var _0xceba86={'raw':!![],'where':{'id':_0x121f0e[_0x4ccd('0x47')]['id']}},_0x257b4a={};_0x257b4a['model']=_[_0x4ccd('0x34')](db[_0x4ccd('0x2d')][_0x4ccd('0x2e')]);_0x257b4a['query']=_[_0x4ccd('0x34')](_0x121f0e[_0x4ccd('0x33')]);_0x257b4a[_0x4ccd('0x35')]=_[_0x4ccd('0x37')](_0x257b4a[_0x4ccd('0x32')],_0x257b4a['query']);_0xceba86[_0x4ccd('0x36')]=_['intersection'](_0x257b4a['model'],qs[_0x4ccd('0x38')](_0x121f0e[_0x4ccd('0x33')][_0x4ccd('0x38')]));_0xceba86[_0x4ccd('0x36')]=_0xceba86[_0x4ccd('0x36')][_0x4ccd('0x39')]?_0xceba86['attributes']:_0x257b4a['model'];if(_0x121f0e['query'][_0x4ccd('0x44')]){_0xceba86[_0x4ccd('0x48')]=[{'all':!![]}];}_0xceba86=_[_0x4ccd('0x41')]({},_0xceba86,_0x121f0e[_0x4ccd('0x43')]);return db[_0x4ccd('0x2d')][_0x4ccd('0x49')](_0xceba86)['then'](handleEntityNotFound(_0x2de907,null))[_0x4ccd('0x27')](respondWithResult(_0x2de907,null))[_0x4ccd('0x4a')](handleError(_0x2de907,null));};exports['create']=function(_0x2c881e,_0x2e1171){return db[_0x4ccd('0x2d')][_0x4ccd('0x4b')](_0x2c881e['body'],{})['then'](respondWithResult(_0x2e1171,0xc9))['catch'](handleError(_0x2e1171,null));};exports[_0x4ccd('0x26')]=function(_0x523d0e,_0x430716){if(_0x523d0e['body']['id']){delete _0x523d0e[_0x4ccd('0x4c')]['id'];}return db['DeskField']['find']({'where':{'id':_0x523d0e['params']['id']}})[_0x4ccd('0x27')](handleEntityNotFound(_0x430716,null))[_0x4ccd('0x27')](saveUpdates(_0x523d0e[_0x4ccd('0x4c')],null))[_0x4ccd('0x27')](respondWithResult(_0x430716,null))['catch'](handleError(_0x430716,null));};exports[_0x4ccd('0x28')]=function(_0x2edf3c,_0xfd17a3){return db[_0x4ccd('0x2d')][_0x4ccd('0x49')]({'where':{'id':_0x2edf3c[_0x4ccd('0x47')]['id']}})[_0x4ccd('0x27')](handleEntityNotFound(_0xfd17a3,null))['then'](removeEntity(_0xfd17a3,null))[_0x4ccd('0x4a')](handleError(_0xfd17a3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 575930a..2dc56f2 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 _0x8c20=['exports','define','DeskField','desk_unique_index','FieldId','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x2a36bd,_0xa128e3){var _0xbfb193=function(_0x774c04){while(--_0x774c04){_0x2a36bd['push'](_0x2a36bd['shift']());}};_0xbfb193(++_0xa128e3);}(_0x8c20,0x1cc));var _0x08c2=function(_0x4c953c,_0x2edbb8){_0x4c953c=_0x4c953c-0x0;var _0xfa0543=_0x8c20[_0x4c953c];return _0xfa0543;};'use strict';var _=require(_0x08c2('0x0'));var util=require('util');var logger=require(_0x08c2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x08c2('0x2'));var rp=require(_0x08c2('0x3'));var fs=require('fs');var path=require(_0x08c2('0x4'));var rimraf=require(_0x08c2('0x5'));var config=require(_0x08c2('0x6'));var attributes=require(_0x08c2('0x7'));module[_0x08c2('0x8')]=function(_0x3b9e0b,_0x377247){return _0x3b9e0b[_0x08c2('0x9')](_0x08c2('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x08c2('0xb'),'fields':['idField',_0x08c2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f44=['desk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField'];(function(_0x2aeea1,_0x134d71){var _0x52f4a0=function(_0x151333){while(--_0x151333){_0x2aeea1['push'](_0x2aeea1['shift']());}};_0x52f4a0(++_0x134d71);}(_0x0f44,0xa8));var _0x40f4=function(_0x5c4a33,_0xee6ff3){_0x5c4a33=_0x5c4a33-0x0;var _0x175630=_0x0f44[_0x5c4a33];return _0x175630;};'use strict';var _=require(_0x40f4('0x0'));var util=require(_0x40f4('0x1'));var logger=require(_0x40f4('0x2'))('api');var moment=require(_0x40f4('0x3'));var BPromise=require(_0x40f4('0x4'));var rp=require(_0x40f4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40f4('0x6'));var config=require(_0x40f4('0x7'));var attributes=require(_0x40f4('0x8'));module[_0x40f4('0x9')]=function(_0x210a63,_0x1132d0){return _0x210a63[_0x40f4('0xa')](_0x40f4('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x40f4('0xc'),'fields':[_0x40f4('0xd'),_0x40f4('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 42c38c0..4d07c45 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 _0x453a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x325aef,_0x2a3cdc){var _0x343e14=function(_0x270e25){while(--_0x270e25){_0x325aef['push'](_0x325aef['shift']());}};_0x343e14(++_0x2a3cdc);}(_0x453a,0x1c2));var _0xa453=function(_0x449acc,_0x416458){_0x449acc=_0x449acc-0x0;var _0x15d15d=_0x453a[_0x449acc];return _0x15d15d;};'use strict';var _=require(_0xa453('0x0'));var util=require(_0xa453('0x1'));var moment=require(_0xa453('0x2'));var BPromise=require(_0xa453('0x3'));var rs=require(_0xa453('0x4'));var fs=require('fs');var Redis=require(_0xa453('0x5'));var db=require(_0xa453('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa453('0x7'))(_0xa453('0x8'));var config=require(_0xa453('0x9'));var jayson=require(_0xa453('0xa'));var client=jayson[_0xa453('0xb')][_0xa453('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43c79f,_0x461471,_0x37d1cd){return new BPromise(function(_0x34b4eb,_0x887e1a){return client[_0xa453('0xd')](_0x43c79f,_0x37d1cd)[_0xa453('0xe')](function(_0x17b5aa){logger[_0xa453('0xf')](_0xa453('0x10'),_0x461471,_0xa453('0x11'));logger['debug'](_0xa453('0x12'),_0x461471,_0xa453('0x11'),JSON[_0xa453('0x13')](_0x17b5aa));if(_0x17b5aa[_0xa453('0x14')]){if(_0x17b5aa[_0xa453('0x14')][_0xa453('0x15')]===0x1f4){logger[_0xa453('0x14')](_0xa453('0x10'),_0x461471,_0x17b5aa[_0xa453('0x14')][_0xa453('0x16')]);return _0x887e1a(_0x17b5aa['error'][_0xa453('0x16')]);}logger[_0xa453('0x14')]('DeskField,\x20%s,\x20%s',_0x461471,_0x17b5aa['error'][_0xa453('0x16')]);return _0x34b4eb(_0x17b5aa[_0xa453('0x14')]['message']);}else{logger['info'](_0xa453('0x10'),_0x461471,_0xa453('0x11'));_0x34b4eb(_0x17b5aa[_0xa453('0x17')]['message']);}})[_0xa453('0x18')](function(_0xdd72ff){logger[_0xa453('0x14')](_0xa453('0x10'),_0x461471,_0xdd72ff);_0x887e1a(_0xdd72ff);});});} \ No newline at end of file +var _0xfddd=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash'];(function(_0x3c7ae2,_0x5504e3){var _0x39f0d7=function(_0x54e317){while(--_0x54e317){_0x3c7ae2['push'](_0x3c7ae2['shift']());}};_0x39f0d7(++_0x5504e3);}(_0xfddd,0x110));var _0xdfdd=function(_0x2ae0cf,_0x3de0ee){_0x2ae0cf=_0x2ae0cf-0x0;var _0x2e5fe9=_0xfddd[_0x2ae0cf];return _0x2e5fe9;};'use strict';var _=require(_0xdfdd('0x0'));var util=require(_0xdfdd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdfdd('0x2'));var fs=require('fs');var Redis=require(_0xdfdd('0x3'));var db=require(_0xdfdd('0x4'))['db'];var utils=require(_0xdfdd('0x5'));var logger=require(_0xdfdd('0x6'))(_0xdfdd('0x7'));var config=require(_0xdfdd('0x8'));var jayson=require(_0xdfdd('0x9'));var client=jayson['client'][_0xdfdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x79c076,_0x56745a,_0x5bcf9a){return new BPromise(function(_0x3c410f,_0x5e36db){return client[_0xdfdd('0xb')](_0x79c076,_0x5bcf9a)[_0xdfdd('0xc')](function(_0x203935){logger['info'](_0xdfdd('0xd'),_0x56745a,'request\x20sent');logger[_0xdfdd('0xe')](_0xdfdd('0xf'),_0x56745a,_0xdfdd('0x10'),JSON[_0xdfdd('0x11')](_0x203935));if(_0x203935[_0xdfdd('0x12')]){if(_0x203935['error'][_0xdfdd('0x13')]===0x1f4){logger[_0xdfdd('0x12')](_0xdfdd('0xd'),_0x56745a,_0x203935['error'][_0xdfdd('0x14')]);return _0x5e36db(_0x203935[_0xdfdd('0x12')]['message']);}logger[_0xdfdd('0x12')]('DeskField,\x20%s,\x20%s',_0x56745a,_0x203935[_0xdfdd('0x12')]['message']);return _0x3c410f(_0x203935[_0xdfdd('0x12')][_0xdfdd('0x14')]);}else{logger['info'](_0xdfdd('0xd'),_0x56745a,_0xdfdd('0x10'));_0x3c410f(_0x203935['result']['message']);}})['catch'](function(_0x2539bc){logger['error']('DeskField,\x20%s,\x20%s',_0x56745a,_0x2539bc);_0x5e36db(_0x2539bc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index cfbd216..a948b19 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 _0x98ee=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','post','create','put','update'];(function(_0x570880,_0x20552d){var _0x1c9252=function(_0x252407){while(--_0x252407){_0x570880['push'](_0x570880['shift']());}};_0x1c9252(++_0x20552d);}(_0x98ee,0x178));var _0xe98e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x98ee[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xe98e('0x0'));var util=require(_0xe98e('0x1'));var path=require(_0xe98e('0x2'));var timeout=require(_0xe98e('0x3'));var express=require(_0xe98e('0x4'));var router=express[_0xe98e('0x5')]();var fs_extra=require(_0xe98e('0x6'));var auth=require(_0xe98e('0x7'));var interaction=require(_0xe98e('0x8'));var config=require(_0xe98e('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xe98e('0xa')](),controller['index']);router[_0xe98e('0xb')](_0xe98e('0xc'),auth[_0xe98e('0xa')](),controller[_0xe98e('0xd')]);router['get'](_0xe98e('0xe'),auth[_0xe98e('0xa')](),controller[_0xe98e('0xf')]);router[_0xe98e('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xe98e('0x10')]('/',auth[_0xe98e('0xa')](),controller[_0xe98e('0x11')]);router['post'](_0xe98e('0xe'),auth[_0xe98e('0xa')](),controller['addConfiguration']);router[_0xe98e('0x12')](_0xe98e('0xc'),auth[_0xe98e('0xa')](),controller[_0xe98e('0x13')]);router[_0xe98e('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe98e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa62b=['multer','util','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/fields','post','/:id/configurations','destroy','exports'];(function(_0x11b3bf,_0xca12c){var _0x2eeb8b=function(_0x47a388){while(--_0x47a388){_0x11b3bf['push'](_0x11b3bf['shift']());}};_0x2eeb8b(++_0xca12c);}(_0xa62b,0xcc));var _0xba62=function(_0xb897ee,_0x24a4da){_0xb897ee=_0xb897ee-0x0;var _0x8b3db0=_0xa62b[_0xb897ee];return _0x8b3db0;};'use strict';var multer=require(_0xba62('0x0'));var util=require(_0xba62('0x1'));var path=require('path');var timeout=require(_0xba62('0x2'));var express=require(_0xba62('0x3'));var router=express[_0xba62('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba62('0x5'));var config=require('../../config/environment');var controller=require(_0xba62('0x6'));router['get']('/',auth[_0xba62('0x7')](),controller[_0xba62('0x8')]);router[_0xba62('0x9')](_0xba62('0xa'),auth[_0xba62('0x7')](),controller[_0xba62('0xb')]);router[_0xba62('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xba62('0xc'),auth[_0xba62('0x7')](),controller['getFields']);router[_0xba62('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xba62('0xd')](_0xba62('0xe'),auth[_0xba62('0x7')](),controller['addConfiguration']);router['put'](_0xba62('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xba62('0xa'),auth['isAuthenticated'](),controller[_0xba62('0xf')]);module[_0xba62('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 783d8c3..6c0d01b 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 _0xb6f1=['BOOLEAN','sequelize','STRING'];(function(_0x464262,_0x5e8304){var _0x29fc8e=function(_0x3ff2da){while(--_0x3ff2da){_0x464262['push'](_0x464262['shift']());}};_0x29fc8e(++_0x5e8304);}(_0xb6f1,0x118));var _0x1b6f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xb6f1[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x1b6f('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b6f('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1b6f('0x1')]},'remoteUri':{'type':Sequelize[_0x1b6f('0x1')]},'tenantId':{'type':Sequelize[_0x1b6f('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x1b6f('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1b6f('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1b6f('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x29b1=['BOOLEAN','STRING'];(function(_0x43d740,_0x1b0b44){var _0xc60a51=function(_0x523c25){while(--_0x523c25){_0x43d740['push'](_0x43d740['shift']());}};_0xc60a51(++_0x1b0b44);}(_0x29b1,0x13b));var _0x129b=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x29b1[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x129b('0x0')]},'username':{'type':Sequelize[_0x129b('0x0')]},'password':{'type':Sequelize[_0x129b('0x0')]},'remoteUri':{'type':Sequelize[_0x129b('0x0')]},'tenantId':{'type':Sequelize[_0x129b('0x0')]},'clientId':{'type':Sequelize[_0x129b('0x0')]},'clientSecret':{'type':Sequelize[_0x129b('0x0')]},'serverUrl':{'type':Sequelize[_0x129b('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x129b('0x0')]},'modernAuthentication':{'type':Sequelize[_0x129b('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 0ffc175..5bbbadf 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 _0xa9dc=['actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','POST','https://login.microsoftonline.com/','password','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','sendStatus','stack','name','send','map','Dynamics365Account','rawAttributes','key','query','keys','filters','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getConfigurations','findOne','Dynamics365Configuration','length','AccountId','Subjects','channel','Dynamics365Field','Descriptions','substring','lastIndexOf','format','getFields','PhoneCall','title','description','customerid','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame'];(function(_0xc7eb36,_0x589842){var _0x1c9dbe=function(_0x508dc6){while(--_0x508dc6){_0xc7eb36['push'](_0xc7eb36['shift']());}};_0x1c9dbe(++_0x589842);}(_0xa9dc,0x71));var _0xca9d=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xa9dc[_0x616290];return _0x453879;};'use strict';var rp=require(_0xca9d('0x0'));var util=require('util');var _=require(_0xca9d('0x1'));var qs=require(_0xca9d('0x2'));var logger=require(_0xca9d('0x3'))(_0xca9d('0x4'));var db=require(_0xca9d('0x5'))['db'];var integrations=require(_0xca9d('0x6'));function respondWithResult(_0x3b10fa,_0x2fa026){_0x2fa026=_0x2fa026||0xc8;return function(_0x11e151){if(_0x11e151){return _0x3b10fa[_0xca9d('0x7')](_0x2fa026)[_0xca9d('0x8')](_0x11e151);}};}function respondWithFilteredResult(_0x430520,_0x27db3e){return function(_0x3a635c){if(_0x3a635c){var _0x45320b=typeof _0x27db3e['offset']===_0xca9d('0x9')&&typeof _0x27db3e[_0xca9d('0xa')]===_0xca9d('0x9');var _0x2b58e6=_0x3a635c[_0xca9d('0xb')];var _0x9c9cbd=_0x45320b?0x0:_0x27db3e[_0xca9d('0xc')];var _0x2bb4cc=_0x45320b?_0x3a635c['count']:_0x27db3e[_0xca9d('0xc')]+_0x27db3e[_0xca9d('0xa')];var _0x597433;if(_0x2bb4cc>=_0x2b58e6){_0x2bb4cc=_0x2b58e6;_0x597433=0xc8;}else{_0x597433=0xce;}_0x430520[_0xca9d('0x7')](_0x597433);return _0x430520[_0xca9d('0xd')](_0xca9d('0xe'),_0x9c9cbd+'-'+_0x2bb4cc+'/'+_0x2b58e6)[_0xca9d('0x8')](_0x3a635c);}return null;};}function saveUpdates(_0xe004b3){return function(_0x375e2e){if(_0x375e2e){return _0x375e2e[_0xca9d('0xf')](_0xe004b3)['then'](function(_0x5ee64f){return _0x5ee64f;});}return null;};}function removeEntity(_0x3c2a3){return function(_0x55e8f1){if(_0x55e8f1){return _0x55e8f1[_0xca9d('0x10')]()['then'](function(){_0x3c2a3[_0xca9d('0x7')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27fe11){return function(_0x4d63dc){if(!_0x4d63dc){_0x27fe11[_0xca9d('0x11')](0x194);}return _0x4d63dc;};}function handleError(_0x5ac7cc,_0x5a331b){_0x5a331b=_0x5a331b||0x1f4;return function(_0x3383ff){logger['error'](_0x3383ff[_0xca9d('0x12')]);if(_0x3383ff[_0xca9d('0x13')]){delete _0x3383ff['name'];}_0x5ac7cc[_0xca9d('0x7')](_0x5a331b)[_0xca9d('0x14')](_0x3383ff);};}exports['index']=function(_0x2eeab6,_0x3d3bef){var _0x3b0035={},_0x14466d={},_0x3d9cbb={'count':0x0,'rows':[]};var _0x5687f5=_[_0xca9d('0x15')](db[_0xca9d('0x16')][_0xca9d('0x17')],function(_0x43ef67){return{'name':_0x43ef67['fieldName'],'type':_0x43ef67['type'][_0xca9d('0x18')]};});_0x14466d['model']=_[_0xca9d('0x15')](_0x5687f5,_0xca9d('0x13'));_0x14466d[_0xca9d('0x19')]=_[_0xca9d('0x1a')](_0x2eeab6['query']);_0x14466d[_0xca9d('0x1b')]=_[_0xca9d('0x1c')](_0x14466d['model'],_0x14466d[_0xca9d('0x19')]);_0x3b0035[_0xca9d('0x1d')]=_[_0xca9d('0x1c')](_0x14466d[_0xca9d('0x1e')],qs['fields'](_0x2eeab6[_0xca9d('0x19')]['fields']));_0x3b0035['attributes']=_0x3b0035[_0xca9d('0x1d')]['length']?_0x3b0035[_0xca9d('0x1d')]:_0x14466d[_0xca9d('0x1e')];if(!_0x2eeab6['query'][_0xca9d('0x1f')](_0xca9d('0x20'))){_0x3b0035[_0xca9d('0xa')]=qs[_0xca9d('0xa')](_0x2eeab6['query'][_0xca9d('0xa')]);_0x3b0035[_0xca9d('0xc')]=qs[_0xca9d('0xc')](_0x2eeab6[_0xca9d('0x19')][_0xca9d('0xc')]);}_0x3b0035[_0xca9d('0x21')]=qs[_0xca9d('0x22')](_0x2eeab6[_0xca9d('0x19')]['sort']);_0x3b0035[_0xca9d('0x23')]=qs['filters'](_[_0xca9d('0x24')](_0x2eeab6[_0xca9d('0x19')],_0x14466d['filters']),_0x5687f5);if(_0x2eeab6[_0xca9d('0x19')][_0xca9d('0x25')]){_0x3b0035[_0xca9d('0x23')]=_[_0xca9d('0x26')](_0x3b0035[_0xca9d('0x23')],{'$or':_['map'](_0x5687f5,function(_0x11c34d){if(_0x11c34d[_0xca9d('0x27')]!==_0xca9d('0x28')){var _0x1b016d={};_0x1b016d[_0x11c34d[_0xca9d('0x13')]]={'$like':'%'+_0x2eeab6[_0xca9d('0x19')][_0xca9d('0x25')]+'%'};return _0x1b016d;}})});}_0x3b0035=_[_0xca9d('0x26')]({},_0x3b0035,_0x2eeab6[_0xca9d('0x29')]);var _0x53dba5={'where':_0x3b0035['where']};return db['Dynamics365Account'][_0xca9d('0xb')](_0x53dba5)[_0xca9d('0x2a')](function(_0x183d7d){_0x3d9cbb[_0xca9d('0xb')]=_0x183d7d;if(_0x2eeab6[_0xca9d('0x19')][_0xca9d('0x2b')]){_0x3b0035[_0xca9d('0x2c')]=[{'all':!![]}];}return db[_0xca9d('0x16')][_0xca9d('0x2d')](_0x3b0035);})[_0xca9d('0x2a')](function(_0x4f04c9){_0x3d9cbb[_0xca9d('0x2e')]=_0x4f04c9;return _0x3d9cbb;})[_0xca9d('0x2a')](respondWithFilteredResult(_0x3d3bef,_0x3b0035))[_0xca9d('0x2f')](handleError(_0x3d3bef,null));};exports[_0xca9d('0x30')]=function(_0x92b8f4,_0x28c8c2){var _0x5b311b={'raw':![],'where':{'id':_0x92b8f4[_0xca9d('0x31')]['id']}},_0x33cf4b={};_0x33cf4b['model']=_[_0xca9d('0x1a')](db[_0xca9d('0x16')][_0xca9d('0x17')]);_0x33cf4b['query']=_['keys'](_0x92b8f4['query']);_0x33cf4b[_0xca9d('0x1b')]=_['intersection'](_0x33cf4b[_0xca9d('0x1e')],_0x33cf4b[_0xca9d('0x19')]);_0x5b311b[_0xca9d('0x1d')]=_['intersection'](_0x33cf4b['model'],qs[_0xca9d('0x32')](_0x92b8f4[_0xca9d('0x19')]['fields']));_0x5b311b[_0xca9d('0x1d')]=_0x5b311b['attributes']['length']?_0x5b311b[_0xca9d('0x1d')]:_0x33cf4b['model'];if(_0x92b8f4[_0xca9d('0x19')][_0xca9d('0x2b')]){_0x5b311b['include']=[{'all':!![]}];}_0x5b311b=_['merge']({},_0x5b311b,_0x92b8f4[_0xca9d('0x29')]);return db[_0xca9d('0x16')][_0xca9d('0x33')](_0x5b311b)['then'](handleEntityNotFound(_0x28c8c2,null))['then'](respondWithResult(_0x28c8c2,null))['catch'](handleError(_0x28c8c2,null));};exports['create']=function(_0x38e3c3,_0x24a7a1){return db[_0xca9d('0x16')][_0xca9d('0x34')](_0x38e3c3[_0xca9d('0x35')],{})[_0xca9d('0x2a')](respondWithResult(_0x24a7a1,0xc9))[_0xca9d('0x2f')](handleError(_0x24a7a1,null));};exports[_0xca9d('0xf')]=function(_0x40e8a8,_0x41ef96){if(_0x40e8a8[_0xca9d('0x35')]['id']){delete _0x40e8a8[_0xca9d('0x35')]['id'];}return db[_0xca9d('0x16')][_0xca9d('0x33')]({'where':{'id':_0x40e8a8[_0xca9d('0x31')]['id']}})[_0xca9d('0x2a')](handleEntityNotFound(_0x41ef96,null))[_0xca9d('0x2a')](saveUpdates(_0x40e8a8[_0xca9d('0x35')],null))['then'](respondWithResult(_0x41ef96,null))[_0xca9d('0x2f')](handleError(_0x41ef96,null));};exports[_0xca9d('0x10')]=function(_0x5b5dc6,_0x5dbf35){return db[_0xca9d('0x16')][_0xca9d('0x33')]({'where':{'id':_0x5b5dc6['params']['id']}})['then'](handleEntityNotFound(_0x5dbf35,null))[_0xca9d('0x2a')](removeEntity(_0x5dbf35,null))[_0xca9d('0x2f')](handleError(_0x5dbf35,null));};exports[_0xca9d('0x36')]=function(_0x27849a,_0x52a3c4){var _0xa5952e={};var _0x57b255={};var _0x5dd6f2;var _0x50b917;return db[_0xca9d('0x16')][_0xca9d('0x37')]({'where':{'id':_0x27849a['params']['id']}})['then'](handleEntityNotFound(_0x52a3c4,null))['then'](function(_0x1d2225){if(_0x1d2225){_0x5dd6f2=_0x1d2225;_0x57b255['model']=_[_0xca9d('0x1a')](db[_0xca9d('0x38')][_0xca9d('0x17')]);_0x57b255[_0xca9d('0x19')]=_[_0xca9d('0x1a')](_0x27849a['query']);_0x57b255[_0xca9d('0x1b')]=_['intersection'](_0x57b255[_0xca9d('0x1e')],_0x57b255[_0xca9d('0x19')]);_0xa5952e[_0xca9d('0x1d')]=_[_0xca9d('0x1c')](_0x57b255[_0xca9d('0x1e')],qs[_0xca9d('0x32')](_0x27849a[_0xca9d('0x19')][_0xca9d('0x32')]));_0xa5952e[_0xca9d('0x1d')]=_0xa5952e[_0xca9d('0x1d')]['length']?_0xa5952e[_0xca9d('0x1d')]:_0x57b255[_0xca9d('0x1e')];_0xa5952e[_0xca9d('0x21')]=qs['sort'](_0x27849a[_0xca9d('0x19')][_0xca9d('0x22')]);_0xa5952e[_0xca9d('0x23')]=qs[_0xca9d('0x1b')](_[_0xca9d('0x24')](_0x27849a[_0xca9d('0x19')],_0x57b255[_0xca9d('0x1b')]));if(_0x27849a[_0xca9d('0x19')][_0xca9d('0x25')]){_0xa5952e[_0xca9d('0x23')]=_[_0xca9d('0x26')](_0xa5952e[_0xca9d('0x23')],{'$or':_[_0xca9d('0x15')](_0xa5952e[_0xca9d('0x1d')],function(_0x2d07ff){var _0x34a243={};_0x34a243[_0x2d07ff]={'$like':'%'+_0x27849a[_0xca9d('0x19')][_0xca9d('0x25')]+'%'};return _0x34a243;})});}_0xa5952e=_[_0xca9d('0x26')]({},_0xa5952e,_0x27849a[_0xca9d('0x29')]);return _0x5dd6f2[_0xca9d('0x36')](_0xa5952e);}})[_0xca9d('0x2a')](function(_0x5ea55a){if(_0x5ea55a){_0x50b917=_0x5ea55a[_0xca9d('0x39')];if(!_0x27849a[_0xca9d('0x19')][_0xca9d('0x1f')](_0xca9d('0x20'))){_0xa5952e[_0xca9d('0xa')]=qs[_0xca9d('0xa')](_0x27849a[_0xca9d('0x19')][_0xca9d('0xa')]);_0xa5952e[_0xca9d('0xc')]=qs['offset'](_0x27849a[_0xca9d('0x19')][_0xca9d('0xc')]);}return _0x5dd6f2[_0xca9d('0x36')](_0xa5952e);}})['then'](function(_0xf6281c){if(_0xf6281c){return _0xf6281c?{'count':_0x50b917,'rows':_0xf6281c}:null;}})[_0xca9d('0x2a')](respondWithResult(_0x52a3c4,null))[_0xca9d('0x2f')](handleError(_0x52a3c4,null));};exports['addConfiguration']=function(_0x305efc,_0x26ff81){if(_0x305efc[_0xca9d('0x35')]['id']){delete _0x305efc[_0xca9d('0x35')]['id'];}return db[_0xca9d('0x16')][_0xca9d('0x37')]({'where':{'id':_0x305efc[_0xca9d('0x31')]['id']}})['then'](handleEntityNotFound(_0x26ff81,null))[_0xca9d('0x2a')](function(_0xa5202e){if(_0xa5202e){_0x305efc[_0xca9d('0x35')][_0xca9d('0x3a')]=_0xa5202e['id'];_0x305efc[_0xca9d('0x35')][_0xca9d('0x3b')]=integrations['getSubjects'](_0x305efc[_0xca9d('0x35')][_0xca9d('0x3c')],_0x305efc['body'][_0xca9d('0x27')]);_0x305efc[_0xca9d('0x35')]['Descriptions']=integrations['getDescriptions'](_0x305efc[_0xca9d('0x35')]['channel'],_0x305efc[_0xca9d('0x35')][_0xca9d('0x27')]);return db[_0xca9d('0x38')][_0xca9d('0x34')](_0x305efc['body'],{'include':[{'model':db[_0xca9d('0x3d')],'as':_0xca9d('0x3b')},{'model':db[_0xca9d('0x3d')],'as':_0xca9d('0x3e')}]});}return null;})[_0xca9d('0x2a')](respondWithResult(_0x26ff81,null))[_0xca9d('0x2f')](handleError(_0x26ff81,null));};function sanitizeRemoteUri(_0xd99c9e){var _0x1db2fc=_0xd99c9e['slice'](-0x1);if(_0x1db2fc==='/')return _0xd99c9e[_0xca9d('0x3f')](0x0,_0xd99c9e[_0xca9d('0x40')](_0x1db2fc));return _0xd99c9e;}function getWebApiUrl(_0x298e3d){return util[_0xca9d('0x41')]('%s/api/data/v9.0/',_0x298e3d);}exports[_0xca9d('0x42')]=function(_0x32d428,_0x5129ce){var _0x4d7139=_0x32d428['query']['ticketType'];var _0x23d815=_0x4d7139==='incident'?'Incident':_0xca9d('0x43');var _0x5cb94f='';var _0x20459f='';var _0x147fa2='';var _0x4e2c10='';var _0x13a98d='';var _0xd3329b='';var _0x462c3f='';var _0xe4c3c1='';var _0x2aa85c=[_0xca9d('0x44'),_0xca9d('0x45'),_0xca9d('0x46'),'ownerid','caseorigincode','subject','phonenumber',_0xca9d('0x47'),_0xca9d('0x48'),_0xca9d('0x49')];var _0x3dfaef=[_0xca9d('0x4a'),_0xca9d('0x4b'),_0xca9d('0x4c'),_0xca9d('0x4d'),_0xca9d('0x4e'),'contactidyominame',_0xca9d('0x4f'),_0xca9d('0x50'),_0xca9d('0x51'),_0xca9d('0x52'),_0xca9d('0x53'),_0xca9d('0x54'),_0xca9d('0x55'),_0xca9d('0x56'),_0xca9d('0x57'),_0xca9d('0x58'),_0xca9d('0x59'),_0xca9d('0x5a'),_0xca9d('0x5b'),_0xca9d('0x5c'),_0xca9d('0x5d'),'entityimage_url','escalatedon',_0xca9d('0x5e'),_0xca9d('0x5f'),_0xca9d('0x60'),_0xca9d('0x61'),_0xca9d('0x62'),_0xca9d('0x63'),_0xca9d('0x64'),_0xca9d('0x65'),_0xca9d('0x66'),_0xca9d('0x67'),_0xca9d('0x68'),'modifiedbyyominame',_0xca9d('0x69'),_0xca9d('0x6a'),_0xca9d('0x6b'),_0xca9d('0x6c'),_0xca9d('0x6d'),_0xca9d('0x6e'),_0xca9d('0x6f'),_0xca9d('0x70'),'owneridname',_0xca9d('0x71'),_0xca9d('0x72'),'parentcaseidname',_0xca9d('0x73'),_0xca9d('0x74'),_0xca9d('0x75'),_0xca9d('0x76'),_0xca9d('0x77'),_0xca9d('0x78'),_0xca9d('0x79'),'responseby',_0xca9d('0x7a'),_0xca9d('0x7b'),_0xca9d('0x7c'),_0xca9d('0x7d'),_0xca9d('0x7e'),'socialprofileidname',_0xca9d('0x7f'),_0xca9d('0x80'),_0xca9d('0x81'),_0xca9d('0x82'),_0xca9d('0x83'),'transactioncurrencyidname',_0xca9d('0x84'),_0xca9d('0x85'),_0xca9d('0x86')];var _0x199c7e=_0x2aa85c[_0xca9d('0x87')](_0x3dfaef);return db[_0xca9d('0x16')][_0xca9d('0x37')]({'where':{'id':_0x32d428[_0xca9d('0x31')]['id']},'attributes':['id',_0xca9d('0x88'),'password',_0xca9d('0x89'),_0xca9d('0x8a'),_0xca9d('0x8b'),_0xca9d('0x8c'),_0xca9d('0x8d')],'include':[{'model':db['CloudProvider'],'as':_0xca9d('0x8e'),'attributes':['id',_0xca9d('0x8f'),'data7']}]})[_0xca9d('0x2a')](handleEntityNotFound(_0x5129ce,null))['then'](function(_0xbde5be){if(_0xbde5be){if(_0xbde5be[_0xca9d('0x8d')]){_0xbde5be['access_token']=_0xbde5be['CloudProvider'][_0xca9d('0x8f')];_0xe4c3c1=sanitizeRemoteUri(_0xbde5be['CloudProvider']['data7']);_0x462c3f=getWebApiUrl(_0xe4c3c1);return _0xbde5be;}_0xe4c3c1=sanitizeRemoteUri(_0xbde5be[_0xca9d('0x89')]);_0x462c3f=getWebApiUrl(_0xe4c3c1);var _0x48ac00={'method':_0xca9d('0x90'),'uri':_0xca9d('0x91')+_0xbde5be[_0xca9d('0x8a')]+'/oauth2/token','form':{'client_id':_0xbde5be[_0xca9d('0x8b')],'resource':_0xe4c3c1,'username':_0xbde5be['username'],'password':_0xbde5be[_0xca9d('0x92')],'grant_type':_0xca9d('0x92'),'client_secret':_0xbde5be[_0xca9d('0x8c')]},'json':!![]};return rp(_0x48ac00);}})[_0xca9d('0x2a')](function(_0x459cb2){_0xd3329b=_0x459cb2[_0xca9d('0x93')];var _0x355a93={'method':_0xca9d('0x94'),'uri':encodeURI(_0x462c3f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x23d815+'\x27'),'headers':{'Authorization':_0xca9d('0x95')+_0xd3329b,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x355a93);})['then'](function(_0x32d8d7){var _0x48c325=_0x32d8d7[_0xca9d('0x97')][0x0];var _0x5b28ae=_0x48c325[_0xca9d('0x98')];var _0x1de3ea={'method':'GET','uri':_0x462c3f+_0xca9d('0x99')+_0x5b28ae+_0xca9d('0x9a'),'headers':{'Authorization':_0xca9d('0x95')+_0xd3329b,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x1de3ea);})['then'](function(_0x43594a){_0x5cb94f=_0x43594a;_0x20459f=_0x5cb94f[_0xca9d('0x9b')];_0x20459f=_[_0xca9d('0x9c')](_0x20459f,function(_0x2d15dd){return!_0x199c7e[_0xca9d('0x9d')](_0x2d15dd[_0xca9d('0x9e')]);});var _0x298177=[];var _0x3779e8=[];_0x20459f[_0xca9d('0x9f')](function(_0x5c0690){if(_0x5c0690[_0xca9d('0xa0')]){var _0x430e2f=_0x5c0690[_0xca9d('0xa0')][_0xca9d('0x3f')](_0x5c0690[_0xca9d('0xa0')][_0xca9d('0x40')]('.')+0x1);if(_0x430e2f===_0xca9d('0xa1')){_0x298177[_0xca9d('0xa2')](getSelectList(_0x462c3f,_0x4d7139,_0x3779e8,_0x5cb94f[_0xca9d('0x98')],_0x5c0690[_0xca9d('0x98')],_0xd3329b));}}});return Promise[_0xca9d('0xa3')](_0x298177);})[_0xca9d('0x2a')](function(_0x47cf9f){_0x147fa2=_0x47cf9f[0x0];var _0x507745=[];var _0x55fd25=[];_0x20459f[_0xca9d('0x9f')](function(_0x59c810){if(!_['isNil'](_0x59c810['@odata.type'])){var _0x4ef450=_0x59c810[_0xca9d('0xa0')][_0xca9d('0x3f')](_0x59c810['@odata.type'][_0xca9d('0x40')]('.')+0x1);if(_0x4ef450===_0xca9d('0xa4')){_0x507745[_0xca9d('0xa2')](getBooleanList(_0x462c3f,_0x4d7139,_0x55fd25,_0x5cb94f[_0xca9d('0x98')],_0x59c810[_0xca9d('0x98')],_0xd3329b));}}});return Promise[_0xca9d('0xa3')](_0x507745);})[_0xca9d('0x2a')](function(_0x495c35){_0x4e2c10=_0x495c35[0x0];var _0x5c53d6=[];var _0x47e9e2=[];_0x20459f[_0xca9d('0x9f')](function(_0x433073){if(_0x433073['@odata.type']){var _0xe5a2eb=_0x433073['@odata.type'][_0xca9d('0x3f')](_0x433073['@odata.type'][_0xca9d('0x40')]('.')+0x1);if(_0xe5a2eb==='StringAttributeMetadata'||_0xe5a2eb===_0xca9d('0xa5')||_0xe5a2eb===_0xca9d('0xa6')||_0xe5a2eb===_0xca9d('0xa7')||_0xe5a2eb===_0xca9d('0xa8')||_0xe5a2eb===_0xca9d('0xa9')||_0xe5a2eb===_0xca9d('0xaa')||_0xe5a2eb==='EntityNameAttributeMetadata'||_0xe5a2eb===_0xca9d('0xab')||_0xe5a2eb===_0xca9d('0xac')){_0x5c53d6[_0xca9d('0xa2')](getInputList(_0x462c3f,_0x4d7139,_0xe5a2eb,_0x47e9e2,_0x5cb94f[_0xca9d('0x98')],_0x433073['MetadataId'],_0xd3329b));}}});return Promise[_0xca9d('0xa3')](_0x5c53d6);})[_0xca9d('0x2a')](function(_0x251a09){_0x13a98d=_0x251a09[0x0];var _0x2df179=_0x147fa2[_0xca9d('0x87')](_0x4e2c10)['concat'](_0x13a98d);var _0x3fbf2f={'count':_0x2df179[_0xca9d('0x39')],'rows':_0x2df179};return _0x3fbf2f;})[_0xca9d('0x2a')](respondWithResult(_0x5129ce,null))[_0xca9d('0x2f')](function(_0x335cac){var _0x2bd539=_0x32d428['query'][_0xca9d('0xad')]?0x1f4:_0x335cac[_0xca9d('0xae')]||0x1f4;logger[_0xca9d('0xaf')](_0x335cac[_0xca9d('0x12')]);delete _0x335cac[_0xca9d('0x13')];if(_0x2bd539===0x191){_0x2bd539=0x190;}_0x5129ce[_0xca9d('0x7')](_0x2bd539)[_0xca9d('0x14')](_0x32d428[_0xca9d('0x19')][_0xca9d('0xad')]?{'message':_0xca9d('0xb0'),'statusCode':_0x335cac['statusCode']}:_0x335cac);});};function getSelectList(_0x40ef2c,_0x1d1cfb,_0x1dcb7b,_0x34822b,_0x48e8d5,_0x4ed408){var _0x2a1813={'method':_0xca9d('0x94'),'uri':_0x40ef2c+_0xca9d('0x99')+_0x34822b+_0xca9d('0xb1')+_0x48e8d5+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xca9d('0xb2'),'headers':{'Authorization':_0xca9d('0x95')+_0x4ed408,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x2a1813)['then'](function(_0x11931d){var _0x240353=[];var _0x487f11=_0x11931d[_0xca9d('0xb3')][_0xca9d('0xb4')];_0x487f11[_0xca9d('0x9f')](function(_0x474fd0){_0x240353[_0xca9d('0xa2')]({'name':_0x474fd0[_0xca9d('0xb5')][_0xca9d('0xb6')]['Label'],'value':String(_0x474fd0[_0xca9d('0xb7')])});});var _0x3fdc13={'id':_0x1d1cfb+'_'+_0x11931d[_0xca9d('0x9e')],'name':_0x11931d[_0xca9d('0xb8')][_0xca9d('0xb6')][_0xca9d('0xb5')],'custom':![],'options':_0x240353};_0x1dcb7b[_0xca9d('0xa2')](_0x3fdc13);return _0x1dcb7b;});}function getBooleanList(_0x5122ea,_0x221181,_0x1fd4d7,_0x34c933,_0x1b33fa,_0x2e196d){var _0x2d4d5e={'method':_0xca9d('0x94'),'uri':_0x5122ea+'EntityDefinitions('+_0x34c933+_0xca9d('0xb1')+_0x1b33fa+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xca9d('0x95')+_0x2e196d,'If-None-Match':null,'OData-Version':_0xca9d('0x96')},'json':!![]};return rp(_0x2d4d5e)[_0xca9d('0x2a')](function(_0x3d798f){var _0x10b1b4=[];_0x10b1b4['push']({'name':_0x3d798f[_0xca9d('0xb3')]['TrueOption']['Label']['UserLocalizedLabel'][_0xca9d('0xb5')],'value':_0xca9d('0xb9')},{'name':_0x3d798f[_0xca9d('0xb3')]['FalseOption']['Label'][_0xca9d('0xb6')][_0xca9d('0xb5')],'value':_0xca9d('0xba')});var _0xbc33b8={'id':_0x221181+'_'+_0x3d798f[_0xca9d('0x9e')],'name':_0x3d798f[_0xca9d('0xb8')][_0xca9d('0xb6')][_0xca9d('0xb5')],'custom':![],'options':_0x10b1b4};_0x1fd4d7[_0xca9d('0xa2')](_0xbc33b8);return _0x1fd4d7;});}function getInputList(_0x4461de,_0x5bebd1,_0x560abd,_0x2c6774,_0x1661f7,_0x28e4db,_0x5a41ea){var _0x1ecf45={'method':_0xca9d('0x94'),'uri':_0x4461de+_0xca9d('0x99')+_0x1661f7+_0xca9d('0xb1')+_0x28e4db+_0xca9d('0xbb')+_0x560abd+_0xca9d('0xbc'),'headers':{'Authorization':_0xca9d('0x95')+_0x5a41ea,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ecf45)[_0xca9d('0x2a')](function(_0x1298c0){var _0x5b5a54={'id':_0x5bebd1+'_'+_0x1298c0[_0xca9d('0x9e')],'name':_0x1298c0[_0xca9d('0xb8')]['UserLocalizedLabel']?_0x1298c0[_0xca9d('0xb8')][_0xca9d('0xb6')]['Label']:_0x1298c0['LogicalName'],'custom':![],'options':[]};_0x2c6774[_0xca9d('0xa2')](_0x5b5a54);return _0x2c6774;});} \ No newline at end of file +var _0xcfef=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','status','index','map','Dynamics365Account','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','fields','include','create','body','params','find','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','getFields','incident','Incident','PhoneCall','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','MetadataId','all','forEach','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','push','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','request-promise','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcfef,0xc1));var _0xfcfe=function(_0x35ce51,_0x100eb4){_0x35ce51=_0x35ce51-0x0;var _0x4bc4ff=_0xcfef[_0x35ce51];return _0x4bc4ff;};'use strict';var rp=require(_0xfcfe('0x0'));var util=require('util');var _=require(_0xfcfe('0x1'));var qs=require(_0xfcfe('0x2'));var logger=require(_0xfcfe('0x3'))(_0xfcfe('0x4'));var db=require(_0xfcfe('0x5'))['db'];var integrations=require(_0xfcfe('0x6'));function respondWithResult(_0x1d5866,_0x45055e){_0x45055e=_0x45055e||0xc8;return function(_0x23bc1f){if(_0x23bc1f){return _0x1d5866['status'](_0x45055e)[_0xfcfe('0x7')](_0x23bc1f);}};}function respondWithFilteredResult(_0xe39d97,_0xe8bf4a){return function(_0x320e63){if(_0x320e63){var _0x46d18e=typeof _0xe8bf4a[_0xfcfe('0x8')]===_0xfcfe('0x9')&&typeof _0xe8bf4a['limit']==='undefined';var _0x2ffcaf=_0x320e63[_0xfcfe('0xa')];var _0x2520c2=_0x46d18e?0x0:_0xe8bf4a[_0xfcfe('0x8')];var _0x38ce0a=_0x46d18e?_0x320e63[_0xfcfe('0xa')]:_0xe8bf4a[_0xfcfe('0x8')]+_0xe8bf4a[_0xfcfe('0xb')];var _0x41adc1;if(_0x38ce0a>=_0x2ffcaf){_0x38ce0a=_0x2ffcaf;_0x41adc1=0xc8;}else{_0x41adc1=0xce;}_0xe39d97['status'](_0x41adc1);return _0xe39d97[_0xfcfe('0xc')](_0xfcfe('0xd'),_0x2520c2+'-'+_0x38ce0a+'/'+_0x2ffcaf)['json'](_0x320e63);}return null;};}function saveUpdates(_0x392a4b){return function(_0x583177){if(_0x583177){return _0x583177[_0xfcfe('0xe')](_0x392a4b)[_0xfcfe('0xf')](function(_0x1eb8cd){return _0x1eb8cd;});}return null;};}function removeEntity(_0x52eb35){return function(_0x7504cb){if(_0x7504cb){return _0x7504cb[_0xfcfe('0x10')]()['then'](function(){_0x52eb35['status'](0xcc)[_0xfcfe('0x11')]();});}};}function handleEntityNotFound(_0x5ad8e7){return function(_0x313140){if(!_0x313140){_0x5ad8e7[_0xfcfe('0x12')](0x194);}return _0x313140;};}function handleError(_0x4f29b0,_0x313ef9){_0x313ef9=_0x313ef9||0x1f4;return function(_0x1a8f27){logger[_0xfcfe('0x13')](_0x1a8f27[_0xfcfe('0x14')]);if(_0x1a8f27[_0xfcfe('0x15')]){delete _0x1a8f27[_0xfcfe('0x15')];}_0x4f29b0[_0xfcfe('0x16')](_0x313ef9)['send'](_0x1a8f27);};}exports[_0xfcfe('0x17')]=function(_0x2811a5,_0x770414){var _0x68cc31={},_0x43d8a4={},_0x386c77={'count':0x0,'rows':[]};var _0x558e3a=_[_0xfcfe('0x18')](db[_0xfcfe('0x19')]['rawAttributes'],function(_0xea77c5){return{'name':_0xea77c5['fieldName'],'type':_0xea77c5[_0xfcfe('0x1a')]['key']};});_0x43d8a4[_0xfcfe('0x1b')]=_[_0xfcfe('0x18')](_0x558e3a,_0xfcfe('0x15'));_0x43d8a4[_0xfcfe('0x1c')]=_['keys'](_0x2811a5['query']);_0x43d8a4[_0xfcfe('0x1d')]=_[_0xfcfe('0x1e')](_0x43d8a4[_0xfcfe('0x1b')],_0x43d8a4[_0xfcfe('0x1c')]);_0x68cc31[_0xfcfe('0x1f')]=_[_0xfcfe('0x1e')](_0x43d8a4[_0xfcfe('0x1b')],qs['fields'](_0x2811a5[_0xfcfe('0x1c')]['fields']));_0x68cc31[_0xfcfe('0x1f')]=_0x68cc31[_0xfcfe('0x1f')][_0xfcfe('0x20')]?_0x68cc31[_0xfcfe('0x1f')]:_0x43d8a4[_0xfcfe('0x1b')];if(!_0x2811a5[_0xfcfe('0x1c')][_0xfcfe('0x21')](_0xfcfe('0x22'))){_0x68cc31['limit']=qs[_0xfcfe('0xb')](_0x2811a5['query'][_0xfcfe('0xb')]);_0x68cc31[_0xfcfe('0x8')]=qs[_0xfcfe('0x8')](_0x2811a5[_0xfcfe('0x1c')]['offset']);}_0x68cc31[_0xfcfe('0x23')]=qs[_0xfcfe('0x24')](_0x2811a5[_0xfcfe('0x1c')][_0xfcfe('0x24')]);_0x68cc31[_0xfcfe('0x25')]=qs['filters'](_['pick'](_0x2811a5['query'],_0x43d8a4[_0xfcfe('0x1d')]),_0x558e3a);if(_0x2811a5[_0xfcfe('0x1c')][_0xfcfe('0x26')]){_0x68cc31['where']=_[_0xfcfe('0x27')](_0x68cc31[_0xfcfe('0x25')],{'$or':_['map'](_0x558e3a,function(_0x5ee0c4){if(_0x5ee0c4[_0xfcfe('0x1a')]!=='VIRTUAL'){var _0x2b5f3f={};_0x2b5f3f[_0x5ee0c4[_0xfcfe('0x15')]]={'$like':'%'+_0x2811a5[_0xfcfe('0x1c')]['filter']+'%'};return _0x2b5f3f;}})});}_0x68cc31=_[_0xfcfe('0x27')]({},_0x68cc31,_0x2811a5[_0xfcfe('0x28')]);var _0x286b2b={'where':_0x68cc31[_0xfcfe('0x25')]};return db[_0xfcfe('0x19')]['count'](_0x286b2b)['then'](function(_0x9b619d){_0x386c77[_0xfcfe('0xa')]=_0x9b619d;if(_0x2811a5[_0xfcfe('0x1c')][_0xfcfe('0x29')]){_0x68cc31['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0xfcfe('0x2a')](_0x68cc31);})[_0xfcfe('0xf')](function(_0xd279f9){_0x386c77[_0xfcfe('0x2b')]=_0xd279f9;return _0x386c77;})[_0xfcfe('0xf')](respondWithFilteredResult(_0x770414,_0x68cc31))[_0xfcfe('0x2c')](handleError(_0x770414,null));};exports[_0xfcfe('0x2d')]=function(_0xcd54fb,_0x54a3c4){var _0x479512={'raw':![],'where':{'id':_0xcd54fb['params']['id']}},_0x1446a7={};_0x1446a7['model']=_[_0xfcfe('0x2e')](db[_0xfcfe('0x19')][_0xfcfe('0x2f')]);_0x1446a7[_0xfcfe('0x1c')]=_[_0xfcfe('0x2e')](_0xcd54fb[_0xfcfe('0x1c')]);_0x1446a7['filters']=_['intersection'](_0x1446a7[_0xfcfe('0x1b')],_0x1446a7[_0xfcfe('0x1c')]);_0x479512['attributes']=_[_0xfcfe('0x1e')](_0x1446a7[_0xfcfe('0x1b')],qs[_0xfcfe('0x30')](_0xcd54fb[_0xfcfe('0x1c')]['fields']));_0x479512['attributes']=_0x479512[_0xfcfe('0x1f')][_0xfcfe('0x20')]?_0x479512['attributes']:_0x1446a7[_0xfcfe('0x1b')];if(_0xcd54fb[_0xfcfe('0x1c')]['includeAll']){_0x479512[_0xfcfe('0x31')]=[{'all':!![]}];}_0x479512=_['merge']({},_0x479512,_0xcd54fb[_0xfcfe('0x28')]);return db['Dynamics365Account']['find'](_0x479512)[_0xfcfe('0xf')](handleEntityNotFound(_0x54a3c4,null))[_0xfcfe('0xf')](respondWithResult(_0x54a3c4,null))[_0xfcfe('0x2c')](handleError(_0x54a3c4,null));};exports[_0xfcfe('0x32')]=function(_0x1e730f,_0x2467d6){return db[_0xfcfe('0x19')][_0xfcfe('0x32')](_0x1e730f[_0xfcfe('0x33')],{})[_0xfcfe('0xf')](respondWithResult(_0x2467d6,0xc9))[_0xfcfe('0x2c')](handleError(_0x2467d6,null));};exports['update']=function(_0x556769,_0x75c6b4){if(_0x556769[_0xfcfe('0x33')]['id']){delete _0x556769[_0xfcfe('0x33')]['id'];}return db[_0xfcfe('0x19')]['find']({'where':{'id':_0x556769[_0xfcfe('0x34')]['id']}})[_0xfcfe('0xf')](handleEntityNotFound(_0x75c6b4,null))[_0xfcfe('0xf')](saveUpdates(_0x556769[_0xfcfe('0x33')],null))[_0xfcfe('0xf')](respondWithResult(_0x75c6b4,null))[_0xfcfe('0x2c')](handleError(_0x75c6b4,null));};exports[_0xfcfe('0x10')]=function(_0x18cfd3,_0x1f62c1){return db[_0xfcfe('0x19')][_0xfcfe('0x35')]({'where':{'id':_0x18cfd3[_0xfcfe('0x34')]['id']}})[_0xfcfe('0xf')](handleEntityNotFound(_0x1f62c1,null))[_0xfcfe('0xf')](removeEntity(_0x1f62c1,null))[_0xfcfe('0x2c')](handleError(_0x1f62c1,null));};exports[_0xfcfe('0x36')]=function(_0x5e3d4a,_0x563897){var _0x2177bd={};var _0x53771b={};var _0x28a1e1;var _0x5dc4cc;return db[_0xfcfe('0x19')][_0xfcfe('0x37')]({'where':{'id':_0x5e3d4a[_0xfcfe('0x34')]['id']}})[_0xfcfe('0xf')](handleEntityNotFound(_0x563897,null))[_0xfcfe('0xf')](function(_0x582ab6){if(_0x582ab6){_0x28a1e1=_0x582ab6;_0x53771b['model']=_[_0xfcfe('0x2e')](db[_0xfcfe('0x38')][_0xfcfe('0x2f')]);_0x53771b['query']=_['keys'](_0x5e3d4a[_0xfcfe('0x1c')]);_0x53771b[_0xfcfe('0x1d')]=_[_0xfcfe('0x1e')](_0x53771b[_0xfcfe('0x1b')],_0x53771b['query']);_0x2177bd[_0xfcfe('0x1f')]=_['intersection'](_0x53771b[_0xfcfe('0x1b')],qs[_0xfcfe('0x30')](_0x5e3d4a[_0xfcfe('0x1c')]['fields']));_0x2177bd[_0xfcfe('0x1f')]=_0x2177bd[_0xfcfe('0x1f')][_0xfcfe('0x20')]?_0x2177bd[_0xfcfe('0x1f')]:_0x53771b['model'];_0x2177bd[_0xfcfe('0x23')]=qs['sort'](_0x5e3d4a[_0xfcfe('0x1c')]['sort']);_0x2177bd['where']=qs[_0xfcfe('0x1d')](_[_0xfcfe('0x39')](_0x5e3d4a[_0xfcfe('0x1c')],_0x53771b[_0xfcfe('0x1d')]));if(_0x5e3d4a[_0xfcfe('0x1c')]['filter']){_0x2177bd[_0xfcfe('0x25')]=_[_0xfcfe('0x27')](_0x2177bd[_0xfcfe('0x25')],{'$or':_['map'](_0x2177bd[_0xfcfe('0x1f')],function(_0x179610){var _0x3e3d01={};_0x3e3d01[_0x179610]={'$like':'%'+_0x5e3d4a[_0xfcfe('0x1c')][_0xfcfe('0x26')]+'%'};return _0x3e3d01;})});}_0x2177bd=_[_0xfcfe('0x27')]({},_0x2177bd,_0x5e3d4a[_0xfcfe('0x28')]);return _0x28a1e1[_0xfcfe('0x36')](_0x2177bd);}})[_0xfcfe('0xf')](function(_0x48c8bb){if(_0x48c8bb){_0x5dc4cc=_0x48c8bb['length'];if(!_0x5e3d4a[_0xfcfe('0x1c')][_0xfcfe('0x21')](_0xfcfe('0x22'))){_0x2177bd[_0xfcfe('0xb')]=qs[_0xfcfe('0xb')](_0x5e3d4a[_0xfcfe('0x1c')]['limit']);_0x2177bd[_0xfcfe('0x8')]=qs[_0xfcfe('0x8')](_0x5e3d4a[_0xfcfe('0x1c')]['offset']);}return _0x28a1e1[_0xfcfe('0x36')](_0x2177bd);}})[_0xfcfe('0xf')](function(_0x3efd59){if(_0x3efd59){return _0x3efd59?{'count':_0x5dc4cc,'rows':_0x3efd59}:null;}})[_0xfcfe('0xf')](respondWithResult(_0x563897,null))[_0xfcfe('0x2c')](handleError(_0x563897,null));};exports[_0xfcfe('0x3a')]=function(_0x2db68f,_0x725ee1){if(_0x2db68f['body']['id']){delete _0x2db68f[_0xfcfe('0x33')]['id'];}return db[_0xfcfe('0x19')][_0xfcfe('0x37')]({'where':{'id':_0x2db68f[_0xfcfe('0x34')]['id']}})[_0xfcfe('0xf')](handleEntityNotFound(_0x725ee1,null))[_0xfcfe('0xf')](function(_0x278a89){if(_0x278a89){_0x2db68f[_0xfcfe('0x33')][_0xfcfe('0x3b')]=_0x278a89['id'];_0x2db68f[_0xfcfe('0x33')][_0xfcfe('0x3c')]=integrations[_0xfcfe('0x3d')](_0x2db68f[_0xfcfe('0x33')][_0xfcfe('0x3e')],_0x2db68f[_0xfcfe('0x33')][_0xfcfe('0x1a')]);_0x2db68f[_0xfcfe('0x33')][_0xfcfe('0x3f')]=integrations[_0xfcfe('0x40')](_0x2db68f[_0xfcfe('0x33')][_0xfcfe('0x3e')],_0x2db68f[_0xfcfe('0x33')]['type']);return db['Dynamics365Configuration'][_0xfcfe('0x32')](_0x2db68f[_0xfcfe('0x33')],{'include':[{'model':db[_0xfcfe('0x41')],'as':_0xfcfe('0x3c')},{'model':db[_0xfcfe('0x41')],'as':'Descriptions'}]});}return null;})[_0xfcfe('0xf')](respondWithResult(_0x725ee1,null))[_0xfcfe('0x2c')](handleError(_0x725ee1,null));};function sanitizeRemoteUri(_0x26858b){var _0x26555e=_0x26858b[_0xfcfe('0x42')](-0x1);if(_0x26555e==='/')return _0x26858b['substring'](0x0,_0x26858b[_0xfcfe('0x43')](_0x26555e));return _0x26858b;}function getWebApiUrl(_0x294bca){return util['format']('%s/api/data/v9.0/',_0x294bca);}exports[_0xfcfe('0x44')]=function(_0x450dac,_0x333b08){var _0x7d4573=_0x450dac[_0xfcfe('0x1c')]['ticketType'];var _0x1c16a8=_0x7d4573===_0xfcfe('0x45')?_0xfcfe('0x46'):_0xfcfe('0x47');var _0x34311c='';var _0x5e4280='';var _0x1b35ab='';var _0x2b7059='';var _0x21e180='';var _0x5b36ef='';var _0x4835c8='';var _0x2c6eea='';var _0x136440=['title','description',_0xfcfe('0x48'),_0xfcfe('0x49'),_0xfcfe('0x4a'),'subject',_0xfcfe('0x4b'),_0xfcfe('0x4c'),_0xfcfe('0x4d'),_0xfcfe('0x4e')];var _0x3f7dd4=[_0xfcfe('0x4f'),_0xfcfe('0x50'),_0xfcfe('0x51'),_0xfcfe('0x52'),_0xfcfe('0x53'),_0xfcfe('0x54'),_0xfcfe('0x55'),_0xfcfe('0x56'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0xfcfe('0x57'),_0xfcfe('0x58'),_0xfcfe('0x59'),_0xfcfe('0x5a'),_0xfcfe('0x5b'),_0xfcfe('0x5c'),_0xfcfe('0x5d'),_0xfcfe('0x5e'),_0xfcfe('0x5f'),_0xfcfe('0x60'),'entityimage_timestamp','entityimage_url',_0xfcfe('0x61'),_0xfcfe('0x62'),_0xfcfe('0x63'),'followupby',_0xfcfe('0x64'),_0xfcfe('0x65'),_0xfcfe('0x66'),_0xfcfe('0x67'),'masteridname',_0xfcfe('0x68'),_0xfcfe('0x69'),_0xfcfe('0x6a'),'modifiedbyyominame',_0xfcfe('0x6b'),_0xfcfe('0x6c'),_0xfcfe('0x6d'),'msdyn_incidenttypename',_0xfcfe('0x6e'),_0xfcfe('0x6f'),'onholdtime',_0xfcfe('0x70'),_0xfcfe('0x71'),_0xfcfe('0x72'),'owneridyominame','parentcaseidname',_0xfcfe('0x73'),_0xfcfe('0x74'),_0xfcfe('0x75'),_0xfcfe('0x76'),_0xfcfe('0x77'),_0xfcfe('0x78'),_0xfcfe('0x79'),_0xfcfe('0x7a'),_0xfcfe('0x7b'),'responsiblecontactidyominame',_0xfcfe('0x7c'),'slainvokedidname',_0xfcfe('0x7d'),_0xfcfe('0x7e'),_0xfcfe('0x7f'),_0xfcfe('0x80'),'subjectidname',_0xfcfe('0x81'),_0xfcfe('0x82'),_0xfcfe('0x83'),_0xfcfe('0x84'),_0xfcfe('0x85'),_0xfcfe('0x86')];var _0x5e5b37=_0x136440[_0xfcfe('0x87')](_0x3f7dd4);return db[_0xfcfe('0x19')]['findOne']({'where':{'id':_0x450dac[_0xfcfe('0x34')]['id']},'attributes':['id',_0xfcfe('0x88'),'password',_0xfcfe('0x89'),_0xfcfe('0x8a'),'clientId','clientSecret',_0xfcfe('0x8b')],'include':[{'model':db[_0xfcfe('0x8c')],'as':_0xfcfe('0x8c'),'attributes':['id',_0xfcfe('0x8d'),_0xfcfe('0x8e')]}]})['then'](handleEntityNotFound(_0x333b08,null))[_0xfcfe('0xf')](function(_0x511bab){if(_0x511bab){if(_0x511bab[_0xfcfe('0x8b')]){_0x511bab[_0xfcfe('0x8f')]=_0x511bab['CloudProvider'][_0xfcfe('0x8d')];_0x2c6eea=sanitizeRemoteUri(_0x511bab[_0xfcfe('0x8c')][_0xfcfe('0x8e')]);_0x4835c8=getWebApiUrl(_0x2c6eea);return _0x511bab;}_0x2c6eea=sanitizeRemoteUri(_0x511bab['remoteUri']);_0x4835c8=getWebApiUrl(_0x2c6eea);var _0x51f941={'method':_0xfcfe('0x90'),'uri':_0xfcfe('0x91')+_0x511bab[_0xfcfe('0x8a')]+_0xfcfe('0x92'),'form':{'client_id':_0x511bab[_0xfcfe('0x93')],'resource':_0x2c6eea,'username':_0x511bab[_0xfcfe('0x88')],'password':_0x511bab[_0xfcfe('0x94')],'grant_type':'password','client_secret':_0x511bab[_0xfcfe('0x95')]},'json':!![]};return rp(_0x51f941);}})['then'](function(_0x39920d){_0x5b36ef=_0x39920d[_0xfcfe('0x8f')];var _0xaff0f8={'method':_0xfcfe('0x96'),'uri':encodeURI(_0x4835c8+_0xfcfe('0x97')+_0x1c16a8+'\x27'),'headers':{'Authorization':_0xfcfe('0x98')+_0x5b36ef,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xaff0f8);})[_0xfcfe('0xf')](function(_0xa2db43){var _0x1500de=_0xa2db43[_0xfcfe('0x99')][0x0];var _0x2d558c=_0x1500de['MetadataId'];var _0x3abb63={'method':'GET','uri':_0x4835c8+_0xfcfe('0x9a')+_0x2d558c+_0xfcfe('0x9b'),'headers':{'Authorization':'Bearer\x20'+_0x5b36ef,'If-None-Match':null,'OData-Version':_0xfcfe('0x9c')},'json':!![]};return rp(_0x3abb63);})[_0xfcfe('0xf')](function(_0x10f531){_0x34311c=_0x10f531;_0x5e4280=_0x34311c[_0xfcfe('0x9d')];_0x5e4280=_[_0xfcfe('0x9e')](_0x5e4280,function(_0x34f151){return!_0x5e5b37[_0xfcfe('0x9f')](_0x34f151[_0xfcfe('0xa0')]);});var _0x506ef5=[];var _0x35cf11=[];_0x5e4280['forEach'](function(_0x30c5e6){if(_0x30c5e6[_0xfcfe('0xa1')]){var _0x1c91e5=_0x30c5e6[_0xfcfe('0xa1')][_0xfcfe('0xa2')](_0x30c5e6[_0xfcfe('0xa1')]['lastIndexOf']('.')+0x1);if(_0x1c91e5===_0xfcfe('0xa3')){_0x506ef5['push'](getSelectList(_0x4835c8,_0x7d4573,_0x35cf11,_0x34311c[_0xfcfe('0xa4')],_0x30c5e6[_0xfcfe('0xa4')],_0x5b36ef));}}});return Promise[_0xfcfe('0xa5')](_0x506ef5);})[_0xfcfe('0xf')](function(_0x202721){_0x1b35ab=_0x202721[0x0];var _0x156d4c=[];var _0x11ca89=[];_0x5e4280[_0xfcfe('0xa6')](function(_0xae2728){if(!_[_0xfcfe('0xa7')](_0xae2728[_0xfcfe('0xa1')])){var _0x3f54af=_0xae2728['@odata.type'][_0xfcfe('0xa2')](_0xae2728['@odata.type'][_0xfcfe('0x43')]('.')+0x1);if(_0x3f54af==='BooleanAttributeMetadata'){_0x156d4c['push'](getBooleanList(_0x4835c8,_0x7d4573,_0x11ca89,_0x34311c[_0xfcfe('0xa4')],_0xae2728[_0xfcfe('0xa4')],_0x5b36ef));}}});return Promise[_0xfcfe('0xa5')](_0x156d4c);})[_0xfcfe('0xf')](function(_0x51a72b){_0x2b7059=_0x51a72b[0x0];var _0x4f010f=[];var _0x468724=[];_0x5e4280[_0xfcfe('0xa6')](function(_0x5bdc22){if(_0x5bdc22[_0xfcfe('0xa1')]){var _0x1f991b=_0x5bdc22[_0xfcfe('0xa1')]['substring'](_0x5bdc22[_0xfcfe('0xa1')][_0xfcfe('0x43')]('.')+0x1);if(_0x1f991b===_0xfcfe('0xa8')||_0x1f991b===_0xfcfe('0xa9')||_0x1f991b===_0xfcfe('0xaa')||_0x1f991b===_0xfcfe('0xab')||_0x1f991b===_0xfcfe('0xac')||_0x1f991b==='DateTimeAttributeMetadata'||_0x1f991b===_0xfcfe('0xad')||_0x1f991b==='EntityNameAttributeMetadata'||_0x1f991b==='StateAttributeMetadata'||_0x1f991b===_0xfcfe('0xae')){_0x4f010f[_0xfcfe('0xaf')](getInputList(_0x4835c8,_0x7d4573,_0x1f991b,_0x468724,_0x34311c['MetadataId'],_0x5bdc22['MetadataId'],_0x5b36ef));}}});return Promise[_0xfcfe('0xa5')](_0x4f010f);})['then'](function(_0x2e5801){_0x21e180=_0x2e5801[0x0];var _0x42b394=_0x1b35ab[_0xfcfe('0x87')](_0x2b7059)['concat'](_0x21e180);var _0x497ba2={'count':_0x42b394[_0xfcfe('0x20')],'rows':_0x42b394};return _0x497ba2;})[_0xfcfe('0xf')](respondWithResult(_0x333b08,null))[_0xfcfe('0x2c')](function(_0x5b3358){var _0x5c3172=_0x450dac[_0xfcfe('0x1c')][_0xfcfe('0xb0')]?0x1f4:_0x5b3358[_0xfcfe('0xb1')]||0x1f4;logger[_0xfcfe('0x13')](_0x5b3358[_0xfcfe('0x14')]);delete _0x5b3358[_0xfcfe('0x15')];if(_0x5c3172===0x191){_0x5c3172=0x190;}_0x333b08[_0xfcfe('0x16')](_0x5c3172)[_0xfcfe('0xb2')](_0x450dac[_0xfcfe('0x1c')][_0xfcfe('0xb0')]?{'message':_0xfcfe('0xb3'),'statusCode':_0x5b3358[_0xfcfe('0xb1')]}:_0x5b3358);});};function getSelectList(_0x3e7b9d,_0x4e99e4,_0x337f42,_0x5ca9e4,_0x48190c,_0x427051){var _0x3b40ff={'method':_0xfcfe('0x96'),'uri':_0x3e7b9d+_0xfcfe('0x9a')+_0x5ca9e4+_0xfcfe('0xb4')+_0x48190c+_0xfcfe('0xb5')+_0xfcfe('0xb6'),'headers':{'Authorization':_0xfcfe('0x98')+_0x427051,'If-None-Match':null,'OData-Version':_0xfcfe('0x9c')},'json':!![]};return rp(_0x3b40ff)[_0xfcfe('0xf')](function(_0x41399a){var _0x3ec542=[];var _0x2fdd8c=_0x41399a[_0xfcfe('0xb7')]['Options'];_0x2fdd8c[_0xfcfe('0xa6')](function(_0x501e5c){_0x3ec542[_0xfcfe('0xaf')]({'name':_0x501e5c[_0xfcfe('0xb8')][_0xfcfe('0xb9')][_0xfcfe('0xb8')],'value':String(_0x501e5c[_0xfcfe('0xba')])});});var _0x1e5955={'id':_0x4e99e4+'_'+_0x41399a['LogicalName'],'name':_0x41399a['DisplayName'][_0xfcfe('0xb9')][_0xfcfe('0xb8')],'custom':![],'options':_0x3ec542};_0x337f42[_0xfcfe('0xaf')](_0x1e5955);return _0x337f42;});}function getBooleanList(_0x6fb5e5,_0x7a764,_0x8ae43e,_0xe97f53,_0x2857bf,_0x5d58e9){var _0x10d1f2={'method':_0xfcfe('0x96'),'uri':_0x6fb5e5+'EntityDefinitions('+_0xe97f53+_0xfcfe('0xb4')+_0x2857bf+_0xfcfe('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x5d58e9,'If-None-Match':null,'OData-Version':_0xfcfe('0x9c')},'json':!![]};return rp(_0x10d1f2)[_0xfcfe('0xf')](function(_0x413df3){var _0x5a7694=[];_0x5a7694[_0xfcfe('0xaf')]({'name':_0x413df3['OptionSet'][_0xfcfe('0xbc')]['Label'][_0xfcfe('0xb9')][_0xfcfe('0xb8')],'value':_0xfcfe('0xbd')},{'name':_0x413df3[_0xfcfe('0xb7')][_0xfcfe('0xbe')][_0xfcfe('0xb8')][_0xfcfe('0xb9')][_0xfcfe('0xb8')],'value':_0xfcfe('0xbf')});var _0x43bcf8={'id':_0x7a764+'_'+_0x413df3[_0xfcfe('0xa0')],'name':_0x413df3['DisplayName'][_0xfcfe('0xb9')][_0xfcfe('0xb8')],'custom':![],'options':_0x5a7694};_0x8ae43e[_0xfcfe('0xaf')](_0x43bcf8);return _0x8ae43e;});}function getInputList(_0x57bcfe,_0x5a3f76,_0x4ee0cc,_0x4345d1,_0x500d54,_0x3a87f5,_0x2a5c09){var _0x476d19={'method':_0xfcfe('0x96'),'uri':_0x57bcfe+_0xfcfe('0x9a')+_0x500d54+')/Attributes('+_0x3a87f5+_0xfcfe('0xc0')+_0x4ee0cc+_0xfcfe('0xc1'),'headers':{'Authorization':_0xfcfe('0x98')+_0x2a5c09,'If-None-Match':null,'OData-Version':_0xfcfe('0x9c')},'json':!![]};return rp(_0x476d19)['then'](function(_0x447244){var _0xc3b10a={'id':_0x5a3f76+'_'+_0x447244[_0xfcfe('0xa0')],'name':_0x447244[_0xfcfe('0xc2')][_0xfcfe('0xb9')]?_0x447244['DisplayName'][_0xfcfe('0xb9')][_0xfcfe('0xb8')]:_0x447244[_0xfcfe('0xa0')],'custom':![],'options':[]};_0x4345d1[_0xfcfe('0xaf')](_0xc3b10a);return _0x4345d1;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index ec6a1a9..723dbf4 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(_0x3bc28f,_0x5a7271){var _0x2a3e8d=function(_0x575ccf){while(--_0x575ccf){_0x3bc28f['push'](_0x3bc28f['shift']());}};_0x2a3e8d(++_0x5a7271);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0xb942dd,_0x11bb9f){var _0x3e3113=function(_0x279352){while(--_0x279352){_0xb942dd['push'](_0xb942dd['shift']());}};_0x3e3113(++_0x11bb9f);}(_0xe706,0xa3));var _0x6e70=function(_0x268b51,_0x24e494){_0x268b51=_0x268b51-0x0;var _0x3306c0=_0xe706[_0x268b51];return _0x3306c0;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 33f31b2..4f1b8b4 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 _0xe765=['rpc','../../config/environment','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','options','raw','where','include','map','model','attributes','catch','ShowDynamics365Account','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe765,0x128));var _0x5e76=function(_0x32cc02,_0x18ca84){_0x32cc02=_0x32cc02-0x0;var _0x1b73f7=_0xe765[_0x32cc02];return _0x1b73f7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5e76('0x0'));var rs=require(_0x5e76('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e76('0x2'));var logger=require(_0x5e76('0x3'))(_0x5e76('0x4'));var config=require(_0x5e76('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5e76('0x6')][_0x5e76('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf8193d,_0x230158,_0x2ba387){return new BPromise(function(_0x3af6e3,_0x44e14a){return client['request'](_0xf8193d,_0x2ba387)[_0x5e76('0x8')](function(_0x5d5b52){logger[_0x5e76('0x9')](_0x5e76('0xa'),_0x230158,_0x5e76('0xb'));logger[_0x5e76('0xc')](_0x5e76('0xd'),_0x230158,_0x5e76('0xb'),JSON[_0x5e76('0xe')](_0x5d5b52));if(_0x5d5b52[_0x5e76('0xf')]){if(_0x5d5b52[_0x5e76('0xf')][_0x5e76('0x10')]===0x1f4){logger['error'](_0x5e76('0xa'),_0x230158,_0x5d5b52[_0x5e76('0xf')][_0x5e76('0x11')]);return _0x44e14a(_0x5d5b52[_0x5e76('0xf')][_0x5e76('0x11')]);}logger[_0x5e76('0xf')](_0x5e76('0xa'),_0x230158,_0x5d5b52[_0x5e76('0xf')][_0x5e76('0x11')]);return _0x3af6e3(_0x5d5b52[_0x5e76('0xf')][_0x5e76('0x11')]);}else{logger['info'](_0x5e76('0xa'),_0x230158,_0x5e76('0xb'));_0x3af6e3(_0x5d5b52[_0x5e76('0x12')][_0x5e76('0x11')]);}})['catch'](function(_0xa5421d){logger['error'](_0x5e76('0xa'),_0x230158,_0xa5421d);_0x44e14a(_0xa5421d);});});}exports[_0x5e76('0x13')]=function(_0x194e2d){var _0x5afa67=this;return new Promise(function(_0xb32c72,_0x3d5afe){return db[_0x5e76('0x14')]['findAll']({'raw':_0x194e2d[_0x5e76('0x15')]?_0x194e2d[_0x5e76('0x15')][_0x5e76('0x16')]===undefined?!![]:![]:!![],'where':_0x194e2d['options']?_0x194e2d[_0x5e76('0x15')][_0x5e76('0x17')]||null:null,'attributes':_0x194e2d[_0x5e76('0x15')]?_0x194e2d['options']['attributes']||null:null,'limit':_0x194e2d[_0x5e76('0x15')]?_0x194e2d[_0x5e76('0x15')]['limit']||null:null,'include':_0x194e2d[_0x5e76('0x15')]?_0x194e2d[_0x5e76('0x15')][_0x5e76('0x18')]?_[_0x5e76('0x19')](_0x194e2d[_0x5e76('0x15')][_0x5e76('0x18')],function(_0x3ec8b9){return{'model':db[_0x3ec8b9[_0x5e76('0x1a')]],'as':_0x3ec8b9['as'],'attributes':_0x3ec8b9[_0x5e76('0x1b')],'include':_0x3ec8b9[_0x5e76('0x18')]?_[_0x5e76('0x19')](_0x3ec8b9[_0x5e76('0x18')],function(_0x5dda6b){return{'model':db[_0x5dda6b['model']],'as':_0x5dda6b['as'],'attributes':_0x5dda6b[_0x5e76('0x1b')],'include':_0x5dda6b[_0x5e76('0x18')]?_[_0x5e76('0x19')](_0x5dda6b[_0x5e76('0x18')],function(_0x371bcf){return{'model':db[_0x371bcf['model']],'as':_0x371bcf['as'],'attributes':_0x371bcf[_0x5e76('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51fe54){logger['info'](_0x5e76('0x13'),_0x194e2d);logger[_0x5e76('0xc')]('GetDynamics365Account',_0x194e2d,JSON[_0x5e76('0xe')](_0x51fe54));_0xb32c72(_0x51fe54);})[_0x5e76('0x1c')](function(_0x32a9d2){logger[_0x5e76('0xf')](_0x5e76('0x13'),_0x32a9d2['message'],_0x194e2d);_0x3d5afe(_0x5afa67['error'](0x1f4,_0x32a9d2['message']));});});};exports['ShowDynamics365Account']=function(_0x44b14b){var _0x342ea1=this;return new Promise(function(_0x1b5d0f,_0x244184){return db[_0x5e76('0x14')]['find']({'raw':_0x44b14b[_0x5e76('0x15')]?_0x44b14b[_0x5e76('0x15')][_0x5e76('0x16')]===undefined?!![]:![]:!![],'where':_0x44b14b[_0x5e76('0x15')]?_0x44b14b[_0x5e76('0x15')][_0x5e76('0x17')]||null:null,'attributes':_0x44b14b['options']?_0x44b14b[_0x5e76('0x15')][_0x5e76('0x1b')]||null:null,'include':_0x44b14b[_0x5e76('0x15')]?_0x44b14b['options'][_0x5e76('0x18')]?_[_0x5e76('0x19')](_0x44b14b[_0x5e76('0x15')][_0x5e76('0x18')],function(_0x5c2340){return{'model':db[_0x5c2340[_0x5e76('0x1a')]],'as':_0x5c2340['as'],'attributes':_0x5c2340[_0x5e76('0x1b')],'include':_0x5c2340[_0x5e76('0x18')]?_['map'](_0x5c2340['include'],function(_0x31af76){return{'model':db[_0x31af76['model']],'as':_0x31af76['as'],'attributes':_0x31af76[_0x5e76('0x1b')],'include':_0x31af76[_0x5e76('0x18')]?_[_0x5e76('0x19')](_0x31af76[_0x5e76('0x18')],function(_0x43b14c){return{'model':db[_0x43b14c[_0x5e76('0x1a')]],'as':_0x43b14c['as'],'attributes':_0x43b14c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e76('0x8')](function(_0x1a5dbf){logger[_0x5e76('0x9')](_0x5e76('0x1d'),_0x44b14b);logger[_0x5e76('0xc')](_0x5e76('0x1d'),_0x44b14b,JSON[_0x5e76('0xe')](_0x1a5dbf));_0x1b5d0f(_0x1a5dbf);})[_0x5e76('0x1c')](function(_0x2415a5){logger[_0x5e76('0xf')]('ShowDynamics365Account',_0x2415a5[_0x5e76('0x11')],_0x44b14b);_0x244184(_0x342ea1[_0x5e76('0xf')](0x1f4,_0x2415a5[_0x5e76('0x11')]));});});}; \ No newline at end of file +var _0x20d7=['catch','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','GetDynamics365Account','debug','find','ShowDynamics365Account','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x577f15,_0x33bcb0){var _0x49d66d=function(_0x24f9ab){while(--_0x24f9ab){_0x577f15['push'](_0x577f15['shift']());}};_0x49d66d(++_0x33bcb0);}(_0x20d7,0xe7));var _0x720d=function(_0x553d30,_0x2bb278){_0x553d30=_0x553d30-0x0;var _0x4a8d7b=_0x20d7[_0x553d30];return _0x4a8d7b;};'use strict';var _=require(_0x720d('0x0'));var util=require(_0x720d('0x1'));var moment=require(_0x720d('0x2'));var BPromise=require('bluebird');var rs=require(_0x720d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x720d('0x4'))['db'];var utils=require(_0x720d('0x5'));var logger=require('../../config/logger')(_0x720d('0x6'));var config=require('../../config/environment');var jayson=require(_0x720d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39575f,_0x2508b2,_0x1833dd){return new BPromise(function(_0x1a80c1,_0x5b6cf3){return client[_0x720d('0x8')](_0x39575f,_0x1833dd)[_0x720d('0x9')](function(_0x3ed335){logger[_0x720d('0xa')](_0x720d('0xb'),_0x2508b2,_0x720d('0xc'));logger['debug'](_0x720d('0xd'),_0x2508b2,'request\x20sent',JSON[_0x720d('0xe')](_0x3ed335));if(_0x3ed335['error']){if(_0x3ed335[_0x720d('0xf')]['code']===0x1f4){logger[_0x720d('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x2508b2,_0x3ed335[_0x720d('0xf')][_0x720d('0x10')]);return _0x5b6cf3(_0x3ed335['error'][_0x720d('0x10')]);}logger[_0x720d('0xf')](_0x720d('0xb'),_0x2508b2,_0x3ed335[_0x720d('0xf')][_0x720d('0x10')]);return _0x1a80c1(_0x3ed335[_0x720d('0xf')]['message']);}else{logger['info'](_0x720d('0xb'),_0x2508b2,_0x720d('0xc'));_0x1a80c1(_0x3ed335['result'][_0x720d('0x10')]);}})[_0x720d('0x11')](function(_0x415687){logger[_0x720d('0xf')](_0x720d('0xb'),_0x2508b2,_0x415687);_0x5b6cf3(_0x415687);});});}exports['GetDynamics365Account']=function(_0x11eacd){var _0x3e8485=this;return new Promise(function(_0x22290,_0x120117){return db[_0x720d('0x12')][_0x720d('0x13')]({'raw':_0x11eacd[_0x720d('0x14')]?_0x11eacd[_0x720d('0x14')][_0x720d('0x15')]===undefined?!![]:![]:!![],'where':_0x11eacd[_0x720d('0x14')]?_0x11eacd[_0x720d('0x14')][_0x720d('0x16')]||null:null,'attributes':_0x11eacd[_0x720d('0x14')]?_0x11eacd[_0x720d('0x14')][_0x720d('0x17')]||null:null,'limit':_0x11eacd[_0x720d('0x14')]?_0x11eacd[_0x720d('0x14')]['limit']||null:null,'include':_0x11eacd[_0x720d('0x14')]?_0x11eacd[_0x720d('0x14')][_0x720d('0x18')]?_[_0x720d('0x19')](_0x11eacd['options']['include'],function(_0x53dc2a){return{'model':db[_0x53dc2a[_0x720d('0x1a')]],'as':_0x53dc2a['as'],'attributes':_0x53dc2a[_0x720d('0x17')],'include':_0x53dc2a[_0x720d('0x18')]?_[_0x720d('0x19')](_0x53dc2a[_0x720d('0x18')],function(_0x169186){return{'model':db[_0x169186[_0x720d('0x1a')]],'as':_0x169186['as'],'attributes':_0x169186[_0x720d('0x17')],'include':_0x169186[_0x720d('0x18')]?_[_0x720d('0x19')](_0x169186[_0x720d('0x18')],function(_0x581a44){return{'model':db[_0x581a44[_0x720d('0x1a')]],'as':_0x581a44['as'],'attributes':_0x581a44[_0x720d('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e8d55){logger['info'](_0x720d('0x1b'),_0x11eacd);logger[_0x720d('0x1c')](_0x720d('0x1b'),_0x11eacd,JSON['stringify'](_0x3e8d55));_0x22290(_0x3e8d55);})[_0x720d('0x11')](function(_0x48d7f0){logger[_0x720d('0xf')](_0x720d('0x1b'),_0x48d7f0[_0x720d('0x10')],_0x11eacd);_0x120117(_0x3e8485[_0x720d('0xf')](0x1f4,_0x48d7f0['message']));});});};exports['ShowDynamics365Account']=function(_0xe79bfe){var _0x1dcd92=this;return new Promise(function(_0x1e1bff,_0x41caf5){return db[_0x720d('0x12')][_0x720d('0x1d')]({'raw':_0xe79bfe['options']?_0xe79bfe[_0x720d('0x14')][_0x720d('0x15')]===undefined?!![]:![]:!![],'where':_0xe79bfe[_0x720d('0x14')]?_0xe79bfe[_0x720d('0x14')]['where']||null:null,'attributes':_0xe79bfe['options']?_0xe79bfe[_0x720d('0x14')]['attributes']||null:null,'include':_0xe79bfe[_0x720d('0x14')]?_0xe79bfe[_0x720d('0x14')][_0x720d('0x18')]?_[_0x720d('0x19')](_0xe79bfe['options'][_0x720d('0x18')],function(_0x254f8a){return{'model':db[_0x254f8a[_0x720d('0x1a')]],'as':_0x254f8a['as'],'attributes':_0x254f8a[_0x720d('0x17')],'include':_0x254f8a[_0x720d('0x18')]?_[_0x720d('0x19')](_0x254f8a[_0x720d('0x18')],function(_0x34b680){return{'model':db[_0x34b680[_0x720d('0x1a')]],'as':_0x34b680['as'],'attributes':_0x34b680[_0x720d('0x17')],'include':_0x34b680[_0x720d('0x18')]?_[_0x720d('0x19')](_0x34b680[_0x720d('0x18')],function(_0x54c23a){return{'model':db[_0x54c23a[_0x720d('0x1a')]],'as':_0x54c23a['as'],'attributes':_0x54c23a[_0x720d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x720d('0x9')](function(_0x1f08ff){logger[_0x720d('0xa')](_0x720d('0x1e'),_0xe79bfe);logger['debug'](_0x720d('0x1e'),_0xe79bfe,JSON[_0x720d('0xe')](_0x1f08ff));_0x1e1bff(_0x1f08ff);})['catch'](function(_0x26b08e){logger[_0x720d('0xf')](_0x720d('0x1e'),_0x26b08e[_0x720d('0x10')],_0xe79bfe);_0x41caf5(_0x1dcd92[_0x720d('0xf')](0x1f4,_0x26b08e['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 21a10bc..72228a2 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 _0x3014=['show','getFields','/:id/subjects','getSubjects','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id'];(function(_0x4053d9,_0x4257a9){var _0x568667=function(_0x1e26d5){while(--_0x1e26d5){_0x4053d9['push'](_0x4053d9['shift']());}};_0x568667(++_0x4257a9);}(_0x3014,0x1d7));var _0x4301=function(_0x2e9c80,_0x10c1a7){_0x2e9c80=_0x2e9c80-0x0;var _0x3fe8c7=_0x3014[_0x2e9c80];return _0x3fe8c7;};'use strict';var multer=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var path=require('path');var timeout=require(_0x4301('0x2'));var express=require(_0x4301('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4301('0x4'));var interaction=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var controller=require(_0x4301('0x7'));router[_0x4301('0x8')]('/',auth[_0x4301('0x9')](),controller[_0x4301('0xa')]);router[_0x4301('0x8')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0xc')]);router['get']('/:id/fields',auth[_0x4301('0x9')](),controller[_0x4301('0xd')]);router['get'](_0x4301('0xe'),auth[_0x4301('0x9')](),controller[_0x4301('0xf')]);router[_0x4301('0x8')]('/:id/descriptions',auth[_0x4301('0x9')](),controller['getDescriptions']);router[_0x4301('0x10')]('/',auth[_0x4301('0x9')](),controller[_0x4301('0x11')]);router[_0x4301('0x12')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0x13')]);router[_0x4301('0x14')](_0x4301('0xb'),auth[_0x4301('0x9')](),controller[_0x4301('0x15')]);module[_0x4301('0x16')]=router; \ No newline at end of file +var _0x7162=['path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','util'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0x7162,0x11d));var _0x2716=function(_0x20c495,_0x13939a){_0x20c495=_0x20c495-0x0;var _0x2ae3f9=_0x7162[_0x20c495];return _0x2ae3f9;};'use strict';var multer=require('multer');var util=require(_0x2716('0x0'));var path=require(_0x2716('0x1'));var timeout=require(_0x2716('0x2'));var express=require(_0x2716('0x3'));var router=express[_0x2716('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2716('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x2716('0x6')](),controller[_0x2716('0x7')]);router[_0x2716('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2716('0x8')](_0x2716('0x9'),auth[_0x2716('0x6')](),controller[_0x2716('0xa')]);router[_0x2716('0x8')](_0x2716('0xb'),auth[_0x2716('0x6')](),controller[_0x2716('0xc')]);router[_0x2716('0x8')](_0x2716('0xd'),auth[_0x2716('0x6')](),controller[_0x2716('0xe')]);router[_0x2716('0xf')]('/',auth[_0x2716('0x6')](),controller[_0x2716('0x10')]);router[_0x2716('0x11')](_0x2716('0x12'),auth[_0x2716('0x6')](),controller[_0x2716('0x13')]);router['delete'](_0x2716('0x12'),auth[_0x2716('0x6')](),controller[_0x2716('0x14')]);module[_0x2716('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 76ef85c..5e5af4e 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 _0x107e=['nothing','contact','STRING','phonecall','ENUM'];(function(_0x578f68,_0x12209b){var _0x31707a=function(_0x583c3c){while(--_0x583c3c){_0x578f68['push'](_0x578f68['shift']());}};_0x31707a(++_0x12209b);}(_0x107e,0xe8));var _0xe107=function(_0xfb003c,_0x3c758a){_0xfb003c=_0xfb003c-0x0;var _0x102344=_0x107e[_0xfb003c];return _0x102344;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe107('0x0')]},'description':{'type':Sequelize[_0xe107('0x0')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0xe107('0x1')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xe107('0x2')]('contact',_0xe107('0x3')),'defaultValue':_0xe107('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xb92a=['ENUM','incident','contact','sequelize','STRING'];(function(_0x5d7803,_0x30e9aa){var _0x1a43b2=function(_0x1359df){while(--_0x1359df){_0x5d7803['push'](_0x5d7803['shift']());}};_0x1a43b2(++_0x30e9aa);}(_0xb92a,0x120));var _0xab92=function(_0x4c277f,_0x5e3853){_0x4c277f=_0x4c277f-0x0;var _0x397444=_0xb92a[_0x4c277f];return _0x397444;};'use strict';var Sequelize=require(_0xab92('0x0'));module['exports']={'name':{'type':Sequelize[_0xab92('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xab92('0x2')](_0xab92('0x3'),'phonecall'),'defaultValue':_0xab92('0x3')},'moduleCreate':{'type':Sequelize[_0xab92('0x2')](_0xab92('0x4'),'nothing'),'defaultValue':_0xab92('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3a3a261..7a2cdd3 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 _0x6c1e=['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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','Dynamics365Configuration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','create','update','body','find','params','getFields','Dynamics365Field','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x3aaa9e,_0x4e0a51){var _0x3f5ab3=function(_0x12d05c){while(--_0x12d05c){_0x3aaa9e['push'](_0x3aaa9e['shift']());}};_0x3f5ab3(++_0x4e0a51);}(_0x6c1e,0xee));var _0xe6c1=function(_0x52851e,_0x535d7a){_0x52851e=_0x52851e-0x0;var _0x1c581e=_0x6c1e[_0x52851e];return _0x1c581e;};'use strict';var emlformat=require(_0xe6c1('0x0'));var rimraf=require(_0xe6c1('0x1'));var zipdir=require(_0xe6c1('0x2'));var jsonpatch=require(_0xe6c1('0x3'));var rp=require(_0xe6c1('0x4'));var moment=require(_0xe6c1('0x5'));var BPromise=require(_0xe6c1('0x6'));var Mustache=require('mustache');var util=require(_0xe6c1('0x7'));var path=require(_0xe6c1('0x8'));var sox=require(_0xe6c1('0x9'));var csv=require('to-csv');var ejs=require(_0xe6c1('0xa'));var fs=require('fs');var fs_extra=require(_0xe6c1('0xb'));var _=require(_0xe6c1('0xc'));var squel=require(_0xe6c1('0xd'));var crypto=require(_0xe6c1('0xe'));var jsforce=require(_0xe6c1('0xf'));var deskjs=require(_0xe6c1('0x10'));var toCsv=require(_0xe6c1('0x11'));var querystring=require(_0xe6c1('0x12'));var Papa=require(_0xe6c1('0x13'));var Redis=require(_0xe6c1('0x14'));var authService=require(_0xe6c1('0x15'));var qs=require(_0xe6c1('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6c1('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xe6c1('0x18'));var config=require(_0xe6c1('0x19'));var licenseUtil=require(_0xe6c1('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32fbe1,_0x1b3bf4){_0x1b3bf4=_0x1b3bf4||0xcc;return function(_0x1586ac){if(_0x1586ac){return _0x32fbe1[_0xe6c1('0x1b')](_0x1b3bf4);}return _0x32fbe1[_0xe6c1('0x1c')](_0x1b3bf4)[_0xe6c1('0x1d')]();};}function respondWithResult(_0x1d0bbf,_0x53ac29){_0x53ac29=_0x53ac29||0xc8;return function(_0x469023){if(_0x469023){return _0x1d0bbf[_0xe6c1('0x1c')](_0x53ac29)[_0xe6c1('0x1e')](_0x469023);}};}function respondWithFilteredResult(_0x4a30ca,_0x1dfd4b){return function(_0x147478){if(_0x147478){var _0x33442b=typeof _0x1dfd4b[_0xe6c1('0x1f')]===_0xe6c1('0x20')&&typeof _0x1dfd4b[_0xe6c1('0x21')]===_0xe6c1('0x20');var _0xb37afd=_0x147478[_0xe6c1('0x22')];var _0x154fd2=_0x33442b?0x0:_0x1dfd4b['offset'];var _0x511b47=_0x33442b?_0x147478[_0xe6c1('0x22')]:_0x1dfd4b['offset']+_0x1dfd4b[_0xe6c1('0x21')];var _0x11cfc6;if(_0x511b47>=_0xb37afd){_0x511b47=_0xb37afd;_0x11cfc6=0xc8;}else{_0x11cfc6=0xce;}_0x4a30ca[_0xe6c1('0x1c')](_0x11cfc6);return _0x4a30ca[_0xe6c1('0x23')](_0xe6c1('0x24'),_0x154fd2+'-'+_0x511b47+'/'+_0xb37afd)[_0xe6c1('0x1e')](_0x147478);}return null;};}function patchUpdates(_0x56ae9f){return function(_0x3f08a7){try{jsonpatch[_0xe6c1('0x25')](_0x3f08a7,_0x56ae9f,!![]);}catch(_0x23f403){return BPromise[_0xe6c1('0x26')](_0x23f403);}return _0x3f08a7[_0xe6c1('0x27')]();};}function saveUpdates(_0x3ca9bc,_0x56fd98){return function(_0x414635){if(_0x414635){return _0x414635['update'](_0x3ca9bc)[_0xe6c1('0x28')](function(_0x4af9b2){return _0x4af9b2;});}return null;};}function removeEntity(_0xc5651f,_0xde7898){return function(_0x7c644d){if(_0x7c644d){return _0x7c644d[_0xe6c1('0x29')]()[_0xe6c1('0x28')](function(){_0xc5651f[_0xe6c1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf302cd,_0x5b451f){return function(_0x3e6b5b){if(!_0x3e6b5b){_0xf302cd[_0xe6c1('0x1b')](0x194);}return _0x3e6b5b;};}function handleError(_0x17ed93,_0xc39eb1){_0xc39eb1=_0xc39eb1||0x1f4;return function(_0x165795){logger[_0xe6c1('0x2a')](_0x165795[_0xe6c1('0x2b')]);if(_0x165795['name']){delete _0x165795[_0xe6c1('0x2c')];}_0x17ed93[_0xe6c1('0x1c')](_0xc39eb1)['send'](_0x165795);};}exports['index']=function(_0xcee329,_0x15ec05){var _0x2f74e0={},_0x1a6bf2={},_0x3f7137={'count':0x0,'rows':[]};var _0xdee0d6=_[_0xe6c1('0x2d')](db[_0xe6c1('0x2e')][_0xe6c1('0x2f')],function(_0x352c3e){return{'name':_0x352c3e['fieldName'],'type':_0x352c3e[_0xe6c1('0x30')][_0xe6c1('0x31')]};});_0x1a6bf2['model']=_['map'](_0xdee0d6,_0xe6c1('0x2c'));_0x1a6bf2[_0xe6c1('0x32')]=_[_0xe6c1('0x33')](_0xcee329['query']);_0x1a6bf2[_0xe6c1('0x34')]=_[_0xe6c1('0x35')](_0x1a6bf2[_0xe6c1('0x36')],_0x1a6bf2[_0xe6c1('0x32')]);_0x2f74e0[_0xe6c1('0x37')]=_[_0xe6c1('0x35')](_0x1a6bf2['model'],qs[_0xe6c1('0x38')](_0xcee329[_0xe6c1('0x32')][_0xe6c1('0x38')]));_0x2f74e0['attributes']=_0x2f74e0[_0xe6c1('0x37')][_0xe6c1('0x39')]?_0x2f74e0['attributes']:_0x1a6bf2[_0xe6c1('0x36')];if(!_0xcee329[_0xe6c1('0x32')][_0xe6c1('0x3a')]('nolimit')){_0x2f74e0[_0xe6c1('0x21')]=qs[_0xe6c1('0x21')](_0xcee329[_0xe6c1('0x32')][_0xe6c1('0x21')]);_0x2f74e0['offset']=qs['offset'](_0xcee329['query'][_0xe6c1('0x1f')]);}_0x2f74e0[_0xe6c1('0x3b')]=qs[_0xe6c1('0x3c')](_0xcee329[_0xe6c1('0x32')][_0xe6c1('0x3c')]);_0x2f74e0['where']=qs[_0xe6c1('0x34')](_[_0xe6c1('0x3d')](_0xcee329[_0xe6c1('0x32')],_0x1a6bf2[_0xe6c1('0x34')]),_0xdee0d6);if(_0xcee329[_0xe6c1('0x32')][_0xe6c1('0x3e')]){_0x2f74e0[_0xe6c1('0x3f')]=_[_0xe6c1('0x40')](_0x2f74e0[_0xe6c1('0x3f')],{'$or':_[_0xe6c1('0x2d')](_0xdee0d6,function(_0x4360ed){if(_0x4360ed[_0xe6c1('0x30')]!=='VIRTUAL'){var _0x24983f={};_0x24983f[_0x4360ed[_0xe6c1('0x2c')]]={'$like':'%'+_0xcee329[_0xe6c1('0x32')][_0xe6c1('0x3e')]+'%'};return _0x24983f;}})});}_0x2f74e0=_[_0xe6c1('0x40')]({},_0x2f74e0,_0xcee329[_0xe6c1('0x41')]);var _0x84b872={'where':_0x2f74e0['where']};return db[_0xe6c1('0x2e')][_0xe6c1('0x22')](_0x84b872)[_0xe6c1('0x28')](function(_0x40715d){_0x3f7137['count']=_0x40715d;if(_0xcee329[_0xe6c1('0x32')][_0xe6c1('0x42')]){_0x2f74e0[_0xe6c1('0x43')]=[{'all':!![]}];}return db[_0xe6c1('0x2e')]['findAll'](_0x2f74e0);})[_0xe6c1('0x28')](function(_0x5ef32f){_0x3f7137[_0xe6c1('0x44')]=_0x5ef32f;return _0x3f7137;})[_0xe6c1('0x28')](respondWithFilteredResult(_0x15ec05,_0x2f74e0))[_0xe6c1('0x45')](handleError(_0x15ec05,null));};exports[_0xe6c1('0x46')]=function(_0x1ce809,_0x33ea1f){var _0x4a2bcd={'raw':![],'where':{'id':_0x1ce809['params']['id']}},_0x35d56e={};_0x35d56e[_0xe6c1('0x36')]=_[_0xe6c1('0x33')](db[_0xe6c1('0x2e')][_0xe6c1('0x2f')]);_0x35d56e['query']=_['keys'](_0x1ce809[_0xe6c1('0x32')]);_0x35d56e['filters']=_[_0xe6c1('0x35')](_0x35d56e[_0xe6c1('0x36')],_0x35d56e[_0xe6c1('0x32')]);_0x4a2bcd[_0xe6c1('0x37')]=_[_0xe6c1('0x35')](_0x35d56e[_0xe6c1('0x36')],qs[_0xe6c1('0x38')](_0x1ce809[_0xe6c1('0x32')][_0xe6c1('0x38')]));_0x4a2bcd[_0xe6c1('0x37')]=_0x4a2bcd[_0xe6c1('0x37')]['length']?_0x4a2bcd[_0xe6c1('0x37')]:_0x35d56e['model'];if(_0x1ce809[_0xe6c1('0x32')][_0xe6c1('0x42')]){_0x4a2bcd['include']=[{'all':!![]}];}_0x4a2bcd=_[_0xe6c1('0x40')]({},_0x4a2bcd,_0x1ce809[_0xe6c1('0x41')]);return db[_0xe6c1('0x2e')]['find'](_0x4a2bcd)[_0xe6c1('0x28')](handleEntityNotFound(_0x33ea1f,null))[_0xe6c1('0x28')](respondWithResult(_0x33ea1f,null))[_0xe6c1('0x45')](handleError(_0x33ea1f,null));};exports[_0xe6c1('0x47')]=function(_0x3f9b70,_0x126bb4){return db[_0xe6c1('0x2e')][_0xe6c1('0x47')](_0x3f9b70['body'],{})[_0xe6c1('0x28')](respondWithResult(_0x126bb4,0xc9))[_0xe6c1('0x45')](handleError(_0x126bb4,null));};exports[_0xe6c1('0x48')]=function(_0x7c9c82,_0x38ca9e){if(_0x7c9c82[_0xe6c1('0x49')]['id']){delete _0x7c9c82[_0xe6c1('0x49')]['id'];}return db[_0xe6c1('0x2e')][_0xe6c1('0x4a')]({'where':{'id':_0x7c9c82[_0xe6c1('0x4b')]['id']}})[_0xe6c1('0x28')](handleEntityNotFound(_0x38ca9e,null))[_0xe6c1('0x28')](saveUpdates(_0x7c9c82['body'],null))[_0xe6c1('0x28')](respondWithResult(_0x38ca9e,null))['catch'](handleError(_0x38ca9e,null));};exports['destroy']=function(_0x24ce53,_0x56c742){return db[_0xe6c1('0x2e')][_0xe6c1('0x4a')]({'where':{'id':_0x24ce53['params']['id']}})[_0xe6c1('0x28')](handleEntityNotFound(_0x56c742,null))[_0xe6c1('0x28')](removeEntity(_0x56c742,null))[_0xe6c1('0x45')](handleError(_0x56c742,null));};exports[_0xe6c1('0x4c')]=function(_0x39e847,_0x480847,_0x56ced4){var _0x4b4514={};var _0x5b9a82={};var _0x17213b;var _0x3beeb3;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x39e847[_0xe6c1('0x4b')]['id']}})[_0xe6c1('0x28')](handleEntityNotFound(_0x480847,null))['then'](function(_0x276594){if(_0x276594){_0x17213b=_0x276594;_0x5b9a82['model']=_[_0xe6c1('0x33')](db[_0xe6c1('0x4d')][_0xe6c1('0x2f')]);_0x5b9a82[_0xe6c1('0x32')]=_[_0xe6c1('0x33')](_0x39e847[_0xe6c1('0x32')]);_0x5b9a82[_0xe6c1('0x34')]=_[_0xe6c1('0x35')](_0x5b9a82[_0xe6c1('0x36')],_0x5b9a82[_0xe6c1('0x32')]);_0x4b4514[_0xe6c1('0x37')]=_[_0xe6c1('0x35')](_0x5b9a82['model'],qs['fields'](_0x39e847[_0xe6c1('0x32')][_0xe6c1('0x38')]));_0x4b4514[_0xe6c1('0x37')]=_0x4b4514[_0xe6c1('0x37')][_0xe6c1('0x39')]?_0x4b4514[_0xe6c1('0x37')]:_0x5b9a82[_0xe6c1('0x36')];_0x4b4514['order']=qs[_0xe6c1('0x3c')](_0x39e847[_0xe6c1('0x32')]['sort']);_0x4b4514['where']=qs[_0xe6c1('0x34')](_[_0xe6c1('0x3d')](_0x39e847[_0xe6c1('0x32')],_0x5b9a82['filters']));if(_0x39e847[_0xe6c1('0x32')]['filter']){_0x4b4514['where']=_[_0xe6c1('0x40')](_0x4b4514['where'],{'$or':_[_0xe6c1('0x2d')](_0x4b4514[_0xe6c1('0x37')],function(_0x3393ba){var _0xe94029={};_0xe94029[_0x3393ba]={'$like':'%'+_0x39e847[_0xe6c1('0x32')][_0xe6c1('0x3e')]+'%'};return _0xe94029;})});}_0x4b4514=_['merge']({},_0x4b4514,_0x39e847[_0xe6c1('0x41')]);return _0x17213b['getFields'](_0x4b4514);}})[_0xe6c1('0x28')](function(_0x8b092d){if(_0x8b092d){_0x3beeb3=_0x8b092d[_0xe6c1('0x39')];if(!_0x39e847['query'][_0xe6c1('0x3a')](_0xe6c1('0x4e'))){_0x4b4514[_0xe6c1('0x21')]=qs[_0xe6c1('0x21')](_0x39e847[_0xe6c1('0x32')][_0xe6c1('0x21')]);_0x4b4514[_0xe6c1('0x1f')]=qs[_0xe6c1('0x1f')](_0x39e847['query']['offset']);}return _0x17213b[_0xe6c1('0x4c')](_0x4b4514);}})[_0xe6c1('0x28')](function(_0x5da702){if(_0x5da702){return _0x5da702?{'count':_0x3beeb3,'rows':_0x5da702}:null;}})[_0xe6c1('0x28')](respondWithResult(_0x480847,null))[_0xe6c1('0x45')](handleError(_0x480847,null));};exports[_0xe6c1('0x4f')]=function(_0x122fd2,_0x1da0b8,_0xce6709){var _0x300951={};var _0x18e1cf={};var _0x43a004;var _0x45f04a;return db[_0xe6c1('0x2e')][_0xe6c1('0x50')]({'where':{'id':_0x122fd2[_0xe6c1('0x4b')]['id']}})[_0xe6c1('0x28')](handleEntityNotFound(_0x1da0b8,null))[_0xe6c1('0x28')](function(_0xd41b76){if(_0xd41b76){_0x43a004=_0xd41b76;_0x18e1cf[_0xe6c1('0x36')]=_[_0xe6c1('0x33')](db[_0xe6c1('0x4d')][_0xe6c1('0x2f')]);_0x18e1cf[_0xe6c1('0x32')]=_[_0xe6c1('0x33')](_0x122fd2['query']);_0x18e1cf['filters']=_[_0xe6c1('0x35')](_0x18e1cf[_0xe6c1('0x36')],_0x18e1cf[_0xe6c1('0x32')]);_0x300951['attributes']=_[_0xe6c1('0x35')](_0x18e1cf['model'],qs[_0xe6c1('0x38')](_0x122fd2[_0xe6c1('0x32')][_0xe6c1('0x38')]));_0x300951[_0xe6c1('0x37')]=_0x300951['attributes'][_0xe6c1('0x39')]?_0x300951['attributes']:_0x18e1cf['model'];_0x300951[_0xe6c1('0x3b')]=qs[_0xe6c1('0x3c')](_0x122fd2[_0xe6c1('0x32')][_0xe6c1('0x3c')]);_0x300951[_0xe6c1('0x3f')]=qs[_0xe6c1('0x34')](_[_0xe6c1('0x3d')](_0x122fd2[_0xe6c1('0x32')],_0x18e1cf['filters']));if(_0x122fd2[_0xe6c1('0x32')]['filter']){_0x300951[_0xe6c1('0x3f')]=_[_0xe6c1('0x40')](_0x300951['where'],{'$or':_[_0xe6c1('0x2d')](_0x300951['attributes'],function(_0x51dbfb){var _0x2bb150={};_0x2bb150[_0x51dbfb]={'$like':'%'+_0x122fd2[_0xe6c1('0x32')][_0xe6c1('0x3e')]+'%'};return _0x2bb150;})});}_0x300951=_['merge']({},_0x300951,_0x122fd2['options']);return _0x43a004[_0xe6c1('0x4f')](_0x300951);}})[_0xe6c1('0x28')](function(_0x568158){if(_0x568158){_0x45f04a=_0x568158['length'];if(!_0x122fd2[_0xe6c1('0x32')][_0xe6c1('0x3a')](_0xe6c1('0x4e'))){_0x300951[_0xe6c1('0x21')]=qs['limit'](_0x122fd2[_0xe6c1('0x32')][_0xe6c1('0x21')]);_0x300951[_0xe6c1('0x1f')]=qs['offset'](_0x122fd2[_0xe6c1('0x32')][_0xe6c1('0x1f')]);}return _0x43a004['getSubjects'](_0x300951);}})['then'](function(_0x4c355b){if(_0x4c355b){return _0x4c355b?{'count':_0x45f04a,'rows':_0x4c355b}:null;}})[_0xe6c1('0x28')](respondWithResult(_0x1da0b8,null))[_0xe6c1('0x45')](handleError(_0x1da0b8,null));};exports[_0xe6c1('0x51')]=function(_0x3e469,_0x55d1ad,_0x4b5801){var _0x4dca81={};var _0x2c7d14={};var _0x18bc50;var _0x29cbdc;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3e469['params']['id']}})[_0xe6c1('0x28')](handleEntityNotFound(_0x55d1ad,null))[_0xe6c1('0x28')](function(_0x4dde79){if(_0x4dde79){_0x18bc50=_0x4dde79;_0x2c7d14[_0xe6c1('0x36')]=_[_0xe6c1('0x33')](db['Dynamics365Field'][_0xe6c1('0x2f')]);_0x2c7d14[_0xe6c1('0x32')]=_[_0xe6c1('0x33')](_0x3e469[_0xe6c1('0x32')]);_0x2c7d14[_0xe6c1('0x34')]=_[_0xe6c1('0x35')](_0x2c7d14[_0xe6c1('0x36')],_0x2c7d14['query']);_0x4dca81[_0xe6c1('0x37')]=_[_0xe6c1('0x35')](_0x2c7d14[_0xe6c1('0x36')],qs[_0xe6c1('0x38')](_0x3e469['query']['fields']));_0x4dca81[_0xe6c1('0x37')]=_0x4dca81[_0xe6c1('0x37')][_0xe6c1('0x39')]?_0x4dca81[_0xe6c1('0x37')]:_0x2c7d14[_0xe6c1('0x36')];_0x4dca81[_0xe6c1('0x3b')]=qs[_0xe6c1('0x3c')](_0x3e469[_0xe6c1('0x32')][_0xe6c1('0x3c')]);_0x4dca81[_0xe6c1('0x3f')]=qs['filters'](_[_0xe6c1('0x3d')](_0x3e469[_0xe6c1('0x32')],_0x2c7d14[_0xe6c1('0x34')]));if(_0x3e469['query'][_0xe6c1('0x3e')]){_0x4dca81[_0xe6c1('0x3f')]=_[_0xe6c1('0x40')](_0x4dca81[_0xe6c1('0x3f')],{'$or':_['map'](_0x4dca81['attributes'],function(_0x33dc5d){var _0x29c1ef={};_0x29c1ef[_0x33dc5d]={'$like':'%'+_0x3e469[_0xe6c1('0x32')]['filter']+'%'};return _0x29c1ef;})});}_0x4dca81=_[_0xe6c1('0x40')]({},_0x4dca81,_0x3e469[_0xe6c1('0x41')]);return _0x18bc50[_0xe6c1('0x51')](_0x4dca81);}})['then'](function(_0x55530e){if(_0x55530e){_0x29cbdc=_0x55530e[_0xe6c1('0x39')];if(!_0x3e469[_0xe6c1('0x32')][_0xe6c1('0x3a')](_0xe6c1('0x4e'))){_0x4dca81[_0xe6c1('0x21')]=qs[_0xe6c1('0x21')](_0x3e469[_0xe6c1('0x32')]['limit']);_0x4dca81[_0xe6c1('0x1f')]=qs[_0xe6c1('0x1f')](_0x3e469[_0xe6c1('0x32')][_0xe6c1('0x1f')]);}return _0x18bc50['getDescriptions'](_0x4dca81);}})[_0xe6c1('0x28')](function(_0x5ba87f){if(_0x5ba87f){return _0x5ba87f?{'count':_0x29cbdc,'rows':_0x5ba87f}:null;}})[_0xe6c1('0x28')](respondWithResult(_0x55d1ad,null))[_0xe6c1('0x45')](handleError(_0x55d1ad,null));}; \ No newline at end of file +var _0x2664=['keys','length','create','body','find','findOne','Dynamics365Field','rawAttributes','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x2664,0x1a5));var _0x4266=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2664[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x4266('0x0'));var rimraf=require(_0x4266('0x1'));var zipdir=require(_0x4266('0x2'));var jsonpatch=require(_0x4266('0x3'));var rp=require(_0x4266('0x4'));var moment=require(_0x4266('0x5'));var BPromise=require(_0x4266('0x6'));var Mustache=require(_0x4266('0x7'));var util=require(_0x4266('0x8'));var path=require('path');var sox=require(_0x4266('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4266('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4266('0xb'));var jsforce=require(_0x4266('0xc'));var deskjs=require(_0x4266('0xd'));var toCsv=require(_0x4266('0xe'));var querystring=require(_0x4266('0xf'));var Papa=require(_0x4266('0x10'));var Redis=require(_0x4266('0x11'));var authService=require(_0x4266('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4266('0x13'));var hardwareService=require(_0x4266('0x14'));var logger=require(_0x4266('0x15'))(_0x4266('0x16'));var utils=require(_0x4266('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4266('0x18'))['db'];function respondWithStatusCode(_0x4f32fe,_0x1a0a5c){_0x1a0a5c=_0x1a0a5c||0xcc;return function(_0x26d17b){if(_0x26d17b){return _0x4f32fe[_0x4266('0x19')](_0x1a0a5c);}return _0x4f32fe[_0x4266('0x1a')](_0x1a0a5c)['end']();};}function respondWithResult(_0x5500ef,_0x5c6715){_0x5c6715=_0x5c6715||0xc8;return function(_0x5c7bf6){if(_0x5c7bf6){return _0x5500ef[_0x4266('0x1a')](_0x5c6715)[_0x4266('0x1b')](_0x5c7bf6);}};}function respondWithFilteredResult(_0x86f8f5,_0xd33740){return function(_0x4197d2){if(_0x4197d2){var _0x43a1dc=typeof _0xd33740[_0x4266('0x1c')]===_0x4266('0x1d')&&typeof _0xd33740[_0x4266('0x1e')]===_0x4266('0x1d');var _0x57970=_0x4197d2[_0x4266('0x1f')];var _0xe5802b=_0x43a1dc?0x0:_0xd33740[_0x4266('0x1c')];var _0x52ffb2=_0x43a1dc?_0x4197d2['count']:_0xd33740[_0x4266('0x1c')]+_0xd33740[_0x4266('0x1e')];var _0x220109;if(_0x52ffb2>=_0x57970){_0x52ffb2=_0x57970;_0x220109=0xc8;}else{_0x220109=0xce;}_0x86f8f5[_0x4266('0x1a')](_0x220109);return _0x86f8f5['set']('Content-Range',_0xe5802b+'-'+_0x52ffb2+'/'+_0x57970)[_0x4266('0x1b')](_0x4197d2);}return null;};}function patchUpdates(_0x434cee){return function(_0x32cc7c){try{jsonpatch[_0x4266('0x20')](_0x32cc7c,_0x434cee,!![]);}catch(_0x3fad4c){return BPromise[_0x4266('0x21')](_0x3fad4c);}return _0x32cc7c[_0x4266('0x22')]();};}function saveUpdates(_0x4733b1,_0x3e80f5){return function(_0x3ce5fb){if(_0x3ce5fb){return _0x3ce5fb[_0x4266('0x23')](_0x4733b1)[_0x4266('0x24')](function(_0x4f8238){return _0x4f8238;});}return null;};}function removeEntity(_0x52a7fd,_0x1ffd71){return function(_0x19f088){if(_0x19f088){return _0x19f088[_0x4266('0x25')]()[_0x4266('0x24')](function(){_0x52a7fd[_0x4266('0x1a')](0xcc)[_0x4266('0x26')]();});}};}function handleEntityNotFound(_0x26ebb4,_0x48fb33){return function(_0xb363d5){if(!_0xb363d5){_0x26ebb4[_0x4266('0x19')](0x194);}return _0xb363d5;};}function handleError(_0x5010d4,_0x2efcd6){_0x2efcd6=_0x2efcd6||0x1f4;return function(_0x128edc){logger[_0x4266('0x27')](_0x128edc[_0x4266('0x28')]);if(_0x128edc[_0x4266('0x29')]){delete _0x128edc[_0x4266('0x29')];}_0x5010d4[_0x4266('0x1a')](_0x2efcd6)[_0x4266('0x2a')](_0x128edc);};}exports[_0x4266('0x2b')]=function(_0x38bdd2,_0xb560da){var _0x40e704={},_0x4e30af={},_0x39327f={'count':0x0,'rows':[]};var _0x5decff=_[_0x4266('0x2c')](db[_0x4266('0x2d')]['rawAttributes'],function(_0x1676df){return{'name':_0x1676df[_0x4266('0x2e')],'type':_0x1676df[_0x4266('0x2f')][_0x4266('0x30')]};});_0x4e30af['model']=_[_0x4266('0x2c')](_0x5decff,_0x4266('0x29'));_0x4e30af['query']=_['keys'](_0x38bdd2[_0x4266('0x31')]);_0x4e30af[_0x4266('0x32')]=_[_0x4266('0x33')](_0x4e30af[_0x4266('0x34')],_0x4e30af[_0x4266('0x31')]);_0x40e704[_0x4266('0x35')]=_[_0x4266('0x33')](_0x4e30af[_0x4266('0x34')],qs[_0x4266('0x36')](_0x38bdd2[_0x4266('0x31')][_0x4266('0x36')]));_0x40e704[_0x4266('0x35')]=_0x40e704['attributes']['length']?_0x40e704['attributes']:_0x4e30af['model'];if(!_0x38bdd2[_0x4266('0x31')][_0x4266('0x37')](_0x4266('0x38'))){_0x40e704[_0x4266('0x1e')]=qs[_0x4266('0x1e')](_0x38bdd2[_0x4266('0x31')][_0x4266('0x1e')]);_0x40e704['offset']=qs[_0x4266('0x1c')](_0x38bdd2[_0x4266('0x31')]['offset']);}_0x40e704[_0x4266('0x39')]=qs['sort'](_0x38bdd2[_0x4266('0x31')][_0x4266('0x3a')]);_0x40e704['where']=qs['filters'](_[_0x4266('0x3b')](_0x38bdd2['query'],_0x4e30af[_0x4266('0x32')]),_0x5decff);if(_0x38bdd2[_0x4266('0x31')][_0x4266('0x3c')]){_0x40e704[_0x4266('0x3d')]=_['merge'](_0x40e704[_0x4266('0x3d')],{'$or':_[_0x4266('0x2c')](_0x5decff,function(_0x1c0255){if(_0x1c0255['type']!==_0x4266('0x3e')){var _0x587b1e={};_0x587b1e[_0x1c0255[_0x4266('0x29')]]={'$like':'%'+_0x38bdd2['query'][_0x4266('0x3c')]+'%'};return _0x587b1e;}})});}_0x40e704=_[_0x4266('0x3f')]({},_0x40e704,_0x38bdd2[_0x4266('0x40')]);var _0x7b161d={'where':_0x40e704['where']};return db[_0x4266('0x2d')]['count'](_0x7b161d)[_0x4266('0x24')](function(_0x162c61){_0x39327f['count']=_0x162c61;if(_0x38bdd2[_0x4266('0x31')][_0x4266('0x41')]){_0x40e704[_0x4266('0x42')]=[{'all':!![]}];}return db[_0x4266('0x2d')][_0x4266('0x43')](_0x40e704);})[_0x4266('0x24')](function(_0xc7744b){_0x39327f[_0x4266('0x44')]=_0xc7744b;return _0x39327f;})[_0x4266('0x24')](respondWithFilteredResult(_0xb560da,_0x40e704))[_0x4266('0x45')](handleError(_0xb560da,null));};exports['show']=function(_0x399e5f,_0x266191){var _0x3770d5={'raw':![],'where':{'id':_0x399e5f[_0x4266('0x46')]['id']}},_0x3a722f={};_0x3a722f[_0x4266('0x34')]=_[_0x4266('0x47')](db['Dynamics365Configuration']['rawAttributes']);_0x3a722f[_0x4266('0x31')]=_[_0x4266('0x47')](_0x399e5f['query']);_0x3a722f[_0x4266('0x32')]=_['intersection'](_0x3a722f[_0x4266('0x34')],_0x3a722f[_0x4266('0x31')]);_0x3770d5[_0x4266('0x35')]=_[_0x4266('0x33')](_0x3a722f[_0x4266('0x34')],qs['fields'](_0x399e5f[_0x4266('0x31')][_0x4266('0x36')]));_0x3770d5['attributes']=_0x3770d5['attributes'][_0x4266('0x48')]?_0x3770d5[_0x4266('0x35')]:_0x3a722f['model'];if(_0x399e5f[_0x4266('0x31')]['includeAll']){_0x3770d5[_0x4266('0x42')]=[{'all':!![]}];}_0x3770d5=_[_0x4266('0x3f')]({},_0x3770d5,_0x399e5f[_0x4266('0x40')]);return db['Dynamics365Configuration']['find'](_0x3770d5)['then'](handleEntityNotFound(_0x266191,null))[_0x4266('0x24')](respondWithResult(_0x266191,null))['catch'](handleError(_0x266191,null));};exports['create']=function(_0xe14f5e,_0x8ae00b){return db['Dynamics365Configuration'][_0x4266('0x49')](_0xe14f5e[_0x4266('0x4a')],{})['then'](respondWithResult(_0x8ae00b,0xc9))[_0x4266('0x45')](handleError(_0x8ae00b,null));};exports[_0x4266('0x23')]=function(_0x11f507,_0x56b901){if(_0x11f507[_0x4266('0x4a')]['id']){delete _0x11f507[_0x4266('0x4a')]['id'];}return db[_0x4266('0x2d')][_0x4266('0x4b')]({'where':{'id':_0x11f507['params']['id']}})[_0x4266('0x24')](handleEntityNotFound(_0x56b901,null))[_0x4266('0x24')](saveUpdates(_0x11f507[_0x4266('0x4a')],null))[_0x4266('0x24')](respondWithResult(_0x56b901,null))[_0x4266('0x45')](handleError(_0x56b901,null));};exports['destroy']=function(_0x153086,_0x31ec4c){return db['Dynamics365Configuration']['find']({'where':{'id':_0x153086[_0x4266('0x46')]['id']}})[_0x4266('0x24')](handleEntityNotFound(_0x31ec4c,null))[_0x4266('0x24')](removeEntity(_0x31ec4c,null))[_0x4266('0x45')](handleError(_0x31ec4c,null));};exports['getFields']=function(_0x4f872e,_0x1356a8,_0x2e8ff2){var _0x3d9fb7={};var _0xc019de={};var _0xb612d3;var _0x17e085;return db[_0x4266('0x2d')][_0x4266('0x4c')]({'where':{'id':_0x4f872e[_0x4266('0x46')]['id']}})['then'](handleEntityNotFound(_0x1356a8,null))['then'](function(_0x1aae5b){if(_0x1aae5b){_0xb612d3=_0x1aae5b;_0xc019de['model']=_['keys'](db[_0x4266('0x4d')][_0x4266('0x4e')]);_0xc019de[_0x4266('0x31')]=_['keys'](_0x4f872e[_0x4266('0x31')]);_0xc019de['filters']=_[_0x4266('0x33')](_0xc019de['model'],_0xc019de['query']);_0x3d9fb7['attributes']=_[_0x4266('0x33')](_0xc019de[_0x4266('0x34')],qs['fields'](_0x4f872e['query']['fields']));_0x3d9fb7[_0x4266('0x35')]=_0x3d9fb7[_0x4266('0x35')][_0x4266('0x48')]?_0x3d9fb7[_0x4266('0x35')]:_0xc019de[_0x4266('0x34')];_0x3d9fb7[_0x4266('0x39')]=qs[_0x4266('0x3a')](_0x4f872e[_0x4266('0x31')][_0x4266('0x3a')]);_0x3d9fb7['where']=qs['filters'](_[_0x4266('0x3b')](_0x4f872e['query'],_0xc019de[_0x4266('0x32')]));if(_0x4f872e[_0x4266('0x31')][_0x4266('0x3c')]){_0x3d9fb7['where']=_[_0x4266('0x3f')](_0x3d9fb7[_0x4266('0x3d')],{'$or':_[_0x4266('0x2c')](_0x3d9fb7['attributes'],function(_0x28f495){var _0x479451={};_0x479451[_0x28f495]={'$like':'%'+_0x4f872e[_0x4266('0x31')]['filter']+'%'};return _0x479451;})});}_0x3d9fb7=_['merge']({},_0x3d9fb7,_0x4f872e[_0x4266('0x40')]);return _0xb612d3[_0x4266('0x4f')](_0x3d9fb7);}})['then'](function(_0x3cfcdf){if(_0x3cfcdf){_0x17e085=_0x3cfcdf['length'];if(!_0x4f872e['query']['hasOwnProperty']('nolimit')){_0x3d9fb7[_0x4266('0x1e')]=qs['limit'](_0x4f872e[_0x4266('0x31')][_0x4266('0x1e')]);_0x3d9fb7['offset']=qs[_0x4266('0x1c')](_0x4f872e[_0x4266('0x31')][_0x4266('0x1c')]);}return _0xb612d3[_0x4266('0x4f')](_0x3d9fb7);}})[_0x4266('0x24')](function(_0x35ccbd){if(_0x35ccbd){return _0x35ccbd?{'count':_0x17e085,'rows':_0x35ccbd}:null;}})[_0x4266('0x24')](respondWithResult(_0x1356a8,null))['catch'](handleError(_0x1356a8,null));};exports[_0x4266('0x50')]=function(_0x1788db,_0x2ad62d,_0x177ffe){var _0x1e4bad={};var _0x28509d={};var _0x2b93ca;var _0x3adc4f;return db[_0x4266('0x2d')]['findOne']({'where':{'id':_0x1788db['params']['id']}})['then'](handleEntityNotFound(_0x2ad62d,null))[_0x4266('0x24')](function(_0x26d9b8){if(_0x26d9b8){_0x2b93ca=_0x26d9b8;_0x28509d[_0x4266('0x34')]=_[_0x4266('0x47')](db[_0x4266('0x4d')][_0x4266('0x4e')]);_0x28509d['query']=_[_0x4266('0x47')](_0x1788db[_0x4266('0x31')]);_0x28509d['filters']=_[_0x4266('0x33')](_0x28509d[_0x4266('0x34')],_0x28509d['query']);_0x1e4bad[_0x4266('0x35')]=_[_0x4266('0x33')](_0x28509d[_0x4266('0x34')],qs['fields'](_0x1788db[_0x4266('0x31')][_0x4266('0x36')]));_0x1e4bad[_0x4266('0x35')]=_0x1e4bad[_0x4266('0x35')]['length']?_0x1e4bad[_0x4266('0x35')]:_0x28509d[_0x4266('0x34')];_0x1e4bad[_0x4266('0x39')]=qs[_0x4266('0x3a')](_0x1788db[_0x4266('0x31')]['sort']);_0x1e4bad[_0x4266('0x3d')]=qs[_0x4266('0x32')](_[_0x4266('0x3b')](_0x1788db[_0x4266('0x31')],_0x28509d['filters']));if(_0x1788db[_0x4266('0x31')][_0x4266('0x3c')]){_0x1e4bad[_0x4266('0x3d')]=_['merge'](_0x1e4bad[_0x4266('0x3d')],{'$or':_[_0x4266('0x2c')](_0x1e4bad[_0x4266('0x35')],function(_0x3191ba){var _0x5e44ab={};_0x5e44ab[_0x3191ba]={'$like':'%'+_0x1788db[_0x4266('0x31')][_0x4266('0x3c')]+'%'};return _0x5e44ab;})});}_0x1e4bad=_[_0x4266('0x3f')]({},_0x1e4bad,_0x1788db[_0x4266('0x40')]);return _0x2b93ca['getSubjects'](_0x1e4bad);}})[_0x4266('0x24')](function(_0x54e399){if(_0x54e399){_0x3adc4f=_0x54e399['length'];if(!_0x1788db['query']['hasOwnProperty'](_0x4266('0x38'))){_0x1e4bad[_0x4266('0x1e')]=qs[_0x4266('0x1e')](_0x1788db[_0x4266('0x31')]['limit']);_0x1e4bad[_0x4266('0x1c')]=qs[_0x4266('0x1c')](_0x1788db['query']['offset']);}return _0x2b93ca[_0x4266('0x50')](_0x1e4bad);}})['then'](function(_0xe0ed0e){if(_0xe0ed0e){return _0xe0ed0e?{'count':_0x3adc4f,'rows':_0xe0ed0e}:null;}})[_0x4266('0x24')](respondWithResult(_0x2ad62d,null))[_0x4266('0x45')](handleError(_0x2ad62d,null));};exports[_0x4266('0x51')]=function(_0x3cd7c4,_0xbfb254,_0x59f03e){var _0x55aed5={};var _0x2ff7de={};var _0x185932;var _0x460fba;return db[_0x4266('0x2d')]['findOne']({'where':{'id':_0x3cd7c4[_0x4266('0x46')]['id']}})[_0x4266('0x24')](handleEntityNotFound(_0xbfb254,null))[_0x4266('0x24')](function(_0x28b662){if(_0x28b662){_0x185932=_0x28b662;_0x2ff7de[_0x4266('0x34')]=_[_0x4266('0x47')](db['Dynamics365Field'][_0x4266('0x4e')]);_0x2ff7de['query']=_[_0x4266('0x47')](_0x3cd7c4[_0x4266('0x31')]);_0x2ff7de[_0x4266('0x32')]=_[_0x4266('0x33')](_0x2ff7de[_0x4266('0x34')],_0x2ff7de[_0x4266('0x31')]);_0x55aed5[_0x4266('0x35')]=_[_0x4266('0x33')](_0x2ff7de[_0x4266('0x34')],qs[_0x4266('0x36')](_0x3cd7c4[_0x4266('0x31')][_0x4266('0x36')]));_0x55aed5[_0x4266('0x35')]=_0x55aed5[_0x4266('0x35')][_0x4266('0x48')]?_0x55aed5['attributes']:_0x2ff7de[_0x4266('0x34')];_0x55aed5[_0x4266('0x39')]=qs[_0x4266('0x3a')](_0x3cd7c4['query'][_0x4266('0x3a')]);_0x55aed5[_0x4266('0x3d')]=qs[_0x4266('0x32')](_['pick'](_0x3cd7c4['query'],_0x2ff7de[_0x4266('0x32')]));if(_0x3cd7c4[_0x4266('0x31')]['filter']){_0x55aed5['where']=_[_0x4266('0x3f')](_0x55aed5[_0x4266('0x3d')],{'$or':_['map'](_0x55aed5['attributes'],function(_0xddb81d){var _0x4fdcf1={};_0x4fdcf1[_0xddb81d]={'$like':'%'+_0x3cd7c4['query'][_0x4266('0x3c')]+'%'};return _0x4fdcf1;})});}_0x55aed5=_[_0x4266('0x3f')]({},_0x55aed5,_0x3cd7c4[_0x4266('0x40')]);return _0x185932[_0x4266('0x51')](_0x55aed5);}})[_0x4266('0x24')](function(_0x2971c6){if(_0x2971c6){_0x460fba=_0x2971c6[_0x4266('0x48')];if(!_0x3cd7c4[_0x4266('0x31')][_0x4266('0x37')](_0x4266('0x38'))){_0x55aed5[_0x4266('0x1e')]=qs[_0x4266('0x1e')](_0x3cd7c4['query']['limit']);_0x55aed5[_0x4266('0x1c')]=qs['offset'](_0x3cd7c4[_0x4266('0x31')][_0x4266('0x1c')]);}return _0x185932[_0x4266('0x51')](_0x55aed5);}})[_0x4266('0x24')](function(_0x4dbd4c){if(_0x4dbd4c){return _0x4dbd4c?{'count':_0x460fba,'rows':_0x4dbd4c}:null;}})[_0x4266('0x24')](respondWithResult(_0xbfb254,null))['catch'](handleError(_0xbfb254,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ab25fc2..d27d7e3 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 _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x4f2a67,_0x5def7a){var _0x333700=function(_0x51ac2a){while(--_0x51ac2a){_0x4f2a67['push'](_0x4f2a67['shift']());}};_0x333700(++_0x5def7a);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x33e123,_0x35f0ee){_0x33e123=_0x33e123-0x0;var _0xf4872e=_0x8d0e[_0x33e123];return _0xf4872e;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x5c38e1,_0x4ece44){var _0x229445=function(_0x13c0f2){while(--_0x13c0f2){_0x5c38e1['push'](_0x5c38e1['shift']());}};_0x229445(++_0x4ece44);}(_0x34e8,0x12c));var _0x834e=function(_0x1c9fb0,_0x3223b0){_0x1c9fb0=_0x1c9fb0-0x0;var _0x2ea643=_0x34e8[_0x1c9fb0];return _0x2ea643;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'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 405c4eb..830f875 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 _0x514b=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xa70a30,_0x42785b){var _0x539c59=function(_0x90a16a){while(--_0x90a16a){_0xa70a30['push'](_0xa70a30['shift']());}};_0x539c59(++_0x42785b);}(_0x514b,0x1b8));var _0xb514=function(_0x378d7f,_0x417216){_0x378d7f=_0x378d7f-0x0;var _0x3bef1c=_0x514b[_0x378d7f];return _0x3bef1c;};'use strict';var _=require(_0xb514('0x0'));var util=require(_0xb514('0x1'));var moment=require(_0xb514('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb514('0x3'));var db=require(_0xb514('0x4'))['db'];var utils=require(_0xb514('0x5'));var logger=require(_0xb514('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb514('0x7'));var client=jayson['client'][_0xb514('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24ee2b,_0x34883c,_0x3cf427){return new BPromise(function(_0x1c314f,_0x373261){return client[_0xb514('0x9')](_0x24ee2b,_0x3cf427)['then'](function(_0x493bd4){logger[_0xb514('0xa')](_0xb514('0xb'),_0x34883c,_0xb514('0xc'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x34883c,_0xb514('0xc'),JSON[_0xb514('0xd')](_0x493bd4));if(_0x493bd4[_0xb514('0xe')]){if(_0x493bd4[_0xb514('0xe')][_0xb514('0xf')]===0x1f4){logger[_0xb514('0xe')](_0xb514('0xb'),_0x34883c,_0x493bd4['error'][_0xb514('0x10')]);return _0x373261(_0x493bd4[_0xb514('0xe')][_0xb514('0x10')]);}logger[_0xb514('0xe')](_0xb514('0xb'),_0x34883c,_0x493bd4['error'][_0xb514('0x10')]);return _0x1c314f(_0x493bd4[_0xb514('0xe')]['message']);}else{logger[_0xb514('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x34883c,_0xb514('0xc'));_0x1c314f(_0x493bd4[_0xb514('0x11')][_0xb514('0x10')]);}})[_0xb514('0x12')](function(_0x28d2cb){logger['error'](_0xb514('0xb'),_0x34883c,_0x28d2cb);_0x373261(_0x28d2cb);});});} \ No newline at end of file +var _0x79e9=['jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x41c5a6,_0x30693a){var _0x43d55a=function(_0x3718f3){while(--_0x3718f3){_0x41c5a6['push'](_0x41c5a6['shift']());}};_0x43d55a(++_0x30693a);}(_0x79e9,0xa5));var _0x979e=function(_0x84aa65,_0x33e9a3){_0x84aa65=_0x84aa65-0x0;var _0x508d85=_0x79e9[_0x84aa65];return _0x508d85;};'use strict';var _=require(_0x979e('0x0'));var util=require('util');var moment=require(_0x979e('0x1'));var BPromise=require(_0x979e('0x2'));var rs=require(_0x979e('0x3'));var fs=require('fs');var Redis=require(_0x979e('0x4'));var db=require(_0x979e('0x5'))['db'];var utils=require(_0x979e('0x6'));var logger=require(_0x979e('0x7'))(_0x979e('0x8'));var config=require(_0x979e('0x9'));var jayson=require(_0x979e('0xa'));var client=jayson[_0x979e('0xb')][_0x979e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c9ac3,_0x1e50a1,_0x462490){return new BPromise(function(_0x13e25f,_0x41c39b){return client[_0x979e('0xd')](_0x2c9ac3,_0x462490)[_0x979e('0xe')](function(_0x469542){logger[_0x979e('0xf')](_0x979e('0x10'),_0x1e50a1,_0x979e('0x11'));logger[_0x979e('0x12')](_0x979e('0x13'),_0x1e50a1,'request\x20sent',JSON[_0x979e('0x14')](_0x469542));if(_0x469542['error']){if(_0x469542[_0x979e('0x15')][_0x979e('0x16')]===0x1f4){logger[_0x979e('0x15')](_0x979e('0x10'),_0x1e50a1,_0x469542[_0x979e('0x15')][_0x979e('0x17')]);return _0x41c39b(_0x469542[_0x979e('0x15')][_0x979e('0x17')]);}logger[_0x979e('0x15')](_0x979e('0x10'),_0x1e50a1,_0x469542['error'][_0x979e('0x17')]);return _0x13e25f(_0x469542[_0x979e('0x15')][_0x979e('0x17')]);}else{logger[_0x979e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1e50a1,'request\x20sent');_0x13e25f(_0x469542[_0x979e('0x18')][_0x979e('0x17')]);}})['catch'](function(_0x5219ba){logger[_0x979e('0x15')](_0x979e('0x10'),_0x1e50a1,_0x5219ba);_0x41c39b(_0x5219ba);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c8d7992..a0d8f54 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 _0xb1fb=['../../components/interaction/service','get','isAuthenticated','index','/:id','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x185080,_0x34e717){var _0x1caefd=function(_0x300f3d){while(--_0x300f3d){_0x185080['push'](_0x185080['shift']());}};_0x1caefd(++_0x34e717);}(_0xb1fb,0xae));var _0xbb1f=function(_0x7f3dd5,_0x58ca84){_0x7f3dd5=_0x7f3dd5-0x0;var _0xc4c11a=_0xb1fb[_0x7f3dd5];return _0xc4c11a;};'use strict';var multer=require(_0xbb1f('0x0'));var util=require(_0xbb1f('0x1'));var path=require(_0xbb1f('0x2'));var timeout=require(_0xbb1f('0x3'));var express=require(_0xbb1f('0x4'));var router=express[_0xbb1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbb1f('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0xbb1f('0x7')]('/',auth[_0xbb1f('0x8')](),controller[_0xbb1f('0x9')]);router['get'](_0xbb1f('0xa'),auth[_0xbb1f('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbb1f('0xb')]);router['put'](_0xbb1f('0xa'),auth[_0xbb1f('0x8')](),controller[_0xbb1f('0xc')]);router[_0xbb1f('0xd')](_0xbb1f('0xa'),auth[_0xbb1f('0x8')](),controller[_0xbb1f('0xe')]);module['exports']=router; \ No newline at end of file +var _0xbdb0=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show','create','put','delete','destroy'];(function(_0x23a079,_0xb8c9aa){var _0x53f2a5=function(_0x1b3dc5){while(--_0x1b3dc5){_0x23a079['push'](_0x23a079['shift']());}};_0x53f2a5(++_0xb8c9aa);}(_0xbdb0,0x144));var _0x0bdb=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0xbdb0[_0x329664];return _0x4e346e;};'use strict';var multer=require(_0x0bdb('0x0'));var util=require(_0x0bdb('0x1'));var path=require('path');var timeout=require(_0x0bdb('0x2'));var express=require(_0x0bdb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0bdb('0x4'));var interaction=require(_0x0bdb('0x5'));var config=require(_0x0bdb('0x6'));var controller=require(_0x0bdb('0x7'));router[_0x0bdb('0x8')]('/',auth['isAuthenticated'](),controller[_0x0bdb('0x9')]);router[_0x0bdb('0x8')]('/:id',auth[_0x0bdb('0xa')](),controller[_0x0bdb('0xb')]);router['post']('/',auth[_0x0bdb('0xa')](),controller[_0x0bdb('0xc')]);router[_0x0bdb('0xd')]('/:id',auth[_0x0bdb('0xa')](),controller['update']);router[_0x0bdb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0bdb('0xf')]);module[_0x0bdb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index b11811b..7ba3c03 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 _0x698d=['sequelize','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x579d91,_0x211b97){var _0x5eb93f=function(_0x2cb17e){while(--_0x2cb17e){_0x579d91['push'](_0x579d91['shift']());}};_0x5eb93f(++_0x211b97);}(_0x698d,0x138));var _0xd698=function(_0xf77d23,_0x104dd7){_0xf77d23=_0xf77d23-0x0;var _0x7ac1a0=_0x698d[_0xf77d23];return _0x7ac1a0;};'use strict';var Sequelize=require(_0xd698('0x0'));module['exports']={'type':{'type':Sequelize[_0xd698('0x1')](_0xd698('0x2'),_0xd698('0x3'),_0xd698('0x4'),'keyValue',_0xd698('0x5')),'defaultValue':_0xd698('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd698('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd698('0x2'),_0xd698('0x3'),_0xd698('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd698('0x6')]},'customField':{'type':Sequelize[_0xd698('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6859=['ENUM','string','keyValue','picklist','STRING','sequelize'];(function(_0x1e6a8d,_0x5a293f){var _0x338f41=function(_0x5af996){while(--_0x5af996){_0x1e6a8d['push'](_0x1e6a8d['shift']());}};_0x338f41(++_0x5a293f);}(_0x6859,0x77));var _0x9685=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6859[_0x263a74];return _0x2aa86c;};'use strict';var Sequelize=require(_0x9685('0x0'));module['exports']={'type':{'type':Sequelize[_0x9685('0x1')](_0x9685('0x2'),'variable','customVariable',_0x9685('0x3'),_0x9685('0x4')),'defaultValue':_0x9685('0x2')},'content':{'type':Sequelize[_0x9685('0x5')]},'key':{'type':Sequelize[_0x9685('0x5')]},'keyType':{'type':Sequelize[_0x9685('0x1')](_0x9685('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9685('0x5')]},'idField':{'type':Sequelize[_0x9685('0x5')]},'nameField':{'type':Sequelize[_0x9685('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9685('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0a08af7..75cd445 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 _0xf7d3=['hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','stack','name','send','map','Dynamics365Field','rawAttributes','query','filters','intersection','attributes','model','fields','length'];(function(_0x4ee8cb,_0x2b0582){var _0x1d7057=function(_0x583e7b){while(--_0x583e7b){_0x4ee8cb['push'](_0x4ee8cb['shift']());}};_0x1d7057(++_0x2b0582);}(_0xf7d3,0x90));var _0x3f7d=function(_0x1b1c24,_0x55adab){_0x1b1c24=_0x1b1c24-0x0;var _0x471ec4=_0xf7d3[_0x1b1c24];return _0x471ec4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3f7d('0x0'));var jsonpatch=require(_0x3f7d('0x1'));var rp=require(_0x3f7d('0x2'));var moment=require('moment');var BPromise=require(_0x3f7d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f7d('0x4'));var sox=require(_0x3f7d('0x5'));var csv=require(_0x3f7d('0x6'));var ejs=require(_0x3f7d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f7d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f7d('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f7d('0xa'));var Papa=require(_0x3f7d('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f7d('0xc'));var as=require(_0x3f7d('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f7d('0xe'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f7d('0xf'))['db'];function respondWithStatusCode(_0x2598ef,_0x289486){_0x289486=_0x289486||0xcc;return function(_0x3940db){if(_0x3940db){return _0x2598ef[_0x3f7d('0x10')](_0x289486);}return _0x2598ef[_0x3f7d('0x11')](_0x289486)['end']();};}function respondWithResult(_0x127f33,_0x168704){_0x168704=_0x168704||0xc8;return function(_0x40b64d){if(_0x40b64d){return _0x127f33[_0x3f7d('0x11')](_0x168704)[_0x3f7d('0x12')](_0x40b64d);}};}function respondWithFilteredResult(_0x51fad6,_0x12e182){return function(_0xadd395){if(_0xadd395){var _0x163cc1=typeof _0x12e182[_0x3f7d('0x13')]===_0x3f7d('0x14')&&typeof _0x12e182[_0x3f7d('0x15')]==='undefined';var _0x3d97f4=_0xadd395[_0x3f7d('0x16')];var _0x44cfe2=_0x163cc1?0x0:_0x12e182['offset'];var _0x1e6d5d=_0x163cc1?_0xadd395[_0x3f7d('0x16')]:_0x12e182['offset']+_0x12e182[_0x3f7d('0x15')];var _0x57e6b3;if(_0x1e6d5d>=_0x3d97f4){_0x1e6d5d=_0x3d97f4;_0x57e6b3=0xc8;}else{_0x57e6b3=0xce;}_0x51fad6[_0x3f7d('0x11')](_0x57e6b3);return _0x51fad6[_0x3f7d('0x17')]('Content-Range',_0x44cfe2+'-'+_0x1e6d5d+'/'+_0x3d97f4)['json'](_0xadd395);}return null;};}function patchUpdates(_0xd91d86){return function(_0x571729){try{jsonpatch[_0x3f7d('0x18')](_0x571729,_0xd91d86,!![]);}catch(_0x38ca4c){return BPromise[_0x3f7d('0x19')](_0x38ca4c);}return _0x571729['save']();};}function saveUpdates(_0x4a642d,_0x46515d){return function(_0x5db8ff){if(_0x5db8ff){return _0x5db8ff[_0x3f7d('0x1a')](_0x4a642d)[_0x3f7d('0x1b')](function(_0x3da9fc){return _0x3da9fc;});}return null;};}function removeEntity(_0x18983f,_0x3ce15c){return function(_0x58afc7){if(_0x58afc7){return _0x58afc7['destroy']()[_0x3f7d('0x1b')](function(){_0x18983f[_0x3f7d('0x11')](0xcc)[_0x3f7d('0x1c')]();});}};}function handleEntityNotFound(_0x148359,_0x29728e){return function(_0x83ca94){if(!_0x83ca94){_0x148359[_0x3f7d('0x10')](0x194);}return _0x83ca94;};}function handleError(_0x56a653,_0x1f270d){_0x1f270d=_0x1f270d||0x1f4;return function(_0x175143){logger['error'](_0x175143[_0x3f7d('0x1d')]);if(_0x175143[_0x3f7d('0x1e')]){delete _0x175143[_0x3f7d('0x1e')];}_0x56a653['status'](_0x1f270d)[_0x3f7d('0x1f')](_0x175143);};}exports['index']=function(_0x551846,_0xf2115c){var _0x324032={},_0x9fd906={},_0x5abe05={'count':0x0,'rows':[]};var _0x2bf8d2=_[_0x3f7d('0x20')](db[_0x3f7d('0x21')][_0x3f7d('0x22')],function(_0xa5cc28){return{'name':_0xa5cc28['fieldName'],'type':_0xa5cc28['type']['key']};});_0x9fd906['model']=_[_0x3f7d('0x20')](_0x2bf8d2,_0x3f7d('0x1e'));_0x9fd906[_0x3f7d('0x23')]=_['keys'](_0x551846[_0x3f7d('0x23')]);_0x9fd906[_0x3f7d('0x24')]=_[_0x3f7d('0x25')](_0x9fd906['model'],_0x9fd906[_0x3f7d('0x23')]);_0x324032[_0x3f7d('0x26')]=_['intersection'](_0x9fd906[_0x3f7d('0x27')],qs[_0x3f7d('0x28')](_0x551846[_0x3f7d('0x23')][_0x3f7d('0x28')]));_0x324032[_0x3f7d('0x26')]=_0x324032['attributes'][_0x3f7d('0x29')]?_0x324032[_0x3f7d('0x26')]:_0x9fd906[_0x3f7d('0x27')];if(!_0x551846['query'][_0x3f7d('0x2a')](_0x3f7d('0x2b'))){_0x324032[_0x3f7d('0x15')]=qs[_0x3f7d('0x15')](_0x551846[_0x3f7d('0x23')][_0x3f7d('0x15')]);_0x324032[_0x3f7d('0x13')]=qs[_0x3f7d('0x13')](_0x551846[_0x3f7d('0x23')][_0x3f7d('0x13')]);}_0x324032[_0x3f7d('0x2c')]=qs[_0x3f7d('0x2d')](_0x551846[_0x3f7d('0x23')]['sort']);_0x324032[_0x3f7d('0x2e')]=qs[_0x3f7d('0x24')](_[_0x3f7d('0x2f')](_0x551846[_0x3f7d('0x23')],_0x9fd906['filters']),_0x2bf8d2);if(_0x551846[_0x3f7d('0x23')]['filter']){_0x324032[_0x3f7d('0x2e')]=_[_0x3f7d('0x30')](_0x324032[_0x3f7d('0x2e')],{'$or':_[_0x3f7d('0x20')](_0x2bf8d2,function(_0x5b630a){if(_0x5b630a['type']!=='VIRTUAL'){var _0x321910={};_0x321910[_0x5b630a['name']]={'$like':'%'+_0x551846[_0x3f7d('0x23')][_0x3f7d('0x31')]+'%'};return _0x321910;}})});}_0x324032=_[_0x3f7d('0x30')]({},_0x324032,_0x551846[_0x3f7d('0x32')]);var _0x4c94b7={'where':_0x324032[_0x3f7d('0x2e')]};return db[_0x3f7d('0x21')][_0x3f7d('0x16')](_0x4c94b7)[_0x3f7d('0x1b')](function(_0x4947de){_0x5abe05[_0x3f7d('0x16')]=_0x4947de;if(_0x551846[_0x3f7d('0x23')][_0x3f7d('0x33')]){_0x324032[_0x3f7d('0x34')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x3f7d('0x35')](_0x324032);})[_0x3f7d('0x1b')](function(_0x39f3ee){_0x5abe05['rows']=_0x39f3ee;return _0x5abe05;})[_0x3f7d('0x1b')](respondWithFilteredResult(_0xf2115c,_0x324032))[_0x3f7d('0x36')](handleError(_0xf2115c,null));};exports[_0x3f7d('0x37')]=function(_0x5db1a8,_0x39a20b){var _0xe26373={'raw':!![],'where':{'id':_0x5db1a8[_0x3f7d('0x38')]['id']}},_0xde1144={};_0xde1144['model']=_[_0x3f7d('0x39')](db[_0x3f7d('0x21')]['rawAttributes']);_0xde1144['query']=_['keys'](_0x5db1a8[_0x3f7d('0x23')]);_0xde1144['filters']=_['intersection'](_0xde1144[_0x3f7d('0x27')],_0xde1144[_0x3f7d('0x23')]);_0xe26373[_0x3f7d('0x26')]=_[_0x3f7d('0x25')](_0xde1144[_0x3f7d('0x27')],qs[_0x3f7d('0x28')](_0x5db1a8[_0x3f7d('0x23')][_0x3f7d('0x28')]));_0xe26373[_0x3f7d('0x26')]=_0xe26373[_0x3f7d('0x26')]['length']?_0xe26373[_0x3f7d('0x26')]:_0xde1144[_0x3f7d('0x27')];if(_0x5db1a8['query'][_0x3f7d('0x33')]){_0xe26373[_0x3f7d('0x34')]=[{'all':!![]}];}_0xe26373=_[_0x3f7d('0x30')]({},_0xe26373,_0x5db1a8[_0x3f7d('0x32')]);return db['Dynamics365Field'][_0x3f7d('0x3a')](_0xe26373)[_0x3f7d('0x1b')](handleEntityNotFound(_0x39a20b,null))['then'](respondWithResult(_0x39a20b,null))[_0x3f7d('0x36')](handleError(_0x39a20b,null));};exports[_0x3f7d('0x3b')]=function(_0x3a096b,_0x31e248){return db[_0x3f7d('0x21')]['create'](_0x3a096b[_0x3f7d('0x3c')],{})[_0x3f7d('0x1b')](respondWithResult(_0x31e248,0xc9))[_0x3f7d('0x36')](handleError(_0x31e248,null));};exports['update']=function(_0xb86b4b,_0x2ef8d6){if(_0xb86b4b[_0x3f7d('0x3c')]['id']){delete _0xb86b4b[_0x3f7d('0x3c')]['id'];}return db[_0x3f7d('0x21')]['find']({'where':{'id':_0xb86b4b[_0x3f7d('0x38')]['id']}})[_0x3f7d('0x1b')](handleEntityNotFound(_0x2ef8d6,null))[_0x3f7d('0x1b')](saveUpdates(_0xb86b4b[_0x3f7d('0x3c')],null))[_0x3f7d('0x1b')](respondWithResult(_0x2ef8d6,null))['catch'](handleError(_0x2ef8d6,null));};exports[_0x3f7d('0x3d')]=function(_0x244b26,_0x550c18){return db['Dynamics365Field'][_0x3f7d('0x3a')]({'where':{'id':_0x244b26[_0x3f7d('0x38')]['id']}})[_0x3f7d('0x1b')](handleEntityNotFound(_0x550c18,null))[_0x3f7d('0x1b')](removeEntity(_0x550c18,null))[_0x3f7d('0x36')](handleError(_0x550c18,null));}; \ No newline at end of file +var _0xefeb=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','reject','update','then','destroy','stack','name','index','map','Dynamics365Field','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters'];(function(_0x1158d5,_0x4e7ee8){var _0x3e9d61=function(_0x182cc7){while(--_0x182cc7){_0x1158d5['push'](_0x1158d5['shift']());}};_0x3e9d61(++_0x4e7ee8);}(_0xefeb,0xd3));var _0xbefe=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xefeb[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbefe('0x0'));var zipdir=require(_0xbefe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbefe('0x2'));var BPromise=require(_0xbefe('0x3'));var Mustache=require(_0xbefe('0x4'));var util=require(_0xbefe('0x5'));var path=require('path');var sox=require(_0xbefe('0x6'));var csv=require(_0xbefe('0x7'));var ejs=require(_0xbefe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbefe('0x9'));var crypto=require(_0xbefe('0xa'));var jsforce=require(_0xbefe('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbefe('0x7'));var querystring=require(_0xbefe('0xc'));var Papa=require(_0xbefe('0xd'));var Redis=require(_0xbefe('0xe'));var authService=require(_0xbefe('0xf'));var qs=require(_0xbefe('0x10'));var as=require(_0xbefe('0x11'));var hardwareService=require(_0xbefe('0x12'));var logger=require(_0xbefe('0x13'))('api');var utils=require(_0xbefe('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbefe('0x15'));var db=require(_0xbefe('0x16'))['db'];function respondWithStatusCode(_0x44f8e0,_0x5d1b88){_0x5d1b88=_0x5d1b88||0xcc;return function(_0x85e607){if(_0x85e607){return _0x44f8e0[_0xbefe('0x17')](_0x5d1b88);}return _0x44f8e0['status'](_0x5d1b88)[_0xbefe('0x18')]();};}function respondWithResult(_0x50c8f3,_0x3ba9cc){_0x3ba9cc=_0x3ba9cc||0xc8;return function(_0x310708){if(_0x310708){return _0x50c8f3['status'](_0x3ba9cc)[_0xbefe('0x19')](_0x310708);}};}function respondWithFilteredResult(_0x388194,_0xc31e6){return function(_0x3da988){if(_0x3da988){var _0x20e44a=typeof _0xc31e6[_0xbefe('0x1a')]===_0xbefe('0x1b')&&typeof _0xc31e6['limit']==='undefined';var _0x2ae561=_0x3da988[_0xbefe('0x1c')];var _0x5be23a=_0x20e44a?0x0:_0xc31e6[_0xbefe('0x1a')];var _0xb486ce=_0x20e44a?_0x3da988[_0xbefe('0x1c')]:_0xc31e6[_0xbefe('0x1a')]+_0xc31e6[_0xbefe('0x1d')];var _0x4586f5;if(_0xb486ce>=_0x2ae561){_0xb486ce=_0x2ae561;_0x4586f5=0xc8;}else{_0x4586f5=0xce;}_0x388194[_0xbefe('0x1e')](_0x4586f5);return _0x388194['set'](_0xbefe('0x1f'),_0x5be23a+'-'+_0xb486ce+'/'+_0x2ae561)[_0xbefe('0x19')](_0x3da988);}return null;};}function patchUpdates(_0x53c8de){return function(_0x11b708){try{jsonpatch['apply'](_0x11b708,_0x53c8de,!![]);}catch(_0x3406dc){return BPromise[_0xbefe('0x20')](_0x3406dc);}return _0x11b708['save']();};}function saveUpdates(_0x51c257,_0x15c6a8){return function(_0x19ff87){if(_0x19ff87){return _0x19ff87[_0xbefe('0x21')](_0x51c257)[_0xbefe('0x22')](function(_0xe5ff39){return _0xe5ff39;});}return null;};}function removeEntity(_0x4bac16,_0x1b4d21){return function(_0x709ad8){if(_0x709ad8){return _0x709ad8[_0xbefe('0x23')]()[_0xbefe('0x22')](function(){_0x4bac16[_0xbefe('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x116ebb,_0x749633){return function(_0x2dac61){if(!_0x2dac61){_0x116ebb[_0xbefe('0x17')](0x194);}return _0x2dac61;};}function handleError(_0xb11db5,_0x11bd40){_0x11bd40=_0x11bd40||0x1f4;return function(_0x4c958a){logger['error'](_0x4c958a[_0xbefe('0x24')]);if(_0x4c958a['name']){delete _0x4c958a[_0xbefe('0x25')];}_0xb11db5[_0xbefe('0x1e')](_0x11bd40)['send'](_0x4c958a);};}exports[_0xbefe('0x26')]=function(_0x1c4f2c,_0x1af093){var _0x23ff52={},_0xece105={},_0x483533={'count':0x0,'rows':[]};var _0x32b295=_[_0xbefe('0x27')](db[_0xbefe('0x28')]['rawAttributes'],function(_0x233a0c){return{'name':_0x233a0c['fieldName'],'type':_0x233a0c[_0xbefe('0x29')]['key']};});_0xece105[_0xbefe('0x2a')]=_['map'](_0x32b295,_0xbefe('0x25'));_0xece105['query']=_[_0xbefe('0x2b')](_0x1c4f2c[_0xbefe('0x2c')]);_0xece105['filters']=_[_0xbefe('0x2d')](_0xece105[_0xbefe('0x2a')],_0xece105[_0xbefe('0x2c')]);_0x23ff52['attributes']=_[_0xbefe('0x2d')](_0xece105['model'],qs[_0xbefe('0x2e')](_0x1c4f2c[_0xbefe('0x2c')][_0xbefe('0x2e')]));_0x23ff52[_0xbefe('0x2f')]=_0x23ff52[_0xbefe('0x2f')][_0xbefe('0x30')]?_0x23ff52[_0xbefe('0x2f')]:_0xece105[_0xbefe('0x2a')];if(!_0x1c4f2c[_0xbefe('0x2c')][_0xbefe('0x31')]('nolimit')){_0x23ff52[_0xbefe('0x1d')]=qs[_0xbefe('0x1d')](_0x1c4f2c['query'][_0xbefe('0x1d')]);_0x23ff52[_0xbefe('0x1a')]=qs['offset'](_0x1c4f2c['query'][_0xbefe('0x1a')]);}_0x23ff52['order']=qs['sort'](_0x1c4f2c[_0xbefe('0x2c')][_0xbefe('0x32')]);_0x23ff52[_0xbefe('0x33')]=qs[_0xbefe('0x34')](_['pick'](_0x1c4f2c['query'],_0xece105['filters']),_0x32b295);if(_0x1c4f2c[_0xbefe('0x2c')][_0xbefe('0x35')]){_0x23ff52['where']=_[_0xbefe('0x36')](_0x23ff52[_0xbefe('0x33')],{'$or':_[_0xbefe('0x27')](_0x32b295,function(_0x4c8adf){if(_0x4c8adf['type']!==_0xbefe('0x37')){var _0x5c3801={};_0x5c3801[_0x4c8adf[_0xbefe('0x25')]]={'$like':'%'+_0x1c4f2c[_0xbefe('0x2c')][_0xbefe('0x35')]+'%'};return _0x5c3801;}})});}_0x23ff52=_[_0xbefe('0x36')]({},_0x23ff52,_0x1c4f2c[_0xbefe('0x38')]);var _0xe42f82={'where':_0x23ff52[_0xbefe('0x33')]};return db['Dynamics365Field']['count'](_0xe42f82)[_0xbefe('0x22')](function(_0xd3284){_0x483533[_0xbefe('0x1c')]=_0xd3284;if(_0x1c4f2c[_0xbefe('0x2c')][_0xbefe('0x39')]){_0x23ff52[_0xbefe('0x3a')]=[{'all':!![]}];}return db[_0xbefe('0x28')][_0xbefe('0x3b')](_0x23ff52);})[_0xbefe('0x22')](function(_0x5d8053){_0x483533[_0xbefe('0x3c')]=_0x5d8053;return _0x483533;})['then'](respondWithFilteredResult(_0x1af093,_0x23ff52))[_0xbefe('0x3d')](handleError(_0x1af093,null));};exports['show']=function(_0x13dd23,_0x31309e){var _0x1427cf={'raw':!![],'where':{'id':_0x13dd23[_0xbefe('0x3e')]['id']}},_0x39a41={};_0x39a41[_0xbefe('0x2a')]=_[_0xbefe('0x2b')](db[_0xbefe('0x28')][_0xbefe('0x3f')]);_0x39a41[_0xbefe('0x2c')]=_[_0xbefe('0x2b')](_0x13dd23['query']);_0x39a41['filters']=_['intersection'](_0x39a41['model'],_0x39a41[_0xbefe('0x2c')]);_0x1427cf['attributes']=_[_0xbefe('0x2d')](_0x39a41[_0xbefe('0x2a')],qs[_0xbefe('0x2e')](_0x13dd23['query'][_0xbefe('0x2e')]));_0x1427cf[_0xbefe('0x2f')]=_0x1427cf['attributes']['length']?_0x1427cf[_0xbefe('0x2f')]:_0x39a41[_0xbefe('0x2a')];if(_0x13dd23[_0xbefe('0x2c')][_0xbefe('0x39')]){_0x1427cf[_0xbefe('0x3a')]=[{'all':!![]}];}_0x1427cf=_[_0xbefe('0x36')]({},_0x1427cf,_0x13dd23[_0xbefe('0x38')]);return db[_0xbefe('0x28')]['find'](_0x1427cf)[_0xbefe('0x22')](handleEntityNotFound(_0x31309e,null))[_0xbefe('0x22')](respondWithResult(_0x31309e,null))[_0xbefe('0x3d')](handleError(_0x31309e,null));};exports[_0xbefe('0x40')]=function(_0x50737f,_0x57f991){return db[_0xbefe('0x28')][_0xbefe('0x40')](_0x50737f[_0xbefe('0x41')],{})['then'](respondWithResult(_0x57f991,0xc9))['catch'](handleError(_0x57f991,null));};exports[_0xbefe('0x21')]=function(_0x50f2d5,_0x32acc9){if(_0x50f2d5[_0xbefe('0x41')]['id']){delete _0x50f2d5[_0xbefe('0x41')]['id'];}return db[_0xbefe('0x28')]['find']({'where':{'id':_0x50f2d5[_0xbefe('0x3e')]['id']}})['then'](handleEntityNotFound(_0x32acc9,null))[_0xbefe('0x22')](saveUpdates(_0x50f2d5[_0xbefe('0x41')],null))[_0xbefe('0x22')](respondWithResult(_0x32acc9,null))['catch'](handleError(_0x32acc9,null));};exports['destroy']=function(_0x2f2aef,_0x13c771){return db[_0xbefe('0x28')]['find']({'where':{'id':_0x2f2aef[_0xbefe('0x3e')]['id']}})[_0xbefe('0x22')](handleEntityNotFound(_0x13c771,null))[_0xbefe('0x22')](removeEntity(_0x13c771,null))['catch'](handleError(_0x13c771,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 17efe3e..7ddc4d2 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 _0xdcb7=['exports','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x2ef519,_0x585c36){var _0x2d41a1=function(_0xbd9b84){while(--_0xbd9b84){_0x2ef519['push'](_0x2ef519['shift']());}};_0x2d41a1(++_0x585c36);}(_0xdcb7,0x1a9));var _0x7dcb=function(_0x2cbba2,_0x1a6d32){_0x2cbba2=_0x2cbba2-0x0;var _0x2af126=_0xdcb7[_0x2cbba2];return _0x2af126;};'use strict';var _=require(_0x7dcb('0x0'));var util=require(_0x7dcb('0x1'));var logger=require('../../config/logger')(_0x7dcb('0x2'));var moment=require(_0x7dcb('0x3'));var BPromise=require(_0x7dcb('0x4'));var rp=require(_0x7dcb('0x5'));var fs=require('fs');var path=require(_0x7dcb('0x6'));var rimraf=require(_0x7dcb('0x7'));var config=require(_0x7dcb('0x8'));var attributes=require(_0x7dcb('0x9'));module[_0x7dcb('0xa')]=function(_0x29c3d8,_0x7dad8f){return _0x29c3d8['define'](_0x7dcb('0xb'),attributes,{'tableName':_0x7dcb('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x7dcb('0xd'),_0x7dcb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x509d=['rimraf','../../config/environment','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x509d,0x159));var _0xd509=function(_0x5ad794,_0x330eb1){_0x5ad794=_0x5ad794-0x0;var _0x58d45e=_0x509d[_0x5ad794];return _0x58d45e;};'use strict';var _=require('lodash');var util=require(_0xd509('0x0'));var logger=require(_0xd509('0x1'))('api');var moment=require(_0xd509('0x2'));var BPromise=require(_0xd509('0x3'));var rp=require(_0xd509('0x4'));var fs=require('fs');var path=require(_0xd509('0x5'));var rimraf=require(_0xd509('0x6'));var config=require(_0xd509('0x7'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x20722f,_0x263e67){return _0x20722f[_0xd509('0x8')](_0xd509('0x9'),attributes,{'tableName':_0xd509('0xa'),'paranoid':![],'indexes':[{'name':_0xd509('0xb'),'fields':['idField',_0xd509('0xc')],'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 a5c7240..b9fac3d 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 _0xcabb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x11529d,_0x124234){var _0x20822d=function(_0x34552b){while(--_0x34552b){_0x11529d['push'](_0x11529d['shift']());}};_0x20822d(++_0x124234);}(_0xcabb,0x173));var _0xbcab=function(_0x33de75,_0x181509){_0x33de75=_0x33de75-0x0;var _0x2d85bf=_0xcabb[_0x33de75];return _0x2d85bf;};'use strict';var _=require(_0xbcab('0x0'));var util=require(_0xbcab('0x1'));var moment=require(_0xbcab('0x2'));var BPromise=require(_0xbcab('0x3'));var rs=require(_0xbcab('0x4'));var fs=require('fs');var Redis=require(_0xbcab('0x5'));var db=require(_0xbcab('0x6'))['db'];var utils=require(_0xbcab('0x7'));var logger=require(_0xbcab('0x8'))('rpc');var config=require(_0xbcab('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbcab('0xa')][_0xbcab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cf0f2,_0x4cac87,_0x703a48){return new BPromise(function(_0x665361,_0x9845f7){return client['request'](_0x1cf0f2,_0x703a48)[_0xbcab('0xc')](function(_0xd04702){logger[_0xbcab('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x4cac87,'request\x20sent');logger['debug'](_0xbcab('0xe'),_0x4cac87,_0xbcab('0xf'),JSON[_0xbcab('0x10')](_0xd04702));if(_0xd04702[_0xbcab('0x11')]){if(_0xd04702[_0xbcab('0x11')][_0xbcab('0x12')]===0x1f4){logger[_0xbcab('0x11')](_0xbcab('0x13'),_0x4cac87,_0xd04702['error'][_0xbcab('0x14')]);return _0x9845f7(_0xd04702[_0xbcab('0x11')]['message']);}logger[_0xbcab('0x11')](_0xbcab('0x13'),_0x4cac87,_0xd04702[_0xbcab('0x11')][_0xbcab('0x14')]);return _0x665361(_0xd04702[_0xbcab('0x11')][_0xbcab('0x14')]);}else{logger[_0xbcab('0xd')](_0xbcab('0x13'),_0x4cac87,_0xbcab('0xf'));_0x665361(_0xd04702['result'][_0xbcab('0x14')]);}})[_0xbcab('0x15')](function(_0xb720ba){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4cac87,_0xb720ba);_0x9845f7(_0xb720ba);});});} \ No newline at end of file +var _0xa67e=['../../config/logger','jayson/promise','http','request','Dynamics365Field,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3b9f91,_0x6d41){var _0x92201d=function(_0x13e534){while(--_0x13e534){_0x3b9f91['push'](_0x3b9f91['shift']());}};_0x92201d(++_0x6d41);}(_0xa67e,0x119));var _0xea67=function(_0xb66f7c,_0x5109ec){_0xb66f7c=_0xb66f7c-0x0;var _0x57c91a=_0xa67e[_0xb66f7c];return _0x57c91a;};'use strict';var _=require(_0xea67('0x0'));var util=require('util');var moment=require(_0xea67('0x1'));var BPromise=require(_0xea67('0x2'));var rs=require(_0xea67('0x3'));var fs=require('fs');var Redis=require(_0xea67('0x4'));var db=require(_0xea67('0x5'))['db'];var utils=require(_0xea67('0x6'));var logger=require(_0xea67('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xea67('0x8'));var client=jayson['client'][_0xea67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aab27,_0x58659b,_0x464789){return new BPromise(function(_0xc00ac5,_0x548f4c){return client[_0xea67('0xa')](_0x1aab27,_0x464789)['then'](function(_0x323986){logger['info'](_0xea67('0xb'),_0x58659b,_0xea67('0xc'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x58659b,'request\x20sent',JSON['stringify'](_0x323986));if(_0x323986['error']){if(_0x323986[_0xea67('0xd')]['code']===0x1f4){logger[_0xea67('0xd')](_0xea67('0xb'),_0x58659b,_0x323986[_0xea67('0xd')]['message']);return _0x548f4c(_0x323986[_0xea67('0xd')]['message']);}logger[_0xea67('0xd')](_0xea67('0xb'),_0x58659b,_0x323986[_0xea67('0xd')][_0xea67('0xe')]);return _0xc00ac5(_0x323986[_0xea67('0xd')][_0xea67('0xe')]);}else{logger[_0xea67('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x58659b,_0xea67('0xc'));_0xc00ac5(_0x323986[_0xea67('0x10')][_0xea67('0xe')]);}})[_0xea67('0x11')](function(_0x4b482c){logger[_0xea67('0xd')](_0xea67('0xb'),_0x58659b,_0x4b482c);_0x548f4c(_0x4b482c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 063ed33..fd0b709 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 _0xe0e5=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x2145cd,_0x420798){var _0x11e828=function(_0x48ab1f){while(--_0x48ab1f){_0x2145cd['push'](_0x2145cd['shift']());}};_0x11e828(++_0x420798);}(_0xe0e5,0xf3));var _0x5e0e=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xe0e5[_0x545bed];return _0x16c79c;};'use strict';var multer=require(_0x5e0e('0x0'));var util=require(_0x5e0e('0x1'));var path=require(_0x5e0e('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e0e('0x3'));var router=express[_0x5e0e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5e0e('0x5'));var interaction=require(_0x5e0e('0x6'));var config=require('../../config/environment');var controller=require(_0x5e0e('0x7'));router[_0x5e0e('0x8')]('/',auth['isAuthenticated'](),controller[_0x5e0e('0x9')]);router[_0x5e0e('0x8')](_0x5e0e('0xa'),auth[_0x5e0e('0xb')](),controller[_0x5e0e('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5e0e('0xd')]);router[_0x5e0e('0x8')](_0x5e0e('0xe'),auth[_0x5e0e('0xb')](),controller[_0x5e0e('0xf')]);router[_0x5e0e('0x10')]('/',auth[_0x5e0e('0xb')](),controller[_0x5e0e('0x11')]);router[_0x5e0e('0x10')]('/:id/configurations',auth[_0x5e0e('0xb')](),controller[_0x5e0e('0x12')]);router[_0x5e0e('0x13')](_0x5e0e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5e0e('0x14')](_0x5e0e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5e0e('0x15')]=router; \ No newline at end of file +var _0xc6f6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0xc6f6,0x1bf));var _0x6c6f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6f6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6c6f('0x0'));var util=require(_0x6c6f('0x1'));var path=require(_0x6c6f('0x2'));var timeout=require(_0x6c6f('0x3'));var express=require(_0x6c6f('0x4'));var router=express[_0x6c6f('0x5')]();var fs_extra=require(_0x6c6f('0x6'));var auth=require(_0x6c6f('0x7'));var interaction=require(_0x6c6f('0x8'));var config=require(_0x6c6f('0x9'));var controller=require(_0x6c6f('0xa'));router['get']('/',auth[_0x6c6f('0xb')](),controller['index']);router[_0x6c6f('0xc')]('/:id',auth[_0x6c6f('0xb')](),controller[_0x6c6f('0xd')]);router['get'](_0x6c6f('0xe'),auth[_0x6c6f('0xb')](),controller[_0x6c6f('0xf')]);router[_0x6c6f('0xc')](_0x6c6f('0x10'),auth[_0x6c6f('0xb')](),controller[_0x6c6f('0x11')]);router[_0x6c6f('0x12')]('/',auth[_0x6c6f('0xb')](),controller['create']);router[_0x6c6f('0x12')](_0x6c6f('0xe'),auth[_0x6c6f('0xb')](),controller[_0x6c6f('0x13')]);router[_0x6c6f('0x14')](_0x6c6f('0x15'),auth[_0x6c6f('0xb')](),controller[_0x6c6f('0x16')]);router['delete'](_0x6c6f('0x15'),auth[_0x6c6f('0xb')](),controller[_0x6c6f('0x17')]);module[_0x6c6f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c108dc5..3475988 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 _0xf61e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x61b748,_0xf1798b){var _0x523279=function(_0x26f36e){while(--_0x26f36e){_0x61b748['push'](_0x61b748['shift']());}};_0x523279(++_0xf1798b);}(_0xf61e,0x191));var _0xef61=function(_0x45b8be,_0x30a855){_0x45b8be=_0x45b8be-0x0;var _0x164425=_0xf61e[_0x45b8be];return _0x164425;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'name':{'type':Sequelize[_0xef61('0x2')]},'description':{'type':Sequelize[_0xef61('0x2')]},'username':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x3')},'apiKey':{'type':Sequelize[_0xef61('0x2')]},'remoteUri':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x4')},'serverUrl':{'type':Sequelize[_0xef61('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x77e6=['STRING','username','sequelize','exports'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x77e6,0x1a6));var _0x677e=function(_0x4bd9b9,_0x1bb2e3){_0x4bd9b9=_0x4bd9b9-0x0;var _0x49af5c=_0x77e6[_0x4bd9b9];return _0x49af5c;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'name':{'type':Sequelize[_0x677e('0x2')]},'description':{'type':Sequelize[_0x677e('0x2')]},'username':{'type':Sequelize[_0x677e('0x2')],'unique':_0x677e('0x3')},'apiKey':{'type':Sequelize[_0x677e('0x2')]},'remoteUri':{'type':Sequelize[_0x677e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x677e('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 f1eac18..acaafea 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 _0x6d4a=['FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','base64','requester','agent','priority','source','ticket_type','group','company','includes','default','custom_text','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','create','body','getConfigurations','findOne'];(function(_0x16954a,_0x1a0278){var _0x1d4cb4=function(_0x32f2be){while(--_0x32f2be){_0x16954a['push'](_0x16954a['shift']());}};_0x1d4cb4(++_0x1a0278);}(_0x6d4a,0x117));var _0xa6d4=function(_0x38c7d9,_0xaa56ee){_0x38c7d9=_0x38c7d9-0x0;var _0x241419=_0x6d4a[_0x38c7d9];return _0x241419;};'use strict';var emlformat=require(_0xa6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6d4('0x1'));var jsonpatch=require(_0xa6d4('0x2'));var rp=require(_0xa6d4('0x3'));var moment=require(_0xa6d4('0x4'));var BPromise=require(_0xa6d4('0x5'));var Mustache=require(_0xa6d4('0x6'));var util=require(_0xa6d4('0x7'));var path=require(_0xa6d4('0x8'));var sox=require(_0xa6d4('0x9'));var csv=require(_0xa6d4('0xa'));var ejs=require(_0xa6d4('0xb'));var fs=require('fs');var fs_extra=require(_0xa6d4('0xc'));var _=require(_0xa6d4('0xd'));var squel=require(_0xa6d4('0xe'));var crypto=require('crypto');var jsforce=require(_0xa6d4('0xf'));var deskjs=require(_0xa6d4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa6d4('0x11'));var Papa=require(_0xa6d4('0x12'));var Redis=require(_0xa6d4('0x13'));var authService=require(_0xa6d4('0x14'));var qs=require(_0xa6d4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6d4('0x16'));var logger=require(_0xa6d4('0x17'))('api');var utils=require(_0xa6d4('0x18'));var config=require(_0xa6d4('0x19'));var licenseUtil=require(_0xa6d4('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa6d4('0x1b'));function respondWithStatusCode(_0x53b1c1,_0x23830f){_0x23830f=_0x23830f||0xcc;return function(_0x13665d){if(_0x13665d){return _0x53b1c1['sendStatus'](_0x23830f);}return _0x53b1c1[_0xa6d4('0x1c')](_0x23830f)[_0xa6d4('0x1d')]();};}function respondWithResult(_0x3a0d34,_0x9631de){_0x9631de=_0x9631de||0xc8;return function(_0x427f4c){if(_0x427f4c){return _0x3a0d34[_0xa6d4('0x1c')](_0x9631de)[_0xa6d4('0x1e')](_0x427f4c);}};}function respondWithFilteredResult(_0x3e714f,_0x7420d8){return function(_0x17a926){if(_0x17a926){var _0x1b9969=typeof _0x7420d8[_0xa6d4('0x1f')]==='undefined'&&typeof _0x7420d8[_0xa6d4('0x20')]==='undefined';var _0x209091=_0x17a926[_0xa6d4('0x21')];var _0x4533ea=_0x1b9969?0x0:_0x7420d8['offset'];var _0x12226a=_0x1b9969?_0x17a926[_0xa6d4('0x21')]:_0x7420d8['offset']+_0x7420d8[_0xa6d4('0x20')];var _0x1e31df;if(_0x12226a>=_0x209091){_0x12226a=_0x209091;_0x1e31df=0xc8;}else{_0x1e31df=0xce;}_0x3e714f[_0xa6d4('0x1c')](_0x1e31df);return _0x3e714f[_0xa6d4('0x22')](_0xa6d4('0x23'),_0x4533ea+'-'+_0x12226a+'/'+_0x209091)['json'](_0x17a926);}return null;};}function patchUpdates(_0x3e0ae2){return function(_0x302292){try{jsonpatch[_0xa6d4('0x24')](_0x302292,_0x3e0ae2,!![]);}catch(_0x545fb1){return BPromise['reject'](_0x545fb1);}return _0x302292[_0xa6d4('0x25')]();};}function saveUpdates(_0x32bea3,_0x46d32f){return function(_0x63886a){if(_0x63886a){return _0x63886a[_0xa6d4('0x26')](_0x32bea3)[_0xa6d4('0x27')](function(_0x4a744e){return _0x4a744e;});}return null;};}function removeEntity(_0x1bf8cb,_0xd4a69e){return function(_0xfa4806){if(_0xfa4806){return _0xfa4806[_0xa6d4('0x28')]()[_0xa6d4('0x27')](function(){_0x1bf8cb[_0xa6d4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3ed8,_0x5589c5){return function(_0x1fec86){if(!_0x1fec86){_0x3a3ed8['sendStatus'](0x194);}return _0x1fec86;};}function handleError(_0x272759,_0xf2f536){_0xf2f536=_0xf2f536||0x1f4;return function(_0x21c658){logger['error'](_0x21c658[_0xa6d4('0x29')]);if(_0x21c658[_0xa6d4('0x2a')]){delete _0x21c658['name'];}_0x272759[_0xa6d4('0x1c')](_0xf2f536)[_0xa6d4('0x2b')](_0x21c658);};}exports['index']=function(_0x581bae,_0x44b967){var _0x378bf6={},_0x1da3e2={},_0x552065={'count':0x0,'rows':[]};var _0x43cfba=_[_0xa6d4('0x2c')](db[_0xa6d4('0x2d')][_0xa6d4('0x2e')],function(_0x59cff9){return{'name':_0x59cff9['fieldName'],'type':_0x59cff9['type'][_0xa6d4('0x2f')]};});_0x1da3e2[_0xa6d4('0x30')]=_[_0xa6d4('0x2c')](_0x43cfba,_0xa6d4('0x2a'));_0x1da3e2[_0xa6d4('0x31')]=_[_0xa6d4('0x32')](_0x581bae[_0xa6d4('0x31')]);_0x1da3e2['filters']=_['intersection'](_0x1da3e2[_0xa6d4('0x30')],_0x1da3e2[_0xa6d4('0x31')]);_0x378bf6[_0xa6d4('0x33')]=_[_0xa6d4('0x34')](_0x1da3e2[_0xa6d4('0x30')],qs[_0xa6d4('0x35')](_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x35')]));_0x378bf6[_0xa6d4('0x33')]=_0x378bf6['attributes'][_0xa6d4('0x36')]?_0x378bf6['attributes']:_0x1da3e2[_0xa6d4('0x30')];if(!_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x37')](_0xa6d4('0x38'))){_0x378bf6[_0xa6d4('0x20')]=qs[_0xa6d4('0x20')](_0x581bae[_0xa6d4('0x31')]['limit']);_0x378bf6['offset']=qs[_0xa6d4('0x1f')](_0x581bae[_0xa6d4('0x31')]['offset']);}_0x378bf6[_0xa6d4('0x39')]=qs['sort'](_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x3a')]);_0x378bf6['where']=qs['filters'](_[_0xa6d4('0x3b')](_0x581bae[_0xa6d4('0x31')],_0x1da3e2['filters']),_0x43cfba);if(_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x3c')]){_0x378bf6[_0xa6d4('0x3d')]=_[_0xa6d4('0x3e')](_0x378bf6[_0xa6d4('0x3d')],{'$or':_[_0xa6d4('0x2c')](_0x43cfba,function(_0x3cde60){if(_0x3cde60['type']!==_0xa6d4('0x3f')){var _0x17793d={};_0x17793d[_0x3cde60['name']]={'$like':'%'+_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x3c')]+'%'};return _0x17793d;}})});}_0x378bf6=_['merge']({},_0x378bf6,_0x581bae[_0xa6d4('0x40')]);var _0x5480ea={'where':_0x378bf6['where']};return db[_0xa6d4('0x2d')][_0xa6d4('0x21')](_0x5480ea)[_0xa6d4('0x27')](function(_0x1ee3ce){_0x552065[_0xa6d4('0x21')]=_0x1ee3ce;if(_0x581bae[_0xa6d4('0x31')][_0xa6d4('0x41')]){_0x378bf6[_0xa6d4('0x42')]=[{'all':!![]}];}return db[_0xa6d4('0x2d')][_0xa6d4('0x43')](_0x378bf6);})['then'](function(_0x5c2eb9){_0x552065[_0xa6d4('0x44')]=_0x5c2eb9;return _0x552065;})['then'](respondWithFilteredResult(_0x44b967,_0x378bf6))[_0xa6d4('0x45')](handleError(_0x44b967,null));};exports[_0xa6d4('0x46')]=function(_0x5de6cd,_0xfeab4d){var _0x4938ed={'raw':![],'where':{'id':_0x5de6cd[_0xa6d4('0x47')]['id']}},_0x4f4b10={};_0x4f4b10[_0xa6d4('0x30')]=_[_0xa6d4('0x32')](db[_0xa6d4('0x2d')]['rawAttributes']);_0x4f4b10['query']=_[_0xa6d4('0x32')](_0x5de6cd['query']);_0x4f4b10[_0xa6d4('0x48')]=_[_0xa6d4('0x34')](_0x4f4b10[_0xa6d4('0x30')],_0x4f4b10[_0xa6d4('0x31')]);_0x4938ed[_0xa6d4('0x33')]=_[_0xa6d4('0x34')](_0x4f4b10[_0xa6d4('0x30')],qs[_0xa6d4('0x35')](_0x5de6cd[_0xa6d4('0x31')][_0xa6d4('0x35')]));_0x4938ed[_0xa6d4('0x33')]=_0x4938ed['attributes'][_0xa6d4('0x36')]?_0x4938ed['attributes']:_0x4f4b10[_0xa6d4('0x30')];if(_0x5de6cd[_0xa6d4('0x31')][_0xa6d4('0x41')]){_0x4938ed['include']=[{'all':!![]}];}_0x4938ed=_[_0xa6d4('0x3e')]({},_0x4938ed,_0x5de6cd[_0xa6d4('0x40')]);return db['FreshdeskAccount'][_0xa6d4('0x49')](_0x4938ed)[_0xa6d4('0x27')](handleEntityNotFound(_0xfeab4d,null))[_0xa6d4('0x27')](respondWithResult(_0xfeab4d,null))[_0xa6d4('0x45')](handleError(_0xfeab4d,null));};exports[_0xa6d4('0x4a')]=function(_0x2b18dc,_0x3c1567){return db[_0xa6d4('0x2d')][_0xa6d4('0x4a')](_0x2b18dc[_0xa6d4('0x4b')],{})[_0xa6d4('0x27')](respondWithResult(_0x3c1567,0xc9))[_0xa6d4('0x45')](handleError(_0x3c1567,null));};exports[_0xa6d4('0x26')]=function(_0x3043cc,_0x20e1e7){if(_0x3043cc[_0xa6d4('0x4b')]['id']){delete _0x3043cc[_0xa6d4('0x4b')]['id'];}return db['FreshdeskAccount'][_0xa6d4('0x49')]({'where':{'id':_0x3043cc[_0xa6d4('0x47')]['id']}})[_0xa6d4('0x27')](handleEntityNotFound(_0x20e1e7,null))[_0xa6d4('0x27')](saveUpdates(_0x3043cc[_0xa6d4('0x4b')],null))['then'](respondWithResult(_0x20e1e7,null))[_0xa6d4('0x45')](handleError(_0x20e1e7,null));};exports[_0xa6d4('0x28')]=function(_0x1e586a,_0xea08e0){return db[_0xa6d4('0x2d')][_0xa6d4('0x49')]({'where':{'id':_0x1e586a['params']['id']}})['then'](handleEntityNotFound(_0xea08e0,null))[_0xa6d4('0x27')](removeEntity(_0xea08e0,null))[_0xa6d4('0x45')](handleError(_0xea08e0,null));};exports[_0xa6d4('0x4c')]=function(_0x12a240,_0xb32887,_0x241df1){var _0x3b2fd7={};var _0x3e0aae={};var _0x53d954;var _0x2227a4;return db[_0xa6d4('0x2d')][_0xa6d4('0x4d')]({'where':{'id':_0x12a240['params']['id']}})['then'](handleEntityNotFound(_0xb32887,null))[_0xa6d4('0x27')](function(_0x2865b6){if(_0x2865b6){_0x53d954=_0x2865b6;_0x3e0aae['model']=_[_0xa6d4('0x32')](db[_0xa6d4('0x4e')][_0xa6d4('0x2e')]);_0x3e0aae['query']=_[_0xa6d4('0x32')](_0x12a240[_0xa6d4('0x31')]);_0x3e0aae[_0xa6d4('0x48')]=_[_0xa6d4('0x34')](_0x3e0aae[_0xa6d4('0x30')],_0x3e0aae['query']);_0x3b2fd7[_0xa6d4('0x33')]=_[_0xa6d4('0x34')](_0x3e0aae[_0xa6d4('0x30')],qs[_0xa6d4('0x35')](_0x12a240['query'][_0xa6d4('0x35')]));_0x3b2fd7['attributes']=_0x3b2fd7['attributes'][_0xa6d4('0x36')]?_0x3b2fd7['attributes']:_0x3e0aae[_0xa6d4('0x30')];_0x3b2fd7[_0xa6d4('0x39')]=qs[_0xa6d4('0x3a')](_0x12a240[_0xa6d4('0x31')][_0xa6d4('0x3a')]);_0x3b2fd7[_0xa6d4('0x3d')]=qs[_0xa6d4('0x48')](_[_0xa6d4('0x3b')](_0x12a240[_0xa6d4('0x31')],_0x3e0aae['filters']));if(_0x12a240['query'][_0xa6d4('0x3c')]){_0x3b2fd7[_0xa6d4('0x3d')]=_[_0xa6d4('0x3e')](_0x3b2fd7['where'],{'$or':_[_0xa6d4('0x2c')](_0x3b2fd7[_0xa6d4('0x33')],function(_0x269c0e){var _0x11ca8f={};_0x11ca8f[_0x269c0e]={'$like':'%'+_0x12a240[_0xa6d4('0x31')][_0xa6d4('0x3c')]+'%'};return _0x11ca8f;})});}_0x3b2fd7=_[_0xa6d4('0x3e')]({},_0x3b2fd7,_0x12a240[_0xa6d4('0x40')]);return _0x53d954[_0xa6d4('0x4c')](_0x3b2fd7);}})[_0xa6d4('0x27')](function(_0x191a1c){if(_0x191a1c){_0x2227a4=_0x191a1c[_0xa6d4('0x36')];if(!_0x12a240[_0xa6d4('0x31')]['hasOwnProperty'](_0xa6d4('0x38'))){_0x3b2fd7[_0xa6d4('0x20')]=qs[_0xa6d4('0x20')](_0x12a240[_0xa6d4('0x31')][_0xa6d4('0x20')]);_0x3b2fd7[_0xa6d4('0x1f')]=qs[_0xa6d4('0x1f')](_0x12a240['query'][_0xa6d4('0x1f')]);}return _0x53d954[_0xa6d4('0x4c')](_0x3b2fd7);}})[_0xa6d4('0x27')](function(_0x48beff){if(_0x48beff){return _0x48beff?{'count':_0x2227a4,'rows':_0x48beff}:null;}})[_0xa6d4('0x27')](respondWithResult(_0xb32887,null))[_0xa6d4('0x45')](handleError(_0xb32887,null));};exports[_0xa6d4('0x4f')]=function(_0x526273,_0x1726f0,_0x5783dd){if(_0x526273['body']['id']){delete _0x526273[_0xa6d4('0x4b')]['id'];}return db[_0xa6d4('0x2d')][_0xa6d4('0x4d')]({'where':{'id':_0x526273[_0xa6d4('0x47')]['id']}})[_0xa6d4('0x27')](handleEntityNotFound(_0x1726f0,null))[_0xa6d4('0x27')](function(_0x292499){if(_0x292499){_0x526273['body']['AccountId']=_0x292499['id'];_0x526273[_0xa6d4('0x4b')][_0xa6d4('0x50')]=integrations[_0xa6d4('0x51')](_0x526273[_0xa6d4('0x4b')][_0xa6d4('0x52')],_0x526273['body'][_0xa6d4('0x53')]);_0x526273['body'][_0xa6d4('0x54')]=integrations[_0xa6d4('0x55')](_0x526273['body'][_0xa6d4('0x52')],_0x526273[_0xa6d4('0x4b')][_0xa6d4('0x53')]);return db[_0xa6d4('0x4e')]['create'](_0x526273[_0xa6d4('0x4b')],{'include':[{'model':db[_0xa6d4('0x56')],'as':_0xa6d4('0x50')},{'model':db['FreshdeskField'],'as':_0xa6d4('0x54')}]});}return null;})['then'](respondWithResult(_0x1726f0,null))[_0xa6d4('0x45')](handleError(_0x1726f0,null));};exports[_0xa6d4('0x57')]=function(_0x26fdd1,_0xd62dac,_0x4aae4e){var _0x241e32='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x26fdd1['params']['id']},'attributes':['id','remoteUri',_0xa6d4('0x58')]})[_0xa6d4('0x27')](handleEntityNotFound(_0xd62dac,null))[_0xa6d4('0x27')](function(_0x20e67e){if(_0x20e67e){_0x241e32=_0x20e67e[_0xa6d4('0x59')];var _0x4bbf2c=_0x241e32[_0xa6d4('0x5a')](-0x1);if(_0x4bbf2c==='/'){_0x241e32=_0x241e32[_0xa6d4('0x5b')](0x0,_0x241e32[_0xa6d4('0x5c')](_0x4bbf2c));}return rp({'method':_0xa6d4('0x5d'),'uri':util['format'](_0xa6d4('0x5e'),_0x241e32,_0xa6d4('0x5f')),'headers':{'Authorization':util[_0xa6d4('0x60')](_0xa6d4('0x61'),new Buffer(util[_0xa6d4('0x60')](_0xa6d4('0x62'),_0x20e67e[_0xa6d4('0x58')]))['toString'](_0xa6d4('0x63')))},'json':!![]});}})['then'](function(_0x47ef3e){if(_0x47ef3e){var _0x20c9ee=[_0xa6d4('0x64'),'subject',_0xa6d4('0x65'),'description',_0xa6d4('0x1c'),_0xa6d4('0x66'),'group',_0xa6d4('0x67'),_0xa6d4('0x68'),_0xa6d4('0x69'),_0xa6d4('0x6a')];_['remove'](_0x47ef3e,function(_0x262219){return _0x20c9ee[_0xa6d4('0x6b')](_0x262219[_0xa6d4('0x2a')])||!_0x262219[_0xa6d4('0x6c')]&&_0x262219[_0xa6d4('0x53')]!==_0xa6d4('0x6d')&&_0x262219[_0xa6d4('0x53')]!=='custom_dropdown';});return{'count':_0x47ef3e[_0xa6d4('0x36')],'rows':_['map'](_0x47ef3e,function(_0x26d393){return{'id':_0x26d393['name'],'name':_0x26d393[_0xa6d4('0x6e')],'custom':!_0x26d393[_0xa6d4('0x6c')],'options':_0x26d393[_0xa6d4('0x6f')]?_['map'](_0x26d393[_0xa6d4('0x6f')],function(_0x2ff9cd){return{'name':_[_0xa6d4('0x70')](_0x2ff9cd),'value':_0x2ff9cd};}):[]};})};}})[_0xa6d4('0x27')](respondWithResult(_0xd62dac,null))[_0xa6d4('0x45')](function(_0x191ca0){var _0x51c27a=_0x26fdd1['query']['test']?0x1f4:_0x191ca0[_0xa6d4('0x71')]||0x1f4;logger[_0xa6d4('0x72')](_0xa6d4('0x73'),_0xa6d4('0x57'),_0x51c27a,JSON[_0xa6d4('0x74')](_0x191ca0));delete _0x191ca0['name'];if(_0x51c27a===0x191){_0x51c27a=0x190;}_0xd62dac[_0xa6d4('0x1c')](_0x51c27a)['send'](_0x26fdd1[_0xa6d4('0x31')][_0xa6d4('0x75')]?{'message':_0xa6d4('0x76'),'statusCode':_0x191ca0[_0xa6d4('0x71')]}:_0x191ca0);});}; \ No newline at end of file +var _0xb6b8=['../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','catch','includeAll','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','Subjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','format','toString','base64','requester','agent','priority','ticket_type','group','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x2e1856,_0x2a33b3){_0x2e1856=_0x2e1856-0x0;var _0x34443a=_0xb6b8[_0x2e1856];return _0x34443a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b6b('0x0'));var zipdir=require(_0x8b6b('0x1'));var jsonpatch=require(_0x8b6b('0x2'));var rp=require(_0x8b6b('0x3'));var moment=require(_0x8b6b('0x4'));var BPromise=require(_0x8b6b('0x5'));var Mustache=require('mustache');var util=require(_0x8b6b('0x6'));var path=require(_0x8b6b('0x7'));var sox=require(_0x8b6b('0x8'));var csv=require('to-csv');var ejs=require(_0x8b6b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8b6b('0xa'));var crypto=require(_0x8b6b('0xb'));var jsforce=require(_0x8b6b('0xc'));var deskjs=require(_0x8b6b('0xd'));var toCsv=require(_0x8b6b('0xe'));var querystring=require(_0x8b6b('0xf'));var Papa=require(_0x8b6b('0x10'));var Redis=require(_0x8b6b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b6b('0x12'));var logger=require(_0x8b6b('0x13'))(_0x8b6b('0x14'));var utils=require('../../config/utils');var config=require(_0x8b6b('0x15'));var licenseUtil=require(_0x8b6b('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8b6b('0x17'));function respondWithStatusCode(_0x577d97,_0x2674e3){_0x2674e3=_0x2674e3||0xcc;return function(_0x1fd37e){if(_0x1fd37e){return _0x577d97['sendStatus'](_0x2674e3);}return _0x577d97['status'](_0x2674e3)[_0x8b6b('0x18')]();};}function respondWithResult(_0x4ba205,_0x352c14){_0x352c14=_0x352c14||0xc8;return function(_0x6f37f7){if(_0x6f37f7){return _0x4ba205[_0x8b6b('0x19')](_0x352c14)[_0x8b6b('0x1a')](_0x6f37f7);}};}function respondWithFilteredResult(_0x25f8a2,_0x532da5){return function(_0x3ffecc){if(_0x3ffecc){var _0x28260a=typeof _0x532da5[_0x8b6b('0x1b')]===_0x8b6b('0x1c')&&typeof _0x532da5[_0x8b6b('0x1d')]===_0x8b6b('0x1c');var _0x19bae5=_0x3ffecc['count'];var _0x3d15d1=_0x28260a?0x0:_0x532da5[_0x8b6b('0x1b')];var _0x11e588=_0x28260a?_0x3ffecc[_0x8b6b('0x1e')]:_0x532da5['offset']+_0x532da5[_0x8b6b('0x1d')];var _0x38fffe;if(_0x11e588>=_0x19bae5){_0x11e588=_0x19bae5;_0x38fffe=0xc8;}else{_0x38fffe=0xce;}_0x25f8a2['status'](_0x38fffe);return _0x25f8a2['set'](_0x8b6b('0x1f'),_0x3d15d1+'-'+_0x11e588+'/'+_0x19bae5)[_0x8b6b('0x1a')](_0x3ffecc);}return null;};}function patchUpdates(_0x3ef39b){return function(_0x4d3a29){try{jsonpatch[_0x8b6b('0x20')](_0x4d3a29,_0x3ef39b,!![]);}catch(_0x31e516){return BPromise[_0x8b6b('0x21')](_0x31e516);}return _0x4d3a29['save']();};}function saveUpdates(_0x2c10b9,_0x153bc0){return function(_0x4421e5){if(_0x4421e5){return _0x4421e5['update'](_0x2c10b9)['then'](function(_0x24221b){return _0x24221b;});}return null;};}function removeEntity(_0x47df9e,_0x370318){return function(_0x53ee8e){if(_0x53ee8e){return _0x53ee8e[_0x8b6b('0x22')]()[_0x8b6b('0x23')](function(){_0x47df9e[_0x8b6b('0x19')](0xcc)[_0x8b6b('0x18')]();});}};}function handleEntityNotFound(_0x36f10a,_0x5ab9df){return function(_0x5070c7){if(!_0x5070c7){_0x36f10a[_0x8b6b('0x24')](0x194);}return _0x5070c7;};}function handleError(_0x3a2621,_0x434631){_0x434631=_0x434631||0x1f4;return function(_0x1d20b6){logger[_0x8b6b('0x25')](_0x1d20b6[_0x8b6b('0x26')]);if(_0x1d20b6['name']){delete _0x1d20b6['name'];}_0x3a2621[_0x8b6b('0x19')](_0x434631)[_0x8b6b('0x27')](_0x1d20b6);};}exports[_0x8b6b('0x28')]=function(_0x336281,_0x420933){var _0x157350={},_0x3270c7={},_0x3d9825={'count':0x0,'rows':[]};var _0x3b756d=_['map'](db[_0x8b6b('0x29')][_0x8b6b('0x2a')],function(_0x4b795d){return{'name':_0x4b795d[_0x8b6b('0x2b')],'type':_0x4b795d[_0x8b6b('0x2c')][_0x8b6b('0x2d')]};});_0x3270c7[_0x8b6b('0x2e')]=_['map'](_0x3b756d,_0x8b6b('0x2f'));_0x3270c7[_0x8b6b('0x30')]=_[_0x8b6b('0x31')](_0x336281[_0x8b6b('0x30')]);_0x3270c7[_0x8b6b('0x32')]=_[_0x8b6b('0x33')](_0x3270c7[_0x8b6b('0x2e')],_0x3270c7[_0x8b6b('0x30')]);_0x157350['attributes']=_[_0x8b6b('0x33')](_0x3270c7[_0x8b6b('0x2e')],qs[_0x8b6b('0x34')](_0x336281['query'][_0x8b6b('0x34')]));_0x157350[_0x8b6b('0x35')]=_0x157350[_0x8b6b('0x35')][_0x8b6b('0x36')]?_0x157350['attributes']:_0x3270c7[_0x8b6b('0x2e')];if(!_0x336281['query'][_0x8b6b('0x37')](_0x8b6b('0x38'))){_0x157350[_0x8b6b('0x1d')]=qs[_0x8b6b('0x1d')](_0x336281[_0x8b6b('0x30')][_0x8b6b('0x1d')]);_0x157350[_0x8b6b('0x1b')]=qs[_0x8b6b('0x1b')](_0x336281[_0x8b6b('0x30')][_0x8b6b('0x1b')]);}_0x157350[_0x8b6b('0x39')]=qs['sort'](_0x336281['query'][_0x8b6b('0x3a')]);_0x157350[_0x8b6b('0x3b')]=qs[_0x8b6b('0x32')](_['pick'](_0x336281[_0x8b6b('0x30')],_0x3270c7['filters']),_0x3b756d);if(_0x336281[_0x8b6b('0x30')][_0x8b6b('0x3c')]){_0x157350[_0x8b6b('0x3b')]=_[_0x8b6b('0x3d')](_0x157350['where'],{'$or':_[_0x8b6b('0x3e')](_0x3b756d,function(_0xd84dfc){if(_0xd84dfc[_0x8b6b('0x2c')]!==_0x8b6b('0x3f')){var _0x3726f8={};_0x3726f8[_0xd84dfc['name']]={'$like':'%'+_0x336281[_0x8b6b('0x30')][_0x8b6b('0x3c')]+'%'};return _0x3726f8;}})});}_0x157350=_[_0x8b6b('0x3d')]({},_0x157350,_0x336281[_0x8b6b('0x40')]);var _0x71afb4={'where':_0x157350['where']};return db[_0x8b6b('0x29')][_0x8b6b('0x1e')](_0x71afb4)['then'](function(_0x57727e){_0x3d9825['count']=_0x57727e;if(_0x336281[_0x8b6b('0x30')]['includeAll']){_0x157350[_0x8b6b('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x8b6b('0x42')](_0x157350);})[_0x8b6b('0x23')](function(_0x6892a0){_0x3d9825['rows']=_0x6892a0;return _0x3d9825;})[_0x8b6b('0x23')](respondWithFilteredResult(_0x420933,_0x157350))[_0x8b6b('0x43')](handleError(_0x420933,null));};exports['show']=function(_0x48cda8,_0x491794){var _0x3e3b99={'raw':![],'where':{'id':_0x48cda8['params']['id']}},_0x14dd49={};_0x14dd49[_0x8b6b('0x2e')]=_[_0x8b6b('0x31')](db[_0x8b6b('0x29')][_0x8b6b('0x2a')]);_0x14dd49[_0x8b6b('0x30')]=_['keys'](_0x48cda8[_0x8b6b('0x30')]);_0x14dd49['filters']=_[_0x8b6b('0x33')](_0x14dd49[_0x8b6b('0x2e')],_0x14dd49[_0x8b6b('0x30')]);_0x3e3b99[_0x8b6b('0x35')]=_[_0x8b6b('0x33')](_0x14dd49[_0x8b6b('0x2e')],qs[_0x8b6b('0x34')](_0x48cda8['query'][_0x8b6b('0x34')]));_0x3e3b99['attributes']=_0x3e3b99[_0x8b6b('0x35')][_0x8b6b('0x36')]?_0x3e3b99[_0x8b6b('0x35')]:_0x14dd49[_0x8b6b('0x2e')];if(_0x48cda8[_0x8b6b('0x30')][_0x8b6b('0x44')]){_0x3e3b99[_0x8b6b('0x41')]=[{'all':!![]}];}_0x3e3b99=_[_0x8b6b('0x3d')]({},_0x3e3b99,_0x48cda8[_0x8b6b('0x40')]);return db['FreshdeskAccount'][_0x8b6b('0x45')](_0x3e3b99)[_0x8b6b('0x23')](handleEntityNotFound(_0x491794,null))[_0x8b6b('0x23')](respondWithResult(_0x491794,null))[_0x8b6b('0x43')](handleError(_0x491794,null));};exports['create']=function(_0x38cb69,_0x16a911){return db[_0x8b6b('0x29')][_0x8b6b('0x46')](_0x38cb69['body'],{})[_0x8b6b('0x23')](respondWithResult(_0x16a911,0xc9))[_0x8b6b('0x43')](handleError(_0x16a911,null));};exports['update']=function(_0x4f4855,_0x5d97f2){if(_0x4f4855['body']['id']){delete _0x4f4855[_0x8b6b('0x47')]['id'];}return db[_0x8b6b('0x29')][_0x8b6b('0x45')]({'where':{'id':_0x4f4855['params']['id']}})[_0x8b6b('0x23')](handleEntityNotFound(_0x5d97f2,null))[_0x8b6b('0x23')](saveUpdates(_0x4f4855[_0x8b6b('0x47')],null))['then'](respondWithResult(_0x5d97f2,null))[_0x8b6b('0x43')](handleError(_0x5d97f2,null));};exports[_0x8b6b('0x22')]=function(_0x16bc04,_0x478ac2){return db[_0x8b6b('0x29')]['find']({'where':{'id':_0x16bc04[_0x8b6b('0x48')]['id']}})[_0x8b6b('0x23')](handleEntityNotFound(_0x478ac2,null))[_0x8b6b('0x23')](removeEntity(_0x478ac2,null))['catch'](handleError(_0x478ac2,null));};exports[_0x8b6b('0x49')]=function(_0x1b9de2,_0xf4bc23,_0x420f64){var _0x4f7fe4={};var _0x1b5c4f={};var _0x11f3b8;var _0x528a24;return db[_0x8b6b('0x29')][_0x8b6b('0x4a')]({'where':{'id':_0x1b9de2[_0x8b6b('0x48')]['id']}})[_0x8b6b('0x23')](handleEntityNotFound(_0xf4bc23,null))[_0x8b6b('0x23')](function(_0x4b492b){if(_0x4b492b){_0x11f3b8=_0x4b492b;_0x1b5c4f['model']=_['keys'](db[_0x8b6b('0x4b')]['rawAttributes']);_0x1b5c4f['query']=_[_0x8b6b('0x31')](_0x1b9de2[_0x8b6b('0x30')]);_0x1b5c4f[_0x8b6b('0x32')]=_[_0x8b6b('0x33')](_0x1b5c4f[_0x8b6b('0x2e')],_0x1b5c4f['query']);_0x4f7fe4[_0x8b6b('0x35')]=_[_0x8b6b('0x33')](_0x1b5c4f[_0x8b6b('0x2e')],qs[_0x8b6b('0x34')](_0x1b9de2[_0x8b6b('0x30')]['fields']));_0x4f7fe4['attributes']=_0x4f7fe4[_0x8b6b('0x35')][_0x8b6b('0x36')]?_0x4f7fe4[_0x8b6b('0x35')]:_0x1b5c4f[_0x8b6b('0x2e')];_0x4f7fe4[_0x8b6b('0x39')]=qs[_0x8b6b('0x3a')](_0x1b9de2[_0x8b6b('0x30')][_0x8b6b('0x3a')]);_0x4f7fe4[_0x8b6b('0x3b')]=qs['filters'](_['pick'](_0x1b9de2['query'],_0x1b5c4f[_0x8b6b('0x32')]));if(_0x1b9de2[_0x8b6b('0x30')][_0x8b6b('0x3c')]){_0x4f7fe4[_0x8b6b('0x3b')]=_[_0x8b6b('0x3d')](_0x4f7fe4[_0x8b6b('0x3b')],{'$or':_[_0x8b6b('0x3e')](_0x4f7fe4[_0x8b6b('0x35')],function(_0x5c2908){var _0x39ae0b={};_0x39ae0b[_0x5c2908]={'$like':'%'+_0x1b9de2['query']['filter']+'%'};return _0x39ae0b;})});}_0x4f7fe4=_[_0x8b6b('0x3d')]({},_0x4f7fe4,_0x1b9de2[_0x8b6b('0x40')]);return _0x11f3b8[_0x8b6b('0x49')](_0x4f7fe4);}})[_0x8b6b('0x23')](function(_0x70f5e8){if(_0x70f5e8){_0x528a24=_0x70f5e8[_0x8b6b('0x36')];if(!_0x1b9de2[_0x8b6b('0x30')][_0x8b6b('0x37')]('nolimit')){_0x4f7fe4[_0x8b6b('0x1d')]=qs[_0x8b6b('0x1d')](_0x1b9de2[_0x8b6b('0x30')][_0x8b6b('0x1d')]);_0x4f7fe4[_0x8b6b('0x1b')]=qs['offset'](_0x1b9de2[_0x8b6b('0x30')][_0x8b6b('0x1b')]);}return _0x11f3b8[_0x8b6b('0x49')](_0x4f7fe4);}})[_0x8b6b('0x23')](function(_0x94bd3d){if(_0x94bd3d){return _0x94bd3d?{'count':_0x528a24,'rows':_0x94bd3d}:null;}})[_0x8b6b('0x23')](respondWithResult(_0xf4bc23,null))[_0x8b6b('0x43')](handleError(_0xf4bc23,null));};exports['addConfiguration']=function(_0xf8aeac,_0x3d7a73,_0x80f6d1){if(_0xf8aeac['body']['id']){delete _0xf8aeac['body']['id'];}return db[_0x8b6b('0x29')]['findOne']({'where':{'id':_0xf8aeac[_0x8b6b('0x48')]['id']}})[_0x8b6b('0x23')](handleEntityNotFound(_0x3d7a73,null))[_0x8b6b('0x23')](function(_0x5ec610){if(_0x5ec610){_0xf8aeac['body']['AccountId']=_0x5ec610['id'];_0xf8aeac[_0x8b6b('0x47')][_0x8b6b('0x4c')]=integrations['getSubjects'](_0xf8aeac[_0x8b6b('0x47')]['channel'],_0xf8aeac[_0x8b6b('0x47')][_0x8b6b('0x2c')]);_0xf8aeac['body'][_0x8b6b('0x4d')]=integrations[_0x8b6b('0x4e')](_0xf8aeac['body']['channel'],_0xf8aeac['body'][_0x8b6b('0x2c')]);return db['FreshdeskConfiguration']['create'](_0xf8aeac[_0x8b6b('0x47')],{'include':[{'model':db[_0x8b6b('0x4f')],'as':_0x8b6b('0x4c')},{'model':db[_0x8b6b('0x4f')],'as':_0x8b6b('0x4d')}]});}return null;})['then'](respondWithResult(_0x3d7a73,null))[_0x8b6b('0x43')](handleError(_0x3d7a73,null));};exports[_0x8b6b('0x50')]=function(_0xb3187c,_0x414be0,_0x134de6){var _0x457ea4='';return db['FreshdeskAccount'][_0x8b6b('0x4a')]({'where':{'id':_0xb3187c['params']['id']},'attributes':['id',_0x8b6b('0x51'),_0x8b6b('0x52')]})[_0x8b6b('0x23')](handleEntityNotFound(_0x414be0,null))[_0x8b6b('0x23')](function(_0x562225){if(_0x562225){_0x457ea4=_0x562225[_0x8b6b('0x51')];var _0x4e7630=_0x457ea4[_0x8b6b('0x53')](-0x1);if(_0x4e7630==='/'){_0x457ea4=_0x457ea4[_0x8b6b('0x54')](0x0,_0x457ea4[_0x8b6b('0x55')](_0x4e7630));}return rp({'method':_0x8b6b('0x56'),'uri':util['format'](_0x8b6b('0x57'),_0x457ea4,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x8b6b('0x58')]('Basic\x20%s',new Buffer(util[_0x8b6b('0x58')]('%s:X',_0x562225[_0x8b6b('0x52')]))[_0x8b6b('0x59')](_0x8b6b('0x5a')))},'json':!![]});}})[_0x8b6b('0x23')](function(_0x18ca29){if(_0x18ca29){var _0x55356f=[_0x8b6b('0x5b'),'subject',_0x8b6b('0x5c'),'description','status',_0x8b6b('0x5d'),'group','source',_0x8b6b('0x5e'),_0x8b6b('0x5f'),'company'];_[_0x8b6b('0x60')](_0x18ca29,function(_0x1c94af){return _0x55356f[_0x8b6b('0x61')](_0x1c94af[_0x8b6b('0x2f')])||!_0x1c94af[_0x8b6b('0x62')]&&_0x1c94af[_0x8b6b('0x2c')]!==_0x8b6b('0x63')&&_0x1c94af[_0x8b6b('0x2c')]!=='custom_dropdown';});return{'count':_0x18ca29[_0x8b6b('0x36')],'rows':_[_0x8b6b('0x3e')](_0x18ca29,function(_0x4d13fc){return{'id':_0x4d13fc[_0x8b6b('0x2f')],'name':_0x4d13fc[_0x8b6b('0x64')],'custom':!_0x4d13fc[_0x8b6b('0x62')],'options':_0x4d13fc['choices']?_[_0x8b6b('0x3e')](_0x4d13fc[_0x8b6b('0x65')],function(_0x920335){return{'name':_[_0x8b6b('0x66')](_0x920335),'value':_0x920335};}):[]};})};}})[_0x8b6b('0x23')](respondWithResult(_0x414be0,null))[_0x8b6b('0x43')](function(_0x4aaba9){var _0x409e68=_0xb3187c['query'][_0x8b6b('0x67')]?0x1f4:_0x4aaba9[_0x8b6b('0x68')]||0x1f4;logger[_0x8b6b('0x25')](_0x8b6b('0x69'),'getFields',_0x409e68,JSON[_0x8b6b('0x6a')](_0x4aaba9));delete _0x4aaba9[_0x8b6b('0x2f')];if(_0x409e68===0x191){_0x409e68=0x190;}_0x414be0['status'](_0x409e68)['send'](_0xb3187c[_0x8b6b('0x30')][_0x8b6b('0x67')]?{'message':_0x8b6b('0x6b'),'statusCode':_0x4aaba9[_0x8b6b('0x68')]}:_0x4aaba9);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8f94963..799e14a 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 _0x99f9=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x99f9,0x72));var _0x999f=function(_0x3bcf97,_0x4632ac){_0x3bcf97=_0x3bcf97-0x0;var _0x1506ba=_0x99f9[_0x3bcf97];return _0x1506ba;};'use strict';var _=require('lodash');var util=require(_0x999f('0x0'));var logger=require(_0x999f('0x1'))(_0x999f('0x2'));var moment=require('moment');var BPromise=require(_0x999f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x999f('0x4'));var rimraf=require(_0x999f('0x5'));var config=require(_0x999f('0x6'));var attributes=require(_0x999f('0x7'));var integrations=require(_0x999f('0x8'));module[_0x999f('0x9')]=function(_0x16e30a,_0x20b29c){return _0x16e30a['define'](_0x999f('0xa'),attributes,{'tableName':_0x999f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ea1=['exports','define','int_freshdesk_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5ea1,0xd3));var _0x15ea=function(_0x5d19e2,_0x3602de){_0x5d19e2=_0x5d19e2-0x0;var _0x3ff8e3=_0x5ea1[_0x5d19e2];return _0x3ff8e3;};'use strict';var _=require(_0x15ea('0x0'));var util=require(_0x15ea('0x1'));var logger=require('../../config/logger')(_0x15ea('0x2'));var moment=require('moment');var BPromise=require(_0x15ea('0x3'));var rp=require(_0x15ea('0x4'));var fs=require('fs');var path=require(_0x15ea('0x5'));var rimraf=require(_0x15ea('0x6'));var config=require(_0x15ea('0x7'));var attributes=require(_0x15ea('0x8'));var integrations=require(_0x15ea('0x9'));module[_0x15ea('0xa')]=function(_0x2731ca,_0x300a25){return _0x2731ca[_0x15ea('0xb')]('FreshdeskAccount',attributes,{'tableName':_0x15ea('0xc'),'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 6967447..8edddf4 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 _0xdace=['catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xdace,0x9d));var _0xedac=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xdace[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require(_0xedac('0x4'));var db=require(_0xedac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require(_0xedac('0x8'));var jayson=require(_0xedac('0x9'));var client=jayson[_0xedac('0xa')][_0xedac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a13b0,_0x1135b8,_0x369ca9){return new BPromise(function(_0x247590,_0xa89012){return client[_0xedac('0xc')](_0x5a13b0,_0x369ca9)[_0xedac('0xd')](function(_0x37817e){logger[_0xedac('0xe')](_0xedac('0xf'),_0x1135b8,_0xedac('0x10'));logger[_0xedac('0x11')](_0xedac('0x12'),_0x1135b8,_0xedac('0x10'),JSON[_0xedac('0x13')](_0x37817e));if(_0x37817e[_0xedac('0x14')]){if(_0x37817e[_0xedac('0x14')][_0xedac('0x15')]===0x1f4){logger[_0xedac('0x14')](_0xedac('0xf'),_0x1135b8,_0x37817e[_0xedac('0x14')]['message']);return _0xa89012(_0x37817e[_0xedac('0x14')][_0xedac('0x16')]);}logger[_0xedac('0x14')](_0xedac('0xf'),_0x1135b8,_0x37817e['error'][_0xedac('0x16')]);return _0x247590(_0x37817e[_0xedac('0x14')]['message']);}else{logger[_0xedac('0xe')](_0xedac('0xf'),_0x1135b8,_0xedac('0x10'));_0x247590(_0x37817e['result'][_0xedac('0x16')]);}})[_0xedac('0x17')](function(_0x274892){logger['error'](_0xedac('0xf'),_0x1135b8,_0x274892);_0xa89012(_0x274892);});});}exports[_0xedac('0x18')]=function(_0x42ff86){var _0x46e55a=this;return new Promise(function(_0x3d76fd,_0x38253f){return db[_0xedac('0x19')]['findAll']({'raw':_0x42ff86['options']?_0x42ff86[_0xedac('0x1a')][_0xedac('0x1b')]===undefined?!![]:![]:!![],'where':_0x42ff86[_0xedac('0x1a')]?_0x42ff86['options'][_0xedac('0x1c')]||null:null,'attributes':_0x42ff86[_0xedac('0x1a')]?_0x42ff86[_0xedac('0x1a')][_0xedac('0x1d')]||null:null,'limit':_0x42ff86[_0xedac('0x1a')]?_0x42ff86[_0xedac('0x1a')][_0xedac('0x1e')]||null:null,'include':_0x42ff86['options']?_0x42ff86[_0xedac('0x1a')][_0xedac('0x1f')]?_[_0xedac('0x20')](_0x42ff86[_0xedac('0x1a')][_0xedac('0x1f')],function(_0x2ac427){return{'model':db[_0x2ac427[_0xedac('0x21')]],'as':_0x2ac427['as'],'attributes':_0x2ac427[_0xedac('0x1d')],'include':_0x2ac427[_0xedac('0x1f')]?_[_0xedac('0x20')](_0x2ac427['include'],function(_0x2611cc){return{'model':db[_0x2611cc['model']],'as':_0x2611cc['as'],'attributes':_0x2611cc[_0xedac('0x1d')],'include':_0x2611cc['include']?_[_0xedac('0x20')](_0x2611cc['include'],function(_0x5518c8){return{'model':db[_0x5518c8[_0xedac('0x21')]],'as':_0x5518c8['as'],'attributes':_0x5518c8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x557549){logger[_0xedac('0xe')](_0xedac('0x18'),_0x42ff86);logger[_0xedac('0x11')]('GetFreshdeskAccount',_0x42ff86,JSON['stringify'](_0x557549));_0x3d76fd(_0x557549);})[_0xedac('0x17')](function(_0x2cce76){logger[_0xedac('0x14')](_0xedac('0x18'),_0x2cce76[_0xedac('0x16')],_0x42ff86);_0x38253f(_0x46e55a[_0xedac('0x14')](0x1f4,_0x2cce76['message']));});});};exports[_0xedac('0x22')]=function(_0xbc28d0){var _0x5a6f5b=this;return new Promise(function(_0x267ce8,_0x54fa98){return db['FreshdeskAccount'][_0xedac('0x23')]({'raw':_0xbc28d0['options']?_0xbc28d0[_0xedac('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xbc28d0[_0xedac('0x1a')]?_0xbc28d0['options'][_0xedac('0x1c')]||null:null,'attributes':_0xbc28d0[_0xedac('0x1a')]?_0xbc28d0[_0xedac('0x1a')][_0xedac('0x1d')]||null:null,'include':_0xbc28d0[_0xedac('0x1a')]?_0xbc28d0[_0xedac('0x1a')][_0xedac('0x1f')]?_[_0xedac('0x20')](_0xbc28d0[_0xedac('0x1a')][_0xedac('0x1f')],function(_0x510e7a){return{'model':db[_0x510e7a[_0xedac('0x21')]],'as':_0x510e7a['as'],'attributes':_0x510e7a[_0xedac('0x1d')],'include':_0x510e7a[_0xedac('0x1f')]?_['map'](_0x510e7a[_0xedac('0x1f')],function(_0x260bdb){return{'model':db[_0x260bdb['model']],'as':_0x260bdb['as'],'attributes':_0x260bdb[_0xedac('0x1d')],'include':_0x260bdb['include']?_['map'](_0x260bdb[_0xedac('0x1f')],function(_0x17ed34){return{'model':db[_0x17ed34[_0xedac('0x21')]],'as':_0x17ed34['as'],'attributes':_0x17ed34[_0xedac('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5548f9){logger[_0xedac('0xe')](_0xedac('0x22'),_0xbc28d0);logger[_0xedac('0x11')](_0xedac('0x22'),_0xbc28d0,JSON[_0xedac('0x13')](_0x5548f9));_0x267ce8(_0x5548f9);})[_0xedac('0x17')](function(_0x25a1b8){logger[_0xedac('0x14')](_0xedac('0x22'),_0x25a1b8[_0xedac('0x16')],_0xbc28d0);_0x54fa98(_0x5a6f5b[_0xedac('0x14')](0x1f4,_0x25a1b8[_0xedac('0x16')]));});});}; \ No newline at end of file +var _0x90c8=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','find','ShowFreshdeskAccount','lodash','util','moment'];(function(_0x591aad,_0x56227c){var _0x377bd1=function(_0x4aec2){while(--_0x4aec2){_0x591aad['push'](_0x591aad['shift']());}};_0x377bd1(++_0x56227c);}(_0x90c8,0x1eb));var _0x890c=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x90c8[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x890c('0x0'));var util=require(_0x890c('0x1'));var moment=require(_0x890c('0x2'));var BPromise=require(_0x890c('0x3'));var rs=require(_0x890c('0x4'));var fs=require('fs');var Redis=require(_0x890c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x890c('0x6'));var logger=require(_0x890c('0x7'))(_0x890c('0x8'));var config=require(_0x890c('0x9'));var jayson=require(_0x890c('0xa'));var client=jayson[_0x890c('0xb')][_0x890c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x207c2f,_0x3530c9,_0x8c682a){return new BPromise(function(_0x3ba753,_0x3b9451){return client[_0x890c('0xd')](_0x207c2f,_0x8c682a)[_0x890c('0xe')](function(_0x2448a6){logger[_0x890c('0xf')](_0x890c('0x10'),_0x3530c9,_0x890c('0x11'));logger[_0x890c('0x12')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3530c9,_0x890c('0x11'),JSON[_0x890c('0x13')](_0x2448a6));if(_0x2448a6[_0x890c('0x14')]){if(_0x2448a6[_0x890c('0x14')][_0x890c('0x15')]===0x1f4){logger[_0x890c('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x3530c9,_0x2448a6[_0x890c('0x14')][_0x890c('0x16')]);return _0x3b9451(_0x2448a6[_0x890c('0x14')][_0x890c('0x16')]);}logger[_0x890c('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x3530c9,_0x2448a6[_0x890c('0x14')]['message']);return _0x3ba753(_0x2448a6[_0x890c('0x14')][_0x890c('0x16')]);}else{logger[_0x890c('0xf')](_0x890c('0x10'),_0x3530c9,_0x890c('0x11'));_0x3ba753(_0x2448a6[_0x890c('0x17')][_0x890c('0x16')]);}})[_0x890c('0x18')](function(_0x56c557){logger[_0x890c('0x14')](_0x890c('0x10'),_0x3530c9,_0x56c557);_0x3b9451(_0x56c557);});});}exports['GetFreshdeskAccount']=function(_0x33af51){var _0x34808f=this;return new Promise(function(_0x426aea,_0x3dadbe){return db[_0x890c('0x19')][_0x890c('0x1a')]({'raw':_0x33af51[_0x890c('0x1b')]?_0x33af51[_0x890c('0x1b')][_0x890c('0x1c')]===undefined?!![]:![]:!![],'where':_0x33af51[_0x890c('0x1b')]?_0x33af51[_0x890c('0x1b')][_0x890c('0x1d')]||null:null,'attributes':_0x33af51[_0x890c('0x1b')]?_0x33af51[_0x890c('0x1b')][_0x890c('0x1e')]||null:null,'limit':_0x33af51['options']?_0x33af51[_0x890c('0x1b')][_0x890c('0x1f')]||null:null,'include':_0x33af51[_0x890c('0x1b')]?_0x33af51[_0x890c('0x1b')][_0x890c('0x20')]?_[_0x890c('0x21')](_0x33af51[_0x890c('0x1b')][_0x890c('0x20')],function(_0x1069c4){return{'model':db[_0x1069c4[_0x890c('0x22')]],'as':_0x1069c4['as'],'attributes':_0x1069c4[_0x890c('0x1e')],'include':_0x1069c4[_0x890c('0x20')]?_[_0x890c('0x21')](_0x1069c4[_0x890c('0x20')],function(_0x1003bc){return{'model':db[_0x1003bc[_0x890c('0x22')]],'as':_0x1003bc['as'],'attributes':_0x1003bc[_0x890c('0x1e')],'include':_0x1003bc[_0x890c('0x20')]?_[_0x890c('0x21')](_0x1003bc['include'],function(_0x1683fe){return{'model':db[_0x1683fe[_0x890c('0x22')]],'as':_0x1683fe['as'],'attributes':_0x1683fe[_0x890c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x890c('0xe')](function(_0x4bed0b){logger[_0x890c('0xf')](_0x890c('0x23'),_0x33af51);logger['debug'](_0x890c('0x23'),_0x33af51,JSON[_0x890c('0x13')](_0x4bed0b));_0x426aea(_0x4bed0b);})[_0x890c('0x18')](function(_0x46fa3b){logger[_0x890c('0x14')]('GetFreshdeskAccount',_0x46fa3b[_0x890c('0x16')],_0x33af51);_0x3dadbe(_0x34808f[_0x890c('0x14')](0x1f4,_0x46fa3b['message']));});});};exports['ShowFreshdeskAccount']=function(_0x1af1de){var _0xa262c4=this;return new Promise(function(_0x50d7b5,_0x485e8c){return db[_0x890c('0x19')][_0x890c('0x24')]({'raw':_0x1af1de[_0x890c('0x1b')]?_0x1af1de[_0x890c('0x1b')][_0x890c('0x1c')]===undefined?!![]:![]:!![],'where':_0x1af1de[_0x890c('0x1b')]?_0x1af1de[_0x890c('0x1b')]['where']||null:null,'attributes':_0x1af1de[_0x890c('0x1b')]?_0x1af1de[_0x890c('0x1b')][_0x890c('0x1e')]||null:null,'include':_0x1af1de[_0x890c('0x1b')]?_0x1af1de[_0x890c('0x1b')][_0x890c('0x20')]?_[_0x890c('0x21')](_0x1af1de[_0x890c('0x1b')][_0x890c('0x20')],function(_0x5bf9a0){return{'model':db[_0x5bf9a0[_0x890c('0x22')]],'as':_0x5bf9a0['as'],'attributes':_0x5bf9a0[_0x890c('0x1e')],'include':_0x5bf9a0[_0x890c('0x20')]?_[_0x890c('0x21')](_0x5bf9a0['include'],function(_0x1c21c1){return{'model':db[_0x1c21c1[_0x890c('0x22')]],'as':_0x1c21c1['as'],'attributes':_0x1c21c1[_0x890c('0x1e')],'include':_0x1c21c1['include']?_[_0x890c('0x21')](_0x1c21c1[_0x890c('0x20')],function(_0x3d907a){return{'model':db[_0x3d907a[_0x890c('0x22')]],'as':_0x3d907a['as'],'attributes':_0x3d907a[_0x890c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449ec3){logger[_0x890c('0xf')](_0x890c('0x25'),_0x1af1de);logger[_0x890c('0x12')](_0x890c('0x25'),_0x1af1de,JSON['stringify'](_0x449ec3));_0x50d7b5(_0x449ec3);})['catch'](function(_0x12f9a9){logger[_0x890c('0x14')](_0x890c('0x25'),_0x12f9a9[_0x890c('0x16')],_0x1af1de);_0x485e8c(_0xa262c4[_0x890c('0x14')](0x1f4,_0x12f9a9[_0x890c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 363111f..17f4663 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 _0x50e0=['post','create','setTags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','getDescriptions','/:id/tags','getTags'];(function(_0x194dd2,_0x47e0e5){var _0x254763=function(_0x28a562){while(--_0x28a562){_0x194dd2['push'](_0x194dd2['shift']());}};_0x254763(++_0x47e0e5);}(_0x50e0,0x13f));var _0x050e=function(_0xb126e5,_0x114cd9){_0xb126e5=_0xb126e5-0x0;var _0x24aa1c=_0x50e0[_0xb126e5];return _0x24aa1c;};'use strict';var multer=require(_0x050e('0x0'));var util=require(_0x050e('0x1'));var path=require(_0x050e('0x2'));var timeout=require(_0x050e('0x3'));var express=require(_0x050e('0x4'));var router=express[_0x050e('0x5')]();var fs_extra=require(_0x050e('0x6'));var auth=require(_0x050e('0x7'));var interaction=require(_0x050e('0x8'));var config=require(_0x050e('0x9'));var controller=require(_0x050e('0xa'));router[_0x050e('0xb')]('/',auth['isAuthenticated'](),controller[_0x050e('0xc')]);router[_0x050e('0xb')](_0x050e('0xd'),auth[_0x050e('0xe')](),controller['show']);router[_0x050e('0xb')]('/:id/fields',auth[_0x050e('0xe')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x050e('0xf')]);router[_0x050e('0xb')]('/:id/descriptions',auth[_0x050e('0xe')](),controller[_0x050e('0x10')]);router['get'](_0x050e('0x11'),auth[_0x050e('0xe')](),controller[_0x050e('0x12')]);router[_0x050e('0x13')]('/',auth[_0x050e('0xe')](),controller[_0x050e('0x14')]);router[_0x050e('0x13')](_0x050e('0x11'),auth[_0x050e('0xe')](),controller[_0x050e('0x15')]);router[_0x050e('0x16')](_0x050e('0xd'),auth[_0x050e('0xe')](),controller[_0x050e('0x17')]);router['delete'](_0x050e('0xd'),auth['isAuthenticated'](),controller[_0x050e('0x18')]);module[_0x050e('0x19')]=router; \ No newline at end of file +var _0xc764=['./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','setTags','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a536e,_0x50ebe7){var _0x1e86d4=function(_0x3970a4){while(--_0x3970a4){_0x1a536e['push'](_0x1a536e['shift']());}};_0x1e86d4(++_0x50ebe7);}(_0xc764,0x110));var _0x4c76=function(_0x26db15,_0x50daec){_0x26db15=_0x26db15-0x0;var _0x31f013=_0xc764[_0x26db15];return _0x31f013;};'use strict';var multer=require(_0x4c76('0x0'));var util=require(_0x4c76('0x1'));var path=require(_0x4c76('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c76('0x3'));var router=express[_0x4c76('0x4')]();var fs_extra=require(_0x4c76('0x5'));var auth=require(_0x4c76('0x6'));var interaction=require(_0x4c76('0x7'));var config=require('../../config/environment');var controller=require(_0x4c76('0x8'));router[_0x4c76('0x9')]('/',auth[_0x4c76('0xa')](),controller[_0x4c76('0xb')]);router[_0x4c76('0x9')](_0x4c76('0xc'),auth[_0x4c76('0xa')](),controller[_0x4c76('0xd')]);router[_0x4c76('0x9')](_0x4c76('0xe'),auth[_0x4c76('0xa')](),controller[_0x4c76('0xf')]);router['get'](_0x4c76('0x10'),auth[_0x4c76('0xa')](),controller[_0x4c76('0x11')]);router[_0x4c76('0x9')](_0x4c76('0x12'),auth['isAuthenticated'](),controller[_0x4c76('0x13')]);router[_0x4c76('0x9')](_0x4c76('0x14'),auth[_0x4c76('0xa')](),controller[_0x4c76('0x15')]);router['post']('/',auth[_0x4c76('0xa')](),controller[_0x4c76('0x16')]);router['post'](_0x4c76('0x14'),auth[_0x4c76('0xa')](),controller[_0x4c76('0x17')]);router[_0x4c76('0x18')](_0x4c76('0xc'),auth[_0x4c76('0xa')](),controller[_0x4c76('0x19')]);router[_0x4c76('0x1a')](_0x4c76('0xc'),auth[_0x4c76('0xa')](),controller['destroy']);module[_0x4c76('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b1bce91..bc72cac 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 _0x4a2f=['exports'];(function(_0x21d70f,_0x22d753){var _0x491e1f=function(_0x165615){while(--_0x165615){_0x21d70f['push'](_0x21d70f['shift']());}};_0x491e1f(++_0x22d753);}(_0x4a2f,0xb6));var _0xf4a2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4a2f[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0xf4a2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb73=['exports','STRING'];(function(_0x23a5b4,_0x26d8ae){var _0x13afe6=function(_0x48802f){while(--_0x48802f){_0x23a5b4['push'](_0x23a5b4['shift']());}};_0x13afe6(++_0x26d8ae);}(_0xdb73,0x154));var _0x3db7=function(_0x1c959f,_0x4a234b){_0x1c959f=_0x1c959f-0x0;var _0x50c0d5=_0xdb73[_0x1c959f];return _0x50c0d5;};'use strict';var Sequelize=require('sequelize');module[_0x3db7('0x0')]={'name':{'type':Sequelize[_0x3db7('0x1')]},'description':{'type':Sequelize[_0x3db7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e977b93..704120c 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 _0x016d=['apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','FreshdeskConfiguration','findAll','params','keys','create','body','catch','find','getFields','findOne','FreshdeskField','pick','filter','getSubjects','getDescriptions','Tag','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','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/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x2ad39d,_0x4168dc){var _0x29495f=function(_0x3d8b7f){while(--_0x3d8b7f){_0x2ad39d['push'](_0x2ad39d['shift']());}};_0x29495f(++_0x4168dc);}(_0x016d,0x1cf));var _0xd016=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x016d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd016('0x0'));var zipdir=require(_0xd016('0x1'));var jsonpatch=require(_0xd016('0x2'));var rp=require(_0xd016('0x3'));var moment=require(_0xd016('0x4'));var BPromise=require(_0xd016('0x5'));var Mustache=require(_0xd016('0x6'));var util=require(_0xd016('0x7'));var path=require(_0xd016('0x8'));var sox=require('sox');var csv=require(_0xd016('0x9'));var ejs=require(_0xd016('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd016('0xb'));var crypto=require(_0xd016('0xc'));var jsforce=require(_0xd016('0xd'));var deskjs=require(_0xd016('0xe'));var toCsv=require(_0xd016('0x9'));var querystring=require(_0xd016('0xf'));var Papa=require(_0xd016('0x10'));var Redis=require('ioredis');var authService=require(_0xd016('0x11'));var qs=require(_0xd016('0x12'));var as=require(_0xd016('0x13'));var hardwareService=require(_0xd016('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd016('0x15'));var config=require(_0xd016('0x16'));var licenseUtil=require(_0xd016('0x17'));var db=require(_0xd016('0x18'))['db'];function respondWithStatusCode(_0x24424f,_0x20e7a5){_0x20e7a5=_0x20e7a5||0xcc;return function(_0x1dd580){if(_0x1dd580){return _0x24424f[_0xd016('0x19')](_0x20e7a5);}return _0x24424f[_0xd016('0x1a')](_0x20e7a5)[_0xd016('0x1b')]();};}function respondWithResult(_0x376288,_0x265e62){_0x265e62=_0x265e62||0xc8;return function(_0x5887b3){if(_0x5887b3){return _0x376288[_0xd016('0x1a')](_0x265e62)[_0xd016('0x1c')](_0x5887b3);}};}function respondWithFilteredResult(_0x118329,_0x53c1bb){return function(_0x54c373){if(_0x54c373){var _0x55d75a=typeof _0x53c1bb[_0xd016('0x1d')]==='undefined'&&typeof _0x53c1bb['limit']===_0xd016('0x1e');var _0x50cf02=_0x54c373[_0xd016('0x1f')];var _0x3f9006=_0x55d75a?0x0:_0x53c1bb['offset'];var _0xa8d14f=_0x55d75a?_0x54c373['count']:_0x53c1bb[_0xd016('0x1d')]+_0x53c1bb[_0xd016('0x20')];var _0x5e818b;if(_0xa8d14f>=_0x50cf02){_0xa8d14f=_0x50cf02;_0x5e818b=0xc8;}else{_0x5e818b=0xce;}_0x118329[_0xd016('0x1a')](_0x5e818b);return _0x118329[_0xd016('0x21')](_0xd016('0x22'),_0x3f9006+'-'+_0xa8d14f+'/'+_0x50cf02)[_0xd016('0x1c')](_0x54c373);}return null;};}function patchUpdates(_0x2088bf){return function(_0x195dc4){try{jsonpatch[_0xd016('0x23')](_0x195dc4,_0x2088bf,!![]);}catch(_0x22397d){return BPromise[_0xd016('0x24')](_0x22397d);}return _0x195dc4[_0xd016('0x25')]();};}function saveUpdates(_0x188aa3,_0x245774){return function(_0x28299d){if(_0x28299d){return _0x28299d[_0xd016('0x26')](_0x188aa3)[_0xd016('0x27')](function(_0x34935c){return _0x34935c;});}return null;};}function removeEntity(_0x2d88bb,_0x140534){return function(_0x58e12b){if(_0x58e12b){return _0x58e12b['destroy']()['then'](function(){_0x2d88bb['status'](0xcc)[_0xd016('0x1b')]();});}};}function handleEntityNotFound(_0xa7c8ba,_0xcae99b){return function(_0x10a29a){if(!_0x10a29a){_0xa7c8ba['sendStatus'](0x194);}return _0x10a29a;};}function handleError(_0x2e6256,_0x46dfd5){_0x46dfd5=_0x46dfd5||0x1f4;return function(_0x259479){logger['error'](_0x259479[_0xd016('0x28')]);if(_0x259479[_0xd016('0x29')]){delete _0x259479['name'];}_0x2e6256[_0xd016('0x1a')](_0x46dfd5)[_0xd016('0x2a')](_0x259479);};}exports[_0xd016('0x2b')]=function(_0x322b43,_0xd546a2){var _0x48a610={},_0x2a59e3={},_0x516627={'count':0x0,'rows':[]};var _0x635c8a=_[_0xd016('0x2c')](db['FreshdeskConfiguration'][_0xd016('0x2d')],function(_0x400426){return{'name':_0x400426[_0xd016('0x2e')],'type':_0x400426[_0xd016('0x2f')][_0xd016('0x30')]};});_0x2a59e3[_0xd016('0x31')]=_[_0xd016('0x2c')](_0x635c8a,'name');_0x2a59e3[_0xd016('0x32')]=_['keys'](_0x322b43['query']);_0x2a59e3[_0xd016('0x33')]=_[_0xd016('0x34')](_0x2a59e3[_0xd016('0x31')],_0x2a59e3[_0xd016('0x32')]);_0x48a610[_0xd016('0x35')]=_[_0xd016('0x34')](_0x2a59e3[_0xd016('0x31')],qs['fields'](_0x322b43[_0xd016('0x32')][_0xd016('0x36')]));_0x48a610[_0xd016('0x35')]=_0x48a610[_0xd016('0x35')][_0xd016('0x37')]?_0x48a610[_0xd016('0x35')]:_0x2a59e3[_0xd016('0x31')];if(!_0x322b43[_0xd016('0x32')][_0xd016('0x38')](_0xd016('0x39'))){_0x48a610[_0xd016('0x20')]=qs[_0xd016('0x20')](_0x322b43[_0xd016('0x32')]['limit']);_0x48a610['offset']=qs[_0xd016('0x1d')](_0x322b43[_0xd016('0x32')][_0xd016('0x1d')]);}_0x48a610[_0xd016('0x3a')]=qs[_0xd016('0x3b')](_0x322b43[_0xd016('0x32')][_0xd016('0x3b')]);_0x48a610['where']=qs[_0xd016('0x33')](_['pick'](_0x322b43[_0xd016('0x32')],_0x2a59e3['filters']),_0x635c8a);if(_0x322b43[_0xd016('0x32')]['filter']){_0x48a610[_0xd016('0x3c')]=_[_0xd016('0x3d')](_0x48a610[_0xd016('0x3c')],{'$or':_[_0xd016('0x2c')](_0x635c8a,function(_0x4434f5){if(_0x4434f5[_0xd016('0x2f')]!=='VIRTUAL'){var _0x26c73f={};_0x26c73f[_0x4434f5[_0xd016('0x29')]]={'$like':'%'+_0x322b43[_0xd016('0x32')]['filter']+'%'};return _0x26c73f;}})});}_0x48a610=_[_0xd016('0x3d')]({},_0x48a610,_0x322b43[_0xd016('0x3e')]);var _0x34b1c7={'where':_0x48a610[_0xd016('0x3c')]};return db['FreshdeskConfiguration'][_0xd016('0x1f')](_0x34b1c7)['then'](function(_0x7db601){_0x516627['count']=_0x7db601;if(_0x322b43['query'][_0xd016('0x3f')]){_0x48a610[_0xd016('0x40')]=[{'all':!![]}];}return db[_0xd016('0x41')][_0xd016('0x42')](_0x48a610);})['then'](function(_0x50e342){_0x516627['rows']=_0x50e342;return _0x516627;})[_0xd016('0x27')](respondWithFilteredResult(_0xd546a2,_0x48a610))['catch'](handleError(_0xd546a2,null));};exports['show']=function(_0x6ba185,_0x400dc1){var _0x326500={'raw':![],'where':{'id':_0x6ba185[_0xd016('0x43')]['id']}},_0x43dcc9={};_0x43dcc9[_0xd016('0x31')]=_[_0xd016('0x44')](db['FreshdeskConfiguration'][_0xd016('0x2d')]);_0x43dcc9[_0xd016('0x32')]=_['keys'](_0x6ba185['query']);_0x43dcc9[_0xd016('0x33')]=_[_0xd016('0x34')](_0x43dcc9[_0xd016('0x31')],_0x43dcc9[_0xd016('0x32')]);_0x326500['attributes']=_[_0xd016('0x34')](_0x43dcc9[_0xd016('0x31')],qs[_0xd016('0x36')](_0x6ba185[_0xd016('0x32')][_0xd016('0x36')]));_0x326500[_0xd016('0x35')]=_0x326500[_0xd016('0x35')][_0xd016('0x37')]?_0x326500[_0xd016('0x35')]:_0x43dcc9[_0xd016('0x31')];if(_0x6ba185['query']['includeAll']){_0x326500['include']=[{'all':!![]}];}_0x326500=_[_0xd016('0x3d')]({},_0x326500,_0x6ba185[_0xd016('0x3e')]);return db[_0xd016('0x41')]['find'](_0x326500)[_0xd016('0x27')](handleEntityNotFound(_0x400dc1,null))['then'](respondWithResult(_0x400dc1,null))['catch'](handleError(_0x400dc1,null));};exports[_0xd016('0x45')]=function(_0xcad6b2,_0x258800){return db['FreshdeskConfiguration'][_0xd016('0x45')](_0xcad6b2[_0xd016('0x46')],{})[_0xd016('0x27')](respondWithResult(_0x258800,0xc9))[_0xd016('0x47')](handleError(_0x258800,null));};exports['update']=function(_0x160293,_0x22c0b0){if(_0x160293[_0xd016('0x46')]['id']){delete _0x160293[_0xd016('0x46')]['id'];}return db[_0xd016('0x41')][_0xd016('0x48')]({'where':{'id':_0x160293[_0xd016('0x43')]['id']}})[_0xd016('0x27')](handleEntityNotFound(_0x22c0b0,null))['then'](saveUpdates(_0x160293[_0xd016('0x46')],null))['then'](respondWithResult(_0x22c0b0,null))[_0xd016('0x47')](handleError(_0x22c0b0,null));};exports['destroy']=function(_0x50c58a,_0x4c6410){return db[_0xd016('0x41')][_0xd016('0x48')]({'where':{'id':_0x50c58a[_0xd016('0x43')]['id']}})[_0xd016('0x27')](handleEntityNotFound(_0x4c6410,null))[_0xd016('0x27')](removeEntity(_0x4c6410,null))[_0xd016('0x47')](handleError(_0x4c6410,null));};exports[_0xd016('0x49')]=function(_0x19324c,_0x52018b,_0x3b2afe){var _0x4450db={};var _0x347dfb={};var _0x2feedb;var _0x2a0424;return db[_0xd016('0x41')][_0xd016('0x4a')]({'where':{'id':_0x19324c[_0xd016('0x43')]['id']}})[_0xd016('0x27')](handleEntityNotFound(_0x52018b,null))[_0xd016('0x27')](function(_0xdc94c9){if(_0xdc94c9){_0x2feedb=_0xdc94c9;_0x347dfb[_0xd016('0x31')]=_[_0xd016('0x44')](db[_0xd016('0x4b')][_0xd016('0x2d')]);_0x347dfb[_0xd016('0x32')]=_[_0xd016('0x44')](_0x19324c['query']);_0x347dfb[_0xd016('0x33')]=_[_0xd016('0x34')](_0x347dfb['model'],_0x347dfb['query']);_0x4450db[_0xd016('0x35')]=_[_0xd016('0x34')](_0x347dfb[_0xd016('0x31')],qs['fields'](_0x19324c[_0xd016('0x32')][_0xd016('0x36')]));_0x4450db[_0xd016('0x35')]=_0x4450db[_0xd016('0x35')]['length']?_0x4450db['attributes']:_0x347dfb[_0xd016('0x31')];_0x4450db[_0xd016('0x3a')]=qs['sort'](_0x19324c[_0xd016('0x32')]['sort']);_0x4450db['where']=qs[_0xd016('0x33')](_[_0xd016('0x4c')](_0x19324c[_0xd016('0x32')],_0x347dfb[_0xd016('0x33')]));if(_0x19324c[_0xd016('0x32')]['filter']){_0x4450db['where']=_[_0xd016('0x3d')](_0x4450db[_0xd016('0x3c')],{'$or':_[_0xd016('0x2c')](_0x4450db['attributes'],function(_0x5c9db6){var _0x32f94f={};_0x32f94f[_0x5c9db6]={'$like':'%'+_0x19324c[_0xd016('0x32')][_0xd016('0x4d')]+'%'};return _0x32f94f;})});}_0x4450db=_[_0xd016('0x3d')]({},_0x4450db,_0x19324c[_0xd016('0x3e')]);return _0x2feedb['getFields'](_0x4450db);}})[_0xd016('0x27')](function(_0x9a05b3){if(_0x9a05b3){_0x2a0424=_0x9a05b3[_0xd016('0x37')];if(!_0x19324c[_0xd016('0x32')][_0xd016('0x38')]('nolimit')){_0x4450db[_0xd016('0x20')]=qs[_0xd016('0x20')](_0x19324c[_0xd016('0x32')]['limit']);_0x4450db[_0xd016('0x1d')]=qs[_0xd016('0x1d')](_0x19324c[_0xd016('0x32')]['offset']);}return _0x2feedb[_0xd016('0x49')](_0x4450db);}})[_0xd016('0x27')](function(_0x4952b4){if(_0x4952b4){return _0x4952b4?{'count':_0x2a0424,'rows':_0x4952b4}:null;}})['then'](respondWithResult(_0x52018b,null))[_0xd016('0x47')](handleError(_0x52018b,null));};exports['getSubjects']=function(_0x52412b,_0x316fc0,_0x67751e){var _0x254b02={};var _0x56b2c9={};var _0x266e90;var _0x1458da;return db[_0xd016('0x41')][_0xd016('0x4a')]({'where':{'id':_0x52412b[_0xd016('0x43')]['id']}})['then'](handleEntityNotFound(_0x316fc0,null))[_0xd016('0x27')](function(_0x47138f){if(_0x47138f){_0x266e90=_0x47138f;_0x56b2c9['model']=_['keys'](db[_0xd016('0x4b')]['rawAttributes']);_0x56b2c9[_0xd016('0x32')]=_['keys'](_0x52412b[_0xd016('0x32')]);_0x56b2c9['filters']=_[_0xd016('0x34')](_0x56b2c9['model'],_0x56b2c9[_0xd016('0x32')]);_0x254b02[_0xd016('0x35')]=_['intersection'](_0x56b2c9['model'],qs[_0xd016('0x36')](_0x52412b[_0xd016('0x32')][_0xd016('0x36')]));_0x254b02[_0xd016('0x35')]=_0x254b02[_0xd016('0x35')][_0xd016('0x37')]?_0x254b02[_0xd016('0x35')]:_0x56b2c9[_0xd016('0x31')];_0x254b02['order']=qs[_0xd016('0x3b')](_0x52412b[_0xd016('0x32')]['sort']);_0x254b02[_0xd016('0x3c')]=qs[_0xd016('0x33')](_[_0xd016('0x4c')](_0x52412b[_0xd016('0x32')],_0x56b2c9[_0xd016('0x33')]));if(_0x52412b[_0xd016('0x32')]['filter']){_0x254b02['where']=_[_0xd016('0x3d')](_0x254b02[_0xd016('0x3c')],{'$or':_['map'](_0x254b02[_0xd016('0x35')],function(_0x6ffe22){var _0x381942={};_0x381942[_0x6ffe22]={'$like':'%'+_0x52412b[_0xd016('0x32')][_0xd016('0x4d')]+'%'};return _0x381942;})});}_0x254b02=_[_0xd016('0x3d')]({},_0x254b02,_0x52412b[_0xd016('0x3e')]);return _0x266e90['getSubjects'](_0x254b02);}})[_0xd016('0x27')](function(_0x242a5f){if(_0x242a5f){_0x1458da=_0x242a5f[_0xd016('0x37')];if(!_0x52412b[_0xd016('0x32')][_0xd016('0x38')]('nolimit')){_0x254b02[_0xd016('0x20')]=qs[_0xd016('0x20')](_0x52412b[_0xd016('0x32')][_0xd016('0x20')]);_0x254b02[_0xd016('0x1d')]=qs[_0xd016('0x1d')](_0x52412b['query']['offset']);}return _0x266e90[_0xd016('0x4e')](_0x254b02);}})[_0xd016('0x27')](function(_0x1062a9){if(_0x1062a9){return _0x1062a9?{'count':_0x1458da,'rows':_0x1062a9}:null;}})['then'](respondWithResult(_0x316fc0,null))[_0xd016('0x47')](handleError(_0x316fc0,null));};exports[_0xd016('0x4f')]=function(_0x358cef,_0x307f27,_0x191be9){var _0xf7aba0={};var _0x4b0ddd={};var _0x169df6;var _0x19818a;return db[_0xd016('0x41')][_0xd016('0x4a')]({'where':{'id':_0x358cef[_0xd016('0x43')]['id']}})[_0xd016('0x27')](handleEntityNotFound(_0x307f27,null))[_0xd016('0x27')](function(_0x1005c5){if(_0x1005c5){_0x169df6=_0x1005c5;_0x4b0ddd[_0xd016('0x31')]=_[_0xd016('0x44')](db[_0xd016('0x4b')]['rawAttributes']);_0x4b0ddd['query']=_[_0xd016('0x44')](_0x358cef[_0xd016('0x32')]);_0x4b0ddd[_0xd016('0x33')]=_[_0xd016('0x34')](_0x4b0ddd[_0xd016('0x31')],_0x4b0ddd[_0xd016('0x32')]);_0xf7aba0[_0xd016('0x35')]=_[_0xd016('0x34')](_0x4b0ddd['model'],qs[_0xd016('0x36')](_0x358cef[_0xd016('0x32')]['fields']));_0xf7aba0[_0xd016('0x35')]=_0xf7aba0[_0xd016('0x35')]['length']?_0xf7aba0['attributes']:_0x4b0ddd[_0xd016('0x31')];_0xf7aba0[_0xd016('0x3a')]=qs[_0xd016('0x3b')](_0x358cef[_0xd016('0x32')]['sort']);_0xf7aba0[_0xd016('0x3c')]=qs['filters'](_['pick'](_0x358cef[_0xd016('0x32')],_0x4b0ddd[_0xd016('0x33')]));if(_0x358cef['query'][_0xd016('0x4d')]){_0xf7aba0['where']=_[_0xd016('0x3d')](_0xf7aba0[_0xd016('0x3c')],{'$or':_[_0xd016('0x2c')](_0xf7aba0['attributes'],function(_0x2f7e66){var _0x347365={};_0x347365[_0x2f7e66]={'$like':'%'+_0x358cef['query'][_0xd016('0x4d')]+'%'};return _0x347365;})});}_0xf7aba0=_[_0xd016('0x3d')]({},_0xf7aba0,_0x358cef[_0xd016('0x3e')]);return _0x169df6['getDescriptions'](_0xf7aba0);}})[_0xd016('0x27')](function(_0x3d871b){if(_0x3d871b){_0x19818a=_0x3d871b[_0xd016('0x37')];if(!_0x358cef['query'][_0xd016('0x38')](_0xd016('0x39'))){_0xf7aba0[_0xd016('0x20')]=qs[_0xd016('0x20')](_0x358cef['query']['limit']);_0xf7aba0[_0xd016('0x1d')]=qs[_0xd016('0x1d')](_0x358cef['query'][_0xd016('0x1d')]);}return _0x169df6[_0xd016('0x4f')](_0xf7aba0);}})[_0xd016('0x27')](function(_0x47415b){if(_0x47415b){return _0x47415b?{'count':_0x19818a,'rows':_0x47415b}:null;}})[_0xd016('0x27')](respondWithResult(_0x307f27,null))[_0xd016('0x47')](handleError(_0x307f27,null));};exports['getTags']=function(_0x46cc52,_0x53093f,_0x52e03e){var _0x1ad10e={};var _0x2cd7bd={};var _0x5d83d5;var _0x3d5840;return db[_0xd016('0x41')][_0xd016('0x4a')]({'where':{'id':_0x46cc52[_0xd016('0x43')]['id']}})['then'](handleEntityNotFound(_0x53093f,null))[_0xd016('0x27')](function(_0xe70a49){if(_0xe70a49){_0x5d83d5=_0xe70a49;_0x2cd7bd['model']=_[_0xd016('0x44')](db[_0xd016('0x50')][_0xd016('0x2d')]);_0x2cd7bd['query']=_[_0xd016('0x44')](_0x46cc52[_0xd016('0x32')]);_0x2cd7bd['filters']=_[_0xd016('0x34')](_0x2cd7bd[_0xd016('0x31')],_0x2cd7bd['query']);_0x1ad10e[_0xd016('0x35')]=_[_0xd016('0x34')](_0x2cd7bd[_0xd016('0x31')],qs['fields'](_0x46cc52[_0xd016('0x32')][_0xd016('0x36')]));_0x1ad10e[_0xd016('0x35')]=_0x1ad10e[_0xd016('0x35')]['length']?_0x1ad10e[_0xd016('0x35')]:_0x2cd7bd['model'];_0x1ad10e[_0xd016('0x3a')]=qs[_0xd016('0x3b')](_0x46cc52[_0xd016('0x32')][_0xd016('0x3b')]);_0x1ad10e['where']=qs['filters'](_['pick'](_0x46cc52[_0xd016('0x32')],_0x2cd7bd[_0xd016('0x33')]));if(_0x46cc52[_0xd016('0x32')][_0xd016('0x4d')]){_0x1ad10e[_0xd016('0x3c')]=_[_0xd016('0x3d')](_0x1ad10e['where'],{'$or':_[_0xd016('0x2c')](_0x1ad10e['attributes'],function(_0x10892f){var _0x5c6703={};_0x5c6703[_0x10892f]={'$like':'%'+_0x46cc52[_0xd016('0x32')][_0xd016('0x4d')]+'%'};return _0x5c6703;})});}_0x1ad10e=_[_0xd016('0x3d')]({},_0x1ad10e,_0x46cc52[_0xd016('0x3e')]);return _0x5d83d5['getTags'](_0x1ad10e);}})[_0xd016('0x27')](function(_0x273cf9){if(_0x273cf9){_0x3d5840=_0x273cf9[_0xd016('0x37')];if(!_0x46cc52[_0xd016('0x32')]['hasOwnProperty'](_0xd016('0x39'))){_0x1ad10e['limit']=qs[_0xd016('0x20')](_0x46cc52['query'][_0xd016('0x20')]);_0x1ad10e[_0xd016('0x1d')]=qs['offset'](_0x46cc52['query'][_0xd016('0x1d')]);}return _0x5d83d5[_0xd016('0x51')](_0x1ad10e);}})['then'](function(_0x479f8c){if(_0x479f8c){return _0x479f8c?{'count':_0x3d5840,'rows':_0x479f8c}:null;}})[_0xd016('0x27')](respondWithResult(_0x53093f,null))[_0xd016('0x47')](handleError(_0x53093f,null));};exports[_0xd016('0x52')]=function(_0x51c363,_0x300b65,_0x2a0319){if(_0x51c363['body']['id']){delete _0x51c363[_0xd016('0x46')]['id'];}return db[_0xd016('0x41')][_0xd016('0x4a')]({'where':{'id':_0x51c363[_0xd016('0x43')]['id']}})[_0xd016('0x27')](handleEntityNotFound(_0x300b65,null))[_0xd016('0x27')](function(_0x1922d3){if(_0x1922d3){return _0x1922d3['setTags'](_0x51c363[_0xd016('0x46')]['ids']||[]);}return null;})['then'](respondWithResult(_0x300b65,null))[_0xd016('0x47')](handleError(_0x300b65,null));}; \ No newline at end of file +var _0x74ba=['offset','undefined','limit','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','nolimit','getTags','Tag','order','setTags','ids','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x74ba,0x12c));var _0xa74b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74ba[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xa74b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa74b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa74b('0x2'));var moment=require(_0xa74b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa74b('0x4'));var util=require('util');var path=require(_0xa74b('0x5'));var sox=require(_0xa74b('0x6'));var csv=require(_0xa74b('0x7'));var ejs=require(_0xa74b('0x8'));var fs=require('fs');var fs_extra=require(_0xa74b('0x9'));var _=require('lodash');var squel=require(_0xa74b('0xa'));var crypto=require('crypto');var jsforce=require(_0xa74b('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa74b('0xc'));var Papa=require(_0xa74b('0xd'));var Redis=require(_0xa74b('0xe'));var authService=require(_0xa74b('0xf'));var qs=require(_0xa74b('0x10'));var as=require(_0xa74b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa74b('0x12'))('api');var utils=require(_0xa74b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa74b('0x14'));var db=require(_0xa74b('0x15'))['db'];function respondWithStatusCode(_0x374725,_0x465848){_0x465848=_0x465848||0xcc;return function(_0xf2d68a){if(_0xf2d68a){return _0x374725['sendStatus'](_0x465848);}return _0x374725[_0xa74b('0x16')](_0x465848)['end']();};}function respondWithResult(_0x1b8fd8,_0x481b63){_0x481b63=_0x481b63||0xc8;return function(_0x12f739){if(_0x12f739){return _0x1b8fd8['status'](_0x481b63)[_0xa74b('0x17')](_0x12f739);}};}function respondWithFilteredResult(_0x15c422,_0x2dbb7c){return function(_0x576924){if(_0x576924){var _0x4f1398=typeof _0x2dbb7c[_0xa74b('0x18')]===_0xa74b('0x19')&&typeof _0x2dbb7c[_0xa74b('0x1a')]===_0xa74b('0x19');var _0x287866=_0x576924[_0xa74b('0x1b')];var _0x322f2e=_0x4f1398?0x0:_0x2dbb7c['offset'];var _0x83eaf5=_0x4f1398?_0x576924[_0xa74b('0x1b')]:_0x2dbb7c[_0xa74b('0x18')]+_0x2dbb7c[_0xa74b('0x1a')];var _0x53495b;if(_0x83eaf5>=_0x287866){_0x83eaf5=_0x287866;_0x53495b=0xc8;}else{_0x53495b=0xce;}_0x15c422[_0xa74b('0x16')](_0x53495b);return _0x15c422[_0xa74b('0x1c')](_0xa74b('0x1d'),_0x322f2e+'-'+_0x83eaf5+'/'+_0x287866)[_0xa74b('0x17')](_0x576924);}return null;};}function patchUpdates(_0x44ec6f){return function(_0x2aab79){try{jsonpatch['apply'](_0x2aab79,_0x44ec6f,!![]);}catch(_0x5a4ee6){return BPromise['reject'](_0x5a4ee6);}return _0x2aab79['save']();};}function saveUpdates(_0x28b7d0,_0x1e5368){return function(_0x2ae4fe){if(_0x2ae4fe){return _0x2ae4fe[_0xa74b('0x1e')](_0x28b7d0)['then'](function(_0x5aaa85){return _0x5aaa85;});}return null;};}function removeEntity(_0x2ec4e5,_0x458c83){return function(_0x3d735f){if(_0x3d735f){return _0x3d735f[_0xa74b('0x1f')]()[_0xa74b('0x20')](function(){_0x2ec4e5[_0xa74b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573da3,_0x27d225){return function(_0x3199b4){if(!_0x3199b4){_0x573da3[_0xa74b('0x21')](0x194);}return _0x3199b4;};}function handleError(_0x272b21,_0x309e26){_0x309e26=_0x309e26||0x1f4;return function(_0x342b92){logger[_0xa74b('0x22')](_0x342b92[_0xa74b('0x23')]);if(_0x342b92[_0xa74b('0x24')]){delete _0x342b92[_0xa74b('0x24')];}_0x272b21[_0xa74b('0x16')](_0x309e26)[_0xa74b('0x25')](_0x342b92);};}exports['index']=function(_0x4a3046,_0x25915c){var _0x147a02={},_0x4fee95={},_0x3f0600={'count':0x0,'rows':[]};var _0x2abd08=_[_0xa74b('0x26')](db[_0xa74b('0x27')][_0xa74b('0x28')],function(_0x52de7e){return{'name':_0x52de7e[_0xa74b('0x29')],'type':_0x52de7e['type'][_0xa74b('0x2a')]};});_0x4fee95['model']=_[_0xa74b('0x26')](_0x2abd08,_0xa74b('0x24'));_0x4fee95[_0xa74b('0x2b')]=_[_0xa74b('0x2c')](_0x4a3046['query']);_0x4fee95[_0xa74b('0x2d')]=_['intersection'](_0x4fee95[_0xa74b('0x2e')],_0x4fee95[_0xa74b('0x2b')]);_0x147a02[_0xa74b('0x2f')]=_[_0xa74b('0x30')](_0x4fee95[_0xa74b('0x2e')],qs[_0xa74b('0x31')](_0x4a3046['query'][_0xa74b('0x31')]));_0x147a02[_0xa74b('0x2f')]=_0x147a02['attributes']['length']?_0x147a02[_0xa74b('0x2f')]:_0x4fee95[_0xa74b('0x2e')];if(!_0x4a3046[_0xa74b('0x2b')][_0xa74b('0x32')]('nolimit')){_0x147a02[_0xa74b('0x1a')]=qs[_0xa74b('0x1a')](_0x4a3046[_0xa74b('0x2b')][_0xa74b('0x1a')]);_0x147a02[_0xa74b('0x18')]=qs[_0xa74b('0x18')](_0x4a3046[_0xa74b('0x2b')][_0xa74b('0x18')]);}_0x147a02['order']=qs[_0xa74b('0x33')](_0x4a3046[_0xa74b('0x2b')][_0xa74b('0x33')]);_0x147a02[_0xa74b('0x34')]=qs['filters'](_[_0xa74b('0x35')](_0x4a3046[_0xa74b('0x2b')],_0x4fee95[_0xa74b('0x2d')]),_0x2abd08);if(_0x4a3046[_0xa74b('0x2b')][_0xa74b('0x36')]){_0x147a02[_0xa74b('0x34')]=_[_0xa74b('0x37')](_0x147a02[_0xa74b('0x34')],{'$or':_[_0xa74b('0x26')](_0x2abd08,function(_0x2203f1){if(_0x2203f1[_0xa74b('0x38')]!==_0xa74b('0x39')){var _0x359135={};_0x359135[_0x2203f1[_0xa74b('0x24')]]={'$like':'%'+_0x4a3046[_0xa74b('0x2b')][_0xa74b('0x36')]+'%'};return _0x359135;}})});}_0x147a02=_[_0xa74b('0x37')]({},_0x147a02,_0x4a3046[_0xa74b('0x3a')]);var _0x2b55d7={'where':_0x147a02[_0xa74b('0x34')]};return db[_0xa74b('0x27')][_0xa74b('0x1b')](_0x2b55d7)[_0xa74b('0x20')](function(_0x20b24e){_0x3f0600[_0xa74b('0x1b')]=_0x20b24e;if(_0x4a3046[_0xa74b('0x2b')][_0xa74b('0x3b')]){_0x147a02['include']=[{'all':!![]}];}return db[_0xa74b('0x27')][_0xa74b('0x3c')](_0x147a02);})[_0xa74b('0x20')](function(_0x2c3c57){_0x3f0600[_0xa74b('0x3d')]=_0x2c3c57;return _0x3f0600;})[_0xa74b('0x20')](respondWithFilteredResult(_0x25915c,_0x147a02))[_0xa74b('0x3e')](handleError(_0x25915c,null));};exports[_0xa74b('0x3f')]=function(_0x7f95c9,_0x3563e4){var _0x317caf={'raw':![],'where':{'id':_0x7f95c9[_0xa74b('0x40')]['id']}},_0x597676={};_0x597676[_0xa74b('0x2e')]=_[_0xa74b('0x2c')](db[_0xa74b('0x27')]['rawAttributes']);_0x597676[_0xa74b('0x2b')]=_[_0xa74b('0x2c')](_0x7f95c9[_0xa74b('0x2b')]);_0x597676[_0xa74b('0x2d')]=_['intersection'](_0x597676[_0xa74b('0x2e')],_0x597676[_0xa74b('0x2b')]);_0x317caf['attributes']=_[_0xa74b('0x30')](_0x597676[_0xa74b('0x2e')],qs[_0xa74b('0x31')](_0x7f95c9[_0xa74b('0x2b')][_0xa74b('0x31')]));_0x317caf[_0xa74b('0x2f')]=_0x317caf[_0xa74b('0x2f')][_0xa74b('0x41')]?_0x317caf[_0xa74b('0x2f')]:_0x597676[_0xa74b('0x2e')];if(_0x7f95c9['query']['includeAll']){_0x317caf[_0xa74b('0x42')]=[{'all':!![]}];}_0x317caf=_[_0xa74b('0x37')]({},_0x317caf,_0x7f95c9[_0xa74b('0x3a')]);return db['FreshdeskConfiguration']['find'](_0x317caf)[_0xa74b('0x20')](handleEntityNotFound(_0x3563e4,null))[_0xa74b('0x20')](respondWithResult(_0x3563e4,null))[_0xa74b('0x3e')](handleError(_0x3563e4,null));};exports[_0xa74b('0x43')]=function(_0x25e90b,_0x56f473){return db[_0xa74b('0x27')]['create'](_0x25e90b[_0xa74b('0x44')],{})[_0xa74b('0x20')](respondWithResult(_0x56f473,0xc9))[_0xa74b('0x3e')](handleError(_0x56f473,null));};exports['update']=function(_0x4c80b8,_0x2ddba5){if(_0x4c80b8[_0xa74b('0x44')]['id']){delete _0x4c80b8[_0xa74b('0x44')]['id'];}return db[_0xa74b('0x27')]['find']({'where':{'id':_0x4c80b8[_0xa74b('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ddba5,null))[_0xa74b('0x20')](saveUpdates(_0x4c80b8[_0xa74b('0x44')],null))[_0xa74b('0x20')](respondWithResult(_0x2ddba5,null))[_0xa74b('0x3e')](handleError(_0x2ddba5,null));};exports['destroy']=function(_0x552a0a,_0x4267e5){return db['FreshdeskConfiguration'][_0xa74b('0x45')]({'where':{'id':_0x552a0a[_0xa74b('0x40')]['id']}})[_0xa74b('0x20')](handleEntityNotFound(_0x4267e5,null))['then'](removeEntity(_0x4267e5,null))[_0xa74b('0x3e')](handleError(_0x4267e5,null));};exports[_0xa74b('0x46')]=function(_0x373a1b,_0x1f4619,_0x5de489){var _0x1d79ad={};var _0x128b4c={};var _0x38964f;var _0x50e3c2;return db['FreshdeskConfiguration'][_0xa74b('0x47')]({'where':{'id':_0x373a1b[_0xa74b('0x40')]['id']}})[_0xa74b('0x20')](handleEntityNotFound(_0x1f4619,null))[_0xa74b('0x20')](function(_0x18f137){if(_0x18f137){_0x38964f=_0x18f137;_0x128b4c['model']=_[_0xa74b('0x2c')](db[_0xa74b('0x48')][_0xa74b('0x28')]);_0x128b4c[_0xa74b('0x2b')]=_[_0xa74b('0x2c')](_0x373a1b[_0xa74b('0x2b')]);_0x128b4c[_0xa74b('0x2d')]=_[_0xa74b('0x30')](_0x128b4c[_0xa74b('0x2e')],_0x128b4c[_0xa74b('0x2b')]);_0x1d79ad[_0xa74b('0x2f')]=_[_0xa74b('0x30')](_0x128b4c[_0xa74b('0x2e')],qs[_0xa74b('0x31')](_0x373a1b['query'][_0xa74b('0x31')]));_0x1d79ad[_0xa74b('0x2f')]=_0x1d79ad[_0xa74b('0x2f')][_0xa74b('0x41')]?_0x1d79ad['attributes']:_0x128b4c['model'];_0x1d79ad['order']=qs[_0xa74b('0x33')](_0x373a1b['query'][_0xa74b('0x33')]);_0x1d79ad['where']=qs[_0xa74b('0x2d')](_[_0xa74b('0x35')](_0x373a1b[_0xa74b('0x2b')],_0x128b4c['filters']));if(_0x373a1b[_0xa74b('0x2b')][_0xa74b('0x36')]){_0x1d79ad[_0xa74b('0x34')]=_[_0xa74b('0x37')](_0x1d79ad[_0xa74b('0x34')],{'$or':_[_0xa74b('0x26')](_0x1d79ad[_0xa74b('0x2f')],function(_0x33f7f2){var _0xbf1016={};_0xbf1016[_0x33f7f2]={'$like':'%'+_0x373a1b[_0xa74b('0x2b')][_0xa74b('0x36')]+'%'};return _0xbf1016;})});}_0x1d79ad=_[_0xa74b('0x37')]({},_0x1d79ad,_0x373a1b[_0xa74b('0x3a')]);return _0x38964f[_0xa74b('0x46')](_0x1d79ad);}})['then'](function(_0x4e32f0){if(_0x4e32f0){_0x50e3c2=_0x4e32f0[_0xa74b('0x41')];if(!_0x373a1b[_0xa74b('0x2b')]['hasOwnProperty']('nolimit')){_0x1d79ad[_0xa74b('0x1a')]=qs['limit'](_0x373a1b[_0xa74b('0x2b')][_0xa74b('0x1a')]);_0x1d79ad[_0xa74b('0x18')]=qs[_0xa74b('0x18')](_0x373a1b['query'][_0xa74b('0x18')]);}return _0x38964f[_0xa74b('0x46')](_0x1d79ad);}})[_0xa74b('0x20')](function(_0x3fccd4){if(_0x3fccd4){return _0x3fccd4?{'count':_0x50e3c2,'rows':_0x3fccd4}:null;}})[_0xa74b('0x20')](respondWithResult(_0x1f4619,null))[_0xa74b('0x3e')](handleError(_0x1f4619,null));};exports['getSubjects']=function(_0x584664,_0x1f909a,_0x37bc16){var _0x18f2b2={};var _0x56f888={};var _0x47ebc1;var _0x1cd1e1;return db['FreshdeskConfiguration'][_0xa74b('0x47')]({'where':{'id':_0x584664[_0xa74b('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f909a,null))[_0xa74b('0x20')](function(_0x2bbc75){if(_0x2bbc75){_0x47ebc1=_0x2bbc75;_0x56f888['model']=_[_0xa74b('0x2c')](db[_0xa74b('0x48')][_0xa74b('0x28')]);_0x56f888[_0xa74b('0x2b')]=_[_0xa74b('0x2c')](_0x584664[_0xa74b('0x2b')]);_0x56f888[_0xa74b('0x2d')]=_['intersection'](_0x56f888[_0xa74b('0x2e')],_0x56f888[_0xa74b('0x2b')]);_0x18f2b2[_0xa74b('0x2f')]=_['intersection'](_0x56f888['model'],qs[_0xa74b('0x31')](_0x584664[_0xa74b('0x2b')]['fields']));_0x18f2b2[_0xa74b('0x2f')]=_0x18f2b2[_0xa74b('0x2f')][_0xa74b('0x41')]?_0x18f2b2[_0xa74b('0x2f')]:_0x56f888['model'];_0x18f2b2['order']=qs[_0xa74b('0x33')](_0x584664[_0xa74b('0x2b')][_0xa74b('0x33')]);_0x18f2b2['where']=qs[_0xa74b('0x2d')](_['pick'](_0x584664[_0xa74b('0x2b')],_0x56f888[_0xa74b('0x2d')]));if(_0x584664['query'][_0xa74b('0x36')]){_0x18f2b2[_0xa74b('0x34')]=_['merge'](_0x18f2b2[_0xa74b('0x34')],{'$or':_[_0xa74b('0x26')](_0x18f2b2[_0xa74b('0x2f')],function(_0x1bbfe6){var _0x10bd15={};_0x10bd15[_0x1bbfe6]={'$like':'%'+_0x584664[_0xa74b('0x2b')]['filter']+'%'};return _0x10bd15;})});}_0x18f2b2=_[_0xa74b('0x37')]({},_0x18f2b2,_0x584664[_0xa74b('0x3a')]);return _0x47ebc1[_0xa74b('0x49')](_0x18f2b2);}})[_0xa74b('0x20')](function(_0xf96308){if(_0xf96308){_0x1cd1e1=_0xf96308[_0xa74b('0x41')];if(!_0x584664[_0xa74b('0x2b')][_0xa74b('0x32')]('nolimit')){_0x18f2b2[_0xa74b('0x1a')]=qs['limit'](_0x584664[_0xa74b('0x2b')]['limit']);_0x18f2b2[_0xa74b('0x18')]=qs[_0xa74b('0x18')](_0x584664[_0xa74b('0x2b')][_0xa74b('0x18')]);}return _0x47ebc1[_0xa74b('0x49')](_0x18f2b2);}})[_0xa74b('0x20')](function(_0x5d3717){if(_0x5d3717){return _0x5d3717?{'count':_0x1cd1e1,'rows':_0x5d3717}:null;}})[_0xa74b('0x20')](respondWithResult(_0x1f909a,null))[_0xa74b('0x3e')](handleError(_0x1f909a,null));};exports[_0xa74b('0x4a')]=function(_0x2f8e3e,_0x596e8a,_0x4ca8d5){var _0x2d504b={};var _0x1a0639={};var _0x21142f;var _0x5313cc;return db[_0xa74b('0x27')][_0xa74b('0x47')]({'where':{'id':_0x2f8e3e[_0xa74b('0x40')]['id']}})[_0xa74b('0x20')](handleEntityNotFound(_0x596e8a,null))[_0xa74b('0x20')](function(_0x2621e5){if(_0x2621e5){_0x21142f=_0x2621e5;_0x1a0639['model']=_[_0xa74b('0x2c')](db[_0xa74b('0x48')][_0xa74b('0x28')]);_0x1a0639[_0xa74b('0x2b')]=_[_0xa74b('0x2c')](_0x2f8e3e['query']);_0x1a0639[_0xa74b('0x2d')]=_[_0xa74b('0x30')](_0x1a0639['model'],_0x1a0639[_0xa74b('0x2b')]);_0x2d504b[_0xa74b('0x2f')]=_['intersection'](_0x1a0639[_0xa74b('0x2e')],qs[_0xa74b('0x31')](_0x2f8e3e[_0xa74b('0x2b')][_0xa74b('0x31')]));_0x2d504b[_0xa74b('0x2f')]=_0x2d504b[_0xa74b('0x2f')]['length']?_0x2d504b[_0xa74b('0x2f')]:_0x1a0639[_0xa74b('0x2e')];_0x2d504b['order']=qs['sort'](_0x2f8e3e[_0xa74b('0x2b')]['sort']);_0x2d504b[_0xa74b('0x34')]=qs[_0xa74b('0x2d')](_[_0xa74b('0x35')](_0x2f8e3e[_0xa74b('0x2b')],_0x1a0639[_0xa74b('0x2d')]));if(_0x2f8e3e[_0xa74b('0x2b')][_0xa74b('0x36')]){_0x2d504b[_0xa74b('0x34')]=_['merge'](_0x2d504b[_0xa74b('0x34')],{'$or':_[_0xa74b('0x26')](_0x2d504b[_0xa74b('0x2f')],function(_0x2a138d){var _0x1f7569={};_0x1f7569[_0x2a138d]={'$like':'%'+_0x2f8e3e['query'][_0xa74b('0x36')]+'%'};return _0x1f7569;})});}_0x2d504b=_[_0xa74b('0x37')]({},_0x2d504b,_0x2f8e3e[_0xa74b('0x3a')]);return _0x21142f[_0xa74b('0x4a')](_0x2d504b);}})[_0xa74b('0x20')](function(_0x2ae133){if(_0x2ae133){_0x5313cc=_0x2ae133['length'];if(!_0x2f8e3e[_0xa74b('0x2b')][_0xa74b('0x32')](_0xa74b('0x4b'))){_0x2d504b[_0xa74b('0x1a')]=qs['limit'](_0x2f8e3e[_0xa74b('0x2b')][_0xa74b('0x1a')]);_0x2d504b[_0xa74b('0x18')]=qs[_0xa74b('0x18')](_0x2f8e3e[_0xa74b('0x2b')][_0xa74b('0x18')]);}return _0x21142f[_0xa74b('0x4a')](_0x2d504b);}})[_0xa74b('0x20')](function(_0x4ea000){if(_0x4ea000){return _0x4ea000?{'count':_0x5313cc,'rows':_0x4ea000}:null;}})[_0xa74b('0x20')](respondWithResult(_0x596e8a,null))[_0xa74b('0x3e')](handleError(_0x596e8a,null));};exports[_0xa74b('0x4c')]=function(_0x40f089,_0x3d2593,_0x230a96){var _0x1cb2a5={};var _0x24eb53={};var _0x373b40;var _0x3d490e;return db[_0xa74b('0x27')][_0xa74b('0x47')]({'where':{'id':_0x40f089[_0xa74b('0x40')]['id']}})[_0xa74b('0x20')](handleEntityNotFound(_0x3d2593,null))[_0xa74b('0x20')](function(_0x3d2e88){if(_0x3d2e88){_0x373b40=_0x3d2e88;_0x24eb53['model']=_[_0xa74b('0x2c')](db[_0xa74b('0x4d')]['rawAttributes']);_0x24eb53[_0xa74b('0x2b')]=_[_0xa74b('0x2c')](_0x40f089[_0xa74b('0x2b')]);_0x24eb53[_0xa74b('0x2d')]=_['intersection'](_0x24eb53[_0xa74b('0x2e')],_0x24eb53['query']);_0x1cb2a5[_0xa74b('0x2f')]=_[_0xa74b('0x30')](_0x24eb53['model'],qs[_0xa74b('0x31')](_0x40f089[_0xa74b('0x2b')]['fields']));_0x1cb2a5[_0xa74b('0x2f')]=_0x1cb2a5[_0xa74b('0x2f')][_0xa74b('0x41')]?_0x1cb2a5['attributes']:_0x24eb53['model'];_0x1cb2a5[_0xa74b('0x4e')]=qs[_0xa74b('0x33')](_0x40f089['query'][_0xa74b('0x33')]);_0x1cb2a5[_0xa74b('0x34')]=qs[_0xa74b('0x2d')](_['pick'](_0x40f089[_0xa74b('0x2b')],_0x24eb53[_0xa74b('0x2d')]));if(_0x40f089[_0xa74b('0x2b')][_0xa74b('0x36')]){_0x1cb2a5[_0xa74b('0x34')]=_[_0xa74b('0x37')](_0x1cb2a5[_0xa74b('0x34')],{'$or':_[_0xa74b('0x26')](_0x1cb2a5[_0xa74b('0x2f')],function(_0x59e89){var _0x8e4767={};_0x8e4767[_0x59e89]={'$like':'%'+_0x40f089[_0xa74b('0x2b')][_0xa74b('0x36')]+'%'};return _0x8e4767;})});}_0x1cb2a5=_[_0xa74b('0x37')]({},_0x1cb2a5,_0x40f089['options']);return _0x373b40[_0xa74b('0x4c')](_0x1cb2a5);}})[_0xa74b('0x20')](function(_0x4155f6){if(_0x4155f6){_0x3d490e=_0x4155f6[_0xa74b('0x41')];if(!_0x40f089['query'][_0xa74b('0x32')]('nolimit')){_0x1cb2a5[_0xa74b('0x1a')]=qs[_0xa74b('0x1a')](_0x40f089[_0xa74b('0x2b')][_0xa74b('0x1a')]);_0x1cb2a5[_0xa74b('0x18')]=qs[_0xa74b('0x18')](_0x40f089[_0xa74b('0x2b')][_0xa74b('0x18')]);}return _0x373b40[_0xa74b('0x4c')](_0x1cb2a5);}})[_0xa74b('0x20')](function(_0x2b14da){if(_0x2b14da){return _0x2b14da?{'count':_0x3d490e,'rows':_0x2b14da}:null;}})[_0xa74b('0x20')](respondWithResult(_0x3d2593,null))[_0xa74b('0x3e')](handleError(_0x3d2593,null));};exports[_0xa74b('0x4f')]=function(_0xa44803,_0x2c8063,_0x1fd04b){if(_0xa44803['body']['id']){delete _0xa44803['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xa44803[_0xa74b('0x40')]['id']}})[_0xa74b('0x20')](handleEntityNotFound(_0x2c8063,null))[_0xa74b('0x20')](function(_0x4de431){if(_0x4de431){return _0x4de431[_0xa74b('0x4f')](_0xa44803[_0xa74b('0x44')][_0xa74b('0x50')]||[]);}return null;})[_0xa74b('0x20')](respondWithResult(_0x2c8063,null))[_0xa74b('0x3e')](handleError(_0x2c8063,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2ddeeb6..6bebe90 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 _0xb67d=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x53c266,_0x4b4ede){var _0x3bc31b=function(_0x176529){while(--_0x176529){_0x53c266['push'](_0x53c266['shift']());}};_0x3bc31b(++_0x4b4ede);}(_0xb67d,0x117));var _0xdb67=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb67d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xdb67('0x0'));var util=require(_0xdb67('0x1'));var logger=require(_0xdb67('0x2'))(_0xdb67('0x3'));var moment=require(_0xdb67('0x4'));var BPromise=require(_0xdb67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdb67('0x6'));var attributes=require(_0xdb67('0x7'));module['exports']=function(_0x260c50,_0x4085f2){return _0x260c50[_0xdb67('0x8')](_0xdb67('0x9'),attributes,{'tableName':_0xdb67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa151=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b890f,_0x2c7db4){var _0xe76ac9=function(_0x267f91){while(--_0x267f91){_0x4b890f['push'](_0x4b890f['shift']());}};_0xe76ac9(++_0x2c7db4);}(_0xa151,0x16f));var _0x1a15=function(_0x79e43a,_0x5210ba){_0x79e43a=_0x79e43a-0x0;var _0x4d2e74=_0xa151[_0x79e43a];return _0x4d2e74;};'use strict';var _=require(_0x1a15('0x0'));var util=require(_0x1a15('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1a15('0x2'));var BPromise=require(_0x1a15('0x3'));var rp=require(_0x1a15('0x4'));var fs=require('fs');var path=require(_0x1a15('0x5'));var rimraf=require(_0x1a15('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x1a15('0x7')]=function(_0x3cb583,_0x617495){return _0x3cb583[_0x1a15('0x8')](_0x1a15('0x9'),attributes,{'tableName':_0x1a15('0xa'),'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 5f37ef9..9cfcc1f 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 _0x4021=['ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x517bbb,_0x13d1dd){var _0x1c5688=function(_0x50e7ae){while(--_0x50e7ae){_0x517bbb['push'](_0x517bbb['shift']());}};_0x1c5688(++_0x13d1dd);}(_0x4021,0x18b));var _0x1402=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x4021[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var moment=require(_0x1402('0x2'));var BPromise=require(_0x1402('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1402('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1402('0x5'));var logger=require(_0x1402('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1402('0x7'));var client=jayson[_0x1402('0x8')][_0x1402('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba2b0,_0xfc4f74,_0x45d981){return new BPromise(function(_0x3aee8d,_0x422a04){return client['request'](_0x1ba2b0,_0x45d981)['then'](function(_0x6294dd){logger[_0x1402('0xa')](_0x1402('0xb'),_0xfc4f74,_0x1402('0xc'));logger[_0x1402('0xd')](_0x1402('0xe'),_0xfc4f74,_0x1402('0xc'),JSON[_0x1402('0xf')](_0x6294dd));if(_0x6294dd[_0x1402('0x10')]){if(_0x6294dd['error']['code']===0x1f4){logger[_0x1402('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xfc4f74,_0x6294dd[_0x1402('0x10')][_0x1402('0x11')]);return _0x422a04(_0x6294dd['error']['message']);}logger[_0x1402('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xfc4f74,_0x6294dd['error']['message']);return _0x3aee8d(_0x6294dd[_0x1402('0x10')][_0x1402('0x11')]);}else{logger[_0x1402('0xa')](_0x1402('0xb'),_0xfc4f74,'request\x20sent');_0x3aee8d(_0x6294dd['result'][_0x1402('0x11')]);}})[_0x1402('0x12')](function(_0x10f7b8){logger[_0x1402('0x10')](_0x1402('0xb'),_0xfc4f74,_0x10f7b8);_0x422a04(_0x10f7b8);});});} \ No newline at end of file +var _0xb455=['client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x305542,_0x4b921a){var _0x413821=function(_0x4c1204){while(--_0x4c1204){_0x305542['push'](_0x305542['shift']());}};_0x413821(++_0x4b921a);}(_0xb455,0x15b));var _0x5b45=function(_0x5def1a,_0xd26c9a){_0x5def1a=_0x5def1a-0x0;var _0x9e84af=_0xb455[_0x5def1a];return _0x9e84af;};'use strict';var _=require(_0x5b45('0x0'));var util=require(_0x5b45('0x1'));var moment=require(_0x5b45('0x2'));var BPromise=require(_0x5b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b45('0x4'));var db=require(_0x5b45('0x5'))['db'];var utils=require(_0x5b45('0x6'));var logger=require('../../config/logger')(_0x5b45('0x7'));var config=require(_0x5b45('0x8'));var jayson=require(_0x5b45('0x9'));var client=jayson[_0x5b45('0xa')][_0x5b45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27933b,_0x5ddffb,_0x2b7892){return new BPromise(function(_0x36d8dd,_0x5b1958){return client['request'](_0x27933b,_0x2b7892)[_0x5b45('0xc')](function(_0x4c1531){logger[_0x5b45('0xd')](_0x5b45('0xe'),_0x5ddffb,_0x5b45('0xf'));logger[_0x5b45('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5ddffb,_0x5b45('0xf'),JSON[_0x5b45('0x11')](_0x4c1531));if(_0x4c1531[_0x5b45('0x12')]){if(_0x4c1531[_0x5b45('0x12')][_0x5b45('0x13')]===0x1f4){logger['error'](_0x5b45('0xe'),_0x5ddffb,_0x4c1531[_0x5b45('0x12')][_0x5b45('0x14')]);return _0x5b1958(_0x4c1531['error'][_0x5b45('0x14')]);}logger[_0x5b45('0x12')](_0x5b45('0xe'),_0x5ddffb,_0x4c1531[_0x5b45('0x12')][_0x5b45('0x14')]);return _0x36d8dd(_0x4c1531[_0x5b45('0x12')][_0x5b45('0x14')]);}else{logger[_0x5b45('0xd')](_0x5b45('0xe'),_0x5ddffb,_0x5b45('0xf'));_0x36d8dd(_0x4c1531['result']['message']);}})['catch'](function(_0x4232bf){logger[_0x5b45('0x12')](_0x5b45('0xe'),_0x5ddffb,_0x4232bf);_0x5b1958(_0x4232bf);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e7c405a..af22ae5 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 _0xaf85=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x337216,_0x4184e2){var _0x113fdb=function(_0x34e656){while(--_0x34e656){_0x337216['push'](_0x337216['shift']());}};_0x113fdb(++_0x4184e2);}(_0xaf85,0x101));var _0x5af8=function(_0x17c64b,_0x38ae9c){_0x17c64b=_0x17c64b-0x0;var _0x5ca37f=_0xaf85[_0x17c64b];return _0x5ca37f;};'use strict';var multer=require(_0x5af8('0x0'));var util=require(_0x5af8('0x1'));var path=require('path');var timeout=require(_0x5af8('0x2'));var express=require(_0x5af8('0x3'));var router=express[_0x5af8('0x4')]();var fs_extra=require(_0x5af8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5af8('0x6'));var config=require(_0x5af8('0x7'));var controller=require(_0x5af8('0x8'));router[_0x5af8('0x9')]('/',auth[_0x5af8('0xa')](),controller[_0x5af8('0xb')]);router[_0x5af8('0x9')]('/:id',auth[_0x5af8('0xa')](),controller[_0x5af8('0xc')]);router[_0x5af8('0xd')]('/',auth[_0x5af8('0xa')](),controller['create']);router[_0x5af8('0xe')](_0x5af8('0xf'),auth['isAuthenticated'](),controller[_0x5af8('0x10')]);router[_0x5af8('0x11')]('/:id',auth[_0x5af8('0xa')](),controller[_0x5af8('0x12')]);module[_0x5af8('0x13')]=router; \ No newline at end of file +var _0xc0d7=['create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x32b576,_0x1c91c4){var _0x40f17b=function(_0x5b105b){while(--_0x5b105b){_0x32b576['push'](_0x32b576['shift']());}};_0x40f17b(++_0x1c91c4);}(_0xc0d7,0x16d));var _0x7c0d=function(_0x2d2bd9,_0x2b06ea){_0x2d2bd9=_0x2d2bd9-0x0;var _0x3fcb3f=_0xc0d7[_0x2d2bd9];return _0x3fcb3f;};'use strict';var multer=require(_0x7c0d('0x0'));var util=require('util');var path=require(_0x7c0d('0x1'));var timeout=require(_0x7c0d('0x2'));var express=require(_0x7c0d('0x3'));var router=express[_0x7c0d('0x4')]();var fs_extra=require(_0x7c0d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c0d('0x6'));var config=require('../../config/environment');var controller=require(_0x7c0d('0x7'));router[_0x7c0d('0x8')]('/',auth[_0x7c0d('0x9')](),controller[_0x7c0d('0xa')]);router['get'](_0x7c0d('0xb'),auth[_0x7c0d('0x9')](),controller['show']);router[_0x7c0d('0xc')]('/',auth[_0x7c0d('0x9')](),controller[_0x7c0d('0xd')]);router['put'](_0x7c0d('0xb'),auth[_0x7c0d('0x9')](),controller[_0x7c0d('0xe')]);router[_0x7c0d('0xf')](_0x7c0d('0xb'),auth[_0x7c0d('0x9')](),controller[_0x7c0d('0x10')]);module[_0x7c0d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 28fee61..5349f91 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 _0x5e26=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string'];(function(_0x4f1742,_0x3e3222){var _0x3c0c76=function(_0x541ec0){while(--_0x541ec0){_0x4f1742['push'](_0x4f1742['shift']());}};_0x3c0c76(++_0x3e3222);}(_0x5e26,0x16f));var _0x65e2=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x5e26[_0x43a1b8];return _0x324ecc;};'use strict';var Sequelize=require(_0x65e2('0x0'));module[_0x65e2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x65e2('0x2'),'variable',_0x65e2('0x3'),_0x65e2('0x4'),_0x65e2('0x5')),'defaultValue':_0x65e2('0x2')},'content':{'type':Sequelize[_0x65e2('0x6')]},'key':{'type':Sequelize[_0x65e2('0x6')]},'keyType':{'type':Sequelize[_0x65e2('0x7')](_0x65e2('0x2'),_0x65e2('0x8'),_0x65e2('0x3'))},'keyContent':{'type':Sequelize[_0x65e2('0x6')]},'idField':{'type':Sequelize[_0x65e2('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x65e2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x65e2('0x6')]}}; \ No newline at end of file +var _0x31c8=['STRING','ENUM','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x31c8,0x9a));var _0x831c=function(_0x50313c,_0x35c9c2){_0x50313c=_0x50313c-0x0;var _0x2ddc75=_0x31c8[_0x50313c];return _0x2ddc75;};'use strict';var Sequelize=require(_0x831c('0x0'));module[_0x831c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x831c('0x2'),_0x831c('0x3'),_0x831c('0x4'),'keyValue',_0x831c('0x5')),'defaultValue':_0x831c('0x2')},'content':{'type':Sequelize[_0x831c('0x6')]},'key':{'type':Sequelize[_0x831c('0x6')]},'keyType':{'type':Sequelize[_0x831c('0x7')](_0x831c('0x2'),_0x831c('0x3'),_0x831c('0x4'))},'keyContent':{'type':Sequelize[_0x831c('0x6')]},'idField':{'type':Sequelize[_0x831c('0x6')]},'nameField':{'type':Sequelize[_0x831c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x831c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 7b3581d..c59500d 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 _0x91a7=['filter','merge','where','VIRTUAL','options','findAll','rows','catch','rawAttributes','includeAll','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort'];(function(_0x53eeac,_0x1babff){var _0x41dddf=function(_0x2e8176){while(--_0x2e8176){_0x53eeac['push'](_0x53eeac['shift']());}};_0x41dddf(++_0x1babff);}(_0x91a7,0xe7));var _0x791a=function(_0x37a881,_0x467f2b){_0x37a881=_0x37a881-0x0;var _0x287ecf=_0x91a7[_0x37a881];return _0x287ecf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x380329,_0x2966b8){return function(_0x4d748a){if(!_0x4d748a){_0x380329[_0x791a('0x16')](0x194);}return _0x4d748a;};}function handleError(_0x2db3f7,_0x51dcca){_0x51dcca=_0x51dcca||0x1f4;return function(_0xdfa84f){logger[_0x791a('0x24')](_0xdfa84f[_0x791a('0x25')]);if(_0xdfa84f['name']){delete _0xdfa84f[_0x791a('0x26')];}_0x2db3f7[_0x791a('0x18')](_0x51dcca)[_0x791a('0x27')](_0xdfa84f);};}exports[_0x791a('0x28')]=function(_0x4f423,_0x1a9c6b){var _0x628816={},_0x889534={},_0x58bbc0={'count':0x0,'rows':[]};var _0xbc3436=_[_0x791a('0x29')](db[_0x791a('0x2a')]['rawAttributes'],function(_0x1cdda9){return{'name':_0x1cdda9['fieldName'],'type':_0x1cdda9[_0x791a('0x2b')][_0x791a('0x2c')]};});_0x889534[_0x791a('0x2d')]=_[_0x791a('0x29')](_0xbc3436,_0x791a('0x26'));_0x889534[_0x791a('0x2e')]=_[_0x791a('0x2f')](_0x4f423['query']);_0x889534[_0x791a('0x30')]=_[_0x791a('0x31')](_0x889534[_0x791a('0x2d')],_0x889534[_0x791a('0x2e')]);_0x628816[_0x791a('0x32')]=_['intersection'](_0x889534[_0x791a('0x2d')],qs[_0x791a('0x33')](_0x4f423[_0x791a('0x2e')][_0x791a('0x33')]));_0x628816[_0x791a('0x32')]=_0x628816['attributes'][_0x791a('0x34')]?_0x628816[_0x791a('0x32')]:_0x889534[_0x791a('0x2d')];if(!_0x4f423[_0x791a('0x2e')][_0x791a('0x35')]('nolimit')){_0x628816[_0x791a('0x36')]=qs['limit'](_0x4f423[_0x791a('0x2e')]['limit']);_0x628816['offset']=qs[_0x791a('0x1a')](_0x4f423[_0x791a('0x2e')][_0x791a('0x1a')]);}_0x628816[_0x791a('0x37')]=qs[_0x791a('0x38')](_0x4f423[_0x791a('0x2e')][_0x791a('0x38')]);_0x628816['where']=qs[_0x791a('0x30')](_['pick'](_0x4f423[_0x791a('0x2e')],_0x889534['filters']),_0xbc3436);if(_0x4f423[_0x791a('0x2e')][_0x791a('0x39')]){_0x628816['where']=_[_0x791a('0x3a')](_0x628816[_0x791a('0x3b')],{'$or':_['map'](_0xbc3436,function(_0x45fbfa){if(_0x45fbfa[_0x791a('0x2b')]!==_0x791a('0x3c')){var _0x23db7d={};_0x23db7d[_0x45fbfa[_0x791a('0x26')]]={'$like':'%'+_0x4f423[_0x791a('0x2e')][_0x791a('0x39')]+'%'};return _0x23db7d;}})});}_0x628816=_[_0x791a('0x3a')]({},_0x628816,_0x4f423[_0x791a('0x3d')]);var _0xeafbb5={'where':_0x628816['where']};return db[_0x791a('0x2a')][_0x791a('0x1c')](_0xeafbb5)[_0x791a('0x22')](function(_0x4efbf6){_0x58bbc0[_0x791a('0x1c')]=_0x4efbf6;if(_0x4f423['query']['includeAll']){_0x628816['include']=[{'all':!![]}];}return db[_0x791a('0x2a')][_0x791a('0x3e')](_0x628816);})['then'](function(_0x415c44){_0x58bbc0[_0x791a('0x3f')]=_0x415c44;return _0x58bbc0;})[_0x791a('0x22')](respondWithFilteredResult(_0x1a9c6b,_0x628816))[_0x791a('0x40')](handleError(_0x1a9c6b,null));};exports['show']=function(_0x483336,_0x57b9ba){var _0x2f0395={'raw':!![],'where':{'id':_0x483336['params']['id']}},_0x216dd3={};_0x216dd3[_0x791a('0x2d')]=_[_0x791a('0x2f')](db[_0x791a('0x2a')][_0x791a('0x41')]);_0x216dd3['query']=_[_0x791a('0x2f')](_0x483336['query']);_0x216dd3[_0x791a('0x30')]=_[_0x791a('0x31')](_0x216dd3[_0x791a('0x2d')],_0x216dd3[_0x791a('0x2e')]);_0x2f0395[_0x791a('0x32')]=_['intersection'](_0x216dd3[_0x791a('0x2d')],qs[_0x791a('0x33')](_0x483336[_0x791a('0x2e')][_0x791a('0x33')]));_0x2f0395[_0x791a('0x32')]=_0x2f0395['attributes'][_0x791a('0x34')]?_0x2f0395[_0x791a('0x32')]:_0x216dd3['model'];if(_0x483336['query'][_0x791a('0x42')]){_0x2f0395[_0x791a('0x43')]=[{'all':!![]}];}_0x2f0395=_[_0x791a('0x3a')]({},_0x2f0395,_0x483336['options']);return db['FreshdeskField'][_0x791a('0x44')](_0x2f0395)[_0x791a('0x22')](handleEntityNotFound(_0x57b9ba,null))['then'](respondWithResult(_0x57b9ba,null))[_0x791a('0x40')](handleError(_0x57b9ba,null));};exports[_0x791a('0x45')]=function(_0x3eac77,_0x549980){return db['FreshdeskField'][_0x791a('0x45')](_0x3eac77[_0x791a('0x46')],{})[_0x791a('0x22')](respondWithResult(_0x549980,0xc9))[_0x791a('0x40')](handleError(_0x549980,null));};exports['update']=function(_0x2d7c7d,_0x9f768a){if(_0x2d7c7d[_0x791a('0x46')]['id']){delete _0x2d7c7d[_0x791a('0x46')]['id'];}return db['FreshdeskField'][_0x791a('0x44')]({'where':{'id':_0x2d7c7d[_0x791a('0x47')]['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x9f768a,null))[_0x791a('0x22')](saveUpdates(_0x2d7c7d[_0x791a('0x46')],null))[_0x791a('0x22')](respondWithResult(_0x9f768a,null))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['destroy']=function(_0xdcb1b,_0x1fd826){return db['FreshdeskField'][_0x791a('0x44')]({'where':{'id':_0xdcb1b[_0x791a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1fd826,null))[_0x791a('0x22')](removeEntity(_0x1fd826,null))[_0x791a('0x40')](handleError(_0x1fd826,null));}; \ No newline at end of file +var _0xb43b=['create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','name','status','send','index','map','FreshdeskField','rawAttributes','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','then','catch','params','find'];(function(_0x3170dd,_0x3e064e){var _0x44615e=function(_0x24d769){while(--_0x24d769){_0x3170dd['push'](_0x3170dd['shift']());}};_0x44615e(++_0x3e064e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x360b0f,_0x293d94){_0x360b0f=_0x360b0f-0x0;var _0x352380=_0xb43b[_0x360b0f];return _0x352380;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={},_0x539730={},_0x2ad6da={'count':0x0,'rows':[]};var _0x56fe33=_[_0xbb43('0x2a')](db[_0xbb43('0x2b')][_0xbb43('0x2c')],function(_0x1880cd){return{'name':_0x1880cd['fieldName'],'type':_0x1880cd[_0xbb43('0x2d')]['key']};});_0x539730['model']=_['map'](_0x56fe33,_0xbb43('0x26'));_0x539730['query']=_[_0xbb43('0x2e')](_0x40b04b[_0xbb43('0x2f')]);_0x539730[_0xbb43('0x30')]=_['intersection'](_0x539730[_0xbb43('0x31')],_0x539730[_0xbb43('0x2f')]);_0x473828[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x539730[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x473828['attributes']=_0x473828[_0xbb43('0x32')][_0xbb43('0x35')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x31')];if(!_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x36')](_0xbb43('0x37'))){_0x473828[_0xbb43('0x1d')]=qs[_0xbb43('0x1d')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1d')]);_0x473828[_0xbb43('0x1c')]=qs[_0xbb43('0x1c')](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x1c')]);}_0x473828[_0xbb43('0x38')]=qs['sort'](_0x40b04b[_0xbb43('0x2f')][_0xbb43('0x39')]);_0x473828['where']=qs[_0xbb43('0x30')](_[_0xbb43('0x3a')](_0x40b04b[_0xbb43('0x2f')],_0x539730['filters']),_0x56fe33);if(_0x40b04b['query']['filter']){_0x473828[_0xbb43('0x3b')]=_[_0xbb43('0x3c')](_0x473828['where'],{'$or':_['map'](_0x56fe33,function(_0x2aa381){if(_0x2aa381[_0xbb43('0x2d')]!==_0xbb43('0x3d')){var _0x37afbb={};_0x37afbb[_0x2aa381[_0xbb43('0x26')]]={'$like':'%'+_0x40b04b['query'][_0xbb43('0x3e')]+'%'};return _0x37afbb;}})});}_0x473828=_[_0xbb43('0x3c')]({},_0x473828,_0x40b04b[_0xbb43('0x3f')]);var _0x3340aa={'where':_0x473828[_0xbb43('0x3b')]};return db['FreshdeskField'][_0xbb43('0x1b')](_0x3340aa)['then'](function(_0x1c076f){_0x2ad6da[_0xbb43('0x1b')]=_0x1c076f;if(_0x40b04b['query'][_0xbb43('0x40')]){_0x473828['include']=[{'all':!![]}];}return db[_0xbb43('0x2b')][_0xbb43('0x41')](_0x473828);})[_0xbb43('0x42')](function(_0xb84ece){_0x2ad6da['rows']=_0xb84ece;return _0x2ad6da;})[_0xbb43('0x42')](respondWithFilteredResult(_0x21d386,_0x473828))[_0xbb43('0x43')](handleError(_0x21d386,null));};exports['show']=function(_0x3443f8,_0x5198a2){var _0x42b965={'raw':!![],'where':{'id':_0x3443f8[_0xbb43('0x44')]['id']}},_0x14285d={};_0x14285d[_0xbb43('0x31')]=_[_0xbb43('0x2e')](db[_0xbb43('0x2b')]['rawAttributes']);_0x14285d[_0xbb43('0x2f')]=_['keys'](_0x3443f8[_0xbb43('0x2f')]);_0x14285d[_0xbb43('0x30')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],_0x14285d['query']);_0x42b965[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x14285d[_0xbb43('0x31')],qs[_0xbb43('0x34')](_0x3443f8[_0xbb43('0x2f')][_0xbb43('0x34')]));_0x42b965[_0xbb43('0x32')]=_0x42b965[_0xbb43('0x32')]['length']?_0x42b965[_0xbb43('0x32')]:_0x14285d[_0xbb43('0x31')];if(_0x3443f8['query'][_0xbb43('0x40')]){_0x42b965['include']=[{'all':!![]}];}_0x42b965=_['merge']({},_0x42b965,_0x3443f8['options']);return db['FreshdeskField'][_0xbb43('0x45')](_0x42b965)['then'](handleEntityNotFound(_0x5198a2,null))[_0xbb43('0x42')](respondWithResult(_0x5198a2,null))['catch'](handleError(_0x5198a2,null));};exports[_0xbb43('0x46')]=function(_0x39b6ae,_0x1f3fb4){return db['FreshdeskField'][_0xbb43('0x46')](_0x39b6ae['body'],{})[_0xbb43('0x42')](respondWithResult(_0x1f3fb4,0xc9))[_0xbb43('0x43')](handleError(_0x1f3fb4,null));};exports[_0xbb43('0x23')]=function(_0x29840e,_0x417ad9){if(_0x29840e[_0xbb43('0x47')]['id']){delete _0x29840e[_0xbb43('0x47')]['id'];}return db['FreshdeskField'][_0xbb43('0x45')]({'where':{'id':_0x29840e[_0xbb43('0x44')]['id']}})[_0xbb43('0x42')](handleEntityNotFound(_0x417ad9,null))[_0xbb43('0x42')](saveUpdates(_0x29840e['body'],null))[_0xbb43('0x42')](respondWithResult(_0x417ad9,null))[_0xbb43('0x43')](handleError(_0x417ad9,null));};exports[_0xbb43('0x24')]=function(_0xb1883e,_0x4b7712){return db[_0xbb43('0x2b')][_0xbb43('0x45')]({'where':{'id':_0xb1883e[_0xbb43('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b7712,null))[_0xbb43('0x42')](removeEntity(_0x4b7712,null))[_0xbb43('0x43')](handleError(_0x4b7712,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f849fec..99bc5f1 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 _0x0f67=['freshdesk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x0f67,0xab));var _0x70f6=function(_0x25da54,_0x231b71){_0x25da54=_0x25da54-0x0;var _0x16742e=_0x0f67[_0x25da54];return _0x16742e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x70f6('0x0'))(_0x70f6('0x1'));var moment=require(_0x70f6('0x2'));var BPromise=require(_0x70f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70f6('0x4'));var rimraf=require(_0x70f6('0x5'));var config=require('../../config/environment');var attributes=require(_0x70f6('0x6'));module[_0x70f6('0x7')]=function(_0x34ecf0,_0x138109){return _0x34ecf0[_0x70f6('0x8')](_0x70f6('0x9'),attributes,{'tableName':_0x70f6('0xa'),'paranoid':![],'indexes':[{'name':_0x70f6('0xb'),'fields':[_0x70f6('0xc'),_0x70f6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6759=['freshdesk_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0x151dca,_0x5289e8){var _0x16d158=function(_0x2d3483){while(--_0x2d3483){_0x151dca['push'](_0x151dca['shift']());}};_0x16d158(++_0x5289e8);}(_0x6759,0x10d));var _0x9675=function(_0x1e0d54,_0x46fbec){_0x1e0d54=_0x1e0d54-0x0;var _0x244204=_0x6759[_0x1e0d54];return _0x244204;};'use strict';var _=require('lodash');var util=require(_0x9675('0x0'));var logger=require('../../config/logger')(_0x9675('0x1'));var moment=require(_0x9675('0x2'));var BPromise=require(_0x9675('0x3'));var rp=require(_0x9675('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9675('0x5'));var config=require(_0x9675('0x6'));var attributes=require(_0x9675('0x7'));module[_0x9675('0x8')]=function(_0x4631d0,_0x47ab59){return _0x4631d0['define'](_0x9675('0x9'),attributes,{'tableName':_0x9675('0xa'),'paranoid':![],'indexes':[{'name':_0x9675('0xb'),'fields':[_0x9675('0xc'),_0x9675('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 4e71c98..707e5a7 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 _0xe3d9=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','info','result','message','catch','lodash'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0xe3d9,0x89));var _0x9e3d=function(_0x506312,_0x5b6b8d){_0x506312=_0x506312-0x0;var _0x5bf5d2=_0xe3d9[_0x506312];return _0x5bf5d2;};'use strict';var _=require(_0x9e3d('0x0'));var util=require(_0x9e3d('0x1'));var moment=require(_0x9e3d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e3d('0x4'))['db'];var utils=require(_0x9e3d('0x5'));var logger=require('../../config/logger')(_0x9e3d('0x6'));var config=require(_0x9e3d('0x7'));var jayson=require(_0x9e3d('0x8'));var client=jayson[_0x9e3d('0x9')][_0x9e3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a0187,_0x2094f1,_0x2ab50b){return new BPromise(function(_0x2a8f3a,_0x3d4b53){return client[_0x9e3d('0xb')](_0x3a0187,_0x2ab50b)[_0x9e3d('0xc')](function(_0x29d6b9){logger['info'](_0x9e3d('0xd'),_0x2094f1,_0x9e3d('0xe'));logger[_0x9e3d('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x2094f1,_0x9e3d('0xe'),JSON[_0x9e3d('0x10')](_0x29d6b9));if(_0x29d6b9[_0x9e3d('0x11')]){if(_0x29d6b9['error'][_0x9e3d('0x12')]===0x1f4){logger['error'](_0x9e3d('0xd'),_0x2094f1,_0x29d6b9['error']['message']);return _0x3d4b53(_0x29d6b9[_0x9e3d('0x11')]['message']);}logger[_0x9e3d('0x11')](_0x9e3d('0xd'),_0x2094f1,_0x29d6b9[_0x9e3d('0x11')]['message']);return _0x2a8f3a(_0x29d6b9[_0x9e3d('0x11')]['message']);}else{logger[_0x9e3d('0x13')](_0x9e3d('0xd'),_0x2094f1,'request\x20sent');_0x2a8f3a(_0x29d6b9[_0x9e3d('0x14')][_0x9e3d('0x15')]);}})[_0x9e3d('0x16')](function(_0x3547fd){logger[_0x9e3d('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x2094f1,_0x3547fd);_0x3d4b53(_0x3547fd);});});} \ No newline at end of file +var _0x6c9c=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x6c9c,0x15d));var _0xc6c9=function(_0x1cd39b,_0xd66ca1){_0x1cd39b=_0x1cd39b-0x0;var _0x22124c=_0x6c9c[_0x1cd39b];return _0x22124c;};'use strict';var _=require(_0xc6c9('0x0'));var util=require(_0xc6c9('0x1'));var moment=require(_0xc6c9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6c9('0x3'));var db=require(_0xc6c9('0x4'))['db'];var utils=require(_0xc6c9('0x5'));var logger=require('../../config/logger')(_0xc6c9('0x6'));var config=require(_0xc6c9('0x7'));var jayson=require(_0xc6c9('0x8'));var client=jayson['client'][_0xc6c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f097b,_0x991141,_0x2c0d8d){return new BPromise(function(_0x442667,_0x55b014){return client[_0xc6c9('0xa')](_0x4f097b,_0x2c0d8d)[_0xc6c9('0xb')](function(_0x2185c4){logger[_0xc6c9('0xc')](_0xc6c9('0xd'),_0x991141,_0xc6c9('0xe'));logger[_0xc6c9('0xf')](_0xc6c9('0x10'),_0x991141,_0xc6c9('0xe'),JSON[_0xc6c9('0x11')](_0x2185c4));if(_0x2185c4['error']){if(_0x2185c4[_0xc6c9('0x12')][_0xc6c9('0x13')]===0x1f4){logger[_0xc6c9('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x991141,_0x2185c4['error']['message']);return _0x55b014(_0x2185c4[_0xc6c9('0x12')][_0xc6c9('0x14')]);}logger[_0xc6c9('0x12')](_0xc6c9('0xd'),_0x991141,_0x2185c4[_0xc6c9('0x12')]['message']);return _0x442667(_0x2185c4[_0xc6c9('0x12')][_0xc6c9('0x14')]);}else{logger[_0xc6c9('0xc')](_0xc6c9('0xd'),_0x991141,_0xc6c9('0xe'));_0x442667(_0x2185c4[_0xc6c9('0x15')][_0xc6c9('0x14')]);}})[_0xc6c9('0x16')](function(_0x5ac5bb){logger[_0xc6c9('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x991141,_0x5ac5bb);_0x55b014(_0x5ac5bb);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a335ed7..4b114e2 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 _0x4fc2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','multer','util','path'];(function(_0x40e9b0,_0x5ea497){var _0x169749=function(_0x3d875d){while(--_0x3d875d){_0x40e9b0['push'](_0x40e9b0['shift']());}};_0x169749(++_0x5ea497);}(_0x4fc2,0x111));var _0x24fc=function(_0x3748ab,_0x13059e){_0x3748ab=_0x3748ab-0x0;var _0x3aca73=_0x4fc2[_0x3748ab];return _0x3aca73;};'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')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getConfigurations']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router[_0x24fc('0x11')]('/:id/configurations',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller['destroy']);module[_0x24fc('0x16')]=router; \ No newline at end of file +var _0xb688=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x3e31b9,_0x2e1650){var _0x19ae13=function(_0x97a4fd){while(--_0x97a4fd){_0x3e31b9['push'](_0x3e31b9['shift']());}};_0x19ae13(++_0x2e1650);}(_0xb688,0xcf));var _0x8b68=function(_0x226c88,_0x3b451e){_0x226c88=_0x226c88-0x0;var _0x3bc996=_0xb688[_0x226c88];return _0x3bc996;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x12')]('/',auth[_0x8b68('0xc')](),controller['create']);router[_0x8b68('0x12')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c51e7a2..a901251 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 _0x5b12=['STRING','sequelize','exports'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x5b12,0xa3));var _0x25b1=function(_0x32f743,_0x338d30){_0x32f743=_0x32f743-0x0;var _0xcdb7e=_0x5b12[_0x32f743];return _0xcdb7e;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9536=['username','remoteUri','sequelize','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9536,0x179));var _0x6953=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x9536[_0x2d6197];return _0x4d0e75;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')]},'description':{'type':Sequelize[_0x6953('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6953('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6953('0x2')],'unique':_0x6953('0x4')},'serverUrl':{'type':Sequelize[_0x6953('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 7ee0912..671877e 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 _0x7285=['channel','Descriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','destroy','then','end','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','keys','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7285,0x1bd));var _0x5728=function(_0x4a1fd1,_0x408c0a){_0x4a1fd1=_0x4a1fd1-0x0;var _0x25fd90=_0x7285[_0x4a1fd1];return _0x25fd90;};'use strict';var emlformat=require(_0x5728('0x0'));var rimraf=require(_0x5728('0x1'));var zipdir=require(_0x5728('0x2'));var jsonpatch=require(_0x5728('0x3'));var rp=require(_0x5728('0x4'));var moment=require(_0x5728('0x5'));var BPromise=require(_0x5728('0x6'));var Mustache=require(_0x5728('0x7'));var util=require(_0x5728('0x8'));var path=require(_0x5728('0x9'));var sox=require(_0x5728('0xa'));var csv=require(_0x5728('0xb'));var ejs=require(_0x5728('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5728('0xd'));var squel=require('squel');var crypto=require(_0x5728('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5728('0xf'));var toCsv=require(_0x5728('0xb'));var querystring=require(_0x5728('0x10'));var Papa=require(_0x5728('0x11'));var Redis=require('ioredis');var authService=require(_0x5728('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5728('0x13'));var hardwareService=require(_0x5728('0x14'));var logger=require(_0x5728('0x15'))(_0x5728('0x16'));var utils=require(_0x5728('0x17'));var config=require(_0x5728('0x18'));var licenseUtil=require(_0x5728('0x19'));var db=require(_0x5728('0x1a'))['db'];var integrations=require(_0x5728('0x1b'));function respondWithStatusCode(_0x4e5b66,_0x29f473){_0x29f473=_0x29f473||0xcc;return function(_0x2782a1){if(_0x2782a1){return _0x4e5b66[_0x5728('0x1c')](_0x29f473);}return _0x4e5b66[_0x5728('0x1d')](_0x29f473)['end']();};}function respondWithResult(_0x10cfb1,_0x467a08){_0x467a08=_0x467a08||0xc8;return function(_0x59720d){if(_0x59720d){return _0x10cfb1['status'](_0x467a08)['json'](_0x59720d);}};}function respondWithFilteredResult(_0x503727,_0x38cf2f){return function(_0x21931f){if(_0x21931f){var _0x7a0a56=typeof _0x38cf2f[_0x5728('0x1e')]===_0x5728('0x1f')&&typeof _0x38cf2f[_0x5728('0x20')]==='undefined';var _0x2d60ee=_0x21931f['count'];var _0x1f790d=_0x7a0a56?0x0:_0x38cf2f[_0x5728('0x1e')];var _0x2621aa=_0x7a0a56?_0x21931f['count']:_0x38cf2f[_0x5728('0x1e')]+_0x38cf2f[_0x5728('0x20')];var _0x1df624;if(_0x2621aa>=_0x2d60ee){_0x2621aa=_0x2d60ee;_0x1df624=0xc8;}else{_0x1df624=0xce;}_0x503727[_0x5728('0x1d')](_0x1df624);return _0x503727[_0x5728('0x21')](_0x5728('0x22'),_0x1f790d+'-'+_0x2621aa+'/'+_0x2d60ee)[_0x5728('0x23')](_0x21931f);}return null;};}function patchUpdates(_0x4de74f){return function(_0x3628ca){try{jsonpatch['apply'](_0x3628ca,_0x4de74f,!![]);}catch(_0x15c25a){return BPromise[_0x5728('0x24')](_0x15c25a);}return _0x3628ca['save']();};}function saveUpdates(_0x19791d,_0x33d5a1){return function(_0x2ef5cc){if(_0x2ef5cc){return _0x2ef5cc[_0x5728('0x25')](_0x19791d)['then'](function(_0x1a2594){return _0x1a2594;});}return null;};}function removeEntity(_0x1905e2,_0x1505e2){return function(_0x396531){if(_0x396531){return _0x396531[_0x5728('0x26')]()[_0x5728('0x27')](function(){_0x1905e2[_0x5728('0x1d')](0xcc)[_0x5728('0x28')]();});}};}function handleEntityNotFound(_0x32a89d,_0x549f0f){return function(_0x15effe){if(!_0x15effe){_0x32a89d[_0x5728('0x1c')](0x194);}return _0x15effe;};}function handleError(_0x55c6ad,_0x46b810){_0x46b810=_0x46b810||0x1f4;return function(_0x3d3d92){logger[_0x5728('0x29')](_0x3d3d92[_0x5728('0x2a')]);if(_0x3d3d92[_0x5728('0x2b')]){delete _0x3d3d92[_0x5728('0x2b')];}_0x55c6ad[_0x5728('0x1d')](_0x46b810)[_0x5728('0x2c')](_0x3d3d92);};}exports[_0x5728('0x2d')]=function(_0xa5e7c9,_0x48032e){var _0x10feb0={},_0x1b0fc9={},_0x59bad0={'count':0x0,'rows':[]};var _0x515536=_[_0x5728('0x2e')](db[_0x5728('0x2f')]['rawAttributes'],function(_0x520ce6){return{'name':_0x520ce6[_0x5728('0x30')],'type':_0x520ce6[_0x5728('0x31')][_0x5728('0x32')]};});_0x1b0fc9['model']=_[_0x5728('0x2e')](_0x515536,_0x5728('0x2b'));_0x1b0fc9['query']=_[_0x5728('0x33')](_0xa5e7c9[_0x5728('0x34')]);_0x1b0fc9['filters']=_[_0x5728('0x35')](_0x1b0fc9[_0x5728('0x36')],_0x1b0fc9[_0x5728('0x34')]);_0x10feb0[_0x5728('0x37')]=_[_0x5728('0x35')](_0x1b0fc9[_0x5728('0x36')],qs['fields'](_0xa5e7c9['query']['fields']));_0x10feb0[_0x5728('0x37')]=_0x10feb0['attributes'][_0x5728('0x38')]?_0x10feb0[_0x5728('0x37')]:_0x1b0fc9[_0x5728('0x36')];if(!_0xa5e7c9[_0x5728('0x34')][_0x5728('0x39')](_0x5728('0x3a'))){_0x10feb0[_0x5728('0x20')]=qs[_0x5728('0x20')](_0xa5e7c9[_0x5728('0x34')][_0x5728('0x20')]);_0x10feb0[_0x5728('0x1e')]=qs[_0x5728('0x1e')](_0xa5e7c9['query'][_0x5728('0x1e')]);}_0x10feb0[_0x5728('0x3b')]=qs['sort'](_0xa5e7c9['query'][_0x5728('0x3c')]);_0x10feb0[_0x5728('0x3d')]=qs['filters'](_[_0x5728('0x3e')](_0xa5e7c9[_0x5728('0x34')],_0x1b0fc9[_0x5728('0x3f')]),_0x515536);if(_0xa5e7c9[_0x5728('0x34')][_0x5728('0x40')]){_0x10feb0[_0x5728('0x3d')]=_[_0x5728('0x41')](_0x10feb0[_0x5728('0x3d')],{'$or':_[_0x5728('0x2e')](_0x515536,function(_0x538a97){if(_0x538a97[_0x5728('0x31')]!==_0x5728('0x42')){var _0x3c14af={};_0x3c14af[_0x538a97[_0x5728('0x2b')]]={'$like':'%'+_0xa5e7c9[_0x5728('0x34')][_0x5728('0x40')]+'%'};return _0x3c14af;}})});}_0x10feb0=_[_0x5728('0x41')]({},_0x10feb0,_0xa5e7c9[_0x5728('0x43')]);var _0x4aa8f9={'where':_0x10feb0['where']};return db['FreshsalesAccount'][_0x5728('0x44')](_0x4aa8f9)[_0x5728('0x27')](function(_0x49aea4){_0x59bad0[_0x5728('0x44')]=_0x49aea4;if(_0xa5e7c9['query']['includeAll']){_0x10feb0[_0x5728('0x45')]=[{'all':!![]}];}return db[_0x5728('0x2f')][_0x5728('0x46')](_0x10feb0);})['then'](function(_0x19a7b1){_0x59bad0[_0x5728('0x47')]=_0x19a7b1;return _0x59bad0;})[_0x5728('0x27')](respondWithFilteredResult(_0x48032e,_0x10feb0))[_0x5728('0x48')](handleError(_0x48032e,null));};exports[_0x5728('0x49')]=function(_0x16fb37,_0x46991f){var _0x41e41b={'raw':![],'where':{'id':_0x16fb37['params']['id']}},_0x57836d={};_0x57836d[_0x5728('0x36')]=_[_0x5728('0x33')](db['FreshsalesAccount'][_0x5728('0x4a')]);_0x57836d[_0x5728('0x34')]=_['keys'](_0x16fb37[_0x5728('0x34')]);_0x57836d[_0x5728('0x3f')]=_[_0x5728('0x35')](_0x57836d[_0x5728('0x36')],_0x57836d['query']);_0x41e41b[_0x5728('0x37')]=_[_0x5728('0x35')](_0x57836d['model'],qs[_0x5728('0x4b')](_0x16fb37[_0x5728('0x34')][_0x5728('0x4b')]));_0x41e41b['attributes']=_0x41e41b[_0x5728('0x37')]['length']?_0x41e41b[_0x5728('0x37')]:_0x57836d[_0x5728('0x36')];if(_0x16fb37[_0x5728('0x34')][_0x5728('0x4c')]){_0x41e41b['include']=[{'all':!![]}];}_0x41e41b=_[_0x5728('0x41')]({},_0x41e41b,_0x16fb37[_0x5728('0x43')]);return db[_0x5728('0x2f')]['find'](_0x41e41b)[_0x5728('0x27')](handleEntityNotFound(_0x46991f,null))['then'](respondWithResult(_0x46991f,null))[_0x5728('0x48')](handleError(_0x46991f,null));};exports[_0x5728('0x4d')]=function(_0x2156ad,_0xa2481d){return db[_0x5728('0x2f')][_0x5728('0x4d')](_0x2156ad[_0x5728('0x4e')],{})[_0x5728('0x27')](respondWithResult(_0xa2481d,0xc9))['catch'](handleError(_0xa2481d,null));};exports[_0x5728('0x25')]=function(_0x52de4a,_0x4b7ecc){if(_0x52de4a[_0x5728('0x4e')]['id']){delete _0x52de4a[_0x5728('0x4e')]['id'];}return db[_0x5728('0x2f')]['find']({'where':{'id':_0x52de4a[_0x5728('0x4f')]['id']}})[_0x5728('0x27')](handleEntityNotFound(_0x4b7ecc,null))[_0x5728('0x27')](saveUpdates(_0x52de4a['body'],null))[_0x5728('0x27')](respondWithResult(_0x4b7ecc,null))[_0x5728('0x48')](handleError(_0x4b7ecc,null));};exports[_0x5728('0x26')]=function(_0x41d175,_0x467d8c){return db[_0x5728('0x2f')]['find']({'where':{'id':_0x41d175[_0x5728('0x4f')]['id']}})[_0x5728('0x27')](handleEntityNotFound(_0x467d8c,null))['then'](removeEntity(_0x467d8c,null))['catch'](handleError(_0x467d8c,null));};exports[_0x5728('0x50')]=function(_0x52123b,_0x457266,_0x46d0f6){var _0x453385={};var _0x11530a={};var _0x79bb2b;var _0x368228;return db['FreshsalesAccount'][_0x5728('0x51')]({'where':{'id':_0x52123b[_0x5728('0x4f')]['id']}})['then'](handleEntityNotFound(_0x457266,null))[_0x5728('0x27')](function(_0x200fdb){if(_0x200fdb){_0x79bb2b=_0x200fdb;_0x11530a[_0x5728('0x36')]=_[_0x5728('0x33')](db[_0x5728('0x52')]['rawAttributes']);_0x11530a[_0x5728('0x34')]=_[_0x5728('0x33')](_0x52123b[_0x5728('0x34')]);_0x11530a[_0x5728('0x3f')]=_['intersection'](_0x11530a['model'],_0x11530a[_0x5728('0x34')]);_0x453385[_0x5728('0x37')]=_[_0x5728('0x35')](_0x11530a[_0x5728('0x36')],qs[_0x5728('0x4b')](_0x52123b[_0x5728('0x34')][_0x5728('0x4b')]));_0x453385[_0x5728('0x37')]=_0x453385[_0x5728('0x37')][_0x5728('0x38')]?_0x453385[_0x5728('0x37')]:_0x11530a[_0x5728('0x36')];_0x453385[_0x5728('0x3b')]=qs['sort'](_0x52123b['query'][_0x5728('0x3c')]);_0x453385[_0x5728('0x3d')]=qs[_0x5728('0x3f')](_[_0x5728('0x3e')](_0x52123b[_0x5728('0x34')],_0x11530a[_0x5728('0x3f')]));if(_0x52123b[_0x5728('0x34')]['filter']){_0x453385['where']=_[_0x5728('0x41')](_0x453385[_0x5728('0x3d')],{'$or':_[_0x5728('0x2e')](_0x453385['attributes'],function(_0x20f438){var _0x117772={};_0x117772[_0x20f438]={'$like':'%'+_0x52123b[_0x5728('0x34')][_0x5728('0x40')]+'%'};return _0x117772;})});}_0x453385=_[_0x5728('0x41')]({},_0x453385,_0x52123b[_0x5728('0x43')]);return _0x79bb2b['getConfigurations'](_0x453385);}})[_0x5728('0x27')](function(_0x4bf2a5){if(_0x4bf2a5){_0x368228=_0x4bf2a5[_0x5728('0x38')];if(!_0x52123b['query'][_0x5728('0x39')](_0x5728('0x3a'))){_0x453385['limit']=qs[_0x5728('0x20')](_0x52123b[_0x5728('0x34')][_0x5728('0x20')]);_0x453385[_0x5728('0x1e')]=qs[_0x5728('0x1e')](_0x52123b[_0x5728('0x34')][_0x5728('0x1e')]);}return _0x79bb2b[_0x5728('0x50')](_0x453385);}})[_0x5728('0x27')](function(_0x596666){if(_0x596666){return _0x596666?{'count':_0x368228,'rows':_0x596666}:null;}})[_0x5728('0x27')](respondWithResult(_0x457266,null))[_0x5728('0x48')](handleError(_0x457266,null));};exports[_0x5728('0x53')]=function(_0x1dc061,_0x407f72,_0x4ea298){if(_0x1dc061[_0x5728('0x4e')]['id']){delete _0x1dc061[_0x5728('0x4e')]['id'];}return db[_0x5728('0x2f')][_0x5728('0x51')]({'where':{'id':_0x1dc061[_0x5728('0x4f')]['id']}})['then'](handleEntityNotFound(_0x407f72,null))[_0x5728('0x27')](function(_0x5851b5){if(_0x5851b5){_0x1dc061[_0x5728('0x4e')][_0x5728('0x54')]=_0x5851b5['id'];_0x1dc061[_0x5728('0x4e')]['Subjects']=integrations['getSubjects'](_0x1dc061[_0x5728('0x4e')][_0x5728('0x55')],_0x1dc061[_0x5728('0x4e')]['type']);_0x1dc061['body'][_0x5728('0x56')]=integrations['getDescriptions'](_0x1dc061[_0x5728('0x4e')][_0x5728('0x55')],_0x1dc061[_0x5728('0x4e')][_0x5728('0x31')]);return db[_0x5728('0x52')][_0x5728('0x4d')](_0x1dc061[_0x5728('0x4e')],{'include':[{'model':db[_0x5728('0x57')],'as':_0x5728('0x58')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x5728('0x27')](respondWithResult(_0x407f72,null))[_0x5728('0x48')](handleError(_0x407f72,null));};exports[_0x5728('0x59')]=function(_0x630588,_0x553300,_0x563e8c){var _0x48edb='';var _0x4159f9='';return db['FreshsalesAccount'][_0x5728('0x51')]({'where':{'id':_0x630588[_0x5728('0x4f')]['id']},'attributes':['id',_0x5728('0x5a'),_0x5728('0x5b'),_0x5728('0x5c')]})['then'](handleEntityNotFound(_0x553300,null))[_0x5728('0x27')](function(_0x52142e){if(_0x52142e){_0x4159f9=_0x52142e['username'];_0x48edb=_0x52142e[_0x5728('0x5b')];var _0x12369a=_0x52142e[_0x5728('0x5b')]['slice'](-0x1);if(_0x12369a==='/'){_0x48edb=_0x48edb[_0x5728('0x5d')](0x0,_0x48edb['lastIndexOf'](_0x12369a));}return rp({'method':_0x5728('0x5e'),'uri':util[_0x5728('0x5f')](_0x5728('0x60'),_0x48edb,_0x5728('0x61')),'headers':{'Authorization':_0x5728('0x62')+_0x52142e[_0x5728('0x5c')]},'json':!![]});}})['then'](function(_0x2a49d6){if(_0x2a49d6){var _0x4f7233=_0x2a49d6[_0x5728('0x63')];var _0x534867=![];var _0x5a8866=null;for(_0x5a8866=0x0;_0x5a8866<_0x4f7233[_0x5728('0x38')];_0x5a8866++){if(_0x4f7233[_0x5a8866]['email']===_0x4159f9){_0x534867=!![];}}if(_0x534867){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5728('0x64')});}}})[_0x5728('0x27')](respondWithResult(_0x553300,null))[_0x5728('0x48')](function(_0x1d4fee){var _0x1cb444=_0x630588[_0x5728('0x34')][_0x5728('0x65')]?0x1f4:_0x1d4fee['statusCode']||0x1f4;logger[_0x5728('0x29')](_0x5728('0x66'),_0x5728('0x59'),_0x1cb444,JSON[_0x5728('0x67')](_0x1d4fee));delete _0x1d4fee[_0x5728('0x2b')];if(_0x1cb444===0x191){_0x1cb444=0x190;}_0x553300[_0x5728('0x1d')](_0x1cb444)[_0x5728('0x2c')](_0x630588['query'][_0x5728('0x65')]?{'message':_0x5728('0x68'),'statusCode':_0x1d4fee[_0x5728('0x69')]}:_0x1d4fee);});}; \ No newline at end of file +var _0x158f=['fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','FreshsalesField','Descriptions','username','remoteUri','apiKey','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes'];(function(_0x511b9e,_0x4ea780){var _0x2f5c28=function(_0x212f20){while(--_0x212f20){_0x511b9e['push'](_0x511b9e['shift']());}};_0x2f5c28(++_0x4ea780);}(_0x158f,0xa2));var _0xf158=function(_0x33cb5f,_0x333504){_0x33cb5f=_0x33cb5f-0x0;var _0x39502a=_0x158f[_0x33cb5f];return _0x39502a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf158('0x0'));var zipdir=require(_0xf158('0x1'));var jsonpatch=require(_0xf158('0x2'));var rp=require(_0xf158('0x3'));var moment=require('moment');var BPromise=require(_0xf158('0x4'));var Mustache=require(_0xf158('0x5'));var util=require('util');var path=require(_0xf158('0x6'));var sox=require(_0xf158('0x7'));var csv=require(_0xf158('0x8'));var ejs=require(_0xf158('0x9'));var fs=require('fs');var fs_extra=require(_0xf158('0xa'));var _=require(_0xf158('0xb'));var squel=require(_0xf158('0xc'));var crypto=require(_0xf158('0xd'));var jsforce=require(_0xf158('0xe'));var deskjs=require(_0xf158('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf158('0x10'));var Papa=require(_0xf158('0x11'));var Redis=require(_0xf158('0x12'));var authService=require(_0xf158('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf158('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf158('0x15'));var utils=require(_0xf158('0x16'));var config=require(_0xf158('0x17'));var licenseUtil=require(_0xf158('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf158('0x19'));function respondWithStatusCode(_0x2dcdbb,_0x1c5c96){_0x1c5c96=_0x1c5c96||0xcc;return function(_0x326e5e){if(_0x326e5e){return _0x2dcdbb[_0xf158('0x1a')](_0x1c5c96);}return _0x2dcdbb[_0xf158('0x1b')](_0x1c5c96)[_0xf158('0x1c')]();};}function respondWithResult(_0x346541,_0x259d4f){_0x259d4f=_0x259d4f||0xc8;return function(_0x31c7f7){if(_0x31c7f7){return _0x346541[_0xf158('0x1b')](_0x259d4f)[_0xf158('0x1d')](_0x31c7f7);}};}function respondWithFilteredResult(_0x5e0e74,_0x23ebeb){return function(_0x252703){if(_0x252703){var _0x2f39a2=typeof _0x23ebeb[_0xf158('0x1e')]===_0xf158('0x1f')&&typeof _0x23ebeb[_0xf158('0x20')]===_0xf158('0x1f');var _0x22c07=_0x252703['count'];var _0x51727a=_0x2f39a2?0x0:_0x23ebeb[_0xf158('0x1e')];var _0x3d7b3f=_0x2f39a2?_0x252703['count']:_0x23ebeb['offset']+_0x23ebeb[_0xf158('0x20')];var _0x3f2888;if(_0x3d7b3f>=_0x22c07){_0x3d7b3f=_0x22c07;_0x3f2888=0xc8;}else{_0x3f2888=0xce;}_0x5e0e74[_0xf158('0x1b')](_0x3f2888);return _0x5e0e74[_0xf158('0x21')](_0xf158('0x22'),_0x51727a+'-'+_0x3d7b3f+'/'+_0x22c07)['json'](_0x252703);}return null;};}function patchUpdates(_0x544ff2){return function(_0x149e52){try{jsonpatch[_0xf158('0x23')](_0x149e52,_0x544ff2,!![]);}catch(_0x4d20bc){return BPromise[_0xf158('0x24')](_0x4d20bc);}return _0x149e52[_0xf158('0x25')]();};}function saveUpdates(_0x51c857,_0x559871){return function(_0x524cf0){if(_0x524cf0){return _0x524cf0[_0xf158('0x26')](_0x51c857)[_0xf158('0x27')](function(_0xe16a5b){return _0xe16a5b;});}return null;};}function removeEntity(_0x518e10,_0x221f24){return function(_0x2e49a3){if(_0x2e49a3){return _0x2e49a3[_0xf158('0x28')]()[_0xf158('0x27')](function(){_0x518e10[_0xf158('0x1b')](0xcc)[_0xf158('0x1c')]();});}};}function handleEntityNotFound(_0x36f8b9,_0x5e95db){return function(_0x1c49ef){if(!_0x1c49ef){_0x36f8b9[_0xf158('0x1a')](0x194);}return _0x1c49ef;};}function handleError(_0x17e820,_0x3715e9){_0x3715e9=_0x3715e9||0x1f4;return function(_0x4a1e63){logger[_0xf158('0x29')](_0x4a1e63[_0xf158('0x2a')]);if(_0x4a1e63[_0xf158('0x2b')]){delete _0x4a1e63[_0xf158('0x2b')];}_0x17e820[_0xf158('0x1b')](_0x3715e9)[_0xf158('0x2c')](_0x4a1e63);};}exports['index']=function(_0xe2d5ed,_0x3e976c){var _0x1fdd69={},_0x2fd558={},_0x2afb34={'count':0x0,'rows':[]};var _0x4c8102=_[_0xf158('0x2d')](db[_0xf158('0x2e')][_0xf158('0x2f')],function(_0x1d22a1){return{'name':_0x1d22a1[_0xf158('0x30')],'type':_0x1d22a1[_0xf158('0x31')][_0xf158('0x32')]};});_0x2fd558[_0xf158('0x33')]=_[_0xf158('0x2d')](_0x4c8102,'name');_0x2fd558[_0xf158('0x34')]=_[_0xf158('0x35')](_0xe2d5ed[_0xf158('0x34')]);_0x2fd558['filters']=_[_0xf158('0x36')](_0x2fd558['model'],_0x2fd558['query']);_0x1fdd69[_0xf158('0x37')]=_[_0xf158('0x36')](_0x2fd558[_0xf158('0x33')],qs[_0xf158('0x38')](_0xe2d5ed[_0xf158('0x34')][_0xf158('0x38')]));_0x1fdd69[_0xf158('0x37')]=_0x1fdd69['attributes']['length']?_0x1fdd69[_0xf158('0x37')]:_0x2fd558[_0xf158('0x33')];if(!_0xe2d5ed[_0xf158('0x34')][_0xf158('0x39')](_0xf158('0x3a'))){_0x1fdd69[_0xf158('0x20')]=qs[_0xf158('0x20')](_0xe2d5ed[_0xf158('0x34')]['limit']);_0x1fdd69[_0xf158('0x1e')]=qs[_0xf158('0x1e')](_0xe2d5ed[_0xf158('0x34')][_0xf158('0x1e')]);}_0x1fdd69[_0xf158('0x3b')]=qs[_0xf158('0x3c')](_0xe2d5ed[_0xf158('0x34')][_0xf158('0x3c')]);_0x1fdd69[_0xf158('0x3d')]=qs[_0xf158('0x3e')](_[_0xf158('0x3f')](_0xe2d5ed[_0xf158('0x34')],_0x2fd558[_0xf158('0x3e')]),_0x4c8102);if(_0xe2d5ed[_0xf158('0x34')][_0xf158('0x40')]){_0x1fdd69['where']=_[_0xf158('0x41')](_0x1fdd69['where'],{'$or':_[_0xf158('0x2d')](_0x4c8102,function(_0x231b32){if(_0x231b32[_0xf158('0x31')]!==_0xf158('0x42')){var _0x204c03={};_0x204c03[_0x231b32[_0xf158('0x2b')]]={'$like':'%'+_0xe2d5ed[_0xf158('0x34')][_0xf158('0x40')]+'%'};return _0x204c03;}})});}_0x1fdd69=_[_0xf158('0x41')]({},_0x1fdd69,_0xe2d5ed[_0xf158('0x43')]);var _0x4f19bf={'where':_0x1fdd69['where']};return db['FreshsalesAccount'][_0xf158('0x44')](_0x4f19bf)[_0xf158('0x27')](function(_0xf6331c){_0x2afb34[_0xf158('0x44')]=_0xf6331c;if(_0xe2d5ed[_0xf158('0x34')][_0xf158('0x45')]){_0x1fdd69[_0xf158('0x46')]=[{'all':!![]}];}return db[_0xf158('0x2e')][_0xf158('0x47')](_0x1fdd69);})['then'](function(_0x468e98){_0x2afb34[_0xf158('0x48')]=_0x468e98;return _0x2afb34;})[_0xf158('0x27')](respondWithFilteredResult(_0x3e976c,_0x1fdd69))[_0xf158('0x49')](handleError(_0x3e976c,null));};exports[_0xf158('0x4a')]=function(_0x151afc,_0x91799a){var _0x41273c={'raw':![],'where':{'id':_0x151afc[_0xf158('0x4b')]['id']}},_0x49784f={};_0x49784f[_0xf158('0x33')]=_[_0xf158('0x35')](db[_0xf158('0x2e')][_0xf158('0x2f')]);_0x49784f['query']=_[_0xf158('0x35')](_0x151afc['query']);_0x49784f[_0xf158('0x3e')]=_[_0xf158('0x36')](_0x49784f[_0xf158('0x33')],_0x49784f['query']);_0x41273c[_0xf158('0x37')]=_[_0xf158('0x36')](_0x49784f[_0xf158('0x33')],qs['fields'](_0x151afc[_0xf158('0x34')][_0xf158('0x38')]));_0x41273c['attributes']=_0x41273c[_0xf158('0x37')][_0xf158('0x4c')]?_0x41273c[_0xf158('0x37')]:_0x49784f[_0xf158('0x33')];if(_0x151afc[_0xf158('0x34')]['includeAll']){_0x41273c[_0xf158('0x46')]=[{'all':!![]}];}_0x41273c=_[_0xf158('0x41')]({},_0x41273c,_0x151afc[_0xf158('0x43')]);return db['FreshsalesAccount'][_0xf158('0x4d')](_0x41273c)[_0xf158('0x27')](handleEntityNotFound(_0x91799a,null))['then'](respondWithResult(_0x91799a,null))['catch'](handleError(_0x91799a,null));};exports['create']=function(_0x24453a,_0x4d1f47){return db[_0xf158('0x2e')][_0xf158('0x4e')](_0x24453a['body'],{})[_0xf158('0x27')](respondWithResult(_0x4d1f47,0xc9))[_0xf158('0x49')](handleError(_0x4d1f47,null));};exports[_0xf158('0x26')]=function(_0x5d20dc,_0x4ec683){if(_0x5d20dc[_0xf158('0x4f')]['id']){delete _0x5d20dc[_0xf158('0x4f')]['id'];}return db[_0xf158('0x2e')]['find']({'where':{'id':_0x5d20dc['params']['id']}})[_0xf158('0x27')](handleEntityNotFound(_0x4ec683,null))[_0xf158('0x27')](saveUpdates(_0x5d20dc[_0xf158('0x4f')],null))[_0xf158('0x27')](respondWithResult(_0x4ec683,null))['catch'](handleError(_0x4ec683,null));};exports[_0xf158('0x28')]=function(_0x4b2c27,_0x2196f6){return db[_0xf158('0x2e')]['find']({'where':{'id':_0x4b2c27['params']['id']}})[_0xf158('0x27')](handleEntityNotFound(_0x2196f6,null))[_0xf158('0x27')](removeEntity(_0x2196f6,null))['catch'](handleError(_0x2196f6,null));};exports[_0xf158('0x50')]=function(_0xee9a58,_0x1cd0db,_0x3af408){var _0x3d9bd2={};var _0x26aee6={};var _0x3a377e;var _0xbfa17;return db[_0xf158('0x2e')][_0xf158('0x51')]({'where':{'id':_0xee9a58['params']['id']}})[_0xf158('0x27')](handleEntityNotFound(_0x1cd0db,null))[_0xf158('0x27')](function(_0x4b710f){if(_0x4b710f){_0x3a377e=_0x4b710f;_0x26aee6[_0xf158('0x33')]=_['keys'](db[_0xf158('0x52')][_0xf158('0x2f')]);_0x26aee6[_0xf158('0x34')]=_[_0xf158('0x35')](_0xee9a58[_0xf158('0x34')]);_0x26aee6[_0xf158('0x3e')]=_[_0xf158('0x36')](_0x26aee6[_0xf158('0x33')],_0x26aee6[_0xf158('0x34')]);_0x3d9bd2[_0xf158('0x37')]=_['intersection'](_0x26aee6[_0xf158('0x33')],qs[_0xf158('0x38')](_0xee9a58[_0xf158('0x34')][_0xf158('0x38')]));_0x3d9bd2[_0xf158('0x37')]=_0x3d9bd2['attributes'][_0xf158('0x4c')]?_0x3d9bd2[_0xf158('0x37')]:_0x26aee6[_0xf158('0x33')];_0x3d9bd2['order']=qs[_0xf158('0x3c')](_0xee9a58['query'][_0xf158('0x3c')]);_0x3d9bd2[_0xf158('0x3d')]=qs[_0xf158('0x3e')](_[_0xf158('0x3f')](_0xee9a58[_0xf158('0x34')],_0x26aee6[_0xf158('0x3e')]));if(_0xee9a58['query']['filter']){_0x3d9bd2[_0xf158('0x3d')]=_[_0xf158('0x41')](_0x3d9bd2[_0xf158('0x3d')],{'$or':_[_0xf158('0x2d')](_0x3d9bd2['attributes'],function(_0x30093b){var _0x1c24f3={};_0x1c24f3[_0x30093b]={'$like':'%'+_0xee9a58[_0xf158('0x34')]['filter']+'%'};return _0x1c24f3;})});}_0x3d9bd2=_[_0xf158('0x41')]({},_0x3d9bd2,_0xee9a58['options']);return _0x3a377e['getConfigurations'](_0x3d9bd2);}})[_0xf158('0x27')](function(_0x1cfa18){if(_0x1cfa18){_0xbfa17=_0x1cfa18['length'];if(!_0xee9a58[_0xf158('0x34')][_0xf158('0x39')](_0xf158('0x3a'))){_0x3d9bd2[_0xf158('0x20')]=qs[_0xf158('0x20')](_0xee9a58[_0xf158('0x34')][_0xf158('0x20')]);_0x3d9bd2[_0xf158('0x1e')]=qs[_0xf158('0x1e')](_0xee9a58[_0xf158('0x34')][_0xf158('0x1e')]);}return _0x3a377e[_0xf158('0x50')](_0x3d9bd2);}})[_0xf158('0x27')](function(_0x34694d){if(_0x34694d){return _0x34694d?{'count':_0xbfa17,'rows':_0x34694d}:null;}})['then'](respondWithResult(_0x1cd0db,null))[_0xf158('0x49')](handleError(_0x1cd0db,null));};exports[_0xf158('0x53')]=function(_0x18dbe4,_0x1dfc9b,_0x444789){if(_0x18dbe4[_0xf158('0x4f')]['id']){delete _0x18dbe4[_0xf158('0x4f')]['id'];}return db[_0xf158('0x2e')][_0xf158('0x51')]({'where':{'id':_0x18dbe4['params']['id']}})[_0xf158('0x27')](handleEntityNotFound(_0x1dfc9b,null))['then'](function(_0x42ffdf){if(_0x42ffdf){_0x18dbe4['body'][_0xf158('0x54')]=_0x42ffdf['id'];_0x18dbe4[_0xf158('0x4f')][_0xf158('0x55')]=integrations[_0xf158('0x56')](_0x18dbe4[_0xf158('0x4f')]['channel'],_0x18dbe4[_0xf158('0x4f')][_0xf158('0x31')]);_0x18dbe4[_0xf158('0x4f')]['Descriptions']=integrations[_0xf158('0x57')](_0x18dbe4[_0xf158('0x4f')][_0xf158('0x58')],_0x18dbe4['body'][_0xf158('0x31')]);return db[_0xf158('0x52')][_0xf158('0x4e')](_0x18dbe4[_0xf158('0x4f')],{'include':[{'model':db[_0xf158('0x59')],'as':_0xf158('0x55')},{'model':db[_0xf158('0x59')],'as':_0xf158('0x5a')}]});}return null;})['then'](respondWithResult(_0x1dfc9b,null))[_0xf158('0x49')](handleError(_0x1dfc9b,null));};exports['getFields']=function(_0x46a278,_0x3c1b1f,_0xd2dda1){var _0x350205='';var _0x4b97a8='';return db[_0xf158('0x2e')][_0xf158('0x51')]({'where':{'id':_0x46a278[_0xf158('0x4b')]['id']},'attributes':['id',_0xf158('0x5b'),_0xf158('0x5c'),_0xf158('0x5d')]})[_0xf158('0x27')](handleEntityNotFound(_0x3c1b1f,null))[_0xf158('0x27')](function(_0x17d5a8){if(_0x17d5a8){_0x4b97a8=_0x17d5a8[_0xf158('0x5b')];_0x350205=_0x17d5a8[_0xf158('0x5c')];var _0x5ce1d5=_0x17d5a8[_0xf158('0x5c')][_0xf158('0x5e')](-0x1);if(_0x5ce1d5==='/'){_0x350205=_0x350205[_0xf158('0x5f')](0x0,_0x350205['lastIndexOf'](_0x5ce1d5));}return rp({'method':_0xf158('0x60'),'uri':util['format'](_0xf158('0x61'),_0x350205,_0xf158('0x62')),'headers':{'Authorization':_0xf158('0x63')+_0x17d5a8[_0xf158('0x5d')]},'json':!![]});}})['then'](function(_0x20bde0){if(_0x20bde0){var _0x18b462=_0x20bde0[_0xf158('0x64')];var _0x3b7f62=![];var _0x19044d=null;for(_0x19044d=0x0;_0x19044d<_0x18b462[_0xf158('0x4c')];_0x19044d++){if(_0x18b462[_0x19044d][_0xf158('0x65')]===_0x4b97a8){_0x3b7f62=!![];}}if(_0x3b7f62){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf158('0x66')});}}})[_0xf158('0x27')](respondWithResult(_0x3c1b1f,null))[_0xf158('0x49')](function(_0x4cc1cc){var _0x32d426=_0x46a278[_0xf158('0x34')][_0xf158('0x67')]?0x1f4:_0x4cc1cc[_0xf158('0x68')]||0x1f4;logger[_0xf158('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x32d426,JSON['stringify'](_0x4cc1cc));delete _0x4cc1cc['name'];if(_0x32d426===0x191){_0x32d426=0x190;}_0x3c1b1f[_0xf158('0x1b')](_0x32d426)[_0xf158('0x2c')](_0x46a278[_0xf158('0x34')][_0xf158('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x4cc1cc[_0xf158('0x68')]}:_0x4cc1cc);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4d6dd05..7282d44 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ee1=['request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','moment','bluebird'];(function(_0x5da997,_0x3e05c2){var _0x1e6f53=function(_0x5caff6){while(--_0x5caff6){_0x5da997['push'](_0x5da997['shift']());}};_0x1e6f53(++_0x3e05c2);}(_0x7ee1,0x8d));var _0x17ee=function(_0xd684bd,_0x5d9e03){_0xd684bd=_0xd684bd-0x0;var _0x4cbd09=_0x7ee1[_0xd684bd];return _0x4cbd09;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));var integrations=require(_0x17ee('0x7'));module['exports']=function(_0x52b1db,_0x29b9eb){return _0x52b1db['define'](_0x17ee('0x8'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x1a4e74,_0x49f161){var _0x2bd9c6=function(_0x36f469){while(--_0x36f469){_0x1a4e74['push'](_0x1a4e74['shift']());}};_0x2bd9c6(++_0x49f161);}(_0xba34,0x119));var _0x4ba3=function(_0x4d21d4,_0x3ecb7a){_0x4d21d4=_0x4d21d4-0x0;var _0x11448f=_0xba34[_0x4d21d4];return _0x11448f;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 3f5d9bb..896c2fc 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 _0x5f66=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4e9a88,_0x237d72){var _0x232249=function(_0x52f021){while(--_0x52f021){_0x4e9a88['push'](_0x4e9a88['shift']());}};_0x232249(++_0x237d72);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['FreshsalesAccount'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowFreshsalesAccount',_0x144e55);logger[_0x65f6('0xd')]('ShowFreshsalesAccount',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowFreshsalesAccount',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x2272=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','raw','ShowFreshsalesAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')]({'raw':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x531f75[_0x2227('0x1b')]?_0x531f75['options'][_0x2227('0x1c')]||null:null,'attributes':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'limit':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1e')]||null:null,'include':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1f')]?_[_0x2227('0x20')](_0x531f75['options'][_0x2227('0x1f')],function(_0x42d500){return{'model':db[_0x42d500['model']],'as':_0x42d500['as'],'attributes':_0x42d500[_0x2227('0x1d')],'include':_0x42d500[_0x2227('0x1f')]?_['map'](_0x42d500['include'],function(_0x17c7a4){return{'model':db[_0x17c7a4[_0x2227('0x21')]],'as':_0x17c7a4['as'],'attributes':_0x17c7a4[_0x2227('0x1d')],'include':_0x17c7a4[_0x2227('0x1f')]?_['map'](_0x17c7a4[_0x2227('0x1f')],function(_0x301304){return{'model':db[_0x301304[_0x2227('0x21')]],'as':_0x301304['as'],'attributes':_0x301304[_0x2227('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x204def){logger[_0x2227('0xd')](_0x2227('0x18'),_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x204def));_0x620012(_0x204def);})['catch'](function(_0x5d1d56){logger[_0x2227('0x12')]('GetFreshsalesAccount',_0x5d1d56[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0x5d1d56['message']));});});};exports['ShowFreshsalesAccount']=function(_0x1f1ba7){var _0x1818ba=this;return new Promise(function(_0x21838a,_0x4cc1e1){return db[_0x2227('0x19')]['find']({'raw':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x22')]===undefined?!![]:![]:!![],'where':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1c')]||null:null,'attributes':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'include':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')]['include']?_[_0x2227('0x20')](_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1f')],function(_0x6cd5d7){return{'model':db[_0x6cd5d7['model']],'as':_0x6cd5d7['as'],'attributes':_0x6cd5d7[_0x2227('0x1d')],'include':_0x6cd5d7[_0x2227('0x1f')]?_[_0x2227('0x20')](_0x6cd5d7[_0x2227('0x1f')],function(_0x5186a6){return{'model':db[_0x5186a6[_0x2227('0x21')]],'as':_0x5186a6['as'],'attributes':_0x5186a6[_0x2227('0x1d')],'include':_0x5186a6[_0x2227('0x1f')]?_['map'](_0x5186a6['include'],function(_0x35d9f1){return{'model':db[_0x35d9f1[_0x2227('0x21')]],'as':_0x35d9f1['as'],'attributes':_0x35d9f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2227('0xc')](function(_0x9a8cc3){logger['info'](_0x2227('0x23'),_0x1f1ba7);logger['debug'](_0x2227('0x23'),_0x1f1ba7,JSON[_0x2227('0x11')](_0x9a8cc3));_0x21838a(_0x9a8cc3);})[_0x2227('0x17')](function(_0x36db00){logger['error'](_0x2227('0x23'),_0x36db00['message'],_0x1f1ba7);_0x4cc1e1(_0x1818ba[_0x2227('0x12')](0x1f4,_0x36db00[_0x2227('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f67ae8c..11ba13d 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 _0x47ae=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getSubjects'];(function(_0x111ee6,_0xd8a3ea){var _0x8bbb51=function(_0x273011){while(--_0x273011){_0x111ee6['push'](_0x111ee6['shift']());}};_0x8bbb51(++_0xd8a3ea);}(_0x47ae,0xb3));var _0xe47a=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x47ae[_0x1602ef];return _0x5870ee;};'use strict';var multer=require(_0xe47a('0x0'));var util=require('util');var path=require(_0xe47a('0x1'));var timeout=require(_0xe47a('0x2'));var express=require(_0xe47a('0x3'));var router=express[_0xe47a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe47a('0x5'));var interaction=require(_0xe47a('0x6'));var config=require(_0xe47a('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xe47a('0x8')](),controller['index']);router[_0xe47a('0x9')](_0xe47a('0xa'),auth['isAuthenticated'](),controller[_0xe47a('0xb')]);router[_0xe47a('0x9')]('/:id/subjects',auth[_0xe47a('0x8')](),controller[_0xe47a('0xc')]);router[_0xe47a('0x9')](_0xe47a('0xd'),auth[_0xe47a('0x8')](),controller[_0xe47a('0xe')]);router[_0xe47a('0x9')](_0xe47a('0xf'),auth[_0xe47a('0x8')](),controller[_0xe47a('0x10')]);router[_0xe47a('0x11')]('/',auth[_0xe47a('0x8')](),controller[_0xe47a('0x12')]);router[_0xe47a('0x13')](_0xe47a('0xa'),auth['isAuthenticated'](),controller[_0xe47a('0x14')]);router[_0xe47a('0x15')](_0xe47a('0xa'),auth[_0xe47a('0x8')](),controller[_0xe47a('0x16')]);module[_0xe47a('0x17')]=router; \ No newline at end of file +var _0x22fc=['/:id/descriptions','getFields','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0xd6aad,_0x3fd78e){var _0x1109e6=function(_0x37f59c){while(--_0x37f59c){_0xd6aad['push'](_0xd6aad['shift']());}};_0x1109e6(++_0x3fd78e);}(_0x22fc,0x1bc));var _0xc22f=function(_0x155181,_0x4d501c){_0x155181=_0x155181-0x0;var _0x3ac2ab=_0x22fc[_0x155181];return _0x3ac2ab;};'use strict';var multer=require(_0xc22f('0x0'));var util=require(_0xc22f('0x1'));var path=require(_0xc22f('0x2'));var timeout=require(_0xc22f('0x3'));var express=require(_0xc22f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc22f('0x5'));var interaction=require(_0xc22f('0x6'));var config=require(_0xc22f('0x7'));var controller=require(_0xc22f('0x8'));router[_0xc22f('0x9')]('/',auth[_0xc22f('0xa')](),controller[_0xc22f('0xb')]);router[_0xc22f('0x9')](_0xc22f('0xc'),auth[_0xc22f('0xa')](),controller[_0xc22f('0xd')]);router[_0xc22f('0x9')](_0xc22f('0xe'),auth['isAuthenticated'](),controller[_0xc22f('0xf')]);router[_0xc22f('0x9')](_0xc22f('0x10'),auth[_0xc22f('0xa')](),controller['getDescriptions']);router[_0xc22f('0x9')]('/:id/fields',auth[_0xc22f('0xa')](),controller[_0xc22f('0x11')]);router['post']('/',auth[_0xc22f('0xa')](),controller[_0xc22f('0x12')]);router[_0xc22f('0x13')]('/:id',auth[_0xc22f('0xa')](),controller[_0xc22f('0x14')]);router[_0xc22f('0x15')](_0xc22f('0xc'),auth['isAuthenticated'](),controller[_0xc22f('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5d14f9e..6441fa6 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 _0xaa97=['sequelize','STRING'];(function(_0x5cf728,_0xb8e38c){var _0x199dc2=function(_0x6ea1f1){while(--_0x6ea1f1){_0x5cf728['push'](_0x5cf728['shift']());}};_0x199dc2(++_0xb8e38c);}(_0xaa97,0x164));var _0x7aa9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xaa97[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x7aa9('0x0'));module['exports']={'name':{'type':Sequelize[_0x7aa9('0x1')]},'description':{'type':Sequelize[_0x7aa9('0x1')]}}; \ No newline at end of file +var _0x3d1e=['exports','STRING','sequelize'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x3d1e,0x1a9));var _0xe3d1=function(_0x3cbaca,_0x10142b){_0x3cbaca=_0x3cbaca-0x0;var _0xd85122=_0x3d1e[_0x3cbaca];return _0xd85122;};'use strict';var Sequelize=require(_0xe3d1('0x0'));module[_0xe3d1('0x1')]={'name':{'type':Sequelize[_0xe3d1('0x2')]},'description':{'type':Sequelize[_0xe3d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 40ed950..b77c309 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 _0x9d7a=['getSubjects','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','index','FreshsalesConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0x9d7a,0xa3));var _0xa9d7=function(_0x3c595b,_0x3270bb){_0x3c595b=_0x3c595b-0x0;var _0xf45592=_0x9d7a[_0x3c595b];return _0xf45592;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9d7('0x0'));var zipdir=require(_0xa9d7('0x1'));var jsonpatch=require(_0xa9d7('0x2'));var rp=require(_0xa9d7('0x3'));var moment=require(_0xa9d7('0x4'));var BPromise=require(_0xa9d7('0x5'));var Mustache=require(_0xa9d7('0x6'));var util=require(_0xa9d7('0x7'));var path=require(_0xa9d7('0x8'));var sox=require(_0xa9d7('0x9'));var csv=require(_0xa9d7('0xa'));var ejs=require(_0xa9d7('0xb'));var fs=require('fs');var fs_extra=require(_0xa9d7('0xc'));var _=require(_0xa9d7('0xd'));var squel=require(_0xa9d7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa9d7('0xf'));var toCsv=require(_0xa9d7('0xa'));var querystring=require('querystring');var Papa=require(_0xa9d7('0x10'));var Redis=require(_0xa9d7('0x11'));var authService=require(_0xa9d7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9d7('0x13'));var logger=require(_0xa9d7('0x14'))('api');var utils=require(_0xa9d7('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa9d7('0x16'))['db'];function respondWithStatusCode(_0x2b1afe,_0x4bbeb5){_0x4bbeb5=_0x4bbeb5||0xcc;return function(_0x4c61b7){if(_0x4c61b7){return _0x2b1afe[_0xa9d7('0x17')](_0x4bbeb5);}return _0x2b1afe[_0xa9d7('0x18')](_0x4bbeb5)[_0xa9d7('0x19')]();};}function respondWithResult(_0xb4dafa,_0x1696a4){_0x1696a4=_0x1696a4||0xc8;return function(_0x3d7128){if(_0x3d7128){return _0xb4dafa[_0xa9d7('0x18')](_0x1696a4)[_0xa9d7('0x1a')](_0x3d7128);}};}function respondWithFilteredResult(_0x2c4bcc,_0x5b620e){return function(_0x3aaaf5){if(_0x3aaaf5){var _0x1c64c8=typeof _0x5b620e[_0xa9d7('0x1b')]===_0xa9d7('0x1c')&&typeof _0x5b620e[_0xa9d7('0x1d')]===_0xa9d7('0x1c');var _0x52be38=_0x3aaaf5['count'];var _0x289548=_0x1c64c8?0x0:_0x5b620e[_0xa9d7('0x1b')];var _0x51dda8=_0x1c64c8?_0x3aaaf5[_0xa9d7('0x1e')]:_0x5b620e['offset']+_0x5b620e[_0xa9d7('0x1d')];var _0x624144;if(_0x51dda8>=_0x52be38){_0x51dda8=_0x52be38;_0x624144=0xc8;}else{_0x624144=0xce;}_0x2c4bcc[_0xa9d7('0x18')](_0x624144);return _0x2c4bcc[_0xa9d7('0x1f')](_0xa9d7('0x20'),_0x289548+'-'+_0x51dda8+'/'+_0x52be38)[_0xa9d7('0x1a')](_0x3aaaf5);}return null;};}function patchUpdates(_0x5c5c4c){return function(_0x2abd1e){try{jsonpatch[_0xa9d7('0x21')](_0x2abd1e,_0x5c5c4c,!![]);}catch(_0x59ca66){return BPromise[_0xa9d7('0x22')](_0x59ca66);}return _0x2abd1e['save']();};}function saveUpdates(_0x20b9fe,_0x3dbcb9){return function(_0x26e071){if(_0x26e071){return _0x26e071['update'](_0x20b9fe)[_0xa9d7('0x23')](function(_0x27af91){return _0x27af91;});}return null;};}function removeEntity(_0x2b364d,_0x57aea9){return function(_0x238131){if(_0x238131){return _0x238131[_0xa9d7('0x24')]()[_0xa9d7('0x23')](function(){_0x2b364d[_0xa9d7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x237bac,_0x12c8b3){return function(_0x2ca8b7){if(!_0x2ca8b7){_0x237bac['sendStatus'](0x194);}return _0x2ca8b7;};}function handleError(_0x1c040e,_0x558ff3){_0x558ff3=_0x558ff3||0x1f4;return function(_0x4107d9){logger[_0xa9d7('0x25')](_0x4107d9['stack']);if(_0x4107d9[_0xa9d7('0x26')]){delete _0x4107d9[_0xa9d7('0x26')];}_0x1c040e[_0xa9d7('0x18')](_0x558ff3)['send'](_0x4107d9);};}exports[_0xa9d7('0x27')]=function(_0x145cd3,_0x199607){var _0x38f272={},_0x17e4d0={},_0x26216d={'count':0x0,'rows':[]};var _0x10d0bc=_['map'](db[_0xa9d7('0x28')][_0xa9d7('0x29')],function(_0xeb5303){return{'name':_0xeb5303['fieldName'],'type':_0xeb5303[_0xa9d7('0x2a')][_0xa9d7('0x2b')]};});_0x17e4d0[_0xa9d7('0x2c')]=_[_0xa9d7('0x2d')](_0x10d0bc,'name');_0x17e4d0[_0xa9d7('0x2e')]=_[_0xa9d7('0x2f')](_0x145cd3[_0xa9d7('0x2e')]);_0x17e4d0[_0xa9d7('0x30')]=_['intersection'](_0x17e4d0[_0xa9d7('0x2c')],_0x17e4d0[_0xa9d7('0x2e')]);_0x38f272[_0xa9d7('0x31')]=_['intersection'](_0x17e4d0[_0xa9d7('0x2c')],qs[_0xa9d7('0x32')](_0x145cd3[_0xa9d7('0x2e')][_0xa9d7('0x32')]));_0x38f272['attributes']=_0x38f272[_0xa9d7('0x31')][_0xa9d7('0x33')]?_0x38f272[_0xa9d7('0x31')]:_0x17e4d0[_0xa9d7('0x2c')];if(!_0x145cd3[_0xa9d7('0x2e')][_0xa9d7('0x34')](_0xa9d7('0x35'))){_0x38f272[_0xa9d7('0x1d')]=qs[_0xa9d7('0x1d')](_0x145cd3[_0xa9d7('0x2e')][_0xa9d7('0x1d')]);_0x38f272[_0xa9d7('0x1b')]=qs[_0xa9d7('0x1b')](_0x145cd3[_0xa9d7('0x2e')]['offset']);}_0x38f272[_0xa9d7('0x36')]=qs[_0xa9d7('0x37')](_0x145cd3['query'][_0xa9d7('0x37')]);_0x38f272[_0xa9d7('0x38')]=qs['filters'](_[_0xa9d7('0x39')](_0x145cd3['query'],_0x17e4d0['filters']),_0x10d0bc);if(_0x145cd3[_0xa9d7('0x2e')][_0xa9d7('0x3a')]){_0x38f272[_0xa9d7('0x38')]=_[_0xa9d7('0x3b')](_0x38f272['where'],{'$or':_[_0xa9d7('0x2d')](_0x10d0bc,function(_0x34aa5f){if(_0x34aa5f[_0xa9d7('0x2a')]!==_0xa9d7('0x3c')){var _0x2ed569={};_0x2ed569[_0x34aa5f[_0xa9d7('0x26')]]={'$like':'%'+_0x145cd3[_0xa9d7('0x2e')]['filter']+'%'};return _0x2ed569;}})});}_0x38f272=_[_0xa9d7('0x3b')]({},_0x38f272,_0x145cd3[_0xa9d7('0x3d')]);var _0xb8ce7f={'where':_0x38f272[_0xa9d7('0x38')]};return db[_0xa9d7('0x28')][_0xa9d7('0x1e')](_0xb8ce7f)[_0xa9d7('0x23')](function(_0x39b056){_0x26216d['count']=_0x39b056;if(_0x145cd3['query'][_0xa9d7('0x3e')]){_0x38f272[_0xa9d7('0x3f')]=[{'all':!![]}];}return db[_0xa9d7('0x28')][_0xa9d7('0x40')](_0x38f272);})['then'](function(_0x50ab5b){_0x26216d[_0xa9d7('0x41')]=_0x50ab5b;return _0x26216d;})['then'](respondWithFilteredResult(_0x199607,_0x38f272))[_0xa9d7('0x42')](handleError(_0x199607,null));};exports[_0xa9d7('0x43')]=function(_0x368a16,_0x5b9c87){var _0x3b3c3f={'raw':![],'where':{'id':_0x368a16[_0xa9d7('0x44')]['id']}},_0x5bab2a={};_0x5bab2a[_0xa9d7('0x2c')]=_[_0xa9d7('0x2f')](db[_0xa9d7('0x28')][_0xa9d7('0x29')]);_0x5bab2a[_0xa9d7('0x2e')]=_[_0xa9d7('0x2f')](_0x368a16[_0xa9d7('0x2e')]);_0x5bab2a[_0xa9d7('0x30')]=_[_0xa9d7('0x45')](_0x5bab2a[_0xa9d7('0x2c')],_0x5bab2a['query']);_0x3b3c3f[_0xa9d7('0x31')]=_[_0xa9d7('0x45')](_0x5bab2a['model'],qs[_0xa9d7('0x32')](_0x368a16['query'][_0xa9d7('0x32')]));_0x3b3c3f['attributes']=_0x3b3c3f[_0xa9d7('0x31')][_0xa9d7('0x33')]?_0x3b3c3f[_0xa9d7('0x31')]:_0x5bab2a[_0xa9d7('0x2c')];if(_0x368a16[_0xa9d7('0x2e')]['includeAll']){_0x3b3c3f['include']=[{'all':!![]}];}_0x3b3c3f=_[_0xa9d7('0x3b')]({},_0x3b3c3f,_0x368a16[_0xa9d7('0x3d')]);return db[_0xa9d7('0x28')][_0xa9d7('0x46')](_0x3b3c3f)['then'](handleEntityNotFound(_0x5b9c87,null))[_0xa9d7('0x23')](respondWithResult(_0x5b9c87,null))[_0xa9d7('0x42')](handleError(_0x5b9c87,null));};exports[_0xa9d7('0x47')]=function(_0x5ef11c,_0x237f6a){return db['FreshsalesConfiguration'][_0xa9d7('0x47')](_0x5ef11c[_0xa9d7('0x48')],{})[_0xa9d7('0x23')](respondWithResult(_0x237f6a,0xc9))[_0xa9d7('0x42')](handleError(_0x237f6a,null));};exports[_0xa9d7('0x49')]=function(_0x5a842a,_0xb4fde5){if(_0x5a842a[_0xa9d7('0x48')]['id']){delete _0x5a842a[_0xa9d7('0x48')]['id'];}return db['FreshsalesConfiguration'][_0xa9d7('0x46')]({'where':{'id':_0x5a842a[_0xa9d7('0x44')]['id']}})['then'](handleEntityNotFound(_0xb4fde5,null))[_0xa9d7('0x23')](saveUpdates(_0x5a842a['body'],null))['then'](respondWithResult(_0xb4fde5,null))[_0xa9d7('0x42')](handleError(_0xb4fde5,null));};exports[_0xa9d7('0x24')]=function(_0x42471a,_0xbf5674){return db['FreshsalesConfiguration'][_0xa9d7('0x46')]({'where':{'id':_0x42471a[_0xa9d7('0x44')]['id']}})[_0xa9d7('0x23')](handleEntityNotFound(_0xbf5674,null))[_0xa9d7('0x23')](removeEntity(_0xbf5674,null))[_0xa9d7('0x42')](handleError(_0xbf5674,null));};exports[_0xa9d7('0x4a')]=function(_0x1ccbfe,_0x5aa00a,_0x1e9e03){var _0x27d942={};var _0x5d02d6={};var _0x1d461e;var _0x1bac92;return db['FreshsalesConfiguration'][_0xa9d7('0x4b')]({'where':{'id':_0x1ccbfe[_0xa9d7('0x44')]['id']}})[_0xa9d7('0x23')](handleEntityNotFound(_0x5aa00a,null))['then'](function(_0x5f0cd2){if(_0x5f0cd2){_0x1d461e=_0x5f0cd2;_0x5d02d6[_0xa9d7('0x2c')]=_['keys'](db[_0xa9d7('0x4c')]['rawAttributes']);_0x5d02d6['query']=_['keys'](_0x1ccbfe[_0xa9d7('0x2e')]);_0x5d02d6[_0xa9d7('0x30')]=_[_0xa9d7('0x45')](_0x5d02d6[_0xa9d7('0x2c')],_0x5d02d6[_0xa9d7('0x2e')]);_0x27d942[_0xa9d7('0x31')]=_[_0xa9d7('0x45')](_0x5d02d6[_0xa9d7('0x2c')],qs[_0xa9d7('0x32')](_0x1ccbfe[_0xa9d7('0x2e')]['fields']));_0x27d942[_0xa9d7('0x31')]=_0x27d942[_0xa9d7('0x31')]['length']?_0x27d942[_0xa9d7('0x31')]:_0x5d02d6[_0xa9d7('0x2c')];_0x27d942[_0xa9d7('0x36')]=qs[_0xa9d7('0x37')](_0x1ccbfe[_0xa9d7('0x2e')][_0xa9d7('0x37')]);_0x27d942['where']=qs['filters'](_[_0xa9d7('0x39')](_0x1ccbfe[_0xa9d7('0x2e')],_0x5d02d6[_0xa9d7('0x30')]));if(_0x1ccbfe['query'][_0xa9d7('0x3a')]){_0x27d942[_0xa9d7('0x38')]=_[_0xa9d7('0x3b')](_0x27d942[_0xa9d7('0x38')],{'$or':_['map'](_0x27d942[_0xa9d7('0x31')],function(_0x3650f9){var _0x5101e9={};_0x5101e9[_0x3650f9]={'$like':'%'+_0x1ccbfe[_0xa9d7('0x2e')][_0xa9d7('0x3a')]+'%'};return _0x5101e9;})});}_0x27d942=_['merge']({},_0x27d942,_0x1ccbfe[_0xa9d7('0x3d')]);return _0x1d461e[_0xa9d7('0x4a')](_0x27d942);}})[_0xa9d7('0x23')](function(_0x1775fd){if(_0x1775fd){_0x1bac92=_0x1775fd[_0xa9d7('0x33')];if(!_0x1ccbfe[_0xa9d7('0x2e')][_0xa9d7('0x34')]('nolimit')){_0x27d942[_0xa9d7('0x1d')]=qs[_0xa9d7('0x1d')](_0x1ccbfe[_0xa9d7('0x2e')]['limit']);_0x27d942[_0xa9d7('0x1b')]=qs[_0xa9d7('0x1b')](_0x1ccbfe[_0xa9d7('0x2e')][_0xa9d7('0x1b')]);}return _0x1d461e['getSubjects'](_0x27d942);}})[_0xa9d7('0x23')](function(_0x31e11c){if(_0x31e11c){return _0x31e11c?{'count':_0x1bac92,'rows':_0x31e11c}:null;}})[_0xa9d7('0x23')](respondWithResult(_0x5aa00a,null))[_0xa9d7('0x42')](handleError(_0x5aa00a,null));};exports['getDescriptions']=function(_0x2af917,_0x55d8d9,_0x8eaca1){var _0x2d0221={};var _0x4f0d8d={};var _0x145d8e;var _0x4ba539;return db['FreshsalesConfiguration'][_0xa9d7('0x4b')]({'where':{'id':_0x2af917[_0xa9d7('0x44')]['id']}})['then'](handleEntityNotFound(_0x55d8d9,null))[_0xa9d7('0x23')](function(_0x33c4be){if(_0x33c4be){_0x145d8e=_0x33c4be;_0x4f0d8d[_0xa9d7('0x2c')]=_['keys'](db[_0xa9d7('0x4c')][_0xa9d7('0x29')]);_0x4f0d8d['query']=_[_0xa9d7('0x2f')](_0x2af917[_0xa9d7('0x2e')]);_0x4f0d8d[_0xa9d7('0x30')]=_[_0xa9d7('0x45')](_0x4f0d8d['model'],_0x4f0d8d['query']);_0x2d0221[_0xa9d7('0x31')]=_[_0xa9d7('0x45')](_0x4f0d8d[_0xa9d7('0x2c')],qs[_0xa9d7('0x32')](_0x2af917[_0xa9d7('0x2e')][_0xa9d7('0x32')]));_0x2d0221['attributes']=_0x2d0221['attributes'][_0xa9d7('0x33')]?_0x2d0221[_0xa9d7('0x31')]:_0x4f0d8d[_0xa9d7('0x2c')];_0x2d0221[_0xa9d7('0x36')]=qs['sort'](_0x2af917[_0xa9d7('0x2e')][_0xa9d7('0x37')]);_0x2d0221[_0xa9d7('0x38')]=qs[_0xa9d7('0x30')](_[_0xa9d7('0x39')](_0x2af917[_0xa9d7('0x2e')],_0x4f0d8d[_0xa9d7('0x30')]));if(_0x2af917[_0xa9d7('0x2e')][_0xa9d7('0x3a')]){_0x2d0221[_0xa9d7('0x38')]=_[_0xa9d7('0x3b')](_0x2d0221['where'],{'$or':_[_0xa9d7('0x2d')](_0x2d0221[_0xa9d7('0x31')],function(_0x8109bb){var _0x23dd5b={};_0x23dd5b[_0x8109bb]={'$like':'%'+_0x2af917[_0xa9d7('0x2e')][_0xa9d7('0x3a')]+'%'};return _0x23dd5b;})});}_0x2d0221=_['merge']({},_0x2d0221,_0x2af917['options']);return _0x145d8e['getDescriptions'](_0x2d0221);}})['then'](function(_0x2c434c){if(_0x2c434c){_0x4ba539=_0x2c434c[_0xa9d7('0x33')];if(!_0x2af917['query'][_0xa9d7('0x34')]('nolimit')){_0x2d0221['limit']=qs[_0xa9d7('0x1d')](_0x2af917[_0xa9d7('0x2e')][_0xa9d7('0x1d')]);_0x2d0221['offset']=qs['offset'](_0x2af917['query'][_0xa9d7('0x1b')]);}return _0x145d8e[_0xa9d7('0x4d')](_0x2d0221);}})[_0xa9d7('0x23')](function(_0x50e3ed){if(_0x50e3ed){return _0x50e3ed?{'count':_0x4ba539,'rows':_0x50e3ed}:null;}})[_0xa9d7('0x23')](respondWithResult(_0x55d8d9,null))[_0xa9d7('0x42')](handleError(_0x55d8d9,null));};exports[_0xa9d7('0x4e')]=function(_0x2381cf,_0x107277,_0x36d0bd){var _0x42052e={};var _0xf5d715={};var _0x1f7cf0;var _0x30a126;return db['FreshsalesConfiguration'][_0xa9d7('0x4b')]({'where':{'id':_0x2381cf[_0xa9d7('0x44')]['id']}})['then'](handleEntityNotFound(_0x107277,null))['then'](function(_0x10fc0c){if(_0x10fc0c){_0x1f7cf0=_0x10fc0c;_0xf5d715[_0xa9d7('0x2c')]=_[_0xa9d7('0x2f')](db[_0xa9d7('0x4c')][_0xa9d7('0x29')]);_0xf5d715[_0xa9d7('0x2e')]=_[_0xa9d7('0x2f')](_0x2381cf[_0xa9d7('0x2e')]);_0xf5d715[_0xa9d7('0x30')]=_['intersection'](_0xf5d715[_0xa9d7('0x2c')],_0xf5d715['query']);_0x42052e[_0xa9d7('0x31')]=_[_0xa9d7('0x45')](_0xf5d715['model'],qs['fields'](_0x2381cf['query'][_0xa9d7('0x32')]));_0x42052e[_0xa9d7('0x31')]=_0x42052e[_0xa9d7('0x31')][_0xa9d7('0x33')]?_0x42052e['attributes']:_0xf5d715[_0xa9d7('0x2c')];_0x42052e[_0xa9d7('0x36')]=qs[_0xa9d7('0x37')](_0x2381cf[_0xa9d7('0x2e')][_0xa9d7('0x37')]);_0x42052e[_0xa9d7('0x38')]=qs[_0xa9d7('0x30')](_[_0xa9d7('0x39')](_0x2381cf[_0xa9d7('0x2e')],_0xf5d715[_0xa9d7('0x30')]));if(_0x2381cf['query']['filter']){_0x42052e[_0xa9d7('0x38')]=_[_0xa9d7('0x3b')](_0x42052e['where'],{'$or':_[_0xa9d7('0x2d')](_0x42052e[_0xa9d7('0x31')],function(_0x4eb8e9){var _0x73686e={};_0x73686e[_0x4eb8e9]={'$like':'%'+_0x2381cf['query']['filter']+'%'};return _0x73686e;})});}_0x42052e=_[_0xa9d7('0x3b')]({},_0x42052e,_0x2381cf[_0xa9d7('0x3d')]);return _0x1f7cf0['getFields'](_0x42052e);}})['then'](function(_0x3afc31){if(_0x3afc31){_0x30a126=_0x3afc31[_0xa9d7('0x33')];if(!_0x2381cf[_0xa9d7('0x2e')][_0xa9d7('0x34')](_0xa9d7('0x35'))){_0x42052e['limit']=qs[_0xa9d7('0x1d')](_0x2381cf[_0xa9d7('0x2e')][_0xa9d7('0x1d')]);_0x42052e[_0xa9d7('0x1b')]=qs[_0xa9d7('0x1b')](_0x2381cf[_0xa9d7('0x2e')][_0xa9d7('0x1b')]);}return _0x1f7cf0[_0xa9d7('0x4e')](_0x42052e);}})['then'](function(_0x1d8a66){if(_0x1d8a66){return _0x1d8a66?{'count':_0x30a126,'rows':_0x1d8a66}:null;}})['then'](respondWithResult(_0x107277,null))[_0xa9d7('0x42')](handleError(_0x107277,null));}; \ No newline at end of file +var _0x9598=['filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','getSubjects','findOne','hasOwnProperty','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','keys'];(function(_0x156c6d,_0x22c89d){var _0x2b35c0=function(_0x53c5d6){while(--_0x53c5d6){_0x156c6d['push'](_0x156c6d['shift']());}};_0x2b35c0(++_0x22c89d);}(_0x9598,0x1b8));var _0x8959=function(_0x1dbbce,_0x48410a){_0x1dbbce=_0x1dbbce-0x0;var _0x30b20d=_0x9598[_0x1dbbce];return _0x30b20d;};'use strict';var emlformat=require(_0x8959('0x0'));var rimraf=require(_0x8959('0x1'));var zipdir=require(_0x8959('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8959('0x3'));var moment=require(_0x8959('0x4'));var BPromise=require(_0x8959('0x5'));var Mustache=require(_0x8959('0x6'));var util=require('util');var path=require(_0x8959('0x7'));var sox=require(_0x8959('0x8'));var csv=require(_0x8959('0x9'));var ejs=require(_0x8959('0xa'));var fs=require('fs');var fs_extra=require(_0x8959('0xb'));var _=require(_0x8959('0xc'));var squel=require(_0x8959('0xd'));var crypto=require('crypto');var jsforce=require(_0x8959('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8959('0x9'));var querystring=require(_0x8959('0xf'));var Papa=require(_0x8959('0x10'));var Redis=require(_0x8959('0x11'));var authService=require(_0x8959('0x12'));var qs=require(_0x8959('0x13'));var as=require(_0x8959('0x14'));var hardwareService=require(_0x8959('0x15'));var logger=require('../../config/logger')(_0x8959('0x16'));var utils=require(_0x8959('0x17'));var config=require(_0x8959('0x18'));var licenseUtil=require(_0x8959('0x19'));var db=require(_0x8959('0x1a'))['db'];function respondWithStatusCode(_0x5a0270,_0x2a1503){_0x2a1503=_0x2a1503||0xcc;return function(_0x1f2d50){if(_0x1f2d50){return _0x5a0270['sendStatus'](_0x2a1503);}return _0x5a0270[_0x8959('0x1b')](_0x2a1503)[_0x8959('0x1c')]();};}function respondWithResult(_0x61a081,_0x51695d){_0x51695d=_0x51695d||0xc8;return function(_0xb12963){if(_0xb12963){return _0x61a081[_0x8959('0x1b')](_0x51695d)[_0x8959('0x1d')](_0xb12963);}};}function respondWithFilteredResult(_0x20c07d,_0x22365d){return function(_0x240648){if(_0x240648){var _0x3d5fde=typeof _0x22365d[_0x8959('0x1e')]===_0x8959('0x1f')&&typeof _0x22365d['limit']===_0x8959('0x1f');var _0xd9643=_0x240648[_0x8959('0x20')];var _0x38b51c=_0x3d5fde?0x0:_0x22365d['offset'];var _0x3a38e8=_0x3d5fde?_0x240648[_0x8959('0x20')]:_0x22365d[_0x8959('0x1e')]+_0x22365d[_0x8959('0x21')];var _0xf568cb;if(_0x3a38e8>=_0xd9643){_0x3a38e8=_0xd9643;_0xf568cb=0xc8;}else{_0xf568cb=0xce;}_0x20c07d['status'](_0xf568cb);return _0x20c07d[_0x8959('0x22')](_0x8959('0x23'),_0x38b51c+'-'+_0x3a38e8+'/'+_0xd9643)[_0x8959('0x1d')](_0x240648);}return null;};}function patchUpdates(_0x1663a5){return function(_0x5ef775){try{jsonpatch[_0x8959('0x24')](_0x5ef775,_0x1663a5,!![]);}catch(_0x1b3be7){return BPromise[_0x8959('0x25')](_0x1b3be7);}return _0x5ef775[_0x8959('0x26')]();};}function saveUpdates(_0x5f4da1,_0x1998b6){return function(_0x1f7048){if(_0x1f7048){return _0x1f7048[_0x8959('0x27')](_0x5f4da1)[_0x8959('0x28')](function(_0x2dca8a){return _0x2dca8a;});}return null;};}function removeEntity(_0x1e1287,_0x37a9a0){return function(_0xeaec8){if(_0xeaec8){return _0xeaec8[_0x8959('0x29')]()['then'](function(){_0x1e1287[_0x8959('0x1b')](0xcc)[_0x8959('0x1c')]();});}};}function handleEntityNotFound(_0x3cc0ec,_0x46920e){return function(_0x400509){if(!_0x400509){_0x3cc0ec['sendStatus'](0x194);}return _0x400509;};}function handleError(_0x43e995,_0x6cf168){_0x6cf168=_0x6cf168||0x1f4;return function(_0x29ae33){logger[_0x8959('0x2a')](_0x29ae33[_0x8959('0x2b')]);if(_0x29ae33[_0x8959('0x2c')]){delete _0x29ae33[_0x8959('0x2c')];}_0x43e995[_0x8959('0x1b')](_0x6cf168)['send'](_0x29ae33);};}exports['index']=function(_0x4fc18b,_0x16fe4c){var _0x43bebf={},_0x412ac7={},_0x16bc73={'count':0x0,'rows':[]};var _0x24c857=_[_0x8959('0x2d')](db[_0x8959('0x2e')][_0x8959('0x2f')],function(_0x36bb1a){return{'name':_0x36bb1a[_0x8959('0x30')],'type':_0x36bb1a[_0x8959('0x31')]['key']};});_0x412ac7[_0x8959('0x32')]=_[_0x8959('0x2d')](_0x24c857,'name');_0x412ac7['query']=_[_0x8959('0x33')](_0x4fc18b['query']);_0x412ac7[_0x8959('0x34')]=_[_0x8959('0x35')](_0x412ac7[_0x8959('0x32')],_0x412ac7[_0x8959('0x36')]);_0x43bebf[_0x8959('0x37')]=_[_0x8959('0x35')](_0x412ac7[_0x8959('0x32')],qs['fields'](_0x4fc18b[_0x8959('0x36')][_0x8959('0x38')]));_0x43bebf['attributes']=_0x43bebf[_0x8959('0x37')]['length']?_0x43bebf[_0x8959('0x37')]:_0x412ac7[_0x8959('0x32')];if(!_0x4fc18b[_0x8959('0x36')]['hasOwnProperty'](_0x8959('0x39'))){_0x43bebf[_0x8959('0x21')]=qs['limit'](_0x4fc18b[_0x8959('0x36')][_0x8959('0x21')]);_0x43bebf[_0x8959('0x1e')]=qs[_0x8959('0x1e')](_0x4fc18b['query'][_0x8959('0x1e')]);}_0x43bebf[_0x8959('0x3a')]=qs['sort'](_0x4fc18b[_0x8959('0x36')][_0x8959('0x3b')]);_0x43bebf[_0x8959('0x3c')]=qs[_0x8959('0x34')](_[_0x8959('0x3d')](_0x4fc18b['query'],_0x412ac7[_0x8959('0x34')]),_0x24c857);if(_0x4fc18b[_0x8959('0x36')][_0x8959('0x3e')]){_0x43bebf[_0x8959('0x3c')]=_[_0x8959('0x3f')](_0x43bebf[_0x8959('0x3c')],{'$or':_[_0x8959('0x2d')](_0x24c857,function(_0x51ecc8){if(_0x51ecc8[_0x8959('0x31')]!==_0x8959('0x40')){var _0x417d30={};_0x417d30[_0x51ecc8[_0x8959('0x2c')]]={'$like':'%'+_0x4fc18b[_0x8959('0x36')]['filter']+'%'};return _0x417d30;}})});}_0x43bebf=_[_0x8959('0x3f')]({},_0x43bebf,_0x4fc18b[_0x8959('0x41')]);var _0xc8e987={'where':_0x43bebf[_0x8959('0x3c')]};return db[_0x8959('0x2e')][_0x8959('0x20')](_0xc8e987)[_0x8959('0x28')](function(_0x53c78a){_0x16bc73[_0x8959('0x20')]=_0x53c78a;if(_0x4fc18b[_0x8959('0x36')][_0x8959('0x42')]){_0x43bebf[_0x8959('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x8959('0x44')](_0x43bebf);})[_0x8959('0x28')](function(_0x5dbfda){_0x16bc73['rows']=_0x5dbfda;return _0x16bc73;})[_0x8959('0x28')](respondWithFilteredResult(_0x16fe4c,_0x43bebf))[_0x8959('0x45')](handleError(_0x16fe4c,null));};exports[_0x8959('0x46')]=function(_0x142f88,_0x5a9408){var _0x2bbd30={'raw':![],'where':{'id':_0x142f88['params']['id']}},_0x211ef2={};_0x211ef2['model']=_['keys'](db[_0x8959('0x2e')]['rawAttributes']);_0x211ef2['query']=_[_0x8959('0x33')](_0x142f88[_0x8959('0x36')]);_0x211ef2[_0x8959('0x34')]=_[_0x8959('0x35')](_0x211ef2[_0x8959('0x32')],_0x211ef2['query']);_0x2bbd30[_0x8959('0x37')]=_['intersection'](_0x211ef2['model'],qs[_0x8959('0x38')](_0x142f88[_0x8959('0x36')]['fields']));_0x2bbd30['attributes']=_0x2bbd30[_0x8959('0x37')][_0x8959('0x47')]?_0x2bbd30[_0x8959('0x37')]:_0x211ef2[_0x8959('0x32')];if(_0x142f88[_0x8959('0x36')][_0x8959('0x42')]){_0x2bbd30[_0x8959('0x43')]=[{'all':!![]}];}_0x2bbd30=_['merge']({},_0x2bbd30,_0x142f88[_0x8959('0x41')]);return db[_0x8959('0x2e')][_0x8959('0x48')](_0x2bbd30)[_0x8959('0x28')](handleEntityNotFound(_0x5a9408,null))[_0x8959('0x28')](respondWithResult(_0x5a9408,null))[_0x8959('0x45')](handleError(_0x5a9408,null));};exports['create']=function(_0x208824,_0x4e6c62){return db[_0x8959('0x2e')][_0x8959('0x49')](_0x208824[_0x8959('0x4a')],{})[_0x8959('0x28')](respondWithResult(_0x4e6c62,0xc9))[_0x8959('0x45')](handleError(_0x4e6c62,null));};exports[_0x8959('0x27')]=function(_0xa0f2a7,_0x584d66){if(_0xa0f2a7[_0x8959('0x4a')]['id']){delete _0xa0f2a7[_0x8959('0x4a')]['id'];}return db[_0x8959('0x2e')][_0x8959('0x48')]({'where':{'id':_0xa0f2a7[_0x8959('0x4b')]['id']}})['then'](handleEntityNotFound(_0x584d66,null))[_0x8959('0x28')](saveUpdates(_0xa0f2a7['body'],null))['then'](respondWithResult(_0x584d66,null))['catch'](handleError(_0x584d66,null));};exports[_0x8959('0x29')]=function(_0xf0b232,_0x248a56){return db[_0x8959('0x2e')][_0x8959('0x48')]({'where':{'id':_0xf0b232[_0x8959('0x4b')]['id']}})['then'](handleEntityNotFound(_0x248a56,null))['then'](removeEntity(_0x248a56,null))[_0x8959('0x45')](handleError(_0x248a56,null));};exports[_0x8959('0x4c')]=function(_0x1591c5,_0x50cc4d,_0xd51517){var _0x1bbfa1={};var _0x41d2f6={};var _0x4f08bb;var _0x2a39e5;return db[_0x8959('0x2e')][_0x8959('0x4d')]({'where':{'id':_0x1591c5[_0x8959('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50cc4d,null))[_0x8959('0x28')](function(_0x390a52){if(_0x390a52){_0x4f08bb=_0x390a52;_0x41d2f6[_0x8959('0x32')]=_[_0x8959('0x33')](db['FreshsalesField'][_0x8959('0x2f')]);_0x41d2f6['query']=_[_0x8959('0x33')](_0x1591c5[_0x8959('0x36')]);_0x41d2f6['filters']=_[_0x8959('0x35')](_0x41d2f6['model'],_0x41d2f6[_0x8959('0x36')]);_0x1bbfa1[_0x8959('0x37')]=_['intersection'](_0x41d2f6['model'],qs[_0x8959('0x38')](_0x1591c5[_0x8959('0x36')][_0x8959('0x38')]));_0x1bbfa1['attributes']=_0x1bbfa1['attributes'][_0x8959('0x47')]?_0x1bbfa1[_0x8959('0x37')]:_0x41d2f6[_0x8959('0x32')];_0x1bbfa1[_0x8959('0x3a')]=qs[_0x8959('0x3b')](_0x1591c5[_0x8959('0x36')][_0x8959('0x3b')]);_0x1bbfa1['where']=qs[_0x8959('0x34')](_[_0x8959('0x3d')](_0x1591c5[_0x8959('0x36')],_0x41d2f6[_0x8959('0x34')]));if(_0x1591c5[_0x8959('0x36')]['filter']){_0x1bbfa1[_0x8959('0x3c')]=_['merge'](_0x1bbfa1[_0x8959('0x3c')],{'$or':_[_0x8959('0x2d')](_0x1bbfa1[_0x8959('0x37')],function(_0x280023){var _0x4c6c37={};_0x4c6c37[_0x280023]={'$like':'%'+_0x1591c5['query'][_0x8959('0x3e')]+'%'};return _0x4c6c37;})});}_0x1bbfa1=_[_0x8959('0x3f')]({},_0x1bbfa1,_0x1591c5[_0x8959('0x41')]);return _0x4f08bb[_0x8959('0x4c')](_0x1bbfa1);}})['then'](function(_0x10faa7){if(_0x10faa7){_0x2a39e5=_0x10faa7[_0x8959('0x47')];if(!_0x1591c5['query'][_0x8959('0x4e')](_0x8959('0x39'))){_0x1bbfa1[_0x8959('0x21')]=qs[_0x8959('0x21')](_0x1591c5[_0x8959('0x36')][_0x8959('0x21')]);_0x1bbfa1[_0x8959('0x1e')]=qs[_0x8959('0x1e')](_0x1591c5[_0x8959('0x36')][_0x8959('0x1e')]);}return _0x4f08bb['getSubjects'](_0x1bbfa1);}})['then'](function(_0x450a33){if(_0x450a33){return _0x450a33?{'count':_0x2a39e5,'rows':_0x450a33}:null;}})[_0x8959('0x28')](respondWithResult(_0x50cc4d,null))[_0x8959('0x45')](handleError(_0x50cc4d,null));};exports[_0x8959('0x4f')]=function(_0x507cff,_0x2cfd13,_0x3bb8c8){var _0x4d8344={};var _0x2a9583={};var _0x21f5df;var _0xf8d916;return db['FreshsalesConfiguration'][_0x8959('0x4d')]({'where':{'id':_0x507cff[_0x8959('0x4b')]['id']}})[_0x8959('0x28')](handleEntityNotFound(_0x2cfd13,null))['then'](function(_0x151b7b){if(_0x151b7b){_0x21f5df=_0x151b7b;_0x2a9583[_0x8959('0x32')]=_['keys'](db[_0x8959('0x50')]['rawAttributes']);_0x2a9583[_0x8959('0x36')]=_[_0x8959('0x33')](_0x507cff['query']);_0x2a9583[_0x8959('0x34')]=_[_0x8959('0x35')](_0x2a9583['model'],_0x2a9583[_0x8959('0x36')]);_0x4d8344['attributes']=_[_0x8959('0x35')](_0x2a9583[_0x8959('0x32')],qs[_0x8959('0x38')](_0x507cff[_0x8959('0x36')][_0x8959('0x38')]));_0x4d8344[_0x8959('0x37')]=_0x4d8344[_0x8959('0x37')]['length']?_0x4d8344[_0x8959('0x37')]:_0x2a9583[_0x8959('0x32')];_0x4d8344[_0x8959('0x3a')]=qs['sort'](_0x507cff[_0x8959('0x36')][_0x8959('0x3b')]);_0x4d8344['where']=qs[_0x8959('0x34')](_[_0x8959('0x3d')](_0x507cff['query'],_0x2a9583[_0x8959('0x34')]));if(_0x507cff[_0x8959('0x36')][_0x8959('0x3e')]){_0x4d8344[_0x8959('0x3c')]=_[_0x8959('0x3f')](_0x4d8344[_0x8959('0x3c')],{'$or':_[_0x8959('0x2d')](_0x4d8344[_0x8959('0x37')],function(_0x3d7b45){var _0x487d73={};_0x487d73[_0x3d7b45]={'$like':'%'+_0x507cff[_0x8959('0x36')]['filter']+'%'};return _0x487d73;})});}_0x4d8344=_[_0x8959('0x3f')]({},_0x4d8344,_0x507cff[_0x8959('0x41')]);return _0x21f5df[_0x8959('0x4f')](_0x4d8344);}})[_0x8959('0x28')](function(_0x3ea418){if(_0x3ea418){_0xf8d916=_0x3ea418[_0x8959('0x47')];if(!_0x507cff[_0x8959('0x36')][_0x8959('0x4e')](_0x8959('0x39'))){_0x4d8344[_0x8959('0x21')]=qs[_0x8959('0x21')](_0x507cff['query']['limit']);_0x4d8344[_0x8959('0x1e')]=qs[_0x8959('0x1e')](_0x507cff[_0x8959('0x36')]['offset']);}return _0x21f5df[_0x8959('0x4f')](_0x4d8344);}})[_0x8959('0x28')](function(_0x205d18){if(_0x205d18){return _0x205d18?{'count':_0xf8d916,'rows':_0x205d18}:null;}})[_0x8959('0x28')](respondWithResult(_0x2cfd13,null))['catch'](handleError(_0x2cfd13,null));};exports[_0x8959('0x51')]=function(_0x878d9,_0x4e09cd,_0x1ab089){var _0x180240={};var _0x4e7031={};var _0x5108c0;var _0x5d9cdc;return db[_0x8959('0x2e')][_0x8959('0x4d')]({'where':{'id':_0x878d9[_0x8959('0x4b')]['id']}})[_0x8959('0x28')](handleEntityNotFound(_0x4e09cd,null))['then'](function(_0x43c9fc){if(_0x43c9fc){_0x5108c0=_0x43c9fc;_0x4e7031['model']=_[_0x8959('0x33')](db['FreshsalesField'][_0x8959('0x2f')]);_0x4e7031[_0x8959('0x36')]=_['keys'](_0x878d9['query']);_0x4e7031[_0x8959('0x34')]=_[_0x8959('0x35')](_0x4e7031[_0x8959('0x32')],_0x4e7031[_0x8959('0x36')]);_0x180240[_0x8959('0x37')]=_['intersection'](_0x4e7031[_0x8959('0x32')],qs['fields'](_0x878d9['query'][_0x8959('0x38')]));_0x180240['attributes']=_0x180240['attributes']['length']?_0x180240[_0x8959('0x37')]:_0x4e7031[_0x8959('0x32')];_0x180240[_0x8959('0x3a')]=qs['sort'](_0x878d9['query'][_0x8959('0x3b')]);_0x180240[_0x8959('0x3c')]=qs[_0x8959('0x34')](_[_0x8959('0x3d')](_0x878d9['query'],_0x4e7031[_0x8959('0x34')]));if(_0x878d9[_0x8959('0x36')][_0x8959('0x3e')]){_0x180240['where']=_[_0x8959('0x3f')](_0x180240[_0x8959('0x3c')],{'$or':_['map'](_0x180240['attributes'],function(_0x3c9287){var _0x2bb151={};_0x2bb151[_0x3c9287]={'$like':'%'+_0x878d9['query'][_0x8959('0x3e')]+'%'};return _0x2bb151;})});}_0x180240=_[_0x8959('0x3f')]({},_0x180240,_0x878d9[_0x8959('0x41')]);return _0x5108c0['getFields'](_0x180240);}})[_0x8959('0x28')](function(_0x11fc0b){if(_0x11fc0b){_0x5d9cdc=_0x11fc0b[_0x8959('0x47')];if(!_0x878d9[_0x8959('0x36')]['hasOwnProperty']('nolimit')){_0x180240[_0x8959('0x21')]=qs['limit'](_0x878d9['query'][_0x8959('0x21')]);_0x180240[_0x8959('0x1e')]=qs[_0x8959('0x1e')](_0x878d9[_0x8959('0x36')][_0x8959('0x1e')]);}return _0x5108c0[_0x8959('0x51')](_0x180240);}})['then'](function(_0x281d0a){if(_0x281d0a){return _0x281d0a?{'count':_0x5d9cdc,'rows':_0x281d0a}:null;}})[_0x8959('0x28')](respondWithResult(_0x4e09cd,null))['catch'](handleError(_0x4e09cd,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0a6f023..ba6507c 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 _0x9b55=['FreshsalesConfiguration','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x63c05a,_0x1e6398){var _0x4540eb=function(_0x54848d){while(--_0x54848d){_0x63c05a['push'](_0x63c05a['shift']());}};_0x4540eb(++_0x1e6398);}(_0x9b55,0x1d5));var _0x59b5=function(_0x2f1538,_0x17c063){_0x2f1538=_0x2f1538-0x0;var _0x44b7d1=_0x9b55[_0x2f1538];return _0x44b7d1;};'use strict';var _=require(_0x59b5('0x0'));var util=require(_0x59b5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x59b5('0x2'));var BPromise=require(_0x59b5('0x3'));var rp=require(_0x59b5('0x4'));var fs=require('fs');var path=require(_0x59b5('0x5'));var rimraf=require('rimraf');var config=require(_0x59b5('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x59b5('0x7')]=function(_0x3af714,_0x31ad14){return _0x3af714['define'](_0x59b5('0x8'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3cd=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb3cd,0xf0));var _0xdb3c=function(_0x119d25,_0x588c8){_0x119d25=_0x119d25-0x0;var _0x39cf30=_0xb3cd[_0x119d25];return _0x39cf30;};'use strict';var _=require(_0xdb3c('0x0'));var util=require('util');var logger=require(_0xdb3c('0x1'))(_0xdb3c('0x2'));var moment=require(_0xdb3c('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb3c('0x4'));var fs=require('fs');var path=require(_0xdb3c('0x5'));var rimraf=require(_0xdb3c('0x6'));var config=require(_0xdb3c('0x7'));var attributes=require(_0xdb3c('0x8'));module[_0xdb3c('0x9')]=function(_0x274421,_0x6e2ea4){return _0x274421[_0xdb3c('0xa')](_0xdb3c('0xb'),attributes,{'tableName':_0xdb3c('0xc'),'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 18b5880..86a61ca 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 _0x62cf=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x24b712,_0x4971cd){var _0x2dfb43=function(_0x5bd91a){while(--_0x5bd91a){_0x24b712['push'](_0x24b712['shift']());}};_0x2dfb43(++_0x4971cd);}(_0x62cf,0x9c));var _0xf62c=function(_0xb6e00,_0x3061ff){_0xb6e00=_0xb6e00-0x0;var _0x4694ae=_0x62cf[_0xb6e00];return _0x4694ae;};'use strict';var _=require(_0xf62c('0x0'));var util=require(_0xf62c('0x1'));var moment=require('moment');var BPromise=require(_0xf62c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf62c('0x3'));var db=require(_0xf62c('0x4'))['db'];var utils=require(_0xf62c('0x5'));var logger=require(_0xf62c('0x6'))(_0xf62c('0x7'));var config=require(_0xf62c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf62c('0x9')][_0xf62c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1497b7,_0x460960,_0x243260){return new BPromise(function(_0x3a902c,_0x3aec28){return client[_0xf62c('0xb')](_0x1497b7,_0x243260)[_0xf62c('0xc')](function(_0x1f89d1){logger[_0xf62c('0xd')](_0xf62c('0xe'),_0x460960,'request\x20sent');logger[_0xf62c('0xf')](_0xf62c('0x10'),_0x460960,_0xf62c('0x11'),JSON[_0xf62c('0x12')](_0x1f89d1));if(_0x1f89d1['error']){if(_0x1f89d1[_0xf62c('0x13')][_0xf62c('0x14')]===0x1f4){logger[_0xf62c('0x13')](_0xf62c('0xe'),_0x460960,_0x1f89d1[_0xf62c('0x13')][_0xf62c('0x15')]);return _0x3aec28(_0x1f89d1[_0xf62c('0x13')][_0xf62c('0x15')]);}logger[_0xf62c('0x13')](_0xf62c('0xe'),_0x460960,_0x1f89d1[_0xf62c('0x13')][_0xf62c('0x15')]);return _0x3a902c(_0x1f89d1[_0xf62c('0x13')][_0xf62c('0x15')]);}else{logger[_0xf62c('0xd')](_0xf62c('0xe'),_0x460960,_0xf62c('0x11'));_0x3a902c(_0x1f89d1[_0xf62c('0x16')][_0xf62c('0x15')]);}})['catch'](function(_0x528e68){logger[_0xf62c('0x13')](_0xf62c('0xe'),_0x460960,_0x528e68);_0x3aec28(_0x528e68);});});} \ No newline at end of file +var _0xe939=['error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xe939,0x174));var _0x9e93=function(_0x4cf2ff,_0x583639){_0x4cf2ff=_0x4cf2ff-0x0;var _0x484b5e=_0xe939[_0x4cf2ff];return _0x484b5e;};'use strict';var _=require(_0x9e93('0x0'));var util=require(_0x9e93('0x1'));var moment=require('moment');var BPromise=require(_0x9e93('0x2'));var rs=require(_0x9e93('0x3'));var fs=require('fs');var Redis=require(_0x9e93('0x4'));var db=require(_0x9e93('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e93('0x6'))(_0x9e93('0x7'));var config=require(_0x9e93('0x8'));var jayson=require(_0x9e93('0x9'));var client=jayson['client'][_0x9e93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43c51b,_0x4c731c,_0x458575){return new BPromise(function(_0x21b9f1,_0x165f19){return client[_0x9e93('0xb')](_0x43c51b,_0x458575)[_0x9e93('0xc')](function(_0x1ce912){logger[_0x9e93('0xd')](_0x9e93('0xe'),_0x4c731c,_0x9e93('0xf'));logger[_0x9e93('0x10')](_0x9e93('0x11'),_0x4c731c,_0x9e93('0xf'),JSON[_0x9e93('0x12')](_0x1ce912));if(_0x1ce912[_0x9e93('0x13')]){if(_0x1ce912[_0x9e93('0x13')]['code']===0x1f4){logger[_0x9e93('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4c731c,_0x1ce912[_0x9e93('0x13')][_0x9e93('0x14')]);return _0x165f19(_0x1ce912[_0x9e93('0x13')][_0x9e93('0x14')]);}logger[_0x9e93('0x13')](_0x9e93('0xe'),_0x4c731c,_0x1ce912['error']['message']);return _0x21b9f1(_0x1ce912[_0x9e93('0x13')][_0x9e93('0x14')]);}else{logger['info'](_0x9e93('0xe'),_0x4c731c,_0x9e93('0xf'));_0x21b9f1(_0x1ce912[_0x9e93('0x15')][_0x9e93('0x14')]);}})[_0x9e93('0x16')](function(_0x693c17){logger[_0x9e93('0x13')](_0x9e93('0xe'),_0x4c731c,_0x693c17);_0x165f19(_0x693c17);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 613f6aa..e001885 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 _0xac7f=['/:id','isAuthenticated','post','create','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0x4c96b8,_0x3f4047){var _0x514fb2=function(_0x29efb7){while(--_0x29efb7){_0x4c96b8['push'](_0x4c96b8['shift']());}};_0x514fb2(++_0x3f4047);}(_0xac7f,0x1e2));var _0xfac7=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xac7f[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0xfac7('0x0'));var util=require('util');var path=require(_0xfac7('0x1'));var timeout=require(_0xfac7('0x2'));var express=require(_0xfac7('0x3'));var router=express['Router']();var fs_extra=require(_0xfac7('0x4'));var auth=require(_0xfac7('0x5'));var interaction=require(_0xfac7('0x6'));var config=require(_0xfac7('0x7'));var controller=require(_0xfac7('0x8'));router[_0xfac7('0x9')]('/',auth['isAuthenticated'](),controller[_0xfac7('0xa')]);router['get'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller['show']);router[_0xfac7('0xd')]('/',auth[_0xfac7('0xc')](),controller[_0xfac7('0xe')]);router['put'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller['update']);router['delete'](_0xfac7('0xb'),auth[_0xfac7('0xc')](),controller[_0xfac7('0xf')]);module[_0xfac7('0x10')]=router; \ No newline at end of file +var _0x2392=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x2d6e3b,_0x5a141f){var _0x204809=function(_0x551a85){while(--_0x551a85){_0x2d6e3b['push'](_0x2d6e3b['shift']());}};_0x204809(++_0x5a141f);}(_0x2392,0xd0));var _0x2239=function(_0x59bee5,_0x5c3de6){_0x59bee5=_0x59bee5-0x0;var _0x2dec2f=_0x2392[_0x59bee5];return _0x2dec2f;};'use strict';var multer=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var path=require('path');var timeout=require(_0x2239('0x2'));var express=require(_0x2239('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2239('0x4'));var interaction=require(_0x2239('0x5'));var config=require(_0x2239('0x6'));var controller=require(_0x2239('0x7'));router[_0x2239('0x8')]('/',auth[_0x2239('0x9')](),controller[_0x2239('0xa')]);router[_0x2239('0x8')](_0x2239('0xb'),auth[_0x2239('0x9')](),controller[_0x2239('0xc')]);router[_0x2239('0xd')]('/',auth[_0x2239('0x9')](),controller['create']);router[_0x2239('0xe')](_0x2239('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2239('0xf')](_0x2239('0xb'),auth[_0x2239('0x9')](),controller[_0x2239('0x10')]);module[_0x2239('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index b9e12e1..3c8cf3c 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 _0xc7d5=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x569731,_0x1fc2fd){var _0x508e6b=function(_0x505f26){while(--_0x505f26){_0x569731['push'](_0x569731['shift']());}};_0x508e6b(++_0x1fc2fd);}(_0xc7d5,0x1a4));var _0x5c7d=function(_0x2adeb1,_0x4e9f65){_0x2adeb1=_0x2adeb1-0x0;var _0x2103a7=_0xc7d5[_0x2adeb1];return _0x2103a7;};'use strict';var Sequelize=require(_0x5c7d('0x0'));module[_0x5c7d('0x1')]={'type':{'type':Sequelize[_0x5c7d('0x2')](_0x5c7d('0x3'),_0x5c7d('0x4'),_0x5c7d('0x5'),'keyValue',_0x5c7d('0x6')),'defaultValue':_0x5c7d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x5c7d('0x3'),_0x5c7d('0x4'),_0x5c7d('0x5'))},'keyContent':{'type':Sequelize[_0x5c7d('0x7')]},'idField':{'type':Sequelize[_0x5c7d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5c7d('0x7')]}}; \ No newline at end of file +var _0xc1af=['keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable'];(function(_0x1367ed,_0x3cbbe0){var _0x100ec4=function(_0x3032de){while(--_0x3032de){_0x1367ed['push'](_0x1367ed['shift']());}};_0x100ec4(++_0x3cbbe0);}(_0xc1af,0x1cc));var _0xfc1a=function(_0x141df4,_0x239fc0){_0x141df4=_0x141df4-0x0;var _0x518c0f=_0xc1af[_0x141df4];return _0x518c0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfc1a('0x0')](_0xfc1a('0x1'),_0xfc1a('0x2'),_0xfc1a('0x3'),_0xfc1a('0x4'),_0xfc1a('0x5')),'defaultValue':_0xfc1a('0x1')},'content':{'type':Sequelize[_0xfc1a('0x6')]},'key':{'type':Sequelize[_0xfc1a('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xfc1a('0x1'),'variable',_0xfc1a('0x3'))},'keyContent':{'type':Sequelize[_0xfc1a('0x6')]},'idField':{'type':Sequelize[_0xfc1a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfc1a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b49190d..3304082 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 _0x4cc1=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','FreshsalesField','rawAttributes','type','query','filters','intersection','attributes','model','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','keys','fields','length','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x1d484c,_0x27c954){var _0xb2ec18=function(_0x504d25){while(--_0x504d25){_0x1d484c['push'](_0x1d484c['shift']());}};_0xb2ec18(++_0x27c954);}(_0x4cc1,0x1a8));var _0x14cc=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x4cc1[_0x350343];return _0x9afc1c;};'use strict';var emlformat=require(_0x14cc('0x0'));var rimraf=require(_0x14cc('0x1'));var zipdir=require(_0x14cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14cc('0x3'));var moment=require(_0x14cc('0x4'));var BPromise=require(_0x14cc('0x5'));var Mustache=require(_0x14cc('0x6'));var util=require(_0x14cc('0x7'));var path=require(_0x14cc('0x8'));var sox=require(_0x14cc('0x9'));var csv=require(_0x14cc('0xa'));var ejs=require(_0x14cc('0xb'));var fs=require('fs');var fs_extra=require(_0x14cc('0xc'));var _=require(_0x14cc('0xd'));var squel=require(_0x14cc('0xe'));var crypto=require(_0x14cc('0xf'));var jsforce=require(_0x14cc('0x10'));var deskjs=require(_0x14cc('0x11'));var toCsv=require(_0x14cc('0xa'));var querystring=require(_0x14cc('0x12'));var Papa=require('papaparse');var Redis=require(_0x14cc('0x13'));var authService=require(_0x14cc('0x14'));var qs=require(_0x14cc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14cc('0x16'));var logger=require('../../config/logger')(_0x14cc('0x17'));var utils=require(_0x14cc('0x18'));var config=require(_0x14cc('0x19'));var licenseUtil=require(_0x14cc('0x1a'));var db=require(_0x14cc('0x1b'))['db'];function respondWithStatusCode(_0x3d3c3f,_0x18248b){_0x18248b=_0x18248b||0xcc;return function(_0x3ec279){if(_0x3ec279){return _0x3d3c3f[_0x14cc('0x1c')](_0x18248b);}return _0x3d3c3f[_0x14cc('0x1d')](_0x18248b)[_0x14cc('0x1e')]();};}function respondWithResult(_0x1e08ab,_0x5c3bee){_0x5c3bee=_0x5c3bee||0xc8;return function(_0x483287){if(_0x483287){return _0x1e08ab[_0x14cc('0x1d')](_0x5c3bee)[_0x14cc('0x1f')](_0x483287);}};}function respondWithFilteredResult(_0x1981ca,_0x3e8f06){return function(_0x491f61){if(_0x491f61){var _0x3c40b6=typeof _0x3e8f06[_0x14cc('0x20')]===_0x14cc('0x21')&&typeof _0x3e8f06['limit']==='undefined';var _0x78167c=_0x491f61['count'];var _0xea2208=_0x3c40b6?0x0:_0x3e8f06[_0x14cc('0x20')];var _0x4a1854=_0x3c40b6?_0x491f61['count']:_0x3e8f06[_0x14cc('0x20')]+_0x3e8f06['limit'];var _0x5bf5f3;if(_0x4a1854>=_0x78167c){_0x4a1854=_0x78167c;_0x5bf5f3=0xc8;}else{_0x5bf5f3=0xce;}_0x1981ca[_0x14cc('0x1d')](_0x5bf5f3);return _0x1981ca[_0x14cc('0x22')](_0x14cc('0x23'),_0xea2208+'-'+_0x4a1854+'/'+_0x78167c)['json'](_0x491f61);}return null;};}function patchUpdates(_0x4412b1){return function(_0x2da4d2){try{jsonpatch[_0x14cc('0x24')](_0x2da4d2,_0x4412b1,!![]);}catch(_0x190100){return BPromise[_0x14cc('0x25')](_0x190100);}return _0x2da4d2[_0x14cc('0x26')]();};}function saveUpdates(_0x2888ee,_0x1b9b39){return function(_0x9fd06){if(_0x9fd06){return _0x9fd06[_0x14cc('0x27')](_0x2888ee)[_0x14cc('0x28')](function(_0x19a6f5){return _0x19a6f5;});}return null;};}function removeEntity(_0x1361e2,_0x4d9b18){return function(_0x15a136){if(_0x15a136){return _0x15a136[_0x14cc('0x29')]()[_0x14cc('0x28')](function(){_0x1361e2[_0x14cc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47add0,_0x2742b5){return function(_0x17ee7c){if(!_0x17ee7c){_0x47add0[_0x14cc('0x1c')](0x194);}return _0x17ee7c;};}function handleError(_0x20493b,_0x3e93e0){_0x3e93e0=_0x3e93e0||0x1f4;return function(_0x52fb47){logger[_0x14cc('0x2a')](_0x52fb47['stack']);if(_0x52fb47[_0x14cc('0x2b')]){delete _0x52fb47[_0x14cc('0x2b')];}_0x20493b[_0x14cc('0x1d')](_0x3e93e0)['send'](_0x52fb47);};}exports[_0x14cc('0x2c')]=function(_0xe492bc,_0x25d1e2){var _0x12d064={},_0x4e8759={},_0x4e47be={'count':0x0,'rows':[]};var _0x44d453=_[_0x14cc('0x2d')](db[_0x14cc('0x2e')][_0x14cc('0x2f')],function(_0x295f6b){return{'name':_0x295f6b['fieldName'],'type':_0x295f6b[_0x14cc('0x30')]['key']};});_0x4e8759['model']=_[_0x14cc('0x2d')](_0x44d453,_0x14cc('0x2b'));_0x4e8759['query']=_['keys'](_0xe492bc[_0x14cc('0x31')]);_0x4e8759[_0x14cc('0x32')]=_[_0x14cc('0x33')](_0x4e8759['model'],_0x4e8759['query']);_0x12d064[_0x14cc('0x34')]=_['intersection'](_0x4e8759['model'],qs['fields'](_0xe492bc['query']['fields']));_0x12d064[_0x14cc('0x34')]=_0x12d064[_0x14cc('0x34')]['length']?_0x12d064[_0x14cc('0x34')]:_0x4e8759[_0x14cc('0x35')];if(!_0xe492bc[_0x14cc('0x31')][_0x14cc('0x36')](_0x14cc('0x37'))){_0x12d064[_0x14cc('0x38')]=qs[_0x14cc('0x38')](_0xe492bc['query'][_0x14cc('0x38')]);_0x12d064[_0x14cc('0x20')]=qs[_0x14cc('0x20')](_0xe492bc['query'][_0x14cc('0x20')]);}_0x12d064['order']=qs[_0x14cc('0x39')](_0xe492bc[_0x14cc('0x31')][_0x14cc('0x39')]);_0x12d064[_0x14cc('0x3a')]=qs[_0x14cc('0x32')](_[_0x14cc('0x3b')](_0xe492bc['query'],_0x4e8759['filters']),_0x44d453);if(_0xe492bc[_0x14cc('0x31')][_0x14cc('0x3c')]){_0x12d064['where']=_[_0x14cc('0x3d')](_0x12d064[_0x14cc('0x3a')],{'$or':_[_0x14cc('0x2d')](_0x44d453,function(_0x168abb){if(_0x168abb[_0x14cc('0x30')]!==_0x14cc('0x3e')){var _0x2ef139={};_0x2ef139[_0x168abb[_0x14cc('0x2b')]]={'$like':'%'+_0xe492bc[_0x14cc('0x31')][_0x14cc('0x3c')]+'%'};return _0x2ef139;}})});}_0x12d064=_['merge']({},_0x12d064,_0xe492bc[_0x14cc('0x3f')]);var _0x10992c={'where':_0x12d064[_0x14cc('0x3a')]};return db[_0x14cc('0x2e')][_0x14cc('0x40')](_0x10992c)['then'](function(_0x2124b6){_0x4e47be['count']=_0x2124b6;if(_0xe492bc['query'][_0x14cc('0x41')]){_0x12d064['include']=[{'all':!![]}];}return db[_0x14cc('0x2e')]['findAll'](_0x12d064);})[_0x14cc('0x28')](function(_0x2399ea){_0x4e47be[_0x14cc('0x42')]=_0x2399ea;return _0x4e47be;})[_0x14cc('0x28')](respondWithFilteredResult(_0x25d1e2,_0x12d064))[_0x14cc('0x43')](handleError(_0x25d1e2,null));};exports['show']=function(_0x3a915c,_0x42cb20){var _0x5ee25e={'raw':!![],'where':{'id':_0x3a915c['params']['id']}},_0x2ccfdf={};_0x2ccfdf[_0x14cc('0x35')]=_['keys'](db[_0x14cc('0x2e')][_0x14cc('0x2f')]);_0x2ccfdf['query']=_[_0x14cc('0x44')](_0x3a915c[_0x14cc('0x31')]);_0x2ccfdf[_0x14cc('0x32')]=_[_0x14cc('0x33')](_0x2ccfdf['model'],_0x2ccfdf[_0x14cc('0x31')]);_0x5ee25e['attributes']=_['intersection'](_0x2ccfdf[_0x14cc('0x35')],qs[_0x14cc('0x45')](_0x3a915c[_0x14cc('0x31')]['fields']));_0x5ee25e[_0x14cc('0x34')]=_0x5ee25e[_0x14cc('0x34')][_0x14cc('0x46')]?_0x5ee25e['attributes']:_0x2ccfdf[_0x14cc('0x35')];if(_0x3a915c[_0x14cc('0x31')][_0x14cc('0x41')]){_0x5ee25e['include']=[{'all':!![]}];}_0x5ee25e=_['merge']({},_0x5ee25e,_0x3a915c[_0x14cc('0x3f')]);return db['FreshsalesField'][_0x14cc('0x47')](_0x5ee25e)['then'](handleEntityNotFound(_0x42cb20,null))[_0x14cc('0x28')](respondWithResult(_0x42cb20,null))['catch'](handleError(_0x42cb20,null));};exports[_0x14cc('0x48')]=function(_0x3bb010,_0x449661){return db[_0x14cc('0x2e')][_0x14cc('0x48')](_0x3bb010['body'],{})[_0x14cc('0x28')](respondWithResult(_0x449661,0xc9))[_0x14cc('0x43')](handleError(_0x449661,null));};exports[_0x14cc('0x27')]=function(_0x2ecba3,_0x57a684){if(_0x2ecba3[_0x14cc('0x49')]['id']){delete _0x2ecba3[_0x14cc('0x49')]['id'];}return db[_0x14cc('0x2e')]['find']({'where':{'id':_0x2ecba3[_0x14cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57a684,null))[_0x14cc('0x28')](saveUpdates(_0x2ecba3[_0x14cc('0x49')],null))[_0x14cc('0x28')](respondWithResult(_0x57a684,null))[_0x14cc('0x43')](handleError(_0x57a684,null));};exports[_0x14cc('0x29')]=function(_0x424a6f,_0x3df6dc){return db[_0x14cc('0x2e')][_0x14cc('0x47')]({'where':{'id':_0x424a6f['params']['id']}})[_0x14cc('0x28')](handleEntityNotFound(_0x3df6dc,null))['then'](removeEntity(_0x3df6dc,null))[_0x14cc('0x43')](handleError(_0x3df6dc,null));}; \ No newline at end of file +var _0xd14c=['apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','FreshsalesField','findAll','rows','show','params','rawAttributes','find','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd14c,0xc0));var _0xcd14=function(_0x45a3cc,_0x42c43a){_0x45a3cc=_0x45a3cc-0x0;var _0x448a0b=_0xd14c[_0x45a3cc];return _0x448a0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcd14('0x0'));var jsonpatch=require(_0xcd14('0x1'));var rp=require(_0xcd14('0x2'));var moment=require(_0xcd14('0x3'));var BPromise=require(_0xcd14('0x4'));var Mustache=require(_0xcd14('0x5'));var util=require(_0xcd14('0x6'));var path=require(_0xcd14('0x7'));var sox=require('sox');var csv=require(_0xcd14('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd14('0x9'));var squel=require(_0xcd14('0xa'));var crypto=require(_0xcd14('0xb'));var jsforce=require(_0xcd14('0xc'));var deskjs=require(_0xcd14('0xd'));var toCsv=require(_0xcd14('0x8'));var querystring=require(_0xcd14('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd14('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd14('0x10'));var as=require(_0xcd14('0x11'));var hardwareService=require(_0xcd14('0x12'));var logger=require(_0xcd14('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd14('0x14'))['db'];function respondWithStatusCode(_0x5eb8de,_0x36f463){_0x36f463=_0x36f463||0xcc;return function(_0x1a1495){if(_0x1a1495){return _0x5eb8de[_0xcd14('0x15')](_0x36f463);}return _0x5eb8de[_0xcd14('0x16')](_0x36f463)[_0xcd14('0x17')]();};}function respondWithResult(_0xbb6bf3,_0x1e1b10){_0x1e1b10=_0x1e1b10||0xc8;return function(_0x4ef7a2){if(_0x4ef7a2){return _0xbb6bf3[_0xcd14('0x16')](_0x1e1b10)[_0xcd14('0x18')](_0x4ef7a2);}};}function respondWithFilteredResult(_0x70a923,_0x44229d){return function(_0x18634f){if(_0x18634f){var _0x1611d8=typeof _0x44229d[_0xcd14('0x19')]===_0xcd14('0x1a')&&typeof _0x44229d['limit']===_0xcd14('0x1a');var _0x5f1c19=_0x18634f[_0xcd14('0x1b')];var _0x447019=_0x1611d8?0x0:_0x44229d[_0xcd14('0x19')];var _0x37433a=_0x1611d8?_0x18634f[_0xcd14('0x1b')]:_0x44229d['offset']+_0x44229d[_0xcd14('0x1c')];var _0xdc74a4;if(_0x37433a>=_0x5f1c19){_0x37433a=_0x5f1c19;_0xdc74a4=0xc8;}else{_0xdc74a4=0xce;}_0x70a923[_0xcd14('0x16')](_0xdc74a4);return _0x70a923[_0xcd14('0x1d')]('Content-Range',_0x447019+'-'+_0x37433a+'/'+_0x5f1c19)[_0xcd14('0x18')](_0x18634f);}return null;};}function patchUpdates(_0x2ffdde){return function(_0x53a82d){try{jsonpatch[_0xcd14('0x1e')](_0x53a82d,_0x2ffdde,!![]);}catch(_0x19edd0){return BPromise[_0xcd14('0x1f')](_0x19edd0);}return _0x53a82d[_0xcd14('0x20')]();};}function saveUpdates(_0x408340,_0x1779ad){return function(_0x5d072d){if(_0x5d072d){return _0x5d072d[_0xcd14('0x21')](_0x408340)['then'](function(_0x4b0430){return _0x4b0430;});}return null;};}function removeEntity(_0x148a67,_0x181f51){return function(_0x3f9915){if(_0x3f9915){return _0x3f9915['destroy']()[_0xcd14('0x22')](function(){_0x148a67['status'](0xcc)[_0xcd14('0x17')]();});}};}function handleEntityNotFound(_0x54695f,_0x197bc8){return function(_0xf013e){if(!_0xf013e){_0x54695f[_0xcd14('0x15')](0x194);}return _0xf013e;};}function handleError(_0x22d0f5,_0x90761){_0x90761=_0x90761||0x1f4;return function(_0x463de9){logger[_0xcd14('0x23')](_0x463de9[_0xcd14('0x24')]);if(_0x463de9['name']){delete _0x463de9[_0xcd14('0x25')];}_0x22d0f5['status'](_0x90761)[_0xcd14('0x26')](_0x463de9);};}exports[_0xcd14('0x27')]=function(_0x1953de,_0x1b72c0){var _0x405f4f={},_0x5e992e={},_0x36a3d6={'count':0x0,'rows':[]};var _0x11de30=_[_0xcd14('0x28')](db['FreshsalesField']['rawAttributes'],function(_0x2f632a){return{'name':_0x2f632a[_0xcd14('0x29')],'type':_0x2f632a[_0xcd14('0x2a')][_0xcd14('0x2b')]};});_0x5e992e[_0xcd14('0x2c')]=_['map'](_0x11de30,_0xcd14('0x25'));_0x5e992e[_0xcd14('0x2d')]=_[_0xcd14('0x2e')](_0x1953de[_0xcd14('0x2d')]);_0x5e992e[_0xcd14('0x2f')]=_[_0xcd14('0x30')](_0x5e992e['model'],_0x5e992e['query']);_0x405f4f[_0xcd14('0x31')]=_[_0xcd14('0x30')](_0x5e992e['model'],qs['fields'](_0x1953de[_0xcd14('0x2d')][_0xcd14('0x32')]));_0x405f4f[_0xcd14('0x31')]=_0x405f4f[_0xcd14('0x31')]['length']?_0x405f4f[_0xcd14('0x31')]:_0x5e992e[_0xcd14('0x2c')];if(!_0x1953de['query'][_0xcd14('0x33')](_0xcd14('0x34'))){_0x405f4f['limit']=qs[_0xcd14('0x1c')](_0x1953de['query'][_0xcd14('0x1c')]);_0x405f4f[_0xcd14('0x19')]=qs[_0xcd14('0x19')](_0x1953de['query'][_0xcd14('0x19')]);}_0x405f4f[_0xcd14('0x35')]=qs[_0xcd14('0x36')](_0x1953de[_0xcd14('0x2d')][_0xcd14('0x36')]);_0x405f4f['where']=qs['filters'](_[_0xcd14('0x37')](_0x1953de[_0xcd14('0x2d')],_0x5e992e[_0xcd14('0x2f')]),_0x11de30);if(_0x1953de[_0xcd14('0x2d')][_0xcd14('0x38')]){_0x405f4f[_0xcd14('0x39')]=_[_0xcd14('0x3a')](_0x405f4f[_0xcd14('0x39')],{'$or':_[_0xcd14('0x28')](_0x11de30,function(_0x137593){if(_0x137593[_0xcd14('0x2a')]!==_0xcd14('0x3b')){var _0x1df49d={};_0x1df49d[_0x137593[_0xcd14('0x25')]]={'$like':'%'+_0x1953de[_0xcd14('0x2d')]['filter']+'%'};return _0x1df49d;}})});}_0x405f4f=_[_0xcd14('0x3a')]({},_0x405f4f,_0x1953de[_0xcd14('0x3c')]);var _0x389250={'where':_0x405f4f['where']};return db['FreshsalesField'][_0xcd14('0x1b')](_0x389250)[_0xcd14('0x22')](function(_0x57f77a){_0x36a3d6['count']=_0x57f77a;if(_0x1953de[_0xcd14('0x2d')][_0xcd14('0x3d')]){_0x405f4f[_0xcd14('0x3e')]=[{'all':!![]}];}return db[_0xcd14('0x3f')][_0xcd14('0x40')](_0x405f4f);})[_0xcd14('0x22')](function(_0x19fa69){_0x36a3d6[_0xcd14('0x41')]=_0x19fa69;return _0x36a3d6;})[_0xcd14('0x22')](respondWithFilteredResult(_0x1b72c0,_0x405f4f))['catch'](handleError(_0x1b72c0,null));};exports[_0xcd14('0x42')]=function(_0x4ea563,_0x3b3576){var _0x20765d={'raw':!![],'where':{'id':_0x4ea563[_0xcd14('0x43')]['id']}},_0x4cfc7b={};_0x4cfc7b[_0xcd14('0x2c')]=_[_0xcd14('0x2e')](db[_0xcd14('0x3f')][_0xcd14('0x44')]);_0x4cfc7b[_0xcd14('0x2d')]=_[_0xcd14('0x2e')](_0x4ea563['query']);_0x4cfc7b[_0xcd14('0x2f')]=_[_0xcd14('0x30')](_0x4cfc7b[_0xcd14('0x2c')],_0x4cfc7b[_0xcd14('0x2d')]);_0x20765d['attributes']=_[_0xcd14('0x30')](_0x4cfc7b[_0xcd14('0x2c')],qs['fields'](_0x4ea563[_0xcd14('0x2d')][_0xcd14('0x32')]));_0x20765d['attributes']=_0x20765d['attributes']['length']?_0x20765d[_0xcd14('0x31')]:_0x4cfc7b['model'];if(_0x4ea563[_0xcd14('0x2d')][_0xcd14('0x3d')]){_0x20765d[_0xcd14('0x3e')]=[{'all':!![]}];}_0x20765d=_[_0xcd14('0x3a')]({},_0x20765d,_0x4ea563[_0xcd14('0x3c')]);return db[_0xcd14('0x3f')][_0xcd14('0x45')](_0x20765d)[_0xcd14('0x22')](handleEntityNotFound(_0x3b3576,null))['then'](respondWithResult(_0x3b3576,null))['catch'](handleError(_0x3b3576,null));};exports[_0xcd14('0x46')]=function(_0x3f8e0e,_0x4d5c50){return db[_0xcd14('0x3f')][_0xcd14('0x46')](_0x3f8e0e[_0xcd14('0x47')],{})[_0xcd14('0x22')](respondWithResult(_0x4d5c50,0xc9))[_0xcd14('0x48')](handleError(_0x4d5c50,null));};exports[_0xcd14('0x21')]=function(_0x548d19,_0x11c4e3){if(_0x548d19[_0xcd14('0x47')]['id']){delete _0x548d19[_0xcd14('0x47')]['id'];}return db[_0xcd14('0x3f')][_0xcd14('0x45')]({'where':{'id':_0x548d19[_0xcd14('0x43')]['id']}})['then'](handleEntityNotFound(_0x11c4e3,null))[_0xcd14('0x22')](saveUpdates(_0x548d19['body'],null))[_0xcd14('0x22')](respondWithResult(_0x11c4e3,null))[_0xcd14('0x48')](handleError(_0x11c4e3,null));};exports[_0xcd14('0x49')]=function(_0x286817,_0x47fb37){return db[_0xcd14('0x3f')][_0xcd14('0x45')]({'where':{'id':_0x286817[_0xcd14('0x43')]['id']}})[_0xcd14('0x22')](handleEntityNotFound(_0x47fb37,null))[_0xcd14('0x22')](removeEntity(_0x47fb37,null))[_0xcd14('0x48')](handleError(_0x47fb37,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 9db7750..518cb17 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 _0xdbc6=['int_freshsales_fields','freshsales_unique_index','idField','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField'];(function(_0x5b4cab,_0x5a6796){var _0x2a6c82=function(_0x54f5dc){while(--_0x54f5dc){_0x5b4cab['push'](_0x5b4cab['shift']());}};_0x2a6c82(++_0x5a6796);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x343261,_0x6710a7){_0x343261=_0x343261-0x0;var _0x14ad75=_0xdbc6[_0x343261];return _0x14ad75;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6dbc('0x0'))('api');var moment=require(_0x6dbc('0x1'));var BPromise=require(_0x6dbc('0x2'));var rp=require(_0x6dbc('0x3'));var fs=require('fs');var path=require(_0x6dbc('0x4'));var rimraf=require(_0x6dbc('0x5'));var config=require(_0x6dbc('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x6dbc('0x7')]=function(_0x434e1a,_0x5ebe85){return _0x434e1a[_0x6dbc('0x8')](_0x6dbc('0x9'),attributes,{'tableName':_0x6dbc('0xa'),'paranoid':![],'indexes':[{'name':_0x6dbc('0xb'),'fields':[_0x6dbc('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa413=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x27fbfc,_0x4ec14f){var _0x27fb46=function(_0x5de8cd){while(--_0x5de8cd){_0x27fbfc['push'](_0x27fbfc['shift']());}};_0x27fb46(++_0x4ec14f);}(_0xa413,0x1e5));var _0x3a41=function(_0x37018e,_0x5af306){_0x37018e=_0x37018e-0x0;var _0x1b3d18=_0xa413[_0x37018e];return _0x1b3d18;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var logger=require(_0x3a41('0x1'))('api');var moment=require(_0x3a41('0x2'));var BPromise=require(_0x3a41('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3a41('0x4'));var config=require(_0x3a41('0x5'));var attributes=require(_0x3a41('0x6'));module[_0x3a41('0x7')]=function(_0x25d3e0,_0x1af004){return _0x25d3e0[_0x3a41('0x8')](_0x3a41('0x9'),attributes,{'tableName':_0x3a41('0xa'),'paranoid':![],'indexes':[{'name':_0x3a41('0xb'),'fields':[_0x3a41('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 a459d21..6f712d8 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 _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x33f614,_0x5242a8){var _0x564db2=function(_0x16d3e0){while(--_0x16d3e0){_0x33f614['push'](_0x33f614['shift']());}};_0x564db2(++_0x5242a8);}(_0x7c09,0x102));var _0x97c0=function(_0x123d95,_0x508460){_0x123d95=_0x123d95-0x0;var _0x5a8fef=_0x7c09[_0x123d95];return _0x5a8fef;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x250404,_0x1f0a7c){var _0x34e46d=function(_0x209f88){while(--_0x209f88){_0x250404['push'](_0x250404['shift']());}};_0x34e46d(++_0x1f0a7c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1d9bba,_0x1ba0bf){_0x1d9bba=_0x1d9bba-0x0;var _0x5f1f98=_0xb4c7[_0x1d9bba];return _0x5f1f98;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e426017..00ceb08 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(_0x28ac37,_0x213dd0){var _0x320b95=function(_0x4c6e10){while(--_0x4c6e10){_0x28ac37['push'](_0x28ac37['shift']());}};_0x320b95(++_0x213dd0);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4338ed,_0x5326b8){var _0x2a7ae8=function(_0x420f8b){while(--_0x420f8b){_0x4338ed['push'](_0x4338ed['shift']());}};_0x2a7ae8(++_0x5326b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 2073a59..b996a6b 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 _0xdadc=['ENUM','integrationTab','sequelize','STRING','username'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0xdadc,0x75));var _0xcdad=function(_0x33667c,_0x46e469){_0x33667c=_0x33667c-0x0;var _0x3c574b=_0xdadc[_0x33667c];return _0x3c574b;};'use strict';var Sequelize=require(_0xcdad('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcdad('0x1')]},'username':{'type':Sequelize[_0xcdad('0x1')],'unique':_0xcdad('0x2')},'remoteUri':{'type':Sequelize[_0xcdad('0x1')]},'password':{'type':Sequelize[_0xcdad('0x1')]},'clientId':{'type':Sequelize[_0xcdad('0x1')]},'clientSecret':{'type':Sequelize[_0xcdad('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xcdad('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xcdad('0x3')](_0xcdad('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xcf61=['integrationTab','newTab','exports','STRING','username','ENUM'];(function(_0x3b2ade,_0x30682c){var _0x432c8e=function(_0x3d3305){while(--_0x3d3305){_0x3b2ade['push'](_0x3b2ade['shift']());}};_0x432c8e(++_0x30682c);}(_0xcf61,0xda));var _0x1cf6=function(_0x4042ba,_0x3c3714){_0x4042ba=_0x4042ba-0x0;var _0x1ee111=_0xcf61[_0x4042ba];return _0x1ee111;};'use strict';var Sequelize=require('sequelize');module[_0x1cf6('0x0')]={'name':{'type':Sequelize[_0x1cf6('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1cf6('0x1')],'unique':_0x1cf6('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1cf6('0x1')]},'clientSecret':{'type':Sequelize[_0x1cf6('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1cf6('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cf6('0x3')](_0x1cf6('0x4'),_0x1cf6('0x5')),'defaultValue':_0x1cf6('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0832803..c7ce42b 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 _0x2de1=['label','custom','picklistValues','value','True','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','body','destroy','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','create','getFields','remoteUri','clientId','clientSecret','username','password','login','concat','securityToken','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes'];(function(_0x4c6bca,_0x3de390){var _0x29d58e=function(_0x1ac871){while(--_0x1ac871){_0x4c6bca['push'](_0x4c6bca['shift']());}};_0x29d58e(++_0x3de390);}(_0x2de1,0x1f3));var _0x12de=function(_0xd8cdc6,_0x1aaba9){_0xd8cdc6=_0xd8cdc6-0x0;var _0x487d52=_0x2de1[_0xd8cdc6];return _0x487d52;};'use strict';var emlformat=require(_0x12de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12de('0x1'));var jsonpatch=require(_0x12de('0x2'));var rp=require(_0x12de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x12de('0x4'));var util=require(_0x12de('0x5'));var path=require('path');var sox=require(_0x12de('0x6'));var csv=require(_0x12de('0x7'));var ejs=require(_0x12de('0x8'));var fs=require('fs');var fs_extra=require(_0x12de('0x9'));var _=require(_0x12de('0xa'));var squel=require(_0x12de('0xb'));var crypto=require('crypto');var jsforce=require(_0x12de('0xc'));var deskjs=require(_0x12de('0xd'));var toCsv=require('to-csv');var querystring=require(_0x12de('0xe'));var Papa=require(_0x12de('0xf'));var Redis=require(_0x12de('0x10'));var authService=require(_0x12de('0x11'));var qs=require(_0x12de('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12de('0x13'));var logger=require(_0x12de('0x14'))(_0x12de('0x15'));var utils=require(_0x12de('0x16'));var config=require(_0x12de('0x17'));var licenseUtil=require(_0x12de('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x41ef28,_0x29643a){_0x29643a=_0x29643a||0xcc;return function(_0x544eaf){if(_0x544eaf){return _0x41ef28['sendStatus'](_0x29643a);}return _0x41ef28[_0x12de('0x19')](_0x29643a)[_0x12de('0x1a')]();};}function respondWithResult(_0x365a38,_0x415624){_0x415624=_0x415624||0xc8;return function(_0x199c24){if(_0x199c24){return _0x365a38['status'](_0x415624)[_0x12de('0x1b')](_0x199c24);}};}function respondWithFilteredResult(_0x1ba4d3,_0x90b547){return function(_0xb0f0fe){if(_0xb0f0fe){var _0x9011d3=typeof _0x90b547[_0x12de('0x1c')]==='undefined'&&typeof _0x90b547['limit']==='undefined';var _0x1ee3eb=_0xb0f0fe[_0x12de('0x1d')];var _0x5c5075=_0x9011d3?0x0:_0x90b547['offset'];var _0x447599=_0x9011d3?_0xb0f0fe[_0x12de('0x1d')]:_0x90b547[_0x12de('0x1c')]+_0x90b547[_0x12de('0x1e')];var _0x3d398e;if(_0x447599>=_0x1ee3eb){_0x447599=_0x1ee3eb;_0x3d398e=0xc8;}else{_0x3d398e=0xce;}_0x1ba4d3[_0x12de('0x19')](_0x3d398e);return _0x1ba4d3[_0x12de('0x1f')](_0x12de('0x20'),_0x5c5075+'-'+_0x447599+'/'+_0x1ee3eb)[_0x12de('0x1b')](_0xb0f0fe);}return null;};}function patchUpdates(_0x24141a){return function(_0x111a45){try{jsonpatch[_0x12de('0x21')](_0x111a45,_0x24141a,!![]);}catch(_0x40201f){return BPromise[_0x12de('0x22')](_0x40201f);}return _0x111a45['save']();};}function saveUpdates(_0x2bbd0b,_0x2c457d){return function(_0x1e9b03){if(_0x1e9b03){return _0x1e9b03[_0x12de('0x23')](_0x2bbd0b)['then'](function(_0x3883c2){return _0x3883c2;});}return null;};}function removeEntity(_0x124d68,_0x1af76a){return function(_0x1d7d66){if(_0x1d7d66){return _0x1d7d66['destroy']()[_0x12de('0x24')](function(){_0x124d68['status'](0xcc)[_0x12de('0x1a')]();});}};}function handleEntityNotFound(_0x402474,_0x104801){return function(_0x45f480){if(!_0x45f480){_0x402474[_0x12de('0x25')](0x194);}return _0x45f480;};}function handleError(_0x40faf0,_0x591ed3){_0x591ed3=_0x591ed3||0x1f4;return function(_0x5b69a0){logger[_0x12de('0x26')](_0x5b69a0[_0x12de('0x27')]);if(_0x5b69a0[_0x12de('0x28')]){delete _0x5b69a0[_0x12de('0x28')];}_0x40faf0['status'](_0x591ed3)[_0x12de('0x29')](_0x5b69a0);};}exports['index']=function(_0x141f6b,_0x58b08f){var _0x98d805={},_0x4eaf8f={},_0x5f19a8={'count':0x0,'rows':[]};var _0x2626c0=_[_0x12de('0x2a')](db[_0x12de('0x2b')][_0x12de('0x2c')],function(_0x33b423){return{'name':_0x33b423['fieldName'],'type':_0x33b423[_0x12de('0x2d')][_0x12de('0x2e')]};});_0x4eaf8f[_0x12de('0x2f')]=_['map'](_0x2626c0,_0x12de('0x28'));_0x4eaf8f[_0x12de('0x30')]=_[_0x12de('0x31')](_0x141f6b[_0x12de('0x30')]);_0x4eaf8f['filters']=_[_0x12de('0x32')](_0x4eaf8f[_0x12de('0x2f')],_0x4eaf8f[_0x12de('0x30')]);_0x98d805['attributes']=_[_0x12de('0x32')](_0x4eaf8f[_0x12de('0x2f')],qs[_0x12de('0x33')](_0x141f6b[_0x12de('0x30')]['fields']));_0x98d805[_0x12de('0x34')]=_0x98d805[_0x12de('0x34')]['length']?_0x98d805[_0x12de('0x34')]:_0x4eaf8f[_0x12de('0x2f')];if(!_0x141f6b[_0x12de('0x30')][_0x12de('0x35')](_0x12de('0x36'))){_0x98d805['limit']=qs[_0x12de('0x1e')](_0x141f6b['query']['limit']);_0x98d805['offset']=qs[_0x12de('0x1c')](_0x141f6b[_0x12de('0x30')][_0x12de('0x1c')]);}_0x98d805['order']=qs['sort'](_0x141f6b[_0x12de('0x30')][_0x12de('0x37')]);_0x98d805[_0x12de('0x38')]=qs[_0x12de('0x39')](_['pick'](_0x141f6b[_0x12de('0x30')],_0x4eaf8f[_0x12de('0x39')]),_0x2626c0);if(_0x141f6b[_0x12de('0x30')][_0x12de('0x3a')]){_0x98d805['where']=_[_0x12de('0x3b')](_0x98d805[_0x12de('0x38')],{'$or':_[_0x12de('0x2a')](_0x2626c0,function(_0x4de13b){if(_0x4de13b['type']!==_0x12de('0x3c')){var _0x97c5e5={};_0x97c5e5[_0x4de13b['name']]={'$like':'%'+_0x141f6b[_0x12de('0x30')][_0x12de('0x3a')]+'%'};return _0x97c5e5;}})});}_0x98d805=_[_0x12de('0x3b')]({},_0x98d805,_0x141f6b[_0x12de('0x3d')]);var _0x246294={'where':_0x98d805[_0x12de('0x38')]};return db[_0x12de('0x2b')]['count'](_0x246294)[_0x12de('0x24')](function(_0x5cc1ef){_0x5f19a8[_0x12de('0x1d')]=_0x5cc1ef;if(_0x141f6b[_0x12de('0x30')][_0x12de('0x3e')]){_0x98d805[_0x12de('0x3f')]=[{'all':!![]}];}return db[_0x12de('0x2b')][_0x12de('0x40')](_0x98d805);})[_0x12de('0x24')](function(_0x1e98dc){_0x5f19a8[_0x12de('0x41')]=_0x1e98dc;return _0x5f19a8;})[_0x12de('0x24')](respondWithFilteredResult(_0x58b08f,_0x98d805))[_0x12de('0x42')](handleError(_0x58b08f,null));};exports[_0x12de('0x43')]=function(_0x1fef84,_0x2b3029){var _0x5089d1={'raw':![],'where':{'id':_0x1fef84['params']['id']}},_0x5e30ea={};_0x5e30ea[_0x12de('0x2f')]=_[_0x12de('0x31')](db['SalesforceAccount'][_0x12de('0x2c')]);_0x5e30ea['query']=_['keys'](_0x1fef84['query']);_0x5e30ea[_0x12de('0x39')]=_[_0x12de('0x32')](_0x5e30ea[_0x12de('0x2f')],_0x5e30ea[_0x12de('0x30')]);_0x5089d1['attributes']=_[_0x12de('0x32')](_0x5e30ea['model'],qs[_0x12de('0x33')](_0x1fef84[_0x12de('0x30')]['fields']));_0x5089d1['attributes']=_0x5089d1[_0x12de('0x34')][_0x12de('0x44')]?_0x5089d1[_0x12de('0x34')]:_0x5e30ea[_0x12de('0x2f')];if(_0x1fef84[_0x12de('0x30')][_0x12de('0x3e')]){_0x5089d1['include']=[{'all':!![]}];}_0x5089d1=_['merge']({},_0x5089d1,_0x1fef84[_0x12de('0x3d')]);return db[_0x12de('0x2b')][_0x12de('0x45')](_0x5089d1)['then'](handleEntityNotFound(_0x2b3029,null))[_0x12de('0x24')](respondWithResult(_0x2b3029,null))[_0x12de('0x42')](handleError(_0x2b3029,null));};exports['create']=function(_0x155d9f,_0x470f42){return db[_0x12de('0x2b')]['create'](_0x155d9f[_0x12de('0x46')],{})[_0x12de('0x24')](respondWithResult(_0x470f42,0xc9))[_0x12de('0x42')](handleError(_0x470f42,null));};exports[_0x12de('0x23')]=function(_0x3e8ca7,_0x26483d){if(_0x3e8ca7[_0x12de('0x46')]['id']){delete _0x3e8ca7[_0x12de('0x46')]['id'];}return db[_0x12de('0x2b')][_0x12de('0x45')]({'where':{'id':_0x3e8ca7['params']['id']}})['then'](handleEntityNotFound(_0x26483d,null))[_0x12de('0x24')](saveUpdates(_0x3e8ca7[_0x12de('0x46')],null))[_0x12de('0x24')](respondWithResult(_0x26483d,null))[_0x12de('0x42')](handleError(_0x26483d,null));};exports[_0x12de('0x47')]=function(_0x38bade,_0x4a292b){return db['SalesforceAccount'][_0x12de('0x45')]({'where':{'id':_0x38bade[_0x12de('0x48')]['id']}})[_0x12de('0x24')](handleEntityNotFound(_0x4a292b,null))[_0x12de('0x24')](removeEntity(_0x4a292b,null))['catch'](handleError(_0x4a292b,null));};exports[_0x12de('0x49')]=function(_0x42c653,_0x157db5,_0x2ce3e7){var _0x4798fc={};var _0xde750a={};var _0x40aa54;var _0x1625f4;return db[_0x12de('0x2b')][_0x12de('0x4a')]({'where':{'id':_0x42c653[_0x12de('0x48')]['id']}})[_0x12de('0x24')](handleEntityNotFound(_0x157db5,null))[_0x12de('0x24')](function(_0x40e1f0){if(_0x40e1f0){_0x40aa54=_0x40e1f0;_0xde750a[_0x12de('0x2f')]=_[_0x12de('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0xde750a[_0x12de('0x30')]=_[_0x12de('0x31')](_0x42c653['query']);_0xde750a[_0x12de('0x39')]=_[_0x12de('0x32')](_0xde750a[_0x12de('0x2f')],_0xde750a[_0x12de('0x30')]);_0x4798fc['attributes']=_[_0x12de('0x32')](_0xde750a['model'],qs[_0x12de('0x33')](_0x42c653[_0x12de('0x30')][_0x12de('0x33')]));_0x4798fc[_0x12de('0x34')]=_0x4798fc['attributes'][_0x12de('0x44')]?_0x4798fc[_0x12de('0x34')]:_0xde750a[_0x12de('0x2f')];_0x4798fc[_0x12de('0x4b')]=qs[_0x12de('0x37')](_0x42c653[_0x12de('0x30')][_0x12de('0x37')]);_0x4798fc['where']=qs['filters'](_[_0x12de('0x4c')](_0x42c653[_0x12de('0x30')],_0xde750a['filters']));if(_0x42c653['query'][_0x12de('0x3a')]){_0x4798fc[_0x12de('0x38')]=_['merge'](_0x4798fc[_0x12de('0x38')],{'$or':_[_0x12de('0x2a')](_0x4798fc['attributes'],function(_0x257cc4){var _0x375a68={};_0x375a68[_0x257cc4]={'$like':'%'+_0x42c653[_0x12de('0x30')][_0x12de('0x3a')]+'%'};return _0x375a68;})});}_0x4798fc=_[_0x12de('0x3b')]({},_0x4798fc,_0x42c653[_0x12de('0x3d')]);return _0x40aa54['getConfigurations'](_0x4798fc);}})[_0x12de('0x24')](function(_0x26cacd){if(_0x26cacd){_0x1625f4=_0x26cacd[_0x12de('0x44')];if(!_0x42c653[_0x12de('0x30')][_0x12de('0x35')](_0x12de('0x36'))){_0x4798fc[_0x12de('0x1e')]=qs[_0x12de('0x1e')](_0x42c653['query'][_0x12de('0x1e')]);_0x4798fc[_0x12de('0x1c')]=qs[_0x12de('0x1c')](_0x42c653['query'][_0x12de('0x1c')]);}return _0x40aa54['getConfigurations'](_0x4798fc);}})[_0x12de('0x24')](function(_0x434b98){if(_0x434b98){return _0x434b98?{'count':_0x1625f4,'rows':_0x434b98}:null;}})[_0x12de('0x24')](respondWithResult(_0x157db5,null))[_0x12de('0x42')](handleError(_0x157db5,null));};exports[_0x12de('0x4d')]=function(_0x477630,_0x2ad6e8,_0x4a0ded){if(_0x477630[_0x12de('0x46')]['id']){delete _0x477630[_0x12de('0x46')]['id'];}return db[_0x12de('0x2b')][_0x12de('0x4a')]({'where':{'id':_0x477630[_0x12de('0x48')]['id']}})[_0x12de('0x24')](handleEntityNotFound(_0x2ad6e8,null))[_0x12de('0x24')](function(_0x37afd2){if(_0x37afd2){_0x477630[_0x12de('0x46')][_0x12de('0x4e')]=_0x37afd2['id'];_0x477630[_0x12de('0x46')][_0x12de('0x4f')]=integrations[_0x12de('0x50')](_0x477630[_0x12de('0x46')][_0x12de('0x51')],_0x477630[_0x12de('0x46')]['type']);_0x477630['body'][_0x12de('0x52')]=integrations[_0x12de('0x53')](_0x477630['body']['channel'],_0x477630[_0x12de('0x46')][_0x12de('0x2d')]);return db[_0x12de('0x54')][_0x12de('0x55')](_0x477630['body'],{'include':[{'model':db['SalesforceField'],'as':_0x12de('0x4f')},{'model':db['SalesforceField'],'as':_0x12de('0x52')}]});}return null;})[_0x12de('0x24')](respondWithResult(_0x2ad6e8,null))[_0x12de('0x42')](handleError(_0x2ad6e8,null));};exports[_0x12de('0x56')]=function(_0x3beb41,_0x144cc2,_0x42313f){var _0x5e0d2c;var _0x1039b8='';var _0x1e47bb='Task';return db['SalesforceAccount'][_0x12de('0x4a')]({'where':{'id':_0x3beb41[_0x12de('0x48')]['id']},'attributes':['id',_0x12de('0x57'),_0x12de('0x58'),_0x12de('0x59'),_0x12de('0x5a'),_0x12de('0x5b'),'securityToken']})[_0x12de('0x24')](handleEntityNotFound(_0x144cc2,null))[_0x12de('0x24')](function(_0x4d782f){if(_0x4d782f){_0x1039b8=_0x4d782f[_0x12de('0x57')];var _0x2f141b=_0x1039b8['slice'](-0x1);if(_0x2f141b==='/'){_0x1039b8=_0x1039b8['substring'](0x0,_0x1039b8['lastIndexOf'](_0x2f141b));}_0x5e0d2c=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1039b8,'clientId':_0x4d782f[_0x12de('0x58')],'clientSecret':_0x4d782f[_0x12de('0x59')]}});return _0x5e0d2c[_0x12de('0x5c')](_0x4d782f[_0x12de('0x5a')],_0x4d782f[_0x12de('0x5b')][_0x12de('0x5d')](_0x4d782f[_0x12de('0x5e')]));}})['then'](function(_0x1aa62d){if(_0x1aa62d){if(!_[_0x12de('0x5f')](_0x3beb41[_0x12de('0x30')][_0x12de('0x60')])){_0x1e47bb=_0x3beb41['query']['ticketType'];}return _0x5e0d2c[_0x12de('0x61')](_0x1e47bb)['describe']();}})['then'](function(_0x1578ea){var _0xf121da=[_0x12de('0x62'),_0x12de('0x63'),_0x12de('0x64'),_0x12de('0x65'),_0x12de('0x66'),'Description'];var _0x58244b=[_0x12de('0x67'),'int',_0x12de('0x68'),_0x12de('0x69'),_0x12de('0x6a'),_0x12de('0x6b'),_0x12de('0x6c')];if(_0x1578ea){_[_0x12de('0x6d')](_0x1578ea['fields'],function(_0x5e6aec){return _0xf121da[_0x12de('0x6e')](_0x5e6aec[_0x12de('0x28')])||!_0x58244b[_0x12de('0x6e')](_0x5e6aec[_0x12de('0x2d')]);});return{'count':_0x1578ea[_0x12de('0x33')][_0x12de('0x44')],'rows':_[_0x12de('0x2a')](_0x1578ea[_0x12de('0x33')],function(_0x32e2b2){return{'id':_0x32e2b2[_0x12de('0x28')],'name':_0x32e2b2[_0x12de('0x6f')],'custom':_0x32e2b2[_0x12de('0x70')],'options':_0x32e2b2['picklistValues'][_0x12de('0x44')]>0x0?_[_0x12de('0x2a')](_0x32e2b2[_0x12de('0x71')],function(_0x14394d){return{'name':_0x14394d[_0x12de('0x6f')],'value':_0x14394d[_0x12de('0x72')]};}):_0x32e2b2[_0x12de('0x2d')]==_0x12de('0x69')?[{'name':_0x12de('0x73'),'value':'true'},{'name':'False','value':_0x12de('0x74')}]:[]};})};}})['then'](respondWithResult(_0x144cc2,null))[_0x12de('0x42')](function(_0x28a8d1){var _0x421c83=_0x3beb41[_0x12de('0x30')]['test']?0x1f4:_0x28a8d1[_0x12de('0x75')]||0x1f4;logger[_0x12de('0x26')](_0x12de('0x76'),_0x12de('0x56'),_0x421c83,JSON[_0x12de('0x77')](_0x28a8d1));delete _0x28a8d1[_0x12de('0x28')];if(_0x421c83===0x191){_0x421c83=0x190;}_0x144cc2['status'](_0x421c83)[_0x12de('0x29')](_0x3beb41['query'][_0x12de('0x78')]?{'message':_0x12de('0x79'),'statusCode':_0x28a8d1[_0x12de('0x75')]}:_0x28a8d1);});}; \ No newline at end of file +var _0xa7fa=['include','findAll','rows','show','params','includeAll','find','catch','create','body','findOne','SalesforceConfiguration','pick','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','False','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','save','update','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options'];(function(_0x5a65da,_0x5e8d5d){var _0x3d01e3=function(_0x2f571f){while(--_0x2f571f){_0x5a65da['push'](_0x5a65da['shift']());}};_0x3d01e3(++_0x5e8d5d);}(_0xa7fa,0xb7));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaa7f('0x1'));var rp=require(_0xaa7f('0x2'));var moment=require(_0xaa7f('0x3'));var BPromise=require(_0xaa7f('0x4'));var Mustache=require('mustache');var util=require(_0xaa7f('0x5'));var path=require(_0xaa7f('0x6'));var sox=require(_0xaa7f('0x7'));var csv=require(_0xaa7f('0x8'));var ejs=require(_0xaa7f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa7f('0xa'));var _=require(_0xaa7f('0xb'));var squel=require(_0xaa7f('0xc'));var crypto=require(_0xaa7f('0xd'));var jsforce=require(_0xaa7f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaa7f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa7f('0xf'));var qs=require(_0xaa7f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa7f('0x11'));var logger=require(_0xaa7f('0x12'))(_0xaa7f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa7f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa7f('0x15'))['db'];var integrations=require(_0xaa7f('0x16'));function respondWithStatusCode(_0x5d276d,_0x15f4d6){_0x15f4d6=_0x15f4d6||0xcc;return function(_0x4fc2df){if(_0x4fc2df){return _0x5d276d[_0xaa7f('0x17')](_0x15f4d6);}return _0x5d276d[_0xaa7f('0x18')](_0x15f4d6)[_0xaa7f('0x19')]();};}function respondWithResult(_0x33e6cf,_0x418dd2){_0x418dd2=_0x418dd2||0xc8;return function(_0x62f20e){if(_0x62f20e){return _0x33e6cf['status'](_0x418dd2)[_0xaa7f('0x1a')](_0x62f20e);}};}function respondWithFilteredResult(_0x507141,_0x44b417){return function(_0x3f809f){if(_0x3f809f){var _0x5df006=typeof _0x44b417[_0xaa7f('0x1b')]===_0xaa7f('0x1c')&&typeof _0x44b417[_0xaa7f('0x1d')]==='undefined';var _0x17a88b=_0x3f809f[_0xaa7f('0x1e')];var _0x26e4b3=_0x5df006?0x0:_0x44b417[_0xaa7f('0x1b')];var _0x2b4b06=_0x5df006?_0x3f809f['count']:_0x44b417[_0xaa7f('0x1b')]+_0x44b417[_0xaa7f('0x1d')];var _0x4c0740;if(_0x2b4b06>=_0x17a88b){_0x2b4b06=_0x17a88b;_0x4c0740=0xc8;}else{_0x4c0740=0xce;}_0x507141[_0xaa7f('0x18')](_0x4c0740);return _0x507141['set']('Content-Range',_0x26e4b3+'-'+_0x2b4b06+'/'+_0x17a88b)[_0xaa7f('0x1a')](_0x3f809f);}return null;};}function patchUpdates(_0x54cc1d){return function(_0x3760d){try{jsonpatch['apply'](_0x3760d,_0x54cc1d,!![]);}catch(_0x38330a){return BPromise['reject'](_0x38330a);}return _0x3760d[_0xaa7f('0x1f')]();};}function saveUpdates(_0x4b7009,_0x409fc6){return function(_0x1cb501){if(_0x1cb501){return _0x1cb501[_0xaa7f('0x20')](_0x4b7009)[_0xaa7f('0x21')](function(_0xd70f05){return _0xd70f05;});}return null;};}function removeEntity(_0x116769,_0x295d55){return function(_0x69df84){if(_0x69df84){return _0x69df84['destroy']()[_0xaa7f('0x21')](function(){_0x116769[_0xaa7f('0x18')](0xcc)[_0xaa7f('0x19')]();});}};}function handleEntityNotFound(_0x1be30f,_0x20b1d9){return function(_0x518fa8){if(!_0x518fa8){_0x1be30f[_0xaa7f('0x17')](0x194);}return _0x518fa8;};}function handleError(_0x878a02,_0x4e568b){_0x4e568b=_0x4e568b||0x1f4;return function(_0x547dd0){logger[_0xaa7f('0x22')](_0x547dd0[_0xaa7f('0x23')]);if(_0x547dd0['name']){delete _0x547dd0[_0xaa7f('0x24')];}_0x878a02['status'](_0x4e568b)[_0xaa7f('0x25')](_0x547dd0);};}exports[_0xaa7f('0x26')]=function(_0x174fcd,_0x336527){var _0x43c07e={},_0x56ab07={},_0x5b30b5={'count':0x0,'rows':[]};var _0x4446bc=_[_0xaa7f('0x27')](db[_0xaa7f('0x28')][_0xaa7f('0x29')],function(_0x194866){return{'name':_0x194866[_0xaa7f('0x2a')],'type':_0x194866[_0xaa7f('0x2b')][_0xaa7f('0x2c')]};});_0x56ab07[_0xaa7f('0x2d')]=_[_0xaa7f('0x27')](_0x4446bc,_0xaa7f('0x24'));_0x56ab07['query']=_[_0xaa7f('0x2e')](_0x174fcd[_0xaa7f('0x2f')]);_0x56ab07[_0xaa7f('0x30')]=_[_0xaa7f('0x31')](_0x56ab07[_0xaa7f('0x2d')],_0x56ab07[_0xaa7f('0x2f')]);_0x43c07e[_0xaa7f('0x32')]=_['intersection'](_0x56ab07[_0xaa7f('0x2d')],qs['fields'](_0x174fcd[_0xaa7f('0x2f')][_0xaa7f('0x33')]));_0x43c07e[_0xaa7f('0x32')]=_0x43c07e['attributes'][_0xaa7f('0x34')]?_0x43c07e[_0xaa7f('0x32')]:_0x56ab07[_0xaa7f('0x2d')];if(!_0x174fcd[_0xaa7f('0x2f')][_0xaa7f('0x35')](_0xaa7f('0x36'))){_0x43c07e['limit']=qs[_0xaa7f('0x1d')](_0x174fcd[_0xaa7f('0x2f')][_0xaa7f('0x1d')]);_0x43c07e['offset']=qs[_0xaa7f('0x1b')](_0x174fcd[_0xaa7f('0x2f')]['offset']);}_0x43c07e[_0xaa7f('0x37')]=qs[_0xaa7f('0x38')](_0x174fcd[_0xaa7f('0x2f')][_0xaa7f('0x38')]);_0x43c07e[_0xaa7f('0x39')]=qs['filters'](_['pick'](_0x174fcd[_0xaa7f('0x2f')],_0x56ab07['filters']),_0x4446bc);if(_0x174fcd[_0xaa7f('0x2f')]['filter']){_0x43c07e[_0xaa7f('0x39')]=_[_0xaa7f('0x3a')](_0x43c07e['where'],{'$or':_[_0xaa7f('0x27')](_0x4446bc,function(_0x36667b){if(_0x36667b['type']!==_0xaa7f('0x3b')){var _0x5ae2f4={};_0x5ae2f4[_0x36667b[_0xaa7f('0x24')]]={'$like':'%'+_0x174fcd['query']['filter']+'%'};return _0x5ae2f4;}})});}_0x43c07e=_[_0xaa7f('0x3a')]({},_0x43c07e,_0x174fcd[_0xaa7f('0x3c')]);var _0x2afb57={'where':_0x43c07e[_0xaa7f('0x39')]};return db[_0xaa7f('0x28')][_0xaa7f('0x1e')](_0x2afb57)[_0xaa7f('0x21')](function(_0x3e8144){_0x5b30b5['count']=_0x3e8144;if(_0x174fcd['query']['includeAll']){_0x43c07e[_0xaa7f('0x3d')]=[{'all':!![]}];}return db[_0xaa7f('0x28')][_0xaa7f('0x3e')](_0x43c07e);})[_0xaa7f('0x21')](function(_0x4d24d3){_0x5b30b5[_0xaa7f('0x3f')]=_0x4d24d3;return _0x5b30b5;})['then'](respondWithFilteredResult(_0x336527,_0x43c07e))['catch'](handleError(_0x336527,null));};exports[_0xaa7f('0x40')]=function(_0x3e83af,_0x360f2d){var _0x48debe={'raw':![],'where':{'id':_0x3e83af[_0xaa7f('0x41')]['id']}},_0x536324={};_0x536324[_0xaa7f('0x2d')]=_[_0xaa7f('0x2e')](db['SalesforceAccount'][_0xaa7f('0x29')]);_0x536324[_0xaa7f('0x2f')]=_['keys'](_0x3e83af[_0xaa7f('0x2f')]);_0x536324['filters']=_[_0xaa7f('0x31')](_0x536324['model'],_0x536324['query']);_0x48debe['attributes']=_[_0xaa7f('0x31')](_0x536324['model'],qs[_0xaa7f('0x33')](_0x3e83af[_0xaa7f('0x2f')][_0xaa7f('0x33')]));_0x48debe['attributes']=_0x48debe[_0xaa7f('0x32')][_0xaa7f('0x34')]?_0x48debe[_0xaa7f('0x32')]:_0x536324[_0xaa7f('0x2d')];if(_0x3e83af[_0xaa7f('0x2f')][_0xaa7f('0x42')]){_0x48debe['include']=[{'all':!![]}];}_0x48debe=_[_0xaa7f('0x3a')]({},_0x48debe,_0x3e83af[_0xaa7f('0x3c')]);return db[_0xaa7f('0x28')][_0xaa7f('0x43')](_0x48debe)[_0xaa7f('0x21')](handleEntityNotFound(_0x360f2d,null))[_0xaa7f('0x21')](respondWithResult(_0x360f2d,null))[_0xaa7f('0x44')](handleError(_0x360f2d,null));};exports[_0xaa7f('0x45')]=function(_0x459359,_0x66fba8){return db[_0xaa7f('0x28')][_0xaa7f('0x45')](_0x459359[_0xaa7f('0x46')],{})[_0xaa7f('0x21')](respondWithResult(_0x66fba8,0xc9))[_0xaa7f('0x44')](handleError(_0x66fba8,null));};exports[_0xaa7f('0x20')]=function(_0x316acd,_0x22c529){if(_0x316acd[_0xaa7f('0x46')]['id']){delete _0x316acd['body']['id'];}return db[_0xaa7f('0x28')][_0xaa7f('0x43')]({'where':{'id':_0x316acd[_0xaa7f('0x41')]['id']}})[_0xaa7f('0x21')](handleEntityNotFound(_0x22c529,null))[_0xaa7f('0x21')](saveUpdates(_0x316acd[_0xaa7f('0x46')],null))['then'](respondWithResult(_0x22c529,null))[_0xaa7f('0x44')](handleError(_0x22c529,null));};exports['destroy']=function(_0x242ea4,_0x164009){return db['SalesforceAccount'][_0xaa7f('0x43')]({'where':{'id':_0x242ea4[_0xaa7f('0x41')]['id']}})[_0xaa7f('0x21')](handleEntityNotFound(_0x164009,null))[_0xaa7f('0x21')](removeEntity(_0x164009,null))['catch'](handleError(_0x164009,null));};exports['getConfigurations']=function(_0x2b7fa0,_0x19c057,_0x43afef){var _0x32109b={};var _0x2ef2cd={};var _0x24e866;var _0x52dddd;return db['SalesforceAccount'][_0xaa7f('0x47')]({'where':{'id':_0x2b7fa0[_0xaa7f('0x41')]['id']}})['then'](handleEntityNotFound(_0x19c057,null))[_0xaa7f('0x21')](function(_0x3b54dc){if(_0x3b54dc){_0x24e866=_0x3b54dc;_0x2ef2cd[_0xaa7f('0x2d')]=_[_0xaa7f('0x2e')](db[_0xaa7f('0x48')][_0xaa7f('0x29')]);_0x2ef2cd[_0xaa7f('0x2f')]=_[_0xaa7f('0x2e')](_0x2b7fa0[_0xaa7f('0x2f')]);_0x2ef2cd[_0xaa7f('0x30')]=_[_0xaa7f('0x31')](_0x2ef2cd[_0xaa7f('0x2d')],_0x2ef2cd[_0xaa7f('0x2f')]);_0x32109b[_0xaa7f('0x32')]=_[_0xaa7f('0x31')](_0x2ef2cd['model'],qs['fields'](_0x2b7fa0[_0xaa7f('0x2f')][_0xaa7f('0x33')]));_0x32109b[_0xaa7f('0x32')]=_0x32109b[_0xaa7f('0x32')]['length']?_0x32109b[_0xaa7f('0x32')]:_0x2ef2cd[_0xaa7f('0x2d')];_0x32109b[_0xaa7f('0x37')]=qs[_0xaa7f('0x38')](_0x2b7fa0['query'][_0xaa7f('0x38')]);_0x32109b[_0xaa7f('0x39')]=qs[_0xaa7f('0x30')](_[_0xaa7f('0x49')](_0x2b7fa0['query'],_0x2ef2cd[_0xaa7f('0x30')]));if(_0x2b7fa0['query'][_0xaa7f('0x4a')]){_0x32109b['where']=_[_0xaa7f('0x3a')](_0x32109b['where'],{'$or':_[_0xaa7f('0x27')](_0x32109b[_0xaa7f('0x32')],function(_0x55ea25){var _0x48a6a7={};_0x48a6a7[_0x55ea25]={'$like':'%'+_0x2b7fa0[_0xaa7f('0x2f')][_0xaa7f('0x4a')]+'%'};return _0x48a6a7;})});}_0x32109b=_[_0xaa7f('0x3a')]({},_0x32109b,_0x2b7fa0[_0xaa7f('0x3c')]);return _0x24e866[_0xaa7f('0x4b')](_0x32109b);}})[_0xaa7f('0x21')](function(_0x45a034){if(_0x45a034){_0x52dddd=_0x45a034['length'];if(!_0x2b7fa0[_0xaa7f('0x2f')][_0xaa7f('0x35')](_0xaa7f('0x36'))){_0x32109b['limit']=qs['limit'](_0x2b7fa0[_0xaa7f('0x2f')][_0xaa7f('0x1d')]);_0x32109b[_0xaa7f('0x1b')]=qs[_0xaa7f('0x1b')](_0x2b7fa0[_0xaa7f('0x2f')][_0xaa7f('0x1b')]);}return _0x24e866[_0xaa7f('0x4b')](_0x32109b);}})[_0xaa7f('0x21')](function(_0x421241){if(_0x421241){return _0x421241?{'count':_0x52dddd,'rows':_0x421241}:null;}})[_0xaa7f('0x21')](respondWithResult(_0x19c057,null))[_0xaa7f('0x44')](handleError(_0x19c057,null));};exports[_0xaa7f('0x4c')]=function(_0x133e0a,_0x2efe8b,_0x1355da){if(_0x133e0a[_0xaa7f('0x46')]['id']){delete _0x133e0a[_0xaa7f('0x46')]['id'];}return db[_0xaa7f('0x28')][_0xaa7f('0x47')]({'where':{'id':_0x133e0a[_0xaa7f('0x41')]['id']}})[_0xaa7f('0x21')](handleEntityNotFound(_0x2efe8b,null))[_0xaa7f('0x21')](function(_0x161ab4){if(_0x161ab4){_0x133e0a[_0xaa7f('0x46')][_0xaa7f('0x4d')]=_0x161ab4['id'];_0x133e0a[_0xaa7f('0x46')][_0xaa7f('0x4e')]=integrations[_0xaa7f('0x4f')](_0x133e0a[_0xaa7f('0x46')][_0xaa7f('0x50')],_0x133e0a[_0xaa7f('0x46')][_0xaa7f('0x2b')]);_0x133e0a[_0xaa7f('0x46')][_0xaa7f('0x51')]=integrations['getDescriptions'](_0x133e0a[_0xaa7f('0x46')][_0xaa7f('0x50')],_0x133e0a['body']['type']);return db[_0xaa7f('0x48')][_0xaa7f('0x45')](_0x133e0a['body'],{'include':[{'model':db[_0xaa7f('0x52')],'as':_0xaa7f('0x4e')},{'model':db[_0xaa7f('0x52')],'as':_0xaa7f('0x51')}]});}return null;})[_0xaa7f('0x21')](respondWithResult(_0x2efe8b,null))['catch'](handleError(_0x2efe8b,null));};exports['getFields']=function(_0x228ab9,_0x1b0323,_0x236f4f){var _0x10e34b;var _0x26e274='';var _0x32d483=_0xaa7f('0x53');return db['SalesforceAccount'][_0xaa7f('0x47')]({'where':{'id':_0x228ab9[_0xaa7f('0x41')]['id']},'attributes':['id',_0xaa7f('0x54'),_0xaa7f('0x55'),_0xaa7f('0x56'),_0xaa7f('0x57'),_0xaa7f('0x58'),_0xaa7f('0x59')]})[_0xaa7f('0x21')](handleEntityNotFound(_0x1b0323,null))[_0xaa7f('0x21')](function(_0x129189){if(_0x129189){_0x26e274=_0x129189[_0xaa7f('0x54')];var _0x3097d6=_0x26e274[_0xaa7f('0x5a')](-0x1);if(_0x3097d6==='/'){_0x26e274=_0x26e274[_0xaa7f('0x5b')](0x0,_0x26e274[_0xaa7f('0x5c')](_0x3097d6));}_0x10e34b=new jsforce[(_0xaa7f('0x5d'))]({'oauth2':{'loginUrl':_0x26e274,'clientId':_0x129189[_0xaa7f('0x55')],'clientSecret':_0x129189[_0xaa7f('0x56')]}});return _0x10e34b[_0xaa7f('0x5e')](_0x129189[_0xaa7f('0x57')],_0x129189['password'][_0xaa7f('0x5f')](_0x129189[_0xaa7f('0x59')]));}})[_0xaa7f('0x21')](function(_0x4a295a){if(_0x4a295a){if(!_['isNil'](_0x228ab9[_0xaa7f('0x2f')][_0xaa7f('0x60')])){_0x32d483=_0x228ab9[_0xaa7f('0x2f')][_0xaa7f('0x60')];}return _0x10e34b[_0xaa7f('0x61')](_0x32d483)[_0xaa7f('0x62')]();}})[_0xaa7f('0x21')](function(_0x1e7e60){var _0x31a664=[_0xaa7f('0x63'),_0xaa7f('0x64'),_0xaa7f('0x65'),'IsRecurrence',_0xaa7f('0x66'),_0xaa7f('0x67')];var _0x49db88=[_0xaa7f('0x68'),_0xaa7f('0x69'),_0xaa7f('0x6a'),_0xaa7f('0x6b'),_0xaa7f('0x6c'),_0xaa7f('0x6d'),_0xaa7f('0x6e')];if(_0x1e7e60){_['remove'](_0x1e7e60['fields'],function(_0x8dd038){return _0x31a664['includes'](_0x8dd038['name'])||!_0x49db88[_0xaa7f('0x6f')](_0x8dd038[_0xaa7f('0x2b')]);});return{'count':_0x1e7e60[_0xaa7f('0x33')][_0xaa7f('0x34')],'rows':_[_0xaa7f('0x27')](_0x1e7e60[_0xaa7f('0x33')],function(_0x468423){return{'id':_0x468423[_0xaa7f('0x24')],'name':_0x468423[_0xaa7f('0x70')],'custom':_0x468423[_0xaa7f('0x71')],'options':_0x468423[_0xaa7f('0x72')]['length']>0x0?_[_0xaa7f('0x27')](_0x468423['picklistValues'],function(_0xb187e){return{'name':_0xb187e[_0xaa7f('0x70')],'value':_0xb187e[_0xaa7f('0x73')]};}):_0x468423[_0xaa7f('0x2b')]=='boolean'?[{'name':_0xaa7f('0x74'),'value':'true'},{'name':_0xaa7f('0x75'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x1b0323,null))[_0xaa7f('0x44')](function(_0x683f){var _0x1a27aa=_0x228ab9[_0xaa7f('0x2f')]['test']?0x1f4:_0x683f['statusCode']||0x1f4;logger[_0xaa7f('0x22')](_0xaa7f('0x76'),_0xaa7f('0x77'),_0x1a27aa,JSON['stringify'](_0x683f));delete _0x683f[_0xaa7f('0x24')];if(_0x1a27aa===0x191){_0x1a27aa=0x190;}_0x1b0323[_0xaa7f('0x18')](_0x1a27aa)[_0xaa7f('0x25')](_0x228ab9[_0xaa7f('0x2f')]['test']?{'message':_0xaa7f('0x78'),'statusCode':_0x683f[_0xaa7f('0x79')]}:_0x683f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 52f69ae..2bf91e1 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 _0x1ee2=['../../config/logger','api','moment','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x22ba30,_0x5d123c){var _0x26e931=function(_0x1fd7bf){while(--_0x1fd7bf){_0x22ba30['push'](_0x22ba30['shift']());}};_0x26e931(++_0x5d123c);}(_0x1ee2,0x11c));var _0x21ee=function(_0x478c65,_0x433cb2){_0x478c65=_0x478c65-0x0;var _0x37a5f9=_0x1ee2[_0x478c65];return _0x37a5f9;};'use strict';var _=require(_0x21ee('0x0'));var util=require(_0x21ee('0x1'));var logger=require(_0x21ee('0x2'))(_0x21ee('0x3'));var moment=require(_0x21ee('0x4'));var BPromise=require('bluebird');var rp=require(_0x21ee('0x5'));var fs=require('fs');var path=require(_0x21ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x21ee('0x7'));var integrations=require(_0x21ee('0x8'));module[_0x21ee('0x9')]=function(_0x20a492,_0x479a60){return _0x20a492[_0x21ee('0xa')](_0x21ee('0xb'),attributes,{'tableName':_0x21ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefc8=['bluebird','request-promise','path','rimraf','../../config/environment','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment'];(function(_0x561a1b,_0x223b2a){var _0x5ae8ab=function(_0xf24384){while(--_0xf24384){_0x561a1b['push'](_0x561a1b['shift']());}};_0x5ae8ab(++_0x223b2a);}(_0xefc8,0xf8));var _0x8efc=function(_0x3795a7,_0x12d975){_0x3795a7=_0x3795a7-0x0;var _0x67b4f9=_0xefc8[_0x3795a7];return _0x67b4f9;};'use strict';var _=require(_0x8efc('0x0'));var util=require(_0x8efc('0x1'));var logger=require('../../config/logger')(_0x8efc('0x2'));var moment=require(_0x8efc('0x3'));var BPromise=require(_0x8efc('0x4'));var rp=require(_0x8efc('0x5'));var fs=require('fs');var path=require(_0x8efc('0x6'));var rimraf=require(_0x8efc('0x7'));var config=require(_0x8efc('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5aee43,_0x3e717e){return _0x5aee43[_0x8efc('0x9')](_0x8efc('0xa'),attributes,{'tableName':_0x8efc('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 6aedf77..1b6e92f 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 _0xd1b2=['client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','map','model','include','then','debug','ShowSalesforceAccount','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2d3728,_0x4c05b2){var _0x13bac3=function(_0x3db693){while(--_0x3db693){_0x2d3728['push'](_0x2d3728['shift']());}};_0x13bac3(++_0x4c05b2);}(_0xd1b2,0x10f));var _0x2d1b=function(_0x3fc3a9,_0x2ac297){_0x3fc3a9=_0x3fc3a9-0x0;var _0x15d167=_0xd1b2[_0x3fc3a9];return _0x15d167;};'use strict';var _=require('lodash');var util=require(_0x2d1b('0x0'));var moment=require(_0x2d1b('0x1'));var BPromise=require(_0x2d1b('0x2'));var rs=require(_0x2d1b('0x3'));var fs=require('fs');var Redis=require(_0x2d1b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d1b('0x5'));var logger=require(_0x2d1b('0x6'))(_0x2d1b('0x7'));var config=require(_0x2d1b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2d1b('0x9')][_0x2d1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3883c0,_0xb01660,_0x6edf96){return new BPromise(function(_0x12df14,_0x15199e){return client[_0x2d1b('0xb')](_0x3883c0,_0x6edf96)['then'](function(_0x1d66c5){logger[_0x2d1b('0xc')](_0x2d1b('0xd'),_0xb01660,_0x2d1b('0xe'));logger['debug'](_0x2d1b('0xf'),_0xb01660,_0x2d1b('0xe'),JSON['stringify'](_0x1d66c5));if(_0x1d66c5[_0x2d1b('0x10')]){if(_0x1d66c5[_0x2d1b('0x10')][_0x2d1b('0x11')]===0x1f4){logger[_0x2d1b('0x10')](_0x2d1b('0xd'),_0xb01660,_0x1d66c5[_0x2d1b('0x10')][_0x2d1b('0x12')]);return _0x15199e(_0x1d66c5[_0x2d1b('0x10')][_0x2d1b('0x12')]);}logger[_0x2d1b('0x10')](_0x2d1b('0xd'),_0xb01660,_0x1d66c5[_0x2d1b('0x10')][_0x2d1b('0x12')]);return _0x12df14(_0x1d66c5[_0x2d1b('0x10')][_0x2d1b('0x12')]);}else{logger[_0x2d1b('0xc')](_0x2d1b('0xd'),_0xb01660,_0x2d1b('0xe'));_0x12df14(_0x1d66c5['result'][_0x2d1b('0x12')]);}})[_0x2d1b('0x13')](function(_0x6dc274){logger[_0x2d1b('0x10')](_0x2d1b('0xd'),_0xb01660,_0x6dc274);_0x15199e(_0x6dc274);});});}exports[_0x2d1b('0x14')]=function(_0x2a99f0){var _0x546ce3=this;return new Promise(function(_0x1e8706,_0x13b5cd){return db[_0x2d1b('0x15')][_0x2d1b('0x16')]({'raw':_0x2a99f0[_0x2d1b('0x17')]?_0x2a99f0[_0x2d1b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2a99f0[_0x2d1b('0x17')]?_0x2a99f0[_0x2d1b('0x17')][_0x2d1b('0x18')]||null:null,'attributes':_0x2a99f0[_0x2d1b('0x17')]?_0x2a99f0['options'][_0x2d1b('0x19')]||null:null,'limit':_0x2a99f0[_0x2d1b('0x17')]?_0x2a99f0['options'][_0x2d1b('0x1a')]||null:null,'include':_0x2a99f0[_0x2d1b('0x17')]?_0x2a99f0[_0x2d1b('0x17')]['include']?_[_0x2d1b('0x1b')](_0x2a99f0[_0x2d1b('0x17')]['include'],function(_0x19e8b1){return{'model':db[_0x19e8b1[_0x2d1b('0x1c')]],'as':_0x19e8b1['as'],'attributes':_0x19e8b1[_0x2d1b('0x19')],'include':_0x19e8b1[_0x2d1b('0x1d')]?_[_0x2d1b('0x1b')](_0x19e8b1['include'],function(_0x17a3e6){return{'model':db[_0x17a3e6[_0x2d1b('0x1c')]],'as':_0x17a3e6['as'],'attributes':_0x17a3e6[_0x2d1b('0x19')],'include':_0x17a3e6[_0x2d1b('0x1d')]?_[_0x2d1b('0x1b')](_0x17a3e6[_0x2d1b('0x1d')],function(_0x22fdfd){return{'model':db[_0x22fdfd['model']],'as':_0x22fdfd['as'],'attributes':_0x22fdfd[_0x2d1b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2d1b('0x1e')](function(_0x19f95d){logger[_0x2d1b('0xc')]('GetSalesforceAccount',_0x2a99f0);logger[_0x2d1b('0x1f')](_0x2d1b('0x14'),_0x2a99f0,JSON['stringify'](_0x19f95d));_0x1e8706(_0x19f95d);})[_0x2d1b('0x13')](function(_0x164f80){logger[_0x2d1b('0x10')](_0x2d1b('0x14'),_0x164f80[_0x2d1b('0x12')],_0x2a99f0);_0x13b5cd(_0x546ce3[_0x2d1b('0x10')](0x1f4,_0x164f80[_0x2d1b('0x12')]));});});};exports[_0x2d1b('0x20')]=function(_0x2461e3){var _0x3ccb62=this;return new Promise(function(_0x515c3d,_0x1530e){return db['SalesforceAccount']['find']({'raw':_0x2461e3['options']?_0x2461e3[_0x2d1b('0x17')][_0x2d1b('0x21')]===undefined?!![]:![]:!![],'where':_0x2461e3[_0x2d1b('0x17')]?_0x2461e3[_0x2d1b('0x17')][_0x2d1b('0x18')]||null:null,'attributes':_0x2461e3[_0x2d1b('0x17')]?_0x2461e3['options'][_0x2d1b('0x19')]||null:null,'include':_0x2461e3[_0x2d1b('0x17')]?_0x2461e3[_0x2d1b('0x17')][_0x2d1b('0x1d')]?_['map'](_0x2461e3[_0x2d1b('0x17')][_0x2d1b('0x1d')],function(_0x42cfde){return{'model':db[_0x42cfde[_0x2d1b('0x1c')]],'as':_0x42cfde['as'],'attributes':_0x42cfde[_0x2d1b('0x19')],'include':_0x42cfde['include']?_[_0x2d1b('0x1b')](_0x42cfde[_0x2d1b('0x1d')],function(_0x121f80){return{'model':db[_0x121f80[_0x2d1b('0x1c')]],'as':_0x121f80['as'],'attributes':_0x121f80[_0x2d1b('0x19')],'include':_0x121f80['include']?_['map'](_0x121f80[_0x2d1b('0x1d')],function(_0x3b31f6){return{'model':db[_0x3b31f6[_0x2d1b('0x1c')]],'as':_0x3b31f6['as'],'attributes':_0x3b31f6[_0x2d1b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2d1b('0x1e')](function(_0x484edd){logger['info']('ShowSalesforceAccount',_0x2461e3);logger[_0x2d1b('0x1f')]('ShowSalesforceAccount',_0x2461e3,JSON[_0x2d1b('0x22')](_0x484edd));_0x515c3d(_0x484edd);})[_0x2d1b('0x13')](function(_0x2020eb){logger['error'](_0x2d1b('0x20'),_0x2020eb[_0x2d1b('0x12')],_0x2461e3);_0x1530e(_0x3ccb62['error'](0x1f4,_0x2020eb[_0x2d1b('0x12')]));});});}; \ No newline at end of file +var _0xda91=['include','model','attributes','map','ShowSalesforceAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit'];(function(_0xf8c2a2,_0x4dac74){var _0x53eba5=function(_0x34db92){while(--_0x34db92){_0xf8c2a2['push'](_0xf8c2a2['shift']());}};_0x53eba5(++_0x4dac74);}(_0xda91,0x72));var _0x1da9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xda91[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1da9('0x0'));var util=require('util');var moment=require(_0x1da9('0x1'));var BPromise=require(_0x1da9('0x2'));var rs=require(_0x1da9('0x3'));var fs=require('fs');var Redis=require(_0x1da9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1da9('0x5'))(_0x1da9('0x6'));var config=require(_0x1da9('0x7'));var jayson=require(_0x1da9('0x8'));var client=jayson[_0x1da9('0x9')][_0x1da9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b135f,_0x54a413,_0x5053a9){return new BPromise(function(_0x213939,_0x55342e){return client[_0x1da9('0xb')](_0x1b135f,_0x5053a9)[_0x1da9('0xc')](function(_0x59b66f){logger[_0x1da9('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x54a413,'request\x20sent');logger[_0x1da9('0xe')](_0x1da9('0xf'),_0x54a413,_0x1da9('0x10'),JSON[_0x1da9('0x11')](_0x59b66f));if(_0x59b66f[_0x1da9('0x12')]){if(_0x59b66f[_0x1da9('0x12')]['code']===0x1f4){logger[_0x1da9('0x12')](_0x1da9('0x13'),_0x54a413,_0x59b66f[_0x1da9('0x12')][_0x1da9('0x14')]);return _0x55342e(_0x59b66f[_0x1da9('0x12')][_0x1da9('0x14')]);}logger[_0x1da9('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x54a413,_0x59b66f[_0x1da9('0x12')]['message']);return _0x213939(_0x59b66f['error']['message']);}else{logger['info'](_0x1da9('0x13'),_0x54a413,_0x1da9('0x10'));_0x213939(_0x59b66f[_0x1da9('0x15')][_0x1da9('0x14')]);}})[_0x1da9('0x16')](function(_0x153467){logger['error'](_0x1da9('0x13'),_0x54a413,_0x153467);_0x55342e(_0x153467);});});}exports[_0x1da9('0x17')]=function(_0x1bceea){var _0x3d7985=this;return new Promise(function(_0x16482a,_0x2fd801){return db[_0x1da9('0x18')][_0x1da9('0x19')]({'raw':_0x1bceea[_0x1da9('0x1a')]?_0x1bceea['options'][_0x1da9('0x1b')]===undefined?!![]:![]:!![],'where':_0x1bceea['options']?_0x1bceea['options'][_0x1da9('0x1c')]||null:null,'attributes':_0x1bceea['options']?_0x1bceea[_0x1da9('0x1a')]['attributes']||null:null,'limit':_0x1bceea[_0x1da9('0x1a')]?_0x1bceea[_0x1da9('0x1a')][_0x1da9('0x1d')]||null:null,'include':_0x1bceea['options']?_0x1bceea[_0x1da9('0x1a')][_0x1da9('0x1e')]?_['map'](_0x1bceea['options']['include'],function(_0x412eac){return{'model':db[_0x412eac[_0x1da9('0x1f')]],'as':_0x412eac['as'],'attributes':_0x412eac[_0x1da9('0x20')],'include':_0x412eac['include']?_['map'](_0x412eac[_0x1da9('0x1e')],function(_0x5be2af){return{'model':db[_0x5be2af[_0x1da9('0x1f')]],'as':_0x5be2af['as'],'attributes':_0x5be2af['attributes'],'include':_0x5be2af['include']?_[_0x1da9('0x21')](_0x5be2af[_0x1da9('0x1e')],function(_0x11fc41){return{'model':db[_0x11fc41['model']],'as':_0x11fc41['as'],'attributes':_0x11fc41[_0x1da9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1da9('0xc')](function(_0x1148cc){logger[_0x1da9('0xd')](_0x1da9('0x17'),_0x1bceea);logger['debug'](_0x1da9('0x17'),_0x1bceea,JSON['stringify'](_0x1148cc));_0x16482a(_0x1148cc);})[_0x1da9('0x16')](function(_0xf5b222){logger[_0x1da9('0x12')](_0x1da9('0x17'),_0xf5b222[_0x1da9('0x14')],_0x1bceea);_0x2fd801(_0x3d7985[_0x1da9('0x12')](0x1f4,_0xf5b222[_0x1da9('0x14')]));});});};exports[_0x1da9('0x22')]=function(_0x52cedb){var _0x2a214a=this;return new Promise(function(_0x546c35,_0x25150a){return db['SalesforceAccount'][_0x1da9('0x23')]({'raw':_0x52cedb[_0x1da9('0x1a')]?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x1b')]===undefined?!![]:![]:!![],'where':_0x52cedb['options']?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x1c')]||null:null,'attributes':_0x52cedb['options']?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x20')]||null:null,'include':_0x52cedb[_0x1da9('0x1a')]?_0x52cedb[_0x1da9('0x1a')][_0x1da9('0x1e')]?_[_0x1da9('0x21')](_0x52cedb['options'][_0x1da9('0x1e')],function(_0x2494f3){return{'model':db[_0x2494f3[_0x1da9('0x1f')]],'as':_0x2494f3['as'],'attributes':_0x2494f3['attributes'],'include':_0x2494f3[_0x1da9('0x1e')]?_[_0x1da9('0x21')](_0x2494f3['include'],function(_0xf1847f){return{'model':db[_0xf1847f[_0x1da9('0x1f')]],'as':_0xf1847f['as'],'attributes':_0xf1847f['attributes'],'include':_0xf1847f['include']?_[_0x1da9('0x21')](_0xf1847f[_0x1da9('0x1e')],function(_0x45f38a){return{'model':db[_0x45f38a['model']],'as':_0x45f38a['as'],'attributes':_0x45f38a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1da9('0xc')](function(_0x4fe108){logger[_0x1da9('0xd')](_0x1da9('0x22'),_0x52cedb);logger[_0x1da9('0xe')](_0x1da9('0x22'),_0x52cedb,JSON[_0x1da9('0x11')](_0x4fe108));_0x546c35(_0x4fe108);})[_0x1da9('0x16')](function(_0x368d33){logger[_0x1da9('0x12')]('ShowSalesforceAccount',_0x368d33[_0x1da9('0x14')],_0x52cedb);_0x25150a(_0x2a214a['error'](0x1f4,_0x368d33[_0x1da9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6ab57d9..16a1a86 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 _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(_0x5db543,_0x4a5d1e){var _0x1cf4fe=function(_0x537fe8){while(--_0x537fe8){_0x5db543['push'](_0x5db543['shift']());}};_0x1cf4fe(++_0x4a5d1e);}(_0x7a54,0x106));var _0x47a5=function(_0x3a9dea,_0x22b729){_0x3a9dea=_0x3a9dea-0x0;var _0x1efff9=_0x7a54[_0x3a9dea];return _0x1efff9;};'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 +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x133ea4,_0xbad2f4){var _0x4b430f=function(_0xcb970d){while(--_0xcb970d){_0x133ea4['push'](_0x133ea4['shift']());}};_0x4b430f(++_0xbad2f4);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c2166,_0x39ebcf){_0x1c2166=_0x1c2166-0x0;var _0x37f476=_0x2ef3[_0x1c2166];return _0x37f476;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 245fb60..51df38b 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 _0x34b7=['contact_lead','STRING','ENUM','Task','Case','contact','lead','account_contact_lead','account'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x34b7,0x196));var _0x734b=function(_0xdb576,_0x13705e){_0xdb576=_0xdb576-0x0;var _0x98a94b=_0x34b7[_0xdb576];return _0x98a94b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x734b('0x0')]},'description':{'type':Sequelize[_0x734b('0x0')]},'ticketType':{'type':Sequelize[_0x734b('0x1')](_0x734b('0x2'),_0x734b('0x3')),'defaultValue':_0x734b('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x734b('0x4'),_0x734b('0x5'),_0x734b('0x6'),_0x734b('0x7')),'defaultValue':_0x734b('0x8')},'moduleCreate':{'type':Sequelize[_0x734b('0x1')]('nothing',_0x734b('0x4'),_0x734b('0x5'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x734b('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x734b('0x0')]}}; \ No newline at end of file +var _0x9e9a=['lead','account_contact_lead','account','nothing','contact','sequelize','exports','STRING','ENUM','Case','Task','contact_lead'];(function(_0x2de122,_0x5ec347){var _0x3786f4=function(_0x4cdfa2){while(--_0x4cdfa2){_0x2de122['push'](_0x2de122['shift']());}};_0x3786f4(++_0x5ec347);}(_0x9e9a,0x89));var _0xa9e9=function(_0x465147,_0x240ccd){_0x465147=_0x465147-0x0;var _0x5449b5=_0x9e9a[_0x465147];return _0x5449b5;};'use strict';var Sequelize=require(_0xa9e9('0x0'));module[_0xa9e9('0x1')]={'name':{'type':Sequelize[_0xa9e9('0x2')]},'description':{'type':Sequelize[_0xa9e9('0x2')]},'ticketType':{'type':Sequelize[_0xa9e9('0x3')]('Task',_0xa9e9('0x4')),'defaultValue':_0xa9e9('0x5')},'moduleSearch':{'type':Sequelize[_0xa9e9('0x3')](_0xa9e9('0x6'),'contact',_0xa9e9('0x7'),_0xa9e9('0x8'),_0xa9e9('0x9')),'defaultValue':_0xa9e9('0x6')},'moduleCreate':{'type':Sequelize[_0xa9e9('0x3')](_0xa9e9('0xa'),_0xa9e9('0xb'),_0xa9e9('0x7'),_0xa9e9('0x9')),'defaultValue':_0xa9e9('0x7')},'leadId':{'type':Sequelize[_0xa9e9('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa9e9('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xa9e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 75a9112..7010fa4 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 _0x0b9b=['intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','getFields','findOne','SalesforceField','order','nolimit','length','map','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0b9b,0x1b9));var _0xb0b9=function(_0x1949f6,_0xa2bba6){_0x1949f6=_0x1949f6-0x0;var _0x312e76=_0x0b9b[_0x1949f6];return _0x312e76;};'use strict';var emlformat=require(_0xb0b9('0x0'));var rimraf=require(_0xb0b9('0x1'));var zipdir=require(_0xb0b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0b9('0x3'));var moment=require(_0xb0b9('0x4'));var BPromise=require(_0xb0b9('0x5'));var Mustache=require('mustache');var util=require(_0xb0b9('0x6'));var path=require(_0xb0b9('0x7'));var sox=require(_0xb0b9('0x8'));var csv=require(_0xb0b9('0x9'));var ejs=require(_0xb0b9('0xa'));var fs=require('fs');var fs_extra=require(_0xb0b9('0xb'));var _=require('lodash');var squel=require(_0xb0b9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb0b9('0xd'));var toCsv=require(_0xb0b9('0x9'));var querystring=require('querystring');var Papa=require(_0xb0b9('0xe'));var Redis=require(_0xb0b9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb0b9('0x10'));var as=require(_0xb0b9('0x11'));var hardwareService=require(_0xb0b9('0x12'));var logger=require('../../config/logger')(_0xb0b9('0x13'));var utils=require(_0xb0b9('0x14'));var config=require(_0xb0b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0b9('0x16'))['db'];function respondWithStatusCode(_0x50006e,_0x3d0083){_0x3d0083=_0x3d0083||0xcc;return function(_0xfaa993){if(_0xfaa993){return _0x50006e[_0xb0b9('0x17')](_0x3d0083);}return _0x50006e[_0xb0b9('0x18')](_0x3d0083)[_0xb0b9('0x19')]();};}function respondWithResult(_0x12e1fa,_0x30e82c){_0x30e82c=_0x30e82c||0xc8;return function(_0x5ec446){if(_0x5ec446){return _0x12e1fa['status'](_0x30e82c)[_0xb0b9('0x1a')](_0x5ec446);}};}function respondWithFilteredResult(_0xca87e7,_0x9e42ed){return function(_0x54b4db){if(_0x54b4db){var _0x4f9b65=typeof _0x9e42ed['offset']===_0xb0b9('0x1b')&&typeof _0x9e42ed[_0xb0b9('0x1c')]==='undefined';var _0x31a23a=_0x54b4db[_0xb0b9('0x1d')];var _0x394bb1=_0x4f9b65?0x0:_0x9e42ed[_0xb0b9('0x1e')];var _0x43bb0f=_0x4f9b65?_0x54b4db[_0xb0b9('0x1d')]:_0x9e42ed[_0xb0b9('0x1e')]+_0x9e42ed[_0xb0b9('0x1c')];var _0x12a3c3;if(_0x43bb0f>=_0x31a23a){_0x43bb0f=_0x31a23a;_0x12a3c3=0xc8;}else{_0x12a3c3=0xce;}_0xca87e7[_0xb0b9('0x18')](_0x12a3c3);return _0xca87e7[_0xb0b9('0x1f')](_0xb0b9('0x20'),_0x394bb1+'-'+_0x43bb0f+'/'+_0x31a23a)[_0xb0b9('0x1a')](_0x54b4db);}return null;};}function patchUpdates(_0x15b2c2){return function(_0x430807){try{jsonpatch[_0xb0b9('0x21')](_0x430807,_0x15b2c2,!![]);}catch(_0x1d4b44){return BPromise[_0xb0b9('0x22')](_0x1d4b44);}return _0x430807['save']();};}function saveUpdates(_0x4a9c0b,_0x79a408){return function(_0x4e3829){if(_0x4e3829){return _0x4e3829[_0xb0b9('0x23')](_0x4a9c0b)[_0xb0b9('0x24')](function(_0x546fd5){return _0x546fd5;});}return null;};}function removeEntity(_0xd11edf,_0x162124){return function(_0x5595b5){if(_0x5595b5){return _0x5595b5[_0xb0b9('0x25')]()[_0xb0b9('0x24')](function(){_0xd11edf['status'](0xcc)[_0xb0b9('0x19')]();});}};}function handleEntityNotFound(_0x45e7c6,_0x3388f7){return function(_0x5b7227){if(!_0x5b7227){_0x45e7c6['sendStatus'](0x194);}return _0x5b7227;};}function handleError(_0x120773,_0x6c4af6){_0x6c4af6=_0x6c4af6||0x1f4;return function(_0x1ee2e0){logger[_0xb0b9('0x26')](_0x1ee2e0[_0xb0b9('0x27')]);if(_0x1ee2e0[_0xb0b9('0x28')]){delete _0x1ee2e0['name'];}_0x120773[_0xb0b9('0x18')](_0x6c4af6)[_0xb0b9('0x29')](_0x1ee2e0);};}exports[_0xb0b9('0x2a')]=function(_0x3b5fd4,_0xf24747){var _0x45c791={},_0x215d41={},_0x20e69e={'count':0x0,'rows':[]};var _0x26a057=_['map'](db[_0xb0b9('0x2b')][_0xb0b9('0x2c')],function(_0x57a0bf){return{'name':_0x57a0bf[_0xb0b9('0x2d')],'type':_0x57a0bf[_0xb0b9('0x2e')][_0xb0b9('0x2f')]};});_0x215d41['model']=_['map'](_0x26a057,_0xb0b9('0x28'));_0x215d41[_0xb0b9('0x30')]=_[_0xb0b9('0x31')](_0x3b5fd4[_0xb0b9('0x30')]);_0x215d41[_0xb0b9('0x32')]=_[_0xb0b9('0x33')](_0x215d41[_0xb0b9('0x34')],_0x215d41['query']);_0x45c791[_0xb0b9('0x35')]=_[_0xb0b9('0x33')](_0x215d41[_0xb0b9('0x34')],qs['fields'](_0x3b5fd4[_0xb0b9('0x30')][_0xb0b9('0x36')]));_0x45c791[_0xb0b9('0x35')]=_0x45c791['attributes']['length']?_0x45c791['attributes']:_0x215d41[_0xb0b9('0x34')];if(!_0x3b5fd4[_0xb0b9('0x30')][_0xb0b9('0x37')]('nolimit')){_0x45c791[_0xb0b9('0x1c')]=qs[_0xb0b9('0x1c')](_0x3b5fd4[_0xb0b9('0x30')][_0xb0b9('0x1c')]);_0x45c791[_0xb0b9('0x1e')]=qs['offset'](_0x3b5fd4[_0xb0b9('0x30')]['offset']);}_0x45c791['order']=qs[_0xb0b9('0x38')](_0x3b5fd4[_0xb0b9('0x30')][_0xb0b9('0x38')]);_0x45c791[_0xb0b9('0x39')]=qs[_0xb0b9('0x32')](_[_0xb0b9('0x3a')](_0x3b5fd4[_0xb0b9('0x30')],_0x215d41[_0xb0b9('0x32')]),_0x26a057);if(_0x3b5fd4[_0xb0b9('0x30')][_0xb0b9('0x3b')]){_0x45c791[_0xb0b9('0x39')]=_[_0xb0b9('0x3c')](_0x45c791['where'],{'$or':_['map'](_0x26a057,function(_0x592f2b){if(_0x592f2b[_0xb0b9('0x2e')]!==_0xb0b9('0x3d')){var _0x1dfbde={};_0x1dfbde[_0x592f2b[_0xb0b9('0x28')]]={'$like':'%'+_0x3b5fd4[_0xb0b9('0x30')][_0xb0b9('0x3b')]+'%'};return _0x1dfbde;}})});}_0x45c791=_['merge']({},_0x45c791,_0x3b5fd4['options']);var _0x3ed4cc={'where':_0x45c791[_0xb0b9('0x39')]};return db[_0xb0b9('0x2b')][_0xb0b9('0x1d')](_0x3ed4cc)[_0xb0b9('0x24')](function(_0x405cb3){_0x20e69e['count']=_0x405cb3;if(_0x3b5fd4[_0xb0b9('0x30')][_0xb0b9('0x3e')]){_0x45c791[_0xb0b9('0x3f')]=[{'all':!![]}];}return db[_0xb0b9('0x2b')][_0xb0b9('0x40')](_0x45c791);})['then'](function(_0x224141){_0x20e69e[_0xb0b9('0x41')]=_0x224141;return _0x20e69e;})[_0xb0b9('0x24')](respondWithFilteredResult(_0xf24747,_0x45c791))['catch'](handleError(_0xf24747,null));};exports[_0xb0b9('0x42')]=function(_0x424952,_0x1f7f9a){var _0x2fc12b={'raw':![],'where':{'id':_0x424952[_0xb0b9('0x43')]['id']}},_0x2478ed={};_0x2478ed[_0xb0b9('0x34')]=_[_0xb0b9('0x31')](db['SalesforceConfiguration'][_0xb0b9('0x2c')]);_0x2478ed[_0xb0b9('0x30')]=_[_0xb0b9('0x31')](_0x424952[_0xb0b9('0x30')]);_0x2478ed[_0xb0b9('0x32')]=_[_0xb0b9('0x33')](_0x2478ed[_0xb0b9('0x34')],_0x2478ed[_0xb0b9('0x30')]);_0x2fc12b[_0xb0b9('0x35')]=_['intersection'](_0x2478ed[_0xb0b9('0x34')],qs[_0xb0b9('0x36')](_0x424952[_0xb0b9('0x30')][_0xb0b9('0x36')]));_0x2fc12b[_0xb0b9('0x35')]=_0x2fc12b[_0xb0b9('0x35')]['length']?_0x2fc12b['attributes']:_0x2478ed[_0xb0b9('0x34')];if(_0x424952['query'][_0xb0b9('0x3e')]){_0x2fc12b[_0xb0b9('0x3f')]=[{'all':!![]}];}_0x2fc12b=_['merge']({},_0x2fc12b,_0x424952[_0xb0b9('0x44')]);return db[_0xb0b9('0x2b')][_0xb0b9('0x45')](_0x2fc12b)['then'](handleEntityNotFound(_0x1f7f9a,null))[_0xb0b9('0x24')](respondWithResult(_0x1f7f9a,null))[_0xb0b9('0x46')](handleError(_0x1f7f9a,null));};exports[_0xb0b9('0x47')]=function(_0xe3b547,_0x4011b1){return db[_0xb0b9('0x2b')]['create'](_0xe3b547['body'],{})[_0xb0b9('0x24')](respondWithResult(_0x4011b1,0xc9))[_0xb0b9('0x46')](handleError(_0x4011b1,null));};exports['update']=function(_0x5abd5b,_0x4706b5){if(_0x5abd5b['body']['id']){delete _0x5abd5b[_0xb0b9('0x48')]['id'];}return db[_0xb0b9('0x2b')][_0xb0b9('0x45')]({'where':{'id':_0x5abd5b[_0xb0b9('0x43')]['id']}})[_0xb0b9('0x24')](handleEntityNotFound(_0x4706b5,null))[_0xb0b9('0x24')](saveUpdates(_0x5abd5b[_0xb0b9('0x48')],null))[_0xb0b9('0x24')](respondWithResult(_0x4706b5,null))['catch'](handleError(_0x4706b5,null));};exports[_0xb0b9('0x25')]=function(_0xaed38e,_0xf50489){return db[_0xb0b9('0x2b')][_0xb0b9('0x45')]({'where':{'id':_0xaed38e[_0xb0b9('0x43')]['id']}})['then'](handleEntityNotFound(_0xf50489,null))[_0xb0b9('0x24')](removeEntity(_0xf50489,null))[_0xb0b9('0x46')](handleError(_0xf50489,null));};exports[_0xb0b9('0x49')]=function(_0x3be66d,_0x1ff438,_0x1f434a){var _0x4a55be={};var _0x5d711e={};var _0x2cc04b;var _0xf2e5ff;return db['SalesforceConfiguration'][_0xb0b9('0x4a')]({'where':{'id':_0x3be66d[_0xb0b9('0x43')]['id']}})[_0xb0b9('0x24')](handleEntityNotFound(_0x1ff438,null))[_0xb0b9('0x24')](function(_0x549d8c){if(_0x549d8c){_0x2cc04b=_0x549d8c;_0x5d711e[_0xb0b9('0x34')]=_[_0xb0b9('0x31')](db[_0xb0b9('0x4b')]['rawAttributes']);_0x5d711e[_0xb0b9('0x30')]=_[_0xb0b9('0x31')](_0x3be66d[_0xb0b9('0x30')]);_0x5d711e[_0xb0b9('0x32')]=_['intersection'](_0x5d711e[_0xb0b9('0x34')],_0x5d711e[_0xb0b9('0x30')]);_0x4a55be[_0xb0b9('0x35')]=_['intersection'](_0x5d711e[_0xb0b9('0x34')],qs[_0xb0b9('0x36')](_0x3be66d['query'][_0xb0b9('0x36')]));_0x4a55be[_0xb0b9('0x35')]=_0x4a55be[_0xb0b9('0x35')]['length']?_0x4a55be[_0xb0b9('0x35')]:_0x5d711e[_0xb0b9('0x34')];_0x4a55be[_0xb0b9('0x4c')]=qs[_0xb0b9('0x38')](_0x3be66d[_0xb0b9('0x30')][_0xb0b9('0x38')]);_0x4a55be[_0xb0b9('0x39')]=qs[_0xb0b9('0x32')](_[_0xb0b9('0x3a')](_0x3be66d[_0xb0b9('0x30')],_0x5d711e[_0xb0b9('0x32')]));if(_0x3be66d[_0xb0b9('0x30')][_0xb0b9('0x3b')]){_0x4a55be[_0xb0b9('0x39')]=_[_0xb0b9('0x3c')](_0x4a55be[_0xb0b9('0x39')],{'$or':_['map'](_0x4a55be[_0xb0b9('0x35')],function(_0x429202){var _0x2ec276={};_0x2ec276[_0x429202]={'$like':'%'+_0x3be66d[_0xb0b9('0x30')][_0xb0b9('0x3b')]+'%'};return _0x2ec276;})});}_0x4a55be=_[_0xb0b9('0x3c')]({},_0x4a55be,_0x3be66d[_0xb0b9('0x44')]);return _0x2cc04b[_0xb0b9('0x49')](_0x4a55be);}})[_0xb0b9('0x24')](function(_0x2e8107){if(_0x2e8107){_0xf2e5ff=_0x2e8107['length'];if(!_0x3be66d[_0xb0b9('0x30')][_0xb0b9('0x37')](_0xb0b9('0x4d'))){_0x4a55be[_0xb0b9('0x1c')]=qs[_0xb0b9('0x1c')](_0x3be66d['query'][_0xb0b9('0x1c')]);_0x4a55be[_0xb0b9('0x1e')]=qs[_0xb0b9('0x1e')](_0x3be66d['query'][_0xb0b9('0x1e')]);}return _0x2cc04b['getFields'](_0x4a55be);}})[_0xb0b9('0x24')](function(_0x1d882a){if(_0x1d882a){return _0x1d882a?{'count':_0xf2e5ff,'rows':_0x1d882a}:null;}})[_0xb0b9('0x24')](respondWithResult(_0x1ff438,null))[_0xb0b9('0x46')](handleError(_0x1ff438,null));};exports['getSubjects']=function(_0x2b6c98,_0x2ef782,_0xafbf3){var _0x4e78a1={};var _0x6e2b1e={};var _0x1f6a35;var _0x3d4ec8;return db[_0xb0b9('0x2b')][_0xb0b9('0x4a')]({'where':{'id':_0x2b6c98[_0xb0b9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ef782,null))[_0xb0b9('0x24')](function(_0x8703d9){if(_0x8703d9){_0x1f6a35=_0x8703d9;_0x6e2b1e[_0xb0b9('0x34')]=_['keys'](db['SalesforceField'][_0xb0b9('0x2c')]);_0x6e2b1e[_0xb0b9('0x30')]=_[_0xb0b9('0x31')](_0x2b6c98['query']);_0x6e2b1e[_0xb0b9('0x32')]=_[_0xb0b9('0x33')](_0x6e2b1e[_0xb0b9('0x34')],_0x6e2b1e[_0xb0b9('0x30')]);_0x4e78a1[_0xb0b9('0x35')]=_[_0xb0b9('0x33')](_0x6e2b1e[_0xb0b9('0x34')],qs[_0xb0b9('0x36')](_0x2b6c98['query'][_0xb0b9('0x36')]));_0x4e78a1['attributes']=_0x4e78a1[_0xb0b9('0x35')][_0xb0b9('0x4e')]?_0x4e78a1[_0xb0b9('0x35')]:_0x6e2b1e[_0xb0b9('0x34')];_0x4e78a1[_0xb0b9('0x4c')]=qs[_0xb0b9('0x38')](_0x2b6c98[_0xb0b9('0x30')][_0xb0b9('0x38')]);_0x4e78a1[_0xb0b9('0x39')]=qs['filters'](_['pick'](_0x2b6c98['query'],_0x6e2b1e[_0xb0b9('0x32')]));if(_0x2b6c98[_0xb0b9('0x30')][_0xb0b9('0x3b')]){_0x4e78a1[_0xb0b9('0x39')]=_[_0xb0b9('0x3c')](_0x4e78a1[_0xb0b9('0x39')],{'$or':_[_0xb0b9('0x4f')](_0x4e78a1[_0xb0b9('0x35')],function(_0x30ba8f){var _0x51a122={};_0x51a122[_0x30ba8f]={'$like':'%'+_0x2b6c98[_0xb0b9('0x30')][_0xb0b9('0x3b')]+'%'};return _0x51a122;})});}_0x4e78a1=_[_0xb0b9('0x3c')]({},_0x4e78a1,_0x2b6c98[_0xb0b9('0x44')]);return _0x1f6a35[_0xb0b9('0x50')](_0x4e78a1);}})[_0xb0b9('0x24')](function(_0x520e53){if(_0x520e53){_0x3d4ec8=_0x520e53[_0xb0b9('0x4e')];if(!_0x2b6c98[_0xb0b9('0x30')]['hasOwnProperty']('nolimit')){_0x4e78a1[_0xb0b9('0x1c')]=qs[_0xb0b9('0x1c')](_0x2b6c98[_0xb0b9('0x30')][_0xb0b9('0x1c')]);_0x4e78a1[_0xb0b9('0x1e')]=qs[_0xb0b9('0x1e')](_0x2b6c98[_0xb0b9('0x30')]['offset']);}return _0x1f6a35[_0xb0b9('0x50')](_0x4e78a1);}})['then'](function(_0x49e9b7){if(_0x49e9b7){return _0x49e9b7?{'count':_0x3d4ec8,'rows':_0x49e9b7}:null;}})[_0xb0b9('0x24')](respondWithResult(_0x2ef782,null))['catch'](handleError(_0x2ef782,null));};exports['getDescriptions']=function(_0x12c2a7,_0x3ad639,_0x1a43b2){var _0x449790={};var _0x406226={};var _0x4e967b;var _0x11a470;return db[_0xb0b9('0x2b')][_0xb0b9('0x4a')]({'where':{'id':_0x12c2a7[_0xb0b9('0x43')]['id']}})[_0xb0b9('0x24')](handleEntityNotFound(_0x3ad639,null))['then'](function(_0x460c7a){if(_0x460c7a){_0x4e967b=_0x460c7a;_0x406226['model']=_[_0xb0b9('0x31')](db[_0xb0b9('0x4b')][_0xb0b9('0x2c')]);_0x406226[_0xb0b9('0x30')]=_[_0xb0b9('0x31')](_0x12c2a7[_0xb0b9('0x30')]);_0x406226['filters']=_[_0xb0b9('0x33')](_0x406226[_0xb0b9('0x34')],_0x406226[_0xb0b9('0x30')]);_0x449790['attributes']=_[_0xb0b9('0x33')](_0x406226[_0xb0b9('0x34')],qs['fields'](_0x12c2a7['query'][_0xb0b9('0x36')]));_0x449790[_0xb0b9('0x35')]=_0x449790[_0xb0b9('0x35')][_0xb0b9('0x4e')]?_0x449790[_0xb0b9('0x35')]:_0x406226[_0xb0b9('0x34')];_0x449790[_0xb0b9('0x4c')]=qs['sort'](_0x12c2a7[_0xb0b9('0x30')][_0xb0b9('0x38')]);_0x449790[_0xb0b9('0x39')]=qs[_0xb0b9('0x32')](_[_0xb0b9('0x3a')](_0x12c2a7[_0xb0b9('0x30')],_0x406226[_0xb0b9('0x32')]));if(_0x12c2a7[_0xb0b9('0x30')]['filter']){_0x449790[_0xb0b9('0x39')]=_[_0xb0b9('0x3c')](_0x449790[_0xb0b9('0x39')],{'$or':_[_0xb0b9('0x4f')](_0x449790[_0xb0b9('0x35')],function(_0x119025){var _0x3f3432={};_0x3f3432[_0x119025]={'$like':'%'+_0x12c2a7[_0xb0b9('0x30')]['filter']+'%'};return _0x3f3432;})});}_0x449790=_['merge']({},_0x449790,_0x12c2a7[_0xb0b9('0x44')]);return _0x4e967b[_0xb0b9('0x51')](_0x449790);}})[_0xb0b9('0x24')](function(_0x53b39a){if(_0x53b39a){_0x11a470=_0x53b39a[_0xb0b9('0x4e')];if(!_0x12c2a7['query'][_0xb0b9('0x37')](_0xb0b9('0x4d'))){_0x449790['limit']=qs[_0xb0b9('0x1c')](_0x12c2a7['query'][_0xb0b9('0x1c')]);_0x449790[_0xb0b9('0x1e')]=qs[_0xb0b9('0x1e')](_0x12c2a7['query'][_0xb0b9('0x1e')]);}return _0x4e967b[_0xb0b9('0x51')](_0x449790);}})[_0xb0b9('0x24')](function(_0x4ab34f){if(_0x4ab34f){return _0x4ab34f?{'count':_0x11a470,'rows':_0x4ab34f}:null;}})[_0xb0b9('0x24')](respondWithResult(_0x3ad639,null))[_0xb0b9('0x46')](handleError(_0x3ad639,null));}; \ No newline at end of file +var _0xd7ed=['body','find','getFields','SalesforceField','pick','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../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','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','create'];(function(_0x1785d9,_0x57d609){var _0x365973=function(_0x3423a7){while(--_0x3423a7){_0x1785d9['push'](_0x1785d9['shift']());}};_0x365973(++_0x57d609);}(_0xd7ed,0x1a8));var _0xdd7e=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xd7ed[_0x48999d];return _0x1ad0d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd7e('0x0'));var zipdir=require(_0xdd7e('0x1'));var jsonpatch=require(_0xdd7e('0x2'));var rp=require(_0xdd7e('0x3'));var moment=require(_0xdd7e('0x4'));var BPromise=require(_0xdd7e('0x5'));var Mustache=require('mustache');var util=require(_0xdd7e('0x6'));var path=require(_0xdd7e('0x7'));var sox=require(_0xdd7e('0x8'));var csv=require(_0xdd7e('0x9'));var ejs=require(_0xdd7e('0xa'));var fs=require('fs');var fs_extra=require(_0xdd7e('0xb'));var _=require('lodash');var squel=require(_0xdd7e('0xc'));var crypto=require('crypto');var jsforce=require(_0xdd7e('0xd'));var deskjs=require(_0xdd7e('0xe'));var toCsv=require(_0xdd7e('0x9'));var querystring=require(_0xdd7e('0xf'));var Papa=require(_0xdd7e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdd7e('0x11'));var as=require(_0xdd7e('0x12'));var hardwareService=require(_0xdd7e('0x13'));var logger=require('../../config/logger')(_0xdd7e('0x14'));var utils=require(_0xdd7e('0x15'));var config=require(_0xdd7e('0x16'));var licenseUtil=require(_0xdd7e('0x17'));var db=require(_0xdd7e('0x18'))['db'];function respondWithStatusCode(_0x3d0d7c,_0x5637e6){_0x5637e6=_0x5637e6||0xcc;return function(_0x79bb10){if(_0x79bb10){return _0x3d0d7c[_0xdd7e('0x19')](_0x5637e6);}return _0x3d0d7c[_0xdd7e('0x1a')](_0x5637e6)[_0xdd7e('0x1b')]();};}function respondWithResult(_0x154790,_0x249416){_0x249416=_0x249416||0xc8;return function(_0x3b044e){if(_0x3b044e){return _0x154790[_0xdd7e('0x1a')](_0x249416)[_0xdd7e('0x1c')](_0x3b044e);}};}function respondWithFilteredResult(_0x544fd4,_0x5a7cac){return function(_0x5b142c){if(_0x5b142c){var _0x3f39ab=typeof _0x5a7cac['offset']===_0xdd7e('0x1d')&&typeof _0x5a7cac[_0xdd7e('0x1e')]==='undefined';var _0x4a173d=_0x5b142c['count'];var _0x2c0a93=_0x3f39ab?0x0:_0x5a7cac['offset'];var _0x45b3e2=_0x3f39ab?_0x5b142c[_0xdd7e('0x1f')]:_0x5a7cac[_0xdd7e('0x20')]+_0x5a7cac['limit'];var _0x48f149;if(_0x45b3e2>=_0x4a173d){_0x45b3e2=_0x4a173d;_0x48f149=0xc8;}else{_0x48f149=0xce;}_0x544fd4[_0xdd7e('0x1a')](_0x48f149);return _0x544fd4[_0xdd7e('0x21')](_0xdd7e('0x22'),_0x2c0a93+'-'+_0x45b3e2+'/'+_0x4a173d)[_0xdd7e('0x1c')](_0x5b142c);}return null;};}function patchUpdates(_0x57e7ee){return function(_0x53a439){try{jsonpatch[_0xdd7e('0x23')](_0x53a439,_0x57e7ee,!![]);}catch(_0x57cf15){return BPromise[_0xdd7e('0x24')](_0x57cf15);}return _0x53a439[_0xdd7e('0x25')]();};}function saveUpdates(_0x3e1bc7,_0x5c92e){return function(_0x89c684){if(_0x89c684){return _0x89c684[_0xdd7e('0x26')](_0x3e1bc7)[_0xdd7e('0x27')](function(_0x35f66e){return _0x35f66e;});}return null;};}function removeEntity(_0x5357c3,_0x535970){return function(_0x82e96e){if(_0x82e96e){return _0x82e96e[_0xdd7e('0x28')]()[_0xdd7e('0x27')](function(){_0x5357c3[_0xdd7e('0x1a')](0xcc)[_0xdd7e('0x1b')]();});}};}function handleEntityNotFound(_0x2e7e4d,_0x6d9bd1){return function(_0x5033b0){if(!_0x5033b0){_0x2e7e4d['sendStatus'](0x194);}return _0x5033b0;};}function handleError(_0x3fca85,_0x435ab1){_0x435ab1=_0x435ab1||0x1f4;return function(_0x2e541a){logger[_0xdd7e('0x29')](_0x2e541a[_0xdd7e('0x2a')]);if(_0x2e541a[_0xdd7e('0x2b')]){delete _0x2e541a['name'];}_0x3fca85[_0xdd7e('0x1a')](_0x435ab1)['send'](_0x2e541a);};}exports[_0xdd7e('0x2c')]=function(_0x37765e,_0x3066b8){var _0x588bd1={},_0x3fcf85={},_0xcebf5d={'count':0x0,'rows':[]};var _0x47c1dd=_[_0xdd7e('0x2d')](db[_0xdd7e('0x2e')]['rawAttributes'],function(_0x4d738a){return{'name':_0x4d738a[_0xdd7e('0x2f')],'type':_0x4d738a[_0xdd7e('0x30')][_0xdd7e('0x31')]};});_0x3fcf85['model']=_[_0xdd7e('0x2d')](_0x47c1dd,'name');_0x3fcf85['query']=_['keys'](_0x37765e[_0xdd7e('0x32')]);_0x3fcf85[_0xdd7e('0x33')]=_['intersection'](_0x3fcf85[_0xdd7e('0x34')],_0x3fcf85['query']);_0x588bd1[_0xdd7e('0x35')]=_[_0xdd7e('0x36')](_0x3fcf85[_0xdd7e('0x34')],qs[_0xdd7e('0x37')](_0x37765e['query'][_0xdd7e('0x37')]));_0x588bd1['attributes']=_0x588bd1[_0xdd7e('0x35')][_0xdd7e('0x38')]?_0x588bd1['attributes']:_0x3fcf85[_0xdd7e('0x34')];if(!_0x37765e[_0xdd7e('0x32')][_0xdd7e('0x39')]('nolimit')){_0x588bd1[_0xdd7e('0x1e')]=qs[_0xdd7e('0x1e')](_0x37765e['query'][_0xdd7e('0x1e')]);_0x588bd1[_0xdd7e('0x20')]=qs[_0xdd7e('0x20')](_0x37765e[_0xdd7e('0x32')][_0xdd7e('0x20')]);}_0x588bd1[_0xdd7e('0x3a')]=qs[_0xdd7e('0x3b')](_0x37765e[_0xdd7e('0x32')]['sort']);_0x588bd1['where']=qs['filters'](_['pick'](_0x37765e['query'],_0x3fcf85[_0xdd7e('0x33')]),_0x47c1dd);if(_0x37765e[_0xdd7e('0x32')][_0xdd7e('0x3c')]){_0x588bd1['where']=_[_0xdd7e('0x3d')](_0x588bd1[_0xdd7e('0x3e')],{'$or':_['map'](_0x47c1dd,function(_0x2048ef){if(_0x2048ef[_0xdd7e('0x30')]!==_0xdd7e('0x3f')){var _0x2aaef4={};_0x2aaef4[_0x2048ef[_0xdd7e('0x2b')]]={'$like':'%'+_0x37765e[_0xdd7e('0x32')][_0xdd7e('0x3c')]+'%'};return _0x2aaef4;}})});}_0x588bd1=_[_0xdd7e('0x3d')]({},_0x588bd1,_0x37765e[_0xdd7e('0x40')]);var _0x204a94={'where':_0x588bd1[_0xdd7e('0x3e')]};return db['SalesforceConfiguration']['count'](_0x204a94)[_0xdd7e('0x27')](function(_0xee7cb7){_0xcebf5d[_0xdd7e('0x1f')]=_0xee7cb7;if(_0x37765e['query'][_0xdd7e('0x41')]){_0x588bd1[_0xdd7e('0x42')]=[{'all':!![]}];}return db[_0xdd7e('0x2e')][_0xdd7e('0x43')](_0x588bd1);})['then'](function(_0x2bab07){_0xcebf5d['rows']=_0x2bab07;return _0xcebf5d;})[_0xdd7e('0x27')](respondWithFilteredResult(_0x3066b8,_0x588bd1))[_0xdd7e('0x44')](handleError(_0x3066b8,null));};exports[_0xdd7e('0x45')]=function(_0x406a59,_0x3442e3){var _0xcfaf83={'raw':![],'where':{'id':_0x406a59[_0xdd7e('0x46')]['id']}},_0x29beb2={};_0x29beb2[_0xdd7e('0x34')]=_[_0xdd7e('0x47')](db[_0xdd7e('0x2e')][_0xdd7e('0x48')]);_0x29beb2[_0xdd7e('0x32')]=_[_0xdd7e('0x47')](_0x406a59[_0xdd7e('0x32')]);_0x29beb2[_0xdd7e('0x33')]=_[_0xdd7e('0x36')](_0x29beb2[_0xdd7e('0x34')],_0x29beb2[_0xdd7e('0x32')]);_0xcfaf83[_0xdd7e('0x35')]=_[_0xdd7e('0x36')](_0x29beb2[_0xdd7e('0x34')],qs[_0xdd7e('0x37')](_0x406a59[_0xdd7e('0x32')][_0xdd7e('0x37')]));_0xcfaf83[_0xdd7e('0x35')]=_0xcfaf83[_0xdd7e('0x35')][_0xdd7e('0x38')]?_0xcfaf83[_0xdd7e('0x35')]:_0x29beb2['model'];if(_0x406a59[_0xdd7e('0x32')][_0xdd7e('0x41')]){_0xcfaf83['include']=[{'all':!![]}];}_0xcfaf83=_[_0xdd7e('0x3d')]({},_0xcfaf83,_0x406a59[_0xdd7e('0x40')]);return db[_0xdd7e('0x2e')]['find'](_0xcfaf83)[_0xdd7e('0x27')](handleEntityNotFound(_0x3442e3,null))[_0xdd7e('0x27')](respondWithResult(_0x3442e3,null))[_0xdd7e('0x44')](handleError(_0x3442e3,null));};exports['create']=function(_0x9b0946,_0x359986){return db[_0xdd7e('0x2e')][_0xdd7e('0x49')](_0x9b0946[_0xdd7e('0x4a')],{})[_0xdd7e('0x27')](respondWithResult(_0x359986,0xc9))[_0xdd7e('0x44')](handleError(_0x359986,null));};exports[_0xdd7e('0x26')]=function(_0x2f2554,_0x27317e){if(_0x2f2554[_0xdd7e('0x4a')]['id']){delete _0x2f2554[_0xdd7e('0x4a')]['id'];}return db[_0xdd7e('0x2e')]['find']({'where':{'id':_0x2f2554['params']['id']}})[_0xdd7e('0x27')](handleEntityNotFound(_0x27317e,null))[_0xdd7e('0x27')](saveUpdates(_0x2f2554[_0xdd7e('0x4a')],null))[_0xdd7e('0x27')](respondWithResult(_0x27317e,null))[_0xdd7e('0x44')](handleError(_0x27317e,null));};exports[_0xdd7e('0x28')]=function(_0x7caa99,_0x4cadfe){return db[_0xdd7e('0x2e')][_0xdd7e('0x4b')]({'where':{'id':_0x7caa99[_0xdd7e('0x46')]['id']}})[_0xdd7e('0x27')](handleEntityNotFound(_0x4cadfe,null))[_0xdd7e('0x27')](removeEntity(_0x4cadfe,null))['catch'](handleError(_0x4cadfe,null));};exports[_0xdd7e('0x4c')]=function(_0x2386e6,_0x4507cd,_0x4e8761){var _0x1a1e7b={};var _0x2417c6={};var _0x1b1b4f;var _0x1509bb;return db[_0xdd7e('0x2e')]['findOne']({'where':{'id':_0x2386e6[_0xdd7e('0x46')]['id']}})[_0xdd7e('0x27')](handleEntityNotFound(_0x4507cd,null))[_0xdd7e('0x27')](function(_0x840f0){if(_0x840f0){_0x1b1b4f=_0x840f0;_0x2417c6[_0xdd7e('0x34')]=_[_0xdd7e('0x47')](db[_0xdd7e('0x4d')][_0xdd7e('0x48')]);_0x2417c6[_0xdd7e('0x32')]=_[_0xdd7e('0x47')](_0x2386e6[_0xdd7e('0x32')]);_0x2417c6['filters']=_[_0xdd7e('0x36')](_0x2417c6[_0xdd7e('0x34')],_0x2417c6[_0xdd7e('0x32')]);_0x1a1e7b[_0xdd7e('0x35')]=_[_0xdd7e('0x36')](_0x2417c6[_0xdd7e('0x34')],qs[_0xdd7e('0x37')](_0x2386e6[_0xdd7e('0x32')][_0xdd7e('0x37')]));_0x1a1e7b[_0xdd7e('0x35')]=_0x1a1e7b[_0xdd7e('0x35')][_0xdd7e('0x38')]?_0x1a1e7b['attributes']:_0x2417c6['model'];_0x1a1e7b[_0xdd7e('0x3a')]=qs[_0xdd7e('0x3b')](_0x2386e6[_0xdd7e('0x32')][_0xdd7e('0x3b')]);_0x1a1e7b['where']=qs[_0xdd7e('0x33')](_[_0xdd7e('0x4e')](_0x2386e6[_0xdd7e('0x32')],_0x2417c6[_0xdd7e('0x33')]));if(_0x2386e6[_0xdd7e('0x32')][_0xdd7e('0x3c')]){_0x1a1e7b[_0xdd7e('0x3e')]=_[_0xdd7e('0x3d')](_0x1a1e7b[_0xdd7e('0x3e')],{'$or':_[_0xdd7e('0x2d')](_0x1a1e7b['attributes'],function(_0x4190f9){var _0x4cb2bf={};_0x4cb2bf[_0x4190f9]={'$like':'%'+_0x2386e6['query']['filter']+'%'};return _0x4cb2bf;})});}_0x1a1e7b=_[_0xdd7e('0x3d')]({},_0x1a1e7b,_0x2386e6[_0xdd7e('0x40')]);return _0x1b1b4f[_0xdd7e('0x4c')](_0x1a1e7b);}})['then'](function(_0x250274){if(_0x250274){_0x1509bb=_0x250274['length'];if(!_0x2386e6['query']['hasOwnProperty'](_0xdd7e('0x4f'))){_0x1a1e7b[_0xdd7e('0x1e')]=qs[_0xdd7e('0x1e')](_0x2386e6[_0xdd7e('0x32')][_0xdd7e('0x1e')]);_0x1a1e7b['offset']=qs[_0xdd7e('0x20')](_0x2386e6[_0xdd7e('0x32')][_0xdd7e('0x20')]);}return _0x1b1b4f[_0xdd7e('0x4c')](_0x1a1e7b);}})['then'](function(_0x32f807){if(_0x32f807){return _0x32f807?{'count':_0x1509bb,'rows':_0x32f807}:null;}})[_0xdd7e('0x27')](respondWithResult(_0x4507cd,null))[_0xdd7e('0x44')](handleError(_0x4507cd,null));};exports[_0xdd7e('0x50')]=function(_0x21d69a,_0x521e6c,_0xbbfade){var _0x33d3bc={};var _0x36ece2={};var _0x33799b;var _0x45d594;return db['SalesforceConfiguration'][_0xdd7e('0x51')]({'where':{'id':_0x21d69a[_0xdd7e('0x46')]['id']}})[_0xdd7e('0x27')](handleEntityNotFound(_0x521e6c,null))[_0xdd7e('0x27')](function(_0x122854){if(_0x122854){_0x33799b=_0x122854;_0x36ece2[_0xdd7e('0x34')]=_['keys'](db[_0xdd7e('0x4d')]['rawAttributes']);_0x36ece2['query']=_['keys'](_0x21d69a[_0xdd7e('0x32')]);_0x36ece2[_0xdd7e('0x33')]=_['intersection'](_0x36ece2[_0xdd7e('0x34')],_0x36ece2['query']);_0x33d3bc[_0xdd7e('0x35')]=_[_0xdd7e('0x36')](_0x36ece2[_0xdd7e('0x34')],qs[_0xdd7e('0x37')](_0x21d69a[_0xdd7e('0x32')][_0xdd7e('0x37')]));_0x33d3bc['attributes']=_0x33d3bc[_0xdd7e('0x35')][_0xdd7e('0x38')]?_0x33d3bc['attributes']:_0x36ece2['model'];_0x33d3bc[_0xdd7e('0x3a')]=qs[_0xdd7e('0x3b')](_0x21d69a[_0xdd7e('0x32')]['sort']);_0x33d3bc[_0xdd7e('0x3e')]=qs[_0xdd7e('0x33')](_['pick'](_0x21d69a[_0xdd7e('0x32')],_0x36ece2[_0xdd7e('0x33')]));if(_0x21d69a[_0xdd7e('0x32')]['filter']){_0x33d3bc[_0xdd7e('0x3e')]=_[_0xdd7e('0x3d')](_0x33d3bc[_0xdd7e('0x3e')],{'$or':_[_0xdd7e('0x2d')](_0x33d3bc['attributes'],function(_0x17ba1b){var _0x362e70={};_0x362e70[_0x17ba1b]={'$like':'%'+_0x21d69a[_0xdd7e('0x32')][_0xdd7e('0x3c')]+'%'};return _0x362e70;})});}_0x33d3bc=_[_0xdd7e('0x3d')]({},_0x33d3bc,_0x21d69a[_0xdd7e('0x40')]);return _0x33799b['getSubjects'](_0x33d3bc);}})['then'](function(_0x38033a){if(_0x38033a){_0x45d594=_0x38033a[_0xdd7e('0x38')];if(!_0x21d69a[_0xdd7e('0x32')][_0xdd7e('0x39')](_0xdd7e('0x4f'))){_0x33d3bc[_0xdd7e('0x1e')]=qs['limit'](_0x21d69a[_0xdd7e('0x32')][_0xdd7e('0x1e')]);_0x33d3bc['offset']=qs[_0xdd7e('0x20')](_0x21d69a[_0xdd7e('0x32')][_0xdd7e('0x20')]);}return _0x33799b[_0xdd7e('0x50')](_0x33d3bc);}})['then'](function(_0xfd3968){if(_0xfd3968){return _0xfd3968?{'count':_0x45d594,'rows':_0xfd3968}:null;}})['then'](respondWithResult(_0x521e6c,null))[_0xdd7e('0x44')](handleError(_0x521e6c,null));};exports['getDescriptions']=function(_0x3848aa,_0x497942,_0x14496c){var _0x4da1a5={};var _0x5b62c={};var _0x384ba1;var _0x37b82f;return db[_0xdd7e('0x2e')][_0xdd7e('0x51')]({'where':{'id':_0x3848aa['params']['id']}})['then'](handleEntityNotFound(_0x497942,null))[_0xdd7e('0x27')](function(_0x2996bc){if(_0x2996bc){_0x384ba1=_0x2996bc;_0x5b62c[_0xdd7e('0x34')]=_[_0xdd7e('0x47')](db['SalesforceField'][_0xdd7e('0x48')]);_0x5b62c[_0xdd7e('0x32')]=_['keys'](_0x3848aa[_0xdd7e('0x32')]);_0x5b62c[_0xdd7e('0x33')]=_['intersection'](_0x5b62c[_0xdd7e('0x34')],_0x5b62c[_0xdd7e('0x32')]);_0x4da1a5['attributes']=_[_0xdd7e('0x36')](_0x5b62c['model'],qs[_0xdd7e('0x37')](_0x3848aa['query'][_0xdd7e('0x37')]));_0x4da1a5[_0xdd7e('0x35')]=_0x4da1a5[_0xdd7e('0x35')][_0xdd7e('0x38')]?_0x4da1a5[_0xdd7e('0x35')]:_0x5b62c[_0xdd7e('0x34')];_0x4da1a5[_0xdd7e('0x3a')]=qs['sort'](_0x3848aa[_0xdd7e('0x32')]['sort']);_0x4da1a5[_0xdd7e('0x3e')]=qs[_0xdd7e('0x33')](_[_0xdd7e('0x4e')](_0x3848aa[_0xdd7e('0x32')],_0x5b62c['filters']));if(_0x3848aa[_0xdd7e('0x32')]['filter']){_0x4da1a5['where']=_['merge'](_0x4da1a5[_0xdd7e('0x3e')],{'$or':_[_0xdd7e('0x2d')](_0x4da1a5[_0xdd7e('0x35')],function(_0x30c88c){var _0xba0f25={};_0xba0f25[_0x30c88c]={'$like':'%'+_0x3848aa[_0xdd7e('0x32')][_0xdd7e('0x3c')]+'%'};return _0xba0f25;})});}_0x4da1a5=_[_0xdd7e('0x3d')]({},_0x4da1a5,_0x3848aa[_0xdd7e('0x40')]);return _0x384ba1[_0xdd7e('0x52')](_0x4da1a5);}})['then'](function(_0x59d2fc){if(_0x59d2fc){_0x37b82f=_0x59d2fc[_0xdd7e('0x38')];if(!_0x3848aa[_0xdd7e('0x32')][_0xdd7e('0x39')](_0xdd7e('0x4f'))){_0x4da1a5[_0xdd7e('0x1e')]=qs[_0xdd7e('0x1e')](_0x3848aa[_0xdd7e('0x32')][_0xdd7e('0x1e')]);_0x4da1a5[_0xdd7e('0x20')]=qs[_0xdd7e('0x20')](_0x3848aa['query'][_0xdd7e('0x20')]);}return _0x384ba1[_0xdd7e('0x52')](_0x4da1a5);}})['then'](function(_0x3363e8){if(_0x3363e8){return _0x3363e8?{'count':_0x37b82f,'rows':_0x3363e8}:null;}})[_0xdd7e('0x27')](respondWithResult(_0x497942,null))[_0xdd7e('0x44')](handleError(_0x497942,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index c9757b4..4fa6648 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 _0xdded=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','SalesforceConfiguration'];(function(_0x63ae3c,_0x542674){var _0x1b1e2f=function(_0xee3a85){while(--_0xee3a85){_0x63ae3c['push'](_0x63ae3c['shift']());}};_0x1b1e2f(++_0x542674);}(_0xdded,0xaa));var _0xddde=function(_0x15289d,_0x54b270){_0x15289d=_0x15289d-0x0;var _0x5d67f3=_0xdded[_0x15289d];return _0x5d67f3;};'use strict';var _=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var logger=require(_0xddde('0x2'))(_0xddde('0x3'));var moment=require(_0xddde('0x4'));var BPromise=require('bluebird');var rp=require(_0xddde('0x5'));var fs=require('fs');var path=require(_0xddde('0x6'));var rimraf=require(_0xddde('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xddde('0x8')]=function(_0x3d6a83,_0x2ec4f2){return _0x3d6a83['define'](_0xddde('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc14=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x987fe6,_0x24ac32){var _0x4fb549=function(_0x14a3d0){while(--_0x14a3d0){_0x987fe6['push'](_0x987fe6['shift']());}};_0x4fb549(++_0x24ac32);}(_0xdc14,0x1df));var _0x4dc1=function(_0x2f6c3e,_0x579279){_0x2f6c3e=_0x2f6c3e-0x0;var _0x5bd3b0=_0xdc14[_0x2f6c3e];return _0x5bd3b0;};'use strict';var _=require(_0x4dc1('0x0'));var util=require(_0x4dc1('0x1'));var logger=require(_0x4dc1('0x2'))(_0x4dc1('0x3'));var moment=require(_0x4dc1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dc1('0x5'));var rimraf=require(_0x4dc1('0x6'));var config=require(_0x4dc1('0x7'));var attributes=require(_0x4dc1('0x8'));module[_0x4dc1('0x9')]=function(_0x535d3f,_0x2bfec8){return _0x535d3f['define'](_0x4dc1('0xa'),attributes,{'tableName':_0x4dc1('0xb'),'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 3d829f0..db27ea4 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 _0xf431=['../../config/utils','../../config/logger','rpc','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x832679,_0x49c631){var _0x5227ae=function(_0x5928f3){while(--_0x5928f3){_0x832679['push'](_0x832679['shift']());}};_0x5227ae(++_0x49c631);}(_0xf431,0x1cf));var _0x1f43=function(_0x54cef6,_0x146b0e){_0x54cef6=_0x54cef6-0x0;var _0x39aacf=_0xf431[_0x54cef6];return _0x39aacf;};'use strict';var _=require(_0x1f43('0x0'));var util=require(_0x1f43('0x1'));var moment=require('moment');var BPromise=require(_0x1f43('0x2'));var rs=require(_0x1f43('0x3'));var fs=require('fs');var Redis=require(_0x1f43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f43('0x5'));var logger=require(_0x1f43('0x6'))(_0x1f43('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f43('0x8')][_0x1f43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5baa95,_0x237840,_0x4f4df2){return new BPromise(function(_0x216348,_0x43d209){return client['request'](_0x5baa95,_0x4f4df2)['then'](function(_0x579176){logger[_0x1f43('0xa')](_0x1f43('0xb'),_0x237840,_0x1f43('0xc'));logger['debug'](_0x1f43('0xd'),_0x237840,_0x1f43('0xc'),JSON['stringify'](_0x579176));if(_0x579176[_0x1f43('0xe')]){if(_0x579176['error'][_0x1f43('0xf')]===0x1f4){logger[_0x1f43('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x237840,_0x579176[_0x1f43('0xe')][_0x1f43('0x10')]);return _0x43d209(_0x579176['error'][_0x1f43('0x10')]);}logger['error'](_0x1f43('0xb'),_0x237840,_0x579176['error']['message']);return _0x216348(_0x579176[_0x1f43('0xe')][_0x1f43('0x10')]);}else{logger[_0x1f43('0xa')](_0x1f43('0xb'),_0x237840,_0x1f43('0xc'));_0x216348(_0x579176['result']['message']);}})[_0x1f43('0x11')](function(_0x5d9812){logger[_0x1f43('0xe')](_0x1f43('0xb'),_0x237840,_0x5d9812);_0x43d209(_0x5d9812);});});} \ No newline at end of file +var _0x4a74=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','../../mysqldb','client','http'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4a74,0x192));var _0x44a7=function(_0x1a2729,_0x2700e1){_0x1a2729=_0x1a2729-0x0;var _0x7e373e=_0x4a74[_0x1a2729];return _0x7e373e;};'use strict';var _=require(_0x44a7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x44a7('0x1'));var rs=require(_0x44a7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44a7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x44a7('0x4')][_0x44a7('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x9aaf2,_0x2b4a56,_0xd5a6d){return new BPromise(function(_0x7115ba,_0x1d59d4){return client[_0x44a7('0x6')](_0x9aaf2,_0xd5a6d)[_0x44a7('0x7')](function(_0x5d1e68){logger[_0x44a7('0x8')](_0x44a7('0x9'),_0x2b4a56,_0x44a7('0xa'));logger[_0x44a7('0xb')](_0x44a7('0xc'),_0x2b4a56,_0x44a7('0xa'),JSON[_0x44a7('0xd')](_0x5d1e68));if(_0x5d1e68[_0x44a7('0xe')]){if(_0x5d1e68[_0x44a7('0xe')]['code']===0x1f4){logger[_0x44a7('0xe')](_0x44a7('0x9'),_0x2b4a56,_0x5d1e68[_0x44a7('0xe')][_0x44a7('0xf')]);return _0x1d59d4(_0x5d1e68['error'][_0x44a7('0xf')]);}logger[_0x44a7('0xe')](_0x44a7('0x9'),_0x2b4a56,_0x5d1e68[_0x44a7('0xe')]['message']);return _0x7115ba(_0x5d1e68[_0x44a7('0xe')][_0x44a7('0xf')]);}else{logger[_0x44a7('0x8')](_0x44a7('0x9'),_0x2b4a56,_0x44a7('0xa'));_0x7115ba(_0x5d1e68[_0x44a7('0x10')][_0x44a7('0xf')]);}})['catch'](function(_0x39b4da){logger['error'](_0x44a7('0x9'),_0x2b4a56,_0x39b4da);_0x1d59d4(_0x39b4da);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9b169d9..45152ad 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 _0x7689=['index','/:id','show','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x5d990e,_0x4ba9f5){var _0x36c763=function(_0x52270c){while(--_0x52270c){_0x5d990e['push'](_0x5d990e['shift']());}};_0x36c763(++_0x4ba9f5);}(_0x7689,0x1aa));var _0x9768=function(_0x41c36e,_0xa33927){_0x41c36e=_0x41c36e-0x0;var _0xd87cf4=_0x7689[_0x41c36e];return _0xd87cf4;};'use strict';var multer=require(_0x9768('0x0'));var util=require(_0x9768('0x1'));var path=require(_0x9768('0x2'));var timeout=require('connect-timeout');var express=require(_0x9768('0x3'));var router=express[_0x9768('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9768('0x5'));var interaction=require(_0x9768('0x6'));var config=require(_0x9768('0x7'));var controller=require(_0x9768('0x8'));router[_0x9768('0x9')]('/',auth[_0x9768('0xa')](),controller[_0x9768('0xb')]);router[_0x9768('0x9')](_0x9768('0xc'),auth[_0x9768('0xa')](),controller[_0x9768('0xd')]);router['post']('/',auth[_0x9768('0xa')](),controller[_0x9768('0xe')]);router[_0x9768('0xf')](_0x9768('0xc'),auth[_0x9768('0xa')](),controller[_0x9768('0x10')]);router[_0x9768('0x11')](_0x9768('0xc'),auth['isAuthenticated'](),controller[_0x9768('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf699=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x378a48,_0x5b012f){var _0x1538c5=function(_0x372bcc){while(--_0x372bcc){_0x378a48['push'](_0x378a48['shift']());}};_0x1538c5(++_0x5b012f);}(_0xf699,0x1c7));var _0x9f69=function(_0x41fd59,_0x457056){_0x41fd59=_0x41fd59-0x0;var _0x30787b=_0xf699[_0x41fd59];return _0x30787b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9f69('0x0'));var timeout=require(_0x9f69('0x1'));var express=require(_0x9f69('0x2'));var router=express[_0x9f69('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f69('0x4'));var interaction=require(_0x9f69('0x5'));var config=require(_0x9f69('0x6'));var controller=require(_0x9f69('0x7'));router['get']('/',auth[_0x9f69('0x8')](),controller[_0x9f69('0x9')]);router['get']('/:id',auth[_0x9f69('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9f69('0xa')]);router[_0x9f69('0xb')](_0x9f69('0xc'),auth[_0x9f69('0x8')](),controller[_0x9f69('0xd')]);router[_0x9f69('0xe')](_0x9f69('0xc'),auth[_0x9f69('0x8')](),controller[_0x9f69('0xf')]);module[_0x9f69('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 e9ab3ab..ef28949 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 _0x6e56=['variable','customVariable','STRING','ENUM','string'];(function(_0x122151,_0x3ec84a){var _0x1a400a=function(_0x1bdf07){while(--_0x1bdf07){_0x122151['push'](_0x122151['shift']());}};_0x1a400a(++_0x3ec84a);}(_0x6e56,0x175));var _0x66e5=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x6e56[_0x143a91];return _0x1906f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x66e5('0x0')](_0x66e5('0x1'),_0x66e5('0x2'),_0x66e5('0x3'),'keyValue','picklist'),'defaultValue':_0x66e5('0x1')},'content':{'type':Sequelize[_0x66e5('0x4')]},'key':{'type':Sequelize[_0x66e5('0x4')]},'keyType':{'type':Sequelize[_0x66e5('0x0')](_0x66e5('0x1'),_0x66e5('0x2'),_0x66e5('0x3'))},'keyContent':{'type':Sequelize[_0x66e5('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x66e5('0x4')]}}; \ No newline at end of file +var _0x649a=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x9746bf,_0x52542b){var _0x4c07d2=function(_0x219179){while(--_0x219179){_0x9746bf['push'](_0x9746bf['shift']());}};_0x4c07d2(++_0x52542b);}(_0x649a,0x16e));var _0xa649=function(_0x5d115e,_0x35ce96){_0x5d115e=_0x5d115e-0x0;var _0x420939=_0x649a[_0x5d115e];return _0x420939;};'use strict';var Sequelize=require(_0xa649('0x0'));module[_0xa649('0x1')]={'type':{'type':Sequelize[_0xa649('0x2')](_0xa649('0x3'),_0xa649('0x4'),_0xa649('0x5'),_0xa649('0x6'),_0xa649('0x7')),'defaultValue':_0xa649('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa649('0x8')]},'keyType':{'type':Sequelize[_0xa649('0x2')](_0xa649('0x3'),'variable',_0xa649('0x5'))},'keyContent':{'type':Sequelize[_0xa649('0x8')]},'idField':{'type':Sequelize[_0xa649('0x8')]},'variableName':{'type':Sequelize[_0xa649('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 1d95cc5..048f846 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 _0x2605=['create','body','find','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','update','then','destroy','error','stack','name','send','index','SalesforceField','type','key','map','query','filters','intersection','model','attributes','fields','limit','sort','where','filter','merge','VIRTUAL','rows','catch','show','params','rawAttributes','keys','includeAll','include','options'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x2605,0x11f));var _0x5260=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x2605[_0x175e89];return _0x2ed996;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5260('0x0'));var rp=require('request-promise');var moment=require(_0x5260('0x1'));var BPromise=require(_0x5260('0x2'));var Mustache=require(_0x5260('0x3'));var util=require(_0x5260('0x4'));var path=require(_0x5260('0x5'));var sox=require(_0x5260('0x6'));var csv=require(_0x5260('0x7'));var ejs=require(_0x5260('0x8'));var fs=require('fs');var fs_extra=require(_0x5260('0x9'));var _=require(_0x5260('0xa'));var squel=require(_0x5260('0xb'));var crypto=require(_0x5260('0xc'));var jsforce=require(_0x5260('0xd'));var deskjs=require(_0x5260('0xe'));var toCsv=require(_0x5260('0x7'));var querystring=require('querystring');var Papa=require(_0x5260('0xf'));var Redis=require(_0x5260('0x10'));var authService=require(_0x5260('0x11'));var qs=require(_0x5260('0x12'));var as=require(_0x5260('0x13'));var hardwareService=require(_0x5260('0x14'));var logger=require(_0x5260('0x15'))(_0x5260('0x16'));var utils=require(_0x5260('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5260('0x18'));var db=require(_0x5260('0x19'))['db'];function respondWithStatusCode(_0x522e4b,_0xb3cdef){_0xb3cdef=_0xb3cdef||0xcc;return function(_0x33f310){if(_0x33f310){return _0x522e4b[_0x5260('0x1a')](_0xb3cdef);}return _0x522e4b[_0x5260('0x1b')](_0xb3cdef)[_0x5260('0x1c')]();};}function respondWithResult(_0x345c30,_0x3d45e7){_0x3d45e7=_0x3d45e7||0xc8;return function(_0x3f3859){if(_0x3f3859){return _0x345c30[_0x5260('0x1b')](_0x3d45e7)[_0x5260('0x1d')](_0x3f3859);}};}function respondWithFilteredResult(_0x58e540,_0x4d6008){return function(_0x298069){if(_0x298069){var _0x400880=typeof _0x4d6008[_0x5260('0x1e')]===_0x5260('0x1f')&&typeof _0x4d6008['limit']===_0x5260('0x1f');var _0x54c65d=_0x298069[_0x5260('0x20')];var _0x59b34f=_0x400880?0x0:_0x4d6008[_0x5260('0x1e')];var _0x33a694=_0x400880?_0x298069['count']:_0x4d6008[_0x5260('0x1e')]+_0x4d6008['limit'];var _0x48b8c0;if(_0x33a694>=_0x54c65d){_0x33a694=_0x54c65d;_0x48b8c0=0xc8;}else{_0x48b8c0=0xce;}_0x58e540[_0x5260('0x1b')](_0x48b8c0);return _0x58e540['set'](_0x5260('0x21'),_0x59b34f+'-'+_0x33a694+'/'+_0x54c65d)[_0x5260('0x1d')](_0x298069);}return null;};}function patchUpdates(_0x1800c1){return function(_0x261ff2){try{jsonpatch['apply'](_0x261ff2,_0x1800c1,!![]);}catch(_0x47800f){return BPromise[_0x5260('0x22')](_0x47800f);}return _0x261ff2['save']();};}function saveUpdates(_0x270f56,_0x278be3){return function(_0x2a786d){if(_0x2a786d){return _0x2a786d[_0x5260('0x23')](_0x270f56)[_0x5260('0x24')](function(_0x6cb572){return _0x6cb572;});}return null;};}function removeEntity(_0x3590dd,_0x190440){return function(_0xe18446){if(_0xe18446){return _0xe18446[_0x5260('0x25')]()['then'](function(){_0x3590dd[_0x5260('0x1b')](0xcc)[_0x5260('0x1c')]();});}};}function handleEntityNotFound(_0x5ba9b7,_0x24b19a){return function(_0x3eb39b){if(!_0x3eb39b){_0x5ba9b7['sendStatus'](0x194);}return _0x3eb39b;};}function handleError(_0x3d184e,_0x6b2b08){_0x6b2b08=_0x6b2b08||0x1f4;return function(_0x3b3814){logger[_0x5260('0x26')](_0x3b3814[_0x5260('0x27')]);if(_0x3b3814[_0x5260('0x28')]){delete _0x3b3814[_0x5260('0x28')];}_0x3d184e['status'](_0x6b2b08)[_0x5260('0x29')](_0x3b3814);};}exports[_0x5260('0x2a')]=function(_0x47439d,_0x2d4ee4){var _0x4f1a78={},_0x23c93c={},_0x4a2c47={'count':0x0,'rows':[]};var _0x4ce269=_['map'](db[_0x5260('0x2b')]['rawAttributes'],function(_0xfd0ed1){return{'name':_0xfd0ed1['fieldName'],'type':_0xfd0ed1[_0x5260('0x2c')][_0x5260('0x2d')]};});_0x23c93c['model']=_[_0x5260('0x2e')](_0x4ce269,_0x5260('0x28'));_0x23c93c['query']=_['keys'](_0x47439d[_0x5260('0x2f')]);_0x23c93c[_0x5260('0x30')]=_[_0x5260('0x31')](_0x23c93c[_0x5260('0x32')],_0x23c93c[_0x5260('0x2f')]);_0x4f1a78[_0x5260('0x33')]=_[_0x5260('0x31')](_0x23c93c['model'],qs[_0x5260('0x34')](_0x47439d[_0x5260('0x2f')]['fields']));_0x4f1a78[_0x5260('0x33')]=_0x4f1a78[_0x5260('0x33')]['length']?_0x4f1a78['attributes']:_0x23c93c['model'];if(!_0x47439d[_0x5260('0x2f')]['hasOwnProperty']('nolimit')){_0x4f1a78[_0x5260('0x35')]=qs[_0x5260('0x35')](_0x47439d['query'][_0x5260('0x35')]);_0x4f1a78[_0x5260('0x1e')]=qs[_0x5260('0x1e')](_0x47439d[_0x5260('0x2f')][_0x5260('0x1e')]);}_0x4f1a78['order']=qs[_0x5260('0x36')](_0x47439d['query']['sort']);_0x4f1a78[_0x5260('0x37')]=qs[_0x5260('0x30')](_['pick'](_0x47439d['query'],_0x23c93c[_0x5260('0x30')]),_0x4ce269);if(_0x47439d[_0x5260('0x2f')][_0x5260('0x38')]){_0x4f1a78[_0x5260('0x37')]=_[_0x5260('0x39')](_0x4f1a78[_0x5260('0x37')],{'$or':_[_0x5260('0x2e')](_0x4ce269,function(_0x112f6f){if(_0x112f6f[_0x5260('0x2c')]!==_0x5260('0x3a')){var _0x362567={};_0x362567[_0x112f6f[_0x5260('0x28')]]={'$like':'%'+_0x47439d[_0x5260('0x2f')][_0x5260('0x38')]+'%'};return _0x362567;}})});}_0x4f1a78=_['merge']({},_0x4f1a78,_0x47439d['options']);var _0x5c313b={'where':_0x4f1a78[_0x5260('0x37')]};return db[_0x5260('0x2b')][_0x5260('0x20')](_0x5c313b)[_0x5260('0x24')](function(_0x43ff6b){_0x4a2c47[_0x5260('0x20')]=_0x43ff6b;if(_0x47439d[_0x5260('0x2f')]['includeAll']){_0x4f1a78['include']=[{'all':!![]}];}return db[_0x5260('0x2b')]['findAll'](_0x4f1a78);})[_0x5260('0x24')](function(_0x10d5db){_0x4a2c47[_0x5260('0x3b')]=_0x10d5db;return _0x4a2c47;})[_0x5260('0x24')](respondWithFilteredResult(_0x2d4ee4,_0x4f1a78))[_0x5260('0x3c')](handleError(_0x2d4ee4,null));};exports[_0x5260('0x3d')]=function(_0x5c8fb2,_0x4dca0c){var _0x5e5656={'raw':!![],'where':{'id':_0x5c8fb2[_0x5260('0x3e')]['id']}},_0x207868={};_0x207868['model']=_['keys'](db[_0x5260('0x2b')][_0x5260('0x3f')]);_0x207868['query']=_[_0x5260('0x40')](_0x5c8fb2[_0x5260('0x2f')]);_0x207868[_0x5260('0x30')]=_[_0x5260('0x31')](_0x207868['model'],_0x207868[_0x5260('0x2f')]);_0x5e5656[_0x5260('0x33')]=_[_0x5260('0x31')](_0x207868[_0x5260('0x32')],qs[_0x5260('0x34')](_0x5c8fb2[_0x5260('0x2f')][_0x5260('0x34')]));_0x5e5656[_0x5260('0x33')]=_0x5e5656['attributes']['length']?_0x5e5656['attributes']:_0x207868[_0x5260('0x32')];if(_0x5c8fb2[_0x5260('0x2f')][_0x5260('0x41')]){_0x5e5656[_0x5260('0x42')]=[{'all':!![]}];}_0x5e5656=_[_0x5260('0x39')]({},_0x5e5656,_0x5c8fb2[_0x5260('0x43')]);return db[_0x5260('0x2b')]['find'](_0x5e5656)['then'](handleEntityNotFound(_0x4dca0c,null))[_0x5260('0x24')](respondWithResult(_0x4dca0c,null))[_0x5260('0x3c')](handleError(_0x4dca0c,null));};exports['create']=function(_0x2875a6,_0x46d99f){return db[_0x5260('0x2b')][_0x5260('0x44')](_0x2875a6[_0x5260('0x45')],{})[_0x5260('0x24')](respondWithResult(_0x46d99f,0xc9))[_0x5260('0x3c')](handleError(_0x46d99f,null));};exports['update']=function(_0x2274d3,_0x203fea){if(_0x2274d3[_0x5260('0x45')]['id']){delete _0x2274d3[_0x5260('0x45')]['id'];}return db[_0x5260('0x2b')]['find']({'where':{'id':_0x2274d3[_0x5260('0x3e')]['id']}})[_0x5260('0x24')](handleEntityNotFound(_0x203fea,null))[_0x5260('0x24')](saveUpdates(_0x2274d3['body'],null))[_0x5260('0x24')](respondWithResult(_0x203fea,null))[_0x5260('0x3c')](handleError(_0x203fea,null));};exports[_0x5260('0x25')]=function(_0xc1d9e7,_0x425a65){return db[_0x5260('0x2b')][_0x5260('0x46')]({'where':{'id':_0xc1d9e7['params']['id']}})['then'](handleEntityNotFound(_0x425a65,null))[_0x5260('0x24')](removeEntity(_0x425a65,null))[_0x5260('0x3c')](handleError(_0x425a65,null));}; \ No newline at end of file +var _0xe897=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count','offset','set','Content-Range','apply','reject','then','destroy','status','name','send','index','SalesforceField','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xe897,0x16d));var _0x7e89=function(_0x54d4c2,_0x198da9){_0x54d4c2=_0x54d4c2-0x0;var _0x591c89=_0xe897[_0x54d4c2];return _0x591c89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e89('0x0'));var zipdir=require(_0x7e89('0x1'));var jsonpatch=require(_0x7e89('0x2'));var rp=require(_0x7e89('0x3'));var moment=require(_0x7e89('0x4'));var BPromise=require(_0x7e89('0x5'));var Mustache=require(_0x7e89('0x6'));var util=require(_0x7e89('0x7'));var path=require('path');var sox=require(_0x7e89('0x8'));var csv=require(_0x7e89('0x9'));var ejs=require(_0x7e89('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e89('0xb'));var squel=require('squel');var crypto=require(_0x7e89('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7e89('0xd'));var toCsv=require(_0x7e89('0x9'));var querystring=require(_0x7e89('0xe'));var Papa=require('papaparse');var Redis=require(_0x7e89('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7e89('0x10'));var as=require(_0x7e89('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e89('0x12'))(_0x7e89('0x13'));var utils=require(_0x7e89('0x14'));var config=require(_0x7e89('0x15'));var licenseUtil=require(_0x7e89('0x16'));var db=require(_0x7e89('0x17'))['db'];function respondWithStatusCode(_0x24987e,_0x1fd896){_0x1fd896=_0x1fd896||0xcc;return function(_0x213bcc){if(_0x213bcc){return _0x24987e[_0x7e89('0x18')](_0x1fd896);}return _0x24987e['status'](_0x1fd896)[_0x7e89('0x19')]();};}function respondWithResult(_0x1f9030,_0x36cfd6){_0x36cfd6=_0x36cfd6||0xc8;return function(_0x1f2734){if(_0x1f2734){return _0x1f9030['status'](_0x36cfd6)[_0x7e89('0x1a')](_0x1f2734);}};}function respondWithFilteredResult(_0x1d031a,_0x3773aa){return function(_0x48b645){if(_0x48b645){var _0x17b590=typeof _0x3773aa['offset']==='undefined'&&typeof _0x3773aa[_0x7e89('0x1b')]==='undefined';var _0x1d6677=_0x48b645[_0x7e89('0x1c')];var _0x18b53f=_0x17b590?0x0:_0x3773aa[_0x7e89('0x1d')];var _0x4395e0=_0x17b590?_0x48b645[_0x7e89('0x1c')]:_0x3773aa[_0x7e89('0x1d')]+_0x3773aa[_0x7e89('0x1b')];var _0x3533c8;if(_0x4395e0>=_0x1d6677){_0x4395e0=_0x1d6677;_0x3533c8=0xc8;}else{_0x3533c8=0xce;}_0x1d031a['status'](_0x3533c8);return _0x1d031a[_0x7e89('0x1e')](_0x7e89('0x1f'),_0x18b53f+'-'+_0x4395e0+'/'+_0x1d6677)[_0x7e89('0x1a')](_0x48b645);}return null;};}function patchUpdates(_0x3b4182){return function(_0x4ba4ef){try{jsonpatch[_0x7e89('0x20')](_0x4ba4ef,_0x3b4182,!![]);}catch(_0x288603){return BPromise[_0x7e89('0x21')](_0x288603);}return _0x4ba4ef['save']();};}function saveUpdates(_0x6411b8,_0x5d4d29){return function(_0x3cb544){if(_0x3cb544){return _0x3cb544['update'](_0x6411b8)[_0x7e89('0x22')](function(_0x3d66c1){return _0x3d66c1;});}return null;};}function removeEntity(_0x6d05a2,_0x52711d){return function(_0x1049cc){if(_0x1049cc){return _0x1049cc[_0x7e89('0x23')]()[_0x7e89('0x22')](function(){_0x6d05a2[_0x7e89('0x24')](0xcc)[_0x7e89('0x19')]();});}};}function handleEntityNotFound(_0x1846b9,_0x3d2ff1){return function(_0x23260e){if(!_0x23260e){_0x1846b9['sendStatus'](0x194);}return _0x23260e;};}function handleError(_0x459dd7,_0x50ec1){_0x50ec1=_0x50ec1||0x1f4;return function(_0x1ea346){logger['error'](_0x1ea346['stack']);if(_0x1ea346['name']){delete _0x1ea346[_0x7e89('0x25')];}_0x459dd7[_0x7e89('0x24')](_0x50ec1)[_0x7e89('0x26')](_0x1ea346);};}exports[_0x7e89('0x27')]=function(_0x143f83,_0x18c920){var _0x349657={},_0x499534={},_0x213acf={'count':0x0,'rows':[]};var _0x916289=_['map'](db[_0x7e89('0x28')][_0x7e89('0x29')],function(_0x2e428f){return{'name':_0x2e428f[_0x7e89('0x2a')],'type':_0x2e428f['type'][_0x7e89('0x2b')]};});_0x499534['model']=_[_0x7e89('0x2c')](_0x916289,_0x7e89('0x25'));_0x499534[_0x7e89('0x2d')]=_[_0x7e89('0x2e')](_0x143f83['query']);_0x499534[_0x7e89('0x2f')]=_[_0x7e89('0x30')](_0x499534[_0x7e89('0x31')],_0x499534[_0x7e89('0x2d')]);_0x349657[_0x7e89('0x32')]=_[_0x7e89('0x30')](_0x499534[_0x7e89('0x31')],qs[_0x7e89('0x33')](_0x143f83[_0x7e89('0x2d')]['fields']));_0x349657[_0x7e89('0x32')]=_0x349657['attributes'][_0x7e89('0x34')]?_0x349657[_0x7e89('0x32')]:_0x499534[_0x7e89('0x31')];if(!_0x143f83[_0x7e89('0x2d')][_0x7e89('0x35')](_0x7e89('0x36'))){_0x349657[_0x7e89('0x1b')]=qs[_0x7e89('0x1b')](_0x143f83[_0x7e89('0x2d')][_0x7e89('0x1b')]);_0x349657[_0x7e89('0x1d')]=qs['offset'](_0x143f83[_0x7e89('0x2d')]['offset']);}_0x349657[_0x7e89('0x37')]=qs[_0x7e89('0x38')](_0x143f83['query'][_0x7e89('0x38')]);_0x349657[_0x7e89('0x39')]=qs[_0x7e89('0x2f')](_[_0x7e89('0x3a')](_0x143f83[_0x7e89('0x2d')],_0x499534[_0x7e89('0x2f')]),_0x916289);if(_0x143f83['query'][_0x7e89('0x3b')]){_0x349657[_0x7e89('0x39')]=_[_0x7e89('0x3c')](_0x349657['where'],{'$or':_[_0x7e89('0x2c')](_0x916289,function(_0x178510){if(_0x178510[_0x7e89('0x3d')]!==_0x7e89('0x3e')){var _0x11ea3e={};_0x11ea3e[_0x178510[_0x7e89('0x25')]]={'$like':'%'+_0x143f83['query'][_0x7e89('0x3b')]+'%'};return _0x11ea3e;}})});}_0x349657=_[_0x7e89('0x3c')]({},_0x349657,_0x143f83[_0x7e89('0x3f')]);var _0x3a7655={'where':_0x349657[_0x7e89('0x39')]};return db['SalesforceField'][_0x7e89('0x1c')](_0x3a7655)[_0x7e89('0x22')](function(_0x2ed03d){_0x213acf[_0x7e89('0x1c')]=_0x2ed03d;if(_0x143f83[_0x7e89('0x2d')][_0x7e89('0x40')]){_0x349657[_0x7e89('0x41')]=[{'all':!![]}];}return db[_0x7e89('0x28')][_0x7e89('0x42')](_0x349657);})[_0x7e89('0x22')](function(_0xd2f20b){_0x213acf[_0x7e89('0x43')]=_0xd2f20b;return _0x213acf;})[_0x7e89('0x22')](respondWithFilteredResult(_0x18c920,_0x349657))[_0x7e89('0x44')](handleError(_0x18c920,null));};exports['show']=function(_0x31cace,_0x6db72f){var _0x5e523b={'raw':!![],'where':{'id':_0x31cace[_0x7e89('0x45')]['id']}},_0x51f56e={};_0x51f56e[_0x7e89('0x31')]=_['keys'](db['SalesforceField'][_0x7e89('0x29')]);_0x51f56e['query']=_[_0x7e89('0x2e')](_0x31cace['query']);_0x51f56e[_0x7e89('0x2f')]=_[_0x7e89('0x30')](_0x51f56e[_0x7e89('0x31')],_0x51f56e[_0x7e89('0x2d')]);_0x5e523b[_0x7e89('0x32')]=_[_0x7e89('0x30')](_0x51f56e[_0x7e89('0x31')],qs[_0x7e89('0x33')](_0x31cace[_0x7e89('0x2d')]['fields']));_0x5e523b[_0x7e89('0x32')]=_0x5e523b[_0x7e89('0x32')][_0x7e89('0x34')]?_0x5e523b[_0x7e89('0x32')]:_0x51f56e[_0x7e89('0x31')];if(_0x31cace[_0x7e89('0x2d')][_0x7e89('0x40')]){_0x5e523b[_0x7e89('0x41')]=[{'all':!![]}];}_0x5e523b=_[_0x7e89('0x3c')]({},_0x5e523b,_0x31cace[_0x7e89('0x3f')]);return db['SalesforceField']['find'](_0x5e523b)['then'](handleEntityNotFound(_0x6db72f,null))[_0x7e89('0x22')](respondWithResult(_0x6db72f,null))[_0x7e89('0x44')](handleError(_0x6db72f,null));};exports[_0x7e89('0x46')]=function(_0x43a681,_0x39f2b3){return db[_0x7e89('0x28')]['create'](_0x43a681['body'],{})[_0x7e89('0x22')](respondWithResult(_0x39f2b3,0xc9))[_0x7e89('0x44')](handleError(_0x39f2b3,null));};exports['update']=function(_0x186bc4,_0xfb9df3){if(_0x186bc4[_0x7e89('0x47')]['id']){delete _0x186bc4['body']['id'];}return db[_0x7e89('0x28')][_0x7e89('0x48')]({'where':{'id':_0x186bc4[_0x7e89('0x45')]['id']}})[_0x7e89('0x22')](handleEntityNotFound(_0xfb9df3,null))[_0x7e89('0x22')](saveUpdates(_0x186bc4[_0x7e89('0x47')],null))[_0x7e89('0x22')](respondWithResult(_0xfb9df3,null))[_0x7e89('0x44')](handleError(_0xfb9df3,null));};exports['destroy']=function(_0x43f8c8,_0x227e2c){return db[_0x7e89('0x28')][_0x7e89('0x48')]({'where':{'id':_0x43f8c8['params']['id']}})[_0x7e89('0x22')](handleEntityNotFound(_0x227e2c,null))[_0x7e89('0x22')](removeEntity(_0x227e2c,null))['catch'](handleError(_0x227e2c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 73388bd..7413292 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 _0x1c54=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0xa268ed,_0x3a262c){var _0x16e3aa=function(_0x3a5007){while(--_0x3a5007){_0xa268ed['push'](_0xa268ed['shift']());}};_0x16e3aa(++_0x3a262c);}(_0x1c54,0xb7));var _0x41c5=function(_0x4b59da,_0x577c76){_0x4b59da=_0x4b59da-0x0;var _0xfed1d8=_0x1c54[_0x4b59da];return _0xfed1d8;};'use strict';var _=require(_0x41c5('0x0'));var util=require(_0x41c5('0x1'));var logger=require(_0x41c5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x41c5('0x3'));var rp=require(_0x41c5('0x4'));var fs=require('fs');var path=require(_0x41c5('0x5'));var rimraf=require(_0x41c5('0x6'));var config=require(_0x41c5('0x7'));var attributes=require(_0x41c5('0x8'));module[_0x41c5('0x9')]=function(_0x5815e8,_0xbd22e6){return _0x5815e8[_0x41c5('0xa')](_0x41c5('0xb'),attributes,{'tableName':_0x41c5('0xc'),'paranoid':![],'indexes':[{'name':_0x41c5('0xd'),'fields':[_0x41c5('0xe'),_0x41c5('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f76=['exports','define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes'];(function(_0x33d225,_0x21d9a6){var _0x3a8d9e=function(_0x3c62ca){while(--_0x3c62ca){_0x33d225['push'](_0x33d225['shift']());}};_0x3a8d9e(++_0x21d9a6);}(_0x2f76,0x1d9));var _0x62f7=function(_0x57ba23,_0x56fc6f){_0x57ba23=_0x57ba23-0x0;var _0x4e40b6=_0x2f76[_0x57ba23];return _0x4e40b6;};'use strict';var _=require(_0x62f7('0x0'));var util=require(_0x62f7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x62f7('0x2'));var BPromise=require(_0x62f7('0x3'));var rp=require(_0x62f7('0x4'));var fs=require('fs');var path=require(_0x62f7('0x5'));var rimraf=require('rimraf');var config=require(_0x62f7('0x6'));var attributes=require(_0x62f7('0x7'));module[_0x62f7('0x8')]=function(_0x3d52a6,_0x230e39){return _0x3d52a6[_0x62f7('0x9')]('SalesforceField',attributes,{'tableName':_0x62f7('0xa'),'paranoid':![],'indexes':[{'name':_0x62f7('0xb'),'fields':[_0x62f7('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 5384583..24354a9 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 _0x0d53=['../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0d53,0x19e));var _0x30d5=function(_0x633b89,_0xc12363){_0x633b89=_0x633b89-0x0;var _0x36cf89=_0x0d53[_0x633b89];return _0x36cf89;};'use strict';var _=require(_0x30d5('0x0'));var util=require('util');var moment=require(_0x30d5('0x1'));var BPromise=require(_0x30d5('0x2'));var rs=require(_0x30d5('0x3'));var fs=require('fs');var Redis=require(_0x30d5('0x4'));var db=require(_0x30d5('0x5'))['db'];var utils=require(_0x30d5('0x6'));var logger=require(_0x30d5('0x7'))(_0x30d5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x30d5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf25c3a,_0x2ae6dc,_0x369f8a){return new BPromise(function(_0x2ff372,_0x2a8309){return client[_0x30d5('0xa')](_0xf25c3a,_0x369f8a)[_0x30d5('0xb')](function(_0xff4eba){logger[_0x30d5('0xc')]('SalesforceField,\x20%s,\x20%s',_0x2ae6dc,_0x30d5('0xd'));logger[_0x30d5('0xe')](_0x30d5('0xf'),_0x2ae6dc,_0x30d5('0xd'),JSON[_0x30d5('0x10')](_0xff4eba));if(_0xff4eba[_0x30d5('0x11')]){if(_0xff4eba[_0x30d5('0x11')]['code']===0x1f4){logger['error'](_0x30d5('0x12'),_0x2ae6dc,_0xff4eba[_0x30d5('0x11')][_0x30d5('0x13')]);return _0x2a8309(_0xff4eba[_0x30d5('0x11')][_0x30d5('0x13')]);}logger[_0x30d5('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ae6dc,_0xff4eba['error'][_0x30d5('0x13')]);return _0x2ff372(_0xff4eba[_0x30d5('0x11')][_0x30d5('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x2ae6dc,'request\x20sent');_0x2ff372(_0xff4eba['result'][_0x30d5('0x13')]);}})[_0x30d5('0x14')](function(_0x564871){logger[_0x30d5('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2ae6dc,_0x564871);_0x2a8309(_0x564871);});});} \ No newline at end of file +var _0xa125=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4e81af,_0x316a05){var _0xda1459=function(_0x263838){while(--_0x263838){_0x4e81af['push'](_0x4e81af['shift']());}};_0xda1459(++_0x316a05);}(_0xa125,0x1e1));var _0x5a12=function(_0x198c32,_0x8e51ec){_0x198c32=_0x198c32-0x0;var _0x23f55a=_0xa125[_0x198c32];return _0x23f55a;};'use strict';var _=require(_0x5a12('0x0'));var util=require(_0x5a12('0x1'));var moment=require(_0x5a12('0x2'));var BPromise=require(_0x5a12('0x3'));var rs=require(_0x5a12('0x4'));var fs=require('fs');var Redis=require(_0x5a12('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a12('0x6'));var logger=require(_0x5a12('0x7'))(_0x5a12('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a12('0x9'));var client=jayson[_0x5a12('0xa')][_0x5a12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2668bf,_0x532cf0,_0x1e1f90){return new BPromise(function(_0x2bba4c,_0x23d86f){return client[_0x5a12('0xc')](_0x2668bf,_0x1e1f90)[_0x5a12('0xd')](function(_0x23604f){logger[_0x5a12('0xe')](_0x5a12('0xf'),_0x532cf0,_0x5a12('0x10'));logger[_0x5a12('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x532cf0,_0x5a12('0x10'),JSON[_0x5a12('0x12')](_0x23604f));if(_0x23604f['error']){if(_0x23604f[_0x5a12('0x13')][_0x5a12('0x14')]===0x1f4){logger[_0x5a12('0x13')]('SalesforceField,\x20%s,\x20%s',_0x532cf0,_0x23604f[_0x5a12('0x13')][_0x5a12('0x15')]);return _0x23d86f(_0x23604f[_0x5a12('0x13')][_0x5a12('0x15')]);}logger[_0x5a12('0x13')](_0x5a12('0xf'),_0x532cf0,_0x23604f['error'][_0x5a12('0x15')]);return _0x2bba4c(_0x23604f[_0x5a12('0x13')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x532cf0,_0x5a12('0x10'));_0x2bba4c(_0x23604f[_0x5a12('0x16')][_0x5a12('0x15')]);}})[_0x5a12('0x17')](function(_0x1a0b75){logger['error']('SalesforceField,\x20%s,\x20%s',_0x532cf0,_0x1a0b75);_0x23d86f(_0x1a0b75);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6d56b42..60989ab 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 _0x409d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x409d,0x195));var _0xd409=function(_0x1e2601,_0x331bbc){_0x1e2601=_0x1e2601-0x0;var _0x3809d2=_0x409d[_0x1e2601];return _0x3809d2;};'use strict';var multer=require('multer');var util=require(_0xd409('0x0'));var path=require(_0xd409('0x1'));var timeout=require(_0xd409('0x2'));var express=require(_0xd409('0x3'));var router=express[_0xd409('0x4')]();var fs_extra=require(_0xd409('0x5'));var auth=require(_0xd409('0x6'));var interaction=require(_0xd409('0x7'));var config=require(_0xd409('0x8'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xd409('0x9')](),controller[_0xd409('0xa')]);router[_0xd409('0xb')](_0xd409('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd409('0xd'),auth[_0xd409('0x9')](),controller[_0xd409('0xe')]);router[_0xd409('0xb')](_0xd409('0xf'),auth[_0xd409('0x9')](),controller['getFields']);router[_0xd409('0x10')]('/',auth[_0xd409('0x9')](),controller[_0xd409('0x11')]);router[_0xd409('0x10')](_0xd409('0xd'),auth[_0xd409('0x9')](),controller[_0xd409('0x12')]);router[_0xd409('0x13')](_0xd409('0xc'),auth[_0xd409('0x9')](),controller[_0xd409('0x14')]);router[_0xd409('0x15')]('/:id',auth[_0xd409('0x9')](),controller[_0xd409('0x16')]);module[_0xd409('0x17')]=router; \ No newline at end of file +var _0x3299=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0x3299,0x1bc));var _0x9329=function(_0x33b61c,_0x467d89){_0x33b61c=_0x33b61c-0x0;var _0x3a7dd9=_0x3299[_0x33b61c];return _0x3a7dd9;};'use strict';var multer=require('multer');var util=require(_0x9329('0x0'));var path=require(_0x9329('0x1'));var timeout=require(_0x9329('0x2'));var express=require(_0x9329('0x3'));var router=express[_0x9329('0x4')]();var fs_extra=require(_0x9329('0x5'));var auth=require(_0x9329('0x6'));var interaction=require(_0x9329('0x7'));var config=require(_0x9329('0x8'));var controller=require(_0x9329('0x9'));router[_0x9329('0xa')]('/',auth[_0x9329('0xb')](),controller[_0x9329('0xc')]);router[_0x9329('0xa')](_0x9329('0xd'),auth[_0x9329('0xb')](),controller[_0x9329('0xe')]);router['get'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x10')]);router[_0x9329('0xa')](_0x9329('0x11'),auth['isAuthenticated'](),controller[_0x9329('0x12')]);router[_0x9329('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9329('0xf'),auth[_0x9329('0xb')](),controller[_0x9329('0x14')]);router[_0x9329('0x15')](_0x9329('0xd'),auth['isAuthenticated'](),controller[_0x9329('0x16')]);router[_0x9329('0x17')](_0x9329('0xd'),auth['isAuthenticated'](),controller[_0x9329('0x18')]);module[_0x9329('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index dba9257..4e081ed 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 _0x3428=['sequelize','exports','STRING','username'];(function(_0x1971f1,_0x48e960){var _0x2c3a90=function(_0x522d8f){while(--_0x522d8f){_0x1971f1['push'](_0x1971f1['shift']());}};_0x2c3a90(++_0x48e960);}(_0x3428,0x114));var _0x8342=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3428[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0x8342('0x0'));module[_0x8342('0x1')]={'name':{'type':Sequelize[_0x8342('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x8342('0x3')},'password':{'type':Sequelize[_0x8342('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8342('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8342('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa30a=['exports','STRING','remoteUri','sequelize'];(function(_0x4b5b06,_0x5df26b){var _0x3388f0=function(_0x27e6f7){while(--_0x27e6f7){_0x4b5b06['push'](_0x4b5b06['shift']());}};_0x3388f0(++_0x5df26b);}(_0xa30a,0xcb));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaa30('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xaa30('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xaa30('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index c20c621..9c3b1a3 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 _0x1060=['sys_class_name','close_notes','closed_by','parent_incident','sys_id','reopened_by','urgency','problem_id','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','result','log','incident\x20table\x20objects','assign','remove','includes','label','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','push','all','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','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','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','length','pick','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','assignment_group','business_stc','description','calendar_duration'];(function(_0xeafbff,_0x1ba785){var _0x1d01f7=function(_0x31cb42){while(--_0x31cb42){_0xeafbff['push'](_0xeafbff['shift']());}};_0x1d01f7(++_0x1ba785);}(_0x1060,0xf4));var _0x0106=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1060[_0x5f1391];return _0x50ebe3;};'use strict';var emlformat=require(_0x0106('0x0'));var rimraf=require(_0x0106('0x1'));var zipdir=require(_0x0106('0x2'));var jsonpatch=require(_0x0106('0x3'));var rp=require(_0x0106('0x4'));var moment=require(_0x0106('0x5'));var BPromise=require(_0x0106('0x6'));var Mustache=require(_0x0106('0x7'));var util=require(_0x0106('0x8'));var path=require(_0x0106('0x9'));var sox=require(_0x0106('0xa'));var csv=require(_0x0106('0xb'));var ejs=require(_0x0106('0xc'));var fs=require('fs');var fs_extra=require(_0x0106('0xd'));var _=require(_0x0106('0xe'));var squel=require(_0x0106('0xf'));var crypto=require(_0x0106('0x10'));var jsforce=require(_0x0106('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0106('0x12'));var Papa=require(_0x0106('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0106('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0106('0x15'));var logger=require(_0x0106('0x16'))(_0x0106('0x17'));var utils=require(_0x0106('0x18'));var config=require(_0x0106('0x19'));var licenseUtil=require(_0x0106('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5f55a6,_0x9f7b88){_0x9f7b88=_0x9f7b88||0xcc;return function(_0xef7bf9){if(_0xef7bf9){return _0x5f55a6[_0x0106('0x1b')](_0x9f7b88);}return _0x5f55a6[_0x0106('0x1c')](_0x9f7b88)['end']();};}function respondWithResult(_0x171ec3,_0x121bf7){_0x121bf7=_0x121bf7||0xc8;return function(_0x23ec48){if(_0x23ec48){return _0x171ec3[_0x0106('0x1c')](_0x121bf7)['json'](_0x23ec48);}};}function respondWithFilteredResult(_0x2d6076,_0x4f1d0b){return function(_0x548eb6){if(_0x548eb6){var _0x4c31f6=typeof _0x4f1d0b[_0x0106('0x1d')]===_0x0106('0x1e')&&typeof _0x4f1d0b[_0x0106('0x1f')]===_0x0106('0x1e');var _0x1d4d10=_0x548eb6['count'];var _0x14528d=_0x4c31f6?0x0:_0x4f1d0b['offset'];var _0x3f22fd=_0x4c31f6?_0x548eb6[_0x0106('0x20')]:_0x4f1d0b[_0x0106('0x1d')]+_0x4f1d0b[_0x0106('0x1f')];var _0x2260ed;if(_0x3f22fd>=_0x1d4d10){_0x3f22fd=_0x1d4d10;_0x2260ed=0xc8;}else{_0x2260ed=0xce;}_0x2d6076['status'](_0x2260ed);return _0x2d6076[_0x0106('0x21')](_0x0106('0x22'),_0x14528d+'-'+_0x3f22fd+'/'+_0x1d4d10)[_0x0106('0x23')](_0x548eb6);}return null;};}function patchUpdates(_0x212a78){return function(_0x28edff){try{jsonpatch[_0x0106('0x24')](_0x28edff,_0x212a78,!![]);}catch(_0x5f05b5){return BPromise['reject'](_0x5f05b5);}return _0x28edff[_0x0106('0x25')]();};}function saveUpdates(_0x341ddc,_0x1972f8){return function(_0x3b245b){if(_0x3b245b){return _0x3b245b[_0x0106('0x26')](_0x341ddc)[_0x0106('0x27')](function(_0x30e4cf){return _0x30e4cf;});}return null;};}function removeEntity(_0x5802ea,_0x256515){return function(_0x2020f8){if(_0x2020f8){return _0x2020f8['destroy']()[_0x0106('0x27')](function(){_0x5802ea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f54c7,_0x1527c3){return function(_0x3286b0){if(!_0x3286b0){_0x4f54c7[_0x0106('0x1b')](0x194);}return _0x3286b0;};}function handleError(_0x50569a,_0x1240f3){_0x1240f3=_0x1240f3||0x1f4;return function(_0x102991){logger[_0x0106('0x28')](_0x102991[_0x0106('0x29')]);if(_0x102991[_0x0106('0x2a')]){delete _0x102991['name'];}_0x50569a[_0x0106('0x1c')](_0x1240f3)[_0x0106('0x2b')](_0x102991);};}exports[_0x0106('0x2c')]=function(_0x42b4f7,_0x2fc687){var _0x12ec3b={},_0x5591e2={},_0x27157c={'count':0x0,'rows':[]};var _0x116e09=_['map'](db[_0x0106('0x2d')][_0x0106('0x2e')],function(_0x5894d7){return{'name':_0x5894d7[_0x0106('0x2f')],'type':_0x5894d7['type'][_0x0106('0x30')]};});_0x5591e2[_0x0106('0x31')]=_[_0x0106('0x32')](_0x116e09,_0x0106('0x2a'));_0x5591e2[_0x0106('0x33')]=_[_0x0106('0x34')](_0x42b4f7['query']);_0x5591e2['filters']=_['intersection'](_0x5591e2['model'],_0x5591e2[_0x0106('0x33')]);_0x12ec3b[_0x0106('0x35')]=_[_0x0106('0x36')](_0x5591e2[_0x0106('0x31')],qs['fields'](_0x42b4f7[_0x0106('0x33')][_0x0106('0x37')]));_0x12ec3b[_0x0106('0x35')]=_0x12ec3b[_0x0106('0x35')]['length']?_0x12ec3b['attributes']:_0x5591e2[_0x0106('0x31')];if(!_0x42b4f7[_0x0106('0x33')]['hasOwnProperty']('nolimit')){_0x12ec3b[_0x0106('0x1f')]=qs[_0x0106('0x1f')](_0x42b4f7[_0x0106('0x33')][_0x0106('0x1f')]);_0x12ec3b[_0x0106('0x1d')]=qs[_0x0106('0x1d')](_0x42b4f7[_0x0106('0x33')][_0x0106('0x1d')]);}_0x12ec3b[_0x0106('0x38')]=qs[_0x0106('0x39')](_0x42b4f7['query'][_0x0106('0x39')]);_0x12ec3b[_0x0106('0x3a')]=qs['filters'](_['pick'](_0x42b4f7[_0x0106('0x33')],_0x5591e2[_0x0106('0x3b')]),_0x116e09);if(_0x42b4f7[_0x0106('0x33')][_0x0106('0x3c')]){_0x12ec3b[_0x0106('0x3a')]=_[_0x0106('0x3d')](_0x12ec3b[_0x0106('0x3a')],{'$or':_[_0x0106('0x32')](_0x116e09,function(_0x243b96){if(_0x243b96[_0x0106('0x3e')]!==_0x0106('0x3f')){var _0xdf7048={};_0xdf7048[_0x243b96['name']]={'$like':'%'+_0x42b4f7[_0x0106('0x33')][_0x0106('0x3c')]+'%'};return _0xdf7048;}})});}_0x12ec3b=_['merge']({},_0x12ec3b,_0x42b4f7[_0x0106('0x40')]);var _0xd943ce={'where':_0x12ec3b[_0x0106('0x3a')]};return db['ServicenowAccount'][_0x0106('0x20')](_0xd943ce)['then'](function(_0x2175c7){_0x27157c[_0x0106('0x20')]=_0x2175c7;if(_0x42b4f7['query'][_0x0106('0x41')]){_0x12ec3b[_0x0106('0x42')]=[{'all':!![]}];}return db[_0x0106('0x2d')]['findAll'](_0x12ec3b);})['then'](function(_0x14aa9f){_0x27157c[_0x0106('0x43')]=_0x14aa9f;return _0x27157c;})[_0x0106('0x27')](respondWithFilteredResult(_0x2fc687,_0x12ec3b))[_0x0106('0x44')](handleError(_0x2fc687,null));};exports[_0x0106('0x45')]=function(_0x15b7ba,_0x3f3d4d){var _0x288eeb={'raw':![],'where':{'id':_0x15b7ba['params']['id']}},_0x3a0392={};_0x3a0392['model']=_[_0x0106('0x34')](db[_0x0106('0x2d')][_0x0106('0x2e')]);_0x3a0392[_0x0106('0x33')]=_[_0x0106('0x34')](_0x15b7ba[_0x0106('0x33')]);_0x3a0392[_0x0106('0x3b')]=_['intersection'](_0x3a0392[_0x0106('0x31')],_0x3a0392[_0x0106('0x33')]);_0x288eeb[_0x0106('0x35')]=_[_0x0106('0x36')](_0x3a0392['model'],qs[_0x0106('0x37')](_0x15b7ba[_0x0106('0x33')][_0x0106('0x37')]));_0x288eeb[_0x0106('0x35')]=_0x288eeb[_0x0106('0x35')]['length']?_0x288eeb[_0x0106('0x35')]:_0x3a0392[_0x0106('0x31')];if(_0x15b7ba[_0x0106('0x33')][_0x0106('0x41')]){_0x288eeb[_0x0106('0x42')]=[{'all':!![]}];}_0x288eeb=_[_0x0106('0x3d')]({},_0x288eeb,_0x15b7ba[_0x0106('0x40')]);return db[_0x0106('0x2d')][_0x0106('0x46')](_0x288eeb)[_0x0106('0x27')](handleEntityNotFound(_0x3f3d4d,null))['then'](respondWithResult(_0x3f3d4d,null))[_0x0106('0x44')](handleError(_0x3f3d4d,null));};exports[_0x0106('0x47')]=function(_0x4969dd,_0x4ef01d){return db[_0x0106('0x2d')][_0x0106('0x47')](_0x4969dd['body'],{})['then'](respondWithResult(_0x4ef01d,0xc9))['catch'](handleError(_0x4ef01d,null));};exports[_0x0106('0x26')]=function(_0x5bf1b2,_0x27286e){if(_0x5bf1b2[_0x0106('0x48')]['id']){delete _0x5bf1b2[_0x0106('0x48')]['id'];}return db[_0x0106('0x2d')][_0x0106('0x46')]({'where':{'id':_0x5bf1b2[_0x0106('0x49')]['id']}})[_0x0106('0x27')](handleEntityNotFound(_0x27286e,null))[_0x0106('0x27')](saveUpdates(_0x5bf1b2[_0x0106('0x48')],null))['then'](respondWithResult(_0x27286e,null))[_0x0106('0x44')](handleError(_0x27286e,null));};exports['destroy']=function(_0x48987e,_0x509702){return db[_0x0106('0x2d')]['find']({'where':{'id':_0x48987e[_0x0106('0x49')]['id']}})[_0x0106('0x27')](handleEntityNotFound(_0x509702,null))['then'](removeEntity(_0x509702,null))[_0x0106('0x44')](handleError(_0x509702,null));};exports[_0x0106('0x4a')]=function(_0x19c434,_0x27b02,_0x282a95){var _0x21c82d={};var _0x59013f={};var _0x42387c;var _0x22687c;return db['ServicenowAccount'][_0x0106('0x4b')]({'where':{'id':_0x19c434[_0x0106('0x49')]['id']}})[_0x0106('0x27')](handleEntityNotFound(_0x27b02,null))[_0x0106('0x27')](function(_0x955fae){if(_0x955fae){_0x42387c=_0x955fae;_0x59013f[_0x0106('0x31')]=_[_0x0106('0x34')](db[_0x0106('0x4c')]['rawAttributes']);_0x59013f[_0x0106('0x33')]=_['keys'](_0x19c434[_0x0106('0x33')]);_0x59013f[_0x0106('0x3b')]=_[_0x0106('0x36')](_0x59013f[_0x0106('0x31')],_0x59013f['query']);_0x21c82d[_0x0106('0x35')]=_[_0x0106('0x36')](_0x59013f[_0x0106('0x31')],qs[_0x0106('0x37')](_0x19c434[_0x0106('0x33')][_0x0106('0x37')]));_0x21c82d[_0x0106('0x35')]=_0x21c82d[_0x0106('0x35')][_0x0106('0x4d')]?_0x21c82d[_0x0106('0x35')]:_0x59013f[_0x0106('0x31')];_0x21c82d[_0x0106('0x38')]=qs[_0x0106('0x39')](_0x19c434['query'][_0x0106('0x39')]);_0x21c82d[_0x0106('0x3a')]=qs[_0x0106('0x3b')](_[_0x0106('0x4e')](_0x19c434[_0x0106('0x33')],_0x59013f[_0x0106('0x3b')]));if(_0x19c434[_0x0106('0x33')][_0x0106('0x3c')]){_0x21c82d[_0x0106('0x3a')]=_[_0x0106('0x3d')](_0x21c82d[_0x0106('0x3a')],{'$or':_[_0x0106('0x32')](_0x21c82d[_0x0106('0x35')],function(_0x2ca5d8){var _0x2e2590={};_0x2e2590[_0x2ca5d8]={'$like':'%'+_0x19c434[_0x0106('0x33')][_0x0106('0x3c')]+'%'};return _0x2e2590;})});}_0x21c82d=_['merge']({},_0x21c82d,_0x19c434[_0x0106('0x40')]);return _0x42387c[_0x0106('0x4a')](_0x21c82d);}})[_0x0106('0x27')](function(_0x1ef0d4){if(_0x1ef0d4){_0x22687c=_0x1ef0d4['length'];if(!_0x19c434[_0x0106('0x33')][_0x0106('0x4f')](_0x0106('0x50'))){_0x21c82d[_0x0106('0x1f')]=qs[_0x0106('0x1f')](_0x19c434['query'][_0x0106('0x1f')]);_0x21c82d[_0x0106('0x1d')]=qs[_0x0106('0x1d')](_0x19c434[_0x0106('0x33')][_0x0106('0x1d')]);}return _0x42387c[_0x0106('0x4a')](_0x21c82d);}})[_0x0106('0x27')](function(_0x4bb908){if(_0x4bb908){return _0x4bb908?{'count':_0x22687c,'rows':_0x4bb908}:null;}})[_0x0106('0x27')](respondWithResult(_0x27b02,null))['catch'](handleError(_0x27b02,null));};exports[_0x0106('0x51')]=function(_0x5a39eb,_0x534f4a,_0x5f2506){if(_0x5a39eb['body']['id']){delete _0x5a39eb[_0x0106('0x48')]['id'];}return db[_0x0106('0x2d')][_0x0106('0x4b')]({'where':{'id':_0x5a39eb[_0x0106('0x49')]['id']}})[_0x0106('0x27')](handleEntityNotFound(_0x534f4a,null))[_0x0106('0x27')](function(_0x33c45e){if(_0x33c45e){_0x5a39eb[_0x0106('0x48')]['AccountId']=_0x33c45e['id'];_0x5a39eb[_0x0106('0x48')][_0x0106('0x52')]=integrations[_0x0106('0x53')](_0x5a39eb[_0x0106('0x48')][_0x0106('0x54')],_0x5a39eb['body']['type']);_0x5a39eb[_0x0106('0x48')][_0x0106('0x55')]=integrations[_0x0106('0x56')](_0x5a39eb['body']['channel'],_0x5a39eb[_0x0106('0x48')][_0x0106('0x3e')]);return db[_0x0106('0x4c')][_0x0106('0x47')](_0x5a39eb[_0x0106('0x48')],{'include':[{'model':db[_0x0106('0x57')],'as':_0x0106('0x52')},{'model':db[_0x0106('0x57')],'as':_0x0106('0x55')}]});}return null;})[_0x0106('0x27')](respondWithResult(_0x534f4a,null))['catch'](handleError(_0x534f4a,null));};exports[_0x0106('0x58')]=function(_0x1aa9c6,_0x48da13,_0x36b6d9){var _0x5ef6cd=[_0x0106('0x59'),_0x0106('0x5a'),_0x0106('0x5b'),_0x0106('0x5c'),_0x0106('0x5d'),_0x0106('0x5e'),_0x0106('0x5f'),_0x0106('0x60'),_0x0106('0x61')];var _0x3bdd02=[_0x0106('0x62'),_0x0106('0x59'),'caused_by','watch_list',_0x0106('0x63'),_0x0106('0x64'),_0x0106('0x65'),'hold_reason',_0x0106('0x66'),_0x0106('0x67'),_0x0106('0x68'),'sys_updated_by',_0x0106('0x69'),_0x0106('0x6a'),_0x0106('0x6b'),_0x0106('0x6c'),_0x0106('0x6d'),_0x0106('0x6e'),'knowledge',_0x0106('0x38'),_0x0106('0x6f'),_0x0106('0x70'),_0x0106('0x71'),_0x0106('0x72'),_0x0106('0x73'),_0x0106('0x74'),'work_notes_list',_0x0106('0x75'),_0x0106('0x76'),_0x0106('0x77'),_0x0106('0x78'),_0x0106('0x79'),_0x0106('0x7a'),_0x0106('0x7b'),_0x0106('0x7c'),_0x0106('0x7d'),'work_end',_0x0106('0x7e'),_0x0106('0x7f'),_0x0106('0x80'),_0x0106('0x81'),'subcategory',_0x0106('0x82'),_0x0106('0x83'),'close_code','correlation_display','delivery_task','work_start',_0x0106('0x84'),_0x0106('0x85'),'additional_assignee_list',_0x0106('0x86'),_0x0106('0x87'),_0x0106('0x5e'),_0x0106('0x88'),_0x0106('0x89'),_0x0106('0x8a'),'follow_up',_0x0106('0x8b'),_0x0106('0x8c'),'contact_type',_0x0106('0x8d'),_0x0106('0x5f'),_0x0106('0x8e'),_0x0106('0x8f'),'company','reassignment_count',_0x0106('0x90'),_0x0106('0x91'),_0x0106('0x60'),_0x0106('0x92'),_0x0106('0x93'),_0x0106('0x94'),_0x0106('0x95'),_0x0106('0x96'),_0x0106('0x97'),_0x0106('0x98'),_0x0106('0x99'),_0x0106('0x9a'),'upon_approval',_0x0106('0x9b'),_0x0106('0x9c'),_0x0106('0x61')];var _0x5b59be='';var _0x1662a6='';var _0x310fe3=[];var _0x34c177='';var _0x139087='';var _0x2e3f12=[];var _0x31f511='';var _0xca8c42='';var _0x543dc3={};var _0x1ad690='';return db[_0x0106('0x2d')][_0x0106('0x4b')]({'where':{'id':_0x1aa9c6[_0x0106('0x49')]['id']},'attributes':['id','username',_0x0106('0x9d'),_0x0106('0x9e'),_0x0106('0x9f'),_0x0106('0xa0')]})[_0x0106('0x27')](handleEntityNotFound(_0x48da13,null))[_0x0106('0x27')](function(_0xe3a7e9){if(_0xe3a7e9){_0x1ad690=_0xe3a7e9[_0x0106('0x9f')];var _0x460688=_0x1ad690[_0x0106('0xa1')](-0x1);if(_0x460688==='/'){_0x1ad690=_0x1ad690[_0x0106('0xa2')](0x0,_0x1ad690['lastIndexOf'](_0x460688));}_0xca8c42=util[_0x0106('0xa3')](_0x0106('0xa4'),_0x1ad690);_0x31f511=util[_0x0106('0xa3')](_0x0106('0xa5'),_0x1ad690);_0x543dc3={'user':_0xe3a7e9[_0x0106('0xa6')],'pass':_0xe3a7e9[_0x0106('0x9d')]};var _0x186560={'method':_0x0106('0xa7'),'uri':_0xca8c42+'incident?sysparm_display_value=all','auth':_0x543dc3,'json':!![]};return rp(_0x186560);}})['then'](function(_0x16a55){if(_0x16a55[_0x0106('0xa8')][_0x0106('0x4d')]>0x0){_0x5b59be=_0x16a55['result'];}console[_0x0106('0xa9')](_0x0106('0xaa'),_0x5b59be);_0x2e3f12=[];_0x1662a6=Object[_0x0106('0xab')]([],_0x5b59be);_[_0x0106('0xac')](_0x1662a6,function(_0x6d0fda){return!_0x5ef6cd[_0x0106('0xad')](_0x6d0fda[_0x0106('0x2a')]);});_0x1662a6['forEach'](function(_0x302c13){var _0x1fcc34=createFieldObject(_0x31f511,_0x543dc3,_0x302c13['internalType'],_0x302c13['name'],_0x302c13[_0x0106('0xae')],![]);_0x2e3f12['push'](_0x1fcc34);});return Promise['all'](_0x2e3f12);})[_0x0106('0x27')](function(_0xf17a92){_0x310fe3=_0xf17a92;_0x34c177=Object[_0x0106('0xab')]([],_0x5b59be);console['log'](_0x0106('0xaf'),_0x5b59be);_[_0x0106('0xac')](_0x34c177,function(_0x342eb7){return _0x3bdd02[_0x0106('0xad')](_0x342eb7[_0x0106('0x2a')]);});console['log'](_0x0106('0xb0'),_0x34c177);_0x2e3f12=[];_0x34c177[_0x0106('0xb1')](function(_0x35a7b1){var _0x29f8e4=createFieldObject(_0x31f511,_0x543dc3,_0x35a7b1[_0x0106('0xb2')],_0x35a7b1[_0x0106('0x2a')],_0x35a7b1[_0x0106('0xae')],!![]);_0x2e3f12[_0x0106('0xb3')](_0x29f8e4);});return Promise[_0x0106('0xb4')](_0x2e3f12);})['then'](function(_0x1c7813){_0x139087=_0x1c7813;var _0xc119a7=_0x310fe3['concat'](_0x139087);return{'count':_0xc119a7['length'],'rows':_0xc119a7};})['then'](respondWithResult(_0x48da13,null))[_0x0106('0x44')](function(_0x215eb4){console[_0x0106('0xa9')]('ServiceNow\x20error:\x20'+_0x215eb4);var _0x526379=_0x1aa9c6[_0x0106('0x33')][_0x0106('0xb5')]?0x1f4:_0x215eb4[_0x0106('0xb6')]||0x1f4;logger['error'](_0x215eb4[_0x0106('0x29')]);delete _0x215eb4[_0x0106('0x2a')];if(_0x526379===0x191){_0x526379=0x190;}_0x48da13[_0x0106('0x1c')](_0x526379)[_0x0106('0x2b')](_0x1aa9c6[_0x0106('0x33')]['test']?{'message':_0x0106('0xb7'),'statusCode':_0x215eb4[_0x0106('0xb6')]}:_0x215eb4);});};function createFieldObject(_0x5133d7,_0x1e326f,_0x322d2c,_0x376ea6,_0x212951,_0x2af82f){return new Promise(function(_0x5b5b17,_0x282998){var _0x4553b6={'id':_0x376ea6,'name':_0x212951,'custom':_0x2af82f};if(_0x322d2c===_0x0106('0xb8')){_0x4553b6[_0x0106('0x40')]=[{'name':_0x0106('0xb9'),'value':_0x0106('0xba')},{'name':_0x0106('0xbb'),'value':_0x0106('0xbc')}];_0x5b5b17(_0x4553b6);}else{var _0x363fee={'method':'GET','uri':_0x5133d7+_0x0106('0xbd')+_0x376ea6,'auth':_0x1e326f,'json':!![]};return rp(_0x363fee)[_0x0106('0x27')](function(_0xe40b20){var _0x51db32=[];if(_0xe40b20[_0x0106('0xa8')]['length']>0x0){_0xe40b20[_0x0106('0xa8')]['forEach'](function(_0x57c613){if(_0x57c613['inactive']==='false'){var _0x40b706={'name':_0x57c613[_0x0106('0xae')],'value':_0x57c613['value']};_0x51db32[_0x0106('0xb3')](_0x40b706);}});}_0x4553b6['options']=_0x51db32;if(_0x4553b6[_0x0106('0x40')][_0x0106('0x4d')]>0x0){_0x5b5b17(_0x4553b6);}else{if(_0x2af82f==![]){_0x5b5b17();}else{_0x5b5b17(_0x4553b6);}}});}});} \ No newline at end of file +var _0xbd5a=['slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','assign','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','send','Wrong\x20credentials','True','true','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','ServicenowField','getFields','hold_reason','knowledge','notify','incident_state','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','user_input','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','sys_domain_path','rfc','time_worked','opened_at','work_end','caller_id','approval_set','subcategory','work_notes','short_description','close_code','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','close_notes','closed_by','sys_id','contact_type','problem_id','company','activity_due','assigned_to','severity','comments','sla_due','approval','sys_mod_count','reopen_count','upon_approval','correlation_id','location','username','password','email','serverUrl','remoteUri'];(function(_0x33e48a,_0x33be28){var _0x219368=function(_0x4c9eb5){while(--_0x4c9eb5){_0x33e48a['push'](_0x33e48a['shift']());}};_0x219368(++_0x33be28);}(_0xbd5a,0x184));var _0xabd5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbd5a[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xabd5('0x0'));var rimraf=require(_0xabd5('0x1'));var zipdir=require(_0xabd5('0x2'));var jsonpatch=require(_0xabd5('0x3'));var rp=require(_0xabd5('0x4'));var moment=require(_0xabd5('0x5'));var BPromise=require(_0xabd5('0x6'));var Mustache=require('mustache');var util=require(_0xabd5('0x7'));var path=require('path');var sox=require(_0xabd5('0x8'));var csv=require(_0xabd5('0x9'));var ejs=require(_0xabd5('0xa'));var fs=require('fs');var fs_extra=require(_0xabd5('0xb'));var _=require('lodash');var squel=require(_0xabd5('0xc'));var crypto=require('crypto');var jsforce=require(_0xabd5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xabd5('0x9'));var querystring=require(_0xabd5('0xe'));var Papa=require(_0xabd5('0xf'));var Redis=require('ioredis');var authService=require(_0xabd5('0x10'));var qs=require(_0xabd5('0x11'));var as=require(_0xabd5('0x12'));var hardwareService=require(_0xabd5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xabd5('0x14'));var config=require(_0xabd5('0x15'));var licenseUtil=require(_0xabd5('0x16'));var db=require(_0xabd5('0x17'))['db'];var integrations=require(_0xabd5('0x18'));function respondWithStatusCode(_0x20ac24,_0x484e67){_0x484e67=_0x484e67||0xcc;return function(_0x46e5b5){if(_0x46e5b5){return _0x20ac24['sendStatus'](_0x484e67);}return _0x20ac24[_0xabd5('0x19')](_0x484e67)[_0xabd5('0x1a')]();};}function respondWithResult(_0x5e017b,_0x2de776){_0x2de776=_0x2de776||0xc8;return function(_0x3a358d){if(_0x3a358d){return _0x5e017b[_0xabd5('0x19')](_0x2de776)['json'](_0x3a358d);}};}function respondWithFilteredResult(_0x2a970e,_0x2e6269){return function(_0x56dd59){if(_0x56dd59){var _0x252b0b=typeof _0x2e6269['offset']==='undefined'&&typeof _0x2e6269[_0xabd5('0x1b')]===_0xabd5('0x1c');var _0x5856b4=_0x56dd59[_0xabd5('0x1d')];var _0x393db3=_0x252b0b?0x0:_0x2e6269[_0xabd5('0x1e')];var _0x3d6364=_0x252b0b?_0x56dd59[_0xabd5('0x1d')]:_0x2e6269[_0xabd5('0x1e')]+_0x2e6269[_0xabd5('0x1b')];var _0x4c09aa;if(_0x3d6364>=_0x5856b4){_0x3d6364=_0x5856b4;_0x4c09aa=0xc8;}else{_0x4c09aa=0xce;}_0x2a970e[_0xabd5('0x19')](_0x4c09aa);return _0x2a970e[_0xabd5('0x1f')](_0xabd5('0x20'),_0x393db3+'-'+_0x3d6364+'/'+_0x5856b4)[_0xabd5('0x21')](_0x56dd59);}return null;};}function patchUpdates(_0x500c75){return function(_0x468b80){try{jsonpatch[_0xabd5('0x22')](_0x468b80,_0x500c75,!![]);}catch(_0x3405ee){return BPromise[_0xabd5('0x23')](_0x3405ee);}return _0x468b80[_0xabd5('0x24')]();};}function saveUpdates(_0x5e7b6d,_0x43542a){return function(_0xac372c){if(_0xac372c){return _0xac372c[_0xabd5('0x25')](_0x5e7b6d)[_0xabd5('0x26')](function(_0x5ed10c){return _0x5ed10c;});}return null;};}function removeEntity(_0x476be6,_0xfea417){return function(_0x55e93e){if(_0x55e93e){return _0x55e93e[_0xabd5('0x27')]()[_0xabd5('0x26')](function(){_0x476be6['status'](0xcc)[_0xabd5('0x1a')]();});}};}function handleEntityNotFound(_0x44fec7,_0x91916){return function(_0x2b54d2){if(!_0x2b54d2){_0x44fec7[_0xabd5('0x28')](0x194);}return _0x2b54d2;};}function handleError(_0x557470,_0x1f7d31){_0x1f7d31=_0x1f7d31||0x1f4;return function(_0x32255f){logger['error'](_0x32255f[_0xabd5('0x29')]);if(_0x32255f[_0xabd5('0x2a')]){delete _0x32255f[_0xabd5('0x2a')];}_0x557470[_0xabd5('0x19')](_0x1f7d31)['send'](_0x32255f);};}exports[_0xabd5('0x2b')]=function(_0x4bc766,_0x3951ec){var _0x26e4e4={},_0x44afcc={},_0x4e0c52={'count':0x0,'rows':[]};var _0x1514d8=_[_0xabd5('0x2c')](db['ServicenowAccount'][_0xabd5('0x2d')],function(_0x1655ea){return{'name':_0x1655ea['fieldName'],'type':_0x1655ea[_0xabd5('0x2e')][_0xabd5('0x2f')]};});_0x44afcc[_0xabd5('0x30')]=_[_0xabd5('0x2c')](_0x1514d8,'name');_0x44afcc[_0xabd5('0x31')]=_[_0xabd5('0x32')](_0x4bc766['query']);_0x44afcc[_0xabd5('0x33')]=_[_0xabd5('0x34')](_0x44afcc['model'],_0x44afcc['query']);_0x26e4e4[_0xabd5('0x35')]=_[_0xabd5('0x34')](_0x44afcc['model'],qs[_0xabd5('0x36')](_0x4bc766[_0xabd5('0x31')][_0xabd5('0x36')]));_0x26e4e4[_0xabd5('0x35')]=_0x26e4e4[_0xabd5('0x35')][_0xabd5('0x37')]?_0x26e4e4[_0xabd5('0x35')]:_0x44afcc['model'];if(!_0x4bc766[_0xabd5('0x31')][_0xabd5('0x38')](_0xabd5('0x39'))){_0x26e4e4[_0xabd5('0x1b')]=qs[_0xabd5('0x1b')](_0x4bc766[_0xabd5('0x31')][_0xabd5('0x1b')]);_0x26e4e4[_0xabd5('0x1e')]=qs[_0xabd5('0x1e')](_0x4bc766[_0xabd5('0x31')]['offset']);}_0x26e4e4[_0xabd5('0x3a')]=qs[_0xabd5('0x3b')](_0x4bc766[_0xabd5('0x31')][_0xabd5('0x3b')]);_0x26e4e4['where']=qs[_0xabd5('0x33')](_['pick'](_0x4bc766[_0xabd5('0x31')],_0x44afcc[_0xabd5('0x33')]),_0x1514d8);if(_0x4bc766[_0xabd5('0x31')][_0xabd5('0x3c')]){_0x26e4e4[_0xabd5('0x3d')]=_[_0xabd5('0x3e')](_0x26e4e4['where'],{'$or':_[_0xabd5('0x2c')](_0x1514d8,function(_0x190a98){if(_0x190a98['type']!==_0xabd5('0x3f')){var _0x324c2d={};_0x324c2d[_0x190a98[_0xabd5('0x2a')]]={'$like':'%'+_0x4bc766[_0xabd5('0x31')][_0xabd5('0x3c')]+'%'};return _0x324c2d;}})});}_0x26e4e4=_[_0xabd5('0x3e')]({},_0x26e4e4,_0x4bc766[_0xabd5('0x40')]);var _0x4d6dde={'where':_0x26e4e4[_0xabd5('0x3d')]};return db[_0xabd5('0x41')]['count'](_0x4d6dde)[_0xabd5('0x26')](function(_0x9ad16c){_0x4e0c52['count']=_0x9ad16c;if(_0x4bc766[_0xabd5('0x31')][_0xabd5('0x42')]){_0x26e4e4[_0xabd5('0x43')]=[{'all':!![]}];}return db[_0xabd5('0x41')]['findAll'](_0x26e4e4);})['then'](function(_0x3e3f5d){_0x4e0c52[_0xabd5('0x44')]=_0x3e3f5d;return _0x4e0c52;})[_0xabd5('0x26')](respondWithFilteredResult(_0x3951ec,_0x26e4e4))[_0xabd5('0x45')](handleError(_0x3951ec,null));};exports[_0xabd5('0x46')]=function(_0x3fafb6,_0x2d9098){var _0x6b40cb={'raw':![],'where':{'id':_0x3fafb6[_0xabd5('0x47')]['id']}},_0x2dc541={};_0x2dc541[_0xabd5('0x30')]=_[_0xabd5('0x32')](db['ServicenowAccount'][_0xabd5('0x2d')]);_0x2dc541[_0xabd5('0x31')]=_['keys'](_0x3fafb6[_0xabd5('0x31')]);_0x2dc541[_0xabd5('0x33')]=_['intersection'](_0x2dc541[_0xabd5('0x30')],_0x2dc541['query']);_0x6b40cb[_0xabd5('0x35')]=_[_0xabd5('0x34')](_0x2dc541[_0xabd5('0x30')],qs[_0xabd5('0x36')](_0x3fafb6[_0xabd5('0x31')]['fields']));_0x6b40cb[_0xabd5('0x35')]=_0x6b40cb[_0xabd5('0x35')][_0xabd5('0x37')]?_0x6b40cb[_0xabd5('0x35')]:_0x2dc541['model'];if(_0x3fafb6[_0xabd5('0x31')][_0xabd5('0x42')]){_0x6b40cb[_0xabd5('0x43')]=[{'all':!![]}];}_0x6b40cb=_[_0xabd5('0x3e')]({},_0x6b40cb,_0x3fafb6[_0xabd5('0x40')]);return db[_0xabd5('0x41')]['find'](_0x6b40cb)[_0xabd5('0x26')](handleEntityNotFound(_0x2d9098,null))[_0xabd5('0x26')](respondWithResult(_0x2d9098,null))['catch'](handleError(_0x2d9098,null));};exports[_0xabd5('0x48')]=function(_0x184ea8,_0x3878a8){return db[_0xabd5('0x41')][_0xabd5('0x48')](_0x184ea8[_0xabd5('0x49')],{})[_0xabd5('0x26')](respondWithResult(_0x3878a8,0xc9))[_0xabd5('0x45')](handleError(_0x3878a8,null));};exports[_0xabd5('0x25')]=function(_0x297692,_0x3bf001){if(_0x297692[_0xabd5('0x49')]['id']){delete _0x297692[_0xabd5('0x49')]['id'];}return db[_0xabd5('0x41')]['find']({'where':{'id':_0x297692[_0xabd5('0x47')]['id']}})[_0xabd5('0x26')](handleEntityNotFound(_0x3bf001,null))[_0xabd5('0x26')](saveUpdates(_0x297692[_0xabd5('0x49')],null))['then'](respondWithResult(_0x3bf001,null))['catch'](handleError(_0x3bf001,null));};exports[_0xabd5('0x27')]=function(_0x3a3258,_0x4538db){return db[_0xabd5('0x41')][_0xabd5('0x4a')]({'where':{'id':_0x3a3258['params']['id']}})[_0xabd5('0x26')](handleEntityNotFound(_0x4538db,null))[_0xabd5('0x26')](removeEntity(_0x4538db,null))[_0xabd5('0x45')](handleError(_0x4538db,null));};exports[_0xabd5('0x4b')]=function(_0x4d109b,_0x479bd6,_0x1e3eb0){var _0x3e966a={};var _0x23c65d={};var _0x36268b;var _0x45ec2b;return db[_0xabd5('0x41')]['findOne']({'where':{'id':_0x4d109b['params']['id']}})[_0xabd5('0x26')](handleEntityNotFound(_0x479bd6,null))[_0xabd5('0x26')](function(_0x244e58){if(_0x244e58){_0x36268b=_0x244e58;_0x23c65d[_0xabd5('0x30')]=_[_0xabd5('0x32')](db[_0xabd5('0x4c')]['rawAttributes']);_0x23c65d[_0xabd5('0x31')]=_[_0xabd5('0x32')](_0x4d109b[_0xabd5('0x31')]);_0x23c65d[_0xabd5('0x33')]=_[_0xabd5('0x34')](_0x23c65d[_0xabd5('0x30')],_0x23c65d['query']);_0x3e966a[_0xabd5('0x35')]=_[_0xabd5('0x34')](_0x23c65d['model'],qs[_0xabd5('0x36')](_0x4d109b[_0xabd5('0x31')][_0xabd5('0x36')]));_0x3e966a['attributes']=_0x3e966a[_0xabd5('0x35')][_0xabd5('0x37')]?_0x3e966a['attributes']:_0x23c65d['model'];_0x3e966a[_0xabd5('0x3a')]=qs[_0xabd5('0x3b')](_0x4d109b[_0xabd5('0x31')][_0xabd5('0x3b')]);_0x3e966a['where']=qs[_0xabd5('0x33')](_['pick'](_0x4d109b['query'],_0x23c65d[_0xabd5('0x33')]));if(_0x4d109b[_0xabd5('0x31')][_0xabd5('0x3c')]){_0x3e966a[_0xabd5('0x3d')]=_[_0xabd5('0x3e')](_0x3e966a[_0xabd5('0x3d')],{'$or':_[_0xabd5('0x2c')](_0x3e966a[_0xabd5('0x35')],function(_0x2bdba2){var _0x38b8be={};_0x38b8be[_0x2bdba2]={'$like':'%'+_0x4d109b[_0xabd5('0x31')][_0xabd5('0x3c')]+'%'};return _0x38b8be;})});}_0x3e966a=_[_0xabd5('0x3e')]({},_0x3e966a,_0x4d109b['options']);return _0x36268b['getConfigurations'](_0x3e966a);}})['then'](function(_0x200ad7){if(_0x200ad7){_0x45ec2b=_0x200ad7['length'];if(!_0x4d109b[_0xabd5('0x31')][_0xabd5('0x38')](_0xabd5('0x39'))){_0x3e966a['limit']=qs['limit'](_0x4d109b[_0xabd5('0x31')][_0xabd5('0x1b')]);_0x3e966a[_0xabd5('0x1e')]=qs['offset'](_0x4d109b[_0xabd5('0x31')]['offset']);}return _0x36268b[_0xabd5('0x4b')](_0x3e966a);}})['then'](function(_0x5e14c0){if(_0x5e14c0){return _0x5e14c0?{'count':_0x45ec2b,'rows':_0x5e14c0}:null;}})['then'](respondWithResult(_0x479bd6,null))[_0xabd5('0x45')](handleError(_0x479bd6,null));};exports[_0xabd5('0x4d')]=function(_0x1ea4af,_0x577d1e,_0x36a253){if(_0x1ea4af[_0xabd5('0x49')]['id']){delete _0x1ea4af[_0xabd5('0x49')]['id'];}return db[_0xabd5('0x41')][_0xabd5('0x4e')]({'where':{'id':_0x1ea4af[_0xabd5('0x47')]['id']}})[_0xabd5('0x26')](handleEntityNotFound(_0x577d1e,null))['then'](function(_0xee5b25){if(_0xee5b25){_0x1ea4af['body'][_0xabd5('0x4f')]=_0xee5b25['id'];_0x1ea4af[_0xabd5('0x49')]['Subjects']=integrations[_0xabd5('0x50')](_0x1ea4af['body']['channel'],_0x1ea4af[_0xabd5('0x49')][_0xabd5('0x2e')]);_0x1ea4af[_0xabd5('0x49')][_0xabd5('0x51')]=integrations[_0xabd5('0x52')](_0x1ea4af[_0xabd5('0x49')][_0xabd5('0x53')],_0x1ea4af[_0xabd5('0x49')][_0xabd5('0x2e')]);return db[_0xabd5('0x4c')][_0xabd5('0x48')](_0x1ea4af[_0xabd5('0x49')],{'include':[{'model':db['ServicenowField'],'as':_0xabd5('0x54')},{'model':db[_0xabd5('0x55')],'as':_0xabd5('0x51')}]});}return null;})[_0xabd5('0x26')](respondWithResult(_0x577d1e,null))[_0xabd5('0x45')](handleError(_0x577d1e,null));};exports[_0xabd5('0x56')]=function(_0x282b25,_0x3d8fb9,_0x49d0f6){var _0x3a7dad=['made_sla',_0xabd5('0x57'),_0xabd5('0x58'),'subcategory','close_code',_0xabd5('0x59'),_0xabd5('0x5a'),'severity','category'];var _0x2dccf0=['parent',_0xabd5('0x5b'),_0xabd5('0x5c'),_0xabd5('0x5d'),'upon_reject',_0xabd5('0x5e'),_0xabd5('0x5f'),_0xabd5('0x57'),_0xabd5('0x60'),'number',_0xabd5('0x61'),_0xabd5('0x62'),'opened_by',_0xabd5('0x63'),'sys_created_on','sys_domain','state',_0xabd5('0x64'),_0xabd5('0x58'),_0xabd5('0x3a'),_0xabd5('0x65'),_0xabd5('0x66'),_0xabd5('0x67'),_0xabd5('0x68'),_0xabd5('0x69'),'active',_0xabd5('0x6a'),'business_service','priority',_0xabd5('0x6b'),_0xabd5('0x6c'),_0xabd5('0x6d'),'expected_start',_0xabd5('0x6e'),'business_duration','group_list',_0xabd5('0x6f'),'reopened_time','resolved_at',_0xabd5('0x70'),_0xabd5('0x71'),_0xabd5('0x72'),_0xabd5('0x73'),_0xabd5('0x74'),_0xabd5('0x75'),_0xabd5('0x76'),_0xabd5('0x77'),'work_start',_0xabd5('0x78'),_0xabd5('0x79'),_0xabd5('0x7a'),_0xabd5('0x7b'),'calendar_duration','notify','sys_class_name',_0xabd5('0x7c'),_0xabd5('0x7d'),'follow_up','parent_incident',_0xabd5('0x7e'),_0xabd5('0x7f'),'reopened_by','incident_state','urgency',_0xabd5('0x80'),_0xabd5('0x81'),'reassignment_count',_0xabd5('0x82'),_0xabd5('0x83'),_0xabd5('0x84'),_0xabd5('0x85'),_0xabd5('0x86'),_0xabd5('0x87'),'comments_and_work_notes','due_date',_0xabd5('0x88'),_0xabd5('0x89'),'sys_tags','escalation',_0xabd5('0x8a'),_0xabd5('0x8b'),_0xabd5('0x8c'),'category'];var _0x214c2d='';var _0x40435c='';var _0x3f33de=[];var _0x49169e='';var _0x4b2b70='';var _0x4222f2=[];var _0x4b4486='';var _0x2e08f4='';var _0x10e493={};var _0x13e359='';return db[_0xabd5('0x41')][_0xabd5('0x4e')]({'where':{'id':_0x282b25['params']['id']},'attributes':['id',_0xabd5('0x8d'),_0xabd5('0x8e'),_0xabd5('0x8f'),'remoteUri',_0xabd5('0x90')]})[_0xabd5('0x26')](handleEntityNotFound(_0x3d8fb9,null))['then'](function(_0x4aea78){if(_0x4aea78){_0x13e359=_0x4aea78[_0xabd5('0x91')];var _0x31d3ae=_0x13e359[_0xabd5('0x92')](-0x1);if(_0x31d3ae==='/'){_0x13e359=_0x13e359[_0xabd5('0x93')](0x0,_0x13e359[_0xabd5('0x94')](_0x31d3ae));}_0x2e08f4=util[_0xabd5('0x95')](_0xabd5('0x96'),_0x13e359);_0x4b4486=util[_0xabd5('0x95')](_0xabd5('0x97'),_0x13e359);_0x10e493={'user':_0x4aea78['username'],'pass':_0x4aea78[_0xabd5('0x8e')]};var _0x2e2816={'method':_0xabd5('0x98'),'uri':_0x2e08f4+'incident?sysparm_display_value=all','auth':_0x10e493,'json':!![]};return rp(_0x2e2816);}})['then'](function(_0x12e914){if(_0x12e914['result']['length']>0x0){_0x214c2d=_0x12e914[_0xabd5('0x99')];}console[_0xabd5('0x9a')](_0xabd5('0x9b'),_0x214c2d);_0x4222f2=[];_0x40435c=Object['assign']([],_0x214c2d);_[_0xabd5('0x9c')](_0x40435c,function(_0x37c4f3){return!_0x3a7dad['includes'](_0x37c4f3[_0xabd5('0x2a')]);});_0x40435c[_0xabd5('0x9d')](function(_0x40402d){var _0x4207d3=createFieldObject(_0x4b4486,_0x10e493,_0x40402d[_0xabd5('0x9e')],_0x40402d[_0xabd5('0x2a')],_0x40402d[_0xabd5('0x9f')],![]);_0x4222f2['push'](_0x4207d3);});return Promise['all'](_0x4222f2);})['then'](function(_0x25c3ae){_0x3f33de=_0x25c3ae;_0x49169e=Object[_0xabd5('0xa0')]([],_0x214c2d);console[_0xabd5('0x9a')](_0xabd5('0xa1'),_0x214c2d);_['remove'](_0x49169e,function(_0x6958ac){return _0x2dccf0[_0xabd5('0xa2')](_0x6958ac[_0xabd5('0x2a')]);});console['log'](_0xabd5('0xa3'),_0x49169e);_0x4222f2=[];_0x49169e[_0xabd5('0x9d')](function(_0x29f73c){var _0x1e87e9=createFieldObject(_0x4b4486,_0x10e493,_0x29f73c[_0xabd5('0x9e')],_0x29f73c[_0xabd5('0x2a')],_0x29f73c[_0xabd5('0x9f')],!![]);_0x4222f2[_0xabd5('0xa4')](_0x1e87e9);});return Promise[_0xabd5('0xa5')](_0x4222f2);})[_0xabd5('0x26')](function(_0x28a5b7){_0x4b2b70=_0x28a5b7;var _0xe20419=_0x3f33de[_0xabd5('0xa6')](_0x4b2b70);return{'count':_0xe20419[_0xabd5('0x37')],'rows':_0xe20419};})[_0xabd5('0x26')](respondWithResult(_0x3d8fb9,null))[_0xabd5('0x45')](function(_0x1920fb){console[_0xabd5('0x9a')](_0xabd5('0xa7')+_0x1920fb);var _0x77d940=_0x282b25['query'][_0xabd5('0xa8')]?0x1f4:_0x1920fb[_0xabd5('0xa9')]||0x1f4;logger[_0xabd5('0xaa')](_0x1920fb[_0xabd5('0x29')]);delete _0x1920fb[_0xabd5('0x2a')];if(_0x77d940===0x191){_0x77d940=0x190;}_0x3d8fb9[_0xabd5('0x19')](_0x77d940)[_0xabd5('0xab')](_0x282b25[_0xabd5('0x31')][_0xabd5('0xa8')]?{'message':_0xabd5('0xac'),'statusCode':_0x1920fb[_0xabd5('0xa9')]}:_0x1920fb);});};function createFieldObject(_0x4923bf,_0x287789,_0x5a84e6,_0x9ec3d7,_0x1c192b,_0x4f4c93){return new Promise(function(_0x58e106,_0xd91f2e){var _0x59f69f={'id':_0x9ec3d7,'name':_0x1c192b,'custom':_0x4f4c93};if(_0x5a84e6==='boolean'){_0x59f69f['options']=[{'name':_0xabd5('0xad'),'value':_0xabd5('0xae')},{'name':'False','value':_0xabd5('0xaf')}];_0x58e106(_0x59f69f);}else{var _0x43479a={'method':'GET','uri':_0x4923bf+_0xabd5('0xb0')+_0x9ec3d7,'auth':_0x287789,'json':!![]};return rp(_0x43479a)[_0xabd5('0x26')](function(_0x48b8fa){var _0x5347a7=[];if(_0x48b8fa[_0xabd5('0x99')][_0xabd5('0x37')]>0x0){_0x48b8fa[_0xabd5('0x99')][_0xabd5('0x9d')](function(_0x4dddc8){if(_0x4dddc8['inactive']===_0xabd5('0xaf')){var _0xa5949c={'name':_0x4dddc8['label'],'value':_0x4dddc8[_0xabd5('0xb1')]};_0x5347a7[_0xabd5('0xa4')](_0xa5949c);}});}_0x59f69f[_0xabd5('0x40')]=_0x5347a7;if(_0x59f69f[_0xabd5('0x40')][_0xabd5('0x37')]>0x0){_0x58e106(_0x59f69f);}else{if(_0x4f4c93==![]){_0x58e106();}else{_0x58e106(_0x59f69f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 936f4cf..694089f 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x449fbe,_0x235353){var _0x1536fa=function(_0xe6ef9b){while(--_0xe6ef9b){_0x449fbe['push'](_0x449fbe['shift']());}};_0x1536fa(++_0x235353);}(_0x8958,0x93));var _0x8895=function(_0x1a6145,_0x1e18e2){_0x1a6145=_0x1a6145-0x0;var _0x5c6bca=_0x8958[_0x1a6145];return _0x5c6bca;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3376ff,_0x3686f7){var _0x258579=function(_0x39f93f){while(--_0x39f93f){_0x3376ff['push'](_0x3376ff['shift']());}};_0x258579(++_0x3686f7);}(_0x31f0,0xb7));var _0x031f=function(_0xde6bc2,_0x294867){_0xde6bc2=_0xde6bc2-0x0;var _0x262e90=_0x31f0[_0xde6bc2];return _0x262e90;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x56328c,_0x3dc98e){return _0x56328c['define'](_0x031f('0x8'),attributes,{'tableName':_0x031f('0x9'),'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 96f5301..6963bf3 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 _0xb1c6=['ShowServicenowAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','options','where','limit','include','map','attributes','model','ServicenowAccount','raw'];(function(_0x406b98,_0x3dea6d){var _0x10545f=function(_0xecba84){while(--_0xecba84){_0x406b98['push'](_0x406b98['shift']());}};_0x10545f(++_0x3dea6d);}(_0xb1c6,0x14b));var _0x6b1c=function(_0x334524,_0x1fca82){_0x334524=_0x334524-0x0;var _0x870ae9=_0xb1c6[_0x334524];return _0x870ae9;};'use strict';var _=require(_0x6b1c('0x0'));var util=require(_0x6b1c('0x1'));var moment=require(_0x6b1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b1c('0x3'));var db=require(_0x6b1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b1c('0x5'))(_0x6b1c('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b1c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bfb46,_0x331a8b,_0x15de89){return new BPromise(function(_0x25097a,_0x5d5583){return client['request'](_0x1bfb46,_0x15de89)[_0x6b1c('0x8')](function(_0x9b271e){logger[_0x6b1c('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x331a8b,_0x6b1c('0xa'));logger[_0x6b1c('0xb')](_0x6b1c('0xc'),_0x331a8b,_0x6b1c('0xa'),JSON[_0x6b1c('0xd')](_0x9b271e));if(_0x9b271e[_0x6b1c('0xe')]){if(_0x9b271e['error'][_0x6b1c('0xf')]===0x1f4){logger[_0x6b1c('0xe')](_0x6b1c('0x10'),_0x331a8b,_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);return _0x5d5583(_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x331a8b,_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);return _0x25097a(_0x9b271e[_0x6b1c('0xe')][_0x6b1c('0x11')]);}else{logger[_0x6b1c('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x331a8b,_0x6b1c('0xa'));_0x25097a(_0x9b271e['result'][_0x6b1c('0x11')]);}})[_0x6b1c('0x12')](function(_0xfcad06){logger[_0x6b1c('0xe')](_0x6b1c('0x10'),_0x331a8b,_0xfcad06);_0x5d5583(_0xfcad06);});});}exports[_0x6b1c('0x13')]=function(_0x5b5651){var _0x1136a3=this;return new Promise(function(_0x47c149,_0x614cba){return db['ServicenowAccount']['findAll']({'raw':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x15')]||null:null,'attributes':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')]['attributes']||null:null,'limit':_0x5b5651['options']?_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x16')]||null:null,'include':_0x5b5651[_0x6b1c('0x14')]?_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x5b5651[_0x6b1c('0x14')][_0x6b1c('0x17')],function(_0x2fb4e0){return{'model':db[_0x2fb4e0['model']],'as':_0x2fb4e0['as'],'attributes':_0x2fb4e0[_0x6b1c('0x19')],'include':_0x2fb4e0[_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x2fb4e0['include'],function(_0x3e62e7){return{'model':db[_0x3e62e7['model']],'as':_0x3e62e7['as'],'attributes':_0x3e62e7[_0x6b1c('0x19')],'include':_0x3e62e7['include']?_[_0x6b1c('0x18')](_0x3e62e7[_0x6b1c('0x17')],function(_0xbce9b5){return{'model':db[_0xbce9b5[_0x6b1c('0x1a')]],'as':_0xbce9b5['as'],'attributes':_0xbce9b5[_0x6b1c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f5f31){logger[_0x6b1c('0x9')]('GetServicenowAccount',_0x5b5651);logger[_0x6b1c('0xb')](_0x6b1c('0x13'),_0x5b5651,JSON[_0x6b1c('0xd')](_0x3f5f31));_0x47c149(_0x3f5f31);})['catch'](function(_0x23cad9){logger[_0x6b1c('0xe')]('GetServicenowAccount',_0x23cad9[_0x6b1c('0x11')],_0x5b5651);_0x614cba(_0x1136a3[_0x6b1c('0xe')](0x1f4,_0x23cad9[_0x6b1c('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x4363d1){var _0x551ed2=this;return new Promise(function(_0x2637f5,_0x5ea8f6){return db[_0x6b1c('0x1b')]['find']({'raw':_0x4363d1['options']?_0x4363d1[_0x6b1c('0x14')][_0x6b1c('0x1c')]===undefined?!![]:![]:!![],'where':_0x4363d1[_0x6b1c('0x14')]?_0x4363d1[_0x6b1c('0x14')]['where']||null:null,'attributes':_0x4363d1[_0x6b1c('0x14')]?_0x4363d1[_0x6b1c('0x14')][_0x6b1c('0x19')]||null:null,'include':_0x4363d1['options']?_0x4363d1['options'][_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x4363d1[_0x6b1c('0x14')]['include'],function(_0x227294){return{'model':db[_0x227294[_0x6b1c('0x1a')]],'as':_0x227294['as'],'attributes':_0x227294[_0x6b1c('0x19')],'include':_0x227294[_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x227294[_0x6b1c('0x17')],function(_0x4d9c45){return{'model':db[_0x4d9c45[_0x6b1c('0x1a')]],'as':_0x4d9c45['as'],'attributes':_0x4d9c45[_0x6b1c('0x19')],'include':_0x4d9c45[_0x6b1c('0x17')]?_[_0x6b1c('0x18')](_0x4d9c45[_0x6b1c('0x17')],function(_0x149508){return{'model':db[_0x149508[_0x6b1c('0x1a')]],'as':_0x149508['as'],'attributes':_0x149508['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4efbd4){logger[_0x6b1c('0x9')](_0x6b1c('0x1d'),_0x4363d1);logger['debug'](_0x6b1c('0x1d'),_0x4363d1,JSON[_0x6b1c('0xd')](_0x4efbd4));_0x2637f5(_0x4efbd4);})[_0x6b1c('0x12')](function(_0x4258c0){logger[_0x6b1c('0xe')](_0x6b1c('0x1d'),_0x4258c0[_0x6b1c('0x11')],_0x4363d1);_0x5ea8f6(_0x551ed2[_0x6b1c('0xe')](0x1f4,_0x4258c0[_0x6b1c('0x11')]));});});}; \ No newline at end of file +var _0xfe36=['result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','include','map','model','attributes','debug','ShowServicenowAccount','find','info','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x54313f,_0x2cbd66){var _0x4ae0a6=function(_0x4801c2){while(--_0x4801c2){_0x54313f['push'](_0x54313f['shift']());}};_0x4ae0a6(++_0x2cbd66);}(_0xfe36,0x142));var _0x6fe3=function(_0x21a50e,_0x1b63d7){_0x21a50e=_0x21a50e-0x0;var _0xf2fcb4=_0xfe36[_0x21a50e];return _0xf2fcb4;};'use strict';var _=require(_0x6fe3('0x0'));var util=require(_0x6fe3('0x1'));var moment=require('moment');var BPromise=require(_0x6fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fe3('0x3'))['db'];var utils=require(_0x6fe3('0x4'));var logger=require(_0x6fe3('0x5'))(_0x6fe3('0x6'));var config=require(_0x6fe3('0x7'));var jayson=require(_0x6fe3('0x8'));var client=jayson['client'][_0x6fe3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x353f14,_0x2d6a9a,_0x31194f){return new BPromise(function(_0x271901,_0x366578){return client[_0x6fe3('0xa')](_0x353f14,_0x31194f)[_0x6fe3('0xb')](function(_0x182ce6){logger['info'](_0x6fe3('0xc'),_0x2d6a9a,_0x6fe3('0xd'));logger['debug'](_0x6fe3('0xe'),_0x2d6a9a,_0x6fe3('0xd'),JSON[_0x6fe3('0xf')](_0x182ce6));if(_0x182ce6[_0x6fe3('0x10')]){if(_0x182ce6[_0x6fe3('0x10')]['code']===0x1f4){logger['error'](_0x6fe3('0xc'),_0x2d6a9a,_0x182ce6[_0x6fe3('0x10')][_0x6fe3('0x11')]);return _0x366578(_0x182ce6[_0x6fe3('0x10')][_0x6fe3('0x11')]);}logger[_0x6fe3('0x10')](_0x6fe3('0xc'),_0x2d6a9a,_0x182ce6[_0x6fe3('0x10')]['message']);return _0x271901(_0x182ce6['error'][_0x6fe3('0x11')]);}else{logger['info'](_0x6fe3('0xc'),_0x2d6a9a,_0x6fe3('0xd'));_0x271901(_0x182ce6[_0x6fe3('0x12')][_0x6fe3('0x11')]);}})[_0x6fe3('0x13')](function(_0x2a589c){logger['error'](_0x6fe3('0xc'),_0x2d6a9a,_0x2a589c);_0x366578(_0x2a589c);});});}exports[_0x6fe3('0x14')]=function(_0x824043){var _0x2322c3=this;return new Promise(function(_0x202087,_0x7524e3){return db[_0x6fe3('0x15')]['findAll']({'raw':_0x824043[_0x6fe3('0x16')]?_0x824043['options'][_0x6fe3('0x17')]===undefined?!![]:![]:!![],'where':_0x824043['options']?_0x824043['options'][_0x6fe3('0x18')]||null:null,'attributes':_0x824043[_0x6fe3('0x16')]?_0x824043[_0x6fe3('0x16')]['attributes']||null:null,'limit':_0x824043['options']?_0x824043[_0x6fe3('0x16')][_0x6fe3('0x19')]||null:null,'include':_0x824043['options']?_0x824043[_0x6fe3('0x16')][_0x6fe3('0x1a')]?_[_0x6fe3('0x1b')](_0x824043['options'][_0x6fe3('0x1a')],function(_0x40e3bd){return{'model':db[_0x40e3bd[_0x6fe3('0x1c')]],'as':_0x40e3bd['as'],'attributes':_0x40e3bd[_0x6fe3('0x1d')],'include':_0x40e3bd['include']?_[_0x6fe3('0x1b')](_0x40e3bd['include'],function(_0x2a5086){return{'model':db[_0x2a5086[_0x6fe3('0x1c')]],'as':_0x2a5086['as'],'attributes':_0x2a5086['attributes'],'include':_0x2a5086[_0x6fe3('0x1a')]?_[_0x6fe3('0x1b')](_0x2a5086['include'],function(_0x21c113){return{'model':db[_0x21c113[_0x6fe3('0x1c')]],'as':_0x21c113['as'],'attributes':_0x21c113[_0x6fe3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x61ae68){logger['info'](_0x6fe3('0x14'),_0x824043);logger[_0x6fe3('0x1e')](_0x6fe3('0x14'),_0x824043,JSON['stringify'](_0x61ae68));_0x202087(_0x61ae68);})[_0x6fe3('0x13')](function(_0x5746df){logger[_0x6fe3('0x10')](_0x6fe3('0x14'),_0x5746df[_0x6fe3('0x11')],_0x824043);_0x7524e3(_0x2322c3[_0x6fe3('0x10')](0x1f4,_0x5746df[_0x6fe3('0x11')]));});});};exports[_0x6fe3('0x1f')]=function(_0x4fb0ea){var _0x235e20=this;return new Promise(function(_0x30035b,_0x3a7611){return db['ServicenowAccount'][_0x6fe3('0x20')]({'raw':_0x4fb0ea['options']?_0x4fb0ea[_0x6fe3('0x16')][_0x6fe3('0x17')]===undefined?!![]:![]:!![],'where':_0x4fb0ea['options']?_0x4fb0ea['options'][_0x6fe3('0x18')]||null:null,'attributes':_0x4fb0ea[_0x6fe3('0x16')]?_0x4fb0ea['options'][_0x6fe3('0x1d')]||null:null,'include':_0x4fb0ea[_0x6fe3('0x16')]?_0x4fb0ea[_0x6fe3('0x16')][_0x6fe3('0x1a')]?_[_0x6fe3('0x1b')](_0x4fb0ea[_0x6fe3('0x16')]['include'],function(_0x13dac2){return{'model':db[_0x13dac2[_0x6fe3('0x1c')]],'as':_0x13dac2['as'],'attributes':_0x13dac2[_0x6fe3('0x1d')],'include':_0x13dac2['include']?_[_0x6fe3('0x1b')](_0x13dac2[_0x6fe3('0x1a')],function(_0x4a2b1b){return{'model':db[_0x4a2b1b['model']],'as':_0x4a2b1b['as'],'attributes':_0x4a2b1b[_0x6fe3('0x1d')],'include':_0x4a2b1b[_0x6fe3('0x1a')]?_[_0x6fe3('0x1b')](_0x4a2b1b['include'],function(_0x53c6b2){return{'model':db[_0x53c6b2[_0x6fe3('0x1c')]],'as':_0x53c6b2['as'],'attributes':_0x53c6b2[_0x6fe3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6fe3('0xb')](function(_0x1ba37e){logger[_0x6fe3('0x21')]('ShowServicenowAccount',_0x4fb0ea);logger[_0x6fe3('0x1e')]('ShowServicenowAccount',_0x4fb0ea,JSON[_0x6fe3('0xf')](_0x1ba37e));_0x30035b(_0x1ba37e);})['catch'](function(_0x18bb93){logger[_0x6fe3('0x10')](_0x6fe3('0x1f'),_0x18bb93[_0x6fe3('0x11')],_0x4fb0ea);_0x3a7611(_0x235e20[_0x6fe3('0x10')](0x1f4,_0x18bb93[_0x6fe3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4a40596..54d6f43 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 _0x04eb=['exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy'];(function(_0x4406e1,_0x9b9927){var _0x1b1f62=function(_0x2c0071){while(--_0x2c0071){_0x4406e1['push'](_0x4406e1['shift']());}};_0x1b1f62(++_0x9b9927);}(_0x04eb,0x1b6));var _0xb04e=function(_0x1cd401,_0x153cdd){_0x1cd401=_0x1cd401-0x0;var _0x136178=_0x04eb[_0x1cd401];return _0x136178;};'use strict';var multer=require('multer');var util=require(_0xb04e('0x0'));var path=require(_0xb04e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb04e('0x2'));var auth=require(_0xb04e('0x3'));var interaction=require(_0xb04e('0x4'));var config=require(_0xb04e('0x5'));var controller=require(_0xb04e('0x6'));router[_0xb04e('0x7')]('/',auth[_0xb04e('0x8')](),controller[_0xb04e('0x9')]);router['get'](_0xb04e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xb04e('0x7')](_0xb04e('0xb'),auth[_0xb04e('0x8')](),controller[_0xb04e('0xc')]);router[_0xb04e('0x7')](_0xb04e('0xd'),auth['isAuthenticated'](),controller[_0xb04e('0xe')]);router[_0xb04e('0x7')](_0xb04e('0xf'),auth['isAuthenticated'](),controller[_0xb04e('0x10')]);router[_0xb04e('0x11')]('/',auth[_0xb04e('0x8')](),controller[_0xb04e('0x12')]);router[_0xb04e('0x13')](_0xb04e('0xa'),auth[_0xb04e('0x8')](),controller['update']);router[_0xb04e('0x14')](_0xb04e('0xa'),auth['isAuthenticated'](),controller[_0xb04e('0x15')]);module[_0xb04e('0x16')]=router; \ No newline at end of file +var _0x5c40=['getSubjects','/:id/descriptions','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects'];(function(_0x10ab33,_0x2baf3d){var _0x1b6f44=function(_0x3670af){while(--_0x3670af){_0x10ab33['push'](_0x10ab33['shift']());}};_0x1b6f44(++_0x2baf3d);}(_0x5c40,0x78));var _0x05c4=function(_0x317413,_0x22abc7){_0x317413=_0x317413-0x0;var _0x2b627a=_0x5c40[_0x317413];return _0x2b627a;};'use strict';var multer=require(_0x05c4('0x0'));var util=require(_0x05c4('0x1'));var path=require(_0x05c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c4('0x3'));var router=express[_0x05c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x05c4('0x5'));var interaction=require(_0x05c4('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x05c4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x05c4('0x7')](_0x05c4('0x8'),auth[_0x05c4('0x9')](),controller['show']);router[_0x05c4('0x7')](_0x05c4('0xa'),auth[_0x05c4('0x9')](),controller[_0x05c4('0xb')]);router['get'](_0x05c4('0xc'),auth[_0x05c4('0x9')](),controller[_0x05c4('0xd')]);router['get'](_0x05c4('0xe'),auth[_0x05c4('0x9')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x05c4('0xf')]);router[_0x05c4('0x10')](_0x05c4('0x8'),auth['isAuthenticated'](),controller[_0x05c4('0x11')]);router['delete'](_0x05c4('0x8'),auth[_0x05c4('0x9')](),controller['destroy']);module[_0x05c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 69e59ce..a1fd9af 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 _0x7727=['exports','STRING','sequelize'];(function(_0x17d389,_0x2f85bf){var _0x28a0c4=function(_0x16d20d){while(--_0x16d20d){_0x17d389['push'](_0x17d389['shift']());}};_0x28a0c4(++_0x2f85bf);}(_0x7727,0x11f));var _0x7772=function(_0x5ef25a,_0x5392c3){_0x5ef25a=_0x5ef25a-0x0;var _0x4dca64=_0x7727[_0x5ef25a];return _0x4dca64;};'use strict';var Sequelize=require(_0x7772('0x0'));module[_0x7772('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7772('0x2')]}}; \ No newline at end of file +var _0x49db=['sequelize','STRING'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0x49db,0xc6));var _0xb49d=function(_0x6a8741,_0x57ac09){_0x6a8741=_0x6a8741-0x0;var _0xc70b78=_0x49db[_0x6a8741];return _0xc70b78;};'use strict';var Sequelize=require(_0xb49d('0x0'));module['exports']={'name':{'type':Sequelize[_0xb49d('0x1')]},'description':{'type':Sequelize[_0xb49d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 1e34884..f9eff98 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 _0xdfe8=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','keys','find','catch','create','body','params','getFields','findOne','ServicenowField','nolimit','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x718b21,_0x165be5){var _0x3bf745=function(_0xa42b52){while(--_0xa42b52){_0x718b21['push'](_0x718b21['shift']());}};_0x3bf745(++_0x165be5);}(_0xdfe8,0x94));var _0x8dfe=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xdfe8[_0x1385dc];return _0x2f6469;};'use strict';var emlformat=require(_0x8dfe('0x0'));var rimraf=require(_0x8dfe('0x1'));var zipdir=require(_0x8dfe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8dfe('0x3'));var moment=require(_0x8dfe('0x4'));var BPromise=require(_0x8dfe('0x5'));var Mustache=require(_0x8dfe('0x6'));var util=require(_0x8dfe('0x7'));var path=require(_0x8dfe('0x8'));var sox=require('sox');var csv=require(_0x8dfe('0x9'));var ejs=require(_0x8dfe('0xa'));var fs=require('fs');var fs_extra=require(_0x8dfe('0xb'));var _=require(_0x8dfe('0xc'));var squel=require(_0x8dfe('0xd'));var crypto=require(_0x8dfe('0xe'));var jsforce=require(_0x8dfe('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8dfe('0x9'));var querystring=require('querystring');var Papa=require(_0x8dfe('0x10'));var Redis=require(_0x8dfe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8dfe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8dfe('0x13'))(_0x8dfe('0x14'));var utils=require(_0x8dfe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8dfe('0x16'));var db=require(_0x8dfe('0x17'))['db'];function respondWithStatusCode(_0x4d142c,_0x2cac28){_0x2cac28=_0x2cac28||0xcc;return function(_0x40f5bb){if(_0x40f5bb){return _0x4d142c[_0x8dfe('0x18')](_0x2cac28);}return _0x4d142c['status'](_0x2cac28)[_0x8dfe('0x19')]();};}function respondWithResult(_0x3d22f6,_0x11bbca){_0x11bbca=_0x11bbca||0xc8;return function(_0x16f13b){if(_0x16f13b){return _0x3d22f6[_0x8dfe('0x1a')](_0x11bbca)[_0x8dfe('0x1b')](_0x16f13b);}};}function respondWithFilteredResult(_0x3c6ed3,_0x5e4feb){return function(_0x5d53d2){if(_0x5d53d2){var _0xcf9202=typeof _0x5e4feb['offset']==='undefined'&&typeof _0x5e4feb['limit']===_0x8dfe('0x1c');var _0x4d1148=_0x5d53d2[_0x8dfe('0x1d')];var _0x2a818c=_0xcf9202?0x0:_0x5e4feb[_0x8dfe('0x1e')];var _0x13dcab=_0xcf9202?_0x5d53d2[_0x8dfe('0x1d')]:_0x5e4feb[_0x8dfe('0x1e')]+_0x5e4feb[_0x8dfe('0x1f')];var _0x223e00;if(_0x13dcab>=_0x4d1148){_0x13dcab=_0x4d1148;_0x223e00=0xc8;}else{_0x223e00=0xce;}_0x3c6ed3[_0x8dfe('0x1a')](_0x223e00);return _0x3c6ed3['set'](_0x8dfe('0x20'),_0x2a818c+'-'+_0x13dcab+'/'+_0x4d1148)['json'](_0x5d53d2);}return null;};}function patchUpdates(_0x1dedc2){return function(_0x50d77a){try{jsonpatch['apply'](_0x50d77a,_0x1dedc2,!![]);}catch(_0x50b50a){return BPromise[_0x8dfe('0x21')](_0x50b50a);}return _0x50d77a[_0x8dfe('0x22')]();};}function saveUpdates(_0x15b855,_0x5bbfa8){return function(_0x5913eb){if(_0x5913eb){return _0x5913eb['update'](_0x15b855)[_0x8dfe('0x23')](function(_0x17c80c){return _0x17c80c;});}return null;};}function removeEntity(_0x56babf,_0x1ec890){return function(_0x5cd18b){if(_0x5cd18b){return _0x5cd18b[_0x8dfe('0x24')]()[_0x8dfe('0x23')](function(){_0x56babf['status'](0xcc)[_0x8dfe('0x19')]();});}};}function handleEntityNotFound(_0x5a6b2c,_0x41842b){return function(_0x47575b){if(!_0x47575b){_0x5a6b2c[_0x8dfe('0x18')](0x194);}return _0x47575b;};}function handleError(_0x485310,_0x331307){_0x331307=_0x331307||0x1f4;return function(_0x38dbdb){logger[_0x8dfe('0x25')](_0x38dbdb[_0x8dfe('0x26')]);if(_0x38dbdb[_0x8dfe('0x27')]){delete _0x38dbdb['name'];}_0x485310[_0x8dfe('0x1a')](_0x331307)[_0x8dfe('0x28')](_0x38dbdb);};}exports['index']=function(_0x57799b,_0x1e8953){var _0x3716f8={},_0xc3fdad={},_0xb6ad66={'count':0x0,'rows':[]};var _0x1742a9=_['map'](db[_0x8dfe('0x29')][_0x8dfe('0x2a')],function(_0x5e5eb9){return{'name':_0x5e5eb9[_0x8dfe('0x2b')],'type':_0x5e5eb9[_0x8dfe('0x2c')][_0x8dfe('0x2d')]};});_0xc3fdad[_0x8dfe('0x2e')]=_['map'](_0x1742a9,_0x8dfe('0x27'));_0xc3fdad[_0x8dfe('0x2f')]=_['keys'](_0x57799b[_0x8dfe('0x2f')]);_0xc3fdad[_0x8dfe('0x30')]=_[_0x8dfe('0x31')](_0xc3fdad[_0x8dfe('0x2e')],_0xc3fdad['query']);_0x3716f8[_0x8dfe('0x32')]=_[_0x8dfe('0x31')](_0xc3fdad[_0x8dfe('0x2e')],qs[_0x8dfe('0x33')](_0x57799b[_0x8dfe('0x2f')]['fields']));_0x3716f8[_0x8dfe('0x32')]=_0x3716f8[_0x8dfe('0x32')][_0x8dfe('0x34')]?_0x3716f8[_0x8dfe('0x32')]:_0xc3fdad[_0x8dfe('0x2e')];if(!_0x57799b[_0x8dfe('0x2f')][_0x8dfe('0x35')]('nolimit')){_0x3716f8[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x57799b['query'][_0x8dfe('0x1f')]);_0x3716f8[_0x8dfe('0x1e')]=qs[_0x8dfe('0x1e')](_0x57799b[_0x8dfe('0x2f')][_0x8dfe('0x1e')]);}_0x3716f8['order']=qs[_0x8dfe('0x36')](_0x57799b[_0x8dfe('0x2f')][_0x8dfe('0x36')]);_0x3716f8[_0x8dfe('0x37')]=qs[_0x8dfe('0x30')](_[_0x8dfe('0x38')](_0x57799b['query'],_0xc3fdad[_0x8dfe('0x30')]),_0x1742a9);if(_0x57799b[_0x8dfe('0x2f')][_0x8dfe('0x39')]){_0x3716f8[_0x8dfe('0x37')]=_[_0x8dfe('0x3a')](_0x3716f8[_0x8dfe('0x37')],{'$or':_[_0x8dfe('0x3b')](_0x1742a9,function(_0x439573){if(_0x439573[_0x8dfe('0x2c')]!==_0x8dfe('0x3c')){var _0x326044={};_0x326044[_0x439573[_0x8dfe('0x27')]]={'$like':'%'+_0x57799b[_0x8dfe('0x2f')][_0x8dfe('0x39')]+'%'};return _0x326044;}})});}_0x3716f8=_[_0x8dfe('0x3a')]({},_0x3716f8,_0x57799b[_0x8dfe('0x3d')]);var _0x22fed8={'where':_0x3716f8[_0x8dfe('0x37')]};return db[_0x8dfe('0x29')][_0x8dfe('0x1d')](_0x22fed8)['then'](function(_0x197e05){_0xb6ad66['count']=_0x197e05;if(_0x57799b[_0x8dfe('0x2f')][_0x8dfe('0x3e')]){_0x3716f8[_0x8dfe('0x3f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8dfe('0x40')](_0x3716f8);})[_0x8dfe('0x23')](function(_0x4b39e1){_0xb6ad66['rows']=_0x4b39e1;return _0xb6ad66;})['then'](respondWithFilteredResult(_0x1e8953,_0x3716f8))['catch'](handleError(_0x1e8953,null));};exports['show']=function(_0x3ed1cc,_0x128cd6){var _0x5f3109={'raw':![],'where':{'id':_0x3ed1cc['params']['id']}},_0x3d712d={};_0x3d712d[_0x8dfe('0x2e')]=_[_0x8dfe('0x41')](db['ServicenowConfiguration'][_0x8dfe('0x2a')]);_0x3d712d[_0x8dfe('0x2f')]=_[_0x8dfe('0x41')](_0x3ed1cc['query']);_0x3d712d['filters']=_[_0x8dfe('0x31')](_0x3d712d['model'],_0x3d712d[_0x8dfe('0x2f')]);_0x5f3109['attributes']=_[_0x8dfe('0x31')](_0x3d712d['model'],qs['fields'](_0x3ed1cc[_0x8dfe('0x2f')][_0x8dfe('0x33')]));_0x5f3109[_0x8dfe('0x32')]=_0x5f3109[_0x8dfe('0x32')][_0x8dfe('0x34')]?_0x5f3109[_0x8dfe('0x32')]:_0x3d712d[_0x8dfe('0x2e')];if(_0x3ed1cc[_0x8dfe('0x2f')]['includeAll']){_0x5f3109[_0x8dfe('0x3f')]=[{'all':!![]}];}_0x5f3109=_[_0x8dfe('0x3a')]({},_0x5f3109,_0x3ed1cc[_0x8dfe('0x3d')]);return db[_0x8dfe('0x29')][_0x8dfe('0x42')](_0x5f3109)['then'](handleEntityNotFound(_0x128cd6,null))[_0x8dfe('0x23')](respondWithResult(_0x128cd6,null))[_0x8dfe('0x43')](handleError(_0x128cd6,null));};exports[_0x8dfe('0x44')]=function(_0x5149f,_0x8b204){return db[_0x8dfe('0x29')]['create'](_0x5149f[_0x8dfe('0x45')],{})[_0x8dfe('0x23')](respondWithResult(_0x8b204,0xc9))[_0x8dfe('0x43')](handleError(_0x8b204,null));};exports['update']=function(_0x7defef,_0xbfb48){if(_0x7defef['body']['id']){delete _0x7defef[_0x8dfe('0x45')]['id'];}return db[_0x8dfe('0x29')][_0x8dfe('0x42')]({'where':{'id':_0x7defef['params']['id']}})['then'](handleEntityNotFound(_0xbfb48,null))[_0x8dfe('0x23')](saveUpdates(_0x7defef[_0x8dfe('0x45')],null))[_0x8dfe('0x23')](respondWithResult(_0xbfb48,null))[_0x8dfe('0x43')](handleError(_0xbfb48,null));};exports[_0x8dfe('0x24')]=function(_0x17b98a,_0x40218e){return db['ServicenowConfiguration'][_0x8dfe('0x42')]({'where':{'id':_0x17b98a[_0x8dfe('0x46')]['id']}})[_0x8dfe('0x23')](handleEntityNotFound(_0x40218e,null))[_0x8dfe('0x23')](removeEntity(_0x40218e,null))['catch'](handleError(_0x40218e,null));};exports[_0x8dfe('0x47')]=function(_0x3d3b74,_0x13f81b,_0x1fb4b7){var _0x1e8e02={};var _0x3b5483={};var _0x350be2;var _0x4947d2;return db[_0x8dfe('0x29')][_0x8dfe('0x48')]({'where':{'id':_0x3d3b74[_0x8dfe('0x46')]['id']}})[_0x8dfe('0x23')](handleEntityNotFound(_0x13f81b,null))[_0x8dfe('0x23')](function(_0x4838ec){if(_0x4838ec){_0x350be2=_0x4838ec;_0x3b5483['model']=_[_0x8dfe('0x41')](db[_0x8dfe('0x49')][_0x8dfe('0x2a')]);_0x3b5483[_0x8dfe('0x2f')]=_[_0x8dfe('0x41')](_0x3d3b74[_0x8dfe('0x2f')]);_0x3b5483[_0x8dfe('0x30')]=_[_0x8dfe('0x31')](_0x3b5483[_0x8dfe('0x2e')],_0x3b5483[_0x8dfe('0x2f')]);_0x1e8e02['attributes']=_[_0x8dfe('0x31')](_0x3b5483[_0x8dfe('0x2e')],qs['fields'](_0x3d3b74[_0x8dfe('0x2f')][_0x8dfe('0x33')]));_0x1e8e02[_0x8dfe('0x32')]=_0x1e8e02[_0x8dfe('0x32')][_0x8dfe('0x34')]?_0x1e8e02['attributes']:_0x3b5483[_0x8dfe('0x2e')];_0x1e8e02['order']=qs[_0x8dfe('0x36')](_0x3d3b74[_0x8dfe('0x2f')][_0x8dfe('0x36')]);_0x1e8e02[_0x8dfe('0x37')]=qs[_0x8dfe('0x30')](_[_0x8dfe('0x38')](_0x3d3b74[_0x8dfe('0x2f')],_0x3b5483['filters']));if(_0x3d3b74[_0x8dfe('0x2f')]['filter']){_0x1e8e02['where']=_[_0x8dfe('0x3a')](_0x1e8e02[_0x8dfe('0x37')],{'$or':_[_0x8dfe('0x3b')](_0x1e8e02[_0x8dfe('0x32')],function(_0x31d4e0){var _0x38fb16={};_0x38fb16[_0x31d4e0]={'$like':'%'+_0x3d3b74[_0x8dfe('0x2f')][_0x8dfe('0x39')]+'%'};return _0x38fb16;})});}_0x1e8e02=_['merge']({},_0x1e8e02,_0x3d3b74[_0x8dfe('0x3d')]);return _0x350be2[_0x8dfe('0x47')](_0x1e8e02);}})['then'](function(_0x27c749){if(_0x27c749){_0x4947d2=_0x27c749[_0x8dfe('0x34')];if(!_0x3d3b74[_0x8dfe('0x2f')][_0x8dfe('0x35')](_0x8dfe('0x4a'))){_0x1e8e02[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x3d3b74[_0x8dfe('0x2f')]['limit']);_0x1e8e02[_0x8dfe('0x1e')]=qs[_0x8dfe('0x1e')](_0x3d3b74[_0x8dfe('0x2f')][_0x8dfe('0x1e')]);}return _0x350be2['getFields'](_0x1e8e02);}})['then'](function(_0x5914df){if(_0x5914df){return _0x5914df?{'count':_0x4947d2,'rows':_0x5914df}:null;}})[_0x8dfe('0x23')](respondWithResult(_0x13f81b,null))[_0x8dfe('0x43')](handleError(_0x13f81b,null));};exports[_0x8dfe('0x4b')]=function(_0x56220b,_0x5d448c,_0x53b19e){var _0x546997={};var _0x2ffd6e={};var _0x31d28d;var _0xacb5e;return db[_0x8dfe('0x29')]['findOne']({'where':{'id':_0x56220b['params']['id']}})[_0x8dfe('0x23')](handleEntityNotFound(_0x5d448c,null))['then'](function(_0x44b5fd){if(_0x44b5fd){_0x31d28d=_0x44b5fd;_0x2ffd6e[_0x8dfe('0x2e')]=_[_0x8dfe('0x41')](db['ServicenowField'][_0x8dfe('0x2a')]);_0x2ffd6e[_0x8dfe('0x2f')]=_[_0x8dfe('0x41')](_0x56220b[_0x8dfe('0x2f')]);_0x2ffd6e['filters']=_[_0x8dfe('0x31')](_0x2ffd6e['model'],_0x2ffd6e[_0x8dfe('0x2f')]);_0x546997['attributes']=_[_0x8dfe('0x31')](_0x2ffd6e[_0x8dfe('0x2e')],qs[_0x8dfe('0x33')](_0x56220b[_0x8dfe('0x2f')]['fields']));_0x546997[_0x8dfe('0x32')]=_0x546997[_0x8dfe('0x32')]['length']?_0x546997[_0x8dfe('0x32')]:_0x2ffd6e['model'];_0x546997[_0x8dfe('0x4c')]=qs[_0x8dfe('0x36')](_0x56220b[_0x8dfe('0x2f')]['sort']);_0x546997[_0x8dfe('0x37')]=qs[_0x8dfe('0x30')](_[_0x8dfe('0x38')](_0x56220b[_0x8dfe('0x2f')],_0x2ffd6e[_0x8dfe('0x30')]));if(_0x56220b[_0x8dfe('0x2f')][_0x8dfe('0x39')]){_0x546997[_0x8dfe('0x37')]=_[_0x8dfe('0x3a')](_0x546997[_0x8dfe('0x37')],{'$or':_[_0x8dfe('0x3b')](_0x546997['attributes'],function(_0x505d7b){var _0x1e55fe={};_0x1e55fe[_0x505d7b]={'$like':'%'+_0x56220b['query'][_0x8dfe('0x39')]+'%'};return _0x1e55fe;})});}_0x546997=_[_0x8dfe('0x3a')]({},_0x546997,_0x56220b[_0x8dfe('0x3d')]);return _0x31d28d[_0x8dfe('0x4b')](_0x546997);}})['then'](function(_0x265d00){if(_0x265d00){_0xacb5e=_0x265d00[_0x8dfe('0x34')];if(!_0x56220b[_0x8dfe('0x2f')][_0x8dfe('0x35')](_0x8dfe('0x4a'))){_0x546997[_0x8dfe('0x1f')]=qs['limit'](_0x56220b[_0x8dfe('0x2f')][_0x8dfe('0x1f')]);_0x546997[_0x8dfe('0x1e')]=qs[_0x8dfe('0x1e')](_0x56220b[_0x8dfe('0x2f')][_0x8dfe('0x1e')]);}return _0x31d28d[_0x8dfe('0x4b')](_0x546997);}})['then'](function(_0x514000){if(_0x514000){return _0x514000?{'count':_0xacb5e,'rows':_0x514000}:null;}})[_0x8dfe('0x23')](respondWithResult(_0x5d448c,null))['catch'](handleError(_0x5d448c,null));};exports[_0x8dfe('0x4d')]=function(_0x18d11b,_0x1365d1,_0x386978){var _0x5dabbf={};var _0xf9bf5d={};var _0x2f0949;var _0x31db46;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x18d11b[_0x8dfe('0x46')]['id']}})[_0x8dfe('0x23')](handleEntityNotFound(_0x1365d1,null))[_0x8dfe('0x23')](function(_0x192eaa){if(_0x192eaa){_0x2f0949=_0x192eaa;_0xf9bf5d[_0x8dfe('0x2e')]=_[_0x8dfe('0x41')](db[_0x8dfe('0x49')][_0x8dfe('0x2a')]);_0xf9bf5d[_0x8dfe('0x2f')]=_[_0x8dfe('0x41')](_0x18d11b[_0x8dfe('0x2f')]);_0xf9bf5d[_0x8dfe('0x30')]=_[_0x8dfe('0x31')](_0xf9bf5d[_0x8dfe('0x2e')],_0xf9bf5d[_0x8dfe('0x2f')]);_0x5dabbf[_0x8dfe('0x32')]=_['intersection'](_0xf9bf5d['model'],qs['fields'](_0x18d11b[_0x8dfe('0x2f')][_0x8dfe('0x33')]));_0x5dabbf[_0x8dfe('0x32')]=_0x5dabbf['attributes'][_0x8dfe('0x34')]?_0x5dabbf['attributes']:_0xf9bf5d['model'];_0x5dabbf[_0x8dfe('0x4c')]=qs[_0x8dfe('0x36')](_0x18d11b[_0x8dfe('0x2f')][_0x8dfe('0x36')]);_0x5dabbf[_0x8dfe('0x37')]=qs[_0x8dfe('0x30')](_[_0x8dfe('0x38')](_0x18d11b[_0x8dfe('0x2f')],_0xf9bf5d['filters']));if(_0x18d11b[_0x8dfe('0x2f')][_0x8dfe('0x39')]){_0x5dabbf[_0x8dfe('0x37')]=_[_0x8dfe('0x3a')](_0x5dabbf[_0x8dfe('0x37')],{'$or':_[_0x8dfe('0x3b')](_0x5dabbf[_0x8dfe('0x32')],function(_0x3992db){var _0x5489c4={};_0x5489c4[_0x3992db]={'$like':'%'+_0x18d11b[_0x8dfe('0x2f')][_0x8dfe('0x39')]+'%'};return _0x5489c4;})});}_0x5dabbf=_[_0x8dfe('0x3a')]({},_0x5dabbf,_0x18d11b[_0x8dfe('0x3d')]);return _0x2f0949[_0x8dfe('0x4d')](_0x5dabbf);}})['then'](function(_0x408425){if(_0x408425){_0x31db46=_0x408425[_0x8dfe('0x34')];if(!_0x18d11b[_0x8dfe('0x2f')][_0x8dfe('0x35')](_0x8dfe('0x4a'))){_0x5dabbf[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x18d11b[_0x8dfe('0x2f')]['limit']);_0x5dabbf[_0x8dfe('0x1e')]=qs[_0x8dfe('0x1e')](_0x18d11b['query'][_0x8dfe('0x1e')]);}return _0x2f0949[_0x8dfe('0x4d')](_0x5dabbf);}})[_0x8dfe('0x23')](function(_0x153f12){if(_0x153f12){return _0x153f12?{'count':_0x31db46,'rows':_0x153f12}:null;}})[_0x8dfe('0x23')](respondWithResult(_0x1365d1,null))[_0x8dfe('0x43')](handleError(_0x1365d1,null));}; \ No newline at end of file +var _0xb75a=['rawAttributes','length','find','create','body','findOne','ServicenowField','order','pick','getFields','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params'];(function(_0x1a1b8a,_0x3d8c03){var _0x1a367d=function(_0x6b0fe1){while(--_0x6b0fe1){_0x1a1b8a['push'](_0x1a1b8a['shift']());}};_0x1a367d(++_0x3d8c03);}(_0xb75a,0x1e1));var _0xab75=function(_0x2a0afb,_0x221e51){_0x2a0afb=_0x2a0afb-0x0;var _0x537b6b=_0xb75a[_0x2a0afb];return _0x537b6b;};'use strict';var emlformat=require(_0xab75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab75('0x1'));var jsonpatch=require(_0xab75('0x2'));var rp=require(_0xab75('0x3'));var moment=require(_0xab75('0x4'));var BPromise=require(_0xab75('0x5'));var Mustache=require(_0xab75('0x6'));var util=require('util');var path=require('path');var sox=require(_0xab75('0x7'));var csv=require(_0xab75('0x8'));var ejs=require(_0xab75('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab75('0xa'));var squel=require(_0xab75('0xb'));var crypto=require('crypto');var jsforce=require(_0xab75('0xc'));var deskjs=require(_0xab75('0xd'));var toCsv=require(_0xab75('0x8'));var querystring=require('querystring');var Papa=require(_0xab75('0xe'));var Redis=require(_0xab75('0xf'));var authService=require(_0xab75('0x10'));var qs=require(_0xab75('0x11'));var as=require(_0xab75('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab75('0x13'))(_0xab75('0x14'));var utils=require(_0xab75('0x15'));var config=require(_0xab75('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xab75('0x17'))['db'];function respondWithStatusCode(_0x2042c5,_0x2c7df2){_0x2c7df2=_0x2c7df2||0xcc;return function(_0x1a6d40){if(_0x1a6d40){return _0x2042c5[_0xab75('0x18')](_0x2c7df2);}return _0x2042c5[_0xab75('0x19')](_0x2c7df2)[_0xab75('0x1a')]();};}function respondWithResult(_0x12e27f,_0x56d60d){_0x56d60d=_0x56d60d||0xc8;return function(_0x2daa53){if(_0x2daa53){return _0x12e27f[_0xab75('0x19')](_0x56d60d)[_0xab75('0x1b')](_0x2daa53);}};}function respondWithFilteredResult(_0x1458a4,_0x1fd4bb){return function(_0xcf8eff){if(_0xcf8eff){var _0x131b05=typeof _0x1fd4bb[_0xab75('0x1c')]===_0xab75('0x1d')&&typeof _0x1fd4bb[_0xab75('0x1e')]==='undefined';var _0x46aa99=_0xcf8eff[_0xab75('0x1f')];var _0x4dca3d=_0x131b05?0x0:_0x1fd4bb['offset'];var _0x215a5a=_0x131b05?_0xcf8eff[_0xab75('0x1f')]:_0x1fd4bb[_0xab75('0x1c')]+_0x1fd4bb[_0xab75('0x1e')];var _0x22777c;if(_0x215a5a>=_0x46aa99){_0x215a5a=_0x46aa99;_0x22777c=0xc8;}else{_0x22777c=0xce;}_0x1458a4[_0xab75('0x19')](_0x22777c);return _0x1458a4[_0xab75('0x20')](_0xab75('0x21'),_0x4dca3d+'-'+_0x215a5a+'/'+_0x46aa99)[_0xab75('0x1b')](_0xcf8eff);}return null;};}function patchUpdates(_0xcf1734){return function(_0x502800){try{jsonpatch['apply'](_0x502800,_0xcf1734,!![]);}catch(_0x31fa3a){return BPromise['reject'](_0x31fa3a);}return _0x502800['save']();};}function saveUpdates(_0x333666,_0x4f6f19){return function(_0x1b370b){if(_0x1b370b){return _0x1b370b[_0xab75('0x22')](_0x333666)[_0xab75('0x23')](function(_0x4cdc53){return _0x4cdc53;});}return null;};}function removeEntity(_0xc01a51,_0x310a66){return function(_0x4b39f5){if(_0x4b39f5){return _0x4b39f5[_0xab75('0x24')]()[_0xab75('0x23')](function(){_0xc01a51['status'](0xcc)[_0xab75('0x1a')]();});}};}function handleEntityNotFound(_0x344afc,_0x231213){return function(_0x46bbc0){if(!_0x46bbc0){_0x344afc[_0xab75('0x18')](0x194);}return _0x46bbc0;};}function handleError(_0x30d67c,_0x4445d8){_0x4445d8=_0x4445d8||0x1f4;return function(_0x8b46ba){logger['error'](_0x8b46ba[_0xab75('0x25')]);if(_0x8b46ba[_0xab75('0x26')]){delete _0x8b46ba['name'];}_0x30d67c[_0xab75('0x19')](_0x4445d8)[_0xab75('0x27')](_0x8b46ba);};}exports[_0xab75('0x28')]=function(_0x464ac3,_0x555e3b){var _0x4e6a39={},_0x4248ad={},_0x2767f5={'count':0x0,'rows':[]};var _0x1265aa=_[_0xab75('0x29')](db[_0xab75('0x2a')]['rawAttributes'],function(_0x4e225c){return{'name':_0x4e225c[_0xab75('0x2b')],'type':_0x4e225c[_0xab75('0x2c')][_0xab75('0x2d')]};});_0x4248ad['model']=_['map'](_0x1265aa,_0xab75('0x26'));_0x4248ad[_0xab75('0x2e')]=_[_0xab75('0x2f')](_0x464ac3[_0xab75('0x2e')]);_0x4248ad[_0xab75('0x30')]=_['intersection'](_0x4248ad[_0xab75('0x31')],_0x4248ad[_0xab75('0x2e')]);_0x4e6a39['attributes']=_[_0xab75('0x32')](_0x4248ad[_0xab75('0x31')],qs['fields'](_0x464ac3['query'][_0xab75('0x33')]));_0x4e6a39[_0xab75('0x34')]=_0x4e6a39['attributes']['length']?_0x4e6a39[_0xab75('0x34')]:_0x4248ad[_0xab75('0x31')];if(!_0x464ac3[_0xab75('0x2e')][_0xab75('0x35')]('nolimit')){_0x4e6a39[_0xab75('0x1e')]=qs[_0xab75('0x1e')](_0x464ac3[_0xab75('0x2e')][_0xab75('0x1e')]);_0x4e6a39['offset']=qs[_0xab75('0x1c')](_0x464ac3[_0xab75('0x2e')][_0xab75('0x1c')]);}_0x4e6a39['order']=qs[_0xab75('0x36')](_0x464ac3[_0xab75('0x2e')]['sort']);_0x4e6a39['where']=qs[_0xab75('0x30')](_['pick'](_0x464ac3[_0xab75('0x2e')],_0x4248ad[_0xab75('0x30')]),_0x1265aa);if(_0x464ac3['query'][_0xab75('0x37')]){_0x4e6a39[_0xab75('0x38')]=_[_0xab75('0x39')](_0x4e6a39['where'],{'$or':_[_0xab75('0x29')](_0x1265aa,function(_0x1ebfac){if(_0x1ebfac[_0xab75('0x2c')]!==_0xab75('0x3a')){var _0x3cbdf3={};_0x3cbdf3[_0x1ebfac[_0xab75('0x26')]]={'$like':'%'+_0x464ac3[_0xab75('0x2e')][_0xab75('0x37')]+'%'};return _0x3cbdf3;}})});}_0x4e6a39=_[_0xab75('0x39')]({},_0x4e6a39,_0x464ac3[_0xab75('0x3b')]);var _0x3e714a={'where':_0x4e6a39[_0xab75('0x38')]};return db[_0xab75('0x2a')][_0xab75('0x1f')](_0x3e714a)[_0xab75('0x23')](function(_0x3c9da1){_0x2767f5[_0xab75('0x1f')]=_0x3c9da1;if(_0x464ac3['query'][_0xab75('0x3c')]){_0x4e6a39['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xab75('0x3d')](_0x4e6a39);})[_0xab75('0x23')](function(_0x535328){_0x2767f5[_0xab75('0x3e')]=_0x535328;return _0x2767f5;})['then'](respondWithFilteredResult(_0x555e3b,_0x4e6a39))[_0xab75('0x3f')](handleError(_0x555e3b,null));};exports['show']=function(_0x5051f1,_0x90294f){var _0x146ba6={'raw':![],'where':{'id':_0x5051f1[_0xab75('0x40')]['id']}},_0x465aa4={};_0x465aa4[_0xab75('0x31')]=_[_0xab75('0x2f')](db[_0xab75('0x2a')][_0xab75('0x41')]);_0x465aa4['query']=_[_0xab75('0x2f')](_0x5051f1['query']);_0x465aa4[_0xab75('0x30')]=_[_0xab75('0x32')](_0x465aa4['model'],_0x465aa4[_0xab75('0x2e')]);_0x146ba6[_0xab75('0x34')]=_[_0xab75('0x32')](_0x465aa4[_0xab75('0x31')],qs[_0xab75('0x33')](_0x5051f1[_0xab75('0x2e')][_0xab75('0x33')]));_0x146ba6['attributes']=_0x146ba6[_0xab75('0x34')][_0xab75('0x42')]?_0x146ba6['attributes']:_0x465aa4['model'];if(_0x5051f1['query'][_0xab75('0x3c')]){_0x146ba6['include']=[{'all':!![]}];}_0x146ba6=_[_0xab75('0x39')]({},_0x146ba6,_0x5051f1[_0xab75('0x3b')]);return db['ServicenowConfiguration'][_0xab75('0x43')](_0x146ba6)[_0xab75('0x23')](handleEntityNotFound(_0x90294f,null))[_0xab75('0x23')](respondWithResult(_0x90294f,null))[_0xab75('0x3f')](handleError(_0x90294f,null));};exports['create']=function(_0x4e49a5,_0x665324){return db[_0xab75('0x2a')][_0xab75('0x44')](_0x4e49a5['body'],{})[_0xab75('0x23')](respondWithResult(_0x665324,0xc9))[_0xab75('0x3f')](handleError(_0x665324,null));};exports['update']=function(_0x2895ce,_0x109ff3){if(_0x2895ce[_0xab75('0x45')]['id']){delete _0x2895ce['body']['id'];}return db[_0xab75('0x2a')][_0xab75('0x43')]({'where':{'id':_0x2895ce['params']['id']}})[_0xab75('0x23')](handleEntityNotFound(_0x109ff3,null))['then'](saveUpdates(_0x2895ce[_0xab75('0x45')],null))[_0xab75('0x23')](respondWithResult(_0x109ff3,null))[_0xab75('0x3f')](handleError(_0x109ff3,null));};exports[_0xab75('0x24')]=function(_0x150534,_0x4c73d9){return db[_0xab75('0x2a')]['find']({'where':{'id':_0x150534[_0xab75('0x40')]['id']}})[_0xab75('0x23')](handleEntityNotFound(_0x4c73d9,null))[_0xab75('0x23')](removeEntity(_0x4c73d9,null))['catch'](handleError(_0x4c73d9,null));};exports['getFields']=function(_0x566928,_0x279450,_0x321e23){var _0x2950f9={};var _0x106e05={};var _0x8dcccd;var _0x481a28;return db[_0xab75('0x2a')][_0xab75('0x46')]({'where':{'id':_0x566928['params']['id']}})['then'](handleEntityNotFound(_0x279450,null))[_0xab75('0x23')](function(_0xc28583){if(_0xc28583){_0x8dcccd=_0xc28583;_0x106e05[_0xab75('0x31')]=_[_0xab75('0x2f')](db[_0xab75('0x47')][_0xab75('0x41')]);_0x106e05[_0xab75('0x2e')]=_['keys'](_0x566928[_0xab75('0x2e')]);_0x106e05[_0xab75('0x30')]=_['intersection'](_0x106e05[_0xab75('0x31')],_0x106e05[_0xab75('0x2e')]);_0x2950f9[_0xab75('0x34')]=_[_0xab75('0x32')](_0x106e05[_0xab75('0x31')],qs['fields'](_0x566928['query'][_0xab75('0x33')]));_0x2950f9[_0xab75('0x34')]=_0x2950f9[_0xab75('0x34')][_0xab75('0x42')]?_0x2950f9[_0xab75('0x34')]:_0x106e05[_0xab75('0x31')];_0x2950f9[_0xab75('0x48')]=qs[_0xab75('0x36')](_0x566928[_0xab75('0x2e')][_0xab75('0x36')]);_0x2950f9[_0xab75('0x38')]=qs[_0xab75('0x30')](_[_0xab75('0x49')](_0x566928[_0xab75('0x2e')],_0x106e05[_0xab75('0x30')]));if(_0x566928[_0xab75('0x2e')][_0xab75('0x37')]){_0x2950f9[_0xab75('0x38')]=_[_0xab75('0x39')](_0x2950f9[_0xab75('0x38')],{'$or':_[_0xab75('0x29')](_0x2950f9['attributes'],function(_0x37a5b5){var _0x40247a={};_0x40247a[_0x37a5b5]={'$like':'%'+_0x566928[_0xab75('0x2e')][_0xab75('0x37')]+'%'};return _0x40247a;})});}_0x2950f9=_[_0xab75('0x39')]({},_0x2950f9,_0x566928[_0xab75('0x3b')]);return _0x8dcccd[_0xab75('0x4a')](_0x2950f9);}})['then'](function(_0x30032d){if(_0x30032d){_0x481a28=_0x30032d['length'];if(!_0x566928[_0xab75('0x2e')][_0xab75('0x35')](_0xab75('0x4b'))){_0x2950f9[_0xab75('0x1e')]=qs[_0xab75('0x1e')](_0x566928[_0xab75('0x2e')][_0xab75('0x1e')]);_0x2950f9[_0xab75('0x1c')]=qs[_0xab75('0x1c')](_0x566928[_0xab75('0x2e')][_0xab75('0x1c')]);}return _0x8dcccd[_0xab75('0x4a')](_0x2950f9);}})[_0xab75('0x23')](function(_0x71bb1f){if(_0x71bb1f){return _0x71bb1f?{'count':_0x481a28,'rows':_0x71bb1f}:null;}})[_0xab75('0x23')](respondWithResult(_0x279450,null))[_0xab75('0x3f')](handleError(_0x279450,null));};exports['getSubjects']=function(_0x599c25,_0x20f169,_0x17c5f6){var _0x2fb562={};var _0x4ed15d={};var _0x2213dd;var _0x46affe;return db['ServicenowConfiguration'][_0xab75('0x46')]({'where':{'id':_0x599c25['params']['id']}})[_0xab75('0x23')](handleEntityNotFound(_0x20f169,null))[_0xab75('0x23')](function(_0xffaa3f){if(_0xffaa3f){_0x2213dd=_0xffaa3f;_0x4ed15d[_0xab75('0x31')]=_[_0xab75('0x2f')](db[_0xab75('0x47')][_0xab75('0x41')]);_0x4ed15d['query']=_[_0xab75('0x2f')](_0x599c25[_0xab75('0x2e')]);_0x4ed15d[_0xab75('0x30')]=_[_0xab75('0x32')](_0x4ed15d['model'],_0x4ed15d[_0xab75('0x2e')]);_0x2fb562['attributes']=_[_0xab75('0x32')](_0x4ed15d[_0xab75('0x31')],qs[_0xab75('0x33')](_0x599c25['query']['fields']));_0x2fb562[_0xab75('0x34')]=_0x2fb562[_0xab75('0x34')][_0xab75('0x42')]?_0x2fb562['attributes']:_0x4ed15d[_0xab75('0x31')];_0x2fb562[_0xab75('0x48')]=qs[_0xab75('0x36')](_0x599c25[_0xab75('0x2e')]['sort']);_0x2fb562['where']=qs[_0xab75('0x30')](_['pick'](_0x599c25[_0xab75('0x2e')],_0x4ed15d['filters']));if(_0x599c25[_0xab75('0x2e')][_0xab75('0x37')]){_0x2fb562[_0xab75('0x38')]=_[_0xab75('0x39')](_0x2fb562[_0xab75('0x38')],{'$or':_[_0xab75('0x29')](_0x2fb562['attributes'],function(_0x3095fc){var _0x18a83b={};_0x18a83b[_0x3095fc]={'$like':'%'+_0x599c25[_0xab75('0x2e')][_0xab75('0x37')]+'%'};return _0x18a83b;})});}_0x2fb562=_[_0xab75('0x39')]({},_0x2fb562,_0x599c25[_0xab75('0x3b')]);return _0x2213dd[_0xab75('0x4c')](_0x2fb562);}})[_0xab75('0x23')](function(_0x55df79){if(_0x55df79){_0x46affe=_0x55df79[_0xab75('0x42')];if(!_0x599c25['query'][_0xab75('0x35')](_0xab75('0x4b'))){_0x2fb562[_0xab75('0x1e')]=qs[_0xab75('0x1e')](_0x599c25[_0xab75('0x2e')][_0xab75('0x1e')]);_0x2fb562[_0xab75('0x1c')]=qs[_0xab75('0x1c')](_0x599c25[_0xab75('0x2e')]['offset']);}return _0x2213dd[_0xab75('0x4c')](_0x2fb562);}})[_0xab75('0x23')](function(_0x1f156c){if(_0x1f156c){return _0x1f156c?{'count':_0x46affe,'rows':_0x1f156c}:null;}})['then'](respondWithResult(_0x20f169,null))['catch'](handleError(_0x20f169,null));};exports[_0xab75('0x4d')]=function(_0x2f9a91,_0x2691f0,_0x37257b){var _0x3cd060={};var _0x2a7be3={};var _0x4ee9ff;var _0x6ff9e4;return db[_0xab75('0x2a')]['findOne']({'where':{'id':_0x2f9a91[_0xab75('0x40')]['id']}})['then'](handleEntityNotFound(_0x2691f0,null))[_0xab75('0x23')](function(_0x15f540){if(_0x15f540){_0x4ee9ff=_0x15f540;_0x2a7be3['model']=_['keys'](db[_0xab75('0x47')][_0xab75('0x41')]);_0x2a7be3[_0xab75('0x2e')]=_[_0xab75('0x2f')](_0x2f9a91[_0xab75('0x2e')]);_0x2a7be3[_0xab75('0x30')]=_[_0xab75('0x32')](_0x2a7be3[_0xab75('0x31')],_0x2a7be3[_0xab75('0x2e')]);_0x3cd060[_0xab75('0x34')]=_[_0xab75('0x32')](_0x2a7be3[_0xab75('0x31')],qs[_0xab75('0x33')](_0x2f9a91[_0xab75('0x2e')][_0xab75('0x33')]));_0x3cd060['attributes']=_0x3cd060[_0xab75('0x34')]['length']?_0x3cd060[_0xab75('0x34')]:_0x2a7be3[_0xab75('0x31')];_0x3cd060[_0xab75('0x48')]=qs['sort'](_0x2f9a91[_0xab75('0x2e')][_0xab75('0x36')]);_0x3cd060[_0xab75('0x38')]=qs['filters'](_[_0xab75('0x49')](_0x2f9a91[_0xab75('0x2e')],_0x2a7be3[_0xab75('0x30')]));if(_0x2f9a91[_0xab75('0x2e')]['filter']){_0x3cd060[_0xab75('0x38')]=_[_0xab75('0x39')](_0x3cd060[_0xab75('0x38')],{'$or':_['map'](_0x3cd060[_0xab75('0x34')],function(_0x3e407e){var _0x1fce8a={};_0x1fce8a[_0x3e407e]={'$like':'%'+_0x2f9a91[_0xab75('0x2e')][_0xab75('0x37')]+'%'};return _0x1fce8a;})});}_0x3cd060=_['merge']({},_0x3cd060,_0x2f9a91[_0xab75('0x3b')]);return _0x4ee9ff['getDescriptions'](_0x3cd060);}})[_0xab75('0x23')](function(_0x48a7c4){if(_0x48a7c4){_0x6ff9e4=_0x48a7c4[_0xab75('0x42')];if(!_0x2f9a91['query'][_0xab75('0x35')](_0xab75('0x4b'))){_0x3cd060[_0xab75('0x1e')]=qs['limit'](_0x2f9a91[_0xab75('0x2e')][_0xab75('0x1e')]);_0x3cd060['offset']=qs[_0xab75('0x1c')](_0x2f9a91[_0xab75('0x2e')][_0xab75('0x1c')]);}return _0x4ee9ff[_0xab75('0x4d')](_0x3cd060);}})['then'](function(_0x5b3f23){if(_0x5b3f23){return _0x5b3f23?{'count':_0x6ff9e4,'rows':_0x5b3f23}:null;}})[_0xab75('0x23')](respondWithResult(_0x2691f0,null))[_0xab75('0x3f')](handleError(_0x2691f0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 882df9e..b0c9ee1 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 _0x5d86=['int_servicenow_configurations','lodash','util','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x3b1e94,_0x1c94c4){var _0x1b03b5=function(_0x1f699d){while(--_0x1f699d){_0x3b1e94['push'](_0x3b1e94['shift']());}};_0x1b03b5(++_0x1c94c4);}(_0x5d86,0x76));var _0x65d8=function(_0x3805e9,_0x33a4ed){_0x3805e9=_0x3805e9-0x0;var _0x207e20=_0x5d86[_0x3805e9];return _0x207e20;};'use strict';var _=require(_0x65d8('0x0'));var util=require(_0x65d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x65d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x65d8('0x3'));var fs=require('fs');var path=require(_0x65d8('0x4'));var rimraf=require('rimraf');var config=require(_0x65d8('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x65d8('0x6')]=function(_0x50c922,_0x1581a6){return _0x50c922[_0x65d8('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0x65d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80cd=['ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports'];(function(_0x2ee959,_0x3fa60c){var _0x196560=function(_0x43d3d5){while(--_0x43d3d5){_0x2ee959['push'](_0x2ee959['shift']());}};_0x196560(++_0x3fa60c);}(_0x80cd,0x146));var _0xd80c=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x80cd[_0x19b84f];return _0x18067b;};'use strict';var _=require('lodash');var util=require(_0xd80c('0x0'));var logger=require(_0xd80c('0x1'))(_0xd80c('0x2'));var moment=require(_0xd80c('0x3'));var BPromise=require(_0xd80c('0x4'));var rp=require(_0xd80c('0x5'));var fs=require('fs');var path=require(_0xd80c('0x6'));var rimraf=require(_0xd80c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd80c('0x8'));module[_0xd80c('0x9')]=function(_0x21149c,_0x46dfa0){return _0x21149c['define'](_0xd80c('0xa'),attributes,{'tableName':_0xd80c('0xb'),'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 16bf232..0ac48b3 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 _0x2e57=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2624ec,_0x28f08f){var _0x3e7e23=function(_0x1624c6){while(--_0x1624c6){_0x2624ec['push'](_0x2624ec['shift']());}};_0x3e7e23(++_0x28f08f);}(_0x2e57,0x1cc));var _0x72e5=function(_0xa70c52,_0x523aee){_0xa70c52=_0xa70c52-0x0;var _0x359238=_0x2e57[_0xa70c52];return _0x359238;};'use strict';var _=require(_0x72e5('0x0'));var util=require(_0x72e5('0x1'));var moment=require(_0x72e5('0x2'));var BPromise=require(_0x72e5('0x3'));var rs=require(_0x72e5('0x4'));var fs=require('fs');var Redis=require(_0x72e5('0x5'));var db=require(_0x72e5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x72e5('0x7'));var config=require(_0x72e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x72e5('0x9')][_0x72e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x894733,_0x122bbc,_0x528b6b){return new BPromise(function(_0x41fd28,_0x4c4326){return client[_0x72e5('0xb')](_0x894733,_0x528b6b)['then'](function(_0x4f189b){logger[_0x72e5('0xc')](_0x72e5('0xd'),_0x122bbc,_0x72e5('0xe'));logger['debug'](_0x72e5('0xf'),_0x122bbc,_0x72e5('0xe'),JSON[_0x72e5('0x10')](_0x4f189b));if(_0x4f189b[_0x72e5('0x11')]){if(_0x4f189b['error'][_0x72e5('0x12')]===0x1f4){logger['error'](_0x72e5('0xd'),_0x122bbc,_0x4f189b[_0x72e5('0x11')][_0x72e5('0x13')]);return _0x4c4326(_0x4f189b[_0x72e5('0x11')][_0x72e5('0x13')]);}logger[_0x72e5('0x11')](_0x72e5('0xd'),_0x122bbc,_0x4f189b[_0x72e5('0x11')][_0x72e5('0x13')]);return _0x41fd28(_0x4f189b[_0x72e5('0x11')][_0x72e5('0x13')]);}else{logger[_0x72e5('0xc')](_0x72e5('0xd'),_0x122bbc,_0x72e5('0xe'));_0x41fd28(_0x4f189b[_0x72e5('0x14')]['message']);}})[_0x72e5('0x15')](function(_0xf695e4){logger[_0x72e5('0x11')](_0x72e5('0xd'),_0x122bbc,_0xf695e4);_0x4c4326(_0xf695e4);});});} \ No newline at end of file +var _0x30b3=['http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2484ad,_0x1b7050){var _0x432e28=function(_0x22dbc4){while(--_0x22dbc4){_0x2484ad['push'](_0x2484ad['shift']());}};_0x432e28(++_0x1b7050);}(_0x30b3,0x1c4));var _0x330b=function(_0x39b316,_0x3def1e){_0x39b316=_0x39b316-0x0;var _0x182ab1=_0x30b3[_0x39b316];return _0x182ab1;};'use strict';var _=require('lodash');var util=require(_0x330b('0x0'));var moment=require('moment');var BPromise=require(_0x330b('0x1'));var rs=require(_0x330b('0x2'));var fs=require('fs');var Redis=require(_0x330b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x330b('0x4'));var logger=require(_0x330b('0x5'))(_0x330b('0x6'));var config=require(_0x330b('0x7'));var jayson=require(_0x330b('0x8'));var client=jayson[_0x330b('0x9')][_0x330b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d23e0,_0x46e078,_0xdb0025){return new BPromise(function(_0x4eea77,_0x2b5de1){return client[_0x330b('0xb')](_0x4d23e0,_0xdb0025)['then'](function(_0x2df215){logger['info'](_0x330b('0xc'),_0x46e078,_0x330b('0xd'));logger[_0x330b('0xe')](_0x330b('0xf'),_0x46e078,'request\x20sent',JSON[_0x330b('0x10')](_0x2df215));if(_0x2df215[_0x330b('0x11')]){if(_0x2df215[_0x330b('0x11')][_0x330b('0x12')]===0x1f4){logger[_0x330b('0x11')](_0x330b('0xc'),_0x46e078,_0x2df215[_0x330b('0x11')][_0x330b('0x13')]);return _0x2b5de1(_0x2df215['error']['message']);}logger[_0x330b('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x46e078,_0x2df215[_0x330b('0x11')][_0x330b('0x13')]);return _0x4eea77(_0x2df215[_0x330b('0x11')]['message']);}else{logger['info'](_0x330b('0xc'),_0x46e078,_0x330b('0xd'));_0x4eea77(_0x2df215[_0x330b('0x14')][_0x330b('0x13')]);}})[_0x330b('0x15')](function(_0x3c5b74){logger[_0x330b('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x46e078,_0x3c5b74);_0x2b5de1(_0x3c5b74);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b52b11c..a25a9b6 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 _0x6a72=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put','update','destroy','util','connect-timeout'];(function(_0x691f6f,_0x56123d){var _0x12f6bf=function(_0x2cefae){while(--_0x2cefae){_0x691f6f['push'](_0x691f6f['shift']());}};_0x12f6bf(++_0x56123d);}(_0x6a72,0x19e));var _0x26a7=function(_0x450536,_0x18f463){_0x450536=_0x450536-0x0;var _0x359f6f=_0x6a72[_0x450536];return _0x359f6f;};'use strict';var multer=require('multer');var util=require(_0x26a7('0x0'));var path=require('path');var timeout=require(_0x26a7('0x1'));var express=require(_0x26a7('0x2'));var router=express[_0x26a7('0x3')]();var fs_extra=require(_0x26a7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x26a7('0x5'));var config=require(_0x26a7('0x6'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x26a7('0x7')](),controller[_0x26a7('0x8')]);router[_0x26a7('0x9')](_0x26a7('0xa'),auth[_0x26a7('0x7')](),controller[_0x26a7('0xb')]);router['post']('/',auth[_0x26a7('0x7')](),controller[_0x26a7('0xc')]);router[_0x26a7('0xd')](_0x26a7('0xa'),auth['isAuthenticated'](),controller[_0x26a7('0xe')]);router['delete']('/:id',auth[_0x26a7('0x7')](),controller[_0x26a7('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2f7c=['post','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x5c0d7b,_0x2dac67){var _0x32098e=function(_0x4b45cb){while(--_0x4b45cb){_0x5c0d7b['push'](_0x5c0d7b['shift']());}};_0x32098e(++_0x2dac67);}(_0x2f7c,0x127));var _0xc2f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2f7c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc2f7('0x0'));var util=require('util');var path=require(_0xc2f7('0x1'));var timeout=require('connect-timeout');var express=require(_0xc2f7('0x2'));var router=express[_0xc2f7('0x3')]();var fs_extra=require(_0xc2f7('0x4'));var auth=require(_0xc2f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc2f7('0x6'));var controller=require(_0xc2f7('0x7'));router[_0xc2f7('0x8')]('/',auth[_0xc2f7('0x9')](),controller[_0xc2f7('0xa')]);router[_0xc2f7('0x8')]('/:id',auth[_0xc2f7('0x9')](),controller['show']);router[_0xc2f7('0xb')]('/',auth[_0xc2f7('0x9')](),controller['create']);router[_0xc2f7('0xc')](_0xc2f7('0xd'),auth[_0xc2f7('0x9')](),controller[_0xc2f7('0xe')]);router[_0xc2f7('0xf')](_0xc2f7('0xd'),auth[_0xc2f7('0x9')](),controller[_0xc2f7('0x10')]);module[_0xc2f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 34a58b4..7684947 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 _0xb1e3=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x1b2161,_0x3d9f64){var _0x4e5851=function(_0x5aabe1){while(--_0x5aabe1){_0x1b2161['push'](_0x1b2161['shift']());}};_0x4e5851(++_0x3d9f64);}(_0xb1e3,0x1b3));var _0x3b1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3b1e('0x0'));module[_0x3b1e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3b1e('0x2'),_0x3b1e('0x3'),_0x3b1e('0x4'),'keyValue',_0x3b1e('0x5')),'defaultValue':_0x3b1e('0x2')},'content':{'type':Sequelize[_0x3b1e('0x6')]},'key':{'type':Sequelize[_0x3b1e('0x6')]},'keyType':{'type':Sequelize[_0x3b1e('0x7')](_0x3b1e('0x2'),_0x3b1e('0x3'),_0x3b1e('0x4'))},'keyContent':{'type':Sequelize[_0x3b1e('0x6')]},'idField':{'type':Sequelize[_0x3b1e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3b1e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b1e('0x6')]}}; \ No newline at end of file +var _0x700d=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x700d,0xbb));var _0xd700=function(_0x5b84ad,_0x1b5708){_0x5b84ad=_0x5b84ad-0x0;var _0x4db22d=_0x700d[_0x5b84ad];return _0x4db22d;};'use strict';var Sequelize=require(_0xd700('0x0'));module[_0xd700('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd700('0x2'),_0xd700('0x3'),_0xd700('0x4'),_0xd700('0x5'),_0xd700('0x6')),'defaultValue':_0xd700('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd700('0x7')]},'keyType':{'type':Sequelize[_0xd700('0x8')](_0xd700('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xd700('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd700('0x7')]},'customField':{'type':Sequelize[_0xd700('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd700('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 39ce5fb..613a51d 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 _0xb6d3=['filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','update','then','destroy','error','name','send','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb6d3,0x12a));var _0x3b6d=function(_0x5257f4,_0x54558d){_0x5257f4=_0x5257f4-0x0;var _0x463559=_0xb6d3[_0x5257f4];return _0x463559;};'use strict';var emlformat=require(_0x3b6d('0x0'));var rimraf=require(_0x3b6d('0x1'));var zipdir=require(_0x3b6d('0x2'));var jsonpatch=require(_0x3b6d('0x3'));var rp=require(_0x3b6d('0x4'));var moment=require(_0x3b6d('0x5'));var BPromise=require(_0x3b6d('0x6'));var Mustache=require(_0x3b6d('0x7'));var util=require(_0x3b6d('0x8'));var path=require(_0x3b6d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b6d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b6d('0xb'));var squel=require(_0x3b6d('0xc'));var crypto=require(_0x3b6d('0xd'));var jsforce=require(_0x3b6d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3b6d('0xf'));var querystring=require(_0x3b6d('0x10'));var Papa=require(_0x3b6d('0x11'));var Redis=require(_0x3b6d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3b6d('0x13'));var as=require(_0x3b6d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b6d('0x15'))(_0x3b6d('0x16'));var utils=require('../../config/utils');var config=require(_0x3b6d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c4aa,_0x39eb86){_0x39eb86=_0x39eb86||0xcc;return function(_0x3cb90a){if(_0x3cb90a){return _0x29c4aa[_0x3b6d('0x18')](_0x39eb86);}return _0x29c4aa[_0x3b6d('0x19')](_0x39eb86)[_0x3b6d('0x1a')]();};}function respondWithResult(_0x540ca6,_0x2658a5){_0x2658a5=_0x2658a5||0xc8;return function(_0x126907){if(_0x126907){return _0x540ca6[_0x3b6d('0x19')](_0x2658a5)['json'](_0x126907);}};}function respondWithFilteredResult(_0x346ac7,_0x51f3d4){return function(_0x266d66){if(_0x266d66){var _0x68aaf3=typeof _0x51f3d4['offset']===_0x3b6d('0x1b')&&typeof _0x51f3d4[_0x3b6d('0x1c')]===_0x3b6d('0x1b');var _0x1466c4=_0x266d66['count'];var _0x12e656=_0x68aaf3?0x0:_0x51f3d4[_0x3b6d('0x1d')];var _0x4de7ed=_0x68aaf3?_0x266d66[_0x3b6d('0x1e')]:_0x51f3d4[_0x3b6d('0x1d')]+_0x51f3d4[_0x3b6d('0x1c')];var _0x442c0;if(_0x4de7ed>=_0x1466c4){_0x4de7ed=_0x1466c4;_0x442c0=0xc8;}else{_0x442c0=0xce;}_0x346ac7[_0x3b6d('0x19')](_0x442c0);return _0x346ac7['set'](_0x3b6d('0x1f'),_0x12e656+'-'+_0x4de7ed+'/'+_0x1466c4)[_0x3b6d('0x20')](_0x266d66);}return null;};}function patchUpdates(_0x2ccd2a){return function(_0x112969){try{jsonpatch['apply'](_0x112969,_0x2ccd2a,!![]);}catch(_0x284a14){return BPromise['reject'](_0x284a14);}return _0x112969['save']();};}function saveUpdates(_0x2071f9,_0x51cab0){return function(_0x195228){if(_0x195228){return _0x195228[_0x3b6d('0x21')](_0x2071f9)[_0x3b6d('0x22')](function(_0xcc2d3f){return _0xcc2d3f;});}return null;};}function removeEntity(_0x301db7,_0x33f618){return function(_0x4d380f){if(_0x4d380f){return _0x4d380f[_0x3b6d('0x23')]()[_0x3b6d('0x22')](function(){_0x301db7['status'](0xcc)[_0x3b6d('0x1a')]();});}};}function handleEntityNotFound(_0x191b7c,_0x5d059b){return function(_0x533b02){if(!_0x533b02){_0x191b7c[_0x3b6d('0x18')](0x194);}return _0x533b02;};}function handleError(_0x4ecc21,_0x3ad661){_0x3ad661=_0x3ad661||0x1f4;return function(_0x5e1a2f){logger[_0x3b6d('0x24')](_0x5e1a2f['stack']);if(_0x5e1a2f[_0x3b6d('0x25')]){delete _0x5e1a2f[_0x3b6d('0x25')];}_0x4ecc21[_0x3b6d('0x19')](_0x3ad661)[_0x3b6d('0x26')](_0x5e1a2f);};}exports['index']=function(_0x2642fa,_0x4f820b){var _0x3c66d5={},_0x53a576={},_0x5445d0={'count':0x0,'rows':[]};var _0x397534=_['map'](db[_0x3b6d('0x27')][_0x3b6d('0x28')],function(_0xa28c38){return{'name':_0xa28c38[_0x3b6d('0x29')],'type':_0xa28c38[_0x3b6d('0x2a')][_0x3b6d('0x2b')]};});_0x53a576[_0x3b6d('0x2c')]=_[_0x3b6d('0x2d')](_0x397534,_0x3b6d('0x25'));_0x53a576[_0x3b6d('0x2e')]=_[_0x3b6d('0x2f')](_0x2642fa['query']);_0x53a576[_0x3b6d('0x30')]=_[_0x3b6d('0x31')](_0x53a576['model'],_0x53a576['query']);_0x3c66d5['attributes']=_[_0x3b6d('0x31')](_0x53a576['model'],qs[_0x3b6d('0x32')](_0x2642fa['query'][_0x3b6d('0x32')]));_0x3c66d5[_0x3b6d('0x33')]=_0x3c66d5[_0x3b6d('0x33')][_0x3b6d('0x34')]?_0x3c66d5['attributes']:_0x53a576[_0x3b6d('0x2c')];if(!_0x2642fa[_0x3b6d('0x2e')][_0x3b6d('0x35')]('nolimit')){_0x3c66d5['limit']=qs[_0x3b6d('0x1c')](_0x2642fa[_0x3b6d('0x2e')][_0x3b6d('0x1c')]);_0x3c66d5[_0x3b6d('0x1d')]=qs[_0x3b6d('0x1d')](_0x2642fa['query']['offset']);}_0x3c66d5['order']=qs[_0x3b6d('0x36')](_0x2642fa[_0x3b6d('0x2e')][_0x3b6d('0x36')]);_0x3c66d5[_0x3b6d('0x37')]=qs[_0x3b6d('0x30')](_[_0x3b6d('0x38')](_0x2642fa[_0x3b6d('0x2e')],_0x53a576[_0x3b6d('0x30')]),_0x397534);if(_0x2642fa[_0x3b6d('0x2e')][_0x3b6d('0x39')]){_0x3c66d5[_0x3b6d('0x37')]=_[_0x3b6d('0x3a')](_0x3c66d5['where'],{'$or':_['map'](_0x397534,function(_0x3c931c){if(_0x3c931c[_0x3b6d('0x2a')]!==_0x3b6d('0x3b')){var _0x368359={};_0x368359[_0x3c931c[_0x3b6d('0x25')]]={'$like':'%'+_0x2642fa[_0x3b6d('0x2e')]['filter']+'%'};return _0x368359;}})});}_0x3c66d5=_[_0x3b6d('0x3a')]({},_0x3c66d5,_0x2642fa[_0x3b6d('0x3c')]);var _0xc0b856={'where':_0x3c66d5['where']};return db[_0x3b6d('0x27')]['count'](_0xc0b856)['then'](function(_0x2fe7ec){_0x5445d0[_0x3b6d('0x1e')]=_0x2fe7ec;if(_0x2642fa[_0x3b6d('0x2e')][_0x3b6d('0x3d')]){_0x3c66d5['include']=[{'all':!![]}];}return db['ServicenowField'][_0x3b6d('0x3e')](_0x3c66d5);})['then'](function(_0x38dc25){_0x5445d0[_0x3b6d('0x3f')]=_0x38dc25;return _0x5445d0;})[_0x3b6d('0x22')](respondWithFilteredResult(_0x4f820b,_0x3c66d5))[_0x3b6d('0x40')](handleError(_0x4f820b,null));};exports[_0x3b6d('0x41')]=function(_0x1782c9,_0x27142f){var _0x4ade5d={'raw':!![],'where':{'id':_0x1782c9['params']['id']}},_0x169356={};_0x169356[_0x3b6d('0x2c')]=_[_0x3b6d('0x2f')](db['ServicenowField'][_0x3b6d('0x28')]);_0x169356['query']=_[_0x3b6d('0x2f')](_0x1782c9[_0x3b6d('0x2e')]);_0x169356[_0x3b6d('0x30')]=_['intersection'](_0x169356[_0x3b6d('0x2c')],_0x169356['query']);_0x4ade5d[_0x3b6d('0x33')]=_['intersection'](_0x169356[_0x3b6d('0x2c')],qs[_0x3b6d('0x32')](_0x1782c9[_0x3b6d('0x2e')][_0x3b6d('0x32')]));_0x4ade5d[_0x3b6d('0x33')]=_0x4ade5d[_0x3b6d('0x33')][_0x3b6d('0x34')]?_0x4ade5d[_0x3b6d('0x33')]:_0x169356['model'];if(_0x1782c9[_0x3b6d('0x2e')]['includeAll']){_0x4ade5d[_0x3b6d('0x42')]=[{'all':!![]}];}_0x4ade5d=_[_0x3b6d('0x3a')]({},_0x4ade5d,_0x1782c9[_0x3b6d('0x3c')]);return db[_0x3b6d('0x27')][_0x3b6d('0x43')](_0x4ade5d)['then'](handleEntityNotFound(_0x27142f,null))[_0x3b6d('0x22')](respondWithResult(_0x27142f,null))[_0x3b6d('0x40')](handleError(_0x27142f,null));};exports[_0x3b6d('0x44')]=function(_0x5a2bb8,_0x46bf62){return db[_0x3b6d('0x27')][_0x3b6d('0x44')](_0x5a2bb8[_0x3b6d('0x45')],{})[_0x3b6d('0x22')](respondWithResult(_0x46bf62,0xc9))[_0x3b6d('0x40')](handleError(_0x46bf62,null));};exports[_0x3b6d('0x21')]=function(_0xd9e711,_0x3a83d2){if(_0xd9e711['body']['id']){delete _0xd9e711[_0x3b6d('0x45')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0xd9e711['params']['id']}})['then'](handleEntityNotFound(_0x3a83d2,null))[_0x3b6d('0x22')](saveUpdates(_0xd9e711[_0x3b6d('0x45')],null))[_0x3b6d('0x22')](respondWithResult(_0x3a83d2,null))['catch'](handleError(_0x3a83d2,null));};exports[_0x3b6d('0x23')]=function(_0x28adbb,_0x551ed3){return db['ServicenowField'][_0x3b6d('0x43')]({'where':{'id':_0x28adbb[_0x3b6d('0x46')]['id']}})[_0x3b6d('0x22')](handleEntityNotFound(_0x551ed3,null))[_0x3b6d('0x22')](removeEntity(_0x551ed3,null))['catch'](handleError(_0x551ed3,null));}; \ No newline at end of file +var _0x8805=['update','then','destroy','error','stack','name','send','index','map','ServicenowField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','rawAttributes','includeAll','options','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x377d53,_0x1f6804){var _0x59eaf4=function(_0x215373){while(--_0x215373){_0x377d53['push'](_0x377d53['shift']());}};_0x59eaf4(++_0x1f6804);}(_0x8805,0x74));var _0x5880=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x8805[_0x4eab61];return _0x342426;};'use strict';var emlformat=require(_0x5880('0x0'));var rimraf=require(_0x5880('0x1'));var zipdir=require(_0x5880('0x2'));var jsonpatch=require(_0x5880('0x3'));var rp=require(_0x5880('0x4'));var moment=require(_0x5880('0x5'));var BPromise=require(_0x5880('0x6'));var Mustache=require(_0x5880('0x7'));var util=require(_0x5880('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5880('0x9'));var ejs=require(_0x5880('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5880('0xb'));var squel=require(_0x5880('0xc'));var crypto=require('crypto');var jsforce=require(_0x5880('0xd'));var deskjs=require(_0x5880('0xe'));var toCsv=require(_0x5880('0x9'));var querystring=require(_0x5880('0xf'));var Papa=require('papaparse');var Redis=require(_0x5880('0x10'));var authService=require(_0x5880('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5880('0x12'));var hardwareService=require(_0x5880('0x13'));var logger=require(_0x5880('0x14'))('api');var utils=require(_0x5880('0x15'));var config=require(_0x5880('0x16'));var licenseUtil=require(_0x5880('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x598466,_0x327278){_0x327278=_0x327278||0xcc;return function(_0x3e13b5){if(_0x3e13b5){return _0x598466[_0x5880('0x18')](_0x327278);}return _0x598466['status'](_0x327278)[_0x5880('0x19')]();};}function respondWithResult(_0xc2f4e5,_0x43d5f1){_0x43d5f1=_0x43d5f1||0xc8;return function(_0x8d78e6){if(_0x8d78e6){return _0xc2f4e5[_0x5880('0x1a')](_0x43d5f1)[_0x5880('0x1b')](_0x8d78e6);}};}function respondWithFilteredResult(_0x1dbce5,_0xa849ed){return function(_0x3eaab2){if(_0x3eaab2){var _0x2c19b7=typeof _0xa849ed[_0x5880('0x1c')]===_0x5880('0x1d')&&typeof _0xa849ed[_0x5880('0x1e')]===_0x5880('0x1d');var _0x5113c3=_0x3eaab2[_0x5880('0x1f')];var _0xdcedd=_0x2c19b7?0x0:_0xa849ed[_0x5880('0x1c')];var _0x1cfc21=_0x2c19b7?_0x3eaab2[_0x5880('0x1f')]:_0xa849ed[_0x5880('0x1c')]+_0xa849ed['limit'];var _0x1381fd;if(_0x1cfc21>=_0x5113c3){_0x1cfc21=_0x5113c3;_0x1381fd=0xc8;}else{_0x1381fd=0xce;}_0x1dbce5[_0x5880('0x1a')](_0x1381fd);return _0x1dbce5[_0x5880('0x20')]('Content-Range',_0xdcedd+'-'+_0x1cfc21+'/'+_0x5113c3)[_0x5880('0x1b')](_0x3eaab2);}return null;};}function patchUpdates(_0x48c882){return function(_0x1c5e66){try{jsonpatch[_0x5880('0x21')](_0x1c5e66,_0x48c882,!![]);}catch(_0x57f0b9){return BPromise[_0x5880('0x22')](_0x57f0b9);}return _0x1c5e66[_0x5880('0x23')]();};}function saveUpdates(_0x6282cd,_0x3971f8){return function(_0x26a2bf){if(_0x26a2bf){return _0x26a2bf[_0x5880('0x24')](_0x6282cd)[_0x5880('0x25')](function(_0x5d8d07){return _0x5d8d07;});}return null;};}function removeEntity(_0x14de7f,_0x183dda){return function(_0x4f86ac){if(_0x4f86ac){return _0x4f86ac[_0x5880('0x26')]()['then'](function(){_0x14de7f[_0x5880('0x1a')](0xcc)[_0x5880('0x19')]();});}};}function handleEntityNotFound(_0x52b053,_0x4d2c15){return function(_0x39dcbe){if(!_0x39dcbe){_0x52b053[_0x5880('0x18')](0x194);}return _0x39dcbe;};}function handleError(_0x1106bb,_0x4b769e){_0x4b769e=_0x4b769e||0x1f4;return function(_0x259e67){logger[_0x5880('0x27')](_0x259e67[_0x5880('0x28')]);if(_0x259e67[_0x5880('0x29')]){delete _0x259e67[_0x5880('0x29')];}_0x1106bb[_0x5880('0x1a')](_0x4b769e)[_0x5880('0x2a')](_0x259e67);};}exports[_0x5880('0x2b')]=function(_0xc69273,_0x40afd4){var _0x540f0e={},_0x219da2={},_0x1da201={'count':0x0,'rows':[]};var _0xdafbd3=_[_0x5880('0x2c')](db[_0x5880('0x2d')]['rawAttributes'],function(_0x4d9d31){return{'name':_0x4d9d31[_0x5880('0x2e')],'type':_0x4d9d31[_0x5880('0x2f')][_0x5880('0x30')]};});_0x219da2[_0x5880('0x31')]=_['map'](_0xdafbd3,_0x5880('0x29'));_0x219da2[_0x5880('0x32')]=_[_0x5880('0x33')](_0xc69273[_0x5880('0x32')]);_0x219da2[_0x5880('0x34')]=_['intersection'](_0x219da2[_0x5880('0x31')],_0x219da2[_0x5880('0x32')]);_0x540f0e['attributes']=_[_0x5880('0x35')](_0x219da2['model'],qs[_0x5880('0x36')](_0xc69273[_0x5880('0x32')][_0x5880('0x36')]));_0x540f0e[_0x5880('0x37')]=_0x540f0e['attributes'][_0x5880('0x38')]?_0x540f0e[_0x5880('0x37')]:_0x219da2[_0x5880('0x31')];if(!_0xc69273[_0x5880('0x32')]['hasOwnProperty'](_0x5880('0x39'))){_0x540f0e[_0x5880('0x1e')]=qs[_0x5880('0x1e')](_0xc69273[_0x5880('0x32')][_0x5880('0x1e')]);_0x540f0e[_0x5880('0x1c')]=qs[_0x5880('0x1c')](_0xc69273[_0x5880('0x32')][_0x5880('0x1c')]);}_0x540f0e[_0x5880('0x3a')]=qs[_0x5880('0x3b')](_0xc69273[_0x5880('0x32')]['sort']);_0x540f0e[_0x5880('0x3c')]=qs[_0x5880('0x34')](_[_0x5880('0x3d')](_0xc69273['query'],_0x219da2[_0x5880('0x34')]),_0xdafbd3);if(_0xc69273[_0x5880('0x32')][_0x5880('0x3e')]){_0x540f0e['where']=_[_0x5880('0x3f')](_0x540f0e[_0x5880('0x3c')],{'$or':_[_0x5880('0x2c')](_0xdafbd3,function(_0x5ed89c){if(_0x5ed89c[_0x5880('0x2f')]!==_0x5880('0x40')){var _0x11dbaf={};_0x11dbaf[_0x5ed89c['name']]={'$like':'%'+_0xc69273[_0x5880('0x32')][_0x5880('0x3e')]+'%'};return _0x11dbaf;}})});}_0x540f0e=_['merge']({},_0x540f0e,_0xc69273['options']);var _0x221cd9={'where':_0x540f0e[_0x5880('0x3c')]};return db['ServicenowField'][_0x5880('0x1f')](_0x221cd9)[_0x5880('0x25')](function(_0xf5ee7a){_0x1da201['count']=_0xf5ee7a;if(_0xc69273[_0x5880('0x32')]['includeAll']){_0x540f0e[_0x5880('0x41')]=[{'all':!![]}];}return db[_0x5880('0x2d')][_0x5880('0x42')](_0x540f0e);})[_0x5880('0x25')](function(_0x350a9e){_0x1da201[_0x5880('0x43')]=_0x350a9e;return _0x1da201;})['then'](respondWithFilteredResult(_0x40afd4,_0x540f0e))[_0x5880('0x44')](handleError(_0x40afd4,null));};exports['show']=function(_0x3018d4,_0x4a917e){var _0x8633b6={'raw':!![],'where':{'id':_0x3018d4['params']['id']}},_0x3d348b={};_0x3d348b[_0x5880('0x31')]=_[_0x5880('0x33')](db['ServicenowField'][_0x5880('0x45')]);_0x3d348b['query']=_[_0x5880('0x33')](_0x3018d4[_0x5880('0x32')]);_0x3d348b[_0x5880('0x34')]=_[_0x5880('0x35')](_0x3d348b[_0x5880('0x31')],_0x3d348b[_0x5880('0x32')]);_0x8633b6['attributes']=_[_0x5880('0x35')](_0x3d348b[_0x5880('0x31')],qs['fields'](_0x3018d4[_0x5880('0x32')]['fields']));_0x8633b6[_0x5880('0x37')]=_0x8633b6['attributes'][_0x5880('0x38')]?_0x8633b6['attributes']:_0x3d348b[_0x5880('0x31')];if(_0x3018d4[_0x5880('0x32')][_0x5880('0x46')]){_0x8633b6['include']=[{'all':!![]}];}_0x8633b6=_['merge']({},_0x8633b6,_0x3018d4[_0x5880('0x47')]);return db[_0x5880('0x2d')]['find'](_0x8633b6)[_0x5880('0x25')](handleEntityNotFound(_0x4a917e,null))[_0x5880('0x25')](respondWithResult(_0x4a917e,null))[_0x5880('0x44')](handleError(_0x4a917e,null));};exports['create']=function(_0x4449b7,_0x518652){return db['ServicenowField'][_0x5880('0x48')](_0x4449b7[_0x5880('0x49')],{})[_0x5880('0x25')](respondWithResult(_0x518652,0xc9))[_0x5880('0x44')](handleError(_0x518652,null));};exports[_0x5880('0x24')]=function(_0x4ac09c,_0x2c9d16){if(_0x4ac09c[_0x5880('0x49')]['id']){delete _0x4ac09c[_0x5880('0x49')]['id'];}return db[_0x5880('0x2d')]['find']({'where':{'id':_0x4ac09c[_0x5880('0x4a')]['id']}})[_0x5880('0x25')](handleEntityNotFound(_0x2c9d16,null))['then'](saveUpdates(_0x4ac09c['body'],null))[_0x5880('0x25')](respondWithResult(_0x2c9d16,null))[_0x5880('0x44')](handleError(_0x2c9d16,null));};exports[_0x5880('0x26')]=function(_0x52a4f8,_0x1ffe6b){return db[_0x5880('0x2d')][_0x5880('0x4b')]({'where':{'id':_0x52a4f8[_0x5880('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ffe6b,null))[_0x5880('0x25')](removeEntity(_0x1ffe6b,null))['catch'](handleError(_0x1ffe6b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 8b4526d..6e5bd55 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 _0x9310=['../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x2bc6a2,_0x44e6ea){var _0x50f1ce=function(_0x2d3e20){while(--_0x2d3e20){_0x2bc6a2['push'](_0x2bc6a2['shift']());}};_0x50f1ce(++_0x44e6ea);}(_0x9310,0xd3));var _0x0931=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x9310[_0x533528];return _0x3189f1;};'use strict';var _=require(_0x0931('0x0'));var util=require(_0x0931('0x1'));var logger=require(_0x0931('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0931('0x3'));var rp=require(_0x0931('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0931('0x5'));var attributes=require('./intServicenowField.attributes');module[_0x0931('0x6')]=function(_0x1a40c5,_0x3612d4){return _0x1a40c5[_0x0931('0x7')](_0x0931('0x8'),attributes,{'tableName':_0x0931('0x9'),'paranoid':![],'indexes':[{'name':_0x0931('0xa'),'fields':['idField',_0x0931('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc44=['servicenow_unique_index','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','ServicenowField','int_servicenow_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc44,0x1c9));var _0x4cc4=function(_0x581cad,_0x355b2e){_0x581cad=_0x581cad-0x0;var _0x1a9f4b=_0xcc44[_0x581cad];return _0x1a9f4b;};'use strict';var _=require(_0x4cc4('0x0'));var util=require(_0x4cc4('0x1'));var logger=require(_0x4cc4('0x2'))(_0x4cc4('0x3'));var moment=require('moment');var BPromise=require(_0x4cc4('0x4'));var rp=require(_0x4cc4('0x5'));var fs=require('fs');var path=require(_0x4cc4('0x6'));var rimraf=require('rimraf');var config=require(_0x4cc4('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x4cc4('0x8')]=function(_0x59fa70,_0x10c621){return _0x59fa70['define'](_0x4cc4('0x9'),attributes,{'tableName':_0x4cc4('0xa'),'paranoid':![],'indexes':[{'name':_0x4cc4('0xb'),'fields':['idField','FieldId'],'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 e5f00fd..17a804d 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 _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x470721,_0x452576){var _0x5bd7e3=function(_0x59184d){while(--_0x59184d){_0x470721['push'](_0x470721['shift']());}};_0x5bd7e3(++_0x452576);}(_0x9bde,0xe1));var _0xe9bd=function(_0x56e469,_0x1951ed){_0x56e469=_0x56e469-0x0;var _0x353b6a=_0x9bde[_0x56e469];return _0x353b6a;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('ServicenowField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x2bad99,_0x4ebe9b){var _0x501eef=function(_0x5ee754){while(--_0x5ee754){_0x2bad99['push'](_0x2bad99['shift']());}};_0x501eef(++_0x4ebe9b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb7e7[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 8512b7a..41301af 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x59f427,_0x1c9fc1){var _0xae8152=function(_0xe3cb31){while(--_0xe3cb31){_0x59f427['push'](_0x59f427['shift']());}};_0xae8152(++_0x1c9fc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x15bd86,_0x16ec7e){var _0x637eb3=function(_0x4edb07){while(--_0x4edb07){_0x15bd86['push'](_0x15bd86['shift']());}};_0x637eb3(++_0x16ec7e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e8ea198..5973436 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(_0x4ef551,_0x3447c3){var _0xbcad4f=function(_0x650d8c){while(--_0x650d8c){_0x4ef551['push'](_0x4ef551['shift']());}};_0xbcad4f(++_0x3447c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x3c1cc2,_0x20e216){var _0x277110=function(_0x92c75a){while(--_0x92c75a){_0x3c1cc2['push'](_0x3c1cc2['shift']());}};_0x277110(++_0x20e216);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 e2f52d8..52af92b 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 _0x701b=['order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','body','find','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SugarcrmField','getFields','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','remoteUri','slice','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','module_fields','remove','label','endsWith','value','statusCode','error','send','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','index','map','SugarcrmAccount','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit'];(function(_0x179de1,_0x402715){var _0x5558ab=function(_0x48cd09){while(--_0x48cd09){_0x179de1['push'](_0x179de1['shift']());}};_0x5558ab(++_0x402715);}(_0x701b,0xb8));var _0xb701=function(_0x3b89e4,_0x4ce452){_0x3b89e4=_0x3b89e4-0x0;var _0xaf94f4=_0x701b[_0x3b89e4];return _0xaf94f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb701('0x0'));var zipdir=require(_0xb701('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb701('0x2'));var moment=require(_0xb701('0x3'));var BPromise=require(_0xb701('0x4'));var Mustache=require(_0xb701('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb701('0x6'));var csv=require('to-csv');var ejs=require(_0xb701('0x7'));var fs=require('fs');var fs_extra=require(_0xb701('0x8'));var _=require(_0xb701('0x9'));var squel=require('squel');var crypto=require(_0xb701('0xa'));var jsforce=require(_0xb701('0xb'));var deskjs=require(_0xb701('0xc'));var toCsv=require(_0xb701('0xd'));var querystring=require('querystring');var Papa=require(_0xb701('0xe'));var Redis=require(_0xb701('0xf'));var authService=require(_0xb701('0x10'));var qs=require(_0xb701('0x11'));var as=require(_0xb701('0x12'));var hardwareService=require(_0xb701('0x13'));var logger=require(_0xb701('0x14'))(_0xb701('0x15'));var utils=require(_0xb701('0x16'));var config=require(_0xb701('0x17'));var licenseUtil=require(_0xb701('0x18'));var db=require(_0xb701('0x19'))['db'];var integrations=require(_0xb701('0x1a'));function respondWithStatusCode(_0x267a5d,_0x31dfd5){_0x31dfd5=_0x31dfd5||0xcc;return function(_0x2a91a6){if(_0x2a91a6){return _0x267a5d['sendStatus'](_0x31dfd5);}return _0x267a5d[_0xb701('0x1b')](_0x31dfd5)[_0xb701('0x1c')]();};}function respondWithResult(_0x220150,_0x550578){_0x550578=_0x550578||0xc8;return function(_0x1cf8ae){if(_0x1cf8ae){return _0x220150[_0xb701('0x1b')](_0x550578)[_0xb701('0x1d')](_0x1cf8ae);}};}function respondWithFilteredResult(_0x1e9cf7,_0x35a839){return function(_0x4890c2){if(_0x4890c2){var _0x3e4213=typeof _0x35a839[_0xb701('0x1e')]===_0xb701('0x1f')&&typeof _0x35a839[_0xb701('0x20')]===_0xb701('0x1f');var _0x1e0568=_0x4890c2['count'];var _0x54e365=_0x3e4213?0x0:_0x35a839[_0xb701('0x1e')];var _0x57cfb6=_0x3e4213?_0x4890c2[_0xb701('0x21')]:_0x35a839['offset']+_0x35a839[_0xb701('0x20')];var _0x298c97;if(_0x57cfb6>=_0x1e0568){_0x57cfb6=_0x1e0568;_0x298c97=0xc8;}else{_0x298c97=0xce;}_0x1e9cf7[_0xb701('0x1b')](_0x298c97);return _0x1e9cf7[_0xb701('0x22')](_0xb701('0x23'),_0x54e365+'-'+_0x57cfb6+'/'+_0x1e0568)['json'](_0x4890c2);}return null;};}function patchUpdates(_0x4346f8){return function(_0x56dbab){try{jsonpatch[_0xb701('0x24')](_0x56dbab,_0x4346f8,!![]);}catch(_0x45cd6b){return BPromise['reject'](_0x45cd6b);}return _0x56dbab[_0xb701('0x25')]();};}function saveUpdates(_0x1fbf7f,_0x22dc07){return function(_0x22b65d){if(_0x22b65d){return _0x22b65d[_0xb701('0x26')](_0x1fbf7f)[_0xb701('0x27')](function(_0x202528){return _0x202528;});}return null;};}function removeEntity(_0x163625,_0x2d32fe){return function(_0x3a9863){if(_0x3a9863){return _0x3a9863[_0xb701('0x28')]()['then'](function(){_0x163625['status'](0xcc)[_0xb701('0x1c')]();});}};}function handleEntityNotFound(_0x42bc9a,_0x261d0b){return function(_0x18ae07){if(!_0x18ae07){_0x42bc9a[_0xb701('0x29')](0x194);}return _0x18ae07;};}function handleError(_0x4704e8,_0x92f4db){_0x92f4db=_0x92f4db||0x1f4;return function(_0xd33d10){logger['error'](_0xd33d10[_0xb701('0x2a')]);if(_0xd33d10['name']){delete _0xd33d10[_0xb701('0x2b')];}_0x4704e8[_0xb701('0x1b')](_0x92f4db)['send'](_0xd33d10);};}exports[_0xb701('0x2c')]=function(_0x2bdb35,_0x3422ae){var _0x1c9644={},_0x391078={},_0x1b7717={'count':0x0,'rows':[]};var _0x1305ba=_[_0xb701('0x2d')](db[_0xb701('0x2e')][_0xb701('0x2f')],function(_0x28ed80){return{'name':_0x28ed80['fieldName'],'type':_0x28ed80[_0xb701('0x30')][_0xb701('0x31')]};});_0x391078[_0xb701('0x32')]=_[_0xb701('0x2d')](_0x1305ba,_0xb701('0x2b'));_0x391078['query']=_[_0xb701('0x33')](_0x2bdb35[_0xb701('0x34')]);_0x391078[_0xb701('0x35')]=_['intersection'](_0x391078['model'],_0x391078[_0xb701('0x34')]);_0x1c9644['attributes']=_[_0xb701('0x36')](_0x391078['model'],qs[_0xb701('0x37')](_0x2bdb35[_0xb701('0x34')]['fields']));_0x1c9644[_0xb701('0x38')]=_0x1c9644[_0xb701('0x38')]['length']?_0x1c9644[_0xb701('0x38')]:_0x391078[_0xb701('0x32')];if(!_0x2bdb35[_0xb701('0x34')]['hasOwnProperty'](_0xb701('0x39'))){_0x1c9644[_0xb701('0x20')]=qs[_0xb701('0x20')](_0x2bdb35[_0xb701('0x34')][_0xb701('0x20')]);_0x1c9644[_0xb701('0x1e')]=qs['offset'](_0x2bdb35[_0xb701('0x34')][_0xb701('0x1e')]);}_0x1c9644[_0xb701('0x3a')]=qs[_0xb701('0x3b')](_0x2bdb35[_0xb701('0x34')][_0xb701('0x3b')]);_0x1c9644[_0xb701('0x3c')]=qs[_0xb701('0x35')](_[_0xb701('0x3d')](_0x2bdb35['query'],_0x391078[_0xb701('0x35')]),_0x1305ba);if(_0x2bdb35['query'][_0xb701('0x3e')]){_0x1c9644[_0xb701('0x3c')]=_[_0xb701('0x3f')](_0x1c9644['where'],{'$or':_[_0xb701('0x2d')](_0x1305ba,function(_0x3d96d2){if(_0x3d96d2[_0xb701('0x30')]!=='VIRTUAL'){var _0x426fef={};_0x426fef[_0x3d96d2[_0xb701('0x2b')]]={'$like':'%'+_0x2bdb35['query'][_0xb701('0x3e')]+'%'};return _0x426fef;}})});}_0x1c9644=_[_0xb701('0x3f')]({},_0x1c9644,_0x2bdb35[_0xb701('0x40')]);var _0xfcc9e1={'where':_0x1c9644[_0xb701('0x3c')]};return db[_0xb701('0x2e')]['count'](_0xfcc9e1)[_0xb701('0x27')](function(_0xa5292e){_0x1b7717[_0xb701('0x21')]=_0xa5292e;if(_0x2bdb35['query'][_0xb701('0x41')]){_0x1c9644['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0xb701('0x42')](_0x1c9644);})[_0xb701('0x27')](function(_0x40dd79){_0x1b7717[_0xb701('0x43')]=_0x40dd79;return _0x1b7717;})[_0xb701('0x27')](respondWithFilteredResult(_0x3422ae,_0x1c9644))[_0xb701('0x44')](handleError(_0x3422ae,null));};exports[_0xb701('0x45')]=function(_0x66eb5c,_0x3eef4d){var _0x26d321={'raw':![],'where':{'id':_0x66eb5c[_0xb701('0x46')]['id']}},_0x5dccb1={};_0x5dccb1[_0xb701('0x32')]=_[_0xb701('0x33')](db[_0xb701('0x2e')][_0xb701('0x2f')]);_0x5dccb1[_0xb701('0x34')]=_[_0xb701('0x33')](_0x66eb5c[_0xb701('0x34')]);_0x5dccb1[_0xb701('0x35')]=_[_0xb701('0x36')](_0x5dccb1[_0xb701('0x32')],_0x5dccb1[_0xb701('0x34')]);_0x26d321[_0xb701('0x38')]=_['intersection'](_0x5dccb1[_0xb701('0x32')],qs[_0xb701('0x37')](_0x66eb5c['query'][_0xb701('0x37')]));_0x26d321[_0xb701('0x38')]=_0x26d321['attributes'][_0xb701('0x47')]?_0x26d321[_0xb701('0x38')]:_0x5dccb1[_0xb701('0x32')];if(_0x66eb5c[_0xb701('0x34')][_0xb701('0x41')]){_0x26d321[_0xb701('0x48')]=[{'all':!![]}];}_0x26d321=_[_0xb701('0x3f')]({},_0x26d321,_0x66eb5c[_0xb701('0x40')]);return db[_0xb701('0x2e')]['find'](_0x26d321)[_0xb701('0x27')](handleEntityNotFound(_0x3eef4d,null))[_0xb701('0x27')](respondWithResult(_0x3eef4d,null))[_0xb701('0x44')](handleError(_0x3eef4d,null));};exports['create']=function(_0x492574,_0x429861){return db[_0xb701('0x2e')]['create'](_0x492574[_0xb701('0x49')],{})[_0xb701('0x27')](respondWithResult(_0x429861,0xc9))[_0xb701('0x44')](handleError(_0x429861,null));};exports[_0xb701('0x26')]=function(_0x362dd4,_0x2606a9){if(_0x362dd4[_0xb701('0x49')]['id']){delete _0x362dd4[_0xb701('0x49')]['id'];}return db[_0xb701('0x2e')][_0xb701('0x4a')]({'where':{'id':_0x362dd4[_0xb701('0x46')]['id']}})[_0xb701('0x27')](handleEntityNotFound(_0x2606a9,null))[_0xb701('0x27')](saveUpdates(_0x362dd4[_0xb701('0x49')],null))[_0xb701('0x27')](respondWithResult(_0x2606a9,null))[_0xb701('0x44')](handleError(_0x2606a9,null));};exports[_0xb701('0x28')]=function(_0x23fc22,_0x32cc37){return db[_0xb701('0x2e')]['find']({'where':{'id':_0x23fc22[_0xb701('0x46')]['id']}})[_0xb701('0x27')](handleEntityNotFound(_0x32cc37,null))[_0xb701('0x27')](removeEntity(_0x32cc37,null))['catch'](handleError(_0x32cc37,null));};exports[_0xb701('0x4b')]=function(_0x1e0065,_0x11986,_0x2356d4){var _0x32917b={};var _0x451f78={};var _0x11cc03;var _0x480023;return db[_0xb701('0x2e')][_0xb701('0x4c')]({'where':{'id':_0x1e0065[_0xb701('0x46')]['id']}})[_0xb701('0x27')](handleEntityNotFound(_0x11986,null))['then'](function(_0x27dac1){if(_0x27dac1){_0x11cc03=_0x27dac1;_0x451f78[_0xb701('0x32')]=_[_0xb701('0x33')](db[_0xb701('0x4d')]['rawAttributes']);_0x451f78[_0xb701('0x34')]=_[_0xb701('0x33')](_0x1e0065['query']);_0x451f78[_0xb701('0x35')]=_[_0xb701('0x36')](_0x451f78['model'],_0x451f78[_0xb701('0x34')]);_0x32917b[_0xb701('0x38')]=_[_0xb701('0x36')](_0x451f78['model'],qs[_0xb701('0x37')](_0x1e0065[_0xb701('0x34')][_0xb701('0x37')]));_0x32917b[_0xb701('0x38')]=_0x32917b['attributes'][_0xb701('0x47')]?_0x32917b[_0xb701('0x38')]:_0x451f78[_0xb701('0x32')];_0x32917b[_0xb701('0x3a')]=qs[_0xb701('0x3b')](_0x1e0065[_0xb701('0x34')][_0xb701('0x3b')]);_0x32917b[_0xb701('0x3c')]=qs[_0xb701('0x35')](_[_0xb701('0x3d')](_0x1e0065[_0xb701('0x34')],_0x451f78[_0xb701('0x35')]));if(_0x1e0065[_0xb701('0x34')][_0xb701('0x3e')]){_0x32917b[_0xb701('0x3c')]=_[_0xb701('0x3f')](_0x32917b[_0xb701('0x3c')],{'$or':_['map'](_0x32917b['attributes'],function(_0x4e11d9){var _0x221a7c={};_0x221a7c[_0x4e11d9]={'$like':'%'+_0x1e0065[_0xb701('0x34')]['filter']+'%'};return _0x221a7c;})});}_0x32917b=_['merge']({},_0x32917b,_0x1e0065['options']);return _0x11cc03['getConfigurations'](_0x32917b);}})[_0xb701('0x27')](function(_0x168fac){if(_0x168fac){_0x480023=_0x168fac[_0xb701('0x47')];if(!_0x1e0065[_0xb701('0x34')][_0xb701('0x4e')](_0xb701('0x39'))){_0x32917b[_0xb701('0x20')]=qs[_0xb701('0x20')](_0x1e0065['query'][_0xb701('0x20')]);_0x32917b[_0xb701('0x1e')]=qs['offset'](_0x1e0065[_0xb701('0x34')][_0xb701('0x1e')]);}return _0x11cc03['getConfigurations'](_0x32917b);}})[_0xb701('0x27')](function(_0x28370e){if(_0x28370e){return _0x28370e?{'count':_0x480023,'rows':_0x28370e}:null;}})['then'](respondWithResult(_0x11986,null))[_0xb701('0x44')](handleError(_0x11986,null));};exports[_0xb701('0x4f')]=function(_0xa38e33,_0x41daac,_0x596c7c){if(_0xa38e33[_0xb701('0x49')]['id']){delete _0xa38e33[_0xb701('0x49')]['id'];}return db['SugarcrmAccount'][_0xb701('0x4c')]({'where':{'id':_0xa38e33[_0xb701('0x46')]['id']}})[_0xb701('0x27')](handleEntityNotFound(_0x41daac,null))[_0xb701('0x27')](function(_0x46b901){if(_0x46b901){_0xa38e33[_0xb701('0x49')][_0xb701('0x50')]=_0x46b901['id'];_0xa38e33['body'][_0xb701('0x51')]=integrations[_0xb701('0x52')](_0xa38e33['body']['channel'],_0xa38e33['body'][_0xb701('0x30')]);_0xa38e33[_0xb701('0x49')][_0xb701('0x53')]=integrations[_0xb701('0x54')](_0xa38e33[_0xb701('0x49')][_0xb701('0x55')],_0xa38e33[_0xb701('0x49')][_0xb701('0x30')]);return db['SugarcrmConfiguration'][_0xb701('0x56')](_0xa38e33['body'],{'include':[{'model':db[_0xb701('0x57')],'as':_0xb701('0x51')},{'model':db[_0xb701('0x57')],'as':_0xb701('0x53')}]});}return null;})[_0xb701('0x27')](respondWithResult(_0x41daac,null))['catch'](handleError(_0x41daac,null));};exports[_0xb701('0x58')]=function(_0x595e69,_0x35112c,_0x738971){var _0x3e7720='';var _0x5905f5=['id',_0xb701('0x2b'),'assigned_user_id','created_by',_0xb701('0x59'),'date_start',_0xb701('0x5a'),_0xb701('0x5b'),_0xb701('0x5c'),_0xb701('0x5d'),_0xb701('0x5e'),'direction'];return db['SugarcrmAccount'][_0xb701('0x4c')]({'where':{'id':_0x595e69[_0xb701('0x46')]['id']},'attributes':['id','username','password',_0xb701('0x5f')]})[_0xb701('0x27')](handleEntityNotFound(_0x35112c,null))['then'](function(_0x573f24){if(_0x573f24){_0x3e7720=_0x573f24[_0xb701('0x5f')];var _0x137a6b=_0x3e7720[_0xb701('0x60')](-0x1);if(_0x137a6b==='/'){_0x3e7720=_0x3e7720['substring'](0x0,_0x3e7720['lastIndexOf'](_0x137a6b));}return rp({'method':_0xb701('0x61'),'uri':util[_0xb701('0x62')](_0xb701('0x63'),_0x3e7720,_0xb701('0x64')),'json':!![],'form':{'method':_0xb701('0x65'),'input_type':_0xb701('0x66'),'response_type':'JSON','rest_data':JSON[_0xb701('0x67')]({'user_auth':{'user_name':_0x573f24[_0xb701('0x68')],'password':_0x573f24[_0xb701('0x69')],'encryption':_0xb701('0x6a')},'application':_0xb701('0x6b')})}});}})['then'](function(_0x4fa6da){if(_0x4fa6da&&_0x4fa6da[_0xb701('0x2b')]!=='Invalid\x20Login'&&_0x4fa6da[_0xb701('0x2b')]!==_0xb701('0x6c')){return rp({'method':'POST','uri':util[_0xb701('0x62')](_0xb701('0x63'),_0x3e7720,_0xb701('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xb701('0x66'),'response_type':_0xb701('0x66'),'rest_data':JSON[_0xb701('0x67')]({'session':_0x4fa6da['id'],'module_name':_0xb701('0x6d')})}})[_0xb701('0x27')](function(_0x43f75a){if(_0x43f75a){var _0x25deab=_[_0xb701('0x6e')](_0x43f75a[_0xb701('0x6f')]);_[_0xb701('0x70')](_0x25deab,function(_0x44b63c){return _0x5905f5['includes'](_0x44b63c[_0xb701('0x2b')]);});return{'count':_0x25deab['length'],'rows':_[_0xb701('0x2d')](_0x25deab,function(_0x12c554){return{'id':_0x12c554[_0xb701('0x2b')],'name':_0x12c554[_0xb701('0x71')],'custom':_[_0xb701('0x72')](_0x12c554['name'],'_c')?!![]:![],'options':_0x12c554['options']?_[_0xb701('0x2d')](_[_0xb701('0x6e')](_0x12c554[_0xb701('0x40')]),function(_0x476dcc){return{'name':_0x476dcc[_0xb701('0x73')],'value':_0x476dcc[_0xb701('0x2b')]};}):[]};})};}})[_0xb701('0x27')](respondWithResult(_0x35112c,null))['catch'](function(_0x35e8f2){var _0x49eb07=_0x595e69[_0xb701('0x34')]['test']?0x1f4:_0x35e8f2[_0xb701('0x74')]||0x1f4;logger[_0xb701('0x75')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x49eb07,JSON['stringify'](_0x35e8f2));delete _0x35e8f2[_0xb701('0x2b')];if(_0x49eb07===0x191){_0x49eb07=0x190;}_0x35112c[_0xb701('0x1b')](_0x49eb07)[_0xb701('0x76')](_0x595e69['query'][_0xb701('0x77')]?{'message':_0xb701('0x78'),'statusCode':_0x35e8f2[_0xb701('0x74')]}:_0x35e8f2);});}else{var _0x2187dc=0x1f4;_0x35112c[_0xb701('0x1b')](_0x2187dc)[_0xb701('0x76')]({'message':_0xb701('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xeb95=['where','pick','filters','filter','merge','options','includeAll','include','rows','show','rawAttributes','find','create','body','params','catch','getConfigurations','SugarcrmConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','duration_minutes','parent_type','parent_name','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','includes','label','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','send','eml-format','zip-dir','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','SugarcrmAccount','type','key','model','map','query','keys','intersection','attributes','length','nolimit','order','sort'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb95,0x173));var _0x5eb9=function(_0x496cf3,_0x5c8e9e){_0x496cf3=_0x496cf3-0x0;var _0x47f41f=_0xeb95[_0x496cf3];return _0x47f41f;};'use strict';var emlformat=require(_0x5eb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eb9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5eb9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5eb9('0x3'));var path=require('path');var sox=require(_0x5eb9('0x4'));var csv=require(_0x5eb9('0x5'));var ejs=require(_0x5eb9('0x6'));var fs=require('fs');var fs_extra=require(_0x5eb9('0x7'));var _=require('lodash');var squel=require(_0x5eb9('0x8'));var crypto=require(_0x5eb9('0x9'));var jsforce=require(_0x5eb9('0xa'));var deskjs=require(_0x5eb9('0xb'));var toCsv=require(_0x5eb9('0x5'));var querystring=require(_0x5eb9('0xc'));var Papa=require(_0x5eb9('0xd'));var Redis=require('ioredis');var authService=require(_0x5eb9('0xe'));var qs=require(_0x5eb9('0xf'));var as=require(_0x5eb9('0x10'));var hardwareService=require(_0x5eb9('0x11'));var logger=require(_0x5eb9('0x12'))(_0x5eb9('0x13'));var utils=require(_0x5eb9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5eb9('0x15'));var db=require(_0x5eb9('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x62d284,_0x19d092){_0x19d092=_0x19d092||0xcc;return function(_0x37ad9b){if(_0x37ad9b){return _0x62d284[_0x5eb9('0x17')](_0x19d092);}return _0x62d284[_0x5eb9('0x18')](_0x19d092)[_0x5eb9('0x19')]();};}function respondWithResult(_0x4cc922,_0x4f5ffc){_0x4f5ffc=_0x4f5ffc||0xc8;return function(_0x5d3c33){if(_0x5d3c33){return _0x4cc922[_0x5eb9('0x18')](_0x4f5ffc)['json'](_0x5d3c33);}};}function respondWithFilteredResult(_0x669caf,_0x324143){return function(_0x2a7129){if(_0x2a7129){var _0x57ad88=typeof _0x324143['offset']===_0x5eb9('0x1a')&&typeof _0x324143[_0x5eb9('0x1b')]===_0x5eb9('0x1a');var _0x31b05b=_0x2a7129[_0x5eb9('0x1c')];var _0x219406=_0x57ad88?0x0:_0x324143['offset'];var _0x27d109=_0x57ad88?_0x2a7129[_0x5eb9('0x1c')]:_0x324143[_0x5eb9('0x1d')]+_0x324143[_0x5eb9('0x1b')];var _0x335a44;if(_0x27d109>=_0x31b05b){_0x27d109=_0x31b05b;_0x335a44=0xc8;}else{_0x335a44=0xce;}_0x669caf['status'](_0x335a44);return _0x669caf['set'](_0x5eb9('0x1e'),_0x219406+'-'+_0x27d109+'/'+_0x31b05b)[_0x5eb9('0x1f')](_0x2a7129);}return null;};}function patchUpdates(_0x4028a2){return function(_0x1edff1){try{jsonpatch[_0x5eb9('0x20')](_0x1edff1,_0x4028a2,!![]);}catch(_0x241719){return BPromise[_0x5eb9('0x21')](_0x241719);}return _0x1edff1[_0x5eb9('0x22')]();};}function saveUpdates(_0x5ccf3e,_0x56feb4){return function(_0x5d0cce){if(_0x5d0cce){return _0x5d0cce['update'](_0x5ccf3e)[_0x5eb9('0x23')](function(_0x492119){return _0x492119;});}return null;};}function removeEntity(_0x217add,_0x93fed5){return function(_0x5da977){if(_0x5da977){return _0x5da977[_0x5eb9('0x24')]()[_0x5eb9('0x23')](function(){_0x217add[_0x5eb9('0x18')](0xcc)[_0x5eb9('0x19')]();});}};}function handleEntityNotFound(_0x1ddb9d,_0x47fc3c){return function(_0x2ff487){if(!_0x2ff487){_0x1ddb9d[_0x5eb9('0x17')](0x194);}return _0x2ff487;};}function handleError(_0x59360d,_0x7fe2a1){_0x7fe2a1=_0x7fe2a1||0x1f4;return function(_0x5dc3f9){logger[_0x5eb9('0x25')](_0x5dc3f9[_0x5eb9('0x26')]);if(_0x5dc3f9[_0x5eb9('0x27')]){delete _0x5dc3f9[_0x5eb9('0x27')];}_0x59360d['status'](_0x7fe2a1)['send'](_0x5dc3f9);};}exports['index']=function(_0x4092eb,_0x55b56b){var _0xa39fc1={},_0x4c9118={},_0x149a21={'count':0x0,'rows':[]};var _0x498fc7=_['map'](db[_0x5eb9('0x28')]['rawAttributes'],function(_0x14298b){return{'name':_0x14298b['fieldName'],'type':_0x14298b[_0x5eb9('0x29')][_0x5eb9('0x2a')]};});_0x4c9118[_0x5eb9('0x2b')]=_[_0x5eb9('0x2c')](_0x498fc7,_0x5eb9('0x27'));_0x4c9118[_0x5eb9('0x2d')]=_[_0x5eb9('0x2e')](_0x4092eb[_0x5eb9('0x2d')]);_0x4c9118['filters']=_[_0x5eb9('0x2f')](_0x4c9118['model'],_0x4c9118[_0x5eb9('0x2d')]);_0xa39fc1[_0x5eb9('0x30')]=_[_0x5eb9('0x2f')](_0x4c9118[_0x5eb9('0x2b')],qs['fields'](_0x4092eb[_0x5eb9('0x2d')]['fields']));_0xa39fc1[_0x5eb9('0x30')]=_0xa39fc1['attributes'][_0x5eb9('0x31')]?_0xa39fc1[_0x5eb9('0x30')]:_0x4c9118[_0x5eb9('0x2b')];if(!_0x4092eb[_0x5eb9('0x2d')]['hasOwnProperty'](_0x5eb9('0x32'))){_0xa39fc1[_0x5eb9('0x1b')]=qs[_0x5eb9('0x1b')](_0x4092eb[_0x5eb9('0x2d')]['limit']);_0xa39fc1[_0x5eb9('0x1d')]=qs['offset'](_0x4092eb[_0x5eb9('0x2d')][_0x5eb9('0x1d')]);}_0xa39fc1[_0x5eb9('0x33')]=qs[_0x5eb9('0x34')](_0x4092eb[_0x5eb9('0x2d')][_0x5eb9('0x34')]);_0xa39fc1[_0x5eb9('0x35')]=qs['filters'](_[_0x5eb9('0x36')](_0x4092eb[_0x5eb9('0x2d')],_0x4c9118[_0x5eb9('0x37')]),_0x498fc7);if(_0x4092eb[_0x5eb9('0x2d')][_0x5eb9('0x38')]){_0xa39fc1[_0x5eb9('0x35')]=_[_0x5eb9('0x39')](_0xa39fc1[_0x5eb9('0x35')],{'$or':_[_0x5eb9('0x2c')](_0x498fc7,function(_0x520625){if(_0x520625[_0x5eb9('0x29')]!=='VIRTUAL'){var _0x4257c0={};_0x4257c0[_0x520625[_0x5eb9('0x27')]]={'$like':'%'+_0x4092eb['query']['filter']+'%'};return _0x4257c0;}})});}_0xa39fc1=_[_0x5eb9('0x39')]({},_0xa39fc1,_0x4092eb[_0x5eb9('0x3a')]);var _0x574496={'where':_0xa39fc1[_0x5eb9('0x35')]};return db[_0x5eb9('0x28')][_0x5eb9('0x1c')](_0x574496)[_0x5eb9('0x23')](function(_0x2da5d0){_0x149a21[_0x5eb9('0x1c')]=_0x2da5d0;if(_0x4092eb[_0x5eb9('0x2d')][_0x5eb9('0x3b')]){_0xa39fc1[_0x5eb9('0x3c')]=[{'all':!![]}];}return db[_0x5eb9('0x28')]['findAll'](_0xa39fc1);})[_0x5eb9('0x23')](function(_0x3535f9){_0x149a21[_0x5eb9('0x3d')]=_0x3535f9;return _0x149a21;})[_0x5eb9('0x23')](respondWithFilteredResult(_0x55b56b,_0xa39fc1))['catch'](handleError(_0x55b56b,null));};exports[_0x5eb9('0x3e')]=function(_0x2dc682,_0xf09894){var _0x14644d={'raw':![],'where':{'id':_0x2dc682['params']['id']}},_0x21f622={};_0x21f622[_0x5eb9('0x2b')]=_['keys'](db[_0x5eb9('0x28')][_0x5eb9('0x3f')]);_0x21f622[_0x5eb9('0x2d')]=_[_0x5eb9('0x2e')](_0x2dc682['query']);_0x21f622[_0x5eb9('0x37')]=_[_0x5eb9('0x2f')](_0x21f622['model'],_0x21f622[_0x5eb9('0x2d')]);_0x14644d[_0x5eb9('0x30')]=_[_0x5eb9('0x2f')](_0x21f622[_0x5eb9('0x2b')],qs['fields'](_0x2dc682['query']['fields']));_0x14644d[_0x5eb9('0x30')]=_0x14644d['attributes'][_0x5eb9('0x31')]?_0x14644d[_0x5eb9('0x30')]:_0x21f622[_0x5eb9('0x2b')];if(_0x2dc682[_0x5eb9('0x2d')][_0x5eb9('0x3b')]){_0x14644d[_0x5eb9('0x3c')]=[{'all':!![]}];}_0x14644d=_[_0x5eb9('0x39')]({},_0x14644d,_0x2dc682['options']);return db[_0x5eb9('0x28')][_0x5eb9('0x40')](_0x14644d)[_0x5eb9('0x23')](handleEntityNotFound(_0xf09894,null))[_0x5eb9('0x23')](respondWithResult(_0xf09894,null))['catch'](handleError(_0xf09894,null));};exports[_0x5eb9('0x41')]=function(_0x3b56a4,_0xb82839){return db['SugarcrmAccount']['create'](_0x3b56a4[_0x5eb9('0x42')],{})['then'](respondWithResult(_0xb82839,0xc9))['catch'](handleError(_0xb82839,null));};exports['update']=function(_0x79b898,_0x5c31b1){if(_0x79b898[_0x5eb9('0x42')]['id']){delete _0x79b898[_0x5eb9('0x42')]['id'];}return db[_0x5eb9('0x28')][_0x5eb9('0x40')]({'where':{'id':_0x79b898[_0x5eb9('0x43')]['id']}})[_0x5eb9('0x23')](handleEntityNotFound(_0x5c31b1,null))[_0x5eb9('0x23')](saveUpdates(_0x79b898['body'],null))[_0x5eb9('0x23')](respondWithResult(_0x5c31b1,null))[_0x5eb9('0x44')](handleError(_0x5c31b1,null));};exports[_0x5eb9('0x24')]=function(_0x3b8240,_0x211899){return db[_0x5eb9('0x28')][_0x5eb9('0x40')]({'where':{'id':_0x3b8240[_0x5eb9('0x43')]['id']}})[_0x5eb9('0x23')](handleEntityNotFound(_0x211899,null))[_0x5eb9('0x23')](removeEntity(_0x211899,null))[_0x5eb9('0x44')](handleError(_0x211899,null));};exports[_0x5eb9('0x45')]=function(_0x48b4fa,_0x4c4594,_0x1bcd09){var _0x51e346={};var _0x4d3395={};var _0x43925b;var _0x2cda3e;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x48b4fa[_0x5eb9('0x43')]['id']}})[_0x5eb9('0x23')](handleEntityNotFound(_0x4c4594,null))['then'](function(_0x37c54f){if(_0x37c54f){_0x43925b=_0x37c54f;_0x4d3395[_0x5eb9('0x2b')]=_['keys'](db[_0x5eb9('0x46')]['rawAttributes']);_0x4d3395['query']=_['keys'](_0x48b4fa[_0x5eb9('0x2d')]);_0x4d3395[_0x5eb9('0x37')]=_[_0x5eb9('0x2f')](_0x4d3395['model'],_0x4d3395['query']);_0x51e346['attributes']=_[_0x5eb9('0x2f')](_0x4d3395['model'],qs['fields'](_0x48b4fa[_0x5eb9('0x2d')]['fields']));_0x51e346[_0x5eb9('0x30')]=_0x51e346[_0x5eb9('0x30')][_0x5eb9('0x31')]?_0x51e346['attributes']:_0x4d3395[_0x5eb9('0x2b')];_0x51e346[_0x5eb9('0x33')]=qs[_0x5eb9('0x34')](_0x48b4fa['query'][_0x5eb9('0x34')]);_0x51e346[_0x5eb9('0x35')]=qs[_0x5eb9('0x37')](_[_0x5eb9('0x36')](_0x48b4fa['query'],_0x4d3395['filters']));if(_0x48b4fa['query'][_0x5eb9('0x38')]){_0x51e346[_0x5eb9('0x35')]=_[_0x5eb9('0x39')](_0x51e346[_0x5eb9('0x35')],{'$or':_[_0x5eb9('0x2c')](_0x51e346[_0x5eb9('0x30')],function(_0x1cc8bc){var _0x1a90b2={};_0x1a90b2[_0x1cc8bc]={'$like':'%'+_0x48b4fa[_0x5eb9('0x2d')][_0x5eb9('0x38')]+'%'};return _0x1a90b2;})});}_0x51e346=_[_0x5eb9('0x39')]({},_0x51e346,_0x48b4fa['options']);return _0x43925b[_0x5eb9('0x45')](_0x51e346);}})['then'](function(_0x3c64b1){if(_0x3c64b1){_0x2cda3e=_0x3c64b1[_0x5eb9('0x31')];if(!_0x48b4fa[_0x5eb9('0x2d')]['hasOwnProperty']('nolimit')){_0x51e346['limit']=qs[_0x5eb9('0x1b')](_0x48b4fa['query'][_0x5eb9('0x1b')]);_0x51e346['offset']=qs[_0x5eb9('0x1d')](_0x48b4fa[_0x5eb9('0x2d')][_0x5eb9('0x1d')]);}return _0x43925b[_0x5eb9('0x45')](_0x51e346);}})[_0x5eb9('0x23')](function(_0x3101e9){if(_0x3101e9){return _0x3101e9?{'count':_0x2cda3e,'rows':_0x3101e9}:null;}})[_0x5eb9('0x23')](respondWithResult(_0x4c4594,null))[_0x5eb9('0x44')](handleError(_0x4c4594,null));};exports['addConfiguration']=function(_0x304578,_0x2b59f7,_0x423da0){if(_0x304578[_0x5eb9('0x42')]['id']){delete _0x304578[_0x5eb9('0x42')]['id'];}return db['SugarcrmAccount'][_0x5eb9('0x47')]({'where':{'id':_0x304578['params']['id']}})['then'](handleEntityNotFound(_0x2b59f7,null))[_0x5eb9('0x23')](function(_0x2553d5){if(_0x2553d5){_0x304578[_0x5eb9('0x42')][_0x5eb9('0x48')]=_0x2553d5['id'];_0x304578[_0x5eb9('0x42')][_0x5eb9('0x49')]=integrations['getSubjects'](_0x304578[_0x5eb9('0x42')]['channel'],_0x304578[_0x5eb9('0x42')][_0x5eb9('0x29')]);_0x304578[_0x5eb9('0x42')][_0x5eb9('0x4a')]=integrations[_0x5eb9('0x4b')](_0x304578[_0x5eb9('0x42')]['channel'],_0x304578[_0x5eb9('0x42')][_0x5eb9('0x29')]);return db[_0x5eb9('0x46')][_0x5eb9('0x41')](_0x304578[_0x5eb9('0x42')],{'include':[{'model':db[_0x5eb9('0x4c')],'as':_0x5eb9('0x49')},{'model':db['SugarcrmField'],'as':_0x5eb9('0x4a')}]});}return null;})[_0x5eb9('0x23')](respondWithResult(_0x2b59f7,null))[_0x5eb9('0x44')](handleError(_0x2b59f7,null));};exports[_0x5eb9('0x4d')]=function(_0x3a383b,_0x3796ec,_0x2117d0){var _0x3e7ccc='';var _0x5bf5af=['id',_0x5eb9('0x27'),'assigned_user_id','created_by','description','date_start','duration_hours',_0x5eb9('0x4e'),'parent_id',_0x5eb9('0x4f'),_0x5eb9('0x50'),'direction'];return db[_0x5eb9('0x28')]['findOne']({'where':{'id':_0x3a383b[_0x5eb9('0x43')]['id']},'attributes':['id',_0x5eb9('0x51'),_0x5eb9('0x52'),'remoteUri']})[_0x5eb9('0x23')](handleEntityNotFound(_0x3796ec,null))[_0x5eb9('0x23')](function(_0x166a97){if(_0x166a97){_0x3e7ccc=_0x166a97[_0x5eb9('0x53')];var _0x2a9da8=_0x3e7ccc[_0x5eb9('0x54')](-0x1);if(_0x2a9da8==='/'){_0x3e7ccc=_0x3e7ccc['substring'](0x0,_0x3e7ccc[_0x5eb9('0x55')](_0x2a9da8));}return rp({'method':_0x5eb9('0x56'),'uri':util[_0x5eb9('0x57')](_0x5eb9('0x58'),_0x3e7ccc,_0x5eb9('0x59')),'json':!![],'form':{'method':_0x5eb9('0x5a'),'input_type':_0x5eb9('0x5b'),'response_type':_0x5eb9('0x5b'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x166a97['username'],'password':_0x166a97['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x5eb9('0x23')](function(_0x346947){if(_0x346947&&_0x346947[_0x5eb9('0x27')]!==_0x5eb9('0x5c')&&_0x346947[_0x5eb9('0x27')]!==_0x5eb9('0x5d')){return rp({'method':'POST','uri':util[_0x5eb9('0x57')]('%s%s',_0x3e7ccc,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x5eb9('0x5e'),'input_type':_0x5eb9('0x5b'),'response_type':'JSON','rest_data':JSON[_0x5eb9('0x5f')]({'session':_0x346947['id'],'module_name':_0x5eb9('0x60')})}})['then'](function(_0x4e32c0){if(_0x4e32c0){var _0xe31c4d=_['values'](_0x4e32c0['module_fields']);_['remove'](_0xe31c4d,function(_0x542c44){return _0x5bf5af[_0x5eb9('0x61')](_0x542c44[_0x5eb9('0x27')]);});return{'count':_0xe31c4d['length'],'rows':_[_0x5eb9('0x2c')](_0xe31c4d,function(_0xf0357a){return{'id':_0xf0357a['name'],'name':_0xf0357a[_0x5eb9('0x62')],'custom':_['endsWith'](_0xf0357a[_0x5eb9('0x27')],'_c')?!![]:![],'options':_0xf0357a['options']?_[_0x5eb9('0x2c')](_[_0x5eb9('0x63')](_0xf0357a[_0x5eb9('0x3a')]),function(_0xcbc39){return{'name':_0xcbc39[_0x5eb9('0x64')],'value':_0xcbc39[_0x5eb9('0x27')]};}):[]};})};}})['then'](respondWithResult(_0x3796ec,null))['catch'](function(_0x3de200){var _0x2df0cb=_0x3a383b[_0x5eb9('0x2d')]['test']?0x1f4:_0x3de200[_0x5eb9('0x65')]||0x1f4;logger[_0x5eb9('0x25')](_0x5eb9('0x66'),_0x5eb9('0x4d'),_0x2df0cb,JSON[_0x5eb9('0x5f')](_0x3de200));delete _0x3de200['name'];if(_0x2df0cb===0x191){_0x2df0cb=0x190;}_0x3796ec[_0x5eb9('0x18')](_0x2df0cb)['send'](_0x3a383b[_0x5eb9('0x2d')][_0x5eb9('0x67')]?{'message':_0x5eb9('0x68'),'statusCode':_0x3de200['statusCode']}:_0x3de200);});}else{var _0x51cfc7=0x1f4;_0x3796ec[_0x5eb9('0x18')](_0x51cfc7)[_0x5eb9('0x69')]({'message':_0x5eb9('0x68'),'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 e1879a4..27ffdc5 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 _0x3bbd=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intSugarcrmAccount.attributes','exports','define'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x3bbd,0x1b2));var _0xd3bb=function(_0x29dba1,_0x2b8dce){_0x29dba1=_0x29dba1-0x0;var _0x10b4cf=_0x3bbd[_0x29dba1];return _0x10b4cf;};'use strict';var _=require(_0xd3bb('0x0'));var util=require(_0xd3bb('0x1'));var logger=require(_0xd3bb('0x2'))(_0xd3bb('0x3'));var moment=require(_0xd3bb('0x4'));var BPromise=require(_0xd3bb('0x5'));var rp=require(_0xd3bb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd3bb('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd3bb('0x8')]=function(_0x2be1bd,_0x5371d7){return _0x2be1bd[_0xd3bb('0x9')](_0xd3bb('0xa'),attributes,{'tableName':_0xd3bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f9d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmAccount','lodash','../../config/logger','moment'];(function(_0x26fbbc,_0x587636){var _0x482a78=function(_0x3cfd99){while(--_0x3cfd99){_0x26fbbc['push'](_0x26fbbc['shift']());}};_0x482a78(++_0x587636);}(_0x0f9d,0x81));var _0xd0f9=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x0f9d[_0x671369];return _0x33f2b4;};'use strict';var _=require(_0xd0f9('0x0'));var util=require('util');var logger=require(_0xd0f9('0x1'))('api');var moment=require(_0xd0f9('0x2'));var BPromise=require(_0xd0f9('0x3'));var rp=require(_0xd0f9('0x4'));var fs=require('fs');var path=require(_0xd0f9('0x5'));var rimraf=require(_0xd0f9('0x6'));var config=require(_0xd0f9('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xd0f9('0x8')]=function(_0x3c7b63,_0x2eaf4b){return _0x3c7b63[_0xd0f9('0x9')](_0xd0f9('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 c82d8ac..e13a47d 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 _0x910f=['rpc','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','GetSugarcrmAccount','debug','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3198fd,_0x58ef80){var _0x4fa1d2=function(_0x1c8f97){while(--_0x1c8f97){_0x3198fd['push'](_0x3198fd['shift']());}};_0x4fa1d2(++_0x58ef80);}(_0x910f,0x1b3));var _0xf910=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x910f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf910('0x0'));var util=require(_0xf910('0x1'));var moment=require(_0xf910('0x2'));var BPromise=require(_0xf910('0x3'));var rs=require(_0xf910('0x4'));var fs=require('fs');var Redis=require(_0xf910('0x5'));var db=require(_0xf910('0x6'))['db'];var utils=require(_0xf910('0x7'));var logger=require(_0xf910('0x8'))(_0xf910('0x9'));var config=require('../../config/environment');var jayson=require(_0xf910('0xa'));var client=jayson[_0xf910('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46d006,_0x69134,_0x48a51f){return new BPromise(function(_0x22d8c1,_0x4645e6){return client[_0xf910('0xc')](_0x46d006,_0x48a51f)['then'](function(_0x8b0e3a){logger[_0xf910('0xd')](_0xf910('0xe'),_0x69134,_0xf910('0xf'));logger['debug'](_0xf910('0x10'),_0x69134,'request\x20sent',JSON[_0xf910('0x11')](_0x8b0e3a));if(_0x8b0e3a['error']){if(_0x8b0e3a[_0xf910('0x12')][_0xf910('0x13')]===0x1f4){logger[_0xf910('0x12')](_0xf910('0xe'),_0x69134,_0x8b0e3a['error']['message']);return _0x4645e6(_0x8b0e3a[_0xf910('0x12')][_0xf910('0x14')]);}logger[_0xf910('0x12')](_0xf910('0xe'),_0x69134,_0x8b0e3a[_0xf910('0x12')][_0xf910('0x14')]);return _0x22d8c1(_0x8b0e3a[_0xf910('0x12')]['message']);}else{logger['info'](_0xf910('0xe'),_0x69134,'request\x20sent');_0x22d8c1(_0x8b0e3a['result'][_0xf910('0x14')]);}})[_0xf910('0x15')](function(_0x5d0fd5){logger[_0xf910('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x69134,_0x5d0fd5);_0x4645e6(_0x5d0fd5);});});}exports['GetSugarcrmAccount']=function(_0xdf6f57){var _0x215b5a=this;return new Promise(function(_0x40ecfd,_0x54cec7){return db[_0xf910('0x16')][_0xf910('0x17')]({'raw':_0xdf6f57[_0xf910('0x18')]?_0xdf6f57['options'][_0xf910('0x19')]===undefined?!![]:![]:!![],'where':_0xdf6f57[_0xf910('0x18')]?_0xdf6f57[_0xf910('0x18')][_0xf910('0x1a')]||null:null,'attributes':_0xdf6f57['options']?_0xdf6f57[_0xf910('0x18')][_0xf910('0x1b')]||null:null,'limit':_0xdf6f57[_0xf910('0x18')]?_0xdf6f57[_0xf910('0x18')][_0xf910('0x1c')]||null:null,'include':_0xdf6f57[_0xf910('0x18')]?_0xdf6f57['options']['include']?_[_0xf910('0x1d')](_0xdf6f57[_0xf910('0x18')][_0xf910('0x1e')],function(_0x52c770){return{'model':db[_0x52c770[_0xf910('0x1f')]],'as':_0x52c770['as'],'attributes':_0x52c770[_0xf910('0x1b')],'include':_0x52c770['include']?_['map'](_0x52c770[_0xf910('0x1e')],function(_0x144437){return{'model':db[_0x144437[_0xf910('0x1f')]],'as':_0x144437['as'],'attributes':_0x144437['attributes'],'include':_0x144437[_0xf910('0x1e')]?_[_0xf910('0x1d')](_0x144437[_0xf910('0x1e')],function(_0x24fb2d){return{'model':db[_0x24fb2d[_0xf910('0x1f')]],'as':_0x24fb2d['as'],'attributes':_0x24fb2d[_0xf910('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf910('0x20')](function(_0x409cce){logger['info'](_0xf910('0x21'),_0xdf6f57);logger[_0xf910('0x22')](_0xf910('0x21'),_0xdf6f57,JSON[_0xf910('0x11')](_0x409cce));_0x40ecfd(_0x409cce);})[_0xf910('0x15')](function(_0x4ddb93){logger[_0xf910('0x12')](_0xf910('0x21'),_0x4ddb93[_0xf910('0x14')],_0xdf6f57);_0x54cec7(_0x215b5a[_0xf910('0x12')](0x1f4,_0x4ddb93['message']));});});};exports[_0xf910('0x23')]=function(_0x3cd956){var _0x34e0c5=this;return new Promise(function(_0x55f0b4,_0xf0a7af){return db['SugarcrmAccount'][_0xf910('0x24')]({'raw':_0x3cd956[_0xf910('0x18')]?_0x3cd956[_0xf910('0x18')][_0xf910('0x19')]===undefined?!![]:![]:!![],'where':_0x3cd956['options']?_0x3cd956[_0xf910('0x18')][_0xf910('0x1a')]||null:null,'attributes':_0x3cd956[_0xf910('0x18')]?_0x3cd956[_0xf910('0x18')][_0xf910('0x1b')]||null:null,'include':_0x3cd956['options']?_0x3cd956[_0xf910('0x18')][_0xf910('0x1e')]?_[_0xf910('0x1d')](_0x3cd956[_0xf910('0x18')][_0xf910('0x1e')],function(_0x97021b){return{'model':db[_0x97021b[_0xf910('0x1f')]],'as':_0x97021b['as'],'attributes':_0x97021b[_0xf910('0x1b')],'include':_0x97021b['include']?_['map'](_0x97021b[_0xf910('0x1e')],function(_0x5b66a0){return{'model':db[_0x5b66a0['model']],'as':_0x5b66a0['as'],'attributes':_0x5b66a0[_0xf910('0x1b')],'include':_0x5b66a0[_0xf910('0x1e')]?_[_0xf910('0x1d')](_0x5b66a0['include'],function(_0x4fd184){return{'model':db[_0x4fd184[_0xf910('0x1f')]],'as':_0x4fd184['as'],'attributes':_0x4fd184['attributes']};}):[]};}):[]};}):[]:[]})[_0xf910('0x20')](function(_0x270b6a){logger[_0xf910('0xd')](_0xf910('0x23'),_0x3cd956);logger['debug'](_0xf910('0x23'),_0x3cd956,JSON[_0xf910('0x11')](_0x270b6a));_0x55f0b4(_0x270b6a);})[_0xf910('0x15')](function(_0x1b6fa5){logger['error'](_0xf910('0x23'),_0x1b6fa5[_0xf910('0x14')],_0x3cd956);_0xf0a7af(_0x34e0c5[_0xf910('0x12')](0x1f4,_0x1b6fa5[_0xf910('0x14')]));});});}; \ No newline at end of file +var _0xdb43=['where','attributes','limit','include','map','model','debug','raw','ShowSugarcrmAccount','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xdb43,0xb9));var _0x3db4=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xdb43[_0x1a7846];return _0x48049;};'use strict';var _=require(_0x3db4('0x0'));var util=require('util');var moment=require(_0x3db4('0x1'));var BPromise=require(_0x3db4('0x2'));var rs=require(_0x3db4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3db4('0x4'))['db'];var utils=require(_0x3db4('0x5'));var logger=require('../../config/logger')(_0x3db4('0x6'));var config=require('../../config/environment');var jayson=require(_0x3db4('0x7'));var client=jayson[_0x3db4('0x8')][_0x3db4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ee0d,_0x2c0dc9,_0x116aa4){return new BPromise(function(_0x84571f,_0x116705){return client[_0x3db4('0xa')](_0x27ee0d,_0x116aa4)[_0x3db4('0xb')](function(_0x268b6d){logger['info'](_0x3db4('0xc'),_0x2c0dc9,_0x3db4('0xd'));logger['debug'](_0x3db4('0xe'),_0x2c0dc9,'request\x20sent',JSON['stringify'](_0x268b6d));if(_0x268b6d['error']){if(_0x268b6d[_0x3db4('0xf')][_0x3db4('0x10')]===0x1f4){logger['error'](_0x3db4('0xc'),_0x2c0dc9,_0x268b6d[_0x3db4('0xf')][_0x3db4('0x11')]);return _0x116705(_0x268b6d[_0x3db4('0xf')][_0x3db4('0x11')]);}logger[_0x3db4('0xf')](_0x3db4('0xc'),_0x2c0dc9,_0x268b6d[_0x3db4('0xf')]['message']);return _0x84571f(_0x268b6d[_0x3db4('0xf')][_0x3db4('0x11')]);}else{logger[_0x3db4('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x2c0dc9,_0x3db4('0xd'));_0x84571f(_0x268b6d[_0x3db4('0x13')][_0x3db4('0x11')]);}})[_0x3db4('0x14')](function(_0x581a09){logger[_0x3db4('0xf')](_0x3db4('0xc'),_0x2c0dc9,_0x581a09);_0x116705(_0x581a09);});});}exports[_0x3db4('0x15')]=function(_0x5530c3){var _0x367896=this;return new Promise(function(_0x423893,_0x5c7fb1){return db[_0x3db4('0x16')][_0x3db4('0x17')]({'raw':_0x5530c3[_0x3db4('0x18')]?_0x5530c3[_0x3db4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5530c3[_0x3db4('0x18')]?_0x5530c3[_0x3db4('0x18')][_0x3db4('0x19')]||null:null,'attributes':_0x5530c3[_0x3db4('0x18')]?_0x5530c3[_0x3db4('0x18')][_0x3db4('0x1a')]||null:null,'limit':_0x5530c3['options']?_0x5530c3[_0x3db4('0x18')][_0x3db4('0x1b')]||null:null,'include':_0x5530c3[_0x3db4('0x18')]?_0x5530c3[_0x3db4('0x18')][_0x3db4('0x1c')]?_[_0x3db4('0x1d')](_0x5530c3[_0x3db4('0x18')][_0x3db4('0x1c')],function(_0x5c8e1e){return{'model':db[_0x5c8e1e[_0x3db4('0x1e')]],'as':_0x5c8e1e['as'],'attributes':_0x5c8e1e[_0x3db4('0x1a')],'include':_0x5c8e1e[_0x3db4('0x1c')]?_[_0x3db4('0x1d')](_0x5c8e1e[_0x3db4('0x1c')],function(_0x1be710){return{'model':db[_0x1be710[_0x3db4('0x1e')]],'as':_0x1be710['as'],'attributes':_0x1be710[_0x3db4('0x1a')],'include':_0x1be710[_0x3db4('0x1c')]?_[_0x3db4('0x1d')](_0x1be710['include'],function(_0x4ce882){return{'model':db[_0x4ce882[_0x3db4('0x1e')]],'as':_0x4ce882['as'],'attributes':_0x4ce882[_0x3db4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3db4('0xb')](function(_0x4989c7){logger[_0x3db4('0x12')](_0x3db4('0x15'),_0x5530c3);logger[_0x3db4('0x1f')](_0x3db4('0x15'),_0x5530c3,JSON['stringify'](_0x4989c7));_0x423893(_0x4989c7);})[_0x3db4('0x14')](function(_0x4cba32){logger[_0x3db4('0xf')](_0x3db4('0x15'),_0x4cba32['message'],_0x5530c3);_0x5c7fb1(_0x367896[_0x3db4('0xf')](0x1f4,_0x4cba32[_0x3db4('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x40a367){var _0x45da91=this;return new Promise(function(_0x462999,_0x36401b){return db['SugarcrmAccount']['find']({'raw':_0x40a367['options']?_0x40a367['options'][_0x3db4('0x20')]===undefined?!![]:![]:!![],'where':_0x40a367[_0x3db4('0x18')]?_0x40a367['options'][_0x3db4('0x19')]||null:null,'attributes':_0x40a367[_0x3db4('0x18')]?_0x40a367[_0x3db4('0x18')][_0x3db4('0x1a')]||null:null,'include':_0x40a367['options']?_0x40a367[_0x3db4('0x18')][_0x3db4('0x1c')]?_[_0x3db4('0x1d')](_0x40a367[_0x3db4('0x18')][_0x3db4('0x1c')],function(_0x48a67b){return{'model':db[_0x48a67b[_0x3db4('0x1e')]],'as':_0x48a67b['as'],'attributes':_0x48a67b[_0x3db4('0x1a')],'include':_0x48a67b[_0x3db4('0x1c')]?_[_0x3db4('0x1d')](_0x48a67b[_0x3db4('0x1c')],function(_0x539153){return{'model':db[_0x539153[_0x3db4('0x1e')]],'as':_0x539153['as'],'attributes':_0x539153[_0x3db4('0x1a')],'include':_0x539153[_0x3db4('0x1c')]?_[_0x3db4('0x1d')](_0x539153[_0x3db4('0x1c')],function(_0x538d32){return{'model':db[_0x538d32[_0x3db4('0x1e')]],'as':_0x538d32['as'],'attributes':_0x538d32[_0x3db4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3db4('0xb')](function(_0x52f19d){logger[_0x3db4('0x12')](_0x3db4('0x21'),_0x40a367);logger[_0x3db4('0x1f')](_0x3db4('0x21'),_0x40a367,JSON[_0x3db4('0x22')](_0x52f19d));_0x462999(_0x52f19d);})['catch'](function(_0x439b42){logger[_0x3db4('0xf')](_0x3db4('0x21'),_0x439b42[_0x3db4('0x11')],_0x40a367);_0x36401b(_0x45da91[_0x3db4('0xf')](0x1f4,_0x439b42['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 94015a6..2a3cc45 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 _0x4991=['./intSugarcrmConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','getSubjects','create','put','/:id','delete','destroy','util','path','express','Router','../../components/interaction/service'];(function(_0x27c7ae,_0x3665f2){var _0x34f880=function(_0x1017f2){while(--_0x1017f2){_0x27c7ae['push'](_0x27c7ae['shift']());}};_0x34f880(++_0x3665f2);}(_0x4991,0xa5));var _0x1499=function(_0x41d8db,_0x42e1af){_0x41d8db=_0x41d8db-0x0;var _0x4aed03=_0x4991[_0x41d8db];return _0x4aed03;};'use strict';var multer=require('multer');var util=require(_0x1499('0x0'));var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1499('0x4'));var config=require('../../config/environment');var controller=require(_0x1499('0x5'));router['get']('/',auth[_0x1499('0x6')](),controller[_0x1499('0x7')]);router[_0x1499('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1499('0x9')]);router[_0x1499('0x8')]('/:id/fields',auth[_0x1499('0x6')](),controller['getFields']);router[_0x1499('0x8')](_0x1499('0xa'),auth[_0x1499('0x6')](),controller[_0x1499('0xb')]);router[_0x1499('0x8')]('/:id/descriptions',auth[_0x1499('0x6')](),controller['getDescriptions']);router['post']('/',auth[_0x1499('0x6')](),controller[_0x1499('0xc')]);router[_0x1499('0xd')](_0x1499('0xe'),auth[_0x1499('0x6')](),controller['update']);router[_0x1499('0xf')](_0x1499('0xe'),auth[_0x1499('0x6')](),controller[_0x1499('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe798=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','get','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','destroy','exports','multer','util','path'];(function(_0x51f593,_0x38d2ec){var _0x4ccfbf=function(_0x4267c8){while(--_0x4267c8){_0x51f593['push'](_0x51f593['shift']());}};_0x4ccfbf(++_0x38d2ec);}(_0xe798,0xe4));var _0x8e79=function(_0x30a8b3,_0x41a8a7){_0x30a8b3=_0x30a8b3-0x0;var _0x3ce1f4=_0xe798[_0x30a8b3];return _0x3ce1f4;};'use strict';var multer=require(_0x8e79('0x0'));var util=require(_0x8e79('0x1'));var path=require(_0x8e79('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e79('0x3'));var router=express[_0x8e79('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e79('0x5'));var interaction=require(_0x8e79('0x6'));var config=require(_0x8e79('0x7'));var controller=require(_0x8e79('0x8'));router['get']('/',auth[_0x8e79('0x9')](),controller['index']);router[_0x8e79('0xa')](_0x8e79('0xb'),auth[_0x8e79('0x9')](),controller[_0x8e79('0xc')]);router['get']('/:id/fields',auth[_0x8e79('0x9')](),controller[_0x8e79('0xd')]);router['get'](_0x8e79('0xe'),auth[_0x8e79('0x9')](),controller[_0x8e79('0xf')]);router[_0x8e79('0xa')]('/:id/descriptions',auth[_0x8e79('0x9')](),controller[_0x8e79('0x10')]);router['post']('/',auth[_0x8e79('0x9')](),controller[_0x8e79('0x11')]);router[_0x8e79('0x12')](_0x8e79('0xb'),auth[_0x8e79('0x9')](),controller['update']);router['delete']('/:id',auth[_0x8e79('0x9')](),controller[_0x8e79('0x13')]);module[_0x8e79('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 61519a6..4a343f4 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 _0x177d=['STRING'];(function(_0x4c66eb,_0x5e0e3c){var _0x3d4213=function(_0x38ce2d){while(--_0x38ce2d){_0x4c66eb['push'](_0x4c66eb['shift']());}};_0x3d4213(++_0x5e0e3c);}(_0x177d,0xae));var _0xd177=function(_0x1b5b2b,_0xd27230){_0x1b5b2b=_0x1b5b2b-0x0;var _0x26589e=_0x177d[_0x1b5b2b];return _0x26589e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd177('0x0')]},'description':{'type':Sequelize[_0xd177('0x0')]}}; \ No newline at end of file +var _0x008b=['STRING'];(function(_0x309bde,_0x3ef7f5){var _0x5fa8bc=function(_0x521e70){while(--_0x521e70){_0x309bde['push'](_0x309bde['shift']());}};_0x5fa8bc(++_0x3ef7f5);}(_0x008b,0x1ce));var _0xb008=function(_0x238b73,_0x5df76f){_0x238b73=_0x238b73-0x0;var _0x5966d9=_0x008b[_0x238b73];return _0x5966d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb008('0x0')]},'description':{'type':Sequelize[_0xb008('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a5f153c..c5610e1 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 _0xfe46=['params','include','find','create','body','getFields','SugarcrmField','pick','map','nolimit','getSubjects','hasOwnProperty','getDescriptions','findOne','order','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x3cba57,_0x39a7c4){var _0x255d48=function(_0xc92655){while(--_0xc92655){_0x3cba57['push'](_0x3cba57['shift']());}};_0x255d48(++_0x39a7c4);}(_0xfe46,0x1d7));var _0x6fe4=function(_0x4a4db3,_0x464859){_0x4a4db3=_0x4a4db3-0x0;var _0xb33dcf=_0xfe46[_0x4a4db3];return _0xb33dcf;};'use strict';var emlformat=require(_0x6fe4('0x0'));var rimraf=require(_0x6fe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fe4('0x2'));var rp=require(_0x6fe4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6fe4('0x4'));var util=require(_0x6fe4('0x5'));var path=require(_0x6fe4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6fe4('0x7'));var fs=require('fs');var fs_extra=require(_0x6fe4('0x8'));var _=require('lodash');var squel=require(_0x6fe4('0x9'));var crypto=require('crypto');var jsforce=require(_0x6fe4('0xa'));var deskjs=require(_0x6fe4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6fe4('0xc'));var Papa=require(_0x6fe4('0xd'));var Redis=require(_0x6fe4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6fe4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fe4('0x10'));var logger=require(_0x6fe4('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6fe4('0x12'));var licenseUtil=require(_0x6fe4('0x13'));var db=require(_0x6fe4('0x14'))['db'];function respondWithStatusCode(_0x26e4dd,_0x51e059){_0x51e059=_0x51e059||0xcc;return function(_0xdaebff){if(_0xdaebff){return _0x26e4dd[_0x6fe4('0x15')](_0x51e059);}return _0x26e4dd[_0x6fe4('0x16')](_0x51e059)['end']();};}function respondWithResult(_0x3602d8,_0x666b9c){_0x666b9c=_0x666b9c||0xc8;return function(_0xa48a69){if(_0xa48a69){return _0x3602d8[_0x6fe4('0x16')](_0x666b9c)['json'](_0xa48a69);}};}function respondWithFilteredResult(_0x143262,_0x2d1e70){return function(_0x229c7c){if(_0x229c7c){var _0x58c5b9=typeof _0x2d1e70[_0x6fe4('0x17')]===_0x6fe4('0x18')&&typeof _0x2d1e70[_0x6fe4('0x19')]==='undefined';var _0x1516bd=_0x229c7c[_0x6fe4('0x1a')];var _0x23a7e2=_0x58c5b9?0x0:_0x2d1e70[_0x6fe4('0x17')];var _0x435eef=_0x58c5b9?_0x229c7c['count']:_0x2d1e70['offset']+_0x2d1e70[_0x6fe4('0x19')];var _0x110a46;if(_0x435eef>=_0x1516bd){_0x435eef=_0x1516bd;_0x110a46=0xc8;}else{_0x110a46=0xce;}_0x143262['status'](_0x110a46);return _0x143262[_0x6fe4('0x1b')](_0x6fe4('0x1c'),_0x23a7e2+'-'+_0x435eef+'/'+_0x1516bd)[_0x6fe4('0x1d')](_0x229c7c);}return null;};}function patchUpdates(_0x5150ac){return function(_0x48d155){try{jsonpatch[_0x6fe4('0x1e')](_0x48d155,_0x5150ac,!![]);}catch(_0x71fcfc){return BPromise['reject'](_0x71fcfc);}return _0x48d155['save']();};}function saveUpdates(_0x184a0a,_0x2eb921){return function(_0xfadf65){if(_0xfadf65){return _0xfadf65['update'](_0x184a0a)[_0x6fe4('0x1f')](function(_0x18f8a9){return _0x18f8a9;});}return null;};}function removeEntity(_0x43c678,_0x70bb3){return function(_0x4b7892){if(_0x4b7892){return _0x4b7892[_0x6fe4('0x20')]()[_0x6fe4('0x1f')](function(){_0x43c678['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfaa49,_0x2a69ed){return function(_0x58faca){if(!_0x58faca){_0xfaa49[_0x6fe4('0x15')](0x194);}return _0x58faca;};}function handleError(_0xc9fd6e,_0x4ffc9f){_0x4ffc9f=_0x4ffc9f||0x1f4;return function(_0xc16745){logger[_0x6fe4('0x21')](_0xc16745[_0x6fe4('0x22')]);if(_0xc16745['name']){delete _0xc16745[_0x6fe4('0x23')];}_0xc9fd6e[_0x6fe4('0x16')](_0x4ffc9f)[_0x6fe4('0x24')](_0xc16745);};}exports[_0x6fe4('0x25')]=function(_0x9992d5,_0x3e8a37){var _0x49a6c4={},_0x5a0f7a={},_0x4d4aca={'count':0x0,'rows':[]};var _0x570cb3=_['map'](db[_0x6fe4('0x26')][_0x6fe4('0x27')],function(_0x4d9d32){return{'name':_0x4d9d32[_0x6fe4('0x28')],'type':_0x4d9d32[_0x6fe4('0x29')]['key']};});_0x5a0f7a[_0x6fe4('0x2a')]=_['map'](_0x570cb3,'name');_0x5a0f7a[_0x6fe4('0x2b')]=_[_0x6fe4('0x2c')](_0x9992d5[_0x6fe4('0x2b')]);_0x5a0f7a['filters']=_['intersection'](_0x5a0f7a['model'],_0x5a0f7a[_0x6fe4('0x2b')]);_0x49a6c4[_0x6fe4('0x2d')]=_[_0x6fe4('0x2e')](_0x5a0f7a[_0x6fe4('0x2a')],qs[_0x6fe4('0x2f')](_0x9992d5[_0x6fe4('0x2b')][_0x6fe4('0x2f')]));_0x49a6c4[_0x6fe4('0x2d')]=_0x49a6c4[_0x6fe4('0x2d')][_0x6fe4('0x30')]?_0x49a6c4[_0x6fe4('0x2d')]:_0x5a0f7a['model'];if(!_0x9992d5['query']['hasOwnProperty']('nolimit')){_0x49a6c4['limit']=qs['limit'](_0x9992d5[_0x6fe4('0x2b')][_0x6fe4('0x19')]);_0x49a6c4[_0x6fe4('0x17')]=qs[_0x6fe4('0x17')](_0x9992d5[_0x6fe4('0x2b')]['offset']);}_0x49a6c4['order']=qs[_0x6fe4('0x31')](_0x9992d5[_0x6fe4('0x2b')]['sort']);_0x49a6c4[_0x6fe4('0x32')]=qs['filters'](_['pick'](_0x9992d5['query'],_0x5a0f7a[_0x6fe4('0x33')]),_0x570cb3);if(_0x9992d5[_0x6fe4('0x2b')][_0x6fe4('0x34')]){_0x49a6c4['where']=_[_0x6fe4('0x35')](_0x49a6c4[_0x6fe4('0x32')],{'$or':_['map'](_0x570cb3,function(_0x206cb6){if(_0x206cb6[_0x6fe4('0x29')]!==_0x6fe4('0x36')){var _0x5e7b40={};_0x5e7b40[_0x206cb6[_0x6fe4('0x23')]]={'$like':'%'+_0x9992d5[_0x6fe4('0x2b')]['filter']+'%'};return _0x5e7b40;}})});}_0x49a6c4=_[_0x6fe4('0x35')]({},_0x49a6c4,_0x9992d5[_0x6fe4('0x37')]);var _0x384046={'where':_0x49a6c4[_0x6fe4('0x32')]};return db['SugarcrmConfiguration'][_0x6fe4('0x1a')](_0x384046)['then'](function(_0x2eec17){_0x4d4aca[_0x6fe4('0x1a')]=_0x2eec17;if(_0x9992d5[_0x6fe4('0x2b')][_0x6fe4('0x38')]){_0x49a6c4['include']=[{'all':!![]}];}return db[_0x6fe4('0x26')][_0x6fe4('0x39')](_0x49a6c4);})[_0x6fe4('0x1f')](function(_0x452b82){_0x4d4aca[_0x6fe4('0x3a')]=_0x452b82;return _0x4d4aca;})[_0x6fe4('0x1f')](respondWithFilteredResult(_0x3e8a37,_0x49a6c4))[_0x6fe4('0x3b')](handleError(_0x3e8a37,null));};exports[_0x6fe4('0x3c')]=function(_0x3bc2ab,_0x3148c8){var _0x2e07d9={'raw':![],'where':{'id':_0x3bc2ab[_0x6fe4('0x3d')]['id']}},_0x3616ee={};_0x3616ee['model']=_[_0x6fe4('0x2c')](db['SugarcrmConfiguration'][_0x6fe4('0x27')]);_0x3616ee[_0x6fe4('0x2b')]=_[_0x6fe4('0x2c')](_0x3bc2ab[_0x6fe4('0x2b')]);_0x3616ee[_0x6fe4('0x33')]=_[_0x6fe4('0x2e')](_0x3616ee[_0x6fe4('0x2a')],_0x3616ee[_0x6fe4('0x2b')]);_0x2e07d9[_0x6fe4('0x2d')]=_['intersection'](_0x3616ee['model'],qs[_0x6fe4('0x2f')](_0x3bc2ab[_0x6fe4('0x2b')][_0x6fe4('0x2f')]));_0x2e07d9['attributes']=_0x2e07d9[_0x6fe4('0x2d')][_0x6fe4('0x30')]?_0x2e07d9[_0x6fe4('0x2d')]:_0x3616ee[_0x6fe4('0x2a')];if(_0x3bc2ab[_0x6fe4('0x2b')]['includeAll']){_0x2e07d9[_0x6fe4('0x3e')]=[{'all':!![]}];}_0x2e07d9=_[_0x6fe4('0x35')]({},_0x2e07d9,_0x3bc2ab[_0x6fe4('0x37')]);return db['SugarcrmConfiguration'][_0x6fe4('0x3f')](_0x2e07d9)[_0x6fe4('0x1f')](handleEntityNotFound(_0x3148c8,null))[_0x6fe4('0x1f')](respondWithResult(_0x3148c8,null))[_0x6fe4('0x3b')](handleError(_0x3148c8,null));};exports[_0x6fe4('0x40')]=function(_0x201964,_0x212381){return db[_0x6fe4('0x26')][_0x6fe4('0x40')](_0x201964['body'],{})[_0x6fe4('0x1f')](respondWithResult(_0x212381,0xc9))[_0x6fe4('0x3b')](handleError(_0x212381,null));};exports['update']=function(_0x518deb,_0x69e5a9){if(_0x518deb[_0x6fe4('0x41')]['id']){delete _0x518deb[_0x6fe4('0x41')]['id'];}return db[_0x6fe4('0x26')]['find']({'where':{'id':_0x518deb['params']['id']}})['then'](handleEntityNotFound(_0x69e5a9,null))[_0x6fe4('0x1f')](saveUpdates(_0x518deb[_0x6fe4('0x41')],null))[_0x6fe4('0x1f')](respondWithResult(_0x69e5a9,null))[_0x6fe4('0x3b')](handleError(_0x69e5a9,null));};exports[_0x6fe4('0x20')]=function(_0x1b5e78,_0x10eb4f){return db[_0x6fe4('0x26')][_0x6fe4('0x3f')]({'where':{'id':_0x1b5e78[_0x6fe4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x10eb4f,null))['then'](removeEntity(_0x10eb4f,null))[_0x6fe4('0x3b')](handleError(_0x10eb4f,null));};exports[_0x6fe4('0x42')]=function(_0x358b8b,_0x3a0e98,_0x5e8ae6){var _0x319c01={};var _0x47c90d={};var _0x158ec7;var _0x3cbf2c;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x358b8b['params']['id']}})['then'](handleEntityNotFound(_0x3a0e98,null))['then'](function(_0x4fb705){if(_0x4fb705){_0x158ec7=_0x4fb705;_0x47c90d[_0x6fe4('0x2a')]=_['keys'](db[_0x6fe4('0x43')][_0x6fe4('0x27')]);_0x47c90d[_0x6fe4('0x2b')]=_[_0x6fe4('0x2c')](_0x358b8b[_0x6fe4('0x2b')]);_0x47c90d[_0x6fe4('0x33')]=_[_0x6fe4('0x2e')](_0x47c90d[_0x6fe4('0x2a')],_0x47c90d[_0x6fe4('0x2b')]);_0x319c01[_0x6fe4('0x2d')]=_[_0x6fe4('0x2e')](_0x47c90d[_0x6fe4('0x2a')],qs[_0x6fe4('0x2f')](_0x358b8b[_0x6fe4('0x2b')][_0x6fe4('0x2f')]));_0x319c01['attributes']=_0x319c01[_0x6fe4('0x2d')][_0x6fe4('0x30')]?_0x319c01[_0x6fe4('0x2d')]:_0x47c90d[_0x6fe4('0x2a')];_0x319c01['order']=qs[_0x6fe4('0x31')](_0x358b8b[_0x6fe4('0x2b')]['sort']);_0x319c01[_0x6fe4('0x32')]=qs['filters'](_[_0x6fe4('0x44')](_0x358b8b[_0x6fe4('0x2b')],_0x47c90d['filters']));if(_0x358b8b[_0x6fe4('0x2b')]['filter']){_0x319c01[_0x6fe4('0x32')]=_['merge'](_0x319c01[_0x6fe4('0x32')],{'$or':_[_0x6fe4('0x45')](_0x319c01['attributes'],function(_0x35ac87){var _0xa386c={};_0xa386c[_0x35ac87]={'$like':'%'+_0x358b8b[_0x6fe4('0x2b')]['filter']+'%'};return _0xa386c;})});}_0x319c01=_[_0x6fe4('0x35')]({},_0x319c01,_0x358b8b[_0x6fe4('0x37')]);return _0x158ec7[_0x6fe4('0x42')](_0x319c01);}})[_0x6fe4('0x1f')](function(_0x588dd3){if(_0x588dd3){_0x3cbf2c=_0x588dd3[_0x6fe4('0x30')];if(!_0x358b8b[_0x6fe4('0x2b')]['hasOwnProperty'](_0x6fe4('0x46'))){_0x319c01[_0x6fe4('0x19')]=qs[_0x6fe4('0x19')](_0x358b8b['query'][_0x6fe4('0x19')]);_0x319c01[_0x6fe4('0x17')]=qs[_0x6fe4('0x17')](_0x358b8b['query'][_0x6fe4('0x17')]);}return _0x158ec7['getFields'](_0x319c01);}})[_0x6fe4('0x1f')](function(_0x255fcd){if(_0x255fcd){return _0x255fcd?{'count':_0x3cbf2c,'rows':_0x255fcd}:null;}})[_0x6fe4('0x1f')](respondWithResult(_0x3a0e98,null))[_0x6fe4('0x3b')](handleError(_0x3a0e98,null));};exports[_0x6fe4('0x47')]=function(_0x2c0150,_0x23c898,_0x2acd62){var _0x21a497={};var _0x49e3d0={};var _0x5216bd;var _0x4db4f5;return db[_0x6fe4('0x26')]['findOne']({'where':{'id':_0x2c0150[_0x6fe4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x23c898,null))['then'](function(_0x441642){if(_0x441642){_0x5216bd=_0x441642;_0x49e3d0[_0x6fe4('0x2a')]=_[_0x6fe4('0x2c')](db['SugarcrmField'][_0x6fe4('0x27')]);_0x49e3d0['query']=_['keys'](_0x2c0150[_0x6fe4('0x2b')]);_0x49e3d0[_0x6fe4('0x33')]=_[_0x6fe4('0x2e')](_0x49e3d0[_0x6fe4('0x2a')],_0x49e3d0[_0x6fe4('0x2b')]);_0x21a497[_0x6fe4('0x2d')]=_[_0x6fe4('0x2e')](_0x49e3d0[_0x6fe4('0x2a')],qs[_0x6fe4('0x2f')](_0x2c0150[_0x6fe4('0x2b')]['fields']));_0x21a497[_0x6fe4('0x2d')]=_0x21a497[_0x6fe4('0x2d')][_0x6fe4('0x30')]?_0x21a497[_0x6fe4('0x2d')]:_0x49e3d0[_0x6fe4('0x2a')];_0x21a497['order']=qs[_0x6fe4('0x31')](_0x2c0150[_0x6fe4('0x2b')][_0x6fe4('0x31')]);_0x21a497[_0x6fe4('0x32')]=qs[_0x6fe4('0x33')](_['pick'](_0x2c0150[_0x6fe4('0x2b')],_0x49e3d0[_0x6fe4('0x33')]));if(_0x2c0150[_0x6fe4('0x2b')]['filter']){_0x21a497['where']=_[_0x6fe4('0x35')](_0x21a497[_0x6fe4('0x32')],{'$or':_[_0x6fe4('0x45')](_0x21a497[_0x6fe4('0x2d')],function(_0x209638){var _0x9bee98={};_0x9bee98[_0x209638]={'$like':'%'+_0x2c0150[_0x6fe4('0x2b')][_0x6fe4('0x34')]+'%'};return _0x9bee98;})});}_0x21a497=_[_0x6fe4('0x35')]({},_0x21a497,_0x2c0150[_0x6fe4('0x37')]);return _0x5216bd[_0x6fe4('0x47')](_0x21a497);}})[_0x6fe4('0x1f')](function(_0x48f490){if(_0x48f490){_0x4db4f5=_0x48f490[_0x6fe4('0x30')];if(!_0x2c0150['query'][_0x6fe4('0x48')](_0x6fe4('0x46'))){_0x21a497[_0x6fe4('0x19')]=qs[_0x6fe4('0x19')](_0x2c0150['query'][_0x6fe4('0x19')]);_0x21a497[_0x6fe4('0x17')]=qs[_0x6fe4('0x17')](_0x2c0150[_0x6fe4('0x2b')]['offset']);}return _0x5216bd[_0x6fe4('0x47')](_0x21a497);}})[_0x6fe4('0x1f')](function(_0x4a3a3d){if(_0x4a3a3d){return _0x4a3a3d?{'count':_0x4db4f5,'rows':_0x4a3a3d}:null;}})[_0x6fe4('0x1f')](respondWithResult(_0x23c898,null))['catch'](handleError(_0x23c898,null));};exports[_0x6fe4('0x49')]=function(_0x530567,_0x311b4d,_0x24681d){var _0x1f4b71={};var _0x5e5de3={};var _0x4af8d9;var _0xc3e72b;return db[_0x6fe4('0x26')][_0x6fe4('0x4a')]({'where':{'id':_0x530567[_0x6fe4('0x3d')]['id']}})[_0x6fe4('0x1f')](handleEntityNotFound(_0x311b4d,null))['then'](function(_0x3eba8c){if(_0x3eba8c){_0x4af8d9=_0x3eba8c;_0x5e5de3[_0x6fe4('0x2a')]=_['keys'](db[_0x6fe4('0x43')][_0x6fe4('0x27')]);_0x5e5de3[_0x6fe4('0x2b')]=_[_0x6fe4('0x2c')](_0x530567[_0x6fe4('0x2b')]);_0x5e5de3[_0x6fe4('0x33')]=_[_0x6fe4('0x2e')](_0x5e5de3[_0x6fe4('0x2a')],_0x5e5de3[_0x6fe4('0x2b')]);_0x1f4b71[_0x6fe4('0x2d')]=_[_0x6fe4('0x2e')](_0x5e5de3[_0x6fe4('0x2a')],qs[_0x6fe4('0x2f')](_0x530567[_0x6fe4('0x2b')][_0x6fe4('0x2f')]));_0x1f4b71[_0x6fe4('0x2d')]=_0x1f4b71[_0x6fe4('0x2d')][_0x6fe4('0x30')]?_0x1f4b71[_0x6fe4('0x2d')]:_0x5e5de3['model'];_0x1f4b71[_0x6fe4('0x4b')]=qs['sort'](_0x530567[_0x6fe4('0x2b')][_0x6fe4('0x31')]);_0x1f4b71['where']=qs[_0x6fe4('0x33')](_['pick'](_0x530567[_0x6fe4('0x2b')],_0x5e5de3[_0x6fe4('0x33')]));if(_0x530567[_0x6fe4('0x2b')][_0x6fe4('0x34')]){_0x1f4b71[_0x6fe4('0x32')]=_[_0x6fe4('0x35')](_0x1f4b71[_0x6fe4('0x32')],{'$or':_[_0x6fe4('0x45')](_0x1f4b71[_0x6fe4('0x2d')],function(_0x4bacd5){var _0x73d0d5={};_0x73d0d5[_0x4bacd5]={'$like':'%'+_0x530567[_0x6fe4('0x2b')]['filter']+'%'};return _0x73d0d5;})});}_0x1f4b71=_['merge']({},_0x1f4b71,_0x530567[_0x6fe4('0x37')]);return _0x4af8d9[_0x6fe4('0x49')](_0x1f4b71);}})['then'](function(_0x34bc06){if(_0x34bc06){_0xc3e72b=_0x34bc06[_0x6fe4('0x30')];if(!_0x530567['query'][_0x6fe4('0x48')](_0x6fe4('0x46'))){_0x1f4b71[_0x6fe4('0x19')]=qs[_0x6fe4('0x19')](_0x530567[_0x6fe4('0x2b')]['limit']);_0x1f4b71[_0x6fe4('0x17')]=qs[_0x6fe4('0x17')](_0x530567[_0x6fe4('0x2b')][_0x6fe4('0x17')]);}return _0x4af8d9[_0x6fe4('0x49')](_0x1f4b71);}})[_0x6fe4('0x1f')](function(_0x3d26d1){if(_0x3d26d1){return _0x3d26d1?{'count':_0xc3e72b,'rows':_0x3d26d1}:null;}})['then'](respondWithResult(_0x311b4d,null))[_0x6fe4('0x3b')](handleError(_0x311b4d,null));}; \ No newline at end of file +var _0x7079=['../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmConfiguration','includeAll','include','findAll','show','params','find','catch','create','body','destroy','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0xffd0c6,_0x1fa211){var _0x4e849c=function(_0x249100){while(--_0x249100){_0xffd0c6['push'](_0xffd0c6['shift']());}};_0x4e849c(++_0x1fa211);}(_0x7079,0x8c));var _0x9707=function(_0x12e77c,_0x2f9499){_0x12e77c=_0x12e77c-0x0;var _0x3bdfe6=_0x7079[_0x12e77c];return _0x3bdfe6;};'use strict';var emlformat=require(_0x9707('0x0'));var rimraf=require(_0x9707('0x1'));var zipdir=require(_0x9707('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9707('0x3'));var BPromise=require(_0x9707('0x4'));var Mustache=require(_0x9707('0x5'));var util=require('util');var path=require(_0x9707('0x6'));var sox=require(_0x9707('0x7'));var csv=require(_0x9707('0x8'));var ejs=require(_0x9707('0x9'));var fs=require('fs');var fs_extra=require(_0x9707('0xa'));var _=require(_0x9707('0xb'));var squel=require(_0x9707('0xc'));var crypto=require(_0x9707('0xd'));var jsforce=require(_0x9707('0xe'));var deskjs=require(_0x9707('0xf'));var toCsv=require(_0x9707('0x8'));var querystring=require(_0x9707('0x10'));var Papa=require(_0x9707('0x11'));var Redis=require(_0x9707('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9707('0x13'));var as=require(_0x9707('0x14'));var hardwareService=require(_0x9707('0x15'));var logger=require(_0x9707('0x16'))('api');var utils=require(_0x9707('0x17'));var config=require(_0x9707('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9707('0x19'))['db'];function respondWithStatusCode(_0x405282,_0x4cdc10){_0x4cdc10=_0x4cdc10||0xcc;return function(_0x333fe8){if(_0x333fe8){return _0x405282['sendStatus'](_0x4cdc10);}return _0x405282[_0x9707('0x1a')](_0x4cdc10)[_0x9707('0x1b')]();};}function respondWithResult(_0x42ad6a,_0x1b15b8){_0x1b15b8=_0x1b15b8||0xc8;return function(_0x4827bc){if(_0x4827bc){return _0x42ad6a[_0x9707('0x1a')](_0x1b15b8)['json'](_0x4827bc);}};}function respondWithFilteredResult(_0x5e696f,_0x20a531){return function(_0x2a080c){if(_0x2a080c){var _0x369272=typeof _0x20a531[_0x9707('0x1c')]===_0x9707('0x1d')&&typeof _0x20a531[_0x9707('0x1e')]===_0x9707('0x1d');var _0x4b45cf=_0x2a080c[_0x9707('0x1f')];var _0x41b93b=_0x369272?0x0:_0x20a531[_0x9707('0x1c')];var _0x29d9d8=_0x369272?_0x2a080c[_0x9707('0x1f')]:_0x20a531[_0x9707('0x1c')]+_0x20a531[_0x9707('0x1e')];var _0x427f35;if(_0x29d9d8>=_0x4b45cf){_0x29d9d8=_0x4b45cf;_0x427f35=0xc8;}else{_0x427f35=0xce;}_0x5e696f['status'](_0x427f35);return _0x5e696f[_0x9707('0x20')](_0x9707('0x21'),_0x41b93b+'-'+_0x29d9d8+'/'+_0x4b45cf)[_0x9707('0x22')](_0x2a080c);}return null;};}function patchUpdates(_0x58c054){return function(_0x4416ee){try{jsonpatch[_0x9707('0x23')](_0x4416ee,_0x58c054,!![]);}catch(_0x81dbb3){return BPromise[_0x9707('0x24')](_0x81dbb3);}return _0x4416ee[_0x9707('0x25')]();};}function saveUpdates(_0x48894e,_0x4a3d99){return function(_0x371996){if(_0x371996){return _0x371996['update'](_0x48894e)[_0x9707('0x26')](function(_0x382b55){return _0x382b55;});}return null;};}function removeEntity(_0x1561b5,_0xfdae9){return function(_0x156c09){if(_0x156c09){return _0x156c09['destroy']()[_0x9707('0x26')](function(){_0x1561b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x431be7,_0x8d5168){return function(_0x507a12){if(!_0x507a12){_0x431be7['sendStatus'](0x194);}return _0x507a12;};}function handleError(_0x18659d,_0xb59c3c){_0xb59c3c=_0xb59c3c||0x1f4;return function(_0x37c1b4){logger[_0x9707('0x27')](_0x37c1b4['stack']);if(_0x37c1b4['name']){delete _0x37c1b4[_0x9707('0x28')];}_0x18659d[_0x9707('0x1a')](_0xb59c3c)[_0x9707('0x29')](_0x37c1b4);};}exports[_0x9707('0x2a')]=function(_0x4ac675,_0x311752){var _0x17cb29={},_0x47ca9f={},_0x4afc30={'count':0x0,'rows':[]};var _0x4e86dc=_[_0x9707('0x2b')](db['SugarcrmConfiguration'][_0x9707('0x2c')],function(_0x1d5389){return{'name':_0x1d5389[_0x9707('0x2d')],'type':_0x1d5389[_0x9707('0x2e')][_0x9707('0x2f')]};});_0x47ca9f[_0x9707('0x30')]=_[_0x9707('0x2b')](_0x4e86dc,_0x9707('0x28'));_0x47ca9f['query']=_[_0x9707('0x31')](_0x4ac675['query']);_0x47ca9f[_0x9707('0x32')]=_[_0x9707('0x33')](_0x47ca9f[_0x9707('0x30')],_0x47ca9f[_0x9707('0x34')]);_0x17cb29[_0x9707('0x35')]=_[_0x9707('0x33')](_0x47ca9f[_0x9707('0x30')],qs['fields'](_0x4ac675[_0x9707('0x34')][_0x9707('0x36')]));_0x17cb29[_0x9707('0x35')]=_0x17cb29[_0x9707('0x35')][_0x9707('0x37')]?_0x17cb29[_0x9707('0x35')]:_0x47ca9f['model'];if(!_0x4ac675[_0x9707('0x34')][_0x9707('0x38')](_0x9707('0x39'))){_0x17cb29['limit']=qs['limit'](_0x4ac675[_0x9707('0x34')][_0x9707('0x1e')]);_0x17cb29['offset']=qs['offset'](_0x4ac675[_0x9707('0x34')][_0x9707('0x1c')]);}_0x17cb29[_0x9707('0x3a')]=qs[_0x9707('0x3b')](_0x4ac675[_0x9707('0x34')]['sort']);_0x17cb29[_0x9707('0x3c')]=qs[_0x9707('0x32')](_[_0x9707('0x3d')](_0x4ac675[_0x9707('0x34')],_0x47ca9f[_0x9707('0x32')]),_0x4e86dc);if(_0x4ac675[_0x9707('0x34')]['filter']){_0x17cb29['where']=_[_0x9707('0x3e')](_0x17cb29[_0x9707('0x3c')],{'$or':_['map'](_0x4e86dc,function(_0x3f2e2c){if(_0x3f2e2c[_0x9707('0x2e')]!==_0x9707('0x3f')){var _0x48fac1={};_0x48fac1[_0x3f2e2c[_0x9707('0x28')]]={'$like':'%'+_0x4ac675[_0x9707('0x34')][_0x9707('0x40')]+'%'};return _0x48fac1;}})});}_0x17cb29=_[_0x9707('0x3e')]({},_0x17cb29,_0x4ac675[_0x9707('0x41')]);var _0x12f143={'where':_0x17cb29['where']};return db[_0x9707('0x42')][_0x9707('0x1f')](_0x12f143)[_0x9707('0x26')](function(_0x4dab35){_0x4afc30[_0x9707('0x1f')]=_0x4dab35;if(_0x4ac675[_0x9707('0x34')][_0x9707('0x43')]){_0x17cb29[_0x9707('0x44')]=[{'all':!![]}];}return db[_0x9707('0x42')][_0x9707('0x45')](_0x17cb29);})[_0x9707('0x26')](function(_0x692cda){_0x4afc30['rows']=_0x692cda;return _0x4afc30;})['then'](respondWithFilteredResult(_0x311752,_0x17cb29))['catch'](handleError(_0x311752,null));};exports[_0x9707('0x46')]=function(_0x42f52b,_0x30d61){var _0x4fdf5f={'raw':![],'where':{'id':_0x42f52b[_0x9707('0x47')]['id']}},_0x5751f1={};_0x5751f1[_0x9707('0x30')]=_['keys'](db[_0x9707('0x42')]['rawAttributes']);_0x5751f1[_0x9707('0x34')]=_[_0x9707('0x31')](_0x42f52b[_0x9707('0x34')]);_0x5751f1['filters']=_['intersection'](_0x5751f1['model'],_0x5751f1[_0x9707('0x34')]);_0x4fdf5f[_0x9707('0x35')]=_[_0x9707('0x33')](_0x5751f1[_0x9707('0x30')],qs[_0x9707('0x36')](_0x42f52b['query'][_0x9707('0x36')]));_0x4fdf5f[_0x9707('0x35')]=_0x4fdf5f[_0x9707('0x35')][_0x9707('0x37')]?_0x4fdf5f[_0x9707('0x35')]:_0x5751f1[_0x9707('0x30')];if(_0x42f52b[_0x9707('0x34')][_0x9707('0x43')]){_0x4fdf5f[_0x9707('0x44')]=[{'all':!![]}];}_0x4fdf5f=_[_0x9707('0x3e')]({},_0x4fdf5f,_0x42f52b['options']);return db[_0x9707('0x42')][_0x9707('0x48')](_0x4fdf5f)[_0x9707('0x26')](handleEntityNotFound(_0x30d61,null))[_0x9707('0x26')](respondWithResult(_0x30d61,null))[_0x9707('0x49')](handleError(_0x30d61,null));};exports[_0x9707('0x4a')]=function(_0x4397f2,_0x20a8b4){return db['SugarcrmConfiguration']['create'](_0x4397f2['body'],{})[_0x9707('0x26')](respondWithResult(_0x20a8b4,0xc9))['catch'](handleError(_0x20a8b4,null));};exports['update']=function(_0x835790,_0x273cd8){if(_0x835790[_0x9707('0x4b')]['id']){delete _0x835790[_0x9707('0x4b')]['id'];}return db['SugarcrmConfiguration'][_0x9707('0x48')]({'where':{'id':_0x835790[_0x9707('0x47')]['id']}})[_0x9707('0x26')](handleEntityNotFound(_0x273cd8,null))[_0x9707('0x26')](saveUpdates(_0x835790[_0x9707('0x4b')],null))[_0x9707('0x26')](respondWithResult(_0x273cd8,null))['catch'](handleError(_0x273cd8,null));};exports[_0x9707('0x4c')]=function(_0x199857,_0x2a75e7){return db['SugarcrmConfiguration'][_0x9707('0x48')]({'where':{'id':_0x199857[_0x9707('0x47')]['id']}})[_0x9707('0x26')](handleEntityNotFound(_0x2a75e7,null))['then'](removeEntity(_0x2a75e7,null))['catch'](handleError(_0x2a75e7,null));};exports['getFields']=function(_0x49db8b,_0x532eec,_0x1191a5){var _0x58683e={};var _0x42ccaa={};var _0x40cafd;var _0x4aee4a;return db[_0x9707('0x42')][_0x9707('0x4d')]({'where':{'id':_0x49db8b[_0x9707('0x47')]['id']}})[_0x9707('0x26')](handleEntityNotFound(_0x532eec,null))[_0x9707('0x26')](function(_0x427853){if(_0x427853){_0x40cafd=_0x427853;_0x42ccaa['model']=_[_0x9707('0x31')](db[_0x9707('0x4e')][_0x9707('0x2c')]);_0x42ccaa[_0x9707('0x34')]=_[_0x9707('0x31')](_0x49db8b[_0x9707('0x34')]);_0x42ccaa[_0x9707('0x32')]=_[_0x9707('0x33')](_0x42ccaa[_0x9707('0x30')],_0x42ccaa[_0x9707('0x34')]);_0x58683e[_0x9707('0x35')]=_[_0x9707('0x33')](_0x42ccaa['model'],qs['fields'](_0x49db8b['query'][_0x9707('0x36')]));_0x58683e[_0x9707('0x35')]=_0x58683e['attributes'][_0x9707('0x37')]?_0x58683e['attributes']:_0x42ccaa[_0x9707('0x30')];_0x58683e[_0x9707('0x3a')]=qs[_0x9707('0x3b')](_0x49db8b['query']['sort']);_0x58683e[_0x9707('0x3c')]=qs[_0x9707('0x32')](_['pick'](_0x49db8b[_0x9707('0x34')],_0x42ccaa[_0x9707('0x32')]));if(_0x49db8b[_0x9707('0x34')][_0x9707('0x40')]){_0x58683e[_0x9707('0x3c')]=_['merge'](_0x58683e['where'],{'$or':_['map'](_0x58683e[_0x9707('0x35')],function(_0xdd162b){var _0x51601c={};_0x51601c[_0xdd162b]={'$like':'%'+_0x49db8b['query'][_0x9707('0x40')]+'%'};return _0x51601c;})});}_0x58683e=_[_0x9707('0x3e')]({},_0x58683e,_0x49db8b[_0x9707('0x41')]);return _0x40cafd['getFields'](_0x58683e);}})['then'](function(_0xf93379){if(_0xf93379){_0x4aee4a=_0xf93379['length'];if(!_0x49db8b['query'][_0x9707('0x38')](_0x9707('0x39'))){_0x58683e['limit']=qs[_0x9707('0x1e')](_0x49db8b[_0x9707('0x34')][_0x9707('0x1e')]);_0x58683e['offset']=qs[_0x9707('0x1c')](_0x49db8b['query'][_0x9707('0x1c')]);}return _0x40cafd[_0x9707('0x4f')](_0x58683e);}})[_0x9707('0x26')](function(_0x20417b){if(_0x20417b){return _0x20417b?{'count':_0x4aee4a,'rows':_0x20417b}:null;}})['then'](respondWithResult(_0x532eec,null))[_0x9707('0x49')](handleError(_0x532eec,null));};exports[_0x9707('0x50')]=function(_0x276229,_0x485558,_0x1c058d){var _0x1c0ca3={};var _0x2817a9={};var _0x369cb7;var _0x3b7f6a;return db[_0x9707('0x42')][_0x9707('0x4d')]({'where':{'id':_0x276229['params']['id']}})[_0x9707('0x26')](handleEntityNotFound(_0x485558,null))[_0x9707('0x26')](function(_0x58761c){if(_0x58761c){_0x369cb7=_0x58761c;_0x2817a9[_0x9707('0x30')]=_[_0x9707('0x31')](db[_0x9707('0x4e')][_0x9707('0x2c')]);_0x2817a9[_0x9707('0x34')]=_['keys'](_0x276229[_0x9707('0x34')]);_0x2817a9['filters']=_['intersection'](_0x2817a9['model'],_0x2817a9['query']);_0x1c0ca3['attributes']=_[_0x9707('0x33')](_0x2817a9[_0x9707('0x30')],qs['fields'](_0x276229[_0x9707('0x34')]['fields']));_0x1c0ca3[_0x9707('0x35')]=_0x1c0ca3[_0x9707('0x35')][_0x9707('0x37')]?_0x1c0ca3[_0x9707('0x35')]:_0x2817a9[_0x9707('0x30')];_0x1c0ca3['order']=qs[_0x9707('0x3b')](_0x276229[_0x9707('0x34')][_0x9707('0x3b')]);_0x1c0ca3[_0x9707('0x3c')]=qs['filters'](_[_0x9707('0x3d')](_0x276229['query'],_0x2817a9['filters']));if(_0x276229[_0x9707('0x34')]['filter']){_0x1c0ca3[_0x9707('0x3c')]=_[_0x9707('0x3e')](_0x1c0ca3['where'],{'$or':_[_0x9707('0x2b')](_0x1c0ca3[_0x9707('0x35')],function(_0x284e42){var _0x402a97={};_0x402a97[_0x284e42]={'$like':'%'+_0x276229['query'][_0x9707('0x40')]+'%'};return _0x402a97;})});}_0x1c0ca3=_[_0x9707('0x3e')]({},_0x1c0ca3,_0x276229['options']);return _0x369cb7[_0x9707('0x50')](_0x1c0ca3);}})['then'](function(_0x4c96eb){if(_0x4c96eb){_0x3b7f6a=_0x4c96eb[_0x9707('0x37')];if(!_0x276229[_0x9707('0x34')]['hasOwnProperty'](_0x9707('0x39'))){_0x1c0ca3['limit']=qs['limit'](_0x276229[_0x9707('0x34')][_0x9707('0x1e')]);_0x1c0ca3[_0x9707('0x1c')]=qs['offset'](_0x276229[_0x9707('0x34')][_0x9707('0x1c')]);}return _0x369cb7['getSubjects'](_0x1c0ca3);}})[_0x9707('0x26')](function(_0xe63f78){if(_0xe63f78){return _0xe63f78?{'count':_0x3b7f6a,'rows':_0xe63f78}:null;}})[_0x9707('0x26')](respondWithResult(_0x485558,null))[_0x9707('0x49')](handleError(_0x485558,null));};exports[_0x9707('0x51')]=function(_0x1c6644,_0x3554a2,_0x5f4118){var _0x5c3d4e={};var _0x3f4c48={};var _0x2552ce;var _0x271f45;return db[_0x9707('0x42')][_0x9707('0x4d')]({'where':{'id':_0x1c6644[_0x9707('0x47')]['id']}})[_0x9707('0x26')](handleEntityNotFound(_0x3554a2,null))['then'](function(_0x24b983){if(_0x24b983){_0x2552ce=_0x24b983;_0x3f4c48[_0x9707('0x30')]=_['keys'](db[_0x9707('0x4e')][_0x9707('0x2c')]);_0x3f4c48[_0x9707('0x34')]=_[_0x9707('0x31')](_0x1c6644[_0x9707('0x34')]);_0x3f4c48[_0x9707('0x32')]=_[_0x9707('0x33')](_0x3f4c48[_0x9707('0x30')],_0x3f4c48['query']);_0x5c3d4e[_0x9707('0x35')]=_['intersection'](_0x3f4c48['model'],qs[_0x9707('0x36')](_0x1c6644[_0x9707('0x34')][_0x9707('0x36')]));_0x5c3d4e[_0x9707('0x35')]=_0x5c3d4e[_0x9707('0x35')][_0x9707('0x37')]?_0x5c3d4e[_0x9707('0x35')]:_0x3f4c48[_0x9707('0x30')];_0x5c3d4e[_0x9707('0x3a')]=qs[_0x9707('0x3b')](_0x1c6644['query'][_0x9707('0x3b')]);_0x5c3d4e[_0x9707('0x3c')]=qs['filters'](_[_0x9707('0x3d')](_0x1c6644[_0x9707('0x34')],_0x3f4c48[_0x9707('0x32')]));if(_0x1c6644[_0x9707('0x34')][_0x9707('0x40')]){_0x5c3d4e[_0x9707('0x3c')]=_[_0x9707('0x3e')](_0x5c3d4e[_0x9707('0x3c')],{'$or':_[_0x9707('0x2b')](_0x5c3d4e[_0x9707('0x35')],function(_0x1f85e2){var _0x14833b={};_0x14833b[_0x1f85e2]={'$like':'%'+_0x1c6644[_0x9707('0x34')][_0x9707('0x40')]+'%'};return _0x14833b;})});}_0x5c3d4e=_[_0x9707('0x3e')]({},_0x5c3d4e,_0x1c6644[_0x9707('0x41')]);return _0x2552ce[_0x9707('0x51')](_0x5c3d4e);}})[_0x9707('0x26')](function(_0x2bef3d){if(_0x2bef3d){_0x271f45=_0x2bef3d[_0x9707('0x37')];if(!_0x1c6644[_0x9707('0x34')][_0x9707('0x38')]('nolimit')){_0x5c3d4e[_0x9707('0x1e')]=qs[_0x9707('0x1e')](_0x1c6644['query']['limit']);_0x5c3d4e['offset']=qs[_0x9707('0x1c')](_0x1c6644[_0x9707('0x34')][_0x9707('0x1c')]);}return _0x2552ce[_0x9707('0x51')](_0x5c3d4e);}})[_0x9707('0x26')](function(_0x510e72){if(_0x510e72){return _0x510e72?{'count':_0x271f45,'rows':_0x510e72}:null;}})['then'](respondWithResult(_0x3554a2,null))[_0x9707('0x49')](handleError(_0x3554a2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 36506be..cdbc285 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 _0xea36=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','int_sugarcrm_configurations','lodash','util'];(function(_0x13bbd1,_0x3bccaf){var _0x45f68c=function(_0x145cb2){while(--_0x145cb2){_0x13bbd1['push'](_0x13bbd1['shift']());}};_0x45f68c(++_0x3bccaf);}(_0xea36,0x1c6));var _0x6ea3=function(_0x117532,_0x44e412){_0x117532=_0x117532-0x0;var _0x352052=_0xea36[_0x117532];return _0x352052;};'use strict';var _=require(_0x6ea3('0x0'));var util=require(_0x6ea3('0x1'));var logger=require(_0x6ea3('0x2'))(_0x6ea3('0x3'));var moment=require(_0x6ea3('0x4'));var BPromise=require(_0x6ea3('0x5'));var rp=require(_0x6ea3('0x6'));var fs=require('fs');var path=require(_0x6ea3('0x7'));var rimraf=require(_0x6ea3('0x8'));var config=require(_0x6ea3('0x9'));var attributes=require(_0x6ea3('0xa'));module['exports']=function(_0x15899a,_0x5dd296){return _0x15899a['define']('SugarcrmConfiguration',attributes,{'tableName':_0x6ea3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78ca=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x78ca,0x16a));var _0xa78c=function(_0x47720a,_0x2ef9d1){_0x47720a=_0x47720a-0x0;var _0xfd28ce=_0x78ca[_0x47720a];return _0xfd28ce;};'use strict';var _=require(_0xa78c('0x0'));var util=require(_0xa78c('0x1'));var logger=require(_0xa78c('0x2'))(_0xa78c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa78c('0x4'));var fs=require('fs');var path=require(_0xa78c('0x5'));var rimraf=require(_0xa78c('0x6'));var config=require(_0xa78c('0x7'));var attributes=require(_0xa78c('0x8'));module[_0xa78c('0x9')]=function(_0x532646,_0x54980b){return _0x532646['define'](_0xa78c('0xa'),attributes,{'tableName':_0xa78c('0xb'),'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 01ffbb0..70f5fd4 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 _0xc1ee=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','debug','request\x20sent','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x4acc94,_0x29330e){var _0xb986e5=function(_0x3356fe){while(--_0x3356fe){_0x4acc94['push'](_0x4acc94['shift']());}};_0xb986e5(++_0x29330e);}(_0xc1ee,0x1e3));var _0xec1e=function(_0x357699,_0x39a550){_0x357699=_0x357699-0x0;var _0x239fa5=_0xc1ee[_0x357699];return _0x239fa5;};'use strict';var _=require(_0xec1e('0x0'));var util=require(_0xec1e('0x1'));var moment=require(_0xec1e('0x2'));var BPromise=require(_0xec1e('0x3'));var rs=require(_0xec1e('0x4'));var fs=require('fs');var Redis=require(_0xec1e('0x5'));var db=require(_0xec1e('0x6'))['db'];var utils=require(_0xec1e('0x7'));var logger=require('../../config/logger')(_0xec1e('0x8'));var config=require(_0xec1e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xec1e('0xa')][_0xec1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xacadb9,_0x36ba80,_0x409370){return new BPromise(function(_0x4e16f5,_0x9e39b){return client['request'](_0xacadb9,_0x409370)[_0xec1e('0xc')](function(_0x252c01){logger[_0xec1e('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x36ba80,'request\x20sent');logger[_0xec1e('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x36ba80,_0xec1e('0xf'),JSON[_0xec1e('0x10')](_0x252c01));if(_0x252c01[_0xec1e('0x11')]){if(_0x252c01[_0xec1e('0x11')][_0xec1e('0x12')]===0x1f4){logger[_0xec1e('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x36ba80,_0x252c01[_0xec1e('0x11')][_0xec1e('0x13')]);return _0x9e39b(_0x252c01[_0xec1e('0x11')][_0xec1e('0x13')]);}logger[_0xec1e('0x11')](_0xec1e('0x14'),_0x36ba80,_0x252c01[_0xec1e('0x11')]['message']);return _0x4e16f5(_0x252c01[_0xec1e('0x11')][_0xec1e('0x13')]);}else{logger['info'](_0xec1e('0x14'),_0x36ba80,'request\x20sent');_0x4e16f5(_0x252c01[_0xec1e('0x15')][_0xec1e('0x13')]);}})[_0xec1e('0x16')](function(_0x1f12a6){logger[_0xec1e('0x11')](_0xec1e('0x14'),_0x36ba80,_0x1f12a6);_0x9e39b(_0x1f12a6);});});} \ No newline at end of file +var _0x07ac=['request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0x07ac,0xfb));var _0xc07a=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x07ac[_0x24f326];return _0x488e2d;};'use strict';var _=require(_0xc07a('0x0'));var util=require(_0xc07a('0x1'));var moment=require(_0xc07a('0x2'));var BPromise=require('bluebird');var rs=require(_0xc07a('0x3'));var fs=require('fs');var Redis=require(_0xc07a('0x4'));var db=require(_0xc07a('0x5'))['db'];var utils=require(_0xc07a('0x6'));var logger=require(_0xc07a('0x7'))(_0xc07a('0x8'));var config=require(_0xc07a('0x9'));var jayson=require(_0xc07a('0xa'));var client=jayson[_0xc07a('0xb')][_0xc07a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x323089,_0x402d48,_0xedde05){return new BPromise(function(_0xe456ee,_0x24ee34){return client[_0xc07a('0xd')](_0x323089,_0xedde05)[_0xc07a('0xe')](function(_0x4675c3){logger[_0xc07a('0xf')](_0xc07a('0x10'),_0x402d48,_0xc07a('0x11'));logger['debug'](_0xc07a('0x12'),_0x402d48,_0xc07a('0x11'),JSON['stringify'](_0x4675c3));if(_0x4675c3[_0xc07a('0x13')]){if(_0x4675c3['error'][_0xc07a('0x14')]===0x1f4){logger[_0xc07a('0x13')](_0xc07a('0x10'),_0x402d48,_0x4675c3[_0xc07a('0x13')]['message']);return _0x24ee34(_0x4675c3[_0xc07a('0x13')]['message']);}logger[_0xc07a('0x13')](_0xc07a('0x10'),_0x402d48,_0x4675c3[_0xc07a('0x13')]['message']);return _0xe456ee(_0x4675c3[_0xc07a('0x13')][_0xc07a('0x15')]);}else{logger[_0xc07a('0xf')](_0xc07a('0x10'),_0x402d48,_0xc07a('0x11'));_0xe456ee(_0x4675c3[_0xc07a('0x16')]['message']);}})[_0xc07a('0x17')](function(_0x2ca875){logger[_0xc07a('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x402d48,_0x2ca875);_0x24ee34(_0x2ca875);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 34b4b7a..34f61e0 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 _0xc0d8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','post','create','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x1d10f1,_0x413f38){var _0x361d9d=function(_0x9424a2){while(--_0x9424a2){_0x1d10f1['push'](_0x1d10f1['shift']());}};_0x361d9d(++_0x413f38);}(_0xc0d8,0x109));var _0x8c0d=function(_0x554fa8,_0x237d00){_0x554fa8=_0x554fa8-0x0;var _0xbc477c=_0xc0d8[_0x554fa8];return _0xbc477c;};'use strict';var multer=require(_0x8c0d('0x0'));var util=require(_0x8c0d('0x1'));var path=require(_0x8c0d('0x2'));var timeout=require(_0x8c0d('0x3'));var express=require('express');var router=express[_0x8c0d('0x4')]();var fs_extra=require(_0x8c0d('0x5'));var auth=require(_0x8c0d('0x6'));var interaction=require(_0x8c0d('0x7'));var config=require(_0x8c0d('0x8'));var controller=require(_0x8c0d('0x9'));router['get']('/',auth[_0x8c0d('0xa')](),controller[_0x8c0d('0xb')]);router[_0x8c0d('0xc')](_0x8c0d('0xd'),auth[_0x8c0d('0xa')](),controller['show']);router[_0x8c0d('0xe')]('/',auth[_0x8c0d('0xa')](),controller[_0x8c0d('0xf')]);router['put']('/:id',auth[_0x8c0d('0xa')](),controller[_0x8c0d('0x10')]);router[_0x8c0d('0x11')]('/:id',auth[_0x8c0d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc701=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id'];(function(_0x1cc9d0,_0x557820){var _0x2cc4f8=function(_0x2a07ff){while(--_0x2a07ff){_0x1cc9d0['push'](_0x1cc9d0['shift']());}};_0x2cc4f8(++_0x557820);}(_0xc701,0x9e));var _0x1c70=function(_0x393d80,_0x3cb358){_0x393d80=_0x393d80-0x0;var _0x12569f=_0xc701[_0x393d80];return _0x12569f;};'use strict';var multer=require(_0x1c70('0x0'));var util=require(_0x1c70('0x1'));var path=require(_0x1c70('0x2'));var timeout=require(_0x1c70('0x3'));var express=require(_0x1c70('0x4'));var router=express[_0x1c70('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1c70('0x6'));var interaction=require(_0x1c70('0x7'));var config=require(_0x1c70('0x8'));var controller=require(_0x1c70('0x9'));router[_0x1c70('0xa')]('/',auth[_0x1c70('0xb')](),controller['index']);router[_0x1c70('0xa')](_0x1c70('0xc'),auth['isAuthenticated'](),controller[_0x1c70('0xd')]);router[_0x1c70('0xe')]('/',auth[_0x1c70('0xb')](),controller[_0x1c70('0xf')]);router[_0x1c70('0x10')](_0x1c70('0xc'),auth[_0x1c70('0xb')](),controller[_0x1c70('0x11')]);router['delete'](_0x1c70('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1c70('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 3eef1d3..1bf7af5 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 _0x5a3c=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x2f2377,_0x11cc21){var _0x441e6b=function(_0x1d0e90){while(--_0x1d0e90){_0x2f2377['push'](_0x2f2377['shift']());}};_0x441e6b(++_0x11cc21);}(_0x5a3c,0xc4));var _0xc5a3=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x5a3c[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0xc5a3('0x0'));module[_0xc5a3('0x1')]={'type':{'type':Sequelize[_0xc5a3('0x2')](_0xc5a3('0x3'),_0xc5a3('0x4'),_0xc5a3('0x5'),_0xc5a3('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc5a3('0x2')](_0xc5a3('0x3'),'variable',_0xc5a3('0x5'))},'keyContent':{'type':Sequelize[_0xc5a3('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc5a3('0x7')]},'customField':{'type':Sequelize[_0xc5a3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5a3('0x7')]}}; \ No newline at end of file +var _0x3515=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x29cb61,_0x494484){var _0x21d3e0=function(_0x3e0ac4){while(--_0x3e0ac4){_0x29cb61['push'](_0x29cb61['shift']());}};_0x21d3e0(++_0x494484);}(_0x3515,0x1c0));var _0x5351=function(_0x31bd88,_0x594c18){_0x31bd88=_0x31bd88-0x0;var _0x16e6c1=_0x3515[_0x31bd88];return _0x16e6c1;};'use strict';var Sequelize=require(_0x5351('0x0'));module[_0x5351('0x1')]={'type':{'type':Sequelize[_0x5351('0x2')](_0x5351('0x3'),_0x5351('0x4'),_0x5351('0x5'),_0x5351('0x6'),_0x5351('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5351('0x8')]},'key':{'type':Sequelize[_0x5351('0x8')]},'keyType':{'type':Sequelize[_0x5351('0x2')]('string',_0x5351('0x4'),_0x5351('0x5'))},'keyContent':{'type':Sequelize[_0x5351('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5351('0x8')]},'customField':{'type':Sequelize[_0x5351('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5351('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d61bd89..84353c0 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 _0x31af=['api','../../config/license/util','status','offset','undefined','count','set','Content-Range','json','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','SugarcrmField','includeAll','include','findAll','length','options','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2c176a,_0x12a8bd){var _0x562b47=function(_0x5db104){while(--_0x5db104){_0x2c176a['push'](_0x2c176a['shift']());}};_0x562b47(++_0x12a8bd);}(_0x31af,0x1e1));var _0xf31a=function(_0x306110,_0x947ded){_0x306110=_0x306110-0x0;var _0x9c2023=_0x31af[_0x306110];return _0x9c2023;};'use strict';var emlformat=require(_0xf31a('0x0'));var rimraf=require(_0xf31a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf31a('0x2'));var rp=require(_0xf31a('0x3'));var moment=require(_0xf31a('0x4'));var BPromise=require(_0xf31a('0x5'));var Mustache=require(_0xf31a('0x6'));var util=require(_0xf31a('0x7'));var path=require(_0xf31a('0x8'));var sox=require(_0xf31a('0x9'));var csv=require(_0xf31a('0xa'));var ejs=require(_0xf31a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf31a('0xc'));var squel=require(_0xf31a('0xd'));var crypto=require('crypto');var jsforce=require(_0xf31a('0xe'));var deskjs=require(_0xf31a('0xf'));var toCsv=require(_0xf31a('0xa'));var querystring=require(_0xf31a('0x10'));var Papa=require(_0xf31a('0x11'));var Redis=require('ioredis');var authService=require(_0xf31a('0x12'));var qs=require(_0xf31a('0x13'));var as=require(_0xf31a('0x14'));var hardwareService=require(_0xf31a('0x15'));var logger=require(_0xf31a('0x16'))(_0xf31a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf31a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x365c97,_0x8c4b2b){_0x8c4b2b=_0x8c4b2b||0xcc;return function(_0x573bdc){if(_0x573bdc){return _0x365c97['sendStatus'](_0x8c4b2b);}return _0x365c97[_0xf31a('0x19')](_0x8c4b2b)['end']();};}function respondWithResult(_0x1d8710,_0x9bce84){_0x9bce84=_0x9bce84||0xc8;return function(_0x341680){if(_0x341680){return _0x1d8710[_0xf31a('0x19')](_0x9bce84)['json'](_0x341680);}};}function respondWithFilteredResult(_0x19abd0,_0x40d9ec){return function(_0x279c37){if(_0x279c37){var _0x5f04d9=typeof _0x40d9ec[_0xf31a('0x1a')]===_0xf31a('0x1b')&&typeof _0x40d9ec['limit']===_0xf31a('0x1b');var _0x593ab3=_0x279c37[_0xf31a('0x1c')];var _0x7cc834=_0x5f04d9?0x0:_0x40d9ec['offset'];var _0x18ff67=_0x5f04d9?_0x279c37[_0xf31a('0x1c')]:_0x40d9ec[_0xf31a('0x1a')]+_0x40d9ec['limit'];var _0x51d33f;if(_0x18ff67>=_0x593ab3){_0x18ff67=_0x593ab3;_0x51d33f=0xc8;}else{_0x51d33f=0xce;}_0x19abd0[_0xf31a('0x19')](_0x51d33f);return _0x19abd0[_0xf31a('0x1d')](_0xf31a('0x1e'),_0x7cc834+'-'+_0x18ff67+'/'+_0x593ab3)[_0xf31a('0x1f')](_0x279c37);}return null;};}function patchUpdates(_0x2b0a31){return function(_0x588f19){try{jsonpatch['apply'](_0x588f19,_0x2b0a31,!![]);}catch(_0xcf47c7){return BPromise[_0xf31a('0x20')](_0xcf47c7);}return _0x588f19[_0xf31a('0x21')]();};}function saveUpdates(_0x5f0dda,_0xd7b987){return function(_0x2aae7a){if(_0x2aae7a){return _0x2aae7a[_0xf31a('0x22')](_0x5f0dda)[_0xf31a('0x23')](function(_0x189cb1){return _0x189cb1;});}return null;};}function removeEntity(_0x45d376,_0x2eed72){return function(_0x220120){if(_0x220120){return _0x220120['destroy']()[_0xf31a('0x23')](function(){_0x45d376[_0xf31a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x286e31,_0x3efc7c){return function(_0x34499f){if(!_0x34499f){_0x286e31[_0xf31a('0x24')](0x194);}return _0x34499f;};}function handleError(_0x1118e6,_0x522354){_0x522354=_0x522354||0x1f4;return function(_0xf680a3){logger[_0xf31a('0x25')](_0xf680a3[_0xf31a('0x26')]);if(_0xf680a3[_0xf31a('0x27')]){delete _0xf680a3[_0xf31a('0x27')];}_0x1118e6['status'](_0x522354)[_0xf31a('0x28')](_0xf680a3);};}exports[_0xf31a('0x29')]=function(_0x4502b9,_0x2d9aa3){var _0x1c1a55={},_0x37e323={},_0x2c8f89={'count':0x0,'rows':[]};var _0x2640e6=_[_0xf31a('0x2a')](db['SugarcrmField'][_0xf31a('0x2b')],function(_0x1ecf14){return{'name':_0x1ecf14[_0xf31a('0x2c')],'type':_0x1ecf14[_0xf31a('0x2d')][_0xf31a('0x2e')]};});_0x37e323[_0xf31a('0x2f')]=_[_0xf31a('0x2a')](_0x2640e6,_0xf31a('0x27'));_0x37e323[_0xf31a('0x30')]=_['keys'](_0x4502b9[_0xf31a('0x30')]);_0x37e323[_0xf31a('0x31')]=_[_0xf31a('0x32')](_0x37e323['model'],_0x37e323[_0xf31a('0x30')]);_0x1c1a55[_0xf31a('0x33')]=_[_0xf31a('0x32')](_0x37e323[_0xf31a('0x2f')],qs['fields'](_0x4502b9[_0xf31a('0x30')][_0xf31a('0x34')]));_0x1c1a55[_0xf31a('0x33')]=_0x1c1a55[_0xf31a('0x33')]['length']?_0x1c1a55[_0xf31a('0x33')]:_0x37e323[_0xf31a('0x2f')];if(!_0x4502b9[_0xf31a('0x30')]['hasOwnProperty'](_0xf31a('0x35'))){_0x1c1a55['limit']=qs[_0xf31a('0x36')](_0x4502b9[_0xf31a('0x30')][_0xf31a('0x36')]);_0x1c1a55['offset']=qs[_0xf31a('0x1a')](_0x4502b9[_0xf31a('0x30')][_0xf31a('0x1a')]);}_0x1c1a55[_0xf31a('0x37')]=qs[_0xf31a('0x38')](_0x4502b9[_0xf31a('0x30')]['sort']);_0x1c1a55[_0xf31a('0x39')]=qs[_0xf31a('0x31')](_[_0xf31a('0x3a')](_0x4502b9['query'],_0x37e323[_0xf31a('0x31')]),_0x2640e6);if(_0x4502b9[_0xf31a('0x30')]['filter']){_0x1c1a55[_0xf31a('0x39')]=_[_0xf31a('0x3b')](_0x1c1a55[_0xf31a('0x39')],{'$or':_['map'](_0x2640e6,function(_0x3affd8){if(_0x3affd8[_0xf31a('0x2d')]!==_0xf31a('0x3c')){var _0x504199={};_0x504199[_0x3affd8[_0xf31a('0x27')]]={'$like':'%'+_0x4502b9[_0xf31a('0x30')]['filter']+'%'};return _0x504199;}})});}_0x1c1a55=_['merge']({},_0x1c1a55,_0x4502b9['options']);var _0x34fdf4={'where':_0x1c1a55[_0xf31a('0x39')]};return db[_0xf31a('0x3d')]['count'](_0x34fdf4)['then'](function(_0x472faf){_0x2c8f89[_0xf31a('0x1c')]=_0x472faf;if(_0x4502b9[_0xf31a('0x30')][_0xf31a('0x3e')]){_0x1c1a55[_0xf31a('0x3f')]=[{'all':!![]}];}return db[_0xf31a('0x3d')][_0xf31a('0x40')](_0x1c1a55);})[_0xf31a('0x23')](function(_0x4be11f){_0x2c8f89['rows']=_0x4be11f;return _0x2c8f89;})['then'](respondWithFilteredResult(_0x2d9aa3,_0x1c1a55))['catch'](handleError(_0x2d9aa3,null));};exports['show']=function(_0x1faa9e,_0x4891eb){var _0x3219d2={'raw':!![],'where':{'id':_0x1faa9e['params']['id']}},_0x479201={};_0x479201[_0xf31a('0x2f')]=_['keys'](db['SugarcrmField'][_0xf31a('0x2b')]);_0x479201['query']=_['keys'](_0x1faa9e[_0xf31a('0x30')]);_0x479201[_0xf31a('0x31')]=_[_0xf31a('0x32')](_0x479201['model'],_0x479201[_0xf31a('0x30')]);_0x3219d2[_0xf31a('0x33')]=_[_0xf31a('0x32')](_0x479201[_0xf31a('0x2f')],qs['fields'](_0x1faa9e[_0xf31a('0x30')][_0xf31a('0x34')]));_0x3219d2[_0xf31a('0x33')]=_0x3219d2[_0xf31a('0x33')][_0xf31a('0x41')]?_0x3219d2['attributes']:_0x479201[_0xf31a('0x2f')];if(_0x1faa9e[_0xf31a('0x30')][_0xf31a('0x3e')]){_0x3219d2['include']=[{'all':!![]}];}_0x3219d2=_[_0xf31a('0x3b')]({},_0x3219d2,_0x1faa9e[_0xf31a('0x42')]);return db['SugarcrmField'][_0xf31a('0x43')](_0x3219d2)[_0xf31a('0x23')](handleEntityNotFound(_0x4891eb,null))[_0xf31a('0x23')](respondWithResult(_0x4891eb,null))[_0xf31a('0x44')](handleError(_0x4891eb,null));};exports[_0xf31a('0x45')]=function(_0x58c473,_0x4734a7){return db[_0xf31a('0x3d')][_0xf31a('0x45')](_0x58c473[_0xf31a('0x46')],{})[_0xf31a('0x23')](respondWithResult(_0x4734a7,0xc9))[_0xf31a('0x44')](handleError(_0x4734a7,null));};exports[_0xf31a('0x22')]=function(_0x27f24f,_0x2aa7be){if(_0x27f24f[_0xf31a('0x46')]['id']){delete _0x27f24f[_0xf31a('0x46')]['id'];}return db[_0xf31a('0x3d')][_0xf31a('0x43')]({'where':{'id':_0x27f24f[_0xf31a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2aa7be,null))['then'](saveUpdates(_0x27f24f[_0xf31a('0x46')],null))[_0xf31a('0x23')](respondWithResult(_0x2aa7be,null))[_0xf31a('0x44')](handleError(_0x2aa7be,null));};exports['destroy']=function(_0x596d72,_0x46111f){return db[_0xf31a('0x3d')]['find']({'where':{'id':_0x596d72[_0xf31a('0x47')]['id']}})[_0xf31a('0x23')](handleEntityNotFound(_0x46111f,null))['then'](removeEntity(_0x46111f,null))[_0xf31a('0x44')](handleError(_0x46111f,null));}; \ No newline at end of file +var _0xd5e9=['SugarcrmField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x3a044b,_0x38d572){var _0xce51c1=function(_0x461ba0){while(--_0x461ba0){_0x3a044b['push'](_0x3a044b['shift']());}};_0xce51c1(++_0x38d572);}(_0xd5e9,0xf4));var _0x9d5e=function(_0x3bfc62,_0x17d9fe){_0x3bfc62=_0x3bfc62-0x0;var _0x5c5d92=_0xd5e9[_0x3bfc62];return _0x5c5d92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d5e('0x0'));var zipdir=require(_0x9d5e('0x1'));var jsonpatch=require(_0x9d5e('0x2'));var rp=require(_0x9d5e('0x3'));var moment=require(_0x9d5e('0x4'));var BPromise=require(_0x9d5e('0x5'));var Mustache=require(_0x9d5e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9d5e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d5e('0x8'));var _=require(_0x9d5e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9d5e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9d5e('0xb'));var querystring=require(_0x9d5e('0xc'));var Papa=require('papaparse');var Redis=require(_0x9d5e('0xd'));var authService=require(_0x9d5e('0xe'));var qs=require(_0x9d5e('0xf'));var as=require(_0x9d5e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d5e('0x11'))(_0x9d5e('0x12'));var utils=require('../../config/utils');var config=require(_0x9d5e('0x13'));var licenseUtil=require(_0x9d5e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x271764,_0x24c309){_0x24c309=_0x24c309||0xcc;return function(_0x4c939c){if(_0x4c939c){return _0x271764[_0x9d5e('0x15')](_0x24c309);}return _0x271764[_0x9d5e('0x16')](_0x24c309)['end']();};}function respondWithResult(_0x44b358,_0x4df07e){_0x4df07e=_0x4df07e||0xc8;return function(_0x3b0ca7){if(_0x3b0ca7){return _0x44b358[_0x9d5e('0x16')](_0x4df07e)['json'](_0x3b0ca7);}};}function respondWithFilteredResult(_0x1c6fa7,_0x5b1f49){return function(_0x3a3ff3){if(_0x3a3ff3){var _0x560804=typeof _0x5b1f49[_0x9d5e('0x17')]===_0x9d5e('0x18')&&typeof _0x5b1f49[_0x9d5e('0x19')]===_0x9d5e('0x18');var _0x3c6155=_0x3a3ff3[_0x9d5e('0x1a')];var _0x48af62=_0x560804?0x0:_0x5b1f49[_0x9d5e('0x17')];var _0x595fed=_0x560804?_0x3a3ff3['count']:_0x5b1f49[_0x9d5e('0x17')]+_0x5b1f49[_0x9d5e('0x19')];var _0x850a4d;if(_0x595fed>=_0x3c6155){_0x595fed=_0x3c6155;_0x850a4d=0xc8;}else{_0x850a4d=0xce;}_0x1c6fa7[_0x9d5e('0x16')](_0x850a4d);return _0x1c6fa7[_0x9d5e('0x1b')](_0x9d5e('0x1c'),_0x48af62+'-'+_0x595fed+'/'+_0x3c6155)[_0x9d5e('0x1d')](_0x3a3ff3);}return null;};}function patchUpdates(_0x2f65cb){return function(_0xf3b5cb){try{jsonpatch[_0x9d5e('0x1e')](_0xf3b5cb,_0x2f65cb,!![]);}catch(_0x3dc763){return BPromise[_0x9d5e('0x1f')](_0x3dc763);}return _0xf3b5cb[_0x9d5e('0x20')]();};}function saveUpdates(_0x1790f4,_0x19de5b){return function(_0x34f281){if(_0x34f281){return _0x34f281[_0x9d5e('0x21')](_0x1790f4)[_0x9d5e('0x22')](function(_0x390ac4){return _0x390ac4;});}return null;};}function removeEntity(_0x5e3888,_0x308381){return function(_0x2bfb17){if(_0x2bfb17){return _0x2bfb17[_0x9d5e('0x23')]()[_0x9d5e('0x22')](function(){_0x5e3888[_0x9d5e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f53fe,_0x23e40b){return function(_0x3263fa){if(!_0x3263fa){_0x5f53fe[_0x9d5e('0x15')](0x194);}return _0x3263fa;};}function handleError(_0x2df16e,_0x28bc7e){_0x28bc7e=_0x28bc7e||0x1f4;return function(_0x2d5187){logger[_0x9d5e('0x24')](_0x2d5187['stack']);if(_0x2d5187[_0x9d5e('0x25')]){delete _0x2d5187[_0x9d5e('0x25')];}_0x2df16e[_0x9d5e('0x16')](_0x28bc7e)[_0x9d5e('0x26')](_0x2d5187);};}exports[_0x9d5e('0x27')]=function(_0x4f659b,_0x467595){var _0x2bea64={},_0x40554a={},_0xf50501={'count':0x0,'rows':[]};var _0x20e92d=_['map'](db[_0x9d5e('0x28')]['rawAttributes'],function(_0x3e117d){return{'name':_0x3e117d[_0x9d5e('0x29')],'type':_0x3e117d[_0x9d5e('0x2a')][_0x9d5e('0x2b')]};});_0x40554a[_0x9d5e('0x2c')]=_['map'](_0x20e92d,_0x9d5e('0x25'));_0x40554a[_0x9d5e('0x2d')]=_[_0x9d5e('0x2e')](_0x4f659b[_0x9d5e('0x2d')]);_0x40554a['filters']=_[_0x9d5e('0x2f')](_0x40554a[_0x9d5e('0x2c')],_0x40554a[_0x9d5e('0x2d')]);_0x2bea64[_0x9d5e('0x30')]=_[_0x9d5e('0x2f')](_0x40554a[_0x9d5e('0x2c')],qs[_0x9d5e('0x31')](_0x4f659b[_0x9d5e('0x2d')][_0x9d5e('0x31')]));_0x2bea64[_0x9d5e('0x30')]=_0x2bea64[_0x9d5e('0x30')][_0x9d5e('0x32')]?_0x2bea64[_0x9d5e('0x30')]:_0x40554a[_0x9d5e('0x2c')];if(!_0x4f659b['query'][_0x9d5e('0x33')]('nolimit')){_0x2bea64[_0x9d5e('0x19')]=qs['limit'](_0x4f659b[_0x9d5e('0x2d')]['limit']);_0x2bea64[_0x9d5e('0x17')]=qs[_0x9d5e('0x17')](_0x4f659b[_0x9d5e('0x2d')]['offset']);}_0x2bea64[_0x9d5e('0x34')]=qs[_0x9d5e('0x35')](_0x4f659b['query'][_0x9d5e('0x35')]);_0x2bea64[_0x9d5e('0x36')]=qs[_0x9d5e('0x37')](_[_0x9d5e('0x38')](_0x4f659b['query'],_0x40554a[_0x9d5e('0x37')]),_0x20e92d);if(_0x4f659b[_0x9d5e('0x2d')][_0x9d5e('0x39')]){_0x2bea64[_0x9d5e('0x36')]=_[_0x9d5e('0x3a')](_0x2bea64[_0x9d5e('0x36')],{'$or':_[_0x9d5e('0x3b')](_0x20e92d,function(_0x560699){if(_0x560699[_0x9d5e('0x2a')]!=='VIRTUAL'){var _0x5c20b2={};_0x5c20b2[_0x560699[_0x9d5e('0x25')]]={'$like':'%'+_0x4f659b[_0x9d5e('0x2d')][_0x9d5e('0x39')]+'%'};return _0x5c20b2;}})});}_0x2bea64=_['merge']({},_0x2bea64,_0x4f659b['options']);var _0x3509bc={'where':_0x2bea64[_0x9d5e('0x36')]};return db[_0x9d5e('0x28')][_0x9d5e('0x1a')](_0x3509bc)[_0x9d5e('0x22')](function(_0x521e33){_0xf50501[_0x9d5e('0x1a')]=_0x521e33;if(_0x4f659b[_0x9d5e('0x2d')][_0x9d5e('0x3c')]){_0x2bea64[_0x9d5e('0x3d')]=[{'all':!![]}];}return db[_0x9d5e('0x28')][_0x9d5e('0x3e')](_0x2bea64);})[_0x9d5e('0x22')](function(_0x2c5c26){_0xf50501['rows']=_0x2c5c26;return _0xf50501;})[_0x9d5e('0x22')](respondWithFilteredResult(_0x467595,_0x2bea64))[_0x9d5e('0x3f')](handleError(_0x467595,null));};exports[_0x9d5e('0x40')]=function(_0x1f39e2,_0x2256e){var _0x4e0923={'raw':!![],'where':{'id':_0x1f39e2[_0x9d5e('0x41')]['id']}},_0x132f8b={};_0x132f8b[_0x9d5e('0x2c')]=_[_0x9d5e('0x2e')](db['SugarcrmField'][_0x9d5e('0x42')]);_0x132f8b[_0x9d5e('0x2d')]=_[_0x9d5e('0x2e')](_0x1f39e2[_0x9d5e('0x2d')]);_0x132f8b[_0x9d5e('0x37')]=_['intersection'](_0x132f8b[_0x9d5e('0x2c')],_0x132f8b[_0x9d5e('0x2d')]);_0x4e0923[_0x9d5e('0x30')]=_[_0x9d5e('0x2f')](_0x132f8b[_0x9d5e('0x2c')],qs[_0x9d5e('0x31')](_0x1f39e2[_0x9d5e('0x2d')][_0x9d5e('0x31')]));_0x4e0923['attributes']=_0x4e0923[_0x9d5e('0x30')]['length']?_0x4e0923[_0x9d5e('0x30')]:_0x132f8b[_0x9d5e('0x2c')];if(_0x1f39e2[_0x9d5e('0x2d')]['includeAll']){_0x4e0923['include']=[{'all':!![]}];}_0x4e0923=_[_0x9d5e('0x3a')]({},_0x4e0923,_0x1f39e2[_0x9d5e('0x43')]);return db['SugarcrmField'][_0x9d5e('0x44')](_0x4e0923)[_0x9d5e('0x22')](handleEntityNotFound(_0x2256e,null))[_0x9d5e('0x22')](respondWithResult(_0x2256e,null))[_0x9d5e('0x3f')](handleError(_0x2256e,null));};exports['create']=function(_0x3992ad,_0x52465c){return db['SugarcrmField'][_0x9d5e('0x45')](_0x3992ad[_0x9d5e('0x46')],{})[_0x9d5e('0x22')](respondWithResult(_0x52465c,0xc9))[_0x9d5e('0x3f')](handleError(_0x52465c,null));};exports[_0x9d5e('0x21')]=function(_0x9bff47,_0x23045d){if(_0x9bff47[_0x9d5e('0x46')]['id']){delete _0x9bff47['body']['id'];}return db[_0x9d5e('0x28')][_0x9d5e('0x44')]({'where':{'id':_0x9bff47[_0x9d5e('0x41')]['id']}})[_0x9d5e('0x22')](handleEntityNotFound(_0x23045d,null))[_0x9d5e('0x22')](saveUpdates(_0x9bff47[_0x9d5e('0x46')],null))[_0x9d5e('0x22')](respondWithResult(_0x23045d,null))[_0x9d5e('0x3f')](handleError(_0x23045d,null));};exports['destroy']=function(_0x460fbb,_0x934bf5){return db[_0x9d5e('0x28')]['find']({'where':{'id':_0x460fbb[_0x9d5e('0x41')]['id']}})[_0x9d5e('0x22')](handleEntityNotFound(_0x934bf5,null))['then'](removeEntity(_0x934bf5,null))['catch'](handleError(_0x934bf5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6dd9458..9312b02 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 _0x89f0=['util','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x4b825d,_0x25cdf5){var _0xc048d0=function(_0x2456e9){while(--_0x2456e9){_0x4b825d['push'](_0x4b825d['shift']());}};_0xc048d0(++_0x25cdf5);}(_0x89f0,0x7d));var _0x089f=function(_0x455525,_0x1f2582){_0x455525=_0x455525-0x0;var _0x2dbdbd=_0x89f0[_0x455525];return _0x2dbdbd;};'use strict';var _=require(_0x089f('0x0'));var util=require(_0x089f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x089f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x089f('0x3'));var rimraf=require(_0x089f('0x4'));var config=require(_0x089f('0x5'));var attributes=require(_0x089f('0x6'));module[_0x089f('0x7')]=function(_0x25f176,_0x5b0649){return _0x25f176[_0x089f('0x8')](_0x089f('0x9'),attributes,{'tableName':_0x089f('0xa'),'paranoid':![],'indexes':[{'name':_0x089f('0xb'),'fields':[_0x089f('0xc'),_0x089f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4741=['FieldId','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x4741,0x169));var _0x1474=function(_0x32717e,_0x2db7c2){_0x32717e=_0x32717e-0x0;var _0x4f182=_0x4741[_0x32717e];return _0x4f182;};'use strict';var _=require(_0x1474('0x0'));var util=require('util');var logger=require(_0x1474('0x1'))(_0x1474('0x2'));var moment=require(_0x1474('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1474('0x4'));var rimraf=require(_0x1474('0x5'));var config=require(_0x1474('0x6'));var attributes=require(_0x1474('0x7'));module[_0x1474('0x8')]=function(_0x2d69aa,_0x5a8452){return _0x2d69aa['define'](_0x1474('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x1474('0xa'),'fields':['idField',_0x1474('0xb')],'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 e1a379e..742807e 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 _0xcb48=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x512fd8,_0x2c161f){var _0x1ceaf6=function(_0x8ee97c){while(--_0x8ee97c){_0x512fd8['push'](_0x512fd8['shift']());}};_0x1ceaf6(++_0x2c161f);}(_0xcb48,0x13e));var _0x8cb4=function(_0x144c5d,_0x52aa0b){_0x144c5d=_0x144c5d-0x0;var _0x225ab3=_0xcb48[_0x144c5d];return _0x225ab3;};'use strict';var _=require(_0x8cb4('0x0'));var util=require(_0x8cb4('0x1'));var moment=require(_0x8cb4('0x2'));var BPromise=require(_0x8cb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cb4('0x4'));var db=require(_0x8cb4('0x5'))['db'];var utils=require(_0x8cb4('0x6'));var logger=require('../../config/logger')(_0x8cb4('0x7'));var config=require(_0x8cb4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8cb4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b357a,_0x316b61,_0x17ffc6){return new BPromise(function(_0x5cca6c,_0x22c9a5){return client[_0x8cb4('0xa')](_0x5b357a,_0x17ffc6)[_0x8cb4('0xb')](function(_0x296ae6){logger[_0x8cb4('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x316b61,_0x8cb4('0xd'));logger[_0x8cb4('0xe')](_0x8cb4('0xf'),_0x316b61,'request\x20sent',JSON[_0x8cb4('0x10')](_0x296ae6));if(_0x296ae6[_0x8cb4('0x11')]){if(_0x296ae6[_0x8cb4('0x11')][_0x8cb4('0x12')]===0x1f4){logger[_0x8cb4('0x11')](_0x8cb4('0x13'),_0x316b61,_0x296ae6[_0x8cb4('0x11')]['message']);return _0x22c9a5(_0x296ae6['error'][_0x8cb4('0x14')]);}logger[_0x8cb4('0x11')](_0x8cb4('0x13'),_0x316b61,_0x296ae6[_0x8cb4('0x11')][_0x8cb4('0x14')]);return _0x5cca6c(_0x296ae6[_0x8cb4('0x11')][_0x8cb4('0x14')]);}else{logger['info'](_0x8cb4('0x13'),_0x316b61,'request\x20sent');_0x5cca6c(_0x296ae6[_0x8cb4('0x15')]['message']);}})[_0x8cb4('0x16')](function(_0x2b81c8){logger['error'](_0x8cb4('0x13'),_0x316b61,_0x2b81c8);_0x22c9a5(_0x2b81c8);});});} \ No newline at end of file +var _0x6b0c=['stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x2eb6f6,_0x2476fa){var _0x2387f6=function(_0x3af35e){while(--_0x3af35e){_0x2eb6f6['push'](_0x2eb6f6['shift']());}};_0x2387f6(++_0x2476fa);}(_0x6b0c,0xa0));var _0xc6b0=function(_0x5e1223,_0x501e41){_0x5e1223=_0x5e1223-0x0;var _0x289a3e=_0x6b0c[_0x5e1223];return _0x289a3e;};'use strict';var _=require(_0xc6b0('0x0'));var util=require(_0xc6b0('0x1'));var moment=require(_0xc6b0('0x2'));var BPromise=require(_0xc6b0('0x3'));var rs=require(_0xc6b0('0x4'));var fs=require('fs');var Redis=require(_0xc6b0('0x5'));var db=require(_0xc6b0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6b0('0x7'))(_0xc6b0('0x8'));var config=require(_0xc6b0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc6b0('0xa')][_0xc6b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x394dd6,_0x3f56a4,_0x22c238){return new BPromise(function(_0x7ecc20,_0x24182d){return client['request'](_0x394dd6,_0x22c238)['then'](function(_0x4980b6){logger[_0xc6b0('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x3f56a4,_0xc6b0('0xd'));logger[_0xc6b0('0xe')](_0xc6b0('0xf'),_0x3f56a4,_0xc6b0('0xd'),JSON[_0xc6b0('0x10')](_0x4980b6));if(_0x4980b6[_0xc6b0('0x11')]){if(_0x4980b6[_0xc6b0('0x11')][_0xc6b0('0x12')]===0x1f4){logger[_0xc6b0('0x11')](_0xc6b0('0x13'),_0x3f56a4,_0x4980b6[_0xc6b0('0x11')][_0xc6b0('0x14')]);return _0x24182d(_0x4980b6[_0xc6b0('0x11')][_0xc6b0('0x14')]);}logger[_0xc6b0('0x11')](_0xc6b0('0x13'),_0x3f56a4,_0x4980b6['error'][_0xc6b0('0x14')]);return _0x7ecc20(_0x4980b6[_0xc6b0('0x11')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x3f56a4,_0xc6b0('0xd'));_0x7ecc20(_0x4980b6['result'][_0xc6b0('0x14')]);}})[_0xc6b0('0x15')](function(_0x28e851){logger[_0xc6b0('0x11')](_0xc6b0('0x13'),_0x3f56a4,_0x28e851);_0x24182d(_0x28e851);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 90e6401..bf1c4b5 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 _0x2821=['../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ed641,_0x48af99){var _0x5318ed=function(_0x5f2ba2){while(--_0x5f2ba2){_0x4ed641['push'](_0x4ed641['shift']());}};_0x5318ed(++_0x48af99);}(_0x2821,0x87));var _0x1282=function(_0x34c3af,_0x2ba39f){_0x34c3af=_0x34c3af-0x0;var _0x181216=_0x2821[_0x34c3af];return _0x181216;};'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('0xd')](_0x1282('0x10'),auth['isAuthenticated'](),controller[_0x1282('0x11')]);router[_0x1282('0xd')](_0x1282('0x12'),auth[_0x1282('0xb')](),controller[_0x1282('0x13')]);router['post']('/',auth[_0x1282('0xb')](),controller[_0x1282('0x14')]);router['post'](_0x1282('0x10'),auth[_0x1282('0xb')](),controller['addConfiguration']);router[_0x1282('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1282('0x16')]);router[_0x1282('0x17')](_0x1282('0xe'),auth[_0x1282('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x40ca=['Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','multer','connect-timeout','express'];(function(_0xe1613,_0x27aba2){var _0x56058d=function(_0xc4ffef){while(--_0xc4ffef){_0xe1613['push'](_0xe1613['shift']());}};_0x56058d(++_0x27aba2);}(_0x40ca,0x1a1));var _0xa40c=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x40ca[_0x4d8ed9];return _0x1e2140;};'use strict';var multer=require(_0xa40c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa40c('0x1'));var express=require(_0xa40c('0x2'));var router=express[_0xa40c('0x3')]();var fs_extra=require(_0xa40c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa40c('0x5'));var config=require('../../config/environment');var controller=require(_0xa40c('0x6'));router['get']('/',auth[_0xa40c('0x7')](),controller['index']);router[_0xa40c('0x8')](_0xa40c('0x9'),auth[_0xa40c('0x7')](),controller[_0xa40c('0xa')]);router[_0xa40c('0x8')]('/:id/configurations',auth[_0xa40c('0x7')](),controller[_0xa40c('0xb')]);router[_0xa40c('0x8')](_0xa40c('0xc'),auth[_0xa40c('0x7')](),controller[_0xa40c('0xd')]);router[_0xa40c('0xe')]('/',auth[_0xa40c('0x7')](),controller[_0xa40c('0xf')]);router[_0xa40c('0xe')]('/:id/configurations',auth[_0xa40c('0x7')](),controller['addConfiguration']);router[_0xa40c('0x10')](_0xa40c('0x9'),auth[_0xa40c('0x7')](),controller[_0xa40c('0x11')]);router[_0xa40c('0x12')]('/:id',auth[_0xa40c('0x7')](),controller[_0xa40c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 03ac484..6db520f 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 _0xf2ac=['HelpDesk','sequelize','exports','STRING'];(function(_0xb469,_0x31af11){var _0x18f118=function(_0x5a4184){while(--_0x5a4184){_0xb469['push'](_0xb469['shift']());}};_0x18f118(++_0x31af11);}(_0xf2ac,0x1d5));var _0xcf2a=function(_0x5a4a74,_0x4a125f){_0x5a4a74=_0x5a4a74-0x0;var _0x3e6fd9=_0xf2ac[_0x5a4a74];return _0x3e6fd9;};'use strict';var Sequelize=require(_0xcf2a('0x0'));module[_0xcf2a('0x1')]={'name':{'type':Sequelize[_0xcf2a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcf2a('0x2')]},'username':{'type':Sequelize[_0xcf2a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcf2a('0x2')],'allowNull':![],'defaultValue':_0xcf2a('0x3')},'remoteUri':{'type':Sequelize[_0xcf2a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xcf2a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9803=['sequelize','STRING','HelpDesk'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x9803,0x1b0));var _0x3980=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9803[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x3980('0x0'));module['exports']={'name':{'type':Sequelize[_0x3980('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3980('0x1')],'allowNull':![],'defaultValue':_0x3980('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3980('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5c733b9..ccbb652 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 _0x1835=['Descriptions','VtigerField','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','token','describe','sessionName','autogenerated','reference','result','includes','remove','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields','Wrong\x20credentials','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','VtigerAccount','count','includeAll','include','findAll','rows','catch','show','create','body','params','destroy','find','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','Subjects','getSubjects','channel'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x1835,0x9f));var _0x5183=function(_0x5b0a55,_0x18c155){_0x5b0a55=_0x5b0a55-0x0;var _0x44266f=_0x1835[_0x5b0a55];return _0x44266f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5183('0x0'));var zipdir=require(_0x5183('0x1'));var jsonpatch=require(_0x5183('0x2'));var rp=require(_0x5183('0x3'));var moment=require(_0x5183('0x4'));var BPromise=require(_0x5183('0x5'));var Mustache=require(_0x5183('0x6'));var util=require(_0x5183('0x7'));var path=require(_0x5183('0x8'));var sox=require(_0x5183('0x9'));var csv=require(_0x5183('0xa'));var ejs=require(_0x5183('0xb'));var fs=require('fs');var fs_extra=require(_0x5183('0xc'));var _=require(_0x5183('0xd'));var squel=require(_0x5183('0xe'));var crypto=require(_0x5183('0xf'));var jsforce=require(_0x5183('0x10'));var deskjs=require(_0x5183('0x11'));var toCsv=require(_0x5183('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5183('0x12'));var qs=require(_0x5183('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5183('0x14'));var logger=require(_0x5183('0x15'))('api');var utils=require(_0x5183('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5183('0x17'));var db=require(_0x5183('0x18'))['db'];var integrations=require(_0x5183('0x19'));function respondWithStatusCode(_0x144de4,_0x53da25){_0x53da25=_0x53da25||0xcc;return function(_0x53ca8d){if(_0x53ca8d){return _0x144de4[_0x5183('0x1a')](_0x53da25);}return _0x144de4[_0x5183('0x1b')](_0x53da25)[_0x5183('0x1c')]();};}function respondWithResult(_0x3e0af2,_0x490a97){_0x490a97=_0x490a97||0xc8;return function(_0x4fa6c2){if(_0x4fa6c2){return _0x3e0af2[_0x5183('0x1b')](_0x490a97)[_0x5183('0x1d')](_0x4fa6c2);}};}function respondWithFilteredResult(_0x37c3d0,_0x38b6fc){return function(_0x3fa548){if(_0x3fa548){var _0x569d4e=typeof _0x38b6fc[_0x5183('0x1e')]===_0x5183('0x1f')&&typeof _0x38b6fc['limit']===_0x5183('0x1f');var _0x3fdb92=_0x3fa548['count'];var _0x4974fc=_0x569d4e?0x0:_0x38b6fc[_0x5183('0x1e')];var _0x35dd78=_0x569d4e?_0x3fa548['count']:_0x38b6fc[_0x5183('0x1e')]+_0x38b6fc[_0x5183('0x20')];var _0x2c13b3;if(_0x35dd78>=_0x3fdb92){_0x35dd78=_0x3fdb92;_0x2c13b3=0xc8;}else{_0x2c13b3=0xce;}_0x37c3d0[_0x5183('0x1b')](_0x2c13b3);return _0x37c3d0[_0x5183('0x21')](_0x5183('0x22'),_0x4974fc+'-'+_0x35dd78+'/'+_0x3fdb92)[_0x5183('0x1d')](_0x3fa548);}return null;};}function patchUpdates(_0x425908){return function(_0x5026a6){try{jsonpatch[_0x5183('0x23')](_0x5026a6,_0x425908,!![]);}catch(_0x4d41b0){return BPromise[_0x5183('0x24')](_0x4d41b0);}return _0x5026a6[_0x5183('0x25')]();};}function saveUpdates(_0x293416,_0x44d78f){return function(_0x3f4642){if(_0x3f4642){return _0x3f4642[_0x5183('0x26')](_0x293416)[_0x5183('0x27')](function(_0x541924){return _0x541924;});}return null;};}function removeEntity(_0x108617,_0x4e62b8){return function(_0x17b883){if(_0x17b883){return _0x17b883['destroy']()[_0x5183('0x27')](function(){_0x108617[_0x5183('0x1b')](0xcc)[_0x5183('0x1c')]();});}};}function handleEntityNotFound(_0x95bae9,_0x4e17db){return function(_0x16e8e2){if(!_0x16e8e2){_0x95bae9[_0x5183('0x1a')](0x194);}return _0x16e8e2;};}function handleError(_0x74bf8a,_0x7b1a62){_0x7b1a62=_0x7b1a62||0x1f4;return function(_0x4a0d43){logger[_0x5183('0x28')](_0x4a0d43[_0x5183('0x29')]);if(_0x4a0d43[_0x5183('0x2a')]){delete _0x4a0d43['name'];}_0x74bf8a['status'](_0x7b1a62)[_0x5183('0x2b')](_0x4a0d43);};}exports[_0x5183('0x2c')]=function(_0x4c11fe,_0x5c9174){var _0xfc02f0={},_0x545314={},_0x48bada={'count':0x0,'rows':[]};var _0x1fd69a=_['map'](db['VtigerAccount'][_0x5183('0x2d')],function(_0x4c85e2){return{'name':_0x4c85e2[_0x5183('0x2e')],'type':_0x4c85e2[_0x5183('0x2f')][_0x5183('0x30')]};});_0x545314[_0x5183('0x31')]=_[_0x5183('0x32')](_0x1fd69a,'name');_0x545314[_0x5183('0x33')]=_[_0x5183('0x34')](_0x4c11fe[_0x5183('0x33')]);_0x545314['filters']=_[_0x5183('0x35')](_0x545314['model'],_0x545314[_0x5183('0x33')]);_0xfc02f0[_0x5183('0x36')]=_[_0x5183('0x35')](_0x545314[_0x5183('0x31')],qs[_0x5183('0x37')](_0x4c11fe['query']['fields']));_0xfc02f0[_0x5183('0x36')]=_0xfc02f0[_0x5183('0x36')][_0x5183('0x38')]?_0xfc02f0[_0x5183('0x36')]:_0x545314[_0x5183('0x31')];if(!_0x4c11fe['query'][_0x5183('0x39')](_0x5183('0x3a'))){_0xfc02f0[_0x5183('0x20')]=qs[_0x5183('0x20')](_0x4c11fe[_0x5183('0x33')]['limit']);_0xfc02f0[_0x5183('0x1e')]=qs[_0x5183('0x1e')](_0x4c11fe[_0x5183('0x33')][_0x5183('0x1e')]);}_0xfc02f0['order']=qs[_0x5183('0x3b')](_0x4c11fe[_0x5183('0x33')][_0x5183('0x3b')]);_0xfc02f0['where']=qs[_0x5183('0x3c')](_[_0x5183('0x3d')](_0x4c11fe[_0x5183('0x33')],_0x545314[_0x5183('0x3c')]),_0x1fd69a);if(_0x4c11fe[_0x5183('0x33')][_0x5183('0x3e')]){_0xfc02f0[_0x5183('0x3f')]=_[_0x5183('0x40')](_0xfc02f0[_0x5183('0x3f')],{'$or':_[_0x5183('0x32')](_0x1fd69a,function(_0x3df801){if(_0x3df801[_0x5183('0x2f')]!=='VIRTUAL'){var _0x12570f={};_0x12570f[_0x3df801[_0x5183('0x2a')]]={'$like':'%'+_0x4c11fe[_0x5183('0x33')][_0x5183('0x3e')]+'%'};return _0x12570f;}})});}_0xfc02f0=_[_0x5183('0x40')]({},_0xfc02f0,_0x4c11fe[_0x5183('0x41')]);var _0x35601c={'where':_0xfc02f0[_0x5183('0x3f')]};return db[_0x5183('0x42')][_0x5183('0x43')](_0x35601c)[_0x5183('0x27')](function(_0x15f2a5){_0x48bada[_0x5183('0x43')]=_0x15f2a5;if(_0x4c11fe[_0x5183('0x33')][_0x5183('0x44')]){_0xfc02f0[_0x5183('0x45')]=[{'all':!![]}];}return db[_0x5183('0x42')][_0x5183('0x46')](_0xfc02f0);})[_0x5183('0x27')](function(_0x5c08d3){_0x48bada[_0x5183('0x47')]=_0x5c08d3;return _0x48bada;})[_0x5183('0x27')](respondWithFilteredResult(_0x5c9174,_0xfc02f0))[_0x5183('0x48')](handleError(_0x5c9174,null));};exports[_0x5183('0x49')]=function(_0x2e7ac4,_0x4eba2b){var _0x16a6e={'raw':![],'where':{'id':_0x2e7ac4['params']['id']}},_0x2db63f={};_0x2db63f['model']=_[_0x5183('0x34')](db[_0x5183('0x42')][_0x5183('0x2d')]);_0x2db63f[_0x5183('0x33')]=_[_0x5183('0x34')](_0x2e7ac4[_0x5183('0x33')]);_0x2db63f['filters']=_[_0x5183('0x35')](_0x2db63f[_0x5183('0x31')],_0x2db63f[_0x5183('0x33')]);_0x16a6e[_0x5183('0x36')]=_[_0x5183('0x35')](_0x2db63f[_0x5183('0x31')],qs['fields'](_0x2e7ac4[_0x5183('0x33')][_0x5183('0x37')]));_0x16a6e[_0x5183('0x36')]=_0x16a6e['attributes'][_0x5183('0x38')]?_0x16a6e[_0x5183('0x36')]:_0x2db63f[_0x5183('0x31')];if(_0x2e7ac4[_0x5183('0x33')][_0x5183('0x44')]){_0x16a6e[_0x5183('0x45')]=[{'all':!![]}];}_0x16a6e=_['merge']({},_0x16a6e,_0x2e7ac4['options']);return db[_0x5183('0x42')]['find'](_0x16a6e)[_0x5183('0x27')](handleEntityNotFound(_0x4eba2b,null))[_0x5183('0x27')](respondWithResult(_0x4eba2b,null))['catch'](handleError(_0x4eba2b,null));};exports['create']=function(_0x4e0087,_0x43d175){return db[_0x5183('0x42')][_0x5183('0x4a')](_0x4e0087[_0x5183('0x4b')],{})[_0x5183('0x27')](respondWithResult(_0x43d175,0xc9))['catch'](handleError(_0x43d175,null));};exports[_0x5183('0x26')]=function(_0x41f846,_0x4c8f6f){if(_0x41f846[_0x5183('0x4b')]['id']){delete _0x41f846[_0x5183('0x4b')]['id'];}return db[_0x5183('0x42')]['find']({'where':{'id':_0x41f846[_0x5183('0x4c')]['id']}})[_0x5183('0x27')](handleEntityNotFound(_0x4c8f6f,null))[_0x5183('0x27')](saveUpdates(_0x41f846[_0x5183('0x4b')],null))[_0x5183('0x27')](respondWithResult(_0x4c8f6f,null))['catch'](handleError(_0x4c8f6f,null));};exports[_0x5183('0x4d')]=function(_0x20c91b,_0x2b60c3){return db[_0x5183('0x42')][_0x5183('0x4e')]({'where':{'id':_0x20c91b[_0x5183('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b60c3,null))[_0x5183('0x27')](removeEntity(_0x2b60c3,null))[_0x5183('0x48')](handleError(_0x2b60c3,null));};exports[_0x5183('0x4f')]=function(_0x4119ee,_0x473907,_0xe0b81e){var _0x22e112={};var _0x18e8d7={};var _0x675ded;var _0x18ae58;return db['VtigerAccount'][_0x5183('0x50')]({'where':{'id':_0x4119ee[_0x5183('0x4c')]['id']}})['then'](handleEntityNotFound(_0x473907,null))['then'](function(_0x48f80d){if(_0x48f80d){_0x675ded=_0x48f80d;_0x18e8d7[_0x5183('0x31')]=_[_0x5183('0x34')](db[_0x5183('0x51')][_0x5183('0x2d')]);_0x18e8d7[_0x5183('0x33')]=_[_0x5183('0x34')](_0x4119ee[_0x5183('0x33')]);_0x18e8d7[_0x5183('0x3c')]=_[_0x5183('0x35')](_0x18e8d7[_0x5183('0x31')],_0x18e8d7[_0x5183('0x33')]);_0x22e112[_0x5183('0x36')]=_[_0x5183('0x35')](_0x18e8d7[_0x5183('0x31')],qs['fields'](_0x4119ee['query']['fields']));_0x22e112[_0x5183('0x36')]=_0x22e112['attributes'][_0x5183('0x38')]?_0x22e112[_0x5183('0x36')]:_0x18e8d7[_0x5183('0x31')];_0x22e112[_0x5183('0x52')]=qs[_0x5183('0x3b')](_0x4119ee[_0x5183('0x33')]['sort']);_0x22e112[_0x5183('0x3f')]=qs[_0x5183('0x3c')](_['pick'](_0x4119ee['query'],_0x18e8d7[_0x5183('0x3c')]));if(_0x4119ee[_0x5183('0x33')][_0x5183('0x3e')]){_0x22e112['where']=_[_0x5183('0x40')](_0x22e112[_0x5183('0x3f')],{'$or':_[_0x5183('0x32')](_0x22e112[_0x5183('0x36')],function(_0xc96559){var _0x364199={};_0x364199[_0xc96559]={'$like':'%'+_0x4119ee[_0x5183('0x33')]['filter']+'%'};return _0x364199;})});}_0x22e112=_[_0x5183('0x40')]({},_0x22e112,_0x4119ee[_0x5183('0x41')]);return _0x675ded['getConfigurations'](_0x22e112);}})[_0x5183('0x27')](function(_0x2c3eab){if(_0x2c3eab){_0x18ae58=_0x2c3eab['length'];if(!_0x4119ee[_0x5183('0x33')][_0x5183('0x39')]('nolimit')){_0x22e112[_0x5183('0x20')]=qs['limit'](_0x4119ee[_0x5183('0x33')][_0x5183('0x20')]);_0x22e112[_0x5183('0x1e')]=qs[_0x5183('0x1e')](_0x4119ee[_0x5183('0x33')][_0x5183('0x1e')]);}return _0x675ded['getConfigurations'](_0x22e112);}})[_0x5183('0x27')](function(_0x4f6ead){if(_0x4f6ead){return _0x4f6ead?{'count':_0x18ae58,'rows':_0x4f6ead}:null;}})[_0x5183('0x27')](respondWithResult(_0x473907,null))['catch'](handleError(_0x473907,null));};exports[_0x5183('0x53')]=function(_0x1a2c2b,_0x3d0f85,_0x33382d){if(_0x1a2c2b[_0x5183('0x4b')]['id']){delete _0x1a2c2b['body']['id'];}return db['VtigerAccount'][_0x5183('0x50')]({'where':{'id':_0x1a2c2b[_0x5183('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d0f85,null))[_0x5183('0x27')](function(_0x21751e){if(_0x21751e){_0x1a2c2b[_0x5183('0x4b')]['AccountId']=_0x21751e['id'];_0x1a2c2b[_0x5183('0x4b')][_0x5183('0x54')]=integrations[_0x5183('0x55')](_0x1a2c2b[_0x5183('0x4b')][_0x5183('0x56')],_0x1a2c2b[_0x5183('0x4b')][_0x5183('0x2f')]);_0x1a2c2b[_0x5183('0x4b')][_0x5183('0x57')]=integrations['getDescriptions'](_0x1a2c2b[_0x5183('0x4b')][_0x5183('0x56')],_0x1a2c2b['body'][_0x5183('0x2f')]);return db['VtigerConfiguration'][_0x5183('0x4a')](_0x1a2c2b[_0x5183('0x4b')],{'include':[{'model':db[_0x5183('0x58')],'as':_0x5183('0x54')},{'model':db['VtigerField'],'as':_0x5183('0x57')}]});}return null;})[_0x5183('0x27')](respondWithResult(_0x3d0f85,null))[_0x5183('0x48')](handleError(_0x3d0f85,null));};var md5=require('md5');exports['getFields']=function(_0x4ac3ac,_0x52dfcd,_0x395bde){var _0x1c9b22=null;var _0x4987be=null;var _0x58978f=null;var _0x4f6787=null;var _0x57da7e='';return db[_0x5183('0x42')][_0x5183('0x50')]({'where':{'id':_0x4ac3ac[_0x5183('0x4c')]['id']},'attributes':['id',_0x5183('0x2a'),_0x5183('0x59'),_0x5183('0x5a'),'moduleName',_0x5183('0x5b'),_0x5183('0x5c'),_0x5183('0x5d')]})[_0x5183('0x27')](handleEntityNotFound(_0x52dfcd,null))[_0x5183('0x27')](function(_0x1adb2f){if(_0x1adb2f){_0x1c9b22=_0x1adb2f['username'];_0x4987be=_0x1adb2f[_0x5183('0x5d')];_0x58978f=_0x1adb2f[_0x5183('0x5e')];_0x57da7e=_0x1adb2f[_0x5183('0x5b')];var _0x588bc4=_0x57da7e[_0x5183('0x5f')](-0x1);if(_0x588bc4==='/'){_0x57da7e=_0x57da7e['substring'](0x0,_0x57da7e[_0x5183('0x60')](_0x588bc4));}_0x4f6787=util['format'](_0x5183('0x61'),_0x57da7e);var _0x26a1be={'method':_0x5183('0x62'),'uri':_0x4f6787,'qs':{'operation':_0x5183('0x63'),'username':_0x1adb2f['username']},'json':!![]};return rp(_0x26a1be);}})[_0x5183('0x27')](function(_0x1983af){if(_0x1983af[_0x5183('0x64')]){var _0xc8af9a={'method':_0x5183('0x65'),'uri':_0x4f6787,'form':{'operation':'login','username':_0x1c9b22,'accessKey':md5(_0x1983af['result'][_0x5183('0x66')]+_0x4987be)},'json':!![]};return rp(_0xc8af9a);}})[_0x5183('0x27')](function(_0x4afe88){if(_0x4afe88[_0x5183('0x64')]){var _0x4a16d6={'method':_0x5183('0x62'),'uri':_0x4f6787,'qs':{'operation':_0x5183('0x67'),'username':_0x1c9b22,'sessionName':_0x4afe88['result'][_0x5183('0x68')],'elementType':_0x58978f},'json':!![]};return rp(_0x4a16d6);}})[_0x5183('0x27')](function(_0x2b2813){if(_0x2b2813[_0x5183('0x64')]){var _0x63df4a=[_0x5183('0x69'),_0x5183('0x6a'),'owner'];_['remove'](_0x2b2813[_0x5183('0x6b')][_0x5183('0x37')],function(_0x31d11e){return _0x63df4a[_0x5183('0x6c')](_0x31d11e['type'][_0x5183('0x2a')]);});_[_0x5183('0x6d')](_0x2b2813[_0x5183('0x6b')][_0x5183('0x37')],function(_0x23de45){return _0x23de45['editable']===_0x5183('0x6e');});return{'count':_0x2b2813[_0x5183('0x6b')][_0x5183('0x37')][_0x5183('0x38')],'rows':_[_0x5183('0x32')](_0x2b2813[_0x5183('0x6b')][_0x5183('0x37')],function(_0x39e748){return{'id':_0x39e748['name'],'name':_0x39e748[_0x5183('0x6f')],'custom':_[_0x5183('0x70')](_0x39e748['name'],_0x5183('0x71'))?!![]:![],'options':_0x39e748[_0x5183('0x2f')][_0x5183('0x2a')]===_0x5183('0x72')&&_0x39e748[_0x5183('0x2f')][_0x5183('0x73')][_0x5183('0x38')]>0x0?_[_0x5183('0x32')](_0x39e748[_0x5183('0x2f')][_0x5183('0x73')],function(_0xe81741){return{'name':_0xe81741[_0x5183('0x6f')],'value':_0xe81741[_0x5183('0x74')]};}):[]};})};}})[_0x5183('0x27')](respondWithResult(_0x52dfcd,null))[_0x5183('0x48')](function(_0x5e0078){console[_0x5183('0x75')](_0x5183('0x76')+_0x5e0078);var _0x1eea43=_0x4ac3ac['query'][_0x5183('0x77')]?0x1f4:_0x5e0078[_0x5183('0x78')]||0x1f4;logger[_0x5183('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x5183('0x79'),_0x1eea43,JSON['stringify'](_0x5e0078));delete _0x5e0078[_0x5183('0x2a')];if(_0x1eea43===0x191){_0x1eea43=0x190;}_0x52dfcd[_0x5183('0x1b')](_0x1eea43)[_0x5183('0x2b')](_0x4ac3ac[_0x5183('0x33')][_0x5183('0x77')]?{'message':_0x5183('0x7a'),'statusCode':_0x5e0078[_0x5183('0x78')]}:_0x5e0078);});}; \ No newline at end of file +var _0x35ab=['serverUrl','accessKey','substring','lastIndexOf','format','GET','getchallenge','success','login','token','describe','autogenerated','reference','owner','result','editable','false','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','filters','attributes','intersection','query','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName'];(function(_0x4b6182,_0xa98fdd){var _0x582892=function(_0x60c498){while(--_0x60c498){_0x4b6182['push'](_0x4b6182['shift']());}};_0x582892(++_0xa98fdd);}(_0x35ab,0x96));var _0xb35a=function(_0x283514,_0x47dad8){_0x283514=_0x283514-0x0;var _0x48dad3=_0x35ab[_0x283514];return _0x48dad3;};'use strict';var emlformat=require(_0xb35a('0x0'));var rimraf=require(_0xb35a('0x1'));var zipdir=require(_0xb35a('0x2'));var jsonpatch=require(_0xb35a('0x3'));var rp=require(_0xb35a('0x4'));var moment=require(_0xb35a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb35a('0x6'));var path=require('path');var sox=require(_0xb35a('0x7'));var csv=require(_0xb35a('0x8'));var ejs=require(_0xb35a('0x9'));var fs=require('fs');var fs_extra=require(_0xb35a('0xa'));var _=require(_0xb35a('0xb'));var squel=require('squel');var crypto=require(_0xb35a('0xc'));var jsforce=require(_0xb35a('0xd'));var deskjs=require(_0xb35a('0xe'));var toCsv=require(_0xb35a('0x8'));var querystring=require('querystring');var Papa=require(_0xb35a('0xf'));var Redis=require('ioredis');var authService=require(_0xb35a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb35a('0x11'));var hardwareService=require(_0xb35a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb35a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb35a('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb35a('0x15'));function respondWithStatusCode(_0x55d34a,_0xfd84e7){_0xfd84e7=_0xfd84e7||0xcc;return function(_0x43532e){if(_0x43532e){return _0x55d34a[_0xb35a('0x16')](_0xfd84e7);}return _0x55d34a[_0xb35a('0x17')](_0xfd84e7)[_0xb35a('0x18')]();};}function respondWithResult(_0x159bda,_0x657baa){_0x657baa=_0x657baa||0xc8;return function(_0x3e7d6d){if(_0x3e7d6d){return _0x159bda[_0xb35a('0x17')](_0x657baa)[_0xb35a('0x19')](_0x3e7d6d);}};}function respondWithFilteredResult(_0x4a5ded,_0x7a1c30){return function(_0x3cac3b){if(_0x3cac3b){var _0x4e7c92=typeof _0x7a1c30[_0xb35a('0x1a')]===_0xb35a('0x1b')&&typeof _0x7a1c30['limit']===_0xb35a('0x1b');var _0x325142=_0x3cac3b[_0xb35a('0x1c')];var _0x3ff298=_0x4e7c92?0x0:_0x7a1c30[_0xb35a('0x1a')];var _0x50f68c=_0x4e7c92?_0x3cac3b['count']:_0x7a1c30[_0xb35a('0x1a')]+_0x7a1c30[_0xb35a('0x1d')];var _0x48db8b;if(_0x50f68c>=_0x325142){_0x50f68c=_0x325142;_0x48db8b=0xc8;}else{_0x48db8b=0xce;}_0x4a5ded[_0xb35a('0x17')](_0x48db8b);return _0x4a5ded[_0xb35a('0x1e')](_0xb35a('0x1f'),_0x3ff298+'-'+_0x50f68c+'/'+_0x325142)[_0xb35a('0x19')](_0x3cac3b);}return null;};}function patchUpdates(_0x3b7342){return function(_0x19301d){try{jsonpatch[_0xb35a('0x20')](_0x19301d,_0x3b7342,!![]);}catch(_0x3ebb88){return BPromise[_0xb35a('0x21')](_0x3ebb88);}return _0x19301d[_0xb35a('0x22')]();};}function saveUpdates(_0x5d9ee8,_0x13d7b3){return function(_0x5ecd80){if(_0x5ecd80){return _0x5ecd80[_0xb35a('0x23')](_0x5d9ee8)[_0xb35a('0x24')](function(_0x23708a){return _0x23708a;});}return null;};}function removeEntity(_0x49e032,_0x596fa8){return function(_0x7e5484){if(_0x7e5484){return _0x7e5484[_0xb35a('0x25')]()['then'](function(){_0x49e032[_0xb35a('0x17')](0xcc)[_0xb35a('0x18')]();});}};}function handleEntityNotFound(_0x3bef50,_0x5d26e1){return function(_0x12c38b){if(!_0x12c38b){_0x3bef50[_0xb35a('0x16')](0x194);}return _0x12c38b;};}function handleError(_0x5095d8,_0x415cff){_0x415cff=_0x415cff||0x1f4;return function(_0x1f387a){logger[_0xb35a('0x26')](_0x1f387a[_0xb35a('0x27')]);if(_0x1f387a[_0xb35a('0x28')]){delete _0x1f387a[_0xb35a('0x28')];}_0x5095d8[_0xb35a('0x17')](_0x415cff)['send'](_0x1f387a);};}exports[_0xb35a('0x29')]=function(_0x3e75cb,_0x1069a7){var _0x4758c5={},_0x1e0e12={},_0x3a59b1={'count':0x0,'rows':[]};var _0x192206=_[_0xb35a('0x2a')](db[_0xb35a('0x2b')][_0xb35a('0x2c')],function(_0x8737e5){return{'name':_0x8737e5[_0xb35a('0x2d')],'type':_0x8737e5['type'][_0xb35a('0x2e')]};});_0x1e0e12[_0xb35a('0x2f')]=_[_0xb35a('0x2a')](_0x192206,'name');_0x1e0e12['query']=_[_0xb35a('0x30')](_0x3e75cb['query']);_0x1e0e12[_0xb35a('0x31')]=_['intersection'](_0x1e0e12[_0xb35a('0x2f')],_0x1e0e12['query']);_0x4758c5[_0xb35a('0x32')]=_[_0xb35a('0x33')](_0x1e0e12[_0xb35a('0x2f')],qs['fields'](_0x3e75cb[_0xb35a('0x34')][_0xb35a('0x35')]));_0x4758c5[_0xb35a('0x32')]=_0x4758c5['attributes'][_0xb35a('0x36')]?_0x4758c5[_0xb35a('0x32')]:_0x1e0e12['model'];if(!_0x3e75cb['query'][_0xb35a('0x37')](_0xb35a('0x38'))){_0x4758c5[_0xb35a('0x1d')]=qs[_0xb35a('0x1d')](_0x3e75cb[_0xb35a('0x34')][_0xb35a('0x1d')]);_0x4758c5['offset']=qs[_0xb35a('0x1a')](_0x3e75cb[_0xb35a('0x34')][_0xb35a('0x1a')]);}_0x4758c5[_0xb35a('0x39')]=qs[_0xb35a('0x3a')](_0x3e75cb[_0xb35a('0x34')][_0xb35a('0x3a')]);_0x4758c5['where']=qs[_0xb35a('0x31')](_[_0xb35a('0x3b')](_0x3e75cb[_0xb35a('0x34')],_0x1e0e12[_0xb35a('0x31')]),_0x192206);if(_0x3e75cb['query'][_0xb35a('0x3c')]){_0x4758c5[_0xb35a('0x3d')]=_['merge'](_0x4758c5[_0xb35a('0x3d')],{'$or':_[_0xb35a('0x2a')](_0x192206,function(_0x3cf62f){if(_0x3cf62f[_0xb35a('0x3e')]!==_0xb35a('0x3f')){var _0x119e2f={};_0x119e2f[_0x3cf62f['name']]={'$like':'%'+_0x3e75cb['query']['filter']+'%'};return _0x119e2f;}})});}_0x4758c5=_[_0xb35a('0x40')]({},_0x4758c5,_0x3e75cb[_0xb35a('0x41')]);var _0x5a7640={'where':_0x4758c5[_0xb35a('0x3d')]};return db['VtigerAccount'][_0xb35a('0x1c')](_0x5a7640)[_0xb35a('0x24')](function(_0x499d46){_0x3a59b1[_0xb35a('0x1c')]=_0x499d46;if(_0x3e75cb['query'][_0xb35a('0x42')]){_0x4758c5['include']=[{'all':!![]}];}return db[_0xb35a('0x2b')][_0xb35a('0x43')](_0x4758c5);})[_0xb35a('0x24')](function(_0x33d72d){_0x3a59b1[_0xb35a('0x44')]=_0x33d72d;return _0x3a59b1;})['then'](respondWithFilteredResult(_0x1069a7,_0x4758c5))[_0xb35a('0x45')](handleError(_0x1069a7,null));};exports[_0xb35a('0x46')]=function(_0xa5759f,_0x291ff5){var _0x2dbecb={'raw':![],'where':{'id':_0xa5759f[_0xb35a('0x47')]['id']}},_0x516377={};_0x516377[_0xb35a('0x2f')]=_['keys'](db[_0xb35a('0x2b')][_0xb35a('0x2c')]);_0x516377[_0xb35a('0x34')]=_[_0xb35a('0x30')](_0xa5759f[_0xb35a('0x34')]);_0x516377['filters']=_[_0xb35a('0x33')](_0x516377[_0xb35a('0x2f')],_0x516377[_0xb35a('0x34')]);_0x2dbecb[_0xb35a('0x32')]=_['intersection'](_0x516377['model'],qs[_0xb35a('0x35')](_0xa5759f[_0xb35a('0x34')][_0xb35a('0x35')]));_0x2dbecb['attributes']=_0x2dbecb[_0xb35a('0x32')][_0xb35a('0x36')]?_0x2dbecb[_0xb35a('0x32')]:_0x516377[_0xb35a('0x2f')];if(_0xa5759f[_0xb35a('0x34')][_0xb35a('0x42')]){_0x2dbecb[_0xb35a('0x48')]=[{'all':!![]}];}_0x2dbecb=_['merge']({},_0x2dbecb,_0xa5759f['options']);return db[_0xb35a('0x2b')][_0xb35a('0x49')](_0x2dbecb)['then'](handleEntityNotFound(_0x291ff5,null))['then'](respondWithResult(_0x291ff5,null))['catch'](handleError(_0x291ff5,null));};exports[_0xb35a('0x4a')]=function(_0x3d9694,_0x4a70ed){return db['VtigerAccount'][_0xb35a('0x4a')](_0x3d9694[_0xb35a('0x4b')],{})['then'](respondWithResult(_0x4a70ed,0xc9))[_0xb35a('0x45')](handleError(_0x4a70ed,null));};exports[_0xb35a('0x23')]=function(_0x480c0e,_0xfdc2a9){if(_0x480c0e[_0xb35a('0x4b')]['id']){delete _0x480c0e[_0xb35a('0x4b')]['id'];}return db['VtigerAccount'][_0xb35a('0x49')]({'where':{'id':_0x480c0e[_0xb35a('0x47')]['id']}})[_0xb35a('0x24')](handleEntityNotFound(_0xfdc2a9,null))[_0xb35a('0x24')](saveUpdates(_0x480c0e[_0xb35a('0x4b')],null))[_0xb35a('0x24')](respondWithResult(_0xfdc2a9,null))[_0xb35a('0x45')](handleError(_0xfdc2a9,null));};exports['destroy']=function(_0x5e34de,_0x226417){return db[_0xb35a('0x2b')]['find']({'where':{'id':_0x5e34de[_0xb35a('0x47')]['id']}})['then'](handleEntityNotFound(_0x226417,null))[_0xb35a('0x24')](removeEntity(_0x226417,null))[_0xb35a('0x45')](handleError(_0x226417,null));};exports[_0xb35a('0x4c')]=function(_0x11075d,_0x87b9b4,_0x3e9ee8){var _0x4760cd={};var _0x16ea9e={};var _0x2f7f17;var _0x5a9c97;return db[_0xb35a('0x2b')][_0xb35a('0x4d')]({'where':{'id':_0x11075d[_0xb35a('0x47')]['id']}})['then'](handleEntityNotFound(_0x87b9b4,null))[_0xb35a('0x24')](function(_0x40db52){if(_0x40db52){_0x2f7f17=_0x40db52;_0x16ea9e[_0xb35a('0x2f')]=_['keys'](db[_0xb35a('0x4e')][_0xb35a('0x2c')]);_0x16ea9e[_0xb35a('0x34')]=_[_0xb35a('0x30')](_0x11075d[_0xb35a('0x34')]);_0x16ea9e[_0xb35a('0x31')]=_[_0xb35a('0x33')](_0x16ea9e['model'],_0x16ea9e[_0xb35a('0x34')]);_0x4760cd[_0xb35a('0x32')]=_[_0xb35a('0x33')](_0x16ea9e[_0xb35a('0x2f')],qs[_0xb35a('0x35')](_0x11075d[_0xb35a('0x34')][_0xb35a('0x35')]));_0x4760cd[_0xb35a('0x32')]=_0x4760cd[_0xb35a('0x32')][_0xb35a('0x36')]?_0x4760cd[_0xb35a('0x32')]:_0x16ea9e[_0xb35a('0x2f')];_0x4760cd['order']=qs[_0xb35a('0x3a')](_0x11075d['query'][_0xb35a('0x3a')]);_0x4760cd[_0xb35a('0x3d')]=qs['filters'](_['pick'](_0x11075d[_0xb35a('0x34')],_0x16ea9e[_0xb35a('0x31')]));if(_0x11075d[_0xb35a('0x34')]['filter']){_0x4760cd[_0xb35a('0x3d')]=_['merge'](_0x4760cd[_0xb35a('0x3d')],{'$or':_[_0xb35a('0x2a')](_0x4760cd[_0xb35a('0x32')],function(_0x238ec9){var _0x35c12c={};_0x35c12c[_0x238ec9]={'$like':'%'+_0x11075d[_0xb35a('0x34')][_0xb35a('0x3c')]+'%'};return _0x35c12c;})});}_0x4760cd=_[_0xb35a('0x40')]({},_0x4760cd,_0x11075d[_0xb35a('0x41')]);return _0x2f7f17[_0xb35a('0x4c')](_0x4760cd);}})[_0xb35a('0x24')](function(_0x3f337c){if(_0x3f337c){_0x5a9c97=_0x3f337c['length'];if(!_0x11075d[_0xb35a('0x34')]['hasOwnProperty'](_0xb35a('0x38'))){_0x4760cd[_0xb35a('0x1d')]=qs['limit'](_0x11075d[_0xb35a('0x34')][_0xb35a('0x1d')]);_0x4760cd[_0xb35a('0x1a')]=qs[_0xb35a('0x1a')](_0x11075d[_0xb35a('0x34')][_0xb35a('0x1a')]);}return _0x2f7f17[_0xb35a('0x4c')](_0x4760cd);}})[_0xb35a('0x24')](function(_0x2127be){if(_0x2127be){return _0x2127be?{'count':_0x5a9c97,'rows':_0x2127be}:null;}})[_0xb35a('0x24')](respondWithResult(_0x87b9b4,null))['catch'](handleError(_0x87b9b4,null));};exports[_0xb35a('0x4f')]=function(_0x13c0f9,_0x313d49,_0x520d35){if(_0x13c0f9[_0xb35a('0x4b')]['id']){delete _0x13c0f9['body']['id'];}return db[_0xb35a('0x2b')]['findOne']({'where':{'id':_0x13c0f9[_0xb35a('0x47')]['id']}})[_0xb35a('0x24')](handleEntityNotFound(_0x313d49,null))[_0xb35a('0x24')](function(_0x5f231){if(_0x5f231){_0x13c0f9[_0xb35a('0x4b')][_0xb35a('0x50')]=_0x5f231['id'];_0x13c0f9[_0xb35a('0x4b')][_0xb35a('0x51')]=integrations[_0xb35a('0x52')](_0x13c0f9[_0xb35a('0x4b')][_0xb35a('0x53')],_0x13c0f9['body'][_0xb35a('0x3e')]);_0x13c0f9[_0xb35a('0x4b')][_0xb35a('0x54')]=integrations[_0xb35a('0x55')](_0x13c0f9[_0xb35a('0x4b')][_0xb35a('0x53')],_0x13c0f9[_0xb35a('0x4b')][_0xb35a('0x3e')]);return db[_0xb35a('0x4e')][_0xb35a('0x4a')](_0x13c0f9[_0xb35a('0x4b')],{'include':[{'model':db[_0xb35a('0x56')],'as':_0xb35a('0x51')},{'model':db[_0xb35a('0x56')],'as':'Descriptions'}]});}return null;})[_0xb35a('0x24')](respondWithResult(_0x313d49,null))[_0xb35a('0x45')](handleError(_0x313d49,null));};var md5=require(_0xb35a('0x57'));exports[_0xb35a('0x58')]=function(_0x2ed646,_0x36c1e2,_0x2d3d66){var _0x1f6c47=null;var _0x3cc97f=null;var _0x554ccb=null;var _0x30f4f2=null;var _0x280eb0='';return db[_0xb35a('0x2b')]['findOne']({'where':{'id':_0x2ed646[_0xb35a('0x47')]['id']},'attributes':['id',_0xb35a('0x28'),_0xb35a('0x59'),_0xb35a('0x5a'),_0xb35a('0x5b'),'remoteUri',_0xb35a('0x5c'),'accessKey']})['then'](handleEntityNotFound(_0x36c1e2,null))[_0xb35a('0x24')](function(_0x2aec6e){if(_0x2aec6e){_0x1f6c47=_0x2aec6e[_0xb35a('0x59')];_0x3cc97f=_0x2aec6e[_0xb35a('0x5d')];_0x554ccb=_0x2aec6e['moduleName'];_0x280eb0=_0x2aec6e['remoteUri'];var _0x45e96b=_0x280eb0['slice'](-0x1);if(_0x45e96b==='/'){_0x280eb0=_0x280eb0[_0xb35a('0x5e')](0x0,_0x280eb0[_0xb35a('0x5f')](_0x45e96b));}_0x30f4f2=util[_0xb35a('0x60')]('%s/webservice.php',_0x280eb0);var _0x581bb6={'method':_0xb35a('0x61'),'uri':_0x30f4f2,'qs':{'operation':_0xb35a('0x62'),'username':_0x2aec6e[_0xb35a('0x59')]},'json':!![]};return rp(_0x581bb6);}})[_0xb35a('0x24')](function(_0x5eaa5c){if(_0x5eaa5c[_0xb35a('0x63')]){var _0x3b35b4={'method':'POST','uri':_0x30f4f2,'form':{'operation':_0xb35a('0x64'),'username':_0x1f6c47,'accessKey':md5(_0x5eaa5c['result'][_0xb35a('0x65')]+_0x3cc97f)},'json':!![]};return rp(_0x3b35b4);}})[_0xb35a('0x24')](function(_0x4ea851){if(_0x4ea851[_0xb35a('0x63')]){var _0x346d38={'method':_0xb35a('0x61'),'uri':_0x30f4f2,'qs':{'operation':_0xb35a('0x66'),'username':_0x1f6c47,'sessionName':_0x4ea851['result']['sessionName'],'elementType':_0x554ccb},'json':!![]};return rp(_0x346d38);}})[_0xb35a('0x24')](function(_0xdb6e1){if(_0xdb6e1[_0xb35a('0x63')]){var _0x13e832=[_0xb35a('0x67'),_0xb35a('0x68'),_0xb35a('0x69')];_['remove'](_0xdb6e1[_0xb35a('0x6a')]['fields'],function(_0x39c9fb){return _0x13e832['includes'](_0x39c9fb[_0xb35a('0x3e')][_0xb35a('0x28')]);});_['remove'](_0xdb6e1['result'][_0xb35a('0x35')],function(_0x380b02){return _0x380b02[_0xb35a('0x6b')]===_0xb35a('0x6c');});return{'count':_0xdb6e1['result'][_0xb35a('0x35')]['length'],'rows':_['map'](_0xdb6e1[_0xb35a('0x6a')][_0xb35a('0x35')],function(_0x33f0c3){return{'id':_0x33f0c3[_0xb35a('0x28')],'name':_0x33f0c3['label'],'custom':_['startsWith'](_0x33f0c3[_0xb35a('0x28')],_0xb35a('0x6d'))?!![]:![],'options':_0x33f0c3['type'][_0xb35a('0x28')]===_0xb35a('0x6e')&&_0x33f0c3[_0xb35a('0x3e')]['picklistValues'][_0xb35a('0x36')]>0x0?_[_0xb35a('0x2a')](_0x33f0c3[_0xb35a('0x3e')][_0xb35a('0x6f')],function(_0x278041){return{'name':_0x278041[_0xb35a('0x70')],'value':_0x278041[_0xb35a('0x71')]};}):[]};})};}})[_0xb35a('0x24')](respondWithResult(_0x36c1e2,null))[_0xb35a('0x45')](function(_0x2fe394){console[_0xb35a('0x72')](_0xb35a('0x73')+_0x2fe394);var _0x305967=_0x2ed646[_0xb35a('0x34')][_0xb35a('0x74')]?0x1f4:_0x2fe394['statusCode']||0x1f4;logger[_0xb35a('0x26')](_0xb35a('0x75'),'getFields',_0x305967,JSON['stringify'](_0x2fe394));delete _0x2fe394[_0xb35a('0x28')];if(_0x305967===0x191){_0x305967=0x190;}_0x36c1e2[_0xb35a('0x17')](_0x305967)[_0xb35a('0x76')](_0x2ed646[_0xb35a('0x34')][_0xb35a('0x74')]?{'message':_0xb35a('0x77'),'statusCode':_0x2fe394[_0xb35a('0x78')]}:_0x2fe394);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 6d7ff83..db64899 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 _0xedc9=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x53a8d6,_0x4f3e7c){var _0x2963ca=function(_0x1fcb3a){while(--_0x1fcb3a){_0x53a8d6['push'](_0x53a8d6['shift']());}};_0x2963ca(++_0x4f3e7c);}(_0xedc9,0x13e));var _0x9edc=function(_0x370732,_0x304cac){_0x370732=_0x370732-0x0;var _0x3226d8=_0xedc9[_0x370732];return _0x3226d8;};'use strict';var _=require(_0x9edc('0x0'));var util=require(_0x9edc('0x1'));var logger=require(_0x9edc('0x2'))(_0x9edc('0x3'));var moment=require(_0x9edc('0x4'));var BPromise=require(_0x9edc('0x5'));var rp=require(_0x9edc('0x6'));var fs=require('fs');var path=require(_0x9edc('0x7'));var rimraf=require(_0x9edc('0x8'));var config=require(_0x9edc('0x9'));var attributes=require(_0x9edc('0xa'));var integrations=require(_0x9edc('0xb'));module['exports']=function(_0x38e89d,_0x114991){return _0x38e89d[_0x9edc('0xc')](_0x9edc('0xd'),attributes,{'tableName':_0x9edc('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7534=['./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3c7396,_0x291d8a){var _0x107ebf=function(_0x2a9b45){while(--_0x2a9b45){_0x3c7396['push'](_0x3c7396['shift']());}};_0x107ebf(++_0x291d8a);}(_0x7534,0xa1));var _0x4753=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7534[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4753('0x0'));var util=require(_0x4753('0x1'));var logger=require(_0x4753('0x2'))('api');var moment=require(_0x4753('0x3'));var BPromise=require('bluebird');var rp=require(_0x4753('0x4'));var fs=require('fs');var path=require(_0x4753('0x5'));var rimraf=require(_0x4753('0x6'));var config=require(_0x4753('0x7'));var attributes=require(_0x4753('0x8'));var integrations=require(_0x4753('0x9'));module['exports']=function(_0x113957,_0x17ee17){return _0x113957[_0x4753('0xa')](_0x4753('0xb'),attributes,{'tableName':_0x4753('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 1823217..293f95c 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 _0xb9a7=['then','debug','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowVtigerAccount','where'];(function(_0x5f3e78,_0x1468ba){var _0xf939da=function(_0x180d4c){while(--_0x180d4c){_0x5f3e78['push'](_0x5f3e78['shift']());}};_0xf939da(++_0x1468ba);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb9a7[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});}exports[_0x7b9a('0x13')]=function(_0x271263){var _0x169d16=this;return new Promise(function(_0x44a232,_0x180a67){return db[_0x7b9a('0x14')][_0x7b9a('0x15')]({'raw':_0x271263[_0x7b9a('0x16')]?_0x271263[_0x7b9a('0x16')][_0x7b9a('0x17')]===undefined?!![]:![]:!![],'where':_0x271263[_0x7b9a('0x16')]?_0x271263[_0x7b9a('0x16')]['where']||null:null,'attributes':_0x271263[_0x7b9a('0x16')]?_0x271263['options'][_0x7b9a('0x18')]||null:null,'limit':_0x271263['options']?_0x271263[_0x7b9a('0x16')][_0x7b9a('0x19')]||null:null,'include':_0x271263[_0x7b9a('0x16')]?_0x271263['options'][_0x7b9a('0x1a')]?_[_0x7b9a('0x1b')](_0x271263['options'][_0x7b9a('0x1a')],function(_0x374dca){return{'model':db[_0x374dca[_0x7b9a('0x1c')]],'as':_0x374dca['as'],'attributes':_0x374dca[_0x7b9a('0x18')],'include':_0x374dca[_0x7b9a('0x1a')]?_['map'](_0x374dca[_0x7b9a('0x1a')],function(_0x23219e){return{'model':db[_0x23219e['model']],'as':_0x23219e['as'],'attributes':_0x23219e[_0x7b9a('0x18')],'include':_0x23219e['include']?_[_0x7b9a('0x1b')](_0x23219e[_0x7b9a('0x1a')],function(_0x4c2271){return{'model':db[_0x4c2271['model']],'as':_0x4c2271['as'],'attributes':_0x4c2271[_0x7b9a('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54df8a){logger[_0x7b9a('0x11')]('GetVtigerAccount',_0x271263);logger['debug'](_0x7b9a('0x13'),_0x271263,JSON['stringify'](_0x54df8a));_0x44a232(_0x54df8a);})[_0x7b9a('0x1d')](function(_0x314b6d){logger['error'](_0x7b9a('0x13'),_0x314b6d[_0x7b9a('0x10')],_0x271263);_0x180a67(_0x169d16[_0x7b9a('0xe')](0x1f4,_0x314b6d['message']));});});};exports[_0x7b9a('0x1e')]=function(_0x2ce78b){var _0x181e9c=this;return new Promise(function(_0x6c8b1f,_0x5028e7){return db[_0x7b9a('0x14')]['find']({'raw':_0x2ce78b['options']?_0x2ce78b[_0x7b9a('0x16')][_0x7b9a('0x17')]===undefined?!![]:![]:!![],'where':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b['options'][_0x7b9a('0x1f')]||null:null,'attributes':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b['options']['attributes']||null:null,'include':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b[_0x7b9a('0x16')]['include']?_[_0x7b9a('0x1b')](_0x2ce78b[_0x7b9a('0x16')][_0x7b9a('0x1a')],function(_0x18db2f){return{'model':db[_0x18db2f[_0x7b9a('0x1c')]],'as':_0x18db2f['as'],'attributes':_0x18db2f['attributes'],'include':_0x18db2f[_0x7b9a('0x1a')]?_[_0x7b9a('0x1b')](_0x18db2f[_0x7b9a('0x1a')],function(_0x7070dd){return{'model':db[_0x7070dd[_0x7b9a('0x1c')]],'as':_0x7070dd['as'],'attributes':_0x7070dd[_0x7b9a('0x18')],'include':_0x7070dd['include']?_['map'](_0x7070dd[_0x7b9a('0x1a')],function(_0x31d29e){return{'model':db[_0x31d29e['model']],'as':_0x31d29e['as'],'attributes':_0x31d29e[_0x7b9a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7b9a('0x20')](function(_0xf58dca){logger['info'](_0x7b9a('0x1e'),_0x2ce78b);logger[_0x7b9a('0x21')]('ShowVtigerAccount',_0x2ce78b,JSON['stringify'](_0xf58dca));_0x6c8b1f(_0xf58dca);})[_0x7b9a('0x1d')](function(_0x130c04){logger[_0x7b9a('0xe')](_0x7b9a('0x1e'),_0x130c04[_0x7b9a('0x10')],_0x2ce78b);_0x5028e7(_0x181e9c[_0x7b9a('0xe')](0x1f4,_0x130c04[_0x7b9a('0x10')]));});});}; \ No newline at end of file +var _0x750a=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','options','raw','attributes','limit','model','include','map','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','where'];(function(_0xa5c969,_0x50d05f){var _0x186948=function(_0x480d52){while(--_0x480d52){_0xa5c969['push'](_0xa5c969['shift']());}};_0x186948(++_0x50d05f);}(_0x750a,0x140));var _0xa750=function(_0x337a07,_0x1bb6d5){_0x337a07=_0x337a07-0x0;var _0x1e87ee=_0x750a[_0x337a07];return _0x1e87ee;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});}exports['GetVtigerAccount']=function(_0x433dbd){var _0x1bde87=this;return new Promise(function(_0x4f1faa,_0x36dcca){return db['VtigerAccount']['findAll']({'raw':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['where']||null:null,'attributes':_0x433dbd[_0xa750('0x15')]?_0x433dbd['options'][_0xa750('0x17')]||null:null,'limit':_0x433dbd['options']?_0x433dbd['options'][_0xa750('0x18')]||null:null,'include':_0x433dbd['options']?_0x433dbd[_0xa750('0x15')]['include']?_['map'](_0x433dbd['options']['include'],function(_0x15d72f){return{'model':db[_0x15d72f[_0xa750('0x19')]],'as':_0x15d72f['as'],'attributes':_0x15d72f[_0xa750('0x17')],'include':_0x15d72f[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x15d72f[_0xa750('0x1a')],function(_0x3001bc){return{'model':db[_0x3001bc[_0xa750('0x19')]],'as':_0x3001bc['as'],'attributes':_0x3001bc[_0xa750('0x17')],'include':_0x3001bc[_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x3001bc[_0xa750('0x1a')],function(_0x31ea63){return{'model':db[_0x31ea63[_0xa750('0x19')]],'as':_0x31ea63['as'],'attributes':_0x31ea63[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d3923){logger[_0xa750('0xc')](_0xa750('0x1c'),_0x433dbd);logger['debug'](_0xa750('0x1c'),_0x433dbd,JSON[_0xa750('0xf')](_0x3d3923));_0x4f1faa(_0x3d3923);})[_0xa750('0x14')](function(_0x1223d2){logger['error'](_0xa750('0x1c'),_0x1223d2[_0xa750('0x13')],_0x433dbd);_0x36dcca(_0x1bde87[_0xa750('0x10')](0x1f4,_0x1223d2[_0xa750('0x13')]));});});};exports[_0xa750('0x1d')]=function(_0x59ab33){var _0x46cc11=this;return new Promise(function(_0x4c2c9e,_0x2d0e93){return db[_0xa750('0x1e')]['find']({'raw':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x16')]===undefined?!![]:![]:!![],'where':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')][_0xa750('0x1f')]||null:null,'attributes':_0x59ab33[_0xa750('0x15')]?_0x59ab33[_0xa750('0x15')]['attributes']||null:null,'include':_0x59ab33[_0xa750('0x15')]?_0x59ab33['options'][_0xa750('0x1a')]?_[_0xa750('0x1b')](_0x59ab33[_0xa750('0x15')][_0xa750('0x1a')],function(_0x556fde){return{'model':db[_0x556fde[_0xa750('0x19')]],'as':_0x556fde['as'],'attributes':_0x556fde[_0xa750('0x17')],'include':_0x556fde['include']?_[_0xa750('0x1b')](_0x556fde[_0xa750('0x1a')],function(_0x280b87){return{'model':db[_0x280b87[_0xa750('0x19')]],'as':_0x280b87['as'],'attributes':_0x280b87['attributes'],'include':_0x280b87[_0xa750('0x1a')]?_['map'](_0x280b87['include'],function(_0x4e59f3){return{'model':db[_0x4e59f3[_0xa750('0x19')]],'as':_0x4e59f3['as'],'attributes':_0x4e59f3[_0xa750('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x470089){logger[_0xa750('0xc')](_0xa750('0x1d'),_0x59ab33);logger['debug'](_0xa750('0x1d'),_0x59ab33,JSON[_0xa750('0xf')](_0x470089));_0x4c2c9e(_0x470089);})[_0xa750('0x14')](function(_0x5d402a){logger[_0xa750('0x10')](_0xa750('0x1d'),_0x5d402a[_0xa750('0x13')],_0x59ab33);_0x2d0e93(_0x46cc11['error'](0x1f4,_0x5d402a[_0xa750('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 89f28cc..281afa8 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 _0x42a8=['/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id/subjects','getSubjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42a8,0x128));var _0x842a=function(_0x469fd4,_0x45a820){_0x469fd4=_0x469fd4-0x0;var _0x2d40fc=_0x42a8[_0x469fd4];return _0x2d40fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x842a('0x0'));var timeout=require('connect-timeout');var express=require(_0x842a('0x1'));var router=express[_0x842a('0x2')]();var fs_extra=require(_0x842a('0x3'));var auth=require(_0x842a('0x4'));var interaction=require(_0x842a('0x5'));var config=require(_0x842a('0x6'));var controller=require(_0x842a('0x7'));router[_0x842a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x842a('0x9')](),controller['getFields']);router['get'](_0x842a('0xa'),auth[_0x842a('0x9')](),controller[_0x842a('0xb')]);router[_0x842a('0x8')](_0x842a('0xc'),auth['isAuthenticated'](),controller[_0x842a('0xd')]);router[_0x842a('0xe')]('/',auth[_0x842a('0x9')](),controller[_0x842a('0xf')]);router[_0x842a('0x10')](_0x842a('0x11'),auth[_0x842a('0x9')](),controller[_0x842a('0x12')]);router[_0x842a('0x13')](_0x842a('0x11'),auth['isAuthenticated'](),controller[_0x842a('0x14')]);module[_0x842a('0x15')]=router; \ No newline at end of file +var _0x308c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','/:id','update','delete','destroy','multer','util'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x308c,0x76));var _0xc308=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x308c[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xc308('0x0'));var util=require(_0xc308('0x1'));var path=require(_0xc308('0x2'));var timeout=require(_0xc308('0x3'));var express=require(_0xc308('0x4'));var router=express[_0xc308('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc308('0x6'));var interaction=require(_0xc308('0x7'));var config=require('../../config/environment');var controller=require(_0xc308('0x8'));router[_0xc308('0x9')]('/',auth[_0xc308('0xa')](),controller[_0xc308('0xb')]);router['get']('/:id',auth[_0xc308('0xa')](),controller[_0xc308('0xc')]);router['get'](_0xc308('0xd'),auth[_0xc308('0xa')](),controller[_0xc308('0xe')]);router['get'](_0xc308('0xf'),auth['isAuthenticated'](),controller[_0xc308('0x10')]);router[_0xc308('0x9')](_0xc308('0x11'),auth[_0xc308('0xa')](),controller[_0xc308('0x12')]);router['post']('/',auth[_0xc308('0xa')](),controller[_0xc308('0x13')]);router['put'](_0xc308('0x14'),auth[_0xc308('0xa')](),controller[_0xc308('0x15')]);router[_0xc308('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xc308('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 10a89e0..1cd37fc 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 _0xb6c8=['exports','STRING','sequelize'];(function(_0x368b42,_0x5128b9){var _0x5910d2=function(_0x10a69e){while(--_0x10a69e){_0x368b42['push'](_0x368b42['shift']());}};_0x5910d2(++_0x5128b9);}(_0xb6c8,0xfe));var _0x8b6c=function(_0x595d60,_0x58c622){_0x595d60=_0x595d60-0x0;var _0x428056=_0xb6c8[_0x595d60];return _0x428056;};'use strict';var Sequelize=require(_0x8b6c('0x0'));module[_0x8b6c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8b6c('0x2')]}}; \ No newline at end of file +var _0xf2db=['exports','STRING','sequelize'];(function(_0x4e883a,_0x1bbfcb){var _0x4845f6=function(_0x4930e8){while(--_0x4930e8){_0x4e883a['push'](_0x4e883a['shift']());}};_0x4845f6(++_0x1bbfcb);}(_0xf2db,0x11f));var _0xbf2d=function(_0x4d6440,_0x4376c8){_0x4d6440=_0x4d6440-0x0;var _0x16c9b6=_0xf2db[_0x4d6440];return _0x16c9b6;};'use strict';var Sequelize=require(_0xbf2d('0x0'));module[_0xbf2d('0x1')]={'name':{'type':Sequelize[_0xbf2d('0x2')]},'description':{'type':Sequelize[_0xbf2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 50ab9cc..07d881d 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 _0x8017=['fieldName','type','map','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','show','params','rawAttributes','intersection','find','catch','create','body','getFields','findOne','VtigerField','order','getDescriptions','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','reject','save','then','destroy','sendStatus','error','stack','name','send'];(function(_0x447706,_0x4a4d31){var _0xd4b02f=function(_0x25dc33){while(--_0x25dc33){_0x447706['push'](_0x447706['shift']());}};_0xd4b02f(++_0x4a4d31);}(_0x8017,0x154));var _0x7801=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x8017[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0x7801('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7801('0x1'));var jsonpatch=require(_0x7801('0x2'));var rp=require(_0x7801('0x3'));var moment=require(_0x7801('0x4'));var BPromise=require(_0x7801('0x5'));var Mustache=require(_0x7801('0x6'));var util=require('util');var path=require(_0x7801('0x7'));var sox=require(_0x7801('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7801('0x9'));var _=require(_0x7801('0xa'));var squel=require(_0x7801('0xb'));var crypto=require(_0x7801('0xc'));var jsforce=require(_0x7801('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7801('0xe'));var querystring=require(_0x7801('0xf'));var Papa=require('papaparse');var Redis=require(_0x7801('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7801('0x11'));var as=require(_0x7801('0x12'));var hardwareService=require(_0x7801('0x13'));var logger=require(_0x7801('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7801('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7801('0x16'))['db'];function respondWithStatusCode(_0x542b44,_0x3ddbb4){_0x3ddbb4=_0x3ddbb4||0xcc;return function(_0x102120){if(_0x102120){return _0x542b44['sendStatus'](_0x3ddbb4);}return _0x542b44['status'](_0x3ddbb4)[_0x7801('0x17')]();};}function respondWithResult(_0x4cc1f1,_0x4facb8){_0x4facb8=_0x4facb8||0xc8;return function(_0x588642){if(_0x588642){return _0x4cc1f1['status'](_0x4facb8)[_0x7801('0x18')](_0x588642);}};}function respondWithFilteredResult(_0x226f4d,_0x49141a){return function(_0x5e8ea0){if(_0x5e8ea0){var _0x6ce28=typeof _0x49141a[_0x7801('0x19')]===_0x7801('0x1a')&&typeof _0x49141a[_0x7801('0x1b')]===_0x7801('0x1a');var _0x3c34b0=_0x5e8ea0[_0x7801('0x1c')];var _0x4ebb59=_0x6ce28?0x0:_0x49141a[_0x7801('0x19')];var _0x19dd9a=_0x6ce28?_0x5e8ea0['count']:_0x49141a[_0x7801('0x19')]+_0x49141a[_0x7801('0x1b')];var _0x3ede46;if(_0x19dd9a>=_0x3c34b0){_0x19dd9a=_0x3c34b0;_0x3ede46=0xc8;}else{_0x3ede46=0xce;}_0x226f4d[_0x7801('0x1d')](_0x3ede46);return _0x226f4d[_0x7801('0x1e')]('Content-Range',_0x4ebb59+'-'+_0x19dd9a+'/'+_0x3c34b0)[_0x7801('0x18')](_0x5e8ea0);}return null;};}function patchUpdates(_0x993097){return function(_0x456bba){try{jsonpatch['apply'](_0x456bba,_0x993097,!![]);}catch(_0x190553){return BPromise[_0x7801('0x1f')](_0x190553);}return _0x456bba[_0x7801('0x20')]();};}function saveUpdates(_0x490c5e,_0x517b36){return function(_0x2aa1d5){if(_0x2aa1d5){return _0x2aa1d5['update'](_0x490c5e)[_0x7801('0x21')](function(_0x4d5ffd){return _0x4d5ffd;});}return null;};}function removeEntity(_0x4c382b,_0x4fa43a){return function(_0x4e4d19){if(_0x4e4d19){return _0x4e4d19[_0x7801('0x22')]()[_0x7801('0x21')](function(){_0x4c382b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x435259,_0x2d3473){return function(_0x14fae3){if(!_0x14fae3){_0x435259[_0x7801('0x23')](0x194);}return _0x14fae3;};}function handleError(_0xe4e2c0,_0x800f62){_0x800f62=_0x800f62||0x1f4;return function(_0x54df66){logger[_0x7801('0x24')](_0x54df66[_0x7801('0x25')]);if(_0x54df66[_0x7801('0x26')]){delete _0x54df66['name'];}_0xe4e2c0['status'](_0x800f62)[_0x7801('0x27')](_0x54df66);};}exports['index']=function(_0x1680ad,_0x195aca){var _0x2cfd93={},_0x5a325a={},_0x4193ba={'count':0x0,'rows':[]};var _0x27b45f=_['map'](db['VtigerConfiguration']['rawAttributes'],function(_0x141108){return{'name':_0x141108[_0x7801('0x28')],'type':_0x141108[_0x7801('0x29')]['key']};});_0x5a325a['model']=_[_0x7801('0x2a')](_0x27b45f,'name');_0x5a325a['query']=_[_0x7801('0x2b')](_0x1680ad[_0x7801('0x2c')]);_0x5a325a[_0x7801('0x2d')]=_['intersection'](_0x5a325a[_0x7801('0x2e')],_0x5a325a['query']);_0x2cfd93['attributes']=_['intersection'](_0x5a325a['model'],qs['fields'](_0x1680ad[_0x7801('0x2c')][_0x7801('0x2f')]));_0x2cfd93[_0x7801('0x30')]=_0x2cfd93[_0x7801('0x30')][_0x7801('0x31')]?_0x2cfd93['attributes']:_0x5a325a[_0x7801('0x2e')];if(!_0x1680ad[_0x7801('0x2c')][_0x7801('0x32')](_0x7801('0x33'))){_0x2cfd93['limit']=qs['limit'](_0x1680ad['query'][_0x7801('0x1b')]);_0x2cfd93[_0x7801('0x19')]=qs[_0x7801('0x19')](_0x1680ad['query'][_0x7801('0x19')]);}_0x2cfd93['order']=qs['sort'](_0x1680ad['query'][_0x7801('0x34')]);_0x2cfd93[_0x7801('0x35')]=qs[_0x7801('0x2d')](_['pick'](_0x1680ad['query'],_0x5a325a[_0x7801('0x2d')]),_0x27b45f);if(_0x1680ad['query'][_0x7801('0x36')]){_0x2cfd93[_0x7801('0x35')]=_[_0x7801('0x37')](_0x2cfd93[_0x7801('0x35')],{'$or':_['map'](_0x27b45f,function(_0x3ece93){if(_0x3ece93[_0x7801('0x29')]!==_0x7801('0x38')){var _0x1acad0={};_0x1acad0[_0x3ece93[_0x7801('0x26')]]={'$like':'%'+_0x1680ad[_0x7801('0x2c')][_0x7801('0x36')]+'%'};return _0x1acad0;}})});}_0x2cfd93=_['merge']({},_0x2cfd93,_0x1680ad[_0x7801('0x39')]);var _0x5c81ad={'where':_0x2cfd93[_0x7801('0x35')]};return db[_0x7801('0x3a')]['count'](_0x5c81ad)[_0x7801('0x21')](function(_0x5e0810){_0x4193ba[_0x7801('0x1c')]=_0x5e0810;if(_0x1680ad[_0x7801('0x2c')][_0x7801('0x3b')]){_0x2cfd93[_0x7801('0x3c')]=[{'all':!![]}];}return db[_0x7801('0x3a')][_0x7801('0x3d')](_0x2cfd93);})['then'](function(_0x41ea5b){_0x4193ba['rows']=_0x41ea5b;return _0x4193ba;})[_0x7801('0x21')](respondWithFilteredResult(_0x195aca,_0x2cfd93))['catch'](handleError(_0x195aca,null));};exports[_0x7801('0x3e')]=function(_0x227f9e,_0x4b180e){var _0x43007c={'raw':![],'where':{'id':_0x227f9e[_0x7801('0x3f')]['id']}},_0x52d34d={};_0x52d34d['model']=_[_0x7801('0x2b')](db[_0x7801('0x3a')][_0x7801('0x40')]);_0x52d34d['query']=_[_0x7801('0x2b')](_0x227f9e[_0x7801('0x2c')]);_0x52d34d['filters']=_[_0x7801('0x41')](_0x52d34d[_0x7801('0x2e')],_0x52d34d[_0x7801('0x2c')]);_0x43007c[_0x7801('0x30')]=_[_0x7801('0x41')](_0x52d34d[_0x7801('0x2e')],qs[_0x7801('0x2f')](_0x227f9e[_0x7801('0x2c')][_0x7801('0x2f')]));_0x43007c[_0x7801('0x30')]=_0x43007c[_0x7801('0x30')]['length']?_0x43007c['attributes']:_0x52d34d[_0x7801('0x2e')];if(_0x227f9e[_0x7801('0x2c')][_0x7801('0x3b')]){_0x43007c[_0x7801('0x3c')]=[{'all':!![]}];}_0x43007c=_[_0x7801('0x37')]({},_0x43007c,_0x227f9e[_0x7801('0x39')]);return db[_0x7801('0x3a')][_0x7801('0x42')](_0x43007c)[_0x7801('0x21')](handleEntityNotFound(_0x4b180e,null))[_0x7801('0x21')](respondWithResult(_0x4b180e,null))[_0x7801('0x43')](handleError(_0x4b180e,null));};exports[_0x7801('0x44')]=function(_0x2ed842,_0x3a60b5){return db['VtigerConfiguration'][_0x7801('0x44')](_0x2ed842['body'],{})[_0x7801('0x21')](respondWithResult(_0x3a60b5,0xc9))['catch'](handleError(_0x3a60b5,null));};exports['update']=function(_0x2e0732,_0x335f25){if(_0x2e0732[_0x7801('0x45')]['id']){delete _0x2e0732['body']['id'];}return db['VtigerConfiguration'][_0x7801('0x42')]({'where':{'id':_0x2e0732[_0x7801('0x3f')]['id']}})[_0x7801('0x21')](handleEntityNotFound(_0x335f25,null))[_0x7801('0x21')](saveUpdates(_0x2e0732[_0x7801('0x45')],null))['then'](respondWithResult(_0x335f25,null))[_0x7801('0x43')](handleError(_0x335f25,null));};exports[_0x7801('0x22')]=function(_0x70c030,_0x12c6de){return db[_0x7801('0x3a')]['find']({'where':{'id':_0x70c030[_0x7801('0x3f')]['id']}})[_0x7801('0x21')](handleEntityNotFound(_0x12c6de,null))[_0x7801('0x21')](removeEntity(_0x12c6de,null))[_0x7801('0x43')](handleError(_0x12c6de,null));};exports[_0x7801('0x46')]=function(_0x4535fa,_0x5187b8,_0x5e1008){var _0xac86e3={};var _0x4846b9={};var _0x888608;var _0x32b84c;return db[_0x7801('0x3a')][_0x7801('0x47')]({'where':{'id':_0x4535fa[_0x7801('0x3f')]['id']}})[_0x7801('0x21')](handleEntityNotFound(_0x5187b8,null))[_0x7801('0x21')](function(_0x20bf74){if(_0x20bf74){_0x888608=_0x20bf74;_0x4846b9[_0x7801('0x2e')]=_['keys'](db[_0x7801('0x48')][_0x7801('0x40')]);_0x4846b9[_0x7801('0x2c')]=_[_0x7801('0x2b')](_0x4535fa[_0x7801('0x2c')]);_0x4846b9[_0x7801('0x2d')]=_['intersection'](_0x4846b9['model'],_0x4846b9[_0x7801('0x2c')]);_0xac86e3[_0x7801('0x30')]=_['intersection'](_0x4846b9['model'],qs['fields'](_0x4535fa['query'][_0x7801('0x2f')]));_0xac86e3[_0x7801('0x30')]=_0xac86e3[_0x7801('0x30')][_0x7801('0x31')]?_0xac86e3['attributes']:_0x4846b9[_0x7801('0x2e')];_0xac86e3[_0x7801('0x49')]=qs[_0x7801('0x34')](_0x4535fa[_0x7801('0x2c')][_0x7801('0x34')]);_0xac86e3[_0x7801('0x35')]=qs['filters'](_['pick'](_0x4535fa[_0x7801('0x2c')],_0x4846b9[_0x7801('0x2d')]));if(_0x4535fa['query'][_0x7801('0x36')]){_0xac86e3[_0x7801('0x35')]=_[_0x7801('0x37')](_0xac86e3[_0x7801('0x35')],{'$or':_[_0x7801('0x2a')](_0xac86e3[_0x7801('0x30')],function(_0x2b1f2c){var _0x1efcbe={};_0x1efcbe[_0x2b1f2c]={'$like':'%'+_0x4535fa[_0x7801('0x2c')]['filter']+'%'};return _0x1efcbe;})});}_0xac86e3=_[_0x7801('0x37')]({},_0xac86e3,_0x4535fa['options']);return _0x888608[_0x7801('0x46')](_0xac86e3);}})[_0x7801('0x21')](function(_0x48ed23){if(_0x48ed23){_0x32b84c=_0x48ed23[_0x7801('0x31')];if(!_0x4535fa[_0x7801('0x2c')]['hasOwnProperty'](_0x7801('0x33'))){_0xac86e3['limit']=qs[_0x7801('0x1b')](_0x4535fa[_0x7801('0x2c')][_0x7801('0x1b')]);_0xac86e3[_0x7801('0x19')]=qs['offset'](_0x4535fa['query']['offset']);}return _0x888608[_0x7801('0x46')](_0xac86e3);}})[_0x7801('0x21')](function(_0x4d5535){if(_0x4d5535){return _0x4d5535?{'count':_0x32b84c,'rows':_0x4d5535}:null;}})['then'](respondWithResult(_0x5187b8,null))[_0x7801('0x43')](handleError(_0x5187b8,null));};exports['getSubjects']=function(_0x1032dd,_0x1e2bc3,_0x5b4444){var _0x7625cf={};var _0x103df1={};var _0xd52330;var _0x2fb684;return db[_0x7801('0x3a')][_0x7801('0x47')]({'where':{'id':_0x1032dd[_0x7801('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e2bc3,null))[_0x7801('0x21')](function(_0x331f90){if(_0x331f90){_0xd52330=_0x331f90;_0x103df1[_0x7801('0x2e')]=_[_0x7801('0x2b')](db['VtigerField']['rawAttributes']);_0x103df1[_0x7801('0x2c')]=_[_0x7801('0x2b')](_0x1032dd['query']);_0x103df1[_0x7801('0x2d')]=_[_0x7801('0x41')](_0x103df1[_0x7801('0x2e')],_0x103df1[_0x7801('0x2c')]);_0x7625cf[_0x7801('0x30')]=_['intersection'](_0x103df1['model'],qs[_0x7801('0x2f')](_0x1032dd['query'][_0x7801('0x2f')]));_0x7625cf[_0x7801('0x30')]=_0x7625cf[_0x7801('0x30')]['length']?_0x7625cf[_0x7801('0x30')]:_0x103df1[_0x7801('0x2e')];_0x7625cf[_0x7801('0x49')]=qs['sort'](_0x1032dd[_0x7801('0x2c')][_0x7801('0x34')]);_0x7625cf[_0x7801('0x35')]=qs[_0x7801('0x2d')](_['pick'](_0x1032dd[_0x7801('0x2c')],_0x103df1[_0x7801('0x2d')]));if(_0x1032dd[_0x7801('0x2c')][_0x7801('0x36')]){_0x7625cf['where']=_[_0x7801('0x37')](_0x7625cf[_0x7801('0x35')],{'$or':_[_0x7801('0x2a')](_0x7625cf[_0x7801('0x30')],function(_0x24f7d4){var _0x3d41c2={};_0x3d41c2[_0x24f7d4]={'$like':'%'+_0x1032dd['query'][_0x7801('0x36')]+'%'};return _0x3d41c2;})});}_0x7625cf=_[_0x7801('0x37')]({},_0x7625cf,_0x1032dd[_0x7801('0x39')]);return _0xd52330['getSubjects'](_0x7625cf);}})[_0x7801('0x21')](function(_0x22e8fd){if(_0x22e8fd){_0x2fb684=_0x22e8fd[_0x7801('0x31')];if(!_0x1032dd['query']['hasOwnProperty']('nolimit')){_0x7625cf[_0x7801('0x1b')]=qs['limit'](_0x1032dd[_0x7801('0x2c')]['limit']);_0x7625cf[_0x7801('0x19')]=qs[_0x7801('0x19')](_0x1032dd[_0x7801('0x2c')]['offset']);}return _0xd52330['getSubjects'](_0x7625cf);}})[_0x7801('0x21')](function(_0x5b124b){if(_0x5b124b){return _0x5b124b?{'count':_0x2fb684,'rows':_0x5b124b}:null;}})[_0x7801('0x21')](respondWithResult(_0x1e2bc3,null))[_0x7801('0x43')](handleError(_0x1e2bc3,null));};exports[_0x7801('0x4a')]=function(_0x47ab8b,_0x5d473a,_0x745d88){var _0x14f05b={};var _0x3713fc={};var _0x4ed7c5;var _0x2e21b7;return db[_0x7801('0x3a')][_0x7801('0x47')]({'where':{'id':_0x47ab8b['params']['id']}})['then'](handleEntityNotFound(_0x5d473a,null))[_0x7801('0x21')](function(_0x3dbb0c){if(_0x3dbb0c){_0x4ed7c5=_0x3dbb0c;_0x3713fc[_0x7801('0x2e')]=_[_0x7801('0x2b')](db['VtigerField'][_0x7801('0x40')]);_0x3713fc['query']=_[_0x7801('0x2b')](_0x47ab8b[_0x7801('0x2c')]);_0x3713fc['filters']=_['intersection'](_0x3713fc[_0x7801('0x2e')],_0x3713fc[_0x7801('0x2c')]);_0x14f05b[_0x7801('0x30')]=_['intersection'](_0x3713fc[_0x7801('0x2e')],qs[_0x7801('0x2f')](_0x47ab8b[_0x7801('0x2c')]['fields']));_0x14f05b[_0x7801('0x30')]=_0x14f05b[_0x7801('0x30')][_0x7801('0x31')]?_0x14f05b['attributes']:_0x3713fc[_0x7801('0x2e')];_0x14f05b[_0x7801('0x49')]=qs[_0x7801('0x34')](_0x47ab8b[_0x7801('0x2c')][_0x7801('0x34')]);_0x14f05b[_0x7801('0x35')]=qs[_0x7801('0x2d')](_[_0x7801('0x4b')](_0x47ab8b[_0x7801('0x2c')],_0x3713fc[_0x7801('0x2d')]));if(_0x47ab8b[_0x7801('0x2c')][_0x7801('0x36')]){_0x14f05b[_0x7801('0x35')]=_['merge'](_0x14f05b[_0x7801('0x35')],{'$or':_[_0x7801('0x2a')](_0x14f05b['attributes'],function(_0x48a669){var _0x127b82={};_0x127b82[_0x48a669]={'$like':'%'+_0x47ab8b['query'][_0x7801('0x36')]+'%'};return _0x127b82;})});}_0x14f05b=_[_0x7801('0x37')]({},_0x14f05b,_0x47ab8b[_0x7801('0x39')]);return _0x4ed7c5[_0x7801('0x4a')](_0x14f05b);}})[_0x7801('0x21')](function(_0x4a90ff){if(_0x4a90ff){_0x2e21b7=_0x4a90ff['length'];if(!_0x47ab8b[_0x7801('0x2c')][_0x7801('0x32')](_0x7801('0x33'))){_0x14f05b[_0x7801('0x1b')]=qs['limit'](_0x47ab8b[_0x7801('0x2c')][_0x7801('0x1b')]);_0x14f05b[_0x7801('0x19')]=qs[_0x7801('0x19')](_0x47ab8b[_0x7801('0x2c')][_0x7801('0x19')]);}return _0x4ed7c5[_0x7801('0x4a')](_0x14f05b);}})[_0x7801('0x21')](function(_0x5e5500){if(_0x5e5500){return _0x5e5500?{'count':_0x2e21b7,'rows':_0x5e5500}:null;}})[_0x7801('0x21')](respondWithResult(_0x5d473a,null))['catch'](handleError(_0x5d473a,null));}; \ No newline at end of file +var _0x0585=['update','then','error','index','VtigerConfiguration','rawAttributes','key','model','map','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','show','params','keys','length','options','find','catch','create','body','destroy','findOne','VtigerField','filter','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x0585,0x1ba));var _0x5058=function(_0x1cbe0f,_0x41f94a){_0x1cbe0f=_0x1cbe0f-0x0;var _0x5199e7=_0x0585[_0x1cbe0f];return _0x5199e7;};'use strict';var emlformat=require(_0x5058('0x0'));var rimraf=require(_0x5058('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5058('0x2'));var rp=require('request-promise');var moment=require(_0x5058('0x3'));var BPromise=require(_0x5058('0x4'));var Mustache=require(_0x5058('0x5'));var util=require(_0x5058('0x6'));var path=require(_0x5058('0x7'));var sox=require(_0x5058('0x8'));var csv=require(_0x5058('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5058('0xa'));var _=require(_0x5058('0xb'));var squel=require(_0x5058('0xc'));var crypto=require('crypto');var jsforce=require(_0x5058('0xd'));var deskjs=require(_0x5058('0xe'));var toCsv=require(_0x5058('0x9'));var querystring=require(_0x5058('0xf'));var Papa=require(_0x5058('0x10'));var Redis=require('ioredis');var authService=require(_0x5058('0x11'));var qs=require(_0x5058('0x12'));var as=require(_0x5058('0x13'));var hardwareService=require(_0x5058('0x14'));var logger=require(_0x5058('0x15'))(_0x5058('0x16'));var utils=require('../../config/utils');var config=require(_0x5058('0x17'));var licenseUtil=require(_0x5058('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281de0,_0x351b75){_0x351b75=_0x351b75||0xcc;return function(_0x3e21a8){if(_0x3e21a8){return _0x281de0[_0x5058('0x19')](_0x351b75);}return _0x281de0[_0x5058('0x1a')](_0x351b75)[_0x5058('0x1b')]();};}function respondWithResult(_0x1559f9,_0x5056c0){_0x5056c0=_0x5056c0||0xc8;return function(_0x4c3d1c){if(_0x4c3d1c){return _0x1559f9[_0x5058('0x1a')](_0x5056c0)[_0x5058('0x1c')](_0x4c3d1c);}};}function respondWithFilteredResult(_0x33c123,_0x17c2df){return function(_0xeb3584){if(_0xeb3584){var _0x32b818=typeof _0x17c2df[_0x5058('0x1d')]===_0x5058('0x1e')&&typeof _0x17c2df[_0x5058('0x1f')]===_0x5058('0x1e');var _0xe497c7=_0xeb3584[_0x5058('0x20')];var _0x11b996=_0x32b818?0x0:_0x17c2df[_0x5058('0x1d')];var _0xb4c282=_0x32b818?_0xeb3584[_0x5058('0x20')]:_0x17c2df['offset']+_0x17c2df['limit'];var _0x9ee4c4;if(_0xb4c282>=_0xe497c7){_0xb4c282=_0xe497c7;_0x9ee4c4=0xc8;}else{_0x9ee4c4=0xce;}_0x33c123[_0x5058('0x1a')](_0x9ee4c4);return _0x33c123[_0x5058('0x21')](_0x5058('0x22'),_0x11b996+'-'+_0xb4c282+'/'+_0xe497c7)[_0x5058('0x1c')](_0xeb3584);}return null;};}function patchUpdates(_0x4cda99){return function(_0x5bdb66){try{jsonpatch[_0x5058('0x23')](_0x5bdb66,_0x4cda99,!![]);}catch(_0x2227b0){return BPromise[_0x5058('0x24')](_0x2227b0);}return _0x5bdb66[_0x5058('0x25')]();};}function saveUpdates(_0x261409,_0x20f528){return function(_0x3991ce){if(_0x3991ce){return _0x3991ce[_0x5058('0x26')](_0x261409)['then'](function(_0xe45dba){return _0xe45dba;});}return null;};}function removeEntity(_0x24d8e5,_0x15132c){return function(_0x4e660e){if(_0x4e660e){return _0x4e660e['destroy']()[_0x5058('0x27')](function(){_0x24d8e5[_0x5058('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de810,_0x1ce318){return function(_0x1d12d5){if(!_0x1d12d5){_0x3de810[_0x5058('0x19')](0x194);}return _0x1d12d5;};}function handleError(_0x49586c,_0x46647e){_0x46647e=_0x46647e||0x1f4;return function(_0x3bf015){logger[_0x5058('0x28')](_0x3bf015['stack']);if(_0x3bf015['name']){delete _0x3bf015['name'];}_0x49586c[_0x5058('0x1a')](_0x46647e)['send'](_0x3bf015);};}exports[_0x5058('0x29')]=function(_0x40548b,_0x56b25f){var _0x938c3c={},_0xa08e6c={},_0xd65cd={'count':0x0,'rows':[]};var _0x2a56f7=_['map'](db[_0x5058('0x2a')][_0x5058('0x2b')],function(_0x17d31f){return{'name':_0x17d31f['fieldName'],'type':_0x17d31f['type'][_0x5058('0x2c')]};});_0xa08e6c[_0x5058('0x2d')]=_[_0x5058('0x2e')](_0x2a56f7,_0x5058('0x2f'));_0xa08e6c[_0x5058('0x30')]=_['keys'](_0x40548b[_0x5058('0x30')]);_0xa08e6c['filters']=_[_0x5058('0x31')](_0xa08e6c[_0x5058('0x2d')],_0xa08e6c['query']);_0x938c3c['attributes']=_[_0x5058('0x31')](_0xa08e6c[_0x5058('0x2d')],qs[_0x5058('0x32')](_0x40548b[_0x5058('0x30')]['fields']));_0x938c3c[_0x5058('0x33')]=_0x938c3c[_0x5058('0x33')]['length']?_0x938c3c[_0x5058('0x33')]:_0xa08e6c['model'];if(!_0x40548b['query'][_0x5058('0x34')](_0x5058('0x35'))){_0x938c3c[_0x5058('0x1f')]=qs[_0x5058('0x1f')](_0x40548b[_0x5058('0x30')][_0x5058('0x1f')]);_0x938c3c[_0x5058('0x1d')]=qs[_0x5058('0x1d')](_0x40548b['query']['offset']);}_0x938c3c[_0x5058('0x36')]=qs[_0x5058('0x37')](_0x40548b[_0x5058('0x30')][_0x5058('0x37')]);_0x938c3c[_0x5058('0x38')]=qs[_0x5058('0x39')](_[_0x5058('0x3a')](_0x40548b[_0x5058('0x30')],_0xa08e6c[_0x5058('0x39')]),_0x2a56f7);if(_0x40548b[_0x5058('0x30')]['filter']){_0x938c3c[_0x5058('0x38')]=_[_0x5058('0x3b')](_0x938c3c[_0x5058('0x38')],{'$or':_[_0x5058('0x2e')](_0x2a56f7,function(_0x51359e){if(_0x51359e['type']!==_0x5058('0x3c')){var _0x2099f6={};_0x2099f6[_0x51359e[_0x5058('0x2f')]]={'$like':'%'+_0x40548b[_0x5058('0x30')]['filter']+'%'};return _0x2099f6;}})});}_0x938c3c=_[_0x5058('0x3b')]({},_0x938c3c,_0x40548b['options']);var _0x31d691={'where':_0x938c3c[_0x5058('0x38')]};return db[_0x5058('0x2a')][_0x5058('0x20')](_0x31d691)[_0x5058('0x27')](function(_0x5aa092){_0xd65cd[_0x5058('0x20')]=_0x5aa092;if(_0x40548b[_0x5058('0x30')][_0x5058('0x3d')]){_0x938c3c[_0x5058('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x5058('0x3f')](_0x938c3c);})[_0x5058('0x27')](function(_0x4765a4){_0xd65cd['rows']=_0x4765a4;return _0xd65cd;})[_0x5058('0x27')](respondWithFilteredResult(_0x56b25f,_0x938c3c))['catch'](handleError(_0x56b25f,null));};exports[_0x5058('0x40')]=function(_0x4c63ff,_0x763150){var _0x41e639={'raw':![],'where':{'id':_0x4c63ff[_0x5058('0x41')]['id']}},_0xbe650f={};_0xbe650f[_0x5058('0x2d')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0xbe650f[_0x5058('0x30')]=_[_0x5058('0x42')](_0x4c63ff['query']);_0xbe650f[_0x5058('0x39')]=_[_0x5058('0x31')](_0xbe650f[_0x5058('0x2d')],_0xbe650f[_0x5058('0x30')]);_0x41e639[_0x5058('0x33')]=_[_0x5058('0x31')](_0xbe650f[_0x5058('0x2d')],qs[_0x5058('0x32')](_0x4c63ff[_0x5058('0x30')]['fields']));_0x41e639[_0x5058('0x33')]=_0x41e639[_0x5058('0x33')][_0x5058('0x43')]?_0x41e639[_0x5058('0x33')]:_0xbe650f[_0x5058('0x2d')];if(_0x4c63ff[_0x5058('0x30')][_0x5058('0x3d')]){_0x41e639['include']=[{'all':!![]}];}_0x41e639=_['merge']({},_0x41e639,_0x4c63ff[_0x5058('0x44')]);return db['VtigerConfiguration'][_0x5058('0x45')](_0x41e639)['then'](handleEntityNotFound(_0x763150,null))[_0x5058('0x27')](respondWithResult(_0x763150,null))[_0x5058('0x46')](handleError(_0x763150,null));};exports[_0x5058('0x47')]=function(_0x116675,_0x38874c){return db[_0x5058('0x2a')][_0x5058('0x47')](_0x116675[_0x5058('0x48')],{})['then'](respondWithResult(_0x38874c,0xc9))['catch'](handleError(_0x38874c,null));};exports[_0x5058('0x26')]=function(_0x32d527,_0x261e6f){if(_0x32d527['body']['id']){delete _0x32d527[_0x5058('0x48')]['id'];}return db['VtigerConfiguration'][_0x5058('0x45')]({'where':{'id':_0x32d527[_0x5058('0x41')]['id']}})[_0x5058('0x27')](handleEntityNotFound(_0x261e6f,null))[_0x5058('0x27')](saveUpdates(_0x32d527[_0x5058('0x48')],null))[_0x5058('0x27')](respondWithResult(_0x261e6f,null))[_0x5058('0x46')](handleError(_0x261e6f,null));};exports[_0x5058('0x49')]=function(_0x15649f,_0x1d8dc3){return db[_0x5058('0x2a')][_0x5058('0x45')]({'where':{'id':_0x15649f[_0x5058('0x41')]['id']}})[_0x5058('0x27')](handleEntityNotFound(_0x1d8dc3,null))[_0x5058('0x27')](removeEntity(_0x1d8dc3,null))[_0x5058('0x46')](handleError(_0x1d8dc3,null));};exports['getFields']=function(_0x1c61cc,_0x1efefa,_0x2306f4){var _0x3371da={};var _0x5a575c={};var _0x2121aa;var _0x3e3a74;return db[_0x5058('0x2a')][_0x5058('0x4a')]({'where':{'id':_0x1c61cc[_0x5058('0x41')]['id']}})[_0x5058('0x27')](handleEntityNotFound(_0x1efefa,null))[_0x5058('0x27')](function(_0xe486c5){if(_0xe486c5){_0x2121aa=_0xe486c5;_0x5a575c[_0x5058('0x2d')]=_['keys'](db[_0x5058('0x4b')][_0x5058('0x2b')]);_0x5a575c[_0x5058('0x30')]=_[_0x5058('0x42')](_0x1c61cc[_0x5058('0x30')]);_0x5a575c[_0x5058('0x39')]=_[_0x5058('0x31')](_0x5a575c[_0x5058('0x2d')],_0x5a575c['query']);_0x3371da[_0x5058('0x33')]=_[_0x5058('0x31')](_0x5a575c['model'],qs[_0x5058('0x32')](_0x1c61cc[_0x5058('0x30')][_0x5058('0x32')]));_0x3371da['attributes']=_0x3371da[_0x5058('0x33')][_0x5058('0x43')]?_0x3371da[_0x5058('0x33')]:_0x5a575c[_0x5058('0x2d')];_0x3371da[_0x5058('0x36')]=qs[_0x5058('0x37')](_0x1c61cc[_0x5058('0x30')]['sort']);_0x3371da[_0x5058('0x38')]=qs[_0x5058('0x39')](_['pick'](_0x1c61cc[_0x5058('0x30')],_0x5a575c[_0x5058('0x39')]));if(_0x1c61cc['query'][_0x5058('0x4c')]){_0x3371da[_0x5058('0x38')]=_['merge'](_0x3371da[_0x5058('0x38')],{'$or':_[_0x5058('0x2e')](_0x3371da['attributes'],function(_0x514387){var _0x220e89={};_0x220e89[_0x514387]={'$like':'%'+_0x1c61cc[_0x5058('0x30')][_0x5058('0x4c')]+'%'};return _0x220e89;})});}_0x3371da=_[_0x5058('0x3b')]({},_0x3371da,_0x1c61cc[_0x5058('0x44')]);return _0x2121aa[_0x5058('0x4d')](_0x3371da);}})['then'](function(_0x5353ec){if(_0x5353ec){_0x3e3a74=_0x5353ec[_0x5058('0x43')];if(!_0x1c61cc['query'][_0x5058('0x34')]('nolimit')){_0x3371da[_0x5058('0x1f')]=qs[_0x5058('0x1f')](_0x1c61cc[_0x5058('0x30')][_0x5058('0x1f')]);_0x3371da[_0x5058('0x1d')]=qs[_0x5058('0x1d')](_0x1c61cc[_0x5058('0x30')][_0x5058('0x1d')]);}return _0x2121aa[_0x5058('0x4d')](_0x3371da);}})[_0x5058('0x27')](function(_0x1c470c){if(_0x1c470c){return _0x1c470c?{'count':_0x3e3a74,'rows':_0x1c470c}:null;}})[_0x5058('0x27')](respondWithResult(_0x1efefa,null))['catch'](handleError(_0x1efefa,null));};exports['getSubjects']=function(_0x4933dd,_0x2dc5e2,_0x2ab392){var _0x2a6715={};var _0x17d44d={};var _0x4ec915;var _0x69121a;return db[_0x5058('0x2a')][_0x5058('0x4a')]({'where':{'id':_0x4933dd[_0x5058('0x41')]['id']}})[_0x5058('0x27')](handleEntityNotFound(_0x2dc5e2,null))[_0x5058('0x27')](function(_0x4e2018){if(_0x4e2018){_0x4ec915=_0x4e2018;_0x17d44d[_0x5058('0x2d')]=_['keys'](db[_0x5058('0x4b')][_0x5058('0x2b')]);_0x17d44d[_0x5058('0x30')]=_['keys'](_0x4933dd[_0x5058('0x30')]);_0x17d44d[_0x5058('0x39')]=_[_0x5058('0x31')](_0x17d44d['model'],_0x17d44d[_0x5058('0x30')]);_0x2a6715[_0x5058('0x33')]=_[_0x5058('0x31')](_0x17d44d[_0x5058('0x2d')],qs[_0x5058('0x32')](_0x4933dd['query'][_0x5058('0x32')]));_0x2a6715[_0x5058('0x33')]=_0x2a6715['attributes']['length']?_0x2a6715[_0x5058('0x33')]:_0x17d44d[_0x5058('0x2d')];_0x2a6715[_0x5058('0x36')]=qs[_0x5058('0x37')](_0x4933dd['query'][_0x5058('0x37')]);_0x2a6715[_0x5058('0x38')]=qs[_0x5058('0x39')](_[_0x5058('0x3a')](_0x4933dd[_0x5058('0x30')],_0x17d44d['filters']));if(_0x4933dd[_0x5058('0x30')][_0x5058('0x4c')]){_0x2a6715['where']=_[_0x5058('0x3b')](_0x2a6715['where'],{'$or':_[_0x5058('0x2e')](_0x2a6715['attributes'],function(_0x1bf557){var _0x518106={};_0x518106[_0x1bf557]={'$like':'%'+_0x4933dd[_0x5058('0x30')][_0x5058('0x4c')]+'%'};return _0x518106;})});}_0x2a6715=_['merge']({},_0x2a6715,_0x4933dd[_0x5058('0x44')]);return _0x4ec915[_0x5058('0x4e')](_0x2a6715);}})[_0x5058('0x27')](function(_0x323798){if(_0x323798){_0x69121a=_0x323798['length'];if(!_0x4933dd['query'][_0x5058('0x34')](_0x5058('0x35'))){_0x2a6715[_0x5058('0x1f')]=qs[_0x5058('0x1f')](_0x4933dd[_0x5058('0x30')][_0x5058('0x1f')]);_0x2a6715['offset']=qs['offset'](_0x4933dd[_0x5058('0x30')][_0x5058('0x1d')]);}return _0x4ec915['getSubjects'](_0x2a6715);}})['then'](function(_0x51f53f){if(_0x51f53f){return _0x51f53f?{'count':_0x69121a,'rows':_0x51f53f}:null;}})['then'](respondWithResult(_0x2dc5e2,null))[_0x5058('0x46')](handleError(_0x2dc5e2,null));};exports[_0x5058('0x4f')]=function(_0x938a14,_0x396b64,_0x171aa9){var _0x58f463={};var _0x1822c2={};var _0x2c62db;var _0x2e782d;return db[_0x5058('0x2a')]['findOne']({'where':{'id':_0x938a14[_0x5058('0x41')]['id']}})[_0x5058('0x27')](handleEntityNotFound(_0x396b64,null))['then'](function(_0x5edd79){if(_0x5edd79){_0x2c62db=_0x5edd79;_0x1822c2[_0x5058('0x2d')]=_['keys'](db['VtigerField']['rawAttributes']);_0x1822c2['query']=_[_0x5058('0x42')](_0x938a14[_0x5058('0x30')]);_0x1822c2[_0x5058('0x39')]=_[_0x5058('0x31')](_0x1822c2[_0x5058('0x2d')],_0x1822c2[_0x5058('0x30')]);_0x58f463[_0x5058('0x33')]=_['intersection'](_0x1822c2[_0x5058('0x2d')],qs[_0x5058('0x32')](_0x938a14[_0x5058('0x30')][_0x5058('0x32')]));_0x58f463['attributes']=_0x58f463[_0x5058('0x33')][_0x5058('0x43')]?_0x58f463[_0x5058('0x33')]:_0x1822c2['model'];_0x58f463['order']=qs[_0x5058('0x37')](_0x938a14['query']['sort']);_0x58f463[_0x5058('0x38')]=qs[_0x5058('0x39')](_[_0x5058('0x3a')](_0x938a14[_0x5058('0x30')],_0x1822c2[_0x5058('0x39')]));if(_0x938a14[_0x5058('0x30')][_0x5058('0x4c')]){_0x58f463[_0x5058('0x38')]=_[_0x5058('0x3b')](_0x58f463[_0x5058('0x38')],{'$or':_[_0x5058('0x2e')](_0x58f463[_0x5058('0x33')],function(_0x512adf){var _0xc6f721={};_0xc6f721[_0x512adf]={'$like':'%'+_0x938a14['query'][_0x5058('0x4c')]+'%'};return _0xc6f721;})});}_0x58f463=_['merge']({},_0x58f463,_0x938a14[_0x5058('0x44')]);return _0x2c62db[_0x5058('0x4f')](_0x58f463);}})[_0x5058('0x27')](function(_0x1fa2d1){if(_0x1fa2d1){_0x2e782d=_0x1fa2d1['length'];if(!_0x938a14['query'][_0x5058('0x34')](_0x5058('0x35'))){_0x58f463[_0x5058('0x1f')]=qs[_0x5058('0x1f')](_0x938a14[_0x5058('0x30')][_0x5058('0x1f')]);_0x58f463[_0x5058('0x1d')]=qs[_0x5058('0x1d')](_0x938a14['query'][_0x5058('0x1d')]);}return _0x2c62db[_0x5058('0x4f')](_0x58f463);}})[_0x5058('0x27')](function(_0x4364e9){if(_0x4364e9){return _0x4364e9?{'count':_0x2e782d,'rows':_0x4364e9}:null;}})[_0x5058('0x27')](respondWithResult(_0x396b64,null))[_0x5058('0x46')](handleError(_0x396b64,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 44f6658..1e6fd88 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 _0x6285=['./intVtigerConfiguration.attributes','exports','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0xee7f65,_0x4ff021){var _0x5449bc=function(_0x8090e2){while(--_0x8090e2){_0xee7f65['push'](_0xee7f65['shift']());}};_0x5449bc(++_0x4ff021);}(_0x6285,0xaa));var _0x5628=function(_0xc11a4c,_0x34b33a){_0xc11a4c=_0xc11a4c-0x0;var _0x32579b=_0x6285[_0xc11a4c];return _0x32579b;};'use strict';var _=require(_0x5628('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5628('0x1'));var moment=require(_0x5628('0x2'));var BPromise=require(_0x5628('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5628('0x4'));var rimraf=require('rimraf');var config=require(_0x5628('0x5'));var attributes=require(_0x5628('0x6'));module[_0x5628('0x7')]=function(_0xeefddb,_0x2def94){return _0xeefddb['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x083c=['../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x37f774,_0x2ec6d3){var _0x17f081=function(_0x5b7fd2){while(--_0x5b7fd2){_0x37f774['push'](_0x37f774['shift']());}};_0x17f081(++_0x2ec6d3);}(_0x083c,0x144));var _0xc083=function(_0x3873ab,_0x152776){_0x3873ab=_0x3873ab-0x0;var _0x42f6ed=_0x083c[_0x3873ab];return _0x42f6ed;};'use strict';var _=require('lodash');var util=require(_0xc083('0x0'));var logger=require(_0xc083('0x1'))('api');var moment=require(_0xc083('0x2'));var BPromise=require('bluebird');var rp=require(_0xc083('0x3'));var fs=require('fs');var path=require(_0xc083('0x4'));var rimraf=require(_0xc083('0x5'));var config=require(_0xc083('0x6'));var attributes=require(_0xc083('0x7'));module['exports']=function(_0x309f6a,_0x1a813c){return _0x309f6a['define'](_0xc083('0x8'),attributes,{'tableName':_0xc083('0x9'),'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 8dbd8be..1239893 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 _0xf436=['lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf436,0x1e0));var _0x6f43=function(_0x34e80f,_0x36476b){_0x34e80f=_0x34e80f-0x0;var _0x3a0d38=_0xf436[_0x34e80f];return _0x3a0d38;};'use strict';var _=require(_0x6f43('0x0'));var util=require(_0x6f43('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f43('0x2'));var fs=require('fs');var Redis=require(_0x6f43('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f43('0x4'));var logger=require(_0x6f43('0x5'))(_0x6f43('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6f43('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x440a14,_0x37c9a8,_0x139d53){return new BPromise(function(_0x5d4329,_0x5f5ceb){return client[_0x6f43('0x8')](_0x440a14,_0x139d53)[_0x6f43('0x9')](function(_0x2d4318){logger[_0x6f43('0xa')](_0x6f43('0xb'),_0x37c9a8,_0x6f43('0xc'));logger['debug'](_0x6f43('0xd'),_0x37c9a8,'request\x20sent',JSON[_0x6f43('0xe')](_0x2d4318));if(_0x2d4318[_0x6f43('0xf')]){if(_0x2d4318['error'][_0x6f43('0x10')]===0x1f4){logger[_0x6f43('0xf')](_0x6f43('0xb'),_0x37c9a8,_0x2d4318[_0x6f43('0xf')][_0x6f43('0x11')]);return _0x5f5ceb(_0x2d4318[_0x6f43('0xf')][_0x6f43('0x11')]);}logger[_0x6f43('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x37c9a8,_0x2d4318[_0x6f43('0xf')][_0x6f43('0x11')]);return _0x5d4329(_0x2d4318[_0x6f43('0xf')][_0x6f43('0x11')]);}else{logger[_0x6f43('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x37c9a8,_0x6f43('0xc'));_0x5d4329(_0x2d4318[_0x6f43('0x12')][_0x6f43('0x11')]);}})[_0x6f43('0x13')](function(_0x42c9f1){logger[_0x6f43('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x37c9a8,_0x42c9f1);_0x5f5ceb(_0x42c9f1);});});} \ No newline at end of file +var _0xca5c=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5a7dfe,_0x1b3da9){var _0x25b133=function(_0xb471e9){while(--_0xb471e9){_0x5a7dfe['push'](_0x5a7dfe['shift']());}};_0x25b133(++_0x1b3da9);}(_0xca5c,0xb8));var _0xcca5=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0xca5c[_0x1af05b];return _0x5be7cc;};'use strict';var _=require(_0xcca5('0x0'));var util=require(_0xcca5('0x1'));var moment=require(_0xcca5('0x2'));var BPromise=require(_0xcca5('0x3'));var rs=require(_0xcca5('0x4'));var fs=require('fs');var Redis=require(_0xcca5('0x5'));var db=require(_0xcca5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcca5('0x7'));var config=require(_0xcca5('0x8'));var jayson=require(_0xcca5('0x9'));var client=jayson[_0xcca5('0xa')][_0xcca5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xad832,_0x25612c,_0x53791b){return new BPromise(function(_0x1a90ba,_0x4d6b6b){return client[_0xcca5('0xc')](_0xad832,_0x53791b)[_0xcca5('0xd')](function(_0x574228){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x25612c,_0xcca5('0xe'));logger['debug'](_0xcca5('0xf'),_0x25612c,'request\x20sent',JSON['stringify'](_0x574228));if(_0x574228['error']){if(_0x574228[_0xcca5('0x10')]['code']===0x1f4){logger[_0xcca5('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x25612c,_0x574228[_0xcca5('0x10')][_0xcca5('0x11')]);return _0x4d6b6b(_0x574228[_0xcca5('0x10')][_0xcca5('0x11')]);}logger['error'](_0xcca5('0x12'),_0x25612c,_0x574228[_0xcca5('0x10')]['message']);return _0x1a90ba(_0x574228['error'][_0xcca5('0x11')]);}else{logger['info'](_0xcca5('0x12'),_0x25612c,'request\x20sent');_0x1a90ba(_0x574228[_0xcca5('0x13')][_0xcca5('0x11')]);}})[_0xcca5('0x14')](function(_0x14404d){logger[_0xcca5('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x25612c,_0x14404d);_0x4d6b6b(_0x14404d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 53561e9..6cf2577 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 _0x18a2=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x18a2,0xdc));var _0x218a=function(_0x15ba19,_0x2acf13){_0x15ba19=_0x15ba19-0x0;var _0x409196=_0x18a2[_0x15ba19];return _0x409196;};'use strict';var multer=require(_0x218a('0x0'));var util=require(_0x218a('0x1'));var path=require(_0x218a('0x2'));var timeout=require(_0x218a('0x3'));var express=require(_0x218a('0x4'));var router=express['Router']();var fs_extra=require(_0x218a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x218a('0x6'));var config=require('../../config/environment');var controller=require(_0x218a('0x7'));router['get']('/',auth[_0x218a('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x218a('0x9')]);router[_0x218a('0xa')]('/',auth[_0x218a('0x8')](),controller[_0x218a('0xb')]);router[_0x218a('0xc')](_0x218a('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x218a('0xe')](_0x218a('0xd'),auth[_0x218a('0x8')](),controller[_0x218a('0xf')]);module[_0x218a('0x10')]=router; \ No newline at end of file +var _0x770d=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x4cb51c,_0x48feba){var _0x52c77c=function(_0x20d0bd){while(--_0x20d0bd){_0x4cb51c['push'](_0x4cb51c['shift']());}};_0x52c77c(++_0x48feba);}(_0x770d,0x121));var _0xd770=function(_0x169902,_0x310166){_0x169902=_0x169902-0x0;var _0x371977=_0x770d[_0x169902];return _0x371977;};'use strict';var multer=require(_0xd770('0x0'));var util=require('util');var path=require(_0xd770('0x1'));var timeout=require(_0xd770('0x2'));var express=require(_0xd770('0x3'));var router=express[_0xd770('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd770('0x5'));var interaction=require(_0xd770('0x6'));var config=require('../../config/environment');var controller=require(_0xd770('0x7'));router[_0xd770('0x8')]('/',auth[_0xd770('0x9')](),controller[_0xd770('0xa')]);router[_0xd770('0x8')](_0xd770('0xb'),auth['isAuthenticated'](),controller[_0xd770('0xc')]);router['post']('/',auth[_0xd770('0x9')](),controller[_0xd770('0xd')]);router[_0xd770('0xe')](_0xd770('0xb'),auth['isAuthenticated'](),controller[_0xd770('0xf')]);router[_0xd770('0x10')](_0xd770('0xb'),auth[_0xd770('0x9')](),controller[_0xd770('0x11')]);module[_0xd770('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 69e8d9d..1ee23ad 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 _0xed7f=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','string','variable'];(function(_0x4d83da,_0x24ebf6){var _0x135277=function(_0x15b20b){while(--_0x15b20b){_0x4d83da['push'](_0x4d83da['shift']());}};_0x135277(++_0x24ebf6);}(_0xed7f,0xc2));var _0xfed7=function(_0x2d9f30,_0x258111){_0x2d9f30=_0x2d9f30-0x0;var _0x243932=_0xed7f[_0x2d9f30];return _0x243932;};'use strict';var Sequelize=require(_0xfed7('0x0'));module[_0xfed7('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfed7('0x2'),_0xfed7('0x3'),_0xfed7('0x4'),_0xfed7('0x5'),_0xfed7('0x6')),'defaultValue':_0xfed7('0x2')},'content':{'type':Sequelize[_0xfed7('0x7')]},'key':{'type':Sequelize[_0xfed7('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xfed7('0x4'))},'keyContent':{'type':Sequelize[_0xfed7('0x7')]},'idField':{'type':Sequelize[_0xfed7('0x7')]},'nameField':{'type':Sequelize[_0xfed7('0x7')]},'customField':{'type':Sequelize[_0xfed7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfed7('0x7')]}}; \ No newline at end of file +var _0x261b=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x261b,0x184));var _0xb261=function(_0x26a840,_0x347f36){_0x26a840=_0x26a840-0x0;var _0x160929=_0x261b[_0x26a840];return _0x160929;};'use strict';var Sequelize=require(_0xb261('0x0'));module[_0xb261('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb261('0x2'),_0xb261('0x3'),_0xb261('0x4'),_0xb261('0x5'),_0xb261('0x6')),'defaultValue':_0xb261('0x2')},'content':{'type':Sequelize[_0xb261('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xb261('0x2'),_0xb261('0x3'),_0xb261('0x4'))},'keyContent':{'type':Sequelize[_0xb261('0x7')]},'idField':{'type':Sequelize[_0xb261('0x7')]},'nameField':{'type':Sequelize[_0xb261('0x7')]},'customField':{'type':Sequelize[_0xb261('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb261('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3490444..b214e91 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 _0x2a8d=['key','model','map','query','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','merge','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2a8d,0x178));var _0xd2a8=function(_0x566760,_0x1f7104){_0x566760=_0x566760-0x0;var _0x30ca6d=_0x2a8d[_0x566760];return _0x30ca6d;};'use strict';var emlformat=require(_0xd2a8('0x0'));var rimraf=require(_0xd2a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2a8('0x2'));var rp=require(_0xd2a8('0x3'));var moment=require(_0xd2a8('0x4'));var BPromise=require(_0xd2a8('0x5'));var Mustache=require(_0xd2a8('0x6'));var util=require(_0xd2a8('0x7'));var path=require('path');var sox=require(_0xd2a8('0x8'));var csv=require(_0xd2a8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd2a8('0xa'));var _=require(_0xd2a8('0xb'));var squel=require('squel');var crypto=require(_0xd2a8('0xc'));var jsforce=require(_0xd2a8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd2a8('0x9'));var querystring=require('querystring');var Papa=require(_0xd2a8('0xe'));var Redis=require(_0xd2a8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd2a8('0x10'));var as=require(_0xd2a8('0x11'));var hardwareService=require(_0xd2a8('0x12'));var logger=require(_0xd2a8('0x13'))('api');var utils=require(_0xd2a8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd2a8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x288010,_0x29d2f5){_0x29d2f5=_0x29d2f5||0xcc;return function(_0x10ad57){if(_0x10ad57){return _0x288010[_0xd2a8('0x16')](_0x29d2f5);}return _0x288010['status'](_0x29d2f5)[_0xd2a8('0x17')]();};}function respondWithResult(_0x265d65,_0x513b1d){_0x513b1d=_0x513b1d||0xc8;return function(_0x560243){if(_0x560243){return _0x265d65[_0xd2a8('0x18')](_0x513b1d)[_0xd2a8('0x19')](_0x560243);}};}function respondWithFilteredResult(_0x59b88f,_0x1f4cca){return function(_0x58fc35){if(_0x58fc35){var _0x1c99fa=typeof _0x1f4cca[_0xd2a8('0x1a')]===_0xd2a8('0x1b')&&typeof _0x1f4cca['limit']===_0xd2a8('0x1b');var _0x24746e=_0x58fc35[_0xd2a8('0x1c')];var _0x6c808a=_0x1c99fa?0x0:_0x1f4cca[_0xd2a8('0x1a')];var _0x32b3d5=_0x1c99fa?_0x58fc35[_0xd2a8('0x1c')]:_0x1f4cca['offset']+_0x1f4cca['limit'];var _0x5e4df4;if(_0x32b3d5>=_0x24746e){_0x32b3d5=_0x24746e;_0x5e4df4=0xc8;}else{_0x5e4df4=0xce;}_0x59b88f[_0xd2a8('0x18')](_0x5e4df4);return _0x59b88f['set'](_0xd2a8('0x1d'),_0x6c808a+'-'+_0x32b3d5+'/'+_0x24746e)[_0xd2a8('0x19')](_0x58fc35);}return null;};}function patchUpdates(_0x30bff6){return function(_0x36c73f){try{jsonpatch['apply'](_0x36c73f,_0x30bff6,!![]);}catch(_0x549964){return BPromise[_0xd2a8('0x1e')](_0x549964);}return _0x36c73f[_0xd2a8('0x1f')]();};}function saveUpdates(_0x5d2ab1,_0x44b024){return function(_0x594f57){if(_0x594f57){return _0x594f57[_0xd2a8('0x20')](_0x5d2ab1)[_0xd2a8('0x21')](function(_0x351ba3){return _0x351ba3;});}return null;};}function removeEntity(_0x134197,_0x476f84){return function(_0x2f3e9e){if(_0x2f3e9e){return _0x2f3e9e[_0xd2a8('0x22')]()[_0xd2a8('0x21')](function(){_0x134197[_0xd2a8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d660,_0xc61d62){return function(_0x382c4d){if(!_0x382c4d){_0x16d660[_0xd2a8('0x16')](0x194);}return _0x382c4d;};}function handleError(_0x2fbb0a,_0x36c3da){_0x36c3da=_0x36c3da||0x1f4;return function(_0x1b567f){logger[_0xd2a8('0x23')](_0x1b567f[_0xd2a8('0x24')]);if(_0x1b567f[_0xd2a8('0x25')]){delete _0x1b567f[_0xd2a8('0x25')];}_0x2fbb0a['status'](_0x36c3da)[_0xd2a8('0x26')](_0x1b567f);};}exports[_0xd2a8('0x27')]=function(_0x181f7e,_0x2a619a){var _0x21ce30={},_0x3976bc={},_0x3caeb5={'count':0x0,'rows':[]};var _0x573c11=_['map'](db[_0xd2a8('0x28')][_0xd2a8('0x29')],function(_0x15e030){return{'name':_0x15e030[_0xd2a8('0x2a')],'type':_0x15e030[_0xd2a8('0x2b')][_0xd2a8('0x2c')]};});_0x3976bc[_0xd2a8('0x2d')]=_[_0xd2a8('0x2e')](_0x573c11,_0xd2a8('0x25'));_0x3976bc[_0xd2a8('0x2f')]=_['keys'](_0x181f7e[_0xd2a8('0x2f')]);_0x3976bc['filters']=_[_0xd2a8('0x30')](_0x3976bc[_0xd2a8('0x2d')],_0x3976bc[_0xd2a8('0x2f')]);_0x21ce30[_0xd2a8('0x31')]=_[_0xd2a8('0x30')](_0x3976bc[_0xd2a8('0x2d')],qs[_0xd2a8('0x32')](_0x181f7e[_0xd2a8('0x2f')][_0xd2a8('0x32')]));_0x21ce30['attributes']=_0x21ce30[_0xd2a8('0x31')][_0xd2a8('0x33')]?_0x21ce30[_0xd2a8('0x31')]:_0x3976bc['model'];if(!_0x181f7e[_0xd2a8('0x2f')]['hasOwnProperty'](_0xd2a8('0x34'))){_0x21ce30['limit']=qs[_0xd2a8('0x35')](_0x181f7e[_0xd2a8('0x2f')][_0xd2a8('0x35')]);_0x21ce30[_0xd2a8('0x1a')]=qs[_0xd2a8('0x1a')](_0x181f7e['query']['offset']);}_0x21ce30['order']=qs['sort'](_0x181f7e['query'][_0xd2a8('0x36')]);_0x21ce30[_0xd2a8('0x37')]=qs[_0xd2a8('0x38')](_['pick'](_0x181f7e[_0xd2a8('0x2f')],_0x3976bc[_0xd2a8('0x38')]),_0x573c11);if(_0x181f7e[_0xd2a8('0x2f')]['filter']){_0x21ce30['where']=_[_0xd2a8('0x39')](_0x21ce30[_0xd2a8('0x37')],{'$or':_[_0xd2a8('0x2e')](_0x573c11,function(_0xa1112c){if(_0xa1112c[_0xd2a8('0x2b')]!=='VIRTUAL'){var _0x48b392={};_0x48b392[_0xa1112c[_0xd2a8('0x25')]]={'$like':'%'+_0x181f7e[_0xd2a8('0x2f')][_0xd2a8('0x3a')]+'%'};return _0x48b392;}})});}_0x21ce30=_[_0xd2a8('0x39')]({},_0x21ce30,_0x181f7e[_0xd2a8('0x3b')]);var _0x132e57={'where':_0x21ce30['where']};return db[_0xd2a8('0x28')][_0xd2a8('0x1c')](_0x132e57)[_0xd2a8('0x21')](function(_0xd22a3f){_0x3caeb5['count']=_0xd22a3f;if(_0x181f7e[_0xd2a8('0x2f')][_0xd2a8('0x3c')]){_0x21ce30[_0xd2a8('0x3d')]=[{'all':!![]}];}return db[_0xd2a8('0x28')][_0xd2a8('0x3e')](_0x21ce30);})['then'](function(_0x42d278){_0x3caeb5[_0xd2a8('0x3f')]=_0x42d278;return _0x3caeb5;})['then'](respondWithFilteredResult(_0x2a619a,_0x21ce30))[_0xd2a8('0x40')](handleError(_0x2a619a,null));};exports['show']=function(_0x532f2d,_0x45d2bf){var _0x6f661a={'raw':!![],'where':{'id':_0x532f2d[_0xd2a8('0x41')]['id']}},_0x107aa={};_0x107aa[_0xd2a8('0x2d')]=_[_0xd2a8('0x42')](db[_0xd2a8('0x28')]['rawAttributes']);_0x107aa[_0xd2a8('0x2f')]=_[_0xd2a8('0x42')](_0x532f2d[_0xd2a8('0x2f')]);_0x107aa['filters']=_['intersection'](_0x107aa[_0xd2a8('0x2d')],_0x107aa[_0xd2a8('0x2f')]);_0x6f661a[_0xd2a8('0x31')]=_[_0xd2a8('0x30')](_0x107aa[_0xd2a8('0x2d')],qs[_0xd2a8('0x32')](_0x532f2d[_0xd2a8('0x2f')][_0xd2a8('0x32')]));_0x6f661a['attributes']=_0x6f661a[_0xd2a8('0x31')][_0xd2a8('0x33')]?_0x6f661a[_0xd2a8('0x31')]:_0x107aa[_0xd2a8('0x2d')];if(_0x532f2d['query'][_0xd2a8('0x3c')]){_0x6f661a['include']=[{'all':!![]}];}_0x6f661a=_[_0xd2a8('0x39')]({},_0x6f661a,_0x532f2d[_0xd2a8('0x3b')]);return db[_0xd2a8('0x28')][_0xd2a8('0x43')](_0x6f661a)[_0xd2a8('0x21')](handleEntityNotFound(_0x45d2bf,null))[_0xd2a8('0x21')](respondWithResult(_0x45d2bf,null))[_0xd2a8('0x40')](handleError(_0x45d2bf,null));};exports[_0xd2a8('0x44')]=function(_0x3e5eaa,_0x42434b){return db[_0xd2a8('0x28')][_0xd2a8('0x44')](_0x3e5eaa[_0xd2a8('0x45')],{})[_0xd2a8('0x21')](respondWithResult(_0x42434b,0xc9))['catch'](handleError(_0x42434b,null));};exports[_0xd2a8('0x20')]=function(_0x39292c,_0x5ead0d){if(_0x39292c[_0xd2a8('0x45')]['id']){delete _0x39292c[_0xd2a8('0x45')]['id'];}return db[_0xd2a8('0x28')][_0xd2a8('0x43')]({'where':{'id':_0x39292c[_0xd2a8('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ead0d,null))[_0xd2a8('0x21')](saveUpdates(_0x39292c[_0xd2a8('0x45')],null))['then'](respondWithResult(_0x5ead0d,null))[_0xd2a8('0x40')](handleError(_0x5ead0d,null));};exports['destroy']=function(_0x40099b,_0x1d6ce7){return db['VtigerField'][_0xd2a8('0x43')]({'where':{'id':_0x40099b['params']['id']}})[_0xd2a8('0x21')](handleEntityNotFound(_0x1d6ce7,null))[_0xd2a8('0x21')](removeEntity(_0x1d6ce7,null))['catch'](handleError(_0x1d6ce7,null));}; \ No newline at end of file +var _0xa192=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VtigerField','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa192,0x11d));var _0x2a19=function(_0x2b74ea,_0x2e97ef){_0x2b74ea=_0x2b74ea-0x0;var _0xa285b2=_0xa192[_0x2b74ea];return _0xa285b2;};'use strict';var emlformat=require(_0x2a19('0x0'));var rimraf=require(_0x2a19('0x1'));var zipdir=require(_0x2a19('0x2'));var jsonpatch=require(_0x2a19('0x3'));var rp=require(_0x2a19('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a19('0x5'));var util=require('util');var path=require(_0x2a19('0x6'));var sox=require(_0x2a19('0x7'));var csv=require(_0x2a19('0x8'));var ejs=require(_0x2a19('0x9'));var fs=require('fs');var fs_extra=require(_0x2a19('0xa'));var _=require('lodash');var squel=require(_0x2a19('0xb'));var crypto=require(_0x2a19('0xc'));var jsforce=require(_0x2a19('0xd'));var deskjs=require(_0x2a19('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2a19('0xf'));var Papa=require(_0x2a19('0x10'));var Redis=require(_0x2a19('0x11'));var authService=require(_0x2a19('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a19('0x13'));var logger=require('../../config/logger')(_0x2a19('0x14'));var utils=require(_0x2a19('0x15'));var config=require(_0x2a19('0x16'));var licenseUtil=require(_0x2a19('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cf676,_0x1c79f0){_0x1c79f0=_0x1c79f0||0xcc;return function(_0x52d489){if(_0x52d489){return _0x5cf676['sendStatus'](_0x1c79f0);}return _0x5cf676[_0x2a19('0x18')](_0x1c79f0)['end']();};}function respondWithResult(_0x3ddece,_0x1e5596){_0x1e5596=_0x1e5596||0xc8;return function(_0x926446){if(_0x926446){return _0x3ddece[_0x2a19('0x18')](_0x1e5596)[_0x2a19('0x19')](_0x926446);}};}function respondWithFilteredResult(_0x56e376,_0x435899){return function(_0x51ce67){if(_0x51ce67){var _0x2ad702=typeof _0x435899[_0x2a19('0x1a')]==='undefined'&&typeof _0x435899[_0x2a19('0x1b')]===_0x2a19('0x1c');var _0x2097bb=_0x51ce67['count'];var _0x15c5c2=_0x2ad702?0x0:_0x435899[_0x2a19('0x1a')];var _0x16c733=_0x2ad702?_0x51ce67[_0x2a19('0x1d')]:_0x435899[_0x2a19('0x1a')]+_0x435899[_0x2a19('0x1b')];var _0x2d319a;if(_0x16c733>=_0x2097bb){_0x16c733=_0x2097bb;_0x2d319a=0xc8;}else{_0x2d319a=0xce;}_0x56e376[_0x2a19('0x18')](_0x2d319a);return _0x56e376['set']('Content-Range',_0x15c5c2+'-'+_0x16c733+'/'+_0x2097bb)[_0x2a19('0x19')](_0x51ce67);}return null;};}function patchUpdates(_0x4eb298){return function(_0x5ce69c){try{jsonpatch['apply'](_0x5ce69c,_0x4eb298,!![]);}catch(_0x2e1744){return BPromise[_0x2a19('0x1e')](_0x2e1744);}return _0x5ce69c[_0x2a19('0x1f')]();};}function saveUpdates(_0x42557b,_0x51d36f){return function(_0x505ba6){if(_0x505ba6){return _0x505ba6[_0x2a19('0x20')](_0x42557b)[_0x2a19('0x21')](function(_0x35dcc2){return _0x35dcc2;});}return null;};}function removeEntity(_0x3b096b,_0x2fc096){return function(_0x557cce){if(_0x557cce){return _0x557cce[_0x2a19('0x22')]()[_0x2a19('0x21')](function(){_0x3b096b['status'](0xcc)[_0x2a19('0x23')]();});}};}function handleEntityNotFound(_0x18ac86,_0x3e05c5){return function(_0x578859){if(!_0x578859){_0x18ac86[_0x2a19('0x24')](0x194);}return _0x578859;};}function handleError(_0x1af587,_0x2b6305){_0x2b6305=_0x2b6305||0x1f4;return function(_0x4a4f0c){logger[_0x2a19('0x25')](_0x4a4f0c[_0x2a19('0x26')]);if(_0x4a4f0c['name']){delete _0x4a4f0c[_0x2a19('0x27')];}_0x1af587['status'](_0x2b6305)[_0x2a19('0x28')](_0x4a4f0c);};}exports['index']=function(_0x2e6306,_0x1a9289){var _0x3da0e5={},_0x4effb7={},_0x7107e1={'count':0x0,'rows':[]};var _0x32c945=_['map'](db['VtigerField'][_0x2a19('0x29')],function(_0x37ec5d){return{'name':_0x37ec5d[_0x2a19('0x2a')],'type':_0x37ec5d[_0x2a19('0x2b')][_0x2a19('0x2c')]};});_0x4effb7[_0x2a19('0x2d')]=_[_0x2a19('0x2e')](_0x32c945,'name');_0x4effb7[_0x2a19('0x2f')]=_[_0x2a19('0x30')](_0x2e6306[_0x2a19('0x2f')]);_0x4effb7[_0x2a19('0x31')]=_[_0x2a19('0x32')](_0x4effb7[_0x2a19('0x2d')],_0x4effb7[_0x2a19('0x2f')]);_0x3da0e5['attributes']=_[_0x2a19('0x32')](_0x4effb7[_0x2a19('0x2d')],qs['fields'](_0x2e6306[_0x2a19('0x2f')]['fields']));_0x3da0e5[_0x2a19('0x33')]=_0x3da0e5['attributes']['length']?_0x3da0e5[_0x2a19('0x33')]:_0x4effb7['model'];if(!_0x2e6306[_0x2a19('0x2f')][_0x2a19('0x34')](_0x2a19('0x35'))){_0x3da0e5[_0x2a19('0x1b')]=qs['limit'](_0x2e6306[_0x2a19('0x2f')][_0x2a19('0x1b')]);_0x3da0e5['offset']=qs['offset'](_0x2e6306[_0x2a19('0x2f')][_0x2a19('0x1a')]);}_0x3da0e5[_0x2a19('0x36')]=qs['sort'](_0x2e6306[_0x2a19('0x2f')][_0x2a19('0x37')]);_0x3da0e5[_0x2a19('0x38')]=qs[_0x2a19('0x31')](_[_0x2a19('0x39')](_0x2e6306[_0x2a19('0x2f')],_0x4effb7[_0x2a19('0x31')]),_0x32c945);if(_0x2e6306[_0x2a19('0x2f')][_0x2a19('0x3a')]){_0x3da0e5[_0x2a19('0x38')]=_[_0x2a19('0x3b')](_0x3da0e5[_0x2a19('0x38')],{'$or':_[_0x2a19('0x2e')](_0x32c945,function(_0x3e38c8){if(_0x3e38c8[_0x2a19('0x2b')]!==_0x2a19('0x3c')){var _0x508801={};_0x508801[_0x3e38c8['name']]={'$like':'%'+_0x2e6306[_0x2a19('0x2f')][_0x2a19('0x3a')]+'%'};return _0x508801;}})});}_0x3da0e5=_[_0x2a19('0x3b')]({},_0x3da0e5,_0x2e6306['options']);var _0x30931e={'where':_0x3da0e5[_0x2a19('0x38')]};return db[_0x2a19('0x3d')]['count'](_0x30931e)[_0x2a19('0x21')](function(_0x47c8ab){_0x7107e1['count']=_0x47c8ab;if(_0x2e6306['query'][_0x2a19('0x3e')]){_0x3da0e5[_0x2a19('0x3f')]=[{'all':!![]}];}return db[_0x2a19('0x3d')][_0x2a19('0x40')](_0x3da0e5);})['then'](function(_0xdc1617){_0x7107e1[_0x2a19('0x41')]=_0xdc1617;return _0x7107e1;})[_0x2a19('0x21')](respondWithFilteredResult(_0x1a9289,_0x3da0e5))[_0x2a19('0x42')](handleError(_0x1a9289,null));};exports[_0x2a19('0x43')]=function(_0x14f7e1,_0x483fe7){var _0x11e56c={'raw':!![],'where':{'id':_0x14f7e1[_0x2a19('0x44')]['id']}},_0x3fbab8={};_0x3fbab8['model']=_[_0x2a19('0x30')](db[_0x2a19('0x3d')][_0x2a19('0x29')]);_0x3fbab8[_0x2a19('0x2f')]=_[_0x2a19('0x30')](_0x14f7e1[_0x2a19('0x2f')]);_0x3fbab8[_0x2a19('0x31')]=_[_0x2a19('0x32')](_0x3fbab8[_0x2a19('0x2d')],_0x3fbab8[_0x2a19('0x2f')]);_0x11e56c[_0x2a19('0x33')]=_['intersection'](_0x3fbab8[_0x2a19('0x2d')],qs[_0x2a19('0x45')](_0x14f7e1[_0x2a19('0x2f')][_0x2a19('0x45')]));_0x11e56c[_0x2a19('0x33')]=_0x11e56c[_0x2a19('0x33')][_0x2a19('0x46')]?_0x11e56c[_0x2a19('0x33')]:_0x3fbab8['model'];if(_0x14f7e1[_0x2a19('0x2f')][_0x2a19('0x3e')]){_0x11e56c[_0x2a19('0x3f')]=[{'all':!![]}];}_0x11e56c=_[_0x2a19('0x3b')]({},_0x11e56c,_0x14f7e1['options']);return db[_0x2a19('0x3d')][_0x2a19('0x47')](_0x11e56c)[_0x2a19('0x21')](handleEntityNotFound(_0x483fe7,null))[_0x2a19('0x21')](respondWithResult(_0x483fe7,null))[_0x2a19('0x42')](handleError(_0x483fe7,null));};exports[_0x2a19('0x48')]=function(_0x48549a,_0x3b7529){return db[_0x2a19('0x3d')][_0x2a19('0x48')](_0x48549a[_0x2a19('0x49')],{})['then'](respondWithResult(_0x3b7529,0xc9))['catch'](handleError(_0x3b7529,null));};exports[_0x2a19('0x20')]=function(_0x19be49,_0x568a41){if(_0x19be49['body']['id']){delete _0x19be49[_0x2a19('0x49')]['id'];}return db[_0x2a19('0x3d')]['find']({'where':{'id':_0x19be49[_0x2a19('0x44')]['id']}})[_0x2a19('0x21')](handleEntityNotFound(_0x568a41,null))[_0x2a19('0x21')](saveUpdates(_0x19be49[_0x2a19('0x49')],null))[_0x2a19('0x21')](respondWithResult(_0x568a41,null))[_0x2a19('0x42')](handleError(_0x568a41,null));};exports[_0x2a19('0x22')]=function(_0x104fe7,_0x2bbe62){return db[_0x2a19('0x3d')][_0x2a19('0x47')]({'where':{'id':_0x104fe7[_0x2a19('0x44')]['id']}})[_0x2a19('0x21')](handleEntityNotFound(_0x2bbe62,null))[_0x2a19('0x21')](removeEntity(_0x2bbe62,null))[_0x2a19('0x42')](handleError(_0x2bbe62,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c0ed03b..32693f2 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 _0x8716=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8716,0x7e));var _0x6871=function(_0xc363be,_0x101f46){_0xc363be=_0xc363be-0x0;var _0x5671dd=_0x8716[_0xc363be];return _0x5671dd;};'use strict';var _=require(_0x6871('0x0'));var util=require(_0x6871('0x1'));var logger=require(_0x6871('0x2'))('api');var moment=require(_0x6871('0x3'));var BPromise=require(_0x6871('0x4'));var rp=require(_0x6871('0x5'));var fs=require('fs');var path=require(_0x6871('0x6'));var rimraf=require(_0x6871('0x7'));var config=require('../../config/environment');var attributes=require(_0x6871('0x8'));module[_0x6871('0x9')]=function(_0x174498,_0x1c927f){return _0x174498['define'](_0x6871('0xa'),attributes,{'tableName':_0x6871('0xb'),'paranoid':![],'indexes':[{'name':_0x6871('0xc'),'fields':[_0x6871('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3338=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','idField'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3338,0xf1));var _0x8333=function(_0x7aef09,_0x192202){_0x7aef09=_0x7aef09-0x0;var _0x224203=_0x3338[_0x7aef09];return _0x224203;};'use strict';var _=require(_0x8333('0x0'));var util=require(_0x8333('0x1'));var logger=require(_0x8333('0x2'))(_0x8333('0x3'));var moment=require(_0x8333('0x4'));var BPromise=require(_0x8333('0x5'));var rp=require(_0x8333('0x6'));var fs=require('fs');var path=require(_0x8333('0x7'));var rimraf=require(_0x8333('0x8'));var config=require('../../config/environment');var attributes=require(_0x8333('0x9'));module[_0x8333('0xa')]=function(_0x2549ce,_0x1a6801){return _0x2549ce['define'](_0x8333('0xb'),attributes,{'tableName':_0x8333('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x8333('0xd'),_0x8333('0xe')],'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 1559fa0..ec9a15c 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 _0x47b3=['jayson/promise','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2b7f97,_0x3fe5c6){var _0x3c2339=function(_0x12e36c){while(--_0x12e36c){_0x2b7f97['push'](_0x2b7f97['shift']());}};_0x3c2339(++_0x3fe5c6);}(_0x47b3,0x1ef));var _0x347b=function(_0x1c36f3,_0x2a7e08){_0x1c36f3=_0x1c36f3-0x0;var _0x2ca8b1=_0x47b3[_0x1c36f3];return _0x2ca8b1;};'use strict';var _=require(_0x347b('0x0'));var util=require('util');var moment=require(_0x347b('0x1'));var BPromise=require(_0x347b('0x2'));var rs=require(_0x347b('0x3'));var fs=require('fs');var Redis=require(_0x347b('0x4'));var db=require(_0x347b('0x5'))['db'];var utils=require(_0x347b('0x6'));var logger=require('../../config/logger')(_0x347b('0x7'));var config=require(_0x347b('0x8'));var jayson=require(_0x347b('0x9'));var client=jayson['client'][_0x347b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5bd2,_0x2a4b41,_0x18e70e){return new BPromise(function(_0x3d13ea,_0x567d2f){return client[_0x347b('0xb')](_0x4c5bd2,_0x18e70e)['then'](function(_0x184498){logger[_0x347b('0xc')](_0x347b('0xd'),_0x2a4b41,_0x347b('0xe'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x2a4b41,'request\x20sent',JSON[_0x347b('0xf')](_0x184498));if(_0x184498['error']){if(_0x184498['error'][_0x347b('0x10')]===0x1f4){logger[_0x347b('0x11')](_0x347b('0xd'),_0x2a4b41,_0x184498['error'][_0x347b('0x12')]);return _0x567d2f(_0x184498[_0x347b('0x11')][_0x347b('0x12')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x2a4b41,_0x184498[_0x347b('0x11')]['message']);return _0x3d13ea(_0x184498['error'][_0x347b('0x12')]);}else{logger['info'](_0x347b('0xd'),_0x2a4b41,_0x347b('0xe'));_0x3d13ea(_0x184498[_0x347b('0x13')][_0x347b('0x12')]);}})[_0x347b('0x14')](function(_0x337f43){logger[_0x347b('0x11')](_0x347b('0xd'),_0x2a4b41,_0x337f43);_0x567d2f(_0x337f43);});});} \ No newline at end of file +var _0x1744=['VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1dbfa3,_0x5717dd){var _0x4f8e54=function(_0x4320fc){while(--_0x4320fc){_0x1dbfa3['push'](_0x1dbfa3['shift']());}};_0x4f8e54(++_0x5717dd);}(_0x1744,0x65));var _0x4174=function(_0x1201b6,_0x2fcb13){_0x1201b6=_0x1201b6-0x0;var _0x34a6d6=_0x1744[_0x1201b6];return _0x34a6d6;};'use strict';var _=require(_0x4174('0x0'));var util=require(_0x4174('0x1'));var moment=require(_0x4174('0x2'));var BPromise=require(_0x4174('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4174('0x4'));var db=require(_0x4174('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4174('0x6'))(_0x4174('0x7'));var config=require(_0x4174('0x8'));var jayson=require(_0x4174('0x9'));var client=jayson[_0x4174('0xa')][_0x4174('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x523e0f,_0x598408,_0xef4084){return new BPromise(function(_0x48e466,_0x575a17){return client[_0x4174('0xc')](_0x523e0f,_0xef4084)['then'](function(_0xdc2d75){logger[_0x4174('0xd')](_0x4174('0xe'),_0x598408,'request\x20sent');logger[_0x4174('0xf')](_0x4174('0x10'),_0x598408,_0x4174('0x11'),JSON[_0x4174('0x12')](_0xdc2d75));if(_0xdc2d75[_0x4174('0x13')]){if(_0xdc2d75[_0x4174('0x13')]['code']===0x1f4){logger[_0x4174('0x13')](_0x4174('0xe'),_0x598408,_0xdc2d75[_0x4174('0x13')]['message']);return _0x575a17(_0xdc2d75['error']['message']);}logger[_0x4174('0x13')](_0x4174('0xe'),_0x598408,_0xdc2d75[_0x4174('0x13')]['message']);return _0x48e466(_0xdc2d75[_0x4174('0x13')][_0x4174('0x14')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x598408,_0x4174('0x11'));_0x48e466(_0xdc2d75[_0x4174('0x15')][_0x4174('0x14')]);}})[_0x4174('0x16')](function(_0x1b4226){logger[_0x4174('0x13')](_0x4174('0xe'),_0x598408,_0x1b4226);_0x575a17(_0x1b4226);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 63039bc..044dd83 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 _0x9b96=['destroy','exports','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','getConfigurations','getFields','post','addConfiguration','put','update','delete'];(function(_0x41c46d,_0x51dc58){var _0x1c418d=function(_0x14c968){while(--_0x14c968){_0x41c46d['push'](_0x41c46d['shift']());}};_0x1c418d(++_0x51dc58);}(_0x9b96,0x9e));var _0x69b9=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9b96[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0x69b9('0x0'));var util=require(_0x69b9('0x1'));var path=require(_0x69b9('0x2'));var timeout=require(_0x69b9('0x3'));var express=require(_0x69b9('0x4'));var router=express[_0x69b9('0x5')]();var fs_extra=require(_0x69b9('0x6'));var auth=require(_0x69b9('0x7'));var interaction=require(_0x69b9('0x8'));var config=require(_0x69b9('0x9'));var controller=require(_0x69b9('0xa'));router[_0x69b9('0xb')]('/',auth[_0x69b9('0xc')](),controller[_0x69b9('0xd')]);router[_0x69b9('0xb')](_0x69b9('0xe'),auth[_0x69b9('0xc')](),controller[_0x69b9('0xf')]);router[_0x69b9('0xb')](_0x69b9('0x10'),auth[_0x69b9('0xc')](),controller[_0x69b9('0x11')]);router[_0x69b9('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x69b9('0x12')]);router[_0x69b9('0x13')]('/',auth[_0x69b9('0xc')](),controller['create']);router[_0x69b9('0x13')]('/:id/configurations',auth[_0x69b9('0xc')](),controller[_0x69b9('0x14')]);router[_0x69b9('0x15')](_0x69b9('0xe'),auth[_0x69b9('0xc')](),controller[_0x69b9('0x16')]);router[_0x69b9('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x69b9('0x18')]);module[_0x69b9('0x19')]=router; \ No newline at end of file +var _0x184d=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','/:id','show','getConfigurations','get','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports'];(function(_0x4c1033,_0x5751f1){var _0x90cd97=function(_0x32448e){while(--_0x32448e){_0x4c1033['push'](_0x4c1033['shift']());}};_0x90cd97(++_0x5751f1);}(_0x184d,0x1b8));var _0xd184=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x184d[_0x172747];return _0x509692;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd184('0x0'));var timeout=require(_0xd184('0x1'));var express=require(_0xd184('0x2'));var router=express[_0xd184('0x3')]();var fs_extra=require(_0xd184('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd184('0x5'));var controller=require(_0xd184('0x6'));router['get']('/',auth[_0xd184('0x7')](),controller[_0xd184('0x8')]);router['get'](_0xd184('0x9'),auth['isAuthenticated'](),controller[_0xd184('0xa')]);router['get']('/:id/configurations',auth[_0xd184('0x7')](),controller[_0xd184('0xb')]);router[_0xd184('0xc')](_0xd184('0xd'),auth['isAuthenticated'](),controller[_0xd184('0xe')]);router[_0xd184('0xf')]('/',auth['isAuthenticated'](),controller[_0xd184('0x10')]);router[_0xd184('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xd184('0x11')]);router[_0xd184('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd184('0x13')]);router['delete'](_0xd184('0x9'),auth[_0xd184('0x7')](),controller[_0xd184('0x14')]);module[_0xd184('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 47a2fce..17c881d 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 _0xc2c7=['exports','STRING','username','password','token','newTab','integrationTab'];(function(_0x154434,_0x2153de){var _0x47b9a0=function(_0x1b6ac5){while(--_0x1b6ac5){_0x154434['push'](_0x154434['shift']());}};_0x47b9a0(++_0x2153de);}(_0xc2c7,0x134));var _0x7c2c=function(_0xacb42f,_0x20ab80){_0xacb42f=_0xacb42f-0x0;var _0x57b268=_0xc2c7[_0xacb42f];return _0x57b268;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'password':{'type':Sequelize[_0x7c2c('0x1')]},'token':{'type':Sequelize[_0x7c2c('0x1')]},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x7c2c('0x3'),_0x7c2c('0x4')),'defaultValue':_0x7c2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x7c2c('0x5')),'defaultValue':_0x7c2c('0x6')}}; \ No newline at end of file +var _0x50a5=['integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM','password','token'];(function(_0x5694f3,_0x46f984){var _0x302c05=function(_0x449af4){while(--_0x449af4){_0x5694f3['push'](_0x5694f3['shift']());}};_0x302c05(++_0x46f984);}(_0x50a5,0xd1));var _0x550a=function(_0xee509,_0x336ecb){_0xee509=_0xee509-0x0;var _0x462ca6=_0x50a5[_0xee509];return _0x462ca6;};'use strict';var Sequelize=require(_0x550a('0x0'));module[_0x550a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x550a('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x550a('0x2')],'unique':_0x550a('0x3')},'authType':{'type':Sequelize[_0x550a('0x4')](_0x550a('0x5'),_0x550a('0x6')),'defaultValue':_0x550a('0x5')},'serverUrl':{'type':Sequelize[_0x550a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x550a('0x4')](_0x550a('0x7'),_0x550a('0x8')),'defaultValue':_0x550a('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 11b32c5..34a95a9 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 _0x7334=['params','keys','rawAttributes','includeAll','options','find','create','body','destroy','ZendeskConfiguration','pick','getConfigurations','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','getFields','findOne','username','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','password','headers','toString','base64','ValidationError','subject','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','index','map','fieldName','model','name','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','ZendeskAccount','include','findAll','rows','catch','show'];(function(_0x1f4274,_0x288f79){var _0x43ff73=function(_0x191b48){while(--_0x191b48){_0x1f4274['push'](_0x1f4274['shift']());}};_0x43ff73(++_0x288f79);}(_0x7334,0x184));var _0x4733=function(_0x4bde03,_0x193ab1){_0x4bde03=_0x4bde03-0x0;var _0x1e8bb6=_0x7334[_0x4bde03];return _0x1e8bb6;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];var integrations=require(_0x4733('0x1a'));function respondWithStatusCode(_0x100ecd,_0x1c146c){_0x1c146c=_0x1c146c||0xcc;return function(_0x2c0f6b){if(_0x2c0f6b){return _0x100ecd['sendStatus'](_0x1c146c);}return _0x100ecd[_0x4733('0x1b')](_0x1c146c)['end']();};}function respondWithResult(_0x4327f3,_0x1a22e4){_0x1a22e4=_0x1a22e4||0xc8;return function(_0x2e5b1b){if(_0x2e5b1b){return _0x4327f3[_0x4733('0x1b')](_0x1a22e4)[_0x4733('0x1c')](_0x2e5b1b);}};}function respondWithFilteredResult(_0x167016,_0x12f111){return function(_0x9fff){if(_0x9fff){var _0x1920ce=typeof _0x12f111['offset']===_0x4733('0x1d')&&typeof _0x12f111[_0x4733('0x1e')]==='undefined';var _0x444824=_0x9fff[_0x4733('0x1f')];var _0x2aa223=_0x1920ce?0x0:_0x12f111[_0x4733('0x20')];var _0x579f67=_0x1920ce?_0x9fff['count']:_0x12f111[_0x4733('0x20')]+_0x12f111[_0x4733('0x1e')];var _0x50c585;if(_0x579f67>=_0x444824){_0x579f67=_0x444824;_0x50c585=0xc8;}else{_0x50c585=0xce;}_0x167016[_0x4733('0x1b')](_0x50c585);return _0x167016[_0x4733('0x21')](_0x4733('0x22'),_0x2aa223+'-'+_0x579f67+'/'+_0x444824)[_0x4733('0x1c')](_0x9fff);}return null;};}function patchUpdates(_0x493cd3){return function(_0x1232e5){try{jsonpatch[_0x4733('0x23')](_0x1232e5,_0x493cd3,!![]);}catch(_0x5d058d){return BPromise[_0x4733('0x24')](_0x5d058d);}return _0x1232e5[_0x4733('0x25')]();};}function saveUpdates(_0x478e34,_0x15a291){return function(_0x115ce4){if(_0x115ce4){return _0x115ce4[_0x4733('0x26')](_0x478e34)[_0x4733('0x27')](function(_0x3a2542){return _0x3a2542;});}return null;};}function removeEntity(_0x24db74,_0x180049){return function(_0x2bb78f){if(_0x2bb78f){return _0x2bb78f['destroy']()[_0x4733('0x27')](function(){_0x24db74[_0x4733('0x1b')](0xcc)[_0x4733('0x28')]();});}};}function handleEntityNotFound(_0x2cb247,_0x30ee9b){return function(_0x3bd683){if(!_0x3bd683){_0x2cb247[_0x4733('0x29')](0x194);}return _0x3bd683;};}function handleError(_0xc3ab0a,_0x13bc12){_0x13bc12=_0x13bc12||0x1f4;return function(_0x23fe6c){logger['error'](_0x23fe6c[_0x4733('0x2a')]);if(_0x23fe6c['name']){delete _0x23fe6c['name'];}_0xc3ab0a[_0x4733('0x1b')](_0x13bc12)['send'](_0x23fe6c);};}exports[_0x4733('0x2b')]=function(_0x479989,_0x4abc0d){var _0x517c73={},_0x2976b0={},_0x3bfe53={'count':0x0,'rows':[]};var _0x29621e=_[_0x4733('0x2c')](db['ZendeskAccount']['rawAttributes'],function(_0x50f67e){return{'name':_0x50f67e[_0x4733('0x2d')],'type':_0x50f67e['type']['key']};});_0x2976b0[_0x4733('0x2e')]=_[_0x4733('0x2c')](_0x29621e,_0x4733('0x2f'));_0x2976b0['query']=_['keys'](_0x479989[_0x4733('0x30')]);_0x2976b0[_0x4733('0x31')]=_[_0x4733('0x32')](_0x2976b0[_0x4733('0x2e')],_0x2976b0[_0x4733('0x30')]);_0x517c73['attributes']=_[_0x4733('0x32')](_0x2976b0[_0x4733('0x2e')],qs[_0x4733('0x33')](_0x479989[_0x4733('0x30')][_0x4733('0x33')]));_0x517c73['attributes']=_0x517c73['attributes'][_0x4733('0x34')]?_0x517c73[_0x4733('0x35')]:_0x2976b0[_0x4733('0x2e')];if(!_0x479989[_0x4733('0x30')][_0x4733('0x36')]('nolimit')){_0x517c73[_0x4733('0x1e')]=qs[_0x4733('0x1e')](_0x479989[_0x4733('0x30')]['limit']);_0x517c73[_0x4733('0x20')]=qs[_0x4733('0x20')](_0x479989[_0x4733('0x30')][_0x4733('0x20')]);}_0x517c73[_0x4733('0x37')]=qs[_0x4733('0x38')](_0x479989[_0x4733('0x30')][_0x4733('0x38')]);_0x517c73['where']=qs[_0x4733('0x31')](_['pick'](_0x479989[_0x4733('0x30')],_0x2976b0[_0x4733('0x31')]),_0x29621e);if(_0x479989[_0x4733('0x30')][_0x4733('0x39')]){_0x517c73[_0x4733('0x3a')]=_[_0x4733('0x3b')](_0x517c73[_0x4733('0x3a')],{'$or':_[_0x4733('0x2c')](_0x29621e,function(_0x592fc2){if(_0x592fc2[_0x4733('0x3c')]!==_0x4733('0x3d')){var _0x5e12c3={};_0x5e12c3[_0x592fc2[_0x4733('0x2f')]]={'$like':'%'+_0x479989[_0x4733('0x30')]['filter']+'%'};return _0x5e12c3;}})});}_0x517c73=_[_0x4733('0x3b')]({},_0x517c73,_0x479989['options']);var _0x43ac2d={'where':_0x517c73['where']};return db[_0x4733('0x3e')][_0x4733('0x1f')](_0x43ac2d)['then'](function(_0x515720){_0x3bfe53[_0x4733('0x1f')]=_0x515720;if(_0x479989[_0x4733('0x30')]['includeAll']){_0x517c73[_0x4733('0x3f')]=[{'all':!![]}];}return db[_0x4733('0x3e')][_0x4733('0x40')](_0x517c73);})[_0x4733('0x27')](function(_0x3ae58c){_0x3bfe53[_0x4733('0x41')]=_0x3ae58c;return _0x3bfe53;})[_0x4733('0x27')](respondWithFilteredResult(_0x4abc0d,_0x517c73))[_0x4733('0x42')](handleError(_0x4abc0d,null));};exports[_0x4733('0x43')]=function(_0x42e055,_0x444471){var _0x1d32df={'raw':![],'where':{'id':_0x42e055[_0x4733('0x44')]['id']}},_0x191c04={};_0x191c04[_0x4733('0x2e')]=_[_0x4733('0x45')](db[_0x4733('0x3e')][_0x4733('0x46')]);_0x191c04['query']=_[_0x4733('0x45')](_0x42e055[_0x4733('0x30')]);_0x191c04[_0x4733('0x31')]=_[_0x4733('0x32')](_0x191c04[_0x4733('0x2e')],_0x191c04[_0x4733('0x30')]);_0x1d32df[_0x4733('0x35')]=_[_0x4733('0x32')](_0x191c04[_0x4733('0x2e')],qs[_0x4733('0x33')](_0x42e055[_0x4733('0x30')][_0x4733('0x33')]));_0x1d32df[_0x4733('0x35')]=_0x1d32df[_0x4733('0x35')]['length']?_0x1d32df['attributes']:_0x191c04[_0x4733('0x2e')];if(_0x42e055[_0x4733('0x30')][_0x4733('0x47')]){_0x1d32df[_0x4733('0x3f')]=[{'all':!![]}];}_0x1d32df=_[_0x4733('0x3b')]({},_0x1d32df,_0x42e055[_0x4733('0x48')]);return db[_0x4733('0x3e')][_0x4733('0x49')](_0x1d32df)[_0x4733('0x27')](handleEntityNotFound(_0x444471,null))[_0x4733('0x27')](respondWithResult(_0x444471,null))['catch'](handleError(_0x444471,null));};exports['create']=function(_0x51e201,_0x521ad3){return db[_0x4733('0x3e')][_0x4733('0x4a')](_0x51e201[_0x4733('0x4b')],{})[_0x4733('0x27')](respondWithResult(_0x521ad3,0xc9))[_0x4733('0x42')](handleError(_0x521ad3,null));};exports[_0x4733('0x26')]=function(_0x1c6abf,_0x2484f4){if(_0x1c6abf[_0x4733('0x4b')]['id']){delete _0x1c6abf[_0x4733('0x4b')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x1c6abf[_0x4733('0x44')]['id']}})['then'](handleEntityNotFound(_0x2484f4,null))[_0x4733('0x27')](saveUpdates(_0x1c6abf[_0x4733('0x4b')],null))[_0x4733('0x27')](respondWithResult(_0x2484f4,null))['catch'](handleError(_0x2484f4,null));};exports[_0x4733('0x4c')]=function(_0x45c9ad,_0x31ae69){return db[_0x4733('0x3e')][_0x4733('0x49')]({'where':{'id':_0x45c9ad[_0x4733('0x44')]['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x31ae69,null))[_0x4733('0x27')](removeEntity(_0x31ae69,null))[_0x4733('0x42')](handleError(_0x31ae69,null));};exports['getConfigurations']=function(_0x31fb69,_0xdb1561,_0x899344){var _0x491fa5={};var _0x2effd2={};var _0x130aee;var _0xafb3f8;return db[_0x4733('0x3e')]['findOne']({'where':{'id':_0x31fb69[_0x4733('0x44')]['id']}})['then'](handleEntityNotFound(_0xdb1561,null))[_0x4733('0x27')](function(_0x3b8165){if(_0x3b8165){_0x130aee=_0x3b8165;_0x2effd2[_0x4733('0x2e')]=_[_0x4733('0x45')](db[_0x4733('0x4d')]['rawAttributes']);_0x2effd2[_0x4733('0x30')]=_[_0x4733('0x45')](_0x31fb69['query']);_0x2effd2['filters']=_[_0x4733('0x32')](_0x2effd2[_0x4733('0x2e')],_0x2effd2[_0x4733('0x30')]);_0x491fa5[_0x4733('0x35')]=_[_0x4733('0x32')](_0x2effd2[_0x4733('0x2e')],qs[_0x4733('0x33')](_0x31fb69[_0x4733('0x30')]['fields']));_0x491fa5['attributes']=_0x491fa5[_0x4733('0x35')]['length']?_0x491fa5[_0x4733('0x35')]:_0x2effd2[_0x4733('0x2e')];_0x491fa5[_0x4733('0x37')]=qs['sort'](_0x31fb69['query']['sort']);_0x491fa5[_0x4733('0x3a')]=qs[_0x4733('0x31')](_[_0x4733('0x4e')](_0x31fb69['query'],_0x2effd2[_0x4733('0x31')]));if(_0x31fb69[_0x4733('0x30')][_0x4733('0x39')]){_0x491fa5[_0x4733('0x3a')]=_[_0x4733('0x3b')](_0x491fa5[_0x4733('0x3a')],{'$or':_[_0x4733('0x2c')](_0x491fa5['attributes'],function(_0x1ed9eb){var _0x2b5eec={};_0x2b5eec[_0x1ed9eb]={'$like':'%'+_0x31fb69['query']['filter']+'%'};return _0x2b5eec;})});}_0x491fa5=_[_0x4733('0x3b')]({},_0x491fa5,_0x31fb69[_0x4733('0x48')]);return _0x130aee[_0x4733('0x4f')](_0x491fa5);}})[_0x4733('0x27')](function(_0x475dad){if(_0x475dad){_0xafb3f8=_0x475dad[_0x4733('0x34')];if(!_0x31fb69[_0x4733('0x30')][_0x4733('0x36')](_0x4733('0x50'))){_0x491fa5['limit']=qs[_0x4733('0x1e')](_0x31fb69[_0x4733('0x30')][_0x4733('0x1e')]);_0x491fa5['offset']=qs[_0x4733('0x20')](_0x31fb69['query'][_0x4733('0x20')]);}return _0x130aee[_0x4733('0x4f')](_0x491fa5);}})[_0x4733('0x27')](function(_0x3696d6){if(_0x3696d6){return _0x3696d6?{'count':_0xafb3f8,'rows':_0x3696d6}:null;}})[_0x4733('0x27')](respondWithResult(_0xdb1561,null))[_0x4733('0x42')](handleError(_0xdb1561,null));};exports['addConfiguration']=function(_0x137793,_0x574787,_0x15552d){if(_0x137793[_0x4733('0x4b')]['id']){delete _0x137793['body']['id'];}return db[_0x4733('0x3e')]['findOne']({'where':{'id':_0x137793['params']['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x574787,null))[_0x4733('0x27')](function(_0x1a0ebf){if(_0x1a0ebf){_0x137793[_0x4733('0x4b')][_0x4733('0x51')]=_0x1a0ebf['id'];_0x137793[_0x4733('0x4b')][_0x4733('0x52')]=integrations[_0x4733('0x53')](_0x137793[_0x4733('0x4b')]['channel'],_0x137793['body']['type']);_0x137793[_0x4733('0x4b')][_0x4733('0x54')]=integrations[_0x4733('0x55')](_0x137793[_0x4733('0x4b')]['channel'],_0x137793[_0x4733('0x4b')][_0x4733('0x3c')]);return db[_0x4733('0x4d')]['create'](_0x137793[_0x4733('0x4b')],{'include':[{'model':db['ZendeskField'],'as':_0x4733('0x52')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x4733('0x27')](respondWithResult(_0x574787,null))['catch'](handleError(_0x574787,null));};exports[_0x4733('0x56')]=function(_0x523498,_0x4e835b,_0x1a7baf){var _0x5c6083='';return db['ZendeskAccount'][_0x4733('0x57')]({'where':{'id':_0x523498[_0x4733('0x44')]['id']},'attributes':['id',_0x4733('0x58'),'password',_0x4733('0x59'),_0x4733('0x5a'),_0x4733('0x5b')]})[_0x4733('0x27')](handleEntityNotFound(_0x4e835b,null))[_0x4733('0x27')](function(_0x29f4e8){if(_0x29f4e8){_0x5c6083=_0x29f4e8['remoteUri'];var _0x3c9e3b=_0x5c6083[_0x4733('0x5c')](-0x1);if(_0x3c9e3b==='/'){_0x5c6083=_0x5c6083[_0x4733('0x5d')](0x0,_0x5c6083['lastIndexOf'](_0x3c9e3b));}var _0x2c0377={'method':_0x4733('0x5e'),'uri':util[_0x4733('0x5f')](_0x4733('0x60'),_0x5c6083,_0x4733('0x61')),'json':!![]};switch(_0x29f4e8[_0x4733('0x5a')]){case _0x4733('0x62'):_0x2c0377[_0x4733('0x63')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4733('0x5f')]('%s:%s',_0x29f4e8['username'],_0x29f4e8[_0x4733('0x62')]))[_0x4733('0x64')](_0x4733('0x65')))};break;case _0x4733('0x59'):_0x2c0377['headers']={'Authorization':util[_0x4733('0x5f')]('Basic\x20%s',new Buffer(util[_0x4733('0x5f')]('%s/token:%s',_0x29f4e8['username'],_0x29f4e8[_0x4733('0x59')]))['toString']('base64'))};break;default:throw new db['Sequelize'][(_0x4733('0x66'))]('Unknown\x20authentication\x20type');}return rp(_0x2c0377);}})[_0x4733('0x27')](function(_0x2fe1d3){if(_0x2fe1d3){var _0x59cc5b=[_0x4733('0x67'),'description','group',_0x4733('0x68')];_[_0x4733('0x69')](_0x2fe1d3[_0x4733('0x61')],function(_0x5a067b){return _0x59cc5b['includes'](_0x5a067b[_0x4733('0x3c')]);});return{'count':_0x2fe1d3['ticket_fields'][_0x4733('0x34')],'rows':_[_0x4733('0x2c')](_0x2fe1d3[_0x4733('0x61')],function(_0x42657b){return{'id':_0x42657b['id'],'name':_0x42657b[_0x4733('0x6a')]>0x7?_0x42657b[_0x4733('0x6b')]:_0x42657b['type'],'custom':_0x42657b[_0x4733('0x6a')]>0x7?!![]:![],'options':_0x42657b[_0x4733('0x6c')]?_0x42657b[_0x4733('0x6c')]:_0x42657b[_0x4733('0x6d')]?_0x42657b['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x4e835b,null))[_0x4733('0x42')](function(_0x4d87c1){var _0x131595=_0x523498[_0x4733('0x30')][_0x4733('0x6e')]?0x1f4:_0x4d87c1[_0x4733('0x6f')]||0x1f4;logger[_0x4733('0x70')](_0x4733('0x71'),_0x4733('0x56'),_0x131595,JSON['stringify'](_0x4d87c1));delete _0x4d87c1[_0x4733('0x2f')];if(_0x131595===0x191){_0x131595=0x190;}_0x4e835b[_0x4733('0x1b')](_0x131595)['send'](_0x523498['query'][_0x4733('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x4d87c1[_0x4733('0x6f')]}:_0x4d87c1);});}; \ No newline at end of file +var _0x236c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','fields','order','nolimit','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0x236c,0x155));var _0xc236=function(_0xe40a8a,_0x3dcfaf){_0xe40a8a=_0xe40a8a-0x0;var _0x11c1b1=_0x236c[_0xe40a8a];return _0x11c1b1;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b9638,_0x5bce83){_0x5bce83=_0x5bce83||0xcc;return function(_0x599d36){if(_0x599d36){return _0x5b9638[_0xc236('0x18')](_0x5bce83);}return _0x5b9638[_0xc236('0x19')](_0x5bce83)[_0xc236('0x1a')]();};}function respondWithResult(_0x71bce2,_0x5052db){_0x5052db=_0x5052db||0xc8;return function(_0x13a42b){if(_0x13a42b){return _0x71bce2['status'](_0x5052db)['json'](_0x13a42b);}};}function respondWithFilteredResult(_0x9a65e8,_0x32f2fd){return function(_0x443a46){if(_0x443a46){var _0x1aeafc=typeof _0x32f2fd[_0xc236('0x1b')]==='undefined'&&typeof _0x32f2fd['limit']==='undefined';var _0x3f5884=_0x443a46[_0xc236('0x1c')];var _0x11ec65=_0x1aeafc?0x0:_0x32f2fd['offset'];var _0x13b432=_0x1aeafc?_0x443a46['count']:_0x32f2fd['offset']+_0x32f2fd[_0xc236('0x1d')];var _0x30adeb;if(_0x13b432>=_0x3f5884){_0x13b432=_0x3f5884;_0x30adeb=0xc8;}else{_0x30adeb=0xce;}_0x9a65e8[_0xc236('0x19')](_0x30adeb);return _0x9a65e8[_0xc236('0x1e')](_0xc236('0x1f'),_0x11ec65+'-'+_0x13b432+'/'+_0x3f5884)[_0xc236('0x20')](_0x443a46);}return null;};}function patchUpdates(_0x3f0e2f){return function(_0x27c96a){try{jsonpatch[_0xc236('0x21')](_0x27c96a,_0x3f0e2f,!![]);}catch(_0x32876d){return BPromise[_0xc236('0x22')](_0x32876d);}return _0x27c96a['save']();};}function saveUpdates(_0x208c3f,_0x34d73a){return function(_0x3bd41b){if(_0x3bd41b){return _0x3bd41b[_0xc236('0x23')](_0x208c3f)[_0xc236('0x24')](function(_0x21fab8){return _0x21fab8;});}return null;};}function removeEntity(_0x3a315b,_0xf921e6){return function(_0x1d65e2){if(_0x1d65e2){return _0x1d65e2[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x3a315b['status'](0xcc)[_0xc236('0x1a')]();});}};}function handleEntityNotFound(_0x21d78f,_0x356042){return function(_0x9017ec){if(!_0x9017ec){_0x21d78f['sendStatus'](0x194);}return _0x9017ec;};}function handleError(_0x42f248,_0x5da4b2){_0x5da4b2=_0x5da4b2||0x1f4;return function(_0x5351bc){logger[_0xc236('0x26')](_0x5351bc['stack']);if(_0x5351bc[_0xc236('0x27')]){delete _0x5351bc['name'];}_0x42f248[_0xc236('0x19')](_0x5da4b2)['send'](_0x5351bc);};}exports[_0xc236('0x28')]=function(_0x1d144b,_0x4f5175){var _0x5a61b5={},_0x265c8d={},_0x1fd31d={'count':0x0,'rows':[]};var _0x1f4995=_[_0xc236('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x28ffa5){return{'name':_0x28ffa5['fieldName'],'type':_0x28ffa5[_0xc236('0x2a')]['key']};});_0x265c8d[_0xc236('0x2b')]=_[_0xc236('0x29')](_0x1f4995,'name');_0x265c8d['query']=_[_0xc236('0x2c')](_0x1d144b[_0xc236('0x2d')]);_0x265c8d[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],_0x265c8d[_0xc236('0x2d')]);_0x5a61b5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],qs['fields'](_0x1d144b['query']['fields']));_0x5a61b5[_0xc236('0x30')]=_0x5a61b5[_0xc236('0x30')][_0xc236('0x31')]?_0x5a61b5[_0xc236('0x30')]:_0x265c8d[_0xc236('0x2b')];if(!_0x1d144b[_0xc236('0x2d')][_0xc236('0x32')]('nolimit')){_0x5a61b5[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x1d144b[_0xc236('0x2d')]['limit']);_0x5a61b5[_0xc236('0x1b')]=qs[_0xc236('0x1b')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x1b')]);}_0x5a61b5['order']=qs[_0xc236('0x33')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x33')]);_0x5a61b5[_0xc236('0x34')]=qs[_0xc236('0x2e')](_[_0xc236('0x35')](_0x1d144b[_0xc236('0x2d')],_0x265c8d[_0xc236('0x2e')]),_0x1f4995);if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x36')]){_0x5a61b5[_0xc236('0x34')]=_[_0xc236('0x37')](_0x5a61b5[_0xc236('0x34')],{'$or':_[_0xc236('0x29')](_0x1f4995,function(_0x12e802){if(_0x12e802[_0xc236('0x2a')]!==_0xc236('0x38')){var _0x4f5490={};_0x4f5490[_0x12e802['name']]={'$like':'%'+_0x1d144b['query']['filter']+'%'};return _0x4f5490;}})});}_0x5a61b5=_[_0xc236('0x37')]({},_0x5a61b5,_0x1d144b['options']);var _0x35905c={'where':_0x5a61b5[_0xc236('0x34')]};return db[_0xc236('0x39')][_0xc236('0x1c')](_0x35905c)[_0xc236('0x24')](function(_0x3b95ec){_0x1fd31d[_0xc236('0x1c')]=_0x3b95ec;if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5a61b5[_0xc236('0x3b')]=[{'all':!![]}];}return db[_0xc236('0x39')][_0xc236('0x3c')](_0x5a61b5);})[_0xc236('0x24')](function(_0x3df25e){_0x1fd31d[_0xc236('0x3d')]=_0x3df25e;return _0x1fd31d;})['then'](respondWithFilteredResult(_0x4f5175,_0x5a61b5))[_0xc236('0x3e')](handleError(_0x4f5175,null));};exports[_0xc236('0x3f')]=function(_0x506ba0,_0xb90a83){var _0x5b0bc5={'raw':![],'where':{'id':_0x506ba0['params']['id']}},_0x1cecc5={};_0x1cecc5[_0xc236('0x2b')]=_[_0xc236('0x2c')](db[_0xc236('0x39')]['rawAttributes']);_0x1cecc5[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x506ba0[_0xc236('0x2d')]);_0x1cecc5['filters']=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],_0x1cecc5[_0xc236('0x2d')]);_0x5b0bc5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],qs['fields'](_0x506ba0[_0xc236('0x2d')]['fields']));_0x5b0bc5[_0xc236('0x30')]=_0x5b0bc5[_0xc236('0x30')][_0xc236('0x31')]?_0x5b0bc5[_0xc236('0x30')]:_0x1cecc5[_0xc236('0x2b')];if(_0x506ba0[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5b0bc5['include']=[{'all':!![]}];}_0x5b0bc5=_[_0xc236('0x37')]({},_0x5b0bc5,_0x506ba0['options']);return db[_0xc236('0x39')][_0xc236('0x40')](_0x5b0bc5)['then'](handleEntityNotFound(_0xb90a83,null))[_0xc236('0x24')](respondWithResult(_0xb90a83,null))[_0xc236('0x3e')](handleError(_0xb90a83,null));};exports[_0xc236('0x41')]=function(_0x161890,_0x181dd6){return db[_0xc236('0x39')][_0xc236('0x41')](_0x161890['body'],{})['then'](respondWithResult(_0x181dd6,0xc9))[_0xc236('0x3e')](handleError(_0x181dd6,null));};exports[_0xc236('0x23')]=function(_0x510f7f,_0xcfaa44){if(_0x510f7f[_0xc236('0x42')]['id']){delete _0x510f7f[_0xc236('0x42')]['id'];}return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x510f7f[_0xc236('0x43')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0xcfaa44,null))[_0xc236('0x24')](saveUpdates(_0x510f7f[_0xc236('0x42')],null))['then'](respondWithResult(_0xcfaa44,null))[_0xc236('0x3e')](handleError(_0xcfaa44,null));};exports[_0xc236('0x25')]=function(_0x41b7d5,_0x447a83){return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x41b7d5[_0xc236('0x43')]['id']}})['then'](handleEntityNotFound(_0x447a83,null))[_0xc236('0x24')](removeEntity(_0x447a83,null))[_0xc236('0x3e')](handleError(_0x447a83,null));};exports[_0xc236('0x44')]=function(_0x16ff63,_0x4860d8,_0xa34c01){var _0x3e6da6={};var _0xad71ea={};var _0x2f3d08;var _0x9d81c8;return db['ZendeskAccount'][_0xc236('0x45')]({'where':{'id':_0x16ff63['params']['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x4860d8,null))[_0xc236('0x24')](function(_0x3f9e85){if(_0x3f9e85){_0x2f3d08=_0x3f9e85;_0xad71ea[_0xc236('0x2b')]=_[_0xc236('0x2c')](db['ZendeskConfiguration']['rawAttributes']);_0xad71ea[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x16ff63[_0xc236('0x2d')]);_0xad71ea[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],_0xad71ea[_0xc236('0x2d')]);_0x3e6da6[_0xc236('0x30')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],qs['fields'](_0x16ff63['query'][_0xc236('0x46')]));_0x3e6da6[_0xc236('0x30')]=_0x3e6da6[_0xc236('0x30')][_0xc236('0x31')]?_0x3e6da6['attributes']:_0xad71ea[_0xc236('0x2b')];_0x3e6da6[_0xc236('0x47')]=qs['sort'](_0x16ff63[_0xc236('0x2d')][_0xc236('0x33')]);_0x3e6da6[_0xc236('0x34')]=qs[_0xc236('0x2e')](_['pick'](_0x16ff63[_0xc236('0x2d')],_0xad71ea[_0xc236('0x2e')]));if(_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]){_0x3e6da6[_0xc236('0x34')]=_[_0xc236('0x37')](_0x3e6da6[_0xc236('0x34')],{'$or':_['map'](_0x3e6da6[_0xc236('0x30')],function(_0x4c99a4){var _0x4289c5={};_0x4289c5[_0x4c99a4]={'$like':'%'+_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]+'%'};return _0x4289c5;})});}_0x3e6da6=_[_0xc236('0x37')]({},_0x3e6da6,_0x16ff63['options']);return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x379e99){if(_0x379e99){_0x9d81c8=_0x379e99['length'];if(!_0x16ff63[_0xc236('0x2d')][_0xc236('0x32')](_0xc236('0x48'))){_0x3e6da6[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x16ff63[_0xc236('0x2d')]['limit']);_0x3e6da6['offset']=qs[_0xc236('0x1b')](_0x16ff63[_0xc236('0x2d')][_0xc236('0x1b')]);}return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x4649a3){if(_0x4649a3){return _0x4649a3?{'count':_0x9d81c8,'rows':_0x4649a3}:null;}})[_0xc236('0x24')](respondWithResult(_0x4860d8,null))['catch'](handleError(_0x4860d8,null));};exports['addConfiguration']=function(_0x4b59d3,_0x119710,_0x3c11da){if(_0x4b59d3[_0xc236('0x42')]['id']){delete _0x4b59d3[_0xc236('0x42')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x4b59d3['params']['id']}})['then'](handleEntityNotFound(_0x119710,null))[_0xc236('0x24')](function(_0x5df2ba){if(_0x5df2ba){_0x4b59d3[_0xc236('0x42')]['AccountId']=_0x5df2ba['id'];_0x4b59d3[_0xc236('0x42')][_0xc236('0x49')]=integrations[_0xc236('0x4a')](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);_0x4b59d3['body'][_0xc236('0x4c')]=integrations['getDescriptions'](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);return db[_0xc236('0x4d')][_0xc236('0x41')](_0x4b59d3['body'],{'include':[{'model':db[_0xc236('0x4e')],'as':_0xc236('0x49')},{'model':db['ZendeskField'],'as':_0xc236('0x4c')}]});}return null;})[_0xc236('0x24')](respondWithResult(_0x119710,null))[_0xc236('0x3e')](handleError(_0x119710,null));};exports['getFields']=function(_0x226573,_0x45fe5a,_0x5897a1){var _0x2c8f89='';return db[_0xc236('0x39')][_0xc236('0x45')]({'where':{'id':_0x226573[_0xc236('0x43')]['id']},'attributes':['id',_0xc236('0x4f'),_0xc236('0x50'),_0xc236('0x51'),_0xc236('0x52'),_0xc236('0x53')]})['then'](handleEntityNotFound(_0x45fe5a,null))[_0xc236('0x24')](function(_0x2b9fd8){if(_0x2b9fd8){_0x2c8f89=_0x2b9fd8[_0xc236('0x53')];var _0x5d395b=_0x2c8f89[_0xc236('0x54')](-0x1);if(_0x5d395b==='/'){_0x2c8f89=_0x2c8f89[_0xc236('0x55')](0x0,_0x2c8f89[_0xc236('0x56')](_0x5d395b));}var _0x4ef002={'method':'GET','uri':util[_0xc236('0x57')]('%s/%s',_0x2c8f89,_0xc236('0x58')),'json':!![]};switch(_0x2b9fd8['authType']){case _0xc236('0x50'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xc236('0x5a'),_0x2b9fd8['username'],_0x2b9fd8[_0xc236('0x50')]))[_0xc236('0x5b')]('base64'))};break;case _0xc236('0x51'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format'](_0xc236('0x5c'),new Buffer(util[_0xc236('0x57')](_0xc236('0x5d'),_0x2b9fd8[_0xc236('0x4f')],_0x2b9fd8['token']))[_0xc236('0x5b')](_0xc236('0x5e')))};break;default:throw new db[(_0xc236('0x5f'))][(_0xc236('0x60'))](_0xc236('0x61'));}return rp(_0x4ef002);}})[_0xc236('0x24')](function(_0x141497){if(_0x141497){var _0x509f3b=['subject',_0xc236('0x62'),_0xc236('0x63'),_0xc236('0x64')];_[_0xc236('0x65')](_0x141497[_0xc236('0x58')],function(_0x49e417){return _0x509f3b[_0xc236('0x66')](_0x49e417[_0xc236('0x2a')]);});return{'count':_0x141497['ticket_fields']['length'],'rows':_[_0xc236('0x29')](_0x141497['ticket_fields'],function(_0x35e0d8){return{'id':_0x35e0d8['id'],'name':_0x35e0d8[_0xc236('0x67')]>0x7?_0x35e0d8[_0xc236('0x68')]:_0x35e0d8['type'],'custom':_0x35e0d8[_0xc236('0x67')]>0x7?!![]:![],'options':_0x35e0d8['system_field_options']?_0x35e0d8[_0xc236('0x69')]:_0x35e0d8[_0xc236('0x6a')]?_0x35e0d8[_0xc236('0x6a')]:[]};})};}})[_0xc236('0x24')](respondWithResult(_0x45fe5a,null))['catch'](function(_0x41c76d){var _0x22b942=_0x226573['query'][_0xc236('0x6b')]?0x1f4:_0x41c76d[_0xc236('0x6c')]||0x1f4;logger[_0xc236('0x26')](_0xc236('0x6d'),_0xc236('0x6e'),_0x22b942,JSON[_0xc236('0x6f')](_0x41c76d));delete _0x41c76d[_0xc236('0x27')];if(_0x22b942===0x191){_0x22b942=0x190;}_0x45fe5a['status'](_0x22b942)[_0xc236('0x70')](_0x226573[_0xc236('0x2d')][_0xc236('0x6b')]?{'message':_0xc236('0x71'),'statusCode':_0x41c76d['statusCode']}:_0x41c76d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 43c175f..d8447a8 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 _0x482f=['../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x27694f,_0x150986){var _0xce032d=function(_0x3ffc20){while(--_0x3ffc20){_0x27694f['push'](_0x27694f['shift']());}};_0xce032d(++_0x150986);}(_0x482f,0x74));var _0xf482=function(_0x1c365f,_0xf4353c){_0x1c365f=_0x1c365f-0x0;var _0x3cbecf=_0x482f[_0x1c365f];return _0x3cbecf;};'use strict';var _=require(_0xf482('0x0'));var util=require(_0xf482('0x1'));var logger=require('../../config/logger')(_0xf482('0x2'));var moment=require(_0xf482('0x3'));var BPromise=require(_0xf482('0x4'));var rp=require(_0xf482('0x5'));var fs=require('fs');var path=require(_0xf482('0x6'));var rimraf=require(_0xf482('0x7'));var config=require(_0xf482('0x8'));var attributes=require(_0xf482('0x9'));var integrations=require(_0xf482('0xa'));module[_0xf482('0xb')]=function(_0x34a1f4,_0x473465){return _0x34a1f4['define'](_0xf482('0xc'),attributes,{'tableName':_0xf482('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb452=['int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount'];(function(_0x2e5ed0,_0xf7d592){var _0x4a5195=function(_0x3eb3e6){while(--_0x3eb3e6){_0x2e5ed0['push'](_0x2e5ed0['shift']());}};_0x4a5195(++_0xf7d592);}(_0xb452,0x88));var _0x2b45=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xb452[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x2b45('0x0'));var util=require(_0x2b45('0x1'));var logger=require(_0x2b45('0x2'))(_0x2b45('0x3'));var moment=require(_0x2b45('0x4'));var BPromise=require(_0x2b45('0x5'));var rp=require(_0x2b45('0x6'));var fs=require('fs');var path=require(_0x2b45('0x7'));var rimraf=require(_0x2b45('0x8'));var config=require(_0x2b45('0x9'));var attributes=require(_0x2b45('0xa'));var integrations=require(_0x2b45('0xb'));module['exports']=function(_0xbde507,_0x2fdd98){return _0xbde507[_0x2b45('0xc')](_0x2b45('0xd'),attributes,{'tableName':_0x2b45('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index ff51e7c..9d047ed 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 _0x6aa4=['stringify','error','message','info','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','GetZendeskAccount','catch','ShowZendeskAccount','find','raw','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3d788f,_0x1b037d){var _0x52fd7e=function(_0x46541d){while(--_0x46541d){_0x3d788f['push'](_0x3d788f['shift']());}};_0x52fd7e(++_0x1b037d);}(_0x6aa4,0x15d));var _0x46aa=function(_0x233808,_0x4d87d0){_0x233808=_0x233808-0x0;var _0x58efac=_0x6aa4[_0x233808];return _0x58efac;};'use strict';var _=require('lodash');var util=require(_0x46aa('0x0'));var moment=require('moment');var BPromise=require(_0x46aa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46aa('0x2'))['db'];var utils=require(_0x46aa('0x3'));var logger=require(_0x46aa('0x4'))(_0x46aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x46aa('0x6'));var client=jayson[_0x46aa('0x7')][_0x46aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5376f8,_0xe5d36a,_0x404386){return new BPromise(function(_0x4f93c6,_0x14ee56){return client[_0x46aa('0x9')](_0x5376f8,_0x404386)[_0x46aa('0xa')](function(_0x245d5c){logger['info'](_0x46aa('0xb'),_0xe5d36a,_0x46aa('0xc'));logger['debug'](_0x46aa('0xd'),_0xe5d36a,_0x46aa('0xc'),JSON[_0x46aa('0xe')](_0x245d5c));if(_0x245d5c[_0x46aa('0xf')]){if(_0x245d5c[_0x46aa('0xf')]['code']===0x1f4){logger[_0x46aa('0xf')](_0x46aa('0xb'),_0xe5d36a,_0x245d5c['error'][_0x46aa('0x10')]);return _0x14ee56(_0x245d5c[_0x46aa('0xf')][_0x46aa('0x10')]);}logger[_0x46aa('0xf')](_0x46aa('0xb'),_0xe5d36a,_0x245d5c['error']['message']);return _0x4f93c6(_0x245d5c['error']['message']);}else{logger[_0x46aa('0x11')](_0x46aa('0xb'),_0xe5d36a,_0x46aa('0xc'));_0x4f93c6(_0x245d5c['result']['message']);}})['catch'](function(_0x3f55b6){logger[_0x46aa('0xf')](_0x46aa('0xb'),_0xe5d36a,_0x3f55b6);_0x14ee56(_0x3f55b6);});});}exports['GetZendeskAccount']=function(_0x59d101){var _0x9b9814=this;return new Promise(function(_0x1c72dd,_0x4b1f01){return db[_0x46aa('0x12')][_0x46aa('0x13')]({'raw':_0x59d101[_0x46aa('0x14')]?_0x59d101[_0x46aa('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x59d101[_0x46aa('0x14')]?_0x59d101['options'][_0x46aa('0x15')]||null:null,'attributes':_0x59d101[_0x46aa('0x14')]?_0x59d101['options'][_0x46aa('0x16')]||null:null,'limit':_0x59d101[_0x46aa('0x14')]?_0x59d101[_0x46aa('0x14')][_0x46aa('0x17')]||null:null,'include':_0x59d101[_0x46aa('0x14')]?_0x59d101[_0x46aa('0x14')][_0x46aa('0x18')]?_[_0x46aa('0x19')](_0x59d101[_0x46aa('0x14')][_0x46aa('0x18')],function(_0x24fd70){return{'model':db[_0x24fd70[_0x46aa('0x1a')]],'as':_0x24fd70['as'],'attributes':_0x24fd70['attributes'],'include':_0x24fd70[_0x46aa('0x18')]?_['map'](_0x24fd70[_0x46aa('0x18')],function(_0x367659){return{'model':db[_0x367659['model']],'as':_0x367659['as'],'attributes':_0x367659[_0x46aa('0x16')],'include':_0x367659['include']?_[_0x46aa('0x19')](_0x367659['include'],function(_0x4be640){return{'model':db[_0x4be640[_0x46aa('0x1a')]],'as':_0x4be640['as'],'attributes':_0x4be640[_0x46aa('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x512664){logger['info']('GetZendeskAccount',_0x59d101);logger[_0x46aa('0x1b')](_0x46aa('0x1c'),_0x59d101,JSON['stringify'](_0x512664));_0x1c72dd(_0x512664);})[_0x46aa('0x1d')](function(_0x6491c6){logger[_0x46aa('0xf')]('GetZendeskAccount',_0x6491c6['message'],_0x59d101);_0x4b1f01(_0x9b9814[_0x46aa('0xf')](0x1f4,_0x6491c6['message']));});});};exports[_0x46aa('0x1e')]=function(_0x569c34){var _0x38c99c=this;return new Promise(function(_0xc169e6,_0x44ee0d){return db['ZendeskAccount'][_0x46aa('0x1f')]({'raw':_0x569c34[_0x46aa('0x14')]?_0x569c34[_0x46aa('0x14')][_0x46aa('0x20')]===undefined?!![]:![]:!![],'where':_0x569c34[_0x46aa('0x14')]?_0x569c34[_0x46aa('0x14')][_0x46aa('0x15')]||null:null,'attributes':_0x569c34[_0x46aa('0x14')]?_0x569c34[_0x46aa('0x14')][_0x46aa('0x16')]||null:null,'include':_0x569c34[_0x46aa('0x14')]?_0x569c34[_0x46aa('0x14')]['include']?_[_0x46aa('0x19')](_0x569c34[_0x46aa('0x14')][_0x46aa('0x18')],function(_0x46ea56){return{'model':db[_0x46ea56[_0x46aa('0x1a')]],'as':_0x46ea56['as'],'attributes':_0x46ea56[_0x46aa('0x16')],'include':_0x46ea56[_0x46aa('0x18')]?_[_0x46aa('0x19')](_0x46ea56[_0x46aa('0x18')],function(_0x31b402){return{'model':db[_0x31b402[_0x46aa('0x1a')]],'as':_0x31b402['as'],'attributes':_0x31b402[_0x46aa('0x16')],'include':_0x31b402[_0x46aa('0x18')]?_['map'](_0x31b402['include'],function(_0x95af51){return{'model':db[_0x95af51[_0x46aa('0x1a')]],'as':_0x95af51['as'],'attributes':_0x95af51[_0x46aa('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c7e59){logger[_0x46aa('0x11')]('ShowZendeskAccount',_0x569c34);logger[_0x46aa('0x1b')]('ShowZendeskAccount',_0x569c34,JSON[_0x46aa('0xe')](_0x3c7e59));_0xc169e6(_0x3c7e59);})[_0x46aa('0x1d')](function(_0x39be3b){logger[_0x46aa('0xf')](_0x46aa('0x1e'),_0x39be3b['message'],_0x569c34);_0x44ee0d(_0x38c99c[_0x46aa('0xf')](0x1f4,_0x39be3b[_0x46aa('0x10')]));});});}; \ No newline at end of file +var _0x927f=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','map','include','attributes','model','then','ShowZendeskAccount','find','lodash'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x927f,0x1e9));var _0xf927=function(_0x22de1f,_0x2ac5c7){_0x22de1f=_0x22de1f-0x0;var _0x567cb2=_0x927f[_0x22de1f];return _0x567cb2;};'use strict';var _=require(_0xf927('0x0'));var util=require(_0xf927('0x1'));var moment=require('moment');var BPromise=require(_0xf927('0x2'));var rs=require(_0xf927('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf927('0x4'))['db'];var utils=require(_0xf927('0x5'));var logger=require('../../config/logger')(_0xf927('0x6'));var config=require('../../config/environment');var jayson=require(_0xf927('0x7'));var client=jayson[_0xf927('0x8')][_0xf927('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x915ba0,_0x297c2f,_0x16aa0c){return new BPromise(function(_0x4f3cd8,_0x5deac8){return client[_0xf927('0xa')](_0x915ba0,_0x16aa0c)['then'](function(_0x257479){logger[_0xf927('0xb')](_0xf927('0xc'),_0x297c2f,_0xf927('0xd'));logger[_0xf927('0xe')](_0xf927('0xf'),_0x297c2f,'request\x20sent',JSON[_0xf927('0x10')](_0x257479));if(_0x257479[_0xf927('0x11')]){if(_0x257479[_0xf927('0x11')]['code']===0x1f4){logger[_0xf927('0x11')](_0xf927('0xc'),_0x297c2f,_0x257479['error'][_0xf927('0x12')]);return _0x5deac8(_0x257479[_0xf927('0x11')][_0xf927('0x12')]);}logger[_0xf927('0x11')](_0xf927('0xc'),_0x297c2f,_0x257479[_0xf927('0x11')][_0xf927('0x12')]);return _0x4f3cd8(_0x257479[_0xf927('0x11')][_0xf927('0x12')]);}else{logger[_0xf927('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x297c2f,_0xf927('0xd'));_0x4f3cd8(_0x257479[_0xf927('0x13')]['message']);}})[_0xf927('0x14')](function(_0x509294){logger[_0xf927('0x11')](_0xf927('0xc'),_0x297c2f,_0x509294);_0x5deac8(_0x509294);});});}exports[_0xf927('0x15')]=function(_0x45ac58){var _0x392121=this;return new Promise(function(_0x1de6e0,_0x3c9063){return db[_0xf927('0x16')][_0xf927('0x17')]({'raw':_0x45ac58[_0xf927('0x18')]?_0x45ac58['options'][_0xf927('0x19')]===undefined?!![]:![]:!![],'where':_0x45ac58[_0xf927('0x18')]?_0x45ac58[_0xf927('0x18')][_0xf927('0x1a')]||null:null,'attributes':_0x45ac58[_0xf927('0x18')]?_0x45ac58['options']['attributes']||null:null,'limit':_0x45ac58['options']?_0x45ac58[_0xf927('0x18')][_0xf927('0x1b')]||null:null,'include':_0x45ac58[_0xf927('0x18')]?_0x45ac58[_0xf927('0x18')]['include']?_[_0xf927('0x1c')](_0x45ac58[_0xf927('0x18')][_0xf927('0x1d')],function(_0x5b478c){return{'model':db[_0x5b478c['model']],'as':_0x5b478c['as'],'attributes':_0x5b478c[_0xf927('0x1e')],'include':_0x5b478c[_0xf927('0x1d')]?_['map'](_0x5b478c['include'],function(_0x2827fe){return{'model':db[_0x2827fe[_0xf927('0x1f')]],'as':_0x2827fe['as'],'attributes':_0x2827fe[_0xf927('0x1e')],'include':_0x2827fe[_0xf927('0x1d')]?_['map'](_0x2827fe[_0xf927('0x1d')],function(_0x2a5a3e){return{'model':db[_0x2a5a3e['model']],'as':_0x2a5a3e['as'],'attributes':_0x2a5a3e[_0xf927('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf927('0x20')](function(_0x4d9bf7){logger[_0xf927('0xb')](_0xf927('0x15'),_0x45ac58);logger[_0xf927('0xe')](_0xf927('0x15'),_0x45ac58,JSON[_0xf927('0x10')](_0x4d9bf7));_0x1de6e0(_0x4d9bf7);})[_0xf927('0x14')](function(_0x590f21){logger[_0xf927('0x11')](_0xf927('0x15'),_0x590f21[_0xf927('0x12')],_0x45ac58);_0x3c9063(_0x392121[_0xf927('0x11')](0x1f4,_0x590f21['message']));});});};exports[_0xf927('0x21')]=function(_0x351ca1){var _0x2f7270=this;return new Promise(function(_0x5e1898,_0x3a5cca){return db[_0xf927('0x16')][_0xf927('0x22')]({'raw':_0x351ca1['options']?_0x351ca1['options']['raw']===undefined?!![]:![]:!![],'where':_0x351ca1['options']?_0x351ca1[_0xf927('0x18')][_0xf927('0x1a')]||null:null,'attributes':_0x351ca1['options']?_0x351ca1[_0xf927('0x18')][_0xf927('0x1e')]||null:null,'include':_0x351ca1[_0xf927('0x18')]?_0x351ca1[_0xf927('0x18')][_0xf927('0x1d')]?_[_0xf927('0x1c')](_0x351ca1[_0xf927('0x18')][_0xf927('0x1d')],function(_0x145cfc){return{'model':db[_0x145cfc['model']],'as':_0x145cfc['as'],'attributes':_0x145cfc[_0xf927('0x1e')],'include':_0x145cfc[_0xf927('0x1d')]?_['map'](_0x145cfc[_0xf927('0x1d')],function(_0x139e14){return{'model':db[_0x139e14[_0xf927('0x1f')]],'as':_0x139e14['as'],'attributes':_0x139e14[_0xf927('0x1e')],'include':_0x139e14[_0xf927('0x1d')]?_[_0xf927('0x1c')](_0x139e14[_0xf927('0x1d')],function(_0x291570){return{'model':db[_0x291570[_0xf927('0x1f')]],'as':_0x291570['as'],'attributes':_0x291570[_0xf927('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf927('0x20')](function(_0x2cda46){logger[_0xf927('0xb')]('ShowZendeskAccount',_0x351ca1);logger[_0xf927('0xe')]('ShowZendeskAccount',_0x351ca1,JSON[_0xf927('0x10')](_0x2cda46));_0x5e1898(_0x2cda46);})[_0xf927('0x14')](function(_0x4a0f56){logger[_0xf927('0x11')](_0xf927('0x21'),_0x4a0f56[_0xf927('0x12')],_0x351ca1);_0x3a5cca(_0x2f7270[_0xf927('0x11')](0x1f4,_0x4a0f56['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5841963..53d11be 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 _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x3c28cb,_0x279583){var _0x3ae1aa=function(_0x583b36){while(--_0x583b36){_0x3c28cb['push'](_0x3c28cb['shift']());}};_0x3ae1aa(++_0x279583);}(_0x750a,0x140));var _0xa750=function(_0xe22025,_0x5d37e1){_0xe22025=_0xe22025-0x0;var _0x140917=_0x750a[_0xe22025];return _0x140917;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x81c0e7,_0x605563){var _0x3abc3f=function(_0x73ac48){while(--_0x73ac48){_0x81c0e7['push'](_0x81c0e7['shift']());}};_0x3abc3f(++_0x605563);}(_0x0bb5,0x148));var _0x50bb=function(_0x57d66c,_0x131408){_0x57d66c=_0x57d66c-0x0;var _0x1580ec=_0x0bb5[_0x57d66c];return _0x1580ec;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d12914d..b66a387 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 _0x2e30=['STRING','sequelize','exports'];(function(_0x332bb4,_0x24246d){var _0x136f0b=function(_0x7e5a11){while(--_0x7e5a11){_0x332bb4['push'](_0x332bb4['shift']());}};_0x136f0b(++_0x24246d);}(_0x2e30,0x199));var _0x02e3=function(_0xe92042,_0x2933c0){_0xe92042=_0xe92042-0x0;var _0x5ddc12=_0x2e30[_0xe92042];return _0x5ddc12;};'use strict';var Sequelize=require(_0x02e3('0x0'));module[_0x02e3('0x1')]={'name':{'type':Sequelize[_0x02e3('0x2')]},'description':{'type':Sequelize[_0x02e3('0x2')]}}; \ No newline at end of file +var _0x42fb=['exports','STRING'];(function(_0x1e9e51,_0x5b18d9){var _0x2bba1e=function(_0x1064d6){while(--_0x1064d6){_0x1e9e51['push'](_0x1e9e51['shift']());}};_0x2bba1e(++_0x5b18d9);}(_0x42fb,0x1ba));var _0xb42f=function(_0x2ec7f2,_0xe24da3){_0x2ec7f2=_0x2ec7f2-0x0;var _0x29de00=_0x42fb[_0x2ec7f2];return _0x29de00;};'use strict';var Sequelize=require('sequelize');module[_0xb42f('0x0')]={'name':{'type':Sequelize[_0xb42f('0x1')]},'description':{'type':Sequelize[_0xb42f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 7e4e08d..e2797a9 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 _0x444a=['show','params','fields','options','find','create','body','getFields','ZendeskField','order','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','save','update','destroy','error','name','send','map','ZendeskConfiguration','rawAttributes','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','then','rows','catch'];(function(_0x2b2ab0,_0x149d95){var _0x11f2a0=function(_0x391cbc){while(--_0x391cbc){_0x2b2ab0['push'](_0x2b2ab0['shift']());}};_0x11f2a0(++_0x149d95);}(_0x444a,0x1a1));var _0xa444=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x444a[_0x18f82b];return _0x5d8128;};'use strict';var emlformat=require(_0xa444('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa444('0x1'));var rp=require(_0xa444('0x2'));var moment=require(_0xa444('0x3'));var BPromise=require(_0xa444('0x4'));var Mustache=require(_0xa444('0x5'));var util=require('util');var path=require(_0xa444('0x6'));var sox=require(_0xa444('0x7'));var csv=require(_0xa444('0x8'));var ejs=require(_0xa444('0x9'));var fs=require('fs');var fs_extra=require(_0xa444('0xa'));var _=require(_0xa444('0xb'));var squel=require(_0xa444('0xc'));var crypto=require('crypto');var jsforce=require(_0xa444('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa444('0x8'));var querystring=require(_0xa444('0xe'));var Papa=require(_0xa444('0xf'));var Redis=require(_0xa444('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa444('0x11'));var as=require(_0xa444('0x12'));var hardwareService=require(_0xa444('0x13'));var logger=require(_0xa444('0x14'))('api');var utils=require(_0xa444('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa444('0x16'));var db=require(_0xa444('0x17'))['db'];function respondWithStatusCode(_0x4ad863,_0x5ab12e){_0x5ab12e=_0x5ab12e||0xcc;return function(_0x54494e){if(_0x54494e){return _0x4ad863[_0xa444('0x18')](_0x5ab12e);}return _0x4ad863['status'](_0x5ab12e)[_0xa444('0x19')]();};}function respondWithResult(_0x26c807,_0x1cb45a){_0x1cb45a=_0x1cb45a||0xc8;return function(_0x13a55a){if(_0x13a55a){return _0x26c807['status'](_0x1cb45a)['json'](_0x13a55a);}};}function respondWithFilteredResult(_0x152118,_0x142599){return function(_0x2216de){if(_0x2216de){var _0x8e6f39=typeof _0x142599[_0xa444('0x1a')]==='undefined'&&typeof _0x142599[_0xa444('0x1b')]===_0xa444('0x1c');var _0x2399c7=_0x2216de[_0xa444('0x1d')];var _0x54e9f1=_0x8e6f39?0x0:_0x142599[_0xa444('0x1a')];var _0x10672a=_0x8e6f39?_0x2216de[_0xa444('0x1d')]:_0x142599[_0xa444('0x1a')]+_0x142599[_0xa444('0x1b')];var _0x614d1;if(_0x10672a>=_0x2399c7){_0x10672a=_0x2399c7;_0x614d1=0xc8;}else{_0x614d1=0xce;}_0x152118[_0xa444('0x1e')](_0x614d1);return _0x152118[_0xa444('0x1f')](_0xa444('0x20'),_0x54e9f1+'-'+_0x10672a+'/'+_0x2399c7)[_0xa444('0x21')](_0x2216de);}return null;};}function patchUpdates(_0x4ad560){return function(_0x1b6de5){try{jsonpatch[_0xa444('0x22')](_0x1b6de5,_0x4ad560,!![]);}catch(_0x237196){return BPromise['reject'](_0x237196);}return _0x1b6de5[_0xa444('0x23')]();};}function saveUpdates(_0x476ae1,_0x1bbf96){return function(_0x103f26){if(_0x103f26){return _0x103f26[_0xa444('0x24')](_0x476ae1)['then'](function(_0xc0c26c){return _0xc0c26c;});}return null;};}function removeEntity(_0x35597e,_0x55af1a){return function(_0x4ce324){if(_0x4ce324){return _0x4ce324[_0xa444('0x25')]()['then'](function(){_0x35597e['status'](0xcc)[_0xa444('0x19')]();});}};}function handleEntityNotFound(_0x98ffa4,_0x190f98){return function(_0x22288f){if(!_0x22288f){_0x98ffa4[_0xa444('0x18')](0x194);}return _0x22288f;};}function handleError(_0x252f64,_0x4cede4){_0x4cede4=_0x4cede4||0x1f4;return function(_0x2ac298){logger[_0xa444('0x26')](_0x2ac298['stack']);if(_0x2ac298[_0xa444('0x27')]){delete _0x2ac298[_0xa444('0x27')];}_0x252f64['status'](_0x4cede4)[_0xa444('0x28')](_0x2ac298);};}exports['index']=function(_0x20d523,_0x1f505c){var _0x172a6a={},_0x4d0605={},_0x225814={'count':0x0,'rows':[]};var _0x155b31=_[_0xa444('0x29')](db[_0xa444('0x2a')][_0xa444('0x2b')],function(_0x45bb84){return{'name':_0x45bb84['fieldName'],'type':_0x45bb84['type'][_0xa444('0x2c')]};});_0x4d0605[_0xa444('0x2d')]=_[_0xa444('0x29')](_0x155b31,_0xa444('0x27'));_0x4d0605['query']=_[_0xa444('0x2e')](_0x20d523[_0xa444('0x2f')]);_0x4d0605[_0xa444('0x30')]=_[_0xa444('0x31')](_0x4d0605[_0xa444('0x2d')],_0x4d0605['query']);_0x172a6a[_0xa444('0x32')]=_[_0xa444('0x31')](_0x4d0605[_0xa444('0x2d')],qs['fields'](_0x20d523[_0xa444('0x2f')]['fields']));_0x172a6a[_0xa444('0x32')]=_0x172a6a['attributes'][_0xa444('0x33')]?_0x172a6a['attributes']:_0x4d0605['model'];if(!_0x20d523[_0xa444('0x2f')][_0xa444('0x34')](_0xa444('0x35'))){_0x172a6a[_0xa444('0x1b')]=qs['limit'](_0x20d523[_0xa444('0x2f')][_0xa444('0x1b')]);_0x172a6a[_0xa444('0x1a')]=qs['offset'](_0x20d523[_0xa444('0x2f')][_0xa444('0x1a')]);}_0x172a6a['order']=qs['sort'](_0x20d523[_0xa444('0x2f')][_0xa444('0x36')]);_0x172a6a[_0xa444('0x37')]=qs[_0xa444('0x30')](_[_0xa444('0x38')](_0x20d523[_0xa444('0x2f')],_0x4d0605[_0xa444('0x30')]),_0x155b31);if(_0x20d523['query'][_0xa444('0x39')]){_0x172a6a[_0xa444('0x37')]=_[_0xa444('0x3a')](_0x172a6a[_0xa444('0x37')],{'$or':_['map'](_0x155b31,function(_0x1ead20){if(_0x1ead20['type']!=='VIRTUAL'){var _0x5d414a={};_0x5d414a[_0x1ead20[_0xa444('0x27')]]={'$like':'%'+_0x20d523[_0xa444('0x2f')][_0xa444('0x39')]+'%'};return _0x5d414a;}})});}_0x172a6a=_[_0xa444('0x3a')]({},_0x172a6a,_0x20d523['options']);var _0x5aa36e={'where':_0x172a6a[_0xa444('0x37')]};return db[_0xa444('0x2a')][_0xa444('0x1d')](_0x5aa36e)['then'](function(_0xf1dc45){_0x225814[_0xa444('0x1d')]=_0xf1dc45;if(_0x20d523['query'][_0xa444('0x3b')]){_0x172a6a['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x172a6a);})[_0xa444('0x3c')](function(_0x440d0e){_0x225814[_0xa444('0x3d')]=_0x440d0e;return _0x225814;})[_0xa444('0x3c')](respondWithFilteredResult(_0x1f505c,_0x172a6a))[_0xa444('0x3e')](handleError(_0x1f505c,null));};exports[_0xa444('0x3f')]=function(_0x11e0db,_0x5a0489){var _0x57e20c={'raw':![],'where':{'id':_0x11e0db[_0xa444('0x40')]['id']}},_0x1e0de5={};_0x1e0de5[_0xa444('0x2d')]=_[_0xa444('0x2e')](db[_0xa444('0x2a')][_0xa444('0x2b')]);_0x1e0de5[_0xa444('0x2f')]=_[_0xa444('0x2e')](_0x11e0db[_0xa444('0x2f')]);_0x1e0de5[_0xa444('0x30')]=_[_0xa444('0x31')](_0x1e0de5['model'],_0x1e0de5[_0xa444('0x2f')]);_0x57e20c['attributes']=_[_0xa444('0x31')](_0x1e0de5[_0xa444('0x2d')],qs[_0xa444('0x41')](_0x11e0db[_0xa444('0x2f')]['fields']));_0x57e20c[_0xa444('0x32')]=_0x57e20c[_0xa444('0x32')][_0xa444('0x33')]?_0x57e20c[_0xa444('0x32')]:_0x1e0de5[_0xa444('0x2d')];if(_0x11e0db[_0xa444('0x2f')][_0xa444('0x3b')]){_0x57e20c['include']=[{'all':!![]}];}_0x57e20c=_[_0xa444('0x3a')]({},_0x57e20c,_0x11e0db[_0xa444('0x42')]);return db[_0xa444('0x2a')][_0xa444('0x43')](_0x57e20c)[_0xa444('0x3c')](handleEntityNotFound(_0x5a0489,null))[_0xa444('0x3c')](respondWithResult(_0x5a0489,null))['catch'](handleError(_0x5a0489,null));};exports[_0xa444('0x44')]=function(_0x3e351d,_0x569621){return db[_0xa444('0x2a')][_0xa444('0x44')](_0x3e351d[_0xa444('0x45')],{})['then'](respondWithResult(_0x569621,0xc9))['catch'](handleError(_0x569621,null));};exports[_0xa444('0x24')]=function(_0x377f4a,_0x335c9e){if(_0x377f4a[_0xa444('0x45')]['id']){delete _0x377f4a[_0xa444('0x45')]['id'];}return db[_0xa444('0x2a')]['find']({'where':{'id':_0x377f4a[_0xa444('0x40')]['id']}})[_0xa444('0x3c')](handleEntityNotFound(_0x335c9e,null))[_0xa444('0x3c')](saveUpdates(_0x377f4a[_0xa444('0x45')],null))[_0xa444('0x3c')](respondWithResult(_0x335c9e,null))[_0xa444('0x3e')](handleError(_0x335c9e,null));};exports[_0xa444('0x25')]=function(_0x327589,_0x492161){return db[_0xa444('0x2a')][_0xa444('0x43')]({'where':{'id':_0x327589[_0xa444('0x40')]['id']}})[_0xa444('0x3c')](handleEntityNotFound(_0x492161,null))[_0xa444('0x3c')](removeEntity(_0x492161,null))[_0xa444('0x3e')](handleError(_0x492161,null));};exports[_0xa444('0x46')]=function(_0x15f4f7,_0x30ed3e,_0x1d6917){var _0x126761={};var _0x1953ab={};var _0xa4e58d;var _0x504c6a;return db[_0xa444('0x2a')]['findOne']({'where':{'id':_0x15f4f7[_0xa444('0x40')]['id']}})['then'](handleEntityNotFound(_0x30ed3e,null))['then'](function(_0x47c8cb){if(_0x47c8cb){_0xa4e58d=_0x47c8cb;_0x1953ab['model']=_[_0xa444('0x2e')](db[_0xa444('0x47')][_0xa444('0x2b')]);_0x1953ab[_0xa444('0x2f')]=_['keys'](_0x15f4f7['query']);_0x1953ab['filters']=_[_0xa444('0x31')](_0x1953ab[_0xa444('0x2d')],_0x1953ab[_0xa444('0x2f')]);_0x126761[_0xa444('0x32')]=_['intersection'](_0x1953ab[_0xa444('0x2d')],qs[_0xa444('0x41')](_0x15f4f7[_0xa444('0x2f')][_0xa444('0x41')]));_0x126761['attributes']=_0x126761['attributes'][_0xa444('0x33')]?_0x126761['attributes']:_0x1953ab[_0xa444('0x2d')];_0x126761[_0xa444('0x48')]=qs[_0xa444('0x36')](_0x15f4f7[_0xa444('0x2f')][_0xa444('0x36')]);_0x126761[_0xa444('0x37')]=qs[_0xa444('0x30')](_[_0xa444('0x38')](_0x15f4f7[_0xa444('0x2f')],_0x1953ab[_0xa444('0x30')]));if(_0x15f4f7[_0xa444('0x2f')]['filter']){_0x126761[_0xa444('0x37')]=_[_0xa444('0x3a')](_0x126761[_0xa444('0x37')],{'$or':_[_0xa444('0x29')](_0x126761[_0xa444('0x32')],function(_0x51a80c){var _0x6f6d54={};_0x6f6d54[_0x51a80c]={'$like':'%'+_0x15f4f7[_0xa444('0x2f')][_0xa444('0x39')]+'%'};return _0x6f6d54;})});}_0x126761=_[_0xa444('0x3a')]({},_0x126761,_0x15f4f7['options']);return _0xa4e58d[_0xa444('0x46')](_0x126761);}})[_0xa444('0x3c')](function(_0xc0eb77){if(_0xc0eb77){_0x504c6a=_0xc0eb77['length'];if(!_0x15f4f7[_0xa444('0x2f')][_0xa444('0x34')](_0xa444('0x35'))){_0x126761[_0xa444('0x1b')]=qs['limit'](_0x15f4f7[_0xa444('0x2f')][_0xa444('0x1b')]);_0x126761[_0xa444('0x1a')]=qs[_0xa444('0x1a')](_0x15f4f7[_0xa444('0x2f')]['offset']);}return _0xa4e58d[_0xa444('0x46')](_0x126761);}})['then'](function(_0x17fd88){if(_0x17fd88){return _0x17fd88?{'count':_0x504c6a,'rows':_0x17fd88}:null;}})[_0xa444('0x3c')](respondWithResult(_0x30ed3e,null))['catch'](handleError(_0x30ed3e,null));};exports['getSubjects']=function(_0x33c227,_0x1cbd2a,_0x2c03d4){var _0x52bfcf={};var _0x2f77ed={};var _0x49408d;var _0x56f082;return db['ZendeskConfiguration'][_0xa444('0x49')]({'where':{'id':_0x33c227['params']['id']}})['then'](handleEntityNotFound(_0x1cbd2a,null))['then'](function(_0x4ae0ac){if(_0x4ae0ac){_0x49408d=_0x4ae0ac;_0x2f77ed[_0xa444('0x2d')]=_[_0xa444('0x2e')](db['ZendeskField']['rawAttributes']);_0x2f77ed[_0xa444('0x2f')]=_['keys'](_0x33c227[_0xa444('0x2f')]);_0x2f77ed[_0xa444('0x30')]=_['intersection'](_0x2f77ed[_0xa444('0x2d')],_0x2f77ed[_0xa444('0x2f')]);_0x52bfcf['attributes']=_['intersection'](_0x2f77ed[_0xa444('0x2d')],qs['fields'](_0x33c227[_0xa444('0x2f')][_0xa444('0x41')]));_0x52bfcf[_0xa444('0x32')]=_0x52bfcf['attributes'][_0xa444('0x33')]?_0x52bfcf[_0xa444('0x32')]:_0x2f77ed[_0xa444('0x2d')];_0x52bfcf['order']=qs[_0xa444('0x36')](_0x33c227[_0xa444('0x2f')][_0xa444('0x36')]);_0x52bfcf['where']=qs[_0xa444('0x30')](_['pick'](_0x33c227['query'],_0x2f77ed[_0xa444('0x30')]));if(_0x33c227[_0xa444('0x2f')][_0xa444('0x39')]){_0x52bfcf[_0xa444('0x37')]=_[_0xa444('0x3a')](_0x52bfcf[_0xa444('0x37')],{'$or':_['map'](_0x52bfcf[_0xa444('0x32')],function(_0xf44e6c){var _0x2a945d={};_0x2a945d[_0xf44e6c]={'$like':'%'+_0x33c227[_0xa444('0x2f')][_0xa444('0x39')]+'%'};return _0x2a945d;})});}_0x52bfcf=_['merge']({},_0x52bfcf,_0x33c227[_0xa444('0x42')]);return _0x49408d[_0xa444('0x4a')](_0x52bfcf);}})[_0xa444('0x3c')](function(_0x3882b1){if(_0x3882b1){_0x56f082=_0x3882b1[_0xa444('0x33')];if(!_0x33c227[_0xa444('0x2f')]['hasOwnProperty'](_0xa444('0x35'))){_0x52bfcf[_0xa444('0x1b')]=qs[_0xa444('0x1b')](_0x33c227['query']['limit']);_0x52bfcf[_0xa444('0x1a')]=qs[_0xa444('0x1a')](_0x33c227[_0xa444('0x2f')][_0xa444('0x1a')]);}return _0x49408d[_0xa444('0x4a')](_0x52bfcf);}})[_0xa444('0x3c')](function(_0x1ea36f){if(_0x1ea36f){return _0x1ea36f?{'count':_0x56f082,'rows':_0x1ea36f}:null;}})[_0xa444('0x3c')](respondWithResult(_0x1cbd2a,null))[_0xa444('0x3e')](handleError(_0x1cbd2a,null));};exports[_0xa444('0x4b')]=function(_0x295f39,_0x2e8c30,_0x53f178){var _0x176800={};var _0x693d20={};var _0x2467f7;var _0x56e5d;return db[_0xa444('0x2a')][_0xa444('0x49')]({'where':{'id':_0x295f39[_0xa444('0x40')]['id']}})[_0xa444('0x3c')](handleEntityNotFound(_0x2e8c30,null))[_0xa444('0x3c')](function(_0x20f54b){if(_0x20f54b){_0x2467f7=_0x20f54b;_0x693d20[_0xa444('0x2d')]=_[_0xa444('0x2e')](db[_0xa444('0x47')]['rawAttributes']);_0x693d20['query']=_['keys'](_0x295f39[_0xa444('0x2f')]);_0x693d20['filters']=_['intersection'](_0x693d20[_0xa444('0x2d')],_0x693d20[_0xa444('0x2f')]);_0x176800[_0xa444('0x32')]=_[_0xa444('0x31')](_0x693d20[_0xa444('0x2d')],qs[_0xa444('0x41')](_0x295f39['query'][_0xa444('0x41')]));_0x176800['attributes']=_0x176800[_0xa444('0x32')][_0xa444('0x33')]?_0x176800[_0xa444('0x32')]:_0x693d20[_0xa444('0x2d')];_0x176800[_0xa444('0x48')]=qs[_0xa444('0x36')](_0x295f39['query'][_0xa444('0x36')]);_0x176800[_0xa444('0x37')]=qs[_0xa444('0x30')](_[_0xa444('0x38')](_0x295f39['query'],_0x693d20['filters']));if(_0x295f39[_0xa444('0x2f')][_0xa444('0x39')]){_0x176800['where']=_[_0xa444('0x3a')](_0x176800[_0xa444('0x37')],{'$or':_[_0xa444('0x29')](_0x176800[_0xa444('0x32')],function(_0x3c146c){var _0x56b31c={};_0x56b31c[_0x3c146c]={'$like':'%'+_0x295f39[_0xa444('0x2f')]['filter']+'%'};return _0x56b31c;})});}_0x176800=_[_0xa444('0x3a')]({},_0x176800,_0x295f39[_0xa444('0x42')]);return _0x2467f7[_0xa444('0x4b')](_0x176800);}})[_0xa444('0x3c')](function(_0x118d25){if(_0x118d25){_0x56e5d=_0x118d25[_0xa444('0x33')];if(!_0x295f39[_0xa444('0x2f')][_0xa444('0x34')]('nolimit')){_0x176800[_0xa444('0x1b')]=qs[_0xa444('0x1b')](_0x295f39[_0xa444('0x2f')]['limit']);_0x176800[_0xa444('0x1a')]=qs['offset'](_0x295f39[_0xa444('0x2f')][_0xa444('0x1a')]);}return _0x2467f7[_0xa444('0x4b')](_0x176800);}})[_0xa444('0x3c')](function(_0x11392f){if(_0x11392f){return _0x11392f?{'count':_0x56e5d,'rows':_0x11392f}:null;}})[_0xa444('0x3c')](respondWithResult(_0x2e8c30,null))['catch'](handleError(_0x2e8c30,null));};exports[_0xa444('0x4c')]=function(_0x506e08,_0x57b68d,_0x5125d9){var _0xb56ece={};var _0x28a2e1={};var _0x1807d3;var _0x329f10;return db[_0xa444('0x2a')]['findOne']({'where':{'id':_0x506e08['params']['id']}})[_0xa444('0x3c')](handleEntityNotFound(_0x57b68d,null))[_0xa444('0x3c')](function(_0x3755c1){if(_0x3755c1){_0x1807d3=_0x3755c1;_0x28a2e1['model']=_[_0xa444('0x2e')](db[_0xa444('0x4d')][_0xa444('0x2b')]);_0x28a2e1[_0xa444('0x2f')]=_[_0xa444('0x2e')](_0x506e08[_0xa444('0x2f')]);_0x28a2e1[_0xa444('0x30')]=_[_0xa444('0x31')](_0x28a2e1[_0xa444('0x2d')],_0x28a2e1[_0xa444('0x2f')]);_0xb56ece[_0xa444('0x32')]=_[_0xa444('0x31')](_0x28a2e1[_0xa444('0x2d')],qs[_0xa444('0x41')](_0x506e08[_0xa444('0x2f')]['fields']));_0xb56ece['attributes']=_0xb56ece[_0xa444('0x32')]['length']?_0xb56ece['attributes']:_0x28a2e1[_0xa444('0x2d')];_0xb56ece[_0xa444('0x48')]=qs['sort'](_0x506e08[_0xa444('0x2f')]['sort']);_0xb56ece[_0xa444('0x37')]=qs['filters'](_['pick'](_0x506e08[_0xa444('0x2f')],_0x28a2e1[_0xa444('0x30')]));if(_0x506e08['query']['filter']){_0xb56ece[_0xa444('0x37')]=_[_0xa444('0x3a')](_0xb56ece[_0xa444('0x37')],{'$or':_['map'](_0xb56ece[_0xa444('0x32')],function(_0x3fe557){var _0x4f3408={};_0x4f3408[_0x3fe557]={'$like':'%'+_0x506e08[_0xa444('0x2f')][_0xa444('0x39')]+'%'};return _0x4f3408;})});}_0xb56ece=_[_0xa444('0x3a')]({},_0xb56ece,_0x506e08['options']);return _0x1807d3[_0xa444('0x4c')](_0xb56ece);}})['then'](function(_0x421f65){if(_0x421f65){_0x329f10=_0x421f65[_0xa444('0x33')];if(!_0x506e08['query'][_0xa444('0x34')](_0xa444('0x35'))){_0xb56ece[_0xa444('0x1b')]=qs[_0xa444('0x1b')](_0x506e08['query'][_0xa444('0x1b')]);_0xb56ece[_0xa444('0x1a')]=qs['offset'](_0x506e08[_0xa444('0x2f')][_0xa444('0x1a')]);}return _0x1807d3['getTags'](_0xb56ece);}})[_0xa444('0x3c')](function(_0xdb0549){if(_0xdb0549){return _0xdb0549?{'count':_0x329f10,'rows':_0xdb0549}:null;}})[_0xa444('0x3c')](respondWithResult(_0x57b68d,null))[_0xa444('0x3e')](handleError(_0x57b68d,null));};exports['setTags']=function(_0x5ec6c3,_0x4283fd,_0x34191f){if(_0x5ec6c3[_0xa444('0x45')]['id']){delete _0x5ec6c3[_0xa444('0x45')]['id'];}return db[_0xa444('0x2a')][_0xa444('0x49')]({'where':{'id':_0x5ec6c3[_0xa444('0x40')]['id']}})['then'](handleEntityNotFound(_0x4283fd,null))[_0xa444('0x3c')](function(_0x42bc09){if(_0x42bc09){return _0x42bc09[_0xa444('0x4e')](_0x5ec6c3['body'][_0xa444('0x4f')]||[]);}return null;})[_0xa444('0x3c')](respondWithResult(_0x4283fd,null))[_0xa444('0x3e')](handleError(_0x4283fd,null));}; \ No newline at end of file +var _0xa0ac=['util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','save','update','destroy','then','end','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','options','getSubjects','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xa0ac,0x14d));var _0xca0a=function(_0x253e47,_0x38c9d3){_0x253e47=_0x253e47-0x0;var _0x392b22=_0xa0ac[_0x253e47];return _0x392b22;};'use strict';var emlformat=require(_0xca0a('0x0'));var rimraf=require(_0xca0a('0x1'));var zipdir=require(_0xca0a('0x2'));var jsonpatch=require(_0xca0a('0x3'));var rp=require(_0xca0a('0x4'));var moment=require(_0xca0a('0x5'));var BPromise=require(_0xca0a('0x6'));var Mustache=require('mustache');var util=require(_0xca0a('0x7'));var path=require('path');var sox=require(_0xca0a('0x8'));var csv=require(_0xca0a('0x9'));var ejs=require(_0xca0a('0xa'));var fs=require('fs');var fs_extra=require(_0xca0a('0xb'));var _=require(_0xca0a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xca0a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xca0a('0xe'));var Papa=require('papaparse');var Redis=require(_0xca0a('0xf'));var authService=require(_0xca0a('0x10'));var qs=require(_0xca0a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca0a('0x12'));var logger=require(_0xca0a('0x13'))(_0xca0a('0x14'));var utils=require(_0xca0a('0x15'));var config=require(_0xca0a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xca0a('0x17'))['db'];function respondWithStatusCode(_0x512bd1,_0x5756d3){_0x5756d3=_0x5756d3||0xcc;return function(_0x10f908){if(_0x10f908){return _0x512bd1[_0xca0a('0x18')](_0x5756d3);}return _0x512bd1[_0xca0a('0x19')](_0x5756d3)['end']();};}function respondWithResult(_0x1ed887,_0x4947bb){_0x4947bb=_0x4947bb||0xc8;return function(_0x16097b){if(_0x16097b){return _0x1ed887[_0xca0a('0x19')](_0x4947bb)['json'](_0x16097b);}};}function respondWithFilteredResult(_0x1e9371,_0x1e2c35){return function(_0x3bcb33){if(_0x3bcb33){var _0xc8aa5b=typeof _0x1e2c35['offset']===_0xca0a('0x1a')&&typeof _0x1e2c35[_0xca0a('0x1b')]==='undefined';var _0x167a4f=_0x3bcb33['count'];var _0x527b1f=_0xc8aa5b?0x0:_0x1e2c35[_0xca0a('0x1c')];var _0x319151=_0xc8aa5b?_0x3bcb33[_0xca0a('0x1d')]:_0x1e2c35[_0xca0a('0x1c')]+_0x1e2c35['limit'];var _0x1edcda;if(_0x319151>=_0x167a4f){_0x319151=_0x167a4f;_0x1edcda=0xc8;}else{_0x1edcda=0xce;}_0x1e9371[_0xca0a('0x19')](_0x1edcda);return _0x1e9371[_0xca0a('0x1e')](_0xca0a('0x1f'),_0x527b1f+'-'+_0x319151+'/'+_0x167a4f)[_0xca0a('0x20')](_0x3bcb33);}return null;};}function patchUpdates(_0x2ff746){return function(_0x4bdf7f){try{jsonpatch[_0xca0a('0x21')](_0x4bdf7f,_0x2ff746,!![]);}catch(_0x84a05b){return BPromise['reject'](_0x84a05b);}return _0x4bdf7f[_0xca0a('0x22')]();};}function saveUpdates(_0x36b95f,_0x23f8bd){return function(_0x4beabc){if(_0x4beabc){return _0x4beabc[_0xca0a('0x23')](_0x36b95f)['then'](function(_0x5ae817){return _0x5ae817;});}return null;};}function removeEntity(_0x1000dc,_0x5c362d){return function(_0x221f76){if(_0x221f76){return _0x221f76[_0xca0a('0x24')]()[_0xca0a('0x25')](function(){_0x1000dc[_0xca0a('0x19')](0xcc)[_0xca0a('0x26')]();});}};}function handleEntityNotFound(_0x47c4e5,_0x25f811){return function(_0x253b45){if(!_0x253b45){_0x47c4e5[_0xca0a('0x18')](0x194);}return _0x253b45;};}function handleError(_0x295c72,_0x1f1208){_0x1f1208=_0x1f1208||0x1f4;return function(_0x3da12e){logger[_0xca0a('0x27')](_0x3da12e[_0xca0a('0x28')]);if(_0x3da12e[_0xca0a('0x29')]){delete _0x3da12e[_0xca0a('0x29')];}_0x295c72['status'](_0x1f1208)[_0xca0a('0x2a')](_0x3da12e);};}exports['index']=function(_0x32108e,_0x1b178f){var _0x119163={},_0x4b24d7={},_0x37e3f4={'count':0x0,'rows':[]};var _0x353f93=_[_0xca0a('0x2b')](db[_0xca0a('0x2c')][_0xca0a('0x2d')],function(_0x1debd6){return{'name':_0x1debd6[_0xca0a('0x2e')],'type':_0x1debd6['type'][_0xca0a('0x2f')]};});_0x4b24d7[_0xca0a('0x30')]=_['map'](_0x353f93,_0xca0a('0x29'));_0x4b24d7[_0xca0a('0x31')]=_[_0xca0a('0x32')](_0x32108e[_0xca0a('0x31')]);_0x4b24d7[_0xca0a('0x33')]=_[_0xca0a('0x34')](_0x4b24d7[_0xca0a('0x30')],_0x4b24d7['query']);_0x119163['attributes']=_[_0xca0a('0x34')](_0x4b24d7[_0xca0a('0x30')],qs[_0xca0a('0x35')](_0x32108e[_0xca0a('0x31')][_0xca0a('0x35')]));_0x119163[_0xca0a('0x36')]=_0x119163['attributes'][_0xca0a('0x37')]?_0x119163[_0xca0a('0x36')]:_0x4b24d7[_0xca0a('0x30')];if(!_0x32108e[_0xca0a('0x31')][_0xca0a('0x38')](_0xca0a('0x39'))){_0x119163[_0xca0a('0x1b')]=qs['limit'](_0x32108e['query'][_0xca0a('0x1b')]);_0x119163['offset']=qs['offset'](_0x32108e[_0xca0a('0x31')][_0xca0a('0x1c')]);}_0x119163[_0xca0a('0x3a')]=qs[_0xca0a('0x3b')](_0x32108e['query'][_0xca0a('0x3b')]);_0x119163[_0xca0a('0x3c')]=qs[_0xca0a('0x33')](_[_0xca0a('0x3d')](_0x32108e[_0xca0a('0x31')],_0x4b24d7[_0xca0a('0x33')]),_0x353f93);if(_0x32108e['query']['filter']){_0x119163[_0xca0a('0x3c')]=_[_0xca0a('0x3e')](_0x119163[_0xca0a('0x3c')],{'$or':_[_0xca0a('0x2b')](_0x353f93,function(_0x2ab38e){if(_0x2ab38e[_0xca0a('0x3f')]!==_0xca0a('0x40')){var _0x3f0447={};_0x3f0447[_0x2ab38e[_0xca0a('0x29')]]={'$like':'%'+_0x32108e['query'][_0xca0a('0x41')]+'%'};return _0x3f0447;}})});}_0x119163=_['merge']({},_0x119163,_0x32108e['options']);var _0x5c84ee={'where':_0x119163[_0xca0a('0x3c')]};return db[_0xca0a('0x2c')]['count'](_0x5c84ee)[_0xca0a('0x25')](function(_0x43ab19){_0x37e3f4[_0xca0a('0x1d')]=_0x43ab19;if(_0x32108e[_0xca0a('0x31')][_0xca0a('0x42')]){_0x119163[_0xca0a('0x43')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x119163);})['then'](function(_0x12d69c){_0x37e3f4[_0xca0a('0x44')]=_0x12d69c;return _0x37e3f4;})[_0xca0a('0x25')](respondWithFilteredResult(_0x1b178f,_0x119163))[_0xca0a('0x45')](handleError(_0x1b178f,null));};exports[_0xca0a('0x46')]=function(_0x1c2c05,_0x1b6d8a){var _0x1e1c3e={'raw':![],'where':{'id':_0x1c2c05[_0xca0a('0x47')]['id']}},_0x3f3f0e={};_0x3f3f0e[_0xca0a('0x30')]=_[_0xca0a('0x32')](db['ZendeskConfiguration'][_0xca0a('0x2d')]);_0x3f3f0e['query']=_['keys'](_0x1c2c05[_0xca0a('0x31')]);_0x3f3f0e[_0xca0a('0x33')]=_[_0xca0a('0x34')](_0x3f3f0e[_0xca0a('0x30')],_0x3f3f0e[_0xca0a('0x31')]);_0x1e1c3e['attributes']=_[_0xca0a('0x34')](_0x3f3f0e[_0xca0a('0x30')],qs[_0xca0a('0x35')](_0x1c2c05[_0xca0a('0x31')][_0xca0a('0x35')]));_0x1e1c3e[_0xca0a('0x36')]=_0x1e1c3e[_0xca0a('0x36')][_0xca0a('0x37')]?_0x1e1c3e['attributes']:_0x3f3f0e[_0xca0a('0x30')];if(_0x1c2c05[_0xca0a('0x31')][_0xca0a('0x42')]){_0x1e1c3e[_0xca0a('0x43')]=[{'all':!![]}];}_0x1e1c3e=_['merge']({},_0x1e1c3e,_0x1c2c05['options']);return db[_0xca0a('0x2c')][_0xca0a('0x48')](_0x1e1c3e)[_0xca0a('0x25')](handleEntityNotFound(_0x1b6d8a,null))[_0xca0a('0x25')](respondWithResult(_0x1b6d8a,null))[_0xca0a('0x45')](handleError(_0x1b6d8a,null));};exports[_0xca0a('0x49')]=function(_0x1c8802,_0x15f91e){return db[_0xca0a('0x2c')]['create'](_0x1c8802[_0xca0a('0x4a')],{})[_0xca0a('0x25')](respondWithResult(_0x15f91e,0xc9))[_0xca0a('0x45')](handleError(_0x15f91e,null));};exports[_0xca0a('0x23')]=function(_0x2052c4,_0x2ddc40){if(_0x2052c4[_0xca0a('0x4a')]['id']){delete _0x2052c4[_0xca0a('0x4a')]['id'];}return db[_0xca0a('0x2c')][_0xca0a('0x48')]({'where':{'id':_0x2052c4[_0xca0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ddc40,null))['then'](saveUpdates(_0x2052c4[_0xca0a('0x4a')],null))[_0xca0a('0x25')](respondWithResult(_0x2ddc40,null))[_0xca0a('0x45')](handleError(_0x2ddc40,null));};exports[_0xca0a('0x24')]=function(_0x13bb70,_0x1d909f){return db[_0xca0a('0x2c')][_0xca0a('0x48')]({'where':{'id':_0x13bb70[_0xca0a('0x47')]['id']}})[_0xca0a('0x25')](handleEntityNotFound(_0x1d909f,null))[_0xca0a('0x25')](removeEntity(_0x1d909f,null))[_0xca0a('0x45')](handleError(_0x1d909f,null));};exports[_0xca0a('0x4b')]=function(_0x482279,_0x4bf045,_0x1fb563){var _0x3bb8ef={};var _0x560b0c={};var _0xbfe9f9;var _0x2ec94a;return db[_0xca0a('0x2c')][_0xca0a('0x4c')]({'where':{'id':_0x482279[_0xca0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bf045,null))['then'](function(_0x37e265){if(_0x37e265){_0xbfe9f9=_0x37e265;_0x560b0c['model']=_[_0xca0a('0x32')](db['ZendeskField']['rawAttributes']);_0x560b0c[_0xca0a('0x31')]=_['keys'](_0x482279[_0xca0a('0x31')]);_0x560b0c['filters']=_['intersection'](_0x560b0c[_0xca0a('0x30')],_0x560b0c[_0xca0a('0x31')]);_0x3bb8ef['attributes']=_[_0xca0a('0x34')](_0x560b0c[_0xca0a('0x30')],qs['fields'](_0x482279[_0xca0a('0x31')][_0xca0a('0x35')]));_0x3bb8ef[_0xca0a('0x36')]=_0x3bb8ef[_0xca0a('0x36')]['length']?_0x3bb8ef['attributes']:_0x560b0c[_0xca0a('0x30')];_0x3bb8ef[_0xca0a('0x3a')]=qs[_0xca0a('0x3b')](_0x482279[_0xca0a('0x31')]['sort']);_0x3bb8ef['where']=qs[_0xca0a('0x33')](_[_0xca0a('0x3d')](_0x482279[_0xca0a('0x31')],_0x560b0c[_0xca0a('0x33')]));if(_0x482279[_0xca0a('0x31')][_0xca0a('0x41')]){_0x3bb8ef['where']=_['merge'](_0x3bb8ef[_0xca0a('0x3c')],{'$or':_['map'](_0x3bb8ef[_0xca0a('0x36')],function(_0x25e137){var _0x39b259={};_0x39b259[_0x25e137]={'$like':'%'+_0x482279['query'][_0xca0a('0x41')]+'%'};return _0x39b259;})});}_0x3bb8ef=_[_0xca0a('0x3e')]({},_0x3bb8ef,_0x482279[_0xca0a('0x4d')]);return _0xbfe9f9[_0xca0a('0x4b')](_0x3bb8ef);}})[_0xca0a('0x25')](function(_0x209afc){if(_0x209afc){_0x2ec94a=_0x209afc[_0xca0a('0x37')];if(!_0x482279[_0xca0a('0x31')]['hasOwnProperty']('nolimit')){_0x3bb8ef[_0xca0a('0x1b')]=qs[_0xca0a('0x1b')](_0x482279[_0xca0a('0x31')][_0xca0a('0x1b')]);_0x3bb8ef[_0xca0a('0x1c')]=qs[_0xca0a('0x1c')](_0x482279['query'][_0xca0a('0x1c')]);}return _0xbfe9f9['getFields'](_0x3bb8ef);}})[_0xca0a('0x25')](function(_0x1e08ec){if(_0x1e08ec){return _0x1e08ec?{'count':_0x2ec94a,'rows':_0x1e08ec}:null;}})[_0xca0a('0x25')](respondWithResult(_0x4bf045,null))['catch'](handleError(_0x4bf045,null));};exports[_0xca0a('0x4e')]=function(_0x26e22d,_0x2d4a18,_0x668585){var _0x8c6bd9={};var _0x3da729={};var _0x20bdc4;var _0x4b67f3;return db[_0xca0a('0x2c')][_0xca0a('0x4c')]({'where':{'id':_0x26e22d[_0xca0a('0x47')]['id']}})[_0xca0a('0x25')](handleEntityNotFound(_0x2d4a18,null))[_0xca0a('0x25')](function(_0x2c34e6){if(_0x2c34e6){_0x20bdc4=_0x2c34e6;_0x3da729[_0xca0a('0x30')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x3da729[_0xca0a('0x31')]=_[_0xca0a('0x32')](_0x26e22d[_0xca0a('0x31')]);_0x3da729[_0xca0a('0x33')]=_[_0xca0a('0x34')](_0x3da729[_0xca0a('0x30')],_0x3da729[_0xca0a('0x31')]);_0x8c6bd9[_0xca0a('0x36')]=_['intersection'](_0x3da729[_0xca0a('0x30')],qs[_0xca0a('0x35')](_0x26e22d[_0xca0a('0x31')]['fields']));_0x8c6bd9['attributes']=_0x8c6bd9[_0xca0a('0x36')][_0xca0a('0x37')]?_0x8c6bd9[_0xca0a('0x36')]:_0x3da729[_0xca0a('0x30')];_0x8c6bd9[_0xca0a('0x3a')]=qs[_0xca0a('0x3b')](_0x26e22d[_0xca0a('0x31')]['sort']);_0x8c6bd9[_0xca0a('0x3c')]=qs[_0xca0a('0x33')](_[_0xca0a('0x3d')](_0x26e22d[_0xca0a('0x31')],_0x3da729[_0xca0a('0x33')]));if(_0x26e22d[_0xca0a('0x31')]['filter']){_0x8c6bd9[_0xca0a('0x3c')]=_['merge'](_0x8c6bd9['where'],{'$or':_[_0xca0a('0x2b')](_0x8c6bd9[_0xca0a('0x36')],function(_0x277294){var _0x1c70a0={};_0x1c70a0[_0x277294]={'$like':'%'+_0x26e22d[_0xca0a('0x31')][_0xca0a('0x41')]+'%'};return _0x1c70a0;})});}_0x8c6bd9=_['merge']({},_0x8c6bd9,_0x26e22d[_0xca0a('0x4d')]);return _0x20bdc4['getSubjects'](_0x8c6bd9);}})['then'](function(_0x4a26fd){if(_0x4a26fd){_0x4b67f3=_0x4a26fd[_0xca0a('0x37')];if(!_0x26e22d[_0xca0a('0x31')][_0xca0a('0x38')](_0xca0a('0x39'))){_0x8c6bd9[_0xca0a('0x1b')]=qs[_0xca0a('0x1b')](_0x26e22d[_0xca0a('0x31')][_0xca0a('0x1b')]);_0x8c6bd9['offset']=qs['offset'](_0x26e22d['query'][_0xca0a('0x1c')]);}return _0x20bdc4[_0xca0a('0x4e')](_0x8c6bd9);}})[_0xca0a('0x25')](function(_0x2b3a79){if(_0x2b3a79){return _0x2b3a79?{'count':_0x4b67f3,'rows':_0x2b3a79}:null;}})[_0xca0a('0x25')](respondWithResult(_0x2d4a18,null))['catch'](handleError(_0x2d4a18,null));};exports[_0xca0a('0x4f')]=function(_0x3b534f,_0x1d4462,_0x6d463b){var _0x1e2021={};var _0x35f26c={};var _0x1a0a9e;var _0xafd094;return db[_0xca0a('0x2c')][_0xca0a('0x4c')]({'where':{'id':_0x3b534f[_0xca0a('0x47')]['id']}})[_0xca0a('0x25')](handleEntityNotFound(_0x1d4462,null))[_0xca0a('0x25')](function(_0x436382){if(_0x436382){_0x1a0a9e=_0x436382;_0x35f26c['model']=_[_0xca0a('0x32')](db[_0xca0a('0x50')][_0xca0a('0x2d')]);_0x35f26c[_0xca0a('0x31')]=_[_0xca0a('0x32')](_0x3b534f[_0xca0a('0x31')]);_0x35f26c['filters']=_[_0xca0a('0x34')](_0x35f26c['model'],_0x35f26c[_0xca0a('0x31')]);_0x1e2021['attributes']=_['intersection'](_0x35f26c[_0xca0a('0x30')],qs['fields'](_0x3b534f[_0xca0a('0x31')][_0xca0a('0x35')]));_0x1e2021[_0xca0a('0x36')]=_0x1e2021[_0xca0a('0x36')][_0xca0a('0x37')]?_0x1e2021[_0xca0a('0x36')]:_0x35f26c[_0xca0a('0x30')];_0x1e2021[_0xca0a('0x3a')]=qs[_0xca0a('0x3b')](_0x3b534f[_0xca0a('0x31')][_0xca0a('0x3b')]);_0x1e2021['where']=qs[_0xca0a('0x33')](_[_0xca0a('0x3d')](_0x3b534f[_0xca0a('0x31')],_0x35f26c['filters']));if(_0x3b534f[_0xca0a('0x31')]['filter']){_0x1e2021['where']=_[_0xca0a('0x3e')](_0x1e2021[_0xca0a('0x3c')],{'$or':_[_0xca0a('0x2b')](_0x1e2021[_0xca0a('0x36')],function(_0xed2877){var _0x48756e={};_0x48756e[_0xed2877]={'$like':'%'+_0x3b534f[_0xca0a('0x31')][_0xca0a('0x41')]+'%'};return _0x48756e;})});}_0x1e2021=_[_0xca0a('0x3e')]({},_0x1e2021,_0x3b534f[_0xca0a('0x4d')]);return _0x1a0a9e[_0xca0a('0x4f')](_0x1e2021);}})['then'](function(_0xd7e03b){if(_0xd7e03b){_0xafd094=_0xd7e03b[_0xca0a('0x37')];if(!_0x3b534f['query']['hasOwnProperty']('nolimit')){_0x1e2021[_0xca0a('0x1b')]=qs[_0xca0a('0x1b')](_0x3b534f['query'][_0xca0a('0x1b')]);_0x1e2021[_0xca0a('0x1c')]=qs[_0xca0a('0x1c')](_0x3b534f[_0xca0a('0x31')][_0xca0a('0x1c')]);}return _0x1a0a9e[_0xca0a('0x4f')](_0x1e2021);}})[_0xca0a('0x25')](function(_0x3aaf08){if(_0x3aaf08){return _0x3aaf08?{'count':_0xafd094,'rows':_0x3aaf08}:null;}})[_0xca0a('0x25')](respondWithResult(_0x1d4462,null))[_0xca0a('0x45')](handleError(_0x1d4462,null));};exports[_0xca0a('0x51')]=function(_0x2059a5,_0x5c72c3,_0x473d67){var _0x2bf74d={};var _0x105ab2={};var _0x4420a4;var _0x2a5d33;return db[_0xca0a('0x2c')][_0xca0a('0x4c')]({'where':{'id':_0x2059a5[_0xca0a('0x47')]['id']}})[_0xca0a('0x25')](handleEntityNotFound(_0x5c72c3,null))[_0xca0a('0x25')](function(_0x56c72f){if(_0x56c72f){_0x4420a4=_0x56c72f;_0x105ab2[_0xca0a('0x30')]=_['keys'](db[_0xca0a('0x52')][_0xca0a('0x2d')]);_0x105ab2[_0xca0a('0x31')]=_['keys'](_0x2059a5['query']);_0x105ab2[_0xca0a('0x33')]=_[_0xca0a('0x34')](_0x105ab2[_0xca0a('0x30')],_0x105ab2['query']);_0x2bf74d[_0xca0a('0x36')]=_[_0xca0a('0x34')](_0x105ab2['model'],qs[_0xca0a('0x35')](_0x2059a5[_0xca0a('0x31')][_0xca0a('0x35')]));_0x2bf74d[_0xca0a('0x36')]=_0x2bf74d[_0xca0a('0x36')][_0xca0a('0x37')]?_0x2bf74d[_0xca0a('0x36')]:_0x105ab2[_0xca0a('0x30')];_0x2bf74d[_0xca0a('0x3a')]=qs[_0xca0a('0x3b')](_0x2059a5[_0xca0a('0x31')][_0xca0a('0x3b')]);_0x2bf74d[_0xca0a('0x3c')]=qs[_0xca0a('0x33')](_[_0xca0a('0x3d')](_0x2059a5[_0xca0a('0x31')],_0x105ab2[_0xca0a('0x33')]));if(_0x2059a5[_0xca0a('0x31')][_0xca0a('0x41')]){_0x2bf74d['where']=_[_0xca0a('0x3e')](_0x2bf74d[_0xca0a('0x3c')],{'$or':_[_0xca0a('0x2b')](_0x2bf74d['attributes'],function(_0x223155){var _0x34581a={};_0x34581a[_0x223155]={'$like':'%'+_0x2059a5[_0xca0a('0x31')]['filter']+'%'};return _0x34581a;})});}_0x2bf74d=_['merge']({},_0x2bf74d,_0x2059a5['options']);return _0x4420a4['getTags'](_0x2bf74d);}})['then'](function(_0x5562fb){if(_0x5562fb){_0x2a5d33=_0x5562fb[_0xca0a('0x37')];if(!_0x2059a5[_0xca0a('0x31')][_0xca0a('0x38')]('nolimit')){_0x2bf74d[_0xca0a('0x1b')]=qs[_0xca0a('0x1b')](_0x2059a5[_0xca0a('0x31')][_0xca0a('0x1b')]);_0x2bf74d[_0xca0a('0x1c')]=qs[_0xca0a('0x1c')](_0x2059a5[_0xca0a('0x31')][_0xca0a('0x1c')]);}return _0x4420a4[_0xca0a('0x51')](_0x2bf74d);}})[_0xca0a('0x25')](function(_0x2b9076){if(_0x2b9076){return _0x2b9076?{'count':_0x2a5d33,'rows':_0x2b9076}:null;}})[_0xca0a('0x25')](respondWithResult(_0x5c72c3,null))[_0xca0a('0x45')](handleError(_0x5c72c3,null));};exports[_0xca0a('0x53')]=function(_0x2036c1,_0x1f9522,_0x55c59e){if(_0x2036c1[_0xca0a('0x4a')]['id']){delete _0x2036c1[_0xca0a('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xca0a('0x4c')]({'where':{'id':_0x2036c1[_0xca0a('0x47')]['id']}})[_0xca0a('0x25')](handleEntityNotFound(_0x1f9522,null))[_0xca0a('0x25')](function(_0x47dbe1){if(_0x47dbe1){return _0x47dbe1[_0xca0a('0x53')](_0x2036c1[_0xca0a('0x4a')][_0xca0a('0x54')]||[]);}return null;})[_0xca0a('0x25')](respondWithResult(_0x1f9522,null))[_0xca0a('0x45')](handleError(_0x1f9522,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 03e80a3..8183e2c 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 _0xea28=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2df685,_0x41b54d){var _0x4010ca=function(_0xfbbb9){while(--_0xfbbb9){_0x2df685['push'](_0x2df685['shift']());}};_0x4010ca(++_0x41b54d);}(_0xea28,0x13a));var _0x8ea2=function(_0x5001ed,_0x443721){_0x5001ed=_0x5001ed-0x0;var _0x3e6666=_0xea28[_0x5001ed];return _0x3e6666;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'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(_0x8da876,_0x4e31cf){var _0x2b8b92=function(_0xbc2bfe){while(--_0xbc2bfe){_0x8da876['push'](_0x8da876['shift']());}};_0x2b8b92(++_0x4e31cf);}(_0x4024,0x89));var _0x4402=function(_0x941816,_0x33772a){_0x941816=_0x941816-0x0;var _0xfb2f5e=_0x4024[_0x941816];return _0xfb2f5e;};'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 0c75980..34b5ad0 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 _0xc0e2=['request\x20sent','debug','stringify','code','error','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x12b19e,_0x35a2c6){var _0x17d8ce=function(_0x5b85e5){while(--_0x5b85e5){_0x12b19e['push'](_0x12b19e['shift']());}};_0x17d8ce(++_0x35a2c6);}(_0xc0e2,0x1c0));var _0x2c0e=function(_0x163c22,_0x12d7e0){_0x163c22=_0x163c22-0x0;var _0x4ebb21=_0xc0e2[_0x163c22];return _0x4ebb21;};'use strict';var _=require(_0x2c0e('0x0'));var util=require(_0x2c0e('0x1'));var moment=require(_0x2c0e('0x2'));var BPromise=require(_0x2c0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c0e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c0e('0x5'))('rpc');var config=require(_0x2c0e('0x6'));var jayson=require(_0x2c0e('0x7'));var client=jayson[_0x2c0e('0x8')][_0x2c0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27fab8,_0x4410ff,_0xc8ffea){return new BPromise(function(_0x1ed30b,_0x3fb6ae){return client['request'](_0x27fab8,_0xc8ffea)[_0x2c0e('0xa')](function(_0x14e701){logger['info'](_0x2c0e('0xb'),_0x4410ff,_0x2c0e('0xc'));logger[_0x2c0e('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4410ff,_0x2c0e('0xc'),JSON[_0x2c0e('0xe')](_0x14e701));if(_0x14e701['error']){if(_0x14e701['error'][_0x2c0e('0xf')]===0x1f4){logger[_0x2c0e('0x10')](_0x2c0e('0xb'),_0x4410ff,_0x14e701[_0x2c0e('0x10')]['message']);return _0x3fb6ae(_0x14e701['error'][_0x2c0e('0x11')]);}logger[_0x2c0e('0x10')](_0x2c0e('0xb'),_0x4410ff,_0x14e701[_0x2c0e('0x10')][_0x2c0e('0x11')]);return _0x1ed30b(_0x14e701[_0x2c0e('0x10')][_0x2c0e('0x11')]);}else{logger[_0x2c0e('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4410ff,'request\x20sent');_0x1ed30b(_0x14e701[_0x2c0e('0x13')][_0x2c0e('0x11')]);}})['catch'](function(_0x5f000e){logger['error'](_0x2c0e('0xb'),_0x4410ff,_0x5f000e);_0x3fb6ae(_0x5f000e);});});} \ No newline at end of file +var _0xdf97=['../../config/logger','rpc','../../config/environment','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5d9b0d,_0x32ec14){var _0x5cf5aa=function(_0x4102ad){while(--_0x4102ad){_0x5d9b0d['push'](_0x5d9b0d['shift']());}};_0x5cf5aa(++_0x32ec14);}(_0xdf97,0xea));var _0x7df9=function(_0x4f0249,_0x4e3562){_0x4f0249=_0x4f0249-0x0;var _0x3f01f3=_0xdf97[_0x4f0249];return _0x3f01f3;};'use strict';var _=require(_0x7df9('0x0'));var util=require(_0x7df9('0x1'));var moment=require('moment');var BPromise=require(_0x7df9('0x2'));var rs=require(_0x7df9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7df9('0x4'))['db'];var utils=require(_0x7df9('0x5'));var logger=require(_0x7df9('0x6'))(_0x7df9('0x7'));var config=require(_0x7df9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7df9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dfab4,_0x5eecd2,_0xc186c8){return new BPromise(function(_0x152aa5,_0x329d32){return client[_0x7df9('0xa')](_0x1dfab4,_0xc186c8)[_0x7df9('0xb')](function(_0x299b06){logger[_0x7df9('0xc')](_0x7df9('0xd'),_0x5eecd2,_0x7df9('0xe'));logger[_0x7df9('0xf')](_0x7df9('0x10'),_0x5eecd2,_0x7df9('0xe'),JSON[_0x7df9('0x11')](_0x299b06));if(_0x299b06['error']){if(_0x299b06[_0x7df9('0x12')]['code']===0x1f4){logger[_0x7df9('0x12')](_0x7df9('0xd'),_0x5eecd2,_0x299b06[_0x7df9('0x12')][_0x7df9('0x13')]);return _0x329d32(_0x299b06[_0x7df9('0x12')]['message']);}logger[_0x7df9('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5eecd2,_0x299b06[_0x7df9('0x12')][_0x7df9('0x13')]);return _0x152aa5(_0x299b06[_0x7df9('0x12')][_0x7df9('0x13')]);}else{logger[_0x7df9('0xc')](_0x7df9('0xd'),_0x5eecd2,_0x7df9('0xe'));_0x152aa5(_0x299b06['result'][_0x7df9('0x13')]);}})['catch'](function(_0x1ae82){logger['error'](_0x7df9('0xd'),_0x5eecd2,_0x1ae82);_0x329d32(_0x1ae82);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ba89a32..1513dc1 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 _0xd07d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id','update','delete','destroy','exports','multer','path'];(function(_0x4d811b,_0x1b267d){var _0x47bcf1=function(_0x1770e2){while(--_0x1770e2){_0x4d811b['push'](_0x4d811b['shift']());}};_0x47bcf1(++_0x1b267d);}(_0xd07d,0xde));var _0xdd07=function(_0x3f55de,_0x3ae98f){_0x3f55de=_0x3f55de-0x0;var _0x2698de=_0xd07d[_0x3f55de];return _0x2698de;};'use strict';var multer=require(_0xdd07('0x0'));var util=require('util');var path=require(_0xdd07('0x1'));var timeout=require(_0xdd07('0x2'));var express=require(_0xdd07('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd07('0x4'));var interaction=require(_0xdd07('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xdd07('0x6')]('/',auth[_0xdd07('0x7')](),controller['index']);router[_0xdd07('0x6')]('/:id',auth[_0xdd07('0x7')](),controller[_0xdd07('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xdd07('0x9'),auth[_0xdd07('0x7')](),controller[_0xdd07('0xa')]);router[_0xdd07('0xb')](_0xdd07('0x9'),auth[_0xdd07('0x7')](),controller[_0xdd07('0xc')]);module[_0xdd07('0xd')]=router; \ No newline at end of file +var _0xed6d=['update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','put','/:id'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xed6d,0xe3));var _0xded6=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xed6d[_0x58e469];return _0x4c01c5;};'use strict';var multer=require('multer');var util=require(_0xded6('0x0'));var path=require('path');var timeout=require(_0xded6('0x1'));var express=require(_0xded6('0x2'));var router=express[_0xded6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xded6('0x4'));var interaction=require(_0xded6('0x5'));var config=require(_0xded6('0x6'));var controller=require('./intZendeskField.controller');router[_0xded6('0x7')]('/',auth[_0xded6('0x8')](),controller[_0xded6('0x9')]);router[_0xded6('0x7')]('/:id',auth[_0xded6('0x8')](),controller['show']);router[_0xded6('0xa')]('/',auth[_0xded6('0x8')](),controller['create']);router[_0xded6('0xb')](_0xded6('0xc'),auth[_0xded6('0x8')](),controller[_0xded6('0xd')]);router[_0xded6('0xe')](_0xded6('0xc'),auth[_0xded6('0x8')](),controller['destroy']);module[_0xded6('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c99f79e..ed03eaa 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 _0x51f2=['keyValue','picklist','STRING','ENUM','exports','string','variable','customVariable'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x51f2,0x6c));var _0x251f=function(_0x333be5,_0x3b45c5){_0x333be5=_0x333be5-0x0;var _0x12be69=_0x51f2[_0x333be5];return _0x12be69;};'use strict';var Sequelize=require('sequelize');module[_0x251f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x251f('0x1'),_0x251f('0x2'),_0x251f('0x3'),_0x251f('0x4'),_0x251f('0x5')),'defaultValue':_0x251f('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x251f('0x6')]},'keyType':{'type':Sequelize[_0x251f('0x7')](_0x251f('0x1'),'variable',_0x251f('0x3'))},'keyContent':{'type':Sequelize[_0x251f('0x6')]},'idField':{'type':Sequelize[_0x251f('0x6')]},'nameField':{'type':Sequelize[_0x251f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x251f('0x6')]}}; \ No newline at end of file +var _0x7208=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x7208,0x11a));var _0x8720=function(_0x118356,_0x728d97){_0x118356=_0x118356-0x0;var _0x4688a9=_0x7208[_0x118356];return _0x4688a9;};'use strict';var Sequelize=require(_0x8720('0x0'));module[_0x8720('0x1')]={'type':{'type':Sequelize[_0x8720('0x2')](_0x8720('0x3'),_0x8720('0x4'),_0x8720('0x5'),_0x8720('0x6'),'picklist'),'defaultValue':_0x8720('0x3')},'content':{'type':Sequelize[_0x8720('0x7')]},'key':{'type':Sequelize[_0x8720('0x7')]},'keyType':{'type':Sequelize[_0x8720('0x2')](_0x8720('0x3'),_0x8720('0x4'),_0x8720('0x5'))},'keyContent':{'type':Sequelize[_0x8720('0x7')]},'idField':{'type':Sequelize[_0x8720('0x7')]},'nameField':{'type':Sequelize[_0x8720('0x7')]},'customField':{'type':Sequelize[_0x8720('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8720('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 3c5ccd3..abfcd89 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 _0xa7a4=['length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','update','then','sendStatus','error','stack','name','send','index','map','ZendeskField','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7a4,0xf6));var _0x4a7a=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0xa7a4[_0x55a89e];return _0x3aa2bd;};'use strict';var emlformat=require(_0x4a7a('0x0'));var rimraf=require(_0x4a7a('0x1'));var zipdir=require(_0x4a7a('0x2'));var jsonpatch=require(_0x4a7a('0x3'));var rp=require(_0x4a7a('0x4'));var moment=require(_0x4a7a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4a7a('0x6'));var util=require(_0x4a7a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4a7a('0x8'));var ejs=require(_0x4a7a('0x9'));var fs=require('fs');var fs_extra=require(_0x4a7a('0xa'));var _=require(_0x4a7a('0xb'));var squel=require(_0x4a7a('0xc'));var crypto=require('crypto');var jsforce=require(_0x4a7a('0xd'));var deskjs=require(_0x4a7a('0xe'));var toCsv=require(_0x4a7a('0x8'));var querystring=require(_0x4a7a('0xf'));var Papa=require(_0x4a7a('0x10'));var Redis=require(_0x4a7a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4a7a('0x12'));var hardwareService=require(_0x4a7a('0x13'));var logger=require(_0x4a7a('0x14'))(_0x4a7a('0x15'));var utils=require(_0x4a7a('0x16'));var config=require(_0x4a7a('0x17'));var licenseUtil=require(_0x4a7a('0x18'));var db=require(_0x4a7a('0x19'))['db'];function respondWithStatusCode(_0x2f9a91,_0x2a88bb){_0x2a88bb=_0x2a88bb||0xcc;return function(_0x11cc3f){if(_0x11cc3f){return _0x2f9a91['sendStatus'](_0x2a88bb);}return _0x2f9a91[_0x4a7a('0x1a')](_0x2a88bb)[_0x4a7a('0x1b')]();};}function respondWithResult(_0x4ce375,_0x5c7d4a){_0x5c7d4a=_0x5c7d4a||0xc8;return function(_0x543cc1){if(_0x543cc1){return _0x4ce375[_0x4a7a('0x1a')](_0x5c7d4a)[_0x4a7a('0x1c')](_0x543cc1);}};}function respondWithFilteredResult(_0x1bd8c6,_0x5d42e9){return function(_0xae416f){if(_0xae416f){var _0x257400=typeof _0x5d42e9[_0x4a7a('0x1d')]===_0x4a7a('0x1e')&&typeof _0x5d42e9['limit']==='undefined';var _0x348b60=_0xae416f[_0x4a7a('0x1f')];var _0x4394e9=_0x257400?0x0:_0x5d42e9['offset'];var _0x35bab0=_0x257400?_0xae416f[_0x4a7a('0x1f')]:_0x5d42e9[_0x4a7a('0x1d')]+_0x5d42e9['limit'];var _0x57d630;if(_0x35bab0>=_0x348b60){_0x35bab0=_0x348b60;_0x57d630=0xc8;}else{_0x57d630=0xce;}_0x1bd8c6[_0x4a7a('0x1a')](_0x57d630);return _0x1bd8c6[_0x4a7a('0x20')]('Content-Range',_0x4394e9+'-'+_0x35bab0+'/'+_0x348b60)[_0x4a7a('0x1c')](_0xae416f);}return null;};}function patchUpdates(_0x4d3175){return function(_0x23d732){try{jsonpatch[_0x4a7a('0x21')](_0x23d732,_0x4d3175,!![]);}catch(_0x3f1ed3){return BPromise['reject'](_0x3f1ed3);}return _0x23d732['save']();};}function saveUpdates(_0x5df3b7,_0x4166e4){return function(_0x5b482d){if(_0x5b482d){return _0x5b482d[_0x4a7a('0x22')](_0x5df3b7)['then'](function(_0x354f01){return _0x354f01;});}return null;};}function removeEntity(_0x5170ad,_0x584b90){return function(_0x2b3fae){if(_0x2b3fae){return _0x2b3fae['destroy']()[_0x4a7a('0x23')](function(){_0x5170ad[_0x4a7a('0x1a')](0xcc)[_0x4a7a('0x1b')]();});}};}function handleEntityNotFound(_0x22656e,_0x380117){return function(_0x1c18e5){if(!_0x1c18e5){_0x22656e[_0x4a7a('0x24')](0x194);}return _0x1c18e5;};}function handleError(_0xfb826,_0x51f14b){_0x51f14b=_0x51f14b||0x1f4;return function(_0x537b63){logger[_0x4a7a('0x25')](_0x537b63[_0x4a7a('0x26')]);if(_0x537b63['name']){delete _0x537b63[_0x4a7a('0x27')];}_0xfb826[_0x4a7a('0x1a')](_0x51f14b)[_0x4a7a('0x28')](_0x537b63);};}exports[_0x4a7a('0x29')]=function(_0x2d5f05,_0x23b99e){var _0x1b5478={},_0x397bd3={},_0x14eacb={'count':0x0,'rows':[]};var _0x6e3378=_[_0x4a7a('0x2a')](db[_0x4a7a('0x2b')]['rawAttributes'],function(_0x1a6ac6){return{'name':_0x1a6ac6[_0x4a7a('0x2c')],'type':_0x1a6ac6[_0x4a7a('0x2d')][_0x4a7a('0x2e')]};});_0x397bd3['model']=_[_0x4a7a('0x2a')](_0x6e3378,_0x4a7a('0x27'));_0x397bd3[_0x4a7a('0x2f')]=_[_0x4a7a('0x30')](_0x2d5f05[_0x4a7a('0x2f')]);_0x397bd3[_0x4a7a('0x31')]=_[_0x4a7a('0x32')](_0x397bd3['model'],_0x397bd3[_0x4a7a('0x2f')]);_0x1b5478[_0x4a7a('0x33')]=_[_0x4a7a('0x32')](_0x397bd3[_0x4a7a('0x34')],qs[_0x4a7a('0x35')](_0x2d5f05[_0x4a7a('0x2f')][_0x4a7a('0x35')]));_0x1b5478[_0x4a7a('0x33')]=_0x1b5478['attributes'][_0x4a7a('0x36')]?_0x1b5478[_0x4a7a('0x33')]:_0x397bd3[_0x4a7a('0x34')];if(!_0x2d5f05[_0x4a7a('0x2f')][_0x4a7a('0x37')](_0x4a7a('0x38'))){_0x1b5478[_0x4a7a('0x39')]=qs[_0x4a7a('0x39')](_0x2d5f05[_0x4a7a('0x2f')][_0x4a7a('0x39')]);_0x1b5478['offset']=qs[_0x4a7a('0x1d')](_0x2d5f05[_0x4a7a('0x2f')][_0x4a7a('0x1d')]);}_0x1b5478[_0x4a7a('0x3a')]=qs[_0x4a7a('0x3b')](_0x2d5f05['query'][_0x4a7a('0x3b')]);_0x1b5478[_0x4a7a('0x3c')]=qs[_0x4a7a('0x31')](_['pick'](_0x2d5f05['query'],_0x397bd3[_0x4a7a('0x31')]),_0x6e3378);if(_0x2d5f05[_0x4a7a('0x2f')][_0x4a7a('0x3d')]){_0x1b5478[_0x4a7a('0x3c')]=_[_0x4a7a('0x3e')](_0x1b5478[_0x4a7a('0x3c')],{'$or':_[_0x4a7a('0x2a')](_0x6e3378,function(_0x443164){if(_0x443164[_0x4a7a('0x2d')]!==_0x4a7a('0x3f')){var _0x32970d={};_0x32970d[_0x443164['name']]={'$like':'%'+_0x2d5f05[_0x4a7a('0x2f')]['filter']+'%'};return _0x32970d;}})});}_0x1b5478=_[_0x4a7a('0x3e')]({},_0x1b5478,_0x2d5f05[_0x4a7a('0x40')]);var _0x5a2d16={'where':_0x1b5478[_0x4a7a('0x3c')]};return db[_0x4a7a('0x2b')]['count'](_0x5a2d16)[_0x4a7a('0x23')](function(_0x4b203a){_0x14eacb[_0x4a7a('0x1f')]=_0x4b203a;if(_0x2d5f05[_0x4a7a('0x2f')][_0x4a7a('0x41')]){_0x1b5478[_0x4a7a('0x42')]=[{'all':!![]}];}return db['ZendeskField'][_0x4a7a('0x43')](_0x1b5478);})[_0x4a7a('0x23')](function(_0x3be333){_0x14eacb['rows']=_0x3be333;return _0x14eacb;})[_0x4a7a('0x23')](respondWithFilteredResult(_0x23b99e,_0x1b5478))['catch'](handleError(_0x23b99e,null));};exports[_0x4a7a('0x44')]=function(_0xbb92b9,_0x4c8990){var _0x4c8daf={'raw':!![],'where':{'id':_0xbb92b9[_0x4a7a('0x45')]['id']}},_0x35121d={};_0x35121d[_0x4a7a('0x34')]=_[_0x4a7a('0x30')](db['ZendeskField'][_0x4a7a('0x46')]);_0x35121d[_0x4a7a('0x2f')]=_[_0x4a7a('0x30')](_0xbb92b9[_0x4a7a('0x2f')]);_0x35121d[_0x4a7a('0x31')]=_['intersection'](_0x35121d['model'],_0x35121d['query']);_0x4c8daf[_0x4a7a('0x33')]=_[_0x4a7a('0x32')](_0x35121d[_0x4a7a('0x34')],qs[_0x4a7a('0x35')](_0xbb92b9[_0x4a7a('0x2f')]['fields']));_0x4c8daf[_0x4a7a('0x33')]=_0x4c8daf[_0x4a7a('0x33')]['length']?_0x4c8daf['attributes']:_0x35121d[_0x4a7a('0x34')];if(_0xbb92b9[_0x4a7a('0x2f')]['includeAll']){_0x4c8daf[_0x4a7a('0x42')]=[{'all':!![]}];}_0x4c8daf=_[_0x4a7a('0x3e')]({},_0x4c8daf,_0xbb92b9[_0x4a7a('0x40')]);return db[_0x4a7a('0x2b')]['find'](_0x4c8daf)[_0x4a7a('0x23')](handleEntityNotFound(_0x4c8990,null))[_0x4a7a('0x23')](respondWithResult(_0x4c8990,null))['catch'](handleError(_0x4c8990,null));};exports['create']=function(_0x4a0e11,_0x3b0f9f){return db[_0x4a7a('0x2b')][_0x4a7a('0x47')](_0x4a0e11['body'],{})[_0x4a7a('0x23')](respondWithResult(_0x3b0f9f,0xc9))['catch'](handleError(_0x3b0f9f,null));};exports[_0x4a7a('0x22')]=function(_0x9d49b1,_0x1742e4){if(_0x9d49b1['body']['id']){delete _0x9d49b1[_0x4a7a('0x48')]['id'];}return db[_0x4a7a('0x2b')]['find']({'where':{'id':_0x9d49b1[_0x4a7a('0x45')]['id']}})[_0x4a7a('0x23')](handleEntityNotFound(_0x1742e4,null))[_0x4a7a('0x23')](saveUpdates(_0x9d49b1['body'],null))[_0x4a7a('0x23')](respondWithResult(_0x1742e4,null))[_0x4a7a('0x49')](handleError(_0x1742e4,null));};exports['destroy']=function(_0xe62d78,_0x4484aa){return db[_0x4a7a('0x2b')][_0x4a7a('0x4a')]({'where':{'id':_0xe62d78['params']['id']}})['then'](handleEntityNotFound(_0x4484aa,null))['then'](removeEntity(_0x4484aa,null))[_0x4a7a('0x49')](handleError(_0x4484aa,null));}; \ No newline at end of file +var _0xeff5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','apply','update','then','destroy','sendStatus','stack','send','index','map','ZendeskField','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','create','body','find','eml-format','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xeff5,0x101));var _0x5eff=function(_0x1640da,_0x3c9f19){_0x1640da=_0x1640da-0x0;var _0xd5041d=_0xeff5[_0x1640da];return _0xd5041d;};'use strict';var emlformat=require(_0x5eff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5eff('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5eff('0x3'));var path=require(_0x5eff('0x4'));var sox=require(_0x5eff('0x5'));var csv=require(_0x5eff('0x6'));var ejs=require(_0x5eff('0x7'));var fs=require('fs');var fs_extra=require(_0x5eff('0x8'));var _=require(_0x5eff('0x9'));var squel=require(_0x5eff('0xa'));var crypto=require(_0x5eff('0xb'));var jsforce=require(_0x5eff('0xc'));var deskjs=require(_0x5eff('0xd'));var toCsv=require(_0x5eff('0x6'));var querystring=require(_0x5eff('0xe'));var Papa=require(_0x5eff('0xf'));var Redis=require(_0x5eff('0x10'));var authService=require(_0x5eff('0x11'));var qs=require(_0x5eff('0x12'));var as=require(_0x5eff('0x13'));var hardwareService=require(_0x5eff('0x14'));var logger=require(_0x5eff('0x15'))('api');var utils=require(_0x5eff('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x506113,_0x5a6085){_0x5a6085=_0x5a6085||0xcc;return function(_0x3d94ed){if(_0x3d94ed){return _0x506113['sendStatus'](_0x5a6085);}return _0x506113[_0x5eff('0x18')](_0x5a6085)['end']();};}function respondWithResult(_0x752e5b,_0x23c6ea){_0x23c6ea=_0x23c6ea||0xc8;return function(_0x3300c0){if(_0x3300c0){return _0x752e5b['status'](_0x23c6ea)[_0x5eff('0x19')](_0x3300c0);}};}function respondWithFilteredResult(_0x35dd15,_0xc81e1d){return function(_0x4a398d){if(_0x4a398d){var _0x31f24b=typeof _0xc81e1d[_0x5eff('0x1a')]===_0x5eff('0x1b')&&typeof _0xc81e1d[_0x5eff('0x1c')]===_0x5eff('0x1b');var _0x52b9df=_0x4a398d['count'];var _0x59876e=_0x31f24b?0x0:_0xc81e1d[_0x5eff('0x1a')];var _0x378039=_0x31f24b?_0x4a398d[_0x5eff('0x1d')]:_0xc81e1d[_0x5eff('0x1a')]+_0xc81e1d[_0x5eff('0x1c')];var _0x1c1ee1;if(_0x378039>=_0x52b9df){_0x378039=_0x52b9df;_0x1c1ee1=0xc8;}else{_0x1c1ee1=0xce;}_0x35dd15['status'](_0x1c1ee1);return _0x35dd15['set']('Content-Range',_0x59876e+'-'+_0x378039+'/'+_0x52b9df)[_0x5eff('0x19')](_0x4a398d);}return null;};}function patchUpdates(_0x34c1c1){return function(_0x3dfd8a){try{jsonpatch[_0x5eff('0x1e')](_0x3dfd8a,_0x34c1c1,!![]);}catch(_0x5c295e){return BPromise['reject'](_0x5c295e);}return _0x3dfd8a['save']();};}function saveUpdates(_0x7e6422,_0x1d95c6){return function(_0xfca33a){if(_0xfca33a){return _0xfca33a[_0x5eff('0x1f')](_0x7e6422)[_0x5eff('0x20')](function(_0x20544e){return _0x20544e;});}return null;};}function removeEntity(_0x238cc4,_0x5b5a57){return function(_0x592cd3){if(_0x592cd3){return _0x592cd3[_0x5eff('0x21')]()[_0x5eff('0x20')](function(){_0x238cc4[_0x5eff('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2c210,_0x2f9c76){return function(_0x9fcedc){if(!_0x9fcedc){_0xa2c210[_0x5eff('0x22')](0x194);}return _0x9fcedc;};}function handleError(_0x353df3,_0x351eae){_0x351eae=_0x351eae||0x1f4;return function(_0x13f37e){logger['error'](_0x13f37e[_0x5eff('0x23')]);if(_0x13f37e['name']){delete _0x13f37e['name'];}_0x353df3['status'](_0x351eae)[_0x5eff('0x24')](_0x13f37e);};}exports[_0x5eff('0x25')]=function(_0x27dfcd,_0x100725){var _0x34e768={},_0x44accf={},_0xeb9d17={'count':0x0,'rows':[]};var _0x30c8cc=_[_0x5eff('0x26')](db[_0x5eff('0x27')]['rawAttributes'],function(_0xf6767f){return{'name':_0xf6767f['fieldName'],'type':_0xf6767f[_0x5eff('0x28')][_0x5eff('0x29')]};});_0x44accf[_0x5eff('0x2a')]=_[_0x5eff('0x26')](_0x30c8cc,'name');_0x44accf['query']=_[_0x5eff('0x2b')](_0x27dfcd[_0x5eff('0x2c')]);_0x44accf[_0x5eff('0x2d')]=_[_0x5eff('0x2e')](_0x44accf[_0x5eff('0x2a')],_0x44accf[_0x5eff('0x2c')]);_0x34e768[_0x5eff('0x2f')]=_['intersection'](_0x44accf[_0x5eff('0x2a')],qs[_0x5eff('0x30')](_0x27dfcd[_0x5eff('0x2c')][_0x5eff('0x30')]));_0x34e768[_0x5eff('0x2f')]=_0x34e768[_0x5eff('0x2f')][_0x5eff('0x31')]?_0x34e768[_0x5eff('0x2f')]:_0x44accf[_0x5eff('0x2a')];if(!_0x27dfcd[_0x5eff('0x2c')][_0x5eff('0x32')](_0x5eff('0x33'))){_0x34e768['limit']=qs['limit'](_0x27dfcd[_0x5eff('0x2c')][_0x5eff('0x1c')]);_0x34e768[_0x5eff('0x1a')]=qs[_0x5eff('0x1a')](_0x27dfcd[_0x5eff('0x2c')][_0x5eff('0x1a')]);}_0x34e768[_0x5eff('0x34')]=qs[_0x5eff('0x35')](_0x27dfcd[_0x5eff('0x2c')][_0x5eff('0x35')]);_0x34e768[_0x5eff('0x36')]=qs[_0x5eff('0x2d')](_[_0x5eff('0x37')](_0x27dfcd['query'],_0x44accf[_0x5eff('0x2d')]),_0x30c8cc);if(_0x27dfcd['query'][_0x5eff('0x38')]){_0x34e768[_0x5eff('0x36')]=_[_0x5eff('0x39')](_0x34e768[_0x5eff('0x36')],{'$or':_[_0x5eff('0x26')](_0x30c8cc,function(_0x54bdd1){if(_0x54bdd1[_0x5eff('0x28')]!==_0x5eff('0x3a')){var _0x124ee9={};_0x124ee9[_0x54bdd1['name']]={'$like':'%'+_0x27dfcd[_0x5eff('0x2c')][_0x5eff('0x38')]+'%'};return _0x124ee9;}})});}_0x34e768=_[_0x5eff('0x39')]({},_0x34e768,_0x27dfcd[_0x5eff('0x3b')]);var _0x40540e={'where':_0x34e768['where']};return db['ZendeskField'][_0x5eff('0x1d')](_0x40540e)[_0x5eff('0x20')](function(_0x19ceea){_0xeb9d17['count']=_0x19ceea;if(_0x27dfcd[_0x5eff('0x2c')]['includeAll']){_0x34e768[_0x5eff('0x3c')]=[{'all':!![]}];}return db[_0x5eff('0x27')][_0x5eff('0x3d')](_0x34e768);})['then'](function(_0x28fe4d){_0xeb9d17['rows']=_0x28fe4d;return _0xeb9d17;})[_0x5eff('0x20')](respondWithFilteredResult(_0x100725,_0x34e768))[_0x5eff('0x3e')](handleError(_0x100725,null));};exports[_0x5eff('0x3f')]=function(_0x580627,_0x2a3ff1){var _0x2a0327={'raw':!![],'where':{'id':_0x580627[_0x5eff('0x40')]['id']}},_0xa52097={};_0xa52097[_0x5eff('0x2a')]=_[_0x5eff('0x2b')](db['ZendeskField'][_0x5eff('0x41')]);_0xa52097[_0x5eff('0x2c')]=_[_0x5eff('0x2b')](_0x580627[_0x5eff('0x2c')]);_0xa52097[_0x5eff('0x2d')]=_[_0x5eff('0x2e')](_0xa52097[_0x5eff('0x2a')],_0xa52097['query']);_0x2a0327['attributes']=_[_0x5eff('0x2e')](_0xa52097[_0x5eff('0x2a')],qs[_0x5eff('0x30')](_0x580627[_0x5eff('0x2c')]['fields']));_0x2a0327[_0x5eff('0x2f')]=_0x2a0327[_0x5eff('0x2f')][_0x5eff('0x31')]?_0x2a0327[_0x5eff('0x2f')]:_0xa52097[_0x5eff('0x2a')];if(_0x580627[_0x5eff('0x2c')]['includeAll']){_0x2a0327['include']=[{'all':!![]}];}_0x2a0327=_[_0x5eff('0x39')]({},_0x2a0327,_0x580627[_0x5eff('0x3b')]);return db[_0x5eff('0x27')]['find'](_0x2a0327)[_0x5eff('0x20')](handleEntityNotFound(_0x2a3ff1,null))[_0x5eff('0x20')](respondWithResult(_0x2a3ff1,null))[_0x5eff('0x3e')](handleError(_0x2a3ff1,null));};exports[_0x5eff('0x42')]=function(_0x7f460a,_0x57a434){return db[_0x5eff('0x27')][_0x5eff('0x42')](_0x7f460a[_0x5eff('0x43')],{})['then'](respondWithResult(_0x57a434,0xc9))[_0x5eff('0x3e')](handleError(_0x57a434,null));};exports[_0x5eff('0x1f')]=function(_0x4ffec1,_0x526a68){if(_0x4ffec1[_0x5eff('0x43')]['id']){delete _0x4ffec1['body']['id'];}return db[_0x5eff('0x27')][_0x5eff('0x44')]({'where':{'id':_0x4ffec1[_0x5eff('0x40')]['id']}})[_0x5eff('0x20')](handleEntityNotFound(_0x526a68,null))[_0x5eff('0x20')](saveUpdates(_0x4ffec1[_0x5eff('0x43')],null))[_0x5eff('0x20')](respondWithResult(_0x526a68,null))['catch'](handleError(_0x526a68,null));};exports['destroy']=function(_0x56d96d,_0x1a645e){return db['ZendeskField'][_0x5eff('0x44')]({'where':{'id':_0x56d96d[_0x5eff('0x40')]['id']}})[_0x5eff('0x20')](handleEntityNotFound(_0x1a645e,null))[_0x5eff('0x20')](removeEntity(_0x1a645e,null))['catch'](handleError(_0x1a645e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index fb12676..30a2af9 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 _0x9cbe=['api','moment','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','FieldId','lodash'];(function(_0x13a838,_0x448820){var _0x26bf5a=function(_0xa1f9b){while(--_0xa1f9b){_0x13a838['push'](_0x13a838['shift']());}};_0x26bf5a(++_0x448820);}(_0x9cbe,0x154));var _0xe9cb=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x9cbe[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xe9cb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe9cb('0x1'));var moment=require(_0xe9cb('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9cb('0x3'));var fs=require('fs');var path=require(_0xe9cb('0x4'));var rimraf=require('rimraf');var config=require(_0xe9cb('0x5'));var attributes=require(_0xe9cb('0x6'));module[_0xe9cb('0x7')]=function(_0x4c4eaa,_0x549d34){return _0x4c4eaa[_0xe9cb('0x8')]('ZendeskField',attributes,{'tableName':_0xe9cb('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xe9cb('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5cc=['zendesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','int_zendesk_fields'];(function(_0x293a6b,_0x3b9ede){var _0x2d371c=function(_0x2b115a){while(--_0x2b115a){_0x293a6b['push'](_0x293a6b['shift']());}};_0x2d371c(++_0x3b9ede);}(_0xa5cc,0x99));var _0xca5c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa5cc[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xca5c('0x0'));var util=require(_0xca5c('0x1'));var logger=require('../../config/logger')(_0xca5c('0x2'));var moment=require(_0xca5c('0x3'));var BPromise=require(_0xca5c('0x4'));var rp=require(_0xca5c('0x5'));var fs=require('fs');var path=require(_0xca5c('0x6'));var rimraf=require(_0xca5c('0x7'));var config=require(_0xca5c('0x8'));var attributes=require(_0xca5c('0x9'));module['exports']=function(_0x3eb9b4,_0x4e283e){return _0x3eb9b4[_0xca5c('0xa')]('ZendeskField',attributes,{'tableName':_0xca5c('0xb'),'paranoid':![],'indexes':[{'name':_0xca5c('0xc'),'fields':[_0xca5c('0xd'),_0xca5c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index f1636d1..ae2650f 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 _0x46e5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskField,\x20%s,\x20%s','result','util','moment','bluebird','ioredis'];(function(_0x1c45e3,_0x2106a7){var _0x30d535=function(_0xfa80ec){while(--_0xfa80ec){_0x1c45e3['push'](_0x1c45e3['shift']());}};_0x30d535(++_0x2106a7);}(_0x46e5,0x9d));var _0x546e=function(_0xdbf024,_0x24afae){_0xdbf024=_0xdbf024-0x0;var _0xa510f2=_0x46e5[_0xdbf024];return _0xa510f2;};'use strict';var _=require('lodash');var util=require(_0x546e('0x0'));var moment=require(_0x546e('0x1'));var BPromise=require(_0x546e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x546e('0x3'));var db=require(_0x546e('0x4'))['db'];var utils=require(_0x546e('0x5'));var logger=require(_0x546e('0x6'))(_0x546e('0x7'));var config=require(_0x546e('0x8'));var jayson=require(_0x546e('0x9'));var client=jayson[_0x546e('0xa')][_0x546e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29a7dc,_0x341476,_0x29aa0f){return new BPromise(function(_0x2b0070,_0x1f4aac){return client[_0x546e('0xc')](_0x29a7dc,_0x29aa0f)['then'](function(_0x74a168){logger[_0x546e('0xd')]('ZendeskField,\x20%s,\x20%s',_0x341476,_0x546e('0xe'));logger[_0x546e('0xf')](_0x546e('0x10'),_0x341476,_0x546e('0xe'),JSON[_0x546e('0x11')](_0x74a168));if(_0x74a168[_0x546e('0x12')]){if(_0x74a168['error'][_0x546e('0x13')]===0x1f4){logger[_0x546e('0x12')]('ZendeskField,\x20%s,\x20%s',_0x341476,_0x74a168['error']['message']);return _0x1f4aac(_0x74a168[_0x546e('0x12')][_0x546e('0x14')]);}logger[_0x546e('0x12')](_0x546e('0x15'),_0x341476,_0x74a168['error'][_0x546e('0x14')]);return _0x2b0070(_0x74a168[_0x546e('0x12')][_0x546e('0x14')]);}else{logger[_0x546e('0xd')](_0x546e('0x15'),_0x341476,'request\x20sent');_0x2b0070(_0x74a168[_0x546e('0x16')][_0x546e('0x14')]);}})['catch'](function(_0x438870){logger['error']('ZendeskField,\x20%s,\x20%s',_0x341476,_0x438870);_0x1f4aac(_0x438870);});});} \ No newline at end of file +var _0x67ee=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1a07fe,_0x38d531){var _0xcb9a20=function(_0x107205){while(--_0x107205){_0x1a07fe['push'](_0x1a07fe['shift']());}};_0xcb9a20(++_0x38d531);}(_0x67ee,0x130));var _0xe67e=function(_0x154378,_0x276868){_0x154378=_0x154378-0x0;var _0x3bc041=_0x67ee[_0x154378];return _0x3bc041;};'use strict';var _=require('lodash');var util=require(_0xe67e('0x0'));var moment=require(_0xe67e('0x1'));var BPromise=require(_0xe67e('0x2'));var rs=require(_0xe67e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe67e('0x4'));var logger=require(_0xe67e('0x5'))(_0xe67e('0x6'));var config=require(_0xe67e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe67e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdc519e,_0x366f06,_0x3108fd){return new BPromise(function(_0x4c440a,_0x21ea22){return client[_0xe67e('0x9')](_0xdc519e,_0x3108fd)[_0xe67e('0xa')](function(_0x34c538){logger[_0xe67e('0xb')](_0xe67e('0xc'),_0x366f06,_0xe67e('0xd'));logger[_0xe67e('0xe')](_0xe67e('0xf'),_0x366f06,_0xe67e('0xd'),JSON[_0xe67e('0x10')](_0x34c538));if(_0x34c538[_0xe67e('0x11')]){if(_0x34c538[_0xe67e('0x11')][_0xe67e('0x12')]===0x1f4){logger['error'](_0xe67e('0xc'),_0x366f06,_0x34c538['error'][_0xe67e('0x13')]);return _0x21ea22(_0x34c538[_0xe67e('0x11')]['message']);}logger[_0xe67e('0x11')]('ZendeskField,\x20%s,\x20%s',_0x366f06,_0x34c538[_0xe67e('0x11')][_0xe67e('0x13')]);return _0x4c440a(_0x34c538['error'][_0xe67e('0x13')]);}else{logger['info'](_0xe67e('0xc'),_0x366f06,_0xe67e('0xd'));_0x4c440a(_0x34c538[_0xe67e('0x14')]['message']);}})[_0xe67e('0x15')](function(_0x59d9f8){logger['error']('ZendeskField,\x20%s,\x20%s',_0x366f06,_0x59d9f8);_0x21ea22(_0x59d9f8);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index aa51b89..3b66ae6 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 _0x82b2=['post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','/:id/fields','getFields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x82b2,0xcf));var _0x282b=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x82b2[_0x117f4c];return _0x2b24e9;};'use strict';var multer=require(_0x282b('0x0'));var util=require(_0x282b('0x1'));var path=require(_0x282b('0x2'));var timeout=require('connect-timeout');var express=require(_0x282b('0x3'));var router=express[_0x282b('0x4')]();var fs_extra=require(_0x282b('0x5'));var auth=require(_0x282b('0x6'));var interaction=require(_0x282b('0x7'));var config=require(_0x282b('0x8'));var controller=require(_0x282b('0x9'));router['get']('/',auth[_0x282b('0xa')](),controller[_0x282b('0xb')]);router['get'](_0x282b('0xc'),auth[_0x282b('0xa')](),controller[_0x282b('0xd')]);router[_0x282b('0xe')](_0x282b('0xf'),auth[_0x282b('0xa')](),controller['getConfigurations']);router[_0x282b('0xe')](_0x282b('0x10'),auth['isAuthenticated'](),controller[_0x282b('0x11')]);router[_0x282b('0x12')]('/',auth[_0x282b('0xa')](),controller['create']);router[_0x282b('0x12')](_0x282b('0xf'),auth[_0x282b('0xa')](),controller[_0x282b('0x13')]);router[_0x282b('0x14')](_0x282b('0xc'),auth['isAuthenticated'](),controller[_0x282b('0x15')]);router[_0x282b('0x16')]('/:id',auth[_0x282b('0xa')](),controller[_0x282b('0x17')]);module[_0x282b('0x18')]=router; \ No newline at end of file +var _0x7697=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getConfigurations','create','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4eb6c2,_0x42b912){var _0x3137d4=function(_0x1a8dba){while(--_0x1a8dba){_0x4eb6c2['push'](_0x4eb6c2['shift']());}};_0x3137d4(++_0x42b912);}(_0x7697,0x164));var _0x7769=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x7697[_0x285800];return _0x4b809e;};'use strict';var multer=require(_0x7769('0x0'));var util=require(_0x7769('0x1'));var path=require(_0x7769('0x2'));var timeout=require('connect-timeout');var express=require(_0x7769('0x3'));var router=express[_0x7769('0x4')]();var fs_extra=require(_0x7769('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7769('0x6'));var config=require(_0x7769('0x7'));var controller=require('./intZohoAccount.controller');router[_0x7769('0x8')]('/',auth[_0x7769('0x9')](),controller[_0x7769('0xa')]);router['get']('/:id',auth[_0x7769('0x9')](),controller['show']);router[_0x7769('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7769('0xb')]);router[_0x7769('0x8')]('/:id/fields',auth[_0x7769('0x9')](),controller['getFields']);router['post']('/',auth[_0x7769('0x9')](),controller[_0x7769('0xc')]);router[_0x7769('0xd')]('/:id/configurations',auth[_0x7769('0x9')](),controller[_0x7769('0xe')]);router[_0x7769('0xf')](_0x7769('0x10'),auth[_0x7769('0x9')](),controller[_0x7769('0x11')]);router[_0x7769('0x12')](_0x7769('0x10'),auth[_0x7769('0x9')](),controller[_0x7769('0x13')]);module[_0x7769('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 25982b1..494aed0 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 _0xd2ea=['sequelize','exports','STRING'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xd2ea,0x15f));var _0xad2e=function(_0x286669,_0x4d203e){_0x286669=_0x286669-0x0;var _0x42fbc2=_0xd2ea[_0x286669];return _0x42fbc2;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')]},'description':{'type':Sequelize[_0xad2e('0x2')]},'host':{'type':Sequelize[_0xad2e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad2e('0x2')]},'clientSecret':{'type':Sequelize[_0xad2e('0x2')]},'serverUrl':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xad2e('0x2')]},'refreshToken':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file +var _0x008c=['exports','STRING','sequelize'];(function(_0xd8e9f5,_0x29df60){var _0x4b915e=function(_0xb395cb){while(--_0xb395cb){_0xd8e9f5['push'](_0xd8e9f5['shift']());}};_0x4b915e(++_0x29df60);}(_0x008c,0x188));var _0xc008=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x008c[_0xa4b8e1];return _0x507e42;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'name':{'type':Sequelize[_0xc008('0x2')]},'description':{'type':Sequelize[_0xc008('0x2')]},'host':{'type':Sequelize[_0xc008('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc008('0x2')]},'clientSecret':{'type':Sequelize[_0xc008('0x2')]},'serverUrl':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xc008('0x2')]},'refreshToken':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 2abbd43..28a5996 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 _0xc697=['ZohoAccount','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','show','rawAttributes','length','include','find','catch','create','body','params','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','type','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','clientId','clientSecret','serverUrl','code','host','zoho.eu','com','slice','substring','lastIndexOf','GET','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','push','display_label','data_type','picklist','pick_list_values','statusCode','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x3806e6,_0x2f55d1){var _0x43aea8=function(_0x3c9928){while(--_0x3c9928){_0x3806e6['push'](_0x3806e6['shift']());}};_0x43aea8(++_0x2f55d1);}(_0xc697,0xd6));var _0x7c69=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xc697[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c69('0x0'));var zipdir=require(_0x7c69('0x1'));var jsonpatch=require(_0x7c69('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7c69('0x3'));var Mustache=require(_0x7c69('0x4'));var util=require(_0x7c69('0x5'));var path=require('path');var sox=require(_0x7c69('0x6'));var csv=require(_0x7c69('0x7'));var ejs=require(_0x7c69('0x8'));var fs=require('fs');var fs_extra=require(_0x7c69('0x9'));var _=require('lodash');var squel=require(_0x7c69('0xa'));var crypto=require(_0x7c69('0xb'));var jsforce=require(_0x7c69('0xc'));var deskjs=require(_0x7c69('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7c69('0xe'));var Papa=require(_0x7c69('0xf'));var Redis=require(_0x7c69('0x10'));var authService=require(_0x7c69('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7c69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c69('0x13'))(_0x7c69('0x14'));var utils=require(_0x7c69('0x15'));var config=require(_0x7c69('0x16'));var licenseUtil=require(_0x7c69('0x17'));var db=require(_0x7c69('0x18'))['db'];var integrations=require(_0x7c69('0x19'));function respondWithStatusCode(_0x172e2d,_0xc8cee3){_0xc8cee3=_0xc8cee3||0xcc;return function(_0x352a84){if(_0x352a84){return _0x172e2d['sendStatus'](_0xc8cee3);}return _0x172e2d[_0x7c69('0x1a')](_0xc8cee3)[_0x7c69('0x1b')]();};}function respondWithResult(_0x2d47b6,_0x14bd16){_0x14bd16=_0x14bd16||0xc8;return function(_0x32cc51){if(_0x32cc51){return _0x2d47b6[_0x7c69('0x1a')](_0x14bd16)[_0x7c69('0x1c')](_0x32cc51);}};}function respondWithFilteredResult(_0x3ed35b,_0x10d4ee){return function(_0x300f8b){if(_0x300f8b){var _0x536751=typeof _0x10d4ee[_0x7c69('0x1d')]===_0x7c69('0x1e')&&typeof _0x10d4ee['limit']===_0x7c69('0x1e');var _0x5af66b=_0x300f8b[_0x7c69('0x1f')];var _0x396d02=_0x536751?0x0:_0x10d4ee[_0x7c69('0x1d')];var _0x4095b0=_0x536751?_0x300f8b[_0x7c69('0x1f')]:_0x10d4ee['offset']+_0x10d4ee['limit'];var _0x3e52f9;if(_0x4095b0>=_0x5af66b){_0x4095b0=_0x5af66b;_0x3e52f9=0xc8;}else{_0x3e52f9=0xce;}_0x3ed35b[_0x7c69('0x1a')](_0x3e52f9);return _0x3ed35b[_0x7c69('0x20')](_0x7c69('0x21'),_0x396d02+'-'+_0x4095b0+'/'+_0x5af66b)[_0x7c69('0x1c')](_0x300f8b);}return null;};}function patchUpdates(_0x4a5fb6){return function(_0x1d3159){try{jsonpatch['apply'](_0x1d3159,_0x4a5fb6,!![]);}catch(_0x45a7f7){return BPromise[_0x7c69('0x22')](_0x45a7f7);}return _0x1d3159[_0x7c69('0x23')]();};}function saveUpdates(_0x1159df,_0x35b2d2){return function(_0x16c87){if(_0x16c87){return _0x16c87[_0x7c69('0x24')](_0x1159df)[_0x7c69('0x25')](function(_0x1006a5){return _0x1006a5;});}return null;};}function removeEntity(_0x173abf,_0x4f8df3){return function(_0x17db6a){if(_0x17db6a){return _0x17db6a[_0x7c69('0x26')]()[_0x7c69('0x25')](function(){_0x173abf[_0x7c69('0x1a')](0xcc)[_0x7c69('0x1b')]();});}};}function handleEntityNotFound(_0x5dae45,_0x58bc9e){return function(_0x5a4280){if(!_0x5a4280){_0x5dae45[_0x7c69('0x27')](0x194);}return _0x5a4280;};}function handleError(_0x1ccf9d,_0x44a9f8){_0x44a9f8=_0x44a9f8||0x1f4;return function(_0x106836){logger[_0x7c69('0x28')](_0x106836[_0x7c69('0x29')]);if(_0x106836[_0x7c69('0x2a')]){delete _0x106836[_0x7c69('0x2a')];}_0x1ccf9d['status'](_0x44a9f8)[_0x7c69('0x2b')](_0x106836);};}exports['index']=function(_0x161ef9,_0x40d244){var _0x546706={},_0x39c3b4={},_0x9944d9={'count':0x0,'rows':[]};var _0x337152=_['map'](db[_0x7c69('0x2c')]['rawAttributes'],function(_0x3934ca){return{'name':_0x3934ca[_0x7c69('0x2d')],'type':_0x3934ca['type'][_0x7c69('0x2e')]};});_0x39c3b4[_0x7c69('0x2f')]=_[_0x7c69('0x30')](_0x337152,_0x7c69('0x2a'));_0x39c3b4['query']=_[_0x7c69('0x31')](_0x161ef9[_0x7c69('0x32')]);_0x39c3b4[_0x7c69('0x33')]=_[_0x7c69('0x34')](_0x39c3b4[_0x7c69('0x2f')],_0x39c3b4[_0x7c69('0x32')]);_0x546706[_0x7c69('0x35')]=_['intersection'](_0x39c3b4[_0x7c69('0x2f')],qs[_0x7c69('0x36')](_0x161ef9[_0x7c69('0x32')]['fields']));_0x546706['attributes']=_0x546706[_0x7c69('0x35')]['length']?_0x546706['attributes']:_0x39c3b4[_0x7c69('0x2f')];if(!_0x161ef9['query'][_0x7c69('0x37')]('nolimit')){_0x546706[_0x7c69('0x38')]=qs[_0x7c69('0x38')](_0x161ef9['query'][_0x7c69('0x38')]);_0x546706['offset']=qs['offset'](_0x161ef9['query']['offset']);}_0x546706[_0x7c69('0x39')]=qs[_0x7c69('0x3a')](_0x161ef9['query'][_0x7c69('0x3a')]);_0x546706[_0x7c69('0x3b')]=qs[_0x7c69('0x33')](_[_0x7c69('0x3c')](_0x161ef9[_0x7c69('0x32')],_0x39c3b4[_0x7c69('0x33')]),_0x337152);if(_0x161ef9[_0x7c69('0x32')][_0x7c69('0x3d')]){_0x546706[_0x7c69('0x3b')]=_['merge'](_0x546706[_0x7c69('0x3b')],{'$or':_['map'](_0x337152,function(_0x23d56c){if(_0x23d56c['type']!=='VIRTUAL'){var _0x583f1b={};_0x583f1b[_0x23d56c[_0x7c69('0x2a')]]={'$like':'%'+_0x161ef9[_0x7c69('0x32')][_0x7c69('0x3d')]+'%'};return _0x583f1b;}})});}_0x546706=_[_0x7c69('0x3e')]({},_0x546706,_0x161ef9[_0x7c69('0x3f')]);var _0x3c41d8={'where':_0x546706[_0x7c69('0x3b')]};return db['ZohoAccount'][_0x7c69('0x1f')](_0x3c41d8)[_0x7c69('0x25')](function(_0x56efc2){_0x9944d9['count']=_0x56efc2;if(_0x161ef9['query']['includeAll']){_0x546706['include']=[{'all':!![]}];}return db[_0x7c69('0x2c')]['findAll'](_0x546706);})[_0x7c69('0x25')](function(_0x506669){_0x9944d9['rows']=_0x506669;return _0x9944d9;})[_0x7c69('0x25')](respondWithFilteredResult(_0x40d244,_0x546706))['catch'](handleError(_0x40d244,null));};exports[_0x7c69('0x40')]=function(_0x3fc1a1,_0xa0ab81){var _0x13843d={'raw':![],'where':{'id':_0x3fc1a1['params']['id']}},_0x173201={};_0x173201[_0x7c69('0x2f')]=_[_0x7c69('0x31')](db['ZohoAccount'][_0x7c69('0x41')]);_0x173201[_0x7c69('0x32')]=_[_0x7c69('0x31')](_0x3fc1a1['query']);_0x173201['filters']=_['intersection'](_0x173201[_0x7c69('0x2f')],_0x173201[_0x7c69('0x32')]);_0x13843d[_0x7c69('0x35')]=_[_0x7c69('0x34')](_0x173201[_0x7c69('0x2f')],qs[_0x7c69('0x36')](_0x3fc1a1[_0x7c69('0x32')][_0x7c69('0x36')]));_0x13843d[_0x7c69('0x35')]=_0x13843d[_0x7c69('0x35')][_0x7c69('0x42')]?_0x13843d['attributes']:_0x173201['model'];if(_0x3fc1a1['query']['includeAll']){_0x13843d[_0x7c69('0x43')]=[{'all':!![]}];}_0x13843d=_[_0x7c69('0x3e')]({},_0x13843d,_0x3fc1a1[_0x7c69('0x3f')]);return db[_0x7c69('0x2c')][_0x7c69('0x44')](_0x13843d)[_0x7c69('0x25')](handleEntityNotFound(_0xa0ab81,null))['then'](respondWithResult(_0xa0ab81,null))[_0x7c69('0x45')](handleError(_0xa0ab81,null));};exports[_0x7c69('0x46')]=function(_0x12e15f,_0x4f8f0c){return db[_0x7c69('0x2c')][_0x7c69('0x46')](_0x12e15f[_0x7c69('0x47')],{})[_0x7c69('0x25')](respondWithResult(_0x4f8f0c,0xc9))[_0x7c69('0x45')](handleError(_0x4f8f0c,null));};exports['update']=function(_0x2cf67d,_0x424c5d){if(_0x2cf67d[_0x7c69('0x47')]['id']){delete _0x2cf67d['body']['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x2cf67d[_0x7c69('0x48')]['id']}})['then'](handleEntityNotFound(_0x424c5d,null))[_0x7c69('0x25')](saveUpdates(_0x2cf67d['body'],null))['then'](respondWithResult(_0x424c5d,null))['catch'](handleError(_0x424c5d,null));};exports[_0x7c69('0x26')]=function(_0xcf1207,_0x228731){return db[_0x7c69('0x2c')][_0x7c69('0x44')]({'where':{'id':_0xcf1207[_0x7c69('0x48')]['id']}})[_0x7c69('0x25')](handleEntityNotFound(_0x228731,null))['then'](removeEntity(_0x228731,null))['catch'](handleError(_0x228731,null));};exports[_0x7c69('0x49')]=function(_0x5d4199,_0x4afd75,_0x4736ad){var _0x5e0c7e={};var _0x27bce1={};var _0x282d1b;var _0x827219;return db[_0x7c69('0x2c')][_0x7c69('0x4a')]({'where':{'id':_0x5d4199[_0x7c69('0x48')]['id']}})[_0x7c69('0x25')](handleEntityNotFound(_0x4afd75,null))[_0x7c69('0x25')](function(_0x114bf3){if(_0x114bf3){_0x282d1b=_0x114bf3;_0x27bce1['model']=_[_0x7c69('0x31')](db[_0x7c69('0x4b')]['rawAttributes']);_0x27bce1['query']=_[_0x7c69('0x31')](_0x5d4199[_0x7c69('0x32')]);_0x27bce1[_0x7c69('0x33')]=_[_0x7c69('0x34')](_0x27bce1[_0x7c69('0x2f')],_0x27bce1['query']);_0x5e0c7e[_0x7c69('0x35')]=_[_0x7c69('0x34')](_0x27bce1['model'],qs[_0x7c69('0x36')](_0x5d4199[_0x7c69('0x32')][_0x7c69('0x36')]));_0x5e0c7e[_0x7c69('0x35')]=_0x5e0c7e[_0x7c69('0x35')][_0x7c69('0x42')]?_0x5e0c7e[_0x7c69('0x35')]:_0x27bce1[_0x7c69('0x2f')];_0x5e0c7e[_0x7c69('0x39')]=qs['sort'](_0x5d4199['query'][_0x7c69('0x3a')]);_0x5e0c7e[_0x7c69('0x3b')]=qs[_0x7c69('0x33')](_['pick'](_0x5d4199[_0x7c69('0x32')],_0x27bce1[_0x7c69('0x33')]));if(_0x5d4199[_0x7c69('0x32')][_0x7c69('0x3d')]){_0x5e0c7e['where']=_['merge'](_0x5e0c7e[_0x7c69('0x3b')],{'$or':_[_0x7c69('0x30')](_0x5e0c7e[_0x7c69('0x35')],function(_0x4cb64d){var _0x1a2e3d={};_0x1a2e3d[_0x4cb64d]={'$like':'%'+_0x5d4199[_0x7c69('0x32')][_0x7c69('0x3d')]+'%'};return _0x1a2e3d;})});}_0x5e0c7e=_[_0x7c69('0x3e')]({},_0x5e0c7e,_0x5d4199[_0x7c69('0x3f')]);return _0x282d1b[_0x7c69('0x49')](_0x5e0c7e);}})[_0x7c69('0x25')](function(_0xa2dfd6){if(_0xa2dfd6){_0x827219=_0xa2dfd6[_0x7c69('0x42')];if(!_0x5d4199[_0x7c69('0x32')][_0x7c69('0x37')](_0x7c69('0x4c'))){_0x5e0c7e['limit']=qs['limit'](_0x5d4199[_0x7c69('0x32')][_0x7c69('0x38')]);_0x5e0c7e['offset']=qs['offset'](_0x5d4199[_0x7c69('0x32')][_0x7c69('0x1d')]);}return _0x282d1b[_0x7c69('0x49')](_0x5e0c7e);}})['then'](function(_0x21fb08){if(_0x21fb08){return _0x21fb08?{'count':_0x827219,'rows':_0x21fb08}:null;}})[_0x7c69('0x25')](respondWithResult(_0x4afd75,null))[_0x7c69('0x45')](handleError(_0x4afd75,null));};exports[_0x7c69('0x4d')]=function(_0x129d42,_0x3a4676,_0x127657){if(_0x129d42[_0x7c69('0x47')]['id']){delete _0x129d42[_0x7c69('0x47')]['id'];}return db['ZohoAccount'][_0x7c69('0x4a')]({'where':{'id':_0x129d42[_0x7c69('0x48')]['id']}})[_0x7c69('0x25')](handleEntityNotFound(_0x3a4676,null))[_0x7c69('0x25')](function(_0xab5ace){if(_0xab5ace){_0x129d42[_0x7c69('0x47')]['AccountId']=_0xab5ace['id'];_0x129d42[_0x7c69('0x47')][_0x7c69('0x4e')]=integrations['getSubjects'](_0x129d42['body'][_0x7c69('0x4f')],_0x129d42[_0x7c69('0x47')]['type']);_0x129d42[_0x7c69('0x47')][_0x7c69('0x50')]=integrations[_0x7c69('0x51')](_0x129d42[_0x7c69('0x47')][_0x7c69('0x4f')],_0x129d42[_0x7c69('0x47')][_0x7c69('0x52')]);return db[_0x7c69('0x4b')]['create'](_0x129d42[_0x7c69('0x47')],{'include':[{'model':db[_0x7c69('0x53')],'as':_0x7c69('0x4e')},{'model':db[_0x7c69('0x53')],'as':_0x7c69('0x50')}]});}return null;})[_0x7c69('0x25')](respondWithResult(_0x3a4676,null))[_0x7c69('0x45')](handleError(_0x3a4676,null));};function getAccessToken(_0x5bcd32){return new Promise(function(_0x1c7c02,_0x199c80){var _0x427a9b;switch(_0x5bcd32[_0x7c69('0x54')]){case'US':_0x427a9b=_0x7c69('0x55');break;case'AU':_0x427a9b=_0x7c69('0x56');break;case'EU':_0x427a9b=_0x7c69('0x57');break;case'IN':_0x427a9b=_0x7c69('0x58');break;case'CN':_0x427a9b='https://accounts.zoho.com.cn';break;default:_0x427a9b=_0x7c69('0x57');break;}var _0x5b843e={'method':_0x7c69('0x59'),'uri':_0x427a9b+_0x7c69('0x5a'),'qs':{'refresh_token':_0x5bcd32[_0x7c69('0x5b')],'client_id':_0x5bcd32['clientId'],'client_secret':_0x5bcd32['clientSecret'],'grant_type':_0x7c69('0x5c')},'json':!![]};return rp(_0x5b843e)[_0x7c69('0x25')](function(_0x2fd5f9){if(_0x2fd5f9[_0x7c69('0x5d')]){_0x1c7c02(_0x2fd5f9['access_token']);}else{_0x199c80(_0x7c69('0x5e'));}})['catch'](function(_0x30a4e5){_0x199c80(_0x30a4e5);});});}exports['getFields']=function(_0x1bae55,_0x255081,_0x5b4f04){var _0x5b641a,_0x335377,_0x1a5069,_0x32d029,_0x330caa;return db[_0x7c69('0x2c')][_0x7c69('0x4a')]({'where':{'id':_0x1bae55[_0x7c69('0x48')]['id']},'attributes':['id','host',_0x7c69('0x54'),_0x7c69('0x5f'),_0x7c69('0x60'),_0x7c69('0x61'),_0x7c69('0x62'),_0x7c69('0x5b')]})[_0x7c69('0x25')](handleEntityNotFound(_0x255081,null))['then'](function(_0x3f3b85){_0x330caa=_0x3f3b85;_0x5b641a=_0x330caa[_0x7c69('0x63')];_0x335377=_0x5b641a===_0x7c69('0x64')?'eu':_0x7c69('0x65');_0x1a5069=_0x330caa[_0x7c69('0x61')];var _0x18f433=_0x1a5069[_0x7c69('0x66')](-0x1);if(_0x18f433==='/'||_0x18f433==='\x5c'||_0x18f433===':'){_0x1a5069=_0x1a5069[_0x7c69('0x67')](0x0,_0x1a5069[_0x7c69('0x68')](_0x18f433));}if(!_0x330caa[_0x7c69('0x5b')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x330caa);})[_0x7c69('0x25')](function(_0x391652){if(_0x391652){return rp({'method':_0x7c69('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x335377),'qs':{'module':_0x7c69('0x6a')},'headers':{'Authorization':_0x7c69('0x6b')+_0x391652},'json':!![]});}})[_0x7c69('0x25')](function(_0x10a51d){if(_0x10a51d){if(_0x10a51d['response']&&_0x10a51d[_0x7c69('0x6c')][_0x7c69('0x28')]){throw new Error(_0x10a51d['response'][_0x7c69('0x28')][_0x7c69('0x6d')]);}var _0x4e8a6e=[];var _0x47613d=[];var _0x4d9a1f=[_0x7c69('0x6e'),_0x7c69('0x6f'),'Description',_0x7c69('0x70'),_0x7c69('0x71'),_0x7c69('0x72'),_0x7c69('0x73'),_0x7c69('0x74')];_0x47613d=_['remove'](_0x10a51d[_0x7c69('0x36')],function(_0x31eea5){return _0x4d9a1f[_0x7c69('0x75')](_0x31eea5[_0x7c69('0x76')]);});for(var _0x4d5dbe=0x0;_0x4d5dbe<_0x47613d[_0x7c69('0x42')];_0x4d5dbe++){if(_0x47613d[_0x4d5dbe]['system_mandatory']===![]){_0x4e8a6e[_0x7c69('0x77')]({'id':_0x47613d[_0x4d5dbe]['id'],'name':_0x47613d[_0x4d5dbe][_0x7c69('0x78')],'custom':_0x47613d[_0x4d5dbe]['custom_field'],'options':_0x47613d[_0x4d5dbe][_0x7c69('0x79')]===_0x7c69('0x7a')&&_0x47613d[_0x4d5dbe][_0x7c69('0x7b')][_0x7c69('0x42')]>-0x1?_[_0x7c69('0x30')](_0x47613d[_0x4d5dbe][_0x7c69('0x7b')],function(_0x5ae1dc){return{'name':_0x5ae1dc,'value':_0x5ae1dc};}):[]});}}return{'count':_0x4e8a6e[_0x7c69('0x42')],'rows':_0x4e8a6e};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x255081,null))[_0x7c69('0x45')](function(_0x21a777){var _0x15374b=_0x1bae55['query']['test']?0x1f4:_0x21a777[_0x7c69('0x7c')]||0x1f4;logger[_0x7c69('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x7c69('0x7d'),_0x15374b,JSON[_0x7c69('0x7e')](_0x21a777));delete _0x21a777[_0x7c69('0x2a')];if(_0x15374b===0x191){_0x15374b=0x190;}_0x255081[_0x7c69('0x1a')](_0x15374b)[_0x7c69('0x2b')](_0x1bae55[_0x7c69('0x32')][_0x7c69('0x7f')]?{'message':_0x7c69('0x80'),'statusCode':_0x21a777[_0x7c69('0x7c')]}:_0x21a777);});}; \ No newline at end of file +var _0x70bb=['refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','findOne','host','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','Call_Duration','Call_Start_Time','Call_Type','remove','api_name','push','display_label','custom_field','data_type','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','show','keys','intersection','catch','body','params','destroy','find','getConfigurations','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x70bb,0xa0));var _0xb70b=function(_0x3768f3,_0x4a40f1){_0x3768f3=_0x3768f3-0x0;var _0x526a13=_0x70bb[_0x3768f3];return _0x526a13;};'use strict';var emlformat=require(_0xb70b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb70b('0x1'));var jsonpatch=require(_0xb70b('0x2'));var rp=require('request-promise');var moment=require(_0xb70b('0x3'));var BPromise=require(_0xb70b('0x4'));var Mustache=require(_0xb70b('0x5'));var util=require(_0xb70b('0x6'));var path=require(_0xb70b('0x7'));var sox=require(_0xb70b('0x8'));var csv=require(_0xb70b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb70b('0xa'));var _=require(_0xb70b('0xb'));var squel=require(_0xb70b('0xc'));var crypto=require(_0xb70b('0xd'));var jsforce=require(_0xb70b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb70b('0x9'));var querystring=require(_0xb70b('0xf'));var Papa=require(_0xb70b('0x10'));var Redis=require('ioredis');var authService=require(_0xb70b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb70b('0x12'));var hardwareService=require(_0xb70b('0x13'));var logger=require(_0xb70b('0x14'))(_0xb70b('0x15'));var utils=require('../../config/utils');var config=require(_0xb70b('0x16'));var licenseUtil=require(_0xb70b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x24cbb2,_0x582790){_0x582790=_0x582790||0xcc;return function(_0x56ef53){if(_0x56ef53){return _0x24cbb2[_0xb70b('0x18')](_0x582790);}return _0x24cbb2[_0xb70b('0x19')](_0x582790)[_0xb70b('0x1a')]();};}function respondWithResult(_0x5ec124,_0x512f79){_0x512f79=_0x512f79||0xc8;return function(_0xbcd19f){if(_0xbcd19f){return _0x5ec124[_0xb70b('0x19')](_0x512f79)[_0xb70b('0x1b')](_0xbcd19f);}};}function respondWithFilteredResult(_0xb003c9,_0x3581f0){return function(_0x58a9d1){if(_0x58a9d1){var _0x168860=typeof _0x3581f0[_0xb70b('0x1c')]==='undefined'&&typeof _0x3581f0[_0xb70b('0x1d')]==='undefined';var _0x1a4598=_0x58a9d1[_0xb70b('0x1e')];var _0x307d0e=_0x168860?0x0:_0x3581f0[_0xb70b('0x1c')];var _0x22c613=_0x168860?_0x58a9d1[_0xb70b('0x1e')]:_0x3581f0[_0xb70b('0x1c')]+_0x3581f0[_0xb70b('0x1d')];var _0x341d02;if(_0x22c613>=_0x1a4598){_0x22c613=_0x1a4598;_0x341d02=0xc8;}else{_0x341d02=0xce;}_0xb003c9['status'](_0x341d02);return _0xb003c9[_0xb70b('0x1f')](_0xb70b('0x20'),_0x307d0e+'-'+_0x22c613+'/'+_0x1a4598)[_0xb70b('0x1b')](_0x58a9d1);}return null;};}function patchUpdates(_0x5df9a){return function(_0xc50281){try{jsonpatch[_0xb70b('0x21')](_0xc50281,_0x5df9a,!![]);}catch(_0x3d7ffe){return BPromise[_0xb70b('0x22')](_0x3d7ffe);}return _0xc50281['save']();};}function saveUpdates(_0x346650,_0x293dd2){return function(_0x34eebe){if(_0x34eebe){return _0x34eebe[_0xb70b('0x23')](_0x346650)[_0xb70b('0x24')](function(_0x545d3b){return _0x545d3b;});}return null;};}function removeEntity(_0x324f00,_0x5cbe87){return function(_0x1cb810){if(_0x1cb810){return _0x1cb810['destroy']()['then'](function(){_0x324f00[_0xb70b('0x19')](0xcc)[_0xb70b('0x1a')]();});}};}function handleEntityNotFound(_0x2a8974,_0x478581){return function(_0x4a75db){if(!_0x4a75db){_0x2a8974[_0xb70b('0x18')](0x194);}return _0x4a75db;};}function handleError(_0x1db798,_0x59d6b2){_0x59d6b2=_0x59d6b2||0x1f4;return function(_0x37cdb8){logger[_0xb70b('0x25')](_0x37cdb8['stack']);if(_0x37cdb8['name']){delete _0x37cdb8['name'];}_0x1db798[_0xb70b('0x19')](_0x59d6b2)[_0xb70b('0x26')](_0x37cdb8);};}exports[_0xb70b('0x27')]=function(_0x321972,_0x3c0981){var _0x108256={},_0x29d01d={},_0x3022c9={'count':0x0,'rows':[]};var _0x592728=_[_0xb70b('0x28')](db[_0xb70b('0x29')][_0xb70b('0x2a')],function(_0xafe524){return{'name':_0xafe524[_0xb70b('0x2b')],'type':_0xafe524[_0xb70b('0x2c')]['key']};});_0x29d01d[_0xb70b('0x2d')]=_[_0xb70b('0x28')](_0x592728,'name');_0x29d01d[_0xb70b('0x2e')]=_['keys'](_0x321972[_0xb70b('0x2e')]);_0x29d01d[_0xb70b('0x2f')]=_['intersection'](_0x29d01d[_0xb70b('0x2d')],_0x29d01d[_0xb70b('0x2e')]);_0x108256[_0xb70b('0x30')]=_['intersection'](_0x29d01d['model'],qs[_0xb70b('0x31')](_0x321972['query']['fields']));_0x108256['attributes']=_0x108256['attributes'][_0xb70b('0x32')]?_0x108256[_0xb70b('0x30')]:_0x29d01d[_0xb70b('0x2d')];if(!_0x321972[_0xb70b('0x2e')][_0xb70b('0x33')](_0xb70b('0x34'))){_0x108256[_0xb70b('0x1d')]=qs[_0xb70b('0x1d')](_0x321972[_0xb70b('0x2e')][_0xb70b('0x1d')]);_0x108256[_0xb70b('0x1c')]=qs[_0xb70b('0x1c')](_0x321972['query']['offset']);}_0x108256[_0xb70b('0x35')]=qs[_0xb70b('0x36')](_0x321972['query'][_0xb70b('0x36')]);_0x108256[_0xb70b('0x37')]=qs[_0xb70b('0x2f')](_[_0xb70b('0x38')](_0x321972['query'],_0x29d01d[_0xb70b('0x2f')]),_0x592728);if(_0x321972[_0xb70b('0x2e')][_0xb70b('0x39')]){_0x108256['where']=_[_0xb70b('0x3a')](_0x108256[_0xb70b('0x37')],{'$or':_[_0xb70b('0x28')](_0x592728,function(_0x553b32){if(_0x553b32[_0xb70b('0x2c')]!==_0xb70b('0x3b')){var _0x351969={};_0x351969[_0x553b32[_0xb70b('0x3c')]]={'$like':'%'+_0x321972['query'][_0xb70b('0x39')]+'%'};return _0x351969;}})});}_0x108256=_[_0xb70b('0x3a')]({},_0x108256,_0x321972[_0xb70b('0x3d')]);var _0x11dcb1={'where':_0x108256[_0xb70b('0x37')]};return db['ZohoAccount'][_0xb70b('0x1e')](_0x11dcb1)[_0xb70b('0x24')](function(_0x4180dc){_0x3022c9[_0xb70b('0x1e')]=_0x4180dc;if(_0x321972[_0xb70b('0x2e')][_0xb70b('0x3e')]){_0x108256[_0xb70b('0x3f')]=[{'all':!![]}];}return db['ZohoAccount'][_0xb70b('0x40')](_0x108256);})['then'](function(_0x1e07ad){_0x3022c9['rows']=_0x1e07ad;return _0x3022c9;})[_0xb70b('0x24')](respondWithFilteredResult(_0x3c0981,_0x108256))['catch'](handleError(_0x3c0981,null));};exports[_0xb70b('0x41')]=function(_0x36bd3c,_0x2cbab7){var _0x248ef4={'raw':![],'where':{'id':_0x36bd3c['params']['id']}},_0x2691d1={};_0x2691d1[_0xb70b('0x2d')]=_[_0xb70b('0x42')](db[_0xb70b('0x29')][_0xb70b('0x2a')]);_0x2691d1[_0xb70b('0x2e')]=_[_0xb70b('0x42')](_0x36bd3c[_0xb70b('0x2e')]);_0x2691d1['filters']=_[_0xb70b('0x43')](_0x2691d1[_0xb70b('0x2d')],_0x2691d1['query']);_0x248ef4[_0xb70b('0x30')]=_[_0xb70b('0x43')](_0x2691d1[_0xb70b('0x2d')],qs[_0xb70b('0x31')](_0x36bd3c[_0xb70b('0x2e')][_0xb70b('0x31')]));_0x248ef4[_0xb70b('0x30')]=_0x248ef4[_0xb70b('0x30')]['length']?_0x248ef4[_0xb70b('0x30')]:_0x2691d1[_0xb70b('0x2d')];if(_0x36bd3c[_0xb70b('0x2e')]['includeAll']){_0x248ef4[_0xb70b('0x3f')]=[{'all':!![]}];}_0x248ef4=_[_0xb70b('0x3a')]({},_0x248ef4,_0x36bd3c['options']);return db['ZohoAccount']['find'](_0x248ef4)[_0xb70b('0x24')](handleEntityNotFound(_0x2cbab7,null))[_0xb70b('0x24')](respondWithResult(_0x2cbab7,null))[_0xb70b('0x44')](handleError(_0x2cbab7,null));};exports['create']=function(_0x4ddc74,_0x508276){return db[_0xb70b('0x29')]['create'](_0x4ddc74[_0xb70b('0x45')],{})['then'](respondWithResult(_0x508276,0xc9))[_0xb70b('0x44')](handleError(_0x508276,null));};exports[_0xb70b('0x23')]=function(_0x299a92,_0x52611f){if(_0x299a92[_0xb70b('0x45')]['id']){delete _0x299a92['body']['id'];}return db[_0xb70b('0x29')]['find']({'where':{'id':_0x299a92[_0xb70b('0x46')]['id']}})['then'](handleEntityNotFound(_0x52611f,null))['then'](saveUpdates(_0x299a92[_0xb70b('0x45')],null))['then'](respondWithResult(_0x52611f,null))['catch'](handleError(_0x52611f,null));};exports[_0xb70b('0x47')]=function(_0x3d085b,_0x3cbd1d){return db[_0xb70b('0x29')][_0xb70b('0x48')]({'where':{'id':_0x3d085b['params']['id']}})[_0xb70b('0x24')](handleEntityNotFound(_0x3cbd1d,null))[_0xb70b('0x24')](removeEntity(_0x3cbd1d,null))[_0xb70b('0x44')](handleError(_0x3cbd1d,null));};exports[_0xb70b('0x49')]=function(_0x5899cd,_0x5d01a2,_0x301b37){var _0x311993={};var _0x2b95f6={};var _0x1bdbae;var _0x545b68;return db[_0xb70b('0x29')]['findOne']({'where':{'id':_0x5899cd[_0xb70b('0x46')]['id']}})[_0xb70b('0x24')](handleEntityNotFound(_0x5d01a2,null))[_0xb70b('0x24')](function(_0x3a0e73){if(_0x3a0e73){_0x1bdbae=_0x3a0e73;_0x2b95f6[_0xb70b('0x2d')]=_['keys'](db[_0xb70b('0x4a')][_0xb70b('0x2a')]);_0x2b95f6[_0xb70b('0x2e')]=_[_0xb70b('0x42')](_0x5899cd[_0xb70b('0x2e')]);_0x2b95f6[_0xb70b('0x2f')]=_[_0xb70b('0x43')](_0x2b95f6[_0xb70b('0x2d')],_0x2b95f6[_0xb70b('0x2e')]);_0x311993[_0xb70b('0x30')]=_['intersection'](_0x2b95f6[_0xb70b('0x2d')],qs[_0xb70b('0x31')](_0x5899cd['query'][_0xb70b('0x31')]));_0x311993[_0xb70b('0x30')]=_0x311993[_0xb70b('0x30')][_0xb70b('0x32')]?_0x311993['attributes']:_0x2b95f6[_0xb70b('0x2d')];_0x311993['order']=qs[_0xb70b('0x36')](_0x5899cd[_0xb70b('0x2e')][_0xb70b('0x36')]);_0x311993['where']=qs['filters'](_['pick'](_0x5899cd[_0xb70b('0x2e')],_0x2b95f6[_0xb70b('0x2f')]));if(_0x5899cd[_0xb70b('0x2e')][_0xb70b('0x39')]){_0x311993[_0xb70b('0x37')]=_['merge'](_0x311993[_0xb70b('0x37')],{'$or':_[_0xb70b('0x28')](_0x311993['attributes'],function(_0x33e240){var _0x4112c0={};_0x4112c0[_0x33e240]={'$like':'%'+_0x5899cd[_0xb70b('0x2e')][_0xb70b('0x39')]+'%'};return _0x4112c0;})});}_0x311993=_[_0xb70b('0x3a')]({},_0x311993,_0x5899cd['options']);return _0x1bdbae['getConfigurations'](_0x311993);}})['then'](function(_0x594b2c){if(_0x594b2c){_0x545b68=_0x594b2c[_0xb70b('0x32')];if(!_0x5899cd['query']['hasOwnProperty'](_0xb70b('0x34'))){_0x311993[_0xb70b('0x1d')]=qs['limit'](_0x5899cd[_0xb70b('0x2e')][_0xb70b('0x1d')]);_0x311993[_0xb70b('0x1c')]=qs['offset'](_0x5899cd['query'][_0xb70b('0x1c')]);}return _0x1bdbae[_0xb70b('0x49')](_0x311993);}})[_0xb70b('0x24')](function(_0x756d62){if(_0x756d62){return _0x756d62?{'count':_0x545b68,'rows':_0x756d62}:null;}})['then'](respondWithResult(_0x5d01a2,null))[_0xb70b('0x44')](handleError(_0x5d01a2,null));};exports[_0xb70b('0x4b')]=function(_0x57ea4a,_0x4d90c5,_0x2e9645){if(_0x57ea4a['body']['id']){delete _0x57ea4a[_0xb70b('0x45')]['id'];}return db[_0xb70b('0x29')]['findOne']({'where':{'id':_0x57ea4a['params']['id']}})[_0xb70b('0x24')](handleEntityNotFound(_0x4d90c5,null))[_0xb70b('0x24')](function(_0x91ac7b){if(_0x91ac7b){_0x57ea4a[_0xb70b('0x45')][_0xb70b('0x4c')]=_0x91ac7b['id'];_0x57ea4a[_0xb70b('0x45')][_0xb70b('0x4d')]=integrations[_0xb70b('0x4e')](_0x57ea4a[_0xb70b('0x45')][_0xb70b('0x4f')],_0x57ea4a[_0xb70b('0x45')][_0xb70b('0x2c')]);_0x57ea4a[_0xb70b('0x45')][_0xb70b('0x50')]=integrations[_0xb70b('0x51')](_0x57ea4a['body']['channel'],_0x57ea4a['body'][_0xb70b('0x2c')]);return db['ZohoConfiguration'][_0xb70b('0x52')](_0x57ea4a[_0xb70b('0x45')],{'include':[{'model':db[_0xb70b('0x53')],'as':'Subjects'},{'model':db[_0xb70b('0x53')],'as':_0xb70b('0x50')}]});}return null;})[_0xb70b('0x24')](respondWithResult(_0x4d90c5,null))[_0xb70b('0x44')](handleError(_0x4d90c5,null));};function getAccessToken(_0x50f1e0){return new Promise(function(_0x279581,_0xecc97){var _0x51a3cd;switch(_0x50f1e0[_0xb70b('0x54')]){case'US':_0x51a3cd=_0xb70b('0x55');break;case'AU':_0x51a3cd='https://accounts.zoho.com.au';break;case'EU':_0x51a3cd='https://accounts.zoho.eu';break;case'IN':_0x51a3cd=_0xb70b('0x56');break;case'CN':_0x51a3cd=_0xb70b('0x57');break;default:_0x51a3cd='https://accounts.zoho.eu';break;}var _0x53a1fd={'method':'POST','uri':_0x51a3cd+_0xb70b('0x58'),'qs':{'refresh_token':_0x50f1e0[_0xb70b('0x59')],'client_id':_0x50f1e0[_0xb70b('0x5a')],'client_secret':_0x50f1e0[_0xb70b('0x5b')],'grant_type':_0xb70b('0x5c')},'json':!![]};return rp(_0x53a1fd)[_0xb70b('0x24')](function(_0x597265){if(_0x597265[_0xb70b('0x5d')]){_0x279581(_0x597265[_0xb70b('0x5d')]);}else{_0xecc97(_0xb70b('0x5e'));}})[_0xb70b('0x44')](function(_0xaa2b81){_0xecc97(_0xaa2b81);});});}exports['getFields']=function(_0x7339d,_0x3b5b4c,_0xa884c6){var _0x321911,_0x2a16d5,_0x17c75f,_0x777821,_0x1f56fd;return db[_0xb70b('0x29')][_0xb70b('0x5f')]({'where':{'id':_0x7339d[_0xb70b('0x46')]['id']},'attributes':['id',_0xb70b('0x60'),_0xb70b('0x54'),_0xb70b('0x5a'),_0xb70b('0x5b'),_0xb70b('0x61'),_0xb70b('0x62'),'refreshToken']})['then'](handleEntityNotFound(_0x3b5b4c,null))[_0xb70b('0x24')](function(_0x21d7b2){_0x1f56fd=_0x21d7b2;_0x321911=_0x1f56fd[_0xb70b('0x60')];_0x2a16d5=_0x321911==='zoho.eu'?'eu':_0xb70b('0x63');_0x17c75f=_0x1f56fd[_0xb70b('0x61')];var _0x5a34b3=_0x17c75f[_0xb70b('0x64')](-0x1);if(_0x5a34b3==='/'||_0x5a34b3==='\x5c'||_0x5a34b3===':'){_0x17c75f=_0x17c75f[_0xb70b('0x65')](0x0,_0x17c75f[_0xb70b('0x66')](_0x5a34b3));}if(!_0x1f56fd[_0xb70b('0x59')]){throw new Error(_0xb70b('0x67'));}return getAccessToken(_0x1f56fd);})['then'](function(_0x2e58f5){if(_0x2e58f5){return rp({'method':_0xb70b('0x68'),'uri':util[_0xb70b('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2a16d5),'qs':{'module':_0xb70b('0x6a')},'headers':{'Authorization':_0xb70b('0x6b')+_0x2e58f5},'json':!![]});}})[_0xb70b('0x24')](function(_0xd4bc5a){if(_0xd4bc5a){if(_0xd4bc5a[_0xb70b('0x6c')]&&_0xd4bc5a[_0xb70b('0x6c')][_0xb70b('0x25')]){throw new Error(_0xd4bc5a[_0xb70b('0x6c')][_0xb70b('0x25')][_0xb70b('0x6d')]);}var _0x41caa0=[];var _0x23a5b9=[];var _0x490f0b=['Owner',_0xb70b('0x6e'),_0xb70b('0x6f'),'WhoId',_0xb70b('0x70'),'Call_Result',_0xb70b('0x71'),_0xb70b('0x72')];_0x23a5b9=_[_0xb70b('0x73')](_0xd4bc5a['fields'],function(_0x5da874){return _0x490f0b['includes'](_0x5da874[_0xb70b('0x74')]);});for(var _0x15be3b=0x0;_0x15be3b<_0x23a5b9[_0xb70b('0x32')];_0x15be3b++){if(_0x23a5b9[_0x15be3b]['system_mandatory']===![]){_0x41caa0[_0xb70b('0x75')]({'id':_0x23a5b9[_0x15be3b]['id'],'name':_0x23a5b9[_0x15be3b][_0xb70b('0x76')],'custom':_0x23a5b9[_0x15be3b][_0xb70b('0x77')],'options':_0x23a5b9[_0x15be3b][_0xb70b('0x78')]==='picklist'&&_0x23a5b9[_0x15be3b]['pick_list_values']['length']>-0x1?_[_0xb70b('0x28')](_0x23a5b9[_0x15be3b]['pick_list_values'],function(_0x56a55b){return{'name':_0x56a55b,'value':_0x56a55b};}):[]});}}return{'count':_0x41caa0[_0xb70b('0x32')],'rows':_0x41caa0};}else{return{'count':0x0,'rows':[]};}})[_0xb70b('0x24')](respondWithResult(_0x3b5b4c,null))[_0xb70b('0x44')](function(_0x29d8a4){var _0x79564=_0x7339d[_0xb70b('0x2e')][_0xb70b('0x79')]?0x1f4:_0x29d8a4['statusCode']||0x1f4;logger[_0xb70b('0x25')](_0xb70b('0x7a'),'getFields',_0x79564,JSON[_0xb70b('0x7b')](_0x29d8a4));delete _0x29d8a4[_0xb70b('0x3c')];if(_0x79564===0x191){_0x79564=0x190;}_0x3b5b4c[_0xb70b('0x19')](_0x79564)['send'](_0x7339d[_0xb70b('0x2e')][_0xb70b('0x79')]?{'message':_0xb70b('0x7c'),'statusCode':_0x29d8a4[_0xb70b('0x7d')]}:_0x29d8a4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index bdae4d3..9d96b20 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 _0x36b2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','then','parse','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.au','https://accounts.zoho.in','code','info','lodash','util'];(function(_0x5d9031,_0x301fe2){var _0x4f2478=function(_0x215f94){while(--_0x215f94){_0x5d9031['push'](_0x5d9031['shift']());}};_0x4f2478(++_0x301fe2);}(_0x36b2,0x132));var _0x236b=function(_0x9f77,_0x4ae99b){_0x9f77=_0x9f77-0x0;var _0x8d2fa6=_0x36b2[_0x9f77];return _0x8d2fa6;};'use strict';var _=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var logger=require(_0x236b('0x2'))(_0x236b('0x3'));var moment=require('moment');var BPromise=require(_0x236b('0x4'));var rp=require(_0x236b('0x5'));var fs=require('fs');var path=require(_0x236b('0x6'));var rimraf=require(_0x236b('0x7'));var config=require(_0x236b('0x8'));var attributes=require(_0x236b('0x9'));var integrations=require(_0x236b('0xa'));module[_0x236b('0xb')]=function(_0x1dad6f,_0x422b34){return _0x1dad6f[_0x236b('0xc')](_0x236b('0xd'),attributes,{'tableName':_0x236b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a517c,_0x2b55d3,_0x1afc7a){if(_0x3a517c[_0x236b('0xf')](_0x236b('0x10'))||_0x3a517c[_0x236b('0xf')](_0x236b('0x11'))||_0x3a517c[_0x236b('0xf')](_0x236b('0x12'))||_0x3a517c['changed'](_0x236b('0x13'))||_0x3a517c['changed']('code')||_0x3a517c[_0x236b('0xf')](_0x236b('0x14'))){var _0x28f814,_0x1bc7ba;_0x28f814=_0x3a517c[_0x236b('0x11')];var _0x5ba1d1=_0x28f814[_0x236b('0x15')](-0x1);if(_0x5ba1d1==='/'||_0x5ba1d1==='\x5c'||_0x5ba1d1===':'){_0x28f814=_0x28f814[_0x236b('0x16')](0x0,_0x28f814[_0x236b('0x17')](_0x5ba1d1));}switch(_0x3a517c[_0x236b('0x10')]){case'US':_0x1bc7ba=_0x236b('0x18');break;case'AU':_0x1bc7ba='https://accounts.zoho.com.au';break;case'IN':_0x1bc7ba='https://accounts.zoho.in';break;case'CN':_0x1bc7ba=_0x236b('0x19');break;default:_0x1bc7ba='https://accounts.zoho.eu';break;}var _0x11e444={'method':_0x236b('0x1a'),'uri':_0x1bc7ba+_0x236b('0x1b'),'form':{'grant_type':_0x236b('0x1c'),'client_id':_0x3a517c[_0x236b('0x12')],'client_secret':_0x3a517c[_0x236b('0x13')],'redirect_uri':_0x3a517c[_0x236b('0x11')],'code':_0x3a517c['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x11e444)[_0x236b('0x1d')](function(_0xa25628){var _0x232e06=JSON[_0x236b('0x1e')](_0xa25628);if(_0x232e06['refresh_token']){_0x3a517c[_0x236b('0x1f')]=_0x232e06[_0x236b('0x20')];logger['info'](util[_0x236b('0x21')](_0x236b('0x22'),_0x3a517c[_0x236b('0x23')],_0x3a517c['id']));}else{logger[_0x236b('0x24')](util[_0x236b('0x21')](_0x236b('0x25'),_0x3a517c[_0x236b('0x23')],_0x3a517c['id']),util[_0x236b('0x26')](_0x232e06,{'showHidden':![],'depth':null}));}return _0x1afc7a(null,_0x2b55d3);})[_0x236b('0x27')](function(_0x55404b){logger['error'](util['format'](_0x236b('0x25'),_0x3a517c[_0x236b('0x23')],_0x3a517c['id']),util[_0x236b('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1afc7a(_0x55404b);});}else{return _0x1afc7a(null,_0x2b55d3);}},'beforeUpdate':function(_0x552f88,_0x4d6b25,_0x314bf7){if(_0x552f88[_0x236b('0xf')](_0x236b('0x10'))||_0x552f88[_0x236b('0xf')](_0x236b('0x11'))||_0x552f88[_0x236b('0xf')](_0x236b('0x12'))||_0x552f88['changed'](_0x236b('0x13'))||_0x552f88[_0x236b('0xf')]('code')||_0x552f88[_0x236b('0xf')](_0x236b('0x14'))){var _0x336e7c,_0x57e73d;_0x336e7c=_0x552f88[_0x236b('0x11')];var _0x11ffe7=_0x336e7c[_0x236b('0x15')](-0x1);if(_0x11ffe7==='/'||_0x11ffe7==='\x5c'||_0x11ffe7===':'){_0x336e7c=_0x336e7c[_0x236b('0x16')](0x0,_0x336e7c[_0x236b('0x17')](_0x11ffe7));}switch(_0x552f88[_0x236b('0x10')]){case'US':_0x57e73d='https://accounts.zoho.com';break;case'AU':_0x57e73d=_0x236b('0x28');break;case'IN':_0x57e73d=_0x236b('0x29');break;case'CN':_0x57e73d=_0x236b('0x19');break;default:_0x57e73d='https://accounts.zoho.eu';break;}var _0x57e4d4={'method':'POST','uri':_0x57e73d+_0x236b('0x1b'),'form':{'grant_type':_0x236b('0x1c'),'client_id':_0x552f88[_0x236b('0x12')],'client_secret':_0x552f88['clientSecret'],'redirect_uri':_0x552f88[_0x236b('0x11')],'code':_0x552f88[_0x236b('0x2a')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x57e4d4)[_0x236b('0x1d')](function(_0xb13bf7){var _0x1e719c=JSON[_0x236b('0x1e')](_0xb13bf7);if(_0x1e719c[_0x236b('0x20')]){_0x552f88['refreshToken']=_0x1e719c[_0x236b('0x20')];logger[_0x236b('0x2b')](util[_0x236b('0x21')](_0x236b('0x22'),_0x552f88['name'],_0x552f88['id']));}else{logger[_0x236b('0x24')](util['format'](_0x236b('0x25'),_0x552f88[_0x236b('0x23')],_0x552f88['id']),util[_0x236b('0x26')](_0x1e719c,{'showHidden':![],'depth':null}));}return _0x314bf7(null,_0x4d6b25);})[_0x236b('0x27')](function(_0x144477){logger[_0x236b('0x24')](util[_0x236b('0x21')](_0x236b('0x25'),_0x552f88['name'],_0x552f88['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x314bf7(_0x144477);});}else{return _0x314bf7(null,_0x4d6b25);}}}});}; \ No newline at end of file +var _0x6cf2=['code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','catch','substring','https://accounts.zoho.com.au','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId'];(function(_0x3a6c37,_0x5d98af){var _0x51e651=function(_0x30df89){while(--_0x30df89){_0x3a6c37['push'](_0x3a6c37['shift']());}};_0x51e651(++_0x5d98af);}(_0x6cf2,0x70));var _0x26cf=function(_0x386d31,_0x5a1390){_0x386d31=_0x386d31-0x0;var _0x31c113=_0x6cf2[_0x386d31];return _0x31c113;};'use strict';var _=require(_0x26cf('0x0'));var util=require('util');var logger=require(_0x26cf('0x1'))('api');var moment=require('moment');var BPromise=require(_0x26cf('0x2'));var rp=require(_0x26cf('0x3'));var fs=require('fs');var path=require(_0x26cf('0x4'));var rimraf=require(_0x26cf('0x5'));var config=require(_0x26cf('0x6'));var attributes=require(_0x26cf('0x7'));var integrations=require(_0x26cf('0x8'));module[_0x26cf('0x9')]=function(_0x4def4b,_0x26a54c){return _0x4def4b[_0x26cf('0xa')](_0x26cf('0xb'),attributes,{'tableName':_0x26cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x551cab,_0x181242,_0x16f8c4){if(_0x551cab[_0x26cf('0xd')](_0x26cf('0xe'))||_0x551cab[_0x26cf('0xd')](_0x26cf('0xf'))||_0x551cab[_0x26cf('0xd')](_0x26cf('0x10'))||_0x551cab[_0x26cf('0xd')]('clientSecret')||_0x551cab['changed'](_0x26cf('0x11'))||_0x551cab[_0x26cf('0xd')](_0x26cf('0x12'))){var _0x153237,_0x2c3e5b;_0x153237=_0x551cab[_0x26cf('0xf')];var _0x189428=_0x153237[_0x26cf('0x13')](-0x1);if(_0x189428==='/'||_0x189428==='\x5c'||_0x189428===':'){_0x153237=_0x153237['substring'](0x0,_0x153237[_0x26cf('0x14')](_0x189428));}switch(_0x551cab[_0x26cf('0xe')]){case'US':_0x2c3e5b=_0x26cf('0x15');break;case'AU':_0x2c3e5b='https://accounts.zoho.com.au';break;case'IN':_0x2c3e5b=_0x26cf('0x16');break;case'CN':_0x2c3e5b=_0x26cf('0x17');break;default:_0x2c3e5b=_0x26cf('0x18');break;}var _0x9de358={'method':_0x26cf('0x19'),'uri':_0x2c3e5b+_0x26cf('0x1a'),'form':{'grant_type':_0x26cf('0x1b'),'client_id':_0x551cab[_0x26cf('0x10')],'client_secret':_0x551cab[_0x26cf('0x1c')],'redirect_uri':_0x551cab[_0x26cf('0xf')],'code':_0x551cab[_0x26cf('0x11')]},'headers':{'Content-Type':_0x26cf('0x1d')}};return rp(_0x9de358)[_0x26cf('0x1e')](function(_0x25528e){var _0xcbeedb=JSON[_0x26cf('0x1f')](_0x25528e);if(_0xcbeedb['refresh_token']){_0x551cab['refreshToken']=_0xcbeedb[_0x26cf('0x20')];logger[_0x26cf('0x21')](util['format'](_0x26cf('0x22'),_0x551cab[_0x26cf('0x23')],_0x551cab['id']));}else{logger[_0x26cf('0x24')](util[_0x26cf('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x551cab[_0x26cf('0x23')],_0x551cab['id']),util[_0x26cf('0x26')](_0xcbeedb,{'showHidden':![],'depth':null}));}return _0x16f8c4(null,_0x181242);})[_0x26cf('0x27')](function(_0x4a4938){logger['error'](util[_0x26cf('0x25')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x551cab[_0x26cf('0x23')],_0x551cab['id']),util[_0x26cf('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x16f8c4(_0x4a4938);});}else{return _0x16f8c4(null,_0x181242);}},'beforeUpdate':function(_0x52b793,_0x580227,_0x35bfbc){if(_0x52b793[_0x26cf('0xd')](_0x26cf('0xe'))||_0x52b793['changed'](_0x26cf('0xf'))||_0x52b793[_0x26cf('0xd')](_0x26cf('0x10'))||_0x52b793[_0x26cf('0xd')](_0x26cf('0x1c'))||_0x52b793['changed']('code')||_0x52b793[_0x26cf('0xd')](_0x26cf('0x12'))){var _0x4611f0,_0x3adbef;_0x4611f0=_0x52b793[_0x26cf('0xf')];var _0x190902=_0x4611f0[_0x26cf('0x13')](-0x1);if(_0x190902==='/'||_0x190902==='\x5c'||_0x190902===':'){_0x4611f0=_0x4611f0[_0x26cf('0x28')](0x0,_0x4611f0[_0x26cf('0x14')](_0x190902));}switch(_0x52b793['zone']){case'US':_0x3adbef=_0x26cf('0x15');break;case'AU':_0x3adbef=_0x26cf('0x29');break;case'IN':_0x3adbef='https://accounts.zoho.in';break;case'CN':_0x3adbef=_0x26cf('0x17');break;default:_0x3adbef='https://accounts.zoho.eu';break;}var _0x3dde5b={'method':_0x26cf('0x19'),'uri':_0x3adbef+_0x26cf('0x1a'),'form':{'grant_type':_0x26cf('0x1b'),'client_id':_0x52b793[_0x26cf('0x10')],'client_secret':_0x52b793[_0x26cf('0x1c')],'redirect_uri':_0x52b793[_0x26cf('0xf')],'code':_0x52b793['code']},'headers':{'Content-Type':_0x26cf('0x1d')}};return rp(_0x3dde5b)[_0x26cf('0x1e')](function(_0x41c2d5){var _0x6372b6=JSON['parse'](_0x41c2d5);if(_0x6372b6[_0x26cf('0x20')]){_0x52b793['refreshToken']=_0x6372b6[_0x26cf('0x20')];logger[_0x26cf('0x21')](util[_0x26cf('0x25')](_0x26cf('0x22'),_0x52b793[_0x26cf('0x23')],_0x52b793['id']));}else{logger[_0x26cf('0x24')](util[_0x26cf('0x25')](_0x26cf('0x2a'),_0x52b793['name'],_0x52b793['id']),util[_0x26cf('0x26')](_0x6372b6,{'showHidden':![],'depth':null}));}return _0x35bfbc(null,_0x580227);})[_0x26cf('0x27')](function(_0x1d147c){logger[_0x26cf('0x24')](util[_0x26cf('0x25')](_0x26cf('0x2a'),_0x52b793['name'],_0x52b793['id']),util[_0x26cf('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x35bfbc(_0x1d147c);});}else{return _0x35bfbc(null,_0x580227);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index a4d36ea..09845ce 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 _0x5713=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','model','attributes','map','find','raw','ShowZohoAccount','stringify','catch'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x5713,0x1c7));var _0x3571=function(_0x3244c0,_0x3e3dc0){_0x3244c0=_0x3244c0-0x0;var _0x15938f=_0x5713[_0x3244c0];return _0x15938f;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var moment=require('moment');var BPromise=require(_0x3571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3571('0x3'));var db=require(_0x3571('0x4'))['db'];var utils=require(_0x3571('0x5'));var logger=require(_0x3571('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3571('0x7'));var client=jayson[_0x3571('0x8')][_0x3571('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432a48,_0x3a6f29,_0x1f8f0f){return new BPromise(function(_0x48b06d,_0x358ba1){return client[_0x3571('0xa')](_0x432a48,_0x1f8f0f)[_0x3571('0xb')](function(_0x288fc8){logger[_0x3571('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x3a6f29,'request\x20sent');logger[_0x3571('0xd')](_0x3571('0xe'),_0x3a6f29,_0x3571('0xf'),JSON['stringify'](_0x288fc8));if(_0x288fc8['error']){if(_0x288fc8['error']['code']===0x1f4){logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x358ba1(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x48b06d(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}else{logger[_0x3571('0xc')](_0x3571('0x11'),_0x3a6f29,_0x3571('0xf'));_0x48b06d(_0x288fc8[_0x3571('0x13')]['message']);}})['catch'](function(_0x48c77e){logger[_0x3571('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3a6f29,_0x48c77e);_0x358ba1(_0x48c77e);});});}exports[_0x3571('0x14')]=function(_0x37881f){var _0x4b745a=this;return new Promise(function(_0x22a418,_0xab19b1){return db[_0x3571('0x15')][_0x3571('0x16')]({'raw':_0x37881f[_0x3571('0x17')]?_0x37881f[_0x3571('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x37881f[_0x3571('0x17')]?_0x37881f['options'][_0x3571('0x18')]||null:null,'attributes':_0x37881f[_0x3571('0x17')]?_0x37881f['options']['attributes']||null:null,'limit':_0x37881f['options']?_0x37881f[_0x3571('0x17')][_0x3571('0x19')]||null:null,'include':_0x37881f[_0x3571('0x17')]?_0x37881f[_0x3571('0x17')][_0x3571('0x1a')]?_['map'](_0x37881f[_0x3571('0x17')][_0x3571('0x1a')],function(_0x17492d){return{'model':db[_0x17492d[_0x3571('0x1b')]],'as':_0x17492d['as'],'attributes':_0x17492d[_0x3571('0x1c')],'include':_0x17492d['include']?_[_0x3571('0x1d')](_0x17492d[_0x3571('0x1a')],function(_0x5c830b){return{'model':db[_0x5c830b[_0x3571('0x1b')]],'as':_0x5c830b['as'],'attributes':_0x5c830b['attributes'],'include':_0x5c830b[_0x3571('0x1a')]?_[_0x3571('0x1d')](_0x5c830b[_0x3571('0x1a')],function(_0x2a06e4){return{'model':db[_0x2a06e4[_0x3571('0x1b')]],'as':_0x2a06e4['as'],'attributes':_0x2a06e4[_0x3571('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3571('0xb')](function(_0x4cbaae){logger[_0x3571('0xc')](_0x3571('0x14'),_0x37881f);logger[_0x3571('0xd')]('GetZohoAccount',_0x37881f,JSON['stringify'](_0x4cbaae));_0x22a418(_0x4cbaae);})['catch'](function(_0xa6d91f){logger['error'](_0x3571('0x14'),_0xa6d91f[_0x3571('0x12')],_0x37881f);_0xab19b1(_0x4b745a[_0x3571('0x10')](0x1f4,_0xa6d91f['message']));});});};exports['ShowZohoAccount']=function(_0x7c1c2a){var _0x40eea0=this;return new Promise(function(_0x4cc26c,_0x37de61){return db['ZohoAccount'][_0x3571('0x1e')]({'raw':_0x7c1c2a[_0x3571('0x17')]?_0x7c1c2a[_0x3571('0x17')][_0x3571('0x1f')]===undefined?!![]:![]:!![],'where':_0x7c1c2a[_0x3571('0x17')]?_0x7c1c2a[_0x3571('0x17')][_0x3571('0x18')]||null:null,'attributes':_0x7c1c2a['options']?_0x7c1c2a[_0x3571('0x17')][_0x3571('0x1c')]||null:null,'include':_0x7c1c2a[_0x3571('0x17')]?_0x7c1c2a[_0x3571('0x17')]['include']?_[_0x3571('0x1d')](_0x7c1c2a['options'][_0x3571('0x1a')],function(_0x16c5a0){return{'model':db[_0x16c5a0[_0x3571('0x1b')]],'as':_0x16c5a0['as'],'attributes':_0x16c5a0[_0x3571('0x1c')],'include':_0x16c5a0[_0x3571('0x1a')]?_['map'](_0x16c5a0['include'],function(_0x525842){return{'model':db[_0x525842['model']],'as':_0x525842['as'],'attributes':_0x525842[_0x3571('0x1c')],'include':_0x525842['include']?_[_0x3571('0x1d')](_0x525842[_0x3571('0x1a')],function(_0xa0d2d3){return{'model':db[_0xa0d2d3[_0x3571('0x1b')]],'as':_0xa0d2d3['as'],'attributes':_0xa0d2d3[_0x3571('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3571('0xb')](function(_0x356eb1){logger['info'](_0x3571('0x20'),_0x7c1c2a);logger[_0x3571('0xd')](_0x3571('0x20'),_0x7c1c2a,JSON[_0x3571('0x21')](_0x356eb1));_0x4cc26c(_0x356eb1);})[_0x3571('0x22')](function(_0x59ecb4){logger[_0x3571('0x10')](_0x3571('0x20'),_0x59ecb4[_0x3571('0x12')],_0x7c1c2a);_0x37de61(_0x40eea0[_0x3571('0x10')](0x1f4,_0x59ecb4[_0x3571('0x12')]));});});}; \ 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(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xc3ed,0x111));var _0xdc3e=function(_0xf46830,_0x267c2a){_0xf46830=_0xf46830-0x0;var _0x29aa0c=_0xc3ed[_0xf46830];return _0x29aa0c;};'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 7b210f8..2420d8b 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 _0x174a=['put','update','destroy','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x174a,0x17f));var _0xa174=function(_0xa224eb,_0x54f8bc){_0xa224eb=_0xa224eb-0x0;var _0x472189=_0x174a[_0xa224eb];return _0x472189;};'use strict';var multer=require(_0xa174('0x0'));var util=require(_0xa174('0x1'));var path=require('path');var timeout=require(_0xa174('0x2'));var express=require(_0xa174('0x3'));var router=express[_0xa174('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa174('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0xa174('0x6')]('/',auth[_0xa174('0x7')](),controller[_0xa174('0x8')]);router[_0xa174('0x6')](_0xa174('0x9'),auth[_0xa174('0x7')](),controller[_0xa174('0xa')]);router[_0xa174('0x6')]('/:id/fields',auth[_0xa174('0x7')](),controller[_0xa174('0xb')]);router[_0xa174('0x6')](_0xa174('0xc'),auth['isAuthenticated'](),controller[_0xa174('0xd')]);router[_0xa174('0x6')](_0xa174('0xe'),auth[_0xa174('0x7')](),controller[_0xa174('0xf')]);router['post']('/',auth[_0xa174('0x7')](),controller[_0xa174('0x10')]);router[_0xa174('0x11')](_0xa174('0x9'),auth['isAuthenticated'](),controller[_0xa174('0x12')]);router['delete'](_0xa174('0x9'),auth[_0xa174('0x7')](),controller[_0xa174('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf7b5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','destroy','exports','util','path'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xf7b5,0x94));var _0x5f7b=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xf7b5[_0x133277];return _0x5b4a22;};'use strict';var multer=require('multer');var util=require(_0x5f7b('0x0'));var path=require(_0x5f7b('0x1'));var timeout=require(_0x5f7b('0x2'));var express=require(_0x5f7b('0x3'));var router=express[_0x5f7b('0x4')]();var fs_extra=require(_0x5f7b('0x5'));var auth=require(_0x5f7b('0x6'));var interaction=require(_0x5f7b('0x7'));var config=require(_0x5f7b('0x8'));var controller=require(_0x5f7b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f7b('0xa')]);router[_0x5f7b('0xb')](_0x5f7b('0xc'),auth['isAuthenticated'](),controller[_0x5f7b('0xd')]);router['get'](_0x5f7b('0xe'),auth[_0x5f7b('0xf')](),controller[_0x5f7b('0x10')]);router[_0x5f7b('0xb')](_0x5f7b('0x11'),auth[_0x5f7b('0xf')](),controller[_0x5f7b('0x12')]);router['get']('/:id/descriptions',auth[_0x5f7b('0xf')](),controller[_0x5f7b('0x13')]);router[_0x5f7b('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5f7b('0x15')](_0x5f7b('0xc'),auth[_0x5f7b('0xf')](),controller[_0x5f7b('0x16')]);router['delete'](_0x5f7b('0xc'),auth[_0x5f7b('0xf')](),controller[_0x5f7b('0x17')]);module[_0x5f7b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ada3cd2..544d498 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 _0x7793=['lead','ENUM','contact','exports','STRING'];(function(_0x39fbbc,_0x9d36ab){var _0x1c171d=function(_0x2d00e7){while(--_0x2d00e7){_0x39fbbc['push'](_0x39fbbc['shift']());}};_0x1c171d(++_0x9d36ab);}(_0x7793,0x120));var _0x3779=function(_0x17a140,_0x20b6a6){_0x17a140=_0x17a140-0x0;var _0x3b6fed=_0x7793[_0x17a140];return _0x3b6fed;};'use strict';var Sequelize=require('sequelize');module[_0x3779('0x0')]={'name':{'type':Sequelize[_0x3779('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x3779('0x2'),'contact','nothing'),'defaultValue':_0x3779('0x2')},'moduleSearch':{'type':Sequelize[_0x3779('0x3')]('contact_lead',_0x3779('0x4'),_0x3779('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x3779('0x1')]}}; \ No newline at end of file +var _0x1ed9=['contact','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0x1ed9,0x113));var _0x91ed=function(_0x1a4a5f,_0x5d070d){_0x1a4a5f=_0x1a4a5f-0x0;var _0x42c9ef=_0x1ed9[_0x1a4a5f];return _0x42c9ef;};'use strict';var Sequelize=require(_0x91ed('0x0'));module[_0x91ed('0x1')]={'name':{'type':Sequelize[_0x91ed('0x2')]},'moduleCreate':{'type':Sequelize[_0x91ed('0x3')](_0x91ed('0x4'),_0x91ed('0x5'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x91ed('0x6'),_0x91ed('0x5'),_0x91ed('0x4')),'defaultValue':_0x91ed('0x6')},'description':{'type':Sequelize[_0x91ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index e5deeb0..fd6d87f 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 _0x775c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','map','ZohoConfiguration','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','getFields','findOne','ZohoField','order','length','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x775c,0x143));var _0xc775=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x775c[_0x4c4042];return _0xbd10dc;};'use strict';var emlformat=require(_0xc775('0x0'));var rimraf=require(_0xc775('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc775('0x2'));var rp=require(_0xc775('0x3'));var moment=require('moment');var BPromise=require(_0xc775('0x4'));var Mustache=require(_0xc775('0x5'));var util=require(_0xc775('0x6'));var path=require(_0xc775('0x7'));var sox=require(_0xc775('0x8'));var csv=require(_0xc775('0x9'));var ejs=require(_0xc775('0xa'));var fs=require('fs');var fs_extra=require(_0xc775('0xb'));var _=require(_0xc775('0xc'));var squel=require(_0xc775('0xd'));var crypto=require(_0xc775('0xe'));var jsforce=require(_0xc775('0xf'));var deskjs=require(_0xc775('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc775('0x11'));var Papa=require(_0xc775('0x12'));var Redis=require(_0xc775('0x13'));var authService=require(_0xc775('0x14'));var qs=require(_0xc775('0x15'));var as=require(_0xc775('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc775('0x17'))(_0xc775('0x18'));var utils=require(_0xc775('0x19'));var config=require(_0xc775('0x1a'));var licenseUtil=require(_0xc775('0x1b'));var db=require(_0xc775('0x1c'))['db'];function respondWithStatusCode(_0x3d7adc,_0x4fc21e){_0x4fc21e=_0x4fc21e||0xcc;return function(_0x43bd1e){if(_0x43bd1e){return _0x3d7adc['sendStatus'](_0x4fc21e);}return _0x3d7adc[_0xc775('0x1d')](_0x4fc21e)[_0xc775('0x1e')]();};}function respondWithResult(_0x5c840a,_0x56d6eb){_0x56d6eb=_0x56d6eb||0xc8;return function(_0x2510ec){if(_0x2510ec){return _0x5c840a['status'](_0x56d6eb)[_0xc775('0x1f')](_0x2510ec);}};}function respondWithFilteredResult(_0x437e25,_0x1b132e){return function(_0x267e1e){if(_0x267e1e){var _0x2a2473=typeof _0x1b132e['offset']===_0xc775('0x20')&&typeof _0x1b132e['limit']==='undefined';var _0x2a5675=_0x267e1e[_0xc775('0x21')];var _0x8b01a7=_0x2a2473?0x0:_0x1b132e[_0xc775('0x22')];var _0x27e1e4=_0x2a2473?_0x267e1e[_0xc775('0x21')]:_0x1b132e[_0xc775('0x22')]+_0x1b132e[_0xc775('0x23')];var _0x5b0fe8;if(_0x27e1e4>=_0x2a5675){_0x27e1e4=_0x2a5675;_0x5b0fe8=0xc8;}else{_0x5b0fe8=0xce;}_0x437e25[_0xc775('0x1d')](_0x5b0fe8);return _0x437e25[_0xc775('0x24')](_0xc775('0x25'),_0x8b01a7+'-'+_0x27e1e4+'/'+_0x2a5675)[_0xc775('0x1f')](_0x267e1e);}return null;};}function patchUpdates(_0x10f1f2){return function(_0x331ccc){try{jsonpatch[_0xc775('0x26')](_0x331ccc,_0x10f1f2,!![]);}catch(_0x123273){return BPromise['reject'](_0x123273);}return _0x331ccc[_0xc775('0x27')]();};}function saveUpdates(_0x2951a8,_0x583f0c){return function(_0x2f9d30){if(_0x2f9d30){return _0x2f9d30['update'](_0x2951a8)[_0xc775('0x28')](function(_0x34e754){return _0x34e754;});}return null;};}function removeEntity(_0xdfd4c4,_0x5e03d7){return function(_0x86f9db){if(_0x86f9db){return _0x86f9db[_0xc775('0x29')]()['then'](function(){_0xdfd4c4[_0xc775('0x1d')](0xcc)[_0xc775('0x1e')]();});}};}function handleEntityNotFound(_0x41c4b2,_0x39364d){return function(_0x4f2f41){if(!_0x4f2f41){_0x41c4b2[_0xc775('0x2a')](0x194);}return _0x4f2f41;};}function handleError(_0x32b903,_0x17d68b){_0x17d68b=_0x17d68b||0x1f4;return function(_0x974499){logger[_0xc775('0x2b')](_0x974499[_0xc775('0x2c')]);if(_0x974499[_0xc775('0x2d')]){delete _0x974499['name'];}_0x32b903['status'](_0x17d68b)[_0xc775('0x2e')](_0x974499);};}exports['index']=function(_0x304b5b,_0x380eab){var _0x2b9c57={},_0x44fd05={},_0x3eefe0={'count':0x0,'rows':[]};var _0xbf54fc=_[_0xc775('0x2f')](db[_0xc775('0x30')]['rawAttributes'],function(_0x57ffbc){return{'name':_0x57ffbc['fieldName'],'type':_0x57ffbc[_0xc775('0x31')][_0xc775('0x32')]};});_0x44fd05['model']=_['map'](_0xbf54fc,_0xc775('0x2d'));_0x44fd05['query']=_['keys'](_0x304b5b[_0xc775('0x33')]);_0x44fd05[_0xc775('0x34')]=_[_0xc775('0x35')](_0x44fd05[_0xc775('0x36')],_0x44fd05[_0xc775('0x33')]);_0x2b9c57[_0xc775('0x37')]=_['intersection'](_0x44fd05[_0xc775('0x36')],qs[_0xc775('0x38')](_0x304b5b[_0xc775('0x33')][_0xc775('0x38')]));_0x2b9c57[_0xc775('0x37')]=_0x2b9c57[_0xc775('0x37')]['length']?_0x2b9c57[_0xc775('0x37')]:_0x44fd05[_0xc775('0x36')];if(!_0x304b5b['query'][_0xc775('0x39')](_0xc775('0x3a'))){_0x2b9c57['limit']=qs[_0xc775('0x23')](_0x304b5b[_0xc775('0x33')]['limit']);_0x2b9c57['offset']=qs['offset'](_0x304b5b[_0xc775('0x33')]['offset']);}_0x2b9c57['order']=qs[_0xc775('0x3b')](_0x304b5b[_0xc775('0x33')][_0xc775('0x3b')]);_0x2b9c57[_0xc775('0x3c')]=qs['filters'](_[_0xc775('0x3d')](_0x304b5b['query'],_0x44fd05[_0xc775('0x34')]),_0xbf54fc);if(_0x304b5b['query']['filter']){_0x2b9c57[_0xc775('0x3c')]=_[_0xc775('0x3e')](_0x2b9c57['where'],{'$or':_['map'](_0xbf54fc,function(_0x377604){if(_0x377604['type']!==_0xc775('0x3f')){var _0x2e5dac={};_0x2e5dac[_0x377604[_0xc775('0x2d')]]={'$like':'%'+_0x304b5b[_0xc775('0x33')][_0xc775('0x40')]+'%'};return _0x2e5dac;}})});}_0x2b9c57=_[_0xc775('0x3e')]({},_0x2b9c57,_0x304b5b[_0xc775('0x41')]);var _0x17f3d8={'where':_0x2b9c57[_0xc775('0x3c')]};return db[_0xc775('0x30')]['count'](_0x17f3d8)[_0xc775('0x28')](function(_0x14e646){_0x3eefe0[_0xc775('0x21')]=_0x14e646;if(_0x304b5b[_0xc775('0x33')][_0xc775('0x42')]){_0x2b9c57[_0xc775('0x43')]=[{'all':!![]}];}return db[_0xc775('0x30')][_0xc775('0x44')](_0x2b9c57);})[_0xc775('0x28')](function(_0x544f4e){_0x3eefe0[_0xc775('0x45')]=_0x544f4e;return _0x3eefe0;})[_0xc775('0x28')](respondWithFilteredResult(_0x380eab,_0x2b9c57))[_0xc775('0x46')](handleError(_0x380eab,null));};exports[_0xc775('0x47')]=function(_0x2d1bc6,_0x26a29c){var _0x37ea0c={'raw':![],'where':{'id':_0x2d1bc6[_0xc775('0x48')]['id']}},_0x3a23fb={};_0x3a23fb[_0xc775('0x36')]=_[_0xc775('0x49')](db[_0xc775('0x30')][_0xc775('0x4a')]);_0x3a23fb['query']=_['keys'](_0x2d1bc6[_0xc775('0x33')]);_0x3a23fb[_0xc775('0x34')]=_['intersection'](_0x3a23fb[_0xc775('0x36')],_0x3a23fb[_0xc775('0x33')]);_0x37ea0c['attributes']=_[_0xc775('0x35')](_0x3a23fb[_0xc775('0x36')],qs[_0xc775('0x38')](_0x2d1bc6[_0xc775('0x33')][_0xc775('0x38')]));_0x37ea0c[_0xc775('0x37')]=_0x37ea0c['attributes']['length']?_0x37ea0c[_0xc775('0x37')]:_0x3a23fb['model'];if(_0x2d1bc6[_0xc775('0x33')][_0xc775('0x42')]){_0x37ea0c[_0xc775('0x43')]=[{'all':!![]}];}_0x37ea0c=_[_0xc775('0x3e')]({},_0x37ea0c,_0x2d1bc6['options']);return db['ZohoConfiguration'][_0xc775('0x4b')](_0x37ea0c)[_0xc775('0x28')](handleEntityNotFound(_0x26a29c,null))[_0xc775('0x28')](respondWithResult(_0x26a29c,null))[_0xc775('0x46')](handleError(_0x26a29c,null));};exports['create']=function(_0x2da46b,_0x3ab2ed){return db[_0xc775('0x30')][_0xc775('0x4c')](_0x2da46b[_0xc775('0x4d')],{})[_0xc775('0x28')](respondWithResult(_0x3ab2ed,0xc9))['catch'](handleError(_0x3ab2ed,null));};exports[_0xc775('0x4e')]=function(_0x279803,_0x51aac4){if(_0x279803[_0xc775('0x4d')]['id']){delete _0x279803[_0xc775('0x4d')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x279803[_0xc775('0x48')]['id']}})[_0xc775('0x28')](handleEntityNotFound(_0x51aac4,null))[_0xc775('0x28')](saveUpdates(_0x279803[_0xc775('0x4d')],null))[_0xc775('0x28')](respondWithResult(_0x51aac4,null))['catch'](handleError(_0x51aac4,null));};exports[_0xc775('0x29')]=function(_0x3241a7,_0x5f021d){return db[_0xc775('0x30')][_0xc775('0x4b')]({'where':{'id':_0x3241a7[_0xc775('0x48')]['id']}})[_0xc775('0x28')](handleEntityNotFound(_0x5f021d,null))[_0xc775('0x28')](removeEntity(_0x5f021d,null))[_0xc775('0x46')](handleError(_0x5f021d,null));};exports[_0xc775('0x4f')]=function(_0x4b0849,_0x298e64,_0x5c2912){var _0x2cfb31={};var _0x1f0d0e={};var _0x5e5c32;var _0x43fee0;return db[_0xc775('0x30')][_0xc775('0x50')]({'where':{'id':_0x4b0849[_0xc775('0x48')]['id']}})[_0xc775('0x28')](handleEntityNotFound(_0x298e64,null))[_0xc775('0x28')](function(_0x4c3164){if(_0x4c3164){_0x5e5c32=_0x4c3164;_0x1f0d0e['model']=_['keys'](db[_0xc775('0x51')][_0xc775('0x4a')]);_0x1f0d0e[_0xc775('0x33')]=_[_0xc775('0x49')](_0x4b0849[_0xc775('0x33')]);_0x1f0d0e['filters']=_[_0xc775('0x35')](_0x1f0d0e[_0xc775('0x36')],_0x1f0d0e[_0xc775('0x33')]);_0x2cfb31[_0xc775('0x37')]=_[_0xc775('0x35')](_0x1f0d0e[_0xc775('0x36')],qs[_0xc775('0x38')](_0x4b0849[_0xc775('0x33')][_0xc775('0x38')]));_0x2cfb31['attributes']=_0x2cfb31[_0xc775('0x37')]['length']?_0x2cfb31['attributes']:_0x1f0d0e[_0xc775('0x36')];_0x2cfb31[_0xc775('0x52')]=qs['sort'](_0x4b0849[_0xc775('0x33')][_0xc775('0x3b')]);_0x2cfb31[_0xc775('0x3c')]=qs[_0xc775('0x34')](_[_0xc775('0x3d')](_0x4b0849[_0xc775('0x33')],_0x1f0d0e[_0xc775('0x34')]));if(_0x4b0849[_0xc775('0x33')][_0xc775('0x40')]){_0x2cfb31[_0xc775('0x3c')]=_[_0xc775('0x3e')](_0x2cfb31[_0xc775('0x3c')],{'$or':_[_0xc775('0x2f')](_0x2cfb31[_0xc775('0x37')],function(_0x33851f){var _0xbfef76={};_0xbfef76[_0x33851f]={'$like':'%'+_0x4b0849[_0xc775('0x33')][_0xc775('0x40')]+'%'};return _0xbfef76;})});}_0x2cfb31=_[_0xc775('0x3e')]({},_0x2cfb31,_0x4b0849[_0xc775('0x41')]);return _0x5e5c32[_0xc775('0x4f')](_0x2cfb31);}})[_0xc775('0x28')](function(_0xd5f26c){if(_0xd5f26c){_0x43fee0=_0xd5f26c[_0xc775('0x53')];if(!_0x4b0849[_0xc775('0x33')][_0xc775('0x39')](_0xc775('0x3a'))){_0x2cfb31[_0xc775('0x23')]=qs[_0xc775('0x23')](_0x4b0849[_0xc775('0x33')][_0xc775('0x23')]);_0x2cfb31['offset']=qs['offset'](_0x4b0849[_0xc775('0x33')]['offset']);}return _0x5e5c32['getFields'](_0x2cfb31);}})['then'](function(_0x2cdcca){if(_0x2cdcca){return _0x2cdcca?{'count':_0x43fee0,'rows':_0x2cdcca}:null;}})[_0xc775('0x28')](respondWithResult(_0x298e64,null))[_0xc775('0x46')](handleError(_0x298e64,null));};exports[_0xc775('0x54')]=function(_0x46a5ae,_0x5b0c7a,_0x1c895c){var _0x30ef3d={};var _0x28ba7d={};var _0x3228c3;var _0x250369;return db[_0xc775('0x30')]['findOne']({'where':{'id':_0x46a5ae['params']['id']}})['then'](handleEntityNotFound(_0x5b0c7a,null))['then'](function(_0x21b463){if(_0x21b463){_0x3228c3=_0x21b463;_0x28ba7d[_0xc775('0x36')]=_[_0xc775('0x49')](db[_0xc775('0x51')][_0xc775('0x4a')]);_0x28ba7d[_0xc775('0x33')]=_[_0xc775('0x49')](_0x46a5ae[_0xc775('0x33')]);_0x28ba7d[_0xc775('0x34')]=_[_0xc775('0x35')](_0x28ba7d[_0xc775('0x36')],_0x28ba7d[_0xc775('0x33')]);_0x30ef3d[_0xc775('0x37')]=_[_0xc775('0x35')](_0x28ba7d['model'],qs['fields'](_0x46a5ae[_0xc775('0x33')]['fields']));_0x30ef3d['attributes']=_0x30ef3d['attributes'][_0xc775('0x53')]?_0x30ef3d['attributes']:_0x28ba7d['model'];_0x30ef3d[_0xc775('0x52')]=qs['sort'](_0x46a5ae[_0xc775('0x33')][_0xc775('0x3b')]);_0x30ef3d['where']=qs['filters'](_[_0xc775('0x3d')](_0x46a5ae[_0xc775('0x33')],_0x28ba7d[_0xc775('0x34')]));if(_0x46a5ae[_0xc775('0x33')][_0xc775('0x40')]){_0x30ef3d[_0xc775('0x3c')]=_['merge'](_0x30ef3d['where'],{'$or':_[_0xc775('0x2f')](_0x30ef3d[_0xc775('0x37')],function(_0x469ae0){var _0x538bac={};_0x538bac[_0x469ae0]={'$like':'%'+_0x46a5ae[_0xc775('0x33')][_0xc775('0x40')]+'%'};return _0x538bac;})});}_0x30ef3d=_[_0xc775('0x3e')]({},_0x30ef3d,_0x46a5ae[_0xc775('0x41')]);return _0x3228c3[_0xc775('0x54')](_0x30ef3d);}})[_0xc775('0x28')](function(_0x4f2f01){if(_0x4f2f01){_0x250369=_0x4f2f01[_0xc775('0x53')];if(!_0x46a5ae['query']['hasOwnProperty'](_0xc775('0x3a'))){_0x30ef3d[_0xc775('0x23')]=qs[_0xc775('0x23')](_0x46a5ae[_0xc775('0x33')]['limit']);_0x30ef3d[_0xc775('0x22')]=qs[_0xc775('0x22')](_0x46a5ae[_0xc775('0x33')]['offset']);}return _0x3228c3[_0xc775('0x54')](_0x30ef3d);}})[_0xc775('0x28')](function(_0x543711){if(_0x543711){return _0x543711?{'count':_0x250369,'rows':_0x543711}:null;}})[_0xc775('0x28')](respondWithResult(_0x5b0c7a,null))['catch'](handleError(_0x5b0c7a,null));};exports[_0xc775('0x55')]=function(_0x412931,_0x1349af,_0x48a874){var _0x454507={};var _0x1b8302={};var _0x2881f0;var _0x8f075c;return db[_0xc775('0x30')][_0xc775('0x50')]({'where':{'id':_0x412931[_0xc775('0x48')]['id']}})['then'](handleEntityNotFound(_0x1349af,null))[_0xc775('0x28')](function(_0x3894c0){if(_0x3894c0){_0x2881f0=_0x3894c0;_0x1b8302[_0xc775('0x36')]=_[_0xc775('0x49')](db[_0xc775('0x51')][_0xc775('0x4a')]);_0x1b8302[_0xc775('0x33')]=_[_0xc775('0x49')](_0x412931['query']);_0x1b8302[_0xc775('0x34')]=_['intersection'](_0x1b8302[_0xc775('0x36')],_0x1b8302[_0xc775('0x33')]);_0x454507[_0xc775('0x37')]=_[_0xc775('0x35')](_0x1b8302[_0xc775('0x36')],qs[_0xc775('0x38')](_0x412931[_0xc775('0x33')][_0xc775('0x38')]));_0x454507['attributes']=_0x454507[_0xc775('0x37')][_0xc775('0x53')]?_0x454507[_0xc775('0x37')]:_0x1b8302['model'];_0x454507[_0xc775('0x52')]=qs[_0xc775('0x3b')](_0x412931[_0xc775('0x33')][_0xc775('0x3b')]);_0x454507[_0xc775('0x3c')]=qs['filters'](_[_0xc775('0x3d')](_0x412931[_0xc775('0x33')],_0x1b8302['filters']));if(_0x412931[_0xc775('0x33')]['filter']){_0x454507['where']=_[_0xc775('0x3e')](_0x454507[_0xc775('0x3c')],{'$or':_[_0xc775('0x2f')](_0x454507[_0xc775('0x37')],function(_0x246048){var _0x21eb38={};_0x21eb38[_0x246048]={'$like':'%'+_0x412931[_0xc775('0x33')][_0xc775('0x40')]+'%'};return _0x21eb38;})});}_0x454507=_['merge']({},_0x454507,_0x412931[_0xc775('0x41')]);return _0x2881f0[_0xc775('0x55')](_0x454507);}})['then'](function(_0x4d7b57){if(_0x4d7b57){_0x8f075c=_0x4d7b57['length'];if(!_0x412931[_0xc775('0x33')]['hasOwnProperty']('nolimit')){_0x454507[_0xc775('0x23')]=qs[_0xc775('0x23')](_0x412931[_0xc775('0x33')][_0xc775('0x23')]);_0x454507[_0xc775('0x22')]=qs['offset'](_0x412931[_0xc775('0x33')][_0xc775('0x22')]);}return _0x2881f0[_0xc775('0x55')](_0x454507);}})[_0xc775('0x28')](function(_0x11937d){if(_0x11937d){return _0x11937d?{'count':_0x8f075c,'rows':_0x11937d}:null;}})[_0xc775('0x28')](respondWithResult(_0x1349af,null))[_0xc775('0x46')](handleError(_0x1349af,null));}; \ No newline at end of file +var _0xc20b=['error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','update','body','find','params','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end'];(function(_0x12700e,_0x43a1a8){var _0x373077=function(_0x48d1d2){while(--_0x48d1d2){_0x12700e['push'](_0x12700e['shift']());}};_0x373077(++_0x43a1a8);}(_0xc20b,0x7b));var _0xbc20=function(_0x2d9fd0,_0x59f12c){_0x2d9fd0=_0x2d9fd0-0x0;var _0x42d48f=_0xc20b[_0x2d9fd0];return _0x42d48f;};'use strict';var emlformat=require(_0xbc20('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc20('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbc20('0x2'));var Mustache=require(_0xbc20('0x3'));var util=require('util');var path=require(_0xbc20('0x4'));var sox=require('sox');var csv=require(_0xbc20('0x5'));var ejs=require(_0xbc20('0x6'));var fs=require('fs');var fs_extra=require(_0xbc20('0x7'));var _=require(_0xbc20('0x8'));var squel=require(_0xbc20('0x9'));var crypto=require('crypto');var jsforce=require(_0xbc20('0xa'));var deskjs=require(_0xbc20('0xb'));var toCsv=require(_0xbc20('0x5'));var querystring=require(_0xbc20('0xc'));var Papa=require(_0xbc20('0xd'));var Redis=require(_0xbc20('0xe'));var authService=require(_0xbc20('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbc20('0x10'));var hardwareService=require(_0xbc20('0x11'));var logger=require(_0xbc20('0x12'))(_0xbc20('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbc20('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196ca3,_0x2aa3df){_0x2aa3df=_0x2aa3df||0xcc;return function(_0x20d8ee){if(_0x20d8ee){return _0x196ca3[_0xbc20('0x15')](_0x2aa3df);}return _0x196ca3[_0xbc20('0x16')](_0x2aa3df)['end']();};}function respondWithResult(_0x503f6f,_0x3ef85f){_0x3ef85f=_0x3ef85f||0xc8;return function(_0x292914){if(_0x292914){return _0x503f6f[_0xbc20('0x16')](_0x3ef85f)[_0xbc20('0x17')](_0x292914);}};}function respondWithFilteredResult(_0x292310,_0x1e1acc){return function(_0x48b5b1){if(_0x48b5b1){var _0x47b0f9=typeof _0x1e1acc[_0xbc20('0x18')]===_0xbc20('0x19')&&typeof _0x1e1acc[_0xbc20('0x1a')]==='undefined';var _0x414f5a=_0x48b5b1[_0xbc20('0x1b')];var _0x49994e=_0x47b0f9?0x0:_0x1e1acc[_0xbc20('0x18')];var _0x30f643=_0x47b0f9?_0x48b5b1[_0xbc20('0x1b')]:_0x1e1acc['offset']+_0x1e1acc[_0xbc20('0x1a')];var _0x5e441b;if(_0x30f643>=_0x414f5a){_0x30f643=_0x414f5a;_0x5e441b=0xc8;}else{_0x5e441b=0xce;}_0x292310['status'](_0x5e441b);return _0x292310[_0xbc20('0x1c')](_0xbc20('0x1d'),_0x49994e+'-'+_0x30f643+'/'+_0x414f5a)['json'](_0x48b5b1);}return null;};}function patchUpdates(_0xc7fa96){return function(_0x566bc3){try{jsonpatch['apply'](_0x566bc3,_0xc7fa96,!![]);}catch(_0x4d01ae){return BPromise[_0xbc20('0x1e')](_0x4d01ae);}return _0x566bc3[_0xbc20('0x1f')]();};}function saveUpdates(_0x3dec8b,_0x374815){return function(_0x10a229){if(_0x10a229){return _0x10a229['update'](_0x3dec8b)[_0xbc20('0x20')](function(_0x1e5a3f){return _0x1e5a3f;});}return null;};}function removeEntity(_0xc878e6,_0x3f5fef){return function(_0x489ed2){if(_0x489ed2){return _0x489ed2[_0xbc20('0x21')]()['then'](function(){_0xc878e6[_0xbc20('0x16')](0xcc)[_0xbc20('0x22')]();});}};}function handleEntityNotFound(_0x10c655,_0x4c9011){return function(_0x4b380d){if(!_0x4b380d){_0x10c655[_0xbc20('0x15')](0x194);}return _0x4b380d;};}function handleError(_0x42938a,_0x553362){_0x553362=_0x553362||0x1f4;return function(_0x1a9c65){logger[_0xbc20('0x23')](_0x1a9c65[_0xbc20('0x24')]);if(_0x1a9c65[_0xbc20('0x25')]){delete _0x1a9c65['name'];}_0x42938a[_0xbc20('0x16')](_0x553362)[_0xbc20('0x26')](_0x1a9c65);};}exports[_0xbc20('0x27')]=function(_0x290de8,_0x56eadf){var _0xe9af7a={},_0x4000a3={},_0x526432={'count':0x0,'rows':[]};var _0x493cd4=_['map'](db[_0xbc20('0x28')][_0xbc20('0x29')],function(_0x47df0e){return{'name':_0x47df0e[_0xbc20('0x2a')],'type':_0x47df0e['type']['key']};});_0x4000a3[_0xbc20('0x2b')]=_[_0xbc20('0x2c')](_0x493cd4,'name');_0x4000a3[_0xbc20('0x2d')]=_[_0xbc20('0x2e')](_0x290de8[_0xbc20('0x2d')]);_0x4000a3['filters']=_[_0xbc20('0x2f')](_0x4000a3['model'],_0x4000a3[_0xbc20('0x2d')]);_0xe9af7a[_0xbc20('0x30')]=_[_0xbc20('0x2f')](_0x4000a3[_0xbc20('0x2b')],qs[_0xbc20('0x31')](_0x290de8[_0xbc20('0x2d')][_0xbc20('0x31')]));_0xe9af7a[_0xbc20('0x30')]=_0xe9af7a[_0xbc20('0x30')][_0xbc20('0x32')]?_0xe9af7a['attributes']:_0x4000a3[_0xbc20('0x2b')];if(!_0x290de8[_0xbc20('0x2d')][_0xbc20('0x33')](_0xbc20('0x34'))){_0xe9af7a[_0xbc20('0x1a')]=qs['limit'](_0x290de8[_0xbc20('0x2d')][_0xbc20('0x1a')]);_0xe9af7a[_0xbc20('0x18')]=qs[_0xbc20('0x18')](_0x290de8['query'][_0xbc20('0x18')]);}_0xe9af7a[_0xbc20('0x35')]=qs[_0xbc20('0x36')](_0x290de8['query'][_0xbc20('0x36')]);_0xe9af7a[_0xbc20('0x37')]=qs[_0xbc20('0x38')](_[_0xbc20('0x39')](_0x290de8[_0xbc20('0x2d')],_0x4000a3[_0xbc20('0x38')]),_0x493cd4);if(_0x290de8[_0xbc20('0x2d')][_0xbc20('0x3a')]){_0xe9af7a['where']=_['merge'](_0xe9af7a[_0xbc20('0x37')],{'$or':_[_0xbc20('0x2c')](_0x493cd4,function(_0x122058){if(_0x122058[_0xbc20('0x3b')]!==_0xbc20('0x3c')){var _0x3614aa={};_0x3614aa[_0x122058[_0xbc20('0x25')]]={'$like':'%'+_0x290de8[_0xbc20('0x2d')][_0xbc20('0x3a')]+'%'};return _0x3614aa;}})});}_0xe9af7a=_[_0xbc20('0x3d')]({},_0xe9af7a,_0x290de8[_0xbc20('0x3e')]);var _0x513db0={'where':_0xe9af7a['where']};return db[_0xbc20('0x28')][_0xbc20('0x1b')](_0x513db0)[_0xbc20('0x20')](function(_0x3e30c6){_0x526432['count']=_0x3e30c6;if(_0x290de8['query'][_0xbc20('0x3f')]){_0xe9af7a[_0xbc20('0x40')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xbc20('0x41')](_0xe9af7a);})[_0xbc20('0x20')](function(_0x53566b){_0x526432[_0xbc20('0x42')]=_0x53566b;return _0x526432;})[_0xbc20('0x20')](respondWithFilteredResult(_0x56eadf,_0xe9af7a))[_0xbc20('0x43')](handleError(_0x56eadf,null));};exports[_0xbc20('0x44')]=function(_0x16e346,_0x14db7d){var _0x37f167={'raw':![],'where':{'id':_0x16e346['params']['id']}},_0x2f7be0={};_0x2f7be0[_0xbc20('0x2b')]=_['keys'](db['ZohoConfiguration'][_0xbc20('0x29')]);_0x2f7be0[_0xbc20('0x2d')]=_[_0xbc20('0x2e')](_0x16e346['query']);_0x2f7be0['filters']=_[_0xbc20('0x2f')](_0x2f7be0['model'],_0x2f7be0[_0xbc20('0x2d')]);_0x37f167[_0xbc20('0x30')]=_[_0xbc20('0x2f')](_0x2f7be0[_0xbc20('0x2b')],qs[_0xbc20('0x31')](_0x16e346[_0xbc20('0x2d')][_0xbc20('0x31')]));_0x37f167[_0xbc20('0x30')]=_0x37f167[_0xbc20('0x30')][_0xbc20('0x32')]?_0x37f167[_0xbc20('0x30')]:_0x2f7be0[_0xbc20('0x2b')];if(_0x16e346[_0xbc20('0x2d')][_0xbc20('0x3f')]){_0x37f167['include']=[{'all':!![]}];}_0x37f167=_['merge']({},_0x37f167,_0x16e346['options']);return db['ZohoConfiguration']['find'](_0x37f167)[_0xbc20('0x20')](handleEntityNotFound(_0x14db7d,null))['then'](respondWithResult(_0x14db7d,null))[_0xbc20('0x43')](handleError(_0x14db7d,null));};exports[_0xbc20('0x45')]=function(_0x5e08f2,_0x20d092){return db[_0xbc20('0x28')][_0xbc20('0x45')](_0x5e08f2['body'],{})['then'](respondWithResult(_0x20d092,0xc9))[_0xbc20('0x43')](handleError(_0x20d092,null));};exports[_0xbc20('0x46')]=function(_0x9ed8f8,_0x3fdadb){if(_0x9ed8f8[_0xbc20('0x47')]['id']){delete _0x9ed8f8['body']['id'];}return db[_0xbc20('0x28')][_0xbc20('0x48')]({'where':{'id':_0x9ed8f8[_0xbc20('0x49')]['id']}})[_0xbc20('0x20')](handleEntityNotFound(_0x3fdadb,null))[_0xbc20('0x20')](saveUpdates(_0x9ed8f8['body'],null))[_0xbc20('0x20')](respondWithResult(_0x3fdadb,null))[_0xbc20('0x43')](handleError(_0x3fdadb,null));};exports[_0xbc20('0x21')]=function(_0x4c22fe,_0x5c52cc){return db[_0xbc20('0x28')]['find']({'where':{'id':_0x4c22fe[_0xbc20('0x49')]['id']}})[_0xbc20('0x20')](handleEntityNotFound(_0x5c52cc,null))[_0xbc20('0x20')](removeEntity(_0x5c52cc,null))[_0xbc20('0x43')](handleError(_0x5c52cc,null));};exports[_0xbc20('0x4a')]=function(_0x5d5fad,_0x194578,_0x535ffa){var _0x5193c0={};var _0xd8a86a={};var _0xecfd6a;var _0x5ba345;return db[_0xbc20('0x28')][_0xbc20('0x4b')]({'where':{'id':_0x5d5fad[_0xbc20('0x49')]['id']}})[_0xbc20('0x20')](handleEntityNotFound(_0x194578,null))[_0xbc20('0x20')](function(_0x3716fc){if(_0x3716fc){_0xecfd6a=_0x3716fc;_0xd8a86a[_0xbc20('0x2b')]=_[_0xbc20('0x2e')](db[_0xbc20('0x4c')][_0xbc20('0x29')]);_0xd8a86a[_0xbc20('0x2d')]=_['keys'](_0x5d5fad[_0xbc20('0x2d')]);_0xd8a86a[_0xbc20('0x38')]=_[_0xbc20('0x2f')](_0xd8a86a[_0xbc20('0x2b')],_0xd8a86a['query']);_0x5193c0[_0xbc20('0x30')]=_[_0xbc20('0x2f')](_0xd8a86a['model'],qs[_0xbc20('0x31')](_0x5d5fad[_0xbc20('0x2d')][_0xbc20('0x31')]));_0x5193c0[_0xbc20('0x30')]=_0x5193c0[_0xbc20('0x30')][_0xbc20('0x32')]?_0x5193c0[_0xbc20('0x30')]:_0xd8a86a[_0xbc20('0x2b')];_0x5193c0[_0xbc20('0x35')]=qs[_0xbc20('0x36')](_0x5d5fad['query'][_0xbc20('0x36')]);_0x5193c0['where']=qs['filters'](_[_0xbc20('0x39')](_0x5d5fad['query'],_0xd8a86a[_0xbc20('0x38')]));if(_0x5d5fad['query'][_0xbc20('0x3a')]){_0x5193c0[_0xbc20('0x37')]=_[_0xbc20('0x3d')](_0x5193c0[_0xbc20('0x37')],{'$or':_[_0xbc20('0x2c')](_0x5193c0['attributes'],function(_0x179d7e){var _0x155074={};_0x155074[_0x179d7e]={'$like':'%'+_0x5d5fad[_0xbc20('0x2d')]['filter']+'%'};return _0x155074;})});}_0x5193c0=_[_0xbc20('0x3d')]({},_0x5193c0,_0x5d5fad[_0xbc20('0x3e')]);return _0xecfd6a[_0xbc20('0x4a')](_0x5193c0);}})[_0xbc20('0x20')](function(_0x1161f0){if(_0x1161f0){_0x5ba345=_0x1161f0[_0xbc20('0x32')];if(!_0x5d5fad[_0xbc20('0x2d')][_0xbc20('0x33')](_0xbc20('0x34'))){_0x5193c0['limit']=qs[_0xbc20('0x1a')](_0x5d5fad[_0xbc20('0x2d')][_0xbc20('0x1a')]);_0x5193c0[_0xbc20('0x18')]=qs[_0xbc20('0x18')](_0x5d5fad[_0xbc20('0x2d')][_0xbc20('0x18')]);}return _0xecfd6a[_0xbc20('0x4a')](_0x5193c0);}})[_0xbc20('0x20')](function(_0x138e49){if(_0x138e49){return _0x138e49?{'count':_0x5ba345,'rows':_0x138e49}:null;}})['then'](respondWithResult(_0x194578,null))['catch'](handleError(_0x194578,null));};exports[_0xbc20('0x4d')]=function(_0x100b16,_0x1d7ff8,_0x8c656a){var _0x4b5eca={};var _0x40d9d8={};var _0x5eb4df;var _0x122729;return db[_0xbc20('0x28')][_0xbc20('0x4b')]({'where':{'id':_0x100b16['params']['id']}})[_0xbc20('0x20')](handleEntityNotFound(_0x1d7ff8,null))[_0xbc20('0x20')](function(_0x1f3564){if(_0x1f3564){_0x5eb4df=_0x1f3564;_0x40d9d8[_0xbc20('0x2b')]=_[_0xbc20('0x2e')](db[_0xbc20('0x4c')][_0xbc20('0x29')]);_0x40d9d8[_0xbc20('0x2d')]=_['keys'](_0x100b16[_0xbc20('0x2d')]);_0x40d9d8[_0xbc20('0x38')]=_['intersection'](_0x40d9d8[_0xbc20('0x2b')],_0x40d9d8[_0xbc20('0x2d')]);_0x4b5eca[_0xbc20('0x30')]=_['intersection'](_0x40d9d8[_0xbc20('0x2b')],qs[_0xbc20('0x31')](_0x100b16['query'][_0xbc20('0x31')]));_0x4b5eca[_0xbc20('0x30')]=_0x4b5eca[_0xbc20('0x30')][_0xbc20('0x32')]?_0x4b5eca[_0xbc20('0x30')]:_0x40d9d8[_0xbc20('0x2b')];_0x4b5eca[_0xbc20('0x35')]=qs['sort'](_0x100b16['query'][_0xbc20('0x36')]);_0x4b5eca[_0xbc20('0x37')]=qs[_0xbc20('0x38')](_['pick'](_0x100b16[_0xbc20('0x2d')],_0x40d9d8['filters']));if(_0x100b16[_0xbc20('0x2d')][_0xbc20('0x3a')]){_0x4b5eca[_0xbc20('0x37')]=_[_0xbc20('0x3d')](_0x4b5eca[_0xbc20('0x37')],{'$or':_[_0xbc20('0x2c')](_0x4b5eca[_0xbc20('0x30')],function(_0x35a2e9){var _0x1c02cf={};_0x1c02cf[_0x35a2e9]={'$like':'%'+_0x100b16[_0xbc20('0x2d')][_0xbc20('0x3a')]+'%'};return _0x1c02cf;})});}_0x4b5eca=_['merge']({},_0x4b5eca,_0x100b16[_0xbc20('0x3e')]);return _0x5eb4df[_0xbc20('0x4d')](_0x4b5eca);}})[_0xbc20('0x20')](function(_0xd1adaa){if(_0xd1adaa){_0x122729=_0xd1adaa[_0xbc20('0x32')];if(!_0x100b16[_0xbc20('0x2d')][_0xbc20('0x33')](_0xbc20('0x34'))){_0x4b5eca[_0xbc20('0x1a')]=qs[_0xbc20('0x1a')](_0x100b16[_0xbc20('0x2d')][_0xbc20('0x1a')]);_0x4b5eca[_0xbc20('0x18')]=qs[_0xbc20('0x18')](_0x100b16[_0xbc20('0x2d')]['offset']);}return _0x5eb4df[_0xbc20('0x4d')](_0x4b5eca);}})[_0xbc20('0x20')](function(_0x1a4108){if(_0x1a4108){return _0x1a4108?{'count':_0x122729,'rows':_0x1a4108}:null;}})['then'](respondWithResult(_0x1d7ff8,null))[_0xbc20('0x43')](handleError(_0x1d7ff8,null));};exports[_0xbc20('0x4e')]=function(_0x444296,_0x11cf1d,_0x3ad963){var _0x3118f8={};var _0x1a971d={};var _0xb138b6;var _0x4fd34a;return db[_0xbc20('0x28')][_0xbc20('0x4b')]({'where':{'id':_0x444296['params']['id']}})['then'](handleEntityNotFound(_0x11cf1d,null))[_0xbc20('0x20')](function(_0x524d75){if(_0x524d75){_0xb138b6=_0x524d75;_0x1a971d[_0xbc20('0x2b')]=_['keys'](db[_0xbc20('0x4c')]['rawAttributes']);_0x1a971d['query']=_[_0xbc20('0x2e')](_0x444296[_0xbc20('0x2d')]);_0x1a971d[_0xbc20('0x38')]=_[_0xbc20('0x2f')](_0x1a971d['model'],_0x1a971d[_0xbc20('0x2d')]);_0x3118f8[_0xbc20('0x30')]=_[_0xbc20('0x2f')](_0x1a971d[_0xbc20('0x2b')],qs['fields'](_0x444296[_0xbc20('0x2d')][_0xbc20('0x31')]));_0x3118f8['attributes']=_0x3118f8[_0xbc20('0x30')]['length']?_0x3118f8[_0xbc20('0x30')]:_0x1a971d['model'];_0x3118f8[_0xbc20('0x35')]=qs[_0xbc20('0x36')](_0x444296['query']['sort']);_0x3118f8[_0xbc20('0x37')]=qs[_0xbc20('0x38')](_[_0xbc20('0x39')](_0x444296[_0xbc20('0x2d')],_0x1a971d[_0xbc20('0x38')]));if(_0x444296[_0xbc20('0x2d')][_0xbc20('0x3a')]){_0x3118f8[_0xbc20('0x37')]=_[_0xbc20('0x3d')](_0x3118f8[_0xbc20('0x37')],{'$or':_[_0xbc20('0x2c')](_0x3118f8[_0xbc20('0x30')],function(_0x34b364){var _0x35d45a={};_0x35d45a[_0x34b364]={'$like':'%'+_0x444296[_0xbc20('0x2d')][_0xbc20('0x3a')]+'%'};return _0x35d45a;})});}_0x3118f8=_[_0xbc20('0x3d')]({},_0x3118f8,_0x444296[_0xbc20('0x3e')]);return _0xb138b6['getDescriptions'](_0x3118f8);}})[_0xbc20('0x20')](function(_0x5bd986){if(_0x5bd986){_0x4fd34a=_0x5bd986[_0xbc20('0x32')];if(!_0x444296[_0xbc20('0x2d')][_0xbc20('0x33')](_0xbc20('0x34'))){_0x3118f8[_0xbc20('0x1a')]=qs[_0xbc20('0x1a')](_0x444296[_0xbc20('0x2d')]['limit']);_0x3118f8[_0xbc20('0x18')]=qs[_0xbc20('0x18')](_0x444296[_0xbc20('0x2d')][_0xbc20('0x18')]);}return _0xb138b6['getDescriptions'](_0x3118f8);}})[_0xbc20('0x20')](function(_0x357ff8){if(_0x357ff8){return _0x357ff8?{'count':_0x4fd34a,'rows':_0x357ff8}:null;}})[_0xbc20('0x20')](respondWithResult(_0x11cf1d,null))[_0xbc20('0x43')](handleError(_0x11cf1d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 6dc4ff3..a37734b 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 _0xf3d7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x695cc3,_0x39efa5){var _0x3274a9=function(_0x817606){while(--_0x817606){_0x695cc3['push'](_0x695cc3['shift']());}};_0x3274a9(++_0x39efa5);}(_0xf3d7,0x10e));var _0x7f3d=function(_0x2902c2,_0x40150){_0x2902c2=_0x2902c2-0x0;var _0x16f4fb=_0xf3d7[_0x2902c2];return _0x16f4fb;};'use strict';var _=require(_0x7f3d('0x0'));var util=require(_0x7f3d('0x1'));var logger=require(_0x7f3d('0x2'))(_0x7f3d('0x3'));var moment=require(_0x7f3d('0x4'));var BPromise=require(_0x7f3d('0x5'));var rp=require(_0x7f3d('0x6'));var fs=require('fs');var path=require(_0x7f3d('0x7'));var rimraf=require(_0x7f3d('0x8'));var config=require(_0x7f3d('0x9'));var attributes=require(_0x7f3d('0xa'));module[_0x7f3d('0xb')]=function(_0xd73467,_0xcc954){return _0xd73467[_0x7f3d('0xc')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83df=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intZohoConfiguration.attributes'];(function(_0xefdf15,_0xca9ce5){var _0x4e9144=function(_0x51ab65){while(--_0x51ab65){_0xefdf15['push'](_0xefdf15['shift']());}};_0x4e9144(++_0xca9ce5);}(_0x83df,0x1f2));var _0xf83d=function(_0x25e7de,_0x24b676){_0x25e7de=_0x25e7de-0x0;var _0x5cd6b8=_0x83df[_0x25e7de];return _0x5cd6b8;};'use strict';var _=require(_0xf83d('0x0'));var util=require(_0xf83d('0x1'));var logger=require(_0xf83d('0x2'))(_0xf83d('0x3'));var moment=require(_0xf83d('0x4'));var BPromise=require(_0xf83d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf83d('0x6'));var rimraf=require(_0xf83d('0x7'));var config=require('../../config/environment');var attributes=require(_0xf83d('0x8'));module[_0xf83d('0x9')]=function(_0x9cb566,_0x3be408){return _0x9cb566[_0xf83d('0xa')](_0xf83d('0xb'),attributes,{'tableName':_0xf83d('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 ee3766f..08e2947 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 _0x75ad=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x42c899,_0x5e1af5){var _0x4a004e=function(_0x5a2f3a){while(--_0x5a2f3a){_0x42c899['push'](_0x42c899['shift']());}};_0x4a004e(++_0x5e1af5);}(_0x75ad,0x105));var _0xd75a=function(_0xea6f2b,_0x33f01c){_0xea6f2b=_0xea6f2b-0x0;var _0xdcb8dc=_0x75ad[_0xea6f2b];return _0xdcb8dc;};'use strict';var _=require(_0xd75a('0x0'));var util=require(_0xd75a('0x1'));var moment=require(_0xd75a('0x2'));var BPromise=require('bluebird');var rs=require(_0xd75a('0x3'));var fs=require('fs');var Redis=require(_0xd75a('0x4'));var db=require(_0xd75a('0x5'))['db'];var utils=require(_0xd75a('0x6'));var logger=require(_0xd75a('0x7'))(_0xd75a('0x8'));var config=require(_0xd75a('0x9'));var jayson=require(_0xd75a('0xa'));var client=jayson[_0xd75a('0xb')][_0xd75a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cd514,_0x39c6cf,_0x164fcc){return new BPromise(function(_0x283952,_0x1d3a58){return client[_0xd75a('0xd')](_0x4cd514,_0x164fcc)[_0xd75a('0xe')](function(_0x15fb99){logger[_0xd75a('0xf')](_0xd75a('0x10'),_0x39c6cf,_0xd75a('0x11'));logger[_0xd75a('0x12')](_0xd75a('0x13'),_0x39c6cf,_0xd75a('0x11'),JSON['stringify'](_0x15fb99));if(_0x15fb99[_0xd75a('0x14')]){if(_0x15fb99[_0xd75a('0x14')]['code']===0x1f4){logger[_0xd75a('0x14')](_0xd75a('0x10'),_0x39c6cf,_0x15fb99[_0xd75a('0x14')][_0xd75a('0x15')]);return _0x1d3a58(_0x15fb99[_0xd75a('0x14')]['message']);}logger[_0xd75a('0x14')](_0xd75a('0x10'),_0x39c6cf,_0x15fb99[_0xd75a('0x14')][_0xd75a('0x15')]);return _0x283952(_0x15fb99[_0xd75a('0x14')][_0xd75a('0x15')]);}else{logger[_0xd75a('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x39c6cf,'request\x20sent');_0x283952(_0x15fb99[_0xd75a('0x16')][_0xd75a('0x15')]);}})['catch'](function(_0x19f968){logger[_0xd75a('0x14')](_0xd75a('0x10'),_0x39c6cf,_0x19f968);_0x1d3a58(_0x19f968);});});} \ No newline at end of file +var _0x1115=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoConfiguration,\x20%s,\x20%s','result'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x1115,0x161));var _0x5111=function(_0x49961c,_0x545981){_0x49961c=_0x49961c-0x0;var _0x3b4198=_0x1115[_0x49961c];return _0x3b4198;};'use strict';var _=require(_0x5111('0x0'));var util=require(_0x5111('0x1'));var moment=require('moment');var BPromise=require(_0x5111('0x2'));var rs=require(_0x5111('0x3'));var fs=require('fs');var Redis=require(_0x5111('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5111('0x5'));var logger=require(_0x5111('0x6'))(_0x5111('0x7'));var config=require('../../config/environment');var jayson=require(_0x5111('0x8'));var client=jayson[_0x5111('0x9')][_0x5111('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cdcc3,_0x18b1b2,_0x70bbfb){return new BPromise(function(_0x4c94ff,_0x582f0b){return client['request'](_0x1cdcc3,_0x70bbfb)[_0x5111('0xb')](function(_0x4fb105){logger[_0x5111('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x18b1b2,_0x5111('0xd'));logger[_0x5111('0xe')](_0x5111('0xf'),_0x18b1b2,'request\x20sent',JSON[_0x5111('0x10')](_0x4fb105));if(_0x4fb105[_0x5111('0x11')]){if(_0x4fb105[_0x5111('0x11')]['code']===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x18b1b2,_0x4fb105[_0x5111('0x11')][_0x5111('0x12')]);return _0x582f0b(_0x4fb105[_0x5111('0x11')][_0x5111('0x12')]);}logger[_0x5111('0x11')](_0x5111('0x13'),_0x18b1b2,_0x4fb105[_0x5111('0x11')]['message']);return _0x4c94ff(_0x4fb105[_0x5111('0x11')][_0x5111('0x12')]);}else{logger['info'](_0x5111('0x13'),_0x18b1b2,_0x5111('0xd'));_0x4c94ff(_0x4fb105[_0x5111('0x14')][_0x5111('0x12')]);}})[_0x5111('0x15')](function(_0x10fefe){logger['error'](_0x5111('0x13'),_0x18b1b2,_0x10fefe);_0x582f0b(_0x10fefe);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5c8eef0..c9cbcee 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 _0x496b=['delete','destroy','exports','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post','put','/:id'];(function(_0x3a9d05,_0x357323){var _0x42b9cc=function(_0x1b18a0){while(--_0x1b18a0){_0x3a9d05['push'](_0x3a9d05['shift']());}};_0x42b9cc(++_0x357323);}(_0x496b,0x13e));var _0xb496=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x496b[_0x10d34b];return _0x92b0bf;};'use strict';var multer=require('multer');var util=require(_0xb496('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb496('0x1')]();var fs_extra=require(_0xb496('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xb496('0x3'));var config=require(_0xb496('0x4'));var controller=require(_0xb496('0x5'));router[_0xb496('0x6')]('/',auth[_0xb496('0x7')](),controller['index']);router[_0xb496('0x6')]('/:id',auth[_0xb496('0x7')](),controller[_0xb496('0x8')]);router[_0xb496('0x9')]('/',auth[_0xb496('0x7')](),controller['create']);router[_0xb496('0xa')](_0xb496('0xb'),auth[_0xb496('0x7')](),controller['update']);router[_0xb496('0xc')]('/:id',auth[_0xb496('0x7')](),controller[_0xb496('0xd')]);module[_0xb496('0xe')]=router; \ No newline at end of file +var _0x9a6e=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x5ada06,_0x2e27cd){var _0x2cc7f8=function(_0x3a3063){while(--_0x3a3063){_0x5ada06['push'](_0x5ada06['shift']());}};_0x2cc7f8(++_0x2e27cd);}(_0x9a6e,0x1dc));var _0xe9a6=function(_0x51c842,_0x2c47a8){_0x51c842=_0x51c842-0x0;var _0x3977a0=_0x9a6e[_0x51c842];return _0x3977a0;};'use strict';var multer=require(_0xe9a6('0x0'));var util=require(_0xe9a6('0x1'));var path=require('path');var timeout=require(_0xe9a6('0x2'));var express=require(_0xe9a6('0x3'));var router=express[_0xe9a6('0x4')]();var fs_extra=require(_0xe9a6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe9a6('0x6'));var config=require(_0xe9a6('0x7'));var controller=require(_0xe9a6('0x8'));router[_0xe9a6('0x9')]('/',auth[_0xe9a6('0xa')](),controller[_0xe9a6('0xb')]);router[_0xe9a6('0x9')]('/:id',auth[_0xe9a6('0xa')](),controller[_0xe9a6('0xc')]);router[_0xe9a6('0xd')]('/',auth['isAuthenticated'](),controller[_0xe9a6('0xe')]);router[_0xe9a6('0xf')](_0xe9a6('0x10'),auth[_0xe9a6('0xa')](),controller[_0xe9a6('0x11')]);router[_0xe9a6('0x12')](_0xe9a6('0x10'),auth[_0xe9a6('0xa')](),controller[_0xe9a6('0x13')]);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 4ace151..7e896ba 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 _0x5f86=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x145c31,_0x100409){var _0x394091=function(_0x450a91){while(--_0x450a91){_0x145c31['push'](_0x145c31['shift']());}};_0x394091(++_0x100409);}(_0x5f86,0xed));var _0x65f8=function(_0xd8fde7,_0x14173a){_0xd8fde7=_0xd8fde7-0x0;var _0x594397=_0x5f86[_0xd8fde7];return _0x594397;};'use strict';var Sequelize=require(_0x65f8('0x0'));module[_0x65f8('0x1')]={'type':{'type':Sequelize[_0x65f8('0x2')](_0x65f8('0x3'),_0x65f8('0x4'),_0x65f8('0x5'),_0x65f8('0x6'),_0x65f8('0x7')),'defaultValue':_0x65f8('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x65f8('0x8')]},'keyType':{'type':Sequelize[_0x65f8('0x2')](_0x65f8('0x3'),_0x65f8('0x4'),_0x65f8('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x65f8('0x8')]},'nameField':{'type':Sequelize[_0x65f8('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x65f8('0x8')]}}; \ No newline at end of file +var _0x7f86=['string','STRING','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7f86,0x1b2));var _0x67f8=function(_0x578dd4,_0xb3df3f){_0x578dd4=_0x578dd4-0x0;var _0x1649a7=_0x7f86[_0x578dd4];return _0x1649a7;};'use strict';var Sequelize=require('sequelize');module[_0x67f8('0x0')]={'type':{'type':Sequelize[_0x67f8('0x1')]('string',_0x67f8('0x2'),_0x67f8('0x3'),_0x67f8('0x4'),_0x67f8('0x5')),'defaultValue':_0x67f8('0x6')},'content':{'type':Sequelize[_0x67f8('0x7')]},'key':{'type':Sequelize[_0x67f8('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x67f8('0x2'),_0x67f8('0x3'))},'keyContent':{'type':Sequelize[_0x67f8('0x7')]},'idField':{'type':Sequelize[_0x67f8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x67f8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 12c8ac4..db30b64 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 _0x0b6e=['catch','params','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','rows'];(function(_0x4a2e71,_0x3a1516){var _0x4b340f=function(_0x37e6ec){while(--_0x37e6ec){_0x4a2e71['push'](_0x4a2e71['shift']());}};_0x4b340f(++_0x3a1516);}(_0x0b6e,0x11f));var _0xe0b6=function(_0x1bbac3,_0x20310c){_0x1bbac3=_0x1bbac3-0x0;var _0x8fd900=_0x0b6e[_0x1bbac3];return _0x8fd900;};'use strict';var emlformat=require(_0xe0b6('0x0'));var rimraf=require(_0xe0b6('0x1'));var zipdir=require(_0xe0b6('0x2'));var jsonpatch=require(_0xe0b6('0x3'));var rp=require(_0xe0b6('0x4'));var moment=require(_0xe0b6('0x5'));var BPromise=require(_0xe0b6('0x6'));var Mustache=require(_0xe0b6('0x7'));var util=require(_0xe0b6('0x8'));var path=require('path');var sox=require(_0xe0b6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0b6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0b6('0xb'));var jsforce=require(_0xe0b6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe0b6('0xd'));var Papa=require(_0xe0b6('0xe'));var Redis=require(_0xe0b6('0xf'));var authService=require(_0xe0b6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0b6('0x12'))(_0xe0b6('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe0b6('0x14'));var db=require(_0xe0b6('0x15'))['db'];function respondWithStatusCode(_0x53d61d,_0x1a5a66){_0x1a5a66=_0x1a5a66||0xcc;return function(_0x4ad326){if(_0x4ad326){return _0x53d61d[_0xe0b6('0x16')](_0x1a5a66);}return _0x53d61d[_0xe0b6('0x17')](_0x1a5a66)[_0xe0b6('0x18')]();};}function respondWithResult(_0x5bf775,_0x478826){_0x478826=_0x478826||0xc8;return function(_0xafa771){if(_0xafa771){return _0x5bf775[_0xe0b6('0x17')](_0x478826)[_0xe0b6('0x19')](_0xafa771);}};}function respondWithFilteredResult(_0x5040e0,_0x2830dd){return function(_0x5a2cd8){if(_0x5a2cd8){var _0x59b3bb=typeof _0x2830dd[_0xe0b6('0x1a')]===_0xe0b6('0x1b')&&typeof _0x2830dd[_0xe0b6('0x1c')]===_0xe0b6('0x1b');var _0x54353d=_0x5a2cd8[_0xe0b6('0x1d')];var _0x16a20f=_0x59b3bb?0x0:_0x2830dd[_0xe0b6('0x1a')];var _0x5b8c28=_0x59b3bb?_0x5a2cd8['count']:_0x2830dd[_0xe0b6('0x1a')]+_0x2830dd[_0xe0b6('0x1c')];var _0x1b6188;if(_0x5b8c28>=_0x54353d){_0x5b8c28=_0x54353d;_0x1b6188=0xc8;}else{_0x1b6188=0xce;}_0x5040e0[_0xe0b6('0x17')](_0x1b6188);return _0x5040e0[_0xe0b6('0x1e')](_0xe0b6('0x1f'),_0x16a20f+'-'+_0x5b8c28+'/'+_0x54353d)[_0xe0b6('0x19')](_0x5a2cd8);}return null;};}function patchUpdates(_0x103e57){return function(_0xb317c7){try{jsonpatch[_0xe0b6('0x20')](_0xb317c7,_0x103e57,!![]);}catch(_0x303dcd){return BPromise['reject'](_0x303dcd);}return _0xb317c7[_0xe0b6('0x21')]();};}function saveUpdates(_0x5a119c,_0x5c7d56){return function(_0x68b540){if(_0x68b540){return _0x68b540['update'](_0x5a119c)[_0xe0b6('0x22')](function(_0x4c65e3){return _0x4c65e3;});}return null;};}function removeEntity(_0x5db790,_0x1a6756){return function(_0x2a289c){if(_0x2a289c){return _0x2a289c[_0xe0b6('0x23')]()[_0xe0b6('0x22')](function(){_0x5db790[_0xe0b6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1944,_0x1b0a13){return function(_0x1efc9d){if(!_0x1efc9d){_0x3f1944['sendStatus'](0x194);}return _0x1efc9d;};}function handleError(_0x2fab6a,_0x523abb){_0x523abb=_0x523abb||0x1f4;return function(_0x1ef1d5){logger[_0xe0b6('0x24')](_0x1ef1d5[_0xe0b6('0x25')]);if(_0x1ef1d5['name']){delete _0x1ef1d5[_0xe0b6('0x26')];}_0x2fab6a[_0xe0b6('0x17')](_0x523abb)[_0xe0b6('0x27')](_0x1ef1d5);};}exports['index']=function(_0xd036fe,_0xaeda91){var _0x595d6f={},_0xb3dbf3={},_0x4677c3={'count':0x0,'rows':[]};var _0xa6eee=_[_0xe0b6('0x28')](db[_0xe0b6('0x29')][_0xe0b6('0x2a')],function(_0x4e9bcf){return{'name':_0x4e9bcf[_0xe0b6('0x2b')],'type':_0x4e9bcf[_0xe0b6('0x2c')][_0xe0b6('0x2d')]};});_0xb3dbf3[_0xe0b6('0x2e')]=_[_0xe0b6('0x28')](_0xa6eee,_0xe0b6('0x26'));_0xb3dbf3[_0xe0b6('0x2f')]=_[_0xe0b6('0x30')](_0xd036fe[_0xe0b6('0x2f')]);_0xb3dbf3[_0xe0b6('0x31')]=_[_0xe0b6('0x32')](_0xb3dbf3[_0xe0b6('0x2e')],_0xb3dbf3[_0xe0b6('0x2f')]);_0x595d6f[_0xe0b6('0x33')]=_[_0xe0b6('0x32')](_0xb3dbf3[_0xe0b6('0x2e')],qs[_0xe0b6('0x34')](_0xd036fe[_0xe0b6('0x2f')]['fields']));_0x595d6f['attributes']=_0x595d6f[_0xe0b6('0x33')][_0xe0b6('0x35')]?_0x595d6f[_0xe0b6('0x33')]:_0xb3dbf3['model'];if(!_0xd036fe[_0xe0b6('0x2f')][_0xe0b6('0x36')](_0xe0b6('0x37'))){_0x595d6f[_0xe0b6('0x1c')]=qs['limit'](_0xd036fe[_0xe0b6('0x2f')][_0xe0b6('0x1c')]);_0x595d6f[_0xe0b6('0x1a')]=qs[_0xe0b6('0x1a')](_0xd036fe['query'][_0xe0b6('0x1a')]);}_0x595d6f['order']=qs['sort'](_0xd036fe['query'][_0xe0b6('0x38')]);_0x595d6f[_0xe0b6('0x39')]=qs[_0xe0b6('0x31')](_[_0xe0b6('0x3a')](_0xd036fe[_0xe0b6('0x2f')],_0xb3dbf3[_0xe0b6('0x31')]),_0xa6eee);if(_0xd036fe[_0xe0b6('0x2f')]['filter']){_0x595d6f[_0xe0b6('0x39')]=_[_0xe0b6('0x3b')](_0x595d6f[_0xe0b6('0x39')],{'$or':_['map'](_0xa6eee,function(_0x2b1d26){if(_0x2b1d26[_0xe0b6('0x2c')]!=='VIRTUAL'){var _0x3edeb5={};_0x3edeb5[_0x2b1d26['name']]={'$like':'%'+_0xd036fe[_0xe0b6('0x2f')]['filter']+'%'};return _0x3edeb5;}})});}_0x595d6f=_[_0xe0b6('0x3b')]({},_0x595d6f,_0xd036fe[_0xe0b6('0x3c')]);var _0x2d114b={'where':_0x595d6f['where']};return db[_0xe0b6('0x29')][_0xe0b6('0x1d')](_0x2d114b)[_0xe0b6('0x22')](function(_0x4a2a8f){_0x4677c3[_0xe0b6('0x1d')]=_0x4a2a8f;if(_0xd036fe[_0xe0b6('0x2f')][_0xe0b6('0x3d')]){_0x595d6f['include']=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x595d6f);})['then'](function(_0x13bec0){_0x4677c3[_0xe0b6('0x3e')]=_0x13bec0;return _0x4677c3;})[_0xe0b6('0x22')](respondWithFilteredResult(_0xaeda91,_0x595d6f))[_0xe0b6('0x3f')](handleError(_0xaeda91,null));};exports['show']=function(_0x562534,_0x3947ff){var _0xe72105={'raw':!![],'where':{'id':_0x562534[_0xe0b6('0x40')]['id']}},_0x2de4c8={};_0x2de4c8[_0xe0b6('0x2e')]=_['keys'](db['ZohoField']['rawAttributes']);_0x2de4c8[_0xe0b6('0x2f')]=_['keys'](_0x562534['query']);_0x2de4c8['filters']=_[_0xe0b6('0x32')](_0x2de4c8[_0xe0b6('0x2e')],_0x2de4c8['query']);_0xe72105[_0xe0b6('0x33')]=_[_0xe0b6('0x32')](_0x2de4c8[_0xe0b6('0x2e')],qs[_0xe0b6('0x34')](_0x562534[_0xe0b6('0x2f')][_0xe0b6('0x34')]));_0xe72105[_0xe0b6('0x33')]=_0xe72105['attributes'][_0xe0b6('0x35')]?_0xe72105[_0xe0b6('0x33')]:_0x2de4c8[_0xe0b6('0x2e')];if(_0x562534[_0xe0b6('0x2f')][_0xe0b6('0x3d')]){_0xe72105[_0xe0b6('0x41')]=[{'all':!![]}];}_0xe72105=_[_0xe0b6('0x3b')]({},_0xe72105,_0x562534['options']);return db[_0xe0b6('0x29')][_0xe0b6('0x42')](_0xe72105)['then'](handleEntityNotFound(_0x3947ff,null))[_0xe0b6('0x22')](respondWithResult(_0x3947ff,null))['catch'](handleError(_0x3947ff,null));};exports['create']=function(_0x34730c,_0x18720d){return db[_0xe0b6('0x29')][_0xe0b6('0x43')](_0x34730c[_0xe0b6('0x44')],{})['then'](respondWithResult(_0x18720d,0xc9))['catch'](handleError(_0x18720d,null));};exports[_0xe0b6('0x45')]=function(_0x1f3799,_0x4ce263){if(_0x1f3799[_0xe0b6('0x44')]['id']){delete _0x1f3799[_0xe0b6('0x44')]['id'];}return db[_0xe0b6('0x29')][_0xe0b6('0x42')]({'where':{'id':_0x1f3799[_0xe0b6('0x40')]['id']}})[_0xe0b6('0x22')](handleEntityNotFound(_0x4ce263,null))[_0xe0b6('0x22')](saveUpdates(_0x1f3799[_0xe0b6('0x44')],null))['then'](respondWithResult(_0x4ce263,null))[_0xe0b6('0x3f')](handleError(_0x4ce263,null));};exports[_0xe0b6('0x23')]=function(_0xc64aea,_0x266c15){return db[_0xe0b6('0x29')][_0xe0b6('0x42')]({'where':{'id':_0xc64aea[_0xe0b6('0x40')]['id']}})['then'](handleEntityNotFound(_0x266c15,null))[_0xe0b6('0x22')](removeEntity(_0x266c15,null))[_0xe0b6('0x3f')](handleError(_0x266c15,null));}; \ No newline at end of file +var _0x98b6=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZohoField','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2e2d89,_0x4bb615){var _0x3aba90=function(_0x9daf58){while(--_0x9daf58){_0x2e2d89['push'](_0x2e2d89['shift']());}};_0x3aba90(++_0x4bb615);}(_0x98b6,0x11a));var _0x698b=function(_0x5df900,_0x31dec5){_0x5df900=_0x5df900-0x0;var _0x3868fa=_0x98b6[_0x5df900];return _0x3868fa;};'use strict';var emlformat=require(_0x698b('0x0'));var rimraf=require(_0x698b('0x1'));var zipdir=require(_0x698b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x698b('0x3'));var moment=require('moment');var BPromise=require(_0x698b('0x4'));var Mustache=require(_0x698b('0x5'));var util=require(_0x698b('0x6'));var path=require(_0x698b('0x7'));var sox=require(_0x698b('0x8'));var csv=require(_0x698b('0x9'));var ejs=require(_0x698b('0xa'));var fs=require('fs');var fs_extra=require(_0x698b('0xb'));var _=require(_0x698b('0xc'));var squel=require('squel');var crypto=require(_0x698b('0xd'));var jsforce=require(_0x698b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x698b('0x9'));var querystring=require(_0x698b('0xf'));var Papa=require(_0x698b('0x10'));var Redis=require(_0x698b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x698b('0x12'));var as=require(_0x698b('0x13'));var hardwareService=require(_0x698b('0x14'));var logger=require(_0x698b('0x15'))(_0x698b('0x16'));var utils=require('../../config/utils');var config=require(_0x698b('0x17'));var licenseUtil=require(_0x698b('0x18'));var db=require(_0x698b('0x19'))['db'];function respondWithStatusCode(_0x3ba769,_0xc820a4){_0xc820a4=_0xc820a4||0xcc;return function(_0x53970d){if(_0x53970d){return _0x3ba769[_0x698b('0x1a')](_0xc820a4);}return _0x3ba769[_0x698b('0x1b')](_0xc820a4)[_0x698b('0x1c')]();};}function respondWithResult(_0x58b3d9,_0x2af970){_0x2af970=_0x2af970||0xc8;return function(_0x3fc216){if(_0x3fc216){return _0x58b3d9[_0x698b('0x1b')](_0x2af970)[_0x698b('0x1d')](_0x3fc216);}};}function respondWithFilteredResult(_0x28a9eb,_0x2ed095){return function(_0x1504c2){if(_0x1504c2){var _0x4249ae=typeof _0x2ed095['offset']===_0x698b('0x1e')&&typeof _0x2ed095[_0x698b('0x1f')]==='undefined';var _0x54ca94=_0x1504c2[_0x698b('0x20')];var _0x787ee6=_0x4249ae?0x0:_0x2ed095[_0x698b('0x21')];var _0x591e95=_0x4249ae?_0x1504c2[_0x698b('0x20')]:_0x2ed095['offset']+_0x2ed095[_0x698b('0x1f')];var _0x3cdfe9;if(_0x591e95>=_0x54ca94){_0x591e95=_0x54ca94;_0x3cdfe9=0xc8;}else{_0x3cdfe9=0xce;}_0x28a9eb['status'](_0x3cdfe9);return _0x28a9eb['set']('Content-Range',_0x787ee6+'-'+_0x591e95+'/'+_0x54ca94)['json'](_0x1504c2);}return null;};}function patchUpdates(_0xd41f97){return function(_0x1cca46){try{jsonpatch[_0x698b('0x22')](_0x1cca46,_0xd41f97,!![]);}catch(_0xd94d90){return BPromise[_0x698b('0x23')](_0xd94d90);}return _0x1cca46[_0x698b('0x24')]();};}function saveUpdates(_0x1732b7,_0x24d811){return function(_0x308a23){if(_0x308a23){return _0x308a23[_0x698b('0x25')](_0x1732b7)[_0x698b('0x26')](function(_0x199039){return _0x199039;});}return null;};}function removeEntity(_0x3671ef,_0x327fd5){return function(_0x987fe1){if(_0x987fe1){return _0x987fe1[_0x698b('0x27')]()[_0x698b('0x26')](function(){_0x3671ef['status'](0xcc)[_0x698b('0x1c')]();});}};}function handleEntityNotFound(_0x225892,_0x4e9a30){return function(_0x1842fd){if(!_0x1842fd){_0x225892[_0x698b('0x1a')](0x194);}return _0x1842fd;};}function handleError(_0x5f1a4a,_0x41534f){_0x41534f=_0x41534f||0x1f4;return function(_0x2acb9b){logger[_0x698b('0x28')](_0x2acb9b[_0x698b('0x29')]);if(_0x2acb9b[_0x698b('0x2a')]){delete _0x2acb9b['name'];}_0x5f1a4a[_0x698b('0x1b')](_0x41534f)[_0x698b('0x2b')](_0x2acb9b);};}exports[_0x698b('0x2c')]=function(_0x417a12,_0x46fec9){var _0x3fa539={},_0x4dedf6={},_0x597ee4={'count':0x0,'rows':[]};var _0x585879=_[_0x698b('0x2d')](db['ZohoField']['rawAttributes'],function(_0x55804f){return{'name':_0x55804f['fieldName'],'type':_0x55804f[_0x698b('0x2e')]['key']};});_0x4dedf6[_0x698b('0x2f')]=_[_0x698b('0x2d')](_0x585879,_0x698b('0x2a'));_0x4dedf6[_0x698b('0x30')]=_[_0x698b('0x31')](_0x417a12[_0x698b('0x30')]);_0x4dedf6[_0x698b('0x32')]=_[_0x698b('0x33')](_0x4dedf6[_0x698b('0x2f')],_0x4dedf6[_0x698b('0x30')]);_0x3fa539[_0x698b('0x34')]=_[_0x698b('0x33')](_0x4dedf6[_0x698b('0x2f')],qs[_0x698b('0x35')](_0x417a12[_0x698b('0x30')][_0x698b('0x35')]));_0x3fa539[_0x698b('0x34')]=_0x3fa539['attributes']['length']?_0x3fa539[_0x698b('0x34')]:_0x4dedf6[_0x698b('0x2f')];if(!_0x417a12[_0x698b('0x30')]['hasOwnProperty'](_0x698b('0x36'))){_0x3fa539[_0x698b('0x1f')]=qs['limit'](_0x417a12[_0x698b('0x30')][_0x698b('0x1f')]);_0x3fa539[_0x698b('0x21')]=qs[_0x698b('0x21')](_0x417a12[_0x698b('0x30')]['offset']);}_0x3fa539[_0x698b('0x37')]=qs[_0x698b('0x38')](_0x417a12['query'][_0x698b('0x38')]);_0x3fa539[_0x698b('0x39')]=qs[_0x698b('0x32')](_[_0x698b('0x3a')](_0x417a12[_0x698b('0x30')],_0x4dedf6['filters']),_0x585879);if(_0x417a12['query'][_0x698b('0x3b')]){_0x3fa539[_0x698b('0x39')]=_[_0x698b('0x3c')](_0x3fa539['where'],{'$or':_[_0x698b('0x2d')](_0x585879,function(_0xb1da57){if(_0xb1da57['type']!==_0x698b('0x3d')){var _0x550d81={};_0x550d81[_0xb1da57['name']]={'$like':'%'+_0x417a12['query'][_0x698b('0x3b')]+'%'};return _0x550d81;}})});}_0x3fa539=_[_0x698b('0x3c')]({},_0x3fa539,_0x417a12['options']);var _0x5728db={'where':_0x3fa539[_0x698b('0x39')]};return db['ZohoField'][_0x698b('0x20')](_0x5728db)[_0x698b('0x26')](function(_0x597d88){_0x597ee4[_0x698b('0x20')]=_0x597d88;if(_0x417a12[_0x698b('0x30')][_0x698b('0x3e')]){_0x3fa539[_0x698b('0x3f')]=[{'all':!![]}];}return db[_0x698b('0x40')][_0x698b('0x41')](_0x3fa539);})[_0x698b('0x26')](function(_0x3b129c){_0x597ee4[_0x698b('0x42')]=_0x3b129c;return _0x597ee4;})[_0x698b('0x26')](respondWithFilteredResult(_0x46fec9,_0x3fa539))[_0x698b('0x43')](handleError(_0x46fec9,null));};exports[_0x698b('0x44')]=function(_0x44cc74,_0x4b6e7b){var _0x26beb4={'raw':!![],'where':{'id':_0x44cc74[_0x698b('0x45')]['id']}},_0x5801b5={};_0x5801b5[_0x698b('0x2f')]=_['keys'](db[_0x698b('0x40')][_0x698b('0x46')]);_0x5801b5['query']=_[_0x698b('0x31')](_0x44cc74[_0x698b('0x30')]);_0x5801b5['filters']=_[_0x698b('0x33')](_0x5801b5[_0x698b('0x2f')],_0x5801b5['query']);_0x26beb4[_0x698b('0x34')]=_[_0x698b('0x33')](_0x5801b5[_0x698b('0x2f')],qs[_0x698b('0x35')](_0x44cc74['query'][_0x698b('0x35')]));_0x26beb4['attributes']=_0x26beb4['attributes'][_0x698b('0x47')]?_0x26beb4[_0x698b('0x34')]:_0x5801b5['model'];if(_0x44cc74[_0x698b('0x30')]['includeAll']){_0x26beb4[_0x698b('0x3f')]=[{'all':!![]}];}_0x26beb4=_[_0x698b('0x3c')]({},_0x26beb4,_0x44cc74[_0x698b('0x48')]);return db['ZohoField'][_0x698b('0x49')](_0x26beb4)['then'](handleEntityNotFound(_0x4b6e7b,null))[_0x698b('0x26')](respondWithResult(_0x4b6e7b,null))['catch'](handleError(_0x4b6e7b,null));};exports[_0x698b('0x4a')]=function(_0x10dcc6,_0x52afcf){return db[_0x698b('0x40')][_0x698b('0x4a')](_0x10dcc6[_0x698b('0x4b')],{})['then'](respondWithResult(_0x52afcf,0xc9))[_0x698b('0x43')](handleError(_0x52afcf,null));};exports[_0x698b('0x25')]=function(_0x511669,_0x24b421){if(_0x511669[_0x698b('0x4b')]['id']){delete _0x511669[_0x698b('0x4b')]['id'];}return db[_0x698b('0x40')][_0x698b('0x49')]({'where':{'id':_0x511669[_0x698b('0x45')]['id']}})['then'](handleEntityNotFound(_0x24b421,null))['then'](saveUpdates(_0x511669[_0x698b('0x4b')],null))[_0x698b('0x26')](respondWithResult(_0x24b421,null))[_0x698b('0x43')](handleError(_0x24b421,null));};exports[_0x698b('0x27')]=function(_0x47f6c8,_0x10c09f){return db['ZohoField'][_0x698b('0x49')]({'where':{'id':_0x47f6c8[_0x698b('0x45')]['id']}})['then'](handleEntityNotFound(_0x10c09f,null))['then'](removeEntity(_0x10c09f,null))[_0x698b('0x43')](handleError(_0x10c09f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index bbb42b0..284e01c 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 _0xffd6=['bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger'];(function(_0x56b33a,_0x74eab2){var _0x49c469=function(_0x3bfb22){while(--_0x3bfb22){_0x56b33a['push'](_0x56b33a['shift']());}};_0x49c469(++_0x74eab2);}(_0xffd6,0x97));var _0x6ffd=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xffd6[_0x2a0738];return _0x159679;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));module[_0x6ffd('0x8')]=function(_0x2949a4,_0x561055){return _0x2949a4[_0x6ffd('0x9')](_0x6ffd('0xa'),attributes,{'tableName':_0x6ffd('0xb'),'paranoid':![],'indexes':[{'name':_0x6ffd('0xc'),'fields':[_0x6ffd('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa456=['./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa456,0x142));var _0x6a45=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xa456[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var moment=require('moment');var BPromise=require(_0x6a45('0x4'));var rp=require(_0x6a45('0x5'));var fs=require('fs');var path=require(_0x6a45('0x6'));var rimraf=require('rimraf');var config=require(_0x6a45('0x7'));var attributes=require(_0x6a45('0x8'));module[_0x6a45('0x9')]=function(_0x14da6b,_0x4dfbfa){return _0x14da6b[_0x6a45('0xa')](_0x6a45('0xb'),attributes,{'tableName':_0x6a45('0xc'),'paranoid':![],'indexes':[{'name':_0x6a45('0xd'),'fields':[_0x6a45('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index c7e03e0..d7d5b2e 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 _0x2e75=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','info','request\x20sent'];(function(_0x28fa46,_0x56a7b2){var _0x341a5c=function(_0x39bcec){while(--_0x39bcec){_0x28fa46['push'](_0x28fa46['shift']());}};_0x341a5c(++_0x56a7b2);}(_0x2e75,0x16e));var _0x52e7=function(_0x43de12,_0x15968b){_0x43de12=_0x43de12-0x0;var _0x579829=_0x2e75[_0x43de12];return _0x579829;};'use strict';var _=require(_0x52e7('0x0'));var util=require(_0x52e7('0x1'));var moment=require(_0x52e7('0x2'));var BPromise=require(_0x52e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52e7('0x4'));var db=require(_0x52e7('0x5'))['db'];var utils=require(_0x52e7('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x52e7('0x7'));var client=jayson[_0x52e7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1431bf,_0x266d6f,_0x1f92b7){return new BPromise(function(_0x2c010f,_0xee2477){return client[_0x52e7('0x9')](_0x1431bf,_0x1f92b7)['then'](function(_0x31c67b){logger[_0x52e7('0xa')]('ZohoField,\x20%s,\x20%s',_0x266d6f,_0x52e7('0xb'));logger[_0x52e7('0xc')](_0x52e7('0xd'),_0x266d6f,_0x52e7('0xb'),JSON[_0x52e7('0xe')](_0x31c67b));if(_0x31c67b['error']){if(_0x31c67b[_0x52e7('0xf')][_0x52e7('0x10')]===0x1f4){logger['error'](_0x52e7('0x11'),_0x266d6f,_0x31c67b[_0x52e7('0xf')][_0x52e7('0x12')]);return _0xee2477(_0x31c67b[_0x52e7('0xf')][_0x52e7('0x12')]);}logger[_0x52e7('0xf')]('ZohoField,\x20%s,\x20%s',_0x266d6f,_0x31c67b[_0x52e7('0xf')][_0x52e7('0x12')]);return _0x2c010f(_0x31c67b[_0x52e7('0xf')][_0x52e7('0x12')]);}else{logger[_0x52e7('0xa')](_0x52e7('0x11'),_0x266d6f,_0x52e7('0xb'));_0x2c010f(_0x31c67b[_0x52e7('0x13')]['message']);}})[_0x52e7('0x14')](function(_0x442162){logger[_0x52e7('0xf')](_0x52e7('0x11'),_0x266d6f,_0x442162);_0xee2477(_0x442162);});});} \ No newline at end of file +var _0x617b=['client','http','request','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2311ba,_0x7d650){var _0x1e2743=function(_0x361c5e){while(--_0x361c5e){_0x2311ba['push'](_0x2311ba['shift']());}};_0x1e2743(++_0x7d650);}(_0x617b,0x141));var _0xb617=function(_0x2f34d0,_0x586a83){_0x2f34d0=_0x2f34d0-0x0;var _0x1ba7a7=_0x617b[_0x2f34d0];return _0x1ba7a7;};'use strict';var _=require(_0xb617('0x0'));var util=require(_0xb617('0x1'));var moment=require(_0xb617('0x2'));var BPromise=require('bluebird');var rs=require(_0xb617('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb617('0x4'))['db'];var utils=require(_0xb617('0x5'));var logger=require('../../config/logger')(_0xb617('0x6'));var config=require(_0xb617('0x7'));var jayson=require(_0xb617('0x8'));var client=jayson[_0xb617('0x9')][_0xb617('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2073,_0x19d8ea,_0x53feaf){return new BPromise(function(_0x31f682,_0x29f582){return client[_0xb617('0xb')](_0x3e2073,_0x53feaf)['then'](function(_0x27c7ed){logger['info']('ZohoField,\x20%s,\x20%s',_0x19d8ea,_0xb617('0xc'));logger[_0xb617('0xd')](_0xb617('0xe'),_0x19d8ea,'request\x20sent',JSON[_0xb617('0xf')](_0x27c7ed));if(_0x27c7ed[_0xb617('0x10')]){if(_0x27c7ed[_0xb617('0x10')]['code']===0x1f4){logger['error'](_0xb617('0x11'),_0x19d8ea,_0x27c7ed[_0xb617('0x10')][_0xb617('0x12')]);return _0x29f582(_0x27c7ed['error']['message']);}logger[_0xb617('0x10')]('ZohoField,\x20%s,\x20%s',_0x19d8ea,_0x27c7ed['error']['message']);return _0x31f682(_0x27c7ed[_0xb617('0x10')]['message']);}else{logger[_0xb617('0x13')](_0xb617('0x11'),_0x19d8ea,_0xb617('0xc'));_0x31f682(_0x27c7ed[_0xb617('0x14')][_0xb617('0x12')]);}})[_0xb617('0x15')](function(_0x4dac34){logger[_0xb617('0x10')](_0xb617('0x11'),_0x19d8ea,_0x4dac34);_0x29f582(_0x4dac34);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 681764b..f4187ae 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3c6d98,_0x46ee36){var _0x54a0ad=function(_0x2b0267){while(--_0x2b0267){_0x3c6d98['push'](_0x3c6d98['shift']());}};_0x54a0ad(++_0x46ee36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xa985ec,_0x3a96b9){var _0x2fbfaa=function(_0x4f5eb2){while(--_0x4f5eb2){_0xa985ec['push'](_0xa985ec['shift']());}};_0x2fbfaa(++_0x3a96b9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xcb91[_0x14fad0];return _0x5c665f;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5575353..2deca55 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 _0x852a=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x852a,0x1d5));var _0xa852=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x852a[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require('sequelize');module[_0xa852('0x0')]={'name':{'type':Sequelize[_0xa852('0x1')],'allowNull':![],'unique':_0xa852('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa852('0x2')},'main':{'type':Sequelize[_0xa852('0x1')],'defaultValue':_0xa852('0x3')},'filename':{'type':Sequelize[_0xa852('0x1')]},'path':{'type':Sequelize[_0xa852('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xa852('0x4')]},'active':{'type':Sequelize[_0xa852('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xa852('0x1')]},'logo':{'type':Sequelize[_0xa852('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xa852('0x6')},'description':{'type':Sequelize[_0xa852('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xa852('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x20cb=['app.js','INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x4e3f1d,_0x56d142){var _0x345a8f=function(_0x4756d9){while(--_0x4756d9){_0x4e3f1d['push'](_0x4e3f1d['shift']());}};_0x345a8f(++_0x56d142);}(_0x20cb,0x12a));var _0xb20c=function(_0x2bf29b,_0x34001a){_0x2bf29b=_0x2bf29b-0x0;var _0x507375=_0x20cb[_0x2bf29b];return _0x507375;};'use strict';var Sequelize=require('sequelize');module[_0xb20c('0x0')]={'name':{'type':Sequelize[_0xb20c('0x1')],'allowNull':![],'unique':_0xb20c('0x2')},'version':{'type':Sequelize[_0xb20c('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xb20c('0x1')],'defaultValue':_0xb20c('0x3')},'filename':{'type':Sequelize[_0xb20c('0x1')]},'path':{'type':Sequelize[_0xb20c('0x1')]},'type':{'type':Sequelize[_0xb20c('0x1')]},'size':{'type':Sequelize[_0xb20c('0x4')]},'active':{'type':Sequelize[_0xb20c('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xb20c('0x1')],'unique':_0xb20c('0x6')},'description':{'type':Sequelize[_0xb20c('0x1')]},'title':{'type':Sequelize[_0xb20c('0x1')]},'remoteUri':{'type':Sequelize[_0xb20c('0x1')]},'link':{'type':Sequelize[_0xb20c('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 ced0c57..6cd5eb9 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 _0xdb28=['error','stack','name','send','index','Integration','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','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'];(function(_0x1e28e3,_0x1f00d0){var _0x72a2b6=function(_0x30a4a3){while(--_0x30a4a3){_0x1e28e3['push'](_0x1e28e3['shift']());}};_0x72a2b6(++_0x1f00d0);}(_0xdb28,0x106));var _0x8db2=function(_0x39b4e6,_0x313a90){_0x39b4e6=_0x39b4e6-0x0;var _0x150cb1=_0xdb28[_0x39b4e6];return _0x150cb1;};'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));}; \ No newline at end of file +var _0xd943=['mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Integration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x17ba68,_0x5c2859){var _0x2a0082=function(_0x1a482d){while(--_0x1a482d){_0x17ba68['push'](_0x17ba68['shift']());}};_0x2a0082(++_0x5c2859);}(_0xd943,0x15d));var _0x3d94=function(_0x3447ac,_0x3ae7f5){_0x3447ac=_0x3447ac-0x0;var _0x5b7a6c=_0xd943[_0x3447ac];return _0x5b7a6c;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 150a6f0..54a705a 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 _0x00af=['path','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','util','api','bluebird','request-promise'];(function(_0x4ece36,_0x445bde){var _0x233b9c=function(_0x6e17b){while(--_0x6e17b){_0x4ece36['push'](_0x4ece36['shift']());}};_0x233b9c(++_0x445bde);}(_0x00af,0x1a8));var _0xf00a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00af[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf00a('0x0'));var util=require(_0xf00a('0x1'));var logger=require('../../config/logger')(_0xf00a('0x2'));var moment=require('moment');var BPromise=require(_0xf00a('0x3'));var rp=require(_0xf00a('0x4'));var fs=require('fs');var path=require(_0xf00a('0x5'));var rimraf=require('rimraf');var config=require(_0xf00a('0x6'));var attributes=require(_0xf00a('0x7'));module[_0xf00a('0x8')]=function(_0x144afb,_0x2ca43e){return _0x144afb['define'](_0xf00a('0x9'),attributes,{'tableName':_0xf00a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf694=['api','moment','path','rimraf','../../config/environment','./integration.attributes','Integration','integrations','lodash','util','../../config/logger'];(function(_0x2d91da,_0x4d39eb){var _0x2dd34d=function(_0x4669da){while(--_0x4669da){_0x2d91da['push'](_0x2d91da['shift']());}};_0x2dd34d(++_0x4d39eb);}(_0xf694,0xce));var _0x4f69=function(_0xc331d6,_0x14c50c){_0xc331d6=_0xc331d6-0x0;var _0x15627e=_0xf694[_0xc331d6];return _0x15627e;};'use strict';var _=require(_0x4f69('0x0'));var util=require(_0x4f69('0x1'));var logger=require(_0x4f69('0x2'))(_0x4f69('0x3'));var moment=require(_0x4f69('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f69('0x5'));var rimraf=require(_0x4f69('0x6'));var config=require(_0x4f69('0x7'));var attributes=require(_0x4f69('0x8'));module['exports']=function(_0x4d1617,_0x3676d9){return _0x4d1617['define'](_0x4f69('0x9'),attributes,{'tableName':_0x4f69('0xa'),'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 0278c40..ac0762d 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x55aeb0,_0x4253b9){var _0x5a45c1=function(_0x10e763){while(--_0x10e763){_0x55aeb0['push'](_0x55aeb0['shift']());}};_0x5a45c1(++_0x4253b9);}(_0x1a85,0x178));var _0x51a8=function(_0x401e83,_0xc6d9c5){_0x401e83=_0x401e83-0x0;var _0x3cc505=_0x1a85[_0x401e83];return _0x3cc505;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0xef0f,0x168));var _0xfef0=function(_0x311d73,_0x5995d5){_0x311d73=_0x311d73-0x0;var _0x47b9e6=_0xef0f[_0x311d73];return _0x47b9e6;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2fe3dbb..8e35719 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 _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(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x896e,0x1e9));var _0xe896=function(_0x668e3f,_0x290a7a){_0x668e3f=_0x668e3f-0x0;var _0x5dd950=_0x896e[_0x668e3f];return _0x5dd950;};'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 +var _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x3a9e34,_0x342d18){var _0x29ff99=function(_0x4ad98d){while(--_0x4ad98d){_0x3a9e34['push'](_0x3a9e34['shift']());}};_0x29ff99(++_0x342d18);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1065f7,_0x58949c){_0x1065f7=_0x1065f7-0x0;var _0x2c5696=_0xc2c7[_0x1065f7];return _0x2c5696;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index b43fd4c..2b61797 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 _0x67eb=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','sequelize','exports'];(function(_0x35c6d3,_0x5f5d8){var _0x1dd248=function(_0x32c3c9){while(--_0x32c3c9){_0x35c6d3['push'](_0x35c6d3['shift']());}};_0x1dd248(++_0x5f5d8);}(_0x67eb,0x18e));var _0xb67e=function(_0x1512ed,_0x1862a2){_0x1512ed=_0x1512ed-0x0;var _0x9400b7=_0x67eb[_0x1512ed];return _0x9400b7;};'use strict';var Sequelize=require(_0xb67e('0x0'));module[_0xb67e('0x1')]={'integration':{'type':Sequelize[_0xb67e('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xb67e('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xb67e('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb67e('0x2')]},'calleridnum':{'type':Sequelize[_0xb67e('0x2')]},'calleridname':{'type':Sequelize[_0xb67e('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb67e('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xb67e('0x4')]},'agentconnectAt':{'type':Sequelize[_0xb67e('0x4')]},'holdtime':{'type':Sequelize[_0xb67e('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb67e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xb67e('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb67e('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb67e('0x4')]},'agentdump':{'type':Sequelize[_0xb67e('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xb67e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb67e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb67e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb67e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb67e('0x2')]},'accountcode':{'type':Sequelize[_0xb67e('0x2')]},'context':{'type':Sequelize[_0xb67e('0x2')]},'exten':{'type':Sequelize[_0xb67e('0x2')]},'priority':{'type':Sequelize[_0xb67e('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb67e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb67e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb67e('0x2')]},'destcalleridname':{'type':Sequelize[_0xb67e('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xb67e('0x2')]},'destlanguage':{'type':Sequelize[_0xb67e('0x2')]},'destaccountcode':{'type':Sequelize[_0xb67e('0x2')]},'destcontext':{'type':Sequelize[_0xb67e('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xb67e('0x2')]},'messageId':{'type':Sequelize[_0xb67e('0x2')]},'inReplyTo':{'type':Sequelize[_0xb67e('0x2')]},'subject':{'type':Sequelize[_0xb67e('0x2')]},'from':{'type':Sequelize[_0xb67e('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xb67e('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xb67e('0x6')]},'status':{'type':Sequelize[_0xb67e('0x7')](_0xb67e('0x8'),'SENDING',_0xb67e('0x9'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xb67e('0x2')]},'appdata':{'type':Sequelize[_0xb67e('0x2')]},'projectId':{'type':Sequelize[_0xb67e('0x3')]}}; \ No newline at end of file +var _0x890d=['BOOLEAN','INTEGER','TEXT','SENT','SENDING','FAILED','sequelize','STRING','DATE'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x890d,0x141));var _0xd890=function(_0x73c418,_0x17e24f){_0x73c418=_0x73c418-0x0;var _0x1b0a7c=_0x890d[_0x73c418];return _0x1b0a7c;};'use strict';var Sequelize=require(_0xd890('0x0'));module['exports']={'integration':{'type':Sequelize[_0xd890('0x1')]},'eventChannel':{'type':Sequelize[_0xd890('0x1')]},'exitStatus':{'type':Sequelize[_0xd890('0x1')]},'ticketId':{'type':Sequelize[_0xd890('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xd890('0x1')]},'uniqueid':{'type':Sequelize[_0xd890('0x1')]},'calleridnum':{'type':Sequelize[_0xd890('0x1')]},'calleridname':{'type':Sequelize[_0xd890('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd890('0x1')]},'membername':{'type':Sequelize[_0xd890('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd890('0x2')]},'agentconnectAt':{'type':Sequelize[_0xd890('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd890('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd890('0x4')]},'agentacw':{'type':Sequelize[_0xd890('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd890('0x4')]},'reason':{'type':Sequelize[_0xd890('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd890('0x2')]},'agentdump':{'type':Sequelize[_0xd890('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd890('0x1')]},'channel':{'type':Sequelize[_0xd890('0x1')]},'channelstate':{'type':Sequelize[_0xd890('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd890('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd890('0x1')]},'connectedlinename':{'type':Sequelize[_0xd890('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd890('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd890('0x1')]},'priority':{'type':Sequelize[_0xd890('0x1')]},'destchannel':{'type':Sequelize[_0xd890('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd890('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd890('0x1')]},'destcalleridname':{'type':Sequelize[_0xd890('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd890('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd890('0x1')]},'destlanguage':{'type':Sequelize[_0xd890('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd890('0x1')]},'destpriority':{'type':Sequelize[_0xd890('0x1')]},'destuniqueid':{'type':Sequelize[_0xd890('0x1')]},'messageId':{'type':Sequelize[_0xd890('0x1')]},'inReplyTo':{'type':Sequelize[_0xd890('0x1')]},'subject':{'type':Sequelize[_0xd890('0x1')]},'from':{'type':Sequelize[_0xd890('0x1')]},'to':{'type':Sequelize[_0xd890('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xd890('0x5')]},'html':{'type':Sequelize[_0xd890('0x5')]},'text':{'type':Sequelize[_0xd890('0x5')]},'status':{'type':Sequelize['ENUM'](_0xd890('0x6'),_0xd890('0x7'),'RECEIVED',_0xd890('0x8'))},'url':{'type':Sequelize[_0xd890('0x1')]},'app':{'type':Sequelize[_0xd890('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 24e8614..c257c6f 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 _0xd31f=['fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','name','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format'];(function(_0x12a041,_0x4f0380){var _0x25cb3=function(_0x225abf){while(--_0x225abf){_0x12a041['push'](_0x12a041['shift']());}};_0x25cb3(++_0x4f0380);}(_0xd31f,0xd7));var _0xfd31=function(_0x7d531f,_0x433e2a){_0x7d531f=_0x7d531f-0x0;var _0x192654=_0xd31f[_0x7d531f];return _0x192654;};'use strict';var emlformat=require(_0xfd31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfd31('0x1'));var rp=require(_0xfd31('0x2'));var moment=require(_0xfd31('0x3'));var BPromise=require(_0xfd31('0x4'));var Mustache=require('mustache');var util=require(_0xfd31('0x5'));var path=require(_0xfd31('0x6'));var sox=require('sox');var csv=require(_0xfd31('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd31('0x8'));var _=require('lodash');var squel=require(_0xfd31('0x9'));var crypto=require(_0xfd31('0xa'));var jsforce=require(_0xfd31('0xb'));var deskjs=require(_0xfd31('0xc'));var toCsv=require(_0xfd31('0x7'));var querystring=require(_0xfd31('0xd'));var Papa=require(_0xfd31('0xe'));var Redis=require(_0xfd31('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfd31('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd31('0x11'))(_0xfd31('0x12'));var utils=require(_0xfd31('0x13'));var config=require(_0xfd31('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2075a4,_0x775202){_0x775202=_0x775202||0xcc;return function(_0x4008ef){if(_0x4008ef){return _0x2075a4[_0xfd31('0x15')](_0x775202);}return _0x2075a4[_0xfd31('0x16')](_0x775202)[_0xfd31('0x17')]();};}function respondWithResult(_0x1b24b7,_0x297b61){_0x297b61=_0x297b61||0xc8;return function(_0x39e8c8){if(_0x39e8c8){return _0x1b24b7['status'](_0x297b61)['json'](_0x39e8c8);}};}function respondWithFilteredResult(_0x49f38f,_0x5185a4){return function(_0x3ae60b){if(_0x3ae60b){var _0x118a89=typeof _0x5185a4[_0xfd31('0x18')]===_0xfd31('0x19')&&typeof _0x5185a4[_0xfd31('0x1a')]===_0xfd31('0x19');var _0x4211fe=_0x3ae60b[_0xfd31('0x1b')];var _0x46891b=_0x118a89?0x0:_0x5185a4[_0xfd31('0x18')];var _0x56929e=_0x118a89?_0x3ae60b['count']:_0x5185a4[_0xfd31('0x18')]+_0x5185a4[_0xfd31('0x1a')];var _0xb78711;if(_0x56929e>=_0x4211fe){_0x56929e=_0x4211fe;_0xb78711=0xc8;}else{_0xb78711=0xce;}_0x49f38f[_0xfd31('0x16')](_0xb78711);return _0x49f38f[_0xfd31('0x1c')](_0xfd31('0x1d'),_0x46891b+'-'+_0x56929e+'/'+_0x4211fe)[_0xfd31('0x1e')](_0x3ae60b);}return null;};}function patchUpdates(_0x560e5f){return function(_0x280e7f){try{jsonpatch[_0xfd31('0x1f')](_0x280e7f,_0x560e5f,!![]);}catch(_0x16210c){return BPromise['reject'](_0x16210c);}return _0x280e7f[_0xfd31('0x20')]();};}function saveUpdates(_0xbe6d77,_0x876036){return function(_0xd5d4a3){if(_0xd5d4a3){return _0xd5d4a3[_0xfd31('0x21')](_0xbe6d77)[_0xfd31('0x22')](function(_0x2b62da){return _0x2b62da;});}return null;};}function removeEntity(_0x27039c,_0x6eab83){return function(_0x5a337a){if(_0x5a337a){return _0x5a337a[_0xfd31('0x23')]()['then'](function(){_0x27039c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a12b,_0x301a38){return function(_0xac5ccf){if(!_0xac5ccf){_0x50a12b[_0xfd31('0x15')](0x194);}return _0xac5ccf;};}function handleError(_0x565844,_0x31f467){_0x31f467=_0x31f467||0x1f4;return function(_0x133b64){logger[_0xfd31('0x24')](_0x133b64['stack']);if(_0x133b64['name']){delete _0x133b64[_0xfd31('0x25')];}_0x565844[_0xfd31('0x16')](_0x31f467)['send'](_0x133b64);};}exports['index']=function(_0x537197,_0x4d3682){var _0x43a286={},_0x1200fa={},_0x546b6b={'count':0x0,'rows':[]};var _0x3eb786=_[_0xfd31('0x26')](db['IntegrationReport']['rawAttributes'],function(_0x1718db){return{'name':_0x1718db[_0xfd31('0x27')],'type':_0x1718db[_0xfd31('0x28')][_0xfd31('0x29')]};});_0x1200fa[_0xfd31('0x2a')]=_[_0xfd31('0x26')](_0x3eb786,_0xfd31('0x25'));_0x1200fa[_0xfd31('0x2b')]=_[_0xfd31('0x2c')](_0x537197[_0xfd31('0x2b')]);_0x1200fa[_0xfd31('0x2d')]=_[_0xfd31('0x2e')](_0x1200fa[_0xfd31('0x2a')],_0x1200fa['query']);_0x43a286[_0xfd31('0x2f')]=_[_0xfd31('0x2e')](_0x1200fa[_0xfd31('0x2a')],qs[_0xfd31('0x30')](_0x537197[_0xfd31('0x2b')]['fields']));_0x43a286['attributes']=_0x43a286[_0xfd31('0x2f')]['length']?_0x43a286['attributes']:_0x1200fa[_0xfd31('0x2a')];if(!_0x537197[_0xfd31('0x2b')][_0xfd31('0x31')](_0xfd31('0x32'))){_0x43a286['limit']=qs['limit'](_0x537197[_0xfd31('0x2b')]['limit']);_0x43a286[_0xfd31('0x18')]=qs[_0xfd31('0x18')](_0x537197['query'][_0xfd31('0x18')]);}_0x43a286[_0xfd31('0x33')]=qs[_0xfd31('0x34')](_0x537197['query']['sort']);_0x43a286[_0xfd31('0x35')]=qs['filters'](_[_0xfd31('0x36')](_0x537197[_0xfd31('0x2b')],_0x1200fa['filters']),_0x3eb786);if(_0x537197[_0xfd31('0x2b')][_0xfd31('0x37')]){_0x43a286['where']=_[_0xfd31('0x38')](_0x43a286[_0xfd31('0x35')],{'$or':_[_0xfd31('0x26')](_0x3eb786,function(_0x4e7acb){if(_0x4e7acb[_0xfd31('0x28')]!=='VIRTUAL'){var _0x3abe7c={};_0x3abe7c[_0x4e7acb[_0xfd31('0x25')]]={'$like':'%'+_0x537197[_0xfd31('0x2b')][_0xfd31('0x37')]+'%'};return _0x3abe7c;}})});}_0x43a286=_[_0xfd31('0x38')]({},_0x43a286,_0x537197[_0xfd31('0x39')]);var _0xde266d={'where':_0x43a286[_0xfd31('0x35')]};return db[_0xfd31('0x3a')]['count'](_0xde266d)[_0xfd31('0x22')](function(_0x5381ee){_0x546b6b['count']=_0x5381ee;if(_0x537197[_0xfd31('0x2b')][_0xfd31('0x3b')]){_0x43a286[_0xfd31('0x3c')]=[{'all':!![]}];}return db[_0xfd31('0x3a')][_0xfd31('0x3d')](_0x43a286);})[_0xfd31('0x22')](function(_0x2ef537){_0x546b6b[_0xfd31('0x3e')]=_0x2ef537;return _0x546b6b;})[_0xfd31('0x22')](respondWithFilteredResult(_0x4d3682,_0x43a286))[_0xfd31('0x3f')](handleError(_0x4d3682,null));};exports[_0xfd31('0x40')]=function(_0x120d13,_0x134081){var _0x5bb7bb={'raw':![],'where':{'id':_0x120d13[_0xfd31('0x41')]['id']}},_0xc887ed={};_0xc887ed['model']=_[_0xfd31('0x2c')](db[_0xfd31('0x3a')][_0xfd31('0x42')]);_0xc887ed[_0xfd31('0x2b')]=_[_0xfd31('0x2c')](_0x120d13[_0xfd31('0x2b')]);_0xc887ed['filters']=_['intersection'](_0xc887ed[_0xfd31('0x2a')],_0xc887ed[_0xfd31('0x2b')]);_0x5bb7bb[_0xfd31('0x2f')]=_[_0xfd31('0x2e')](_0xc887ed[_0xfd31('0x2a')],qs[_0xfd31('0x30')](_0x120d13[_0xfd31('0x2b')][_0xfd31('0x30')]));_0x5bb7bb['attributes']=_0x5bb7bb[_0xfd31('0x2f')][_0xfd31('0x43')]?_0x5bb7bb['attributes']:_0xc887ed['model'];if(_0x120d13[_0xfd31('0x2b')][_0xfd31('0x3b')]){_0x5bb7bb[_0xfd31('0x3c')]=[{'all':!![]}];}_0x5bb7bb=_['merge']({},_0x5bb7bb,_0x120d13[_0xfd31('0x39')]);return db[_0xfd31('0x3a')][_0xfd31('0x44')](_0x5bb7bb)[_0xfd31('0x22')](handleEntityNotFound(_0x134081,null))[_0xfd31('0x22')](respondWithResult(_0x134081,null))['catch'](handleError(_0x134081,null));};exports[_0xfd31('0x45')]=function(_0x2cabdf,_0x1ef70f){return db[_0xfd31('0x3a')][_0xfd31('0x45')](_0x2cabdf['body'],{})[_0xfd31('0x22')](respondWithResult(_0x1ef70f,0xc9))[_0xfd31('0x3f')](handleError(_0x1ef70f,null));};exports[_0xfd31('0x21')]=function(_0x28be23,_0x11ffc3){if(_0x28be23[_0xfd31('0x46')]['id']){delete _0x28be23[_0xfd31('0x46')]['id'];}return db['IntegrationReport'][_0xfd31('0x44')]({'where':{'id':_0x28be23[_0xfd31('0x41')]['id']}})[_0xfd31('0x22')](handleEntityNotFound(_0x11ffc3,null))['then'](saveUpdates(_0x28be23[_0xfd31('0x46')],null))[_0xfd31('0x22')](respondWithResult(_0x11ffc3,null))['catch'](handleError(_0x11ffc3,null));};exports[_0xfd31('0x23')]=function(_0x356817,_0x37e0b3){return db[_0xfd31('0x3a')][_0xfd31('0x44')]({'where':{'id':_0x356817['params']['id']}})[_0xfd31('0x22')](handleEntityNotFound(_0x37e0b3,null))[_0xfd31('0x22')](removeEntity(_0x37e0b3,null))[_0xfd31('0x3f')](handleError(_0x37e0b3,null));};exports[_0xfd31('0x47')]=function(_0xf45fc,_0x171867){return db['IntegrationReport'][_0xfd31('0x47')]()[_0xfd31('0x22')](respondWithResult(_0x171867,null))['catch'](handleError(_0x171867,null));}; \ No newline at end of file +var _0x0b43=['send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','IntegrationReport','count','rows','catch','params','keys','filters','includeAll','include','create','body','find','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','save','update','then','name'];(function(_0x3dbccf,_0x1e8f8c){var _0x70ce31=function(_0x2abba1){while(--_0x2abba1){_0x3dbccf['push'](_0x3dbccf['shift']());}};_0x70ce31(++_0x1e8f8c);}(_0x0b43,0x196));var _0x30b4=function(_0x229208,_0x15c395){_0x229208=_0x229208-0x0;var _0x125d0a=_0x0b43[_0x229208];return _0x125d0a;};'use strict';var emlformat=require(_0x30b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30b4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30b4('0x2'));var moment=require(_0x30b4('0x3'));var BPromise=require(_0x30b4('0x4'));var Mustache=require(_0x30b4('0x5'));var util=require(_0x30b4('0x6'));var path=require(_0x30b4('0x7'));var sox=require(_0x30b4('0x8'));var csv=require(_0x30b4('0x9'));var ejs=require(_0x30b4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30b4('0xb'));var squel=require(_0x30b4('0xc'));var crypto=require(_0x30b4('0xd'));var jsforce=require(_0x30b4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x30b4('0x9'));var querystring=require(_0x30b4('0xf'));var Papa=require(_0x30b4('0x10'));var Redis=require(_0x30b4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x30b4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x30b4('0x13'))(_0x30b4('0x14'));var utils=require(_0x30b4('0x15'));var config=require(_0x30b4('0x16'));var licenseUtil=require(_0x30b4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0123,_0x330ff9){_0x330ff9=_0x330ff9||0xcc;return function(_0xdd7fc5){if(_0xdd7fc5){return _0x1d0123[_0x30b4('0x18')](_0x330ff9);}return _0x1d0123[_0x30b4('0x19')](_0x330ff9)[_0x30b4('0x1a')]();};}function respondWithResult(_0x587092,_0x5416d1){_0x5416d1=_0x5416d1||0xc8;return function(_0xc1446e){if(_0xc1446e){return _0x587092['status'](_0x5416d1)[_0x30b4('0x1b')](_0xc1446e);}};}function respondWithFilteredResult(_0xadea13,_0x5c0036){return function(_0x186350){if(_0x186350){var _0x5e3052=typeof _0x5c0036[_0x30b4('0x1c')]==='undefined'&&typeof _0x5c0036[_0x30b4('0x1d')]===_0x30b4('0x1e');var _0x281ef7=_0x186350['count'];var _0x158810=_0x5e3052?0x0:_0x5c0036[_0x30b4('0x1c')];var _0x327c83=_0x5e3052?_0x186350['count']:_0x5c0036[_0x30b4('0x1c')]+_0x5c0036[_0x30b4('0x1d')];var _0x42768e;if(_0x327c83>=_0x281ef7){_0x327c83=_0x281ef7;_0x42768e=0xc8;}else{_0x42768e=0xce;}_0xadea13[_0x30b4('0x19')](_0x42768e);return _0xadea13[_0x30b4('0x1f')](_0x30b4('0x20'),_0x158810+'-'+_0x327c83+'/'+_0x281ef7)['json'](_0x186350);}return null;};}function patchUpdates(_0x24b6fa){return function(_0x4a7979){try{jsonpatch[_0x30b4('0x21')](_0x4a7979,_0x24b6fa,!![]);}catch(_0x386d02){return BPromise['reject'](_0x386d02);}return _0x4a7979[_0x30b4('0x22')]();};}function saveUpdates(_0x141b7e,_0x4d48c6){return function(_0x5724e9){if(_0x5724e9){return _0x5724e9[_0x30b4('0x23')](_0x141b7e)[_0x30b4('0x24')](function(_0x47ae27){return _0x47ae27;});}return null;};}function removeEntity(_0x22b52d,_0x37cf54){return function(_0x1b0ba8){if(_0x1b0ba8){return _0x1b0ba8['destroy']()[_0x30b4('0x24')](function(){_0x22b52d['status'](0xcc)[_0x30b4('0x1a')]();});}};}function handleEntityNotFound(_0x280de4,_0xd30b45){return function(_0x4018d6){if(!_0x4018d6){_0x280de4[_0x30b4('0x18')](0x194);}return _0x4018d6;};}function handleError(_0x4394f4,_0xf95700){_0xf95700=_0xf95700||0x1f4;return function(_0xfe4348){logger['error'](_0xfe4348['stack']);if(_0xfe4348[_0x30b4('0x25')]){delete _0xfe4348[_0x30b4('0x25')];}_0x4394f4[_0x30b4('0x19')](_0xf95700)[_0x30b4('0x26')](_0xfe4348);};}exports[_0x30b4('0x27')]=function(_0x454745,_0x532b7e){var _0x521c54={},_0x5e0e11={},_0x486409={'count':0x0,'rows':[]};var _0x4f831a=_[_0x30b4('0x28')](db['IntegrationReport'][_0x30b4('0x29')],function(_0x248c17){return{'name':_0x248c17[_0x30b4('0x2a')],'type':_0x248c17[_0x30b4('0x2b')][_0x30b4('0x2c')]};});_0x5e0e11[_0x30b4('0x2d')]=_[_0x30b4('0x28')](_0x4f831a,_0x30b4('0x25'));_0x5e0e11[_0x30b4('0x2e')]=_['keys'](_0x454745[_0x30b4('0x2e')]);_0x5e0e11['filters']=_[_0x30b4('0x2f')](_0x5e0e11[_0x30b4('0x2d')],_0x5e0e11[_0x30b4('0x2e')]);_0x521c54[_0x30b4('0x30')]=_[_0x30b4('0x2f')](_0x5e0e11[_0x30b4('0x2d')],qs[_0x30b4('0x31')](_0x454745[_0x30b4('0x2e')]['fields']));_0x521c54[_0x30b4('0x30')]=_0x521c54[_0x30b4('0x30')][_0x30b4('0x32')]?_0x521c54[_0x30b4('0x30')]:_0x5e0e11['model'];if(!_0x454745[_0x30b4('0x2e')][_0x30b4('0x33')](_0x30b4('0x34'))){_0x521c54[_0x30b4('0x1d')]=qs[_0x30b4('0x1d')](_0x454745['query'][_0x30b4('0x1d')]);_0x521c54[_0x30b4('0x1c')]=qs[_0x30b4('0x1c')](_0x454745[_0x30b4('0x2e')]['offset']);}_0x521c54[_0x30b4('0x35')]=qs[_0x30b4('0x36')](_0x454745[_0x30b4('0x2e')][_0x30b4('0x36')]);_0x521c54[_0x30b4('0x37')]=qs['filters'](_['pick'](_0x454745[_0x30b4('0x2e')],_0x5e0e11['filters']),_0x4f831a);if(_0x454745['query'][_0x30b4('0x38')]){_0x521c54[_0x30b4('0x37')]=_['merge'](_0x521c54[_0x30b4('0x37')],{'$or':_['map'](_0x4f831a,function(_0x28d93b){if(_0x28d93b[_0x30b4('0x2b')]!==_0x30b4('0x39')){var _0x19af0c={};_0x19af0c[_0x28d93b[_0x30b4('0x25')]]={'$like':'%'+_0x454745[_0x30b4('0x2e')][_0x30b4('0x38')]+'%'};return _0x19af0c;}})});}_0x521c54=_[_0x30b4('0x3a')]({},_0x521c54,_0x454745[_0x30b4('0x3b')]);var _0x22fa8a={'where':_0x521c54[_0x30b4('0x37')]};return db[_0x30b4('0x3c')][_0x30b4('0x3d')](_0x22fa8a)['then'](function(_0x35247d){_0x486409[_0x30b4('0x3d')]=_0x35247d;if(_0x454745['query']['includeAll']){_0x521c54['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x521c54);})[_0x30b4('0x24')](function(_0x1e3c78){_0x486409[_0x30b4('0x3e')]=_0x1e3c78;return _0x486409;})[_0x30b4('0x24')](respondWithFilteredResult(_0x532b7e,_0x521c54))[_0x30b4('0x3f')](handleError(_0x532b7e,null));};exports['show']=function(_0x2e5231,_0x4a49d5){var _0x5c896c={'raw':![],'where':{'id':_0x2e5231[_0x30b4('0x40')]['id']}},_0x539e31={};_0x539e31[_0x30b4('0x2d')]=_[_0x30b4('0x41')](db[_0x30b4('0x3c')]['rawAttributes']);_0x539e31[_0x30b4('0x2e')]=_[_0x30b4('0x41')](_0x2e5231[_0x30b4('0x2e')]);_0x539e31[_0x30b4('0x42')]=_['intersection'](_0x539e31[_0x30b4('0x2d')],_0x539e31[_0x30b4('0x2e')]);_0x5c896c[_0x30b4('0x30')]=_[_0x30b4('0x2f')](_0x539e31[_0x30b4('0x2d')],qs[_0x30b4('0x31')](_0x2e5231[_0x30b4('0x2e')][_0x30b4('0x31')]));_0x5c896c[_0x30b4('0x30')]=_0x5c896c[_0x30b4('0x30')][_0x30b4('0x32')]?_0x5c896c[_0x30b4('0x30')]:_0x539e31['model'];if(_0x2e5231['query'][_0x30b4('0x43')]){_0x5c896c[_0x30b4('0x44')]=[{'all':!![]}];}_0x5c896c=_['merge']({},_0x5c896c,_0x2e5231[_0x30b4('0x3b')]);return db['IntegrationReport']['find'](_0x5c896c)[_0x30b4('0x24')](handleEntityNotFound(_0x4a49d5,null))[_0x30b4('0x24')](respondWithResult(_0x4a49d5,null))[_0x30b4('0x3f')](handleError(_0x4a49d5,null));};exports[_0x30b4('0x45')]=function(_0x2113f5,_0x3b9555){return db['IntegrationReport'][_0x30b4('0x45')](_0x2113f5['body'],{})[_0x30b4('0x24')](respondWithResult(_0x3b9555,0xc9))['catch'](handleError(_0x3b9555,null));};exports[_0x30b4('0x23')]=function(_0x9adb9a,_0x6f7ab4){if(_0x9adb9a[_0x30b4('0x46')]['id']){delete _0x9adb9a[_0x30b4('0x46')]['id'];}return db['IntegrationReport'][_0x30b4('0x47')]({'where':{'id':_0x9adb9a[_0x30b4('0x40')]['id']}})['then'](handleEntityNotFound(_0x6f7ab4,null))[_0x30b4('0x24')](saveUpdates(_0x9adb9a[_0x30b4('0x46')],null))['then'](respondWithResult(_0x6f7ab4,null))[_0x30b4('0x3f')](handleError(_0x6f7ab4,null));};exports[_0x30b4('0x48')]=function(_0x542f6b,_0x5bd466){return db['IntegrationReport'][_0x30b4('0x47')]({'where':{'id':_0x542f6b[_0x30b4('0x40')]['id']}})[_0x30b4('0x24')](handleEntityNotFound(_0x5bd466,null))[_0x30b4('0x24')](removeEntity(_0x5bd466,null))['catch'](handleError(_0x5bd466,null));};exports[_0x30b4('0x49')]=function(_0x5ddd4a,_0x47a259){return db[_0x30b4('0x3c')][_0x30b4('0x49')]()[_0x30b4('0x24')](respondWithResult(_0x47a259,null))[_0x30b4('0x3f')](handleError(_0x47a259,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1976080..c828d51 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 _0x679f=['../../config/environment','exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x679f,0x139));var _0xf679=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x679f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf679('0x0'));var util=require('util');var logger=require(_0xf679('0x1'))(_0xf679('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf679('0x3'));var fs=require('fs');var path=require(_0xf679('0x4'));var rimraf=require(_0xf679('0x5'));var config=require(_0xf679('0x6'));var attributes=require('./integrationReport.attributes');module[_0xf679('0x7')]=function(_0x390408,_0x6a91c6){return _0x390408[_0xf679('0x8')](_0xf679('0x9'),attributes,{'tableName':_0xf679('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ec=['report_integration','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0xff7f0a,_0xc8b980){var _0x406117=function(_0x57429c){while(--_0x57429c){_0xff7f0a['push'](_0xff7f0a['shift']());}};_0x406117(++_0xc8b980);}(_0xd0ec,0xf8));var _0xcd0e=function(_0x176228,_0x2b4ff5){_0x176228=_0x176228-0x0;var _0x57457e=_0xd0ec[_0x176228];return _0x57457e;};'use strict';var _=require(_0xcd0e('0x0'));var util=require(_0xcd0e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcd0e('0x2'));var BPromise=require(_0xcd0e('0x3'));var rp=require(_0xcd0e('0x4'));var fs=require('fs');var path=require(_0xcd0e('0x5'));var rimraf=require(_0xcd0e('0x6'));var config=require(_0xcd0e('0x7'));var attributes=require(_0xcd0e('0x8'));module[_0xcd0e('0x9')]=function(_0x3ee63e,_0x2178ef){return _0x3ee63e[_0xcd0e('0xa')](_0xcd0e('0xb'),attributes,{'tableName':_0xcd0e('0xc'),'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 c85e998..d929b64 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 _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x33e114,_0x77cc5a){var _0x17e9b6=function(_0xd1cb2f){while(--_0xd1cb2f){_0x33e114['push'](_0x33e114['shift']());}};_0x17e9b6(++_0x77cc5a);}(_0x31f0,0xb7));var _0x031f=function(_0x44a626,_0x46731d){_0x44a626=_0x44a626-0x0;var _0x347a77=_0x31f0[_0x44a626];return _0x347a77;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2a25c4,_0x449a7f){_0x2a25c4=_0x2a25c4-0x0;var _0x27d21b=_0xc2c7[_0x2a25c4];return _0x27d21b;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a9a3353..85de513 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 _0xfef2=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfef2,0x1e0));var _0x2fef=function(_0x17044c,_0x208790){_0x17044c=_0x17044c-0x0;var _0x5e6db0=_0xfef2[_0x17044c];return _0x5e6db0;};'use strict';var multer=require(_0x2fef('0x0'));var util=require(_0x2fef('0x1'));var path=require(_0x2fef('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fef('0x3'));var router=express[_0x2fef('0x4')]();var fs_extra=require(_0x2fef('0x5'));var auth=require(_0x2fef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2fef('0x7'));var controller=require('./interval.controller');router[_0x2fef('0x8')]('/',auth[_0x2fef('0x9')](),controller[_0x2fef('0xa')]);router[_0x2fef('0x8')](_0x2fef('0xb'),auth[_0x2fef('0x9')](),controller[_0x2fef('0xc')]);router[_0x2fef('0x8')](_0x2fef('0xd'),auth[_0x2fef('0x9')](),controller[_0x2fef('0xe')]);router['post']('/',auth[_0x2fef('0x9')](),controller['create']);router[_0x2fef('0xf')](_0x2fef('0xd'),auth[_0x2fef('0x9')](),controller[_0x2fef('0x10')]);router[_0x2fef('0xf')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x2fef('0x11')]);router[_0x2fef('0x12')]('/:id',auth[_0x2fef('0x9')](),controller['update']);router['delete'](_0x2fef('0xb'),auth[_0x2fef('0x9')](),controller[_0x2fef('0x13')]);module[_0x2fef('0x14')]=router; \ No newline at end of file +var _0xd325=['../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd325,0x1f3));var _0x5d32=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xd325[_0x5d8018];return _0x151ac4;};'use strict';var multer=require(_0x5d32('0x0'));var util=require(_0x5d32('0x1'));var path=require('path');var timeout=require(_0x5d32('0x2'));var express=require(_0x5d32('0x3'));var router=express[_0x5d32('0x4')]();var fs_extra=require(_0x5d32('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5d32('0x6'));var config=require(_0x5d32('0x7'));var controller=require('./interval.controller');router['get']('/',auth[_0x5d32('0x8')](),controller[_0x5d32('0x9')]);router[_0x5d32('0xa')](_0x5d32('0xb'),auth[_0x5d32('0x8')](),controller[_0x5d32('0xc')]);router['get'](_0x5d32('0xd'),auth[_0x5d32('0x8')](),controller[_0x5d32('0xe')]);router[_0x5d32('0xf')]('/',auth[_0x5d32('0x8')](),controller['create']);router['post']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x5d32('0x10')]);router['post'](_0x5d32('0x11'),auth[_0x5d32('0x8')](),controller['addIntervals']);router[_0x5d32('0x12')](_0x5d32('0xb'),auth[_0x5d32('0x8')](),controller[_0x5d32('0x13')]);router[_0x5d32('0x14')](_0x5d32('0xb'),auth['isAuthenticated'](),controller[_0x5d32('0x15')]);module[_0x5d32('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 31b32e9..ed9122a 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 _0x1264=['sequelize','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1264,0x8a));var _0x4126=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x1264[_0x35d8af];return _0x1d08b0;};'use strict';var Sequelize=require(_0x4126('0x0'));module[_0x4126('0x1')]={'name':{'type':Sequelize[_0x4126('0x2')]},'description':{'type':Sequelize[_0x4126('0x2')]},'interval':{'type':Sequelize[_0x4126('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa8b8=['sequelize','exports','STRING'];(function(_0x409507,_0x3d4002){var _0xc3dcf5=function(_0xc3bb6b){while(--_0xc3bb6b){_0x409507['push'](_0x409507['shift']());}};_0xc3dcf5(++_0x3d4002);}(_0xa8b8,0x90));var _0x8a8b=function(_0x14a150,_0x38ff36){_0x14a150=_0x14a150-0x0;var _0x2fc871=_0xa8b8[_0x14a150];return _0x2fc871;};'use strict';var Sequelize=require(_0x8a8b('0x0'));module[_0x8a8b('0x1')]={'name':{'type':Sequelize[_0x8a8b('0x2')]},'description':{'type':Sequelize[_0x8a8b('0x2')]},'interval':{'type':Sequelize[_0x8a8b('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index dcfc5dd..8d6119d 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 _0xffe9=['sox','to-csv','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/extensions/rewrite','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','map','Interval','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','length','order','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x1e6763,_0x5d2711){var _0x33786d=function(_0x210ef1){while(--_0x210ef1){_0x1e6763['push'](_0x1e6763['shift']());}};_0x33786d(++_0x5d2711);}(_0xffe9,0x170));var _0x9ffe=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0xffe9[_0x43f47b];return _0x4af9a6;};'use strict';var emlformat=require(_0x9ffe('0x0'));var rimraf=require(_0x9ffe('0x1'));var zipdir=require(_0x9ffe('0x2'));var jsonpatch=require(_0x9ffe('0x3'));var rp=require(_0x9ffe('0x4'));var moment=require(_0x9ffe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9ffe('0x6'));var util=require(_0x9ffe('0x7'));var path=require('path');var sox=require(_0x9ffe('0x8'));var csv=require(_0x9ffe('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ffe('0xa'));var _=require(_0x9ffe('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ffe('0xc'));var deskjs=require(_0x9ffe('0xd'));var toCsv=require(_0x9ffe('0x9'));var querystring=require('querystring');var Papa=require(_0x9ffe('0xe'));var Redis=require(_0x9ffe('0xf'));var authService=require(_0x9ffe('0x10'));var qs=require(_0x9ffe('0x11'));var as=require(_0x9ffe('0x12'));var hardwareService=require(_0x9ffe('0x13'));var logger=require(_0x9ffe('0x14'))(_0x9ffe('0x15'));var utils=require(_0x9ffe('0x16'));var config=require(_0x9ffe('0x17'));var licenseUtil=require(_0x9ffe('0x18'));var db=require(_0x9ffe('0x19'))['db'];var extensions=require(_0x9ffe('0x1a'));function respondWithStatusCode(_0xc2449,_0x4320f4){_0x4320f4=_0x4320f4||0xcc;return function(_0x4a4376){if(_0x4a4376){return _0xc2449[_0x9ffe('0x1b')](_0x4320f4);}return _0xc2449[_0x9ffe('0x1c')](_0x4320f4)[_0x9ffe('0x1d')]();};}function respondWithResult(_0xf5a8a9,_0x116cbe){_0x116cbe=_0x116cbe||0xc8;return function(_0x48d96a){if(_0x48d96a){return _0xf5a8a9[_0x9ffe('0x1c')](_0x116cbe)['json'](_0x48d96a);}};}function respondWithFilteredResult(_0x3148a5,_0x3049d0){return function(_0x539fd8){if(_0x539fd8){var _0x2b8afb=typeof _0x3049d0[_0x9ffe('0x1e')]===_0x9ffe('0x1f')&&typeof _0x3049d0['limit']===_0x9ffe('0x1f');var _0x37a289=_0x539fd8[_0x9ffe('0x20')];var _0x232738=_0x2b8afb?0x0:_0x3049d0['offset'];var _0xd72691=_0x2b8afb?_0x539fd8['count']:_0x3049d0[_0x9ffe('0x1e')]+_0x3049d0[_0x9ffe('0x21')];var _0x5d8167;if(_0xd72691>=_0x37a289){_0xd72691=_0x37a289;_0x5d8167=0xc8;}else{_0x5d8167=0xce;}_0x3148a5[_0x9ffe('0x1c')](_0x5d8167);return _0x3148a5[_0x9ffe('0x22')](_0x9ffe('0x23'),_0x232738+'-'+_0xd72691+'/'+_0x37a289)[_0x9ffe('0x24')](_0x539fd8);}return null;};}function patchUpdates(_0x144fae){return function(_0x496316){try{jsonpatch[_0x9ffe('0x25')](_0x496316,_0x144fae,!![]);}catch(_0x2c722b){return BPromise[_0x9ffe('0x26')](_0x2c722b);}return _0x496316['save']();};}function saveUpdates(_0x4cfb0e,_0x29b570){return function(_0x2b40cd){if(_0x2b40cd){return _0x2b40cd['update'](_0x4cfb0e)[_0x9ffe('0x27')](function(_0x5617d3){return _0x5617d3;});}return null;};}function removeEntity(_0xbf6944,_0x145368){return function(_0xd8f65c){if(_0xd8f65c){return _0xd8f65c['destroy']()['then'](function(){var _0x669875=_0xd8f65c[_0x9ffe('0x28')]({'plain':!![]});var _0x2c5ced=_0x9ffe('0x29');return db[_0x9ffe('0x2a')][_0x9ffe('0x2b')]({'where':{'type':_0x2c5ced,'resourceId':_0x669875['id']}})['then'](function(){return _0xd8f65c;});})[_0x9ffe('0x27')](function(){_0xbf6944[_0x9ffe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x711fa8,_0x203ca3){return function(_0x556db3){if(!_0x556db3){_0x711fa8[_0x9ffe('0x1b')](0x194);}return _0x556db3;};}function handleError(_0x4a87ba,_0x5e5950){_0x5e5950=_0x5e5950||0x1f4;return function(_0x534289){logger[_0x9ffe('0x2c')](_0x534289[_0x9ffe('0x2d')]);if(_0x534289[_0x9ffe('0x2e')]){delete _0x534289[_0x9ffe('0x2e')];}_0x4a87ba[_0x9ffe('0x1c')](_0x5e5950)[_0x9ffe('0x2f')](_0x534289);};}exports['index']=function(_0x443fde,_0x3596f7){var _0xcf730c={},_0x5b3989={},_0x2ca6cf={'count':0x0,'rows':[]};var _0x3b26d6=_[_0x9ffe('0x30')](db[_0x9ffe('0x31')][_0x9ffe('0x32')],function(_0xbd4ec){return{'name':_0xbd4ec['fieldName'],'type':_0xbd4ec[_0x9ffe('0x33')][_0x9ffe('0x34')]};});_0x5b3989[_0x9ffe('0x35')]=_[_0x9ffe('0x30')](_0x3b26d6,_0x9ffe('0x2e'));_0x5b3989[_0x9ffe('0x36')]=_['keys'](_0x443fde[_0x9ffe('0x36')]);_0x5b3989[_0x9ffe('0x37')]=_[_0x9ffe('0x38')](_0x5b3989[_0x9ffe('0x35')],_0x5b3989['query']);_0xcf730c[_0x9ffe('0x39')]=_[_0x9ffe('0x38')](_0x5b3989[_0x9ffe('0x35')],qs['fields'](_0x443fde[_0x9ffe('0x36')][_0x9ffe('0x3a')]));_0xcf730c['attributes']=_0xcf730c[_0x9ffe('0x39')]['length']?_0xcf730c[_0x9ffe('0x39')]:_0x5b3989[_0x9ffe('0x35')];if(!_0x443fde[_0x9ffe('0x36')][_0x9ffe('0x3b')](_0x9ffe('0x3c'))){_0xcf730c[_0x9ffe('0x21')]=qs[_0x9ffe('0x21')](_0x443fde[_0x9ffe('0x36')][_0x9ffe('0x21')]);_0xcf730c[_0x9ffe('0x1e')]=qs['offset'](_0x443fde[_0x9ffe('0x36')][_0x9ffe('0x1e')]);}_0xcf730c['order']=qs[_0x9ffe('0x3d')](_0x443fde[_0x9ffe('0x36')][_0x9ffe('0x3d')]);_0xcf730c[_0x9ffe('0x3e')]=qs['filters'](_[_0x9ffe('0x3f')](_0x443fde['query'],_0x5b3989[_0x9ffe('0x37')]),_0x3b26d6);if(_0x443fde['query']['filter']){_0xcf730c[_0x9ffe('0x3e')]=_['merge'](_0xcf730c['where'],{'$or':_[_0x9ffe('0x30')](_0x3b26d6,function(_0x4d0b18){if(_0x4d0b18[_0x9ffe('0x33')]!==_0x9ffe('0x40')){var _0xde29e0={};_0xde29e0[_0x4d0b18['name']]={'$like':'%'+_0x443fde[_0x9ffe('0x36')][_0x9ffe('0x41')]+'%'};return _0xde29e0;}})});}_0xcf730c=_[_0x9ffe('0x42')]({},_0xcf730c,_0x443fde[_0x9ffe('0x43')]);var _0x40d7af={'where':_0xcf730c[_0x9ffe('0x3e')]};return db[_0x9ffe('0x31')][_0x9ffe('0x20')](_0x40d7af)[_0x9ffe('0x27')](function(_0x2026d2){_0x2ca6cf['count']=_0x2026d2;if(_0x443fde[_0x9ffe('0x36')]['includeAll']){_0xcf730c[_0x9ffe('0x44')]=[{'all':!![]}];}return db[_0x9ffe('0x31')][_0x9ffe('0x45')](_0xcf730c);})[_0x9ffe('0x27')](function(_0x177efa){_0x2ca6cf[_0x9ffe('0x46')]=_0x177efa;return _0x2ca6cf;})[_0x9ffe('0x27')](respondWithFilteredResult(_0x3596f7,_0xcf730c))['catch'](handleError(_0x3596f7,null));};exports['show']=function(_0x124240,_0x2c9f7b){var _0xcedf44={'raw':!![],'where':{'id':_0x124240['params']['id']}},_0x2287dd={};_0x2287dd[_0x9ffe('0x35')]=_[_0x9ffe('0x47')](db[_0x9ffe('0x31')][_0x9ffe('0x32')]);_0x2287dd['query']=_['keys'](_0x124240[_0x9ffe('0x36')]);_0x2287dd['filters']=_['intersection'](_0x2287dd[_0x9ffe('0x35')],_0x2287dd[_0x9ffe('0x36')]);_0xcedf44[_0x9ffe('0x39')]=_[_0x9ffe('0x38')](_0x2287dd[_0x9ffe('0x35')],qs[_0x9ffe('0x3a')](_0x124240[_0x9ffe('0x36')]['fields']));_0xcedf44[_0x9ffe('0x39')]=_0xcedf44['attributes']['length']?_0xcedf44[_0x9ffe('0x39')]:_0x2287dd['model'];if(_0x124240[_0x9ffe('0x36')][_0x9ffe('0x48')]){_0xcedf44[_0x9ffe('0x44')]=[{'all':!![]}];}_0xcedf44=_[_0x9ffe('0x42')]({},_0xcedf44,_0x124240['options']);return db[_0x9ffe('0x31')][_0x9ffe('0x49')](_0xcedf44)[_0x9ffe('0x27')](handleEntityNotFound(_0x2c9f7b,null))['then'](respondWithResult(_0x2c9f7b,null))['catch'](handleError(_0x2c9f7b,null));};exports['create']=function(_0x463f99,_0x1fabfb){return db['Interval'][_0x9ffe('0x4a')](_0x463f99[_0x9ffe('0x4b')],{})['then'](function(_0x11decb){var _0x319fca=_0x463f99['user'][_0x9ffe('0x28')]({'plain':!![]});if(!_0x319fca)throw new Error(_0x9ffe('0x4c'));if(_0x319fca[_0x9ffe('0x4d')]===_0x9ffe('0x4e')){var _0x36cfd2=_0x11decb['get']({'plain':!![]});var _0x3c8757='Intervals';return db[_0x9ffe('0x4f')]['find']({'where':{'name':_0x3c8757,'userProfileId':_0x319fca[_0x9ffe('0x50')]},'raw':!![]})[_0x9ffe('0x27')](function(_0xa5943a){if(_0xa5943a&&_0xa5943a[_0x9ffe('0x51')]===0x0){return db[_0x9ffe('0x2a')][_0x9ffe('0x4a')]({'name':_0x36cfd2['name'],'resourceId':_0x36cfd2['id'],'type':_0xa5943a['name'],'sectionId':_0xa5943a['id']},{})[_0x9ffe('0x27')](function(){return _0x11decb;});}else{return _0x11decb;}})[_0x9ffe('0x52')](function(_0xf6d327){logger[_0x9ffe('0x2c')](_0x9ffe('0x53'),_0xf6d327);throw _0xf6d327;});}return _0x11decb;})['then'](respondWithResult(_0x1fabfb,0xc9))[_0x9ffe('0x52')](handleError(_0x1fabfb,null));};exports[_0x9ffe('0x54')]=function(_0x5823ee,_0x333647){if(_0x5823ee['body']['id']){delete _0x5823ee[_0x9ffe('0x4b')]['id'];}return db[_0x9ffe('0x31')]['find']({'where':{'id':_0x5823ee['params']['id']}})['then'](handleEntityNotFound(_0x333647,null))['then'](saveUpdates(_0x5823ee[_0x9ffe('0x4b')],null))['then'](respondWithResult(_0x333647,null))[_0x9ffe('0x52')](handleError(_0x333647,null));};exports[_0x9ffe('0x2b')]=function(_0x1a822a,_0x230e0a){return db[_0x9ffe('0x31')][_0x9ffe('0x49')]({'where':{'id':_0x1a822a[_0x9ffe('0x55')]['id']}})['then'](handleEntityNotFound(_0x230e0a,null))['then'](removeEntity(_0x230e0a,null))[_0x9ffe('0x52')](handleError(_0x230e0a,null));};exports[_0x9ffe('0x56')]=function(_0x1f3e75,_0x57090f,_0xf6cd1){if(_0x1f3e75[_0x9ffe('0x4b')]['id']){delete _0x1f3e75[_0x9ffe('0x4b')]['id'];}return db[_0x9ffe('0x31')]['find']({'where':{'id':_0x1f3e75[_0x9ffe('0x55')]['id']}})[_0x9ffe('0x27')](handleEntityNotFound(_0x57090f,null))[_0x9ffe('0x27')](function(_0x9bd67b){if(_0x9bd67b){_0x1f3e75[_0x9ffe('0x4b')][_0x9ffe('0x57')]=_0x9bd67b['id'];return db[_0x9ffe('0x31')][_0x9ffe('0x4a')](_0x1f3e75[_0x9ffe('0x4b')]);}})[_0x9ffe('0x27')](respondWithResult(_0x57090f,null))[_0x9ffe('0x52')](handleError(_0x57090f,null));};exports[_0x9ffe('0x58')]=function(_0x14bb83,_0x68c4e,_0x27276b){var _0x174189={};var _0x15c454={};var _0x15ffc1;var _0x214cec;return db[_0x9ffe('0x31')][_0x9ffe('0x59')]({'where':{'id':_0x14bb83[_0x9ffe('0x55')]['id']}})[_0x9ffe('0x27')](handleEntityNotFound(_0x68c4e,null))['then'](function(_0x414363){if(_0x414363){_0x15ffc1=_0x414363;_0x15c454['model']=_['keys'](db[_0x9ffe('0x31')][_0x9ffe('0x32')]);_0x15c454['query']=_[_0x9ffe('0x47')](_0x14bb83[_0x9ffe('0x36')]);_0x15c454[_0x9ffe('0x37')]=_[_0x9ffe('0x38')](_0x15c454[_0x9ffe('0x35')],_0x15c454['query']);_0x174189['attributes']=_['intersection'](_0x15c454['model'],qs[_0x9ffe('0x3a')](_0x14bb83[_0x9ffe('0x36')]['fields']));_0x174189[_0x9ffe('0x39')]=_0x174189['attributes'][_0x9ffe('0x5a')]?_0x174189[_0x9ffe('0x39')]:_0x15c454[_0x9ffe('0x35')];_0x174189[_0x9ffe('0x5b')]=qs[_0x9ffe('0x3d')](_0x14bb83[_0x9ffe('0x36')][_0x9ffe('0x3d')]);_0x174189[_0x9ffe('0x3e')]=qs['filters'](_[_0x9ffe('0x3f')](_0x14bb83['query'],_0x15c454[_0x9ffe('0x37')]));if(_0x14bb83['query'][_0x9ffe('0x41')]){_0x174189[_0x9ffe('0x3e')]=_[_0x9ffe('0x42')](_0x174189['where'],{'$or':_[_0x9ffe('0x30')](_0x174189[_0x9ffe('0x39')],function(_0xb7cce3){var _0x2775e9={};_0x2775e9[_0xb7cce3]={'$like':'%'+_0x14bb83[_0x9ffe('0x36')]['filter']+'%'};return _0x2775e9;})});}_0x174189=_[_0x9ffe('0x42')]({},_0x174189,_0x14bb83['options']);return _0x15ffc1[_0x9ffe('0x58')](_0x174189);}})[_0x9ffe('0x27')](function(_0x56eadf){if(_0x56eadf){_0x214cec=_0x56eadf[_0x9ffe('0x5a')];if(!_0x14bb83[_0x9ffe('0x36')]['hasOwnProperty'](_0x9ffe('0x3c'))){_0x174189[_0x9ffe('0x21')]=qs[_0x9ffe('0x21')](_0x14bb83['query']['limit']);_0x174189[_0x9ffe('0x1e')]=qs['offset'](_0x14bb83['query']['offset']);}return _0x15ffc1[_0x9ffe('0x58')](_0x174189);}})[_0x9ffe('0x27')](function(_0x286dbd){if(_0x286dbd){return _0x286dbd?{'count':_0x214cec,'rows':_0x286dbd}:null;}})[_0x9ffe('0x27')](respondWithResult(_0x68c4e,null))[_0x9ffe('0x52')](handleError(_0x68c4e,null));};exports['addIntervals']=function(_0x41ee,_0x30ded4,_0x4aca5c){return db['Interval'][_0x9ffe('0x59')]({'where':{'id':_0x41ee[_0x9ffe('0x55')]['id']}})[_0x9ffe('0x27')](handleEntityNotFound(_0x30ded4,null))[_0x9ffe('0x27')](function(_0x454675){if(_0x454675){return db[_0x9ffe('0x5c')]['transaction'](function(_0x24b704){return db[_0x9ffe('0x31')][_0x9ffe('0x2b')]({'where':{'IntervalId':_0x41ee[_0x9ffe('0x55')]['id']},'transaction':_0x24b704})[_0x9ffe('0x27')](function(_0x1e999f){var _0x237098=_['map'](_0x41ee[_0x9ffe('0x4b')],function(_0x580d8c){delete _0x580d8c['id'];_0x580d8c[_0x9ffe('0x57')]=_0x41ee[_0x9ffe('0x55')]['id'];return _0x580d8c;});return db[_0x9ffe('0x31')][_0x9ffe('0x5d')](_0x237098,{'transaction':_0x24b704});});})[_0x9ffe('0x27')](function(){return db[_0x9ffe('0x31')][_0x9ffe('0x45')]({'where':{'IntervalId':_0x41ee['params']['id']}});});}})[_0x9ffe('0x27')](respondWithResult(_0x30ded4,null))['catch'](handleError(_0x30ded4,null));}; \ No newline at end of file +var _0x60a3=['get','Intervals','UserProfileResource','sendStatus','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','find','create','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','sort','findOne','sequelize','transaction','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x305c29,_0x5065a2){var _0x916e31=function(_0x36769f){while(--_0x36769f){_0x305c29['push'](_0x305c29['shift']());}};_0x916e31(++_0x5065a2);}(_0x60a3,0x8e));var _0x360a=function(_0x474025,_0x1e3bf0){_0x474025=_0x474025-0x0;var _0x1202b4=_0x60a3[_0x474025];return _0x1202b4;};'use strict';var emlformat=require(_0x360a('0x0'));var rimraf=require(_0x360a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x360a('0x2'));var moment=require('moment');var BPromise=require(_0x360a('0x3'));var Mustache=require(_0x360a('0x4'));var util=require('util');var path=require(_0x360a('0x5'));var sox=require(_0x360a('0x6'));var csv=require(_0x360a('0x7'));var ejs=require(_0x360a('0x8'));var fs=require('fs');var fs_extra=require(_0x360a('0x9'));var _=require(_0x360a('0xa'));var squel=require(_0x360a('0xb'));var crypto=require(_0x360a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x360a('0xd'));var Papa=require(_0x360a('0xe'));var Redis=require(_0x360a('0xf'));var authService=require(_0x360a('0x10'));var qs=require(_0x360a('0x11'));var as=require(_0x360a('0x12'));var hardwareService=require(_0x360a('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x360a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x360a('0x15'))['db'];var extensions=require(_0x360a('0x16'));function respondWithStatusCode(_0x38bee7,_0x324184){_0x324184=_0x324184||0xcc;return function(_0x533979){if(_0x533979){return _0x38bee7['sendStatus'](_0x324184);}return _0x38bee7[_0x360a('0x17')](_0x324184)[_0x360a('0x18')]();};}function respondWithResult(_0x4093ad,_0x16dfa0){_0x16dfa0=_0x16dfa0||0xc8;return function(_0x2f4308){if(_0x2f4308){return _0x4093ad[_0x360a('0x17')](_0x16dfa0)[_0x360a('0x19')](_0x2f4308);}};}function respondWithFilteredResult(_0x1e6747,_0x52538b){return function(_0x1a22b7){if(_0x1a22b7){var _0x32513f=typeof _0x52538b[_0x360a('0x1a')]===_0x360a('0x1b')&&typeof _0x52538b[_0x360a('0x1c')]===_0x360a('0x1b');var _0x1b743e=_0x1a22b7[_0x360a('0x1d')];var _0x38fdbd=_0x32513f?0x0:_0x52538b[_0x360a('0x1a')];var _0x4169ed=_0x32513f?_0x1a22b7[_0x360a('0x1d')]:_0x52538b[_0x360a('0x1a')]+_0x52538b[_0x360a('0x1c')];var _0xe5457;if(_0x4169ed>=_0x1b743e){_0x4169ed=_0x1b743e;_0xe5457=0xc8;}else{_0xe5457=0xce;}_0x1e6747['status'](_0xe5457);return _0x1e6747[_0x360a('0x1e')](_0x360a('0x1f'),_0x38fdbd+'-'+_0x4169ed+'/'+_0x1b743e)['json'](_0x1a22b7);}return null;};}function patchUpdates(_0x198469){return function(_0x53d402){try{jsonpatch[_0x360a('0x20')](_0x53d402,_0x198469,!![]);}catch(_0x2e2d58){return BPromise[_0x360a('0x21')](_0x2e2d58);}return _0x53d402[_0x360a('0x22')]();};}function saveUpdates(_0x38a067,_0x32f518){return function(_0x2ca7cf){if(_0x2ca7cf){return _0x2ca7cf[_0x360a('0x23')](_0x38a067)[_0x360a('0x24')](function(_0x1a8732){return _0x1a8732;});}return null;};}function removeEntity(_0x179cb6,_0x1186e1){return function(_0x320af1){if(_0x320af1){return _0x320af1[_0x360a('0x25')]()['then'](function(){var _0x3f8700=_0x320af1[_0x360a('0x26')]({'plain':!![]});var _0xff063e=_0x360a('0x27');return db[_0x360a('0x28')][_0x360a('0x25')]({'where':{'type':_0xff063e,'resourceId':_0x3f8700['id']}})['then'](function(){return _0x320af1;});})[_0x360a('0x24')](function(){_0x179cb6[_0x360a('0x17')](0xcc)[_0x360a('0x18')]();});}};}function handleEntityNotFound(_0x176b47,_0x364129){return function(_0x30f892){if(!_0x30f892){_0x176b47[_0x360a('0x29')](0x194);}return _0x30f892;};}function handleError(_0x47f02c,_0x4c9c40){_0x4c9c40=_0x4c9c40||0x1f4;return function(_0x426dc9){logger['error'](_0x426dc9[_0x360a('0x2a')]);if(_0x426dc9[_0x360a('0x2b')]){delete _0x426dc9[_0x360a('0x2b')];}_0x47f02c[_0x360a('0x17')](_0x4c9c40)[_0x360a('0x2c')](_0x426dc9);};}exports['index']=function(_0x1968d5,_0x5555e1){var _0x3be158={},_0x32ed49={},_0x349a21={'count':0x0,'rows':[]};var _0x17db29=_[_0x360a('0x2d')](db[_0x360a('0x2e')][_0x360a('0x2f')],function(_0x5832f8){return{'name':_0x5832f8[_0x360a('0x30')],'type':_0x5832f8[_0x360a('0x31')][_0x360a('0x32')]};});_0x32ed49[_0x360a('0x33')]=_['map'](_0x17db29,'name');_0x32ed49['query']=_['keys'](_0x1968d5[_0x360a('0x34')]);_0x32ed49['filters']=_[_0x360a('0x35')](_0x32ed49[_0x360a('0x33')],_0x32ed49[_0x360a('0x34')]);_0x3be158['attributes']=_[_0x360a('0x35')](_0x32ed49[_0x360a('0x33')],qs[_0x360a('0x36')](_0x1968d5[_0x360a('0x34')][_0x360a('0x36')]));_0x3be158[_0x360a('0x37')]=_0x3be158['attributes']['length']?_0x3be158[_0x360a('0x37')]:_0x32ed49[_0x360a('0x33')];if(!_0x1968d5[_0x360a('0x34')][_0x360a('0x38')](_0x360a('0x39'))){_0x3be158[_0x360a('0x1c')]=qs[_0x360a('0x1c')](_0x1968d5[_0x360a('0x34')]['limit']);_0x3be158[_0x360a('0x1a')]=qs[_0x360a('0x1a')](_0x1968d5['query'][_0x360a('0x1a')]);}_0x3be158[_0x360a('0x3a')]=qs['sort'](_0x1968d5['query']['sort']);_0x3be158['where']=qs[_0x360a('0x3b')](_[_0x360a('0x3c')](_0x1968d5[_0x360a('0x34')],_0x32ed49[_0x360a('0x3b')]),_0x17db29);if(_0x1968d5['query'][_0x360a('0x3d')]){_0x3be158['where']=_[_0x360a('0x3e')](_0x3be158[_0x360a('0x3f')],{'$or':_[_0x360a('0x2d')](_0x17db29,function(_0x241ec9){if(_0x241ec9[_0x360a('0x31')]!==_0x360a('0x40')){var _0x30a52e={};_0x30a52e[_0x241ec9[_0x360a('0x2b')]]={'$like':'%'+_0x1968d5[_0x360a('0x34')][_0x360a('0x3d')]+'%'};return _0x30a52e;}})});}_0x3be158=_['merge']({},_0x3be158,_0x1968d5[_0x360a('0x41')]);var _0x4b3d2a={'where':_0x3be158['where']};return db[_0x360a('0x2e')][_0x360a('0x1d')](_0x4b3d2a)[_0x360a('0x24')](function(_0x51ca59){_0x349a21['count']=_0x51ca59;if(_0x1968d5[_0x360a('0x34')]['includeAll']){_0x3be158[_0x360a('0x42')]=[{'all':!![]}];}return db[_0x360a('0x2e')][_0x360a('0x43')](_0x3be158);})[_0x360a('0x24')](function(_0x253188){_0x349a21[_0x360a('0x44')]=_0x253188;return _0x349a21;})[_0x360a('0x24')](respondWithFilteredResult(_0x5555e1,_0x3be158))[_0x360a('0x45')](handleError(_0x5555e1,null));};exports[_0x360a('0x46')]=function(_0x1f4da3,_0x3bff50){var _0x47e3d4={'raw':!![],'where':{'id':_0x1f4da3[_0x360a('0x47')]['id']}},_0x35b0c8={};_0x35b0c8[_0x360a('0x33')]=_[_0x360a('0x48')](db[_0x360a('0x2e')][_0x360a('0x2f')]);_0x35b0c8[_0x360a('0x34')]=_[_0x360a('0x48')](_0x1f4da3[_0x360a('0x34')]);_0x35b0c8[_0x360a('0x3b')]=_[_0x360a('0x35')](_0x35b0c8[_0x360a('0x33')],_0x35b0c8[_0x360a('0x34')]);_0x47e3d4[_0x360a('0x37')]=_[_0x360a('0x35')](_0x35b0c8['model'],qs['fields'](_0x1f4da3[_0x360a('0x34')][_0x360a('0x36')]));_0x47e3d4['attributes']=_0x47e3d4[_0x360a('0x37')][_0x360a('0x49')]?_0x47e3d4['attributes']:_0x35b0c8[_0x360a('0x33')];if(_0x1f4da3['query']['includeAll']){_0x47e3d4[_0x360a('0x42')]=[{'all':!![]}];}_0x47e3d4=_[_0x360a('0x3e')]({},_0x47e3d4,_0x1f4da3[_0x360a('0x41')]);return db['Interval'][_0x360a('0x4a')](_0x47e3d4)['then'](handleEntityNotFound(_0x3bff50,null))[_0x360a('0x24')](respondWithResult(_0x3bff50,null))[_0x360a('0x45')](handleError(_0x3bff50,null));};exports['create']=function(_0x187309,_0x420267){return db[_0x360a('0x2e')][_0x360a('0x4b')](_0x187309['body'],{})[_0x360a('0x24')](function(_0xc4c008){var _0x2ca1ee=_0x187309[_0x360a('0x4c')][_0x360a('0x26')]({'plain':!![]});if(!_0x2ca1ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ca1ee[_0x360a('0x4d')]===_0x360a('0x4c')){var _0x2bf261=_0xc4c008[_0x360a('0x26')]({'plain':!![]});var _0x1223ec='Intervals';return db[_0x360a('0x4e')][_0x360a('0x4a')]({'where':{'name':_0x1223ec,'userProfileId':_0x2ca1ee[_0x360a('0x4f')]},'raw':!![]})['then'](function(_0x19d89a){if(_0x19d89a&&_0x19d89a['autoAssociation']===0x0){return db[_0x360a('0x28')][_0x360a('0x4b')]({'name':_0x2bf261[_0x360a('0x2b')],'resourceId':_0x2bf261['id'],'type':_0x19d89a[_0x360a('0x2b')],'sectionId':_0x19d89a['id']},{})[_0x360a('0x24')](function(){return _0xc4c008;});}else{return _0xc4c008;}})[_0x360a('0x45')](function(_0x4376b8){logger[_0x360a('0x50')](_0x360a('0x51'),_0x4376b8);throw _0x4376b8;});}return _0xc4c008;})[_0x360a('0x24')](respondWithResult(_0x420267,0xc9))[_0x360a('0x45')](handleError(_0x420267,null));};exports[_0x360a('0x23')]=function(_0x5f49f0,_0x2b61ad){if(_0x5f49f0['body']['id']){delete _0x5f49f0[_0x360a('0x52')]['id'];}return db['Interval'][_0x360a('0x4a')]({'where':{'id':_0x5f49f0[_0x360a('0x47')]['id']}})[_0x360a('0x24')](handleEntityNotFound(_0x2b61ad,null))[_0x360a('0x24')](saveUpdates(_0x5f49f0['body'],null))[_0x360a('0x24')](respondWithResult(_0x2b61ad,null))[_0x360a('0x45')](handleError(_0x2b61ad,null));};exports[_0x360a('0x25')]=function(_0x425010,_0x1bde99){return db[_0x360a('0x2e')][_0x360a('0x4a')]({'where':{'id':_0x425010[_0x360a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1bde99,null))[_0x360a('0x24')](removeEntity(_0x1bde99,null))[_0x360a('0x45')](handleError(_0x1bde99,null));};exports[_0x360a('0x53')]=function(_0xc3f338,_0x571b28,_0x3837e2){if(_0xc3f338['body']['id']){delete _0xc3f338[_0x360a('0x52')]['id'];}return db[_0x360a('0x2e')][_0x360a('0x4a')]({'where':{'id':_0xc3f338[_0x360a('0x47')]['id']}})['then'](handleEntityNotFound(_0x571b28,null))[_0x360a('0x24')](function(_0x599186){if(_0x599186){_0xc3f338[_0x360a('0x52')][_0x360a('0x54')]=_0x599186['id'];return db[_0x360a('0x2e')][_0x360a('0x4b')](_0xc3f338[_0x360a('0x52')]);}})[_0x360a('0x24')](respondWithResult(_0x571b28,null))[_0x360a('0x45')](handleError(_0x571b28,null));};exports[_0x360a('0x55')]=function(_0x3a396a,_0x12b23b,_0x3ca5c1){var _0x3090bc={};var _0x183798={};var _0x27e4d5;var _0x41082e;return db['Interval']['findOne']({'where':{'id':_0x3a396a[_0x360a('0x47')]['id']}})[_0x360a('0x24')](handleEntityNotFound(_0x12b23b,null))[_0x360a('0x24')](function(_0x17eae5){if(_0x17eae5){_0x27e4d5=_0x17eae5;_0x183798[_0x360a('0x33')]=_[_0x360a('0x48')](db[_0x360a('0x2e')][_0x360a('0x2f')]);_0x183798[_0x360a('0x34')]=_[_0x360a('0x48')](_0x3a396a[_0x360a('0x34')]);_0x183798[_0x360a('0x3b')]=_[_0x360a('0x35')](_0x183798[_0x360a('0x33')],_0x183798['query']);_0x3090bc[_0x360a('0x37')]=_[_0x360a('0x35')](_0x183798['model'],qs['fields'](_0x3a396a[_0x360a('0x34')][_0x360a('0x36')]));_0x3090bc[_0x360a('0x37')]=_0x3090bc['attributes'][_0x360a('0x49')]?_0x3090bc[_0x360a('0x37')]:_0x183798['model'];_0x3090bc[_0x360a('0x3a')]=qs[_0x360a('0x56')](_0x3a396a['query'][_0x360a('0x56')]);_0x3090bc['where']=qs[_0x360a('0x3b')](_[_0x360a('0x3c')](_0x3a396a[_0x360a('0x34')],_0x183798[_0x360a('0x3b')]));if(_0x3a396a[_0x360a('0x34')][_0x360a('0x3d')]){_0x3090bc[_0x360a('0x3f')]=_[_0x360a('0x3e')](_0x3090bc[_0x360a('0x3f')],{'$or':_[_0x360a('0x2d')](_0x3090bc['attributes'],function(_0x2c4643){var _0x185e54={};_0x185e54[_0x2c4643]={'$like':'%'+_0x3a396a[_0x360a('0x34')][_0x360a('0x3d')]+'%'};return _0x185e54;})});}_0x3090bc=_['merge']({},_0x3090bc,_0x3a396a[_0x360a('0x41')]);return _0x27e4d5['getIntervals'](_0x3090bc);}})[_0x360a('0x24')](function(_0x3809c7){if(_0x3809c7){_0x41082e=_0x3809c7['length'];if(!_0x3a396a['query'][_0x360a('0x38')](_0x360a('0x39'))){_0x3090bc[_0x360a('0x1c')]=qs[_0x360a('0x1c')](_0x3a396a['query'][_0x360a('0x1c')]);_0x3090bc[_0x360a('0x1a')]=qs[_0x360a('0x1a')](_0x3a396a[_0x360a('0x34')]['offset']);}return _0x27e4d5[_0x360a('0x55')](_0x3090bc);}})[_0x360a('0x24')](function(_0x3ac448){if(_0x3ac448){return _0x3ac448?{'count':_0x41082e,'rows':_0x3ac448}:null;}})[_0x360a('0x24')](respondWithResult(_0x12b23b,null))[_0x360a('0x45')](handleError(_0x12b23b,null));};exports['addIntervals']=function(_0x5cc172,_0xdba376,_0x4bcf2d){return db['Interval'][_0x360a('0x57')]({'where':{'id':_0x5cc172[_0x360a('0x47')]['id']}})[_0x360a('0x24')](handleEntityNotFound(_0xdba376,null))[_0x360a('0x24')](function(_0xcd9fcc){if(_0xcd9fcc){return db[_0x360a('0x58')][_0x360a('0x59')](function(_0x4dae7e){return db[_0x360a('0x2e')][_0x360a('0x25')]({'where':{'IntervalId':_0x5cc172[_0x360a('0x47')]['id']},'transaction':_0x4dae7e})[_0x360a('0x24')](function(_0x41c8cb){var _0x4f2f94=_[_0x360a('0x2d')](_0x5cc172[_0x360a('0x52')],function(_0x5e5793){delete _0x5e5793['id'];_0x5e5793[_0x360a('0x54')]=_0x5cc172[_0x360a('0x47')]['id'];return _0x5e5793;});return db[_0x360a('0x2e')]['bulkCreate'](_0x4f2f94,{'transaction':_0x4dae7e});});})['then'](function(){return db[_0x360a('0x2e')]['findAll']({'where':{'IntervalId':_0x5cc172['params']['id']}});});}})['then'](respondWithResult(_0xdba376,null))[_0x360a('0x45')](handleError(_0xdba376,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 8e62517..878a3ca 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 _0xd1f3=['lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xd1f3,0x16c));var _0x3d1f=function(_0x529ae5,_0x5cc451){_0x529ae5=_0x529ae5-0x0;var _0x2b6cb0=_0xd1f3[_0x529ae5];return _0x2b6cb0;};'use strict';var _=require(_0x3d1f('0x0'));var util=require('util');var logger=require(_0x3d1f('0x1'))('api');var moment=require(_0x3d1f('0x2'));var BPromise=require(_0x3d1f('0x3'));var rp=require(_0x3d1f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3d1f('0x5'));var attributes=require(_0x3d1f('0x6'));var extensions=require(_0x3d1f('0x7'));module[_0x3d1f('0x8')]=function(_0x219a3d,_0x430b19){return _0x219a3d[_0x3d1f('0x9')](_0x3d1f('0xa'),attributes,{'tableName':_0x3d1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x479d9d,_0x1e70ba){extensions['rewrite'](_0x219a3d,_0x479d9d);},'afterBulkCreate':function(_0x574224,_0x3e47de,_0x573d2c){_0x573d2c();extensions[_0x3d1f('0xc')](_0x219a3d,_0x574224[0x0]);},'afterUpdate':function(_0x36a8ba,_0x43e7bc){extensions['rewrite'](_0x219a3d,_0x36a8ba);},'afterDestroy':function(_0x140961,_0xa46b23){extensions[_0x3d1f('0xc')](_0x219a3d,_0x140961);}}});}; \ No newline at end of file +var _0xf94a=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf94a,0xa6));var _0xaf94=function(_0x18a19b,_0x5d4ecd){_0x18a19b=_0x18a19b-0x0;var _0x19bde2=_0xf94a[_0x18a19b];return _0x19bde2;};'use strict';var _=require(_0xaf94('0x0'));var util=require('util');var logger=require(_0xaf94('0x1'))(_0xaf94('0x2'));var moment=require(_0xaf94('0x3'));var BPromise=require(_0xaf94('0x4'));var rp=require(_0xaf94('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf94('0x6'));var config=require(_0xaf94('0x7'));var attributes=require(_0xaf94('0x8'));var extensions=require(_0xaf94('0x9'));module['exports']=function(_0x9c2ce4,_0x590440){return _0x9c2ce4[_0xaf94('0xa')](_0xaf94('0xb'),attributes,{'tableName':_0xaf94('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x114690,_0x9934be){extensions['rewrite'](_0x9c2ce4,_0x114690);},'afterBulkCreate':function(_0x38bc38,_0x324b5d,_0x309ebd){_0x309ebd();extensions[_0xaf94('0xd')](_0x9c2ce4,_0x38bc38[0x0]);},'afterUpdate':function(_0x5c2665,_0x4c3bb9){extensions[_0xaf94('0xd')](_0x9c2ce4,_0x5c2665);},'afterDestroy':function(_0x51dfd9,_0x403c17){extensions['rewrite'](_0x9c2ce4,_0x51dfd9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 71396bb..d01f340 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 377b060..ae861cf 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x0b0e[_0x2650e9];return _0x3511c8;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x0b0e,0x187));var _0xe0b0=function(_0x541095,_0x582b30){_0x541095=_0x541095-0x0;var _0x5a2c40=_0x0b0e[_0x541095];return _0x5a2c40;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3739d9a..d9ebe29 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 _0xf2d1=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','send','body','headers','x-forwarded-for','socket','remoteAddress','connection','bluebird','https','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','status','statusCode','json','error'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0xf2d1,0x1c4));var _0x1f2d=function(_0x104297,_0x45200f){_0x104297=_0x104297-0x0;var _0x194246=_0xf2d1[_0x104297];return _0x194246;};'use strict';var BPromise=require(_0x1f2d('0x0'));var https=require(_0x1f2d('0x1'));var logger=require('../../config/logger')(_0x1f2d('0x2'));var USERNAME='support';var PASSWORD=_0x1f2d('0x3');function openIssue(_0x371d77,_0xfe1d8e){var _0x553724={'fields':{'project':{'key':_0x371d77[_0x1f2d('0x4')]||'MOTGUI'},'summary':(_0x371d77[_0x1f2d('0x5')]||_0x1f2d('0x6'))+_0x1f2d('0x7')+_0x371d77['ip'],'description':_0x371d77[_0x1f2d('0x8')]||JSON['stringify'](_0x371d77),'issuetype':{'name':_0x371d77[_0x1f2d('0x9')]||_0x1f2d('0xa')}}};_0x553724[_0x1f2d('0xb')][_0x1f2d('0xc')]=_0x371d77[_0x1f2d('0xd')];_0x553724[_0x1f2d('0xb')][_0x1f2d('0xe')]=_0x371d77[_0x1f2d('0xf')];_0x553724[_0x1f2d('0xb')][_0x1f2d('0x10')]=_0x371d77[_0x1f2d('0x11')];_0x553724[_0x1f2d('0xb')]['customfield_11503']=_0x371d77[_0x1f2d('0x12')];_0x553724[_0x1f2d('0xb')][_0x1f2d('0x13')]=_0x371d77[_0x1f2d('0x14')];_0x553724[_0x1f2d('0xb')][_0x1f2d('0x15')]=_0x371d77['ip'];var _0x2d95ac={'host':_0x1f2d('0x16'),'port':0x1bb,'path':_0x1f2d('0x17'),'method':_0x1f2d('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x1f2d('0x19'),'Authorization':_0x1f2d('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x1f2d('0x1b')](_0x1f2d('0x1c'))}};var _0x49eb7a=JSON[_0x1f2d('0x1d')](_0x553724);var _0x435f97=https[_0x1f2d('0x1e')](_0x2d95ac,function(_0x41e47a){_0x41e47a[_0x1f2d('0x1f')](_0x1f2d('0x20'));var _0x1e37fe='';_0x41e47a['on'](_0x1f2d('0x21'),function(_0x32edad){_0x1e37fe+=_0x32edad;});_0x41e47a['on']('end',function(){if(_0xfe1d8e){return _0xfe1d8e[_0x1f2d('0x22')](_0x41e47a[_0x1f2d('0x23')])[_0x1f2d('0x24')](JSON['parse'](_0x1e37fe));}});});_0x435f97['on'](_0x1f2d('0x25'),function(_0x36f64e){if(_0xfe1d8e){return _0xfe1d8e[_0x1f2d('0x22')](0x1f4)[_0x1f2d('0x24')]({'errors':[{'message':_0x1f2d('0x26'),'type':_0x1f2d('0x27')}]});}});_0x435f97[_0x1f2d('0x28')](_0x49eb7a);_0x435f97[_0x1f2d('0x29')]();}exports['openIssue']=openIssue;exports[_0x1f2d('0x2a')]=function(_0x591607,_0x2982a6){_0x591607[_0x1f2d('0x2b')]['ip']=_0x591607[_0x1f2d('0x2c')][_0x1f2d('0x2d')]||_0x591607['connection']['remoteAddress']||_0x591607[_0x1f2d('0x2e')][_0x1f2d('0x2f')]||_0x591607[_0x1f2d('0x30')][_0x1f2d('0x2e')][_0x1f2d('0x2f')];return openIssue(_0x591607['body'],_0x2982a6);}; \ No newline at end of file +var _0x7709=['body','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write'];(function(_0x2b38d2,_0x2fef35){var _0x39b6f9=function(_0x3c0c7a){while(--_0x3c0c7a){_0x2b38d2['push'](_0x2b38d2['shift']());}};_0x39b6f9(++_0x2fef35);}(_0x7709,0x1e8));var _0x9770=function(_0xb6c024,_0x1c4ed8){_0xb6c024=_0xb6c024-0x0;var _0x364abf=_0x7709[_0xb6c024];return _0x364abf;};'use strict';var BPromise=require(_0x9770('0x0'));var https=require(_0x9770('0x1'));var logger=require(_0x9770('0x2'))(_0x9770('0x3'));var USERNAME=_0x9770('0x4');var PASSWORD=_0x9770('0x5');function openIssue(_0x19db2a,_0x55aa86){var _0x4701df={'fields':{'project':{'key':_0x19db2a[_0x9770('0x6')]||_0x9770('0x7')},'summary':(_0x19db2a['summary']||_0x9770('0x8'))+_0x9770('0x9')+_0x19db2a['ip'],'description':_0x19db2a[_0x9770('0xa')]||JSON[_0x9770('0xb')](_0x19db2a),'issuetype':{'name':_0x19db2a[_0x9770('0xc')]||_0x9770('0xd')}}};_0x4701df[_0x9770('0xe')]['customfield_11500']=_0x19db2a[_0x9770('0xf')];_0x4701df['fields']['customfield_11501']=_0x19db2a[_0x9770('0x10')];_0x4701df['fields'][_0x9770('0x11')]=_0x19db2a['newToken'];_0x4701df[_0x9770('0xe')][_0x9770('0x12')]=_0x19db2a[_0x9770('0x13')];_0x4701df['fields'][_0x9770('0x14')]=_0x19db2a[_0x9770('0x15')];_0x4701df['fields']['customfield_10102']=_0x19db2a['ip'];var _0x22e397={'host':_0x9770('0x16'),'port':0x1bb,'path':_0x9770('0x17'),'method':_0x9770('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x9770('0x19'),'Authorization':_0x9770('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9770('0x1b'))}};var _0x410df6=JSON[_0x9770('0xb')](_0x4701df);var _0x2379ae=https[_0x9770('0x1c')](_0x22e397,function(_0x24491f){_0x24491f[_0x9770('0x1d')](_0x9770('0x1e'));var _0x408d6b='';_0x24491f['on'](_0x9770('0x1f'),function(_0x4fe8ee){_0x408d6b+=_0x4fe8ee;});_0x24491f['on'](_0x9770('0x20'),function(){if(_0x55aa86){return _0x55aa86[_0x9770('0x21')](_0x24491f[_0x9770('0x22')])[_0x9770('0x23')](JSON[_0x9770('0x24')](_0x408d6b));}});});_0x2379ae['on'](_0x9770('0x25'),function(_0xd0fdda){if(_0x55aa86){return _0x55aa86['status'](0x1f4)[_0x9770('0x23')]({'errors':[{'message':_0x9770('0x26'),'type':'api.jira'}]});}});_0x2379ae[_0x9770('0x27')](_0x410df6);_0x2379ae[_0x9770('0x20')]();}exports['openIssue']=openIssue;exports['send']=function(_0x47efa8,_0x4a6072){_0x47efa8[_0x9770('0x28')]['ip']=_0x47efa8['headers']['x-forwarded-for']||_0x47efa8[_0x9770('0x29')]['remoteAddress']||_0x47efa8['socket'][_0x9770('0x2a')]||_0x47efa8[_0x9770('0x29')][_0x9770('0x2b')][_0x9770('0x2a')];return openIssue(_0x47efa8[_0x9770('0x28')],_0x4a6072);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ae79d5c..bdd550d 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(_0x3d77a7,_0x4cf5cc){var _0x27d929=function(_0x2a21a6){while(--_0x2a21a6){_0x3d77a7['push'](_0x3d77a7['shift']());}};_0x27d929(++_0x4cf5cc);}(_0xdace,0xc5));var _0xedac=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0xdace[_0x155c64];return _0x1f154a;};'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 _0x2750=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','/:id','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x2750,0x13b));var _0x0275=function(_0x37bd0c,_0x4e1265){_0x37bd0c=_0x37bd0c-0x0;var _0x40ac7d=_0x2750[_0x37bd0c];return _0x40ac7d;};'use strict';var multer=require(_0x0275('0x0'));var util=require('util');var path=require(_0x0275('0x1'));var timeout=require(_0x0275('0x2'));var express=require(_0x0275('0x3'));var router=express[_0x0275('0x4')]();var fs_extra=require(_0x0275('0x5'));var auth=require(_0x0275('0x6'));var interaction=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var controller=require(_0x0275('0x9'));router[_0x0275('0xa')]('/',auth['isAuthenticated'](),controller[_0x0275('0xb')]);router[_0x0275('0xa')](_0x0275('0xc'),auth[_0x0275('0xd')](),controller['describe']);router[_0x0275('0xa')](_0x0275('0xe'),auth[_0x0275('0xd')](),controller['show']);router['post']('/',auth[_0x0275('0xd')](),controller['create']);router[_0x0275('0xf')](_0x0275('0xe'),auth[_0x0275('0xd')](),controller[_0x0275('0x10')]);router[_0x0275('0x11')]('/:id',auth[_0x0275('0xd')](),controller[_0x0275('0x12')]);module[_0x0275('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 7aa967d..400fba0 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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x519ee9,_0x2eabcd){_0x519ee9=_0x519ee9-0x0;var _0x49f035=_0x7a54[_0x519ee9];return _0x49f035;};'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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x490f3d,_0x1e0ce8){_0x490f3d=_0x490f3d-0x0;var _0x148df9=_0x7a54[_0x490f3d];return _0x148df9;};'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 2c4a81d..e3c1b76 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 _0x36c3=['nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','end','json','offset','limit','count','set','apply','then','destroy','status','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0x18a861,_0x5699b9){var _0x356f56=function(_0x16b425){while(--_0x16b425){_0x18a861['push'](_0x18a861['shift']());}};_0x356f56(++_0x5699b9);}(_0x36c3,0x1a6));var _0x336c=function(_0x1e1dea,_0x16fe92){_0x1e1dea=_0x1e1dea-0x0;var _0x360ed7=_0x36c3[_0x1e1dea];return _0x360ed7;};'use strict';var emlformat=require(_0x336c('0x0'));var rimraf=require(_0x336c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x336c('0x2'));var rp=require(_0x336c('0x3'));var moment=require(_0x336c('0x4'));var BPromise=require(_0x336c('0x5'));var Mustache=require(_0x336c('0x6'));var util=require(_0x336c('0x7'));var path=require(_0x336c('0x8'));var sox=require('sox');var csv=require(_0x336c('0x9'));var ejs=require(_0x336c('0xa'));var fs=require('fs');var fs_extra=require(_0x336c('0xb'));var _=require(_0x336c('0xc'));var squel=require(_0x336c('0xd'));var crypto=require('crypto');var jsforce=require(_0x336c('0xe'));var deskjs=require(_0x336c('0xf'));var toCsv=require(_0x336c('0x9'));var querystring=require(_0x336c('0x10'));var Papa=require(_0x336c('0x11'));var Redis=require(_0x336c('0x12'));var authService=require(_0x336c('0x13'));var qs=require(_0x336c('0x14'));var as=require(_0x336c('0x15'));var hardwareService=require(_0x336c('0x16'));var logger=require(_0x336c('0x17'))(_0x336c('0x18'));var utils=require(_0x336c('0x19'));var config=require(_0x336c('0x1a'));var licenseUtil=require(_0x336c('0x1b'));var db=require(_0x336c('0x1c'))['db'];function respondWithStatusCode(_0x94b601,_0x4b08f8){_0x4b08f8=_0x4b08f8||0xcc;return function(_0x592a5b){if(_0x592a5b){return _0x94b601[_0x336c('0x1d')](_0x4b08f8);}return _0x94b601['status'](_0x4b08f8)[_0x336c('0x1e')]();};}function respondWithResult(_0xc6a857,_0x2115ce){_0x2115ce=_0x2115ce||0xc8;return function(_0x345be6){if(_0x345be6){return _0xc6a857['status'](_0x2115ce)[_0x336c('0x1f')](_0x345be6);}};}function respondWithFilteredResult(_0x15bc2b,_0x4ce90a){return function(_0x23b375){if(_0x23b375){var _0x5f5ae1=typeof _0x4ce90a[_0x336c('0x20')]==='undefined'&&typeof _0x4ce90a[_0x336c('0x21')]==='undefined';var _0x7610f4=_0x23b375[_0x336c('0x22')];var _0x4a46ff=_0x5f5ae1?0x0:_0x4ce90a['offset'];var _0x13db87=_0x5f5ae1?_0x23b375[_0x336c('0x22')]:_0x4ce90a[_0x336c('0x20')]+_0x4ce90a[_0x336c('0x21')];var _0x366182;if(_0x13db87>=_0x7610f4){_0x13db87=_0x7610f4;_0x366182=0xc8;}else{_0x366182=0xce;}_0x15bc2b['status'](_0x366182);return _0x15bc2b[_0x336c('0x23')]('Content-Range',_0x4a46ff+'-'+_0x13db87+'/'+_0x7610f4)['json'](_0x23b375);}return null;};}function patchUpdates(_0x5f401e){return function(_0x9d4fc6){try{jsonpatch[_0x336c('0x24')](_0x9d4fc6,_0x5f401e,!![]);}catch(_0x2c8254){return BPromise['reject'](_0x2c8254);}return _0x9d4fc6['save']();};}function saveUpdates(_0x5b6cc3,_0x3ba228){return function(_0x60d259){if(_0x60d259){return _0x60d259['update'](_0x5b6cc3)[_0x336c('0x25')](function(_0x421929){return _0x421929;});}return null;};}function removeEntity(_0x37a355,_0x56a6fb){return function(_0x473164){if(_0x473164){return _0x473164[_0x336c('0x26')]()[_0x336c('0x25')](function(){_0x37a355[_0x336c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401660,_0x9dc9bc){return function(_0x412a00){if(!_0x412a00){_0x401660[_0x336c('0x1d')](0x194);}return _0x412a00;};}function handleError(_0x27fcc2,_0x1cb083){_0x1cb083=_0x1cb083||0x1f4;return function(_0x567bfa){logger[_0x336c('0x28')](_0x567bfa[_0x336c('0x29')]);if(_0x567bfa[_0x336c('0x2a')]){delete _0x567bfa[_0x336c('0x2a')];}_0x27fcc2['status'](_0x1cb083)[_0x336c('0x2b')](_0x567bfa);};}exports[_0x336c('0x2c')]=function(_0x54b06b,_0x5476ff){var _0x562043={},_0x2ba9c1={},_0x1c7a34={'count':0x0,'rows':[]};var _0x489901=_['map'](db['JscriptyAnswerReport'][_0x336c('0x2d')],function(_0x37782a){return{'name':_0x37782a[_0x336c('0x2e')],'type':_0x37782a[_0x336c('0x2f')][_0x336c('0x30')]};});_0x2ba9c1[_0x336c('0x31')]=_[_0x336c('0x32')](_0x489901,'name');_0x2ba9c1[_0x336c('0x33')]=_[_0x336c('0x34')](_0x54b06b[_0x336c('0x33')]);_0x2ba9c1[_0x336c('0x35')]=_['intersection'](_0x2ba9c1[_0x336c('0x31')],_0x2ba9c1[_0x336c('0x33')]);_0x562043['attributes']=_[_0x336c('0x36')](_0x2ba9c1[_0x336c('0x31')],qs['fields'](_0x54b06b[_0x336c('0x33')][_0x336c('0x37')]));_0x562043[_0x336c('0x38')]=_0x562043[_0x336c('0x38')][_0x336c('0x39')]?_0x562043[_0x336c('0x38')]:_0x2ba9c1[_0x336c('0x31')];if(!_0x54b06b[_0x336c('0x33')]['hasOwnProperty'](_0x336c('0x3a'))){_0x562043[_0x336c('0x21')]=qs[_0x336c('0x21')](_0x54b06b[_0x336c('0x33')][_0x336c('0x21')]);_0x562043[_0x336c('0x20')]=qs[_0x336c('0x20')](_0x54b06b[_0x336c('0x33')][_0x336c('0x20')]);}_0x562043[_0x336c('0x3b')]=qs['sort'](_0x54b06b[_0x336c('0x33')][_0x336c('0x3c')]);_0x562043[_0x336c('0x3d')]=qs[_0x336c('0x35')](_[_0x336c('0x3e')](_0x54b06b[_0x336c('0x33')],_0x2ba9c1[_0x336c('0x35')]),_0x489901);if(_0x54b06b[_0x336c('0x33')][_0x336c('0x3f')]){_0x562043[_0x336c('0x3d')]=_['merge'](_0x562043[_0x336c('0x3d')],{'$or':_[_0x336c('0x32')](_0x489901,function(_0x3615a7){if(_0x3615a7['type']!==_0x336c('0x40')){var _0x154bc0={};_0x154bc0[_0x3615a7[_0x336c('0x2a')]]={'$like':'%'+_0x54b06b[_0x336c('0x33')]['filter']+'%'};return _0x154bc0;}})});}_0x562043=_[_0x336c('0x41')]({},_0x562043,_0x54b06b[_0x336c('0x42')]);var _0x478b10={'where':_0x562043[_0x336c('0x3d')]};return db[_0x336c('0x43')][_0x336c('0x22')](_0x478b10)['then'](function(_0x16c6c6){_0x1c7a34[_0x336c('0x22')]=_0x16c6c6;if(_0x54b06b[_0x336c('0x33')][_0x336c('0x44')]){_0x562043[_0x336c('0x45')]=[{'all':!![]}];}return db[_0x336c('0x43')][_0x336c('0x46')](_0x562043);})[_0x336c('0x25')](function(_0x1ab068){_0x1c7a34[_0x336c('0x47')]=_0x1ab068;return _0x1c7a34;})['then'](respondWithFilteredResult(_0x5476ff,_0x562043))[_0x336c('0x48')](handleError(_0x5476ff,null));};exports[_0x336c('0x49')]=function(_0x290750,_0x5b2f25){var _0x22ad35={'raw':!![],'where':{'id':_0x290750['params']['id']}},_0xabb11e={};_0xabb11e[_0x336c('0x31')]=_[_0x336c('0x34')](db[_0x336c('0x43')][_0x336c('0x2d')]);_0xabb11e['query']=_[_0x336c('0x34')](_0x290750[_0x336c('0x33')]);_0xabb11e['filters']=_[_0x336c('0x36')](_0xabb11e[_0x336c('0x31')],_0xabb11e['query']);_0x22ad35[_0x336c('0x38')]=_[_0x336c('0x36')](_0xabb11e[_0x336c('0x31')],qs[_0x336c('0x37')](_0x290750['query'][_0x336c('0x37')]));_0x22ad35[_0x336c('0x38')]=_0x22ad35[_0x336c('0x38')][_0x336c('0x39')]?_0x22ad35[_0x336c('0x38')]:_0xabb11e[_0x336c('0x31')];if(_0x290750[_0x336c('0x33')][_0x336c('0x44')]){_0x22ad35[_0x336c('0x45')]=[{'all':!![]}];}_0x22ad35=_['merge']({},_0x22ad35,_0x290750[_0x336c('0x42')]);return db[_0x336c('0x43')][_0x336c('0x4a')](_0x22ad35)[_0x336c('0x25')](handleEntityNotFound(_0x5b2f25,null))[_0x336c('0x25')](respondWithResult(_0x5b2f25,null))[_0x336c('0x48')](handleError(_0x5b2f25,null));};exports[_0x336c('0x4b')]=function(_0xbfac47,_0x3bdbb8){return db[_0x336c('0x43')][_0x336c('0x4b')](_0xbfac47[_0x336c('0x4c')],{})[_0x336c('0x25')](respondWithResult(_0x3bdbb8,0xc9))['catch'](handleError(_0x3bdbb8,null));};exports[_0x336c('0x4d')]=function(_0x57f151,_0x4f4e12){if(_0x57f151[_0x336c('0x4c')]['id']){delete _0x57f151['body']['id'];}return db['JscriptyAnswerReport'][_0x336c('0x4a')]({'where':{'id':_0x57f151['params']['id']}})[_0x336c('0x25')](handleEntityNotFound(_0x4f4e12,null))[_0x336c('0x25')](saveUpdates(_0x57f151[_0x336c('0x4c')],null))[_0x336c('0x25')](respondWithResult(_0x4f4e12,null))['catch'](handleError(_0x4f4e12,null));};exports['destroy']=function(_0x33f091,_0x17bfc9){return db['JscriptyAnswerReport'][_0x336c('0x4a')]({'where':{'id':_0x33f091[_0x336c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17bfc9,null))[_0x336c('0x25')](removeEntity(_0x17bfc9,null))[_0x336c('0x48')](handleError(_0x17bfc9,null));};exports[_0x336c('0x4f')]=function(_0x2a0bf2,_0x4e0a2f){return db[_0x336c('0x43')][_0x336c('0x4f')]()['then'](respondWithResult(_0x4e0a2f,null))['catch'](handleError(_0x4e0a2f,null));}; \ No newline at end of file +var _0x8d0a=['undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x8d0a,0x172));var _0xa8d0=function(_0x3f54e1,_0x2aac41){_0x3f54e1=_0x3f54e1-0x0;var _0x5a0d29=_0x8d0a[_0x3f54e1];return _0x5a0d29;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d0('0x5'));var util=require(_0xa8d0('0x6'));var path=require(_0xa8d0('0x7'));var sox=require('sox');var csv=require(_0xa8d0('0x8'));var ejs=require(_0xa8d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xa'));var _=require(_0xa8d0('0xb'));var squel=require(_0xa8d0('0xc'));var crypto=require(_0xa8d0('0xd'));var jsforce=require(_0xa8d0('0xe'));var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0x8'));var querystring=require(_0xa8d0('0x10'));var Papa=require(_0xa8d0('0x11'));var Redis=require(_0xa8d0('0x12'));var authService=require(_0xa8d0('0x13'));var qs=require(_0xa8d0('0x14'));var as=require(_0xa8d0('0x15'));var hardwareService=require(_0xa8d0('0x16'));var logger=require(_0xa8d0('0x17'))(_0xa8d0('0x18'));var utils=require(_0xa8d0('0x19'));var config=require(_0xa8d0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318fb1,_0x23b588){_0x23b588=_0x23b588||0xcc;return function(_0x572d64){if(_0x572d64){return _0x318fb1['sendStatus'](_0x23b588);}return _0x318fb1[_0xa8d0('0x1b')](_0x23b588)[_0xa8d0('0x1c')]();};}function respondWithResult(_0x3ecc36,_0xbdc234){_0xbdc234=_0xbdc234||0xc8;return function(_0x2ebddf){if(_0x2ebddf){return _0x3ecc36[_0xa8d0('0x1b')](_0xbdc234)[_0xa8d0('0x1d')](_0x2ebddf);}};}function respondWithFilteredResult(_0x1daf70,_0x2871cb){return function(_0x238e85){if(_0x238e85){var _0xfa19ee=typeof _0x2871cb['offset']===_0xa8d0('0x1e')&&typeof _0x2871cb[_0xa8d0('0x1f')]==='undefined';var _0x3e1dc6=_0x238e85[_0xa8d0('0x20')];var _0x2899fb=_0xfa19ee?0x0:_0x2871cb[_0xa8d0('0x21')];var _0x34ce5d=_0xfa19ee?_0x238e85['count']:_0x2871cb[_0xa8d0('0x21')]+_0x2871cb[_0xa8d0('0x1f')];var _0x213de2;if(_0x34ce5d>=_0x3e1dc6){_0x34ce5d=_0x3e1dc6;_0x213de2=0xc8;}else{_0x213de2=0xce;}_0x1daf70[_0xa8d0('0x1b')](_0x213de2);return _0x1daf70[_0xa8d0('0x22')](_0xa8d0('0x23'),_0x2899fb+'-'+_0x34ce5d+'/'+_0x3e1dc6)[_0xa8d0('0x1d')](_0x238e85);}return null;};}function patchUpdates(_0x595452){return function(_0x1a3345){try{jsonpatch[_0xa8d0('0x24')](_0x1a3345,_0x595452,!![]);}catch(_0x3c8843){return BPromise[_0xa8d0('0x25')](_0x3c8843);}return _0x1a3345['save']();};}function saveUpdates(_0x31cf4f,_0x31216e){return function(_0x3212a3){if(_0x3212a3){return _0x3212a3[_0xa8d0('0x26')](_0x31cf4f)['then'](function(_0x150080){return _0x150080;});}return null;};}function removeEntity(_0x30a566,_0x20ae2c){return function(_0x1e9c3e){if(_0x1e9c3e){return _0x1e9c3e['destroy']()[_0xa8d0('0x27')](function(){_0x30a566[_0xa8d0('0x1b')](0xcc)[_0xa8d0('0x1c')]();});}};}function handleEntityNotFound(_0x507d18,_0x34c0bf){return function(_0x5f5dfb){if(!_0x5f5dfb){_0x507d18[_0xa8d0('0x28')](0x194);}return _0x5f5dfb;};}function handleError(_0x291e8e,_0x548076){_0x548076=_0x548076||0x1f4;return function(_0x5d7292){logger[_0xa8d0('0x29')](_0x5d7292['stack']);if(_0x5d7292[_0xa8d0('0x2a')]){delete _0x5d7292[_0xa8d0('0x2a')];}_0x291e8e[_0xa8d0('0x1b')](_0x548076)[_0xa8d0('0x2b')](_0x5d7292);};}exports[_0xa8d0('0x2c')]=function(_0x5a5079,_0x221c6e){var _0x356892={},_0x13de71={},_0x500cec={'count':0x0,'rows':[]};var _0x48c682=_['map'](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')],function(_0x2a8e98){return{'name':_0x2a8e98[_0xa8d0('0x2f')],'type':_0x2a8e98[_0xa8d0('0x30')][_0xa8d0('0x31')]};});_0x13de71[_0xa8d0('0x32')]=_['map'](_0x48c682,_0xa8d0('0x2a'));_0x13de71['query']=_[_0xa8d0('0x33')](_0x5a5079['query']);_0x13de71['filters']=_['intersection'](_0x13de71['model'],_0x13de71[_0xa8d0('0x34')]);_0x356892[_0xa8d0('0x35')]=_['intersection'](_0x13de71['model'],qs[_0xa8d0('0x36')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x36')]));_0x356892[_0xa8d0('0x35')]=_0x356892[_0xa8d0('0x35')]['length']?_0x356892['attributes']:_0x13de71[_0xa8d0('0x32')];if(!_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x37')](_0xa8d0('0x38'))){_0x356892[_0xa8d0('0x1f')]=qs[_0xa8d0('0x1f')](_0x5a5079['query'][_0xa8d0('0x1f')]);_0x356892[_0xa8d0('0x21')]=qs[_0xa8d0('0x21')](_0x5a5079['query'][_0xa8d0('0x21')]);}_0x356892[_0xa8d0('0x39')]=qs[_0xa8d0('0x3a')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x3a')]);_0x356892[_0xa8d0('0x3b')]=qs[_0xa8d0('0x3c')](_[_0xa8d0('0x3d')](_0x5a5079[_0xa8d0('0x34')],_0x13de71[_0xa8d0('0x3c')]),_0x48c682);if(_0x5a5079[_0xa8d0('0x34')]['filter']){_0x356892[_0xa8d0('0x3b')]=_['merge'](_0x356892[_0xa8d0('0x3b')],{'$or':_[_0xa8d0('0x3e')](_0x48c682,function(_0xd181d1){if(_0xd181d1['type']!==_0xa8d0('0x3f')){var _0x172b6a={};_0x172b6a[_0xd181d1[_0xa8d0('0x2a')]]={'$like':'%'+_0x5a5079['query'][_0xa8d0('0x40')]+'%'};return _0x172b6a;}})});}_0x356892=_[_0xa8d0('0x41')]({},_0x356892,_0x5a5079[_0xa8d0('0x42')]);var _0x3c3080={'where':_0x356892[_0xa8d0('0x3b')]};return db[_0xa8d0('0x2d')][_0xa8d0('0x20')](_0x3c3080)[_0xa8d0('0x27')](function(_0x2e2778){_0x500cec['count']=_0x2e2778;if(_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x43')]){_0x356892[_0xa8d0('0x44')]=[{'all':!![]}];}return db[_0xa8d0('0x2d')][_0xa8d0('0x45')](_0x356892);})[_0xa8d0('0x27')](function(_0x3438b7){_0x500cec[_0xa8d0('0x46')]=_0x3438b7;return _0x500cec;})[_0xa8d0('0x27')](respondWithFilteredResult(_0x221c6e,_0x356892))['catch'](handleError(_0x221c6e,null));};exports[_0xa8d0('0x47')]=function(_0x588e17,_0x21c0e2){var _0x8bbb72={'raw':!![],'where':{'id':_0x588e17[_0xa8d0('0x48')]['id']}},_0x58ec61={};_0x58ec61['model']=_[_0xa8d0('0x33')](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')]);_0x58ec61['query']=_['keys'](_0x588e17[_0xa8d0('0x34')]);_0x58ec61[_0xa8d0('0x3c')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],_0x58ec61[_0xa8d0('0x34')]);_0x8bbb72[_0xa8d0('0x35')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],qs['fields'](_0x588e17[_0xa8d0('0x34')]['fields']));_0x8bbb72[_0xa8d0('0x35')]=_0x8bbb72['attributes'][_0xa8d0('0x4a')]?_0x8bbb72[_0xa8d0('0x35')]:_0x58ec61[_0xa8d0('0x32')];if(_0x588e17['query'][_0xa8d0('0x43')]){_0x8bbb72[_0xa8d0('0x44')]=[{'all':!![]}];}_0x8bbb72=_[_0xa8d0('0x41')]({},_0x8bbb72,_0x588e17[_0xa8d0('0x42')]);return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')](_0x8bbb72)[_0xa8d0('0x27')](handleEntityNotFound(_0x21c0e2,null))[_0xa8d0('0x27')](respondWithResult(_0x21c0e2,null))[_0xa8d0('0x4c')](handleError(_0x21c0e2,null));};exports[_0xa8d0('0x4d')]=function(_0x39f402,_0x3187){return db[_0xa8d0('0x2d')][_0xa8d0('0x4d')](_0x39f402[_0xa8d0('0x4e')],{})['then'](respondWithResult(_0x3187,0xc9))['catch'](handleError(_0x3187,null));};exports[_0xa8d0('0x26')]=function(_0x15f801,_0x3ddebe){if(_0x15f801[_0xa8d0('0x4e')]['id']){delete _0x15f801[_0xa8d0('0x4e')]['id'];}return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')]({'where':{'id':_0x15f801[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x3ddebe,null))[_0xa8d0('0x27')](saveUpdates(_0x15f801[_0xa8d0('0x4e')],null))[_0xa8d0('0x27')](respondWithResult(_0x3ddebe,null))[_0xa8d0('0x4c')](handleError(_0x3ddebe,null));};exports['destroy']=function(_0x2afc73,_0x31e586){return db[_0xa8d0('0x2d')]['find']({'where':{'id':_0x2afc73[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x31e586,null))[_0xa8d0('0x27')](removeEntity(_0x31e586,null))[_0xa8d0('0x4c')](handleError(_0x31e586,null));};exports[_0xa8d0('0x4f')]=function(_0x5680c1,_0x54f9e6){return db[_0xa8d0('0x2d')][_0xa8d0('0x4f')]()[_0xa8d0('0x27')](respondWithResult(_0x54f9e6,null))[_0xa8d0('0x4c')](handleError(_0x54f9e6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 6edd248..d745b47 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 _0x1690=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x1690,0x67));var _0x0169=function(_0x517e18,_0xf19ce){_0x517e18=_0x517e18-0x0;var _0x3557ef=_0x1690[_0x517e18];return _0x3557ef;};'use strict';var _=require(_0x0169('0x0'));var util=require(_0x0169('0x1'));var logger=require(_0x0169('0x2'))(_0x0169('0x3'));var moment=require('moment');var BPromise=require(_0x0169('0x4'));var rp=require(_0x0169('0x5'));var fs=require('fs');var path=require(_0x0169('0x6'));var rimraf=require(_0x0169('0x7'));var config=require(_0x0169('0x8'));var attributes=require(_0x0169('0x9'));module['exports']=function(_0x345e70,_0x1d1b58){return _0x345e70[_0x0169('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1421=['JscriptyAnswerReport','lodash','util','api','moment','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x1011e5,_0x5c1c8d){var _0x1a5dc8=function(_0xc3c90d){while(--_0xc3c90d){_0x1011e5['push'](_0x1011e5['shift']());}};_0x1a5dc8(++_0x5c1c8d);}(_0x1421,0x11f));var _0x1142=function(_0x1f5f25,_0x47b87f){_0x1f5f25=_0x1f5f25-0x0;var _0x509829=_0x1421[_0x1f5f25];return _0x509829;};'use strict';var _=require(_0x1142('0x0'));var util=require(_0x1142('0x1'));var logger=require('../../config/logger')(_0x1142('0x2'));var moment=require(_0x1142('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1142('0x4'));var rimraf=require(_0x1142('0x5'));var config=require(_0x1142('0x6'));var attributes=require(_0x1142('0x7'));module[_0x1142('0x8')]=function(_0xc96155,_0xe045cf){return _0xc96155[_0x1142('0x9')](_0x1142('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index a48b3b2..c1247bd 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 _0x515b=['jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x475ea8,_0x487887){var _0x490ac0=function(_0x181389){while(--_0x181389){_0x475ea8['push'](_0x475ea8['shift']());}};_0x490ac0(++_0x487887);}(_0x515b,0x1f2));var _0xb515=function(_0x533a98,_0xabd78d){_0x533a98=_0x533a98-0x0;var _0x28c6a8=_0x515b[_0x533a98];return _0x28c6a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb515('0x0'));var rs=require(_0xb515('0x1'));var fs=require('fs');var Redis=require(_0xb515('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb515('0x3'))(_0xb515('0x4'));var config=require(_0xb515('0x5'));var jayson=require(_0xb515('0x6'));var client=jayson[_0xb515('0x7')][_0xb515('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1db5de,_0x2e7ca0,_0x6e3492){return new BPromise(function(_0x508a99,_0x4c6eb7){return client[_0xb515('0x9')](_0x1db5de,_0x6e3492)['then'](function(_0xdd8c21){logger[_0xb515('0xa')](_0xb515('0xb'),_0x2e7ca0,_0xb515('0xc'));logger[_0xb515('0xd')](_0xb515('0xe'),_0x2e7ca0,'request\x20sent',JSON[_0xb515('0xf')](_0xdd8c21));if(_0xdd8c21[_0xb515('0x10')]){if(_0xdd8c21[_0xb515('0x10')][_0xb515('0x11')]===0x1f4){logger[_0xb515('0x10')](_0xb515('0xb'),_0x2e7ca0,_0xdd8c21['error'][_0xb515('0x12')]);return _0x4c6eb7(_0xdd8c21[_0xb515('0x10')][_0xb515('0x12')]);}logger[_0xb515('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e7ca0,_0xdd8c21[_0xb515('0x10')][_0xb515('0x12')]);return _0x508a99(_0xdd8c21[_0xb515('0x10')]['message']);}else{logger['info'](_0xb515('0xb'),_0x2e7ca0,_0xb515('0xc'));_0x508a99(_0xdd8c21[_0xb515('0x13')][_0xb515('0x12')]);}})[_0xb515('0x14')](function(_0x2247c9){logger['error'](_0xb515('0xb'),_0x2e7ca0,_0x2247c9);_0x4c6eb7(_0x2247c9);});});} \ No newline at end of file +var _0x0b00=['lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch'];(function(_0x397567,_0x5049b1){var _0x575a64=function(_0x3cdc36){while(--_0x3cdc36){_0x397567['push'](_0x397567['shift']());}};_0x575a64(++_0x5049b1);}(_0x0b00,0x1a4));var _0x00b0=function(_0x440009,_0x3337de){_0x440009=_0x440009-0x0;var _0x58b870=_0x0b00[_0x440009];return _0x58b870;};'use strict';var _=require(_0x00b0('0x0'));var util=require(_0x00b0('0x1'));var moment=require(_0x00b0('0x2'));var BPromise=require(_0x00b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x00b0('0x5'))(_0x00b0('0x6'));var config=require('../../config/environment');var jayson=require(_0x00b0('0x7'));var client=jayson[_0x00b0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0000,_0xefa873,_0x52b9d5){return new BPromise(function(_0x381357,_0x43f503){return client['request'](_0x3a0000,_0x52b9d5)[_0x00b0('0x9')](function(_0xacf404){logger[_0x00b0('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xefa873,_0x00b0('0xb'));logger[_0x00b0('0xc')](_0x00b0('0xd'),_0xefa873,_0x00b0('0xb'),JSON['stringify'](_0xacf404));if(_0xacf404[_0x00b0('0xe')]){if(_0xacf404[_0x00b0('0xe')][_0x00b0('0xf')]===0x1f4){logger[_0x00b0('0xe')](_0x00b0('0x10'),_0xefa873,_0xacf404[_0x00b0('0xe')][_0x00b0('0x11')]);return _0x43f503(_0xacf404[_0x00b0('0xe')][_0x00b0('0x11')]);}logger[_0x00b0('0xe')](_0x00b0('0x10'),_0xefa873,_0xacf404[_0x00b0('0xe')][_0x00b0('0x11')]);return _0x381357(_0xacf404[_0x00b0('0xe')][_0x00b0('0x11')]);}else{logger[_0x00b0('0xa')](_0x00b0('0x10'),_0xefa873,_0x00b0('0xb'));_0x381357(_0xacf404[_0x00b0('0x12')][_0x00b0('0x11')]);}})[_0x00b0('0x13')](function(_0x463320){logger['error'](_0x00b0('0x10'),_0xefa873,_0x463320);_0x43f503(_0x463320);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 481f820..f4832b3 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 _0x1c6a=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','post','create','/:id/clone','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x296ba4,_0x1f83ae){var _0x1699f9=function(_0x4ebdb9){while(--_0x4ebdb9){_0x296ba4['push'](_0x296ba4['shift']());}};_0x1699f9(++_0x1f83ae);}(_0x1c6a,0xa8));var _0xa1c6=function(_0xe6f4ef,_0x4e34cc){_0xe6f4ef=_0xe6f4ef-0x0;var _0x4f3447=_0x1c6a[_0xe6f4ef];return _0x4f3447;};'use strict';var multer=require(_0xa1c6('0x0'));var util=require(_0xa1c6('0x1'));var path=require(_0xa1c6('0x2'));var timeout=require(_0xa1c6('0x3'));var express=require(_0xa1c6('0x4'));var router=express[_0xa1c6('0x5')]();var fs_extra=require(_0xa1c6('0x6'));var auth=require(_0xa1c6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c6('0x8'));var controller=require('./jscriptyProject.controller');router[_0xa1c6('0x9')]('/',auth[_0xa1c6('0xa')](),controller[_0xa1c6('0xb')]);router['get'](_0xa1c6('0xc'),auth[_0xa1c6('0xa')](),controller['show']);router[_0xa1c6('0x9')](_0xa1c6('0xd'),auth[_0xa1c6('0xa')](),controller[_0xa1c6('0xe')]);router[_0xa1c6('0x9')](_0xa1c6('0xf'),auth[_0xa1c6('0xa')](),controller[_0xa1c6('0x10')]);router[_0xa1c6('0x9')]('/:id/summary',auth[_0xa1c6('0xa')](),timeout(_0xa1c6('0x11')),controller['getSummary']);router[_0xa1c6('0x12')]('/',auth[_0xa1c6('0xa')](),controller[_0xa1c6('0x13')]);router[_0xa1c6('0x12')](_0xa1c6('0x14'),auth[_0xa1c6('0xa')](),controller['clone']);router[_0xa1c6('0x15')](_0xa1c6('0xc'),auth[_0xa1c6('0xa')](),controller[_0xa1c6('0x16')]);router['delete'](_0xa1c6('0xc'),auth[_0xa1c6('0xa')](),controller[_0xa1c6('0x17')]);module[_0xa1c6('0x18')]=router; \ No newline at end of file +var _0x48a1=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','30s','getSummary','post','create','clone','update'];(function(_0x3d6812,_0x5b158a){var _0x387a96=function(_0x5c1cbe){while(--_0x5c1cbe){_0x3d6812['push'](_0x3d6812['shift']());}};_0x387a96(++_0x5b158a);}(_0x48a1,0x92));var _0x148a=function(_0x4f1eec,_0x536335){_0x4f1eec=_0x4f1eec-0x0;var _0x5bc7ae=_0x48a1[_0x4f1eec];return _0x5bc7ae;};'use strict';var multer=require(_0x148a('0x0'));var util=require(_0x148a('0x1'));var path=require(_0x148a('0x2'));var timeout=require(_0x148a('0x3'));var express=require(_0x148a('0x4'));var router=express[_0x148a('0x5')]();var fs_extra=require(_0x148a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x148a('0x7'));router[_0x148a('0x8')]('/',auth[_0x148a('0x9')](),controller[_0x148a('0xa')]);router[_0x148a('0x8')](_0x148a('0xb'),auth[_0x148a('0x9')](),controller[_0x148a('0xc')]);router[_0x148a('0x8')](_0x148a('0xd'),auth[_0x148a('0x9')](),controller[_0x148a('0xe')]);router[_0x148a('0x8')]('/:id/answers',auth['isAuthenticated'](),controller[_0x148a('0xf')]);router[_0x148a('0x8')]('/:id/summary',auth[_0x148a('0x9')](),timeout(_0x148a('0x10')),controller[_0x148a('0x11')]);router[_0x148a('0x12')]('/',auth[_0x148a('0x9')](),controller[_0x148a('0x13')]);router[_0x148a('0x12')]('/:id/clone',auth[_0x148a('0x9')](),controller[_0x148a('0x14')]);router['put'](_0x148a('0xb'),auth['isAuthenticated'](),controller[_0x148a('0x15')]);router[_0x148a('0x16')](_0x148a('0xb'),auth[_0x148a('0x9')](),controller['destroy']);module[_0x148a('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 95cf992..5e89f81 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 _0x981f=['lodash','util','STRING','name','long','isObjectLike','formData','format','getDataValue','description','BOOLEAN','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x981f,0x18b));var _0xf981=function(_0x58f686,_0x3440e2){_0x58f686=_0x58f686-0x0;var _0x3c82b9=_0x981f[_0x58f686];return _0x3c82b9;};'use strict';var Sequelize=require(_0xf981('0x0'));var _=require(_0xf981('0x1'));var util=require(_0xf981('0x2'));module['exports']={'name':{'type':Sequelize[_0xf981('0x3')],'unique':_0xf981('0x4')},'description':{'type':Sequelize[_0xf981('0x3')]},'formData':{'type':Sequelize['TEXT'](_0xf981('0x5')),'set':function(_0x2db0c3){if(_[_0xf981('0x6')](_0x2db0c3)){this['setDataValue'](_0xf981('0x7'),JSON['stringify'](_0x2db0c3));}else if(_['isString'](_0x2db0c3)){this['setDataValue'](_0xf981('0x7'),_0x2db0c3);}else{this['setDataValue']('formData',util[_0xf981('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf981('0x9')](_0xf981('0x4'))||'',this['getDataValue'](_0xf981('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf981('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x3863=['BOOLEAN','sequelize','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x8d06b5,_0x300df8){var _0x3225d4=function(_0x6233ae){while(--_0x6233ae){_0x8d06b5['push'](_0x8d06b5['shift']());}};_0x3225d4(++_0x300df8);}(_0x3863,0x1f0));var _0x3386=function(_0xadc238,_0x56e2d9){_0xadc238=_0xadc238-0x0;var _0x4eb6f4=_0x3863[_0xadc238];return _0x4eb6f4;};'use strict';var Sequelize=require(_0x3386('0x0'));var _=require('lodash');var util=require(_0x3386('0x1'));module[_0x3386('0x2')]={'name':{'type':Sequelize[_0x3386('0x3')],'unique':_0x3386('0x4')},'description':{'type':Sequelize[_0x3386('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x3386('0x5')),'set':function(_0x20e043){if(_[_0x3386('0x6')](_0x20e043)){this[_0x3386('0x7')](_0x3386('0x8'),JSON['stringify'](_0x20e043));}else if(_[_0x3386('0x9')](_0x20e043)){this[_0x3386('0x7')]('formData',_0x20e043);}else{this['setDataValue'](_0x3386('0x8'),util[_0x3386('0xa')](_0x3386('0xb'),this[_0x3386('0xc')](_0x3386('0x4'))||'',this['getDataValue'](_0x3386('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3386('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3386('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 60a8880..255a526 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 _0xcac2=['where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','eml-format','rimraf','zip-dir','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','get','Projects','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort'];(function(_0x2766cc,_0x246297){var _0x3dd08f=function(_0x47448e){while(--_0x47448e){_0x2766cc['push'](_0x2766cc['shift']());}};_0x3dd08f(++_0x246297);}(_0xcac2,0x1e8));var _0x2cac=function(_0x2cd7fb,_0x2d4d50){_0x2cd7fb=_0x2cd7fb-0x0;var _0x3171a3=_0xcac2[_0x2cd7fb];return _0x3171a3;};'use strict';var emlformat=require(_0x2cac('0x0'));var rimraf=require(_0x2cac('0x1'));var zipdir=require(_0x2cac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cac('0x3'));var moment=require(_0x2cac('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2cac('0x5'));var csv=require(_0x2cac('0x6'));var ejs=require(_0x2cac('0x7'));var fs=require('fs');var fs_extra=require(_0x2cac('0x8'));var _=require(_0x2cac('0x9'));var squel=require(_0x2cac('0xa'));var crypto=require(_0x2cac('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2cac('0x6'));var querystring=require('querystring');var Papa=require(_0x2cac('0xc'));var Redis=require(_0x2cac('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2cac('0xe'));var hardwareService=require(_0x2cac('0xf'));var logger=require('../../config/logger')(_0x2cac('0x10'));var utils=require('../../config/utils');var config=require(_0x2cac('0x11'));var licenseUtil=require(_0x2cac('0x12'));var db=require(_0x2cac('0x13'))['db'];function respondWithStatusCode(_0x1ccf7b,_0x2b5975){_0x2b5975=_0x2b5975||0xcc;return function(_0x58aad7){if(_0x58aad7){return _0x1ccf7b[_0x2cac('0x14')](_0x2b5975);}return _0x1ccf7b[_0x2cac('0x15')](_0x2b5975)['end']();};}function respondWithResult(_0x440617,_0x302d91){_0x302d91=_0x302d91||0xc8;return function(_0x3c1b1f){if(_0x3c1b1f){return _0x440617['status'](_0x302d91)[_0x2cac('0x16')](_0x3c1b1f);}};}function respondWithFilteredResult(_0x354ab7,_0x3d846b){return function(_0x5e731b){if(_0x5e731b){var _0x46db00=typeof _0x3d846b[_0x2cac('0x17')]===_0x2cac('0x18')&&typeof _0x3d846b['limit']==='undefined';var _0x474b7=_0x5e731b[_0x2cac('0x19')];var _0x1dac01=_0x46db00?0x0:_0x3d846b[_0x2cac('0x17')];var _0x2109af=_0x46db00?_0x5e731b['count']:_0x3d846b[_0x2cac('0x17')]+_0x3d846b[_0x2cac('0x1a')];var _0x397e70;if(_0x2109af>=_0x474b7){_0x2109af=_0x474b7;_0x397e70=0xc8;}else{_0x397e70=0xce;}_0x354ab7[_0x2cac('0x15')](_0x397e70);return _0x354ab7[_0x2cac('0x1b')](_0x2cac('0x1c'),_0x1dac01+'-'+_0x2109af+'/'+_0x474b7)[_0x2cac('0x16')](_0x5e731b);}return null;};}function patchUpdates(_0xd04add){return function(_0x5871af){try{jsonpatch[_0x2cac('0x1d')](_0x5871af,_0xd04add,!![]);}catch(_0x2c082e){return BPromise['reject'](_0x2c082e);}return _0x5871af['save']();};}function saveUpdates(_0x35d99b,_0x53f335){return function(_0xbdb16b){if(_0xbdb16b){return _0xbdb16b[_0x2cac('0x1e')](_0x35d99b)['then'](function(_0x3823e8){return _0x3823e8;});}return null;};}function removeEntity(_0x565f96,_0x43b372){return function(_0x4267cc){if(_0x4267cc){return _0x4267cc[_0x2cac('0x1f')]()[_0x2cac('0x20')](function(){var _0x547154=_0x4267cc[_0x2cac('0x21')]({'plain':!![]});var _0x1de22c=_0x2cac('0x22');return db[_0x2cac('0x23')][_0x2cac('0x1f')]({'where':{'type':_0x1de22c,'resourceId':_0x547154['id']}})[_0x2cac('0x20')](function(){return _0x4267cc;});})['then'](function(){_0x565f96[_0x2cac('0x15')](0xcc)[_0x2cac('0x24')]();});}};}function handleEntityNotFound(_0x523e2b,_0x1f189a){return function(_0x4b6ad1){if(!_0x4b6ad1){_0x523e2b[_0x2cac('0x14')](0x194);}return _0x4b6ad1;};}function handleError(_0x387e56,_0x5d70a7){_0x5d70a7=_0x5d70a7||0x1f4;return function(_0x4898b3){logger[_0x2cac('0x25')](_0x4898b3[_0x2cac('0x26')]);if(_0x4898b3[_0x2cac('0x27')]){delete _0x4898b3['name'];}_0x387e56[_0x2cac('0x15')](_0x5d70a7)[_0x2cac('0x28')](_0x4898b3);};}exports[_0x2cac('0x29')]=function(_0x52c9b0,_0x3584d6){var _0x1460da={},_0x3780c0={},_0x2bed7d={'count':0x0,'rows':[]};var _0x1b4844=_[_0x2cac('0x2a')](db[_0x2cac('0x2b')]['rawAttributes'],function(_0x256eb3){return{'name':_0x256eb3[_0x2cac('0x2c')],'type':_0x256eb3[_0x2cac('0x2d')]['key']};});_0x3780c0[_0x2cac('0x2e')]=_[_0x2cac('0x2a')](_0x1b4844,_0x2cac('0x27'));_0x3780c0[_0x2cac('0x2f')]=_[_0x2cac('0x30')](_0x52c9b0[_0x2cac('0x2f')]);_0x3780c0[_0x2cac('0x31')]=_[_0x2cac('0x32')](_0x3780c0[_0x2cac('0x2e')],_0x3780c0['query']);_0x1460da['attributes']=_['intersection'](_0x3780c0[_0x2cac('0x2e')],qs[_0x2cac('0x33')](_0x52c9b0['query']['fields']));_0x1460da['attributes']=_0x1460da['attributes']['length']?_0x1460da[_0x2cac('0x34')]:_0x3780c0['model'];if(!_0x52c9b0[_0x2cac('0x2f')][_0x2cac('0x35')](_0x2cac('0x36'))){_0x1460da[_0x2cac('0x1a')]=qs[_0x2cac('0x1a')](_0x52c9b0[_0x2cac('0x2f')][_0x2cac('0x1a')]);_0x1460da[_0x2cac('0x17')]=qs[_0x2cac('0x17')](_0x52c9b0[_0x2cac('0x2f')]['offset']);}_0x1460da[_0x2cac('0x37')]=qs[_0x2cac('0x38')](_0x52c9b0['query']['sort']);_0x1460da[_0x2cac('0x39')]=qs[_0x2cac('0x31')](_[_0x2cac('0x3a')](_0x52c9b0[_0x2cac('0x2f')],_0x3780c0[_0x2cac('0x31')]),_0x1b4844);if(_0x52c9b0[_0x2cac('0x2f')][_0x2cac('0x3b')]){_0x1460da[_0x2cac('0x39')]=_[_0x2cac('0x3c')](_0x1460da[_0x2cac('0x39')],{'$or':_['map'](_0x1b4844,function(_0x565744){if(_0x565744[_0x2cac('0x2d')]!==_0x2cac('0x3d')){var _0x341561={};_0x341561[_0x565744[_0x2cac('0x27')]]={'$like':'%'+_0x52c9b0[_0x2cac('0x2f')][_0x2cac('0x3b')]+'%'};return _0x341561;}})});}_0x1460da=_[_0x2cac('0x3c')]({},_0x1460da,_0x52c9b0[_0x2cac('0x3e')]);var _0x86f0f1={'where':_0x1460da[_0x2cac('0x39')]};return db['JscriptyProject'][_0x2cac('0x19')](_0x86f0f1)[_0x2cac('0x20')](function(_0x25c9f9){_0x2bed7d[_0x2cac('0x19')]=_0x25c9f9;if(_0x52c9b0[_0x2cac('0x2f')]['includeAll']){_0x1460da[_0x2cac('0x3f')]=[{'all':!![]}];}return db[_0x2cac('0x2b')]['findAll'](_0x1460da);})[_0x2cac('0x20')](function(_0x23cdec){_0x2bed7d[_0x2cac('0x40')]=_0x23cdec;return _0x2bed7d;})[_0x2cac('0x20')](respondWithFilteredResult(_0x3584d6,_0x1460da))[_0x2cac('0x41')](handleError(_0x3584d6,null));};exports[_0x2cac('0x42')]=function(_0x49fa72,_0x40d301){var _0x30b462={'raw':![],'where':{'id':_0x49fa72[_0x2cac('0x43')]['id']}},_0x509dfa={};_0x509dfa[_0x2cac('0x2e')]=_[_0x2cac('0x30')](db['JscriptyProject'][_0x2cac('0x44')]);_0x509dfa['query']=_['keys'](_0x49fa72['query']);_0x509dfa[_0x2cac('0x31')]=_[_0x2cac('0x32')](_0x509dfa['model'],_0x509dfa['query']);_0x30b462[_0x2cac('0x34')]=_[_0x2cac('0x32')](_0x509dfa[_0x2cac('0x2e')],qs[_0x2cac('0x33')](_0x49fa72[_0x2cac('0x2f')]['fields']));_0x30b462[_0x2cac('0x34')]=_0x30b462[_0x2cac('0x34')][_0x2cac('0x45')]?_0x30b462[_0x2cac('0x34')]:_0x509dfa['model'];if(_0x49fa72[_0x2cac('0x2f')][_0x2cac('0x46')]){_0x30b462[_0x2cac('0x3f')]=[{'all':!![]}];}_0x30b462=_[_0x2cac('0x3c')]({},_0x30b462,_0x49fa72[_0x2cac('0x3e')]);return db['JscriptyProject'][_0x2cac('0x47')](_0x30b462)['then'](handleEntityNotFound(_0x40d301,null))[_0x2cac('0x20')](respondWithResult(_0x40d301,null))[_0x2cac('0x41')](handleError(_0x40d301,null));};exports[_0x2cac('0x48')]=function(_0x108483,_0xd7ad89){return db[_0x2cac('0x2b')][_0x2cac('0x48')](_0x108483[_0x2cac('0x49')],{})[_0x2cac('0x20')](function(_0x39ec1c){var _0x2c7d9c=_0x108483[_0x2cac('0x4a')][_0x2cac('0x21')]({'plain':!![]});if(!_0x2c7d9c)throw new Error(_0x2cac('0x4b'));if(_0x2c7d9c[_0x2cac('0x4c')]===_0x2cac('0x4a')){var _0x28f724=_0x39ec1c[_0x2cac('0x21')]({'plain':!![]});var _0x2ec917='Projects';return db[_0x2cac('0x4d')][_0x2cac('0x47')]({'where':{'name':_0x2ec917,'userProfileId':_0x2c7d9c[_0x2cac('0x4e')]},'raw':!![]})['then'](function(_0x56f5a2){if(_0x56f5a2&&_0x56f5a2[_0x2cac('0x4f')]===0x0){return db[_0x2cac('0x23')][_0x2cac('0x48')]({'name':_0x28f724[_0x2cac('0x27')],'resourceId':_0x28f724['id'],'type':_0x56f5a2[_0x2cac('0x27')],'sectionId':_0x56f5a2['id']},{})[_0x2cac('0x20')](function(){return _0x39ec1c;});}else{return _0x39ec1c;}})['catch'](function(_0x5aee6d){logger['error'](_0x2cac('0x50'),_0x5aee6d);throw _0x5aee6d;});}return _0x39ec1c;})['then'](respondWithResult(_0xd7ad89,0xc9))[_0x2cac('0x41')](handleError(_0xd7ad89,null));};exports[_0x2cac('0x51')]=function(_0xba373f,_0xf5b24d){var _0x146232={'where':{'id':_0xba373f[_0x2cac('0x43')]['id']}},_0x494177={};_0x494177['model']=_['keys'](db['JscriptyProject'][_0x2cac('0x44')]);_0x146232[_0x2cac('0x34')]=_[_0x2cac('0x32')](_0x494177[_0x2cac('0x2e')],qs['fields'](_0xba373f['query']['fields']));_0x146232[_0x2cac('0x34')]=_0x146232['attributes'][_0x2cac('0x45')]?_0x146232[_0x2cac('0x34')]:_0x494177[_0x2cac('0x2e')];if(_0xba373f[_0x2cac('0x2f')][_0x2cac('0x46')]){_0x146232[_0x2cac('0x3f')]=[{'all':!![]}];}_0x146232=_[_0x2cac('0x3c')]({},_0x146232,_0xba373f['options']);return db['JscriptyProject'][_0x2cac('0x47')](_0x146232)[_0x2cac('0x20')](handleEntityNotFound(_0xf5b24d,null))[_0x2cac('0x20')](function(_0x5c1834){if(_0x5c1834){var _0x3ded7e=_0x5c1834[_0x2cac('0x21')]({'plain':!![]});_0x3ded7e=qs[_0x2cac('0x52')](_0x3ded7e,['id',_0x2cac('0x53'),'updatedAt']);_0xba373f[_0x2cac('0x49')]=_[_0x2cac('0x52')](_0xba373f['body'],['id','createdAt',_0x2cac('0x54')]);return db['JscriptyProject']['create'](_[_0x2cac('0x3c')](_0x3ded7e,_0xba373f[_0x2cac('0x49')]),{'include':_0xba373f[_0x2cac('0x2f')][_0x2cac('0x46')]?[{'all':!![]}]:undefined})[_0x2cac('0x20')](function(_0x35758a){var _0x115ee7=_0xba373f[_0x2cac('0x4a')][_0x2cac('0x21')]({'plain':!![]});if(!_0x115ee7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x115ee7[_0x2cac('0x4c')]===_0x2cac('0x4a')){var _0x2042f4=_0x35758a[_0x2cac('0x21')]({'plain':!![]});var _0x20e932='Projects';return db['UserProfileSection'][_0x2cac('0x47')]({'where':{'name':_0x20e932,'userProfileId':_0x115ee7[_0x2cac('0x4e')]},'raw':!![]})['then'](function(_0x1456ea){if(_0x1456ea&&_0x1456ea[_0x2cac('0x4f')]===0x0){return db['UserProfileResource'][_0x2cac('0x48')]({'name':_0x2042f4[_0x2cac('0x27')],'resourceId':_0x2042f4['id'],'type':_0x1456ea['name'],'sectionId':_0x1456ea['id']},{})[_0x2cac('0x20')](function(){return _0x35758a;});}else{return _0x35758a;}})[_0x2cac('0x41')](function(_0xc619e6){logger[_0x2cac('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc619e6);throw _0xc619e6;});}return _0x35758a;});}})[_0x2cac('0x20')](respondWithResult(_0xf5b24d,0xc9))['catch'](handleError(_0xf5b24d,null));};exports[_0x2cac('0x1e')]=function(_0x354d7b,_0x316bf2){if(_0x354d7b['body']['id']){delete _0x354d7b[_0x2cac('0x49')]['id'];}return db[_0x2cac('0x2b')][_0x2cac('0x47')]({'where':{'id':_0x354d7b[_0x2cac('0x43')]['id']}})[_0x2cac('0x20')](handleEntityNotFound(_0x316bf2,null))[_0x2cac('0x20')](saveUpdates(_0x354d7b[_0x2cac('0x49')],null))[_0x2cac('0x20')](respondWithResult(_0x316bf2,null))['catch'](handleError(_0x316bf2,null));};exports['destroy']=function(_0x255899,_0x37421f){return db['JscriptyProject']['find']({'where':{'id':_0x255899['params']['id']}})[_0x2cac('0x20')](handleEntityNotFound(_0x37421f,null))[_0x2cac('0x20')](removeEntity(_0x37421f,null))[_0x2cac('0x41')](handleError(_0x37421f,null));};exports[_0x2cac('0x55')]=function(_0x4301a8,_0x2896a7,_0x5adff8){var _0x1e334f={'raw':!![],'where':{}};var _0x354b4d={};var _0x64058b={'count':0x0,'rows':[]};return db[_0x2cac('0x2b')]['findOne']({'where':{'id':_0x4301a8[_0x2cac('0x43')]['id']}})[_0x2cac('0x20')](handleEntityNotFound(_0x2896a7,null))[_0x2cac('0x20')](function(_0x1cfc94){if(_0x1cfc94){_0x354b4d[_0x2cac('0x2e')]=_[_0x2cac('0x30')](db['JscriptySessionReport'][_0x2cac('0x44')]);_0x354b4d['query']=_[_0x2cac('0x30')](_0x4301a8[_0x2cac('0x2f')]);_0x354b4d[_0x2cac('0x31')]=_['intersection'](_0x354b4d[_0x2cac('0x2e')],_0x354b4d['query']);_0x1e334f[_0x2cac('0x34')]=_[_0x2cac('0x32')](_0x354b4d[_0x2cac('0x2e')],qs[_0x2cac('0x33')](_0x4301a8[_0x2cac('0x2f')][_0x2cac('0x33')]));_0x1e334f[_0x2cac('0x34')]=_0x1e334f[_0x2cac('0x34')][_0x2cac('0x45')]?_0x1e334f[_0x2cac('0x34')]:_0x354b4d[_0x2cac('0x2e')];if(!_0x4301a8[_0x2cac('0x2f')][_0x2cac('0x35')]('nolimit')){_0x1e334f[_0x2cac('0x1a')]=qs[_0x2cac('0x1a')](_0x4301a8[_0x2cac('0x2f')]['limit']);_0x1e334f[_0x2cac('0x17')]=qs[_0x2cac('0x17')](_0x4301a8[_0x2cac('0x2f')][_0x2cac('0x17')]);}_0x1e334f['order']=qs[_0x2cac('0x38')](_0x4301a8[_0x2cac('0x2f')][_0x2cac('0x38')]);_0x1e334f[_0x2cac('0x39')]=qs[_0x2cac('0x31')](_[_0x2cac('0x3a')](_0x4301a8[_0x2cac('0x2f')],_0x354b4d[_0x2cac('0x31')]));_0x1e334f[_0x2cac('0x39')]['ProjectId']=_0x1cfc94['id'];if(_0x4301a8[_0x2cac('0x2f')]['filter']){_0x1e334f[_0x2cac('0x39')]=_[_0x2cac('0x3c')](_0x1e334f[_0x2cac('0x39')],{'$or':_[_0x2cac('0x2a')](_0x1e334f[_0x2cac('0x34')],function(_0x49730d){var _0x41a3a8={};_0x41a3a8[_0x49730d]={'$like':'%'+_0x4301a8[_0x2cac('0x2f')][_0x2cac('0x3b')]+'%'};return _0x41a3a8;})});}_0x1e334f=_[_0x2cac('0x3c')]({},_0x1e334f,_0x4301a8['options']);return db['JscriptySessionReport'][_0x2cac('0x19')]({'where':_0x1e334f[_0x2cac('0x39')]})['then'](function(_0x3f215f){_0x64058b[_0x2cac('0x19')]=_0x3f215f;if(_0x4301a8[_0x2cac('0x2f')]['includeAll']){_0x1e334f[_0x2cac('0x3f')]=[{'all':!![]}];}return db[_0x2cac('0x56')][_0x2cac('0x57')](_0x1e334f);})[_0x2cac('0x20')](function(_0x15368e){_0x64058b[_0x2cac('0x40')]=_0x15368e;return _0x64058b;});}})['then'](respondWithFilteredResult(_0x2896a7,_0x1e334f))[_0x2cac('0x41')](handleError(_0x2896a7,null));};exports[_0x2cac('0x58')]=function(_0x306fc5,_0x27f62a,_0xa59ec3){var _0x3b0567={'raw':!![],'where':{}};var _0x4a169b={};var _0x33650d={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x306fc5[_0x2cac('0x43')]['id']}})[_0x2cac('0x20')](handleEntityNotFound(_0x27f62a,null))[_0x2cac('0x20')](function(_0x126f68){if(_0x126f68){_0x4a169b['model']=_[_0x2cac('0x30')](db[_0x2cac('0x59')][_0x2cac('0x44')]);_0x4a169b[_0x2cac('0x2f')]=_[_0x2cac('0x30')](_0x306fc5[_0x2cac('0x2f')]);_0x4a169b[_0x2cac('0x31')]=_[_0x2cac('0x32')](_0x4a169b[_0x2cac('0x2e')],_0x4a169b['query']);_0x3b0567[_0x2cac('0x34')]=_['intersection'](_0x4a169b[_0x2cac('0x2e')],qs[_0x2cac('0x33')](_0x306fc5[_0x2cac('0x2f')][_0x2cac('0x33')]));_0x3b0567[_0x2cac('0x34')]=_0x3b0567[_0x2cac('0x34')][_0x2cac('0x45')]?_0x3b0567[_0x2cac('0x34')]:_0x4a169b[_0x2cac('0x2e')];if(!_0x306fc5[_0x2cac('0x2f')]['hasOwnProperty'](_0x2cac('0x36'))){_0x3b0567['limit']=qs[_0x2cac('0x1a')](_0x306fc5[_0x2cac('0x2f')][_0x2cac('0x1a')]);_0x3b0567['offset']=qs['offset'](_0x306fc5[_0x2cac('0x2f')][_0x2cac('0x17')]);}_0x3b0567[_0x2cac('0x37')]=qs[_0x2cac('0x38')](_0x306fc5[_0x2cac('0x2f')]['sort']);_0x3b0567[_0x2cac('0x39')]=qs[_0x2cac('0x31')](_[_0x2cac('0x3a')](_0x306fc5[_0x2cac('0x2f')],_0x4a169b[_0x2cac('0x31')]));_0x3b0567[_0x2cac('0x39')]['ProjectId']=_0x126f68['id'];if(_0x306fc5[_0x2cac('0x2f')][_0x2cac('0x3b')]){_0x3b0567['where']=_['merge'](_0x3b0567['where'],{'$or':_[_0x2cac('0x2a')](_0x3b0567[_0x2cac('0x34')],function(_0x51352e){var _0x363f02={};_0x363f02[_0x51352e]={'$like':'%'+_0x306fc5[_0x2cac('0x2f')]['filter']+'%'};return _0x363f02;})});}_0x3b0567=_[_0x2cac('0x3c')]({},_0x3b0567,_0x306fc5[_0x2cac('0x3e')]);return db[_0x2cac('0x59')][_0x2cac('0x19')]({'where':_0x3b0567['where']})[_0x2cac('0x20')](function(_0x23635b){_0x33650d['count']=_0x23635b;if(_0x306fc5['query'][_0x2cac('0x46')]){_0x3b0567[_0x2cac('0x3f')]=[{'all':!![]}];}return db[_0x2cac('0x59')]['findAll'](_0x3b0567);})[_0x2cac('0x20')](function(_0x22200c){_0x33650d[_0x2cac('0x40')]=_0x22200c;return _0x33650d;});}})[_0x2cac('0x20')](respondWithFilteredResult(_0x27f62a,_0x3b0567))[_0x2cac('0x41')](handleError(_0x27f62a,null));};function char(_0x5cad52){return'number'===typeof _0x5cad52?String[_0x2cac('0x5a')]['apply'](null,arguments):_0x5cad52;}function needsEncapsulation(_0x2e1f3d){return!!_0x2e1f3d&&(_0x2e1f3d[_0x2cac('0x5b')]()[_0x2cac('0x5c')](char(0xd))>=0x0||_0x2e1f3d[_0x2cac('0x5b')]()[_0x2cac('0x5c')](char(0xa))>=0x0||_0x2e1f3d[_0x2cac('0x5b')]()[_0x2cac('0x5c')](char(0x2c))>=0x0||_0x2e1f3d[_0x2cac('0x5b')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x28199a){var _0x1ee7ed=char(0x22),_0x2b56da='\x5c'+char(0x22),_0x4dd4fd=_0x28199a[_0x2cac('0x5b')]()[_0x2cac('0x5d')](new RegExp(_0x1ee7ed,'g'),_0x2b56da);return _0x1ee7ed+_0x4dd4fd+_0x1ee7ed;}exports['getSummary']=function(_0x562bc4,_0x49fab9,_0x46f867){var _0x5f53a4,_0x4a0223;var _0x3ac3db={'where':{'ProjectId':_0x562bc4[_0x2cac('0x43')]['id']}};if(_0x562bc4['query'][_0x2cac('0x5e')]){_0x3ac3db[_0x2cac('0x39')][_0x2cac('0x5f')]=JSON['parse'](_0x562bc4[_0x2cac('0x2f')][_0x2cac('0x5e')]);}return db['JscriptySessionReport'][_0x2cac('0x57')](_0x3ac3db)[_0x2cac('0x20')](handleEntityNotFound(_0x49fab9,null))[_0x2cac('0x20')](function(_0x448fb8){if(_0x448fb8){_0x5f53a4=_0x448fb8;return db[_0x2cac('0x60')]['findAll']({'where':{'SessionId':{'$in':_[_0x2cac('0x2a')](_0x5f53a4,'id')},'ProjectId':_0x562bc4[_0x2cac('0x43')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x49fab9,null))[_0x2cac('0x20')](function(_0x571e04){if(_0x571e04){_0x4a0223=_0x571e04;var _0x3dee5b={};for(var _0x4f775b=0x0,_0x538244=_0x4a0223['length'];_0x4f775b<_0x538244;_0x4f775b++){if(!_0x3dee5b[_0x2cac('0x35')](_0x4a0223[_0x4f775b][_0x2cac('0x61')])){_0x3dee5b[_0x4a0223[_0x4f775b]['questionId']]=needsEncapsulation(_0x4a0223[_0x4f775b]['question'])?encapsulate(_0x4a0223[_0x4f775b][_0x2cac('0x62')]):_0x4a0223[_0x4f775b][_0x2cac('0x62')];}}var _0x1b3fac=[],_0x185ec8={};for(var _0x30a303=0x0,_0x3016a3=_0x5f53a4[_0x2cac('0x45')];_0x30a303<_0x3016a3;_0x30a303++){_0x185ec8={'ProjectId':_0x562bc4[_0x2cac('0x43')]['id'],'SessionId':_0x5f53a4[_0x30a303]['id'],'StartTime':moment(_0x5f53a4[_0x30a303][_0x2cac('0x5f')])[_0x2cac('0x63')](_0x2cac('0x64'))};for(var _0x401802=0x0,_0xc6e300=_0x4a0223[_0x2cac('0x45')];_0x401802<_0xc6e300;_0x401802++){if(_0x4a0223[_0x401802]['SessionId']==_0x5f53a4[_0x30a303]['id']&&_0x3dee5b[_0x2cac('0x35')](_0x4a0223[_0x401802][_0x2cac('0x61')])){_0x185ec8[_0x3dee5b[_0x4a0223[_0x401802][_0x2cac('0x61')]]]=_0x4a0223[_0x401802][_0x2cac('0x65')];}}for(var _0x28c27e in _0x3dee5b){if(!_0x185ec8[_0x2cac('0x35')](_0x3dee5b[_0x28c27e])){_0x185ec8[_0x3dee5b[_0x28c27e]]=null;}}_0x1b3fac[_0x2cac('0x66')](_0x185ec8);}return _0x1b3fac;}})[_0x2cac('0x20')](function(_0x119408){if(!_[_0x2cac('0x67')](_0x119408)){var _0x57d419=toCsv(_0x119408);var _0x4b4c1d=Date[_0x2cac('0x68')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x562bc4['params']['id'],_0x4b4c1d),_0x57d419);_0x49fab9['setHeader'](_0x2cac('0x69'),_0x2cac('0x6a')+util[_0x2cac('0x63')](_0x2cac('0x6b'),_0x562bc4[_0x2cac('0x43')]['id'],_0x4b4c1d));_0x49fab9['setHeader'](_0x2cac('0x6c'),'text/csv');return _0x49fab9['download'](util[_0x2cac('0x63')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x562bc4['params']['id'],_0x4b4c1d));}else{return _0x49fab9[_0x2cac('0x14')](0xcc);}})[_0x2cac('0x41')](handleError(_0x49fab9,null));}; \ No newline at end of file +var _0xf7fb=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','clone','include','omit','createdAt','updatedAt','userProfileId','update','getSessions','findOne','JscriptySessionReport','hasOwnProperty','nolimit','pick','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','attachment;\x20filename=','setHeader','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0xffcb0d,_0x53a43f){var _0x3c2a31=function(_0x1cb57c){while(--_0x1cb57c){_0xffcb0d['push'](_0xffcb0d['shift']());}};_0x3c2a31(++_0x53a43f);}(_0xf7fb,0x1cc));var _0xbf7f=function(_0x2297e0,_0x3d984f){_0x2297e0=_0x2297e0-0x0;var _0x27ffcc=_0xf7fb[_0x2297e0];return _0x27ffcc;};'use strict';var emlformat=require(_0xbf7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf7f('0x1'));var rp=require(_0xbf7f('0x2'));var moment=require(_0xbf7f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf7f('0x4'));var util=require('util');var path=require(_0xbf7f('0x5'));var sox=require('sox');var csv=require(_0xbf7f('0x6'));var ejs=require(_0xbf7f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf7f('0x8'));var squel=require(_0xbf7f('0x9'));var crypto=require(_0xbf7f('0xa'));var jsforce=require(_0xbf7f('0xb'));var deskjs=require(_0xbf7f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbf7f('0xd'));var Papa=require(_0xbf7f('0xe'));var Redis=require(_0xbf7f('0xf'));var authService=require(_0xbf7f('0x10'));var qs=require(_0xbf7f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf7f('0x12'));var logger=require(_0xbf7f('0x13'))(_0xbf7f('0x14'));var utils=require(_0xbf7f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbf7f('0x16'));var db=require(_0xbf7f('0x17'))['db'];function respondWithStatusCode(_0x19f61e,_0x1f7144){_0x1f7144=_0x1f7144||0xcc;return function(_0x4f2145){if(_0x4f2145){return _0x19f61e[_0xbf7f('0x18')](_0x1f7144);}return _0x19f61e[_0xbf7f('0x19')](_0x1f7144)[_0xbf7f('0x1a')]();};}function respondWithResult(_0x5be657,_0x2f8d09){_0x2f8d09=_0x2f8d09||0xc8;return function(_0x3d3b8f){if(_0x3d3b8f){return _0x5be657[_0xbf7f('0x19')](_0x2f8d09)[_0xbf7f('0x1b')](_0x3d3b8f);}};}function respondWithFilteredResult(_0x1645ba,_0xf58ae9){return function(_0x1ce1ed){if(_0x1ce1ed){var _0x29ab44=typeof _0xf58ae9['offset']===_0xbf7f('0x1c')&&typeof _0xf58ae9[_0xbf7f('0x1d')]===_0xbf7f('0x1c');var _0x50ddb9=_0x1ce1ed[_0xbf7f('0x1e')];var _0x33b1c3=_0x29ab44?0x0:_0xf58ae9[_0xbf7f('0x1f')];var _0x358f00=_0x29ab44?_0x1ce1ed[_0xbf7f('0x1e')]:_0xf58ae9[_0xbf7f('0x1f')]+_0xf58ae9[_0xbf7f('0x1d')];var _0x27838e;if(_0x358f00>=_0x50ddb9){_0x358f00=_0x50ddb9;_0x27838e=0xc8;}else{_0x27838e=0xce;}_0x1645ba[_0xbf7f('0x19')](_0x27838e);return _0x1645ba[_0xbf7f('0x20')]('Content-Range',_0x33b1c3+'-'+_0x358f00+'/'+_0x50ddb9)[_0xbf7f('0x1b')](_0x1ce1ed);}return null;};}function patchUpdates(_0x4e1545){return function(_0x32211a){try{jsonpatch[_0xbf7f('0x21')](_0x32211a,_0x4e1545,!![]);}catch(_0x50a2f0){return BPromise['reject'](_0x50a2f0);}return _0x32211a[_0xbf7f('0x22')]();};}function saveUpdates(_0x10e7f5,_0xa2f08e){return function(_0x4804d0){if(_0x4804d0){return _0x4804d0['update'](_0x10e7f5)[_0xbf7f('0x23')](function(_0x3001c4){return _0x3001c4;});}return null;};}function removeEntity(_0x3eccd6,_0x59ad88){return function(_0x1f83e3){if(_0x1f83e3){return _0x1f83e3[_0xbf7f('0x24')]()[_0xbf7f('0x23')](function(){var _0x65959b=_0x1f83e3[_0xbf7f('0x25')]({'plain':!![]});var _0x4163b6=_0xbf7f('0x26');return db[_0xbf7f('0x27')][_0xbf7f('0x24')]({'where':{'type':_0x4163b6,'resourceId':_0x65959b['id']}})[_0xbf7f('0x23')](function(){return _0x1f83e3;});})['then'](function(){_0x3eccd6[_0xbf7f('0x19')](0xcc)[_0xbf7f('0x1a')]();});}};}function handleEntityNotFound(_0x497aab,_0x19ba68){return function(_0x568dcd){if(!_0x568dcd){_0x497aab[_0xbf7f('0x18')](0x194);}return _0x568dcd;};}function handleError(_0x44220e,_0x11c4d8){_0x11c4d8=_0x11c4d8||0x1f4;return function(_0x544c99){logger[_0xbf7f('0x28')](_0x544c99[_0xbf7f('0x29')]);if(_0x544c99[_0xbf7f('0x2a')]){delete _0x544c99[_0xbf7f('0x2a')];}_0x44220e[_0xbf7f('0x19')](_0x11c4d8)[_0xbf7f('0x2b')](_0x544c99);};}exports[_0xbf7f('0x2c')]=function(_0x4498f9,_0x47fdd8){var _0x120d5a={},_0x55df36={},_0x48be6a={'count':0x0,'rows':[]};var _0x35ba3c=_[_0xbf7f('0x2d')](db[_0xbf7f('0x2e')][_0xbf7f('0x2f')],function(_0x117374){return{'name':_0x117374['fieldName'],'type':_0x117374[_0xbf7f('0x30')][_0xbf7f('0x31')]};});_0x55df36[_0xbf7f('0x32')]=_['map'](_0x35ba3c,_0xbf7f('0x2a'));_0x55df36['query']=_['keys'](_0x4498f9['query']);_0x55df36[_0xbf7f('0x33')]=_[_0xbf7f('0x34')](_0x55df36[_0xbf7f('0x32')],_0x55df36[_0xbf7f('0x35')]);_0x120d5a[_0xbf7f('0x36')]=_[_0xbf7f('0x34')](_0x55df36[_0xbf7f('0x32')],qs[_0xbf7f('0x37')](_0x4498f9[_0xbf7f('0x35')]['fields']));_0x120d5a[_0xbf7f('0x36')]=_0x120d5a[_0xbf7f('0x36')][_0xbf7f('0x38')]?_0x120d5a[_0xbf7f('0x36')]:_0x55df36[_0xbf7f('0x32')];if(!_0x4498f9[_0xbf7f('0x35')]['hasOwnProperty']('nolimit')){_0x120d5a[_0xbf7f('0x1d')]=qs[_0xbf7f('0x1d')](_0x4498f9[_0xbf7f('0x35')]['limit']);_0x120d5a['offset']=qs['offset'](_0x4498f9[_0xbf7f('0x35')][_0xbf7f('0x1f')]);}_0x120d5a[_0xbf7f('0x39')]=qs[_0xbf7f('0x3a')](_0x4498f9[_0xbf7f('0x35')][_0xbf7f('0x3a')]);_0x120d5a['where']=qs[_0xbf7f('0x33')](_['pick'](_0x4498f9['query'],_0x55df36['filters']),_0x35ba3c);if(_0x4498f9[_0xbf7f('0x35')][_0xbf7f('0x3b')]){_0x120d5a[_0xbf7f('0x3c')]=_['merge'](_0x120d5a[_0xbf7f('0x3c')],{'$or':_[_0xbf7f('0x2d')](_0x35ba3c,function(_0x54bcea){if(_0x54bcea['type']!==_0xbf7f('0x3d')){var _0xe1cf57={};_0xe1cf57[_0x54bcea[_0xbf7f('0x2a')]]={'$like':'%'+_0x4498f9[_0xbf7f('0x35')]['filter']+'%'};return _0xe1cf57;}})});}_0x120d5a=_[_0xbf7f('0x3e')]({},_0x120d5a,_0x4498f9[_0xbf7f('0x3f')]);var _0x4907e0={'where':_0x120d5a[_0xbf7f('0x3c')]};return db[_0xbf7f('0x2e')][_0xbf7f('0x1e')](_0x4907e0)[_0xbf7f('0x23')](function(_0x450852){_0x48be6a[_0xbf7f('0x1e')]=_0x450852;if(_0x4498f9[_0xbf7f('0x35')][_0xbf7f('0x40')]){_0x120d5a['include']=[{'all':!![]}];}return db[_0xbf7f('0x2e')]['findAll'](_0x120d5a);})[_0xbf7f('0x23')](function(_0x1116ce){_0x48be6a[_0xbf7f('0x41')]=_0x1116ce;return _0x48be6a;})[_0xbf7f('0x23')](respondWithFilteredResult(_0x47fdd8,_0x120d5a))[_0xbf7f('0x42')](handleError(_0x47fdd8,null));};exports[_0xbf7f('0x43')]=function(_0x10f350,_0x1d096b){var _0x29c82f={'raw':![],'where':{'id':_0x10f350[_0xbf7f('0x44')]['id']}},_0x55df54={};_0x55df54[_0xbf7f('0x32')]=_['keys'](db[_0xbf7f('0x2e')][_0xbf7f('0x2f')]);_0x55df54['query']=_[_0xbf7f('0x45')](_0x10f350['query']);_0x55df54[_0xbf7f('0x33')]=_[_0xbf7f('0x34')](_0x55df54[_0xbf7f('0x32')],_0x55df54[_0xbf7f('0x35')]);_0x29c82f[_0xbf7f('0x36')]=_['intersection'](_0x55df54[_0xbf7f('0x32')],qs[_0xbf7f('0x37')](_0x10f350[_0xbf7f('0x35')]['fields']));_0x29c82f[_0xbf7f('0x36')]=_0x29c82f[_0xbf7f('0x36')][_0xbf7f('0x38')]?_0x29c82f[_0xbf7f('0x36')]:_0x55df54[_0xbf7f('0x32')];if(_0x10f350[_0xbf7f('0x35')][_0xbf7f('0x40')]){_0x29c82f['include']=[{'all':!![]}];}_0x29c82f=_[_0xbf7f('0x3e')]({},_0x29c82f,_0x10f350[_0xbf7f('0x3f')]);return db['JscriptyProject'][_0xbf7f('0x46')](_0x29c82f)[_0xbf7f('0x23')](handleEntityNotFound(_0x1d096b,null))[_0xbf7f('0x23')](respondWithResult(_0x1d096b,null))[_0xbf7f('0x42')](handleError(_0x1d096b,null));};exports[_0xbf7f('0x47')]=function(_0x27394e,_0x4c66bc){return db['JscriptyProject'][_0xbf7f('0x47')](_0x27394e[_0xbf7f('0x48')],{})[_0xbf7f('0x23')](function(_0x1052fb){var _0x5d7cc6=_0x27394e[_0xbf7f('0x49')][_0xbf7f('0x25')]({'plain':!![]});if(!_0x5d7cc6)throw new Error(_0xbf7f('0x4a'));if(_0x5d7cc6[_0xbf7f('0x4b')]===_0xbf7f('0x49')){var _0x2f72fd=_0x1052fb[_0xbf7f('0x25')]({'plain':!![]});var _0x5bb5e7=_0xbf7f('0x26');return db[_0xbf7f('0x4c')]['find']({'where':{'name':_0x5bb5e7,'userProfileId':_0x5d7cc6['userProfileId']},'raw':!![]})[_0xbf7f('0x23')](function(_0x4b7ab0){if(_0x4b7ab0&&_0x4b7ab0[_0xbf7f('0x4d')]===0x0){return db[_0xbf7f('0x27')][_0xbf7f('0x47')]({'name':_0x2f72fd['name'],'resourceId':_0x2f72fd['id'],'type':_0x4b7ab0[_0xbf7f('0x2a')],'sectionId':_0x4b7ab0['id']},{})[_0xbf7f('0x23')](function(){return _0x1052fb;});}else{return _0x1052fb;}})[_0xbf7f('0x42')](function(_0x56f5aa){logger[_0xbf7f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56f5aa);throw _0x56f5aa;});}return _0x1052fb;})[_0xbf7f('0x23')](respondWithResult(_0x4c66bc,0xc9))[_0xbf7f('0x42')](handleError(_0x4c66bc,null));};exports[_0xbf7f('0x4e')]=function(_0xa68e3f,_0x5577e6){var _0x53e1dc={'where':{'id':_0xa68e3f[_0xbf7f('0x44')]['id']}},_0x4d52c4={};_0x4d52c4[_0xbf7f('0x32')]=_[_0xbf7f('0x45')](db[_0xbf7f('0x2e')][_0xbf7f('0x2f')]);_0x53e1dc[_0xbf7f('0x36')]=_[_0xbf7f('0x34')](_0x4d52c4[_0xbf7f('0x32')],qs[_0xbf7f('0x37')](_0xa68e3f[_0xbf7f('0x35')][_0xbf7f('0x37')]));_0x53e1dc[_0xbf7f('0x36')]=_0x53e1dc[_0xbf7f('0x36')][_0xbf7f('0x38')]?_0x53e1dc[_0xbf7f('0x36')]:_0x4d52c4[_0xbf7f('0x32')];if(_0xa68e3f[_0xbf7f('0x35')][_0xbf7f('0x40')]){_0x53e1dc[_0xbf7f('0x4f')]=[{'all':!![]}];}_0x53e1dc=_[_0xbf7f('0x3e')]({},_0x53e1dc,_0xa68e3f[_0xbf7f('0x3f')]);return db['JscriptyProject'][_0xbf7f('0x46')](_0x53e1dc)[_0xbf7f('0x23')](handleEntityNotFound(_0x5577e6,null))[_0xbf7f('0x23')](function(_0xa07491){if(_0xa07491){var _0x24d202=_0xa07491[_0xbf7f('0x25')]({'plain':!![]});_0x24d202=qs[_0xbf7f('0x50')](_0x24d202,['id',_0xbf7f('0x51'),_0xbf7f('0x52')]);_0xa68e3f[_0xbf7f('0x48')]=_[_0xbf7f('0x50')](_0xa68e3f['body'],['id',_0xbf7f('0x51'),_0xbf7f('0x52')]);return db['JscriptyProject'][_0xbf7f('0x47')](_['merge'](_0x24d202,_0xa68e3f[_0xbf7f('0x48')]),{'include':_0xa68e3f[_0xbf7f('0x35')][_0xbf7f('0x40')]?[{'all':!![]}]:undefined})[_0xbf7f('0x23')](function(_0x1ee501){var _0xa27b52=_0xa68e3f[_0xbf7f('0x49')][_0xbf7f('0x25')]({'plain':!![]});if(!_0xa27b52)throw new Error(_0xbf7f('0x4a'));if(_0xa27b52['role']===_0xbf7f('0x49')){var _0xce3857=_0x1ee501[_0xbf7f('0x25')]({'plain':!![]});var _0x2fbdc6='Projects';return db[_0xbf7f('0x4c')]['find']({'where':{'name':_0x2fbdc6,'userProfileId':_0xa27b52[_0xbf7f('0x53')]},'raw':!![]})['then'](function(_0x212d40){if(_0x212d40&&_0x212d40[_0xbf7f('0x4d')]===0x0){return db[_0xbf7f('0x27')][_0xbf7f('0x47')]({'name':_0xce3857[_0xbf7f('0x2a')],'resourceId':_0xce3857['id'],'type':_0x212d40[_0xbf7f('0x2a')],'sectionId':_0x212d40['id']},{})['then'](function(){return _0x1ee501;});}else{return _0x1ee501;}})['catch'](function(_0x3f9a2e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f9a2e);throw _0x3f9a2e;});}return _0x1ee501;});}})[_0xbf7f('0x23')](respondWithResult(_0x5577e6,0xc9))[_0xbf7f('0x42')](handleError(_0x5577e6,null));};exports[_0xbf7f('0x54')]=function(_0x40e35b,_0x16ff24){if(_0x40e35b['body']['id']){delete _0x40e35b[_0xbf7f('0x48')]['id'];}return db['JscriptyProject'][_0xbf7f('0x46')]({'where':{'id':_0x40e35b[_0xbf7f('0x44')]['id']}})['then'](handleEntityNotFound(_0x16ff24,null))[_0xbf7f('0x23')](saveUpdates(_0x40e35b[_0xbf7f('0x48')],null))[_0xbf7f('0x23')](respondWithResult(_0x16ff24,null))[_0xbf7f('0x42')](handleError(_0x16ff24,null));};exports[_0xbf7f('0x24')]=function(_0xd5cbd3,_0x5e9211){return db['JscriptyProject'][_0xbf7f('0x46')]({'where':{'id':_0xd5cbd3['params']['id']}})[_0xbf7f('0x23')](handleEntityNotFound(_0x5e9211,null))[_0xbf7f('0x23')](removeEntity(_0x5e9211,null))[_0xbf7f('0x42')](handleError(_0x5e9211,null));};exports[_0xbf7f('0x55')]=function(_0x1b9cb2,_0x25a0ff,_0x15ab75){var _0x3e0165={'raw':!![],'where':{}};var _0x344169={};var _0x2d52a6={'count':0x0,'rows':[]};return db[_0xbf7f('0x2e')][_0xbf7f('0x56')]({'where':{'id':_0x1b9cb2['params']['id']}})[_0xbf7f('0x23')](handleEntityNotFound(_0x25a0ff,null))[_0xbf7f('0x23')](function(_0x354891){if(_0x354891){_0x344169[_0xbf7f('0x32')]=_[_0xbf7f('0x45')](db[_0xbf7f('0x57')][_0xbf7f('0x2f')]);_0x344169[_0xbf7f('0x35')]=_['keys'](_0x1b9cb2[_0xbf7f('0x35')]);_0x344169['filters']=_[_0xbf7f('0x34')](_0x344169[_0xbf7f('0x32')],_0x344169[_0xbf7f('0x35')]);_0x3e0165[_0xbf7f('0x36')]=_['intersection'](_0x344169['model'],qs[_0xbf7f('0x37')](_0x1b9cb2[_0xbf7f('0x35')][_0xbf7f('0x37')]));_0x3e0165[_0xbf7f('0x36')]=_0x3e0165['attributes'][_0xbf7f('0x38')]?_0x3e0165[_0xbf7f('0x36')]:_0x344169[_0xbf7f('0x32')];if(!_0x1b9cb2[_0xbf7f('0x35')][_0xbf7f('0x58')](_0xbf7f('0x59'))){_0x3e0165[_0xbf7f('0x1d')]=qs[_0xbf7f('0x1d')](_0x1b9cb2[_0xbf7f('0x35')]['limit']);_0x3e0165['offset']=qs[_0xbf7f('0x1f')](_0x1b9cb2[_0xbf7f('0x35')]['offset']);}_0x3e0165[_0xbf7f('0x39')]=qs[_0xbf7f('0x3a')](_0x1b9cb2[_0xbf7f('0x35')]['sort']);_0x3e0165[_0xbf7f('0x3c')]=qs[_0xbf7f('0x33')](_[_0xbf7f('0x5a')](_0x1b9cb2[_0xbf7f('0x35')],_0x344169['filters']));_0x3e0165['where'][_0xbf7f('0x5b')]=_0x354891['id'];if(_0x1b9cb2[_0xbf7f('0x35')][_0xbf7f('0x3b')]){_0x3e0165['where']=_[_0xbf7f('0x3e')](_0x3e0165[_0xbf7f('0x3c')],{'$or':_[_0xbf7f('0x2d')](_0x3e0165['attributes'],function(_0x2fbb82){var _0x38e13e={};_0x38e13e[_0x2fbb82]={'$like':'%'+_0x1b9cb2[_0xbf7f('0x35')][_0xbf7f('0x3b')]+'%'};return _0x38e13e;})});}_0x3e0165=_['merge']({},_0x3e0165,_0x1b9cb2[_0xbf7f('0x3f')]);return db['JscriptySessionReport'][_0xbf7f('0x1e')]({'where':_0x3e0165[_0xbf7f('0x3c')]})[_0xbf7f('0x23')](function(_0xbecc5c){_0x2d52a6[_0xbf7f('0x1e')]=_0xbecc5c;if(_0x1b9cb2['query'][_0xbf7f('0x40')]){_0x3e0165['include']=[{'all':!![]}];}return db[_0xbf7f('0x57')][_0xbf7f('0x5c')](_0x3e0165);})[_0xbf7f('0x23')](function(_0x1b1f57){_0x2d52a6[_0xbf7f('0x41')]=_0x1b1f57;return _0x2d52a6;});}})[_0xbf7f('0x23')](respondWithFilteredResult(_0x25a0ff,_0x3e0165))[_0xbf7f('0x42')](handleError(_0x25a0ff,null));};exports[_0xbf7f('0x5d')]=function(_0x2b9252,_0x2b605b,_0x2197b3){var _0x2f6717={'raw':!![],'where':{}};var _0x1c51ff={};var _0x42c797={'count':0x0,'rows':[]};return db[_0xbf7f('0x2e')][_0xbf7f('0x56')]({'where':{'id':_0x2b9252[_0xbf7f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b605b,null))['then'](function(_0x3918ca){if(_0x3918ca){_0x1c51ff[_0xbf7f('0x32')]=_['keys'](db[_0xbf7f('0x5e')][_0xbf7f('0x2f')]);_0x1c51ff[_0xbf7f('0x35')]=_[_0xbf7f('0x45')](_0x2b9252[_0xbf7f('0x35')]);_0x1c51ff['filters']=_['intersection'](_0x1c51ff['model'],_0x1c51ff[_0xbf7f('0x35')]);_0x2f6717[_0xbf7f('0x36')]=_['intersection'](_0x1c51ff[_0xbf7f('0x32')],qs[_0xbf7f('0x37')](_0x2b9252['query'][_0xbf7f('0x37')]));_0x2f6717[_0xbf7f('0x36')]=_0x2f6717[_0xbf7f('0x36')]['length']?_0x2f6717[_0xbf7f('0x36')]:_0x1c51ff[_0xbf7f('0x32')];if(!_0x2b9252['query'][_0xbf7f('0x58')](_0xbf7f('0x59'))){_0x2f6717[_0xbf7f('0x1d')]=qs['limit'](_0x2b9252[_0xbf7f('0x35')][_0xbf7f('0x1d')]);_0x2f6717[_0xbf7f('0x1f')]=qs[_0xbf7f('0x1f')](_0x2b9252[_0xbf7f('0x35')][_0xbf7f('0x1f')]);}_0x2f6717[_0xbf7f('0x39')]=qs[_0xbf7f('0x3a')](_0x2b9252[_0xbf7f('0x35')]['sort']);_0x2f6717[_0xbf7f('0x3c')]=qs[_0xbf7f('0x33')](_[_0xbf7f('0x5a')](_0x2b9252['query'],_0x1c51ff['filters']));_0x2f6717['where'][_0xbf7f('0x5b')]=_0x3918ca['id'];if(_0x2b9252[_0xbf7f('0x35')][_0xbf7f('0x3b')]){_0x2f6717[_0xbf7f('0x3c')]=_[_0xbf7f('0x3e')](_0x2f6717[_0xbf7f('0x3c')],{'$or':_[_0xbf7f('0x2d')](_0x2f6717[_0xbf7f('0x36')],function(_0x315610){var _0x5100f9={};_0x5100f9[_0x315610]={'$like':'%'+_0x2b9252['query'][_0xbf7f('0x3b')]+'%'};return _0x5100f9;})});}_0x2f6717=_[_0xbf7f('0x3e')]({},_0x2f6717,_0x2b9252['options']);return db[_0xbf7f('0x5e')][_0xbf7f('0x1e')]({'where':_0x2f6717[_0xbf7f('0x3c')]})[_0xbf7f('0x23')](function(_0x4ea60f){_0x42c797['count']=_0x4ea60f;if(_0x2b9252['query']['includeAll']){_0x2f6717[_0xbf7f('0x4f')]=[{'all':!![]}];}return db[_0xbf7f('0x5e')][_0xbf7f('0x5c')](_0x2f6717);})['then'](function(_0x1f0e93){_0x42c797[_0xbf7f('0x41')]=_0x1f0e93;return _0x42c797;});}})[_0xbf7f('0x23')](respondWithFilteredResult(_0x2b605b,_0x2f6717))[_0xbf7f('0x42')](handleError(_0x2b605b,null));};function char(_0x4e6889){return _0xbf7f('0x5f')===typeof _0x4e6889?String[_0xbf7f('0x60')][_0xbf7f('0x21')](null,arguments):_0x4e6889;}function needsEncapsulation(_0x51e1aa){return!!_0x51e1aa&&(_0x51e1aa[_0xbf7f('0x61')]()[_0xbf7f('0x62')](char(0xd))>=0x0||_0x51e1aa[_0xbf7f('0x61')]()[_0xbf7f('0x62')](char(0xa))>=0x0||_0x51e1aa[_0xbf7f('0x61')]()['indexOf'](char(0x2c))>=0x0||_0x51e1aa[_0xbf7f('0x61')]()[_0xbf7f('0x62')](char(0x22))>=0x0);}function encapsulate(_0x36ae3f){var _0xc596fa=char(0x22),_0x2d7723='\x5c'+char(0x22),_0x3bd88e=_0x36ae3f[_0xbf7f('0x61')]()[_0xbf7f('0x63')](new RegExp(_0xc596fa,'g'),_0x2d7723);return _0xc596fa+_0x3bd88e+_0xc596fa;}exports['getSummary']=function(_0x1f123d,_0x48a362,_0x58b135){var _0x437099,_0x579168;var _0x2c9f71={'where':{'ProjectId':_0x1f123d['params']['id']}};if(_0x1f123d[_0xbf7f('0x35')][_0xbf7f('0x64')]){_0x2c9f71[_0xbf7f('0x3c')][_0xbf7f('0x65')]=JSON[_0xbf7f('0x66')](_0x1f123d[_0xbf7f('0x35')][_0xbf7f('0x64')]);}return db[_0xbf7f('0x57')][_0xbf7f('0x5c')](_0x2c9f71)[_0xbf7f('0x23')](handleEntityNotFound(_0x48a362,null))[_0xbf7f('0x23')](function(_0x5f5142){if(_0x5f5142){_0x437099=_0x5f5142;return db[_0xbf7f('0x67')][_0xbf7f('0x5c')]({'where':{'SessionId':{'$in':_[_0xbf7f('0x2d')](_0x437099,'id')},'ProjectId':_0x1f123d[_0xbf7f('0x44')]['id']},'order':_0xbf7f('0x68')});}})[_0xbf7f('0x23')](handleEntityNotFound(_0x48a362,null))[_0xbf7f('0x23')](function(_0xc93d9a){if(_0xc93d9a){_0x579168=_0xc93d9a;var _0x559e6f={};for(var _0x4a7d3f=0x0,_0x3a942f=_0x579168[_0xbf7f('0x38')];_0x4a7d3f<_0x3a942f;_0x4a7d3f++){if(!_0x559e6f['hasOwnProperty'](_0x579168[_0x4a7d3f][_0xbf7f('0x69')])){_0x559e6f[_0x579168[_0x4a7d3f][_0xbf7f('0x69')]]=needsEncapsulation(_0x579168[_0x4a7d3f]['question'])?encapsulate(_0x579168[_0x4a7d3f][_0xbf7f('0x6a')]):_0x579168[_0x4a7d3f][_0xbf7f('0x6a')];}}var _0x492283=[],_0x7d5d81={};for(var _0x270cb4=0x0,_0x12c8d7=_0x437099['length'];_0x270cb4<_0x12c8d7;_0x270cb4++){_0x7d5d81={'ProjectId':_0x1f123d[_0xbf7f('0x44')]['id'],'SessionId':_0x437099[_0x270cb4]['id'],'StartTime':moment(_0x437099[_0x270cb4][_0xbf7f('0x65')])[_0xbf7f('0x6b')](_0xbf7f('0x6c'))};for(var _0xd69534=0x0,_0x44717f=_0x579168[_0xbf7f('0x38')];_0xd69534<_0x44717f;_0xd69534++){if(_0x579168[_0xd69534][_0xbf7f('0x6d')]==_0x437099[_0x270cb4]['id']&&_0x559e6f[_0xbf7f('0x58')](_0x579168[_0xd69534][_0xbf7f('0x69')])){_0x7d5d81[_0x559e6f[_0x579168[_0xd69534]['questionId']]]=_0x579168[_0xd69534][_0xbf7f('0x6e')];}}for(var _0x579f00 in _0x559e6f){if(!_0x7d5d81['hasOwnProperty'](_0x559e6f[_0x579f00])){_0x7d5d81[_0x559e6f[_0x579f00]]=null;}}_0x492283[_0xbf7f('0x6f')](_0x7d5d81);}return _0x492283;}})[_0xbf7f('0x23')](function(_0x3f4bb0){if(!_[_0xbf7f('0x70')](_0x3f4bb0)){var _0x318cdf=toCsv(_0x3f4bb0);var _0x2c42f7=Date[_0xbf7f('0x71')]();fs[_0xbf7f('0x72')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1f123d[_0xbf7f('0x44')]['id'],_0x2c42f7),_0x318cdf);_0x48a362['setHeader']('Content-disposition',_0xbf7f('0x73')+util[_0xbf7f('0x6b')]('Jscripty_Project_%d_Summary_%s.csv',_0x1f123d[_0xbf7f('0x44')]['id'],_0x2c42f7));_0x48a362[_0xbf7f('0x74')]('Content-type',_0xbf7f('0x75'));return _0x48a362[_0xbf7f('0x76')](util['format'](_0xbf7f('0x77'),_0x1f123d[_0xbf7f('0x44')]['id'],_0x2c42f7));}else{return _0x48a362['sendStatus'](0xcc);}})['catch'](handleError(_0x48a362,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c0ceb62..459973a 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 _0x746f=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d27c7,_0x57fae8){var _0x20f591=function(_0x1e2a78){while(--_0x1e2a78){_0x4d27c7['push'](_0x4d27c7['shift']());}};_0x20f591(++_0x57fae8);}(_0x746f,0x9c));var _0xf746=function(_0x61a739,_0x997e85){_0x61a739=_0x61a739-0x0;var _0x259381=_0x746f[_0x61a739];return _0x259381;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var logger=require(_0xf746('0x2'))(_0xf746('0x3'));var moment=require(_0xf746('0x4'));var BPromise=require(_0xf746('0x5'));var rp=require(_0xf746('0x6'));var fs=require('fs');var path=require(_0xf746('0x7'));var rimraf=require(_0xf746('0x8'));var config=require(_0xf746('0x9'));var attributes=require(_0xf746('0xa'));module[_0xf746('0xb')]=function(_0x19d855,_0x2f0f3c){return _0x19d855[_0xf746('0xc')](_0xf746('0xd'),attributes,{'tableName':_0xf746('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects','lodash','../../config/logger','moment'];(function(_0x2ea89f,_0x5ef256){var _0x5dfab4=function(_0x6afdb1){while(--_0x6afdb1){_0x2ea89f['push'](_0x2ea89f['shift']());}};_0x5dfab4(++_0x5ef256);}(_0xa8eb,0x179));var _0xba8e=function(_0x3bf19b,_0x10252a){_0x3bf19b=_0x3bf19b-0x0;var _0x23411b=_0xa8eb[_0x3bf19b];return _0x23411b;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('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 48fd102..9279075 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x13d878,_0x3ac33){_0x13d878=_0x13d878-0x0;var _0x4f9280=_0xbdb7[_0x13d878];return _0x4f9280;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac4a,0x13f));var _0xaac4=function(_0x3a6b59,_0x30fe97){_0x3a6b59=_0x3a6b59-0x0;var _0x434a37=_0xac4a[_0x3a6b59];return _0x434a37;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d8ff6d2..9bb04b3 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 _0xf750=['create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x5810df,_0x30447f){var _0x5d84b3=function(_0x16cddc){while(--_0x16cddc){_0x5810df['push'](_0x5810df['shift']());}};_0x5d84b3(++_0x30447f);}(_0xf750,0x1a3));var _0x0f75=function(_0x9a2f5,_0x6095ba){_0x9a2f5=_0x9a2f5-0x0;var _0x1b9757=_0xf750[_0x9a2f5];return _0x1b9757;};'use strict';var multer=require(_0x0f75('0x0'));var util=require(_0x0f75('0x1'));var path=require(_0x0f75('0x2'));var timeout=require(_0x0f75('0x3'));var express=require('express');var router=express[_0x0f75('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f75('0x5'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x0f75('0x6')]('/',auth[_0x0f75('0x7')](),controller[_0x0f75('0x8')]);router[_0x0f75('0x6')](_0x0f75('0x9'),auth[_0x0f75('0x7')](),controller['describe']);router[_0x0f75('0x6')](_0x0f75('0xa'),auth['isAuthenticated'](),controller[_0x0f75('0xb')]);router[_0x0f75('0xc')]('/',auth['isAuthenticated'](),controller[_0x0f75('0xd')]);router[_0x0f75('0xe')](_0x0f75('0xa'),auth[_0x0f75('0x7')](),controller[_0x0f75('0xf')]);router[_0x0f75('0x10')](_0x0f75('0xa'),auth['isAuthenticated'](),controller[_0x0f75('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2edb=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0x2edb,0x113));var _0xb2ed=function(_0x20a270,_0x8b8437){_0x20a270=_0x20a270-0x0;var _0x49429a=_0x2edb[_0x20a270];return _0x49429a;};'use strict';var multer=require('multer');var util=require(_0xb2ed('0x0'));var path=require(_0xb2ed('0x1'));var timeout=require(_0xb2ed('0x2'));var express=require('express');var router=express[_0xb2ed('0x3')]();var fs_extra=require(_0xb2ed('0x4'));var auth=require(_0xb2ed('0x5'));var interaction=require(_0xb2ed('0x6'));var config=require(_0xb2ed('0x7'));var controller=require(_0xb2ed('0x8'));router[_0xb2ed('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2ed('0xa')]);router[_0xb2ed('0x9')](_0xb2ed('0xb'),auth[_0xb2ed('0xc')](),controller[_0xb2ed('0xd')]);router[_0xb2ed('0x9')](_0xb2ed('0xe'),auth['isAuthenticated'](),controller[_0xb2ed('0xf')]);router[_0xb2ed('0x10')]('/',auth[_0xb2ed('0xc')](),controller[_0xb2ed('0x11')]);router[_0xb2ed('0x12')](_0xb2ed('0xe'),auth[_0xb2ed('0xc')](),controller[_0xb2ed('0x13')]);router[_0xb2ed('0x14')]('/:id',auth[_0xb2ed('0xc')](),controller[_0xb2ed('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5679418..cd17f98 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x1d8092,_0x4d1cc5){_0x1d8092=_0x1d8092-0x0;var _0x48498c=_0x7a54[_0x1d8092];return _0x48498c;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x30a906,_0x57bfa2){_0x30a906=_0x30a906-0x0;var _0x1f2e23=_0x7a54[_0x30a906];return _0x1f2e23;};'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 d5aaabe..401a245 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 _0xe025=['index','map','JscriptyQuestionReport','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xe025,0x146));var _0x5e02=function(_0x23a192,_0x1b530e){_0x23a192=_0x23a192-0x0;var _0x70dedc=_0xe025[_0x23a192];return _0x70dedc;};'use strict';var emlformat=require(_0x5e02('0x0'));var rimraf=require(_0x5e02('0x1'));var zipdir=require(_0x5e02('0x2'));var jsonpatch=require(_0x5e02('0x3'));var rp=require(_0x5e02('0x4'));var moment=require(_0x5e02('0x5'));var BPromise=require(_0x5e02('0x6'));var Mustache=require(_0x5e02('0x7'));var util=require(_0x5e02('0x8'));var path=require('path');var sox=require(_0x5e02('0x9'));var csv=require('to-csv');var ejs=require(_0x5e02('0xa'));var fs=require('fs');var fs_extra=require(_0x5e02('0xb'));var _=require(_0x5e02('0xc'));var squel=require(_0x5e02('0xd'));var crypto=require(_0x5e02('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5e02('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e02('0x10'));var Redis=require(_0x5e02('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e02('0x12'));var hardwareService=require(_0x5e02('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5e02('0x14'));var config=require(_0x5e02('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d67b8,_0x3c359b){_0x3c359b=_0x3c359b||0xcc;return function(_0x2012e0){if(_0x2012e0){return _0x3d67b8['sendStatus'](_0x3c359b);}return _0x3d67b8[_0x5e02('0x16')](_0x3c359b)[_0x5e02('0x17')]();};}function respondWithResult(_0x416e80,_0x2345f0){_0x2345f0=_0x2345f0||0xc8;return function(_0x371d97){if(_0x371d97){return _0x416e80[_0x5e02('0x16')](_0x2345f0)[_0x5e02('0x18')](_0x371d97);}};}function respondWithFilteredResult(_0x5e7339,_0x407d4f){return function(_0x5c6c13){if(_0x5c6c13){var _0x16245b=typeof _0x407d4f[_0x5e02('0x19')]===_0x5e02('0x1a')&&typeof _0x407d4f[_0x5e02('0x1b')]===_0x5e02('0x1a');var _0x4d7393=_0x5c6c13[_0x5e02('0x1c')];var _0xdd1fc9=_0x16245b?0x0:_0x407d4f[_0x5e02('0x19')];var _0x38c067=_0x16245b?_0x5c6c13[_0x5e02('0x1c')]:_0x407d4f['offset']+_0x407d4f[_0x5e02('0x1b')];var _0x565a4e;if(_0x38c067>=_0x4d7393){_0x38c067=_0x4d7393;_0x565a4e=0xc8;}else{_0x565a4e=0xce;}_0x5e7339[_0x5e02('0x16')](_0x565a4e);return _0x5e7339['set'](_0x5e02('0x1d'),_0xdd1fc9+'-'+_0x38c067+'/'+_0x4d7393)[_0x5e02('0x18')](_0x5c6c13);}return null;};}function patchUpdates(_0x7311bd){return function(_0xf3f6aa){try{jsonpatch[_0x5e02('0x1e')](_0xf3f6aa,_0x7311bd,!![]);}catch(_0x37f289){return BPromise[_0x5e02('0x1f')](_0x37f289);}return _0xf3f6aa['save']();};}function saveUpdates(_0x3af80a,_0x8ebc1e){return function(_0x4cebbb){if(_0x4cebbb){return _0x4cebbb[_0x5e02('0x20')](_0x3af80a)[_0x5e02('0x21')](function(_0x1286bc){return _0x1286bc;});}return null;};}function removeEntity(_0x1fb7ed,_0x17e036){return function(_0x5cb1a5){if(_0x5cb1a5){return _0x5cb1a5[_0x5e02('0x22')]()[_0x5e02('0x21')](function(){_0x1fb7ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x317117,_0x23ddcc){return function(_0x23b6b2){if(!_0x23b6b2){_0x317117[_0x5e02('0x23')](0x194);}return _0x23b6b2;};}function handleError(_0x22d17f,_0x3eddee){_0x3eddee=_0x3eddee||0x1f4;return function(_0x33e14a){logger['error'](_0x33e14a[_0x5e02('0x24')]);if(_0x33e14a[_0x5e02('0x25')]){delete _0x33e14a[_0x5e02('0x25')];}_0x22d17f[_0x5e02('0x16')](_0x3eddee)[_0x5e02('0x26')](_0x33e14a);};}exports[_0x5e02('0x27')]=function(_0x3615b4,_0x4839e9){var _0x5a6dc3={},_0x5c03cb={},_0x1ead9e={'count':0x0,'rows':[]};var _0x140b44=_[_0x5e02('0x28')](db[_0x5e02('0x29')]['rawAttributes'],function(_0xfc2708){return{'name':_0xfc2708['fieldName'],'type':_0xfc2708['type'][_0x5e02('0x2a')]};});_0x5c03cb[_0x5e02('0x2b')]=_[_0x5e02('0x28')](_0x140b44,_0x5e02('0x25'));_0x5c03cb['query']=_[_0x5e02('0x2c')](_0x3615b4[_0x5e02('0x2d')]);_0x5c03cb['filters']=_[_0x5e02('0x2e')](_0x5c03cb[_0x5e02('0x2b')],_0x5c03cb[_0x5e02('0x2d')]);_0x5a6dc3[_0x5e02('0x2f')]=_[_0x5e02('0x2e')](_0x5c03cb[_0x5e02('0x2b')],qs[_0x5e02('0x30')](_0x3615b4[_0x5e02('0x2d')][_0x5e02('0x30')]));_0x5a6dc3[_0x5e02('0x2f')]=_0x5a6dc3[_0x5e02('0x2f')][_0x5e02('0x31')]?_0x5a6dc3[_0x5e02('0x2f')]:_0x5c03cb[_0x5e02('0x2b')];if(!_0x3615b4[_0x5e02('0x2d')]['hasOwnProperty'](_0x5e02('0x32'))){_0x5a6dc3[_0x5e02('0x1b')]=qs['limit'](_0x3615b4[_0x5e02('0x2d')][_0x5e02('0x1b')]);_0x5a6dc3[_0x5e02('0x19')]=qs[_0x5e02('0x19')](_0x3615b4[_0x5e02('0x2d')][_0x5e02('0x19')]);}_0x5a6dc3[_0x5e02('0x33')]=qs[_0x5e02('0x34')](_0x3615b4[_0x5e02('0x2d')][_0x5e02('0x34')]);_0x5a6dc3[_0x5e02('0x35')]=qs[_0x5e02('0x36')](_[_0x5e02('0x37')](_0x3615b4[_0x5e02('0x2d')],_0x5c03cb['filters']),_0x140b44);if(_0x3615b4[_0x5e02('0x2d')][_0x5e02('0x38')]){_0x5a6dc3['where']=_['merge'](_0x5a6dc3['where'],{'$or':_[_0x5e02('0x28')](_0x140b44,function(_0x179634){if(_0x179634[_0x5e02('0x39')]!==_0x5e02('0x3a')){var _0x475150={};_0x475150[_0x179634[_0x5e02('0x25')]]={'$like':'%'+_0x3615b4[_0x5e02('0x2d')]['filter']+'%'};return _0x475150;}})});}_0x5a6dc3=_[_0x5e02('0x3b')]({},_0x5a6dc3,_0x3615b4[_0x5e02('0x3c')]);var _0x5d2f02={'where':_0x5a6dc3[_0x5e02('0x35')]};return db[_0x5e02('0x29')][_0x5e02('0x1c')](_0x5d2f02)[_0x5e02('0x21')](function(_0x1d3ea4){_0x1ead9e[_0x5e02('0x1c')]=_0x1d3ea4;if(_0x3615b4[_0x5e02('0x2d')][_0x5e02('0x3d')]){_0x5a6dc3[_0x5e02('0x3e')]=[{'all':!![]}];}return db[_0x5e02('0x29')][_0x5e02('0x3f')](_0x5a6dc3);})[_0x5e02('0x21')](function(_0x3e7e1a){_0x1ead9e[_0x5e02('0x40')]=_0x3e7e1a;return _0x1ead9e;})[_0x5e02('0x21')](respondWithFilteredResult(_0x4839e9,_0x5a6dc3))[_0x5e02('0x41')](handleError(_0x4839e9,null));};exports[_0x5e02('0x42')]=function(_0x1f9603,_0x2ba462){var _0x5acf72={'raw':!![],'where':{'id':_0x1f9603[_0x5e02('0x43')]['id']}},_0xf9b36a={};_0xf9b36a[_0x5e02('0x2b')]=_[_0x5e02('0x2c')](db['JscriptyQuestionReport'][_0x5e02('0x44')]);_0xf9b36a[_0x5e02('0x2d')]=_[_0x5e02('0x2c')](_0x1f9603[_0x5e02('0x2d')]);_0xf9b36a[_0x5e02('0x36')]=_[_0x5e02('0x2e')](_0xf9b36a[_0x5e02('0x2b')],_0xf9b36a[_0x5e02('0x2d')]);_0x5acf72[_0x5e02('0x2f')]=_[_0x5e02('0x2e')](_0xf9b36a[_0x5e02('0x2b')],qs[_0x5e02('0x30')](_0x1f9603['query'][_0x5e02('0x30')]));_0x5acf72[_0x5e02('0x2f')]=_0x5acf72['attributes']['length']?_0x5acf72[_0x5e02('0x2f')]:_0xf9b36a['model'];if(_0x1f9603[_0x5e02('0x2d')][_0x5e02('0x3d')]){_0x5acf72[_0x5e02('0x3e')]=[{'all':!![]}];}_0x5acf72=_['merge']({},_0x5acf72,_0x1f9603['options']);return db[_0x5e02('0x29')][_0x5e02('0x45')](_0x5acf72)['then'](handleEntityNotFound(_0x2ba462,null))['then'](respondWithResult(_0x2ba462,null))[_0x5e02('0x41')](handleError(_0x2ba462,null));};exports[_0x5e02('0x46')]=function(_0xfe57b5,_0x181a03){return db['JscriptyQuestionReport'][_0x5e02('0x46')](_0xfe57b5[_0x5e02('0x47')],{})[_0x5e02('0x21')](respondWithResult(_0x181a03,0xc9))['catch'](handleError(_0x181a03,null));};exports['update']=function(_0x4d2131,_0x44eb48){if(_0x4d2131[_0x5e02('0x47')]['id']){delete _0x4d2131[_0x5e02('0x47')]['id'];}return db[_0x5e02('0x29')][_0x5e02('0x45')]({'where':{'id':_0x4d2131['params']['id']}})[_0x5e02('0x21')](handleEntityNotFound(_0x44eb48,null))[_0x5e02('0x21')](saveUpdates(_0x4d2131[_0x5e02('0x47')],null))[_0x5e02('0x21')](respondWithResult(_0x44eb48,null))[_0x5e02('0x41')](handleError(_0x44eb48,null));};exports[_0x5e02('0x22')]=function(_0x3032b3,_0x43f1a2){return db[_0x5e02('0x29')][_0x5e02('0x45')]({'where':{'id':_0x3032b3['params']['id']}})[_0x5e02('0x21')](handleEntityNotFound(_0x43f1a2,null))['then'](removeEntity(_0x43f1a2,null))['catch'](handleError(_0x43f1a2,null));};exports[_0x5e02('0x48')]=function(_0x2e480d,_0x20e95a){return db['JscriptyQuestionReport'][_0x5e02('0x48')]()[_0x5e02('0x21')](respondWithResult(_0x20e95a,null))[_0x5e02('0x41')](handleError(_0x20e95a,null));}; \ No newline at end of file +var _0x361b=['fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','end','json','limit','undefined','count','offset','set','apply','reject','then','destroy','error','stack','name','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','JscriptyQuestionReport','findAll','rows','catch','show','params','find','create','update','body','describe','eml-format'];(function(_0x46b214,_0x5acd3b){var _0x1ce9cf=function(_0x4deac){while(--_0x4deac){_0x46b214['push'](_0x46b214['shift']());}};_0x1ce9cf(++_0x5acd3b);}(_0x361b,0x8f));var _0xb361=function(_0x38f324,_0x1a515a){_0x38f324=_0x38f324-0x0;var _0x1e2971=_0x361b[_0x38f324];return _0x1e2971;};'use strict';var emlformat=require(_0xb361('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb361('0x1'));var rp=require('request-promise');var moment=require(_0xb361('0x2'));var BPromise=require(_0xb361('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb361('0x4'));var sox=require(_0xb361('0x5'));var csv=require(_0xb361('0x6'));var ejs=require(_0xb361('0x7'));var fs=require('fs');var fs_extra=require(_0xb361('0x8'));var _=require(_0xb361('0x9'));var squel=require('squel');var crypto=require(_0xb361('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb361('0xb'));var Papa=require(_0xb361('0xc'));var Redis=require('ioredis');var authService=require(_0xb361('0xd'));var qs=require(_0xb361('0xe'));var as=require(_0xb361('0xf'));var hardwareService=require(_0xb361('0x10'));var logger=require(_0xb361('0x11'))('api');var utils=require(_0xb361('0x12'));var config=require(_0xb361('0x13'));var licenseUtil=require(_0xb361('0x14'));var db=require(_0xb361('0x15'))['db'];function respondWithStatusCode(_0x14c52a,_0x411422){_0x411422=_0x411422||0xcc;return function(_0xce95f8){if(_0xce95f8){return _0x14c52a[_0xb361('0x16')](_0x411422);}return _0x14c52a[_0xb361('0x17')](_0x411422)[_0xb361('0x18')]();};}function respondWithResult(_0x1af1a9,_0x4a49c0){_0x4a49c0=_0x4a49c0||0xc8;return function(_0x30e38f){if(_0x30e38f){return _0x1af1a9[_0xb361('0x17')](_0x4a49c0)[_0xb361('0x19')](_0x30e38f);}};}function respondWithFilteredResult(_0x255340,_0x5dc8f9){return function(_0x1bbec6){if(_0x1bbec6){var _0x5dfb5c=typeof _0x5dc8f9['offset']==='undefined'&&typeof _0x5dc8f9[_0xb361('0x1a')]===_0xb361('0x1b');var _0x187f5a=_0x1bbec6[_0xb361('0x1c')];var _0x751144=_0x5dfb5c?0x0:_0x5dc8f9['offset'];var _0x3212ef=_0x5dfb5c?_0x1bbec6[_0xb361('0x1c')]:_0x5dc8f9[_0xb361('0x1d')]+_0x5dc8f9['limit'];var _0x41515e;if(_0x3212ef>=_0x187f5a){_0x3212ef=_0x187f5a;_0x41515e=0xc8;}else{_0x41515e=0xce;}_0x255340[_0xb361('0x17')](_0x41515e);return _0x255340[_0xb361('0x1e')]('Content-Range',_0x751144+'-'+_0x3212ef+'/'+_0x187f5a)['json'](_0x1bbec6);}return null;};}function patchUpdates(_0x2b1626){return function(_0x54d3d7){try{jsonpatch[_0xb361('0x1f')](_0x54d3d7,_0x2b1626,!![]);}catch(_0x146907){return BPromise[_0xb361('0x20')](_0x146907);}return _0x54d3d7['save']();};}function saveUpdates(_0x4832ac,_0x2ca20e){return function(_0x2a8929){if(_0x2a8929){return _0x2a8929['update'](_0x4832ac)[_0xb361('0x21')](function(_0x1be430){return _0x1be430;});}return null;};}function removeEntity(_0x14bfc6,_0x3a0246){return function(_0x2be0f0){if(_0x2be0f0){return _0x2be0f0[_0xb361('0x22')]()[_0xb361('0x21')](function(){_0x14bfc6[_0xb361('0x17')](0xcc)[_0xb361('0x18')]();});}};}function handleEntityNotFound(_0x5ce655,_0x2a1150){return function(_0x37a51e){if(!_0x37a51e){_0x5ce655[_0xb361('0x16')](0x194);}return _0x37a51e;};}function handleError(_0x26ce50,_0x18ad56){_0x18ad56=_0x18ad56||0x1f4;return function(_0x1a0430){logger[_0xb361('0x23')](_0x1a0430[_0xb361('0x24')]);if(_0x1a0430[_0xb361('0x25')]){delete _0x1a0430[_0xb361('0x25')];}_0x26ce50[_0xb361('0x17')](_0x18ad56)['send'](_0x1a0430);};}exports['index']=function(_0x967f7f,_0x222939){var _0x376e1f={},_0x5977b9={},_0x2d3ab2={'count':0x0,'rows':[]};var _0x41475f=_[_0xb361('0x26')](db['JscriptyQuestionReport'][_0xb361('0x27')],function(_0x466627){return{'name':_0x466627[_0xb361('0x28')],'type':_0x466627['type'][_0xb361('0x29')]};});_0x5977b9[_0xb361('0x2a')]=_[_0xb361('0x26')](_0x41475f,'name');_0x5977b9[_0xb361('0x2b')]=_[_0xb361('0x2c')](_0x967f7f['query']);_0x5977b9[_0xb361('0x2d')]=_[_0xb361('0x2e')](_0x5977b9[_0xb361('0x2a')],_0x5977b9[_0xb361('0x2b')]);_0x376e1f[_0xb361('0x2f')]=_[_0xb361('0x2e')](_0x5977b9['model'],qs[_0xb361('0x30')](_0x967f7f[_0xb361('0x2b')][_0xb361('0x30')]));_0x376e1f[_0xb361('0x2f')]=_0x376e1f[_0xb361('0x2f')][_0xb361('0x31')]?_0x376e1f[_0xb361('0x2f')]:_0x5977b9[_0xb361('0x2a')];if(!_0x967f7f[_0xb361('0x2b')][_0xb361('0x32')](_0xb361('0x33'))){_0x376e1f[_0xb361('0x1a')]=qs[_0xb361('0x1a')](_0x967f7f[_0xb361('0x2b')][_0xb361('0x1a')]);_0x376e1f['offset']=qs[_0xb361('0x1d')](_0x967f7f[_0xb361('0x2b')][_0xb361('0x1d')]);}_0x376e1f[_0xb361('0x34')]=qs[_0xb361('0x35')](_0x967f7f[_0xb361('0x2b')][_0xb361('0x35')]);_0x376e1f[_0xb361('0x36')]=qs['filters'](_['pick'](_0x967f7f[_0xb361('0x2b')],_0x5977b9['filters']),_0x41475f);if(_0x967f7f[_0xb361('0x2b')][_0xb361('0x37')]){_0x376e1f[_0xb361('0x36')]=_[_0xb361('0x38')](_0x376e1f[_0xb361('0x36')],{'$or':_[_0xb361('0x26')](_0x41475f,function(_0x50d584){if(_0x50d584[_0xb361('0x39')]!==_0xb361('0x3a')){var _0x2d693b={};_0x2d693b[_0x50d584[_0xb361('0x25')]]={'$like':'%'+_0x967f7f[_0xb361('0x2b')][_0xb361('0x37')]+'%'};return _0x2d693b;}})});}_0x376e1f=_[_0xb361('0x38')]({},_0x376e1f,_0x967f7f[_0xb361('0x3b')]);var _0x3b9b6f={'where':_0x376e1f[_0xb361('0x36')]};return db['JscriptyQuestionReport'][_0xb361('0x1c')](_0x3b9b6f)[_0xb361('0x21')](function(_0x5f3dc5){_0x2d3ab2['count']=_0x5f3dc5;if(_0x967f7f[_0xb361('0x2b')]['includeAll']){_0x376e1f[_0xb361('0x3c')]=[{'all':!![]}];}return db[_0xb361('0x3d')][_0xb361('0x3e')](_0x376e1f);})['then'](function(_0x3d5a55){_0x2d3ab2[_0xb361('0x3f')]=_0x3d5a55;return _0x2d3ab2;})[_0xb361('0x21')](respondWithFilteredResult(_0x222939,_0x376e1f))[_0xb361('0x40')](handleError(_0x222939,null));};exports[_0xb361('0x41')]=function(_0x38f2fe,_0x9b8af9){var _0x110360={'raw':!![],'where':{'id':_0x38f2fe[_0xb361('0x42')]['id']}},_0x50bda7={};_0x50bda7[_0xb361('0x2a')]=_['keys'](db[_0xb361('0x3d')]['rawAttributes']);_0x50bda7[_0xb361('0x2b')]=_[_0xb361('0x2c')](_0x38f2fe[_0xb361('0x2b')]);_0x50bda7[_0xb361('0x2d')]=_['intersection'](_0x50bda7[_0xb361('0x2a')],_0x50bda7[_0xb361('0x2b')]);_0x110360['attributes']=_[_0xb361('0x2e')](_0x50bda7[_0xb361('0x2a')],qs['fields'](_0x38f2fe[_0xb361('0x2b')]['fields']));_0x110360[_0xb361('0x2f')]=_0x110360[_0xb361('0x2f')][_0xb361('0x31')]?_0x110360[_0xb361('0x2f')]:_0x50bda7[_0xb361('0x2a')];if(_0x38f2fe[_0xb361('0x2b')]['includeAll']){_0x110360[_0xb361('0x3c')]=[{'all':!![]}];}_0x110360=_[_0xb361('0x38')]({},_0x110360,_0x38f2fe['options']);return db[_0xb361('0x3d')][_0xb361('0x43')](_0x110360)['then'](handleEntityNotFound(_0x9b8af9,null))[_0xb361('0x21')](respondWithResult(_0x9b8af9,null))[_0xb361('0x40')](handleError(_0x9b8af9,null));};exports[_0xb361('0x44')]=function(_0x4b56c2,_0x46dd58){return db[_0xb361('0x3d')]['create'](_0x4b56c2['body'],{})['then'](respondWithResult(_0x46dd58,0xc9))[_0xb361('0x40')](handleError(_0x46dd58,null));};exports[_0xb361('0x45')]=function(_0x5001bb,_0x1b31ba){if(_0x5001bb['body']['id']){delete _0x5001bb['body']['id'];}return db['JscriptyQuestionReport'][_0xb361('0x43')]({'where':{'id':_0x5001bb[_0xb361('0x42')]['id']}})[_0xb361('0x21')](handleEntityNotFound(_0x1b31ba,null))[_0xb361('0x21')](saveUpdates(_0x5001bb[_0xb361('0x46')],null))[_0xb361('0x21')](respondWithResult(_0x1b31ba,null))[_0xb361('0x40')](handleError(_0x1b31ba,null));};exports[_0xb361('0x22')]=function(_0x5a537d,_0x55bc2c){return db[_0xb361('0x3d')]['find']({'where':{'id':_0x5a537d['params']['id']}})[_0xb361('0x21')](handleEntityNotFound(_0x55bc2c,null))[_0xb361('0x21')](removeEntity(_0x55bc2c,null))[_0xb361('0x40')](handleError(_0x55bc2c,null));};exports[_0xb361('0x47')]=function(_0x1d6947,_0x5d6946){return db[_0xb361('0x3d')][_0xb361('0x47')]()[_0xb361('0x21')](respondWithResult(_0x5d6946,null))[_0xb361('0x40')](handleError(_0x5d6946,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index aa7d041..80421b9 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 _0xa222=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x2a3f7a,_0x43ebfe){var _0x487795=function(_0x1fb12a){while(--_0x1fb12a){_0x2a3f7a['push'](_0x2a3f7a['shift']());}};_0x487795(++_0x43ebfe);}(_0xa222,0xf0));var _0x2a22=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0xa222[_0x406e46];return _0x4a3742;};'use strict';var _=require('lodash');var util=require(_0x2a22('0x0'));var logger=require(_0x2a22('0x1'))(_0x2a22('0x2'));var moment=require(_0x2a22('0x3'));var BPromise=require(_0x2a22('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a22('0x5'));var rimraf=require(_0x2a22('0x6'));var config=require(_0x2a22('0x7'));var attributes=require(_0x2a22('0x8'));module['exports']=function(_0xb361da,_0x284a61){return _0xb361da[_0x2a22('0x9')](_0x2a22('0xa'),attributes,{'tableName':_0x2a22('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfefa=['moment','bluebird','path','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x173060,_0xf5ad1){var _0x122cad=function(_0x10a570){while(--_0x10a570){_0x173060['push'](_0x173060['shift']());}};_0x122cad(++_0xf5ad1);}(_0xfefa,0x81));var _0xafef=function(_0x429b3d,_0x53f4df){_0x429b3d=_0x429b3d-0x0;var _0x263040=_0xfefa[_0x429b3d];return _0x263040;};'use strict';var _=require(_0xafef('0x0'));var util=require(_0xafef('0x1'));var logger=require(_0xafef('0x2'))('api');var moment=require(_0xafef('0x3'));var BPromise=require(_0xafef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafef('0x5'));var rimraf=require('rimraf');var config=require(_0xafef('0x6'));var attributes=require(_0xafef('0x7'));module['exports']=function(_0x5d9d71,_0x521217){return _0x5d9d71[_0xafef('0x8')](_0xafef('0x9'),attributes,{'tableName':_0xafef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index c131611..0ccf4a9 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 _0x9840=['rpc','../../config/environment','jayson/promise','client','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3d8c7a,_0x34a40e){var _0x4a4824=function(_0x6370c3){while(--_0x6370c3){_0x3d8c7a['push'](_0x3d8c7a['shift']());}};_0x4a4824(++_0x34a40e);}(_0x9840,0x164));var _0x0984=function(_0x1f2ba3,_0x470020){_0x1f2ba3=_0x1f2ba3-0x0;var _0x3261e0=_0x9840[_0x1f2ba3];return _0x3261e0;};'use strict';var _=require(_0x0984('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0984('0x1'));var rs=require(_0x0984('0x2'));var fs=require('fs');var Redis=require(_0x0984('0x3'));var db=require(_0x0984('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0984('0x5'));var config=require(_0x0984('0x6'));var jayson=require(_0x0984('0x7'));var client=jayson[_0x0984('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1930,_0x3a5f5b,_0xe03cf4){return new BPromise(function(_0x2cfc7a,_0x2579b0){return client['request'](_0x1d1930,_0xe03cf4)['then'](function(_0xa36115){logger[_0x0984('0x9')](_0x0984('0xa'),_0x3a5f5b,_0x0984('0xb'));logger[_0x0984('0xc')](_0x0984('0xd'),_0x3a5f5b,_0x0984('0xb'),JSON[_0x0984('0xe')](_0xa36115));if(_0xa36115[_0x0984('0xf')]){if(_0xa36115[_0x0984('0xf')]['code']===0x1f4){logger[_0x0984('0xf')](_0x0984('0xa'),_0x3a5f5b,_0xa36115[_0x0984('0xf')][_0x0984('0x10')]);return _0x2579b0(_0xa36115[_0x0984('0xf')][_0x0984('0x10')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a5f5b,_0xa36115['error'][_0x0984('0x10')]);return _0x2cfc7a(_0xa36115[_0x0984('0xf')][_0x0984('0x10')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a5f5b,_0x0984('0xb'));_0x2cfc7a(_0xa36115[_0x0984('0x11')]['message']);}})[_0x0984('0x12')](function(_0x4c1306){logger[_0x0984('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a5f5b,_0x4c1306);_0x2579b0(_0x4c1306);});});} \ No newline at end of file +var _0x60e8=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x11c0d4,_0x4742d3){var _0x4d2191=function(_0x3781fe){while(--_0x3781fe){_0x11c0d4['push'](_0x11c0d4['shift']());}};_0x4d2191(++_0x4742d3);}(_0x60e8,0x105));var _0x860e=function(_0x4ee8e2,_0x52cf20){_0x4ee8e2=_0x4ee8e2-0x0;var _0xf26123=_0x60e8[_0x4ee8e2];return _0xf26123;};'use strict';var _=require(_0x860e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x860e('0x1'));var rs=require(_0x860e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x860e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x860e('0x4'))(_0x860e('0x5'));var config=require(_0x860e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x860e('0x7')][_0x860e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f7748,_0x578b72,_0x534c2c){return new BPromise(function(_0x50fbde,_0x23de68){return client['request'](_0x2f7748,_0x534c2c)[_0x860e('0x9')](function(_0x3c0c18){logger[_0x860e('0xa')](_0x860e('0xb'),_0x578b72,_0x860e('0xc'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x578b72,'request\x20sent',JSON[_0x860e('0xd')](_0x3c0c18));if(_0x3c0c18[_0x860e('0xe')]){if(_0x3c0c18[_0x860e('0xe')][_0x860e('0xf')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x578b72,_0x3c0c18[_0x860e('0xe')][_0x860e('0x10')]);return _0x23de68(_0x3c0c18[_0x860e('0xe')][_0x860e('0x10')]);}logger[_0x860e('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x578b72,_0x3c0c18[_0x860e('0xe')][_0x860e('0x10')]);return _0x50fbde(_0x3c0c18[_0x860e('0xe')]['message']);}else{logger[_0x860e('0xa')](_0x860e('0xb'),_0x578b72,_0x860e('0xc'));_0x50fbde(_0x3c0c18['result'][_0x860e('0x10')]);}})[_0x860e('0x11')](function(_0x295a17){logger[_0x860e('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x578b72,_0x295a17);_0x23de68(_0x295a17);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4d8e137..ed720e8 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 _0xce17=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/questions','getQuestions','post','put','update','delete','/:id','destroy','exports'];(function(_0x147c3f,_0x34cdab){var _0x2fc86d=function(_0x1261d2){while(--_0x1261d2){_0x147c3f['push'](_0x147c3f['shift']());}};_0x2fc86d(++_0x34cdab);}(_0xce17,0xa1));var _0x7ce1=function(_0xf6e75d,_0xc70967){_0xf6e75d=_0xf6e75d-0x0;var _0x27514d=_0xce17[_0xf6e75d];return _0x27514d;};'use strict';var multer=require(_0x7ce1('0x0'));var util=require(_0x7ce1('0x1'));var path=require(_0x7ce1('0x2'));var timeout=require(_0x7ce1('0x3'));var express=require(_0x7ce1('0x4'));var router=express[_0x7ce1('0x5')]();var fs_extra=require(_0x7ce1('0x6'));var auth=require(_0x7ce1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7ce1('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x7ce1('0x9')]('/',auth[_0x7ce1('0xa')](),controller[_0x7ce1('0xb')]);router[_0x7ce1('0x9')](_0x7ce1('0xc'),auth[_0x7ce1('0xa')](),controller['describe']);router[_0x7ce1('0x9')]('/:id',auth[_0x7ce1('0xa')](),controller[_0x7ce1('0xd')]);router[_0x7ce1('0x9')](_0x7ce1('0xe'),auth['isAuthenticated'](),controller[_0x7ce1('0xf')]);router[_0x7ce1('0x10')]('/',auth[_0x7ce1('0xa')](),controller['create']);router[_0x7ce1('0x11')]('/:id',auth[_0x7ce1('0xa')](),controller[_0x7ce1('0x12')]);router[_0x7ce1('0x13')](_0x7ce1('0x14'),auth[_0x7ce1('0xa')](),controller[_0x7ce1('0x15')]);module[_0x7ce1('0x16')]=router; \ No newline at end of file +var _0x3dcd=['/:id/questions','getQuestions','create','put','/:id','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x53e654,_0xf5d2a0){var _0xed8977=function(_0x35a504){while(--_0x35a504){_0x53e654['push'](_0x53e654['shift']());}};_0xed8977(++_0xf5d2a0);}(_0x3dcd,0x1d6));var _0xd3dc=function(_0x39cbe4,_0x4a7958){_0x39cbe4=_0x39cbe4-0x0;var _0xe76ba7=_0x3dcd[_0x39cbe4];return _0xe76ba7;};'use strict';var multer=require(_0xd3dc('0x0'));var util=require(_0xd3dc('0x1'));var path=require(_0xd3dc('0x2'));var timeout=require('connect-timeout');var express=require(_0xd3dc('0x3'));var router=express['Router']();var fs_extra=require(_0xd3dc('0x4'));var auth=require(_0xd3dc('0x5'));var interaction=require(_0xd3dc('0x6'));var config=require(_0xd3dc('0x7'));var controller=require(_0xd3dc('0x8'));router[_0xd3dc('0x9')]('/',auth[_0xd3dc('0xa')](),controller['index']);router[_0xd3dc('0x9')](_0xd3dc('0xb'),auth[_0xd3dc('0xa')](),controller[_0xd3dc('0xc')]);router[_0xd3dc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd3dc('0xd')]);router['get'](_0xd3dc('0xe'),auth[_0xd3dc('0xa')](),controller[_0xd3dc('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd3dc('0x10')]);router[_0xd3dc('0x11')](_0xd3dc('0x12'),auth['isAuthenticated'](),controller[_0xd3dc('0x13')]);router[_0xd3dc('0x14')](_0xd3dc('0x12'),auth[_0xd3dc('0xa')](),controller[_0xd3dc('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 595f57b..97d757a 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 _0x62a4=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue'];(function(_0x1fdc33,_0x291828){var _0x34773d=function(_0x21146a){while(--_0x21146a){_0x1fdc33['push'](_0x1fdc33['shift']());}};_0x34773d(++_0x291828);}(_0x62a4,0x88));var _0x462a=function(_0x1cb267,_0xab55ce){_0x1cb267=_0x1cb267-0x0;var _0x8b30ff=_0x62a4[_0x1cb267];return _0x8b30ff;};'use strict';var moment=require('moment');var Sequelize=require(_0x462a('0x0'));module[_0x462a('0x1')]={'starttime':{'type':Sequelize[_0x462a('0x2')],'set':function(_0x45598f){this[_0x462a('0x3')](_0x462a('0x4'),_0x45598f);this['setDataValue'](_0x462a('0x5'),moment()[_0x462a('0x6')](_0x462a('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x462a('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x462a('0x8')]},'completed':{'type':Sequelize[_0x462a('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xf0f7=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xf0f7,0x81));var _0x7f0f=function(_0x2e2665,_0x54a8b1){_0x2e2665=_0x2e2665-0x0;var _0x37ab4e=_0xf0f7[_0x2e2665];return _0x37ab4e;};'use strict';var moment=require(_0x7f0f('0x0'));var Sequelize=require(_0x7f0f('0x1'));module[_0x7f0f('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4ea934){this[_0x7f0f('0x3')](_0x7f0f('0x4'),_0x4ea934);this['setDataValue'](_0x7f0f('0x5'),moment()[_0x7f0f('0x6')](_0x7f0f('0x7')));}},'endtime':{'type':Sequelize[_0x7f0f('0x8')]},'membername':{'type':Sequelize[_0x7f0f('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7f0f('0x9')]},'uniqueid':{'type':Sequelize[_0x7f0f('0x9')]},'calleridname':{'type':Sequelize[_0x7f0f('0x9')]},'calleridnum':{'type':Sequelize[_0x7f0f('0x9')]},'completed':{'type':Sequelize[_0x7f0f('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5aba5de..96ca479 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 _0x92bb=['JscriptySessionReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','then','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rows','rimraf','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','sendStatus','name','index','map'];(function(_0x11e4cc,_0x330f3f){var _0x58bfa1=function(_0x172e9f){while(--_0x172e9f){_0x11e4cc['push'](_0x11e4cc['shift']());}};_0x58bfa1(++_0x330f3f);}(_0x92bb,0xf8));var _0xb92b=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x92bb[_0x51ed62];return _0x34aee3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb92b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb92b('0x1'));var moment=require(_0xb92b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb92b('0x3'));var util=require(_0xb92b('0x4'));var path=require('path');var sox=require(_0xb92b('0x5'));var csv=require(_0xb92b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb92b('0x7'));var _=require(_0xb92b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb92b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb92b('0x6'));var querystring=require(_0xb92b('0xa'));var Papa=require(_0xb92b('0xb'));var Redis=require(_0xb92b('0xc'));var authService=require(_0xb92b('0xd'));var qs=require(_0xb92b('0xe'));var as=require(_0xb92b('0xf'));var hardwareService=require(_0xb92b('0x10'));var logger=require(_0xb92b('0x11'))('api');var utils=require(_0xb92b('0x12'));var config=require(_0xb92b('0x13'));var licenseUtil=require(_0xb92b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54c2e9,_0x31fe21){_0x31fe21=_0x31fe21||0xcc;return function(_0x2682e5){if(_0x2682e5){return _0x54c2e9['sendStatus'](_0x31fe21);}return _0x54c2e9[_0xb92b('0x15')](_0x31fe21)[_0xb92b('0x16')]();};}function respondWithResult(_0x532f72,_0x3d72fa){_0x3d72fa=_0x3d72fa||0xc8;return function(_0x32c9b3){if(_0x32c9b3){return _0x532f72[_0xb92b('0x15')](_0x3d72fa)[_0xb92b('0x17')](_0x32c9b3);}};}function respondWithFilteredResult(_0xfab8d0,_0xce69ea){return function(_0x2f5ed8){if(_0x2f5ed8){var _0x319cf0=typeof _0xce69ea[_0xb92b('0x18')]===_0xb92b('0x19')&&typeof _0xce69ea[_0xb92b('0x1a')]===_0xb92b('0x19');var _0x430c46=_0x2f5ed8[_0xb92b('0x1b')];var _0x2991e4=_0x319cf0?0x0:_0xce69ea[_0xb92b('0x18')];var _0x2e4b61=_0x319cf0?_0x2f5ed8[_0xb92b('0x1b')]:_0xce69ea[_0xb92b('0x18')]+_0xce69ea[_0xb92b('0x1a')];var _0x1d330d;if(_0x2e4b61>=_0x430c46){_0x2e4b61=_0x430c46;_0x1d330d=0xc8;}else{_0x1d330d=0xce;}_0xfab8d0['status'](_0x1d330d);return _0xfab8d0[_0xb92b('0x1c')]('Content-Range',_0x2991e4+'-'+_0x2e4b61+'/'+_0x430c46)['json'](_0x2f5ed8);}return null;};}function patchUpdates(_0x5c646f){return function(_0x4dd37a){try{jsonpatch['apply'](_0x4dd37a,_0x5c646f,!![]);}catch(_0x557949){return BPromise[_0xb92b('0x1d')](_0x557949);}return _0x4dd37a['save']();};}function saveUpdates(_0x48227b,_0x56389d){return function(_0xcf1e68){if(_0xcf1e68){return _0xcf1e68[_0xb92b('0x1e')](_0x48227b)['then'](function(_0x39aede){return _0x39aede;});}return null;};}function removeEntity(_0x23d6ee,_0x1e4471){return function(_0xaf734e){if(_0xaf734e){return _0xaf734e[_0xb92b('0x1f')]()['then'](function(){_0x23d6ee['status'](0xcc)[_0xb92b('0x16')]();});}};}function handleEntityNotFound(_0x4fc7b4,_0x4a1849){return function(_0x16179f){if(!_0x16179f){_0x4fc7b4[_0xb92b('0x20')](0x194);}return _0x16179f;};}function handleError(_0x5d6345,_0x39f6d2){_0x39f6d2=_0x39f6d2||0x1f4;return function(_0x4191bb){logger['error'](_0x4191bb['stack']);if(_0x4191bb[_0xb92b('0x21')]){delete _0x4191bb[_0xb92b('0x21')];}_0x5d6345[_0xb92b('0x15')](_0x39f6d2)['send'](_0x4191bb);};}exports[_0xb92b('0x22')]=function(_0x5a0345,_0x2d279e){var _0x411430={},_0x28b325={},_0x139882={'count':0x0,'rows':[]};var _0x47ebd4=_[_0xb92b('0x23')](db[_0xb92b('0x24')][_0xb92b('0x25')],function(_0x3209af){return{'name':_0x3209af['fieldName'],'type':_0x3209af['type'][_0xb92b('0x26')]};});_0x28b325[_0xb92b('0x27')]=_[_0xb92b('0x23')](_0x47ebd4,_0xb92b('0x21'));_0x28b325['query']=_['keys'](_0x5a0345[_0xb92b('0x28')]);_0x28b325[_0xb92b('0x29')]=_[_0xb92b('0x2a')](_0x28b325[_0xb92b('0x27')],_0x28b325['query']);_0x411430[_0xb92b('0x2b')]=_[_0xb92b('0x2a')](_0x28b325[_0xb92b('0x27')],qs[_0xb92b('0x2c')](_0x5a0345[_0xb92b('0x28')][_0xb92b('0x2c')]));_0x411430[_0xb92b('0x2b')]=_0x411430[_0xb92b('0x2b')][_0xb92b('0x2d')]?_0x411430[_0xb92b('0x2b')]:_0x28b325[_0xb92b('0x27')];if(!_0x5a0345[_0xb92b('0x28')][_0xb92b('0x2e')](_0xb92b('0x2f'))){_0x411430[_0xb92b('0x1a')]=qs[_0xb92b('0x1a')](_0x5a0345[_0xb92b('0x28')][_0xb92b('0x1a')]);_0x411430[_0xb92b('0x18')]=qs[_0xb92b('0x18')](_0x5a0345[_0xb92b('0x28')][_0xb92b('0x18')]);}_0x411430['order']=qs[_0xb92b('0x30')](_0x5a0345[_0xb92b('0x28')][_0xb92b('0x30')]);_0x411430[_0xb92b('0x31')]=qs['filters'](_['pick'](_0x5a0345[_0xb92b('0x28')],_0x28b325[_0xb92b('0x29')]),_0x47ebd4);if(_0x5a0345[_0xb92b('0x28')][_0xb92b('0x32')]){_0x411430['where']=_[_0xb92b('0x33')](_0x411430['where'],{'$or':_[_0xb92b('0x23')](_0x47ebd4,function(_0xdcfd9b){if(_0xdcfd9b[_0xb92b('0x34')]!=='VIRTUAL'){var _0x59cd50={};_0x59cd50[_0xdcfd9b['name']]={'$like':'%'+_0x5a0345[_0xb92b('0x28')][_0xb92b('0x32')]+'%'};return _0x59cd50;}})});}_0x411430=_[_0xb92b('0x33')]({},_0x411430,_0x5a0345['options']);var _0x1ea31b={'where':_0x411430[_0xb92b('0x31')]};return db[_0xb92b('0x24')][_0xb92b('0x1b')](_0x1ea31b)[_0xb92b('0x35')](function(_0x2620c2){_0x139882[_0xb92b('0x1b')]=_0x2620c2;if(_0x5a0345[_0xb92b('0x28')][_0xb92b('0x36')]){_0x411430[_0xb92b('0x37')]=[{'all':!![]}];}return db[_0xb92b('0x24')][_0xb92b('0x38')](_0x411430);})['then'](function(_0x4cb7bc){_0x139882['rows']=_0x4cb7bc;return _0x139882;})['then'](respondWithFilteredResult(_0x2d279e,_0x411430))[_0xb92b('0x39')](handleError(_0x2d279e,null));};exports[_0xb92b('0x3a')]=function(_0x14fc9d,_0x4aead9){var _0x37b79e={'raw':!![],'where':{'id':_0x14fc9d[_0xb92b('0x3b')]['id']}},_0x436909={};_0x436909[_0xb92b('0x27')]=_[_0xb92b('0x3c')](db[_0xb92b('0x24')][_0xb92b('0x25')]);_0x436909[_0xb92b('0x28')]=_['keys'](_0x14fc9d['query']);_0x436909['filters']=_[_0xb92b('0x2a')](_0x436909[_0xb92b('0x27')],_0x436909[_0xb92b('0x28')]);_0x37b79e[_0xb92b('0x2b')]=_[_0xb92b('0x2a')](_0x436909[_0xb92b('0x27')],qs[_0xb92b('0x2c')](_0x14fc9d[_0xb92b('0x28')]['fields']));_0x37b79e[_0xb92b('0x2b')]=_0x37b79e[_0xb92b('0x2b')]['length']?_0x37b79e[_0xb92b('0x2b')]:_0x436909['model'];if(_0x14fc9d[_0xb92b('0x28')][_0xb92b('0x36')]){_0x37b79e['include']=[{'all':!![]}];}_0x37b79e=_[_0xb92b('0x33')]({},_0x37b79e,_0x14fc9d[_0xb92b('0x3d')]);return db['JscriptySessionReport'][_0xb92b('0x3e')](_0x37b79e)[_0xb92b('0x35')](handleEntityNotFound(_0x4aead9,null))[_0xb92b('0x35')](respondWithResult(_0x4aead9,null))[_0xb92b('0x39')](handleError(_0x4aead9,null));};exports[_0xb92b('0x3f')]=function(_0x470d6b,_0x5ed597){return db[_0xb92b('0x24')][_0xb92b('0x3f')](_0x470d6b[_0xb92b('0x40')],{})[_0xb92b('0x35')](respondWithResult(_0x5ed597,0xc9))['catch'](handleError(_0x5ed597,null));};exports['update']=function(_0x56695a,_0x1ab1ce){if(_0x56695a[_0xb92b('0x40')]['id']){delete _0x56695a[_0xb92b('0x40')]['id'];}return db['JscriptySessionReport'][_0xb92b('0x3e')]({'where':{'id':_0x56695a[_0xb92b('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1ab1ce,null))[_0xb92b('0x35')](saveUpdates(_0x56695a[_0xb92b('0x40')],null))[_0xb92b('0x35')](respondWithResult(_0x1ab1ce,null))[_0xb92b('0x39')](handleError(_0x1ab1ce,null));};exports[_0xb92b('0x1f')]=function(_0x572f6d,_0x1e6121){return db[_0xb92b('0x24')][_0xb92b('0x3e')]({'where':{'id':_0x572f6d[_0xb92b('0x3b')]['id']}})[_0xb92b('0x35')](handleEntityNotFound(_0x1e6121,null))[_0xb92b('0x35')](removeEntity(_0x1e6121,null))[_0xb92b('0x39')](handleError(_0x1e6121,null));};exports['describe']=function(_0x128d98,_0x58245f){return db[_0xb92b('0x24')][_0xb92b('0x41')]()[_0xb92b('0x35')](respondWithResult(_0x58245f,null))[_0xb92b('0x39')](handleError(_0x58245f,null));};exports[_0xb92b('0x42')]=function(_0x3b1927,_0x476a67,_0x268868){var _0x185f0a={'raw':!![],'where':{}};var _0xba8835={};var _0x4c2106={'count':0x0,'rows':[]};return db[_0xb92b('0x24')][_0xb92b('0x43')]({'where':{'id':_0x3b1927[_0xb92b('0x3b')]['id']}})[_0xb92b('0x35')](handleEntityNotFound(_0x476a67,null))[_0xb92b('0x35')](function(_0x417a28){if(_0x417a28){_0xba8835[_0xb92b('0x27')]=_[_0xb92b('0x3c')](db[_0xb92b('0x44')][_0xb92b('0x25')]);_0xba8835[_0xb92b('0x28')]=_[_0xb92b('0x3c')](_0x3b1927[_0xb92b('0x28')]);_0xba8835[_0xb92b('0x29')]=_[_0xb92b('0x2a')](_0xba8835[_0xb92b('0x27')],_0xba8835[_0xb92b('0x28')]);_0x185f0a['attributes']=_[_0xb92b('0x2a')](_0xba8835[_0xb92b('0x27')],qs['fields'](_0x3b1927[_0xb92b('0x28')]['fields']));_0x185f0a[_0xb92b('0x2b')]=_0x185f0a[_0xb92b('0x2b')]['length']?_0x185f0a[_0xb92b('0x2b')]:_0xba8835[_0xb92b('0x27')];if(!_0x3b1927[_0xb92b('0x28')][_0xb92b('0x2e')](_0xb92b('0x2f'))){_0x185f0a[_0xb92b('0x1a')]=qs['limit'](_0x3b1927[_0xb92b('0x28')][_0xb92b('0x1a')]);_0x185f0a[_0xb92b('0x18')]=qs[_0xb92b('0x18')](_0x3b1927[_0xb92b('0x28')][_0xb92b('0x18')]);}_0x185f0a['order']=qs[_0xb92b('0x30')](_0x3b1927[_0xb92b('0x28')]['sort']);_0x185f0a[_0xb92b('0x31')]=qs[_0xb92b('0x29')](_['pick'](_0x3b1927[_0xb92b('0x28')],_0xba8835['filters']));_0x185f0a[_0xb92b('0x31')][_0xb92b('0x45')]=_0x417a28['id'];if(_0x3b1927[_0xb92b('0x28')][_0xb92b('0x32')]){_0x185f0a[_0xb92b('0x31')]=_[_0xb92b('0x33')](_0x185f0a[_0xb92b('0x31')],{'$or':_[_0xb92b('0x23')](_0x185f0a[_0xb92b('0x2b')],function(_0x312309){var _0x22c3ed={};_0x22c3ed[_0x312309]={'$like':'%'+_0x3b1927[_0xb92b('0x28')][_0xb92b('0x32')]+'%'};return _0x22c3ed;})});}_0x185f0a=_[_0xb92b('0x33')]({},_0x185f0a,_0x3b1927[_0xb92b('0x3d')]);return db[_0xb92b('0x44')][_0xb92b('0x1b')]({'where':_0x185f0a[_0xb92b('0x31')]})[_0xb92b('0x35')](function(_0x4ca7c9){_0x4c2106[_0xb92b('0x1b')]=_0x4ca7c9;if(_0x3b1927[_0xb92b('0x28')]['includeAll']){_0x185f0a[_0xb92b('0x37')]=[{'all':!![]}];}return db[_0xb92b('0x44')][_0xb92b('0x38')](_0x185f0a);})[_0xb92b('0x35')](function(_0x14c17d){_0x4c2106[_0xb92b('0x46')]=_0x14c17d;return _0x4c2106;});}})[_0xb92b('0x35')](respondWithFilteredResult(_0x476a67,_0x185f0a))[_0xb92b('0x39')](handleError(_0x476a67,null));}; \ No newline at end of file +var _0x4c4b=['intersection','find','create','body','update','describe','findOne','JscriptyQuestionReport','nolimit','pick','SessionId','rows','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','destroy','then','error','name','send','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','show','params'];(function(_0x9a2c13,_0x49e894){var _0x192d55=function(_0x140875){while(--_0x140875){_0x9a2c13['push'](_0x9a2c13['shift']());}};_0x192d55(++_0x49e894);}(_0x4c4b,0x1ec));var _0xb4c4=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x4c4b[_0x1b3a5c];return _0x2ae8cb;};'use strict';var emlformat=require(_0xb4c4('0x0'));var rimraf=require(_0xb4c4('0x1'));var zipdir=require(_0xb4c4('0x2'));var jsonpatch=require(_0xb4c4('0x3'));var rp=require(_0xb4c4('0x4'));var moment=require(_0xb4c4('0x5'));var BPromise=require(_0xb4c4('0x6'));var Mustache=require(_0xb4c4('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb4c4('0x8'));var csv=require(_0xb4c4('0x9'));var ejs=require(_0xb4c4('0xa'));var fs=require('fs');var fs_extra=require(_0xb4c4('0xb'));var _=require(_0xb4c4('0xc'));var squel=require(_0xb4c4('0xd'));var crypto=require(_0xb4c4('0xe'));var jsforce=require(_0xb4c4('0xf'));var deskjs=require(_0xb4c4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb4c4('0x11'));var Papa=require('papaparse');var Redis=require(_0xb4c4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb4c4('0x13'));var as=require(_0xb4c4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4c4('0x15'))('api');var utils=require(_0xb4c4('0x16'));var config=require(_0xb4c4('0x17'));var licenseUtil=require(_0xb4c4('0x18'));var db=require(_0xb4c4('0x19'))['db'];function respondWithStatusCode(_0x48552f,_0x1da4ab){_0x1da4ab=_0x1da4ab||0xcc;return function(_0x7b2f26){if(_0x7b2f26){return _0x48552f[_0xb4c4('0x1a')](_0x1da4ab);}return _0x48552f['status'](_0x1da4ab)[_0xb4c4('0x1b')]();};}function respondWithResult(_0x32dfec,_0x3cb9ff){_0x3cb9ff=_0x3cb9ff||0xc8;return function(_0x3765ba){if(_0x3765ba){return _0x32dfec[_0xb4c4('0x1c')](_0x3cb9ff)['json'](_0x3765ba);}};}function respondWithFilteredResult(_0x27a179,_0x5e4aaa){return function(_0x1812a7){if(_0x1812a7){var _0x192ade=typeof _0x5e4aaa[_0xb4c4('0x1d')]===_0xb4c4('0x1e')&&typeof _0x5e4aaa['limit']===_0xb4c4('0x1e');var _0x33f4a5=_0x1812a7[_0xb4c4('0x1f')];var _0x450a27=_0x192ade?0x0:_0x5e4aaa[_0xb4c4('0x1d')];var _0x586c91=_0x192ade?_0x1812a7['count']:_0x5e4aaa['offset']+_0x5e4aaa[_0xb4c4('0x20')];var _0x1f06d7;if(_0x586c91>=_0x33f4a5){_0x586c91=_0x33f4a5;_0x1f06d7=0xc8;}else{_0x1f06d7=0xce;}_0x27a179[_0xb4c4('0x1c')](_0x1f06d7);return _0x27a179[_0xb4c4('0x21')](_0xb4c4('0x22'),_0x450a27+'-'+_0x586c91+'/'+_0x33f4a5)[_0xb4c4('0x23')](_0x1812a7);}return null;};}function patchUpdates(_0x32fe11){return function(_0x12c169){try{jsonpatch[_0xb4c4('0x24')](_0x12c169,_0x32fe11,!![]);}catch(_0x3a3725){return BPromise[_0xb4c4('0x25')](_0x3a3725);}return _0x12c169['save']();};}function saveUpdates(_0x45bb22,_0x42a4ee){return function(_0x5de587){if(_0x5de587){return _0x5de587['update'](_0x45bb22)['then'](function(_0x5757d1){return _0x5757d1;});}return null;};}function removeEntity(_0x1249b6,_0x1e18a3){return function(_0x2c39ce){if(_0x2c39ce){return _0x2c39ce[_0xb4c4('0x26')]()[_0xb4c4('0x27')](function(){_0x1249b6['status'](0xcc)[_0xb4c4('0x1b')]();});}};}function handleEntityNotFound(_0x438a85,_0x1b9c8c){return function(_0x33f1dc){if(!_0x33f1dc){_0x438a85[_0xb4c4('0x1a')](0x194);}return _0x33f1dc;};}function handleError(_0x5e261f,_0x43c92a){_0x43c92a=_0x43c92a||0x1f4;return function(_0x4450fb){logger[_0xb4c4('0x28')](_0x4450fb['stack']);if(_0x4450fb[_0xb4c4('0x29')]){delete _0x4450fb['name'];}_0x5e261f[_0xb4c4('0x1c')](_0x43c92a)[_0xb4c4('0x2a')](_0x4450fb);};}exports['index']=function(_0x74f853,_0x58abcc){var _0x599f22={},_0x150dc0={},_0x46285f={'count':0x0,'rows':[]};var _0x3aa2ac=_[_0xb4c4('0x2b')](db[_0xb4c4('0x2c')][_0xb4c4('0x2d')],function(_0x1a78fd){return{'name':_0x1a78fd[_0xb4c4('0x2e')],'type':_0x1a78fd['type'][_0xb4c4('0x2f')]};});_0x150dc0[_0xb4c4('0x30')]=_[_0xb4c4('0x2b')](_0x3aa2ac,'name');_0x150dc0[_0xb4c4('0x31')]=_[_0xb4c4('0x32')](_0x74f853[_0xb4c4('0x31')]);_0x150dc0[_0xb4c4('0x33')]=_['intersection'](_0x150dc0[_0xb4c4('0x30')],_0x150dc0['query']);_0x599f22[_0xb4c4('0x34')]=_['intersection'](_0x150dc0[_0xb4c4('0x30')],qs[_0xb4c4('0x35')](_0x74f853[_0xb4c4('0x31')][_0xb4c4('0x35')]));_0x599f22[_0xb4c4('0x34')]=_0x599f22['attributes'][_0xb4c4('0x36')]?_0x599f22[_0xb4c4('0x34')]:_0x150dc0['model'];if(!_0x74f853[_0xb4c4('0x31')][_0xb4c4('0x37')]('nolimit')){_0x599f22[_0xb4c4('0x20')]=qs[_0xb4c4('0x20')](_0x74f853['query']['limit']);_0x599f22[_0xb4c4('0x1d')]=qs[_0xb4c4('0x1d')](_0x74f853[_0xb4c4('0x31')][_0xb4c4('0x1d')]);}_0x599f22['order']=qs[_0xb4c4('0x38')](_0x74f853[_0xb4c4('0x31')][_0xb4c4('0x38')]);_0x599f22[_0xb4c4('0x39')]=qs[_0xb4c4('0x33')](_['pick'](_0x74f853['query'],_0x150dc0[_0xb4c4('0x33')]),_0x3aa2ac);if(_0x74f853[_0xb4c4('0x31')][_0xb4c4('0x3a')]){_0x599f22[_0xb4c4('0x39')]=_[_0xb4c4('0x3b')](_0x599f22[_0xb4c4('0x39')],{'$or':_[_0xb4c4('0x2b')](_0x3aa2ac,function(_0x447a1a){if(_0x447a1a[_0xb4c4('0x3c')]!=='VIRTUAL'){var _0x2656bb={};_0x2656bb[_0x447a1a['name']]={'$like':'%'+_0x74f853[_0xb4c4('0x31')][_0xb4c4('0x3a')]+'%'};return _0x2656bb;}})});}_0x599f22=_['merge']({},_0x599f22,_0x74f853[_0xb4c4('0x3d')]);var _0x1baecd={'where':_0x599f22['where']};return db[_0xb4c4('0x2c')][_0xb4c4('0x1f')](_0x1baecd)[_0xb4c4('0x27')](function(_0x3879d8){_0x46285f[_0xb4c4('0x1f')]=_0x3879d8;if(_0x74f853[_0xb4c4('0x31')][_0xb4c4('0x3e')]){_0x599f22[_0xb4c4('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb4c4('0x40')](_0x599f22);})[_0xb4c4('0x27')](function(_0x193aa4){_0x46285f['rows']=_0x193aa4;return _0x46285f;})[_0xb4c4('0x27')](respondWithFilteredResult(_0x58abcc,_0x599f22))[_0xb4c4('0x41')](handleError(_0x58abcc,null));};exports[_0xb4c4('0x42')]=function(_0x3aa8dc,_0x4e6303){var _0x58064c={'raw':!![],'where':{'id':_0x3aa8dc[_0xb4c4('0x43')]['id']}},_0x1caa01={};_0x1caa01[_0xb4c4('0x30')]=_[_0xb4c4('0x32')](db['JscriptySessionReport'][_0xb4c4('0x2d')]);_0x1caa01[_0xb4c4('0x31')]=_[_0xb4c4('0x32')](_0x3aa8dc['query']);_0x1caa01['filters']=_['intersection'](_0x1caa01[_0xb4c4('0x30')],_0x1caa01[_0xb4c4('0x31')]);_0x58064c[_0xb4c4('0x34')]=_[_0xb4c4('0x44')](_0x1caa01[_0xb4c4('0x30')],qs[_0xb4c4('0x35')](_0x3aa8dc[_0xb4c4('0x31')][_0xb4c4('0x35')]));_0x58064c[_0xb4c4('0x34')]=_0x58064c[_0xb4c4('0x34')][_0xb4c4('0x36')]?_0x58064c[_0xb4c4('0x34')]:_0x1caa01[_0xb4c4('0x30')];if(_0x3aa8dc['query'][_0xb4c4('0x3e')]){_0x58064c[_0xb4c4('0x3f')]=[{'all':!![]}];}_0x58064c=_[_0xb4c4('0x3b')]({},_0x58064c,_0x3aa8dc[_0xb4c4('0x3d')]);return db[_0xb4c4('0x2c')][_0xb4c4('0x45')](_0x58064c)[_0xb4c4('0x27')](handleEntityNotFound(_0x4e6303,null))['then'](respondWithResult(_0x4e6303,null))[_0xb4c4('0x41')](handleError(_0x4e6303,null));};exports[_0xb4c4('0x46')]=function(_0x5ebfb4,_0x2fc7ca){return db['JscriptySessionReport'][_0xb4c4('0x46')](_0x5ebfb4[_0xb4c4('0x47')],{})['then'](respondWithResult(_0x2fc7ca,0xc9))[_0xb4c4('0x41')](handleError(_0x2fc7ca,null));};exports[_0xb4c4('0x48')]=function(_0x1c51cd,_0x29ae11){if(_0x1c51cd[_0xb4c4('0x47')]['id']){delete _0x1c51cd[_0xb4c4('0x47')]['id'];}return db['JscriptySessionReport'][_0xb4c4('0x45')]({'where':{'id':_0x1c51cd['params']['id']}})[_0xb4c4('0x27')](handleEntityNotFound(_0x29ae11,null))[_0xb4c4('0x27')](saveUpdates(_0x1c51cd[_0xb4c4('0x47')],null))[_0xb4c4('0x27')](respondWithResult(_0x29ae11,null))[_0xb4c4('0x41')](handleError(_0x29ae11,null));};exports['destroy']=function(_0x496568,_0x4f5fec){return db[_0xb4c4('0x2c')]['find']({'where':{'id':_0x496568['params']['id']}})[_0xb4c4('0x27')](handleEntityNotFound(_0x4f5fec,null))[_0xb4c4('0x27')](removeEntity(_0x4f5fec,null))[_0xb4c4('0x41')](handleError(_0x4f5fec,null));};exports[_0xb4c4('0x49')]=function(_0x2bb928,_0x521a88){return db[_0xb4c4('0x2c')][_0xb4c4('0x49')]()[_0xb4c4('0x27')](respondWithResult(_0x521a88,null))[_0xb4c4('0x41')](handleError(_0x521a88,null));};exports['getQuestions']=function(_0xd7d927,_0x47518b,_0x191ec4){var _0xbe1a70={'raw':!![],'where':{}};var _0x57e64f={};var _0x457814={'count':0x0,'rows':[]};return db[_0xb4c4('0x2c')][_0xb4c4('0x4a')]({'where':{'id':_0xd7d927[_0xb4c4('0x43')]['id']}})[_0xb4c4('0x27')](handleEntityNotFound(_0x47518b,null))[_0xb4c4('0x27')](function(_0x3d1912){if(_0x3d1912){_0x57e64f[_0xb4c4('0x30')]=_[_0xb4c4('0x32')](db[_0xb4c4('0x4b')]['rawAttributes']);_0x57e64f['query']=_[_0xb4c4('0x32')](_0xd7d927['query']);_0x57e64f[_0xb4c4('0x33')]=_[_0xb4c4('0x44')](_0x57e64f[_0xb4c4('0x30')],_0x57e64f['query']);_0xbe1a70[_0xb4c4('0x34')]=_['intersection'](_0x57e64f['model'],qs['fields'](_0xd7d927[_0xb4c4('0x31')][_0xb4c4('0x35')]));_0xbe1a70[_0xb4c4('0x34')]=_0xbe1a70[_0xb4c4('0x34')]['length']?_0xbe1a70[_0xb4c4('0x34')]:_0x57e64f['model'];if(!_0xd7d927['query'][_0xb4c4('0x37')](_0xb4c4('0x4c'))){_0xbe1a70[_0xb4c4('0x20')]=qs['limit'](_0xd7d927[_0xb4c4('0x31')][_0xb4c4('0x20')]);_0xbe1a70[_0xb4c4('0x1d')]=qs[_0xb4c4('0x1d')](_0xd7d927[_0xb4c4('0x31')][_0xb4c4('0x1d')]);}_0xbe1a70['order']=qs[_0xb4c4('0x38')](_0xd7d927[_0xb4c4('0x31')][_0xb4c4('0x38')]);_0xbe1a70[_0xb4c4('0x39')]=qs[_0xb4c4('0x33')](_[_0xb4c4('0x4d')](_0xd7d927[_0xb4c4('0x31')],_0x57e64f[_0xb4c4('0x33')]));_0xbe1a70[_0xb4c4('0x39')][_0xb4c4('0x4e')]=_0x3d1912['id'];if(_0xd7d927[_0xb4c4('0x31')][_0xb4c4('0x3a')]){_0xbe1a70['where']=_[_0xb4c4('0x3b')](_0xbe1a70['where'],{'$or':_[_0xb4c4('0x2b')](_0xbe1a70[_0xb4c4('0x34')],function(_0x5f1dac){var _0x481def={};_0x481def[_0x5f1dac]={'$like':'%'+_0xd7d927['query']['filter']+'%'};return _0x481def;})});}_0xbe1a70=_[_0xb4c4('0x3b')]({},_0xbe1a70,_0xd7d927[_0xb4c4('0x3d')]);return db[_0xb4c4('0x4b')][_0xb4c4('0x1f')]({'where':_0xbe1a70['where']})[_0xb4c4('0x27')](function(_0x28b0ed){_0x457814[_0xb4c4('0x1f')]=_0x28b0ed;if(_0xd7d927['query']['includeAll']){_0xbe1a70[_0xb4c4('0x3f')]=[{'all':!![]}];}return db[_0xb4c4('0x4b')][_0xb4c4('0x40')](_0xbe1a70);})[_0xb4c4('0x27')](function(_0x205945){_0x457814[_0xb4c4('0x4f')]=_0x205945;return _0x457814;});}})[_0xb4c4('0x27')](respondWithFilteredResult(_0x47518b,_0xbe1a70))[_0xb4c4('0x41')](handleError(_0x47518b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 49d40bc..2687d51 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 _0xef17=['./jscriptySessionReport.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xef17,0x136));var _0x7ef1=function(_0x5bbe3b,_0x49443f){_0x5bbe3b=_0x5bbe3b-0x0;var _0x46f667=_0xef17[_0x5bbe3b];return _0x46f667;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var logger=require(_0x7ef1('0x2'))(_0x7ef1('0x3'));var moment=require(_0x7ef1('0x4'));var BPromise=require(_0x7ef1('0x5'));var rp=require(_0x7ef1('0x6'));var fs=require('fs');var path=require(_0x7ef1('0x7'));var rimraf=require(_0x7ef1('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ef1('0x9'));module['exports']=function(_0x138ed1,_0x498596){return _0x138ed1[_0x7ef1('0xa')]('JscriptySessionReport',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(_0x2bd78d,_0x2e3e47){var _0x4766ca=function(_0x4a68a1){while(--_0x4a68a1){_0x2bd78d['push'](_0x2bd78d['shift']());}};_0x4766ca(++_0x2e3e47);}(_0x6f47,0xc7));var _0x76f4=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x6f47[_0x38ced4];return _0x547c07;};'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 c3597a9..30c9ea5 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x687b,0x14a));var _0xb687=function(_0x55deec,_0x130e1f){_0x55deec=_0x55deec-0x0;var _0x2a071a=_0x687b[_0x55deec];return _0x2a071a;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x36f226,_0x45cdc2){var _0xd9157d=function(_0x400ae1){while(--_0x400ae1){_0x36f226['push'](_0x36f226['shift']());}};_0xd9157d(++_0x45cdc2);}(_0x71ab,0x64));var _0xb71a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x71ab[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ff1ef82..4ae218b 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 _0x7232=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','update','isAuthenticated','downloadLogFile','multer'];(function(_0x59f4a8,_0x5acea8){var _0x4266a8=function(_0x5565ad){while(--_0x5565ad){_0x59f4a8['push'](_0x59f4a8['shift']());}};_0x4266a8(++_0x5acea8);}(_0x7232,0x1ca));var _0x2723=function(_0x4aa8e8,_0x1ba2b8){_0x4aa8e8=_0x4aa8e8-0x0;var _0x35e0f4=_0x7232[_0x4aa8e8];return _0x35e0f4;};'use strict';var multer=require(_0x2723('0x0'));var util=require(_0x2723('0x1'));var path=require(_0x2723('0x2'));var timeout=require(_0x2723('0x3'));var express=require(_0x2723('0x4'));var router=express[_0x2723('0x5')]();var fs_extra=require(_0x2723('0x6'));var auth=require(_0x2723('0x7'));var interaction=require(_0x2723('0x8'));var config=require(_0x2723('0x9'));var controller=require(_0x2723('0xa'));router[_0x2723('0xb')]('/',controller['index']);router[_0x2723('0xc')](_0x2723('0xd'),auth['isAuthenticated'](),controller[_0x2723('0xe')]);router[_0x2723('0xb')]('/download_log_file',auth[_0x2723('0xf')](),controller[_0x2723('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfbc6=['express','fs-extra','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','downloadLogFile','multer','util','connect-timeout'];(function(_0x397849,_0x50b227){var _0x19a76e=function(_0x4973ff){while(--_0x4973ff){_0x397849['push'](_0x397849['shift']());}};_0x19a76e(++_0x50b227);}(_0xfbc6,0x1e9));var _0x6fbc=function(_0x141993,_0x5cd8c2){_0x141993=_0x141993-0x0;var _0x55203a=_0xfbc6[_0x141993];return _0x55203a;};'use strict';var multer=require(_0x6fbc('0x0'));var util=require(_0x6fbc('0x1'));var path=require('path');var timeout=require(_0x6fbc('0x2'));var express=require(_0x6fbc('0x3'));var router=express['Router']();var fs_extra=require(_0x6fbc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6fbc('0x5'));var controller=require(_0x6fbc('0x6'));router[_0x6fbc('0x7')]('/',controller['index']);router[_0x6fbc('0x8')](_0x6fbc('0x9'),auth[_0x6fbc('0xa')](),controller['update']);router[_0x6fbc('0x7')]('/download_log_file',auth[_0x6fbc('0xa')](),controller[_0x6fbc('0xb')]);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 5afb12d..7f0b17e 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 _0x74a0=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74a0,0x6a));var _0x074a=function(_0x49bdd0,_0x17ce22){_0x49bdd0=_0x49bdd0-0x0;var _0x419682=_0x74a0[_0x49bdd0];return _0x419682;};'use strict';var Sequelize=require(_0x074a('0x0'));module[_0x074a('0x1')]={'license':{'type':Sequelize[_0x074a('0x2')]},'data1':{'type':Sequelize[_0x074a('0x3')]},'data2':{'type':Sequelize[_0x074a('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x074a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf417=['sequelize','TEXT','STRING','INTEGER'];(function(_0x4ac824,_0x313c51){var _0x18895b=function(_0xe8822a){while(--_0xe8822a){_0x4ac824['push'](_0x4ac824['shift']());}};_0x18895b(++_0x313c51);}(_0xf417,0x1d4));var _0x7f41=function(_0x2de9bb,_0xc6daf6){_0x2de9bb=_0x2de9bb-0x0;var _0x2acc40=_0xf417[_0x2de9bb];return _0x2acc40;};'use strict';var Sequelize=require(_0x7f41('0x0'));module['exports']={'license':{'type':Sequelize[_0x7f41('0x1')]},'data1':{'type':Sequelize[_0x7f41('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x7f41('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index fbeab9c..74a8c38 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 _0x6ba8=['length','merge','getLicense','catch','body','find','params','checkLicense','key','demo','downloadLogFile','/var','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','model','keys','License','query','filters','intersection','fields','attributes'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x6ba8,0x116));var _0x86ba=function(_0x8f0b9a,_0x2382d8){_0x8f0b9a=_0x8f0b9a-0x0;var _0x3908ff=_0x6ba8[_0x8f0b9a];return _0x3908ff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86ba('0x0'));var Mustache=require(_0x86ba('0x1'));var util=require(_0x86ba('0x2'));var path=require('path');var sox=require(_0x86ba('0x3'));var csv=require(_0x86ba('0x4'));var ejs=require(_0x86ba('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86ba('0x6'));var squel=require(_0x86ba('0x7'));var crypto=require(_0x86ba('0x8'));var jsforce=require(_0x86ba('0x9'));var deskjs=require(_0x86ba('0xa'));var toCsv=require(_0x86ba('0x4'));var querystring=require(_0x86ba('0xb'));var Papa=require(_0x86ba('0xc'));var Redis=require(_0x86ba('0xd'));var authService=require(_0x86ba('0xe'));var qs=require(_0x86ba('0xf'));var as=require(_0x86ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x86ba('0x11'));var utils=require('../../config/utils');var config=require(_0x86ba('0x12'));var licenseUtil=require(_0x86ba('0x13'));var db=require(_0x86ba('0x14'))['db'];function respondWithStatusCode(_0x3a22a9,_0x38e415){_0x38e415=_0x38e415||0xcc;return function(_0x2d92ac){if(_0x2d92ac){return _0x3a22a9['sendStatus'](_0x38e415);}return _0x3a22a9[_0x86ba('0x15')](_0x38e415)[_0x86ba('0x16')]();};}function respondWithResult(_0xbf2a17,_0x590aec){_0x590aec=_0x590aec||0xc8;return function(_0x541ddb){if(_0x541ddb){return _0xbf2a17[_0x86ba('0x15')](_0x590aec)[_0x86ba('0x17')](_0x541ddb);}};}function respondWithFilteredResult(_0x3f8262,_0x1ba5a7){return function(_0x5a8251){if(_0x5a8251){var _0x685b2a=typeof _0x1ba5a7[_0x86ba('0x18')]==='undefined'&&typeof _0x1ba5a7[_0x86ba('0x19')]===_0x86ba('0x1a');var _0x3852aa=_0x5a8251[_0x86ba('0x1b')];var _0x47842a=_0x685b2a?0x0:_0x1ba5a7['offset'];var _0x548ce4=_0x685b2a?_0x5a8251['count']:_0x1ba5a7[_0x86ba('0x18')]+_0x1ba5a7[_0x86ba('0x19')];var _0x42302e;if(_0x548ce4>=_0x3852aa){_0x548ce4=_0x3852aa;_0x42302e=0xc8;}else{_0x42302e=0xce;}_0x3f8262[_0x86ba('0x15')](_0x42302e);return _0x3f8262[_0x86ba('0x1c')](_0x86ba('0x1d'),_0x47842a+'-'+_0x548ce4+'/'+_0x3852aa)[_0x86ba('0x17')](_0x5a8251);}return null;};}function patchUpdates(_0x5c6d0d){return function(_0x4b197a){try{jsonpatch[_0x86ba('0x1e')](_0x4b197a,_0x5c6d0d,!![]);}catch(_0x2cfb3c){return BPromise[_0x86ba('0x1f')](_0x2cfb3c);}return _0x4b197a[_0x86ba('0x20')]();};}function saveUpdates(_0x38eae6,_0x170800){return function(_0x4e35e2){if(_0x4e35e2){return _0x4e35e2[_0x86ba('0x21')](_0x38eae6)[_0x86ba('0x22')](function(_0x3d0715){return _0x3d0715;});}return null;};}function removeEntity(_0x523d3d,_0x22dd2a){return function(_0x5092e7){if(_0x5092e7){return _0x5092e7['destroy']()[_0x86ba('0x22')](function(){_0x523d3d[_0x86ba('0x15')](0xcc)[_0x86ba('0x16')]();});}};}function handleEntityNotFound(_0x13a810,_0x4b5e31){return function(_0x491a07){if(!_0x491a07){_0x13a810['sendStatus'](0x194);}return _0x491a07;};}function handleError(_0x4ab338,_0x438895){_0x438895=_0x438895||0x1f4;return function(_0x53bd2f){logger[_0x86ba('0x23')](_0x53bd2f[_0x86ba('0x24')]);if(_0x53bd2f[_0x86ba('0x25')]){delete _0x53bd2f[_0x86ba('0x25')];}_0x4ab338[_0x86ba('0x15')](_0x438895)[_0x86ba('0x26')](_0x53bd2f);};}var utilLicense=require(_0x86ba('0x13'));exports['index']=function(_0x493ead,_0x331fe5){var _0x59c9c9={'raw':!![],'where':{'id':0x1}},_0x50ffb8={};_0x50ffb8[_0x86ba('0x27')]=_[_0x86ba('0x28')](db[_0x86ba('0x29')]['rawAttributes']);_0x50ffb8[_0x86ba('0x2a')]=_[_0x86ba('0x28')](_0x493ead[_0x86ba('0x2a')]);_0x50ffb8[_0x86ba('0x2b')]=_[_0x86ba('0x2c')](_0x50ffb8[_0x86ba('0x27')],_0x50ffb8[_0x86ba('0x2a')]);_0x59c9c9['attributes']=_[_0x86ba('0x2c')](_0x50ffb8['model'],qs[_0x86ba('0x2d')](_0x493ead[_0x86ba('0x2a')][_0x86ba('0x2d')]));_0x59c9c9[_0x86ba('0x2e')]=_0x59c9c9[_0x86ba('0x2e')][_0x86ba('0x2f')]?_0x59c9c9['attributes']:_0x50ffb8[_0x86ba('0x27')];_0x59c9c9=_[_0x86ba('0x30')]({},_0x59c9c9,_0x493ead['options']);return utilLicense[_0x86ba('0x31')](_0x59c9c9)['then'](respondWithResult(_0x331fe5,null))[_0x86ba('0x32')](handleError(_0x331fe5,null));};exports[_0x86ba('0x21')]=function(_0x2636a8,_0x596248){if(_0x2636a8[_0x86ba('0x33')]['id']){delete _0x2636a8['body']['id'];}return db[_0x86ba('0x29')][_0x86ba('0x34')]({'where':{'id':_0x2636a8[_0x86ba('0x35')]['id']}})['then'](handleEntityNotFound(_0x596248,null))[_0x86ba('0x22')](function(_0x5251ea){var _0x436e36=_0x5251ea['get']({'plain':!![]});return utilLicense[_0x86ba('0x36')](_0x436e36,_0x2636a8[_0x86ba('0x33')][_0x86ba('0x37')]);})[_0x86ba('0x22')](function(_0x4d8733){if(!_0x4d8733[_0x86ba('0x38')]){return saveUpdates(_0x2636a8['body'],null);}return _0x4d8733;})[_0x86ba('0x22')](respondWithResult(_0x596248,null))[_0x86ba('0x32')](handleError(_0x596248,null));};exports[_0x86ba('0x39')]=function(_0x28d940,_0x3edbe8){var _0x7988c4='license-info.log';var _0x49559a=path['join'](_0x86ba('0x3a'),'log','xcally',_0x7988c4);_0x3edbe8[_0x86ba('0x3b')](_0x86ba('0x3c'),_0x86ba('0x3d')+_0x7988c4);_0x3edbe8[_0x86ba('0x1c')](_0x86ba('0x3e'),_0x86ba('0x3f'));_0x3edbe8[_0x86ba('0x40')](_0x49559a);}; \ No newline at end of file +var _0x907c=['ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','keys','License','query','filters','model','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','key','downloadLogFile','license-info.log','join','log','setHeader','Content-disposition','attachment;\x20filename=','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x907c,0x101));var _0xc907=function(_0x1e2144,_0x311099){_0x1e2144=_0x1e2144-0x0;var _0x392381=_0x907c[_0x1e2144];return _0x392381;};'use strict';var emlformat=require(_0xc907('0x0'));var rimraf=require(_0xc907('0x1'));var zipdir=require(_0xc907('0x2'));var jsonpatch=require(_0xc907('0x3'));var rp=require('request-promise');var moment=require(_0xc907('0x4'));var BPromise=require(_0xc907('0x5'));var Mustache=require(_0xc907('0x6'));var util=require(_0xc907('0x7'));var path=require(_0xc907('0x8'));var sox=require(_0xc907('0x9'));var csv=require(_0xc907('0xa'));var ejs=require(_0xc907('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc907('0xc'));var squel=require('squel');var crypto=require(_0xc907('0xd'));var jsforce=require(_0xc907('0xe'));var deskjs=require(_0xc907('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc907('0x10'));var qs=require(_0xc907('0x11'));var as=require(_0xc907('0x12'));var hardwareService=require(_0xc907('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc907('0x14'));var db=require(_0xc907('0x15'))['db'];function respondWithStatusCode(_0x43bf3b,_0x2e5749){_0x2e5749=_0x2e5749||0xcc;return function(_0x528a34){if(_0x528a34){return _0x43bf3b[_0xc907('0x16')](_0x2e5749);}return _0x43bf3b[_0xc907('0x17')](_0x2e5749)[_0xc907('0x18')]();};}function respondWithResult(_0x2a889b,_0x1615d7){_0x1615d7=_0x1615d7||0xc8;return function(_0x46dbd6){if(_0x46dbd6){return _0x2a889b[_0xc907('0x17')](_0x1615d7)[_0xc907('0x19')](_0x46dbd6);}};}function respondWithFilteredResult(_0x400f14,_0x49d901){return function(_0x5c3595){if(_0x5c3595){var _0xdd98f3=typeof _0x49d901['offset']===_0xc907('0x1a')&&typeof _0x49d901[_0xc907('0x1b')]===_0xc907('0x1a');var _0x40f0f5=_0x5c3595[_0xc907('0x1c')];var _0x478781=_0xdd98f3?0x0:_0x49d901[_0xc907('0x1d')];var _0x3dc2d5=_0xdd98f3?_0x5c3595[_0xc907('0x1c')]:_0x49d901[_0xc907('0x1d')]+_0x49d901[_0xc907('0x1b')];var _0x48ebaa;if(_0x3dc2d5>=_0x40f0f5){_0x3dc2d5=_0x40f0f5;_0x48ebaa=0xc8;}else{_0x48ebaa=0xce;}_0x400f14[_0xc907('0x17')](_0x48ebaa);return _0x400f14[_0xc907('0x1e')](_0xc907('0x1f'),_0x478781+'-'+_0x3dc2d5+'/'+_0x40f0f5)[_0xc907('0x19')](_0x5c3595);}return null;};}function patchUpdates(_0x52f23d){return function(_0xf3c52c){try{jsonpatch['apply'](_0xf3c52c,_0x52f23d,!![]);}catch(_0x44a5d8){return BPromise[_0xc907('0x20')](_0x44a5d8);}return _0xf3c52c[_0xc907('0x21')]();};}function saveUpdates(_0x33eed8,_0x81da4c){return function(_0x34a9f7){if(_0x34a9f7){return _0x34a9f7[_0xc907('0x22')](_0x33eed8)[_0xc907('0x23')](function(_0x530bad){return _0x530bad;});}return null;};}function removeEntity(_0x24dff7,_0xea0fcb){return function(_0x122e53){if(_0x122e53){return _0x122e53[_0xc907('0x24')]()[_0xc907('0x23')](function(){_0x24dff7['status'](0xcc)[_0xc907('0x18')]();});}};}function handleEntityNotFound(_0x1e5227,_0xc25d53){return function(_0x2dfe6b){if(!_0x2dfe6b){_0x1e5227[_0xc907('0x16')](0x194);}return _0x2dfe6b;};}function handleError(_0xd71c86,_0x5484b7){_0x5484b7=_0x5484b7||0x1f4;return function(_0x58c7ea){logger[_0xc907('0x25')](_0x58c7ea[_0xc907('0x26')]);if(_0x58c7ea['name']){delete _0x58c7ea[_0xc907('0x27')];}_0xd71c86[_0xc907('0x17')](_0x5484b7)[_0xc907('0x28')](_0x58c7ea);};}var utilLicense=require(_0xc907('0x14'));exports[_0xc907('0x29')]=function(_0x4a4fac,_0x2bedf1){var _0x44795f={'raw':!![],'where':{'id':0x1}},_0x1c70c3={};_0x1c70c3['model']=_[_0xc907('0x2a')](db[_0xc907('0x2b')]['rawAttributes']);_0x1c70c3[_0xc907('0x2c')]=_[_0xc907('0x2a')](_0x4a4fac[_0xc907('0x2c')]);_0x1c70c3[_0xc907('0x2d')]=_['intersection'](_0x1c70c3[_0xc907('0x2e')],_0x1c70c3[_0xc907('0x2c')]);_0x44795f[_0xc907('0x2f')]=_['intersection'](_0x1c70c3['model'],qs[_0xc907('0x30')](_0x4a4fac[_0xc907('0x2c')][_0xc907('0x30')]));_0x44795f[_0xc907('0x2f')]=_0x44795f[_0xc907('0x2f')][_0xc907('0x31')]?_0x44795f[_0xc907('0x2f')]:_0x1c70c3[_0xc907('0x2e')];_0x44795f=_[_0xc907('0x32')]({},_0x44795f,_0x4a4fac[_0xc907('0x33')]);return utilLicense[_0xc907('0x34')](_0x44795f)[_0xc907('0x23')](respondWithResult(_0x2bedf1,null))[_0xc907('0x35')](handleError(_0x2bedf1,null));};exports[_0xc907('0x22')]=function(_0x5097c4,_0xbea6b7){if(_0x5097c4[_0xc907('0x36')]['id']){delete _0x5097c4[_0xc907('0x36')]['id'];}return db[_0xc907('0x2b')][_0xc907('0x37')]({'where':{'id':_0x5097c4[_0xc907('0x38')]['id']}})[_0xc907('0x23')](handleEntityNotFound(_0xbea6b7,null))['then'](function(_0x4d21a4){var _0x15cd33=_0x4d21a4[_0xc907('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x15cd33,_0x5097c4[_0xc907('0x36')][_0xc907('0x3a')]);})[_0xc907('0x23')](function(_0x409693){if(!_0x409693['demo']){return saveUpdates(_0x5097c4[_0xc907('0x36')],null);}return _0x409693;})[_0xc907('0x23')](respondWithResult(_0xbea6b7,null))[_0xc907('0x35')](handleError(_0xbea6b7,null));};exports[_0xc907('0x3b')]=function(_0x464344,_0x5b165d){var _0x58ede7=_0xc907('0x3c');var _0x3a9a70=path[_0xc907('0x3d')]('/var',_0xc907('0x3e'),'xcally',_0x58ede7);_0x5b165d[_0xc907('0x3f')](_0xc907('0x40'),_0xc907('0x41')+_0x58ede7);_0x5b165d['set']('Content-Type','text/plain');_0x5b165d[_0xc907('0x42')](_0x3a9a70);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1ea504a..8d96713 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 _0xa437=['license','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x36755d,_0x3b60d5){var _0x3867f0=function(_0x11b714){while(--_0x11b714){_0x36755d['push'](_0x36755d['shift']());}};_0x3867f0(++_0x3b60d5);}(_0xa437,0x187));var _0x7a43=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa437[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x7a43('0x0'));var util=require(_0x7a43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7a43('0x2'));var BPromise=require(_0x7a43('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a43('0x4'));var rimraf=require(_0x7a43('0x5'));var config=require(_0x7a43('0x6'));var attributes=require('./license.attributes');module[_0x7a43('0x7')]=function(_0x59e760,_0x419c86){return _0x59e760[_0x7a43('0x8')]('License',attributes,{'tableName':_0x7a43('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fe8=['./license.attributes','exports','define','License','license','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x57b8fa,_0x3d9f70){var _0x51dba0=function(_0x2a5963){while(--_0x2a5963){_0x57b8fa['push'](_0x57b8fa['shift']());}};_0x51dba0(++_0x3d9f70);}(_0x1fe8,0x164));var _0x81fe=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1fe8[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x81fe('0x0'));var util=require(_0x81fe('0x1'));var logger=require(_0x81fe('0x2'))('api');var moment=require('moment');var BPromise=require(_0x81fe('0x3'));var rp=require(_0x81fe('0x4'));var fs=require('fs');var path=require(_0x81fe('0x5'));var rimraf=require(_0x81fe('0x6'));var config=require(_0x81fe('0x7'));var attributes=require(_0x81fe('0x8'));module[_0x81fe('0x9')]=function(_0x67d70c,_0xb1fb3d){return _0x67d70c[_0x81fe('0xa')](_0x81fe('0xb'),attributes,{'tableName':_0x81fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index c537997..83668f5 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 _0x5fb2=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','License,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1bbc73,_0x3ac520){var _0x120a0f=function(_0x434a88){while(--_0x434a88){_0x1bbc73['push'](_0x1bbc73['shift']());}};_0x120a0f(++_0x3ac520);}(_0x5fb2,0x96));var _0x25fb=function(_0x4fe496,_0x1d8673){_0x4fe496=_0x4fe496-0x0;var _0x422b24=_0x5fb2[_0x4fe496];return _0x422b24;};'use strict';var _=require(_0x25fb('0x0'));var util=require(_0x25fb('0x1'));var moment=require(_0x25fb('0x2'));var BPromise=require(_0x25fb('0x3'));var rs=require(_0x25fb('0x4'));var fs=require('fs');var Redis=require(_0x25fb('0x5'));var db=require(_0x25fb('0x6'))['db'];var utils=require(_0x25fb('0x7'));var logger=require(_0x25fb('0x8'))(_0x25fb('0x9'));var config=require(_0x25fb('0xa'));var jayson=require(_0x25fb('0xb'));var client=jayson[_0x25fb('0xc')][_0x25fb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4b4890,_0x3105c6,_0x350d5d){return new BPromise(function(_0x5920d1,_0x18d8b6){return client['request'](_0x4b4890,_0x350d5d)[_0x25fb('0xe')](function(_0x5c37e9){logger['info'](_0x25fb('0xf'),_0x3105c6,_0x25fb('0x10'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x3105c6,'request\x20sent',JSON[_0x25fb('0x11')](_0x5c37e9));if(_0x5c37e9[_0x25fb('0x12')]){if(_0x5c37e9[_0x25fb('0x12')][_0x25fb('0x13')]===0x1f4){logger['error'](_0x25fb('0xf'),_0x3105c6,_0x5c37e9['error']['message']);return _0x18d8b6(_0x5c37e9[_0x25fb('0x12')]['message']);}logger[_0x25fb('0x12')](_0x25fb('0xf'),_0x3105c6,_0x5c37e9[_0x25fb('0x12')][_0x25fb('0x14')]);return _0x5920d1(_0x5c37e9[_0x25fb('0x12')][_0x25fb('0x14')]);}else{logger[_0x25fb('0x15')](_0x25fb('0xf'),_0x3105c6,_0x25fb('0x10'));_0x5920d1(_0x5c37e9[_0x25fb('0x16')][_0x25fb('0x14')]);}})[_0x25fb('0x17')](function(_0x51948e){logger['error'](_0x25fb('0xf'),_0x3105c6,_0x51948e);_0x18d8b6(_0x51948e);});});} \ No newline at end of file +var _0x3b93=['catch','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x5930bb,_0x43709f){var _0x553b38=function(_0x202382){while(--_0x202382){_0x5930bb['push'](_0x5930bb['shift']());}};_0x553b38(++_0x43709f);}(_0x3b93,0x11e));var _0x33b9=function(_0xf765d6,_0x364af9){_0xf765d6=_0xf765d6-0x0;var _0x7d3fb=_0x3b93[_0xf765d6];return _0x7d3fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x33b9('0x0'));var BPromise=require('bluebird');var rs=require(_0x33b9('0x1'));var fs=require('fs');var Redis=require(_0x33b9('0x2'));var db=require(_0x33b9('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x33b9('0x4'));var config=require(_0x33b9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x33b9('0x6')][_0x33b9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ebef8,_0x45783f,_0x2038e0){return new BPromise(function(_0xde27b,_0x5613a6){return client[_0x33b9('0x8')](_0x4ebef8,_0x2038e0)[_0x33b9('0x9')](function(_0x5cba89){logger[_0x33b9('0xa')](_0x33b9('0xb'),_0x45783f,_0x33b9('0xc'));logger[_0x33b9('0xd')](_0x33b9('0xe'),_0x45783f,_0x33b9('0xc'),JSON['stringify'](_0x5cba89));if(_0x5cba89['error']){if(_0x5cba89['error']['code']===0x1f4){logger['error'](_0x33b9('0xb'),_0x45783f,_0x5cba89[_0x33b9('0xf')]['message']);return _0x5613a6(_0x5cba89[_0x33b9('0xf')][_0x33b9('0x10')]);}logger[_0x33b9('0xf')]('License,\x20%s,\x20%s',_0x45783f,_0x5cba89[_0x33b9('0xf')][_0x33b9('0x10')]);return _0xde27b(_0x5cba89['error'][_0x33b9('0x10')]);}else{logger[_0x33b9('0xa')](_0x33b9('0xb'),_0x45783f,'request\x20sent');_0xde27b(_0x5cba89[_0x33b9('0x11')][_0x33b9('0x10')]);}})[_0x33b9('0x12')](function(_0xb3fde6){logger['error'](_0x33b9('0xb'),_0x45783f,_0xb3fde6);_0x5613a6(_0xb3fde6);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d32de51..d700f8e 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 _0x33f2=['/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents','post','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','/:id/users','addAgents','put','update','/:id/dispositions','removeDispositions','delete','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/canned_answers'];(function(_0x15c9c5,_0x4773ac){var _0x57ef22=function(_0x4eaf8b){while(--_0x4eaf8b){_0x15c9c5['push'](_0x15c9c5['shift']());}};_0x57ef22(++_0x4773ac);}(_0x33f2,0x1d4));var _0x233f=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0x33f2[_0x50f6e5];return _0x5988c5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x233f('0x0'));var timeout=require(_0x233f('0x1'));var express=require(_0x233f('0x2'));var router=express[_0x233f('0x3')]();var fs_extra=require(_0x233f('0x4'));var auth=require(_0x233f('0x5'));var interaction=require(_0x233f('0x6'));var config=require('../../config/environment');var controller=require(_0x233f('0x7'));router['get']('/',auth[_0x233f('0x8')](),controller[_0x233f('0x9')]);router[_0x233f('0xa')](_0x233f('0xb'),auth['isAuthenticated'](),controller[_0x233f('0xc')]);router['get'](_0x233f('0xd'),auth['isAuthenticated'](),controller[_0x233f('0xe')]);router[_0x233f('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x233f('0xa')](_0x233f('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x233f('0x10'),auth['isAuthenticated'](),controller[_0x233f('0x11')]);router[_0x233f('0xa')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x233f('0x12')]);router[_0x233f('0xa')](_0x233f('0x13'),auth[_0x233f('0x8')](),controller[_0x233f('0x14')]);router[_0x233f('0xa')](_0x233f('0x15'),auth['isAuthenticated'](),controller[_0x233f('0x16')]);router[_0x233f('0xa')](_0x233f('0x17'),auth[_0x233f('0x8')](),controller['getMessages']);router[_0x233f('0xa')](_0x233f('0x18'),auth[_0x233f('0x8')](),controller[_0x233f('0x19')]);router[_0x233f('0xa')]('/:id/users',auth[_0x233f('0x8')](),controller[_0x233f('0x1a')]);router[_0x233f('0x1b')]('/:id/dispositions',auth[_0x233f('0x8')](),controller['addDisposition']);router[_0x233f('0x1b')](_0x233f('0xf'),auth[_0x233f('0x8')](),controller[_0x233f('0x1c')]);router[_0x233f('0x1b')]('/',auth[_0x233f('0x8')](),controller['create']);router['post'](_0x233f('0x10'),auth['isAuthenticated'](),controller[_0x233f('0x1d')]);router['post'](_0x233f('0x1e'),auth[_0x233f('0x8')](),controller[_0x233f('0x1f')]);router[_0x233f('0x1b')](_0x233f('0x13'),auth['isAuthenticated'](),controller[_0x233f('0x20')]);router['post'](_0x233f('0x15'),auth[_0x233f('0x8')](),controller['addApplications']);router[_0x233f('0x1b')](_0x233f('0x21'),auth[_0x233f('0x8')](),controller[_0x233f('0x22')]);router[_0x233f('0x1b')](_0x233f('0x23'),auth[_0x233f('0x8')](),controller[_0x233f('0x24')]);router[_0x233f('0x25')](_0x233f('0xd'),auth[_0x233f('0x8')](),controller[_0x233f('0x26')]);router['delete'](_0x233f('0x27'),auth['isAuthenticated'](),controller[_0x233f('0x28')]);router['delete'](_0x233f('0xf'),auth[_0x233f('0x8')](),controller['removeAnswers']);router[_0x233f('0x29')](_0x233f('0x10'),auth[_0x233f('0x8')](),controller['removeImap']);router['delete'](_0x233f('0x1e'),auth[_0x233f('0x8')](),controller['removeSmtp']);router[_0x233f('0x29')](_0x233f('0xd'),auth[_0x233f('0x8')](),controller['destroy']);router[_0x233f('0x29')](_0x233f('0x23'),auth[_0x233f('0x8')](),controller[_0x233f('0x2a')]);module[_0x233f('0x2b')]=router; \ No newline at end of file +var _0x3369=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getInteractions','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addSmtp','/:id/interactions','addInteraction','/:id/applications','/:id/send','send','put','update','removeDispositions','delete','/:id/in_servers','removeImap','removeSmtp','destroy','multer'];(function(_0x4b64a4,_0x1bdc50){var _0xd19b0e=function(_0x4dfbe0){while(--_0x4dfbe0){_0x4b64a4['push'](_0x4b64a4['shift']());}};_0xd19b0e(++_0x1bdc50);}(_0x3369,0x16f));var _0x9336=function(_0x409b87,_0x5ef488){_0x409b87=_0x409b87-0x0;var _0x46fa68=_0x3369[_0x409b87];return _0x46fa68;};'use strict';var multer=require(_0x9336('0x0'));var util=require(_0x9336('0x1'));var path=require(_0x9336('0x2'));var timeout=require(_0x9336('0x3'));var express=require(_0x9336('0x4'));var router=express[_0x9336('0x5')]();var fs_extra=require(_0x9336('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9336('0x7'));var config=require(_0x9336('0x8'));var controller=require('./mailAccount.controller');router[_0x9336('0x9')]('/',auth[_0x9336('0xa')](),controller[_0x9336('0xb')]);router[_0x9336('0x9')](_0x9336('0xc'),auth[_0x9336('0xa')](),controller[_0x9336('0xd')]);router[_0x9336('0x9')](_0x9336('0xe'),auth['isAuthenticated'](),controller[_0x9336('0xf')]);router[_0x9336('0x9')](_0x9336('0x10'),auth['isAuthenticated'](),controller[_0x9336('0x11')]);router[_0x9336('0x9')](_0x9336('0x12'),auth['isAuthenticated'](),controller[_0x9336('0x13')]);router['get']('/:id/in_servers',auth[_0x9336('0xa')](),controller[_0x9336('0x14')]);router[_0x9336('0x9')](_0x9336('0x15'),auth[_0x9336('0xa')](),controller['getSmtp']);router[_0x9336('0x9')]('/:id/interactions',auth[_0x9336('0xa')](),controller[_0x9336('0x16')]);router[_0x9336('0x9')]('/:id/applications',auth[_0x9336('0xa')](),controller[_0x9336('0x17')]);router[_0x9336('0x9')]('/:id/messages',auth[_0x9336('0xa')](),controller['getMessages']);router[_0x9336('0x9')](_0x9336('0x18'),auth[_0x9336('0xa')](),controller[_0x9336('0x19')]);router[_0x9336('0x9')](_0x9336('0x1a'),auth['isAuthenticated'](),controller[_0x9336('0x1b')]);router[_0x9336('0x1c')](_0x9336('0x10'),auth[_0x9336('0xa')](),controller[_0x9336('0x1d')]);router['post']('/:id/canned_answers',auth[_0x9336('0xa')](),controller[_0x9336('0x1e')]);router[_0x9336('0x1c')]('/',auth[_0x9336('0xa')](),controller['create']);router[_0x9336('0x1c')]('/:id/in_servers',auth[_0x9336('0xa')](),controller[_0x9336('0x1f')]);router[_0x9336('0x1c')](_0x9336('0x15'),auth['isAuthenticated'](),controller[_0x9336('0x20')]);router[_0x9336('0x1c')](_0x9336('0x21'),auth[_0x9336('0xa')](),controller[_0x9336('0x22')]);router[_0x9336('0x1c')](_0x9336('0x23'),auth['isAuthenticated'](),controller['addApplications']);router[_0x9336('0x1c')](_0x9336('0x24'),auth[_0x9336('0xa')](),controller[_0x9336('0x25')]);router[_0x9336('0x1c')](_0x9336('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9336('0x26')]('/:id',auth[_0x9336('0xa')](),controller[_0x9336('0x27')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9336('0x28')]);router[_0x9336('0x29')](_0x9336('0x12'),auth[_0x9336('0xa')](),controller['removeAnswers']);router['delete'](_0x9336('0x2a'),auth[_0x9336('0xa')](),controller[_0x9336('0x2b')]);router['delete'](_0x9336('0x15'),auth[_0x9336('0xa')](),controller[_0x9336('0x2c')]);router[_0x9336('0x29')](_0x9336('0xe'),auth[_0x9336('0xa')](),controller[_0x9336('0x2d')]);router[_0x9336('0x29')](_0x9336('0x1a'),auth[_0x9336('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d1494cd..f117cab 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 _0x1118=['ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x41a578,_0x112b81){var _0x3904cb=function(_0x43ed12){while(--_0x43ed12){_0x41a578['push'](_0x41a578['shift']());}};_0x3904cb(++_0x112b81);}(_0x1118,0x86));var _0x8111=function(_0x107ad0,_0x3f5a09){_0x107ad0=_0x107ad0-0x0;var _0x318a0a=_0x1118[_0x107ad0];return _0x318a0a;};'use strict';var Sequelize=require(_0x8111('0x0'));module[_0x8111('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x8111('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x8111('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x8111('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x8111('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x8111('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8111('0x2')],'allowNull':![],'defaultValue':_0x8111('0x5')},'fontSize':{'type':Sequelize[_0x8111('0x6')](0x2)[_0x8111('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8111('0x4')],'defaultValue':function(){return _0x8111('0x8');}},'notificationSound':{'type':Sequelize[_0x8111('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8111('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8111('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8111('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8111('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8111('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8111('0x3')],'defaultValue':![],'comment':_0x8111('0x9'),'set':function(_0x328242){if(!_0x328242)this[_0x8111('0xa')](_0x8111('0xb'),null);this[_0x8111('0xa')](_0x8111('0xc'),_0x328242);}},'provider':{'type':Sequelize[_0x8111('0xd')](_0x8111('0xe'),_0x8111('0xf'),_0x8111('0x10'),_0x8111('0x11')),'defaultValue':null,'get':function(){if(!this[_0x8111('0x12')](_0x8111('0x13')))return _0x8111('0x14');return this[_0x8111('0x12')](_0x8111('0x13'));},'set':function(_0x272c90){if(_0x272c90===_0x8111('0x14'))_0x272c90=null;return this['setDataValue'](_0x8111('0x13'),_0x272c90);}}}; \ No newline at end of file +var _0x348a=['sequelize','STRING','BOOLEAN','UNSIGNED','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','getDataValue','provider','custom'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x348a,0xd2));var _0xa348=function(_0x4cbec2,_0x3e354f){_0x4cbec2=_0x4cbec2-0x0;var _0x207cd4=_0x348a[_0x4cbec2];return _0x207cd4;};'use strict';var Sequelize=require(_0xa348('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xa348('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xa348('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa348('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa348('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa348('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa348('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xa348('0x3')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xa348('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa348('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa348('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa348('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa348('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa348('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa348('0x2')],'defaultValue':![],'comment':_0xa348('0x5'),'set':function(_0x12a0a5){if(!_0x12a0a5)this[_0xa348('0x6')](_0xa348('0x7'),null);this[_0xa348('0x6')](_0xa348('0x8'),_0x12a0a5);}},'provider':{'type':Sequelize[_0xa348('0x9')](_0xa348('0xa'),'hotmail',_0xa348('0xb'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xa348('0xc')](_0xa348('0xd')))return _0xa348('0xe');return this['getDataValue'](_0xa348('0xd'));},'set':function(_0x5c99f0){if(_0x5c99f0==='custom')_0x5c99f0=null;return this['setDataValue'](_0xa348('0xd'),_0x5c99f0);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 839552a..1b383ab 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 _0x040a=['error','message','result','status','end','json','offset','limit','undefined','count','set','update','then','get','MailAccounts','UserProfileResource','sendStatus','stack','name','send','Imap','Smtp','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','MailAccount','includeAll','include','findAll','rows','catch','MailServerIn','Pause','body','modernAuthentication','CloudProviderId','MailServerOut','describe','addDisposition','find','MailAccountId','create','getDispositions','findOne','params','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','provider','email','ListId','isNil','active','description','user','password','pass','service','host','port','username','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','split','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','CloudProvider','custom','OAuth2','VerifySmtp','destroy','Sequelize','ValidationError','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailAccount.socket','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x040a,0x9f));var _0xa040=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x040a[_0x4bfe08];return _0x1f9125;};'use strict';var moment=require(_0xa040('0x0'));var BPromise=require(_0xa040('0x1'));var util=require(_0xa040('0x2'));var path=require(_0xa040('0x3'));var _=require(_0xa040('0x4'));var juice=require(_0xa040('0x5'));var Redis=require(_0xa040('0x6'));var qs=require(_0xa040('0x7'));var logger=require(_0xa040('0x8'))(_0xa040('0x9'));var config=require(_0xa040('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa040('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa040('0xc'))(new Redis(config[_0xa040('0xd')]));require(_0xa040('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xa040('0xf')]({'port':0x232b});function respondWithRpcPromise(_0xd459cd,_0x8a493,_0x326834,_0x27dff3){return new BPromise(function(_0x2a8e44,_0x4d9cfc){var _0x40457d=_0x27dff3||client;return _0x40457d['request'](_0xd459cd,_0x326834)['then'](function(_0x1498ff){logger[_0xa040('0x10')](_0xa040('0x11'),_0x8a493,_0xa040('0x12'));logger[_0xa040('0x13')](_0xa040('0x14'),_0x8a493,_0xa040('0x12'),JSON['stringify'](_0x1498ff));if(_0x1498ff[_0xa040('0x15')]){if(_0x1498ff[_0xa040('0x15')]['code']===0x1f4){logger[_0xa040('0x15')](_0xa040('0x11'),_0x8a493,_0x1498ff[_0xa040('0x15')]['message']);return _0x4d9cfc(_0x1498ff[_0xa040('0x15')][_0xa040('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x8a493,_0x1498ff[_0xa040('0x15')][_0xa040('0x16')]);return _0x2a8e44(_0x1498ff[_0xa040('0x15')]['message']);}else{logger[_0xa040('0x10')](_0xa040('0x11'),_0x8a493,_0xa040('0x12'));_0x2a8e44(_0x1498ff[_0xa040('0x17')][_0xa040('0x16')]);}})['catch'](function(_0x10fe68){logger['error'](_0xa040('0x11'),_0x8a493,_0x10fe68);_0x4d9cfc(_0x10fe68);});});}function respondWithStatusCode(_0x5c7b37,_0x501f11){_0x501f11=_0x501f11||0xcc;return function(_0x170b45){if(_0x170b45){return _0x5c7b37['sendStatus'](_0x501f11);}return _0x5c7b37[_0xa040('0x18')](_0x501f11)[_0xa040('0x19')]();};}function respondWithResult(_0x1ea864,_0x3f092c){_0x3f092c=_0x3f092c||0xc8;return function(_0x3f6509){if(_0x3f6509){return _0x1ea864[_0xa040('0x18')](_0x3f092c)[_0xa040('0x1a')](_0x3f6509);}};}function respondWithFilteredResult(_0x3748d0,_0x109178){return function(_0x3cb76c){if(_0x3cb76c){var _0x2f93fc=typeof _0x109178[_0xa040('0x1b')]==='undefined'&&typeof _0x109178[_0xa040('0x1c')]===_0xa040('0x1d');var _0x285543=_0x3cb76c[_0xa040('0x1e')];var _0x2299c8=_0x2f93fc?0x0:_0x109178['offset'];var _0x12128a=_0x2f93fc?_0x3cb76c['count']:_0x109178[_0xa040('0x1b')]+_0x109178['limit'];var _0x552a6d;if(_0x12128a>=_0x285543){_0x12128a=_0x285543;_0x552a6d=0xc8;}else{_0x552a6d=0xce;}_0x3748d0[_0xa040('0x18')](_0x552a6d);return _0x3748d0[_0xa040('0x1f')]('Content-Range',_0x2299c8+'-'+_0x12128a+'/'+_0x285543)[_0xa040('0x1a')](_0x3cb76c);}return null;};}function saveUpdates(_0x1c7277){return function(_0xbe3838){if(_0xbe3838){return _0xbe3838[_0xa040('0x20')](_0x1c7277)[_0xa040('0x21')](function(_0x3ddebd){return _0x3ddebd;});}return null;};}function removeEntity(_0x55fff1){return function(_0x2ad45c){if(_0x2ad45c){return _0x2ad45c['destroy']()[_0xa040('0x21')](function(){var _0x3e6735=_0x2ad45c[_0xa040('0x22')]({'plain':!![]});var _0x12d7f4=_0xa040('0x23');return db[_0xa040('0x24')]['destroy']({'where':{'type':_0x12d7f4,'resourceId':_0x3e6735['id']}})['then'](function(){return _0x2ad45c;});})['then'](function(){_0x55fff1[_0xa040('0x18')](0xcc)[_0xa040('0x19')]();});}};}function handleEntityNotFound(_0x516d3f){return function(_0x381d41){if(!_0x381d41){_0x516d3f[_0xa040('0x25')](0x194);}return _0x381d41;};}function handleError(_0x209370,_0x165de0){_0x165de0=_0x165de0||0x1f4;return function(_0x33f731){logger['error'](_0x33f731[_0xa040('0x26')]);if(_0x33f731[_0xa040('0x27')]){delete _0x33f731[_0xa040('0x27')];}_0x209370[_0xa040('0x18')](_0x165de0)[_0xa040('0x28')](_0x33f731);};}exports['index']=function(_0x2d56f1,_0x4374d6){var _0xa61676={'include':[{'model':db['MailServerIn'],'as':_0xa040('0x29')},{'model':db['MailServerOut'],'as':_0xa040('0x2a')},{'model':db['Pause'],'as':_0xa040('0x2b')}]},_0x1212ea={},_0x20cef7={'count':0x0,'rows':[]};var _0x56c1d5=_[_0xa040('0x2c')](db['MailAccount'][_0xa040('0x2d')],function(_0x5c0499){return{'name':_0x5c0499[_0xa040('0x2e')],'type':_0x5c0499[_0xa040('0x2f')][_0xa040('0x30')]};});_0x1212ea[_0xa040('0x31')]=_[_0xa040('0x2c')](_0x56c1d5,_0xa040('0x27'));_0x1212ea[_0xa040('0x32')]=_[_0xa040('0x33')](_0x2d56f1['query']);_0x1212ea[_0xa040('0x34')]=_[_0xa040('0x35')](_0x1212ea[_0xa040('0x31')],_0x1212ea[_0xa040('0x32')]);_0xa61676[_0xa040('0x36')]=_[_0xa040('0x35')](_0x1212ea[_0xa040('0x31')],qs['fields'](_0x2d56f1['query'][_0xa040('0x37')]));_0xa61676[_0xa040('0x36')]=_0xa61676[_0xa040('0x36')][_0xa040('0x38')]?_0xa61676[_0xa040('0x36')]:_0x1212ea['model'];if(!_0x2d56f1[_0xa040('0x32')][_0xa040('0x39')](_0xa040('0x3a'))){_0xa61676['limit']=qs[_0xa040('0x1c')](_0x2d56f1['query']['limit']);_0xa61676['offset']=qs[_0xa040('0x1b')](_0x2d56f1[_0xa040('0x32')][_0xa040('0x1b')]);}_0xa61676['order']=qs['sort'](_0x2d56f1[_0xa040('0x32')][_0xa040('0x3b')]);_0xa61676[_0xa040('0x3c')]=qs[_0xa040('0x34')](_[_0xa040('0x3d')](_0x2d56f1['query'],_0x1212ea['filters']),_0x56c1d5);if(_0x2d56f1[_0xa040('0x32')]['filter']){_0xa61676[_0xa040('0x3c')]=_[_0xa040('0x3e')](_0xa61676[_0xa040('0x3c')],{'$or':_[_0xa040('0x2c')](_0x56c1d5,function(_0x23d378){if(_0x23d378[_0xa040('0x2f')]!=='VIRTUAL'){var _0x166b96={};_0x166b96[_0x23d378[_0xa040('0x27')]]={'$like':'%'+_0x2d56f1['query'][_0xa040('0x3f')]+'%'};return _0x166b96;}})});}_0xa61676=_[_0xa040('0x3e')]({},_0xa61676,_0x2d56f1[_0xa040('0x40')]);var _0x2b3447={'where':_0xa61676[_0xa040('0x3c')]};return db[_0xa040('0x41')][_0xa040('0x1e')](_0x2b3447)[_0xa040('0x21')](function(_0x502e30){_0x20cef7[_0xa040('0x1e')]=_0x502e30;if(_0x2d56f1[_0xa040('0x32')][_0xa040('0x42')]){_0xa61676[_0xa040('0x43')]=[{'all':!![]}];}return db['MailAccount'][_0xa040('0x44')](_0xa61676);})[_0xa040('0x21')](function(_0x2e9909){_0x20cef7[_0xa040('0x45')]=_0x2e9909;return _0x20cef7;})[_0xa040('0x21')](respondWithFilteredResult(_0x4374d6,_0xa61676))[_0xa040('0x46')](handleError(_0x4374d6,null));};exports['show']=function(_0x218420,_0x1d8fc0){var _0x167148={'raw':![],'where':{'id':_0x218420['params']['id']},'include':[{'model':db[_0xa040('0x47')],'as':_0xa040('0x29')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xa040('0x48')],'as':_0xa040('0x2b')}]},_0x100e55={};_0x100e55[_0xa040('0x31')]=_['keys'](db[_0xa040('0x41')]['rawAttributes']);_0x100e55[_0xa040('0x32')]=_['keys'](_0x218420[_0xa040('0x32')]);_0x100e55[_0xa040('0x34')]=_[_0xa040('0x35')](_0x100e55[_0xa040('0x31')],_0x100e55[_0xa040('0x32')]);_0x167148[_0xa040('0x36')]=_[_0xa040('0x35')](_0x100e55[_0xa040('0x31')],qs[_0xa040('0x37')](_0x218420[_0xa040('0x32')][_0xa040('0x37')]));_0x167148[_0xa040('0x36')]=_0x167148[_0xa040('0x36')][_0xa040('0x38')]?_0x167148['attributes']:_0x100e55[_0xa040('0x31')];if(_0x218420['query'][_0xa040('0x42')]){_0x167148[_0xa040('0x43')]=[{'all':!![]}];}_0x167148=_[_0xa040('0x3e')]({},_0x167148,_0x218420[_0xa040('0x40')]);return db[_0xa040('0x41')]['find'](_0x167148)[_0xa040('0x21')](handleEntityNotFound(_0x1d8fc0,null))[_0xa040('0x21')](respondWithResult(_0x1d8fc0,null))[_0xa040('0x46')](handleError(_0x1d8fc0,null));};exports[_0xa040('0x20')]=function(_0x5611a6,_0x52ce51){if(_0x5611a6[_0xa040('0x49')]['id']){delete _0x5611a6[_0xa040('0x49')]['id'];}if(_0x5611a6[_0xa040('0x49')][_0xa040('0x29')]){if(!_0x5611a6[_0xa040('0x49')][_0xa040('0x29')][_0xa040('0x4a')]){_0x5611a6[_0xa040('0x49')][_0xa040('0x29')][_0xa040('0x4b')]=null;}}if(_0x5611a6[_0xa040('0x49')][_0xa040('0x2a')]){if(!_0x5611a6[_0xa040('0x49')]['Smtp'][_0xa040('0x4a')]){_0x5611a6[_0xa040('0x49')][_0xa040('0x2a')][_0xa040('0x4b')]=null;}}return db[_0xa040('0x41')]['find']({'where':{'id':_0x5611a6['params']['id']},'include':[{'model':db[_0xa040('0x47')],'as':'Imap'},{'model':db[_0xa040('0x4c')],'as':'Smtp'},{'model':db[_0xa040('0x48')],'as':_0xa040('0x2b')}]})[_0xa040('0x21')](handleEntityNotFound(_0x52ce51,null))[_0xa040('0x21')](saveUpdates(_0x5611a6[_0xa040('0x49')],null))[_0xa040('0x21')](function(_0x940b4b){if(_0x940b4b&&_0x5611a6[_0xa040('0x49')][_0xa040('0x29')]){return db[_0xa040('0x47')]['update'](_0x5611a6['body'][_0xa040('0x29')],{'where':{'MailAccountId':_0x940b4b['id']}})[_0xa040('0x21')](function(){return _0x940b4b;});}return _0x940b4b;})['then'](function(_0x1d291f){if(_0x1d291f&&_0x5611a6['body']['Smtp']){return db[_0xa040('0x4c')][_0xa040('0x20')](_0x5611a6[_0xa040('0x49')][_0xa040('0x2a')],{'where':{'MailAccountId':_0x1d291f['id']}})['then'](function(){return _0x1d291f;});}return _0x1d291f;})['then'](respondWithResult(_0x52ce51,null))['catch'](handleError(_0x52ce51,null));};exports[_0xa040('0x4d')]=function(_0x3b685c,_0x50e571){return db['MailAccount'][_0xa040('0x4d')]()[_0xa040('0x21')](respondWithResult(_0x50e571,null))[_0xa040('0x46')](handleError(_0x50e571,null));};exports[_0xa040('0x4e')]=function(_0x437d8d,_0xe39632){if(_0x437d8d['body']['id']){delete _0x437d8d[_0xa040('0x49')]['id'];}return db['MailAccount'][_0xa040('0x4f')]({'where':{'id':_0x437d8d['params']['id']}})[_0xa040('0x21')](handleEntityNotFound(_0xe39632,null))['then'](function(_0x1a3b1e){if(_0x1a3b1e){_0x437d8d[_0xa040('0x49')][_0xa040('0x50')]=_0x1a3b1e['id'];return db['Disposition'][_0xa040('0x51')](_0x437d8d[_0xa040('0x49')]);}})[_0xa040('0x21')](respondWithResult(_0xe39632,null))[_0xa040('0x46')](handleError(_0xe39632,null));};exports[_0xa040('0x52')]=function(_0xd115ff,_0x41f0ee){var _0x4131ce={'raw':![],'where':{}};var _0x43e798={};var _0x184af0={'count':0x0,'rows':[]};return db[_0xa040('0x41')][_0xa040('0x53')]({'where':{'id':_0xd115ff[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x41f0ee,null))[_0xa040('0x21')](function(_0x47ab08){if(_0x47ab08){_0x43e798[_0xa040('0x31')]=_['keys'](db[_0xa040('0x55')]['rawAttributes']);_0x43e798[_0xa040('0x32')]=_[_0xa040('0x33')](_0xd115ff[_0xa040('0x32')]);_0x43e798[_0xa040('0x34')]=_[_0xa040('0x35')](_0x43e798['model'],_0x43e798['query']);_0x4131ce[_0xa040('0x36')]=_[_0xa040('0x35')](_0x43e798['model'],qs[_0xa040('0x37')](_0xd115ff[_0xa040('0x32')][_0xa040('0x37')]));_0x4131ce['attributes']=_0x4131ce[_0xa040('0x36')][_0xa040('0x38')]?_0x4131ce[_0xa040('0x36')]:_0x43e798['model'];if(!_0xd115ff[_0xa040('0x32')][_0xa040('0x39')](_0xa040('0x3a'))){_0x4131ce[_0xa040('0x1c')]=qs[_0xa040('0x1c')](_0xd115ff[_0xa040('0x32')][_0xa040('0x1c')]);_0x4131ce[_0xa040('0x1b')]=qs['offset'](_0xd115ff[_0xa040('0x32')]['offset']);}_0x4131ce['order']=qs[_0xa040('0x3b')](_0xd115ff[_0xa040('0x32')][_0xa040('0x3b')]);_0x4131ce[_0xa040('0x3c')]=qs[_0xa040('0x34')](_[_0xa040('0x3d')](_0xd115ff['query'],_0x43e798[_0xa040('0x34')]));_0x4131ce[_0xa040('0x3c')][_0xa040('0x50')]=_0x47ab08['id'];if(_0xd115ff['query'][_0xa040('0x3f')]){_0x4131ce['where']=_[_0xa040('0x3e')](_0x4131ce[_0xa040('0x3c')],{'$or':_[_0xa040('0x2c')](_0x4131ce[_0xa040('0x36')],function(_0x390953){var _0x109dc7={};_0x109dc7[_0x390953]={'$like':'%'+_0xd115ff[_0xa040('0x32')][_0xa040('0x3f')]+'%'};return _0x109dc7;})});}_0x4131ce=_[_0xa040('0x3e')]({},_0x4131ce,_0xd115ff[_0xa040('0x40')]);return db[_0xa040('0x55')]['count']({'where':_0x4131ce[_0xa040('0x3c')]})[_0xa040('0x21')](function(_0x131b7a){_0x184af0['count']=_0x131b7a;if(_0xd115ff[_0xa040('0x32')]['includeAll']){_0x4131ce[_0xa040('0x43')]=[{'all':!![]}];}return db['Disposition'][_0xa040('0x44')](_0x4131ce);})['then'](function(_0x52ac8b){_0x184af0[_0xa040('0x45')]=_0x52ac8b;return _0x184af0;});}})[_0xa040('0x21')](respondWithFilteredResult(_0x41f0ee,_0x4131ce))['catch'](handleError(_0x41f0ee,null));};exports[_0xa040('0x56')]=function(_0x33301e,_0x93c00c){return db[_0xa040('0x41')][_0xa040('0x4f')]({'where':{'id':_0x33301e[_0xa040('0x54')]['id']}})['then'](handleEntityNotFound(_0x93c00c,null))['then'](function(_0x35319d){if(_0x35319d){return _0x35319d[_0xa040('0x56')](_0x33301e['query'][_0xa040('0x57')]);}})[_0xa040('0x21')](respondWithStatusCode(_0x93c00c,null))['catch'](handleError(_0x93c00c,null));};exports[_0xa040('0x58')]=function(_0x50577d,_0x5cf1fc){if(_0x50577d[_0xa040('0x49')]['id']){delete _0x50577d['body']['id'];}return db[_0xa040('0x41')][_0xa040('0x4f')]({'where':{'id':_0x50577d[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x5cf1fc,null))['then'](function(_0x4d0c79){if(_0x4d0c79){_0x50577d['body']['MailAccountId']=_0x4d0c79['id'];return db[_0xa040('0x59')][_0xa040('0x51')](_0x50577d[_0xa040('0x49')]);}})['then'](respondWithResult(_0x5cf1fc,null))['catch'](handleError(_0x5cf1fc,null));};exports[_0xa040('0x5a')]=function(_0x1c1e4c,_0x42d5c0){var _0x2da17c={'raw':![],'where':{}};var _0x79d122={};var _0x2ea269={'count':0x0,'rows':[]};return db['MailAccount'][_0xa040('0x53')]({'where':{'id':_0x1c1e4c[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x42d5c0,null))['then'](function(_0x8b148d){if(_0x8b148d){_0x79d122['model']=_[_0xa040('0x33')](db[_0xa040('0x59')][_0xa040('0x2d')]);_0x79d122[_0xa040('0x32')]=_[_0xa040('0x33')](_0x1c1e4c[_0xa040('0x32')]);_0x79d122[_0xa040('0x34')]=_[_0xa040('0x35')](_0x79d122[_0xa040('0x31')],_0x79d122['query']);_0x2da17c[_0xa040('0x36')]=_[_0xa040('0x35')](_0x79d122['model'],qs[_0xa040('0x37')](_0x1c1e4c[_0xa040('0x32')][_0xa040('0x37')]));_0x2da17c['attributes']=_0x2da17c[_0xa040('0x36')][_0xa040('0x38')]?_0x2da17c[_0xa040('0x36')]:_0x79d122[_0xa040('0x31')];if(!_0x1c1e4c[_0xa040('0x32')][_0xa040('0x39')](_0xa040('0x3a'))){_0x2da17c[_0xa040('0x1c')]=qs['limit'](_0x1c1e4c[_0xa040('0x32')][_0xa040('0x1c')]);_0x2da17c['offset']=qs[_0xa040('0x1b')](_0x1c1e4c[_0xa040('0x32')][_0xa040('0x1b')]);}_0x2da17c[_0xa040('0x5b')]=qs[_0xa040('0x3b')](_0x1c1e4c[_0xa040('0x32')][_0xa040('0x3b')]);_0x2da17c['where']=qs[_0xa040('0x34')](_[_0xa040('0x3d')](_0x1c1e4c[_0xa040('0x32')],_0x79d122[_0xa040('0x34')]));_0x2da17c[_0xa040('0x3c')]['MailAccountId']=_0x8b148d['id'];if(_0x1c1e4c['query'][_0xa040('0x3f')]){_0x2da17c[_0xa040('0x3c')]=_[_0xa040('0x3e')](_0x2da17c[_0xa040('0x3c')],{'$or':_['map'](_0x2da17c[_0xa040('0x36')],function(_0x5ea6eb){var _0x441d93={};_0x441d93[_0x5ea6eb]={'$like':'%'+_0x1c1e4c[_0xa040('0x32')][_0xa040('0x3f')]+'%'};return _0x441d93;})});}_0x2da17c=_[_0xa040('0x3e')]({},_0x2da17c,_0x1c1e4c[_0xa040('0x40')]);return db[_0xa040('0x59')]['count']({'where':_0x2da17c[_0xa040('0x3c')]})[_0xa040('0x21')](function(_0x476a1a){_0x2ea269[_0xa040('0x1e')]=_0x476a1a;if(_0x1c1e4c[_0xa040('0x32')]['includeAll']){_0x2da17c[_0xa040('0x43')]=[{'all':!![]}];}return db[_0xa040('0x59')][_0xa040('0x44')](_0x2da17c);})[_0xa040('0x21')](function(_0x3b8c78){_0x2ea269['rows']=_0x3b8c78;return _0x2ea269;});}})[_0xa040('0x21')](respondWithFilteredResult(_0x42d5c0,_0x2da17c))[_0xa040('0x46')](handleError(_0x42d5c0,null));};exports['removeAnswers']=function(_0x534d16,_0x46d27d){return db[_0xa040('0x41')][_0xa040('0x4f')]({'where':{'id':_0x534d16[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x46d27d,null))[_0xa040('0x21')](function(_0x55afd6){if(_0x55afd6){return _0x55afd6[_0xa040('0x5c')](_0x534d16[_0xa040('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x46d27d,null))[_0xa040('0x46')](handleError(_0x46d27d,null));};exports['create']=function(_0x2dc0a1,_0x41805b){var _0x293b45={'name':_0x2dc0a1[_0xa040('0x49')][_0xa040('0x27')],'key':_0x2dc0a1['body']['key'],'provider':_0x2dc0a1[_0xa040('0x49')][_0xa040('0x5d')]==='custom'?null:_0x2dc0a1['body']['provider'],'email':_0x2dc0a1[_0xa040('0x49')][_0xa040('0x5e')],'ListId':_0x2dc0a1[_0xa040('0x49')][_0xa040('0x5f')],'active':!_[_0xa040('0x60')](_0x2dc0a1[_0xa040('0x49')][_0xa040('0x61')])?_0x2dc0a1[_0xa040('0x49')][_0xa040('0x61')]:!![],'description':_0x2dc0a1[_0xa040('0x49')][_0xa040('0x62')]||null,'Imap':{},'Smtp':{}};if(_0x293b45[_0xa040('0x5d')]){_0x293b45[_0xa040('0x29')]['user']=_0x293b45[_0xa040('0x2a')][_0xa040('0x63')]=_0x2dc0a1[_0xa040('0x49')]['username'];_0x293b45[_0xa040('0x29')][_0xa040('0x64')]=_0x293b45[_0xa040('0x2a')][_0xa040('0x65')]=_0x2dc0a1[_0xa040('0x49')]['password'];if(_0x2dc0a1[_0xa040('0x49')][_0xa040('0x4a')]){_0x293b45['Imap'][_0xa040('0x4a')]=_0x293b45[_0xa040('0x2a')]['modernAuthentication']=!![];_0x293b45[_0xa040('0x29')]['CloudProviderId']=_0x293b45[_0xa040('0x2a')][_0xa040('0x4b')]=_0x2dc0a1['body']['CloudProviderId'];_0x293b45[_0xa040('0x29')][_0xa040('0x64')]=_0x293b45[_0xa040('0x2a')][_0xa040('0x65')]=null;}else{_0x293b45['Imap'][_0xa040('0x4b')]=_0x293b45[_0xa040('0x2a')][_0xa040('0x4b')]=null;}_0x293b45['Imap'][_0xa040('0x66')]=_0x293b45[_0xa040('0x2a')][_0xa040('0x66')]=null;_0x293b45[_0xa040('0x29')][_0xa040('0x67')]=_0x293b45[_0xa040('0x2a')][_0xa040('0x67')]=null;_0x293b45[_0xa040('0x29')][_0xa040('0x68')]=_0x293b45[_0xa040('0x2a')][_0xa040('0x68')]=null;}else{if(_0x2dc0a1[_0xa040('0x49')]['authentication']){_0x293b45[_0xa040('0x29')][_0xa040('0x63')]=_0x293b45[_0xa040('0x2a')]['user']=_0x2dc0a1['body'][_0xa040('0x69')];_0x293b45['Imap'][_0xa040('0x64')]=_0x293b45[_0xa040('0x2a')]['pass']=_0x2dc0a1[_0xa040('0x49')][_0xa040('0x64')];}else{_0x293b45['Imap'][_0xa040('0x6a')]=_0x293b45[_0xa040('0x2a')]['authentication']=![];_0x293b45[_0xa040('0x29')][_0xa040('0x63')]=_0x293b45[_0xa040('0x2a')]['user']=null;_0x293b45[_0xa040('0x29')][_0xa040('0x64')]=_0x293b45[_0xa040('0x2a')][_0xa040('0x65')]=null;}_0x293b45[_0xa040('0x29')][_0xa040('0x67')]=_0x2dc0a1[_0xa040('0x49')][_0xa040('0x29')]['host'];_0x293b45[_0xa040('0x29')][_0xa040('0x68')]=_0x2dc0a1[_0xa040('0x49')][_0xa040('0x29')][_0xa040('0x68')];_0x293b45[_0xa040('0x2a')][_0xa040('0x67')]=_0x2dc0a1[_0xa040('0x49')][_0xa040('0x2a')][_0xa040('0x67')];_0x293b45[_0xa040('0x2a')][_0xa040('0x68')]=_0x2dc0a1['body'][_0xa040('0x2a')]['port'];}return db[_0xa040('0x41')][_0xa040('0x51')](_0x293b45,{'include':[{'model':db['MailServerOut'],'as':_0xa040('0x2a')},{'model':db['MailServerIn'],'as':_0xa040('0x29')}]})[_0xa040('0x21')](function(_0x25dac3){var _0x577263=_0x2dc0a1[_0xa040('0x63')][_0xa040('0x22')]({'plain':!![]});if(!_0x577263)throw new Error(_0xa040('0x6b'));if(_0x577263[_0xa040('0x6c')]===_0xa040('0x63')){var _0x3c91ce=_0x25dac3[_0xa040('0x22')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xa040('0x23'),'userProfileId':_0x577263['userProfileId']},'raw':!![]})[_0xa040('0x21')](function(_0x5ef810){if(_0x5ef810&&_0x5ef810[_0xa040('0x6d')]===0x0){return db[_0xa040('0x24')][_0xa040('0x51')]({'name':_0x3c91ce[_0xa040('0x27')],'resourceId':_0x3c91ce['id'],'type':_0x5ef810['name'],'sectionId':_0x5ef810['id']},{})[_0xa040('0x21')](function(){return _0x25dac3;});}else{return _0x25dac3;}})[_0xa040('0x46')](function(_0x19fa75){logger[_0xa040('0x15')](_0xa040('0x6e'),_0x19fa75);throw _0x19fa75;});}return _0x25dac3;})['then'](respondWithResult(_0x41805b,0xc9))['catch'](handleError(_0x41805b,null));};exports[_0xa040('0x6f')]=function(_0x2b03cc,_0x110035){return db['MailAccount'][_0xa040('0x53')]({'where':{'id':_0x2b03cc['params']['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x110035,null))['then'](function(_0x16adc7){if(_0x16adc7){return _0x16adc7['getImap']();}return null;})[_0xa040('0x21')](respondWithResult(_0x110035,null))['catch'](handleError(_0x110035,null));};exports[_0xa040('0x70')]=function(_0x425953,_0x4babdd){if(_0x425953[_0xa040('0x49')]['id']){delete _0x425953[_0xa040('0x49')]['id'];}return db['MailAccount'][_0xa040('0x4f')]({'where':{'id':_0x425953[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x4babdd,null))[_0xa040('0x21')](function(_0x3cd1ce){if(_0x3cd1ce){_0x425953['body']['MailAccountId']=_0x3cd1ce['id'];return db[_0xa040('0x47')][_0xa040('0x51')](_0x425953[_0xa040('0x49')]);}})[_0xa040('0x21')](respondWithResult(_0x4babdd,null))[_0xa040('0x46')](handleError(_0x4babdd,null));};exports['removeImap']=function(_0x2aa357,_0x2a4315){return db[_0xa040('0x41')][_0xa040('0x53')]({'where':{'id':_0x2aa357[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x2a4315,null))[_0xa040('0x21')](function(_0x1db193){if(_0x1db193){return _0x1db193['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x2a4315,null))[_0xa040('0x46')](handleError(_0x2a4315,null));};exports['getSmtp']=function(_0x3b8014,_0x1c74e8){return db[_0xa040('0x41')][_0xa040('0x53')]({'where':{'id':_0x3b8014[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x1c74e8,null))[_0xa040('0x21')](function(_0x3a1d9b){if(_0x3a1d9b){return _0x3a1d9b['getSmtp']();}return null;})[_0xa040('0x21')](respondWithResult(_0x1c74e8,null))[_0xa040('0x46')](handleError(_0x1c74e8,null));};exports['addSmtp']=function(_0x30c18d,_0x470242){if(_0x30c18d[_0xa040('0x49')]['id']){delete _0x30c18d[_0xa040('0x49')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x30c18d[_0xa040('0x54')]['id']}})['then'](handleEntityNotFound(_0x470242,null))['then'](function(_0x5dfcf8){if(_0x5dfcf8){_0x30c18d[_0xa040('0x49')]['MailAccountId']=_0x5dfcf8['id'];return db[_0xa040('0x4c')][_0xa040('0x51')](_0x30c18d[_0xa040('0x49')]);}})[_0xa040('0x21')](respondWithResult(_0x470242,null))[_0xa040('0x46')](handleError(_0x470242,null));};exports[_0xa040('0x71')]=function(_0x1d79e8,_0x17138e){return db[_0xa040('0x41')]['findOne']({'where':{'id':_0x1d79e8[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x17138e,null))['then'](function(_0x1b51a1){if(_0x1b51a1){return _0x1b51a1[_0xa040('0x72')](null);}return null;})[_0xa040('0x21')](respondWithStatusCode(_0x17138e,null))[_0xa040('0x46')](handleError(_0x17138e,null));};exports['addInteraction']=function(_0x134d6b,_0x4f628c){return db[_0xa040('0x73')]['find']({'where':{'id':_0x134d6b[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x4f628c,null))['then'](function(_0x57d65a){if(_0x57d65a){return _0x57d65a[_0xa040('0x74')](_0x134d6b[_0xa040('0x49')][_0xa040('0x57')],_[_0xa040('0x75')](_0x134d6b[_0xa040('0x49')],[_0xa040('0x57'),'id'])||{});}})[_0xa040('0x21')](respondWithResult(_0x4f628c,null))[_0xa040('0x46')](handleError(_0x4f628c,null));};exports[_0xa040('0x76')]=function(_0x4ff3f3,_0x37762c){var _0x1bf925={'raw':![],'where':{}};var _0x55c3ba={};var _0x1ef596={'count':0x0,'rows':[]};return db[_0xa040('0x41')][_0xa040('0x53')]({'where':{'id':_0x4ff3f3['params']['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x37762c,null))['then'](function(_0x3a22cb){if(_0x3a22cb){_0x55c3ba[_0xa040('0x31')]=_[_0xa040('0x33')](db[_0xa040('0x73')][_0xa040('0x2d')]);_0x55c3ba[_0xa040('0x32')]=_['keys'](_0x4ff3f3['query']);_0x55c3ba['filters']=_[_0xa040('0x35')](_0x55c3ba[_0xa040('0x31')],_0x55c3ba['query']);_0x1bf925['attributes']=_['intersection'](_0x55c3ba[_0xa040('0x31')],qs['fields'](_0x4ff3f3['query'][_0xa040('0x37')]));_0x1bf925['attributes']=_0x1bf925['attributes'][_0xa040('0x38')]?_0x1bf925[_0xa040('0x36')]:_0x55c3ba['model'];if(!_0x4ff3f3[_0xa040('0x32')][_0xa040('0x39')](_0xa040('0x3a'))){_0x1bf925[_0xa040('0x1c')]=qs[_0xa040('0x1c')](_0x4ff3f3[_0xa040('0x32')][_0xa040('0x1c')]);_0x1bf925[_0xa040('0x1b')]=qs['offset'](_0x4ff3f3[_0xa040('0x32')][_0xa040('0x1b')]);}_0x1bf925[_0xa040('0x5b')]=qs[_0xa040('0x3b')](_0x4ff3f3['query'][_0xa040('0x3b')]);_0x1bf925[_0xa040('0x3c')]=qs[_0xa040('0x34')](_[_0xa040('0x3d')](_0x4ff3f3[_0xa040('0x32')],_0x55c3ba[_0xa040('0x34')]));_0x1bf925[_0xa040('0x3c')][_0xa040('0x50')]=_0x3a22cb['id'];if(_0x4ff3f3[_0xa040('0x32')][_0xa040('0x3f')]){_0x1bf925[_0xa040('0x3c')]=_[_0xa040('0x3e')](_0x1bf925['where'],{'$or':_[_0xa040('0x2c')](_0x1bf925[_0xa040('0x36')],function(_0x581198){var _0x1e7c21={};_0x1e7c21[_0x581198]={'$like':'%'+_0x4ff3f3[_0xa040('0x32')][_0xa040('0x3f')]+'%'};return _0x1e7c21;})});}_0x1bf925=_[_0xa040('0x3e')]({},_0x1bf925,_0x4ff3f3[_0xa040('0x40')]);return db[_0xa040('0x73')][_0xa040('0x1e')]({'where':_0x1bf925[_0xa040('0x3c')]})[_0xa040('0x21')](function(_0x3fad69){_0x1ef596['count']=_0x3fad69;if(_0x4ff3f3['query']['includeAll']){_0x1bf925[_0xa040('0x43')]=[{'model':db[_0xa040('0x77')],'as':_0xa040('0x78'),'required':![]},{'model':db[_0xa040('0x79')],'as':_0xa040('0x7a'),'attributes':[_0xa040('0x27'),'fullname',_0xa040('0x7b')],'required':![]},{'model':db[_0xa040('0x7c')],'as':_0xa040('0x7d'),'attributes':['id','name','color'],'where':_0x4ff3f3[_0xa040('0x32')][_0xa040('0x7e')]?{'id':_0x4ff3f3[_0xa040('0x32')][_0xa040('0x7e')]}:undefined,'required':_0x4ff3f3[_0xa040('0x32')][_0xa040('0x7e')]?!![]:![]}];}return db[_0xa040('0x73')]['findAll'](_0x1bf925);})[_0xa040('0x21')](function(_0x1281ec){_0x1ef596[_0xa040('0x45')]=_0x1281ec;return _0x1ef596;});}})[_0xa040('0x21')](respondWithFilteredResult(_0x37762c,_0x1bf925))['catch'](handleError(_0x37762c,null));};exports[_0xa040('0x7f')]=function addApplications(_0x4998a4,_0x32700e){var _0x3de7f0=_0x4998a4[_0xa040('0x54')]['id'];var _0xa8691e=_0x4998a4['body'];var _0x486794=0xc8;var _0x41242f=null;return db[_0xa040('0x80')][_0xa040('0x81')]({'isolationLevel':db[_0xa040('0x80')][_0xa040('0x82')][_0xa040('0x83')][_0xa040('0x84')]},function(_0x36ee9d){return db['MailAccount'][_0xa040('0x53')]({'where':{'id':_0x3de7f0},'transaction':_0x36ee9d})[_0xa040('0x21')](function(_0x22a725){if(_0x22a725){return db[_0xa040('0x85')]['destroy']({'where':{'MailAccountId':_0x3de7f0},'transaction':_0x36ee9d})[_0xa040('0x21')](function(){var _0x1041eb=_[_0xa040('0x2c')](_0xa8691e,function(_0x3e72ef){_0x3e72ef[_0xa040('0x50')]=_0x3de7f0;return _0x3e72ef;});return db[_0xa040('0x85')][_0xa040('0x86')](_0x1041eb,{'transaction':_0x36ee9d});});}else{_0x486794=0x194;_0x41242f=[];}});})[_0xa040('0x21')](function(){if(_0x486794!==0x194){return db[_0xa040('0x85')]['findAndCountAll']({'where':{'MailAccountId':_0x3de7f0},'order':_0xa040('0x87')})['then'](function(_0x35e48a){_0x41242f=_0x35e48a;});}})[_0xa040('0x46')](function(_0x4ebfd4){_0x486794=0x1f4;logger[_0xa040('0x15')](_0x4ebfd4[_0xa040('0x26')]);if(_0x4ebfd4['name']){delete _0x4ebfd4[_0xa040('0x27')];}_0x41242f=_0x4ebfd4;})[_0xa040('0x88')](function(){if(_0x41242f===null){_0x32700e['sendStatus'](_0x486794);}else{if(_0x486794===0x1f4){_0x32700e[_0xa040('0x18')](_0x486794)['send'](_0x41242f);}else{_0x32700e[_0xa040('0x18')](_0x486794)[_0xa040('0x1a')](_0x41242f);}}});};exports[_0xa040('0x89')]=function(_0x374529,_0x12960f){var _0x5958b7={};var _0x68495f={};var _0x6d695c;var _0x2db19f;return db[_0xa040('0x41')][_0xa040('0x53')]({'where':{'id':_0x374529['params']['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x12960f,null))[_0xa040('0x21')](function(_0x3d15a5){if(_0x3d15a5){_0x6d695c=_0x3d15a5;_0x68495f[_0xa040('0x31')]=_['keys'](db['MailApplication']['rawAttributes']);_0x68495f[_0xa040('0x32')]=_[_0xa040('0x33')](_0x374529[_0xa040('0x32')]);_0x68495f[_0xa040('0x34')]=_[_0xa040('0x35')](_0x68495f[_0xa040('0x31')],_0x68495f[_0xa040('0x32')]);_0x5958b7[_0xa040('0x36')]=_[_0xa040('0x35')](_0x68495f[_0xa040('0x31')],qs[_0xa040('0x37')](_0x374529[_0xa040('0x32')][_0xa040('0x37')]));_0x5958b7['attributes']=_0x5958b7['attributes'][_0xa040('0x38')]?_0x5958b7[_0xa040('0x36')]:_0x68495f['model'];_0x5958b7[_0xa040('0x5b')]=qs[_0xa040('0x3b')](_0x374529['query']['sort']);_0x5958b7[_0xa040('0x3c')]=qs[_0xa040('0x34')](_[_0xa040('0x3d')](_0x374529[_0xa040('0x32')],_0x68495f[_0xa040('0x34')]));if(_0x374529[_0xa040('0x32')][_0xa040('0x3f')]){_0x5958b7[_0xa040('0x3c')]=_[_0xa040('0x3e')](_0x5958b7[_0xa040('0x3c')],{'$or':_[_0xa040('0x2c')](_0x5958b7[_0xa040('0x36')],function(_0x5ea7cf){var _0x39cc79={};_0x39cc79[_0x5ea7cf]={'$like':'%'+_0x374529[_0xa040('0x32')][_0xa040('0x3f')]+'%'};return _0x39cc79;})});}_0x5958b7=_[_0xa040('0x3e')]({},_0x5958b7,_0x374529[_0xa040('0x40')]);return _0x6d695c['getApplications'](_0x5958b7);}})[_0xa040('0x21')](function(_0x299f1c){if(_0x299f1c){_0x2db19f=_0x299f1c[_0xa040('0x38')];if(!_0x374529[_0xa040('0x32')]['hasOwnProperty'](_0xa040('0x3a'))){_0x5958b7[_0xa040('0x1c')]=qs[_0xa040('0x1c')](_0x374529[_0xa040('0x32')][_0xa040('0x1c')]);_0x5958b7[_0xa040('0x1b')]=qs[_0xa040('0x1b')](_0x374529['query'][_0xa040('0x1b')]);}return _0x6d695c[_0xa040('0x89')](_0x5958b7);}})[_0xa040('0x21')](function(_0x5814c0){if(_0x5814c0){return _0x5814c0?{'count':_0x2db19f,'rows':_0x5814c0}:null;}})['then'](respondWithResult(_0x12960f,null))[_0xa040('0x46')](handleError(_0x12960f,null));};exports[_0xa040('0x8a')]=function(_0x348411,_0x477a66){var _0x53d05c={'raw':!![],'where':{}};var _0x2c7a95={};var _0xfb4ac6={'count':0x0,'rows':[]};return db[_0xa040('0x41')][_0xa040('0x53')]({'where':{'id':_0x348411['params']['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x477a66,null))[_0xa040('0x21')](function(_0x493b14){if(_0x493b14){_0x2c7a95[_0xa040('0x31')]=_['keys'](db[_0xa040('0x8b')][_0xa040('0x2d')]);_0x2c7a95[_0xa040('0x32')]=_['keys'](_0x348411[_0xa040('0x32')]);_0x2c7a95['filters']=_[_0xa040('0x35')](_0x2c7a95[_0xa040('0x31')],_0x2c7a95[_0xa040('0x32')]);_0x53d05c['attributes']=_[_0xa040('0x35')](_0x2c7a95[_0xa040('0x31')],qs[_0xa040('0x37')](_0x348411[_0xa040('0x32')]['fields']));_0x53d05c[_0xa040('0x36')]=_0x53d05c[_0xa040('0x36')]['length']?_0x53d05c[_0xa040('0x36')]:_0x2c7a95['model'];if(!_0x348411[_0xa040('0x32')][_0xa040('0x39')]('nolimit')){_0x53d05c[_0xa040('0x1c')]=qs['limit'](_0x348411['query'][_0xa040('0x1c')]);_0x53d05c[_0xa040('0x1b')]=qs[_0xa040('0x1b')](_0x348411[_0xa040('0x32')][_0xa040('0x1b')]);}_0x53d05c[_0xa040('0x5b')]=qs[_0xa040('0x3b')](_0x348411[_0xa040('0x32')]['sort']);_0x53d05c[_0xa040('0x3c')]=qs[_0xa040('0x34')](_['pick'](_0x348411['query'],_0x2c7a95[_0xa040('0x34')]));_0x53d05c[_0xa040('0x3c')][_0xa040('0x50')]=_0x493b14['id'];if(_0x348411[_0xa040('0x32')][_0xa040('0x3f')]){_0x53d05c[_0xa040('0x3c')]=_[_0xa040('0x3e')](_0x53d05c[_0xa040('0x3c')],{'$or':_[_0xa040('0x2c')](_0x53d05c['attributes'],function(_0x1404ed){var _0x3caa53={};_0x3caa53[_0x1404ed]={'$like':'%'+_0x348411['query'][_0xa040('0x3f')]+'%'};return _0x3caa53;})});}if(_0x348411[_0xa040('0x32')][_0xa040('0x8c')]){var _0xd75042=_0x348411[_0xa040('0x32')][_0xa040('0x8c')]['split'](',');var _0x2896bf={};_0x2896bf[_0xd75042[0x0]]={'$gte':moment(_0xd75042[0x1])[_0xa040('0x8d')](_0xa040('0x8e'))};_0x53d05c[_0xa040('0x3c')]=_[_0xa040('0x3e')](_0x53d05c['where'],_0x2896bf);}_0x53d05c=_[_0xa040('0x3e')]({},_0x53d05c,_0x348411[_0xa040('0x40')]);return db['MailMessage'][_0xa040('0x1e')]({'where':_0x53d05c['where']})[_0xa040('0x21')](function(_0x19cbf6){_0xfb4ac6[_0xa040('0x1e')]=_0x19cbf6;if(_0x348411['query']['includeAll']){_0x53d05c['include']=[{'all':!![]}];}return db['MailMessage'][_0xa040('0x44')](_0x53d05c);})[_0xa040('0x21')](function(_0x4a0a35){if(_0x348411['query']['inlineCss']===_0xa040('0x8f')){for(var _0x4b0851=0x0;_0x4b0851<_0x4a0a35['length'];_0x4b0851++){_0x4a0a35[_0x4b0851][_0xa040('0x49')]=juice(_0x4a0a35[_0x4b0851][_0xa040('0x49')]);}}_0xfb4ac6[_0xa040('0x45')]=_0x4a0a35;return _0xfb4ac6;});}})[_0xa040('0x21')](respondWithFilteredResult(_0x477a66,_0x53d05c))['catch'](handleError(_0x477a66,null));};exports[_0xa040('0x28')]=function(_0x6744e1,_0x568474){var _0x6e54b9,_0xd0e4da={},_0x119e2f;if(_0x6744e1[_0xa040('0x49')]['to']){_0x119e2f=_0x6744e1[_0xa040('0x49')]['to'][_0xa040('0x90')](',')[0x0];}return db[_0xa040('0x41')][_0xa040('0x4f')]({'where':{'id':_0x6744e1[_0xa040('0x54')]['id']},'include':[{'model':db[_0xa040('0x91')],'as':_0xa040('0x92'),'include':[{'model':db[_0xa040('0x77')],'as':_0xa040('0x93'),'where':{'email':_0x119e2f},'limit':0x1,'order':[[_0xa040('0x94'),_0xa040('0x95')]]}]},{'model':db[_0xa040('0x4c')],'as':_0xa040('0x2a'),'raw':!![]}]})[_0xa040('0x21')](handleEntityNotFound(_0x568474,null))[_0xa040('0x21')](function(_0x90ee8){if(_0x90ee8){_0x6e54b9=_0x90ee8;if(_0x90ee8[_0xa040('0x2a')]){if(_[_0xa040('0x60')](_0x6744e1[_0xa040('0x49')][_0xa040('0x96')])){_0x6744e1[_0xa040('0x49')][_0xa040('0x96')]=util['format'](_0xa040('0x97'),_0x90ee8[_0xa040('0x27')],_0x90ee8['email']||_0x90ee8[_0xa040('0x2a')]['user']);}if(_0x6744e1[_0xa040('0x49')]['attachments']&&_0x6744e1[_0xa040('0x49')]['attachments'][_0xa040('0x38')]){for(var _0x4fd1f1=0x0;_0x4fd1f1<_0x6744e1[_0xa040('0x49')][_0xa040('0x98')]['length'];_0x4fd1f1+=0x1){_0x6744e1['body'][_0xa040('0x98')][_0x4fd1f1]={'filename':_0x6744e1[_0xa040('0x49')][_0xa040('0x98')][_0x4fd1f1][_0xa040('0x27')],'path':path['join'](config[_0xa040('0x99')],_0xa040('0x9a'),_0x6744e1[_0xa040('0x49')][_0xa040('0x98')][_0x4fd1f1][_0xa040('0x9b')])};}}var _0x36d485={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x90ee8[_0xa040('0x2a')][_0xa040('0x66')])){if(_0x90ee8[_0xa040('0x2a')][_0xa040('0x6a')]){_0x36d485[_0xa040('0x9c')]={'user':_0x90ee8['Smtp'][_0xa040('0x63')],'pass':_0x90ee8['Smtp'][_0xa040('0x65')]};}_0x36d485[_0xa040('0x67')]=_0x90ee8[_0xa040('0x2a')]['host'];_0x36d485[_0xa040('0x68')]=_0x90ee8['Smtp'][_0xa040('0x68')];_0x36d485[_0xa040('0x9d')]=_0x90ee8[_0xa040('0x2a')][_0xa040('0x9d')];}else{_0x36d485[_0xa040('0x66')]=_0x90ee8['Smtp']['service'];_0x36d485[_0xa040('0x9c')]={'user':_0x90ee8[_0xa040('0x2a')]['user'],'pass':_0x90ee8['Smtp'][_0xa040('0x65')]};}return respondWithRpcPromise(_0xa040('0x9e'),_0xa040('0x9f'),{'account':_0x36d485,'message':_0x6744e1[_0xa040('0x49')]});}else{throw new Error('List\x20not\x20found');}}})[_0xa040('0x21')](function(_0x761069){if(_0x761069){_0xd0e4da=_0x761069;if(_0x6e54b9[_0xa040('0x92')]){if(_0x6e54b9[_0xa040('0x92')][_0xa040('0x93')][_0xa040('0x38')]){return _0x6e54b9[_0xa040('0x92')]['Contacts'][0x0];}else{return db[_0xa040('0x77')][_0xa040('0x51')](_[_0xa040('0xb')](_0x6744e1['body'],{'firstName':_0x6744e1[_0xa040('0x49')]['to'],'email':_0x6744e1[_0xa040('0x49')]['to'],'phone':_0x6744e1[_0xa040('0x49')]['to'],'ListId':_0x6e54b9[_0xa040('0x5f')]}));}}else{throw new Error(_0xa040('0xa0'));}}})[_0xa040('0x21')](function(_0x55f5cc){if(_0x55f5cc){var _0x397d96={'UserId':_0x6744e1[_0xa040('0x63')]['id'],'ContactId':_0x55f5cc['id'],'MailAccountId':_0x6e54b9['id'],'inReplyTo':_0xd0e4da[_0xa040('0xa1')],'to':_0x6744e1[_0xa040('0x49')][_0xa040('0x96')],'cc':_0x6744e1[_0xa040('0x49')]['cc'],'subject':_0x6744e1[_0xa040('0x49')]['subject'],'attach':_0x6744e1[_0xa040('0x49')][_0xa040('0xa2')],'firstMsgDirection':_0xa040('0xa3'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xa040('0xa3'),'Messages':[_[_0xa040('0x3e')](_0x6744e1['body'],{'messageId':_0xd0e4da['messageId'],'sentAt':moment()[_0xa040('0x8d')](_0xa040('0x8e')),'read':!![],'MailAccountId':_0x6e54b9['id'],'UserId':_0x6744e1['user']['id'],'ContactId':_0x55f5cc['id']})]};if(_0x6744e1['body'][_0xa040('0xa4')]){_0x397d96=_['merge'](_0x397d96,_0x6744e1['body'][_0xa040('0xa4')]);}return db[_0xa040('0x73')][_0xa040('0x51')](_0x397d96,{'include':[{'model':db[_0xa040('0x8b')],'as':_0xa040('0xa5')}]});}})['then'](respondWithResult(_0x568474,null))[_0xa040('0x46')](handleError(_0x568474,null));};exports['verifySmtp']=function(_0x56cfe6,_0x35ff37){return db[_0xa040('0x41')][_0xa040('0x4f')]({'where':{'id':_0x56cfe6[_0xa040('0x54')]['id']},'include':[{'model':db[_0xa040('0x4c')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa040('0xa6'),'raw':!![]}]}]})[_0xa040('0x21')](handleEntityNotFound(_0x35ff37,null))[_0xa040('0x21')](function(_0x4e80b3){if(!_0x4e80b3[_0xa040('0x2a')])return;var _0x5e38e8={'id':_0x4e80b3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4e80b3[_0xa040('0x5d')]!==_0xa040('0xa7')){_0x5e38e8[_0xa040('0x66')]=_0x4e80b3[_0xa040('0x5d')];}else{_0x5e38e8['host']=_0x4e80b3[_0xa040('0x2a')][_0xa040('0x67')];_0x5e38e8[_0xa040('0x68')]=_0x4e80b3[_0xa040('0x2a')]['port'];_0x5e38e8[_0xa040('0x9d')]=_0x4e80b3['Smtp'][_0xa040('0x9d')];}if(_0x4e80b3[_0xa040('0x2a')][_0xa040('0x6a')]){if(_0x4e80b3[_0xa040('0x2a')]['modernAuthentication']){_0x5e38e8[_0xa040('0x9c')]={'type':_0xa040('0xa8'),'user':_0x4e80b3[_0xa040('0x2a')][_0xa040('0x63')],'accessToken':_0x4e80b3['Smtp']['CloudProvider']['data5']};}else{_0x5e38e8['auth']={'user':_0x4e80b3[_0xa040('0x2a')][_0xa040('0x63')],'pass':_0x4e80b3[_0xa040('0x2a')][_0xa040('0x65')]};}}return respondWithRpcPromise(_0xa040('0xa9'),'verifySmtp',{'account':_0x5e38e8});})['then'](respondWithResult(_0x35ff37,null))['catch'](handleError(_0x35ff37,null));};exports[_0xa040('0xaa')]=function(_0x5db5b5,_0x1d893b){return db['MailAccount'][_0xa040('0x4f')]({'where':{'id':_0x5db5b5[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x1d893b,null))[_0xa040('0x21')](function(_0x81e595){if(_0x81e595&&_0x81e595[_0xa040('0x66')]){throw new db[(_0xa040('0xab'))][(_0xa040('0xac'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x81e595;})[_0xa040('0x21')](removeEntity(_0x1d893b,null))[_0xa040('0x46')](handleError(_0x1d893b,null));};exports[_0xa040('0xad')]=function(_0x546884,_0x340864){return db[_0xa040('0x41')][_0xa040('0x4f')]({'where':{'id':_0x546884[_0xa040('0x54')]['id']}})['then'](handleEntityNotFound(_0x340864,null))[_0xa040('0x21')](function(_0x51a245){if(_0x51a245){return _0x51a245[_0xa040('0xad')](_0x546884[_0xa040('0x49')]['ids'],_[_0xa040('0x75')](_0x546884[_0xa040('0x49')],[_0xa040('0x57'),'id'])||{})['spread'](function(_0x276e8){for(var _0x2c7d19=0x0;_0x2c7d19<_0x546884[_0xa040('0x49')][_0xa040('0x57')]['length'];_0x2c7d19+=0x1){socket['emit'](_0xa040('0xae'),{'UserId':Number(_0x546884['body'][_0xa040('0x57')][_0x2c7d19]),'MailAccountId':Number(_0x546884[_0xa040('0x54')]['id'])});}return _0x276e8;});}})[_0xa040('0x21')](respondWithResult(_0x340864,null))[_0xa040('0x46')](handleError(_0x340864,null));};exports[_0xa040('0xaf')]=function(_0x3a3b46,_0x3f2207){return db['MailAccount'][_0xa040('0x4f')]({'where':{'id':_0x3a3b46[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x3f2207,null))[_0xa040('0x21')](function(_0x1bc3f0){if(_0x1bc3f0){return _0x1bc3f0['removeAgents'](_0x3a3b46['query']['ids'])[_0xa040('0x21')](function(){if(_[_0xa040('0xb0')](_0x3a3b46['query'][_0xa040('0x57')])){for(var _0x2d19d1=0x0;_0x2d19d1<_0x3a3b46[_0xa040('0x32')]['ids'][_0xa040('0x38')];_0x2d19d1+=0x1){socket[_0xa040('0xb1')](_0xa040('0xb2'),{'UserId':Number(_0x3a3b46['query'][_0xa040('0x57')][_0x2d19d1]),'MailAccountId':Number(_0x3a3b46[_0xa040('0x54')]['id'])});}}else{socket[_0xa040('0xb1')]('userMailAccount:remove',{'UserId':Number(_0x3a3b46[_0xa040('0x32')]['ids']),'MailAccountId':Number(_0x3a3b46[_0xa040('0x54')]['id'])});}});}})[_0xa040('0x21')](respondWithStatusCode(_0x3f2207,null))[_0xa040('0x46')](handleError(_0x3f2207,null));};exports[_0xa040('0xb3')]=function(_0x286971,_0x1572af){var _0x1dae68={};var _0x49cd39={};var _0x506faa;var _0x2c8c30;return db[_0xa040('0x41')]['findOne']({'where':{'id':_0x286971[_0xa040('0x54')]['id']}})[_0xa040('0x21')](handleEntityNotFound(_0x1572af,null))[_0xa040('0x21')](function(_0x4a78f6){if(_0x4a78f6){_0x506faa=_0x4a78f6;_0x49cd39['model']=_['keys'](db[_0xa040('0x79')]['rawAttributes']);_0x49cd39[_0xa040('0x32')]=_[_0xa040('0x33')](_0x286971[_0xa040('0x32')]);_0x49cd39[_0xa040('0x34')]=_[_0xa040('0x35')](_0x49cd39[_0xa040('0x31')],_0x49cd39[_0xa040('0x32')]);_0x1dae68[_0xa040('0x36')]=_['intersection'](_0x49cd39[_0xa040('0x31')],qs['fields'](_0x286971[_0xa040('0x32')][_0xa040('0x37')]));_0x1dae68[_0xa040('0x36')]=_0x1dae68[_0xa040('0x36')][_0xa040('0x38')]?_0x1dae68[_0xa040('0x36')]:_0x49cd39[_0xa040('0x31')];_0x1dae68[_0xa040('0x5b')]=qs['sort'](_0x286971['query']['sort']);_0x1dae68[_0xa040('0x3c')]=qs[_0xa040('0x34')](_[_0xa040('0x3d')](_0x286971[_0xa040('0x32')],_0x49cd39['filters']));if(_0x286971[_0xa040('0x32')][_0xa040('0x3f')]){_0x1dae68[_0xa040('0x3c')]=_[_0xa040('0x3e')](_0x1dae68[_0xa040('0x3c')],{'$or':_[_0xa040('0x2c')](_0x1dae68[_0xa040('0x36')],function(_0x53e1b3){var _0x40d4f4={};_0x40d4f4[_0x53e1b3]={'$like':'%'+_0x286971[_0xa040('0x32')][_0xa040('0x3f')]+'%'};return _0x40d4f4;})});}_0x1dae68=_[_0xa040('0x3e')]({},_0x1dae68,_0x286971[_0xa040('0x40')]);return _0x506faa[_0xa040('0xb3')](_0x1dae68);}})[_0xa040('0x21')](function(_0x44e5d8){if(_0x44e5d8){_0x2c8c30=_0x44e5d8[_0xa040('0x38')];if(!_0x286971['query'][_0xa040('0x39')](_0xa040('0x3a'))){_0x1dae68['limit']=qs['limit'](_0x286971[_0xa040('0x32')][_0xa040('0x1c')]);_0x1dae68[_0xa040('0x1b')]=qs[_0xa040('0x1b')](_0x286971[_0xa040('0x32')][_0xa040('0x1b')]);}return _0x506faa[_0xa040('0xb3')](_0x1dae68);}})[_0xa040('0x21')](function(_0x5c2956){if(_0x5c2956){return _0x5c2956?{'count':_0x2c8c30,'rows':_0x5c2956}:null;}})[_0xa040('0x21')](respondWithResult(_0x1572af,null))[_0xa040('0x46')](handleError(_0x1572af,null));}; \ No newline at end of file +var _0xc87d=['name','send','index','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','MailServerIn','keys','options','find','update','body','CloudProviderId','modernAuthentication','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','order','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','findOne','nolimit','removeAnswers','provider','custom','email','ListId','isNil','active','description','user','username','pass','password','service','host','port','authentication','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','fullname','Tag','Tags','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','List\x20not\x20found','List','subject','attach','out','messageId','Interaction','verifySmtp','CloudProvider','OAuth2','data5','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','undefined','limit','offset','count','Content-Range','json','destroy','get','UserProfileResource','end','stack'];(function(_0x59fc7c,_0x1146f2){var _0x2653ff=function(_0x4e4d5f){while(--_0x4e4d5f){_0x59fc7c['push'](_0x59fc7c['shift']());}};_0x2653ff(++_0x1146f2);}(_0xc87d,0x94));var _0xdc87=function(_0x123c5e,_0x430bcf){_0x123c5e=_0x123c5e-0x0;var _0x2ffbfa=_0xc87d[_0x123c5e];return _0x2ffbfa;};'use strict';var moment=require(_0xdc87('0x0'));var BPromise=require('bluebird');var util=require(_0xdc87('0x1'));var path=require(_0xdc87('0x2'));var _=require(_0xdc87('0x3'));var juice=require(_0xdc87('0x4'));var Redis=require(_0xdc87('0x5'));var qs=require(_0xdc87('0x6'));var logger=require(_0xdc87('0x7'))(_0xdc87('0x8'));var config=require(_0xdc87('0x9'));var db=require(_0xdc87('0xa'))['db'];config[_0xdc87('0xb')]=_[_0xdc87('0xc')](config[_0xdc87('0xb')],{'host':_0xdc87('0xd'),'port':0x18eb});var socket=require(_0xdc87('0xe'))(new Redis(config[_0xdc87('0xb')]));require(_0xdc87('0xf'))[_0xdc87('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdc87('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x33abd9,_0x38370f,_0xefae6a,_0x58020d){return new BPromise(function(_0x3d6ade,_0xa0de32){var _0x1be9ee=_0x58020d||client;return _0x1be9ee[_0xdc87('0x12')](_0x33abd9,_0xefae6a)[_0xdc87('0x13')](function(_0x7b225b){logger[_0xdc87('0x14')](_0xdc87('0x15'),_0x38370f,_0xdc87('0x16'));logger[_0xdc87('0x17')](_0xdc87('0x18'),_0x38370f,_0xdc87('0x16'),JSON['stringify'](_0x7b225b));if(_0x7b225b['error']){if(_0x7b225b[_0xdc87('0x19')]['code']===0x1f4){logger['error'](_0xdc87('0x15'),_0x38370f,_0x7b225b[_0xdc87('0x19')][_0xdc87('0x1a')]);return _0xa0de32(_0x7b225b[_0xdc87('0x19')][_0xdc87('0x1a')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x38370f,_0x7b225b['error'][_0xdc87('0x1a')]);return _0x3d6ade(_0x7b225b[_0xdc87('0x19')][_0xdc87('0x1a')]);}else{logger[_0xdc87('0x14')](_0xdc87('0x15'),_0x38370f,'request\x20sent');_0x3d6ade(_0x7b225b[_0xdc87('0x1b')]['message']);}})[_0xdc87('0x1c')](function(_0x1bc737){logger[_0xdc87('0x19')](_0xdc87('0x15'),_0x38370f,_0x1bc737);_0xa0de32(_0x1bc737);});});}function respondWithStatusCode(_0x26c825,_0x48a90f){_0x48a90f=_0x48a90f||0xcc;return function(_0x353d59){if(_0x353d59){return _0x26c825[_0xdc87('0x1d')](_0x48a90f);}return _0x26c825[_0xdc87('0x1e')](_0x48a90f)['end']();};}function respondWithResult(_0x3c9b6c,_0x2e69bb){_0x2e69bb=_0x2e69bb||0xc8;return function(_0x46858a){if(_0x46858a){return _0x3c9b6c[_0xdc87('0x1e')](_0x2e69bb)['json'](_0x46858a);}};}function respondWithFilteredResult(_0x893282,_0x3e488c){return function(_0x12e8b1){if(_0x12e8b1){var _0x2c7d4a=typeof _0x3e488c['offset']===_0xdc87('0x1f')&&typeof _0x3e488c[_0xdc87('0x20')]===_0xdc87('0x1f');var _0x4f5938=_0x12e8b1['count'];var _0x387358=_0x2c7d4a?0x0:_0x3e488c[_0xdc87('0x21')];var _0x520580=_0x2c7d4a?_0x12e8b1[_0xdc87('0x22')]:_0x3e488c[_0xdc87('0x21')]+_0x3e488c[_0xdc87('0x20')];var _0x28a8fa;if(_0x520580>=_0x4f5938){_0x520580=_0x4f5938;_0x28a8fa=0xc8;}else{_0x28a8fa=0xce;}_0x893282[_0xdc87('0x1e')](_0x28a8fa);return _0x893282['set'](_0xdc87('0x23'),_0x387358+'-'+_0x520580+'/'+_0x4f5938)[_0xdc87('0x24')](_0x12e8b1);}return null;};}function saveUpdates(_0x7d3465){return function(_0x230678){if(_0x230678){return _0x230678['update'](_0x7d3465)['then'](function(_0x3f47e5){return _0x3f47e5;});}return null;};}function removeEntity(_0x4976ae){return function(_0x59c6bc){if(_0x59c6bc){return _0x59c6bc[_0xdc87('0x25')]()['then'](function(){var _0x240278=_0x59c6bc[_0xdc87('0x26')]({'plain':!![]});var _0xb49d8f='MailAccounts';return db[_0xdc87('0x27')][_0xdc87('0x25')]({'where':{'type':_0xb49d8f,'resourceId':_0x240278['id']}})[_0xdc87('0x13')](function(){return _0x59c6bc;});})[_0xdc87('0x13')](function(){_0x4976ae['status'](0xcc)[_0xdc87('0x28')]();});}};}function handleEntityNotFound(_0x39ff6c){return function(_0x884ca5){if(!_0x884ca5){_0x39ff6c[_0xdc87('0x1d')](0x194);}return _0x884ca5;};}function handleError(_0x3bc5e0,_0x353465){_0x353465=_0x353465||0x1f4;return function(_0x5d041d){logger[_0xdc87('0x19')](_0x5d041d[_0xdc87('0x29')]);if(_0x5d041d[_0xdc87('0x2a')]){delete _0x5d041d[_0xdc87('0x2a')];}_0x3bc5e0[_0xdc87('0x1e')](_0x353465)[_0xdc87('0x2b')](_0x5d041d);};}exports[_0xdc87('0x2c')]=function(_0x458034,_0x5a42da){var _0x2a2e9a={'include':[{'model':db['MailServerIn'],'as':_0xdc87('0x2d')},{'model':db[_0xdc87('0x2e')],'as':_0xdc87('0x2f')},{'model':db[_0xdc87('0x30')],'as':_0xdc87('0x31')}]},_0x57edbe={},_0xa789fb={'count':0x0,'rows':[]};var _0xb69132=_['map'](db[_0xdc87('0x32')][_0xdc87('0x33')],function(_0x5241d6){return{'name':_0x5241d6[_0xdc87('0x34')],'type':_0x5241d6[_0xdc87('0x35')][_0xdc87('0x36')]};});_0x57edbe[_0xdc87('0x37')]=_[_0xdc87('0x38')](_0xb69132,_0xdc87('0x2a'));_0x57edbe['query']=_['keys'](_0x458034['query']);_0x57edbe[_0xdc87('0x39')]=_[_0xdc87('0x3a')](_0x57edbe['model'],_0x57edbe[_0xdc87('0x3b')]);_0x2a2e9a[_0xdc87('0x3c')]=_[_0xdc87('0x3a')](_0x57edbe[_0xdc87('0x37')],qs[_0xdc87('0x3d')](_0x458034[_0xdc87('0x3b')]['fields']));_0x2a2e9a[_0xdc87('0x3c')]=_0x2a2e9a[_0xdc87('0x3c')][_0xdc87('0x3e')]?_0x2a2e9a['attributes']:_0x57edbe[_0xdc87('0x37')];if(!_0x458034[_0xdc87('0x3b')][_0xdc87('0x3f')]('nolimit')){_0x2a2e9a['limit']=qs[_0xdc87('0x20')](_0x458034[_0xdc87('0x3b')][_0xdc87('0x20')]);_0x2a2e9a['offset']=qs[_0xdc87('0x21')](_0x458034[_0xdc87('0x3b')][_0xdc87('0x21')]);}_0x2a2e9a['order']=qs['sort'](_0x458034[_0xdc87('0x3b')][_0xdc87('0x40')]);_0x2a2e9a[_0xdc87('0x41')]=qs['filters'](_['pick'](_0x458034[_0xdc87('0x3b')],_0x57edbe[_0xdc87('0x39')]),_0xb69132);if(_0x458034['query'][_0xdc87('0x42')]){_0x2a2e9a['where']=_['merge'](_0x2a2e9a['where'],{'$or':_[_0xdc87('0x38')](_0xb69132,function(_0x5802eb){if(_0x5802eb[_0xdc87('0x35')]!==_0xdc87('0x43')){var _0x2e6c47={};_0x2e6c47[_0x5802eb[_0xdc87('0x2a')]]={'$like':'%'+_0x458034[_0xdc87('0x3b')][_0xdc87('0x42')]+'%'};return _0x2e6c47;}})});}_0x2a2e9a=_[_0xdc87('0x44')]({},_0x2a2e9a,_0x458034['options']);var _0x117919={'where':_0x2a2e9a['where']};return db[_0xdc87('0x32')]['count'](_0x117919)[_0xdc87('0x13')](function(_0x22660d){_0xa789fb[_0xdc87('0x22')]=_0x22660d;if(_0x458034['query'][_0xdc87('0x45')]){_0x2a2e9a[_0xdc87('0x46')]=[{'all':!![]}];}return db[_0xdc87('0x32')][_0xdc87('0x47')](_0x2a2e9a);})[_0xdc87('0x13')](function(_0x4a0ee2){_0xa789fb['rows']=_0x4a0ee2;return _0xa789fb;})[_0xdc87('0x13')](respondWithFilteredResult(_0x5a42da,_0x2a2e9a))[_0xdc87('0x1c')](handleError(_0x5a42da,null));};exports[_0xdc87('0x48')]=function(_0x4b512f,_0x2ed7eb){var _0x4bbb17={'raw':![],'where':{'id':_0x4b512f[_0xdc87('0x49')]['id']},'include':[{'model':db[_0xdc87('0x4a')],'as':_0xdc87('0x2d')},{'model':db[_0xdc87('0x2e')],'as':_0xdc87('0x2f')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x8b1c63={};_0x8b1c63['model']=_[_0xdc87('0x4b')](db[_0xdc87('0x32')][_0xdc87('0x33')]);_0x8b1c63[_0xdc87('0x3b')]=_[_0xdc87('0x4b')](_0x4b512f[_0xdc87('0x3b')]);_0x8b1c63[_0xdc87('0x39')]=_['intersection'](_0x8b1c63['model'],_0x8b1c63['query']);_0x4bbb17[_0xdc87('0x3c')]=_[_0xdc87('0x3a')](_0x8b1c63[_0xdc87('0x37')],qs['fields'](_0x4b512f[_0xdc87('0x3b')][_0xdc87('0x3d')]));_0x4bbb17[_0xdc87('0x3c')]=_0x4bbb17[_0xdc87('0x3c')][_0xdc87('0x3e')]?_0x4bbb17[_0xdc87('0x3c')]:_0x8b1c63['model'];if(_0x4b512f[_0xdc87('0x3b')][_0xdc87('0x45')]){_0x4bbb17['include']=[{'all':!![]}];}_0x4bbb17=_[_0xdc87('0x44')]({},_0x4bbb17,_0x4b512f[_0xdc87('0x4c')]);return db[_0xdc87('0x32')][_0xdc87('0x4d')](_0x4bbb17)[_0xdc87('0x13')](handleEntityNotFound(_0x2ed7eb,null))['then'](respondWithResult(_0x2ed7eb,null))[_0xdc87('0x1c')](handleError(_0x2ed7eb,null));};exports[_0xdc87('0x4e')]=function(_0xba4882,_0x2993f4){if(_0xba4882[_0xdc87('0x4f')]['id']){delete _0xba4882[_0xdc87('0x4f')]['id'];}if(_0xba4882[_0xdc87('0x4f')][_0xdc87('0x2d')]){if(!_0xba4882['body'][_0xdc87('0x2d')]['modernAuthentication']){_0xba4882[_0xdc87('0x4f')][_0xdc87('0x2d')][_0xdc87('0x50')]=null;}}if(_0xba4882[_0xdc87('0x4f')][_0xdc87('0x2f')]){if(!_0xba4882['body'][_0xdc87('0x2f')][_0xdc87('0x51')]){_0xba4882[_0xdc87('0x4f')]['Smtp'][_0xdc87('0x50')]=null;}}return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0xba4882[_0xdc87('0x49')]['id']},'include':[{'model':db[_0xdc87('0x4a')],'as':_0xdc87('0x2d')},{'model':db[_0xdc87('0x2e')],'as':_0xdc87('0x2f')},{'model':db[_0xdc87('0x30')],'as':_0xdc87('0x31')}]})['then'](handleEntityNotFound(_0x2993f4,null))['then'](saveUpdates(_0xba4882[_0xdc87('0x4f')],null))[_0xdc87('0x13')](function(_0x59a929){if(_0x59a929&&_0xba4882['body']['Imap']){return db[_0xdc87('0x4a')][_0xdc87('0x4e')](_0xba4882[_0xdc87('0x4f')][_0xdc87('0x2d')],{'where':{'MailAccountId':_0x59a929['id']}})['then'](function(){return _0x59a929;});}return _0x59a929;})[_0xdc87('0x13')](function(_0x28cf5a){if(_0x28cf5a&&_0xba4882[_0xdc87('0x4f')]['Smtp']){return db[_0xdc87('0x2e')][_0xdc87('0x4e')](_0xba4882['body'][_0xdc87('0x2f')],{'where':{'MailAccountId':_0x28cf5a['id']}})[_0xdc87('0x13')](function(){return _0x28cf5a;});}return _0x28cf5a;})[_0xdc87('0x13')](respondWithResult(_0x2993f4,null))[_0xdc87('0x1c')](handleError(_0x2993f4,null));};exports[_0xdc87('0x52')]=function(_0x16fcf0,_0x54a778){return db[_0xdc87('0x32')][_0xdc87('0x52')]()[_0xdc87('0x13')](respondWithResult(_0x54a778,null))['catch'](handleError(_0x54a778,null));};exports[_0xdc87('0x53')]=function(_0x49f4c4,_0x4db8cf){if(_0x49f4c4[_0xdc87('0x4f')]['id']){delete _0x49f4c4['body']['id'];}return db['MailAccount'][_0xdc87('0x4d')]({'where':{'id':_0x49f4c4[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x4db8cf,null))['then'](function(_0x1519f6){if(_0x1519f6){_0x49f4c4['body'][_0xdc87('0x54')]=_0x1519f6['id'];return db[_0xdc87('0x55')][_0xdc87('0x56')](_0x49f4c4[_0xdc87('0x4f')]);}})[_0xdc87('0x13')](respondWithResult(_0x4db8cf,null))['catch'](handleError(_0x4db8cf,null));};exports[_0xdc87('0x57')]=function(_0x3c435e,_0x39a811){var _0x3ddb10={'raw':![],'where':{}};var _0x16c88f={};var _0x42b26c={'count':0x0,'rows':[]};return db[_0xdc87('0x32')]['findOne']({'where':{'id':_0x3c435e[_0xdc87('0x49')]['id']}})['then'](handleEntityNotFound(_0x39a811,null))[_0xdc87('0x13')](function(_0x34f516){if(_0x34f516){_0x16c88f[_0xdc87('0x37')]=_['keys'](db[_0xdc87('0x55')]['rawAttributes']);_0x16c88f[_0xdc87('0x3b')]=_[_0xdc87('0x4b')](_0x3c435e[_0xdc87('0x3b')]);_0x16c88f[_0xdc87('0x39')]=_[_0xdc87('0x3a')](_0x16c88f[_0xdc87('0x37')],_0x16c88f['query']);_0x3ddb10[_0xdc87('0x3c')]=_['intersection'](_0x16c88f[_0xdc87('0x37')],qs[_0xdc87('0x3d')](_0x3c435e[_0xdc87('0x3b')][_0xdc87('0x3d')]));_0x3ddb10[_0xdc87('0x3c')]=_0x3ddb10['attributes']['length']?_0x3ddb10[_0xdc87('0x3c')]:_0x16c88f['model'];if(!_0x3c435e[_0xdc87('0x3b')][_0xdc87('0x3f')]('nolimit')){_0x3ddb10['limit']=qs[_0xdc87('0x20')](_0x3c435e['query']['limit']);_0x3ddb10[_0xdc87('0x21')]=qs[_0xdc87('0x21')](_0x3c435e['query'][_0xdc87('0x21')]);}_0x3ddb10[_0xdc87('0x58')]=qs[_0xdc87('0x40')](_0x3c435e['query'][_0xdc87('0x40')]);_0x3ddb10[_0xdc87('0x41')]=qs[_0xdc87('0x39')](_[_0xdc87('0x59')](_0x3c435e[_0xdc87('0x3b')],_0x16c88f[_0xdc87('0x39')]));_0x3ddb10[_0xdc87('0x41')]['MailAccountId']=_0x34f516['id'];if(_0x3c435e['query'][_0xdc87('0x42')]){_0x3ddb10[_0xdc87('0x41')]=_[_0xdc87('0x44')](_0x3ddb10[_0xdc87('0x41')],{'$or':_['map'](_0x3ddb10[_0xdc87('0x3c')],function(_0x226c58){var _0x431ff6={};_0x431ff6[_0x226c58]={'$like':'%'+_0x3c435e[_0xdc87('0x3b')][_0xdc87('0x42')]+'%'};return _0x431ff6;})});}_0x3ddb10=_['merge']({},_0x3ddb10,_0x3c435e[_0xdc87('0x4c')]);return db[_0xdc87('0x55')][_0xdc87('0x22')]({'where':_0x3ddb10[_0xdc87('0x41')]})[_0xdc87('0x13')](function(_0x408768){_0x42b26c[_0xdc87('0x22')]=_0x408768;if(_0x3c435e['query'][_0xdc87('0x45')]){_0x3ddb10[_0xdc87('0x46')]=[{'all':!![]}];}return db[_0xdc87('0x55')]['findAll'](_0x3ddb10);})['then'](function(_0x34761c){_0x42b26c[_0xdc87('0x5a')]=_0x34761c;return _0x42b26c;});}})[_0xdc87('0x13')](respondWithFilteredResult(_0x39a811,_0x3ddb10))[_0xdc87('0x1c')](handleError(_0x39a811,null));};exports[_0xdc87('0x5b')]=function(_0x4271b6,_0x3b2036){return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0x4271b6[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x3b2036,null))[_0xdc87('0x13')](function(_0x2b8fb0){if(_0x2b8fb0){return _0x2b8fb0[_0xdc87('0x5b')](_0x4271b6[_0xdc87('0x3b')][_0xdc87('0x5c')]);}})[_0xdc87('0x13')](respondWithStatusCode(_0x3b2036,null))[_0xdc87('0x1c')](handleError(_0x3b2036,null));};exports[_0xdc87('0x5d')]=function(_0x33126d,_0x285869){if(_0x33126d[_0xdc87('0x4f')]['id']){delete _0x33126d['body']['id'];}return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0x33126d[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x285869,null))[_0xdc87('0x13')](function(_0x45c982){if(_0x45c982){_0x33126d[_0xdc87('0x4f')][_0xdc87('0x54')]=_0x45c982['id'];return db[_0xdc87('0x5e')][_0xdc87('0x56')](_0x33126d['body']);}})[_0xdc87('0x13')](respondWithResult(_0x285869,null))[_0xdc87('0x1c')](handleError(_0x285869,null));};exports['getAnswers']=function(_0x2f7d29,_0x168bbe){var _0x2fe075={'raw':![],'where':{}};var _0x37bfe1={};var _0x302015={'count':0x0,'rows':[]};return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x2f7d29[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x168bbe,null))[_0xdc87('0x13')](function(_0x37ab8a){if(_0x37ab8a){_0x37bfe1['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x37bfe1[_0xdc87('0x3b')]=_[_0xdc87('0x4b')](_0x2f7d29[_0xdc87('0x3b')]);_0x37bfe1[_0xdc87('0x39')]=_[_0xdc87('0x3a')](_0x37bfe1[_0xdc87('0x37')],_0x37bfe1[_0xdc87('0x3b')]);_0x2fe075[_0xdc87('0x3c')]=_[_0xdc87('0x3a')](_0x37bfe1[_0xdc87('0x37')],qs['fields'](_0x2f7d29[_0xdc87('0x3b')]['fields']));_0x2fe075[_0xdc87('0x3c')]=_0x2fe075[_0xdc87('0x3c')][_0xdc87('0x3e')]?_0x2fe075['attributes']:_0x37bfe1[_0xdc87('0x37')];if(!_0x2f7d29[_0xdc87('0x3b')][_0xdc87('0x3f')](_0xdc87('0x60'))){_0x2fe075[_0xdc87('0x20')]=qs[_0xdc87('0x20')](_0x2f7d29[_0xdc87('0x3b')][_0xdc87('0x20')]);_0x2fe075[_0xdc87('0x21')]=qs[_0xdc87('0x21')](_0x2f7d29['query'][_0xdc87('0x21')]);}_0x2fe075[_0xdc87('0x58')]=qs['sort'](_0x2f7d29[_0xdc87('0x3b')][_0xdc87('0x40')]);_0x2fe075[_0xdc87('0x41')]=qs['filters'](_[_0xdc87('0x59')](_0x2f7d29[_0xdc87('0x3b')],_0x37bfe1[_0xdc87('0x39')]));_0x2fe075[_0xdc87('0x41')][_0xdc87('0x54')]=_0x37ab8a['id'];if(_0x2f7d29[_0xdc87('0x3b')]['filter']){_0x2fe075['where']=_[_0xdc87('0x44')](_0x2fe075[_0xdc87('0x41')],{'$or':_[_0xdc87('0x38')](_0x2fe075[_0xdc87('0x3c')],function(_0x56f4f9){var _0x4ccc7b={};_0x4ccc7b[_0x56f4f9]={'$like':'%'+_0x2f7d29[_0xdc87('0x3b')]['filter']+'%'};return _0x4ccc7b;})});}_0x2fe075=_[_0xdc87('0x44')]({},_0x2fe075,_0x2f7d29[_0xdc87('0x4c')]);return db[_0xdc87('0x5e')][_0xdc87('0x22')]({'where':_0x2fe075[_0xdc87('0x41')]})[_0xdc87('0x13')](function(_0xb5a4f6){_0x302015[_0xdc87('0x22')]=_0xb5a4f6;if(_0x2f7d29[_0xdc87('0x3b')][_0xdc87('0x45')]){_0x2fe075['include']=[{'all':!![]}];}return db[_0xdc87('0x5e')]['findAll'](_0x2fe075);})[_0xdc87('0x13')](function(_0xa2c30c){_0x302015[_0xdc87('0x5a')]=_0xa2c30c;return _0x302015;});}})[_0xdc87('0x13')](respondWithFilteredResult(_0x168bbe,_0x2fe075))[_0xdc87('0x1c')](handleError(_0x168bbe,null));};exports[_0xdc87('0x61')]=function(_0x2463a5,_0x28a23d){return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0x2463a5[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x28a23d,null))[_0xdc87('0x13')](function(_0x251695){if(_0x251695){return _0x251695['removeAnswers'](_0x2463a5['query']['ids']);}})[_0xdc87('0x13')](respondWithStatusCode(_0x28a23d,null))['catch'](handleError(_0x28a23d,null));};exports[_0xdc87('0x56')]=function(_0x5df874,_0xd4f351){var _0x6f7a27={'name':_0x5df874[_0xdc87('0x4f')][_0xdc87('0x2a')],'key':_0x5df874['body'][_0xdc87('0x36')],'provider':_0x5df874[_0xdc87('0x4f')][_0xdc87('0x62')]===_0xdc87('0x63')?null:_0x5df874[_0xdc87('0x4f')]['provider'],'email':_0x5df874[_0xdc87('0x4f')][_0xdc87('0x64')],'ListId':_0x5df874[_0xdc87('0x4f')][_0xdc87('0x65')],'active':!_[_0xdc87('0x66')](_0x5df874['body']['active'])?_0x5df874[_0xdc87('0x4f')][_0xdc87('0x67')]:!![],'description':_0x5df874['body'][_0xdc87('0x68')]||null,'Imap':{},'Smtp':{}};if(_0x6f7a27[_0xdc87('0x62')]){_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x69')]=_0x6f7a27['Smtp'][_0xdc87('0x69')]=_0x5df874[_0xdc87('0x4f')][_0xdc87('0x6a')];_0x6f7a27[_0xdc87('0x2d')]['password']=_0x6f7a27[_0xdc87('0x2f')][_0xdc87('0x6b')]=_0x5df874[_0xdc87('0x4f')][_0xdc87('0x6c')];if(_0x5df874['body'][_0xdc87('0x51')]){_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x51')]=_0x6f7a27['Smtp']['modernAuthentication']=!![];_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x50')]=_0x6f7a27['Smtp'][_0xdc87('0x50')]=_0x5df874[_0xdc87('0x4f')][_0xdc87('0x50')];_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x6c')]=_0x6f7a27[_0xdc87('0x2f')]['pass']=null;}else{_0x6f7a27[_0xdc87('0x2d')]['CloudProviderId']=_0x6f7a27[_0xdc87('0x2f')][_0xdc87('0x50')]=null;}_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x6d')]=_0x6f7a27['Smtp'][_0xdc87('0x6d')]=null;_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x6e')]=_0x6f7a27['Smtp'][_0xdc87('0x6e')]=null;_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x6f')]=_0x6f7a27['Smtp'][_0xdc87('0x6f')]=null;}else{if(_0x5df874[_0xdc87('0x4f')][_0xdc87('0x70')]){_0x6f7a27[_0xdc87('0x2d')]['user']=_0x6f7a27[_0xdc87('0x2f')][_0xdc87('0x69')]=_0x5df874['body'][_0xdc87('0x6a')];_0x6f7a27[_0xdc87('0x2d')]['password']=_0x6f7a27[_0xdc87('0x2f')]['pass']=_0x5df874[_0xdc87('0x4f')]['password'];}else{_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x70')]=_0x6f7a27[_0xdc87('0x2f')][_0xdc87('0x70')]=![];_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x69')]=_0x6f7a27[_0xdc87('0x2f')][_0xdc87('0x69')]=null;_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x6c')]=_0x6f7a27[_0xdc87('0x2f')][_0xdc87('0x6b')]=null;}_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x6e')]=_0x5df874[_0xdc87('0x4f')][_0xdc87('0x2d')][_0xdc87('0x6e')];_0x6f7a27[_0xdc87('0x2d')][_0xdc87('0x6f')]=_0x5df874['body']['Imap'][_0xdc87('0x6f')];_0x6f7a27['Smtp'][_0xdc87('0x6e')]=_0x5df874[_0xdc87('0x4f')][_0xdc87('0x2f')][_0xdc87('0x6e')];_0x6f7a27[_0xdc87('0x2f')][_0xdc87('0x6f')]=_0x5df874[_0xdc87('0x4f')][_0xdc87('0x2f')]['port'];}return db[_0xdc87('0x32')][_0xdc87('0x56')](_0x6f7a27,{'include':[{'model':db[_0xdc87('0x2e')],'as':'Smtp'},{'model':db[_0xdc87('0x4a')],'as':'Imap'}]})['then'](function(_0x124229){var _0x454574=_0x5df874[_0xdc87('0x69')]['get']({'plain':!![]});if(!_0x454574)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x454574[_0xdc87('0x71')]===_0xdc87('0x69')){var _0x3f996a=_0x124229[_0xdc87('0x26')]({'plain':!![]});return db[_0xdc87('0x72')][_0xdc87('0x4d')]({'where':{'name':_0xdc87('0x73'),'userProfileId':_0x454574[_0xdc87('0x74')]},'raw':!![]})['then'](function(_0x22f3c7){if(_0x22f3c7&&_0x22f3c7[_0xdc87('0x75')]===0x0){return db['UserProfileResource'][_0xdc87('0x56')]({'name':_0x3f996a['name'],'resourceId':_0x3f996a['id'],'type':_0x22f3c7[_0xdc87('0x2a')],'sectionId':_0x22f3c7['id']},{})[_0xdc87('0x13')](function(){return _0x124229;});}else{return _0x124229;}})['catch'](function(_0x196790){logger[_0xdc87('0x19')](_0xdc87('0x76'),_0x196790);throw _0x196790;});}return _0x124229;})[_0xdc87('0x13')](respondWithResult(_0xd4f351,0xc9))[_0xdc87('0x1c')](handleError(_0xd4f351,null));};exports[_0xdc87('0x77')]=function(_0x1d5aee,_0x58926d){return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x1d5aee[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x58926d,null))[_0xdc87('0x13')](function(_0x581be1){if(_0x581be1){return _0x581be1[_0xdc87('0x77')]();}return null;})['then'](respondWithResult(_0x58926d,null))[_0xdc87('0x1c')](handleError(_0x58926d,null));};exports[_0xdc87('0x78')]=function(_0x1ffd51,_0x526af6){if(_0x1ffd51[_0xdc87('0x4f')]['id']){delete _0x1ffd51[_0xdc87('0x4f')]['id'];}return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0x1ffd51[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x526af6,null))[_0xdc87('0x13')](function(_0x2e5582){if(_0x2e5582){_0x1ffd51[_0xdc87('0x4f')][_0xdc87('0x54')]=_0x2e5582['id'];return db[_0xdc87('0x4a')]['create'](_0x1ffd51['body']);}})[_0xdc87('0x13')](respondWithResult(_0x526af6,null))[_0xdc87('0x1c')](handleError(_0x526af6,null));};exports[_0xdc87('0x79')]=function(_0x4666e7,_0x2d7602){return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x4666e7[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x2d7602,null))[_0xdc87('0x13')](function(_0xa47433){if(_0xa47433){return _0xa47433[_0xdc87('0x7a')](null);}return null;})['then'](respondWithStatusCode(_0x2d7602,null))[_0xdc87('0x1c')](handleError(_0x2d7602,null));};exports[_0xdc87('0x7b')]=function(_0x5c3185,_0x4587d3){return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x5c3185[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x4587d3,null))[_0xdc87('0x13')](function(_0x114662){if(_0x114662){return _0x114662['getSmtp']();}return null;})['then'](respondWithResult(_0x4587d3,null))[_0xdc87('0x1c')](handleError(_0x4587d3,null));};exports[_0xdc87('0x7c')]=function(_0x47249b,_0x44ab80){if(_0x47249b[_0xdc87('0x4f')]['id']){delete _0x47249b[_0xdc87('0x4f')]['id'];}return db[_0xdc87('0x32')]['find']({'where':{'id':_0x47249b[_0xdc87('0x49')]['id']}})['then'](handleEntityNotFound(_0x44ab80,null))[_0xdc87('0x13')](function(_0x2274bb){if(_0x2274bb){_0x47249b[_0xdc87('0x4f')][_0xdc87('0x54')]=_0x2274bb['id'];return db[_0xdc87('0x2e')][_0xdc87('0x56')](_0x47249b[_0xdc87('0x4f')]);}})[_0xdc87('0x13')](respondWithResult(_0x44ab80,null))['catch'](handleError(_0x44ab80,null));};exports['removeSmtp']=function(_0x5dd8a9,_0x50b5df){return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x5dd8a9[_0xdc87('0x49')]['id']}})['then'](handleEntityNotFound(_0x50b5df,null))[_0xdc87('0x13')](function(_0x1fad19){if(_0x1fad19){return _0x1fad19[_0xdc87('0x7d')](null);}return null;})[_0xdc87('0x13')](respondWithStatusCode(_0x50b5df,null))[_0xdc87('0x1c')](handleError(_0x50b5df,null));};exports['addInteraction']=function(_0x564221,_0x873de8){return db[_0xdc87('0x7e')]['find']({'where':{'id':_0x564221[_0xdc87('0x49')]['id']}})['then'](handleEntityNotFound(_0x873de8,null))[_0xdc87('0x13')](function(_0x3daaf7){if(_0x3daaf7){return _0x3daaf7[_0xdc87('0x7f')](_0x564221[_0xdc87('0x4f')][_0xdc87('0x5c')],_[_0xdc87('0x80')](_0x564221[_0xdc87('0x4f')],[_0xdc87('0x5c'),'id'])||{});}})[_0xdc87('0x13')](respondWithResult(_0x873de8,null))['catch'](handleError(_0x873de8,null));};exports[_0xdc87('0x81')]=function(_0x5e8ac4,_0x337bc6){var _0x18b3a2={'raw':![],'where':{}};var _0x5877c2={};var _0x4c76f8={'count':0x0,'rows':[]};return db['MailAccount'][_0xdc87('0x5f')]({'where':{'id':_0x5e8ac4[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x337bc6,null))['then'](function(_0x126b58){if(_0x126b58){_0x5877c2[_0xdc87('0x37')]=_[_0xdc87('0x4b')](db['MailInteraction'][_0xdc87('0x33')]);_0x5877c2[_0xdc87('0x3b')]=_[_0xdc87('0x4b')](_0x5e8ac4[_0xdc87('0x3b')]);_0x5877c2['filters']=_[_0xdc87('0x3a')](_0x5877c2['model'],_0x5877c2['query']);_0x18b3a2[_0xdc87('0x3c')]=_[_0xdc87('0x3a')](_0x5877c2[_0xdc87('0x37')],qs[_0xdc87('0x3d')](_0x5e8ac4[_0xdc87('0x3b')]['fields']));_0x18b3a2['attributes']=_0x18b3a2[_0xdc87('0x3c')][_0xdc87('0x3e')]?_0x18b3a2['attributes']:_0x5877c2[_0xdc87('0x37')];if(!_0x5e8ac4[_0xdc87('0x3b')][_0xdc87('0x3f')](_0xdc87('0x60'))){_0x18b3a2[_0xdc87('0x20')]=qs[_0xdc87('0x20')](_0x5e8ac4['query'][_0xdc87('0x20')]);_0x18b3a2[_0xdc87('0x21')]=qs[_0xdc87('0x21')](_0x5e8ac4['query'][_0xdc87('0x21')]);}_0x18b3a2[_0xdc87('0x58')]=qs['sort'](_0x5e8ac4[_0xdc87('0x3b')][_0xdc87('0x40')]);_0x18b3a2[_0xdc87('0x41')]=qs['filters'](_[_0xdc87('0x59')](_0x5e8ac4[_0xdc87('0x3b')],_0x5877c2[_0xdc87('0x39')]));_0x18b3a2[_0xdc87('0x41')][_0xdc87('0x54')]=_0x126b58['id'];if(_0x5e8ac4['query']['filter']){_0x18b3a2[_0xdc87('0x41')]=_[_0xdc87('0x44')](_0x18b3a2[_0xdc87('0x41')],{'$or':_['map'](_0x18b3a2[_0xdc87('0x3c')],function(_0x15347e){var _0x51eb87={};_0x51eb87[_0x15347e]={'$like':'%'+_0x5e8ac4[_0xdc87('0x3b')][_0xdc87('0x42')]+'%'};return _0x51eb87;})});}_0x18b3a2=_[_0xdc87('0x44')]({},_0x18b3a2,_0x5e8ac4[_0xdc87('0x4c')]);return db[_0xdc87('0x7e')]['count']({'where':_0x18b3a2[_0xdc87('0x41')]})[_0xdc87('0x13')](function(_0x1f5cc0){_0x4c76f8[_0xdc87('0x22')]=_0x1f5cc0;if(_0x5e8ac4['query'][_0xdc87('0x45')]){_0x18b3a2[_0xdc87('0x46')]=[{'model':db[_0xdc87('0x82')],'as':_0xdc87('0x83'),'required':![]},{'model':db[_0xdc87('0x84')],'as':'Owner','attributes':['name',_0xdc87('0x85'),'internal'],'required':![]},{'model':db[_0xdc87('0x86')],'as':_0xdc87('0x87'),'attributes':['id','name',_0xdc87('0x88')],'where':_0x5e8ac4[_0xdc87('0x3b')][_0xdc87('0x89')]?{'id':_0x5e8ac4[_0xdc87('0x3b')][_0xdc87('0x89')]}:undefined,'required':_0x5e8ac4[_0xdc87('0x3b')]['tag']?!![]:![]}];}return db[_0xdc87('0x7e')][_0xdc87('0x47')](_0x18b3a2);})[_0xdc87('0x13')](function(_0x1f1199){_0x4c76f8[_0xdc87('0x5a')]=_0x1f1199;return _0x4c76f8;});}})[_0xdc87('0x13')](respondWithFilteredResult(_0x337bc6,_0x18b3a2))[_0xdc87('0x1c')](handleError(_0x337bc6,null));};exports['addApplications']=function addApplications(_0x578f8e,_0x280313){var _0x506ba0=_0x578f8e[_0xdc87('0x49')]['id'];var _0x53fa50=_0x578f8e['body'];var _0x4d5c03=0xc8;var _0x11dace=null;return db['sequelize'][_0xdc87('0x8a')]({'isolationLevel':db[_0xdc87('0x8b')][_0xdc87('0x8c')][_0xdc87('0x8d')][_0xdc87('0x8e')]},function(_0x375e5a){return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x506ba0},'transaction':_0x375e5a})[_0xdc87('0x13')](function(_0x53f7cb){if(_0x53f7cb){return db[_0xdc87('0x8f')][_0xdc87('0x25')]({'where':{'MailAccountId':_0x506ba0},'transaction':_0x375e5a})[_0xdc87('0x13')](function(){var _0x27254f=_[_0xdc87('0x38')](_0x53fa50,function(_0x17136e){_0x17136e[_0xdc87('0x54')]=_0x506ba0;return _0x17136e;});return db[_0xdc87('0x8f')][_0xdc87('0x90')](_0x27254f,{'transaction':_0x375e5a});});}else{_0x4d5c03=0x194;_0x11dace=[];}});})['then'](function(){if(_0x4d5c03!==0x194){return db[_0xdc87('0x8f')][_0xdc87('0x91')]({'where':{'MailAccountId':_0x506ba0},'order':_0xdc87('0x92')})[_0xdc87('0x13')](function(_0x402650){_0x11dace=_0x402650;});}})[_0xdc87('0x1c')](function(_0x13725e){_0x4d5c03=0x1f4;logger[_0xdc87('0x19')](_0x13725e[_0xdc87('0x29')]);if(_0x13725e['name']){delete _0x13725e[_0xdc87('0x2a')];}_0x11dace=_0x13725e;})[_0xdc87('0x93')](function(){if(_0x11dace===null){_0x280313[_0xdc87('0x1d')](_0x4d5c03);}else{if(_0x4d5c03===0x1f4){_0x280313[_0xdc87('0x1e')](_0x4d5c03)[_0xdc87('0x2b')](_0x11dace);}else{_0x280313[_0xdc87('0x1e')](_0x4d5c03)[_0xdc87('0x24')](_0x11dace);}}});};exports[_0xdc87('0x94')]=function(_0x2b53d7,_0x413400){var _0x514f1f={};var _0x596069={};var _0x21c302;var _0x3af1ac;return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x2b53d7[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x413400,null))[_0xdc87('0x13')](function(_0x293a30){if(_0x293a30){_0x21c302=_0x293a30;_0x596069['model']=_[_0xdc87('0x4b')](db['MailApplication']['rawAttributes']);_0x596069[_0xdc87('0x3b')]=_[_0xdc87('0x4b')](_0x2b53d7[_0xdc87('0x3b')]);_0x596069[_0xdc87('0x39')]=_['intersection'](_0x596069[_0xdc87('0x37')],_0x596069[_0xdc87('0x3b')]);_0x514f1f['attributes']=_['intersection'](_0x596069[_0xdc87('0x37')],qs['fields'](_0x2b53d7[_0xdc87('0x3b')][_0xdc87('0x3d')]));_0x514f1f[_0xdc87('0x3c')]=_0x514f1f[_0xdc87('0x3c')][_0xdc87('0x3e')]?_0x514f1f[_0xdc87('0x3c')]:_0x596069[_0xdc87('0x37')];_0x514f1f[_0xdc87('0x58')]=qs[_0xdc87('0x40')](_0x2b53d7[_0xdc87('0x3b')][_0xdc87('0x40')]);_0x514f1f['where']=qs['filters'](_[_0xdc87('0x59')](_0x2b53d7[_0xdc87('0x3b')],_0x596069[_0xdc87('0x39')]));if(_0x2b53d7[_0xdc87('0x3b')][_0xdc87('0x42')]){_0x514f1f[_0xdc87('0x41')]=_['merge'](_0x514f1f[_0xdc87('0x41')],{'$or':_[_0xdc87('0x38')](_0x514f1f[_0xdc87('0x3c')],function(_0x46c836){var _0x535a5c={};_0x535a5c[_0x46c836]={'$like':'%'+_0x2b53d7[_0xdc87('0x3b')][_0xdc87('0x42')]+'%'};return _0x535a5c;})});}_0x514f1f=_['merge']({},_0x514f1f,_0x2b53d7['options']);return _0x21c302[_0xdc87('0x94')](_0x514f1f);}})[_0xdc87('0x13')](function(_0x23b971){if(_0x23b971){_0x3af1ac=_0x23b971[_0xdc87('0x3e')];if(!_0x2b53d7['query'][_0xdc87('0x3f')](_0xdc87('0x60'))){_0x514f1f[_0xdc87('0x20')]=qs[_0xdc87('0x20')](_0x2b53d7['query'][_0xdc87('0x20')]);_0x514f1f[_0xdc87('0x21')]=qs['offset'](_0x2b53d7[_0xdc87('0x3b')][_0xdc87('0x21')]);}return _0x21c302[_0xdc87('0x94')](_0x514f1f);}})['then'](function(_0x109cdc){if(_0x109cdc){return _0x109cdc?{'count':_0x3af1ac,'rows':_0x109cdc}:null;}})['then'](respondWithResult(_0x413400,null))[_0xdc87('0x1c')](handleError(_0x413400,null));};exports[_0xdc87('0x95')]=function(_0x3585f4,_0x2263c0){var _0x411e5c={'raw':!![],'where':{}};var _0x504239={};var _0x2b15ee={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3585f4[_0xdc87('0x49')]['id']}})['then'](handleEntityNotFound(_0x2263c0,null))['then'](function(_0x31ba74){if(_0x31ba74){_0x504239['model']=_[_0xdc87('0x4b')](db[_0xdc87('0x96')]['rawAttributes']);_0x504239[_0xdc87('0x3b')]=_[_0xdc87('0x4b')](_0x3585f4[_0xdc87('0x3b')]);_0x504239[_0xdc87('0x39')]=_[_0xdc87('0x3a')](_0x504239[_0xdc87('0x37')],_0x504239[_0xdc87('0x3b')]);_0x411e5c['attributes']=_['intersection'](_0x504239[_0xdc87('0x37')],qs[_0xdc87('0x3d')](_0x3585f4[_0xdc87('0x3b')][_0xdc87('0x3d')]));_0x411e5c[_0xdc87('0x3c')]=_0x411e5c[_0xdc87('0x3c')][_0xdc87('0x3e')]?_0x411e5c[_0xdc87('0x3c')]:_0x504239[_0xdc87('0x37')];if(!_0x3585f4[_0xdc87('0x3b')][_0xdc87('0x3f')](_0xdc87('0x60'))){_0x411e5c[_0xdc87('0x20')]=qs['limit'](_0x3585f4[_0xdc87('0x3b')][_0xdc87('0x20')]);_0x411e5c[_0xdc87('0x21')]=qs[_0xdc87('0x21')](_0x3585f4['query'][_0xdc87('0x21')]);}_0x411e5c[_0xdc87('0x58')]=qs[_0xdc87('0x40')](_0x3585f4[_0xdc87('0x3b')][_0xdc87('0x40')]);_0x411e5c[_0xdc87('0x41')]=qs[_0xdc87('0x39')](_[_0xdc87('0x59')](_0x3585f4[_0xdc87('0x3b')],_0x504239[_0xdc87('0x39')]));_0x411e5c[_0xdc87('0x41')]['MailAccountId']=_0x31ba74['id'];if(_0x3585f4[_0xdc87('0x3b')]['filter']){_0x411e5c[_0xdc87('0x41')]=_['merge'](_0x411e5c['where'],{'$or':_['map'](_0x411e5c[_0xdc87('0x3c')],function(_0x159141){var _0x5622a5={};_0x5622a5[_0x159141]={'$like':'%'+_0x3585f4[_0xdc87('0x3b')][_0xdc87('0x42')]+'%'};return _0x5622a5;})});}if(_0x3585f4['query'][_0xdc87('0x97')]){var _0x334f18=_0x3585f4[_0xdc87('0x3b')]['$gte'][_0xdc87('0x98')](',');var _0x3995d6={};_0x3995d6[_0x334f18[0x0]]={'$gte':moment(_0x334f18[0x1])[_0xdc87('0x99')](_0xdc87('0x9a'))};_0x411e5c[_0xdc87('0x41')]=_[_0xdc87('0x44')](_0x411e5c[_0xdc87('0x41')],_0x3995d6);}_0x411e5c=_[_0xdc87('0x44')]({},_0x411e5c,_0x3585f4[_0xdc87('0x4c')]);return db[_0xdc87('0x96')][_0xdc87('0x22')]({'where':_0x411e5c[_0xdc87('0x41')]})[_0xdc87('0x13')](function(_0x7d7e57){_0x2b15ee[_0xdc87('0x22')]=_0x7d7e57;if(_0x3585f4[_0xdc87('0x3b')][_0xdc87('0x45')]){_0x411e5c[_0xdc87('0x46')]=[{'all':!![]}];}return db['MailMessage'][_0xdc87('0x47')](_0x411e5c);})['then'](function(_0x5bd7d1){if(_0x3585f4[_0xdc87('0x3b')][_0xdc87('0x9b')]===_0xdc87('0x9c')){for(var _0x3fba71=0x0;_0x3fba71<_0x5bd7d1[_0xdc87('0x3e')];_0x3fba71++){_0x5bd7d1[_0x3fba71][_0xdc87('0x4f')]=juice(_0x5bd7d1[_0x3fba71][_0xdc87('0x4f')]);}}_0x2b15ee[_0xdc87('0x5a')]=_0x5bd7d1;return _0x2b15ee;});}})[_0xdc87('0x13')](respondWithFilteredResult(_0x2263c0,_0x411e5c))[_0xdc87('0x1c')](handleError(_0x2263c0,null));};exports[_0xdc87('0x2b')]=function(_0x77a334,_0x3f5d61){var _0x3f1366,_0xf3c922={},_0x42bc40;if(_0x77a334[_0xdc87('0x4f')]['to']){_0x42bc40=_0x77a334[_0xdc87('0x4f')]['to'][_0xdc87('0x98')](',')[0x0];}return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0x77a334[_0xdc87('0x49')]['id']},'include':[{'model':db[_0xdc87('0x9d')],'as':'List','include':[{'model':db[_0xdc87('0x82')],'as':_0xdc87('0x9e'),'where':{'email':_0x42bc40},'limit':0x1,'order':[[_0xdc87('0x9f'),_0xdc87('0xa0')]]}]},{'model':db[_0xdc87('0x2e')],'as':_0xdc87('0x2f'),'raw':!![]}]})[_0xdc87('0x13')](handleEntityNotFound(_0x3f5d61,null))[_0xdc87('0x13')](function(_0x47131e){if(_0x47131e){_0x3f1366=_0x47131e;if(_0x47131e[_0xdc87('0x2f')]){if(_[_0xdc87('0x66')](_0x77a334[_0xdc87('0x4f')][_0xdc87('0xa1')])){_0x77a334[_0xdc87('0x4f')][_0xdc87('0xa1')]=util[_0xdc87('0x99')]('%s\x20<%s>',_0x47131e['name'],_0x47131e[_0xdc87('0x64')]||_0x47131e[_0xdc87('0x2f')][_0xdc87('0x69')]);}if(_0x77a334[_0xdc87('0x4f')][_0xdc87('0xa2')]&&_0x77a334['body'][_0xdc87('0xa2')][_0xdc87('0x3e')]){for(var _0x1a46f0=0x0;_0x1a46f0<_0x77a334[_0xdc87('0x4f')]['attachments'][_0xdc87('0x3e')];_0x1a46f0+=0x1){_0x77a334[_0xdc87('0x4f')][_0xdc87('0xa2')][_0x1a46f0]={'filename':_0x77a334[_0xdc87('0x4f')]['attachments'][_0x1a46f0][_0xdc87('0x2a')],'path':path[_0xdc87('0xa3')](config[_0xdc87('0xa4')],_0xdc87('0xa5'),_0x77a334[_0xdc87('0x4f')][_0xdc87('0xa2')][_0x1a46f0][_0xdc87('0xa6')])};}}var _0x52acb5={'tls':{'rejectUnauthorized':![]}};if(_[_0xdc87('0x66')](_0x47131e[_0xdc87('0x2f')][_0xdc87('0x6d')])){if(_0x47131e[_0xdc87('0x2f')][_0xdc87('0x70')]){_0x52acb5[_0xdc87('0xa7')]={'user':_0x47131e[_0xdc87('0x2f')][_0xdc87('0x69')],'pass':_0x47131e[_0xdc87('0x2f')][_0xdc87('0x6b')]};}_0x52acb5[_0xdc87('0x6e')]=_0x47131e[_0xdc87('0x2f')][_0xdc87('0x6e')];_0x52acb5['port']=_0x47131e[_0xdc87('0x2f')][_0xdc87('0x6f')];_0x52acb5[_0xdc87('0xa8')]=_0x47131e[_0xdc87('0x2f')]['secure'];}else{_0x52acb5[_0xdc87('0x6d')]=_0x47131e['Smtp'][_0xdc87('0x6d')];_0x52acb5[_0xdc87('0xa7')]={'user':_0x47131e[_0xdc87('0x2f')][_0xdc87('0x69')],'pass':_0x47131e[_0xdc87('0x2f')][_0xdc87('0x6b')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x52acb5,'message':_0x77a334['body']});}else{throw new Error(_0xdc87('0xa9'));}}})[_0xdc87('0x13')](function(_0x4ad41a){if(_0x4ad41a){_0xf3c922=_0x4ad41a;if(_0x3f1366[_0xdc87('0xaa')]){if(_0x3f1366['List'][_0xdc87('0x9e')][_0xdc87('0x3e')]){return _0x3f1366[_0xdc87('0xaa')][_0xdc87('0x9e')][0x0];}else{return db['CmContact'][_0xdc87('0x56')](_[_0xdc87('0xc')](_0x77a334[_0xdc87('0x4f')],{'firstName':_0x77a334[_0xdc87('0x4f')]['to'],'email':_0x77a334[_0xdc87('0x4f')]['to'],'phone':_0x77a334[_0xdc87('0x4f')]['to'],'ListId':_0x3f1366[_0xdc87('0x65')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x5a6221){if(_0x5a6221){var _0x1756fb={'UserId':_0x77a334[_0xdc87('0x69')]['id'],'ContactId':_0x5a6221['id'],'MailAccountId':_0x3f1366['id'],'inReplyTo':_0xf3c922['messageId'],'to':_0x77a334['body'][_0xdc87('0xa1')],'cc':_0x77a334['body']['cc'],'subject':_0x77a334[_0xdc87('0x4f')][_0xdc87('0xab')],'attach':_0x77a334['body'][_0xdc87('0xac')],'firstMsgDirection':_0xdc87('0xad'),'lastMsgAt':moment()[_0xdc87('0x99')](_0xdc87('0x9a')),'lastMsgDirection':_0xdc87('0xad'),'Messages':[_[_0xdc87('0x44')](_0x77a334[_0xdc87('0x4f')],{'messageId':_0xf3c922[_0xdc87('0xae')],'sentAt':moment()[_0xdc87('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3f1366['id'],'UserId':_0x77a334[_0xdc87('0x69')]['id'],'ContactId':_0x5a6221['id']})]};if(_0x77a334['body'][_0xdc87('0xaf')]){_0x1756fb=_[_0xdc87('0x44')](_0x1756fb,_0x77a334[_0xdc87('0x4f')][_0xdc87('0xaf')]);}return db[_0xdc87('0x7e')][_0xdc87('0x56')](_0x1756fb,{'include':[{'model':db[_0xdc87('0x96')],'as':'Messages'}]});}})[_0xdc87('0x13')](respondWithResult(_0x3f5d61,null))['catch'](handleError(_0x3f5d61,null));};exports[_0xdc87('0xb0')]=function(_0x57e8fc,_0x58f9e6){return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0x57e8fc['params']['id']},'include':[{'model':db[_0xdc87('0x2e')],'as':_0xdc87('0x2f'),'raw':!![],'include':[{'model':db[_0xdc87('0xb1')],'as':_0xdc87('0xb1'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x58f9e6,null))['then'](function(_0x239e8f){if(!_0x239e8f[_0xdc87('0x2f')])return;var _0x29e497={'id':_0x239e8f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x239e8f[_0xdc87('0x62')]!=='custom'){_0x29e497[_0xdc87('0x6d')]=_0x239e8f[_0xdc87('0x62')];}else{_0x29e497[_0xdc87('0x6e')]=_0x239e8f[_0xdc87('0x2f')][_0xdc87('0x6e')];_0x29e497[_0xdc87('0x6f')]=_0x239e8f[_0xdc87('0x2f')]['port'];_0x29e497[_0xdc87('0xa8')]=_0x239e8f[_0xdc87('0x2f')][_0xdc87('0xa8')];}if(_0x239e8f[_0xdc87('0x2f')]['authentication']){if(_0x239e8f[_0xdc87('0x2f')][_0xdc87('0x51')]){_0x29e497[_0xdc87('0xa7')]={'type':_0xdc87('0xb2'),'user':_0x239e8f[_0xdc87('0x2f')][_0xdc87('0x69')],'accessToken':_0x239e8f[_0xdc87('0x2f')][_0xdc87('0xb1')][_0xdc87('0xb3')]};}else{_0x29e497[_0xdc87('0xa7')]={'user':_0x239e8f[_0xdc87('0x2f')][_0xdc87('0x69')],'pass':_0x239e8f['Smtp'][_0xdc87('0x6b')]};}}return respondWithRpcPromise(_0xdc87('0xb4'),_0xdc87('0xb0'),{'account':_0x29e497});})[_0xdc87('0x13')](respondWithResult(_0x58f9e6,null))['catch'](handleError(_0x58f9e6,null));};exports[_0xdc87('0x25')]=function(_0x1487cf,_0x344fe3){return db[_0xdc87('0x32')][_0xdc87('0x4d')]({'where':{'id':_0x1487cf[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x344fe3,null))[_0xdc87('0x13')](function(_0x422312){if(_0x422312&&_0x422312[_0xdc87('0x6d')]){throw new db[(_0xdc87('0xb5'))]['ValidationError'](_0xdc87('0xb6'));}return _0x422312;})[_0xdc87('0x13')](removeEntity(_0x344fe3,null))[_0xdc87('0x1c')](handleError(_0x344fe3,null));};exports[_0xdc87('0xb7')]=function(_0x5aa142,_0x53fa43){return db['MailAccount'][_0xdc87('0x4d')]({'where':{'id':_0x5aa142[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x53fa43,null))[_0xdc87('0x13')](function(_0x5ad90b){if(_0x5ad90b){return _0x5ad90b['addAgents'](_0x5aa142['body']['ids'],_[_0xdc87('0x80')](_0x5aa142[_0xdc87('0x4f')],[_0xdc87('0x5c'),'id'])||{})['spread'](function(_0x3bdc5e){for(var _0x358284=0x0;_0x358284<_0x5aa142[_0xdc87('0x4f')][_0xdc87('0x5c')][_0xdc87('0x3e')];_0x358284+=0x1){socket['emit'](_0xdc87('0xb8'),{'UserId':Number(_0x5aa142[_0xdc87('0x4f')][_0xdc87('0x5c')][_0x358284]),'MailAccountId':Number(_0x5aa142[_0xdc87('0x49')]['id'])});}return _0x3bdc5e;});}})[_0xdc87('0x13')](respondWithResult(_0x53fa43,null))[_0xdc87('0x1c')](handleError(_0x53fa43,null));};exports[_0xdc87('0xb9')]=function(_0x56e856,_0x2f8964){return db['MailAccount'][_0xdc87('0x4d')]({'where':{'id':_0x56e856[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x2f8964,null))[_0xdc87('0x13')](function(_0xfb2223){if(_0xfb2223){return _0xfb2223[_0xdc87('0xb9')](_0x56e856[_0xdc87('0x3b')]['ids'])[_0xdc87('0x13')](function(){if(_[_0xdc87('0xba')](_0x56e856[_0xdc87('0x3b')][_0xdc87('0x5c')])){for(var _0x44c39c=0x0;_0x44c39c<_0x56e856[_0xdc87('0x3b')][_0xdc87('0x5c')][_0xdc87('0x3e')];_0x44c39c+=0x1){socket[_0xdc87('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x56e856[_0xdc87('0x3b')]['ids'][_0x44c39c]),'MailAccountId':Number(_0x56e856[_0xdc87('0x49')]['id'])});}}else{socket[_0xdc87('0xbb')](_0xdc87('0xbc'),{'UserId':Number(_0x56e856[_0xdc87('0x3b')][_0xdc87('0x5c')]),'MailAccountId':Number(_0x56e856[_0xdc87('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f8964,null))[_0xdc87('0x1c')](handleError(_0x2f8964,null));};exports['getAgents']=function(_0x3bba89,_0x5d19b4){var _0x3a1837={};var _0x541739={};var _0x5a0904;var _0x4630ff;return db[_0xdc87('0x32')][_0xdc87('0x5f')]({'where':{'id':_0x3bba89[_0xdc87('0x49')]['id']}})[_0xdc87('0x13')](handleEntityNotFound(_0x5d19b4,null))['then'](function(_0x1eb586){if(_0x1eb586){_0x5a0904=_0x1eb586;_0x541739[_0xdc87('0x37')]=_[_0xdc87('0x4b')](db[_0xdc87('0x84')]['rawAttributes']);_0x541739['query']=_['keys'](_0x3bba89[_0xdc87('0x3b')]);_0x541739['filters']=_[_0xdc87('0x3a')](_0x541739[_0xdc87('0x37')],_0x541739[_0xdc87('0x3b')]);_0x3a1837[_0xdc87('0x3c')]=_[_0xdc87('0x3a')](_0x541739[_0xdc87('0x37')],qs[_0xdc87('0x3d')](_0x3bba89[_0xdc87('0x3b')][_0xdc87('0x3d')]));_0x3a1837[_0xdc87('0x3c')]=_0x3a1837[_0xdc87('0x3c')][_0xdc87('0x3e')]?_0x3a1837[_0xdc87('0x3c')]:_0x541739['model'];_0x3a1837[_0xdc87('0x58')]=qs[_0xdc87('0x40')](_0x3bba89['query'][_0xdc87('0x40')]);_0x3a1837['where']=qs['filters'](_['pick'](_0x3bba89[_0xdc87('0x3b')],_0x541739[_0xdc87('0x39')]));if(_0x3bba89[_0xdc87('0x3b')][_0xdc87('0x42')]){_0x3a1837[_0xdc87('0x41')]=_[_0xdc87('0x44')](_0x3a1837['where'],{'$or':_[_0xdc87('0x38')](_0x3a1837['attributes'],function(_0xddd892){var _0x2177b3={};_0x2177b3[_0xddd892]={'$like':'%'+_0x3bba89[_0xdc87('0x3b')][_0xdc87('0x42')]+'%'};return _0x2177b3;})});}_0x3a1837=_[_0xdc87('0x44')]({},_0x3a1837,_0x3bba89['options']);return _0x5a0904['getAgents'](_0x3a1837);}})['then'](function(_0x446ecd){if(_0x446ecd){_0x4630ff=_0x446ecd[_0xdc87('0x3e')];if(!_0x3bba89[_0xdc87('0x3b')][_0xdc87('0x3f')](_0xdc87('0x60'))){_0x3a1837[_0xdc87('0x20')]=qs[_0xdc87('0x20')](_0x3bba89[_0xdc87('0x3b')][_0xdc87('0x20')]);_0x3a1837[_0xdc87('0x21')]=qs[_0xdc87('0x21')](_0x3bba89[_0xdc87('0x3b')]['offset']);}return _0x5a0904[_0xdc87('0xbd')](_0x3a1837);}})[_0xdc87('0x13')](function(_0x368528){if(_0x368528){return _0x368528?{'count':_0x4630ff,'rows':_0x368528}:null;}})['then'](respondWithResult(_0x5d19b4,null))['catch'](handleError(_0x5d19b4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2b709cf..c77d68d 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 _0x855f=['remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save','update'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x855f,0x145));var _0xf855=function(_0x3deea6,_0x1cd5a2){_0x3deea6=_0x3deea6-0x0;var _0x15f45e=_0x855f[_0x3deea6];return _0x15f45e;};'use strict';var EventEmitter=require(_0xf855('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xf855('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf855('0x2')](0x0);var events={'afterCreate':_0xf855('0x3'),'afterUpdate':_0xf855('0x4'),'afterDestroy':_0xf855('0x5')};function emitEvent(_0x5046aa){return function(_0x4620ba,_0x33ad4f,_0x4887c0){MailAccountEvents['emit'](_0x5046aa+':'+_0x4620ba['id'],_0x4620ba);MailAccountEvents[_0xf855('0x6')](_0x5046aa,_0x4620ba);_0x4887c0(null);};}for(var e in events){if(events[_0xf855('0x7')](e)){var event=events[e];MailAccount[_0xf855('0x8')](e,emitEvent(event));}}module[_0xf855('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xe230=['events','../../mysqldb','save','update','remove','hasOwnProperty','exports'];(function(_0x554014,_0xd700f7){var _0x558bc5=function(_0x4b2719){while(--_0x4b2719){_0x554014['push'](_0x554014['shift']());}};_0x558bc5(++_0xd700f7);}(_0xe230,0x85));var _0x0e23=function(_0x4c5352,_0x406fc9){_0x4c5352=_0x4c5352-0x0;var _0x16d878=_0xe230[_0x4c5352];return _0x16d878;};'use strict';var EventEmitter=require(_0x0e23('0x0'));var MailAccount=require(_0x0e23('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e23('0x2'),'afterUpdate':_0x0e23('0x3'),'afterDestroy':_0x0e23('0x4')};function emitEvent(_0x3c7591){return function(_0x2dfdc6,_0x545ec7,_0x174e77){MailAccountEvents['emit'](_0x3c7591+':'+_0x2dfdc6['id'],_0x2dfdc6);MailAccountEvents['emit'](_0x3c7591,_0x2dfdc6);_0x174e77(null);};}for(var e in events){if(events[_0x0e23('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x0e23('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b777e1b..03d3ea7 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 _0x6f86=['mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x17d2be,_0x51b9c6){var _0x59af79=function(_0x1dc31b){while(--_0x1dc31b){_0x17d2be['push'](_0x17d2be['shift']());}};_0x59af79(++_0x51b9c6);}(_0x6f86,0x187));var _0x66f8=function(_0x4c3851,_0xbebbfd){_0x4c3851=_0x4c3851-0x0;var _0x43a1e2=_0x6f86[_0x4c3851];return _0x43a1e2;};'use strict';var _=require(_0x66f8('0x0'));var util=require(_0x66f8('0x1'));var logger=require(_0x66f8('0x2'))(_0x66f8('0x3'));var moment=require(_0x66f8('0x4'));var BPromise=require(_0x66f8('0x5'));var rp=require(_0x66f8('0x6'));var fs=require('fs');var path=require(_0x66f8('0x7'));var rimraf=require(_0x66f8('0x8'));var config=require(_0x66f8('0x9'));var attributes=require(_0x66f8('0xa'));module[_0x66f8('0xb')]=function(_0x53eb47,_0x40df59){return _0x53eb47[_0x66f8('0xc')](_0x66f8('0xd'),attributes,{'tableName':_0x66f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dea=['bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api'];(function(_0x34cadb,_0x52b843){var _0x1a3672=function(_0x1a09e8){while(--_0x1a09e8){_0x34cadb['push'](_0x34cadb['shift']());}};_0x1a3672(++_0x52b843);}(_0x7dea,0x182));var _0xa7de=function(_0x531c7c,_0x2e02ad){_0x531c7c=_0x531c7c-0x0;var _0xe9125=_0x7dea[_0x531c7c];return _0xe9125;};'use strict';var _=require(_0xa7de('0x0'));var util=require(_0xa7de('0x1'));var logger=require(_0xa7de('0x2'))(_0xa7de('0x3'));var moment=require('moment');var BPromise=require(_0xa7de('0x4'));var rp=require(_0xa7de('0x5'));var fs=require('fs');var path=require(_0xa7de('0x6'));var rimraf=require(_0xa7de('0x7'));var config=require(_0xa7de('0x8'));var attributes=require(_0xa7de('0x9'));module[_0xa7de('0xa')]=function(_0x47ee53,_0x111ef3){return _0x47ee53['define'](_0xa7de('0xb'),attributes,{'tableName':_0xa7de('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 8091642..cc1a2cc 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 _0x6f1d=['raw','where','attributes','limit','include','model','map','stringify','ShowMailAccount','body','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','MailAccount','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','applications','list','priority','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','name','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','ioredis','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailAccount','findAll','options'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x6f1d,0x1e9));var _0xd6f1=function(_0x2b0030,_0x512183){_0x2b0030=_0x2b0030-0x0;var _0x4bbf92=_0x6f1d[_0x2b0030];return _0x4bbf92;};'use strict';var _=require(_0xd6f1('0x0'));var util=require('util');var moment=require(_0xd6f1('0x1'));var BPromise=require(_0xd6f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd6f1('0x4'));var config=require('../../config/environment');var jayson=require(_0xd6f1('0x5'));var client=jayson[_0xd6f1('0x6')][_0xd6f1('0x7')]({'port':0x232c});config[_0xd6f1('0x8')]=_[_0xd6f1('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd6f1('0xa'))(new Redis(config[_0xd6f1('0x8')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x57dfd1,_0x1d6ae0,_0x214221){return new BPromise(function(_0x3b7765,_0x24d638){return client[_0xd6f1('0xb')](_0x57dfd1,_0x214221)[_0xd6f1('0xc')](function(_0x58bb6e){logger[_0xd6f1('0xd')](_0xd6f1('0xe'),_0x1d6ae0,'request\x20sent');logger[_0xd6f1('0xf')](_0xd6f1('0x10'),_0x1d6ae0,_0xd6f1('0x11'),JSON['stringify'](_0x58bb6e));if(_0x58bb6e[_0xd6f1('0x12')]){if(_0x58bb6e[_0xd6f1('0x12')][_0xd6f1('0x13')]===0x1f4){logger[_0xd6f1('0x12')](_0xd6f1('0xe'),_0x1d6ae0,_0x58bb6e[_0xd6f1('0x12')]['message']);return _0x24d638(_0x58bb6e['error'][_0xd6f1('0x14')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x1d6ae0,_0x58bb6e[_0xd6f1('0x12')]['message']);return _0x3b7765(_0x58bb6e[_0xd6f1('0x12')]['message']);}else{logger[_0xd6f1('0xd')](_0xd6f1('0xe'),_0x1d6ae0,'request\x20sent');_0x3b7765(_0x58bb6e[_0xd6f1('0x15')][_0xd6f1('0x14')]);}})[_0xd6f1('0x16')](function(_0x4ae967){logger[_0xd6f1('0x12')](_0xd6f1('0xe'),_0x1d6ae0,_0x4ae967);_0x24d638(_0x4ae967);});});}exports[_0xd6f1('0x17')]=function(_0x4a88d9){var _0xae4dd6=this;return new Promise(function(_0x440b92,_0x3f7922){return db['MailAccount'][_0xd6f1('0x18')]({'raw':_0x4a88d9[_0xd6f1('0x19')]?_0x4a88d9[_0xd6f1('0x19')][_0xd6f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a88d9[_0xd6f1('0x19')]?_0x4a88d9[_0xd6f1('0x19')][_0xd6f1('0x1b')]||null:null,'attributes':_0x4a88d9[_0xd6f1('0x19')]?_0x4a88d9[_0xd6f1('0x19')][_0xd6f1('0x1c')]||null:null,'limit':_0x4a88d9[_0xd6f1('0x19')]?_0x4a88d9['options'][_0xd6f1('0x1d')]||null:null,'include':_0x4a88d9[_0xd6f1('0x19')]?_0x4a88d9[_0xd6f1('0x19')][_0xd6f1('0x1e')]?_['map'](_0x4a88d9[_0xd6f1('0x19')]['include'],function(_0x19881c){return{'model':db[_0x19881c[_0xd6f1('0x1f')]],'as':_0x19881c['as'],'attributes':_0x19881c[_0xd6f1('0x1c')],'include':_0x19881c[_0xd6f1('0x1e')]?_[_0xd6f1('0x20')](_0x19881c[_0xd6f1('0x1e')],function(_0x3f5f97){return{'model':db[_0x3f5f97[_0xd6f1('0x1f')]],'as':_0x3f5f97['as'],'attributes':_0x3f5f97[_0xd6f1('0x1c')],'include':_0x3f5f97[_0xd6f1('0x1e')]?_[_0xd6f1('0x20')](_0x3f5f97[_0xd6f1('0x1e')],function(_0x5e5fa0){return{'model':db[_0x5e5fa0[_0xd6f1('0x1f')]],'as':_0x5e5fa0['as'],'attributes':_0x5e5fa0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd6f1('0xc')](function(_0x551044){logger['info']('GetMailAccount',_0x4a88d9);logger[_0xd6f1('0xf')](_0xd6f1('0x17'),_0x4a88d9,JSON[_0xd6f1('0x21')](_0x551044));_0x440b92(_0x551044);})[_0xd6f1('0x16')](function(_0xab5280){logger[_0xd6f1('0x12')](_0xd6f1('0x17'),_0xab5280[_0xd6f1('0x14')],_0x4a88d9);_0x3f7922(_0xae4dd6[_0xd6f1('0x12')](0x1f4,_0xab5280['message']));});});};exports['ShowMailAccount']=function(_0x5293a2){var _0x29da2c=this;return new Promise(function(_0x2af0c1,_0x1b59bb){return db['MailAccount']['find']({'raw':_0x5293a2[_0xd6f1('0x19')]?_0x5293a2[_0xd6f1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5293a2[_0xd6f1('0x19')]?_0x5293a2[_0xd6f1('0x19')]['where']||null:null,'attributes':_0x5293a2['options']?_0x5293a2[_0xd6f1('0x19')]['attributes']||null:null,'include':_0x5293a2[_0xd6f1('0x19')]?_0x5293a2[_0xd6f1('0x19')][_0xd6f1('0x1e')]?_[_0xd6f1('0x20')](_0x5293a2['options'][_0xd6f1('0x1e')],function(_0xfb571d){return{'model':db[_0xfb571d['model']],'as':_0xfb571d['as'],'attributes':_0xfb571d['attributes'],'include':_0xfb571d[_0xd6f1('0x1e')]?_[_0xd6f1('0x20')](_0xfb571d['include'],function(_0x2de2b2){return{'model':db[_0x2de2b2[_0xd6f1('0x1f')]],'as':_0x2de2b2['as'],'attributes':_0x2de2b2[_0xd6f1('0x1c')],'include':_0x2de2b2['include']?_[_0xd6f1('0x20')](_0x2de2b2[_0xd6f1('0x1e')],function(_0x5f051d){return{'model':db[_0x5f051d[_0xd6f1('0x1f')]],'as':_0x5f051d['as'],'attributes':_0x5f051d[_0xd6f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd6f1('0xc')](function(_0x3482f1){logger['info'](_0xd6f1('0x22'),_0x5293a2);logger['debug']('ShowMailAccount',_0x5293a2,JSON['stringify'](_0x3482f1));_0x2af0c1(_0x3482f1);})[_0xd6f1('0x16')](function(_0x87287c){logger[_0xd6f1('0x12')](_0xd6f1('0x22'),_0x87287c[_0xd6f1('0x14')],_0x5293a2);_0x1b59bb(_0x29da2c[_0xd6f1('0x12')](0x1f4,_0x87287c[_0xd6f1('0x14')]));});});};exports['NotifyMailAccount']=function(_0x2bf92e){var _0x584972=this;return new Promise(function(_0x228e49,_0x1d354f){var _0x18e102={'body':_0x2bf92e[_0xd6f1('0x23')],'channel':'mail'};var _0x989d03=_['difference'](_[_0xd6f1('0x24')](db[_0xd6f1('0x25')][_0xd6f1('0x26')]),[_0xd6f1('0x27'),_0xd6f1('0x28'),_0xd6f1('0x29'),_0xd6f1('0x2a')]);var _0x485163=![];if(_0x2bf92e[_0xd6f1('0x23')]['id']){delete _0x2bf92e[_0xd6f1('0x23')]['id'];}if(_['isNil'](_0x2bf92e[_0xd6f1('0x23')]['from'])){return _0x1d354f(_0x584972[_0xd6f1('0x12')](0x1f4,_0xd6f1('0x2b')));}if(_[_0xd6f1('0x2c')](_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x23')])||_0x2bf92e[_0xd6f1('0x23')]['body']===''){return _0x1d354f(_0x584972[_0xd6f1('0x12')](0x1f4,_0xd6f1('0x2d')));}if(_[_0xd6f1('0x2c')](_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x2e')])){return _0x1d354f(_0x584972[_0xd6f1('0x12')](0x1f4,_0xd6f1('0x2f')+_0x989d03));}if(!_[_0xd6f1('0x30')](_0x989d03,_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x2e')])){return _0x1d354f(_0x584972[_0xd6f1('0x12')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x989d03));}var _0xe583fa={};_0xe583fa[_0x2bf92e['body'][_0xd6f1('0x2e')]]=_0x2bf92e['body'][_0xd6f1('0x31')];return db[_0xd6f1('0x32')][_0xd6f1('0x33')]({'where':{'id':_0x2bf92e[_0xd6f1('0x34')]['id']},'include':[{'model':db[_0xd6f1('0x35')],'as':_0xd6f1('0x36'),'include':[{'model':db[_0xd6f1('0x25')],'as':_0xd6f1('0x37'),'where':_0xe583fa,'limit':0x1,'order':[[_0xd6f1('0x28'),_0xd6f1('0x38')]]}]},{'model':db[_0xd6f1('0x39')],'as':_0xd6f1('0x3a')},{'model':db[_0xd6f1('0x3b')],'as':_0xd6f1('0x3c')}]})['then'](function(_0x1a72b9){if(_0x1a72b9&&_0x1a72b9[_0xd6f1('0x36')]){var _0x1fe8c3=_0x1a72b9[_0xd6f1('0x3d')]({'plain':!![]});_0x18e102[_0xd6f1('0x34')]=_['omit'](_0x1fe8c3,[_0xd6f1('0x3a'),_0xd6f1('0x36')]);_0x18e102[_0xd6f1('0x3e')]=_0x1fe8c3[_0xd6f1('0x3a')];_0x18e102[_0xd6f1('0x3f')]=_0x1fe8c3['List'];_0x18e102['applications']=_['orderBy'](_0x18e102[_0xd6f1('0x3e')],[_0xd6f1('0x40')],['asc']);if(_0x18e102[_0xd6f1('0x34')]&&_0x18e102['account'][_0xd6f1('0x41')]){_0x18e102[_0xd6f1('0x3e')][_0xd6f1('0x42')]({'id':0x0,'priority':_0x18e102[_0xd6f1('0x3e')][_0xd6f1('0x43')]+0x1,'app':_0xd6f1('0x44'),'appdata':_0xd6f1('0x41'),'interval':'*,*,*,*'});}if(_0x18e102[_0xd6f1('0x34')][_0xd6f1('0x3a')]){delete _0x18e102[_0xd6f1('0x34')][_0xd6f1('0x3a')];}if(_0x18e102[_0xd6f1('0x34')]['List']){delete _0x18e102[_0xd6f1('0x34')][_0xd6f1('0x36')];}if(_0x1fe8c3['List']['Contacts'][_0xd6f1('0x43')]){return _0x1fe8c3['List']['Contacts'][0x0];}var _0x599bfb=_[_0xd6f1('0x9')](_0x2bf92e[_0xd6f1('0x23')],{'firstName':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x31')],'ListId':_0x1fe8c3[_0xd6f1('0x2a')]});_0x599bfb[_0x2bf92e[_0xd6f1('0x23')]['mapKey']]=_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x31')];return db[_0xd6f1('0x25')][_0xd6f1('0x45')](_0x599bfb);}else{throw new Error(_0xd6f1('0x46'));}})[_0xd6f1('0xc')](function(_0x11ff5c){_0x18e102[_0xd6f1('0x47')]=_0x11ff5c;if(_0x11ff5c){if(!_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')][_0xd6f1('0x48')]){_0x2bf92e['body']['message']['messageId']=rs[_0xd6f1('0x49')]()+'\x20'+_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')][_0xd6f1('0x31')];}var _0x5c8a13={'ContactId':_0x11ff5c['id'],'MailAccountId':_0x2bf92e[_0xd6f1('0x34')]['id'],'inReplyTo':_0x2bf92e[_0xd6f1('0x23')]['message'][_0xd6f1('0x48')],'to':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')][_0xd6f1('0x31')],'cc':_0x2bf92e['body'][_0xd6f1('0x14')]['cc'],'subject':_0x2bf92e[_0xd6f1('0x23')]['message'][_0xd6f1('0x4a')],'attach':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')][_0xd6f1('0x4b')],'lastMsgAt':moment()[_0xd6f1('0x4c')](_0xd6f1('0x4d')),'lastMsgDirection':'in'};return db[_0xd6f1('0x4e')][_0xd6f1('0x33')]({'where':{'closed':![],'MailAccountId':_0x2bf92e[_0xd6f1('0x34')]['id']},'include':[{'model':db[_0xd6f1('0x4f')],'as':_0xd6f1('0x50'),'attributes':['messageId'],'where':{'messageId':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['inReplyTo']}}]})[_0xd6f1('0xc')](function(_0x5b138c){if(_0x5b138c){return[_0x5b138c,![]];}return db[_0xd6f1('0x4e')]['create'](_0x5c8a13)[_0xd6f1('0xc')](function(_0x4fbdec){return[_0x4fbdec,!![]];});});}else{throw new Error(_0xd6f1('0x51'));}})[_0xd6f1('0x52')](function(_0x1a1558,_0x28a268){if(_0x1a1558){_0x485163=_0x28a268;if(!_0x28a268){return _0x1a1558['update']({'inReplyTo':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['messageId'],'to':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['from'],'cc':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['cc'],'subject':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['subject'],'attach':_0x1a1558[_0xd6f1('0x4b')]?_0x1a1558[_0xd6f1('0x4b')]:_0x2bf92e['body'][_0xd6f1('0x14')][_0xd6f1('0x4b')],'substatus':null,'substatusAt':moment()['format'](_0xd6f1('0x4d')),'lastMsgAt':moment()[_0xd6f1('0x4c')](_0xd6f1('0x4d')),'lastMsgDirection':'in'});}else{return _0x1a1558;}}})['then'](function(_0x11a541){_0x18e102[_0xd6f1('0x53')]=_0x11a541[_0xd6f1('0x3d')]({'plain':!![]});_0x18e102[_0xd6f1('0x53')][_0xd6f1('0x54')]=_0x485163;return db['MailMessage'][_0xd6f1('0x45')]({'body':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x23')],'MailAccountId':_0x2bf92e['account']['id'],'MailInteractionId':_0x11a541['id'],'direction':'in','ContactId':_0x18e102[_0xd6f1('0x47')]['id'],'messageId':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')][_0xd6f1('0x48')],'from':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['from'],'to':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['to'],'cc':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')]['cc'],'subject':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')][_0xd6f1('0x4a')],'attach':_0x2bf92e[_0xd6f1('0x23')]['message']['attach'],'Attachments':_0x2bf92e['body'][_0xd6f1('0x14')][_0xd6f1('0x55')],'originTo':_0x2bf92e['body'][_0xd6f1('0x14')][_0xd6f1('0x56')],'originCc':_0x2bf92e['body'][_0xd6f1('0x14')][_0xd6f1('0x57')],'bcc':_0x2bf92e['body'][_0xd6f1('0x14')][_0xd6f1('0x58')],'ChatWebsiteId':_0x2bf92e[_0xd6f1('0x23')][_0xd6f1('0x14')][_0xd6f1('0x59')]||null,'originChannel':_0x2bf92e[_0xd6f1('0x23')]['message'][_0xd6f1('0x5a')]||_0xd6f1('0x5b'),'ChatOfflineMessageId':_0x2bf92e[_0xd6f1('0x23')]['message'][_0xd6f1('0x5c')]||null},{'include':[{'model':db[_0xd6f1('0x5d')],'as':'Attachments'}]});})[_0xd6f1('0xc')](function(_0x5b1043){_0x18e102[_0xd6f1('0x14')]=_0x5b1043;if(_0x18e102[_0xd6f1('0x53')]['UserId']){return db[_0xd6f1('0x5e')]['find']({'attributes':['id',_0xd6f1('0x5f')],'where':{'id':_0x18e102[_0xd6f1('0x53')][_0xd6f1('0x60')]}})[_0xd6f1('0xc')](function(_0x52e404){if(_0x52e404){_0x18e102['applications'][_0xd6f1('0x61')]({'id':0x0,'priority':0x0,'app':_0xd6f1('0x62'),'appdata':_0x52e404[_0xd6f1('0x5f')]+','+(_0x18e102['account'][_0xd6f1('0x63')]||0xa),'interval':_0xd6f1('0x64')});}return respondWithRpcPromise(_0xd6f1('0x65'),_0xd6f1('0x66'),_0x18e102);});}return respondWithRpcPromise(_0xd6f1('0x65'),'startRouting',_0x18e102);})[_0xd6f1('0xc')](function(_0x317566){_0x228e49(_0x317566);})['catch'](function(_0x27f57a){_0x1d354f(_0x584972['error'](0x1f4,_0x27f57a[_0xd6f1('0x14')]));});});}; \ No newline at end of file +var _0x1721=['startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','findAll','options','raw','where','attributes','include','model','map','then','GetMailAccount','stringify','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','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','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','applications','list','orderBy','priority','autoclose','push','close','*,*,*,*','length','defaults','create','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','interaction','created','contact','attachments','originTo','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x1721,0x6d));var _0x1172=function(_0x4763cf,_0xb10bef){_0x4763cf=_0x4763cf-0x0;var _0x48779e=_0x1721[_0x4763cf];return _0x48779e;};'use strict';var _=require('lodash');var util=require(_0x1172('0x0'));var moment=require(_0x1172('0x1'));var BPromise=require(_0x1172('0x2'));var rs=require(_0x1172('0x3'));var fs=require('fs');var Redis=require(_0x1172('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1172('0x5'));var logger=require(_0x1172('0x6'))(_0x1172('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1172('0x8')][_0x1172('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x1172('0xa')],{'host':_0x1172('0xb'),'port':0x18eb});var socket=require(_0x1172('0xc'))(new Redis(config[_0x1172('0xa')]));require('./mailAccount.socket')[_0x1172('0xd')](socket);function respondWithRpcPromise(_0x5afb0e,_0x2a6e51,_0x51a8eb){return new BPromise(function(_0x39009e,_0x2bb1ab){return client[_0x1172('0xe')](_0x5afb0e,_0x51a8eb)['then'](function(_0x3011c1){logger[_0x1172('0xf')](_0x1172('0x10'),_0x2a6e51,'request\x20sent');logger[_0x1172('0x11')](_0x1172('0x12'),_0x2a6e51,_0x1172('0x13'),JSON['stringify'](_0x3011c1));if(_0x3011c1['error']){if(_0x3011c1[_0x1172('0x14')][_0x1172('0x15')]===0x1f4){logger[_0x1172('0x14')](_0x1172('0x10'),_0x2a6e51,_0x3011c1['error'][_0x1172('0x16')]);return _0x2bb1ab(_0x3011c1[_0x1172('0x14')][_0x1172('0x16')]);}logger[_0x1172('0x14')](_0x1172('0x10'),_0x2a6e51,_0x3011c1['error']['message']);return _0x39009e(_0x3011c1[_0x1172('0x14')][_0x1172('0x16')]);}else{logger[_0x1172('0xf')](_0x1172('0x10'),_0x2a6e51,'request\x20sent');_0x39009e(_0x3011c1[_0x1172('0x17')][_0x1172('0x16')]);}})[_0x1172('0x18')](function(_0x5dcd0b){logger[_0x1172('0x14')](_0x1172('0x10'),_0x2a6e51,_0x5dcd0b);_0x2bb1ab(_0x5dcd0b);});});}exports['GetMailAccount']=function(_0x1dbb1e){var _0x540ba3=this;return new Promise(function(_0x52b029,_0x544612){return db['MailAccount'][_0x1172('0x19')]({'raw':_0x1dbb1e['options']?_0x1dbb1e[_0x1172('0x1a')][_0x1172('0x1b')]===undefined?!![]:![]:!![],'where':_0x1dbb1e[_0x1172('0x1a')]?_0x1dbb1e[_0x1172('0x1a')][_0x1172('0x1c')]||null:null,'attributes':_0x1dbb1e['options']?_0x1dbb1e[_0x1172('0x1a')][_0x1172('0x1d')]||null:null,'limit':_0x1dbb1e[_0x1172('0x1a')]?_0x1dbb1e[_0x1172('0x1a')]['limit']||null:null,'include':_0x1dbb1e[_0x1172('0x1a')]?_0x1dbb1e[_0x1172('0x1a')][_0x1172('0x1e')]?_['map'](_0x1dbb1e[_0x1172('0x1a')][_0x1172('0x1e')],function(_0x402096){return{'model':db[_0x402096[_0x1172('0x1f')]],'as':_0x402096['as'],'attributes':_0x402096[_0x1172('0x1d')],'include':_0x402096[_0x1172('0x1e')]?_[_0x1172('0x20')](_0x402096[_0x1172('0x1e')],function(_0x4578d7){return{'model':db[_0x4578d7[_0x1172('0x1f')]],'as':_0x4578d7['as'],'attributes':_0x4578d7[_0x1172('0x1d')],'include':_0x4578d7['include']?_['map'](_0x4578d7[_0x1172('0x1e')],function(_0x50cd14){return{'model':db[_0x50cd14[_0x1172('0x1f')]],'as':_0x50cd14['as'],'attributes':_0x50cd14[_0x1172('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1172('0x21')](function(_0x252c13){logger['info'](_0x1172('0x22'),_0x1dbb1e);logger[_0x1172('0x11')](_0x1172('0x22'),_0x1dbb1e,JSON[_0x1172('0x23')](_0x252c13));_0x52b029(_0x252c13);})[_0x1172('0x18')](function(_0x55bd8e){logger[_0x1172('0x14')](_0x1172('0x22'),_0x55bd8e['message'],_0x1dbb1e);_0x544612(_0x540ba3[_0x1172('0x14')](0x1f4,_0x55bd8e[_0x1172('0x16')]));});});};exports[_0x1172('0x24')]=function(_0x42228d){var _0x3303e9=this;return new Promise(function(_0x322646,_0x359528){return db['MailAccount'][_0x1172('0x25')]({'raw':_0x42228d['options']?_0x42228d[_0x1172('0x1a')][_0x1172('0x1b')]===undefined?!![]:![]:!![],'where':_0x42228d[_0x1172('0x1a')]?_0x42228d[_0x1172('0x1a')]['where']||null:null,'attributes':_0x42228d[_0x1172('0x1a')]?_0x42228d[_0x1172('0x1a')][_0x1172('0x1d')]||null:null,'include':_0x42228d[_0x1172('0x1a')]?_0x42228d[_0x1172('0x1a')][_0x1172('0x1e')]?_[_0x1172('0x20')](_0x42228d[_0x1172('0x1a')][_0x1172('0x1e')],function(_0x3087f0){return{'model':db[_0x3087f0['model']],'as':_0x3087f0['as'],'attributes':_0x3087f0['attributes'],'include':_0x3087f0[_0x1172('0x1e')]?_[_0x1172('0x20')](_0x3087f0[_0x1172('0x1e')],function(_0x8e7dd9){return{'model':db[_0x8e7dd9[_0x1172('0x1f')]],'as':_0x8e7dd9['as'],'attributes':_0x8e7dd9['attributes'],'include':_0x8e7dd9[_0x1172('0x1e')]?_['map'](_0x8e7dd9[_0x1172('0x1e')],function(_0x237331){return{'model':db[_0x237331[_0x1172('0x1f')]],'as':_0x237331['as'],'attributes':_0x237331[_0x1172('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1172('0x21')](function(_0x2753cb){logger[_0x1172('0xf')]('ShowMailAccount',_0x42228d);logger[_0x1172('0x11')](_0x1172('0x24'),_0x42228d,JSON[_0x1172('0x23')](_0x2753cb));_0x322646(_0x2753cb);})[_0x1172('0x18')](function(_0x36ea03){logger[_0x1172('0x14')](_0x1172('0x24'),_0x36ea03['message'],_0x42228d);_0x359528(_0x3303e9[_0x1172('0x14')](0x1f4,_0x36ea03['message']));});});};exports[_0x1172('0x26')]=function(_0x3c82d4){var _0x1adb70=this;return new Promise(function(_0xd20c7c,_0x163d48){var _0x143ff1={'body':_0x3c82d4[_0x1172('0x27')],'channel':_0x1172('0x28')};var _0x139124=_[_0x1172('0x29')](_[_0x1172('0x2a')](db['CmContact'][_0x1172('0x2b')]),[_0x1172('0x2c'),_0x1172('0x2d'),_0x1172('0x2e'),_0x1172('0x2f')]);var _0xeb6580=![];if(_0x3c82d4[_0x1172('0x27')]['id']){delete _0x3c82d4[_0x1172('0x27')]['id'];}if(_[_0x1172('0x30')](_0x3c82d4[_0x1172('0x27')][_0x1172('0x31')])){return _0x163d48(_0x1adb70[_0x1172('0x14')](0x1f4,_0x1172('0x32')));}if(_[_0x1172('0x30')](_0x3c82d4[_0x1172('0x27')][_0x1172('0x27')])||_0x3c82d4[_0x1172('0x27')]['body']===''){return _0x163d48(_0x1adb70[_0x1172('0x14')](0x1f4,_0x1172('0x33')));}if(_['isNil'](_0x3c82d4[_0x1172('0x27')][_0x1172('0x34')])){return _0x163d48(_0x1adb70[_0x1172('0x14')](0x1f4,_0x1172('0x35')+_0x139124));}if(!_[_0x1172('0x36')](_0x139124,_0x3c82d4[_0x1172('0x27')][_0x1172('0x34')])){return _0x163d48(_0x1adb70[_0x1172('0x14')](0x1f4,_0x1172('0x37')+_0x139124));}var _0x1990d2={};_0x1990d2[_0x3c82d4[_0x1172('0x27')]['mapKey']]=_0x3c82d4[_0x1172('0x27')][_0x1172('0x31')];return db['MailAccount'][_0x1172('0x25')]({'where':{'id':_0x3c82d4[_0x1172('0x38')]['id']},'include':[{'model':db[_0x1172('0x39')],'as':_0x1172('0x3a'),'include':[{'model':db['CmContact'],'as':_0x1172('0x3b'),'where':_0x1990d2,'limit':0x1,'order':[[_0x1172('0x2d'),_0x1172('0x3c')]]}]},{'model':db[_0x1172('0x3d')],'as':_0x1172('0x3e')},{'model':db[_0x1172('0x3f')],'as':_0x1172('0x40')}]})['then'](function(_0x2d5cf6){if(_0x2d5cf6&&_0x2d5cf6['List']){var _0x362255=_0x2d5cf6[_0x1172('0x41')]({'plain':!![]});_0x143ff1[_0x1172('0x38')]=_['omit'](_0x362255,[_0x1172('0x3e'),'List']);_0x143ff1[_0x1172('0x42')]=_0x362255[_0x1172('0x3e')];_0x143ff1[_0x1172('0x43')]=_0x362255['List'];_0x143ff1['applications']=_[_0x1172('0x44')](_0x143ff1[_0x1172('0x42')],[_0x1172('0x45')],['asc']);if(_0x143ff1[_0x1172('0x38')]&&_0x143ff1[_0x1172('0x38')][_0x1172('0x46')]){_0x143ff1[_0x1172('0x42')][_0x1172('0x47')]({'id':0x0,'priority':_0x143ff1[_0x1172('0x42')]['length']+0x1,'app':_0x1172('0x48'),'appdata':_0x1172('0x46'),'interval':_0x1172('0x49')});}if(_0x143ff1[_0x1172('0x38')][_0x1172('0x3e')]){delete _0x143ff1[_0x1172('0x38')][_0x1172('0x3e')];}if(_0x143ff1[_0x1172('0x38')]['List']){delete _0x143ff1[_0x1172('0x38')][_0x1172('0x3a')];}if(_0x362255[_0x1172('0x3a')]['Contacts'][_0x1172('0x4a')]){return _0x362255[_0x1172('0x3a')]['Contacts'][0x0];}var _0x289164=_[_0x1172('0x4b')](_0x3c82d4['body'],{'firstName':_0x3c82d4[_0x1172('0x27')][_0x1172('0x31')],'ListId':_0x362255[_0x1172('0x2f')]});_0x289164[_0x3c82d4[_0x1172('0x27')]['mapKey']]=_0x3c82d4[_0x1172('0x27')][_0x1172('0x31')];return db['CmContact'][_0x1172('0x4c')](_0x289164);}else{throw new Error(_0x1172('0x4d'));}})[_0x1172('0x21')](function(_0xd299c0){_0x143ff1['contact']=_0xd299c0;if(_0xd299c0){if(!_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x4e')]){_0x3c82d4[_0x1172('0x27')]['message'][_0x1172('0x4e')]=rs['generate']()+'\x20'+_0x3c82d4['body'][_0x1172('0x16')]['from'];}var _0x1bf538={'ContactId':_0xd299c0['id'],'MailAccountId':_0x3c82d4[_0x1172('0x38')]['id'],'inReplyTo':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x4e')],'to':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x31')],'cc':_0x3c82d4['body'][_0x1172('0x16')]['cc'],'subject':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x4f')],'attach':_0x3c82d4['body'][_0x1172('0x16')][_0x1172('0x50')],'lastMsgAt':moment()[_0x1172('0x51')](_0x1172('0x52')),'lastMsgDirection':'in'};return db[_0x1172('0x53')][_0x1172('0x25')]({'where':{'closed':![],'MailAccountId':_0x3c82d4[_0x1172('0x38')]['id']},'include':[{'model':db[_0x1172('0x54')],'as':_0x1172('0x55'),'attributes':[_0x1172('0x4e')],'where':{'messageId':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x56')]}}]})[_0x1172('0x21')](function(_0x461010){if(_0x461010){return[_0x461010,![]];}return db[_0x1172('0x53')][_0x1172('0x4c')](_0x1bf538)['then'](function(_0x384eb1){return[_0x384eb1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1172('0x57')](function(_0x1eea9a,_0x34323e){if(_0x1eea9a){_0xeb6580=_0x34323e;if(!_0x34323e){return _0x1eea9a[_0x1172('0x58')]({'inReplyTo':_0x3c82d4[_0x1172('0x27')]['message'][_0x1172('0x4e')],'to':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x31')],'cc':_0x3c82d4[_0x1172('0x27')]['message']['cc'],'subject':_0x3c82d4['body'][_0x1172('0x16')]['subject'],'attach':_0x1eea9a['attach']?_0x1eea9a[_0x1172('0x50')]:_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')]['attach'],'substatus':null,'substatusAt':moment()[_0x1172('0x51')](_0x1172('0x52')),'lastMsgAt':moment()[_0x1172('0x51')](_0x1172('0x52')),'lastMsgDirection':'in'});}else{return _0x1eea9a;}}})[_0x1172('0x21')](function(_0x80f8f7){_0x143ff1[_0x1172('0x59')]=_0x80f8f7[_0x1172('0x41')]({'plain':!![]});_0x143ff1[_0x1172('0x59')][_0x1172('0x5a')]=_0xeb6580;return db[_0x1172('0x54')][_0x1172('0x4c')]({'body':_0x3c82d4['body']['body'],'MailAccountId':_0x3c82d4['account']['id'],'MailInteractionId':_0x80f8f7['id'],'direction':'in','ContactId':_0x143ff1[_0x1172('0x5b')]['id'],'messageId':_0x3c82d4['body'][_0x1172('0x16')]['messageId'],'from':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x31')],'to':_0x3c82d4['body'][_0x1172('0x16')]['to'],'cc':_0x3c82d4['body']['message']['cc'],'subject':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')]['subject'],'attach':_0x3c82d4['body'][_0x1172('0x16')][_0x1172('0x50')],'Attachments':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x5c')],'originTo':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x5d')],'originCc':_0x3c82d4[_0x1172('0x27')]['message']['originCc'],'bcc':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')]['bcc'],'ChatWebsiteId':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')]['ChatWebsiteId']||null,'originChannel':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x5e')]||_0x1172('0x5f'),'ChatOfflineMessageId':_0x3c82d4[_0x1172('0x27')][_0x1172('0x16')][_0x1172('0x60')]||null},{'include':[{'model':db[_0x1172('0x61')],'as':_0x1172('0x62')}]});})[_0x1172('0x21')](function(_0x4d25a5){_0x143ff1['message']=_0x4d25a5;if(_0x143ff1[_0x1172('0x59')][_0x1172('0x63')]){return db[_0x1172('0x64')][_0x1172('0x25')]({'attributes':['id',_0x1172('0x65')],'where':{'id':_0x143ff1[_0x1172('0x59')][_0x1172('0x63')]}})[_0x1172('0x21')](function(_0x5e1042){if(_0x5e1042){_0x143ff1[_0x1172('0x42')][_0x1172('0x66')]({'id':0x0,'priority':0x0,'app':_0x1172('0x67'),'appdata':_0x5e1042[_0x1172('0x65')]+','+(_0x143ff1[_0x1172('0x38')][_0x1172('0x68')]||0xa),'interval':_0x1172('0x49')});}return respondWithRpcPromise('Start',_0x1172('0x69'),_0x143ff1);});}return respondWithRpcPromise(_0x1172('0x6a'),_0x1172('0x69'),_0x143ff1);})[_0x1172('0x21')](function(_0x87c96f){_0xd20c7c(_0x87c96f);})[_0x1172('0x18')](function(_0x48143a){_0x163d48(_0x1adb70[_0x1172('0x14')](0x1f4,_0x48143a[_0x1172('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a6a59e4..35bb431 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 _0xd90c=['emit','removeListener','register','length','mailAccount:','save','remove'];(function(_0x35adef,_0x463819){var _0x2135b0=function(_0x43dd5c){while(--_0x43dd5c){_0x35adef['push'](_0x35adef['shift']());}};_0x2135b0(++_0x463819);}(_0xd90c,0x194));var _0xcd90=function(_0x5e7fa3,_0x537559){_0x5e7fa3=_0x5e7fa3-0x0;var _0x323185=_0xd90c[_0x5e7fa3];return _0x323185;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xcd90('0x0'),_0xcd90('0x1'),'update'];function createListener(_0x3baf7e,_0x20e2b8){return function(_0x43b472){_0x20e2b8[_0xcd90('0x2')](_0x3baf7e,_0x43b472);};}function removeListener(_0x125a67,_0x512dc2){return function(){MailAccountEvents[_0xcd90('0x3')](_0x125a67,_0x512dc2);};}exports[_0xcd90('0x4')]=function(_0x51eb17){for(var _0xf2c4ce=0x0,_0x4a70f3=events[_0xcd90('0x5')];_0xf2c4ce<_0x4a70f3;_0xf2c4ce++){var _0x435116=events[_0xf2c4ce];var _0x468f67=createListener(_0xcd90('0x6')+_0x435116,_0x51eb17);MailAccountEvents['on'](_0x435116,_0x468f67);}}; \ No newline at end of file +var _0xaed4=['remove','update','emit','removeListener','register','length','./mailAccount.events'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xaed4,0xf4));var _0x4aed=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xaed4[_0x369151];return _0x4292d5;};'use strict';var MailAccountEvents=require(_0x4aed('0x0'));var events=['save',_0x4aed('0x1'),_0x4aed('0x2')];function createListener(_0x46455e,_0x44ff08){return function(_0x532158){_0x44ff08[_0x4aed('0x3')](_0x46455e,_0x532158);};}function removeListener(_0x368f78,_0x1e413b){return function(){MailAccountEvents[_0x4aed('0x4')](_0x368f78,_0x1e413b);};}exports[_0x4aed('0x5')]=function(_0x4ed9ed){for(var _0x33cb6b=0x0,_0x44dd26=events[_0x4aed('0x6')];_0x33cb6b<_0x44dd26;_0x33cb6b++){var _0x404afa=events[_0x33cb6b];var _0x176cd1=createListener('mailAccount:'+_0x404afa,_0x4ed9ed);MailAccountEvents['on'](_0x404afa,_0x176cd1);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1b02964..f8135a8 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 _0x77a2=['isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','./mailApplication.controller','get','/:id'];(function(_0xa8c76f,_0x3c67a8){var _0x29b564=function(_0x2073d7){while(--_0x2073d7){_0xa8c76f['push'](_0xa8c76f['shift']());}};_0x29b564(++_0x3c67a8);}(_0x77a2,0x151));var _0x277a=function(_0x55fdc2,_0x667855){_0x55fdc2=_0x55fdc2-0x0;var _0x23476b=_0x77a2[_0x55fdc2];return _0x23476b;};'use strict';var multer=require('multer');var util=require(_0x277a('0x0'));var path=require(_0x277a('0x1'));var timeout=require(_0x277a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x277a('0x3'));var auth=require(_0x277a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x277a('0x5'));router[_0x277a('0x6')](_0x277a('0x7'),auth[_0x277a('0x8')](),controller[_0x277a('0x9')]);router[_0x277a('0xa')](_0x277a('0x7'),auth[_0x277a('0x8')](),controller[_0x277a('0xb')]);router[_0x277a('0xc')](_0x277a('0x7'),auth[_0x277a('0x8')](),controller[_0x277a('0xd')]);module[_0x277a('0xe')]=router; \ No newline at end of file +var _0x7873=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7873,0xcd));var _0x3787=function(_0x450adb,_0x5bdf4f){_0x450adb=_0x450adb-0x0;var _0x6e0025=_0x7873[_0x450adb];return _0x6e0025;};'use strict';var multer=require(_0x3787('0x0'));var util=require('util');var path=require(_0x3787('0x1'));var timeout=require(_0x3787('0x2'));var express=require(_0x3787('0x3'));var router=express[_0x3787('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3787('0x5'));var interaction=require(_0x3787('0x6'));var config=require(_0x3787('0x7'));var controller=require('./mailApplication.controller');router[_0x3787('0x8')](_0x3787('0x9'),auth['isAuthenticated'](),controller[_0x3787('0xa')]);router[_0x3787('0xb')]('/:id',auth[_0x3787('0xc')](),controller[_0x3787('0xd')]);router[_0x3787('0xe')](_0x3787('0x9'),auth[_0x3787('0xc')](),controller[_0x3787('0xf')]);module[_0x3787('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f229458..6c1ed80 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 _0x3e73=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x46bffd,_0xdea53e){var _0x2d73ed=function(_0x2c1508){while(--_0x2c1508){_0x46bffd['push'](_0x46bffd['shift']());}};_0x2d73ed(++_0xdea53e);}(_0x3e73,0x8c));var _0x33e7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3e73[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x33e7('0x0'));module[_0x33e7('0x1')]={'priority':{'type':Sequelize[_0x33e7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x33e7('0x3')],'allowNull':![],'defaultValue':_0x33e7('0x4')},'appdata':{'type':Sequelize[_0x33e7('0x5')]()},'description':{'type':Sequelize[_0x33e7('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x33e7('0x6')}}; \ No newline at end of file +var _0x64bd=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x3159da,_0x6cffda){var _0x17e4bd=function(_0x4f57a4){while(--_0x4f57a4){_0x3159da['push'](_0x3159da['shift']());}};_0x17e4bd(++_0x6cffda);}(_0x64bd,0xeb));var _0xd64b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x64bd[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xd64b('0x0'));module[_0xd64b('0x1')]={'priority':{'type':Sequelize[_0xd64b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd64b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd64b('0x3')],'defaultValue':_0xd64b('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d3c9381..f173a06 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x4a0b33,_0x2bae9b){var _0x91975c=function(_0x143f94){while(--_0x143f94){_0x4a0b33['push'](_0x4a0b33['shift']());}};_0x91975c(++_0x2bae9b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1cb4f3,_0x105b33){_0x1cb4f3=_0x1cb4f3-0x0;var _0x1d7356=_0xb43b[_0x1cb4f3];return _0x1d7356;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x4e0578,_0x4485a1){var _0x4649b8=function(_0x2aed2c){while(--_0x2aed2c){_0x4e0578['push'](_0x4e0578['shift']());}};_0x4649b8(++_0x4485a1);}(_0xac4a,0x13f));var _0xaac4=function(_0x53de99,_0x9e7179){_0x53de99=_0x53de99-0x0;var _0x4234ea=_0xac4a[_0x53de99];return _0x4234ea;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 211301c..7c3941d 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 _0x1ee1=['./mailApplication.attributes','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1ee1,0x1b2));var _0x11ee=function(_0x16dc09,_0x47389a){_0x16dc09=_0x16dc09-0x0;var _0x47ea56=_0x1ee1[_0x16dc09];return _0x47ea56;};'use strict';var _=require(_0x11ee('0x0'));var util=require(_0x11ee('0x1'));var logger=require('../../config/logger')(_0x11ee('0x2'));var moment=require(_0x11ee('0x3'));var BPromise=require('bluebird');var rp=require(_0x11ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11ee('0x5'));var config=require('../../config/environment');var attributes=require(_0x11ee('0x6'));module['exports']=function(_0x2875bb,_0x52ef49){return _0x2875bb[_0x11ee('0x7')]('MailApplication',attributes,{'tableName':_0x11ee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x11ee('0x9'),'collate':_0x11ee('0xa')});}; \ No newline at end of file +var _0xc03b=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5a625e,_0x587615){var _0x8a53fb=function(_0x33d59b){while(--_0x33d59b){_0x5a625e['push'](_0x5a625e['shift']());}};_0x8a53fb(++_0x587615);}(_0xc03b,0xdc));var _0xbc03=function(_0x37d9b1,_0x358b0d){_0x37d9b1=_0x37d9b1-0x0;var _0x580044=_0xc03b[_0x37d9b1];return _0x580044;};'use strict';var _=require(_0xbc03('0x0'));var util=require(_0xbc03('0x1'));var logger=require(_0xbc03('0x2'))(_0xbc03('0x3'));var moment=require(_0xbc03('0x4'));var BPromise=require(_0xbc03('0x5'));var rp=require(_0xbc03('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc03('0x7'));var config=require(_0xbc03('0x8'));var attributes=require(_0xbc03('0x9'));module[_0xbc03('0xa')]=function(_0x6ca92e,_0x44acb1){return _0x6ca92e[_0xbc03('0xb')](_0xbc03('0xc'),attributes,{'tableName':_0xbc03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc03('0xe'),'collate':_0xbc03('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b02b09b..3eae747 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 _0xabd7=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailApplication','body','raw','options','attributes','UpdateMailApplication','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xabd7,0x189));var _0x7abd=function(_0x3d0332,_0x31dbf3){_0x3d0332=_0x3d0332-0x0;var _0x4e5fd1=_0xabd7[_0x3d0332];return _0x4e5fd1;};'use strict';var _=require(_0x7abd('0x0'));var util=require('util');var moment=require(_0x7abd('0x1'));var BPromise=require(_0x7abd('0x2'));var rs=require(_0x7abd('0x3'));var fs=require('fs');var Redis=require(_0x7abd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7abd('0x5'));var logger=require(_0x7abd('0x6'))(_0x7abd('0x7'));var config=require(_0x7abd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7abd('0x9')][_0x7abd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fc5d9,_0x321050,_0x85b861){return new BPromise(function(_0x294db9,_0x377c40){return client[_0x7abd('0xb')](_0x1fc5d9,_0x85b861)[_0x7abd('0xc')](function(_0x535163){logger[_0x7abd('0xd')](_0x7abd('0xe'),_0x321050,_0x7abd('0xf'));logger[_0x7abd('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x321050,_0x7abd('0xf'),JSON[_0x7abd('0x11')](_0x535163));if(_0x535163[_0x7abd('0x12')]){if(_0x535163[_0x7abd('0x12')][_0x7abd('0x13')]===0x1f4){logger[_0x7abd('0x12')](_0x7abd('0xe'),_0x321050,_0x535163[_0x7abd('0x12')][_0x7abd('0x14')]);return _0x377c40(_0x535163[_0x7abd('0x12')][_0x7abd('0x14')]);}logger['error'](_0x7abd('0xe'),_0x321050,_0x535163['error'][_0x7abd('0x14')]);return _0x294db9(_0x535163[_0x7abd('0x12')][_0x7abd('0x14')]);}else{logger[_0x7abd('0xd')](_0x7abd('0xe'),_0x321050,_0x7abd('0xf'));_0x294db9(_0x535163[_0x7abd('0x15')]['message']);}})[_0x7abd('0x16')](function(_0x40f96e){logger[_0x7abd('0x12')](_0x7abd('0xe'),_0x321050,_0x40f96e);_0x377c40(_0x40f96e);});});}exports['UpdateMailApplication']=function(_0x1de934){var _0x46c9d5=this;return new Promise(function(_0x2574d,_0x1e6b25){return db[_0x7abd('0x17')]['update'](_0x1de934[_0x7abd('0x18')],{'raw':_0x1de934['options']?_0x1de934['options'][_0x7abd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de934[_0x7abd('0x1a')]?_0x1de934[_0x7abd('0x1a')]['where']||null:null,'attributes':_0x1de934[_0x7abd('0x1a')]?_0x1de934[_0x7abd('0x1a')][_0x7abd('0x1b')]||null:null,'limit':_0x1de934[_0x7abd('0x1a')]?_0x1de934[_0x7abd('0x1a')]['limit']||null:null})['then'](function(_0x21142c){logger['info']('UpdateMailApplication',_0x1de934);logger['debug'](_0x7abd('0x1c'),_0x1de934,JSON[_0x7abd('0x11')](_0x21142c));_0x2574d(_0x21142c);})[_0x7abd('0x16')](function(_0x42511c){logger[_0x7abd('0x12')]('UpdateMailApplication',_0x42511c['message'],_0x1de934);_0x1e6b25(_0x46c9d5[_0x7abd('0x12')](0x1f4,_0x42511c[_0x7abd('0x14')]));});});}; \ No newline at end of file +var _0x247a=['limit','then','debug','catch','lodash','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','info','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','request\x20sent','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x247a,0xcc));var _0xa247=function(_0x6af1b1,_0x4ccf9e){_0x6af1b1=_0x6af1b1-0x0;var _0x139dae=_0x247a[_0x6af1b1];return _0x139dae;};'use strict';var _=require(_0xa247('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(_0xa247('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xa247('0x2'))('rpc');var config=require(_0xa247('0x3'));var jayson=require(_0xa247('0x4'));var client=jayson[_0xa247('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bcf2e,_0x1933dc,_0x5e2ce7){return new BPromise(function(_0xbe0535,_0x44f2cd){return client['request'](_0x1bcf2e,_0x5e2ce7)['then'](function(_0x5e4529){logger[_0xa247('0x6')]('MailApplication,\x20%s,\x20%s',_0x1933dc,'request\x20sent');logger['debug'](_0xa247('0x7'),_0x1933dc,'request\x20sent',JSON[_0xa247('0x8')](_0x5e4529));if(_0x5e4529[_0xa247('0x9')]){if(_0x5e4529['error']['code']===0x1f4){logger[_0xa247('0x9')](_0xa247('0xa'),_0x1933dc,_0x5e4529[_0xa247('0x9')]['message']);return _0x44f2cd(_0x5e4529['error'][_0xa247('0xb')]);}logger[_0xa247('0x9')](_0xa247('0xa'),_0x1933dc,_0x5e4529['error']['message']);return _0xbe0535(_0x5e4529['error'][_0xa247('0xb')]);}else{logger[_0xa247('0x6')](_0xa247('0xa'),_0x1933dc,_0xa247('0xc'));_0xbe0535(_0x5e4529['result'][_0xa247('0xb')]);}})['catch'](function(_0x84942){logger[_0xa247('0x9')]('MailApplication,\x20%s,\x20%s',_0x1933dc,_0x84942);_0x44f2cd(_0x84942);});});}exports[_0xa247('0xd')]=function(_0x193ac3){var _0x588311=this;return new Promise(function(_0x1e6ebc,_0x2ce98d){return db[_0xa247('0xe')][_0xa247('0xf')](_0x193ac3[_0xa247('0x10')],{'raw':_0x193ac3[_0xa247('0x11')]?_0x193ac3[_0xa247('0x11')][_0xa247('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x193ac3['options']?_0x193ac3[_0xa247('0x11')][_0xa247('0x13')]||null:null,'attributes':_0x193ac3['options']?_0x193ac3['options'][_0xa247('0x14')]||null:null,'limit':_0x193ac3['options']?_0x193ac3[_0xa247('0x11')][_0xa247('0x15')]||null:null})[_0xa247('0x16')](function(_0x3716b5){logger[_0xa247('0x6')](_0xa247('0xd'),_0x193ac3);logger[_0xa247('0x17')](_0xa247('0xd'),_0x193ac3,JSON[_0xa247('0x8')](_0x3716b5));_0x1e6ebc(_0x3716b5);})[_0xa247('0x18')](function(_0x1a3666){logger[_0xa247('0x9')](_0xa247('0xd'),_0x1a3666['message'],_0x193ac3);_0x2ce98d(_0x588311['error'](0x1f4,_0x1a3666['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 952c48a..0a38080 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 _0x2fc5=['/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage'];(function(_0x34986b,_0x56fb4a){var _0x28a0d1=function(_0x2c1e2a){while(--_0x2c1e2a){_0x34986b['push'](_0x34986b['shift']());}};_0x28a0d1(++_0x56fb4a);}(_0x2fc5,0x1aa));var _0x52fc=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0x2fc5[_0x2bb3f6];return _0x62b339;};'use strict';var express=require(_0x52fc('0x0'));var router=express[_0x52fc('0x1')]();var auth=require(_0x52fc('0x2'));var interaction=require(_0x52fc('0x3'));var controller=require(_0x52fc('0x4'));router[_0x52fc('0x5')]('/',auth[_0x52fc('0x6')](),controller[_0x52fc('0x7')]);router[_0x52fc('0x5')](_0x52fc('0x8'),auth[_0x52fc('0x6')](),controller['describe']);router[_0x52fc('0x5')](_0x52fc('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x52fc('0x5')](_0x52fc('0xa'),auth[_0x52fc('0x6')](),controller[_0x52fc('0xb')]);router[_0x52fc('0x5')](_0x52fc('0xc'),auth[_0x52fc('0x6')](),controller[_0x52fc('0xd')]);router[_0x52fc('0xe')]('/',auth[_0x52fc('0x6')](),controller['create']);router[_0x52fc('0xe')](_0x52fc('0xa'),auth[_0x52fc('0x6')](),controller[_0x52fc('0xf')]);router[_0x52fc('0xe')](_0x52fc('0x10'),auth[_0x52fc('0x6')](),interaction[_0x52fc('0x11')](_0x52fc('0x12'),'mailinteraction:addtags'),controller[_0x52fc('0x13')]);router[_0x52fc('0x14')](_0x52fc('0x9'),auth[_0x52fc('0x6')](),interaction[_0x52fc('0x11')](_0x52fc('0x12'),_0x52fc('0x15')),controller[_0x52fc('0x16')]);router[_0x52fc('0x17')](_0x52fc('0x9'),auth[_0x52fc('0x6')](),interaction[_0x52fc('0x11')](_0x52fc('0x12'),_0x52fc('0x18')),controller['destroy']);router['delete'](_0x52fc('0x10'),auth[_0x52fc('0x6')](),controller[_0x52fc('0x19')]);module['exports']=router; \ No newline at end of file +var _0x2a67=['Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','tracked','mailinteraction:update','delete','mailinteraction:destroy','destroy','exports'];(function(_0x2cc700,_0x1c9c9b){var _0x4c1171=function(_0x16a7e4){while(--_0x16a7e4){_0x2cc700['push'](_0x2cc700['shift']());}};_0x4c1171(++_0x1c9c9b);}(_0x2a67,0xaf));var _0x72a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a67[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x72a6('0x0')]();var auth=require(_0x72a6('0x1'));var interaction=require(_0x72a6('0x2'));var controller=require(_0x72a6('0x3'));router[_0x72a6('0x4')]('/',auth['isAuthenticated'](),controller[_0x72a6('0x5')]);router[_0x72a6('0x4')](_0x72a6('0x6'),auth['isAuthenticated'](),controller[_0x72a6('0x7')]);router['get'](_0x72a6('0x8'),auth[_0x72a6('0x9')](),controller['show']);router[_0x72a6('0x4')](_0x72a6('0xa'),auth[_0x72a6('0x9')](),controller[_0x72a6('0xb')]);router[_0x72a6('0x4')]('/:id/download',auth['isAuthenticated'](),controller[_0x72a6('0xc')]);router[_0x72a6('0xd')]('/',auth['isAuthenticated'](),controller[_0x72a6('0xe')]);router[_0x72a6('0xd')](_0x72a6('0xa'),auth[_0x72a6('0x9')](),controller[_0x72a6('0xf')]);router['post'](_0x72a6('0x10'),auth[_0x72a6('0x9')](),interaction['tracked'](_0x72a6('0x11'),_0x72a6('0x12')),controller['addTags']);router['put']('/:id',auth[_0x72a6('0x9')](),interaction[_0x72a6('0x13')](_0x72a6('0x11'),_0x72a6('0x14')),controller['update']);router[_0x72a6('0x15')](_0x72a6('0x8'),auth['isAuthenticated'](),interaction[_0x72a6('0x13')](_0x72a6('0x11'),_0x72a6('0x16')),controller[_0x72a6('0x17')]);router['delete'](_0x72a6('0x10'),auth['isAuthenticated'](),controller['removeTags']);module[_0x72a6('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index e77a625..9bfe5ec 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 _0xaed9=['TEXT','long','BOOLEAN','ENUM','out','sequelize','iconv','DATE','STRING'];(function(_0x3af645,_0x336711){var _0x4e3002=function(_0x410f08){while(--_0x410f08){_0x3af645['push'](_0x3af645['shift']());}};_0x4e3002(++_0x336711);}(_0xaed9,0x11c));var _0x9aed=function(_0x49dd01,_0x3c7496){_0x49dd01=_0x49dd01-0x0;var _0x9bfc6e=_0xaed9[_0x49dd01];return _0x9bfc6e;};'use strict';var Sequelize=require(_0x9aed('0x0'));var iconv=require(_0x9aed('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9aed('0x2')]},'disposition':{'type':Sequelize[_0x9aed('0x3')]},'secondDisposition':{'type':Sequelize[_0x9aed('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9aed('0x3')]},'note':{'type':Sequelize[_0x9aed('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x9aed('0x3')]},'cc':{'type':Sequelize[_0x9aed('0x4')](_0x9aed('0x5'))},'subject':{'type':Sequelize[_0x9aed('0x4')]()},'attach':{'type':Sequelize[_0x9aed('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9aed('0x2')]},'substatus':{'type':Sequelize[_0x9aed('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x9aed('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x9aed('0x7')]('in',_0x9aed('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9aed('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9aed('0x7')]('in',_0x9aed('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9aed('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x9412=['DATE','STRING','long','TEXT','BOOLEAN','out','ENUM','sequelize','iconv'];(function(_0x150e70,_0x36c06b){var _0x51ebb9=function(_0x2a16c7){while(--_0x2a16c7){_0x150e70['push'](_0x150e70['shift']());}};_0x51ebb9(++_0x36c06b);}(_0x9412,0x8e));var _0x2941=function(_0x36f72f,_0x4ffea3){_0x36f72f=_0x36f72f-0x0;var _0xea2851=_0x9412[_0x36f72f];return _0xea2851;};'use strict';var Sequelize=require(_0x2941('0x0'));var iconv=require(_0x2941('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2941('0x2')]},'disposition':{'type':Sequelize[_0x2941('0x3')]},'secondDisposition':{'type':Sequelize[_0x2941('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2941('0x3')]},'note':{'type':Sequelize[_0x2941('0x3')]},'inReplyTo':{'type':Sequelize[_0x2941('0x3')](0x1fe)},'to':{'type':Sequelize[_0x2941('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x2941('0x4'))},'subject':{'type':Sequelize[_0x2941('0x5')]()},'attach':{'type':Sequelize[_0x2941('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x2941('0x2')]},'substatus':{'type':Sequelize[_0x2941('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x2941('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x2941('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2941('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2941('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e4cf6e3..af82f48 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 _0xb0df=['union','User','$substring','some','compact','isEmpty','MailAccountId','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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','i.subject','i.disposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','MailInteraction','includeAll','include','merge','options','create','body','describe','MailMessage','addMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','send','Users','map','fullname','Tags','TagIds','forEach','push','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','closed','UserId','total','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xb0df,0x85));var _0xfb0d=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xb0df[_0x57b432];return _0x2edf2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb0d('0x0'));var zipdir=require(_0xfb0d('0x1'));var moment=require(_0xfb0d('0x2'));var BPromise=require(_0xfb0d('0x3'));var util=require(_0xfb0d('0x4'));var path=require(_0xfb0d('0x5'));var fs=require('fs');var _=require(_0xfb0d('0x6'));var squel=require(_0xfb0d('0x7'));var juice=require(_0xfb0d('0x8'));var Redis=require('ioredis');var qs=require(_0xfb0d('0x9'));var as=require(_0xfb0d('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xfb0d('0xb'));var db=require(_0xfb0d('0xc'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0xfb0d('0xd')](config[_0xfb0d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xfb0d('0xf'))(new Redis(config[_0xfb0d('0xe')]));require(_0xfb0d('0x10'))[_0xfb0d('0x11')](socket);function respondWithStatusCode(_0xf6ee9b,_0x154c31){_0x154c31=_0x154c31||0xcc;return function(_0x4936a1){if(_0x4936a1){return _0xf6ee9b[_0xfb0d('0x12')](_0x154c31);}return _0xf6ee9b['status'](_0x154c31)[_0xfb0d('0x13')]();};}function respondWithResult(_0x335172,_0x254576){_0x254576=_0x254576||0xc8;return function(_0x2e9f20){if(_0x2e9f20){return _0x335172[_0xfb0d('0x14')](_0x254576)[_0xfb0d('0x15')](_0x2e9f20);}};}function respondWithFilteredResult(_0x303aa3,_0x587b3a){return function(_0x505e22){if(_0x505e22){var _0x5b7e54=typeof _0x587b3a[_0xfb0d('0x16')]===_0xfb0d('0x17')&&typeof _0x587b3a[_0xfb0d('0x18')]===_0xfb0d('0x17');var _0x38c64b=_0x505e22[_0xfb0d('0x19')];var _0xced21c=_0x5b7e54?0x0:_0x587b3a['offset'];var _0x77e8e7=_0x5b7e54?_0x505e22[_0xfb0d('0x19')]:_0x587b3a[_0xfb0d('0x16')]+_0x587b3a[_0xfb0d('0x18')];var _0x58b1cc;if(_0x77e8e7>=_0x38c64b){_0x77e8e7=_0x38c64b;_0x58b1cc=0xc8;}else{_0x58b1cc=0xce;}_0x303aa3[_0xfb0d('0x14')](_0x58b1cc);return _0x303aa3[_0xfb0d('0x1a')](_0xfb0d('0x1b'),_0xced21c+'-'+_0x77e8e7+'/'+_0x38c64b)[_0xfb0d('0x15')](_0x505e22);}return null;};}function saveUpdates(_0x190c64){return function(_0x1d4217){if(_0x1d4217){return _0x1d4217[_0xfb0d('0x1c')](_0x190c64)['then'](function(_0x1b869f){return _0x1b869f;});}return null;};}function removeEntity(_0xa5da11){return function(_0x2baa88){if(_0x2baa88){return _0x2baa88[_0xfb0d('0x1d')]()[_0xfb0d('0x1e')](function(){_0xa5da11[_0xfb0d('0x14')](0xcc)[_0xfb0d('0x13')]();});}};}function handleEntityNotFound(_0x27a5cf){return function(_0x391ec6){if(!_0x391ec6){_0x27a5cf[_0xfb0d('0x12')](0x194);}return _0x391ec6;};}function handleError(_0x3411cb,_0x5ef220){_0x5ef220=_0x5ef220||0x1f4;return function(_0x4f605a){logger[_0xfb0d('0x1f')](_0x4f605a[_0xfb0d('0x20')]);if(_0x4f605a['name']){delete _0x4f605a['name'];}_0x3411cb[_0xfb0d('0x14')](_0x5ef220)[_0xfb0d('0x21')](_0x4f605a);};}function getInteractionUsers(_0x5a1e63,_0x85663a){return new BPromise(function(_0x29be8f,_0x1c234c){try{if(_0x85663a[_0x5a1e63['id']]){_0x5a1e63[_0xfb0d('0x22')]=_[_0xfb0d('0x23')](_0x85663a[_0x5a1e63['id']],function(_0x10c1f9){return{'id':_0x10c1f9['id'],'fullname':_0x10c1f9[_0xfb0d('0x24')]};});}}catch(_0x373373){_0x1c234c(_0x373373);}_0x29be8f(_0x5a1e63);});}function getInteractionTags(_0x2d5f75,_0x31496e){return new BPromise(function(_0x1c6770,_0x803bdd){try{if(_0x2d5f75['TagIds']){_0x2d5f75[_0xfb0d('0x25')]=[];_0x2d5f75[_0xfb0d('0x26')]['split'](',')[_0xfb0d('0x27')](function(_0x2a2838){_0x2d5f75[_0xfb0d('0x25')][_0xfb0d('0x28')](_0x31496e[_0x2a2838]);});}delete _0x2d5f75['TagIds'];}catch(_0x4fb6ba){_0x803bdd(_0x4fb6ba);}_0x1c6770(_0x2d5f75);});}function getLastMessageText(_0x421a23){return new BPromise(function(_0x4c4c8f,_0x21f005){return db['MailMessage'][_0xfb0d('0x29')]({'where':{'$and':[{'MailInteractionId':_0x421a23['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xfb0d('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xfb0d('0x2b')],'order':_0xfb0d('0x2c'),'raw':!![]})['then'](function(_0x4839e7){if(_0x4839e7&&_0x4839e7[_0xfb0d('0x2b')]){_0x421a23[_0xfb0d('0x2d')]=_[_0xfb0d('0x2e')](_0x4839e7[_0xfb0d('0x2b')]);}_0x4c4c8f(_0x421a23);})['catch'](function(_0x162d86){_0x21f005(_0x162d86);});});}function updateMailInteraction(_0x4e2c40,_0xc54535,_0x5987db,_0x2640a6){return new BPromise(function(_0x45e7e9,_0x470071){return getInteractionUsers(_0x4e2c40,_0x5987db)[_0xfb0d('0x1e')](function(_0x608b28){return getInteractionTags(_0x608b28,_0xc54535);})[_0xfb0d('0x1e')](function(_0x5a1c0d){return getStateInteraction(_0x5a1c0d);})[_0xfb0d('0x1e')](function(_0x3e9206){if(_0x2640a6){_0x45e7e9(getLastMessageText(_0x3e9206));}else{_0x45e7e9(_0x3e9206);}})[_0xfb0d('0x2f')](function(_0x394c85){_0x470071(_0x394c85);});});}function getStateInteraction(_0x404e26){return new BPromise(function(_0x5278aa){_0x404e26[_0xfb0d('0x30')]=0x0;_0x404e26[_0xfb0d('0x31')]=0x0;_0x404e26[_0xfb0d('0x32')]=0x0;_0x404e26[_0xfb0d('0x33')]=0x0;_0x404e26['total']=0x0;if(!_0x404e26['closed']&&!_0x404e26['UserId']){_0x404e26[_0xfb0d('0x30')]+=0x1;}if(!_0x404e26[_0xfb0d('0x34')]&&_0x404e26[_0xfb0d('0x35')]){_0x404e26[_0xfb0d('0x31')]+=0x1;if(_0x404e26[_0xfb0d('0x30')]){_0x404e26[_0xfb0d('0x30')]-=0x1;}}if(_0x404e26[_0xfb0d('0x34')]&&_0x404e26['UserId']){_0x404e26[_0xfb0d('0x32')]+=0x1;if(_0x404e26[_0xfb0d('0x31')]){_0x404e26['talking']-=0x1;}}if(_0x404e26['closed']&&!_0x404e26[_0xfb0d('0x35')]){_0x404e26[_0xfb0d('0x33')]+=0x1;if(_0x404e26[_0xfb0d('0x30')]){_0x404e26[_0xfb0d('0x30')]-=0x1;}}_0x404e26[_0xfb0d('0x36')]+=0x1;_0x5278aa(_0x404e26);});}exports['index']=function(_0x6113e6,_0x211db5){var _0x3e1072={},_0x3020b4={},_0x4e8a83={'count':0x0,'rows':[]};var _0x46dc01=_[_0xfb0d('0x23')](db['MailInteraction'][_0xfb0d('0x37')],function(_0x3415ca){return{'name':_0x3415ca[_0xfb0d('0x38')],'type':_0x3415ca[_0xfb0d('0x39')][_0xfb0d('0x3a')]};});_0x3020b4[_0xfb0d('0x3b')]=_['map'](_0x46dc01,_0xfb0d('0x3c'));_0x3020b4[_0xfb0d('0x3d')]=_[_0xfb0d('0x3e')](_0x6113e6['query']);_0x3020b4[_0xfb0d('0x3f')]=_[_0xfb0d('0x40')](_0x3020b4['model'],_0x3020b4[_0xfb0d('0x3d')]);_0x3e1072['attributes']=_[_0xfb0d('0x40')](_0x3020b4[_0xfb0d('0x3b')],qs['fields'](_0x6113e6['query'][_0xfb0d('0x41')]));_0x3e1072['attributes']=_0x3e1072[_0xfb0d('0x42')][_0xfb0d('0x43')]?_0x3e1072[_0xfb0d('0x42')]:_0x3020b4[_0xfb0d('0x3b')];if(!_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x44')](_0xfb0d('0x45'))){_0x3e1072['limit']=qs[_0xfb0d('0x18')](_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x18')]);_0x3e1072[_0xfb0d('0x16')]=qs[_0xfb0d('0x16')](_0x6113e6['query'][_0xfb0d('0x16')]);}_0x3e1072['order']=qs[_0xfb0d('0x46')](_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x46')]);_0x3e1072[_0xfb0d('0x47')]=qs[_0xfb0d('0x3f')](_[_0xfb0d('0x48')](_0x6113e6[_0xfb0d('0x3d')],_0x3020b4['filters']),_0x46dc01);var _0x356f7c=[];var _0x34fbd0=squel[_0xfb0d('0x49')]()[_0xfb0d('0x4a')]('id')[_0xfb0d('0x4a')](_0xfb0d('0x3c'))['field'](_0xfb0d('0x4b'))[_0xfb0d('0x4c')]('tools_tags');var _0x23d3cf=squel['select']()['field'](_0xfb0d('0x4d'))[_0xfb0d('0x4a')](_0xfb0d('0x4e'))['field'](_0xfb0d('0x4f'))[_0xfb0d('0x4c')](_0xfb0d('0x50'),'ui')[_0xfb0d('0x51')](_0xfb0d('0x52'),'u',_0xfb0d('0x53'));var _0x25ba79=squel[_0xfb0d('0x49')]()[_0xfb0d('0x4c')]('mail_interactions','i')[_0xfb0d('0x51')]('cm_contacts','c',_0xfb0d('0x54'))['left_join'](_0xfb0d('0x52'),'o','o.id\x20=\x20i.UserId')[_0xfb0d('0x51')]('mail_accounts','a',_0xfb0d('0x55'))[_0xfb0d('0x51')]('mail_messages','me',_0xfb0d('0x56'))[_0xfb0d('0x51')](_0xfb0d('0x57'),'it',_0xfb0d('0x58'))[_0xfb0d('0x51')]('tools_tags','t',_0xfb0d('0x59'));var _0x5735bb=squel[_0xfb0d('0x5a')]();var _0x27923b=[];var _0x453f3f=squel['expr']();var _0x32e1f8;if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x5b')]){_0x32e1f8=as[_0xfb0d('0x5c')](_0x6113e6['query'][_0xfb0d('0x5b')]);var _0x30f6f4=_0x32e1f8[_0xfb0d('0x5d')];for(var _0x38674a=0x0;_0x38674a<_0x32e1f8[_0xfb0d('0x5e')][_0xfb0d('0x43')];_0x38674a++){var _0x3a4433=_0x32e1f8[_0xfb0d('0x5e')][_0x38674a];var _0x4d2b4b='i';var _0x312ada=_[_0xfb0d('0x5f')](_0x46dc01,[_0xfb0d('0x3c'),_0x3a4433['field']]);if(!_0x312ada){switch(_0x3a4433[_0xfb0d('0x4a')]){case _0xfb0d('0x60'):if(_0x3a4433[_0xfb0d('0x61')]==0x1){_0x25ba79[_0xfb0d('0x62')]('`'+_0x3a4433['field']+_0xfb0d('0x63'));}else{_0x25ba79['having']('`'+_0x3a4433[_0xfb0d('0x4a')]+'`\x20>\x200');}break;case _0xfb0d('0x64'):if(_0x3a4433[_0xfb0d('0x65')]==='$substring'){if(_0x3a4433[_0xfb0d('0x61')][_0xfb0d('0x66')]('\x20')[_0xfb0d('0x43')]>0x1){_0x5735bb[_0x30f6f4](_0xfb0d('0x67'),qs[_0xfb0d('0x68')](_0x3a4433[_0xfb0d('0x61')]),null);}else{var _0x43c72f='%'+_0x3a4433['value']+'%';_0x5735bb[_0x30f6f4](_0xfb0d('0x69'),_0x43c72f,_0x43c72f,_0x43c72f);}}else{_0x312ada=_[_0xfb0d('0x5f')](_0x46dc01,['name','ContactId']);_0x3a4433[_0xfb0d('0x4a')]=_0xfb0d('0x6a');_0x4e27e8=as[_0xfb0d('0x6b')](_0x4d2b4b,_0x312ada[_0xfb0d('0x39')],_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8[_0xfb0d('0x6c')],_0x4e27e8['value'][_0xfb0d('0x6d')],_0x4e27e8['value'][_0xfb0d('0x13')]);}break;case _0xfb0d('0x6e'):var _0x2461fb=_0x3a4433['value']['split'](',')[_0xfb0d('0x23')](function(_0x28b103){return Number(_0x28b103);});_0x2461fb[_0xfb0d('0x27')](function(_0x569da9){_0x453f3f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x569da9+',%');});_0x27923b=_[_0xfb0d('0x6f')](_0x27923b,_0x2461fb);break;case _0xfb0d('0x70'):if(_0x3a4433[_0xfb0d('0x65')]===_0xfb0d('0x71')){_0x5735bb[_0x30f6f4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3a4433[_0xfb0d('0x61')]+'%',null);}else{_0x312ada=_[_0xfb0d('0x5f')](_0x46dc01,['name',_0xfb0d('0x35')]);_0x3a4433['field']=_0xfb0d('0x35');_0x4e27e8=as[_0xfb0d('0x6b')](_0x4d2b4b,_0x312ada[_0xfb0d('0x39')],_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8['text'],_0x4e27e8[_0xfb0d('0x61')][_0xfb0d('0x6d')],_0x4e27e8[_0xfb0d('0x61')]['end']);}break;case'plainBody':_0x4e27e8=as['buildExpression']('me',null,_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8[_0xfb0d('0x6c')],_0x4e27e8[_0xfb0d('0x61')]['start'],_0x4e27e8['value'][_0xfb0d('0x13')]);break;}}else{var _0x4e27e8=as[_0xfb0d('0x6b')](_0x4d2b4b,_0x312ada[_0xfb0d('0x39')],_0x3a4433);_0x5735bb[_0x30f6f4](_0x4e27e8['text'],_0x4e27e8[_0xfb0d('0x61')][_0xfb0d('0x6d')],_0x4e27e8['value'][_0xfb0d('0x13')]);}}}else{var _0x4dea17=_(_0x6113e6[_0xfb0d('0x3d')])[_0xfb0d('0x3e')]()[_0xfb0d('0x23')](function(_0xbc2b73){return _[_0xfb0d('0x72')](_0x46dc01,[_0xfb0d('0x3c'),_0xbc2b73])?_0xbc2b73:undefined;})[_0xfb0d('0x73')]()['value']();if(!_[_0xfb0d('0x74')](_0x4dea17)){_0x4dea17['forEach'](function(_0x1ad8a0){if(_0x1ad8a0===_0xfb0d('0x75')){_0x25ba79[_0xfb0d('0x47')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x6113e6[_0xfb0d('0x3d')][_0x1ad8a0]));}else if(_0x1ad8a0==='createdAt'){var _0x2c8dcc=JSON[_0xfb0d('0x76')](_0x6113e6[_0xfb0d('0x3d')][_0x1ad8a0])[_0xfb0d('0x77')];var _0x500bbb=JSON[_0xfb0d('0x76')](_0x6113e6['query'][_0x1ad8a0])['$lte'];_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x78'),_0x2c8dcc,_0x500bbb);}else{if(_0x6113e6[_0xfb0d('0x3d')][_0x1ad8a0]==='null'){_0x25ba79[_0xfb0d('0x47')]('i.'+_0x1ad8a0+_0xfb0d('0x79'));}else{_0x25ba79[_0xfb0d('0x47')]('i.'+_0x1ad8a0+'\x20=\x20?',_0x6113e6['query'][_0x1ad8a0]);}}});}if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7a')]){if(_0x6113e6['query'][_0xfb0d('0x7a')]==0x1){_0x25ba79[_0xfb0d('0x62')](_0xfb0d('0x7b'));}else{_0x25ba79[_0xfb0d('0x62')](_0xfb0d('0x7c'));}}if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')]){_0x27923b=_[_0xfb0d('0x7e')](_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')])?_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')]:new Array(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x7d')]);_0x27923b[_0xfb0d('0x27')](function(_0x47cc17){_0x453f3f['or'](_0xfb0d('0x7f'),'%,'+_0x47cc17+',%');});}if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x80')]){var _0x139aef=_0x6113e6[_0xfb0d('0x3d')]['filter'][_0xfb0d('0x81')]('\x5c','\x5c\x5c')[_0xfb0d('0x81')](/'/g,'\x27\x27');if(qs[_0xfb0d('0x82')](_0x139aef)){_0x5735bb['or'](_0xfb0d('0x83'),_0x139aef+'%');}else if(qs[_0xfb0d('0x84')](_0x139aef)){_0x5735bb['or'](_0xfb0d('0x85'),_0x139aef+'%');}else{_0x5735bb['or'](_0xfb0d('0x86'),qs[_0xfb0d('0x68')](_0x139aef))['or'](_0xfb0d('0x87'),qs[_0xfb0d('0x68')](_0x139aef));}}}_0x25ba79[_0xfb0d('0x47')](_0x5735bb);_0x25ba79[_0xfb0d('0x88')](_0xfb0d('0x89'));var _0x4050a7={'type':db['Sequelize'][_0xfb0d('0x8a')][_0xfb0d('0x8b')],'raw':!![]};var _0x30cf71=_0x25ba79[_0xfb0d('0x8c')]();_0x30cf71[_0xfb0d('0x4a')](_0xfb0d('0x89'));_0x30cf71['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x3e1072['order']){_0x3e1072[_0xfb0d('0x8d')]['forEach'](function(_0x26aebb){var _0xfd5b23=_0x26aebb[0x0]==='contactName'?_0x26aebb[0x0]:'i.'+_0x26aebb[0x0];_0x25ba79[_0xfb0d('0x8d')](_0xfd5b23,_0x26aebb[0x1]===_0xfb0d('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x27923b)){_0x25ba79[_0xfb0d('0x62')](_0x453f3f);_0x30cf71[_0xfb0d('0x47')](_0xfb0d('0x8f'),_0x27923b);}BPromise[_0xfb0d('0x90')]()['then'](function(){if(!_0x32e1f8){if(_0x6113e6[_0xfb0d('0x3d')]['MailAccountId'])return;_0x30cf71[_0xfb0d('0x47')](_0xfb0d('0x91'));_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x91'));return;}if(_0x6113e6['user']['role']!==_0xfb0d('0x92'))return;return _0x6113e6[_0xfb0d('0x93')][_0xfb0d('0x94')]({'attributes':['id'],'raw':!![]})[_0xfb0d('0x1e')](function(_0x4ce28c){if(_['isEmpty'](_0x4ce28c)){_0x30cf71[_0xfb0d('0x47')](_0xfb0d('0x95'));_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x95'));}else{_0x30cf71['where'](_0xfb0d('0x96'),_['map'](_0x4ce28c,'id'));_0x25ba79[_0xfb0d('0x47')](_0xfb0d('0x96'),_['map'](_0x4ce28c,'id'));}});})[_0xfb0d('0x1e')](function(){if(_0x6113e6['user']['role']===_0xfb0d('0x92')&&!_0x32e1f8&&!_0x6113e6['query']['MailAccountId'])return[];return db[_0xfb0d('0x97')]['query'](_0x30cf71[_0xfb0d('0x98')](),_0x4050a7);})['then'](function(_0x5a2d50){_0x4e8a83[_0xfb0d('0x19')]=_0x5a2d50[_0xfb0d('0x43')];if(_0x4e8a83[_0xfb0d('0x19')]===0x0)return[];return db[_0xfb0d('0x97')][_0xfb0d('0x3d')](_0x34fbd0[_0xfb0d('0x98')](),_0x4050a7)['then'](function(_0x297dd5){_0x356f7c=_['keyBy'](_0x297dd5,'id');_0x4050a7=_['merge'](_0x4050a7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6113e6[_0xfb0d('0x3d')][_0xfb0d('0x41')]){_0x3e1072[_0xfb0d('0x42')]['forEach'](function(_0x5650ea){_0x25ba79[_0xfb0d('0x4a')]('i.'+_0x5650ea);});}else{_0x25ba79['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xfb0d('0x60'));_0x25ba79['field'](_0xfb0d('0x99'),_0xfb0d('0x9a'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0x9b'),_0xfb0d('0x9c'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0x9d'),_0xfb0d('0x9e'));_0x25ba79['field'](_0xfb0d('0x89'));_0x25ba79['field'](_0xfb0d('0x9f'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa0'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa1'));_0x25ba79[_0xfb0d('0x4a')]('i.closedAt');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa2'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa3'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa4'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa5'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa6'));_0x25ba79[_0xfb0d('0x4a')]('i.secondDisposition');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa7'));_0x25ba79[_0xfb0d('0x4a')]('i.substatus');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa8'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xa9'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xaa'));_0x25ba79['field'](_0xfb0d('0xab'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xac'),_0xfb0d('0xad'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xae'),_0xfb0d('0xaf'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb0'),_0xfb0d('0xb1'));_0x25ba79['field'](_0xfb0d('0xb2'),_0xfb0d('0xb3'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb4'),'Contact.mobile');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb5'),'Contact.fax');_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb6'),_0xfb0d('0xb7'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xb8'),_0xfb0d('0xb9'));_0x25ba79[_0xfb0d('0x4a')](_0xfb0d('0xba'),_0xfb0d('0x26'));}if(_0x3e1072[_0xfb0d('0x18')])_0x25ba79[_0xfb0d('0x18')](_0x3e1072[_0xfb0d('0x18')]);if(_0x3e1072[_0xfb0d('0x16')])_0x25ba79['offset'](_0x3e1072['offset']);return db[_0xfb0d('0x97')]['query'](_0x25ba79[_0xfb0d('0x98')](),_0x4050a7);})[_0xfb0d('0x1e')](function(_0xed5a8a){if(_0xed5a8a[_0xfb0d('0x43')]>0x0)_0x23d3cf[_0xfb0d('0x47')](_0xfb0d('0xbb'),_['map'](_0xed5a8a,'id'));return db['sequelize'][_0xfb0d('0x3d')](_0x23d3cf[_0xfb0d('0x98')](),_0x4050a7)[_0xfb0d('0x1e')](function(_0x177950){var _0x5e80c0=_[_0xfb0d('0xbc')](_0x177950,_0xfb0d('0xbd'));var _0x1b5223=[];return db[_0xfb0d('0xbe')][_0xfb0d('0x29')]({'attributes':[_0xfb0d('0xbf')],'raw':!![]})[_0xfb0d('0x1e')](function(_0x5b59f4){var _0x2c1c55=_0x5b59f4[_0xfb0d('0xbf')];_0xed5a8a[_0xfb0d('0x27')](function(_0x555736){_0x1b5223[_0xfb0d('0x28')](updateMailInteraction(_0x555736,_0x356f7c,_0x5e80c0,_0x2c1c55));});return BPromise[_0xfb0d('0xc0')](_0x1b5223);});});});})[_0xfb0d('0x1e')](function(_0x529468){_0x4e8a83[_0xfb0d('0xc1')]=_0x529468;return _0x4e8a83;})[_0xfb0d('0x1e')](respondWithFilteredResult(_0x211db5,_0x3e1072))[_0xfb0d('0x2f')](handleError(_0x211db5,null));};exports[_0xfb0d('0xc2')]=function(_0x3b4289,_0x10d640){var _0x5f13bc={'raw':![],'where':{'id':_0x3b4289[_0xfb0d('0xc3')]['id']}},_0xea7404={};_0xea7404[_0xfb0d('0x3b')]=_['keys'](db[_0xfb0d('0xc4')][_0xfb0d('0x37')]);_0xea7404[_0xfb0d('0x3d')]=_[_0xfb0d('0x3e')](_0x3b4289[_0xfb0d('0x3d')]);_0xea7404['filters']=_[_0xfb0d('0x40')](_0xea7404[_0xfb0d('0x3b')],_0xea7404[_0xfb0d('0x3d')]);_0x5f13bc[_0xfb0d('0x42')]=_[_0xfb0d('0x40')](_0xea7404[_0xfb0d('0x3b')],qs[_0xfb0d('0x41')](_0x3b4289[_0xfb0d('0x3d')]['fields']));_0x5f13bc[_0xfb0d('0x42')]=_0x5f13bc['attributes'][_0xfb0d('0x43')]?_0x5f13bc[_0xfb0d('0x42')]:_0xea7404[_0xfb0d('0x3b')];if(_0x3b4289[_0xfb0d('0x3d')][_0xfb0d('0xc5')]){_0x5f13bc[_0xfb0d('0xc6')]=[{'all':!![]}];}_0x5f13bc=_[_0xfb0d('0xc7')]({},_0x5f13bc,_0x3b4289[_0xfb0d('0xc8')]);return db[_0xfb0d('0xc4')][_0xfb0d('0x5f')](_0x5f13bc)[_0xfb0d('0x1e')](handleEntityNotFound(_0x10d640,null))[_0xfb0d('0x1e')](respondWithResult(_0x10d640,null))[_0xfb0d('0x2f')](handleError(_0x10d640,null));};exports[_0xfb0d('0xc9')]=function(_0x31c5a5,_0x37c2c3){return db[_0xfb0d('0xc4')]['create'](_0x31c5a5[_0xfb0d('0xca')],{})[_0xfb0d('0x1e')](respondWithResult(_0x37c2c3,0xc9))[_0xfb0d('0x2f')](handleError(_0x37c2c3,null));};exports[_0xfb0d('0x1c')]=function(_0x175fd7,_0x1010b4){if(_0x175fd7[_0xfb0d('0xca')]['id']){delete _0x175fd7['body']['id'];}return db[_0xfb0d('0xc4')][_0xfb0d('0x5f')]({'where':{'id':_0x175fd7[_0xfb0d('0xc3')]['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x1010b4,null))[_0xfb0d('0x1e')](saveUpdates(_0x175fd7['body'],null))['then'](respondWithResult(_0x1010b4,null))[_0xfb0d('0x2f')](handleError(_0x1010b4,null));};exports[_0xfb0d('0x1d')]=function(_0x416e2d,_0x1dd2c6){return db[_0xfb0d('0xc4')][_0xfb0d('0x5f')]({'where':{'id':_0x416e2d[_0xfb0d('0xc3')]['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x1dd2c6,null))[_0xfb0d('0x1e')](removeEntity(_0x1dd2c6,null))[_0xfb0d('0x2f')](handleError(_0x1dd2c6,null));};exports[_0xfb0d('0xcb')]=function(_0x2aea7d,_0x42cff1){return db[_0xfb0d('0xc4')][_0xfb0d('0xcb')]()[_0xfb0d('0x1e')](respondWithResult(_0x42cff1,null))[_0xfb0d('0x2f')](handleError(_0x42cff1,null));};exports['addMessage']=function(_0x1eeacc,_0x4bf73e){return db[_0xfb0d('0xcc')][_0xfb0d('0x5f')]({'where':{'id':_0x1eeacc['params']['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x4bf73e,null))[_0xfb0d('0x1e')](function(_0x6f7f7){if(_0x6f7f7){return _0x6f7f7[_0xfb0d('0xcd')](_0x1eeacc[_0xfb0d('0xca')]['ids'],_['omit'](_0x1eeacc[_0xfb0d('0xca')],[_0xfb0d('0xce'),'id'])||{});}})['then'](respondWithResult(_0x4bf73e,null))['catch'](handleError(_0x4bf73e,null));};exports[_0xfb0d('0xcf')]=function(_0x20ec1c,_0x14ab5a){var _0x50c636={'raw':![],'where':{}};var _0x30bc4b={};var _0x337024={'count':0x0,'rows':[]};return db[_0xfb0d('0xc4')][_0xfb0d('0x29')]({'where':{'id':_0x20ec1c['params']['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x14ab5a,null))[_0xfb0d('0x1e')](function(_0x23b84f){if(_0x23b84f){_0x30bc4b['model']=_[_0xfb0d('0x3e')](db[_0xfb0d('0xcc')][_0xfb0d('0x37')]);_0x30bc4b[_0xfb0d('0x3d')]=_['keys'](_0x20ec1c[_0xfb0d('0x3d')]);_0x30bc4b[_0xfb0d('0x3f')]=_['intersection'](_0x30bc4b[_0xfb0d('0x3b')],_0x30bc4b[_0xfb0d('0x3d')]);_0x50c636[_0xfb0d('0x42')]=_[_0xfb0d('0x40')](_0x30bc4b['model'],qs['fields'](_0x20ec1c['query'][_0xfb0d('0x41')]));_0x50c636[_0xfb0d('0x42')]=_0x50c636['attributes'][_0xfb0d('0x43')]?_0x50c636[_0xfb0d('0x42')]:_0x30bc4b['model'];if(!_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x44')]('nolimit')){_0x50c636[_0xfb0d('0x18')]=qs['limit'](_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x18')]);_0x50c636[_0xfb0d('0x16')]=qs[_0xfb0d('0x16')](_0x20ec1c['query']['offset']);}_0x50c636[_0xfb0d('0x8d')]=qs[_0xfb0d('0x46')](_0x20ec1c['query'][_0xfb0d('0x46')]);_0x50c636[_0xfb0d('0x47')]=qs[_0xfb0d('0x3f')](_['pick'](_0x20ec1c[_0xfb0d('0x3d')],_0x30bc4b['filters']));_0x50c636[_0xfb0d('0x47')][_0xfb0d('0xbd')]=_0x23b84f['id'];if(_0x20ec1c['query'][_0xfb0d('0x80')]){_0x50c636['where']=_[_0xfb0d('0xc7')](_0x50c636[_0xfb0d('0x47')],{'$or':_[_0xfb0d('0x23')](_0x50c636['attributes'],function(_0x116d55){var _0x3fba44={};_0x3fba44[_0x116d55]={'$like':'%'+_0x20ec1c[_0xfb0d('0x3d')]['filter']+'%'};return _0x3fba44;})});}if(_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x77')]){var _0x4f1f7d=_0x20ec1c[_0xfb0d('0x3d')][_0xfb0d('0x77')]['split'](',');var _0x67a5ec={};_0x67a5ec[_0x4f1f7d[0x0]]={'$gte':moment(_0x4f1f7d[0x1])['format'](_0xfb0d('0xd0'))};_0x50c636['where']=_[_0xfb0d('0xc7')](_0x50c636[_0xfb0d('0x47')],_0x67a5ec);}_0x50c636=_[_0xfb0d('0xc7')]({},_0x50c636,_0x20ec1c[_0xfb0d('0xc8')]);return db[_0xfb0d('0xcc')][_0xfb0d('0x19')]({'where':_0x50c636[_0xfb0d('0x47')]})[_0xfb0d('0x1e')](function(_0x5955b2){_0x337024[_0xfb0d('0x19')]=_0x5955b2;if(_0x20ec1c['query']['includeAll']){_0x50c636[_0xfb0d('0xc6')]=[{'all':!![]}];}return db[_0xfb0d('0xcc')][_0xfb0d('0xd1')](_0x50c636);})[_0xfb0d('0x1e')](function(_0x15f75b){if(_0x20ec1c['query'][_0xfb0d('0xd2')]===_0xfb0d('0xd3')){for(var _0x82c15d=0x0;_0x82c15d<_0x15f75b[_0xfb0d('0x43')];_0x82c15d++){_0x15f75b[_0x82c15d][_0xfb0d('0xca')]=juice(_0x15f75b[_0x82c15d][_0xfb0d('0xca')]);}}_0x337024[_0xfb0d('0xc1')]=_0x15f75b;return _0x337024;});}})[_0xfb0d('0x1e')](respondWithFilteredResult(_0x14ab5a,_0x50c636))[_0xfb0d('0x2f')](handleError(_0x14ab5a,null));};exports[_0xfb0d('0xd4')]=function(_0x29a253,_0x2bb6d9){return db['MailInteraction'][_0xfb0d('0x5f')]({'where':{'id':_0x29a253[_0xfb0d('0xc3')]['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x2bb6d9,null))['then'](function(_0xdd40e5){if(_0xdd40e5){return _0xdd40e5[_0xfb0d('0xd5')](_0x29a253[_0xfb0d('0xca')][_0xfb0d('0xce')],_[_0xfb0d('0xd6')](_0x29a253[_0xfb0d('0xca')],[_0xfb0d('0xce'),'id'])||{})[_0xfb0d('0xd7')](function(){return db[_0xfb0d('0x6e')][_0xfb0d('0xd1')]({'attributes':['id',_0xfb0d('0x3c'),'color'],'where':{'id':_0x29a253[_0xfb0d('0xca')][_0xfb0d('0xce')]}});})[_0xfb0d('0x1e')](function(_0x2932be){socket[_0xfb0d('0xd8')](_0xfb0d('0xd9'),{'id':Number(_0x29a253[_0xfb0d('0xc3')]['id']),'tags':_0x2932be||[]});return{'id':Number(_0x29a253[_0xfb0d('0xc3')]['id']),'tags':_0x2932be||[]};});}})[_0xfb0d('0x1e')](respondWithResult(_0x2bb6d9,null))[_0xfb0d('0x2f')](handleError(_0x2bb6d9,null));};exports[_0xfb0d('0xda')]=function(_0x3d4fe4,_0x2f2f3b){return db[_0xfb0d('0xc4')]['find']({'where':{'id':_0x3d4fe4['params']['id']}})[_0xfb0d('0x1e')](handleEntityNotFound(_0x2f2f3b,null))[_0xfb0d('0x1e')](function(_0x179e00){if(_0x179e00){return _0x179e00[_0xfb0d('0xda')](_0x3d4fe4[_0xfb0d('0x3d')][_0xfb0d('0xce')]);}})[_0xfb0d('0x1e')](respondWithStatusCode(_0x2f2f3b,null))['catch'](handleError(_0x2f2f3b,null));};exports['download']=function(_0xe5d916,_0x39eb3e){var _0x3762e1=moment()[_0xfb0d('0xdb')]()['toString']();var _0x542693=path[_0xfb0d('0xdc')](config[_0xfb0d('0xdd')],_0xfb0d('0xde'),'files','tmp');var _0x2b36d8=path[_0xfb0d('0xdc')](config[_0xfb0d('0xdd')],_0xfb0d('0xde'),_0xfb0d('0xdf'),_0xfb0d('0xe0'));var _0x173a70=path[_0xfb0d('0xdc')](_0x542693,_0x3762e1);var _0x46629f=util['format'](_0xfb0d('0xe1'),_0xe5d916[_0xfb0d('0xc3')]['id'],_0x3762e1);var _0xdb10aa=path[_0xfb0d('0xdc')](_0x542693,_0x46629f);var _0x1c5ebc=[];if(_0xe5d916[_0xfb0d('0x3d')]['attachments']){_0x1c5ebc[_0xfb0d('0x28')]({'model':db['Attachment'],'as':_0xfb0d('0xe2'),'raw':!![]});}var _0x45668e=[{'model':db[_0xfb0d('0xcc')],'as':_0xfb0d('0xe3'),'attributes':['id',_0xfb0d('0xca'),'from','to','cc',_0xfb0d('0xe4'),_0xfb0d('0xe5'),_0xfb0d('0xe6')],'where':{'secret':![]},'order':qs[_0xfb0d('0x46')]('id'),'include':_0x1c5ebc}];return db[_0xfb0d('0xc4')]['find']({'where':{'id':_0xe5d916[_0xfb0d('0xc3')]['id']},'include':_0x45668e})[_0xfb0d('0x1e')](handleEntityNotFound(_0x39eb3e,null))[_0xfb0d('0x1e')](function(_0x255d15){if(_0x255d15&&_0x255d15[_0xfb0d('0xe3')]){var _0xa9d2a=_0x255d15[_0xfb0d('0xe7')]({'plain':!![]});fs[_0xfb0d('0xe8')](_0x173a70);return BPromise[_0xfb0d('0xe9')](_0xa9d2a[_0xfb0d('0xe3')],function(_0x523241,_0x1aae66){var _0x336e87={'from':_0x523241[_0xfb0d('0x4c')],'to':_0x523241['to'],'subject':_0x523241[_0xfb0d('0xe5')],'html':htmlEntities[_0xfb0d('0xea')](_0x523241['body']),'headers':{'Date':moment(_0x523241[_0xfb0d('0xe6')])['format'](_0xfb0d('0xeb'))},'attachments':[]};if(_0x523241['cc']){_0x336e87['headers']['Cc']=_0x523241['cc'];}if(_0x523241['bcc']){_0x336e87[_0xfb0d('0xec')][_0xfb0d('0xed')]=_0x523241[_0xfb0d('0xe4')];}return new BPromise(function(_0x2be77b,_0x251f2d){if(_0x523241[_0xfb0d('0xe2')]){for(var _0x3090d5=0x0;_0x3090d5<_0x523241[_0xfb0d('0xe2')][_0xfb0d('0x43')];_0x3090d5++){var _0x5c08f3=_0x523241[_0xfb0d('0xe2')][_0x3090d5];var _0x520a9e=path['join'](_0x2b36d8,_0x5c08f3[_0xfb0d('0xee')]);if(fs[_0xfb0d('0xef')](_0x520a9e)){_0x336e87[_0xfb0d('0xe0')][_0xfb0d('0x28')]({'name':_0x5c08f3[_0xfb0d('0x3c')],'contentType':_0x5c08f3['type'],'data':fs[_0xfb0d('0xf0')](_0x520a9e)});}}}emlformat[_0xfb0d('0xf1')](_0x336e87,function(_0x23d10a,_0x38feb5){if(_0x23d10a)return _0x251f2d(_0x23d10a);fs[_0xfb0d('0xf2')](path[_0xfb0d('0xdc')](_0x173a70,util['format']('message%d.eml',_0x1aae66)),_0x38feb5);return _0x2be77b(_0x38feb5);});});})['then'](function(){return new BPromise(function(_0x57835b,_0x15c2b5){zipdir(_0x173a70,{'saveTo':_0xdb10aa},function(_0x2844ba,_0x26453e){if(_0x2844ba)return _0x15c2b5(_0x2844ba);return _0x57835b(_0x26453e);});})[_0xfb0d('0x1e')](function(){return new BPromise(function(_0x410666,_0x323c12){rimraf(_0x173a70,function(_0x52fdba){if(_0x52fdba)_0x323c12(_0x52fdba);return _0x410666();});});})[_0xfb0d('0x1e')](function(){return _0x39eb3e['download'](_0xdb10aa,_0x46629f,function(_0x2f70b0){if(!_0x2f70b0)fs[_0xfb0d('0xf3')](_0xdb10aa);});});});}else{return _0x39eb3e['sendStatus'](0xc8);}})[_0xfb0d('0x2f')](handleError(_0x39eb3e,null));}; \ No newline at end of file +var _0x16a6=['compact','isEmpty','MailAccountId','where','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','tag','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','count','keyBy','merge','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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.closed','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','rows','show','params','rawAttributes','includeAll','include','options','create','body','destroy','describe','addMessage','omit','ids','format','YYYY-MM-DD\x20HH:mm:ss','findAll','true','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','Attachments','Messages','bcc','get','mkdirSync','decode','headers','Bcc','readFileSync','writeFileSync','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','error','stack','name','send','map','TagIds','split','forEach','Tags','push','MailMessage','plainBody','-id','lastMsgText','trimStart','catch','answered','unmanaged','total','closed','UserId','waiting','talking','MailInteraction','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','field','color','tools_tags','select','u.fullname','ui.MailInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','start'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x16a6,0x15c));var _0x616a=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x16a6[_0x54381d];return _0x5308a7;};'use strict';var emlformat=require(_0x616a('0x0'));var rimraf=require(_0x616a('0x1'));var zipdir=require('zip-dir');var moment=require(_0x616a('0x2'));var BPromise=require(_0x616a('0x3'));var util=require(_0x616a('0x4'));var path=require(_0x616a('0x5'));var fs=require('fs');var _=require(_0x616a('0x6'));var squel=require(_0x616a('0x7'));var juice=require('juice');var Redis=require(_0x616a('0x8'));var qs=require(_0x616a('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require('../../config/logger')(_0x616a('0xa'));var config=require(_0x616a('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x616a('0xc')]=_['defaults'](config[_0x616a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x616a('0xd'))(new Redis(config[_0x616a('0xc')]));require(_0x616a('0xe'))['register'](socket);function respondWithStatusCode(_0x1ab052,_0x44e8f3){_0x44e8f3=_0x44e8f3||0xcc;return function(_0x2cf0db){if(_0x2cf0db){return _0x1ab052[_0x616a('0xf')](_0x44e8f3);}return _0x1ab052[_0x616a('0x10')](_0x44e8f3)[_0x616a('0x11')]();};}function respondWithResult(_0x1eb032,_0x4122b7){_0x4122b7=_0x4122b7||0xc8;return function(_0x5755c7){if(_0x5755c7){return _0x1eb032[_0x616a('0x10')](_0x4122b7)[_0x616a('0x12')](_0x5755c7);}};}function respondWithFilteredResult(_0x3db4ae,_0x32becb){return function(_0x295fc2){if(_0x295fc2){var _0x4a33d5=typeof _0x32becb[_0x616a('0x13')]===_0x616a('0x14')&&typeof _0x32becb[_0x616a('0x15')]===_0x616a('0x14');var _0x3bcf20=_0x295fc2['count'];var _0x204e68=_0x4a33d5?0x0:_0x32becb[_0x616a('0x13')];var _0x4eb3ba=_0x4a33d5?_0x295fc2['count']:_0x32becb[_0x616a('0x13')]+_0x32becb[_0x616a('0x15')];var _0x23052c;if(_0x4eb3ba>=_0x3bcf20){_0x4eb3ba=_0x3bcf20;_0x23052c=0xc8;}else{_0x23052c=0xce;}_0x3db4ae['status'](_0x23052c);return _0x3db4ae[_0x616a('0x16')](_0x616a('0x17'),_0x204e68+'-'+_0x4eb3ba+'/'+_0x3bcf20)['json'](_0x295fc2);}return null;};}function saveUpdates(_0x535d2b){return function(_0x3c106c){if(_0x3c106c){return _0x3c106c[_0x616a('0x18')](_0x535d2b)[_0x616a('0x19')](function(_0x31b711){return _0x31b711;});}return null;};}function removeEntity(_0x505b9f){return function(_0x499132){if(_0x499132){return _0x499132['destroy']()['then'](function(){_0x505b9f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30b18f){return function(_0x5542ca){if(!_0x5542ca){_0x30b18f[_0x616a('0xf')](0x194);}return _0x5542ca;};}function handleError(_0x137974,_0x4f5594){_0x4f5594=_0x4f5594||0x1f4;return function(_0x46ac5d){logger[_0x616a('0x1a')](_0x46ac5d[_0x616a('0x1b')]);if(_0x46ac5d[_0x616a('0x1c')]){delete _0x46ac5d['name'];}_0x137974[_0x616a('0x10')](_0x4f5594)[_0x616a('0x1d')](_0x46ac5d);};}function getInteractionUsers(_0x3d1728,_0x3ff690){return new BPromise(function(_0x500f4e,_0x3e11f2){try{if(_0x3ff690[_0x3d1728['id']]){_0x3d1728['Users']=_[_0x616a('0x1e')](_0x3ff690[_0x3d1728['id']],function(_0x397a69){return{'id':_0x397a69['id'],'fullname':_0x397a69['fullname']};});}}catch(_0x55abc8){_0x3e11f2(_0x55abc8);}_0x500f4e(_0x3d1728);});}function getInteractionTags(_0x50c6b8,_0x474420){return new BPromise(function(_0x7ebd63,_0x343f49){try{if(_0x50c6b8[_0x616a('0x1f')]){_0x50c6b8['Tags']=[];_0x50c6b8[_0x616a('0x1f')][_0x616a('0x20')](',')[_0x616a('0x21')](function(_0x163fd0){_0x50c6b8[_0x616a('0x22')][_0x616a('0x23')](_0x474420[_0x163fd0]);});}delete _0x50c6b8[_0x616a('0x1f')];}catch(_0x5f3a59){_0x343f49(_0x5f3a59);}_0x7ebd63(_0x50c6b8);});}function getLastMessageText(_0x15c632){return new BPromise(function(_0x1ded22,_0x4cd6e2){return db[_0x616a('0x24')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x15c632['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x616a('0x25')],'order':_0x616a('0x26'),'raw':!![]})[_0x616a('0x19')](function(_0x4e4460){if(_0x4e4460&&_0x4e4460[_0x616a('0x25')]){_0x15c632[_0x616a('0x27')]=_[_0x616a('0x28')](_0x4e4460[_0x616a('0x25')]);}_0x1ded22(_0x15c632);})[_0x616a('0x29')](function(_0x3bfbd1){_0x4cd6e2(_0x3bfbd1);});});}function updateMailInteraction(_0x5191d2,_0x147b50,_0x4a938c,_0x1cc6c5){return new BPromise(function(_0x24d57f,_0x1e38f4){return getInteractionUsers(_0x5191d2,_0x4a938c)['then'](function(_0x42f429){return getInteractionTags(_0x42f429,_0x147b50);})[_0x616a('0x19')](function(_0x579402){return getStateInteraction(_0x579402);})['then'](function(_0x419198){if(_0x1cc6c5){_0x24d57f(getLastMessageText(_0x419198));}else{_0x24d57f(_0x419198);}})[_0x616a('0x29')](function(_0x3e7301){_0x1e38f4(_0x3e7301);});});}function getStateInteraction(_0x12fd21){return new BPromise(function(_0x562688){_0x12fd21['waiting']=0x0;_0x12fd21['talking']=0x0;_0x12fd21[_0x616a('0x2a')]=0x0;_0x12fd21[_0x616a('0x2b')]=0x0;_0x12fd21[_0x616a('0x2c')]=0x0;if(!_0x12fd21[_0x616a('0x2d')]&&!_0x12fd21[_0x616a('0x2e')]){_0x12fd21[_0x616a('0x2f')]+=0x1;}if(!_0x12fd21[_0x616a('0x2d')]&&_0x12fd21[_0x616a('0x2e')]){_0x12fd21[_0x616a('0x30')]+=0x1;if(_0x12fd21[_0x616a('0x2f')]){_0x12fd21['waiting']-=0x1;}}if(_0x12fd21[_0x616a('0x2d')]&&_0x12fd21['UserId']){_0x12fd21[_0x616a('0x2a')]+=0x1;if(_0x12fd21[_0x616a('0x30')]){_0x12fd21[_0x616a('0x30')]-=0x1;}}if(_0x12fd21[_0x616a('0x2d')]&&!_0x12fd21[_0x616a('0x2e')]){_0x12fd21[_0x616a('0x2b')]+=0x1;if(_0x12fd21[_0x616a('0x2f')]){_0x12fd21[_0x616a('0x2f')]-=0x1;}}_0x12fd21[_0x616a('0x2c')]+=0x1;_0x562688(_0x12fd21);});}exports['index']=function(_0x304e27,_0x32d36){var _0x203d8c={},_0x4c36d9={},_0x4b3e7d={'count':0x0,'rows':[]};var _0x105112=_['map'](db[_0x616a('0x31')]['rawAttributes'],function(_0x139e4c){return{'name':_0x139e4c[_0x616a('0x32')],'type':_0x139e4c['type'][_0x616a('0x33')]};});_0x4c36d9['model']=_[_0x616a('0x1e')](_0x105112,_0x616a('0x1c'));_0x4c36d9[_0x616a('0x34')]=_[_0x616a('0x35')](_0x304e27[_0x616a('0x34')]);_0x4c36d9[_0x616a('0x36')]=_[_0x616a('0x37')](_0x4c36d9['model'],_0x4c36d9[_0x616a('0x34')]);_0x203d8c['attributes']=_[_0x616a('0x37')](_0x4c36d9[_0x616a('0x38')],qs[_0x616a('0x39')](_0x304e27['query'][_0x616a('0x39')]));_0x203d8c[_0x616a('0x3a')]=_0x203d8c[_0x616a('0x3a')][_0x616a('0x3b')]?_0x203d8c[_0x616a('0x3a')]:_0x4c36d9['model'];if(!_0x304e27[_0x616a('0x34')][_0x616a('0x3c')](_0x616a('0x3d'))){_0x203d8c['limit']=qs[_0x616a('0x15')](_0x304e27[_0x616a('0x34')][_0x616a('0x15')]);_0x203d8c[_0x616a('0x13')]=qs[_0x616a('0x13')](_0x304e27[_0x616a('0x34')][_0x616a('0x13')]);}_0x203d8c['order']=qs[_0x616a('0x3e')](_0x304e27[_0x616a('0x34')]['sort']);_0x203d8c['where']=qs[_0x616a('0x36')](_[_0x616a('0x3f')](_0x304e27[_0x616a('0x34')],_0x4c36d9[_0x616a('0x36')]),_0x105112);var _0x136774=[];var _0x2f4c3c=squel['select']()[_0x616a('0x40')]('id')[_0x616a('0x40')](_0x616a('0x1c'))['field'](_0x616a('0x41'))['from'](_0x616a('0x42'));var _0x76336d=squel[_0x616a('0x43')]()[_0x616a('0x40')]('u.id')[_0x616a('0x40')](_0x616a('0x44'))[_0x616a('0x40')](_0x616a('0x45'))[_0x616a('0x46')]('user_has_mail_interactions','ui')[_0x616a('0x47')](_0x616a('0x48'),'u',_0x616a('0x49'));var _0x1194b4=squel[_0x616a('0x43')]()[_0x616a('0x46')]('mail_interactions','i')[_0x616a('0x47')](_0x616a('0x4a'),'c',_0x616a('0x4b'))[_0x616a('0x47')]('users','o',_0x616a('0x4c'))['left_join'](_0x616a('0x4d'),'a',_0x616a('0x4e'))['left_join'](_0x616a('0x4f'),'me',_0x616a('0x50'))[_0x616a('0x47')]('mail_interaction_has_tags','it',_0x616a('0x51'))[_0x616a('0x47')](_0x616a('0x42'),'t',_0x616a('0x52'));var _0x499cd0=squel['expr']();var _0x944a82=[];var _0x441dc5=squel[_0x616a('0x53')]();var _0x1af824;if(_0x304e27['query'][_0x616a('0x54')]){_0x1af824=as[_0x616a('0x55')](_0x304e27[_0x616a('0x34')]['search']);var _0x550a48=_0x1af824[_0x616a('0x56')];for(var _0xd73c5a=0x0;_0xd73c5a<_0x1af824[_0x616a('0x57')][_0x616a('0x3b')];_0xd73c5a++){var _0x2be473=_0x1af824[_0x616a('0x57')][_0xd73c5a];var _0x13a095='i';var _0x12e509=_[_0x616a('0x58')](_0x105112,[_0x616a('0x1c'),_0x2be473[_0x616a('0x40')]]);if(!_0x12e509){switch(_0x2be473['field']){case'unreadMessages':if(_0x2be473[_0x616a('0x59')]==0x1){_0x1194b4[_0x616a('0x5a')]('`'+_0x2be473[_0x616a('0x40')]+_0x616a('0x5b'));}else{_0x1194b4['having']('`'+_0x2be473['field']+_0x616a('0x5c'));}break;case'Contact':if(_0x2be473[_0x616a('0x5d')]===_0x616a('0x5e')){if(_0x2be473[_0x616a('0x59')][_0x616a('0x20')]('\x20')['length']>0x1){_0x499cd0[_0x550a48](_0x616a('0x5f'),qs[_0x616a('0x60')](_0x2be473[_0x616a('0x59')]),null);}else{var _0xa38f0c='%'+_0x2be473[_0x616a('0x59')]+'%';_0x499cd0[_0x550a48]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xa38f0c,_0xa38f0c,_0xa38f0c);}}else{_0x12e509=_['find'](_0x105112,['name',_0x616a('0x61')]);_0x2be473['field']=_0x616a('0x61');_0x3cea1e=as[_0x616a('0x62')](_0x13a095,_0x12e509['type'],_0x2be473);_0x499cd0[_0x550a48](_0x3cea1e[_0x616a('0x63')],_0x3cea1e['value']['start'],_0x3cea1e[_0x616a('0x59')]['end']);}break;case'Tag':var _0x12debf=_0x2be473['value'][_0x616a('0x20')](',')[_0x616a('0x1e')](function(_0x466efc){return Number(_0x466efc);});_0x12debf[_0x616a('0x21')](function(_0x1583ef){_0x441dc5['or'](_0x616a('0x64'),'%,'+_0x1583ef+',%');});_0x944a82=_[_0x616a('0x65')](_0x944a82,_0x12debf);break;case _0x616a('0x66'):if(_0x2be473['operator']==='$substring'){_0x499cd0[_0x550a48](_0x616a('0x67'),'%'+_0x2be473[_0x616a('0x59')]+'%',null);}else{_0x12e509=_['find'](_0x105112,[_0x616a('0x1c'),_0x616a('0x2e')]);_0x2be473['field']=_0x616a('0x2e');_0x3cea1e=as[_0x616a('0x62')](_0x13a095,_0x12e509[_0x616a('0x68')],_0x2be473);_0x499cd0[_0x550a48](_0x3cea1e['text'],_0x3cea1e[_0x616a('0x59')][_0x616a('0x69')],_0x3cea1e['value'][_0x616a('0x11')]);}break;case'plainBody':_0x3cea1e=as[_0x616a('0x62')]('me',null,_0x2be473);_0x499cd0[_0x550a48](_0x3cea1e[_0x616a('0x63')],_0x3cea1e[_0x616a('0x59')][_0x616a('0x69')],_0x3cea1e[_0x616a('0x59')]['end']);break;}}else{var _0x3cea1e=as[_0x616a('0x62')](_0x13a095,_0x12e509[_0x616a('0x68')],_0x2be473);_0x499cd0[_0x550a48](_0x3cea1e[_0x616a('0x63')],_0x3cea1e[_0x616a('0x59')][_0x616a('0x69')],_0x3cea1e['value'][_0x616a('0x11')]);}}}else{var _0x376b6c=_(_0x304e27[_0x616a('0x34')])[_0x616a('0x35')]()[_0x616a('0x1e')](function(_0x2fac75){return _['some'](_0x105112,[_0x616a('0x1c'),_0x2fac75])?_0x2fac75:undefined;})[_0x616a('0x6a')]()[_0x616a('0x59')]();if(!_[_0x616a('0x6b')](_0x376b6c)){_0x376b6c[_0x616a('0x21')](function(_0x450f85){if(_0x450f85===_0x616a('0x6c')){_0x1194b4[_0x616a('0x6d')](_0x616a('0x6e'),[]['concat'](_0x304e27[_0x616a('0x34')][_0x450f85]));}else if(_0x450f85===_0x616a('0x6f')){var _0x485bcf=JSON[_0x616a('0x70')](_0x304e27['query'][_0x450f85])[_0x616a('0x71')];var _0x2b52e1=JSON[_0x616a('0x70')](_0x304e27[_0x616a('0x34')][_0x450f85])[_0x616a('0x72')];_0x1194b4[_0x616a('0x6d')](_0x616a('0x73'),_0x485bcf,_0x2b52e1);}else{if(_0x304e27[_0x616a('0x34')][_0x450f85]===_0x616a('0x74')){_0x1194b4[_0x616a('0x6d')]('i.'+_0x450f85+_0x616a('0x75'));}else{_0x1194b4['where']('i.'+_0x450f85+'\x20=\x20?',_0x304e27[_0x616a('0x34')][_0x450f85]);}}});}if(_0x304e27['query'][_0x616a('0x76')]){if(_0x304e27[_0x616a('0x34')]['read']==0x1){_0x1194b4[_0x616a('0x5a')]('`unreadMessages`\x20=\x200');}else{_0x1194b4[_0x616a('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x304e27[_0x616a('0x34')][_0x616a('0x77')]){_0x944a82=_['isArray'](_0x304e27[_0x616a('0x34')]['tag'])?_0x304e27['query'][_0x616a('0x77')]:new Array(_0x304e27[_0x616a('0x34')]['tag']);_0x944a82[_0x616a('0x21')](function(_0x2a7859){_0x441dc5['or'](_0x616a('0x64'),'%,'+_0x2a7859+',%');});}if(_0x304e27[_0x616a('0x34')][_0x616a('0x78')]){var _0x24f999=_0x304e27[_0x616a('0x34')]['filter'][_0x616a('0x79')]('\x5c','\x5c\x5c')[_0x616a('0x79')](/'/g,'\x27\x27');if(qs[_0x616a('0x7a')](_0x24f999)){_0x499cd0['or']('i.id\x20LIKE\x20?',_0x24f999+'%');}else if(qs[_0x616a('0x7b')](_0x24f999)){_0x499cd0['or'](_0x616a('0x7c'),_0x24f999+'%');}else{_0x499cd0['or'](_0x616a('0x7d'),qs['getFullTextValue'](_0x24f999))['or'](_0x616a('0x7e'),qs[_0x616a('0x60')](_0x24f999));}}}_0x1194b4[_0x616a('0x6d')](_0x499cd0);_0x1194b4[_0x616a('0x7f')](_0x616a('0x80'));var _0x5dca9e={'type':db[_0x616a('0x81')][_0x616a('0x82')][_0x616a('0x83')],'raw':!![]};var _0x50dff7=_0x1194b4[_0x616a('0x84')]();_0x50dff7['field']('i.id');_0x50dff7[_0x616a('0x40')](_0x616a('0x85'),_0x616a('0x86'));if(_0x203d8c[_0x616a('0x87')]){_0x203d8c['order'][_0x616a('0x21')](function(_0x30bcff){var _0x352512=_0x30bcff[0x0]==='contactName'?_0x30bcff[0x0]:'i.'+_0x30bcff[0x0];_0x1194b4[_0x616a('0x87')](_0x352512,_0x30bcff[0x1]===_0x616a('0x88')?![]:!![]);});}if(!_[_0x616a('0x6b')](_0x944a82)){_0x1194b4[_0x616a('0x5a')](_0x441dc5);_0x50dff7[_0x616a('0x6d')](_0x616a('0x89'),_0x944a82);}BPromise[_0x616a('0x8a')]()['then'](function(){if(!_0x1af824){if(_0x304e27['query'][_0x616a('0x6c')])return;_0x50dff7[_0x616a('0x6d')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x1194b4[_0x616a('0x6d')](_0x616a('0x8b'));return;}if(_0x304e27[_0x616a('0x8c')][_0x616a('0x8d')]!==_0x616a('0x8e'))return;return _0x304e27['user'][_0x616a('0x8f')]({'attributes':['id'],'raw':!![]})[_0x616a('0x19')](function(_0x2e6f86){if(_[_0x616a('0x6b')](_0x2e6f86)){_0x50dff7['where'](_0x616a('0x90'));_0x1194b4[_0x616a('0x6d')](_0x616a('0x90'));}else{_0x50dff7['where'](_0x616a('0x6e'),_[_0x616a('0x1e')](_0x2e6f86,'id'));_0x1194b4[_0x616a('0x6d')]('i.MailAccountId\x20IN\x20?',_[_0x616a('0x1e')](_0x2e6f86,'id'));}});})['then'](function(){if(_0x304e27['user'][_0x616a('0x8d')]==='agent'&&!_0x1af824&&!_0x304e27[_0x616a('0x34')][_0x616a('0x6c')])return[];return db['sequelize']['query'](_0x50dff7[_0x616a('0x91')](),_0x5dca9e);})[_0x616a('0x19')](function(_0xaec586){_0x4b3e7d[_0x616a('0x92')]=_0xaec586[_0x616a('0x3b')];if(_0x4b3e7d[_0x616a('0x92')]===0x0)return[];return db['sequelize'][_0x616a('0x34')](_0x2f4c3c['toString'](),_0x5dca9e)[_0x616a('0x19')](function(_0x1cf3e6){_0x136774=_[_0x616a('0x93')](_0x1cf3e6,'id');_0x5dca9e=_[_0x616a('0x94')](_0x5dca9e,{'model':db[_0x616a('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x304e27[_0x616a('0x34')][_0x616a('0x39')]){_0x203d8c[_0x616a('0x3a')][_0x616a('0x21')](function(_0x5c21f2){_0x1194b4[_0x616a('0x40')]('i.'+_0x5c21f2);});}else{_0x1194b4['field'](_0x616a('0x85'),_0x616a('0x86'));_0x1194b4[_0x616a('0x40')](_0x616a('0x95'),'Account.key');_0x1194b4[_0x616a('0x40')]('a.mandatoryDisposition',_0x616a('0x96'));_0x1194b4[_0x616a('0x40')](_0x616a('0x97'),_0x616a('0x98'));_0x1194b4['field']('i.id');_0x1194b4['field'](_0x616a('0x99'));_0x1194b4['field']('i.updatedAt');_0x1194b4[_0x616a('0x40')](_0x616a('0x9a'));_0x1194b4[_0x616a('0x40')]('i.closedAt');_0x1194b4[_0x616a('0x40')]('i.attach');_0x1194b4[_0x616a('0x40')](_0x616a('0x9b'));_0x1194b4[_0x616a('0x40')](_0x616a('0x9c'));_0x1194b4['field']('i.subject');_0x1194b4['field'](_0x616a('0x9d'));_0x1194b4[_0x616a('0x40')](_0x616a('0x9e'));_0x1194b4[_0x616a('0x40')](_0x616a('0x9f'));_0x1194b4[_0x616a('0x40')](_0x616a('0xa0'));_0x1194b4[_0x616a('0x40')]('i.to');_0x1194b4[_0x616a('0x40')](_0x616a('0xa1'));_0x1194b4[_0x616a('0x40')](_0x616a('0xa2'));_0x1194b4['field'](_0x616a('0xa3'));_0x1194b4[_0x616a('0x40')](_0x616a('0xa4'),_0x616a('0xa5'));_0x1194b4[_0x616a('0x40')](_0x616a('0xa6'),_0x616a('0xa7'));_0x1194b4[_0x616a('0x40')](_0x616a('0xa8'),_0x616a('0xa9'));_0x1194b4[_0x616a('0x40')](_0x616a('0xaa'),_0x616a('0xab'));_0x1194b4[_0x616a('0x40')](_0x616a('0xac'),_0x616a('0xad'));_0x1194b4[_0x616a('0x40')](_0x616a('0xae'),'Contact.fax');_0x1194b4[_0x616a('0x40')](_0x616a('0xaf'),_0x616a('0xb0'));_0x1194b4['field']('o.internal','Owner.internal');_0x1194b4[_0x616a('0x40')](_0x616a('0xb1'),_0x616a('0x1f'));}if(_0x203d8c[_0x616a('0x15')])_0x1194b4['limit'](_0x203d8c['limit']);if(_0x203d8c[_0x616a('0x13')])_0x1194b4[_0x616a('0x13')](_0x203d8c[_0x616a('0x13')]);return db[_0x616a('0xb2')][_0x616a('0x34')](_0x1194b4['toString'](),_0x5dca9e);})[_0x616a('0x19')](function(_0x450e15){if(_0x450e15['length']>0x0)_0x76336d[_0x616a('0x6d')](_0x616a('0xb3'),_['map'](_0x450e15,'id'));return db[_0x616a('0xb2')]['query'](_0x76336d[_0x616a('0x91')](),_0x5dca9e)[_0x616a('0x19')](function(_0x1e5076){var _0x1b4a75=_[_0x616a('0xb4')](_0x1e5076,_0x616a('0xb5'));var _0x43258d=[];return db[_0x616a('0xb6')]['findOne']({'attributes':[_0x616a('0xb7')],'raw':!![]})[_0x616a('0x19')](function(_0x3f771f){var _0x22af5b=_0x3f771f['enableEmailPreview'];_0x450e15[_0x616a('0x21')](function(_0x3a32cd){_0x43258d[_0x616a('0x23')](updateMailInteraction(_0x3a32cd,_0x136774,_0x1b4a75,_0x22af5b));});return BPromise['all'](_0x43258d);});});});})['then'](function(_0x2af731){_0x4b3e7d[_0x616a('0xb8')]=_0x2af731;return _0x4b3e7d;})[_0x616a('0x19')](respondWithFilteredResult(_0x32d36,_0x203d8c))[_0x616a('0x29')](handleError(_0x32d36,null));};exports[_0x616a('0xb9')]=function(_0x562e6d,_0x5c8b87){var _0x175fde={'raw':![],'where':{'id':_0x562e6d[_0x616a('0xba')]['id']}},_0x518fad={};_0x518fad[_0x616a('0x38')]=_[_0x616a('0x35')](db['MailInteraction'][_0x616a('0xbb')]);_0x518fad[_0x616a('0x34')]=_[_0x616a('0x35')](_0x562e6d[_0x616a('0x34')]);_0x518fad['filters']=_['intersection'](_0x518fad[_0x616a('0x38')],_0x518fad[_0x616a('0x34')]);_0x175fde[_0x616a('0x3a')]=_['intersection'](_0x518fad['model'],qs['fields'](_0x562e6d['query'][_0x616a('0x39')]));_0x175fde['attributes']=_0x175fde[_0x616a('0x3a')][_0x616a('0x3b')]?_0x175fde[_0x616a('0x3a')]:_0x518fad[_0x616a('0x38')];if(_0x562e6d[_0x616a('0x34')][_0x616a('0xbc')]){_0x175fde[_0x616a('0xbd')]=[{'all':!![]}];}_0x175fde=_['merge']({},_0x175fde,_0x562e6d[_0x616a('0xbe')]);return db[_0x616a('0x31')]['find'](_0x175fde)[_0x616a('0x19')](handleEntityNotFound(_0x5c8b87,null))[_0x616a('0x19')](respondWithResult(_0x5c8b87,null))[_0x616a('0x29')](handleError(_0x5c8b87,null));};exports[_0x616a('0xbf')]=function(_0x1a5e64,_0x1b77b0){return db[_0x616a('0x31')][_0x616a('0xbf')](_0x1a5e64[_0x616a('0xc0')],{})[_0x616a('0x19')](respondWithResult(_0x1b77b0,0xc9))[_0x616a('0x29')](handleError(_0x1b77b0,null));};exports['update']=function(_0x480cd1,_0x5bdacd){if(_0x480cd1[_0x616a('0xc0')]['id']){delete _0x480cd1[_0x616a('0xc0')]['id'];}return db[_0x616a('0x31')]['find']({'where':{'id':_0x480cd1['params']['id']}})['then'](handleEntityNotFound(_0x5bdacd,null))[_0x616a('0x19')](saveUpdates(_0x480cd1[_0x616a('0xc0')],null))[_0x616a('0x19')](respondWithResult(_0x5bdacd,null))[_0x616a('0x29')](handleError(_0x5bdacd,null));};exports[_0x616a('0xc1')]=function(_0x2dca4a,_0xbf479){return db[_0x616a('0x31')]['find']({'where':{'id':_0x2dca4a[_0x616a('0xba')]['id']}})[_0x616a('0x19')](handleEntityNotFound(_0xbf479,null))[_0x616a('0x19')](removeEntity(_0xbf479,null))[_0x616a('0x29')](handleError(_0xbf479,null));};exports['describe']=function(_0x4d28a3,_0x3054e4){return db[_0x616a('0x31')][_0x616a('0xc2')]()[_0x616a('0x19')](respondWithResult(_0x3054e4,null))['catch'](handleError(_0x3054e4,null));};exports[_0x616a('0xc3')]=function(_0x7d8541,_0x2e07dc){return db[_0x616a('0x24')]['find']({'where':{'id':_0x7d8541[_0x616a('0xba')]['id']}})[_0x616a('0x19')](handleEntityNotFound(_0x2e07dc,null))[_0x616a('0x19')](function(_0x884f5f){if(_0x884f5f){return _0x884f5f[_0x616a('0xc3')](_0x7d8541[_0x616a('0xc0')]['ids'],_[_0x616a('0xc4')](_0x7d8541[_0x616a('0xc0')],[_0x616a('0xc5'),'id'])||{});}})['then'](respondWithResult(_0x2e07dc,null))[_0x616a('0x29')](handleError(_0x2e07dc,null));};exports['getMessages']=function(_0xf2c344,_0x549011){var _0x33ba6a={'raw':![],'where':{}};var _0x3ab67a={};var _0x3cb779={'count':0x0,'rows':[]};return db[_0x616a('0x31')]['findOne']({'where':{'id':_0xf2c344[_0x616a('0xba')]['id']}})[_0x616a('0x19')](handleEntityNotFound(_0x549011,null))[_0x616a('0x19')](function(_0x5bde35){if(_0x5bde35){_0x3ab67a[_0x616a('0x38')]=_[_0x616a('0x35')](db[_0x616a('0x24')][_0x616a('0xbb')]);_0x3ab67a[_0x616a('0x34')]=_[_0x616a('0x35')](_0xf2c344['query']);_0x3ab67a['filters']=_[_0x616a('0x37')](_0x3ab67a[_0x616a('0x38')],_0x3ab67a[_0x616a('0x34')]);_0x33ba6a[_0x616a('0x3a')]=_[_0x616a('0x37')](_0x3ab67a[_0x616a('0x38')],qs[_0x616a('0x39')](_0xf2c344[_0x616a('0x34')][_0x616a('0x39')]));_0x33ba6a['attributes']=_0x33ba6a[_0x616a('0x3a')][_0x616a('0x3b')]?_0x33ba6a['attributes']:_0x3ab67a[_0x616a('0x38')];if(!_0xf2c344[_0x616a('0x34')][_0x616a('0x3c')](_0x616a('0x3d'))){_0x33ba6a[_0x616a('0x15')]=qs[_0x616a('0x15')](_0xf2c344['query']['limit']);_0x33ba6a[_0x616a('0x13')]=qs[_0x616a('0x13')](_0xf2c344[_0x616a('0x34')][_0x616a('0x13')]);}_0x33ba6a['order']=qs[_0x616a('0x3e')](_0xf2c344[_0x616a('0x34')][_0x616a('0x3e')]);_0x33ba6a[_0x616a('0x6d')]=qs[_0x616a('0x36')](_[_0x616a('0x3f')](_0xf2c344['query'],_0x3ab67a[_0x616a('0x36')]));_0x33ba6a[_0x616a('0x6d')][_0x616a('0xb5')]=_0x5bde35['id'];if(_0xf2c344['query'][_0x616a('0x78')]){_0x33ba6a[_0x616a('0x6d')]=_['merge'](_0x33ba6a[_0x616a('0x6d')],{'$or':_[_0x616a('0x1e')](_0x33ba6a[_0x616a('0x3a')],function(_0x2c5c6d){var _0xfe2db0={};_0xfe2db0[_0x2c5c6d]={'$like':'%'+_0xf2c344[_0x616a('0x34')][_0x616a('0x78')]+'%'};return _0xfe2db0;})});}if(_0xf2c344['query'][_0x616a('0x71')]){var _0x58f971=_0xf2c344['query'][_0x616a('0x71')][_0x616a('0x20')](',');var _0x512895={};_0x512895[_0x58f971[0x0]]={'$gte':moment(_0x58f971[0x1])[_0x616a('0xc6')](_0x616a('0xc7'))};_0x33ba6a['where']=_['merge'](_0x33ba6a['where'],_0x512895);}_0x33ba6a=_[_0x616a('0x94')]({},_0x33ba6a,_0xf2c344[_0x616a('0xbe')]);return db[_0x616a('0x24')][_0x616a('0x92')]({'where':_0x33ba6a[_0x616a('0x6d')]})[_0x616a('0x19')](function(_0x3c4dd){_0x3cb779[_0x616a('0x92')]=_0x3c4dd;if(_0xf2c344['query'][_0x616a('0xbc')]){_0x33ba6a['include']=[{'all':!![]}];}return db['MailMessage'][_0x616a('0xc8')](_0x33ba6a);})['then'](function(_0x2076bd){if(_0xf2c344[_0x616a('0x34')]['inlineCss']===_0x616a('0xc9')){for(var _0x20968d=0x0;_0x20968d<_0x2076bd[_0x616a('0x3b')];_0x20968d++){_0x2076bd[_0x20968d][_0x616a('0xc0')]=juice(_0x2076bd[_0x20968d]['body']);}}_0x3cb779[_0x616a('0xb8')]=_0x2076bd;return _0x3cb779;});}})[_0x616a('0x19')](respondWithFilteredResult(_0x549011,_0x33ba6a))[_0x616a('0x29')](handleError(_0x549011,null));};exports[_0x616a('0xca')]=function(_0x25d3fa,_0x429801){return db[_0x616a('0x31')][_0x616a('0x58')]({'where':{'id':_0x25d3fa['params']['id']}})[_0x616a('0x19')](handleEntityNotFound(_0x429801,null))[_0x616a('0x19')](function(_0x193d3f){if(_0x193d3f){return _0x193d3f[_0x616a('0xcb')](_0x25d3fa['body'][_0x616a('0xc5')],_[_0x616a('0xc4')](_0x25d3fa[_0x616a('0xc0')],[_0x616a('0xc5'),'id'])||{})[_0x616a('0xcc')](function(){return db[_0x616a('0xcd')][_0x616a('0xc8')]({'attributes':['id',_0x616a('0x1c'),'color'],'where':{'id':_0x25d3fa[_0x616a('0xc0')]['ids']}});})[_0x616a('0x19')](function(_0xf1b833){socket[_0x616a('0xce')](_0x616a('0xcf'),{'id':Number(_0x25d3fa['params']['id']),'tags':_0xf1b833||[]});return{'id':Number(_0x25d3fa[_0x616a('0xba')]['id']),'tags':_0xf1b833||[]};});}})['then'](respondWithResult(_0x429801,null))[_0x616a('0x29')](handleError(_0x429801,null));};exports[_0x616a('0xd0')]=function(_0x5c46cc,_0x3f3256){return db['MailInteraction'][_0x616a('0x58')]({'where':{'id':_0x5c46cc[_0x616a('0xba')]['id']}})[_0x616a('0x19')](handleEntityNotFound(_0x3f3256,null))[_0x616a('0x19')](function(_0x26d428){if(_0x26d428){return _0x26d428['removeTags'](_0x5c46cc[_0x616a('0x34')][_0x616a('0xc5')]);}})[_0x616a('0x19')](respondWithStatusCode(_0x3f3256,null))['catch'](handleError(_0x3f3256,null));};exports[_0x616a('0xd1')]=function(_0x106d90,_0x498eeb){var _0xda64ce=moment()[_0x616a('0xd2')]()[_0x616a('0x91')]();var _0x5dde4b=path[_0x616a('0xd3')](config[_0x616a('0xd4')],_0x616a('0xd5'),_0x616a('0xd6'),'tmp');var _0x48bb93=path[_0x616a('0xd3')](config[_0x616a('0xd4')],'server',_0x616a('0xd6'),_0x616a('0xd7'));var _0x3b1cec=path[_0x616a('0xd3')](_0x5dde4b,_0xda64ce);var _0x1b4236=util[_0x616a('0xc6')]('transcript-%d-%s.zip',_0x106d90[_0x616a('0xba')]['id'],_0xda64ce);var _0x512365=path['join'](_0x5dde4b,_0x1b4236);var _0x35b1c3=[];if(_0x106d90[_0x616a('0x34')][_0x616a('0xd7')]){_0x35b1c3[_0x616a('0x23')]({'model':db['Attachment'],'as':_0x616a('0xd8'),'raw':!![]});}var _0x211105=[{'model':db['MailMessage'],'as':_0x616a('0xd9'),'attributes':['id',_0x616a('0xc0'),'from','to','cc',_0x616a('0xda'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x616a('0x3e')]('id'),'include':_0x35b1c3}];return db[_0x616a('0x31')][_0x616a('0x58')]({'where':{'id':_0x106d90[_0x616a('0xba')]['id']},'include':_0x211105})['then'](handleEntityNotFound(_0x498eeb,null))[_0x616a('0x19')](function(_0x2b13fa){if(_0x2b13fa&&_0x2b13fa[_0x616a('0xd9')]){var _0x97563e=_0x2b13fa[_0x616a('0xdb')]({'plain':!![]});fs[_0x616a('0xdc')](_0x3b1cec);return BPromise['each'](_0x97563e[_0x616a('0xd9')],function(_0x3f6075,_0x2da237){var _0x5354cd={'from':_0x3f6075['from'],'to':_0x3f6075['to'],'subject':_0x3f6075['subject'],'html':htmlEntities[_0x616a('0xdd')](_0x3f6075['body']),'headers':{'Date':moment(_0x3f6075[_0x616a('0x6f')])[_0x616a('0xc6')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3f6075['cc']){_0x5354cd[_0x616a('0xde')]['Cc']=_0x3f6075['cc'];}if(_0x3f6075[_0x616a('0xda')]){_0x5354cd[_0x616a('0xde')][_0x616a('0xdf')]=_0x3f6075['bcc'];}return new BPromise(function(_0x5e0538,_0x29a847){if(_0x3f6075[_0x616a('0xd8')]){for(var _0x3a9c58=0x0;_0x3a9c58<_0x3f6075[_0x616a('0xd8')][_0x616a('0x3b')];_0x3a9c58++){var _0x3d0385=_0x3f6075['Attachments'][_0x3a9c58];var _0x20b629=path[_0x616a('0xd3')](_0x48bb93,_0x3d0385['basename']);if(fs['existsSync'](_0x20b629)){_0x5354cd[_0x616a('0xd7')][_0x616a('0x23')]({'name':_0x3d0385[_0x616a('0x1c')],'contentType':_0x3d0385[_0x616a('0x68')],'data':fs[_0x616a('0xe0')](_0x20b629)});}}}emlformat['build'](_0x5354cd,function(_0x262aaf,_0x30a71a){if(_0x262aaf)return _0x29a847(_0x262aaf);fs[_0x616a('0xe1')](path[_0x616a('0xd3')](_0x3b1cec,util['format']('message%d.eml',_0x2da237)),_0x30a71a);return _0x5e0538(_0x30a71a);});});})[_0x616a('0x19')](function(){return new BPromise(function(_0x3b2e25,_0x4c6852){zipdir(_0x3b1cec,{'saveTo':_0x512365},function(_0x430e71,_0x53f229){if(_0x430e71)return _0x4c6852(_0x430e71);return _0x3b2e25(_0x53f229);});})[_0x616a('0x19')](function(){return new BPromise(function(_0xad1fd9,_0x25613c){rimraf(_0x3b1cec,function(_0x4a6eaf){if(_0x4a6eaf)_0x25613c(_0x4a6eaf);return _0xad1fd9();});});})[_0x616a('0x19')](function(){return _0x498eeb[_0x616a('0xd1')](_0x512365,_0x1b4236,function(_0x130911){if(!_0x130911)fs[_0x616a('0xe2')](_0x512365);});});});}else{return _0x498eeb[_0x616a('0xf')](0xc8);}})[_0x616a('0x29')](handleError(_0x498eeb,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ec7ad60..feae036 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 _0x77c4=['MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','MailInteraction'];(function(_0x3136d6,_0x22c53e){var _0x2793d0=function(_0x30b9a3){while(--_0x30b9a3){_0x3136d6['push'](_0x3136d6['shift']());}};_0x2793d0(++_0x22c53e);}(_0x77c4,0x96));var _0x477c=function(_0x734635,_0x3ff344){_0x734635=_0x734635-0x0;var _0xbb63f6=_0x77c4[_0x734635];return _0xbb63f6;};'use strict';var EventEmitter=require(_0x477c('0x0'));var MailInteraction=require(_0x477c('0x1'))['db'][_0x477c('0x2')];var MailMessage=require(_0x477c('0x1'))['db'][_0x477c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x477c('0x4')](0x0);var events={'afterCreate':_0x477c('0x5'),'afterUpdate':_0x477c('0x6'),'afterDestroy':_0x477c('0x7')};function emitEvent(_0x37b082){return function(_0x3072cd,_0x3ce9b1,_0x497e80){_0x3072cd[_0x477c('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4aa6c8){_0x3072cd[_0x477c('0x9')](_0x477c('0xa'),_0x4aa6c8['map'](function(_0x247e2b){return{'id':_0x247e2b['id']};}));return MailMessage[_0x477c('0xb')]({'where':{'MailInteractionId':_0x3072cd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x344f24){_0x3072cd[_0x477c('0x9')](_0x477c('0xc'),_0x344f24[_0x477c('0xd')]);MailInteractionEvents['emit'](_0x37b082+':'+_0x3072cd['id'],_0x3072cd);MailInteractionEvents[_0x477c('0xe')](_0x37b082,_0x3072cd);_0x497e80(null);})[_0x477c('0xf')](_0x497e80(null));};}for(var e in events){if(events[_0x477c('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xd09d=['hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','then','Users','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd09d,0x1cd));var _0xdd09=function(_0x480e0d,_0x4f8dfb){_0x480e0d=_0x480e0d-0x0;var _0x2fb3d5=_0xd09d[_0x480e0d];return _0x2fb3d5;};'use strict';var EventEmitter=require(_0xdd09('0x0'));var MailInteraction=require(_0xdd09('0x1'))['db'][_0xdd09('0x2')];var MailMessage=require(_0xdd09('0x1'))['db'][_0xdd09('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdd09('0x4')](0x0);var events={'afterCreate':_0xdd09('0x5'),'afterUpdate':_0xdd09('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4e56a0){return function(_0x189773,_0xfb83a,_0x48e053){_0x189773['getUsers']({'attributes':['id'],'raw':!![]})[_0xdd09('0x7')](function(_0x499e35){_0x189773['setDataValue'](_0xdd09('0x8'),_0x499e35['map'](function(_0x34586c){return{'id':_0x34586c['id']};}));return MailMessage[_0xdd09('0x9')]({'where':{'MailInteractionId':_0x189773['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdd09('0x7')](function(_0x2e4ede){_0x189773[_0xdd09('0xa')](_0xdd09('0xb'),_0x2e4ede['length']);MailInteractionEvents[_0xdd09('0xc')](_0x4e56a0+':'+_0x189773['id'],_0x189773);MailInteractionEvents[_0xdd09('0xc')](_0x4e56a0,_0x189773);_0x48e053(null);})[_0xdd09('0xd')](_0x48e053(null));};}for(var e in events){if(events[_0xdd09('0xe')](e)){var event=events[e];MailInteraction[_0xdd09('0xf')](e,emitEvent(event));}}module[_0xdd09('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 0b52411..bd09e09 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 _0x85e6=['utf8mb4_unicode_ci','lodash','api','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85e6,0x1c1));var _0x685e=function(_0xa7968f,_0x3698a2){_0xa7968f=_0xa7968f-0x0;var _0x38cc5c=_0x85e6[_0xa7968f];return _0x38cc5c;};'use strict';var _=require(_0x685e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x685e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x685e('0x2'));var fs=require('fs');var path=require(_0x685e('0x3'));var rimraf=require(_0x685e('0x4'));var config=require(_0x685e('0x5'));var attributes=require(_0x685e('0x6'));module[_0x685e('0x7')]=function(_0x3a3f07,_0x3d5b63){return _0x3a3f07[_0x685e('0x8')](_0x685e('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x685e('0xa'),'fields':[_0x685e('0xb'),'to'],'type':_0x685e('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x148084,_0x18fbe1,_0x57227c){if(_0x148084[_0x685e('0xd')]){_0x148084[_0x685e('0xe')]=moment()[_0x685e('0xf')](_0x685e('0x10'));}if(_0x148084[_0x685e('0x11')]){_0x148084[_0x685e('0x12')]=moment()['format'](_0x685e('0x10'));}_0x57227c(null,_0x18fbe1);},'beforeUpdate':function(_0x4ad048,_0x10c945,_0x39c356){if(_0x4ad048[_0x685e('0x13')](_0x685e('0xd'))){_0x4ad048[_0x685e('0xe')]=_0x4ad048[_0x685e('0xd')]?moment()[_0x685e('0xf')](_0x685e('0x10')):null;}if(_0x4ad048[_0x685e('0x13')](_0x685e('0x11'))){_0x4ad048[_0x685e('0x12')]=moment()[_0x685e('0xf')](_0x685e('0x10'));_0x4ad048[_0x685e('0xd')]=null;_0x4ad048[_0x685e('0xe')]=null;}_0x39c356(null,_0x4ad048);},'afterUpdate':function(_0x52f126,_0x33f8a5,_0x26a005){var _0x360220=_0x3a3f07[_0x685e('0x14')];var _0x5f555e=_0x52f126[_0x685e('0x15')]({'plain':!![]});if(_0x5f555e[_0x685e('0x11')]){return _0x360220[_0x685e('0x16')][_0x685e('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x5f555e['id']}})[_0x685e('0x18')](function(){_0x26a005();})[_0x685e('0x19')](function(_0x425386){_0x26a005(_0x425386);});}else{_0x26a005();}}},'charset':_0x685e('0x1a'),'collate':_0x685e('0x1b')});}; \ No newline at end of file +var _0xe99f=['closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','subject','FULLTEXT','substatusAt','format','closed'];(function(_0x4ed37d,_0x1a84c9){var _0x4fb2c5=function(_0x5c9013){while(--_0x5c9013){_0x4ed37d['push'](_0x4ed37d['shift']());}};_0x4fb2c5(++_0x1a84c9);}(_0xe99f,0x193));var _0xfe99=function(_0x347349,_0x21c30b){_0x347349=_0x347349-0x0;var _0x44e065=_0xe99f[_0x347349];return _0x44e065;};'use strict';var _=require(_0xfe99('0x0'));var util=require(_0xfe99('0x1'));var logger=require(_0xfe99('0x2'))('api');var moment=require(_0xfe99('0x3'));var BPromise=require(_0xfe99('0x4'));var rp=require(_0xfe99('0x5'));var fs=require('fs');var path=require(_0xfe99('0x6'));var rimraf=require(_0xfe99('0x7'));var config=require(_0xfe99('0x8'));var attributes=require('./mailInteraction.attributes');module[_0xfe99('0x9')]=function(_0x2895dc,_0x3a6446){return _0x2895dc[_0xfe99('0xa')](_0xfe99('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xfe99('0xc'),'to'],'type':_0xfe99('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20e44b,_0x49b87c,_0x36d89e){if(_0x20e44b['substatus']){_0x20e44b[_0xfe99('0xe')]=moment()[_0xfe99('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x20e44b[_0xfe99('0x10')]){_0x20e44b[_0xfe99('0x11')]=moment()[_0xfe99('0xf')](_0xfe99('0x12'));}_0x36d89e(null,_0x49b87c);},'beforeUpdate':function(_0x3e04f0,_0x1403c9,_0x4e0a2e){if(_0x3e04f0[_0xfe99('0x13')](_0xfe99('0x14'))){_0x3e04f0[_0xfe99('0xe')]=_0x3e04f0['substatus']?moment()[_0xfe99('0xf')](_0xfe99('0x12')):null;}if(_0x3e04f0[_0xfe99('0x13')](_0xfe99('0x10'))){_0x3e04f0[_0xfe99('0x11')]=moment()['format'](_0xfe99('0x12'));_0x3e04f0['substatus']=null;_0x3e04f0[_0xfe99('0xe')]=null;}_0x4e0a2e(null,_0x3e04f0);},'afterUpdate':function(_0x44a3cb,_0x38686b,_0x481073){var _0x2cee77=_0x2895dc['models'];var _0x55b25c=_0x44a3cb[_0xfe99('0x15')]({'plain':!![]});if(_0x55b25c[_0xfe99('0x10')]){return _0x2cee77[_0xfe99('0x16')][_0xfe99('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x55b25c['id']}})[_0xfe99('0x18')](function(){_0x481073();})[_0xfe99('0x19')](function(_0x2776d7){_0x481073(_0x2776d7);});}else{_0x481073();}}},'charset':_0xfe99('0x1a'),'collate':_0xfe99('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4cd5654..7bb5955 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 _0x6eec=['result','catch','UpdateMailInteraction','update','options','raw','where','limit','then','stringify','AddTagsToMailInteraction','MailInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5457e9,_0x4a575e){var _0x2e9414=function(_0xa8c65b){while(--_0xa8c65b){_0x5457e9['push'](_0x5457e9['shift']());}};_0x2e9414(++_0x4a575e);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var moment=require(_0xc6ee('0x2'));var BPromise=require(_0xc6ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6ee('0x4'));var db=require(_0xc6ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6ee('0x6'))(_0xc6ee('0x7'));var config=require(_0xc6ee('0x8'));var jayson=require(_0xc6ee('0x9'));var client=jayson[_0xc6ee('0xa')][_0xc6ee('0xb')]({'port':0x232a});config[_0xc6ee('0xc')]=_[_0xc6ee('0xd')](config[_0xc6ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6ee('0xc')]));require(_0xc6ee('0xe'))['register'](socket);function respondWithRpcPromise(_0x10a743,_0x5f57ec,_0x294274){return new BPromise(function(_0x2e999c,_0x405ce3){return client[_0xc6ee('0xf')](_0x10a743,_0x294274)['then'](function(_0x122a94){logger[_0xc6ee('0x10')](_0xc6ee('0x11'),_0x5f57ec,'request\x20sent');logger[_0xc6ee('0x12')](_0xc6ee('0x13'),_0x5f57ec,_0xc6ee('0x14'),JSON['stringify'](_0x122a94));if(_0x122a94[_0xc6ee('0x15')]){if(_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x16')]===0x1f4){logger['error'](_0xc6ee('0x11'),_0x5f57ec,_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x17')]);return _0x405ce3(_0x122a94['error'][_0xc6ee('0x17')]);}logger[_0xc6ee('0x15')](_0xc6ee('0x11'),_0x5f57ec,_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x17')]);return _0x2e999c(_0x122a94[_0xc6ee('0x15')][_0xc6ee('0x17')]);}else{logger[_0xc6ee('0x10')](_0xc6ee('0x11'),_0x5f57ec,_0xc6ee('0x14'));_0x2e999c(_0x122a94[_0xc6ee('0x18')][_0xc6ee('0x17')]);}})[_0xc6ee('0x19')](function(_0xee8280){logger[_0xc6ee('0x15')](_0xc6ee('0x11'),_0x5f57ec,_0xee8280);_0x405ce3(_0xee8280);});});}exports[_0xc6ee('0x1a')]=function(_0x41e260){var _0x31701c=this;return new Promise(function(_0x2d4d65,_0x167181){return db['MailInteraction'][_0xc6ee('0x1b')](_0x41e260['body'],{'raw':_0x41e260['options']?_0x41e260[_0xc6ee('0x1c')][_0xc6ee('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e260[_0xc6ee('0x1c')]?_0x41e260['options'][_0xc6ee('0x1e')]||null:null,'attributes':_0x41e260['options']?_0x41e260[_0xc6ee('0x1c')]['attributes']||null:null,'limit':_0x41e260[_0xc6ee('0x1c')]?_0x41e260[_0xc6ee('0x1c')][_0xc6ee('0x1f')]||null:null})[_0xc6ee('0x20')](function(_0x1b48a4){logger[_0xc6ee('0x10')]('UpdateMailInteraction',_0x41e260);logger['debug'](_0xc6ee('0x1a'),_0x41e260,JSON[_0xc6ee('0x21')](_0x1b48a4));_0x2d4d65(_0x1b48a4);})['catch'](function(_0x18ae95){logger['error'](_0xc6ee('0x1a'),_0x18ae95[_0xc6ee('0x17')],_0x41e260);_0x167181(_0x31701c[_0xc6ee('0x15')](0x1f4,_0x18ae95['message']));});});};exports[_0xc6ee('0x22')]=function(_0x126b10){return new Promise(function(_0x450f0e,_0x2c01f4){return db[_0xc6ee('0x23')][_0xc6ee('0x24')]({'where':_0x126b10[_0xc6ee('0x1c')]?_0x126b10['options'][_0xc6ee('0x1e')]||null:null})['then'](function(_0x20efe3){if(_0x20efe3){return _0x20efe3[_0xc6ee('0x25')](_0x126b10[_0xc6ee('0x26')][_0xc6ee('0x27')],_[_0xc6ee('0x28')](_0x126b10['body'],[_0xc6ee('0x27'),'id'])||{});}})['spread'](function(_0x2702f3){logger[_0xc6ee('0x10')](_0xc6ee('0x29'),_0x126b10);logger[_0xc6ee('0x12')]('AddTags',_0x126b10,JSON[_0xc6ee('0x21')](_0x2702f3));_0x450f0e(_0x2702f3);})[_0xc6ee('0x19')](function(_0x4c0baa){logger[_0xc6ee('0x15')]('AddTags',_0x4c0baa[_0xc6ee('0x17')],_0x126b10);_0x2c01f4(_this[_0xc6ee('0x15')](0x1f4,_0x4c0baa[_0xc6ee('0x17')]));});});}; \ No newline at end of file +var _0xfa0b=['http','redis','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfa0b,0x1cc));var _0xbfa0=function(_0x466e6b,_0x4053fd){_0x466e6b=_0x466e6b-0x0;var _0x118deb=_0xfa0b[_0x466e6b];return _0x118deb;};'use strict';var _=require(_0xbfa0('0x0'));var util=require('util');var moment=require(_0xbfa0('0x1'));var BPromise=require(_0xbfa0('0x2'));var rs=require(_0xbfa0('0x3'));var fs=require('fs');var Redis=require(_0xbfa0('0x4'));var db=require(_0xbfa0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfa0('0x6'))(_0xbfa0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbfa0('0x8')]({'port':0x232a});config[_0xbfa0('0x9')]=_['defaults'](config[_0xbfa0('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfa0('0x9')]));require(_0xbfa0('0xa'))[_0xbfa0('0xb')](socket);function respondWithRpcPromise(_0x4737ab,_0x437544,_0x4ad339){return new BPromise(function(_0x2c31f9,_0x23b852){return client[_0xbfa0('0xc')](_0x4737ab,_0x4ad339)[_0xbfa0('0xd')](function(_0x5e9710){logger[_0xbfa0('0xe')](_0xbfa0('0xf'),_0x437544,_0xbfa0('0x10'));logger[_0xbfa0('0x11')](_0xbfa0('0x12'),_0x437544,_0xbfa0('0x10'),JSON[_0xbfa0('0x13')](_0x5e9710));if(_0x5e9710['error']){if(_0x5e9710[_0xbfa0('0x14')]['code']===0x1f4){logger[_0xbfa0('0x14')](_0xbfa0('0xf'),_0x437544,_0x5e9710[_0xbfa0('0x14')][_0xbfa0('0x15')]);return _0x23b852(_0x5e9710['error'][_0xbfa0('0x15')]);}logger[_0xbfa0('0x14')](_0xbfa0('0xf'),_0x437544,_0x5e9710[_0xbfa0('0x14')][_0xbfa0('0x15')]);return _0x2c31f9(_0x5e9710[_0xbfa0('0x14')][_0xbfa0('0x15')]);}else{logger[_0xbfa0('0xe')](_0xbfa0('0xf'),_0x437544,_0xbfa0('0x10'));_0x2c31f9(_0x5e9710[_0xbfa0('0x16')][_0xbfa0('0x15')]);}})[_0xbfa0('0x17')](function(_0x1172a7){logger[_0xbfa0('0x14')](_0xbfa0('0xf'),_0x437544,_0x1172a7);_0x23b852(_0x1172a7);});});}exports[_0xbfa0('0x18')]=function(_0x43af99){var _0x1e1963=this;return new Promise(function(_0x49813c,_0x3fa9a9){return db[_0xbfa0('0x19')][_0xbfa0('0x1a')](_0x43af99[_0xbfa0('0x1b')],{'raw':_0x43af99[_0xbfa0('0x1c')]?_0x43af99[_0xbfa0('0x1c')][_0xbfa0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43af99[_0xbfa0('0x1c')]?_0x43af99['options'][_0xbfa0('0x1e')]||null:null,'attributes':_0x43af99[_0xbfa0('0x1c')]?_0x43af99[_0xbfa0('0x1c')][_0xbfa0('0x1f')]||null:null,'limit':_0x43af99[_0xbfa0('0x1c')]?_0x43af99[_0xbfa0('0x1c')][_0xbfa0('0x20')]||null:null})[_0xbfa0('0xd')](function(_0x4105fa){logger[_0xbfa0('0xe')]('UpdateMailInteraction',_0x43af99);logger[_0xbfa0('0x11')](_0xbfa0('0x18'),_0x43af99,JSON[_0xbfa0('0x13')](_0x4105fa));_0x49813c(_0x4105fa);})[_0xbfa0('0x17')](function(_0x4906bb){logger[_0xbfa0('0x14')](_0xbfa0('0x18'),_0x4906bb[_0xbfa0('0x15')],_0x43af99);_0x3fa9a9(_0x1e1963[_0xbfa0('0x14')](0x1f4,_0x4906bb['message']));});});};exports['AddTagsToMailInteraction']=function(_0x8db9fc){return new Promise(function(_0x33cb9e,_0x25d353){return db[_0xbfa0('0x19')]['find']({'where':_0x8db9fc[_0xbfa0('0x1c')]?_0x8db9fc['options'][_0xbfa0('0x1e')]||null:null})['then'](function(_0x8eb51a){if(_0x8eb51a){return _0x8eb51a[_0xbfa0('0x21')](_0x8db9fc[_0xbfa0('0x1b')]['ids'],_['omit'](_0x8db9fc[_0xbfa0('0x1b')],[_0xbfa0('0x22'),'id'])||{});}})['spread'](function(_0x3c077d){logger[_0xbfa0('0xe')]('AddTags',_0x8db9fc);logger[_0xbfa0('0x11')](_0xbfa0('0x23'),_0x8db9fc,JSON['stringify'](_0x3c077d));_0x33cb9e(_0x3c077d);})[_0xbfa0('0x17')](function(_0x55c94e){logger['error'](_0xbfa0('0x23'),_0x55c94e[_0xbfa0('0x15')],_0x8db9fc);_0x25d353(_this['error'](0x1f4,_0x55c94e[_0xbfa0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 466ce1c..ed53541 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 _0xc9ab=['length','mailInteraction:','remove','update','emit'];(function(_0x1a526e,_0x52e31b){var _0x14e7c4=function(_0x221161){while(--_0x221161){_0x1a526e['push'](_0x1a526e['shift']());}};_0x14e7c4(++_0x52e31b);}(_0xc9ab,0x1bf));var _0xbc9a=function(_0x43c6ef,_0x4fed76){_0x43c6ef=_0x43c6ef-0x0;var _0x3695cc=_0xc9ab[_0x43c6ef];return _0x3695cc;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xbc9a('0x0'),_0xbc9a('0x1')];function createListener(_0x18e590,_0x4f9d3c){return function(_0x442015){_0x4f9d3c[_0xbc9a('0x2')](_0x18e590,_0x442015);};}function removeListener(_0x224182,_0x28a621){return function(){MailInteractionEvents['removeListener'](_0x224182,_0x28a621);};}exports['register']=function(_0x207764){for(var _0x45d572=0x0,_0x3ab8f3=events[_0xbc9a('0x3')];_0x45d572<_0x3ab8f3;_0x45d572++){var _0x5df37f=events[_0x45d572];var _0x3dbead=createListener(_0xbc9a('0x4')+_0x5df37f,_0x207764);MailInteractionEvents['on'](_0x5df37f,_0x3dbead);}}; \ No newline at end of file +var _0xc61d=['./mailInteraction.events','save','remove','emit','removeListener','register','length','mailInteraction:'];(function(_0x1950c3,_0x4e5f7b){var _0x435897=function(_0x44c16d){while(--_0x44c16d){_0x1950c3['push'](_0x1950c3['shift']());}};_0x435897(++_0x4e5f7b);}(_0xc61d,0x1e8));var _0xdc61=function(_0x3ab0ec,_0x305d83){_0x3ab0ec=_0x3ab0ec-0x0;var _0x34d00e=_0xc61d[_0x3ab0ec];return _0x34d00e;};'use strict';var MailInteractionEvents=require(_0xdc61('0x0'));var events=[_0xdc61('0x1'),_0xdc61('0x2'),'update'];function createListener(_0x3e3882,_0x456b69){return function(_0x1410d3){_0x456b69[_0xdc61('0x3')](_0x3e3882,_0x1410d3);};}function removeListener(_0x411b52,_0x3348a5){return function(){MailInteractionEvents[_0xdc61('0x4')](_0x411b52,_0x3348a5);};}exports[_0xdc61('0x5')]=function(_0x1d4020){for(var _0x20b51d=0x0,_0x10f6a8=events[_0xdc61('0x6')];_0x20b51d<_0x10f6a8;_0x20b51d++){var _0x4d01cf=events[_0x20b51d];var _0x5b389a=createListener(_0xdc61('0x7')+_0x4d01cf,_0x1d4020);MailInteractionEvents['on'](_0x4d01cf,_0x5b389a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 44ba608..7e3d0f1 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 _0x9bc3=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','tracked','create','put','update','reject','delete','destroy','exports','multer'];(function(_0x9c0f90,_0x552310){var _0x48a313=function(_0x2a1b48){while(--_0x2a1b48){_0x9c0f90['push'](_0x9c0f90['shift']());}};_0x48a313(++_0x552310);}(_0x9bc3,0x137));var _0x39bc=function(_0x5fa75f,_0x5b1be6){_0x5fa75f=_0x5fa75f-0x0;var _0x1122bb=_0x9bc3[_0x5fa75f];return _0x1122bb;};'use strict';var multer=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var path=require(_0x39bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x39bc('0x3'));var router=express[_0x39bc('0x4')]();var fs_extra=require(_0x39bc('0x5'));var auth=require(_0x39bc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x39bc('0x7'));var controller=require(_0x39bc('0x8'));router[_0x39bc('0x9')]('/',auth[_0x39bc('0xa')](),controller['index']);router[_0x39bc('0x9')](_0x39bc('0xb'),auth[_0x39bc('0xa')](),controller[_0x39bc('0xc')]);router[_0x39bc('0x9')](_0x39bc('0xd'),auth[_0x39bc('0xa')](),controller[_0x39bc('0xe')]);router['get'](_0x39bc('0xf'),auth[_0x39bc('0xa')](),controller[_0x39bc('0x10')]);router[_0x39bc('0x11')]('/',auth[_0x39bc('0xa')](),interaction[_0x39bc('0x12')]('mail','mailmessage:create'),controller[_0x39bc('0x13')]);router[_0x39bc('0x14')]('/:id',auth[_0x39bc('0xa')](),controller[_0x39bc('0x15')]);router[_0x39bc('0x14')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x39bc('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x39bc('0x16')]);router[_0x39bc('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x39bc('0x18')]);module[_0x39bc('0x19')]=router; \ No newline at end of file +var _0x7980=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path'];(function(_0x4cd56e,_0x56661a){var _0x110558=function(_0x215591){while(--_0x215591){_0x4cd56e['push'](_0x4cd56e['shift']());}};_0x110558(++_0x56661a);}(_0x7980,0xab));var _0x0798=function(_0x37afc8,_0x202da3){_0x37afc8=_0x37afc8-0x0;var _0x19d17a=_0x7980[_0x37afc8];return _0x19d17a;};'use strict';var multer=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var path=require(_0x0798('0x2'));var timeout=require(_0x0798('0x3'));var express=require(_0x0798('0x4'));var router=express['Router']();var fs_extra=require(_0x0798('0x5'));var auth=require(_0x0798('0x6'));var interaction=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var controller=require(_0x0798('0x9'));router['get']('/',auth[_0x0798('0xa')](),controller['index']);router[_0x0798('0xb')](_0x0798('0xc'),auth[_0x0798('0xa')](),controller['describe']);router['get'](_0x0798('0xd'),auth[_0x0798('0xa')](),controller[_0x0798('0xe')]);router[_0x0798('0xb')](_0x0798('0xf'),auth[_0x0798('0xa')](),controller[_0x0798('0x10')]);router[_0x0798('0x11')]('/',auth[_0x0798('0xa')](),interaction[_0x0798('0x12')]('mail',_0x0798('0x13')),controller[_0x0798('0x14')]);router['put']('/:id',auth[_0x0798('0xa')](),controller[_0x0798('0x15')]);router[_0x0798('0x16')](_0x0798('0x17'),auth[_0x0798('0xa')](),controller[_0x0798('0x18')]);router[_0x0798('0x16')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0798('0x19')]);router[_0x0798('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x0798('0x1b')]);module[_0x0798('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 716045b..09c4ffc 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 _0x00e0=['INTEGER','Email','Chat','long','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x25a8fc,_0x2dad1b){var _0x449ad0=function(_0x42f1b6){while(--_0x42f1b6){_0x25a8fc['push'](_0x25a8fc['shift']());}};_0x449ad0(++_0x2dad1b);}(_0x00e0,0x123));var _0x000e=function(_0x101d5f,_0x495a91){_0x101d5f=_0x101d5f-0x0;var _0x3425bf=_0x00e0[_0x101d5f];return _0x3425bf;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize['TEXT'](_0x000e('0x0')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x000e('0x1')]('medium')},'read':{'type':Sequelize[_0x000e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x000e('0x3')]('in','out'),'defaultValue':_0x000e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x000e('0x5')]},'to':{'type':Sequelize['TEXT'](_0x000e('0x0'))},'cc':{'type':Sequelize[_0x000e('0x1')](_0x000e('0x0'))},'bcc':{'type':Sequelize[_0x000e('0x1')](_0x000e('0x0'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x000e('0x6')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x000e('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x000e('0x1')](_0x000e('0x0'))},'originCc':{'type':Sequelize[_0x000e('0x1')](_0x000e('0x0'))},'originChannel':{'type':Sequelize[_0x000e('0x3')](_0x000e('0x7'),_0x000e('0x8')),'defaultValue':_0x000e('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x69d7=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','sequelize','lodash','TEXT','long'];(function(_0xca5cc5,_0x2486f6){var _0x36a2b7=function(_0x419e77){while(--_0x419e77){_0xca5cc5['push'](_0xca5cc5['shift']());}};_0x36a2b7(++_0x2486f6);}(_0x69d7,0xd8));var _0x769d=function(_0x2fdfcf,_0x3497fa){_0x2fdfcf=_0x2fdfcf-0x0;var _0x7eb4f7=_0x69d7[_0x2fdfcf];return _0x7eb4f7;};'use strict';var Sequelize=require(_0x769d('0x0'));var _=require(_0x769d('0x1'));module['exports']={'body':{'type':Sequelize[_0x769d('0x2')](_0x769d('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x769d('0x2')](_0x769d('0x4'))},'read':{'type':Sequelize[_0x769d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x769d('0x6')]('in',_0x769d('0x7')),'defaultValue':_0x769d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x769d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x769d('0x8')]},'to':{'type':Sequelize['TEXT'](_0x769d('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x769d('0x3'))},'bcc':{'type':Sequelize[_0x769d('0x2')](_0x769d('0x3'))},'subject':{'type':Sequelize[_0x769d('0x2')]},'sentAt':{'type':Sequelize[_0x769d('0x9')]},'attach':{'type':Sequelize[_0x769d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x769d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x769d('0x9')]},'originTo':{'type':Sequelize[_0x769d('0x2')](_0x769d('0x3'))},'originCc':{'type':Sequelize[_0x769d('0x2')](_0x769d('0x3'))},'originChannel':{'type':Sequelize[_0x769d('0x6')]('Email','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 1e339b6..5914ace 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 _0x1add=['sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','internal','toString','join','server','files','tmp','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','build','download','eml-format','moment','bluebird','util','path','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','limit','offset','status','set','Content-Range','update','then','destroy','sendStatus','name','send','MailMessage','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','findAll','rows','includeAll','find','body','params','describe','create','out','secret','findOne','MailAccountId','CmList','List','CmContact','updatedAt','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','root','basename','Contacts','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x1add,0x165));var _0xd1ad=function(_0x24676d,_0x3c0fd2){_0x24676d=_0x24676d-0x0;var _0x29c01a=_0x1add[_0x24676d];return _0x29c01a;};'use strict';var emlformat=require(_0xd1ad('0x0'));var moment=require(_0xd1ad('0x1'));var BPromise=require(_0xd1ad('0x2'));var util=require(_0xd1ad('0x3'));var path=require(_0xd1ad('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xd1ad('0x5'));var logger=require(_0xd1ad('0x6'))(_0xd1ad('0x7'));var interaction_log=require(_0xd1ad('0x6'))(_0xd1ad('0x8'));var config=require(_0xd1ad('0x9'));var db=require(_0xd1ad('0xa'))['db'];config[_0xd1ad('0xb')]=_[_0xd1ad('0xc')](config[_0xd1ad('0xb')],{'host':_0xd1ad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xd1ad('0xe'));require('./mailMessage.socket')[_0xd1ad('0xf')](socket);var jayson=require(_0xd1ad('0x10'));var client=jayson[_0xd1ad('0x11')][_0xd1ad('0x12')]({'port':0x232c});var client9003=jayson[_0xd1ad('0x11')][_0xd1ad('0x12')]({'port':0x232b});var client9002=jayson[_0xd1ad('0x11')][_0xd1ad('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xc2703,_0x467e3f,_0x4e92b5,_0x1bffe1){return new BPromise(function(_0x4adfd9,_0x1fcdcf){var _0x3fdbfd=_0x1bffe1||client;return _0x3fdbfd[_0xd1ad('0x13')](_0xc2703,_0x4e92b5)['then'](function(_0x2a2e61){logger[_0xd1ad('0x14')](_0xd1ad('0x15'),_0x467e3f,_0xd1ad('0x16'));logger[_0xd1ad('0x17')](_0xd1ad('0x18'),_0x467e3f,_0xd1ad('0x16'),JSON[_0xd1ad('0x19')](_0x2a2e61));if(_0x2a2e61[_0xd1ad('0x1a')]){if(_0x2a2e61[_0xd1ad('0x1a')][_0xd1ad('0x1b')]===0x1f4){logger[_0xd1ad('0x1a')](_0xd1ad('0x15'),_0x467e3f,_0x2a2e61['error']['message']);return _0x1fcdcf(_0x2a2e61[_0xd1ad('0x1a')]['message']);}logger[_0xd1ad('0x1a')](_0xd1ad('0x15'),_0x467e3f,_0x2a2e61[_0xd1ad('0x1a')][_0xd1ad('0x1c')]);return _0x4adfd9(_0x2a2e61[_0xd1ad('0x1a')][_0xd1ad('0x1c')]);}else{logger['info'](_0xd1ad('0x15'),_0x467e3f,_0xd1ad('0x16'));_0x4adfd9(_0x2a2e61[_0xd1ad('0x1d')][_0xd1ad('0x1c')]);}})[_0xd1ad('0x1e')](function(_0xf3ca99){logger[_0xd1ad('0x1a')](_0xd1ad('0x15'),_0x467e3f,_0xf3ca99);_0x1fcdcf(_0xf3ca99);});});}function respondWithResult(_0x377a86,_0x30a47c){_0x30a47c=_0x30a47c||0xc8;return function(_0x422654){if(_0x422654){return _0x377a86['status'](_0x30a47c)[_0xd1ad('0x1f')](_0x422654);}};}function respondWithFilteredResult(_0x27be74,_0x1d467c){return function(_0x2e494d){if(_0x2e494d){var _0xe9c6c7=typeof _0x1d467c['offset']===_0xd1ad('0x20')&&typeof _0x1d467c[_0xd1ad('0x21')]===_0xd1ad('0x20');var _0x5e63d1=_0x2e494d['count'];var _0xa61d76=_0xe9c6c7?0x0:_0x1d467c[_0xd1ad('0x22')];var _0x438c6e=_0xe9c6c7?_0x2e494d['count']:_0x1d467c['offset']+_0x1d467c['limit'];var _0x48b6c4;if(_0x438c6e>=_0x5e63d1){_0x438c6e=_0x5e63d1;_0x48b6c4=0xc8;}else{_0x48b6c4=0xce;}_0x27be74[_0xd1ad('0x23')](_0x48b6c4);return _0x27be74[_0xd1ad('0x24')](_0xd1ad('0x25'),_0xa61d76+'-'+_0x438c6e+'/'+_0x5e63d1)[_0xd1ad('0x1f')](_0x2e494d);}return null;};}function saveUpdates(_0x15e9fe){return function(_0xa7141b){if(_0xa7141b){return _0xa7141b[_0xd1ad('0x26')](_0x15e9fe)[_0xd1ad('0x27')](function(_0x35db70){return _0x35db70;});}return null;};}function removeEntity(_0x55a539){return function(_0x3873fa){if(_0x3873fa){return _0x3873fa[_0xd1ad('0x28')]()['then'](function(){_0x55a539[_0xd1ad('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6db4){return function(_0x5a76a1){if(!_0x5a76a1){_0x2d6db4[_0xd1ad('0x29')](0x194);}return _0x5a76a1;};}function handleError(_0x62372c,_0x359679){_0x359679=_0x359679||0x1f4;return function(_0x4367dc){logger['error'](_0x4367dc['stack']);if(_0x4367dc[_0xd1ad('0x2a')]){delete _0x4367dc[_0xd1ad('0x2a')];}_0x62372c[_0xd1ad('0x23')](_0x359679)[_0xd1ad('0x2b')](_0x4367dc);};}exports['index']=function(_0x4a4acf,_0x122852){var _0x2a0de5={},_0x193fb2={},_0x353f9e={'count':0x0,'rows':[]};var _0x1c37b5=_['map'](db[_0xd1ad('0x2c')][_0xd1ad('0x2d')],function(_0x7608aa){return{'name':_0x7608aa[_0xd1ad('0x2e')],'type':_0x7608aa['type']['key']};});_0x193fb2[_0xd1ad('0x2f')]=_[_0xd1ad('0x30')](_0x1c37b5,_0xd1ad('0x2a'));_0x193fb2['query']=_[_0xd1ad('0x31')](_0x4a4acf[_0xd1ad('0x32')]);_0x193fb2[_0xd1ad('0x33')]=_[_0xd1ad('0x34')](_0x193fb2[_0xd1ad('0x2f')],_0x193fb2[_0xd1ad('0x32')]);_0x2a0de5[_0xd1ad('0x35')]=_['intersection'](_0x193fb2[_0xd1ad('0x2f')],qs['fields'](_0x4a4acf[_0xd1ad('0x32')][_0xd1ad('0x36')]));_0x2a0de5[_0xd1ad('0x35')]=_0x2a0de5['attributes'][_0xd1ad('0x37')]?_0x2a0de5[_0xd1ad('0x35')]:_0x193fb2['model'];if(!_0x4a4acf[_0xd1ad('0x32')]['hasOwnProperty'](_0xd1ad('0x38'))){_0x2a0de5[_0xd1ad('0x21')]=qs['limit'](_0x4a4acf[_0xd1ad('0x32')][_0xd1ad('0x21')]);_0x2a0de5[_0xd1ad('0x22')]=qs[_0xd1ad('0x22')](_0x4a4acf[_0xd1ad('0x32')][_0xd1ad('0x22')]);}_0x2a0de5[_0xd1ad('0x39')]=qs[_0xd1ad('0x3a')](_0x4a4acf[_0xd1ad('0x32')]['sort']);_0x2a0de5[_0xd1ad('0x3b')]=qs[_0xd1ad('0x33')](_[_0xd1ad('0x3c')](_0x4a4acf['query'],_0x193fb2[_0xd1ad('0x33')]),_0x1c37b5);if(_0x4a4acf[_0xd1ad('0x32')]['filter']){_0x2a0de5['where']=_[_0xd1ad('0x3d')](_0x2a0de5[_0xd1ad('0x3b')],{'$or':_[_0xd1ad('0x30')](_0x1c37b5,function(_0x57ca86){if(_0x57ca86[_0xd1ad('0x3e')]!==_0xd1ad('0x3f')){var _0x59bec1={};_0x59bec1[_0x57ca86[_0xd1ad('0x2a')]]={'$like':'%'+_0x4a4acf['query'][_0xd1ad('0x40')]+'%'};return _0x59bec1;}})});}_0x2a0de5=_[_0xd1ad('0x3d')]({},_0x2a0de5,_0x4a4acf[_0xd1ad('0x41')]);var _0x1defb6={'where':_0x2a0de5[_0xd1ad('0x3b')]};return db['MailMessage'][_0xd1ad('0x42')](_0x1defb6)[_0xd1ad('0x27')](function(_0x508a7b){_0x353f9e[_0xd1ad('0x42')]=_0x508a7b;if(_0x4a4acf[_0xd1ad('0x32')]['includeAll']){_0x2a0de5['include']=[{'all':!![]}];}return db[_0xd1ad('0x2c')][_0xd1ad('0x43')](_0x2a0de5);})[_0xd1ad('0x27')](function(_0x408755){_0x353f9e[_0xd1ad('0x44')]=_0x408755;return _0x353f9e;})['then'](respondWithFilteredResult(_0x122852,_0x2a0de5))[_0xd1ad('0x1e')](handleError(_0x122852,null));};exports['show']=function(_0x4002dd,_0xea6eb4){var _0x453316={'raw':!![],'where':{'id':_0x4002dd['params']['id']}},_0x262bf0={};_0x262bf0[_0xd1ad('0x2f')]=_['keys'](db[_0xd1ad('0x2c')][_0xd1ad('0x2d')]);_0x262bf0[_0xd1ad('0x32')]=_['keys'](_0x4002dd[_0xd1ad('0x32')]);_0x262bf0['filters']=_['intersection'](_0x262bf0[_0xd1ad('0x2f')],_0x262bf0[_0xd1ad('0x32')]);_0x453316[_0xd1ad('0x35')]=_['intersection'](_0x262bf0['model'],qs[_0xd1ad('0x36')](_0x4002dd[_0xd1ad('0x32')][_0xd1ad('0x36')]));_0x453316[_0xd1ad('0x35')]=_0x453316[_0xd1ad('0x35')][_0xd1ad('0x37')]?_0x453316['attributes']:_0x262bf0[_0xd1ad('0x2f')];if(_0x4002dd['query'][_0xd1ad('0x45')]){_0x453316['include']=[{'all':!![]}];}_0x453316=_[_0xd1ad('0x3d')]({},_0x453316,_0x4002dd[_0xd1ad('0x41')]);return db['MailMessage'][_0xd1ad('0x46')](_0x453316)[_0xd1ad('0x27')](handleEntityNotFound(_0xea6eb4,null))[_0xd1ad('0x27')](respondWithResult(_0xea6eb4,null))[_0xd1ad('0x1e')](handleError(_0xea6eb4,null));};exports[_0xd1ad('0x26')]=function(_0x32c688,_0x48a5b9){if(_0x32c688[_0xd1ad('0x47')]['id']){delete _0x32c688[_0xd1ad('0x47')]['id'];}return db['MailMessage'][_0xd1ad('0x46')]({'where':{'id':_0x32c688['params']['id']}})[_0xd1ad('0x27')](handleEntityNotFound(_0x48a5b9,null))[_0xd1ad('0x27')](saveUpdates(_0x32c688[_0xd1ad('0x47')],null))['then'](respondWithResult(_0x48a5b9,null))[_0xd1ad('0x1e')](handleError(_0x48a5b9,null));};exports[_0xd1ad('0x28')]=function(_0x84e9d3,_0x3a93a9){return db[_0xd1ad('0x2c')][_0xd1ad('0x46')]({'where':{'id':_0x84e9d3[_0xd1ad('0x48')]['id']}})[_0xd1ad('0x27')](handleEntityNotFound(_0x3a93a9,null))['then'](removeEntity(_0x3a93a9,null))['catch'](handleError(_0x3a93a9,null));};exports[_0xd1ad('0x49')]=function(_0x5d711f,_0x426637){return db['MailMessage'][_0xd1ad('0x49')]()[_0xd1ad('0x27')](respondWithResult(_0x426637,null))[_0xd1ad('0x1e')](handleError(_0x426637,null));};exports['create']=function(_0x2cbdd7,_0x1d9e95){return db[_0xd1ad('0x2c')][_0xd1ad('0x4a')](_0x2cbdd7[_0xd1ad('0x47')])[_0xd1ad('0x27')](function(_0x5c67dc){if(_0x5c67dc){if(_0x5c67dc['direction']===_0xd1ad('0x4b')&&!_0x5c67dc[_0xd1ad('0x4c')]){var _0x1c676b,_0x1603ac,_0x3ce065;if(_0x2cbdd7[_0xd1ad('0x47')]['to']){_0x1603ac=_0x2cbdd7[_0xd1ad('0x47')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xd1ad('0x4d')]({'where':{'id':_0x5c67dc[_0xd1ad('0x4e')]},'include':[{'model':db[_0xd1ad('0x4f')],'as':_0xd1ad('0x50'),'include':[{'model':db[_0xd1ad('0x51')],'as':'Contacts','where':{'email':_0x1603ac},'limit':0x1,'order':[[_0xd1ad('0x52'),'DESC']]}]},{'model':db[_0xd1ad('0x53')],'as':_0xd1ad('0x54'),'raw':!![]}]})[_0xd1ad('0x27')](function(_0x14e073){_0x1c676b=_0x14e073;if(_0x1c676b&&_0x1c676b['Smtp']){var _0x54549f={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x1c676b['Smtp'][_0xd1ad('0x55')])){_0x54549f[_0xd1ad('0x56')]=_0x1c676b[_0xd1ad('0x54')][_0xd1ad('0x56')];_0x54549f['port']=_0x1c676b[_0xd1ad('0x54')][_0xd1ad('0x57')];_0x54549f[_0xd1ad('0x58')]=_0x1c676b[_0xd1ad('0x54')]['secure'];if(_0x1c676b[_0xd1ad('0x54')][_0xd1ad('0x59')]){_0x54549f[_0xd1ad('0x5a')]={'user':_0x1c676b['Smtp'][_0xd1ad('0x5b')],'pass':_0x1c676b[_0xd1ad('0x54')][_0xd1ad('0x5c')]};}}else{_0x54549f[_0xd1ad('0x55')]=_0x1c676b[_0xd1ad('0x54')][_0xd1ad('0x55')];_0x54549f[_0xd1ad('0x5a')]={'user':_0x1c676b[_0xd1ad('0x54')][_0xd1ad('0x5b')],'pass':_0x1c676b['Smtp'][_0xd1ad('0x5c')]};_0x54549f[_0xd1ad('0x58')]=_0x1c676b[_0xd1ad('0x54')][_0xd1ad('0x58')];}if(_0x2cbdd7[_0xd1ad('0x47')][_0xd1ad('0x5d')]&&_0x2cbdd7[_0xd1ad('0x47')]['attachments'][_0xd1ad('0x37')]){for(var _0x5251d5=0x0;_0x5251d5<_0x2cbdd7[_0xd1ad('0x47')][_0xd1ad('0x5d')]['length'];_0x5251d5+=0x1){_0x2cbdd7['body']['attachments'][_0x5251d5]={'filename':_0x2cbdd7[_0xd1ad('0x47')][_0xd1ad('0x5d')][_0x5251d5][_0xd1ad('0x2a')],'path':path['join'](config[_0xd1ad('0x5e')],'server/files/attachments',_0x2cbdd7[_0xd1ad('0x47')]['attachments'][_0x5251d5][_0xd1ad('0x5f')])};}}_0x3ce065={'account':_0x54549f,'message':_0x2cbdd7['body']};return;}})[_0xd1ad('0x27')](function(){if(_0x1c676b['List']){if(_0x1c676b['List'][_0xd1ad('0x60')][_0xd1ad('0x37')]){return _0x1c676b[_0xd1ad('0x50')]['Contacts'][0x0];}else{return db[_0xd1ad('0x51')][_0xd1ad('0x4a')](_['defaults'](_0x2cbdd7[_0xd1ad('0x47')],{'firstName':_0x2cbdd7[_0xd1ad('0x47')]['to'],'email':_0x2cbdd7[_0xd1ad('0x47')]['to'],'phone':_0x2cbdd7[_0xd1ad('0x47')]['to'],'ListId':_0x1c676b['ListId']}));}}else{throw new Error(_0xd1ad('0x61'));}})[_0xd1ad('0x27')](function(){if(_0x3ce065){return respondWithRpcPromise(_0xd1ad('0x62'),_0xd1ad('0x63'),_0x3ce065,client9003)[_0xd1ad('0x27')](function(_0x3b209f){return _0x5c67dc[_0xd1ad('0x26')]({'read':!![],'messageId':_0x3b209f[_0xd1ad('0x64')],'sentAt':moment()[_0xd1ad('0x65')](_0xd1ad('0x66'))});})[_0xd1ad('0x1e')](function(_0x5ba90d){logger[_0xd1ad('0x1a')]('%s',JSON[_0xd1ad('0x19')](_0x5ba90d));return _0x5c67dc;});}return _0x5c67dc;});}return _0x5c67dc;}})['then'](respondWithResult(_0x1d9e95,0xc9))[_0xd1ad('0x1e')](handleError(_0x1d9e95,null));};exports[_0xd1ad('0x67')]=function(_0x4f1251,_0x382f18){var _0x267ef4={'agent':{},'channel':_0xd1ad('0x68')};if(_0x4f1251[_0xd1ad('0x47')]['id']){delete _0x4f1251[_0xd1ad('0x47')]['id'];}_0x4f1251[_0xd1ad('0x47')][_0xd1ad('0x69')]=!![];_0x4f1251['body'][_0xd1ad('0x6a')]=moment()[_0xd1ad('0x65')](_0xd1ad('0x66'));_0x4f1251[_0xd1ad('0x47')]['UserId']=_0x4f1251[_0xd1ad('0x47')]['UserId']||_0x4f1251[_0xd1ad('0x5b')]['id'];_0x267ef4['agent']['id']=_0x4f1251[_0xd1ad('0x47')][_0xd1ad('0x6b')];return db[_0xd1ad('0x2c')][_0xd1ad('0x46')]({'where':{'id':_0x4f1251[_0xd1ad('0x48')]['id'],'UserId':null}})[_0xd1ad('0x27')](handleEntityNotFound(_0x382f18,null))[_0xd1ad('0x27')](saveUpdates(_0x4f1251[_0xd1ad('0x47')],null))[_0xd1ad('0x27')](function(_0x4b6664){if(_0x4b6664){_0x267ef4[_0xd1ad('0x1c')]=_0x4b6664[_0xd1ad('0x6c')]({'plain':!![]});return db[_0xd1ad('0x6d')][_0xd1ad('0x46')]({'where':{'id':_0x4b6664[_0xd1ad('0x6e')]}});}return null;})[_0xd1ad('0x27')](handleEntityNotFound(_0x382f18,null))[_0xd1ad('0x27')](function(_0x34987a){if(_0x34987a){return _0x34987a['update']({'UserId':_0x4f1251[_0xd1ad('0x47')]['UserId'],'read1stAt':_[_0xd1ad('0x6f')](_0x34987a[_0xd1ad('0x70')])?moment()['format'](_0xd1ad('0x66')):undefined});}return null;})[_0xd1ad('0x27')](function(_0x10290a){if(_0x10290a){_0x267ef4['interaction']=_0x10290a['get']({'plain':!![]});interaction_log[_0xd1ad('0x14')](_0xd1ad('0x71'),_0x4f1251[_0xd1ad('0x5b')]['id'],_0x4f1251[_0xd1ad('0x5b')][_0xd1ad('0x2a')],_0x4f1251[_0xd1ad('0x5b')][_0xd1ad('0x72')],_0x267ef4[_0xd1ad('0x73')]['id'],_0x4f1251[_0xd1ad('0x47')]?JSON['stringify'](_0x4f1251['body']):_0xd1ad('0x74'));return respondWithRpcPromise('AcceptMessage',_0xd1ad('0x75'),_0x267ef4);}return null;})['then'](function(_0x5a2310){var _0x59c601=_0xd1ad('0x76')+_0x5a2310[_0xd1ad('0x1c')][_0xd1ad('0x77')];return db[_0xd1ad('0x78')][_0xd1ad('0x32')](_0x59c601,{'type':db[_0xd1ad('0x79')][_0xd1ad('0x7a')][_0xd1ad('0x7b')],'raw':!![]})[_0xd1ad('0x27')](function(_0x2b5fa7){return _0x2b5fa7;});})[_0xd1ad('0x27')](function(_0x2eecb3){if(_0x2eecb3){_0x267ef4[_0xd1ad('0x1c')][_0xd1ad('0x7c')]=_0x2eecb3[0x0];if(!_0x4f1251[_0xd1ad('0x47')]['UserId'])return;return db[_0xd1ad('0x7d')][_0xd1ad('0x46')]({'where':{'id':_0x4f1251['body'][_0xd1ad('0x6b')],'role':_0xd1ad('0x7e')},'attributes':['id',_0xd1ad('0x2a'),'fullname',_0xd1ad('0x7f'),'internal'],'raw':!![]});}return null;})[_0xd1ad('0x27')](function(_0x229921){if(!_0x229921)return null;_0x267ef4[_0xd1ad('0x1c')][_0xd1ad('0x7e')]=_0x229921;return _0x267ef4;})['then'](function(_0x40d3a7){if(_0x40d3a7){if(_0x4f1251['body'][_0xd1ad('0x80')]){_0x267ef4[_0xd1ad('0x1c')][_0xd1ad('0x81')]=util[_0xd1ad('0x65')](_0xd1ad('0x82'),_0x4f1251['user'][_0xd1ad('0x2a')]);_0x267ef4['message'][_0xd1ad('0x83')]=_0x267ef4[_0xd1ad('0x83')];_0x267ef4[_0xd1ad('0x1c')][_0xd1ad('0x84')]=_0x267ef4[_0xd1ad('0x83')];_0x267ef4[_0xd1ad('0x1c')][_0xd1ad('0x85')]=_0xd1ad('0x67');_0x267ef4[_0xd1ad('0x1c')][_0xd1ad('0x47')]=htmlToText[_0xd1ad('0x86')](_0x267ef4['message'][_0xd1ad('0x47')]);return respondWithRpcPromise(_0xd1ad('0x87'),_0xd1ad('0x87'),{'event':_0xd1ad('0x88'),'message':_0x267ef4[_0xd1ad('0x1c')]},client9002)[_0xd1ad('0x27')](function(){return _0x267ef4;});}return _0x267ef4;}return null;})[_0xd1ad('0x27')](respondWithResult(_0x382f18,null))[_0xd1ad('0x1e')](handleError(_0x382f18,null));};exports[_0xd1ad('0x89')]=function(_0x95e017,_0x45925a){var _0xe1dda6={'agent':{},'channel':'mail'};if(_0x95e017[_0xd1ad('0x47')]['id']){delete _0x95e017[_0xd1ad('0x47')]['id'];}_0x95e017[_0xd1ad('0x47')][_0xd1ad('0x6b')]=_0x95e017[_0xd1ad('0x47')][_0xd1ad('0x6b')]||_0x95e017[_0xd1ad('0x5b')]['id'];_0xe1dda6[_0xd1ad('0x7e')]['id']=_0x95e017[_0xd1ad('0x47')][_0xd1ad('0x6b')];return db[_0xd1ad('0x2c')][_0xd1ad('0x46')]({'where':{'id':_0x95e017[_0xd1ad('0x48')]['id'],'UserId':null}})[_0xd1ad('0x27')](handleEntityNotFound(_0x45925a,null))[_0xd1ad('0x27')](function(_0x42aa2b){if(_0x42aa2b){_0xe1dda6[_0xd1ad('0x1c')]=_0x42aa2b[_0xd1ad('0x6c')]({'plain':!![]});return db[_0xd1ad('0x6d')][_0xd1ad('0x46')]({'where':{'id':_0x42aa2b[_0xd1ad('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x45925a,null))['then'](function(_0x35e085){if(_0x35e085){_0xe1dda6[_0xd1ad('0x73')]=_0x35e085[_0xd1ad('0x6c')]({'plain':!![]});interaction_log[_0xd1ad('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x95e017[_0xd1ad('0x5b')]['id'],_0x95e017[_0xd1ad('0x5b')][_0xd1ad('0x2a')],_0x95e017[_0xd1ad('0x5b')]['role'],_0xe1dda6[_0xd1ad('0x73')]['id'],_0x95e017[_0xd1ad('0x47')]?JSON[_0xd1ad('0x19')](_0x95e017[_0xd1ad('0x47')]):'null');return respondWithRpcPromise(_0xd1ad('0x8a'),_0xd1ad('0x8b'),_0xe1dda6);}return null;})['then'](function(_0x3bc0b5){var _0x50794c=_0xd1ad('0x76')+_0x3bc0b5[_0xd1ad('0x1c')][_0xd1ad('0x77')];return db[_0xd1ad('0x78')]['query'](_0x50794c,{'type':db[_0xd1ad('0x79')]['QueryTypes'][_0xd1ad('0x7b')],'raw':!![]})['then'](function(_0x4d44ac){return _0x4d44ac;});})[_0xd1ad('0x27')](function(_0x56ba78){if(_0x56ba78){_0xe1dda6[_0xd1ad('0x1c')]['contact']=_0x56ba78[0x0];if(!_0x95e017['body'][_0xd1ad('0x6b')])return;return db[_0xd1ad('0x7d')][_0xd1ad('0x46')]({'where':{'id':_0x95e017[_0xd1ad('0x47')]['UserId'],'role':_0xd1ad('0x7e')},'attributes':['id',_0xd1ad('0x2a'),'fullname',_0xd1ad('0x7f'),_0xd1ad('0x8c')],'raw':!![]});}return null;})[_0xd1ad('0x27')](function(_0x2f1377){if(!_0x2f1377)return null;_0xe1dda6[_0xd1ad('0x1c')]['agent']=_0x2f1377;return _0xe1dda6;})[_0xd1ad('0x27')](function(_0x474941){if(_0x474941){_0x474941['message'][_0xd1ad('0x81')]=util[_0xd1ad('0x65')](_0xd1ad('0x82'),_0x95e017['user'][_0xd1ad('0x2a')]);_0x474941['message'][_0xd1ad('0x83')]=_0xe1dda6[_0xd1ad('0x83')];_0x474941[_0xd1ad('0x1c')][_0xd1ad('0x84')]=_0xe1dda6[_0xd1ad('0x83')];_0x474941['message'][_0xd1ad('0x85')]='reject';_0x474941[_0xd1ad('0x1c')]['body']=htmlToText['fromString'](_0xe1dda6[_0xd1ad('0x1c')][_0xd1ad('0x47')]);respondWithRpcPromise(_0xd1ad('0x87'),'EventManager',{'event':'rejectmessage','message':_0x474941[_0xd1ad('0x1c')]},client9002);return _0xe1dda6;}return null;})['then'](respondWithResult(_0x45925a,null))['catch'](handleError(_0x45925a,null));};exports['download']=function(_0x1f9181,_0xd6330e){var _0x5d31ee=moment()['unix']()[_0xd1ad('0x8d')]();var _0x4e9de1=path[_0xd1ad('0x8e')](config[_0xd1ad('0x5e')],_0xd1ad('0x8f'),_0xd1ad('0x90'),_0xd1ad('0x91'));var _0x13b403=path[_0xd1ad('0x8e')](config[_0xd1ad('0x5e')],'server','files',_0xd1ad('0x5d'));var _0x1f5f69=util[_0xd1ad('0x65')]('message-%s.eml',_0x5d31ee);return db[_0xd1ad('0x2c')]['find']({'where':{'id':_0x1f9181[_0xd1ad('0x48')]['id']},'attributes':['id',_0xd1ad('0x47'),'from','to','cc','bcc','subject',_0xd1ad('0x92')],'include':_0x1f9181[_0xd1ad('0x32')][_0xd1ad('0x5d')]?[{'model':db[_0xd1ad('0x93')],'as':_0xd1ad('0x94')}]:undefined})[_0xd1ad('0x27')](handleEntityNotFound(_0xd6330e,null))[_0xd1ad('0x27')](function(_0x3da5f0){if(_0x3da5f0){var _0x3010dd=_0x3da5f0;var _0x7b897b={'from':_0x3010dd[_0xd1ad('0x95')],'to':_0x3010dd['to'],'subject':_0x3010dd['subject'],'html':htmlEntities[_0xd1ad('0x96')](_0x3010dd[_0xd1ad('0x47')]),'headers':{'Date':moment(_0x3010dd[_0xd1ad('0x92')])[_0xd1ad('0x65')](_0xd1ad('0x97'))},'attachments':[]};if(_0x3da5f0['cc']){_0x7b897b[_0xd1ad('0x98')]['Cc']=_0x3da5f0['cc'];}if(_0x3da5f0[_0xd1ad('0x99')]){_0x7b897b[_0xd1ad('0x98')][_0xd1ad('0x9a')]=_0x3da5f0[_0xd1ad('0x99')];}return new BPromise(function(_0x4ed969,_0x3db421){if(_0x3da5f0['Attachments']){for(var _0x173ccb=0x0;_0x173ccb<_0x3da5f0[_0xd1ad('0x94')]['length'];_0x173ccb++){var _0xbc83c5=_0x3da5f0[_0xd1ad('0x94')][_0x173ccb];var _0x2e25a0=path[_0xd1ad('0x8e')](_0x13b403,_0xbc83c5['basename']);if(fs[_0xd1ad('0x9b')](_0x2e25a0)){_0x7b897b[_0xd1ad('0x5d')][_0xd1ad('0x9c')]({'name':_0xbc83c5[_0xd1ad('0x2a')],'contentType':_0xbc83c5[_0xd1ad('0x3e')],'data':fs['readFileSync'](_0x2e25a0)});}}}emlformat[_0xd1ad('0x9d')](_0x7b897b,function(_0xd465b2,_0x14b830){if(_0xd465b2)return _0x3db421(_0xd465b2);fs['writeFileSync'](path['join'](_0x4e9de1,_0x1f5f69),_0x14b830);return _0x4ed969(_0x14b830);});});}})[_0xd1ad('0x27')](function(_0x5e7042){if(_0x5e7042){return _0xd6330e[_0xd1ad('0x9e')](path[_0xd1ad('0x8e')](_0x4e9de1,_0x1f5f69),_0x1f5f69,function(_0x11e306){if(!_0x11e306)fs['unlinkSync'](path[_0xd1ad('0x8e')](_0x4e9de1,_0x1f5f69));});}})['catch'](handleError(_0xd6330e,null));}; \ No newline at end of file +var _0xd6c2=['message','MailMessage,\x20%s,\x20%s','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','MailMessage','includeAll','include','show','params','body','find','describe','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','auth','pass','attachments','join','server/files/attachments','basename','create','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','event','reject','rejectmessage','download','root','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client','then','info','debug','request\x20sent','error','code'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xd6c2,0x8b));var _0x2d6c=function(_0x4c74b8,_0x1dcd04){_0x4c74b8=_0x4c74b8-0x0;var _0x192e21=_0xd6c2[_0x4c74b8];return _0x192e21;};'use strict';var emlformat=require('eml-format');var moment=require(_0x2d6c('0x0'));var BPromise=require(_0x2d6c('0x1'));var util=require(_0x2d6c('0x2'));var path=require(_0x2d6c('0x3'));var fs=require('fs');var _=require(_0x2d6c('0x4'));var Redis=require(_0x2d6c('0x5'));var htmlToText=require(_0x2d6c('0x6'));var qs=require(_0x2d6c('0x7'));var logger=require(_0x2d6c('0x8'))(_0x2d6c('0x9'));var interaction_log=require(_0x2d6c('0x8'))(_0x2d6c('0xa'));var config=require(_0x2d6c('0xb'));var db=require('../../mysqldb')['db'];config[_0x2d6c('0xc')]=_[_0x2d6c('0xd')](config[_0x2d6c('0xc')],{'host':_0x2d6c('0xe'),'port':0x18eb});var socket=require(_0x2d6c('0xf'))(new Redis(config[_0x2d6c('0xc')]));var htmlEntities=require(_0x2d6c('0x10'));require(_0x2d6c('0x11'))[_0x2d6c('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2d6c('0x13')]['http']({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x2d6c('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25f7e6,_0x346716,_0x4575ec,_0x25d032){return new BPromise(function(_0x8cd102,_0x1cc106){var _0x215b25=_0x25d032||client;return _0x215b25['request'](_0x25f7e6,_0x4575ec)[_0x2d6c('0x14')](function(_0x19e22d){logger[_0x2d6c('0x15')]('MailMessage,\x20%s,\x20%s',_0x346716,'request\x20sent');logger[_0x2d6c('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x346716,_0x2d6c('0x17'),JSON['stringify'](_0x19e22d));if(_0x19e22d[_0x2d6c('0x18')]){if(_0x19e22d['error'][_0x2d6c('0x19')]===0x1f4){logger[_0x2d6c('0x18')]('MailMessage,\x20%s,\x20%s',_0x346716,_0x19e22d[_0x2d6c('0x18')][_0x2d6c('0x1a')]);return _0x1cc106(_0x19e22d[_0x2d6c('0x18')]['message']);}logger[_0x2d6c('0x18')](_0x2d6c('0x1b'),_0x346716,_0x19e22d[_0x2d6c('0x18')][_0x2d6c('0x1a')]);return _0x8cd102(_0x19e22d['error'][_0x2d6c('0x1a')]);}else{logger[_0x2d6c('0x15')](_0x2d6c('0x1b'),_0x346716,'request\x20sent');_0x8cd102(_0x19e22d[_0x2d6c('0x1c')][_0x2d6c('0x1a')]);}})[_0x2d6c('0x1d')](function(_0x42bf37){logger[_0x2d6c('0x18')](_0x2d6c('0x1b'),_0x346716,_0x42bf37);_0x1cc106(_0x42bf37);});});}function respondWithResult(_0x358c52,_0x48341f){_0x48341f=_0x48341f||0xc8;return function(_0xe73b65){if(_0xe73b65){return _0x358c52[_0x2d6c('0x1e')](_0x48341f)[_0x2d6c('0x1f')](_0xe73b65);}};}function respondWithFilteredResult(_0x51feb1,_0x22372e){return function(_0x409c88){if(_0x409c88){var _0x57e0a3=typeof _0x22372e[_0x2d6c('0x20')]==='undefined'&&typeof _0x22372e[_0x2d6c('0x21')]===_0x2d6c('0x22');var _0x7dfd29=_0x409c88[_0x2d6c('0x23')];var _0x35494e=_0x57e0a3?0x0:_0x22372e['offset'];var _0x4d8b78=_0x57e0a3?_0x409c88[_0x2d6c('0x23')]:_0x22372e[_0x2d6c('0x20')]+_0x22372e[_0x2d6c('0x21')];var _0x36fab2;if(_0x4d8b78>=_0x7dfd29){_0x4d8b78=_0x7dfd29;_0x36fab2=0xc8;}else{_0x36fab2=0xce;}_0x51feb1[_0x2d6c('0x1e')](_0x36fab2);return _0x51feb1[_0x2d6c('0x24')](_0x2d6c('0x25'),_0x35494e+'-'+_0x4d8b78+'/'+_0x7dfd29)[_0x2d6c('0x1f')](_0x409c88);}return null;};}function saveUpdates(_0x397250){return function(_0x525d58){if(_0x525d58){return _0x525d58[_0x2d6c('0x26')](_0x397250)[_0x2d6c('0x14')](function(_0xa7b661){return _0xa7b661;});}return null;};}function removeEntity(_0x27408f){return function(_0x2b630b){if(_0x2b630b){return _0x2b630b[_0x2d6c('0x27')]()[_0x2d6c('0x14')](function(){_0x27408f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de4e0){return function(_0x37bf95){if(!_0x37bf95){_0x3de4e0[_0x2d6c('0x28')](0x194);}return _0x37bf95;};}function handleError(_0x85b0e7,_0x14019f){_0x14019f=_0x14019f||0x1f4;return function(_0x134aef){logger[_0x2d6c('0x18')](_0x134aef[_0x2d6c('0x29')]);if(_0x134aef[_0x2d6c('0x2a')]){delete _0x134aef['name'];}_0x85b0e7[_0x2d6c('0x1e')](_0x14019f)[_0x2d6c('0x2b')](_0x134aef);};}exports[_0x2d6c('0x2c')]=function(_0xa323a3,_0x16d1b1){var _0x3975a4={},_0xd168bf={},_0x461da5={'count':0x0,'rows':[]};var _0x2af33a=_[_0x2d6c('0x2d')](db['MailMessage'][_0x2d6c('0x2e')],function(_0x4d6974){return{'name':_0x4d6974['fieldName'],'type':_0x4d6974[_0x2d6c('0x2f')]['key']};});_0xd168bf[_0x2d6c('0x30')]=_[_0x2d6c('0x2d')](_0x2af33a,_0x2d6c('0x2a'));_0xd168bf[_0x2d6c('0x31')]=_[_0x2d6c('0x32')](_0xa323a3[_0x2d6c('0x31')]);_0xd168bf[_0x2d6c('0x33')]=_[_0x2d6c('0x34')](_0xd168bf['model'],_0xd168bf[_0x2d6c('0x31')]);_0x3975a4[_0x2d6c('0x35')]=_[_0x2d6c('0x34')](_0xd168bf[_0x2d6c('0x30')],qs[_0x2d6c('0x36')](_0xa323a3[_0x2d6c('0x31')][_0x2d6c('0x36')]));_0x3975a4['attributes']=_0x3975a4['attributes'][_0x2d6c('0x37')]?_0x3975a4[_0x2d6c('0x35')]:_0xd168bf['model'];if(!_0xa323a3[_0x2d6c('0x31')][_0x2d6c('0x38')](_0x2d6c('0x39'))){_0x3975a4[_0x2d6c('0x21')]=qs[_0x2d6c('0x21')](_0xa323a3[_0x2d6c('0x31')][_0x2d6c('0x21')]);_0x3975a4['offset']=qs[_0x2d6c('0x20')](_0xa323a3[_0x2d6c('0x31')][_0x2d6c('0x20')]);}_0x3975a4['order']=qs[_0x2d6c('0x3a')](_0xa323a3[_0x2d6c('0x31')][_0x2d6c('0x3a')]);_0x3975a4['where']=qs[_0x2d6c('0x33')](_[_0x2d6c('0x3b')](_0xa323a3[_0x2d6c('0x31')],_0xd168bf[_0x2d6c('0x33')]),_0x2af33a);if(_0xa323a3[_0x2d6c('0x31')][_0x2d6c('0x3c')]){_0x3975a4['where']=_[_0x2d6c('0x3d')](_0x3975a4['where'],{'$or':_[_0x2d6c('0x2d')](_0x2af33a,function(_0xa6d458){if(_0xa6d458[_0x2d6c('0x2f')]!==_0x2d6c('0x3e')){var _0x4551b5={};_0x4551b5[_0xa6d458[_0x2d6c('0x2a')]]={'$like':'%'+_0xa323a3[_0x2d6c('0x31')]['filter']+'%'};return _0x4551b5;}})});}_0x3975a4=_[_0x2d6c('0x3d')]({},_0x3975a4,_0xa323a3[_0x2d6c('0x3f')]);var _0x473bc2={'where':_0x3975a4[_0x2d6c('0x40')]};return db[_0x2d6c('0x41')]['count'](_0x473bc2)['then'](function(_0x401f50){_0x461da5[_0x2d6c('0x23')]=_0x401f50;if(_0xa323a3[_0x2d6c('0x31')][_0x2d6c('0x42')]){_0x3975a4[_0x2d6c('0x43')]=[{'all':!![]}];}return db[_0x2d6c('0x41')]['findAll'](_0x3975a4);})['then'](function(_0x421d1f){_0x461da5['rows']=_0x421d1f;return _0x461da5;})[_0x2d6c('0x14')](respondWithFilteredResult(_0x16d1b1,_0x3975a4))[_0x2d6c('0x1d')](handleError(_0x16d1b1,null));};exports[_0x2d6c('0x44')]=function(_0x2a67aa,_0x547fdf){var _0x3d7209={'raw':!![],'where':{'id':_0x2a67aa[_0x2d6c('0x45')]['id']}},_0x588494={};_0x588494['model']=_[_0x2d6c('0x32')](db['MailMessage'][_0x2d6c('0x2e')]);_0x588494[_0x2d6c('0x31')]=_[_0x2d6c('0x32')](_0x2a67aa[_0x2d6c('0x31')]);_0x588494[_0x2d6c('0x33')]=_[_0x2d6c('0x34')](_0x588494[_0x2d6c('0x30')],_0x588494[_0x2d6c('0x31')]);_0x3d7209[_0x2d6c('0x35')]=_[_0x2d6c('0x34')](_0x588494['model'],qs[_0x2d6c('0x36')](_0x2a67aa[_0x2d6c('0x31')]['fields']));_0x3d7209[_0x2d6c('0x35')]=_0x3d7209[_0x2d6c('0x35')][_0x2d6c('0x37')]?_0x3d7209[_0x2d6c('0x35')]:_0x588494['model'];if(_0x2a67aa[_0x2d6c('0x31')][_0x2d6c('0x42')]){_0x3d7209[_0x2d6c('0x43')]=[{'all':!![]}];}_0x3d7209=_['merge']({},_0x3d7209,_0x2a67aa[_0x2d6c('0x3f')]);return db['MailMessage']['find'](_0x3d7209)[_0x2d6c('0x14')](handleEntityNotFound(_0x547fdf,null))[_0x2d6c('0x14')](respondWithResult(_0x547fdf,null))['catch'](handleError(_0x547fdf,null));};exports[_0x2d6c('0x26')]=function(_0x4aa094,_0x19ca42){if(_0x4aa094[_0x2d6c('0x46')]['id']){delete _0x4aa094[_0x2d6c('0x46')]['id'];}return db[_0x2d6c('0x41')][_0x2d6c('0x47')]({'where':{'id':_0x4aa094['params']['id']}})[_0x2d6c('0x14')](handleEntityNotFound(_0x19ca42,null))[_0x2d6c('0x14')](saveUpdates(_0x4aa094[_0x2d6c('0x46')],null))[_0x2d6c('0x14')](respondWithResult(_0x19ca42,null))[_0x2d6c('0x1d')](handleError(_0x19ca42,null));};exports[_0x2d6c('0x27')]=function(_0x3649a1,_0x49f52c){return db[_0x2d6c('0x41')][_0x2d6c('0x47')]({'where':{'id':_0x3649a1[_0x2d6c('0x45')]['id']}})[_0x2d6c('0x14')](handleEntityNotFound(_0x49f52c,null))[_0x2d6c('0x14')](removeEntity(_0x49f52c,null))[_0x2d6c('0x1d')](handleError(_0x49f52c,null));};exports[_0x2d6c('0x48')]=function(_0x2ce019,_0x17cff0){return db['MailMessage'][_0x2d6c('0x48')]()['then'](respondWithResult(_0x17cff0,null))[_0x2d6c('0x1d')](handleError(_0x17cff0,null));};exports['create']=function(_0x1dae4a,_0x31e18e){return db[_0x2d6c('0x41')]['create'](_0x1dae4a[_0x2d6c('0x46')])[_0x2d6c('0x14')](function(_0x487848){if(_0x487848){if(_0x487848['direction']==='out'&&!_0x487848[_0x2d6c('0x49')]){var _0x89aadb,_0xd542a3,_0x312741;if(_0x1dae4a[_0x2d6c('0x46')]['to']){_0xd542a3=_0x1dae4a[_0x2d6c('0x46')]['to']['split'](',')[0x0];}return db[_0x2d6c('0x4a')][_0x2d6c('0x4b')]({'where':{'id':_0x487848[_0x2d6c('0x4c')]},'include':[{'model':db[_0x2d6c('0x4d')],'as':_0x2d6c('0x4e'),'include':[{'model':db[_0x2d6c('0x4f')],'as':_0x2d6c('0x50'),'where':{'email':_0xd542a3},'limit':0x1,'order':[[_0x2d6c('0x51'),_0x2d6c('0x52')]]}]},{'model':db['MailServerOut'],'as':_0x2d6c('0x53'),'raw':!![]}]})[_0x2d6c('0x14')](function(_0x4140f1){_0x89aadb=_0x4140f1;if(_0x89aadb&&_0x89aadb['Smtp']){var _0x5cec53={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x54')])){_0x5cec53[_0x2d6c('0x55')]=_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x55')];_0x5cec53[_0x2d6c('0x56')]=_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x56')];_0x5cec53[_0x2d6c('0x57')]=_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x57')];if(_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x58')]){_0x5cec53[_0x2d6c('0x59')]={'user':_0x89aadb[_0x2d6c('0x53')]['user'],'pass':_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x5a')]};}}else{_0x5cec53[_0x2d6c('0x54')]=_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x54')];_0x5cec53['auth']={'user':_0x89aadb[_0x2d6c('0x53')]['user'],'pass':_0x89aadb['Smtp'][_0x2d6c('0x5a')]};_0x5cec53['secure']=_0x89aadb[_0x2d6c('0x53')][_0x2d6c('0x57')];}if(_0x1dae4a[_0x2d6c('0x46')][_0x2d6c('0x5b')]&&_0x1dae4a['body']['attachments']['length']){for(var _0x339263=0x0;_0x339263<_0x1dae4a[_0x2d6c('0x46')][_0x2d6c('0x5b')][_0x2d6c('0x37')];_0x339263+=0x1){_0x1dae4a[_0x2d6c('0x46')]['attachments'][_0x339263]={'filename':_0x1dae4a[_0x2d6c('0x46')][_0x2d6c('0x5b')][_0x339263][_0x2d6c('0x2a')],'path':path[_0x2d6c('0x5c')](config['root'],_0x2d6c('0x5d'),_0x1dae4a['body'][_0x2d6c('0x5b')][_0x339263][_0x2d6c('0x5e')])};}}_0x312741={'account':_0x5cec53,'message':_0x1dae4a['body']};return;}})[_0x2d6c('0x14')](function(){if(_0x89aadb['List']){if(_0x89aadb[_0x2d6c('0x4e')][_0x2d6c('0x50')][_0x2d6c('0x37')]){return _0x89aadb[_0x2d6c('0x4e')][_0x2d6c('0x50')][0x0];}else{return db['CmContact'][_0x2d6c('0x5f')](_[_0x2d6c('0xd')](_0x1dae4a[_0x2d6c('0x46')],{'firstName':_0x1dae4a[_0x2d6c('0x46')]['to'],'email':_0x1dae4a[_0x2d6c('0x46')]['to'],'phone':_0x1dae4a[_0x2d6c('0x46')]['to'],'ListId':_0x89aadb[_0x2d6c('0x60')]}));}}else{throw new Error(_0x2d6c('0x61'));}})['then'](function(){if(_0x312741){return respondWithRpcPromise(_0x2d6c('0x62'),_0x2d6c('0x63'),_0x312741,client9003)['then'](function(_0x5102ce){return _0x487848[_0x2d6c('0x26')]({'read':!![],'messageId':_0x5102ce[_0x2d6c('0x64')],'sentAt':moment()[_0x2d6c('0x65')](_0x2d6c('0x66'))});})[_0x2d6c('0x1d')](function(_0x359056){logger[_0x2d6c('0x18')]('%s',JSON[_0x2d6c('0x67')](_0x359056));return _0x487848;});}return _0x487848;});}return _0x487848;}})[_0x2d6c('0x14')](respondWithResult(_0x31e18e,0xc9))[_0x2d6c('0x1d')](handleError(_0x31e18e,null));};exports[_0x2d6c('0x68')]=function(_0x2f43ba,_0x4026c1){var _0xad70b7={'agent':{},'channel':_0x2d6c('0x69')};if(_0x2f43ba[_0x2d6c('0x46')]['id']){delete _0x2f43ba[_0x2d6c('0x46')]['id'];}_0x2f43ba[_0x2d6c('0x46')][_0x2d6c('0x6a')]=!![];_0x2f43ba[_0x2d6c('0x46')]['readAt']=moment()[_0x2d6c('0x65')](_0x2d6c('0x66'));_0x2f43ba[_0x2d6c('0x46')][_0x2d6c('0x6b')]=_0x2f43ba['body'][_0x2d6c('0x6b')]||_0x2f43ba[_0x2d6c('0x6c')]['id'];_0xad70b7[_0x2d6c('0x6d')]['id']=_0x2f43ba[_0x2d6c('0x46')]['UserId'];return db['MailMessage'][_0x2d6c('0x47')]({'where':{'id':_0x2f43ba[_0x2d6c('0x45')]['id'],'UserId':null}})[_0x2d6c('0x14')](handleEntityNotFound(_0x4026c1,null))[_0x2d6c('0x14')](saveUpdates(_0x2f43ba['body'],null))[_0x2d6c('0x14')](function(_0x1d5b28){if(_0x1d5b28){_0xad70b7[_0x2d6c('0x1a')]=_0x1d5b28['get']({'plain':!![]});return db[_0x2d6c('0x6e')][_0x2d6c('0x47')]({'where':{'id':_0x1d5b28[_0x2d6c('0x6f')]}});}return null;})['then'](handleEntityNotFound(_0x4026c1,null))['then'](function(_0x475b8f){if(_0x475b8f){return _0x475b8f[_0x2d6c('0x26')]({'UserId':_0x2f43ba[_0x2d6c('0x46')]['UserId'],'read1stAt':_[_0x2d6c('0x70')](_0x475b8f['read1stAt'])?moment()[_0x2d6c('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2d6c('0x14')](function(_0x1310cf){if(_0x1310cf){_0xad70b7[_0x2d6c('0x71')]=_0x1310cf[_0x2d6c('0x72')]({'plain':!![]});interaction_log[_0x2d6c('0x15')](_0x2d6c('0x73'),_0x2f43ba[_0x2d6c('0x6c')]['id'],_0x2f43ba[_0x2d6c('0x6c')][_0x2d6c('0x2a')],_0x2f43ba[_0x2d6c('0x6c')][_0x2d6c('0x74')],_0xad70b7['interaction']['id'],_0x2f43ba[_0x2d6c('0x46')]?JSON['stringify'](_0x2f43ba[_0x2d6c('0x46')]):_0x2d6c('0x75'));return respondWithRpcPromise(_0x2d6c('0x76'),_0x2d6c('0x77'),_0xad70b7);}return null;})[_0x2d6c('0x14')](function(_0x294da9){var _0x11612d=_0x2d6c('0x78')+_0x294da9[_0x2d6c('0x1a')][_0x2d6c('0x79')];return db[_0x2d6c('0x7a')][_0x2d6c('0x31')](_0x11612d,{'type':db[_0x2d6c('0x7b')][_0x2d6c('0x7c')][_0x2d6c('0x7d')],'raw':!![]})[_0x2d6c('0x14')](function(_0x1a549f){return _0x1a549f;});})[_0x2d6c('0x14')](function(_0x20d325){if(_0x20d325){_0xad70b7[_0x2d6c('0x1a')][_0x2d6c('0x7e')]=_0x20d325[0x0];if(!_0x2f43ba[_0x2d6c('0x46')][_0x2d6c('0x6b')])return;return db['User'][_0x2d6c('0x47')]({'where':{'id':_0x2f43ba[_0x2d6c('0x46')][_0x2d6c('0x6b')],'role':'agent'},'attributes':['id',_0x2d6c('0x2a'),_0x2d6c('0x7f'),_0x2d6c('0x80'),_0x2d6c('0x81')],'raw':!![]});}return null;})['then'](function(_0xce47c5){if(!_0xce47c5)return null;_0xad70b7[_0x2d6c('0x1a')][_0x2d6c('0x6d')]=_0xce47c5;return _0xad70b7;})['then'](function(_0x467a97){if(_0x467a97){if(_0x2f43ba[_0x2d6c('0x46')][_0x2d6c('0x82')]){_0xad70b7[_0x2d6c('0x1a')][_0x2d6c('0x83')]=util[_0x2d6c('0x65')](_0x2d6c('0x84'),_0x2f43ba[_0x2d6c('0x6c')][_0x2d6c('0x2a')]);_0xad70b7[_0x2d6c('0x1a')][_0x2d6c('0x85')]=_0xad70b7['channel'];_0xad70b7[_0x2d6c('0x1a')][_0x2d6c('0x86')]=_0xad70b7[_0x2d6c('0x85')];_0xad70b7[_0x2d6c('0x1a')]['event']=_0x2d6c('0x68');_0xad70b7[_0x2d6c('0x1a')][_0x2d6c('0x46')]=htmlToText[_0x2d6c('0x87')](_0xad70b7['message']['body']);return respondWithRpcPromise(_0x2d6c('0x88'),_0x2d6c('0x88'),{'event':_0x2d6c('0x89'),'message':_0xad70b7['message']},client9002)['then'](function(){return _0xad70b7;});}return _0xad70b7;}return null;})[_0x2d6c('0x14')](respondWithResult(_0x4026c1,null))['catch'](handleError(_0x4026c1,null));};exports['reject']=function(_0x4b4e9b,_0x548db5){var _0x1a1aee={'agent':{},'channel':_0x2d6c('0x69')};if(_0x4b4e9b[_0x2d6c('0x46')]['id']){delete _0x4b4e9b[_0x2d6c('0x46')]['id'];}_0x4b4e9b['body'][_0x2d6c('0x6b')]=_0x4b4e9b[_0x2d6c('0x46')][_0x2d6c('0x6b')]||_0x4b4e9b[_0x2d6c('0x6c')]['id'];_0x1a1aee[_0x2d6c('0x6d')]['id']=_0x4b4e9b['body']['UserId'];return db[_0x2d6c('0x41')][_0x2d6c('0x47')]({'where':{'id':_0x4b4e9b[_0x2d6c('0x45')]['id'],'UserId':null}})[_0x2d6c('0x14')](handleEntityNotFound(_0x548db5,null))[_0x2d6c('0x14')](function(_0x8fd54f){if(_0x8fd54f){_0x1a1aee[_0x2d6c('0x1a')]=_0x8fd54f['get']({'plain':!![]});return db[_0x2d6c('0x6e')][_0x2d6c('0x47')]({'where':{'id':_0x8fd54f[_0x2d6c('0x6f')]}});}return null;})['then'](handleEntityNotFound(_0x548db5,null))[_0x2d6c('0x14')](function(_0xd8b0d2){if(_0xd8b0d2){_0x1a1aee['interaction']=_0xd8b0d2[_0x2d6c('0x72')]({'plain':!![]});interaction_log[_0x2d6c('0x15')](_0x2d6c('0x8a'),_0x4b4e9b['user']['id'],_0x4b4e9b['user'][_0x2d6c('0x2a')],_0x4b4e9b[_0x2d6c('0x6c')][_0x2d6c('0x74')],_0x1a1aee['interaction']['id'],_0x4b4e9b[_0x2d6c('0x46')]?JSON['stringify'](_0x4b4e9b[_0x2d6c('0x46')]):'null');return respondWithRpcPromise(_0x2d6c('0x8b'),_0x2d6c('0x8c'),_0x1a1aee);}return null;})[_0x2d6c('0x14')](function(_0x2774b7){var _0x570642=_0x2d6c('0x78')+_0x2774b7['message'][_0x2d6c('0x79')];return db['sequelize'][_0x2d6c('0x31')](_0x570642,{'type':db[_0x2d6c('0x7b')][_0x2d6c('0x7c')]['SELECT'],'raw':!![]})['then'](function(_0x11a626){return _0x11a626;});})[_0x2d6c('0x14')](function(_0x57bd74){if(_0x57bd74){_0x1a1aee[_0x2d6c('0x1a')][_0x2d6c('0x7e')]=_0x57bd74[0x0];if(!_0x4b4e9b[_0x2d6c('0x46')][_0x2d6c('0x6b')])return;return db[_0x2d6c('0x8d')]['find']({'where':{'id':_0x4b4e9b[_0x2d6c('0x46')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0x2d6c('0x80'),'internal'],'raw':!![]});}return null;})['then'](function(_0xd733f4){if(!_0xd733f4)return null;_0x1a1aee['message'][_0x2d6c('0x6d')]=_0xd733f4;return _0x1a1aee;})['then'](function(_0x3251c7){if(_0x3251c7){_0x3251c7['message'][_0x2d6c('0x83')]=util[_0x2d6c('0x65')](_0x2d6c('0x84'),_0x4b4e9b[_0x2d6c('0x6c')][_0x2d6c('0x2a')]);_0x3251c7[_0x2d6c('0x1a')][_0x2d6c('0x85')]=_0x1a1aee['channel'];_0x3251c7['message']['motionChannel']=_0x1a1aee[_0x2d6c('0x85')];_0x3251c7[_0x2d6c('0x1a')][_0x2d6c('0x8e')]=_0x2d6c('0x8f');_0x3251c7[_0x2d6c('0x1a')][_0x2d6c('0x46')]=htmlToText[_0x2d6c('0x87')](_0x1a1aee[_0x2d6c('0x1a')][_0x2d6c('0x46')]);respondWithRpcPromise(_0x2d6c('0x88'),_0x2d6c('0x88'),{'event':_0x2d6c('0x90'),'message':_0x3251c7[_0x2d6c('0x1a')]},client9002);return _0x1a1aee;}return null;})[_0x2d6c('0x14')](respondWithResult(_0x548db5,null))[_0x2d6c('0x1d')](handleError(_0x548db5,null));};exports[_0x2d6c('0x91')]=function(_0x589678,_0x59c146){var _0x3b786f=moment()['unix']()['toString']();var _0x58346d=path[_0x2d6c('0x5c')](config[_0x2d6c('0x92')],_0x2d6c('0x93'),_0x2d6c('0x94'),_0x2d6c('0x95'));var _0x5b9a94=path[_0x2d6c('0x5c')](config[_0x2d6c('0x92')],_0x2d6c('0x93'),_0x2d6c('0x94'),'attachments');var _0x2825c0=util[_0x2d6c('0x65')](_0x2d6c('0x96'),_0x3b786f);return db[_0x2d6c('0x41')][_0x2d6c('0x47')]({'where':{'id':_0x589678[_0x2d6c('0x45')]['id']},'attributes':['id','body','from','to','cc',_0x2d6c('0x97'),_0x2d6c('0x98'),_0x2d6c('0x99')],'include':_0x589678[_0x2d6c('0x31')][_0x2d6c('0x5b')]?[{'model':db['Attachment'],'as':_0x2d6c('0x9a')}]:undefined})[_0x2d6c('0x14')](handleEntityNotFound(_0x59c146,null))[_0x2d6c('0x14')](function(_0x14fb1c){if(_0x14fb1c){var _0x18e025=_0x14fb1c;var _0x7d4f45={'from':_0x18e025[_0x2d6c('0x9b')],'to':_0x18e025['to'],'subject':_0x18e025['subject'],'html':htmlEntities[_0x2d6c('0x9c')](_0x18e025[_0x2d6c('0x46')]),'headers':{'Date':moment(_0x18e025[_0x2d6c('0x99')])[_0x2d6c('0x65')](_0x2d6c('0x9d'))},'attachments':[]};if(_0x14fb1c['cc']){_0x7d4f45[_0x2d6c('0x9e')]['Cc']=_0x14fb1c['cc'];}if(_0x14fb1c[_0x2d6c('0x97')]){_0x7d4f45[_0x2d6c('0x9e')][_0x2d6c('0x9f')]=_0x14fb1c[_0x2d6c('0x97')];}return new BPromise(function(_0x5e4f96,_0x5ef6c0){if(_0x14fb1c[_0x2d6c('0x9a')]){for(var _0x3fed5a=0x0;_0x3fed5a<_0x14fb1c[_0x2d6c('0x9a')]['length'];_0x3fed5a++){var _0x895518=_0x14fb1c[_0x2d6c('0x9a')][_0x3fed5a];var _0x11d162=path[_0x2d6c('0x5c')](_0x5b9a94,_0x895518['basename']);if(fs[_0x2d6c('0xa0')](_0x11d162)){_0x7d4f45[_0x2d6c('0x5b')][_0x2d6c('0xa1')]({'name':_0x895518[_0x2d6c('0x2a')],'contentType':_0x895518[_0x2d6c('0x2f')],'data':fs[_0x2d6c('0xa2')](_0x11d162)});}}}emlformat[_0x2d6c('0xa3')](_0x7d4f45,function(_0x241a6e,_0x42a32d){if(_0x241a6e)return _0x5ef6c0(_0x241a6e);fs[_0x2d6c('0xa4')](path['join'](_0x58346d,_0x2825c0),_0x42a32d);return _0x5e4f96(_0x42a32d);});});}})['then'](function(_0x48e328){if(_0x48e328){return _0x59c146[_0x2d6c('0x91')](path[_0x2d6c('0x5c')](_0x58346d,_0x2825c0),_0x2825c0,function(_0x14c663){if(!_0x14c663)fs['unlinkSync'](path[_0x2d6c('0x5c')](_0x58346d,_0x2825c0));});}})[_0x2d6c('0x1d')](handleError(_0x59c146,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index dc177f0..8f67d7d 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 _0xdce5=['MailMessage','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdce5,0x11e));var _0x5dce=function(_0x5d6f2d,_0x4ba335){_0x5d6f2d=_0x5d6f2d-0x0;var _0x35a97a=_0xdce5[_0x5d6f2d];return _0x35a97a;};'use strict';var EventEmitter=require(_0x5dce('0x0'));var MailMessage=require(_0x5dce('0x1'))['db'][_0x5dce('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5dce('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4de0b5){return function(_0x554b78,_0x1abd87,_0x39930f){MailMessageEvents[_0x5dce('0x4')](_0x4de0b5+':'+_0x554b78['id'],_0x554b78);MailMessageEvents['emit'](_0x4de0b5,_0x554b78);_0x39930f(null);};}for(var e in events){if(events[_0x5dce('0x5')](e)){var event=events[e];MailMessage[_0x5dce('0x6')](e,emitEvent(event));}}module[_0x5dce('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xd39f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xd39f,0x1e5));var _0xfd39=function(_0x3336c3,_0x268086){_0x3336c3=_0x3336c3-0x0;var _0x340747=_0xd39f[_0x3336c3];return _0x340747;};'use strict';var EventEmitter=require(_0xfd39('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xfd39('0x1')](0x0);var events={'afterCreate':_0xfd39('0x2'),'afterUpdate':_0xfd39('0x3'),'afterDestroy':_0xfd39('0x4')};function emitEvent(_0x574d1f){return function(_0x53b3b3,_0x1a68de,_0x419ff1){MailMessageEvents[_0xfd39('0x5')](_0x574d1f+':'+_0x53b3b3['id'],_0x53b3b3);MailMessageEvents['emit'](_0x574d1f,_0x53b3b3);_0x419ff1(null);};}for(var e in events){if(events[_0xfd39('0x6')](e)){var event=events[e];MailMessage[_0xfd39('0x7')](e,emitEvent(event));}}module[_0xfd39('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 8927be9..b35d785 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 _0x5987=['html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','FULLTEXT','fromString','body','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x17dffc,_0x40f6fb){var _0x16e8e4=function(_0x1062cc){while(--_0x1062cc){_0x17dffc['push'](_0x17dffc['shift']());}};_0x16e8e4(++_0x40f6fb);}(_0x5987,0x7a));var _0x7598=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5987[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7598('0x0'));var util=require(_0x7598('0x1'));var logger=require('../../config/logger')(_0x7598('0x2'));var moment=require(_0x7598('0x3'));var BPromise=require(_0x7598('0x4'));var rp=require(_0x7598('0x5'));var htmlToText=require(_0x7598('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7598('0x7'));var config=require(_0x7598('0x8'));var attributes=require(_0x7598('0x9'));module[_0x7598('0xa')]=function(_0x5e79de,_0x5ddd18){return _0x5e79de[_0x7598('0xb')](_0x7598('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x7598('0xd'),'fields':[_0x7598('0xd')]},{'name':_0x7598('0xe'),'fields':[_0x7598('0xf'),'subject'],'type':_0x7598('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xd4d504,_0x261752,_0x19d4a1){if(_0xd4d504['body']){_0xd4d504['plainBody']=htmlToText[_0x7598('0x11')](_0xd4d504[_0x7598('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x19d4a1(null,_0x261752);},'afterCreate':function(_0x3f94b0,_0x1b98a8,_0x29cfde){var _0x11f29d=_0x5e79de['models'];var _0xadbc7f=_0x3f94b0['get']({'plain':!![]});if(_0xadbc7f[_0x7598('0x13')][_0x7598('0x14')]()==='in'||_0xadbc7f['direction']['toLowerCase']()===_0x7598('0x15')&&!_0xadbc7f[_0x7598('0x16')]&&!_[_0x7598('0x17')](_0xadbc7f[_0x7598('0x18')])){_0x11f29d[_0x7598('0x19')][_0x7598('0x1a')]({'where':{'id':_0xadbc7f[_0x7598('0x1b')]}})[_0x7598('0x1c')](function(_0x2bbe4c){if(_0x2bbe4c){_0x2bbe4c['update']({'lastMsgAt':_0xadbc7f['createdAt'],'lastMsgDirection':_0xadbc7f[_0x7598('0x13')][_0x7598('0x14')]()});}})['catch'](function(_0x508ee5){console[_0x7598('0x1d')](_0x508ee5);});}_0x29cfde();}},'charset':_0x7598('0x1e'),'collate':_0x7598('0x1f')});}; \ No newline at end of file +var _0x9609=['error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','plainBody','body','fromString','get','direction','toLowerCase','secret','isNil','UserId','findOne','MailInteractionId','update','createdAt','catch'];(function(_0x511397,_0x2147a6){var _0x53ad66=function(_0x3e9759){while(--_0x3e9759){_0x511397['push'](_0x511397['shift']());}};_0x53ad66(++_0x2147a6);}(_0x9609,0xb7));var _0x9960=function(_0x5d4c07,_0x42a206){_0x5d4c07=_0x5d4c07-0x0;var _0x2f10f4=_0x9609[_0x5d4c07];return _0x2f10f4;};'use strict';var _=require(_0x9960('0x0'));var util=require('util');var logger=require(_0x9960('0x1'))(_0x9960('0x2'));var moment=require(_0x9960('0x3'));var BPromise=require('bluebird');var rp=require(_0x9960('0x4'));var htmlToText=require(_0x9960('0x5'));var fs=require('fs');var path=require(_0x9960('0x6'));var rimraf=require(_0x9960('0x7'));var config=require(_0x9960('0x8'));var attributes=require('./mailMessage.attributes');module[_0x9960('0x9')]=function(_0x4c8e13,_0x5571d1){return _0x4c8e13[_0x9960('0xa')](_0x9960('0xb'),attributes,{'tableName':_0x9960('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x9960('0xd'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x110dae,_0x2b386d,_0x3c1143){if(_0x110dae[_0x9960('0xe')]){_0x110dae['plainBody']=htmlToText[_0x9960('0xf')](_0x110dae[_0x9960('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3c1143(null,_0x2b386d);},'afterCreate':function(_0x559cee,_0x474cf2,_0x2506f2){var _0x211c77=_0x4c8e13['models'];var _0x118140=_0x559cee[_0x9960('0x10')]({'plain':!![]});if(_0x118140[_0x9960('0x11')][_0x9960('0x12')]()==='in'||_0x118140[_0x9960('0x11')][_0x9960('0x12')]()==='out'&&!_0x118140[_0x9960('0x13')]&&!_[_0x9960('0x14')](_0x118140[_0x9960('0x15')])){_0x211c77['MailInteraction'][_0x9960('0x16')]({'where':{'id':_0x118140[_0x9960('0x17')]}})['then'](function(_0x4566ba){if(_0x4566ba){_0x4566ba[_0x9960('0x18')]({'lastMsgAt':_0x118140[_0x9960('0x19')],'lastMsgDirection':_0x118140[_0x9960('0x11')][_0x9960('0x12')]()});}})[_0x9960('0x1a')](function(_0x55e297){console[_0x9960('0x1b')](_0x55e297);});}_0x2506f2();}},'charset':_0x9960('0x1c'),'collate':_0x9960('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 7b92e16..bdc1542 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 _0x8e3f=['redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('MailMessage,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('MailMessage,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});}exports[_0xf8e3('0x1c')]=function(_0x24e8d6){var _0x31f55d=this;return new Promise(function(_0x3128ad,_0x11c58e){return db[_0xf8e3('0x1d')][_0xf8e3('0x1e')](_0x24e8d6['body'],{'raw':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x20')]===undefined?!![]:![]:!![]})[_0xf8e3('0x21')](function(_0x4a1e5f){logger[_0xf8e3('0x11')]('CreateMailMessage',_0x24e8d6);logger[_0xf8e3('0x13')](_0xf8e3('0x1c'),_0x24e8d6,JSON[_0xf8e3('0x16')](_0x4a1e5f));_0x3128ad(_0x4a1e5f);})[_0xf8e3('0x1b')](function(_0x1f4b68){logger[_0xf8e3('0x17')]('CreateMailMessage',_0x1f4b68[_0xf8e3('0x19')],_0x24e8d6);_0x11c58e(_0x31f55d[_0xf8e3('0x17')](0x1f4,_0x1f4b68[_0xf8e3('0x19')]));});});}; \ No newline at end of file +var _0x7d25=['client','redis','defaults','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x194ec4,_0x1e52f3){var _0x4d21bb=function(_0x4f54c1){while(--_0x4f54c1){_0x194ec4['push'](_0x194ec4['shift']());}};_0x4d21bb(++_0x1e52f3);}(_0x7d25,0x8a));var _0x57d2=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x7d25[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});config[_0x57d2('0x8')]=_[_0x57d2('0x9')](config[_0x57d2('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57d2('0x8')]));require('./mailMessage.socket')[_0x57d2('0xa')](socket);function respondWithRpcPromise(_0x5153c2,_0xa04872,_0x485438){return new BPromise(function(_0x429301,_0x1a86db){return client[_0x57d2('0xb')](_0x5153c2,_0x485438)[_0x57d2('0xc')](function(_0x2e8e12){logger[_0x57d2('0xd')](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));logger[_0x57d2('0x10')](_0x57d2('0x11'),_0xa04872,_0x57d2('0xf'),JSON[_0x57d2('0x12')](_0x2e8e12));if(_0x2e8e12[_0x57d2('0x13')]){if(_0x2e8e12[_0x57d2('0x13')][_0x57d2('0x14')]===0x1f4){logger[_0x57d2('0x13')]('MailMessage,\x20%s,\x20%s',_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x1a86db(_0x2e8e12[_0x57d2('0x13')]['message']);}logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0x2e8e12['error'][_0x57d2('0x15')]);return _0x429301(_0x2e8e12['error'][_0x57d2('0x15')]);}else{logger['info'](_0x57d2('0xe'),_0xa04872,_0x57d2('0xf'));_0x429301(_0x2e8e12[_0x57d2('0x16')]['message']);}})['catch'](function(_0xbaeda8){logger[_0x57d2('0x13')](_0x57d2('0xe'),_0xa04872,_0xbaeda8);_0x1a86db(_0xbaeda8);});});}exports[_0x57d2('0x17')]=function(_0x5b1b9d){var _0x1cbe4a=this;return new Promise(function(_0xcf924f,_0x55191e){return db['MailMessage'][_0x57d2('0x18')](_0x5b1b9d[_0x57d2('0x19')],{'raw':_0x5b1b9d[_0x57d2('0x1a')]?_0x5b1b9d[_0x57d2('0x1a')][_0x57d2('0x1b')]===undefined?!![]:![]:!![]})[_0x57d2('0xc')](function(_0x32c7c8){logger[_0x57d2('0xd')](_0x57d2('0x17'),_0x5b1b9d);logger[_0x57d2('0x10')](_0x57d2('0x17'),_0x5b1b9d,JSON[_0x57d2('0x12')](_0x32c7c8));_0xcf924f(_0x32c7c8);})[_0x57d2('0x1c')](function(_0x473df2){logger['error'](_0x57d2('0x17'),_0x473df2[_0x57d2('0x15')],_0x5b1b9d);_0x55191e(_0x1cbe4a[_0x57d2('0x13')](0x1f4,_0x473df2[_0x57d2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 4d7ac39..40610b3 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 _0x405f=['mailMessage:','save','remove','update','emit','length'];(function(_0x44af93,_0x45fa15){var _0x22eef3=function(_0x53dc6f){while(--_0x53dc6f){_0x44af93['push'](_0x44af93['shift']());}};_0x22eef3(++_0x45fa15);}(_0x405f,0x127));var _0xf405=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x405f[_0x39096d];return _0x13da4f;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xf405('0x0'),_0xf405('0x1'),_0xf405('0x2')];function createListener(_0x244868,_0x426d70){return function(_0x22272){_0x426d70[_0xf405('0x3')](_0x244868,_0x22272);};}function removeListener(_0x1bd2d3,_0x37d98c){return function(){MailMessageEvents['removeListener'](_0x1bd2d3,_0x37d98c);};}exports['register']=function(_0x179442){for(var _0x56b41f=0x0,_0x43b3f5=events[_0xf405('0x4')];_0x56b41f<_0x43b3f5;_0x56b41f++){var _0x374881=events[_0x56b41f];var _0x5bb692=createListener(_0xf405('0x5')+_0x374881,_0x179442);MailMessageEvents['on'](_0x374881,_0x5bb692);}}; \ No newline at end of file +var _0xacd7=['length','mailMessage:','save','remove','update','emit','removeListener','register'];(function(_0xb5b79b,_0x5a2efa){var _0x1e281c=function(_0x1bfa81){while(--_0x1bfa81){_0xb5b79b['push'](_0xb5b79b['shift']());}};_0x1e281c(++_0x5a2efa);}(_0xacd7,0x1a2));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x7acd('0x0'),_0x7acd('0x1'),_0x7acd('0x2')];function createListener(_0x573183,_0x5d597e){return function(_0x33004e){_0x5d597e[_0x7acd('0x3')](_0x573183,_0x33004e);};}function removeListener(_0x4cd3b,_0x4ba6e6){return function(){MailMessageEvents[_0x7acd('0x4')](_0x4cd3b,_0x4ba6e6);};}exports[_0x7acd('0x5')]=function(_0xa1330d){for(var _0x26af83=0x0,_0x322352=events[_0x7acd('0x6')];_0x26af83<_0x322352;_0x26af83++){var _0x156374=events[_0x26af83];var _0x13c827=createListener(_0x7acd('0x7')+_0x156374,_0xa1330d);MailMessageEvents['on'](_0x156374,_0x13c827);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 700883c..5b76d69 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 _0xa3eb=['../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','post','create','/:id/teams','addTeams','put','update','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x38442f,_0x521fbc){var _0x81f922=function(_0x5104db){while(--_0x5104db){_0x38442f['push'](_0x38442f['shift']());}};_0x81f922(++_0x521fbc);}(_0xa3eb,0x18a));var _0xba3e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa3eb[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var path=require(_0xba3e('0x2'));var timeout=require(_0xba3e('0x3'));var express=require(_0xba3e('0x4'));var router=express[_0xba3e('0x5')]();var fs_extra=require(_0xba3e('0x6'));var auth=require(_0xba3e('0x7'));var interaction=require(_0xba3e('0x8'));var config=require(_0xba3e('0x9'));var controller=require(_0xba3e('0xa'));router[_0xba3e('0xb')]('/',auth[_0xba3e('0xc')](),controller[_0xba3e('0xd')]);router[_0xba3e('0xb')](_0xba3e('0xe'),auth[_0xba3e('0xc')](),controller[_0xba3e('0xf')]);router['get'](_0xba3e('0x10'),auth[_0xba3e('0xc')](),controller[_0xba3e('0x11')]);router[_0xba3e('0xb')](_0xba3e('0x12'),auth['isAuthenticated'](),controller['getMembers']);router[_0xba3e('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0xba3e('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xba3e('0x14')]('/',auth[_0xba3e('0xc')](),controller[_0xba3e('0x15')]);router[_0xba3e('0x14')](_0xba3e('0x16'),auth['isAuthenticated'](),controller[_0xba3e('0x17')]);router[_0xba3e('0x14')]('/:id/users',auth[_0xba3e('0xc')](),controller['addAgents']);router[_0xba3e('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xba3e('0x19')]);router[_0xba3e('0x1a')](_0xba3e('0x10'),auth[_0xba3e('0xc')](),controller['destroy']);router[_0xba3e('0x1a')](_0xba3e('0x16'),auth[_0xba3e('0xc')](),controller[_0xba3e('0x1b')]);router['delete'](_0xba3e('0x1c'),auth[_0xba3e('0xc')](),controller[_0xba3e('0x1d')]);module[_0xba3e('0x1e')]=router; \ No newline at end of file +var _0x69dc=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','/:id','delete'];(function(_0x304b25,_0xd4a8e0){var _0x3ff0e2=function(_0x4466f8){while(--_0x4466f8){_0x304b25['push'](_0x304b25['shift']());}};_0x3ff0e2(++_0xd4a8e0);}(_0x69dc,0x162));var _0xc69d=function(_0x40eaaf,_0x5cff2e){_0x40eaaf=_0x40eaaf-0x0;var _0x711a58=_0x69dc[_0x40eaaf];return _0x711a58;};'use strict';var multer=require(_0xc69d('0x0'));var util=require(_0xc69d('0x1'));var path=require(_0xc69d('0x2'));var timeout=require(_0xc69d('0x3'));var express=require(_0xc69d('0x4'));var router=express[_0xc69d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc69d('0x6'));var interaction=require(_0xc69d('0x7'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xc69d('0x8')]('/',auth[_0xc69d('0x9')](),controller[_0xc69d('0xa')]);router['get']('/describe',auth[_0xc69d('0x9')](),controller[_0xc69d('0xb')]);router[_0xc69d('0x8')]('/:id',auth[_0xc69d('0x9')](),controller[_0xc69d('0xc')]);router[_0xc69d('0x8')](_0xc69d('0xd'),auth[_0xc69d('0x9')](),controller[_0xc69d('0xe')]);router['get'](_0xc69d('0xf'),auth[_0xc69d('0x9')](),controller[_0xc69d('0x10')]);router[_0xc69d('0x8')](_0xc69d('0x11'),auth[_0xc69d('0x9')](),controller['getAgents']);router['post']('/',auth[_0xc69d('0x9')](),controller[_0xc69d('0x12')]);router[_0xc69d('0x13')](_0xc69d('0xf'),auth[_0xc69d('0x9')](),controller[_0xc69d('0x14')]);router[_0xc69d('0x13')](_0xc69d('0x11'),auth['isAuthenticated'](),controller[_0xc69d('0x15')]);router['put'](_0xc69d('0x16'),auth[_0xc69d('0x9')](),controller['update']);router[_0xc69d('0x17')](_0xc69d('0x16'),auth[_0xc69d('0x9')](),controller['destroy']);router[_0xc69d('0x17')]('/:id/teams',auth[_0xc69d('0x9')](),controller[_0xc69d('0x18')]);router[_0xc69d('0x17')]('/:id/users',auth[_0xc69d('0x9')](),controller[_0xc69d('0x19')]);module[_0xc69d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6da4aac..34d5559 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 _0xd6b7=['roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x523031,_0x355d4f){var _0x2c0acc=function(_0x547c82){while(--_0x547c82){_0x523031['push'](_0x523031['shift']());}};_0x2c0acc(++_0x355d4f);}(_0xd6b7,0x89));var _0x7d6b=function(_0x5c16c5,_0x1fca20){_0x5c16c5=_0x5c16c5-0x0;var _0x11e7d4=_0xd6b7[_0x5c16c5];return _0x11e7d4;};'use strict';var Sequelize=require('sequelize');module[_0x7d6b('0x0')]={'name':{'type':Sequelize[_0x7d6b('0x1')],'unique':_0x7d6b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d6b('0x1')]},'timeout':{'type':Sequelize[_0x7d6b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d6b('0x4')](_0x7d6b('0x5'),_0x7d6b('0x6'),_0x7d6b('0x7'))}}; \ No newline at end of file +var _0xed17=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed17,0x17a));var _0x7ed1=function(_0x44b249,_0x5b4811){_0x44b249=_0x44b249-0x0;var _0x23b853=_0xed17[_0x44b249];return _0x23b853;};'use strict';var Sequelize=require('sequelize');module[_0x7ed1('0x0')]={'name':{'type':Sequelize[_0x7ed1('0x1')],'unique':_0x7ed1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7ed1('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7ed1('0x4')]('rrmemory',_0x7ed1('0x5'),_0x7ed1('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a148038..7666abe 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 _0xa109=['sequelize','transaction','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','limit','count','offset','Content-Range','apply','reject','then','destroy','get','MailQueues','UserProfileResource','end','sendStatus','error','name','send','index','MailQueue','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','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','describe','getMembers','UserMailQueue','length','nolimit','pick','MailQueueId','User','findAndCountAll','agent','mailPause','format','SIP','createdAt','updatedAt','getTeams','findOne','Team','Agents','online','interface','addTeams','each','findOrCreate','forEach','emit','ids','select','field','tq.TeamId','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','compact','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa109,0x1b9));var _0x9a10=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa109[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x9a10('0x0'));var rimraf=require(_0x9a10('0x1'));var zipdir=require(_0x9a10('0x2'));var jsonpatch=require(_0x9a10('0x3'));var rp=require(_0x9a10('0x4'));var moment=require('moment');var BPromise=require(_0x9a10('0x5'));var Mustache=require(_0x9a10('0x6'));var util=require(_0x9a10('0x7'));var path=require(_0x9a10('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a10('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9a10('0xa'));var crypto=require(_0x9a10('0xb'));var jsforce=require(_0x9a10('0xc'));var deskjs=require(_0x9a10('0xd'));var toCsv=require(_0x9a10('0xe'));var querystring=require(_0x9a10('0xf'));var Papa=require(_0x9a10('0x10'));var Redis=require(_0x9a10('0x11'));var authService=require(_0x9a10('0x12'));var qs=require(_0x9a10('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a10('0x14'));var logger=require('../../config/logger')(_0x9a10('0x15'));var utils=require(_0x9a10('0x16'));var config=require(_0x9a10('0x17'));var licenseUtil=require(_0x9a10('0x18'));var db=require(_0x9a10('0x19'))['db'];config[_0x9a10('0x1a')]=_['defaults'](config[_0x9a10('0x1a')],{'host':_0x9a10('0x1b'),'port':0x18eb});var socket=require(_0x9a10('0x1c'))(new Redis(config[_0x9a10('0x1a')]));require(_0x9a10('0x1d'))[_0x9a10('0x1e')](socket);function respondWithStatusCode(_0x54aea9,_0x4768c3){_0x4768c3=_0x4768c3||0xcc;return function(_0x530c6d){if(_0x530c6d){return _0x54aea9['sendStatus'](_0x4768c3);}return _0x54aea9[_0x9a10('0x1f')](_0x4768c3)['end']();};}function respondWithResult(_0x29ffb4,_0x115f3f){_0x115f3f=_0x115f3f||0xc8;return function(_0x5cbaa3){if(_0x5cbaa3){return _0x29ffb4[_0x9a10('0x1f')](_0x115f3f)[_0x9a10('0x20')](_0x5cbaa3);}};}function respondWithFilteredResult(_0x2888fd,_0x583a05){return function(_0x186c94){if(_0x186c94){var _0x9c814f=typeof _0x583a05['offset']==='undefined'&&typeof _0x583a05[_0x9a10('0x21')]==='undefined';var _0x3e8169=_0x186c94[_0x9a10('0x22')];var _0x218a1f=_0x9c814f?0x0:_0x583a05[_0x9a10('0x23')];var _0x35c254=_0x9c814f?_0x186c94['count']:_0x583a05[_0x9a10('0x23')]+_0x583a05[_0x9a10('0x21')];var _0x4b5f74;if(_0x35c254>=_0x3e8169){_0x35c254=_0x3e8169;_0x4b5f74=0xc8;}else{_0x4b5f74=0xce;}_0x2888fd['status'](_0x4b5f74);return _0x2888fd['set'](_0x9a10('0x24'),_0x218a1f+'-'+_0x35c254+'/'+_0x3e8169)[_0x9a10('0x20')](_0x186c94);}return null;};}function patchUpdates(_0x2c1eab){return function(_0x46a3d6){try{jsonpatch[_0x9a10('0x25')](_0x46a3d6,_0x2c1eab,!![]);}catch(_0x407df7){return BPromise[_0x9a10('0x26')](_0x407df7);}return _0x46a3d6['save']();};}function saveUpdates(_0x447da5,_0x57a1ef){return function(_0x4908b5){if(_0x4908b5){return _0x4908b5['update'](_0x447da5)[_0x9a10('0x27')](function(_0x2b725f){return _0x2b725f;});}return null;};}function removeEntity(_0x8f4dc3,_0x377556){return function(_0x268300){if(_0x268300){return _0x268300[_0x9a10('0x28')]()['then'](function(){var _0xad4bf2=_0x268300[_0x9a10('0x29')]({'plain':!![]});var _0x1db34f=_0x9a10('0x2a');return db[_0x9a10('0x2b')][_0x9a10('0x28')]({'where':{'type':_0x1db34f,'resourceId':_0xad4bf2['id']}})[_0x9a10('0x27')](function(){return _0x268300;});})[_0x9a10('0x27')](function(){_0x8f4dc3[_0x9a10('0x1f')](0xcc)[_0x9a10('0x2c')]();});}};}function handleEntityNotFound(_0x19a03e,_0x16a04e){return function(_0xe576e8){if(!_0xe576e8){_0x19a03e[_0x9a10('0x2d')](0x194);}return _0xe576e8;};}function handleError(_0x3ebf51,_0x1dfa2d){_0x1dfa2d=_0x1dfa2d||0x1f4;return function(_0x16f48b){logger[_0x9a10('0x2e')](_0x16f48b['stack']);if(_0x16f48b[_0x9a10('0x2f')]){delete _0x16f48b[_0x9a10('0x2f')];}_0x3ebf51[_0x9a10('0x1f')](_0x1dfa2d)[_0x9a10('0x30')](_0x16f48b);};}exports[_0x9a10('0x31')]=function(_0xbbe988,_0x480616){var _0x5e04db={},_0x27d62f={},_0x65b5e4={'count':0x0,'rows':[]};var _0x54c306=_['map'](db[_0x9a10('0x32')][_0x9a10('0x33')],function(_0x212451){return{'name':_0x212451[_0x9a10('0x34')],'type':_0x212451[_0x9a10('0x35')][_0x9a10('0x36')]};});_0x27d62f[_0x9a10('0x37')]=_[_0x9a10('0x38')](_0x54c306,'name');_0x27d62f['query']=_[_0x9a10('0x39')](_0xbbe988['query']);_0x27d62f[_0x9a10('0x3a')]=_[_0x9a10('0x3b')](_0x27d62f[_0x9a10('0x37')],_0x27d62f[_0x9a10('0x3c')]);_0x5e04db[_0x9a10('0x3d')]=_['intersection'](_0x27d62f['model'],qs[_0x9a10('0x3e')](_0xbbe988[_0x9a10('0x3c')]['fields']));_0x5e04db[_0x9a10('0x3d')]=_0x5e04db[_0x9a10('0x3d')]['length']?_0x5e04db[_0x9a10('0x3d')]:_0x27d62f['model'];if(!_0xbbe988[_0x9a10('0x3c')][_0x9a10('0x3f')]('nolimit')){_0x5e04db[_0x9a10('0x21')]=qs[_0x9a10('0x21')](_0xbbe988[_0x9a10('0x3c')]['limit']);_0x5e04db['offset']=qs['offset'](_0xbbe988[_0x9a10('0x3c')][_0x9a10('0x23')]);}_0x5e04db[_0x9a10('0x40')]=qs[_0x9a10('0x41')](_0xbbe988['query'][_0x9a10('0x41')]);_0x5e04db[_0x9a10('0x42')]=qs[_0x9a10('0x3a')](_['pick'](_0xbbe988[_0x9a10('0x3c')],_0x27d62f[_0x9a10('0x3a')]),_0x54c306);if(_0xbbe988[_0x9a10('0x3c')][_0x9a10('0x43')]){_0x5e04db[_0x9a10('0x42')]=_[_0x9a10('0x44')](_0x5e04db[_0x9a10('0x42')],{'$or':_[_0x9a10('0x38')](_0x54c306,function(_0x48b3e3){if(_0x48b3e3['type']!==_0x9a10('0x45')){var _0x1b4470={};_0x1b4470[_0x48b3e3[_0x9a10('0x2f')]]={'$like':'%'+_0xbbe988[_0x9a10('0x3c')][_0x9a10('0x43')]+'%'};return _0x1b4470;}})});}_0x5e04db=_[_0x9a10('0x44')]({},_0x5e04db,_0xbbe988[_0x9a10('0x46')]);var _0x470424={'where':_0x5e04db['where']};return db[_0x9a10('0x32')][_0x9a10('0x22')](_0x470424)['then'](function(_0x500679){_0x65b5e4[_0x9a10('0x22')]=_0x500679;if(_0xbbe988['query'][_0x9a10('0x47')]){_0x5e04db[_0x9a10('0x48')]=[{'all':!![]}];}return db[_0x9a10('0x32')][_0x9a10('0x49')](_0x5e04db);})['then'](function(_0x2bc2d9){_0x65b5e4[_0x9a10('0x4a')]=_0x2bc2d9;return _0x65b5e4;})[_0x9a10('0x27')](respondWithFilteredResult(_0x480616,_0x5e04db))[_0x9a10('0x4b')](handleError(_0x480616,null));};exports[_0x9a10('0x4c')]=function(_0x5cfc9d,_0x275e82){var _0x2c9cf3={'raw':!![],'where':{'id':_0x5cfc9d[_0x9a10('0x4d')]['id']}},_0x26d7d3={};_0x26d7d3[_0x9a10('0x37')]=_['keys'](db[_0x9a10('0x32')][_0x9a10('0x33')]);_0x26d7d3['query']=_[_0x9a10('0x39')](_0x5cfc9d[_0x9a10('0x3c')]);_0x26d7d3[_0x9a10('0x3a')]=_[_0x9a10('0x3b')](_0x26d7d3[_0x9a10('0x37')],_0x26d7d3[_0x9a10('0x3c')]);_0x2c9cf3[_0x9a10('0x3d')]=_[_0x9a10('0x3b')](_0x26d7d3[_0x9a10('0x37')],qs[_0x9a10('0x3e')](_0x5cfc9d['query'][_0x9a10('0x3e')]));_0x2c9cf3[_0x9a10('0x3d')]=_0x2c9cf3[_0x9a10('0x3d')]['length']?_0x2c9cf3[_0x9a10('0x3d')]:_0x26d7d3[_0x9a10('0x37')];if(_0x5cfc9d[_0x9a10('0x3c')][_0x9a10('0x47')]){_0x2c9cf3[_0x9a10('0x48')]=[{'all':!![]}];}_0x2c9cf3=_[_0x9a10('0x44')]({},_0x2c9cf3,_0x5cfc9d[_0x9a10('0x46')]);return db['MailQueue']['find'](_0x2c9cf3)['then'](handleEntityNotFound(_0x275e82,null))[_0x9a10('0x27')](respondWithResult(_0x275e82,null))[_0x9a10('0x4b')](handleError(_0x275e82,null));};exports[_0x9a10('0x4e')]=function(_0x62b38a,_0x542e9f){return db[_0x9a10('0x32')][_0x9a10('0x4e')](_0x62b38a[_0x9a10('0x4f')],{})[_0x9a10('0x27')](function(_0xd029a3){var _0x4b5a44=_0x62b38a[_0x9a10('0x50')][_0x9a10('0x29')]({'plain':!![]});if(!_0x4b5a44)throw new Error(_0x9a10('0x51'));if(_0x4b5a44[_0x9a10('0x52')]===_0x9a10('0x50')){var _0x5452af=_0xd029a3[_0x9a10('0x29')]({'plain':!![]});var _0x470761=_0x9a10('0x2a');return db['UserProfileSection'][_0x9a10('0x53')]({'where':{'name':_0x470761,'userProfileId':_0x4b5a44[_0x9a10('0x54')]},'raw':!![]})[_0x9a10('0x27')](function(_0x382245){if(_0x382245&&_0x382245[_0x9a10('0x55')]===0x0){return db[_0x9a10('0x2b')]['create']({'name':_0x5452af[_0x9a10('0x2f')],'resourceId':_0x5452af['id'],'type':_0x382245[_0x9a10('0x2f')],'sectionId':_0x382245['id']},{})['then'](function(){return _0xd029a3;});}else{return _0xd029a3;}})[_0x9a10('0x4b')](function(_0xe39b03){logger[_0x9a10('0x2e')](_0x9a10('0x56'),_0xe39b03);throw _0xe39b03;});}return _0xd029a3;})[_0x9a10('0x27')](respondWithResult(_0x542e9f,0xc9))[_0x9a10('0x4b')](handleError(_0x542e9f,null));};exports[_0x9a10('0x57')]=function(_0x44e9a0,_0x206285){if(_0x44e9a0[_0x9a10('0x4f')]['id']){delete _0x44e9a0[_0x9a10('0x4f')]['id'];}return db['MailQueue'][_0x9a10('0x53')]({'where':{'id':_0x44e9a0[_0x9a10('0x4d')]['id']}})[_0x9a10('0x27')](handleEntityNotFound(_0x206285,null))[_0x9a10('0x27')](saveUpdates(_0x44e9a0[_0x9a10('0x4f')],null))['then'](respondWithResult(_0x206285,null))['catch'](handleError(_0x206285,null));};exports[_0x9a10('0x28')]=function(_0x19fb9c,_0x106618){return db['MailQueue'][_0x9a10('0x53')]({'where':{'id':_0x19fb9c[_0x9a10('0x4d')]['id']}})[_0x9a10('0x27')](handleEntityNotFound(_0x106618,null))['then'](removeEntity(_0x106618,null))[_0x9a10('0x4b')](handleError(_0x106618,null));};exports[_0x9a10('0x58')]=function(_0x4accab,_0x43c35f){return db['MailQueue'][_0x9a10('0x58')]()[_0x9a10('0x27')](respondWithResult(_0x43c35f,null))[_0x9a10('0x4b')](handleError(_0x43c35f,null));};exports[_0x9a10('0x59')]=function(_0x5b7559,_0x5a74cf,_0x2b3f7e){var _0x3d0c83={'raw':!![],'where':{}},_0x24d215={},_0x576312;return db[_0x9a10('0x32')]['findOne']({'where':{'id':_0x5b7559['params']['id']}})[_0x9a10('0x27')](handleEntityNotFound(_0x5a74cf,null))['then'](function(_0x5534e5){if(_0x5534e5){_0x576312=_0x5534e5[_0x9a10('0x29')]({'plain':!![]});_0x24d215[_0x9a10('0x37')]=_[_0x9a10('0x39')](db[_0x9a10('0x5a')]['rawAttributes']);_0x24d215[_0x9a10('0x3c')]=_[_0x9a10('0x39')](_0x5b7559[_0x9a10('0x3c')]);_0x24d215[_0x9a10('0x3a')]=_[_0x9a10('0x3b')](_0x24d215[_0x9a10('0x37')],_0x24d215['query']);_0x3d0c83[_0x9a10('0x3d')]=_[_0x9a10('0x3b')](_0x24d215[_0x9a10('0x37')],qs['fields'](_0x5b7559['query'][_0x9a10('0x3e')]));_0x3d0c83[_0x9a10('0x3d')]=_0x3d0c83['attributes'][_0x9a10('0x5b')]?_0x3d0c83[_0x9a10('0x3d')]:_0x24d215[_0x9a10('0x37')];if(!_0x5b7559[_0x9a10('0x3c')][_0x9a10('0x3f')](_0x9a10('0x5c'))){_0x3d0c83[_0x9a10('0x21')]=qs[_0x9a10('0x21')](_0x5b7559[_0x9a10('0x3c')][_0x9a10('0x21')]);_0x3d0c83[_0x9a10('0x23')]=qs[_0x9a10('0x23')](_0x5b7559[_0x9a10('0x3c')]['offset']);}_0x3d0c83['order']=qs['sort'](_0x5b7559[_0x9a10('0x3c')][_0x9a10('0x41')]);_0x3d0c83['where']=qs[_0x9a10('0x3a')](_[_0x9a10('0x5d')](_0x5b7559[_0x9a10('0x3c')],_0x24d215[_0x9a10('0x3a')]));_0x3d0c83[_0x9a10('0x42')][_0x9a10('0x5e')]=_0x5534e5['id'];if(_0x5b7559[_0x9a10('0x3c')][_0x9a10('0x43')]){_0x3d0c83[_0x9a10('0x42')]=_[_0x9a10('0x44')](_0x3d0c83['where'],{'$or':_[_0x9a10('0x38')](_0x3d0c83[_0x9a10('0x3d')],function(_0x10e883){var _0xd77a32={};_0xd77a32[_0x10e883]={'$like':'%'+_0x5b7559['query'][_0x9a10('0x43')]+'%'};return _0xd77a32;})});}_0x3d0c83=_[_0x9a10('0x44')]({},_0x3d0c83,_0x5b7559[_0x9a10('0x46')]);return db[_0x9a10('0x5a')][_0x9a10('0x49')](_0x3d0c83);}})[_0x9a10('0x27')](function(_0x38533b){if(_0x38533b){return db[_0x9a10('0x5f')][_0x9a10('0x60')]({'where':{'id':_[_0x9a10('0x38')](_0x38533b,'UserId'),'role':_0x9a10('0x61')},'attributes':['id',_0x9a10('0x2f'),_0x9a10('0x62'),'updatedAt','createdAt']});}})[_0x9a10('0x27')](function(_0x19f895){if(_0x19f895){return{'count':_0x19f895[_0x9a10('0x22')],'rows':_[_0x9a10('0x38')](_0x19f895[_0x9a10('0x4a')],function(_0x13b515){return{'membername':_0x13b515[_0x9a10('0x2f')],'UserId':_0x13b515['id'],'queue_name':_0x576312['name'],'MailQueueId':_0x576312['id'],'interface':util[_0x9a10('0x63')]('%s/%s',_0x9a10('0x64'),_0x13b515[_0x9a10('0x2f')]),'penalty':0x0,'paused':_0x13b515[_0x9a10('0x62')],'createdAt':_0x13b515[_0x9a10('0x65')],'updatedAt':_0x13b515[_0x9a10('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9a10('0x27')](respondWithFilteredResult(_0x5a74cf,_0x3d0c83))[_0x9a10('0x4b')](handleError(_0x5a74cf,null));};exports[_0x9a10('0x67')]=function(_0x436ae9,_0x5e08c8,_0x14de17){var _0x50f71e={};var _0x3091e7={};var _0x5eab9e;var _0x181074;return db[_0x9a10('0x32')][_0x9a10('0x68')]({'where':{'id':_0x436ae9[_0x9a10('0x4d')]['id']}})[_0x9a10('0x27')](handleEntityNotFound(_0x5e08c8,null))[_0x9a10('0x27')](function(_0xfcef6e){if(_0xfcef6e){_0x5eab9e=_0xfcef6e;_0x3091e7[_0x9a10('0x37')]=_[_0x9a10('0x39')](db[_0x9a10('0x69')]['rawAttributes']);_0x3091e7[_0x9a10('0x3c')]=_[_0x9a10('0x39')](_0x436ae9[_0x9a10('0x3c')]);_0x3091e7[_0x9a10('0x3a')]=_['intersection'](_0x3091e7[_0x9a10('0x37')],_0x3091e7[_0x9a10('0x3c')]);_0x50f71e[_0x9a10('0x3d')]=_[_0x9a10('0x3b')](_0x3091e7[_0x9a10('0x37')],qs[_0x9a10('0x3e')](_0x436ae9['query']['fields']));_0x50f71e['attributes']=_0x50f71e[_0x9a10('0x3d')][_0x9a10('0x5b')]?_0x50f71e[_0x9a10('0x3d')]:_0x3091e7['model'];_0x50f71e[_0x9a10('0x40')]=qs[_0x9a10('0x41')](_0x436ae9['query'][_0x9a10('0x41')]);_0x50f71e[_0x9a10('0x42')]=qs['filters'](_[_0x9a10('0x5d')](_0x436ae9[_0x9a10('0x3c')],_0x3091e7[_0x9a10('0x3a')]));if(_0x436ae9[_0x9a10('0x3c')][_0x9a10('0x43')]){_0x50f71e[_0x9a10('0x42')]=_[_0x9a10('0x44')](_0x50f71e['where'],{'$or':_['map'](_0x50f71e[_0x9a10('0x3d')],function(_0xb4833e){var _0x4a1f05={};_0x4a1f05[_0xb4833e]={'$like':'%'+_0x436ae9['query'][_0x9a10('0x43')]+'%'};return _0x4a1f05;})});}_0x50f71e=_[_0x9a10('0x44')]({},_0x50f71e,_0x436ae9[_0x9a10('0x46')]);return _0x5eab9e[_0x9a10('0x67')](_0x50f71e);}})[_0x9a10('0x27')](function(_0x444d9b){if(_0x444d9b){_0x181074=_0x444d9b[_0x9a10('0x5b')];if(!_0x436ae9[_0x9a10('0x3c')]['hasOwnProperty'](_0x9a10('0x5c'))){_0x50f71e[_0x9a10('0x21')]=qs[_0x9a10('0x21')](_0x436ae9[_0x9a10('0x3c')][_0x9a10('0x21')]);_0x50f71e[_0x9a10('0x23')]=qs[_0x9a10('0x23')](_0x436ae9[_0x9a10('0x3c')][_0x9a10('0x23')]);}return _0x5eab9e[_0x9a10('0x67')](_0x50f71e);}})[_0x9a10('0x27')](function(_0x21cb98){if(_0x21cb98){return _0x21cb98?{'count':_0x181074,'rows':_0x21cb98}:null;}})[_0x9a10('0x27')](respondWithResult(_0x5e08c8,null))[_0x9a10('0x4b')](handleError(_0x5e08c8,null));};exports['addTeams']=function(_0x17e21d,_0x8a7007,_0x28f664){var _0x3a67f8=_0x17e21d['body']['ids'];return db[_0x9a10('0x69')]['findAll']({'where':{'id':_0x3a67f8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9a10('0x6a'),'attributes':['id',_0x9a10('0x2f'),_0x9a10('0x6b'),'voicePause',_0x9a10('0x6c')],'raw':!![]}]})[_0x9a10('0x27')](function(_0x10b608){if(_0x10b608){var _0x2d4718=_['flatMap'](_0x10b608,function(_0xd8a3ac){var _0x8114fc=_0xd8a3ac['get']({'plain':!![]});return _0x8114fc[_0x9a10('0x6a')];});return db[_0x9a10('0x32')]['find']({'where':{'id':_0x17e21d[_0x9a10('0x4d')]['id']}})['then'](function(_0x291643){return db['sequelize']['transaction'](function(_0x247efb){return _0x291643[_0x9a10('0x6d')](_0x3a67f8,{'transaction':_0x247efb})['then'](function(){return BPromise[_0x9a10('0x6e')](_0x2d4718,function(_0x183195){return db[_0x9a10('0x5a')][_0x9a10('0x6f')]({'where':{'UserId':_0x183195['id'],'MailQueueId':_0x17e21d[_0x9a10('0x4d')]['id']},'transaction':_0x247efb});});})['then'](function(){_0x2d4718[_0x9a10('0x70')](function(_0x21039a){socket[_0x9a10('0x71')]('userMailQueue:save',{'UserId':_0x21039a['id'],'MailQueueId':_0x291643['id']});});});});});}})[_0x9a10('0x27')](respondWithStatusCode(_0x8a7007,null))[_0x9a10('0x4b')](handleError(_0x8a7007,null));};exports['removeTeams']=function(_0x3bc195,_0x40199b,_0x270b6e){return db['Team']['findAll']({'where':{'id':_0x3bc195['query'][_0x9a10('0x72')]},'attributes':['id'],'include':[{'model':db[_0x9a10('0x5f')],'as':_0x9a10('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x9a10('0x27')](handleEntityNotFound(_0x40199b,null))[_0x9a10('0x27')](function(_0x292efa){var _0x3b9da3=_['map'](_0x292efa,'id');var _0x487bd2=[];var _0x23a3a1=[];var _0xd0c8ef=squel[_0x9a10('0x73')]();_0xd0c8ef[_0x9a10('0x74')](_0x9a10('0x75'))['from'](_0x9a10('0x76'),'tq')[_0x9a10('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9a10('0x42')](_0x9a10('0x78'),_0x3bc195['params']['id']);for(var _0x3dc7fe=0x0;_0x3dc7fe<_0x292efa[_0x9a10('0x5b')];_0x3dc7fe+=0x1){let _0x3bbf2b=_0x292efa[_0x3dc7fe];for(var _0x2d589d=0x0;_0x2d589d<_0x3bbf2b[_0x9a10('0x6a')][_0x9a10('0x5b')];_0x2d589d+=0x1){let _0x3ff7d7=_0x3bbf2b[_0x9a10('0x6a')][_0x2d589d];var _0x9801af=_0xd0c8ef[_0x9a10('0x79')]();_0x9801af[_0x9a10('0x42')](_0x9a10('0x7a'),_0x3ff7d7['id']);_0x23a3a1[_0x9a10('0x7b')](db['sequelize'][_0x9a10('0x3c')](_0x9801af[_0x9a10('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0x9a10('0x7d')]})[_0x9a10('0x27')](function(_0x5249c3){if(_0x5249c3['length']===0x1){return _0x3ff7d7['id'];}else{var _0xdd6df9=_['every'](_[_0x9a10('0x38')](_0x5249c3,_0x9a10('0x7e')),function(_0x1648af){return _['includes'](_0x3b9da3,_0x1648af);});if(_0xdd6df9){return _0x3ff7d7['id'];}}}));}}return BPromise[_0x9a10('0x7f')](_0x23a3a1)[_0x9a10('0x27')](function(_0x20ba96){_0x487bd2=_(_0x487bd2)[_0x9a10('0x80')](_0x20ba96)[_0x9a10('0x81')]()[_0x9a10('0x82')]();return db['MailQueue']['find']({'where':{'id':_0x3bc195[_0x9a10('0x4d')]['id']}})[_0x9a10('0x27')](function(_0x315713){return db[_0x9a10('0x83')][_0x9a10('0x84')](function(_0x1fe1e1){return _0x315713[_0x9a10('0x85')](_0x3bc195['query'][_0x9a10('0x72')],{'transaction':_0x1fe1e1})['then'](function(){if(!_[_0x9a10('0x86')](_0x487bd2)){return _0x315713['removeAgents'](_0x487bd2,{'transaction':_0x1fe1e1});}})[_0x9a10('0x27')](function(){_0x487bd2['forEach'](function(_0x422f8a){socket[_0x9a10('0x71')](_0x9a10('0x87'),{'UserId':_0x422f8a,'MailQueueId':_0x315713['id']});});});});});});})[_0x9a10('0x27')](respondWithStatusCode(_0x40199b,null))['catch'](handleError(_0x40199b,null));};exports[_0x9a10('0x88')]=function(_0x114d2b,_0x239b4f,_0x583bf2){return db[_0x9a10('0x32')][_0x9a10('0x53')]({'where':{'id':_0x114d2b[_0x9a10('0x4d')]['id']}})['then'](handleEntityNotFound(_0x239b4f,null))[_0x9a10('0x27')](function(_0x740126){if(_0x740126){return _0x740126[_0x9a10('0x88')](_0x114d2b[_0x9a10('0x4f')][_0x9a10('0x72')],_[_0x9a10('0x89')](_0x114d2b[_0x9a10('0x4f')],[_0x9a10('0x72'),'id'])||{})[_0x9a10('0x8a')](function(_0x5f4be9){for(var _0x13bd88=0x0;_0x13bd88<_0x114d2b['body'][_0x9a10('0x72')][_0x9a10('0x5b')];_0x13bd88+=0x1){socket['emit'](_0x9a10('0x8b'),{'UserId':Number(_0x114d2b[_0x9a10('0x4f')][_0x9a10('0x72')][_0x13bd88]),'MailQueueId':Number(_0x114d2b[_0x9a10('0x4d')]['id'])});}return _0x5f4be9;});}})[_0x9a10('0x27')](respondWithResult(_0x239b4f,null))[_0x9a10('0x4b')](handleError(_0x239b4f,null));};exports[_0x9a10('0x8c')]=function(_0x4971f1,_0x3b41b9,_0x42775c){return db['MailQueue'][_0x9a10('0x53')]({'where':{'id':_0x4971f1[_0x9a10('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b41b9,null))[_0x9a10('0x27')](function(_0x5a6a98){if(_0x5a6a98){return _0x5a6a98['removeAgents'](_0x4971f1['query'][_0x9a10('0x72')])['then'](function(){if(_[_0x9a10('0x8d')](_0x4971f1[_0x9a10('0x3c')][_0x9a10('0x72')])){for(var _0x52357a=0x0;_0x52357a<_0x4971f1[_0x9a10('0x3c')][_0x9a10('0x72')]['length'];_0x52357a+=0x1){socket[_0x9a10('0x71')](_0x9a10('0x87'),{'UserId':Number(_0x4971f1[_0x9a10('0x3c')]['ids'][_0x52357a]),'MailQueueId':Number(_0x4971f1['params']['id'])});}}else{socket['emit'](_0x9a10('0x87'),{'UserId':Number(_0x4971f1[_0x9a10('0x3c')][_0x9a10('0x72')]),'MailQueueId':Number(_0x4971f1[_0x9a10('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b41b9,null))['catch'](handleError(_0x3b41b9,null));};exports[_0x9a10('0x8e')]=function(_0x1a3413,_0x27730b,_0xc0bf9){var _0x63b4e6={};var _0x13a98f={};var _0x47953f;var _0x454eff;return db[_0x9a10('0x32')][_0x9a10('0x68')]({'where':{'id':_0x1a3413[_0x9a10('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27730b,null))[_0x9a10('0x27')](function(_0x2c2be2){if(_0x2c2be2){_0x47953f=_0x2c2be2;_0x13a98f[_0x9a10('0x37')]=_[_0x9a10('0x39')](db['User'][_0x9a10('0x33')]);_0x13a98f[_0x9a10('0x3c')]=_['keys'](_0x1a3413[_0x9a10('0x3c')]);_0x13a98f[_0x9a10('0x3a')]=_[_0x9a10('0x3b')](_0x13a98f[_0x9a10('0x37')],_0x13a98f['query']);_0x63b4e6[_0x9a10('0x3d')]=_[_0x9a10('0x3b')](_0x13a98f[_0x9a10('0x37')],qs['fields'](_0x1a3413['query'][_0x9a10('0x3e')]));_0x63b4e6[_0x9a10('0x3d')]=_0x63b4e6[_0x9a10('0x3d')][_0x9a10('0x5b')]?_0x63b4e6[_0x9a10('0x3d')]:_0x13a98f[_0x9a10('0x37')];_0x63b4e6[_0x9a10('0x40')]=qs['sort'](_0x1a3413['query']['sort']);_0x63b4e6[_0x9a10('0x42')]=qs[_0x9a10('0x3a')](_[_0x9a10('0x5d')](_0x1a3413[_0x9a10('0x3c')],_0x13a98f[_0x9a10('0x3a')]));if(_0x1a3413['query']['filter']){_0x63b4e6['where']=_[_0x9a10('0x44')](_0x63b4e6['where'],{'$or':_[_0x9a10('0x38')](_0x63b4e6[_0x9a10('0x3d')],function(_0x2840ac){var _0x4916eb={};_0x4916eb[_0x2840ac]={'$like':'%'+_0x1a3413[_0x9a10('0x3c')]['filter']+'%'};return _0x4916eb;})});}_0x63b4e6=_[_0x9a10('0x44')]({},_0x63b4e6,_0x1a3413[_0x9a10('0x46')]);return _0x47953f['getAgents'](_0x63b4e6);}})['then'](function(_0x306ac5){if(_0x306ac5){_0x454eff=_0x306ac5[_0x9a10('0x5b')];if(!_0x1a3413[_0x9a10('0x3c')][_0x9a10('0x3f')](_0x9a10('0x5c'))){_0x63b4e6['limit']=qs[_0x9a10('0x21')](_0x1a3413[_0x9a10('0x3c')]['limit']);_0x63b4e6[_0x9a10('0x23')]=qs[_0x9a10('0x23')](_0x1a3413[_0x9a10('0x3c')][_0x9a10('0x23')]);}return _0x47953f['getAgents'](_0x63b4e6);}})[_0x9a10('0x27')](function(_0x1624a8){if(_0x1624a8){return _0x1624a8?{'count':_0x454eff,'rows':_0x1624a8}:null;}})[_0x9a10('0x27')](respondWithResult(_0x27730b,null))['catch'](handleError(_0x27730b,null));}; \ No newline at end of file +var _0x5af7=['select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','includes','all','union','removeAgents','forEach','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','MailQueues','end','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','create','body','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','MailQueueId','User','UserId','mailPause','rows','%s/%s','createdAt','getTeams','Team','pick','options','addTeams','ids','online','voicePause','interface','flatMap','Agents','transaction','each','UserMailQueue','emit','userMailQueue:save'];(function(_0x493614,_0x52be18){var _0x47cb94=function(_0x38bf00){while(--_0x38bf00){_0x493614['push'](_0x493614['shift']());}};_0x47cb94(++_0x52be18);}(_0x5af7,0x9c));var _0x75af=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x5af7[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require(_0x75af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x75af('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x75af('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x75af('0x3'));var util=require(_0x75af('0x4'));var path=require(_0x75af('0x5'));var sox=require('sox');var csv=require(_0x75af('0x6'));var ejs=require(_0x75af('0x7'));var fs=require('fs');var fs_extra=require(_0x75af('0x8'));var _=require(_0x75af('0x9'));var squel=require(_0x75af('0xa'));var crypto=require(_0x75af('0xb'));var jsforce=require(_0x75af('0xc'));var deskjs=require(_0x75af('0xd'));var toCsv=require('to-csv');var querystring=require(_0x75af('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x75af('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x75af('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x75af('0x11'));var db=require(_0x75af('0x12'))['db'];config[_0x75af('0x13')]=_[_0x75af('0x14')](config[_0x75af('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x75af('0x15'))(new Redis(config[_0x75af('0x13')]));require(_0x75af('0x16'))['register'](socket);function respondWithStatusCode(_0x254ec6,_0x30f953){_0x30f953=_0x30f953||0xcc;return function(_0x2763f1){if(_0x2763f1){return _0x254ec6[_0x75af('0x17')](_0x30f953);}return _0x254ec6[_0x75af('0x18')](_0x30f953)['end']();};}function respondWithResult(_0x396d72,_0x44fb60){_0x44fb60=_0x44fb60||0xc8;return function(_0x58e393){if(_0x58e393){return _0x396d72[_0x75af('0x18')](_0x44fb60)[_0x75af('0x19')](_0x58e393);}};}function respondWithFilteredResult(_0x3aa558,_0x1ece9e){return function(_0x42f5b9){if(_0x42f5b9){var _0x548d28=typeof _0x1ece9e['offset']===_0x75af('0x1a')&&typeof _0x1ece9e[_0x75af('0x1b')]==='undefined';var _0x446dd7=_0x42f5b9[_0x75af('0x1c')];var _0x3b6d64=_0x548d28?0x0:_0x1ece9e[_0x75af('0x1d')];var _0xed021e=_0x548d28?_0x42f5b9['count']:_0x1ece9e['offset']+_0x1ece9e[_0x75af('0x1b')];var _0x29f62b;if(_0xed021e>=_0x446dd7){_0xed021e=_0x446dd7;_0x29f62b=0xc8;}else{_0x29f62b=0xce;}_0x3aa558[_0x75af('0x18')](_0x29f62b);return _0x3aa558[_0x75af('0x1e')](_0x75af('0x1f'),_0x3b6d64+'-'+_0xed021e+'/'+_0x446dd7)[_0x75af('0x19')](_0x42f5b9);}return null;};}function patchUpdates(_0x39a33a){return function(_0x411962){try{jsonpatch['apply'](_0x411962,_0x39a33a,!![]);}catch(_0x58f6be){return BPromise[_0x75af('0x20')](_0x58f6be);}return _0x411962[_0x75af('0x21')]();};}function saveUpdates(_0x4941e4,_0x4b8f48){return function(_0x2d0613){if(_0x2d0613){return _0x2d0613[_0x75af('0x22')](_0x4941e4)[_0x75af('0x23')](function(_0x4b6e61){return _0x4b6e61;});}return null;};}function removeEntity(_0xb0fa37,_0x13849b){return function(_0x110f67){if(_0x110f67){return _0x110f67[_0x75af('0x24')]()[_0x75af('0x23')](function(){var _0x5786c1=_0x110f67[_0x75af('0x25')]({'plain':!![]});var _0x477dcb=_0x75af('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x477dcb,'resourceId':_0x5786c1['id']}})[_0x75af('0x23')](function(){return _0x110f67;});})[_0x75af('0x23')](function(){_0xb0fa37[_0x75af('0x18')](0xcc)[_0x75af('0x27')]();});}};}function handleEntityNotFound(_0x45a3a7,_0x3d2268){return function(_0x28839b){if(!_0x28839b){_0x45a3a7['sendStatus'](0x194);}return _0x28839b;};}function handleError(_0x361b58,_0x5899e4){_0x5899e4=_0x5899e4||0x1f4;return function(_0x51ce65){logger[_0x75af('0x28')](_0x51ce65['stack']);if(_0x51ce65[_0x75af('0x29')]){delete _0x51ce65[_0x75af('0x29')];}_0x361b58['status'](_0x5899e4)[_0x75af('0x2a')](_0x51ce65);};}exports[_0x75af('0x2b')]=function(_0x38ce72,_0x3d57dd){var _0x530695={},_0x3c5fd0={},_0x133d6f={'count':0x0,'rows':[]};var _0x2ae009=_[_0x75af('0x2c')](db[_0x75af('0x2d')][_0x75af('0x2e')],function(_0x1c060e){return{'name':_0x1c060e[_0x75af('0x2f')],'type':_0x1c060e[_0x75af('0x30')][_0x75af('0x31')]};});_0x3c5fd0[_0x75af('0x32')]=_['map'](_0x2ae009,_0x75af('0x29'));_0x3c5fd0['query']=_[_0x75af('0x33')](_0x38ce72['query']);_0x3c5fd0[_0x75af('0x34')]=_[_0x75af('0x35')](_0x3c5fd0['model'],_0x3c5fd0[_0x75af('0x36')]);_0x530695[_0x75af('0x37')]=_['intersection'](_0x3c5fd0[_0x75af('0x32')],qs[_0x75af('0x38')](_0x38ce72[_0x75af('0x36')]['fields']));_0x530695['attributes']=_0x530695[_0x75af('0x37')][_0x75af('0x39')]?_0x530695[_0x75af('0x37')]:_0x3c5fd0[_0x75af('0x32')];if(!_0x38ce72[_0x75af('0x36')]['hasOwnProperty'](_0x75af('0x3a'))){_0x530695[_0x75af('0x1b')]=qs['limit'](_0x38ce72['query'][_0x75af('0x1b')]);_0x530695[_0x75af('0x1d')]=qs[_0x75af('0x1d')](_0x38ce72[_0x75af('0x36')][_0x75af('0x1d')]);}_0x530695[_0x75af('0x3b')]=qs[_0x75af('0x3c')](_0x38ce72[_0x75af('0x36')]['sort']);_0x530695[_0x75af('0x3d')]=qs['filters'](_['pick'](_0x38ce72['query'],_0x3c5fd0[_0x75af('0x34')]),_0x2ae009);if(_0x38ce72[_0x75af('0x36')][_0x75af('0x3e')]){_0x530695[_0x75af('0x3d')]=_[_0x75af('0x3f')](_0x530695[_0x75af('0x3d')],{'$or':_[_0x75af('0x2c')](_0x2ae009,function(_0x22998e){if(_0x22998e[_0x75af('0x30')]!==_0x75af('0x40')){var _0x3b25ed={};_0x3b25ed[_0x22998e[_0x75af('0x29')]]={'$like':'%'+_0x38ce72[_0x75af('0x36')]['filter']+'%'};return _0x3b25ed;}})});}_0x530695=_['merge']({},_0x530695,_0x38ce72['options']);var _0x1a55b4={'where':_0x530695['where']};return db['MailQueue'][_0x75af('0x1c')](_0x1a55b4)[_0x75af('0x23')](function(_0x356c1e){_0x133d6f[_0x75af('0x1c')]=_0x356c1e;if(_0x38ce72[_0x75af('0x36')][_0x75af('0x41')]){_0x530695[_0x75af('0x42')]=[{'all':!![]}];}return db[_0x75af('0x2d')][_0x75af('0x43')](_0x530695);})['then'](function(_0x12b9f3){_0x133d6f['rows']=_0x12b9f3;return _0x133d6f;})[_0x75af('0x23')](respondWithFilteredResult(_0x3d57dd,_0x530695))[_0x75af('0x44')](handleError(_0x3d57dd,null));};exports[_0x75af('0x45')]=function(_0x2fb1b1,_0x5571ef){var _0x3f282a={'raw':!![],'where':{'id':_0x2fb1b1[_0x75af('0x46')]['id']}},_0x4231c6={};_0x4231c6[_0x75af('0x32')]=_['keys'](db[_0x75af('0x2d')][_0x75af('0x2e')]);_0x4231c6[_0x75af('0x36')]=_[_0x75af('0x33')](_0x2fb1b1[_0x75af('0x36')]);_0x4231c6[_0x75af('0x34')]=_[_0x75af('0x35')](_0x4231c6[_0x75af('0x32')],_0x4231c6['query']);_0x3f282a[_0x75af('0x37')]=_[_0x75af('0x35')](_0x4231c6[_0x75af('0x32')],qs[_0x75af('0x38')](_0x2fb1b1[_0x75af('0x36')][_0x75af('0x38')]));_0x3f282a[_0x75af('0x37')]=_0x3f282a[_0x75af('0x37')]['length']?_0x3f282a[_0x75af('0x37')]:_0x4231c6[_0x75af('0x32')];if(_0x2fb1b1[_0x75af('0x36')][_0x75af('0x41')]){_0x3f282a[_0x75af('0x42')]=[{'all':!![]}];}_0x3f282a=_[_0x75af('0x3f')]({},_0x3f282a,_0x2fb1b1['options']);return db[_0x75af('0x2d')]['find'](_0x3f282a)[_0x75af('0x23')](handleEntityNotFound(_0x5571ef,null))[_0x75af('0x23')](respondWithResult(_0x5571ef,null))[_0x75af('0x44')](handleError(_0x5571ef,null));};exports[_0x75af('0x47')]=function(_0x35ab44,_0x1dfafa){return db[_0x75af('0x2d')]['create'](_0x35ab44[_0x75af('0x48')],{})[_0x75af('0x23')](function(_0x2f058b){var _0x4759c9=_0x35ab44[_0x75af('0x49')]['get']({'plain':!![]});if(!_0x4759c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4759c9['role']===_0x75af('0x49')){var _0x3ccf82=_0x2f058b[_0x75af('0x25')]({'plain':!![]});var _0x3d37b8=_0x75af('0x26');return db['UserProfileSection'][_0x75af('0x4a')]({'where':{'name':_0x3d37b8,'userProfileId':_0x4759c9[_0x75af('0x4b')]},'raw':!![]})['then'](function(_0x496b43){if(_0x496b43&&_0x496b43[_0x75af('0x4c')]===0x0){return db[_0x75af('0x4d')]['create']({'name':_0x3ccf82['name'],'resourceId':_0x3ccf82['id'],'type':_0x496b43['name'],'sectionId':_0x496b43['id']},{})[_0x75af('0x23')](function(){return _0x2f058b;});}else{return _0x2f058b;}})['catch'](function(_0x418cba){logger[_0x75af('0x28')](_0x75af('0x4e'),_0x418cba);throw _0x418cba;});}return _0x2f058b;})[_0x75af('0x23')](respondWithResult(_0x1dfafa,0xc9))[_0x75af('0x44')](handleError(_0x1dfafa,null));};exports['update']=function(_0x98f8d8,_0x89856e){if(_0x98f8d8[_0x75af('0x48')]['id']){delete _0x98f8d8['body']['id'];}return db[_0x75af('0x2d')][_0x75af('0x4a')]({'where':{'id':_0x98f8d8[_0x75af('0x46')]['id']}})[_0x75af('0x23')](handleEntityNotFound(_0x89856e,null))[_0x75af('0x23')](saveUpdates(_0x98f8d8[_0x75af('0x48')],null))[_0x75af('0x23')](respondWithResult(_0x89856e,null))[_0x75af('0x44')](handleError(_0x89856e,null));};exports[_0x75af('0x24')]=function(_0xc65f1a,_0x1a1840){return db['MailQueue'][_0x75af('0x4a')]({'where':{'id':_0xc65f1a[_0x75af('0x46')]['id']}})[_0x75af('0x23')](handleEntityNotFound(_0x1a1840,null))[_0x75af('0x23')](removeEntity(_0x1a1840,null))[_0x75af('0x44')](handleError(_0x1a1840,null));};exports[_0x75af('0x4f')]=function(_0x4f5d6a,_0x4482a6){return db[_0x75af('0x2d')][_0x75af('0x4f')]()[_0x75af('0x23')](respondWithResult(_0x4482a6,null))[_0x75af('0x44')](handleError(_0x4482a6,null));};exports[_0x75af('0x50')]=function(_0x3d79aa,_0x4213e2,_0x9f89ad){var _0x2a6961={'raw':!![],'where':{}},_0x1d59ff={},_0x505a74;return db[_0x75af('0x2d')][_0x75af('0x51')]({'where':{'id':_0x3d79aa[_0x75af('0x46')]['id']}})[_0x75af('0x23')](handleEntityNotFound(_0x4213e2,null))[_0x75af('0x23')](function(_0x1b7780){if(_0x1b7780){_0x505a74=_0x1b7780[_0x75af('0x25')]({'plain':!![]});_0x1d59ff[_0x75af('0x32')]=_[_0x75af('0x33')](db['UserMailQueue'][_0x75af('0x2e')]);_0x1d59ff[_0x75af('0x36')]=_[_0x75af('0x33')](_0x3d79aa[_0x75af('0x36')]);_0x1d59ff['filters']=_[_0x75af('0x35')](_0x1d59ff[_0x75af('0x32')],_0x1d59ff['query']);_0x2a6961[_0x75af('0x37')]=_['intersection'](_0x1d59ff[_0x75af('0x32')],qs['fields'](_0x3d79aa[_0x75af('0x36')][_0x75af('0x38')]));_0x2a6961[_0x75af('0x37')]=_0x2a6961['attributes'][_0x75af('0x39')]?_0x2a6961['attributes']:_0x1d59ff['model'];if(!_0x3d79aa[_0x75af('0x36')][_0x75af('0x52')](_0x75af('0x3a'))){_0x2a6961[_0x75af('0x1b')]=qs[_0x75af('0x1b')](_0x3d79aa[_0x75af('0x36')][_0x75af('0x1b')]);_0x2a6961[_0x75af('0x1d')]=qs['offset'](_0x3d79aa[_0x75af('0x36')][_0x75af('0x1d')]);}_0x2a6961[_0x75af('0x3b')]=qs['sort'](_0x3d79aa[_0x75af('0x36')][_0x75af('0x3c')]);_0x2a6961[_0x75af('0x3d')]=qs['filters'](_['pick'](_0x3d79aa[_0x75af('0x36')],_0x1d59ff['filters']));_0x2a6961[_0x75af('0x3d')][_0x75af('0x53')]=_0x1b7780['id'];if(_0x3d79aa[_0x75af('0x36')][_0x75af('0x3e')]){_0x2a6961['where']=_[_0x75af('0x3f')](_0x2a6961[_0x75af('0x3d')],{'$or':_[_0x75af('0x2c')](_0x2a6961[_0x75af('0x37')],function(_0x91c93d){var _0x1fd6d4={};_0x1fd6d4[_0x91c93d]={'$like':'%'+_0x3d79aa[_0x75af('0x36')][_0x75af('0x3e')]+'%'};return _0x1fd6d4;})});}_0x2a6961=_[_0x75af('0x3f')]({},_0x2a6961,_0x3d79aa['options']);return db['UserMailQueue']['findAll'](_0x2a6961);}})[_0x75af('0x23')](function(_0x4ee2d8){if(_0x4ee2d8){return db[_0x75af('0x54')]['findAndCountAll']({'where':{'id':_[_0x75af('0x2c')](_0x4ee2d8,_0x75af('0x55')),'role':'agent'},'attributes':['id','name',_0x75af('0x56'),'updatedAt','createdAt']});}})[_0x75af('0x23')](function(_0x267879){if(_0x267879){return{'count':_0x267879[_0x75af('0x1c')],'rows':_[_0x75af('0x2c')](_0x267879[_0x75af('0x57')],function(_0x2cbdb9){return{'membername':_0x2cbdb9[_0x75af('0x29')],'UserId':_0x2cbdb9['id'],'queue_name':_0x505a74[_0x75af('0x29')],'MailQueueId':_0x505a74['id'],'interface':util['format'](_0x75af('0x58'),'SIP',_0x2cbdb9['name']),'penalty':0x0,'paused':_0x2cbdb9[_0x75af('0x56')],'createdAt':_0x2cbdb9[_0x75af('0x59')],'updatedAt':_0x2cbdb9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4213e2,_0x2a6961))[_0x75af('0x44')](handleError(_0x4213e2,null));};exports[_0x75af('0x5a')]=function(_0x6e9b39,_0x4f3f3e,_0xd66e0e){var _0x1424e0={};var _0x5995d5={};var _0x2c57b5;var _0x4f4953;return db[_0x75af('0x2d')][_0x75af('0x51')]({'where':{'id':_0x6e9b39['params']['id']}})[_0x75af('0x23')](handleEntityNotFound(_0x4f3f3e,null))[_0x75af('0x23')](function(_0x506484){if(_0x506484){_0x2c57b5=_0x506484;_0x5995d5['model']=_[_0x75af('0x33')](db[_0x75af('0x5b')]['rawAttributes']);_0x5995d5['query']=_[_0x75af('0x33')](_0x6e9b39[_0x75af('0x36')]);_0x5995d5[_0x75af('0x34')]=_[_0x75af('0x35')](_0x5995d5[_0x75af('0x32')],_0x5995d5['query']);_0x1424e0[_0x75af('0x37')]=_[_0x75af('0x35')](_0x5995d5['model'],qs[_0x75af('0x38')](_0x6e9b39[_0x75af('0x36')][_0x75af('0x38')]));_0x1424e0['attributes']=_0x1424e0['attributes'][_0x75af('0x39')]?_0x1424e0[_0x75af('0x37')]:_0x5995d5[_0x75af('0x32')];_0x1424e0[_0x75af('0x3b')]=qs[_0x75af('0x3c')](_0x6e9b39[_0x75af('0x36')]['sort']);_0x1424e0[_0x75af('0x3d')]=qs[_0x75af('0x34')](_[_0x75af('0x5c')](_0x6e9b39['query'],_0x5995d5[_0x75af('0x34')]));if(_0x6e9b39[_0x75af('0x36')][_0x75af('0x3e')]){_0x1424e0[_0x75af('0x3d')]=_['merge'](_0x1424e0[_0x75af('0x3d')],{'$or':_[_0x75af('0x2c')](_0x1424e0[_0x75af('0x37')],function(_0x1ceb0f){var _0x8500a3={};_0x8500a3[_0x1ceb0f]={'$like':'%'+_0x6e9b39['query']['filter']+'%'};return _0x8500a3;})});}_0x1424e0=_['merge']({},_0x1424e0,_0x6e9b39[_0x75af('0x5d')]);return _0x2c57b5[_0x75af('0x5a')](_0x1424e0);}})[_0x75af('0x23')](function(_0x270898){if(_0x270898){_0x4f4953=_0x270898[_0x75af('0x39')];if(!_0x6e9b39['query']['hasOwnProperty'](_0x75af('0x3a'))){_0x1424e0['limit']=qs['limit'](_0x6e9b39[_0x75af('0x36')][_0x75af('0x1b')]);_0x1424e0[_0x75af('0x1d')]=qs['offset'](_0x6e9b39[_0x75af('0x36')][_0x75af('0x1d')]);}return _0x2c57b5[_0x75af('0x5a')](_0x1424e0);}})[_0x75af('0x23')](function(_0x2ae6f5){if(_0x2ae6f5){return _0x2ae6f5?{'count':_0x4f4953,'rows':_0x2ae6f5}:null;}})[_0x75af('0x23')](respondWithResult(_0x4f3f3e,null))[_0x75af('0x44')](handleError(_0x4f3f3e,null));};exports[_0x75af('0x5e')]=function(_0xac0fc8,_0x4b989a,_0x9a47f6){var _0x2a3679=_0xac0fc8[_0x75af('0x48')][_0x75af('0x5f')];return db[_0x75af('0x5b')][_0x75af('0x43')]({'where':{'id':_0x2a3679},'attributes':['id'],'include':[{'model':db[_0x75af('0x54')],'as':'Agents','attributes':['id',_0x75af('0x29'),_0x75af('0x60'),_0x75af('0x61'),_0x75af('0x62')],'raw':!![]}]})[_0x75af('0x23')](function(_0x32d7f9){if(_0x32d7f9){var _0xef5788=_[_0x75af('0x63')](_0x32d7f9,function(_0x5bd493){var _0x2c6428=_0x5bd493[_0x75af('0x25')]({'plain':!![]});return _0x2c6428[_0x75af('0x64')];});return db[_0x75af('0x2d')][_0x75af('0x4a')]({'where':{'id':_0xac0fc8[_0x75af('0x46')]['id']}})[_0x75af('0x23')](function(_0x5cf8db){return db['sequelize'][_0x75af('0x65')](function(_0x3e17bf){return _0x5cf8db[_0x75af('0x5e')](_0x2a3679,{'transaction':_0x3e17bf})[_0x75af('0x23')](function(){return BPromise[_0x75af('0x66')](_0xef5788,function(_0x5ba7aa){return db[_0x75af('0x67')]['findOrCreate']({'where':{'UserId':_0x5ba7aa['id'],'MailQueueId':_0xac0fc8[_0x75af('0x46')]['id']},'transaction':_0x3e17bf});});})[_0x75af('0x23')](function(){_0xef5788['forEach'](function(_0x252a70){socket[_0x75af('0x68')](_0x75af('0x69'),{'UserId':_0x252a70['id'],'MailQueueId':_0x5cf8db['id']});});});});});}})[_0x75af('0x23')](respondWithStatusCode(_0x4b989a,null))['catch'](handleError(_0x4b989a,null));};exports['removeTeams']=function(_0x43d66d,_0x4e40c6,_0x54559a){return db[_0x75af('0x5b')][_0x75af('0x43')]({'where':{'id':_0x43d66d[_0x75af('0x36')][_0x75af('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x75af('0x54')],'as':_0x75af('0x64'),'attributes':['id'],'raw':!![]}]})[_0x75af('0x23')](handleEntityNotFound(_0x4e40c6,null))[_0x75af('0x23')](function(_0x4802a8){var _0xab8177=_[_0x75af('0x2c')](_0x4802a8,'id');var _0x205a4a=[];var _0x4b09d2=[];var _0x4bca67=squel[_0x75af('0x6a')]();_0x4bca67[_0x75af('0x6b')]('tq.TeamId')[_0x75af('0x6c')](_0x75af('0x6d'),'tq')[_0x75af('0x6e')](_0x75af('0x6f'),'ut',_0x75af('0x70'))[_0x75af('0x3d')](_0x75af('0x71'),_0x43d66d[_0x75af('0x46')]['id']);for(var _0xc1e78c=0x0;_0xc1e78c<_0x4802a8[_0x75af('0x39')];_0xc1e78c+=0x1){let _0x20abba=_0x4802a8[_0xc1e78c];for(var _0x67cb9=0x0;_0x67cb9<_0x20abba[_0x75af('0x64')][_0x75af('0x39')];_0x67cb9+=0x1){let _0x4b305e=_0x20abba[_0x75af('0x64')][_0x67cb9];var _0x5d929e=_0x4bca67['clone']();_0x5d929e[_0x75af('0x3d')](_0x75af('0x72'),_0x4b305e['id']);_0x4b09d2[_0x75af('0x73')](db['sequelize']['query'](_0x5d929e[_0x75af('0x74')](),{'type':db[_0x75af('0x75')][_0x75af('0x76')]['SELECT']})['then'](function(_0x373f91){if(_0x373f91[_0x75af('0x39')]===0x1){return _0x4b305e['id'];}else{var _0x113370=_[_0x75af('0x77')](_['map'](_0x373f91,_0x75af('0x78')),function(_0x37e702){return _[_0x75af('0x79')](_0xab8177,_0x37e702);});if(_0x113370){return _0x4b305e['id'];}}}));}}return BPromise[_0x75af('0x7a')](_0x4b09d2)['then'](function(_0x128e5d){_0x205a4a=_(_0x205a4a)[_0x75af('0x7b')](_0x128e5d)['compact']()['value']();return db[_0x75af('0x2d')][_0x75af('0x4a')]({'where':{'id':_0x43d66d['params']['id']}})[_0x75af('0x23')](function(_0x2e3033){return db['sequelize'][_0x75af('0x65')](function(_0x465970){return _0x2e3033['removeTeams'](_0x43d66d[_0x75af('0x36')][_0x75af('0x5f')],{'transaction':_0x465970})[_0x75af('0x23')](function(){if(!_['isEmpty'](_0x205a4a)){return _0x2e3033[_0x75af('0x7c')](_0x205a4a,{'transaction':_0x465970});}})['then'](function(){_0x205a4a[_0x75af('0x7d')](function(_0x3b704e){socket['emit']('userMailQueue:remove',{'UserId':_0x3b704e,'MailQueueId':_0x2e3033['id']});});});});});});})[_0x75af('0x23')](respondWithStatusCode(_0x4e40c6,null))['catch'](handleError(_0x4e40c6,null));};exports['addAgents']=function(_0x47b069,_0x1c38b1,_0x698ec8){return db[_0x75af('0x2d')][_0x75af('0x4a')]({'where':{'id':_0x47b069[_0x75af('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c38b1,null))['then'](function(_0x4c7782){if(_0x4c7782){return _0x4c7782['addAgents'](_0x47b069[_0x75af('0x48')][_0x75af('0x5f')],_[_0x75af('0x7e')](_0x47b069[_0x75af('0x48')],[_0x75af('0x5f'),'id'])||{})[_0x75af('0x7f')](function(_0xb6f491){for(var _0x94b037=0x0;_0x94b037<_0x47b069[_0x75af('0x48')][_0x75af('0x5f')][_0x75af('0x39')];_0x94b037+=0x1){socket['emit'](_0x75af('0x69'),{'UserId':Number(_0x47b069[_0x75af('0x48')][_0x75af('0x5f')][_0x94b037]),'MailQueueId':Number(_0x47b069[_0x75af('0x46')]['id'])});}return _0xb6f491;});}})['then'](respondWithResult(_0x1c38b1,null))[_0x75af('0x44')](handleError(_0x1c38b1,null));};exports[_0x75af('0x7c')]=function(_0x37aacd,_0x588b82,_0x3c81d3){return db[_0x75af('0x2d')][_0x75af('0x4a')]({'where':{'id':_0x37aacd[_0x75af('0x46')]['id']}})[_0x75af('0x23')](handleEntityNotFound(_0x588b82,null))[_0x75af('0x23')](function(_0x5a16a2){if(_0x5a16a2){return _0x5a16a2['removeAgents'](_0x37aacd['query'][_0x75af('0x5f')])[_0x75af('0x23')](function(){if(_[_0x75af('0x80')](_0x37aacd[_0x75af('0x36')][_0x75af('0x5f')])){for(var _0x6e7a92=0x0;_0x6e7a92<_0x37aacd[_0x75af('0x36')]['ids'][_0x75af('0x39')];_0x6e7a92+=0x1){socket[_0x75af('0x68')](_0x75af('0x81'),{'UserId':Number(_0x37aacd['query'][_0x75af('0x5f')][_0x6e7a92]),'MailQueueId':Number(_0x37aacd['params']['id'])});}}else{socket[_0x75af('0x68')]('userMailQueue:remove',{'UserId':Number(_0x37aacd[_0x75af('0x36')]['ids']),'MailQueueId':Number(_0x37aacd[_0x75af('0x46')]['id'])});}});}})[_0x75af('0x23')](respondWithStatusCode(_0x588b82,null))[_0x75af('0x44')](handleError(_0x588b82,null));};exports[_0x75af('0x82')]=function(_0x50991f,_0x4f9a73,_0x1974e8){var _0x4c314f={};var _0x2f329e={};var _0x490344;var _0x1de1e7;return db[_0x75af('0x2d')]['findOne']({'where':{'id':_0x50991f[_0x75af('0x46')]['id']}})[_0x75af('0x23')](handleEntityNotFound(_0x4f9a73,null))[_0x75af('0x23')](function(_0x1e0eba){if(_0x1e0eba){_0x490344=_0x1e0eba;_0x2f329e[_0x75af('0x32')]=_['keys'](db['User'][_0x75af('0x2e')]);_0x2f329e[_0x75af('0x36')]=_[_0x75af('0x33')](_0x50991f[_0x75af('0x36')]);_0x2f329e[_0x75af('0x34')]=_[_0x75af('0x35')](_0x2f329e[_0x75af('0x32')],_0x2f329e[_0x75af('0x36')]);_0x4c314f['attributes']=_[_0x75af('0x35')](_0x2f329e[_0x75af('0x32')],qs[_0x75af('0x38')](_0x50991f[_0x75af('0x36')][_0x75af('0x38')]));_0x4c314f[_0x75af('0x37')]=_0x4c314f[_0x75af('0x37')]['length']?_0x4c314f[_0x75af('0x37')]:_0x2f329e[_0x75af('0x32')];_0x4c314f[_0x75af('0x3b')]=qs['sort'](_0x50991f[_0x75af('0x36')]['sort']);_0x4c314f[_0x75af('0x3d')]=qs[_0x75af('0x34')](_[_0x75af('0x5c')](_0x50991f[_0x75af('0x36')],_0x2f329e['filters']));if(_0x50991f[_0x75af('0x36')][_0x75af('0x3e')]){_0x4c314f[_0x75af('0x3d')]=_['merge'](_0x4c314f[_0x75af('0x3d')],{'$or':_['map'](_0x4c314f[_0x75af('0x37')],function(_0xba427f){var _0x2288a5={};_0x2288a5[_0xba427f]={'$like':'%'+_0x50991f[_0x75af('0x36')]['filter']+'%'};return _0x2288a5;})});}_0x4c314f=_['merge']({},_0x4c314f,_0x50991f[_0x75af('0x5d')]);return _0x490344[_0x75af('0x82')](_0x4c314f);}})[_0x75af('0x23')](function(_0x3efd3f){if(_0x3efd3f){_0x1de1e7=_0x3efd3f['length'];if(!_0x50991f[_0x75af('0x36')]['hasOwnProperty'](_0x75af('0x3a'))){_0x4c314f['limit']=qs[_0x75af('0x1b')](_0x50991f[_0x75af('0x36')][_0x75af('0x1b')]);_0x4c314f[_0x75af('0x1d')]=qs['offset'](_0x50991f[_0x75af('0x36')]['offset']);}return _0x490344[_0x75af('0x82')](_0x4c314f);}})[_0x75af('0x23')](function(_0x401d75){if(_0x401d75){return _0x401d75?{'count':_0x1de1e7,'rows':_0x401d75}:null;}})[_0x75af('0x23')](respondWithResult(_0x4f9a73,null))['catch'](handleError(_0x4f9a73,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index a0876c6..c79be33 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 _0xdcf4=['events','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x30ec9e,_0x1710d3){var _0xba2912=function(_0x5d2204){while(--_0x5d2204){_0x30ec9e['push'](_0x30ec9e['shift']());}};_0xba2912(++_0x1710d3);}(_0xdcf4,0x1dd));var _0x4dcf=function(_0x658806,_0x55accf){_0x658806=_0x658806-0x0;var _0x595700=_0xdcf4[_0x658806];return _0x595700;};'use strict';var EventEmitter=require(_0x4dcf('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x4dcf('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4dcf('0x2')](0x0);var events={'afterCreate':_0x4dcf('0x3'),'afterUpdate':_0x4dcf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2f665e){return function(_0x2c4ac4,_0x227f4e,_0x5838e8){MailQueueEvents[_0x4dcf('0x5')](_0x2f665e+':'+_0x2c4ac4['id'],_0x2c4ac4);MailQueueEvents[_0x4dcf('0x5')](_0x2f665e,_0x2c4ac4);_0x5838e8(null);};}for(var e in events){if(events[_0x4dcf('0x6')](e)){var event=events[e];MailQueue[_0x4dcf('0x7')](e,emitEvent(event));}}module[_0x4dcf('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xcd76=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x53331c,_0x908b8f){var _0x5ddbb8=function(_0x28b807){while(--_0x28b807){_0x53331c['push'](_0x53331c['shift']());}};_0x5ddbb8(++_0x908b8f);}(_0xcd76,0x8e));var _0x6cd7=function(_0x198585,_0x378e82){_0x198585=_0x198585-0x0;var _0x22e0fc=_0xcd76[_0x198585];return _0x22e0fc;};'use strict';var EventEmitter=require(_0x6cd7('0x0'));var MailQueue=require(_0x6cd7('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6cd7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6cd7('0x3'),'afterDestroy':_0x6cd7('0x4')};function emitEvent(_0x3237da){return function(_0x1d0dc2,_0x44be2f,_0x11d8a4){MailQueueEvents[_0x6cd7('0x5')](_0x3237da+':'+_0x1d0dc2['id'],_0x1d0dc2);MailQueueEvents['emit'](_0x3237da,_0x1d0dc2);_0x11d8a4(null);};}for(var e in events){if(events[_0x6cd7('0x6')](e)){var event=events[e];MailQueue[_0x6cd7('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d4fe4c1..a78be34 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 _0x9ca7=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0xa25342,_0x24522b){var _0x52be43=function(_0x1ea0e9){while(--_0x1ea0e9){_0xa25342['push'](_0xa25342['shift']());}};_0x52be43(++_0x24522b);}(_0x9ca7,0x17a));var _0x79ca=function(_0x2699a9,_0xbd0638){_0x2699a9=_0x2699a9-0x0;var _0x1fe851=_0x9ca7[_0x2699a9];return _0x1fe851;};'use strict';var _=require(_0x79ca('0x0'));var util=require(_0x79ca('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x79ca('0x2'));var rp=require(_0x79ca('0x3'));var fs=require('fs');var path=require(_0x79ca('0x4'));var rimraf=require(_0x79ca('0x5'));var config=require(_0x79ca('0x6'));var attributes=require(_0x79ca('0x7'));module[_0x79ca('0x8')]=function(_0x5c382b,_0x152856){return _0x5c382b[_0x79ca('0x9')](_0x79ca('0xa'),attributes,{'tableName':_0x79ca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ec1=['exports','define','mail_queues','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x3ee609,_0x2c99ab){var _0x162ebe=function(_0x554452){while(--_0x554452){_0x3ee609['push'](_0x3ee609['shift']());}};_0x162ebe(++_0x2c99ab);}(_0x5ec1,0x186));var _0x15ec=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0x5ec1[_0x4e697a];return _0x88850c;};'use strict';var _=require('lodash');var util=require(_0x15ec('0x0'));var logger=require(_0x15ec('0x1'))('api');var moment=require('moment');var BPromise=require(_0x15ec('0x2'));var rp=require(_0x15ec('0x3'));var fs=require('fs');var path=require(_0x15ec('0x4'));var rimraf=require('rimraf');var config=require(_0x15ec('0x5'));var attributes=require('./mailQueue.attributes');module[_0x15ec('0x6')]=function(_0x22394d,_0x3d870b){return _0x22394d[_0x15ec('0x7')]('MailQueue',attributes,{'tableName':_0x15ec('0x8'),'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 0c1ea28..3496cae 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 _0xff01=['stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','include','model','map','ShowMailQueue','find','raw','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x37ef22,_0x348c92){var _0x49eeb3=function(_0x1ef837){while(--_0x1ef837){_0x37ef22['push'](_0x37ef22['shift']());}};_0x49eeb3(++_0x348c92);}(_0xff01,0xad));var _0x1ff0=function(_0x105255,_0x44c094){_0x105255=_0x105255-0x0;var _0x5ef3dd=_0xff01[_0x105255];return _0x5ef3dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1ff0('0x0'));var rs=require(_0x1ff0('0x1'));var fs=require('fs');var Redis=require(_0x1ff0('0x2'));var db=require(_0x1ff0('0x3'))['db'];var utils=require(_0x1ff0('0x4'));var logger=require(_0x1ff0('0x5'))('rpc');var config=require(_0x1ff0('0x6'));var jayson=require(_0x1ff0('0x7'));var client=jayson['client'][_0x1ff0('0x8')]({'port':0x232a});config['redis']=_[_0x1ff0('0x9')](config[_0x1ff0('0xa')],{'host':_0x1ff0('0xb'),'port':0x18eb});var socket=require(_0x1ff0('0xc'))(new Redis(config[_0x1ff0('0xa')]));require(_0x1ff0('0xd'))[_0x1ff0('0xe')](socket);function respondWithRpcPromise(_0x726042,_0x5283eb,_0x231151){return new BPromise(function(_0x26fe0a,_0xb497aa){return client[_0x1ff0('0xf')](_0x726042,_0x231151)[_0x1ff0('0x10')](function(_0x528551){logger[_0x1ff0('0x11')](_0x1ff0('0x12'),_0x5283eb,_0x1ff0('0x13'));logger[_0x1ff0('0x14')](_0x1ff0('0x15'),_0x5283eb,_0x1ff0('0x13'),JSON[_0x1ff0('0x16')](_0x528551));if(_0x528551[_0x1ff0('0x17')]){if(_0x528551[_0x1ff0('0x17')]['code']===0x1f4){logger[_0x1ff0('0x17')](_0x1ff0('0x12'),_0x5283eb,_0x528551[_0x1ff0('0x17')][_0x1ff0('0x18')]);return _0xb497aa(_0x528551['error'][_0x1ff0('0x18')]);}logger[_0x1ff0('0x17')](_0x1ff0('0x12'),_0x5283eb,_0x528551['error'][_0x1ff0('0x18')]);return _0x26fe0a(_0x528551[_0x1ff0('0x17')]['message']);}else{logger[_0x1ff0('0x11')](_0x1ff0('0x12'),_0x5283eb,'request\x20sent');_0x26fe0a(_0x528551[_0x1ff0('0x19')][_0x1ff0('0x18')]);}})[_0x1ff0('0x1a')](function(_0x2094a3){logger[_0x1ff0('0x17')]('MailQueue,\x20%s,\x20%s',_0x5283eb,_0x2094a3);_0xb497aa(_0x2094a3);});});}exports[_0x1ff0('0x1b')]=function(_0x483920){var _0x3d9553=this;return new Promise(function(_0x48b84f,_0xb8c73e){return db[_0x1ff0('0x1c')][_0x1ff0('0x1d')]({'raw':_0x483920[_0x1ff0('0x1e')]?_0x483920[_0x1ff0('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x483920[_0x1ff0('0x1e')]?_0x483920[_0x1ff0('0x1e')][_0x1ff0('0x1f')]||null:null,'attributes':_0x483920[_0x1ff0('0x1e')]?_0x483920[_0x1ff0('0x1e')][_0x1ff0('0x20')]||null:null,'limit':_0x483920[_0x1ff0('0x1e')]?_0x483920[_0x1ff0('0x1e')]['limit']||null:null,'include':_0x483920[_0x1ff0('0x1e')]?_0x483920[_0x1ff0('0x1e')][_0x1ff0('0x21')]?_['map'](_0x483920[_0x1ff0('0x1e')][_0x1ff0('0x21')],function(_0x51a81b){return{'model':db[_0x51a81b[_0x1ff0('0x22')]],'as':_0x51a81b['as'],'attributes':_0x51a81b[_0x1ff0('0x20')],'include':_0x51a81b[_0x1ff0('0x21')]?_[_0x1ff0('0x23')](_0x51a81b[_0x1ff0('0x21')],function(_0x2179f6){return{'model':db[_0x2179f6[_0x1ff0('0x22')]],'as':_0x2179f6['as'],'attributes':_0x2179f6[_0x1ff0('0x20')],'include':_0x2179f6[_0x1ff0('0x21')]?_[_0x1ff0('0x23')](_0x2179f6[_0x1ff0('0x21')],function(_0x35a355){return{'model':db[_0x35a355[_0x1ff0('0x22')]],'as':_0x35a355['as'],'attributes':_0x35a355['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ff0('0x10')](function(_0xa2a8f0){logger['info']('GetMailQueue',_0x483920);logger[_0x1ff0('0x14')]('GetMailQueue',_0x483920,JSON[_0x1ff0('0x16')](_0xa2a8f0));_0x48b84f(_0xa2a8f0);})[_0x1ff0('0x1a')](function(_0x335bab){logger[_0x1ff0('0x17')](_0x1ff0('0x1b'),_0x335bab[_0x1ff0('0x18')],_0x483920);_0xb8c73e(_0x3d9553[_0x1ff0('0x17')](0x1f4,_0x335bab[_0x1ff0('0x18')]));});});};exports[_0x1ff0('0x24')]=function(_0x113f4d){var _0x20c30b=this;return new Promise(function(_0x591ce9,_0x1fe898){return db[_0x1ff0('0x1c')][_0x1ff0('0x25')]({'raw':_0x113f4d[_0x1ff0('0x1e')]?_0x113f4d[_0x1ff0('0x1e')][_0x1ff0('0x26')]===undefined?!![]:![]:!![],'where':_0x113f4d[_0x1ff0('0x1e')]?_0x113f4d['options'][_0x1ff0('0x1f')]||null:null,'attributes':_0x113f4d[_0x1ff0('0x1e')]?_0x113f4d[_0x1ff0('0x1e')]['attributes']||null:null,'include':_0x113f4d[_0x1ff0('0x1e')]?_0x113f4d[_0x1ff0('0x1e')][_0x1ff0('0x21')]?_['map'](_0x113f4d[_0x1ff0('0x1e')][_0x1ff0('0x21')],function(_0x5a86fd){return{'model':db[_0x5a86fd[_0x1ff0('0x22')]],'as':_0x5a86fd['as'],'attributes':_0x5a86fd[_0x1ff0('0x20')],'include':_0x5a86fd['include']?_[_0x1ff0('0x23')](_0x5a86fd['include'],function(_0x55c0c9){return{'model':db[_0x55c0c9[_0x1ff0('0x22')]],'as':_0x55c0c9['as'],'attributes':_0x55c0c9[_0x1ff0('0x20')],'include':_0x55c0c9[_0x1ff0('0x21')]?_['map'](_0x55c0c9[_0x1ff0('0x21')],function(_0x330ed1){return{'model':db[_0x330ed1[_0x1ff0('0x22')]],'as':_0x330ed1['as'],'attributes':_0x330ed1[_0x1ff0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1ff0('0x10')](function(_0x47a537){logger[_0x1ff0('0x11')](_0x1ff0('0x24'),_0x113f4d);logger[_0x1ff0('0x14')](_0x1ff0('0x24'),_0x113f4d,JSON['stringify'](_0x47a537));_0x591ce9(_0x47a537);})[_0x1ff0('0x1a')](function(_0x4fb096){logger[_0x1ff0('0x17')]('ShowMailQueue',_0x4fb096[_0x1ff0('0x18')],_0x113f4d);_0x1fe898(_0x20c30b['error'](0x1f4,_0x4fb096[_0x1ff0('0x18')]));});});}; \ No newline at end of file +var _0xd720=['ShowMailQueue','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','findAll','options','raw','attributes','limit','map','include','model','then','debug','GetMailQueue','catch','MailQueue','where'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xd720,0xba));var _0x0d72=function(_0x480cd2,_0x2dcbab){_0x480cd2=_0x480cd2-0x0;var _0x39fb18=_0xd720[_0x480cd2];return _0x39fb18;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d72('0x0'));var BPromise=require('bluebird');var rs=require(_0x0d72('0x1'));var fs=require('fs');var Redis=require(_0x0d72('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0d72('0x3'))(_0x0d72('0x4'));var config=require(_0x0d72('0x5'));var jayson=require(_0x0d72('0x6'));var client=jayson[_0x0d72('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0d72('0x8'),'port':0x18eb});var socket=require(_0x0d72('0x9'))(new Redis(config[_0x0d72('0xa')]));require(_0x0d72('0xb'))[_0x0d72('0xc')](socket);function respondWithRpcPromise(_0x3bb32f,_0x2b1100,_0x2df560){return new BPromise(function(_0x2a631a,_0x5e6e1e){return client[_0x0d72('0xd')](_0x3bb32f,_0x2df560)['then'](function(_0x49b57d){logger[_0x0d72('0xe')](_0x0d72('0xf'),_0x2b1100,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x2b1100,_0x0d72('0x10'),JSON[_0x0d72('0x11')](_0x49b57d));if(_0x49b57d[_0x0d72('0x12')]){if(_0x49b57d[_0x0d72('0x12')][_0x0d72('0x13')]===0x1f4){logger[_0x0d72('0x12')](_0x0d72('0xf'),_0x2b1100,_0x49b57d[_0x0d72('0x12')][_0x0d72('0x14')]);return _0x5e6e1e(_0x49b57d[_0x0d72('0x12')][_0x0d72('0x14')]);}logger[_0x0d72('0x12')](_0x0d72('0xf'),_0x2b1100,_0x49b57d[_0x0d72('0x12')][_0x0d72('0x14')]);return _0x2a631a(_0x49b57d[_0x0d72('0x12')][_0x0d72('0x14')]);}else{logger[_0x0d72('0xe')](_0x0d72('0xf'),_0x2b1100,'request\x20sent');_0x2a631a(_0x49b57d[_0x0d72('0x15')][_0x0d72('0x14')]);}})['catch'](function(_0xa7714f){logger[_0x0d72('0x12')](_0x0d72('0xf'),_0x2b1100,_0xa7714f);_0x5e6e1e(_0xa7714f);});});}exports['GetMailQueue']=function(_0x28dbf7){var _0x3d0555=this;return new Promise(function(_0x2f9735,_0x50d0fc){return db['MailQueue'][_0x0d72('0x16')]({'raw':_0x28dbf7[_0x0d72('0x17')]?_0x28dbf7[_0x0d72('0x17')][_0x0d72('0x18')]===undefined?!![]:![]:!![],'where':_0x28dbf7[_0x0d72('0x17')]?_0x28dbf7[_0x0d72('0x17')]['where']||null:null,'attributes':_0x28dbf7[_0x0d72('0x17')]?_0x28dbf7['options'][_0x0d72('0x19')]||null:null,'limit':_0x28dbf7[_0x0d72('0x17')]?_0x28dbf7[_0x0d72('0x17')][_0x0d72('0x1a')]||null:null,'include':_0x28dbf7[_0x0d72('0x17')]?_0x28dbf7[_0x0d72('0x17')]['include']?_[_0x0d72('0x1b')](_0x28dbf7[_0x0d72('0x17')][_0x0d72('0x1c')],function(_0x365a7f){return{'model':db[_0x365a7f[_0x0d72('0x1d')]],'as':_0x365a7f['as'],'attributes':_0x365a7f['attributes'],'include':_0x365a7f[_0x0d72('0x1c')]?_['map'](_0x365a7f['include'],function(_0x42a535){return{'model':db[_0x42a535[_0x0d72('0x1d')]],'as':_0x42a535['as'],'attributes':_0x42a535[_0x0d72('0x19')],'include':_0x42a535['include']?_[_0x0d72('0x1b')](_0x42a535[_0x0d72('0x1c')],function(_0x5a0721){return{'model':db[_0x5a0721[_0x0d72('0x1d')]],'as':_0x5a0721['as'],'attributes':_0x5a0721['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d72('0x1e')](function(_0x3a5a06){logger[_0x0d72('0xe')]('GetMailQueue',_0x28dbf7);logger[_0x0d72('0x1f')](_0x0d72('0x20'),_0x28dbf7,JSON[_0x0d72('0x11')](_0x3a5a06));_0x2f9735(_0x3a5a06);})[_0x0d72('0x21')](function(_0xb2e7b1){logger[_0x0d72('0x12')](_0x0d72('0x20'),_0xb2e7b1[_0x0d72('0x14')],_0x28dbf7);_0x50d0fc(_0x3d0555[_0x0d72('0x12')](0x1f4,_0xb2e7b1[_0x0d72('0x14')]));});});};exports['ShowMailQueue']=function(_0x5eca9a){var _0x216711=this;return new Promise(function(_0x3630fb,_0x5bd676){return db[_0x0d72('0x22')]['find']({'raw':_0x5eca9a[_0x0d72('0x17')]?_0x5eca9a[_0x0d72('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5eca9a[_0x0d72('0x17')]?_0x5eca9a['options'][_0x0d72('0x23')]||null:null,'attributes':_0x5eca9a['options']?_0x5eca9a[_0x0d72('0x17')][_0x0d72('0x19')]||null:null,'include':_0x5eca9a[_0x0d72('0x17')]?_0x5eca9a[_0x0d72('0x17')][_0x0d72('0x1c')]?_[_0x0d72('0x1b')](_0x5eca9a[_0x0d72('0x17')][_0x0d72('0x1c')],function(_0x4f88e6){return{'model':db[_0x4f88e6[_0x0d72('0x1d')]],'as':_0x4f88e6['as'],'attributes':_0x4f88e6['attributes'],'include':_0x4f88e6[_0x0d72('0x1c')]?_['map'](_0x4f88e6[_0x0d72('0x1c')],function(_0x467993){return{'model':db[_0x467993[_0x0d72('0x1d')]],'as':_0x467993['as'],'attributes':_0x467993['attributes'],'include':_0x467993[_0x0d72('0x1c')]?_['map'](_0x467993[_0x0d72('0x1c')],function(_0x22cb9d){return{'model':db[_0x22cb9d[_0x0d72('0x1d')]],'as':_0x22cb9d['as'],'attributes':_0x22cb9d[_0x0d72('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0d72('0x1e')](function(_0x2c6081){logger[_0x0d72('0xe')](_0x0d72('0x24'),_0x5eca9a);logger['debug']('ShowMailQueue',_0x5eca9a,JSON[_0x0d72('0x11')](_0x2c6081));_0x3630fb(_0x2c6081);})[_0x0d72('0x21')](function(_0x5514cd){logger[_0x0d72('0x12')](_0x0d72('0x24'),_0x5514cd[_0x0d72('0x14')],_0x5eca9a);_0x5bd676(_0x216711['error'](0x1f4,_0x5514cd['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b7b6f3b..4b348da 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 _0xa440=['update','emit','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x5d4390,_0x21b7d8){var _0x4f3e01=function(_0x42372f){while(--_0x42372f){_0x5d4390['push'](_0x5d4390['shift']());}};_0x4f3e01(++_0x21b7d8);}(_0xa440,0x6e));var _0x0a44=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0xa440[_0x580b15];return _0x1adb1b;};'use strict';var MailQueueEvents=require(_0x0a44('0x0'));var events=[_0x0a44('0x1'),'remove',_0x0a44('0x2')];function createListener(_0x11a694,_0x18da33){return function(_0x3f0a0e){_0x18da33[_0x0a44('0x3')](_0x11a694,_0x3f0a0e);};}function removeListener(_0x22f4c5,_0x5426b7){return function(){MailQueueEvents['removeListener'](_0x22f4c5,_0x5426b7);};}exports[_0x0a44('0x4')]=function(_0x2698a7){for(var _0x16a1de=0x0,_0x5e9fb1=events[_0x0a44('0x5')];_0x16a1de<_0x5e9fb1;_0x16a1de++){var _0x21fd2c=events[_0x16a1de];var _0x389c27=createListener(_0x0a44('0x6')+_0x21fd2c,_0x2698a7);MailQueueEvents['on'](_0x21fd2c,_0x389c27);}}; \ No newline at end of file +var _0xc23d=['save','remove','update','emit','removeListener','register','mailQueue:','./mailQueue.events'];(function(_0x3a785d,_0x32d933){var _0x2f91a6=function(_0x32288f){while(--_0x32288f){_0x3a785d['push'](_0x3a785d['shift']());}};_0x2f91a6(++_0x32d933);}(_0xc23d,0x7f));var _0xdc23=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0xc23d[_0x264f48];return _0xb99167;};'use strict';var MailQueueEvents=require(_0xdc23('0x0'));var events=[_0xdc23('0x1'),_0xdc23('0x2'),_0xdc23('0x3')];function createListener(_0x400976,_0x1feefa){return function(_0x48228e){_0x1feefa[_0xdc23('0x4')](_0x400976,_0x48228e);};}function removeListener(_0x202655,_0x38fc3c){return function(){MailQueueEvents[_0xdc23('0x5')](_0x202655,_0x38fc3c);};}exports[_0xdc23('0x6')]=function(_0x5b6bec){for(var _0x4a153f=0x0,_0x17cb48=events['length'];_0x4a153f<_0x17cb48;_0x4a153f++){var _0x2a5303=events[_0x4a153f];var _0x4d16cf=createListener(_0xdc23('0x7')+_0x2a5303,_0x5b6bec);MailQueueEvents['on'](_0x2a5303,_0x4d16cf);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 633b6ce..91fb080 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 _0x7ab7=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xafce13,_0x28eec3){var _0xb9d178=function(_0x167458){while(--_0x167458){_0xafce13['push'](_0xafce13['shift']());}};_0xb9d178(++_0x28eec3);}(_0x7ab7,0xa0));var _0x77ab=function(_0x1d5837,_0x4bc137){_0x1d5837=_0x1d5837-0x0;var _0x16773d=_0x7ab7[_0x1d5837];return _0x16773d;};'use strict';var multer=require(_0x77ab('0x0'));var util=require(_0x77ab('0x1'));var path=require(_0x77ab('0x2'));var timeout=require(_0x77ab('0x3'));var express=require(_0x77ab('0x4'));var router=express[_0x77ab('0x5')]();var fs_extra=require(_0x77ab('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x77ab('0x7'));var config=require(_0x77ab('0x8'));var controller=require(_0x77ab('0x9'));router[_0x77ab('0xa')]('/',auth[_0x77ab('0xb')](),controller[_0x77ab('0xc')]);router[_0x77ab('0xa')](_0x77ab('0xd'),auth[_0x77ab('0xb')](),controller[_0x77ab('0xe')]);router['get'](_0x77ab('0xf'),auth['isAuthenticated'](),controller[_0x77ab('0x10')]);router[_0x77ab('0x11')]('/',auth[_0x77ab('0xb')](),controller['create']);router[_0x77ab('0x12')](_0x77ab('0xf'),auth[_0x77ab('0xb')](),controller['update']);router['delete'](_0x77ab('0xf'),auth[_0x77ab('0xb')](),controller[_0x77ab('0x13')]);module[_0x77ab('0x14')]=router; \ No newline at end of file +var _0x5c99=['isAuthenticated','/:id','post','create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe'];(function(_0x2a0f3f,_0x4dce14){var _0x43daa7=function(_0x357b96){while(--_0x357b96){_0x2a0f3f['push'](_0x2a0f3f['shift']());}};_0x43daa7(++_0x4dce14);}(_0x5c99,0x85));var _0x95c9=function(_0x4a92c2,_0x28ed8b){_0x4a92c2=_0x4a92c2-0x0;var _0x7b52f1=_0x5c99[_0x4a92c2];return _0x7b52f1;};'use strict';var multer=require(_0x95c9('0x0'));var util=require(_0x95c9('0x1'));var path=require(_0x95c9('0x2'));var timeout=require('connect-timeout');var express=require(_0x95c9('0x3'));var router=express[_0x95c9('0x4')]();var fs_extra=require(_0x95c9('0x5'));var auth=require(_0x95c9('0x6'));var interaction=require(_0x95c9('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x95c9('0x8')]('/',auth['isAuthenticated'](),controller[_0x95c9('0x9')]);router[_0x95c9('0x8')](_0x95c9('0xa'),auth[_0x95c9('0xb')](),controller['describe']);router['get'](_0x95c9('0xc'),auth[_0x95c9('0xb')](),controller['show']);router[_0x95c9('0xd')]('/',auth[_0x95c9('0xb')](),controller[_0x95c9('0xe')]);router[_0x95c9('0xf')](_0x95c9('0xc'),auth[_0x95c9('0xb')](),controller[_0x95c9('0x10')]);router['delete'](_0x95c9('0xc'),auth[_0x95c9('0xb')](),controller['destroy']);module[_0x95c9('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 108ee6e..f95e360 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 _0x728d=['moment','sequelize','exports','STRING','DATE'];(function(_0x19aa32,_0x33381b){var _0x104dd6=function(_0xd172cd){while(--_0xd172cd){_0x19aa32['push'](_0x19aa32['shift']());}};_0x104dd6(++_0x33381b);}(_0x728d,0x1c2));var _0xd728=function(_0x1263cc,_0x34b0a6){_0x1263cc=_0x1263cc-0x0;var _0x4132a0=_0x728d[_0x1263cc];return _0x4132a0;};'use strict';var moment=require(_0xd728('0x0'));var Sequelize=require(_0xd728('0x1'));module[_0xd728('0x2')]={'uniqueid':{'type':Sequelize[_0xd728('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd728('0x3')]},'joinAt':{'type':Sequelize[_0xd728('0x4')]},'leaveAt':{'type':Sequelize[_0xd728('0x4')]},'acceptAt':{'type':Sequelize[_0xd728('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd728('0x3')]}}; \ No newline at end of file +var _0x71a6=['sequelize','exports','STRING','DATE','moment'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x71a6,0x108));var _0x671a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71a6[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require(_0x671a('0x0'));var Sequelize=require(_0x671a('0x1'));module[_0x671a('0x2')]={'uniqueid':{'type':Sequelize[_0x671a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x671a('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x671a('0x4')]},'acceptAt':{'type':Sequelize[_0x671a('0x4')]},'exitAt':{'type':Sequelize[_0x671a('0x4')]},'reason':{'type':Sequelize[_0x671a('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index af9de57..4492bc2 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaebd=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','MailQueueReport','options','create','body','find','describe','eml-format'];(function(_0x4a3088,_0x899ef4){var _0x53faf0=function(_0xe543c1){while(--_0xe543c1){_0x4a3088['push'](_0x4a3088['shift']());}};_0x53faf0(++_0x899ef4);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1ecf36,_0x4186ce){_0x1ecf36=_0x1ecf36-0x0;var _0x11ae82=_0xaebd[_0x1ecf36];return _0x11ae82;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){_0x39dfae[_0xdaeb('0x16')](0xcc)[_0xdaeb('0x17')]();});}};}function handleEntityNotFound(_0x3b0770,_0x32c2c1){return function(_0x4fc3e2){if(!_0x4fc3e2){_0x3b0770[_0xdaeb('0x15')](0x194);}return _0x4fc3e2;};}function handleError(_0x34fa21,_0x338687){_0x338687=_0x338687||0x1f4;return function(_0x4eb719){logger['error'](_0x4eb719[_0xdaeb('0x24')]);if(_0x4eb719['name']){delete _0x4eb719['name'];}_0x34fa21[_0xdaeb('0x16')](_0x338687)[_0xdaeb('0x25')](_0x4eb719);};}exports[_0xdaeb('0x26')]=function(_0x5eb7b5,_0x5e6f97){var _0x32966f={},_0x440022={},_0x37f468={'count':0x0,'rows':[]};var _0x596c19=_[_0xdaeb('0x27')](db['MailQueueReport']['rawAttributes'],function(_0x28812c){return{'name':_0x28812c[_0xdaeb('0x28')],'type':_0x28812c[_0xdaeb('0x29')][_0xdaeb('0x2a')]};});_0x440022[_0xdaeb('0x2b')]=_[_0xdaeb('0x27')](_0x596c19,_0xdaeb('0x2c'));_0x440022['query']=_[_0xdaeb('0x2d')](_0x5eb7b5[_0xdaeb('0x2e')]);_0x440022[_0xdaeb('0x2f')]=_[_0xdaeb('0x30')](_0x440022[_0xdaeb('0x2b')],_0x440022['query']);_0x32966f[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x440022['model'],qs[_0xdaeb('0x32')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x32966f[_0xdaeb('0x31')]=_0x32966f[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x32966f[_0xdaeb('0x31')]:_0x440022[_0xdaeb('0x2b')];if(!_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x34')]('nolimit')){_0x32966f['limit']=qs[_0xdaeb('0x1c')](_0x5eb7b5['query'][_0xdaeb('0x1c')]);_0x32966f[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x1b')]);}_0x32966f[_0xdaeb('0x35')]=qs['sort'](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x36')]);_0x32966f[_0xdaeb('0x37')]=qs['filters'](_[_0xdaeb('0x38')](_0x5eb7b5[_0xdaeb('0x2e')],_0x440022[_0xdaeb('0x2f')]),_0x596c19);if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x39')]){_0x32966f[_0xdaeb('0x37')]=_[_0xdaeb('0x3a')](_0x32966f['where'],{'$or':_[_0xdaeb('0x27')](_0x596c19,function(_0x170009){if(_0x170009['type']!=='VIRTUAL'){var _0x2ef310={};_0x2ef310[_0x170009[_0xdaeb('0x2c')]]={'$like':'%'+_0x5eb7b5['query'][_0xdaeb('0x39')]+'%'};return _0x2ef310;}})});}_0x32966f=_[_0xdaeb('0x3a')]({},_0x32966f,_0x5eb7b5['options']);var _0x151cc4={'where':_0x32966f[_0xdaeb('0x37')]};return db['MailQueueReport']['count'](_0x151cc4)[_0xdaeb('0x23')](function(_0x11dce7){_0x37f468[_0xdaeb('0x1a')]=_0x11dce7;if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x3b')]){_0x32966f[_0xdaeb('0x3c')]=[{'all':!![]}];}return db['MailQueueReport'][_0xdaeb('0x3d')](_0x32966f);})['then'](function(_0x46aa44){_0x37f468['rows']=_0x46aa44;return _0x37f468;})['then'](respondWithFilteredResult(_0x5e6f97,_0x32966f))[_0xdaeb('0x3e')](handleError(_0x5e6f97,null));};exports['show']=function(_0x5a42a6,_0x4efd96){var _0x45c3fc={'raw':!![],'where':{'id':_0x5a42a6[_0xdaeb('0x3f')]['id']}},_0x244369={};_0x244369[_0xdaeb('0x2b')]=_['keys'](db[_0xdaeb('0x40')]['rawAttributes']);_0x244369[_0xdaeb('0x2e')]=_[_0xdaeb('0x2d')](_0x5a42a6[_0xdaeb('0x2e')]);_0x244369['filters']=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],_0x244369[_0xdaeb('0x2e')]);_0x45c3fc[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],qs[_0xdaeb('0x32')](_0x5a42a6[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x45c3fc[_0xdaeb('0x31')]=_0x45c3fc[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x45c3fc['attributes']:_0x244369[_0xdaeb('0x2b')];if(_0x5a42a6[_0xdaeb('0x2e')]['includeAll']){_0x45c3fc['include']=[{'all':!![]}];}_0x45c3fc=_[_0xdaeb('0x3a')]({},_0x45c3fc,_0x5a42a6[_0xdaeb('0x41')]);return db[_0xdaeb('0x40')]['find'](_0x45c3fc)[_0xdaeb('0x23')](handleEntityNotFound(_0x4efd96,null))[_0xdaeb('0x23')](respondWithResult(_0x4efd96,null))[_0xdaeb('0x3e')](handleError(_0x4efd96,null));};exports[_0xdaeb('0x42')]=function(_0x266d6b,_0x45344b){return db[_0xdaeb('0x40')][_0xdaeb('0x42')](_0x266d6b['body'],{})[_0xdaeb('0x23')](respondWithResult(_0x45344b,0xc9))[_0xdaeb('0x3e')](handleError(_0x45344b,null));};exports['update']=function(_0x38d2ee,_0x4dd70c){if(_0x38d2ee[_0xdaeb('0x43')]['id']){delete _0x38d2ee[_0xdaeb('0x43')]['id'];}return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x38d2ee[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x4dd70c,null))[_0xdaeb('0x23')](saveUpdates(_0x38d2ee[_0xdaeb('0x43')],null))[_0xdaeb('0x23')](respondWithResult(_0x4dd70c,null))['catch'](handleError(_0x4dd70c,null));};exports['destroy']=function(_0x1403c8,_0x3112d2){return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x1403c8[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x3112d2,null))['then'](removeEntity(_0x3112d2,null))[_0xdaeb('0x3e')](handleError(_0x3112d2,null));};exports[_0xdaeb('0x45')]=function(_0x3f6a88,_0x589442){return db[_0xdaeb('0x40')]['describe']()[_0xdaeb('0x23')](respondWithResult(_0x589442,null))[_0xdaeb('0x3e')](handleError(_0x589442,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3054ab,_0x5218e4){_0x3054ab=_0x3054ab-0x0;var _0x1e4101=_0x9f0e[_0x3054ab];return _0x1e4101;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':!![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['MailQueueReport'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['MailQueueReport'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f9220e9..c96261e 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 _0x81c6=['bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','util'];(function(_0x3e4853,_0x256600){var _0x214a19=function(_0x1c8f1b){while(--_0x1c8f1b){_0x3e4853['push'](_0x3e4853['shift']());}};_0x214a19(++_0x256600);}(_0x81c6,0x1d5));var _0x681c=function(_0x21057f,_0x4e3b82){_0x21057f=_0x21057f-0x0;var _0x1e2c77=_0x81c6[_0x21057f];return _0x1e2c77;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x681c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bbc=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x25e9b5,_0x241578){var _0x2fa336=function(_0x4e690b){while(--_0x4e690b){_0x25e9b5['push'](_0x25e9b5['shift']());}};_0x2fa336(++_0x241578);}(_0x2bbc,0x1ea));var _0xc2bb=function(_0x2800e6,_0x392ece){_0x2800e6=_0x2800e6-0x0;var _0x105e4e=_0x2bbc[_0x2800e6];return _0x105e4e;};'use strict';var _=require(_0xc2bb('0x0'));var util=require(_0xc2bb('0x1'));var logger=require(_0xc2bb('0x2'))(_0xc2bb('0x3'));var moment=require('moment');var BPromise=require(_0xc2bb('0x4'));var rp=require(_0xc2bb('0x5'));var fs=require('fs');var path=require(_0xc2bb('0x6'));var rimraf=require(_0xc2bb('0x7'));var config=require(_0xc2bb('0x8'));var attributes=require(_0xc2bb('0x9'));module['exports']=function(_0x32d66c,_0xa597f2){return _0x32d66c[_0xc2bb('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index b3e8fce..6b698d2 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x127644,_0xe55c07){var _0x431524=function(_0x2f0a9a){while(--_0x2f0a9a){_0x127644['push'](_0x127644['shift']());}};_0x431524(++_0xe55c07);}(_0x1261,0x144));var _0x1126=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x1261[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xe8319,_0x3505e1){var _0x34f85e=function(_0x4cefa0){while(--_0x4cefa0){_0xe8319['push'](_0xe8319['shift']());}};_0x34f85e(++_0x3505e1);}(_0xadb5,0xad));var _0x5adb=function(_0x29ed83,_0x54677a){_0x29ed83=_0x29ed83-0x0;var _0x22a71d=_0xadb5[_0x29ed83];return _0x22a71d;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index ca1e329..e47aa97 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4cf927,_0x4c39f0){var _0x2bc920=function(_0x4b6e2f){while(--_0x4b6e2f){_0x4cf927['push'](_0x4cf927['shift']());}};_0x2bc920(++_0x4c39f0);}(_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(_0x45645f,_0x7d5cf0){var _0x492f06=function(_0x513a12){while(--_0x513a12){_0x45645f['push'](_0x45645f['shift']());}};_0x492f06(++_0x7d5cf0);}(_0x70e0,0x17b));var _0x070e=function(_0x458252,_0x8db450){_0x458252=_0x458252-0x0;var _0x35c1f1=_0x70e0[_0x458252];return _0x35c1f1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 15d5ba4..6dad3c7 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 _0x11b3=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x160a89,_0x43f11f){var _0x16837c=function(_0x422ba5){while(--_0x422ba5){_0x160a89['push'](_0x160a89['shift']());}};_0x16837c(++_0x43f11f);}(_0x11b3,0xe2));var _0x311b=function(_0x49225e,_0x32351d){_0x49225e=_0x49225e-0x0;var _0xfb6519=_0x11b3[_0x49225e];return _0xfb6519;};'use strict';var Sequelize=require(_0x311b('0x0'));module['exports']={'description':{'type':Sequelize[_0x311b('0x1')]},'host':{'type':Sequelize[_0x311b('0x1')]},'authentication':{'type':Sequelize[_0x311b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x311b('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x311b('0x3')]},'tls':{'type':Sequelize[_0x311b('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x311b('0x4')},'connTimeout':{'type':Sequelize[_0x311b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x311b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa10c=['sequelize','exports','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x150a17,_0x12e876){var _0x439f1e=function(_0x15ea6e){while(--_0x15ea6e){_0x150a17['push'](_0x150a17['shift']());}};_0x439f1e(++_0x12e876);}(_0xa10c,0x120));var _0xca10=function(_0xd6ed2d,_0x2fb0dd){_0xd6ed2d=_0xd6ed2d-0x0;var _0x575552=_0xa10c[_0xd6ed2d];return _0x575552;};'use strict';var Sequelize=require(_0xca10('0x0'));module[_0xca10('0x1')]={'description':{'type':Sequelize[_0xca10('0x2')]},'host':{'type':Sequelize[_0xca10('0x2')]},'authentication':{'type':Sequelize[_0xca10('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xca10('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xca10('0x2')],'defaultValue':_0xca10('0x4')},'connTimeout':{'type':Sequelize[_0xca10('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xca10('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'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 222b84e..596d2f2 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 _0xe33c=['api','moment','bluebird','path','rimraf','./mailServerIn.attributes','exports','mail_servers_in','lodash','util'];(function(_0x4d6f8a,_0x2f1bae){var _0x377928=function(_0x548e81){while(--_0x548e81){_0x4d6f8a['push'](_0x4d6f8a['shift']());}};_0x377928(++_0x2f1bae);}(_0xe33c,0x166));var _0xce33=function(_0x3a54ae,_0x7843ac){_0x3a54ae=_0x3a54ae-0x0;var _0x54d3be=_0xe33c[_0x3a54ae];return _0x54d3be;};'use strict';var _=require(_0xce33('0x0'));var util=require(_0xce33('0x1'));var logger=require('../../config/logger')(_0xce33('0x2'));var moment=require(_0xce33('0x3'));var BPromise=require(_0xce33('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce33('0x5'));var rimraf=require(_0xce33('0x6'));var config=require('../../config/environment');var attributes=require(_0xce33('0x7'));module[_0xce33('0x8')]=function(_0x411697,_0xa41c9){return _0x411697['define']('MailServerIn',attributes,{'tableName':_0xce33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x725d=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','lodash','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x725d,0x167));var _0xd725=function(_0x143395,_0x3cf7d4){_0x143395=_0x143395-0x0;var _0x5768ff=_0x725d[_0x143395];return _0x5768ff;};'use strict';var _=require(_0xd725('0x0'));var util=require(_0xd725('0x1'));var logger=require(_0xd725('0x2'))('api');var moment=require(_0xd725('0x3'));var BPromise=require('bluebird');var rp=require(_0xd725('0x4'));var fs=require('fs');var path=require(_0xd725('0x5'));var rimraf=require(_0xd725('0x6'));var config=require(_0xd725('0x7'));var attributes=require(_0xd725('0x8'));module['exports']=function(_0x2faa4d,_0x1b748a){return _0x2faa4d[_0xd725('0x9')](_0xd725('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index f0a599a..24c54f2 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 _0x3870=['message','request\x20sent','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3870,0x15b));var _0x0387=function(_0x5337b7,_0x48ea52){_0x5337b7=_0x5337b7-0x0;var _0x54a6af=_0x3870[_0x5337b7];return _0x54a6af;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var moment=require(_0x0387('0x2'));var BPromise=require(_0x0387('0x3'));var rs=require(_0x0387('0x4'));var fs=require('fs');var Redis=require(_0x0387('0x5'));var db=require(_0x0387('0x6'))['db'];var utils=require(_0x0387('0x7'));var logger=require(_0x0387('0x8'))(_0x0387('0x9'));var config=require(_0x0387('0xa'));var jayson=require(_0x0387('0xb'));var client=jayson[_0x0387('0xc')][_0x0387('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e7159,_0x4eff50,_0x12024e){return new BPromise(function(_0x1d926d,_0x4c94bd){return client[_0x0387('0xe')](_0x4e7159,_0x12024e)[_0x0387('0xf')](function(_0x2d42eb){logger[_0x0387('0x10')](_0x0387('0x11'),_0x4eff50,'request\x20sent');logger[_0x0387('0x12')](_0x0387('0x13'),_0x4eff50,'request\x20sent',JSON[_0x0387('0x14')](_0x2d42eb));if(_0x2d42eb[_0x0387('0x15')]){if(_0x2d42eb['error'][_0x0387('0x16')]===0x1f4){logger['error'](_0x0387('0x11'),_0x4eff50,_0x2d42eb[_0x0387('0x15')]['message']);return _0x4c94bd(_0x2d42eb[_0x0387('0x15')][_0x0387('0x17')]);}logger[_0x0387('0x15')](_0x0387('0x11'),_0x4eff50,_0x2d42eb[_0x0387('0x15')][_0x0387('0x17')]);return _0x1d926d(_0x2d42eb[_0x0387('0x15')][_0x0387('0x17')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x4eff50,_0x0387('0x18'));_0x1d926d(_0x2d42eb['result'][_0x0387('0x17')]);}})[_0x0387('0x19')](function(_0xe77709){logger[_0x0387('0x15')](_0x0387('0x11'),_0x4eff50,_0xe77709);_0x4c94bd(_0xe77709);});});}exports[_0x0387('0x1a')]=function(_0x28097e){var _0x1d994d=this;return new Promise(function(_0x388c67,_0x1bc32a){return db[_0x0387('0x1b')][_0x0387('0x1c')]({'raw':_0x28097e[_0x0387('0x1d')]?_0x28097e[_0x0387('0x1d')][_0x0387('0x1e')]===undefined?!![]:![]:!![],'where':_0x28097e[_0x0387('0x1d')]?_0x28097e['options'][_0x0387('0x1f')]||null:null,'attributes':_0x28097e[_0x0387('0x1d')]?_0x28097e[_0x0387('0x1d')][_0x0387('0x20')]||null:null,'limit':_0x28097e[_0x0387('0x1d')]?_0x28097e['options'][_0x0387('0x21')]||null:null,'include':_0x28097e[_0x0387('0x1d')]?_0x28097e[_0x0387('0x1d')][_0x0387('0x22')]?_[_0x0387('0x23')](_0x28097e[_0x0387('0x1d')][_0x0387('0x22')],function(_0x5b7648){return{'model':db[_0x5b7648[_0x0387('0x24')]],'as':_0x5b7648['as'],'attributes':_0x5b7648['attributes'],'include':_0x5b7648['include']?_[_0x0387('0x23')](_0x5b7648[_0x0387('0x22')],function(_0x38bd14){return{'model':db[_0x38bd14[_0x0387('0x24')]],'as':_0x38bd14['as'],'attributes':_0x38bd14['attributes'],'include':_0x38bd14['include']?_[_0x0387('0x23')](_0x38bd14['include'],function(_0x934392){return{'model':db[_0x934392[_0x0387('0x24')]],'as':_0x934392['as'],'attributes':_0x934392[_0x0387('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0387('0xf')](function(_0x17aac4){logger[_0x0387('0x10')](_0x0387('0x1a'),_0x28097e);logger[_0x0387('0x12')](_0x0387('0x1a'),_0x28097e,JSON[_0x0387('0x14')](_0x17aac4));_0x388c67(_0x17aac4);})[_0x0387('0x19')](function(_0x3be0f9){logger[_0x0387('0x15')](_0x0387('0x1a'),_0x3be0f9[_0x0387('0x17')],_0x28097e);_0x1bc32a(_0x1d994d[_0x0387('0x15')](0x1f4,_0x3be0f9[_0x0387('0x17')]));});});}; \ No newline at end of file +var _0xd6ef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailServerIn','findAll','options','raw','where','limit','include','model','map','attributes','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5a8c71,_0x1f2d33){var _0x388ec1=function(_0x35e201){while(--_0x35e201){_0x5a8c71['push'](_0x5a8c71['shift']());}};_0x388ec1(++_0x1f2d33);}(_0xd6ef,0xfb));var _0xfd6e=function(_0x5bc104,_0x121300){_0x5bc104=_0x5bc104-0x0;var _0x9af42f=_0xd6ef[_0x5bc104];return _0x9af42f;};'use strict';var _=require(_0xfd6e('0x0'));var util=require(_0xfd6e('0x1'));var moment=require('moment');var BPromise=require(_0xfd6e('0x2'));var rs=require(_0xfd6e('0x3'));var fs=require('fs');var Redis=require(_0xfd6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd6e('0x5'));var logger=require(_0xfd6e('0x6'))(_0xfd6e('0x7'));var config=require(_0xfd6e('0x8'));var jayson=require(_0xfd6e('0x9'));var client=jayson[_0xfd6e('0xa')][_0xfd6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aafe0,_0x25090d,_0x25eaee){return new BPromise(function(_0x2064b3,_0x380d2d){return client['request'](_0x1aafe0,_0x25eaee)['then'](function(_0x4d8a31){logger[_0xfd6e('0xc')](_0xfd6e('0xd'),_0x25090d,_0xfd6e('0xe'));logger[_0xfd6e('0xf')](_0xfd6e('0x10'),_0x25090d,_0xfd6e('0xe'),JSON[_0xfd6e('0x11')](_0x4d8a31));if(_0x4d8a31['error']){if(_0x4d8a31[_0xfd6e('0x12')]['code']===0x1f4){logger[_0xfd6e('0x12')](_0xfd6e('0xd'),_0x25090d,_0x4d8a31['error'][_0xfd6e('0x13')]);return _0x380d2d(_0x4d8a31[_0xfd6e('0x12')][_0xfd6e('0x13')]);}logger[_0xfd6e('0x12')]('MailServerIn,\x20%s,\x20%s',_0x25090d,_0x4d8a31['error'][_0xfd6e('0x13')]);return _0x2064b3(_0x4d8a31[_0xfd6e('0x12')][_0xfd6e('0x13')]);}else{logger[_0xfd6e('0xc')](_0xfd6e('0xd'),_0x25090d,_0xfd6e('0xe'));_0x2064b3(_0x4d8a31[_0xfd6e('0x14')][_0xfd6e('0x13')]);}})[_0xfd6e('0x15')](function(_0x5ddc69){logger[_0xfd6e('0x12')]('MailServerIn,\x20%s,\x20%s',_0x25090d,_0x5ddc69);_0x380d2d(_0x5ddc69);});});}exports['GetMailServerIn']=function(_0x93b63b){var _0x86c3b5=this;return new Promise(function(_0x346bdf,_0x2b4243){return db[_0xfd6e('0x16')][_0xfd6e('0x17')]({'raw':_0x93b63b[_0xfd6e('0x18')]?_0x93b63b['options'][_0xfd6e('0x19')]===undefined?!![]:![]:!![],'where':_0x93b63b[_0xfd6e('0x18')]?_0x93b63b[_0xfd6e('0x18')][_0xfd6e('0x1a')]||null:null,'attributes':_0x93b63b['options']?_0x93b63b['options']['attributes']||null:null,'limit':_0x93b63b[_0xfd6e('0x18')]?_0x93b63b['options'][_0xfd6e('0x1b')]||null:null,'include':_0x93b63b['options']?_0x93b63b['options'][_0xfd6e('0x1c')]?_['map'](_0x93b63b[_0xfd6e('0x18')][_0xfd6e('0x1c')],function(_0x51b1f6){return{'model':db[_0x51b1f6[_0xfd6e('0x1d')]],'as':_0x51b1f6['as'],'attributes':_0x51b1f6['attributes'],'include':_0x51b1f6[_0xfd6e('0x1c')]?_[_0xfd6e('0x1e')](_0x51b1f6[_0xfd6e('0x1c')],function(_0x6d2864){return{'model':db[_0x6d2864[_0xfd6e('0x1d')]],'as':_0x6d2864['as'],'attributes':_0x6d2864[_0xfd6e('0x1f')],'include':_0x6d2864['include']?_['map'](_0x6d2864[_0xfd6e('0x1c')],function(_0x34b69f){return{'model':db[_0x34b69f[_0xfd6e('0x1d')]],'as':_0x34b69f['as'],'attributes':_0x34b69f[_0xfd6e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50d531){logger[_0xfd6e('0xc')]('GetMailServerIn',_0x93b63b);logger[_0xfd6e('0xf')]('GetMailServerIn',_0x93b63b,JSON[_0xfd6e('0x11')](_0x50d531));_0x346bdf(_0x50d531);})[_0xfd6e('0x15')](function(_0x4ed9b7){logger[_0xfd6e('0x12')]('GetMailServerIn',_0x4ed9b7[_0xfd6e('0x13')],_0x93b63b);_0x2b4243(_0x86c3b5[_0xfd6e('0x12')](0x1f4,_0x4ed9b7[_0xfd6e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 768360e..81b7ac3 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x33324e,_0x2d29a5){_0x33324e=_0x33324e-0x0;var _0x2ea7e6=_0x7a54[_0x33324e];return _0x2ea7e6;};'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 c32b580..b3da601 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(_0x3df976,_0x1c4a66){var _0x209104=function(_0x189397){while(--_0x189397){_0x3df976['push'](_0x3df976['shift']());}};_0x209104(++_0x1c4a66);}(_0x065e,0x1a7));var _0xe065=function(_0x3b7560,_0x4d9d92){_0x3b7560=_0x3b7560-0x0;var _0x5df7ee=_0x065e[_0x3b7560];return _0x5df7ee;};'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 _0x1d2d=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x516114,_0x31201b){var _0x772fe4=function(_0x26c01f){while(--_0x26c01f){_0x516114['push'](_0x516114['shift']());}};_0x772fe4(++_0x31201b);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x4299fa,_0x1ccaf1){_0x4299fa=_0x4299fa-0x0;var _0x1f1d0b=_0x1d2d[_0x4299fa];return _0x1f1d0b;};'use strict';var Sequelize=require(_0xd1d2('0x0'));module[_0xd1d2('0x1')]={'description':{'type':Sequelize[_0xd1d2('0x2')]},'host':{'type':Sequelize[_0xd1d2('0x2')]},'user':{'type':Sequelize[_0xd1d2('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd1d2('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd1d2('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xd1d2('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 49b7ff9..52811d2 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 _0x8d15=['include','findAll','show','params','keys','rawAttributes','length','find','catch','body','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','reject','update','destroy','then','error','stack','name','send','index','map','MailServerOut','fieldName','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','count','includeAll'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x8d15,0x1a8));var _0x58d1=function(_0x4409e8,_0x4e97be){_0x4409e8=_0x4409e8-0x0;var _0x1ececb=_0x8d15[_0x4409e8];return _0x1ececb;};'use strict';var emlformat=require(_0x58d1('0x0'));var rimraf=require(_0x58d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58d1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x58d1('0x3'));var util=require(_0x58d1('0x4'));var path=require(_0x58d1('0x5'));var sox=require(_0x58d1('0x6'));var csv=require(_0x58d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58d1('0x8'));var _=require(_0x58d1('0x9'));var squel=require(_0x58d1('0xa'));var crypto=require(_0x58d1('0xb'));var jsforce=require(_0x58d1('0xc'));var deskjs=require(_0x58d1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x58d1('0xe'));var Papa=require('papaparse');var Redis=require(_0x58d1('0xf'));var authService=require(_0x58d1('0x10'));var qs=require(_0x58d1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x58d1('0x12'))(_0x58d1('0x13'));var utils=require(_0x58d1('0x14'));var config=require(_0x58d1('0x15'));var licenseUtil=require(_0x58d1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ba444,_0x42666e){_0x42666e=_0x42666e||0xcc;return function(_0x11a6bb){if(_0x11a6bb){return _0x4ba444[_0x58d1('0x17')](_0x42666e);}return _0x4ba444[_0x58d1('0x18')](_0x42666e)[_0x58d1('0x19')]();};}function respondWithResult(_0x277f70,_0x1a5af3){_0x1a5af3=_0x1a5af3||0xc8;return function(_0xd4b884){if(_0xd4b884){return _0x277f70['status'](_0x1a5af3)[_0x58d1('0x1a')](_0xd4b884);}};}function respondWithFilteredResult(_0x20c306,_0x5accb4){return function(_0x47864d){if(_0x47864d){var _0x527e34=typeof _0x5accb4[_0x58d1('0x1b')]==='undefined'&&typeof _0x5accb4[_0x58d1('0x1c')]===_0x58d1('0x1d');var _0x2fc839=_0x47864d['count'];var _0x36bf57=_0x527e34?0x0:_0x5accb4['offset'];var _0x2c59e8=_0x527e34?_0x47864d['count']:_0x5accb4[_0x58d1('0x1b')]+_0x5accb4[_0x58d1('0x1c')];var _0x35c1f8;if(_0x2c59e8>=_0x2fc839){_0x2c59e8=_0x2fc839;_0x35c1f8=0xc8;}else{_0x35c1f8=0xce;}_0x20c306[_0x58d1('0x18')](_0x35c1f8);return _0x20c306['set']('Content-Range',_0x36bf57+'-'+_0x2c59e8+'/'+_0x2fc839)['json'](_0x47864d);}return null;};}function patchUpdates(_0x3cc675){return function(_0x18cf3c){try{jsonpatch['apply'](_0x18cf3c,_0x3cc675,!![]);}catch(_0xf5eafa){return BPromise[_0x58d1('0x1e')](_0xf5eafa);}return _0x18cf3c['save']();};}function saveUpdates(_0xdc207f,_0xfd5f72){return function(_0xf91166){if(_0xf91166){return _0xf91166[_0x58d1('0x1f')](_0xdc207f)['then'](function(_0x27a5c4){return _0x27a5c4;});}return null;};}function removeEntity(_0x3dbcb8,_0x4df247){return function(_0x583afd){if(_0x583afd){return _0x583afd[_0x58d1('0x20')]()[_0x58d1('0x21')](function(){_0x3dbcb8[_0x58d1('0x18')](0xcc)[_0x58d1('0x19')]();});}};}function handleEntityNotFound(_0x80c334,_0x1b33c2){return function(_0x4471aa){if(!_0x4471aa){_0x80c334[_0x58d1('0x17')](0x194);}return _0x4471aa;};}function handleError(_0x14c3c6,_0x14db19){_0x14db19=_0x14db19||0x1f4;return function(_0x12c3b3){logger[_0x58d1('0x22')](_0x12c3b3[_0x58d1('0x23')]);if(_0x12c3b3[_0x58d1('0x24')]){delete _0x12c3b3[_0x58d1('0x24')];}_0x14c3c6[_0x58d1('0x18')](_0x14db19)[_0x58d1('0x25')](_0x12c3b3);};}exports[_0x58d1('0x26')]=function(_0x274279,_0x4f1e34){var _0x18285a={},_0xaf2f7a={},_0x2c3f6c={'count':0x0,'rows':[]};var _0x1321fd=_[_0x58d1('0x27')](db[_0x58d1('0x28')]['rawAttributes'],function(_0x5e3baf){return{'name':_0x5e3baf[_0x58d1('0x29')],'type':_0x5e3baf[_0x58d1('0x2a')]['key']};});_0xaf2f7a['model']=_[_0x58d1('0x27')](_0x1321fd,_0x58d1('0x24'));_0xaf2f7a[_0x58d1('0x2b')]=_['keys'](_0x274279[_0x58d1('0x2b')]);_0xaf2f7a[_0x58d1('0x2c')]=_['intersection'](_0xaf2f7a['model'],_0xaf2f7a['query']);_0x18285a['attributes']=_[_0x58d1('0x2d')](_0xaf2f7a[_0x58d1('0x2e')],qs[_0x58d1('0x2f')](_0x274279['query'][_0x58d1('0x2f')]));_0x18285a[_0x58d1('0x30')]=_0x18285a[_0x58d1('0x30')]['length']?_0x18285a[_0x58d1('0x30')]:_0xaf2f7a['model'];if(!_0x274279[_0x58d1('0x2b')][_0x58d1('0x31')](_0x58d1('0x32'))){_0x18285a[_0x58d1('0x1c')]=qs['limit'](_0x274279[_0x58d1('0x2b')][_0x58d1('0x1c')]);_0x18285a[_0x58d1('0x1b')]=qs[_0x58d1('0x1b')](_0x274279[_0x58d1('0x2b')][_0x58d1('0x1b')]);}_0x18285a[_0x58d1('0x33')]=qs['sort'](_0x274279['query']['sort']);_0x18285a['where']=qs[_0x58d1('0x2c')](_[_0x58d1('0x34')](_0x274279[_0x58d1('0x2b')],_0xaf2f7a[_0x58d1('0x2c')]),_0x1321fd);if(_0x274279[_0x58d1('0x2b')][_0x58d1('0x35')]){_0x18285a[_0x58d1('0x36')]=_[_0x58d1('0x37')](_0x18285a[_0x58d1('0x36')],{'$or':_['map'](_0x1321fd,function(_0x22f470){if(_0x22f470[_0x58d1('0x2a')]!=='VIRTUAL'){var _0x345d5b={};_0x345d5b[_0x22f470[_0x58d1('0x24')]]={'$like':'%'+_0x274279[_0x58d1('0x2b')][_0x58d1('0x35')]+'%'};return _0x345d5b;}})});}_0x18285a=_[_0x58d1('0x37')]({},_0x18285a,_0x274279[_0x58d1('0x38')]);var _0x610996={'where':_0x18285a['where']};return db[_0x58d1('0x28')][_0x58d1('0x39')](_0x610996)['then'](function(_0x5c13db){_0x2c3f6c[_0x58d1('0x39')]=_0x5c13db;if(_0x274279[_0x58d1('0x2b')][_0x58d1('0x3a')]){_0x18285a[_0x58d1('0x3b')]=[{'all':!![]}];}return db[_0x58d1('0x28')][_0x58d1('0x3c')](_0x18285a);})[_0x58d1('0x21')](function(_0x2d70ec){_0x2c3f6c['rows']=_0x2d70ec;return _0x2c3f6c;})[_0x58d1('0x21')](respondWithFilteredResult(_0x4f1e34,_0x18285a))['catch'](handleError(_0x4f1e34,null));};exports[_0x58d1('0x3d')]=function(_0x215b17,_0x12c04a){var _0x3425a4={'raw':!![],'where':{'id':_0x215b17[_0x58d1('0x3e')]['id']}},_0xd5a28c={};_0xd5a28c[_0x58d1('0x2e')]=_[_0x58d1('0x3f')](db[_0x58d1('0x28')][_0x58d1('0x40')]);_0xd5a28c[_0x58d1('0x2b')]=_[_0x58d1('0x3f')](_0x215b17['query']);_0xd5a28c['filters']=_[_0x58d1('0x2d')](_0xd5a28c[_0x58d1('0x2e')],_0xd5a28c[_0x58d1('0x2b')]);_0x3425a4[_0x58d1('0x30')]=_['intersection'](_0xd5a28c['model'],qs[_0x58d1('0x2f')](_0x215b17[_0x58d1('0x2b')]['fields']));_0x3425a4[_0x58d1('0x30')]=_0x3425a4[_0x58d1('0x30')][_0x58d1('0x41')]?_0x3425a4[_0x58d1('0x30')]:_0xd5a28c[_0x58d1('0x2e')];if(_0x215b17[_0x58d1('0x2b')][_0x58d1('0x3a')]){_0x3425a4['include']=[{'all':!![]}];}_0x3425a4=_[_0x58d1('0x37')]({},_0x3425a4,_0x215b17[_0x58d1('0x38')]);return db[_0x58d1('0x28')][_0x58d1('0x42')](_0x3425a4)[_0x58d1('0x21')](handleEntityNotFound(_0x12c04a,null))[_0x58d1('0x21')](respondWithResult(_0x12c04a,null))['catch'](handleError(_0x12c04a,null));};exports['create']=function(_0x438263,_0x2add62){return db[_0x58d1('0x28')]['create'](_0x438263['body'],{})[_0x58d1('0x21')](respondWithResult(_0x2add62,0xc9))[_0x58d1('0x43')](handleError(_0x2add62,null));};exports[_0x58d1('0x1f')]=function(_0x22e401,_0x29d4e6){if(_0x22e401['body']['id']){delete _0x22e401[_0x58d1('0x44')]['id'];}return db[_0x58d1('0x28')][_0x58d1('0x42')]({'where':{'id':_0x22e401['params']['id']}})[_0x58d1('0x21')](handleEntityNotFound(_0x29d4e6,null))[_0x58d1('0x21')](saveUpdates(_0x22e401[_0x58d1('0x44')],null))['then'](respondWithResult(_0x29d4e6,null))[_0x58d1('0x43')](handleError(_0x29d4e6,null));};exports[_0x58d1('0x20')]=function(_0x4f072f,_0x240996){return db[_0x58d1('0x28')][_0x58d1('0x42')]({'where':{'id':_0x4f072f[_0x58d1('0x3e')]['id']}})[_0x58d1('0x21')](handleEntityNotFound(_0x240996,null))['then'](removeEntity(_0x240996,null))[_0x58d1('0x43')](handleError(_0x240996,null));}; \ No newline at end of file +var _0x8d77=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','MailServerOut','findAll','rows','catch','params','keys','include','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x8d77,0x150));var _0x78d7=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x8d77[_0xb0f7c3];return _0x28ea68;};'use strict';var emlformat=require(_0x78d7('0x0'));var rimraf=require(_0x78d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78d7('0x2'));var rp=require(_0x78d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x78d7('0x4'));var util=require(_0x78d7('0x5'));var path=require('path');var sox=require(_0x78d7('0x6'));var csv=require(_0x78d7('0x7'));var ejs=require(_0x78d7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x78d7('0x9'));var crypto=require(_0x78d7('0xa'));var jsforce=require(_0x78d7('0xb'));var deskjs=require(_0x78d7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x78d7('0xd'));var Papa=require(_0x78d7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x78d7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78d7('0x10'))(_0x78d7('0x11'));var utils=require(_0x78d7('0x12'));var config=require(_0x78d7('0x13'));var licenseUtil=require(_0x78d7('0x14'));var db=require(_0x78d7('0x15'))['db'];function respondWithStatusCode(_0x3fc77f,_0x3f8ded){_0x3f8ded=_0x3f8ded||0xcc;return function(_0x4a93ed){if(_0x4a93ed){return _0x3fc77f[_0x78d7('0x16')](_0x3f8ded);}return _0x3fc77f[_0x78d7('0x17')](_0x3f8ded)[_0x78d7('0x18')]();};}function respondWithResult(_0x49bf85,_0x46eb6a){_0x46eb6a=_0x46eb6a||0xc8;return function(_0x265a74){if(_0x265a74){return _0x49bf85[_0x78d7('0x17')](_0x46eb6a)[_0x78d7('0x19')](_0x265a74);}};}function respondWithFilteredResult(_0x2b7c6a,_0x3ac0c7){return function(_0x1408bc){if(_0x1408bc){var _0x3c4092=typeof _0x3ac0c7[_0x78d7('0x1a')]==='undefined'&&typeof _0x3ac0c7[_0x78d7('0x1b')]===_0x78d7('0x1c');var _0x7fdfd1=_0x1408bc[_0x78d7('0x1d')];var _0x1bed9b=_0x3c4092?0x0:_0x3ac0c7[_0x78d7('0x1a')];var _0x196d30=_0x3c4092?_0x1408bc[_0x78d7('0x1d')]:_0x3ac0c7[_0x78d7('0x1a')]+_0x3ac0c7[_0x78d7('0x1b')];var _0x4c2374;if(_0x196d30>=_0x7fdfd1){_0x196d30=_0x7fdfd1;_0x4c2374=0xc8;}else{_0x4c2374=0xce;}_0x2b7c6a[_0x78d7('0x17')](_0x4c2374);return _0x2b7c6a[_0x78d7('0x1e')](_0x78d7('0x1f'),_0x1bed9b+'-'+_0x196d30+'/'+_0x7fdfd1)['json'](_0x1408bc);}return null;};}function patchUpdates(_0x56cabe){return function(_0x212ca9){try{jsonpatch['apply'](_0x212ca9,_0x56cabe,!![]);}catch(_0x21654a){return BPromise[_0x78d7('0x20')](_0x21654a);}return _0x212ca9['save']();};}function saveUpdates(_0x100cea,_0x156c96){return function(_0x3bb5dc){if(_0x3bb5dc){return _0x3bb5dc['update'](_0x100cea)[_0x78d7('0x21')](function(_0x631562){return _0x631562;});}return null;};}function removeEntity(_0x11cfdd,_0x270fec){return function(_0x48c90b){if(_0x48c90b){return _0x48c90b[_0x78d7('0x22')]()['then'](function(){_0x11cfdd['status'](0xcc)[_0x78d7('0x18')]();});}};}function handleEntityNotFound(_0x18ad6e,_0x2ce580){return function(_0x5fc8c1){if(!_0x5fc8c1){_0x18ad6e[_0x78d7('0x16')](0x194);}return _0x5fc8c1;};}function handleError(_0x407ae4,_0x23c66b){_0x23c66b=_0x23c66b||0x1f4;return function(_0x4e8a3f){logger[_0x78d7('0x23')](_0x4e8a3f['stack']);if(_0x4e8a3f[_0x78d7('0x24')]){delete _0x4e8a3f[_0x78d7('0x24')];}_0x407ae4[_0x78d7('0x17')](_0x23c66b)['send'](_0x4e8a3f);};}exports[_0x78d7('0x25')]=function(_0x508ceb,_0x4a8216){var _0x90b750={},_0x109432={},_0x122f6f={'count':0x0,'rows':[]};var _0x1b1e17=_[_0x78d7('0x26')](db['MailServerOut'][_0x78d7('0x27')],function(_0x29d154){return{'name':_0x29d154[_0x78d7('0x28')],'type':_0x29d154[_0x78d7('0x29')][_0x78d7('0x2a')]};});_0x109432[_0x78d7('0x2b')]=_['map'](_0x1b1e17,_0x78d7('0x24'));_0x109432[_0x78d7('0x2c')]=_['keys'](_0x508ceb[_0x78d7('0x2c')]);_0x109432['filters']=_[_0x78d7('0x2d')](_0x109432['model'],_0x109432[_0x78d7('0x2c')]);_0x90b750[_0x78d7('0x2e')]=_[_0x78d7('0x2d')](_0x109432[_0x78d7('0x2b')],qs[_0x78d7('0x2f')](_0x508ceb[_0x78d7('0x2c')][_0x78d7('0x2f')]));_0x90b750[_0x78d7('0x2e')]=_0x90b750[_0x78d7('0x2e')][_0x78d7('0x30')]?_0x90b750[_0x78d7('0x2e')]:_0x109432[_0x78d7('0x2b')];if(!_0x508ceb[_0x78d7('0x2c')]['hasOwnProperty'](_0x78d7('0x31'))){_0x90b750['limit']=qs['limit'](_0x508ceb['query']['limit']);_0x90b750['offset']=qs[_0x78d7('0x1a')](_0x508ceb[_0x78d7('0x2c')][_0x78d7('0x1a')]);}_0x90b750[_0x78d7('0x32')]=qs[_0x78d7('0x33')](_0x508ceb[_0x78d7('0x2c')]['sort']);_0x90b750[_0x78d7('0x34')]=qs[_0x78d7('0x35')](_[_0x78d7('0x36')](_0x508ceb['query'],_0x109432[_0x78d7('0x35')]),_0x1b1e17);if(_0x508ceb[_0x78d7('0x2c')][_0x78d7('0x37')]){_0x90b750[_0x78d7('0x34')]=_[_0x78d7('0x38')](_0x90b750['where'],{'$or':_[_0x78d7('0x26')](_0x1b1e17,function(_0x53e39e){if(_0x53e39e[_0x78d7('0x29')]!==_0x78d7('0x39')){var _0x215249={};_0x215249[_0x53e39e[_0x78d7('0x24')]]={'$like':'%'+_0x508ceb[_0x78d7('0x2c')][_0x78d7('0x37')]+'%'};return _0x215249;}})});}_0x90b750=_[_0x78d7('0x38')]({},_0x90b750,_0x508ceb[_0x78d7('0x3a')]);var _0x38ea9f={'where':_0x90b750[_0x78d7('0x34')]};return db['MailServerOut']['count'](_0x38ea9f)[_0x78d7('0x21')](function(_0xc31ffa){_0x122f6f[_0x78d7('0x1d')]=_0xc31ffa;if(_0x508ceb[_0x78d7('0x2c')][_0x78d7('0x3b')]){_0x90b750['include']=[{'all':!![]}];}return db[_0x78d7('0x3c')][_0x78d7('0x3d')](_0x90b750);})[_0x78d7('0x21')](function(_0x954139){_0x122f6f[_0x78d7('0x3e')]=_0x954139;return _0x122f6f;})[_0x78d7('0x21')](respondWithFilteredResult(_0x4a8216,_0x90b750))[_0x78d7('0x3f')](handleError(_0x4a8216,null));};exports['show']=function(_0x522113,_0x2bfeea){var _0x50e66f={'raw':!![],'where':{'id':_0x522113[_0x78d7('0x40')]['id']}},_0x57ec6b={};_0x57ec6b['model']=_[_0x78d7('0x41')](db[_0x78d7('0x3c')]['rawAttributes']);_0x57ec6b[_0x78d7('0x2c')]=_['keys'](_0x522113[_0x78d7('0x2c')]);_0x57ec6b[_0x78d7('0x35')]=_[_0x78d7('0x2d')](_0x57ec6b[_0x78d7('0x2b')],_0x57ec6b[_0x78d7('0x2c')]);_0x50e66f[_0x78d7('0x2e')]=_[_0x78d7('0x2d')](_0x57ec6b['model'],qs[_0x78d7('0x2f')](_0x522113[_0x78d7('0x2c')][_0x78d7('0x2f')]));_0x50e66f[_0x78d7('0x2e')]=_0x50e66f[_0x78d7('0x2e')][_0x78d7('0x30')]?_0x50e66f['attributes']:_0x57ec6b[_0x78d7('0x2b')];if(_0x522113[_0x78d7('0x2c')][_0x78d7('0x3b')]){_0x50e66f[_0x78d7('0x42')]=[{'all':!![]}];}_0x50e66f=_[_0x78d7('0x38')]({},_0x50e66f,_0x522113[_0x78d7('0x3a')]);return db['MailServerOut'][_0x78d7('0x43')](_0x50e66f)[_0x78d7('0x21')](handleEntityNotFound(_0x2bfeea,null))[_0x78d7('0x21')](respondWithResult(_0x2bfeea,null))['catch'](handleError(_0x2bfeea,null));};exports[_0x78d7('0x44')]=function(_0x3b8744,_0x98c7ad){return db[_0x78d7('0x3c')]['create'](_0x3b8744[_0x78d7('0x45')],{})['then'](respondWithResult(_0x98c7ad,0xc9))[_0x78d7('0x3f')](handleError(_0x98c7ad,null));};exports[_0x78d7('0x46')]=function(_0xb7fedc,_0x475728){if(_0xb7fedc[_0x78d7('0x45')]['id']){delete _0xb7fedc[_0x78d7('0x45')]['id'];}return db['MailServerOut'][_0x78d7('0x43')]({'where':{'id':_0xb7fedc[_0x78d7('0x40')]['id']}})[_0x78d7('0x21')](handleEntityNotFound(_0x475728,null))[_0x78d7('0x21')](saveUpdates(_0xb7fedc[_0x78d7('0x45')],null))['then'](respondWithResult(_0x475728,null))[_0x78d7('0x3f')](handleError(_0x475728,null));};exports['destroy']=function(_0x1f5d00,_0x4fb7eb){return db[_0x78d7('0x3c')][_0x78d7('0x43')]({'where':{'id':_0x1f5d00['params']['id']}})[_0x78d7('0x21')](handleEntityNotFound(_0x4fb7eb,null))[_0x78d7('0x21')](removeEntity(_0x4fb7eb,null))[_0x78d7('0x3f')](handleError(_0x4fb7eb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1e3a6d4..228e2c4 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 _0xd11a=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','util','api','moment','bluebird','request-promise'];(function(_0x1e4177,_0x26a73a){var _0xa6e76c=function(_0x3a422e){while(--_0x3a422e){_0x1e4177['push'](_0x1e4177['shift']());}};_0xa6e76c(++_0x26a73a);}(_0xd11a,0xeb));var _0xad11=function(_0x182ccd,_0x431919){_0x182ccd=_0x182ccd-0x0;var _0x14dae1=_0xd11a[_0x182ccd];return _0x14dae1;};'use strict';var _=require('lodash');var util=require(_0xad11('0x0'));var logger=require('../../config/logger')(_0xad11('0x1'));var moment=require(_0xad11('0x2'));var BPromise=require(_0xad11('0x3'));var rp=require(_0xad11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad11('0x5'));var config=require(_0xad11('0x6'));var attributes=require(_0xad11('0x7'));module[_0xad11('0x8')]=function(_0x1880fd,_0x30c483){return _0x1880fd[_0xad11('0x9')](_0xad11('0xa'),attributes,{'tableName':_0xad11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x433f=['rimraf','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','api','moment','bluebird','request-promise'];(function(_0xcf8432,_0xa5556a){var _0x3b5f02=function(_0x4c1059){while(--_0x4c1059){_0xcf8432['push'](_0xcf8432['shift']());}};_0x3b5f02(++_0xa5556a);}(_0x433f,0x19c));var _0xf433=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x433f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xf433('0x0'));var util=require(_0xf433('0x1'));var logger=require('../../config/logger')(_0xf433('0x2'));var moment=require(_0xf433('0x3'));var BPromise=require(_0xf433('0x4'));var rp=require(_0xf433('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf433('0x6'));var config=require('../../config/environment');var attributes=require(_0xf433('0x7'));module[_0xf433('0x8')]=function(_0x6fa0f5,_0x29fe32){return _0x6fa0f5[_0xf433('0x9')]('MailServerOut',attributes,{'tableName':_0xf433('0xa'),'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 6319c0a..1ff66e0 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x408bd4,_0x102be0){var _0x45e311=function(_0x1bbe35){while(--_0x1bbe35){_0x408bd4['push'](_0x408bd4['shift']());}};_0x45e311(++_0x102be0);}(_0xdb28,0x106));var _0x8db2=function(_0x46a5bb,_0x5215b9){_0x46a5bb=_0x46a5bb-0x0;var _0x4bf06b=_0xdb28[_0x46a5bb];return _0x4bf06b;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x26322d,_0x1c18de){var _0x263139=function(_0x480fcd){while(--_0x480fcd){_0x26322d['push'](_0x26322d['shift']());}};_0x263139(++_0x1c18de);}(_0xdb28,0x106));var _0x8db2=function(_0x5c629e,_0xd6ce98){_0x5c629e=_0x5c629e-0x0;var _0x1dd6ec=_0xdb28[_0x5c629e];return _0x1dd6ec;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index dc9ce48..46cf197 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 _0x4019=['destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','describe','show','post','put','update','delete','/:id'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0x4019,0x151));var _0x9401=function(_0x15c1dd,_0x2d1834){_0x15c1dd=_0x15c1dd-0x0;var _0x22f7b4=_0x4019[_0x15c1dd];return _0x22f7b4;};'use strict';var multer=require(_0x9401('0x0'));var util=require(_0x9401('0x1'));var path=require(_0x9401('0x2'));var timeout=require('connect-timeout');var express=require(_0x9401('0x3'));var router=express[_0x9401('0x4')]();var fs_extra=require(_0x9401('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9401('0x6'));var config=require(_0x9401('0x7'));var controller=require(_0x9401('0x8'));router[_0x9401('0x9')]('/',auth['isAuthenticated'](),controller[_0x9401('0xa')]);router[_0x9401('0x9')](_0x9401('0xb'),auth[_0x9401('0xc')](),controller[_0x9401('0xd')]);router[_0x9401('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9401('0xe')]);router[_0x9401('0xf')]('/',auth[_0x9401('0xc')](),controller['create']);router[_0x9401('0x10')]('/:id',auth[_0x9401('0xc')](),controller[_0x9401('0x11')]);router[_0x9401('0x12')](_0x9401('0x13'),auth[_0x9401('0xc')](),controller[_0x9401('0x14')]);module['exports']=router; \ No newline at end of file +var _0x409d=['describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe'];(function(_0x1c416d,_0x33927b){var _0x437296=function(_0x2e1ec3){while(--_0x2e1ec3){_0x1c416d['push'](_0x1c416d['shift']());}};_0x437296(++_0x33927b);}(_0x409d,0x9d));var _0xd409=function(_0x156210,_0x4b451b){_0x156210=_0x156210-0x0;var _0x58ab4f=_0x409d[_0x156210];return _0x58ab4f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd409('0x0'));var timeout=require(_0xd409('0x1'));var express=require(_0xd409('0x2'));var router=express[_0xd409('0x3')]();var fs_extra=require(_0xd409('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd409('0x5'));var config=require(_0xd409('0x6'));var controller=require(_0xd409('0x7'));router[_0xd409('0x8')]('/',auth['isAuthenticated'](),controller[_0xd409('0x9')]);router[_0xd409('0x8')](_0xd409('0xa'),auth['isAuthenticated'](),controller[_0xd409('0xb')]);router['get'](_0xd409('0xc'),auth[_0xd409('0xd')](),controller[_0xd409('0xe')]);router[_0xd409('0xf')]('/',auth[_0xd409('0xd')](),controller[_0xd409('0x10')]);router[_0xd409('0x11')](_0xd409('0xc'),auth[_0xd409('0xd')](),controller[_0xd409('0x12')]);router[_0xd409('0x13')](_0xd409('0xc'),auth['isAuthenticated'](),controller[_0xd409('0x14')]);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 2d30ae0..34c3e9f 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 _0x0a6b=['sequelize','STRING'];(function(_0x57d7df,_0x3842ee){var _0x2884a4=function(_0x441227){while(--_0x441227){_0x57d7df['push'](_0x57d7df['shift']());}};_0x2884a4(++_0x3842ee);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x408d5e,_0x27e654){_0x408d5e=_0x408d5e-0x0;var _0x577cf7=_0x0a6b[_0x408d5e];return _0x577cf7;};'use strict';var Sequelize=require(_0xb0a6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb0a6('0x1')]}}; \ No newline at end of file +var _0x5f6f=['exports','STRING','name','sequelize'];(function(_0x49552e,_0x370ce2){var _0x2559f9=function(_0xd9c170){while(--_0xd9c170){_0x49552e['push'](_0x49552e['shift']());}};_0x2559f9(++_0x370ce2);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x215442,_0x5d2a14){_0x215442=_0x215442-0x0;var _0x342ec6=_0x5f6f[_0x215442];return _0x342ec6;};'use strict';var Sequelize=require(_0xf5f6('0x0'));module[_0xf5f6('0x1')]={'name':{'type':Sequelize[_0xf5f6('0x2')],'unique':_0xf5f6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 75ea374..678ced2 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 _0x32f4=['Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32f4,0x158));var _0x432f=function(_0x4db474,_0x2e74de){_0x4db474=_0x4db474-0x0;var _0x22520=_0x32f4[_0x4db474];return _0x22520;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x432f('0x2'));var rp=require('request-promise');var moment=require(_0x432f('0x3'));var BPromise=require(_0x432f('0x4'));var Mustache=require('mustache');var util=require(_0x432f('0x5'));var path=require(_0x432f('0x6'));var sox=require('sox');var csv=require(_0x432f('0x7'));var ejs=require(_0x432f('0x8'));var fs=require('fs');var fs_extra=require(_0x432f('0x9'));var _=require(_0x432f('0xa'));var squel=require('squel');var crypto=require(_0x432f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xc'));var toCsv=require(_0x432f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x432f('0xd'));var qs=require(_0x432f('0xe'));var as=require(_0x432f('0xf'));var hardwareService=require(_0x432f('0x10'));var logger=require(_0x432f('0x11'))('api');var utils=require(_0x432f('0x12'));var config=require(_0x432f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x432f('0x14'))['db'];function respondWithStatusCode(_0x58a904,_0x53612e){_0x53612e=_0x53612e||0xcc;return function(_0x2ede8e){if(_0x2ede8e){return _0x58a904[_0x432f('0x15')](_0x53612e);}return _0x58a904[_0x432f('0x16')](_0x53612e)['end']();};}function respondWithResult(_0x4bb271,_0x39d1e4){_0x39d1e4=_0x39d1e4||0xc8;return function(_0x10418e){if(_0x10418e){return _0x4bb271[_0x432f('0x16')](_0x39d1e4)['json'](_0x10418e);}};}function respondWithFilteredResult(_0x40b1ce,_0x5d4abd){return function(_0x331a22){if(_0x331a22){var _0x804151=typeof _0x5d4abd['offset']===_0x432f('0x17')&&typeof _0x5d4abd['limit']==='undefined';var _0x504c6b=_0x331a22[_0x432f('0x18')];var _0xda18bb=_0x804151?0x0:_0x5d4abd[_0x432f('0x19')];var _0x2b28cd=_0x804151?_0x331a22['count']:_0x5d4abd[_0x432f('0x19')]+_0x5d4abd['limit'];var _0xe3adab;if(_0x2b28cd>=_0x504c6b){_0x2b28cd=_0x504c6b;_0xe3adab=0xc8;}else{_0xe3adab=0xce;}_0x40b1ce['status'](_0xe3adab);return _0x40b1ce['set'](_0x432f('0x1a'),_0xda18bb+'-'+_0x2b28cd+'/'+_0x504c6b)[_0x432f('0x1b')](_0x331a22);}return null;};}function patchUpdates(_0x4728f1){return function(_0x11f8eb){try{jsonpatch[_0x432f('0x1c')](_0x11f8eb,_0x4728f1,!![]);}catch(_0x2081e0){return BPromise[_0x432f('0x1d')](_0x2081e0);}return _0x11f8eb[_0x432f('0x1e')]();};}function saveUpdates(_0x218fb9,_0x34672a){return function(_0x373e73){if(_0x373e73){return _0x373e73[_0x432f('0x1f')](_0x218fb9)[_0x432f('0x20')](function(_0x36be35){return _0x36be35;});}return null;};}function removeEntity(_0x3d5373,_0x2dcc4d){return function(_0x580c0b){if(_0x580c0b){return _0x580c0b[_0x432f('0x21')]()[_0x432f('0x20')](function(){_0x3d5373[_0x432f('0x16')](0xcc)[_0x432f('0x22')]();});}};}function handleEntityNotFound(_0x45f274,_0x48063d){return function(_0x2927e6){if(!_0x2927e6){_0x45f274[_0x432f('0x15')](0x194);}return _0x2927e6;};}function handleError(_0x93607e,_0x48c2b6){_0x48c2b6=_0x48c2b6||0x1f4;return function(_0x1daf38){logger[_0x432f('0x23')](_0x1daf38[_0x432f('0x24')]);if(_0x1daf38['name']){delete _0x1daf38[_0x432f('0x25')];}_0x93607e[_0x432f('0x16')](_0x48c2b6)[_0x432f('0x26')](_0x1daf38);};}exports[_0x432f('0x27')]=function(_0x3071c9,_0x2bdaa3){var _0x5dfa8c={},_0x474047={},_0x149dc6={'count':0x0,'rows':[]};var _0x31e1e4=_[_0x432f('0x28')](db[_0x432f('0x29')][_0x432f('0x2a')],function(_0xa8d507){return{'name':_0xa8d507[_0x432f('0x2b')],'type':_0xa8d507['type'][_0x432f('0x2c')]};});_0x474047[_0x432f('0x2d')]=_[_0x432f('0x28')](_0x31e1e4,_0x432f('0x25'));_0x474047['query']=_[_0x432f('0x2e')](_0x3071c9[_0x432f('0x2f')]);_0x474047[_0x432f('0x30')]=_[_0x432f('0x31')](_0x474047['model'],_0x474047[_0x432f('0x2f')]);_0x5dfa8c[_0x432f('0x32')]=_[_0x432f('0x31')](_0x474047['model'],qs[_0x432f('0x33')](_0x3071c9[_0x432f('0x2f')]['fields']));_0x5dfa8c[_0x432f('0x32')]=_0x5dfa8c[_0x432f('0x32')]['length']?_0x5dfa8c[_0x432f('0x32')]:_0x474047[_0x432f('0x2d')];if(!_0x3071c9[_0x432f('0x2f')][_0x432f('0x34')](_0x432f('0x35'))){_0x5dfa8c[_0x432f('0x36')]=qs[_0x432f('0x36')](_0x3071c9['query']['limit']);_0x5dfa8c[_0x432f('0x19')]=qs['offset'](_0x3071c9[_0x432f('0x2f')][_0x432f('0x19')]);}_0x5dfa8c[_0x432f('0x37')]=qs[_0x432f('0x38')](_0x3071c9['query'][_0x432f('0x38')]);_0x5dfa8c['where']=qs[_0x432f('0x30')](_[_0x432f('0x39')](_0x3071c9[_0x432f('0x2f')],_0x474047[_0x432f('0x30')]),_0x31e1e4);if(_0x3071c9[_0x432f('0x2f')]['filter']){_0x5dfa8c[_0x432f('0x3a')]=_[_0x432f('0x3b')](_0x5dfa8c[_0x432f('0x3a')],{'$or':_['map'](_0x31e1e4,function(_0x28ee2e){if(_0x28ee2e[_0x432f('0x3c')]!==_0x432f('0x3d')){var _0x17ad59={};_0x17ad59[_0x28ee2e[_0x432f('0x25')]]={'$like':'%'+_0x3071c9[_0x432f('0x2f')][_0x432f('0x3e')]+'%'};return _0x17ad59;}})});}_0x5dfa8c=_[_0x432f('0x3b')]({},_0x5dfa8c,_0x3071c9[_0x432f('0x3f')]);var _0x3b81f3={'where':_0x5dfa8c[_0x432f('0x3a')]};return db[_0x432f('0x29')][_0x432f('0x18')](_0x3b81f3)[_0x432f('0x20')](function(_0xdaa7af){_0x149dc6[_0x432f('0x18')]=_0xdaa7af;if(_0x3071c9[_0x432f('0x2f')][_0x432f('0x40')]){_0x5dfa8c[_0x432f('0x41')]=[{'all':!![]}];}return db[_0x432f('0x29')][_0x432f('0x42')](_0x5dfa8c);})[_0x432f('0x20')](function(_0x53cd41){_0x149dc6[_0x432f('0x43')]=_0x53cd41;return _0x149dc6;})[_0x432f('0x20')](respondWithFilteredResult(_0x2bdaa3,_0x5dfa8c))['catch'](handleError(_0x2bdaa3,null));};exports['show']=function(_0x4af547,_0x1a4cf3){var _0x1887cb={'raw':!![],'where':{'id':_0x4af547[_0x432f('0x44')]['id']}},_0x2a0bcd={};_0x2a0bcd['model']=_['keys'](db['MailSubstatus'][_0x432f('0x2a')]);_0x2a0bcd[_0x432f('0x2f')]=_[_0x432f('0x2e')](_0x4af547[_0x432f('0x2f')]);_0x2a0bcd['filters']=_[_0x432f('0x31')](_0x2a0bcd[_0x432f('0x2d')],_0x2a0bcd[_0x432f('0x2f')]);_0x1887cb[_0x432f('0x32')]=_[_0x432f('0x31')](_0x2a0bcd[_0x432f('0x2d')],qs['fields'](_0x4af547[_0x432f('0x2f')][_0x432f('0x33')]));_0x1887cb[_0x432f('0x32')]=_0x1887cb[_0x432f('0x32')][_0x432f('0x45')]?_0x1887cb[_0x432f('0x32')]:_0x2a0bcd['model'];if(_0x4af547['query'][_0x432f('0x40')]){_0x1887cb['include']=[{'all':!![]}];}_0x1887cb=_[_0x432f('0x3b')]({},_0x1887cb,_0x4af547[_0x432f('0x3f')]);return db[_0x432f('0x29')][_0x432f('0x46')](_0x1887cb)['then'](handleEntityNotFound(_0x1a4cf3,null))[_0x432f('0x20')](respondWithResult(_0x1a4cf3,null))[_0x432f('0x47')](handleError(_0x1a4cf3,null));};exports[_0x432f('0x48')]=function(_0x36d433,_0xda65b8){return db[_0x432f('0x29')][_0x432f('0x48')](_0x36d433[_0x432f('0x49')],{})[_0x432f('0x20')](respondWithResult(_0xda65b8,0xc9))['catch'](handleError(_0xda65b8,null));};exports[_0x432f('0x1f')]=function(_0x1b3fe8,_0x5b16a8){if(_0x1b3fe8[_0x432f('0x49')]['id']){delete _0x1b3fe8[_0x432f('0x49')]['id'];}return db['MailSubstatus'][_0x432f('0x46')]({'where':{'id':_0x1b3fe8[_0x432f('0x44')]['id']}})[_0x432f('0x20')](handleEntityNotFound(_0x5b16a8,null))[_0x432f('0x20')](saveUpdates(_0x1b3fe8['body'],null))[_0x432f('0x20')](respondWithResult(_0x5b16a8,null))[_0x432f('0x47')](handleError(_0x5b16a8,null));};exports[_0x432f('0x21')]=function(_0x531cc5,_0x193fe1){return db[_0x432f('0x29')][_0x432f('0x46')]({'where':{'id':_0x531cc5['params']['id']}})[_0x432f('0x20')](handleEntityNotFound(_0x193fe1,null))[_0x432f('0x20')](removeEntity(_0x193fe1,null))[_0x432f('0x47')](handleError(_0x193fe1,null));};exports['describe']=function(_0x1eb17f,_0x482d1f){return db[_0x432f('0x29')]['describe']()[_0x432f('0x20')](respondWithResult(_0x482d1f,null))[_0x432f('0x47')](handleError(_0x482d1f,null));}; \ No newline at end of file +var _0x85ac=['attributes','intersection','fields','length','sort','where','filters','pick','filter','merge','options','MailSubstatus','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','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','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x85ac,0x133));var _0xc85a=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x85ac[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0xc85a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc85a('0x1'));var BPromise=require(_0xc85a('0x2'));var Mustache=require(_0xc85a('0x3'));var util=require('util');var path=require(_0xc85a('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc85a('0x5'));var _=require(_0xc85a('0x6'));var squel=require(_0xc85a('0x7'));var crypto=require(_0xc85a('0x8'));var jsforce=require(_0xc85a('0x9'));var deskjs=require(_0xc85a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc85a('0xb'));var Papa=require('papaparse');var Redis=require(_0xc85a('0xc'));var authService=require(_0xc85a('0xd'));var qs=require(_0xc85a('0xe'));var as=require(_0xc85a('0xf'));var hardwareService=require(_0xc85a('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xc85a('0x11'));var config=require(_0xc85a('0x12'));var licenseUtil=require(_0xc85a('0x13'));var db=require(_0xc85a('0x14'))['db'];function respondWithStatusCode(_0x4c2f65,_0x3e781c){_0x3e781c=_0x3e781c||0xcc;return function(_0x5cbbc9){if(_0x5cbbc9){return _0x4c2f65[_0xc85a('0x15')](_0x3e781c);}return _0x4c2f65['status'](_0x3e781c)[_0xc85a('0x16')]();};}function respondWithResult(_0x195860,_0x1f4bb8){_0x1f4bb8=_0x1f4bb8||0xc8;return function(_0x1c569d){if(_0x1c569d){return _0x195860[_0xc85a('0x17')](_0x1f4bb8)[_0xc85a('0x18')](_0x1c569d);}};}function respondWithFilteredResult(_0x583988,_0x3aaff3){return function(_0x2606ed){if(_0x2606ed){var _0x2f9091=typeof _0x3aaff3['offset']===_0xc85a('0x19')&&typeof _0x3aaff3['limit']===_0xc85a('0x19');var _0x5cc235=_0x2606ed[_0xc85a('0x1a')];var _0x5e6baf=_0x2f9091?0x0:_0x3aaff3[_0xc85a('0x1b')];var _0x39135f=_0x2f9091?_0x2606ed[_0xc85a('0x1a')]:_0x3aaff3[_0xc85a('0x1b')]+_0x3aaff3[_0xc85a('0x1c')];var _0x475ba4;if(_0x39135f>=_0x5cc235){_0x39135f=_0x5cc235;_0x475ba4=0xc8;}else{_0x475ba4=0xce;}_0x583988[_0xc85a('0x17')](_0x475ba4);return _0x583988[_0xc85a('0x1d')](_0xc85a('0x1e'),_0x5e6baf+'-'+_0x39135f+'/'+_0x5cc235)[_0xc85a('0x18')](_0x2606ed);}return null;};}function patchUpdates(_0x17d8b6){return function(_0x3a0145){try{jsonpatch[_0xc85a('0x1f')](_0x3a0145,_0x17d8b6,!![]);}catch(_0x421dfc){return BPromise[_0xc85a('0x20')](_0x421dfc);}return _0x3a0145[_0xc85a('0x21')]();};}function saveUpdates(_0xbc03ad,_0x5efab4){return function(_0x1534da){if(_0x1534da){return _0x1534da['update'](_0xbc03ad)['then'](function(_0xc495f0){return _0xc495f0;});}return null;};}function removeEntity(_0x221cf3,_0x15544e){return function(_0x20cc0e){if(_0x20cc0e){return _0x20cc0e[_0xc85a('0x22')]()[_0xc85a('0x23')](function(){_0x221cf3['status'](0xcc)[_0xc85a('0x16')]();});}};}function handleEntityNotFound(_0x280dde,_0x4bd098){return function(_0x574b38){if(!_0x574b38){_0x280dde[_0xc85a('0x15')](0x194);}return _0x574b38;};}function handleError(_0x3b1c91,_0x33123c){_0x33123c=_0x33123c||0x1f4;return function(_0x105d3c){logger[_0xc85a('0x24')](_0x105d3c[_0xc85a('0x25')]);if(_0x105d3c[_0xc85a('0x26')]){delete _0x105d3c[_0xc85a('0x26')];}_0x3b1c91[_0xc85a('0x17')](_0x33123c)[_0xc85a('0x27')](_0x105d3c);};}exports['index']=function(_0x4204a8,_0x5ad27e){var _0x959067={},_0x1e2be0={},_0x296e8b={'count':0x0,'rows':[]};var _0x32cb31=_[_0xc85a('0x28')](db['MailSubstatus'][_0xc85a('0x29')],function(_0x5c87c7){return{'name':_0x5c87c7[_0xc85a('0x2a')],'type':_0x5c87c7[_0xc85a('0x2b')][_0xc85a('0x2c')]};});_0x1e2be0[_0xc85a('0x2d')]=_[_0xc85a('0x28')](_0x32cb31,_0xc85a('0x26'));_0x1e2be0[_0xc85a('0x2e')]=_[_0xc85a('0x2f')](_0x4204a8[_0xc85a('0x2e')]);_0x1e2be0['filters']=_['intersection'](_0x1e2be0['model'],_0x1e2be0[_0xc85a('0x2e')]);_0x959067[_0xc85a('0x30')]=_[_0xc85a('0x31')](_0x1e2be0[_0xc85a('0x2d')],qs[_0xc85a('0x32')](_0x4204a8[_0xc85a('0x2e')]['fields']));_0x959067[_0xc85a('0x30')]=_0x959067[_0xc85a('0x30')][_0xc85a('0x33')]?_0x959067[_0xc85a('0x30')]:_0x1e2be0[_0xc85a('0x2d')];if(!_0x4204a8[_0xc85a('0x2e')]['hasOwnProperty']('nolimit')){_0x959067['limit']=qs[_0xc85a('0x1c')](_0x4204a8[_0xc85a('0x2e')][_0xc85a('0x1c')]);_0x959067[_0xc85a('0x1b')]=qs[_0xc85a('0x1b')](_0x4204a8['query'][_0xc85a('0x1b')]);}_0x959067['order']=qs[_0xc85a('0x34')](_0x4204a8['query']['sort']);_0x959067[_0xc85a('0x35')]=qs[_0xc85a('0x36')](_[_0xc85a('0x37')](_0x4204a8['query'],_0x1e2be0[_0xc85a('0x36')]),_0x32cb31);if(_0x4204a8[_0xc85a('0x2e')][_0xc85a('0x38')]){_0x959067['where']=_['merge'](_0x959067[_0xc85a('0x35')],{'$or':_[_0xc85a('0x28')](_0x32cb31,function(_0x1be702){if(_0x1be702[_0xc85a('0x2b')]!=='VIRTUAL'){var _0x36aa8c={};_0x36aa8c[_0x1be702[_0xc85a('0x26')]]={'$like':'%'+_0x4204a8[_0xc85a('0x2e')][_0xc85a('0x38')]+'%'};return _0x36aa8c;}})});}_0x959067=_[_0xc85a('0x39')]({},_0x959067,_0x4204a8[_0xc85a('0x3a')]);var _0x3b9b89={'where':_0x959067[_0xc85a('0x35')]};return db[_0xc85a('0x3b')]['count'](_0x3b9b89)[_0xc85a('0x23')](function(_0x35de3e){_0x296e8b[_0xc85a('0x1a')]=_0x35de3e;if(_0x4204a8[_0xc85a('0x2e')]['includeAll']){_0x959067[_0xc85a('0x3c')]=[{'all':!![]}];}return db[_0xc85a('0x3b')][_0xc85a('0x3d')](_0x959067);})[_0xc85a('0x23')](function(_0x5df80a){_0x296e8b[_0xc85a('0x3e')]=_0x5df80a;return _0x296e8b;})[_0xc85a('0x23')](respondWithFilteredResult(_0x5ad27e,_0x959067))['catch'](handleError(_0x5ad27e,null));};exports[_0xc85a('0x3f')]=function(_0x1c51ca,_0x1938cb){var _0x2ac945={'raw':!![],'where':{'id':_0x1c51ca[_0xc85a('0x40')]['id']}},_0x246115={};_0x246115['model']=_[_0xc85a('0x2f')](db[_0xc85a('0x3b')][_0xc85a('0x29')]);_0x246115[_0xc85a('0x2e')]=_[_0xc85a('0x2f')](_0x1c51ca[_0xc85a('0x2e')]);_0x246115[_0xc85a('0x36')]=_[_0xc85a('0x31')](_0x246115[_0xc85a('0x2d')],_0x246115[_0xc85a('0x2e')]);_0x2ac945[_0xc85a('0x30')]=_[_0xc85a('0x31')](_0x246115[_0xc85a('0x2d')],qs[_0xc85a('0x32')](_0x1c51ca[_0xc85a('0x2e')]['fields']));_0x2ac945[_0xc85a('0x30')]=_0x2ac945[_0xc85a('0x30')]['length']?_0x2ac945[_0xc85a('0x30')]:_0x246115[_0xc85a('0x2d')];if(_0x1c51ca[_0xc85a('0x2e')][_0xc85a('0x41')]){_0x2ac945[_0xc85a('0x3c')]=[{'all':!![]}];}_0x2ac945=_[_0xc85a('0x39')]({},_0x2ac945,_0x1c51ca[_0xc85a('0x3a')]);return db[_0xc85a('0x3b')][_0xc85a('0x42')](_0x2ac945)[_0xc85a('0x23')](handleEntityNotFound(_0x1938cb,null))[_0xc85a('0x23')](respondWithResult(_0x1938cb,null))[_0xc85a('0x43')](handleError(_0x1938cb,null));};exports[_0xc85a('0x44')]=function(_0x1e803d,_0x373e55){return db['MailSubstatus']['create'](_0x1e803d[_0xc85a('0x45')],{})[_0xc85a('0x23')](respondWithResult(_0x373e55,0xc9))['catch'](handleError(_0x373e55,null));};exports['update']=function(_0x3dc0b6,_0x3e66f1){if(_0x3dc0b6[_0xc85a('0x45')]['id']){delete _0x3dc0b6[_0xc85a('0x45')]['id'];}return db[_0xc85a('0x3b')][_0xc85a('0x42')]({'where':{'id':_0x3dc0b6[_0xc85a('0x40')]['id']}})[_0xc85a('0x23')](handleEntityNotFound(_0x3e66f1,null))[_0xc85a('0x23')](saveUpdates(_0x3dc0b6[_0xc85a('0x45')],null))[_0xc85a('0x23')](respondWithResult(_0x3e66f1,null))['catch'](handleError(_0x3e66f1,null));};exports[_0xc85a('0x22')]=function(_0x321b5e,_0x3d0d65){return db[_0xc85a('0x3b')][_0xc85a('0x42')]({'where':{'id':_0x321b5e[_0xc85a('0x40')]['id']}})[_0xc85a('0x23')](handleEntityNotFound(_0x3d0d65,null))[_0xc85a('0x23')](removeEntity(_0x3d0d65,null))[_0xc85a('0x43')](handleError(_0x3d0d65,null));};exports[_0xc85a('0x46')]=function(_0x39b7d5,_0x19426b){return db['MailSubstatus'][_0xc85a('0x46')]()[_0xc85a('0x23')](respondWithResult(_0x19426b,null))[_0xc85a('0x43')](handleError(_0x19426b,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 5bbbab3..72b23d8 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 _0x574d=['exports','../../mysqldb','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x28330e,_0x369b44){var _0x3b82dc=function(_0x32d658){while(--_0x32d658){_0x28330e['push'](_0x28330e['shift']());}};_0x3b82dc(++_0x369b44);}(_0x574d,0xd9));var _0xd574=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x574d[_0xa148b7];return _0x51efd3;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xd574('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xd574('0x1')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x120f20){return function(_0x4e36b3,_0xd87040,_0xcf4743){MailSubstatusEvents[_0xd574('0x2')](_0x120f20+':'+_0x4e36b3['id'],_0x4e36b3);MailSubstatusEvents[_0xd574('0x2')](_0x120f20,_0x4e36b3);_0xcf4743(null);};}for(var e in events){if(events[_0xd574('0x3')](e)){var event=events[e];MailSubstatus[_0xd574('0x4')](e,emitEvent(event));}}module[_0xd574('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x719a=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x719a,0x1c5));var _0xa719=function(_0x37d1e8,_0x2ea422){_0x37d1e8=_0x37d1e8-0x0;var _0x307f7a=_0x719a[_0x37d1e8];return _0x307f7a;};'use strict';var EventEmitter=require(_0xa719('0x0'));var MailSubstatus=require(_0xa719('0x1'))['db'][_0xa719('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa719('0x3')](0x0);var events={'afterUpdate':_0xa719('0x4')};function emitEvent(_0x26926a){return function(_0x4704d9,_0x5ca911,_0x4bd702){MailSubstatusEvents[_0xa719('0x5')](_0x26926a+':'+_0x4704d9['id'],_0x4704d9);MailSubstatusEvents['emit'](_0x26926a,_0x4704d9);_0x4bd702(null);};}for(var e in events){if(events[_0xa719('0x6')](e)){var event=events[e];MailSubstatus[_0xa719('0x7')](e,emitEvent(event));}}module[_0xa719('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index dd7875a..740c992 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 _0x1c01=['name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','define','Condition','update'];(function(_0x25d141,_0x54ba97){var _0x43ed43=function(_0xcaea62){while(--_0xcaea62){_0x25d141['push'](_0x25d141['shift']());}};_0x43ed43(++_0x54ba97);}(_0x1c01,0xf5));var _0x11c0=function(_0x287cee,_0x59479b){_0x287cee=_0x287cee-0x0;var _0x5cc740=_0x1c01[_0x287cee];return _0x5cc740;};'use strict';var attributes=require(_0x11c0('0x0'));module[_0x11c0('0x1')]=function(_0x5c3ea9){var _0x311659=_0x5c3ea9['models'];return _0x5c3ea9[_0x11c0('0x2')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x59e958,_0x519114,_0xa622f3){return _0x311659[_0x11c0('0x3')][_0x11c0('0x4')]({'value':_0x59e958[_0x11c0('0x5')]},{'where':{'field':_0x11c0('0x6'),'value':_0x59e958[_0x11c0('0x7')][_0x11c0('0x5')]}})[_0x11c0('0x8')](function(){_0xa622f3();})[_0x11c0('0x9')](function(_0x482ac2){_0xa622f3(_0x482ac2);});}}});}; \ No newline at end of file +var _0xd5ab=['mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','MailSubstatus','mail_substatuses','Condition','update','name'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xd5ab,0x14e));var _0xbd5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd5ab[_0x14add3];return _0x4a174f;};'use strict';var attributes=require(_0xbd5a('0x0'));module['exports']=function(_0x22c80e){var _0x310960=_0x22c80e[_0xbd5a('0x1')];return _0x22c80e['define'](_0xbd5a('0x2'),attributes,{'tableName':_0xbd5a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4c1b2e,_0x13ec6e,_0x417ddc){return _0x310960[_0xbd5a('0x4')][_0xbd5a('0x5')]({'value':_0x4c1b2e[_0xbd5a('0x6')]},{'where':{'field':_0xbd5a('0x7'),'value':_0x4c1b2e[_0xbd5a('0x8')]['name']}})[_0xbd5a('0x9')](function(){_0x417ddc();})[_0xbd5a('0xa')](function(_0x28dfc0){_0x417ddc(_0x28dfc0);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 517b739..bf6d32d 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 _0x1b88=['request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring','../../config/utils','rpc','jayson/promise','client'];(function(_0x50514b,_0x83db65){var _0x5d8587=function(_0x327ba5){while(--_0x327ba5){_0x50514b['push'](_0x50514b['shift']());}};_0x5d8587(++_0x83db65);}(_0x1b88,0x197));var _0x81b8=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x1b88[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x81b8('0x0'));var util=require(_0x81b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x81b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x81b8('0x3'));var logger=require('../../config/logger')(_0x81b8('0x4'));var config=require('../../config/environment');var jayson=require(_0x81b8('0x5'));var client=jayson[_0x81b8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea773,_0x5b3333,_0x1fe7d8){return new BPromise(function(_0x579eb1,_0x22ce72){return client[_0x81b8('0x7')](_0x2ea773,_0x1fe7d8)[_0x81b8('0x8')](function(_0x4e838a){logger[_0x81b8('0x9')](_0x81b8('0xa'),_0x5b3333,_0x81b8('0xb'));logger[_0x81b8('0xc')](_0x81b8('0xd'),_0x5b3333,_0x81b8('0xb'),JSON[_0x81b8('0xe')](_0x4e838a));if(_0x4e838a[_0x81b8('0xf')]){if(_0x4e838a[_0x81b8('0xf')]['code']===0x1f4){logger[_0x81b8('0xf')](_0x81b8('0xa'),_0x5b3333,_0x4e838a['error'][_0x81b8('0x10')]);return _0x22ce72(_0x4e838a['error'][_0x81b8('0x10')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5b3333,_0x4e838a[_0x81b8('0xf')][_0x81b8('0x10')]);return _0x579eb1(_0x4e838a['error'][_0x81b8('0x10')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x5b3333,_0x81b8('0xb'));_0x579eb1(_0x4e838a[_0x81b8('0x11')][_0x81b8('0x10')]);}})['catch'](function(_0x4f17bd){logger[_0x81b8('0xf')](_0x81b8('0xa'),_0x5b3333,_0x4f17bd);_0x22ce72(_0x4f17bd);});});} \ No newline at end of file +var _0xf0ea=['MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0xf0ea,0x11b));var _0xaf0e=function(_0x53c2a5,_0x5b47e0){_0x53c2a5=_0x53c2a5-0x0;var _0x419e23=_0xf0ea[_0x53c2a5];return _0x419e23;};'use strict';var _=require(_0xaf0e('0x0'));var util=require(_0xaf0e('0x1'));var moment=require('moment');var BPromise=require(_0xaf0e('0x2'));var rs=require(_0xaf0e('0x3'));var fs=require('fs');var Redis=require(_0xaf0e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaf0e('0x5'));var logger=require(_0xaf0e('0x6'))(_0xaf0e('0x7'));var config=require(_0xaf0e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaf0e('0x9')][_0xaf0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2db988,_0x36c8bf,_0x4b4bfb){return new BPromise(function(_0x2e2750,_0x36ee78){return client[_0xaf0e('0xb')](_0x2db988,_0x4b4bfb)[_0xaf0e('0xc')](function(_0x194b07){logger[_0xaf0e('0xd')](_0xaf0e('0xe'),_0x36c8bf,'request\x20sent');logger[_0xaf0e('0xf')](_0xaf0e('0x10'),_0x36c8bf,_0xaf0e('0x11'),JSON[_0xaf0e('0x12')](_0x194b07));if(_0x194b07[_0xaf0e('0x13')]){if(_0x194b07[_0xaf0e('0x13')][_0xaf0e('0x14')]===0x1f4){logger['error'](_0xaf0e('0xe'),_0x36c8bf,_0x194b07[_0xaf0e('0x13')][_0xaf0e('0x15')]);return _0x36ee78(_0x194b07[_0xaf0e('0x13')]['message']);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x36c8bf,_0x194b07['error'][_0xaf0e('0x15')]);return _0x2e2750(_0x194b07[_0xaf0e('0x13')]['message']);}else{logger['info'](_0xaf0e('0xe'),_0x36c8bf,_0xaf0e('0x11'));_0x2e2750(_0x194b07['result'][_0xaf0e('0x15')]);}})[_0xaf0e('0x16')](function(_0x39c1cc){logger[_0xaf0e('0x13')](_0xaf0e('0xe'),_0x36c8bf,_0x39c1cc);_0x36ee78(_0x39c1cc);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fb6b939..f5be992 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 _0x3f70=['isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe'];(function(_0x326ef5,_0xac958f){var _0x2c11e3=function(_0x598419){while(--_0x598419){_0x326ef5['push'](_0x326ef5['shift']());}};_0x2c11e3(++_0xac958f);}(_0x3f70,0x1d1));var _0x03f7=function(_0x3603ed,_0x37b1b1){_0x3603ed=_0x3603ed-0x0;var _0x35d333=_0x3f70[_0x3603ed];return _0x35d333;};'use strict';var multer=require(_0x03f7('0x0'));var util=require('util');var path=require(_0x03f7('0x1'));var timeout=require(_0x03f7('0x2'));var express=require(_0x03f7('0x3'));var router=express[_0x03f7('0x4')]();var fs_extra=require(_0x03f7('0x5'));var auth=require(_0x03f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x03f7('0x7'));var controller=require('./mailTransferReport.controller');router[_0x03f7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x03f7('0x8')](_0x03f7('0x9'),auth[_0x03f7('0xa')](),controller[_0x03f7('0xb')]);router[_0x03f7('0x8')](_0x03f7('0xc'),auth[_0x03f7('0xa')](),controller['show']);router[_0x03f7('0xd')]('/',auth[_0x03f7('0xa')](),controller[_0x03f7('0xe')]);router[_0x03f7('0xf')](_0x03f7('0xc'),auth[_0x03f7('0xa')](),controller[_0x03f7('0x10')]);router[_0x03f7('0x11')]('/:id',auth[_0x03f7('0xa')](),controller[_0x03f7('0x12')]);module['exports']=router; \ No newline at end of file +var _0xffed=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17435e,_0x37e929){var _0x3001ef=function(_0x51dcab){while(--_0x51dcab){_0x17435e['push'](_0x17435e['shift']());}};_0x3001ef(++_0x37e929);}(_0xffed,0xb6));var _0xdffe=function(_0x2c81cb,_0x19e092){_0x2c81cb=_0x2c81cb-0x0;var _0xa3f8fa=_0xffed[_0x2c81cb];return _0xa3f8fa;};'use strict';var multer=require('multer');var util=require(_0xdffe('0x0'));var path=require(_0xdffe('0x1'));var timeout=require(_0xdffe('0x2'));var express=require(_0xdffe('0x3'));var router=express[_0xdffe('0x4')]();var fs_extra=require(_0xdffe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdffe('0x6'));var config=require(_0xdffe('0x7'));var controller=require(_0xdffe('0x8'));router[_0xdffe('0x9')]('/',auth[_0xdffe('0xa')](),controller[_0xdffe('0xb')]);router['get'](_0xdffe('0xc'),auth[_0xdffe('0xa')](),controller[_0xdffe('0xd')]);router[_0xdffe('0x9')](_0xdffe('0xe'),auth[_0xdffe('0xa')](),controller[_0xdffe('0xf')]);router[_0xdffe('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdffe('0x11')](_0xdffe('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xdffe('0x12')](_0xdffe('0xe'),auth['isAuthenticated'](),controller[_0xdffe('0x13')]);module[_0xdffe('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 2760316..f0f1e7e 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x9bde,0xe1));var _0xe9bd=function(_0x390208,_0x4e7c9a){_0x390208=_0x390208-0x0;var _0x261167=_0x9bde[_0x390208];return _0x261167;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x301868,_0x52cd50){var _0x4683a8=function(_0x30a1d6){while(--_0x30a1d6){_0x301868['push'](_0x301868['shift']());}};_0x4683a8(++_0x52cd50);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x4b84[_0x2d6197];return _0x4d0e75;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9254617..09b900a 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 _0x2155=['params','keys','fields','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','json','reject','update','destroy','then','error','name','index','map','MailTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2155,0x130));var _0x5215=function(_0x269157,_0x22dc74){_0x269157=_0x269157-0x0;var _0x35c7d9=_0x2155[_0x269157];return _0x35c7d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5215('0x0'));var zipdir=require(_0x5215('0x1'));var jsonpatch=require(_0x5215('0x2'));var rp=require(_0x5215('0x3'));var moment=require(_0x5215('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5215('0x5'));var util=require('util');var path=require(_0x5215('0x6'));var sox=require('sox');var csv=require(_0x5215('0x7'));var ejs=require(_0x5215('0x8'));var fs=require('fs');var fs_extra=require(_0x5215('0x9'));var _=require(_0x5215('0xa'));var squel=require(_0x5215('0xb'));var crypto=require('crypto');var jsforce=require(_0x5215('0xc'));var deskjs=require(_0x5215('0xd'));var toCsv=require(_0x5215('0x7'));var querystring=require(_0x5215('0xe'));var Papa=require(_0x5215('0xf'));var Redis=require('ioredis');var authService=require(_0x5215('0x10'));var qs=require(_0x5215('0x11'));var as=require(_0x5215('0x12'));var hardwareService=require(_0x5215('0x13'));var logger=require(_0x5215('0x14'))('api');var utils=require(_0x5215('0x15'));var config=require(_0x5215('0x16'));var licenseUtil=require(_0x5215('0x17'));var db=require(_0x5215('0x18'))['db'];function respondWithStatusCode(_0xc02213,_0x710202){_0x710202=_0x710202||0xcc;return function(_0x3c26f2){if(_0x3c26f2){return _0xc02213[_0x5215('0x19')](_0x710202);}return _0xc02213[_0x5215('0x1a')](_0x710202)[_0x5215('0x1b')]();};}function respondWithResult(_0x37bd63,_0x3dafd8){_0x3dafd8=_0x3dafd8||0xc8;return function(_0x42a179){if(_0x42a179){return _0x37bd63[_0x5215('0x1a')](_0x3dafd8)['json'](_0x42a179);}};}function respondWithFilteredResult(_0x400b3a,_0x36acbd){return function(_0x5b22e0){if(_0x5b22e0){var _0x56c20c=typeof _0x36acbd['offset']===_0x5215('0x1c')&&typeof _0x36acbd[_0x5215('0x1d')]===_0x5215('0x1c');var _0x107bb8=_0x5b22e0['count'];var _0x1f4c68=_0x56c20c?0x0:_0x36acbd[_0x5215('0x1e')];var _0x356218=_0x56c20c?_0x5b22e0[_0x5215('0x1f')]:_0x36acbd[_0x5215('0x1e')]+_0x36acbd[_0x5215('0x1d')];var _0x38ba17;if(_0x356218>=_0x107bb8){_0x356218=_0x107bb8;_0x38ba17=0xc8;}else{_0x38ba17=0xce;}_0x400b3a['status'](_0x38ba17);return _0x400b3a[_0x5215('0x20')]('Content-Range',_0x1f4c68+'-'+_0x356218+'/'+_0x107bb8)[_0x5215('0x21')](_0x5b22e0);}return null;};}function patchUpdates(_0x553667){return function(_0x45ae8c){try{jsonpatch['apply'](_0x45ae8c,_0x553667,!![]);}catch(_0x1c0abf){return BPromise[_0x5215('0x22')](_0x1c0abf);}return _0x45ae8c['save']();};}function saveUpdates(_0x28cb9d,_0x3a1dff){return function(_0x1bbaa0){if(_0x1bbaa0){return _0x1bbaa0[_0x5215('0x23')](_0x28cb9d)['then'](function(_0x3bc1c4){return _0x3bc1c4;});}return null;};}function removeEntity(_0x34630c,_0x2cbfc9){return function(_0x83bd48){if(_0x83bd48){return _0x83bd48[_0x5215('0x24')]()[_0x5215('0x25')](function(){_0x34630c['status'](0xcc)[_0x5215('0x1b')]();});}};}function handleEntityNotFound(_0x6a1731,_0x1dde9f){return function(_0x8c3f2a){if(!_0x8c3f2a){_0x6a1731[_0x5215('0x19')](0x194);}return _0x8c3f2a;};}function handleError(_0x35ead3,_0x2a9b98){_0x2a9b98=_0x2a9b98||0x1f4;return function(_0x4caf3d){logger[_0x5215('0x26')](_0x4caf3d['stack']);if(_0x4caf3d[_0x5215('0x27')]){delete _0x4caf3d['name'];}_0x35ead3[_0x5215('0x1a')](_0x2a9b98)['send'](_0x4caf3d);};}exports[_0x5215('0x28')]=function(_0xb44af1,_0x47f55b){var _0x13b7a0={},_0x14e8b4={},_0x45457b={'count':0x0,'rows':[]};var _0x500709=_[_0x5215('0x29')](db[_0x5215('0x2a')][_0x5215('0x2b')],function(_0x46a748){return{'name':_0x46a748['fieldName'],'type':_0x46a748[_0x5215('0x2c')][_0x5215('0x2d')]};});_0x14e8b4[_0x5215('0x2e')]=_[_0x5215('0x29')](_0x500709,'name');_0x14e8b4[_0x5215('0x2f')]=_['keys'](_0xb44af1[_0x5215('0x2f')]);_0x14e8b4[_0x5215('0x30')]=_[_0x5215('0x31')](_0x14e8b4[_0x5215('0x2e')],_0x14e8b4[_0x5215('0x2f')]);_0x13b7a0[_0x5215('0x32')]=_[_0x5215('0x31')](_0x14e8b4[_0x5215('0x2e')],qs['fields'](_0xb44af1[_0x5215('0x2f')]['fields']));_0x13b7a0[_0x5215('0x32')]=_0x13b7a0['attributes'][_0x5215('0x33')]?_0x13b7a0[_0x5215('0x32')]:_0x14e8b4[_0x5215('0x2e')];if(!_0xb44af1[_0x5215('0x2f')]['hasOwnProperty'](_0x5215('0x34'))){_0x13b7a0[_0x5215('0x1d')]=qs[_0x5215('0x1d')](_0xb44af1[_0x5215('0x2f')]['limit']);_0x13b7a0[_0x5215('0x1e')]=qs[_0x5215('0x1e')](_0xb44af1[_0x5215('0x2f')][_0x5215('0x1e')]);}_0x13b7a0[_0x5215('0x35')]=qs[_0x5215('0x36')](_0xb44af1[_0x5215('0x2f')][_0x5215('0x36')]);_0x13b7a0[_0x5215('0x37')]=qs[_0x5215('0x30')](_[_0x5215('0x38')](_0xb44af1['query'],_0x14e8b4[_0x5215('0x30')]),_0x500709);if(_0xb44af1['query'][_0x5215('0x39')]){_0x13b7a0['where']=_[_0x5215('0x3a')](_0x13b7a0[_0x5215('0x37')],{'$or':_[_0x5215('0x29')](_0x500709,function(_0x56ffb0){if(_0x56ffb0[_0x5215('0x2c')]!==_0x5215('0x3b')){var _0x128165={};_0x128165[_0x56ffb0[_0x5215('0x27')]]={'$like':'%'+_0xb44af1[_0x5215('0x2f')][_0x5215('0x39')]+'%'};return _0x128165;}})});}_0x13b7a0=_[_0x5215('0x3a')]({},_0x13b7a0,_0xb44af1[_0x5215('0x3c')]);var _0x48b860={'where':_0x13b7a0['where']};return db[_0x5215('0x2a')][_0x5215('0x1f')](_0x48b860)[_0x5215('0x25')](function(_0x3c8b45){_0x45457b['count']=_0x3c8b45;if(_0xb44af1['query'][_0x5215('0x3d')]){_0x13b7a0[_0x5215('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0x5215('0x3f')](_0x13b7a0);})[_0x5215('0x25')](function(_0x1963b8){_0x45457b[_0x5215('0x40')]=_0x1963b8;return _0x45457b;})['then'](respondWithFilteredResult(_0x47f55b,_0x13b7a0))['catch'](handleError(_0x47f55b,null));};exports[_0x5215('0x41')]=function(_0x3ab2ff,_0x567197){var _0x8a6de7={'raw':!![],'where':{'id':_0x3ab2ff[_0x5215('0x42')]['id']}},_0x2f3a90={};_0x2f3a90['model']=_['keys'](db[_0x5215('0x2a')][_0x5215('0x2b')]);_0x2f3a90[_0x5215('0x2f')]=_[_0x5215('0x43')](_0x3ab2ff[_0x5215('0x2f')]);_0x2f3a90[_0x5215('0x30')]=_[_0x5215('0x31')](_0x2f3a90[_0x5215('0x2e')],_0x2f3a90[_0x5215('0x2f')]);_0x8a6de7[_0x5215('0x32')]=_['intersection'](_0x2f3a90[_0x5215('0x2e')],qs[_0x5215('0x44')](_0x3ab2ff[_0x5215('0x2f')][_0x5215('0x44')]));_0x8a6de7['attributes']=_0x8a6de7['attributes'][_0x5215('0x33')]?_0x8a6de7[_0x5215('0x32')]:_0x2f3a90[_0x5215('0x2e')];if(_0x3ab2ff[_0x5215('0x2f')][_0x5215('0x3d')]){_0x8a6de7[_0x5215('0x3e')]=[{'all':!![]}];}_0x8a6de7=_[_0x5215('0x3a')]({},_0x8a6de7,_0x3ab2ff['options']);return db['MailTransferReport'][_0x5215('0x45')](_0x8a6de7)[_0x5215('0x25')](handleEntityNotFound(_0x567197,null))[_0x5215('0x25')](respondWithResult(_0x567197,null))[_0x5215('0x46')](handleError(_0x567197,null));};exports[_0x5215('0x47')]=function(_0x11a618,_0x3999b5){return db['MailTransferReport'][_0x5215('0x47')](_0x11a618[_0x5215('0x48')],{})['then'](respondWithResult(_0x3999b5,0xc9))['catch'](handleError(_0x3999b5,null));};exports[_0x5215('0x23')]=function(_0x16ff63,_0x5b604a){if(_0x16ff63[_0x5215('0x48')]['id']){delete _0x16ff63[_0x5215('0x48')]['id'];}return db['MailTransferReport'][_0x5215('0x45')]({'where':{'id':_0x16ff63[_0x5215('0x42')]['id']}})[_0x5215('0x25')](handleEntityNotFound(_0x5b604a,null))['then'](saveUpdates(_0x16ff63[_0x5215('0x48')],null))[_0x5215('0x25')](respondWithResult(_0x5b604a,null))[_0x5215('0x46')](handleError(_0x5b604a,null));};exports[_0x5215('0x24')]=function(_0x7c8458,_0x168e4f){return db[_0x5215('0x2a')][_0x5215('0x45')]({'where':{'id':_0x7c8458[_0x5215('0x42')]['id']}})['then'](handleEntityNotFound(_0x168e4f,null))[_0x5215('0x25')](removeEntity(_0x168e4f,null))[_0x5215('0x46')](handleError(_0x168e4f,null));};exports[_0x5215('0x49')]=function(_0x5ac7b6,_0x496d35){return db[_0x5215('0x2a')][_0x5215('0x49')]()[_0x5215('0x25')](respondWithResult(_0x496d35,null))[_0x5215('0x46')](handleError(_0x496d35,null));}; \ No newline at end of file +var _0x5b80=['catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','show','params','keys','rawAttributes','length','find'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0x5b80,0x124));var _0x05b8=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x5b80[_0x2fc012];return _0x2891f9;};'use strict';var emlformat=require(_0x05b8('0x0'));var rimraf=require(_0x05b8('0x1'));var zipdir=require(_0x05b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05b8('0x3'));var moment=require('moment');var BPromise=require(_0x05b8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x05b8('0x5'));var csv=require('to-csv');var ejs=require(_0x05b8('0x6'));var fs=require('fs');var fs_extra=require(_0x05b8('0x7'));var _=require(_0x05b8('0x8'));var squel=require('squel');var crypto=require(_0x05b8('0x9'));var jsforce=require(_0x05b8('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x05b8('0xb'));var Papa=require('papaparse');var Redis=require(_0x05b8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x05b8('0xd'));var as=require(_0x05b8('0xe'));var hardwareService=require(_0x05b8('0xf'));var logger=require(_0x05b8('0x10'))(_0x05b8('0x11'));var utils=require('../../config/utils');var config=require(_0x05b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x05b8('0x13'))['db'];function respondWithStatusCode(_0x29ba78,_0x18ddd5){_0x18ddd5=_0x18ddd5||0xcc;return function(_0x229970){if(_0x229970){return _0x29ba78['sendStatus'](_0x18ddd5);}return _0x29ba78[_0x05b8('0x14')](_0x18ddd5)[_0x05b8('0x15')]();};}function respondWithResult(_0x52a461,_0x46497f){_0x46497f=_0x46497f||0xc8;return function(_0xea7942){if(_0xea7942){return _0x52a461[_0x05b8('0x14')](_0x46497f)[_0x05b8('0x16')](_0xea7942);}};}function respondWithFilteredResult(_0x889e0b,_0x1816a3){return function(_0x572f2c){if(_0x572f2c){var _0x1b75aa=typeof _0x1816a3[_0x05b8('0x17')]===_0x05b8('0x18')&&typeof _0x1816a3[_0x05b8('0x19')]==='undefined';var _0x5dcf13=_0x572f2c[_0x05b8('0x1a')];var _0x5bf5c5=_0x1b75aa?0x0:_0x1816a3['offset'];var _0x92a565=_0x1b75aa?_0x572f2c['count']:_0x1816a3[_0x05b8('0x17')]+_0x1816a3[_0x05b8('0x19')];var _0x1d143c;if(_0x92a565>=_0x5dcf13){_0x92a565=_0x5dcf13;_0x1d143c=0xc8;}else{_0x1d143c=0xce;}_0x889e0b[_0x05b8('0x14')](_0x1d143c);return _0x889e0b[_0x05b8('0x1b')](_0x05b8('0x1c'),_0x5bf5c5+'-'+_0x92a565+'/'+_0x5dcf13)['json'](_0x572f2c);}return null;};}function patchUpdates(_0x36b229){return function(_0x394090){try{jsonpatch[_0x05b8('0x1d')](_0x394090,_0x36b229,!![]);}catch(_0x194178){return BPromise[_0x05b8('0x1e')](_0x194178);}return _0x394090[_0x05b8('0x1f')]();};}function saveUpdates(_0x4fa6aa,_0x211ae5){return function(_0x3ba86b){if(_0x3ba86b){return _0x3ba86b[_0x05b8('0x20')](_0x4fa6aa)[_0x05b8('0x21')](function(_0x483eed){return _0x483eed;});}return null;};}function removeEntity(_0x333292,_0x4c51d3){return function(_0x1a5896){if(_0x1a5896){return _0x1a5896[_0x05b8('0x22')]()['then'](function(){_0x333292['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x246ada,_0x5c37c6){return function(_0x54f1b3){if(!_0x54f1b3){_0x246ada[_0x05b8('0x23')](0x194);}return _0x54f1b3;};}function handleError(_0x467863,_0x29b934){_0x29b934=_0x29b934||0x1f4;return function(_0x2f9404){logger[_0x05b8('0x24')](_0x2f9404['stack']);if(_0x2f9404[_0x05b8('0x25')]){delete _0x2f9404[_0x05b8('0x25')];}_0x467863[_0x05b8('0x14')](_0x29b934)[_0x05b8('0x26')](_0x2f9404);};}exports['index']=function(_0x146cb1,_0x148ff0){var _0x3d17da={},_0x27d8c1={},_0xed45b3={'count':0x0,'rows':[]};var _0xc0263c=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x1e078f){return{'name':_0x1e078f[_0x05b8('0x27')],'type':_0x1e078f[_0x05b8('0x28')][_0x05b8('0x29')]};});_0x27d8c1[_0x05b8('0x2a')]=_['map'](_0xc0263c,_0x05b8('0x25'));_0x27d8c1[_0x05b8('0x2b')]=_['keys'](_0x146cb1['query']);_0x27d8c1[_0x05b8('0x2c')]=_[_0x05b8('0x2d')](_0x27d8c1[_0x05b8('0x2a')],_0x27d8c1[_0x05b8('0x2b')]);_0x3d17da['attributes']=_[_0x05b8('0x2d')](_0x27d8c1[_0x05b8('0x2a')],qs[_0x05b8('0x2e')](_0x146cb1[_0x05b8('0x2b')][_0x05b8('0x2e')]));_0x3d17da['attributes']=_0x3d17da['attributes']['length']?_0x3d17da[_0x05b8('0x2f')]:_0x27d8c1[_0x05b8('0x2a')];if(!_0x146cb1[_0x05b8('0x2b')][_0x05b8('0x30')](_0x05b8('0x31'))){_0x3d17da[_0x05b8('0x19')]=qs[_0x05b8('0x19')](_0x146cb1[_0x05b8('0x2b')][_0x05b8('0x19')]);_0x3d17da[_0x05b8('0x17')]=qs[_0x05b8('0x17')](_0x146cb1[_0x05b8('0x2b')][_0x05b8('0x17')]);}_0x3d17da[_0x05b8('0x32')]=qs['sort'](_0x146cb1['query'][_0x05b8('0x33')]);_0x3d17da[_0x05b8('0x34')]=qs[_0x05b8('0x2c')](_['pick'](_0x146cb1[_0x05b8('0x2b')],_0x27d8c1[_0x05b8('0x2c')]),_0xc0263c);if(_0x146cb1[_0x05b8('0x2b')][_0x05b8('0x35')]){_0x3d17da[_0x05b8('0x34')]=_[_0x05b8('0x36')](_0x3d17da[_0x05b8('0x34')],{'$or':_[_0x05b8('0x37')](_0xc0263c,function(_0x5f256b){if(_0x5f256b[_0x05b8('0x28')]!==_0x05b8('0x38')){var _0x879ac1={};_0x879ac1[_0x5f256b[_0x05b8('0x25')]]={'$like':'%'+_0x146cb1[_0x05b8('0x2b')]['filter']+'%'};return _0x879ac1;}})});}_0x3d17da=_['merge']({},_0x3d17da,_0x146cb1[_0x05b8('0x39')]);var _0x5039f7={'where':_0x3d17da['where']};return db['MailTransferReport']['count'](_0x5039f7)[_0x05b8('0x21')](function(_0x3e5c8f){_0xed45b3['count']=_0x3e5c8f;if(_0x146cb1[_0x05b8('0x2b')][_0x05b8('0x3a')]){_0x3d17da[_0x05b8('0x3b')]=[{'all':!![]}];}return db[_0x05b8('0x3c')][_0x05b8('0x3d')](_0x3d17da);})[_0x05b8('0x21')](function(_0x4164ec){_0xed45b3['rows']=_0x4164ec;return _0xed45b3;})['then'](respondWithFilteredResult(_0x148ff0,_0x3d17da))['catch'](handleError(_0x148ff0,null));};exports[_0x05b8('0x3e')]=function(_0x397ef1,_0x2c055c){var _0x1116f8={'raw':!![],'where':{'id':_0x397ef1[_0x05b8('0x3f')]['id']}},_0x1e6a26={};_0x1e6a26[_0x05b8('0x2a')]=_[_0x05b8('0x40')](db[_0x05b8('0x3c')][_0x05b8('0x41')]);_0x1e6a26[_0x05b8('0x2b')]=_[_0x05b8('0x40')](_0x397ef1[_0x05b8('0x2b')]);_0x1e6a26['filters']=_[_0x05b8('0x2d')](_0x1e6a26[_0x05b8('0x2a')],_0x1e6a26['query']);_0x1116f8[_0x05b8('0x2f')]=_['intersection'](_0x1e6a26[_0x05b8('0x2a')],qs[_0x05b8('0x2e')](_0x397ef1['query'][_0x05b8('0x2e')]));_0x1116f8['attributes']=_0x1116f8[_0x05b8('0x2f')][_0x05b8('0x42')]?_0x1116f8[_0x05b8('0x2f')]:_0x1e6a26[_0x05b8('0x2a')];if(_0x397ef1[_0x05b8('0x2b')][_0x05b8('0x3a')]){_0x1116f8['include']=[{'all':!![]}];}_0x1116f8=_[_0x05b8('0x36')]({},_0x1116f8,_0x397ef1[_0x05b8('0x39')]);return db[_0x05b8('0x3c')][_0x05b8('0x43')](_0x1116f8)[_0x05b8('0x21')](handleEntityNotFound(_0x2c055c,null))[_0x05b8('0x21')](respondWithResult(_0x2c055c,null))[_0x05b8('0x44')](handleError(_0x2c055c,null));};exports['create']=function(_0x28ea08,_0x4c9d72){return db[_0x05b8('0x3c')][_0x05b8('0x45')](_0x28ea08[_0x05b8('0x46')],{})[_0x05b8('0x21')](respondWithResult(_0x4c9d72,0xc9))['catch'](handleError(_0x4c9d72,null));};exports[_0x05b8('0x20')]=function(_0x191604,_0xd684f3){if(_0x191604[_0x05b8('0x46')]['id']){delete _0x191604[_0x05b8('0x46')]['id'];}return db[_0x05b8('0x3c')][_0x05b8('0x43')]({'where':{'id':_0x191604['params']['id']}})['then'](handleEntityNotFound(_0xd684f3,null))['then'](saveUpdates(_0x191604[_0x05b8('0x46')],null))[_0x05b8('0x21')](respondWithResult(_0xd684f3,null))['catch'](handleError(_0xd684f3,null));};exports[_0x05b8('0x22')]=function(_0x4e2476,_0x153121){return db['MailTransferReport'][_0x05b8('0x43')]({'where':{'id':_0x4e2476['params']['id']}})[_0x05b8('0x21')](handleEntityNotFound(_0x153121,null))['then'](removeEntity(_0x153121,null))[_0x05b8('0x44')](handleError(_0x153121,null));};exports[_0x05b8('0x47')]=function(_0x5d56de,_0x24f63d){return db['MailTransferReport'][_0x05b8('0x47')]()[_0x05b8('0x21')](respondWithResult(_0x24f63d,null))[_0x05b8('0x44')](handleError(_0x24f63d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 58d7c74..2e2b43d 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 _0xb35a=['MailTransferReport','report_mail_transfer','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb35a,0x1d7));var _0xab35=function(_0x1598de,_0x3ebcb4){_0x1598de=_0x1598de-0x0;var _0x549cbd=_0xb35a[_0x1598de];return _0x549cbd;};'use strict';var _=require(_0xab35('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab35('0x1'));var moment=require('moment');var BPromise=require(_0xab35('0x2'));var rp=require(_0xab35('0x3'));var fs=require('fs');var path=require(_0xab35('0x4'));var rimraf=require(_0xab35('0x5'));var config=require(_0xab35('0x6'));var attributes=require(_0xab35('0x7'));module[_0xab35('0x8')]=function(_0x1c6022,_0x2c3072){return _0x1c6022[_0xab35('0x9')](_0xab35('0xa'),attributes,{'tableName':_0xab35('0xb'),'paranoid':![],'indexes':[{'name':_0xab35('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb95a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid'];(function(_0x5b04a3,_0xfda4fd){var _0x1adf11=function(_0x9e242a){while(--_0x9e242a){_0x5b04a3['push'](_0x5b04a3['shift']());}};_0x1adf11(++_0xfda4fd);}(_0xb95a,0x13b));var _0xab95=function(_0x33afd7,_0x23bf16){_0x33afd7=_0x33afd7-0x0;var _0x25bcf5=_0xb95a[_0x33afd7];return _0x25bcf5;};'use strict';var _=require(_0xab95('0x0'));var util=require(_0xab95('0x1'));var logger=require(_0xab95('0x2'))(_0xab95('0x3'));var moment=require(_0xab95('0x4'));var BPromise=require(_0xab95('0x5'));var rp=require(_0xab95('0x6'));var fs=require('fs');var path=require(_0xab95('0x7'));var rimraf=require(_0xab95('0x8'));var config=require(_0xab95('0x9'));var attributes=require(_0xab95('0xa'));module[_0xab95('0xb')]=function(_0x4ef149,_0xa2ba87){return _0x4ef149[_0xab95('0xc')](_0xab95('0xd'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xab95('0xe'),'fields':[_0xab95('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 6b98bce..a98248b 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 _0x5ac8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','randomstring','ioredis','../../mysqldb'];(function(_0xac9bb8,_0x4c1343){var _0x8c7c24=function(_0x55e70c){while(--_0x55e70c){_0xac9bb8['push'](_0xac9bb8['shift']());}};_0x8c7c24(++_0x4c1343);}(_0x5ac8,0x18b));var _0x85ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ac8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85ac('0x0'));var BPromise=require('bluebird');var rs=require(_0x85ac('0x1'));var fs=require('fs');var Redis=require(_0x85ac('0x2'));var db=require(_0x85ac('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x85ac('0x4'))(_0x85ac('0x5'));var config=require(_0x85ac('0x6'));var jayson=require(_0x85ac('0x7'));var client=jayson[_0x85ac('0x8')][_0x85ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x407c47,_0x58e9cd,_0xf06c9c){return new BPromise(function(_0x4071b2,_0x178559){return client[_0x85ac('0xa')](_0x407c47,_0xf06c9c)[_0x85ac('0xb')](function(_0x5d4002){logger[_0x85ac('0xc')](_0x85ac('0xd'),_0x58e9cd,_0x85ac('0xe'));logger[_0x85ac('0xf')](_0x85ac('0x10'),_0x58e9cd,_0x85ac('0xe'),JSON[_0x85ac('0x11')](_0x5d4002));if(_0x5d4002[_0x85ac('0x12')]){if(_0x5d4002[_0x85ac('0x12')]['code']===0x1f4){logger['error'](_0x85ac('0xd'),_0x58e9cd,_0x5d4002[_0x85ac('0x12')][_0x85ac('0x13')]);return _0x178559(_0x5d4002['error'][_0x85ac('0x13')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x58e9cd,_0x5d4002['error'][_0x85ac('0x13')]);return _0x4071b2(_0x5d4002[_0x85ac('0x12')][_0x85ac('0x13')]);}else{logger[_0x85ac('0xc')](_0x85ac('0xd'),_0x58e9cd,_0x85ac('0xe'));_0x4071b2(_0x5d4002[_0x85ac('0x14')][_0x85ac('0x13')]);}})['catch'](function(_0x3461a0){logger[_0x85ac('0x12')](_0x85ac('0xd'),_0x58e9cd,_0x3461a0);_0x178559(_0x3461a0);});});} \ No newline at end of file +var _0x36a5=['client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1f8413,_0x18f221){var _0x133870=function(_0x1c6c25){while(--_0x1c6c25){_0x1f8413['push'](_0x1f8413['shift']());}};_0x133870(++_0x18f221);}(_0x36a5,0xb4));var _0x536a=function(_0x5e3ffb,_0x234bbb){_0x5e3ffb=_0x5e3ffb-0x0;var _0x5e4a40=_0x36a5[_0x5e3ffb];return _0x5e4a40;};'use strict';var _=require(_0x536a('0x0'));var util=require(_0x536a('0x1'));var moment=require(_0x536a('0x2'));var BPromise=require('bluebird');var rs=require(_0x536a('0x3'));var fs=require('fs');var Redis=require(_0x536a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x536a('0x5'));var logger=require('../../config/logger')(_0x536a('0x6'));var config=require(_0x536a('0x7'));var jayson=require(_0x536a('0x8'));var client=jayson[_0x536a('0x9')][_0x536a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ac00d,_0x2da988,_0x320a10){return new BPromise(function(_0x141270,_0x14dad2){return client['request'](_0x4ac00d,_0x320a10)[_0x536a('0xb')](function(_0x104a6b){logger[_0x536a('0xc')](_0x536a('0xd'),_0x2da988,_0x536a('0xe'));logger['debug'](_0x536a('0xf'),_0x2da988,_0x536a('0xe'),JSON[_0x536a('0x10')](_0x104a6b));if(_0x104a6b[_0x536a('0x11')]){if(_0x104a6b[_0x536a('0x11')][_0x536a('0x12')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2da988,_0x104a6b[_0x536a('0x11')][_0x536a('0x13')]);return _0x14dad2(_0x104a6b[_0x536a('0x11')][_0x536a('0x13')]);}logger[_0x536a('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2da988,_0x104a6b[_0x536a('0x11')]['message']);return _0x141270(_0x104a6b['error']['message']);}else{logger[_0x536a('0xc')](_0x536a('0xd'),_0x2da988,_0x536a('0xe'));_0x141270(_0x104a6b['result'][_0x536a('0x13')]);}})[_0x536a('0x14')](function(_0x45ed07){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2da988,_0x45ed07);_0x14dad2(_0x45ed07);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index de4b2b4..8942632 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 _0xb6cb=['create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./memberReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x243fdb,_0x1ed974){var _0x4d2a7c=function(_0x36d29b){while(--_0x36d29b){_0x243fdb['push'](_0x243fdb['shift']());}};_0x4d2a7c(++_0x1ed974);}(_0xb6cb,0x1d3));var _0xbb6c=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0xb6cb[_0xdefbc3];return _0x367798;};'use strict';var multer=require(_0xbb6c('0x0'));var util=require(_0xbb6c('0x1'));var path=require('path');var timeout=require(_0xbb6c('0x2'));var express=require(_0xbb6c('0x3'));var router=express[_0xbb6c('0x4')]();var fs_extra=require(_0xbb6c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb6c('0x6'));var controller=require(_0xbb6c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb6c('0x8')]);router[_0xbb6c('0x9')](_0xbb6c('0xa'),auth['isAuthenticated'](),controller[_0xbb6c('0xb')]);router['get'](_0xbb6c('0xc'),auth[_0xbb6c('0xd')](),controller[_0xbb6c('0xe')]);router[_0xbb6c('0xf')]('/',auth[_0xbb6c('0xd')](),controller[_0xbb6c('0x10')]);router[_0xbb6c('0x11')]('/:id',auth[_0xbb6c('0xd')](),controller[_0xbb6c('0x12')]);router[_0xbb6c('0x13')](_0xbb6c('0xc'),auth[_0xbb6c('0xd')](),controller[_0xbb6c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4686=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./memberReport.controller','isAuthenticated','get','/describe','describe','show','post','put','/:id','update','destroy','exports'];(function(_0x2e6f05,_0x28de72){var _0x145f67=function(_0x47f0aa){while(--_0x47f0aa){_0x2e6f05['push'](_0x2e6f05['shift']());}};_0x145f67(++_0x28de72);}(_0x4686,0x17c));var _0x6468=function(_0x43cf6e,_0x33ffc4){_0x43cf6e=_0x43cf6e-0x0;var _0x63c6eb=_0x4686[_0x43cf6e];return _0x63c6eb;};'use strict';var multer=require(_0x6468('0x0'));var util=require(_0x6468('0x1'));var path=require(_0x6468('0x2'));var timeout=require(_0x6468('0x3'));var express=require(_0x6468('0x4'));var router=express[_0x6468('0x5')]();var fs_extra=require(_0x6468('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6468('0x7'));var controller=require(_0x6468('0x8'));router['get']('/',auth[_0x6468('0x9')](),controller['index']);router[_0x6468('0xa')](_0x6468('0xb'),auth['isAuthenticated'](),controller[_0x6468('0xc')]);router[_0x6468('0xa')]('/:id',auth[_0x6468('0x9')](),controller[_0x6468('0xd')]);router[_0x6468('0xe')]('/',auth[_0x6468('0x9')](),controller['create']);router[_0x6468('0xf')](_0x6468('0x10'),auth[_0x6468('0x9')](),controller[_0x6468('0x11')]);router['delete'](_0x6468('0x10'),auth['isAuthenticated'](),controller[_0x6468('0x12')]);module[_0x6468('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0bfe520..6fe34b8 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 _0x99e4=['talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x99e4,0x70));var _0x499e=function(_0x3bd3c1,_0x2d1d04){_0x3bd3c1=_0x3bd3c1-0x0;var _0x4236f7=_0x99e4[_0x3bd3c1];return _0x4236f7;};'use strict';var Sequelize=require(_0x499e('0x0'));var moment=require(_0x499e('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x499e('0x2')]},'interface':{'type':Sequelize[_0x499e('0x2')]},'type':{'type':Sequelize[_0x499e('0x2')],'defaultValue':_0x499e('0x3'),'comment':_0x499e('0x4')},'duration':{'type':Sequelize[_0x499e('0x5')]},'enterAt':{'type':Sequelize[_0x499e('0x6')]},'exitAt':{'type':Sequelize[_0x499e('0x6')],'set':function(_0x523f05){var _0x5ce849=moment(_0x523f05);var _0x590642=moment(this[_0x499e('0x7')](_0x499e('0x8')));var _0x155efc=_0x5ce849[_0x499e('0x9')](_0x590642,_0x499e('0xa'));this[_0x499e('0xb')](_0x499e('0xc'),_0x523f05);this[_0x499e('0xb')](_0x499e('0xd'),_0x155efc>=0x0?_0x155efc:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x499e('0x2')],'comment':_0x499e('0xe')},'data3':{'type':Sequelize[_0x499e('0x2')],'comment':_0x499e('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x499e('0x10')},'data5':{'type':Sequelize[_0x499e('0x2')],'comment':_0x499e('0x11')},'role':{'type':Sequelize[_0x499e('0x2')]},'internal':{'type':Sequelize[_0x499e('0x5')]},'uniqueid':{'type':Sequelize[_0x499e('0x2')]}}; \ No newline at end of file +var _0x781c=['seconds','setDataValue','talk:[start]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff'];(function(_0x5e7b0a,_0xe2a383){var _0x59e412=function(_0xd3a9cb){while(--_0xd3a9cb){_0x5e7b0a['push'](_0x5e7b0a['shift']());}};_0x59e412(++_0xe2a383);}(_0x781c,0x157));var _0xc781=function(_0xb46f8c,_0x562985){_0xb46f8c=_0xb46f8c-0x0;var _0x4fc388=_0x781c[_0xb46f8c];return _0x4fc388;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc781('0x0'));module[_0xc781('0x1')]={'channel':{'type':Sequelize[_0xc781('0x2')]},'membername':{'type':Sequelize[_0xc781('0x2')]},'interface':{'type':Sequelize[_0xc781('0x2')]},'type':{'type':Sequelize[_0xc781('0x2')],'defaultValue':_0xc781('0x3'),'comment':_0xc781('0x4')},'duration':{'type':Sequelize[_0xc781('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc781('0x6')],'set':function(_0x2a2845){var _0x2e38da=moment(_0x2a2845);var _0x1251ed=moment(this['getDataValue']('enterAt'));var _0x25beb3=_0x2e38da[_0xc781('0x7')](_0x1251ed,_0xc781('0x8'));this[_0xc781('0x9')]('exitAt',_0x2a2845);this[_0xc781('0x9')]('duration',_0x25beb3>=0x0?_0x25beb3:null);}},'data1':{'type':Sequelize[_0xc781('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xc781('0x2')],'comment':_0xc781('0xa')},'data3':{'type':Sequelize[_0xc781('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xc781('0x2')],'comment':_0xc781('0xb')},'data5':{'type':Sequelize[_0xc781('0x2')],'comment':_0xc781('0xc')},'role':{'type':Sequelize[_0xc781('0x2')]},'internal':{'type':Sequelize[_0xc781('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index af0ce5f..13d5d27 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x3a9a68,_0x39e066){var _0x12867f=function(_0x2adbdb){while(--_0x2adbdb){_0x3a9a68['push'](_0x3a9a68['shift']());}};_0x12867f(++_0x39e066);}(_0x3e74,0x175));var _0x43e7=function(_0x35abbe,_0x2ab9fe){_0x35abbe=_0x35abbe-0x0;var _0x3a9f96=_0x3e74[_0x35abbe];return _0x3a9f96;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x34e8,0x12c));var _0x834e=function(_0x1aa236,_0x5a4d20){_0x1aa236=_0x1aa236-0x0;var _0x393cb6=_0x34e8[_0x1aa236];return _0x393cb6;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7b74e0c..5501030 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 _0x1d3c=['exports','define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x579088,_0x52b8eb){var _0x34ff77=function(_0x5d1a8e){while(--_0x5d1a8e){_0x579088['push'](_0x579088['shift']());}};_0x34ff77(++_0x52b8eb);}(_0x1d3c,0x6f));var _0xc1d3=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0x1d3c[_0x133fe4];return _0x4c4017;};'use strict';var _=require(_0xc1d3('0x0'));var util=require(_0xc1d3('0x1'));var logger=require(_0xc1d3('0x2'))(_0xc1d3('0x3'));var moment=require(_0xc1d3('0x4'));var BPromise=require(_0xc1d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc1d3('0x6'));var config=require(_0xc1d3('0x7'));var attributes=require(_0xc1d3('0x8'));module[_0xc1d3('0x9')]=function(_0x182389,_0x3be6a2){return _0x182389[_0xc1d3('0xa')](_0xc1d3('0xb'),attributes,{'tableName':_0xc1d3('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc1d3('0xd'),_0xc1d3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd90=['request-promise','rimraf','../../config/environment','exports','MemberReport','lodash','util','../../config/logger','moment'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xcd90,0x8c));var _0x0cd9=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xcd90[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0cd9('0x0'));var util=require(_0x0cd9('0x1'));var logger=require(_0x0cd9('0x2'))('api');var moment=require(_0x0cd9('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cd9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cd9('0x5'));var config=require(_0x0cd9('0x6'));var attributes=require('./memberReport.attributes');module[_0x0cd9('0x7')]=function(_0x1f121a,_0x10ee87){return _0x1f121a['define'](_0x0cd9('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7159116..7481251 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 _0x576b=['message','result','catch','GetMemberReport','MemberReport','raw','where','options','attributes','limit','include','map','model','CreateMemberReport','create','body','UpdateMemberReport','update','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x576b,0x1d9));var _0xb576=function(_0x2e3cf5,_0x333c81){_0x2e3cf5=_0x2e3cf5-0x0;var _0x1a2cf5=_0x576b[_0x2e3cf5];return _0x1a2cf5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb576('0x0'));var rs=require(_0xb576('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb576('0x2'))['db'];var utils=require(_0xb576('0x3'));var logger=require('../../config/logger')(_0xb576('0x4'));var config=require(_0xb576('0x5'));var jayson=require(_0xb576('0x6'));var client=jayson[_0xb576('0x7')][_0xb576('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22cbae,_0x42affb,_0x42f2c0){return new BPromise(function(_0xe6d2fd,_0x450f16){return client[_0xb576('0x9')](_0x22cbae,_0x42f2c0)[_0xb576('0xa')](function(_0x7cc721){logger[_0xb576('0xb')](_0xb576('0xc'),_0x42affb,'request\x20sent');logger[_0xb576('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x42affb,_0xb576('0xe'),JSON[_0xb576('0xf')](_0x7cc721));if(_0x7cc721[_0xb576('0x10')]){if(_0x7cc721['error']['code']===0x1f4){logger[_0xb576('0x10')](_0xb576('0xc'),_0x42affb,_0x7cc721[_0xb576('0x10')][_0xb576('0x11')]);return _0x450f16(_0x7cc721[_0xb576('0x10')][_0xb576('0x11')]);}logger[_0xb576('0x10')](_0xb576('0xc'),_0x42affb,_0x7cc721[_0xb576('0x10')][_0xb576('0x11')]);return _0xe6d2fd(_0x7cc721['error']['message']);}else{logger['info'](_0xb576('0xc'),_0x42affb,_0xb576('0xe'));_0xe6d2fd(_0x7cc721[_0xb576('0x12')][_0xb576('0x11')]);}})[_0xb576('0x13')](function(_0x29940b){logger['error'](_0xb576('0xc'),_0x42affb,_0x29940b);_0x450f16(_0x29940b);});});}exports[_0xb576('0x14')]=function(_0x5406c9){var _0x52a0ca=this;return new Promise(function(_0x394d7e,_0x3da216){return db[_0xb576('0x15')]['findAll']({'raw':_0x5406c9['options']?_0x5406c9['options'][_0xb576('0x16')]===undefined?!![]:![]:!![],'where':_0x5406c9['options']?_0x5406c9['options'][_0xb576('0x17')]||null:null,'attributes':_0x5406c9[_0xb576('0x18')]?_0x5406c9[_0xb576('0x18')][_0xb576('0x19')]||null:null,'limit':_0x5406c9['options']?_0x5406c9[_0xb576('0x18')][_0xb576('0x1a')]||null:null,'include':_0x5406c9[_0xb576('0x18')]?_0x5406c9[_0xb576('0x18')][_0xb576('0x1b')]?_[_0xb576('0x1c')](_0x5406c9[_0xb576('0x18')][_0xb576('0x1b')],function(_0x23d3e7){return{'model':db[_0x23d3e7[_0xb576('0x1d')]],'as':_0x23d3e7['as'],'attributes':_0x23d3e7[_0xb576('0x19')],'include':_0x23d3e7[_0xb576('0x1b')]?_[_0xb576('0x1c')](_0x23d3e7[_0xb576('0x1b')],function(_0x5c343f){return{'model':db[_0x5c343f[_0xb576('0x1d')]],'as':_0x5c343f['as'],'attributes':_0x5c343f[_0xb576('0x19')],'include':_0x5c343f[_0xb576('0x1b')]?_[_0xb576('0x1c')](_0x5c343f[_0xb576('0x1b')],function(_0x46863c){return{'model':db[_0x46863c[_0xb576('0x1d')]],'as':_0x46863c['as'],'attributes':_0x46863c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb576('0xa')](function(_0x6cd45e){logger[_0xb576('0xb')](_0xb576('0x14'),_0x5406c9);logger[_0xb576('0xd')]('GetMemberReport',_0x5406c9,JSON[_0xb576('0xf')](_0x6cd45e));_0x394d7e(_0x6cd45e);})['catch'](function(_0xc6cbc){logger[_0xb576('0x10')](_0xb576('0x14'),_0xc6cbc[_0xb576('0x11')],_0x5406c9);_0x3da216(_0x52a0ca[_0xb576('0x10')](0x1f4,_0xc6cbc['message']));});});};exports[_0xb576('0x1e')]=function(_0x5e3860){var _0x2f4e6c=this;return new Promise(function(_0x215d52,_0x549815){return db[_0xb576('0x15')][_0xb576('0x1f')](_0x5e3860[_0xb576('0x20')],{'raw':_0x5e3860['options']?_0x5e3860['options']['raw']===undefined?!![]:![]:!![]})[_0xb576('0xa')](function(_0x3f7fc6){logger[_0xb576('0xb')](_0xb576('0x1e'),_0x5e3860);logger[_0xb576('0xd')](_0xb576('0x1e'),_0x5e3860,JSON[_0xb576('0xf')](_0x3f7fc6));_0x215d52(_0x3f7fc6);})[_0xb576('0x13')](function(_0x1be7ab){logger['error'](_0xb576('0x1e'),_0x1be7ab['message'],_0x5e3860);_0x549815(_0x2f4e6c['error'](0x1f4,_0x1be7ab[_0xb576('0x11')]));});});};exports[_0xb576('0x21')]=function(_0x1e446a){var _0x55738f=this;return new Promise(function(_0x231495,_0x2c32c4){return db['MemberReport'][_0xb576('0x22')](_0x1e446a[_0xb576('0x20')],{'raw':_0x1e446a[_0xb576('0x18')]?_0x1e446a[_0xb576('0x18')][_0xb576('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e446a[_0xb576('0x18')]?_0x1e446a[_0xb576('0x18')][_0xb576('0x17')]||null:null,'attributes':_0x1e446a[_0xb576('0x18')]?_0x1e446a[_0xb576('0x18')][_0xb576('0x19')]||null:null,'limit':_0x1e446a['options']?_0x1e446a['options'][_0xb576('0x1a')]||null:null})['then'](function(_0x1f1086){logger[_0xb576('0xb')](_0xb576('0x21'),_0x1e446a);logger[_0xb576('0xd')]('UpdateMemberReport',_0x1e446a,JSON[_0xb576('0xf')](_0x1f1086));_0x231495(_0x1f1086);})['catch'](function(_0x66dd5d){logger[_0xb576('0x10')](_0xb576('0x21'),_0x66dd5d['message'],_0x1e446a);_0x2c32c4(_0x55738f[_0xb576('0x10')](0x1f4,_0x66dd5d['message']));});});}; \ No newline at end of file +var _0x82f8=['rpc','../../config/environment','jayson/promise','request','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetMemberReport','options','raw','where','attributes','limit','include','model','map','then','debug','CreateMemberReport','MemberReport','body','update','UpdateMemberReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x438990,_0x5ba134){var _0x1b1c6a=function(_0x458f9c){while(--_0x458f9c){_0x438990['push'](_0x438990['shift']());}};_0x1b1c6a(++_0x5ba134);}(_0x82f8,0x157));var _0x882f=function(_0x40ab5b,_0x4d56e6){_0x40ab5b=_0x40ab5b-0x0;var _0x38d9a2=_0x82f8[_0x40ab5b];return _0x38d9a2;};'use strict';var _=require('lodash');var util=require(_0x882f('0x0'));var moment=require(_0x882f('0x1'));var BPromise=require('bluebird');var rs=require(_0x882f('0x2'));var fs=require('fs');var Redis=require(_0x882f('0x3'));var db=require(_0x882f('0x4'))['db'];var utils=require(_0x882f('0x5'));var logger=require(_0x882f('0x6'))(_0x882f('0x7'));var config=require(_0x882f('0x8'));var jayson=require(_0x882f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c414d,_0x2c7ade,_0x3efa94){return new BPromise(function(_0x2e6f92,_0x4f9dd6){return client[_0x882f('0xa')](_0x3c414d,_0x3efa94)['then'](function(_0x29c3e8){logger['info'](_0x882f('0xb'),_0x2c7ade,'request\x20sent');logger['debug'](_0x882f('0xc'),_0x2c7ade,_0x882f('0xd'),JSON[_0x882f('0xe')](_0x29c3e8));if(_0x29c3e8[_0x882f('0xf')]){if(_0x29c3e8[_0x882f('0xf')]['code']===0x1f4){logger['error'](_0x882f('0xb'),_0x2c7ade,_0x29c3e8[_0x882f('0xf')][_0x882f('0x10')]);return _0x4f9dd6(_0x29c3e8[_0x882f('0xf')][_0x882f('0x10')]);}logger[_0x882f('0xf')](_0x882f('0xb'),_0x2c7ade,_0x29c3e8['error'][_0x882f('0x10')]);return _0x2e6f92(_0x29c3e8[_0x882f('0xf')][_0x882f('0x10')]);}else{logger[_0x882f('0x11')]('MemberReport,\x20%s,\x20%s',_0x2c7ade,'request\x20sent');_0x2e6f92(_0x29c3e8['result'][_0x882f('0x10')]);}})[_0x882f('0x12')](function(_0x3357ef){logger[_0x882f('0xf')](_0x882f('0xb'),_0x2c7ade,_0x3357ef);_0x4f9dd6(_0x3357ef);});});}exports[_0x882f('0x13')]=function(_0x3bd47c){var _0x67cc4b=this;return new Promise(function(_0x544fd5,_0x3e4847){return db['MemberReport']['findAll']({'raw':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')][_0x882f('0x15')]===undefined?!![]:![]:!![],'where':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c['options'][_0x882f('0x16')]||null:null,'attributes':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')][_0x882f('0x17')]||null:null,'limit':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')][_0x882f('0x18')]||null:null,'include':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')]['include']?_['map'](_0x3bd47c['options'][_0x882f('0x19')],function(_0x2c44e5){return{'model':db[_0x2c44e5[_0x882f('0x1a')]],'as':_0x2c44e5['as'],'attributes':_0x2c44e5[_0x882f('0x17')],'include':_0x2c44e5[_0x882f('0x19')]?_[_0x882f('0x1b')](_0x2c44e5[_0x882f('0x19')],function(_0x2d6f58){return{'model':db[_0x2d6f58[_0x882f('0x1a')]],'as':_0x2d6f58['as'],'attributes':_0x2d6f58['attributes'],'include':_0x2d6f58[_0x882f('0x19')]?_[_0x882f('0x1b')](_0x2d6f58['include'],function(_0x48c52b){return{'model':db[_0x48c52b[_0x882f('0x1a')]],'as':_0x48c52b['as'],'attributes':_0x48c52b[_0x882f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x882f('0x1c')](function(_0x4cf987){logger[_0x882f('0x11')](_0x882f('0x13'),_0x3bd47c);logger[_0x882f('0x1d')](_0x882f('0x13'),_0x3bd47c,JSON['stringify'](_0x4cf987));_0x544fd5(_0x4cf987);})[_0x882f('0x12')](function(_0x31d0b7){logger[_0x882f('0xf')](_0x882f('0x13'),_0x31d0b7[_0x882f('0x10')],_0x3bd47c);_0x3e4847(_0x67cc4b[_0x882f('0xf')](0x1f4,_0x31d0b7[_0x882f('0x10')]));});});};exports[_0x882f('0x1e')]=function(_0x299f62){var _0x46cb78=this;return new Promise(function(_0x97706f,_0x292532){return db[_0x882f('0x1f')]['create'](_0x299f62[_0x882f('0x20')],{'raw':_0x299f62['options']?_0x299f62[_0x882f('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x20aa1c){logger[_0x882f('0x11')]('CreateMemberReport',_0x299f62);logger[_0x882f('0x1d')](_0x882f('0x1e'),_0x299f62,JSON[_0x882f('0xe')](_0x20aa1c));_0x97706f(_0x20aa1c);})[_0x882f('0x12')](function(_0x4910ab){logger[_0x882f('0xf')]('CreateMemberReport',_0x4910ab['message'],_0x299f62);_0x292532(_0x46cb78['error'](0x1f4,_0x4910ab[_0x882f('0x10')]));});});};exports['UpdateMemberReport']=function(_0x2080ac){var _0x8ce14b=this;return new Promise(function(_0x496804,_0x5de26e){return db[_0x882f('0x1f')][_0x882f('0x21')](_0x2080ac['body'],{'raw':_0x2080ac[_0x882f('0x14')]?_0x2080ac[_0x882f('0x14')][_0x882f('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2080ac[_0x882f('0x14')]?_0x2080ac[_0x882f('0x14')]['where']||null:null,'attributes':_0x2080ac[_0x882f('0x14')]?_0x2080ac[_0x882f('0x14')][_0x882f('0x17')]||null:null,'limit':_0x2080ac[_0x882f('0x14')]?_0x2080ac[_0x882f('0x14')][_0x882f('0x18')]||null:null})[_0x882f('0x1c')](function(_0x328582){logger['info'](_0x882f('0x22'),_0x2080ac);logger[_0x882f('0x1d')](_0x882f('0x22'),_0x2080ac,JSON[_0x882f('0xe')](_0x328582));_0x496804(_0x328582);})[_0x882f('0x12')](function(_0x40a82f){logger[_0x882f('0xf')](_0x882f('0x22'),_0x40a82f['message'],_0x2080ac);_0x5de26e(_0x8ce14b[_0x882f('0xf')](0x1f4,_0x40a82f[_0x882f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d13e719..f0e66d3 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 _0x1501=['../../components/interaction/service','./migration.controller','index','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x6e6df4,_0x99b7ce){var _0x47e3ba=function(_0x468a15){while(--_0x468a15){_0x6e6df4['push'](_0x6e6df4['shift']());}};_0x47e3ba(++_0x99b7ce);}(_0x1501,0x126));var _0x1150=function(_0x25b78d,_0x347586){_0x25b78d=_0x25b78d-0x0;var _0x3d04f5=_0x1501[_0x25b78d];return _0x3d04f5;};'use strict';var multer=require('multer');var util=require(_0x1150('0x0'));var path=require(_0x1150('0x1'));var timeout=require(_0x1150('0x2'));var express=require('express');var router=express[_0x1150('0x3')]();var fs_extra=require(_0x1150('0x4'));var auth=require(_0x1150('0x5'));var interaction=require(_0x1150('0x6'));var config=require('../../config/environment');var controller=require(_0x1150('0x7'));router['get']('/',controller[_0x1150('0x8')]);module[_0x1150('0x9')]=router; \ No newline at end of file +var _0x3568=['../../config/environment','./migration.controller','index','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x19c7f6,_0x58b59a){var _0x509752=function(_0x32743d){while(--_0x32743d){_0x19c7f6['push'](_0x19c7f6['shift']());}};_0x509752(++_0x58b59a);}(_0x3568,0xc2));var _0x8356=function(_0xf94319,_0x265b0c){_0xf94319=_0xf94319-0x0;var _0x51d561=_0x3568[_0xf94319];return _0x51d561;};'use strict';var multer=require(_0x8356('0x0'));var util=require(_0x8356('0x1'));var path=require('path');var timeout=require(_0x8356('0x2'));var express=require(_0x8356('0x3'));var router=express['Router']();var fs_extra=require(_0x8356('0x4'));var auth=require(_0x8356('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8356('0x6'));var controller=require(_0x8356('0x7'));router['get']('/',controller[_0x8356('0x8')]);module[_0x8356('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index ed2ec63..656ac9a 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 _0x9c0e=['version','exports'];(function(_0x17073a,_0x49b061){var _0x4c4259=function(_0xaf556d){while(--_0xaf556d){_0x17073a['push'](_0x17073a['shift']());}};_0x4c4259(++_0x49b061);}(_0x9c0e,0x1b5));var _0xe9c0=function(_0x546b53,_0x1304b4){_0x546b53=_0x546b53-0x0;var _0x56a74f=_0x9c0e[_0x546b53];return _0x56a74f;};'use strict';var Sequelize=require('sequelize');module[_0xe9c0('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xe9c0('0x1')}}; \ No newline at end of file +var _0xe9cf=['sequelize','exports','STRING'];(function(_0x402b27,_0x11547f){var _0x2c654d=function(_0x29b6cd){while(--_0x29b6cd){_0x402b27['push'](_0x402b27['shift']());}};_0x2c654d(++_0x11547f);}(_0xe9cf,0x102));var _0xfe9c=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xe9cf[_0x498334];return _0x13bb70;};'use strict';var Sequelize=require(_0xfe9c('0x0'));module[_0xfe9c('0x1')]={'version':{'type':Sequelize[_0xfe9c('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 754b3df..307e918 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 _0xec1d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','Migration','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3cb00c,_0xe8f03e){var _0x38896c=function(_0x4bd7d5){while(--_0x4bd7d5){_0x3cb00c['push'](_0x3cb00c['shift']());}};_0x38896c(++_0xe8f03e);}(_0xec1d,0x145));var _0xdec1=function(_0x3f5464,_0x231d62){_0x3f5464=_0x3f5464-0x0;var _0x22da42=_0xec1d[_0x3f5464];return _0x22da42;};'use strict';var emlformat=require(_0xdec1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdec1('0x1'));var jsonpatch=require(_0xdec1('0x2'));var rp=require('request-promise');var moment=require(_0xdec1('0x3'));var BPromise=require(_0xdec1('0x4'));var Mustache=require(_0xdec1('0x5'));var util=require(_0xdec1('0x6'));var path=require('path');var sox=require(_0xdec1('0x7'));var csv=require(_0xdec1('0x8'));var ejs=require(_0xdec1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdec1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdec1('0xb'));var deskjs=require(_0xdec1('0xc'));var toCsv=require(_0xdec1('0x8'));var querystring=require(_0xdec1('0xd'));var Papa=require(_0xdec1('0xe'));var Redis=require(_0xdec1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdec1('0x10'));var as=require(_0xdec1('0x11'));var hardwareService=require(_0xdec1('0x12'));var logger=require(_0xdec1('0x13'))(_0xdec1('0x14'));var utils=require(_0xdec1('0x15'));var config=require(_0xdec1('0x16'));var licenseUtil=require(_0xdec1('0x17'));var db=require(_0xdec1('0x18'))['db'];function respondWithStatusCode(_0x5120dc,_0x2f8283){_0x2f8283=_0x2f8283||0xcc;return function(_0x103b4c){if(_0x103b4c){return _0x5120dc[_0xdec1('0x19')](_0x2f8283);}return _0x5120dc[_0xdec1('0x1a')](_0x2f8283)[_0xdec1('0x1b')]();};}function respondWithResult(_0x2599de,_0x58055b){_0x58055b=_0x58055b||0xc8;return function(_0x5c0ef5){if(_0x5c0ef5){return _0x2599de[_0xdec1('0x1a')](_0x58055b)[_0xdec1('0x1c')](_0x5c0ef5);}};}function respondWithFilteredResult(_0x45d381,_0x352796){return function(_0x1e27ea){if(_0x1e27ea){var _0x43a0ac=typeof _0x352796['offset']===_0xdec1('0x1d')&&typeof _0x352796[_0xdec1('0x1e')]===_0xdec1('0x1d');var _0x37ab9e=_0x1e27ea[_0xdec1('0x1f')];var _0x40edde=_0x43a0ac?0x0:_0x352796[_0xdec1('0x20')];var _0x177b88=_0x43a0ac?_0x1e27ea[_0xdec1('0x1f')]:_0x352796['offset']+_0x352796[_0xdec1('0x1e')];var _0x2250ff;if(_0x177b88>=_0x37ab9e){_0x177b88=_0x37ab9e;_0x2250ff=0xc8;}else{_0x2250ff=0xce;}_0x45d381['status'](_0x2250ff);return _0x45d381[_0xdec1('0x21')](_0xdec1('0x22'),_0x40edde+'-'+_0x177b88+'/'+_0x37ab9e)['json'](_0x1e27ea);}return null;};}function patchUpdates(_0x537c93){return function(_0x2d0608){try{jsonpatch['apply'](_0x2d0608,_0x537c93,!![]);}catch(_0x55919){return BPromise[_0xdec1('0x23')](_0x55919);}return _0x2d0608[_0xdec1('0x24')]();};}function saveUpdates(_0x2c25f2,_0x2a8018){return function(_0x2d5875){if(_0x2d5875){return _0x2d5875[_0xdec1('0x25')](_0x2c25f2)['then'](function(_0x13c98c){return _0x13c98c;});}return null;};}function removeEntity(_0x5d64c4,_0x207e0c){return function(_0xac8ca3){if(_0xac8ca3){return _0xac8ca3[_0xdec1('0x26')]()[_0xdec1('0x27')](function(){_0x5d64c4[_0xdec1('0x1a')](0xcc)[_0xdec1('0x1b')]();});}};}function handleEntityNotFound(_0xc944e0,_0x78b85b){return function(_0x231e2a){if(!_0x231e2a){_0xc944e0['sendStatus'](0x194);}return _0x231e2a;};}function handleError(_0x4b893c,_0x44497a){_0x44497a=_0x44497a||0x1f4;return function(_0x58d34b){logger['error'](_0x58d34b['stack']);if(_0x58d34b[_0xdec1('0x28')]){delete _0x58d34b['name'];}_0x4b893c[_0xdec1('0x1a')](_0x44497a)[_0xdec1('0x29')](_0x58d34b);};}exports['index']=function(_0x239ecd,_0x3e3529){var _0x100612={},_0x518d0a={},_0x269640={'count':0x0,'rows':[]};var _0x4636e7=_['map'](db['Migration'][_0xdec1('0x2a')],function(_0x8049a7){return{'name':_0x8049a7[_0xdec1('0x2b')],'type':_0x8049a7[_0xdec1('0x2c')][_0xdec1('0x2d')]};});_0x518d0a[_0xdec1('0x2e')]=_['map'](_0x4636e7,'name');_0x518d0a[_0xdec1('0x2f')]=_[_0xdec1('0x30')](_0x239ecd[_0xdec1('0x2f')]);_0x518d0a[_0xdec1('0x31')]=_[_0xdec1('0x32')](_0x518d0a[_0xdec1('0x2e')],_0x518d0a[_0xdec1('0x2f')]);_0x100612['attributes']=_[_0xdec1('0x32')](_0x518d0a[_0xdec1('0x2e')],qs[_0xdec1('0x33')](_0x239ecd[_0xdec1('0x2f')]['fields']));_0x100612[_0xdec1('0x34')]=_0x100612['attributes']['length']?_0x100612[_0xdec1('0x34')]:_0x518d0a[_0xdec1('0x2e')];if(!_0x239ecd[_0xdec1('0x2f')]['hasOwnProperty'](_0xdec1('0x35'))){_0x100612['limit']=qs['limit'](_0x239ecd['query']['limit']);_0x100612[_0xdec1('0x20')]=qs[_0xdec1('0x20')](_0x239ecd['query'][_0xdec1('0x20')]);}_0x100612[_0xdec1('0x36')]=qs[_0xdec1('0x37')](_0x239ecd[_0xdec1('0x2f')][_0xdec1('0x37')]);_0x100612[_0xdec1('0x38')]=qs[_0xdec1('0x31')](_[_0xdec1('0x39')](_0x239ecd[_0xdec1('0x2f')],_0x518d0a[_0xdec1('0x31')]),_0x4636e7);if(_0x239ecd[_0xdec1('0x2f')][_0xdec1('0x3a')]){_0x100612['where']=_[_0xdec1('0x3b')](_0x100612['where'],{'$or':_[_0xdec1('0x3c')](_0x4636e7,function(_0x133233){if(_0x133233['type']!==_0xdec1('0x3d')){var _0x4b0a97={};_0x4b0a97[_0x133233['name']]={'$like':'%'+_0x239ecd[_0xdec1('0x2f')][_0xdec1('0x3a')]+'%'};return _0x4b0a97;}})});}_0x100612=_[_0xdec1('0x3b')]({},_0x100612,_0x239ecd[_0xdec1('0x3e')]);var _0x1963d7={'where':_0x100612['where']};return db[_0xdec1('0x3f')]['count'](_0x1963d7)['then'](function(_0x53db2a){_0x269640[_0xdec1('0x1f')]=_0x53db2a;if(_0x239ecd[_0xdec1('0x2f')][_0xdec1('0x40')]){_0x100612[_0xdec1('0x41')]=[{'all':!![]}];}return db[_0xdec1('0x3f')][_0xdec1('0x42')](_0x100612);})[_0xdec1('0x27')](function(_0x466c3d){_0x269640[_0xdec1('0x43')]=_0x466c3d;return _0x269640;})[_0xdec1('0x27')](respondWithFilteredResult(_0x3e3529,_0x100612))[_0xdec1('0x44')](handleError(_0x3e3529,null));}; \ No newline at end of file +var _0x5871=['crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','status','error','stack','name','map','Migration','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0xab1eba,_0x40ee48){var _0x34c169=function(_0x32d79d){while(--_0x32d79d){_0xab1eba['push'](_0xab1eba['shift']());}};_0x34c169(++_0x40ee48);}(_0x5871,0x1d5));var _0x1587=function(_0x1dda7d,_0x4debb8){_0x1dda7d=_0x1dda7d-0x0;var _0x208176=_0x5871[_0x1dda7d];return _0x208176;};'use strict';var emlformat=require(_0x1587('0x0'));var rimraf=require(_0x1587('0x1'));var zipdir=require(_0x1587('0x2'));var jsonpatch=require(_0x1587('0x3'));var rp=require(_0x1587('0x4'));var moment=require(_0x1587('0x5'));var BPromise=require(_0x1587('0x6'));var Mustache=require('mustache');var util=require(_0x1587('0x7'));var path=require(_0x1587('0x8'));var sox=require(_0x1587('0x9'));var csv=require(_0x1587('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1587('0xb'));var _=require(_0x1587('0xc'));var squel=require(_0x1587('0xd'));var crypto=require(_0x1587('0xe'));var jsforce=require(_0x1587('0xf'));var deskjs=require(_0x1587('0x10'));var toCsv=require(_0x1587('0xa'));var querystring=require(_0x1587('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1587('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1587('0x13'));var hardwareService=require(_0x1587('0x14'));var logger=require(_0x1587('0x15'))(_0x1587('0x16'));var utils=require(_0x1587('0x17'));var config=require(_0x1587('0x18'));var licenseUtil=require(_0x1587('0x19'));var db=require(_0x1587('0x1a'))['db'];function respondWithStatusCode(_0x4a4ad1,_0x14c35e){_0x14c35e=_0x14c35e||0xcc;return function(_0x1fa9cb){if(_0x1fa9cb){return _0x4a4ad1[_0x1587('0x1b')](_0x14c35e);}return _0x4a4ad1['status'](_0x14c35e)[_0x1587('0x1c')]();};}function respondWithResult(_0x5d890e,_0x4f14a0){_0x4f14a0=_0x4f14a0||0xc8;return function(_0x1ed806){if(_0x1ed806){return _0x5d890e['status'](_0x4f14a0)[_0x1587('0x1d')](_0x1ed806);}};}function respondWithFilteredResult(_0x5d9326,_0x25da42){return function(_0x11c796){if(_0x11c796){var _0x59b8a3=typeof _0x25da42[_0x1587('0x1e')]===_0x1587('0x1f')&&typeof _0x25da42['limit']==='undefined';var _0x567463=_0x11c796[_0x1587('0x20')];var _0x283061=_0x59b8a3?0x0:_0x25da42[_0x1587('0x1e')];var _0x42e351=_0x59b8a3?_0x11c796['count']:_0x25da42[_0x1587('0x1e')]+_0x25da42[_0x1587('0x21')];var _0x52dc74;if(_0x42e351>=_0x567463){_0x42e351=_0x567463;_0x52dc74=0xc8;}else{_0x52dc74=0xce;}_0x5d9326['status'](_0x52dc74);return _0x5d9326['set'](_0x1587('0x22'),_0x283061+'-'+_0x42e351+'/'+_0x567463)['json'](_0x11c796);}return null;};}function patchUpdates(_0x254e7c){return function(_0x33414a){try{jsonpatch[_0x1587('0x23')](_0x33414a,_0x254e7c,!![]);}catch(_0x342a31){return BPromise[_0x1587('0x24')](_0x342a31);}return _0x33414a[_0x1587('0x25')]();};}function saveUpdates(_0x20437e,_0x5c11a2){return function(_0x4ae858){if(_0x4ae858){return _0x4ae858[_0x1587('0x26')](_0x20437e)['then'](function(_0x119909){return _0x119909;});}return null;};}function removeEntity(_0x19f8ba,_0x540bef){return function(_0x499f06){if(_0x499f06){return _0x499f06[_0x1587('0x27')]()[_0x1587('0x28')](function(){_0x19f8ba[_0x1587('0x29')](0xcc)[_0x1587('0x1c')]();});}};}function handleEntityNotFound(_0x54ffe8,_0x392e49){return function(_0x137392){if(!_0x137392){_0x54ffe8[_0x1587('0x1b')](0x194);}return _0x137392;};}function handleError(_0x37b770,_0x1f79c1){_0x1f79c1=_0x1f79c1||0x1f4;return function(_0x52696b){logger[_0x1587('0x2a')](_0x52696b[_0x1587('0x2b')]);if(_0x52696b[_0x1587('0x2c')]){delete _0x52696b[_0x1587('0x2c')];}_0x37b770[_0x1587('0x29')](_0x1f79c1)['send'](_0x52696b);};}exports['index']=function(_0x4874d8,_0x3caf5f){var _0x4f19ee={},_0x584f57={},_0x4c45c0={'count':0x0,'rows':[]};var _0x138735=_[_0x1587('0x2d')](db[_0x1587('0x2e')]['rawAttributes'],function(_0x3d5bb5){return{'name':_0x3d5bb5[_0x1587('0x2f')],'type':_0x3d5bb5['type'][_0x1587('0x30')]};});_0x584f57['model']=_[_0x1587('0x2d')](_0x138735,_0x1587('0x2c'));_0x584f57['query']=_[_0x1587('0x31')](_0x4874d8[_0x1587('0x32')]);_0x584f57[_0x1587('0x33')]=_[_0x1587('0x34')](_0x584f57[_0x1587('0x35')],_0x584f57[_0x1587('0x32')]);_0x4f19ee[_0x1587('0x36')]=_[_0x1587('0x34')](_0x584f57['model'],qs[_0x1587('0x37')](_0x4874d8[_0x1587('0x32')][_0x1587('0x37')]));_0x4f19ee[_0x1587('0x36')]=_0x4f19ee[_0x1587('0x36')]['length']?_0x4f19ee['attributes']:_0x584f57['model'];if(!_0x4874d8['query'][_0x1587('0x38')](_0x1587('0x39'))){_0x4f19ee[_0x1587('0x21')]=qs[_0x1587('0x21')](_0x4874d8[_0x1587('0x32')][_0x1587('0x21')]);_0x4f19ee[_0x1587('0x1e')]=qs[_0x1587('0x1e')](_0x4874d8[_0x1587('0x32')][_0x1587('0x1e')]);}_0x4f19ee[_0x1587('0x3a')]=qs[_0x1587('0x3b')](_0x4874d8['query']['sort']);_0x4f19ee[_0x1587('0x3c')]=qs[_0x1587('0x33')](_[_0x1587('0x3d')](_0x4874d8[_0x1587('0x32')],_0x584f57[_0x1587('0x33')]),_0x138735);if(_0x4874d8[_0x1587('0x32')][_0x1587('0x3e')]){_0x4f19ee['where']=_[_0x1587('0x3f')](_0x4f19ee[_0x1587('0x3c')],{'$or':_[_0x1587('0x2d')](_0x138735,function(_0x4edbf7){if(_0x4edbf7[_0x1587('0x40')]!==_0x1587('0x41')){var _0x5a859f={};_0x5a859f[_0x4edbf7[_0x1587('0x2c')]]={'$like':'%'+_0x4874d8[_0x1587('0x32')][_0x1587('0x3e')]+'%'};return _0x5a859f;}})});}_0x4f19ee=_[_0x1587('0x3f')]({},_0x4f19ee,_0x4874d8['options']);var _0x4d17dd={'where':_0x4f19ee[_0x1587('0x3c')]};return db[_0x1587('0x2e')][_0x1587('0x20')](_0x4d17dd)[_0x1587('0x28')](function(_0x5bf20d){_0x4c45c0[_0x1587('0x20')]=_0x5bf20d;if(_0x4874d8[_0x1587('0x32')][_0x1587('0x42')]){_0x4f19ee[_0x1587('0x43')]=[{'all':!![]}];}return db[_0x1587('0x2e')]['findAll'](_0x4f19ee);})[_0x1587('0x28')](function(_0x4eea69){_0x4c45c0[_0x1587('0x44')]=_0x4eea69;return _0x4c45c0;})[_0x1587('0x28')](respondWithFilteredResult(_0x3caf5f,_0x4f19ee))['catch'](handleError(_0x3caf5f,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 27d3e4c..93e8169 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 _0x343e=['define','migrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x343e,0xec));var _0xe343=function(_0x17a93a,_0x1af366){_0x17a93a=_0x17a93a-0x0;var _0x43223c=_0x343e[_0x17a93a];return _0x43223c;};'use strict';var _=require(_0xe343('0x0'));var util=require(_0xe343('0x1'));var logger=require(_0xe343('0x2'))(_0xe343('0x3'));var moment=require(_0xe343('0x4'));var BPromise=require(_0xe343('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe343('0x6'));var rimraf=require(_0xe343('0x7'));var config=require(_0xe343('0x8'));var attributes=require(_0xe343('0x9'));module[_0xe343('0xa')]=function(_0xbf0b8e,_0x2a31b7){return _0xbf0b8e[_0xe343('0xb')]('Migration',attributes,{'tableName':_0xe343('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f16=['moment','request-promise','rimraf','../../config/environment','exports','define','Migration','migrations','lodash'];(function(_0xf10e41,_0x36d4ad){var _0x598dee=function(_0x5736bd){while(--_0x5736bd){_0xf10e41['push'](_0xf10e41['shift']());}};_0x598dee(++_0x36d4ad);}(_0x8f16,0x1c1));var _0x68f1=function(_0x50755f,_0x4d3b5e){_0x50755f=_0x50755f-0x0;var _0x29233e=_0x8f16[_0x50755f];return _0x29233e;};'use strict';var _=require(_0x68f1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x68f1('0x1'));var BPromise=require('bluebird');var rp=require(_0x68f1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68f1('0x3'));var config=require(_0x68f1('0x4'));var attributes=require('./migration.attributes');module[_0x68f1('0x5')]=function(_0x414fa2,_0x2fe44d){return _0x414fa2[_0x68f1('0x6')](_0x68f1('0x7'),attributes,{'tableName':_0x68f1('0x8'),'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 1d419f4..55e307e 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 _0x8efc=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8efc,0xb3));var _0xc8ef=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0x8efc[_0x5a7618];return _0x12dc65;};'use strict';var _=require('lodash');var util=require(_0xc8ef('0x0'));var moment=require(_0xc8ef('0x1'));var BPromise=require(_0xc8ef('0x2'));var rs=require(_0xc8ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8ef('0x4'))['db'];var utils=require(_0xc8ef('0x5'));var logger=require(_0xc8ef('0x6'))('rpc');var config=require(_0xc8ef('0x7'));var jayson=require(_0xc8ef('0x8'));var client=jayson[_0xc8ef('0x9')][_0xc8ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576ff9,_0x1fa519,_0x3d06cd){return new BPromise(function(_0x1c8931,_0x489778){return client[_0xc8ef('0xb')](_0x576ff9,_0x3d06cd)[_0xc8ef('0xc')](function(_0x1a9a5f){logger[_0xc8ef('0xd')]('Migration,\x20%s,\x20%s',_0x1fa519,_0xc8ef('0xe'));logger['debug'](_0xc8ef('0xf'),_0x1fa519,_0xc8ef('0xe'),JSON[_0xc8ef('0x10')](_0x1a9a5f));if(_0x1a9a5f[_0xc8ef('0x11')]){if(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x12')]===0x1f4){logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);return _0x489778(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);}logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);return _0x1c8931(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);}else{logger[_0xc8ef('0xd')](_0xc8ef('0x13'),_0x1fa519,_0xc8ef('0xe'));_0x1c8931(_0x1a9a5f[_0xc8ef('0x15')]['message']);}})[_0xc8ef('0x16')](function(_0x332e70){logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x332e70);_0x489778(_0x332e70);});});} \ No newline at end of file +var _0x9755=['client','http','request','then','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x201e54,_0x1d6073){var _0x1701b3=function(_0x422317){while(--_0x422317){_0x201e54['push'](_0x201e54['shift']());}};_0x1701b3(++_0x1d6073);}(_0x9755,0x1c6));var _0x5975=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x9755[_0x1304c6];return _0x2e6654;};'use strict';var _=require(_0x5975('0x0'));var util=require('util');var moment=require(_0x5975('0x1'));var BPromise=require(_0x5975('0x2'));var rs=require(_0x5975('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5975('0x4'))(_0x5975('0x5'));var config=require(_0x5975('0x6'));var jayson=require(_0x5975('0x7'));var client=jayson[_0x5975('0x8')][_0x5975('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365ac3,_0x56fc2e,_0x48d8b5){return new BPromise(function(_0x2209f1,_0x55e597){return client[_0x5975('0xa')](_0x365ac3,_0x48d8b5)[_0x5975('0xb')](function(_0x15ebfd){logger['info'](_0x5975('0xc'),_0x56fc2e,'request\x20sent');logger['debug'](_0x5975('0xd'),_0x56fc2e,_0x5975('0xe'),JSON[_0x5975('0xf')](_0x15ebfd));if(_0x15ebfd['error']){if(_0x15ebfd[_0x5975('0x10')][_0x5975('0x11')]===0x1f4){logger[_0x5975('0x10')]('Migration,\x20%s,\x20%s',_0x56fc2e,_0x15ebfd[_0x5975('0x10')][_0x5975('0x12')]);return _0x55e597(_0x15ebfd[_0x5975('0x10')][_0x5975('0x12')]);}logger['error']('Migration,\x20%s,\x20%s',_0x56fc2e,_0x15ebfd[_0x5975('0x10')][_0x5975('0x12')]);return _0x2209f1(_0x15ebfd[_0x5975('0x10')]['message']);}else{logger[_0x5975('0x13')]('Migration,\x20%s,\x20%s',_0x56fc2e,_0x5975('0xe'));_0x2209f1(_0x15ebfd['result'][_0x5975('0x12')]);}})[_0x5975('0x14')](function(_0x16706c){logger[_0x5975('0x10')](_0x5975('0xc'),_0x56fc2e,_0x16706c);_0x55e597(_0x16706c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 1832847..f984680 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 _0xd48e=['put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create'];(function(_0x1be537,_0x2e75b0){var _0x5e2824=function(_0x300dc0){while(--_0x300dc0){_0x1be537['push'](_0x1be537['shift']());}};_0x5e2824(++_0x2e75b0);}(_0xd48e,0x93));var _0xed48=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xd48e[_0x166742];return _0xb7814a;};'use strict';var multer=require('multer');var util=require(_0xed48('0x0'));var path=require(_0xed48('0x1'));var timeout=require(_0xed48('0x2'));var express=require(_0xed48('0x3'));var router=express[_0xed48('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed48('0x5'));var interaction=require(_0xed48('0x6'));var config=require(_0xed48('0x7'));var controller=require('./network.controller');router[_0xed48('0x8')]('/',auth[_0xed48('0x9')](),controller[_0xed48('0xa')]);router['get'](_0xed48('0xb'),auth[_0xed48('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xed48('0xc')]);router[_0xed48('0xd')](_0xed48('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xed48('0xe')](_0xed48('0xb'),auth[_0xed48('0x9')](),controller['destroy']);module[_0xed48('0xf')]=router; \ No newline at end of file +var _0x5919=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','post','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5919,0x15d));var _0x9591=function(_0xf1b134,_0xb399dd){_0xf1b134=_0xf1b134-0x0;var _0x139dbb=_0x5919[_0xf1b134];return _0x139dbb;};'use strict';var multer=require(_0x9591('0x0'));var util=require(_0x9591('0x1'));var path=require('path');var timeout=require(_0x9591('0x2'));var express=require(_0x9591('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9591('0x4'));var interaction=require(_0x9591('0x5'));var config=require(_0x9591('0x6'));var controller=require(_0x9591('0x7'));router[_0x9591('0x8')]('/',auth[_0x9591('0x9')](),controller['index']);router[_0x9591('0x8')](_0x9591('0xa'),auth[_0x9591('0x9')](),controller['show']);router[_0x9591('0xb')]('/',auth[_0x9591('0x9')](),controller['create']);router['put']('/:id',auth[_0x9591('0x9')](),controller[_0x9591('0xc')]);router[_0x9591('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9591('0xe')]);module[_0x9591('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 238fd2c..5beafe8 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 _0x00f4=['localnet','externip','turn','STRING','exports','ENUM'];(function(_0x4ff42e,_0x3ee69e){var _0x348b96=function(_0x43b4b3){while(--_0x43b4b3){_0x4ff42e['push'](_0x4ff42e['shift']());}};_0x348b96(++_0x3ee69e);}(_0x00f4,0x18a));var _0x400f=function(_0x5246ef,_0x517e8c){_0x5246ef=_0x5246ef-0x0;var _0x134cfa=_0x00f4[_0x5246ef];return _0x134cfa;};'use strict';var Sequelize=require('sequelize');module[_0x400f('0x0')]={'type':{'type':Sequelize[_0x400f('0x1')](_0x400f('0x2'),_0x400f('0x3'),'stun',_0x400f('0x4'))},'value':{'type':Sequelize[_0x400f('0x5')]},'username':{'type':Sequelize[_0x400f('0x5')]},'password':{'type':Sequelize[_0x400f('0x5')]}}; \ No newline at end of file +var _0x02f3=['exports','localnet','externip','STRING','sequelize'];(function(_0x31d77c,_0xa64675){var _0x8e82c2=function(_0xd70987){while(--_0xd70987){_0x31d77c['push'](_0x31d77c['shift']());}};_0x8e82c2(++_0xa64675);}(_0x02f3,0x18a));var _0x302f=function(_0x4bd0f2,_0x34ac02){_0x4bd0f2=_0x4bd0f2-0x0;var _0x56aad8=_0x02f3[_0x4bd0f2];return _0x56aad8;};'use strict';var Sequelize=require(_0x302f('0x0'));module[_0x302f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x302f('0x2'),_0x302f('0x3'),'stun','turn')},'value':{'type':Sequelize[_0x302f('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x302f('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9d482fa..839592e 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 _0x2bce=['toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','offset','undefined','limit','count','Content-Range','json','reject','destroy','sendStatus','stack','name','send','map','Network','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','body','chan_sip.so','update','sequelize','transaction','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bce,0xd3));var _0xe2bc=function(_0x2c4cdd,_0x12ccaa){_0x2c4cdd=_0x2c4cdd-0x0;var _0x3855f3=_0x2bce[_0x2c4cdd];return _0x3855f3;};'use strict';var emlformat=require(_0xe2bc('0x0'));var rimraf=require(_0xe2bc('0x1'));var zipdir=require(_0xe2bc('0x2'));var jsonpatch=require(_0xe2bc('0x3'));var rp=require(_0xe2bc('0x4'));var moment=require(_0xe2bc('0x5'));var BPromise=require(_0xe2bc('0x6'));var Mustache=require(_0xe2bc('0x7'));var util=require('util');var path=require(_0xe2bc('0x8'));var sox=require(_0xe2bc('0x9'));var csv=require(_0xe2bc('0xa'));var ejs=require(_0xe2bc('0xb'));var fs=require('fs');var fs_extra=require(_0xe2bc('0xc'));var _=require(_0xe2bc('0xd'));var squel=require(_0xe2bc('0xe'));var crypto=require('crypto');var jsforce=require(_0xe2bc('0xf'));var deskjs=require(_0xe2bc('0x10'));var toCsv=require(_0xe2bc('0xa'));var querystring=require(_0xe2bc('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe2bc('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2bc('0x13'));var logger=require(_0xe2bc('0x14'))(_0xe2bc('0x15'));var utils=require('../../config/utils');var config=require(_0xe2bc('0x16'));var licenseUtil=require(_0xe2bc('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe2bc('0x18'));var client=jayson['client'][_0xe2bc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x513116,_0x246d71,_0x62fe14,_0x5c8010){return new BPromise(function(_0x2b784d,_0x4386f0){var _0x2843fd=_0x5c8010||client;return _0x2843fd[_0xe2bc('0x1a')](_0x513116,_0x62fe14)[_0xe2bc('0x1b')](function(_0x4dbdfd){logger[_0xe2bc('0x1c')](_0xe2bc('0x1d'),_0x246d71,_0xe2bc('0x1e'));logger['debug'](_0xe2bc('0x1f'),_0x246d71,_0xe2bc('0x1e'),JSON[_0xe2bc('0x20')](_0x4dbdfd));if(_0x4dbdfd[_0xe2bc('0x21')]){if(_0x4dbdfd['error'][_0xe2bc('0x22')]===0x1f4){logger[_0xe2bc('0x21')](_0xe2bc('0x1d'),_0x246d71,_0x4dbdfd[_0xe2bc('0x21')]['message']);return _0x4386f0(_0x4dbdfd['error'][_0xe2bc('0x23')]);}logger['error']('Network,\x20%s,\x20%s',_0x246d71,_0x4dbdfd[_0xe2bc('0x21')][_0xe2bc('0x23')]);return _0x2b784d(_0x4dbdfd[_0xe2bc('0x21')]['message']);}else{logger[_0xe2bc('0x1c')](_0xe2bc('0x1d'),_0x246d71,_0xe2bc('0x1e'));_0x2b784d(_0x4dbdfd[_0xe2bc('0x24')][_0xe2bc('0x23')]);}})['catch'](function(_0x5e496f){logger[_0xe2bc('0x21')]('Network,\x20%s,\x20%s',_0x246d71,_0x5e496f);_0x4386f0(_0x5e496f);});});}function respondWithStatusCode(_0x1ff571,_0xc579e2){_0xc579e2=_0xc579e2||0xcc;return function(_0xa96ffb){if(_0xa96ffb){return _0x1ff571['sendStatus'](_0xc579e2);}return _0x1ff571[_0xe2bc('0x25')](_0xc579e2)['end']();};}function respondWithResult(_0x1b20cd,_0x54d62f){_0x54d62f=_0x54d62f||0xc8;return function(_0xdd2bee){if(_0xdd2bee){return _0x1b20cd[_0xe2bc('0x25')](_0x54d62f)['json'](_0xdd2bee);}};}function respondWithFilteredResult(_0xfd36d2,_0x4fd536){return function(_0x4ed827){if(_0x4ed827){var _0x59e7c1=typeof _0x4fd536[_0xe2bc('0x26')]===_0xe2bc('0x27')&&typeof _0x4fd536[_0xe2bc('0x28')]===_0xe2bc('0x27');var _0x49a242=_0x4ed827[_0xe2bc('0x29')];var _0x3d8ff6=_0x59e7c1?0x0:_0x4fd536[_0xe2bc('0x26')];var _0x18b317=_0x59e7c1?_0x4ed827[_0xe2bc('0x29')]:_0x4fd536[_0xe2bc('0x26')]+_0x4fd536['limit'];var _0x29ec45;if(_0x18b317>=_0x49a242){_0x18b317=_0x49a242;_0x29ec45=0xc8;}else{_0x29ec45=0xce;}_0xfd36d2['status'](_0x29ec45);return _0xfd36d2['set'](_0xe2bc('0x2a'),_0x3d8ff6+'-'+_0x18b317+'/'+_0x49a242)[_0xe2bc('0x2b')](_0x4ed827);}return null;};}function patchUpdates(_0x5dbaf0){return function(_0x5dec61){try{jsonpatch['apply'](_0x5dec61,_0x5dbaf0,!![]);}catch(_0x840d35){return BPromise[_0xe2bc('0x2c')](_0x840d35);}return _0x5dec61['save']();};}function saveUpdates(_0x4dfb96,_0x3aef8f){return function(_0x59d0d2){if(_0x59d0d2){return _0x59d0d2['update'](_0x4dfb96)[_0xe2bc('0x1b')](function(_0x76e213){return _0x76e213;});}return null;};}function removeEntity(_0x412015,_0x432fa8){return function(_0x244a4c){if(_0x244a4c){return _0x244a4c[_0xe2bc('0x2d')]()[_0xe2bc('0x1b')](function(){_0x412015[_0xe2bc('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x570f0a,_0x90d33b){return function(_0x227abe){if(!_0x227abe){_0x570f0a[_0xe2bc('0x2e')](0x194);}return _0x227abe;};}function handleError(_0x1529bd,_0x42d305){_0x42d305=_0x42d305||0x1f4;return function(_0xbefb5){logger[_0xe2bc('0x21')](_0xbefb5[_0xe2bc('0x2f')]);if(_0xbefb5['name']){delete _0xbefb5[_0xe2bc('0x30')];}_0x1529bd[_0xe2bc('0x25')](_0x42d305)[_0xe2bc('0x31')](_0xbefb5);};}exports['index']=function(_0x392bfa,_0x133758){var _0x1912c4={},_0x50fe6d={},_0x2c69c4={'count':0x0,'rows':[]};var _0x4c3326=_[_0xe2bc('0x32')](db[_0xe2bc('0x33')]['rawAttributes'],function(_0x1b2d74){return{'name':_0x1b2d74['fieldName'],'type':_0x1b2d74['type']['key']};});_0x50fe6d[_0xe2bc('0x34')]=_[_0xe2bc('0x32')](_0x4c3326,_0xe2bc('0x30'));_0x50fe6d[_0xe2bc('0x35')]=_[_0xe2bc('0x36')](_0x392bfa[_0xe2bc('0x35')]);_0x50fe6d[_0xe2bc('0x37')]=_[_0xe2bc('0x38')](_0x50fe6d[_0xe2bc('0x34')],_0x50fe6d[_0xe2bc('0x35')]);_0x1912c4[_0xe2bc('0x39')]=_[_0xe2bc('0x38')](_0x50fe6d[_0xe2bc('0x34')],qs[_0xe2bc('0x3a')](_0x392bfa['query'][_0xe2bc('0x3a')]));_0x1912c4['attributes']=_0x1912c4['attributes'][_0xe2bc('0x3b')]?_0x1912c4[_0xe2bc('0x39')]:_0x50fe6d[_0xe2bc('0x34')];if(!_0x392bfa['query'][_0xe2bc('0x3c')](_0xe2bc('0x3d'))){_0x1912c4[_0xe2bc('0x28')]=qs[_0xe2bc('0x28')](_0x392bfa[_0xe2bc('0x35')][_0xe2bc('0x28')]);_0x1912c4[_0xe2bc('0x26')]=qs[_0xe2bc('0x26')](_0x392bfa[_0xe2bc('0x35')][_0xe2bc('0x26')]);}_0x1912c4[_0xe2bc('0x3e')]=qs[_0xe2bc('0x3f')](_0x392bfa[_0xe2bc('0x35')][_0xe2bc('0x3f')]);_0x1912c4[_0xe2bc('0x40')]=qs[_0xe2bc('0x37')](_[_0xe2bc('0x41')](_0x392bfa['query'],_0x50fe6d[_0xe2bc('0x37')]),_0x4c3326);if(_0x392bfa['query'][_0xe2bc('0x42')]){_0x1912c4['where']=_[_0xe2bc('0x43')](_0x1912c4[_0xe2bc('0x40')],{'$or':_[_0xe2bc('0x32')](_0x4c3326,function(_0x58518d){if(_0x58518d[_0xe2bc('0x44')]!==_0xe2bc('0x45')){var _0x48653b={};_0x48653b[_0x58518d[_0xe2bc('0x30')]]={'$like':'%'+_0x392bfa['query'][_0xe2bc('0x42')]+'%'};return _0x48653b;}})});}_0x1912c4=_[_0xe2bc('0x43')]({},_0x1912c4,_0x392bfa[_0xe2bc('0x46')]);var _0x5cbb29={'where':_0x1912c4[_0xe2bc('0x40')]};return db[_0xe2bc('0x33')][_0xe2bc('0x29')](_0x5cbb29)[_0xe2bc('0x1b')](function(_0x75ef90){_0x2c69c4['count']=_0x75ef90;if(_0x392bfa[_0xe2bc('0x35')][_0xe2bc('0x47')]){_0x1912c4[_0xe2bc('0x48')]=[{'all':!![]}];}return db[_0xe2bc('0x33')][_0xe2bc('0x49')](_0x1912c4);})['then'](function(_0x63513a){_0x2c69c4[_0xe2bc('0x4a')]=_0x63513a;return _0x2c69c4;})['then'](respondWithFilteredResult(_0x133758,_0x1912c4))[_0xe2bc('0x4b')](handleError(_0x133758,null));};exports[_0xe2bc('0x4c')]=function(_0x1e2c67,_0x3690da){var _0x4359c9={'raw':!![],'where':{'id':_0x1e2c67['params']['id']}},_0x211301={};_0x211301['model']=_[_0xe2bc('0x36')](db[_0xe2bc('0x33')][_0xe2bc('0x4d')]);_0x211301['query']=_['keys'](_0x1e2c67['query']);_0x211301[_0xe2bc('0x37')]=_[_0xe2bc('0x38')](_0x211301['model'],_0x211301['query']);_0x4359c9[_0xe2bc('0x39')]=_[_0xe2bc('0x38')](_0x211301[_0xe2bc('0x34')],qs[_0xe2bc('0x3a')](_0x1e2c67[_0xe2bc('0x35')][_0xe2bc('0x3a')]));_0x4359c9['attributes']=_0x4359c9['attributes']['length']?_0x4359c9[_0xe2bc('0x39')]:_0x211301[_0xe2bc('0x34')];if(_0x1e2c67[_0xe2bc('0x35')][_0xe2bc('0x47')]){_0x4359c9['include']=[{'all':!![]}];}_0x4359c9=_[_0xe2bc('0x43')]({},_0x4359c9,_0x1e2c67[_0xe2bc('0x46')]);return db['Network'][_0xe2bc('0x4e')](_0x4359c9)[_0xe2bc('0x1b')](handleEntityNotFound(_0x3690da,null))[_0xe2bc('0x1b')](respondWithResult(_0x3690da,null))[_0xe2bc('0x4b')](handleError(_0x3690da,null));};exports[_0xe2bc('0x4f')]=function(_0x20f153,_0x112b2e,_0x5d88de){var _0x44ece7;return db['sequelize']['transaction'](function(_0x1103d4){return db[_0xe2bc('0x33')][_0xe2bc('0x4f')](_0x20f153['body'],{'raw':!![]})[_0xe2bc('0x1b')](function(_0x25083a){_0x44ece7=_0x25083a;return db[_0xe2bc('0x33')][_0xe2bc('0x49')]({'where':{'type':_0x20f153['body'][_0xe2bc('0x44')]},'raw':!![]});})['then'](function(_0x3adefb){if(_0x44ece7['type'][_0xe2bc('0x50')]()==_0xe2bc('0x51')){var _0x345637=fs[_0xe2bc('0x52')](path[_0xe2bc('0x53')](config[_0xe2bc('0x54')],_0xe2bc('0x55')),_0xe2bc('0x56'));var _0x2b2ed4=ejs[_0xe2bc('0x57')](_0x345637,{'networks':_0x3adefb||[]});fs['writeFileSync'](_0xe2bc('0x58'),_0x2b2ed4);return respondWithRpcPromise(_0xe2bc('0x59'),_0xe2bc('0x4f'),{'module':_0xe2bc('0x5a')});}else if(_0x44ece7[_0xe2bc('0x44')][_0xe2bc('0x50')]()==_0xe2bc('0x5b')){var _0x2247ce=fs['readFileSync'](path[_0xe2bc('0x53')](config[_0xe2bc('0x54')],_0xe2bc('0x5c')),'utf8');var _0xdda82c=ejs[_0xe2bc('0x57')](_0x2247ce,{'networks':_0x3adefb||[]});fs['writeFileSync'](_0xe2bc('0x5d'),_0xdda82c);return respondWithRpcPromise(_0xe2bc('0x59'),_0xe2bc('0x4f'),{'module':_0xe2bc('0x5a')});}else{var _0x5e98ef=fs['readFileSync'](path[_0xe2bc('0x53')](config[_0xe2bc('0x54')],_0xe2bc('0x5e')),_0xe2bc('0x56'));var _0x2515e4=ejs[_0xe2bc('0x57')](_0x5e98ef,{'networks':_0x3adefb||[]});fs[_0xe2bc('0x5f')](util[_0xe2bc('0x60')](_0xe2bc('0x61'),_0x20f153[_0xe2bc('0x62')][_0xe2bc('0x44')]['toLowerCase']()),_0x2515e4);return respondWithRpcPromise('Reload',_0xe2bc('0x4f'),{'module':_0xe2bc('0x63')});}return null;})[_0xe2bc('0x1b')](function(){return _0x44ece7;});})['then'](respondWithResult(_0x112b2e,0xc9))[_0xe2bc('0x4b')](handleError(_0x112b2e,null));};exports[_0xe2bc('0x64')]=function(_0x3bdfd3,_0xcf3250,_0x255f4e){var _0x2e4a81;return db[_0xe2bc('0x65')][_0xe2bc('0x66')](function(_0x2c6804){return db[_0xe2bc('0x33')]['find']({'where':{'id':_0x3bdfd3[_0xe2bc('0x67')]['id']}})[_0xe2bc('0x1b')](handleEntityNotFound(_0xcf3250,null))[_0xe2bc('0x1b')](saveUpdates(_0x3bdfd3[_0xe2bc('0x62')],null))[_0xe2bc('0x1b')](function(_0xd4aad3){if(_0xd4aad3){_0x2e4a81=_0xd4aad3;return db[_0xe2bc('0x33')][_0xe2bc('0x49')]({'where':{'type':_0x2e4a81[_0xe2bc('0x44')]},'raw':!![]});}return null;})[_0xe2bc('0x1b')](function(_0x263eae){if(_0x2e4a81[_0xe2bc('0x44')]['toUpperCase']()=='STUN'){var _0x2b7b8c=fs['readFileSync'](path[_0xe2bc('0x53')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xe2bc('0x56'));var _0x4e0f41=ejs['render'](_0x2b7b8c,{'networks':_0x263eae||[]});fs[_0xe2bc('0x5f')]('/etc/asterisk/stun_xcally.conf',_0x4e0f41);return respondWithRpcPromise(_0xe2bc('0x59'),_0xe2bc('0x64'),{'module':'res_stun_monitor.so'});}else if(_0x2e4a81[_0xe2bc('0x44')][_0xe2bc('0x50')]()==_0xe2bc('0x5b')){var _0x22b28d=fs[_0xe2bc('0x52')](path['join'](config[_0xe2bc('0x54')],_0xe2bc('0x5c')),_0xe2bc('0x56'));var _0x302a70=ejs[_0xe2bc('0x57')](_0x22b28d,{'networks':_0x263eae||[]});fs[_0xe2bc('0x5f')]('/etc/asterisk/turn_xcally.conf',_0x302a70);return respondWithRpcPromise(_0xe2bc('0x59'),'update',{'module':_0xe2bc('0x5a')});}else{var _0x6f95e=fs[_0xe2bc('0x52')](path[_0xe2bc('0x53')](config[_0xe2bc('0x54')],_0xe2bc('0x5e')),_0xe2bc('0x56'));var _0x2076e4=ejs[_0xe2bc('0x57')](_0x6f95e,{'networks':_0x263eae||[]});fs[_0xe2bc('0x5f')](util[_0xe2bc('0x60')]('/etc/asterisk/sip_xcally_%s.conf',_0x3bdfd3[_0xe2bc('0x62')][_0xe2bc('0x44')][_0xe2bc('0x68')]()),_0x2076e4);return respondWithRpcPromise(_0xe2bc('0x59'),'update',{'module':_0xe2bc('0x63')});}return null;})[_0xe2bc('0x1b')](function(_0x4e23ff){if(_0x4e23ff){return _0x2e4a81;}return null;});})[_0xe2bc('0x1b')](respondWithResult(_0xcf3250,null))[_0xe2bc('0x4b')](handleError(_0xcf3250,null));};exports['destroy']=function(_0xf12afc,_0x505e70,_0xc584c6){var _0x2991b4;return db[_0xe2bc('0x33')][_0xe2bc('0x4e')]({'where':{'id':_0xf12afc[_0xe2bc('0x67')]['id']}})['then'](function(_0x1b90bd){_0x2991b4=_0x1b90bd;return _0x1b90bd;})[_0xe2bc('0x1b')](handleEntityNotFound(_0x505e70,null))[_0xe2bc('0x1b')](removeEntity(_0x505e70,null))[_0xe2bc('0x1b')](function(){if(_0x2991b4){return db[_0xe2bc('0x33')]['findAll']({'where':{'type':_0x2991b4[_0xe2bc('0x44')]},'raw':!![]});}})[_0xe2bc('0x1b')](function(_0x550032){if(_0x2991b4[_0xe2bc('0x44')]['toUpperCase']()==_0xe2bc('0x51')){var _0x3c20e8=fs[_0xe2bc('0x52')](path['join'](config[_0xe2bc('0x54')],_0xe2bc('0x55')),_0xe2bc('0x56'));var _0x550106=ejs[_0xe2bc('0x57')](_0x3c20e8,{'networks':_0x550032||[]});fs[_0xe2bc('0x5f')](_0xe2bc('0x58'),_0x550106);return respondWithRpcPromise(_0xe2bc('0x59'),_0xe2bc('0x2d'),{'module':_0xe2bc('0x5a')});}else if(_0x2991b4[_0xe2bc('0x44')][_0xe2bc('0x50')]()=='TURN'){var _0x3e003f=fs['readFileSync'](path[_0xe2bc('0x53')](config[_0xe2bc('0x54')],_0xe2bc('0x5c')),_0xe2bc('0x56'));var _0x1652f6=ejs[_0xe2bc('0x57')](_0x3e003f,{'networks':_0x550032||[]});fs[_0xe2bc('0x5f')](_0xe2bc('0x5d'),_0x1652f6);return respondWithRpcPromise(_0xe2bc('0x59'),_0xe2bc('0x2d'),{'module':'res_stun_monitor.so'});}else{var _0x23a484=fs[_0xe2bc('0x52')](path[_0xe2bc('0x53')](config['root'],'server/files/templates/network.ejs'),_0xe2bc('0x56'));var _0x1c48bb=ejs['render'](_0x23a484,{'networks':_0x550032||[]});fs[_0xe2bc('0x5f')](util[_0xe2bc('0x60')]('/etc/asterisk/sip_xcally_%s.conf',_0xf12afc['body'][_0xe2bc('0x44')][_0xe2bc('0x68')]()),_0x1c48bb);return respondWithRpcPromise(_0xe2bc('0x59'),_0xe2bc('0x2d'),{'module':'chan_sip.so'});}return null;})[_0xe2bc('0x4b')](handleError(_0x505e70,null));}; \ No newline at end of file +var _0x2ae0=['sort','where','filter','include','show','includeAll','merge','create','sequelize','transaction','findAll','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','find','params','server/files/templates/stun_multiple.ejs','update','format','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4584f1,_0x566d68){var _0x34fe53=function(_0x19244e){while(--_0x19244e){_0x4584f1['push'](_0x4584f1['shift']());}};_0x34fe53(++_0x566d68);}(_0x2ae0,0x161));var _0x02ae=function(_0x409106,_0x22e9a0){_0x409106=_0x409106-0x0;var _0x62019b=_0x2ae0[_0x409106];return _0x62019b;};'use strict';var emlformat=require(_0x02ae('0x0'));var rimraf=require(_0x02ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x02ae('0x2'));var moment=require(_0x02ae('0x3'));var BPromise=require(_0x02ae('0x4'));var Mustache=require(_0x02ae('0x5'));var util=require('util');var path=require(_0x02ae('0x6'));var sox=require(_0x02ae('0x7'));var csv=require(_0x02ae('0x8'));var ejs=require(_0x02ae('0x9'));var fs=require('fs');var fs_extra=require(_0x02ae('0xa'));var _=require(_0x02ae('0xb'));var squel=require(_0x02ae('0xc'));var crypto=require(_0x02ae('0xd'));var jsforce=require(_0x02ae('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x02ae('0x8'));var querystring=require('querystring');var Papa=require(_0x02ae('0xf'));var Redis=require(_0x02ae('0x10'));var authService=require(_0x02ae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x02ae('0x12'));var hardwareService=require(_0x02ae('0x13'));var logger=require('../../config/logger')(_0x02ae('0x14'));var utils=require(_0x02ae('0x15'));var config=require(_0x02ae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x02ae('0x17'))['db'];var jayson=require(_0x02ae('0x18'));var client=jayson[_0x02ae('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c59b4,_0x478c61,_0x154bb2,_0x4394f4){return new BPromise(function(_0x4d0585,_0x260db4){var _0x2febc7=_0x4394f4||client;return _0x2febc7[_0x02ae('0x1a')](_0x5c59b4,_0x154bb2)[_0x02ae('0x1b')](function(_0x43d309){logger[_0x02ae('0x1c')](_0x02ae('0x1d'),_0x478c61,'request\x20sent');logger[_0x02ae('0x1e')](_0x02ae('0x1f'),_0x478c61,_0x02ae('0x20'),JSON['stringify'](_0x43d309));if(_0x43d309['error']){if(_0x43d309['error']['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x478c61,_0x43d309[_0x02ae('0x21')][_0x02ae('0x22')]);return _0x260db4(_0x43d309[_0x02ae('0x21')][_0x02ae('0x22')]);}logger[_0x02ae('0x21')]('Network,\x20%s,\x20%s',_0x478c61,_0x43d309[_0x02ae('0x21')][_0x02ae('0x22')]);return _0x4d0585(_0x43d309['error'][_0x02ae('0x22')]);}else{logger[_0x02ae('0x1c')]('Network,\x20%s,\x20%s',_0x478c61,_0x02ae('0x20'));_0x4d0585(_0x43d309[_0x02ae('0x23')]['message']);}})[_0x02ae('0x24')](function(_0x4b8bc4){logger['error'](_0x02ae('0x1d'),_0x478c61,_0x4b8bc4);_0x260db4(_0x4b8bc4);});});}function respondWithStatusCode(_0x4be9a4,_0x429a29){_0x429a29=_0x429a29||0xcc;return function(_0x1af2c7){if(_0x1af2c7){return _0x4be9a4['sendStatus'](_0x429a29);}return _0x4be9a4['status'](_0x429a29)['end']();};}function respondWithResult(_0x23b49c,_0x48c35f){_0x48c35f=_0x48c35f||0xc8;return function(_0x278ef5){if(_0x278ef5){return _0x23b49c['status'](_0x48c35f)[_0x02ae('0x25')](_0x278ef5);}};}function respondWithFilteredResult(_0x49a628,_0x18595a){return function(_0x1006e0){if(_0x1006e0){var _0x372c69=typeof _0x18595a['offset']===_0x02ae('0x26')&&typeof _0x18595a[_0x02ae('0x27')]==='undefined';var _0x1d755d=_0x1006e0['count'];var _0x4526af=_0x372c69?0x0:_0x18595a[_0x02ae('0x28')];var _0x52d756=_0x372c69?_0x1006e0[_0x02ae('0x29')]:_0x18595a[_0x02ae('0x28')]+_0x18595a[_0x02ae('0x27')];var _0xd27d9a;if(_0x52d756>=_0x1d755d){_0x52d756=_0x1d755d;_0xd27d9a=0xc8;}else{_0xd27d9a=0xce;}_0x49a628[_0x02ae('0x2a')](_0xd27d9a);return _0x49a628[_0x02ae('0x2b')](_0x02ae('0x2c'),_0x4526af+'-'+_0x52d756+'/'+_0x1d755d)[_0x02ae('0x25')](_0x1006e0);}return null;};}function patchUpdates(_0x143d7f){return function(_0x16dbc2){try{jsonpatch[_0x02ae('0x2d')](_0x16dbc2,_0x143d7f,!![]);}catch(_0x1fac3b){return BPromise[_0x02ae('0x2e')](_0x1fac3b);}return _0x16dbc2[_0x02ae('0x2f')]();};}function saveUpdates(_0xaf8b9f,_0x16d07f){return function(_0x12818f){if(_0x12818f){return _0x12818f['update'](_0xaf8b9f)[_0x02ae('0x1b')](function(_0x28e682){return _0x28e682;});}return null;};}function removeEntity(_0xed36ea,_0x6ab4fe){return function(_0x2e4247){if(_0x2e4247){return _0x2e4247[_0x02ae('0x30')]()['then'](function(){_0xed36ea[_0x02ae('0x2a')](0xcc)[_0x02ae('0x31')]();});}};}function handleEntityNotFound(_0xb5f925,_0x3e2d00){return function(_0x1e3a72){if(!_0x1e3a72){_0xb5f925[_0x02ae('0x32')](0x194);}return _0x1e3a72;};}function handleError(_0x173734,_0x143451){_0x143451=_0x143451||0x1f4;return function(_0x58452b){logger[_0x02ae('0x21')](_0x58452b[_0x02ae('0x33')]);if(_0x58452b[_0x02ae('0x34')]){delete _0x58452b[_0x02ae('0x34')];}_0x173734['status'](_0x143451)[_0x02ae('0x35')](_0x58452b);};}exports['index']=function(_0x27f2c6,_0x185d57){var _0xf633f7={},_0x112160={},_0x24f08e={'count':0x0,'rows':[]};var _0x3f8a60=_[_0x02ae('0x36')](db[_0x02ae('0x37')][_0x02ae('0x38')],function(_0x14edf1){return{'name':_0x14edf1[_0x02ae('0x39')],'type':_0x14edf1[_0x02ae('0x3a')][_0x02ae('0x3b')]};});_0x112160[_0x02ae('0x3c')]=_[_0x02ae('0x36')](_0x3f8a60,_0x02ae('0x34'));_0x112160[_0x02ae('0x3d')]=_[_0x02ae('0x3e')](_0x27f2c6['query']);_0x112160[_0x02ae('0x3f')]=_[_0x02ae('0x40')](_0x112160[_0x02ae('0x3c')],_0x112160[_0x02ae('0x3d')]);_0xf633f7['attributes']=_[_0x02ae('0x40')](_0x112160[_0x02ae('0x3c')],qs[_0x02ae('0x41')](_0x27f2c6[_0x02ae('0x3d')][_0x02ae('0x41')]));_0xf633f7[_0x02ae('0x42')]=_0xf633f7[_0x02ae('0x42')][_0x02ae('0x43')]?_0xf633f7[_0x02ae('0x42')]:_0x112160[_0x02ae('0x3c')];if(!_0x27f2c6[_0x02ae('0x3d')][_0x02ae('0x44')](_0x02ae('0x45'))){_0xf633f7[_0x02ae('0x27')]=qs[_0x02ae('0x27')](_0x27f2c6['query'][_0x02ae('0x27')]);_0xf633f7['offset']=qs[_0x02ae('0x28')](_0x27f2c6['query'][_0x02ae('0x28')]);}_0xf633f7[_0x02ae('0x46')]=qs[_0x02ae('0x47')](_0x27f2c6[_0x02ae('0x3d')]['sort']);_0xf633f7[_0x02ae('0x48')]=qs[_0x02ae('0x3f')](_['pick'](_0x27f2c6[_0x02ae('0x3d')],_0x112160['filters']),_0x3f8a60);if(_0x27f2c6[_0x02ae('0x3d')][_0x02ae('0x49')]){_0xf633f7['where']=_['merge'](_0xf633f7[_0x02ae('0x48')],{'$or':_['map'](_0x3f8a60,function(_0x324026){if(_0x324026[_0x02ae('0x3a')]!=='VIRTUAL'){var _0x19920a={};_0x19920a[_0x324026['name']]={'$like':'%'+_0x27f2c6[_0x02ae('0x3d')][_0x02ae('0x49')]+'%'};return _0x19920a;}})});}_0xf633f7=_['merge']({},_0xf633f7,_0x27f2c6['options']);var _0x45e690={'where':_0xf633f7[_0x02ae('0x48')]};return db[_0x02ae('0x37')][_0x02ae('0x29')](_0x45e690)[_0x02ae('0x1b')](function(_0x1f6b02){_0x24f08e[_0x02ae('0x29')]=_0x1f6b02;if(_0x27f2c6[_0x02ae('0x3d')]['includeAll']){_0xf633f7[_0x02ae('0x4a')]=[{'all':!![]}];}return db[_0x02ae('0x37')]['findAll'](_0xf633f7);})[_0x02ae('0x1b')](function(_0x43205c){_0x24f08e['rows']=_0x43205c;return _0x24f08e;})['then'](respondWithFilteredResult(_0x185d57,_0xf633f7))['catch'](handleError(_0x185d57,null));};exports[_0x02ae('0x4b')]=function(_0x194046,_0x5e5914){var _0x156684={'raw':!![],'where':{'id':_0x194046['params']['id']}},_0x7dc99a={};_0x7dc99a['model']=_[_0x02ae('0x3e')](db[_0x02ae('0x37')]['rawAttributes']);_0x7dc99a[_0x02ae('0x3d')]=_['keys'](_0x194046[_0x02ae('0x3d')]);_0x7dc99a[_0x02ae('0x3f')]=_['intersection'](_0x7dc99a[_0x02ae('0x3c')],_0x7dc99a[_0x02ae('0x3d')]);_0x156684[_0x02ae('0x42')]=_[_0x02ae('0x40')](_0x7dc99a[_0x02ae('0x3c')],qs[_0x02ae('0x41')](_0x194046[_0x02ae('0x3d')][_0x02ae('0x41')]));_0x156684[_0x02ae('0x42')]=_0x156684['attributes']['length']?_0x156684[_0x02ae('0x42')]:_0x7dc99a[_0x02ae('0x3c')];if(_0x194046[_0x02ae('0x3d')][_0x02ae('0x4c')]){_0x156684[_0x02ae('0x4a')]=[{'all':!![]}];}_0x156684=_[_0x02ae('0x4d')]({},_0x156684,_0x194046['options']);return db[_0x02ae('0x37')]['find'](_0x156684)[_0x02ae('0x1b')](handleEntityNotFound(_0x5e5914,null))[_0x02ae('0x1b')](respondWithResult(_0x5e5914,null))[_0x02ae('0x24')](handleError(_0x5e5914,null));};exports[_0x02ae('0x4e')]=function(_0x47ed61,_0x3eb6fe,_0x2da858){var _0x48cc08;return db[_0x02ae('0x4f')][_0x02ae('0x50')](function(_0x9f2a18){return db[_0x02ae('0x37')][_0x02ae('0x4e')](_0x47ed61['body'],{'raw':!![]})['then'](function(_0x45c954){_0x48cc08=_0x45c954;return db[_0x02ae('0x37')][_0x02ae('0x51')]({'where':{'type':_0x47ed61[_0x02ae('0x52')][_0x02ae('0x3a')]},'raw':!![]});})[_0x02ae('0x1b')](function(_0x151a7f){if(_0x48cc08[_0x02ae('0x3a')][_0x02ae('0x53')]()==_0x02ae('0x54')){var _0x1c17d4=fs[_0x02ae('0x55')](path[_0x02ae('0x56')](config[_0x02ae('0x57')],'server/files/templates/stun_multiple.ejs'),_0x02ae('0x58'));var _0x4afa2b=ejs[_0x02ae('0x59')](_0x1c17d4,{'networks':_0x151a7f||[]});fs[_0x02ae('0x5a')](_0x02ae('0x5b'),_0x4afa2b);return respondWithRpcPromise('Reload',_0x02ae('0x4e'),{'module':'res_stun_monitor.so'});}else if(_0x48cc08[_0x02ae('0x3a')][_0x02ae('0x53')]()==_0x02ae('0x5c')){var _0x97ca=fs[_0x02ae('0x55')](path[_0x02ae('0x56')](config[_0x02ae('0x57')],_0x02ae('0x5d')),_0x02ae('0x58'));var _0x3bf718=ejs[_0x02ae('0x59')](_0x97ca,{'networks':_0x151a7f||[]});fs[_0x02ae('0x5a')](_0x02ae('0x5e'),_0x3bf718);return respondWithRpcPromise('Reload',_0x02ae('0x4e'),{'module':_0x02ae('0x5f')});}else{var _0x2bcd0b=fs[_0x02ae('0x55')](path[_0x02ae('0x56')](config[_0x02ae('0x57')],_0x02ae('0x60')),_0x02ae('0x58'));var _0x3b5760=ejs['render'](_0x2bcd0b,{'networks':_0x151a7f||[]});fs[_0x02ae('0x5a')](util['format'](_0x02ae('0x61'),_0x47ed61['body'][_0x02ae('0x3a')][_0x02ae('0x62')]()),_0x3b5760);return respondWithRpcPromise(_0x02ae('0x63'),_0x02ae('0x4e'),{'module':_0x02ae('0x64')});}return null;})[_0x02ae('0x1b')](function(){return _0x48cc08;});})[_0x02ae('0x1b')](respondWithResult(_0x3eb6fe,0xc9))[_0x02ae('0x24')](handleError(_0x3eb6fe,null));};exports['update']=function(_0x5eac29,_0x23c242,_0x432f6a){var _0x3d573b;return db['sequelize'][_0x02ae('0x50')](function(_0x55585c){return db['Network'][_0x02ae('0x65')]({'where':{'id':_0x5eac29[_0x02ae('0x66')]['id']}})[_0x02ae('0x1b')](handleEntityNotFound(_0x23c242,null))[_0x02ae('0x1b')](saveUpdates(_0x5eac29[_0x02ae('0x52')],null))[_0x02ae('0x1b')](function(_0x51fbe3){if(_0x51fbe3){_0x3d573b=_0x51fbe3;return db[_0x02ae('0x37')][_0x02ae('0x51')]({'where':{'type':_0x3d573b[_0x02ae('0x3a')]},'raw':!![]});}return null;})[_0x02ae('0x1b')](function(_0xaac3fb){if(_0x3d573b['type'][_0x02ae('0x53')]()==_0x02ae('0x54')){var _0x33ef36=fs[_0x02ae('0x55')](path['join'](config[_0x02ae('0x57')],_0x02ae('0x67')),_0x02ae('0x58'));var _0x53625b=ejs['render'](_0x33ef36,{'networks':_0xaac3fb||[]});fs[_0x02ae('0x5a')](_0x02ae('0x5b'),_0x53625b);return respondWithRpcPromise(_0x02ae('0x63'),'update',{'module':'res_stun_monitor.so'});}else if(_0x3d573b[_0x02ae('0x3a')][_0x02ae('0x53')]()==_0x02ae('0x5c')){var _0x41dfe5=fs['readFileSync'](path[_0x02ae('0x56')](config[_0x02ae('0x57')],_0x02ae('0x5d')),_0x02ae('0x58'));var _0x362f9c=ejs[_0x02ae('0x59')](_0x41dfe5,{'networks':_0xaac3fb||[]});fs[_0x02ae('0x5a')](_0x02ae('0x5e'),_0x362f9c);return respondWithRpcPromise(_0x02ae('0x63'),_0x02ae('0x68'),{'module':'res_stun_monitor.so'});}else{var _0x59c71b=fs[_0x02ae('0x55')](path['join'](config[_0x02ae('0x57')],_0x02ae('0x60')),_0x02ae('0x58'));var _0xc3b959=ejs[_0x02ae('0x59')](_0x59c71b,{'networks':_0xaac3fb||[]});fs[_0x02ae('0x5a')](util[_0x02ae('0x69')](_0x02ae('0x61'),_0x5eac29[_0x02ae('0x52')][_0x02ae('0x3a')][_0x02ae('0x62')]()),_0xc3b959);return respondWithRpcPromise(_0x02ae('0x63'),_0x02ae('0x68'),{'module':_0x02ae('0x64')});}return null;})[_0x02ae('0x1b')](function(_0x587f16){if(_0x587f16){return _0x3d573b;}return null;});})[_0x02ae('0x1b')](respondWithResult(_0x23c242,null))[_0x02ae('0x24')](handleError(_0x23c242,null));};exports[_0x02ae('0x30')]=function(_0x290c81,_0x24d997,_0x32af1e){var _0x59a9d4;return db[_0x02ae('0x37')][_0x02ae('0x65')]({'where':{'id':_0x290c81['params']['id']}})['then'](function(_0x329170){_0x59a9d4=_0x329170;return _0x329170;})[_0x02ae('0x1b')](handleEntityNotFound(_0x24d997,null))[_0x02ae('0x1b')](removeEntity(_0x24d997,null))[_0x02ae('0x1b')](function(){if(_0x59a9d4){return db[_0x02ae('0x37')][_0x02ae('0x51')]({'where':{'type':_0x59a9d4[_0x02ae('0x3a')]},'raw':!![]});}})[_0x02ae('0x1b')](function(_0x5d1921){if(_0x59a9d4['type'][_0x02ae('0x53')]()=='STUN'){var _0x3fa199=fs[_0x02ae('0x55')](path[_0x02ae('0x56')](config[_0x02ae('0x57')],_0x02ae('0x67')),_0x02ae('0x58'));var _0x48e393=ejs[_0x02ae('0x59')](_0x3fa199,{'networks':_0x5d1921||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x48e393);return respondWithRpcPromise(_0x02ae('0x63'),'destroy',{'module':_0x02ae('0x5f')});}else if(_0x59a9d4['type'][_0x02ae('0x53')]()==_0x02ae('0x5c')){var _0x10f9a5=fs[_0x02ae('0x55')](path[_0x02ae('0x56')](config[_0x02ae('0x57')],_0x02ae('0x5d')),_0x02ae('0x58'));var _0x10dc5b=ejs[_0x02ae('0x59')](_0x10f9a5,{'networks':_0x5d1921||[]});fs[_0x02ae('0x5a')](_0x02ae('0x5e'),_0x10dc5b);return respondWithRpcPromise(_0x02ae('0x63'),'destroy',{'module':_0x02ae('0x5f')});}else{var _0x24431e=fs[_0x02ae('0x55')](path[_0x02ae('0x56')](config[_0x02ae('0x57')],_0x02ae('0x60')),_0x02ae('0x58'));var _0x14c918=ejs[_0x02ae('0x59')](_0x24431e,{'networks':_0x5d1921||[]});fs['writeFileSync'](util[_0x02ae('0x69')](_0x02ae('0x61'),_0x290c81[_0x02ae('0x52')]['type'][_0x02ae('0x62')]()),_0x14c918);return respondWithRpcPromise('Reload','destroy',{'module':_0x02ae('0x64')});}return null;})[_0x02ae('0x24')](handleError(_0x24d997,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 77ff289..f2eb693 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 _0xd382=['request-promise','path','rimraf','../../config/environment','define','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x2d3335,_0x4a777d){_0x2d3335=_0x2d3335-0x0;var _0x25dec8=_0xd382[_0x2d3335];return _0x25dec8;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))(_0x2d38('0x3'));var moment=require(_0x2d38('0x4'));var BPromise=require(_0x2d38('0x5'));var rp=require(_0x2d38('0x6'));var fs=require('fs');var path=require(_0x2d38('0x7'));var rimraf=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x5a8219,_0x30106c){return _0x5a8219[_0x2d38('0xa')]('Network',attributes,{'tableName':_0x2d38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb58b=['Network','network','util','../../config/logger','api','bluebird','request-promise','rimraf','./network.attributes','exports','define'];(function(_0x4ead23,_0x537fec){var _0x36bcae=function(_0xe423ee){while(--_0xe423ee){_0x4ead23['push'](_0x4ead23['shift']());}};_0x36bcae(++_0x537fec);}(_0xb58b,0x1f1));var _0xbb58=function(_0x59c8b7,_0x5e0eca){_0x59c8b7=_0x59c8b7-0x0;var _0x4f723a=_0xb58b[_0x59c8b7];return _0x4f723a;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb58('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb58('0x6'));module[_0xbb58('0x7')]=function(_0x33fe85,_0x5cf8b1){return _0x33fe85[_0xbb58('0x8')](_0xbb58('0x9'),attributes,{'tableName':_0xbb58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index dc75805..e6492c5 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x56a6b0,_0x3ac3d8){_0x56a6b0=_0x56a6b0-0x0;var _0x242c02=_0x7a54[_0x56a6b0];return _0x242c02;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x4ce946,_0x2f80ca){_0x4ce946=_0x4ce946-0x0;var _0x51dda8=_0x7a54[_0x4ce946];return _0x51dda8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7e2370d..569c3d7 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 _0xe524=['/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index'];(function(_0x4018c5,_0x4a60ac){var _0x532d25=function(_0x42bf83){while(--_0x42bf83){_0x4018c5['push'](_0x4018c5['shift']());}};_0x532d25(++_0x4a60ac);}(_0xe524,0x1e3));var _0x4e52=function(_0x1a3a52,_0x422da1){_0x1a3a52=_0x1a3a52-0x0;var _0x1ed24a=_0xe524[_0x1a3a52];return _0x1ed24a;};'use strict';var multer=require(_0x4e52('0x0'));var util=require(_0x4e52('0x1'));var path=require(_0x4e52('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e52('0x3'));var router=express[_0x4e52('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4e52('0x5'));var interaction=require(_0x4e52('0x6'));var config=require(_0x4e52('0x7'));var controller=require(_0x4e52('0x8'));router[_0x4e52('0x9')]('/',auth['isAuthenticated'](),controller[_0x4e52('0xa')]);router['get'](_0x4e52('0xb'),auth[_0x4e52('0xc')](),controller['describe']);router[_0x4e52('0x9')](_0x4e52('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4e52('0x9')](_0x4e52('0xe'),auth[_0x4e52('0xc')](),controller[_0x4e52('0xf')]);router[_0x4e52('0x9')](_0x4e52('0x10'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x11')]);router['get'](_0x4e52('0x12'),auth['isAuthenticated'](),controller[_0x4e52('0x13')]);router[_0x4e52('0x9')](_0x4e52('0x14'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x15')]);router['get'](_0x4e52('0x16'),auth['isAuthenticated'](),controller[_0x4e52('0x17')]);router[_0x4e52('0x18')]('/',auth[_0x4e52('0xc')](),controller['create']);router[_0x4e52('0x18')](_0x4e52('0xe'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x19')]);router[_0x4e52('0x18')](_0x4e52('0x10'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x1a')]);router['post']('/:id/notify',controller[_0x4e52('0x1b')]);router['post'](_0x4e52('0x12'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x1c')]);router[_0x4e52('0x18')](_0x4e52('0x16'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x1d')]);router['post']('/:id/send',auth[_0x4e52('0xc')](),controller[_0x4e52('0x1e')]);router[_0x4e52('0x1f')](_0x4e52('0xd'),auth[_0x4e52('0xc')](),controller['update']);router[_0x4e52('0x20')](_0x4e52('0xd'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x21')]);router[_0x4e52('0x20')](_0x4e52('0xe'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x22')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4e52('0x23')]);router[_0x4e52('0x20')](_0x4e52('0x16'),auth[_0x4e52('0xc')](),controller[_0x4e52('0x24')]);module[_0x4e52('0x25')]=router; \ No newline at end of file +var _0x8279=['delete','destroy','removeDispositions','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','isAuthenticated','get','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getInteractions','getAgents','create','post','addDisposition','/:id/canned_answers','/:id/notify','notify','addApplications','/:id/users','put','update'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x8279,0x1d3));var _0x9827=function(_0x5f603,_0x5b6622){_0x5f603=_0x5f603-0x0;var _0x31dc1b=_0x8279[_0x5f603];return _0x31dc1b;};'use strict';var multer=require(_0x9827('0x0'));var util=require('util');var path=require(_0x9827('0x1'));var timeout=require('connect-timeout');var express=require(_0x9827('0x2'));var router=express[_0x9827('0x3')]();var fs_extra=require(_0x9827('0x4'));var auth=require(_0x9827('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9827('0x6'));router['get']('/',auth[_0x9827('0x7')](),controller['index']);router[_0x9827('0x8')](_0x9827('0x9'),auth[_0x9827('0x7')](),controller['describe']);router[_0x9827('0x8')](_0x9827('0xa'),auth['isAuthenticated'](),controller[_0x9827('0xb')]);router[_0x9827('0x8')](_0x9827('0xc'),auth[_0x9827('0x7')](),controller[_0x9827('0xd')]);router['get']('/:id/canned_answers',auth[_0x9827('0x7')](),controller[_0x9827('0xe')]);router[_0x9827('0x8')](_0x9827('0xf'),auth[_0x9827('0x7')](),controller['getApplications']);router['get']('/:id/interactions',auth[_0x9827('0x7')](),controller[_0x9827('0x10')]);router['get']('/:id/users',auth[_0x9827('0x7')](),controller[_0x9827('0x11')]);router['post']('/',auth[_0x9827('0x7')](),controller[_0x9827('0x12')]);router[_0x9827('0x13')](_0x9827('0xc'),auth[_0x9827('0x7')](),controller[_0x9827('0x14')]);router[_0x9827('0x13')](_0x9827('0x15'),auth[_0x9827('0x7')](),controller['addAnswer']);router[_0x9827('0x13')](_0x9827('0x16'),controller[_0x9827('0x17')]);router['post'](_0x9827('0xf'),auth[_0x9827('0x7')](),controller[_0x9827('0x18')]);router[_0x9827('0x13')](_0x9827('0x19'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9827('0x13')]('/:id/send',auth[_0x9827('0x7')](),controller['send']);router[_0x9827('0x1a')](_0x9827('0xa'),auth[_0x9827('0x7')](),controller[_0x9827('0x1b')]);router[_0x9827('0x1c')]('/:id',auth[_0x9827('0x7')](),controller[_0x9827('0x1d')]);router[_0x9827('0x1c')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9827('0x1e')]);router[_0x9827('0x1c')]('/:id/canned_answers',auth[_0x9827('0x7')](),controller[_0x9827('0x1f')]);router['delete'](_0x9827('0x19'),auth[_0x9827('0x7')](),controller['removeAgents']);module[_0x9827('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9ad8b6c..ecf31da 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 _0xd4e9=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4e9,0xcb));var _0x9d4e=function(_0x304f0a,_0x5a77a){_0x304f0a=_0x304f0a-0x0;var _0x2cec46=_0xd4e9[_0x304f0a];return _0x2cec46;};'use strict';var Sequelize=require(_0x9d4e('0x0'));var rs=require(_0x9d4e('0x1'));module[_0x9d4e('0x2')]={'name':{'type':Sequelize[_0x9d4e('0x3')],'unique':_0x9d4e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x9d4e('0x3')]},'token':{'type':Sequelize[_0x9d4e('0x3')],'defaultValue':function(){return rs[_0x9d4e('0x5')]();}},'replyUri':{'type':Sequelize[_0x9d4e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9d4e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9d4e('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9d4e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9d4e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9d4e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9d4e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9d4e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x9d4e('0x7')],'defaultValue':![],'comment':_0x9d4e('0xa'),'set':function(_0x4b3798){if(!_0x4b3798)this['setDataValue'](_0x9d4e('0xb'),null);this[_0x9d4e('0xc')](_0x9d4e('0xd'),_0x4b3798);}}}; \ No newline at end of file +var _0xa97b=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','TEXT','BOOLEAN'];(function(_0x3f586d,_0x2ab5e9){var _0x842ee3=function(_0x2937fd){while(--_0x2937fd){_0x3f586d['push'](_0x3f586d['shift']());}};_0x842ee3(++_0x2ab5e9);}(_0xa97b,0x65));var _0xba97=function(_0x1dd26d,_0x102e38){_0x1dd26d=_0x1dd26d-0x0;var _0x513f0a=_0xa97b[_0x1dd26d];return _0x513f0a;};'use strict';var Sequelize=require(_0xba97('0x0'));var rs=require('randomstring');module[_0xba97('0x1')]={'name':{'type':Sequelize[_0xba97('0x2')],'unique':_0xba97('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xba97('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xba97('0x4')]();}},'replyUri':{'type':Sequelize[_0xba97('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xba97('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xba97('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xba97('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba97('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba97('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xba97('0x2')]},'queueTransfer':{'type':Sequelize[_0xba97('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba97('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba97('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba97('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba97('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xba97('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xba97('0x9'),'set':function(_0x552841){if(!_0x552841)this['setDataValue'](_0xba97('0xa'),null);this['setDataValue'](_0xba97('0xb'),_0x552841);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9ea64e4..939235e 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 _0xb75e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','Contacts','DESC','account','Applications','list','List','orderBy','applications','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','interaction','created','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','agent','*,*,*,*','forcedOwnership','Start','EventManager','transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','finally','getApplications','Contact','Owner','internal','Tag','Tags','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','out','dataValues','Messages','push','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','status','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','OpenchannelAccount','includeAll','findAll','rows','params','include','options','find','create','body','user'];(function(_0x1ca01d,_0x17125a){var _0x2b7aa9=function(_0x3fed7c){while(--_0x3fed7c){_0x1ca01d['push'](_0x1ca01d['shift']());}};_0x2b7aa9(++_0x17125a);}(_0xb75e,0x112));var _0xeb75=function(_0x1e11e6,_0x4d817e){_0x1e11e6=_0x1e11e6-0x0;var _0x58c19c=_0xb75e[_0x1e11e6];return _0x58c19c;};'use strict';var emlformat=require(_0xeb75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb75('0x1'));var jsonpatch=require(_0xeb75('0x2'));var rp=require('request-promise');var moment=require(_0xeb75('0x3'));var BPromise=require(_0xeb75('0x4'));var Mustache=require(_0xeb75('0x5'));var util=require(_0xeb75('0x6'));var path=require(_0xeb75('0x7'));var sox=require(_0xeb75('0x8'));var csv=require(_0xeb75('0x9'));var ejs=require(_0xeb75('0xa'));var fs=require('fs');var fs_extra=require(_0xeb75('0xb'));var _=require('lodash');var squel=require(_0xeb75('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb75('0xd'));var deskjs=require(_0xeb75('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb75('0xf'));var Papa=require(_0xeb75('0x10'));var Redis=require(_0xeb75('0x11'));var authService=require(_0xeb75('0x12'));var qs=require(_0xeb75('0x13'));var as=require(_0xeb75('0x14'));var hardwareService=require(_0xeb75('0x15'));var logger=require(_0xeb75('0x16'))(_0xeb75('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb75('0x18'));var db=require(_0xeb75('0x19'))['db'];config[_0xeb75('0x1a')]=_['defaults'](config['redis'],{'host':_0xeb75('0x1b'),'port':0x18eb});var socket=require(_0xeb75('0x1c'))(new Redis(config[_0xeb75('0x1a')]));require(_0xeb75('0x1d'))[_0xeb75('0x1e')](socket);var jayson=require(_0xeb75('0x1f'));var client=jayson[_0xeb75('0x20')][_0xeb75('0x21')]({'port':0x232c});var client9002=jayson[_0xeb75('0x20')][_0xeb75('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x43db06,_0x187d2d,_0x4cc0ab,_0x3bd67c){return new BPromise(function(_0x278d01,_0x33d770){var _0x58ca67=_0x3bd67c||client;return _0x58ca67['request'](_0x43db06,_0x4cc0ab)[_0xeb75('0x22')](function(_0x4e7923){logger[_0xeb75('0x23')](_0xeb75('0x24'),_0x187d2d,_0xeb75('0x25'));logger[_0xeb75('0x26')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x187d2d,_0xeb75('0x25'),JSON['stringify'](_0x4e7923));if(_0x4e7923[_0xeb75('0x27')]){if(_0x4e7923[_0xeb75('0x27')][_0xeb75('0x28')]===0x1f4){logger[_0xeb75('0x27')](_0xeb75('0x24'),_0x187d2d,_0x4e7923[_0xeb75('0x27')]['message']);return _0x33d770(_0x4e7923[_0xeb75('0x27')]['message']);}logger[_0xeb75('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x187d2d,_0x4e7923[_0xeb75('0x27')][_0xeb75('0x29')]);return _0x278d01(_0x4e7923['error'][_0xeb75('0x29')]);}else{logger[_0xeb75('0x23')](_0xeb75('0x24'),_0x187d2d,'request\x20sent');_0x278d01(_0x4e7923[_0xeb75('0x2a')][_0xeb75('0x29')]);}})[_0xeb75('0x2b')](function(_0x2707f0){logger[_0xeb75('0x27')](_0xeb75('0x24'),_0x187d2d,_0x2707f0);_0x33d770(_0x2707f0);});});}function respondWithStatusCode(_0x49a1df,_0x4b41b0){_0x4b41b0=_0x4b41b0||0xcc;return function(_0x366948){if(_0x366948){return _0x49a1df[_0xeb75('0x2c')](_0x4b41b0);}return _0x49a1df['status'](_0x4b41b0)[_0xeb75('0x2d')]();};}function respondWithResult(_0xeb2068,_0x4a04b6){_0x4a04b6=_0x4a04b6||0xc8;return function(_0x454e0d){if(_0x454e0d){return _0xeb2068['status'](_0x4a04b6)[_0xeb75('0x2e')](_0x454e0d);}};}function respondWithFilteredResult(_0x36d9a3,_0x3a8c54){return function(_0x25bdd4){if(_0x25bdd4){var _0x412009=typeof _0x3a8c54[_0xeb75('0x2f')]===_0xeb75('0x30')&&typeof _0x3a8c54['limit']===_0xeb75('0x30');var _0x57c738=_0x25bdd4[_0xeb75('0x31')];var _0x7d7479=_0x412009?0x0:_0x3a8c54[_0xeb75('0x2f')];var _0x56f5c2=_0x412009?_0x25bdd4[_0xeb75('0x31')]:_0x3a8c54['offset']+_0x3a8c54[_0xeb75('0x32')];var _0x5adf91;if(_0x56f5c2>=_0x57c738){_0x56f5c2=_0x57c738;_0x5adf91=0xc8;}else{_0x5adf91=0xce;}_0x36d9a3['status'](_0x5adf91);return _0x36d9a3[_0xeb75('0x33')](_0xeb75('0x34'),_0x7d7479+'-'+_0x56f5c2+'/'+_0x57c738)['json'](_0x25bdd4);}return null;};}function patchUpdates(_0xf5362){return function(_0x548f80){try{jsonpatch[_0xeb75('0x35')](_0x548f80,_0xf5362,!![]);}catch(_0x4e279c){return BPromise['reject'](_0x4e279c);}return _0x548f80[_0xeb75('0x36')]();};}function saveUpdates(_0x415402,_0x361eb4){return function(_0x5a46c5){if(_0x5a46c5){return _0x5a46c5[_0xeb75('0x37')](_0x415402)[_0xeb75('0x22')](function(_0xb98ed7){return _0xb98ed7;});}return null;};}function removeEntity(_0x365e19,_0x566665){return function(_0x115aa4){if(_0x115aa4){return _0x115aa4['destroy']()['then'](function(){var _0x429e91=_0x115aa4[_0xeb75('0x38')]({'plain':!![]});var _0x3e4e02=_0xeb75('0x39');return db[_0xeb75('0x3a')][_0xeb75('0x3b')]({'where':{'type':_0x3e4e02,'resourceId':_0x429e91['id']}})['then'](function(){return _0x115aa4;});})[_0xeb75('0x22')](function(){_0x365e19[_0xeb75('0x3c')](0xcc)[_0xeb75('0x2d')]();});}};}function handleEntityNotFound(_0x2b8584,_0x4cf347){return function(_0x3c3730){if(!_0x3c3730){_0x2b8584[_0xeb75('0x2c')](0x194);}return _0x3c3730;};}function handleError(_0x234e8f,_0xac81e5){_0xac81e5=_0xac81e5||0x1f4;return function(_0x40d417){logger[_0xeb75('0x27')](_0x40d417[_0xeb75('0x3d')]);if(_0x40d417[_0xeb75('0x3e')]){delete _0x40d417[_0xeb75('0x3e')];}_0x234e8f[_0xeb75('0x3c')](_0xac81e5)['send'](_0x40d417);};}exports[_0xeb75('0x3f')]=function(_0x4f0e89,_0x3f3996){var _0x3af7cf={'include':[{'model':db[_0xeb75('0x40')],'as':_0xeb75('0x41')}]},_0x5c24fa={},_0x4f37f6={'count':0x0,'rows':[]};var _0x21b00b=_[_0xeb75('0x42')](db['OpenchannelAccount'][_0xeb75('0x43')],function(_0xf7b240){return{'name':_0xf7b240['fieldName'],'type':_0xf7b240[_0xeb75('0x44')][_0xeb75('0x45')]};});_0x5c24fa[_0xeb75('0x46')]=_[_0xeb75('0x42')](_0x21b00b,_0xeb75('0x3e'));_0x5c24fa[_0xeb75('0x47')]=_[_0xeb75('0x48')](_0x4f0e89[_0xeb75('0x47')]);_0x5c24fa['filters']=_['intersection'](_0x5c24fa[_0xeb75('0x46')],_0x5c24fa[_0xeb75('0x47')]);_0x3af7cf[_0xeb75('0x49')]=_[_0xeb75('0x4a')](_0x5c24fa[_0xeb75('0x46')],qs[_0xeb75('0x4b')](_0x4f0e89[_0xeb75('0x47')][_0xeb75('0x4b')]));_0x3af7cf[_0xeb75('0x49')]=_0x3af7cf['attributes'][_0xeb75('0x4c')]?_0x3af7cf[_0xeb75('0x49')]:_0x5c24fa[_0xeb75('0x46')];if(!_0x4f0e89[_0xeb75('0x47')]['hasOwnProperty'](_0xeb75('0x4d'))){_0x3af7cf[_0xeb75('0x32')]=qs[_0xeb75('0x32')](_0x4f0e89['query'][_0xeb75('0x32')]);_0x3af7cf[_0xeb75('0x2f')]=qs['offset'](_0x4f0e89[_0xeb75('0x47')]['offset']);}_0x3af7cf[_0xeb75('0x4e')]=qs[_0xeb75('0x4f')](_0x4f0e89[_0xeb75('0x47')][_0xeb75('0x4f')]);_0x3af7cf['where']=qs[_0xeb75('0x50')](_[_0xeb75('0x51')](_0x4f0e89[_0xeb75('0x47')],_0x5c24fa[_0xeb75('0x50')]),_0x21b00b);if(_0x4f0e89[_0xeb75('0x47')][_0xeb75('0x52')]){_0x3af7cf[_0xeb75('0x53')]=_[_0xeb75('0x54')](_0x3af7cf[_0xeb75('0x53')],{'$or':_[_0xeb75('0x42')](_0x21b00b,function(_0x36f4f1){if(_0x36f4f1[_0xeb75('0x44')]!=='VIRTUAL'){var _0x41db78={};_0x41db78[_0x36f4f1[_0xeb75('0x3e')]]={'$like':'%'+_0x4f0e89[_0xeb75('0x47')][_0xeb75('0x52')]+'%'};return _0x41db78;}})});}_0x3af7cf=_[_0xeb75('0x54')]({},_0x3af7cf,_0x4f0e89['options']);var _0x11172e={'where':_0x3af7cf[_0xeb75('0x53')]};return db[_0xeb75('0x55')]['count'](_0x11172e)['then'](function(_0x1e198f){_0x4f37f6[_0xeb75('0x31')]=_0x1e198f;if(_0x4f0e89['query'][_0xeb75('0x56')]){_0x3af7cf['include']=[{'all':!![]}];}return db[_0xeb75('0x55')][_0xeb75('0x57')](_0x3af7cf);})[_0xeb75('0x22')](function(_0x4279eb){_0x4f37f6[_0xeb75('0x58')]=_0x4279eb;return _0x4f37f6;})[_0xeb75('0x22')](respondWithFilteredResult(_0x3f3996,_0x3af7cf))['catch'](handleError(_0x3f3996,null));};exports['show']=function(_0x249889,_0x5a3ae8){var _0x4628f1={'raw':![],'where':{'id':_0x249889[_0xeb75('0x59')]['id']},'include':[{'model':db[_0xeb75('0x40')],'as':_0xeb75('0x41')}]},_0x3a680c={};_0x3a680c[_0xeb75('0x46')]=_[_0xeb75('0x48')](db[_0xeb75('0x55')][_0xeb75('0x43')]);_0x3a680c[_0xeb75('0x47')]=_['keys'](_0x249889[_0xeb75('0x47')]);_0x3a680c[_0xeb75('0x50')]=_[_0xeb75('0x4a')](_0x3a680c[_0xeb75('0x46')],_0x3a680c[_0xeb75('0x47')]);_0x4628f1[_0xeb75('0x49')]=_[_0xeb75('0x4a')](_0x3a680c[_0xeb75('0x46')],qs[_0xeb75('0x4b')](_0x249889['query']['fields']));_0x4628f1[_0xeb75('0x49')]=_0x4628f1[_0xeb75('0x49')][_0xeb75('0x4c')]?_0x4628f1[_0xeb75('0x49')]:_0x3a680c['model'];if(_0x249889[_0xeb75('0x47')][_0xeb75('0x56')]){_0x4628f1[_0xeb75('0x5a')]=[{'all':!![]}];}_0x4628f1=_[_0xeb75('0x54')]({},_0x4628f1,_0x249889[_0xeb75('0x5b')]);return db[_0xeb75('0x55')][_0xeb75('0x5c')](_0x4628f1)[_0xeb75('0x22')](handleEntityNotFound(_0x5a3ae8,null))[_0xeb75('0x22')](respondWithResult(_0x5a3ae8,null))['catch'](handleError(_0x5a3ae8,null));};exports[_0xeb75('0x5d')]=function(_0x3d10ec,_0x41206f){return db[_0xeb75('0x55')][_0xeb75('0x5d')](_0x3d10ec[_0xeb75('0x5e')],{})[_0xeb75('0x22')](function(_0x1c3f0b){var _0x349deb=_0x3d10ec[_0xeb75('0x5f')][_0xeb75('0x38')]({'plain':!![]});if(!_0x349deb)throw new Error(_0xeb75('0x60'));if(_0x349deb[_0xeb75('0x61')]==='user'){var _0x426001=_0x1c3f0b[_0xeb75('0x38')]({'plain':!![]});var _0x7ce2da=_0xeb75('0x39');return db['UserProfileSection'][_0xeb75('0x5c')]({'where':{'name':_0x7ce2da,'userProfileId':_0x349deb['userProfileId']},'raw':!![]})[_0xeb75('0x22')](function(_0x524de6){if(_0x524de6&&_0x524de6['autoAssociation']===0x0){return db[_0xeb75('0x3a')]['create']({'name':_0x426001[_0xeb75('0x3e')],'resourceId':_0x426001['id'],'type':_0x524de6[_0xeb75('0x3e')],'sectionId':_0x524de6['id']},{})[_0xeb75('0x22')](function(){return _0x1c3f0b;});}else{return _0x1c3f0b;}})[_0xeb75('0x2b')](function(_0x4dafa3){logger[_0xeb75('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dafa3);throw _0x4dafa3;});}return _0x1c3f0b;})[_0xeb75('0x22')](respondWithResult(_0x41206f,0xc9))[_0xeb75('0x2b')](handleError(_0x41206f,null));};exports[_0xeb75('0x37')]=function(_0x52317a,_0x31735b){if(_0x52317a['body']['id']){delete _0x52317a['body']['id'];}return db[_0xeb75('0x55')][_0xeb75('0x5c')]({'where':{'id':_0x52317a[_0xeb75('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xeb75('0x22')](handleEntityNotFound(_0x31735b,null))[_0xeb75('0x22')](saveUpdates(_0x52317a[_0xeb75('0x5e')],null))['then'](respondWithResult(_0x31735b,null))[_0xeb75('0x2b')](handleError(_0x31735b,null));};exports[_0xeb75('0x3b')]=function(_0x42a146,_0x346156){return db[_0xeb75('0x55')][_0xeb75('0x5c')]({'where':{'id':_0x42a146[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x346156,null))[_0xeb75('0x22')](removeEntity(_0x346156,null))[_0xeb75('0x2b')](handleError(_0x346156,null));};exports[_0xeb75('0x62')]=function(_0x4383d0,_0x356683){return db[_0xeb75('0x55')][_0xeb75('0x62')]()['then'](respondWithResult(_0x356683,null))['catch'](handleError(_0x356683,null));};exports[_0xeb75('0x63')]=function(_0x4bbb89,_0x561d01,_0x1e288c){if(_0x4bbb89[_0xeb75('0x5e')]['id']){delete _0x4bbb89['body']['id'];}return db[_0xeb75('0x55')][_0xeb75('0x5c')]({'where':{'id':_0x4bbb89[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x561d01,null))[_0xeb75('0x22')](function(_0xa9b80c){if(_0xa9b80c){_0x4bbb89[_0xeb75('0x5e')][_0xeb75('0x64')]=_0xa9b80c['id'];return db[_0xeb75('0x65')][_0xeb75('0x5d')](_0x4bbb89['body']);}})[_0xeb75('0x22')](respondWithResult(_0x561d01,null))[_0xeb75('0x2b')](handleError(_0x561d01,null));};exports[_0xeb75('0x66')]=function(_0x2d5183,_0x54e34e,_0x53d537){var _0x62eeca={'raw':![],'where':{}};var _0x42700b={};var _0x1f2b0c={'count':0x0,'rows':[]};return db[_0xeb75('0x55')][_0xeb75('0x67')]({'where':{'id':_0x2d5183[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x54e34e,null))[_0xeb75('0x22')](function(_0x46967f){if(_0x46967f){_0x42700b[_0xeb75('0x46')]=_[_0xeb75('0x48')](db[_0xeb75('0x65')][_0xeb75('0x43')]);_0x42700b[_0xeb75('0x47')]=_[_0xeb75('0x48')](_0x2d5183['query']);_0x42700b['filters']=_['intersection'](_0x42700b[_0xeb75('0x46')],_0x42700b[_0xeb75('0x47')]);_0x62eeca['attributes']=_[_0xeb75('0x4a')](_0x42700b[_0xeb75('0x46')],qs[_0xeb75('0x4b')](_0x2d5183[_0xeb75('0x47')][_0xeb75('0x4b')]));_0x62eeca[_0xeb75('0x49')]=_0x62eeca[_0xeb75('0x49')]['length']?_0x62eeca['attributes']:_0x42700b[_0xeb75('0x46')];if(!_0x2d5183[_0xeb75('0x47')][_0xeb75('0x68')](_0xeb75('0x4d'))){_0x62eeca[_0xeb75('0x32')]=qs[_0xeb75('0x32')](_0x2d5183['query'][_0xeb75('0x32')]);_0x62eeca['offset']=qs['offset'](_0x2d5183[_0xeb75('0x47')][_0xeb75('0x2f')]);}_0x62eeca['order']=qs['sort'](_0x2d5183['query'][_0xeb75('0x4f')]);_0x62eeca[_0xeb75('0x53')]=qs[_0xeb75('0x50')](_[_0xeb75('0x51')](_0x2d5183['query'],_0x42700b['filters']));_0x62eeca['where']['OpenchannelAccountId']=_0x46967f['id'];if(_0x2d5183[_0xeb75('0x47')][_0xeb75('0x52')]){_0x62eeca[_0xeb75('0x53')]=_[_0xeb75('0x54')](_0x62eeca[_0xeb75('0x53')],{'$or':_[_0xeb75('0x42')](_0x62eeca[_0xeb75('0x49')],function(_0x3d168e){var _0x2f5596={};_0x2f5596[_0x3d168e]={'$like':'%'+_0x2d5183['query'][_0xeb75('0x52')]+'%'};return _0x2f5596;})});}_0x62eeca=_[_0xeb75('0x54')]({},_0x62eeca,_0x2d5183[_0xeb75('0x5b')]);return db[_0xeb75('0x65')]['count']({'where':_0x62eeca[_0xeb75('0x53')]})[_0xeb75('0x22')](function(_0x28e2eb){_0x1f2b0c[_0xeb75('0x31')]=_0x28e2eb;if(_0x2d5183[_0xeb75('0x47')]['includeAll']){_0x62eeca['include']=[{'all':!![]}];}return db[_0xeb75('0x65')][_0xeb75('0x57')](_0x62eeca);})[_0xeb75('0x22')](function(_0x36f3d6){_0x1f2b0c[_0xeb75('0x58')]=_0x36f3d6;return _0x1f2b0c;});}})[_0xeb75('0x22')](respondWithFilteredResult(_0x54e34e,_0x62eeca))['catch'](handleError(_0x54e34e,null));};exports['removeDispositions']=function(_0xdaa66c,_0x37e66d,_0x53a284){return db[_0xeb75('0x55')]['find']({'where':{'id':_0xdaa66c[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x37e66d,null))[_0xeb75('0x22')](function(_0x49102c){if(_0x49102c){return _0x49102c[_0xeb75('0x69')](_0xdaa66c[_0xeb75('0x47')][_0xeb75('0x6a')]);}})[_0xeb75('0x22')](respondWithStatusCode(_0x37e66d,null))[_0xeb75('0x2b')](handleError(_0x37e66d,null));};exports[_0xeb75('0x6b')]=function(_0x56fa46,_0x4eefc2,_0x443178){if(_0x56fa46['body']['id']){delete _0x56fa46['body']['id'];}return db['OpenchannelAccount'][_0xeb75('0x5c')]({'where':{'id':_0x56fa46[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x4eefc2,null))[_0xeb75('0x22')](function(_0x55f1e7){if(_0x55f1e7){_0x56fa46[_0xeb75('0x5e')][_0xeb75('0x64')]=_0x55f1e7['id'];return db[_0xeb75('0x6c')][_0xeb75('0x5d')](_0x56fa46['body']);}})[_0xeb75('0x22')](respondWithResult(_0x4eefc2,null))[_0xeb75('0x2b')](handleError(_0x4eefc2,null));};exports[_0xeb75('0x6d')]=function(_0x3a42c3,_0x28a1fd,_0x2cf79c){var _0x257507={'raw':![],'where':{}};var _0x238610={};var _0x3c8b3a={'count':0x0,'rows':[]};return db[_0xeb75('0x55')][_0xeb75('0x67')]({'where':{'id':_0x3a42c3[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x28a1fd,null))['then'](function(_0x61c4ef){if(_0x61c4ef){_0x238610['model']=_[_0xeb75('0x48')](db[_0xeb75('0x6c')][_0xeb75('0x43')]);_0x238610[_0xeb75('0x47')]=_['keys'](_0x3a42c3[_0xeb75('0x47')]);_0x238610[_0xeb75('0x50')]=_[_0xeb75('0x4a')](_0x238610[_0xeb75('0x46')],_0x238610[_0xeb75('0x47')]);_0x257507[_0xeb75('0x49')]=_[_0xeb75('0x4a')](_0x238610[_0xeb75('0x46')],qs['fields'](_0x3a42c3['query'][_0xeb75('0x4b')]));_0x257507[_0xeb75('0x49')]=_0x257507['attributes'][_0xeb75('0x4c')]?_0x257507[_0xeb75('0x49')]:_0x238610[_0xeb75('0x46')];if(!_0x3a42c3[_0xeb75('0x47')]['hasOwnProperty'](_0xeb75('0x4d'))){_0x257507['limit']=qs[_0xeb75('0x32')](_0x3a42c3[_0xeb75('0x47')]['limit']);_0x257507['offset']=qs[_0xeb75('0x2f')](_0x3a42c3[_0xeb75('0x47')]['offset']);}_0x257507[_0xeb75('0x4e')]=qs[_0xeb75('0x4f')](_0x3a42c3['query']['sort']);_0x257507[_0xeb75('0x53')]=qs[_0xeb75('0x50')](_[_0xeb75('0x51')](_0x3a42c3['query'],_0x238610[_0xeb75('0x50')]));_0x257507[_0xeb75('0x53')][_0xeb75('0x64')]=_0x61c4ef['id'];if(_0x3a42c3[_0xeb75('0x47')][_0xeb75('0x52')]){_0x257507[_0xeb75('0x53')]=_[_0xeb75('0x54')](_0x257507[_0xeb75('0x53')],{'$or':_[_0xeb75('0x42')](_0x257507['attributes'],function(_0x1e209d){var _0x53e265={};_0x53e265[_0x1e209d]={'$like':'%'+_0x3a42c3[_0xeb75('0x47')][_0xeb75('0x52')]+'%'};return _0x53e265;})});}_0x257507=_[_0xeb75('0x54')]({},_0x257507,_0x3a42c3['options']);return db[_0xeb75('0x6c')][_0xeb75('0x31')]({'where':_0x257507['where']})[_0xeb75('0x22')](function(_0x23b6a7){_0x3c8b3a['count']=_0x23b6a7;if(_0x3a42c3[_0xeb75('0x47')][_0xeb75('0x56')]){_0x257507[_0xeb75('0x5a')]=[{'all':!![]}];}return db[_0xeb75('0x6c')][_0xeb75('0x57')](_0x257507);})['then'](function(_0xb0fd66){_0x3c8b3a['rows']=_0xb0fd66;return _0x3c8b3a;});}})[_0xeb75('0x22')](respondWithFilteredResult(_0x28a1fd,_0x257507))[_0xeb75('0x2b')](handleError(_0x28a1fd,null));};exports[_0xeb75('0x6e')]=function(_0x3d52fd,_0x518825,_0x94f356){return db['OpenchannelAccount'][_0xeb75('0x5c')]({'where':{'id':_0x3d52fd[_0xeb75('0x59')]['id']}})['then'](handleEntityNotFound(_0x518825,null))[_0xeb75('0x22')](function(_0x4835b3){if(_0x4835b3){return _0x4835b3[_0xeb75('0x6e')](_0x3d52fd[_0xeb75('0x47')][_0xeb75('0x6a')]);}})[_0xeb75('0x22')](respondWithStatusCode(_0x518825,null))[_0xeb75('0x2b')](handleError(_0x518825,null));};exports[_0xeb75('0x6f')]=function(_0x9edcc7,_0x43fd42,_0x1d00d7){var _0x3ceca5={'body':_0x9edcc7[_0xeb75('0x5e')],'channel':_0xeb75('0x70')};var _0x1c8ad7=[];var _0x4007c9=[];var _0x30b27b={};var _0x543a5e=![];return db[_0xeb75('0x71')][_0xeb75('0x62')]()[_0xeb75('0x22')](function(_0x51aba0){if(!_0x51aba0){throw new db[(_0xeb75('0x72'))][(_0xeb75('0x73'))](_0xeb75('0x74'));}_0x1c8ad7=_['difference'](_['keys'](_0x51aba0),[_0xeb75('0x75'),_0xeb75('0x76')]);_0x4007c9=_[_0xeb75('0x77')](_[_0xeb75('0x48')](_0x51aba0),['createdAt',_0xeb75('0x76'),_0xeb75('0x78'),_0xeb75('0x79')]);if(_0x9edcc7[_0xeb75('0x5e')]['id']){delete _0x9edcc7[_0xeb75('0x5e')]['id'];}if(_[_0xeb75('0x7a')](_0x9edcc7[_0xeb75('0x5e')]['from'])){throw new db[(_0xeb75('0x72'))][(_0xeb75('0x73'))](_0xeb75('0x7b'));}if(_[_0xeb75('0x7a')](_0x9edcc7[_0xeb75('0x5e')]['body'])||_0x9edcc7[_0xeb75('0x5e')][_0xeb75('0x5e')]===''){throw new db[(_0xeb75('0x72'))][(_0xeb75('0x73'))](_0xeb75('0x7c'));}if(_[_0xeb75('0x7a')](_0x9edcc7[_0xeb75('0x5e')][_0xeb75('0x7d')])){throw new db[(_0xeb75('0x72'))][(_0xeb75('0x73'))](_0xeb75('0x7e')+_0x4007c9);}if(!_[_0xeb75('0x7f')](_0x4007c9,_0x9edcc7['body']['mapKey'])){throw new db[(_0xeb75('0x72'))][(_0xeb75('0x73'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4007c9);}_0x30b27b[_0x9edcc7[_0xeb75('0x5e')][_0xeb75('0x7d')]]=_0x9edcc7[_0xeb75('0x5e')][_0xeb75('0x80')];})['then'](function(){return db[_0xeb75('0x55')]['find']({'where':{'id':_0x9edcc7[_0xeb75('0x59')]['id']},'include':[{'model':db[_0xeb75('0x81')],'as':'List','include':[{'model':db[_0xeb75('0x71')],'as':_0xeb75('0x82'),'where':_0x30b27b,'limit':0x1,'order':[['updatedAt',_0xeb75('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xeb75('0x22')](handleEntityNotFound(_0x43fd42,null))[_0xeb75('0x22')](function(_0x4637ea){if(_0x4637ea&&_0x4637ea['List']){_0x3ceca5[_0xeb75('0x84')]=_0x4637ea;_0x3ceca5['applications']=_0x4637ea[_0xeb75('0x85')];_0x3ceca5[_0xeb75('0x86')]=_0x4637ea[_0xeb75('0x87')];_0x3ceca5['applications']=_[_0xeb75('0x88')](_0x3ceca5[_0xeb75('0x89')],[_0xeb75('0x8a')],[_0xeb75('0x8b')]);if(_0x3ceca5[_0xeb75('0x84')][_0xeb75('0x85')]){delete _0x3ceca5['account']['Applications'];}if(_0x3ceca5[_0xeb75('0x84')]['List']&&_0x3ceca5['account'][_0xeb75('0x87')][_0xeb75('0x82')]['length']){return _0x3ceca5['account'][_0xeb75('0x87')][_0xeb75('0x82')][0x0];}var _0x1180af=_[_0xeb75('0x8c')](_0x9edcc7[_0xeb75('0x5e')],{'firstName':_0x9edcc7[_0xeb75('0x5e')][_0xeb75('0x80')],'ListId':_0x4637ea[_0xeb75('0x79')]});_0x1180af[_0x9edcc7['body'][_0xeb75('0x7d')]]=_0x9edcc7['body'][_0xeb75('0x80')];return db[_0xeb75('0x71')]['create'](_0x1180af,{'fields':_0x1c8ad7,'raw':!![]});}})['then'](handleEntityNotFound(_0x43fd42,null))[_0xeb75('0x22')](function(_0x2ab93e){_0x3ceca5[_0xeb75('0x8d')]=_0x2ab93e;if(_0x2ab93e){var _0x3bb7ee={'ContactId':_0x2ab93e['id'],'OpenchannelAccountId':_0x9edcc7[_0xeb75('0x59')]['id'],'from':(_0x2ab93e[_0xeb75('0x8e')]||'')+'\x20'+(_0x2ab93e[_0xeb75('0x8f')]||'')};var _0x17db80={'OpenchannelAccountId':_0x9edcc7[_0xeb75('0x59')]['id'],'closed':![]};if(_0x9edcc7['body'][_0xeb75('0x90')]){_0x17db80[_0xeb75('0x90')]=_0x9edcc7['body'][_0xeb75('0x90')];return db[_0xeb75('0x91')][_0xeb75('0x5c')]({'where':_0x17db80})['then'](function(_0x27d314){if(_0x27d314){return[_0x27d314,![]];}_0x3bb7ee[_0xeb75('0x90')]=_0x9edcc7['body'][_0xeb75('0x90')];_0x3bb7ee[_0xeb75('0x92')]=_0x9edcc7[_0xeb75('0x5e')]['externalUrl'];return db[_0xeb75('0x91')][_0xeb75('0x5d')](_0x3bb7ee)[_0xeb75('0x22')](function(_0x227167){return[_0x227167,!![]];});});}else{_0x17db80[_0xeb75('0x90')]=null;}_0x17db80[_0xeb75('0x93')]=_0x2ab93e['id'];return db[_0xeb75('0x91')][_0xeb75('0x5c')]({'where':_0x17db80})[_0xeb75('0x22')](function(_0x422e61){if(_0x422e61){return[_0x422e61,![]];}return db[_0xeb75('0x91')][_0xeb75('0x5d')](_0x3bb7ee)[_0xeb75('0x22')](function(_0x2b20c4){return[_0x2b20c4,!![]];});});}})[_0xeb75('0x94')](function(_0x5975b1,_0x456936){if(_0x5975b1){_0x543a5e=_0x456936;if(!_0x456936){var _0x84cf05={'from':(_0x3ceca5['contact'][_0xeb75('0x8e')]||'')+'\x20'+(_0x3ceca5[_0xeb75('0x8d')][_0xeb75('0x8f')]||'')};if(_0x9edcc7[_0xeb75('0x5e')]['threadId']&&_0x9edcc7[_0xeb75('0x5e')]['messageId']&&_0x9edcc7[_0xeb75('0x5e')]['threadId']!=_0x9edcc7[_0xeb75('0x5e')]['messageId']){_0x84cf05[_0xeb75('0x90')]=_0x9edcc7[_0xeb75('0x5e')]['messageId'];}return _0x5975b1[_0xeb75('0x37')](_0x84cf05);}else{return _0x5975b1;}}})[_0xeb75('0x22')](function(_0x1728cd){_0x3ceca5[_0xeb75('0x95')]=_0x1728cd[_0xeb75('0x38')]({'plain':!![]});_0x3ceca5[_0xeb75('0x95')][_0xeb75('0x96')]=_0x543a5e;if(_0x3ceca5['interaction'][_0xeb75('0x96')]){if(_0x3ceca5[_0xeb75('0x84')]['autoclose']){_0x3ceca5['applications']['push']({'id':0x0,'priority':_0x3ceca5[_0xeb75('0x89')][_0xeb75('0x4c')]+0x1,'app':'close','appdata':_0xeb75('0x97'),'interval':'*,*,*,*'});}}return db[_0xeb75('0x98')][_0xeb75('0x5d')]({'body':_0x9edcc7[_0xeb75('0x5e')][_0xeb75('0x5e')],'OpenchannelAccountId':_0x9edcc7['params']['id'],'OpenchannelInteractionId':_0x1728cd['id'],'direction':'in','ContactId':_0x3ceca5[_0xeb75('0x8d')]['id'],'AttachmentId':_0x9edcc7[_0xeb75('0x5e')][_0xeb75('0x99')]});})[_0xeb75('0x22')](function(_0x200789){_0x3ceca5['message']=_0x200789;if(_0x3ceca5[_0xeb75('0x95')]['UserId']){return db[_0xeb75('0x9a')][_0xeb75('0x5c')]({'attributes':['id',_0xeb75('0x3e')],'where':{'id':_0x3ceca5[_0xeb75('0x95')][_0xeb75('0x9b')]}})['then'](function(_0x4de5a3){if(_0x4de5a3){_0x3ceca5[_0xeb75('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0xeb75('0x9c'),'appdata':_0x4de5a3[_0xeb75('0x3e')]+','+(_0x3ceca5['account']['waitForTheAssignedAgent']||0xa),'interval':_0xeb75('0x9d')});_0x3ceca5[_0xeb75('0x9e')]=![];}return respondWithRpcPromise(_0xeb75('0x9f'),'startRouting',_0x3ceca5);});}return respondWithRpcPromise(_0xeb75('0x9f'),'startRouting',_0x3ceca5);})[_0xeb75('0x22')](function(_0x5b31cc){respondWithRpcPromise(_0xeb75('0xa0'),'EventManager',{'event':'notify','message':_0x5b31cc},client9002);return _0x5b31cc;})[_0xeb75('0x22')](respondWithResult(_0x43fd42,null))[_0xeb75('0x2b')](handleError(_0x43fd42,null));};exports['addApplications']=function(_0x1e6054,_0x4adeaf){var _0x1f7dd4=_0x1e6054[_0xeb75('0x59')]['id'];var _0x4d0dc9=_0x1e6054[_0xeb75('0x5e')];var _0x224d04=0xc8;var _0x4b4ff5=null;return db['sequelize'][_0xeb75('0xa1')]({'isolationLevel':db['sequelize']['Transaction'][_0xeb75('0xa2')][_0xeb75('0xa3')]},function(_0x338720){return db[_0xeb75('0x55')][_0xeb75('0x67')]({'where':{'id':_0x1f7dd4},'transaction':_0x338720})[_0xeb75('0x22')](function(_0x34f219){if(_0x34f219){return db[_0xeb75('0xa4')]['destroy']({'where':{'OpenchannelAccountId':_0x1f7dd4},'transaction':_0x338720})['then'](function(){var _0x491de9=_['map'](_0x4d0dc9,function(_0x7424ee){_0x7424ee[_0xeb75('0x64')]=_0x1f7dd4;return _0x7424ee;});return db[_0xeb75('0xa4')][_0xeb75('0xa5')](_0x491de9,{'transaction':_0x338720});});}else{_0x224d04=0x194;_0x4b4ff5=[];}});})[_0xeb75('0x22')](function(){if(_0x224d04!==0x194){return db[_0xeb75('0xa4')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1f7dd4},'order':_0xeb75('0x8a')})[_0xeb75('0x22')](function(_0x38f803){_0x4b4ff5=_0x38f803;});}})['catch'](function(_0x86454f){_0x224d04=0x1f4;logger[_0xeb75('0x27')](_0x86454f[_0xeb75('0x3d')]);if(_0x86454f['name']){delete _0x86454f['name'];}_0x4b4ff5=_0x86454f;})[_0xeb75('0xa6')](function(){if(_0x4b4ff5===null){_0x4adeaf[_0xeb75('0x2c')](_0x224d04);}else{if(_0x224d04===0x1f4){_0x4adeaf[_0xeb75('0x3c')](_0x224d04)['send'](_0x4b4ff5);}else{_0x4adeaf[_0xeb75('0x3c')](_0x224d04)[_0xeb75('0x2e')](_0x4b4ff5);}}});};exports['getApplications']=function(_0x568e92,_0x5c807c,_0x3e6aa3){var _0x584a8d={};var _0x256330={};var _0x1db69c;var _0x11a5dd;return db['OpenchannelAccount'][_0xeb75('0x67')]({'where':{'id':_0x568e92[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x5c807c,null))[_0xeb75('0x22')](function(_0x297d76){if(_0x297d76){_0x1db69c=_0x297d76;_0x256330[_0xeb75('0x46')]=_[_0xeb75('0x48')](db[_0xeb75('0xa4')]['rawAttributes']);_0x256330[_0xeb75('0x47')]=_[_0xeb75('0x48')](_0x568e92['query']);_0x256330[_0xeb75('0x50')]=_[_0xeb75('0x4a')](_0x256330[_0xeb75('0x46')],_0x256330['query']);_0x584a8d[_0xeb75('0x49')]=_[_0xeb75('0x4a')](_0x256330['model'],qs[_0xeb75('0x4b')](_0x568e92[_0xeb75('0x47')]['fields']));_0x584a8d[_0xeb75('0x49')]=_0x584a8d[_0xeb75('0x49')][_0xeb75('0x4c')]?_0x584a8d[_0xeb75('0x49')]:_0x256330[_0xeb75('0x46')];_0x584a8d[_0xeb75('0x4e')]=qs[_0xeb75('0x4f')](_0x568e92[_0xeb75('0x47')][_0xeb75('0x4f')]);_0x584a8d['where']=qs[_0xeb75('0x50')](_[_0xeb75('0x51')](_0x568e92[_0xeb75('0x47')],_0x256330[_0xeb75('0x50')]));if(_0x568e92[_0xeb75('0x47')]['filter']){_0x584a8d[_0xeb75('0x53')]=_[_0xeb75('0x54')](_0x584a8d[_0xeb75('0x53')],{'$or':_[_0xeb75('0x42')](_0x584a8d['attributes'],function(_0x1f8df3){var _0x18f5df={};_0x18f5df[_0x1f8df3]={'$like':'%'+_0x568e92[_0xeb75('0x47')]['filter']+'%'};return _0x18f5df;})});}_0x584a8d=_[_0xeb75('0x54')]({},_0x584a8d,_0x568e92[_0xeb75('0x5b')]);return _0x1db69c['getApplications'](_0x584a8d);}})[_0xeb75('0x22')](function(_0x573f4a){if(_0x573f4a){_0x11a5dd=_0x573f4a['length'];if(!_0x568e92[_0xeb75('0x47')]['hasOwnProperty'](_0xeb75('0x4d'))){_0x584a8d[_0xeb75('0x32')]=qs[_0xeb75('0x32')](_0x568e92[_0xeb75('0x47')]['limit']);_0x584a8d[_0xeb75('0x2f')]=qs[_0xeb75('0x2f')](_0x568e92[_0xeb75('0x47')][_0xeb75('0x2f')]);}return _0x1db69c[_0xeb75('0xa7')](_0x584a8d);}})['then'](function(_0x58e3d1){if(_0x58e3d1){return _0x58e3d1?{'count':_0x11a5dd,'rows':_0x58e3d1}:null;}})[_0xeb75('0x22')](respondWithResult(_0x5c807c,null))['catch'](handleError(_0x5c807c,null));};exports['getInteractions']=function(_0x23c90b,_0x3e7a6d,_0x7fcaaf){var _0x12f514={'raw':![],'where':{}};var _0x5afe49={};var _0x5662f7={'count':0x0,'rows':[]};return db[_0xeb75('0x55')]['findOne']({'where':{'id':_0x23c90b[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x3e7a6d,null))['then'](function(_0x35ac8e){if(_0x35ac8e){_0x5afe49[_0xeb75('0x46')]=_[_0xeb75('0x48')](db[_0xeb75('0x91')][_0xeb75('0x43')]);_0x5afe49['query']=_[_0xeb75('0x48')](_0x23c90b[_0xeb75('0x47')]);_0x5afe49[_0xeb75('0x50')]=_['intersection'](_0x5afe49[_0xeb75('0x46')],_0x5afe49['query']);_0x12f514[_0xeb75('0x49')]=_[_0xeb75('0x4a')](_0x5afe49[_0xeb75('0x46')],qs[_0xeb75('0x4b')](_0x23c90b[_0xeb75('0x47')]['fields']));_0x12f514['attributes']=_0x12f514[_0xeb75('0x49')][_0xeb75('0x4c')]?_0x12f514[_0xeb75('0x49')]:_0x5afe49['model'];if(!_0x23c90b[_0xeb75('0x47')][_0xeb75('0x68')](_0xeb75('0x4d'))){_0x12f514[_0xeb75('0x32')]=qs['limit'](_0x23c90b[_0xeb75('0x47')][_0xeb75('0x32')]);_0x12f514['offset']=qs[_0xeb75('0x2f')](_0x23c90b[_0xeb75('0x47')][_0xeb75('0x2f')]);}_0x12f514[_0xeb75('0x4e')]=qs[_0xeb75('0x4f')](_0x23c90b['query'][_0xeb75('0x4f')]);_0x12f514[_0xeb75('0x53')]=qs[_0xeb75('0x50')](_[_0xeb75('0x51')](_0x23c90b[_0xeb75('0x47')],_0x5afe49[_0xeb75('0x50')]));_0x12f514[_0xeb75('0x53')][_0xeb75('0x64')]=_0x35ac8e['id'];if(_0x23c90b['query'][_0xeb75('0x52')]){_0x12f514[_0xeb75('0x53')]=_[_0xeb75('0x54')](_0x12f514['where'],{'$or':_['map'](_0x12f514[_0xeb75('0x49')],function(_0x89d0da){var _0x3a18f9={};_0x3a18f9[_0x89d0da]={'$like':'%'+_0x23c90b['query'][_0xeb75('0x52')]+'%'};return _0x3a18f9;})});}_0x12f514=_[_0xeb75('0x54')]({},_0x12f514,_0x23c90b['options']);return db[_0xeb75('0x91')][_0xeb75('0x31')]({'where':_0x12f514[_0xeb75('0x53')]})['then'](function(_0x28178b){_0x5662f7[_0xeb75('0x31')]=_0x28178b;if(_0x23c90b[_0xeb75('0x47')]['includeAll']){_0x12f514[_0xeb75('0x5a')]=[{'model':db[_0xeb75('0x71')],'as':_0xeb75('0xa8'),'required':![]},{'model':db['User'],'as':_0xeb75('0xa9'),'attributes':[_0xeb75('0x3e'),'fullname',_0xeb75('0xaa')],'required':![]},{'model':db[_0xeb75('0xab')],'as':_0xeb75('0xac'),'attributes':['id','name','color'],'where':_0x23c90b[_0xeb75('0x47')][_0xeb75('0xad')]?{'id':_0x23c90b[_0xeb75('0x47')][_0xeb75('0xad')]}:undefined,'required':_0x23c90b[_0xeb75('0x47')][_0xeb75('0xad')]?!![]:![]}];}return db[_0xeb75('0x91')][_0xeb75('0x57')](_0x12f514);})[_0xeb75('0x22')](function(_0x36779d){_0x5662f7[_0xeb75('0x58')]=_0x36779d;return _0x5662f7;});}})[_0xeb75('0x22')](respondWithFilteredResult(_0x3e7a6d,_0x12f514))[_0xeb75('0x2b')](handleError(_0x3e7a6d,null));};exports[_0xeb75('0xae')]=function(_0x190d4d,_0x20da39,_0x173748){return db[_0xeb75('0x55')][_0xeb75('0x5c')]({'where':{'id':_0x190d4d['params']['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x20da39,null))[_0xeb75('0x22')](function(_0x3ff6aa){if(_0x3ff6aa){return _0x3ff6aa[_0xeb75('0xae')](_0x190d4d[_0xeb75('0x5e')]['ids'],_['omit'](_0x190d4d[_0xeb75('0x5e')],['ids','id'])||{})[_0xeb75('0x94')](function(_0x3af955){for(var _0x4f5204=0x0;_0x4f5204<_0x190d4d[_0xeb75('0x5e')]['ids'][_0xeb75('0x4c')];_0x4f5204+=0x1){socket[_0xeb75('0xaf')](_0xeb75('0xb0'),{'UserId':Number(_0x190d4d['body'][_0xeb75('0x6a')][_0x4f5204]),'OpenchannelAccountId':Number(_0x190d4d[_0xeb75('0x59')]['id'])});}return _0x3af955;});}})[_0xeb75('0x22')](respondWithResult(_0x20da39,null))[_0xeb75('0x2b')](handleError(_0x20da39,null));};exports['removeAgents']=function(_0x59b95f,_0xaaa4f4,_0x11d097){return db[_0xeb75('0x55')][_0xeb75('0x5c')]({'where':{'id':_0x59b95f['params']['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0xaaa4f4,null))[_0xeb75('0x22')](function(_0x1da063){if(_0x1da063){return _0x1da063[_0xeb75('0xb1')](_0x59b95f[_0xeb75('0x47')][_0xeb75('0x6a')])[_0xeb75('0x22')](function(){if(_['isArray'](_0x59b95f[_0xeb75('0x47')][_0xeb75('0x6a')])){for(var _0x75ac3f=0x0;_0x75ac3f<_0x59b95f['query'][_0xeb75('0x6a')][_0xeb75('0x4c')];_0x75ac3f+=0x1){socket[_0xeb75('0xaf')](_0xeb75('0xb2'),{'UserId':Number(_0x59b95f[_0xeb75('0x47')][_0xeb75('0x6a')][_0x75ac3f]),'OpenchannelAccountId':Number(_0x59b95f[_0xeb75('0x59')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x59b95f[_0xeb75('0x47')][_0xeb75('0x6a')]),'OpenchannelAccountId':Number(_0x59b95f[_0xeb75('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0xaaa4f4,null))[_0xeb75('0x2b')](handleError(_0xaaa4f4,null));};exports[_0xeb75('0xb3')]=function(_0x4a7847,_0x155766,_0x2de1cc){var _0x222ba2={};var _0x72754c={};var _0x49b241;var _0x174a55;return db[_0xeb75('0x55')][_0xeb75('0x67')]({'where':{'id':_0x4a7847[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x155766,null))['then'](function(_0x187573){if(_0x187573){_0x49b241=_0x187573;_0x72754c[_0xeb75('0x46')]=_[_0xeb75('0x48')](db[_0xeb75('0x9a')][_0xeb75('0x43')]);_0x72754c[_0xeb75('0x47')]=_['keys'](_0x4a7847[_0xeb75('0x47')]);_0x72754c['filters']=_[_0xeb75('0x4a')](_0x72754c['model'],_0x72754c[_0xeb75('0x47')]);_0x222ba2['attributes']=_[_0xeb75('0x4a')](_0x72754c[_0xeb75('0x46')],qs[_0xeb75('0x4b')](_0x4a7847['query'][_0xeb75('0x4b')]));_0x222ba2[_0xeb75('0x49')]=_0x222ba2['attributes'][_0xeb75('0x4c')]?_0x222ba2[_0xeb75('0x49')]:_0x72754c[_0xeb75('0x46')];_0x222ba2[_0xeb75('0x4e')]=qs['sort'](_0x4a7847[_0xeb75('0x47')][_0xeb75('0x4f')]);_0x222ba2[_0xeb75('0x53')]=qs[_0xeb75('0x50')](_[_0xeb75('0x51')](_0x4a7847[_0xeb75('0x47')],_0x72754c[_0xeb75('0x50')]));if(_0x4a7847[_0xeb75('0x47')][_0xeb75('0x52')]){_0x222ba2[_0xeb75('0x53')]=_[_0xeb75('0x54')](_0x222ba2[_0xeb75('0x53')],{'$or':_[_0xeb75('0x42')](_0x222ba2[_0xeb75('0x49')],function(_0x585949){var _0x2408f0={};_0x2408f0[_0x585949]={'$like':'%'+_0x4a7847['query']['filter']+'%'};return _0x2408f0;})});}_0x222ba2=_[_0xeb75('0x54')]({},_0x222ba2,_0x4a7847[_0xeb75('0x5b')]);return _0x49b241[_0xeb75('0xb3')](_0x222ba2);}})['then'](function(_0x4ad8b7){if(_0x4ad8b7){_0x174a55=_0x4ad8b7[_0xeb75('0x4c')];if(!_0x4a7847[_0xeb75('0x47')][_0xeb75('0x68')](_0xeb75('0x4d'))){_0x222ba2[_0xeb75('0x32')]=qs[_0xeb75('0x32')](_0x4a7847[_0xeb75('0x47')][_0xeb75('0x32')]);_0x222ba2[_0xeb75('0x2f')]=qs[_0xeb75('0x2f')](_0x4a7847[_0xeb75('0x47')][_0xeb75('0x2f')]);}return _0x49b241[_0xeb75('0xb3')](_0x222ba2);}})[_0xeb75('0x22')](function(_0x18b524){if(_0x18b524){return _0x18b524?{'count':_0x174a55,'rows':_0x18b524}:null;}})[_0xeb75('0x22')](respondWithResult(_0x155766,null))[_0xeb75('0x2b')](handleError(_0x155766,null));};exports[_0xeb75('0xb4')]=function(_0x446f8f,_0x498012,_0x1c863f){var _0x3373ea,_0x2da581,_0x3443ac;if(_[_0xeb75('0x7a')](_0x446f8f[_0xeb75('0x5e')]['body'])||_0x446f8f[_0xeb75('0x5e')][_0xeb75('0x5e')]===''){throw new db[(_0xeb75('0x72'))][(_0xeb75('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeb75('0x7a')](_0x446f8f[_0xeb75('0x5e')]['to'])){}_0x3373ea=_0x446f8f[_0xeb75('0x5e')]['to'];return db[_0xeb75('0x55')][_0xeb75('0x67')]({'where':{'id':_0x446f8f[_0xeb75('0x59')]['id']}})[_0xeb75('0x22')](handleEntityNotFound(_0x498012,null))[_0xeb75('0x22')](function(_0x1e172f){if(_0x1e172f){return db['OpenchannelAccount'][_0xeb75('0x5c')]({'where':{'id':_0x1e172f['id']},'include':[{'model':db[_0xeb75('0x81')],'as':_0xeb75('0x87'),'include':[{'model':db[_0xeb75('0x71')],'as':'Contacts','where':{[_0x1e172f[_0xeb75('0x7d')]]:_0x3373ea},'limit':0x1,'order':[[_0xeb75('0x76'),_0xeb75('0x83')]]}]}]})['then'](handleEntityNotFound(_0x498012,null))[_0xeb75('0x22')](function(_0x4d949a){if(_0x4d949a&&_0x4d949a['List']){_0x2da581=_0x4d949a['get']({'plain':!![]});if(_0x2da581[_0xeb75('0x87')]&&_0x2da581[_0xeb75('0x87')]['Contacts'][_0xeb75('0x4c')]){return _0x2da581[_0xeb75('0x87')][_0xeb75('0x82')][0x0];}return db[_0xeb75('0x71')][_0xeb75('0x5d')](_[_0xeb75('0x8c')](_0x446f8f['body'],{'firstName':_0x3373ea,[_0x4d949a[_0xeb75('0x7d')]]:_0x3373ea,'phone':_0x3373ea,'ListId':_0x2da581['ListId']}));}})[_0xeb75('0x22')](handleEntityNotFound(_0x498012,null))['then'](function(_0x44b742){if(_0x44b742){_0x3443ac=_0x44b742;return db['OpenchannelInteraction'][_0xeb75('0x5c')]({'where':{'ContactId':_0x3443ac['id'],'closed':![],'OpenchannelAccountId':_0x2da581['id']}})[_0xeb75('0x22')](function(_0x2e9421){if(_0x2e9421){return[_0x2e9421,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x446f8f['user']['id'],'ContactId':_0x3443ac['id'],'OpenchannelAccountId':_0x2da581['id'],'lastMsgDirection':_0xeb75('0xb5'),'Messages':[_[_0xeb75('0x54')](_0x446f8f[_0xeb75('0x5e')],{'read':![],'body':_0x446f8f['body'][_0xeb75('0x5e')],'OpenchannelAccountId':_0x2da581['id'],'UserId':_0x446f8f[_0xeb75('0x5f')]['id'],'ContactId':_0x3443ac['id']})]},{'include':[{'model':db[_0xeb75('0x98')],'as':'Messages'}]})[_0xeb75('0x22')](function(_0x5b4f09){return[_0x5b4f09,!![]];});});}})[_0xeb75('0x94')](function(_0x34d07f,_0x34ed42){if(_0x34ed42){return _0x34d07f;}return db[_0xeb75('0x98')][_0xeb75('0x5d')](_[_0xeb75('0x54')](_0x446f8f[_0xeb75('0x5e')],{'read':![],'body':_0x446f8f[_0xeb75('0x5e')]['body'],'OpenchannelAccountId':_0x2da581['id'],'OpenchannelInteractionId':_0x34d07f['id'],'UserId':_0x446f8f[_0xeb75('0x5f')]['id'],'ContactId':_0x3443ac['id']}))[_0xeb75('0x22')](function(_0x3b813f){_0x34d07f[_0xeb75('0xb6')][_0xeb75('0xb7')]=[];_0x34d07f[_0xeb75('0xb6')][_0xeb75('0xb7')][_0xeb75('0xb8')](_0x3b813f['dataValues']);return _0x34d07f;});});}})[_0xeb75('0x22')](respondWithResult(_0x498012,null))['catch'](handleError(_0x498012,null));}; \ No newline at end of file +var _0xd92b=['out','OpenchannelMessage','Messages','dataValues','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','Disposition','getDispositions','findOne','pick','OpenchannelAccountId','removeDispositions','addAnswer','order','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','Transaction','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','ids','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC'];(function(_0x23a43d,_0x4d825b){var _0x237807=function(_0x3c398a){while(--_0x3c398a){_0x23a43d['push'](_0x23a43d['shift']());}};_0x237807(++_0x4d825b);}(_0xd92b,0xc6));var _0xbd92=function(_0x1f9ad2,_0x3fa6a2){_0x1f9ad2=_0x1f9ad2-0x0;var _0xaf026f=_0xd92b[_0x1f9ad2];return _0xaf026f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd92('0x0'));var jsonpatch=require(_0xbd92('0x1'));var rp=require(_0xbd92('0x2'));var moment=require('moment');var BPromise=require(_0xbd92('0x3'));var Mustache=require(_0xbd92('0x4'));var util=require(_0xbd92('0x5'));var path=require(_0xbd92('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd92('0x7'));var fs=require('fs');var fs_extra=require(_0xbd92('0x8'));var _=require(_0xbd92('0x9'));var squel=require(_0xbd92('0xa'));var crypto=require(_0xbd92('0xb'));var jsforce=require(_0xbd92('0xc'));var deskjs=require(_0xbd92('0xd'));var toCsv=require(_0xbd92('0xe'));var querystring=require('querystring');var Papa=require(_0xbd92('0xf'));var Redis=require(_0xbd92('0x10'));var authService=require(_0xbd92('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbd92('0x12'));var hardwareService=require(_0xbd92('0x13'));var logger=require(_0xbd92('0x14'))('api');var utils=require(_0xbd92('0x15'));var config=require(_0xbd92('0x16'));var licenseUtil=require(_0xbd92('0x17'));var db=require(_0xbd92('0x18'))['db'];config[_0xbd92('0x19')]=_[_0xbd92('0x1a')](config['redis'],{'host':_0xbd92('0x1b'),'port':0x18eb});var socket=require(_0xbd92('0x1c'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xbd92('0x1d')](socket);var jayson=require(_0xbd92('0x1e'));var client=jayson[_0xbd92('0x1f')][_0xbd92('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xbd92('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4bd07e,_0x206b94,_0x117391,_0x336ee0){return new BPromise(function(_0x3139b9,_0x29d815){var _0x534a4f=_0x336ee0||client;return _0x534a4f['request'](_0x4bd07e,_0x117391)[_0xbd92('0x21')](function(_0xca77b3){logger[_0xbd92('0x22')](_0xbd92('0x23'),_0x206b94,_0xbd92('0x24'));logger[_0xbd92('0x25')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x206b94,'request\x20sent',JSON[_0xbd92('0x26')](_0xca77b3));if(_0xca77b3[_0xbd92('0x27')]){if(_0xca77b3[_0xbd92('0x27')][_0xbd92('0x28')]===0x1f4){logger[_0xbd92('0x27')](_0xbd92('0x23'),_0x206b94,_0xca77b3[_0xbd92('0x27')][_0xbd92('0x29')]);return _0x29d815(_0xca77b3[_0xbd92('0x27')][_0xbd92('0x29')]);}logger[_0xbd92('0x27')](_0xbd92('0x23'),_0x206b94,_0xca77b3[_0xbd92('0x27')]['message']);return _0x3139b9(_0xca77b3['error']['message']);}else{logger[_0xbd92('0x22')](_0xbd92('0x23'),_0x206b94,'request\x20sent');_0x3139b9(_0xca77b3[_0xbd92('0x2a')][_0xbd92('0x29')]);}})['catch'](function(_0x31ef1f){logger['error'](_0xbd92('0x23'),_0x206b94,_0x31ef1f);_0x29d815(_0x31ef1f);});});}function respondWithStatusCode(_0x3b424,_0x51a5fa){_0x51a5fa=_0x51a5fa||0xcc;return function(_0x296a96){if(_0x296a96){return _0x3b424[_0xbd92('0x2b')](_0x51a5fa);}return _0x3b424[_0xbd92('0x2c')](_0x51a5fa)[_0xbd92('0x2d')]();};}function respondWithResult(_0x29fd7a,_0x2f1aeb){_0x2f1aeb=_0x2f1aeb||0xc8;return function(_0x2bc873){if(_0x2bc873){return _0x29fd7a[_0xbd92('0x2c')](_0x2f1aeb)[_0xbd92('0x2e')](_0x2bc873);}};}function respondWithFilteredResult(_0x388281,_0x15ff43){return function(_0xf739e3){if(_0xf739e3){var _0x21dc1e=typeof _0x15ff43[_0xbd92('0x2f')]===_0xbd92('0x30')&&typeof _0x15ff43[_0xbd92('0x31')]===_0xbd92('0x30');var _0x42283d=_0xf739e3[_0xbd92('0x32')];var _0x5f173a=_0x21dc1e?0x0:_0x15ff43[_0xbd92('0x2f')];var _0x50e4be=_0x21dc1e?_0xf739e3[_0xbd92('0x32')]:_0x15ff43[_0xbd92('0x2f')]+_0x15ff43[_0xbd92('0x31')];var _0x58ed98;if(_0x50e4be>=_0x42283d){_0x50e4be=_0x42283d;_0x58ed98=0xc8;}else{_0x58ed98=0xce;}_0x388281['status'](_0x58ed98);return _0x388281['set'](_0xbd92('0x33'),_0x5f173a+'-'+_0x50e4be+'/'+_0x42283d)[_0xbd92('0x2e')](_0xf739e3);}return null;};}function patchUpdates(_0x1ab5d5){return function(_0x5b8b56){try{jsonpatch[_0xbd92('0x34')](_0x5b8b56,_0x1ab5d5,!![]);}catch(_0x5988c9){return BPromise['reject'](_0x5988c9);}return _0x5b8b56[_0xbd92('0x35')]();};}function saveUpdates(_0x6925fe,_0x5a660d){return function(_0x138d3d){if(_0x138d3d){return _0x138d3d[_0xbd92('0x36')](_0x6925fe)['then'](function(_0x1ae618){return _0x1ae618;});}return null;};}function removeEntity(_0xb48768,_0x3f3e6b){return function(_0x432654){if(_0x432654){return _0x432654[_0xbd92('0x37')]()[_0xbd92('0x21')](function(){var _0x463ad2=_0x432654[_0xbd92('0x38')]({'plain':!![]});var _0x4063c0=_0xbd92('0x39');return db[_0xbd92('0x3a')]['destroy']({'where':{'type':_0x4063c0,'resourceId':_0x463ad2['id']}})[_0xbd92('0x21')](function(){return _0x432654;});})[_0xbd92('0x21')](function(){_0xb48768[_0xbd92('0x2c')](0xcc)[_0xbd92('0x2d')]();});}};}function handleEntityNotFound(_0x47a775,_0x3fbc6a){return function(_0x337623){if(!_0x337623){_0x47a775[_0xbd92('0x2b')](0x194);}return _0x337623;};}function handleError(_0x5365d2,_0x21cd07){_0x21cd07=_0x21cd07||0x1f4;return function(_0x3a3641){logger[_0xbd92('0x27')](_0x3a3641[_0xbd92('0x3b')]);if(_0x3a3641[_0xbd92('0x3c')]){delete _0x3a3641[_0xbd92('0x3c')];}_0x5365d2[_0xbd92('0x2c')](_0x21cd07)['send'](_0x3a3641);};}exports[_0xbd92('0x3d')]=function(_0x559a3f,_0x40da67){var _0x29a585={'include':[{'model':db[_0xbd92('0x3e')],'as':_0xbd92('0x3f')}]},_0x104e2e={},_0x39aaf4={'count':0x0,'rows':[]};var _0x1634ec=_[_0xbd92('0x40')](db[_0xbd92('0x41')]['rawAttributes'],function(_0x591514){return{'name':_0x591514[_0xbd92('0x42')],'type':_0x591514['type']['key']};});_0x104e2e[_0xbd92('0x43')]=_[_0xbd92('0x40')](_0x1634ec,_0xbd92('0x3c'));_0x104e2e[_0xbd92('0x44')]=_[_0xbd92('0x45')](_0x559a3f['query']);_0x104e2e[_0xbd92('0x46')]=_['intersection'](_0x104e2e['model'],_0x104e2e[_0xbd92('0x44')]);_0x29a585['attributes']=_[_0xbd92('0x47')](_0x104e2e[_0xbd92('0x43')],qs[_0xbd92('0x48')](_0x559a3f[_0xbd92('0x44')]['fields']));_0x29a585[_0xbd92('0x49')]=_0x29a585[_0xbd92('0x49')][_0xbd92('0x4a')]?_0x29a585[_0xbd92('0x49')]:_0x104e2e[_0xbd92('0x43')];if(!_0x559a3f[_0xbd92('0x44')][_0xbd92('0x4b')](_0xbd92('0x4c'))){_0x29a585['limit']=qs['limit'](_0x559a3f['query'][_0xbd92('0x31')]);_0x29a585['offset']=qs['offset'](_0x559a3f['query'][_0xbd92('0x2f')]);}_0x29a585['order']=qs[_0xbd92('0x4d')](_0x559a3f[_0xbd92('0x44')][_0xbd92('0x4d')]);_0x29a585[_0xbd92('0x4e')]=qs['filters'](_['pick'](_0x559a3f[_0xbd92('0x44')],_0x104e2e[_0xbd92('0x46')]),_0x1634ec);if(_0x559a3f['query'][_0xbd92('0x4f')]){_0x29a585[_0xbd92('0x4e')]=_[_0xbd92('0x50')](_0x29a585[_0xbd92('0x4e')],{'$or':_[_0xbd92('0x40')](_0x1634ec,function(_0x2f4421){if(_0x2f4421[_0xbd92('0x51')]!==_0xbd92('0x52')){var _0x1ce27f={};_0x1ce27f[_0x2f4421[_0xbd92('0x3c')]]={'$like':'%'+_0x559a3f['query'][_0xbd92('0x4f')]+'%'};return _0x1ce27f;}})});}_0x29a585=_[_0xbd92('0x50')]({},_0x29a585,_0x559a3f[_0xbd92('0x53')]);var _0x2f9ad1={'where':_0x29a585[_0xbd92('0x4e')]};return db[_0xbd92('0x41')][_0xbd92('0x32')](_0x2f9ad1)['then'](function(_0x35b2b1){_0x39aaf4['count']=_0x35b2b1;if(_0x559a3f[_0xbd92('0x44')]['includeAll']){_0x29a585[_0xbd92('0x54')]=[{'all':!![]}];}return db[_0xbd92('0x41')][_0xbd92('0x55')](_0x29a585);})[_0xbd92('0x21')](function(_0x4152f2){_0x39aaf4[_0xbd92('0x56')]=_0x4152f2;return _0x39aaf4;})[_0xbd92('0x21')](respondWithFilteredResult(_0x40da67,_0x29a585))[_0xbd92('0x57')](handleError(_0x40da67,null));};exports[_0xbd92('0x58')]=function(_0x52955a,_0x3c5236){var _0x56ba59={'raw':![],'where':{'id':_0x52955a[_0xbd92('0x59')]['id']},'include':[{'model':db[_0xbd92('0x3e')],'as':_0xbd92('0x3f')}]},_0x194a16={};_0x194a16[_0xbd92('0x43')]=_['keys'](db[_0xbd92('0x41')][_0xbd92('0x5a')]);_0x194a16[_0xbd92('0x44')]=_[_0xbd92('0x45')](_0x52955a[_0xbd92('0x44')]);_0x194a16[_0xbd92('0x46')]=_[_0xbd92('0x47')](_0x194a16['model'],_0x194a16[_0xbd92('0x44')]);_0x56ba59['attributes']=_[_0xbd92('0x47')](_0x194a16[_0xbd92('0x43')],qs[_0xbd92('0x48')](_0x52955a[_0xbd92('0x44')]['fields']));_0x56ba59[_0xbd92('0x49')]=_0x56ba59['attributes'][_0xbd92('0x4a')]?_0x56ba59['attributes']:_0x194a16[_0xbd92('0x43')];if(_0x52955a[_0xbd92('0x44')][_0xbd92('0x5b')]){_0x56ba59[_0xbd92('0x54')]=[{'all':!![]}];}_0x56ba59=_[_0xbd92('0x50')]({},_0x56ba59,_0x52955a['options']);return db[_0xbd92('0x41')][_0xbd92('0x5c')](_0x56ba59)[_0xbd92('0x21')](handleEntityNotFound(_0x3c5236,null))[_0xbd92('0x21')](respondWithResult(_0x3c5236,null))[_0xbd92('0x57')](handleError(_0x3c5236,null));};exports[_0xbd92('0x5d')]=function(_0x51340f,_0x5c1830){return db[_0xbd92('0x41')][_0xbd92('0x5d')](_0x51340f['body'],{})[_0xbd92('0x21')](function(_0x19b980){var _0x369eb6=_0x51340f[_0xbd92('0x5e')]['get']({'plain':!![]});if(!_0x369eb6)throw new Error(_0xbd92('0x5f'));if(_0x369eb6[_0xbd92('0x60')]===_0xbd92('0x5e')){var _0x2a8c1d=_0x19b980[_0xbd92('0x38')]({'plain':!![]});var _0xa4a4a1=_0xbd92('0x39');return db[_0xbd92('0x61')][_0xbd92('0x5c')]({'where':{'name':_0xa4a4a1,'userProfileId':_0x369eb6[_0xbd92('0x62')]},'raw':!![]})[_0xbd92('0x21')](function(_0xf7a722){if(_0xf7a722&&_0xf7a722[_0xbd92('0x63')]===0x0){return db[_0xbd92('0x3a')][_0xbd92('0x5d')]({'name':_0x2a8c1d[_0xbd92('0x3c')],'resourceId':_0x2a8c1d['id'],'type':_0xf7a722[_0xbd92('0x3c')],'sectionId':_0xf7a722['id']},{})[_0xbd92('0x21')](function(){return _0x19b980;});}else{return _0x19b980;}})[_0xbd92('0x57')](function(_0x815fa8){logger[_0xbd92('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x815fa8);throw _0x815fa8;});}return _0x19b980;})['then'](respondWithResult(_0x5c1830,0xc9))[_0xbd92('0x57')](handleError(_0x5c1830,null));};exports['update']=function(_0x1f9699,_0x23f7e8){if(_0x1f9699['body']['id']){delete _0x1f9699[_0xbd92('0x64')]['id'];}return db[_0xbd92('0x41')][_0xbd92('0x5c')]({'where':{'id':_0x1f9699[_0xbd92('0x59')]['id']},'include':[{'model':db[_0xbd92('0x3e')],'as':_0xbd92('0x3f')}]})[_0xbd92('0x21')](handleEntityNotFound(_0x23f7e8,null))[_0xbd92('0x21')](saveUpdates(_0x1f9699[_0xbd92('0x64')],null))[_0xbd92('0x21')](respondWithResult(_0x23f7e8,null))[_0xbd92('0x57')](handleError(_0x23f7e8,null));};exports[_0xbd92('0x37')]=function(_0x184d68,_0x4ae890){return db[_0xbd92('0x41')]['find']({'where':{'id':_0x184d68[_0xbd92('0x59')]['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x4ae890,null))[_0xbd92('0x21')](removeEntity(_0x4ae890,null))[_0xbd92('0x57')](handleError(_0x4ae890,null));};exports['describe']=function(_0x53f9f9,_0x34e28a){return db[_0xbd92('0x41')][_0xbd92('0x65')]()[_0xbd92('0x21')](respondWithResult(_0x34e28a,null))[_0xbd92('0x57')](handleError(_0x34e28a,null));};exports[_0xbd92('0x66')]=function(_0x41449e,_0x587918,_0xc27494){if(_0x41449e[_0xbd92('0x64')]['id']){delete _0x41449e[_0xbd92('0x64')]['id'];}return db[_0xbd92('0x41')][_0xbd92('0x5c')]({'where':{'id':_0x41449e[_0xbd92('0x59')]['id']}})['then'](handleEntityNotFound(_0x587918,null))['then'](function(_0x2b914a){if(_0x2b914a){_0x41449e[_0xbd92('0x64')]['OpenchannelAccountId']=_0x2b914a['id'];return db[_0xbd92('0x67')][_0xbd92('0x5d')](_0x41449e[_0xbd92('0x64')]);}})[_0xbd92('0x21')](respondWithResult(_0x587918,null))['catch'](handleError(_0x587918,null));};exports[_0xbd92('0x68')]=function(_0x1c0958,_0xea191d,_0x79bdec){var _0x802aa9={'raw':![],'where':{}};var _0x2bfb92={};var _0x857e45={'count':0x0,'rows':[]};return db[_0xbd92('0x41')][_0xbd92('0x69')]({'where':{'id':_0x1c0958['params']['id']}})['then'](handleEntityNotFound(_0xea191d,null))[_0xbd92('0x21')](function(_0x5e4f9c){if(_0x5e4f9c){_0x2bfb92[_0xbd92('0x43')]=_[_0xbd92('0x45')](db[_0xbd92('0x67')][_0xbd92('0x5a')]);_0x2bfb92[_0xbd92('0x44')]=_['keys'](_0x1c0958[_0xbd92('0x44')]);_0x2bfb92[_0xbd92('0x46')]=_[_0xbd92('0x47')](_0x2bfb92[_0xbd92('0x43')],_0x2bfb92[_0xbd92('0x44')]);_0x802aa9[_0xbd92('0x49')]=_['intersection'](_0x2bfb92[_0xbd92('0x43')],qs[_0xbd92('0x48')](_0x1c0958[_0xbd92('0x44')][_0xbd92('0x48')]));_0x802aa9[_0xbd92('0x49')]=_0x802aa9['attributes'][_0xbd92('0x4a')]?_0x802aa9[_0xbd92('0x49')]:_0x2bfb92[_0xbd92('0x43')];if(!_0x1c0958['query']['hasOwnProperty'](_0xbd92('0x4c'))){_0x802aa9[_0xbd92('0x31')]=qs[_0xbd92('0x31')](_0x1c0958[_0xbd92('0x44')]['limit']);_0x802aa9['offset']=qs[_0xbd92('0x2f')](_0x1c0958[_0xbd92('0x44')]['offset']);}_0x802aa9['order']=qs['sort'](_0x1c0958[_0xbd92('0x44')]['sort']);_0x802aa9['where']=qs[_0xbd92('0x46')](_[_0xbd92('0x6a')](_0x1c0958[_0xbd92('0x44')],_0x2bfb92[_0xbd92('0x46')]));_0x802aa9[_0xbd92('0x4e')][_0xbd92('0x6b')]=_0x5e4f9c['id'];if(_0x1c0958[_0xbd92('0x44')][_0xbd92('0x4f')]){_0x802aa9[_0xbd92('0x4e')]=_[_0xbd92('0x50')](_0x802aa9[_0xbd92('0x4e')],{'$or':_[_0xbd92('0x40')](_0x802aa9[_0xbd92('0x49')],function(_0x232216){var _0x5e5f19={};_0x5e5f19[_0x232216]={'$like':'%'+_0x1c0958[_0xbd92('0x44')][_0xbd92('0x4f')]+'%'};return _0x5e5f19;})});}_0x802aa9=_[_0xbd92('0x50')]({},_0x802aa9,_0x1c0958[_0xbd92('0x53')]);return db[_0xbd92('0x67')][_0xbd92('0x32')]({'where':_0x802aa9[_0xbd92('0x4e')]})[_0xbd92('0x21')](function(_0x555b85){_0x857e45[_0xbd92('0x32')]=_0x555b85;if(_0x1c0958[_0xbd92('0x44')][_0xbd92('0x5b')]){_0x802aa9[_0xbd92('0x54')]=[{'all':!![]}];}return db[_0xbd92('0x67')][_0xbd92('0x55')](_0x802aa9);})['then'](function(_0x1fae19){_0x857e45[_0xbd92('0x56')]=_0x1fae19;return _0x857e45;});}})[_0xbd92('0x21')](respondWithFilteredResult(_0xea191d,_0x802aa9))[_0xbd92('0x57')](handleError(_0xea191d,null));};exports['removeDispositions']=function(_0x4803d3,_0x170ade,_0x145b85){return db['OpenchannelAccount'][_0xbd92('0x5c')]({'where':{'id':_0x4803d3['params']['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x170ade,null))['then'](function(_0x1d3302){if(_0x1d3302){return _0x1d3302[_0xbd92('0x6c')](_0x4803d3[_0xbd92('0x44')]['ids']);}})[_0xbd92('0x21')](respondWithStatusCode(_0x170ade,null))['catch'](handleError(_0x170ade,null));};exports[_0xbd92('0x6d')]=function(_0x24eeef,_0x501ae5,_0x49d28d){if(_0x24eeef[_0xbd92('0x64')]['id']){delete _0x24eeef[_0xbd92('0x64')]['id'];}return db[_0xbd92('0x41')][_0xbd92('0x5c')]({'where':{'id':_0x24eeef[_0xbd92('0x59')]['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x501ae5,null))['then'](function(_0x14fc7d){if(_0x14fc7d){_0x24eeef[_0xbd92('0x64')]['OpenchannelAccountId']=_0x14fc7d['id'];return db['CannedAnswer'][_0xbd92('0x5d')](_0x24eeef[_0xbd92('0x64')]);}})[_0xbd92('0x21')](respondWithResult(_0x501ae5,null))[_0xbd92('0x57')](handleError(_0x501ae5,null));};exports['getAnswers']=function(_0x24dacc,_0x210e47,_0x56e407){var _0x421d91={'raw':![],'where':{}};var _0x5207a3={};var _0x3d5705={'count':0x0,'rows':[]};return db[_0xbd92('0x41')][_0xbd92('0x69')]({'where':{'id':_0x24dacc[_0xbd92('0x59')]['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x210e47,null))['then'](function(_0x4a5789){if(_0x4a5789){_0x5207a3['model']=_['keys'](db['CannedAnswer'][_0xbd92('0x5a')]);_0x5207a3[_0xbd92('0x44')]=_[_0xbd92('0x45')](_0x24dacc[_0xbd92('0x44')]);_0x5207a3['filters']=_[_0xbd92('0x47')](_0x5207a3['model'],_0x5207a3['query']);_0x421d91[_0xbd92('0x49')]=_[_0xbd92('0x47')](_0x5207a3['model'],qs['fields'](_0x24dacc[_0xbd92('0x44')][_0xbd92('0x48')]));_0x421d91[_0xbd92('0x49')]=_0x421d91['attributes'][_0xbd92('0x4a')]?_0x421d91['attributes']:_0x5207a3[_0xbd92('0x43')];if(!_0x24dacc[_0xbd92('0x44')][_0xbd92('0x4b')](_0xbd92('0x4c'))){_0x421d91[_0xbd92('0x31')]=qs['limit'](_0x24dacc[_0xbd92('0x44')][_0xbd92('0x31')]);_0x421d91[_0xbd92('0x2f')]=qs[_0xbd92('0x2f')](_0x24dacc[_0xbd92('0x44')][_0xbd92('0x2f')]);}_0x421d91[_0xbd92('0x6e')]=qs[_0xbd92('0x4d')](_0x24dacc['query'][_0xbd92('0x4d')]);_0x421d91[_0xbd92('0x4e')]=qs[_0xbd92('0x46')](_['pick'](_0x24dacc['query'],_0x5207a3['filters']));_0x421d91[_0xbd92('0x4e')][_0xbd92('0x6b')]=_0x4a5789['id'];if(_0x24dacc[_0xbd92('0x44')][_0xbd92('0x4f')]){_0x421d91[_0xbd92('0x4e')]=_['merge'](_0x421d91[_0xbd92('0x4e')],{'$or':_[_0xbd92('0x40')](_0x421d91[_0xbd92('0x49')],function(_0x15c361){var _0x3fb903={};_0x3fb903[_0x15c361]={'$like':'%'+_0x24dacc['query'][_0xbd92('0x4f')]+'%'};return _0x3fb903;})});}_0x421d91=_['merge']({},_0x421d91,_0x24dacc['options']);return db[_0xbd92('0x6f')][_0xbd92('0x32')]({'where':_0x421d91[_0xbd92('0x4e')]})[_0xbd92('0x21')](function(_0x170339){_0x3d5705[_0xbd92('0x32')]=_0x170339;if(_0x24dacc[_0xbd92('0x44')]['includeAll']){_0x421d91[_0xbd92('0x54')]=[{'all':!![]}];}return db[_0xbd92('0x6f')]['findAll'](_0x421d91);})[_0xbd92('0x21')](function(_0x40d348){_0x3d5705[_0xbd92('0x56')]=_0x40d348;return _0x3d5705;});}})[_0xbd92('0x21')](respondWithFilteredResult(_0x210e47,_0x421d91))[_0xbd92('0x57')](handleError(_0x210e47,null));};exports[_0xbd92('0x70')]=function(_0x23447e,_0xae8447,_0x320dc3){return db[_0xbd92('0x41')]['find']({'where':{'id':_0x23447e[_0xbd92('0x59')]['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0xae8447,null))[_0xbd92('0x21')](function(_0x9acf4c){if(_0x9acf4c){return _0x9acf4c[_0xbd92('0x70')](_0x23447e[_0xbd92('0x44')]['ids']);}})[_0xbd92('0x21')](respondWithStatusCode(_0xae8447,null))[_0xbd92('0x57')](handleError(_0xae8447,null));};exports[_0xbd92('0x71')]=function(_0x3fb965,_0x28abfe,_0x234e87){var _0x38741b={'body':_0x3fb965[_0xbd92('0x64')],'channel':_0xbd92('0x72')};var _0x1ce817=[];var _0x425e96=[];var _0x24dc8f={};var _0x6ec785=![];return db[_0xbd92('0x73')]['describe']()[_0xbd92('0x21')](function(_0x38a126){if(!_0x38a126){throw new db[(_0xbd92('0x74'))][(_0xbd92('0x75'))]('no\x20available\x20attributes');}_0x1ce817=_[_0xbd92('0x76')](_[_0xbd92('0x45')](_0x38a126),[_0xbd92('0x77'),'updatedAt']);_0x425e96=_[_0xbd92('0x76')](_[_0xbd92('0x45')](_0x38a126),['createdAt','updatedAt',_0xbd92('0x78'),_0xbd92('0x79')]);if(_0x3fb965['body']['id']){delete _0x3fb965['body']['id'];}if(_[_0xbd92('0x7a')](_0x3fb965[_0xbd92('0x64')][_0xbd92('0x7b')])){throw new db[(_0xbd92('0x74'))][(_0xbd92('0x75'))](_0xbd92('0x7c'));}if(_['isNil'](_0x3fb965[_0xbd92('0x64')][_0xbd92('0x64')])||_0x3fb965[_0xbd92('0x64')][_0xbd92('0x64')]===''){throw new db[(_0xbd92('0x74'))][(_0xbd92('0x75'))](_0xbd92('0x7d'));}if(_[_0xbd92('0x7a')](_0x3fb965[_0xbd92('0x64')][_0xbd92('0x7e')])){throw new db[(_0xbd92('0x74'))]['ValidationError'](_0xbd92('0x7f')+_0x425e96);}if(!_['includes'](_0x425e96,_0x3fb965[_0xbd92('0x64')][_0xbd92('0x7e')])){throw new db[(_0xbd92('0x74'))][(_0xbd92('0x75'))](_0xbd92('0x80')+_0x425e96);}_0x24dc8f[_0x3fb965['body'][_0xbd92('0x7e')]]=_0x3fb965[_0xbd92('0x64')]['from'];})[_0xbd92('0x21')](function(){return db[_0xbd92('0x41')][_0xbd92('0x5c')]({'where':{'id':_0x3fb965[_0xbd92('0x59')]['id']},'include':[{'model':db[_0xbd92('0x81')],'as':_0xbd92('0x82'),'include':[{'model':db[_0xbd92('0x73')],'as':_0xbd92('0x83'),'where':_0x24dc8f,'limit':0x1,'order':[[_0xbd92('0x84'),'DESC']]}]},{'model':db[_0xbd92('0x85')],'as':_0xbd92('0x86')}]});})[_0xbd92('0x21')](handleEntityNotFound(_0x28abfe,null))[_0xbd92('0x21')](function(_0x706a84){if(_0x706a84&&_0x706a84[_0xbd92('0x82')]){_0x38741b['account']=_0x706a84;_0x38741b[_0xbd92('0x87')]=_0x706a84[_0xbd92('0x86')];_0x38741b[_0xbd92('0x88')]=_0x706a84[_0xbd92('0x82')];_0x38741b[_0xbd92('0x87')]=_[_0xbd92('0x89')](_0x38741b[_0xbd92('0x87')],[_0xbd92('0x8a')],[_0xbd92('0x8b')]);if(_0x38741b['account'][_0xbd92('0x86')]){delete _0x38741b[_0xbd92('0x8c')][_0xbd92('0x86')];}if(_0x38741b[_0xbd92('0x8c')]['List']&&_0x38741b[_0xbd92('0x8c')][_0xbd92('0x82')][_0xbd92('0x83')]['length']){return _0x38741b[_0xbd92('0x8c')][_0xbd92('0x82')][_0xbd92('0x83')][0x0];}var _0x47c9cb=_[_0xbd92('0x1a')](_0x3fb965[_0xbd92('0x64')],{'firstName':_0x3fb965[_0xbd92('0x64')]['from'],'ListId':_0x706a84[_0xbd92('0x79')]});_0x47c9cb[_0x3fb965[_0xbd92('0x64')][_0xbd92('0x7e')]]=_0x3fb965[_0xbd92('0x64')][_0xbd92('0x7b')];return db['CmContact'][_0xbd92('0x5d')](_0x47c9cb,{'fields':_0x1ce817,'raw':!![]});}})[_0xbd92('0x21')](handleEntityNotFound(_0x28abfe,null))['then'](function(_0x3b95b2){_0x38741b[_0xbd92('0x8d')]=_0x3b95b2;if(_0x3b95b2){var _0x26a07d={'ContactId':_0x3b95b2['id'],'OpenchannelAccountId':_0x3fb965['params']['id'],'from':(_0x3b95b2[_0xbd92('0x8e')]||'')+'\x20'+(_0x3b95b2[_0xbd92('0x8f')]||'')};var _0x3f3a0b={'OpenchannelAccountId':_0x3fb965['params']['id'],'closed':![]};if(_0x3fb965[_0xbd92('0x64')]['threadId']){_0x3f3a0b[_0xbd92('0x90')]=_0x3fb965['body'][_0xbd92('0x90')];return db[_0xbd92('0x91')][_0xbd92('0x5c')]({'where':_0x3f3a0b})['then'](function(_0x1b5a3b){if(_0x1b5a3b){return[_0x1b5a3b,![]];}_0x26a07d['threadId']=_0x3fb965['body']['threadId'];_0x26a07d[_0xbd92('0x92')]=_0x3fb965['body'][_0xbd92('0x92')];return db['OpenchannelInteraction'][_0xbd92('0x5d')](_0x26a07d)[_0xbd92('0x21')](function(_0x54d92c){return[_0x54d92c,!![]];});});}else{_0x3f3a0b['threadId']=null;}_0x3f3a0b[_0xbd92('0x93')]=_0x3b95b2['id'];return db[_0xbd92('0x91')][_0xbd92('0x5c')]({'where':_0x3f3a0b})['then'](function(_0x35e114){if(_0x35e114){return[_0x35e114,![]];}return db[_0xbd92('0x91')]['create'](_0x26a07d)['then'](function(_0x3d2d6f){return[_0x3d2d6f,!![]];});});}})[_0xbd92('0x94')](function(_0xbbceb5,_0x2f4395){if(_0xbbceb5){_0x6ec785=_0x2f4395;if(!_0x2f4395){var _0x48a08a={'from':(_0x38741b[_0xbd92('0x8d')][_0xbd92('0x8e')]||'')+'\x20'+(_0x38741b[_0xbd92('0x8d')][_0xbd92('0x8f')]||'')};if(_0x3fb965[_0xbd92('0x64')][_0xbd92('0x90')]&&_0x3fb965['body'][_0xbd92('0x95')]&&_0x3fb965['body'][_0xbd92('0x90')]!=_0x3fb965['body'][_0xbd92('0x95')]){_0x48a08a[_0xbd92('0x90')]=_0x3fb965[_0xbd92('0x64')][_0xbd92('0x95')];}return _0xbbceb5[_0xbd92('0x36')](_0x48a08a);}else{return _0xbbceb5;}}})[_0xbd92('0x21')](function(_0x13886e){_0x38741b[_0xbd92('0x96')]=_0x13886e['get']({'plain':!![]});_0x38741b[_0xbd92('0x96')]['created']=_0x6ec785;if(_0x38741b[_0xbd92('0x96')][_0xbd92('0x97')]){if(_0x38741b[_0xbd92('0x8c')][_0xbd92('0x98')]){_0x38741b[_0xbd92('0x87')][_0xbd92('0x99')]({'id':0x0,'priority':_0x38741b[_0xbd92('0x87')][_0xbd92('0x4a')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xbd92('0x5d')]({'body':_0x3fb965[_0xbd92('0x64')][_0xbd92('0x64')],'OpenchannelAccountId':_0x3fb965[_0xbd92('0x59')]['id'],'OpenchannelInteractionId':_0x13886e['id'],'direction':'in','ContactId':_0x38741b[_0xbd92('0x8d')]['id'],'AttachmentId':_0x3fb965[_0xbd92('0x64')][_0xbd92('0x9a')]});})[_0xbd92('0x21')](function(_0x3664d8){_0x38741b[_0xbd92('0x29')]=_0x3664d8;if(_0x38741b[_0xbd92('0x96')][_0xbd92('0x9b')]){return db[_0xbd92('0x9c')][_0xbd92('0x5c')]({'attributes':['id',_0xbd92('0x3c')],'where':{'id':_0x38741b[_0xbd92('0x96')][_0xbd92('0x9b')]}})['then'](function(_0x5b1be8){if(_0x5b1be8){_0x38741b[_0xbd92('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0xbd92('0x9d'),'appdata':_0x5b1be8[_0xbd92('0x3c')]+','+(_0x38741b[_0xbd92('0x8c')][_0xbd92('0x9e')]||0xa),'interval':_0xbd92('0x9f')});_0x38741b[_0xbd92('0xa0')]=![];}return respondWithRpcPromise('Start',_0xbd92('0xa1'),_0x38741b);});}return respondWithRpcPromise(_0xbd92('0xa2'),'startRouting',_0x38741b);})[_0xbd92('0x21')](function(_0x1cec1b){respondWithRpcPromise(_0xbd92('0xa3'),_0xbd92('0xa3'),{'event':_0xbd92('0x71'),'message':_0x1cec1b},client9002);return _0x1cec1b;})[_0xbd92('0x21')](respondWithResult(_0x28abfe,null))['catch'](handleError(_0x28abfe,null));};exports[_0xbd92('0xa4')]=function(_0x4d0358,_0x15ba66){var _0x1ee103=_0x4d0358['params']['id'];var _0x16c5d5=_0x4d0358[_0xbd92('0x64')];var _0x35a1f0=0xc8;var _0x5b4df3=null;return db[_0xbd92('0xa5')][_0xbd92('0xa6')]({'isolationLevel':db[_0xbd92('0xa5')][_0xbd92('0xa7')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5ecfce){return db[_0xbd92('0x41')]['findOne']({'where':{'id':_0x1ee103},'transaction':_0x5ecfce})[_0xbd92('0x21')](function(_0x3cdc7c){if(_0x3cdc7c){return db['OpenchannelApplication'][_0xbd92('0x37')]({'where':{'OpenchannelAccountId':_0x1ee103},'transaction':_0x5ecfce})[_0xbd92('0x21')](function(){var _0x545885=_['map'](_0x16c5d5,function(_0x3a14f8){_0x3a14f8[_0xbd92('0x6b')]=_0x1ee103;return _0x3a14f8;});return db[_0xbd92('0x85')][_0xbd92('0xa8')](_0x545885,{'transaction':_0x5ecfce});});}else{_0x35a1f0=0x194;_0x5b4df3=[];}});})[_0xbd92('0x21')](function(){if(_0x35a1f0!==0x194){return db[_0xbd92('0x85')][_0xbd92('0xa9')]({'where':{'OpenchannelAccountId':_0x1ee103},'order':_0xbd92('0x8a')})[_0xbd92('0x21')](function(_0x2a04e7){_0x5b4df3=_0x2a04e7;});}})[_0xbd92('0x57')](function(_0x2976fc){_0x35a1f0=0x1f4;logger[_0xbd92('0x27')](_0x2976fc['stack']);if(_0x2976fc[_0xbd92('0x3c')]){delete _0x2976fc[_0xbd92('0x3c')];}_0x5b4df3=_0x2976fc;})[_0xbd92('0xaa')](function(){if(_0x5b4df3===null){_0x15ba66[_0xbd92('0x2b')](_0x35a1f0);}else{if(_0x35a1f0===0x1f4){_0x15ba66[_0xbd92('0x2c')](_0x35a1f0)[_0xbd92('0xab')](_0x5b4df3);}else{_0x15ba66[_0xbd92('0x2c')](_0x35a1f0)['json'](_0x5b4df3);}}});};exports['getApplications']=function(_0x526ac4,_0xa9bec5,_0x454535){var _0x15c427={};var _0x247cda={};var _0x1a9593;var _0x3d4f99;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x526ac4[_0xbd92('0x59')]['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0xa9bec5,null))[_0xbd92('0x21')](function(_0x1934bb){if(_0x1934bb){_0x1a9593=_0x1934bb;_0x247cda['model']=_[_0xbd92('0x45')](db[_0xbd92('0x85')][_0xbd92('0x5a')]);_0x247cda[_0xbd92('0x44')]=_[_0xbd92('0x45')](_0x526ac4[_0xbd92('0x44')]);_0x247cda['filters']=_[_0xbd92('0x47')](_0x247cda[_0xbd92('0x43')],_0x247cda[_0xbd92('0x44')]);_0x15c427['attributes']=_[_0xbd92('0x47')](_0x247cda[_0xbd92('0x43')],qs[_0xbd92('0x48')](_0x526ac4[_0xbd92('0x44')][_0xbd92('0x48')]));_0x15c427['attributes']=_0x15c427[_0xbd92('0x49')][_0xbd92('0x4a')]?_0x15c427['attributes']:_0x247cda[_0xbd92('0x43')];_0x15c427[_0xbd92('0x6e')]=qs[_0xbd92('0x4d')](_0x526ac4[_0xbd92('0x44')]['sort']);_0x15c427[_0xbd92('0x4e')]=qs['filters'](_['pick'](_0x526ac4[_0xbd92('0x44')],_0x247cda[_0xbd92('0x46')]));if(_0x526ac4['query']['filter']){_0x15c427[_0xbd92('0x4e')]=_[_0xbd92('0x50')](_0x15c427[_0xbd92('0x4e')],{'$or':_[_0xbd92('0x40')](_0x15c427[_0xbd92('0x49')],function(_0x400254){var _0x14c248={};_0x14c248[_0x400254]={'$like':'%'+_0x526ac4[_0xbd92('0x44')][_0xbd92('0x4f')]+'%'};return _0x14c248;})});}_0x15c427=_['merge']({},_0x15c427,_0x526ac4[_0xbd92('0x53')]);return _0x1a9593[_0xbd92('0xac')](_0x15c427);}})[_0xbd92('0x21')](function(_0x92109e){if(_0x92109e){_0x3d4f99=_0x92109e[_0xbd92('0x4a')];if(!_0x526ac4[_0xbd92('0x44')]['hasOwnProperty'](_0xbd92('0x4c'))){_0x15c427[_0xbd92('0x31')]=qs['limit'](_0x526ac4[_0xbd92('0x44')][_0xbd92('0x31')]);_0x15c427[_0xbd92('0x2f')]=qs[_0xbd92('0x2f')](_0x526ac4[_0xbd92('0x44')][_0xbd92('0x2f')]);}return _0x1a9593[_0xbd92('0xac')](_0x15c427);}})[_0xbd92('0x21')](function(_0x590e0d){if(_0x590e0d){return _0x590e0d?{'count':_0x3d4f99,'rows':_0x590e0d}:null;}})[_0xbd92('0x21')](respondWithResult(_0xa9bec5,null))[_0xbd92('0x57')](handleError(_0xa9bec5,null));};exports[_0xbd92('0xad')]=function(_0x29cf78,_0x2be61e,_0x46d5ff){var _0x175f1f={'raw':![],'where':{}};var _0xc3ae76={};var _0x2f9594={'count':0x0,'rows':[]};return db[_0xbd92('0x41')][_0xbd92('0x69')]({'where':{'id':_0x29cf78[_0xbd92('0x59')]['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x2be61e,null))[_0xbd92('0x21')](function(_0x23118f){if(_0x23118f){_0xc3ae76[_0xbd92('0x43')]=_[_0xbd92('0x45')](db[_0xbd92('0x91')][_0xbd92('0x5a')]);_0xc3ae76[_0xbd92('0x44')]=_[_0xbd92('0x45')](_0x29cf78[_0xbd92('0x44')]);_0xc3ae76[_0xbd92('0x46')]=_[_0xbd92('0x47')](_0xc3ae76[_0xbd92('0x43')],_0xc3ae76[_0xbd92('0x44')]);_0x175f1f[_0xbd92('0x49')]=_['intersection'](_0xc3ae76[_0xbd92('0x43')],qs[_0xbd92('0x48')](_0x29cf78[_0xbd92('0x44')]['fields']));_0x175f1f[_0xbd92('0x49')]=_0x175f1f[_0xbd92('0x49')][_0xbd92('0x4a')]?_0x175f1f[_0xbd92('0x49')]:_0xc3ae76[_0xbd92('0x43')];if(!_0x29cf78[_0xbd92('0x44')]['hasOwnProperty'](_0xbd92('0x4c'))){_0x175f1f[_0xbd92('0x31')]=qs[_0xbd92('0x31')](_0x29cf78[_0xbd92('0x44')][_0xbd92('0x31')]);_0x175f1f[_0xbd92('0x2f')]=qs[_0xbd92('0x2f')](_0x29cf78['query'][_0xbd92('0x2f')]);}_0x175f1f['order']=qs[_0xbd92('0x4d')](_0x29cf78[_0xbd92('0x44')][_0xbd92('0x4d')]);_0x175f1f[_0xbd92('0x4e')]=qs[_0xbd92('0x46')](_['pick'](_0x29cf78['query'],_0xc3ae76[_0xbd92('0x46')]));_0x175f1f[_0xbd92('0x4e')][_0xbd92('0x6b')]=_0x23118f['id'];if(_0x29cf78['query']['filter']){_0x175f1f[_0xbd92('0x4e')]=_[_0xbd92('0x50')](_0x175f1f[_0xbd92('0x4e')],{'$or':_['map'](_0x175f1f['attributes'],function(_0x35bdb2){var _0xddfabb={};_0xddfabb[_0x35bdb2]={'$like':'%'+_0x29cf78[_0xbd92('0x44')][_0xbd92('0x4f')]+'%'};return _0xddfabb;})});}_0x175f1f=_[_0xbd92('0x50')]({},_0x175f1f,_0x29cf78['options']);return db[_0xbd92('0x91')]['count']({'where':_0x175f1f[_0xbd92('0x4e')]})['then'](function(_0x362a1d){_0x2f9594[_0xbd92('0x32')]=_0x362a1d;if(_0x29cf78[_0xbd92('0x44')]['includeAll']){_0x175f1f[_0xbd92('0x54')]=[{'model':db['CmContact'],'as':_0xbd92('0xae'),'required':![]},{'model':db['User'],'as':_0xbd92('0xaf'),'attributes':[_0xbd92('0x3c'),_0xbd92('0xb0'),'internal'],'required':![]},{'model':db[_0xbd92('0xb1')],'as':_0xbd92('0xb2'),'attributes':['id','name',_0xbd92('0xb3')],'where':_0x29cf78[_0xbd92('0x44')][_0xbd92('0xb4')]?{'id':_0x29cf78[_0xbd92('0x44')]['tag']}:undefined,'required':_0x29cf78[_0xbd92('0x44')][_0xbd92('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xbd92('0x55')](_0x175f1f);})[_0xbd92('0x21')](function(_0x4e40f0){_0x2f9594[_0xbd92('0x56')]=_0x4e40f0;return _0x2f9594;});}})['then'](respondWithFilteredResult(_0x2be61e,_0x175f1f))[_0xbd92('0x57')](handleError(_0x2be61e,null));};exports['addAgents']=function(_0x4c9513,_0x3fe483,_0x49b4a8){return db[_0xbd92('0x41')][_0xbd92('0x5c')]({'where':{'id':_0x4c9513['params']['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x3fe483,null))['then'](function(_0x3b98f5){if(_0x3b98f5){return _0x3b98f5[_0xbd92('0xb5')](_0x4c9513[_0xbd92('0x64')][_0xbd92('0xb6')],_[_0xbd92('0xb7')](_0x4c9513[_0xbd92('0x64')],[_0xbd92('0xb6'),'id'])||{})[_0xbd92('0x94')](function(_0xf8847e){for(var _0x2eeff8=0x0;_0x2eeff8<_0x4c9513[_0xbd92('0x64')][_0xbd92('0xb6')][_0xbd92('0x4a')];_0x2eeff8+=0x1){socket[_0xbd92('0xb8')]('userOpenchannelAccount:save',{'UserId':Number(_0x4c9513['body'][_0xbd92('0xb6')][_0x2eeff8]),'OpenchannelAccountId':Number(_0x4c9513['params']['id'])});}return _0xf8847e;});}})[_0xbd92('0x21')](respondWithResult(_0x3fe483,null))['catch'](handleError(_0x3fe483,null));};exports[_0xbd92('0xb9')]=function(_0x461030,_0x9393d1,_0x58c3a1){return db[_0xbd92('0x41')]['find']({'where':{'id':_0x461030['params']['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x9393d1,null))[_0xbd92('0x21')](function(_0x1e54e8){if(_0x1e54e8){return _0x1e54e8[_0xbd92('0xb9')](_0x461030[_0xbd92('0x44')][_0xbd92('0xb6')])[_0xbd92('0x21')](function(){if(_[_0xbd92('0xba')](_0x461030[_0xbd92('0x44')][_0xbd92('0xb6')])){for(var _0x1ab0d3=0x0;_0x1ab0d3<_0x461030['query']['ids'][_0xbd92('0x4a')];_0x1ab0d3+=0x1){socket[_0xbd92('0xb8')](_0xbd92('0xbb'),{'UserId':Number(_0x461030[_0xbd92('0x44')][_0xbd92('0xb6')][_0x1ab0d3]),'OpenchannelAccountId':Number(_0x461030[_0xbd92('0x59')]['id'])});}}else{socket['emit'](_0xbd92('0xbb'),{'UserId':Number(_0x461030[_0xbd92('0x44')][_0xbd92('0xb6')]),'OpenchannelAccountId':Number(_0x461030['params']['id'])});}});}})[_0xbd92('0x21')](respondWithStatusCode(_0x9393d1,null))[_0xbd92('0x57')](handleError(_0x9393d1,null));};exports[_0xbd92('0xbc')]=function(_0x4adf09,_0x30965c,_0x30b623){var _0x5a72ca={};var _0x27e14d={};var _0x527e8f;var _0x3b45eb;return db[_0xbd92('0x41')][_0xbd92('0x69')]({'where':{'id':_0x4adf09[_0xbd92('0x59')]['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x30965c,null))['then'](function(_0x4707db){if(_0x4707db){_0x527e8f=_0x4707db;_0x27e14d[_0xbd92('0x43')]=_[_0xbd92('0x45')](db[_0xbd92('0x9c')]['rawAttributes']);_0x27e14d[_0xbd92('0x44')]=_[_0xbd92('0x45')](_0x4adf09['query']);_0x27e14d[_0xbd92('0x46')]=_[_0xbd92('0x47')](_0x27e14d[_0xbd92('0x43')],_0x27e14d[_0xbd92('0x44')]);_0x5a72ca[_0xbd92('0x49')]=_['intersection'](_0x27e14d[_0xbd92('0x43')],qs[_0xbd92('0x48')](_0x4adf09[_0xbd92('0x44')]['fields']));_0x5a72ca['attributes']=_0x5a72ca[_0xbd92('0x49')][_0xbd92('0x4a')]?_0x5a72ca['attributes']:_0x27e14d[_0xbd92('0x43')];_0x5a72ca[_0xbd92('0x6e')]=qs['sort'](_0x4adf09[_0xbd92('0x44')][_0xbd92('0x4d')]);_0x5a72ca[_0xbd92('0x4e')]=qs[_0xbd92('0x46')](_[_0xbd92('0x6a')](_0x4adf09[_0xbd92('0x44')],_0x27e14d['filters']));if(_0x4adf09[_0xbd92('0x44')]['filter']){_0x5a72ca[_0xbd92('0x4e')]=_[_0xbd92('0x50')](_0x5a72ca[_0xbd92('0x4e')],{'$or':_['map'](_0x5a72ca['attributes'],function(_0x93c34b){var _0x2933ee={};_0x2933ee[_0x93c34b]={'$like':'%'+_0x4adf09[_0xbd92('0x44')][_0xbd92('0x4f')]+'%'};return _0x2933ee;})});}_0x5a72ca=_[_0xbd92('0x50')]({},_0x5a72ca,_0x4adf09[_0xbd92('0x53')]);return _0x527e8f[_0xbd92('0xbc')](_0x5a72ca);}})[_0xbd92('0x21')](function(_0x4b14d8){if(_0x4b14d8){_0x3b45eb=_0x4b14d8['length'];if(!_0x4adf09['query'][_0xbd92('0x4b')]('nolimit')){_0x5a72ca[_0xbd92('0x31')]=qs[_0xbd92('0x31')](_0x4adf09[_0xbd92('0x44')][_0xbd92('0x31')]);_0x5a72ca[_0xbd92('0x2f')]=qs[_0xbd92('0x2f')](_0x4adf09[_0xbd92('0x44')][_0xbd92('0x2f')]);}return _0x527e8f[_0xbd92('0xbc')](_0x5a72ca);}})[_0xbd92('0x21')](function(_0x1a2ad4){if(_0x1a2ad4){return _0x1a2ad4?{'count':_0x3b45eb,'rows':_0x1a2ad4}:null;}})['then'](respondWithResult(_0x30965c,null))[_0xbd92('0x57')](handleError(_0x30965c,null));};exports['send']=function(_0x20040e,_0x4312ae,_0x588c0d){var _0x439ab7,_0xe93c6,_0x1312bf;if(_[_0xbd92('0x7a')](_0x20040e[_0xbd92('0x64')][_0xbd92('0x64')])||_0x20040e[_0xbd92('0x64')][_0xbd92('0x64')]===''){throw new db[(_0xbd92('0x74'))][(_0xbd92('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd92('0x7a')](_0x20040e['body']['to'])){}_0x439ab7=_0x20040e['body']['to'];return db['OpenchannelAccount'][_0xbd92('0x69')]({'where':{'id':_0x20040e['params']['id']}})[_0xbd92('0x21')](handleEntityNotFound(_0x4312ae,null))[_0xbd92('0x21')](function(_0x3cc98){if(_0x3cc98){return db[_0xbd92('0x41')][_0xbd92('0x5c')]({'where':{'id':_0x3cc98['id']},'include':[{'model':db[_0xbd92('0x81')],'as':_0xbd92('0x82'),'include':[{'model':db[_0xbd92('0x73')],'as':_0xbd92('0x83'),'where':{[_0x3cc98[_0xbd92('0x7e')]]:_0x439ab7},'limit':0x1,'order':[['updatedAt',_0xbd92('0xbd')]]}]}]})['then'](handleEntityNotFound(_0x4312ae,null))[_0xbd92('0x21')](function(_0x530225){if(_0x530225&&_0x530225[_0xbd92('0x82')]){_0xe93c6=_0x530225[_0xbd92('0x38')]({'plain':!![]});if(_0xe93c6[_0xbd92('0x82')]&&_0xe93c6[_0xbd92('0x82')][_0xbd92('0x83')][_0xbd92('0x4a')]){return _0xe93c6[_0xbd92('0x82')]['Contacts'][0x0];}return db['CmContact'][_0xbd92('0x5d')](_[_0xbd92('0x1a')](_0x20040e[_0xbd92('0x64')],{'firstName':_0x439ab7,[_0x530225['mapKey']]:_0x439ab7,'phone':_0x439ab7,'ListId':_0xe93c6['ListId']}));}})[_0xbd92('0x21')](handleEntityNotFound(_0x4312ae,null))['then'](function(_0x1dd413){if(_0x1dd413){_0x1312bf=_0x1dd413;return db[_0xbd92('0x91')][_0xbd92('0x5c')]({'where':{'ContactId':_0x1312bf['id'],'closed':![],'OpenchannelAccountId':_0xe93c6['id']}})['then'](function(_0x5e32b0){if(_0x5e32b0){return[_0x5e32b0,![]];}return db[_0xbd92('0x91')]['create']({'UserId':_0x20040e[_0xbd92('0x5e')]['id'],'ContactId':_0x1312bf['id'],'OpenchannelAccountId':_0xe93c6['id'],'lastMsgDirection':_0xbd92('0xbe'),'Messages':[_[_0xbd92('0x50')](_0x20040e[_0xbd92('0x64')],{'read':![],'body':_0x20040e['body'][_0xbd92('0x64')],'OpenchannelAccountId':_0xe93c6['id'],'UserId':_0x20040e['user']['id'],'ContactId':_0x1312bf['id']})]},{'include':[{'model':db[_0xbd92('0xbf')],'as':'Messages'}]})[_0xbd92('0x21')](function(_0x5876ff){return[_0x5876ff,!![]];});});}})[_0xbd92('0x94')](function(_0x38b6e3,_0xee6f0e){if(_0xee6f0e){return _0x38b6e3;}return db['OpenchannelMessage'][_0xbd92('0x5d')](_[_0xbd92('0x50')](_0x20040e[_0xbd92('0x64')],{'read':![],'body':_0x20040e[_0xbd92('0x64')][_0xbd92('0x64')],'OpenchannelAccountId':_0xe93c6['id'],'OpenchannelInteractionId':_0x38b6e3['id'],'UserId':_0x20040e[_0xbd92('0x5e')]['id'],'ContactId':_0x1312bf['id']}))[_0xbd92('0x21')](function(_0x16919e){_0x38b6e3['dataValues'][_0xbd92('0xc0')]=[];_0x38b6e3['dataValues'][_0xbd92('0xc0')][_0xbd92('0x99')](_0x16919e[_0xbd92('0xc1')]);return _0x38b6e3;});});}})[_0xbd92('0x21')](respondWithResult(_0x4312ae,null))[_0xbd92('0x57')](handleError(_0x4312ae,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1ab41c7..b344637 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 _0xa75b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x24c636,_0x390e14){var _0x411828=function(_0x54173d){while(--_0x54173d){_0x24c636['push'](_0x24c636['shift']());}};_0x411828(++_0x390e14);}(_0xa75b,0x170));var _0xba75=function(_0x374560,_0x100a9e){_0x374560=_0x374560-0x0;var _0x4d39d5=_0xa75b[_0x374560];return _0x4d39d5;};'use strict';var EventEmitter=require(_0xba75('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xba75('0x1')](0x0);var events={'afterCreate':_0xba75('0x2'),'afterUpdate':_0xba75('0x3'),'afterDestroy':_0xba75('0x4')};function emitEvent(_0x1760c0){return function(_0x336606,_0x152269,_0x398bd5){OpenchannelAccountEvents[_0xba75('0x5')](_0x1760c0+':'+_0x336606['id'],_0x336606);OpenchannelAccountEvents[_0xba75('0x5')](_0x1760c0,_0x336606);_0x398bd5(null);};}for(var e in events){if(events[_0xba75('0x6')](e)){var event=events[e];OpenchannelAccount[_0xba75('0x7')](e,emitEvent(event));}}module[_0xba75('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x1339=['update','remove','emit','hasOwnProperty','exports','OpenchannelAccount','setMaxListeners','save'];(function(_0x578c3e,_0x458d4a){var _0x5348bd=function(_0x1f6414){while(--_0x1f6414){_0x578c3e['push'](_0x578c3e['shift']());}};_0x5348bd(++_0x458d4a);}(_0x1339,0x1ed));var _0x9133=function(_0x4bb821,_0x7073be){_0x4bb821=_0x4bb821-0x0;var _0x1129e=_0x1339[_0x4bb821];return _0x1129e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x9133('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9133('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 790d1af..a12c151 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(_0x117e62,_0x4fc396){var _0x133c14=function(_0x505d4f){while(--_0x505d4f){_0x117e62['push'](_0x117e62['shift']());}};_0x133c14(++_0x4fc396);}(_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':'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(_0x5d0a4a,_0x2c90cd){var _0x255973=function(_0x118884){while(--_0x118884){_0x5d0a4a['push'](_0x5d0a4a['shift']());}};_0x255973(++_0x2c90cd);}(_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':'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 86d3b6a..bd2593d 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 _0xe5b5=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x554638,_0x377247){var _0x5b6479=function(_0x4e1be5){while(--_0x4e1be5){_0x554638['push'](_0x554638['shift']());}};_0x5b6479(++_0x377247);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0xe5b5[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});config[_0x5e5b('0xe')]=_[_0x5e5b('0xf')](config[_0x5e5b('0xe')],{'host':_0x5e5b('0x10'),'port':0x18eb});var socket=require(_0x5e5b('0x11'))(new Redis(config[_0x5e5b('0xe')]));require(_0x5e5b('0x12'))[_0x5e5b('0x13')](socket);function respondWithRpcPromise(_0x3f8534,_0x492a0e,_0x300890){return new BPromise(function(_0x59112d,_0x108c34){return client[_0x5e5b('0x14')](_0x3f8534,_0x300890)[_0x5e5b('0x15')](function(_0x3f64b6){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x492a0e,'request\x20sent');logger[_0x5e5b('0x16')](_0x5e5b('0x17'),_0x492a0e,_0x5e5b('0x18'),JSON[_0x5e5b('0x19')](_0x3f64b6));if(_0x3f64b6[_0x5e5b('0x1a')]){if(_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1b')]===0x1f4){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')]['message']);return _0x108c34(_0x3f64b6[_0x5e5b('0x1a')]['message']);}logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1d')]);return _0x59112d(_0x3f64b6['error'][_0x5e5b('0x1d')]);}else{logger['info'](_0x5e5b('0x1c'),_0x492a0e,_0x5e5b('0x18'));_0x59112d(_0x3f64b6['result'][_0x5e5b('0x1d')]);}})[_0x5e5b('0x1e')](function(_0x2281c8){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x2281c8);_0x108c34(_0x2281c8);});});} \ No newline at end of file +var _0x2f3a=['http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x19c891,_0x5c7411){var _0x658b1e=function(_0x1a6b83){while(--_0x1a6b83){_0x19c891['push'](_0x19c891['shift']());}};_0x658b1e(++_0x5c7411);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x3e0a79,_0x4d65c8){_0x3e0a79=_0x3e0a79-0x0;var _0x4914bb=_0x2f3a[_0x3e0a79];return _0x4914bb;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa2f3('0xa')],{'host':_0xa2f3('0xb'),'port':0x18eb});var socket=require(_0xa2f3('0xc'))(new Redis(config[_0xa2f3('0xa')]));require('./openchannelAccount.socket')[_0xa2f3('0xd')](socket);function respondWithRpcPromise(_0x6373f7,_0x1fce68,_0x41a90c){return new BPromise(function(_0x214f68,_0x55ff83){return client[_0xa2f3('0xe')](_0x6373f7,_0x41a90c)[_0xa2f3('0xf')](function(_0x52aabd){logger[_0xa2f3('0x10')](_0xa2f3('0x11'),_0x1fce68,_0xa2f3('0x12'));logger['debug'](_0xa2f3('0x13'),_0x1fce68,_0xa2f3('0x12'),JSON[_0xa2f3('0x14')](_0x52aabd));if(_0x52aabd[_0xa2f3('0x15')]){if(_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x16')]===0x1f4){logger[_0xa2f3('0x15')](_0xa2f3('0x11'),_0x1fce68,_0x52aabd[_0xa2f3('0x15')]['message']);return _0x55ff83(_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x17')]);}logger[_0xa2f3('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fce68,_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x17')]);return _0x214f68(_0x52aabd['error']['message']);}else{logger[_0xa2f3('0x10')](_0xa2f3('0x11'),_0x1fce68,_0xa2f3('0x12'));_0x214f68(_0x52aabd[_0xa2f3('0x18')][_0xa2f3('0x17')]);}})[_0xa2f3('0x19')](function(_0x30be69){logger[_0xa2f3('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fce68,_0x30be69);_0x55ff83(_0x30be69);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index dae515d..9162ccf 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 _0x0834=['update','emit','removeListener','register','length','openchannelAccount:','remove'];(function(_0x6c6ea5,_0x1099aa){var _0x3923e9=function(_0x1c155e){while(--_0x1c155e){_0x6c6ea5['push'](_0x6c6ea5['shift']());}};_0x3923e9(++_0x1099aa);}(_0x0834,0x18e));var _0x4083=function(_0xc9e769,_0x18e5c1){_0xc9e769=_0xc9e769-0x0;var _0x14e276=_0x0834[_0xc9e769];return _0x14e276;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x4083('0x0'),_0x4083('0x1')];function createListener(_0x5cbfad,_0x491147){return function(_0x5e1812){_0x491147[_0x4083('0x2')](_0x5cbfad,_0x5e1812);};}function removeListener(_0x14b7c6,_0x4e3837){return function(){OpenchannelAccountEvents[_0x4083('0x3')](_0x14b7c6,_0x4e3837);};}exports[_0x4083('0x4')]=function(_0x50a894){for(var _0x3bf635=0x0,_0x5c5a54=events[_0x4083('0x5')];_0x3bf635<_0x5c5a54;_0x3bf635++){var _0x26ed53=events[_0x3bf635];var _0x2c42bb=createListener(_0x4083('0x6')+_0x26ed53,_0x50a894);OpenchannelAccountEvents['on'](_0x26ed53,_0x2c42bb);}}; \ No newline at end of file +var _0xfc73=['openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register'];(function(_0x4d7c59,_0x7fee17){var _0x27faaa=function(_0xe61dbe){while(--_0xe61dbe){_0x4d7c59['push'](_0x4d7c59['shift']());}};_0x27faaa(++_0x7fee17);}(_0xfc73,0x8d));var _0x3fc7=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xfc73[_0x411017];return _0x2adeea;};'use strict';var OpenchannelAccountEvents=require(_0x3fc7('0x0'));var events=[_0x3fc7('0x1'),'remove',_0x3fc7('0x2')];function createListener(_0x3a593d,_0xe51dfd){return function(_0x161492){_0xe51dfd[_0x3fc7('0x3')](_0x3a593d,_0x161492);};}function removeListener(_0x1c4900,_0x429287){return function(){OpenchannelAccountEvents[_0x3fc7('0x4')](_0x1c4900,_0x429287);};}exports[_0x3fc7('0x5')]=function(_0x1039e0){for(var _0x262417=0x0,_0x1375dc=events['length'];_0x262417<_0x1375dc;_0x262417++){var _0x36ec87=events[_0x262417];var _0x12c2ec=createListener(_0x3fc7('0x6')+_0x36ec87,_0x1039e0);OpenchannelAccountEvents['on'](_0x36ec87,_0x12c2ec);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index fd14a96..f6f7add 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 _0x9c3f=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','index','/:id','show','post','isAuthenticated','put','update','delete','destroy','multer'];(function(_0x6ce2d4,_0xa4264e){var _0x4b0231=function(_0x11d520){while(--_0x11d520){_0x6ce2d4['push'](_0x6ce2d4['shift']());}};_0x4b0231(++_0xa4264e);}(_0x9c3f,0x155));var _0xf9c3=function(_0x1e9ef6,_0x1f9d70){_0x1e9ef6=_0x1e9ef6-0x0;var _0x4629f1=_0x9c3f[_0x1e9ef6];return _0x4629f1;};'use strict';var multer=require(_0xf9c3('0x0'));var util=require(_0xf9c3('0x1'));var path=require(_0xf9c3('0x2'));var timeout=require(_0xf9c3('0x3'));var express=require(_0xf9c3('0x4'));var router=express['Router']();var fs_extra=require(_0xf9c3('0x5'));var auth=require(_0xf9c3('0x6'));var interaction=require(_0xf9c3('0x7'));var config=require('../../config/environment');var controller=require(_0xf9c3('0x8'));router[_0xf9c3('0x9')]('/',auth['isAuthenticated'](),controller[_0xf9c3('0xa')]);router[_0xf9c3('0x9')](_0xf9c3('0xb'),auth['isAuthenticated'](),controller[_0xf9c3('0xc')]);router[_0xf9c3('0xd')]('/',auth[_0xf9c3('0xe')](),controller['create']);router[_0xf9c3('0xf')](_0xf9c3('0xb'),auth[_0xf9c3('0xe')](),controller[_0xf9c3('0x10')]);router[_0xf9c3('0x11')](_0xf9c3('0xb'),auth['isAuthenticated'](),controller[_0xf9c3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9986=['post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x296b85,_0x59fdd6){var _0x586515=function(_0x16eabb){while(--_0x16eabb){_0x296b85['push'](_0x296b85['shift']());}};_0x586515(++_0x59fdd6);}(_0x9986,0x1a8));var _0x6998=function(_0x24e3aa,_0x12af36){_0x24e3aa=_0x24e3aa-0x0;var _0x3d9a41=_0x9986[_0x24e3aa];return _0x3d9a41;};'use strict';var multer=require(_0x6998('0x0'));var util=require('util');var path=require(_0x6998('0x1'));var timeout=require('connect-timeout');var express=require(_0x6998('0x2'));var router=express[_0x6998('0x3')]();var fs_extra=require(_0x6998('0x4'));var auth=require(_0x6998('0x5'));var interaction=require(_0x6998('0x6'));var config=require(_0x6998('0x7'));var controller=require(_0x6998('0x8'));router[_0x6998('0x9')]('/',auth[_0x6998('0xa')](),controller[_0x6998('0xb')]);router[_0x6998('0x9')](_0x6998('0xc'),auth[_0x6998('0xa')](),controller['show']);router[_0x6998('0xd')]('/',auth[_0x6998('0xa')](),controller[_0x6998('0xe')]);router[_0x6998('0xf')](_0x6998('0xc'),auth[_0x6998('0xa')](),controller['update']);router[_0x6998('0x10')](_0x6998('0xc'),auth['isAuthenticated'](),controller[_0x6998('0x11')]);module[_0x6998('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 48d3e8b..27ba3a1 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 _0x8f48=['noop','*,*,*,*','sequelize','STRING'];(function(_0x113966,_0x231574){var _0x3165a8=function(_0x47707a){while(--_0x47707a){_0x113966['push'](_0x113966['shift']());}};_0x3165a8(++_0x231574);}(_0x8f48,0x76));var _0x88f4=function(_0x292911,_0x279a2e){_0x292911=_0x292911-0x0;var _0x18dee9=_0x8f48[_0x292911];return _0x18dee9;};'use strict';var Sequelize=require(_0x88f4('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x88f4('0x1')],'allowNull':![],'defaultValue':_0x88f4('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x88f4('0x1')]},'interval':{'type':Sequelize[_0x88f4('0x1')],'defaultValue':_0x88f4('0x3')}}; \ No newline at end of file +var _0xa40d=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5a13a2,_0x2a392d){var _0x557597=function(_0x2826df){while(--_0x2826df){_0x5a13a2['push'](_0x5a13a2['shift']());}};_0x557597(++_0x2a392d);}(_0xa40d,0x19e));var _0xda40=function(_0x4be79b,_0x21e987){_0x4be79b=_0x4be79b-0x0;var _0x14d71e=_0xa40d[_0x4be79b];return _0x14d71e;};'use strict';var Sequelize=require(_0xda40('0x0'));module[_0xda40('0x1')]={'priority':{'type':Sequelize[_0xda40('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xda40('0x3')],'allowNull':![],'defaultValue':_0xda40('0x4')},'appdata':{'type':Sequelize[_0xda40('0x5')]()},'description':{'type':Sequelize[_0xda40('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xda40('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 933e116..9641e00 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 _0xe1ec=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty'];(function(_0x3fc905,_0x2c666f){var _0x4dbd62=function(_0x2a3b54){while(--_0x2a3b54){_0x3fc905['push'](_0x3fc905['shift']());}};_0x4dbd62(++_0x2c666f);}(_0xe1ec,0x199));var _0xce1e=function(_0x441547,_0x49ba10){_0x441547=_0x441547-0x0;var _0x3995cf=_0xe1ec[_0x441547];return _0x3995cf;};'use strict';var emlformat=require(_0xce1e('0x0'));var rimraf=require(_0xce1e('0x1'));var zipdir=require(_0xce1e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce1e('0x3'));var moment=require(_0xce1e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce1e('0x5'));var util=require(_0xce1e('0x6'));var path=require(_0xce1e('0x7'));var sox=require('sox');var csv=require(_0xce1e('0x8'));var ejs=require(_0xce1e('0x9'));var fs=require('fs');var fs_extra=require(_0xce1e('0xa'));var _=require(_0xce1e('0xb'));var squel=require('squel');var crypto=require(_0xce1e('0xc'));var jsforce=require(_0xce1e('0xd'));var deskjs=require(_0xce1e('0xe'));var toCsv=require(_0xce1e('0x8'));var querystring=require('querystring');var Papa=require(_0xce1e('0xf'));var Redis=require('ioredis');var authService=require(_0xce1e('0x10'));var qs=require(_0xce1e('0x11'));var as=require(_0xce1e('0x12'));var hardwareService=require(_0xce1e('0x13'));var logger=require(_0xce1e('0x14'))(_0xce1e('0x15'));var utils=require(_0xce1e('0x16'));var config=require(_0xce1e('0x17'));var licenseUtil=require(_0xce1e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5660c1,_0x2673d3){_0x2673d3=_0x2673d3||0xcc;return function(_0x1e93fb){if(_0x1e93fb){return _0x5660c1[_0xce1e('0x19')](_0x2673d3);}return _0x5660c1[_0xce1e('0x1a')](_0x2673d3)[_0xce1e('0x1b')]();};}function respondWithResult(_0x3e3c2f,_0x543545){_0x543545=_0x543545||0xc8;return function(_0x431424){if(_0x431424){return _0x3e3c2f['status'](_0x543545)[_0xce1e('0x1c')](_0x431424);}};}function respondWithFilteredResult(_0x5765cc,_0x5bf3a9){return function(_0x440976){if(_0x440976){var _0x140ee9=typeof _0x5bf3a9[_0xce1e('0x1d')]===_0xce1e('0x1e')&&typeof _0x5bf3a9[_0xce1e('0x1f')]==='undefined';var _0x261ee5=_0x440976[_0xce1e('0x20')];var _0x2bab68=_0x140ee9?0x0:_0x5bf3a9['offset'];var _0x4eee3a=_0x140ee9?_0x440976['count']:_0x5bf3a9[_0xce1e('0x1d')]+_0x5bf3a9[_0xce1e('0x1f')];var _0x42aa60;if(_0x4eee3a>=_0x261ee5){_0x4eee3a=_0x261ee5;_0x42aa60=0xc8;}else{_0x42aa60=0xce;}_0x5765cc['status'](_0x42aa60);return _0x5765cc[_0xce1e('0x21')](_0xce1e('0x22'),_0x2bab68+'-'+_0x4eee3a+'/'+_0x261ee5)[_0xce1e('0x1c')](_0x440976);}return null;};}function patchUpdates(_0x28d4f5){return function(_0x4d8d70){try{jsonpatch[_0xce1e('0x23')](_0x4d8d70,_0x28d4f5,!![]);}catch(_0x362985){return BPromise['reject'](_0x362985);}return _0x4d8d70[_0xce1e('0x24')]();};}function saveUpdates(_0x5af125,_0x1c3341){return function(_0x5c6dec){if(_0x5c6dec){return _0x5c6dec[_0xce1e('0x25')](_0x5af125)[_0xce1e('0x26')](function(_0x160836){return _0x160836;});}return null;};}function removeEntity(_0x12c49d,_0xde2a38){return function(_0x14f0a5){if(_0x14f0a5){return _0x14f0a5[_0xce1e('0x27')]()[_0xce1e('0x26')](function(){_0x12c49d[_0xce1e('0x1a')](0xcc)[_0xce1e('0x1b')]();});}};}function handleEntityNotFound(_0x3912f6,_0xdf38cf){return function(_0x4ead68){if(!_0x4ead68){_0x3912f6[_0xce1e('0x19')](0x194);}return _0x4ead68;};}function handleError(_0x53a0f4,_0x2b1c20){_0x2b1c20=_0x2b1c20||0x1f4;return function(_0x4d13e7){logger[_0xce1e('0x28')](_0x4d13e7[_0xce1e('0x29')]);if(_0x4d13e7[_0xce1e('0x2a')]){delete _0x4d13e7[_0xce1e('0x2a')];}_0x53a0f4[_0xce1e('0x1a')](_0x2b1c20)[_0xce1e('0x2b')](_0x4d13e7);};}exports[_0xce1e('0x2c')]=function(_0x447f56,_0x3dd806){var _0x3a6e53={},_0x917cec={},_0x5f2530={'count':0x0,'rows':[]};var _0x515972=_[_0xce1e('0x2d')](db[_0xce1e('0x2e')][_0xce1e('0x2f')],function(_0x4fe744){return{'name':_0x4fe744[_0xce1e('0x30')],'type':_0x4fe744[_0xce1e('0x31')][_0xce1e('0x32')]};});_0x917cec['model']=_[_0xce1e('0x2d')](_0x515972,_0xce1e('0x2a'));_0x917cec[_0xce1e('0x33')]=_[_0xce1e('0x34')](_0x447f56['query']);_0x917cec[_0xce1e('0x35')]=_['intersection'](_0x917cec[_0xce1e('0x36')],_0x917cec['query']);_0x3a6e53[_0xce1e('0x37')]=_[_0xce1e('0x38')](_0x917cec[_0xce1e('0x36')],qs[_0xce1e('0x39')](_0x447f56[_0xce1e('0x33')][_0xce1e('0x39')]));_0x3a6e53[_0xce1e('0x37')]=_0x3a6e53['attributes']['length']?_0x3a6e53[_0xce1e('0x37')]:_0x917cec['model'];if(!_0x447f56[_0xce1e('0x33')][_0xce1e('0x3a')](_0xce1e('0x3b'))){_0x3a6e53['limit']=qs[_0xce1e('0x1f')](_0x447f56['query'][_0xce1e('0x1f')]);_0x3a6e53[_0xce1e('0x1d')]=qs[_0xce1e('0x1d')](_0x447f56[_0xce1e('0x33')]['offset']);}_0x3a6e53[_0xce1e('0x3c')]=qs[_0xce1e('0x3d')](_0x447f56[_0xce1e('0x33')][_0xce1e('0x3d')]);_0x3a6e53[_0xce1e('0x3e')]=qs[_0xce1e('0x35')](_[_0xce1e('0x3f')](_0x447f56['query'],_0x917cec['filters']),_0x515972);if(_0x447f56['query'][_0xce1e('0x40')]){_0x3a6e53[_0xce1e('0x3e')]=_[_0xce1e('0x41')](_0x3a6e53[_0xce1e('0x3e')],{'$or':_['map'](_0x515972,function(_0x3d9a5a){if(_0x3d9a5a[_0xce1e('0x31')]!==_0xce1e('0x42')){var _0x1d3830={};_0x1d3830[_0x3d9a5a['name']]={'$like':'%'+_0x447f56['query'][_0xce1e('0x40')]+'%'};return _0x1d3830;}})});}_0x3a6e53=_['merge']({},_0x3a6e53,_0x447f56['options']);var _0x15db69={'where':_0x3a6e53['where']};return db['OpenchannelApplication'][_0xce1e('0x20')](_0x15db69)[_0xce1e('0x26')](function(_0x327785){_0x5f2530['count']=_0x327785;if(_0x447f56[_0xce1e('0x33')][_0xce1e('0x43')]){_0x3a6e53[_0xce1e('0x44')]=[{'all':!![]}];}return db[_0xce1e('0x2e')][_0xce1e('0x45')](_0x3a6e53);})['then'](function(_0x174510){_0x5f2530[_0xce1e('0x46')]=_0x174510;return _0x5f2530;})[_0xce1e('0x26')](respondWithFilteredResult(_0x3dd806,_0x3a6e53))[_0xce1e('0x47')](handleError(_0x3dd806,null));};exports[_0xce1e('0x48')]=function(_0x27bda5,_0x1a1bb5){var _0x503e4b={'raw':!![],'where':{'id':_0x27bda5[_0xce1e('0x49')]['id']}},_0x182b31={};_0x182b31[_0xce1e('0x36')]=_['keys'](db[_0xce1e('0x2e')][_0xce1e('0x2f')]);_0x182b31[_0xce1e('0x33')]=_[_0xce1e('0x34')](_0x27bda5[_0xce1e('0x33')]);_0x182b31['filters']=_['intersection'](_0x182b31[_0xce1e('0x36')],_0x182b31[_0xce1e('0x33')]);_0x503e4b[_0xce1e('0x37')]=_['intersection'](_0x182b31[_0xce1e('0x36')],qs[_0xce1e('0x39')](_0x27bda5['query']['fields']));_0x503e4b['attributes']=_0x503e4b[_0xce1e('0x37')][_0xce1e('0x4a')]?_0x503e4b[_0xce1e('0x37')]:_0x182b31[_0xce1e('0x36')];if(_0x27bda5[_0xce1e('0x33')][_0xce1e('0x43')]){_0x503e4b[_0xce1e('0x44')]=[{'all':!![]}];}_0x503e4b=_[_0xce1e('0x41')]({},_0x503e4b,_0x27bda5['options']);return db['OpenchannelApplication']['find'](_0x503e4b)['then'](handleEntityNotFound(_0x1a1bb5,null))['then'](respondWithResult(_0x1a1bb5,null))['catch'](handleError(_0x1a1bb5,null));};exports['create']=function(_0x4f4e71,_0x30333c){return db[_0xce1e('0x2e')][_0xce1e('0x4b')](_0x4f4e71[_0xce1e('0x4c')],{})[_0xce1e('0x26')](respondWithResult(_0x30333c,0xc9))[_0xce1e('0x47')](handleError(_0x30333c,null));};exports[_0xce1e('0x25')]=function(_0x394a39,_0x4215aa){if(_0x394a39[_0xce1e('0x4c')]['id']){delete _0x394a39[_0xce1e('0x4c')]['id'];}return db['OpenchannelApplication'][_0xce1e('0x4d')]({'where':{'id':_0x394a39[_0xce1e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4215aa,null))['then'](saveUpdates(_0x394a39['body'],null))['then'](respondWithResult(_0x4215aa,null))[_0xce1e('0x47')](handleError(_0x4215aa,null));};exports[_0xce1e('0x27')]=function(_0x2d1d96,_0x229e88){return db['OpenchannelApplication']['find']({'where':{'id':_0x2d1d96[_0xce1e('0x49')]['id']}})[_0xce1e('0x26')](handleEntityNotFound(_0x229e88,null))[_0xce1e('0x26')](removeEntity(_0x229e88,null))[_0xce1e('0x47')](handleError(_0x229e88,null));}; \ No newline at end of file +var _0x4906=['catch','show','keys','rawAttributes','length','include','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','map','OpenchannelApplication','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x22f866,_0x538d2b){var _0x20cf88=function(_0x3c4775){while(--_0x3c4775){_0x22f866['push'](_0x22f866['shift']());}};_0x20cf88(++_0x538d2b);}(_0x4906,0x13e));var _0x6490=function(_0xab8ffa,_0x29179d){_0xab8ffa=_0xab8ffa-0x0;var _0x173c69=_0x4906[_0xab8ffa];return _0x173c69;};'use strict';var emlformat=require(_0x6490('0x0'));var rimraf=require(_0x6490('0x1'));var zipdir=require(_0x6490('0x2'));var jsonpatch=require(_0x6490('0x3'));var rp=require(_0x6490('0x4'));var moment=require(_0x6490('0x5'));var BPromise=require(_0x6490('0x6'));var Mustache=require(_0x6490('0x7'));var util=require(_0x6490('0x8'));var path=require(_0x6490('0x9'));var sox=require(_0x6490('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6490('0xb'));var _=require(_0x6490('0xc'));var squel=require(_0x6490('0xd'));var crypto=require(_0x6490('0xe'));var jsforce=require(_0x6490('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6490('0x10'));var querystring=require(_0x6490('0x11'));var Papa=require(_0x6490('0x12'));var Redis=require('ioredis');var authService=require(_0x6490('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6490('0x14'));var hardwareService=require(_0x6490('0x15'));var logger=require(_0x6490('0x16'))(_0x6490('0x17'));var utils=require(_0x6490('0x18'));var config=require(_0x6490('0x19'));var licenseUtil=require(_0x6490('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c62b7,_0x21ed26){_0x21ed26=_0x21ed26||0xcc;return function(_0x512302){if(_0x512302){return _0x2c62b7['sendStatus'](_0x21ed26);}return _0x2c62b7['status'](_0x21ed26)[_0x6490('0x1b')]();};}function respondWithResult(_0x4e0a70,_0x3401ce){_0x3401ce=_0x3401ce||0xc8;return function(_0x45d1d3){if(_0x45d1d3){return _0x4e0a70[_0x6490('0x1c')](_0x3401ce)[_0x6490('0x1d')](_0x45d1d3);}};}function respondWithFilteredResult(_0x4b21c7,_0x2a3444){return function(_0x161e17){if(_0x161e17){var _0x533c20=typeof _0x2a3444[_0x6490('0x1e')]===_0x6490('0x1f')&&typeof _0x2a3444[_0x6490('0x20')]==='undefined';var _0x3ccf69=_0x161e17[_0x6490('0x21')];var _0x3c465c=_0x533c20?0x0:_0x2a3444['offset'];var _0x2644be=_0x533c20?_0x161e17['count']:_0x2a3444['offset']+_0x2a3444['limit'];var _0x41559c;if(_0x2644be>=_0x3ccf69){_0x2644be=_0x3ccf69;_0x41559c=0xc8;}else{_0x41559c=0xce;}_0x4b21c7[_0x6490('0x1c')](_0x41559c);return _0x4b21c7[_0x6490('0x22')](_0x6490('0x23'),_0x3c465c+'-'+_0x2644be+'/'+_0x3ccf69)[_0x6490('0x1d')](_0x161e17);}return null;};}function patchUpdates(_0x449147){return function(_0x2c500c){try{jsonpatch[_0x6490('0x24')](_0x2c500c,_0x449147,!![]);}catch(_0xe851f8){return BPromise[_0x6490('0x25')](_0xe851f8);}return _0x2c500c[_0x6490('0x26')]();};}function saveUpdates(_0x2f4588,_0x12c3f8){return function(_0x29a239){if(_0x29a239){return _0x29a239[_0x6490('0x27')](_0x2f4588)[_0x6490('0x28')](function(_0x20be7a){return _0x20be7a;});}return null;};}function removeEntity(_0x3ba6c7,_0x525bd){return function(_0x435d9c){if(_0x435d9c){return _0x435d9c[_0x6490('0x29')]()['then'](function(){_0x3ba6c7['status'](0xcc)[_0x6490('0x1b')]();});}};}function handleEntityNotFound(_0x3ade01,_0x156de7){return function(_0x2b84ef){if(!_0x2b84ef){_0x3ade01[_0x6490('0x2a')](0x194);}return _0x2b84ef;};}function handleError(_0x52a619,_0x17ae8){_0x17ae8=_0x17ae8||0x1f4;return function(_0x1611c0){logger['error'](_0x1611c0['stack']);if(_0x1611c0[_0x6490('0x2b')]){delete _0x1611c0['name'];}_0x52a619[_0x6490('0x1c')](_0x17ae8)[_0x6490('0x2c')](_0x1611c0);};}exports['index']=function(_0x2f8327,_0x388133){var _0x3c77f9={},_0x3a473a={},_0x207cd7={'count':0x0,'rows':[]};var _0x102c35=_[_0x6490('0x2d')](db[_0x6490('0x2e')]['rawAttributes'],function(_0x5f3678){return{'name':_0x5f3678['fieldName'],'type':_0x5f3678[_0x6490('0x2f')][_0x6490('0x30')]};});_0x3a473a[_0x6490('0x31')]=_[_0x6490('0x2d')](_0x102c35,_0x6490('0x2b'));_0x3a473a['query']=_['keys'](_0x2f8327[_0x6490('0x32')]);_0x3a473a[_0x6490('0x33')]=_[_0x6490('0x34')](_0x3a473a[_0x6490('0x31')],_0x3a473a['query']);_0x3c77f9[_0x6490('0x35')]=_[_0x6490('0x34')](_0x3a473a[_0x6490('0x31')],qs[_0x6490('0x36')](_0x2f8327[_0x6490('0x32')]['fields']));_0x3c77f9[_0x6490('0x35')]=_0x3c77f9['attributes']['length']?_0x3c77f9[_0x6490('0x35')]:_0x3a473a[_0x6490('0x31')];if(!_0x2f8327[_0x6490('0x32')][_0x6490('0x37')](_0x6490('0x38'))){_0x3c77f9[_0x6490('0x20')]=qs[_0x6490('0x20')](_0x2f8327[_0x6490('0x32')][_0x6490('0x20')]);_0x3c77f9[_0x6490('0x1e')]=qs[_0x6490('0x1e')](_0x2f8327['query'][_0x6490('0x1e')]);}_0x3c77f9[_0x6490('0x39')]=qs[_0x6490('0x3a')](_0x2f8327['query'][_0x6490('0x3a')]);_0x3c77f9[_0x6490('0x3b')]=qs['filters'](_[_0x6490('0x3c')](_0x2f8327[_0x6490('0x32')],_0x3a473a[_0x6490('0x33')]),_0x102c35);if(_0x2f8327[_0x6490('0x32')][_0x6490('0x3d')]){_0x3c77f9[_0x6490('0x3b')]=_[_0x6490('0x3e')](_0x3c77f9[_0x6490('0x3b')],{'$or':_[_0x6490('0x2d')](_0x102c35,function(_0x12eb63){if(_0x12eb63[_0x6490('0x2f')]!==_0x6490('0x3f')){var _0x326c9e={};_0x326c9e[_0x12eb63[_0x6490('0x2b')]]={'$like':'%'+_0x2f8327[_0x6490('0x32')][_0x6490('0x3d')]+'%'};return _0x326c9e;}})});}_0x3c77f9=_[_0x6490('0x3e')]({},_0x3c77f9,_0x2f8327[_0x6490('0x40')]);var _0x15f994={'where':_0x3c77f9[_0x6490('0x3b')]};return db[_0x6490('0x2e')][_0x6490('0x21')](_0x15f994)[_0x6490('0x28')](function(_0x2d83fb){_0x207cd7[_0x6490('0x21')]=_0x2d83fb;if(_0x2f8327['query'][_0x6490('0x41')]){_0x3c77f9['include']=[{'all':!![]}];}return db[_0x6490('0x2e')][_0x6490('0x42')](_0x3c77f9);})[_0x6490('0x28')](function(_0xff4b08){_0x207cd7['rows']=_0xff4b08;return _0x207cd7;})[_0x6490('0x28')](respondWithFilteredResult(_0x388133,_0x3c77f9))[_0x6490('0x43')](handleError(_0x388133,null));};exports[_0x6490('0x44')]=function(_0x370084,_0x41ca96){var _0x476c19={'raw':!![],'where':{'id':_0x370084['params']['id']}},_0x14add6={};_0x14add6[_0x6490('0x31')]=_[_0x6490('0x45')](db[_0x6490('0x2e')][_0x6490('0x46')]);_0x14add6[_0x6490('0x32')]=_['keys'](_0x370084[_0x6490('0x32')]);_0x14add6[_0x6490('0x33')]=_[_0x6490('0x34')](_0x14add6[_0x6490('0x31')],_0x14add6[_0x6490('0x32')]);_0x476c19[_0x6490('0x35')]=_[_0x6490('0x34')](_0x14add6[_0x6490('0x31')],qs[_0x6490('0x36')](_0x370084[_0x6490('0x32')][_0x6490('0x36')]));_0x476c19['attributes']=_0x476c19[_0x6490('0x35')][_0x6490('0x47')]?_0x476c19[_0x6490('0x35')]:_0x14add6[_0x6490('0x31')];if(_0x370084[_0x6490('0x32')]['includeAll']){_0x476c19[_0x6490('0x48')]=[{'all':!![]}];}_0x476c19=_[_0x6490('0x3e')]({},_0x476c19,_0x370084[_0x6490('0x40')]);return db[_0x6490('0x2e')]['find'](_0x476c19)[_0x6490('0x28')](handleEntityNotFound(_0x41ca96,null))[_0x6490('0x28')](respondWithResult(_0x41ca96,null))[_0x6490('0x43')](handleError(_0x41ca96,null));};exports[_0x6490('0x49')]=function(_0x27a7fc,_0x11b458){return db[_0x6490('0x2e')]['create'](_0x27a7fc[_0x6490('0x4a')],{})[_0x6490('0x28')](respondWithResult(_0x11b458,0xc9))[_0x6490('0x43')](handleError(_0x11b458,null));};exports[_0x6490('0x27')]=function(_0x5ec530,_0x2db75b){if(_0x5ec530['body']['id']){delete _0x5ec530[_0x6490('0x4a')]['id'];}return db[_0x6490('0x2e')][_0x6490('0x4b')]({'where':{'id':_0x5ec530['params']['id']}})[_0x6490('0x28')](handleEntityNotFound(_0x2db75b,null))['then'](saveUpdates(_0x5ec530[_0x6490('0x4a')],null))[_0x6490('0x28')](respondWithResult(_0x2db75b,null))[_0x6490('0x43')](handleError(_0x2db75b,null));};exports[_0x6490('0x29')]=function(_0xe8b582,_0x1ea4fb){return db[_0x6490('0x2e')][_0x6490('0x4b')]({'where':{'id':_0xe8b582[_0x6490('0x4c')]['id']}})[_0x6490('0x28')](handleEntityNotFound(_0x1ea4fb,null))[_0x6490('0x28')](removeEntity(_0x1ea4fb,null))[_0x6490('0x43')](handleError(_0x1ea4fb,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2d54f54..9c5d3bb 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 _0x2ba7=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x2ba7,0x16d));var _0x72ba=function(_0x331443,_0x3c233e){_0x331443=_0x331443-0x0;var _0x182073=_0x2ba7[_0x331443];return _0x182073;};'use strict';var _=require(_0x72ba('0x0'));var util=require(_0x72ba('0x1'));var logger=require('../../config/logger')(_0x72ba('0x2'));var moment=require(_0x72ba('0x3'));var BPromise=require(_0x72ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x72ba('0x5'));var config=require(_0x72ba('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x72ba('0x7')]=function(_0x49c5de,_0x117df1){return _0x49c5de[_0x72ba('0x8')](_0x72ba('0x9'),attributes,{'tableName':_0x72ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x72ba('0xb'),'collate':_0x72ba('0xc')});}; \ No newline at end of file +var _0x45cd=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x372f47,_0x29af61){var _0x293e38=function(_0x218bfa){while(--_0x218bfa){_0x372f47['push'](_0x372f47['shift']());}};_0x293e38(++_0x29af61);}(_0x45cd,0x1db));var _0xd45c=function(_0x5adecb,_0x110e3f){_0x5adecb=_0x5adecb-0x0;var _0x4765b8=_0x45cd[_0x5adecb];return _0x4765b8;};'use strict';var _=require(_0xd45c('0x0'));var util=require('util');var logger=require(_0xd45c('0x1'))(_0xd45c('0x2'));var moment=require(_0xd45c('0x3'));var BPromise=require(_0xd45c('0x4'));var rp=require(_0xd45c('0x5'));var fs=require('fs');var path=require(_0xd45c('0x6'));var rimraf=require(_0xd45c('0x7'));var config=require(_0xd45c('0x8'));var attributes=require(_0xd45c('0x9'));module[_0xd45c('0xa')]=function(_0x5ad51f,_0x2788a4){return _0x5ad51f[_0xd45c('0xb')](_0xd45c('0xc'),attributes,{'tableName':_0xd45c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd45c('0xe'),'collate':_0xd45c('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6589e91..ad0f3f5 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 _0xbd4e=['info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelApplication','update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then'];(function(_0x5b67f4,_0x3b251b){var _0xc61216=function(_0x2ea903){while(--_0x2ea903){_0x5b67f4['push'](_0x5b67f4['shift']());}};_0xc61216(++_0x3b251b);}(_0xbd4e,0x1d4));var _0xebd4=function(_0x288fac,_0x220761){_0x288fac=_0x288fac-0x0;var _0x3a9b28=_0xbd4e[_0x288fac];return _0x3a9b28;};'use strict';var _=require(_0xebd4('0x0'));var util=require(_0xebd4('0x1'));var moment=require(_0xebd4('0x2'));var BPromise=require(_0xebd4('0x3'));var rs=require(_0xebd4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebd4('0x5'))['db'];var utils=require(_0xebd4('0x6'));var logger=require(_0xebd4('0x7'))(_0xebd4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xebd4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23050a,_0x12f93d,_0x41762f){return new BPromise(function(_0x1bd858,_0x2f7af8){return client[_0xebd4('0xa')](_0x23050a,_0x41762f)[_0xebd4('0xb')](function(_0x5383d3){logger[_0xebd4('0xc')](_0xebd4('0xd'),_0x12f93d,_0xebd4('0xe'));logger[_0xebd4('0xf')](_0xebd4('0x10'),_0x12f93d,_0xebd4('0xe'),JSON[_0xebd4('0x11')](_0x5383d3));if(_0x5383d3[_0xebd4('0x12')]){if(_0x5383d3[_0xebd4('0x12')][_0xebd4('0x13')]===0x1f4){logger[_0xebd4('0x12')](_0xebd4('0xd'),_0x12f93d,_0x5383d3['error'][_0xebd4('0x14')]);return _0x2f7af8(_0x5383d3['error'][_0xebd4('0x14')]);}logger[_0xebd4('0x12')](_0xebd4('0xd'),_0x12f93d,_0x5383d3[_0xebd4('0x12')]['message']);return _0x1bd858(_0x5383d3['error']['message']);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x12f93d,_0xebd4('0xe'));_0x1bd858(_0x5383d3[_0xebd4('0x15')]['message']);}})[_0xebd4('0x16')](function(_0x2f4438){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x12f93d,_0x2f4438);_0x2f7af8(_0x2f4438);});});}exports['UpdateOpenchannelApplication']=function(_0x5a2c35){var _0x18de68=this;return new Promise(function(_0x1db6ee,_0x393c15){return db[_0xebd4('0x17')][_0xebd4('0x18')](_0x5a2c35[_0xebd4('0x19')],{'raw':_0x5a2c35[_0xebd4('0x1a')]?_0x5a2c35[_0xebd4('0x1a')][_0xebd4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a2c35[_0xebd4('0x1a')]?_0x5a2c35[_0xebd4('0x1a')][_0xebd4('0x1c')]||null:null,'attributes':_0x5a2c35[_0xebd4('0x1a')]?_0x5a2c35[_0xebd4('0x1a')][_0xebd4('0x1d')]||null:null,'limit':_0x5a2c35['options']?_0x5a2c35['options'][_0xebd4('0x1e')]||null:null})['then'](function(_0x4db4dc){logger['info'](_0xebd4('0x1f'),_0x5a2c35);logger[_0xebd4('0xf')]('UpdateOpenchannelApplication',_0x5a2c35,JSON[_0xebd4('0x11')](_0x4db4dc));_0x1db6ee(_0x4db4dc);})[_0xebd4('0x16')](function(_0x31f45a){logger[_0xebd4('0x12')](_0xebd4('0x1f'),_0x31f45a['message'],_0x5a2c35);_0x393c15(_0x18de68[_0xebd4('0x12')](0x1f4,_0x31f45a[_0xebd4('0x14')]));});});}; \ No newline at end of file +var _0x8ea2=['raw','where','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelApplication','update','body','options'];(function(_0x2f7ff2,_0x37267c){var _0xca77db=function(_0x3bb190){while(--_0x3bb190){_0x2f7ff2['push'](_0x2f7ff2['shift']());}};_0xca77db(++_0x37267c);}(_0x8ea2,0xea));var _0x28ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x28ea('0x0'));var util=require(_0x28ea('0x1'));var moment=require(_0x28ea('0x2'));var BPromise=require(_0x28ea('0x3'));var rs=require(_0x28ea('0x4'));var fs=require('fs');var Redis=require(_0x28ea('0x5'));var db=require(_0x28ea('0x6'))['db'];var utils=require(_0x28ea('0x7'));var logger=require(_0x28ea('0x8'))(_0x28ea('0x9'));var config=require(_0x28ea('0xa'));var jayson=require(_0x28ea('0xb'));var client=jayson['client'][_0x28ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4870b2,_0x3e4a0f,_0x2b7c4f){return new BPromise(function(_0x3ab8c3,_0xfdcec1){return client[_0x28ea('0xd')](_0x4870b2,_0x2b7c4f)[_0x28ea('0xe')](function(_0x3683b4){logger[_0x28ea('0xf')](_0x28ea('0x10'),_0x3e4a0f,_0x28ea('0x11'));logger[_0x28ea('0x12')](_0x28ea('0x13'),_0x3e4a0f,_0x28ea('0x11'),JSON[_0x28ea('0x14')](_0x3683b4));if(_0x3683b4['error']){if(_0x3683b4[_0x28ea('0x15')][_0x28ea('0x16')]===0x1f4){logger[_0x28ea('0x15')](_0x28ea('0x10'),_0x3e4a0f,_0x3683b4[_0x28ea('0x15')][_0x28ea('0x17')]);return _0xfdcec1(_0x3683b4['error'][_0x28ea('0x17')]);}logger[_0x28ea('0x15')](_0x28ea('0x10'),_0x3e4a0f,_0x3683b4[_0x28ea('0x15')]['message']);return _0x3ab8c3(_0x3683b4[_0x28ea('0x15')][_0x28ea('0x17')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3e4a0f,_0x28ea('0x11'));_0x3ab8c3(_0x3683b4[_0x28ea('0x18')][_0x28ea('0x17')]);}})[_0x28ea('0x19')](function(_0x4c5c86){logger[_0x28ea('0x15')](_0x28ea('0x10'),_0x3e4a0f,_0x4c5c86);_0xfdcec1(_0x4c5c86);});});}exports['UpdateOpenchannelApplication']=function(_0x3fdc9e){var _0x104fb7=this;return new Promise(function(_0x3ab4ed,_0xa89dfd){return db[_0x28ea('0x1a')][_0x28ea('0x1b')](_0x3fdc9e[_0x28ea('0x1c')],{'raw':_0x3fdc9e[_0x28ea('0x1d')]?_0x3fdc9e[_0x28ea('0x1d')][_0x28ea('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fdc9e['options']?_0x3fdc9e[_0x28ea('0x1d')][_0x28ea('0x1f')]||null:null,'attributes':_0x3fdc9e['options']?_0x3fdc9e[_0x28ea('0x1d')]['attributes']||null:null,'limit':_0x3fdc9e['options']?_0x3fdc9e[_0x28ea('0x1d')]['limit']||null:null})[_0x28ea('0xe')](function(_0x5914bc){logger['info'](_0x28ea('0x20'),_0x3fdc9e);logger[_0x28ea('0x12')](_0x28ea('0x20'),_0x3fdc9e,JSON[_0x28ea('0x14')](_0x5914bc));_0x3ab4ed(_0x5914bc);})[_0x28ea('0x19')](function(_0x4f078e){logger[_0x28ea('0x15')](_0x28ea('0x20'),_0x4f078e['message'],_0x3fdc9e);_0xa89dfd(_0x104fb7[_0x28ea('0x15')](0x1f4,_0x4f078e[_0x28ea('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index bd8ffda..8f9650e 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 _0x575e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','connect-timeout'];(function(_0x286e51,_0x25ba9d){var _0x5cf65b=function(_0x47ce9c){while(--_0x47ce9c){_0x286e51['push'](_0x286e51['shift']());}};_0x5cf65b(++_0x25ba9d);}(_0x575e,0x9a));var _0xe575=function(_0x3bdde7,_0x5949fd){_0x3bdde7=_0x3bdde7-0x0;var _0xf94a37=_0x575e[_0x3bdde7];return _0xf94a37;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe575('0x0'));var express=require(_0xe575('0x1'));var router=express[_0xe575('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe575('0x3'));var interaction=require(_0xe575('0x4'));var config=require(_0xe575('0x5'));var controller=require(_0xe575('0x6'));router[_0xe575('0x7')]('/',auth[_0xe575('0x8')](),controller[_0xe575('0x9')]);router['get'](_0xe575('0xa'),auth[_0xe575('0x8')](),controller[_0xe575('0xb')]);router[_0xe575('0x7')](_0xe575('0xc'),auth['isAuthenticated'](),controller[_0xe575('0xd')]);router['get'](_0xe575('0xe'),auth[_0xe575('0x8')](),controller[_0xe575('0xf')]);router[_0xe575('0x7')](_0xe575('0x10'),auth[_0xe575('0x8')](),controller['download']);router[_0xe575('0x11')]('/',auth[_0xe575('0x8')](),controller[_0xe575('0x12')]);router['post'](_0xe575('0xe'),auth[_0xe575('0x8')](),controller[_0xe575('0x13')]);router['post'](_0xe575('0x14'),auth[_0xe575('0x8')](),interaction[_0xe575('0x15')](_0xe575('0x16'),_0xe575('0x17')),controller['addTags']);router[_0xe575('0x18')](_0xe575('0xc'),auth[_0xe575('0x8')](),interaction[_0xe575('0x15')](_0xe575('0x16'),_0xe575('0x19')),controller[_0xe575('0x1a')]);router[_0xe575('0x1b')](_0xe575('0xc'),auth[_0xe575('0x8')](),interaction[_0xe575('0x15')]('openchannel',_0xe575('0x1c')),controller[_0xe575('0x1d')]);router['delete']('/:id/tags',auth[_0xe575('0x8')](),controller['removeTags']);module[_0xe575('0x1e')]=router; \ No newline at end of file +var _0x779e=['removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','update','openchannelinteraction:destroy','destroy','delete'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x779e,0x142));var _0xe779=function(_0x5aa1e2,_0x2b5adb){_0x5aa1e2=_0x5aa1e2-0x0;var _0x399098=_0x779e[_0x5aa1e2];return _0x399098;};'use strict';var multer=require('multer');var util=require(_0xe779('0x0'));var path=require(_0xe779('0x1'));var timeout=require(_0xe779('0x2'));var express=require(_0xe779('0x3'));var router=express[_0xe779('0x4')]();var fs_extra=require(_0xe779('0x5'));var auth=require(_0xe779('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe779('0x7'));var controller=require(_0xe779('0x8'));router[_0xe779('0x9')]('/',auth[_0xe779('0xa')](),controller[_0xe779('0xb')]);router[_0xe779('0x9')](_0xe779('0xc'),auth['isAuthenticated'](),controller[_0xe779('0xd')]);router[_0xe779('0x9')](_0xe779('0xe'),auth[_0xe779('0xa')](),controller[_0xe779('0xf')]);router[_0xe779('0x9')](_0xe779('0x10'),auth['isAuthenticated'](),controller[_0xe779('0x11')]);router[_0xe779('0x9')]('/:id/download',auth[_0xe779('0xa')](),controller['download']);router[_0xe779('0x12')]('/',auth[_0xe779('0xa')](),controller[_0xe779('0x13')]);router[_0xe779('0x12')](_0xe779('0x10'),auth[_0xe779('0xa')](),controller[_0xe779('0x14')]);router[_0xe779('0x12')](_0xe779('0x15'),auth['isAuthenticated'](),interaction[_0xe779('0x16')](_0xe779('0x17'),_0xe779('0x18')),controller[_0xe779('0x19')]);router['put']('/:id',auth[_0xe779('0xa')](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller[_0xe779('0x1a')]);router['delete'](_0xe779('0xe'),auth[_0xe779('0xa')](),interaction[_0xe779('0x16')]('openchannel',_0xe779('0x1b')),controller[_0xe779('0x1c')]);router[_0xe779('0x1d')](_0xe779('0x15'),auth[_0xe779('0xa')](),controller[_0xe779('0x1e')]);module[_0xe779('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 587d985..a330374 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 _0x61b8=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x61b8,0x169));var _0x861b=function(_0x536559,_0x10ccde){_0x536559=_0x536559-0x0;var _0x15d8f1=_0x61b8[_0x536559];return _0x15d8f1;};'use strict';var Sequelize=require(_0x861b('0x0'));module[_0x861b('0x1')]={'closed':{'type':Sequelize[_0x861b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x861b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x861b('0x3')]},'read1stAt':{'type':Sequelize[_0x861b('0x4')]},'threadId':{'type':Sequelize[_0x861b('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x861b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x861b('0x5')]('in',_0x861b('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x861b('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x861b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6688=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x6688,0x10e));var _0x8668=function(_0xb1d685,_0x3a02ec){_0xb1d685=_0xb1d685-0x0;var _0x400fc3=_0x6688[_0xb1d685];return _0x400fc3;};'use strict';var Sequelize=require(_0x8668('0x0'));module[_0x8668('0x1')]={'closed':{'type':Sequelize[_0x8668('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8668('0x3')]},'secondDisposition':{'type':Sequelize[_0x8668('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8668('0x3')]},'note':{'type':Sequelize[_0x8668('0x3')]},'read1stAt':{'type':Sequelize[_0x8668('0x4')]},'threadId':{'type':Sequelize[_0x8668('0x3')]},'externalUrl':{'type':Sequelize[_0x8668('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8668('0x5')]('in',_0x8668('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x8668('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index cdd7d5b..8ef6983 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 _0x1051=['user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','unreadMessages','value','having','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','User','operator','text','start','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','params','options','create','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','Tag','emit','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','fullname','CmContact','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','N.A.','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','createWriteStream','System','Contact','basename','out','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','sendStatus','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','name','map','TagIds','Tags','forEach','catch','waiting','talking','unmanaged','UserId','closed','total','index','OpenchannelInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1051,0x189));var _0x1105=function(_0x5dae4b,_0x3f85b3){_0x5dae4b=_0x5dae4b-0x0;var _0x41bdbe=_0x1051[_0x5dae4b];return _0x41bdbe;};'use strict';var emlformat=require(_0x1105('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1105('0x1'));var jsonpatch=require(_0x1105('0x2'));var rp=require('request-promise');var moment=require(_0x1105('0x3'));var BPromise=require(_0x1105('0x4'));var Mustache=require(_0x1105('0x5'));var util=require('util');var path=require(_0x1105('0x6'));var sox=require('sox');var csv=require(_0x1105('0x7'));var ejs=require(_0x1105('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1105('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1105('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1105('0xb'));var Papa=require('papaparse');var Redis=require(_0x1105('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1105('0xd'));var as=require(_0x1105('0xe'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1105('0xf'))(_0x1105('0x10'));var utils=require(_0x1105('0x11'));var config=require(_0x1105('0x12'));var licenseUtil=require(_0x1105('0x13'));var db=require(_0x1105('0x14'))['db'];config['redis']=_[_0x1105('0x15')](config[_0x1105('0x16')],{'host':_0x1105('0x17'),'port':0x18eb});var socket=require(_0x1105('0x18'))(new Redis(config[_0x1105('0x16')]));require(_0x1105('0x19'))['register'](socket);function respondWithStatusCode(_0xa6314d,_0x3890c8){_0x3890c8=_0x3890c8||0xcc;return function(_0x531548){if(_0x531548){return _0xa6314d['sendStatus'](_0x3890c8);}return _0xa6314d[_0x1105('0x1a')](_0x3890c8)[_0x1105('0x1b')]();};}function respondWithResult(_0x53916c,_0x7f82da){_0x7f82da=_0x7f82da||0xc8;return function(_0x4e57dd){if(_0x4e57dd){return _0x53916c['status'](_0x7f82da)[_0x1105('0x1c')](_0x4e57dd);}};}function respondWithFilteredResult(_0x5d55ce,_0x3d2f10){return function(_0x458538){if(_0x458538){var _0x12d355=typeof _0x3d2f10['offset']==='undefined'&&typeof _0x3d2f10[_0x1105('0x1d')]===_0x1105('0x1e');var _0x237830=_0x458538[_0x1105('0x1f')];var _0x5335a5=_0x12d355?0x0:_0x3d2f10[_0x1105('0x20')];var _0x22b5c3=_0x12d355?_0x458538[_0x1105('0x1f')]:_0x3d2f10[_0x1105('0x20')]+_0x3d2f10[_0x1105('0x1d')];var _0x1c9308;if(_0x22b5c3>=_0x237830){_0x22b5c3=_0x237830;_0x1c9308=0xc8;}else{_0x1c9308=0xce;}_0x5d55ce[_0x1105('0x1a')](_0x1c9308);return _0x5d55ce[_0x1105('0x21')](_0x1105('0x22'),_0x5335a5+'-'+_0x22b5c3+'/'+_0x237830)[_0x1105('0x1c')](_0x458538);}return null;};}function patchUpdates(_0x2085f8){return function(_0x499b3e){try{jsonpatch[_0x1105('0x23')](_0x499b3e,_0x2085f8,!![]);}catch(_0x2b41e4){return BPromise[_0x1105('0x24')](_0x2b41e4);}return _0x499b3e[_0x1105('0x25')]();};}function saveUpdates(_0x300228,_0x24603f){return function(_0x5a40c2){if(_0x5a40c2){return _0x5a40c2[_0x1105('0x26')](_0x300228)['then'](function(_0x4985bc){return _0x4985bc;});}return null;};}function removeEntity(_0x5ca4b1,_0x28441a){return function(_0x138abe){if(_0x138abe){return _0x138abe[_0x1105('0x27')]()[_0x1105('0x28')](function(){_0x5ca4b1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cee59,_0x166091){return function(_0x42b145){if(!_0x42b145){_0x4cee59['sendStatus'](0x194);}return _0x42b145;};}function handleError(_0x319d52,_0x160f6b){_0x160f6b=_0x160f6b||0x1f4;return function(_0x422479){logger[_0x1105('0x29')](_0x422479['stack']);if(_0x422479[_0x1105('0x2a')]){delete _0x422479['name'];}_0x319d52[_0x1105('0x1a')](_0x160f6b)['send'](_0x422479);};}function getInteractionUsers(_0x2250cb,_0x25b140){return new BPromise(function(_0x2bce33,_0x36f2be){try{if(_0x25b140[_0x2250cb['id']]){_0x2250cb['Users']=_[_0x1105('0x2b')](_0x25b140[_0x2250cb['id']],function(_0x5bec34){return{'id':_0x5bec34['id'],'fullname':_0x5bec34['fullname']};});}}catch(_0x1c2968){_0x36f2be(_0x1c2968);}_0x2bce33(_0x2250cb);});}function getInteractionTags(_0x1f446c,_0x57b59e){return new BPromise(function(_0x1020bf,_0x38638c){try{if(_0x1f446c[_0x1105('0x2c')]){_0x1f446c[_0x1105('0x2d')]=[];_0x1f446c[_0x1105('0x2c')]['split'](',')[_0x1105('0x2e')](function(_0x59e645){_0x1f446c[_0x1105('0x2d')]['push'](_0x57b59e[_0x59e645]);});}delete _0x1f446c['TagIds'];}catch(_0x5611da){_0x38638c(_0x5611da);}_0x1020bf(_0x1f446c);});}function updateOpenchannelInteraction(_0x322b81,_0x11fbc3,_0x169614){return new BPromise(function(_0x2911c4,_0x48fed1){return getInteractionUsers(_0x322b81,_0x169614)['then'](function(_0x51ff27){return getInteractionTags(_0x51ff27,_0x11fbc3);})[_0x1105('0x28')](function(_0x595412){return getStateInteraction(_0x595412);})[_0x1105('0x28')](function(_0x5b16da){_0x2911c4(_0x5b16da);})[_0x1105('0x2f')](function(_0x32b760){_0x48fed1(_0x32b760);});});}function getStateInteraction(_0x2031c4){return new BPromise(function(_0x485db2){_0x2031c4[_0x1105('0x30')]=0x0;_0x2031c4[_0x1105('0x31')]=0x0;_0x2031c4['answered']=0x0;_0x2031c4[_0x1105('0x32')]=0x0;_0x2031c4['total']=0x0;if(!_0x2031c4['closed']&&!_0x2031c4[_0x1105('0x33')]){_0x2031c4[_0x1105('0x30')]+=0x1;}if(!_0x2031c4[_0x1105('0x34')]&&_0x2031c4['UserId']){_0x2031c4[_0x1105('0x31')]+=0x1;if(_0x2031c4[_0x1105('0x30')]){_0x2031c4[_0x1105('0x30')]-=0x1;}}if(_0x2031c4[_0x1105('0x34')]&&_0x2031c4['UserId']){_0x2031c4['answered']+=0x1;if(_0x2031c4[_0x1105('0x31')]){_0x2031c4['talking']-=0x1;}}if(_0x2031c4[_0x1105('0x34')]&&!_0x2031c4[_0x1105('0x33')]){_0x2031c4[_0x1105('0x32')]+=0x1;if(_0x2031c4[_0x1105('0x30')]){_0x2031c4[_0x1105('0x30')]-=0x1;}}_0x2031c4[_0x1105('0x35')]+=0x1;_0x485db2(_0x2031c4);});}exports[_0x1105('0x36')]=function(_0x5aac6d,_0x99e4da){var _0xbcd0a1={},_0x1e67d2={},_0x571055={'count':0x0,'rows':[]};var _0x5a3d9f=_[_0x1105('0x2b')](db[_0x1105('0x37')][_0x1105('0x38')],function(_0x19178f){return{'name':_0x19178f['fieldName'],'type':_0x19178f[_0x1105('0x39')][_0x1105('0x3a')]};});_0x1e67d2[_0x1105('0x3b')]=_[_0x1105('0x2b')](_0x5a3d9f,_0x1105('0x2a'));_0x1e67d2[_0x1105('0x3c')]=_[_0x1105('0x3d')](_0x5aac6d[_0x1105('0x3c')]);_0x1e67d2[_0x1105('0x3e')]=_[_0x1105('0x3f')](_0x1e67d2[_0x1105('0x3b')],_0x1e67d2[_0x1105('0x3c')]);_0xbcd0a1[_0x1105('0x40')]=_[_0x1105('0x3f')](_0x1e67d2['model'],qs[_0x1105('0x41')](_0x5aac6d['query'][_0x1105('0x41')]));_0xbcd0a1['attributes']=_0xbcd0a1[_0x1105('0x40')][_0x1105('0x42')]?_0xbcd0a1[_0x1105('0x40')]:_0x1e67d2[_0x1105('0x3b')];if(!_0x5aac6d[_0x1105('0x3c')][_0x1105('0x43')]('nolimit')){_0xbcd0a1[_0x1105('0x1d')]=qs[_0x1105('0x1d')](_0x5aac6d[_0x1105('0x3c')][_0x1105('0x1d')]);_0xbcd0a1['offset']=qs['offset'](_0x5aac6d[_0x1105('0x3c')][_0x1105('0x20')]);}_0xbcd0a1[_0x1105('0x44')]=qs['sort'](_0x5aac6d[_0x1105('0x3c')][_0x1105('0x45')]);_0xbcd0a1[_0x1105('0x46')]=qs[_0x1105('0x3e')](_[_0x1105('0x47')](_0x5aac6d['query'],_0x1e67d2[_0x1105('0x3e')]),_0x5a3d9f);var _0x4ea908=[];var _0x52c684=squel[_0x1105('0x48')]()[_0x1105('0x49')]('id')[_0x1105('0x49')](_0x1105('0x2a'))[_0x1105('0x49')](_0x1105('0x4a'))[_0x1105('0x4b')](_0x1105('0x4c'));var _0x5f3981=squel[_0x1105('0x48')]()[_0x1105('0x49')](_0x1105('0x4d'))[_0x1105('0x49')](_0x1105('0x4e'))[_0x1105('0x49')]('ui.OpenchannelInteractionId')[_0x1105('0x4b')](_0x1105('0x4f'),'ui')[_0x1105('0x50')](_0x1105('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x4eae31=squel['select']()[_0x1105('0x4b')](_0x1105('0x52'),'i')[_0x1105('0x50')](_0x1105('0x53'),'c',_0x1105('0x54'))[_0x1105('0x50')](_0x1105('0x51'),'o',_0x1105('0x55'))['left_join'](_0x1105('0x56'),'a',_0x1105('0x57'))[_0x1105('0x50')](_0x1105('0x58'),'me',_0x1105('0x59'))[_0x1105('0x50')]('openchannel_interaction_has_tags','it',_0x1105('0x5a'))['left_join'](_0x1105('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x2acc5d=squel['expr']();var _0x3ef334=[];var _0x17704f=squel[_0x1105('0x5b')]();var _0x186e1f;if(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x5c')]){_0x186e1f=as[_0x1105('0x5d')](_0x5aac6d['query'][_0x1105('0x5c')]);var _0xb898f6=_0x186e1f['sqlOperator'];for(var _0x4e7843=0x0;_0x4e7843<_0x186e1f[_0x1105('0x5e')][_0x1105('0x42')];_0x4e7843++){var _0xb0eac3=_0x186e1f[_0x1105('0x5e')][_0x4e7843];var _0x5d9920='i';var _0x2464c8=_['find'](_0x5a3d9f,[_0x1105('0x2a'),_0xb0eac3[_0x1105('0x49')]]);if(!_0x2464c8){switch(_0xb0eac3[_0x1105('0x49')]){case _0x1105('0x5f'):if(_0xb0eac3[_0x1105('0x60')]==0x1){_0x4eae31[_0x1105('0x61')]('`'+_0xb0eac3['field']+'`\x20=\x200');}else{_0x4eae31[_0x1105('0x61')]('`'+_0xb0eac3['field']+'`\x20>\x200');}break;case'Contact':if(_0xb0eac3['operator']===_0x1105('0x62')){if(_0xb0eac3[_0x1105('0x60')][_0x1105('0x63')]('\x20')[_0x1105('0x42')]>0x1){_0x2acc5d[_0xb898f6](_0x1105('0x64'),qs[_0x1105('0x65')](_0xb0eac3[_0x1105('0x60')]),null);}else{var _0x17571a='%'+_0xb0eac3[_0x1105('0x60')]+'%';_0x2acc5d[_0xb898f6](_0x1105('0x66'),_0x17571a,_0x17571a,_0x17571a);}}else{_0x2464c8=_[_0x1105('0x67')](_0x5a3d9f,['name',_0x1105('0x68')]);_0xb0eac3['field']='ContactId';_0x16264=as[_0x1105('0x69')](_0x5d9920,_0x2464c8[_0x1105('0x39')],_0xb0eac3);_0x2acc5d[_0xb898f6](_0x16264['text'],_0x16264[_0x1105('0x60')]['start'],_0x16264['value'][_0x1105('0x1b')]);}break;case'Tag':var _0x4b39d0=_0xb0eac3[_0x1105('0x60')][_0x1105('0x63')](',')[_0x1105('0x2b')](function(_0x1a5e93){return Number(_0x1a5e93);});_0x4b39d0['forEach'](function(_0x4f772e){_0x17704f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f772e+',%');});_0x3ef334=_['union'](_0x3ef334,_0x4b39d0);break;case _0x1105('0x6a'):if(_0xb0eac3[_0x1105('0x6b')]==='$substring'){_0x2acc5d[_0xb898f6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xb0eac3[_0x1105('0x60')]+'%',null);}else{_0x2464c8=_[_0x1105('0x67')](_0x5a3d9f,[_0x1105('0x2a'),_0x1105('0x33')]);_0xb0eac3['field']=_0x1105('0x33');_0x16264=as['buildExpression'](_0x5d9920,_0x2464c8['type'],_0xb0eac3);_0x2acc5d[_0xb898f6](_0x16264[_0x1105('0x6c')],_0x16264['value'][_0x1105('0x6d')],_0x16264[_0x1105('0x60')]['end']);}break;case _0x1105('0x6e'):_0x16264=as[_0x1105('0x69')]('me',null,_0xb0eac3);_0x2acc5d[_0xb898f6](_0x16264[_0x1105('0x6c')],_0x16264[_0x1105('0x60')]['start'],_0x16264[_0x1105('0x60')]['end']);break;}}else{var _0x16264=as[_0x1105('0x69')](_0x5d9920,_0x2464c8[_0x1105('0x39')],_0xb0eac3);_0x2acc5d[_0xb898f6](_0x16264['text'],_0x16264[_0x1105('0x60')][_0x1105('0x6d')],_0x16264[_0x1105('0x60')]['end']);}}}else{var _0x4a38d7=_(_0x5aac6d['query'])[_0x1105('0x3d')]()[_0x1105('0x2b')](function(_0x36a8be){return _[_0x1105('0x6f')](_0x5a3d9f,['name',_0x36a8be])?_0x36a8be:undefined;})[_0x1105('0x70')]()[_0x1105('0x60')]();if(!_['isEmpty'](_0x4a38d7)){_0x4a38d7[_0x1105('0x2e')](function(_0x5fe66c){if(_0x5fe66c===_0x1105('0x71')){_0x4eae31[_0x1105('0x46')](_0x1105('0x72'),[]['concat'](_0x5aac6d[_0x1105('0x3c')][_0x5fe66c]));}else if(_0x5fe66c==='createdAt'){var _0x117692=JSON[_0x1105('0x73')](_0x5aac6d[_0x1105('0x3c')][_0x5fe66c])[_0x1105('0x74')];var _0xb02f1f=JSON['parse'](_0x5aac6d[_0x1105('0x3c')][_0x5fe66c])[_0x1105('0x75')];_0x4eae31['where'](_0x1105('0x76'),_0x117692,_0xb02f1f);}else{if(_0x5aac6d[_0x1105('0x3c')][_0x5fe66c]==='null'){_0x4eae31[_0x1105('0x46')]('i.'+_0x5fe66c+_0x1105('0x77'));}else{_0x4eae31['where']('i.'+_0x5fe66c+'\x20=\x20?',_0x5aac6d['query'][_0x5fe66c]);}}});}if(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x78')]){if(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x78')]==0x1){_0x4eae31[_0x1105('0x61')](_0x1105('0x79'));}else{_0x4eae31[_0x1105('0x61')](_0x1105('0x7a'));}}if(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x7b')]){_0x3ef334=_[_0x1105('0x7c')](_0x5aac6d['query'][_0x1105('0x7b')])?_0x5aac6d['query'][_0x1105('0x7b')]:new Array(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x7b')]);_0x3ef334[_0x1105('0x2e')](function(_0x4c255f){_0x17704f['or'](_0x1105('0x7d'),'%,'+_0x4c255f+',%');});}if(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x7e')]){var _0x44c1de=_0x5aac6d[_0x1105('0x3c')][_0x1105('0x7e')][_0x1105('0x7f')]('\x5c','\x5c\x5c')[_0x1105('0x7f')](/'/g,'\x27\x27');if(qs[_0x1105('0x80')](_0x44c1de)){_0x2acc5d['or'](_0x1105('0x81'),_0x44c1de+'%');}else{_0x2acc5d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x44c1de))['or'](_0x1105('0x82'),_0x44c1de+'%')['or'](_0x1105('0x83'),_0x44c1de+'%');}}}_0x4eae31[_0x1105('0x46')](_0x2acc5d);_0x4eae31[_0x1105('0x84')](_0x1105('0x85'));var _0x42a52b={'type':db[_0x1105('0x86')][_0x1105('0x87')]['SELECT'],'raw':!![]};var _0x13e512=_0x4eae31[_0x1105('0x88')]();_0x13e512[_0x1105('0x49')]('i.id');_0x13e512[_0x1105('0x49')](_0x1105('0x89'),_0x1105('0x5f'));if(_0xbcd0a1[_0x1105('0x44')]){_0xbcd0a1[_0x1105('0x44')]['forEach'](function(_0x293bc4){var _0x64a87d=_0x293bc4[0x0]===_0x1105('0x8a')?_0x293bc4[0x0]:'i.'+_0x293bc4[0x0];_0x4eae31[_0x1105('0x44')](_0x64a87d,_0x293bc4[0x1]===_0x1105('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x3ef334)){_0x4eae31[_0x1105('0x61')](_0x17704f);_0x13e512[_0x1105('0x46')](_0x1105('0x8c'),_0x3ef334);}BPromise[_0x1105('0x8d')]()[_0x1105('0x28')](function(){if(!_0x186e1f){if(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x71')])return;_0x13e512[_0x1105('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x4eae31[_0x1105('0x46')](_0x1105('0x8e'));return;}if(_0x5aac6d[_0x1105('0x8f')]['role']!==_0x1105('0x90'))return;return _0x5aac6d[_0x1105('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x3865a6){if(_['isEmpty'](_0x3865a6)){_0x13e512[_0x1105('0x46')](_0x1105('0x91'));_0x4eae31[_0x1105('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x13e512[_0x1105('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x3865a6,'id'));_0x4eae31[_0x1105('0x46')](_0x1105('0x72'),_[_0x1105('0x2b')](_0x3865a6,'id'));}});})[_0x1105('0x28')](function(){if(_0x5aac6d[_0x1105('0x8f')][_0x1105('0x92')]==='agent'&&!_0x186e1f&&!_0x5aac6d[_0x1105('0x3c')]['OpenchannelAccountId'])return[];return db[_0x1105('0x93')][_0x1105('0x3c')](_0x13e512[_0x1105('0x94')](),_0x42a52b);})[_0x1105('0x28')](function(_0x35885d){_0x571055[_0x1105('0x1f')]=_0x35885d['length'];if(_0x571055[_0x1105('0x1f')]===0x0)return[];return db['sequelize'][_0x1105('0x3c')](_0x52c684[_0x1105('0x94')](),_0x42a52b)[_0x1105('0x28')](function(_0x5e9d42){_0x4ea908=_[_0x1105('0x95')](_0x5e9d42,'id');_0x42a52b=_[_0x1105('0x96')](_0x42a52b,{'model':db[_0x1105('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5aac6d[_0x1105('0x3c')][_0x1105('0x41')]){_0xbcd0a1[_0x1105('0x40')]['forEach'](function(_0x26b4a8){_0x4eae31[_0x1105('0x49')]('i.'+_0x26b4a8);});}else{_0x4eae31['field'](_0x1105('0x89'),_0x1105('0x5f'));_0x4eae31[_0x1105('0x49')](_0x1105('0x97'),_0x1105('0x98'));_0x4eae31['field'](_0x1105('0x99'),_0x1105('0x9a'));_0x4eae31['field'](_0x1105('0x9b'),'contactName');_0x4eae31[_0x1105('0x49')](_0x1105('0x9c'));_0x4eae31['field']('c.firstName',_0x1105('0x9d'));_0x4eae31[_0x1105('0x49')](_0x1105('0x9e'),_0x1105('0x9f'));_0x4eae31[_0x1105('0x49')](_0x1105('0xa0'),_0x1105('0xa1'));_0x4eae31['field'](_0x1105('0xa2'),'Contact.phone');_0x4eae31['field']('c.mobile',_0x1105('0xa3'));_0x4eae31[_0x1105('0x49')](_0x1105('0xa4'),'Contact.fax');_0x4eae31['field']('o.fullname',_0x1105('0xa5'));_0x4eae31[_0x1105('0x49')](_0x1105('0xa6'),_0x1105('0xa7'));_0x4eae31['field'](_0x1105('0xa8'),'TagIds');}if(_0xbcd0a1[_0x1105('0x1d')])_0x4eae31['limit'](_0xbcd0a1['limit']);if(_0xbcd0a1[_0x1105('0x20')])_0x4eae31['offset'](_0xbcd0a1['offset']);return db[_0x1105('0x93')]['query'](_0x4eae31['toString'](),_0x42a52b);})[_0x1105('0x28')](function(_0x558688){if(_0x558688['length']>0x0)_0x5f3981[_0x1105('0x46')](_0x1105('0xa9'),_[_0x1105('0x2b')](_0x558688,'id'));return db[_0x1105('0x93')][_0x1105('0x3c')](_0x5f3981[_0x1105('0x94')](),_0x42a52b)[_0x1105('0x28')](function(_0x58bf22){var _0x56090c=_[_0x1105('0xaa')](_0x58bf22,_0x1105('0xab'));var _0xfdceeb=[];_0x558688['forEach'](function(_0x1d8717){_0xfdceeb[_0x1105('0xac')](updateOpenchannelInteraction(_0x1d8717,_0x4ea908,_0x56090c));});return BPromise[_0x1105('0xad')](_0xfdceeb);});});})[_0x1105('0x28')](function(_0x4a3554){_0x571055[_0x1105('0xae')]=_0x4a3554;return _0x571055;})[_0x1105('0x28')](respondWithFilteredResult(_0x99e4da,_0xbcd0a1))[_0x1105('0x2f')](handleError(_0x99e4da,null));};exports['show']=function(_0x35a5e0,_0x16ce34){var _0x277965={};if(_0x35a5e0['query'][_0x1105('0x39')]&&_0x35a5e0[_0x1105('0x3c')][_0x1105('0x39')]==='from'){_0x277965['from']=_0x35a5e0[_0x1105('0xaf')]['id'];}else{_0x277965['id']=_0x35a5e0['params']['id'];}var _0xb64ad2={'raw':![],'where':_0x277965},_0x42f4aa={};_0x42f4aa[_0x1105('0x3b')]=_[_0x1105('0x3d')](db[_0x1105('0x37')][_0x1105('0x38')]);_0x42f4aa[_0x1105('0x3c')]=_['keys'](_0x35a5e0['query']);_0x42f4aa[_0x1105('0x3e')]=_['intersection'](_0x42f4aa[_0x1105('0x3b')],_0x42f4aa[_0x1105('0x3c')]);_0xb64ad2[_0x1105('0x40')]=_[_0x1105('0x3f')](_0x42f4aa['model'],qs[_0x1105('0x41')](_0x35a5e0[_0x1105('0x3c')][_0x1105('0x41')]));_0xb64ad2[_0x1105('0x40')]=_0xb64ad2[_0x1105('0x40')][_0x1105('0x42')]?_0xb64ad2[_0x1105('0x40')]:_0x42f4aa[_0x1105('0x3b')];if(_0x35a5e0[_0x1105('0x3c')]['includeAll']){_0xb64ad2['include']=[{'all':!![]}];}_0xb64ad2=_[_0x1105('0x96')]({},_0xb64ad2,_0x35a5e0[_0x1105('0xb0')]);return db['OpenchannelInteraction']['find'](_0xb64ad2)[_0x1105('0x28')](handleEntityNotFound(_0x16ce34,null))[_0x1105('0x28')](respondWithResult(_0x16ce34,null))[_0x1105('0x2f')](handleError(_0x16ce34,null));};exports[_0x1105('0xb1')]=function(_0xf3aec1,_0x215895){return db['OpenchannelInteraction']['create'](_0xf3aec1['body'],{})[_0x1105('0x28')](respondWithResult(_0x215895,0xc9))[_0x1105('0x2f')](handleError(_0x215895,null));};exports[_0x1105('0x26')]=function(_0x58e72c,_0x39a9aa){if(_0x58e72c['body']['id']){delete _0x58e72c[_0x1105('0x6e')]['id'];}return db[_0x1105('0x37')][_0x1105('0x67')]({'where':{'id':_0x58e72c[_0x1105('0xaf')]['id']}})['then'](handleEntityNotFound(_0x39a9aa,null))[_0x1105('0x28')](saveUpdates(_0x58e72c[_0x1105('0x6e')],null))[_0x1105('0x28')](respondWithResult(_0x39a9aa,null))[_0x1105('0x2f')](handleError(_0x39a9aa,null));};exports[_0x1105('0x27')]=function(_0x56b933,_0x2ce327){return db[_0x1105('0x37')][_0x1105('0x67')]({'where':{'id':_0x56b933[_0x1105('0xaf')]['id']}})[_0x1105('0x28')](handleEntityNotFound(_0x2ce327,null))[_0x1105('0x28')](removeEntity(_0x2ce327,null))[_0x1105('0x2f')](handleError(_0x2ce327,null));};exports['describe']=function(_0x815fe4,_0xa511bf){return db[_0x1105('0x37')][_0x1105('0xb2')]()[_0x1105('0x28')](respondWithResult(_0xa511bf,null))['catch'](handleError(_0xa511bf,null));};exports[_0x1105('0xb3')]=function(_0x2a66d3,_0x2c56ce,_0xe3bbc7){return db[_0x1105('0xb4')][_0x1105('0x67')]({'where':{'id':_0x2a66d3['params']['id']}})[_0x1105('0x28')](handleEntityNotFound(_0x2c56ce,null))['then'](function(_0x5be416){if(_0x5be416){return _0x5be416[_0x1105('0xb3')](_0x2a66d3[_0x1105('0x6e')]['ids'],_[_0x1105('0xb5')](_0x2a66d3['body'],[_0x1105('0xb6'),'id'])||{});}})[_0x1105('0x28')](respondWithResult(_0x2c56ce,null))[_0x1105('0x2f')](handleError(_0x2c56ce,null));};exports[_0x1105('0xb7')]=function(_0x5aa61e,_0x456514,_0xec9462){var _0x378d23={'raw':![],'where':{}};var _0x3fc256={};var _0x1af73b={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x5aa61e[_0x1105('0xaf')]['id']}})[_0x1105('0x28')](handleEntityNotFound(_0x456514,null))[_0x1105('0x28')](function(_0x26c07c){if(_0x26c07c){_0x3fc256['model']=_[_0x1105('0x3d')](db['OpenchannelMessage'][_0x1105('0x38')]);_0x3fc256[_0x1105('0x3c')]=_['keys'](_0x5aa61e['query']);_0x3fc256[_0x1105('0x3e')]=_[_0x1105('0x3f')](_0x3fc256[_0x1105('0x3b')],_0x3fc256[_0x1105('0x3c')]);_0x378d23[_0x1105('0x40')]=_[_0x1105('0x3f')](_0x3fc256[_0x1105('0x3b')],qs['fields'](_0x5aa61e['query'][_0x1105('0x41')]));_0x378d23[_0x1105('0x40')]=_0x378d23[_0x1105('0x40')][_0x1105('0x42')]?_0x378d23[_0x1105('0x40')]:_0x3fc256[_0x1105('0x3b')];if(!_0x5aa61e['query'][_0x1105('0x43')](_0x1105('0xb8'))){_0x378d23[_0x1105('0x1d')]=qs[_0x1105('0x1d')](_0x5aa61e[_0x1105('0x3c')][_0x1105('0x1d')]);_0x378d23[_0x1105('0x20')]=qs[_0x1105('0x20')](_0x5aa61e[_0x1105('0x3c')][_0x1105('0x20')]);}_0x378d23[_0x1105('0x44')]=qs[_0x1105('0x45')](_0x5aa61e[_0x1105('0x3c')][_0x1105('0x45')]);_0x378d23[_0x1105('0x46')]=qs[_0x1105('0x3e')](_['pick'](_0x5aa61e[_0x1105('0x3c')],_0x3fc256[_0x1105('0x3e')]));_0x378d23['where']['OpenchannelInteractionId']=_0x26c07c['id'];if(_0x5aa61e[_0x1105('0x3c')][_0x1105('0x7e')]){_0x378d23[_0x1105('0x46')]=_['merge'](_0x378d23[_0x1105('0x46')],{'$or':_[_0x1105('0x2b')](_0x378d23[_0x1105('0x40')],function(_0x569b0f){var _0x407d21={};_0x407d21[_0x569b0f]={'$like':'%'+_0x5aa61e[_0x1105('0x3c')][_0x1105('0x7e')]+'%'};return _0x407d21;})});}if(_0x5aa61e[_0x1105('0x3c')][_0x1105('0x74')]){var _0x1d642d=_0x5aa61e[_0x1105('0x3c')][_0x1105('0x74')]['split'](',');var _0x423366={};_0x423366[_0x1d642d[0x0]]={'$gte':moment(_0x1d642d[0x1])[_0x1105('0xb9')](_0x1105('0xba'))};_0x378d23['where']=_[_0x1105('0x96')](_0x378d23['where'],_0x423366);}_0x378d23=_[_0x1105('0x96')]({},_0x378d23,_0x5aa61e[_0x1105('0xb0')]);return db['OpenchannelMessage']['count']({'where':_0x378d23['where']})[_0x1105('0x28')](function(_0x4c30b5){_0x1af73b[_0x1105('0x1f')]=_0x4c30b5;if(_0x5aa61e[_0x1105('0x3c')][_0x1105('0xbb')]){_0x378d23['include']=[{'all':!![]}];}return db[_0x1105('0xb4')][_0x1105('0xbc')](_0x378d23);})[_0x1105('0x28')](function(_0x36f6a3){_0x1af73b[_0x1105('0xae')]=_0x36f6a3;return _0x1af73b;});}})['then'](respondWithFilteredResult(_0x456514,_0x378d23))[_0x1105('0x2f')](handleError(_0x456514,null));};exports[_0x1105('0xbd')]=function(_0x361a10,_0x49d8e9,_0x1ad9d3){return db['OpenchannelInteraction'][_0x1105('0x67')]({'where':{'id':_0x361a10[_0x1105('0xaf')]['id']}})[_0x1105('0x28')](handleEntityNotFound(_0x49d8e9,null))['then'](function(_0x4513f7){if(_0x4513f7){return _0x4513f7[_0x1105('0xbe')](_0x361a10[_0x1105('0x6e')][_0x1105('0xb6')],_[_0x1105('0xb5')](_0x361a10[_0x1105('0x6e')],[_0x1105('0xb6'),'id'])||{})[_0x1105('0xbf')](function(){return db[_0x1105('0xc0')][_0x1105('0xbc')]({'attributes':['id',_0x1105('0x2a'),_0x1105('0x4a')],'where':{'id':_0x361a10['body'][_0x1105('0xb6')]}});})[_0x1105('0x28')](function(_0x1838d1){socket[_0x1105('0xc1')]('openchannelInteractionTags:save',{'id':Number(_0x361a10[_0x1105('0xaf')]['id']),'tags':_0x1838d1||[]});return{'id':Number(_0x361a10[_0x1105('0xaf')]['id']),'tags':_0x1838d1||[]};});}})['then'](respondWithResult(_0x49d8e9,null))[_0x1105('0x2f')](handleError(_0x49d8e9,null));};exports['removeTags']=function(_0x4b255b,_0x28b328,_0x4a2d67){return db[_0x1105('0x37')]['find']({'where':{'id':_0x4b255b['params']['id']}})[_0x1105('0x28')](handleEntityNotFound(_0x28b328,null))[_0x1105('0x28')](function(_0x43f987){if(_0x43f987){return _0x43f987['removeTags'](_0x4b255b['query'][_0x1105('0xb6')]);}})[_0x1105('0x28')](respondWithStatusCode(_0x28b328,null))['catch'](handleError(_0x28b328,null));};exports[_0x1105('0xc2')]=function(_0x225ce6,_0x2b1d3b){var _0x3859fc=moment()[_0x1105('0xc3')]()[_0x1105('0x94')]();var _0x2b2118=path[_0x1105('0xc4')](config['root'],_0x1105('0xc5'),_0x1105('0xc6'),_0x1105('0xc7'));var _0x193415=path[_0x1105('0xc4')](config[_0x1105('0xc8')],_0x1105('0xc5'),_0x1105('0xc6'),_0x1105('0xc9'));var _0x53c2c6=path[_0x1105('0xc4')](_0x2b2118,_0x3859fc);var _0x4cac5c=util['format'](_0x1105('0xca'),_0x225ce6[_0x1105('0xaf')]['id'],_0x3859fc);var _0xe56bea=path[_0x1105('0xc4')](_0x2b2118,_0x4cac5c);var _0x2030d5=[];_0x2030d5['push']({'model':db[_0x1105('0x6a')],'as':_0x1105('0x6a'),'attributes':['id',_0x1105('0xcb')],'raw':!![]});_0x2030d5[_0x1105('0xac')]({'model':db[_0x1105('0xcc')],'as':'Contact','attributes':['id','firstName',_0x1105('0xcd')],'raw':!![]});if(_0x225ce6['query'][_0x1105('0xc9')]){_0x2030d5[_0x1105('0xac')]({'model':db[_0x1105('0xce')],'as':_0x1105('0xce'),'raw':!![]});}var _0x2c2f2f=[{'model':db[_0x1105('0xb4')],'as':_0x1105('0xcf'),'attributes':['id',_0x1105('0x6e'),_0x1105('0xd0'),_0x1105('0xd1'),_0x1105('0xd2'),_0x1105('0x78')],'include':_0x2030d5}];_0x2c2f2f[_0x1105('0xac')]({'model':db[_0x1105('0xd3')],'as':_0x1105('0xd4'),'attributes':['id',_0x1105('0x2a')]});_0x2c2f2f[_0x1105('0xac')]({'model':db[_0x1105('0x6a')],'as':_0x1105('0xd5'),'attributes':['id',_0x1105('0xcb')]});return db[_0x1105('0x37')][_0x1105('0x67')]({'where':{'id':_0x225ce6[_0x1105('0xaf')]['id']},'include':_0x2c2f2f})[_0x1105('0x28')](handleEntityNotFound(_0x2b1d3b,null))[_0x1105('0x28')](function(_0x1cb24b){if(_0x1cb24b){var _0x29c331=_0x1cb24b['get']({'plain':!![]});fs['mkdirSync'](_0x53c2c6);var _0x3db212={'channel':'Openchannel','account':_0x29c331[_0x1105('0xd4')]['name'],'agent':_0x29c331['Owner']?_0x29c331[_0x1105('0xd5')][_0x1105('0xcb')]:_0x1105('0xd6'),'createdAt':moment(_0x29c331['createdAt'])[_0x1105('0xb9')](_0x1105('0xba'))[_0x1105('0x94')](),'closedAt':_0x29c331[_0x1105('0x34')]?moment(_0x29c331[_0x1105('0xd7')])[_0x1105('0xb9')](_0x1105('0xba'))[_0x1105('0x94')]():'','disposition':_0x29c331[_0x1105('0xd8')],'visibility':_0x29c331[_0x1105('0xd9')]?_0x1105('0xda'):_0x1105('0xdb'),'messages':_(_0x29c331['Messages'])[_0x1105('0x7e')]({'secret':![]})[_0x1105('0x2b')](function(_0x43e457){if(_0x43e457[_0x1105('0xce')]){var _0x303775=path['join'](_0x193415,_0x43e457[_0x1105('0xce')]['basename']);if(fs[_0x1105('0xdc')](_0x303775)){fs[_0x1105('0xdd')](_0x303775)['pipe'](fs[_0x1105('0xde')](path[_0x1105('0xc4')](_0x53c2c6,_0x43e457[_0x1105('0xce')]['basename'])));}}return{'date':moment(_0x43e457['createdAt'])[_0x1105('0xb9')](_0x1105('0xba'))['toString'](),'sender':_0x43e457[_0x1105('0xd1')]==='out'?_0x43e457['User']?_0x43e457[_0x1105('0x6a')][_0x1105('0xcb')]:_0x1105('0xdf'):_0x43e457['Contact']['firstName']+(_0x43e457[_0x1105('0xe0')][_0x1105('0xcd')]?'\x20'+_0x43e457[_0x1105('0xe0')][_0x1105('0xcd')]:''),'body':_0x43e457[_0x1105('0xce')]?_0x43e457['Attachment'][_0x1105('0xe1')]:_0x43e457['body'],'direction':_0x43e457[_0x1105('0xd1')]===_0x1105('0xe2')?'A':'C','secret':_0x43e457[_0x1105('0xd2')],'read':_0x43e457[_0x1105('0x78')],'attachment':_0x43e457[_0x1105('0xce')]};})[_0x1105('0x60')]()};return ejs['renderFile'](path[_0x1105('0xc4')](config[_0x1105('0xc8')],'server',_0x1105('0xe3'),_0x1105('0xe4')),{'interaction':_0x3db212})[_0x1105('0x28')](function(_0x589f05){var _0x1405c4=path['join'](_0x53c2c6,_0x1105('0xe5')+_0x29c331['id']+'-'+_0x3859fc+_0x1105('0xe6'));var _0x25f797={'path':_0x1405c4,'channel':'Openchannel','interactionId':_0x29c331['id']};return pdf[_0x1105('0xe7')](_0x589f05,_0x25f797);})[_0x1105('0x28')](function(){return new BPromise(function(_0x4ebe11,_0xbcca8a){zipdir(_0x53c2c6,{'saveTo':_0xe56bea},function(_0x4f13e6,_0x5551ce){if(_0x4f13e6)return _0xbcca8a(_0x4f13e6);return _0x4ebe11(_0x5551ce);});})[_0x1105('0x28')](function(){return new BPromise(function(_0x1a629c,_0x4eda4f){rimraf(_0x53c2c6,function(_0x6828a){if(_0x6828a)_0x4eda4f(_0x6828a);return _0x1a629c();});});})[_0x1105('0x28')](function(){return _0x2b1d3b[_0x1105('0xc2')](_0xe56bea,_0x4cac5c,function(_0x59baa7){if(_0x59baa7){console[_0x1105('0xe8')](_0x1105('0xe9'),_0x59baa7);}else{fs[_0x1105('0xea')](_0xe56bea);}});});});}else{return _0x2b1d3b[_0x1105('0xeb')](0xc8);}})['catch'](handleError(_0x2b1d3b,null));}; \ No newline at end of file +var _0xb0f5=['conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','buildExpression','text','body','some','compact','isEmpty','OpenchannelAccountId','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','show','params','rawAttributes','includeAll','include','create','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','sort','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','createdAt','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','disposition','threadId','Public','Messages','Attachment','basename','createWriteStream','out','System','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','talking','unmanaged','closed','UserId','waiting','answered','total','index','OpenchannelInteraction','fieldName','type','model','keys','filters','attributes','intersection','fields','query','length','offset','order','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch'];(function(_0x45268e,_0x5ee19e){var _0x36d493=function(_0x59b799){while(--_0x59b799){_0x45268e['push'](_0x45268e['shift']());}};_0x36d493(++_0x5ee19e);}(_0xb0f5,0x18d));var _0x5b0f=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xb0f5[_0x456fb1];return _0x4083d6;};'use strict';var emlformat=require(_0x5b0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b0f('0x1'));var jsonpatch=require(_0x5b0f('0x2'));var rp=require(_0x5b0f('0x3'));var moment=require(_0x5b0f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5b0f('0x5'));var util=require(_0x5b0f('0x6'));var path=require(_0x5b0f('0x7'));var sox=require(_0x5b0f('0x8'));var csv=require(_0x5b0f('0x9'));var ejs=require(_0x5b0f('0xa'));var fs=require('fs');var fs_extra=require(_0x5b0f('0xb'));var _=require(_0x5b0f('0xc'));var squel=require(_0x5b0f('0xd'));var crypto=require(_0x5b0f('0xe'));var jsforce=require(_0x5b0f('0xf'));var deskjs=require(_0x5b0f('0x10'));var toCsv=require(_0x5b0f('0x9'));var querystring=require(_0x5b0f('0x11'));var Papa=require(_0x5b0f('0x12'));var Redis=require(_0x5b0f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5b0f('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5b0f('0x15'));var hardwareService=require(_0x5b0f('0x16'));var logger=require('../../config/logger')(_0x5b0f('0x17'));var utils=require(_0x5b0f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5b0f('0x19'));var db=require(_0x5b0f('0x1a'))['db'];config['redis']=_[_0x5b0f('0x1b')](config[_0x5b0f('0x1c')],{'host':_0x5b0f('0x1d'),'port':0x18eb});var socket=require(_0x5b0f('0x1e'))(new Redis(config[_0x5b0f('0x1c')]));require(_0x5b0f('0x1f'))[_0x5b0f('0x20')](socket);function respondWithStatusCode(_0x160633,_0x4a7820){_0x4a7820=_0x4a7820||0xcc;return function(_0x356766){if(_0x356766){return _0x160633[_0x5b0f('0x21')](_0x4a7820);}return _0x160633[_0x5b0f('0x22')](_0x4a7820)['end']();};}function respondWithResult(_0x326e80,_0x798e7e){_0x798e7e=_0x798e7e||0xc8;return function(_0xc0dd85){if(_0xc0dd85){return _0x326e80[_0x5b0f('0x22')](_0x798e7e)[_0x5b0f('0x23')](_0xc0dd85);}};}function respondWithFilteredResult(_0x50d8a1,_0x1cacca){return function(_0x5d5e93){if(_0x5d5e93){var _0x40ec82=typeof _0x1cacca['offset']==='undefined'&&typeof _0x1cacca[_0x5b0f('0x24')]===_0x5b0f('0x25');var _0x3e0dfd=_0x5d5e93[_0x5b0f('0x26')];var _0xbd49d5=_0x40ec82?0x0:_0x1cacca['offset'];var _0x1d3d62=_0x40ec82?_0x5d5e93[_0x5b0f('0x26')]:_0x1cacca['offset']+_0x1cacca[_0x5b0f('0x24')];var _0x48a24c;if(_0x1d3d62>=_0x3e0dfd){_0x1d3d62=_0x3e0dfd;_0x48a24c=0xc8;}else{_0x48a24c=0xce;}_0x50d8a1[_0x5b0f('0x22')](_0x48a24c);return _0x50d8a1[_0x5b0f('0x27')](_0x5b0f('0x28'),_0xbd49d5+'-'+_0x1d3d62+'/'+_0x3e0dfd)['json'](_0x5d5e93);}return null;};}function patchUpdates(_0x110cf0){return function(_0x336df2){try{jsonpatch[_0x5b0f('0x29')](_0x336df2,_0x110cf0,!![]);}catch(_0x1d8d74){return BPromise[_0x5b0f('0x2a')](_0x1d8d74);}return _0x336df2['save']();};}function saveUpdates(_0x2b5cdc,_0x4f4342){return function(_0x2c2e87){if(_0x2c2e87){return _0x2c2e87[_0x5b0f('0x2b')](_0x2b5cdc)['then'](function(_0x186455){return _0x186455;});}return null;};}function removeEntity(_0x1934ac,_0x2bb4ce){return function(_0x249605){if(_0x249605){return _0x249605[_0x5b0f('0x2c')]()[_0x5b0f('0x2d')](function(){_0x1934ac[_0x5b0f('0x22')](0xcc)[_0x5b0f('0x2e')]();});}};}function handleEntityNotFound(_0x130f53,_0x43cec6){return function(_0x584ed5){if(!_0x584ed5){_0x130f53[_0x5b0f('0x21')](0x194);}return _0x584ed5;};}function handleError(_0x186a38,_0x285a80){_0x285a80=_0x285a80||0x1f4;return function(_0x3d3356){logger['error'](_0x3d3356[_0x5b0f('0x2f')]);if(_0x3d3356['name']){delete _0x3d3356[_0x5b0f('0x30')];}_0x186a38[_0x5b0f('0x22')](_0x285a80)[_0x5b0f('0x31')](_0x3d3356);};}function getInteractionUsers(_0x20d25f,_0x1eb21e){return new BPromise(function(_0x7f410a,_0xc797fb){try{if(_0x1eb21e[_0x20d25f['id']]){_0x20d25f[_0x5b0f('0x32')]=_[_0x5b0f('0x33')](_0x1eb21e[_0x20d25f['id']],function(_0x40afca){return{'id':_0x40afca['id'],'fullname':_0x40afca['fullname']};});}}catch(_0x3d8a93){_0xc797fb(_0x3d8a93);}_0x7f410a(_0x20d25f);});}function getInteractionTags(_0x36cfdf,_0x599eb4){return new BPromise(function(_0x5ece36,_0x1a117f){try{if(_0x36cfdf[_0x5b0f('0x34')]){_0x36cfdf[_0x5b0f('0x35')]=[];_0x36cfdf['TagIds'][_0x5b0f('0x36')](',')[_0x5b0f('0x37')](function(_0x4ace48){_0x36cfdf[_0x5b0f('0x35')][_0x5b0f('0x38')](_0x599eb4[_0x4ace48]);});}delete _0x36cfdf[_0x5b0f('0x34')];}catch(_0x2adb07){_0x1a117f(_0x2adb07);}_0x5ece36(_0x36cfdf);});}function updateOpenchannelInteraction(_0x3e6c5d,_0x4f02ba,_0x583cdd){return new BPromise(function(_0x5ea0d1,_0xf04472){return getInteractionUsers(_0x3e6c5d,_0x583cdd)[_0x5b0f('0x2d')](function(_0x4b2225){return getInteractionTags(_0x4b2225,_0x4f02ba);})[_0x5b0f('0x2d')](function(_0x242021){return getStateInteraction(_0x242021);})[_0x5b0f('0x2d')](function(_0x569958){_0x5ea0d1(_0x569958);})[_0x5b0f('0x39')](function(_0x3cdf63){_0xf04472(_0x3cdf63);});});}function getStateInteraction(_0x3aab0a){return new BPromise(function(_0x567097){_0x3aab0a['waiting']=0x0;_0x3aab0a[_0x5b0f('0x3a')]=0x0;_0x3aab0a['answered']=0x0;_0x3aab0a[_0x5b0f('0x3b')]=0x0;_0x3aab0a['total']=0x0;if(!_0x3aab0a[_0x5b0f('0x3c')]&&!_0x3aab0a[_0x5b0f('0x3d')]){_0x3aab0a[_0x5b0f('0x3e')]+=0x1;}if(!_0x3aab0a[_0x5b0f('0x3c')]&&_0x3aab0a[_0x5b0f('0x3d')]){_0x3aab0a[_0x5b0f('0x3a')]+=0x1;if(_0x3aab0a[_0x5b0f('0x3e')]){_0x3aab0a[_0x5b0f('0x3e')]-=0x1;}}if(_0x3aab0a['closed']&&_0x3aab0a[_0x5b0f('0x3d')]){_0x3aab0a[_0x5b0f('0x3f')]+=0x1;if(_0x3aab0a['talking']){_0x3aab0a[_0x5b0f('0x3a')]-=0x1;}}if(_0x3aab0a[_0x5b0f('0x3c')]&&!_0x3aab0a[_0x5b0f('0x3d')]){_0x3aab0a[_0x5b0f('0x3b')]+=0x1;if(_0x3aab0a[_0x5b0f('0x3e')]){_0x3aab0a[_0x5b0f('0x3e')]-=0x1;}}_0x3aab0a[_0x5b0f('0x40')]+=0x1;_0x567097(_0x3aab0a);});}exports[_0x5b0f('0x41')]=function(_0xdda86e,_0x2b76f9){var _0x32bb13={},_0x4f4b33={},_0x32d7b0={'count':0x0,'rows':[]};var _0x20e6ff=_['map'](db[_0x5b0f('0x42')]['rawAttributes'],function(_0x33f173){return{'name':_0x33f173[_0x5b0f('0x43')],'type':_0x33f173[_0x5b0f('0x44')]['key']};});_0x4f4b33[_0x5b0f('0x45')]=_[_0x5b0f('0x33')](_0x20e6ff,'name');_0x4f4b33['query']=_[_0x5b0f('0x46')](_0xdda86e['query']);_0x4f4b33[_0x5b0f('0x47')]=_['intersection'](_0x4f4b33['model'],_0x4f4b33['query']);_0x32bb13[_0x5b0f('0x48')]=_[_0x5b0f('0x49')](_0x4f4b33[_0x5b0f('0x45')],qs[_0x5b0f('0x4a')](_0xdda86e[_0x5b0f('0x4b')][_0x5b0f('0x4a')]));_0x32bb13[_0x5b0f('0x48')]=_0x32bb13[_0x5b0f('0x48')][_0x5b0f('0x4c')]?_0x32bb13['attributes']:_0x4f4b33[_0x5b0f('0x45')];if(!_0xdda86e[_0x5b0f('0x4b')]['hasOwnProperty']('nolimit')){_0x32bb13[_0x5b0f('0x24')]=qs[_0x5b0f('0x24')](_0xdda86e[_0x5b0f('0x4b')][_0x5b0f('0x24')]);_0x32bb13[_0x5b0f('0x4d')]=qs['offset'](_0xdda86e['query'][_0x5b0f('0x4d')]);}_0x32bb13[_0x5b0f('0x4e')]=qs['sort'](_0xdda86e['query']['sort']);_0x32bb13[_0x5b0f('0x4f')]=qs[_0x5b0f('0x47')](_[_0x5b0f('0x50')](_0xdda86e['query'],_0x4f4b33[_0x5b0f('0x47')]),_0x20e6ff);var _0x16b724=[];var _0x3aca11=squel[_0x5b0f('0x51')]()[_0x5b0f('0x52')]('id')[_0x5b0f('0x52')](_0x5b0f('0x30'))[_0x5b0f('0x52')]('color')[_0x5b0f('0x53')](_0x5b0f('0x54'));var _0x2bf2aa=squel[_0x5b0f('0x51')]()['field'](_0x5b0f('0x55'))[_0x5b0f('0x52')](_0x5b0f('0x56'))[_0x5b0f('0x52')](_0x5b0f('0x57'))[_0x5b0f('0x53')]('user_has_openchannel_interactions','ui')[_0x5b0f('0x58')](_0x5b0f('0x59'),'u',_0x5b0f('0x5a'));var _0x5f06c5=squel[_0x5b0f('0x51')]()['from'](_0x5b0f('0x5b'),'i')[_0x5b0f('0x58')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x5b0f('0x59'),'o',_0x5b0f('0x5c'))[_0x5b0f('0x58')](_0x5b0f('0x5d'),'a',_0x5b0f('0x5e'))[_0x5b0f('0x58')](_0x5b0f('0x5f'),'me',_0x5b0f('0x60'))[_0x5b0f('0x58')](_0x5b0f('0x61'),'it',_0x5b0f('0x62'))[_0x5b0f('0x58')]('tools_tags','t',_0x5b0f('0x63'));var _0x28be83=squel[_0x5b0f('0x64')]();var _0x106635=[];var _0x18893a=squel[_0x5b0f('0x64')]();var _0x5d4e7a;if(_0xdda86e[_0x5b0f('0x4b')][_0x5b0f('0x65')]){_0x5d4e7a=as[_0x5b0f('0x66')](_0xdda86e['query'][_0x5b0f('0x65')]);var _0x2c9100=_0x5d4e7a['sqlOperator'];for(var _0x4d8134=0x0;_0x4d8134<_0x5d4e7a[_0x5b0f('0x67')]['length'];_0x4d8134++){var _0x198849=_0x5d4e7a[_0x5b0f('0x67')][_0x4d8134];var _0x56a11c='i';var _0x4236a7=_[_0x5b0f('0x68')](_0x20e6ff,[_0x5b0f('0x30'),_0x198849[_0x5b0f('0x52')]]);if(!_0x4236a7){switch(_0x198849['field']){case _0x5b0f('0x69'):if(_0x198849[_0x5b0f('0x6a')]==0x1){_0x5f06c5['having']('`'+_0x198849[_0x5b0f('0x52')]+_0x5b0f('0x6b'));}else{_0x5f06c5[_0x5b0f('0x6c')]('`'+_0x198849[_0x5b0f('0x52')]+_0x5b0f('0x6d'));}break;case _0x5b0f('0x6e'):if(_0x198849[_0x5b0f('0x6f')]===_0x5b0f('0x70')){if(_0x198849[_0x5b0f('0x6a')][_0x5b0f('0x36')]('\x20')['length']>0x1){_0x28be83[_0x2c9100](_0x5b0f('0x71'),qs['getFullTextValue'](_0x198849[_0x5b0f('0x6a')]),null);}else{var _0xaa8290='%'+_0x198849['value']+'%';_0x28be83[_0x2c9100](_0x5b0f('0x72'),_0xaa8290,_0xaa8290,_0xaa8290);}}else{_0x4236a7=_['find'](_0x20e6ff,[_0x5b0f('0x30'),_0x5b0f('0x73')]);_0x198849[_0x5b0f('0x52')]=_0x5b0f('0x73');_0xbd7b18=as['buildExpression'](_0x56a11c,_0x4236a7[_0x5b0f('0x44')],_0x198849);_0x28be83[_0x2c9100](_0xbd7b18['text'],_0xbd7b18[_0x5b0f('0x6a')][_0x5b0f('0x74')],_0xbd7b18[_0x5b0f('0x6a')][_0x5b0f('0x2e')]);}break;case _0x5b0f('0x75'):var _0x48b6c6=_0x198849[_0x5b0f('0x6a')][_0x5b0f('0x36')](',')[_0x5b0f('0x33')](function(_0xde23ed){return Number(_0xde23ed);});_0x48b6c6[_0x5b0f('0x37')](function(_0x3a3014){_0x18893a['or'](_0x5b0f('0x76'),'%,'+_0x3a3014+',%');});_0x106635=_[_0x5b0f('0x77')](_0x106635,_0x48b6c6);break;case'User':if(_0x198849[_0x5b0f('0x6f')]==='$substring'){_0x28be83[_0x2c9100]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x198849[_0x5b0f('0x6a')]+'%',null);}else{_0x4236a7=_[_0x5b0f('0x68')](_0x20e6ff,[_0x5b0f('0x30'),'UserId']);_0x198849['field']='UserId';_0xbd7b18=as[_0x5b0f('0x78')](_0x56a11c,_0x4236a7['type'],_0x198849);_0x28be83[_0x2c9100](_0xbd7b18[_0x5b0f('0x79')],_0xbd7b18[_0x5b0f('0x6a')][_0x5b0f('0x74')],_0xbd7b18[_0x5b0f('0x6a')]['end']);}break;case _0x5b0f('0x7a'):_0xbd7b18=as[_0x5b0f('0x78')]('me',null,_0x198849);_0x28be83[_0x2c9100](_0xbd7b18[_0x5b0f('0x79')],_0xbd7b18[_0x5b0f('0x6a')]['start'],_0xbd7b18['value'][_0x5b0f('0x2e')]);break;}}else{var _0xbd7b18=as[_0x5b0f('0x78')](_0x56a11c,_0x4236a7['type'],_0x198849);_0x28be83[_0x2c9100](_0xbd7b18[_0x5b0f('0x79')],_0xbd7b18['value'][_0x5b0f('0x74')],_0xbd7b18[_0x5b0f('0x6a')]['end']);}}}else{var _0x9824cf=_(_0xdda86e[_0x5b0f('0x4b')])[_0x5b0f('0x46')]()[_0x5b0f('0x33')](function(_0x4ecd2e){return _[_0x5b0f('0x7b')](_0x20e6ff,[_0x5b0f('0x30'),_0x4ecd2e])?_0x4ecd2e:undefined;})[_0x5b0f('0x7c')]()[_0x5b0f('0x6a')]();if(!_[_0x5b0f('0x7d')](_0x9824cf)){_0x9824cf[_0x5b0f('0x37')](function(_0xc181cf){if(_0xc181cf===_0x5b0f('0x7e')){_0x5f06c5['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x5b0f('0x7f')](_0xdda86e['query'][_0xc181cf]));}else if(_0xc181cf==='createdAt'){var _0x4776b1=JSON[_0x5b0f('0x80')](_0xdda86e[_0x5b0f('0x4b')][_0xc181cf])['$gte'];var _0x3feb0b=JSON[_0x5b0f('0x80')](_0xdda86e[_0x5b0f('0x4b')][_0xc181cf])[_0x5b0f('0x81')];_0x5f06c5[_0x5b0f('0x4f')](_0x5b0f('0x82'),_0x4776b1,_0x3feb0b);}else{if(_0xdda86e[_0x5b0f('0x4b')][_0xc181cf]==='null'){_0x5f06c5['where']('i.'+_0xc181cf+_0x5b0f('0x83'));}else{_0x5f06c5[_0x5b0f('0x4f')]('i.'+_0xc181cf+_0x5b0f('0x84'),_0xdda86e['query'][_0xc181cf]);}}});}if(_0xdda86e[_0x5b0f('0x4b')][_0x5b0f('0x85')]){if(_0xdda86e['query']['read']==0x1){_0x5f06c5[_0x5b0f('0x6c')](_0x5b0f('0x86'));}else{_0x5f06c5[_0x5b0f('0x6c')](_0x5b0f('0x87'));}}if(_0xdda86e['query'][_0x5b0f('0x88')]){_0x106635=_[_0x5b0f('0x89')](_0xdda86e['query']['tag'])?_0xdda86e[_0x5b0f('0x4b')][_0x5b0f('0x88')]:new Array(_0xdda86e['query'][_0x5b0f('0x88')]);_0x106635[_0x5b0f('0x37')](function(_0x3288d0){_0x18893a['or'](_0x5b0f('0x76'),'%,'+_0x3288d0+',%');});}if(_0xdda86e[_0x5b0f('0x4b')][_0x5b0f('0x8a')]){var _0x37fdbd=_0xdda86e[_0x5b0f('0x4b')]['filter'][_0x5b0f('0x8b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x37fdbd)){_0x28be83['or'](_0x5b0f('0x8c'),_0x37fdbd+'%');}else{_0x28be83['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5b0f('0x8d')](_0x37fdbd))['or'](_0x5b0f('0x8e'),_0x37fdbd+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x37fdbd+'%');}}}_0x5f06c5[_0x5b0f('0x4f')](_0x28be83);_0x5f06c5[_0x5b0f('0x8f')](_0x5b0f('0x90'));var _0x20de13={'type':db[_0x5b0f('0x91')]['QueryTypes'][_0x5b0f('0x92')],'raw':!![]};var _0x431a0f=_0x5f06c5[_0x5b0f('0x93')]();_0x431a0f[_0x5b0f('0x52')](_0x5b0f('0x90'));_0x431a0f['field'](_0x5b0f('0x94'),_0x5b0f('0x69'));if(_0x32bb13[_0x5b0f('0x4e')]){_0x32bb13['order']['forEach'](function(_0x5df2e7){var _0x278cec=_0x5df2e7[0x0]===_0x5b0f('0x95')?_0x5df2e7[0x0]:'i.'+_0x5df2e7[0x0];_0x5f06c5[_0x5b0f('0x4e')](_0x278cec,_0x5df2e7[0x1]===_0x5b0f('0x96')?![]:!![]);});}if(!_[_0x5b0f('0x7d')](_0x106635)){_0x5f06c5[_0x5b0f('0x6c')](_0x18893a);_0x431a0f[_0x5b0f('0x4f')](_0x5b0f('0x97'),_0x106635);}BPromise[_0x5b0f('0x98')]()[_0x5b0f('0x2d')](function(){if(!_0x5d4e7a){if(_0xdda86e[_0x5b0f('0x4b')]['OpenchannelAccountId'])return;_0x431a0f[_0x5b0f('0x4f')](_0x5b0f('0x99'));_0x5f06c5['where'](_0x5b0f('0x99'));return;}if(_0xdda86e[_0x5b0f('0x9a')][_0x5b0f('0x9b')]!==_0x5b0f('0x9c'))return;return _0xdda86e['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x5b0f('0x2d')](function(_0x5386f4){if(_[_0x5b0f('0x7d')](_0x5386f4)){_0x431a0f[_0x5b0f('0x4f')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x5f06c5[_0x5b0f('0x4f')](_0x5b0f('0x9d'));}else{_0x431a0f[_0x5b0f('0x4f')](_0x5b0f('0x9e'),_[_0x5b0f('0x33')](_0x5386f4,'id'));_0x5f06c5[_0x5b0f('0x4f')](_0x5b0f('0x9e'),_[_0x5b0f('0x33')](_0x5386f4,'id'));}});})[_0x5b0f('0x2d')](function(){if(_0xdda86e[_0x5b0f('0x9a')][_0x5b0f('0x9b')]===_0x5b0f('0x9c')&&!_0x5d4e7a&&!_0xdda86e[_0x5b0f('0x4b')][_0x5b0f('0x7e')])return[];return db[_0x5b0f('0x9f')]['query'](_0x431a0f[_0x5b0f('0xa0')](),_0x20de13);})['then'](function(_0x339aa7){_0x32d7b0[_0x5b0f('0x26')]=_0x339aa7[_0x5b0f('0x4c')];if(_0x32d7b0[_0x5b0f('0x26')]===0x0)return[];return db[_0x5b0f('0x9f')]['query'](_0x3aca11[_0x5b0f('0xa0')](),_0x20de13)[_0x5b0f('0x2d')](function(_0x5c8c5d){_0x16b724=_['keyBy'](_0x5c8c5d,'id');_0x20de13=_[_0x5b0f('0xa1')](_0x20de13,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xdda86e[_0x5b0f('0x4b')]['fields']){_0x32bb13['attributes'][_0x5b0f('0x37')](function(_0x41bb02){_0x5f06c5[_0x5b0f('0x52')]('i.'+_0x41bb02);});}else{_0x5f06c5['field'](_0x5b0f('0x94'),_0x5b0f('0x69'));_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xa2'),_0x5b0f('0xa3'));_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xa4'),'Account.mandatoryDisposition');_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xa5'),_0x5b0f('0x95'));_0x5f06c5['field'](_0x5b0f('0xa6'));_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xa7'),_0x5b0f('0xa8'));_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xa9'),'Contact.lastName');_0x5f06c5['field'](_0x5b0f('0xaa'),_0x5b0f('0xab'));_0x5f06c5['field']('c.phone',_0x5b0f('0xac'));_0x5f06c5['field']('c.mobile',_0x5b0f('0xad'));_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xae'),_0x5b0f('0xaf'));_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xb0'),_0x5b0f('0xb1'));_0x5f06c5[_0x5b0f('0x52')](_0x5b0f('0xb2'),_0x5b0f('0xb3'));_0x5f06c5['field'](_0x5b0f('0xb4'),'TagIds');}if(_0x32bb13['limit'])_0x5f06c5[_0x5b0f('0x24')](_0x32bb13[_0x5b0f('0x24')]);if(_0x32bb13[_0x5b0f('0x4d')])_0x5f06c5[_0x5b0f('0x4d')](_0x32bb13[_0x5b0f('0x4d')]);return db[_0x5b0f('0x9f')]['query'](_0x5f06c5[_0x5b0f('0xa0')](),_0x20de13);})[_0x5b0f('0x2d')](function(_0x3fdc5a){if(_0x3fdc5a[_0x5b0f('0x4c')]>0x0)_0x2bf2aa[_0x5b0f('0x4f')](_0x5b0f('0xb5'),_[_0x5b0f('0x33')](_0x3fdc5a,'id'));return db[_0x5b0f('0x9f')]['query'](_0x2bf2aa[_0x5b0f('0xa0')](),_0x20de13)[_0x5b0f('0x2d')](function(_0x47350f){var _0x341090=_['groupBy'](_0x47350f,_0x5b0f('0xb6'));var _0x57a83c=[];_0x3fdc5a[_0x5b0f('0x37')](function(_0x7b9ec0){_0x57a83c[_0x5b0f('0x38')](updateOpenchannelInteraction(_0x7b9ec0,_0x16b724,_0x341090));});return BPromise[_0x5b0f('0xb7')](_0x57a83c);});});})[_0x5b0f('0x2d')](function(_0x5ccb48){_0x32d7b0['rows']=_0x5ccb48;return _0x32d7b0;})[_0x5b0f('0x2d')](respondWithFilteredResult(_0x2b76f9,_0x32bb13))[_0x5b0f('0x39')](handleError(_0x2b76f9,null));};exports[_0x5b0f('0xb8')]=function(_0x2594ca,_0xd54e6c){var _0x342b46={};if(_0x2594ca[_0x5b0f('0x4b')][_0x5b0f('0x44')]&&_0x2594ca[_0x5b0f('0x4b')][_0x5b0f('0x44')]==='from'){_0x342b46[_0x5b0f('0x53')]=_0x2594ca['params']['id'];}else{_0x342b46['id']=_0x2594ca[_0x5b0f('0xb9')]['id'];}var _0x2b5a39={'raw':![],'where':_0x342b46},_0x5db217={};_0x5db217[_0x5b0f('0x45')]=_[_0x5b0f('0x46')](db[_0x5b0f('0x42')][_0x5b0f('0xba')]);_0x5db217[_0x5b0f('0x4b')]=_['keys'](_0x2594ca[_0x5b0f('0x4b')]);_0x5db217['filters']=_[_0x5b0f('0x49')](_0x5db217['model'],_0x5db217[_0x5b0f('0x4b')]);_0x2b5a39[_0x5b0f('0x48')]=_[_0x5b0f('0x49')](_0x5db217[_0x5b0f('0x45')],qs['fields'](_0x2594ca['query'][_0x5b0f('0x4a')]));_0x2b5a39[_0x5b0f('0x48')]=_0x2b5a39[_0x5b0f('0x48')]['length']?_0x2b5a39[_0x5b0f('0x48')]:_0x5db217[_0x5b0f('0x45')];if(_0x2594ca['query'][_0x5b0f('0xbb')]){_0x2b5a39[_0x5b0f('0xbc')]=[{'all':!![]}];}_0x2b5a39=_[_0x5b0f('0xa1')]({},_0x2b5a39,_0x2594ca['options']);return db['OpenchannelInteraction'][_0x5b0f('0x68')](_0x2b5a39)[_0x5b0f('0x2d')](handleEntityNotFound(_0xd54e6c,null))['then'](respondWithResult(_0xd54e6c,null))['catch'](handleError(_0xd54e6c,null));};exports[_0x5b0f('0xbd')]=function(_0x358236,_0x546500){return db['OpenchannelInteraction'][_0x5b0f('0xbd')](_0x358236['body'],{})[_0x5b0f('0x2d')](respondWithResult(_0x546500,0xc9))[_0x5b0f('0x39')](handleError(_0x546500,null));};exports[_0x5b0f('0x2b')]=function(_0x493fb0,_0x4c3b99){if(_0x493fb0[_0x5b0f('0x7a')]['id']){delete _0x493fb0[_0x5b0f('0x7a')]['id'];}return db[_0x5b0f('0x42')][_0x5b0f('0x68')]({'where':{'id':_0x493fb0[_0x5b0f('0xb9')]['id']}})[_0x5b0f('0x2d')](handleEntityNotFound(_0x4c3b99,null))[_0x5b0f('0x2d')](saveUpdates(_0x493fb0['body'],null))[_0x5b0f('0x2d')](respondWithResult(_0x4c3b99,null))[_0x5b0f('0x39')](handleError(_0x4c3b99,null));};exports['destroy']=function(_0x142764,_0x4e6574){return db['OpenchannelInteraction'][_0x5b0f('0x68')]({'where':{'id':_0x142764['params']['id']}})[_0x5b0f('0x2d')](handleEntityNotFound(_0x4e6574,null))[_0x5b0f('0x2d')](removeEntity(_0x4e6574,null))[_0x5b0f('0x39')](handleError(_0x4e6574,null));};exports[_0x5b0f('0xbe')]=function(_0x3e10a8,_0x3090a3){return db['OpenchannelInteraction'][_0x5b0f('0xbe')]()[_0x5b0f('0x2d')](respondWithResult(_0x3090a3,null))[_0x5b0f('0x39')](handleError(_0x3090a3,null));};exports[_0x5b0f('0xbf')]=function(_0x5cf3d6,_0x31276f,_0x350448){return db[_0x5b0f('0xc0')][_0x5b0f('0x68')]({'where':{'id':_0x5cf3d6['params']['id']}})[_0x5b0f('0x2d')](handleEntityNotFound(_0x31276f,null))[_0x5b0f('0x2d')](function(_0x3930a3){if(_0x3930a3){return _0x3930a3['addMessage'](_0x5cf3d6[_0x5b0f('0x7a')][_0x5b0f('0xc1')],_['omit'](_0x5cf3d6[_0x5b0f('0x7a')],[_0x5b0f('0xc1'),'id'])||{});}})['then'](respondWithResult(_0x31276f,null))[_0x5b0f('0x39')](handleError(_0x31276f,null));};exports[_0x5b0f('0xc2')]=function(_0x4e6935,_0x5a1bb7,_0x14e320){var _0x1887f7={'raw':![],'where':{}};var _0x45d0ca={};var _0x40a492={'count':0x0,'rows':[]};return db[_0x5b0f('0x42')][_0x5b0f('0xc3')]({'where':{'id':_0x4e6935[_0x5b0f('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5a1bb7,null))[_0x5b0f('0x2d')](function(_0x1fb454){if(_0x1fb454){_0x45d0ca[_0x5b0f('0x45')]=_[_0x5b0f('0x46')](db[_0x5b0f('0xc0')][_0x5b0f('0xba')]);_0x45d0ca['query']=_[_0x5b0f('0x46')](_0x4e6935[_0x5b0f('0x4b')]);_0x45d0ca[_0x5b0f('0x47')]=_[_0x5b0f('0x49')](_0x45d0ca[_0x5b0f('0x45')],_0x45d0ca[_0x5b0f('0x4b')]);_0x1887f7[_0x5b0f('0x48')]=_[_0x5b0f('0x49')](_0x45d0ca['model'],qs[_0x5b0f('0x4a')](_0x4e6935[_0x5b0f('0x4b')][_0x5b0f('0x4a')]));_0x1887f7[_0x5b0f('0x48')]=_0x1887f7[_0x5b0f('0x48')]['length']?_0x1887f7['attributes']:_0x45d0ca[_0x5b0f('0x45')];if(!_0x4e6935[_0x5b0f('0x4b')][_0x5b0f('0xc4')]('nolimit')){_0x1887f7[_0x5b0f('0x24')]=qs[_0x5b0f('0x24')](_0x4e6935[_0x5b0f('0x4b')][_0x5b0f('0x24')]);_0x1887f7['offset']=qs['offset'](_0x4e6935['query'][_0x5b0f('0x4d')]);}_0x1887f7[_0x5b0f('0x4e')]=qs[_0x5b0f('0xc5')](_0x4e6935[_0x5b0f('0x4b')][_0x5b0f('0xc5')]);_0x1887f7[_0x5b0f('0x4f')]=qs[_0x5b0f('0x47')](_[_0x5b0f('0x50')](_0x4e6935['query'],_0x45d0ca[_0x5b0f('0x47')]));_0x1887f7[_0x5b0f('0x4f')][_0x5b0f('0xb6')]=_0x1fb454['id'];if(_0x4e6935[_0x5b0f('0x4b')][_0x5b0f('0x8a')]){_0x1887f7[_0x5b0f('0x4f')]=_['merge'](_0x1887f7['where'],{'$or':_[_0x5b0f('0x33')](_0x1887f7[_0x5b0f('0x48')],function(_0x2d5628){var _0x250853={};_0x250853[_0x2d5628]={'$like':'%'+_0x4e6935[_0x5b0f('0x4b')]['filter']+'%'};return _0x250853;})});}if(_0x4e6935[_0x5b0f('0x4b')]['$gte']){var _0x1e016c=_0x4e6935[_0x5b0f('0x4b')][_0x5b0f('0xc6')][_0x5b0f('0x36')](',');var _0x589c6f={};_0x589c6f[_0x1e016c[0x0]]={'$gte':moment(_0x1e016c[0x1])['format'](_0x5b0f('0xc7'))};_0x1887f7[_0x5b0f('0x4f')]=_[_0x5b0f('0xa1')](_0x1887f7['where'],_0x589c6f);}_0x1887f7=_[_0x5b0f('0xa1')]({},_0x1887f7,_0x4e6935['options']);return db[_0x5b0f('0xc0')][_0x5b0f('0x26')]({'where':_0x1887f7[_0x5b0f('0x4f')]})['then'](function(_0x39b776){_0x40a492[_0x5b0f('0x26')]=_0x39b776;if(_0x4e6935[_0x5b0f('0x4b')][_0x5b0f('0xbb')]){_0x1887f7[_0x5b0f('0xbc')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x5b0f('0xc8')](_0x1887f7);})[_0x5b0f('0x2d')](function(_0x54c09d){_0x40a492['rows']=_0x54c09d;return _0x40a492;});}})[_0x5b0f('0x2d')](respondWithFilteredResult(_0x5a1bb7,_0x1887f7))[_0x5b0f('0x39')](handleError(_0x5a1bb7,null));};exports[_0x5b0f('0xc9')]=function(_0x21f57b,_0x160f1d,_0x58a69e){return db[_0x5b0f('0x42')]['find']({'where':{'id':_0x21f57b[_0x5b0f('0xb9')]['id']}})[_0x5b0f('0x2d')](handleEntityNotFound(_0x160f1d,null))[_0x5b0f('0x2d')](function(_0x189e5f){if(_0x189e5f){return _0x189e5f[_0x5b0f('0xca')](_0x21f57b['body'][_0x5b0f('0xc1')],_[_0x5b0f('0xcb')](_0x21f57b['body'],['ids','id'])||{})[_0x5b0f('0xcc')](function(){return db[_0x5b0f('0x75')]['findAll']({'attributes':['id',_0x5b0f('0x30'),_0x5b0f('0xcd')],'where':{'id':_0x21f57b['body'][_0x5b0f('0xc1')]}});})[_0x5b0f('0x2d')](function(_0x5a07e4){socket[_0x5b0f('0xce')](_0x5b0f('0xcf'),{'id':Number(_0x21f57b[_0x5b0f('0xb9')]['id']),'tags':_0x5a07e4||[]});return{'id':Number(_0x21f57b[_0x5b0f('0xb9')]['id']),'tags':_0x5a07e4||[]};});}})[_0x5b0f('0x2d')](respondWithResult(_0x160f1d,null))[_0x5b0f('0x39')](handleError(_0x160f1d,null));};exports[_0x5b0f('0xd0')]=function(_0x79687f,_0x284f8a,_0x3fd0fa){return db[_0x5b0f('0x42')]['find']({'where':{'id':_0x79687f[_0x5b0f('0xb9')]['id']}})['then'](handleEntityNotFound(_0x284f8a,null))['then'](function(_0x2b8853){if(_0x2b8853){return _0x2b8853['removeTags'](_0x79687f[_0x5b0f('0x4b')]['ids']);}})[_0x5b0f('0x2d')](respondWithStatusCode(_0x284f8a,null))[_0x5b0f('0x39')](handleError(_0x284f8a,null));};exports[_0x5b0f('0xd1')]=function(_0x1f19b0,_0xe88201){var _0x4bf4ba=moment()[_0x5b0f('0xd2')]()['toString']();var _0x141ad0=path[_0x5b0f('0xd3')](config[_0x5b0f('0xd4')],_0x5b0f('0xd5'),_0x5b0f('0xd6'),_0x5b0f('0xd7'));var _0x4435ff=path[_0x5b0f('0xd3')](config['root'],_0x5b0f('0xd5'),'files',_0x5b0f('0xd8'));var _0x2905f7=path['join'](_0x141ad0,_0x4bf4ba);var _0x31bd18=util[_0x5b0f('0xd9')](_0x5b0f('0xda'),_0x1f19b0['params']['id'],_0x4bf4ba);var _0x574625=path[_0x5b0f('0xd3')](_0x141ad0,_0x31bd18);var _0x5d5cd1=[];_0x5d5cd1['push']({'model':db[_0x5b0f('0xdb')],'as':_0x5b0f('0xdb'),'attributes':['id',_0x5b0f('0xdc')],'raw':!![]});_0x5d5cd1['push']({'model':db[_0x5b0f('0xdd')],'as':'Contact','attributes':['id',_0x5b0f('0xde'),_0x5b0f('0xdf')],'raw':!![]});if(_0x1f19b0[_0x5b0f('0x4b')]['attachments']){_0x5d5cd1[_0x5b0f('0x38')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x17c92c=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x5b0f('0x7a'),_0x5b0f('0xe0'),_0x5b0f('0xe1'),_0x5b0f('0xe2'),'read'],'include':_0x5d5cd1}];_0x17c92c[_0x5b0f('0x38')]({'model':db[_0x5b0f('0xe3')],'as':_0x5b0f('0xe4'),'attributes':['id',_0x5b0f('0x30')]});_0x17c92c[_0x5b0f('0x38')]({'model':db['User'],'as':'Owner','attributes':['id',_0x5b0f('0xdc')]});return db[_0x5b0f('0x42')]['find']({'where':{'id':_0x1f19b0[_0x5b0f('0xb9')]['id']},'include':_0x17c92c})[_0x5b0f('0x2d')](handleEntityNotFound(_0xe88201,null))[_0x5b0f('0x2d')](function(_0x4826f6){if(_0x4826f6){var _0x1291a2=_0x4826f6[_0x5b0f('0xe5')]({'plain':!![]});fs[_0x5b0f('0xe6')](_0x2905f7);var _0xcf8da5={'channel':_0x5b0f('0xe7'),'account':_0x1291a2[_0x5b0f('0xe4')][_0x5b0f('0x30')],'agent':_0x1291a2[_0x5b0f('0xe8')]?_0x1291a2[_0x5b0f('0xe8')][_0x5b0f('0xdc')]:'N.A.','createdAt':moment(_0x1291a2[_0x5b0f('0xe0')])[_0x5b0f('0xd9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5b0f('0xa0')](),'closedAt':_0x1291a2[_0x5b0f('0x3c')]?moment(_0x1291a2['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x5b0f('0xa0')]():'','disposition':_0x1291a2[_0x5b0f('0xe9')],'visibility':_0x1291a2[_0x5b0f('0xea')]?_0x5b0f('0xeb'):'Private','messages':_(_0x1291a2[_0x5b0f('0xec')])[_0x5b0f('0x8a')]({'secret':![]})[_0x5b0f('0x33')](function(_0x498ecf){if(_0x498ecf[_0x5b0f('0xed')]){var _0x4bcbdd=path['join'](_0x4435ff,_0x498ecf[_0x5b0f('0xed')][_0x5b0f('0xee')]);if(fs['existsSync'](_0x4bcbdd)){fs['createReadStream'](_0x4bcbdd)['pipe'](fs[_0x5b0f('0xef')](path['join'](_0x2905f7,_0x498ecf[_0x5b0f('0xed')][_0x5b0f('0xee')])));}}return{'date':moment(_0x498ecf[_0x5b0f('0xe0')])[_0x5b0f('0xd9')](_0x5b0f('0xc7'))[_0x5b0f('0xa0')](),'sender':_0x498ecf[_0x5b0f('0xe1')]===_0x5b0f('0xf0')?_0x498ecf['User']?_0x498ecf[_0x5b0f('0xdb')][_0x5b0f('0xdc')]:_0x5b0f('0xf1'):_0x498ecf[_0x5b0f('0x6e')]['firstName']+(_0x498ecf[_0x5b0f('0x6e')][_0x5b0f('0xdf')]?'\x20'+_0x498ecf[_0x5b0f('0x6e')][_0x5b0f('0xdf')]:''),'body':_0x498ecf[_0x5b0f('0xed')]?_0x498ecf[_0x5b0f('0xed')][_0x5b0f('0xee')]:_0x498ecf[_0x5b0f('0x7a')],'direction':_0x498ecf['direction']===_0x5b0f('0xf0')?'A':'C','secret':_0x498ecf['secret'],'read':_0x498ecf[_0x5b0f('0x85')],'attachment':_0x498ecf[_0x5b0f('0xed')]};})[_0x5b0f('0x6a')]()};return ejs['renderFile'](path[_0x5b0f('0xd3')](config[_0x5b0f('0xd4')],_0x5b0f('0xd5'),_0x5b0f('0xf2'),_0x5b0f('0xf3')),{'interaction':_0xcf8da5})['then'](function(_0x4f18a4){var _0xeb7d1d=path['join'](_0x2905f7,_0x5b0f('0xf4')+_0x1291a2['id']+'-'+_0x4bf4ba+_0x5b0f('0xf5'));var _0xf2d391={'path':_0xeb7d1d,'channel':_0x5b0f('0xe7'),'interactionId':_0x1291a2['id']};return pdf[_0x5b0f('0xf6')](_0x4f18a4,_0xf2d391);})[_0x5b0f('0x2d')](function(){return new BPromise(function(_0xdf5227,_0x1f33fd){zipdir(_0x2905f7,{'saveTo':_0x574625},function(_0x33ce24,_0x10eb40){if(_0x33ce24)return _0x1f33fd(_0x33ce24);return _0xdf5227(_0x10eb40);});})[_0x5b0f('0x2d')](function(){return new BPromise(function(_0x420c64,_0x3a0681){rimraf(_0x2905f7,function(_0x5324f9){if(_0x5324f9)_0x3a0681(_0x5324f9);return _0x420c64();});});})[_0x5b0f('0x2d')](function(){return _0xe88201['download'](_0x574625,_0x31bd18,function(_0x72ff94){if(_0x72ff94){console[_0x5b0f('0xf7')](_0x5b0f('0xf8'),_0x72ff94);}else{fs[_0x5b0f('0xf9')](_0x574625);}});});});}else{return _0xe88201[_0x5b0f('0x21')](0xc8);}})['catch'](handleError(_0xe88201,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index fb6e116..ec51d30 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 _0x6ff1=['map','findAll','setDataValue','length','emit','catch','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','Users'];(function(_0x34190e,_0x50ecc7){var _0x41a4e6=function(_0x4a9ad9){while(--_0x4a9ad9){_0x34190e['push'](_0x34190e['shift']());}};_0x41a4e6(++_0x50ecc7);}(_0x6ff1,0x197));var _0x16ff=function(_0x61ca47,_0x40e9f0){_0x61ca47=_0x61ca47-0x0;var _0x50fedb=_0x6ff1[_0x61ca47];return _0x50fedb;};'use strict';var EventEmitter=require(_0x16ff('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x16ff('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x16ff('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x16ff('0x3')](0x0);var events={'afterCreate':_0x16ff('0x4'),'afterUpdate':_0x16ff('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4eb199){return function(_0x2ac1c4,_0x5f1b83,_0x109cb9){_0x2ac1c4[_0x16ff('0x6')]({'attributes':['id'],'raw':!![]})[_0x16ff('0x7')](function(_0xbf228c){_0x2ac1c4['setDataValue'](_0x16ff('0x8'),_0xbf228c[_0x16ff('0x9')](function(_0x4b1a7c){return{'id':_0x4b1a7c['id']};}));return OpenchannelMessage[_0x16ff('0xa')]({'where':{'OpenchannelInteractionId':_0x2ac1c4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xc3718b){_0x2ac1c4[_0x16ff('0xb')]('unreadMessages',_0xc3718b[_0x16ff('0xc')]);OpenchannelInteractionEvents[_0x16ff('0xd')](_0x4eb199+':'+_0x2ac1c4['id'],_0x2ac1c4);OpenchannelInteractionEvents['emit'](_0x4eb199,_0x2ac1c4);_0x109cb9(null);})[_0x16ff('0xe')](_0x109cb9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x16ff('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xf5a7=['OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1a427a,_0x2b0287){var _0x2a5d47=function(_0xdd02a2){while(--_0xdd02a2){_0x1a427a['push'](_0x1a427a['shift']());}};_0x2a5d47(++_0x2b0287);}(_0xf5a7,0x163));var _0x7f5a=function(_0x54917f,_0x3dd1e8){_0x54917f=_0x54917f-0x0;var _0x3e1925=_0xf5a7[_0x54917f];return _0x3e1925;};'use strict';var EventEmitter=require(_0x7f5a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x7f5a('0x1'))['db'][_0x7f5a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7f5a('0x3')](0x0);var events={'afterCreate':_0x7f5a('0x4'),'afterUpdate':_0x7f5a('0x5'),'afterDestroy':'remove'};function emitEvent(_0xe54e7b){return function(_0x26b45f,_0x1cc2d0,_0xaabf76){_0x26b45f[_0x7f5a('0x6')]({'attributes':['id'],'raw':!![]})[_0x7f5a('0x7')](function(_0x2724fa){_0x26b45f[_0x7f5a('0x8')](_0x7f5a('0x9'),_0x2724fa['map'](function(_0x473dd2){return{'id':_0x473dd2['id']};}));return OpenchannelMessage[_0x7f5a('0xa')]({'where':{'OpenchannelInteractionId':_0x26b45f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x42f45c){_0x26b45f[_0x7f5a('0x8')](_0x7f5a('0xb'),_0x42f45c[_0x7f5a('0xc')]);OpenchannelInteractionEvents[_0x7f5a('0xd')](_0xe54e7b+':'+_0x26b45f['id'],_0x26b45f);OpenchannelInteractionEvents['emit'](_0xe54e7b,_0x26b45f);_0xaabf76(null);})[_0x7f5a('0xe')](_0xaabf76(null));};}for(var e in events){if(events[_0x7f5a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7f5a('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 5f27fef..dcc42a2 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 _0x57e8=['openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','util','bluebird','path','rimraf','../../config/environment','exports','OpenchannelInteraction'];(function(_0x57c662,_0x2c9ffe){var _0x216916=function(_0x357ee8){while(--_0x357ee8){_0x57c662['push'](_0x57c662['shift']());}};_0x216916(++_0x2c9ffe);}(_0x57e8,0x10a));var _0x857e=function(_0x5b8de4,_0x57b2a9){_0x5b8de4=_0x5b8de4-0x0;var _0x2ef767=_0x57e8[_0x5b8de4];return _0x2ef767;};'use strict';var _=require('lodash');var util=require(_0x857e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x857e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x857e('0x2'));var rimraf=require(_0x857e('0x3'));var config=require(_0x857e('0x4'));var attributes=require('./openchannelInteraction.attributes');module[_0x857e('0x5')]=function(_0xbba086,_0x35cf28){return _0xbba086['define'](_0x857e('0x6'),attributes,{'tableName':_0x857e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x857e('0x8'),'hooks':{'beforeUpdate':function(_0x2a03a7,_0x1809fe,_0x2986ca){if(_0x2a03a7[_0x857e('0x9')](_0x857e('0xa'))){_0x2a03a7[_0x857e('0xb')]=moment()[_0x857e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2986ca(null,_0x2a03a7);}}});}; \ No newline at end of file +var _0x339d=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x4cca2b,_0x1545fb){var _0x2f752d=function(_0xd9f538){while(--_0xd9f538){_0x4cca2b['push'](_0x4cca2b['shift']());}};_0x2f752d(++_0x1545fb);}(_0x339d,0x14c));var _0xd339=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0x339d[_0xce6f11];return _0x35b709;};'use strict';var _=require('lodash');var util=require(_0xd339('0x0'));var logger=require(_0xd339('0x1'))(_0xd339('0x2'));var moment=require(_0xd339('0x3'));var BPromise=require('bluebird');var rp=require(_0xd339('0x4'));var fs=require('fs');var path=require(_0xd339('0x5'));var rimraf=require(_0xd339('0x6'));var config=require(_0xd339('0x7'));var attributes=require(_0xd339('0x8'));module[_0xd339('0x9')]=function(_0x8de76,_0x38a80e){return _0x8de76[_0xd339('0xa')](_0xd339('0xb'),attributes,{'tableName':_0xd339('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd339('0xd'),'collate':_0xd339('0xe'),'hooks':{'beforeUpdate':function(_0x133697,_0x4c6a08,_0x286cd3){if(_0x133697[_0xd339('0xf')](_0xd339('0x10'))){_0x133697['closedAt']=moment()[_0xd339('0x11')](_0xd339('0x12'));}_0x286cd3(null,_0x133697);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e1c1ea7..4adbfab 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 _0x63e6=['AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','where','limit','UpdateOpenchannelInteraction'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x63e6,0x1a1));var _0x663e=function(_0x194b25,_0x4bedc4){_0x194b25=_0x194b25-0x0;var _0x107ac5=_0x63e6[_0x194b25];return _0x107ac5;};'use strict';var _=require(_0x663e('0x0'));var util=require(_0x663e('0x1'));var moment=require(_0x663e('0x2'));var BPromise=require(_0x663e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x663e('0x4'))['db'];var utils=require(_0x663e('0x5'));var logger=require(_0x663e('0x6'))(_0x663e('0x7'));var config=require(_0x663e('0x8'));var jayson=require(_0x663e('0x9'));var client=jayson[_0x663e('0xa')][_0x663e('0xb')]({'port':0x232a});config['redis']=_[_0x663e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x663e('0xd'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x167aea,_0x2be452,_0x307e04){return new BPromise(function(_0x377f90,_0xe0a369){return client[_0x663e('0xe')](_0x167aea,_0x307e04)[_0x663e('0xf')](function(_0x442a95){logger[_0x663e('0x10')](_0x663e('0x11'),_0x2be452,_0x663e('0x12'));logger[_0x663e('0x13')](_0x663e('0x14'),_0x2be452,_0x663e('0x12'),JSON[_0x663e('0x15')](_0x442a95));if(_0x442a95[_0x663e('0x16')]){if(_0x442a95['error'][_0x663e('0x17')]===0x1f4){logger[_0x663e('0x16')](_0x663e('0x11'),_0x2be452,_0x442a95[_0x663e('0x16')][_0x663e('0x18')]);return _0xe0a369(_0x442a95[_0x663e('0x16')][_0x663e('0x18')]);}logger[_0x663e('0x16')](_0x663e('0x11'),_0x2be452,_0x442a95[_0x663e('0x16')][_0x663e('0x18')]);return _0x377f90(_0x442a95[_0x663e('0x16')][_0x663e('0x18')]);}else{logger[_0x663e('0x10')](_0x663e('0x11'),_0x2be452,_0x663e('0x12'));_0x377f90(_0x442a95[_0x663e('0x19')][_0x663e('0x18')]);}})[_0x663e('0x1a')](function(_0x2efdf8){logger[_0x663e('0x16')](_0x663e('0x11'),_0x2be452,_0x2efdf8);_0xe0a369(_0x2efdf8);});});}exports['UpdateOpenchannelInteraction']=function(_0x594b7c){var _0x2e5113=this;return new Promise(function(_0x36b5e4,_0x3e043d){return db[_0x663e('0x1b')][_0x663e('0x1c')](_0x594b7c[_0x663e('0x1d')],{'raw':_0x594b7c[_0x663e('0x1e')]?_0x594b7c[_0x663e('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594b7c[_0x663e('0x1e')]?_0x594b7c[_0x663e('0x1e')][_0x663e('0x1f')]||null:null,'attributes':_0x594b7c[_0x663e('0x1e')]?_0x594b7c[_0x663e('0x1e')]['attributes']||null:null,'limit':_0x594b7c['options']?_0x594b7c['options'][_0x663e('0x20')]||null:null})[_0x663e('0xf')](function(_0x25ad66){logger[_0x663e('0x10')](_0x663e('0x21'),_0x594b7c);logger['debug'](_0x663e('0x21'),_0x594b7c,JSON[_0x663e('0x15')](_0x25ad66));_0x36b5e4(_0x25ad66);})[_0x663e('0x1a')](function(_0x644ccc){logger[_0x663e('0x16')](_0x663e('0x21'),_0x644ccc[_0x663e('0x18')],_0x594b7c);_0x3e043d(_0x2e5113[_0x663e('0x16')](0x1f4,_0x644ccc[_0x663e('0x18')]));});});};exports[_0x663e('0x22')]=function(_0x357deb){return new Promise(function(_0x4fad97,_0x541c84){return db['OpenchannelInteraction'][_0x663e('0x23')]({'where':_0x357deb['options']?_0x357deb['options'][_0x663e('0x1f')]||null:null})['then'](function(_0xa902fa){if(_0xa902fa){return _0xa902fa[_0x663e('0x24')](_0x357deb[_0x663e('0x1d')][_0x663e('0x25')],_[_0x663e('0x26')](_0x357deb[_0x663e('0x1d')],[_0x663e('0x25'),'id'])||{});}})[_0x663e('0x27')](function(_0x5d3ecb){logger[_0x663e('0x10')]('AddTags',_0x357deb);logger['debug'](_0x663e('0x28'),_0x357deb,JSON['stringify'](_0x5d3ecb));_0x4fad97(_0x5d3ecb);})[_0x663e('0x1a')](function(_0x207875){logger[_0x663e('0x16')](_0x663e('0x28'),_0x207875[_0x663e('0x18')],_0x357deb);_0x541c84(_this['error'](0x1f4,_0x207875[_0x663e('0x18')]));});});}; \ No newline at end of file +var _0x2f9f=['../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','where','addTags','ids','AddTags','util','ioredis'];(function(_0x39901e,_0x4b9bd4){var _0x13c7a7=function(_0x5804dc){while(--_0x5804dc){_0x39901e['push'](_0x39901e['shift']());}};_0x13c7a7(++_0x4b9bd4);}(_0x2f9f,0xfa));var _0xf2f9=function(_0x310ad7,_0x1f8c6c){_0x310ad7=_0x310ad7-0x0;var _0x41a2c6=_0x2f9f[_0x310ad7];return _0x41a2c6;};'use strict';var _=require('lodash');var util=require(_0xf2f9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2f9('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf2f9('0x2'))(_0xf2f9('0x3'));var config=require(_0xf2f9('0x4'));var jayson=require(_0xf2f9('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xf2f9('0x6')](config[_0xf2f9('0x7')],{'host':_0xf2f9('0x8'),'port':0x18eb});var socket=require(_0xf2f9('0x9'))(new Redis(config[_0xf2f9('0x7')]));require(_0xf2f9('0xa'))[_0xf2f9('0xb')](socket);function respondWithRpcPromise(_0x472848,_0x8203ab,_0x144268){return new BPromise(function(_0xa19723,_0x342b5a){return client[_0xf2f9('0xc')](_0x472848,_0x144268)[_0xf2f9('0xd')](function(_0x716a2){logger[_0xf2f9('0xe')](_0xf2f9('0xf'),_0x8203ab,'request\x20sent');logger[_0xf2f9('0x10')](_0xf2f9('0x11'),_0x8203ab,_0xf2f9('0x12'),JSON[_0xf2f9('0x13')](_0x716a2));if(_0x716a2[_0xf2f9('0x14')]){if(_0x716a2['error']['code']===0x1f4){logger['error'](_0xf2f9('0xf'),_0x8203ab,_0x716a2['error'][_0xf2f9('0x15')]);return _0x342b5a(_0x716a2['error'][_0xf2f9('0x15')]);}logger[_0xf2f9('0x14')](_0xf2f9('0xf'),_0x8203ab,_0x716a2[_0xf2f9('0x14')][_0xf2f9('0x15')]);return _0xa19723(_0x716a2['error'][_0xf2f9('0x15')]);}else{logger[_0xf2f9('0xe')](_0xf2f9('0xf'),_0x8203ab,_0xf2f9('0x12'));_0xa19723(_0x716a2['result'][_0xf2f9('0x15')]);}})['catch'](function(_0x58f5e8){logger['error'](_0xf2f9('0xf'),_0x8203ab,_0x58f5e8);_0x342b5a(_0x58f5e8);});});}exports[_0xf2f9('0x16')]=function(_0x4c990c){var _0x1da596=this;return new Promise(function(_0x3b4bb9,_0x3baf63){return db[_0xf2f9('0x17')][_0xf2f9('0x18')](_0x4c990c[_0xf2f9('0x19')],{'raw':_0x4c990c[_0xf2f9('0x1a')]?_0x4c990c[_0xf2f9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c990c[_0xf2f9('0x1a')]?_0x4c990c[_0xf2f9('0x1a')]['where']||null:null,'attributes':_0x4c990c[_0xf2f9('0x1a')]?_0x4c990c[_0xf2f9('0x1a')][_0xf2f9('0x1b')]||null:null,'limit':_0x4c990c[_0xf2f9('0x1a')]?_0x4c990c['options'][_0xf2f9('0x1c')]||null:null})['then'](function(_0x4a61f8){logger[_0xf2f9('0xe')](_0xf2f9('0x16'),_0x4c990c);logger[_0xf2f9('0x10')](_0xf2f9('0x16'),_0x4c990c,JSON[_0xf2f9('0x13')](_0x4a61f8));_0x3b4bb9(_0x4a61f8);})[_0xf2f9('0x1d')](function(_0x1c98e6){logger[_0xf2f9('0x14')](_0xf2f9('0x16'),_0x1c98e6[_0xf2f9('0x15')],_0x4c990c);_0x3baf63(_0x1da596[_0xf2f9('0x14')](0x1f4,_0x1c98e6['message']));});});};exports[_0xf2f9('0x1e')]=function(_0x7fcebd){return new Promise(function(_0x1d509e,_0x5cab97){return db[_0xf2f9('0x17')][_0xf2f9('0x1f')]({'where':_0x7fcebd['options']?_0x7fcebd[_0xf2f9('0x1a')][_0xf2f9('0x20')]||null:null})[_0xf2f9('0xd')](function(_0x38160e){if(_0x38160e){return _0x38160e[_0xf2f9('0x21')](_0x7fcebd[_0xf2f9('0x19')][_0xf2f9('0x22')],_['omit'](_0x7fcebd[_0xf2f9('0x19')],[_0xf2f9('0x22'),'id'])||{});}})['spread'](function(_0x94d03a){logger[_0xf2f9('0xe')](_0xf2f9('0x23'),_0x7fcebd);logger[_0xf2f9('0x10')](_0xf2f9('0x23'),_0x7fcebd,JSON[_0xf2f9('0x13')](_0x94d03a));_0x1d509e(_0x94d03a);})[_0xf2f9('0x1d')](function(_0x3e385c){logger[_0xf2f9('0x14')]('AddTags',_0x3e385c[_0xf2f9('0x15')],_0x7fcebd);_0x5cab97(_this[_0xf2f9('0x14')](0x1f4,_0x3e385c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 7dd7c8f..d29e246 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 _0x2726=['openchannelInteraction:','remove','update','emit','removeListener','register','length'];(function(_0x38eb2a,_0x35a243){var _0x2e9a6e=function(_0x6d744e){while(--_0x6d744e){_0x38eb2a['push'](_0x38eb2a['shift']());}};_0x2e9a6e(++_0x35a243);}(_0x2726,0x189));var _0x6272=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2726[_0x2f3848];return _0x102668;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x6272('0x0'),_0x6272('0x1')];function createListener(_0x527dcc,_0x264d05){return function(_0x4be76a){_0x264d05[_0x6272('0x2')](_0x527dcc,_0x4be76a);};}function removeListener(_0x266bef,_0x27d263){return function(){OpenchannelInteractionEvents[_0x6272('0x3')](_0x266bef,_0x27d263);};}exports[_0x6272('0x4')]=function(_0x4419a6){for(var _0x5568e1=0x0,_0x5047a6=events[_0x6272('0x5')];_0x5568e1<_0x5047a6;_0x5568e1++){var _0x1fd920=events[_0x5568e1];var _0x3ad1cb=createListener(_0x6272('0x6')+_0x1fd920,_0x4419a6);OpenchannelInteractionEvents['on'](_0x1fd920,_0x3ad1cb);}}; \ No newline at end of file +var _0x2ad5=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x5980aa,_0x5dd3ed){var _0x2209c8=function(_0x13c819){while(--_0x13c819){_0x5980aa['push'](_0x5980aa['shift']());}};_0x2209c8(++_0x5dd3ed);}(_0x2ad5,0x17a));var _0x52ad=function(_0x32dc49,_0x4bf4cf){_0x32dc49=_0x32dc49-0x0;var _0x15a4ce=_0x2ad5[_0x32dc49];return _0x15a4ce;};'use strict';var OpenchannelInteractionEvents=require(_0x52ad('0x0'));var events=[_0x52ad('0x1'),_0x52ad('0x2'),_0x52ad('0x3')];function createListener(_0x59f508,_0x3300d0){return function(_0x35af39){_0x3300d0[_0x52ad('0x4')](_0x59f508,_0x35af39);};}function removeListener(_0x46c2ee,_0xb697c6){return function(){OpenchannelInteractionEvents[_0x52ad('0x5')](_0x46c2ee,_0xb697c6);};}exports[_0x52ad('0x6')]=function(_0xa966e6){for(var _0x518e78=0x0,_0xa5be37=events[_0x52ad('0x7')];_0x518e78<_0xa5be37;_0x518e78++){var _0x710479=events[_0x518e78];var _0x5c99f8=createListener(_0x52ad('0x8')+_0x710479,_0xa966e6);OpenchannelInteractionEvents['on'](_0x710479,_0x5c99f8);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 30394b5..4cfc40e 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x1cff50,_0x31eae0){var _0x40149c=function(_0x5bd624){while(--_0x5bd624){_0x1cff50['push'](_0x1cff50['shift']());}};_0x40149c(++_0x31eae0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0xc7648a,_0x1ec3be){var _0x245784=function(_0x23eacd){while(--_0x23eacd){_0xc7648a['push'](_0xc7648a['shift']());}};_0x245784(++_0x1ec3be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 041baf5..672cd41 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 _0x9a2d=['out','DATE','STRING','TEXT','BOOLEAN','ENUM'];(function(_0x5752f8,_0x4c9fc9){var _0x42259d=function(_0xc2240a){while(--_0xc2240a){_0x5752f8['push'](_0x5752f8['shift']());}};_0x42259d(++_0x4c9fc9);}(_0x9a2d,0x123));var _0xd9a2=function(_0x167805,_0x11f6f2){_0x167805=_0x167805-0x0;var _0x351497=_0x9a2d[_0x167805];return _0x351497;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd9a2('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd9a2('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd9a2('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9a2('0x2')]('in',_0xd9a2('0x3')),'defaultValue':_0xd9a2('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9a2('0x4')]},'providerName':{'type':Sequelize[_0xd9a2('0x5')]},'providerResponse':{'type':Sequelize[_0xd9a2('0x0')]}}; \ No newline at end of file +var _0x36ee=['ENUM','out','DATE','STRING','TEXT','BOOLEAN'];(function(_0x5c3f7c,_0x35db9f){var _0x410420=function(_0x290b71){while(--_0x290b71){_0x5c3f7c['push'](_0x5c3f7c['shift']());}};_0x410420(++_0x35db9f);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe36e('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe36e('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe36e('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe36e('0x2')]('in',_0xe36e('0x3')),'defaultValue':_0xe36e('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe36e('0x4')]},'providerName':{'type':Sequelize[_0xe36e('0x5')]},'providerResponse':{'type':Sequelize[_0xe36e('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 86cc49f..ad483df 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 _0xb501=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','create','body','find','destroy','describe','openchannel-interactions','accept','read','readAt','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','internal','rejectmessage','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','name','send','map','OpenchannelMessage'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb501,0x1ce));var _0x1b50=function(_0x28f5c0,_0x24925f){_0x28f5c0=_0x28f5c0-0x0;var _0x3d05a1=_0xb501[_0x28f5c0];return _0x3d05a1;};'use strict';var emlformat=require(_0x1b50('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b50('0x1'));var jsonpatch=require(_0x1b50('0x2'));var rp=require('request-promise');var moment=require(_0x1b50('0x3'));var BPromise=require(_0x1b50('0x4'));var Mustache=require(_0x1b50('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1b50('0x6'));var csv=require(_0x1b50('0x7'));var ejs=require(_0x1b50('0x8'));var fs=require('fs');var fs_extra=require(_0x1b50('0x9'));var _=require('lodash');var squel=require(_0x1b50('0xa'));var crypto=require(_0x1b50('0xb'));var jsforce=require(_0x1b50('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1b50('0x7'));var querystring=require(_0x1b50('0xd'));var Papa=require(_0x1b50('0xe'));var Redis=require(_0x1b50('0xf'));var authService=require(_0x1b50('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1b50('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b50('0x12'))(_0x1b50('0x13'));var utils=require(_0x1b50('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1b50('0x15'));var db=require(_0x1b50('0x16'))['db'];config['redis']=_[_0x1b50('0x17')](config[_0x1b50('0x18')],{'host':_0x1b50('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b50('0x18')]));require(_0x1b50('0x1a'))[_0x1b50('0x1b')](socket);var jayson=require(_0x1b50('0x1c'));var client=jayson[_0x1b50('0x1d')][_0x1b50('0x1e')]({'port':0x232c});var client9002=jayson[_0x1b50('0x1d')][_0x1b50('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4e4b2f,_0x1ee1e4,_0x1e0ca6,_0x5f2afc){return new BPromise(function(_0x42b090,_0x1615fa){var _0x344b0d=_0x5f2afc||client;return _0x344b0d['request'](_0x4e4b2f,_0x1e0ca6)[_0x1b50('0x1f')](function(_0x179a69){logger[_0x1b50('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x1ee1e4,_0x1b50('0x21'));logger[_0x1b50('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1ee1e4,'request\x20sent',JSON[_0x1b50('0x23')](_0x179a69));if(_0x179a69['error']){if(_0x179a69['error']['code']===0x1f4){logger[_0x1b50('0x24')](_0x1b50('0x25'),_0x1ee1e4,_0x179a69[_0x1b50('0x24')][_0x1b50('0x26')]);return _0x1615fa(_0x179a69[_0x1b50('0x24')]['message']);}logger[_0x1b50('0x24')](_0x1b50('0x25'),_0x1ee1e4,_0x179a69[_0x1b50('0x24')][_0x1b50('0x26')]);return _0x42b090(_0x179a69['error'][_0x1b50('0x26')]);}else{logger['info'](_0x1b50('0x25'),_0x1ee1e4,'request\x20sent');_0x42b090(_0x179a69[_0x1b50('0x27')][_0x1b50('0x26')]);}})[_0x1b50('0x28')](function(_0x56c0af){logger[_0x1b50('0x24')](_0x1b50('0x25'),_0x1ee1e4,_0x56c0af);_0x1615fa(_0x56c0af);});});}function respondWithStatusCode(_0x5a342b,_0x4143c6){_0x4143c6=_0x4143c6||0xcc;return function(_0x25c0d1){if(_0x25c0d1){return _0x5a342b[_0x1b50('0x29')](_0x4143c6);}return _0x5a342b[_0x1b50('0x2a')](_0x4143c6)[_0x1b50('0x2b')]();};}function respondWithResult(_0x46b864,_0x20500b){_0x20500b=_0x20500b||0xc8;return function(_0x532e19){if(_0x532e19){return _0x46b864[_0x1b50('0x2a')](_0x20500b)[_0x1b50('0x2c')](_0x532e19);}};}function respondWithFilteredResult(_0x4fd651,_0x162a5c){return function(_0x47908d){if(_0x47908d){var _0x28342a=typeof _0x162a5c[_0x1b50('0x2d')]===_0x1b50('0x2e')&&typeof _0x162a5c[_0x1b50('0x2f')]===_0x1b50('0x2e');var _0x24b09e=_0x47908d[_0x1b50('0x30')];var _0xc7d157=_0x28342a?0x0:_0x162a5c['offset'];var _0x3bc10e=_0x28342a?_0x47908d[_0x1b50('0x30')]:_0x162a5c['offset']+_0x162a5c[_0x1b50('0x2f')];var _0x56ff0d;if(_0x3bc10e>=_0x24b09e){_0x3bc10e=_0x24b09e;_0x56ff0d=0xc8;}else{_0x56ff0d=0xce;}_0x4fd651['status'](_0x56ff0d);return _0x4fd651[_0x1b50('0x31')](_0x1b50('0x32'),_0xc7d157+'-'+_0x3bc10e+'/'+_0x24b09e)[_0x1b50('0x2c')](_0x47908d);}return null;};}function patchUpdates(_0x14fe71){return function(_0x15194d){try{jsonpatch[_0x1b50('0x33')](_0x15194d,_0x14fe71,!![]);}catch(_0x4de8d9){return BPromise['reject'](_0x4de8d9);}return _0x15194d[_0x1b50('0x34')]();};}function saveUpdates(_0x10a75b,_0x597eec){return function(_0x36d28f){if(_0x36d28f){return _0x36d28f[_0x1b50('0x35')](_0x10a75b)[_0x1b50('0x1f')](function(_0xf295ff){return _0xf295ff;});}return null;};}function removeEntity(_0x21630b,_0x40434e){return function(_0x28c529){if(_0x28c529){return _0x28c529['destroy']()['then'](function(){_0x21630b[_0x1b50('0x2a')](0xcc)[_0x1b50('0x2b')]();});}};}function handleEntityNotFound(_0xed8c38,_0x4a92f6){return function(_0x450ca8){if(!_0x450ca8){_0xed8c38[_0x1b50('0x29')](0x194);}return _0x450ca8;};}function handleError(_0xf8ef19,_0x51d376){_0x51d376=_0x51d376||0x1f4;return function(_0x2f4338){logger[_0x1b50('0x24')](_0x2f4338['stack']);if(_0x2f4338['name']){delete _0x2f4338[_0x1b50('0x36')];}_0xf8ef19[_0x1b50('0x2a')](_0x51d376)[_0x1b50('0x37')](_0x2f4338);};}exports['index']=function(_0x2005a2,_0x11f8d7){var _0x528667={},_0x43b12b={},_0x2b5486={'count':0x0,'rows':[]};var _0x156fdc=_[_0x1b50('0x38')](db[_0x1b50('0x39')][_0x1b50('0x3a')],function(_0x596881){return{'name':_0x596881[_0x1b50('0x3b')],'type':_0x596881[_0x1b50('0x3c')][_0x1b50('0x3d')]};});_0x43b12b[_0x1b50('0x3e')]=_[_0x1b50('0x38')](_0x156fdc,_0x1b50('0x36'));_0x43b12b[_0x1b50('0x3f')]=_[_0x1b50('0x40')](_0x2005a2[_0x1b50('0x3f')]);_0x43b12b[_0x1b50('0x41')]=_[_0x1b50('0x42')](_0x43b12b[_0x1b50('0x3e')],_0x43b12b[_0x1b50('0x3f')]);_0x528667[_0x1b50('0x43')]=_[_0x1b50('0x42')](_0x43b12b[_0x1b50('0x3e')],qs[_0x1b50('0x44')](_0x2005a2['query'][_0x1b50('0x44')]));_0x528667[_0x1b50('0x43')]=_0x528667[_0x1b50('0x43')][_0x1b50('0x45')]?_0x528667[_0x1b50('0x43')]:_0x43b12b['model'];if(!_0x2005a2['query'][_0x1b50('0x46')](_0x1b50('0x47'))){_0x528667[_0x1b50('0x2f')]=qs[_0x1b50('0x2f')](_0x2005a2[_0x1b50('0x3f')][_0x1b50('0x2f')]);_0x528667[_0x1b50('0x2d')]=qs[_0x1b50('0x2d')](_0x2005a2[_0x1b50('0x3f')][_0x1b50('0x2d')]);}_0x528667[_0x1b50('0x48')]=qs['sort'](_0x2005a2[_0x1b50('0x3f')]['sort']);_0x528667[_0x1b50('0x49')]=qs[_0x1b50('0x41')](_[_0x1b50('0x4a')](_0x2005a2[_0x1b50('0x3f')],_0x43b12b['filters']),_0x156fdc);if(_0x2005a2[_0x1b50('0x3f')][_0x1b50('0x4b')]){_0x528667[_0x1b50('0x49')]=_[_0x1b50('0x4c')](_0x528667[_0x1b50('0x49')],{'$or':_['map'](_0x156fdc,function(_0x25fc12){if(_0x25fc12['type']!=='VIRTUAL'){var _0x26e565={};_0x26e565[_0x25fc12[_0x1b50('0x36')]]={'$like':'%'+_0x2005a2[_0x1b50('0x3f')]['filter']+'%'};return _0x26e565;}})});}_0x528667=_['merge']({},_0x528667,_0x2005a2[_0x1b50('0x4d')]);var _0x4073c9={'where':_0x528667[_0x1b50('0x49')]};return db[_0x1b50('0x39')]['count'](_0x4073c9)[_0x1b50('0x1f')](function(_0x27ed35){_0x2b5486[_0x1b50('0x30')]=_0x27ed35;if(_0x2005a2['query'][_0x1b50('0x4e')]){_0x528667[_0x1b50('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1b50('0x50')](_0x528667);})[_0x1b50('0x1f')](function(_0x31c952){_0x2b5486[_0x1b50('0x51')]=_0x31c952;return _0x2b5486;})[_0x1b50('0x1f')](respondWithFilteredResult(_0x11f8d7,_0x528667))[_0x1b50('0x28')](handleError(_0x11f8d7,null));};exports[_0x1b50('0x52')]=function(_0x32bab0,_0x2a3bf1){var _0x3f2e3e={'raw':!![],'where':{'id':_0x32bab0[_0x1b50('0x53')]['id']}},_0x4ee6f0={};_0x4ee6f0[_0x1b50('0x3e')]=_[_0x1b50('0x40')](db[_0x1b50('0x39')][_0x1b50('0x3a')]);_0x4ee6f0[_0x1b50('0x3f')]=_[_0x1b50('0x40')](_0x32bab0[_0x1b50('0x3f')]);_0x4ee6f0[_0x1b50('0x41')]=_[_0x1b50('0x42')](_0x4ee6f0[_0x1b50('0x3e')],_0x4ee6f0[_0x1b50('0x3f')]);_0x3f2e3e[_0x1b50('0x43')]=_[_0x1b50('0x42')](_0x4ee6f0[_0x1b50('0x3e')],qs[_0x1b50('0x44')](_0x32bab0['query'][_0x1b50('0x44')]));_0x3f2e3e[_0x1b50('0x43')]=_0x3f2e3e[_0x1b50('0x43')][_0x1b50('0x45')]?_0x3f2e3e[_0x1b50('0x43')]:_0x4ee6f0[_0x1b50('0x3e')];if(_0x32bab0[_0x1b50('0x3f')][_0x1b50('0x4e')]){_0x3f2e3e[_0x1b50('0x4f')]=[{'all':!![]}];}_0x3f2e3e=_[_0x1b50('0x4c')]({},_0x3f2e3e,_0x32bab0['options']);return db[_0x1b50('0x39')]['find'](_0x3f2e3e)[_0x1b50('0x1f')](handleEntityNotFound(_0x2a3bf1,null))['then'](respondWithResult(_0x2a3bf1,null))['catch'](handleError(_0x2a3bf1,null));};exports['create']=function(_0x172d8f,_0x8c19a4){return db[_0x1b50('0x39')][_0x1b50('0x54')](_0x172d8f[_0x1b50('0x55')],{})[_0x1b50('0x1f')](respondWithResult(_0x8c19a4,0xc9))[_0x1b50('0x28')](handleError(_0x8c19a4,null));};exports['update']=function(_0x2c4543,_0x8ba5d){if(_0x2c4543[_0x1b50('0x55')]['id']){delete _0x2c4543['body']['id'];}return db[_0x1b50('0x39')][_0x1b50('0x56')]({'where':{'id':_0x2c4543['params']['id']}})[_0x1b50('0x1f')](handleEntityNotFound(_0x8ba5d,null))[_0x1b50('0x1f')](saveUpdates(_0x2c4543[_0x1b50('0x55')],null))[_0x1b50('0x1f')](respondWithResult(_0x8ba5d,null))['catch'](handleError(_0x8ba5d,null));};exports[_0x1b50('0x57')]=function(_0xabe405,_0x2c4788){return db[_0x1b50('0x39')][_0x1b50('0x56')]({'where':{'id':_0xabe405[_0x1b50('0x53')]['id']}})[_0x1b50('0x1f')](handleEntityNotFound(_0x2c4788,null))['then'](removeEntity(_0x2c4788,null))['catch'](handleError(_0x2c4788,null));};exports[_0x1b50('0x58')]=function(_0xbbcb45,_0x3522bb){return db[_0x1b50('0x39')][_0x1b50('0x58')]()[_0x1b50('0x1f')](respondWithResult(_0x3522bb,null))['catch'](handleError(_0x3522bb,null));};var interaction_log=require(_0x1b50('0x12'))(_0x1b50('0x59'));exports[_0x1b50('0x5a')]=function(_0x32bf88,_0x4100ed,_0x1c8805){var _0x2409ab={'agent':{},'channel':'openchannel'};if(_0x32bf88[_0x1b50('0x55')]['id']){delete _0x32bf88['body']['id'];}_0x32bf88[_0x1b50('0x55')][_0x1b50('0x5b')]=!![];_0x32bf88['body'][_0x1b50('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32bf88[_0x1b50('0x55')][_0x1b50('0x5d')]=_0x32bf88[_0x1b50('0x55')][_0x1b50('0x5d')]||_0x32bf88[_0x1b50('0x5e')]['id'];_0x2409ab[_0x1b50('0x5f')]['id']=_0x32bf88[_0x1b50('0x55')][_0x1b50('0x5d')];return db[_0x1b50('0x39')][_0x1b50('0x56')]({'where':{'id':_0x32bf88[_0x1b50('0x53')]['id'],'UserId':null}})[_0x1b50('0x1f')](handleEntityNotFound(_0x4100ed,null))[_0x1b50('0x1f')](saveUpdates(_0x32bf88[_0x1b50('0x55')],null))[_0x1b50('0x1f')](function(_0x529d24){if(_0x529d24){_0x2409ab[_0x1b50('0x26')]=_0x529d24[_0x1b50('0x60')]({'plain':!![]});return db[_0x1b50('0x61')][_0x1b50('0x56')]({'where':{'id':_0x529d24[_0x1b50('0x62')]}});}return null;})[_0x1b50('0x1f')](handleEntityNotFound(_0x4100ed,null))[_0x1b50('0x1f')](function(_0x708bbd){if(_0x708bbd){return _0x708bbd[_0x1b50('0x35')]({'UserId':_0x32bf88[_0x1b50('0x55')][_0x1b50('0x5d')],'read1stAt':_[_0x1b50('0x63')](_0x708bbd[_0x1b50('0x64')])?moment()[_0x1b50('0x65')](_0x1b50('0x66')):undefined});}return null;})[_0x1b50('0x1f')](function(_0x1d6404){if(_0x1d6404){_0x2409ab['interaction']=_0x1d6404['get']({'plain':!![]});interaction_log['info'](_0x1b50('0x67'),_0x32bf88[_0x1b50('0x5e')]['id'],_0x32bf88[_0x1b50('0x5e')][_0x1b50('0x36')],_0x32bf88[_0x1b50('0x5e')][_0x1b50('0x68')],_0x2409ab[_0x1b50('0x69')]['id'],_0x32bf88['body']?JSON[_0x1b50('0x23')](_0x32bf88['body']):_0x1b50('0x6a'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2409ab);}return null;})[_0x1b50('0x1f')](function(_0x1b0fb9){var _0x5e4010=_0x1b50('0x6b')+_0x1b0fb9[_0x1b50('0x26')][_0x1b50('0x6c')];return db[_0x1b50('0x6d')][_0x1b50('0x3f')](_0x5e4010,{'type':db['Sequelize']['QueryTypes'][_0x1b50('0x6e')],'raw':!![]})[_0x1b50('0x1f')](function(_0x5800a6){return _0x5800a6;});})[_0x1b50('0x1f')](function(_0x9d3522){if(_0x9d3522){_0x2409ab[_0x1b50('0x26')][_0x1b50('0x6f')]=_0x9d3522[0x0];if(!_0x32bf88[_0x1b50('0x55')][_0x1b50('0x5d')])return;return db[_0x1b50('0x70')][_0x1b50('0x56')]({'where':{'id':_0x32bf88[_0x1b50('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x1b50('0x36'),_0x1b50('0x71'),_0x1b50('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x315aea){if(!_0x315aea)return null;_0x2409ab[_0x1b50('0x26')][_0x1b50('0x5f')]=_0x315aea;return _0x2409ab;})[_0x1b50('0x1f')](function(_0xe19b8d){if(_0xe19b8d){if(_0x32bf88[_0x1b50('0x55')][_0x1b50('0x73')]){_0x2409ab[_0x1b50('0x26')][_0x1b50('0x74')]=util['format'](_0x1b50('0x75'),_0x32bf88[_0x1b50('0x5e')]['name']);_0x2409ab[_0x1b50('0x26')][_0x1b50('0x76')]=_0x2409ab[_0x1b50('0x76')];_0x2409ab[_0x1b50('0x26')][_0x1b50('0x77')]=_0x2409ab[_0x1b50('0x76')];_0x2409ab[_0x1b50('0x26')][_0x1b50('0x78')]='accept';return respondWithRpcPromise(_0x1b50('0x79'),_0x1b50('0x79'),{'event':_0x1b50('0x7a'),'message':_0x2409ab[_0x1b50('0x26')]},client9002)[_0x1b50('0x1f')](function(){return _0x2409ab;});}return _0x2409ab;}return null;})[_0x1b50('0x1f')](respondWithResult(_0x4100ed,null))[_0x1b50('0x28')](handleError(_0x4100ed,null));};var interaction_log=require(_0x1b50('0x12'))(_0x1b50('0x59'));exports[_0x1b50('0x7b')]=function(_0xeb8b07,_0x7c63f4,_0x3243db){var _0xe26c79={'agent':{},'channel':_0x1b50('0x7c')};if(_0xeb8b07[_0x1b50('0x55')]['id']){delete _0xeb8b07[_0x1b50('0x55')]['id'];}_0xeb8b07['body'][_0x1b50('0x5d')]=_0xeb8b07[_0x1b50('0x55')]['UserId']||_0xeb8b07[_0x1b50('0x5e')]['id'];_0xe26c79['agent']['id']=_0xeb8b07[_0x1b50('0x55')]['UserId'];return db[_0x1b50('0x39')][_0x1b50('0x56')]({'where':{'id':_0xeb8b07[_0x1b50('0x53')]['id'],'UserId':null}})[_0x1b50('0x1f')](handleEntityNotFound(_0x7c63f4,null))['then'](function(_0x48fd0f){if(_0x48fd0f){_0xe26c79['message']=_0x48fd0f[_0x1b50('0x60')]({'plain':!![]});return db[_0x1b50('0x61')]['find']({'where':{'id':_0x48fd0f[_0x1b50('0x62')]}});}return null;})[_0x1b50('0x1f')](handleEntityNotFound(_0x7c63f4,null))[_0x1b50('0x1f')](function(_0x1f5e0c){if(_0x1f5e0c){_0xe26c79[_0x1b50('0x69')]=_0x1f5e0c[_0x1b50('0x60')]({'plain':!![]});interaction_log['info'](_0x1b50('0x7d'),_0xeb8b07[_0x1b50('0x5e')]['id'],_0xeb8b07[_0x1b50('0x5e')][_0x1b50('0x36')],_0xeb8b07[_0x1b50('0x5e')][_0x1b50('0x68')],_0xe26c79['interaction']['id'],_0xeb8b07[_0x1b50('0x55')]?JSON['stringify'](_0xeb8b07[_0x1b50('0x55')]):_0x1b50('0x6a'));return respondWithRpcPromise(_0x1b50('0x7e'),'rejectMessage',_0xe26c79);}return null;})[_0x1b50('0x1f')](function(_0x1a12b9){var _0x620b58=_0x1b50('0x6b')+_0x1a12b9[_0x1b50('0x26')][_0x1b50('0x6c')];return db[_0x1b50('0x6d')]['query'](_0x620b58,{'type':db[_0x1b50('0x7f')]['QueryTypes'][_0x1b50('0x6e')],'raw':!![]})[_0x1b50('0x1f')](function(_0x396a3a){return _0x396a3a;});})['then'](function(_0x2743fe){if(_0x2743fe){_0xe26c79[_0x1b50('0x26')][_0x1b50('0x6f')]=_0x2743fe[0x0];if(!_0xeb8b07[_0x1b50('0x55')][_0x1b50('0x5d')])return;return db[_0x1b50('0x70')][_0x1b50('0x56')]({'where':{'id':_0xeb8b07[_0x1b50('0x55')][_0x1b50('0x5d')],'role':_0x1b50('0x5f')},'attributes':['id','name',_0x1b50('0x71'),_0x1b50('0x72'),_0x1b50('0x80')],'raw':!![]});}return null;})[_0x1b50('0x1f')](function(_0x5c3121){if(!_0x5c3121)return null;_0xe26c79[_0x1b50('0x26')][_0x1b50('0x5f')]=_0x5c3121;return _0xe26c79;})[_0x1b50('0x1f')](function(_0x3e1503){if(_0x3e1503){_0x3e1503[_0x1b50('0x26')][_0x1b50('0x74')]=util[_0x1b50('0x65')](_0x1b50('0x75'),_0xeb8b07[_0x1b50('0x5e')][_0x1b50('0x36')]);_0x3e1503['message']['channel']=_0xe26c79[_0x1b50('0x76')];_0x3e1503[_0x1b50('0x26')]['motionChannel']=_0xe26c79[_0x1b50('0x76')];_0x3e1503[_0x1b50('0x26')][_0x1b50('0x78')]=_0x1b50('0x7b');respondWithRpcPromise(_0x1b50('0x79'),_0x1b50('0x79'),{'event':_0x1b50('0x81'),'message':_0x3e1503[_0x1b50('0x26')]},client9002);return _0xe26c79;}return null;})['then'](respondWithResult(_0x7c63f4,null))['catch'](handleError(_0x7c63f4,null));}; \ No newline at end of file +var _0x5cc1=['SELECT','User','email','manual','interface','channel','motionChannel','event','EventManager','openchannel-interactions','reject','null','RejectMessage','rejectMessage','contact','fullname','SIP/%s','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','OpenchannelMessage','includeAll','findAll','rows','show','params','include','options','find','create','body','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x5cc1,0x123));var _0x15cc=function(_0x237a31,_0x1f1191){_0x237a31=_0x237a31-0x0;var _0x4c7cea=_0x5cc1[_0x237a31];return _0x4c7cea;};'use strict';var emlformat=require(_0x15cc('0x0'));var rimraf=require(_0x15cc('0x1'));var zipdir=require(_0x15cc('0x2'));var jsonpatch=require(_0x15cc('0x3'));var rp=require(_0x15cc('0x4'));var moment=require(_0x15cc('0x5'));var BPromise=require(_0x15cc('0x6'));var Mustache=require(_0x15cc('0x7'));var util=require('util');var path=require(_0x15cc('0x8'));var sox=require(_0x15cc('0x9'));var csv=require(_0x15cc('0xa'));var ejs=require(_0x15cc('0xb'));var fs=require('fs');var fs_extra=require(_0x15cc('0xc'));var _=require(_0x15cc('0xd'));var squel=require(_0x15cc('0xe'));var crypto=require(_0x15cc('0xf'));var jsforce=require(_0x15cc('0x10'));var deskjs=require(_0x15cc('0x11'));var toCsv=require(_0x15cc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x15cc('0x12'));var authService=require(_0x15cc('0x13'));var qs=require(_0x15cc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15cc('0x15'));var logger=require('../../config/logger')(_0x15cc('0x16'));var utils=require(_0x15cc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x15cc('0x18'));var db=require(_0x15cc('0x19'))['db'];config[_0x15cc('0x1a')]=_[_0x15cc('0x1b')](config[_0x15cc('0x1a')],{'host':_0x15cc('0x1c'),'port':0x18eb});var socket=require(_0x15cc('0x1d'))(new Redis(config[_0x15cc('0x1a')]));require(_0x15cc('0x1e'))[_0x15cc('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x15cc('0x20')][_0x15cc('0x21')]({'port':0x232c});var client9002=jayson[_0x15cc('0x20')][_0x15cc('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3e8751,_0x56ffd0,_0x1f5575,_0x55d493){return new BPromise(function(_0x1d59b3,_0x1d22ed){var _0x3cc61c=_0x55d493||client;return _0x3cc61c[_0x15cc('0x22')](_0x3e8751,_0x1f5575)[_0x15cc('0x23')](function(_0x138af4){logger[_0x15cc('0x24')](_0x15cc('0x25'),_0x56ffd0,_0x15cc('0x26'));logger[_0x15cc('0x27')](_0x15cc('0x28'),_0x56ffd0,'request\x20sent',JSON['stringify'](_0x138af4));if(_0x138af4[_0x15cc('0x29')]){if(_0x138af4['error'][_0x15cc('0x2a')]===0x1f4){logger['error'](_0x15cc('0x25'),_0x56ffd0,_0x138af4[_0x15cc('0x29')][_0x15cc('0x2b')]);return _0x1d22ed(_0x138af4[_0x15cc('0x29')][_0x15cc('0x2b')]);}logger[_0x15cc('0x29')](_0x15cc('0x25'),_0x56ffd0,_0x138af4['error'][_0x15cc('0x2b')]);return _0x1d59b3(_0x138af4['error']['message']);}else{logger[_0x15cc('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x56ffd0,'request\x20sent');_0x1d59b3(_0x138af4[_0x15cc('0x2c')][_0x15cc('0x2b')]);}})[_0x15cc('0x2d')](function(_0x2d0c81){logger[_0x15cc('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x56ffd0,_0x2d0c81);_0x1d22ed(_0x2d0c81);});});}function respondWithStatusCode(_0x5d61c8,_0x14b7bc){_0x14b7bc=_0x14b7bc||0xcc;return function(_0x47c8b0){if(_0x47c8b0){return _0x5d61c8['sendStatus'](_0x14b7bc);}return _0x5d61c8['status'](_0x14b7bc)['end']();};}function respondWithResult(_0x33cd1f,_0x36a67e){_0x36a67e=_0x36a67e||0xc8;return function(_0x16ff73){if(_0x16ff73){return _0x33cd1f[_0x15cc('0x2e')](_0x36a67e)[_0x15cc('0x2f')](_0x16ff73);}};}function respondWithFilteredResult(_0x52c57e,_0x250e97){return function(_0x3b6f09){if(_0x3b6f09){var _0x35927e=typeof _0x250e97['offset']===_0x15cc('0x30')&&typeof _0x250e97['limit']===_0x15cc('0x30');var _0x78ba48=_0x3b6f09['count'];var _0x5521f1=_0x35927e?0x0:_0x250e97[_0x15cc('0x31')];var _0x51c5bc=_0x35927e?_0x3b6f09[_0x15cc('0x32')]:_0x250e97[_0x15cc('0x31')]+_0x250e97[_0x15cc('0x33')];var _0x4a1936;if(_0x51c5bc>=_0x78ba48){_0x51c5bc=_0x78ba48;_0x4a1936=0xc8;}else{_0x4a1936=0xce;}_0x52c57e[_0x15cc('0x2e')](_0x4a1936);return _0x52c57e[_0x15cc('0x34')](_0x15cc('0x35'),_0x5521f1+'-'+_0x51c5bc+'/'+_0x78ba48)['json'](_0x3b6f09);}return null;};}function patchUpdates(_0x13c0fa){return function(_0x59b8dc){try{jsonpatch[_0x15cc('0x36')](_0x59b8dc,_0x13c0fa,!![]);}catch(_0x311b7d){return BPromise['reject'](_0x311b7d);}return _0x59b8dc[_0x15cc('0x37')]();};}function saveUpdates(_0x5d414b,_0x38907d){return function(_0x1a7195){if(_0x1a7195){return _0x1a7195[_0x15cc('0x38')](_0x5d414b)['then'](function(_0x202c03){return _0x202c03;});}return null;};}function removeEntity(_0x4f8a6d,_0x4c9ce2){return function(_0x7dd7ce){if(_0x7dd7ce){return _0x7dd7ce[_0x15cc('0x39')]()['then'](function(){_0x4f8a6d[_0x15cc('0x2e')](0xcc)[_0x15cc('0x3a')]();});}};}function handleEntityNotFound(_0x4cda71,_0x1235e7){return function(_0x37946a){if(!_0x37946a){_0x4cda71[_0x15cc('0x3b')](0x194);}return _0x37946a;};}function handleError(_0x19f81c,_0x552ab3){_0x552ab3=_0x552ab3||0x1f4;return function(_0x42ea12){logger[_0x15cc('0x29')](_0x42ea12[_0x15cc('0x3c')]);if(_0x42ea12[_0x15cc('0x3d')]){delete _0x42ea12[_0x15cc('0x3d')];}_0x19f81c['status'](_0x552ab3)[_0x15cc('0x3e')](_0x42ea12);};}exports[_0x15cc('0x3f')]=function(_0x1ad39e,_0x5759ec){var _0xb5c75b={},_0x11ee0f={},_0xd29b34={'count':0x0,'rows':[]};var _0x15845=_[_0x15cc('0x40')](db['OpenchannelMessage'][_0x15cc('0x41')],function(_0x39c43a){return{'name':_0x39c43a[_0x15cc('0x42')],'type':_0x39c43a[_0x15cc('0x43')][_0x15cc('0x44')]};});_0x11ee0f[_0x15cc('0x45')]=_['map'](_0x15845,_0x15cc('0x3d'));_0x11ee0f[_0x15cc('0x46')]=_[_0x15cc('0x47')](_0x1ad39e['query']);_0x11ee0f[_0x15cc('0x48')]=_[_0x15cc('0x49')](_0x11ee0f[_0x15cc('0x45')],_0x11ee0f[_0x15cc('0x46')]);_0xb5c75b[_0x15cc('0x4a')]=_[_0x15cc('0x49')](_0x11ee0f[_0x15cc('0x45')],qs[_0x15cc('0x4b')](_0x1ad39e[_0x15cc('0x46')][_0x15cc('0x4b')]));_0xb5c75b['attributes']=_0xb5c75b[_0x15cc('0x4a')][_0x15cc('0x4c')]?_0xb5c75b[_0x15cc('0x4a')]:_0x11ee0f['model'];if(!_0x1ad39e[_0x15cc('0x46')]['hasOwnProperty'](_0x15cc('0x4d'))){_0xb5c75b[_0x15cc('0x33')]=qs[_0x15cc('0x33')](_0x1ad39e['query'][_0x15cc('0x33')]);_0xb5c75b[_0x15cc('0x31')]=qs[_0x15cc('0x31')](_0x1ad39e['query']['offset']);}_0xb5c75b[_0x15cc('0x4e')]=qs[_0x15cc('0x4f')](_0x1ad39e[_0x15cc('0x46')][_0x15cc('0x4f')]);_0xb5c75b[_0x15cc('0x50')]=qs[_0x15cc('0x48')](_['pick'](_0x1ad39e[_0x15cc('0x46')],_0x11ee0f[_0x15cc('0x48')]),_0x15845);if(_0x1ad39e['query'][_0x15cc('0x51')]){_0xb5c75b[_0x15cc('0x50')]=_['merge'](_0xb5c75b['where'],{'$or':_[_0x15cc('0x40')](_0x15845,function(_0x44facc){if(_0x44facc[_0x15cc('0x43')]!=='VIRTUAL'){var _0x122863={};_0x122863[_0x44facc['name']]={'$like':'%'+_0x1ad39e[_0x15cc('0x46')][_0x15cc('0x51')]+'%'};return _0x122863;}})});}_0xb5c75b=_[_0x15cc('0x52')]({},_0xb5c75b,_0x1ad39e['options']);var _0x97a0fb={'where':_0xb5c75b['where']};return db[_0x15cc('0x53')]['count'](_0x97a0fb)['then'](function(_0x39e140){_0xd29b34['count']=_0x39e140;if(_0x1ad39e['query'][_0x15cc('0x54')]){_0xb5c75b['include']=[{'all':!![]}];}return db[_0x15cc('0x53')][_0x15cc('0x55')](_0xb5c75b);})[_0x15cc('0x23')](function(_0xda6aab){_0xd29b34[_0x15cc('0x56')]=_0xda6aab;return _0xd29b34;})[_0x15cc('0x23')](respondWithFilteredResult(_0x5759ec,_0xb5c75b))[_0x15cc('0x2d')](handleError(_0x5759ec,null));};exports[_0x15cc('0x57')]=function(_0x4cb23a,_0x2c089c){var _0x19684f={'raw':!![],'where':{'id':_0x4cb23a[_0x15cc('0x58')]['id']}},_0x266c67={};_0x266c67[_0x15cc('0x45')]=_[_0x15cc('0x47')](db[_0x15cc('0x53')][_0x15cc('0x41')]);_0x266c67[_0x15cc('0x46')]=_[_0x15cc('0x47')](_0x4cb23a['query']);_0x266c67['filters']=_['intersection'](_0x266c67[_0x15cc('0x45')],_0x266c67[_0x15cc('0x46')]);_0x19684f[_0x15cc('0x4a')]=_['intersection'](_0x266c67[_0x15cc('0x45')],qs[_0x15cc('0x4b')](_0x4cb23a[_0x15cc('0x46')]['fields']));_0x19684f[_0x15cc('0x4a')]=_0x19684f[_0x15cc('0x4a')][_0x15cc('0x4c')]?_0x19684f[_0x15cc('0x4a')]:_0x266c67[_0x15cc('0x45')];if(_0x4cb23a[_0x15cc('0x46')][_0x15cc('0x54')]){_0x19684f[_0x15cc('0x59')]=[{'all':!![]}];}_0x19684f=_[_0x15cc('0x52')]({},_0x19684f,_0x4cb23a[_0x15cc('0x5a')]);return db[_0x15cc('0x53')][_0x15cc('0x5b')](_0x19684f)[_0x15cc('0x23')](handleEntityNotFound(_0x2c089c,null))[_0x15cc('0x23')](respondWithResult(_0x2c089c,null))[_0x15cc('0x2d')](handleError(_0x2c089c,null));};exports[_0x15cc('0x5c')]=function(_0x478cf1,_0x31e17a){return db[_0x15cc('0x53')][_0x15cc('0x5c')](_0x478cf1[_0x15cc('0x5d')],{})[_0x15cc('0x23')](respondWithResult(_0x31e17a,0xc9))[_0x15cc('0x2d')](handleError(_0x31e17a,null));};exports[_0x15cc('0x38')]=function(_0x73790c,_0x571f20){if(_0x73790c[_0x15cc('0x5d')]['id']){delete _0x73790c['body']['id'];}return db[_0x15cc('0x53')][_0x15cc('0x5b')]({'where':{'id':_0x73790c[_0x15cc('0x58')]['id']}})[_0x15cc('0x23')](handleEntityNotFound(_0x571f20,null))[_0x15cc('0x23')](saveUpdates(_0x73790c[_0x15cc('0x5d')],null))[_0x15cc('0x23')](respondWithResult(_0x571f20,null))[_0x15cc('0x2d')](handleError(_0x571f20,null));};exports[_0x15cc('0x39')]=function(_0x5cb646,_0x3d9cb1){return db[_0x15cc('0x53')]['find']({'where':{'id':_0x5cb646[_0x15cc('0x58')]['id']}})[_0x15cc('0x23')](handleEntityNotFound(_0x3d9cb1,null))['then'](removeEntity(_0x3d9cb1,null))['catch'](handleError(_0x3d9cb1,null));};exports[_0x15cc('0x5e')]=function(_0x1c560f,_0x8d27a5){return db[_0x15cc('0x53')]['describe']()['then'](respondWithResult(_0x8d27a5,null))[_0x15cc('0x2d')](handleError(_0x8d27a5,null));};var interaction_log=require(_0x15cc('0x5f'))('openchannel-interactions');exports[_0x15cc('0x60')]=function(_0x4c21d7,_0x3dd557,_0xdb0754){var _0x1bc6f0={'agent':{},'channel':_0x15cc('0x61')};if(_0x4c21d7[_0x15cc('0x5d')]['id']){delete _0x4c21d7[_0x15cc('0x5d')]['id'];}_0x4c21d7[_0x15cc('0x5d')][_0x15cc('0x62')]=!![];_0x4c21d7[_0x15cc('0x5d')][_0x15cc('0x63')]=moment()[_0x15cc('0x64')](_0x15cc('0x65'));_0x4c21d7[_0x15cc('0x5d')][_0x15cc('0x66')]=_0x4c21d7[_0x15cc('0x5d')][_0x15cc('0x66')]||_0x4c21d7[_0x15cc('0x67')]['id'];_0x1bc6f0[_0x15cc('0x68')]['id']=_0x4c21d7[_0x15cc('0x5d')][_0x15cc('0x66')];return db[_0x15cc('0x53')][_0x15cc('0x5b')]({'where':{'id':_0x4c21d7['params']['id'],'UserId':null}})[_0x15cc('0x23')](handleEntityNotFound(_0x3dd557,null))[_0x15cc('0x23')](saveUpdates(_0x4c21d7['body'],null))[_0x15cc('0x23')](function(_0x67860c){if(_0x67860c){_0x1bc6f0[_0x15cc('0x2b')]=_0x67860c[_0x15cc('0x69')]({'plain':!![]});return db[_0x15cc('0x6a')][_0x15cc('0x5b')]({'where':{'id':_0x67860c[_0x15cc('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x3dd557,null))['then'](function(_0x1f3191){if(_0x1f3191){return _0x1f3191[_0x15cc('0x38')]({'UserId':_0x4c21d7[_0x15cc('0x5d')][_0x15cc('0x66')],'read1stAt':_[_0x15cc('0x6c')](_0x1f3191[_0x15cc('0x6d')])?moment()['format'](_0x15cc('0x65')):undefined});}return null;})[_0x15cc('0x23')](function(_0x58b2ce){if(_0x58b2ce){_0x1bc6f0[_0x15cc('0x6e')]=_0x58b2ce[_0x15cc('0x69')]({'plain':!![]});interaction_log[_0x15cc('0x24')](_0x15cc('0x6f'),_0x4c21d7[_0x15cc('0x67')]['id'],_0x4c21d7['user'][_0x15cc('0x3d')],_0x4c21d7[_0x15cc('0x67')][_0x15cc('0x70')],_0x1bc6f0['interaction']['id'],_0x4c21d7['body']?JSON[_0x15cc('0x71')](_0x4c21d7[_0x15cc('0x5d')]):'null');return respondWithRpcPromise(_0x15cc('0x72'),'acceptMessage',_0x1bc6f0);}return null;})[_0x15cc('0x23')](function(_0x3d46b7){var _0x556e75=_0x15cc('0x73')+_0x3d46b7[_0x15cc('0x2b')][_0x15cc('0x74')];return db[_0x15cc('0x75')][_0x15cc('0x46')](_0x556e75,{'type':db[_0x15cc('0x76')][_0x15cc('0x77')][_0x15cc('0x78')],'raw':!![]})[_0x15cc('0x23')](function(_0x27c1b1){return _0x27c1b1;});})[_0x15cc('0x23')](function(_0x481082){if(_0x481082){_0x1bc6f0['message']['contact']=_0x481082[0x0];if(!_0x4c21d7['body'][_0x15cc('0x66')])return;return db[_0x15cc('0x79')][_0x15cc('0x5b')]({'where':{'id':_0x4c21d7[_0x15cc('0x5d')][_0x15cc('0x66')],'role':_0x15cc('0x68')},'attributes':['id',_0x15cc('0x3d'),'fullname',_0x15cc('0x7a'),'internal'],'raw':!![]});}return null;})[_0x15cc('0x23')](function(_0xfbec8f){if(!_0xfbec8f)return null;_0x1bc6f0[_0x15cc('0x2b')]['agent']=_0xfbec8f;return _0x1bc6f0;})[_0x15cc('0x23')](function(_0x1e6ebc){if(_0x1e6ebc){if(_0x4c21d7['body'][_0x15cc('0x7b')]){_0x1bc6f0[_0x15cc('0x2b')][_0x15cc('0x7c')]=util['format']('SIP/%s',_0x4c21d7[_0x15cc('0x67')][_0x15cc('0x3d')]);_0x1bc6f0[_0x15cc('0x2b')][_0x15cc('0x7d')]=_0x1bc6f0['channel'];_0x1bc6f0[_0x15cc('0x2b')][_0x15cc('0x7e')]=_0x1bc6f0[_0x15cc('0x7d')];_0x1bc6f0['message'][_0x15cc('0x7f')]='accept';return respondWithRpcPromise(_0x15cc('0x80'),'EventManager',{'event':'acceptmessage','message':_0x1bc6f0[_0x15cc('0x2b')]},client9002)[_0x15cc('0x23')](function(){return _0x1bc6f0;});}return _0x1bc6f0;}return null;})[_0x15cc('0x23')](respondWithResult(_0x3dd557,null))[_0x15cc('0x2d')](handleError(_0x3dd557,null));};var interaction_log=require(_0x15cc('0x5f'))(_0x15cc('0x81'));exports[_0x15cc('0x82')]=function(_0x599876,_0x5a247a,_0xb01a1e){var _0x3242e6={'agent':{},'channel':_0x15cc('0x61')};if(_0x599876['body']['id']){delete _0x599876['body']['id'];}_0x599876[_0x15cc('0x5d')][_0x15cc('0x66')]=_0x599876['body'][_0x15cc('0x66')]||_0x599876['user']['id'];_0x3242e6['agent']['id']=_0x599876[_0x15cc('0x5d')][_0x15cc('0x66')];return db[_0x15cc('0x53')][_0x15cc('0x5b')]({'where':{'id':_0x599876['params']['id'],'UserId':null}})[_0x15cc('0x23')](handleEntityNotFound(_0x5a247a,null))[_0x15cc('0x23')](function(_0x307115){if(_0x307115){_0x3242e6[_0x15cc('0x2b')]=_0x307115[_0x15cc('0x69')]({'plain':!![]});return db[_0x15cc('0x6a')][_0x15cc('0x5b')]({'where':{'id':_0x307115['OpenchannelInteractionId']}});}return null;})[_0x15cc('0x23')](handleEntityNotFound(_0x5a247a,null))[_0x15cc('0x23')](function(_0x40a869){if(_0x40a869){_0x3242e6['interaction']=_0x40a869[_0x15cc('0x69')]({'plain':!![]});interaction_log[_0x15cc('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x599876['user']['id'],_0x599876[_0x15cc('0x67')][_0x15cc('0x3d')],_0x599876[_0x15cc('0x67')][_0x15cc('0x70')],_0x3242e6[_0x15cc('0x6e')]['id'],_0x599876[_0x15cc('0x5d')]?JSON[_0x15cc('0x71')](_0x599876[_0x15cc('0x5d')]):_0x15cc('0x83'));return respondWithRpcPromise(_0x15cc('0x84'),_0x15cc('0x85'),_0x3242e6);}return null;})[_0x15cc('0x23')](function(_0xaf27d7){var _0xa910ca=_0x15cc('0x73')+_0xaf27d7[_0x15cc('0x2b')][_0x15cc('0x74')];return db[_0x15cc('0x75')][_0x15cc('0x46')](_0xa910ca,{'type':db['Sequelize'][_0x15cc('0x77')][_0x15cc('0x78')],'raw':!![]})[_0x15cc('0x23')](function(_0x4bac1e){return _0x4bac1e;});})[_0x15cc('0x23')](function(_0x14166d){if(_0x14166d){_0x3242e6[_0x15cc('0x2b')][_0x15cc('0x86')]=_0x14166d[0x0];if(!_0x599876[_0x15cc('0x5d')]['UserId'])return;return db[_0x15cc('0x79')]['find']({'where':{'id':_0x599876[_0x15cc('0x5d')][_0x15cc('0x66')],'role':_0x15cc('0x68')},'attributes':['id',_0x15cc('0x3d'),_0x15cc('0x87'),_0x15cc('0x7a'),'internal'],'raw':!![]});}return null;})[_0x15cc('0x23')](function(_0x562be0){if(!_0x562be0)return null;_0x3242e6[_0x15cc('0x2b')]['agent']=_0x562be0;return _0x3242e6;})['then'](function(_0x169adf){if(_0x169adf){_0x169adf[_0x15cc('0x2b')][_0x15cc('0x7c')]=util[_0x15cc('0x64')](_0x15cc('0x88'),_0x599876[_0x15cc('0x67')][_0x15cc('0x3d')]);_0x169adf['message'][_0x15cc('0x7d')]=_0x3242e6[_0x15cc('0x7d')];_0x169adf['message'][_0x15cc('0x7e')]=_0x3242e6[_0x15cc('0x7d')];_0x169adf[_0x15cc('0x2b')][_0x15cc('0x7f')]='reject';respondWithRpcPromise(_0x15cc('0x80'),_0x15cc('0x80'),{'event':'rejectmessage','message':_0x169adf['message']},client9002);return _0x3242e6;}return null;})['then'](respondWithResult(_0x5a247a,null))[_0x15cc('0x2d')](handleError(_0x5a247a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 41271c2..302a769 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 _0x6959=['hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x508841,_0x25751e){var _0x18b712=function(_0x4e2398){while(--_0x4e2398){_0x508841['push'](_0x508841['shift']());}};_0x18b712(++_0x25751e);}(_0x6959,0x12e));var _0x9695=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6959[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x9695('0x0'));var OpenchannelMessage=require(_0x9695('0x1'))['db'][_0x9695('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9695('0x3')](0x0);var events={'afterCreate':_0x9695('0x4'),'afterUpdate':_0x9695('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2b72d2){return function(_0x685ace,_0x2f4638,_0x470e31){OpenchannelMessageEvents['emit'](_0x2b72d2+':'+_0x685ace['id'],_0x685ace);OpenchannelMessageEvents[_0x9695('0x6')](_0x2b72d2,_0x685ace);_0x470e31(null);};}for(var e in events){if(events[_0x9695('0x7')](e)){var event=events[e];OpenchannelMessage[_0x9695('0x8')](e,emitEvent(event));}}module[_0x9695('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3e43=['events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4b3e13,_0x36483c){var _0xcd9d5c=function(_0x43a522){while(--_0x43a522){_0x4b3e13['push'](_0x4b3e13['shift']());}};_0xcd9d5c(++_0x36483c);}(_0x3e43,0xb4));var _0x33e4=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3e43[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0x33e4('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x33e4('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x33e4('0x2')](0x0);var events={'afterCreate':_0x33e4('0x3'),'afterUpdate':_0x33e4('0x4'),'afterDestroy':_0x33e4('0x5')};function emitEvent(_0x41f1f4){return function(_0xfa30a7,_0x366278,_0x5ac2e5){OpenchannelMessageEvents[_0x33e4('0x6')](_0x41f1f4+':'+_0xfa30a7['id'],_0xfa30a7);OpenchannelMessageEvents[_0x33e4('0x6')](_0x41f1f4,_0xfa30a7);_0x5ac2e5(null);};}for(var e in events){if(events[_0x33e4('0x7')](e)){var event=events[e];OpenchannelMessage[_0x33e4('0x8')](e,emitEvent(event));}}module[_0x33e4('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 1e0068a..fdccaf3 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 _0x5c00=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','direction','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get'];(function(_0x19cf1c,_0x255b86){var _0x5a61bb=function(_0x101b90){while(--_0x101b90){_0x19cf1c['push'](_0x19cf1c['shift']());}};_0x5a61bb(++_0x255b86);}(_0x5c00,0x17e));var _0x05c0=function(_0x35acf5,_0x4577af){_0x35acf5=_0x35acf5-0x0;var _0x3ffed3=_0x5c00[_0x35acf5];return _0x3ffed3;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[{'name':_0x05c0('0xb'),'fields':[_0x05c0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32a795,_0x32cdfa,_0x996d6b){var _0x321c09=_0x3521fe[_0x05c0('0xd')];var _0x1edbb=_0x32a795['get']({'plain':!![]});if(_0x1edbb['direction'][_0x05c0('0xe')]()==='in'||_0x1edbb['direction'][_0x05c0('0xe')]()===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]&&!_['isNil'](_0x1edbb[_0x05c0('0x11')])){_0x321c09['OpenchannelInteraction'][_0x05c0('0x12')]({'where':{'id':_0x1edbb[_0x05c0('0x13')]}})[_0x05c0('0x14')](function(_0x12deeb){if(_0x12deeb){_0x12deeb[_0x05c0('0x15')]({'lastMsgAt':_0x1edbb[_0x05c0('0x16')],'lastMsgDirection':_0x1edbb[_0x05c0('0x17')][_0x05c0('0xe')]()});}})['catch'](function(_0x238e25){console[_0x05c0('0x18')](_0x238e25);});}if(_0x1edbb[_0x05c0('0x17')]===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]){var _0x40153e;_0x321c09[_0x05c0('0x19')][_0x05c0('0x1a')]()[_0x05c0('0x14')](function(_0x521cbd){return _0x321c09[_0x05c0('0x1b')][_0x05c0('0x1c')]({'where':{'id':_0x1edbb[_0x05c0('0x1d')]},'include':[{'model':_0x321c09['OpenchannelInteraction'],'as':_0x05c0('0x1e'),'where':{'id':_0x1edbb[_0x05c0('0x13')]},'limit':0x1,'include':[{'model':_0x321c09[_0x05c0('0x19')],'as':_0x05c0('0x1f'),'attributes':_[_0x05c0('0x20')](_0x521cbd)}]}]});})['then'](function(_0x407c1f){_0x40153e=_0x407c1f[_0x05c0('0x21')]({'plain':!![]});if(_0x40153e&&_0x40153e['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x24'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x40153e[_0x05c0('0x1e')]&&_0x40153e[_0x05c0('0x1e')][_0x05c0('0x26')]){_0x1edbb['Interaction']=_[_0x05c0('0x27')](_0x40153e[_0x05c0('0x1e')][0x0],'Contact');_0x1edbb['Contact']=_0x40153e['Interactions'][0x0]['Contact'];}var _0x32cdfa={'method':_0x05c0('0x28'),'uri':encodeURI(_0x40153e[_0x05c0('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32cdfa['method']){case _0x05c0('0x29'):_0x32cdfa['qs']=_0x1edbb;break;case _0x05c0('0x28'):_0x32cdfa[_0x05c0('0xc')]=_0x1edbb;break;}return rp(_0x32cdfa)[_0x05c0('0x14')](function(_0x58769a){logger[_0x05c0('0x2a')](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x2c'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x58769a['body']['threadId']&&_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]!=_0x1edbb[_0x05c0('0x2e')][_0x05c0('0x2d')]){return _0x321c09[_0x05c0('0x2f')][_0x05c0('0x15')]({'threadId':_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]},{'logging':!![],'where':{'id':_0x1edbb[_0x05c0('0x2e')]['id']}});}else{return;}})[_0x05c0('0x14')](function(){return _0x32a795[_0x05c0('0x15')]({'read':!![]});})[_0x05c0('0x30')](function(_0x50f03d){logger['error'](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x31')](_0x50f03d,{'showHidden':![],'depth':null}));_0x996d6b();});}else{_0x996d6b();}})['finally'](function(){_0x996d6b();});}else{_0x996d6b();}}},'charset':_0x05c0('0x32'),'collate':_0x05c0('0x33')});}; \ No newline at end of file +var _0xe511=['define','fti_openchannel_messages','body','models','get','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Interaction','omit','POST','info','format','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports'];(function(_0x433d2f,_0x62fbcb){var _0x154d4d=function(_0x225f05){while(--_0x225f05){_0x433d2f['push'](_0x433d2f['shift']());}};_0x154d4d(++_0x62fbcb);}(_0xe511,0x16f));var _0x1e51=function(_0x5b2e7f,_0x4cf29a){_0x5b2e7f=_0x5b2e7f-0x0;var _0x6d6f90=_0xe511[_0x5b2e7f];return _0x6d6f90;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x1e51('0xa'),'fields':[_0x1e51('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49d359,_0x658941,_0x2712e0){var _0x29da1f=_0x480cca[_0x1e51('0xc')];var _0x4241a6=_0x49d359[_0x1e51('0xd')]({'plain':!![]});if(_0x4241a6['direction'][_0x1e51('0xe')]()==='in'||_0x4241a6[_0x1e51('0xf')][_0x1e51('0xe')]()===_0x1e51('0x10')&&!_0x4241a6[_0x1e51('0x11')]&&!_[_0x1e51('0x12')](_0x4241a6['UserId'])){_0x29da1f[_0x1e51('0x13')][_0x1e51('0x14')]({'where':{'id':_0x4241a6[_0x1e51('0x15')]}})[_0x1e51('0x16')](function(_0x21bcbd){if(_0x21bcbd){_0x21bcbd[_0x1e51('0x17')]({'lastMsgAt':_0x4241a6[_0x1e51('0x18')],'lastMsgDirection':_0x4241a6[_0x1e51('0xf')][_0x1e51('0xe')]()});}})[_0x1e51('0x19')](function(_0x5a5c07){console[_0x1e51('0x1a')](_0x5a5c07);});}if(_0x4241a6[_0x1e51('0xf')]===_0x1e51('0x10')&&!_0x4241a6['secret']){var _0xa3b410;_0x29da1f['CmContact']['describe']()[_0x1e51('0x16')](function(_0x27dcad){return _0x29da1f[_0x1e51('0x1b')][_0x1e51('0x1c')]({'where':{'id':_0x4241a6[_0x1e51('0x1d')]},'include':[{'model':_0x29da1f[_0x1e51('0x13')],'as':'Interactions','where':{'id':_0x4241a6[_0x1e51('0x15')]},'limit':0x1,'include':[{'model':_0x29da1f['CmContact'],'as':_0x1e51('0x1e'),'attributes':_[_0x1e51('0x1f')](_0x27dcad)}]}]});})[_0x1e51('0x16')](function(_0x183a95){_0xa3b410=_0x183a95['get']({'plain':!![]});if(_0xa3b410&&_0xa3b410['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1e51('0x20'),util['format'](_0x1e51('0x21'),_0x4241a6['id'],_0xa3b410[_0x1e51('0x22')]));if(_0xa3b410[_0x1e51('0x23')]&&_0xa3b410[_0x1e51('0x23')][_0x1e51('0x24')]){_0x4241a6[_0x1e51('0x25')]=_[_0x1e51('0x26')](_0xa3b410[_0x1e51('0x23')][0x0],'Contact');_0x4241a6['Contact']=_0xa3b410[_0x1e51('0x23')][0x0][_0x1e51('0x1e')];}var _0x658941={'method':_0x1e51('0x27'),'uri':encodeURI(_0xa3b410['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x658941['method']){case'GET':_0x658941['qs']=_0x4241a6;break;case _0x1e51('0x27'):_0x658941[_0x1e51('0xb')]=_0x4241a6;break;}return rp(_0x658941)[_0x1e51('0x16')](function(_0x5412bc){logger[_0x1e51('0x28')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x1e51('0x29')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4241a6['id'],_0xa3b410[_0x1e51('0x22')]));if(_0x5412bc[_0x1e51('0xb')]['threadId']&&_0x5412bc[_0x1e51('0xb')][_0x1e51('0x2a')]!=_0x4241a6[_0x1e51('0x25')][_0x1e51('0x2a')]){return _0x29da1f['OpenchannelInteraction']['update']({'threadId':_0x5412bc['body'][_0x1e51('0x2a')]},{'logging':!![],'where':{'id':_0x4241a6[_0x1e51('0x25')]['id']}});}else{return;}})[_0x1e51('0x16')](function(){return _0x49d359[_0x1e51('0x17')]({'read':!![]});})[_0x1e51('0x19')](function(_0x27d9a2){logger[_0x1e51('0x1a')](_0x1e51('0x2b'),_0x1e51('0x20'),util[_0x1e51('0x2c')](_0x27d9a2,{'showHidden':![],'depth':null}));_0x2712e0();});}else{_0x2712e0();}})[_0x1e51('0x2d')](function(){_0x2712e0();});}else{_0x2712e0();}}},'charset':'utf8mb4','collate':_0x1e51('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8f4ef13..ce4c403 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0xdb28,0x106));var _0x8db2=function(_0x6f53aa,_0x2a2b2e){_0x6f53aa=_0x6f53aa-0x0;var _0x3c18cf=_0xdb28[_0x6f53aa];return _0x3c18cf;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3e3978,_0x14f9e9){var _0x5dac49=function(_0x49749d){while(--_0x49749d){_0x3e3978['push'](_0x3e3978['shift']());}};_0x5dac49(++_0x14f9e9);}(_0xadb5,0xad));var _0x5adb=function(_0x309e0e,_0x57b9e9){_0x309e0e=_0x309e0e-0x0;var _0x31f873=_0xadb5[_0x309e0e];return _0x31f873;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e46786e..8a00959 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 _0xe714=['register','openchannelMessage:','./openchannelMessage.events','remove','update','emit','removeListener'];(function(_0x43ae3c,_0xd6d0a6){var _0x597f95=function(_0x435160){while(--_0x435160){_0x43ae3c['push'](_0x43ae3c['shift']());}};_0x597f95(++_0xd6d0a6);}(_0xe714,0xe2));var _0x4e71=function(_0x5adc7b,_0x2484b1){_0x5adc7b=_0x5adc7b-0x0;var _0xab1cf8=_0xe714[_0x5adc7b];return _0xab1cf8;};'use strict';var OpenchannelMessageEvents=require(_0x4e71('0x0'));var events=['save',_0x4e71('0x1'),_0x4e71('0x2')];function createListener(_0xe0504f,_0x28abe0){return function(_0x5c5974){_0x28abe0[_0x4e71('0x3')](_0xe0504f,_0x5c5974);};}function removeListener(_0x59a685,_0xad5224){return function(){OpenchannelMessageEvents[_0x4e71('0x4')](_0x59a685,_0xad5224);};}exports[_0x4e71('0x5')]=function(_0x204a19){for(var _0xfe1559=0x0,_0x1f1d35=events['length'];_0xfe1559<_0x1f1d35;_0xfe1559++){var _0x3b0a3a=events[_0xfe1559];var _0x32b6d0=createListener(_0x4e71('0x6')+_0x3b0a3a,_0x204a19);OpenchannelMessageEvents['on'](_0x3b0a3a,_0x32b6d0);}}; \ No newline at end of file +var _0x4c50=['openchannelMessage:','./openchannelMessage.events','remove','emit','removeListener','register','length'];(function(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0x4c50,0x1f2));var _0x04c5=function(_0x1a7e1f,_0x1c71dd){_0x1a7e1f=_0x1a7e1f-0x0;var _0x14d22c=_0x4c50[_0x1a7e1f];return _0x14d22c;};'use strict';var OpenchannelMessageEvents=require(_0x04c5('0x0'));var events=['save',_0x04c5('0x1'),'update'];function createListener(_0x399687,_0x1152e1){return function(_0x2a99ac){_0x1152e1[_0x04c5('0x2')](_0x399687,_0x2a99ac);};}function removeListener(_0x42b75b,_0x1d2a1d){return function(){OpenchannelMessageEvents[_0x04c5('0x3')](_0x42b75b,_0x1d2a1d);};}exports[_0x04c5('0x4')]=function(_0x393b3b){for(var _0x4b2aad=0x0,_0x2851a2=events[_0x04c5('0x5')];_0x4b2aad<_0x2851a2;_0x4b2aad++){var _0x2ac9cf=events[_0x4b2aad];var _0x3dc262=createListener(_0x04c5('0x6')+_0x2ac9cf,_0x393b3b);OpenchannelMessageEvents['on'](_0x2ac9cf,_0x3dc262);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index d58056f..b81d834 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 _0xf9fb=['removeTeams','/:id/users','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf9fb,0x1a7));var _0xbf9f=function(_0x3df27d,_0x179216){_0x3df27d=_0x3df27d-0x0;var _0xb21030=_0xf9fb[_0x3df27d];return _0xb21030;};'use strict';var multer=require(_0xbf9f('0x0'));var util=require(_0xbf9f('0x1'));var path=require('path');var timeout=require(_0xbf9f('0x2'));var express=require('express');var router=express[_0xbf9f('0x3')]();var fs_extra=require(_0xbf9f('0x4'));var auth=require(_0xbf9f('0x5'));var interaction=require(_0xbf9f('0x6'));var config=require('../../config/environment');var controller=require(_0xbf9f('0x7'));router[_0xbf9f('0x8')]('/',auth['isAuthenticated'](),controller[_0xbf9f('0x9')]);router['get'](_0xbf9f('0xa'),auth[_0xbf9f('0xb')](),controller[_0xbf9f('0xc')]);router[_0xbf9f('0x8')](_0xbf9f('0xd'),auth['isAuthenticated'](),controller[_0xbf9f('0xe')]);router['get'](_0xbf9f('0xf'),auth[_0xbf9f('0xb')](),controller[_0xbf9f('0x10')]);router['get'](_0xbf9f('0x11'),auth[_0xbf9f('0xb')](),controller[_0xbf9f('0x12')]);router[_0xbf9f('0x8')]('/:id/users',auth[_0xbf9f('0xb')](),controller[_0xbf9f('0x13')]);router[_0xbf9f('0x14')]('/',auth[_0xbf9f('0xb')](),controller[_0xbf9f('0x15')]);router['post'](_0xbf9f('0x11'),auth['isAuthenticated'](),controller[_0xbf9f('0x16')]);router[_0xbf9f('0x14')]('/:id/users',auth[_0xbf9f('0xb')](),controller[_0xbf9f('0x17')]);router[_0xbf9f('0x18')](_0xbf9f('0xd'),auth[_0xbf9f('0xb')](),controller[_0xbf9f('0x19')]);router[_0xbf9f('0x1a')](_0xbf9f('0xd'),auth[_0xbf9f('0xb')](),controller['destroy']);router['delete'](_0xbf9f('0x11'),auth[_0xbf9f('0xb')](),controller[_0xbf9f('0x1b')]);router[_0xbf9f('0x1a')](_0xbf9f('0x1c'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xbf9f('0x1d')]=router; \ No newline at end of file +var _0xc963=['create','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x537924,_0x106d71){var _0x344a0e=function(_0x4c4213){while(--_0x4c4213){_0x537924['push'](_0x537924['shift']());}};_0x344a0e(++_0x106d71);}(_0xc963,0x9f));var _0x3c96=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0xc963[_0xb875ee];return _0x4c7f3a;};'use strict';var multer=require('multer');var util=require(_0x3c96('0x0'));var path=require(_0x3c96('0x1'));var timeout=require(_0x3c96('0x2'));var express=require(_0x3c96('0x3'));var router=express[_0x3c96('0x4')]();var fs_extra=require(_0x3c96('0x5'));var auth=require(_0x3c96('0x6'));var interaction=require(_0x3c96('0x7'));var config=require(_0x3c96('0x8'));var controller=require(_0x3c96('0x9'));router[_0x3c96('0xa')]('/',auth[_0x3c96('0xb')](),controller[_0x3c96('0xc')]);router[_0x3c96('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x3c96('0xd')]);router['get'](_0x3c96('0xe'),auth['isAuthenticated'](),controller[_0x3c96('0xf')]);router[_0x3c96('0xa')](_0x3c96('0x10'),auth[_0x3c96('0xb')](),controller[_0x3c96('0x11')]);router[_0x3c96('0xa')](_0x3c96('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3c96('0xa')](_0x3c96('0x13'),auth[_0x3c96('0xb')](),controller[_0x3c96('0x14')]);router['post']('/',auth[_0x3c96('0xb')](),controller[_0x3c96('0x15')]);router[_0x3c96('0x16')](_0x3c96('0x12'),auth[_0x3c96('0xb')](),controller[_0x3c96('0x17')]);router[_0x3c96('0x16')](_0x3c96('0x13'),auth[_0x3c96('0xb')](),controller['addAgents']);router[_0x3c96('0x18')](_0x3c96('0xe'),auth[_0x3c96('0xb')](),controller['update']);router[_0x3c96('0x19')](_0x3c96('0xe'),auth[_0x3c96('0xb')](),controller[_0x3c96('0x1a')]);router[_0x3c96('0x19')](_0x3c96('0x12'),auth[_0x3c96('0xb')](),controller[_0x3c96('0x1b')]);router['delete'](_0x3c96('0x13'),auth[_0x3c96('0xb')](),controller[_0x3c96('0x1c')]);module[_0x3c96('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 3bf948d..7923117 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 _0x252d=['roundrobin','sequelize','STRING','name','INTEGER','beepall'];(function(_0x360ec,_0x585d47){var _0xf03953=function(_0xf081db){while(--_0xf081db){_0x360ec['push'](_0x360ec['shift']());}};_0xf03953(++_0x585d47);}(_0x252d,0x15d));var _0xd252=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x252d[_0x507c81];return _0x368a25;};'use strict';var Sequelize=require(_0xd252('0x0'));module['exports']={'name':{'type':Sequelize[_0xd252('0x1')],'unique':_0xd252('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd252('0x1')]},'timeout':{'type':Sequelize[_0xd252('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd252('0x4'),_0xd252('0x5'))}}; \ No newline at end of file +var _0xb4f0=['roundrobin','sequelize','STRING','INTEGER','beepall'];(function(_0x553e9,_0x3f2081){var _0x4b488e=function(_0x5330fb){while(--_0x5330fb){_0x553e9['push'](_0x553e9['shift']());}};_0x4b488e(++_0x3f2081);}(_0xb4f0,0x1a5));var _0x0b4f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb4f0[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0x0b4f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0b4f('0x1')]},'timeout':{'type':Sequelize[_0x0b4f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x0b4f('0x3'),_0x0b4f('0x4'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index f16c31e..d4ecf1b 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 _0x2e0b=['union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','ids','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','OpenchannelQueues','UserProfileResource','end','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','key','query','keys','intersection','fields','attributes','model','hasOwnProperty','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','nolimit','order','pick','OpenchannelQueueId','User','findAndCountAll','openchannelPause','updatedAt','%s/%s','createdAt','getTeams','findOne','Team','length','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','UserOpenchannelQueue','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all'];(function(_0x5de7e8,_0x4ce50f){var _0x387fdb=function(_0x3de485){while(--_0x3de485){_0x5de7e8['push'](_0x5de7e8['shift']());}};_0x387fdb(++_0x4ce50f);}(_0x2e0b,0x1b0));var _0xb2e0=function(_0x5ea79d,_0x2b6657){_0x5ea79d=_0x5ea79d-0x0;var _0x3c2b27=_0x2e0b[_0x5ea79d];return _0x3c2b27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2e0('0x0'));var zipdir=require(_0xb2e0('0x1'));var jsonpatch=require(_0xb2e0('0x2'));var rp=require(_0xb2e0('0x3'));var moment=require(_0xb2e0('0x4'));var BPromise=require(_0xb2e0('0x5'));var Mustache=require('mustache');var util=require(_0xb2e0('0x6'));var path=require('path');var sox=require(_0xb2e0('0x7'));var csv=require(_0xb2e0('0x8'));var ejs=require(_0xb2e0('0x9'));var fs=require('fs');var fs_extra=require(_0xb2e0('0xa'));var _=require(_0xb2e0('0xb'));var squel=require(_0xb2e0('0xc'));var crypto=require(_0xb2e0('0xd'));var jsforce=require(_0xb2e0('0xe'));var deskjs=require(_0xb2e0('0xf'));var toCsv=require(_0xb2e0('0x8'));var querystring=require(_0xb2e0('0x10'));var Papa=require(_0xb2e0('0x11'));var Redis=require('ioredis');var authService=require(_0xb2e0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2e0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2e0('0x14'))('api');var utils=require(_0xb2e0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb2e0('0x16'))['db'];config[_0xb2e0('0x17')]=_[_0xb2e0('0x18')](config['redis'],{'host':_0xb2e0('0x19'),'port':0x18eb});var socket=require(_0xb2e0('0x1a'))(new Redis(config[_0xb2e0('0x17')]));require('./openchannelQueue.socket')[_0xb2e0('0x1b')](socket);function respondWithStatusCode(_0x2a1647,_0x483600){_0x483600=_0x483600||0xcc;return function(_0x12cb67){if(_0x12cb67){return _0x2a1647[_0xb2e0('0x1c')](_0x483600);}return _0x2a1647[_0xb2e0('0x1d')](_0x483600)['end']();};}function respondWithResult(_0x55489a,_0x59a93a){_0x59a93a=_0x59a93a||0xc8;return function(_0x5f5484){if(_0x5f5484){return _0x55489a[_0xb2e0('0x1d')](_0x59a93a)[_0xb2e0('0x1e')](_0x5f5484);}};}function respondWithFilteredResult(_0x2efb8d,_0x3e2f9e){return function(_0x41eca5){if(_0x41eca5){var _0x31444f=typeof _0x3e2f9e['offset']===_0xb2e0('0x1f')&&typeof _0x3e2f9e[_0xb2e0('0x20')]===_0xb2e0('0x1f');var _0x350aa4=_0x41eca5[_0xb2e0('0x21')];var _0x19e350=_0x31444f?0x0:_0x3e2f9e[_0xb2e0('0x22')];var _0x4f2382=_0x31444f?_0x41eca5[_0xb2e0('0x21')]:_0x3e2f9e[_0xb2e0('0x22')]+_0x3e2f9e['limit'];var _0x4043ae;if(_0x4f2382>=_0x350aa4){_0x4f2382=_0x350aa4;_0x4043ae=0xc8;}else{_0x4043ae=0xce;}_0x2efb8d['status'](_0x4043ae);return _0x2efb8d[_0xb2e0('0x23')](_0xb2e0('0x24'),_0x19e350+'-'+_0x4f2382+'/'+_0x350aa4)['json'](_0x41eca5);}return null;};}function patchUpdates(_0x3ca630){return function(_0x3b114c){try{jsonpatch[_0xb2e0('0x25')](_0x3b114c,_0x3ca630,!![]);}catch(_0x4d7bc3){return BPromise['reject'](_0x4d7bc3);}return _0x3b114c[_0xb2e0('0x26')]();};}function saveUpdates(_0x5c7b06,_0x3dda1e){return function(_0x83b938){if(_0x83b938){return _0x83b938[_0xb2e0('0x27')](_0x5c7b06)['then'](function(_0x3bf1ac){return _0x3bf1ac;});}return null;};}function removeEntity(_0x267fb5,_0x59d84e){return function(_0x83475f){if(_0x83475f){return _0x83475f[_0xb2e0('0x28')]()[_0xb2e0('0x29')](function(){var _0x229134=_0x83475f['get']({'plain':!![]});var _0xed42c7=_0xb2e0('0x2a');return db[_0xb2e0('0x2b')]['destroy']({'where':{'type':_0xed42c7,'resourceId':_0x229134['id']}})[_0xb2e0('0x29')](function(){return _0x83475f;});})[_0xb2e0('0x29')](function(){_0x267fb5[_0xb2e0('0x1d')](0xcc)[_0xb2e0('0x2c')]();});}};}function handleEntityNotFound(_0x2e46f2,_0x306780){return function(_0x43c3b1){if(!_0x43c3b1){_0x2e46f2[_0xb2e0('0x1c')](0x194);}return _0x43c3b1;};}function handleError(_0x1148d4,_0x3cc20d){_0x3cc20d=_0x3cc20d||0x1f4;return function(_0xccb585){logger['error'](_0xccb585[_0xb2e0('0x2d')]);if(_0xccb585[_0xb2e0('0x2e')]){delete _0xccb585[_0xb2e0('0x2e')];}_0x1148d4['status'](_0x3cc20d)['send'](_0xccb585);};}exports[_0xb2e0('0x2f')]=function(_0x5802c5,_0x3231de){var _0x430dfc={},_0x66cbd7={},_0x198e4a={'count':0x0,'rows':[]};var _0x32380e=_[_0xb2e0('0x30')](db[_0xb2e0('0x31')][_0xb2e0('0x32')],function(_0x4b97a8){return{'name':_0x4b97a8[_0xb2e0('0x33')],'type':_0x4b97a8['type'][_0xb2e0('0x34')]};});_0x66cbd7['model']=_[_0xb2e0('0x30')](_0x32380e,'name');_0x66cbd7[_0xb2e0('0x35')]=_[_0xb2e0('0x36')](_0x5802c5[_0xb2e0('0x35')]);_0x66cbd7['filters']=_[_0xb2e0('0x37')](_0x66cbd7['model'],_0x66cbd7['query']);_0x430dfc['attributes']=_[_0xb2e0('0x37')](_0x66cbd7['model'],qs[_0xb2e0('0x38')](_0x5802c5[_0xb2e0('0x35')]['fields']));_0x430dfc['attributes']=_0x430dfc[_0xb2e0('0x39')]['length']?_0x430dfc[_0xb2e0('0x39')]:_0x66cbd7[_0xb2e0('0x3a')];if(!_0x5802c5[_0xb2e0('0x35')][_0xb2e0('0x3b')]('nolimit')){_0x430dfc[_0xb2e0('0x20')]=qs[_0xb2e0('0x20')](_0x5802c5[_0xb2e0('0x35')][_0xb2e0('0x20')]);_0x430dfc['offset']=qs[_0xb2e0('0x22')](_0x5802c5[_0xb2e0('0x35')]['offset']);}_0x430dfc['order']=qs[_0xb2e0('0x3c')](_0x5802c5[_0xb2e0('0x35')][_0xb2e0('0x3c')]);_0x430dfc['where']=qs[_0xb2e0('0x3d')](_['pick'](_0x5802c5[_0xb2e0('0x35')],_0x66cbd7[_0xb2e0('0x3d')]),_0x32380e);if(_0x5802c5['query'][_0xb2e0('0x3e')]){_0x430dfc[_0xb2e0('0x3f')]=_[_0xb2e0('0x40')](_0x430dfc[_0xb2e0('0x3f')],{'$or':_['map'](_0x32380e,function(_0x44b8b8){if(_0x44b8b8['type']!=='VIRTUAL'){var _0x35c207={};_0x35c207[_0x44b8b8[_0xb2e0('0x2e')]]={'$like':'%'+_0x5802c5['query']['filter']+'%'};return _0x35c207;}})});}_0x430dfc=_[_0xb2e0('0x40')]({},_0x430dfc,_0x5802c5[_0xb2e0('0x41')]);var _0x1a19c5={'where':_0x430dfc[_0xb2e0('0x3f')]};return db[_0xb2e0('0x31')][_0xb2e0('0x21')](_0x1a19c5)[_0xb2e0('0x29')](function(_0xbac004){_0x198e4a['count']=_0xbac004;if(_0x5802c5[_0xb2e0('0x35')][_0xb2e0('0x42')]){_0x430dfc[_0xb2e0('0x43')]=[{'all':!![]}];}return db[_0xb2e0('0x31')][_0xb2e0('0x44')](_0x430dfc);})[_0xb2e0('0x29')](function(_0x2aaaf1){_0x198e4a[_0xb2e0('0x45')]=_0x2aaaf1;return _0x198e4a;})[_0xb2e0('0x29')](respondWithFilteredResult(_0x3231de,_0x430dfc))['catch'](handleError(_0x3231de,null));};exports['show']=function(_0x4b4640,_0xf78d4c){var _0x489690={'raw':!![],'where':{'id':_0x4b4640[_0xb2e0('0x46')]['id']}},_0x4ab043={};_0x4ab043[_0xb2e0('0x3a')]=_['keys'](db[_0xb2e0('0x31')]['rawAttributes']);_0x4ab043[_0xb2e0('0x35')]=_[_0xb2e0('0x36')](_0x4b4640[_0xb2e0('0x35')]);_0x4ab043[_0xb2e0('0x3d')]=_[_0xb2e0('0x37')](_0x4ab043[_0xb2e0('0x3a')],_0x4ab043['query']);_0x489690[_0xb2e0('0x39')]=_[_0xb2e0('0x37')](_0x4ab043[_0xb2e0('0x3a')],qs['fields'](_0x4b4640[_0xb2e0('0x35')][_0xb2e0('0x38')]));_0x489690[_0xb2e0('0x39')]=_0x489690[_0xb2e0('0x39')]['length']?_0x489690[_0xb2e0('0x39')]:_0x4ab043[_0xb2e0('0x3a')];if(_0x4b4640['query']['includeAll']){_0x489690[_0xb2e0('0x43')]=[{'all':!![]}];}_0x489690=_[_0xb2e0('0x40')]({},_0x489690,_0x4b4640[_0xb2e0('0x41')]);return db[_0xb2e0('0x31')][_0xb2e0('0x47')](_0x489690)[_0xb2e0('0x29')](handleEntityNotFound(_0xf78d4c,null))[_0xb2e0('0x29')](respondWithResult(_0xf78d4c,null))[_0xb2e0('0x48')](handleError(_0xf78d4c,null));};exports[_0xb2e0('0x49')]=function(_0xb522dc,_0x4f75a1){return db[_0xb2e0('0x31')][_0xb2e0('0x49')](_0xb522dc[_0xb2e0('0x4a')],{})['then'](function(_0x2d56d3){var _0x28931f=_0xb522dc[_0xb2e0('0x4b')][_0xb2e0('0x4c')]({'plain':!![]});if(!_0x28931f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28931f[_0xb2e0('0x4d')]===_0xb2e0('0x4b')){var _0x476474=_0x2d56d3[_0xb2e0('0x4c')]({'plain':!![]});var _0x14d1e0='OpenchannelQueues';return db[_0xb2e0('0x4e')][_0xb2e0('0x47')]({'where':{'name':_0x14d1e0,'userProfileId':_0x28931f[_0xb2e0('0x4f')]},'raw':!![]})[_0xb2e0('0x29')](function(_0x3a3ec5){if(_0x3a3ec5&&_0x3a3ec5['autoAssociation']===0x0){return db[_0xb2e0('0x2b')][_0xb2e0('0x49')]({'name':_0x476474[_0xb2e0('0x2e')],'resourceId':_0x476474['id'],'type':_0x3a3ec5['name'],'sectionId':_0x3a3ec5['id']},{})['then'](function(){return _0x2d56d3;});}else{return _0x2d56d3;}})[_0xb2e0('0x48')](function(_0x3785f6){logger['error'](_0xb2e0('0x50'),_0x3785f6);throw _0x3785f6;});}return _0x2d56d3;})[_0xb2e0('0x29')](respondWithResult(_0x4f75a1,0xc9))[_0xb2e0('0x48')](handleError(_0x4f75a1,null));};exports[_0xb2e0('0x27')]=function(_0x56d771,_0x1f810a){if(_0x56d771[_0xb2e0('0x4a')]['id']){delete _0x56d771[_0xb2e0('0x4a')]['id'];}return db[_0xb2e0('0x31')]['find']({'where':{'id':_0x56d771[_0xb2e0('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f810a,null))[_0xb2e0('0x29')](saveUpdates(_0x56d771[_0xb2e0('0x4a')],null))[_0xb2e0('0x29')](respondWithResult(_0x1f810a,null))[_0xb2e0('0x48')](handleError(_0x1f810a,null));};exports[_0xb2e0('0x28')]=function(_0x4b10ac,_0x203c8c){return db['OpenchannelQueue'][_0xb2e0('0x47')]({'where':{'id':_0x4b10ac[_0xb2e0('0x46')]['id']}})[_0xb2e0('0x29')](handleEntityNotFound(_0x203c8c,null))[_0xb2e0('0x29')](removeEntity(_0x203c8c,null))[_0xb2e0('0x48')](handleError(_0x203c8c,null));};exports['describe']=function(_0x3145eb,_0x2b0c19){return db[_0xb2e0('0x31')][_0xb2e0('0x51')]()[_0xb2e0('0x29')](respondWithResult(_0x2b0c19,null))[_0xb2e0('0x48')](handleError(_0x2b0c19,null));};exports[_0xb2e0('0x52')]=function(_0x431a8a,_0x520162,_0x543a56){var _0x4f0c6a={'raw':!![],'where':{}},_0x302c0e={},_0x143879;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x431a8a['params']['id']}})['then'](handleEntityNotFound(_0x520162,null))['then'](function(_0x14a0cc){if(_0x14a0cc){_0x143879=_0x14a0cc['get']({'plain':!![]});_0x302c0e['model']=_[_0xb2e0('0x36')](db['UserOpenchannelQueue']['rawAttributes']);_0x302c0e[_0xb2e0('0x35')]=_[_0xb2e0('0x36')](_0x431a8a['query']);_0x302c0e['filters']=_[_0xb2e0('0x37')](_0x302c0e[_0xb2e0('0x3a')],_0x302c0e[_0xb2e0('0x35')]);_0x4f0c6a[_0xb2e0('0x39')]=_[_0xb2e0('0x37')](_0x302c0e[_0xb2e0('0x3a')],qs['fields'](_0x431a8a[_0xb2e0('0x35')]['fields']));_0x4f0c6a['attributes']=_0x4f0c6a['attributes']['length']?_0x4f0c6a[_0xb2e0('0x39')]:_0x302c0e['model'];if(!_0x431a8a[_0xb2e0('0x35')][_0xb2e0('0x3b')](_0xb2e0('0x53'))){_0x4f0c6a['limit']=qs['limit'](_0x431a8a[_0xb2e0('0x35')][_0xb2e0('0x20')]);_0x4f0c6a[_0xb2e0('0x22')]=qs[_0xb2e0('0x22')](_0x431a8a[_0xb2e0('0x35')]['offset']);}_0x4f0c6a[_0xb2e0('0x54')]=qs[_0xb2e0('0x3c')](_0x431a8a['query'][_0xb2e0('0x3c')]);_0x4f0c6a['where']=qs[_0xb2e0('0x3d')](_[_0xb2e0('0x55')](_0x431a8a[_0xb2e0('0x35')],_0x302c0e[_0xb2e0('0x3d')]));_0x4f0c6a[_0xb2e0('0x3f')][_0xb2e0('0x56')]=_0x14a0cc['id'];if(_0x431a8a['query'][_0xb2e0('0x3e')]){_0x4f0c6a['where']=_[_0xb2e0('0x40')](_0x4f0c6a[_0xb2e0('0x3f')],{'$or':_[_0xb2e0('0x30')](_0x4f0c6a[_0xb2e0('0x39')],function(_0x809331){var _0x5eb21d={};_0x5eb21d[_0x809331]={'$like':'%'+_0x431a8a[_0xb2e0('0x35')][_0xb2e0('0x3e')]+'%'};return _0x5eb21d;})});}_0x4f0c6a=_['merge']({},_0x4f0c6a,_0x431a8a[_0xb2e0('0x41')]);return db['UserOpenchannelQueue'][_0xb2e0('0x44')](_0x4f0c6a);}})[_0xb2e0('0x29')](function(_0x18e010){if(_0x18e010){return db[_0xb2e0('0x57')][_0xb2e0('0x58')]({'where':{'id':_[_0xb2e0('0x30')](_0x18e010,'UserId'),'role':'agent'},'attributes':['id',_0xb2e0('0x2e'),_0xb2e0('0x59'),_0xb2e0('0x5a'),'createdAt']});}})['then'](function(_0x47d923){if(_0x47d923){return{'count':_0x47d923[_0xb2e0('0x21')],'rows':_['map'](_0x47d923[_0xb2e0('0x45')],function(_0x12f97e){return{'membername':_0x12f97e['name'],'UserId':_0x12f97e['id'],'queue_name':_0x143879[_0xb2e0('0x2e')],'OpenchannelQueueId':_0x143879['id'],'interface':util['format'](_0xb2e0('0x5b'),'SIP',_0x12f97e['name']),'penalty':0x0,'paused':_0x12f97e['openchannelPause'],'createdAt':_0x12f97e[_0xb2e0('0x5c')],'updatedAt':_0x12f97e[_0xb2e0('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x520162,_0x4f0c6a))[_0xb2e0('0x48')](handleError(_0x520162,null));};exports[_0xb2e0('0x5d')]=function(_0x5b8949,_0x29b912,_0x11832e){var _0x4a1cae={};var _0x515382={};var _0xa1e625;var _0x78a96;return db['OpenchannelQueue'][_0xb2e0('0x5e')]({'where':{'id':_0x5b8949[_0xb2e0('0x46')]['id']}})[_0xb2e0('0x29')](handleEntityNotFound(_0x29b912,null))[_0xb2e0('0x29')](function(_0x592ae5){if(_0x592ae5){_0xa1e625=_0x592ae5;_0x515382[_0xb2e0('0x3a')]=_[_0xb2e0('0x36')](db[_0xb2e0('0x5f')][_0xb2e0('0x32')]);_0x515382[_0xb2e0('0x35')]=_['keys'](_0x5b8949[_0xb2e0('0x35')]);_0x515382[_0xb2e0('0x3d')]=_[_0xb2e0('0x37')](_0x515382[_0xb2e0('0x3a')],_0x515382['query']);_0x4a1cae[_0xb2e0('0x39')]=_['intersection'](_0x515382[_0xb2e0('0x3a')],qs[_0xb2e0('0x38')](_0x5b8949[_0xb2e0('0x35')][_0xb2e0('0x38')]));_0x4a1cae[_0xb2e0('0x39')]=_0x4a1cae['attributes'][_0xb2e0('0x60')]?_0x4a1cae[_0xb2e0('0x39')]:_0x515382[_0xb2e0('0x3a')];_0x4a1cae[_0xb2e0('0x54')]=qs[_0xb2e0('0x3c')](_0x5b8949[_0xb2e0('0x35')]['sort']);_0x4a1cae['where']=qs['filters'](_['pick'](_0x5b8949[_0xb2e0('0x35')],_0x515382['filters']));if(_0x5b8949[_0xb2e0('0x35')]['filter']){_0x4a1cae[_0xb2e0('0x3f')]=_[_0xb2e0('0x40')](_0x4a1cae[_0xb2e0('0x3f')],{'$or':_[_0xb2e0('0x30')](_0x4a1cae[_0xb2e0('0x39')],function(_0x4a8159){var _0xf5c07e={};_0xf5c07e[_0x4a8159]={'$like':'%'+_0x5b8949[_0xb2e0('0x35')][_0xb2e0('0x3e')]+'%'};return _0xf5c07e;})});}_0x4a1cae=_['merge']({},_0x4a1cae,_0x5b8949['options']);return _0xa1e625['getTeams'](_0x4a1cae);}})[_0xb2e0('0x29')](function(_0x440838){if(_0x440838){_0x78a96=_0x440838[_0xb2e0('0x60')];if(!_0x5b8949[_0xb2e0('0x35')][_0xb2e0('0x3b')](_0xb2e0('0x53'))){_0x4a1cae[_0xb2e0('0x20')]=qs[_0xb2e0('0x20')](_0x5b8949[_0xb2e0('0x35')][_0xb2e0('0x20')]);_0x4a1cae[_0xb2e0('0x22')]=qs[_0xb2e0('0x22')](_0x5b8949[_0xb2e0('0x35')]['offset']);}return _0xa1e625[_0xb2e0('0x5d')](_0x4a1cae);}})[_0xb2e0('0x29')](function(_0x5f391b){if(_0x5f391b){return _0x5f391b?{'count':_0x78a96,'rows':_0x5f391b}:null;}})[_0xb2e0('0x29')](respondWithResult(_0x29b912,null))[_0xb2e0('0x48')](handleError(_0x29b912,null));};exports['addTeams']=function(_0x3efd4f,_0x4971e3,_0x467a78){var _0x2ecff5=_0x3efd4f[_0xb2e0('0x4a')]['ids'];return db[_0xb2e0('0x5f')][_0xb2e0('0x44')]({'where':{'id':_0x2ecff5},'attributes':['id'],'include':[{'model':db[_0xb2e0('0x57')],'as':_0xb2e0('0x61'),'attributes':['id','name',_0xb2e0('0x62'),_0xb2e0('0x63'),_0xb2e0('0x64')],'raw':!![]}]})[_0xb2e0('0x29')](function(_0x4b33b7){if(_0x4b33b7){var _0x1e961d=_[_0xb2e0('0x65')](_0x4b33b7,function(_0x149d35){var _0x5ad4b2=_0x149d35['get']({'plain':!![]});return _0x5ad4b2[_0xb2e0('0x61')];});return db[_0xb2e0('0x31')][_0xb2e0('0x47')]({'where':{'id':_0x3efd4f['params']['id']}})[_0xb2e0('0x29')](function(_0x113aab){return db[_0xb2e0('0x66')][_0xb2e0('0x67')](function(_0x4b6f5b){return _0x113aab[_0xb2e0('0x68')](_0x2ecff5,{'transaction':_0x4b6f5b})['then'](function(){return BPromise[_0xb2e0('0x69')](_0x1e961d,function(_0x5f1fcc){return db[_0xb2e0('0x6a')]['findOrCreate']({'where':{'UserId':_0x5f1fcc['id'],'OpenchannelQueueId':_0x3efd4f[_0xb2e0('0x46')]['id']},'transaction':_0x4b6f5b});});})['then'](function(){_0x1e961d[_0xb2e0('0x6b')](function(_0x5c30cd){socket[_0xb2e0('0x6c')](_0xb2e0('0x6d'),{'UserId':_0x5c30cd['id'],'OpenchannelQueueId':_0x113aab['id']});});});});});}})[_0xb2e0('0x29')](respondWithStatusCode(_0x4971e3,null))[_0xb2e0('0x48')](handleError(_0x4971e3,null));};exports[_0xb2e0('0x6e')]=function(_0x482c34,_0x52583b,_0x2e6423){return db[_0xb2e0('0x5f')][_0xb2e0('0x44')]({'where':{'id':_0x482c34[_0xb2e0('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb2e0('0x29')](handleEntityNotFound(_0x52583b,null))[_0xb2e0('0x29')](function(_0x79716a){var _0x10e235=_[_0xb2e0('0x30')](_0x79716a,'id');var _0x3f1fcc=[];var _0x9d1794=[];var _0x5e1980=squel[_0xb2e0('0x6f')]();_0x5e1980[_0xb2e0('0x70')](_0xb2e0('0x71'))[_0xb2e0('0x72')](_0xb2e0('0x73'),'tq')[_0xb2e0('0x74')](_0xb2e0('0x75'),'ut',_0xb2e0('0x76'))[_0xb2e0('0x3f')](_0xb2e0('0x77'),_0x482c34[_0xb2e0('0x46')]['id']);for(var _0x1b0a2b=0x0;_0x1b0a2b<_0x79716a['length'];_0x1b0a2b+=0x1){let _0x408b44=_0x79716a[_0x1b0a2b];for(var _0x2f3781=0x0;_0x2f3781<_0x408b44[_0xb2e0('0x61')][_0xb2e0('0x60')];_0x2f3781+=0x1){let _0x17df62=_0x408b44[_0xb2e0('0x61')][_0x2f3781];var _0xaf97c9=_0x5e1980[_0xb2e0('0x78')]();_0xaf97c9[_0xb2e0('0x3f')](_0xb2e0('0x79'),_0x17df62['id']);_0x9d1794[_0xb2e0('0x7a')](db[_0xb2e0('0x66')]['query'](_0xaf97c9['toString'](),{'type':db['sequelize']['QueryTypes'][_0xb2e0('0x7b')]})[_0xb2e0('0x29')](function(_0x815cf7){if(_0x815cf7[_0xb2e0('0x60')]===0x1){return _0x17df62['id'];}else{var _0x13ea6e=_[_0xb2e0('0x7c')](_['map'](_0x815cf7,_0xb2e0('0x7d')),function(_0x3ed33){return _[_0xb2e0('0x7e')](_0x10e235,_0x3ed33);});if(_0x13ea6e){return _0x17df62['id'];}}}));}}return BPromise[_0xb2e0('0x7f')](_0x9d1794)[_0xb2e0('0x29')](function(_0x148426){_0x3f1fcc=_(_0x3f1fcc)[_0xb2e0('0x80')](_0x148426)[_0xb2e0('0x81')]()[_0xb2e0('0x82')]();return db[_0xb2e0('0x31')][_0xb2e0('0x47')]({'where':{'id':_0x482c34[_0xb2e0('0x46')]['id']}})[_0xb2e0('0x29')](function(_0x22891f){return db[_0xb2e0('0x66')][_0xb2e0('0x67')](function(_0x1f78fc){return _0x22891f[_0xb2e0('0x6e')](_0x482c34[_0xb2e0('0x35')]['ids'],{'transaction':_0x1f78fc})[_0xb2e0('0x29')](function(){if(!_[_0xb2e0('0x83')](_0x3f1fcc)){return _0x22891f[_0xb2e0('0x84')](_0x3f1fcc,{'transaction':_0x1f78fc});}})['then'](function(){_0x3f1fcc['forEach'](function(_0x30a38a){socket[_0xb2e0('0x6c')](_0xb2e0('0x85'),{'UserId':_0x30a38a,'OpenchannelQueueId':_0x22891f['id']});});});});});});})[_0xb2e0('0x29')](respondWithStatusCode(_0x52583b,null))[_0xb2e0('0x48')](handleError(_0x52583b,null));};exports[_0xb2e0('0x86')]=function(_0x8fdc92,_0x39202e,_0x2daf11){return db['OpenchannelQueue'][_0xb2e0('0x47')]({'where':{'id':_0x8fdc92[_0xb2e0('0x46')]['id']}})[_0xb2e0('0x29')](handleEntityNotFound(_0x39202e,null))[_0xb2e0('0x29')](function(_0xdb2904){if(_0xdb2904){return _0xdb2904[_0xb2e0('0x86')](_0x8fdc92[_0xb2e0('0x4a')][_0xb2e0('0x87')],_[_0xb2e0('0x88')](_0x8fdc92[_0xb2e0('0x4a')],[_0xb2e0('0x87'),'id'])||{})[_0xb2e0('0x89')](function(_0x2e9154){for(var _0x157554=0x0;_0x157554<_0x8fdc92[_0xb2e0('0x4a')]['ids'][_0xb2e0('0x60')];_0x157554+=0x1){socket[_0xb2e0('0x6c')](_0xb2e0('0x6d'),{'UserId':Number(_0x8fdc92[_0xb2e0('0x4a')][_0xb2e0('0x87')][_0x157554]),'OpenchannelQueueId':Number(_0x8fdc92['params']['id'])});}return _0x2e9154;});}})[_0xb2e0('0x29')](respondWithResult(_0x39202e,null))[_0xb2e0('0x48')](handleError(_0x39202e,null));};exports[_0xb2e0('0x84')]=function(_0x59fc23,_0x432c04,_0x3fd2e6){return db[_0xb2e0('0x31')]['find']({'where':{'id':_0x59fc23['params']['id']}})[_0xb2e0('0x29')](handleEntityNotFound(_0x432c04,null))[_0xb2e0('0x29')](function(_0x521f2f){if(_0x521f2f){return _0x521f2f['removeAgents'](_0x59fc23[_0xb2e0('0x35')][_0xb2e0('0x87')])[_0xb2e0('0x29')](function(){if(_[_0xb2e0('0x8a')](_0x59fc23[_0xb2e0('0x35')][_0xb2e0('0x87')])){for(var _0x9dc380=0x0;_0x9dc380<_0x59fc23['query'][_0xb2e0('0x87')][_0xb2e0('0x60')];_0x9dc380+=0x1){socket[_0xb2e0('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x59fc23['query'][_0xb2e0('0x87')][_0x9dc380]),'OpenchannelQueueId':Number(_0x59fc23[_0xb2e0('0x46')]['id'])});}}else{socket[_0xb2e0('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0x59fc23[_0xb2e0('0x35')]['ids']),'OpenchannelQueueId':Number(_0x59fc23[_0xb2e0('0x46')]['id'])});}});}})[_0xb2e0('0x29')](respondWithStatusCode(_0x432c04,null))[_0xb2e0('0x48')](handleError(_0x432c04,null));};exports[_0xb2e0('0x8b')]=function(_0x59a7e1,_0x35dc80,_0x6d977a){var _0x112a9f={};var _0x3ae0be={};var _0x4b96b0;var _0x309d62;return db[_0xb2e0('0x31')][_0xb2e0('0x5e')]({'where':{'id':_0x59a7e1[_0xb2e0('0x46')]['id']}})[_0xb2e0('0x29')](handleEntityNotFound(_0x35dc80,null))['then'](function(_0x3350ea){if(_0x3350ea){_0x4b96b0=_0x3350ea;_0x3ae0be[_0xb2e0('0x3a')]=_[_0xb2e0('0x36')](db[_0xb2e0('0x57')][_0xb2e0('0x32')]);_0x3ae0be[_0xb2e0('0x35')]=_[_0xb2e0('0x36')](_0x59a7e1[_0xb2e0('0x35')]);_0x3ae0be[_0xb2e0('0x3d')]=_[_0xb2e0('0x37')](_0x3ae0be[_0xb2e0('0x3a')],_0x3ae0be[_0xb2e0('0x35')]);_0x112a9f[_0xb2e0('0x39')]=_[_0xb2e0('0x37')](_0x3ae0be[_0xb2e0('0x3a')],qs['fields'](_0x59a7e1[_0xb2e0('0x35')]['fields']));_0x112a9f[_0xb2e0('0x39')]=_0x112a9f[_0xb2e0('0x39')][_0xb2e0('0x60')]?_0x112a9f['attributes']:_0x3ae0be[_0xb2e0('0x3a')];_0x112a9f[_0xb2e0('0x54')]=qs[_0xb2e0('0x3c')](_0x59a7e1[_0xb2e0('0x35')][_0xb2e0('0x3c')]);_0x112a9f[_0xb2e0('0x3f')]=qs[_0xb2e0('0x3d')](_[_0xb2e0('0x55')](_0x59a7e1[_0xb2e0('0x35')],_0x3ae0be[_0xb2e0('0x3d')]));if(_0x59a7e1[_0xb2e0('0x35')][_0xb2e0('0x3e')]){_0x112a9f[_0xb2e0('0x3f')]=_[_0xb2e0('0x40')](_0x112a9f[_0xb2e0('0x3f')],{'$or':_[_0xb2e0('0x30')](_0x112a9f[_0xb2e0('0x39')],function(_0x2f022c){var _0x369d40={};_0x369d40[_0x2f022c]={'$like':'%'+_0x59a7e1[_0xb2e0('0x35')][_0xb2e0('0x3e')]+'%'};return _0x369d40;})});}_0x112a9f=_[_0xb2e0('0x40')]({},_0x112a9f,_0x59a7e1[_0xb2e0('0x41')]);return _0x4b96b0[_0xb2e0('0x8b')](_0x112a9f);}})[_0xb2e0('0x29')](function(_0x314ac6){if(_0x314ac6){_0x309d62=_0x314ac6[_0xb2e0('0x60')];if(!_0x59a7e1[_0xb2e0('0x35')][_0xb2e0('0x3b')](_0xb2e0('0x53'))){_0x112a9f[_0xb2e0('0x20')]=qs[_0xb2e0('0x20')](_0x59a7e1['query'][_0xb2e0('0x20')]);_0x112a9f['offset']=qs['offset'](_0x59a7e1[_0xb2e0('0x35')][_0xb2e0('0x22')]);}return _0x4b96b0[_0xb2e0('0x8b')](_0x112a9f);}})['then'](function(_0x35f64b){if(_0x35f64b){return _0x35f64b?{'count':_0x309d62,'rows':_0x35f64b}:null;}})[_0xb2e0('0x29')](respondWithResult(_0x35dc80,null))['catch'](handleError(_0x35dc80,null));}; \ No newline at end of file +var _0x9fe7=['ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','save','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','map','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues'];(function(_0x152052,_0x5e57bb){var _0x11f41d=function(_0x873644){while(--_0x873644){_0x152052['push'](_0x152052['shift']());}};_0x11f41d(++_0x5e57bb);}(_0x9fe7,0xa3));var _0x79fe=function(_0x544e0f,_0x248084){_0x544e0f=_0x544e0f-0x0;var _0x27eff9=_0x9fe7[_0x544e0f];return _0x27eff9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x79fe('0x0'));var zipdir=require(_0x79fe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79fe('0x2'));var moment=require(_0x79fe('0x3'));var BPromise=require(_0x79fe('0x4'));var Mustache=require(_0x79fe('0x5'));var util=require(_0x79fe('0x6'));var path=require('path');var sox=require(_0x79fe('0x7'));var csv=require(_0x79fe('0x8'));var ejs=require(_0x79fe('0x9'));var fs=require('fs');var fs_extra=require(_0x79fe('0xa'));var _=require(_0x79fe('0xb'));var squel=require(_0x79fe('0xc'));var crypto=require(_0x79fe('0xd'));var jsforce=require(_0x79fe('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x79fe('0x8'));var querystring=require(_0x79fe('0xf'));var Papa=require(_0x79fe('0x10'));var Redis=require(_0x79fe('0x11'));var authService=require(_0x79fe('0x12'));var qs=require(_0x79fe('0x13'));var as=require(_0x79fe('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x79fe('0x15'));var utils=require(_0x79fe('0x16'));var config=require(_0x79fe('0x17'));var licenseUtil=require(_0x79fe('0x18'));var db=require(_0x79fe('0x19'))['db'];config[_0x79fe('0x1a')]=_[_0x79fe('0x1b')](config[_0x79fe('0x1a')],{'host':_0x79fe('0x1c'),'port':0x18eb});var socket=require(_0x79fe('0x1d'))(new Redis(config[_0x79fe('0x1a')]));require(_0x79fe('0x1e'))[_0x79fe('0x1f')](socket);function respondWithStatusCode(_0x50bfd9,_0x553825){_0x553825=_0x553825||0xcc;return function(_0x214392){if(_0x214392){return _0x50bfd9[_0x79fe('0x20')](_0x553825);}return _0x50bfd9['status'](_0x553825)[_0x79fe('0x21')]();};}function respondWithResult(_0x50a7fa,_0x5376d8){_0x5376d8=_0x5376d8||0xc8;return function(_0xdc11cf){if(_0xdc11cf){return _0x50a7fa[_0x79fe('0x22')](_0x5376d8)[_0x79fe('0x23')](_0xdc11cf);}};}function respondWithFilteredResult(_0x1ba614,_0x222062){return function(_0x1fd260){if(_0x1fd260){var _0x5a85f3=typeof _0x222062[_0x79fe('0x24')]===_0x79fe('0x25')&&typeof _0x222062[_0x79fe('0x26')]==='undefined';var _0x39aaab=_0x1fd260['count'];var _0x3f0fad=_0x5a85f3?0x0:_0x222062[_0x79fe('0x24')];var _0xa48de4=_0x5a85f3?_0x1fd260[_0x79fe('0x27')]:_0x222062[_0x79fe('0x24')]+_0x222062['limit'];var _0x19ad98;if(_0xa48de4>=_0x39aaab){_0xa48de4=_0x39aaab;_0x19ad98=0xc8;}else{_0x19ad98=0xce;}_0x1ba614[_0x79fe('0x22')](_0x19ad98);return _0x1ba614[_0x79fe('0x28')]('Content-Range',_0x3f0fad+'-'+_0xa48de4+'/'+_0x39aaab)[_0x79fe('0x23')](_0x1fd260);}return null;};}function patchUpdates(_0x53314a){return function(_0x1e0765){try{jsonpatch['apply'](_0x1e0765,_0x53314a,!![]);}catch(_0x4a5f84){return BPromise['reject'](_0x4a5f84);}return _0x1e0765[_0x79fe('0x29')]();};}function saveUpdates(_0x230df1,_0x2c9403){return function(_0x5729ee){if(_0x5729ee){return _0x5729ee['update'](_0x230df1)[_0x79fe('0x2a')](function(_0x39d5fd){return _0x39d5fd;});}return null;};}function removeEntity(_0x3d2268,_0x24498f){return function(_0x5aaaf0){if(_0x5aaaf0){return _0x5aaaf0[_0x79fe('0x2b')]()[_0x79fe('0x2a')](function(){var _0x3a1f05=_0x5aaaf0[_0x79fe('0x2c')]({'plain':!![]});var _0xbbf742=_0x79fe('0x2d');return db[_0x79fe('0x2e')][_0x79fe('0x2b')]({'where':{'type':_0xbbf742,'resourceId':_0x3a1f05['id']}})[_0x79fe('0x2a')](function(){return _0x5aaaf0;});})[_0x79fe('0x2a')](function(){_0x3d2268[_0x79fe('0x22')](0xcc)[_0x79fe('0x21')]();});}};}function handleEntityNotFound(_0x15196f,_0x5a593c){return function(_0x20f8d2){if(!_0x20f8d2){_0x15196f[_0x79fe('0x20')](0x194);}return _0x20f8d2;};}function handleError(_0x289db8,_0x20cc95){_0x20cc95=_0x20cc95||0x1f4;return function(_0x3cecbc){logger[_0x79fe('0x2f')](_0x3cecbc[_0x79fe('0x30')]);if(_0x3cecbc['name']){delete _0x3cecbc[_0x79fe('0x31')];}_0x289db8[_0x79fe('0x22')](_0x20cc95)[_0x79fe('0x32')](_0x3cecbc);};}exports[_0x79fe('0x33')]=function(_0x1033b1,_0x3555bc){var _0x15294c={},_0x24ef77={},_0x1e2f86={'count':0x0,'rows':[]};var _0x4fa009=_['map'](db[_0x79fe('0x34')][_0x79fe('0x35')],function(_0x447942){return{'name':_0x447942[_0x79fe('0x36')],'type':_0x447942['type']['key']};});_0x24ef77['model']=_['map'](_0x4fa009,'name');_0x24ef77[_0x79fe('0x37')]=_[_0x79fe('0x38')](_0x1033b1['query']);_0x24ef77[_0x79fe('0x39')]=_[_0x79fe('0x3a')](_0x24ef77[_0x79fe('0x3b')],_0x24ef77[_0x79fe('0x37')]);_0x15294c[_0x79fe('0x3c')]=_[_0x79fe('0x3a')](_0x24ef77[_0x79fe('0x3b')],qs[_0x79fe('0x3d')](_0x1033b1['query'][_0x79fe('0x3d')]));_0x15294c['attributes']=_0x15294c[_0x79fe('0x3c')][_0x79fe('0x3e')]?_0x15294c[_0x79fe('0x3c')]:_0x24ef77[_0x79fe('0x3b')];if(!_0x1033b1[_0x79fe('0x37')][_0x79fe('0x3f')](_0x79fe('0x40'))){_0x15294c['limit']=qs['limit'](_0x1033b1[_0x79fe('0x37')][_0x79fe('0x26')]);_0x15294c[_0x79fe('0x24')]=qs[_0x79fe('0x24')](_0x1033b1[_0x79fe('0x37')][_0x79fe('0x24')]);}_0x15294c[_0x79fe('0x41')]=qs[_0x79fe('0x42')](_0x1033b1['query'][_0x79fe('0x42')]);_0x15294c[_0x79fe('0x43')]=qs['filters'](_[_0x79fe('0x44')](_0x1033b1[_0x79fe('0x37')],_0x24ef77[_0x79fe('0x39')]),_0x4fa009);if(_0x1033b1['query'][_0x79fe('0x45')]){_0x15294c['where']=_[_0x79fe('0x46')](_0x15294c['where'],{'$or':_['map'](_0x4fa009,function(_0x2cc273){if(_0x2cc273[_0x79fe('0x47')]!==_0x79fe('0x48')){var _0x1c1166={};_0x1c1166[_0x2cc273[_0x79fe('0x31')]]={'$like':'%'+_0x1033b1[_0x79fe('0x37')][_0x79fe('0x45')]+'%'};return _0x1c1166;}})});}_0x15294c=_['merge']({},_0x15294c,_0x1033b1[_0x79fe('0x49')]);var _0x5254c1={'where':_0x15294c['where']};return db[_0x79fe('0x34')][_0x79fe('0x27')](_0x5254c1)[_0x79fe('0x2a')](function(_0x5a65fe){_0x1e2f86[_0x79fe('0x27')]=_0x5a65fe;if(_0x1033b1['query'][_0x79fe('0x4a')]){_0x15294c[_0x79fe('0x4b')]=[{'all':!![]}];}return db[_0x79fe('0x34')][_0x79fe('0x4c')](_0x15294c);})[_0x79fe('0x2a')](function(_0x577ed9){_0x1e2f86[_0x79fe('0x4d')]=_0x577ed9;return _0x1e2f86;})[_0x79fe('0x2a')](respondWithFilteredResult(_0x3555bc,_0x15294c))[_0x79fe('0x4e')](handleError(_0x3555bc,null));};exports[_0x79fe('0x4f')]=function(_0x42d213,_0x5e0c0f){var _0x17e7b7={'raw':!![],'where':{'id':_0x42d213[_0x79fe('0x50')]['id']}},_0x50c29e={};_0x50c29e[_0x79fe('0x3b')]=_['keys'](db[_0x79fe('0x34')][_0x79fe('0x35')]);_0x50c29e[_0x79fe('0x37')]=_[_0x79fe('0x38')](_0x42d213[_0x79fe('0x37')]);_0x50c29e[_0x79fe('0x39')]=_[_0x79fe('0x3a')](_0x50c29e[_0x79fe('0x3b')],_0x50c29e[_0x79fe('0x37')]);_0x17e7b7[_0x79fe('0x3c')]=_[_0x79fe('0x3a')](_0x50c29e[_0x79fe('0x3b')],qs[_0x79fe('0x3d')](_0x42d213[_0x79fe('0x37')][_0x79fe('0x3d')]));_0x17e7b7[_0x79fe('0x3c')]=_0x17e7b7[_0x79fe('0x3c')]['length']?_0x17e7b7[_0x79fe('0x3c')]:_0x50c29e['model'];if(_0x42d213[_0x79fe('0x37')][_0x79fe('0x4a')]){_0x17e7b7['include']=[{'all':!![]}];}_0x17e7b7=_[_0x79fe('0x46')]({},_0x17e7b7,_0x42d213[_0x79fe('0x49')]);return db[_0x79fe('0x34')][_0x79fe('0x51')](_0x17e7b7)['then'](handleEntityNotFound(_0x5e0c0f,null))[_0x79fe('0x2a')](respondWithResult(_0x5e0c0f,null))[_0x79fe('0x4e')](handleError(_0x5e0c0f,null));};exports[_0x79fe('0x52')]=function(_0x26fa95,_0x191c11){return db[_0x79fe('0x34')][_0x79fe('0x52')](_0x26fa95[_0x79fe('0x53')],{})[_0x79fe('0x2a')](function(_0x39d437){var _0x55e4fb=_0x26fa95[_0x79fe('0x54')]['get']({'plain':!![]});if(!_0x55e4fb)throw new Error(_0x79fe('0x55'));if(_0x55e4fb['role']==='user'){var _0x439dab=_0x39d437[_0x79fe('0x2c')]({'plain':!![]});var _0x3df0db=_0x79fe('0x2d');return db[_0x79fe('0x56')]['find']({'where':{'name':_0x3df0db,'userProfileId':_0x55e4fb[_0x79fe('0x57')]},'raw':!![]})['then'](function(_0x2608fe){if(_0x2608fe&&_0x2608fe[_0x79fe('0x58')]===0x0){return db[_0x79fe('0x2e')][_0x79fe('0x52')]({'name':_0x439dab[_0x79fe('0x31')],'resourceId':_0x439dab['id'],'type':_0x2608fe[_0x79fe('0x31')],'sectionId':_0x2608fe['id']},{})['then'](function(){return _0x39d437;});}else{return _0x39d437;}})[_0x79fe('0x4e')](function(_0x213a6a){logger['error'](_0x79fe('0x59'),_0x213a6a);throw _0x213a6a;});}return _0x39d437;})[_0x79fe('0x2a')](respondWithResult(_0x191c11,0xc9))[_0x79fe('0x4e')](handleError(_0x191c11,null));};exports[_0x79fe('0x5a')]=function(_0x4c2380,_0x5b82bd){if(_0x4c2380[_0x79fe('0x53')]['id']){delete _0x4c2380[_0x79fe('0x53')]['id'];}return db[_0x79fe('0x34')][_0x79fe('0x51')]({'where':{'id':_0x4c2380[_0x79fe('0x50')]['id']}})[_0x79fe('0x2a')](handleEntityNotFound(_0x5b82bd,null))[_0x79fe('0x2a')](saveUpdates(_0x4c2380['body'],null))[_0x79fe('0x2a')](respondWithResult(_0x5b82bd,null))[_0x79fe('0x4e')](handleError(_0x5b82bd,null));};exports[_0x79fe('0x2b')]=function(_0xc6d411,_0x31c5be){return db[_0x79fe('0x34')][_0x79fe('0x51')]({'where':{'id':_0xc6d411['params']['id']}})[_0x79fe('0x2a')](handleEntityNotFound(_0x31c5be,null))[_0x79fe('0x2a')](removeEntity(_0x31c5be,null))[_0x79fe('0x4e')](handleError(_0x31c5be,null));};exports[_0x79fe('0x5b')]=function(_0x51ba6f,_0x4781df){return db[_0x79fe('0x34')][_0x79fe('0x5b')]()['then'](respondWithResult(_0x4781df,null))[_0x79fe('0x4e')](handleError(_0x4781df,null));};exports[_0x79fe('0x5c')]=function(_0x3c79f0,_0x268b1f,_0x4529da){var _0x35a7ff={'raw':!![],'where':{}},_0x4c6438={},_0x4017fc;return db[_0x79fe('0x34')][_0x79fe('0x5d')]({'where':{'id':_0x3c79f0['params']['id']}})[_0x79fe('0x2a')](handleEntityNotFound(_0x268b1f,null))[_0x79fe('0x2a')](function(_0x14b439){if(_0x14b439){_0x4017fc=_0x14b439['get']({'plain':!![]});_0x4c6438[_0x79fe('0x3b')]=_[_0x79fe('0x38')](db[_0x79fe('0x5e')][_0x79fe('0x35')]);_0x4c6438['query']=_[_0x79fe('0x38')](_0x3c79f0['query']);_0x4c6438[_0x79fe('0x39')]=_[_0x79fe('0x3a')](_0x4c6438[_0x79fe('0x3b')],_0x4c6438[_0x79fe('0x37')]);_0x35a7ff[_0x79fe('0x3c')]=_[_0x79fe('0x3a')](_0x4c6438[_0x79fe('0x3b')],qs[_0x79fe('0x3d')](_0x3c79f0['query']['fields']));_0x35a7ff['attributes']=_0x35a7ff[_0x79fe('0x3c')][_0x79fe('0x3e')]?_0x35a7ff[_0x79fe('0x3c')]:_0x4c6438[_0x79fe('0x3b')];if(!_0x3c79f0[_0x79fe('0x37')][_0x79fe('0x3f')](_0x79fe('0x40'))){_0x35a7ff[_0x79fe('0x26')]=qs['limit'](_0x3c79f0['query'][_0x79fe('0x26')]);_0x35a7ff[_0x79fe('0x24')]=qs[_0x79fe('0x24')](_0x3c79f0[_0x79fe('0x37')][_0x79fe('0x24')]);}_0x35a7ff['order']=qs[_0x79fe('0x42')](_0x3c79f0['query'][_0x79fe('0x42')]);_0x35a7ff['where']=qs[_0x79fe('0x39')](_[_0x79fe('0x44')](_0x3c79f0['query'],_0x4c6438[_0x79fe('0x39')]));_0x35a7ff[_0x79fe('0x43')][_0x79fe('0x5f')]=_0x14b439['id'];if(_0x3c79f0['query'][_0x79fe('0x45')]){_0x35a7ff['where']=_[_0x79fe('0x46')](_0x35a7ff['where'],{'$or':_[_0x79fe('0x60')](_0x35a7ff[_0x79fe('0x3c')],function(_0x404093){var _0x19c4cf={};_0x19c4cf[_0x404093]={'$like':'%'+_0x3c79f0['query'][_0x79fe('0x45')]+'%'};return _0x19c4cf;})});}_0x35a7ff=_[_0x79fe('0x46')]({},_0x35a7ff,_0x3c79f0[_0x79fe('0x49')]);return db[_0x79fe('0x5e')]['findAll'](_0x35a7ff);}})[_0x79fe('0x2a')](function(_0x38c544){if(_0x38c544){return db[_0x79fe('0x61')][_0x79fe('0x62')]({'where':{'id':_[_0x79fe('0x60')](_0x38c544,_0x79fe('0x63')),'role':_0x79fe('0x64')},'attributes':['id',_0x79fe('0x31'),_0x79fe('0x65'),_0x79fe('0x66'),_0x79fe('0x67')]});}})[_0x79fe('0x2a')](function(_0x103d82){if(_0x103d82){return{'count':_0x103d82['count'],'rows':_[_0x79fe('0x60')](_0x103d82[_0x79fe('0x4d')],function(_0x1a6457){return{'membername':_0x1a6457[_0x79fe('0x31')],'UserId':_0x1a6457['id'],'queue_name':_0x4017fc[_0x79fe('0x31')],'OpenchannelQueueId':_0x4017fc['id'],'interface':util[_0x79fe('0x68')](_0x79fe('0x69'),_0x79fe('0x6a'),_0x1a6457[_0x79fe('0x31')]),'penalty':0x0,'paused':_0x1a6457[_0x79fe('0x65')],'createdAt':_0x1a6457[_0x79fe('0x67')],'updatedAt':_0x1a6457[_0x79fe('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x79fe('0x2a')](respondWithFilteredResult(_0x268b1f,_0x35a7ff))[_0x79fe('0x4e')](handleError(_0x268b1f,null));};exports[_0x79fe('0x6b')]=function(_0x4b4bb8,_0x528757,_0xd9b17){var _0x47dc67={};var _0x10522a={};var _0x5c93b2;var _0x305487;return db[_0x79fe('0x34')]['findOne']({'where':{'id':_0x4b4bb8[_0x79fe('0x50')]['id']}})['then'](handleEntityNotFound(_0x528757,null))['then'](function(_0x2004fc){if(_0x2004fc){_0x5c93b2=_0x2004fc;_0x10522a[_0x79fe('0x3b')]=_[_0x79fe('0x38')](db[_0x79fe('0x6c')][_0x79fe('0x35')]);_0x10522a[_0x79fe('0x37')]=_[_0x79fe('0x38')](_0x4b4bb8[_0x79fe('0x37')]);_0x10522a[_0x79fe('0x39')]=_['intersection'](_0x10522a[_0x79fe('0x3b')],_0x10522a[_0x79fe('0x37')]);_0x47dc67[_0x79fe('0x3c')]=_[_0x79fe('0x3a')](_0x10522a[_0x79fe('0x3b')],qs[_0x79fe('0x3d')](_0x4b4bb8[_0x79fe('0x37')][_0x79fe('0x3d')]));_0x47dc67['attributes']=_0x47dc67['attributes'][_0x79fe('0x3e')]?_0x47dc67['attributes']:_0x10522a['model'];_0x47dc67['order']=qs['sort'](_0x4b4bb8[_0x79fe('0x37')][_0x79fe('0x42')]);_0x47dc67[_0x79fe('0x43')]=qs[_0x79fe('0x39')](_[_0x79fe('0x44')](_0x4b4bb8[_0x79fe('0x37')],_0x10522a[_0x79fe('0x39')]));if(_0x4b4bb8['query'][_0x79fe('0x45')]){_0x47dc67[_0x79fe('0x43')]=_[_0x79fe('0x46')](_0x47dc67[_0x79fe('0x43')],{'$or':_[_0x79fe('0x60')](_0x47dc67[_0x79fe('0x3c')],function(_0x11f69f){var _0x38efc5={};_0x38efc5[_0x11f69f]={'$like':'%'+_0x4b4bb8[_0x79fe('0x37')]['filter']+'%'};return _0x38efc5;})});}_0x47dc67=_[_0x79fe('0x46')]({},_0x47dc67,_0x4b4bb8[_0x79fe('0x49')]);return _0x5c93b2[_0x79fe('0x6b')](_0x47dc67);}})[_0x79fe('0x2a')](function(_0x4e3b95){if(_0x4e3b95){_0x305487=_0x4e3b95['length'];if(!_0x4b4bb8['query'][_0x79fe('0x3f')](_0x79fe('0x40'))){_0x47dc67['limit']=qs[_0x79fe('0x26')](_0x4b4bb8[_0x79fe('0x37')]['limit']);_0x47dc67['offset']=qs['offset'](_0x4b4bb8['query'][_0x79fe('0x24')]);}return _0x5c93b2[_0x79fe('0x6b')](_0x47dc67);}})[_0x79fe('0x2a')](function(_0x5134a8){if(_0x5134a8){return _0x5134a8?{'count':_0x305487,'rows':_0x5134a8}:null;}})[_0x79fe('0x2a')](respondWithResult(_0x528757,null))['catch'](handleError(_0x528757,null));};exports[_0x79fe('0x6d')]=function(_0x3ff64a,_0x2f2377,_0x19e514){var _0x2f5d03=_0x3ff64a['body'][_0x79fe('0x6e')];return db[_0x79fe('0x6c')][_0x79fe('0x4c')]({'where':{'id':_0x2f5d03},'attributes':['id'],'include':[{'model':db[_0x79fe('0x61')],'as':_0x79fe('0x6f'),'attributes':['id','name','online',_0x79fe('0x70'),_0x79fe('0x71')],'raw':!![]}]})[_0x79fe('0x2a')](function(_0x588cd0){if(_0x588cd0){var _0x471b9f=_['flatMap'](_0x588cd0,function(_0x45e2b2){var _0x303d19=_0x45e2b2[_0x79fe('0x2c')]({'plain':!![]});return _0x303d19[_0x79fe('0x6f')];});return db[_0x79fe('0x34')]['find']({'where':{'id':_0x3ff64a[_0x79fe('0x50')]['id']}})['then'](function(_0x293120){return db[_0x79fe('0x72')][_0x79fe('0x73')](function(_0x170eed){return _0x293120[_0x79fe('0x6d')](_0x2f5d03,{'transaction':_0x170eed})[_0x79fe('0x2a')](function(){return BPromise[_0x79fe('0x74')](_0x471b9f,function(_0x4f690){return db['UserOpenchannelQueue'][_0x79fe('0x75')]({'where':{'UserId':_0x4f690['id'],'OpenchannelQueueId':_0x3ff64a['params']['id']},'transaction':_0x170eed});});})['then'](function(){_0x471b9f[_0x79fe('0x76')](function(_0x1426ac){socket[_0x79fe('0x77')](_0x79fe('0x78'),{'UserId':_0x1426ac['id'],'OpenchannelQueueId':_0x293120['id']});});});});});}})[_0x79fe('0x2a')](respondWithStatusCode(_0x2f2377,null))[_0x79fe('0x4e')](handleError(_0x2f2377,null));};exports[_0x79fe('0x79')]=function(_0x404b53,_0x33b745,_0x5348e2){return db[_0x79fe('0x6c')][_0x79fe('0x4c')]({'where':{'id':_0x404b53[_0x79fe('0x37')][_0x79fe('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x79fe('0x61')],'as':_0x79fe('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x79fe('0x2a')](handleEntityNotFound(_0x33b745,null))[_0x79fe('0x2a')](function(_0x4df92d){var _0x532716=_[_0x79fe('0x60')](_0x4df92d,'id');var _0x18a60d=[];var _0x25f3c0=[];var _0x5df02c=squel[_0x79fe('0x7a')]();_0x5df02c[_0x79fe('0x7b')](_0x79fe('0x7c'))[_0x79fe('0x7d')](_0x79fe('0x7e'),'tq')['join']('user_has_teams','ut',_0x79fe('0x7f'))[_0x79fe('0x43')](_0x79fe('0x80'),_0x404b53[_0x79fe('0x50')]['id']);for(var _0x4e8147=0x0;_0x4e8147<_0x4df92d['length'];_0x4e8147+=0x1){let _0x57b55c=_0x4df92d[_0x4e8147];for(var _0x299b77=0x0;_0x299b77<_0x57b55c[_0x79fe('0x6f')][_0x79fe('0x3e')];_0x299b77+=0x1){let _0x1aa557=_0x57b55c['Agents'][_0x299b77];var _0x308c39=_0x5df02c['clone']();_0x308c39[_0x79fe('0x43')](_0x79fe('0x81'),_0x1aa557['id']);_0x25f3c0[_0x79fe('0x82')](db[_0x79fe('0x72')][_0x79fe('0x37')](_0x308c39['toString'](),{'type':db[_0x79fe('0x72')][_0x79fe('0x83')][_0x79fe('0x84')]})[_0x79fe('0x2a')](function(_0x1ca2b8){if(_0x1ca2b8[_0x79fe('0x3e')]===0x1){return _0x1aa557['id'];}else{var _0xfa815a=_[_0x79fe('0x85')](_['map'](_0x1ca2b8,'TeamId'),function(_0x563a38){return _[_0x79fe('0x86')](_0x532716,_0x563a38);});if(_0xfa815a){return _0x1aa557['id'];}}}));}}return BPromise[_0x79fe('0x87')](_0x25f3c0)[_0x79fe('0x2a')](function(_0x3ed4e1){_0x18a60d=_(_0x18a60d)['union'](_0x3ed4e1)[_0x79fe('0x88')]()[_0x79fe('0x89')]();return db['OpenchannelQueue'][_0x79fe('0x51')]({'where':{'id':_0x404b53['params']['id']}})[_0x79fe('0x2a')](function(_0x31bd99){return db[_0x79fe('0x72')]['transaction'](function(_0x23ae56){return _0x31bd99[_0x79fe('0x79')](_0x404b53[_0x79fe('0x37')]['ids'],{'transaction':_0x23ae56})[_0x79fe('0x2a')](function(){if(!_['isEmpty'](_0x18a60d)){return _0x31bd99[_0x79fe('0x8a')](_0x18a60d,{'transaction':_0x23ae56});}})[_0x79fe('0x2a')](function(){_0x18a60d[_0x79fe('0x76')](function(_0x2c2007){socket[_0x79fe('0x77')](_0x79fe('0x8b'),{'UserId':_0x2c2007,'OpenchannelQueueId':_0x31bd99['id']});});});});});});})[_0x79fe('0x2a')](respondWithStatusCode(_0x33b745,null))[_0x79fe('0x4e')](handleError(_0x33b745,null));};exports[_0x79fe('0x8c')]=function(_0x19c4b9,_0x207c7a,_0x27d50a){return db[_0x79fe('0x34')][_0x79fe('0x51')]({'where':{'id':_0x19c4b9[_0x79fe('0x50')]['id']}})[_0x79fe('0x2a')](handleEntityNotFound(_0x207c7a,null))['then'](function(_0x11a8cf){if(_0x11a8cf){return _0x11a8cf[_0x79fe('0x8c')](_0x19c4b9[_0x79fe('0x53')][_0x79fe('0x6e')],_[_0x79fe('0x8d')](_0x19c4b9[_0x79fe('0x53')],['ids','id'])||{})[_0x79fe('0x8e')](function(_0x105224){for(var _0xaac039=0x0;_0xaac039<_0x19c4b9[_0x79fe('0x53')]['ids'][_0x79fe('0x3e')];_0xaac039+=0x1){socket[_0x79fe('0x77')](_0x79fe('0x78'),{'UserId':Number(_0x19c4b9[_0x79fe('0x53')][_0x79fe('0x6e')][_0xaac039]),'OpenchannelQueueId':Number(_0x19c4b9[_0x79fe('0x50')]['id'])});}return _0x105224;});}})[_0x79fe('0x2a')](respondWithResult(_0x207c7a,null))[_0x79fe('0x4e')](handleError(_0x207c7a,null));};exports['removeAgents']=function(_0x450e80,_0x2daf30,_0x5ac1cc){return db[_0x79fe('0x34')]['find']({'where':{'id':_0x450e80[_0x79fe('0x50')]['id']}})[_0x79fe('0x2a')](handleEntityNotFound(_0x2daf30,null))[_0x79fe('0x2a')](function(_0x1f17f1){if(_0x1f17f1){return _0x1f17f1[_0x79fe('0x8a')](_0x450e80[_0x79fe('0x37')]['ids'])[_0x79fe('0x2a')](function(){if(_[_0x79fe('0x8f')](_0x450e80[_0x79fe('0x37')][_0x79fe('0x6e')])){for(var _0x5b032e=0x0;_0x5b032e<_0x450e80['query'][_0x79fe('0x6e')]['length'];_0x5b032e+=0x1){socket[_0x79fe('0x77')](_0x79fe('0x8b'),{'UserId':Number(_0x450e80[_0x79fe('0x37')][_0x79fe('0x6e')][_0x5b032e]),'OpenchannelQueueId':Number(_0x450e80[_0x79fe('0x50')]['id'])});}}else{socket[_0x79fe('0x77')](_0x79fe('0x8b'),{'UserId':Number(_0x450e80[_0x79fe('0x37')]['ids']),'OpenchannelQueueId':Number(_0x450e80[_0x79fe('0x50')]['id'])});}});}})[_0x79fe('0x2a')](respondWithStatusCode(_0x2daf30,null))[_0x79fe('0x4e')](handleError(_0x2daf30,null));};exports[_0x79fe('0x90')]=function(_0x482706,_0x4cdd59,_0x5da45d){var _0x51f348={};var _0x1302e1={};var _0x2eae65;var _0x5909d6;return db[_0x79fe('0x34')]['findOne']({'where':{'id':_0x482706[_0x79fe('0x50')]['id']}})['then'](handleEntityNotFound(_0x4cdd59,null))[_0x79fe('0x2a')](function(_0x4f96b9){if(_0x4f96b9){_0x2eae65=_0x4f96b9;_0x1302e1[_0x79fe('0x3b')]=_[_0x79fe('0x38')](db[_0x79fe('0x61')]['rawAttributes']);_0x1302e1[_0x79fe('0x37')]=_['keys'](_0x482706[_0x79fe('0x37')]);_0x1302e1[_0x79fe('0x39')]=_[_0x79fe('0x3a')](_0x1302e1['model'],_0x1302e1[_0x79fe('0x37')]);_0x51f348['attributes']=_['intersection'](_0x1302e1[_0x79fe('0x3b')],qs['fields'](_0x482706['query'][_0x79fe('0x3d')]));_0x51f348[_0x79fe('0x3c')]=_0x51f348[_0x79fe('0x3c')][_0x79fe('0x3e')]?_0x51f348[_0x79fe('0x3c')]:_0x1302e1['model'];_0x51f348[_0x79fe('0x41')]=qs[_0x79fe('0x42')](_0x482706[_0x79fe('0x37')][_0x79fe('0x42')]);_0x51f348[_0x79fe('0x43')]=qs[_0x79fe('0x39')](_[_0x79fe('0x44')](_0x482706['query'],_0x1302e1['filters']));if(_0x482706[_0x79fe('0x37')][_0x79fe('0x45')]){_0x51f348['where']=_[_0x79fe('0x46')](_0x51f348['where'],{'$or':_['map'](_0x51f348['attributes'],function(_0x1345f1){var _0x4633f2={};_0x4633f2[_0x1345f1]={'$like':'%'+_0x482706[_0x79fe('0x37')][_0x79fe('0x45')]+'%'};return _0x4633f2;})});}_0x51f348=_[_0x79fe('0x46')]({},_0x51f348,_0x482706[_0x79fe('0x49')]);return _0x2eae65[_0x79fe('0x90')](_0x51f348);}})[_0x79fe('0x2a')](function(_0x20fed3){if(_0x20fed3){_0x5909d6=_0x20fed3['length'];if(!_0x482706[_0x79fe('0x37')][_0x79fe('0x3f')](_0x79fe('0x40'))){_0x51f348[_0x79fe('0x26')]=qs[_0x79fe('0x26')](_0x482706[_0x79fe('0x37')][_0x79fe('0x26')]);_0x51f348['offset']=qs[_0x79fe('0x24')](_0x482706['query'][_0x79fe('0x24')]);}return _0x2eae65['getAgents'](_0x51f348);}})[_0x79fe('0x2a')](function(_0x441b5f){if(_0x441b5f){return _0x441b5f?{'count':_0x5909d6,'rows':_0x441b5f}:null;}})[_0x79fe('0x2a')](respondWithResult(_0x4cdd59,null))[_0x79fe('0x4e')](handleError(_0x4cdd59,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index febf95f..1d5660d 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 _0xf759=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x187826,_0x357251){var _0x2c22f5=function(_0x19159e){while(--_0x19159e){_0x187826['push'](_0x187826['shift']());}};_0x2c22f5(++_0x357251);}(_0xf759,0x1e1));var _0x9f75=function(_0x149c2f,_0x1cd398){_0x149c2f=_0x149c2f-0x0;var _0x3e4162=_0xf759[_0x149c2f];return _0x3e4162;};'use strict';var EventEmitter=require(_0x9f75('0x0'));var OpenchannelQueue=require(_0x9f75('0x1'))['db'][_0x9f75('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9f75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50cb7f){return function(_0x4523b4,_0xf6b09b,_0x48841c){OpenchannelQueueEvents['emit'](_0x50cb7f+':'+_0x4523b4['id'],_0x4523b4);OpenchannelQueueEvents[_0x9f75('0x4')](_0x50cb7f,_0x4523b4);_0x48841c(null);};}for(var e in events){if(events[_0x9f75('0x5')](e)){var event=events[e];OpenchannelQueue[_0x9f75('0x6')](e,emitEvent(event));}}module[_0x9f75('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xdf79=['save','update','remove','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0xf4a348,_0x2d53c2){var _0x1029fa=function(_0x411ac3){while(--_0x411ac3){_0xf4a348['push'](_0xf4a348['shift']());}};_0x1029fa(++_0x2d53c2);}(_0xdf79,0x72));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x9df7('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x9df7('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9df7('0x2')](0x0);var events={'afterCreate':_0x9df7('0x3'),'afterUpdate':_0x9df7('0x4'),'afterDestroy':_0x9df7('0x5')};function emitEvent(_0x494cc3){return function(_0x4fce2a,_0x436d5d,_0x4cc801){OpenchannelQueueEvents['emit'](_0x494cc3+':'+_0x4fce2a['id'],_0x4fce2a);OpenchannelQueueEvents['emit'](_0x494cc3,_0x4fce2a);_0x4cc801(null);};}for(var e in events){if(events[_0x9df7('0x6')](e)){var event=events[e];OpenchannelQueue[_0x9df7('0x7')](e,emitEvent(event));}}module[_0x9df7('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 4f71b20..a8d3465 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 _0x1b24=['request-promise','./openchannelQueue.attributes','exports','define','util','../../config/logger','api','moment','bluebird'];(function(_0x4b2059,_0x48b53f){var _0x3680ad=function(_0x595e94){while(--_0x595e94){_0x4b2059['push'](_0x4b2059['shift']());}};_0x3680ad(++_0x48b53f);}(_0x1b24,0x112));var _0x41b2=function(_0x53d2bb,_0x1a1346){_0x53d2bb=_0x53d2bb-0x0;var _0xebce97=_0x1b24[_0x53d2bb];return _0xebce97;};'use strict';var _=require('lodash');var util=require(_0x41b2('0x0'));var logger=require(_0x41b2('0x1'))(_0x41b2('0x2'));var moment=require(_0x41b2('0x3'));var BPromise=require(_0x41b2('0x4'));var rp=require(_0x41b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x41b2('0x6'));module[_0x41b2('0x7')]=function(_0x5c24a7,_0x2ef2d2){return _0x5c24a7[_0x41b2('0x8')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d91=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util'];(function(_0x54adaa,_0x2eb2d0){var _0x1750b8=function(_0x2bb862){while(--_0x2bb862){_0x54adaa['push'](_0x54adaa['shift']());}};_0x1750b8(++_0x2eb2d0);}(_0x0d91,0x9b));var _0x10d9=function(_0x309251,_0x59a3d3){_0x309251=_0x309251-0x0;var _0x3c6e84=_0x0d91[_0x309251];return _0x3c6e84;};'use strict';var _=require('lodash');var util=require(_0x10d9('0x0'));var logger=require('../../config/logger')(_0x10d9('0x1'));var moment=require(_0x10d9('0x2'));var BPromise=require(_0x10d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10d9('0x4'));var rimraf=require(_0x10d9('0x5'));var config=require(_0x10d9('0x6'));var attributes=require(_0x10d9('0x7'));module[_0x10d9('0x8')]=function(_0x34db4e,_0x1e2427){return _0x34db4e[_0x10d9('0x9')](_0x10d9('0xa'),attributes,{'tableName':_0x10d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 95836c2..c45272b 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 _0x1a56=['../../config/environment','jayson/promise','client','redis','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x314cb8,_0x407905){var _0x32a7bf=function(_0x4c90a7){while(--_0x4c90a7){_0x314cb8['push'](_0x314cb8['shift']());}};_0x32a7bf(++_0x407905);}(_0x1a56,0x137));var _0x61a5=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x1a56[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x61a5('0x0'));var util=require(_0x61a5('0x1'));var moment=require(_0x61a5('0x2'));var BPromise=require(_0x61a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61a5('0x4'));var db=require(_0x61a5('0x5'))['db'];var utils=require(_0x61a5('0x6'));var logger=require(_0x61a5('0x7'))(_0x61a5('0x8'));var config=require(_0x61a5('0x9'));var jayson=require(_0x61a5('0xa'));var client=jayson[_0x61a5('0xb')]['http']({'port':0x232a});config[_0x61a5('0xc')]=_['defaults'](config[_0x61a5('0xc')],{'host':_0x61a5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61a5('0xc')]));require(_0x61a5('0xe'))[_0x61a5('0xf')](socket);function respondWithRpcPromise(_0x10362e,_0x1d36b4,_0xcb9d41){return new BPromise(function(_0x2404d6,_0x93af2f){return client[_0x61a5('0x10')](_0x10362e,_0xcb9d41)['then'](function(_0x32b679){logger[_0x61a5('0x11')](_0x61a5('0x12'),_0x1d36b4,_0x61a5('0x13'));logger['debug'](_0x61a5('0x14'),_0x1d36b4,_0x61a5('0x13'),JSON[_0x61a5('0x15')](_0x32b679));if(_0x32b679['error']){if(_0x32b679[_0x61a5('0x16')]['code']===0x1f4){logger[_0x61a5('0x16')](_0x61a5('0x12'),_0x1d36b4,_0x32b679[_0x61a5('0x16')][_0x61a5('0x17')]);return _0x93af2f(_0x32b679['error']['message']);}logger[_0x61a5('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x1d36b4,_0x32b679[_0x61a5('0x16')][_0x61a5('0x17')]);return _0x2404d6(_0x32b679[_0x61a5('0x16')]['message']);}else{logger['info'](_0x61a5('0x12'),_0x1d36b4,_0x61a5('0x13'));_0x2404d6(_0x32b679[_0x61a5('0x18')][_0x61a5('0x17')]);}})[_0x61a5('0x19')](function(_0x35d09b){logger['error'](_0x61a5('0x12'),_0x1d36b4,_0x35d09b);_0x93af2f(_0x35d09b);});});}exports[_0x61a5('0x1a')]=function(_0x266938){var _0x34a580=this;return new Promise(function(_0x49ca87,_0x3f4d05){return db['OpenchannelQueue'][_0x61a5('0x1b')]({'raw':_0x266938[_0x61a5('0x1c')]?_0x266938['options'][_0x61a5('0x1d')]===undefined?!![]:![]:!![],'where':_0x266938[_0x61a5('0x1c')]?_0x266938[_0x61a5('0x1c')][_0x61a5('0x1e')]||null:null,'attributes':_0x266938['options']?_0x266938['options'][_0x61a5('0x1f')]||null:null,'limit':_0x266938[_0x61a5('0x1c')]?_0x266938[_0x61a5('0x1c')][_0x61a5('0x20')]||null:null,'include':_0x266938[_0x61a5('0x1c')]?_0x266938[_0x61a5('0x1c')]['include']?_['map'](_0x266938[_0x61a5('0x1c')][_0x61a5('0x21')],function(_0x52eb1b){return{'model':db[_0x52eb1b[_0x61a5('0x22')]],'as':_0x52eb1b['as'],'attributes':_0x52eb1b['attributes'],'include':_0x52eb1b[_0x61a5('0x21')]?_[_0x61a5('0x23')](_0x52eb1b[_0x61a5('0x21')],function(_0x41f6a7){return{'model':db[_0x41f6a7[_0x61a5('0x22')]],'as':_0x41f6a7['as'],'attributes':_0x41f6a7[_0x61a5('0x1f')],'include':_0x41f6a7[_0x61a5('0x21')]?_[_0x61a5('0x23')](_0x41f6a7[_0x61a5('0x21')],function(_0x2899e6){return{'model':db[_0x2899e6['model']],'as':_0x2899e6['as'],'attributes':_0x2899e6[_0x61a5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x61a5('0x24')](function(_0x1cb9c0){logger[_0x61a5('0x11')](_0x61a5('0x1a'),_0x266938);logger['debug'](_0x61a5('0x1a'),_0x266938,JSON['stringify'](_0x1cb9c0));_0x49ca87(_0x1cb9c0);})[_0x61a5('0x19')](function(_0x1b5adf){logger['error'](_0x61a5('0x1a'),_0x1b5adf[_0x61a5('0x17')],_0x266938);_0x3f4d05(_0x34a580[_0x61a5('0x16')](0x1f4,_0x1b5adf['message']));});});};exports[_0x61a5('0x25')]=function(_0x3b47c6){var _0x30b78d=this;return new Promise(function(_0x4d1a3d,_0xc915ae){return db[_0x61a5('0x26')][_0x61a5('0x27')]({'raw':_0x3b47c6[_0x61a5('0x1c')]?_0x3b47c6[_0x61a5('0x1c')][_0x61a5('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b47c6[_0x61a5('0x1c')]?_0x3b47c6[_0x61a5('0x1c')][_0x61a5('0x1e')]||null:null,'attributes':_0x3b47c6[_0x61a5('0x1c')]?_0x3b47c6[_0x61a5('0x1c')][_0x61a5('0x1f')]||null:null,'include':_0x3b47c6['options']?_0x3b47c6[_0x61a5('0x1c')][_0x61a5('0x21')]?_['map'](_0x3b47c6['options'][_0x61a5('0x21')],function(_0x3a8d4a){return{'model':db[_0x3a8d4a[_0x61a5('0x22')]],'as':_0x3a8d4a['as'],'attributes':_0x3a8d4a[_0x61a5('0x1f')],'include':_0x3a8d4a[_0x61a5('0x21')]?_[_0x61a5('0x23')](_0x3a8d4a['include'],function(_0x5c3a04){return{'model':db[_0x5c3a04[_0x61a5('0x22')]],'as':_0x5c3a04['as'],'attributes':_0x5c3a04[_0x61a5('0x1f')],'include':_0x5c3a04[_0x61a5('0x21')]?_['map'](_0x5c3a04[_0x61a5('0x21')],function(_0x4cba89){return{'model':db[_0x4cba89[_0x61a5('0x22')]],'as':_0x4cba89['as'],'attributes':_0x4cba89['attributes']};}):[]};}):[]};}):[]:[]})[_0x61a5('0x24')](function(_0x303ae5){logger['info'](_0x61a5('0x25'),_0x3b47c6);logger['debug']('ShowOpenchannelQueue',_0x3b47c6,JSON[_0x61a5('0x15')](_0x303ae5));_0x4d1a3d(_0x303ae5);})[_0x61a5('0x19')](function(_0xe98e83){logger[_0x61a5('0x16')](_0x61a5('0x25'),_0xe98e83['message'],_0x3b47c6);_0xc915ae(_0x30b78d['error'](0x1f4,_0xe98e83[_0x61a5('0x17')]));});});}; \ No newline at end of file +var _0x41dd=['OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','ShowOpenchannelQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetOpenchannelQueue'];(function(_0x1c2a65,_0x4450f2){var _0x9b7e31=function(_0x5c45f1){while(--_0x5c45f1){_0x1c2a65['push'](_0x1c2a65['shift']());}};_0x9b7e31(++_0x4450f2);}(_0x41dd,0x1ef));var _0xd41d=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x41dd[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0xd41d('0x0'));var util=require(_0xd41d('0x1'));var moment=require(_0xd41d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd41d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd41d('0x4'))['db'];var utils=require(_0xd41d('0x5'));var logger=require('../../config/logger')(_0xd41d('0x6'));var config=require('../../config/environment');var jayson=require(_0xd41d('0x7'));var client=jayson['client'][_0xd41d('0x8')]({'port':0x232a});config['redis']=_[_0xd41d('0x9')](config[_0xd41d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd41d('0xb'))(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x43651d,_0x3766af,_0x2f369b){return new BPromise(function(_0x432a3a,_0x148e95){return client[_0xd41d('0xc')](_0x43651d,_0x2f369b)['then'](function(_0xf27841){logger[_0xd41d('0xd')](_0xd41d('0xe'),_0x3766af,'request\x20sent');logger[_0xd41d('0xf')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3766af,_0xd41d('0x10'),JSON['stringify'](_0xf27841));if(_0xf27841['error']){if(_0xf27841[_0xd41d('0x11')][_0xd41d('0x12')]===0x1f4){logger[_0xd41d('0x11')](_0xd41d('0xe'),_0x3766af,_0xf27841[_0xd41d('0x11')][_0xd41d('0x13')]);return _0x148e95(_0xf27841[_0xd41d('0x11')][_0xd41d('0x13')]);}logger[_0xd41d('0x11')](_0xd41d('0xe'),_0x3766af,_0xf27841['error'][_0xd41d('0x13')]);return _0x432a3a(_0xf27841[_0xd41d('0x11')][_0xd41d('0x13')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x3766af,_0xd41d('0x10'));_0x432a3a(_0xf27841[_0xd41d('0x14')]['message']);}})[_0xd41d('0x15')](function(_0x397bb1){logger[_0xd41d('0x11')](_0xd41d('0xe'),_0x3766af,_0x397bb1);_0x148e95(_0x397bb1);});});}exports[_0xd41d('0x16')]=function(_0x135d76){var _0x317024=this;return new Promise(function(_0x3a82fb,_0x29ba69){return db[_0xd41d('0x17')][_0xd41d('0x18')]({'raw':_0x135d76[_0xd41d('0x19')]?_0x135d76[_0xd41d('0x19')][_0xd41d('0x1a')]===undefined?!![]:![]:!![],'where':_0x135d76[_0xd41d('0x19')]?_0x135d76[_0xd41d('0x19')][_0xd41d('0x1b')]||null:null,'attributes':_0x135d76[_0xd41d('0x19')]?_0x135d76[_0xd41d('0x19')]['attributes']||null:null,'limit':_0x135d76['options']?_0x135d76['options'][_0xd41d('0x1c')]||null:null,'include':_0x135d76[_0xd41d('0x19')]?_0x135d76['options'][_0xd41d('0x1d')]?_[_0xd41d('0x1e')](_0x135d76[_0xd41d('0x19')][_0xd41d('0x1d')],function(_0x29262d){return{'model':db[_0x29262d[_0xd41d('0x1f')]],'as':_0x29262d['as'],'attributes':_0x29262d['attributes'],'include':_0x29262d[_0xd41d('0x1d')]?_[_0xd41d('0x1e')](_0x29262d[_0xd41d('0x1d')],function(_0x56747e){return{'model':db[_0x56747e[_0xd41d('0x1f')]],'as':_0x56747e['as'],'attributes':_0x56747e[_0xd41d('0x20')],'include':_0x56747e['include']?_[_0xd41d('0x1e')](_0x56747e[_0xd41d('0x1d')],function(_0x18b17e){return{'model':db[_0x18b17e[_0xd41d('0x1f')]],'as':_0x18b17e['as'],'attributes':_0x18b17e[_0xd41d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd41d('0x21')](function(_0x3c8ef5){logger['info']('GetOpenchannelQueue',_0x135d76);logger[_0xd41d('0xf')]('GetOpenchannelQueue',_0x135d76,JSON[_0xd41d('0x22')](_0x3c8ef5));_0x3a82fb(_0x3c8ef5);})[_0xd41d('0x15')](function(_0x36e17a){logger[_0xd41d('0x11')](_0xd41d('0x16'),_0x36e17a[_0xd41d('0x13')],_0x135d76);_0x29ba69(_0x317024[_0xd41d('0x11')](0x1f4,_0x36e17a[_0xd41d('0x13')]));});});};exports[_0xd41d('0x23')]=function(_0x3aedf7){var _0x346174=this;return new Promise(function(_0xa76b1e,_0x848703){return db['OpenchannelQueue'][_0xd41d('0x24')]({'raw':_0x3aedf7[_0xd41d('0x19')]?_0x3aedf7[_0xd41d('0x19')][_0xd41d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3aedf7[_0xd41d('0x19')]?_0x3aedf7[_0xd41d('0x19')][_0xd41d('0x1b')]||null:null,'attributes':_0x3aedf7[_0xd41d('0x19')]?_0x3aedf7[_0xd41d('0x19')]['attributes']||null:null,'include':_0x3aedf7[_0xd41d('0x19')]?_0x3aedf7['options'][_0xd41d('0x1d')]?_['map'](_0x3aedf7['options'][_0xd41d('0x1d')],function(_0x4614dc){return{'model':db[_0x4614dc[_0xd41d('0x1f')]],'as':_0x4614dc['as'],'attributes':_0x4614dc[_0xd41d('0x20')],'include':_0x4614dc[_0xd41d('0x1d')]?_[_0xd41d('0x1e')](_0x4614dc[_0xd41d('0x1d')],function(_0x59e5dc){return{'model':db[_0x59e5dc[_0xd41d('0x1f')]],'as':_0x59e5dc['as'],'attributes':_0x59e5dc[_0xd41d('0x20')],'include':_0x59e5dc[_0xd41d('0x1d')]?_['map'](_0x59e5dc[_0xd41d('0x1d')],function(_0x29d27e){return{'model':db[_0x29d27e[_0xd41d('0x1f')]],'as':_0x29d27e['as'],'attributes':_0x29d27e[_0xd41d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32b4c8){logger[_0xd41d('0xd')]('ShowOpenchannelQueue',_0x3aedf7);logger[_0xd41d('0xf')](_0xd41d('0x23'),_0x3aedf7,JSON[_0xd41d('0x22')](_0x32b4c8));_0xa76b1e(_0x32b4c8);})[_0xd41d('0x15')](function(_0x5e3c51){logger[_0xd41d('0x11')]('ShowOpenchannelQueue',_0x5e3c51[_0xd41d('0x13')],_0x3aedf7);_0x848703(_0x346174[_0xd41d('0x11')](0x1f4,_0x5e3c51[_0xd41d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5ecdaf0..de2bc4a 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 _0x38b5=['remove','update','emit','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x379ccc,_0x56379d){var _0x4d8bc6=function(_0x47a443){while(--_0x47a443){_0x379ccc['push'](_0x379ccc['shift']());}};_0x4d8bc6(++_0x56379d);}(_0x38b5,0x124));var _0x538b=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0x38b5[_0x47df54];return _0x261b87;};'use strict';var OpenchannelQueueEvents=require(_0x538b('0x0'));var events=[_0x538b('0x1'),_0x538b('0x2'),_0x538b('0x3')];function createListener(_0x37b4f0,_0x58480a){return function(_0x66a7dd){_0x58480a[_0x538b('0x4')](_0x37b4f0,_0x66a7dd);};}function removeListener(_0x1f36e7,_0x25d715){return function(){OpenchannelQueueEvents['removeListener'](_0x1f36e7,_0x25d715);};}exports[_0x538b('0x5')]=function(_0x36b43d){for(var _0x2983ad=0x0,_0x51d32c=events['length'];_0x2983ad<_0x51d32c;_0x2983ad++){var _0x401bb0=events[_0x2983ad];var _0xac9c1f=createListener(_0x538b('0x6')+_0x401bb0,_0x36b43d);OpenchannelQueueEvents['on'](_0x401bb0,_0xac9c1f);}}; \ No newline at end of file +var _0xfd27=['removeListener','register','openchannelQueue:','./openchannelQueue.events','remove','update','emit'];(function(_0xb67f9c,_0x23be9b){var _0x514938=function(_0x181039){while(--_0x181039){_0xb67f9c['push'](_0xb67f9c['shift']());}};_0x514938(++_0x23be9b);}(_0xfd27,0xff));var _0x7fd2=function(_0x4a0dbd,_0x576261){_0x4a0dbd=_0x4a0dbd-0x0;var _0x22e2e2=_0xfd27[_0x4a0dbd];return _0x22e2e2;};'use strict';var OpenchannelQueueEvents=require(_0x7fd2('0x0'));var events=['save',_0x7fd2('0x1'),_0x7fd2('0x2')];function createListener(_0x2e652d,_0x3eac3d){return function(_0x2ae7ff){_0x3eac3d[_0x7fd2('0x3')](_0x2e652d,_0x2ae7ff);};}function removeListener(_0x537f09,_0x53ee09){return function(){OpenchannelQueueEvents[_0x7fd2('0x4')](_0x537f09,_0x53ee09);};}exports[_0x7fd2('0x5')]=function(_0x5b723e){for(var _0x8b282=0x0,_0x2846da=events['length'];_0x8b282<_0x2846da;_0x8b282++){var _0x21a103=events[_0x8b282];var _0x2e7e7d=createListener(_0x7fd2('0x6')+_0x21a103,_0x5b723e);OpenchannelQueueEvents['on'](_0x21a103,_0x2e7e7d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 3097445..98e8498 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 _0xe000=['show','post','create','/:id','update','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0xfbaa1b,_0x457818){var _0x54d340=function(_0x4021a6){while(--_0x4021a6){_0xfbaa1b['push'](_0xfbaa1b['shift']());}};_0x54d340(++_0x457818);}(_0xe000,0x111));var _0x0e00=function(_0x5904fa,_0x460389){_0x5904fa=_0x5904fa-0x0;var _0x36c9cf=_0xe000[_0x5904fa];return _0x36c9cf;};'use strict';var multer=require(_0x0e00('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e00('0x1'));var router=express[_0x0e00('0x2')]();var fs_extra=require(_0x0e00('0x3'));var auth=require(_0x0e00('0x4'));var interaction=require(_0x0e00('0x5'));var config=require(_0x0e00('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x0e00('0x7')]('/',auth['isAuthenticated'](),controller[_0x0e00('0x8')]);router['get'](_0x0e00('0x9'),auth[_0x0e00('0xa')](),controller[_0x0e00('0xb')]);router[_0x0e00('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0e00('0xc')]);router[_0x0e00('0xd')]('/',auth[_0x0e00('0xa')](),controller[_0x0e00('0xe')]);router['put'](_0x0e00('0xf'),auth['isAuthenticated'](),controller[_0x0e00('0x10')]);router['delete'](_0x0e00('0xf'),auth[_0x0e00('0xa')](),controller[_0x0e00('0x11')]);module[_0x0e00('0x12')]=router; \ No newline at end of file +var _0x9957=['exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9957,0x17d));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7995('0x0'));var express=require(_0x7995('0x1'));var router=express['Router']();var fs_extra=require(_0x7995('0x2'));var auth=require(_0x7995('0x3'));var interaction=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var controller=require(_0x7995('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7995('0x7')]);router[_0x7995('0x8')](_0x7995('0x9'),auth[_0x7995('0xa')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0xa')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x10')](_0x7995('0xb'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);module[_0x7995('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index f974a4c..8ac9585 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 _0xae6b=['moment','exports','STRING','DATE'];(function(_0x415854,_0x2b79d2){var _0x467ad8=function(_0x4299d1){while(--_0x4299d1){_0x415854['push'](_0x415854['shift']());}};_0x467ad8(++_0x2b79d2);}(_0xae6b,0x158));var _0xbae6=function(_0xedeb50,_0x5481cf){_0xedeb50=_0xedeb50-0x0;var _0x48ded6=_0xae6b[_0xedeb50];return _0x48ded6;};'use strict';var moment=require(_0xbae6('0x0'));var Sequelize=require('sequelize');module[_0xbae6('0x1')]={'uniqueid':{'type':Sequelize[_0xbae6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbae6('0x2')]},'joinAt':{'type':Sequelize[_0xbae6('0x3')]},'leaveAt':{'type':Sequelize[_0xbae6('0x3')]},'acceptAt':{'type':Sequelize[_0xbae6('0x3')]},'exitAt':{'type':Sequelize[_0xbae6('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x728d=['moment','sequelize','exports','STRING','DATE'];(function(_0x36c900,_0x3ffa9b){var _0x7a97=function(_0x36a6f3){while(--_0x36a6f3){_0x36c900['push'](_0x36c900['shift']());}};_0x7a97(++_0x3ffa9b);}(_0x728d,0x1c2));var _0xd728=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x728d[_0x220dbb];return _0x2b77de;};'use strict';var moment=require(_0xd728('0x0'));var Sequelize=require(_0xd728('0x1'));module[_0xd728('0x2')]={'uniqueid':{'type':Sequelize[_0xd728('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd728('0x3')]},'joinAt':{'type':Sequelize[_0xd728('0x4')]},'leaveAt':{'type':Sequelize[_0xd728('0x4')]},'acceptAt':{'type':Sequelize[_0xd728('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd728('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2701006..ecaa416 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 _0xd0e1=['destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x358682,_0x561a15){var _0x35deed=function(_0x5c5119){while(--_0x5c5119){_0x358682['push'](_0x358682['shift']());}};_0x35deed(++_0x561a15);}(_0xd0e1,0xbf));var _0x1d0e=function(_0x4a57e8,_0x1ec50){_0x4a57e8=_0x4a57e8-0x0;var _0x20e5dc=_0xd0e1[_0x4a57e8];return _0x20e5dc;};'use strict';var emlformat=require(_0x1d0e('0x0'));var rimraf=require(_0x1d0e('0x1'));var zipdir=require(_0x1d0e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1d0e('0x3'));var BPromise=require(_0x1d0e('0x4'));var Mustache=require('mustache');var util=require(_0x1d0e('0x5'));var path=require(_0x1d0e('0x6'));var sox=require('sox');var csv=require(_0x1d0e('0x7'));var ejs=require(_0x1d0e('0x8'));var fs=require('fs');var fs_extra=require(_0x1d0e('0x9'));var _=require(_0x1d0e('0xa'));var squel=require(_0x1d0e('0xb'));var crypto=require(_0x1d0e('0xc'));var jsforce=require(_0x1d0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1d0e('0x7'));var querystring=require(_0x1d0e('0xe'));var Papa=require('papaparse');var Redis=require(_0x1d0e('0xf'));var authService=require(_0x1d0e('0x10'));var qs=require(_0x1d0e('0x11'));var as=require(_0x1d0e('0x12'));var hardwareService=require(_0x1d0e('0x13'));var logger=require('../../config/logger')(_0x1d0e('0x14'));var utils=require(_0x1d0e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1d0e('0x16'));var db=require(_0x1d0e('0x17'))['db'];function respondWithStatusCode(_0x38923f,_0x26596e){_0x26596e=_0x26596e||0xcc;return function(_0x37edcc){if(_0x37edcc){return _0x38923f['sendStatus'](_0x26596e);}return _0x38923f[_0x1d0e('0x18')](_0x26596e)[_0x1d0e('0x19')]();};}function respondWithResult(_0x3dfbde,_0x6d2599){_0x6d2599=_0x6d2599||0xc8;return function(_0x22faf6){if(_0x22faf6){return _0x3dfbde[_0x1d0e('0x18')](_0x6d2599)[_0x1d0e('0x1a')](_0x22faf6);}};}function respondWithFilteredResult(_0x53436b,_0x31b567){return function(_0xa86bbd){if(_0xa86bbd){var _0x1cf53e=typeof _0x31b567[_0x1d0e('0x1b')]==='undefined'&&typeof _0x31b567[_0x1d0e('0x1c')]==='undefined';var _0x3c14f0=_0xa86bbd['count'];var _0x2ee0c3=_0x1cf53e?0x0:_0x31b567[_0x1d0e('0x1b')];var _0x37d694=_0x1cf53e?_0xa86bbd[_0x1d0e('0x1d')]:_0x31b567[_0x1d0e('0x1b')]+_0x31b567[_0x1d0e('0x1c')];var _0x238192;if(_0x37d694>=_0x3c14f0){_0x37d694=_0x3c14f0;_0x238192=0xc8;}else{_0x238192=0xce;}_0x53436b['status'](_0x238192);return _0x53436b[_0x1d0e('0x1e')](_0x1d0e('0x1f'),_0x2ee0c3+'-'+_0x37d694+'/'+_0x3c14f0)['json'](_0xa86bbd);}return null;};}function patchUpdates(_0x547a61){return function(_0x33c135){try{jsonpatch[_0x1d0e('0x20')](_0x33c135,_0x547a61,!![]);}catch(_0x4f1825){return BPromise[_0x1d0e('0x21')](_0x4f1825);}return _0x33c135[_0x1d0e('0x22')]();};}function saveUpdates(_0x59008c,_0x230eb3){return function(_0x3251cd){if(_0x3251cd){return _0x3251cd[_0x1d0e('0x23')](_0x59008c)[_0x1d0e('0x24')](function(_0x2f066c){return _0x2f066c;});}return null;};}function removeEntity(_0x36e3db,_0x368280){return function(_0x54dea1){if(_0x54dea1){return _0x54dea1[_0x1d0e('0x25')]()[_0x1d0e('0x24')](function(){_0x36e3db[_0x1d0e('0x18')](0xcc)[_0x1d0e('0x19')]();});}};}function handleEntityNotFound(_0xcc94fd,_0x4f0586){return function(_0x505fc3){if(!_0x505fc3){_0xcc94fd[_0x1d0e('0x26')](0x194);}return _0x505fc3;};}function handleError(_0x451514,_0x38e54d){_0x38e54d=_0x38e54d||0x1f4;return function(_0x194214){logger[_0x1d0e('0x27')](_0x194214[_0x1d0e('0x28')]);if(_0x194214[_0x1d0e('0x29')]){delete _0x194214[_0x1d0e('0x29')];}_0x451514[_0x1d0e('0x18')](_0x38e54d)[_0x1d0e('0x2a')](_0x194214);};}exports[_0x1d0e('0x2b')]=function(_0xfa3d16,_0x3c49eb){var _0x537123={},_0x5f2306={},_0x175cad={'count':0x0,'rows':[]};var _0x431a4b=_[_0x1d0e('0x2c')](db[_0x1d0e('0x2d')]['rawAttributes'],function(_0x362a66){return{'name':_0x362a66[_0x1d0e('0x2e')],'type':_0x362a66[_0x1d0e('0x2f')][_0x1d0e('0x30')]};});_0x5f2306[_0x1d0e('0x31')]=_[_0x1d0e('0x2c')](_0x431a4b,'name');_0x5f2306['query']=_[_0x1d0e('0x32')](_0xfa3d16['query']);_0x5f2306[_0x1d0e('0x33')]=_[_0x1d0e('0x34')](_0x5f2306[_0x1d0e('0x31')],_0x5f2306[_0x1d0e('0x35')]);_0x537123[_0x1d0e('0x36')]=_['intersection'](_0x5f2306[_0x1d0e('0x31')],qs[_0x1d0e('0x37')](_0xfa3d16[_0x1d0e('0x35')][_0x1d0e('0x37')]));_0x537123[_0x1d0e('0x36')]=_0x537123[_0x1d0e('0x36')][_0x1d0e('0x38')]?_0x537123[_0x1d0e('0x36')]:_0x5f2306['model'];if(!_0xfa3d16[_0x1d0e('0x35')]['hasOwnProperty'](_0x1d0e('0x39'))){_0x537123[_0x1d0e('0x1c')]=qs[_0x1d0e('0x1c')](_0xfa3d16[_0x1d0e('0x35')][_0x1d0e('0x1c')]);_0x537123['offset']=qs[_0x1d0e('0x1b')](_0xfa3d16[_0x1d0e('0x35')][_0x1d0e('0x1b')]);}_0x537123[_0x1d0e('0x3a')]=qs[_0x1d0e('0x3b')](_0xfa3d16['query'][_0x1d0e('0x3b')]);_0x537123[_0x1d0e('0x3c')]=qs[_0x1d0e('0x33')](_[_0x1d0e('0x3d')](_0xfa3d16[_0x1d0e('0x35')],_0x5f2306[_0x1d0e('0x33')]),_0x431a4b);if(_0xfa3d16[_0x1d0e('0x35')][_0x1d0e('0x3e')]){_0x537123[_0x1d0e('0x3c')]=_[_0x1d0e('0x3f')](_0x537123[_0x1d0e('0x3c')],{'$or':_[_0x1d0e('0x2c')](_0x431a4b,function(_0x12ba4e){if(_0x12ba4e['type']!==_0x1d0e('0x40')){var _0x56e695={};_0x56e695[_0x12ba4e['name']]={'$like':'%'+_0xfa3d16[_0x1d0e('0x35')][_0x1d0e('0x3e')]+'%'};return _0x56e695;}})});}_0x537123=_[_0x1d0e('0x3f')]({},_0x537123,_0xfa3d16['options']);var _0x3d0784={'where':_0x537123['where']};return db[_0x1d0e('0x2d')]['count'](_0x3d0784)[_0x1d0e('0x24')](function(_0x514c8e){_0x175cad['count']=_0x514c8e;if(_0xfa3d16[_0x1d0e('0x35')][_0x1d0e('0x41')]){_0x537123[_0x1d0e('0x42')]=[{'all':!![]}];}return db[_0x1d0e('0x2d')][_0x1d0e('0x43')](_0x537123);})['then'](function(_0xedb5fa){_0x175cad['rows']=_0xedb5fa;return _0x175cad;})['then'](respondWithFilteredResult(_0x3c49eb,_0x537123))[_0x1d0e('0x44')](handleError(_0x3c49eb,null));};exports[_0x1d0e('0x45')]=function(_0x281ba3,_0x2abadd){var _0x5e3c73={'raw':!![],'where':{'id':_0x281ba3[_0x1d0e('0x46')]['id']}},_0x7fac6f={};_0x7fac6f['model']=_[_0x1d0e('0x32')](db[_0x1d0e('0x2d')][_0x1d0e('0x47')]);_0x7fac6f[_0x1d0e('0x35')]=_[_0x1d0e('0x32')](_0x281ba3['query']);_0x7fac6f[_0x1d0e('0x33')]=_[_0x1d0e('0x34')](_0x7fac6f[_0x1d0e('0x31')],_0x7fac6f[_0x1d0e('0x35')]);_0x5e3c73[_0x1d0e('0x36')]=_[_0x1d0e('0x34')](_0x7fac6f['model'],qs[_0x1d0e('0x37')](_0x281ba3[_0x1d0e('0x35')][_0x1d0e('0x37')]));_0x5e3c73[_0x1d0e('0x36')]=_0x5e3c73[_0x1d0e('0x36')][_0x1d0e('0x38')]?_0x5e3c73[_0x1d0e('0x36')]:_0x7fac6f[_0x1d0e('0x31')];if(_0x281ba3[_0x1d0e('0x35')][_0x1d0e('0x41')]){_0x5e3c73[_0x1d0e('0x42')]=[{'all':!![]}];}_0x5e3c73=_['merge']({},_0x5e3c73,_0x281ba3['options']);return db['OpenchannelQueueReport'][_0x1d0e('0x48')](_0x5e3c73)[_0x1d0e('0x24')](handleEntityNotFound(_0x2abadd,null))[_0x1d0e('0x24')](respondWithResult(_0x2abadd,null))[_0x1d0e('0x44')](handleError(_0x2abadd,null));};exports[_0x1d0e('0x49')]=function(_0x565520,_0x229615){return db[_0x1d0e('0x2d')][_0x1d0e('0x49')](_0x565520[_0x1d0e('0x4a')],{})[_0x1d0e('0x24')](respondWithResult(_0x229615,0xc9))[_0x1d0e('0x44')](handleError(_0x229615,null));};exports[_0x1d0e('0x23')]=function(_0x227d0c,_0x31cae5){if(_0x227d0c['body']['id']){delete _0x227d0c[_0x1d0e('0x4a')]['id'];}return db[_0x1d0e('0x2d')][_0x1d0e('0x48')]({'where':{'id':_0x227d0c[_0x1d0e('0x46')]['id']}})[_0x1d0e('0x24')](handleEntityNotFound(_0x31cae5,null))[_0x1d0e('0x24')](saveUpdates(_0x227d0c[_0x1d0e('0x4a')],null))['then'](respondWithResult(_0x31cae5,null))['catch'](handleError(_0x31cae5,null));};exports[_0x1d0e('0x25')]=function(_0x132540,_0x3a6877){return db[_0x1d0e('0x2d')][_0x1d0e('0x48')]({'where':{'id':_0x132540[_0x1d0e('0x46')]['id']}})[_0x1d0e('0x24')](handleEntityNotFound(_0x3a6877,null))['then'](removeEntity(_0x3a6877,null))[_0x1d0e('0x44')](handleError(_0x3a6877,null));};exports[_0x1d0e('0x4b')]=function(_0xc6698a,_0x2f9413){return db[_0x1d0e('0x2d')][_0x1d0e('0x4b')]()['then'](respondWithResult(_0x2f9413,null))[_0x1d0e('0x44')](handleError(_0x2f9413,null));}; \ No newline at end of file +var _0xbd8c=['filters','pick','where','merge','VIRTUAL','filter','options','OpenchannelQueueReport','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','intersection','attributes','fields','query','length','nolimit','order','sort'];(function(_0x315584,_0x5b2c26){var _0x216c6d=function(_0x553f0a){while(--_0x553f0a){_0x315584['push'](_0x315584['shift']());}};_0x216c6d(++_0x5b2c26);}(_0xbd8c,0x14b));var _0xcbd8=function(_0x1fafda,_0x47a4d2){_0x1fafda=_0x1fafda-0x0;var _0x5c1b2e=_0xbd8c[_0x1fafda];return _0x5c1b2e;};'use strict';var emlformat=require(_0xcbd8('0x0'));var rimraf=require(_0xcbd8('0x1'));var zipdir=require(_0xcbd8('0x2'));var jsonpatch=require(_0xcbd8('0x3'));var rp=require('request-promise');var moment=require(_0xcbd8('0x4'));var BPromise=require(_0xcbd8('0x5'));var Mustache=require(_0xcbd8('0x6'));var util=require(_0xcbd8('0x7'));var path=require(_0xcbd8('0x8'));var sox=require(_0xcbd8('0x9'));var csv=require('to-csv');var ejs=require(_0xcbd8('0xa'));var fs=require('fs');var fs_extra=require(_0xcbd8('0xb'));var _=require(_0xcbd8('0xc'));var squel=require(_0xcbd8('0xd'));var crypto=require(_0xcbd8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcbd8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcbd8('0x10'));var Papa=require(_0xcbd8('0x11'));var Redis=require(_0xcbd8('0x12'));var authService=require(_0xcbd8('0x13'));var qs=require(_0xcbd8('0x14'));var as=require(_0xcbd8('0x15'));var hardwareService=require(_0xcbd8('0x16'));var logger=require('../../config/logger')(_0xcbd8('0x17'));var utils=require(_0xcbd8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd60191,_0x2a4219){_0x2a4219=_0x2a4219||0xcc;return function(_0x13cbfb){if(_0x13cbfb){return _0xd60191['sendStatus'](_0x2a4219);}return _0xd60191[_0xcbd8('0x19')](_0x2a4219)[_0xcbd8('0x1a')]();};}function respondWithResult(_0x49bd10,_0x3d7c23){_0x3d7c23=_0x3d7c23||0xc8;return function(_0x444de0){if(_0x444de0){return _0x49bd10[_0xcbd8('0x19')](_0x3d7c23)[_0xcbd8('0x1b')](_0x444de0);}};}function respondWithFilteredResult(_0x561f52,_0x26faa2){return function(_0x55be54){if(_0x55be54){var _0x3e6ee1=typeof _0x26faa2['offset']==='undefined'&&typeof _0x26faa2['limit']===_0xcbd8('0x1c');var _0x5d2ce7=_0x55be54[_0xcbd8('0x1d')];var _0x250636=_0x3e6ee1?0x0:_0x26faa2[_0xcbd8('0x1e')];var _0x4ff4c5=_0x3e6ee1?_0x55be54[_0xcbd8('0x1d')]:_0x26faa2['offset']+_0x26faa2[_0xcbd8('0x1f')];var _0x2fa9b4;if(_0x4ff4c5>=_0x5d2ce7){_0x4ff4c5=_0x5d2ce7;_0x2fa9b4=0xc8;}else{_0x2fa9b4=0xce;}_0x561f52[_0xcbd8('0x19')](_0x2fa9b4);return _0x561f52[_0xcbd8('0x20')](_0xcbd8('0x21'),_0x250636+'-'+_0x4ff4c5+'/'+_0x5d2ce7)[_0xcbd8('0x1b')](_0x55be54);}return null;};}function patchUpdates(_0x2715ea){return function(_0x537f80){try{jsonpatch[_0xcbd8('0x22')](_0x537f80,_0x2715ea,!![]);}catch(_0x346268){return BPromise['reject'](_0x346268);}return _0x537f80[_0xcbd8('0x23')]();};}function saveUpdates(_0xcffd34,_0x492866){return function(_0x572ec9){if(_0x572ec9){return _0x572ec9[_0xcbd8('0x24')](_0xcffd34)[_0xcbd8('0x25')](function(_0x1f50bb){return _0x1f50bb;});}return null;};}function removeEntity(_0x1ff742,_0x15e31b){return function(_0x113569){if(_0x113569){return _0x113569[_0xcbd8('0x26')]()[_0xcbd8('0x25')](function(){_0x1ff742[_0xcbd8('0x19')](0xcc)[_0xcbd8('0x1a')]();});}};}function handleEntityNotFound(_0x1da87b,_0x2ea340){return function(_0x4c57d7){if(!_0x4c57d7){_0x1da87b[_0xcbd8('0x27')](0x194);}return _0x4c57d7;};}function handleError(_0x4bf204,_0x7bdbc0){_0x7bdbc0=_0x7bdbc0||0x1f4;return function(_0x1df6ee){logger[_0xcbd8('0x28')](_0x1df6ee[_0xcbd8('0x29')]);if(_0x1df6ee[_0xcbd8('0x2a')]){delete _0x1df6ee[_0xcbd8('0x2a')];}_0x4bf204[_0xcbd8('0x19')](_0x7bdbc0)[_0xcbd8('0x2b')](_0x1df6ee);};}exports[_0xcbd8('0x2c')]=function(_0x2a1710,_0xbaede6){var _0x23ebb8={},_0x2bab83={},_0x18f508={'count':0x0,'rows':[]};var _0x2b0f21=_[_0xcbd8('0x2d')](db['OpenchannelQueueReport'][_0xcbd8('0x2e')],function(_0xcb2d3e){return{'name':_0xcb2d3e['fieldName'],'type':_0xcb2d3e[_0xcbd8('0x2f')][_0xcbd8('0x30')]};});_0x2bab83[_0xcbd8('0x31')]=_['map'](_0x2b0f21,_0xcbd8('0x2a'));_0x2bab83['query']=_[_0xcbd8('0x32')](_0x2a1710['query']);_0x2bab83['filters']=_[_0xcbd8('0x33')](_0x2bab83[_0xcbd8('0x31')],_0x2bab83['query']);_0x23ebb8[_0xcbd8('0x34')]=_[_0xcbd8('0x33')](_0x2bab83[_0xcbd8('0x31')],qs[_0xcbd8('0x35')](_0x2a1710[_0xcbd8('0x36')][_0xcbd8('0x35')]));_0x23ebb8[_0xcbd8('0x34')]=_0x23ebb8[_0xcbd8('0x34')][_0xcbd8('0x37')]?_0x23ebb8[_0xcbd8('0x34')]:_0x2bab83[_0xcbd8('0x31')];if(!_0x2a1710[_0xcbd8('0x36')]['hasOwnProperty'](_0xcbd8('0x38'))){_0x23ebb8['limit']=qs[_0xcbd8('0x1f')](_0x2a1710[_0xcbd8('0x36')][_0xcbd8('0x1f')]);_0x23ebb8[_0xcbd8('0x1e')]=qs['offset'](_0x2a1710[_0xcbd8('0x36')]['offset']);}_0x23ebb8[_0xcbd8('0x39')]=qs['sort'](_0x2a1710[_0xcbd8('0x36')][_0xcbd8('0x3a')]);_0x23ebb8['where']=qs[_0xcbd8('0x3b')](_[_0xcbd8('0x3c')](_0x2a1710[_0xcbd8('0x36')],_0x2bab83[_0xcbd8('0x3b')]),_0x2b0f21);if(_0x2a1710[_0xcbd8('0x36')]['filter']){_0x23ebb8[_0xcbd8('0x3d')]=_[_0xcbd8('0x3e')](_0x23ebb8[_0xcbd8('0x3d')],{'$or':_[_0xcbd8('0x2d')](_0x2b0f21,function(_0x337902){if(_0x337902['type']!==_0xcbd8('0x3f')){var _0x10d655={};_0x10d655[_0x337902[_0xcbd8('0x2a')]]={'$like':'%'+_0x2a1710[_0xcbd8('0x36')][_0xcbd8('0x40')]+'%'};return _0x10d655;}})});}_0x23ebb8=_[_0xcbd8('0x3e')]({},_0x23ebb8,_0x2a1710[_0xcbd8('0x41')]);var _0x521211={'where':_0x23ebb8['where']};return db[_0xcbd8('0x42')]['count'](_0x521211)[_0xcbd8('0x25')](function(_0x39b979){_0x18f508[_0xcbd8('0x1d')]=_0x39b979;if(_0x2a1710[_0xcbd8('0x36')][_0xcbd8('0x43')]){_0x23ebb8[_0xcbd8('0x44')]=[{'all':!![]}];}return db[_0xcbd8('0x42')][_0xcbd8('0x45')](_0x23ebb8);})[_0xcbd8('0x25')](function(_0x21eb48){_0x18f508[_0xcbd8('0x46')]=_0x21eb48;return _0x18f508;})[_0xcbd8('0x25')](respondWithFilteredResult(_0xbaede6,_0x23ebb8))['catch'](handleError(_0xbaede6,null));};exports[_0xcbd8('0x47')]=function(_0x1c3117,_0x197d99){var _0x4443e0={'raw':!![],'where':{'id':_0x1c3117['params']['id']}},_0x309a5a={};_0x309a5a[_0xcbd8('0x31')]=_[_0xcbd8('0x32')](db[_0xcbd8('0x42')][_0xcbd8('0x2e')]);_0x309a5a['query']=_['keys'](_0x1c3117[_0xcbd8('0x36')]);_0x309a5a[_0xcbd8('0x3b')]=_[_0xcbd8('0x33')](_0x309a5a[_0xcbd8('0x31')],_0x309a5a['query']);_0x4443e0[_0xcbd8('0x34')]=_[_0xcbd8('0x33')](_0x309a5a[_0xcbd8('0x31')],qs[_0xcbd8('0x35')](_0x1c3117['query'][_0xcbd8('0x35')]));_0x4443e0['attributes']=_0x4443e0[_0xcbd8('0x34')]['length']?_0x4443e0[_0xcbd8('0x34')]:_0x309a5a[_0xcbd8('0x31')];if(_0x1c3117[_0xcbd8('0x36')]['includeAll']){_0x4443e0[_0xcbd8('0x44')]=[{'all':!![]}];}_0x4443e0=_['merge']({},_0x4443e0,_0x1c3117[_0xcbd8('0x41')]);return db['OpenchannelQueueReport'][_0xcbd8('0x48')](_0x4443e0)['then'](handleEntityNotFound(_0x197d99,null))[_0xcbd8('0x25')](respondWithResult(_0x197d99,null))[_0xcbd8('0x49')](handleError(_0x197d99,null));};exports[_0xcbd8('0x4a')]=function(_0x3d8595,_0x514099){return db[_0xcbd8('0x42')][_0xcbd8('0x4a')](_0x3d8595[_0xcbd8('0x4b')],{})[_0xcbd8('0x25')](respondWithResult(_0x514099,0xc9))[_0xcbd8('0x49')](handleError(_0x514099,null));};exports[_0xcbd8('0x24')]=function(_0x1bab15,_0x34fdc3){if(_0x1bab15[_0xcbd8('0x4b')]['id']){delete _0x1bab15[_0xcbd8('0x4b')]['id'];}return db[_0xcbd8('0x42')][_0xcbd8('0x48')]({'where':{'id':_0x1bab15[_0xcbd8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34fdc3,null))[_0xcbd8('0x25')](saveUpdates(_0x1bab15['body'],null))[_0xcbd8('0x25')](respondWithResult(_0x34fdc3,null))[_0xcbd8('0x49')](handleError(_0x34fdc3,null));};exports[_0xcbd8('0x26')]=function(_0x239dc1,_0x45eff6){return db[_0xcbd8('0x42')]['find']({'where':{'id':_0x239dc1['params']['id']}})[_0xcbd8('0x25')](handleEntityNotFound(_0x45eff6,null))[_0xcbd8('0x25')](removeEntity(_0x45eff6,null))[_0xcbd8('0x49')](handleError(_0x45eff6,null));};exports[_0xcbd8('0x4d')]=function(_0x48a163,_0x5b144c){return db[_0xcbd8('0x42')]['describe']()['then'](respondWithResult(_0x5b144c,null))[_0xcbd8('0x49')](handleError(_0x5b144c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index dff52e7..3e0c21c 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(_0xe1269d,_0x57b7c3){var _0x261ca1=function(_0x13b234){while(--_0x13b234){_0xe1269d['push'](_0xe1269d['shift']());}};_0x261ca1(++_0x57b7c3);}(_0xe14b,0x93));var _0xbe14=function(_0xcb343,_0x57faf3){_0xcb343=_0xcb343-0x0;var _0x3133ad=_0xe14b[_0xcb343];return _0x3133ad;};'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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x18f1a5,_0x475159){var _0x15c0d5=function(_0x29b673){while(--_0x29b673){_0x18f1a5['push'](_0x18f1a5['shift']());}};_0x15c0d5(++_0x475159);}(_0xe14b,0x93));var _0xbe14=function(_0x44dafd,_0x5cc823){_0x44dafd=_0x44dafd-0x0;var _0xfccbf5=_0xe14b[_0x44dafd];return _0xfccbf5;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b3cfffc..0ea6827 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 _0x19e1=['where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update'];(function(_0x33c6d1,_0x21af35){var _0x5eff9f=function(_0x111fe7){while(--_0x111fe7){_0x33c6d1['push'](_0x33c6d1['shift']());}};_0x5eff9f(++_0x21af35);}(_0x19e1,0x163));var _0x119e=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x19e1[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});}exports[_0x119e('0x15')]=function(_0xb3375c){var _0x348ae3=this;return new Promise(function(_0xedc945,_0x2848fa){return db[_0x119e('0x16')][_0x119e('0x17')](_0xb3375c[_0x119e('0x18')],{'raw':_0xb3375c[_0x119e('0x19')]?_0xb3375c['options'][_0x119e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xd4c2d5){logger['info'](_0x119e('0x15'),_0xb3375c);logger[_0x119e('0xc')]('CreateOpenchannelQueueReport',_0xb3375c,JSON['stringify'](_0xd4c2d5));_0xedc945(_0xd4c2d5);})[_0x119e('0x14')](function(_0x29de19){logger[_0x119e('0xf')]('CreateOpenchannelQueueReport',_0x29de19['message'],_0xb3375c);_0x2848fa(_0x348ae3[_0x119e('0xf')](0x1f4,_0x29de19['message']));});});};exports[_0x119e('0x1b')]=function(_0x21fb19){var _0x198f7b=this;return new Promise(function(_0x596dfb,_0x1e4c98){return db['OpenchannelQueueReport'][_0x119e('0x1c')](_0x21fb19['body'],{'raw':_0x21fb19['options']?_0x21fb19[_0x119e('0x19')][_0x119e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21fb19[_0x119e('0x19')]?_0x21fb19[_0x119e('0x19')][_0x119e('0x1d')]||null:null,'attributes':_0x21fb19[_0x119e('0x19')]?_0x21fb19['options'][_0x119e('0x1e')]||null:null,'limit':_0x21fb19[_0x119e('0x19')]?_0x21fb19['options'][_0x119e('0x1f')]||null:null})[_0x119e('0xa')](function(_0x49b965){logger[_0x119e('0x12')]('UpdateOpenchannelQueueReport',_0x21fb19);logger[_0x119e('0xc')](_0x119e('0x1b'),_0x21fb19,JSON[_0x119e('0xe')](_0x49b965));_0x596dfb(_0x49b965);})[_0x119e('0x14')](function(_0x3df7e9){logger['error'](_0x119e('0x1b'),_0x3df7e9[_0x119e('0x11')],_0x21fb19);_0x1e4c98(_0x198f7b[_0x119e('0xf')](0x1f4,_0x3df7e9[_0x119e('0x11')]));});});}; \ No newline at end of file +var _0x5ed9=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x17a594,_0x3aed81){var _0xc5f397=function(_0x1203ab){while(--_0x1203ab){_0x17a594['push'](_0x17a594['shift']());}};_0xc5f397(++_0x3aed81);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5ed9[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});}exports[_0x95ed('0x15')]=function(_0x58fb9e){var _0x421ab9=this;return new Promise(function(_0x1bc47c,_0x4ad26d){return db[_0x95ed('0x16')][_0x95ed('0x17')](_0x58fb9e[_0x95ed('0x18')],{'raw':_0x58fb9e[_0x95ed('0x19')]?_0x58fb9e[_0x95ed('0x19')][_0x95ed('0x1a')]===undefined?!![]:![]:!![]})[_0x95ed('0x1b')](function(_0x3e05cf){logger[_0x95ed('0xb')](_0x95ed('0x15'),_0x58fb9e);logger['debug'](_0x95ed('0x15'),_0x58fb9e,JSON[_0x95ed('0xf')](_0x3e05cf));_0x1bc47c(_0x3e05cf);})['catch'](function(_0x5d5afe){logger['error'](_0x95ed('0x15'),_0x5d5afe[_0x95ed('0x12')],_0x58fb9e);_0x4ad26d(_0x421ab9[_0x95ed('0x10')](0x1f4,_0x5d5afe[_0x95ed('0x12')]));});});};exports[_0x95ed('0x1c')]=function(_0x19b664){var _0x3ef74c=this;return new Promise(function(_0x416d23,_0x146f74){return db[_0x95ed('0x16')][_0x95ed('0x1d')](_0x19b664[_0x95ed('0x18')],{'raw':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19b664[_0x95ed('0x19')]?_0x19b664['options']['where']||null:null,'attributes':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')][_0x95ed('0x1e')]||null:null,'limit':_0x19b664[_0x95ed('0x19')]?_0x19b664[_0x95ed('0x19')][_0x95ed('0x1f')]||null:null})[_0x95ed('0x1b')](function(_0x190620){logger[_0x95ed('0xb')](_0x95ed('0x1c'),_0x19b664);logger[_0x95ed('0xd')](_0x95ed('0x1c'),_0x19b664,JSON['stringify'](_0x190620));_0x416d23(_0x190620);})[_0x95ed('0x14')](function(_0xf73b6f){logger['error'](_0x95ed('0x1c'),_0xf73b6f['message'],_0x19b664);_0x146f74(_0x3ef74c['error'](0x1f4,_0xf73b6f['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 9c58d55..c09343f 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 _0xfcaf=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x25c3d1,_0x5196a1){var _0x4a3075=function(_0x6907de){while(--_0x6907de){_0x25c3d1['push'](_0x25c3d1['shift']());}};_0x4a3075(++_0x5196a1);}(_0xfcaf,0x7e));var _0xffca=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0xfcaf[_0x2dce9f];return _0x1cd454;};'use strict';var multer=require(_0xffca('0x0'));var util=require(_0xffca('0x1'));var path=require(_0xffca('0x2'));var timeout=require(_0xffca('0x3'));var express=require('express');var router=express[_0xffca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xffca('0x5'));var interaction=require(_0xffca('0x6'));var config=require(_0xffca('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0xffca('0x8')]('/',auth[_0xffca('0x9')](),controller[_0xffca('0xa')]);router[_0xffca('0x8')](_0xffca('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xffca('0x8')](_0xffca('0xc'),auth[_0xffca('0x9')](),controller[_0xffca('0xd')]);router[_0xffca('0xe')]('/',auth[_0xffca('0x9')](),controller[_0xffca('0xf')]);router['put'](_0xffca('0xc'),auth[_0xffca('0x9')](),controller[_0xffca('0x10')]);router[_0xffca('0x11')](_0xffca('0xc'),auth[_0xffca('0x9')](),controller[_0xffca('0x12')]);module[_0xffca('0x13')]=router; \ No newline at end of file +var _0x61a7=['index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61a7,0x160));var _0x761a=function(_0x35b579,_0x2d94a5){_0x35b579=_0x35b579-0x0;var _0x4e4cda=_0x61a7[_0x35b579];return _0x4e4cda;};'use strict';var multer=require(_0x761a('0x0'));var util=require('util');var path=require(_0x761a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x761a('0x2')]();var fs_extra=require(_0x761a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x761a('0x4'));var config=require(_0x761a('0x5'));var controller=require(_0x761a('0x6'));router['get']('/',auth[_0x761a('0x7')](),controller[_0x761a('0x8')]);router[_0x761a('0x9')](_0x761a('0xa'),auth[_0x761a('0x7')](),controller[_0x761a('0xb')]);router['get'](_0x761a('0xc'),auth[_0x761a('0x7')](),controller['show']);router[_0x761a('0xd')]('/',auth[_0x761a('0x7')](),controller[_0x761a('0xe')]);router[_0x761a('0xf')](_0x761a('0xc'),auth[_0x761a('0x7')](),controller[_0x761a('0x10')]);router[_0x761a('0x11')](_0x761a('0xc'),auth['isAuthenticated'](),controller[_0x761a('0x12')]);module[_0x761a('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e724dc1..df9d724 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5d4078,_0x8da411){var _0x49fb8f=function(_0x2686cf){while(--_0x2686cf){_0x5d4078['push'](_0x5d4078['shift']());}};_0x49fb8f(++_0x8da411);}(_0x008c,0x188));var _0xc008=function(_0x2709bb,_0x41eede){_0x2709bb=_0x2709bb-0x0;var _0x5a5bbd=_0x008c[_0x2709bb];return _0x5a5bbd;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1ab527,_0x373063){_0x1ab527=_0x1ab527-0x0;var _0x318583=_0x9bde[_0x1ab527];return _0x318583;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a38fca9..29c3d17 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 _0xb93e=['json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelTransferReport','findAll','catch','show','includeAll','include','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0xb93e,0x85));var _0xeb93=function(_0x155b44,_0x49db6f){_0x155b44=_0x155b44-0x0;var _0x142a23=_0xb93e[_0x155b44];return _0x142a23;};'use strict';var emlformat=require(_0xeb93('0x0'));var rimraf=require(_0xeb93('0x1'));var zipdir=require(_0xeb93('0x2'));var jsonpatch=require(_0xeb93('0x3'));var rp=require(_0xeb93('0x4'));var moment=require('moment');var BPromise=require(_0xeb93('0x5'));var Mustache=require(_0xeb93('0x6'));var util=require(_0xeb93('0x7'));var path=require('path');var sox=require(_0xeb93('0x8'));var csv=require(_0xeb93('0x9'));var ejs=require(_0xeb93('0xa'));var fs=require('fs');var fs_extra=require(_0xeb93('0xb'));var _=require(_0xeb93('0xc'));var squel=require(_0xeb93('0xd'));var crypto=require(_0xeb93('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xeb93('0xf'));var toCsv=require(_0xeb93('0x9'));var querystring=require(_0xeb93('0x10'));var Papa=require(_0xeb93('0x11'));var Redis=require(_0xeb93('0x12'));var authService=require(_0xeb93('0x13'));var qs=require(_0xeb93('0x14'));var as=require(_0xeb93('0x15'));var hardwareService=require(_0xeb93('0x16'));var logger=require(_0xeb93('0x17'))(_0xeb93('0x18'));var utils=require(_0xeb93('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xeb93('0x1a'));var db=require(_0xeb93('0x1b'))['db'];function respondWithStatusCode(_0x3e8e3f,_0x21e679){_0x21e679=_0x21e679||0xcc;return function(_0x3b51f6){if(_0x3b51f6){return _0x3e8e3f[_0xeb93('0x1c')](_0x21e679);}return _0x3e8e3f[_0xeb93('0x1d')](_0x21e679)[_0xeb93('0x1e')]();};}function respondWithResult(_0x237d02,_0x21ad65){_0x21ad65=_0x21ad65||0xc8;return function(_0x52ec1b){if(_0x52ec1b){return _0x237d02[_0xeb93('0x1d')](_0x21ad65)[_0xeb93('0x1f')](_0x52ec1b);}};}function respondWithFilteredResult(_0x3a7185,_0xb777e4){return function(_0x142844){if(_0x142844){var _0x26ff35=typeof _0xb777e4['offset']===_0xeb93('0x20')&&typeof _0xb777e4[_0xeb93('0x21')]===_0xeb93('0x20');var _0x5da5a7=_0x142844[_0xeb93('0x22')];var _0x51f17f=_0x26ff35?0x0:_0xb777e4[_0xeb93('0x23')];var _0x4c35ce=_0x26ff35?_0x142844[_0xeb93('0x22')]:_0xb777e4[_0xeb93('0x23')]+_0xb777e4['limit'];var _0xe7b3f3;if(_0x4c35ce>=_0x5da5a7){_0x4c35ce=_0x5da5a7;_0xe7b3f3=0xc8;}else{_0xe7b3f3=0xce;}_0x3a7185[_0xeb93('0x1d')](_0xe7b3f3);return _0x3a7185[_0xeb93('0x24')]('Content-Range',_0x51f17f+'-'+_0x4c35ce+'/'+_0x5da5a7)[_0xeb93('0x1f')](_0x142844);}return null;};}function patchUpdates(_0x12fb32){return function(_0x2f0592){try{jsonpatch[_0xeb93('0x25')](_0x2f0592,_0x12fb32,!![]);}catch(_0x3d27e2){return BPromise[_0xeb93('0x26')](_0x3d27e2);}return _0x2f0592[_0xeb93('0x27')]();};}function saveUpdates(_0x144965,_0x3744f9){return function(_0x397c49){if(_0x397c49){return _0x397c49['update'](_0x144965)[_0xeb93('0x28')](function(_0x547e40){return _0x547e40;});}return null;};}function removeEntity(_0x323727,_0x304027){return function(_0x188ed0){if(_0x188ed0){return _0x188ed0[_0xeb93('0x29')]()[_0xeb93('0x28')](function(){_0x323727[_0xeb93('0x1d')](0xcc)[_0xeb93('0x1e')]();});}};}function handleEntityNotFound(_0x2b40d6,_0x5e5f0b){return function(_0x3fa881){if(!_0x3fa881){_0x2b40d6[_0xeb93('0x1c')](0x194);}return _0x3fa881;};}function handleError(_0x37d994,_0x135bbc){_0x135bbc=_0x135bbc||0x1f4;return function(_0x2ff2cd){logger[_0xeb93('0x2a')](_0x2ff2cd[_0xeb93('0x2b')]);if(_0x2ff2cd[_0xeb93('0x2c')]){delete _0x2ff2cd['name'];}_0x37d994['status'](_0x135bbc)[_0xeb93('0x2d')](_0x2ff2cd);};}exports[_0xeb93('0x2e')]=function(_0x4e6384,_0x2b56f5){var _0x2c2ec9={},_0x4da4ab={},_0x58d22e={'count':0x0,'rows':[]};var _0x20f890=_['map'](db['OpenchannelTransferReport'][_0xeb93('0x2f')],function(_0x5d6614){return{'name':_0x5d6614[_0xeb93('0x30')],'type':_0x5d6614[_0xeb93('0x31')][_0xeb93('0x32')]};});_0x4da4ab[_0xeb93('0x33')]=_[_0xeb93('0x34')](_0x20f890,_0xeb93('0x2c'));_0x4da4ab['query']=_[_0xeb93('0x35')](_0x4e6384[_0xeb93('0x36')]);_0x4da4ab[_0xeb93('0x37')]=_[_0xeb93('0x38')](_0x4da4ab[_0xeb93('0x33')],_0x4da4ab['query']);_0x2c2ec9[_0xeb93('0x39')]=_[_0xeb93('0x38')](_0x4da4ab[_0xeb93('0x33')],qs[_0xeb93('0x3a')](_0x4e6384[_0xeb93('0x36')][_0xeb93('0x3a')]));_0x2c2ec9['attributes']=_0x2c2ec9['attributes'][_0xeb93('0x3b')]?_0x2c2ec9['attributes']:_0x4da4ab['model'];if(!_0x4e6384[_0xeb93('0x36')][_0xeb93('0x3c')](_0xeb93('0x3d'))){_0x2c2ec9['limit']=qs[_0xeb93('0x21')](_0x4e6384[_0xeb93('0x36')][_0xeb93('0x21')]);_0x2c2ec9[_0xeb93('0x23')]=qs['offset'](_0x4e6384[_0xeb93('0x36')]['offset']);}_0x2c2ec9[_0xeb93('0x3e')]=qs[_0xeb93('0x3f')](_0x4e6384[_0xeb93('0x36')][_0xeb93('0x3f')]);_0x2c2ec9[_0xeb93('0x40')]=qs[_0xeb93('0x37')](_[_0xeb93('0x41')](_0x4e6384[_0xeb93('0x36')],_0x4da4ab['filters']),_0x20f890);if(_0x4e6384['query'][_0xeb93('0x42')]){_0x2c2ec9[_0xeb93('0x40')]=_[_0xeb93('0x43')](_0x2c2ec9['where'],{'$or':_[_0xeb93('0x34')](_0x20f890,function(_0xf4e0c3){if(_0xf4e0c3[_0xeb93('0x31')]!==_0xeb93('0x44')){var _0x52fdd8={};_0x52fdd8[_0xf4e0c3['name']]={'$like':'%'+_0x4e6384['query'][_0xeb93('0x42')]+'%'};return _0x52fdd8;}})});}_0x2c2ec9=_[_0xeb93('0x43')]({},_0x2c2ec9,_0x4e6384['options']);var _0x2baed9={'where':_0x2c2ec9['where']};return db[_0xeb93('0x45')]['count'](_0x2baed9)[_0xeb93('0x28')](function(_0x4afa3d){_0x58d22e['count']=_0x4afa3d;if(_0x4e6384['query']['includeAll']){_0x2c2ec9['include']=[{'all':!![]}];}return db[_0xeb93('0x45')][_0xeb93('0x46')](_0x2c2ec9);})[_0xeb93('0x28')](function(_0x82a15c){_0x58d22e['rows']=_0x82a15c;return _0x58d22e;})[_0xeb93('0x28')](respondWithFilteredResult(_0x2b56f5,_0x2c2ec9))[_0xeb93('0x47')](handleError(_0x2b56f5,null));};exports[_0xeb93('0x48')]=function(_0x18aede,_0x302114){var _0x10b174={'raw':!![],'where':{'id':_0x18aede['params']['id']}},_0x5d823b={};_0x5d823b[_0xeb93('0x33')]=_['keys'](db[_0xeb93('0x45')][_0xeb93('0x2f')]);_0x5d823b[_0xeb93('0x36')]=_[_0xeb93('0x35')](_0x18aede[_0xeb93('0x36')]);_0x5d823b[_0xeb93('0x37')]=_[_0xeb93('0x38')](_0x5d823b[_0xeb93('0x33')],_0x5d823b['query']);_0x10b174['attributes']=_[_0xeb93('0x38')](_0x5d823b[_0xeb93('0x33')],qs[_0xeb93('0x3a')](_0x18aede[_0xeb93('0x36')]['fields']));_0x10b174[_0xeb93('0x39')]=_0x10b174[_0xeb93('0x39')]['length']?_0x10b174[_0xeb93('0x39')]:_0x5d823b[_0xeb93('0x33')];if(_0x18aede['query'][_0xeb93('0x49')]){_0x10b174[_0xeb93('0x4a')]=[{'all':!![]}];}_0x10b174=_[_0xeb93('0x43')]({},_0x10b174,_0x18aede[_0xeb93('0x4b')]);return db['OpenchannelTransferReport'][_0xeb93('0x4c')](_0x10b174)[_0xeb93('0x28')](handleEntityNotFound(_0x302114,null))[_0xeb93('0x28')](respondWithResult(_0x302114,null))[_0xeb93('0x47')](handleError(_0x302114,null));};exports[_0xeb93('0x4d')]=function(_0x54a096,_0xc90dde){return db[_0xeb93('0x45')]['create'](_0x54a096[_0xeb93('0x4e')],{})['then'](respondWithResult(_0xc90dde,0xc9))[_0xeb93('0x47')](handleError(_0xc90dde,null));};exports[_0xeb93('0x4f')]=function(_0x181e32,_0xd4c4){if(_0x181e32['body']['id']){delete _0x181e32[_0xeb93('0x4e')]['id'];}return db[_0xeb93('0x45')]['find']({'where':{'id':_0x181e32[_0xeb93('0x50')]['id']}})[_0xeb93('0x28')](handleEntityNotFound(_0xd4c4,null))[_0xeb93('0x28')](saveUpdates(_0x181e32[_0xeb93('0x4e')],null))['then'](respondWithResult(_0xd4c4,null))[_0xeb93('0x47')](handleError(_0xd4c4,null));};exports[_0xeb93('0x29')]=function(_0x2786b1,_0x4e467a){return db[_0xeb93('0x45')][_0xeb93('0x4c')]({'where':{'id':_0x2786b1[_0xeb93('0x50')]['id']}})[_0xeb93('0x28')](handleEntityNotFound(_0x4e467a,null))[_0xeb93('0x28')](removeEntity(_0x4e467a,null))[_0xeb93('0x47')](handleError(_0x4e467a,null));};exports[_0xeb93('0x51')]=function(_0x52aa85,_0x2bfc9c){return db['OpenchannelTransferReport']['describe']()['then'](respondWithResult(_0x2bfc9c,null))[_0xeb93('0x47')](handleError(_0x2bfc9c,null));}; \ No newline at end of file +var _0x3494=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','OpenchannelTransferReport','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x3494,0x13e));var _0x4349=function(_0x248c36,_0x47f960){_0x248c36=_0x248c36-0x0;var _0x22a14b=_0x3494[_0x248c36];return _0x22a14b;};'use strict';var emlformat=require(_0x4349('0x0'));var rimraf=require(_0x4349('0x1'));var zipdir=require(_0x4349('0x2'));var jsonpatch=require(_0x4349('0x3'));var rp=require(_0x4349('0x4'));var moment=require(_0x4349('0x5'));var BPromise=require(_0x4349('0x6'));var Mustache=require(_0x4349('0x7'));var util=require(_0x4349('0x8'));var path=require(_0x4349('0x9'));var sox=require('sox');var csv=require(_0x4349('0xa'));var ejs=require(_0x4349('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4349('0xc'));var crypto=require(_0x4349('0xd'));var jsforce=require(_0x4349('0xe'));var deskjs=require(_0x4349('0xf'));var toCsv=require(_0x4349('0xa'));var querystring=require(_0x4349('0x10'));var Papa=require(_0x4349('0x11'));var Redis=require(_0x4349('0x12'));var authService=require(_0x4349('0x13'));var qs=require(_0x4349('0x14'));var as=require(_0x4349('0x15'));var hardwareService=require(_0x4349('0x16'));var logger=require(_0x4349('0x17'))(_0x4349('0x18'));var utils=require(_0x4349('0x19'));var config=require(_0x4349('0x1a'));var licenseUtil=require(_0x4349('0x1b'));var db=require(_0x4349('0x1c'))['db'];function respondWithStatusCode(_0x12b0ec,_0x4cc67d){_0x4cc67d=_0x4cc67d||0xcc;return function(_0x4f93f5){if(_0x4f93f5){return _0x12b0ec[_0x4349('0x1d')](_0x4cc67d);}return _0x12b0ec['status'](_0x4cc67d)[_0x4349('0x1e')]();};}function respondWithResult(_0x47a703,_0xa1a669){_0xa1a669=_0xa1a669||0xc8;return function(_0x44f094){if(_0x44f094){return _0x47a703[_0x4349('0x1f')](_0xa1a669)['json'](_0x44f094);}};}function respondWithFilteredResult(_0x5f2c5d,_0xaa299b){return function(_0x3a0fc5){if(_0x3a0fc5){var _0x21431b=typeof _0xaa299b['offset']===_0x4349('0x20')&&typeof _0xaa299b[_0x4349('0x21')]===_0x4349('0x20');var _0x22eff6=_0x3a0fc5[_0x4349('0x22')];var _0x23f053=_0x21431b?0x0:_0xaa299b[_0x4349('0x23')];var _0x50a51b=_0x21431b?_0x3a0fc5['count']:_0xaa299b['offset']+_0xaa299b[_0x4349('0x21')];var _0x594ea6;if(_0x50a51b>=_0x22eff6){_0x50a51b=_0x22eff6;_0x594ea6=0xc8;}else{_0x594ea6=0xce;}_0x5f2c5d[_0x4349('0x1f')](_0x594ea6);return _0x5f2c5d['set'](_0x4349('0x24'),_0x23f053+'-'+_0x50a51b+'/'+_0x22eff6)[_0x4349('0x25')](_0x3a0fc5);}return null;};}function patchUpdates(_0x4568e9){return function(_0xf60a9b){try{jsonpatch[_0x4349('0x26')](_0xf60a9b,_0x4568e9,!![]);}catch(_0x53a772){return BPromise[_0x4349('0x27')](_0x53a772);}return _0xf60a9b[_0x4349('0x28')]();};}function saveUpdates(_0x127d35,_0x14577f){return function(_0x23e94a){if(_0x23e94a){return _0x23e94a[_0x4349('0x29')](_0x127d35)['then'](function(_0x2d8b7a){return _0x2d8b7a;});}return null;};}function removeEntity(_0x30fce5,_0x189f18){return function(_0x450719){if(_0x450719){return _0x450719[_0x4349('0x2a')]()['then'](function(){_0x30fce5[_0x4349('0x1f')](0xcc)[_0x4349('0x1e')]();});}};}function handleEntityNotFound(_0x36864d,_0x5840c6){return function(_0x11a199){if(!_0x11a199){_0x36864d['sendStatus'](0x194);}return _0x11a199;};}function handleError(_0x2e9be9,_0x3e742f){_0x3e742f=_0x3e742f||0x1f4;return function(_0x4e953){logger['error'](_0x4e953[_0x4349('0x2b')]);if(_0x4e953[_0x4349('0x2c')]){delete _0x4e953[_0x4349('0x2c')];}_0x2e9be9['status'](_0x3e742f)[_0x4349('0x2d')](_0x4e953);};}exports[_0x4349('0x2e')]=function(_0x58bc46,_0x369902){var _0x49d3b3={},_0x4a0bd6={},_0x37d1aa={'count':0x0,'rows':[]};var _0x49a716=_[_0x4349('0x2f')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x1e7f0d){return{'name':_0x1e7f0d[_0x4349('0x30')],'type':_0x1e7f0d['type'][_0x4349('0x31')]};});_0x4a0bd6[_0x4349('0x32')]=_['map'](_0x49a716,_0x4349('0x2c'));_0x4a0bd6[_0x4349('0x33')]=_[_0x4349('0x34')](_0x58bc46[_0x4349('0x33')]);_0x4a0bd6[_0x4349('0x35')]=_[_0x4349('0x36')](_0x4a0bd6[_0x4349('0x32')],_0x4a0bd6['query']);_0x49d3b3[_0x4349('0x37')]=_[_0x4349('0x36')](_0x4a0bd6[_0x4349('0x32')],qs[_0x4349('0x38')](_0x58bc46['query'][_0x4349('0x38')]));_0x49d3b3[_0x4349('0x37')]=_0x49d3b3[_0x4349('0x37')][_0x4349('0x39')]?_0x49d3b3[_0x4349('0x37')]:_0x4a0bd6[_0x4349('0x32')];if(!_0x58bc46['query'][_0x4349('0x3a')](_0x4349('0x3b'))){_0x49d3b3[_0x4349('0x21')]=qs[_0x4349('0x21')](_0x58bc46[_0x4349('0x33')][_0x4349('0x21')]);_0x49d3b3['offset']=qs[_0x4349('0x23')](_0x58bc46[_0x4349('0x33')][_0x4349('0x23')]);}_0x49d3b3[_0x4349('0x3c')]=qs[_0x4349('0x3d')](_0x58bc46['query'][_0x4349('0x3d')]);_0x49d3b3['where']=qs['filters'](_[_0x4349('0x3e')](_0x58bc46[_0x4349('0x33')],_0x4a0bd6[_0x4349('0x35')]),_0x49a716);if(_0x58bc46[_0x4349('0x33')][_0x4349('0x3f')]){_0x49d3b3[_0x4349('0x40')]=_[_0x4349('0x41')](_0x49d3b3[_0x4349('0x40')],{'$or':_[_0x4349('0x2f')](_0x49a716,function(_0xc685d6){if(_0xc685d6['type']!=='VIRTUAL'){var _0x5d64fd={};_0x5d64fd[_0xc685d6[_0x4349('0x2c')]]={'$like':'%'+_0x58bc46[_0x4349('0x33')][_0x4349('0x3f')]+'%'};return _0x5d64fd;}})});}_0x49d3b3=_[_0x4349('0x41')]({},_0x49d3b3,_0x58bc46[_0x4349('0x42')]);var _0x3fb1bb={'where':_0x49d3b3[_0x4349('0x40')]};return db[_0x4349('0x43')]['count'](_0x3fb1bb)[_0x4349('0x44')](function(_0x4f1676){_0x37d1aa[_0x4349('0x22')]=_0x4f1676;if(_0x58bc46[_0x4349('0x33')][_0x4349('0x45')]){_0x49d3b3[_0x4349('0x46')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4349('0x47')](_0x49d3b3);})[_0x4349('0x44')](function(_0x5dbcca){_0x37d1aa[_0x4349('0x48')]=_0x5dbcca;return _0x37d1aa;})[_0x4349('0x44')](respondWithFilteredResult(_0x369902,_0x49d3b3))[_0x4349('0x49')](handleError(_0x369902,null));};exports[_0x4349('0x4a')]=function(_0x2831a5,_0x5137b7){var _0x68e884={'raw':!![],'where':{'id':_0x2831a5[_0x4349('0x4b')]['id']}},_0x3d6508={};_0x3d6508[_0x4349('0x32')]=_[_0x4349('0x34')](db[_0x4349('0x43')]['rawAttributes']);_0x3d6508[_0x4349('0x33')]=_[_0x4349('0x34')](_0x2831a5[_0x4349('0x33')]);_0x3d6508['filters']=_['intersection'](_0x3d6508[_0x4349('0x32')],_0x3d6508[_0x4349('0x33')]);_0x68e884[_0x4349('0x37')]=_[_0x4349('0x36')](_0x3d6508[_0x4349('0x32')],qs['fields'](_0x2831a5[_0x4349('0x33')]['fields']));_0x68e884[_0x4349('0x37')]=_0x68e884[_0x4349('0x37')][_0x4349('0x39')]?_0x68e884['attributes']:_0x3d6508[_0x4349('0x32')];if(_0x2831a5['query'][_0x4349('0x45')]){_0x68e884[_0x4349('0x46')]=[{'all':!![]}];}_0x68e884=_[_0x4349('0x41')]({},_0x68e884,_0x2831a5[_0x4349('0x42')]);return db[_0x4349('0x43')][_0x4349('0x4c')](_0x68e884)[_0x4349('0x44')](handleEntityNotFound(_0x5137b7,null))['then'](respondWithResult(_0x5137b7,null))[_0x4349('0x49')](handleError(_0x5137b7,null));};exports[_0x4349('0x4d')]=function(_0x53bde0,_0x4f5fb4){return db[_0x4349('0x43')][_0x4349('0x4d')](_0x53bde0['body'],{})[_0x4349('0x44')](respondWithResult(_0x4f5fb4,0xc9))[_0x4349('0x49')](handleError(_0x4f5fb4,null));};exports[_0x4349('0x29')]=function(_0x3044fa,_0x16907e){if(_0x3044fa[_0x4349('0x4e')]['id']){delete _0x3044fa['body']['id'];}return db['OpenchannelTransferReport'][_0x4349('0x4c')]({'where':{'id':_0x3044fa[_0x4349('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16907e,null))[_0x4349('0x44')](saveUpdates(_0x3044fa[_0x4349('0x4e')],null))[_0x4349('0x44')](respondWithResult(_0x16907e,null))[_0x4349('0x49')](handleError(_0x16907e,null));};exports['destroy']=function(_0x53f570,_0xd84e03){return db[_0x4349('0x43')]['find']({'where':{'id':_0x53f570[_0x4349('0x4b')]['id']}})[_0x4349('0x44')](handleEntityNotFound(_0xd84e03,null))[_0x4349('0x44')](removeEntity(_0xd84e03,null))[_0x4349('0x49')](handleError(_0xd84e03,null));};exports[_0x4349('0x4f')]=function(_0x14c8fe,_0x3caf80){return db[_0x4349('0x43')][_0x4349('0x4f')]()['then'](respondWithResult(_0x3caf80,null))[_0x4349('0x49')](handleError(_0x3caf80,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0931080..d05322d 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 _0xef40=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x45d5ef,_0x10c29b){var _0x474d19=function(_0xc182bf){while(--_0xc182bf){_0x45d5ef['push'](_0x45d5ef['shift']());}};_0x474d19(++_0x10c29b);}(_0xef40,0x1c4));var _0x0ef4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xef40[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0ef4('0x0'));var util=require('util');var logger=require(_0x0ef4('0x1'))(_0x0ef4('0x2'));var moment=require(_0x0ef4('0x3'));var BPromise=require(_0x0ef4('0x4'));var rp=require(_0x0ef4('0x5'));var fs=require('fs');var path=require(_0x0ef4('0x6'));var rimraf=require(_0x0ef4('0x7'));var config=require(_0x0ef4('0x8'));var attributes=require(_0x0ef4('0x9'));module['exports']=function(_0x3a9549,_0x25f725){return _0x3a9549[_0x0ef4('0xa')](_0x0ef4('0xb'),attributes,{'tableName':_0x0ef4('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0ef4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc963=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x12f994,_0x1bd6e4){var _0x545ff3=function(_0x4347e1){while(--_0x4347e1){_0x12f994['push'](_0x12f994['shift']());}};_0x545ff3(++_0x1bd6e4);}(_0xc963,0x198));var _0x3c96=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0xc963[_0x220afa];return _0x1b79d1;};'use strict';var _=require(_0x3c96('0x0'));var util=require(_0x3c96('0x1'));var logger=require(_0x3c96('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3c96('0x3'));var rp=require(_0x3c96('0x4'));var fs=require('fs');var path=require(_0x3c96('0x5'));var rimraf=require(_0x3c96('0x6'));var config=require(_0x3c96('0x7'));var attributes=require(_0x3c96('0x8'));module[_0x3c96('0x9')]=function(_0x26f6ad,_0x3685a9){return _0x26f6ad[_0x3c96('0xa')](_0x3c96('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','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 cfe0e49..7b3ef94 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 _0x98a8=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xea3e64,_0x249120){var _0x17028c=function(_0x4b658c){while(--_0x4b658c){_0xea3e64['push'](_0xea3e64['shift']());}};_0x17028c(++_0x249120);}(_0x98a8,0x12c));var _0x898a=function(_0x1858d6,_0x2881b0){_0x1858d6=_0x1858d6-0x0;var _0x3eab17=_0x98a8[_0x1858d6];return _0x3eab17;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0xc474=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x4ab6e6,_0x2ae37a){var _0x191476=function(_0x2b4328){while(--_0x2b4328){_0x4ab6e6['push'](_0x4ab6e6['shift']());}};_0x191476(++_0x2ae37a);}(_0xc474,0xfc));var _0x4c47=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xc474[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x4c47('0x0'));var util=require(_0x4c47('0x1'));var moment=require(_0x4c47('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c47('0x3'));var fs=require('fs');var Redis=require(_0x4c47('0x4'));var db=require(_0x4c47('0x5'))['db'];var utils=require(_0x4c47('0x6'));var logger=require(_0x4c47('0x7'))(_0x4c47('0x8'));var config=require(_0x4c47('0x9'));var jayson=require(_0x4c47('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6aeef8,_0x255b6e,_0x275a64){return new BPromise(function(_0x35a093,_0x2593c2){return client['request'](_0x6aeef8,_0x275a64)[_0x4c47('0xb')](function(_0x1d2f5c){logger['info'](_0x4c47('0xc'),_0x255b6e,_0x4c47('0xd'));logger[_0x4c47('0xe')](_0x4c47('0xf'),_0x255b6e,'request\x20sent',JSON[_0x4c47('0x10')](_0x1d2f5c));if(_0x1d2f5c['error']){if(_0x1d2f5c[_0x4c47('0x11')][_0x4c47('0x12')]===0x1f4){logger[_0x4c47('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x255b6e,_0x1d2f5c[_0x4c47('0x11')][_0x4c47('0x13')]);return _0x2593c2(_0x1d2f5c['error'][_0x4c47('0x13')]);}logger['error'](_0x4c47('0xc'),_0x255b6e,_0x1d2f5c[_0x4c47('0x11')][_0x4c47('0x13')]);return _0x35a093(_0x1d2f5c[_0x4c47('0x11')]['message']);}else{logger[_0x4c47('0x14')](_0x4c47('0xc'),_0x255b6e,_0x4c47('0xd'));_0x35a093(_0x1d2f5c[_0x4c47('0x15')]['message']);}})['catch'](function(_0x5afffc){logger[_0x4c47('0x11')](_0x4c47('0xc'),_0x255b6e,_0x5afffc);_0x2593c2(_0x5afffc);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3abe7d2..b38c7ee 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 _0x2785=['create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show'];(function(_0x2b4cf3,_0x367b12){var _0x2773c3=function(_0x3d813e){while(--_0x3d813e){_0x2b4cf3['push'](_0x2b4cf3['shift']());}};_0x2773c3(++_0x367b12);}(_0x2785,0x1be));var _0x5278=function(_0x3bf043,_0x439342){_0x3bf043=_0x3bf043-0x0;var _0x35a484=_0x2785[_0x3bf043];return _0x35a484;};'use strict';var multer=require(_0x5278('0x0'));var util=require(_0x5278('0x1'));var path=require(_0x5278('0x2'));var timeout=require(_0x5278('0x3'));var express=require(_0x5278('0x4'));var router=express['Router']();var fs_extra=require(_0x5278('0x5'));var auth=require(_0x5278('0x6'));var interaction=require(_0x5278('0x7'));var config=require(_0x5278('0x8'));var controller=require(_0x5278('0x9'));router[_0x5278('0xa')]('/',auth[_0x5278('0xb')](),controller[_0x5278('0xc')]);router[_0x5278('0xa')]('/:id',auth[_0x5278('0xb')](),controller[_0x5278('0xd')]);router['post']('/',auth[_0x5278('0xb')](),controller[_0x5278('0xe')]);router['put']('/:id',auth[_0x5278('0xb')](),controller[_0x5278('0xf')]);router[_0x5278('0x10')](_0x5278('0x11'),auth[_0x5278('0xb')](),controller[_0x5278('0x12')]);module[_0x5278('0x13')]=router; \ No newline at end of file +var _0x4a0e=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0x4a0e,0xab));var _0xe4a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4a0e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe4a0('0x0'));var util=require(_0xe4a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4a0('0x2'));var router=express[_0xe4a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe4a0('0x4'));var interaction=require(_0xe4a0('0x5'));var config=require(_0xe4a0('0x6'));var controller=require('./pause.controller');router[_0xe4a0('0x7')]('/',auth[_0xe4a0('0x8')](),controller[_0xe4a0('0x9')]);router['get'](_0xe4a0('0xa'),auth[_0xe4a0('0x8')](),controller[_0xe4a0('0xb')]);router[_0xe4a0('0xc')]('/',auth[_0xe4a0('0x8')](),controller[_0xe4a0('0xd')]);router[_0xe4a0('0xe')]('/:id',auth[_0xe4a0('0x8')](),controller[_0xe4a0('0xf')]);router[_0xe4a0('0x10')](_0xe4a0('0xa'),auth[_0xe4a0('0x8')](),controller[_0xe4a0('0x11')]);module[_0xe4a0('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7bb9b99..16ad0ab 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 _0xab19=['name','sequelize','exports'];(function(_0x18f38c,_0x1cde0d){var _0x357d65=function(_0x71b2be){while(--_0x71b2be){_0x18f38c['push'](_0x18f38c['shift']());}};_0x357d65(++_0x1cde0d);}(_0xab19,0xfa));var _0x9ab1=function(_0x5543a7,_0x5e0ea9){_0x5543a7=_0x5543a7-0x0;var _0x408cf2=_0xab19[_0x5543a7];return _0x408cf2;};'use strict';var Sequelize=require(_0x9ab1('0x0'));module[_0x9ab1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9ab1('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc695=['exports','STRING'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xc695,0x118));var _0x5c69=function(_0x279522,_0x497270){_0x279522=_0x279522-0x0;var _0xc6071d=_0xc695[_0x279522];return _0xc6071d;};'use strict';var Sequelize=require('sequelize');module[_0x5c69('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5c69('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 888db23..deeb136 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 _0xcfd6=['index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','Pauses','stack','name','send'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcfd6,0x83));var _0x6cfd=function(_0x499937,_0x4a473b){_0x499937=_0x499937-0x0;var _0x41f9b9=_0xcfd6[_0x499937];return _0x41f9b9;};'use strict';var emlformat=require(_0x6cfd('0x0'));var rimraf=require(_0x6cfd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6cfd('0x2'));var moment=require(_0x6cfd('0x3'));var BPromise=require(_0x6cfd('0x4'));var Mustache=require(_0x6cfd('0x5'));var util=require(_0x6cfd('0x6'));var path=require('path');var sox=require(_0x6cfd('0x7'));var csv=require(_0x6cfd('0x8'));var ejs=require(_0x6cfd('0x9'));var fs=require('fs');var fs_extra=require(_0x6cfd('0xa'));var _=require(_0x6cfd('0xb'));var squel=require('squel');var crypto=require(_0x6cfd('0xc'));var jsforce=require(_0x6cfd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6cfd('0x8'));var querystring=require(_0x6cfd('0xe'));var Papa=require(_0x6cfd('0xf'));var Redis=require(_0x6cfd('0x10'));var authService=require(_0x6cfd('0x11'));var qs=require(_0x6cfd('0x12'));var as=require(_0x6cfd('0x13'));var hardwareService=require(_0x6cfd('0x14'));var logger=require(_0x6cfd('0x15'))(_0x6cfd('0x16'));var utils=require(_0x6cfd('0x17'));var config=require(_0x6cfd('0x18'));var licenseUtil=require(_0x6cfd('0x19'));var db=require(_0x6cfd('0x1a'))['db'];function respondWithStatusCode(_0x26f632,_0x532a41){_0x532a41=_0x532a41||0xcc;return function(_0x5073ee){if(_0x5073ee){return _0x26f632[_0x6cfd('0x1b')](_0x532a41);}return _0x26f632[_0x6cfd('0x1c')](_0x532a41)[_0x6cfd('0x1d')]();};}function respondWithResult(_0x3be556,_0x584bf9){_0x584bf9=_0x584bf9||0xc8;return function(_0x77df85){if(_0x77df85){return _0x3be556[_0x6cfd('0x1c')](_0x584bf9)[_0x6cfd('0x1e')](_0x77df85);}};}function respondWithFilteredResult(_0x326323,_0x48f81a){return function(_0x570105){if(_0x570105){var _0x2c1823=typeof _0x48f81a[_0x6cfd('0x1f')]===_0x6cfd('0x20')&&typeof _0x48f81a[_0x6cfd('0x21')]==='undefined';var _0x48a1ca=_0x570105[_0x6cfd('0x22')];var _0x488e8d=_0x2c1823?0x0:_0x48f81a[_0x6cfd('0x1f')];var _0x1c83c5=_0x2c1823?_0x570105[_0x6cfd('0x22')]:_0x48f81a[_0x6cfd('0x1f')]+_0x48f81a['limit'];var _0x1f6d55;if(_0x1c83c5>=_0x48a1ca){_0x1c83c5=_0x48a1ca;_0x1f6d55=0xc8;}else{_0x1f6d55=0xce;}_0x326323[_0x6cfd('0x1c')](_0x1f6d55);return _0x326323[_0x6cfd('0x23')]('Content-Range',_0x488e8d+'-'+_0x1c83c5+'/'+_0x48a1ca)['json'](_0x570105);}return null;};}function patchUpdates(_0x306c89){return function(_0x46c472){try{jsonpatch[_0x6cfd('0x24')](_0x46c472,_0x306c89,!![]);}catch(_0x4df03d){return BPromise[_0x6cfd('0x25')](_0x4df03d);}return _0x46c472['save']();};}function saveUpdates(_0x58f237,_0x5037d3){return function(_0x9b92f4){if(_0x9b92f4){return _0x9b92f4[_0x6cfd('0x26')](_0x58f237)[_0x6cfd('0x27')](function(_0x19396f){return _0x19396f;});}return null;};}function removeEntity(_0x16a50c,_0x4d1a0c){return function(_0x3ab50d){if(_0x3ab50d){return _0x3ab50d[_0x6cfd('0x28')]()['then'](function(){var _0x2dc764=_0x3ab50d['get']({'plain':!![]});var _0x219650=_0x6cfd('0x29');return db['UserProfileResource'][_0x6cfd('0x28')]({'where':{'type':_0x219650,'resourceId':_0x2dc764['id']}})[_0x6cfd('0x27')](function(){return _0x3ab50d;});})[_0x6cfd('0x27')](function(){_0x16a50c[_0x6cfd('0x1c')](0xcc)[_0x6cfd('0x1d')]();});}};}function handleEntityNotFound(_0x59d44f,_0x17ff36){return function(_0x479cf4){if(!_0x479cf4){_0x59d44f['sendStatus'](0x194);}return _0x479cf4;};}function handleError(_0x55d0df,_0xe6f26){_0xe6f26=_0xe6f26||0x1f4;return function(_0x51343a){logger['error'](_0x51343a[_0x6cfd('0x2a')]);if(_0x51343a['name']){delete _0x51343a[_0x6cfd('0x2b')];}_0x55d0df[_0x6cfd('0x1c')](_0xe6f26)[_0x6cfd('0x2c')](_0x51343a);};}exports[_0x6cfd('0x2d')]=function(_0x5a98b5,_0x60261c){var _0x4c7f52={},_0xc8433a={},_0x3bc7d6={'count':0x0,'rows':[]};var _0x408cd4=_[_0x6cfd('0x2e')](db[_0x6cfd('0x2f')][_0x6cfd('0x30')],function(_0x5f0334){return{'name':_0x5f0334[_0x6cfd('0x31')],'type':_0x5f0334[_0x6cfd('0x32')][_0x6cfd('0x33')]};});_0xc8433a[_0x6cfd('0x34')]=_[_0x6cfd('0x2e')](_0x408cd4,_0x6cfd('0x2b'));_0xc8433a[_0x6cfd('0x35')]=_[_0x6cfd('0x36')](_0x5a98b5[_0x6cfd('0x35')]);_0xc8433a['filters']=_[_0x6cfd('0x37')](_0xc8433a['model'],_0xc8433a[_0x6cfd('0x35')]);_0x4c7f52[_0x6cfd('0x38')]=_[_0x6cfd('0x37')](_0xc8433a[_0x6cfd('0x34')],qs['fields'](_0x5a98b5[_0x6cfd('0x35')][_0x6cfd('0x39')]));_0x4c7f52[_0x6cfd('0x38')]=_0x4c7f52[_0x6cfd('0x38')][_0x6cfd('0x3a')]?_0x4c7f52[_0x6cfd('0x38')]:_0xc8433a[_0x6cfd('0x34')];if(!_0x5a98b5[_0x6cfd('0x35')][_0x6cfd('0x3b')](_0x6cfd('0x3c'))){_0x4c7f52[_0x6cfd('0x21')]=qs[_0x6cfd('0x21')](_0x5a98b5[_0x6cfd('0x35')][_0x6cfd('0x21')]);_0x4c7f52[_0x6cfd('0x1f')]=qs[_0x6cfd('0x1f')](_0x5a98b5[_0x6cfd('0x35')][_0x6cfd('0x1f')]);}_0x4c7f52[_0x6cfd('0x3d')]=qs[_0x6cfd('0x3e')](_0x5a98b5[_0x6cfd('0x35')][_0x6cfd('0x3e')]);_0x4c7f52[_0x6cfd('0x3f')]=qs[_0x6cfd('0x40')](_[_0x6cfd('0x41')](_0x5a98b5[_0x6cfd('0x35')],_0xc8433a[_0x6cfd('0x40')]),_0x408cd4);if(_0x5a98b5['query']['filter']){_0x4c7f52[_0x6cfd('0x3f')]=_[_0x6cfd('0x42')](_0x4c7f52[_0x6cfd('0x3f')],{'$or':_[_0x6cfd('0x2e')](_0x408cd4,function(_0x10e088){if(_0x10e088[_0x6cfd('0x32')]!==_0x6cfd('0x43')){var _0xacdb34={};_0xacdb34[_0x10e088['name']]={'$like':'%'+_0x5a98b5['query']['filter']+'%'};return _0xacdb34;}})});}_0x4c7f52=_[_0x6cfd('0x42')]({},_0x4c7f52,_0x5a98b5[_0x6cfd('0x44')]);var _0x30634e={'where':_0x4c7f52[_0x6cfd('0x3f')]};return db[_0x6cfd('0x2f')]['count'](_0x30634e)[_0x6cfd('0x27')](function(_0x4ef37e){_0x3bc7d6[_0x6cfd('0x22')]=_0x4ef37e;if(_0x5a98b5[_0x6cfd('0x35')]['includeAll']){_0x4c7f52[_0x6cfd('0x45')]=[{'all':!![]}];}return db[_0x6cfd('0x2f')][_0x6cfd('0x46')](_0x4c7f52);})[_0x6cfd('0x27')](function(_0x456dda){_0x3bc7d6[_0x6cfd('0x47')]=_0x456dda;return _0x3bc7d6;})[_0x6cfd('0x27')](respondWithFilteredResult(_0x60261c,_0x4c7f52))['catch'](handleError(_0x60261c,null));};exports[_0x6cfd('0x48')]=function(_0x5d25e7,_0x31c3f4){var _0x2be4c1={'raw':!![],'where':{'id':_0x5d25e7[_0x6cfd('0x49')]['id']}},_0x109dbc={};_0x109dbc[_0x6cfd('0x34')]=_[_0x6cfd('0x36')](db[_0x6cfd('0x2f')]['rawAttributes']);_0x109dbc[_0x6cfd('0x35')]=_[_0x6cfd('0x36')](_0x5d25e7['query']);_0x109dbc['filters']=_[_0x6cfd('0x37')](_0x109dbc[_0x6cfd('0x34')],_0x109dbc[_0x6cfd('0x35')]);_0x2be4c1['attributes']=_['intersection'](_0x109dbc[_0x6cfd('0x34')],qs[_0x6cfd('0x39')](_0x5d25e7['query']['fields']));_0x2be4c1['attributes']=_0x2be4c1['attributes'][_0x6cfd('0x3a')]?_0x2be4c1[_0x6cfd('0x38')]:_0x109dbc[_0x6cfd('0x34')];if(_0x5d25e7[_0x6cfd('0x35')][_0x6cfd('0x4a')]){_0x2be4c1[_0x6cfd('0x45')]=[{'all':!![]}];}_0x2be4c1=_[_0x6cfd('0x42')]({},_0x2be4c1,_0x5d25e7[_0x6cfd('0x44')]);return db['Pause']['find'](_0x2be4c1)[_0x6cfd('0x27')](handleEntityNotFound(_0x31c3f4,null))[_0x6cfd('0x27')](respondWithResult(_0x31c3f4,null))[_0x6cfd('0x4b')](handleError(_0x31c3f4,null));};exports[_0x6cfd('0x4c')]=function(_0x44e87e,_0x27ba0e){return db['Pause'][_0x6cfd('0x4c')](_0x44e87e['body'],{})[_0x6cfd('0x27')](function(_0x1478d1){var _0x484550=_0x44e87e[_0x6cfd('0x4d')][_0x6cfd('0x4e')]({'plain':!![]});if(!_0x484550)throw new Error(_0x6cfd('0x4f'));if(_0x484550[_0x6cfd('0x50')]===_0x6cfd('0x4d')){var _0x53e24f=_0x1478d1[_0x6cfd('0x4e')]({'plain':!![]});var _0x4b492d=_0x6cfd('0x29');return db[_0x6cfd('0x51')][_0x6cfd('0x52')]({'where':{'name':_0x4b492d,'userProfileId':_0x484550[_0x6cfd('0x53')]},'raw':!![]})[_0x6cfd('0x27')](function(_0x23a200){if(_0x23a200&&_0x23a200[_0x6cfd('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x53e24f[_0x6cfd('0x2b')],'resourceId':_0x53e24f['id'],'type':_0x23a200[_0x6cfd('0x2b')],'sectionId':_0x23a200['id']},{})[_0x6cfd('0x27')](function(){return _0x1478d1;});}else{return _0x1478d1;}})[_0x6cfd('0x4b')](function(_0x1409f5){logger[_0x6cfd('0x55')](_0x6cfd('0x56'),_0x1409f5);throw _0x1409f5;});}return _0x1478d1;})[_0x6cfd('0x27')](respondWithResult(_0x27ba0e,0xc9))[_0x6cfd('0x4b')](handleError(_0x27ba0e,null));};exports['update']=function(_0x549601,_0x340b7a){if(_0x549601[_0x6cfd('0x57')]['id']){delete _0x549601[_0x6cfd('0x57')]['id'];}return db[_0x6cfd('0x2f')][_0x6cfd('0x52')]({'where':{'id':_0x549601['params']['id']}})['then'](handleEntityNotFound(_0x340b7a,null))[_0x6cfd('0x27')](saveUpdates(_0x549601[_0x6cfd('0x57')],null))[_0x6cfd('0x27')](respondWithResult(_0x340b7a,null))[_0x6cfd('0x4b')](handleError(_0x340b7a,null));};exports[_0x6cfd('0x28')]=function(_0x5d002e,_0xec169b){return db['Pause'][_0x6cfd('0x52')]({'where':{'id':_0x5d002e['params']['id']}})['then'](handleEntityNotFound(_0xec169b,null))[_0x6cfd('0x27')](removeEntity(_0xec169b,null))[_0x6cfd('0x4b')](handleError(_0xec169b,null));}; \ No newline at end of file +var _0x0248=['../../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','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x3b38cf,_0x4ecfd3){var _0x97cbd5=function(_0x359a7c){while(--_0x359a7c){_0x3b38cf['push'](_0x3b38cf['shift']());}};_0x97cbd5(++_0x4ecfd3);}(_0x0248,0xef));var _0x8024=function(_0x3294d2,_0xfcc7a5){_0x3294d2=_0x3294d2-0x0;var _0x44ffa0=_0x0248[_0x3294d2];return _0x44ffa0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8024('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8024('0x1'));var rp=require(_0x8024('0x2'));var moment=require(_0x8024('0x3'));var BPromise=require(_0x8024('0x4'));var Mustache=require(_0x8024('0x5'));var util=require(_0x8024('0x6'));var path=require(_0x8024('0x7'));var sox=require('sox');var csv=require(_0x8024('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8024('0x9'));var _=require(_0x8024('0xa'));var squel=require(_0x8024('0xb'));var crypto=require('crypto');var jsforce=require(_0x8024('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8024('0x8'));var querystring=require(_0x8024('0xd'));var Papa=require(_0x8024('0xe'));var Redis=require(_0x8024('0xf'));var authService=require(_0x8024('0x10'));var qs=require(_0x8024('0x11'));var as=require(_0x8024('0x12'));var hardwareService=require(_0x8024('0x13'));var logger=require(_0x8024('0x14'))(_0x8024('0x15'));var utils=require(_0x8024('0x16'));var config=require(_0x8024('0x17'));var licenseUtil=require(_0x8024('0x18'));var db=require(_0x8024('0x19'))['db'];function respondWithStatusCode(_0x46965b,_0x5fd7e3){_0x5fd7e3=_0x5fd7e3||0xcc;return function(_0x283044){if(_0x283044){return _0x46965b[_0x8024('0x1a')](_0x5fd7e3);}return _0x46965b[_0x8024('0x1b')](_0x5fd7e3)[_0x8024('0x1c')]();};}function respondWithResult(_0x313e68,_0x14f43b){_0x14f43b=_0x14f43b||0xc8;return function(_0x37fca6){if(_0x37fca6){return _0x313e68[_0x8024('0x1b')](_0x14f43b)[_0x8024('0x1d')](_0x37fca6);}};}function respondWithFilteredResult(_0x14dbbc,_0x272a09){return function(_0x2bc6c4){if(_0x2bc6c4){var _0x4af5b3=typeof _0x272a09[_0x8024('0x1e')]===_0x8024('0x1f')&&typeof _0x272a09['limit']===_0x8024('0x1f');var _0x293167=_0x2bc6c4[_0x8024('0x20')];var _0x3d0c1a=_0x4af5b3?0x0:_0x272a09[_0x8024('0x1e')];var _0x5ce1a2=_0x4af5b3?_0x2bc6c4[_0x8024('0x20')]:_0x272a09['offset']+_0x272a09[_0x8024('0x21')];var _0x1e6368;if(_0x5ce1a2>=_0x293167){_0x5ce1a2=_0x293167;_0x1e6368=0xc8;}else{_0x1e6368=0xce;}_0x14dbbc['status'](_0x1e6368);return _0x14dbbc['set'](_0x8024('0x22'),_0x3d0c1a+'-'+_0x5ce1a2+'/'+_0x293167)[_0x8024('0x1d')](_0x2bc6c4);}return null;};}function patchUpdates(_0x2c936b){return function(_0x3e986f){try{jsonpatch[_0x8024('0x23')](_0x3e986f,_0x2c936b,!![]);}catch(_0x5232e0){return BPromise[_0x8024('0x24')](_0x5232e0);}return _0x3e986f[_0x8024('0x25')]();};}function saveUpdates(_0x1ce14f,_0x2bc8da){return function(_0x5a5d2e){if(_0x5a5d2e){return _0x5a5d2e[_0x8024('0x26')](_0x1ce14f)[_0x8024('0x27')](function(_0x286b7f){return _0x286b7f;});}return null;};}function removeEntity(_0x474197,_0x3b44dc){return function(_0x219606){if(_0x219606){return _0x219606[_0x8024('0x28')]()[_0x8024('0x27')](function(){var _0x50e1a3=_0x219606['get']({'plain':!![]});var _0x2b3b4b=_0x8024('0x29');return db[_0x8024('0x2a')][_0x8024('0x28')]({'where':{'type':_0x2b3b4b,'resourceId':_0x50e1a3['id']}})[_0x8024('0x27')](function(){return _0x219606;});})[_0x8024('0x27')](function(){_0x474197[_0x8024('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259885,_0x36c082){return function(_0x5b759c){if(!_0x5b759c){_0x259885[_0x8024('0x1a')](0x194);}return _0x5b759c;};}function handleError(_0x28d66f,_0x30c0af){_0x30c0af=_0x30c0af||0x1f4;return function(_0x134af9){logger[_0x8024('0x2b')](_0x134af9[_0x8024('0x2c')]);if(_0x134af9[_0x8024('0x2d')]){delete _0x134af9[_0x8024('0x2d')];}_0x28d66f[_0x8024('0x1b')](_0x30c0af)['send'](_0x134af9);};}exports[_0x8024('0x2e')]=function(_0x18a579,_0x2a2ccf){var _0x1a50cc={},_0x1796bf={},_0x13b3a4={'count':0x0,'rows':[]};var _0x4115c0=_[_0x8024('0x2f')](db[_0x8024('0x30')][_0x8024('0x31')],function(_0x466741){return{'name':_0x466741[_0x8024('0x32')],'type':_0x466741[_0x8024('0x33')][_0x8024('0x34')]};});_0x1796bf[_0x8024('0x35')]=_[_0x8024('0x2f')](_0x4115c0,'name');_0x1796bf[_0x8024('0x36')]=_[_0x8024('0x37')](_0x18a579[_0x8024('0x36')]);_0x1796bf['filters']=_['intersection'](_0x1796bf[_0x8024('0x35')],_0x1796bf[_0x8024('0x36')]);_0x1a50cc[_0x8024('0x38')]=_[_0x8024('0x39')](_0x1796bf[_0x8024('0x35')],qs[_0x8024('0x3a')](_0x18a579[_0x8024('0x36')][_0x8024('0x3a')]));_0x1a50cc['attributes']=_0x1a50cc['attributes'][_0x8024('0x3b')]?_0x1a50cc[_0x8024('0x38')]:_0x1796bf[_0x8024('0x35')];if(!_0x18a579['query']['hasOwnProperty'](_0x8024('0x3c'))){_0x1a50cc[_0x8024('0x21')]=qs[_0x8024('0x21')](_0x18a579[_0x8024('0x36')][_0x8024('0x21')]);_0x1a50cc['offset']=qs[_0x8024('0x1e')](_0x18a579[_0x8024('0x36')][_0x8024('0x1e')]);}_0x1a50cc[_0x8024('0x3d')]=qs['sort'](_0x18a579[_0x8024('0x36')][_0x8024('0x3e')]);_0x1a50cc[_0x8024('0x3f')]=qs[_0x8024('0x40')](_[_0x8024('0x41')](_0x18a579[_0x8024('0x36')],_0x1796bf[_0x8024('0x40')]),_0x4115c0);if(_0x18a579[_0x8024('0x36')][_0x8024('0x42')]){_0x1a50cc[_0x8024('0x3f')]=_[_0x8024('0x43')](_0x1a50cc[_0x8024('0x3f')],{'$or':_[_0x8024('0x2f')](_0x4115c0,function(_0x34db87){if(_0x34db87[_0x8024('0x33')]!=='VIRTUAL'){var _0x42f639={};_0x42f639[_0x34db87[_0x8024('0x2d')]]={'$like':'%'+_0x18a579['query']['filter']+'%'};return _0x42f639;}})});}_0x1a50cc=_[_0x8024('0x43')]({},_0x1a50cc,_0x18a579[_0x8024('0x44')]);var _0x399263={'where':_0x1a50cc[_0x8024('0x3f')]};return db[_0x8024('0x30')][_0x8024('0x20')](_0x399263)[_0x8024('0x27')](function(_0x1e2fa4){_0x13b3a4[_0x8024('0x20')]=_0x1e2fa4;if(_0x18a579[_0x8024('0x36')][_0x8024('0x45')]){_0x1a50cc[_0x8024('0x46')]=[{'all':!![]}];}return db[_0x8024('0x30')]['findAll'](_0x1a50cc);})['then'](function(_0x5a4470){_0x13b3a4[_0x8024('0x47')]=_0x5a4470;return _0x13b3a4;})['then'](respondWithFilteredResult(_0x2a2ccf,_0x1a50cc))[_0x8024('0x48')](handleError(_0x2a2ccf,null));};exports['show']=function(_0xade9b1,_0x2db741){var _0x51b0b0={'raw':!![],'where':{'id':_0xade9b1[_0x8024('0x49')]['id']}},_0x1ba930={};_0x1ba930['model']=_[_0x8024('0x37')](db[_0x8024('0x30')][_0x8024('0x31')]);_0x1ba930[_0x8024('0x36')]=_['keys'](_0xade9b1[_0x8024('0x36')]);_0x1ba930[_0x8024('0x40')]=_[_0x8024('0x39')](_0x1ba930[_0x8024('0x35')],_0x1ba930[_0x8024('0x36')]);_0x51b0b0[_0x8024('0x38')]=_['intersection'](_0x1ba930['model'],qs[_0x8024('0x3a')](_0xade9b1[_0x8024('0x36')]['fields']));_0x51b0b0[_0x8024('0x38')]=_0x51b0b0['attributes']['length']?_0x51b0b0['attributes']:_0x1ba930[_0x8024('0x35')];if(_0xade9b1['query'][_0x8024('0x45')]){_0x51b0b0[_0x8024('0x46')]=[{'all':!![]}];}_0x51b0b0=_[_0x8024('0x43')]({},_0x51b0b0,_0xade9b1[_0x8024('0x44')]);return db[_0x8024('0x30')][_0x8024('0x4a')](_0x51b0b0)[_0x8024('0x27')](handleEntityNotFound(_0x2db741,null))[_0x8024('0x27')](respondWithResult(_0x2db741,null))[_0x8024('0x48')](handleError(_0x2db741,null));};exports[_0x8024('0x4b')]=function(_0xefdbc3,_0x198185){return db['Pause'][_0x8024('0x4b')](_0xefdbc3[_0x8024('0x4c')],{})[_0x8024('0x27')](function(_0x177520){var _0x46a294=_0xefdbc3[_0x8024('0x4d')][_0x8024('0x4e')]({'plain':!![]});if(!_0x46a294)throw new Error(_0x8024('0x4f'));if(_0x46a294[_0x8024('0x50')]===_0x8024('0x4d')){var _0x3fe5f2=_0x177520[_0x8024('0x4e')]({'plain':!![]});var _0x2494d5=_0x8024('0x29');return db[_0x8024('0x51')]['find']({'where':{'name':_0x2494d5,'userProfileId':_0x46a294[_0x8024('0x52')]},'raw':!![]})[_0x8024('0x27')](function(_0x6f3bb7){if(_0x6f3bb7&&_0x6f3bb7[_0x8024('0x53')]===0x0){return db[_0x8024('0x2a')]['create']({'name':_0x3fe5f2[_0x8024('0x2d')],'resourceId':_0x3fe5f2['id'],'type':_0x6f3bb7[_0x8024('0x2d')],'sectionId':_0x6f3bb7['id']},{})[_0x8024('0x27')](function(){return _0x177520;});}else{return _0x177520;}})[_0x8024('0x48')](function(_0x618daf){logger[_0x8024('0x2b')](_0x8024('0x54'),_0x618daf);throw _0x618daf;});}return _0x177520;})[_0x8024('0x27')](respondWithResult(_0x198185,0xc9))[_0x8024('0x48')](handleError(_0x198185,null));};exports[_0x8024('0x26')]=function(_0x1c7d76,_0x5f33d8){if(_0x1c7d76[_0x8024('0x4c')]['id']){delete _0x1c7d76[_0x8024('0x4c')]['id'];}return db[_0x8024('0x30')][_0x8024('0x4a')]({'where':{'id':_0x1c7d76[_0x8024('0x49')]['id']}})[_0x8024('0x27')](handleEntityNotFound(_0x5f33d8,null))[_0x8024('0x27')](saveUpdates(_0x1c7d76[_0x8024('0x4c')],null))[_0x8024('0x27')](respondWithResult(_0x5f33d8,null))[_0x8024('0x48')](handleError(_0x5f33d8,null));};exports['destroy']=function(_0xecefcd,_0x3fdda0){return db['Pause'][_0x8024('0x4a')]({'where':{'id':_0xecefcd[_0x8024('0x49')]['id']}})[_0x8024('0x27')](handleEntityNotFound(_0x3fdda0,null))['then'](removeEntity(_0x3fdda0,null))['catch'](handleError(_0x3fdda0,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2b2bc01..7f44c62 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x94f8a,_0x270beb){var _0x3ea963=function(_0x33c269){while(--_0x33c269){_0x94f8a['push'](_0x94f8a['shift']());}};_0x3ea963(++_0x270beb);}(_0x814b,0x1a2));var _0xb814=function(_0x64b31d,_0x393b36){_0x64b31d=_0x64b31d-0x0;var _0x42c45b=_0x814b[_0x64b31d];return _0x42c45b;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa7,0x178));var _0x76aa=function(_0x26ea6f,_0x271205){_0x26ea6f=_0x26ea6f-0x0;var _0x258159=_0x6aa7[_0x26ea6f];return _0x258159;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 4062da8..977490c 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(_0x1723e5,_0x2edbf7){var _0xbf5caf=function(_0x4465ba){while(--_0x4465ba){_0x1723e5['push'](_0x1723e5['shift']());}};_0xbf5caf(++_0x2edbf7);}(_0x7a54,0x106));var _0x47a5=function(_0x19f03d,_0x336e47){_0x19f03d=_0x19f03d-0x0;var _0x39ae94=_0x7a54[_0x19f03d];return _0x39ae94;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x16feb7,_0x1311a6){var _0x2f8144=function(_0x55cf6b){while(--_0x55cf6b){_0x16feb7['push'](_0x16feb7['shift']());}};_0x2f8144(++_0x1311a6);}(_0x7a54,0x106));var _0x47a5=function(_0x4b6010,_0x588c1b){_0x4b6010=_0x4b6010-0x0;var _0xc1660d=_0x7a54[_0x4b6010];return _0xc1660d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d53dab3..bbc92c5 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 _0x3140=['../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','single','file','upload','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0x34afb9,_0x100ab7){var _0x1db4c6=function(_0x383225){while(--_0x383225){_0x34afb9['push'](_0x34afb9['shift']());}};_0x1db4c6(++_0x100ab7);}(_0x3140,0xaf));var _0x0314=function(_0xa0d6e8,_0x41e320){_0xa0d6e8=_0xa0d6e8-0x0;var _0x4ba300=_0x3140[_0xa0d6e8];return _0x4ba300;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),controller[_0x0314('0xd')]);router['get'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['show']);router['get'](_0x0314('0xf'),auth['isAuthenticated'](),controller[_0x0314('0x10')]);var upload=multer({'storage':multer[_0x0314('0x11')]({'destination':function(_0x3a7713,_0x376da9,_0x375416){_0x375416(null,path[_0x0314('0x12')](config['root'],_0x0314('0x13')));},'filename':function(_0x2bc151,_0xd85ddf,_0x4602ec){_0xd85ddf[_0x0314('0x14')]=_0xd85ddf[_0x0314('0x14')][_0x0314('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4602ec(null,util['format'](_0x0314('0x16'),path[_0x0314('0x17')](_0xd85ddf[_0x0314('0x14')],path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])),Date[_0x0314('0x19')](),path[_0x0314('0x18')](_0xd85ddf[_0x0314('0x14')])));}})});router['post']('/',upload[_0x0314('0x1a')](_0x0314('0x1b')),controller[_0x0314('0x1c')]);router['post'](_0x0314('0xc'),controller['webhookPost']);router['put'](_0x0314('0xe'),auth[_0x0314('0xa')](),controller['update']);router[_0x0314('0x1d')](_0x0314('0xe'),auth['isAuthenticated'](),controller[_0x0314('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0x5b5cad,_0x8e52da){var _0x1a333a=function(_0x597b24){while(--_0x597b24){_0x5b5cad['push'](_0x5b5cad['shift']());}};_0x1a333a(++_0x8e52da);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8958e63..197ca5e 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 _0x221f=['ENUM','agentOnly','always','never','sequelize','exports','html','script','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x467ad4,_0x4ff859){var _0x26e28b=function(_0x46bbe5){while(--_0x46bbe5){_0x467ad4['push'](_0x467ad4['shift']());}};_0x26e28b(++_0x4ff859);}(_0x221f,0x14e));var _0xf221=function(_0x32917a,_0x3559ea){_0x32917a=_0x32917a-0x0;var _0x1881e1=_0x221f[_0x32917a];return _0x1881e1;};'use strict';var Sequelize=require(_0xf221('0x0'));module[_0xf221('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xf221('0x2'),_0xf221('0x3'))},'description':{'type':Sequelize[_0xf221('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xf221('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf221('0x6')},'sidebar':{'type':Sequelize[_0xf221('0x7')]('adminOnly',_0xf221('0x8'),_0xf221('0x9'),_0xf221('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xf221('0x5')]},'adminUrl':{'type':Sequelize[_0xf221('0x5')]},'agentUrl':{'type':Sequelize[_0xf221('0x5')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xffc1=['STRING','ENUM','html','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports'];(function(_0x2e17fa,_0x24213a){var _0x10fb88=function(_0x17c4ed){while(--_0x17c4ed){_0x2e17fa['push'](_0x2e17fa['shift']());}};_0x10fb88(++_0x24213a);}(_0xffc1,0x113));var _0x1ffc=function(_0x11ac19,_0x130a0f){_0x11ac19=_0x11ac19-0x0;var _0x39d73c=_0xffc1[_0x11ac19];return _0x39d73c;};'use strict';var Sequelize=require('sequelize');module[_0x1ffc('0x0')]={'name':{'type':Sequelize[_0x1ffc('0x1')]},'type':{'type':Sequelize[_0x1ffc('0x2')](_0x1ffc('0x3'),'script')},'description':{'type':Sequelize[_0x1ffc('0x4')]},'version':{'type':Sequelize[_0x1ffc('0x4')]},'path':{'type':Sequelize[_0x1ffc('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x1ffc('0x5')],'defaultValue':0x0,'comment':_0x1ffc('0x6')},'sidebar':{'type':Sequelize[_0x1ffc('0x2')](_0x1ffc('0x7'),_0x1ffc('0x8'),_0x1ffc('0x9'),_0x1ffc('0xa')),'defaultValue':_0x1ffc('0x9'),'comment':_0x1ffc('0xb')},'icon':{'type':Sequelize[_0x1ffc('0x1')]},'adminUrl':{'type':Sequelize[_0x1ffc('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1ffc('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4b99ab8..a8ce0d0 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 _0xffae=['map','VIRTUAL','filter','include','findAll','rows','catch','show','params','keys','includeAll','options','find','join','root','format','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','server/files/plugins','dirname','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','offset','undefined','count','limit','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x3d2c7d,_0x28d472){var _0x14510a=function(_0x2f0590){while(--_0x2f0590){_0x3d2c7d['push'](_0x3d2c7d['shift']());}};_0x14510a(++_0x28d472);}(_0xffae,0x1bc));var _0xeffa=function(_0x4bbb3c,_0xd5c6ef){_0x4bbb3c=_0x4bbb3c-0x0;var _0x417425=_0xffae[_0x4bbb3c];return _0x417425;};'use strict';var emlformat=require(_0xeffa('0x0'));var rimraf=require(_0xeffa('0x1'));var zipdir=require(_0xeffa('0x2'));var jsonpatch=require(_0xeffa('0x3'));var rp=require(_0xeffa('0x4'));var moment=require('moment');var BPromise=require(_0xeffa('0x5'));var Mustache=require(_0xeffa('0x6'));var util=require(_0xeffa('0x7'));var path=require(_0xeffa('0x8'));var sox=require(_0xeffa('0x9'));var csv=require(_0xeffa('0xa'));var ejs=require(_0xeffa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeffa('0xc'));var squel=require('squel');var crypto=require(_0xeffa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeffa('0xe'));var Papa=require(_0xeffa('0xf'));var extract=require(_0xeffa('0x10'));var rimraf=require(_0xeffa('0x1'));var archiver=require(_0xeffa('0x11'));var Redis=require(_0xeffa('0x12'));var authService=require(_0xeffa('0x13'));var qs=require(_0xeffa('0x14'));var as=require(_0xeffa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeffa('0x16'))('api');var utils=require(_0xeffa('0x17'));var config=require(_0xeffa('0x18'));var licenseUtil=require(_0xeffa('0x19'));var db=require(_0xeffa('0x1a'))['db'];config['redis']=_[_0xeffa('0x1b')](config[_0xeffa('0x1c')],{'host':_0xeffa('0x1d'),'port':0x18eb});var socket=require(_0xeffa('0x1e'))(new Redis(config['redis']));require(_0xeffa('0x1f'))[_0xeffa('0x20')](socket);function respondWithStatusCode(_0x2a880d,_0x4a9859){_0x4a9859=_0x4a9859||0xcc;return function(_0x5b1cdd){if(_0x5b1cdd){return _0x2a880d[_0xeffa('0x21')](_0x4a9859);}return _0x2a880d['status'](_0x4a9859)[_0xeffa('0x22')]();};}function respondWithResult(_0x57c57c,_0x5cd824){_0x5cd824=_0x5cd824||0xc8;return function(_0x512463){if(_0x512463){return _0x57c57c[_0xeffa('0x23')](_0x5cd824)['json'](_0x512463);}};}function respondWithFilteredResult(_0x5f214e,_0x393e50){return function(_0x2bafcb){if(_0x2bafcb){var _0x5deae7=typeof _0x393e50[_0xeffa('0x24')]==='undefined'&&typeof _0x393e50['limit']===_0xeffa('0x25');var _0x5c15c9=_0x2bafcb[_0xeffa('0x26')];var _0x51beeb=_0x5deae7?0x0:_0x393e50[_0xeffa('0x24')];var _0x1fc168=_0x5deae7?_0x2bafcb['count']:_0x393e50[_0xeffa('0x24')]+_0x393e50[_0xeffa('0x27')];var _0x27db92;if(_0x1fc168>=_0x5c15c9){_0x1fc168=_0x5c15c9;_0x27db92=0xc8;}else{_0x27db92=0xce;}_0x5f214e['status'](_0x27db92);return _0x5f214e['set']('Content-Range',_0x51beeb+'-'+_0x1fc168+'/'+_0x5c15c9)['json'](_0x2bafcb);}return null;};}function patchUpdates(_0x2d74f8){return function(_0x59c6e1){try{jsonpatch['apply'](_0x59c6e1,_0x2d74f8,!![]);}catch(_0x3ea5fa){return BPromise['reject'](_0x3ea5fa);}return _0x59c6e1[_0xeffa('0x28')]();};}function saveUpdates(_0x1413f8,_0x3c7b70){return function(_0x495145){if(_0x495145){return _0x495145[_0xeffa('0x29')](_0x1413f8)[_0xeffa('0x2a')](function(_0x584f74){return _0x584f74;});}return null;};}function removeEntity(_0xb6abd6,_0x14dd12){return function(_0x13c129){if(_0x13c129){return _0x13c129[_0xeffa('0x2b')]()['then'](function(){var _0x2b6023=_0x13c129['get']({'plain':!![]});var _0x2b723b=_0xeffa('0x2c');return db[_0xeffa('0x2d')][_0xeffa('0x2b')]({'where':{'type':_0x2b723b,'resourceId':_0x2b6023['id']}})[_0xeffa('0x2a')](function(){return _0x13c129;});})[_0xeffa('0x2a')](function(){_0xb6abd6[_0xeffa('0x23')](0xcc)[_0xeffa('0x22')]();});}};}function handleEntityNotFound(_0x224718,_0x1ebb40){return function(_0x44f0c8){if(!_0x44f0c8){_0x224718[_0xeffa('0x21')](0x194);}return _0x44f0c8;};}function handleError(_0x816e93,_0x26db88){_0x26db88=_0x26db88||0x1f4;return function(_0x2b094e){logger[_0xeffa('0x2e')](_0x2b094e[_0xeffa('0x2f')]);if(_0x2b094e['name']){delete _0x2b094e[_0xeffa('0x30')];}_0x816e93[_0xeffa('0x23')](_0x26db88)[_0xeffa('0x31')](_0x2b094e);};}exports[_0xeffa('0x32')]=function(_0x44f443,_0x5c2857){var _0x4ba22e={},_0x2ff647={},_0x13f312={'count':0x0,'rows':[]};var _0x94d757=_['map'](db[_0xeffa('0x33')][_0xeffa('0x34')],function(_0x428f96){return{'name':_0x428f96[_0xeffa('0x35')],'type':_0x428f96[_0xeffa('0x36')][_0xeffa('0x37')]};});_0x2ff647[_0xeffa('0x38')]=_['map'](_0x94d757,_0xeffa('0x30'));_0x2ff647['query']=_['keys'](_0x44f443[_0xeffa('0x39')]);_0x2ff647[_0xeffa('0x3a')]=_[_0xeffa('0x3b')](_0x2ff647[_0xeffa('0x38')],_0x2ff647[_0xeffa('0x39')]);_0x4ba22e[_0xeffa('0x3c')]=_[_0xeffa('0x3b')](_0x2ff647[_0xeffa('0x38')],qs[_0xeffa('0x3d')](_0x44f443['query'][_0xeffa('0x3d')]));_0x4ba22e[_0xeffa('0x3c')]=_0x4ba22e[_0xeffa('0x3c')][_0xeffa('0x3e')]?_0x4ba22e[_0xeffa('0x3c')]:_0x2ff647['model'];if(!_0x44f443[_0xeffa('0x39')][_0xeffa('0x3f')](_0xeffa('0x40'))){_0x4ba22e[_0xeffa('0x27')]=qs[_0xeffa('0x27')](_0x44f443[_0xeffa('0x39')]['limit']);_0x4ba22e[_0xeffa('0x24')]=qs['offset'](_0x44f443[_0xeffa('0x39')][_0xeffa('0x24')]);}_0x4ba22e['order']=qs[_0xeffa('0x41')](_0x44f443[_0xeffa('0x39')][_0xeffa('0x41')]);_0x4ba22e[_0xeffa('0x42')]=qs[_0xeffa('0x3a')](_[_0xeffa('0x43')](_0x44f443[_0xeffa('0x39')],_0x2ff647[_0xeffa('0x3a')]),_0x94d757);if(_0x44f443[_0xeffa('0x39')]['filter']){_0x4ba22e[_0xeffa('0x42')]=_[_0xeffa('0x44')](_0x4ba22e[_0xeffa('0x42')],{'$or':_[_0xeffa('0x45')](_0x94d757,function(_0x385500){if(_0x385500[_0xeffa('0x36')]!==_0xeffa('0x46')){var _0x39fe1d={};_0x39fe1d[_0x385500[_0xeffa('0x30')]]={'$like':'%'+_0x44f443['query'][_0xeffa('0x47')]+'%'};return _0x39fe1d;}})});}_0x4ba22e=_[_0xeffa('0x44')]({},_0x4ba22e,_0x44f443['options']);var _0xfb6a83={'where':_0x4ba22e[_0xeffa('0x42')]};return db[_0xeffa('0x33')][_0xeffa('0x26')](_0xfb6a83)[_0xeffa('0x2a')](function(_0x192cc7){_0x13f312['count']=_0x192cc7;if(_0x44f443[_0xeffa('0x39')]['includeAll']){_0x4ba22e[_0xeffa('0x48')]=[{'all':!![]}];}return db[_0xeffa('0x33')][_0xeffa('0x49')](_0x4ba22e);})[_0xeffa('0x2a')](function(_0x3026d3){_0x13f312[_0xeffa('0x4a')]=_0x3026d3;return _0x13f312;})[_0xeffa('0x2a')](respondWithFilteredResult(_0x5c2857,_0x4ba22e))[_0xeffa('0x4b')](handleError(_0x5c2857,null));};exports[_0xeffa('0x4c')]=function(_0x3ffc0d,_0x568c78){var _0x21f9c8={'raw':!![],'where':{'id':_0x3ffc0d[_0xeffa('0x4d')]['id']}},_0x377386={};_0x377386[_0xeffa('0x38')]=_[_0xeffa('0x4e')](db['Plugin'][_0xeffa('0x34')]);_0x377386[_0xeffa('0x39')]=_[_0xeffa('0x4e')](_0x3ffc0d['query']);_0x377386[_0xeffa('0x3a')]=_[_0xeffa('0x3b')](_0x377386[_0xeffa('0x38')],_0x377386[_0xeffa('0x39')]);_0x21f9c8[_0xeffa('0x3c')]=_['intersection'](_0x377386[_0xeffa('0x38')],qs[_0xeffa('0x3d')](_0x3ffc0d['query'][_0xeffa('0x3d')]));_0x21f9c8[_0xeffa('0x3c')]=_0x21f9c8[_0xeffa('0x3c')][_0xeffa('0x3e')]?_0x21f9c8[_0xeffa('0x3c')]:_0x377386['model'];if(_0x3ffc0d[_0xeffa('0x39')][_0xeffa('0x4f')]){_0x21f9c8[_0xeffa('0x48')]=[{'all':!![]}];}_0x21f9c8=_[_0xeffa('0x44')]({},_0x21f9c8,_0x3ffc0d[_0xeffa('0x50')]);return db['Plugin'][_0xeffa('0x51')](_0x21f9c8)['then'](handleEntityNotFound(_0x568c78,null))[_0xeffa('0x2a')](respondWithResult(_0x568c78,null))[_0xeffa('0x4b')](handleError(_0x568c78,null));};exports['download']=function(_0x1f787b,_0x520887,_0x3917da){return db[_0xeffa('0x33')][_0xeffa('0x51')]({'where':{'id':_0x1f787b[_0xeffa('0x4d')]['id']},'attributes':[_0xeffa('0x30'),'path'],'raw':!![]})[_0xeffa('0x2a')](handleEntityNotFound(_0x520887,null))[_0xeffa('0x2a')](function(_0x4f71d3){if(_0x4f71d3){var _0x2c01b2=path[_0xeffa('0x52')](config[_0xeffa('0x53')],'server/files/plugins',util[_0xeffa('0x54')]('%s.zip',path[_0xeffa('0x55')](_0x4f71d3[_0xeffa('0x8')])));var _0x5d0d65=fs[_0xeffa('0x56')](_0x2c01b2);var _0x35b177=archiver(_0xeffa('0x57'),{'zlib':{'level':0x9}});_0x35b177['on'](_0xeffa('0x58'),function(_0x18c0c1){if(_0x18c0c1['code']===_0xeffa('0x59')){logger[_0xeffa('0x2e')](_0x18c0c1);}else{throw new db[(_0xeffa('0x5a'))][(_0xeffa('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x35b177['on']('error',function(_0x5ac08d){throw new db[(_0xeffa('0x5a'))][(_0xeffa('0x5b'))](_0xeffa('0x5c'));});_0x35b177[_0xeffa('0x5d')](_0x5d0d65);_0x35b177['glob'](_0xeffa('0x5e'),{'cwd':path['join'](config[_0xeffa('0x53')],_0xeffa('0x5f'),path[_0xeffa('0x60')](_0x4f71d3[_0xeffa('0x8')])),'ignore':[path[_0xeffa('0x52')](path['basename'](_0x4f71d3['path']),'node_modules/**/*'),path[_0xeffa('0x52')](path[_0xeffa('0x55')](_0x4f71d3['path']),_0xeffa('0x61'))],'nodir':!![]})[_0xeffa('0x62')]();_0x5d0d65['on']('close',function(){if(!fs[_0xeffa('0x63')](_0x2c01b2)){throw new db[(_0xeffa('0x5a'))][(_0xeffa('0x5b'))](_0xeffa('0x64'));}return _0x520887[_0xeffa('0x65')](_0x2c01b2,util[_0xeffa('0x54')](_0xeffa('0x66'),path[_0xeffa('0x55')](_0x4f71d3[_0xeffa('0x8')])),function(_0x1ee4ef){if(_0x1ee4ef){throw new db[(_0xeffa('0x5a'))]['Error'](_0xeffa('0x67'));}fs[_0xeffa('0x68')](_0x2c01b2);logger[_0xeffa('0x69')](_0xeffa('0x6a'));logger[_0xeffa('0x69')](_0xeffa('0x6b'));});});}return null;})['catch'](handleError(_0x520887,null));};exports[_0xeffa('0x6c')]=function(_0x4bab12,_0x34f96c,_0x14e84d){var _0x342f90=path[_0xeffa('0x55')](_0x4bab12[_0xeffa('0x6d')][_0xeffa('0x6e')],path[_0xeffa('0x6f')](_0x4bab12['file'][_0xeffa('0x6e')]));var _0x424c24=path[_0xeffa('0x52')](config[_0xeffa('0x53')],_0xeffa('0x5f'),_0x4bab12['file'][_0xeffa('0x6e')]);var _0x1d40e1=path['join'](config['root'],_0xeffa('0x5f'),_0x342f90);logger['info'](_0xeffa('0x70'),_0x424c24);logger['info'](_0xeffa('0x71'),_0x1d40e1);try{fs['chmodSync'](_0x424c24,parseInt(_0xeffa('0x72'),0x8));extract(_0x424c24,{'dir':_0x1d40e1},function(_0x5325ba){if(_0x5325ba){logger['error'](_0x5325ba);handleError(_0x5325ba,!![]);};var _0x3456c5=fs[_0xeffa('0x73')](_0x1d40e1);if(_0x3456c5[_0xeffa('0x3e')]>0x1){removeReferences(_0x424c24,_0x1d40e1);logger[_0xeffa('0x2e')](_0xeffa('0x74'));return _0x14e84d(new Error('Invalid\x20plugin\x20structure'));}var _0x2b8ad4=fs['lstatSync'](path['join'](_0x1d40e1,_0x3456c5[0x0]));if(_0x2b8ad4[_0xeffa('0x75')]()){removeReferences(_0x424c24,_0x1d40e1);logger[_0xeffa('0x2e')](_0xeffa('0x74'));return _0x14e84d(new Error(_0xeffa('0x74')));}if(_0x2b8ad4['isDirectory']()){var _0x3738b2=fs[_0xeffa('0x73')](path['join'](_0x1d40e1,_0x3456c5[0x0]));if(_0x3738b2[_0xeffa('0x3e')]===0x0){removeReferences(_0x424c24,_0x1d40e1);logger[_0xeffa('0x2e')](_0xeffa('0x74'));return _0x14e84d(new Error(_0xeffa('0x74')));}var _0x11cc36=_0x3738b2[_0xeffa('0x76')](function(_0x11bd8c){return _0x11bd8c===_0xeffa('0x77');});if(!_0x11cc36){return _0x14e84d(new Error(_0xeffa('0x78')));}var _0x334a6f=fs[_0xeffa('0x79')](path[_0xeffa('0x52')](_0x1d40e1,_0x3456c5[0x0],'manifest.json'));var _0x42d3e3=JSON['parse'](_0x334a6f);if(_0xeffa('0x25')==typeof _0x42d3e3[_0xeffa('0x30')]){return _0x14e84d(new Error(_0xeffa('0x7a')));}if(_0xeffa('0x25')==typeof _0x42d3e3[_0xeffa('0x36')]){return _0x14e84d(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x42d3e3[_0xeffa('0x7b')]){return _0x14e84d(new Error(_0xeffa('0x7c')));}if(_0xeffa('0x25')==typeof _0x42d3e3['parameters']){return _0x14e84d(new Error(_0xeffa('0x7d')));}if(_0x42d3e3[_0xeffa('0x36')]==='html'){if(_0xeffa('0x25')==typeof _0x42d3e3[_0xeffa('0x7e')]['views']){return _0x14e84d(new Error(_0xeffa('0x7f')));}if(_0xeffa('0x25')==typeof _0x42d3e3[_0xeffa('0x7e')][_0xeffa('0x80')][_0xeffa('0x81')]&&_0xeffa('0x25')==typeof _0x42d3e3['parameters'][_0xeffa('0x80')]['agent']){return _0x14e84d(new Error(_0xeffa('0x82')));}}else if(_0x42d3e3['type']===_0xeffa('0x83')){if('undefined'==typeof _0x42d3e3['parameters'][_0xeffa('0x84')]){return _0x14e84d(new Error(_0xeffa('0x85')));}if(_0xeffa('0x25')==typeof _0x42d3e3[_0xeffa('0x7e')][_0xeffa('0x86')]){return _0x14e84d(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x14e84d(new Error(_0xeffa('0x87')));}var _0x39e765=_0x42d3e3['name'];var _0x3b2d66=_0x42d3e3[_0xeffa('0x88')];var _0x5dd05b=_0x42d3e3['type'];var _0x2cd01b=_0x42d3e3[_0xeffa('0x89')]?_0x42d3e3[_0xeffa('0x89')]:_0xeffa('0x8a');var _0x3d2c9a=_0x42d3e3[_0xeffa('0x8b')]?_0x42d3e3[_0xeffa('0x8b')]:_0xeffa('0x8c');var _0x4becd4='';var _0x1b8ea0='';var _0x2b97ec='';var _0x2e0a91='';var _0x34a87f=_0x42d3e3[_0xeffa('0x7b')];if(_0x5dd05b==='html'){if(_0xeffa('0x25')!=typeof _0x42d3e3[_0xeffa('0x7e')][_0xeffa('0x80')][_0xeffa('0x81')]){var _0xce2b78=_0x42d3e3[_0xeffa('0x7e')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0xce2b78)){_0x4becd4=path['join'](_0xeffa('0x8d'),_0x342f90,_0x3456c5[0x0],_0xce2b78);}else{_0x4becd4=_0xce2b78;}}else{logger[_0xeffa('0x69')](_0xeffa('0x8e'));}if(_0xeffa('0x25')!=typeof _0x42d3e3[_0xeffa('0x7e')][_0xeffa('0x80')][_0xeffa('0x8f')]){var _0x4c1cea=_0x42d3e3[_0xeffa('0x7e')]['views'][_0xeffa('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xeffa('0x90')](_0x4c1cea)){_0x1b8ea0=path[_0xeffa('0x52')]('plugins',_0x342f90,_0x3456c5[0x0],_0x4c1cea);}else{_0x1b8ea0=_0x4c1cea;}}else{logger[_0xeffa('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5dd05b===_0xeffa('0x83')){_0x2b97ec=_0x42d3e3[_0xeffa('0x7e')]['scriptName'];_0x2e0a91=_0x42d3e3['parameters'][_0xeffa('0x86')];if('undefined'!=typeof _0x42d3e3['parameters'][_0xeffa('0x80')]){if(_0xeffa('0x25')!=typeof _0x42d3e3[_0xeffa('0x7e')]['views'][_0xeffa('0x81')]){var _0xce2b78=_0x42d3e3['parameters'][_0xeffa('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0xce2b78)){_0x4becd4=path[_0xeffa('0x52')](_0xeffa('0x8d'),_0x342f90,_0x3456c5[0x0],_0xce2b78);}else{_0x4becd4=_0xce2b78;}}if(_0xeffa('0x25')!=typeof _0x42d3e3['parameters'][_0xeffa('0x80')][_0xeffa('0x8f')]){var _0x4c1cea=_0x42d3e3[_0xeffa('0x7e')][_0xeffa('0x80')][_0xeffa('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xeffa('0x90')](_0x4c1cea)){_0x1b8ea0=path[_0xeffa('0x52')](_0xeffa('0x8d'),_0x342f90,_0x3456c5[0x0],_0x4c1cea);}else{_0x1b8ea0=_0x4c1cea;}}}}var _0x13b9e6={'name':_0x39e765,'description':_0x3b2d66,'path':path[_0xeffa('0x52')](_0x342f90,_0x3456c5[0x0]),'type':_0x5dd05b,'sidebar':_0x2cd01b,'icon':_0x3d2c9a,'adminUrl':_0x4becd4,'agentUrl':_0x1b8ea0,'scriptName':_0x2b97ec,'scriptPath':_0x2e0a91,'version':_0x34a87f};removeReferences(_0x424c24,null);return db[_0xeffa('0x33')][_0xeffa('0x91')](_0x13b9e6)[_0xeffa('0x2a')](function(_0x16b3df){var _0x21d4cf={'role':_0x4bab12[_0xeffa('0x92')][_0xeffa('0x93')],'userProfileId':_0x4bab12[_0xeffa('0x92')][_0xeffa('0x94')]};if(!_0x21d4cf)throw new Error(_0xeffa('0x95'));if(_0x21d4cf[_0xeffa('0x93')]==='user'){var _0x5d20d2=_0x16b3df[_0xeffa('0x96')]({'plain':!![]});return db['UserProfileSection'][_0xeffa('0x51')]({'where':{'name':_0xeffa('0x2c'),'userProfileId':_0x21d4cf['userProfileId']},'raw':!![]})['then'](function(_0x2c460c){if(_0x2c460c&&_0x2c460c[_0xeffa('0x97')]===0x0){return db[_0xeffa('0x2d')]['create']({'name':_0x5d20d2['name'],'resourceId':_0x5d20d2['id'],'type':_0x2c460c[_0xeffa('0x30')],'sectionId':_0x2c460c['id']},{})[_0xeffa('0x2a')](function(){return _0x16b3df;});}else{return _0x16b3df;}})['catch'](function(_0x40b317){logger[_0xeffa('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40b317);throw _0x40b317;});}return _0x16b3df;})['then'](respondWithResult(_0x34f96c,null))[_0xeffa('0x4b')](handleError(_0x34f96c,null));}});}catch(_0x3675e6){_0x34f96c[_0xeffa('0x23')](0x1f4)[_0xeffa('0x31')](_0x3675e6);}};function removeReferences(_0x37084e,_0x1d19ed){try{if(_0x37084e){fs[_0xeffa('0x68')](_0x37084e);logger[_0xeffa('0x69')](_0xeffa('0x98'));}if(_0x1d19ed){rimraf(_0x1d19ed,function(){});logger[_0xeffa('0x69')](_0xeffa('0x99'));}}catch(_0x3e92ac){logger[_0xeffa('0x2e')](_0x3e92ac);}}exports[_0xeffa('0x29')]=function(_0x1d7e80,_0x2f38ac,_0x805b13){return db[_0xeffa('0x33')][_0xeffa('0x51')]({'where':{'id':_0x1d7e80[_0xeffa('0x4d')]['id']}})[_0xeffa('0x2a')](handleEntityNotFound(_0x2f38ac,null))['then'](saveUpdates(_0x1d7e80[_0xeffa('0x92')],null))[_0xeffa('0x2a')](respondWithResult(_0x2f38ac,null))[_0xeffa('0x4b')](handleError(_0x2f38ac,null));};exports['delete']=function(_0x5a47f8,_0x4ae8af,_0x39e49c){return db[_0xeffa('0x33')][_0xeffa('0x51')]({'where':{'id':_0x5a47f8[_0xeffa('0x4d')]['id']}})[_0xeffa('0x2a')](function(_0x21876d){if(_0x21876d){return _0x21876d[_0xeffa('0x2b')]();}})['then'](function(_0x3fef88){rimraf(path[_0xeffa('0x52')](config['root'],_0xeffa('0x5f'),path[_0xeffa('0x60')](_0x3fef88[_0xeffa('0x8')])),function(){});return _0x3fef88;})['then'](handleEntityNotFound(_0x4ae8af,null))[_0xeffa('0x2a')](respondWithStatusCode(_0x4ae8af,null))[_0xeffa('0x4b')](handleError(_0x4ae8af,null));};exports[_0xeffa('0x9a')]=function(_0xdb7084,_0x13066e,_0x5d4a25){return BPromise[_0xeffa('0x9b')]()[_0xeffa('0x2a')](function(){if(!_0xdb7084['query'][_0xeffa('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xdb7084[_0xeffa('0x39')][_0xeffa('0x9c')]){throw new Error(_0xeffa('0x9d'));}var _0x407974=_0xdb7084['query'][_0xeffa('0x9e')]?_0xdb7084[_0xeffa('0x39')][_0xeffa('0x9e')]+':'+_0xdb7084[_0xeffa('0x39')][_0xeffa('0x9c')]:_0xeffa('0x9f')+_0xdb7084[_0xeffa('0x39')][_0xeffa('0x9c')];var _0x411013=_0xdb7084[_0xeffa('0x39')][_0xeffa('0xa0')]?_0xdb7084['query'][_0xeffa('0xa0')]:!![];var _0x139f0f=_0xdb7084[_0xeffa('0x39')][_0xeffa('0xa1')]?_0xdb7084['query'][_0xeffa('0xa1')]:null;var _0x5c08f9={'method':_0xdb7084[_0xeffa('0xa2')],'uri':util[_0xeffa('0x54')](_0xeffa('0xa3'),_0x407974,_0xdb7084['query']['path']),'json':_0x411013,'resolveWithFullResponse':!![],'encoding':_0x139f0f,'qs':_0xdb7084[_0xeffa('0x39')]};if(_0xdb7084[_0xeffa('0xa4')]){_0x5c08f9[_0xeffa('0xa4')]=_0xdb7084[_0xeffa('0xa4')];if(_0x5c08f9[_0xeffa('0xa4')][_0xeffa('0xa5')]){delete _0x5c08f9[_0xeffa('0xa4')]['content-length'];}}if(_0x5c08f9[_0xeffa('0xa4')][_0xeffa('0xa6')]){delete _0x5c08f9[_0xeffa('0xa4')]['content-type'];}return rp(_0x5c08f9);})[_0xeffa('0x2a')](function(_0x109860){if(_0x109860){_0x13066e[_0xeffa('0xa7')](_0x109860[_0xeffa('0xa4')]);logger[_0xeffa('0x69')](_0x109860[_0xeffa('0x92')]);if(_[_0xeffa('0xa8')](_0xdb7084[_0xeffa('0x39')][_0xeffa('0x8')],'download')&&_0x109860[_0xeffa('0xa9')]==0x1f4){return _0x13066e[_0xeffa('0x21')](_0x109860[_0xeffa('0xa9')]);}else{return _0x13066e[_0xeffa('0x23')](_0x109860[_0xeffa('0xa9')])['send'](_0x109860[_0xeffa('0x92')]);}}else{return _0x13066e[_0xeffa('0x21')](0xc8);}})[_0xeffa('0x4b')](handleError(_0x13066e,null));};exports['webhookPost']=function(_0x21b501,_0x3547d4,_0x54cdc8){return BPromise[_0xeffa('0x9b')]()['then'](function(){if(!_0x21b501[_0xeffa('0x39')]['path']){throw new Error(_0xeffa('0xaa'));}if(!_0x21b501[_0xeffa('0x39')][_0xeffa('0x9c')]){throw new Error(_0xeffa('0x9d'));}var _0xf36779=_0x21b501['query'][_0xeffa('0x9e')]?_0x21b501[_0xeffa('0x39')][_0xeffa('0x9e')]+':'+_0x21b501[_0xeffa('0x39')][_0xeffa('0x9c')]:_0xeffa('0x9f')+_0x21b501[_0xeffa('0x39')][_0xeffa('0x9c')];var _0x48f347=_0x21b501[_0xeffa('0x39')][_0xeffa('0xa0')]?_0x21b501[_0xeffa('0x39')]['json']:!![];var _0x133075=_0x21b501[_0xeffa('0x39')][_0xeffa('0xa1')]?_0x21b501[_0xeffa('0x39')][_0xeffa('0xa1')]:null;var _0x4a6e6f={'method':_0x21b501[_0xeffa('0xa2')],'uri':util[_0xeffa('0x54')]('%s%s',_0xf36779,_0x21b501[_0xeffa('0x39')][_0xeffa('0x8')]),'json':_0x48f347,'resolveWithFullResponse':!![],'encoding':_0x133075,'body':_0x21b501[_0xeffa('0x92')]};if(_0x21b501[_0xeffa('0xa4')]){_0x4a6e6f[_0xeffa('0xa4')]=_0x21b501[_0xeffa('0xa4')];if(_0x4a6e6f['headers'][_0xeffa('0xa5')]){delete _0x4a6e6f['headers'][_0xeffa('0xa5')];}}if(_0x4a6e6f[_0xeffa('0xa4')][_0xeffa('0xa6')]){delete _0x4a6e6f[_0xeffa('0xa4')][_0xeffa('0xa6')];}return rp(_0x4a6e6f);})['then'](function(_0x2e0e1d){if(_0x2e0e1d){_0x3547d4[_0xeffa('0xa7')](_0x2e0e1d[_0xeffa('0xa4')]);logger[_0xeffa('0x69')](_0x2e0e1d[_0xeffa('0x92')]);return _0x3547d4[_0xeffa('0x23')](_0x2e0e1d['statusCode'])[_0xeffa('0x31')](_0x2e0e1d[_0xeffa('0x92')]);}else{return _0x3547d4[_0xeffa('0x21')](0xc8);}})['catch'](handleError(_0x3547d4,null));}; \ No newline at end of file +var _0xfc7d=['rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','path','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','endsWith','download','statusCode','sendStatus','webhookPost','method','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','../../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','./plugin.socket','register','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','stack','send','index','map','Plugin'];(function(_0x1641ca,_0x290a2e){var _0xd3a8d2=function(_0x1e3119){while(--_0x1e3119){_0x1641ca['push'](_0x1641ca['shift']());}};_0xd3a8d2(++_0x290a2e);}(_0xfc7d,0x7b));var _0xdfc7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfc7d[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfc7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfc7('0x1'));var rp=require('request-promise');var moment=require(_0xdfc7('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdfc7('0x3'));var path=require('path');var sox=require(_0xdfc7('0x4'));var csv=require(_0xdfc7('0x5'));var ejs=require(_0xdfc7('0x6'));var fs=require('fs');var fs_extra=require(_0xdfc7('0x7'));var _=require(_0xdfc7('0x8'));var squel=require('squel');var crypto=require(_0xdfc7('0x9'));var jsforce=require(_0xdfc7('0xa'));var deskjs=require(_0xdfc7('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdfc7('0xc'));var Papa=require(_0xdfc7('0xd'));var extract=require(_0xdfc7('0xe'));var rimraf=require(_0xdfc7('0x0'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xdfc7('0xf'));var qs=require(_0xdfc7('0x10'));var as=require(_0xdfc7('0x11'));var hardwareService=require(_0xdfc7('0x12'));var logger=require(_0xdfc7('0x13'))(_0xdfc7('0x14'));var utils=require('../../config/utils');var config=require(_0xdfc7('0x15'));var licenseUtil=require(_0xdfc7('0x16'));var db=require(_0xdfc7('0x17'))['db'];config[_0xdfc7('0x18')]=_[_0xdfc7('0x19')](config[_0xdfc7('0x18')],{'host':_0xdfc7('0x1a'),'port':0x18eb});var socket=require(_0xdfc7('0x1b'))(new Redis(config['redis']));require(_0xdfc7('0x1c'))[_0xdfc7('0x1d')](socket);function respondWithStatusCode(_0x4f4b55,_0x199538){_0x199538=_0x199538||0xcc;return function(_0x1624ee){if(_0x1624ee){return _0x4f4b55['sendStatus'](_0x199538);}return _0x4f4b55['status'](_0x199538)[_0xdfc7('0x1e')]();};}function respondWithResult(_0x47c540,_0x3a2a11){_0x3a2a11=_0x3a2a11||0xc8;return function(_0x3ef357){if(_0x3ef357){return _0x47c540[_0xdfc7('0x1f')](_0x3a2a11)[_0xdfc7('0x20')](_0x3ef357);}};}function respondWithFilteredResult(_0x49b44e,_0x51884a){return function(_0x2e24f3){if(_0x2e24f3){var _0x410634=typeof _0x51884a[_0xdfc7('0x21')]===_0xdfc7('0x22')&&typeof _0x51884a['limit']==='undefined';var _0x21fbfd=_0x2e24f3['count'];var _0x22ea3f=_0x410634?0x0:_0x51884a[_0xdfc7('0x21')];var _0x5eca7b=_0x410634?_0x2e24f3[_0xdfc7('0x23')]:_0x51884a[_0xdfc7('0x21')]+_0x51884a[_0xdfc7('0x24')];var _0x2917a7;if(_0x5eca7b>=_0x21fbfd){_0x5eca7b=_0x21fbfd;_0x2917a7=0xc8;}else{_0x2917a7=0xce;}_0x49b44e[_0xdfc7('0x1f')](_0x2917a7);return _0x49b44e['set'](_0xdfc7('0x25'),_0x22ea3f+'-'+_0x5eca7b+'/'+_0x21fbfd)[_0xdfc7('0x20')](_0x2e24f3);}return null;};}function patchUpdates(_0xf17aa7){return function(_0x263c3a){try{jsonpatch[_0xdfc7('0x26')](_0x263c3a,_0xf17aa7,!![]);}catch(_0x2f07ee){return BPromise[_0xdfc7('0x27')](_0x2f07ee);}return _0x263c3a[_0xdfc7('0x28')]();};}function saveUpdates(_0x35313c,_0xd1216f){return function(_0x4d884e){if(_0x4d884e){return _0x4d884e[_0xdfc7('0x29')](_0x35313c)[_0xdfc7('0x2a')](function(_0x4997da){return _0x4997da;});}return null;};}function removeEntity(_0xfb06c5,_0x388093){return function(_0x25bbcc){if(_0x25bbcc){return _0x25bbcc[_0xdfc7('0x2b')]()['then'](function(){var _0x16f621=_0x25bbcc[_0xdfc7('0x2c')]({'plain':!![]});var _0x4052ca=_0xdfc7('0x2d');return db[_0xdfc7('0x2e')][_0xdfc7('0x2b')]({'where':{'type':_0x4052ca,'resourceId':_0x16f621['id']}})[_0xdfc7('0x2a')](function(){return _0x25bbcc;});})[_0xdfc7('0x2a')](function(){_0xfb06c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x340365,_0x1be443){return function(_0x4e9b43){if(!_0x4e9b43){_0x340365['sendStatus'](0x194);}return _0x4e9b43;};}function handleError(_0xde908,_0x2874ea){_0x2874ea=_0x2874ea||0x1f4;return function(_0x2ce6ef){logger['error'](_0x2ce6ef[_0xdfc7('0x2f')]);if(_0x2ce6ef['name']){delete _0x2ce6ef['name'];}_0xde908[_0xdfc7('0x1f')](_0x2874ea)[_0xdfc7('0x30')](_0x2ce6ef);};}exports[_0xdfc7('0x31')]=function(_0x4cb016,_0x3579dd){var _0x126277={},_0x3df64b={},_0x4cf55b={'count':0x0,'rows':[]};var _0xb6b632=_[_0xdfc7('0x32')](db[_0xdfc7('0x33')][_0xdfc7('0x34')],function(_0x205e0c){return{'name':_0x205e0c[_0xdfc7('0x35')],'type':_0x205e0c[_0xdfc7('0x36')]['key']};});_0x3df64b['model']=_['map'](_0xb6b632,_0xdfc7('0x37'));_0x3df64b[_0xdfc7('0x38')]=_[_0xdfc7('0x39')](_0x4cb016['query']);_0x3df64b[_0xdfc7('0x3a')]=_[_0xdfc7('0x3b')](_0x3df64b[_0xdfc7('0x3c')],_0x3df64b[_0xdfc7('0x38')]);_0x126277['attributes']=_[_0xdfc7('0x3b')](_0x3df64b[_0xdfc7('0x3c')],qs[_0xdfc7('0x3d')](_0x4cb016[_0xdfc7('0x38')]['fields']));_0x126277['attributes']=_0x126277[_0xdfc7('0x3e')][_0xdfc7('0x3f')]?_0x126277[_0xdfc7('0x3e')]:_0x3df64b['model'];if(!_0x4cb016['query']['hasOwnProperty']('nolimit')){_0x126277[_0xdfc7('0x24')]=qs['limit'](_0x4cb016['query'][_0xdfc7('0x24')]);_0x126277[_0xdfc7('0x21')]=qs[_0xdfc7('0x21')](_0x4cb016[_0xdfc7('0x38')]['offset']);}_0x126277['order']=qs[_0xdfc7('0x40')](_0x4cb016[_0xdfc7('0x38')][_0xdfc7('0x40')]);_0x126277[_0xdfc7('0x41')]=qs[_0xdfc7('0x3a')](_[_0xdfc7('0x42')](_0x4cb016[_0xdfc7('0x38')],_0x3df64b[_0xdfc7('0x3a')]),_0xb6b632);if(_0x4cb016['query'][_0xdfc7('0x43')]){_0x126277[_0xdfc7('0x41')]=_[_0xdfc7('0x44')](_0x126277[_0xdfc7('0x41')],{'$or':_[_0xdfc7('0x32')](_0xb6b632,function(_0x1e83a7){if(_0x1e83a7[_0xdfc7('0x36')]!==_0xdfc7('0x45')){var _0x52e433={};_0x52e433[_0x1e83a7[_0xdfc7('0x37')]]={'$like':'%'+_0x4cb016['query'][_0xdfc7('0x43')]+'%'};return _0x52e433;}})});}_0x126277=_[_0xdfc7('0x44')]({},_0x126277,_0x4cb016[_0xdfc7('0x46')]);var _0x889b1={'where':_0x126277[_0xdfc7('0x41')]};return db[_0xdfc7('0x33')][_0xdfc7('0x23')](_0x889b1)[_0xdfc7('0x2a')](function(_0x157052){_0x4cf55b[_0xdfc7('0x23')]=_0x157052;if(_0x4cb016['query'][_0xdfc7('0x47')]){_0x126277[_0xdfc7('0x48')]=[{'all':!![]}];}return db[_0xdfc7('0x33')][_0xdfc7('0x49')](_0x126277);})[_0xdfc7('0x2a')](function(_0x5818ae){_0x4cf55b[_0xdfc7('0x4a')]=_0x5818ae;return _0x4cf55b;})['then'](respondWithFilteredResult(_0x3579dd,_0x126277))[_0xdfc7('0x4b')](handleError(_0x3579dd,null));};exports['show']=function(_0x3de5a1,_0x1cde4a){var _0x5bbfcc={'raw':!![],'where':{'id':_0x3de5a1[_0xdfc7('0x4c')]['id']}},_0xdbfe8b={};_0xdbfe8b['model']=_[_0xdfc7('0x39')](db[_0xdfc7('0x33')][_0xdfc7('0x34')]);_0xdbfe8b[_0xdfc7('0x38')]=_[_0xdfc7('0x39')](_0x3de5a1['query']);_0xdbfe8b[_0xdfc7('0x3a')]=_[_0xdfc7('0x3b')](_0xdbfe8b['model'],_0xdbfe8b['query']);_0x5bbfcc[_0xdfc7('0x3e')]=_[_0xdfc7('0x3b')](_0xdbfe8b[_0xdfc7('0x3c')],qs[_0xdfc7('0x3d')](_0x3de5a1[_0xdfc7('0x38')][_0xdfc7('0x3d')]));_0x5bbfcc[_0xdfc7('0x3e')]=_0x5bbfcc[_0xdfc7('0x3e')][_0xdfc7('0x3f')]?_0x5bbfcc[_0xdfc7('0x3e')]:_0xdbfe8b['model'];if(_0x3de5a1[_0xdfc7('0x38')][_0xdfc7('0x47')]){_0x5bbfcc['include']=[{'all':!![]}];}_0x5bbfcc=_[_0xdfc7('0x44')]({},_0x5bbfcc,_0x3de5a1[_0xdfc7('0x46')]);return db[_0xdfc7('0x33')][_0xdfc7('0x4d')](_0x5bbfcc)[_0xdfc7('0x2a')](handleEntityNotFound(_0x1cde4a,null))[_0xdfc7('0x2a')](respondWithResult(_0x1cde4a,null))['catch'](handleError(_0x1cde4a,null));};exports['download']=function(_0x454c69,_0x1f3b0a,_0x10b305){return db[_0xdfc7('0x33')][_0xdfc7('0x4d')]({'where':{'id':_0x454c69[_0xdfc7('0x4c')]['id']},'attributes':[_0xdfc7('0x37'),'path'],'raw':!![]})[_0xdfc7('0x2a')](handleEntityNotFound(_0x1f3b0a,null))[_0xdfc7('0x2a')](function(_0x5915be){if(_0x5915be){var _0x307f8e=path[_0xdfc7('0x4e')](config[_0xdfc7('0x4f')],_0xdfc7('0x50'),util[_0xdfc7('0x51')](_0xdfc7('0x52'),path[_0xdfc7('0x53')](_0x5915be['path'])));var _0x5e7856=fs[_0xdfc7('0x54')](_0x307f8e);var _0x225d2f=archiver(_0xdfc7('0x55'),{'zlib':{'level':0x9}});_0x225d2f['on'](_0xdfc7('0x56'),function(_0xd117ff){if(_0xd117ff['code']===_0xdfc7('0x57')){logger[_0xdfc7('0x58')](_0xd117ff);}else{throw new db[(_0xdfc7('0x59'))][(_0xdfc7('0x5a'))](_0xdfc7('0x5b'));}});_0x225d2f['on'](_0xdfc7('0x58'),function(_0x50276b){throw new db[(_0xdfc7('0x59'))][(_0xdfc7('0x5a'))](_0xdfc7('0x5b'));});_0x225d2f[_0xdfc7('0x5c')](_0x5e7856);_0x225d2f['glob'](_0xdfc7('0x5d'),{'cwd':path[_0xdfc7('0x4e')](config[_0xdfc7('0x4f')],_0xdfc7('0x50'),path['dirname'](_0x5915be[_0xdfc7('0x5e')])),'ignore':[path['join'](path['basename'](_0x5915be[_0xdfc7('0x5e')]),_0xdfc7('0x5f')),path[_0xdfc7('0x4e')](path[_0xdfc7('0x53')](_0x5915be[_0xdfc7('0x5e')]),_0xdfc7('0x60'))],'nodir':!![]})[_0xdfc7('0x61')]();_0x5e7856['on'](_0xdfc7('0x62'),function(){if(!fs[_0xdfc7('0x63')](_0x307f8e)){throw new db['Sequelize'][(_0xdfc7('0x5a'))](_0xdfc7('0x64'));}return _0x1f3b0a['download'](_0x307f8e,util[_0xdfc7('0x51')](_0xdfc7('0x52'),path[_0xdfc7('0x53')](_0x5915be[_0xdfc7('0x5e')])),function(_0x5d4b59){if(_0x5d4b59){throw new db['Sequelize'][(_0xdfc7('0x5a'))](_0xdfc7('0x65'));}fs[_0xdfc7('0x66')](_0x307f8e);logger['info']('Download\x20completed');logger[_0xdfc7('0x67')](_0xdfc7('0x68'));});});}return null;})[_0xdfc7('0x4b')](handleError(_0x1f3b0a,null));};exports[_0xdfc7('0x69')]=function(_0x4c18ab,_0x34029b,_0x2c4de9){var _0x1c5214=path[_0xdfc7('0x53')](_0x4c18ab[_0xdfc7('0x6a')]['filename'],path['extname'](_0x4c18ab[_0xdfc7('0x6a')]['filename']));var _0x51d0ac=path[_0xdfc7('0x4e')](config[_0xdfc7('0x4f')],'server/files/plugins',_0x4c18ab['file'][_0xdfc7('0x6b')]);var _0x13b91c=path[_0xdfc7('0x4e')](config[_0xdfc7('0x4f')],_0xdfc7('0x50'),_0x1c5214);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x51d0ac);logger[_0xdfc7('0x67')](_0xdfc7('0x6c'),_0x13b91c);try{fs[_0xdfc7('0x6d')](_0x51d0ac,parseInt(_0xdfc7('0x6e'),0x8));extract(_0x51d0ac,{'dir':_0x13b91c},function(_0x5e36d3){if(_0x5e36d3){logger['error'](_0x5e36d3);handleError(_0x5e36d3,!![]);};var _0xcddec5=fs[_0xdfc7('0x6f')](_0x13b91c);if(_0xcddec5[_0xdfc7('0x3f')]>0x1){removeReferences(_0x51d0ac,_0x13b91c);logger['error'](_0xdfc7('0x70'));return _0x2c4de9(new Error(_0xdfc7('0x70')));}var _0x280904=fs[_0xdfc7('0x71')](path[_0xdfc7('0x4e')](_0x13b91c,_0xcddec5[0x0]));if(_0x280904[_0xdfc7('0x72')]()){removeReferences(_0x51d0ac,_0x13b91c);logger['error'](_0xdfc7('0x70'));return _0x2c4de9(new Error('Invalid\x20plugin\x20structure'));}if(_0x280904[_0xdfc7('0x73')]()){var _0x1b4efa=fs['readdirSync'](path['join'](_0x13b91c,_0xcddec5[0x0]));if(_0x1b4efa['length']===0x0){removeReferences(_0x51d0ac,_0x13b91c);logger['error'](_0xdfc7('0x70'));return _0x2c4de9(new Error(_0xdfc7('0x70')));}var _0x27a83a=_0x1b4efa[_0xdfc7('0x74')](function(_0x122a18){return _0x122a18===_0xdfc7('0x75');});if(!_0x27a83a){return _0x2c4de9(new Error(_0xdfc7('0x76')));}var _0x4af882=fs[_0xdfc7('0x77')](path[_0xdfc7('0x4e')](_0x13b91c,_0xcddec5[0x0],_0xdfc7('0x75')));var _0xf7f0bc=JSON[_0xdfc7('0x78')](_0x4af882);if(_0xdfc7('0x22')==typeof _0xf7f0bc[_0xdfc7('0x37')]){return _0x2c4de9(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xdfc7('0x22')==typeof _0xf7f0bc['type']){return _0x2c4de9(new Error(_0xdfc7('0x79')));}if(_0xdfc7('0x22')==typeof _0xf7f0bc[_0xdfc7('0x7a')]){return _0x2c4de9(new Error(_0xdfc7('0x7b')));}if(_0xdfc7('0x22')==typeof _0xf7f0bc[_0xdfc7('0x7c')]){return _0x2c4de9(new Error(_0xdfc7('0x7d')));}if(_0xf7f0bc[_0xdfc7('0x36')]===_0xdfc7('0x7e')){if(_0xdfc7('0x22')==typeof _0xf7f0bc['parameters']['views']){return _0x2c4de9(new Error(_0xdfc7('0x7f')));}if(_0xdfc7('0x22')==typeof _0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x80')][_0xdfc7('0x81')]&&_0xdfc7('0x22')==typeof _0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x80')]['agent']){return _0x2c4de9(new Error(_0xdfc7('0x82')));}}else if(_0xf7f0bc['type']===_0xdfc7('0x83')){if(_0xdfc7('0x22')==typeof _0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x84')]){return _0x2c4de9(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x85')]){return _0x2c4de9(new Error(_0xdfc7('0x86')));}}else{return _0x2c4de9(new Error(_0xdfc7('0x87')));}var _0x5c1a5a=_0xf7f0bc[_0xdfc7('0x37')];var _0x5cc5ce=_0xf7f0bc[_0xdfc7('0x88')];var _0x1d49c7=_0xf7f0bc['type'];var _0x2c47e1=_0xf7f0bc[_0xdfc7('0x89')]?_0xf7f0bc[_0xdfc7('0x89')]:_0xdfc7('0x8a');var _0x205952=_0xf7f0bc[_0xdfc7('0x8b')]?_0xf7f0bc[_0xdfc7('0x8b')]:_0xdfc7('0x8c');var _0x29dbec='';var _0x2be754='';var _0x11a5bd='';var _0x232914='';var _0x2cf52d=_0xf7f0bc[_0xdfc7('0x7a')];if(_0x1d49c7===_0xdfc7('0x7e')){if('undefined'!=typeof _0xf7f0bc[_0xdfc7('0x7c')]['views'][_0xdfc7('0x81')]){var _0x1f7d75=_0xf7f0bc['parameters'][_0xdfc7('0x80')][_0xdfc7('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1f7d75)){_0x29dbec=path['join'](_0xdfc7('0x8d'),_0x1c5214,_0xcddec5[0x0],_0x1f7d75);}else{_0x29dbec=_0x1f7d75;}}else{logger[_0xdfc7('0x67')](_0xdfc7('0x8e'));}if(_0xdfc7('0x22')!=typeof _0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x80')][_0xdfc7('0x8f')]){var _0x7ed15d=_0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x80')][_0xdfc7('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xdfc7('0x90')](_0x7ed15d)){_0x2be754=path[_0xdfc7('0x4e')](_0xdfc7('0x8d'),_0x1c5214,_0xcddec5[0x0],_0x7ed15d);}else{_0x2be754=_0x7ed15d;}}else{logger[_0xdfc7('0x67')](_0xdfc7('0x91'));}}else if(_0x1d49c7===_0xdfc7('0x83')){_0x11a5bd=_0xf7f0bc['parameters'][_0xdfc7('0x84')];_0x232914=_0xf7f0bc[_0xdfc7('0x7c')]['scriptPath'];if(_0xdfc7('0x22')!=typeof _0xf7f0bc['parameters'][_0xdfc7('0x80')]){if(_0xdfc7('0x22')!=typeof _0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x80')][_0xdfc7('0x81')]){var _0x1f7d75=_0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x80')][_0xdfc7('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xdfc7('0x90')](_0x1f7d75)){_0x29dbec=path[_0xdfc7('0x4e')](_0xdfc7('0x8d'),_0x1c5214,_0xcddec5[0x0],_0x1f7d75);}else{_0x29dbec=_0x1f7d75;}}if(_0xdfc7('0x22')!=typeof _0xf7f0bc[_0xdfc7('0x7c')]['views'][_0xdfc7('0x8f')]){var _0x7ed15d=_0xf7f0bc[_0xdfc7('0x7c')][_0xdfc7('0x80')][_0xdfc7('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0xdfc7('0x90')](_0x7ed15d)){_0x2be754=path[_0xdfc7('0x4e')](_0xdfc7('0x8d'),_0x1c5214,_0xcddec5[0x0],_0x7ed15d);}else{_0x2be754=_0x7ed15d;}}}}var _0x2505d5={'name':_0x5c1a5a,'description':_0x5cc5ce,'path':path['join'](_0x1c5214,_0xcddec5[0x0]),'type':_0x1d49c7,'sidebar':_0x2c47e1,'icon':_0x205952,'adminUrl':_0x29dbec,'agentUrl':_0x2be754,'scriptName':_0x11a5bd,'scriptPath':_0x232914,'version':_0x2cf52d};removeReferences(_0x51d0ac,null);return db[_0xdfc7('0x33')]['create'](_0x2505d5)['then'](function(_0x45a6b2){var _0x14ac5a={'role':_0x4c18ab['body'][_0xdfc7('0x92')],'userProfileId':_0x4c18ab[_0xdfc7('0x93')][_0xdfc7('0x94')]};if(!_0x14ac5a)throw new Error(_0xdfc7('0x95'));if(_0x14ac5a['role']==='user'){var _0x327bc4=_0x45a6b2[_0xdfc7('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0xdfc7('0x4d')]({'where':{'name':_0xdfc7('0x2d'),'userProfileId':_0x14ac5a['userProfileId']},'raw':!![]})[_0xdfc7('0x2a')](function(_0x43195e){if(_0x43195e&&_0x43195e[_0xdfc7('0x96')]===0x0){return db['UserProfileResource'][_0xdfc7('0x97')]({'name':_0x327bc4['name'],'resourceId':_0x327bc4['id'],'type':_0x43195e[_0xdfc7('0x37')],'sectionId':_0x43195e['id']},{})[_0xdfc7('0x2a')](function(){return _0x45a6b2;});}else{return _0x45a6b2;}})[_0xdfc7('0x4b')](function(_0x57545a){logger[_0xdfc7('0x58')](_0xdfc7('0x98'),_0x57545a);throw _0x57545a;});}return _0x45a6b2;})['then'](respondWithResult(_0x34029b,null))[_0xdfc7('0x4b')](handleError(_0x34029b,null));}});}catch(_0x178c4f){_0x34029b[_0xdfc7('0x1f')](0x1f4)[_0xdfc7('0x30')](_0x178c4f);}};function removeReferences(_0x2d5706,_0x4ee40e){try{if(_0x2d5706){fs[_0xdfc7('0x66')](_0x2d5706);logger['info'](_0xdfc7('0x99'));}if(_0x4ee40e){rimraf(_0x4ee40e,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x3f55bf){logger[_0xdfc7('0x58')](_0x3f55bf);}}exports[_0xdfc7('0x29')]=function(_0x5176ee,_0x1bbadc,_0x166938){return db[_0xdfc7('0x33')][_0xdfc7('0x4d')]({'where':{'id':_0x5176ee['params']['id']}})[_0xdfc7('0x2a')](handleEntityNotFound(_0x1bbadc,null))[_0xdfc7('0x2a')](saveUpdates(_0x5176ee[_0xdfc7('0x93')],null))[_0xdfc7('0x2a')](respondWithResult(_0x1bbadc,null))['catch'](handleError(_0x1bbadc,null));};exports[_0xdfc7('0x9a')]=function(_0x5e17d4,_0xf6a40d,_0x3fc775){return db['Plugin']['find']({'where':{'id':_0x5e17d4[_0xdfc7('0x4c')]['id']}})[_0xdfc7('0x2a')](function(_0x375a00){if(_0x375a00){return _0x375a00[_0xdfc7('0x2b')]();}})[_0xdfc7('0x2a')](function(_0x31933c){rimraf(path[_0xdfc7('0x4e')](config[_0xdfc7('0x4f')],_0xdfc7('0x50'),path[_0xdfc7('0x9b')](_0x31933c['path'])),function(){});return _0x31933c;})['then'](handleEntityNotFound(_0xf6a40d,null))['then'](respondWithStatusCode(_0xf6a40d,null))[_0xdfc7('0x4b')](handleError(_0xf6a40d,null));};exports[_0xdfc7('0x9c')]=function(_0x2f3b86,_0x26286a,_0x40c2db){return BPromise[_0xdfc7('0x9d')]()[_0xdfc7('0x2a')](function(){if(!_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0x5e')]){throw new Error(_0xdfc7('0x9e'));}if(!_0x2f3b86[_0xdfc7('0x38')]['port']){throw new Error(_0xdfc7('0x9f'));}var _0x37f379=_0x2f3b86['query'][_0xdfc7('0xa0')]?_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0xa0')]+':'+_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0xa1')]:_0xdfc7('0xa2')+_0x2f3b86['query']['port'];var _0xcdfe06=_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0x20')]?_0x2f3b86[_0xdfc7('0x38')]['json']:!![];var _0x4fceb5=_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0xa3')]?_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0xa3')]:null;var _0x59e258={'method':_0x2f3b86['method'],'uri':util[_0xdfc7('0x51')](_0xdfc7('0xa4'),_0x37f379,_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0x5e')]),'json':_0xcdfe06,'resolveWithFullResponse':!![],'encoding':_0x4fceb5,'qs':_0x2f3b86[_0xdfc7('0x38')]};if(_0x2f3b86[_0xdfc7('0xa5')]){_0x59e258[_0xdfc7('0xa5')]=_0x2f3b86[_0xdfc7('0xa5')];if(_0x59e258[_0xdfc7('0xa5')][_0xdfc7('0xa6')]){delete _0x59e258['headers'][_0xdfc7('0xa6')];}}if(_0x59e258[_0xdfc7('0xa5')][_0xdfc7('0xa7')]){delete _0x59e258[_0xdfc7('0xa5')][_0xdfc7('0xa7')];}return rp(_0x59e258);})[_0xdfc7('0x2a')](function(_0x35a400){if(_0x35a400){_0x26286a[_0xdfc7('0xa8')](_0x35a400[_0xdfc7('0xa5')]);logger[_0xdfc7('0x67')](_0x35a400['body']);if(_[_0xdfc7('0xa9')](_0x2f3b86[_0xdfc7('0x38')][_0xdfc7('0x5e')],_0xdfc7('0xaa'))&&_0x35a400[_0xdfc7('0xab')]==0x1f4){return _0x26286a[_0xdfc7('0xac')](_0x35a400[_0xdfc7('0xab')]);}else{return _0x26286a['status'](_0x35a400[_0xdfc7('0xab')])[_0xdfc7('0x30')](_0x35a400['body']);}}else{return _0x26286a[_0xdfc7('0xac')](0xc8);}})['catch'](handleError(_0x26286a,null));};exports[_0xdfc7('0xad')]=function(_0x4110f9,_0x34c0b9,_0x3c58a0){return BPromise[_0xdfc7('0x9d')]()[_0xdfc7('0x2a')](function(){if(!_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0x5e')]){throw new Error(_0xdfc7('0x9e'));}if(!_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0xa1')]){throw new Error(_0xdfc7('0x9f'));}var _0x100c6a=_0x4110f9['query'][_0xdfc7('0xa0')]?_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0xa0')]+':'+_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0xa1')]:'http://localhost:'+_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0xa1')];var _0x12efb5=_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0x20')]?_0x4110f9[_0xdfc7('0x38')]['json']:!![];var _0x537370=_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0xa3')]?_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0xa3')]:null;var _0x2c5682={'method':_0x4110f9[_0xdfc7('0xae')],'uri':util[_0xdfc7('0x51')](_0xdfc7('0xa4'),_0x100c6a,_0x4110f9[_0xdfc7('0x38')][_0xdfc7('0x5e')]),'json':_0x12efb5,'resolveWithFullResponse':!![],'encoding':_0x537370,'body':_0x4110f9[_0xdfc7('0x93')]};if(_0x4110f9[_0xdfc7('0xa5')]){_0x2c5682[_0xdfc7('0xa5')]=_0x4110f9['headers'];if(_0x2c5682[_0xdfc7('0xa5')][_0xdfc7('0xa6')]){delete _0x2c5682['headers'][_0xdfc7('0xa6')];}}if(_0x2c5682[_0xdfc7('0xa5')][_0xdfc7('0xa7')]){delete _0x2c5682[_0xdfc7('0xa5')][_0xdfc7('0xa7')];}return rp(_0x2c5682);})[_0xdfc7('0x2a')](function(_0x95b9ba){if(_0x95b9ba){_0x34c0b9[_0xdfc7('0xa8')](_0x95b9ba[_0xdfc7('0xa5')]);logger[_0xdfc7('0x67')](_0x95b9ba[_0xdfc7('0x93')]);return _0x34c0b9['status'](_0x95b9ba['statusCode'])[_0xdfc7('0x30')](_0x95b9ba[_0xdfc7('0x93')]);}else{return _0x34c0b9[_0xdfc7('0xac')](0xc8);}})[_0xdfc7('0x4b')](handleError(_0x34c0b9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 52a6d7c..a05e5c1 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 _0x1b94=['emit','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove'];(function(_0x1cbd45,_0xc1a48a){var _0x47931b=function(_0x498fd3){while(--_0x498fd3){_0x1cbd45['push'](_0x1cbd45['shift']());}};_0x47931b(++_0xc1a48a);}(_0x1b94,0x1f2));var _0x41b9=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x1b94[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x41b9('0x0'));var Plugin=require(_0x41b9('0x1'))['db'][_0x41b9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x41b9('0x3')](0x0);var events={'afterCreate':_0x41b9('0x4'),'afterUpdate':'update','afterDestroy':_0x41b9('0x5')};function emitEvent(_0x295a00){return function(_0x864f17,_0x57f10c,_0x14990b){PluginEvents[_0x41b9('0x6')](_0x295a00+':'+_0x864f17['id'],_0x864f17);PluginEvents[_0x41b9('0x6')](_0x295a00,_0x864f17);_0x14990b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x41b9('0x7')](e,emitEvent(event));}}module[_0x41b9('0x8')]=PluginEvents; \ No newline at end of file +var _0x7958=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x2d228a,_0x2f0bee){var _0x288974=function(_0x56e513){while(--_0x56e513){_0x2d228a['push'](_0x2d228a['shift']());}};_0x288974(++_0x2f0bee);}(_0x7958,0x126));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x8795('0x0'));var Plugin=require(_0x8795('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x8795('0x2')](0x0);var events={'afterCreate':_0x8795('0x3'),'afterUpdate':_0x8795('0x4'),'afterDestroy':_0x8795('0x5')};function emitEvent(_0x3becac){return function(_0x43aff1,_0x347089,_0x2f2594){PluginEvents['emit'](_0x3becac+':'+_0x43aff1['id'],_0x43aff1);PluginEvents[_0x8795('0x6')](_0x3becac,_0x43aff1);_0x2f2594(null);};}for(var e in events){if(events[_0x8795('0x7')](e)){var event=events[e];Plugin[_0x8795('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index afa2217..1b38916 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 _0x8f27=['moment','bluebird','path','rimraf','../../config/environment','Plugin','lodash','util','api'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8f27,0x11d));var _0x78f2=function(_0x3bb830,_0xa498c1){_0x3bb830=_0x3bb830-0x0;var _0x309778=_0x8f27[_0x3bb830];return _0x309778;};'use strict';var _=require(_0x78f2('0x0'));var util=require(_0x78f2('0x1'));var logger=require('../../config/logger')(_0x78f2('0x2'));var moment=require(_0x78f2('0x3'));var BPromise=require(_0x78f2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78f2('0x5'));var rimraf=require(_0x78f2('0x6'));var config=require(_0x78f2('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x496b0e,_0x51c504){return _0x496b0e['define'](_0x78f2('0x8'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3739=['exports','define','Plugin','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0xb57095,_0x1ce6cf){var _0x1f51d4=function(_0xf50105){while(--_0xf50105){_0xb57095['push'](_0xb57095['shift']());}};_0x1f51d4(++_0x1ce6cf);}(_0x3739,0xc3));var _0x9373=function(_0x5e54c2,_0x1fc3a2){_0x5e54c2=_0x5e54c2-0x0;var _0xa36ee=_0x3739[_0x5e54c2];return _0xa36ee;};'use strict';var _=require(_0x9373('0x0'));var util=require(_0x9373('0x1'));var logger=require(_0x9373('0x2'))(_0x9373('0x3'));var moment=require('moment');var BPromise=require(_0x9373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9373('0x5'));var rimraf=require(_0x9373('0x6'));var config=require(_0x9373('0x7'));var attributes=require(_0x9373('0x8'));module[_0x9373('0x9')]=function(_0xecc6cb,_0x30a353){return _0xecc6cb[_0x9373('0xa')](_0x9373('0xb'),attributes,{'tableName':'plugins','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 1431606..14eefd9 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 _0x4c87=['Plugin','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin'];(function(_0x5a6f9e,_0x343a71){var _0x1d2abb=function(_0x299d8b){while(--_0x299d8b){_0x5a6f9e['push'](_0x5a6f9e['shift']());}};_0x1d2abb(++_0x343a71);}(_0x4c87,0x163));var _0x74c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4c87[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x74c8('0x0'));var moment=require(_0x74c8('0x1'));var BPromise=require(_0x74c8('0x2'));var rs=require(_0x74c8('0x3'));var fs=require('fs');var Redis=require(_0x74c8('0x4'));var db=require(_0x74c8('0x5'))['db'];var utils=require(_0x74c8('0x6'));var logger=require(_0x74c8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x74c8('0x8'));var client=jayson[_0x74c8('0x9')][_0x74c8('0xa')]({'port':0x232a});config[_0x74c8('0xb')]=_[_0x74c8('0xc')](config[_0x74c8('0xb')],{'host':_0x74c8('0xd'),'port':0x18eb});var socket=require(_0x74c8('0xe'))(new Redis(config[_0x74c8('0xb')]));require(_0x74c8('0xf'))[_0x74c8('0x10')](socket);function respondWithRpcPromise(_0x4d95a4,_0x2fbe68,_0xe46382){return new BPromise(function(_0x1686ac,_0x32839e){return client[_0x74c8('0x11')](_0x4d95a4,_0xe46382)[_0x74c8('0x12')](function(_0x25539f){logger[_0x74c8('0x13')](_0x74c8('0x14'),_0x2fbe68,_0x74c8('0x15'));logger[_0x74c8('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2fbe68,_0x74c8('0x15'),JSON[_0x74c8('0x17')](_0x25539f));if(_0x25539f[_0x74c8('0x18')]){if(_0x25539f[_0x74c8('0x18')][_0x74c8('0x19')]===0x1f4){logger[_0x74c8('0x18')]('Plugin,\x20%s,\x20%s',_0x2fbe68,_0x25539f[_0x74c8('0x18')][_0x74c8('0x1a')]);return _0x32839e(_0x25539f['error'][_0x74c8('0x1a')]);}logger[_0x74c8('0x18')](_0x74c8('0x14'),_0x2fbe68,_0x25539f[_0x74c8('0x18')][_0x74c8('0x1a')]);return _0x1686ac(_0x25539f[_0x74c8('0x18')][_0x74c8('0x1a')]);}else{logger[_0x74c8('0x13')](_0x74c8('0x14'),_0x2fbe68,'request\x20sent');_0x1686ac(_0x25539f[_0x74c8('0x1b')][_0x74c8('0x1a')]);}})[_0x74c8('0x1c')](function(_0x3f3f4e){logger[_0x74c8('0x18')](_0x74c8('0x14'),_0x2fbe68,_0x3f3f4e);_0x32839e(_0x3f3f4e);});});}exports[_0x74c8('0x1d')]=function(_0xdaeaf3){var _0x5b13c1=this;return new Promise(function(_0x5f0e4c,_0x1eed2b){return db[_0x74c8('0x1e')][_0x74c8('0x1f')](_0xdaeaf3[_0x74c8('0x20')],{'raw':_0xdaeaf3[_0x74c8('0x21')]?_0xdaeaf3[_0x74c8('0x21')][_0x74c8('0x22')]===undefined?!![]:![]:!![]})[_0x74c8('0x12')](function(_0x2e115e){logger[_0x74c8('0x13')]('CreatePlugin',_0xdaeaf3);logger[_0x74c8('0x16')](_0x74c8('0x1d'),_0xdaeaf3,JSON[_0x74c8('0x17')](_0x2e115e));_0x5f0e4c(_0x2e115e);})['catch'](function(_0x168231){logger[_0x74c8('0x18')](_0x74c8('0x1d'),_0x168231[_0x74c8('0x1a')],_0xdaeaf3);_0x1eed2b(_0x5b13c1['error'](0x1f4,_0x168231[_0x74c8('0x1a')]));});});}; \ No newline at end of file +var _0x3436=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Plugin','create','body','options','raw','debug','CreatePlugin','lodash','util','moment','bluebird'];(function(_0x6dc709,_0x3ea8e7){var _0x22a923=function(_0x10f9ae){while(--_0x10f9ae){_0x6dc709['push'](_0x6dc709['shift']());}};_0x22a923(++_0x3ea8e7);}(_0x3436,0x1b6));var _0x6343=function(_0xe0ff6,_0x457c6e){_0xe0ff6=_0xe0ff6-0x0;var _0x5b8eb2=_0x3436[_0xe0ff6];return _0x5b8eb2;};'use strict';var _=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rs=require(_0x6343('0x4'));var fs=require('fs');var Redis=require(_0x6343('0x5'));var db=require(_0x6343('0x6'))['db'];var utils=require(_0x6343('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6343('0x8'));var jayson=require(_0x6343('0x9'));var client=jayson['client'][_0x6343('0xa')]({'port':0x232a});config[_0x6343('0xb')]=_[_0x6343('0xc')](config[_0x6343('0xb')],{'host':_0x6343('0xd'),'port':0x18eb});var socket=require(_0x6343('0xe'))(new Redis(config[_0x6343('0xb')]));require(_0x6343('0xf'))[_0x6343('0x10')](socket);function respondWithRpcPromise(_0x11060c,_0x20d6af,_0x345832){return new BPromise(function(_0x1a814b,_0x2536be){return client[_0x6343('0x11')](_0x11060c,_0x345832)[_0x6343('0x12')](function(_0x466227){logger[_0x6343('0x13')](_0x6343('0x14'),_0x20d6af,_0x6343('0x15'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x20d6af,_0x6343('0x15'),JSON[_0x6343('0x16')](_0x466227));if(_0x466227['error']){if(_0x466227['error']['code']===0x1f4){logger[_0x6343('0x17')](_0x6343('0x14'),_0x20d6af,_0x466227[_0x6343('0x17')][_0x6343('0x18')]);return _0x2536be(_0x466227[_0x6343('0x17')][_0x6343('0x18')]);}logger[_0x6343('0x17')](_0x6343('0x14'),_0x20d6af,_0x466227[_0x6343('0x17')][_0x6343('0x18')]);return _0x1a814b(_0x466227['error'][_0x6343('0x18')]);}else{logger['info'](_0x6343('0x14'),_0x20d6af,'request\x20sent');_0x1a814b(_0x466227[_0x6343('0x19')][_0x6343('0x18')]);}})[_0x6343('0x1a')](function(_0x355641){logger[_0x6343('0x17')]('Plugin,\x20%s,\x20%s',_0x20d6af,_0x355641);_0x2536be(_0x355641);});});}exports['CreatePlugin']=function(_0x2f7a8c){var _0xeed32a=this;return new Promise(function(_0x3aca0c,_0x3f9b2e){return db[_0x6343('0x1b')][_0x6343('0x1c')](_0x2f7a8c[_0x6343('0x1d')],{'raw':_0x2f7a8c[_0x6343('0x1e')]?_0x2f7a8c[_0x6343('0x1e')][_0x6343('0x1f')]===undefined?!![]:![]:!![]})[_0x6343('0x12')](function(_0x17c991){logger['info']('CreatePlugin',_0x2f7a8c);logger[_0x6343('0x20')]('CreatePlugin',_0x2f7a8c,JSON[_0x6343('0x16')](_0x17c991));_0x3aca0c(_0x17c991);})[_0x6343('0x1a')](function(_0xe5c4d5){logger[_0x6343('0x17')](_0x6343('0x21'),_0xe5c4d5[_0x6343('0x18')],_0x2f7a8c);_0x3f9b2e(_0xeed32a[_0x6343('0x17')](0x1f4,_0xe5c4d5[_0x6343('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9d1aa34..d0d933c 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 _0x312d=['./plugin.events','remove','emit','removeListener','length','plugin:'];(function(_0x551a7b,_0x4389f3){var _0x2bd60f=function(_0x39d826){while(--_0x39d826){_0x551a7b['push'](_0x551a7b['shift']());}};_0x2bd60f(++_0x4389f3);}(_0x312d,0x1bc));var _0xd312=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x312d[_0x4fde08];return _0x12e725;};'use strict';var PluginEvents=require(_0xd312('0x0'));var events=['save',_0xd312('0x1'),'update'];function createListener(_0x18712a,_0x36c2fa){return function(_0x593198){_0x36c2fa[_0xd312('0x2')](_0x18712a,_0x593198);};}function removeListener(_0x30d2c0,_0x546d8c){return function(){PluginEvents[_0xd312('0x3')](_0x30d2c0,_0x546d8c);};}exports['register']=function(_0x3df00c){for(var _0x474172=0x0,_0x4eedfb=events[_0xd312('0x4')];_0x474172<_0x4eedfb;_0x474172++){var _0x14d561=events[_0x474172];var _0x4e5acb=createListener(_0xd312('0x5')+_0x14d561,_0x3df00c);PluginEvents['on'](_0x14d561,_0x4e5acb);}}; \ No newline at end of file +var _0x9f6e=['remove','update','emit','removeListener','register','./plugin.events','save'];(function(_0x47fbe5,_0x1c97bb){var _0x433779=function(_0xad9d27){while(--_0xad9d27){_0x47fbe5['push'](_0x47fbe5['shift']());}};_0x433779(++_0x1c97bb);}(_0x9f6e,0x178));var _0xe9f6=function(_0x1f2818,_0x8226bf){_0x1f2818=_0x1f2818-0x0;var _0x10def=_0x9f6e[_0x1f2818];return _0x10def;};'use strict';var PluginEvents=require(_0xe9f6('0x0'));var events=[_0xe9f6('0x1'),_0xe9f6('0x2'),_0xe9f6('0x3')];function createListener(_0x5e293d,_0x299b17){return function(_0x4a2352){_0x299b17[_0xe9f6('0x4')](_0x5e293d,_0x4a2352);};}function removeListener(_0x5140e1,_0x50a960){return function(){PluginEvents[_0xe9f6('0x5')](_0x5140e1,_0x50a960);};}exports[_0xe9f6('0x6')]=function(_0x3ae7d2){for(var _0x43bdfa=0x0,_0x3d1f87=events['length'];_0x43bdfa<_0x3d1f87;_0x43bdfa++){var _0x4d6b9b=events[_0x43bdfa];var _0x1b37a6=createListener('plugin:'+_0x4d6b9b,_0x3ae7d2);PluginEvents['on'](_0x4d6b9b,_0x1b37a6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4f56108..0995e08 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(_0x55a000,_0xa8aac6){var _0x39dc77=function(_0x4d5bd0){while(--_0x4d5bd0){_0x55a000['push'](_0x55a000['shift']());}};_0x39dc77(++_0xa8aac6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x157be4,_0x13fde1){var _0x46194c=function(_0x193989){while(--_0x193989){_0x157be4['push'](_0x157be4['shift']());}};_0x46194c(++_0x13fde1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 75f8786..f155427 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 _0x54ef=['bluebird','status','error','name','send','npm\x20install','info','index','list','reject','express','motion2','catch','show','describe','params','then','create','script','join','../../files/plugins','body','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','exec'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x54ef,0x112));var _0xf54e=function(_0x40e745,_0x4e1396){_0x40e745=_0x40e745-0x0;var _0x8abaa4=_0x54ef[_0x40e745];return _0x8abaa4;};'use strict';var _=require(_0xf54e('0x0'));var pm2=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var path=require(_0xf54e('0x3'));var exec=require(_0xf54e('0x4'))[_0xf54e('0x5')];var BPromise=require(_0xf54e('0x6'));function handleEntityNotFound(_0x8b6bb6,_0x431e36){return function(_0x12d43f){if(!_0x12d43f){_0x8b6bb6['sendStatus'](0x194);;}return _0x12d43f;};}function respondWithResult(_0x55e611,_0x18e84e){_0x18e84e=_0x18e84e||0xc8;return function(_0x99cf9){if(_0x99cf9){return _0x55e611[_0xf54e('0x7')](_0x18e84e)['json'](_0x99cf9);}return null;};}function handleError(_0x27e69b,_0x57a1ce){_0x57a1ce=_0x57a1ce||0x1f4;return function(_0x40a75d){logger[_0xf54e('0x8')](_0x40a75d['stack']);if(_0x40a75d[_0xf54e('0x9')]){delete _0x40a75d[_0xf54e('0x9')];}_0x27e69b[_0xf54e('0x7')](_0x57a1ce)[_0xf54e('0xa')](_0x40a75d);};}function execChildProcess(){return new BPromise(function(_0x5f232a,_0x558502){exec(_0xf54e('0xb'),function(_0x143d66,_0x326eef,_0x553759){logger[_0xf54e('0xc')](_0x326eef);logger['info'](_0x553759);if(_0x143d66){logger['error'](_0x143d66);return _0x558502(_0x143d66);}return _0x5f232a(_0x326eef);});});}exports[_0xf54e('0xd')]=function(_0x2033e9,_0x28f776){return pm2[_0xf54e('0xe')]()['then'](function(_0x331732){if(_0x331732){var _0x1bbeaa=_[_0xf54e('0xf')](_0x331732,function(_0x15f639){return _0x15f639['name']===_0xf54e('0x10')||_0x15f639[_0xf54e('0x9')]===_0xf54e('0x11');});return{'rows':_0x1bbeaa,'count':_0x1bbeaa['length']};}return null;})['then'](respondWithResult(_0x28f776,null))[_0xf54e('0x12')](handleError(_0x28f776,null));};exports[_0xf54e('0x13')]=function(_0x1c02e7,_0x9647f){return pm2[_0xf54e('0x14')](_0x1c02e7[_0xf54e('0x15')]['id'])[_0xf54e('0x16')](respondWithResult(_0x9647f,null))[_0xf54e('0x16')](handleEntityNotFound(_0x9647f,null))[_0xf54e('0x12')](handleError(_0x9647f,null));};exports[_0xf54e('0x17')]=function(_0x226c96,_0x50fc66){if(_0x226c96['body'][_0xf54e('0x9')]&&_0x226c96['body'][_0xf54e('0x18')]){var _0x1bfe99=path[_0xf54e('0x19')](__dirname,_0xf54e('0x1a'),_0x226c96[_0xf54e('0x1b')][_0xf54e('0x18')]);var _0x388aa0=process[_0xf54e('0x1c')]();process[_0xf54e('0x1d')](path[_0xf54e('0x1e')](_0x1bfe99));return execChildProcess()[_0xf54e('0x16')](function(_0x5b83df){process[_0xf54e('0x1d')](_0x388aa0);return pm2['start']({'name':_0x226c96[_0xf54e('0x1b')][_0xf54e('0x9')],'script':_0x1bfe99});})[_0xf54e('0x16')](function(_0x474b61){pm2[_0xf54e('0x1f')]();return _0x474b61[0x0];})[_0xf54e('0x16')](respondWithResult(_0x50fc66,0xc9))[_0xf54e('0x12')](handleError(_0x50fc66,null));}else{return _0x50fc66[_0xf54e('0x7')](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x20')});}};exports[_0xf54e('0x21')]=function(_0x39c0ae,_0x2ea001){if(_0x39c0ae['body']['id']){delete _0x39c0ae[_0xf54e('0x1b')]['id'];}var _0x4cbf7c={'online':_0xf54e('0x22'),'stopped':'stop'};if(_0x4cbf7c[_0xf54e('0x23')](_0x39c0ae[_0xf54e('0x1b')][_0xf54e('0x7')])){return pm2[_0x4cbf7c[_0x39c0ae[_0xf54e('0x1b')][_0xf54e('0x7')]]](_0x39c0ae[_0xf54e('0x15')]['id'])[_0xf54e('0x16')](respondWithResult(_0x2ea001,0xc8))['catch'](handleError(_0x2ea001,null));}else{return _0x2ea001['status'](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x24')});}};exports[_0xf54e('0x25')]=function(_0x16d00f,_0xb2d4c4){if(_0x16d00f[_0xf54e('0x1b')]['id']){delete _0x16d00f[_0xf54e('0x1b')]['id'];}if(_0x16d00f[_0xf54e('0x15')]['id']){return pm2[_0xf54e('0x26')](_0x16d00f[_0xf54e('0x15')]['id'])['then'](function(_0x5f29d3){pm2[_0xf54e('0x1f')]();return _0x5f29d3[0x0];})[_0xf54e('0x16')](respondWithResult(_0xb2d4c4,null))['catch'](handleError(_0xb2d4c4,null));}else{return _0xb2d4c4[_0xf54e('0x7')](0x1f4)[_0xf54e('0xa')]({'message':_0xf54e('0x27')});}}; \ No newline at end of file +var _0x222f=['dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','describe','params','body','join','../../files/plugins','script','chdir','dirname','start'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x222f,0x1a4));var _0xf222=function(_0x154b4c,_0xa38e2){_0x154b4c=_0x154b4c-0x0;var _0x100586=_0x222f[_0x154b4c];return _0x100586;};'use strict';var _=require(_0xf222('0x0'));var pm2=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var path=require('path');var exec=require('child_process')[_0xf222('0x4')];var BPromise=require(_0xf222('0x5'));function handleEntityNotFound(_0x307791,_0x7b187d){return function(_0x59a619){if(!_0x59a619){_0x307791[_0xf222('0x6')](0x194);;}return _0x59a619;};}function respondWithResult(_0x54a758,_0x112e6d){_0x112e6d=_0x112e6d||0xc8;return function(_0x26f129){if(_0x26f129){return _0x54a758['status'](_0x112e6d)[_0xf222('0x7')](_0x26f129);}return null;};}function handleError(_0x302d7a,_0x4aceb4){_0x4aceb4=_0x4aceb4||0x1f4;return function(_0x31c027){logger[_0xf222('0x8')](_0x31c027[_0xf222('0x9')]);if(_0x31c027[_0xf222('0xa')]){delete _0x31c027[_0xf222('0xa')];}_0x302d7a[_0xf222('0xb')](_0x4aceb4)['send'](_0x31c027);};}function execChildProcess(){return new BPromise(function(_0x2e29ad,_0x405080){exec(_0xf222('0xc'),function(_0x182bc3,_0x48f740,_0x3c9b96){logger[_0xf222('0xd')](_0x48f740);logger[_0xf222('0xd')](_0x3c9b96);if(_0x182bc3){logger[_0xf222('0x8')](_0x182bc3);return _0x405080(_0x182bc3);}return _0x2e29ad(_0x48f740);});});}exports[_0xf222('0xe')]=function(_0x334017,_0x11fca0){return pm2[_0xf222('0xf')]()['then'](function(_0x5b8f97){if(_0x5b8f97){var _0x1feb86=_[_0xf222('0x10')](_0x5b8f97,function(_0x4c2314){return _0x4c2314[_0xf222('0xa')]===_0xf222('0x11')||_0x4c2314[_0xf222('0xa')]===_0xf222('0x12');});return{'rows':_0x1feb86,'count':_0x1feb86[_0xf222('0x13')]};}return null;})[_0xf222('0x14')](respondWithResult(_0x11fca0,null))[_0xf222('0x15')](handleError(_0x11fca0,null));};exports['show']=function(_0x1efa9f,_0x823314){return pm2[_0xf222('0x16')](_0x1efa9f[_0xf222('0x17')]['id'])[_0xf222('0x14')](respondWithResult(_0x823314,null))[_0xf222('0x14')](handleEntityNotFound(_0x823314,null))[_0xf222('0x15')](handleError(_0x823314,null));};exports['create']=function(_0xf26a16,_0x1bdd0a){if(_0xf26a16[_0xf222('0x18')][_0xf222('0xa')]&&_0xf26a16['body']['script']){var _0x398ff4=path[_0xf222('0x19')](__dirname,_0xf222('0x1a'),_0xf26a16[_0xf222('0x18')][_0xf222('0x1b')]);var _0x151a89=process['cwd']();process[_0xf222('0x1c')](path[_0xf222('0x1d')](_0x398ff4));return execChildProcess()[_0xf222('0x14')](function(_0x12d443){process[_0xf222('0x1c')](_0x151a89);return pm2[_0xf222('0x1e')]({'name':_0xf26a16[_0xf222('0x18')][_0xf222('0xa')],'script':_0x398ff4});})['then'](function(_0x145e2e){pm2[_0xf222('0x1f')]();return _0x145e2e[0x0];})[_0xf222('0x14')](respondWithResult(_0x1bdd0a,0xc9))[_0xf222('0x15')](handleError(_0x1bdd0a,null));}else{return _0x1bdd0a[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x21')});}};exports[_0xf222('0x22')]=function(_0x15bf4e,_0x2ec2e9){if(_0x15bf4e[_0xf222('0x18')]['id']){delete _0x15bf4e['body']['id'];}var _0x14b2b1={'online':_0xf222('0x23'),'stopped':_0xf222('0x24')};if(_0x14b2b1[_0xf222('0x25')](_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')])){return pm2[_0x14b2b1[_0x15bf4e[_0xf222('0x18')][_0xf222('0xb')]]](_0x15bf4e[_0xf222('0x17')]['id'])['then'](respondWithResult(_0x2ec2e9,0xc8))[_0xf222('0x15')](handleError(_0x2ec2e9,null));}else{return _0x2ec2e9[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':'Unknown\x20status'});}};exports[_0xf222('0x26')]=function(_0x5d5963,_0x40c7e7){if(_0x5d5963[_0xf222('0x18')]['id']){delete _0x5d5963[_0xf222('0x18')]['id'];}if(_0x5d5963[_0xf222('0x17')]['id']){return pm2[_0xf222('0x27')](_0x5d5963[_0xf222('0x17')]['id'])[_0xf222('0x14')](function(_0x5075ad){pm2['dump']();return _0x5075ad[0x0];})[_0xf222('0x14')](respondWithResult(_0x40c7e7,null))[_0xf222('0x15')](handleError(_0x40c7e7,null));}else{return _0x40c7e7[_0xf222('0xb')](0x1f4)[_0xf222('0x20')]({'message':_0xf222('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f57a59f..b6fcdf9 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 _0x6f92=['get','getAgents','isAuthenticated','getQueues','exports','Router','../../components/auth/service'];(function(_0xc989a3,_0x2ad1b0){var _0x24de1a=function(_0x37ee92){while(--_0x37ee92){_0xc989a3['push'](_0xc989a3['shift']());}};_0x24de1a(++_0x2ad1b0);}(_0x6f92,0xc2));var _0x26f9=function(_0x5d0f98,_0x3f5acf){_0x5d0f98=_0x5d0f98-0x0;var _0x167477=_0x6f92[_0x5d0f98];return _0x167477;};'use strict';var express=require('express');var router=express[_0x26f9('0x0')]();var auth=require(_0x26f9('0x1'));var controller=require('./realtime.controller');router[_0x26f9('0x2')]('/agents',auth['isAuthenticated'](),controller[_0x26f9('0x3')]);router[_0x26f9('0x2')]('/queues',auth[_0x26f9('0x4')](),controller[_0x26f9('0x5')]);module[_0x26f9('0x6')]=router; \ No newline at end of file +var _0x493a=['./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues','express','Router'];(function(_0xc5ce79,_0x5a0841){var _0x484c05=function(_0x3d1785){while(--_0x3d1785){_0xc5ce79['push'](_0xc5ce79['shift']());}};_0x484c05(++_0x5a0841);}(_0x493a,0x11e));var _0xa493=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x493a[_0x4702ee];return _0x62ca7d;};'use strict';var express=require(_0xa493('0x0'));var router=express[_0xa493('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa493('0x2'));router[_0xa493('0x3')](_0xa493('0x4'),auth[_0xa493('0x5')](),controller[_0xa493('0x6')]);router['get']('/queues',auth[_0xa493('0x5')](),controller[_0xa493('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 9288f8c..86e9cea 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 _0x1967=['voicePause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','unknown','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','pauseType','chatPause','whatsappPause','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','faxPause','resolve','User','rawAttributes','type','key','query','role','agent','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','globalStatusFilter','globalStatus','pauseTypeFilter','rows','getQueues','mail','chat','fax','whatsapp','channel','includes','Invalid\x20channel','toLowerCase','Queue','fieldName','QueueCampaigns','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','stack','name','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','catch','voice','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','talking','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','map','get','paused','loggedInDb','waiting','busy','outbound','pick','filter','queue','length','some','connectedlinenum','internal','find','UserId','accountcode','voiceStatus','online','agents','findAll','QueueId','idle','ringing','mailPause','openchannelPause','smsPause'];(function(_0xb5e0f0,_0x153e78){var _0x3651a4=function(_0x54ec4d){while(--_0x54ec4d){_0xb5e0f0['push'](_0xb5e0f0['shift']());}};_0x3651a4(++_0x153e78);}(_0x1967,0x173));var _0x7196=function(_0x414043,_0x92f905){_0x414043=_0x414043-0x0;var _0x363194=_0x1967[_0x414043];return _0x363194;};'use strict';var util=require('util');var _=require(_0x7196('0x0'));var jayson=require(_0x7196('0x1'));var qs=require(_0x7196('0x2'));var logger=require(_0x7196('0x3'))(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var amiClient=jayson[_0x7196('0x6')][_0x7196('0x7')]({'port':0x232a});var routingClient=jayson[_0x7196('0x6')][_0x7196('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x5c128f,_0x36b01e){return function(_0x186175){if(_0x186175){var _0x194746=typeof _0x36b01e[_0x7196('0x8')]===_0x7196('0x9')&&typeof _0x36b01e[_0x7196('0xa')]==='undefined';var _0x218520=_0x186175[_0x7196('0xb')];var _0x3f846e=_0x194746?0x0:_0x36b01e[_0x7196('0x8')];var _0x1e862d=_0x194746?_0x186175['count']:_0x36b01e['offset']+_0x36b01e[_0x7196('0xa')];var _0x10459b;if(_0x1e862d>=_0x218520){_0x1e862d=_0x218520;_0x10459b=0xc8;}else{_0x10459b=0xce;}_0x5c128f[_0x7196('0xc')](_0x10459b);return _0x5c128f[_0x7196('0xd')](_0x7196('0xe'),_0x3f846e+'-'+_0x1e862d+'/'+_0x218520)[_0x7196('0xf')](_0x186175);}return null;};}function handleError(_0x1bf0a5,_0x325641){_0x325641=_0x325641||0x1f4;return function(_0x24f1c3){logger[_0x7196('0x10')](_0x24f1c3[_0x7196('0x11')]);if(_0x24f1c3['name']){delete _0x24f1c3[_0x7196('0x12')];}_0x1bf0a5[_0x7196('0xc')](_0x325641)[_0x7196('0x13')](_0x24f1c3);};}function getRealtimeAgents(){return new Promise(function(_0xf098c1,_0x511aa1){return amiClient[_0x7196('0x14')]('Agents',{})[_0x7196('0x15')](function(_0x2590a6){if(_0x2590a6[_0x7196('0x10')])throw new Error(_0x7196('0x16'));var _0x12dce7=_0x2590a6[_0x7196('0x17')];return routingClient[_0x7196('0x14')](_0x7196('0x18'),{})[_0x7196('0x15')](function(_0x32fe2b){if(_0x32fe2b[_0x7196('0x10')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x4c4f91=_0x32fe2b[_0x7196('0x17')];return _0xf098c1(_[_0x7196('0x19')]({},_0x12dce7,_0x4c4f91));});})[_0x7196('0x1a')](function(_0x517a3e){_0x511aa1(_0x517a3e);});});}function getRealtimeQueues(_0x39b944,_0x539d8b){return new Promise(function(_0x5b25f0,_0x296e07){var _0x627223=_0x539d8b===_0x7196('0x1b')?amiClient:routingClient;return _0x627223['request'](_['startCase'](_0x539d8b)+_0x7196('0x1c'),_0x39b944)[_0x7196('0x15')](function(_0x598a26){if(_0x598a26[_0x7196('0x10')])throw new Error(util[_0x7196('0x1d')](_0x7196('0x1e'),_0x539d8b));return _0x5b25f0(_0x598a26[_0x7196('0x17')]);})[_0x7196('0x1a')](function(_0x549f34){_0x296e07(_0x549f34);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x3f8178,_0x520d01){return amiClient[_0x7196('0x14')](_0x7196('0x1f'),{})[_0x7196('0x15')](function(_0xa69810){if(_0xa69810[_0x7196('0x10')])throw new Error(_0x7196('0x20'));return _0x3f8178(_0xa69810['result']);})['catch'](function(_0x1482e5){_0x520d01(_0x1482e5);});});}function initializeQueues(_0x2d284f,_0x184c09,_0x4e878f,_0x5aa538){var _0x41cfd2=[_0x7196('0x21'),_0x7196('0x22'),'waiting',_0x7196('0x23'),'paused'];if(_0x4e878f===_0x7196('0x1b')&&_0x5aa538==='outbound'){_0x41cfd2[_0x7196('0x24')](_0x7196('0x25'),_0x7196('0x26'),'message',_0x7196('0x27'),_0x7196('0x28'),_0x7196('0x29'),_0x7196('0x2a'),'startProgressive',_0x7196('0x2b'),_0x7196('0x2c'),_0x7196('0x2d'),_0x7196('0x2e'),_0x7196('0x2f'),_0x7196('0x30'),_0x7196('0x31'),_0x7196('0x32'),_0x7196('0x33'),_0x7196('0x34'),_0x7196('0x35'),'predictiveIntervalDroppedCallsCallersExit',_0x7196('0x36'),'predictiveIntervalAvgTalktime');}return _0x2d284f[_0x7196('0x37')](function(_0x4c3365){var _0x372ddc=_0x4c3365[_0x7196('0x38')]({'plain':!![]});_0x372ddc['agents']=[];_0x372ddc[_0x7196('0x39')]=0x0;_0x372ddc[_0x7196('0x3a')]=0x0;_0x372ddc[_0x7196('0x21')]=0x0;_0x372ddc[_0x7196('0x22')]=0x0;_0x372ddc[_0x7196('0x3b')]=0x0;if(_0x4e878f==='voice'){_0x372ddc[_0x7196('0x23')]=0x0;_0x372ddc[_0x7196('0x3c')]=0x0;if(_0x5aa538===_0x7196('0x3d')){_0x372ddc[_0x7196('0x25')]=0x0;_0x372ddc[_0x7196('0x26')]=0x0;}}var _0x123cad=_['find'](_0x184c09,['id',_0x372ddc['id']]);if(_0x123cad)_[_0x7196('0x19')](_0x372ddc,_[_0x7196('0x3e')](_0x123cad,_0x41cfd2));return _0x372ddc;});}function updateAgentVoiceStatus(_0x191df2,_0x4f6b27,_0x33831a){var _0x75530e=_[_0x7196('0x3f')](_0x33831a,[_0x7196('0x40'),_0x4f6b27[_0x7196('0x12')]]);if(_0x75530e[_0x7196('0x41')]===0x0)return _0x191df2[_0x7196('0x3c')]=!![];if(_[_0x7196('0x42')](_0x75530e,[_0x7196('0x43'),_0x191df2[_0x7196('0x44')]['toString']()]))return _0x191df2[_0x7196('0x23')]=!![];if(!_0x191df2[_0x7196('0x23')])return _0x191df2['busy']=!![];}function getVoiceQueueAgents(_0x186efe,_0x54767f,_0x5bd701,_0x301c42){var _0x1a14c6=_['find'](_0x54767f,['id',_0x186efe['id']]);if(!_0x1a14c6)return _0x186efe;return _0x1a14c6['getMembers']({'raw':!![]})[_0x7196('0x15')](function(_0x2a62e8){for(var _0xed32cd=0x0;_0xed32cd<_0x2a62e8['length'];_0xed32cd++){var _0x36a990=_[_0x7196('0x45')](_0x5bd701,['id',_0x2a62e8[_0xed32cd][_0x7196('0x46')]]);if(!_0x36a990){_0x36a990={'id':_0x2a62e8[_0xed32cd][_0x7196('0x46')],'name':_0x2a62e8[_0xed32cd][_0x7196('0x46')],'accountcode':'','online':![]};}var _0x428d76={'id':_0x36a990['id'],'name':_0x36a990[_0x7196('0x12')],'internal':_0x36a990[_0x7196('0x47')],'online':Boolean(_0x36a990['online']),'paused':Boolean(_0x2a62e8[_0xed32cd][_0x7196('0x39')])};if(_0x36a990[_0x7196('0x48')]==='talking')updateAgentVoiceStatus(_0x428d76,_0x186efe,_0x301c42);if(_0x428d76[_0x7196('0x49')])_0x186efe[_0x7196('0x3a')]++;if(_0x428d76['busy'])_0x186efe[_0x7196('0x3c')]++;if(_0x428d76[_0x7196('0x39')]&&!_0x428d76[_0x7196('0x3c')]&&!_0x428d76['talking'])_0x186efe[_0x7196('0x39')]++;_0x186efe[_0x7196('0x4a')]['push'](_0x428d76);}return _0x186efe;});}function getQueueAgents(_0xcd287c,_0x1a7052,_0x4f0c6c){var _0x335e6f='User'+_['startCase'](_0x4f0c6c)+'Queue';var _0x4d3502=_0x4f0c6c+'Pause';return db[_0x335e6f][_0x7196('0x4b')]({'where':{[_['startCase'](_0x4f0c6c)+_0x7196('0x4c')]:_0xcd287c['id']},'raw':!![]})[_0x7196('0x15')](function(_0x780275){for(var _0x6766b8=0x0;_0x6766b8<_0x780275['length'];_0x6766b8++){var _0x3f3171=_['find'](_0x1a7052,['id',_0x780275[_0x6766b8][_0x7196('0x46')]]);if(!_0x3f3171){_0x3f3171={'id':_0x780275[_0x6766b8][_0x7196('0x46')],'name':_0x780275[_0x6766b8][_0x7196('0x46')],'online':![],['pauseField']:![]};}var _0x5e34e8={'id':_0x3f3171['id'],'name':_0x3f3171[_0x7196('0x12')],'online':Boolean(_0x3f3171[_0x7196('0x49')]),'paused':Boolean(_0x3f3171[_0x4d3502])};if(_0x5e34e8[_0x7196('0x49')])_0xcd287c['loggedInDb']++;_0xcd287c['agents'][_0x7196('0x24')](_0x5e34e8);}return _0xcd287c;});}function isIdle(_0x5a7896){return _0x5a7896===_0x7196('0x4d')||_0x5a7896==='unknown'||_0x5a7896==='unavailable'||_0x5a7896===_0x7196('0x4e')||_['isNil'](_0x5a7896);}function isAgentPaused(_0x48f5e7,_0x516825){var _0x2299e2=[_0x48f5e7['chatPause'],_0x48f5e7['faxPause'],_0x48f5e7[_0x7196('0x4f')],_0x48f5e7[_0x7196('0x50')],_0x48f5e7[_0x7196('0x51')],_0x48f5e7[_0x7196('0x52')],_0x48f5e7['whatsappPause']];if(!_0x516825)return _[_0x7196('0x53')](_0x2299e2);var _0x564688=_[_0x7196('0x3f')](_0x2299e2);return _0x564688[_0x7196('0x41')]>0x0&&_0x564688['length']<_0x2299e2[_0x7196('0x41')]?!![]:![];}function isAgentIdle(_0x2fd056){if(_0x2fd056[_0x7196('0x48')]!=='idle'&&_0x2fd056[_0x7196('0x52')]){_0x2fd056['voiceStatus']=_0x7196('0x54');return![];}return _[_0x7196('0x53')]([_0x2fd056[_0x7196('0x55')],_0x2fd056[_0x7196('0x56')],_0x2fd056[_0x7196('0x57')],_0x2fd056[_0x7196('0x58')],_0x2fd056[_0x7196('0x59')],_0x2fd056[_0x7196('0x48')],_0x2fd056['whatsappStatus']],isIdle);}function getAgentStatus(_0x54f39d){var _0x24d81a=_0x7196('0x5a');if(isAgentPaused(_0x54f39d))_0x24d81a=_0x7196('0x54');else if(isAgentPaused(_0x54f39d,!![]))_0x24d81a=_0x7196('0x5b');else if(isAgentIdle(_0x54f39d))_0x24d81a='idle';else _0x24d81a=_0x7196('0x3c');return _0x24d81a;}exports[_0x7196('0x5c')]=function(_0x17cce3,_0x11dc10){var _0x9fcfd4={'count':0x0,'rows':[]},_0x3177c2={},_0x7bc89f,_0x18b49b,_0x1f3c60=[_0x7196('0x5d'),'online',_0x7196('0x5e'),_0x7196('0x5f'),_0x7196('0x60'),'lastPauseAt',_0x7196('0x44'),'address',_0x7196('0x61'),_0x7196('0x50'),_0x7196('0x4f'),_0x7196('0x51'),_0x7196('0x62'),'faxPause',_0x7196('0x52'),'chatCapacity','openchannelCapacity','mailCapacity',_0x7196('0x63'),_0x7196('0x64'),_0x7196('0x65'),_0x7196('0x66'),_0x7196('0x67'),_0x7196('0x68'),_0x7196('0x69'),'whatsappCurrentCapacity',_0x7196('0x6a'),_0x7196('0x55'),_0x7196('0x58'),_0x7196('0x57'),_0x7196('0x59'),'whatsappStatus','faxStatus',_0x7196('0x48'),_0x7196('0x6b'),_0x7196('0x6c'),_0x7196('0x6d'),_0x7196('0x6e'),_0x7196('0x6f'),_0x7196('0x70'),_0x7196('0x71'),_0x7196('0x40'),_0x7196('0x72'),_0x7196('0x73'),'phoneBarEnableScreenRecordingByAgent',_0x7196('0x74'),_0x7196('0x75')],_0x391cd1=[_0x7196('0x61'),_0x7196('0x50'),'mailPause',_0x7196('0x51'),_0x7196('0x62'),_0x7196('0x76'),_0x7196('0x52'),_0x7196('0x49')];Promise[_0x7196('0x77')]()[_0x7196('0x15')](function(){var _0x559b68=_[_0x7196('0x37')](db[_0x7196('0x78')][_0x7196('0x79')],function(_0x3fb671){return{'name':_0x3fb671['fieldName'],'type':_0x3fb671[_0x7196('0x7a')][_0x7196('0x7b')]};});_0x17cce3[_0x7196('0x7c')][_0x7196('0x7d')]=_0x7196('0x7e');_0x17cce3[_0x7196('0x7c')][_0x7196('0x49')]=!![];_0x3177c2=qs['getOptions'](_0x559b68,_0x17cce3);_0x3177c2['raw']=!![];if(_0x17cce3['user'][_0x7196('0x7d')]==='user'){var _0xd94bd1={'params':{'id':_0x17cce3[_0x7196('0x7f')][_0x7196('0x80')]},'query':{'section':_0x7196('0x18'),'role':_0x7196('0x7e'),'online':!![],'nolimit':_0x17cce3[_0x7196('0x7c')][_0x7196('0x81')],'sort':_0x17cce3[_0x7196('0x7c')][_0x7196('0x82')],'filter':_0x17cce3['query']['filter'],'raw':!![]}};return db[_0x7196('0x83')][_0x7196('0x84')](_0xd94bd1);}return db[_0x7196('0x78')][_0x7196('0x85')](_0x3177c2);})[_0x7196('0x15')](function(_0x45e21f){_0x9fcfd4[_0x7196('0xb')]=_0x45e21f[_0x7196('0xb')];_0x7bc89f=_0x45e21f['rows'];return getRealtimeAgents();})['then'](function(_0x1a736a){_0x18b49b=_0x1a736a['rows'];return _0x7bc89f[_0x7196('0x37')](function(_0x52f532){var _0x18efc7=_[_0x7196('0x45')](_0x18b49b,['id',_0x52f532['id']]);if(_0x18efc7)_[_0x7196('0x19')](_0x52f532,_[_0x7196('0x3e')](_['omit'](_0x18efc7,_0x391cd1),_0x1f3c60));_0x52f532['globalStatus']=getAgentStatus(_0x52f532);return _0x52f532;});})[_0x7196('0x15')](function(_0x5328c5){if(_0x17cce3[_0x7196('0x7c')][_0x7196('0x86')]){var _0x4526e8=_[_0x7196('0x3f')](_0x5328c5,[_0x7196('0x87'),_0x17cce3[_0x7196('0x7c')]['globalStatusFilter']]);if(_0x17cce3[_0x7196('0x7c')][_0x7196('0x88')]){_0x4526e8=_[_0x7196('0x3f')](_0x4526e8,[_0x7196('0x60'),_0x17cce3[_0x7196('0x7c')][_0x7196('0x88')]]);}}_0x9fcfd4[_0x7196('0x89')]=_0x4526e8||_0x5328c5;return _0x9fcfd4;})[_0x7196('0x15')](respondWithFilteredResult(_0x11dc10,_0x3177c2))[_0x7196('0x1a')](handleError(_0x11dc10,null));};exports[_0x7196('0x8a')]=function(_0x3d3768,_0x2181f5){var _0x53a6fa=[_0x7196('0x8b'),_0x7196('0x8c'),'sms','openchannel',_0x7196('0x8d'),_0x7196('0x8e'),_0x7196('0x1b')];var _0x5b2c33={'count':0x0,'rows':[]},_0x2fe44c={},_0x550454,_0x218396,_0x19b682,_0x4bcf73,_0x1b3d4a;Promise['resolve']()['then'](function(){if(_0x3d3768[_0x7196('0x7c')][_0x7196('0x8f')]){if(!_[_0x7196('0x90')](_0x53a6fa,_0x3d3768['query'][_0x7196('0x8f')]['toLowerCase']()))throw new Error(_0x7196('0x91'));_0x550454=_0x3d3768[_0x7196('0x7c')][_0x7196('0x8f')][_0x7196('0x92')]();}var _0x2bb345=_['startCase'](_0x550454)+_0x7196('0x93');var _0x13c8c0=_[_0x7196('0x37')](db[_0x2bb345][_0x7196('0x79')],function(_0xc44ef5){return{'name':_0xc44ef5[_0x7196('0x94')],'type':_0xc44ef5[_0x7196('0x7a')][_0x7196('0x7b')]};});_0x2fe44c=qs['getOptions'](_0x13c8c0,_0x3d3768);if(_0x3d3768[_0x7196('0x7f')][_0x7196('0x7d')]===_0x7196('0x7f')){var _0x2b899d={'params':{'id':_0x3d3768['user'][_0x7196('0x80')]},'query':{'section':_0x550454===_0x7196('0x1b')&&_0x3d3768['query'][_0x7196('0x7a')]==='outbound'?_0x7196('0x95'):_['startCase'](_0x550454)+_0x7196('0x1c'),'type':_0x3d3768[_0x7196('0x7c')]['type'],'nolimit':!![],'sort':_0x7196('0x12'),'filter':_0x3d3768[_0x7196('0x7c')][_0x7196('0x3f')]}};return db['UserProfile']['getResources'](_0x2b899d);}return db[_0x2bb345][_0x7196('0x85')](_0x2fe44c);})['then'](function(_0x4d3a21){_0x5b2c33[_0x7196('0xb')]=_0x4d3a21[_0x7196('0xb')];_0x218396=_0x4d3a21[_0x7196('0x89')];return getRealtimeQueues(_0x3d3768,_0x550454);})['then'](function(_0x35c5b3){_0x4bcf73=_0x35c5b3[_0x7196('0x89')];return getRealtimeAgents();})[_0x7196('0x15')](function(_0x175dd8){_0x19b682=_0x175dd8[_0x7196('0x89')];if(_0x550454!=_0x7196('0x1b'))return;return getRealtimeVoiceQueueChannels();})[_0x7196('0x15')](function(_0x8673e){_0x1b3d4a=_0x8673e?_0x8673e[_0x7196('0x89')]:[];return initializeQueues(_0x218396,_0x4bcf73,_0x550454,_0x3d3768[_0x7196('0x7c')][_0x7196('0x7a')]);})['then'](function(_0x5acff1){var _0x32ab6c=_0x5acff1['map'](function(_0x588da9){if(_0x550454===_0x7196('0x1b'))return getVoiceQueueAgents(_0x588da9,_0x218396,_0x19b682,_0x1b3d4a);else return getQueueAgents(_0x588da9,_0x19b682,_0x550454);});return Promise[_0x7196('0x96')](_0x32ab6c);})[_0x7196('0x15')](function(_0x3fe7fd){_0x5b2c33['rows']=_0x3fe7fd;return _0x5b2c33;})['then'](respondWithFilteredResult(_0x2181f5,_0x2fe44c))[_0x7196('0x1a')](handleError(_0x2181f5,null));}; \ No newline at end of file +var _0xf494=['includes','toLowerCase','type','all','util','lodash','jayson/promise','../../config/logger','api','../../mysqldb','client','http','limit','undefined','count','offset','set','error','stack','name','status','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','voice','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','waiting','talking','paused','outbound','push','pTalking','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','loggedInDb','loggedIn','available','busy','originated','find','pick','filter','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','startCase','agents','idle','unknown','unavailable','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','mailStatus','smsStatus','whatsappStatus','getAgents','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','rawAttributes','fieldName','key','role','agent','query','getOptions','raw','user','userProfileId','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','sms','whatsapp','resolve','channel'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xf494,0x1c6));var _0x4f49=function(_0x5c4316,_0x262e12){_0x5c4316=_0x5c4316-0x0;var _0xdfa29b=_0xf494[_0x5c4316];return _0xdfa29b;};'use strict';var util=require(_0x4f49('0x0'));var _=require(_0x4f49('0x1'));var jayson=require(_0x4f49('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x4f49('0x3'))(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var amiClient=jayson[_0x4f49('0x6')][_0x4f49('0x7')]({'port':0x232a});var routingClient=jayson[_0x4f49('0x6')][_0x4f49('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x790e8b,_0xc5e778){return function(_0x413530){if(_0x413530){var _0x42b0e8=typeof _0xc5e778['offset']==='undefined'&&typeof _0xc5e778[_0x4f49('0x8')]===_0x4f49('0x9');var _0x31a725=_0x413530[_0x4f49('0xa')];var _0x185174=_0x42b0e8?0x0:_0xc5e778[_0x4f49('0xb')];var _0x151d8c=_0x42b0e8?_0x413530[_0x4f49('0xa')]:_0xc5e778['offset']+_0xc5e778[_0x4f49('0x8')];var _0x411759;if(_0x151d8c>=_0x31a725){_0x151d8c=_0x31a725;_0x411759=0xc8;}else{_0x411759=0xce;}_0x790e8b['status'](_0x411759);return _0x790e8b[_0x4f49('0xc')]('Content-Range',_0x185174+'-'+_0x151d8c+'/'+_0x31a725)['json'](_0x413530);}return null;};}function handleError(_0x4b9cd3,_0x12527d){_0x12527d=_0x12527d||0x1f4;return function(_0x4bf89f){logger[_0x4f49('0xd')](_0x4bf89f[_0x4f49('0xe')]);if(_0x4bf89f[_0x4f49('0xf')]){delete _0x4bf89f[_0x4f49('0xf')];}_0x4b9cd3[_0x4f49('0x10')](_0x12527d)[_0x4f49('0x11')](_0x4bf89f);};}function getRealtimeAgents(){return new Promise(function(_0xfdb477,_0x5c373e){return amiClient[_0x4f49('0x12')](_0x4f49('0x13'),{})[_0x4f49('0x14')](function(_0x5878f4){if(_0x5878f4['error'])throw new Error(_0x4f49('0x15'));var _0x2ecaaa=_0x5878f4[_0x4f49('0x16')];return routingClient['request'](_0x4f49('0x13'),{})[_0x4f49('0x14')](function(_0x4e85df){if(_0x4e85df['error'])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x560592=_0x4e85df['result'];return _0xfdb477(_[_0x4f49('0x17')]({},_0x2ecaaa,_0x560592));});})[_0x4f49('0x18')](function(_0x1c2d70){_0x5c373e(_0x1c2d70);});});}function getRealtimeQueues(_0x407042,_0x5793ac){return new Promise(function(_0x416893,_0x2aed27){var _0x197a49=_0x5793ac===_0x4f49('0x19')?amiClient:routingClient;return _0x197a49[_0x4f49('0x12')](_['startCase'](_0x5793ac)+_0x4f49('0x1a'),_0x407042)[_0x4f49('0x14')](function(_0x3ae590){if(_0x3ae590['error'])throw new Error(util[_0x4f49('0x1b')](_0x4f49('0x1c'),_0x5793ac));return _0x416893(_0x3ae590[_0x4f49('0x16')]);})[_0x4f49('0x18')](function(_0x9d30aa){_0x2aed27(_0x9d30aa);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x36187b,_0x559d98){return amiClient['request'](_0x4f49('0x1d'),{})[_0x4f49('0x14')](function(_0x4fedbb){if(_0x4fedbb[_0x4f49('0xd')])throw new Error(_0x4f49('0x1e'));return _0x36187b(_0x4fedbb[_0x4f49('0x16')]);})['catch'](function(_0xc54070){_0x559d98(_0xc54070);});});}function initializeQueues(_0x2eed1c,_0x298785,_0x148153,_0xfefbab){var _0x122404=['loggedIn','available',_0x4f49('0x1f'),_0x4f49('0x20'),_0x4f49('0x21')];if(_0x148153==='voice'&&_0xfefbab===_0x4f49('0x22')){_0x122404[_0x4f49('0x23')](_0x4f49('0x24'),'originated','message',_0x4f49('0x25'),_0x4f49('0x26'),_0x4f49('0x27'),'startPredictive',_0x4f49('0x28'),_0x4f49('0x29'),_0x4f49('0x2a'),_0x4f49('0x2b'),_0x4f49('0x2c'),_0x4f49('0x2d'),_0x4f49('0x2e'),_0x4f49('0x2f'),_0x4f49('0x30'),_0x4f49('0x31'),_0x4f49('0x32'),_0x4f49('0x33'),_0x4f49('0x34'),_0x4f49('0x35'),_0x4f49('0x36'));}return _0x2eed1c[_0x4f49('0x37')](function(_0x376a7d){var _0x14ca52=_0x376a7d[_0x4f49('0x38')]({'plain':!![]});_0x14ca52['agents']=[];_0x14ca52[_0x4f49('0x21')]=0x0;_0x14ca52[_0x4f49('0x39')]=0x0;_0x14ca52[_0x4f49('0x3a')]=0x0;_0x14ca52[_0x4f49('0x3b')]=0x0;_0x14ca52[_0x4f49('0x1f')]=0x0;if(_0x148153===_0x4f49('0x19')){_0x14ca52[_0x4f49('0x20')]=0x0;_0x14ca52[_0x4f49('0x3c')]=0x0;if(_0xfefbab===_0x4f49('0x22')){_0x14ca52[_0x4f49('0x24')]=0x0;_0x14ca52[_0x4f49('0x3d')]=0x0;}}var _0x343365=_[_0x4f49('0x3e')](_0x298785,['id',_0x14ca52['id']]);if(_0x343365)_['merge'](_0x14ca52,_[_0x4f49('0x3f')](_0x343365,_0x122404));return _0x14ca52;});}function updateAgentVoiceStatus(_0x27b7a9,_0x36000a,_0x26014f){var _0x1c1e9b=_[_0x4f49('0x40')](_0x26014f,[_0x4f49('0x41'),_0x36000a[_0x4f49('0xf')]]);if(_0x1c1e9b[_0x4f49('0x42')]===0x0)return _0x27b7a9[_0x4f49('0x3c')]=!![];if(_[_0x4f49('0x43')](_0x1c1e9b,[_0x4f49('0x44'),_0x27b7a9[_0x4f49('0x45')][_0x4f49('0x46')]()]))return _0x27b7a9['talking']=!![];if(!_0x27b7a9[_0x4f49('0x20')])return _0x27b7a9[_0x4f49('0x3c')]=!![];}function getVoiceQueueAgents(_0x543605,_0x2b7eed,_0xbf05f3,_0x560938){var _0x29e762=_[_0x4f49('0x3e')](_0x2b7eed,['id',_0x543605['id']]);if(!_0x29e762)return _0x543605;return _0x29e762[_0x4f49('0x47')]({'raw':!![]})[_0x4f49('0x14')](function(_0x3bfe7e){for(var _0x3d5cf2=0x0;_0x3d5cf2<_0x3bfe7e[_0x4f49('0x42')];_0x3d5cf2++){var _0x5d464e=_['find'](_0xbf05f3,['id',_0x3bfe7e[_0x3d5cf2]['UserId']]);if(!_0x5d464e){_0x5d464e={'id':_0x3bfe7e[_0x3d5cf2][_0x4f49('0x48')],'name':_0x3bfe7e[_0x3d5cf2][_0x4f49('0x48')],'accountcode':'','online':![]};}var _0x2e4355={'id':_0x5d464e['id'],'name':_0x5d464e[_0x4f49('0xf')],'internal':_0x5d464e[_0x4f49('0x49')],'online':Boolean(_0x5d464e[_0x4f49('0x4a')]),'paused':Boolean(_0x3bfe7e[_0x3d5cf2][_0x4f49('0x21')])};if(_0x5d464e[_0x4f49('0x4b')]===_0x4f49('0x20'))updateAgentVoiceStatus(_0x2e4355,_0x543605,_0x560938);if(_0x2e4355['online'])_0x543605['loggedInDb']++;if(_0x2e4355[_0x4f49('0x3c')])_0x543605[_0x4f49('0x3c')]++;if(_0x2e4355[_0x4f49('0x21')]&&!_0x2e4355['busy']&&!_0x2e4355[_0x4f49('0x20')])_0x543605['paused']++;_0x543605['agents'][_0x4f49('0x23')](_0x2e4355);}return _0x543605;});}function getQueueAgents(_0x41230e,_0x40eadc,_0x497cb8){var _0x287781=_0x4f49('0x4c')+_['startCase'](_0x497cb8)+_0x4f49('0x4d');var _0x5c7cc7=_0x497cb8+_0x4f49('0x4e');return db[_0x287781][_0x4f49('0x4f')]({'where':{[_[_0x4f49('0x50')](_0x497cb8)+'QueueId']:_0x41230e['id']},'raw':!![]})[_0x4f49('0x14')](function(_0x1e5f0b){for(var _0x33bb04=0x0;_0x33bb04<_0x1e5f0b[_0x4f49('0x42')];_0x33bb04++){var _0x29dfdb=_[_0x4f49('0x3e')](_0x40eadc,['id',_0x1e5f0b[_0x33bb04][_0x4f49('0x48')]]);if(!_0x29dfdb){_0x29dfdb={'id':_0x1e5f0b[_0x33bb04][_0x4f49('0x48')],'name':_0x1e5f0b[_0x33bb04][_0x4f49('0x48')],'online':![],['pauseField']:![]};}var _0x157a55={'id':_0x29dfdb['id'],'name':_0x29dfdb['name'],'online':Boolean(_0x29dfdb[_0x4f49('0x4a')]),'paused':Boolean(_0x29dfdb[_0x5c7cc7])};if(_0x157a55[_0x4f49('0x4a')])_0x41230e['loggedInDb']++;_0x41230e[_0x4f49('0x51')]['push'](_0x157a55);}return _0x41230e;});}function isIdle(_0x132c46){return _0x132c46===_0x4f49('0x52')||_0x132c46===_0x4f49('0x53')||_0x132c46===_0x4f49('0x54')||_0x132c46==='ringing'||_[_0x4f49('0x55')](_0x132c46);}function isAgentPaused(_0x2c426b,_0x37bafa){var _0x973099=[_0x2c426b[_0x4f49('0x56')],_0x2c426b[_0x4f49('0x57')],_0x2c426b[_0x4f49('0x58')],_0x2c426b[_0x4f49('0x59')],_0x2c426b[_0x4f49('0x5a')],_0x2c426b[_0x4f49('0x5b')],_0x2c426b[_0x4f49('0x5c')]];if(!_0x37bafa)return _[_0x4f49('0x5d')](_0x973099);var _0x148031=_[_0x4f49('0x40')](_0x973099);return _0x148031[_0x4f49('0x42')]>0x0&&_0x148031[_0x4f49('0x42')]<_0x973099['length']?!![]:![];}function isAgentIdle(_0x4eadc2){if(_0x4eadc2[_0x4f49('0x4b')]!==_0x4f49('0x52')&&_0x4eadc2[_0x4f49('0x5b')]){_0x4eadc2[_0x4f49('0x4b')]=_0x4f49('0x5e');return![];}return _[_0x4f49('0x5d')]([_0x4eadc2[_0x4f49('0x5f')],_0x4eadc2['faxStatus'],_0x4eadc2[_0x4f49('0x60')],_0x4eadc2['openchannelStatus'],_0x4eadc2[_0x4f49('0x61')],_0x4eadc2[_0x4f49('0x4b')],_0x4eadc2[_0x4f49('0x62')]],isIdle);}function getAgentStatus(_0x1f1c04){var _0x586095=_0x4f49('0x53');if(isAgentPaused(_0x1f1c04))_0x586095='pause';else if(isAgentPaused(_0x1f1c04,!![]))_0x586095='*pause';else if(isAgentIdle(_0x1f1c04))_0x586095=_0x4f49('0x52');else _0x586095=_0x4f49('0x3c');return _0x586095;}exports[_0x4f49('0x63')]=function(_0x26ae33,_0x56375a){var _0x599c51={'count':0x0,'rows':[]},_0xd7f47b={},_0x291a45,_0x5cb187,_0x3941db=['userpic',_0x4f49('0x4a'),'lastLoginAt',_0x4f49('0x64'),'pauseType',_0x4f49('0x64'),_0x4f49('0x45'),_0x4f49('0x65'),_0x4f49('0x56'),_0x4f49('0x59'),_0x4f49('0x58'),_0x4f49('0x5a'),_0x4f49('0x5c'),'faxPause',_0x4f49('0x5b'),'chatCapacity',_0x4f49('0x66'),_0x4f49('0x67'),_0x4f49('0x68'),_0x4f49('0x69'),_0x4f49('0x6a'),_0x4f49('0x6b'),'openchannelCurrentCapacity',_0x4f49('0x6c'),_0x4f49('0x6d'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x4f49('0x5f'),_0x4f49('0x6e'),_0x4f49('0x60'),_0x4f49('0x61'),_0x4f49('0x62'),'faxStatus',_0x4f49('0x4b'),'chatStatusTime',_0x4f49('0x6f'),_0x4f49('0x70'),_0x4f49('0x71'),'whatsappStatusTime',_0x4f49('0x72'),_0x4f49('0x73'),_0x4f49('0x41'),_0x4f49('0x74'),'screenrecording',_0x4f49('0x75'),_0x4f49('0x76'),'routealias'],_0x5b50bc=[_0x4f49('0x56'),_0x4f49('0x59'),_0x4f49('0x58'),_0x4f49('0x5a'),_0x4f49('0x5c'),_0x4f49('0x57'),_0x4f49('0x5b'),_0x4f49('0x4a')];Promise['resolve']()[_0x4f49('0x14')](function(){var _0x3566f2=_[_0x4f49('0x37')](db[_0x4f49('0x4c')][_0x4f49('0x77')],function(_0x26b022){return{'name':_0x26b022[_0x4f49('0x78')],'type':_0x26b022['type'][_0x4f49('0x79')]};});_0x26ae33['query'][_0x4f49('0x7a')]=_0x4f49('0x7b');_0x26ae33[_0x4f49('0x7c')][_0x4f49('0x4a')]=!![];_0xd7f47b=qs[_0x4f49('0x7d')](_0x3566f2,_0x26ae33);_0xd7f47b[_0x4f49('0x7e')]=!![];if(_0x26ae33[_0x4f49('0x7f')][_0x4f49('0x7a')]===_0x4f49('0x7f')){var _0x176a6a={'params':{'id':_0x26ae33['user'][_0x4f49('0x80')]},'query':{'section':_0x4f49('0x13'),'role':_0x4f49('0x7b'),'online':!![],'nolimit':_0x26ae33[_0x4f49('0x7c')]['nolimit'],'sort':_0x26ae33['query'][_0x4f49('0x81')],'filter':_0x26ae33['query'][_0x4f49('0x40')],'raw':!![]}};return db[_0x4f49('0x82')][_0x4f49('0x83')](_0x176a6a);}return db[_0x4f49('0x4c')][_0x4f49('0x84')](_0xd7f47b);})[_0x4f49('0x14')](function(_0x179431){_0x599c51[_0x4f49('0xa')]=_0x179431[_0x4f49('0xa')];_0x291a45=_0x179431[_0x4f49('0x85')];return getRealtimeAgents();})[_0x4f49('0x14')](function(_0x1ba97e){_0x5cb187=_0x1ba97e[_0x4f49('0x85')];return _0x291a45[_0x4f49('0x37')](function(_0x234984){var _0x412d84=_[_0x4f49('0x3e')](_0x5cb187,['id',_0x234984['id']]);if(_0x412d84)_[_0x4f49('0x17')](_0x234984,_[_0x4f49('0x3f')](_[_0x4f49('0x86')](_0x412d84,_0x5b50bc),_0x3941db));_0x234984[_0x4f49('0x87')]=getAgentStatus(_0x234984);return _0x234984;});})[_0x4f49('0x14')](function(_0xf6d04b){if(_0x26ae33[_0x4f49('0x7c')][_0x4f49('0x88')]){var _0x49a79d=_[_0x4f49('0x40')](_0xf6d04b,['globalStatus',_0x26ae33[_0x4f49('0x7c')][_0x4f49('0x88')]]);if(_0x26ae33[_0x4f49('0x7c')][_0x4f49('0x89')]){_0x49a79d=_[_0x4f49('0x40')](_0x49a79d,[_0x4f49('0x8a'),_0x26ae33[_0x4f49('0x7c')][_0x4f49('0x89')]]);}}_0x599c51[_0x4f49('0x85')]=_0x49a79d||_0xf6d04b;return _0x599c51;})['then'](respondWithFilteredResult(_0x56375a,_0xd7f47b))['catch'](handleError(_0x56375a,null));};exports[_0x4f49('0x8b')]=function(_0x592c3c,_0x29b009){var _0x1e6e62=[_0x4f49('0x8c'),_0x4f49('0x8d'),_0x4f49('0x8e'),'openchannel','fax',_0x4f49('0x8f'),_0x4f49('0x19')];var _0x4bdd1b={'count':0x0,'rows':[]},_0x8ba79d={},_0x2dca37,_0x5c824f,_0x24da23,_0x5b88aa,_0x121972;Promise[_0x4f49('0x90')]()['then'](function(){if(_0x592c3c[_0x4f49('0x7c')][_0x4f49('0x91')]){if(!_[_0x4f49('0x92')](_0x1e6e62,_0x592c3c[_0x4f49('0x7c')][_0x4f49('0x91')][_0x4f49('0x93')]()))throw new Error('Invalid\x20channel');_0x2dca37=_0x592c3c[_0x4f49('0x7c')]['channel'][_0x4f49('0x93')]();}var _0x574343=_[_0x4f49('0x50')](_0x2dca37)+'Queue';var _0x29e639=_[_0x4f49('0x37')](db[_0x574343][_0x4f49('0x77')],function(_0x2dbd0f){return{'name':_0x2dbd0f['fieldName'],'type':_0x2dbd0f[_0x4f49('0x94')]['key']};});_0x8ba79d=qs[_0x4f49('0x7d')](_0x29e639,_0x592c3c);if(_0x592c3c['user'][_0x4f49('0x7a')]==='user'){var _0x4938a6={'params':{'id':_0x592c3c[_0x4f49('0x7f')][_0x4f49('0x80')]},'query':{'section':_0x2dca37===_0x4f49('0x19')&&_0x592c3c['query'][_0x4f49('0x94')]===_0x4f49('0x22')?'QueueCampaigns':_['startCase'](_0x2dca37)+'Queues','type':_0x592c3c[_0x4f49('0x7c')][_0x4f49('0x94')],'nolimit':!![],'sort':_0x4f49('0xf'),'filter':_0x592c3c[_0x4f49('0x7c')][_0x4f49('0x40')]}};return db['UserProfile'][_0x4f49('0x83')](_0x4938a6);}return db[_0x574343][_0x4f49('0x84')](_0x8ba79d);})[_0x4f49('0x14')](function(_0x58d07e){_0x4bdd1b[_0x4f49('0xa')]=_0x58d07e[_0x4f49('0xa')];_0x5c824f=_0x58d07e[_0x4f49('0x85')];return getRealtimeQueues(_0x592c3c,_0x2dca37);})[_0x4f49('0x14')](function(_0x5ea6b4){_0x5b88aa=_0x5ea6b4[_0x4f49('0x85')];return getRealtimeAgents();})[_0x4f49('0x14')](function(_0x310480){_0x24da23=_0x310480[_0x4f49('0x85')];if(_0x2dca37!=_0x4f49('0x19'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x2409a8){_0x121972=_0x2409a8?_0x2409a8[_0x4f49('0x85')]:[];return initializeQueues(_0x5c824f,_0x5b88aa,_0x2dca37,_0x592c3c['query'][_0x4f49('0x94')]);})['then'](function(_0x351a33){var _0x4d72a0=_0x351a33[_0x4f49('0x37')](function(_0x2702fb){if(_0x2dca37===_0x4f49('0x19'))return getVoiceQueueAgents(_0x2702fb,_0x5c824f,_0x24da23,_0x121972);else return getQueueAgents(_0x2702fb,_0x24da23,_0x2dca37);});return Promise[_0x4f49('0x95')](_0x4d72a0);})[_0x4f49('0x14')](function(_0x538943){_0x4bdd1b[_0x4f49('0x85')]=_0x538943;return _0x4bdd1b;})[_0x4f49('0x14')](respondWithFilteredResult(_0x29b009,_0x8ba79d))[_0x4f49('0x18')](handleError(_0x29b009,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0567b2e..59bc51a 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(_0x1629a7,_0x57f2d7){var _0xad468e=function(_0x801194){while(--_0x801194){_0x1629a7['push'](_0x1629a7['shift']());}};_0xad468e(++_0x57f2d7);}(_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(_0x3a5c6a,_0x290dd1){var _0x4ac43a=function(_0x368a85){while(--_0x368a85){_0x3a5c6a['push'](_0x3a5c6a['shift']());}};_0x4ac43a(++_0x290dd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index bbcc830..e02be9b 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 _0x25fa=['DATE','sequelize','INTEGER','STRING'];(function(_0xfe4701,_0x243b46){var _0x329972=function(_0x205b52){while(--_0x205b52){_0xfe4701['push'](_0xfe4701['shift']());}};_0x329972(++_0x243b46);}(_0x25fa,0x109));var _0xa25f=function(_0x1726db,_0x437ac3){_0x1726db=_0x1726db-0x0;var _0x560107=_0x25fa[_0x1726db];return _0x560107;};'use strict';var Sequelize=require(_0xa25f('0x0'));module['exports']={'state':{'type':Sequelize[_0xa25f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa25f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xa25f('0x2')]},'starttime':{'type':Sequelize[_0xa25f('0x3')]},'responsetime':{'type':Sequelize[_0xa25f('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa25f('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a83=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x400096,_0x101dc3){var _0x31755a=function(_0x2d29b4){while(--_0x2d29b4){_0x400096['push'](_0x400096['shift']());}};_0x31755a(++_0x101dc3);}(_0x6a83,0xd2));var _0x36a8=function(_0x1aae4e,_0x403b9d){_0x1aae4e=_0x1aae4e-0x0;var _0x56a2d5=_0x6a83[_0x1aae4e];return _0x56a2d5;};'use strict';var Sequelize=require(_0x36a8('0x0'));module[_0x36a8('0x1')]={'state':{'type':Sequelize[_0x36a8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x36a8('0x3')]},'scheduledat':{'type':Sequelize[_0x36a8('0x4')]},'uniqueid':{'type':Sequelize[_0x36a8('0x3')]},'starttime':{'type':Sequelize[_0x36a8('0x4')]},'responsetime':{'type':Sequelize[_0x36a8('0x4')]},'ringtime':{'type':Sequelize[_0x36a8('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x36a8('0x3')]},'campaigntype':{'type':Sequelize[_0x36a8('0x3')]},'membername':{'type':Sequelize[_0x36a8('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index fdd9fb1..eaef937 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 _0xbdff=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2717ef,_0x180027){var _0x5c0b2a=function(_0x1a76c8){while(--_0x1a76c8){_0x2717ef['push'](_0x2717ef['shift']());}};_0x5c0b2a(++_0x180027);}(_0xbdff,0x158));var _0xfbdf=function(_0x10318a,_0x157e24){_0x10318a=_0x10318a-0x0;var _0x1f371b=_0xbdff[_0x10318a];return _0x1f371b;};'use strict';var _=require(_0xfbdf('0x0'));var util=require(_0xfbdf('0x1'));var logger=require('../../config/logger')(_0xfbdf('0x2'));var moment=require('moment');var BPromise=require(_0xfbdf('0x3'));var rp=require(_0xfbdf('0x4'));var fs=require('fs');var path=require(_0xfbdf('0x5'));var rimraf=require(_0xfbdf('0x6'));var config=require(_0xfbdf('0x7'));var attributes=require(_0xfbdf('0x8'));module[_0xfbdf('0x9')]=function(_0x3ae38f,_0x5665ad){return _0x3ae38f[_0xfbdf('0xa')](_0xfbdf('0xb'),attributes,{'tableName':_0xfbdf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59ba=['../../config/environment','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x164727,_0x253185){var _0x4b3e65=function(_0x2d1b5d){while(--_0x2d1b5d){_0x164727['push'](_0x164727['shift']());}};_0x4b3e65(++_0x253185);}(_0x59ba,0x12e));var _0xa59b=function(_0x324c8f,_0x1dfacd){_0x324c8f=_0x324c8f-0x0;var _0x44f071=_0x59ba[_0x324c8f];return _0x44f071;};'use strict';var _=require(_0xa59b('0x0'));var util=require(_0xa59b('0x1'));var logger=require(_0xa59b('0x2'))(_0xa59b('0x3'));var moment=require(_0xa59b('0x4'));var BPromise=require(_0xa59b('0x5'));var rp=require(_0xa59b('0x6'));var fs=require('fs');var path=require(_0xa59b('0x7'));var rimraf=require('rimraf');var config=require(_0xa59b('0x8'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0xc97f58,_0x28449b){return _0xc97f58[_0xa59b('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c146dd5..9c945f9 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 _0xf0a4=['stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x394873,_0x5bc8a9){var _0x550585=function(_0x10882c){while(--_0x10882c){_0x394873['push'](_0x394873['shift']());}};_0x550585(++_0x5bc8a9);}(_0xf0a4,0x167));var _0x4f0a=function(_0x4619c8,_0x2ea2a2){_0x4619c8=_0x4619c8-0x0;var _0x454bfe=_0xf0a4[_0x4619c8];return _0x454bfe;};'use strict';var _=require(_0x4f0a('0x0'));var util=require(_0x4f0a('0x1'));var moment=require(_0x4f0a('0x2'));var BPromise=require(_0x4f0a('0x3'));var rs=require(_0x4f0a('0x4'));var fs=require('fs');var Redis=require(_0x4f0a('0x5'));var db=require(_0x4f0a('0x6'))['db'];var utils=require(_0x4f0a('0x7'));var logger=require('../../config/logger')(_0x4f0a('0x8'));var config=require(_0x4f0a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4f0a('0xa')][_0x4f0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x167291,_0x1d66c7,_0x5f5ab5){return new BPromise(function(_0x1e79dd,_0x404128){return client[_0x4f0a('0xc')](_0x167291,_0x5f5ab5)[_0x4f0a('0xd')](function(_0x3adcd6){logger[_0x4f0a('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d66c7,_0x4f0a('0xf'));logger[_0x4f0a('0x10')](_0x4f0a('0x11'),_0x1d66c7,_0x4f0a('0xf'),JSON[_0x4f0a('0x12')](_0x3adcd6));if(_0x3adcd6[_0x4f0a('0x13')]){if(_0x3adcd6[_0x4f0a('0x13')]['code']===0x1f4){logger['error'](_0x4f0a('0x14'),_0x1d66c7,_0x3adcd6[_0x4f0a('0x13')][_0x4f0a('0x15')]);return _0x404128(_0x3adcd6[_0x4f0a('0x13')][_0x4f0a('0x15')]);}logger[_0x4f0a('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d66c7,_0x3adcd6['error'][_0x4f0a('0x15')]);return _0x1e79dd(_0x3adcd6[_0x4f0a('0x13')][_0x4f0a('0x15')]);}else{logger[_0x4f0a('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d66c7,_0x4f0a('0xf'));_0x1e79dd(_0x3adcd6['result'][_0x4f0a('0x15')]);}})[_0x4f0a('0x16')](function(_0x577599){logger[_0x4f0a('0x13')](_0x4f0a('0x14'),_0x1d66c7,_0x577599);_0x404128(_0x577599);});});}exports[_0x4f0a('0x17')]=function(_0x57183a){var _0xd6e91a=this;return new Promise(function(_0x3bca16,_0x5da5c2){return db[_0x4f0a('0x18')][_0x4f0a('0x19')](_0x57183a[_0x4f0a('0x1a')],{'raw':_0x57183a[_0x4f0a('0x1b')]?_0x57183a['options'][_0x4f0a('0x1c')]===undefined?!![]:![]:!![]})[_0x4f0a('0xd')](function(_0x4382de){logger[_0x4f0a('0xe')](_0x4f0a('0x17'),_0x57183a);logger[_0x4f0a('0x10')]('CreateReportAgentPreview',_0x57183a,JSON['stringify'](_0x4382de));_0x3bca16(_0x4382de);})[_0x4f0a('0x16')](function(_0xca677d){logger[_0x4f0a('0x13')](_0x4f0a('0x17'),_0xca677d[_0x4f0a('0x15')],_0x57183a);_0x5da5c2(_0xd6e91a[_0x4f0a('0x13')](0x1f4,_0xca677d['message']));});});}; \ No newline at end of file +var _0x97f7=['info','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x4cb3bc,_0x4759bf){var _0x160e55=function(_0x4b7018){while(--_0x4b7018){_0x4cb3bc['push'](_0x4cb3bc['shift']());}};_0x160e55(++_0x4759bf);}(_0x97f7,0x10f));var _0x797f=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x97f7[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x797f('0x0'));var util=require(_0x797f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x797f('0x2'));var db=require(_0x797f('0x3'))['db'];var utils=require(_0x797f('0x4'));var logger=require(_0x797f('0x5'))(_0x797f('0x6'));var config=require(_0x797f('0x7'));var jayson=require(_0x797f('0x8'));var client=jayson[_0x797f('0x9')][_0x797f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24742a,_0x2c05d1,_0x41caee){return new BPromise(function(_0x1dbb36,_0x32e1f3){return client[_0x797f('0xb')](_0x24742a,_0x41caee)[_0x797f('0xc')](function(_0x23f2d1){logger['info'](_0x797f('0xd'),_0x2c05d1,_0x797f('0xe'));logger[_0x797f('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2c05d1,_0x797f('0xe'),JSON['stringify'](_0x23f2d1));if(_0x23f2d1[_0x797f('0x10')]){if(_0x23f2d1[_0x797f('0x10')][_0x797f('0x11')]===0x1f4){logger[_0x797f('0x10')](_0x797f('0xd'),_0x2c05d1,_0x23f2d1[_0x797f('0x10')]['message']);return _0x32e1f3(_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);}logger['error'](_0x797f('0xd'),_0x2c05d1,_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);return _0x1dbb36(_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);}else{logger[_0x797f('0x13')](_0x797f('0xd'),_0x2c05d1,_0x797f('0xe'));_0x1dbb36(_0x23f2d1[_0x797f('0x14')][_0x797f('0x12')]);}})[_0x797f('0x15')](function(_0x3a48d2){logger[_0x797f('0x10')](_0x797f('0xd'),_0x2c05d1,_0x3a48d2);_0x32e1f3(_0x3a48d2);});});}exports['CreateReportAgentPreview']=function(_0x164fe7){var _0x1c04f5=this;return new Promise(function(_0x430819,_0x578cac){return db[_0x797f('0x16')][_0x797f('0x17')](_0x164fe7[_0x797f('0x18')],{'raw':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1a')]===undefined?!![]:![]:!![]})[_0x797f('0xc')](function(_0x2203b0){logger[_0x797f('0x13')](_0x797f('0x1b'),_0x164fe7);logger[_0x797f('0xf')](_0x797f('0x1b'),_0x164fe7,JSON[_0x797f('0x1c')](_0x2203b0));_0x430819(_0x2203b0);})[_0x797f('0x15')](function(_0x59af4a){logger['error'](_0x797f('0x1b'),_0x59af4a[_0x797f('0x12')],_0x164fe7);_0x578cac(_0x1c04f5[_0x797f('0x10')](0x1f4,_0x59af4a['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1048163..06b924d 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 _0xe238=['/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','openchannel'];(function(_0x1f2dea,_0x33fbbb){var _0x19eb60=function(_0x354d57){while(--_0x354d57){_0x1f2dea['push'](_0x1f2dea['shift']());}};_0x19eb60(++_0x33fbbb);}(_0xe238,0x18d));var _0x8e23=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe238[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x8e23('0x0'));var util=require(_0x8e23('0x1'));var path=require(_0x8e23('0x2'));var express=require(_0x8e23('0x3'));var router=express[_0x8e23('0x4')]();var auth=require(_0x8e23('0x5'));var controller=require('./rpc.controller');router[_0x8e23('0x6')](_0x8e23('0x7'),auth['isAuthenticated'](),controller[_0x8e23('0x8')]);router[_0x8e23('0x6')](_0x8e23('0x9'),auth[_0x8e23('0xa')](),controller['voiceChannelMixMonitor']);router[_0x8e23('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x8e23('0xb')]);router['get'](_0x8e23('0xc'),auth[_0x8e23('0xa')](),controller[_0x8e23('0xd')]);router[_0x8e23('0x6')](_0x8e23('0xe'),auth['isAuthenticated'](),controller[_0x8e23('0xf')]);router[_0x8e23('0x6')](_0x8e23('0x10'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x11')]);router[_0x8e23('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x8e23('0x12')]);router[_0x8e23('0x6')]('/openchannel/queues',auth[_0x8e23('0xa')](),controller['openchannelQueues']);router['get'](_0x8e23('0x13'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x14')]);router[_0x8e23('0x6')](_0x8e23('0x15'),auth['isAuthenticated'](),controller[_0x8e23('0x16')]);router[_0x8e23('0x6')]('/fax/queues',auth[_0x8e23('0xa')](),controller[_0x8e23('0x17')]);router['get'](_0x8e23('0x18'),auth['isAuthenticated'](),controller[_0x8e23('0x19')]);router[_0x8e23('0x6')](_0x8e23('0x1a'),auth['isAuthenticated'](),controller[_0x8e23('0x1b')]);router[_0x8e23('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x8e23('0x1c')]);router[_0x8e23('0x6')](_0x8e23('0x1d'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x1e')]);router[_0x8e23('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x8e23('0x6')]('/voice/queues/:id',auth[_0x8e23('0xa')](),controller[_0x8e23('0x1f')]);router[_0x8e23('0x20')](_0x8e23('0x21'),auth[_0x8e23('0xa')](),controller['updateVoiceQueue']);router[_0x8e23('0x6')](_0x8e23('0x22'),auth['isAuthenticated'](),controller[_0x8e23('0x23')]);router['get'](_0x8e23('0x24'),auth['isAuthenticated'](),controller[_0x8e23('0x25')]);router[_0x8e23('0x6')](_0x8e23('0x26'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x27')]);router[_0x8e23('0x20')](_0x8e23('0x28'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x29')]);router[_0x8e23('0x6')]('/telephones',auth['isAuthenticated'](),controller[_0x8e23('0x2a')]);router[_0x8e23('0x6')](_0x8e23('0x2b'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x2c')]);router[_0x8e23('0x6')](_0x8e23('0x2d'),auth[_0x8e23('0xa')](),controller['campaigns']);router['get'](_0x8e23('0x2e'),auth[_0x8e23('0xa')](),controller['faxAccounts']);router['get'](_0x8e23('0x2f'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x30')]);router[_0x8e23('0x6')](_0x8e23('0x31'),auth['isAuthenticated'](),controller[_0x8e23('0x32')]);router[_0x8e23('0x6')](_0x8e23('0x33'),auth[_0x8e23('0xa')](),controller['openchannelQueuesWaitingInteractions']);router[_0x8e23('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x8e23('0xa')](),controller[_0x8e23('0x34')]);router[_0x8e23('0x6')]('/sms/queues/waitinginteractions',auth[_0x8e23('0xa')](),controller[_0x8e23('0x35')]);router[_0x8e23('0x6')](_0x8e23('0x36'),auth[_0x8e23('0xa')](),controller['whatsappQueuesWaitingInteractions']);router[_0x8e23('0x6')](_0x8e23('0x37'),auth['isAuthenticated'](),controller[_0x8e23('0x38')]);router['post'](_0x8e23('0x39'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x3a')](_0x8e23('0x3b')));router['get'](_0x8e23('0x3c'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x3d')]);router[_0x8e23('0x3e')](_0x8e23('0x3f'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x3a')](_0x8e23('0x40')));router[_0x8e23('0x6')](_0x8e23('0x41'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x42')]);router[_0x8e23('0x3e')](_0x8e23('0x43'),auth['isAuthenticated'](),controller[_0x8e23('0x3a')](_0x8e23('0x44')));router[_0x8e23('0x6')](_0x8e23('0x45'),auth[_0x8e23('0xa')](),controller['showFaxQueues']);router[_0x8e23('0x3e')]('/openchannel/queues/:id/notify',auth[_0x8e23('0xa')](),controller[_0x8e23('0x3a')](_0x8e23('0x46')));router[_0x8e23('0x6')](_0x8e23('0x47'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x48')]);router[_0x8e23('0x3e')](_0x8e23('0x49'),auth[_0x8e23('0xa')](),controller[_0x8e23('0x3a')]('sms'));router[_0x8e23('0x3e')](_0x8e23('0x4a'),auth[_0x8e23('0xa')](),controller['queueNotify']('whatsapp'));router['get']('/sms/queues/:id',auth[_0x8e23('0xa')](),controller[_0x8e23('0x4b')]);router[_0x8e23('0x6')](_0x8e23('0x4c'),auth[_0x8e23('0xa')](),controller['showWhatsappQueues']);router[_0x8e23('0x3e')](_0x8e23('0x4d'),auth[_0x8e23('0xa')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xe8dd=['./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','util','Router'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe8dd,0x146));var _0xde8d=function(_0x8ee9cb,_0x404f2a){_0x8ee9cb=_0x8ee9cb-0x0;var _0x438b6c=_0xe8dd[_0x8ee9cb];return _0x438b6c;};'use strict';var multer=require('multer');var util=require(_0xde8d('0x0'));var path=require('path');var express=require('express');var router=express[_0xde8d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xde8d('0x2'));router[_0xde8d('0x3')]('/voice/channels',auth['isAuthenticated'](),controller[_0xde8d('0x4')]);router[_0xde8d('0x3')](_0xde8d('0x5'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x7')]);router[_0xde8d('0x3')](_0xde8d('0x8'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x9')]);router['get'](_0xde8d('0xa'),auth['isAuthenticated'](),controller[_0xde8d('0xb')]);router[_0xde8d('0x3')](_0xde8d('0xc'),auth[_0xde8d('0x6')](),controller['chatQueues']);router[_0xde8d('0x3')](_0xde8d('0xd'),auth[_0xde8d('0x6')](),controller['mailQueues']);router['get'](_0xde8d('0xe'),auth[_0xde8d('0x6')](),controller['mailAccounts']);router[_0xde8d('0x3')](_0xde8d('0xf'),auth[_0xde8d('0x6')](),controller['openchannelQueues']);router['get'](_0xde8d('0x10'),auth[_0xde8d('0x6')](),controller['smsQueues']);router[_0xde8d('0x3')](_0xde8d('0x11'),auth['isAuthenticated'](),controller[_0xde8d('0x12')]);router['get'](_0xde8d('0x13'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x14')]);router[_0xde8d('0x3')]('/voice/queues/preview/:id',auth[_0xde8d('0x6')](),controller[_0xde8d('0x15')]);router['get'](_0xde8d('0x16'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x17')]);router[_0xde8d('0x3')](_0xde8d('0x18'),auth[_0xde8d('0x6')](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xde8d('0x6')](),controller[_0xde8d('0x19')]);router[_0xde8d('0x3')](_0xde8d('0x1a'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x1b')]);router['get'](_0xde8d('0x1c'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x1d')]);router[_0xde8d('0x1e')](_0xde8d('0x1c'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x1f')]);router['get'](_0xde8d('0x20'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x21')]);router[_0xde8d('0x3')](_0xde8d('0x22'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x23')]);router[_0xde8d('0x3')](_0xde8d('0x24'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x25')]);router['put'](_0xde8d('0x26'),auth['isAuthenticated'](),controller[_0xde8d('0x27')]);router[_0xde8d('0x3')](_0xde8d('0x28'),auth[_0xde8d('0x6')](),controller['telephones']);router[_0xde8d('0x3')](_0xde8d('0x29'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x2a')]);router[_0xde8d('0x3')](_0xde8d('0x2b'),auth[_0xde8d('0x6')](),controller['campaigns']);router['get'](_0xde8d('0x2c'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x2d')]);router['get']('/chat/queues/waitinginteractions',auth[_0xde8d('0x6')](),controller[_0xde8d('0x2e')]);router[_0xde8d('0x3')](_0xde8d('0x2f'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x30')]);router[_0xde8d('0x3')](_0xde8d('0x31'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x32')]);router[_0xde8d('0x3')](_0xde8d('0x33'),auth['isAuthenticated'](),controller[_0xde8d('0x34')]);router['get'](_0xde8d('0x35'),auth[_0xde8d('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0xde8d('0x3')](_0xde8d('0x36'),auth[_0xde8d('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0xde8d('0x3')](_0xde8d('0x37'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x38')]);router[_0xde8d('0x39')](_0xde8d('0x3a'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x3b')](_0xde8d('0x3c')));router[_0xde8d('0x3')](_0xde8d('0x3d'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x3e')]);router[_0xde8d('0x39')](_0xde8d('0x3f'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x3b')](_0xde8d('0x40')));router[_0xde8d('0x3')](_0xde8d('0x41'),auth[_0xde8d('0x6')](),controller['showChatQueues']);router[_0xde8d('0x39')](_0xde8d('0x42'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x3b')](_0xde8d('0x43')));router[_0xde8d('0x3')](_0xde8d('0x44'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x45')]);router[_0xde8d('0x39')](_0xde8d('0x46'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x3b')](_0xde8d('0x47')));router[_0xde8d('0x3')](_0xde8d('0x48'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x49')]);router['post']('/sms/queues/:id/notify',auth[_0xde8d('0x6')](),controller[_0xde8d('0x3b')](_0xde8d('0x4a')));router[_0xde8d('0x39')]('/whatsapp/queues/:id/notify',auth[_0xde8d('0x6')](),controller[_0xde8d('0x3b')](_0xde8d('0x4b')));router[_0xde8d('0x3')](_0xde8d('0x4c'),auth['isAuthenticated'](),controller[_0xde8d('0x4d')]);router[_0xde8d('0x3')](_0xde8d('0x4e'),auth[_0xde8d('0x6')](),controller[_0xde8d('0x4f')]);router[_0xde8d('0x39')](_0xde8d('0x50'),auth[_0xde8d('0x6')](),controller['agentNotify']);module[_0xde8d('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e68d614..ad9c718 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 _0x814b=['whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','create','Start','queue','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','voiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues'];(function(_0x4c7a40,_0x4a80ff){var _0x5f3d9b=function(_0x11a907){while(--_0x11a907){_0x4c7a40['push'](_0x4c7a40['shift']());}};_0x5f3d9b(++_0x4a80ff);}(_0x814b,0x1a2));var _0xb814=function(_0x5c0a22,_0x3e0eb3){_0x5c0a22=_0x5c0a22-0x0;var _0x292d8e=_0x814b[_0x5c0a22];return _0x292d8e;};'use strict';var BPromise=require(_0xb814('0x0'));var moment=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var db=require(_0xb814('0x4'))['db'];var logger=require(_0xb814('0x5'))('api');var jayson=require(_0xb814('0x6'));var amiClient=jayson[_0xb814('0x7')][_0xb814('0x8')]({'port':0x232a});var mailClient=jayson[_0xb814('0x7')][_0xb814('0x8')]({'port':0x232b});var routingClient=jayson[_0xb814('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){var _0x186d5a=_0x5c8539?_0x5c8539:amiClient;return _0x186d5a[_0xb814('0x9')](_0x3b0829,_0x2e6272)[_0xb814('0xa')](function(_0x21d4a5){if(_0x21d4a5[_0xb814('0xb')]){if(_0x21d4a5[_0xb814('0xb')][_0xb814('0xc')]===0x1f4){return _0x2913a6(_0x21d4a5[_0xb814('0xb')][_0xb814('0xd')]);}return _0x271af9(_0x21d4a5['error'][_0xb814('0xd')]);}else{_0x271af9(_0x21d4a5['result']);}})[_0xb814('0xe')](function(_0x15d6ef){_0x2913a6(_0x15d6ef);});});}function respondWithResult(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xc8;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0xf')](_0x2cc46b)[_0xb814('0x10')](_0x2ce718);}return _0x35b10d[_0xb814('0x11')](0x194);};}function handleError(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0x1f4;return function(_0x3f4881){logger[_0xb814('0xb')](_0x3f4881[_0xb814('0x12')]);if(_0x3f4881[_0xb814('0x13')]){delete _0x3f4881[_0xb814('0x13')];}_0xa0a2e5[_0xb814('0xf')](_0x2ab627)[_0xb814('0x14')](_0x3f4881);};}function findById(_0x265a83){return function(_0x125ce2){if(!_[_0xb814('0x15')](_0x265a83)&&!_[_0xb814('0x15')](_0x125ce2)&&!_['isNil'](_0x125ce2[_0xb814('0x16')])){return _['find'](_0x125ce2[_0xb814('0x16')],function(_0xfac75b){return _0xfac75b['id']==_0x265a83;});}return null;};}exports['voiceChannels']=function(_0x4b55a7,_0x55d63c){return respondWithRpcPromise(_0xb814('0x17'),_0x4b55a7['query'])['then'](respondWithResult(_0x55d63c,null))[_0xb814('0xe')](handleError(_0x55d63c,null));};exports[_0xb814('0x18')]=function(_0x25b6b6,_0x4e139e){return respondWithRpcPromise(_0xb814('0x19'),_['merge'](_0x25b6b6[_0xb814('0x1a')],_0x25b6b6[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4e139e,null))[_0xb814('0xe')](handleError(_0x4e139e,null));};exports[_0xb814('0x1c')]=function(_0x2bd039,_0x1f5d40){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xb814('0x1d')](_0x2bd039['query'],_0x2bd039[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x1f5d40,null))[_0xb814('0xe')](handleError(_0x1f5d40,null));};exports[_0xb814('0x1e')]=function(_0x1c8a2e,_0xb9e57d){return respondWithRpcPromise(_0xb814('0x1f'),_0x1c8a2e['query'])[_0xb814('0xa')](respondWithResult(_0xb9e57d,null))[_0xb814('0xe')](handleError(_0xb9e57d,null));};exports[_0xb814('0x20')]=function(_0x349394,_0x32ed56){return respondWithRpcPromise(_0xb814('0x1f'),_0x349394[_0xb814('0x1a')])[_0xb814('0xa')](findById(_0x349394['params']['id']))[_0xb814('0xa')](respondWithResult(_0x32ed56,null))[_0xb814('0xe')](handleError(_0x32ed56,null));};exports['updateVoiceQueue']=function(_0x9008b2,_0x37d24d){return respondWithRpcPromise(_0xb814('0x21'),_['merge'](_0x9008b2[_0xb814('0x22')],_0x9008b2[_0xb814('0x1b')]))['then'](respondWithResult(_0x37d24d,null))[_0xb814('0xe')](handleError(_0x37d24d,null));};exports['voiceQueuesPreview']=function(_0x6efe9a,_0x5f3e9b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xb814('0x1d')](_0x6efe9a['query'],_0x6efe9a[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x5f3e9b,null))[_0xb814('0xe')](handleError(_0x5f3e9b,null));};exports['voiceQueuesChannels']=function(_0x51d5ae,_0x26d3a9){return respondWithRpcPromise(_0xb814('0x23'),_0x51d5ae['query'])[_0xb814('0xa')](respondWithResult(_0x26d3a9,null))[_0xb814('0xe')](handleError(_0x26d3a9,null));};exports[_0xb814('0x24')]=function(_0x217b7e,_0x1b78de){return respondWithRpcPromise(_0xb814('0x25'),_[_0xb814('0x1d')](_0x217b7e['query'],_0x217b7e[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x1b78de,null))[_0xb814('0xe')](handleError(_0x1b78de,null));};exports[_0xb814('0x26')]=function(_0x14100d,_0x4ff31a){return respondWithRpcPromise(_0xb814('0x27'),_['merge'](_0x14100d[_0xb814('0x1a')],_0x14100d[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4ff31a,null))['catch'](handleError(_0x4ff31a,null));};exports[_0xb814('0x28')]=function(_0xbdb3e9,_0x4ea6f8){return respondWithRpcPromise(_0xb814('0x29'),_[_0xb814('0x1d')](_0xbdb3e9[_0xb814('0x1a')],_0xbdb3e9[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4ea6f8,null))[_0xb814('0xe')](handleError(_0x4ea6f8,null));};exports['outbound']=function(_0xa6ce87,_0x4e4684){return respondWithRpcPromise(_0xb814('0x2a'),_0xa6ce87['query'])[_0xb814('0xa')](respondWithResult(_0x4e4684,null))['catch'](handleError(_0x4e4684,null));};exports[_0xb814('0x2b')]=function(_0x26675a,_0x54a7fb){return respondWithRpcPromise('OutboundChannels',_0x26675a['query'])['then'](respondWithResult(_0x54a7fb,null))[_0xb814('0xe')](handleError(_0x54a7fb,null));};exports[_0xb814('0x2c')]=function(_0x38cdc2,_0x42c2ed){var _0x51cdba;return respondWithRpcPromise('Agents',_0x38cdc2[_0xb814('0x1a')])['then'](function(_0x2a93da){_0x51cdba=_0x2a93da;return respondWithRpcPromise(_0xb814('0x2d'),_0x38cdc2[_0xb814('0x1a')],routingClient);})[_0xb814('0xa')](function(_0x42653f){return _[_0xb814('0x1d')]({},_0x42653f,_0x51cdba);})[_0xb814('0xa')](respondWithResult(_0x42c2ed,null))[_0xb814('0xe')](handleError(_0x42c2ed,null));};exports[_0xb814('0x2e')]=function(_0x4b6ff8,_0x544d36){if(_0x4b6ff8['body']&&_0x4b6ff8[_0xb814('0x22')]['interaction']&&_0x4b6ff8[_0xb814('0x2f')]&&_0x4b6ff8['user'][_0xb814('0x13')]){for(var _0x44ff56 in _0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')]){if(_0x4b6ff8['body'][_0xb814('0x30')][_0xb814('0x31')](_0x44ff56)){db[_0xb814('0x32')][_0xb814('0x33')]({'where':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56]&&_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56][_0xb814('0x34')]?{'$notIn':_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56]}:{'$ne':null}}})['then'](function(_0x4a5e84){var _0xe751c3=moment()[_0xb814('0x35')](_0xb814('0x36'));for(var _0x2bf906=0x0,_0x43f1b=_0x4a5e84[_0xb814('0x34')];_0x2bf906<_0x43f1b;_0x2bf906+=0x1){_0x4a5e84[_0x2bf906][_0xb814('0x37')]({'exitAt':_0xe751c3});}});for(var _0x40af85=0x0;_0x40af85<_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56][_0xb814('0x34')];_0x40af85+=0x1){db['MemberReport'][_0xb814('0x38')]({'where':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')]['name'],'type':_0xb814('0x39'),'uniqueid':_0x4b6ff8['body'][_0xb814('0x30')][_0x44ff56][_0x40af85],'exitAt':null},'defaults':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')],'interface':_[_0xb814('0x15')](_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x3a')])?util[_0xb814('0x35')](_0xb814('0x3b'),_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')]):_0x4b6ff8['user']['interface'],'type':_0xb814('0x39'),'enterAt':moment()[_0xb814('0x35')](_0xb814('0x36')),'role':_0xb814('0x3c'),'internal':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x3d')],'uniqueid':_0x4b6ff8[_0xb814('0x22')]['interaction'][_0x44ff56][_0x40af85]}});}}}}return respondWithRpcPromise(_0xb814('0x3e'),{'id':_0x4b6ff8[_0xb814('0x1b')]['id'],'capacity':_0x4b6ff8[_0xb814('0x22')]['capacity']},routingClient)[_0xb814('0xa')](respondWithResult(_0x544d36,null))['catch'](handleError(_0x544d36,null));};exports[_0xb814('0x3f')]=function(_0x5dc28e,_0x403872){return respondWithRpcPromise(_0xb814('0x40'),_0x5dc28e['query'])[_0xb814('0xa')](respondWithResult(_0x403872,null))[_0xb814('0xe')](handleError(_0x403872,null));};exports[_0xb814('0x41')]=function(_0x5209d1,_0x3da050){return respondWithRpcPromise('Trunks',_0x5209d1[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0x3da050,null))['catch'](handleError(_0x3da050,null));};exports[_0xb814('0x42')]=function(_0x4a3f84,_0x539be7){return respondWithRpcPromise(_0xb814('0x43'),_0x4a3f84[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0x539be7,null))['catch'](handleError(_0x539be7,null));};exports[_0xb814('0x44')]=function(_0x538b0f,_0xf88d23){return respondWithRpcPromise(_0xb814('0x45'),_0x538b0f['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0xf88d23,null))['catch'](handleError(_0xf88d23,null));};exports[_0xb814('0x46')]=function(_0x1656ed,_0xb2bd82){return respondWithRpcPromise(_0xb814('0x45'),_0x1656ed[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x1656ed[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0xb2bd82,null))['catch'](handleError(_0xb2bd82,null));};exports[_0xb814('0x47')]=function(_0x5441c5,_0x5d71d5){return respondWithRpcPromise(_0xb814('0x48'),_0x5441c5[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x5d71d5,null))[_0xb814('0xe')](handleError(_0x5d71d5,null));};exports['showMailQueues']=function(_0x48362c,_0x2114ca){return respondWithRpcPromise('MailQueues',_0x48362c[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x48362c[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x2114ca,null))[_0xb814('0xe')](handleError(_0x2114ca,null));};exports['mailAccounts']=function(_0x2ef77d,_0x1e9196){return respondWithRpcPromise(_0xb814('0x49'),_0x2ef77d[_0xb814('0x1a')],mailClient)[_0xb814('0xa')](respondWithResult(_0x1e9196,null))[_0xb814('0xe')](handleError(_0x1e9196,null));};exports[_0xb814('0x4a')]=function(_0x113350,_0x46014f){return respondWithRpcPromise('OpenchannelQueues',_0x113350[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x46014f,null))[_0xb814('0xe')](handleError(_0x46014f,null));};exports[_0xb814('0x4b')]=function(_0x3b35a8,_0x3d4843){return respondWithRpcPromise('OpenchannelQueues',_0x3b35a8[_0xb814('0x1a')],routingClient)['then'](findById(_0x3b35a8[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0x3d4843,null))[_0xb814('0xe')](handleError(_0x3d4843,null));};exports['smsQueues']=function(_0x150e73,_0x579351){return respondWithRpcPromise(_0xb814('0x4c'),_0x150e73['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0x579351,null))[_0xb814('0xe')](handleError(_0x579351,null));};exports[_0xb814('0x4d')]=function(_0x1b024f,_0x3377d4){return respondWithRpcPromise(_0xb814('0x4c'),_0x1b024f[_0xb814('0x1a')],routingClient)['then'](findById(_0x1b024f[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x3377d4,null))[_0xb814('0xe')](handleError(_0x3377d4,null));};exports[_0xb814('0x4e')]=function(_0x1b989d,_0x3dcaeb){return respondWithRpcPromise(_0xb814('0x4f'),_0x1b989d[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x3dcaeb,null))[_0xb814('0xe')](handleError(_0x3dcaeb,null));};exports[_0xb814('0x50')]=function(_0x4a49ba,_0x3bb2b4){return respondWithRpcPromise(_0xb814('0x4f'),_0x4a49ba[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x4a49ba[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x3bb2b4,null))[_0xb814('0xe')](handleError(_0x3bb2b4,null));};exports['faxQueues']=function(_0x24594a,_0x16f8f2){return respondWithRpcPromise(_0xb814('0x51'),_0x24594a[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x16f8f2,null))[_0xb814('0xe')](handleError(_0x16f8f2,null));};exports['showFaxQueues']=function(_0x506bf2,_0x5d064b){return respondWithRpcPromise(_0xb814('0x51'),_0x506bf2['query'],routingClient)[_0xb814('0xa')](findById(_0x506bf2[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0x5d064b,null))['catch'](handleError(_0x5d064b,null));};exports[_0xb814('0x52')]=function(_0x3e5ce8,_0xee204){return respondWithRpcPromise('FaxAccounts',_0x3e5ce8[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0xee204,null))[_0xb814('0xe')](handleError(_0xee204,null));};exports[_0xb814('0x53')]=function(_0x555be0,_0x5dedd7){return respondWithRpcPromise(_0xb814('0x54'),_0x555be0[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x5dedd7,null))[_0xb814('0xe')](handleError(_0x5dedd7,null));};exports[_0xb814('0x55')]=function(_0xe5fc12,_0x34a0b3){return respondWithRpcPromise(_0xb814('0x56'),_0xe5fc12[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x34a0b3,null))[_0xb814('0xe')](handleError(_0x34a0b3,null));};exports[_0xb814('0x57')]=function(_0x3ef474,_0x21fc41){return respondWithRpcPromise(_0xb814('0x58'),_0x3ef474['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0x21fc41,null))[_0xb814('0xe')](handleError(_0x21fc41,null));};exports[_0xb814('0x59')]=function(_0x357b90,_0xec821a){return respondWithRpcPromise(_0xb814('0x58'),_0x357b90['query'],routingClient)[_0xb814('0xa')](function(_0x52e1fc){if(_0x357b90[_0xb814('0x1a')][_0xb814('0x5a')]!==undefined){var _0x3c5a58=_(_0x52e1fc[_0xb814('0x16')])[_0xb814('0x5b')]([_0x357b90['query']['type'],_0x357b90[_0xb814('0x1b')]['id']])[_0xb814('0x5c')](_0xb814('0x5d'))[_0xb814('0x5e')]()['value']();return _0x52e1fc[_0xb814('0x16')]['filter'](function(_0x39073c){return _0x3c5a58[_0xb814('0x5f')](_0x39073c['queue_id'])>-0x1;});}else{return _0x52e1fc['rows'][_0xb814('0x5b')](function(_0x52e17a){return _0x52e17a[_0xb814('0x5d')]===parseInt(_0x357b90[_0xb814('0x1b')]['id']);});}})[_0xb814('0xa')](respondWithResult(_0xec821a,null))[_0xb814('0xe')](handleError(_0xec821a,null));};exports[_0xb814('0x60')]=function(_0x420bde,_0x40fe4a){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x420bde[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x40fe4a,null))[_0xb814('0xe')](handleError(_0x40fe4a,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2838cb,_0x43ee60){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2838cb[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x43ee60,null))[_0xb814('0xe')](handleError(_0x43ee60,null));};exports[_0xb814('0x61')]=function(_0x4e15c2,_0x5a0c4a){return respondWithRpcPromise(_0xb814('0x62'),_0x4e15c2[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x5a0c4a,null))[_0xb814('0xe')](handleError(_0x5a0c4a,null));};exports[_0xb814('0x63')]=function(_0x4394da){return function(_0x2b12a9,_0x314600){var _0x8cb107,_0x34f49c;var _0x53e705=_['capitalize'](_0x4394da);var _0x5bee4d=_0x4394da==='chat'?'Website':_0xb814('0x64');return db[_0x53e705+_0xb814('0x65')][_0xb814('0x66')]({'raw':!![],'where':{'id':_0x2b12a9['params']['id']}})[_0xb814('0xa')](function(_0x1fb1ea){if(_[_0xb814('0x15')](_0x1fb1ea)){throw new Error(_0x53e705+_0xb814('0x67'));}_0x8cb107=_0x1fb1ea;return db[_0x53e705+_0xb814('0x68')][_0xb814('0x66')]({'where':{'id':_0x2b12a9[_0xb814('0x22')][_0xb814('0x69')]},'include':[{'model':db[_0x53e705+'Interaction'],'as':_0xb814('0x6a')},{'model':db[_0x53e705+_0x5bee4d],'as':_0xb814('0x64')}]});})[_0xb814('0xa')](function(_0x30faa0){if(_['isNil'](_0x30faa0)){throw new Error(_0x53e705+_0xb814('0x6b'));}_0x34f49c=_0x30faa0;return _0x30faa0[_0xb814('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb814('0xa')](function(){var _0x3037f2={'uniqueid':_0x4394da+'.'+_0x34f49c['id']+'.'+_0x34f49c[_0xb814('0x6a')]['id'],'FromUserId':_0x2b12a9['user']['id'],'type':'queue'};_0x3037f2[_0x53e705+_0xb814('0x6d')]=_0x34f49c['id'];_0x3037f2[_0x53e705+'InteractionId']=_0x34f49c[_0xb814('0x6a')]['id'];_0x3037f2[_0xb814('0x6e')+_0x53e705+_0x5bee4d+'Id']=_0x34f49c['Account']['id'];_0x3037f2['To'+_0x53e705+_0xb814('0x6f')]=_0x8cb107['id'];return db[_0x53e705+'TransferReport'][_0xb814('0x70')](_0x3037f2);})['then'](function(){return respondWithRpcPromise(_0xb814('0x71'),{'channel':_0x4394da,'interaction':_0x34f49c[_0xb814('0x6a')],'message':_0x34f49c,'account':_0x34f49c[_0xb814('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb814('0x72'),'appdata':_0x8cb107[_0xb814('0x13')]+','+(_0x34f49c[_0xb814('0x64')][_0xb814('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x314600,null))[_0xb814('0xe')](handleError(_0x314600,null));};};exports['agentNotify']=function(_0x511e03,_0x2d0061){var _0x8fbda1,_0x25d42d;if(_['isNil'](_0x511e03[_0xb814('0x22')]['channel'])){throw new Error(_0xb814('0x74'));}var _0x19d508=_0x511e03[_0xb814('0x22')][_0xb814('0x75')];var _0x4c8a00=_[_0xb814('0x76')](_0x19d508);var _0xc0ff3c=_0x19d508===_0xb814('0x77')?'Website':_0xb814('0x64');return db[_0xb814('0x78')][_0xb814('0x66')]({'raw':!![],'where':{'id':_0x511e03['params']['id'],'role':_0xb814('0x3c')}})[_0xb814('0xa')](function(_0x9dc06b){if(_[_0xb814('0x15')](_0x9dc06b)){throw new Error(_0xb814('0x79'));}_0x8fbda1=_0x9dc06b;return db[_0x4c8a00+_0xb814('0x68')][_0xb814('0x66')]({'where':{'id':_0x511e03[_0xb814('0x22')][_0xb814('0x69')]},'include':[{'model':db[_0x4c8a00+_0xb814('0x6a')],'as':_0xb814('0x6a')},{'model':db[_0x4c8a00+_0xc0ff3c],'as':_0xb814('0x64')}]});})[_0xb814('0xa')](function(_0x5b8d2e){if(_['isNil'](_0x5b8d2e)){throw new Error(_0x4c8a00+_0xb814('0x6b'));}_0x25d42d=_0x5b8d2e;return _0x5b8d2e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xb814('0xa')](function(){var _0x3949fd={'uniqueid':_0x19d508+'.'+_0x25d42d['id']+'.'+_0x25d42d[_0xb814('0x6a')]['id'],'FromUserId':_0x511e03[_0xb814('0x2f')]['id'],'type':_0xb814('0x72'),'ToUserId':_0x8fbda1['id']};_0x3949fd[_0x4c8a00+_0xb814('0x6d')]=_0x25d42d['id'];_0x3949fd[_0x4c8a00+_0xb814('0x7a')]=_0x25d42d['Interaction']['id'];_0x3949fd['From'+_0x4c8a00+_0xc0ff3c+'Id']=_0x25d42d[_0xb814('0x64')]['id'];return db[_0x4c8a00+'TransferReport'][_0xb814('0x70')](_0x3949fd);})[_0xb814('0xa')](function(){return respondWithRpcPromise(_0xb814('0x71'),{'channel':_0x19d508,'interaction':_0x25d42d['Interaction'],'message':_0x25d42d,'account':_0x25d42d[_0xb814('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb814('0x3c'),'appdata':_0x8fbda1[_0xb814('0x13')]+','+(_0x25d42d[_0xb814('0x64')][_0xb814('0x7b')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb814('0xa')](respondWithResult(_0x2d0061,null))[_0xb814('0xe')](handleError(_0x2d0061,null));}; \ No newline at end of file +var _0x81bd=['client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','Message','Interaction','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','agent','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api'];(function(_0x482914,_0x157546){var _0x3d12e2=function(_0x4307cd){while(--_0x4307cd){_0x482914['push'](_0x482914['shift']());}};_0x3d12e2(++_0x157546);}(_0x81bd,0x7c));var _0xd81b=function(_0x162167,_0x52203f){_0x162167=_0x162167-0x0;var _0x13fda6=_0x81bd[_0x162167];return _0x13fda6;};'use strict';var BPromise=require(_0xd81b('0x0'));var moment=require(_0xd81b('0x1'));var _=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var db=require(_0xd81b('0x4'))['db'];var logger=require(_0xd81b('0x5'))(_0xd81b('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232a});var mailClient=jayson[_0xd81b('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){var _0x223515=_0x5e14e8?_0x5e14e8:amiClient;return _0x223515[_0xd81b('0x9')](_0x1f3f2c,_0x562084)[_0xd81b('0xa')](function(_0x86dab6){if(_0x86dab6[_0xd81b('0xb')]){if(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xc')]===0x1f4){return _0x5468d5(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}return _0xa4cf97(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}else{_0xa4cf97(_0x86dab6[_0xd81b('0xe')]);}})[_0xd81b('0xf')](function(_0x560530){_0x5468d5(_0x560530);});});}function respondWithResult(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xc8;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x10')](_0x57f71d)['json'](_0x3f2405);}return _0x21dfff[_0xd81b('0x11')](0x194);};}function handleError(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0x1f4;return function(_0x41bf7a){logger[_0xd81b('0xb')](_0x41bf7a[_0xd81b('0x12')]);if(_0x41bf7a[_0xd81b('0x13')]){delete _0x41bf7a['name'];}_0x47dd04[_0xd81b('0x10')](_0x13dd00)[_0xd81b('0x14')](_0x41bf7a);};}function findById(_0x5c2863){return function(_0x2abef4){if(!_[_0xd81b('0x15')](_0x5c2863)&&!_[_0xd81b('0x15')](_0x2abef4)&&!_[_0xd81b('0x15')](_0x2abef4[_0xd81b('0x16')])){return _[_0xd81b('0x17')](_0x2abef4[_0xd81b('0x16')],function(_0x3d4d34){return _0x3d4d34['id']==_0x5c2863;});}return null;};}exports[_0xd81b('0x18')]=function(_0x285164,_0x1ff3c6){return respondWithRpcPromise(_0xd81b('0x19'),_0x285164[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x1ff3c6,null))[_0xd81b('0xf')](handleError(_0x1ff3c6,null));};exports[_0xd81b('0x1b')]=function(_0x5f101a,_0x4d566e){return respondWithRpcPromise(_0xd81b('0x1c'),_[_0xd81b('0x1d')](_0x5f101a[_0xd81b('0x1a')],_0x5f101a['params']))[_0xd81b('0xa')](respondWithResult(_0x4d566e,null))[_0xd81b('0xf')](handleError(_0x4d566e,null));};exports['voiceChannelStopMixMonitor']=function(_0xcd6474,_0x13d687){return respondWithRpcPromise(_0xd81b('0x1e'),_[_0xd81b('0x1d')](_0xcd6474[_0xd81b('0x1a')],_0xcd6474[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x13d687,null))[_0xd81b('0xf')](handleError(_0x13d687,null));};exports[_0xd81b('0x20')]=function(_0x212c4e,_0x2ccedf){return respondWithRpcPromise(_0xd81b('0x21'),_0x212c4e['query'])[_0xd81b('0xa')](respondWithResult(_0x2ccedf,null))[_0xd81b('0xf')](handleError(_0x2ccedf,null));};exports[_0xd81b('0x22')]=function(_0x31b9fd,_0x3266c2){return respondWithRpcPromise(_0xd81b('0x21'),_0x31b9fd[_0xd81b('0x1a')])[_0xd81b('0xa')](findById(_0x31b9fd[_0xd81b('0x1f')]['id']))['then'](respondWithResult(_0x3266c2,null))[_0xd81b('0xf')](handleError(_0x3266c2,null));};exports['updateVoiceQueue']=function(_0x5c8aee,_0xb9ff9f){return respondWithRpcPromise(_0xd81b('0x23'),_['merge'](_0x5c8aee['body'],_0x5c8aee[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0xb9ff9f,null))[_0xd81b('0xf')](handleError(_0xb9ff9f,null));};exports[_0xd81b('0x24')]=function(_0x1a1572,_0x4654ba){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xd81b('0x1d')](_0x1a1572[_0xd81b('0x1a')],_0x1a1572['params']))['then'](respondWithResult(_0x4654ba,null))[_0xd81b('0xf')](handleError(_0x4654ba,null));};exports[_0xd81b('0x25')]=function(_0x50472a,_0x50ce25){return respondWithRpcPromise('VoiceQueuesChannels',_0x50472a[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x50ce25,null))[_0xd81b('0xf')](handleError(_0x50ce25,null));};exports[_0xd81b('0x26')]=function(_0xa56339,_0x12ee8f){return respondWithRpcPromise(_0xd81b('0x27'),_['merge'](_0xa56339[_0xd81b('0x1a')],_0xa56339['params']))[_0xd81b('0xa')](respondWithResult(_0x12ee8f,null))[_0xd81b('0xf')](handleError(_0x12ee8f,null));};exports[_0xd81b('0x28')]=function(_0xcd9e86,_0x36c69f){return respondWithRpcPromise(_0xd81b('0x29'),_[_0xd81b('0x1d')](_0xcd9e86[_0xd81b('0x1a')],_0xcd9e86[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x36c69f,null))[_0xd81b('0xf')](handleError(_0x36c69f,null));};exports[_0xd81b('0x2a')]=function(_0x346038,_0x57bc0c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd81b('0x1d')](_0x346038[_0xd81b('0x1a')],_0x346038[_0xd81b('0x1f')]))['then'](respondWithResult(_0x57bc0c,null))[_0xd81b('0xf')](handleError(_0x57bc0c,null));};exports[_0xd81b('0x2b')]=function(_0x5a236a,_0x46f058){return respondWithRpcPromise(_0xd81b('0x2c'),_0x5a236a['query'])[_0xd81b('0xa')](respondWithResult(_0x46f058,null))['catch'](handleError(_0x46f058,null));};exports[_0xd81b('0x2d')]=function(_0x2502d1,_0x203365){return respondWithRpcPromise(_0xd81b('0x2e'),_0x2502d1['query'])[_0xd81b('0xa')](respondWithResult(_0x203365,null))[_0xd81b('0xf')](handleError(_0x203365,null));};exports[_0xd81b('0x2f')]=function(_0x67fbe5,_0x3abd60){var _0x466e98;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'])[_0xd81b('0xa')](function(_0x35a295){_0x466e98=_0x35a295;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'],routingClient);})[_0xd81b('0xa')](function(_0x3a05f4){return _[_0xd81b('0x1d')]({},_0x3a05f4,_0x466e98);})[_0xd81b('0xa')](respondWithResult(_0x3abd60,null))[_0xd81b('0xf')](handleError(_0x3abd60,null));};exports['agentCapacity']=function(_0x3dfba7,_0x11d617){if(_0x3dfba7[_0xd81b('0x31')]&&_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]&&_0x3dfba7[_0xd81b('0x33')]&&_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]){for(var _0x4405a8 in _0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]){if(_0x3dfba7['body'][_0xd81b('0x32')][_0xd81b('0x34')](_0x4405a8)){db[_0xd81b('0x35')][_0xd81b('0x36')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'exitAt':null,'uniqueid':_0x3dfba7[_0xd81b('0x31')]['interaction'][_0x4405a8]&&_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')]?{'$notIn':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8]}:{'$ne':null}}})[_0xd81b('0xa')](function(_0x37031b){var _0x334bd0=moment()[_0xd81b('0x39')](_0xd81b('0x3a'));for(var _0xcfbbc2=0x0,_0x41e2e6=_0x37031b[_0xd81b('0x38')];_0xcfbbc2<_0x41e2e6;_0xcfbbc2+=0x1){_0x37031b[_0xcfbbc2]['updateAttributes']({'exitAt':_0x334bd0});}});for(var _0x27d18a=0x0;_0x27d18a<_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')];_0x27d18a+=0x1){db[_0xd81b('0x35')][_0xd81b('0x3b')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'uniqueid':_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0x27d18a],'exitAt':null},'defaults':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'interface':_[_0xd81b('0x15')](_0x3dfba7['user'][_0xd81b('0x3c')])?util[_0xd81b('0x39')](_0xd81b('0x3d'),_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]):_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3c')],'type':_0xd81b('0x37'),'enterAt':moment()[_0xd81b('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3e')],'uniqueid':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0x27d18a]}});}}}}return respondWithRpcPromise(_0xd81b('0x3f'),{'id':_0x3dfba7[_0xd81b('0x1f')]['id'],'capacity':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x40')]},routingClient)['then'](respondWithResult(_0x11d617,null))[_0xd81b('0xf')](handleError(_0x11d617,null));};exports[_0xd81b('0x41')]=function(_0x1b523c,_0x3d171a){return respondWithRpcPromise(_0xd81b('0x42'),_0x1b523c['query'])[_0xd81b('0xa')](respondWithResult(_0x3d171a,null))[_0xd81b('0xf')](handleError(_0x3d171a,null));};exports['trunks']=function(_0x1f13c3,_0x315bd5){return respondWithRpcPromise(_0xd81b('0x43'),_0x1f13c3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x315bd5,null))[_0xd81b('0xf')](handleError(_0x315bd5,null));};exports[_0xd81b('0x44')]=function(_0x22f588,_0x3ed626){return respondWithRpcPromise(_0xd81b('0x45'),_0x22f588[_0xd81b('0x1a')])['then'](respondWithResult(_0x3ed626,null))[_0xd81b('0xf')](handleError(_0x3ed626,null));};exports['chatQueues']=function(_0x1800fa,_0x7b438c){return respondWithRpcPromise(_0xd81b('0x46'),_0x1800fa[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x7b438c,null))[_0xd81b('0xf')](handleError(_0x7b438c,null));};exports['showChatQueues']=function(_0x2d978d,_0xe0c9c6){return respondWithRpcPromise('ChatQueues',_0x2d978d['query'],routingClient)[_0xd81b('0xa')](findById(_0x2d978d['params']['id']))[_0xd81b('0xa')](respondWithResult(_0xe0c9c6,null))['catch'](handleError(_0xe0c9c6,null));};exports[_0xd81b('0x47')]=function(_0x315a66,_0x3d97ba){return respondWithRpcPromise('MailQueues',_0x315a66[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3d97ba,null))['catch'](handleError(_0x3d97ba,null));};exports[_0xd81b('0x48')]=function(_0x108aaf,_0x5951ec){return respondWithRpcPromise(_0xd81b('0x49'),_0x108aaf['query'],routingClient)[_0xd81b('0xa')](findById(_0x108aaf[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5951ec,null))[_0xd81b('0xf')](handleError(_0x5951ec,null));};exports[_0xd81b('0x4a')]=function(_0x32eab4,_0x2f2afe){return respondWithRpcPromise(_0xd81b('0x4b'),_0x32eab4[_0xd81b('0x1a')],mailClient)[_0xd81b('0xa')](respondWithResult(_0x2f2afe,null))['catch'](handleError(_0x2f2afe,null));};exports[_0xd81b('0x4c')]=function(_0x434434,_0x385841){return respondWithRpcPromise(_0xd81b('0x4d'),_0x434434[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x385841,null))[_0xd81b('0xf')](handleError(_0x385841,null));};exports['showOpenchannelQueues']=function(_0x57f0fb,_0x5de22d){return respondWithRpcPromise(_0xd81b('0x4d'),_0x57f0fb[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x57f0fb[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5de22d,null))[_0xd81b('0xf')](handleError(_0x5de22d,null));};exports[_0xd81b('0x4e')]=function(_0x5afecf,_0x3fcd8c){return respondWithRpcPromise(_0xd81b('0x4f'),_0x5afecf[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3fcd8c,null))[_0xd81b('0xf')](handleError(_0x3fcd8c,null));};exports[_0xd81b('0x50')]=function(_0xb5fca8,_0x4ed17d){return respondWithRpcPromise(_0xd81b('0x4f'),_0xb5fca8[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0xb5fca8[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x4ed17d,null))[_0xd81b('0xf')](handleError(_0x4ed17d,null));};exports[_0xd81b('0x51')]=function(_0x19d4f0,_0x8fa8cd){return respondWithRpcPromise(_0xd81b('0x52'),_0x19d4f0[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x8fa8cd,null))['catch'](handleError(_0x8fa8cd,null));};exports[_0xd81b('0x53')]=function(_0x5358a6,_0x2e7141){return respondWithRpcPromise(_0xd81b('0x52'),_0x5358a6[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x5358a6[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x2e7141,null))[_0xd81b('0xf')](handleError(_0x2e7141,null));};exports[_0xd81b('0x54')]=function(_0x10d6d2,_0x36fb7a){return respondWithRpcPromise('FaxQueues',_0x10d6d2[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x36fb7a,null))[_0xd81b('0xf')](handleError(_0x36fb7a,null));};exports[_0xd81b('0x55')]=function(_0x7720d3,_0x5abbb4){return respondWithRpcPromise('FaxQueues',_0x7720d3[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x7720d3[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5abbb4,null))[_0xd81b('0xf')](handleError(_0x5abbb4,null));};exports[_0xd81b('0x56')]=function(_0xaee7e3,_0x539132){return respondWithRpcPromise(_0xd81b('0x57'),_0xaee7e3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x539132,null))[_0xd81b('0xf')](handleError(_0x539132,null));};exports[_0xd81b('0x58')]=function(_0x21d039,_0x1e0da3){return respondWithRpcPromise(_0xd81b('0x59'),_0x21d039[_0xd81b('0x1a')],routingClient)['then'](respondWithResult(_0x1e0da3,null))[_0xd81b('0xf')](handleError(_0x1e0da3,null));};exports[_0xd81b('0x5a')]=function(_0x3858eb,_0x9c30e7){return respondWithRpcPromise(_0xd81b('0x5b'),_0x3858eb['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x9c30e7,null))[_0xd81b('0xf')](handleError(_0x9c30e7,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xa00645,_0x43e593){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0xa00645[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x43e593,null))[_0xd81b('0xf')](handleError(_0x43e593,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2aff4b,_0x3db4d7){return respondWithRpcPromise(_0xd81b('0x5c'),_0x2aff4b['query'],routingClient)['then'](function(_0xdd970d){if(_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')]!==undefined){var _0x5d601d=_(_0xdd970d[_0xd81b('0x16')])[_0xd81b('0x5e')]([_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')],_0x2aff4b['params']['id']])['map'](_0xd81b('0x5f'))[_0xd81b('0x60')]()[_0xd81b('0x61')]();return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x1b8b17){return _0x5d601d[_0xd81b('0x62')](_0x1b8b17['queue_id'])>-0x1;});}else{return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x32a8f4){return _0x32a8f4[_0xd81b('0x5f')]===parseInt(_0x2aff4b['params']['id']);});}})[_0xd81b('0xa')](respondWithResult(_0x3db4d7,null))[_0xd81b('0xf')](handleError(_0x3db4d7,null));};exports[_0xd81b('0x63')]=function(_0x2490f1,_0x2b0fe4){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2490f1[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b0fe4,null))[_0xd81b('0xf')](handleError(_0x2b0fe4,null));};exports[_0xd81b('0x64')]=function(_0x1919b2,_0x2b1d96){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x1919b2['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b1d96,null))[_0xd81b('0xf')](handleError(_0x2b1d96,null));};exports[_0xd81b('0x65')]=function(_0x15aed5,_0x4dd8ac){return respondWithRpcPromise(_0xd81b('0x66'),_0x15aed5[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x4dd8ac,null))[_0xd81b('0xf')](handleError(_0x4dd8ac,null));};exports[_0xd81b('0x67')]=function(_0x589882){return function(_0x3744bf,_0x374ac0){var _0x159b28,_0x40b468;var _0x1d596c=_[_0xd81b('0x68')](_0x589882);var _0x402eb9=_0x589882==='chat'?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0x1d596c+_0xd81b('0x6b')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x3744bf[_0xd81b('0x1f')]['id']}})[_0xd81b('0xa')](function(_0x59bee6){if(_[_0xd81b('0x15')](_0x59bee6)){throw new Error(_0x1d596c+'\x20Queue\x20not\x20found');}_0x159b28=_0x59bee6;return db[_0x1d596c+_0xd81b('0x6d')][_0xd81b('0x6c')]({'where':{'id':_0x3744bf[_0xd81b('0x31')]['messageId']},'include':[{'model':db[_0x1d596c+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x1d596c+_0x402eb9],'as':_0xd81b('0x6a')}]});})[_0xd81b('0xa')](function(_0x254105){if(_[_0xd81b('0x15')](_0x254105)){throw new Error(_0x1d596c+'\x20Message\x20not\x20found');}_0x40b468=_0x254105;return _0x254105[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5f5514={'uniqueid':_0x589882+'.'+_0x40b468['id']+'.'+_0x40b468[_0xd81b('0x6e')]['id'],'FromUserId':_0x3744bf[_0xd81b('0x33')]['id'],'type':_0xd81b('0x70')};_0x5f5514[_0x1d596c+'MessageId']=_0x40b468['id'];_0x5f5514[_0x1d596c+_0xd81b('0x71')]=_0x40b468[_0xd81b('0x6e')]['id'];_0x5f5514[_0xd81b('0x72')+_0x1d596c+_0x402eb9+'Id']=_0x40b468[_0xd81b('0x6a')]['id'];_0x5f5514['To'+_0x1d596c+_0xd81b('0x73')]=_0x159b28['id'];return db[_0x1d596c+_0xd81b('0x74')]['create'](_0x5f5514);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x589882,'interaction':_0x40b468[_0xd81b('0x6e')],'message':_0x40b468,'account':_0x40b468[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x70'),'appdata':_0x159b28[_0xd81b('0x13')]+','+(_0x40b468[_0xd81b('0x6a')][_0xd81b('0x76')]||0x12c),'interval':_0xd81b('0x77')}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x374ac0,null))[_0xd81b('0xf')](handleError(_0x374ac0,null));};};exports[_0xd81b('0x78')]=function(_0x42eb62,_0x2c19fd){var _0x36d8fd,_0x5adfe4;if(_[_0xd81b('0x15')](_0x42eb62['body'][_0xd81b('0x79')])){throw new Error(_0xd81b('0x7a'));}var _0x1ca94b=_0x42eb62[_0xd81b('0x31')][_0xd81b('0x79')];var _0x115805=_['capitalize'](_0x1ca94b);var _0x3a41e6=_0x1ca94b===_0xd81b('0x7b')?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0xd81b('0x7c')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x42eb62[_0xd81b('0x1f')]['id'],'role':_0xd81b('0x7d')}})[_0xd81b('0xa')](function(_0xfacc8f){if(_[_0xd81b('0x15')](_0xfacc8f)){throw new Error(_0xd81b('0x7e'));}_0x36d8fd=_0xfacc8f;return db[_0x115805+'Message'][_0xd81b('0x6c')]({'where':{'id':_0x42eb62[_0xd81b('0x31')][_0xd81b('0x7f')]},'include':[{'model':db[_0x115805+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x115805+_0x3a41e6],'as':'Account'}]});})[_0xd81b('0xa')](function(_0x1e61d8){if(_[_0xd81b('0x15')](_0x1e61d8)){throw new Error(_0x115805+_0xd81b('0x80'));}_0x5adfe4=_0x1e61d8;return _0x1e61d8[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd81b('0xa')](function(){var _0x4e4919={'uniqueid':_0x1ca94b+'.'+_0x5adfe4['id']+'.'+_0x5adfe4[_0xd81b('0x6e')]['id'],'FromUserId':_0x42eb62['user']['id'],'type':_0xd81b('0x70'),'ToUserId':_0x36d8fd['id']};_0x4e4919[_0x115805+_0xd81b('0x81')]=_0x5adfe4['id'];_0x4e4919[_0x115805+_0xd81b('0x71')]=_0x5adfe4[_0xd81b('0x6e')]['id'];_0x4e4919['From'+_0x115805+_0x3a41e6+'Id']=_0x5adfe4[_0xd81b('0x6a')]['id'];return db[_0x115805+_0xd81b('0x74')]['create'](_0x4e4919);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x1ca94b,'interaction':_0x5adfe4[_0xd81b('0x6e')],'message':_0x5adfe4,'account':_0x5adfe4[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x7d'),'appdata':_0x36d8fd['name']+','+(_0x5adfe4['Account'][_0xd81b('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x2c19fd,null))['catch'](handleError(_0x2c19fd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d0e3316..e73fa3a 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 _0xbdbe=['path','express','Router','fs-extra','../../components/interaction/service','./schedule.controller','index','get','/:id','show','/:id/run','isAuthenticated','post','create','put','update','delete','destroy','exports','util'];(function(_0xd8186b,_0x2b0b4f){var _0x95d572=function(_0x2401e6){while(--_0x2401e6){_0xd8186b['push'](_0xd8186b['shift']());}};_0x95d572(++_0x2b0b4f);}(_0xbdbe,0x1cb));var _0xebdb=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xbdbe[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require('multer');var util=require(_0xebdb('0x0'));var path=require(_0xebdb('0x1'));var timeout=require('connect-timeout');var express=require(_0xebdb('0x2'));var router=express[_0xebdb('0x3')]();var fs_extra=require(_0xebdb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xebdb('0x5'));var config=require('../../config/environment');var controller=require(_0xebdb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xebdb('0x7')]);router[_0xebdb('0x8')](_0xebdb('0x9'),auth['isAuthenticated'](),controller[_0xebdb('0xa')]);router[_0xebdb('0x8')](_0xebdb('0xb'),auth[_0xebdb('0xc')](),controller['run']);router[_0xebdb('0xd')]('/',auth['isAuthenticated'](),controller[_0xebdb('0xe')]);router[_0xebdb('0xf')](_0xebdb('0x9'),auth[_0xebdb('0xc')](),controller[_0xebdb('0x10')]);router[_0xebdb('0x11')](_0xebdb('0x9'),auth['isAuthenticated'](),controller[_0xebdb('0x12')]);module[_0xebdb('0x13')]=router; \ No newline at end of file +var _0x1347=['./schedule.controller','isAuthenticated','index','get','/:id','show','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3207a4,_0x1b9024){var _0x5c8dff=function(_0x4611b9){while(--_0x4611b9){_0x3207a4['push'](_0x3207a4['shift']());}};_0x5c8dff(++_0x1b9024);}(_0x1347,0x1f1));var _0x7134=function(_0x5d01d1,_0x511ae8){_0x5d01d1=_0x5d01d1-0x0;var _0x1526dd=_0x1347[_0x5d01d1];return _0x1526dd;};'use strict';var multer=require(_0x7134('0x0'));var util=require(_0x7134('0x1'));var path=require(_0x7134('0x2'));var timeout=require(_0x7134('0x3'));var express=require(_0x7134('0x4'));var router=express[_0x7134('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7134('0x6'));var interaction=require(_0x7134('0x7'));var config=require(_0x7134('0x8'));var controller=require(_0x7134('0x9'));router['get']('/',auth[_0x7134('0xa')](),controller[_0x7134('0xb')]);router[_0x7134('0xc')](_0x7134('0xd'),auth['isAuthenticated'](),controller[_0x7134('0xe')]);router[_0x7134('0xc')]('/:id/run',auth[_0x7134('0xa')](),controller[_0x7134('0xf')]);router[_0x7134('0x10')]('/',auth[_0x7134('0xa')](),controller[_0x7134('0x11')]);router[_0x7134('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7134('0x13')]);router[_0x7134('0x14')](_0x7134('0xd'),auth[_0x7134('0xa')](),controller[_0x7134('0x15')]);module[_0x7134('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 65fc262..789ea06 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 _0xa059=['default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','xlsx','custom'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa059,0x191));var _0x9a05=function(_0x3d7d66,_0x2fa6f8){_0x3d7d66=_0x3d7d66-0x0;var _0x1f204c=_0xa059[_0x3d7d66];return _0x1f204c;};'use strict';var Sequelize=require(_0x9a05('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a05('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9a05('0x1')]},'active':{'type':Sequelize[_0x9a05('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9a05('0x1')],'allowNull':![],'defaultValue':_0x9a05('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x9a05('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9a05('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9a05('0x6')](_0x9a05('0x7'),_0x9a05('0x8'),_0x9a05('0x9'),_0x9a05('0xa'),_0x9a05('0xb'),'hours',_0x9a05('0xc')),'allowNull':![],'defaultValue':_0x9a05('0xb')},'output':{'type':Sequelize['ENUM'](_0x9a05('0xd'),_0x9a05('0xe'),_0x9a05('0xf')),'allowNull':![],'defaultValue':_0x9a05('0xd')},'type':{'type':Sequelize[_0x9a05('0x6')](_0x9a05('0x10'),_0x9a05('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x9a05('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9a05('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x9a05('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe861=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','days','minutes','ENUM','csv','xlsx','custom','default','TEXT','sequelize'];(function(_0x55c64d,_0x1aef01){var _0x5a5273=function(_0x21e514){while(--_0x21e514){_0x55c64d['push'](_0x55c64d['shift']());}};_0x5a5273(++_0x1aef01);}(_0xe861,0x142));var _0x1e86=function(_0x1fe688,_0x2bf830){_0x1fe688=_0x1fe688-0x0;var _0x4e391b=_0xe861[_0x1fe688];return _0x4e391b;};'use strict';var Sequelize=require(_0x1e86('0x0'));module[_0x1e86('0x1')]={'name':{'type':Sequelize[_0x1e86('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1e86('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1e86('0x2')],'allowNull':![],'defaultValue':_0x1e86('0x4')},'startAt':{'type':Sequelize[_0x1e86('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1e86('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x1e86('0x6'),_0x1e86('0x7'),_0x1e86('0x8'),'weeks',_0x1e86('0x9'),'hours',_0x1e86('0xa')),'allowNull':![],'defaultValue':_0x1e86('0x9')},'output':{'type':Sequelize[_0x1e86('0xb')](_0x1e86('0xc'),'pdf',_0x1e86('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x1e86('0xb')](_0x1e86('0xe'),_0x1e86('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x1e86('0x2')]},'cc':{'type':Sequelize[_0x1e86('0x10')]},'bcc':{'type':Sequelize[_0x1e86('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x1e86('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 78fca3e..41c98c2 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 _0x3a28=['findAll','catch','show','params','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','status','sendStatus','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x20c1ac,_0x9b2695){var _0x2bb4f3=function(_0x5917fc){while(--_0x5917fc){_0x20c1ac['push'](_0x20c1ac['shift']());}};_0x2bb4f3(++_0x9b2695);}(_0x3a28,0xbd));var _0x83a2=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x3a28[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0x83a2('0x0'));var rimraf=require(_0x83a2('0x1'));var zipdir=require(_0x83a2('0x2'));var jsonpatch=require(_0x83a2('0x3'));var rp=require(_0x83a2('0x4'));var moment=require('moment');var BPromise=require(_0x83a2('0x5'));var Mustache=require(_0x83a2('0x6'));var util=require(_0x83a2('0x7'));var path=require(_0x83a2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x83a2('0x9'));var fs=require('fs');var fs_extra=require(_0x83a2('0xa'));var _=require(_0x83a2('0xb'));var squel=require('squel');var crypto=require(_0x83a2('0xc'));var jsforce=require(_0x83a2('0xd'));var deskjs=require(_0x83a2('0xe'));var toCsv=require(_0x83a2('0xf'));var querystring=require('querystring');var Papa=require(_0x83a2('0x10'));var Redis=require(_0x83a2('0x11'));var authService=require(_0x83a2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x83a2('0x13'));var hardwareService=require(_0x83a2('0x14'));var logger=require('../../config/logger')(_0x83a2('0x15'));var utils=require(_0x83a2('0x16'));var config=require(_0x83a2('0x17'));var licenseUtil=require(_0x83a2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37371c,_0x4e9262){_0x4e9262=_0x4e9262||0xcc;return function(_0x58ae52){if(_0x58ae52){return _0x37371c['sendStatus'](_0x4e9262);}return _0x37371c['status'](_0x4e9262)['end']();};}function respondWithResult(_0x828370,_0x59dc3e){_0x59dc3e=_0x59dc3e||0xc8;return function(_0x4559fb){if(_0x4559fb){return _0x828370['status'](_0x59dc3e)[_0x83a2('0x19')](_0x4559fb);}};}function respondWithFilteredResult(_0x489a85,_0x502ac3){return function(_0x580f4d){if(_0x580f4d){var _0x39ec42=typeof _0x502ac3[_0x83a2('0x1a')]===_0x83a2('0x1b')&&typeof _0x502ac3[_0x83a2('0x1c')]===_0x83a2('0x1b');var _0x58b0de=_0x580f4d['count'];var _0x186f92=_0x39ec42?0x0:_0x502ac3[_0x83a2('0x1a')];var _0x160a84=_0x39ec42?_0x580f4d[_0x83a2('0x1d')]:_0x502ac3[_0x83a2('0x1a')]+_0x502ac3[_0x83a2('0x1c')];var _0x4ca314;if(_0x160a84>=_0x58b0de){_0x160a84=_0x58b0de;_0x4ca314=0xc8;}else{_0x4ca314=0xce;}_0x489a85['status'](_0x4ca314);return _0x489a85[_0x83a2('0x1e')](_0x83a2('0x1f'),_0x186f92+'-'+_0x160a84+'/'+_0x58b0de)[_0x83a2('0x19')](_0x580f4d);}return null;};}function patchUpdates(_0x252860){return function(_0x37d803){try{jsonpatch[_0x83a2('0x20')](_0x37d803,_0x252860,!![]);}catch(_0x43c164){return BPromise[_0x83a2('0x21')](_0x43c164);}return _0x37d803[_0x83a2('0x22')]();};}function saveUpdates(_0x3c5feb,_0x3f6774){return function(_0x2e2d06){if(_0x2e2d06){return _0x2e2d06[_0x83a2('0x23')](_0x3c5feb)[_0x83a2('0x24')](function(_0x4e3726){return _0x4e3726;});}return null;};}function removeEntity(_0x376e46,_0x35215d){return function(_0xdabbcb){if(_0xdabbcb){return _0xdabbcb[_0x83a2('0x25')]()[_0x83a2('0x24')](function(){var _0x38a248=_0xdabbcb['get']({'plain':!![]});var _0x5674f1=_0x83a2('0x26');return db[_0x83a2('0x27')][_0x83a2('0x25')]({'where':{'type':_0x5674f1,'resourceId':_0x38a248['id']}})['then'](function(){return _0xdabbcb;});})[_0x83a2('0x24')](function(){_0x376e46[_0x83a2('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af0d5,_0x37f599){return function(_0x381cd4){if(!_0x381cd4){_0x1af0d5[_0x83a2('0x29')](0x194);}return _0x381cd4;};}function handleError(_0x4ba455,_0x380080){_0x380080=_0x380080||0x1f4;return function(_0x3a8b31){logger[_0x83a2('0x2a')](_0x3a8b31[_0x83a2('0x2b')]);if(_0x3a8b31['name']){delete _0x3a8b31[_0x83a2('0x2c')];}_0x4ba455[_0x83a2('0x28')](_0x380080)['send'](_0x3a8b31);};}exports[_0x83a2('0x2d')]=function(_0x3aec25,_0x120213){var _0x39562d={},_0x315d3a={},_0x2c1664={'count':0x0,'rows':[]};var _0x56de22=_[_0x83a2('0x2e')](db[_0x83a2('0x2f')][_0x83a2('0x30')],function(_0x192810){return{'name':_0x192810[_0x83a2('0x31')],'type':_0x192810[_0x83a2('0x32')][_0x83a2('0x33')]};});_0x315d3a[_0x83a2('0x34')]=_[_0x83a2('0x2e')](_0x56de22,'name');_0x315d3a[_0x83a2('0x35')]=_[_0x83a2('0x36')](_0x3aec25[_0x83a2('0x35')]);_0x315d3a[_0x83a2('0x37')]=_['intersection'](_0x315d3a[_0x83a2('0x34')],_0x315d3a[_0x83a2('0x35')]);_0x39562d['attributes']=_['intersection'](_0x315d3a['model'],qs[_0x83a2('0x38')](_0x3aec25['query'][_0x83a2('0x38')]));_0x39562d['attributes']=_0x39562d[_0x83a2('0x39')][_0x83a2('0x3a')]?_0x39562d[_0x83a2('0x39')]:_0x315d3a[_0x83a2('0x34')];if(!_0x3aec25['query'][_0x83a2('0x3b')]('nolimit')){_0x39562d[_0x83a2('0x1c')]=qs[_0x83a2('0x1c')](_0x3aec25[_0x83a2('0x35')]['limit']);_0x39562d[_0x83a2('0x1a')]=qs[_0x83a2('0x1a')](_0x3aec25[_0x83a2('0x35')][_0x83a2('0x1a')]);}_0x39562d[_0x83a2('0x3c')]=qs['sort'](_0x3aec25[_0x83a2('0x35')][_0x83a2('0x3d')]);_0x39562d[_0x83a2('0x3e')]=qs[_0x83a2('0x37')](_[_0x83a2('0x3f')](_0x3aec25[_0x83a2('0x35')],_0x315d3a[_0x83a2('0x37')]),_0x56de22);if(_0x3aec25[_0x83a2('0x35')][_0x83a2('0x40')]){_0x39562d[_0x83a2('0x3e')]=_[_0x83a2('0x41')](_0x39562d[_0x83a2('0x3e')],{'$or':_[_0x83a2('0x2e')](_0x56de22,function(_0x32ba09){if(_0x32ba09[_0x83a2('0x32')]!=='VIRTUAL'){var _0x26900f={};_0x26900f[_0x32ba09[_0x83a2('0x2c')]]={'$like':'%'+_0x3aec25[_0x83a2('0x35')][_0x83a2('0x40')]+'%'};return _0x26900f;}})});}_0x39562d=_[_0x83a2('0x41')]({},_0x39562d,_0x3aec25[_0x83a2('0x42')]);var _0x3c17e2={'where':_0x39562d[_0x83a2('0x3e')]};return db[_0x83a2('0x2f')][_0x83a2('0x1d')](_0x3c17e2)['then'](function(_0xb31a01){_0x2c1664['count']=_0xb31a01;if(_0x3aec25[_0x83a2('0x35')][_0x83a2('0x43')]){_0x39562d[_0x83a2('0x44')]=[{'all':!![]}];}return db['Schedule'][_0x83a2('0x45')](_0x39562d);})[_0x83a2('0x24')](function(_0x1cd875){_0x2c1664['rows']=_0x1cd875;return _0x2c1664;})[_0x83a2('0x24')](respondWithFilteredResult(_0x120213,_0x39562d))[_0x83a2('0x46')](handleError(_0x120213,null));};exports[_0x83a2('0x47')]=function(_0x54c639,_0x41377b){var _0x4efa29={'raw':![],'where':{'id':_0x54c639[_0x83a2('0x48')]['id']}},_0x4c5d70={};_0x4c5d70[_0x83a2('0x34')]=_[_0x83a2('0x36')](db['Schedule'][_0x83a2('0x30')]);_0x4c5d70[_0x83a2('0x35')]=_['keys'](_0x54c639[_0x83a2('0x35')]);_0x4c5d70[_0x83a2('0x37')]=_[_0x83a2('0x49')](_0x4c5d70[_0x83a2('0x34')],_0x4c5d70[_0x83a2('0x35')]);_0x4efa29[_0x83a2('0x39')]=_['intersection'](_0x4c5d70[_0x83a2('0x34')],qs[_0x83a2('0x38')](_0x54c639[_0x83a2('0x35')][_0x83a2('0x38')]));_0x4efa29[_0x83a2('0x39')]=_0x4efa29['attributes'][_0x83a2('0x3a')]?_0x4efa29['attributes']:_0x4c5d70[_0x83a2('0x34')];if(_0x54c639[_0x83a2('0x35')][_0x83a2('0x43')]){_0x4efa29[_0x83a2('0x44')]=[{'all':!![]}];}_0x4efa29=_[_0x83a2('0x41')]({},_0x4efa29,_0x54c639[_0x83a2('0x42')]);return db[_0x83a2('0x2f')][_0x83a2('0x4a')](_0x4efa29)[_0x83a2('0x24')](handleEntityNotFound(_0x41377b,null))['then'](respondWithResult(_0x41377b,null))['catch'](handleError(_0x41377b,null));};exports[_0x83a2('0x4b')]=function(_0x36af0d,_0x4279ac){return db['Schedule'][_0x83a2('0x4b')](_0x36af0d[_0x83a2('0x4c')],{})[_0x83a2('0x24')](function(_0x710d9a){var _0x1787a7=_0x36af0d[_0x83a2('0x4d')][_0x83a2('0x4e')]({'plain':!![]});if(!_0x1787a7)throw new Error(_0x83a2('0x4f'));if(_0x1787a7[_0x83a2('0x50')]===_0x83a2('0x4d')){var _0x154023=_0x710d9a[_0x83a2('0x4e')]({'plain':!![]});var _0x98741f=_0x83a2('0x26');return db[_0x83a2('0x51')]['find']({'where':{'name':_0x98741f,'userProfileId':_0x1787a7[_0x83a2('0x52')]},'raw':!![]})[_0x83a2('0x24')](function(_0x3f612d){if(_0x3f612d&&_0x3f612d[_0x83a2('0x53')]===0x0){return db['UserProfileResource'][_0x83a2('0x4b')]({'name':_0x154023[_0x83a2('0x2c')],'resourceId':_0x154023['id'],'type':_0x3f612d[_0x83a2('0x2c')],'sectionId':_0x3f612d['id']},{})['then'](function(){return _0x710d9a;});}else{return _0x710d9a;}})[_0x83a2('0x46')](function(_0x2b89bc){logger[_0x83a2('0x2a')](_0x83a2('0x54'),_0x2b89bc);throw _0x2b89bc;});}return _0x710d9a;})[_0x83a2('0x24')](respondWithResult(_0x4279ac,0xc9))[_0x83a2('0x46')](handleError(_0x4279ac,null));};exports['update']=function(_0x5e9187,_0xde8813){if(_0x5e9187[_0x83a2('0x4c')]['id']){delete _0x5e9187['body']['id'];}return db[_0x83a2('0x2f')][_0x83a2('0x4a')]({'where':{'id':_0x5e9187['params']['id']}})[_0x83a2('0x24')](handleEntityNotFound(_0xde8813,null))['then'](saveUpdates(_0x5e9187['body'],null))['then'](respondWithResult(_0xde8813,null))[_0x83a2('0x46')](handleError(_0xde8813,null));};exports[_0x83a2('0x25')]=function(_0x83d175,_0x5c14dd){return db[_0x83a2('0x2f')][_0x83a2('0x4a')]({'where':{'id':_0x83d175[_0x83a2('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c14dd,null))[_0x83a2('0x24')](removeEntity(_0x5c14dd,null))[_0x83a2('0x46')](handleError(_0x5c14dd,null));};exports[_0x83a2('0x55')]=function(_0x383fe1,_0xe812cc,_0x4f77ef){var _0x46d89c=require('../../config/schedule');return db[_0x83a2('0x2f')][_0x83a2('0x4a')]({'where':{'id':_0x383fe1[_0x83a2('0x48')]['id']},'raw':!![]})[_0x83a2('0x24')](handleEntityNotFound(_0xe812cc,null))[_0x83a2('0x24')](function(){_0x46d89c['run'](_0x383fe1[_0x83a2('0x48')]['id']);})['then'](respondWithStatusCode(_0xe812cc,null))['catch'](handleError(_0xe812cc,null));}; \ No newline at end of file +var _0xe87a=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','fields','length','catch','create','body','user'];(function(_0xee37f1,_0x189f43){var _0x37fd54=function(_0x3c8109){while(--_0x3c8109){_0xee37f1['push'](_0xee37f1['shift']());}};_0x37fd54(++_0x189f43);}(_0xe87a,0x19c));var _0xae87=function(_0x44cade,_0x1eaccc){_0x44cade=_0x44cade-0x0;var _0x3e07c2=_0xe87a[_0x44cade];return _0x3e07c2;};'use strict';var emlformat=require(_0xae87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae87('0x1'));var jsonpatch=require(_0xae87('0x2'));var rp=require(_0xae87('0x3'));var moment=require(_0xae87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xae87('0x5'));var util=require(_0xae87('0x6'));var path=require(_0xae87('0x7'));var sox=require(_0xae87('0x8'));var csv=require(_0xae87('0x9'));var ejs=require(_0xae87('0xa'));var fs=require('fs');var fs_extra=require(_0xae87('0xb'));var _=require(_0xae87('0xc'));var squel=require('squel');var crypto=require(_0xae87('0xd'));var jsforce=require(_0xae87('0xe'));var deskjs=require(_0xae87('0xf'));var toCsv=require(_0xae87('0x9'));var querystring=require(_0xae87('0x10'));var Papa=require(_0xae87('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae87('0x12'));var as=require(_0xae87('0x13'));var hardwareService=require(_0xae87('0x14'));var logger=require('../../config/logger')(_0xae87('0x15'));var utils=require(_0xae87('0x16'));var config=require(_0xae87('0x17'));var licenseUtil=require(_0xae87('0x18'));var db=require(_0xae87('0x19'))['db'];function respondWithStatusCode(_0x1552d1,_0x106653){_0x106653=_0x106653||0xcc;return function(_0x39f62f){if(_0x39f62f){return _0x1552d1[_0xae87('0x1a')](_0x106653);}return _0x1552d1[_0xae87('0x1b')](_0x106653)['end']();};}function respondWithResult(_0x3efd02,_0x426bbf){_0x426bbf=_0x426bbf||0xc8;return function(_0x2d53e6){if(_0x2d53e6){return _0x3efd02[_0xae87('0x1b')](_0x426bbf)[_0xae87('0x1c')](_0x2d53e6);}};}function respondWithFilteredResult(_0x1c654a,_0x40c0f2){return function(_0x4e71c5){if(_0x4e71c5){var _0x2b001f=typeof _0x40c0f2[_0xae87('0x1d')]===_0xae87('0x1e')&&typeof _0x40c0f2[_0xae87('0x1f')]===_0xae87('0x1e');var _0x59c9e7=_0x4e71c5[_0xae87('0x20')];var _0x1e530a=_0x2b001f?0x0:_0x40c0f2['offset'];var _0x5a9bff=_0x2b001f?_0x4e71c5[_0xae87('0x20')]:_0x40c0f2['offset']+_0x40c0f2[_0xae87('0x1f')];var _0x8e62ef;if(_0x5a9bff>=_0x59c9e7){_0x5a9bff=_0x59c9e7;_0x8e62ef=0xc8;}else{_0x8e62ef=0xce;}_0x1c654a[_0xae87('0x1b')](_0x8e62ef);return _0x1c654a[_0xae87('0x21')](_0xae87('0x22'),_0x1e530a+'-'+_0x5a9bff+'/'+_0x59c9e7)[_0xae87('0x1c')](_0x4e71c5);}return null;};}function patchUpdates(_0x4b924f){return function(_0x4cb029){try{jsonpatch[_0xae87('0x23')](_0x4cb029,_0x4b924f,!![]);}catch(_0x1b1046){return BPromise['reject'](_0x1b1046);}return _0x4cb029[_0xae87('0x24')]();};}function saveUpdates(_0x38fb8a,_0x44c8e5){return function(_0x364ed6){if(_0x364ed6){return _0x364ed6[_0xae87('0x25')](_0x38fb8a)['then'](function(_0x532c00){return _0x532c00;});}return null;};}function removeEntity(_0x5be6cf,_0x3d7884){return function(_0x440694){if(_0x440694){return _0x440694[_0xae87('0x26')]()[_0xae87('0x27')](function(){var _0x43e03f=_0x440694[_0xae87('0x28')]({'plain':!![]});var _0xd3a60b='Scheduler';return db['UserProfileResource'][_0xae87('0x26')]({'where':{'type':_0xd3a60b,'resourceId':_0x43e03f['id']}})[_0xae87('0x27')](function(){return _0x440694;});})[_0xae87('0x27')](function(){_0x5be6cf[_0xae87('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xffd0f2,_0x53dbf3){return function(_0x5d436b){if(!_0x5d436b){_0xffd0f2[_0xae87('0x1a')](0x194);}return _0x5d436b;};}function handleError(_0xccf4f,_0x46ad60){_0x46ad60=_0x46ad60||0x1f4;return function(_0x5da832){logger[_0xae87('0x29')](_0x5da832[_0xae87('0x2a')]);if(_0x5da832['name']){delete _0x5da832[_0xae87('0x2b')];}_0xccf4f[_0xae87('0x1b')](_0x46ad60)[_0xae87('0x2c')](_0x5da832);};}exports['index']=function(_0x2e9db1,_0x4d963d){var _0x5a0493={},_0x118fa6={},_0x3aa264={'count':0x0,'rows':[]};var _0x31b2ca=_[_0xae87('0x2d')](db[_0xae87('0x2e')][_0xae87('0x2f')],function(_0x5e7622){return{'name':_0x5e7622[_0xae87('0x30')],'type':_0x5e7622[_0xae87('0x31')]['key']};});_0x118fa6[_0xae87('0x32')]=_[_0xae87('0x2d')](_0x31b2ca,_0xae87('0x2b'));_0x118fa6['query']=_[_0xae87('0x33')](_0x2e9db1['query']);_0x118fa6[_0xae87('0x34')]=_[_0xae87('0x35')](_0x118fa6[_0xae87('0x32')],_0x118fa6[_0xae87('0x36')]);_0x5a0493[_0xae87('0x37')]=_[_0xae87('0x35')](_0x118fa6[_0xae87('0x32')],qs['fields'](_0x2e9db1[_0xae87('0x36')]['fields']));_0x5a0493['attributes']=_0x5a0493[_0xae87('0x37')]['length']?_0x5a0493[_0xae87('0x37')]:_0x118fa6[_0xae87('0x32')];if(!_0x2e9db1[_0xae87('0x36')]['hasOwnProperty'](_0xae87('0x38'))){_0x5a0493['limit']=qs['limit'](_0x2e9db1[_0xae87('0x36')][_0xae87('0x1f')]);_0x5a0493[_0xae87('0x1d')]=qs[_0xae87('0x1d')](_0x2e9db1[_0xae87('0x36')][_0xae87('0x1d')]);}_0x5a0493[_0xae87('0x39')]=qs['sort'](_0x2e9db1['query'][_0xae87('0x3a')]);_0x5a0493[_0xae87('0x3b')]=qs[_0xae87('0x34')](_['pick'](_0x2e9db1[_0xae87('0x36')],_0x118fa6[_0xae87('0x34')]),_0x31b2ca);if(_0x2e9db1[_0xae87('0x36')][_0xae87('0x3c')]){_0x5a0493[_0xae87('0x3b')]=_[_0xae87('0x3d')](_0x5a0493[_0xae87('0x3b')],{'$or':_[_0xae87('0x2d')](_0x31b2ca,function(_0x95feb1){if(_0x95feb1['type']!=='VIRTUAL'){var _0x213f92={};_0x213f92[_0x95feb1[_0xae87('0x2b')]]={'$like':'%'+_0x2e9db1[_0xae87('0x36')][_0xae87('0x3c')]+'%'};return _0x213f92;}})});}_0x5a0493=_[_0xae87('0x3d')]({},_0x5a0493,_0x2e9db1[_0xae87('0x3e')]);var _0x550792={'where':_0x5a0493[_0xae87('0x3b')]};return db[_0xae87('0x2e')]['count'](_0x550792)[_0xae87('0x27')](function(_0x58cea1){_0x3aa264[_0xae87('0x20')]=_0x58cea1;if(_0x2e9db1['query'][_0xae87('0x3f')]){_0x5a0493[_0xae87('0x40')]=[{'all':!![]}];}return db[_0xae87('0x2e')][_0xae87('0x41')](_0x5a0493);})[_0xae87('0x27')](function(_0x5d3b1a){_0x3aa264[_0xae87('0x42')]=_0x5d3b1a;return _0x3aa264;})[_0xae87('0x27')](respondWithFilteredResult(_0x4d963d,_0x5a0493))['catch'](handleError(_0x4d963d,null));};exports['show']=function(_0x22ba49,_0x47c080){var _0x45b4d8={'raw':![],'where':{'id':_0x22ba49[_0xae87('0x43')]['id']}},_0x306d59={};_0x306d59[_0xae87('0x32')]=_[_0xae87('0x33')](db['Schedule']['rawAttributes']);_0x306d59[_0xae87('0x36')]=_[_0xae87('0x33')](_0x22ba49[_0xae87('0x36')]);_0x306d59[_0xae87('0x34')]=_[_0xae87('0x35')](_0x306d59['model'],_0x306d59['query']);_0x45b4d8[_0xae87('0x37')]=_[_0xae87('0x35')](_0x306d59[_0xae87('0x32')],qs['fields'](_0x22ba49[_0xae87('0x36')][_0xae87('0x44')]));_0x45b4d8[_0xae87('0x37')]=_0x45b4d8[_0xae87('0x37')][_0xae87('0x45')]?_0x45b4d8['attributes']:_0x306d59[_0xae87('0x32')];if(_0x22ba49[_0xae87('0x36')][_0xae87('0x3f')]){_0x45b4d8[_0xae87('0x40')]=[{'all':!![]}];}_0x45b4d8=_['merge']({},_0x45b4d8,_0x22ba49[_0xae87('0x3e')]);return db[_0xae87('0x2e')]['find'](_0x45b4d8)[_0xae87('0x27')](handleEntityNotFound(_0x47c080,null))[_0xae87('0x27')](respondWithResult(_0x47c080,null))[_0xae87('0x46')](handleError(_0x47c080,null));};exports[_0xae87('0x47')]=function(_0x1ec3d9,_0x3514f1){return db['Schedule'][_0xae87('0x47')](_0x1ec3d9[_0xae87('0x48')],{})['then'](function(_0x5f5a41){var _0x268e64=_0x1ec3d9[_0xae87('0x49')][_0xae87('0x28')]({'plain':!![]});if(!_0x268e64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x268e64[_0xae87('0x4a')]==='user'){var _0x39f797=_0x5f5a41[_0xae87('0x28')]({'plain':!![]});var _0x61a77e='Scheduler';return db[_0xae87('0x4b')]['find']({'where':{'name':_0x61a77e,'userProfileId':_0x268e64[_0xae87('0x4c')]},'raw':!![]})[_0xae87('0x27')](function(_0x3e3d9d){if(_0x3e3d9d&&_0x3e3d9d[_0xae87('0x4d')]===0x0){return db[_0xae87('0x4e')][_0xae87('0x47')]({'name':_0x39f797[_0xae87('0x2b')],'resourceId':_0x39f797['id'],'type':_0x3e3d9d[_0xae87('0x2b')],'sectionId':_0x3e3d9d['id']},{})['then'](function(){return _0x5f5a41;});}else{return _0x5f5a41;}})[_0xae87('0x46')](function(_0x48d81e){logger[_0xae87('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48d81e);throw _0x48d81e;});}return _0x5f5a41;})[_0xae87('0x27')](respondWithResult(_0x3514f1,0xc9))[_0xae87('0x46')](handleError(_0x3514f1,null));};exports[_0xae87('0x25')]=function(_0x131f9e,_0x39d1b0){if(_0x131f9e[_0xae87('0x48')]['id']){delete _0x131f9e[_0xae87('0x48')]['id'];}return db[_0xae87('0x2e')][_0xae87('0x4f')]({'where':{'id':_0x131f9e[_0xae87('0x43')]['id']}})[_0xae87('0x27')](handleEntityNotFound(_0x39d1b0,null))[_0xae87('0x27')](saveUpdates(_0x131f9e[_0xae87('0x48')],null))[_0xae87('0x27')](respondWithResult(_0x39d1b0,null))[_0xae87('0x46')](handleError(_0x39d1b0,null));};exports['destroy']=function(_0x5ab453,_0x43f691){return db[_0xae87('0x2e')]['find']({'where':{'id':_0x5ab453[_0xae87('0x43')]['id']}})[_0xae87('0x27')](handleEntityNotFound(_0x43f691,null))[_0xae87('0x27')](removeEntity(_0x43f691,null))[_0xae87('0x46')](handleError(_0x43f691,null));};exports['run']=function(_0x63650e,_0x4c2bfe,_0x57d016){var _0x449e5f=require(_0xae87('0x50'));return db['Schedule'][_0xae87('0x4f')]({'where':{'id':_0x63650e['params']['id']},'raw':!![]})[_0xae87('0x27')](handleEntityNotFound(_0x4c2bfe,null))[_0xae87('0x27')](function(){_0x449e5f['run'](_0x63650e['params']['id']);})[_0xae87('0x27')](respondWithStatusCode(_0x4c2bfe,null))[_0xae87('0x46')](handleError(_0x4c2bfe,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7bcebfc..33630ec 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 _0xa825=['api','request-promise','path','rimraf','../../config/environment','define','Schedule','lodash','util','../../config/logger'];(function(_0x1cd23d,_0xec4ea5){var _0x5e8ad5=function(_0x1603d8){while(--_0x1603d8){_0x1cd23d['push'](_0x1cd23d['shift']());}};_0x5e8ad5(++_0xec4ea5);}(_0xa825,0xbb));var _0x5a82=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa825[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5a82('0x0'));var util=require(_0x5a82('0x1'));var logger=require(_0x5a82('0x2'))(_0x5a82('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a82('0x4'));var fs=require('fs');var path=require(_0x5a82('0x5'));var rimraf=require(_0x5a82('0x6'));var config=require(_0x5a82('0x7'));var attributes=require('./schedule.attributes');module['exports']=function(_0x5000d4,_0x1303b0){return _0x5000d4[_0x5a82('0x8')](_0x5a82('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf45d=['util','../../config/logger','api','moment','bluebird','path','rimraf','exports','Schedule','lodash'];(function(_0x4e007d,_0x5a0b85){var _0x270c4f=function(_0x338a08){while(--_0x338a08){_0x4e007d['push'](_0x4e007d['shift']());}};_0x270c4f(++_0x5a0b85);}(_0xf45d,0x17b));var _0xdf45=function(_0x53a8bb,_0x4404dd){_0x53a8bb=_0x53a8bb-0x0;var _0x11ade8=_0xf45d[_0x53a8bb];return _0x11ade8;};'use strict';var _=require(_0xdf45('0x0'));var util=require(_0xdf45('0x1'));var logger=require(_0xdf45('0x2'))(_0xdf45('0x3'));var moment=require(_0xdf45('0x4'));var BPromise=require(_0xdf45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf45('0x6'));var rimraf=require(_0xdf45('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0xdf45('0x8')]=function(_0x39314a,_0x1f58c5){return _0x39314a['define'](_0xdf45('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 4a796cb..4d428fb 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 _0xbaaf=['then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x38bb18,_0x22f104){var _0x568736=function(_0x555be5){while(--_0x555be5){_0x38bb18['push'](_0x38bb18['shift']());}};_0x568736(++_0x22f104);}(_0xbaaf,0x1e5));var _0xfbaa=function(_0x5445b9,_0x4c58aa){_0x5445b9=_0x5445b9-0x0;var _0x230ef3=_0xbaaf[_0x5445b9];return _0x230ef3;};'use strict';var _=require('lodash');var util=require(_0xfbaa('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfbaa('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbaa('0x2'))['db'];var utils=require(_0xfbaa('0x3'));var logger=require(_0xfbaa('0x4'))('rpc');var config=require(_0xfbaa('0x5'));var jayson=require(_0xfbaa('0x6'));var client=jayson[_0xfbaa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b96ee,_0x49a35b,_0x55d83e){return new BPromise(function(_0x11d01e,_0x5b80a2){return client[_0xfbaa('0x8')](_0x1b96ee,_0x55d83e)[_0xfbaa('0x9')](function(_0x28c2ba){logger['info'](_0xfbaa('0xa'),_0x49a35b,'request\x20sent');logger[_0xfbaa('0xb')](_0xfbaa('0xc'),_0x49a35b,_0xfbaa('0xd'),JSON['stringify'](_0x28c2ba));if(_0x28c2ba['error']){if(_0x28c2ba[_0xfbaa('0xe')][_0xfbaa('0xf')]===0x1f4){logger[_0xfbaa('0xe')](_0xfbaa('0xa'),_0x49a35b,_0x28c2ba[_0xfbaa('0xe')][_0xfbaa('0x10')]);return _0x5b80a2(_0x28c2ba['error']['message']);}logger['error'](_0xfbaa('0xa'),_0x49a35b,_0x28c2ba[_0xfbaa('0xe')][_0xfbaa('0x10')]);return _0x11d01e(_0x28c2ba['error'][_0xfbaa('0x10')]);}else{logger[_0xfbaa('0x11')]('Schedule,\x20%s,\x20%s',_0x49a35b,_0xfbaa('0xd'));_0x11d01e(_0x28c2ba[_0xfbaa('0x12')][_0xfbaa('0x10')]);}})['catch'](function(_0x13ee64){logger[_0xfbaa('0xe')](_0xfbaa('0xa'),_0x49a35b,_0x13ee64);_0x5b80a2(_0x13ee64);});});} \ No newline at end of file +var _0x8221=['randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x8221,0x15d));var _0x1822=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x8221[_0x356e8d];return _0x39e65a;};'use strict';var _=require(_0x1822('0x0'));var util=require(_0x1822('0x1'));var moment=require('moment');var BPromise=require(_0x1822('0x2'));var rs=require(_0x1822('0x3'));var fs=require('fs');var Redis=require(_0x1822('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1822('0x5'));var config=require(_0x1822('0x6'));var jayson=require(_0x1822('0x7'));var client=jayson[_0x1822('0x8')][_0x1822('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x204dc1,_0x1d19c1,_0x27ed13){return new BPromise(function(_0x4fd148,_0x2e133a){return client[_0x1822('0xa')](_0x204dc1,_0x27ed13)[_0x1822('0xb')](function(_0x50f75b){logger[_0x1822('0xc')](_0x1822('0xd'),_0x1d19c1,'request\x20sent');logger[_0x1822('0xe')](_0x1822('0xf'),_0x1d19c1,_0x1822('0x10'),JSON[_0x1822('0x11')](_0x50f75b));if(_0x50f75b[_0x1822('0x12')]){if(_0x50f75b[_0x1822('0x12')]['code']===0x1f4){logger[_0x1822('0x12')]('Schedule,\x20%s,\x20%s',_0x1d19c1,_0x50f75b['error'][_0x1822('0x13')]);return _0x2e133a(_0x50f75b[_0x1822('0x12')][_0x1822('0x13')]);}logger['error'](_0x1822('0xd'),_0x1d19c1,_0x50f75b[_0x1822('0x12')]['message']);return _0x4fd148(_0x50f75b[_0x1822('0x12')][_0x1822('0x13')]);}else{logger[_0x1822('0xc')](_0x1822('0xd'),_0x1d19c1,_0x1822('0x10'));_0x4fd148(_0x50f75b[_0x1822('0x14')][_0x1822('0x13')]);}})[_0x1822('0x15')](function(_0x2415f5){logger[_0x1822('0x12')](_0x1822('0xd'),_0x1d19c1,_0x2415f5);_0x2e133a(_0x2415f5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 79580c5..a0bf933 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 _0x250d=['../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show','download','create','put','update','delete','destroy','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x257f14,_0x58d8e0){var _0xd5836=function(_0x177cff){while(--_0x177cff){_0x257f14['push'](_0x257f14['shift']());}};_0xd5836(++_0x58d8e0);}(_0x250d,0xdf));var _0xd250=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x250d[_0x2543d6];return _0x55213c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd250('0x0'));var express=require('express');var router=express[_0xd250('0x1')]();var fs_extra=require(_0xd250('0x2'));var auth=require(_0xd250('0x3'));var interaction=require(_0xd250('0x4'));var config=require(_0xd250('0x5'));var controller=require('./screenRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd250('0x6')]);router[_0xd250('0x7')](_0xd250('0x8'),auth['isAuthenticated'](),controller[_0xd250('0x9')]);router[_0xd250('0x7')](_0xd250('0xa'),auth[_0xd250('0xb')](),controller[_0xd250('0xc')]);router[_0xd250('0x7')]('/:id/download',auth[_0xd250('0xb')](),controller[_0xd250('0xd')]);router['post']('/',auth[_0xd250('0xb')](),controller[_0xd250('0xe')]);router[_0xd250('0xf')](_0xd250('0xa'),auth[_0xd250('0xb')](),controller[_0xd250('0x10')]);router[_0xd250('0x11')](_0xd250('0xa'),auth['isAuthenticated'](),controller[_0xd250('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe8a3=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','download','post','create','update','destroy'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xe8a3,0x7f));var _0x3e8a=function(_0x100827,_0x49215d){_0x100827=_0x100827-0x0;var _0x1e6245=_0xe8a3[_0x100827];return _0x1e6245;};'use strict';var multer=require(_0x3e8a('0x0'));var util=require(_0x3e8a('0x1'));var path=require(_0x3e8a('0x2'));var timeout=require(_0x3e8a('0x3'));var express=require(_0x3e8a('0x4'));var router=express[_0x3e8a('0x5')]();var fs_extra=require(_0x3e8a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3e8a('0x7'));router['get']('/',auth[_0x3e8a('0x8')](),controller[_0x3e8a('0x9')]);router[_0x3e8a('0xa')](_0x3e8a('0xb'),auth[_0x3e8a('0x8')](),controller[_0x3e8a('0xc')]);router[_0x3e8a('0xa')](_0x3e8a('0xd'),auth[_0x3e8a('0x8')](),controller[_0x3e8a('0xe')]);router[_0x3e8a('0xa')]('/:id/download',auth[_0x3e8a('0x8')](),controller[_0x3e8a('0xf')]);router[_0x3e8a('0x10')]('/',auth[_0x3e8a('0x8')](),controller[_0x3e8a('0x11')]);router['put'](_0x3e8a('0xd'),auth[_0x3e8a('0x8')](),controller[_0x3e8a('0x12')]);router['delete'](_0x3e8a('0xd'),auth[_0x3e8a('0x8')](),controller[_0x3e8a('0x13')]);module[_0x3e8a('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f305725..18eb971 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 _0x2fe5=['setDataValue','INTEGER','subtract','duration','DATE','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace'];(function(_0x58f555,_0x552ef2){var _0x4eb99b=function(_0x110a86){while(--_0x110a86){_0x58f555['push'](_0x58f555['shift']());}};_0x4eb99b(++_0x552ef2);}(_0x2fe5,0x14b));var _0x52fe=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2fe5[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x52fe('0x0'));var moment=require(_0x52fe('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x52fe('0x2')]={'format':{'type':Sequelize[_0x52fe('0x3')],'get':function(){return this[_0x52fe('0x4')](_0x52fe('0x5'))?path[_0x52fe('0x6')](this['getDataValue'](_0x52fe('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x52fe('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x52fe('0x7')],'set':function(_0x157c5a){var _0x2b3f41=_0x157c5a[_0x52fe('0x8')](/\\/g,'/');this[_0x52fe('0x9')]('value',_0x2b3f41);}},'rating':{'type':Sequelize[_0x52fe('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x52fe('0xa')],'set':function(_0xe73ece){this['setDataValue']('startedAt',moment()[_0x52fe('0xb')](_0xe73ece,'ms'));this[_0x52fe('0x9')]('closedAt',moment());this[_0x52fe('0x9')](_0x52fe('0xc'),_0xe73ece);}},'startedAt':{'type':Sequelize[_0x52fe('0xd')],'get':function(){return moment(this[_0x52fe('0x4')]('startedAt'))[_0x52fe('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x52fe('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x52fe('0x4')](_0x52fe('0x10')))[_0x52fe('0xe')](_0x52fe('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x52fe('0xd')],'get':function(){return moment(this[_0x52fe('0x4')](_0x52fe('0x12')))[_0x52fe('0xe')](_0x52fe('0x11'))[_0x52fe('0xf')]();}},'updatedAt':{'type':Sequelize[_0x52fe('0xd')],'get':function(){return moment(this[_0x52fe('0x4')](_0x52fe('0x13')))[_0x52fe('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x1c63=['startedAt','subtract','closedAt','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','format','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x1c63,0xdc));var _0x31c6=function(_0x461935,_0xeaeb6e){_0x461935=_0x461935-0x0;var _0x1f809f=_0x1c63[_0x461935];return _0x1f809f;};'use strict';var Sequelize=require(_0x31c6('0x0'));var moment=require(_0x31c6('0x1'));var path=require(_0x31c6('0x2'));var config=require(_0x31c6('0x3'));module['exports']={'format':{'type':Sequelize[_0x31c6('0x4')],'get':function(){return this[_0x31c6('0x5')](_0x31c6('0x6'))?path['extname'](this[_0x31c6('0x5')](_0x31c6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x31c6('0x7')]},'channel':{'type':Sequelize[_0x31c6('0x7')]},'value':{'type':Sequelize[_0x31c6('0x7')],'set':function(_0x4ac1b7){var _0x560053=_0x4ac1b7[_0x31c6('0x8')](/\\/g,'/');this[_0x31c6('0x9')](_0x31c6('0x6'),_0x560053);}},'rating':{'type':Sequelize[_0x31c6('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x31c6('0xa')],'set':function(_0x487e6e){this[_0x31c6('0x9')](_0x31c6('0xb'),moment()[_0x31c6('0xc')](_0x487e6e,'ms'));this[_0x31c6('0x9')](_0x31c6('0xd'),moment());this['setDataValue'](_0x31c6('0xe'),_0x487e6e);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x31c6('0x5')](_0x31c6('0xb')))['format'](_0x31c6('0xf'))[_0x31c6('0x10')]();}},'closedAt':{'type':Sequelize[_0x31c6('0x11')],'get':function(){return moment(this[_0x31c6('0x5')](_0x31c6('0xd')))[_0x31c6('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x31c6('0x10')]();}},'createdAt':{'type':Sequelize[_0x31c6('0x11')],'get':function(){return moment(this[_0x31c6('0x5')](_0x31c6('0x13')))[_0x31c6('0x12')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x31c6('0x14')))['format'](_0x31c6('0xf'))[_0x31c6('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5c62747..3c09e37 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038b=['offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','root','%s.cypher','decryptFile','secrets','recording','join','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4a986d,_0x44feb1){var _0x493937=function(_0x43ea89){while(--_0x43ea89){_0x4a986d['push'](_0x4a986d['shift']());}};_0x493937(++_0x44feb1);}(_0x038b,0x114));var _0xb038=function(_0x28800f,_0x48876f){_0x28800f=_0x28800f-0x0;var _0x5f0dc8=_0x038b[_0x28800f];return _0x5f0dc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x2d')](_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24')),[_0xb038('0x2e')]);_0xc387d['query']=_[_0xb038('0x2f')](_0x2855a6['query']);_0xc387d[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x32')]);_0x12b3b6[_0xb038('0x33')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x32')][_0xb038('0x34')]));_0x12b3b6['attributes']=_0x12b3b6[_0xb038('0x33')][_0xb038('0x35')]?_0x12b3b6[_0xb038('0x33')]:_0xc387d['model'];if(!_0x2855a6['query']['hasOwnProperty'](_0xb038('0x36'))){_0x12b3b6[_0xb038('0x1b')]=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x32')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs['offset'](_0x2855a6[_0xb038('0x32')][_0xb038('0x18')]);}_0x12b3b6[_0xb038('0x37')]=qs[_0xb038('0x38')](_0x2855a6['query'][_0xb038('0x38')]);_0x12b3b6[_0xb038('0x39')]=qs['filters'](_['pick'](_0x2855a6[_0xb038('0x32')],_0xc387d[_0xb038('0x30')]),_0x1783d4);if(_0x2855a6[_0xb038('0x32')][_0xb038('0x3a')]){_0x12b3b6[_0xb038('0x39')]=_['merge'](_0x12b3b6[_0xb038('0x39')],{'$or':_[_0xb038('0x26')](_0x1783d4,function(_0x26d48c){if(_0x26d48c[_0xb038('0x2a')]!=='VIRTUAL'){var _0x793da9={};_0x793da9[_0x26d48c[_0xb038('0x24')]]={'$like':'%'+_0x2855a6[_0xb038('0x32')]['filter']+'%'};return _0x793da9;}})});}_0x12b3b6=_[_0xb038('0x3b')]({},_0x12b3b6,_0x2855a6['options']);var _0x36f281={'where':_0x12b3b6[_0xb038('0x39')]};return db[_0xb038('0x27')]['count'](_0x36f281)[_0xb038('0x22')](function(_0x357c78){_0x551b55[_0xb038('0x1a')]=_0x357c78;if(_0x2855a6['query'][_0xb038('0x3c')]){_0x12b3b6[_0xb038('0x3d')]=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3e')](_0x12b3b6);})['then'](function(_0x28b922){_0x551b55[_0xb038('0x3f')]=_0x28b922;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x40')](handleError(_0x28a6a9,null));};exports['show']=function(_0x19dc7b,_0x269c7d){var _0x57816c={'raw':![],'where':{'id':_0x19dc7b[_0xb038('0x41')]['id']}},_0x207fb5={};_0x207fb5[_0xb038('0x2c')]=_['keys'](db[_0xb038('0x27')][_0xb038('0x28')]);_0x207fb5['query']=_['keys'](_0x19dc7b[_0xb038('0x32')]);_0x207fb5[_0xb038('0x30')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],_0x207fb5[_0xb038('0x32')]);_0x57816c[_0xb038('0x33')]=_[_0xb038('0x31')](_0x207fb5[_0xb038('0x2c')],qs['fields'](_0x19dc7b['query']['fields']));_0x57816c[_0xb038('0x33')]=_0x57816c[_0xb038('0x33')]['length']?_0x57816c[_0xb038('0x33')]:_0x207fb5[_0xb038('0x2c')];if(_0x19dc7b[_0xb038('0x32')]['includeAll']){_0x57816c[_0xb038('0x3d')]=[{'all':!![]}];}_0x57816c=_['merge']({},_0x57816c,_0x19dc7b['options']);return db[_0xb038('0x27')][_0xb038('0x42')](_0x57816c)[_0xb038('0x22')](handleEntityNotFound(_0x269c7d,null))[_0xb038('0x22')](respondWithResult(_0x269c7d,null))[_0xb038('0x40')](handleError(_0x269c7d,null));};exports[_0xb038('0x43')]=function(_0x2f053a,_0x473aae){return db[_0xb038('0x27')][_0xb038('0x43')](_0x2f053a['body'],{})[_0xb038('0x22')](respondWithResult(_0x473aae,0xc9))[_0xb038('0x40')](handleError(_0x473aae,null));};exports['update']=function(_0x906c9c,_0x19ab72){if(_0x906c9c['body']['id']){delete _0x906c9c[_0xb038('0x44')]['id'];}delete _0x906c9c[_0xb038('0x44')][_0xb038('0x45')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x46')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x47')];delete _0x906c9c[_0xb038('0x44')][_0xb038('0x48')];return db['ScreenRecording'][_0xb038('0x42')]({'where':{'id':_0x906c9c[_0xb038('0x41')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x19ab72,null))[_0xb038('0x22')](saveUpdates(_0x906c9c[_0xb038('0x44')],null))[_0xb038('0x22')](respondWithResult(_0x19ab72,null))['catch'](handleError(_0x19ab72,null));};exports[_0xb038('0x49')]=function(_0x2f3622,_0x2b2b4d){return db[_0xb038('0x27')][_0xb038('0x49')]()[_0xb038('0x22')](respondWithResult(_0x2b2b4d,null))[_0xb038('0x40')](handleError(_0x2b2b4d,null));};exports['download']=function(_0x3abe7a,_0x5c4a79,_0x77f211){var _0x1ea8ad=require(_0xb038('0x4a'));var _0x998fe3=![];var _0x1518c4={};if(_0x3abe7a['query']['type']&&_0x3abe7a['query'][_0xb038('0x2a')]===_0xb038('0x4b')){_0x1518c4[_0xb038('0x4b')]=_0x3abe7a[_0xb038('0x41')]['id'];}else{_0x1518c4['id']=_0x3abe7a[_0xb038('0x41')]['id'];}return db[_0xb038('0x27')]['find']({'where':_0x1518c4,'attributes':['id',_0xb038('0x48')],'raw':!![]})[_0xb038('0x22')](handleEntityNotFound(_0x5c4a79,null))['then'](function(_0x5b27d3){if(_0x5b27d3){var _0xf2907b=path['join'](config[_0xb038('0x4c')],'server/files/screen_recordings',_0x5b27d3[_0xb038('0x48')]);var _0x4677b8=util[_0xb038('0x2e')](_0xb038('0x4d'),_0xf2907b);if(fs['existsSync'](_0x4677b8)){_0x998fe3=!![];return _0x1ea8ad[_0xb038('0x4e')](_0x4677b8,_0xf2907b,config[_0xb038('0x4f')][_0xb038('0x50')])[_0xb038('0x22')](function(){return _0x5b27d3;});}return _0x5b27d3;}})[_0xb038('0x22')](function(_0x1246c8){if(_0x1246c8){var _0x14a553=path[_0xb038('0x51')](config[_0xb038('0x4c')],_0xb038('0x52'),_0x1246c8[_0xb038('0x48')]);if(!fs[_0xb038('0x53')](_0x14a553)){throw new db['Sequelize'][(_0xb038('0x54'))](_0xb038('0x55'));}if(_0x1246c8[_0xb038('0x56')]){return _0x5c4a79[_0xb038('0x57')](_0x14a553,_0x1246c8[_0xb038('0x56')]+path['extname'](_0x14a553),function(){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}else{return _0x5c4a79['download'](_0x14a553,function(_0xfb3ce6){if(_0x998fe3){fs[_0xb038('0x58')](_0x14a553);}});}}})['catch'](function(_0x15d61c){if(_0x15d61c[_0xb038('0x59')]===_0xb038('0x55')){_0x5c4a79[_0xb038('0x16')](0x194)[_0xb038('0x5a')](_0xb038('0x5b'));}else{return handleError(_0x5c4a79,null);}});};exports[_0xb038('0x5c')]=function(_0xe275b8,_0x769f1e){return db[_0xb038('0x27')]['find']({'where':{'id':_0xe275b8[_0xb038('0x41')]['id']}})['then'](function(_0x189894){if(_[_0xb038('0x5d')](_0x189894)){throw new ReferenceError(_0xb038('0x5e'));}return _0x189894;})[_0xb038('0x22')](function(_0x1f5f3f){var _0x23fb92=path[_0xb038('0x51')](config['root'],'server/files/screen_recordings',_0x1f5f3f[_0xb038('0x48')]);logger[_0xb038('0x5f')](_0xb038('0x60'),_0x23fb92);if(!_['isNil'](_0x1f5f3f['value'])&&fs[_0xb038('0x53')](_0x23fb92)){logger['info'](_0xb038('0x61')+_0x23fb92+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb038('0x62')](_0x23fb92);}_0x23fb92=_0x23fb92+'.cypher';if(!_[_0xb038('0x5d')](_0x1f5f3f[_0xb038('0x48')])&&fs[_0xb038('0x53')](_0x23fb92)){logger[_0xb038('0x5f')](_0xb038('0x61')+_0x23fb92+_0xb038('0x63'));fs['unlinkSync'](_0x23fb92);}return _0x1f5f3f;})['then'](function(_0x45e628){if(!_0x45e628)throw new InternalError();return _0x45e628['destroy']();})[_0xb038('0x22')](function(){_0x769f1e[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();})['catch'](handleError(_0x769f1e,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x4c4e,0x152));var _0xe4c4=function(_0x785948,_0x4b455b){_0x785948=_0x785948-0x0;var _0x937114=_0x4c4e[_0x785948];return _0x937114;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 56c3a14..a71a947 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 _0xf40b=['api','moment','bluebird','path','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x57335a,_0x5d4c0a){var _0x54bdaf=function(_0x4f7ddd){while(--_0x4f7ddd){_0x57335a['push'](_0x57335a['shift']());}};_0x54bdaf(++_0x5d4c0a);}(_0xf40b,0x1ea));var _0xbf40=function(_0x3702ba,_0x460951){_0x3702ba=_0x3702ba-0x0;var _0x115695=_0xf40b[_0x3702ba];return _0x115695;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbf40('0x0'));var moment=require(_0xbf40('0x1'));var BPromise=require(_0xbf40('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf40('0x3'));var rimraf=require(_0xbf40('0x4'));var config=require('../../config/environment');var attributes=require(_0xbf40('0x5'));module['exports']=function(_0x2b4adf,_0x3f42b6){return _0x2b4adf[_0xbf40('0x6')](_0xbf40('0x7'),attributes,{'tableName':_0xbf40('0x8'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xbf40('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd1a=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','lodash'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xfd1a,0x83));var _0xafd1=function(_0x5a905f,_0x44c2ad){_0x5a905f=_0x5a905f-0x0;var _0x3050b5=_0xfd1a[_0x5a905f];return _0x3050b5;};'use strict';var _=require(_0xafd1('0x0'));var util=require(_0xafd1('0x1'));var logger=require('../../config/logger')(_0xafd1('0x2'));var moment=require(_0xafd1('0x3'));var BPromise=require('bluebird');var rp=require(_0xafd1('0x4'));var fs=require('fs');var path=require(_0xafd1('0x5'));var rimraf=require(_0xafd1('0x6'));var config=require(_0xafd1('0x7'));var attributes=require('./screenRecording.attributes');module[_0xafd1('0x8')]=function(_0x2518dc,_0x447c0a){return _0x2518dc[_0xafd1('0x9')](_0xafd1('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xafd1('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 19b5649..cc9f5c8 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 _0x94f4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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','bluebird'];(function(_0xf04542,_0x47db75){var _0x739220=function(_0x1569c5){while(--_0x1569c5){_0xf04542['push'](_0xf04542['shift']());}};_0x739220(++_0x47db75);}(_0x94f4,0x1bf));var _0x494f=function(_0x4492a3,_0x26d430){_0x4492a3=_0x4492a3-0x0;var _0x2bc386=_0x94f4[_0x4492a3];return _0x2bc386;};'use strict';var _=require(_0x494f('0x0'));var util=require(_0x494f('0x1'));var moment=require('moment');var BPromise=require(_0x494f('0x2'));var rs=require(_0x494f('0x3'));var fs=require('fs');var Redis=require(_0x494f('0x4'));var db=require(_0x494f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x494f('0x6'))(_0x494f('0x7'));var config=require(_0x494f('0x8'));var jayson=require(_0x494f('0x9'));var client=jayson[_0x494f('0xa')][_0x494f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x78c53d,_0x3adab6,_0x19acb2){return new BPromise(function(_0x338c66,_0x28717b){return client[_0x494f('0xc')](_0x78c53d,_0x19acb2)[_0x494f('0xd')](function(_0x142b41){logger[_0x494f('0xe')](_0x494f('0xf'),_0x3adab6,_0x494f('0x10'));logger[_0x494f('0x11')](_0x494f('0x12'),_0x3adab6,'request\x20sent',JSON[_0x494f('0x13')](_0x142b41));if(_0x142b41['error']){if(_0x142b41[_0x494f('0x14')][_0x494f('0x15')]===0x1f4){logger[_0x494f('0x14')](_0x494f('0xf'),_0x3adab6,_0x142b41[_0x494f('0x14')][_0x494f('0x16')]);return _0x28717b(_0x142b41[_0x494f('0x14')][_0x494f('0x16')]);}logger[_0x494f('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x3adab6,_0x142b41[_0x494f('0x14')][_0x494f('0x16')]);return _0x338c66(_0x142b41['error'][_0x494f('0x16')]);}else{logger[_0x494f('0xe')](_0x494f('0xf'),_0x3adab6,_0x494f('0x10'));_0x338c66(_0x142b41[_0x494f('0x17')][_0x494f('0x16')]);}})[_0x494f('0x18')](function(_0x215f2a){logger['error'](_0x494f('0xf'),_0x3adab6,_0x215f2a);_0x28717b(_0x215f2a);});});} \ No newline at end of file +var _0x00a8=['debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x4800bf,_0x3f6aa0){var _0x4dc339=function(_0x5d32f2){while(--_0x5d32f2){_0x4800bf['push'](_0x4800bf['shift']());}};_0x4dc339(++_0x3f6aa0);}(_0x00a8,0x1ea));var _0x800a=function(_0x1c808d,_0x1c267c){_0x1c808d=_0x1c808d-0x0;var _0x11027d=_0x00a8[_0x1c808d];return _0x11027d;};'use strict';var _=require(_0x800a('0x0'));var util=require(_0x800a('0x1'));var moment=require(_0x800a('0x2'));var BPromise=require(_0x800a('0x3'));var rs=require(_0x800a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x800a('0x5'))['db'];var utils=require(_0x800a('0x6'));var logger=require(_0x800a('0x7'))('rpc');var config=require(_0x800a('0x8'));var jayson=require(_0x800a('0x9'));var client=jayson[_0x800a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x429ec3,_0x2ba30f,_0x510b65){return new BPromise(function(_0xe84532,_0x2dc1ff){return client[_0x800a('0xb')](_0x429ec3,_0x510b65)[_0x800a('0xc')](function(_0x32d760){logger[_0x800a('0xd')](_0x800a('0xe'),_0x2ba30f,_0x800a('0xf'));logger[_0x800a('0x10')](_0x800a('0x11'),_0x2ba30f,_0x800a('0xf'),JSON[_0x800a('0x12')](_0x32d760));if(_0x32d760[_0x800a('0x13')]){if(_0x32d760[_0x800a('0x13')][_0x800a('0x14')]===0x1f4){logger['error'](_0x800a('0xe'),_0x2ba30f,_0x32d760[_0x800a('0x13')][_0x800a('0x15')]);return _0x2dc1ff(_0x32d760[_0x800a('0x13')][_0x800a('0x15')]);}logger['error'](_0x800a('0xe'),_0x2ba30f,_0x32d760['error'][_0x800a('0x15')]);return _0xe84532(_0x32d760[_0x800a('0x13')][_0x800a('0x15')]);}else{logger[_0x800a('0xd')](_0x800a('0xe'),_0x2ba30f,_0x800a('0xf'));_0xe84532(_0x32d760['result'][_0x800a('0x15')]);}})['catch'](function(_0x12c261){logger[_0x800a('0x13')](_0x800a('0xe'),_0x2ba30f,_0x12c261);_0x2dc1ff(_0x12c261);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 69790fa..ebcad18 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 _0x20f4=['/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','/:id/logo','single','addLogo','%s%s','logologin','file','addLogoLogin','preferred','addPreferred','addFavicon','put','/:id','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x35e60e,_0x523db2){var _0x1a5b5e=function(_0x1c6900){while(--_0x1c6900){_0x35e60e['push'](_0x35e60e['shift']());}};_0x1a5b5e(++_0x523db2);}(_0x20f4,0x13d));var _0x420f=function(_0x5b7a30,_0x3b8bfe){_0x5b7a30=_0x5b7a30-0x0;var _0x24f81b=_0x20f4[_0x5b7a30];return _0x24f81b;};'use strict';var multer=require(_0x420f('0x0'));var util=require(_0x420f('0x1'));var path=require(_0x420f('0x2'));var timeout=require('connect-timeout');var express=require(_0x420f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x420f('0x4'));var interaction=require(_0x420f('0x5'));var config=require(_0x420f('0x6'));var controller=require(_0x420f('0x7'));router[_0x420f('0x8')]('/',auth[_0x420f('0x9')](),controller[_0x420f('0xa')]);router['get']('/now',controller['getDate']);router[_0x420f('0x8')]('/:id',controller[_0x420f('0xb')]);router[_0x420f('0x8')]('/:id/logo',controller[_0x420f('0xc')]);router[_0x420f('0x8')](_0x420f('0xd'),controller[_0x420f('0xe')]);router[_0x420f('0x8')](_0x420f('0xf'),controller[_0x420f('0x10')]);router[_0x420f('0x8')](_0x420f('0x11'),controller[_0x420f('0x12')]);router[_0x420f('0x8')](_0x420f('0x13'),controller[_0x420f('0x14')]);var upload=multer({'storage':multer[_0x420f('0x15')]({'destination':function(_0x33d911,_0x428e85,_0x5f5133){_0x5f5133(null,path[_0x420f('0x16')](config[_0x420f('0x17')],_0x420f('0x18')));},'filename':function(_0x27c486,_0xc0b4c0,_0x854ae7){_0x854ae7(null,util[_0x420f('0x19')]('%s%s',_0x420f('0x1a'),path[_0x420f('0x1b')](_0xc0b4c0[_0x420f('0x1c')])));}})});router[_0x420f('0x1d')](_0x420f('0x1e'),upload[_0x420f('0x1f')]('file'),controller[_0x420f('0x20')]);var upload=multer({'storage':multer[_0x420f('0x15')]({'destination':function(_0x57656b,_0x2594b3,_0x2440d4){_0x2440d4(null,path[_0x420f('0x16')](config['root'],_0x420f('0x18')));},'filename':function(_0x1b32f3,_0x526012,_0x26a669){_0x26a669(null,util[_0x420f('0x19')](_0x420f('0x21'),_0x420f('0x22'),path['extname'](_0x526012[_0x420f('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0x420f('0x1f')](_0x420f('0x23')),controller[_0x420f('0x24')]);var upload=multer({'storage':multer[_0x420f('0x15')]({'destination':function(_0x1071bd,_0x331fe3,_0x2e8473){_0x2e8473(null,path[_0x420f('0x16')](config['root'],_0x420f('0x18')));},'filename':function(_0x50aa68,_0x302a5a,_0x6118f2){_0x6118f2(null,util[_0x420f('0x19')](_0x420f('0x21'),_0x420f('0x25'),path['extname'](_0x302a5a[_0x420f('0x1c')])));}})});router[_0x420f('0x1d')](_0x420f('0x11'),upload[_0x420f('0x1f')](_0x420f('0x23')),controller[_0x420f('0x26')]);var upload=multer({'storage':multer[_0x420f('0x15')]({'destination':function(_0x5a8c9c,_0xab0465,_0x1638ed){_0x1638ed(null,path['join'](config[_0x420f('0x17')],_0x420f('0x18')));},'filename':function(_0x902fc9,_0x16268b,_0x3f6d03){_0x3f6d03(null,util[_0x420f('0x19')](_0x420f('0x21'),'favicon',path[_0x420f('0x1b')](_0x16268b[_0x420f('0x1c')])));}})});router[_0x420f('0x1d')](_0x420f('0x13'),upload[_0x420f('0x1f')](_0x420f('0x23')),controller[_0x420f('0x27')]);router[_0x420f('0x28')](_0x420f('0x29'),auth[_0x420f('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x09de=['/:id/logo_login','getLogoLogin','/:id/favicon','join','root','%s%s','logo','post','single','file','addLogo','diskStorage','server/files/images/logos/','originalname','addLogoLogin','format','preferred','extname','/:id/preferred','favicon','addFavicon','put','/:id','update','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','get','/now','getDate','/:id/logo','getLogo'];(function(_0xaa0f1,_0x5c0217){var _0x1ba692=function(_0x4d468f){while(--_0x4d468f){_0xaa0f1['push'](_0xaa0f1['shift']());}};_0x1ba692(++_0x5c0217);}(_0x09de,0x65));var _0xe09d=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x09de[_0x237da8];return _0x558825;};'use strict';var multer=require(_0xe09d('0x0'));var util=require(_0xe09d('0x1'));var path=require(_0xe09d('0x2'));var timeout=require(_0xe09d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe09d('0x4'));var interaction=require(_0xe09d('0x5'));var config=require('../../config/environment');var controller=require(_0xe09d('0x6'));router['get']('/',auth[_0xe09d('0x7')](),controller['index']);router[_0xe09d('0x8')](_0xe09d('0x9'),controller[_0xe09d('0xa')]);router[_0xe09d('0x8')]('/:id',controller['show']);router[_0xe09d('0x8')](_0xe09d('0xb'),controller[_0xe09d('0xc')]);router[_0xe09d('0x8')](_0xe09d('0xd'),controller[_0xe09d('0xe')]);router[_0xe09d('0x8')]('/:id/gdpr',controller['gdpr']);router[_0xe09d('0x8')]('/:id/preferred',controller['getPreferred']);router['get'](_0xe09d('0xf'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5f0c26,_0x537e58,_0x408a9b){_0x408a9b(null,path[_0xe09d('0x10')](config[_0xe09d('0x11')],'server/files/images/logos/'));},'filename':function(_0x5443b6,_0x1c2567,_0x427be7){_0x427be7(null,util['format'](_0xe09d('0x12'),_0xe09d('0x13'),path['extname'](_0x1c2567['originalname'])));}})});router[_0xe09d('0x14')]('/:id/logo',upload[_0xe09d('0x15')](_0xe09d('0x16')),controller[_0xe09d('0x17')]);var upload=multer({'storage':multer[_0xe09d('0x18')]({'destination':function(_0x1b37d2,_0x57255b,_0x380981){_0x380981(null,path['join'](config['root'],_0xe09d('0x19')));},'filename':function(_0x45d9ac,_0x37b555,_0x4f2764){_0x4f2764(null,util['format'](_0xe09d('0x12'),'logologin',path['extname'](_0x37b555[_0xe09d('0x1a')])));}})});router[_0xe09d('0x14')]('/:id/logo_login',upload['single'](_0xe09d('0x16')),controller[_0xe09d('0x1b')]);var upload=multer({'storage':multer[_0xe09d('0x18')]({'destination':function(_0x482386,_0x3e83a0,_0x2abfc8){_0x2abfc8(null,path['join'](config[_0xe09d('0x11')],_0xe09d('0x19')));},'filename':function(_0x4b9dbf,_0x34f555,_0x108fb3){_0x108fb3(null,util[_0xe09d('0x1c')](_0xe09d('0x12'),_0xe09d('0x1d'),path[_0xe09d('0x1e')](_0x34f555['originalname'])));}})});router[_0xe09d('0x14')](_0xe09d('0x1f'),upload[_0xe09d('0x15')](_0xe09d('0x16')),controller['addPreferred']);var upload=multer({'storage':multer[_0xe09d('0x18')]({'destination':function(_0x59593f,_0x4f4f49,_0x2c52f5){_0x2c52f5(null,path[_0xe09d('0x10')](config[_0xe09d('0x11')],_0xe09d('0x19')));},'filename':function(_0xc8d54f,_0x2d3526,_0x414174){_0x414174(null,util[_0xe09d('0x1c')](_0xe09d('0x12'),_0xe09d('0x20'),path[_0xe09d('0x1e')](_0x2d3526['originalname'])));}})});router[_0xe09d('0x14')](_0xe09d('0xf'),upload[_0xe09d('0x15')](_0xe09d('0x16')),controller[_0xe09d('0x21')]);router[_0xe09d('0x22')](_0xe09d('0x23'),auth[_0xe09d('0x7')](),controller[_0xe09d('0x24')]);module[_0xe09d('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a4dc71f..95c4079 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 _0x315f=['UNSIGNED','sequelize','INTEGER','min_mailbox','BOOLEAN','STRING','alternate'];(function(_0x4f1998,_0x305ab1){var _0xbe9716=function(_0xe0dbc){while(--_0xe0dbc){_0x4f1998['push'](_0x4f1998['shift']());}};_0xbe9716(++_0x305ab1);}(_0x315f,0x174));var _0xf315=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x315f[_0x2d4661];return _0x42ed1e;};'use strict';var Sequelize=require(_0xf315('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xf315('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xf315('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf315('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf315('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xf315('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf315('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf315('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf315('0x5')},'chatTimeout':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf315('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf315('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf315('0x1')]},'transcribeRegion':{'type':Sequelize[_0xf315('0x4')]},'sentiment':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf315('0x1')]},'sentimentRegion':{'type':Sequelize[_0xf315('0x4')]},'language':{'type':Sequelize[_0xf315('0x4')]},'bucket':{'type':Sequelize[_0xf315('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xf315('0x3')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf315('0x1')](0x2)[_0xf315('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf315('0x1')](0x2)[_0xf315('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf315('0x1')](0x2)[_0xf315('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xf315('0x1')](0x2)[_0xf315('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xf315('0x3')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xf315('0x1')],'defaultValue':0x14}}; \ No newline at end of file +var _0x17bb=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x13e28f,_0x2e9f9d){var _0x54df67=function(_0x568747){while(--_0x568747){_0x13e28f['push'](_0x13e28f['shift']());}};_0x54df67(++_0x2e9f9d);}(_0x17bb,0x188));var _0xb17b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x17bb[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xb17b('0x0'));module[_0xb17b('0x1')]={'min_internal':{'type':Sequelize[_0xb17b('0x2')](0xb),'unique':_0xb17b('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb17b('0x2')](0xb),'unique':_0xb17b('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb17b('0x5')],'defaultValue':_0xb17b('0x6')},'logo':{'type':Sequelize[_0xb17b('0x5')]},'defaultLogo':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xb17b('0x5')]},'turnusername':{'type':Sequelize[_0xb17b('0x5')]},'turnpassword':{'type':Sequelize[_0xb17b('0x5')]},'pageTitle':{'type':Sequelize[_0xb17b('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb17b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb17b('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb17b('0x5')]},'defaultPreferred':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xb17b('0x5')]},'sentiment':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb17b('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb17b('0x5')]},'bucket':{'type':Sequelize[_0xb17b('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb17b('0x2')](0x2)[_0xb17b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xb17b('0x2')](0x2)[_0xb17b('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xb17b('0x2')](0x2)[_0xb17b('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xb17b('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xb17b('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xb17b('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xb17b('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 c7dd30f..7be94f2 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 _0x3ed9=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','update','destroy','end','stack','name','send','map','Setting','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','rawAttributes','find','body','params','addLogo','file','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','join','toLower','root','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLicense','defaultLogo','defaultFavicon','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','filename','getPreferred','default_preferred.png','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3ed9,0xe0));var _0x93ed=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x3ed9[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0x93ed('0x0'));var rimraf=require(_0x93ed('0x1'));var zipdir=require(_0x93ed('0x2'));var jsonpatch=require(_0x93ed('0x3'));var rp=require(_0x93ed('0x4'));var moment=require(_0x93ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x93ed('0x6'));var util=require('util');var path=require(_0x93ed('0x7'));var sox=require(_0x93ed('0x8'));var csv=require(_0x93ed('0x9'));var ejs=require(_0x93ed('0xa'));var fs=require('fs');var fs_extra=require(_0x93ed('0xb'));var _=require(_0x93ed('0xc'));var squel=require(_0x93ed('0xd'));var crypto=require('crypto');var jsforce=require(_0x93ed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x93ed('0x9'));var querystring=require(_0x93ed('0xf'));var Papa=require('papaparse');var Redis=require(_0x93ed('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x93ed('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x93ed('0x12'));var utils=require(_0x93ed('0x13'));var config=require(_0x93ed('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x93ed('0x15'));var client=jayson[_0x93ed('0x16')][_0x93ed('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x18f7fc,_0x38d3f4,_0x499db8,_0x5beccb){return new BPromise(function(_0x230489,_0x3b0166){var _0x46f543=_0x5beccb||client;return _0x46f543[_0x93ed('0x18')](_0x18f7fc,_0x499db8)[_0x93ed('0x19')](function(_0x453c4d){logger[_0x93ed('0x1a')](_0x93ed('0x1b'),_0x38d3f4,_0x93ed('0x1c'));logger[_0x93ed('0x1d')](_0x93ed('0x1e'),_0x38d3f4,_0x93ed('0x1c'),JSON[_0x93ed('0x1f')](_0x453c4d));if(_0x453c4d[_0x93ed('0x20')]){if(_0x453c4d['error']['code']===0x1f4){logger[_0x93ed('0x20')]('Setting,\x20%s,\x20%s',_0x38d3f4,_0x453c4d[_0x93ed('0x20')][_0x93ed('0x21')]);return _0x3b0166(_0x453c4d[_0x93ed('0x20')][_0x93ed('0x21')]);}logger['error'](_0x93ed('0x1b'),_0x38d3f4,_0x453c4d[_0x93ed('0x20')][_0x93ed('0x21')]);return _0x230489(_0x453c4d[_0x93ed('0x20')]['message']);}else{logger[_0x93ed('0x1a')](_0x93ed('0x1b'),_0x38d3f4,_0x93ed('0x1c'));_0x230489(_0x453c4d['result'][_0x93ed('0x21')]);}})[_0x93ed('0x22')](function(_0x275104){logger[_0x93ed('0x20')](_0x93ed('0x1b'),_0x38d3f4,_0x275104);_0x3b0166(_0x275104);});});}function respondWithStatusCode(_0x491925,_0x41d0c0){_0x41d0c0=_0x41d0c0||0xcc;return function(_0x1707b5){if(_0x1707b5){return _0x491925[_0x93ed('0x23')](_0x41d0c0);}return _0x491925[_0x93ed('0x24')](_0x41d0c0)['end']();};}function respondWithResult(_0x28c8b4,_0x273077){_0x273077=_0x273077||0xc8;return function(_0x2c69c8){if(_0x2c69c8){return _0x28c8b4[_0x93ed('0x24')](_0x273077)[_0x93ed('0x25')](_0x2c69c8);}};}function respondWithFilteredResult(_0x4cc549,_0x4d70da){return function(_0x1d6e9c){if(_0x1d6e9c){var _0x1522ae=typeof _0x4d70da['offset']===_0x93ed('0x26')&&typeof _0x4d70da['limit']===_0x93ed('0x26');var _0x452921=_0x1d6e9c[_0x93ed('0x27')];var _0x402119=_0x1522ae?0x0:_0x4d70da[_0x93ed('0x28')];var _0x17ae93=_0x1522ae?_0x1d6e9c[_0x93ed('0x27')]:_0x4d70da[_0x93ed('0x28')]+_0x4d70da[_0x93ed('0x29')];var _0x5de789;if(_0x17ae93>=_0x452921){_0x17ae93=_0x452921;_0x5de789=0xc8;}else{_0x5de789=0xce;}_0x4cc549[_0x93ed('0x24')](_0x5de789);return _0x4cc549['set'](_0x93ed('0x2a'),_0x402119+'-'+_0x17ae93+'/'+_0x452921)[_0x93ed('0x25')](_0x1d6e9c);}return null;};}function patchUpdates(_0x2338a0){return function(_0x1b4b07){try{jsonpatch['apply'](_0x1b4b07,_0x2338a0,!![]);}catch(_0x43f18c){return BPromise[_0x93ed('0x2b')](_0x43f18c);}return _0x1b4b07['save']();};}function saveUpdates(_0x2f4e4e,_0x37c431){return function(_0x13a7b7){if(_0x13a7b7){return _0x13a7b7[_0x93ed('0x2c')](_0x2f4e4e)[_0x93ed('0x19')](function(_0x11133e){return _0x11133e;});}return null;};}function removeEntity(_0x5b1074,_0x4f829d){return function(_0x1f0265){if(_0x1f0265){return _0x1f0265[_0x93ed('0x2d')]()['then'](function(){_0x5b1074[_0x93ed('0x24')](0xcc)[_0x93ed('0x2e')]();});}};}function handleEntityNotFound(_0x16e85a,_0x46afd8){return function(_0x31959d){if(!_0x31959d){_0x16e85a[_0x93ed('0x23')](0x194);}return _0x31959d;};}function handleError(_0x4becc9,_0x1374f3){_0x1374f3=_0x1374f3||0x1f4;return function(_0x335b96){logger[_0x93ed('0x20')](_0x335b96[_0x93ed('0x2f')]);if(_0x335b96[_0x93ed('0x30')]){delete _0x335b96['name'];}_0x4becc9[_0x93ed('0x24')](_0x1374f3)[_0x93ed('0x31')](_0x335b96);};}exports['index']=function(_0x5782e6,_0x16c959){var _0x4db99a={},_0x2cfe0e={},_0x435b5e={'count':0x0,'rows':[]};var _0x272221=_[_0x93ed('0x32')](db[_0x93ed('0x33')]['rawAttributes'],function(_0x4c2736){return{'name':_0x4c2736[_0x93ed('0x34')],'type':_0x4c2736[_0x93ed('0x35')]['key']};});_0x2cfe0e[_0x93ed('0x36')]=_[_0x93ed('0x32')](_0x272221,_0x93ed('0x30'));_0x2cfe0e[_0x93ed('0x37')]=_['keys'](_0x5782e6['query']);_0x2cfe0e[_0x93ed('0x38')]=_[_0x93ed('0x39')](_0x2cfe0e[_0x93ed('0x36')],_0x2cfe0e['query']);_0x4db99a[_0x93ed('0x3a')]=_[_0x93ed('0x39')](_0x2cfe0e[_0x93ed('0x36')],qs[_0x93ed('0x3b')](_0x5782e6[_0x93ed('0x37')][_0x93ed('0x3b')]));_0x4db99a[_0x93ed('0x3a')]=_0x4db99a[_0x93ed('0x3a')][_0x93ed('0x3c')]?_0x4db99a[_0x93ed('0x3a')]:_0x2cfe0e[_0x93ed('0x36')];if(!_0x5782e6[_0x93ed('0x37')]['hasOwnProperty']('nolimit')){_0x4db99a[_0x93ed('0x29')]=qs[_0x93ed('0x29')](_0x5782e6['query']['limit']);_0x4db99a[_0x93ed('0x28')]=qs[_0x93ed('0x28')](_0x5782e6[_0x93ed('0x37')][_0x93ed('0x28')]);}_0x4db99a[_0x93ed('0x3d')]=qs['sort'](_0x5782e6[_0x93ed('0x37')]['sort']);_0x4db99a[_0x93ed('0x3e')]=qs[_0x93ed('0x38')](_[_0x93ed('0x3f')](_0x5782e6['query'],_0x2cfe0e[_0x93ed('0x38')]),_0x272221);if(_0x5782e6['query'][_0x93ed('0x40')]){_0x4db99a['where']=_[_0x93ed('0x41')](_0x4db99a[_0x93ed('0x3e')],{'$or':_[_0x93ed('0x32')](_0x272221,function(_0x525bb4){if(_0x525bb4['type']!==_0x93ed('0x42')){var _0x32d0a5={};_0x32d0a5[_0x525bb4['name']]={'$like':'%'+_0x5782e6[_0x93ed('0x37')]['filter']+'%'};return _0x32d0a5;}})});}_0x4db99a=_['merge']({},_0x4db99a,_0x5782e6[_0x93ed('0x43')]);var _0x149f9c={'where':_0x4db99a[_0x93ed('0x3e')]};return db['Setting'][_0x93ed('0x27')](_0x149f9c)[_0x93ed('0x19')](function(_0x23bbeb){_0x435b5e[_0x93ed('0x27')]=_0x23bbeb;if(_0x5782e6[_0x93ed('0x37')][_0x93ed('0x44')]){_0x4db99a[_0x93ed('0x45')]=[{'all':!![]}];}return db[_0x93ed('0x33')]['findAll'](_0x4db99a);})[_0x93ed('0x19')](function(_0x46b511){_0x435b5e[_0x93ed('0x46')]=_0x46b511;return _0x435b5e;})['then'](respondWithFilteredResult(_0x16c959,_0x4db99a))['catch'](handleError(_0x16c959,null));};exports[_0x93ed('0x47')]=function(_0x9964f1,_0x345471){var _0x3f8f45={'raw':![],'where':{'id':_0x9964f1['params']['id']}},_0x28fd61={};_0x28fd61['model']=_[_0x93ed('0x48')](db[_0x93ed('0x33')][_0x93ed('0x49')]);_0x28fd61[_0x93ed('0x37')]=_[_0x93ed('0x48')](_0x9964f1[_0x93ed('0x37')]);_0x28fd61['filters']=_[_0x93ed('0x39')](_0x28fd61[_0x93ed('0x36')],_0x28fd61[_0x93ed('0x37')]);_0x3f8f45['attributes']=_['intersection'](_0x28fd61[_0x93ed('0x36')],qs[_0x93ed('0x3b')](_0x9964f1['query'][_0x93ed('0x3b')]));_0x3f8f45[_0x93ed('0x3a')]=_0x3f8f45[_0x93ed('0x3a')][_0x93ed('0x3c')]?_0x3f8f45[_0x93ed('0x3a')]:_0x28fd61[_0x93ed('0x36')];if(_0x9964f1[_0x93ed('0x37')]['includeAll']){_0x3f8f45[_0x93ed('0x45')]=[{'all':!![]}];}_0x3f8f45=_['merge']({},_0x3f8f45,_0x9964f1[_0x93ed('0x43')]);return db['Setting'][_0x93ed('0x4a')](_0x3f8f45)[_0x93ed('0x19')](handleEntityNotFound(_0x345471,null))[_0x93ed('0x19')](respondWithResult(_0x345471,null))[_0x93ed('0x22')](handleError(_0x345471,null));};exports['update']=function(_0x394180,_0x3a337a){if(_0x394180[_0x93ed('0x4b')]['id']){delete _0x394180[_0x93ed('0x4b')]['id'];}return db[_0x93ed('0x33')][_0x93ed('0x4a')]({'where':{'id':_0x394180[_0x93ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3a337a,null))[_0x93ed('0x19')](saveUpdates(_0x394180['body'],null))[_0x93ed('0x19')](respondWithResult(_0x3a337a,null))[_0x93ed('0x22')](handleError(_0x3a337a,null));};exports[_0x93ed('0x4d')]=function(_0x3a508d,_0x48af3e,_0x2970bf){if(_0x3a508d[_0x93ed('0x4e')]&&_0x3a508d[_0x93ed('0x4e')]['filename']){_0x3a508d[_0x93ed('0x4b')]['logo']=_0x3a508d[_0x93ed('0x4e')]['filename'];}return db[_0x93ed('0x33')][_0x93ed('0x4a')]({'where':{'id':_0x3a508d[_0x93ed('0x4c')]['id']}})[_0x93ed('0x19')](handleEntityNotFound(_0x48af3e,null))['then'](saveUpdates(_0x3a508d[_0x93ed('0x4b')],null))['then'](respondWithResult(_0x48af3e,null))[_0x93ed('0x22')](handleError(_0x48af3e,null));};exports[_0x93ed('0x4f')]=function(_0x5c23fc,_0x28bed2,_0x3bd9ce){if(_0x5c23fc[_0x93ed('0x4e')]&&_0x5c23fc[_0x93ed('0x4e')]['filename']){_0x5c23fc[_0x93ed('0x4b')][_0x93ed('0x50')]=_0x5c23fc[_0x93ed('0x4e')]['filename'];}return db[_0x93ed('0x33')][_0x93ed('0x4a')]({'where':{'id':_0x5c23fc[_0x93ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28bed2,null))[_0x93ed('0x19')](saveUpdates(_0x5c23fc[_0x93ed('0x4b')],null))[_0x93ed('0x19')](respondWithResult(_0x28bed2,null))['catch'](handleError(_0x28bed2,null));};var utilLicense=require(_0x93ed('0x51'));exports[_0x93ed('0x52')]=function(_0x29e260,_0x1c52b9,_0x5700c2){var _0x371659=_0x93ed('0x53');var _0x2ec404={'custom':![]};return utilLicense['getLicense']()[_0x93ed('0x19')](function(_0x3d41a3){if(_0x3d41a3){_0x2ec404=_0x3d41a3;}return db[_0x93ed('0x33')][_0x93ed('0x4a')]({'where':{'id':_0x29e260[_0x93ed('0x4c')]['id']},'attributes':[_0x93ed('0x54'),_0x93ed('0x50'),_0x93ed('0x55'),_0x93ed('0x56'),'defaultLogo',_0x93ed('0x57'),_0x93ed('0x58'),'defaultFavicon'],'raw':!![]});})[_0x93ed('0x19')](handleEntityNotFound(_0x1c52b9,null))['then'](function(_0x20e2a5){if(_0x20e2a5){var _0x184f6a=_0x20e2a5[_0x93ed('0x54')]&&fs[_0x93ed('0x59')](path[_0x93ed('0x5a')](config['root'],_0x371659,_[_0x93ed('0x5b')](_0x20e2a5[_0x93ed('0x54')])))?path[_0x93ed('0x5a')](config[_0x93ed('0x5c')],_0x371659,_['toLower'](_0x20e2a5[_0x93ed('0x54')])):path[_0x93ed('0x5a')](config['root'],_0x371659,_['toLower'](_0x93ed('0x5d')));var _0x1cb7b6=_0x93ed('0x5e')+_['upperFirst'](_0x93ed('0x54'));if(_0x20e2a5[_0x1cb7b6]||!_0x2ec404[_0x93ed('0x5f')]){_0x184f6a=path[_0x93ed('0x5a')](config[_0x93ed('0x5c')],_0x371659,_[_0x93ed('0x5b')](_0x93ed('0x5d')));}if(!fs[_0x93ed('0x59')](_0x184f6a)){throw new db[(_0x93ed('0x60'))][(_0x93ed('0x61'))](_[_0x93ed('0x62')]('logo')+_0x93ed('0x63'));}return _0x1c52b9['download'](_0x184f6a);}})[_0x93ed('0x22')](handleError(_0x1c52b9,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x4265a9,_0x4844ee,_0x557534){var _0x443080=_0x93ed('0x53');var _0x4a82d2={'custom':![]};return utilLicense[_0x93ed('0x64')]()['then'](function(_0x5cceab){if(_0x5cceab){_0x4a82d2=_0x5cceab;}return db[_0x93ed('0x33')]['find']({'where':{'id':_0x4265a9[_0x93ed('0x4c')]['id']},'attributes':['logo',_0x93ed('0x50'),'preferred',_0x93ed('0x56'),_0x93ed('0x65'),'defaultLoginLogo','defaultPreferred',_0x93ed('0x66')],'raw':!![]});})['then'](handleEntityNotFound(_0x4844ee,null))[_0x93ed('0x19')](function(_0x314bd9){if(_0x314bd9){var _0x429a3c=_0x314bd9[_0x93ed('0x50')]&&fs[_0x93ed('0x59')](path[_0x93ed('0x5a')](config['root'],_0x443080,_[_0x93ed('0x5b')](_0x314bd9[_0x93ed('0x50')])))?path[_0x93ed('0x5a')](config[_0x93ed('0x5c')],_0x443080,_[_0x93ed('0x5b')](_0x314bd9[_0x93ed('0x50')])):path[_0x93ed('0x5a')](config[_0x93ed('0x5c')],_0x443080,_['toLower'](_0x93ed('0x67')));var _0x2295f3=_0x93ed('0x5e')+_[_0x93ed('0x62')](_0x93ed('0x50'));if(_0x314bd9[_0x2295f3]||!_0x4a82d2['custom']){_0x429a3c=path[_0x93ed('0x5a')](config[_0x93ed('0x5c')],_0x443080,_[_0x93ed('0x5b')](_0x93ed('0x67')));}if(!fs[_0x93ed('0x59')](_0x429a3c)){throw new db[(_0x93ed('0x60'))][(_0x93ed('0x61'))](_[_0x93ed('0x62')](_0x93ed('0x50'))+_0x93ed('0x63'));}return _0x4844ee[_0x93ed('0x68')](_0x429a3c);}})[_0x93ed('0x22')](handleError(_0x4844ee,null));};exports[_0x93ed('0x69')]=function(_0x377b62,_0x4e67bb){return db[_0x93ed('0x33')]['find']({'where':{'id':_0x377b62[_0x93ed('0x4c')]['id']},'attributes':[_0x93ed('0x6a')]})[_0x93ed('0x19')](respondWithResult(_0x4e67bb,null))[_0x93ed('0x22')](handleError(_0x4e67bb,null));};exports[_0x93ed('0x6b')]=function(_0x4663e2,_0xdfe5ff,_0x19d335){if(_0x4663e2[_0x93ed('0x4e')]&&_0x4663e2[_0x93ed('0x4e')][_0x93ed('0x6c')]){_0x4663e2[_0x93ed('0x4b')][_0x93ed('0x55')]=_0x4663e2[_0x93ed('0x4e')]['filename'];}return db[_0x93ed('0x33')][_0x93ed('0x4a')]({'where':{'id':_0x4663e2[_0x93ed('0x4c')]['id']}})[_0x93ed('0x19')](handleEntityNotFound(_0xdfe5ff,null))['then'](saveUpdates(_0x4663e2[_0x93ed('0x4b')],null))[_0x93ed('0x19')](respondWithResult(_0xdfe5ff,null))[_0x93ed('0x22')](handleError(_0xdfe5ff,null));};var utilLicense=require(_0x93ed('0x51'));exports[_0x93ed('0x6d')]=function(_0x2fd866,_0x3003fa,_0x2e287a){var _0x3f44f0=_0x93ed('0x53');var _0xff0376={'custom':![]};return utilLicense[_0x93ed('0x64')]()[_0x93ed('0x19')](function(_0x9d0d73){if(_0x9d0d73){_0xff0376=_0x9d0d73;}return db['Setting'][_0x93ed('0x4a')]({'where':{'id':_0x2fd866[_0x93ed('0x4c')]['id']},'attributes':[_0x93ed('0x54'),_0x93ed('0x50'),_0x93ed('0x55'),'favicon',_0x93ed('0x65'),_0x93ed('0x57'),_0x93ed('0x58'),_0x93ed('0x66')],'raw':!![]});})[_0x93ed('0x19')](handleEntityNotFound(_0x3003fa,null))[_0x93ed('0x19')](function(_0x1579e5){if(_0x1579e5){var _0x26c47f=_0x1579e5[_0x93ed('0x55')]&&fs['existsSync'](path['join'](config[_0x93ed('0x5c')],_0x3f44f0,_[_0x93ed('0x5b')](_0x1579e5[_0x93ed('0x55')])))?path['join'](config['root'],_0x3f44f0,_[_0x93ed('0x5b')](_0x1579e5[_0x93ed('0x55')])):path[_0x93ed('0x5a')](config[_0x93ed('0x5c')],_0x3f44f0,_[_0x93ed('0x5b')](_0x93ed('0x6e')));var _0x30ba39=_0x93ed('0x5e')+_[_0x93ed('0x62')](_0x93ed('0x55'));if(_0x1579e5[_0x30ba39]||!_0xff0376[_0x93ed('0x5f')]||!_0xff0376[_0x93ed('0x55')]){_0x26c47f=path[_0x93ed('0x5a')](config['root'],_0x3f44f0,_[_0x93ed('0x5b')](_0x93ed('0x6e')));}if(!fs[_0x93ed('0x59')](_0x26c47f)){throw new db['Sequelize'][(_0x93ed('0x61'))](_[_0x93ed('0x62')](_0x93ed('0x55'))+_0x93ed('0x63'));}return _0x3003fa[_0x93ed('0x68')](_0x26c47f);}})[_0x93ed('0x22')](handleError(_0x3003fa,null));};exports['addFavicon']=function(_0x32efd2,_0x3d8734,_0x207d63){if(_0x32efd2[_0x93ed('0x4e')]&&_0x32efd2[_0x93ed('0x4e')][_0x93ed('0x6c')]){_0x32efd2['body'][_0x93ed('0x56')]=_0x32efd2[_0x93ed('0x4e')][_0x93ed('0x6c')];}return db[_0x93ed('0x33')][_0x93ed('0x4a')]({'where':{'id':_0x32efd2[_0x93ed('0x4c')]['id']}})[_0x93ed('0x19')](handleEntityNotFound(_0x3d8734,null))[_0x93ed('0x19')](saveUpdates(_0x32efd2[_0x93ed('0x4b')],null))[_0x93ed('0x19')](respondWithResult(_0x3d8734,null))[_0x93ed('0x22')](handleError(_0x3d8734,null));};var utilLicense=require(_0x93ed('0x51'));exports['getFavicon']=function(_0x2cfe4d,_0x512805,_0x45b595){var _0x192f29=_0x93ed('0x53');var _0x33bff3={'custom':![]};return utilLicense[_0x93ed('0x64')]()[_0x93ed('0x19')](function(_0x89b8c6){if(_0x89b8c6){_0x33bff3=_0x89b8c6;}return db[_0x93ed('0x33')][_0x93ed('0x4a')]({'where':{'id':_0x2cfe4d[_0x93ed('0x4c')]['id']},'attributes':[_0x93ed('0x54'),_0x93ed('0x50'),_0x93ed('0x55'),_0x93ed('0x56'),_0x93ed('0x65'),_0x93ed('0x57'),_0x93ed('0x58'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x512805,null))[_0x93ed('0x19')](function(_0x296e6a){if(_0x296e6a){var _0x22e56f=_0x296e6a[_0x93ed('0x56')]&&fs['existsSync'](path[_0x93ed('0x5a')](config['root'],_0x192f29,_[_0x93ed('0x5b')](_0x296e6a[_0x93ed('0x56')])))?path['join'](config[_0x93ed('0x5c')],_0x192f29,_[_0x93ed('0x5b')](_0x296e6a[_0x93ed('0x56')])):path['join'](config[_0x93ed('0x5c')],_0x192f29,_['toLower'](_0x93ed('0x6f')));var _0x554558=_0x93ed('0x5e')+_[_0x93ed('0x62')](_0x93ed('0x56'));if(_0x296e6a[_0x554558]||!_0x33bff3[_0x93ed('0x5f')]){_0x22e56f=path[_0x93ed('0x5a')](config['root'],_0x192f29,_[_0x93ed('0x5b')](_0x93ed('0x6f')));}if(!fs['existsSync'](_0x22e56f)){throw new db['Sequelize'][(_0x93ed('0x61'))](_[_0x93ed('0x62')](_0x93ed('0x56'))+_0x93ed('0x63'));}return _0x512805[_0x93ed('0x68')](_0x22e56f);}})[_0x93ed('0x22')](handleError(_0x512805,null));};exports[_0x93ed('0x70')]=function(_0x458a9f,_0x22e695){var _0x1a8e1c={'offset':moment()['utcOffset']()};_0x1a8e1c[_0x93ed('0x71')]=moment()['utcOffset'](_0x1a8e1c[_0x93ed('0x28')])[_0x93ed('0x72')](_0x93ed('0x73'));return _0x22e695['status'](0xc8)[_0x93ed('0x31')](_0x1a8e1c);}; \ No newline at end of file +var _0xc698=['params','length','find','body','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','loginLogo','favicon','defaultLogo','default_loginLogo.svg','download','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','then','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','end','status','json','offset','limit','count','Content-Range','apply','save','update','destroy','sendStatus','map','Setting','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show'];(function(_0x3b7186,_0x425972){var _0x3286fb=function(_0x2d3e51){while(--_0x2d3e51){_0x3b7186['push'](_0x3b7186['shift']());}};_0x3286fb(++_0x425972);}(_0xc698,0x116));var _0x8c69=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0xc698[_0xf168d3];return _0x17fb54;};'use strict';var emlformat=require(_0x8c69('0x0'));var rimraf=require(_0x8c69('0x1'));var zipdir=require(_0x8c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c69('0x3'));var moment=require(_0x8c69('0x4'));var BPromise=require(_0x8c69('0x5'));var Mustache=require('mustache');var util=require(_0x8c69('0x6'));var path=require('path');var sox=require(_0x8c69('0x7'));var csv=require(_0x8c69('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c69('0x9'));var squel=require(_0x8c69('0xa'));var crypto=require(_0x8c69('0xb'));var jsforce=require(_0x8c69('0xc'));var deskjs=require(_0x8c69('0xd'));var toCsv=require(_0x8c69('0x8'));var querystring=require(_0x8c69('0xe'));var Papa=require(_0x8c69('0xf'));var Redis=require(_0x8c69('0x10'));var authService=require(_0x8c69('0x11'));var qs=require(_0x8c69('0x12'));var as=require(_0x8c69('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c69('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8c69('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c69('0x16'))['db'];var jayson=require(_0x8c69('0x17'));var client=jayson['client'][_0x8c69('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xf601dd,_0x512367,_0x3c30ac,_0x50fceb){return new BPromise(function(_0x46fe8b,_0x1b8825){var _0x4d9cf8=_0x50fceb||client;return _0x4d9cf8['request'](_0xf601dd,_0x3c30ac)[_0x8c69('0x19')](function(_0x4f9ad8){logger['info'](_0x8c69('0x1a'),_0x512367,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x512367,_0x8c69('0x1b'),JSON[_0x8c69('0x1c')](_0x4f9ad8));if(_0x4f9ad8[_0x8c69('0x1d')]){if(_0x4f9ad8[_0x8c69('0x1d')]['code']===0x1f4){logger[_0x8c69('0x1d')](_0x8c69('0x1a'),_0x512367,_0x4f9ad8['error'][_0x8c69('0x1e')]);return _0x1b8825(_0x4f9ad8[_0x8c69('0x1d')][_0x8c69('0x1e')]);}logger[_0x8c69('0x1d')](_0x8c69('0x1a'),_0x512367,_0x4f9ad8[_0x8c69('0x1d')]['message']);return _0x46fe8b(_0x4f9ad8['error']['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x512367,'request\x20sent');_0x46fe8b(_0x4f9ad8['result'][_0x8c69('0x1e')]);}})[_0x8c69('0x1f')](function(_0x3b5b0d){logger[_0x8c69('0x1d')]('Setting,\x20%s,\x20%s',_0x512367,_0x3b5b0d);_0x1b8825(_0x3b5b0d);});});}function respondWithStatusCode(_0x5c1bd7,_0x3f8895){_0x3f8895=_0x3f8895||0xcc;return function(_0x249800){if(_0x249800){return _0x5c1bd7['sendStatus'](_0x3f8895);}return _0x5c1bd7['status'](_0x3f8895)[_0x8c69('0x20')]();};}function respondWithResult(_0x4d2c30,_0x17d698){_0x17d698=_0x17d698||0xc8;return function(_0x29b9b0){if(_0x29b9b0){return _0x4d2c30[_0x8c69('0x21')](_0x17d698)[_0x8c69('0x22')](_0x29b9b0);}};}function respondWithFilteredResult(_0x2d76c7,_0x22ac6c){return function(_0xe06835){if(_0xe06835){var _0x534b8c=typeof _0x22ac6c[_0x8c69('0x23')]==='undefined'&&typeof _0x22ac6c[_0x8c69('0x24')]==='undefined';var _0x3057d8=_0xe06835[_0x8c69('0x25')];var _0x479bd6=_0x534b8c?0x0:_0x22ac6c[_0x8c69('0x23')];var _0x131106=_0x534b8c?_0xe06835[_0x8c69('0x25')]:_0x22ac6c['offset']+_0x22ac6c[_0x8c69('0x24')];var _0x2322dc;if(_0x131106>=_0x3057d8){_0x131106=_0x3057d8;_0x2322dc=0xc8;}else{_0x2322dc=0xce;}_0x2d76c7[_0x8c69('0x21')](_0x2322dc);return _0x2d76c7['set'](_0x8c69('0x26'),_0x479bd6+'-'+_0x131106+'/'+_0x3057d8)[_0x8c69('0x22')](_0xe06835);}return null;};}function patchUpdates(_0x4d3b74){return function(_0x58ce66){try{jsonpatch[_0x8c69('0x27')](_0x58ce66,_0x4d3b74,!![]);}catch(_0x545468){return BPromise['reject'](_0x545468);}return _0x58ce66[_0x8c69('0x28')]();};}function saveUpdates(_0x35ef39,_0x4e02f9){return function(_0x4beb68){if(_0x4beb68){return _0x4beb68[_0x8c69('0x29')](_0x35ef39)[_0x8c69('0x19')](function(_0x4c6c9f){return _0x4c6c9f;});}return null;};}function removeEntity(_0x4f5b3a,_0x1cbb42){return function(_0x5448cb){if(_0x5448cb){return _0x5448cb[_0x8c69('0x2a')]()[_0x8c69('0x19')](function(){_0x4f5b3a[_0x8c69('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28f646,_0x24fd59){return function(_0x3d2b8a){if(!_0x3d2b8a){_0x28f646[_0x8c69('0x2b')](0x194);}return _0x3d2b8a;};}function handleError(_0xead370,_0x1477a8){_0x1477a8=_0x1477a8||0x1f4;return function(_0x53c7f7){logger[_0x8c69('0x1d')](_0x53c7f7['stack']);if(_0x53c7f7['name']){delete _0x53c7f7['name'];}_0xead370['status'](_0x1477a8)['send'](_0x53c7f7);};}exports['index']=function(_0x142b59,_0x4f1a91){var _0x531b7f={},_0x1e2a2b={},_0x46d2fe={'count':0x0,'rows':[]};var _0x339ed4=_[_0x8c69('0x2c')](db[_0x8c69('0x2d')]['rawAttributes'],function(_0xd1bba1){return{'name':_0xd1bba1['fieldName'],'type':_0xd1bba1[_0x8c69('0x2e')][_0x8c69('0x2f')]};});_0x1e2a2b[_0x8c69('0x30')]=_[_0x8c69('0x2c')](_0x339ed4,_0x8c69('0x31'));_0x1e2a2b[_0x8c69('0x32')]=_[_0x8c69('0x33')](_0x142b59['query']);_0x1e2a2b[_0x8c69('0x34')]=_[_0x8c69('0x35')](_0x1e2a2b[_0x8c69('0x30')],_0x1e2a2b[_0x8c69('0x32')]);_0x531b7f['attributes']=_[_0x8c69('0x35')](_0x1e2a2b[_0x8c69('0x30')],qs['fields'](_0x142b59['query'][_0x8c69('0x36')]));_0x531b7f[_0x8c69('0x37')]=_0x531b7f[_0x8c69('0x37')]['length']?_0x531b7f[_0x8c69('0x37')]:_0x1e2a2b[_0x8c69('0x30')];if(!_0x142b59[_0x8c69('0x32')][_0x8c69('0x38')](_0x8c69('0x39'))){_0x531b7f['limit']=qs[_0x8c69('0x24')](_0x142b59[_0x8c69('0x32')][_0x8c69('0x24')]);_0x531b7f['offset']=qs[_0x8c69('0x23')](_0x142b59['query'][_0x8c69('0x23')]);}_0x531b7f[_0x8c69('0x3a')]=qs[_0x8c69('0x3b')](_0x142b59[_0x8c69('0x32')][_0x8c69('0x3b')]);_0x531b7f[_0x8c69('0x3c')]=qs['filters'](_[_0x8c69('0x3d')](_0x142b59[_0x8c69('0x32')],_0x1e2a2b[_0x8c69('0x34')]),_0x339ed4);if(_0x142b59[_0x8c69('0x32')][_0x8c69('0x3e')]){_0x531b7f[_0x8c69('0x3c')]=_[_0x8c69('0x3f')](_0x531b7f[_0x8c69('0x3c')],{'$or':_['map'](_0x339ed4,function(_0x1ddb02){if(_0x1ddb02[_0x8c69('0x2e')]!==_0x8c69('0x40')){var _0x15e990={};_0x15e990[_0x1ddb02['name']]={'$like':'%'+_0x142b59[_0x8c69('0x32')][_0x8c69('0x3e')]+'%'};return _0x15e990;}})});}_0x531b7f=_[_0x8c69('0x3f')]({},_0x531b7f,_0x142b59['options']);var _0xbf092b={'where':_0x531b7f[_0x8c69('0x3c')]};return db[_0x8c69('0x2d')][_0x8c69('0x25')](_0xbf092b)[_0x8c69('0x19')](function(_0x20cae2){_0x46d2fe[_0x8c69('0x25')]=_0x20cae2;if(_0x142b59['query'][_0x8c69('0x41')]){_0x531b7f[_0x8c69('0x42')]=[{'all':!![]}];}return db[_0x8c69('0x2d')][_0x8c69('0x43')](_0x531b7f);})[_0x8c69('0x19')](function(_0x15d61c){_0x46d2fe[_0x8c69('0x44')]=_0x15d61c;return _0x46d2fe;})['then'](respondWithFilteredResult(_0x4f1a91,_0x531b7f))['catch'](handleError(_0x4f1a91,null));};exports[_0x8c69('0x45')]=function(_0x54500c,_0x4713b6){var _0x151ff6={'raw':![],'where':{'id':_0x54500c[_0x8c69('0x46')]['id']}},_0x20dfbc={};_0x20dfbc[_0x8c69('0x30')]=_[_0x8c69('0x33')](db[_0x8c69('0x2d')]['rawAttributes']);_0x20dfbc[_0x8c69('0x32')]=_[_0x8c69('0x33')](_0x54500c[_0x8c69('0x32')]);_0x20dfbc[_0x8c69('0x34')]=_['intersection'](_0x20dfbc[_0x8c69('0x30')],_0x20dfbc[_0x8c69('0x32')]);_0x151ff6[_0x8c69('0x37')]=_['intersection'](_0x20dfbc['model'],qs[_0x8c69('0x36')](_0x54500c[_0x8c69('0x32')][_0x8c69('0x36')]));_0x151ff6[_0x8c69('0x37')]=_0x151ff6[_0x8c69('0x37')][_0x8c69('0x47')]?_0x151ff6[_0x8c69('0x37')]:_0x20dfbc[_0x8c69('0x30')];if(_0x54500c[_0x8c69('0x32')][_0x8c69('0x41')]){_0x151ff6[_0x8c69('0x42')]=[{'all':!![]}];}_0x151ff6=_['merge']({},_0x151ff6,_0x54500c['options']);return db[_0x8c69('0x2d')][_0x8c69('0x48')](_0x151ff6)[_0x8c69('0x19')](handleEntityNotFound(_0x4713b6,null))[_0x8c69('0x19')](respondWithResult(_0x4713b6,null))[_0x8c69('0x1f')](handleError(_0x4713b6,null));};exports[_0x8c69('0x29')]=function(_0x8f26e8,_0x14d1d8){if(_0x8f26e8[_0x8c69('0x49')]['id']){delete _0x8f26e8['body']['id'];}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x8f26e8['params']['id']}})[_0x8c69('0x19')](handleEntityNotFound(_0x14d1d8,null))[_0x8c69('0x19')](saveUpdates(_0x8f26e8[_0x8c69('0x49')],null))['then'](respondWithResult(_0x14d1d8,null))['catch'](handleError(_0x14d1d8,null));};exports[_0x8c69('0x4a')]=function(_0x49acf0,_0x22a2f1,_0x2e899e){if(_0x49acf0[_0x8c69('0x4b')]&&_0x49acf0[_0x8c69('0x4b')][_0x8c69('0x4c')]){_0x49acf0[_0x8c69('0x49')][_0x8c69('0x4d')]=_0x49acf0[_0x8c69('0x4b')][_0x8c69('0x4c')];}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x49acf0['params']['id']}})[_0x8c69('0x19')](handleEntityNotFound(_0x22a2f1,null))[_0x8c69('0x19')](saveUpdates(_0x49acf0['body'],null))[_0x8c69('0x19')](respondWithResult(_0x22a2f1,null))[_0x8c69('0x1f')](handleError(_0x22a2f1,null));};exports[_0x8c69('0x4e')]=function(_0x29e637,_0x3d2adc,_0x4ed8ff){if(_0x29e637[_0x8c69('0x4b')]&&_0x29e637['file'][_0x8c69('0x4c')]){_0x29e637[_0x8c69('0x49')]['loginLogo']=_0x29e637['file'][_0x8c69('0x4c')];}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x29e637[_0x8c69('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d2adc,null))['then'](saveUpdates(_0x29e637[_0x8c69('0x49')],null))[_0x8c69('0x19')](respondWithResult(_0x3d2adc,null))[_0x8c69('0x1f')](handleError(_0x3d2adc,null));};var utilLicense=require(_0x8c69('0x4f'));exports[_0x8c69('0x50')]=function(_0x4568d2,_0x225a36,_0x2ebfdb){var _0x20cc3f=_0x8c69('0x51');var _0x2ba094={'custom':![]};return utilLicense[_0x8c69('0x52')]()[_0x8c69('0x19')](function(_0x10a771){if(_0x10a771){_0x2ba094=_0x10a771;}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x4568d2[_0x8c69('0x46')]['id']},'attributes':[_0x8c69('0x4d'),'loginLogo',_0x8c69('0x53'),'favicon','defaultLogo',_0x8c69('0x54'),_0x8c69('0x55'),_0x8c69('0x56')],'raw':!![]});})[_0x8c69('0x19')](handleEntityNotFound(_0x225a36,null))['then'](function(_0x5d9221){if(_0x5d9221){var _0x16710f=_0x5d9221[_0x8c69('0x4d')]&&fs[_0x8c69('0x57')](path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x20cc3f,_[_0x8c69('0x5a')](_0x5d9221[_0x8c69('0x4d')])))?path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x20cc3f,_[_0x8c69('0x5a')](_0x5d9221[_0x8c69('0x4d')])):path['join'](config[_0x8c69('0x59')],_0x20cc3f,_[_0x8c69('0x5a')](_0x8c69('0x5b')));var _0x23ab32=_0x8c69('0x5c')+_[_0x8c69('0x5d')](_0x8c69('0x4d'));if(_0x5d9221[_0x23ab32]||!_0x2ba094[_0x8c69('0x5e')]){_0x16710f=path[_0x8c69('0x58')](config['root'],_0x20cc3f,_[_0x8c69('0x5a')](_0x8c69('0x5b')));}if(!fs['existsSync'](_0x16710f)){throw new db[(_0x8c69('0x5f'))][(_0x8c69('0x60'))](_[_0x8c69('0x5d')](_0x8c69('0x4d'))+_0x8c69('0x61'));}return _0x225a36['download'](_0x16710f);}})[_0x8c69('0x1f')](handleError(_0x225a36,null));};var utilLicense=require(_0x8c69('0x4f'));exports[_0x8c69('0x62')]=function(_0x2d2bb2,_0x4cce8f,_0x35b690){var _0x2ea2ab=_0x8c69('0x51');var _0x44354e={'custom':![]};return utilLicense[_0x8c69('0x52')]()[_0x8c69('0x19')](function(_0x3fb46d){if(_0x3fb46d){_0x44354e=_0x3fb46d;}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x2d2bb2[_0x8c69('0x46')]['id']},'attributes':[_0x8c69('0x4d'),_0x8c69('0x63'),_0x8c69('0x53'),_0x8c69('0x64'),_0x8c69('0x65'),_0x8c69('0x54'),_0x8c69('0x55'),_0x8c69('0x56')],'raw':!![]});})[_0x8c69('0x19')](handleEntityNotFound(_0x4cce8f,null))[_0x8c69('0x19')](function(_0x9b4d45){if(_0x9b4d45){var _0x46f363=_0x9b4d45[_0x8c69('0x63')]&&fs[_0x8c69('0x57')](path[_0x8c69('0x58')](config['root'],_0x2ea2ab,_[_0x8c69('0x5a')](_0x9b4d45[_0x8c69('0x63')])))?path[_0x8c69('0x58')](config['root'],_0x2ea2ab,_[_0x8c69('0x5a')](_0x9b4d45[_0x8c69('0x63')])):path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x2ea2ab,_['toLower'](_0x8c69('0x66')));var _0x5e0c84=_0x8c69('0x5c')+_[_0x8c69('0x5d')](_0x8c69('0x63'));if(_0x9b4d45[_0x5e0c84]||!_0x44354e[_0x8c69('0x5e')]){_0x46f363=path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x2ea2ab,_[_0x8c69('0x5a')](_0x8c69('0x66')));}if(!fs['existsSync'](_0x46f363)){throw new db['Sequelize'][(_0x8c69('0x60'))](_[_0x8c69('0x5d')](_0x8c69('0x63'))+'\x20not\x20found');}return _0x4cce8f[_0x8c69('0x67')](_0x46f363);}})['catch'](handleError(_0x4cce8f,null));};exports['gdpr']=function(_0x2f84c3,_0x556125){return db['Setting']['find']({'where':{'id':_0x2f84c3[_0x8c69('0x46')]['id']},'attributes':[_0x8c69('0x68')]})[_0x8c69('0x19')](respondWithResult(_0x556125,null))[_0x8c69('0x1f')](handleError(_0x556125,null));};exports[_0x8c69('0x69')]=function(_0x464482,_0x1abb79,_0x51be3a){if(_0x464482['file']&&_0x464482[_0x8c69('0x4b')][_0x8c69('0x4c')]){_0x464482[_0x8c69('0x49')][_0x8c69('0x53')]=_0x464482[_0x8c69('0x4b')]['filename'];}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x464482[_0x8c69('0x46')]['id']}})[_0x8c69('0x19')](handleEntityNotFound(_0x1abb79,null))['then'](saveUpdates(_0x464482['body'],null))['then'](respondWithResult(_0x1abb79,null))[_0x8c69('0x1f')](handleError(_0x1abb79,null));};var utilLicense=require(_0x8c69('0x4f'));exports[_0x8c69('0x6a')]=function(_0x466f15,_0x452ad7,_0x2d97b3){var _0x2eadd9='server/files/images/logos';var _0x218bf1={'custom':![]};return utilLicense[_0x8c69('0x52')]()[_0x8c69('0x19')](function(_0x447b07){if(_0x447b07){_0x218bf1=_0x447b07;}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x466f15[_0x8c69('0x46')]['id']},'attributes':[_0x8c69('0x4d'),'loginLogo','preferred',_0x8c69('0x64'),_0x8c69('0x65'),_0x8c69('0x54'),_0x8c69('0x55'),'defaultFavicon'],'raw':!![]});})[_0x8c69('0x19')](handleEntityNotFound(_0x452ad7,null))['then'](function(_0x19a0ac){if(_0x19a0ac){var _0x32cac2=_0x19a0ac[_0x8c69('0x53')]&&fs['existsSync'](path['join'](config[_0x8c69('0x59')],_0x2eadd9,_[_0x8c69('0x5a')](_0x19a0ac['preferred'])))?path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x2eadd9,_[_0x8c69('0x5a')](_0x19a0ac['preferred'])):path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x2eadd9,_[_0x8c69('0x5a')](_0x8c69('0x6b')));var _0x55ae7c=_0x8c69('0x5c')+_[_0x8c69('0x5d')](_0x8c69('0x53'));if(_0x19a0ac[_0x55ae7c]||!_0x218bf1[_0x8c69('0x5e')]||!_0x218bf1[_0x8c69('0x53')]){_0x32cac2=path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x2eadd9,_['toLower'](_0x8c69('0x6b')));}if(!fs[_0x8c69('0x57')](_0x32cac2)){throw new db[(_0x8c69('0x5f'))][(_0x8c69('0x60'))](_[_0x8c69('0x5d')](_0x8c69('0x53'))+_0x8c69('0x61'));}return _0x452ad7[_0x8c69('0x67')](_0x32cac2);}})[_0x8c69('0x1f')](handleError(_0x452ad7,null));};exports[_0x8c69('0x6c')]=function(_0x41ac8e,_0x5835e5,_0x31a0c0){if(_0x41ac8e[_0x8c69('0x4b')]&&_0x41ac8e[_0x8c69('0x4b')][_0x8c69('0x4c')]){_0x41ac8e[_0x8c69('0x49')][_0x8c69('0x64')]=_0x41ac8e[_0x8c69('0x4b')][_0x8c69('0x4c')];}return db[_0x8c69('0x2d')][_0x8c69('0x48')]({'where':{'id':_0x41ac8e[_0x8c69('0x46')]['id']}})[_0x8c69('0x19')](handleEntityNotFound(_0x5835e5,null))[_0x8c69('0x19')](saveUpdates(_0x41ac8e[_0x8c69('0x49')],null))[_0x8c69('0x19')](respondWithResult(_0x5835e5,null))[_0x8c69('0x1f')](handleError(_0x5835e5,null));};var utilLicense=require(_0x8c69('0x4f'));exports['getFavicon']=function(_0x2a865a,_0x3bc7d1,_0x577719){var _0x30139a=_0x8c69('0x51');var _0x1828f1={'custom':![]};return utilLicense[_0x8c69('0x52')]()[_0x8c69('0x19')](function(_0x177018){if(_0x177018){_0x1828f1=_0x177018;}return db['Setting'][_0x8c69('0x48')]({'where':{'id':_0x2a865a['params']['id']},'attributes':['logo',_0x8c69('0x63'),_0x8c69('0x53'),_0x8c69('0x64'),_0x8c69('0x65'),'defaultLoginLogo',_0x8c69('0x55'),_0x8c69('0x56')],'raw':!![]});})[_0x8c69('0x19')](handleEntityNotFound(_0x3bc7d1,null))['then'](function(_0x507cc7){if(_0x507cc7){var _0x285e4d=_0x507cc7[_0x8c69('0x64')]&&fs[_0x8c69('0x57')](path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x30139a,_[_0x8c69('0x5a')](_0x507cc7['favicon'])))?path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x30139a,_[_0x8c69('0x5a')](_0x507cc7[_0x8c69('0x64')])):path[_0x8c69('0x58')](config[_0x8c69('0x59')],_0x30139a,_[_0x8c69('0x5a')](_0x8c69('0x6d')));var _0x426eb7=_0x8c69('0x5c')+_[_0x8c69('0x5d')](_0x8c69('0x64'));if(_0x507cc7[_0x426eb7]||!_0x1828f1['custom']){_0x285e4d=path['join'](config[_0x8c69('0x59')],_0x30139a,_[_0x8c69('0x5a')](_0x8c69('0x6d')));}if(!fs[_0x8c69('0x57')](_0x285e4d)){throw new db[(_0x8c69('0x5f'))]['ValidationError'](_[_0x8c69('0x5d')]('favicon')+'\x20not\x20found');}return _0x3bc7d1[_0x8c69('0x67')](_0x285e4d);}})[_0x8c69('0x1f')](handleError(_0x3bc7d1,null));};exports[_0x8c69('0x6e')]=function(_0x4f6354,_0x294605){var _0x51b227={'offset':moment()['utcOffset']()};_0x51b227[_0x8c69('0x6f')]=moment()[_0x8c69('0x70')](_0x51b227[_0x8c69('0x23')])[_0x8c69('0x71')](_0x8c69('0x72'));return _0x294605[_0x8c69('0x21')](0xc8)[_0x8c69('0x73')](_0x51b227);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 45dc961..880c707 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x7217,0x19e));var _0x7721=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7217[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c52c413..51b3cfd 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 _0x522f=['error','code','message','result','catch','ShowSetting','Setting','find','options','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x522f,0x1ba));var _0xf522=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x522f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf522('0x0'));var util=require(_0xf522('0x1'));var moment=require(_0xf522('0x2'));var BPromise=require(_0xf522('0x3'));var rs=require(_0xf522('0x4'));var fs=require('fs');var Redis=require(_0xf522('0x5'));var db=require(_0xf522('0x6'))['db'];var utils=require(_0xf522('0x7'));var logger=require(_0xf522('0x8'))(_0xf522('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf522('0xa')][_0xf522('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2775a3,_0x23e4b2,_0x1c78c1){return new BPromise(function(_0x4e26b3,_0x336119){return client[_0xf522('0xc')](_0x2775a3,_0x1c78c1)[_0xf522('0xd')](function(_0x1656a6){logger[_0xf522('0xe')](_0xf522('0xf'),_0x23e4b2,'request\x20sent');logger[_0xf522('0x10')](_0xf522('0x11'),_0x23e4b2,_0xf522('0x12'),JSON[_0xf522('0x13')](_0x1656a6));if(_0x1656a6[_0xf522('0x14')]){if(_0x1656a6[_0xf522('0x14')][_0xf522('0x15')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x23e4b2,_0x1656a6[_0xf522('0x14')]['message']);return _0x336119(_0x1656a6[_0xf522('0x14')][_0xf522('0x16')]);}logger[_0xf522('0x14')](_0xf522('0xf'),_0x23e4b2,_0x1656a6[_0xf522('0x14')][_0xf522('0x16')]);return _0x4e26b3(_0x1656a6[_0xf522('0x14')][_0xf522('0x16')]);}else{logger['info'](_0xf522('0xf'),_0x23e4b2,_0xf522('0x12'));_0x4e26b3(_0x1656a6[_0xf522('0x17')][_0xf522('0x16')]);}})[_0xf522('0x18')](function(_0x1913bd){logger[_0xf522('0x14')]('Setting,\x20%s,\x20%s',_0x23e4b2,_0x1913bd);_0x336119(_0x1913bd);});});}exports[_0xf522('0x19')]=function(_0x2dc8c4){var _0x193e19=this;return new Promise(function(_0x59a31d,_0x11a7cd){return db[_0xf522('0x1a')][_0xf522('0x1b')]({'raw':_0x2dc8c4[_0xf522('0x1c')]?_0x2dc8c4[_0xf522('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2dc8c4[_0xf522('0x1c')]?_0x2dc8c4[_0xf522('0x1c')]['where']||null:null,'attributes':_0x2dc8c4[_0xf522('0x1c')]?_0x2dc8c4['options'][_0xf522('0x1d')]||null:null,'include':_0x2dc8c4[_0xf522('0x1c')]?_0x2dc8c4[_0xf522('0x1c')]['include']?_[_0xf522('0x1e')](_0x2dc8c4[_0xf522('0x1c')][_0xf522('0x1f')],function(_0x32786f){return{'model':db[_0x32786f['model']],'as':_0x32786f['as'],'attributes':_0x32786f[_0xf522('0x1d')],'include':_0x32786f[_0xf522('0x1f')]?_[_0xf522('0x1e')](_0x32786f[_0xf522('0x1f')],function(_0x23ff3b){return{'model':db[_0x23ff3b[_0xf522('0x20')]],'as':_0x23ff3b['as'],'attributes':_0x23ff3b[_0xf522('0x1d')],'include':_0x23ff3b[_0xf522('0x1f')]?_[_0xf522('0x1e')](_0x23ff3b[_0xf522('0x1f')],function(_0x495a2c){return{'model':db[_0x495a2c['model']],'as':_0x495a2c['as'],'attributes':_0x495a2c[_0xf522('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf522('0xd')](function(_0x1e7682){logger['info'](_0xf522('0x19'),_0x2dc8c4);logger[_0xf522('0x10')]('ShowSetting',_0x2dc8c4,JSON[_0xf522('0x13')](_0x1e7682));_0x59a31d(_0x1e7682);})['catch'](function(_0x427857){logger[_0xf522('0x14')]('ShowSetting',_0x427857[_0xf522('0x16')],_0x2dc8c4);_0x11a7cd(_0x193e19[_0xf522('0x14')](0x1f4,_0x427857['message']));});});}; \ No newline at end of file +var _0xf984=['where','attributes','include','map','model','lodash','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','raw','options'];(function(_0x3b4ddd,_0x171dc5){var _0x5089e3=function(_0x1081a0){while(--_0x1081a0){_0x3b4ddd['push'](_0x3b4ddd['shift']());}};_0x5089e3(++_0x171dc5);}(_0xf984,0x16d));var _0x4f98=function(_0x3acdef,_0x2a7ae7){_0x3acdef=_0x3acdef-0x0;var _0x3a252a=_0xf984[_0x3acdef];return _0x3a252a;};'use strict';var _=require(_0x4f98('0x0'));var util=require('util');var moment=require(_0x4f98('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f98('0x2'));var logger=require(_0x4f98('0x3'))(_0x4f98('0x4'));var config=require('../../config/environment');var jayson=require(_0x4f98('0x5'));var client=jayson[_0x4f98('0x6')][_0x4f98('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45d483,_0x5e2f13,_0x22848a){return new BPromise(function(_0x401ab8,_0x188101){return client[_0x4f98('0x8')](_0x45d483,_0x22848a)['then'](function(_0x344cf4){logger[_0x4f98('0x9')]('Setting,\x20%s,\x20%s',_0x5e2f13,_0x4f98('0xa'));logger[_0x4f98('0xb')](_0x4f98('0xc'),_0x5e2f13,_0x4f98('0xa'),JSON[_0x4f98('0xd')](_0x344cf4));if(_0x344cf4[_0x4f98('0xe')]){if(_0x344cf4[_0x4f98('0xe')][_0x4f98('0xf')]===0x1f4){logger[_0x4f98('0xe')](_0x4f98('0x10'),_0x5e2f13,_0x344cf4[_0x4f98('0xe')][_0x4f98('0x11')]);return _0x188101(_0x344cf4['error'][_0x4f98('0x11')]);}logger[_0x4f98('0xe')](_0x4f98('0x10'),_0x5e2f13,_0x344cf4[_0x4f98('0xe')][_0x4f98('0x11')]);return _0x401ab8(_0x344cf4[_0x4f98('0xe')][_0x4f98('0x11')]);}else{logger[_0x4f98('0x9')](_0x4f98('0x10'),_0x5e2f13,_0x4f98('0xa'));_0x401ab8(_0x344cf4[_0x4f98('0x12')][_0x4f98('0x11')]);}})[_0x4f98('0x13')](function(_0x53c086){logger[_0x4f98('0xe')](_0x4f98('0x10'),_0x5e2f13,_0x53c086);_0x188101(_0x53c086);});});}exports[_0x4f98('0x14')]=function(_0xb06d9){var _0x39f9be=this;return new Promise(function(_0x200a84,_0xbf6078){return db[_0x4f98('0x15')][_0x4f98('0x16')]({'raw':_0xb06d9['options']?_0xb06d9['options'][_0x4f98('0x17')]===undefined?!![]:![]:!![],'where':_0xb06d9[_0x4f98('0x18')]?_0xb06d9[_0x4f98('0x18')][_0x4f98('0x19')]||null:null,'attributes':_0xb06d9['options']?_0xb06d9[_0x4f98('0x18')][_0x4f98('0x1a')]||null:null,'include':_0xb06d9[_0x4f98('0x18')]?_0xb06d9[_0x4f98('0x18')][_0x4f98('0x1b')]?_[_0x4f98('0x1c')](_0xb06d9['options'][_0x4f98('0x1b')],function(_0x12da86){return{'model':db[_0x12da86[_0x4f98('0x1d')]],'as':_0x12da86['as'],'attributes':_0x12da86[_0x4f98('0x1a')],'include':_0x12da86[_0x4f98('0x1b')]?_[_0x4f98('0x1c')](_0x12da86[_0x4f98('0x1b')],function(_0x59edef){return{'model':db[_0x59edef[_0x4f98('0x1d')]],'as':_0x59edef['as'],'attributes':_0x59edef[_0x4f98('0x1a')],'include':_0x59edef[_0x4f98('0x1b')]?_[_0x4f98('0x1c')](_0x59edef[_0x4f98('0x1b')],function(_0x20ef91){return{'model':db[_0x20ef91['model']],'as':_0x20ef91['as'],'attributes':_0x20ef91[_0x4f98('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x170f2b){logger[_0x4f98('0x9')](_0x4f98('0x14'),_0xb06d9);logger[_0x4f98('0xb')](_0x4f98('0x14'),_0xb06d9,JSON[_0x4f98('0xd')](_0x170f2b));_0x200a84(_0x170f2b);})[_0x4f98('0x13')](function(_0x34beca){logger['error'](_0x4f98('0x14'),_0x34beca[_0x4f98('0x11')],_0xb06d9);_0xbf6078(_0x39f9be[_0x4f98('0xe')](0x1f4,_0x34beca[_0x4f98('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 328e5b0..00f7730 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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x4a8481,_0x19d6b4){var _0x46cb13=function(_0xec225c){while(--_0xec225c){_0x4a8481['push'](_0x4a8481['shift']());}};_0x46cb13(++_0x19d6b4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x499e85,_0x2f2774){var _0x537fc2=function(_0x423e7d){while(--_0x423e7d){_0x499e85['push'](_0x499e85['shift']());}};_0x537fc2(++_0x2f2774);}(_0x5fc3,0xa8));var _0x35fc=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0x5fc3[_0xc0d9bc];return _0x32ff73;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c5481f7..8759fb3 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 _0x257f=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x257f,0x1ea));var _0xf257=function(_0x518422,_0x457f7d){_0x518422=_0x518422-0x0;var _0x396182=_0x257f[_0x518422];return _0x396182;};'use strict';var Sequelize=require(_0xf257('0x0'));var rs=require(_0xf257('0x1'));module[_0xf257('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xf257('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xf257('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xf257('0x4')],'defaultValue':function(){return rs[_0xf257('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf257('0x6')](_0xf257('0x7'),'skebby',_0xf257('0x8'),_0xf257('0x9'),_0xf257('0xa'),_0xf257('0xb'),_0xf257('0xc'),_0xf257('0xd'),_0xf257('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0xf257('0x4')]},'authId':{'type':Sequelize[_0xf257('0x4')]},'authToken':{'type':Sequelize[_0xf257('0x4')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xf257('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xf257('0x4')]},'senderString':{'type':Sequelize[_0xf257('0x4')]},'deliveryReport':{'type':Sequelize[_0xf257('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xf257('0x4')]},'notificationTemplate':{'type':Sequelize[_0xf257('0x10')],'defaultValue':function(){return _0xf257('0x11');}},'notificationSound':{'type':Sequelize[_0xf257('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf257('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf257('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf257('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf257('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf257('0x12')],'comment':_0xf257('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf257('0xf')],'defaultValue':![],'comment':_0xf257('0x14'),'set':function(_0x586bf1){if(!_0x586bf1)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf257('0x15')](_0xf257('0x16'),_0x586bf1);}}}; \ No newline at end of file +var _0x557e=['infobip','intelepeer','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','twilio','connectel','bandwidth','csc'];(function(_0x4fbf13,_0x50c612){var _0x37304e=function(_0x29e328){while(--_0x29e328){_0x4fbf13['push'](_0x4fbf13['shift']());}};_0x37304e(++_0x50c612);}(_0x557e,0x186));var _0xe557=function(_0x4efa3d,_0x1af72a){_0x4efa3d=_0x4efa3d-0x0;var _0x28d344=_0x557e[_0x4efa3d];return _0x28d344;};'use strict';var Sequelize=require(_0xe557('0x0'));var rs=require(_0xe557('0x1'));module[_0xe557('0x2')]={'name':{'type':Sequelize[_0xe557('0x3')],'unique':_0xe557('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe557('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe557('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe557('0x5')]();}},'phone':{'type':Sequelize[_0xe557('0x3')]},'type':{'type':Sequelize['ENUM'](_0xe557('0x6'),'skebby',_0xe557('0x7'),'clicksend','plivo','clickatell',_0xe557('0x8'),_0xe557('0x9'),_0xe557('0xa'),_0xe557('0xb'))},'accountSid':{'type':Sequelize[_0xe557('0x3')]},'authId':{'type':Sequelize[_0xe557('0x3')]},'authToken':{'type':Sequelize[_0xe557('0x3')]},'smsMethod':{'type':Sequelize[_0xe557('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe557('0x3')]},'password':{'type':Sequelize[_0xe557('0x3')]},'apiKey':{'type':Sequelize[_0xe557('0x3')]},'applicationId':{'type':Sequelize[_0xe557('0x3')]},'accountId':{'type':Sequelize[_0xe557('0x3')]},'senderString':{'type':Sequelize[_0xe557('0x3')]},'deliveryReport':{'type':Sequelize[_0xe557('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe557('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe557('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe557('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe557('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe557('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe557('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe557('0xf')],'comment':_0xe557('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xe557('0xd')],'defaultValue':![],'comment':_0xe557('0x11'),'set':function(_0x247cc1){if(!_0x247cc1)this[_0xe557('0x12')](_0xe557('0x13'),null);this[_0xe557('0x12')]('mandatoryDisposition',_0x247cc1);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9559b4c..ff77c45 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 _0xa059=['plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','SmsInteraction','interaction','created','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','order','getInteractions','Owner','color','tag','CmList','List','out','spread','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','request-promise','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/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','intersection','fields','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','twilio','From','Body','messageId','MessageSid','from','text','connectel','clicksend','message_id'];(function(_0x36f17d,_0x39531f){var _0x10950e=function(_0x593471){while(--_0x593471){_0x36f17d['push'](_0x36f17d['shift']());}};_0x10950e(++_0x39531f);}(_0xa059,0x142));var _0x9a05=function(_0x3c036a,_0x29ac00){_0x3c036a=_0x3c036a-0x0;var _0x3bd8d6=_0xa059[_0x3c036a];return _0x3bd8d6;};'use strict';var emlformat=require(_0x9a05('0x0'));var rimraf=require(_0x9a05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a05('0x2'));var moment=require(_0x9a05('0x3'));var BPromise=require(_0x9a05('0x4'));var Mustache=require(_0x9a05('0x5'));var util=require(_0x9a05('0x6'));var path=require(_0x9a05('0x7'));var sox=require(_0x9a05('0x8'));var csv=require(_0x9a05('0x9'));var ejs=require(_0x9a05('0xa'));var fs=require('fs');var fs_extra=require(_0x9a05('0xb'));var _=require(_0x9a05('0xc'));var squel=require('squel');var crypto=require(_0x9a05('0xd'));var jsforce=require(_0x9a05('0xe'));var deskjs=require(_0x9a05('0xf'));var toCsv=require(_0x9a05('0x9'));var querystring=require(_0x9a05('0x10'));var Papa=require(_0x9a05('0x11'));var Redis=require(_0x9a05('0x12'));var authService=require(_0x9a05('0x13'));var qs=require(_0x9a05('0x14'));var as=require(_0x9a05('0x15'));var hardwareService=require(_0x9a05('0x16'));var logger=require(_0x9a05('0x17'))(_0x9a05('0x18'));var utils=require('../../config/utils');var config=require(_0x9a05('0x19'));var licenseUtil=require(_0x9a05('0x1a'));var db=require(_0x9a05('0x1b'))['db'];config['redis']=_[_0x9a05('0x1c')](config[_0x9a05('0x1d')],{'host':_0x9a05('0x1e'),'port':0x18eb});var socket=require(_0x9a05('0x1f'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x9a05('0x20')](socket);var jayson=require(_0x9a05('0x21'));var client=jayson[_0x9a05('0x22')][_0x9a05('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x3ea42b,_0xe922ee,_0x159e70,_0x1c3a4a){return new BPromise(function(_0x3f2437,_0x2064ea){var _0x1acd6c=_0x1c3a4a||client;return _0x1acd6c[_0x9a05('0x24')](_0x3ea42b,_0x159e70)['then'](function(_0x250855){logger[_0x9a05('0x25')](_0x9a05('0x26'),_0xe922ee,_0x9a05('0x27'));logger[_0x9a05('0x28')](_0x9a05('0x29'),_0xe922ee,_0x9a05('0x27'),JSON[_0x9a05('0x2a')](_0x250855));if(_0x250855[_0x9a05('0x2b')]){if(_0x250855[_0x9a05('0x2b')][_0x9a05('0x2c')]===0x1f4){logger[_0x9a05('0x2b')](_0x9a05('0x26'),_0xe922ee,_0x250855[_0x9a05('0x2b')][_0x9a05('0x2d')]);return _0x2064ea(_0x250855[_0x9a05('0x2b')][_0x9a05('0x2d')]);}logger[_0x9a05('0x2b')](_0x9a05('0x26'),_0xe922ee,_0x250855[_0x9a05('0x2b')][_0x9a05('0x2d')]);return _0x3f2437(_0x250855['error']['message']);}else{logger[_0x9a05('0x25')]('SmsAccount,\x20%s,\x20%s',_0xe922ee,_0x9a05('0x27'));_0x3f2437(_0x250855[_0x9a05('0x2e')][_0x9a05('0x2d')]);}})[_0x9a05('0x2f')](function(_0x52277e){logger['error']('SmsAccount,\x20%s,\x20%s',_0xe922ee,_0x52277e);_0x2064ea(_0x52277e);});});}function respondWithStatusCode(_0x351c48,_0x77e426){_0x77e426=_0x77e426||0xcc;return function(_0x1c3d0d){if(_0x1c3d0d){return _0x351c48[_0x9a05('0x30')](_0x77e426);}return _0x351c48[_0x9a05('0x31')](_0x77e426)[_0x9a05('0x32')]();};}function respondWithResult(_0x1f7432,_0x33b600){_0x33b600=_0x33b600||0xc8;return function(_0x2e990b){if(_0x2e990b){return _0x1f7432[_0x9a05('0x31')](_0x33b600)[_0x9a05('0x33')](_0x2e990b);}};}function respondWithFilteredResult(_0xf252b1,_0x38d70d){return function(_0x2e974b){if(_0x2e974b){var _0xd83c20=typeof _0x38d70d[_0x9a05('0x34')]===_0x9a05('0x35')&&typeof _0x38d70d[_0x9a05('0x36')]===_0x9a05('0x35');var _0x21a2de=_0x2e974b[_0x9a05('0x37')];var _0x265b69=_0xd83c20?0x0:_0x38d70d[_0x9a05('0x34')];var _0x12ca30=_0xd83c20?_0x2e974b['count']:_0x38d70d[_0x9a05('0x34')]+_0x38d70d[_0x9a05('0x36')];var _0x1c180e;if(_0x12ca30>=_0x21a2de){_0x12ca30=_0x21a2de;_0x1c180e=0xc8;}else{_0x1c180e=0xce;}_0xf252b1[_0x9a05('0x31')](_0x1c180e);return _0xf252b1['set'](_0x9a05('0x38'),_0x265b69+'-'+_0x12ca30+'/'+_0x21a2de)[_0x9a05('0x33')](_0x2e974b);}return null;};}function patchUpdates(_0x1704fd){return function(_0x2173c7){try{jsonpatch[_0x9a05('0x39')](_0x2173c7,_0x1704fd,!![]);}catch(_0x3dddc8){return BPromise[_0x9a05('0x3a')](_0x3dddc8);}return _0x2173c7[_0x9a05('0x3b')]();};}function saveUpdates(_0xdd167b,_0x348455){return function(_0x4aedaf){if(_0x4aedaf){return _0x4aedaf['update'](_0xdd167b)[_0x9a05('0x3c')](function(_0x372169){return _0x372169;});}return null;};}function removeEntity(_0x207ba3,_0x461866){return function(_0x88b788){if(_0x88b788){return _0x88b788['destroy']()['then'](function(){var _0xccd9a9=_0x88b788[_0x9a05('0x3d')]({'plain':!![]});var _0x2a72ed='SmsAccounts';return db[_0x9a05('0x3e')][_0x9a05('0x3f')]({'where':{'type':_0x2a72ed,'resourceId':_0xccd9a9['id']}})[_0x9a05('0x3c')](function(){return _0x88b788;});})[_0x9a05('0x3c')](function(){_0x207ba3[_0x9a05('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x194171,_0x2d16bd){return function(_0x31cfb8){if(!_0x31cfb8){_0x194171[_0x9a05('0x30')](0x194);}return _0x31cfb8;};}function handleError(_0x322c0f,_0x280823){_0x280823=_0x280823||0x1f4;return function(_0x31af94){logger[_0x9a05('0x2b')](_0x31af94[_0x9a05('0x40')]);if(_0x31af94[_0x9a05('0x41')]){delete _0x31af94['name'];}_0x322c0f[_0x9a05('0x31')](_0x280823)[_0x9a05('0x42')](_0x31af94);};}exports[_0x9a05('0x43')]=function(_0x5ab3d9,_0x23cb8e){var _0x450c17={'include':[{'model':db[_0x9a05('0x44')],'as':_0x9a05('0x45')}]},_0x17a252={},_0x42e22e={'count':0x0,'rows':[]};var _0x5666c7=_[_0x9a05('0x46')](db[_0x9a05('0x47')]['rawAttributes'],function(_0x40c84f){return{'name':_0x40c84f[_0x9a05('0x48')],'type':_0x40c84f[_0x9a05('0x49')][_0x9a05('0x4a')]};});_0x17a252['model']=_[_0x9a05('0x46')](_0x5666c7,_0x9a05('0x41'));_0x17a252[_0x9a05('0x4b')]=_[_0x9a05('0x4c')](_0x5ab3d9[_0x9a05('0x4b')]);_0x17a252[_0x9a05('0x4d')]=_['intersection'](_0x17a252[_0x9a05('0x4e')],_0x17a252[_0x9a05('0x4b')]);_0x450c17[_0x9a05('0x4f')]=_['intersection'](_0x17a252[_0x9a05('0x4e')],qs['fields'](_0x5ab3d9[_0x9a05('0x4b')]['fields']));_0x450c17[_0x9a05('0x4f')]=_0x450c17[_0x9a05('0x4f')][_0x9a05('0x50')]?_0x450c17[_0x9a05('0x4f')]:_0x17a252[_0x9a05('0x4e')];if(!_0x5ab3d9[_0x9a05('0x4b')][_0x9a05('0x51')](_0x9a05('0x52'))){_0x450c17[_0x9a05('0x36')]=qs[_0x9a05('0x36')](_0x5ab3d9['query'][_0x9a05('0x36')]);_0x450c17[_0x9a05('0x34')]=qs[_0x9a05('0x34')](_0x5ab3d9[_0x9a05('0x4b')][_0x9a05('0x34')]);}_0x450c17['order']=qs[_0x9a05('0x53')](_0x5ab3d9[_0x9a05('0x4b')][_0x9a05('0x53')]);_0x450c17['where']=qs[_0x9a05('0x4d')](_[_0x9a05('0x54')](_0x5ab3d9[_0x9a05('0x4b')],_0x17a252[_0x9a05('0x4d')]),_0x5666c7);if(_0x5ab3d9[_0x9a05('0x4b')][_0x9a05('0x55')]){_0x450c17[_0x9a05('0x56')]=_['merge'](_0x450c17[_0x9a05('0x56')],{'$or':_[_0x9a05('0x46')](_0x5666c7,function(_0x2c39de){if(_0x2c39de[_0x9a05('0x49')]!==_0x9a05('0x57')){var _0x4d595a={};_0x4d595a[_0x2c39de[_0x9a05('0x41')]]={'$like':'%'+_0x5ab3d9[_0x9a05('0x4b')]['filter']+'%'};return _0x4d595a;}})});}_0x450c17=_[_0x9a05('0x58')]({},_0x450c17,_0x5ab3d9[_0x9a05('0x59')]);var _0x1fd866={'where':_0x450c17['where']};return db['SmsAccount'][_0x9a05('0x37')](_0x1fd866)[_0x9a05('0x3c')](function(_0xc25988){_0x42e22e[_0x9a05('0x37')]=_0xc25988;if(_0x5ab3d9[_0x9a05('0x4b')][_0x9a05('0x5a')]){_0x450c17[_0x9a05('0x5b')]=[{'all':!![]}];}return db[_0x9a05('0x47')][_0x9a05('0x5c')](_0x450c17);})[_0x9a05('0x3c')](function(_0x4f7a64){_0x42e22e[_0x9a05('0x5d')]=_0x4f7a64;return _0x42e22e;})[_0x9a05('0x3c')](respondWithFilteredResult(_0x23cb8e,_0x450c17))[_0x9a05('0x2f')](handleError(_0x23cb8e,null));};exports[_0x9a05('0x5e')]=function(_0x559de3,_0x11b4a6){var _0x4c09d6={'raw':![],'where':{'id':_0x559de3[_0x9a05('0x5f')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x523935={};_0x523935['model']=_[_0x9a05('0x4c')](db[_0x9a05('0x47')]['rawAttributes']);_0x523935['query']=_[_0x9a05('0x4c')](_0x559de3[_0x9a05('0x4b')]);_0x523935[_0x9a05('0x4d')]=_[_0x9a05('0x60')](_0x523935[_0x9a05('0x4e')],_0x523935[_0x9a05('0x4b')]);_0x4c09d6['attributes']=_['intersection'](_0x523935['model'],qs[_0x9a05('0x61')](_0x559de3[_0x9a05('0x4b')]['fields']));_0x4c09d6[_0x9a05('0x4f')]=_0x4c09d6[_0x9a05('0x4f')][_0x9a05('0x50')]?_0x4c09d6[_0x9a05('0x4f')]:_0x523935[_0x9a05('0x4e')];if(_0x559de3['query']['includeAll']){_0x4c09d6[_0x9a05('0x5b')]=[{'all':!![]}];}_0x4c09d6=_[_0x9a05('0x58')]({},_0x4c09d6,_0x559de3[_0x9a05('0x59')]);return db[_0x9a05('0x47')][_0x9a05('0x62')](_0x4c09d6)['then'](handleEntityNotFound(_0x11b4a6,null))[_0x9a05('0x3c')](respondWithResult(_0x11b4a6,null))[_0x9a05('0x2f')](handleError(_0x11b4a6,null));};exports[_0x9a05('0x63')]=function(_0xa9e271,_0x37fa0f){return db[_0x9a05('0x47')][_0x9a05('0x63')](_0xa9e271[_0x9a05('0x64')],{})[_0x9a05('0x3c')](function(_0x380e8b){var _0x5cab62=_0xa9e271['user'][_0x9a05('0x3d')]({'plain':!![]});if(!_0x5cab62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cab62['role']===_0x9a05('0x65')){var _0x270bcc=_0x380e8b[_0x9a05('0x3d')]({'plain':!![]});var _0x24ba6a='SmsAccounts';return db[_0x9a05('0x66')][_0x9a05('0x62')]({'where':{'name':_0x24ba6a,'userProfileId':_0x5cab62[_0x9a05('0x67')]},'raw':!![]})[_0x9a05('0x3c')](function(_0x5b0f6a){if(_0x5b0f6a&&_0x5b0f6a['autoAssociation']===0x0){return db[_0x9a05('0x3e')]['create']({'name':_0x270bcc[_0x9a05('0x41')],'resourceId':_0x270bcc['id'],'type':_0x5b0f6a[_0x9a05('0x41')],'sectionId':_0x5b0f6a['id']},{})['then'](function(){return _0x380e8b;});}else{return _0x380e8b;}})[_0x9a05('0x2f')](function(_0x5d8fcf){logger[_0x9a05('0x2b')](_0x9a05('0x68'),_0x5d8fcf);throw _0x5d8fcf;});}return _0x380e8b;})[_0x9a05('0x3c')](respondWithResult(_0x37fa0f,0xc9))['catch'](handleError(_0x37fa0f,null));};exports[_0x9a05('0x69')]=function(_0x43af1e,_0x6b03e3){if(_0x43af1e[_0x9a05('0x64')]['id']){delete _0x43af1e['body']['id'];}return db[_0x9a05('0x47')]['find']({'where':{'id':_0x43af1e['params']['id']},'include':[{'model':db[_0x9a05('0x44')],'as':_0x9a05('0x45')}]})[_0x9a05('0x3c')](handleEntityNotFound(_0x6b03e3,null))['then'](saveUpdates(_0x43af1e[_0x9a05('0x64')],null))[_0x9a05('0x3c')](respondWithResult(_0x6b03e3,null))['catch'](handleError(_0x6b03e3,null));};exports[_0x9a05('0x3f')]=function(_0x4b9bc3,_0xb83335){return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x4b9bc3[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0xb83335,null))['then'](removeEntity(_0xb83335,null))['catch'](handleError(_0xb83335,null));};exports['describe']=function(_0x18a928,_0xd79507){return db[_0x9a05('0x47')][_0x9a05('0x6a')]()[_0x9a05('0x3c')](respondWithResult(_0xd79507,null))[_0x9a05('0x2f')](handleError(_0xd79507,null));};exports[_0x9a05('0x6b')]=function(_0x5ebc7b,_0x2528b5,_0x51027d){if(_0x5ebc7b['body']['id']){delete _0x5ebc7b[_0x9a05('0x64')]['id'];}return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x5ebc7b['params']['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x2528b5,null))[_0x9a05('0x3c')](function(_0x17432a){if(_0x17432a){_0x5ebc7b['body'][_0x9a05('0x6c')]=_0x17432a['id'];return db[_0x9a05('0x6d')][_0x9a05('0x63')](_0x5ebc7b['body']);}})[_0x9a05('0x3c')](respondWithResult(_0x2528b5,null))['catch'](handleError(_0x2528b5,null));};exports[_0x9a05('0x6e')]=function(_0x4197f9,_0x5ec040,_0xbae19c){var _0x311de2={'raw':![],'where':{}};var _0x175bde={};var _0x346a99={'count':0x0,'rows':[]};return db[_0x9a05('0x47')][_0x9a05('0x6f')]({'where':{'id':_0x4197f9[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x5ec040,null))['then'](function(_0x498f0e){if(_0x498f0e){_0x175bde[_0x9a05('0x4e')]=_[_0x9a05('0x4c')](db[_0x9a05('0x6d')][_0x9a05('0x70')]);_0x175bde[_0x9a05('0x4b')]=_['keys'](_0x4197f9[_0x9a05('0x4b')]);_0x175bde[_0x9a05('0x4d')]=_[_0x9a05('0x60')](_0x175bde[_0x9a05('0x4e')],_0x175bde[_0x9a05('0x4b')]);_0x311de2[_0x9a05('0x4f')]=_[_0x9a05('0x60')](_0x175bde[_0x9a05('0x4e')],qs[_0x9a05('0x61')](_0x4197f9[_0x9a05('0x4b')][_0x9a05('0x61')]));_0x311de2[_0x9a05('0x4f')]=_0x311de2['attributes']['length']?_0x311de2[_0x9a05('0x4f')]:_0x175bde[_0x9a05('0x4e')];if(!_0x4197f9[_0x9a05('0x4b')][_0x9a05('0x51')](_0x9a05('0x52'))){_0x311de2[_0x9a05('0x36')]=qs['limit'](_0x4197f9['query'][_0x9a05('0x36')]);_0x311de2[_0x9a05('0x34')]=qs[_0x9a05('0x34')](_0x4197f9['query'][_0x9a05('0x34')]);}_0x311de2['order']=qs[_0x9a05('0x53')](_0x4197f9['query'][_0x9a05('0x53')]);_0x311de2[_0x9a05('0x56')]=qs[_0x9a05('0x4d')](_[_0x9a05('0x54')](_0x4197f9['query'],_0x175bde[_0x9a05('0x4d')]));_0x311de2[_0x9a05('0x56')][_0x9a05('0x6c')]=_0x498f0e['id'];if(_0x4197f9[_0x9a05('0x4b')]['filter']){_0x311de2[_0x9a05('0x56')]=_[_0x9a05('0x58')](_0x311de2[_0x9a05('0x56')],{'$or':_[_0x9a05('0x46')](_0x311de2['attributes'],function(_0x2c42e3){var _0x55fbe6={};_0x55fbe6[_0x2c42e3]={'$like':'%'+_0x4197f9[_0x9a05('0x4b')][_0x9a05('0x55')]+'%'};return _0x55fbe6;})});}_0x311de2=_['merge']({},_0x311de2,_0x4197f9[_0x9a05('0x59')]);return db[_0x9a05('0x6d')][_0x9a05('0x37')]({'where':_0x311de2[_0x9a05('0x56')]})[_0x9a05('0x3c')](function(_0x522c50){_0x346a99[_0x9a05('0x37')]=_0x522c50;if(_0x4197f9[_0x9a05('0x4b')]['includeAll']){_0x311de2[_0x9a05('0x5b')]=[{'all':!![]}];}return db[_0x9a05('0x6d')][_0x9a05('0x5c')](_0x311de2);})[_0x9a05('0x3c')](function(_0x5a1dc3){_0x346a99['rows']=_0x5a1dc3;return _0x346a99;});}})[_0x9a05('0x3c')](respondWithFilteredResult(_0x5ec040,_0x311de2))[_0x9a05('0x2f')](handleError(_0x5ec040,null));};exports[_0x9a05('0x71')]=function(_0x52855e,_0x3b5556,_0x44fe52){return db['SmsAccount'][_0x9a05('0x62')]({'where':{'id':_0x52855e[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x3b5556,null))[_0x9a05('0x3c')](function(_0x4c3ffd){if(_0x4c3ffd){return _0x4c3ffd[_0x9a05('0x71')](_0x52855e['query'][_0x9a05('0x72')]);}})['then'](respondWithStatusCode(_0x3b5556,null))[_0x9a05('0x2f')](handleError(_0x3b5556,null));};exports[_0x9a05('0x73')]=function(_0x37b335,_0x31f75c,_0xcb8b7e){if(_0x37b335[_0x9a05('0x64')]['id']){delete _0x37b335[_0x9a05('0x64')]['id'];}return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x37b335[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x31f75c,null))[_0x9a05('0x3c')](function(_0x296421){if(_0x296421){_0x37b335['body'][_0x9a05('0x6c')]=_0x296421['id'];return db[_0x9a05('0x74')][_0x9a05('0x63')](_0x37b335[_0x9a05('0x64')]);}})[_0x9a05('0x3c')](respondWithResult(_0x31f75c,null))['catch'](handleError(_0x31f75c,null));};exports[_0x9a05('0x75')]=function(_0xe34fa1,_0x15652c,_0x481231){var _0x5176b3={'raw':![],'where':{}};var _0x2aa136={};var _0x55c9cf={'count':0x0,'rows':[]};return db[_0x9a05('0x47')][_0x9a05('0x6f')]({'where':{'id':_0xe34fa1[_0x9a05('0x5f')]['id']}})['then'](handleEntityNotFound(_0x15652c,null))[_0x9a05('0x3c')](function(_0x58ad3c){if(_0x58ad3c){_0x2aa136['model']=_['keys'](db[_0x9a05('0x74')][_0x9a05('0x70')]);_0x2aa136['query']=_[_0x9a05('0x4c')](_0xe34fa1[_0x9a05('0x4b')]);_0x2aa136[_0x9a05('0x4d')]=_[_0x9a05('0x60')](_0x2aa136[_0x9a05('0x4e')],_0x2aa136[_0x9a05('0x4b')]);_0x5176b3[_0x9a05('0x4f')]=_[_0x9a05('0x60')](_0x2aa136['model'],qs[_0x9a05('0x61')](_0xe34fa1[_0x9a05('0x4b')][_0x9a05('0x61')]));_0x5176b3[_0x9a05('0x4f')]=_0x5176b3[_0x9a05('0x4f')][_0x9a05('0x50')]?_0x5176b3[_0x9a05('0x4f')]:_0x2aa136['model'];if(!_0xe34fa1[_0x9a05('0x4b')][_0x9a05('0x51')](_0x9a05('0x52'))){_0x5176b3['limit']=qs[_0x9a05('0x36')](_0xe34fa1[_0x9a05('0x4b')]['limit']);_0x5176b3[_0x9a05('0x34')]=qs[_0x9a05('0x34')](_0xe34fa1[_0x9a05('0x4b')][_0x9a05('0x34')]);}_0x5176b3['order']=qs[_0x9a05('0x53')](_0xe34fa1[_0x9a05('0x4b')][_0x9a05('0x53')]);_0x5176b3[_0x9a05('0x56')]=qs[_0x9a05('0x4d')](_[_0x9a05('0x54')](_0xe34fa1[_0x9a05('0x4b')],_0x2aa136[_0x9a05('0x4d')]));_0x5176b3[_0x9a05('0x56')]['SmsAccountId']=_0x58ad3c['id'];if(_0xe34fa1[_0x9a05('0x4b')][_0x9a05('0x55')]){_0x5176b3[_0x9a05('0x56')]=_['merge'](_0x5176b3['where'],{'$or':_[_0x9a05('0x46')](_0x5176b3[_0x9a05('0x4f')],function(_0x26371c){var _0x13ba26={};_0x13ba26[_0x26371c]={'$like':'%'+_0xe34fa1[_0x9a05('0x4b')]['filter']+'%'};return _0x13ba26;})});}_0x5176b3=_[_0x9a05('0x58')]({},_0x5176b3,_0xe34fa1[_0x9a05('0x59')]);return db[_0x9a05('0x74')][_0x9a05('0x37')]({'where':_0x5176b3[_0x9a05('0x56')]})['then'](function(_0x59c08f){_0x55c9cf[_0x9a05('0x37')]=_0x59c08f;if(_0xe34fa1[_0x9a05('0x4b')][_0x9a05('0x5a')]){_0x5176b3[_0x9a05('0x5b')]=[{'all':!![]}];}return db[_0x9a05('0x74')]['findAll'](_0x5176b3);})[_0x9a05('0x3c')](function(_0x2275b9){_0x55c9cf[_0x9a05('0x5d')]=_0x2275b9;return _0x55c9cf;});}})[_0x9a05('0x3c')](respondWithFilteredResult(_0x15652c,_0x5176b3))[_0x9a05('0x2f')](handleError(_0x15652c,null));};exports[_0x9a05('0x76')]=function(_0x782661,_0x488e14,_0x2e4422){return db['SmsAccount'][_0x9a05('0x62')]({'where':{'id':_0x782661[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x488e14,null))[_0x9a05('0x3c')](function(_0x4643b9){if(_0x4643b9){return _0x4643b9[_0x9a05('0x76')](_0x782661[_0x9a05('0x4b')][_0x9a05('0x72')]);}})[_0x9a05('0x3c')](respondWithStatusCode(_0x488e14,null))['catch'](handleError(_0x488e14,null));};exports['notify']=function(_0x29ab27,_0x5e8dd0,_0x13f00b){var _0x3fad3e={'channel':_0x9a05('0x77')};var _0x193adf=[];var _0x574302=[];var _0x4a6732={};return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x29ab27[_0x9a05('0x5f')]['id']},'include':[{'model':db[_0x9a05('0x78')],'as':'Applications'}]})[_0x9a05('0x3c')](handleEntityNotFound(_0x5e8dd0,null))[_0x9a05('0x3c')](function(_0x137777){_0x3fad3e['account']=_0x137777;_0x3fad3e[_0x9a05('0x79')]=_[_0x9a05('0x7a')](_0x137777[_0x9a05('0x7b')],[_0x9a05('0x7c')],[_0x9a05('0x7d')]);if(_0x3fad3e['account']['Applications']){delete _0x3fad3e[_0x9a05('0x7e')]['Applications'];}return db[_0x9a05('0x7f')][_0x9a05('0x6a')]();})[_0x9a05('0x3c')](function(_0x131464){if(!_0x131464){throw new db[(_0x9a05('0x80'))][(_0x9a05('0x81'))](_0x9a05('0x82'));}_0x193adf=_['difference'](_[_0x9a05('0x4c')](_0x131464),['createdAt',_0x9a05('0x83')]);_0x574302=_[_0x9a05('0x84')](_[_0x9a05('0x4c')](_0x131464),[_0x9a05('0x85'),_0x9a05('0x83'),_0x9a05('0x86'),_0x9a05('0x87')]);_0x3fad3e[_0x9a05('0x64')]={'mapKey':'mobile'};if(_0x3fad3e[_0x9a05('0x7e')][_0x9a05('0x49')]){switch(_0x3fad3e[_0x9a05('0x7e')][_0x9a05('0x49')]){case _0x9a05('0x88'):_0x3fad3e[_0x9a05('0x64')]['from']=_0x29ab27['body'][_0x9a05('0x89')];_0x3fad3e[_0x9a05('0x64')]['body']=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x8a')];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8b')]=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x8c')];break;case'skebby':_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8d')]='+'+_0x29ab27[_0x9a05('0x64')]['sender'];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x64')]=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x8e')];break;case _0x9a05('0x8f'):_0x3fad3e['body']['from']=_0x29ab27[_0x9a05('0x64')]['from'];_0x3fad3e['body'][_0x9a05('0x64')]=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x2d')];break;case _0x9a05('0x90'):_0x3fad3e[_0x9a05('0x64')]['from']=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x8d')];_0x3fad3e['body']['body']=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x64')];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8b')]=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x91')];break;case _0x9a05('0x92'):_0x3fad3e['body']['from']=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x89')];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x64')]=_0x29ab27[_0x9a05('0x64')]['Text'];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8b')]=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x93')];break;case _0x9a05('0x94'):_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8d')]='+'+_0x29ab27[_0x9a05('0x64')][_0x9a05('0x95')][0x0][_0x9a05('0x8d')];_0x3fad3e[_0x9a05('0x64')]['body']=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x95')][0x0][_0x9a05('0x8e')];_0x3fad3e['body']['messageId']=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x95')][0x0][_0x9a05('0x8b')];break;case _0x9a05('0x96'):_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8d')]=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x97')];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x64')]=_0x29ab27['body'][_0x9a05('0x98')][_0x9a05('0x2d')];break;case _0x9a05('0x99'):_0x3fad3e[_0x9a05('0x64')]['from']=_0x29ab27['body'][_0x9a05('0x9a')];_0x3fad3e[_0x9a05('0x64')]['body']=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x8e')];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8b')]=_0x29ab27['body'][_0x9a05('0x9b')];break;case _0x9a05('0x9c'):_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8b')]=_0x29ab27[_0x9a05('0x64')][0x0][_0x9a05('0x2d')]['id'];_0x3fad3e[_0x9a05('0x64')]['from']=_0x29ab27[_0x9a05('0x64')][0x0][_0x9a05('0x2d')][_0x9a05('0x8d')];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x64')]=_0x29ab27['body'][0x0][_0x9a05('0x2d')][_0x9a05('0x8e')];break;case _0x9a05('0x9d'):_0x3fad3e['body'][_0x9a05('0x8d')]=_0x29ab27[_0x9a05('0x64')][_0x9a05('0x8d')];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x64')]=_0x29ab27['body']['message'];_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8b')]=_0x29ab27['body'][_0x9a05('0x9e')];break;}}if(_0x3fad3e['body']['id']){delete _0x3fad3e[_0x9a05('0x64')]['id'];}if(_[_0x9a05('0x9f')](_0x3fad3e['body'][_0x9a05('0x8d')])){throw new db[(_0x9a05('0x80'))][(_0x9a05('0x81'))](_0x9a05('0xa0'));}if(_['isNil'](_0x3fad3e['body'][_0x9a05('0x64')])||_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x64')]===''){throw new db[(_0x9a05('0x80'))][(_0x9a05('0x81'))](_0x9a05('0xa1'));}if(_[_0x9a05('0x9f')](_0x3fad3e[_0x9a05('0x64')][_0x9a05('0xa2')])){throw new db['Sequelize']['ValidationError'](_0x9a05('0xa3')+_0x574302);}if(!_[_0x9a05('0xa4')](_0x574302,_0x3fad3e[_0x9a05('0x64')]['mapKey'])){throw new db['Sequelize'][(_0x9a05('0x81'))](_0x9a05('0xa5')+_0x574302);}_0x4a6732[_0x3fad3e[_0x9a05('0x64')]['mapKey']]=_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8d')];return db['CmList'][_0x9a05('0x62')]({'where':{'id':_0x3fad3e[_0x9a05('0x7e')][_0x9a05('0x87')]},'include':[{'model':db[_0x9a05('0x7f')],'as':_0x9a05('0xa6'),'where':_0x4a6732,'limit':0x1,'order':[[_0x9a05('0x83'),_0x9a05('0xa7')]]}]});})[_0x9a05('0x3c')](handleEntityNotFound(_0x5e8dd0,null))[_0x9a05('0x3c')](function(_0x559791){if(_0x559791){_0x3fad3e[_0x9a05('0xa8')]=_['omit'](_0x559791,[_0x9a05('0xa6')]);if(_0x559791[_0x9a05('0xa6')][_0x9a05('0x50')]){return _0x559791[_0x9a05('0xa6')][0x0];}var _0x4caf36=_[_0x9a05('0x1c')](_0x3fad3e['body'],{'firstName':_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8d')],'ListId':_0x559791['id']});_0x4caf36[_0x3fad3e[_0x9a05('0x64')]['mapKey']]=_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8d')];return db[_0x9a05('0x7f')][_0x9a05('0x63')](_0x4caf36,{'fields':_0x193adf,'raw':!![]});}})['then'](handleEntityNotFound(_0x5e8dd0,null))[_0x9a05('0x3c')](function(_0x42c2b3){if(_0x42c2b3){_0x3fad3e['contact']=_0x42c2b3;var _0x166a33={'ContactId':_0x42c2b3['id'],'phone':_0x3fad3e['body'][_0x9a05('0x8d')],'SmsAccountId':_0x29ab27[_0x9a05('0x5f')]['id']};var _0x35530a={'ContactId':_0x42c2b3['id'],'SmsAccountId':_0x29ab27[_0x9a05('0x5f')]['id'],'closed':![]};return db[_0x9a05('0xa9')][_0x9a05('0x62')]({'where':_0x35530a})['then'](function(_0x9ec137){if(_0x9ec137){return[_0x9ec137,![]];}return db[_0x9a05('0xa9')]['create'](_0x166a33)[_0x9a05('0x3c')](function(_0x1c25b5){return[_0x1c25b5,!![]];});});}})['spread'](function(_0x2cb0ef,_0x3c47cd){_0x3fad3e['interaction']=_0x2cb0ef[_0x9a05('0x3d')]({'plain':!![]});_0x3fad3e[_0x9a05('0xaa')][_0x9a05('0xab')]=![];if(_0x3c47cd){if(_0x3fad3e['account']['autoclose']){_0x3fad3e[_0x9a05('0x79')][_0x9a05('0xac')]({'id':0x0,'priority':_0x3fad3e['applications'][_0x9a05('0x50')]+0x1,'app':_0x9a05('0xad'),'appdata':'unmanaged','interval':_0x9a05('0xae')});}_0x3fad3e[_0x9a05('0xaa')][_0x9a05('0xab')]=!![];}return db[_0x9a05('0xaf')][_0x9a05('0x63')]({'phone':_0x3fad3e['body'][_0x9a05('0x8d')],'messageId':_0x3fad3e[_0x9a05('0x64')][_0x9a05('0x8b')],'body':_0x3fad3e['body'][_0x9a05('0x64')],'SmsAccountId':_0x29ab27['params']['id'],'SmsInteractionId':_0x2cb0ef['id'],'direction':'in','ContactId':_0x2cb0ef[_0x9a05('0xb0')],'AttachmentId':_0x3fad3e[_0x9a05('0x64')][_0x9a05('0xb1')]});})[_0x9a05('0x3c')](function(_0x6db678){_0x3fad3e[_0x9a05('0x2d')]=_0x6db678;if(_0x3fad3e[_0x9a05('0xaa')][_0x9a05('0xb2')]){return db[_0x9a05('0xb3')][_0x9a05('0x62')]({'attributes':['id','name'],'where':{'id':_0x3fad3e[_0x9a05('0xaa')][_0x9a05('0xb2')]}})[_0x9a05('0x3c')](function(_0x46a7c2){if(_0x46a7c2){_0x3fad3e[_0x9a05('0x79')][_0x9a05('0xb4')]({'id':0x0,'priority':0x0,'app':_0x9a05('0xb5'),'appdata':_0x46a7c2[_0x9a05('0x41')]+','+(_0x3fad3e['account'][_0x9a05('0xb6')]||0xa),'interval':_0x9a05('0xae')});}return respondWithRpcPromise(_0x9a05('0xb7'),_0x9a05('0xb8'),_0x3fad3e);});}return respondWithRpcPromise(_0x9a05('0xb7'),_0x9a05('0xb8'),_0x3fad3e);})[_0x9a05('0x3c')](function(_0x51ab85){if(_0x51ab85){var _0x54e327=0xc8;var _0x5cb27d=_0x9a05('0xb9');logger['info'](_0x9a05('0x29'),_0x5cb27d,_0x54e327,_0x9a05('0xba'));logger[_0x9a05('0x28')](_0x9a05('0xbb'),_0x5cb27d,_0x54e327,'entity\x20found',JSON['stringify'](_0x51ab85));if(_0x3fad3e['account'][_0x9a05('0x49')]===_0x9a05('0x88')){return _0x5e8dd0[_0x9a05('0x31')](_0x54e327)[_0x9a05('0xbc')](_0x9a05('0xbd'),_0x9a05('0xbe'))['send']('\x0a');}else{return _0x5e8dd0[_0x9a05('0x31')](_0x54e327)[_0x9a05('0x33')](_0x51ab85);}}})[_0x9a05('0x2f')](handleError(_0x5e8dd0,null));};exports[_0x9a05('0xbf')]=function(_0x17df34,_0x575080){var _0x1bd3a5=_0x17df34[_0x9a05('0x5f')]['id'];var _0x17cd62=_0x17df34['body'];var _0x1dd1e1=0xc8;var _0x3b2b67=null;return db[_0x9a05('0xc0')][_0x9a05('0xc1')]({'isolationLevel':db[_0x9a05('0xc0')][_0x9a05('0xc2')][_0x9a05('0xc3')]['READ_COMMITTED']},function(_0x3e2191){return db[_0x9a05('0x47')][_0x9a05('0x6f')]({'where':{'id':_0x1bd3a5},'transaction':_0x3e2191})[_0x9a05('0x3c')](function(_0x1e4104){if(_0x1e4104){return db['SmsApplication'][_0x9a05('0x3f')]({'where':{'SmsAccountId':_0x1bd3a5},'transaction':_0x3e2191})[_0x9a05('0x3c')](function(){var _0x4c3f73=_[_0x9a05('0x46')](_0x17cd62,function(_0x281f66){_0x281f66[_0x9a05('0x6c')]=_0x1bd3a5;return _0x281f66;});return db[_0x9a05('0x78')][_0x9a05('0xc4')](_0x4c3f73,{'transaction':_0x3e2191});});}else{_0x1dd1e1=0x194;_0x3b2b67=[];}});})[_0x9a05('0x3c')](function(){if(_0x1dd1e1!==0x194){return db[_0x9a05('0x78')][_0x9a05('0xc5')]({'where':{'SmsAccountId':_0x1bd3a5},'order':_0x9a05('0x7c')})[_0x9a05('0x3c')](function(_0x28d747){_0x3b2b67=_0x28d747;});}})[_0x9a05('0x2f')](function(_0x32645e){_0x1dd1e1=0x1f4;logger[_0x9a05('0x2b')](_0x32645e['stack']);if(_0x32645e[_0x9a05('0x41')]){delete _0x32645e[_0x9a05('0x41')];}_0x3b2b67=_0x32645e;})[_0x9a05('0xc6')](function(){if(_0x3b2b67===null){_0x575080[_0x9a05('0x30')](_0x1dd1e1);}else{if(_0x1dd1e1===0x1f4){_0x575080['status'](_0x1dd1e1)[_0x9a05('0x42')](_0x3b2b67);}else{_0x575080[_0x9a05('0x31')](_0x1dd1e1)[_0x9a05('0x33')](_0x3b2b67);}}});};exports[_0x9a05('0xc7')]=function(_0x3d8031,_0xc105cf,_0x103385){var _0x48aa76={};var _0x5f3167={};var _0x5da61b;var _0xc312ca;return db[_0x9a05('0x47')]['findOne']({'where':{'id':_0x3d8031[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0xc105cf,null))[_0x9a05('0x3c')](function(_0x18cb29){if(_0x18cb29){_0x5da61b=_0x18cb29;_0x5f3167[_0x9a05('0x4e')]=_[_0x9a05('0x4c')](db['SmsApplication'][_0x9a05('0x70')]);_0x5f3167[_0x9a05('0x4b')]=_[_0x9a05('0x4c')](_0x3d8031[_0x9a05('0x4b')]);_0x5f3167[_0x9a05('0x4d')]=_['intersection'](_0x5f3167[_0x9a05('0x4e')],_0x5f3167[_0x9a05('0x4b')]);_0x48aa76[_0x9a05('0x4f')]=_[_0x9a05('0x60')](_0x5f3167[_0x9a05('0x4e')],qs['fields'](_0x3d8031[_0x9a05('0x4b')][_0x9a05('0x61')]));_0x48aa76[_0x9a05('0x4f')]=_0x48aa76[_0x9a05('0x4f')][_0x9a05('0x50')]?_0x48aa76[_0x9a05('0x4f')]:_0x5f3167[_0x9a05('0x4e')];_0x48aa76[_0x9a05('0xc8')]=qs[_0x9a05('0x53')](_0x3d8031[_0x9a05('0x4b')][_0x9a05('0x53')]);_0x48aa76[_0x9a05('0x56')]=qs['filters'](_['pick'](_0x3d8031[_0x9a05('0x4b')],_0x5f3167['filters']));if(_0x3d8031[_0x9a05('0x4b')]['filter']){_0x48aa76[_0x9a05('0x56')]=_[_0x9a05('0x58')](_0x48aa76[_0x9a05('0x56')],{'$or':_[_0x9a05('0x46')](_0x48aa76['attributes'],function(_0x3e44cc){var _0x461eb7={};_0x461eb7[_0x3e44cc]={'$like':'%'+_0x3d8031[_0x9a05('0x4b')]['filter']+'%'};return _0x461eb7;})});}_0x48aa76=_['merge']({},_0x48aa76,_0x3d8031['options']);return _0x5da61b[_0x9a05('0xc7')](_0x48aa76);}})[_0x9a05('0x3c')](function(_0x1186c5){if(_0x1186c5){_0xc312ca=_0x1186c5[_0x9a05('0x50')];if(!_0x3d8031[_0x9a05('0x4b')][_0x9a05('0x51')](_0x9a05('0x52'))){_0x48aa76[_0x9a05('0x36')]=qs['limit'](_0x3d8031[_0x9a05('0x4b')][_0x9a05('0x36')]);_0x48aa76[_0x9a05('0x34')]=qs[_0x9a05('0x34')](_0x3d8031[_0x9a05('0x4b')][_0x9a05('0x34')]);}return _0x5da61b[_0x9a05('0xc7')](_0x48aa76);}})[_0x9a05('0x3c')](function(_0x2df048){if(_0x2df048){return _0x2df048?{'count':_0xc312ca,'rows':_0x2df048}:null;}})[_0x9a05('0x3c')](respondWithResult(_0xc105cf,null))['catch'](handleError(_0xc105cf,null));};exports[_0x9a05('0xc9')]=function(_0x292387,_0x5e23b6,_0x4afcee){var _0x2b79da={'raw':![],'where':{}};var _0x1b993e={};var _0x53e3d4={'count':0x0,'rows':[]};return db[_0x9a05('0x47')][_0x9a05('0x6f')]({'where':{'id':_0x292387[_0x9a05('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5e23b6,null))['then'](function(_0x20a39c){if(_0x20a39c){_0x1b993e[_0x9a05('0x4e')]=_['keys'](db[_0x9a05('0xa9')][_0x9a05('0x70')]);_0x1b993e[_0x9a05('0x4b')]=_[_0x9a05('0x4c')](_0x292387[_0x9a05('0x4b')]);_0x1b993e[_0x9a05('0x4d')]=_[_0x9a05('0x60')](_0x1b993e[_0x9a05('0x4e')],_0x1b993e[_0x9a05('0x4b')]);_0x2b79da[_0x9a05('0x4f')]=_[_0x9a05('0x60')](_0x1b993e['model'],qs[_0x9a05('0x61')](_0x292387[_0x9a05('0x4b')][_0x9a05('0x61')]));_0x2b79da[_0x9a05('0x4f')]=_0x2b79da[_0x9a05('0x4f')][_0x9a05('0x50')]?_0x2b79da['attributes']:_0x1b993e[_0x9a05('0x4e')];if(!_0x292387['query'][_0x9a05('0x51')](_0x9a05('0x52'))){_0x2b79da[_0x9a05('0x36')]=qs[_0x9a05('0x36')](_0x292387[_0x9a05('0x4b')][_0x9a05('0x36')]);_0x2b79da[_0x9a05('0x34')]=qs[_0x9a05('0x34')](_0x292387[_0x9a05('0x4b')][_0x9a05('0x34')]);}_0x2b79da[_0x9a05('0xc8')]=qs[_0x9a05('0x53')](_0x292387[_0x9a05('0x4b')][_0x9a05('0x53')]);_0x2b79da[_0x9a05('0x56')]=qs[_0x9a05('0x4d')](_[_0x9a05('0x54')](_0x292387[_0x9a05('0x4b')],_0x1b993e[_0x9a05('0x4d')]));_0x2b79da[_0x9a05('0x56')]['SmsAccountId']=_0x20a39c['id'];if(_0x292387[_0x9a05('0x4b')][_0x9a05('0x55')]){_0x2b79da['where']=_[_0x9a05('0x58')](_0x2b79da[_0x9a05('0x56')],{'$or':_['map'](_0x2b79da['attributes'],function(_0x1034a1){var _0x4596cf={};_0x4596cf[_0x1034a1]={'$like':'%'+_0x292387[_0x9a05('0x4b')][_0x9a05('0x55')]+'%'};return _0x4596cf;})});}_0x2b79da=_[_0x9a05('0x58')]({},_0x2b79da,_0x292387['options']);return db[_0x9a05('0xa9')][_0x9a05('0x37')]({'where':_0x2b79da[_0x9a05('0x56')]})[_0x9a05('0x3c')](function(_0x447792){_0x53e3d4[_0x9a05('0x37')]=_0x447792;if(_0x292387[_0x9a05('0x4b')]['includeAll']){_0x2b79da[_0x9a05('0x5b')]=[{'model':db[_0x9a05('0x7f')],'as':'Contact','required':![]},{'model':db[_0x9a05('0xb3')],'as':_0x9a05('0xca'),'attributes':[_0x9a05('0x41'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9a05('0x41'),_0x9a05('0xcb')],'where':_0x292387[_0x9a05('0x4b')]['tag']?{'id':_0x292387[_0x9a05('0x4b')]['tag']}:undefined,'required':_0x292387[_0x9a05('0x4b')][_0x9a05('0xcc')]?!![]:![]}];}return db[_0x9a05('0xa9')][_0x9a05('0x5c')](_0x2b79da);})[_0x9a05('0x3c')](function(_0x929e48){_0x53e3d4[_0x9a05('0x5d')]=_0x929e48;return _0x53e3d4;});}})[_0x9a05('0x3c')](respondWithFilteredResult(_0x5e23b6,_0x2b79da))['catch'](handleError(_0x5e23b6,null));};exports['send']=function(_0x44786a,_0x21a345,_0x288e76){var _0x3771af,_0x129111,_0x1b48e8;if(_[_0x9a05('0x9f')](_0x44786a[_0x9a05('0x64')]['body'])||_0x44786a[_0x9a05('0x64')][_0x9a05('0x64')]===''){throw new db[(_0x9a05('0x80'))]['ValidationError'](_0x9a05('0xa1'));}if(_[_0x9a05('0x9f')](_0x44786a[_0x9a05('0x64')]['to'])){throw new db['Sequelize']['ValidationError']('to\x20is\x20mandatory');}_0x3771af=_0x44786a[_0x9a05('0x64')]['to'];return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x44786a[_0x9a05('0x5f')]['id']},'include':[{'model':db[_0x9a05('0xcd')],'as':_0x9a05('0xce'),'include':[{'model':db['CmContact'],'as':_0x9a05('0xa6'),'where':{'mobile':_0x3771af},'limit':0x1,'order':[[_0x9a05('0x83'),_0x9a05('0xa7')]]}]}]})['then'](handleEntityNotFound(_0x21a345,null))[_0x9a05('0x3c')](function(_0x1641d2){if(_0x1641d2&&_0x1641d2[_0x9a05('0xce')]){_0x129111=_0x1641d2[_0x9a05('0x3d')]({'plain':!![]});if(_0x129111[_0x9a05('0xce')]&&_0x129111['List']['Contacts']['length']){return _0x129111[_0x9a05('0xce')][_0x9a05('0xa6')][0x0];}return db[_0x9a05('0x7f')]['create'](_[_0x9a05('0x1c')](_0x44786a[_0x9a05('0x64')],{'firstName':_0x3771af,'mobile':_0x3771af,'phone':_0x3771af,'ListId':_0x129111[_0x9a05('0x87')]}));}})[_0x9a05('0x3c')](handleEntityNotFound(_0x21a345,null))[_0x9a05('0x3c')](function(_0x346123){if(_0x346123){_0x1b48e8=_0x346123;return db[_0x9a05('0xa9')][_0x9a05('0x62')]({'where':{'ContactId':_0x1b48e8['id'],'closed':![],'SmsAccountId':_0x129111['id']}})[_0x9a05('0x3c')](function(_0x413d59){if(_0x413d59){return[_0x413d59,![]];}return db[_0x9a05('0xa9')][_0x9a05('0x63')]({'UserId':_0x44786a[_0x9a05('0x65')]['id'],'ContactId':_0x1b48e8['id'],'SmsAccountId':_0x129111['id'],'phone':_0x3771af,'firstMsgDirection':_0x9a05('0xcf'),'Messages':[_[_0x9a05('0x58')](_0x44786a[_0x9a05('0x64')],{'read':![],'body':_0x44786a[_0x9a05('0x64')][_0x9a05('0x64')],'phone':_0x3771af,'SmsAccountId':_0x129111['id'],'UserId':_0x44786a[_0x9a05('0x65')]['id'],'ContactId':_0x1b48e8['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})['then'](function(_0x1e0ac6){return[_0x1e0ac6,!![]];});});}})[_0x9a05('0xd0')](function(_0x24f295,_0x588713){if(_0x588713){return _0x24f295;}return db[_0x9a05('0xaf')][_0x9a05('0x63')](_['merge'](_0x44786a[_0x9a05('0x64')],{'read':![],'body':_0x44786a[_0x9a05('0x64')][_0x9a05('0x64')],'phone':_0x3771af,'SmsAccountId':_0x129111['id'],'SmsInteractionId':_0x24f295['id'],'UserId':_0x44786a[_0x9a05('0x65')]['id'],'ContactId':_0x1b48e8['id']}))[_0x9a05('0x3c')](function(_0xec7ad2){_0x24f295[_0x9a05('0xd1')][_0x9a05('0xd2')]=[];_0x24f295['dataValues'][_0x9a05('0xd2')][_0x9a05('0xac')](_0xec7ad2[_0x9a05('0xd1')]);return _0x24f295;});})['then'](respondWithResult(_0x21a345,null))[_0x9a05('0x2f')](handleError(_0x21a345,null));};exports['status']=function(_0x5e205a,_0x3a32fd,_0x43f5c9){if(_0x5e205a[_0x9a05('0x64')]['id']){delete _0x5e205a[_0x9a05('0x64')]['id'];}var _0x5ecf9d,_0x128b56,_0xd64c5a;return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x5e205a[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x3a32fd,null))[_0x9a05('0x3c')](function(_0x1aaa3f){if(_0x1aaa3f){_0xd64c5a=_0x1aaa3f;logger[_0x9a05('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9a05('0x31'),_0x9a05('0xd3'),_0x1aaa3f[_0x9a05('0x49')],util[_0x9a05('0xd4')](_0x5e205a[_0x9a05('0x64')],{'showHidden':![],'depth':null}));switch(_0x1aaa3f[_0x9a05('0x49')]){case _0x9a05('0xd5'):if(_0x5e205a[_0x9a05('0x64')][_0x9a05('0xd6')]&&_0x5e205a['body'][_0x9a05('0x31')]){_0x128b56=_0x5e205a[_0x9a05('0x64')][_0x9a05('0x31')];return db[_0x9a05('0xaf')]['find']({'where':{'messageId':_0x5e205a[_0x9a05('0x64')]['skebby_dispatch_id']}});}break;case _0x9a05('0x8f'):if(_0x5e205a['body'][_0x9a05('0xd7')]&&_0x5e205a[_0x9a05('0x64')]['statusInt']){_0x128b56=_0x5e205a['body'][_0x9a05('0xd8')];return db[_0x9a05('0xaf')][_0x9a05('0x62')]({'where':{'messageId':_0x5e205a[_0x9a05('0x64')][_0x9a05('0xd7')]}});}break;case _0x9a05('0x90'):if(_0x5e205a[_0x9a05('0x64')][_0x9a05('0x91')]&&_0x5e205a['body'][_0x9a05('0xd9')]){_0x128b56=_0x5e205a[_0x9a05('0x64')][_0x9a05('0xd9')];return db[_0x9a05('0xaf')][_0x9a05('0x62')]({'where':{'messageId':_0x5e205a['body'][_0x9a05('0x91')]}});}break;case _0x9a05('0x94'):var _0x27b79e=_0x5e205a[_0x9a05('0x64')][_0x9a05('0x95')][0x0];if(_0x27b79e[_0x9a05('0x8b')]&&_0x27b79e['status'][_0x9a05('0xda')]===_0x9a05('0xdb')){_0x128b56=_0x27b79e['status']['groupName'];return db['SmsMessage'][_0x9a05('0x62')]({'where':{'messageId':_0x27b79e[_0x9a05('0x8b')]}});}break;case _0x9a05('0x99'):if(_0x5e205a['body'][_0x9a05('0x8b')]&&_0x5e205a[_0x9a05('0x64')][_0x9a05('0x31')]){_0x128b56=_0x5e205a[_0x9a05('0x64')]['status'];return db[_0x9a05('0xaf')]['find']({'where':{'messageId':_0x5e205a[_0x9a05('0x64')][_0x9a05('0x8b')]}});}break;case _0x9a05('0x9c'):if(_0x5e205a[_0x9a05('0x64')][0x0][_0x9a05('0x2d')]['id']){_0x128b56=_0x5e205a[_0x9a05('0x64')][0x0]['type'];return db[_0x9a05('0xaf')][_0x9a05('0x62')]({'where':{'messageId':_0x5e205a[_0x9a05('0x64')][0x0][_0x9a05('0x2d')]['id']}});}break;case _0x9a05('0x9d'):if(_0x5e205a[_0x9a05('0x64')]['redif']&&_0x5e205a[_0x9a05('0x64')]['status']){_0x128b56=_0x5e205a['body'][_0x9a05('0x31')];return db[_0x9a05('0xaf')][_0x9a05('0x62')]({'where':{'messageId':_0x5e205a[_0x9a05('0x64')]['redif']}});}break;}}})[_0x9a05('0x3c')](handleEntityNotFound(_0x3a32fd,null))[_0x9a05('0x3c')](function(_0x46c11b){if(_0x46c11b){_0x5ecf9d=_0x46c11b;switch(_0xd64c5a['type']){case'skebby':if(_0x128b56===_0x9a05('0xdb')){return _0x5ecf9d[_0x9a05('0x69')]({'read':!![]});}else{logger[_0x9a05('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9a05('0xd5'),util['inspect'](_0x5e205a[_0x9a05('0x64')],{'showHidden':![],'depth':null}));}break;case _0x9a05('0x8f'):if(_0x128b56==='1'){return _0x5ecf9d[_0x9a05('0x69')]({'read':!![]});}else{logger[_0x9a05('0x2b')](_0x9a05('0x29'),_0x9a05('0x31'),_0x9a05('0xd5'),util['inspect'](_0x5e205a['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5e205a['body'][_0x9a05('0xdc')]&&_0x128b56>=0xc8&&_0x128b56<=0xce){return _0x5ecf9d[_0x9a05('0x69')]({'read':!![]});}else{logger[_0x9a05('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9a05('0x31'),'clicksend',util[_0x9a05('0xd4')](_0x5e205a[_0x9a05('0x64')],{'showHidden':![],'depth':null}));}break;case _0x9a05('0x94'):var _0x222471=_0x5e205a[_0x9a05('0x64')]['results'][0x0];if(_0x222471[_0x9a05('0x31')][_0x9a05('0xda')]===_0x9a05('0xdb')){return _0x5ecf9d[_0x9a05('0x69')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9a05('0x94'),util[_0x9a05('0xd4')](_0x5e205a[_0x9a05('0x64')],{'showHidden':![],'depth':null}));}break;case _0x9a05('0x99'):if(_0x128b56==_0x9a05('0xdd')||_0x128b56==_0x9a05('0xde')){return _0x5ecf9d[_0x9a05('0x69')]({'read':!![]});}else{logger[_0x9a05('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9a05('0x31'),_0x9a05('0x99'),util[_0x9a05('0xd4')](_0x5e205a[_0x9a05('0x64')],{'showHidden':![],'depth':null}));}break;case _0x9a05('0x9c'):if(_0x128b56==_0x9a05('0xdf')){return _0x5ecf9d['update']({'read':!![]});}else{logger[_0x9a05('0x2b')](_0x9a05('0x29'),_0x9a05('0x31'),_0x9a05('0x9c'),util[_0x9a05('0xd4')](_0x5e205a[_0x9a05('0x64')],{'showHidden':![],'depth':null}));}break;case _0x9a05('0x9d'):if(_0x128b56==='DELIVRD'||_0x128b56===_0x9a05('0xe0')){return _0x5ecf9d[_0x9a05('0x69')]({'read':!![]});}else{logger[_0x9a05('0x2b')](_0x9a05('0x29'),'status','intelepeer',util[_0x9a05('0xd4')](_0x5e205a['body'],{'showHidden':![],'depth':null}));}break;}return _0x5ecf9d;}})[_0x9a05('0x3c')](respondWithResult(_0x3a32fd,null))[_0x9a05('0x2f')](handleError(_0x3a32fd,null));};exports['statusGet']=function(_0x5c4991,_0x1715fc,_0x4745ca){var _0x4d180e,_0x292f5b,_0x2ca3c0;return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x5c4991[_0x9a05('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1715fc,null))[_0x9a05('0x3c')](function(_0x53d9a6){if(_0x53d9a6){_0x2ca3c0=_0x53d9a6;logger[_0x9a05('0x28')](_0x9a05('0x29'),'status',_0x9a05('0xd3'),_0x53d9a6[_0x9a05('0x49')],util[_0x9a05('0xd4')](_0x5c4991[_0x9a05('0x4b')],{'showHidden':![],'depth':null}));switch(_0x53d9a6['type']){case _0x9a05('0x96'):if(_0x5c4991['query'][_0x9a05('0xe1')]&&_0x5c4991[_0x9a05('0x4b')][_0x9a05('0xe2')]){_0x292f5b=_0x5c4991['query'][_0x9a05('0xe2')];return db[_0x9a05('0xaf')][_0x9a05('0x62')]({'where':{'messageId':_0x5c4991[_0x9a05('0x4b')][_0x9a05('0xe1')]}});}break;}}})[_0x9a05('0x3c')](handleEntityNotFound(_0x1715fc,null))['then'](function(_0x425d5f){if(_0x425d5f){_0x4d180e=_0x425d5f;switch(_0x2ca3c0[_0x9a05('0x49')]){case'csc':if(_0x292f5b==='2'||_0x292f5b==='6'){return _0x4d180e[_0x9a05('0x69')]({'read':!![]});}else{logger[_0x9a05('0x2b')](_0x9a05('0x29'),_0x9a05('0x31'),_0x9a05('0x96'),util[_0x9a05('0xd4')](_0x5c4991[_0x9a05('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x4d180e;}})['then'](respondWithResult(_0x1715fc,null))['catch'](handleError(_0x1715fc,null));};exports['addAgents']=function(_0x2160ef,_0x1c90d1,_0xc55e91){return db[_0x9a05('0x47')][_0x9a05('0x62')]({'where':{'id':_0x2160ef[_0x9a05('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1c90d1,null))[_0x9a05('0x3c')](function(_0x40f528){if(_0x40f528){return _0x40f528[_0x9a05('0xe3')](_0x2160ef[_0x9a05('0x64')]['ids'],_[_0x9a05('0xe4')](_0x2160ef[_0x9a05('0x64')],[_0x9a05('0x72'),'id'])||{})[_0x9a05('0xd0')](function(_0x34858c){for(var _0x5a4a86=0x0;_0x5a4a86<_0x2160ef[_0x9a05('0x64')][_0x9a05('0x72')][_0x9a05('0x50')];_0x5a4a86+=0x1){socket[_0x9a05('0xe5')](_0x9a05('0xe6'),{'UserId':Number(_0x2160ef[_0x9a05('0x64')][_0x9a05('0x72')][_0x5a4a86]),'SmsAccountId':Number(_0x2160ef['params']['id'])});}return _0x34858c;});}})['then'](respondWithResult(_0x1c90d1,null))[_0x9a05('0x2f')](handleError(_0x1c90d1,null));};exports[_0x9a05('0xe7')]=function(_0x151441,_0x59216b,_0x4d74cc){return db[_0x9a05('0x47')]['find']({'where':{'id':_0x151441[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x59216b,null))[_0x9a05('0x3c')](function(_0x4e86e2){if(_0x4e86e2){return _0x4e86e2[_0x9a05('0xe7')](_0x151441[_0x9a05('0x4b')]['ids'])[_0x9a05('0x3c')](function(){if(_[_0x9a05('0xe8')](_0x151441[_0x9a05('0x4b')][_0x9a05('0x72')])){for(var _0x20e5a0=0x0;_0x20e5a0<_0x151441['query'][_0x9a05('0x72')][_0x9a05('0x50')];_0x20e5a0+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x151441[_0x9a05('0x4b')]['ids'][_0x20e5a0]),'SmsAccountId':Number(_0x151441[_0x9a05('0x5f')]['id'])});}}else{socket[_0x9a05('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x151441['query'][_0x9a05('0x72')]),'SmsAccountId':Number(_0x151441['params']['id'])});}});}})['then'](respondWithStatusCode(_0x59216b,null))[_0x9a05('0x2f')](handleError(_0x59216b,null));};exports['getAgents']=function(_0x45e5ff,_0x374ef2,_0x55c3b3){var _0x3bcf91={};var _0x4877a5={};var _0x40f063;var _0xe5ab10;return db[_0x9a05('0x47')][_0x9a05('0x6f')]({'where':{'id':_0x45e5ff[_0x9a05('0x5f')]['id']}})[_0x9a05('0x3c')](handleEntityNotFound(_0x374ef2,null))['then'](function(_0x33e1ab){if(_0x33e1ab){_0x40f063=_0x33e1ab;_0x4877a5[_0x9a05('0x4e')]=_['keys'](db['User']['rawAttributes']);_0x4877a5[_0x9a05('0x4b')]=_['keys'](_0x45e5ff['query']);_0x4877a5[_0x9a05('0x4d')]=_[_0x9a05('0x60')](_0x4877a5[_0x9a05('0x4e')],_0x4877a5['query']);_0x3bcf91[_0x9a05('0x4f')]=_[_0x9a05('0x60')](_0x4877a5[_0x9a05('0x4e')],qs['fields'](_0x45e5ff[_0x9a05('0x4b')]['fields']));_0x3bcf91[_0x9a05('0x4f')]=_0x3bcf91[_0x9a05('0x4f')]['length']?_0x3bcf91[_0x9a05('0x4f')]:_0x4877a5[_0x9a05('0x4e')];_0x3bcf91[_0x9a05('0xc8')]=qs['sort'](_0x45e5ff['query'][_0x9a05('0x53')]);_0x3bcf91['where']=qs[_0x9a05('0x4d')](_[_0x9a05('0x54')](_0x45e5ff[_0x9a05('0x4b')],_0x4877a5[_0x9a05('0x4d')]));if(_0x45e5ff[_0x9a05('0x4b')][_0x9a05('0x55')]){_0x3bcf91['where']=_[_0x9a05('0x58')](_0x3bcf91[_0x9a05('0x56')],{'$or':_[_0x9a05('0x46')](_0x3bcf91[_0x9a05('0x4f')],function(_0x33c89d){var _0x239013={};_0x239013[_0x33c89d]={'$like':'%'+_0x45e5ff[_0x9a05('0x4b')][_0x9a05('0x55')]+'%'};return _0x239013;})});}_0x3bcf91=_[_0x9a05('0x58')]({},_0x3bcf91,_0x45e5ff[_0x9a05('0x59')]);return _0x40f063[_0x9a05('0xe9')](_0x3bcf91);}})[_0x9a05('0x3c')](function(_0x3bbee3){if(_0x3bbee3){_0xe5ab10=_0x3bbee3[_0x9a05('0x50')];if(!_0x45e5ff[_0x9a05('0x4b')]['hasOwnProperty'](_0x9a05('0x52'))){_0x3bcf91['limit']=qs[_0x9a05('0x36')](_0x45e5ff[_0x9a05('0x4b')]['limit']);_0x3bcf91[_0x9a05('0x34')]=qs['offset'](_0x45e5ff['query'][_0x9a05('0x34')]);}return _0x40f063[_0x9a05('0xe9')](_0x3bcf91);}})[_0x9a05('0x3c')](function(_0x3d3940){if(_0x3d3940){return _0x3d3940?{'count':_0xe5ab10,'rows':_0x3d3940}:null;}})[_0x9a05('0x3c')](respondWithResult(_0x374ef2,null))[_0x9a05('0x2f')](handleError(_0x374ef2,null));}; \ No newline at end of file +var _0x2fa2=['update','destroy','get','SmsAccounts','end','stack','name','index','mandatoryDispositionPause','map','SmsAccount','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','merge','include','findAll','catch','show','params','Pause','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','findOne','CannedAnswer','hasOwnProperty','removeAnswers','notify','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','text','connectel','clicksend','message_id','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','omit','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','ContactId','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','send','\x0a','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','User','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','requestid','statusInt','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x1cac80,_0x52918e){var _0x557db1=function(_0x308e2c){while(--_0x308e2c){_0x1cac80['push'](_0x1cac80['shift']());}};_0x557db1(++_0x52918e);}(_0x2fa2,0xae));var _0x22fa=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x2fa2[_0x454165];return _0x56db53;};'use strict';var emlformat=require(_0x22fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22fa('0x1'));var jsonpatch=require(_0x22fa('0x2'));var rp=require(_0x22fa('0x3'));var moment=require(_0x22fa('0x4'));var BPromise=require(_0x22fa('0x5'));var Mustache=require(_0x22fa('0x6'));var util=require(_0x22fa('0x7'));var path=require(_0x22fa('0x8'));var sox=require(_0x22fa('0x9'));var csv=require(_0x22fa('0xa'));var ejs=require(_0x22fa('0xb'));var fs=require('fs');var fs_extra=require(_0x22fa('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x22fa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x22fa('0xe'));var Redis=require(_0x22fa('0xf'));var authService=require(_0x22fa('0x10'));var qs=require(_0x22fa('0x11'));var as=require(_0x22fa('0x12'));var hardwareService=require(_0x22fa('0x13'));var logger=require('../../config/logger')(_0x22fa('0x14'));var utils=require(_0x22fa('0x15'));var config=require(_0x22fa('0x16'));var licenseUtil=require(_0x22fa('0x17'));var db=require(_0x22fa('0x18'))['db'];config[_0x22fa('0x19')]=_[_0x22fa('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x22fa('0x1b'))(new Redis(config[_0x22fa('0x19')]));require('./smsAccount.socket')[_0x22fa('0x1c')](socket);var jayson=require(_0x22fa('0x1d'));var client=jayson[_0x22fa('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0xa4b54b,_0x17dab7,_0x5bc937,_0x29b366){return new BPromise(function(_0x54b400,_0x51cf2a){var _0xcbab6=_0x29b366||client;return _0xcbab6['request'](_0xa4b54b,_0x5bc937)[_0x22fa('0x1f')](function(_0x340848){logger[_0x22fa('0x20')]('SmsAccount,\x20%s,\x20%s',_0x17dab7,_0x22fa('0x21'));logger[_0x22fa('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x17dab7,_0x22fa('0x21'),JSON['stringify'](_0x340848));if(_0x340848[_0x22fa('0x23')]){if(_0x340848[_0x22fa('0x23')][_0x22fa('0x24')]===0x1f4){logger[_0x22fa('0x23')](_0x22fa('0x25'),_0x17dab7,_0x340848[_0x22fa('0x23')][_0x22fa('0x26')]);return _0x51cf2a(_0x340848[_0x22fa('0x23')][_0x22fa('0x26')]);}logger[_0x22fa('0x23')](_0x22fa('0x25'),_0x17dab7,_0x340848[_0x22fa('0x23')][_0x22fa('0x26')]);return _0x54b400(_0x340848[_0x22fa('0x23')][_0x22fa('0x26')]);}else{logger['info'](_0x22fa('0x25'),_0x17dab7,_0x22fa('0x21'));_0x54b400(_0x340848[_0x22fa('0x27')]['message']);}})['catch'](function(_0x5c61cc){logger['error'](_0x22fa('0x25'),_0x17dab7,_0x5c61cc);_0x51cf2a(_0x5c61cc);});});}function respondWithStatusCode(_0xb5a530,_0x5b6828){_0x5b6828=_0x5b6828||0xcc;return function(_0x58be26){if(_0x58be26){return _0xb5a530[_0x22fa('0x28')](_0x5b6828);}return _0xb5a530[_0x22fa('0x29')](_0x5b6828)['end']();};}function respondWithResult(_0xa3ba35,_0x4f8cf0){_0x4f8cf0=_0x4f8cf0||0xc8;return function(_0x3ee069){if(_0x3ee069){return _0xa3ba35[_0x22fa('0x29')](_0x4f8cf0)[_0x22fa('0x2a')](_0x3ee069);}};}function respondWithFilteredResult(_0x23eaa3,_0x45ff45){return function(_0x1beb53){if(_0x1beb53){var _0x578dfc=typeof _0x45ff45[_0x22fa('0x2b')]===_0x22fa('0x2c')&&typeof _0x45ff45[_0x22fa('0x2d')]===_0x22fa('0x2c');var _0x37a1fd=_0x1beb53[_0x22fa('0x2e')];var _0x407c48=_0x578dfc?0x0:_0x45ff45[_0x22fa('0x2b')];var _0x32366a=_0x578dfc?_0x1beb53[_0x22fa('0x2e')]:_0x45ff45[_0x22fa('0x2b')]+_0x45ff45[_0x22fa('0x2d')];var _0x5992f8;if(_0x32366a>=_0x37a1fd){_0x32366a=_0x37a1fd;_0x5992f8=0xc8;}else{_0x5992f8=0xce;}_0x23eaa3[_0x22fa('0x29')](_0x5992f8);return _0x23eaa3[_0x22fa('0x2f')](_0x22fa('0x30'),_0x407c48+'-'+_0x32366a+'/'+_0x37a1fd)[_0x22fa('0x2a')](_0x1beb53);}return null;};}function patchUpdates(_0x2a8b00){return function(_0xc62208){try{jsonpatch[_0x22fa('0x31')](_0xc62208,_0x2a8b00,!![]);}catch(_0x178f5a){return BPromise[_0x22fa('0x32')](_0x178f5a);}return _0xc62208[_0x22fa('0x33')]();};}function saveUpdates(_0x3e3e17,_0x465459){return function(_0x33dd3b){if(_0x33dd3b){return _0x33dd3b[_0x22fa('0x34')](_0x3e3e17)['then'](function(_0x23f33f){return _0x23f33f;});}return null;};}function removeEntity(_0x1db4a2,_0x14f1c3){return function(_0x28a335){if(_0x28a335){return _0x28a335[_0x22fa('0x35')]()[_0x22fa('0x1f')](function(){var _0xfc08b9=_0x28a335[_0x22fa('0x36')]({'plain':!![]});var _0x23b701=_0x22fa('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x23b701,'resourceId':_0xfc08b9['id']}})['then'](function(){return _0x28a335;});})[_0x22fa('0x1f')](function(){_0x1db4a2['status'](0xcc)[_0x22fa('0x38')]();});}};}function handleEntityNotFound(_0x5126e1,_0x862b50){return function(_0x2a70bc){if(!_0x2a70bc){_0x5126e1['sendStatus'](0x194);}return _0x2a70bc;};}function handleError(_0x32d793,_0x3327bd){_0x3327bd=_0x3327bd||0x1f4;return function(_0x4f263c){logger['error'](_0x4f263c[_0x22fa('0x39')]);if(_0x4f263c['name']){delete _0x4f263c[_0x22fa('0x3a')];}_0x32d793[_0x22fa('0x29')](_0x3327bd)['send'](_0x4f263c);};}exports[_0x22fa('0x3b')]=function(_0x19c085,_0x1e4373){var _0x4ba891={'include':[{'model':db['Pause'],'as':_0x22fa('0x3c')}]},_0x151cc5={},_0x465127={'count':0x0,'rows':[]};var _0x472562=_[_0x22fa('0x3d')](db[_0x22fa('0x3e')]['rawAttributes'],function(_0x141d90){return{'name':_0x141d90[_0x22fa('0x3f')],'type':_0x141d90['type'][_0x22fa('0x40')]};});_0x151cc5[_0x22fa('0x41')]=_['map'](_0x472562,_0x22fa('0x3a'));_0x151cc5['query']=_[_0x22fa('0x42')](_0x19c085[_0x22fa('0x43')]);_0x151cc5[_0x22fa('0x44')]=_[_0x22fa('0x45')](_0x151cc5[_0x22fa('0x41')],_0x151cc5[_0x22fa('0x43')]);_0x4ba891[_0x22fa('0x46')]=_[_0x22fa('0x45')](_0x151cc5[_0x22fa('0x41')],qs[_0x22fa('0x47')](_0x19c085[_0x22fa('0x43')]['fields']));_0x4ba891[_0x22fa('0x46')]=_0x4ba891[_0x22fa('0x46')][_0x22fa('0x48')]?_0x4ba891[_0x22fa('0x46')]:_0x151cc5[_0x22fa('0x41')];if(!_0x19c085['query']['hasOwnProperty'](_0x22fa('0x49'))){_0x4ba891['limit']=qs['limit'](_0x19c085['query']['limit']);_0x4ba891[_0x22fa('0x2b')]=qs[_0x22fa('0x2b')](_0x19c085[_0x22fa('0x43')][_0x22fa('0x2b')]);}_0x4ba891[_0x22fa('0x4a')]=qs[_0x22fa('0x4b')](_0x19c085[_0x22fa('0x43')]['sort']);_0x4ba891['where']=qs[_0x22fa('0x44')](_[_0x22fa('0x4c')](_0x19c085[_0x22fa('0x43')],_0x151cc5[_0x22fa('0x44')]),_0x472562);if(_0x19c085[_0x22fa('0x43')][_0x22fa('0x4d')]){_0x4ba891[_0x22fa('0x4e')]=_['merge'](_0x4ba891[_0x22fa('0x4e')],{'$or':_['map'](_0x472562,function(_0x12fa3c){if(_0x12fa3c[_0x22fa('0x4f')]!=='VIRTUAL'){var _0x3936a2={};_0x3936a2[_0x12fa3c[_0x22fa('0x3a')]]={'$like':'%'+_0x19c085[_0x22fa('0x43')]['filter']+'%'};return _0x3936a2;}})});}_0x4ba891=_[_0x22fa('0x50')]({},_0x4ba891,_0x19c085['options']);var _0x4f8bf4={'where':_0x4ba891['where']};return db[_0x22fa('0x3e')]['count'](_0x4f8bf4)[_0x22fa('0x1f')](function(_0x19cad2){_0x465127['count']=_0x19cad2;if(_0x19c085[_0x22fa('0x43')]['includeAll']){_0x4ba891[_0x22fa('0x51')]=[{'all':!![]}];}return db[_0x22fa('0x3e')][_0x22fa('0x52')](_0x4ba891);})[_0x22fa('0x1f')](function(_0x7969f0){_0x465127['rows']=_0x7969f0;return _0x465127;})['then'](respondWithFilteredResult(_0x1e4373,_0x4ba891))[_0x22fa('0x53')](handleError(_0x1e4373,null));};exports[_0x22fa('0x54')]=function(_0x3856a9,_0x3a43a9){var _0x333657={'raw':![],'where':{'id':_0x3856a9[_0x22fa('0x55')]['id']},'include':[{'model':db[_0x22fa('0x56')],'as':_0x22fa('0x3c')}]},_0x50db36={};_0x50db36[_0x22fa('0x41')]=_[_0x22fa('0x42')](db[_0x22fa('0x3e')][_0x22fa('0x57')]);_0x50db36['query']=_[_0x22fa('0x42')](_0x3856a9[_0x22fa('0x43')]);_0x50db36[_0x22fa('0x44')]=_[_0x22fa('0x45')](_0x50db36[_0x22fa('0x41')],_0x50db36[_0x22fa('0x43')]);_0x333657[_0x22fa('0x46')]=_[_0x22fa('0x45')](_0x50db36['model'],qs['fields'](_0x3856a9['query'][_0x22fa('0x47')]));_0x333657[_0x22fa('0x46')]=_0x333657[_0x22fa('0x46')][_0x22fa('0x48')]?_0x333657[_0x22fa('0x46')]:_0x50db36[_0x22fa('0x41')];if(_0x3856a9[_0x22fa('0x43')][_0x22fa('0x58')]){_0x333657[_0x22fa('0x51')]=[{'all':!![]}];}_0x333657=_['merge']({},_0x333657,_0x3856a9[_0x22fa('0x59')]);return db[_0x22fa('0x3e')][_0x22fa('0x5a')](_0x333657)[_0x22fa('0x1f')](handleEntityNotFound(_0x3a43a9,null))[_0x22fa('0x1f')](respondWithResult(_0x3a43a9,null))['catch'](handleError(_0x3a43a9,null));};exports[_0x22fa('0x5b')]=function(_0x59442d,_0x414cb7){return db[_0x22fa('0x3e')]['create'](_0x59442d[_0x22fa('0x5c')],{})[_0x22fa('0x1f')](function(_0x13dd6b){var _0x12050b=_0x59442d[_0x22fa('0x5d')]['get']({'plain':!![]});if(!_0x12050b)throw new Error(_0x22fa('0x5e'));if(_0x12050b[_0x22fa('0x5f')]===_0x22fa('0x5d')){var _0x5f00a8=_0x13dd6b[_0x22fa('0x36')]({'plain':!![]});var _0x3f787f='SmsAccounts';return db['UserProfileSection'][_0x22fa('0x5a')]({'where':{'name':_0x3f787f,'userProfileId':_0x12050b[_0x22fa('0x60')]},'raw':!![]})[_0x22fa('0x1f')](function(_0x1d10ee){if(_0x1d10ee&&_0x1d10ee[_0x22fa('0x61')]===0x0){return db['UserProfileResource'][_0x22fa('0x5b')]({'name':_0x5f00a8[_0x22fa('0x3a')],'resourceId':_0x5f00a8['id'],'type':_0x1d10ee[_0x22fa('0x3a')],'sectionId':_0x1d10ee['id']},{})['then'](function(){return _0x13dd6b;});}else{return _0x13dd6b;}})[_0x22fa('0x53')](function(_0x54cbf3){logger[_0x22fa('0x23')](_0x22fa('0x62'),_0x54cbf3);throw _0x54cbf3;});}return _0x13dd6b;})[_0x22fa('0x1f')](respondWithResult(_0x414cb7,0xc9))[_0x22fa('0x53')](handleError(_0x414cb7,null));};exports[_0x22fa('0x34')]=function(_0x489ad2,_0x2f05d8){if(_0x489ad2[_0x22fa('0x5c')]['id']){delete _0x489ad2[_0x22fa('0x5c')]['id'];}return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x489ad2[_0x22fa('0x55')]['id']},'include':[{'model':db[_0x22fa('0x56')],'as':'mandatoryDispositionPause'}]})[_0x22fa('0x1f')](handleEntityNotFound(_0x2f05d8,null))[_0x22fa('0x1f')](saveUpdates(_0x489ad2[_0x22fa('0x5c')],null))[_0x22fa('0x1f')](respondWithResult(_0x2f05d8,null))[_0x22fa('0x53')](handleError(_0x2f05d8,null));};exports[_0x22fa('0x35')]=function(_0x27f548,_0x5d8d08){return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x27f548[_0x22fa('0x55')]['id']}})['then'](handleEntityNotFound(_0x5d8d08,null))[_0x22fa('0x1f')](removeEntity(_0x5d8d08,null))['catch'](handleError(_0x5d8d08,null));};exports[_0x22fa('0x63')]=function(_0x5c06c3,_0x4baf68){return db[_0x22fa('0x3e')][_0x22fa('0x63')]()[_0x22fa('0x1f')](respondWithResult(_0x4baf68,null))[_0x22fa('0x53')](handleError(_0x4baf68,null));};exports[_0x22fa('0x64')]=function(_0x512c24,_0x10b224,_0xee5b13){if(_0x512c24['body']['id']){delete _0x512c24[_0x22fa('0x5c')]['id'];}return db['SmsAccount'][_0x22fa('0x5a')]({'where':{'id':_0x512c24[_0x22fa('0x55')]['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x10b224,null))[_0x22fa('0x1f')](function(_0x34c784){if(_0x34c784){_0x512c24['body'][_0x22fa('0x65')]=_0x34c784['id'];return db[_0x22fa('0x66')][_0x22fa('0x5b')](_0x512c24[_0x22fa('0x5c')]);}})[_0x22fa('0x1f')](respondWithResult(_0x10b224,null))['catch'](handleError(_0x10b224,null));};exports[_0x22fa('0x67')]=function(_0x478dea,_0x3e2bf5,_0x502a11){var _0x1027cd={'raw':![],'where':{}};var _0x47f5c6={};var _0x26bba7={'count':0x0,'rows':[]};return db[_0x22fa('0x3e')]['findOne']({'where':{'id':_0x478dea[_0x22fa('0x55')]['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x3e2bf5,null))['then'](function(_0x425ac2){if(_0x425ac2){_0x47f5c6['model']=_['keys'](db[_0x22fa('0x66')][_0x22fa('0x57')]);_0x47f5c6['query']=_['keys'](_0x478dea[_0x22fa('0x43')]);_0x47f5c6[_0x22fa('0x44')]=_['intersection'](_0x47f5c6[_0x22fa('0x41')],_0x47f5c6[_0x22fa('0x43')]);_0x1027cd[_0x22fa('0x46')]=_[_0x22fa('0x45')](_0x47f5c6['model'],qs['fields'](_0x478dea[_0x22fa('0x43')][_0x22fa('0x47')]));_0x1027cd[_0x22fa('0x46')]=_0x1027cd[_0x22fa('0x46')][_0x22fa('0x48')]?_0x1027cd[_0x22fa('0x46')]:_0x47f5c6[_0x22fa('0x41')];if(!_0x478dea[_0x22fa('0x43')]['hasOwnProperty'](_0x22fa('0x49'))){_0x1027cd[_0x22fa('0x2d')]=qs[_0x22fa('0x2d')](_0x478dea['query'][_0x22fa('0x2d')]);_0x1027cd['offset']=qs['offset'](_0x478dea['query'][_0x22fa('0x2b')]);}_0x1027cd[_0x22fa('0x4a')]=qs[_0x22fa('0x4b')](_0x478dea[_0x22fa('0x43')][_0x22fa('0x4b')]);_0x1027cd[_0x22fa('0x4e')]=qs[_0x22fa('0x44')](_[_0x22fa('0x4c')](_0x478dea[_0x22fa('0x43')],_0x47f5c6[_0x22fa('0x44')]));_0x1027cd[_0x22fa('0x4e')][_0x22fa('0x65')]=_0x425ac2['id'];if(_0x478dea[_0x22fa('0x43')][_0x22fa('0x4d')]){_0x1027cd[_0x22fa('0x4e')]=_['merge'](_0x1027cd[_0x22fa('0x4e')],{'$or':_[_0x22fa('0x3d')](_0x1027cd[_0x22fa('0x46')],function(_0x194aa4){var _0x264982={};_0x264982[_0x194aa4]={'$like':'%'+_0x478dea['query']['filter']+'%'};return _0x264982;})});}_0x1027cd=_['merge']({},_0x1027cd,_0x478dea[_0x22fa('0x59')]);return db[_0x22fa('0x66')][_0x22fa('0x2e')]({'where':_0x1027cd[_0x22fa('0x4e')]})[_0x22fa('0x1f')](function(_0x2c0784){_0x26bba7[_0x22fa('0x2e')]=_0x2c0784;if(_0x478dea[_0x22fa('0x43')][_0x22fa('0x58')]){_0x1027cd[_0x22fa('0x51')]=[{'all':!![]}];}return db[_0x22fa('0x66')][_0x22fa('0x52')](_0x1027cd);})[_0x22fa('0x1f')](function(_0x5e37ea){_0x26bba7[_0x22fa('0x68')]=_0x5e37ea;return _0x26bba7;});}})[_0x22fa('0x1f')](respondWithFilteredResult(_0x3e2bf5,_0x1027cd))['catch'](handleError(_0x3e2bf5,null));};exports[_0x22fa('0x69')]=function(_0x5bc58a,_0x5e6935,_0x1471c3){return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x5bc58a['params']['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x5e6935,null))[_0x22fa('0x1f')](function(_0x3e5712){if(_0x3e5712){return _0x3e5712[_0x22fa('0x69')](_0x5bc58a[_0x22fa('0x43')][_0x22fa('0x6a')]);}})[_0x22fa('0x1f')](respondWithStatusCode(_0x5e6935,null))[_0x22fa('0x53')](handleError(_0x5e6935,null));};exports[_0x22fa('0x6b')]=function(_0x3ba579,_0x3935e6,_0x375b72){if(_0x3ba579['body']['id']){delete _0x3ba579[_0x22fa('0x5c')]['id'];}return db[_0x22fa('0x3e')]['find']({'where':{'id':_0x3ba579[_0x22fa('0x55')]['id']}})['then'](handleEntityNotFound(_0x3935e6,null))[_0x22fa('0x1f')](function(_0x1fd699){if(_0x1fd699){_0x3ba579[_0x22fa('0x5c')][_0x22fa('0x65')]=_0x1fd699['id'];return db['CannedAnswer'][_0x22fa('0x5b')](_0x3ba579['body']);}})[_0x22fa('0x1f')](respondWithResult(_0x3935e6,null))['catch'](handleError(_0x3935e6,null));};exports['getAnswers']=function(_0x56e855,_0x909c97,_0x8f7fd7){var _0x292e30={'raw':![],'where':{}};var _0x4069f4={};var _0x2537cd={'count':0x0,'rows':[]};return db['SmsAccount'][_0x22fa('0x6c')]({'where':{'id':_0x56e855[_0x22fa('0x55')]['id']}})['then'](handleEntityNotFound(_0x909c97,null))['then'](function(_0x37ac0a){if(_0x37ac0a){_0x4069f4[_0x22fa('0x41')]=_[_0x22fa('0x42')](db[_0x22fa('0x6d')][_0x22fa('0x57')]);_0x4069f4[_0x22fa('0x43')]=_[_0x22fa('0x42')](_0x56e855['query']);_0x4069f4[_0x22fa('0x44')]=_[_0x22fa('0x45')](_0x4069f4['model'],_0x4069f4[_0x22fa('0x43')]);_0x292e30['attributes']=_[_0x22fa('0x45')](_0x4069f4[_0x22fa('0x41')],qs['fields'](_0x56e855[_0x22fa('0x43')]['fields']));_0x292e30[_0x22fa('0x46')]=_0x292e30[_0x22fa('0x46')][_0x22fa('0x48')]?_0x292e30[_0x22fa('0x46')]:_0x4069f4[_0x22fa('0x41')];if(!_0x56e855[_0x22fa('0x43')][_0x22fa('0x6e')](_0x22fa('0x49'))){_0x292e30[_0x22fa('0x2d')]=qs['limit'](_0x56e855[_0x22fa('0x43')][_0x22fa('0x2d')]);_0x292e30[_0x22fa('0x2b')]=qs['offset'](_0x56e855['query']['offset']);}_0x292e30[_0x22fa('0x4a')]=qs[_0x22fa('0x4b')](_0x56e855[_0x22fa('0x43')][_0x22fa('0x4b')]);_0x292e30['where']=qs['filters'](_[_0x22fa('0x4c')](_0x56e855['query'],_0x4069f4['filters']));_0x292e30[_0x22fa('0x4e')][_0x22fa('0x65')]=_0x37ac0a['id'];if(_0x56e855[_0x22fa('0x43')][_0x22fa('0x4d')]){_0x292e30[_0x22fa('0x4e')]=_[_0x22fa('0x50')](_0x292e30[_0x22fa('0x4e')],{'$or':_[_0x22fa('0x3d')](_0x292e30[_0x22fa('0x46')],function(_0x53145a){var _0x1e63b1={};_0x1e63b1[_0x53145a]={'$like':'%'+_0x56e855[_0x22fa('0x43')][_0x22fa('0x4d')]+'%'};return _0x1e63b1;})});}_0x292e30=_[_0x22fa('0x50')]({},_0x292e30,_0x56e855[_0x22fa('0x59')]);return db['CannedAnswer']['count']({'where':_0x292e30['where']})[_0x22fa('0x1f')](function(_0x21644b){_0x2537cd[_0x22fa('0x2e')]=_0x21644b;if(_0x56e855[_0x22fa('0x43')][_0x22fa('0x58')]){_0x292e30['include']=[{'all':!![]}];}return db[_0x22fa('0x6d')]['findAll'](_0x292e30);})[_0x22fa('0x1f')](function(_0x4d22fa){_0x2537cd[_0x22fa('0x68')]=_0x4d22fa;return _0x2537cd;});}})[_0x22fa('0x1f')](respondWithFilteredResult(_0x909c97,_0x292e30))[_0x22fa('0x53')](handleError(_0x909c97,null));};exports['removeAnswers']=function(_0x514661,_0x1ee04d,_0x569b7a){return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x514661[_0x22fa('0x55')]['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x1ee04d,null))[_0x22fa('0x1f')](function(_0x2c0fa1){if(_0x2c0fa1){return _0x2c0fa1[_0x22fa('0x6f')](_0x514661['query'][_0x22fa('0x6a')]);}})[_0x22fa('0x1f')](respondWithStatusCode(_0x1ee04d,null))['catch'](handleError(_0x1ee04d,null));};exports[_0x22fa('0x70')]=function(_0x278356,_0x5773ac,_0x297d20){var _0x4a2e11={'channel':'sms'};var _0x4aca8e=[];var _0xfeee43=[];var _0xfcf8f3={};return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x278356['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x22fa('0x71')}]})[_0x22fa('0x1f')](handleEntityNotFound(_0x5773ac,null))[_0x22fa('0x1f')](function(_0x5ba105){_0x4a2e11[_0x22fa('0x72')]=_0x5ba105;_0x4a2e11[_0x22fa('0x73')]=_[_0x22fa('0x74')](_0x5ba105[_0x22fa('0x71')],['priority'],[_0x22fa('0x75')]);if(_0x4a2e11[_0x22fa('0x72')][_0x22fa('0x71')]){delete _0x4a2e11[_0x22fa('0x72')][_0x22fa('0x71')];}return db[_0x22fa('0x76')][_0x22fa('0x63')]();})[_0x22fa('0x1f')](function(_0x1ea188){if(!_0x1ea188){throw new db['Sequelize'][(_0x22fa('0x77'))](_0x22fa('0x78'));}_0x4aca8e=_['difference'](_[_0x22fa('0x42')](_0x1ea188),[_0x22fa('0x79'),_0x22fa('0x7a')]);_0xfeee43=_[_0x22fa('0x7b')](_[_0x22fa('0x42')](_0x1ea188),[_0x22fa('0x79'),_0x22fa('0x7a'),_0x22fa('0x7c'),_0x22fa('0x7d')]);_0x4a2e11[_0x22fa('0x5c')]={'mapKey':_0x22fa('0x7e')};if(_0x4a2e11[_0x22fa('0x72')][_0x22fa('0x4f')]){switch(_0x4a2e11[_0x22fa('0x72')][_0x22fa('0x4f')]){case _0x22fa('0x7f'):_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')]=_0x278356['body'][_0x22fa('0x81')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x82')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x83')]=_0x278356[_0x22fa('0x5c')]['MessageSid'];break;case _0x22fa('0x84'):_0x4a2e11[_0x22fa('0x5c')]['from']='+'+_0x278356[_0x22fa('0x5c')]['sender'];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x85')];break;case _0x22fa('0x86'):_0x4a2e11[_0x22fa('0x5c')]['from']=_0x278356[_0x22fa('0x5c')][_0x22fa('0x80')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356['body']['message'];break;case _0x22fa('0x87'):_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')]=_0x278356['body'][_0x22fa('0x80')];_0x4a2e11['body'][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x5c')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x83')]=_0x278356['body'][_0x22fa('0x88')];break;case'plivo':_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')]=_0x278356[_0x22fa('0x5c')]['From'];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x89')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x83')]=_0x278356[_0x22fa('0x5c')]['MessageUUID'];break;case _0x22fa('0x8a'):_0x4a2e11['body'][_0x22fa('0x80')]='+'+_0x278356[_0x22fa('0x5c')]['results'][0x0][_0x22fa('0x80')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x8b')][0x0][_0x22fa('0x85')];_0x4a2e11['body'][_0x22fa('0x83')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x8b')][0x0][_0x22fa('0x83')];break;case _0x22fa('0x8c'):_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x8d')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x8e')][_0x22fa('0x26')];break;case _0x22fa('0x8f'):_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x90')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')]['text'];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x83')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x91')];break;case _0x22fa('0x92'):_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x83')]=_0x278356[_0x22fa('0x5c')][0x0]['message']['id'];_0x4a2e11['body']['from']=_0x278356['body'][0x0][_0x22fa('0x26')][_0x22fa('0x80')];_0x4a2e11['body']['body']=_0x278356[_0x22fa('0x5c')][0x0][_0x22fa('0x26')][_0x22fa('0x85')];break;case _0x22fa('0x93'):_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x80')];_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x5c')]=_0x278356[_0x22fa('0x5c')][_0x22fa('0x26')];_0x4a2e11[_0x22fa('0x5c')]['messageId']=_0x278356[_0x22fa('0x5c')][_0x22fa('0x94')];break;}}if(_0x4a2e11[_0x22fa('0x5c')]['id']){delete _0x4a2e11[_0x22fa('0x5c')]['id'];}if(_[_0x22fa('0x95')](_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')])){throw new db['Sequelize'][(_0x22fa('0x77'))](_0x22fa('0x96'));}if(_[_0x22fa('0x95')](_0x4a2e11['body'][_0x22fa('0x5c')])||_0x4a2e11['body'][_0x22fa('0x5c')]===''){throw new db[(_0x22fa('0x97'))]['ValidationError'](_0x22fa('0x98'));}if(_[_0x22fa('0x95')](_0x4a2e11['body']['mapKey'])){throw new db['Sequelize'][(_0x22fa('0x77'))](_0x22fa('0x99')+_0xfeee43);}if(!_[_0x22fa('0x9a')](_0xfeee43,_0x4a2e11['body'][_0x22fa('0x9b')])){throw new db[(_0x22fa('0x97'))][(_0x22fa('0x77'))](_0x22fa('0x9c')+_0xfeee43);}_0xfcf8f3[_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x9b')]]=_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')];return db[_0x22fa('0x9d')][_0x22fa('0x5a')]({'where':{'id':_0x4a2e11['account'][_0x22fa('0x7d')]},'include':[{'model':db[_0x22fa('0x76')],'as':_0x22fa('0x9e'),'where':_0xfcf8f3,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x5773ac,null))[_0x22fa('0x1f')](function(_0x40abde){if(_0x40abde){_0x4a2e11['list']=_[_0x22fa('0x9f')](_0x40abde,[_0x22fa('0x9e')]);if(_0x40abde[_0x22fa('0x9e')][_0x22fa('0x48')]){return _0x40abde[_0x22fa('0x9e')][0x0];}var _0x5d05cd=_['defaults'](_0x4a2e11[_0x22fa('0x5c')],{'firstName':_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')],'ListId':_0x40abde['id']});_0x5d05cd[_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x9b')]]=_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')];return db['CmContact']['create'](_0x5d05cd,{'fields':_0x4aca8e,'raw':!![]});}})[_0x22fa('0x1f')](handleEntityNotFound(_0x5773ac,null))[_0x22fa('0x1f')](function(_0x338576){if(_0x338576){_0x4a2e11[_0x22fa('0xa0')]=_0x338576;var _0x3d0158={'ContactId':_0x338576['id'],'phone':_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x80')],'SmsAccountId':_0x278356['params']['id']};var _0x398391={'ContactId':_0x338576['id'],'SmsAccountId':_0x278356[_0x22fa('0x55')]['id'],'closed':![]};return db[_0x22fa('0xa1')]['find']({'where':_0x398391})[_0x22fa('0x1f')](function(_0x28d02a){if(_0x28d02a){return[_0x28d02a,![]];}return db[_0x22fa('0xa1')][_0x22fa('0x5b')](_0x3d0158)[_0x22fa('0x1f')](function(_0xa8196b){return[_0xa8196b,!![]];});});}})[_0x22fa('0xa2')](function(_0x524fc5,_0x466211){_0x4a2e11[_0x22fa('0xa3')]=_0x524fc5['get']({'plain':!![]});_0x4a2e11[_0x22fa('0xa3')][_0x22fa('0xa4')]=![];if(_0x466211){if(_0x4a2e11[_0x22fa('0x72')]['autoclose']){_0x4a2e11['applications'][_0x22fa('0xa5')]({'id':0x0,'priority':_0x4a2e11['applications'][_0x22fa('0x48')]+0x1,'app':_0x22fa('0xa6'),'appdata':_0x22fa('0xa7'),'interval':'*,*,*,*'});}_0x4a2e11[_0x22fa('0xa3')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x4a2e11['body'][_0x22fa('0x80')],'messageId':_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0x83')],'body':_0x4a2e11[_0x22fa('0x5c')]['body'],'SmsAccountId':_0x278356[_0x22fa('0x55')]['id'],'SmsInteractionId':_0x524fc5['id'],'direction':'in','ContactId':_0x524fc5[_0x22fa('0xa8')],'AttachmentId':_0x4a2e11[_0x22fa('0x5c')][_0x22fa('0xa9')]});})[_0x22fa('0x1f')](function(_0x51a0aa){_0x4a2e11[_0x22fa('0x26')]=_0x51a0aa;if(_0x4a2e11['interaction'][_0x22fa('0xaa')]){return db['User'][_0x22fa('0x5a')]({'attributes':['id','name'],'where':{'id':_0x4a2e11[_0x22fa('0xa3')][_0x22fa('0xaa')]}})[_0x22fa('0x1f')](function(_0x46601f){if(_0x46601f){_0x4a2e11['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x22fa('0xab'),'appdata':_0x46601f[_0x22fa('0x3a')]+','+(_0x4a2e11[_0x22fa('0x72')]['waitForTheAssignedAgent']||0xa),'interval':_0x22fa('0xac')});}return respondWithRpcPromise(_0x22fa('0xad'),_0x22fa('0xae'),_0x4a2e11);});}return respondWithRpcPromise(_0x22fa('0xad'),_0x22fa('0xae'),_0x4a2e11);})[_0x22fa('0x1f')](function(_0x3300ad){if(_0x3300ad){var _0x157003=0xc8;var _0x42e1ed=_0x22fa('0xaf');logger[_0x22fa('0x20')](_0x22fa('0xb0'),_0x42e1ed,_0x157003,_0x22fa('0xb1'));logger[_0x22fa('0x22')](_0x22fa('0xb2'),_0x42e1ed,_0x157003,'entity\x20found',JSON[_0x22fa('0xb3')](_0x3300ad));if(_0x4a2e11[_0x22fa('0x72')][_0x22fa('0x4f')]===_0x22fa('0x7f')){return _0x5773ac[_0x22fa('0x29')](_0x157003)['set']('Content-Type','text/xml')[_0x22fa('0xb4')](_0x22fa('0xb5'));}else{return _0x5773ac['status'](_0x157003)['json'](_0x3300ad);}}})[_0x22fa('0x53')](handleError(_0x5773ac,null));};exports['addApplications']=function(_0x11f130,_0x32b895){var _0x15b865=_0x11f130[_0x22fa('0x55')]['id'];var _0x5a4b34=_0x11f130[_0x22fa('0x5c')];var _0x1e1729=0xc8;var _0x20ae7b=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x22fa('0xb6')]['Transaction'][_0x22fa('0xb7')][_0x22fa('0xb8')]},function(_0x12e3da){return db[_0x22fa('0x3e')][_0x22fa('0x6c')]({'where':{'id':_0x15b865},'transaction':_0x12e3da})[_0x22fa('0x1f')](function(_0x4e0cfd){if(_0x4e0cfd){return db['SmsApplication'][_0x22fa('0x35')]({'where':{'SmsAccountId':_0x15b865},'transaction':_0x12e3da})[_0x22fa('0x1f')](function(){var _0x510502=_['map'](_0x5a4b34,function(_0x5b3fb6){_0x5b3fb6[_0x22fa('0x65')]=_0x15b865;return _0x5b3fb6;});return db[_0x22fa('0xb9')][_0x22fa('0xba')](_0x510502,{'transaction':_0x12e3da});});}else{_0x1e1729=0x194;_0x20ae7b=[];}});})[_0x22fa('0x1f')](function(){if(_0x1e1729!==0x194){return db[_0x22fa('0xb9')][_0x22fa('0xbb')]({'where':{'SmsAccountId':_0x15b865},'order':_0x22fa('0xbc')})[_0x22fa('0x1f')](function(_0x281440){_0x20ae7b=_0x281440;});}})['catch'](function(_0x1f3fe1){_0x1e1729=0x1f4;logger['error'](_0x1f3fe1[_0x22fa('0x39')]);if(_0x1f3fe1[_0x22fa('0x3a')]){delete _0x1f3fe1[_0x22fa('0x3a')];}_0x20ae7b=_0x1f3fe1;})[_0x22fa('0xbd')](function(){if(_0x20ae7b===null){_0x32b895[_0x22fa('0x28')](_0x1e1729);}else{if(_0x1e1729===0x1f4){_0x32b895[_0x22fa('0x29')](_0x1e1729)[_0x22fa('0xb4')](_0x20ae7b);}else{_0x32b895[_0x22fa('0x29')](_0x1e1729)[_0x22fa('0x2a')](_0x20ae7b);}}});};exports[_0x22fa('0xbe')]=function(_0x3cbd5a,_0x342b55,_0x4cb9a6){var _0x3b3910={};var _0x558727={};var _0x3088cf;var _0x3c3b2d;return db[_0x22fa('0x3e')]['findOne']({'where':{'id':_0x3cbd5a[_0x22fa('0x55')]['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x342b55,null))[_0x22fa('0x1f')](function(_0x5f32ed){if(_0x5f32ed){_0x3088cf=_0x5f32ed;_0x558727['model']=_['keys'](db['SmsApplication'][_0x22fa('0x57')]);_0x558727[_0x22fa('0x43')]=_[_0x22fa('0x42')](_0x3cbd5a[_0x22fa('0x43')]);_0x558727[_0x22fa('0x44')]=_[_0x22fa('0x45')](_0x558727['model'],_0x558727[_0x22fa('0x43')]);_0x3b3910['attributes']=_['intersection'](_0x558727[_0x22fa('0x41')],qs[_0x22fa('0x47')](_0x3cbd5a[_0x22fa('0x43')][_0x22fa('0x47')]));_0x3b3910['attributes']=_0x3b3910[_0x22fa('0x46')][_0x22fa('0x48')]?_0x3b3910['attributes']:_0x558727[_0x22fa('0x41')];_0x3b3910[_0x22fa('0x4a')]=qs['sort'](_0x3cbd5a[_0x22fa('0x43')]['sort']);_0x3b3910[_0x22fa('0x4e')]=qs['filters'](_[_0x22fa('0x4c')](_0x3cbd5a[_0x22fa('0x43')],_0x558727[_0x22fa('0x44')]));if(_0x3cbd5a[_0x22fa('0x43')][_0x22fa('0x4d')]){_0x3b3910[_0x22fa('0x4e')]=_[_0x22fa('0x50')](_0x3b3910[_0x22fa('0x4e')],{'$or':_[_0x22fa('0x3d')](_0x3b3910['attributes'],function(_0x4f426f){var _0x2fefc1={};_0x2fefc1[_0x4f426f]={'$like':'%'+_0x3cbd5a[_0x22fa('0x43')][_0x22fa('0x4d')]+'%'};return _0x2fefc1;})});}_0x3b3910=_['merge']({},_0x3b3910,_0x3cbd5a[_0x22fa('0x59')]);return _0x3088cf['getApplications'](_0x3b3910);}})[_0x22fa('0x1f')](function(_0xb345ec){if(_0xb345ec){_0x3c3b2d=_0xb345ec[_0x22fa('0x48')];if(!_0x3cbd5a[_0x22fa('0x43')]['hasOwnProperty'](_0x22fa('0x49'))){_0x3b3910[_0x22fa('0x2d')]=qs[_0x22fa('0x2d')](_0x3cbd5a[_0x22fa('0x43')]['limit']);_0x3b3910[_0x22fa('0x2b')]=qs['offset'](_0x3cbd5a['query']['offset']);}return _0x3088cf['getApplications'](_0x3b3910);}})[_0x22fa('0x1f')](function(_0x2e911e){if(_0x2e911e){return _0x2e911e?{'count':_0x3c3b2d,'rows':_0x2e911e}:null;}})['then'](respondWithResult(_0x342b55,null))[_0x22fa('0x53')](handleError(_0x342b55,null));};exports[_0x22fa('0xbf')]=function(_0x4de4f9,_0x5b411c,_0x44e398){var _0x542cf2={'raw':![],'where':{}};var _0x23c55b={};var _0x467846={'count':0x0,'rows':[]};return db[_0x22fa('0x3e')][_0x22fa('0x6c')]({'where':{'id':_0x4de4f9[_0x22fa('0x55')]['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x5b411c,null))['then'](function(_0x3ed1c0){if(_0x3ed1c0){_0x23c55b[_0x22fa('0x41')]=_[_0x22fa('0x42')](db[_0x22fa('0xa1')][_0x22fa('0x57')]);_0x23c55b['query']=_['keys'](_0x4de4f9[_0x22fa('0x43')]);_0x23c55b[_0x22fa('0x44')]=_[_0x22fa('0x45')](_0x23c55b['model'],_0x23c55b[_0x22fa('0x43')]);_0x542cf2[_0x22fa('0x46')]=_[_0x22fa('0x45')](_0x23c55b['model'],qs[_0x22fa('0x47')](_0x4de4f9['query'][_0x22fa('0x47')]));_0x542cf2[_0x22fa('0x46')]=_0x542cf2[_0x22fa('0x46')][_0x22fa('0x48')]?_0x542cf2[_0x22fa('0x46')]:_0x23c55b[_0x22fa('0x41')];if(!_0x4de4f9[_0x22fa('0x43')][_0x22fa('0x6e')](_0x22fa('0x49'))){_0x542cf2[_0x22fa('0x2d')]=qs[_0x22fa('0x2d')](_0x4de4f9[_0x22fa('0x43')]['limit']);_0x542cf2[_0x22fa('0x2b')]=qs['offset'](_0x4de4f9[_0x22fa('0x43')][_0x22fa('0x2b')]);}_0x542cf2[_0x22fa('0x4a')]=qs[_0x22fa('0x4b')](_0x4de4f9[_0x22fa('0x43')]['sort']);_0x542cf2[_0x22fa('0x4e')]=qs[_0x22fa('0x44')](_[_0x22fa('0x4c')](_0x4de4f9[_0x22fa('0x43')],_0x23c55b[_0x22fa('0x44')]));_0x542cf2['where']['SmsAccountId']=_0x3ed1c0['id'];if(_0x4de4f9[_0x22fa('0x43')][_0x22fa('0x4d')]){_0x542cf2[_0x22fa('0x4e')]=_[_0x22fa('0x50')](_0x542cf2[_0x22fa('0x4e')],{'$or':_[_0x22fa('0x3d')](_0x542cf2[_0x22fa('0x46')],function(_0xd435a7){var _0x11cf13={};_0x11cf13[_0xd435a7]={'$like':'%'+_0x4de4f9[_0x22fa('0x43')]['filter']+'%'};return _0x11cf13;})});}_0x542cf2=_[_0x22fa('0x50')]({},_0x542cf2,_0x4de4f9[_0x22fa('0x59')]);return db[_0x22fa('0xa1')][_0x22fa('0x2e')]({'where':_0x542cf2['where']})[_0x22fa('0x1f')](function(_0x27ec91){_0x467846[_0x22fa('0x2e')]=_0x27ec91;if(_0x4de4f9[_0x22fa('0x43')]['includeAll']){_0x542cf2[_0x22fa('0x51')]=[{'model':db[_0x22fa('0x76')],'as':'Contact','required':![]},{'model':db[_0x22fa('0xc0')],'as':'Owner','attributes':[_0x22fa('0x3a'),_0x22fa('0xc1'),_0x22fa('0xc2')],'required':![]},{'model':db[_0x22fa('0xc3')],'as':_0x22fa('0xc4'),'attributes':['id',_0x22fa('0x3a'),'color'],'where':_0x4de4f9[_0x22fa('0x43')][_0x22fa('0xc5')]?{'id':_0x4de4f9[_0x22fa('0x43')][_0x22fa('0xc5')]}:undefined,'required':_0x4de4f9['query'][_0x22fa('0xc5')]?!![]:![]}];}return db[_0x22fa('0xa1')][_0x22fa('0x52')](_0x542cf2);})['then'](function(_0x30875b){_0x467846[_0x22fa('0x68')]=_0x30875b;return _0x467846;});}})[_0x22fa('0x1f')](respondWithFilteredResult(_0x5b411c,_0x542cf2))[_0x22fa('0x53')](handleError(_0x5b411c,null));};exports[_0x22fa('0xb4')]=function(_0x3d02f2,_0x23b844,_0x4cbac0){var _0x31c5ea,_0x18819c,_0x446a13;if(_[_0x22fa('0x95')](_0x3d02f2[_0x22fa('0x5c')][_0x22fa('0x5c')])||_0x3d02f2['body'][_0x22fa('0x5c')]===''){throw new db[(_0x22fa('0x97'))][(_0x22fa('0x77'))](_0x22fa('0x98'));}if(_['isNil'](_0x3d02f2['body']['to'])){throw new db[(_0x22fa('0x97'))][(_0x22fa('0x77'))](_0x22fa('0xc6'));}_0x31c5ea=_0x3d02f2['body']['to'];return db[_0x22fa('0x3e')]['find']({'where':{'id':_0x3d02f2[_0x22fa('0x55')]['id']},'include':[{'model':db[_0x22fa('0x9d')],'as':_0x22fa('0xc7'),'include':[{'model':db[_0x22fa('0x76')],'as':_0x22fa('0x9e'),'where':{'mobile':_0x31c5ea},'limit':0x1,'order':[['updatedAt',_0x22fa('0xc8')]]}]}]})[_0x22fa('0x1f')](handleEntityNotFound(_0x23b844,null))[_0x22fa('0x1f')](function(_0x49442b){if(_0x49442b&&_0x49442b['List']){_0x18819c=_0x49442b[_0x22fa('0x36')]({'plain':!![]});if(_0x18819c[_0x22fa('0xc7')]&&_0x18819c[_0x22fa('0xc7')]['Contacts']['length']){return _0x18819c[_0x22fa('0xc7')][_0x22fa('0x9e')][0x0];}return db[_0x22fa('0x76')][_0x22fa('0x5b')](_[_0x22fa('0x1a')](_0x3d02f2[_0x22fa('0x5c')],{'firstName':_0x31c5ea,'mobile':_0x31c5ea,'phone':_0x31c5ea,'ListId':_0x18819c[_0x22fa('0x7d')]}));}})[_0x22fa('0x1f')](handleEntityNotFound(_0x23b844,null))[_0x22fa('0x1f')](function(_0x48989b){if(_0x48989b){_0x446a13=_0x48989b;return db[_0x22fa('0xa1')][_0x22fa('0x5a')]({'where':{'ContactId':_0x446a13['id'],'closed':![],'SmsAccountId':_0x18819c['id']}})[_0x22fa('0x1f')](function(_0x54cd68){if(_0x54cd68){return[_0x54cd68,![]];}return db[_0x22fa('0xa1')]['create']({'UserId':_0x3d02f2[_0x22fa('0x5d')]['id'],'ContactId':_0x446a13['id'],'SmsAccountId':_0x18819c['id'],'phone':_0x31c5ea,'firstMsgDirection':_0x22fa('0xc9'),'Messages':[_[_0x22fa('0x50')](_0x3d02f2[_0x22fa('0x5c')],{'read':![],'body':_0x3d02f2[_0x22fa('0x5c')]['body'],'phone':_0x31c5ea,'SmsAccountId':_0x18819c['id'],'UserId':_0x3d02f2[_0x22fa('0x5d')]['id'],'ContactId':_0x446a13['id']})]},{'include':[{'model':db[_0x22fa('0xca')],'as':_0x22fa('0xcb')}]})['then'](function(_0x58de00){return[_0x58de00,!![]];});});}})['spread'](function(_0x2cc423,_0x224de2){if(_0x224de2){return _0x2cc423;}return db[_0x22fa('0xca')][_0x22fa('0x5b')](_['merge'](_0x3d02f2[_0x22fa('0x5c')],{'read':![],'body':_0x3d02f2[_0x22fa('0x5c')][_0x22fa('0x5c')],'phone':_0x31c5ea,'SmsAccountId':_0x18819c['id'],'SmsInteractionId':_0x2cc423['id'],'UserId':_0x3d02f2[_0x22fa('0x5d')]['id'],'ContactId':_0x446a13['id']}))['then'](function(_0x4eb8a2){_0x2cc423[_0x22fa('0xcc')][_0x22fa('0xcb')]=[];_0x2cc423[_0x22fa('0xcc')][_0x22fa('0xcb')][_0x22fa('0xa5')](_0x4eb8a2['dataValues']);return _0x2cc423;});})[_0x22fa('0x1f')](respondWithResult(_0x23b844,null))[_0x22fa('0x53')](handleError(_0x23b844,null));};exports[_0x22fa('0x29')]=function(_0x4e6120,_0x109aa5,_0x112d66){if(_0x4e6120[_0x22fa('0x5c')]['id']){delete _0x4e6120[_0x22fa('0x5c')]['id'];}var _0x538ce0,_0x503876,_0x1fdf5c;return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x4e6120['params']['id']}})['then'](handleEntityNotFound(_0x109aa5,null))[_0x22fa('0x1f')](function(_0x24fd7d){if(_0x24fd7d){_0x1fdf5c=_0x24fd7d;logger[_0x22fa('0x22')](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0xcd'),_0x24fd7d['type'],util[_0x22fa('0xce')](_0x4e6120[_0x22fa('0x5c')],{'showHidden':![],'depth':null}));switch(_0x24fd7d['type']){case _0x22fa('0x84'):if(_0x4e6120[_0x22fa('0x5c')]['skebby_dispatch_id']&&_0x4e6120[_0x22fa('0x5c')][_0x22fa('0x29')]){_0x503876=_0x4e6120[_0x22fa('0x5c')][_0x22fa('0x29')];return db[_0x22fa('0xca')][_0x22fa('0x5a')]({'where':{'messageId':_0x4e6120[_0x22fa('0x5c')]['skebby_dispatch_id']}});}break;case _0x22fa('0x86'):if(_0x4e6120[_0x22fa('0x5c')][_0x22fa('0xcf')]&&_0x4e6120[_0x22fa('0x5c')][_0x22fa('0xd0')]){_0x503876=_0x4e6120[_0x22fa('0x5c')]['statusInt'];return db[_0x22fa('0xca')][_0x22fa('0x5a')]({'where':{'messageId':_0x4e6120['body'][_0x22fa('0xcf')]}});}break;case _0x22fa('0x87'):if(_0x4e6120[_0x22fa('0x5c')]['message_id']&&_0x4e6120[_0x22fa('0x5c')]['status_code']){_0x503876=_0x4e6120['body'][_0x22fa('0xd1')];return db[_0x22fa('0xca')][_0x22fa('0x5a')]({'where':{'messageId':_0x4e6120[_0x22fa('0x5c')][_0x22fa('0x88')]}});}break;case'infobip':var _0x2d5b3a=_0x4e6120[_0x22fa('0x5c')][_0x22fa('0x8b')][0x0];if(_0x2d5b3a[_0x22fa('0x83')]&&_0x2d5b3a[_0x22fa('0x29')][_0x22fa('0xd2')]===_0x22fa('0xd3')){_0x503876=_0x2d5b3a[_0x22fa('0x29')][_0x22fa('0xd2')];return db[_0x22fa('0xca')]['find']({'where':{'messageId':_0x2d5b3a['messageId']}});}break;case _0x22fa('0x8f'):if(_0x4e6120['body'][_0x22fa('0x83')]&&_0x4e6120[_0x22fa('0x5c')][_0x22fa('0x29')]){_0x503876=_0x4e6120[_0x22fa('0x5c')][_0x22fa('0x29')];return db['SmsMessage'][_0x22fa('0x5a')]({'where':{'messageId':_0x4e6120[_0x22fa('0x5c')]['messageId']}});}break;case _0x22fa('0x92'):if(_0x4e6120[_0x22fa('0x5c')][0x0][_0x22fa('0x26')]['id']){_0x503876=_0x4e6120[_0x22fa('0x5c')][0x0][_0x22fa('0x4f')];return db[_0x22fa('0xca')][_0x22fa('0x5a')]({'where':{'messageId':_0x4e6120['body'][0x0][_0x22fa('0x26')]['id']}});}break;case _0x22fa('0x93'):if(_0x4e6120[_0x22fa('0x5c')][_0x22fa('0xd4')]&&_0x4e6120[_0x22fa('0x5c')]['status']){_0x503876=_0x4e6120[_0x22fa('0x5c')]['status'];return db[_0x22fa('0xca')][_0x22fa('0x5a')]({'where':{'messageId':_0x4e6120[_0x22fa('0x5c')][_0x22fa('0xd4')]}});}break;}}})[_0x22fa('0x1f')](handleEntityNotFound(_0x109aa5,null))[_0x22fa('0x1f')](function(_0x5e92e3){if(_0x5e92e3){_0x538ce0=_0x5e92e3;switch(_0x1fdf5c[_0x22fa('0x4f')]){case _0x22fa('0x84'):if(_0x503876===_0x22fa('0xd3')){return _0x538ce0[_0x22fa('0x34')]({'read':!![]});}else{logger[_0x22fa('0x23')](_0x22fa('0xb0'),_0x22fa('0x29'),'skebby',util[_0x22fa('0xce')](_0x4e6120[_0x22fa('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x22fa('0x86'):if(_0x503876==='1'){return _0x538ce0[_0x22fa('0x34')]({'read':!![]});}else{logger[_0x22fa('0x23')](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0x84'),util['inspect'](_0x4e6120[_0x22fa('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x22fa('0x87'):if(!_0x4e6120[_0x22fa('0x5c')]['error_code']&&_0x503876>=0xc8&&_0x503876<=0xce){return _0x538ce0['update']({'read':!![]});}else{logger['error'](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0x87'),util[_0x22fa('0xce')](_0x4e6120[_0x22fa('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x22fa('0x8a'):var _0x1f2a33=_0x4e6120[_0x22fa('0x5c')][_0x22fa('0x8b')][0x0];if(_0x1f2a33[_0x22fa('0x29')][_0x22fa('0xd2')]===_0x22fa('0xd3')){return _0x538ce0[_0x22fa('0x34')]({'read':!![]});}else{logger[_0x22fa('0x23')](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0x8a'),util[_0x22fa('0xce')](_0x4e6120[_0x22fa('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x22fa('0x8f'):if(_0x503876==_0x22fa('0xd5')||_0x503876==_0x22fa('0xd6')){return _0x538ce0['update']({'read':!![]});}else{logger[_0x22fa('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x22fa('0x29'),_0x22fa('0x8f'),util[_0x22fa('0xce')](_0x4e6120[_0x22fa('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x22fa('0x92'):if(_0x503876==_0x22fa('0xd7')){return _0x538ce0[_0x22fa('0x34')]({'read':!![]});}else{logger[_0x22fa('0x23')](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0x92'),util['inspect'](_0x4e6120[_0x22fa('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x503876===_0x22fa('0xd8')||_0x503876===_0x22fa('0xd9')){return _0x538ce0[_0x22fa('0x34')]({'read':!![]});}else{logger['error'](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0x93'),util[_0x22fa('0xce')](_0x4e6120['body'],{'showHidden':![],'depth':null}));}break;}return _0x538ce0;}})[_0x22fa('0x1f')](respondWithResult(_0x109aa5,null))[_0x22fa('0x53')](handleError(_0x109aa5,null));};exports['statusGet']=function(_0x516b1e,_0x29f531,_0x5094f2){var _0x5b78d2,_0x14071b,_0x1bdefa;return db['SmsAccount'][_0x22fa('0x5a')]({'where':{'id':_0x516b1e[_0x22fa('0x55')]['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x29f531,null))[_0x22fa('0x1f')](function(_0x246388){if(_0x246388){_0x1bdefa=_0x246388;logger[_0x22fa('0x22')](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0xcd'),_0x246388[_0x22fa('0x4f')],util['inspect'](_0x516b1e[_0x22fa('0x43')],{'showHidden':![],'depth':null}));switch(_0x246388[_0x22fa('0x4f')]){case _0x22fa('0x8c'):if(_0x516b1e[_0x22fa('0x43')][_0x22fa('0xda')]&&_0x516b1e[_0x22fa('0x43')][_0x22fa('0xdb')]){_0x14071b=_0x516b1e[_0x22fa('0x43')]['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x516b1e[_0x22fa('0x43')][_0x22fa('0xda')]}});}break;}}})[_0x22fa('0x1f')](handleEntityNotFound(_0x29f531,null))[_0x22fa('0x1f')](function(_0x51d1dd){if(_0x51d1dd){_0x5b78d2=_0x51d1dd;switch(_0x1bdefa[_0x22fa('0x4f')]){case'csc':if(_0x14071b==='2'||_0x14071b==='6'){return _0x5b78d2[_0x22fa('0x34')]({'read':!![]});}else{logger['error'](_0x22fa('0xb0'),_0x22fa('0x29'),_0x22fa('0x8c'),util[_0x22fa('0xce')](_0x516b1e['query'],{'showHidden':![],'depth':null}));};break;}return _0x5b78d2;}})[_0x22fa('0x1f')](respondWithResult(_0x29f531,null))[_0x22fa('0x53')](handleError(_0x29f531,null));};exports['addAgents']=function(_0x45ff71,_0x51f95c,_0x359623){return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x45ff71[_0x22fa('0x55')]['id']}})['then'](handleEntityNotFound(_0x51f95c,null))['then'](function(_0x27f009){if(_0x27f009){return _0x27f009[_0x22fa('0xdc')](_0x45ff71[_0x22fa('0x5c')][_0x22fa('0x6a')],_['omit'](_0x45ff71['body'],[_0x22fa('0x6a'),'id'])||{})[_0x22fa('0xa2')](function(_0x39206e){for(var _0x5f0767=0x0;_0x5f0767<_0x45ff71[_0x22fa('0x5c')][_0x22fa('0x6a')]['length'];_0x5f0767+=0x1){socket[_0x22fa('0xdd')](_0x22fa('0xde'),{'UserId':Number(_0x45ff71[_0x22fa('0x5c')][_0x22fa('0x6a')][_0x5f0767]),'SmsAccountId':Number(_0x45ff71['params']['id'])});}return _0x39206e;});}})[_0x22fa('0x1f')](respondWithResult(_0x51f95c,null))[_0x22fa('0x53')](handleError(_0x51f95c,null));};exports['removeAgents']=function(_0x1e82fa,_0x43c803,_0x3f2af2){return db[_0x22fa('0x3e')][_0x22fa('0x5a')]({'where':{'id':_0x1e82fa[_0x22fa('0x55')]['id']}})['then'](handleEntityNotFound(_0x43c803,null))[_0x22fa('0x1f')](function(_0x57d0d1){if(_0x57d0d1){return _0x57d0d1['removeAgents'](_0x1e82fa[_0x22fa('0x43')]['ids'])[_0x22fa('0x1f')](function(){if(_[_0x22fa('0xdf')](_0x1e82fa[_0x22fa('0x43')][_0x22fa('0x6a')])){for(var _0x24e5dc=0x0;_0x24e5dc<_0x1e82fa['query'][_0x22fa('0x6a')][_0x22fa('0x48')];_0x24e5dc+=0x1){socket[_0x22fa('0xdd')](_0x22fa('0xe0'),{'UserId':Number(_0x1e82fa[_0x22fa('0x43')]['ids'][_0x24e5dc]),'SmsAccountId':Number(_0x1e82fa[_0x22fa('0x55')]['id'])});}}else{socket[_0x22fa('0xdd')](_0x22fa('0xe0'),{'UserId':Number(_0x1e82fa['query'][_0x22fa('0x6a')]),'SmsAccountId':Number(_0x1e82fa[_0x22fa('0x55')]['id'])});}});}})[_0x22fa('0x1f')](respondWithStatusCode(_0x43c803,null))[_0x22fa('0x53')](handleError(_0x43c803,null));};exports[_0x22fa('0xe1')]=function(_0x273b29,_0x3a1e28,_0x1fe098){var _0x37d93e={};var _0x3d5113={};var _0xa3c686;var _0x4f4106;return db[_0x22fa('0x3e')][_0x22fa('0x6c')]({'where':{'id':_0x273b29[_0x22fa('0x55')]['id']}})[_0x22fa('0x1f')](handleEntityNotFound(_0x3a1e28,null))[_0x22fa('0x1f')](function(_0x59eaed){if(_0x59eaed){_0xa3c686=_0x59eaed;_0x3d5113[_0x22fa('0x41')]=_[_0x22fa('0x42')](db[_0x22fa('0xc0')][_0x22fa('0x57')]);_0x3d5113[_0x22fa('0x43')]=_[_0x22fa('0x42')](_0x273b29['query']);_0x3d5113[_0x22fa('0x44')]=_[_0x22fa('0x45')](_0x3d5113[_0x22fa('0x41')],_0x3d5113[_0x22fa('0x43')]);_0x37d93e[_0x22fa('0x46')]=_['intersection'](_0x3d5113['model'],qs[_0x22fa('0x47')](_0x273b29['query'][_0x22fa('0x47')]));_0x37d93e[_0x22fa('0x46')]=_0x37d93e[_0x22fa('0x46')][_0x22fa('0x48')]?_0x37d93e[_0x22fa('0x46')]:_0x3d5113[_0x22fa('0x41')];_0x37d93e[_0x22fa('0x4a')]=qs[_0x22fa('0x4b')](_0x273b29[_0x22fa('0x43')][_0x22fa('0x4b')]);_0x37d93e[_0x22fa('0x4e')]=qs[_0x22fa('0x44')](_['pick'](_0x273b29[_0x22fa('0x43')],_0x3d5113[_0x22fa('0x44')]));if(_0x273b29[_0x22fa('0x43')][_0x22fa('0x4d')]){_0x37d93e[_0x22fa('0x4e')]=_['merge'](_0x37d93e[_0x22fa('0x4e')],{'$or':_[_0x22fa('0x3d')](_0x37d93e[_0x22fa('0x46')],function(_0xf743c2){var _0x573b8d={};_0x573b8d[_0xf743c2]={'$like':'%'+_0x273b29['query'][_0x22fa('0x4d')]+'%'};return _0x573b8d;})});}_0x37d93e=_[_0x22fa('0x50')]({},_0x37d93e,_0x273b29[_0x22fa('0x59')]);return _0xa3c686[_0x22fa('0xe1')](_0x37d93e);}})['then'](function(_0x5b417f){if(_0x5b417f){_0x4f4106=_0x5b417f[_0x22fa('0x48')];if(!_0x273b29['query'][_0x22fa('0x6e')]('nolimit')){_0x37d93e[_0x22fa('0x2d')]=qs[_0x22fa('0x2d')](_0x273b29[_0x22fa('0x43')]['limit']);_0x37d93e[_0x22fa('0x2b')]=qs['offset'](_0x273b29['query'][_0x22fa('0x2b')]);}return _0xa3c686[_0x22fa('0xe1')](_0x37d93e);}})[_0x22fa('0x1f')](function(_0x11eea6){if(_0x11eea6){return _0x11eea6?{'count':_0x4f4106,'rows':_0x11eea6}:null;}})[_0x22fa('0x1f')](respondWithResult(_0x3a1e28,null))[_0x22fa('0x53')](handleError(_0x3a1e28,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c5e917a..dd9aa59 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 _0xe2c2=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xe2c2,0x112));var _0x2e2c=function(_0x14a41a,_0x3b50c5){_0x14a41a=_0x14a41a-0x0;var _0x48ea12=_0xe2c2[_0x14a41a];return _0x48ea12;};'use strict';var EventEmitter=require(_0x2e2c('0x0'));var SmsAccount=require(_0x2e2c('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2e2c('0x2')](0x0);var events={'afterCreate':_0x2e2c('0x3'),'afterUpdate':_0x2e2c('0x4'),'afterDestroy':_0x2e2c('0x5')};function emitEvent(_0x540cee){return function(_0x589b86,_0x2b52b6,_0x2df39b){SmsAccountEvents['emit'](_0x540cee+':'+_0x589b86['id'],_0x589b86);SmsAccountEvents['emit'](_0x540cee,_0x589b86);_0x2df39b(null);};}for(var e in events){if(events[_0x2e2c('0x6')](e)){var event=events[e];SmsAccount[_0x2e2c('0x7')](e,emitEvent(event));}}module[_0x2e2c('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x7c90=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x831f03,_0x2d195f){var _0x32a50e=function(_0x96f679){while(--_0x96f679){_0x831f03['push'](_0x831f03['shift']());}};_0x32a50e(++_0x2d195f);}(_0x7c90,0x1a4));var _0x07c9=function(_0x21310f,_0x2b178d){_0x21310f=_0x21310f-0x0;var _0x5bb5a3=_0x7c90[_0x21310f];return _0x5bb5a3;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x07c9('0x0'))['db'][_0x07c9('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x07c9('0x2')](0x0);var events={'afterCreate':_0x07c9('0x3'),'afterUpdate':_0x07c9('0x4'),'afterDestroy':_0x07c9('0x5')};function emitEvent(_0x2e5b9d){return function(_0x124e53,_0x3b3b44,_0x35c0a5){SmsAccountEvents[_0x07c9('0x6')](_0x2e5b9d+':'+_0x124e53['id'],_0x124e53);SmsAccountEvents[_0x07c9('0x6')](_0x2e5b9d,_0x124e53);_0x35c0a5(null);};}for(var e in events){if(events[_0x07c9('0x7')](e)){var event=events[e];SmsAccount[_0x07c9('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 5da4b46..0b64d67 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 _0xe0e8=['./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x595c3e,_0x3cf6d3){var _0x240f07=function(_0x51d3f7){while(--_0x51d3f7){_0x595c3e['push'](_0x595c3e['shift']());}};_0x240f07(++_0x3cf6d3);}(_0xe0e8,0xd6));var _0x8e0e=function(_0x59578a,_0x122395){_0x59578a=_0x59578a-0x0;var _0x5f25dc=_0xe0e8[_0x59578a];return _0x5f25dc;};'use strict';var _=require(_0x8e0e('0x0'));var util=require(_0x8e0e('0x1'));var logger=require(_0x8e0e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8e0e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e0e('0x4'));var rimraf=require(_0x8e0e('0x5'));var config=require('../../config/environment');var attributes=require(_0x8e0e('0x6'));module['exports']=function(_0xfb58b7,_0x3abe5f){return _0xfb58b7[_0x8e0e('0x7')](_0x8e0e('0x8'),attributes,{'tableName':_0x8e0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1915=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0xdb020a,_0x30a171){var _0xe85208=function(_0x3a5f4f){while(--_0x3a5f4f){_0xdb020a['push'](_0xdb020a['shift']());}};_0xe85208(++_0x30a171);}(_0x1915,0x6f));var _0x5191=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1915[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5191('0x0'));var util=require('util');var logger=require(_0x5191('0x1'))(_0x5191('0x2'));var moment=require(_0x5191('0x3'));var BPromise=require(_0x5191('0x4'));var rp=require(_0x5191('0x5'));var fs=require('fs');var path=require(_0x5191('0x6'));var rimraf=require(_0x5191('0x7'));var config=require(_0x5191('0x8'));var attributes=require(_0x5191('0x9'));module[_0x5191('0xa')]=function(_0x5da979,_0x241010){return _0x5da979[_0x5191('0xb')](_0x5191('0xc'),attributes,{'tableName':_0x5191('0xd'),'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 4e34149..728431a 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 _0x39ed=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5a7a74,_0x152d10){var _0x4232eb=function(_0x14e18e){while(--_0x14e18e){_0x5a7a74['push'](_0x5a7a74['shift']());}};_0x4232eb(++_0x152d10);}(_0x39ed,0x159));var _0xd39e=function(_0x41341f,_0x65a54a){_0x41341f=_0x41341f-0x0;var _0x29468e=_0x39ed[_0x41341f];return _0x29468e;};'use strict';var _=require(_0xd39e('0x0'));var util=require(_0xd39e('0x1'));var moment=require(_0xd39e('0x2'));var BPromise=require('bluebird');var rs=require(_0xd39e('0x3'));var fs=require('fs');var Redis=require(_0xd39e('0x4'));var db=require(_0xd39e('0x5'))['db'];var utils=require(_0xd39e('0x6'));var logger=require(_0xd39e('0x7'))(_0xd39e('0x8'));var config=require(_0xd39e('0x9'));var jayson=require(_0xd39e('0xa'));var client=jayson[_0xd39e('0xb')]['http']({'port':0x232a});config[_0xd39e('0xc')]=_[_0xd39e('0xd')](config[_0xd39e('0xc')],{'host':_0xd39e('0xe'),'port':0x18eb});var socket=require(_0xd39e('0xf'))(new Redis(config['redis']));require(_0xd39e('0x10'))['register'](socket);function respondWithRpcPromise(_0x441bd2,_0x2586f1,_0x4a0d0d){return new BPromise(function(_0x2db504,_0x25ca39){return client[_0xd39e('0x11')](_0x441bd2,_0x4a0d0d)[_0xd39e('0x12')](function(_0x552ab3){logger[_0xd39e('0x13')](_0xd39e('0x14'),_0x2586f1,_0xd39e('0x15'));logger[_0xd39e('0x16')](_0xd39e('0x17'),_0x2586f1,_0xd39e('0x15'),JSON['stringify'](_0x552ab3));if(_0x552ab3[_0xd39e('0x18')]){if(_0x552ab3[_0xd39e('0x18')][_0xd39e('0x19')]===0x1f4){logger[_0xd39e('0x18')](_0xd39e('0x14'),_0x2586f1,_0x552ab3[_0xd39e('0x18')]['message']);return _0x25ca39(_0x552ab3[_0xd39e('0x18')][_0xd39e('0x1a')]);}logger[_0xd39e('0x18')]('SmsAccount,\x20%s,\x20%s',_0x2586f1,_0x552ab3['error'][_0xd39e('0x1a')]);return _0x2db504(_0x552ab3[_0xd39e('0x18')][_0xd39e('0x1a')]);}else{logger['info'](_0xd39e('0x14'),_0x2586f1,_0xd39e('0x15'));_0x2db504(_0x552ab3[_0xd39e('0x1b')]['message']);}})[_0xd39e('0x1c')](function(_0x26b636){logger[_0xd39e('0x18')](_0xd39e('0x14'),_0x2586f1,_0x26b636);_0x25ca39(_0x26b636);});});}exports[_0xd39e('0x1d')]=function(_0x1f3566){var _0x48c29d=this;return new Promise(function(_0x59bb30,_0xf72262){return db['SmsAccount'][_0xd39e('0x1e')]({'raw':_0x1f3566[_0xd39e('0x1f')]?_0x1f3566[_0xd39e('0x1f')][_0xd39e('0x20')]===undefined?!![]:![]:!![],'where':_0x1f3566[_0xd39e('0x1f')]?_0x1f3566['options'][_0xd39e('0x21')]||null:null,'attributes':_0x1f3566[_0xd39e('0x1f')]?_0x1f3566[_0xd39e('0x1f')][_0xd39e('0x22')]||null:null,'include':_0x1f3566[_0xd39e('0x1f')]?_0x1f3566['options'][_0xd39e('0x23')]?_['map'](_0x1f3566[_0xd39e('0x1f')][_0xd39e('0x23')],function(_0x1884ea){return{'model':db[_0x1884ea[_0xd39e('0x24')]],'as':_0x1884ea['as'],'attributes':_0x1884ea[_0xd39e('0x22')],'include':_0x1884ea['include']?_['map'](_0x1884ea[_0xd39e('0x23')],function(_0x34893f){return{'model':db[_0x34893f[_0xd39e('0x24')]],'as':_0x34893f['as'],'attributes':_0x34893f['attributes'],'include':_0x34893f['include']?_[_0xd39e('0x25')](_0x34893f[_0xd39e('0x23')],function(_0x2429fb){return{'model':db[_0x2429fb[_0xd39e('0x24')]],'as':_0x2429fb['as'],'attributes':_0x2429fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xd39e('0x12')](function(_0x3d6325){logger[_0xd39e('0x13')](_0xd39e('0x1d'),_0x1f3566);logger[_0xd39e('0x16')]('ShowSmsAccount',_0x1f3566,JSON[_0xd39e('0x26')](_0x3d6325));_0x59bb30(_0x3d6325);})[_0xd39e('0x1c')](function(_0x1ecfd0){logger[_0xd39e('0x18')](_0xd39e('0x1d'),_0x1ecfd0[_0xd39e('0x1a')],_0x1f3566);_0xf72262(_0x48c29d[_0xd39e('0x18')](0x1f4,_0x1ecfd0[_0xd39e('0x1a')]));});});}; \ No newline at end of file +var _0x891f=['SmsAccount','find','options','raw','attributes','include','map','model','then','ShowSmsAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch'];(function(_0x118222,_0x12a147){var _0xe1278f=function(_0x2459f0){while(--_0x2459f0){_0x118222['push'](_0x118222['shift']());}};_0xe1278f(++_0x12a147);}(_0x891f,0x1a5));var _0xf891=function(_0x25e108,_0x37d939){_0x25e108=_0x25e108-0x0;var _0x41741c=_0x891f[_0x25e108];return _0x41741c;};'use strict';var _=require(_0xf891('0x0'));var util=require(_0xf891('0x1'));var moment=require(_0xf891('0x2'));var BPromise=require(_0xf891('0x3'));var rs=require(_0xf891('0x4'));var fs=require('fs');var Redis=require(_0xf891('0x5'));var db=require(_0xf891('0x6'))['db'];var utils=require(_0xf891('0x7'));var logger=require(_0xf891('0x8'))(_0xf891('0x9'));var config=require(_0xf891('0xa'));var jayson=require(_0xf891('0xb'));var client=jayson[_0xf891('0xc')][_0xf891('0xd')]({'port':0x232a});config[_0xf891('0xe')]=_[_0xf891('0xf')](config[_0xf891('0xe')],{'host':_0xf891('0x10'),'port':0x18eb});var socket=require(_0xf891('0x11'))(new Redis(config[_0xf891('0xe')]));require(_0xf891('0x12'))[_0xf891('0x13')](socket);function respondWithRpcPromise(_0x5a3122,_0x205210,_0xe082b3){return new BPromise(function(_0xc16949,_0x394a21){return client[_0xf891('0x14')](_0x5a3122,_0xe082b3)['then'](function(_0x244282){logger['info'](_0xf891('0x15'),_0x205210,_0xf891('0x16'));logger['debug'](_0xf891('0x17'),_0x205210,_0xf891('0x16'),JSON['stringify'](_0x244282));if(_0x244282['error']){if(_0x244282['error'][_0xf891('0x18')]===0x1f4){logger['error'](_0xf891('0x15'),_0x205210,_0x244282[_0xf891('0x19')][_0xf891('0x1a')]);return _0x394a21(_0x244282[_0xf891('0x19')][_0xf891('0x1a')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x205210,_0x244282[_0xf891('0x19')][_0xf891('0x1a')]);return _0xc16949(_0x244282[_0xf891('0x19')][_0xf891('0x1a')]);}else{logger[_0xf891('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x205210,'request\x20sent');_0xc16949(_0x244282[_0xf891('0x1c')][_0xf891('0x1a')]);}})[_0xf891('0x1d')](function(_0x362173){logger[_0xf891('0x19')](_0xf891('0x15'),_0x205210,_0x362173);_0x394a21(_0x362173);});});}exports['ShowSmsAccount']=function(_0x4fbed0){var _0x5f49c9=this;return new Promise(function(_0x344c20,_0x5610c5){return db[_0xf891('0x1e')][_0xf891('0x1f')]({'raw':_0x4fbed0[_0xf891('0x20')]?_0x4fbed0[_0xf891('0x20')][_0xf891('0x21')]===undefined?!![]:![]:!![],'where':_0x4fbed0['options']?_0x4fbed0[_0xf891('0x20')]['where']||null:null,'attributes':_0x4fbed0[_0xf891('0x20')]?_0x4fbed0[_0xf891('0x20')][_0xf891('0x22')]||null:null,'include':_0x4fbed0[_0xf891('0x20')]?_0x4fbed0[_0xf891('0x20')][_0xf891('0x23')]?_[_0xf891('0x24')](_0x4fbed0[_0xf891('0x20')][_0xf891('0x23')],function(_0x3ca716){return{'model':db[_0x3ca716[_0xf891('0x25')]],'as':_0x3ca716['as'],'attributes':_0x3ca716['attributes'],'include':_0x3ca716[_0xf891('0x23')]?_['map'](_0x3ca716[_0xf891('0x23')],function(_0x396f4e){return{'model':db[_0x396f4e[_0xf891('0x25')]],'as':_0x396f4e['as'],'attributes':_0x396f4e['attributes'],'include':_0x396f4e[_0xf891('0x23')]?_['map'](_0x396f4e['include'],function(_0x4de08c){return{'model':db[_0x4de08c['model']],'as':_0x4de08c['as'],'attributes':_0x4de08c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf891('0x26')](function(_0xcda880){logger[_0xf891('0x1b')](_0xf891('0x27'),_0x4fbed0);logger[_0xf891('0x28')]('ShowSmsAccount',_0x4fbed0,JSON['stringify'](_0xcda880));_0x344c20(_0xcda880);})[_0xf891('0x1d')](function(_0x151fa1){logger['error'](_0xf891('0x27'),_0x151fa1[_0xf891('0x1a')],_0x4fbed0);_0x5610c5(_0x5f49c9[_0xf891('0x19')](0x1f4,_0x151fa1[_0xf891('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 11969f8..2825788 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 ea75a4e..584c279 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x30f0cd,_0x48c5ea){var _0x32790e=function(_0x5be1dd){while(--_0x5be1dd){_0x30f0cd['push'](_0x30f0cd['shift']());}};_0x32790e(++_0x48c5ea);}(_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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 4fca67d..a30eaa7 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 _0x004f=['sequelize','exports','STRING','noop','TEXT'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x004f,0x1bd));var _0xf004=function(_0x2f97c9,_0x25a335){_0x2f97c9=_0x2f97c9-0x0;var _0x46c878=_0x004f[_0x2f97c9];return _0x46c878;};'use strict';var Sequelize=require(_0xf004('0x0'));module[_0xf004('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf004('0x2')],'allowNull':![],'defaultValue':_0xf004('0x3')},'appdata':{'type':Sequelize[_0xf004('0x4')]()},'description':{'type':Sequelize[_0xf004('0x2')]},'interval':{'type':Sequelize[_0xf004('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4103=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x1d3663,_0x3f6a8d){var _0x4fdf4e=function(_0x493e26){while(--_0x493e26){_0x1d3663['push'](_0x1d3663['shift']());}};_0x4fdf4e(++_0x3f6a8d);}(_0x4103,0x1e4));var _0x3410=function(_0x447881,_0x171f0a){_0x447881=_0x447881-0x0;var _0x39a9fb=_0x4103[_0x447881];return _0x39a9fb;};'use strict';var Sequelize=require(_0x3410('0x0'));module[_0x3410('0x1')]={'priority':{'type':Sequelize[_0x3410('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3410('0x3')],'allowNull':![],'defaultValue':_0x3410('0x4')},'appdata':{'type':Sequelize[_0x3410('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3410('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4a6d677..dffc571 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 _0x2ed8=['status','stack','name','send','index','map','rawAttributes','fieldName','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','SmsApplication','includeAll','find','create','body','zip-dir','moment','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x2ed8,0xa9));var _0x82ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2ed8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x82ed('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x82ed('0x1'));var BPromise=require(_0x82ed('0x2'));var Mustache=require(_0x82ed('0x3'));var util=require(_0x82ed('0x4'));var path=require(_0x82ed('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82ed('0x6'));var squel=require(_0x82ed('0x7'));var crypto=require(_0x82ed('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x82ed('0x9'));var toCsv=require(_0x82ed('0xa'));var querystring=require(_0x82ed('0xb'));var Papa=require(_0x82ed('0xc'));var Redis=require(_0x82ed('0xd'));var authService=require(_0x82ed('0xe'));var qs=require(_0x82ed('0xf'));var as=require(_0x82ed('0x10'));var hardwareService=require(_0x82ed('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82ed('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac657,_0x5f565e){_0x5f565e=_0x5f565e||0xcc;return function(_0x387cad){if(_0x387cad){return _0x2ac657[_0x82ed('0x13')](_0x5f565e);}return _0x2ac657['status'](_0x5f565e)[_0x82ed('0x14')]();};}function respondWithResult(_0x62c2ff,_0x30791b){_0x30791b=_0x30791b||0xc8;return function(_0x42e91e){if(_0x42e91e){return _0x62c2ff['status'](_0x30791b)[_0x82ed('0x15')](_0x42e91e);}};}function respondWithFilteredResult(_0x300e8a,_0x1351de){return function(_0x26ba4e){if(_0x26ba4e){var _0x49c7fc=typeof _0x1351de[_0x82ed('0x16')]===_0x82ed('0x17')&&typeof _0x1351de[_0x82ed('0x18')]===_0x82ed('0x17');var _0x23023e=_0x26ba4e[_0x82ed('0x19')];var _0x46c194=_0x49c7fc?0x0:_0x1351de[_0x82ed('0x16')];var _0x1f602c=_0x49c7fc?_0x26ba4e[_0x82ed('0x19')]:_0x1351de['offset']+_0x1351de[_0x82ed('0x18')];var _0x533990;if(_0x1f602c>=_0x23023e){_0x1f602c=_0x23023e;_0x533990=0xc8;}else{_0x533990=0xce;}_0x300e8a['status'](_0x533990);return _0x300e8a[_0x82ed('0x1a')]('Content-Range',_0x46c194+'-'+_0x1f602c+'/'+_0x23023e)[_0x82ed('0x15')](_0x26ba4e);}return null;};}function patchUpdates(_0x28d19a){return function(_0x5d454e){try{jsonpatch[_0x82ed('0x1b')](_0x5d454e,_0x28d19a,!![]);}catch(_0xfe2b7d){return BPromise[_0x82ed('0x1c')](_0xfe2b7d);}return _0x5d454e['save']();};}function saveUpdates(_0x548563,_0x1b7eef){return function(_0x395e0d){if(_0x395e0d){return _0x395e0d[_0x82ed('0x1d')](_0x548563)[_0x82ed('0x1e')](function(_0xeaa17d){return _0xeaa17d;});}return null;};}function removeEntity(_0x5e2c1e,_0x4c30c3){return function(_0xf13492){if(_0xf13492){return _0xf13492[_0x82ed('0x1f')]()[_0x82ed('0x1e')](function(){_0x5e2c1e[_0x82ed('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1568d9,_0x65533d){return function(_0x59410b){if(!_0x59410b){_0x1568d9[_0x82ed('0x13')](0x194);}return _0x59410b;};}function handleError(_0x5e0797,_0x389356){_0x389356=_0x389356||0x1f4;return function(_0x5c3a34){logger['error'](_0x5c3a34[_0x82ed('0x21')]);if(_0x5c3a34['name']){delete _0x5c3a34[_0x82ed('0x22')];}_0x5e0797[_0x82ed('0x20')](_0x389356)[_0x82ed('0x23')](_0x5c3a34);};}exports[_0x82ed('0x24')]=function(_0x6d1129,_0xa4056b){var _0x5a088a={},_0x42056e={},_0xe058ae={'count':0x0,'rows':[]};var _0x867e81=_[_0x82ed('0x25')](db['SmsApplication'][_0x82ed('0x26')],function(_0x14c6cb){return{'name':_0x14c6cb[_0x82ed('0x27')],'type':_0x14c6cb['type']['key']};});_0x42056e[_0x82ed('0x28')]=_[_0x82ed('0x25')](_0x867e81,'name');_0x42056e['query']=_[_0x82ed('0x29')](_0x6d1129['query']);_0x42056e[_0x82ed('0x2a')]=_[_0x82ed('0x2b')](_0x42056e['model'],_0x42056e['query']);_0x5a088a[_0x82ed('0x2c')]=_['intersection'](_0x42056e[_0x82ed('0x28')],qs[_0x82ed('0x2d')](_0x6d1129['query']['fields']));_0x5a088a['attributes']=_0x5a088a['attributes'][_0x82ed('0x2e')]?_0x5a088a[_0x82ed('0x2c')]:_0x42056e[_0x82ed('0x28')];if(!_0x6d1129['query'][_0x82ed('0x2f')](_0x82ed('0x30'))){_0x5a088a['limit']=qs[_0x82ed('0x18')](_0x6d1129['query']['limit']);_0x5a088a[_0x82ed('0x16')]=qs[_0x82ed('0x16')](_0x6d1129[_0x82ed('0x31')][_0x82ed('0x16')]);}_0x5a088a[_0x82ed('0x32')]=qs[_0x82ed('0x33')](_0x6d1129[_0x82ed('0x31')][_0x82ed('0x33')]);_0x5a088a[_0x82ed('0x34')]=qs['filters'](_[_0x82ed('0x35')](_0x6d1129[_0x82ed('0x31')],_0x42056e[_0x82ed('0x2a')]),_0x867e81);if(_0x6d1129[_0x82ed('0x31')][_0x82ed('0x36')]){_0x5a088a[_0x82ed('0x34')]=_[_0x82ed('0x37')](_0x5a088a['where'],{'$or':_[_0x82ed('0x25')](_0x867e81,function(_0x2239a1){if(_0x2239a1['type']!==_0x82ed('0x38')){var _0x4a7c73={};_0x4a7c73[_0x2239a1[_0x82ed('0x22')]]={'$like':'%'+_0x6d1129[_0x82ed('0x31')][_0x82ed('0x36')]+'%'};return _0x4a7c73;}})});}_0x5a088a=_[_0x82ed('0x37')]({},_0x5a088a,_0x6d1129[_0x82ed('0x39')]);var _0x3f9a93={'where':_0x5a088a[_0x82ed('0x34')]};return db['SmsApplication'][_0x82ed('0x19')](_0x3f9a93)['then'](function(_0xcd9bf8){_0xe058ae[_0x82ed('0x19')]=_0xcd9bf8;if(_0x6d1129[_0x82ed('0x31')]['includeAll']){_0x5a088a['include']=[{'all':!![]}];}return db['SmsApplication'][_0x82ed('0x3a')](_0x5a088a);})[_0x82ed('0x1e')](function(_0x3353e1){_0xe058ae['rows']=_0x3353e1;return _0xe058ae;})[_0x82ed('0x1e')](respondWithFilteredResult(_0xa4056b,_0x5a088a))[_0x82ed('0x3b')](handleError(_0xa4056b,null));};exports[_0x82ed('0x3c')]=function(_0x25c8f7,_0x4e3f30){var _0x29d1cf={'raw':!![],'where':{'id':_0x25c8f7[_0x82ed('0x3d')]['id']}},_0x21c4fa={};_0x21c4fa[_0x82ed('0x28')]=_[_0x82ed('0x29')](db[_0x82ed('0x3e')][_0x82ed('0x26')]);_0x21c4fa[_0x82ed('0x31')]=_[_0x82ed('0x29')](_0x25c8f7[_0x82ed('0x31')]);_0x21c4fa[_0x82ed('0x2a')]=_[_0x82ed('0x2b')](_0x21c4fa['model'],_0x21c4fa[_0x82ed('0x31')]);_0x29d1cf[_0x82ed('0x2c')]=_[_0x82ed('0x2b')](_0x21c4fa[_0x82ed('0x28')],qs[_0x82ed('0x2d')](_0x25c8f7[_0x82ed('0x31')][_0x82ed('0x2d')]));_0x29d1cf[_0x82ed('0x2c')]=_0x29d1cf['attributes'][_0x82ed('0x2e')]?_0x29d1cf[_0x82ed('0x2c')]:_0x21c4fa[_0x82ed('0x28')];if(_0x25c8f7[_0x82ed('0x31')][_0x82ed('0x3f')]){_0x29d1cf['include']=[{'all':!![]}];}_0x29d1cf=_[_0x82ed('0x37')]({},_0x29d1cf,_0x25c8f7[_0x82ed('0x39')]);return db['SmsApplication'][_0x82ed('0x40')](_0x29d1cf)['then'](handleEntityNotFound(_0x4e3f30,null))['then'](respondWithResult(_0x4e3f30,null))[_0x82ed('0x3b')](handleError(_0x4e3f30,null));};exports[_0x82ed('0x41')]=function(_0x44e6ea,_0x2afe43){return db[_0x82ed('0x3e')][_0x82ed('0x41')](_0x44e6ea['body'],{})[_0x82ed('0x1e')](respondWithResult(_0x2afe43,0xc9))[_0x82ed('0x3b')](handleError(_0x2afe43,null));};exports[_0x82ed('0x1d')]=function(_0x72c42e,_0x2c6c0d){if(_0x72c42e['body']['id']){delete _0x72c42e['body']['id'];}return db[_0x82ed('0x3e')]['find']({'where':{'id':_0x72c42e['params']['id']}})['then'](handleEntityNotFound(_0x2c6c0d,null))[_0x82ed('0x1e')](saveUpdates(_0x72c42e[_0x82ed('0x42')],null))[_0x82ed('0x1e')](respondWithResult(_0x2c6c0d,null))[_0x82ed('0x3b')](handleError(_0x2c6c0d,null));};exports[_0x82ed('0x1f')]=function(_0x44c80e,_0x223692){return db[_0x82ed('0x3e')][_0x82ed('0x40')]({'where':{'id':_0x44c80e[_0x82ed('0x3d')]['id']}})['then'](handleEntityNotFound(_0x223692,null))[_0x82ed('0x1e')](removeEntity(_0x223692,null))[_0x82ed('0x3b')](handleError(_0x223692,null));}; \ No newline at end of file +var _0x4d47=['fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','filters','options','find','create','body','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','SmsApplication','rawAttributes'];(function(_0x18deef,_0x5b8774){var _0x3f4361=function(_0xc61e4d){while(--_0xc61e4d){_0x18deef['push'](_0x18deef['shift']());}};_0x3f4361(++_0x5b8774);}(_0x4d47,0x6b));var _0x74d4=function(_0xb7fca7,_0x38ca46){_0xb7fca7=_0xb7fca7-0x0;var _0x3c0d34=_0x4d47[_0xb7fca7];return _0x3c0d34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74d4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74d4('0x1'));var rp=require(_0x74d4('0x2'));var moment=require('moment');var BPromise=require(_0x74d4('0x3'));var Mustache=require('mustache');var util=require(_0x74d4('0x4'));var path=require(_0x74d4('0x5'));var sox=require(_0x74d4('0x6'));var csv=require(_0x74d4('0x7'));var ejs=require(_0x74d4('0x8'));var fs=require('fs');var fs_extra=require(_0x74d4('0x9'));var _=require(_0x74d4('0xa'));var squel=require('squel');var crypto=require(_0x74d4('0xb'));var jsforce=require(_0x74d4('0xc'));var deskjs=require(_0x74d4('0xd'));var toCsv=require(_0x74d4('0x7'));var querystring=require(_0x74d4('0xe'));var Papa=require(_0x74d4('0xf'));var Redis=require(_0x74d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x74d4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74d4('0x12'));var logger=require(_0x74d4('0x13'))(_0x74d4('0x14'));var utils=require(_0x74d4('0x15'));var config=require(_0x74d4('0x16'));var licenseUtil=require(_0x74d4('0x17'));var db=require(_0x74d4('0x18'))['db'];function respondWithStatusCode(_0x208f37,_0x591885){_0x591885=_0x591885||0xcc;return function(_0x3170fd){if(_0x3170fd){return _0x208f37[_0x74d4('0x19')](_0x591885);}return _0x208f37['status'](_0x591885)[_0x74d4('0x1a')]();};}function respondWithResult(_0xc3b43c,_0x1c5f8f){_0x1c5f8f=_0x1c5f8f||0xc8;return function(_0x4b0f24){if(_0x4b0f24){return _0xc3b43c[_0x74d4('0x1b')](_0x1c5f8f)[_0x74d4('0x1c')](_0x4b0f24);}};}function respondWithFilteredResult(_0x144d92,_0x576efb){return function(_0x1b0207){if(_0x1b0207){var _0x40098b=typeof _0x576efb[_0x74d4('0x1d')]===_0x74d4('0x1e')&&typeof _0x576efb['limit']===_0x74d4('0x1e');var _0x4c1186=_0x1b0207['count'];var _0x57849a=_0x40098b?0x0:_0x576efb[_0x74d4('0x1d')];var _0x575e3c=_0x40098b?_0x1b0207['count']:_0x576efb[_0x74d4('0x1d')]+_0x576efb[_0x74d4('0x1f')];var _0x31048e;if(_0x575e3c>=_0x4c1186){_0x575e3c=_0x4c1186;_0x31048e=0xc8;}else{_0x31048e=0xce;}_0x144d92[_0x74d4('0x1b')](_0x31048e);return _0x144d92[_0x74d4('0x20')](_0x74d4('0x21'),_0x57849a+'-'+_0x575e3c+'/'+_0x4c1186)['json'](_0x1b0207);}return null;};}function patchUpdates(_0x362005){return function(_0x55fdfa){try{jsonpatch[_0x74d4('0x22')](_0x55fdfa,_0x362005,!![]);}catch(_0x5b43b7){return BPromise[_0x74d4('0x23')](_0x5b43b7);}return _0x55fdfa[_0x74d4('0x24')]();};}function saveUpdates(_0x23f0a2,_0x12f399){return function(_0x1a4cdc){if(_0x1a4cdc){return _0x1a4cdc[_0x74d4('0x25')](_0x23f0a2)[_0x74d4('0x26')](function(_0x890c69){return _0x890c69;});}return null;};}function removeEntity(_0x189d42,_0x6986f3){return function(_0x59fac9){if(_0x59fac9){return _0x59fac9[_0x74d4('0x27')]()[_0x74d4('0x26')](function(){_0x189d42[_0x74d4('0x1b')](0xcc)[_0x74d4('0x1a')]();});}};}function handleEntityNotFound(_0xbd347f,_0x34ce30){return function(_0x51940c){if(!_0x51940c){_0xbd347f['sendStatus'](0x194);}return _0x51940c;};}function handleError(_0x58b97c,_0x486ba7){_0x486ba7=_0x486ba7||0x1f4;return function(_0x23b3f0){logger[_0x74d4('0x28')](_0x23b3f0['stack']);if(_0x23b3f0[_0x74d4('0x29')]){delete _0x23b3f0[_0x74d4('0x29')];}_0x58b97c[_0x74d4('0x1b')](_0x486ba7)[_0x74d4('0x2a')](_0x23b3f0);};}exports['index']=function(_0x3e9808,_0x3382f4){var _0x4a6559={},_0x58dcc0={},_0x159b2c={'count':0x0,'rows':[]};var _0x2993d7=_['map'](db[_0x74d4('0x2b')][_0x74d4('0x2c')],function(_0x4b1ebd){return{'name':_0x4b1ebd[_0x74d4('0x2d')],'type':_0x4b1ebd[_0x74d4('0x2e')][_0x74d4('0x2f')]};});_0x58dcc0[_0x74d4('0x30')]=_[_0x74d4('0x31')](_0x2993d7,_0x74d4('0x29'));_0x58dcc0[_0x74d4('0x32')]=_[_0x74d4('0x33')](_0x3e9808['query']);_0x58dcc0['filters']=_[_0x74d4('0x34')](_0x58dcc0[_0x74d4('0x30')],_0x58dcc0['query']);_0x4a6559[_0x74d4('0x35')]=_[_0x74d4('0x34')](_0x58dcc0[_0x74d4('0x30')],qs[_0x74d4('0x36')](_0x3e9808[_0x74d4('0x32')]['fields']));_0x4a6559[_0x74d4('0x35')]=_0x4a6559[_0x74d4('0x35')][_0x74d4('0x37')]?_0x4a6559[_0x74d4('0x35')]:_0x58dcc0[_0x74d4('0x30')];if(!_0x3e9808[_0x74d4('0x32')][_0x74d4('0x38')]('nolimit')){_0x4a6559[_0x74d4('0x1f')]=qs['limit'](_0x3e9808[_0x74d4('0x32')]['limit']);_0x4a6559[_0x74d4('0x1d')]=qs['offset'](_0x3e9808[_0x74d4('0x32')][_0x74d4('0x1d')]);}_0x4a6559[_0x74d4('0x39')]=qs[_0x74d4('0x3a')](_0x3e9808[_0x74d4('0x32')][_0x74d4('0x3a')]);_0x4a6559[_0x74d4('0x3b')]=qs['filters'](_[_0x74d4('0x3c')](_0x3e9808[_0x74d4('0x32')],_0x58dcc0['filters']),_0x2993d7);if(_0x3e9808['query']['filter']){_0x4a6559[_0x74d4('0x3b')]=_['merge'](_0x4a6559[_0x74d4('0x3b')],{'$or':_[_0x74d4('0x31')](_0x2993d7,function(_0x4c5508){if(_0x4c5508[_0x74d4('0x2e')]!==_0x74d4('0x3d')){var _0x861d34={};_0x861d34[_0x4c5508[_0x74d4('0x29')]]={'$like':'%'+_0x3e9808[_0x74d4('0x32')][_0x74d4('0x3e')]+'%'};return _0x861d34;}})});}_0x4a6559=_[_0x74d4('0x3f')]({},_0x4a6559,_0x3e9808['options']);var _0x5c680c={'where':_0x4a6559['where']};return db[_0x74d4('0x2b')]['count'](_0x5c680c)[_0x74d4('0x26')](function(_0x28cb65){_0x159b2c['count']=_0x28cb65;if(_0x3e9808[_0x74d4('0x32')][_0x74d4('0x40')]){_0x4a6559[_0x74d4('0x41')]=[{'all':!![]}];}return db[_0x74d4('0x2b')][_0x74d4('0x42')](_0x4a6559);})['then'](function(_0x595cc9){_0x159b2c[_0x74d4('0x43')]=_0x595cc9;return _0x159b2c;})[_0x74d4('0x26')](respondWithFilteredResult(_0x3382f4,_0x4a6559))[_0x74d4('0x44')](handleError(_0x3382f4,null));};exports[_0x74d4('0x45')]=function(_0x451b8a,_0x1f958b){var _0x226211={'raw':!![],'where':{'id':_0x451b8a[_0x74d4('0x46')]['id']}},_0x32017e={};_0x32017e[_0x74d4('0x30')]=_['keys'](db[_0x74d4('0x2b')][_0x74d4('0x2c')]);_0x32017e[_0x74d4('0x32')]=_['keys'](_0x451b8a[_0x74d4('0x32')]);_0x32017e[_0x74d4('0x47')]=_['intersection'](_0x32017e[_0x74d4('0x30')],_0x32017e[_0x74d4('0x32')]);_0x226211['attributes']=_[_0x74d4('0x34')](_0x32017e[_0x74d4('0x30')],qs[_0x74d4('0x36')](_0x451b8a[_0x74d4('0x32')][_0x74d4('0x36')]));_0x226211['attributes']=_0x226211['attributes'][_0x74d4('0x37')]?_0x226211[_0x74d4('0x35')]:_0x32017e[_0x74d4('0x30')];if(_0x451b8a[_0x74d4('0x32')][_0x74d4('0x40')]){_0x226211[_0x74d4('0x41')]=[{'all':!![]}];}_0x226211=_['merge']({},_0x226211,_0x451b8a[_0x74d4('0x48')]);return db['SmsApplication'][_0x74d4('0x49')](_0x226211)[_0x74d4('0x26')](handleEntityNotFound(_0x1f958b,null))[_0x74d4('0x26')](respondWithResult(_0x1f958b,null))[_0x74d4('0x44')](handleError(_0x1f958b,null));};exports[_0x74d4('0x4a')]=function(_0x31adc0,_0x3b389f){return db['SmsApplication'][_0x74d4('0x4a')](_0x31adc0[_0x74d4('0x4b')],{})[_0x74d4('0x26')](respondWithResult(_0x3b389f,0xc9))[_0x74d4('0x44')](handleError(_0x3b389f,null));};exports[_0x74d4('0x25')]=function(_0x3f7cda,_0x82b1c){if(_0x3f7cda['body']['id']){delete _0x3f7cda[_0x74d4('0x4b')]['id'];}return db[_0x74d4('0x2b')][_0x74d4('0x49')]({'where':{'id':_0x3f7cda[_0x74d4('0x46')]['id']}})['then'](handleEntityNotFound(_0x82b1c,null))[_0x74d4('0x26')](saveUpdates(_0x3f7cda[_0x74d4('0x4b')],null))['then'](respondWithResult(_0x82b1c,null))['catch'](handleError(_0x82b1c,null));};exports['destroy']=function(_0x40ac2c,_0x2c292d){return db[_0x74d4('0x2b')][_0x74d4('0x49')]({'where':{'id':_0x40ac2c['params']['id']}})[_0x74d4('0x26')](handleEntityNotFound(_0x2c292d,null))[_0x74d4('0x26')](removeEntity(_0x2c292d,null))[_0x74d4('0x44')](handleError(_0x2c292d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7856bb6..40c8681 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 _0x6c50=['request-promise','rimraf','exports','define','SmsApplication','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4fdac5,_0xccca45){var _0x52b9d3=function(_0x3de960){while(--_0x3de960){_0x4fdac5['push'](_0x4fdac5['shift']());}};_0x52b9d3(++_0xccca45);}(_0x6c50,0xe2));var _0x06c5=function(_0x34b6a6,_0x54958d){_0x34b6a6=_0x34b6a6-0x0;var _0x4ee1f0=_0x6c50[_0x34b6a6];return _0x4ee1f0;};'use strict';var _=require(_0x06c5('0x0'));var util=require('util');var logger=require(_0x06c5('0x1'))(_0x06c5('0x2'));var moment=require(_0x06c5('0x3'));var BPromise=require(_0x06c5('0x4'));var rp=require(_0x06c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06c5('0x6'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x06c5('0x7')]=function(_0x47435d,_0x2372fd){return _0x47435d[_0x06c5('0x8')](_0x06c5('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x06c5('0xa')});}; \ No newline at end of file +var _0x3d94=['../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x3d94,0xd7));var _0x43d9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d94[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x43d9('0x0'));var logger=require(_0x43d9('0x1'))(_0x43d9('0x2'));var moment=require('moment');var BPromise=require(_0x43d9('0x3'));var rp=require(_0x43d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x43d9('0x5'));var attributes=require(_0x43d9('0x6'));module['exports']=function(_0xc6dd85,_0x533b97){return _0xc6dd85[_0x43d9('0x7')](_0x43d9('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x43d9('0x9'),'collate':_0x43d9('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index d3c8b02..991352d 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 _0xb91a=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','SmsApplication,\x20%s,\x20%s'];(function(_0x1c565d,_0x4a8ca6){var _0x260058=function(_0x254b9c){while(--_0x254b9c){_0x1c565d['push'](_0x1c565d['shift']());}};_0x260058(++_0x4a8ca6);}(_0xb91a,0xe5));var _0xab91=function(_0x157fcd,_0x592032){_0x157fcd=_0x157fcd-0x0;var _0x111742=_0xb91a[_0x157fcd];return _0x111742;};'use strict';var _=require('lodash');var util=require(_0xab91('0x0'));var moment=require(_0xab91('0x1'));var BPromise=require(_0xab91('0x2'));var rs=require(_0xab91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab91('0x4'))['db'];var utils=require(_0xab91('0x5'));var logger=require('../../config/logger')(_0xab91('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xab91('0x7')][_0xab91('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56f24d,_0x2ebd86,_0x26e44b){return new BPromise(function(_0x55a554,_0x1748f2){return client[_0xab91('0x9')](_0x56f24d,_0x26e44b)['then'](function(_0x5765fc){logger['info'](_0xab91('0xa'),_0x2ebd86,_0xab91('0xb'));logger[_0xab91('0xc')](_0xab91('0xd'),_0x2ebd86,'request\x20sent',JSON[_0xab91('0xe')](_0x5765fc));if(_0x5765fc[_0xab91('0xf')]){if(_0x5765fc['error'][_0xab91('0x10')]===0x1f4){logger['error'](_0xab91('0xa'),_0x2ebd86,_0x5765fc['error']['message']);return _0x1748f2(_0x5765fc[_0xab91('0xf')]['message']);}logger[_0xab91('0xf')](_0xab91('0xa'),_0x2ebd86,_0x5765fc[_0xab91('0xf')][_0xab91('0x11')]);return _0x55a554(_0x5765fc[_0xab91('0xf')][_0xab91('0x11')]);}else{logger['info'](_0xab91('0xa'),_0x2ebd86,'request\x20sent');_0x55a554(_0x5765fc[_0xab91('0x12')][_0xab91('0x11')]);}})[_0xab91('0x13')](function(_0x32df88){logger['error'](_0xab91('0xa'),_0x2ebd86,_0x32df88);_0x1748f2(_0x32df88);});});} \ No newline at end of file +var _0xd0e4=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash'];(function(_0x31a0b2,_0x5e499d){var _0x473abd=function(_0x5dee06){while(--_0x5dee06){_0x31a0b2['push'](_0x31a0b2['shift']());}};_0x473abd(++_0x5e499d);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x5d1f51,_0xe9efbd){_0x5d1f51=_0x5d1f51-0x0;var _0x2412c1=_0xd0e4[_0x5d1f51];return _0x2412c1;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var moment=require(_0x4d0e('0x2'));var BPromise=require(_0x4d0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d0e('0x4'))['db'];var utils=require(_0x4d0e('0x5'));var logger=require(_0x4d0e('0x6'))(_0x4d0e('0x7'));var config=require(_0x4d0e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x103596,_0x39e5c6,_0x50cd74){return new BPromise(function(_0x2f900a,_0x1731e4){return client['request'](_0x103596,_0x50cd74)['then'](function(_0x9358f5){logger['info'](_0x4d0e('0x9'),_0x39e5c6,_0x4d0e('0xa'));logger[_0x4d0e('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x39e5c6,_0x4d0e('0xa'),JSON[_0x4d0e('0xc')](_0x9358f5));if(_0x9358f5['error']){if(_0x9358f5['error'][_0x4d0e('0xd')]===0x1f4){logger[_0x4d0e('0xe')](_0x4d0e('0x9'),_0x39e5c6,_0x9358f5[_0x4d0e('0xe')][_0x4d0e('0xf')]);return _0x1731e4(_0x9358f5[_0x4d0e('0xe')][_0x4d0e('0xf')]);}logger[_0x4d0e('0xe')](_0x4d0e('0x9'),_0x39e5c6,_0x9358f5['error'][_0x4d0e('0xf')]);return _0x2f900a(_0x9358f5[_0x4d0e('0xe')][_0x4d0e('0xf')]);}else{logger['info'](_0x4d0e('0x9'),_0x39e5c6,'request\x20sent');_0x2f900a(_0x9358f5[_0x4d0e('0x10')][_0x4d0e('0xf')]);}})[_0x4d0e('0x11')](function(_0x956477){logger[_0x4d0e('0xe')](_0x4d0e('0x9'),_0x39e5c6,_0x956477);_0x1731e4(_0x956477);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index cc44602..d5eed84 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 _0x5eb8=['smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x248ee9,_0x5b756d){var _0x15829f=function(_0x372c44){while(--_0x372c44){_0x248ee9['push'](_0x248ee9['shift']());}};_0x15829f(++_0x5b756d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0x5eb8[_0x542f45];return _0x38c609;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x15')]);router[_0x85eb('0x14')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller['addMessage']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),interaction[_0x85eb('0x17')](_0x85eb('0x18'),_0x85eb('0x19')),controller[_0x85eb('0x1a')]);router[_0x85eb('0x1b')]('/:id',auth[_0x85eb('0xa')](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1c')),controller[_0x85eb('0x1d')]);router[_0x85eb('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1f')),controller[_0x85eb('0x20')]);router[_0x85eb('0x1e')](_0x85eb('0x16'),auth[_0x85eb('0xa')](),controller['removeTags']);module[_0x85eb('0x21')]=router; \ No newline at end of file +var _0xefda=['../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x48f1bf,_0x20b1cd){var _0x89c75=function(_0x158e44){while(--_0x158e44){_0x48f1bf['push'](_0x48f1bf['shift']());}};_0x89c75(++_0x20b1cd);}(_0xefda,0x96));var _0xaefd=function(_0x3824f2,_0x197ec3){_0x3824f2=_0x3824f2-0x0;var _0x99d941=_0xefda[_0x3824f2];return _0x99d941;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['describe']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['show']);router['get']('/:id/messages',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0x8')](_0xaefd('0xe'),auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x10')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x10')](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x13')]);router['post'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),'smsinteraction:addtags'),controller[_0xaefd('0x17')]);router[_0xaefd('0x18')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x19')),controller[_0xaefd('0x1a')]);router['delete'](_0xaefd('0xc'),auth[_0xaefd('0xb')](),interaction[_0xaefd('0x15')](_0xaefd('0x16'),_0xaefd('0x1b')),controller[_0xaefd('0x1c')]);router['delete'](_0xaefd('0x14'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x1d')]);module[_0xaefd('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 19bd71e..e4c128c 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 _0xf96b=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2946bc,_0x44bec2){var _0x32cfb8=function(_0x28c40e){while(--_0x28c40e){_0x2946bc['push'](_0x2946bc['shift']());}};_0x32cfb8(++_0x44bec2);}(_0xf96b,0x109));var _0xbf96=function(_0x18aa37,_0x3c56ce){_0x18aa37=_0x18aa37-0x0;var _0x21ba66=_0xf96b[_0x18aa37];return _0x21ba66;};'use strict';var Sequelize=require(_0xbf96('0x0'));var moment=require(_0xbf96('0x1'));module[_0xbf96('0x2')]={'closed':{'type':Sequelize[_0xbf96('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbf96('0x4')]},'disposition':{'type':Sequelize[_0xbf96('0x5')]},'secondDisposition':{'type':Sequelize[_0xbf96('0x5')]},'thirdDisposition':{'type':Sequelize[_0xbf96('0x5')]},'note':{'type':Sequelize[_0xbf96('0x5')]},'phone':{'type':Sequelize[_0xbf96('0x5')]},'read1stAt':{'type':Sequelize[_0xbf96('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xbf96('0x6')]('in',_0xbf96('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbf96('0x6')]('in',_0xbf96('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbf96('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4148=['STRING','ENUM','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4148,0xc6));var _0x8414=function(_0x5b78fe,_0x44542c){_0x5b78fe=_0x5b78fe-0x0;var _0x24ac3c=_0x4148[_0x5b78fe];return _0x24ac3c;};'use strict';var Sequelize=require(_0x8414('0x0'));var moment=require(_0x8414('0x1'));module[_0x8414('0x2')]={'closed':{'type':Sequelize[_0x8414('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8414('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8414('0x5')]},'thirdDisposition':{'type':Sequelize[_0x8414('0x5')]},'note':{'type':Sequelize[_0x8414('0x5')]},'phone':{'type':Sequelize[_0x8414('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8414('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8414('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8414('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c80e124..bc67aea 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 _0xabda=['include','merge','options','create','describe','ids','getMessages','findOne','SmsInteractionId','$gte','format','SmsMessage','findAll','rows','addTags','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','root','files','tmp','join','transcript-%d-%s.zip','Contact','lastName','Messages','secret','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','direction','out','System','firstName','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','Users','map','TagIds','split','forEach','Tags','push','catch','waiting','answered','unmanaged','total','closed','UserId','talking','SmsInteraction','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','select','field','color','from','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','text','keys','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','params','includeAll'];(function(_0x4068a3,_0x1c2cd3){var _0xcdea1=function(_0x1eabe1){while(--_0x1eabe1){_0x4068a3['push'](_0x4068a3['shift']());}};_0xcdea1(++_0x1c2cd3);}(_0xabda,0x126));var _0xaabd=function(_0x2803ab,_0x1c33f2){_0x2803ab=_0x2803ab-0x0;var _0x3d6e8e=_0xabda[_0x2803ab];return _0x3d6e8e;};'use strict';var emlformat=require(_0xaabd('0x0'));var rimraf=require(_0xaabd('0x1'));var zipdir=require(_0xaabd('0x2'));var jsonpatch=require(_0xaabd('0x3'));var rp=require(_0xaabd('0x4'));var moment=require('moment');var BPromise=require(_0xaabd('0x5'));var Mustache=require(_0xaabd('0x6'));var util=require(_0xaabd('0x7'));var path=require(_0xaabd('0x8'));var sox=require(_0xaabd('0x9'));var csv=require(_0xaabd('0xa'));var ejs=require(_0xaabd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaabd('0xc'));var squel=require('squel');var crypto=require(_0xaabd('0xd'));var jsforce=require(_0xaabd('0xe'));var deskjs=require(_0xaabd('0xf'));var toCsv=require(_0xaabd('0xa'));var querystring=require(_0xaabd('0x10'));var Papa=require('papaparse');var Redis=require(_0xaabd('0x11'));var authService=require(_0xaabd('0x12'));var qs=require(_0xaabd('0x13'));var as=require(_0xaabd('0x14'));var pdf=require(_0xaabd('0x15'));var hardwareService=require(_0xaabd('0x16'));var logger=require('../../config/logger')(_0xaabd('0x17'));var utils=require('../../config/utils');var config=require(_0xaabd('0x18'));var licenseUtil=require(_0xaabd('0x19'));var db=require(_0xaabd('0x1a'))['db'];config['redis']=_[_0xaabd('0x1b')](config[_0xaabd('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaabd('0x1d'))[_0xaabd('0x1e')](socket);function respondWithStatusCode(_0x3b2aa6,_0x57250d){_0x57250d=_0x57250d||0xcc;return function(_0x17903d){if(_0x17903d){return _0x3b2aa6[_0xaabd('0x1f')](_0x57250d);}return _0x3b2aa6[_0xaabd('0x20')](_0x57250d)[_0xaabd('0x21')]();};}function respondWithResult(_0x53a5bd,_0x11e5e5){_0x11e5e5=_0x11e5e5||0xc8;return function(_0x37ddf4){if(_0x37ddf4){return _0x53a5bd[_0xaabd('0x20')](_0x11e5e5)[_0xaabd('0x22')](_0x37ddf4);}};}function respondWithFilteredResult(_0xa96a38,_0x35e06c){return function(_0x395848){if(_0x395848){var _0x2cd6ec=typeof _0x35e06c[_0xaabd('0x23')]===_0xaabd('0x24')&&typeof _0x35e06c[_0xaabd('0x25')]==='undefined';var _0x45ab06=_0x395848[_0xaabd('0x26')];var _0x32c9cd=_0x2cd6ec?0x0:_0x35e06c[_0xaabd('0x23')];var _0x5e9381=_0x2cd6ec?_0x395848[_0xaabd('0x26')]:_0x35e06c[_0xaabd('0x23')]+_0x35e06c[_0xaabd('0x25')];var _0x59fd0b;if(_0x5e9381>=_0x45ab06){_0x5e9381=_0x45ab06;_0x59fd0b=0xc8;}else{_0x59fd0b=0xce;}_0xa96a38[_0xaabd('0x20')](_0x59fd0b);return _0xa96a38[_0xaabd('0x27')](_0xaabd('0x28'),_0x32c9cd+'-'+_0x5e9381+'/'+_0x45ab06)[_0xaabd('0x22')](_0x395848);}return null;};}function patchUpdates(_0xb65e4d){return function(_0x2b2064){try{jsonpatch['apply'](_0x2b2064,_0xb65e4d,!![]);}catch(_0x4f9c7f){return BPromise[_0xaabd('0x29')](_0x4f9c7f);}return _0x2b2064['save']();};}function saveUpdates(_0x4c5283,_0x3f3886){return function(_0x5c132d){if(_0x5c132d){return _0x5c132d[_0xaabd('0x2a')](_0x4c5283)[_0xaabd('0x2b')](function(_0x3d7b38){return _0x3d7b38;});}return null;};}function removeEntity(_0x28f257,_0x12543f){return function(_0x289362){if(_0x289362){return _0x289362[_0xaabd('0x2c')]()[_0xaabd('0x2b')](function(){_0x28f257[_0xaabd('0x20')](0xcc)[_0xaabd('0x21')]();});}};}function handleEntityNotFound(_0x28398a,_0x1fc94e){return function(_0x2e104a){if(!_0x2e104a){_0x28398a[_0xaabd('0x1f')](0x194);}return _0x2e104a;};}function handleError(_0x25d815,_0x4a07e4){_0x4a07e4=_0x4a07e4||0x1f4;return function(_0xa0e953){logger[_0xaabd('0x2d')](_0xa0e953[_0xaabd('0x2e')]);if(_0xa0e953[_0xaabd('0x2f')]){delete _0xa0e953[_0xaabd('0x2f')];}_0x25d815[_0xaabd('0x20')](_0x4a07e4)['send'](_0xa0e953);};}function getInteractionUsers(_0xe8c424,_0x29c9b2){return new BPromise(function(_0x36eaf3,_0x38e03a){try{if(_0x29c9b2[_0xe8c424['id']]){_0xe8c424[_0xaabd('0x30')]=_[_0xaabd('0x31')](_0x29c9b2[_0xe8c424['id']],function(_0x58d836){return{'id':_0x58d836['id'],'fullname':_0x58d836['fullname']};});}}catch(_0x3ffcb6){_0x38e03a(_0x3ffcb6);}_0x36eaf3(_0xe8c424);});}function getInteractionTags(_0x4ee967,_0x2ed5d8){return new BPromise(function(_0x2c19b0,_0x1e59b1){try{if(_0x4ee967[_0xaabd('0x32')]){_0x4ee967['Tags']=[];_0x4ee967[_0xaabd('0x32')][_0xaabd('0x33')](',')[_0xaabd('0x34')](function(_0x4a9448){_0x4ee967[_0xaabd('0x35')][_0xaabd('0x36')](_0x2ed5d8[_0x4a9448]);});}delete _0x4ee967[_0xaabd('0x32')];}catch(_0x5806f){_0x1e59b1(_0x5806f);}_0x2c19b0(_0x4ee967);});}function updateSmsInteraction(_0x2c9269,_0x11ea66,_0x4974a7){return new BPromise(function(_0x3fac3d,_0x1c8528){return getInteractionUsers(_0x2c9269,_0x4974a7)['then'](function(_0x23fe74){return getInteractionTags(_0x23fe74,_0x11ea66);})['then'](function(_0x16c6a6){return getStateInteraction(_0x16c6a6);})['then'](function(_0x170fe9){_0x3fac3d(_0x170fe9);})[_0xaabd('0x37')](function(_0x26719b){_0x1c8528(_0x26719b);});});}function getStateInteraction(_0x56c747){return new BPromise(function(_0x3ed55c){_0x56c747[_0xaabd('0x38')]=0x0;_0x56c747['talking']=0x0;_0x56c747[_0xaabd('0x39')]=0x0;_0x56c747[_0xaabd('0x3a')]=0x0;_0x56c747[_0xaabd('0x3b')]=0x0;if(!_0x56c747[_0xaabd('0x3c')]&&!_0x56c747[_0xaabd('0x3d')]){_0x56c747[_0xaabd('0x38')]+=0x1;}if(!_0x56c747[_0xaabd('0x3c')]&&_0x56c747[_0xaabd('0x3d')]){_0x56c747[_0xaabd('0x3e')]+=0x1;if(_0x56c747['waiting']){_0x56c747[_0xaabd('0x38')]-=0x1;}}if(_0x56c747[_0xaabd('0x3c')]&&_0x56c747[_0xaabd('0x3d')]){_0x56c747[_0xaabd('0x39')]+=0x1;if(_0x56c747[_0xaabd('0x3e')]){_0x56c747[_0xaabd('0x3e')]-=0x1;}}if(_0x56c747[_0xaabd('0x3c')]&&!_0x56c747[_0xaabd('0x3d')]){_0x56c747['unmanaged']+=0x1;if(_0x56c747[_0xaabd('0x38')]){_0x56c747[_0xaabd('0x38')]-=0x1;}}_0x56c747[_0xaabd('0x3b')]+=0x1;_0x3ed55c(_0x56c747);});}exports['index']=function(_0x2b952c,_0x4367d3){var _0xa1bac={},_0x29ff7={},_0x1a3c4e={'count':0x0,'rows':[]};var _0x587a05=_[_0xaabd('0x31')](db[_0xaabd('0x3f')][_0xaabd('0x40')],function(_0x2fb706){return{'name':_0x2fb706[_0xaabd('0x41')],'type':_0x2fb706[_0xaabd('0x42')][_0xaabd('0x43')]};});_0x29ff7[_0xaabd('0x44')]=_[_0xaabd('0x31')](_0x587a05,_0xaabd('0x2f'));_0x29ff7[_0xaabd('0x45')]=_['keys'](_0x2b952c[_0xaabd('0x45')]);_0x29ff7['filters']=_[_0xaabd('0x46')](_0x29ff7['model'],_0x29ff7[_0xaabd('0x45')]);_0xa1bac[_0xaabd('0x47')]=_[_0xaabd('0x46')](_0x29ff7[_0xaabd('0x44')],qs[_0xaabd('0x48')](_0x2b952c[_0xaabd('0x45')][_0xaabd('0x48')]));_0xa1bac['attributes']=_0xa1bac[_0xaabd('0x47')][_0xaabd('0x49')]?_0xa1bac[_0xaabd('0x47')]:_0x29ff7['model'];if(!_0x2b952c[_0xaabd('0x45')][_0xaabd('0x4a')](_0xaabd('0x4b'))){_0xa1bac['limit']=qs[_0xaabd('0x25')](_0x2b952c[_0xaabd('0x45')][_0xaabd('0x25')]);_0xa1bac[_0xaabd('0x23')]=qs['offset'](_0x2b952c['query'][_0xaabd('0x23')]);}_0xa1bac['order']=qs[_0xaabd('0x4c')](_0x2b952c[_0xaabd('0x45')][_0xaabd('0x4c')]);_0xa1bac[_0xaabd('0x4d')]=qs[_0xaabd('0x4e')](_['pick'](_0x2b952c[_0xaabd('0x45')],_0x29ff7[_0xaabd('0x4e')]),_0x587a05);var _0x1975ab=[];var _0x1bc17b=squel[_0xaabd('0x4f')]()[_0xaabd('0x50')]('id')[_0xaabd('0x50')](_0xaabd('0x2f'))[_0xaabd('0x50')](_0xaabd('0x51'))[_0xaabd('0x52')]('tools_tags');var _0x3f9741=squel[_0xaabd('0x4f')]()[_0xaabd('0x50')](_0xaabd('0x53'))[_0xaabd('0x50')](_0xaabd('0x54'))['field']('ui.SmsInteractionId')[_0xaabd('0x52')](_0xaabd('0x55'),'ui')[_0xaabd('0x56')](_0xaabd('0x57'),'u',_0xaabd('0x58'));var _0x459d99=squel[_0xaabd('0x4f')]()[_0xaabd('0x52')](_0xaabd('0x59'),'i')[_0xaabd('0x56')]('cm_contacts','c',_0xaabd('0x5a'))[_0xaabd('0x56')]('users','o',_0xaabd('0x5b'))[_0xaabd('0x56')](_0xaabd('0x5c'),'a',_0xaabd('0x5d'))['left_join']('sms_messages','me',_0xaabd('0x5e'))[_0xaabd('0x56')](_0xaabd('0x5f'),'it',_0xaabd('0x60'))[_0xaabd('0x56')](_0xaabd('0x61'),'t',_0xaabd('0x62'));var _0x13d04f=squel[_0xaabd('0x63')]();var _0x3f1e0b=[];var _0x40aae1=squel[_0xaabd('0x63')]();var _0x5a76d1;if(_0x2b952c[_0xaabd('0x45')]['search']){_0x5a76d1=as[_0xaabd('0x64')](_0x2b952c['query']['search']);var _0x18ae67=_0x5a76d1[_0xaabd('0x65')];for(var _0x33d49a=0x0;_0x33d49a<_0x5a76d1[_0xaabd('0x66')][_0xaabd('0x49')];_0x33d49a++){var _0x4c9914=_0x5a76d1['conditions'][_0x33d49a];var _0x293e02='i';var _0x583e07=_[_0xaabd('0x67')](_0x587a05,[_0xaabd('0x2f'),_0x4c9914[_0xaabd('0x50')]]);if(!_0x583e07){switch(_0x4c9914[_0xaabd('0x50')]){case _0xaabd('0x68'):if(_0x4c9914[_0xaabd('0x69')]==0x1){_0x459d99['having']('`'+_0x4c9914['field']+_0xaabd('0x6a'));}else{_0x459d99[_0xaabd('0x6b')]('`'+_0x4c9914[_0xaabd('0x50')]+_0xaabd('0x6c'));}break;case'Contact':if(_0x4c9914[_0xaabd('0x6d')]===_0xaabd('0x6e')){if(_0x4c9914[_0xaabd('0x69')][_0xaabd('0x33')]('\x20')[_0xaabd('0x49')]>0x1){_0x13d04f[_0x18ae67](_0xaabd('0x6f'),qs[_0xaabd('0x70')](_0x4c9914[_0xaabd('0x69')]),null);}else{var _0x51722c='%'+_0x4c9914[_0xaabd('0x69')]+'%';_0x13d04f[_0x18ae67](_0xaabd('0x71'),_0x51722c,_0x51722c,_0x51722c);}}else{_0x583e07=_['find'](_0x587a05,[_0xaabd('0x2f'),'ContactId']);_0x4c9914[_0xaabd('0x50')]=_0xaabd('0x72');_0x3d19d1=as[_0xaabd('0x73')](_0x293e02,_0x583e07[_0xaabd('0x42')],_0x4c9914);_0x13d04f[_0x18ae67](_0x3d19d1['text'],_0x3d19d1['value'][_0xaabd('0x74')],_0x3d19d1['value'][_0xaabd('0x21')]);}break;case _0xaabd('0x75'):var _0x198dbf=_0x4c9914[_0xaabd('0x69')][_0xaabd('0x33')](',')[_0xaabd('0x31')](function(_0x54613a){return Number(_0x54613a);});_0x198dbf[_0xaabd('0x34')](function(_0xee6968){_0x40aae1['or'](_0xaabd('0x76'),'%,'+_0xee6968+',%');});_0x3f1e0b=_[_0xaabd('0x77')](_0x3f1e0b,_0x198dbf);break;case _0xaabd('0x78'):if(_0x4c9914[_0xaabd('0x6d')]===_0xaabd('0x6e')){_0x13d04f[_0x18ae67]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4c9914[_0xaabd('0x69')]+'%',null);}else{_0x583e07=_[_0xaabd('0x67')](_0x587a05,[_0xaabd('0x2f'),_0xaabd('0x3d')]);_0x4c9914[_0xaabd('0x50')]='UserId';_0x3d19d1=as[_0xaabd('0x73')](_0x293e02,_0x583e07[_0xaabd('0x42')],_0x4c9914);_0x13d04f[_0x18ae67](_0x3d19d1['text'],_0x3d19d1[_0xaabd('0x69')][_0xaabd('0x74')],_0x3d19d1[_0xaabd('0x69')][_0xaabd('0x21')]);}break;case _0xaabd('0x79'):_0x3d19d1=as[_0xaabd('0x73')]('me',null,_0x4c9914);_0x13d04f[_0x18ae67](_0x3d19d1[_0xaabd('0x7a')],_0x3d19d1[_0xaabd('0x69')][_0xaabd('0x74')],_0x3d19d1['value'][_0xaabd('0x21')]);break;}}else{var _0x3d19d1=as[_0xaabd('0x73')](_0x293e02,_0x583e07[_0xaabd('0x42')],_0x4c9914);_0x13d04f[_0x18ae67](_0x3d19d1[_0xaabd('0x7a')],_0x3d19d1[_0xaabd('0x69')][_0xaabd('0x74')],_0x3d19d1[_0xaabd('0x69')][_0xaabd('0x21')]);}}}else{var _0x4d2338=_(_0x2b952c[_0xaabd('0x45')])[_0xaabd('0x7b')]()[_0xaabd('0x31')](function(_0x50c8c7){return _['some'](_0x587a05,[_0xaabd('0x2f'),_0x50c8c7])?_0x50c8c7:undefined;})[_0xaabd('0x7c')]()[_0xaabd('0x69')]();if(!_[_0xaabd('0x7d')](_0x4d2338)){_0x4d2338[_0xaabd('0x34')](function(_0x3226eb){if(_0x3226eb===_0xaabd('0x7e')){_0x459d99['where'](_0xaabd('0x7f'),[]['concat'](_0x2b952c[_0xaabd('0x45')][_0x3226eb]));}else if(_0x3226eb===_0xaabd('0x80')){var _0x4ff57b=JSON[_0xaabd('0x81')](_0x2b952c['query'][_0x3226eb])['$gte'];var _0x598dd4=JSON['parse'](_0x2b952c[_0xaabd('0x45')][_0x3226eb])[_0xaabd('0x82')];_0x459d99[_0xaabd('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4ff57b,_0x598dd4);}else{if(_0x2b952c[_0xaabd('0x45')][_0x3226eb]==='null'){_0x459d99['where']('i.'+_0x3226eb+_0xaabd('0x83'));}else{_0x459d99[_0xaabd('0x4d')]('i.'+_0x3226eb+_0xaabd('0x84'),_0x2b952c[_0xaabd('0x45')][_0x3226eb]);}}});}if(_0x2b952c[_0xaabd('0x45')][_0xaabd('0x85')]){if(_0x2b952c[_0xaabd('0x45')][_0xaabd('0x85')]==0x1){_0x459d99[_0xaabd('0x6b')](_0xaabd('0x86'));}else{_0x459d99['having']('`unreadMessages`\x20>\x200');}}if(_0x2b952c[_0xaabd('0x45')]['tag']){_0x3f1e0b=_[_0xaabd('0x87')](_0x2b952c[_0xaabd('0x45')][_0xaabd('0x88')])?_0x2b952c[_0xaabd('0x45')]['tag']:new Array(_0x2b952c[_0xaabd('0x45')]['tag']);_0x3f1e0b['forEach'](function(_0x34f950){_0x40aae1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x34f950+',%');});}if(_0x2b952c[_0xaabd('0x45')][_0xaabd('0x89')]){var _0x328985=_0x2b952c['query'][_0xaabd('0x89')]['replace']('\x5c','\x5c\x5c')[_0xaabd('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x328985)){_0x13d04f['or'](_0xaabd('0x8b'),_0x328985+'%')['or'](_0xaabd('0x8c'),_0x328985+'%');}else{_0x13d04f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xaabd('0x70')](_0x328985))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x328985+'%');}}}_0x459d99['where'](_0x13d04f);_0x459d99[_0xaabd('0x8d')](_0xaabd('0x8e'));var _0x402ef7={'type':db[_0xaabd('0x8f')][_0xaabd('0x90')][_0xaabd('0x91')],'raw':!![]};var _0x59bea0=_0x459d99[_0xaabd('0x92')]();_0x59bea0[_0xaabd('0x50')](_0xaabd('0x8e'));_0x59bea0[_0xaabd('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xaabd('0x68'));if(_0xa1bac[_0xaabd('0x93')]){_0xa1bac[_0xaabd('0x93')][_0xaabd('0x34')](function(_0x24db98){var _0x4c7c9f=_0x24db98[0x0]===_0xaabd('0x94')?_0x24db98[0x0]:'i.'+_0x24db98[0x0];_0x459d99[_0xaabd('0x93')](_0x4c7c9f,_0x24db98[0x1]==='DESC'?![]:!![]);});}if(!_[_0xaabd('0x7d')](_0x3f1e0b)){_0x459d99['having'](_0x40aae1);_0x59bea0[_0xaabd('0x4d')](_0xaabd('0x95'),_0x3f1e0b);}BPromise[_0xaabd('0x96')]()[_0xaabd('0x2b')](function(){if(!_0x5a76d1){if(_0x2b952c[_0xaabd('0x45')][_0xaabd('0x7e')])return;_0x59bea0[_0xaabd('0x4d')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x459d99[_0xaabd('0x4d')](_0xaabd('0x97'));return;}if(_0x2b952c['user'][_0xaabd('0x98')]!==_0xaabd('0x99'))return;return _0x2b952c[_0xaabd('0x9a')][_0xaabd('0x9b')]({'attributes':['id'],'raw':!![]})[_0xaabd('0x2b')](function(_0x5a90e6){if(_[_0xaabd('0x7d')](_0x5a90e6)){_0x59bea0[_0xaabd('0x4d')](_0xaabd('0x9c'));_0x459d99['where'](_0xaabd('0x9c'));}else{_0x59bea0[_0xaabd('0x4d')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x5a90e6,'id'));_0x459d99[_0xaabd('0x4d')](_0xaabd('0x7f'),_['map'](_0x5a90e6,'id'));}});})[_0xaabd('0x2b')](function(){if(_0x2b952c[_0xaabd('0x9a')][_0xaabd('0x98')]===_0xaabd('0x99')&&!_0x5a76d1&&!_0x2b952c[_0xaabd('0x45')][_0xaabd('0x7e')])return[];return db[_0xaabd('0x9d')]['query'](_0x59bea0[_0xaabd('0x9e')](),_0x402ef7);})['then'](function(_0x24ca2d){_0x1a3c4e[_0xaabd('0x26')]=_0x24ca2d[_0xaabd('0x49')];if(_0x1a3c4e[_0xaabd('0x26')]===0x0)return[];return db[_0xaabd('0x9d')][_0xaabd('0x45')](_0x1bc17b['toString'](),_0x402ef7)[_0xaabd('0x2b')](function(_0x46063e){_0x1975ab=_[_0xaabd('0x9f')](_0x46063e,'id');_0x402ef7=_['merge'](_0x402ef7,{'model':db[_0xaabd('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b952c[_0xaabd('0x45')]['fields']){_0xa1bac[_0xaabd('0x47')][_0xaabd('0x34')](function(_0x566b96){_0x459d99[_0xaabd('0x50')]('i.'+_0x566b96);});}else{_0x459d99['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xaabd('0x68'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xa0'),_0xaabd('0xa1'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xa2'),_0xaabd('0xa3'));_0x459d99['field'](_0xaabd('0xa4'),_0xaabd('0x94'));_0x459d99[_0xaabd('0x50')]('i.*');_0x459d99[_0xaabd('0x50')](_0xaabd('0xa5'),_0xaabd('0xa6'));_0x459d99[_0xaabd('0x50')]('c.lastName',_0xaabd('0xa7'));_0x459d99[_0xaabd('0x50')]('c.email',_0xaabd('0xa8'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xa9'),_0xaabd('0xaa'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xab'),_0xaabd('0xac'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xad'),_0xaabd('0xae'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xaf'),_0xaabd('0xb0'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xb1'),_0xaabd('0xb2'));_0x459d99[_0xaabd('0x50')](_0xaabd('0xb3'),_0xaabd('0x32'));}if(_0xa1bac['limit'])_0x459d99[_0xaabd('0x25')](_0xa1bac[_0xaabd('0x25')]);if(_0xa1bac[_0xaabd('0x23')])_0x459d99[_0xaabd('0x23')](_0xa1bac['offset']);return db[_0xaabd('0x9d')][_0xaabd('0x45')](_0x459d99[_0xaabd('0x9e')](),_0x402ef7);})[_0xaabd('0x2b')](function(_0x35d9e9){if(_0x35d9e9[_0xaabd('0x49')]>0x0)_0x3f9741[_0xaabd('0x4d')](_0xaabd('0xb4'),_[_0xaabd('0x31')](_0x35d9e9,'id'));return db[_0xaabd('0x9d')]['query'](_0x3f9741[_0xaabd('0x9e')](),_0x402ef7)[_0xaabd('0x2b')](function(_0x3b7d81){var _0x423890=_[_0xaabd('0xb5')](_0x3b7d81,'SmsInteractionId');var _0x259787=[];_0x35d9e9[_0xaabd('0x34')](function(_0x46086f){_0x259787[_0xaabd('0x36')](updateSmsInteraction(_0x46086f,_0x1975ab,_0x423890));});return BPromise['all'](_0x259787);});});})[_0xaabd('0x2b')](function(_0x1e02b3){_0x1a3c4e['rows']=_0x1e02b3;return _0x1a3c4e;})[_0xaabd('0x2b')](respondWithFilteredResult(_0x4367d3,_0xa1bac))[_0xaabd('0x37')](handleError(_0x4367d3,null));};exports['show']=function(_0x15960e,_0x42a60b){var _0x65aaa9={'raw':![],'where':{'id':_0x15960e[_0xaabd('0xb6')]['id']}},_0x42e71d={};_0x42e71d[_0xaabd('0x44')]=_['keys'](db[_0xaabd('0x3f')][_0xaabd('0x40')]);_0x42e71d['query']=_[_0xaabd('0x7b')](_0x15960e['query']);_0x42e71d[_0xaabd('0x4e')]=_[_0xaabd('0x46')](_0x42e71d[_0xaabd('0x44')],_0x42e71d[_0xaabd('0x45')]);_0x65aaa9[_0xaabd('0x47')]=_[_0xaabd('0x46')](_0x42e71d[_0xaabd('0x44')],qs['fields'](_0x15960e[_0xaabd('0x45')]['fields']));_0x65aaa9[_0xaabd('0x47')]=_0x65aaa9[_0xaabd('0x47')][_0xaabd('0x49')]?_0x65aaa9['attributes']:_0x42e71d[_0xaabd('0x44')];if(_0x15960e[_0xaabd('0x45')][_0xaabd('0xb7')]){_0x65aaa9[_0xaabd('0xb8')]=[{'all':!![]}];}_0x65aaa9=_[_0xaabd('0xb9')]({},_0x65aaa9,_0x15960e[_0xaabd('0xba')]);return db[_0xaabd('0x3f')][_0xaabd('0x67')](_0x65aaa9)[_0xaabd('0x2b')](handleEntityNotFound(_0x42a60b,null))[_0xaabd('0x2b')](respondWithResult(_0x42a60b,null))[_0xaabd('0x37')](handleError(_0x42a60b,null));};exports[_0xaabd('0xbb')]=function(_0x2b0f17,_0x182790){return db[_0xaabd('0x3f')]['create'](_0x2b0f17[_0xaabd('0x79')],{})[_0xaabd('0x2b')](respondWithResult(_0x182790,0xc9))['catch'](handleError(_0x182790,null));};exports[_0xaabd('0x2a')]=function(_0x161c1d,_0x235f08){if(_0x161c1d['body']['id']){delete _0x161c1d[_0xaabd('0x79')]['id'];}return db[_0xaabd('0x3f')][_0xaabd('0x67')]({'where':{'id':_0x161c1d[_0xaabd('0xb6')]['id']}})[_0xaabd('0x2b')](handleEntityNotFound(_0x235f08,null))['then'](saveUpdates(_0x161c1d[_0xaabd('0x79')],null))[_0xaabd('0x2b')](respondWithResult(_0x235f08,null))[_0xaabd('0x37')](handleError(_0x235f08,null));};exports['destroy']=function(_0x29d36f,_0x2b11d7){return db['SmsInteraction'][_0xaabd('0x67')]({'where':{'id':_0x29d36f[_0xaabd('0xb6')]['id']}})[_0xaabd('0x2b')](handleEntityNotFound(_0x2b11d7,null))['then'](removeEntity(_0x2b11d7,null))[_0xaabd('0x37')](handleError(_0x2b11d7,null));};exports[_0xaabd('0xbc')]=function(_0x3e7d52,_0x14f4e2){return db['SmsInteraction'][_0xaabd('0xbc')]()[_0xaabd('0x2b')](respondWithResult(_0x14f4e2,null))['catch'](handleError(_0x14f4e2,null));};exports['addMessage']=function(_0x11db07,_0x13dd15,_0x5d37a0){return db['SmsMessage'][_0xaabd('0x67')]({'where':{'id':_0x11db07[_0xaabd('0xb6')]['id']}})[_0xaabd('0x2b')](handleEntityNotFound(_0x13dd15,null))[_0xaabd('0x2b')](function(_0xf2af80){if(_0xf2af80){return _0xf2af80['addMessage'](_0x11db07[_0xaabd('0x79')]['ids'],_['omit'](_0x11db07['body'],[_0xaabd('0xbd'),'id'])||{});}})[_0xaabd('0x2b')](respondWithResult(_0x13dd15,null))[_0xaabd('0x37')](handleError(_0x13dd15,null));};exports[_0xaabd('0xbe')]=function(_0x2000f3,_0x4441b5,_0x28dac8){var _0x23fab2={'raw':![],'where':{}};var _0x1188ea={};var _0x2b21f7={'count':0x0,'rows':[]};return db[_0xaabd('0x3f')][_0xaabd('0xbf')]({'where':{'id':_0x2000f3[_0xaabd('0xb6')]['id']}})[_0xaabd('0x2b')](handleEntityNotFound(_0x4441b5,null))[_0xaabd('0x2b')](function(_0xcee02e){if(_0xcee02e){_0x1188ea[_0xaabd('0x44')]=_[_0xaabd('0x7b')](db['SmsMessage'][_0xaabd('0x40')]);_0x1188ea['query']=_[_0xaabd('0x7b')](_0x2000f3[_0xaabd('0x45')]);_0x1188ea[_0xaabd('0x4e')]=_['intersection'](_0x1188ea[_0xaabd('0x44')],_0x1188ea[_0xaabd('0x45')]);_0x23fab2[_0xaabd('0x47')]=_[_0xaabd('0x46')](_0x1188ea[_0xaabd('0x44')],qs[_0xaabd('0x48')](_0x2000f3[_0xaabd('0x45')][_0xaabd('0x48')]));_0x23fab2[_0xaabd('0x47')]=_0x23fab2[_0xaabd('0x47')]['length']?_0x23fab2[_0xaabd('0x47')]:_0x1188ea[_0xaabd('0x44')];if(!_0x2000f3['query'][_0xaabd('0x4a')](_0xaabd('0x4b'))){_0x23fab2['limit']=qs[_0xaabd('0x25')](_0x2000f3[_0xaabd('0x45')][_0xaabd('0x25')]);_0x23fab2[_0xaabd('0x23')]=qs[_0xaabd('0x23')](_0x2000f3[_0xaabd('0x45')][_0xaabd('0x23')]);}_0x23fab2[_0xaabd('0x93')]=qs[_0xaabd('0x4c')](_0x2000f3[_0xaabd('0x45')]['sort']);_0x23fab2[_0xaabd('0x4d')]=qs[_0xaabd('0x4e')](_['pick'](_0x2000f3[_0xaabd('0x45')],_0x1188ea[_0xaabd('0x4e')]));_0x23fab2[_0xaabd('0x4d')][_0xaabd('0xc0')]=_0xcee02e['id'];if(_0x2000f3['query'][_0xaabd('0x89')]){_0x23fab2[_0xaabd('0x4d')]=_[_0xaabd('0xb9')](_0x23fab2['where'],{'$or':_[_0xaabd('0x31')](_0x23fab2['attributes'],function(_0x5aba9d){var _0x333f71={};_0x333f71[_0x5aba9d]={'$like':'%'+_0x2000f3['query']['filter']+'%'};return _0x333f71;})});}if(_0x2000f3[_0xaabd('0x45')][_0xaabd('0xc1')]){var _0x173816=_0x2000f3[_0xaabd('0x45')][_0xaabd('0xc1')][_0xaabd('0x33')](',');var _0x4f01cb={};_0x4f01cb[_0x173816[0x0]]={'$gte':moment(_0x173816[0x1])[_0xaabd('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23fab2[_0xaabd('0x4d')]=_[_0xaabd('0xb9')](_0x23fab2['where'],_0x4f01cb);}_0x23fab2=_[_0xaabd('0xb9')]({},_0x23fab2,_0x2000f3[_0xaabd('0xba')]);return db[_0xaabd('0xc3')]['count']({'where':_0x23fab2[_0xaabd('0x4d')]})[_0xaabd('0x2b')](function(_0x4f075f){_0x2b21f7[_0xaabd('0x26')]=_0x4f075f;if(_0x2000f3[_0xaabd('0x45')][_0xaabd('0xb7')]){_0x23fab2['include']=[{'all':!![]}];}return db[_0xaabd('0xc3')][_0xaabd('0xc4')](_0x23fab2);})[_0xaabd('0x2b')](function(_0x11b03c){_0x2b21f7[_0xaabd('0xc5')]=_0x11b03c;return _0x2b21f7;});}})[_0xaabd('0x2b')](respondWithFilteredResult(_0x4441b5,_0x23fab2))['catch'](handleError(_0x4441b5,null));};exports[_0xaabd('0xc6')]=function(_0x51ce47,_0x2c47e8,_0x103780){return db['SmsInteraction'][_0xaabd('0x67')]({'where':{'id':_0x51ce47[_0xaabd('0xb6')]['id']}})['then'](handleEntityNotFound(_0x2c47e8,null))['then'](function(_0xcb1ef){if(_0xcb1ef){return _0xcb1ef[_0xaabd('0xc7')](_0x51ce47[_0xaabd('0x79')][_0xaabd('0xbd')],_[_0xaabd('0xc8')](_0x51ce47['body'],[_0xaabd('0xbd'),'id'])||{})[_0xaabd('0xc9')](function(){return db[_0xaabd('0x75')]['findAll']({'attributes':['id','name',_0xaabd('0x51')],'where':{'id':_0x51ce47[_0xaabd('0x79')]['ids']}});})[_0xaabd('0x2b')](function(_0x4c07a4){socket[_0xaabd('0xca')](_0xaabd('0xcb'),{'id':Number(_0x51ce47[_0xaabd('0xb6')]['id']),'tags':_0x4c07a4||[]});return{'id':Number(_0x51ce47[_0xaabd('0xb6')]['id']),'tags':_0x4c07a4||[]};});}})[_0xaabd('0x2b')](respondWithResult(_0x2c47e8,null))[_0xaabd('0x37')](handleError(_0x2c47e8,null));};exports[_0xaabd('0xcc')]=function(_0x36574f,_0x5cbbf6,_0x37fc6b){return db[_0xaabd('0x3f')]['find']({'where':{'id':_0x36574f[_0xaabd('0xb6')]['id']}})[_0xaabd('0x2b')](handleEntityNotFound(_0x5cbbf6,null))['then'](function(_0x2c0b2d){if(_0x2c0b2d){return _0x2c0b2d['removeTags'](_0x36574f[_0xaabd('0x45')][_0xaabd('0xbd')]);}})[_0xaabd('0x2b')](respondWithStatusCode(_0x5cbbf6,null))[_0xaabd('0x37')](handleError(_0x5cbbf6,null));};exports[_0xaabd('0xcd')]=function(_0x3af96e,_0x48f565){var _0x1c6f86=moment()['unix']()[_0xaabd('0x9e')]();var _0x63203a=path['join'](config[_0xaabd('0xce')],'server',_0xaabd('0xcf'),_0xaabd('0xd0'));var _0x3671d3=path[_0xaabd('0xd1')](config['root'],'server',_0xaabd('0xcf'),'attachments');var _0x54e6f5=path['join'](_0x63203a,_0x1c6f86);var _0x22e01a=util[_0xaabd('0xc2')](_0xaabd('0xd2'),_0x3af96e[_0xaabd('0xb6')]['id'],_0x1c6f86);var _0x3b061c=path[_0xaabd('0xd1')](_0x63203a,_0x22e01a);var _0x332538=[];_0x332538[_0xaabd('0x36')]({'model':db[_0xaabd('0x78')],'as':_0xaabd('0x78'),'attributes':['id','fullname'],'raw':!![]});_0x332538['push']({'model':db['CmContact'],'as':_0xaabd('0xd3'),'attributes':['id','firstName',_0xaabd('0xd4')],'raw':!![]});var _0x52bf9e=[{'model':db[_0xaabd('0xc3')],'as':_0xaabd('0xd5'),'attributes':['id','body',_0xaabd('0x80'),'direction',_0xaabd('0xd6'),_0xaabd('0x85')],'include':_0x332538}];_0x52bf9e[_0xaabd('0x36')]({'model':db[_0xaabd('0xd7')],'as':_0xaabd('0xd8'),'attributes':['id',_0xaabd('0x2f')]});_0x52bf9e[_0xaabd('0x36')]({'model':db[_0xaabd('0x78')],'as':_0xaabd('0xd9'),'attributes':['id',_0xaabd('0xda')]});return db['SmsInteraction'][_0xaabd('0x67')]({'where':{'id':_0x3af96e['params']['id']},'include':_0x52bf9e})[_0xaabd('0x2b')](handleEntityNotFound(_0x48f565,null))[_0xaabd('0x2b')](function(_0x4e4c67){if(_0x4e4c67){var _0x21aab1=_0x4e4c67[_0xaabd('0xdb')]({'plain':!![]});fs[_0xaabd('0xdc')](_0x54e6f5);var _0x3ce2b5={'channel':_0xaabd('0xdd'),'account':_0x21aab1[_0xaabd('0xd8')][_0xaabd('0x2f')],'agent':_0x21aab1[_0xaabd('0xd9')]?_0x21aab1[_0xaabd('0xd9')][_0xaabd('0xda')]:_0xaabd('0xde'),'createdAt':moment(_0x21aab1[_0xaabd('0x80')])[_0xaabd('0xc2')](_0xaabd('0xdf'))[_0xaabd('0x9e')](),'closedAt':_0x21aab1[_0xaabd('0x3c')]?moment(_0x21aab1[_0xaabd('0xe0')])[_0xaabd('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x21aab1[_0xaabd('0xe1')],'messages':_(_0x21aab1[_0xaabd('0xd5')])[_0xaabd('0x89')]({'secret':![]})['map'](function(_0x543e52){return{'date':moment(_0x543e52[_0xaabd('0x80')])[_0xaabd('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xaabd('0x9e')](),'sender':_0x543e52[_0xaabd('0xe2')]===_0xaabd('0xe3')?_0x543e52[_0xaabd('0x78')]?_0x543e52[_0xaabd('0x78')]['fullname']:_0xaabd('0xe4'):_0x543e52[_0xaabd('0xd3')][_0xaabd('0xe5')]+(_0x543e52['Contact'][_0xaabd('0xd4')]?'\x20'+_0x543e52[_0xaabd('0xd3')]['lastName']:''),'body':_0x543e52[_0xaabd('0x79')],'direction':_0x543e52[_0xaabd('0xe2')]===_0xaabd('0xe3')?'A':'C','secret':_0x543e52[_0xaabd('0xd6')],'read':_0x543e52[_0xaabd('0x85')]};})[_0xaabd('0x69')]()};return ejs[_0xaabd('0xe6')](path['join'](config[_0xaabd('0xce')],_0xaabd('0xe7'),_0xaabd('0xe8'),_0xaabd('0xe9')),{'interaction':_0x3ce2b5})[_0xaabd('0x2b')](function(_0xbee240){var _0x517c34=path[_0xaabd('0xd1')](_0x54e6f5,_0xaabd('0xea')+_0x21aab1['id']+'-'+_0x1c6f86+_0xaabd('0xeb'));var _0x4d0462={'path':_0x517c34,'channel':_0xaabd('0xdd'),'interactionId':_0x21aab1['id']};return pdf[_0xaabd('0xec')](_0xbee240,_0x4d0462);})['then'](function(){return new BPromise(function(_0xf62ab7,_0x38d7bd){zipdir(_0x54e6f5,{'saveTo':_0x3b061c},function(_0x38793a,_0x3a97ff){if(_0x38793a)return _0x38d7bd(_0x38793a);return _0xf62ab7(_0x3a97ff);});})['then'](function(){return new BPromise(function(_0x37e73e,_0x45dabd){rimraf(_0x54e6f5,function(_0x8c6666){if(_0x8c6666)_0x45dabd(_0x8c6666);return _0x37e73e();});});})[_0xaabd('0x2b')](function(){return _0x48f565[_0xaabd('0xcd')](_0x3b061c,_0x22e01a,function(_0x39c927){if(_0x39c927){console[_0xaabd('0xed')]('err',_0x39c927);}else{fs[_0xaabd('0xee')](_0x3b061c);}});});});}else{return _0x48f565[_0xaabd('0x1f')](0xc8);}})[_0xaabd('0x37')](handleError(_0x48f565,null));}; \ No newline at end of file +var _0xfda9=['all','rows','catch','show','params','include','options','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','$gte','format','includeAll','findAll','setTags','Tag','smsInteractionTags:save','removeTags','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Messages','createdAt','direction','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','System','out','secret','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsInteraction.socket','register','status','json','offset','limit','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','waiting','answered','total','closed','UserId','talking','index','SmsInteraction','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','u.id','u.fullname','ui.SmsInteractionId','left_join','users','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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.lastName','c.email','Contact.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId'];(function(_0x2d9639,_0xa1568f){var _0x26ca5d=function(_0x1ae04b){while(--_0x1ae04b){_0x2d9639['push'](_0x2d9639['shift']());}};_0x26ca5d(++_0xa1568f);}(_0xfda9,0x12b));var _0x9fda=function(_0x461413,_0xd2dd3b){_0x461413=_0x461413-0x0;var _0xc54a55=_0xfda9[_0x461413];return _0xc54a55;};'use strict';var emlformat=require(_0x9fda('0x0'));var rimraf=require(_0x9fda('0x1'));var zipdir=require(_0x9fda('0x2'));var jsonpatch=require(_0x9fda('0x3'));var rp=require(_0x9fda('0x4'));var moment=require(_0x9fda('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9fda('0x6'));var util=require(_0x9fda('0x7'));var path=require(_0x9fda('0x8'));var sox=require(_0x9fda('0x9'));var csv=require('to-csv');var ejs=require(_0x9fda('0xa'));var fs=require('fs');var fs_extra=require(_0x9fda('0xb'));var _=require(_0x9fda('0xc'));var squel=require(_0x9fda('0xd'));var crypto=require(_0x9fda('0xe'));var jsforce=require(_0x9fda('0xf'));var deskjs=require(_0x9fda('0x10'));var toCsv=require(_0x9fda('0x11'));var querystring=require(_0x9fda('0x12'));var Papa=require(_0x9fda('0x13'));var Redis=require(_0x9fda('0x14'));var authService=require(_0x9fda('0x15'));var qs=require(_0x9fda('0x16'));var as=require(_0x9fda('0x17'));var pdf=require(_0x9fda('0x18'));var hardwareService=require(_0x9fda('0x19'));var logger=require(_0x9fda('0x1a'))('api');var utils=require(_0x9fda('0x1b'));var config=require(_0x9fda('0x1c'));var licenseUtil=require(_0x9fda('0x1d'));var db=require(_0x9fda('0x1e'))['db'];config[_0x9fda('0x1f')]=_[_0x9fda('0x20')](config[_0x9fda('0x1f')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9fda('0x1f')]));require(_0x9fda('0x21'))[_0x9fda('0x22')](socket);function respondWithStatusCode(_0x37d94c,_0x5ed10f){_0x5ed10f=_0x5ed10f||0xcc;return function(_0x1dc4cd){if(_0x1dc4cd){return _0x37d94c['sendStatus'](_0x5ed10f);}return _0x37d94c['status'](_0x5ed10f)['end']();};}function respondWithResult(_0x2658f7,_0x52e77f){_0x52e77f=_0x52e77f||0xc8;return function(_0xbb7d84){if(_0xbb7d84){return _0x2658f7[_0x9fda('0x23')](_0x52e77f)[_0x9fda('0x24')](_0xbb7d84);}};}function respondWithFilteredResult(_0x536396,_0x5cd16b){return function(_0x5401ad){if(_0x5401ad){var _0x2534ec=typeof _0x5cd16b[_0x9fda('0x25')]==='undefined'&&typeof _0x5cd16b[_0x9fda('0x26')]==='undefined';var _0x5442f4=_0x5401ad['count'];var _0x2c114e=_0x2534ec?0x0:_0x5cd16b[_0x9fda('0x25')];var _0x5fa907=_0x2534ec?_0x5401ad['count']:_0x5cd16b[_0x9fda('0x25')]+_0x5cd16b[_0x9fda('0x26')];var _0x400d29;if(_0x5fa907>=_0x5442f4){_0x5fa907=_0x5442f4;_0x400d29=0xc8;}else{_0x400d29=0xce;}_0x536396[_0x9fda('0x23')](_0x400d29);return _0x536396[_0x9fda('0x27')](_0x9fda('0x28'),_0x2c114e+'-'+_0x5fa907+'/'+_0x5442f4)['json'](_0x5401ad);}return null;};}function patchUpdates(_0x18b6c4){return function(_0x178334){try{jsonpatch[_0x9fda('0x29')](_0x178334,_0x18b6c4,!![]);}catch(_0x35312f){return BPromise[_0x9fda('0x2a')](_0x35312f);}return _0x178334['save']();};}function saveUpdates(_0x2cfa6e,_0x2c9c0a){return function(_0x4ec5fb){if(_0x4ec5fb){return _0x4ec5fb[_0x9fda('0x2b')](_0x2cfa6e)[_0x9fda('0x2c')](function(_0x243837){return _0x243837;});}return null;};}function removeEntity(_0x37a422,_0x3ef7a5){return function(_0x11e29c){if(_0x11e29c){return _0x11e29c['destroy']()[_0x9fda('0x2c')](function(){_0x37a422['status'](0xcc)[_0x9fda('0x2d')]();});}};}function handleEntityNotFound(_0x28b06b,_0x5cce74){return function(_0x361695){if(!_0x361695){_0x28b06b[_0x9fda('0x2e')](0x194);}return _0x361695;};}function handleError(_0x59fe64,_0x32471d){_0x32471d=_0x32471d||0x1f4;return function(_0x1df294){logger[_0x9fda('0x2f')](_0x1df294[_0x9fda('0x30')]);if(_0x1df294[_0x9fda('0x31')]){delete _0x1df294['name'];}_0x59fe64[_0x9fda('0x23')](_0x32471d)[_0x9fda('0x32')](_0x1df294);};}function getInteractionUsers(_0x213e0b,_0x205921){return new BPromise(function(_0x57467e,_0x11529a){try{if(_0x205921[_0x213e0b['id']]){_0x213e0b[_0x9fda('0x33')]=_[_0x9fda('0x34')](_0x205921[_0x213e0b['id']],function(_0xc9e83){return{'id':_0xc9e83['id'],'fullname':_0xc9e83['fullname']};});}}catch(_0x4b6708){_0x11529a(_0x4b6708);}_0x57467e(_0x213e0b);});}function getInteractionTags(_0x4cfd98,_0x16800e){return new BPromise(function(_0x185778,_0x2230b4){try{if(_0x4cfd98[_0x9fda('0x35')]){_0x4cfd98['Tags']=[];_0x4cfd98['TagIds'][_0x9fda('0x36')](',')[_0x9fda('0x37')](function(_0x4b4026){_0x4cfd98[_0x9fda('0x38')][_0x9fda('0x39')](_0x16800e[_0x4b4026]);});}delete _0x4cfd98['TagIds'];}catch(_0x2bed0d){_0x2230b4(_0x2bed0d);}_0x185778(_0x4cfd98);});}function updateSmsInteraction(_0x2b16cd,_0x3db6df,_0x203440){return new BPromise(function(_0x47f0fa,_0x199d92){return getInteractionUsers(_0x2b16cd,_0x203440)[_0x9fda('0x2c')](function(_0x20a2e1){return getInteractionTags(_0x20a2e1,_0x3db6df);})['then'](function(_0x355e2f){return getStateInteraction(_0x355e2f);})[_0x9fda('0x2c')](function(_0x17f73e){_0x47f0fa(_0x17f73e);})['catch'](function(_0x372704){_0x199d92(_0x372704);});});}function getStateInteraction(_0x1ec817){return new BPromise(function(_0x1aa4e4){_0x1ec817[_0x9fda('0x3a')]=0x0;_0x1ec817['talking']=0x0;_0x1ec817[_0x9fda('0x3b')]=0x0;_0x1ec817['unmanaged']=0x0;_0x1ec817[_0x9fda('0x3c')]=0x0;if(!_0x1ec817[_0x9fda('0x3d')]&&!_0x1ec817[_0x9fda('0x3e')]){_0x1ec817[_0x9fda('0x3a')]+=0x1;}if(!_0x1ec817[_0x9fda('0x3d')]&&_0x1ec817[_0x9fda('0x3e')]){_0x1ec817['talking']+=0x1;if(_0x1ec817['waiting']){_0x1ec817[_0x9fda('0x3a')]-=0x1;}}if(_0x1ec817[_0x9fda('0x3d')]&&_0x1ec817[_0x9fda('0x3e')]){_0x1ec817['answered']+=0x1;if(_0x1ec817['talking']){_0x1ec817[_0x9fda('0x3f')]-=0x1;}}if(_0x1ec817[_0x9fda('0x3d')]&&!_0x1ec817['UserId']){_0x1ec817['unmanaged']+=0x1;if(_0x1ec817[_0x9fda('0x3a')]){_0x1ec817[_0x9fda('0x3a')]-=0x1;}}_0x1ec817[_0x9fda('0x3c')]+=0x1;_0x1aa4e4(_0x1ec817);});}exports[_0x9fda('0x40')]=function(_0x51c22a,_0x5550af){var _0x4e65f5={},_0x5a13c3={},_0x4841f3={'count':0x0,'rows':[]};var _0x495488=_[_0x9fda('0x34')](db[_0x9fda('0x41')][_0x9fda('0x42')],function(_0x210fac){return{'name':_0x210fac['fieldName'],'type':_0x210fac[_0x9fda('0x43')][_0x9fda('0x44')]};});_0x5a13c3[_0x9fda('0x45')]=_[_0x9fda('0x34')](_0x495488,'name');_0x5a13c3['query']=_[_0x9fda('0x46')](_0x51c22a[_0x9fda('0x47')]);_0x5a13c3['filters']=_[_0x9fda('0x48')](_0x5a13c3[_0x9fda('0x45')],_0x5a13c3[_0x9fda('0x47')]);_0x4e65f5[_0x9fda('0x49')]=_[_0x9fda('0x48')](_0x5a13c3['model'],qs['fields'](_0x51c22a[_0x9fda('0x47')][_0x9fda('0x4a')]));_0x4e65f5['attributes']=_0x4e65f5[_0x9fda('0x49')]['length']?_0x4e65f5[_0x9fda('0x49')]:_0x5a13c3['model'];if(!_0x51c22a[_0x9fda('0x47')][_0x9fda('0x4b')](_0x9fda('0x4c'))){_0x4e65f5[_0x9fda('0x26')]=qs['limit'](_0x51c22a[_0x9fda('0x47')]['limit']);_0x4e65f5[_0x9fda('0x25')]=qs[_0x9fda('0x25')](_0x51c22a[_0x9fda('0x47')][_0x9fda('0x25')]);}_0x4e65f5[_0x9fda('0x4d')]=qs[_0x9fda('0x4e')](_0x51c22a[_0x9fda('0x47')][_0x9fda('0x4e')]);_0x4e65f5[_0x9fda('0x4f')]=qs['filters'](_[_0x9fda('0x50')](_0x51c22a[_0x9fda('0x47')],_0x5a13c3['filters']),_0x495488);var _0x55f3b5=[];var _0x3f41de=squel['select']()[_0x9fda('0x51')]('id')[_0x9fda('0x51')](_0x9fda('0x31'))[_0x9fda('0x51')](_0x9fda('0x52'))[_0x9fda('0x53')]('tools_tags');var _0x2f5cf5=squel['select']()[_0x9fda('0x51')](_0x9fda('0x54'))[_0x9fda('0x51')](_0x9fda('0x55'))['field'](_0x9fda('0x56'))['from']('user_has_sms_interactions','ui')[_0x9fda('0x57')](_0x9fda('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x597565=squel[_0x9fda('0x59')]()[_0x9fda('0x53')](_0x9fda('0x5a'),'i')[_0x9fda('0x57')](_0x9fda('0x5b'),'c',_0x9fda('0x5c'))[_0x9fda('0x57')](_0x9fda('0x58'),'o',_0x9fda('0x5d'))[_0x9fda('0x57')](_0x9fda('0x5e'),'a',_0x9fda('0x5f'))[_0x9fda('0x57')]('sms_messages','me',_0x9fda('0x60'))[_0x9fda('0x57')](_0x9fda('0x61'),'it',_0x9fda('0x62'))[_0x9fda('0x57')](_0x9fda('0x63'),'t',_0x9fda('0x64'));var _0x524b2b=squel[_0x9fda('0x65')]();var _0x2e316c=[];var _0x56de00=squel[_0x9fda('0x65')]();var _0x5efbab;if(_0x51c22a['query'][_0x9fda('0x66')]){_0x5efbab=as[_0x9fda('0x67')](_0x51c22a[_0x9fda('0x47')][_0x9fda('0x66')]);var _0x55ae11=_0x5efbab[_0x9fda('0x68')];for(var _0xdd6351=0x0;_0xdd6351<_0x5efbab[_0x9fda('0x69')]['length'];_0xdd6351++){var _0x4eaf14=_0x5efbab[_0x9fda('0x69')][_0xdd6351];var _0x4bf8ac='i';var _0x1e4ef8=_[_0x9fda('0x6a')](_0x495488,[_0x9fda('0x31'),_0x4eaf14[_0x9fda('0x51')]]);if(!_0x1e4ef8){switch(_0x4eaf14[_0x9fda('0x51')]){case _0x9fda('0x6b'):if(_0x4eaf14['value']==0x1){_0x597565['having']('`'+_0x4eaf14['field']+_0x9fda('0x6c'));}else{_0x597565[_0x9fda('0x6d')]('`'+_0x4eaf14[_0x9fda('0x51')]+'`\x20>\x200');}break;case _0x9fda('0x6e'):if(_0x4eaf14['operator']==='$substring'){if(_0x4eaf14['value'][_0x9fda('0x36')]('\x20')[_0x9fda('0x6f')]>0x1){_0x524b2b[_0x55ae11](_0x9fda('0x70'),qs[_0x9fda('0x71')](_0x4eaf14['value']),null);}else{var _0x577d37='%'+_0x4eaf14[_0x9fda('0x72')]+'%';_0x524b2b[_0x55ae11](_0x9fda('0x73'),_0x577d37,_0x577d37,_0x577d37);}}else{_0x1e4ef8=_[_0x9fda('0x6a')](_0x495488,['name',_0x9fda('0x74')]);_0x4eaf14[_0x9fda('0x51')]=_0x9fda('0x74');_0x32e50d=as[_0x9fda('0x75')](_0x4bf8ac,_0x1e4ef8[_0x9fda('0x43')],_0x4eaf14);_0x524b2b[_0x55ae11](_0x32e50d[_0x9fda('0x76')],_0x32e50d['value'][_0x9fda('0x77')],_0x32e50d[_0x9fda('0x72')][_0x9fda('0x2d')]);}break;case'Tag':var _0x207a20=_0x4eaf14[_0x9fda('0x72')][_0x9fda('0x36')](',')[_0x9fda('0x34')](function(_0x1dd63a){return Number(_0x1dd63a);});_0x207a20[_0x9fda('0x37')](function(_0x3feb98){_0x56de00['or'](_0x9fda('0x78'),'%,'+_0x3feb98+',%');});_0x2e316c=_[_0x9fda('0x79')](_0x2e316c,_0x207a20);break;case _0x9fda('0x7a'):if(_0x4eaf14[_0x9fda('0x7b')]==='$substring'){_0x524b2b[_0x55ae11](_0x9fda('0x7c'),'%'+_0x4eaf14[_0x9fda('0x72')]+'%',null);}else{_0x1e4ef8=_[_0x9fda('0x6a')](_0x495488,[_0x9fda('0x31'),_0x9fda('0x3e')]);_0x4eaf14[_0x9fda('0x51')]=_0x9fda('0x3e');_0x32e50d=as[_0x9fda('0x75')](_0x4bf8ac,_0x1e4ef8[_0x9fda('0x43')],_0x4eaf14);_0x524b2b[_0x55ae11](_0x32e50d[_0x9fda('0x76')],_0x32e50d['value'][_0x9fda('0x77')],_0x32e50d[_0x9fda('0x72')][_0x9fda('0x2d')]);}break;case'body':_0x32e50d=as['buildExpression']('me',null,_0x4eaf14);_0x524b2b[_0x55ae11](_0x32e50d[_0x9fda('0x76')],_0x32e50d['value'][_0x9fda('0x77')],_0x32e50d['value'][_0x9fda('0x2d')]);break;}}else{var _0x32e50d=as['buildExpression'](_0x4bf8ac,_0x1e4ef8['type'],_0x4eaf14);_0x524b2b[_0x55ae11](_0x32e50d[_0x9fda('0x76')],_0x32e50d[_0x9fda('0x72')][_0x9fda('0x77')],_0x32e50d['value'][_0x9fda('0x2d')]);}}}else{var _0x4589ba=_(_0x51c22a[_0x9fda('0x47')])[_0x9fda('0x46')]()[_0x9fda('0x34')](function(_0x486b18){return _['some'](_0x495488,[_0x9fda('0x31'),_0x486b18])?_0x486b18:undefined;})[_0x9fda('0x7d')]()[_0x9fda('0x72')]();if(!_['isEmpty'](_0x4589ba)){_0x4589ba[_0x9fda('0x37')](function(_0x41f2c5){if(_0x41f2c5===_0x9fda('0x7e')){_0x597565['where'](_0x9fda('0x7f'),[][_0x9fda('0x80')](_0x51c22a[_0x9fda('0x47')][_0x41f2c5]));}else if(_0x41f2c5==='createdAt'){var _0x2e041f=JSON[_0x9fda('0x81')](_0x51c22a[_0x9fda('0x47')][_0x41f2c5])['$gte'];var _0x437301=JSON[_0x9fda('0x81')](_0x51c22a['query'][_0x41f2c5])[_0x9fda('0x82')];_0x597565[_0x9fda('0x4f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2e041f,_0x437301);}else{if(_0x51c22a['query'][_0x41f2c5]===_0x9fda('0x83')){_0x597565[_0x9fda('0x4f')]('i.'+_0x41f2c5+'\x20IS\x20NULL');}else{_0x597565[_0x9fda('0x4f')]('i.'+_0x41f2c5+'\x20=\x20?',_0x51c22a[_0x9fda('0x47')][_0x41f2c5]);}}});}if(_0x51c22a[_0x9fda('0x47')][_0x9fda('0x84')]){if(_0x51c22a[_0x9fda('0x47')][_0x9fda('0x84')]==0x1){_0x597565[_0x9fda('0x6d')](_0x9fda('0x85'));}else{_0x597565[_0x9fda('0x6d')](_0x9fda('0x86'));}}if(_0x51c22a['query'][_0x9fda('0x87')]){_0x2e316c=_['isArray'](_0x51c22a['query'][_0x9fda('0x87')])?_0x51c22a[_0x9fda('0x47')][_0x9fda('0x87')]:new Array(_0x51c22a[_0x9fda('0x47')][_0x9fda('0x87')]);_0x2e316c['forEach'](function(_0x439928){_0x56de00['or'](_0x9fda('0x78'),'%,'+_0x439928+',%');});}if(_0x51c22a[_0x9fda('0x47')][_0x9fda('0x88')]){var _0x1bb717=_0x51c22a['query'][_0x9fda('0x88')][_0x9fda('0x89')]('\x5c','\x5c\x5c')[_0x9fda('0x89')](/'/g,'\x27\x27');if(qs[_0x9fda('0x8a')](_0x1bb717)){_0x524b2b['or'](_0x9fda('0x8b'),_0x1bb717+'%')['or'](_0x9fda('0x8c'),_0x1bb717+'%');}else{_0x524b2b['or'](_0x9fda('0x8d'),qs[_0x9fda('0x71')](_0x1bb717))['or'](_0x9fda('0x8e'),_0x1bb717+'%');}}}_0x597565[_0x9fda('0x4f')](_0x524b2b);_0x597565[_0x9fda('0x8f')](_0x9fda('0x90'));var _0x509174={'type':db[_0x9fda('0x91')][_0x9fda('0x92')][_0x9fda('0x93')],'raw':!![]};var _0x123ee1=_0x597565[_0x9fda('0x94')]();_0x123ee1[_0x9fda('0x51')]('i.id');_0x123ee1[_0x9fda('0x51')](_0x9fda('0x95'),_0x9fda('0x6b'));if(_0x4e65f5[_0x9fda('0x4d')]){_0x4e65f5[_0x9fda('0x4d')]['forEach'](function(_0x37f81f){var _0x2f6232=_0x37f81f[0x0]===_0x9fda('0x96')?_0x37f81f[0x0]:'i.'+_0x37f81f[0x0];_0x597565['order'](_0x2f6232,_0x37f81f[0x1]===_0x9fda('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x2e316c)){_0x597565['having'](_0x56de00);_0x123ee1['where'](_0x9fda('0x98'),_0x2e316c);}BPromise[_0x9fda('0x99')]()[_0x9fda('0x2c')](function(){if(!_0x5efbab){if(_0x51c22a[_0x9fda('0x47')][_0x9fda('0x7e')])return;_0x123ee1[_0x9fda('0x4f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x597565[_0x9fda('0x4f')](_0x9fda('0x9a'));return;}if(_0x51c22a[_0x9fda('0x9b')]['role']!==_0x9fda('0x9c'))return;return _0x51c22a['user'][_0x9fda('0x9d')]({'attributes':['id'],'raw':!![]})[_0x9fda('0x2c')](function(_0x4a02af){if(_['isEmpty'](_0x4a02af)){_0x123ee1['where'](_0x9fda('0x9e'));_0x597565[_0x9fda('0x4f')](_0x9fda('0x9e'));}else{_0x123ee1[_0x9fda('0x4f')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x4a02af,'id'));_0x597565[_0x9fda('0x4f')](_0x9fda('0x7f'),_['map'](_0x4a02af,'id'));}});})[_0x9fda('0x2c')](function(){if(_0x51c22a[_0x9fda('0x9b')][_0x9fda('0x9f')]===_0x9fda('0x9c')&&!_0x5efbab&&!_0x51c22a[_0x9fda('0x47')][_0x9fda('0x7e')])return[];return db[_0x9fda('0xa0')][_0x9fda('0x47')](_0x123ee1[_0x9fda('0xa1')](),_0x509174);})[_0x9fda('0x2c')](function(_0xfbc732){_0x4841f3[_0x9fda('0xa2')]=_0xfbc732[_0x9fda('0x6f')];if(_0x4841f3[_0x9fda('0xa2')]===0x0)return[];return db[_0x9fda('0xa0')][_0x9fda('0x47')](_0x3f41de[_0x9fda('0xa1')](),_0x509174)[_0x9fda('0x2c')](function(_0x49f38a){_0x55f3b5=_[_0x9fda('0xa3')](_0x49f38a,'id');_0x509174=_[_0x9fda('0xa4')](_0x509174,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x51c22a[_0x9fda('0x47')]['fields']){_0x4e65f5['attributes'][_0x9fda('0x37')](function(_0x3c4a8b){_0x597565[_0x9fda('0x51')]('i.'+_0x3c4a8b);});}else{_0x597565[_0x9fda('0x51')](_0x9fda('0x95'),'unreadMessages');_0x597565[_0x9fda('0x51')](_0x9fda('0xa5'),_0x9fda('0xa6'));_0x597565[_0x9fda('0x51')](_0x9fda('0xa7'),_0x9fda('0xa8'));_0x597565[_0x9fda('0x51')](_0x9fda('0xa9'),'contactName');_0x597565[_0x9fda('0x51')](_0x9fda('0xaa'));_0x597565['field'](_0x9fda('0xab'),'Contact.firstName');_0x597565[_0x9fda('0x51')]('c.lastName',_0x9fda('0xac'));_0x597565['field'](_0x9fda('0xad'),_0x9fda('0xae'));_0x597565[_0x9fda('0x51')]('c.phone',_0x9fda('0xaf'));_0x597565[_0x9fda('0x51')]('c.mobile','Contact.mobile');_0x597565[_0x9fda('0x51')](_0x9fda('0xb0'),_0x9fda('0xb1'));_0x597565[_0x9fda('0x51')](_0x9fda('0xb2'),_0x9fda('0xb3'));_0x597565[_0x9fda('0x51')]('o.internal',_0x9fda('0xb4'));_0x597565[_0x9fda('0x51')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x9fda('0x35'));}if(_0x4e65f5['limit'])_0x597565[_0x9fda('0x26')](_0x4e65f5['limit']);if(_0x4e65f5[_0x9fda('0x25')])_0x597565['offset'](_0x4e65f5['offset']);return db['sequelize'][_0x9fda('0x47')](_0x597565['toString'](),_0x509174);})[_0x9fda('0x2c')](function(_0x52852d){if(_0x52852d[_0x9fda('0x6f')]>0x0)_0x2f5cf5[_0x9fda('0x4f')](_0x9fda('0xb5'),_['map'](_0x52852d,'id'));return db[_0x9fda('0xa0')][_0x9fda('0x47')](_0x2f5cf5['toString'](),_0x509174)[_0x9fda('0x2c')](function(_0x4314fa){var _0x45eb2e=_['groupBy'](_0x4314fa,_0x9fda('0xb6'));var _0x54996c=[];_0x52852d[_0x9fda('0x37')](function(_0x5a8794){_0x54996c['push'](updateSmsInteraction(_0x5a8794,_0x55f3b5,_0x45eb2e));});return BPromise[_0x9fda('0xb7')](_0x54996c);});});})[_0x9fda('0x2c')](function(_0x1a0668){_0x4841f3[_0x9fda('0xb8')]=_0x1a0668;return _0x4841f3;})['then'](respondWithFilteredResult(_0x5550af,_0x4e65f5))[_0x9fda('0xb9')](handleError(_0x5550af,null));};exports[_0x9fda('0xba')]=function(_0x2661ac,_0x5dd700){var _0x13f929={'raw':![],'where':{'id':_0x2661ac[_0x9fda('0xbb')]['id']}},_0x4f44df={};_0x4f44df[_0x9fda('0x45')]=_[_0x9fda('0x46')](db[_0x9fda('0x41')][_0x9fda('0x42')]);_0x4f44df[_0x9fda('0x47')]=_[_0x9fda('0x46')](_0x2661ac[_0x9fda('0x47')]);_0x4f44df['filters']=_[_0x9fda('0x48')](_0x4f44df[_0x9fda('0x45')],_0x4f44df[_0x9fda('0x47')]);_0x13f929[_0x9fda('0x49')]=_['intersection'](_0x4f44df[_0x9fda('0x45')],qs['fields'](_0x2661ac[_0x9fda('0x47')]['fields']));_0x13f929[_0x9fda('0x49')]=_0x13f929[_0x9fda('0x49')][_0x9fda('0x6f')]?_0x13f929[_0x9fda('0x49')]:_0x4f44df[_0x9fda('0x45')];if(_0x2661ac[_0x9fda('0x47')]['includeAll']){_0x13f929[_0x9fda('0xbc')]=[{'all':!![]}];}_0x13f929=_[_0x9fda('0xa4')]({},_0x13f929,_0x2661ac[_0x9fda('0xbd')]);return db[_0x9fda('0x41')][_0x9fda('0x6a')](_0x13f929)[_0x9fda('0x2c')](handleEntityNotFound(_0x5dd700,null))[_0x9fda('0x2c')](respondWithResult(_0x5dd700,null))[_0x9fda('0xb9')](handleError(_0x5dd700,null));};exports[_0x9fda('0xbe')]=function(_0xaa7fc9,_0x42f73e){return db['SmsInteraction']['create'](_0xaa7fc9[_0x9fda('0xbf')],{})[_0x9fda('0x2c')](respondWithResult(_0x42f73e,0xc9))[_0x9fda('0xb9')](handleError(_0x42f73e,null));};exports[_0x9fda('0x2b')]=function(_0x30f2d0,_0x43b8cf){if(_0x30f2d0[_0x9fda('0xbf')]['id']){delete _0x30f2d0['body']['id'];}return db[_0x9fda('0x41')][_0x9fda('0x6a')]({'where':{'id':_0x30f2d0[_0x9fda('0xbb')]['id']}})[_0x9fda('0x2c')](handleEntityNotFound(_0x43b8cf,null))[_0x9fda('0x2c')](saveUpdates(_0x30f2d0[_0x9fda('0xbf')],null))[_0x9fda('0x2c')](respondWithResult(_0x43b8cf,null))[_0x9fda('0xb9')](handleError(_0x43b8cf,null));};exports['destroy']=function(_0xa1ddea,_0x298463){return db[_0x9fda('0x41')][_0x9fda('0x6a')]({'where':{'id':_0xa1ddea['params']['id']}})[_0x9fda('0x2c')](handleEntityNotFound(_0x298463,null))[_0x9fda('0x2c')](removeEntity(_0x298463,null))[_0x9fda('0xb9')](handleError(_0x298463,null));};exports[_0x9fda('0xc0')]=function(_0x2dc299,_0x468ea2){return db[_0x9fda('0x41')]['describe']()[_0x9fda('0x2c')](respondWithResult(_0x468ea2,null))[_0x9fda('0xb9')](handleError(_0x468ea2,null));};exports[_0x9fda('0xc1')]=function(_0x6f5fc7,_0x2c8d48,_0x564319){return db[_0x9fda('0xc2')]['find']({'where':{'id':_0x6f5fc7[_0x9fda('0xbb')]['id']}})[_0x9fda('0x2c')](handleEntityNotFound(_0x2c8d48,null))[_0x9fda('0x2c')](function(_0x39864c){if(_0x39864c){return _0x39864c['addMessage'](_0x6f5fc7[_0x9fda('0xbf')][_0x9fda('0xc3')],_[_0x9fda('0xc4')](_0x6f5fc7[_0x9fda('0xbf')],['ids','id'])||{});}})['then'](respondWithResult(_0x2c8d48,null))[_0x9fda('0xb9')](handleError(_0x2c8d48,null));};exports[_0x9fda('0xc5')]=function(_0x1c9c50,_0x206650,_0x293bc2){var _0x4c9438={'raw':![],'where':{}};var _0x5eff69={};var _0x3d183f={'count':0x0,'rows':[]};return db[_0x9fda('0x41')][_0x9fda('0xc6')]({'where':{'id':_0x1c9c50[_0x9fda('0xbb')]['id']}})[_0x9fda('0x2c')](handleEntityNotFound(_0x206650,null))[_0x9fda('0x2c')](function(_0x44269b){if(_0x44269b){_0x5eff69[_0x9fda('0x45')]=_['keys'](db[_0x9fda('0xc2')][_0x9fda('0x42')]);_0x5eff69['query']=_['keys'](_0x1c9c50[_0x9fda('0x47')]);_0x5eff69[_0x9fda('0xc7')]=_[_0x9fda('0x48')](_0x5eff69[_0x9fda('0x45')],_0x5eff69[_0x9fda('0x47')]);_0x4c9438[_0x9fda('0x49')]=_[_0x9fda('0x48')](_0x5eff69[_0x9fda('0x45')],qs['fields'](_0x1c9c50[_0x9fda('0x47')][_0x9fda('0x4a')]));_0x4c9438[_0x9fda('0x49')]=_0x4c9438[_0x9fda('0x49')][_0x9fda('0x6f')]?_0x4c9438[_0x9fda('0x49')]:_0x5eff69['model'];if(!_0x1c9c50[_0x9fda('0x47')][_0x9fda('0x4b')](_0x9fda('0x4c'))){_0x4c9438['limit']=qs[_0x9fda('0x26')](_0x1c9c50['query']['limit']);_0x4c9438[_0x9fda('0x25')]=qs[_0x9fda('0x25')](_0x1c9c50[_0x9fda('0x47')][_0x9fda('0x25')]);}_0x4c9438[_0x9fda('0x4d')]=qs[_0x9fda('0x4e')](_0x1c9c50[_0x9fda('0x47')][_0x9fda('0x4e')]);_0x4c9438[_0x9fda('0x4f')]=qs['filters'](_[_0x9fda('0x50')](_0x1c9c50[_0x9fda('0x47')],_0x5eff69[_0x9fda('0xc7')]));_0x4c9438['where']['SmsInteractionId']=_0x44269b['id'];if(_0x1c9c50['query'][_0x9fda('0x88')]){_0x4c9438['where']=_[_0x9fda('0xa4')](_0x4c9438[_0x9fda('0x4f')],{'$or':_[_0x9fda('0x34')](_0x4c9438[_0x9fda('0x49')],function(_0x2c4ea8){var _0x39638e={};_0x39638e[_0x2c4ea8]={'$like':'%'+_0x1c9c50['query']['filter']+'%'};return _0x39638e;})});}if(_0x1c9c50[_0x9fda('0x47')]['$gte']){var _0x14fc2b=_0x1c9c50[_0x9fda('0x47')][_0x9fda('0xc8')]['split'](',');var _0x6738b5={};_0x6738b5[_0x14fc2b[0x0]]={'$gte':moment(_0x14fc2b[0x1])[_0x9fda('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4c9438[_0x9fda('0x4f')]=_[_0x9fda('0xa4')](_0x4c9438[_0x9fda('0x4f')],_0x6738b5);}_0x4c9438=_['merge']({},_0x4c9438,_0x1c9c50[_0x9fda('0xbd')]);return db[_0x9fda('0xc2')][_0x9fda('0xa2')]({'where':_0x4c9438[_0x9fda('0x4f')]})[_0x9fda('0x2c')](function(_0x176e5c){_0x3d183f[_0x9fda('0xa2')]=_0x176e5c;if(_0x1c9c50[_0x9fda('0x47')][_0x9fda('0xca')]){_0x4c9438[_0x9fda('0xbc')]=[{'all':!![]}];}return db[_0x9fda('0xc2')][_0x9fda('0xcb')](_0x4c9438);})[_0x9fda('0x2c')](function(_0x5a9fa0){_0x3d183f['rows']=_0x5a9fa0;return _0x3d183f;});}})[_0x9fda('0x2c')](respondWithFilteredResult(_0x206650,_0x4c9438))[_0x9fda('0xb9')](handleError(_0x206650,null));};exports['addTags']=function(_0x173d48,_0x5cd53e,_0x461116){return db[_0x9fda('0x41')][_0x9fda('0x6a')]({'where':{'id':_0x173d48[_0x9fda('0xbb')]['id']}})[_0x9fda('0x2c')](handleEntityNotFound(_0x5cd53e,null))['then'](function(_0x274c9e){if(_0x274c9e){return _0x274c9e[_0x9fda('0xcc')](_0x173d48[_0x9fda('0xbf')][_0x9fda('0xc3')],_[_0x9fda('0xc4')](_0x173d48[_0x9fda('0xbf')],['ids','id'])||{})['spread'](function(){return db[_0x9fda('0xcd')]['findAll']({'attributes':['id',_0x9fda('0x31'),_0x9fda('0x52')],'where':{'id':_0x173d48['body'][_0x9fda('0xc3')]}});})[_0x9fda('0x2c')](function(_0x4821e3){socket['emit'](_0x9fda('0xce'),{'id':Number(_0x173d48['params']['id']),'tags':_0x4821e3||[]});return{'id':Number(_0x173d48[_0x9fda('0xbb')]['id']),'tags':_0x4821e3||[]};});}})[_0x9fda('0x2c')](respondWithResult(_0x5cd53e,null))[_0x9fda('0xb9')](handleError(_0x5cd53e,null));};exports['removeTags']=function(_0x308ea2,_0x98cc21,_0x5ad177){return db['SmsInteraction'][_0x9fda('0x6a')]({'where':{'id':_0x308ea2['params']['id']}})[_0x9fda('0x2c')](handleEntityNotFound(_0x98cc21,null))[_0x9fda('0x2c')](function(_0x5e2a40){if(_0x5e2a40){return _0x5e2a40[_0x9fda('0xcf')](_0x308ea2[_0x9fda('0x47')][_0x9fda('0xc3')]);}})[_0x9fda('0x2c')](respondWithStatusCode(_0x98cc21,null))[_0x9fda('0xb9')](handleError(_0x98cc21,null));};exports['download']=function(_0x432e28,_0x5f1997){var _0x29436b=moment()[_0x9fda('0xd0')]()[_0x9fda('0xa1')]();var _0xd828f0=path['join'](config[_0x9fda('0xd1')],_0x9fda('0xd2'),_0x9fda('0xd3'),_0x9fda('0xd4'));var _0x34191c=path['join'](config[_0x9fda('0xd1')],_0x9fda('0xd2'),'files',_0x9fda('0xd5'));var _0x32941c=path[_0x9fda('0xd6')](_0xd828f0,_0x29436b);var _0x31696a=util[_0x9fda('0xc9')](_0x9fda('0xd7'),_0x432e28[_0x9fda('0xbb')]['id'],_0x29436b);var _0x110dca=path[_0x9fda('0xd6')](_0xd828f0,_0x31696a);var _0x41ce50=[];_0x41ce50[_0x9fda('0x39')]({'model':db[_0x9fda('0x7a')],'as':_0x9fda('0x7a'),'attributes':['id',_0x9fda('0xd8')],'raw':!![]});_0x41ce50['push']({'model':db[_0x9fda('0xd9')],'as':_0x9fda('0x6e'),'attributes':['id',_0x9fda('0xda'),_0x9fda('0xdb')],'raw':!![]});var _0x25d49e=[{'model':db[_0x9fda('0xc2')],'as':_0x9fda('0xdc'),'attributes':['id',_0x9fda('0xbf'),_0x9fda('0xdd'),_0x9fda('0xde'),'secret','read'],'include':_0x41ce50}];_0x25d49e['push']({'model':db[_0x9fda('0xdf')],'as':_0x9fda('0xe0'),'attributes':['id',_0x9fda('0x31')]});_0x25d49e[_0x9fda('0x39')]({'model':db[_0x9fda('0x7a')],'as':_0x9fda('0xe1'),'attributes':['id',_0x9fda('0xd8')]});return db[_0x9fda('0x41')]['find']({'where':{'id':_0x432e28[_0x9fda('0xbb')]['id']},'include':_0x25d49e})[_0x9fda('0x2c')](handleEntityNotFound(_0x5f1997,null))[_0x9fda('0x2c')](function(_0x3e058b){if(_0x3e058b){var _0x41c388=_0x3e058b[_0x9fda('0xe2')]({'plain':!![]});fs[_0x9fda('0xe3')](_0x32941c);var _0x34028b={'channel':_0x9fda('0xe4'),'account':_0x41c388['Account'][_0x9fda('0x31')],'agent':_0x41c388[_0x9fda('0xe1')]?_0x41c388['Owner']['fullname']:_0x9fda('0xe5'),'createdAt':moment(_0x41c388[_0x9fda('0xdd')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9fda('0xa1')](),'closedAt':_0x41c388[_0x9fda('0x3d')]?moment(_0x41c388[_0x9fda('0xe6')])[_0x9fda('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9fda('0xa1')]():'','disposition':_0x41c388[_0x9fda('0xe7')],'messages':_(_0x41c388[_0x9fda('0xdc')])[_0x9fda('0x88')]({'secret':![]})[_0x9fda('0x34')](function(_0x4ac2af){return{'date':moment(_0x4ac2af['createdAt'])[_0x9fda('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ac2af[_0x9fda('0xde')]==='out'?_0x4ac2af[_0x9fda('0x7a')]?_0x4ac2af[_0x9fda('0x7a')][_0x9fda('0xd8')]:_0x9fda('0xe8'):_0x4ac2af[_0x9fda('0x6e')][_0x9fda('0xda')]+(_0x4ac2af[_0x9fda('0x6e')][_0x9fda('0xdb')]?'\x20'+_0x4ac2af[_0x9fda('0x6e')][_0x9fda('0xdb')]:''),'body':_0x4ac2af[_0x9fda('0xbf')],'direction':_0x4ac2af[_0x9fda('0xde')]===_0x9fda('0xe9')?'A':'C','secret':_0x4ac2af[_0x9fda('0xea')],'read':_0x4ac2af[_0x9fda('0x84')]};})['value']()};return ejs['renderFile'](path[_0x9fda('0xd6')](config[_0x9fda('0xd1')],_0x9fda('0xd2'),'views','downloadInteraction.ejs'),{'interaction':_0x34028b})['then'](function(_0x53c6b9){var _0x4782d7=path[_0x9fda('0xd6')](_0x32941c,'transcript-'+_0x41c388['id']+'-'+_0x29436b+_0x9fda('0xeb'));var _0x31e16d={'path':_0x4782d7,'channel':_0x9fda('0xe4'),'interactionId':_0x41c388['id']};return pdf[_0x9fda('0xec')](_0x53c6b9,_0x31e16d);})['then'](function(){return new BPromise(function(_0x323ab4,_0x26d754){zipdir(_0x32941c,{'saveTo':_0x110dca},function(_0x39f4f8,_0x345d74){if(_0x39f4f8)return _0x26d754(_0x39f4f8);return _0x323ab4(_0x345d74);});})[_0x9fda('0x2c')](function(){return new BPromise(function(_0x5dca80,_0x4fc433){rimraf(_0x32941c,function(_0x3333db){if(_0x3333db)_0x4fc433(_0x3333db);return _0x5dca80();});});})[_0x9fda('0x2c')](function(){return _0x5f1997[_0x9fda('0xed')](_0x110dca,_0x31696a,function(_0x1fbce6){if(_0x1fbce6){console[_0x9fda('0xee')](_0x9fda('0xef'),_0x1fbce6);}else{fs[_0x9fda('0xf0')](_0x110dca);}});});});}else{return _0x5f1997[_0x9fda('0x2e')](0xc8);}})[_0x9fda('0xb9')](handleError(_0x5f1997,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f831ada..255f66e 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 _0x9582=['../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x40a097,_0x5ee9f5){var _0x3d25fe=function(_0x4c6c69){while(--_0x4c6c69){_0x40a097['push'](_0x40a097['shift']());}};_0x3d25fe(++_0x5ee9f5);}(_0x9582,0x95));var _0x2958=function(_0x573ab4,_0x5a2eac){_0x573ab4=_0x573ab4-0x0;var _0x3b7784=_0x9582[_0x573ab4];return _0x3b7784;};'use strict';var EventEmitter=require(_0x2958('0x0'));var SmsInteraction=require(_0x2958('0x1'))['db'][_0x2958('0x2')];var SmsMessage=require(_0x2958('0x1'))['db'][_0x2958('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2958('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2958('0x5'),'afterDestroy':_0x2958('0x6')};function emitEvent(_0x136c77){return function(_0x195138,_0x2f15c9,_0xbde128){_0x195138[_0x2958('0x7')]({'attributes':['id'],'raw':!![]})[_0x2958('0x8')](function(_0xa385ec){_0x195138[_0x2958('0x9')]('Users',_0xa385ec['map'](function(_0x313702){return{'id':_0x313702['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x195138['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2958('0x8')](function(_0x51e460){_0x195138[_0x2958('0x9')]('unreadMessages',_0x51e460[_0x2958('0xa')]);SmsInteractionEvents[_0x2958('0xb')](_0x136c77+':'+_0x195138['id'],_0x195138);SmsInteractionEvents[_0x2958('0xb')](_0x136c77,_0x195138);_0xbde128(null);})[_0x2958('0xc')](_0xbde128(null));};}for(var e in events){if(events[_0x2958('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x2958('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x1893=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x4040bb,_0x337187){var _0x4a7cf4=function(_0x2475b2){while(--_0x2475b2){_0x4040bb['push'](_0x4040bb['shift']());}};_0x4a7cf4(++_0x337187);}(_0x1893,0xa2));var _0x3189=function(_0x602436,_0xbf433){_0x602436=_0x602436-0x0;var _0x504c33=_0x1893[_0x602436];return _0x504c33;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3189('0x0')];var SmsMessage=require(_0x3189('0x1'))['db'][_0x3189('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3189('0x3')](0x0);var events={'afterCreate':_0x3189('0x4'),'afterUpdate':_0x3189('0x5'),'afterDestroy':_0x3189('0x6')};function emitEvent(_0x5371db){return function(_0x27445,_0x4faebf,_0x2333e6){_0x27445[_0x3189('0x7')]({'attributes':['id'],'raw':!![]})[_0x3189('0x8')](function(_0x118970){_0x27445[_0x3189('0x9')](_0x3189('0xa'),_0x118970['map'](function(_0x1d5f6a){return{'id':_0x1d5f6a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x27445['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3189('0x8')](function(_0x4ac683){_0x27445[_0x3189('0x9')](_0x3189('0xb'),_0x4ac683[_0x3189('0xc')]);SmsInteractionEvents[_0x3189('0xd')](_0x5371db+':'+_0x27445['id'],_0x27445);SmsInteractionEvents['emit'](_0x5371db,_0x27445);_0x2333e6(null);})[_0x3189('0xe')](_0x2333e6(null));};}for(var e in events){if(events[_0x3189('0xf')](e)){var event=events[e];SmsInteraction[_0x3189('0x10')](e,emitEvent(event));}}module[_0x3189('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7b833bc..80662d8 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 _0xfc15=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4a44e8,_0x5990d3){var _0x1f48e5=function(_0x4233aa){while(--_0x4233aa){_0x4a44e8['push'](_0x4a44e8['shift']());}};_0x1f48e5(++_0x5990d3);}(_0xfc15,0x1a3));var _0x5fc1=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xfc15[_0x2962d5];return _0x273406;};'use strict';var _=require('lodash');var util=require(_0x5fc1('0x0'));var logger=require(_0x5fc1('0x1'))('api');var moment=require(_0x5fc1('0x2'));var BPromise=require(_0x5fc1('0x3'));var rp=require(_0x5fc1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fc1('0x5'));var config=require(_0x5fc1('0x6'));var attributes=require(_0x5fc1('0x7'));module[_0x5fc1('0x8')]=function(_0x43cee8,_0xc81064){return _0x43cee8[_0x5fc1('0x9')](_0x5fc1('0xa'),attributes,{'tableName':_0x5fc1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26e7ea,_0x563289,_0xd2125d){if(_0x26e7ea[_0x5fc1('0xc')](_0x5fc1('0xd'))){_0x26e7ea[_0x5fc1('0xe')]=moment()[_0x5fc1('0xf')](_0x5fc1('0x10'));}_0xd2125d(null,_0x26e7ea);}}});}; \ No newline at end of file +var _0xa773=['lodash','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4df6aa,_0xe25dc3){var _0x2bde2d=function(_0x500099){while(--_0x500099){_0x4df6aa['push'](_0x4df6aa['shift']());}};_0x2bde2d(++_0xe25dc3);}(_0xa773,0x10e));var _0x3a77=function(_0x5bac35,_0x338bab){_0x5bac35=_0x5bac35-0x0;var _0x72d075=_0xa773[_0x5bac35];return _0x72d075;};'use strict';var _=require(_0x3a77('0x0'));var util=require('util');var logger=require(_0x3a77('0x1'))('api');var moment=require(_0x3a77('0x2'));var BPromise=require(_0x3a77('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a77('0x4'));var rimraf=require('rimraf');var config=require(_0x3a77('0x5'));var attributes=require('./smsInteraction.attributes');module[_0x3a77('0x6')]=function(_0x1d3161,_0x1439ee){return _0x1d3161[_0x3a77('0x7')](_0x3a77('0x8'),attributes,{'tableName':_0x3a77('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x257167,_0x52558d,_0x4cc6c5){if(_0x257167[_0x3a77('0xa')](_0x3a77('0xb'))){_0x257167[_0x3a77('0xc')]=moment()[_0x3a77('0xd')](_0x3a77('0xe'));}_0x4cc6c5(null,_0x257167);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 45ddcd6..e9f0302 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 _0xec2e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','where','limit','debug','stringify','addTags','body','ids','omit','spread','info','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4bb227,_0xdaa422){var _0x3b392f=function(_0x119d1c){while(--_0x119d1c){_0x4bb227['push'](_0x4bb227['shift']());}};_0x3b392f(++_0xdaa422);}(_0xec2e,0x194));var _0xeec2=function(_0x337ed8,_0x48a460){_0x337ed8=_0x337ed8-0x0;var _0x4eb9a8=_0xec2e[_0x337ed8];return _0x4eb9a8;};'use strict';var _=require('lodash');var util=require(_0xeec2('0x0'));var moment=require(_0xeec2('0x1'));var BPromise=require(_0xeec2('0x2'));var rs=require(_0xeec2('0x3'));var fs=require('fs');var Redis=require(_0xeec2('0x4'));var db=require(_0xeec2('0x5'))['db'];var utils=require(_0xeec2('0x6'));var logger=require(_0xeec2('0x7'))(_0xeec2('0x8'));var config=require(_0xeec2('0x9'));var jayson=require(_0xeec2('0xa'));var client=jayson[_0xeec2('0xb')][_0xeec2('0xc')]({'port':0x232a});config[_0xeec2('0xd')]=_[_0xeec2('0xe')](config['redis'],{'host':_0xeec2('0xf'),'port':0x18eb});var socket=require(_0xeec2('0x10'))(new Redis(config[_0xeec2('0xd')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x378837,_0xd377dc,_0x5aa780){return new BPromise(function(_0x35555a,_0x54ad9f){return client['request'](_0x378837,_0x5aa780)[_0xeec2('0x11')](function(_0x3a9adf){logger['info'](_0xeec2('0x12'),_0xd377dc,_0xeec2('0x13'));logger['debug'](_0xeec2('0x14'),_0xd377dc,'request\x20sent',JSON['stringify'](_0x3a9adf));if(_0x3a9adf[_0xeec2('0x15')]){if(_0x3a9adf[_0xeec2('0x15')][_0xeec2('0x16')]===0x1f4){logger[_0xeec2('0x15')](_0xeec2('0x12'),_0xd377dc,_0x3a9adf[_0xeec2('0x15')][_0xeec2('0x17')]);return _0x54ad9f(_0x3a9adf['error'][_0xeec2('0x17')]);}logger[_0xeec2('0x15')]('SmsInteraction,\x20%s,\x20%s',_0xd377dc,_0x3a9adf['error'][_0xeec2('0x17')]);return _0x35555a(_0x3a9adf[_0xeec2('0x15')][_0xeec2('0x17')]);}else{logger['info'](_0xeec2('0x12'),_0xd377dc,_0xeec2('0x13'));_0x35555a(_0x3a9adf[_0xeec2('0x18')][_0xeec2('0x17')]);}})[_0xeec2('0x19')](function(_0x3bb122){logger['error'](_0xeec2('0x12'),_0xd377dc,_0x3bb122);_0x54ad9f(_0x3bb122);});});}exports[_0xeec2('0x1a')]=function(_0x442f0d){var _0x232421=this;return new Promise(function(_0x37b4b8,_0x5f0c79){return db[_0xeec2('0x1b')][_0xeec2('0x1c')](_0x442f0d['body'],{'raw':_0x442f0d[_0xeec2('0x1d')]?_0x442f0d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x442f0d[_0xeec2('0x1d')]?_0x442f0d[_0xeec2('0x1d')][_0xeec2('0x1e')]||null:null,'attributes':_0x442f0d[_0xeec2('0x1d')]?_0x442f0d[_0xeec2('0x1d')]['attributes']||null:null,'limit':_0x442f0d[_0xeec2('0x1d')]?_0x442f0d[_0xeec2('0x1d')][_0xeec2('0x1f')]||null:null})['then'](function(_0x3614c2){logger['info'](_0xeec2('0x1a'),_0x442f0d);logger[_0xeec2('0x20')]('UpdateSmsInteraction',_0x442f0d,JSON[_0xeec2('0x21')](_0x3614c2));_0x37b4b8(_0x3614c2);})[_0xeec2('0x19')](function(_0x7642e9){logger[_0xeec2('0x15')](_0xeec2('0x1a'),_0x7642e9['message'],_0x442f0d);_0x5f0c79(_0x232421[_0xeec2('0x15')](0x1f4,_0x7642e9[_0xeec2('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x41115f){return new Promise(function(_0xb14abf,_0x2449c5){return db[_0xeec2('0x1b')]['find']({'where':_0x41115f[_0xeec2('0x1d')]?_0x41115f['options'][_0xeec2('0x1e')]||null:null})['then'](function(_0xd2c7fa){if(_0xd2c7fa){return _0xd2c7fa[_0xeec2('0x22')](_0x41115f[_0xeec2('0x23')][_0xeec2('0x24')],_[_0xeec2('0x25')](_0x41115f[_0xeec2('0x23')],[_0xeec2('0x24'),'id'])||{});}})[_0xeec2('0x26')](function(_0x168aba){logger[_0xeec2('0x27')](_0xeec2('0x28'),_0x41115f);logger['debug'](_0xeec2('0x28'),_0x41115f,JSON['stringify'](_0x168aba));_0xb14abf(_0x168aba);})['catch'](function(_0xa0e60a){logger[_0xeec2('0x15')](_0xeec2('0x28'),_0xa0e60a['message'],_0x41115f);_0x2449c5(_this[_0xeec2('0x15')](0x1f4,_0xa0e60a[_0xeec2('0x17')]));});});}; \ No newline at end of file +var _0x15e3=['attributes','limit','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateSmsInteraction','update','body','options','raw'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x15e3,0x1ee));var _0x315e=function(_0x3e332b,_0x3fdd31){_0x3e332b=_0x3e332b-0x0;var _0x3f0eb1=_0x15e3[_0x3e332b];return _0x3f0eb1;};'use strict';var _=require(_0x315e('0x0'));var util=require(_0x315e('0x1'));var moment=require(_0x315e('0x2'));var BPromise=require('bluebird');var rs=require(_0x315e('0x3'));var fs=require('fs');var Redis=require(_0x315e('0x4'));var db=require(_0x315e('0x5'))['db'];var utils=require(_0x315e('0x6'));var logger=require(_0x315e('0x7'))(_0x315e('0x8'));var config=require(_0x315e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x315e('0xa')][_0x315e('0xb')]({'port':0x232a});config['redis']=_[_0x315e('0xc')](config[_0x315e('0xd')],{'host':_0x315e('0xe'),'port':0x18eb});var socket=require(_0x315e('0xf'))(new Redis(config['redis']));require(_0x315e('0x10'))[_0x315e('0x11')](socket);function respondWithRpcPromise(_0x3ec3b5,_0x42cbb0,_0x44af51){return new BPromise(function(_0x351b12,_0x4755a5){return client[_0x315e('0x12')](_0x3ec3b5,_0x44af51)[_0x315e('0x13')](function(_0x5e7df3){logger[_0x315e('0x14')](_0x315e('0x15'),_0x42cbb0,_0x315e('0x16'));logger[_0x315e('0x17')](_0x315e('0x18'),_0x42cbb0,_0x315e('0x16'),JSON[_0x315e('0x19')](_0x5e7df3));if(_0x5e7df3['error']){if(_0x5e7df3[_0x315e('0x1a')]['code']===0x1f4){logger[_0x315e('0x1a')](_0x315e('0x15'),_0x42cbb0,_0x5e7df3['error']['message']);return _0x4755a5(_0x5e7df3[_0x315e('0x1a')][_0x315e('0x1b')]);}logger[_0x315e('0x1a')](_0x315e('0x15'),_0x42cbb0,_0x5e7df3[_0x315e('0x1a')][_0x315e('0x1b')]);return _0x351b12(_0x5e7df3['error'][_0x315e('0x1b')]);}else{logger[_0x315e('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x42cbb0,_0x315e('0x16'));_0x351b12(_0x5e7df3['result'][_0x315e('0x1b')]);}})[_0x315e('0x1c')](function(_0x829c9){logger['error'](_0x315e('0x15'),_0x42cbb0,_0x829c9);_0x4755a5(_0x829c9);});});}exports[_0x315e('0x1d')]=function(_0x49958e){var _0x53c849=this;return new Promise(function(_0x274c31,_0x4dd58c){return db['SmsInteraction'][_0x315e('0x1e')](_0x49958e[_0x315e('0x1f')],{'raw':_0x49958e[_0x315e('0x20')]?_0x49958e[_0x315e('0x20')][_0x315e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49958e['options']?_0x49958e[_0x315e('0x20')]['where']||null:null,'attributes':_0x49958e[_0x315e('0x20')]?_0x49958e[_0x315e('0x20')][_0x315e('0x22')]||null:null,'limit':_0x49958e[_0x315e('0x20')]?_0x49958e[_0x315e('0x20')][_0x315e('0x23')]||null:null})[_0x315e('0x13')](function(_0x5bdb7a){logger[_0x315e('0x14')](_0x315e('0x1d'),_0x49958e);logger[_0x315e('0x17')](_0x315e('0x1d'),_0x49958e,JSON[_0x315e('0x19')](_0x5bdb7a));_0x274c31(_0x5bdb7a);})[_0x315e('0x1c')](function(_0x1cfa72){logger[_0x315e('0x1a')](_0x315e('0x1d'),_0x1cfa72[_0x315e('0x1b')],_0x49958e);_0x4dd58c(_0x53c849['error'](0x1f4,_0x1cfa72['message']));});});};exports[_0x315e('0x24')]=function(_0x3a497c){return new Promise(function(_0x4936e1,_0x8bcda2){return db['SmsInteraction'][_0x315e('0x25')]({'where':_0x3a497c[_0x315e('0x20')]?_0x3a497c[_0x315e('0x20')][_0x315e('0x26')]||null:null})[_0x315e('0x13')](function(_0x3367a5){if(_0x3367a5){return _0x3367a5[_0x315e('0x27')](_0x3a497c[_0x315e('0x1f')][_0x315e('0x28')],_[_0x315e('0x29')](_0x3a497c[_0x315e('0x1f')],[_0x315e('0x28'),'id'])||{});}})[_0x315e('0x2a')](function(_0x37377b){logger[_0x315e('0x14')](_0x315e('0x2b'),_0x3a497c);logger[_0x315e('0x17')](_0x315e('0x2b'),_0x3a497c,JSON[_0x315e('0x19')](_0x37377b));_0x4936e1(_0x37377b);})['catch'](function(_0x479838){logger[_0x315e('0x1a')](_0x315e('0x2b'),_0x479838[_0x315e('0x1b')],_0x3a497c);_0x8bcda2(_this[_0x315e('0x1a')](0x1f4,_0x479838[_0x315e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8a60c76..9a11ffe 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 _0xd6b7=['removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x1d2eda,_0x3da00d){var _0x14c67d=function(_0x519b48){while(--_0x519b48){_0x1d2eda['push'](_0x1d2eda['shift']());}};_0x14c67d(++_0x3da00d);}(_0xd6b7,0x1bd));var _0x7d6b=function(_0x9aa351,_0x4be397){_0x9aa351=_0x9aa351-0x0;var _0x5c729b=_0xd6b7[_0x9aa351];return _0x5c729b;};'use strict';var SmsInteractionEvents=require(_0x7d6b('0x0'));var events=[_0x7d6b('0x1'),_0x7d6b('0x2'),_0x7d6b('0x3')];function createListener(_0x50f5d6,_0x45bb19){return function(_0x457a69){_0x45bb19[_0x7d6b('0x4')](_0x50f5d6,_0x457a69);};}function removeListener(_0xc99d24,_0x1c38ba){return function(){SmsInteractionEvents[_0x7d6b('0x5')](_0xc99d24,_0x1c38ba);};}exports[_0x7d6b('0x6')]=function(_0x3df3e3){for(var _0xd64c5a=0x0,_0x17a4a1=events[_0x7d6b('0x7')];_0xd64c5a<_0x17a4a1;_0xd64c5a++){var _0x54dd50=events[_0xd64c5a];var _0x2ad36a=createListener(_0x7d6b('0x8')+_0x54dd50,_0x3df3e3);SmsInteractionEvents['on'](_0x54dd50,_0x2ad36a);}}; \ No newline at end of file +var _0x3e10=['./smsInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3e10,0xc0));var _0x03e1=function(_0x3825e5,_0x3b0456){_0x3825e5=_0x3825e5-0x0;var _0x275d34=_0x3e10[_0x3825e5];return _0x275d34;};'use strict';var SmsInteractionEvents=require(_0x03e1('0x0'));var events=[_0x03e1('0x1'),_0x03e1('0x2'),_0x03e1('0x3')];function createListener(_0x434739,_0x5cdea4){return function(_0x31cfd5){_0x5cdea4[_0x03e1('0x4')](_0x434739,_0x31cfd5);};}function removeListener(_0x48c370,_0x3c173a){return function(){SmsInteractionEvents[_0x03e1('0x5')](_0x48c370,_0x3c173a);};}exports[_0x03e1('0x6')]=function(_0x1d4fc9){for(var _0x42286c=0x0,_0xb029fe=events[_0x03e1('0x7')];_0x42286c<_0xb029fe;_0x42286c++){var _0x3a194d=events[_0x42286c];var _0x1a2b0b=createListener('smsInteraction:'+_0x3a194d,_0x1d4fc9);SmsInteractionEvents['on'](_0x3a194d,_0x1a2b0b);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2a9bbdc..32ceb65 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 _0x4dd3=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x376e59,_0x6a0178){var _0x2befd3=function(_0x29b14d){while(--_0x29b14d){_0x376e59['push'](_0x376e59['shift']());}};_0x2befd3(++_0x6a0178);}(_0x4dd3,0xf5));var _0x34dd=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0x4dd3[_0x33bcdb];return _0x18a9bf;};'use strict';var multer=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var path=require(_0x34dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x34dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34dd('0x4'));var interaction=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var controller=require('./smsMessage.controller');router[_0x34dd('0x7')]('/',auth[_0x34dd('0x8')](),controller[_0x34dd('0x9')]);router[_0x34dd('0x7')](_0x34dd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x34dd('0x7')](_0x34dd('0xb'),auth[_0x34dd('0x8')](),controller['show']);router[_0x34dd('0xc')]('/',auth[_0x34dd('0x8')](),interaction[_0x34dd('0xd')](_0x34dd('0xe'),_0x34dd('0xf')),controller[_0x34dd('0x10')]);router['post'](_0x34dd('0x11'),controller[_0x34dd('0x12')]);router[_0x34dd('0x13')](_0x34dd('0xb'),auth[_0x34dd('0x8')](),controller['update']);router['put'](_0x34dd('0x14'),auth[_0x34dd('0x8')](),controller[_0x34dd('0x15')]);router['put'](_0x34dd('0x16'),auth['isAuthenticated'](),controller[_0x34dd('0x17')]);router[_0x34dd('0x18')](_0x34dd('0xb'),auth[_0x34dd('0x8')](),controller[_0x34dd('0x19')]);module[_0x34dd('0x1a')]=router; \ No newline at end of file +var _0xc2af=['post','tracked','smsmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x1a4169,_0x5ddf1a){var _0x197233=function(_0x36edaf){while(--_0x36edaf){_0x1a4169['push'](_0x1a4169['shift']());}};_0x197233(++_0x5ddf1a);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x49c338,_0x111498){_0x49c338=_0x49c338-0x0;var _0x29f9de=_0xc2af[_0x49c338];return _0x29f9de;};'use strict';var multer=require(_0xfc2a('0x0'));var util=require('util');var path=require(_0xfc2a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc2a('0x2'));var router=express[_0xfc2a('0x3')]();var fs_extra=require(_0xfc2a('0x4'));var auth=require(_0xfc2a('0x5'));var interaction=require(_0xfc2a('0x6'));var config=require(_0xfc2a('0x7'));var controller=require(_0xfc2a('0x8'));router[_0xfc2a('0x9')]('/',auth['isAuthenticated'](),controller[_0xfc2a('0xa')]);router['get'](_0xfc2a('0xb'),auth['isAuthenticated'](),controller[_0xfc2a('0xc')]);router[_0xfc2a('0x9')](_0xfc2a('0xd'),auth[_0xfc2a('0xe')](),controller['show']);router[_0xfc2a('0xf')]('/',auth['isAuthenticated'](),interaction[_0xfc2a('0x10')]('sms',_0xfc2a('0x11')),controller[_0xfc2a('0x12')]);router[_0xfc2a('0xf')]('/:id/status',controller['status']);router[_0xfc2a('0x13')](_0xfc2a('0xd'),auth[_0xfc2a('0xe')](),controller[_0xfc2a('0x14')]);router[_0xfc2a('0x13')](_0xfc2a('0x15'),auth[_0xfc2a('0xe')](),controller[_0xfc2a('0x16')]);router[_0xfc2a('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0xfc2a('0x17')]);router[_0xfc2a('0x18')]('/:id',auth[_0xfc2a('0xe')](),controller[_0xfc2a('0x19')]);module[_0xfc2a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 0220d4b..f07c67e 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 _0x093d=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0xf6b9a6,_0x1fde70){var _0x2ac9e8=function(_0x8315b5){while(--_0x8315b5){_0xf6b9a6['push'](_0xf6b9a6['shift']());}};_0x2ac9e8(++_0x1fde70);}(_0x093d,0x1c9));var _0xd093=function(_0x4413cf,_0x3f70e8){_0x4413cf=_0x4413cf-0x0;var _0x9a1479=_0x093d[_0x4413cf];return _0x9a1479;};'use strict';var Sequelize=require(_0xd093('0x0'));module[_0xd093('0x1')]={'body':{'type':Sequelize[_0xd093('0x2')](_0xd093('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd093('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd093('0x5')]('in',_0xd093('0x6')),'defaultValue':_0xd093('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd093('0x7')](0xbe)},'phone':{'type':Sequelize[_0xd093('0x7')]},'readAt':{'type':Sequelize[_0xd093('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x95c3=['TEXT','medium','BOOLEAN','ENUM','STRING','DATE','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x95c3,0xfb));var _0x395c=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x95c3[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x395c('0x0'));module['exports']={'body':{'type':Sequelize[_0x395c('0x1')](_0x395c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x395c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x395c('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x395c('0x5')](0xbe)},'phone':{'type':Sequelize[_0x395c('0x5')]},'readAt':{'type':Sequelize[_0x395c('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x395c('0x5')]},'providerResponse':{'type':Sequelize[_0x395c('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index a413467..f68b0a0 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 _0x47d6=['sent','delivered','Status','infobip','results','groupName','DELIVERED','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','include','find','create','body','describe','sms-interactions','sms','readAt','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','email','internal','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf'];(function(_0x1fe9e5,_0x5eb665){var _0x51d38c=function(_0x20bf65){while(--_0x20bf65){_0x1fe9e5['push'](_0x1fe9e5['shift']());}};_0x51d38c(++_0x5eb665);}(_0x47d6,0x13f));var _0x647d=function(_0x1f65a0,_0x1a10ec){_0x1f65a0=_0x1f65a0-0x0;var _0x1b6bd3=_0x47d6[_0x1f65a0];return _0x1b6bd3;};'use strict';var emlformat=require(_0x647d('0x0'));var rimraf=require(_0x647d('0x1'));var zipdir=require(_0x647d('0x2'));var jsonpatch=require(_0x647d('0x3'));var rp=require(_0x647d('0x4'));var moment=require(_0x647d('0x5'));var BPromise=require(_0x647d('0x6'));var Mustache=require(_0x647d('0x7'));var util=require(_0x647d('0x8'));var path=require(_0x647d('0x9'));var sox=require(_0x647d('0xa'));var csv=require(_0x647d('0xb'));var ejs=require(_0x647d('0xc'));var fs=require('fs');var fs_extra=require(_0x647d('0xd'));var _=require(_0x647d('0xe'));var squel=require(_0x647d('0xf'));var crypto=require('crypto');var jsforce=require(_0x647d('0x10'));var deskjs=require(_0x647d('0x11'));var toCsv=require(_0x647d('0xb'));var querystring=require(_0x647d('0x12'));var Papa=require(_0x647d('0x13'));var Redis=require(_0x647d('0x14'));var authService=require(_0x647d('0x15'));var qs=require(_0x647d('0x16'));var as=require(_0x647d('0x17'));var hardwareService=require(_0x647d('0x18'));var logger=require(_0x647d('0x19'))(_0x647d('0x1a'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x647d('0x1b'));var db=require(_0x647d('0x1c'))['db'];config[_0x647d('0x1d')]=_[_0x647d('0x1e')](config[_0x647d('0x1d')],{'host':_0x647d('0x1f'),'port':0x18eb});var socket=require(_0x647d('0x20'))(new Redis(config[_0x647d('0x1d')]));require('./smsMessage.socket')[_0x647d('0x21')](socket);var jayson=require(_0x647d('0x22'));var client=jayson['client'][_0x647d('0x23')]({'port':0x232c});var client9002=jayson[_0x647d('0x24')][_0x647d('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x53297a,_0x531499,_0x2f9be8,_0x20c5d1){return new BPromise(function(_0x433cc1,_0x5ba225){var _0x2be22c=_0x20c5d1||client;return _0x2be22c[_0x647d('0x25')](_0x53297a,_0x2f9be8)['then'](function(_0x1c66d1){logger[_0x647d('0x26')](_0x647d('0x27'),_0x531499,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x531499,_0x647d('0x28'),JSON[_0x647d('0x29')](_0x1c66d1));if(_0x1c66d1[_0x647d('0x2a')]){if(_0x1c66d1['error'][_0x647d('0x2b')]===0x1f4){logger[_0x647d('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x531499,_0x1c66d1['error']['message']);return _0x5ba225(_0x1c66d1[_0x647d('0x2a')][_0x647d('0x2c')]);}logger['error'](_0x647d('0x27'),_0x531499,_0x1c66d1[_0x647d('0x2a')][_0x647d('0x2c')]);return _0x433cc1(_0x1c66d1[_0x647d('0x2a')]['message']);}else{logger['info'](_0x647d('0x27'),_0x531499,'request\x20sent');_0x433cc1(_0x1c66d1[_0x647d('0x2d')][_0x647d('0x2c')]);}})[_0x647d('0x2e')](function(_0xdd1cf6){logger[_0x647d('0x2a')](_0x647d('0x27'),_0x531499,_0xdd1cf6);_0x5ba225(_0xdd1cf6);});});}function respondWithStatusCode(_0x389791,_0x204670){_0x204670=_0x204670||0xcc;return function(_0x243f13){if(_0x243f13){return _0x389791[_0x647d('0x2f')](_0x204670);}return _0x389791[_0x647d('0x30')](_0x204670)[_0x647d('0x31')]();};}function respondWithResult(_0x31be11,_0x398c33){_0x398c33=_0x398c33||0xc8;return function(_0x24356c){if(_0x24356c){return _0x31be11[_0x647d('0x30')](_0x398c33)['json'](_0x24356c);}};}function respondWithFilteredResult(_0x5b418e,_0x575c52){return function(_0x38ab27){if(_0x38ab27){var _0x58c102=typeof _0x575c52[_0x647d('0x32')]===_0x647d('0x33')&&typeof _0x575c52['limit']===_0x647d('0x33');var _0x2fe75d=_0x38ab27[_0x647d('0x34')];var _0x51295a=_0x58c102?0x0:_0x575c52[_0x647d('0x32')];var _0x3d15c5=_0x58c102?_0x38ab27[_0x647d('0x34')]:_0x575c52['offset']+_0x575c52['limit'];var _0x3d2217;if(_0x3d15c5>=_0x2fe75d){_0x3d15c5=_0x2fe75d;_0x3d2217=0xc8;}else{_0x3d2217=0xce;}_0x5b418e[_0x647d('0x30')](_0x3d2217);return _0x5b418e[_0x647d('0x35')]('Content-Range',_0x51295a+'-'+_0x3d15c5+'/'+_0x2fe75d)[_0x647d('0x36')](_0x38ab27);}return null;};}function patchUpdates(_0x11c9e8){return function(_0x2c9e0d){try{jsonpatch[_0x647d('0x37')](_0x2c9e0d,_0x11c9e8,!![]);}catch(_0x1658e2){return BPromise[_0x647d('0x38')](_0x1658e2);}return _0x2c9e0d[_0x647d('0x39')]();};}function saveUpdates(_0x9652cb,_0x32bab8){return function(_0x42b0e8){if(_0x42b0e8){return _0x42b0e8[_0x647d('0x3a')](_0x9652cb)['then'](function(_0x197725){return _0x197725;});}return null;};}function removeEntity(_0xce1f54,_0x283036){return function(_0x31b860){if(_0x31b860){return _0x31b860[_0x647d('0x3b')]()[_0x647d('0x3c')](function(){_0xce1f54[_0x647d('0x30')](0xcc)[_0x647d('0x31')]();});}};}function handleEntityNotFound(_0x565966,_0x54911d){return function(_0x453a99){if(!_0x453a99){_0x565966[_0x647d('0x2f')](0x194);}return _0x453a99;};}function handleError(_0x22d927,_0x4624ff){_0x4624ff=_0x4624ff||0x1f4;return function(_0x54a2ec){logger[_0x647d('0x2a')](_0x54a2ec[_0x647d('0x3d')]);if(_0x54a2ec['name']){delete _0x54a2ec[_0x647d('0x3e')];}_0x22d927[_0x647d('0x30')](_0x4624ff)['send'](_0x54a2ec);};}exports[_0x647d('0x3f')]=function(_0x18a517,_0x380d4e){var _0xb6c9f6={},_0x24a947={},_0x44163c={'count':0x0,'rows':[]};var _0x2b1e53=_[_0x647d('0x40')](db[_0x647d('0x41')][_0x647d('0x42')],function(_0x1a5de7){return{'name':_0x1a5de7[_0x647d('0x43')],'type':_0x1a5de7[_0x647d('0x44')][_0x647d('0x45')]};});_0x24a947[_0x647d('0x46')]=_[_0x647d('0x40')](_0x2b1e53,'name');_0x24a947['query']=_['keys'](_0x18a517[_0x647d('0x47')]);_0x24a947['filters']=_[_0x647d('0x48')](_0x24a947[_0x647d('0x46')],_0x24a947['query']);_0xb6c9f6[_0x647d('0x49')]=_[_0x647d('0x48')](_0x24a947[_0x647d('0x46')],qs['fields'](_0x18a517['query'][_0x647d('0x4a')]));_0xb6c9f6[_0x647d('0x49')]=_0xb6c9f6[_0x647d('0x49')][_0x647d('0x4b')]?_0xb6c9f6['attributes']:_0x24a947['model'];if(!_0x18a517[_0x647d('0x47')][_0x647d('0x4c')](_0x647d('0x4d'))){_0xb6c9f6[_0x647d('0x4e')]=qs[_0x647d('0x4e')](_0x18a517['query'][_0x647d('0x4e')]);_0xb6c9f6[_0x647d('0x32')]=qs[_0x647d('0x32')](_0x18a517['query']['offset']);}_0xb6c9f6['order']=qs[_0x647d('0x4f')](_0x18a517[_0x647d('0x47')][_0x647d('0x4f')]);_0xb6c9f6[_0x647d('0x50')]=qs[_0x647d('0x51')](_[_0x647d('0x52')](_0x18a517[_0x647d('0x47')],_0x24a947['filters']),_0x2b1e53);if(_0x18a517[_0x647d('0x47')][_0x647d('0x53')]){_0xb6c9f6[_0x647d('0x50')]=_[_0x647d('0x54')](_0xb6c9f6[_0x647d('0x50')],{'$or':_[_0x647d('0x40')](_0x2b1e53,function(_0x163f6d){if(_0x163f6d[_0x647d('0x44')]!==_0x647d('0x55')){var _0x2cb4cd={};_0x2cb4cd[_0x163f6d['name']]={'$like':'%'+_0x18a517[_0x647d('0x47')][_0x647d('0x53')]+'%'};return _0x2cb4cd;}})});}_0xb6c9f6=_['merge']({},_0xb6c9f6,_0x18a517[_0x647d('0x56')]);var _0x432229={'where':_0xb6c9f6[_0x647d('0x50')]};return db[_0x647d('0x41')][_0x647d('0x34')](_0x432229)[_0x647d('0x3c')](function(_0x1189dd){_0x44163c[_0x647d('0x34')]=_0x1189dd;if(_0x18a517[_0x647d('0x47')][_0x647d('0x57')]){_0xb6c9f6['include']=[{'all':!![]}];}return db[_0x647d('0x41')][_0x647d('0x58')](_0xb6c9f6);})[_0x647d('0x3c')](function(_0xb16950){_0x44163c['rows']=_0xb16950;return _0x44163c;})[_0x647d('0x3c')](respondWithFilteredResult(_0x380d4e,_0xb6c9f6))[_0x647d('0x2e')](handleError(_0x380d4e,null));};exports[_0x647d('0x59')]=function(_0x319c13,_0xb2f736){var _0x26d8a3={'raw':!![],'where':{'id':_0x319c13[_0x647d('0x5a')]['id']}},_0x154508={};_0x154508[_0x647d('0x46')]=_[_0x647d('0x5b')](db['SmsMessage']['rawAttributes']);_0x154508[_0x647d('0x47')]=_[_0x647d('0x5b')](_0x319c13[_0x647d('0x47')]);_0x154508[_0x647d('0x51')]=_[_0x647d('0x48')](_0x154508[_0x647d('0x46')],_0x154508['query']);_0x26d8a3[_0x647d('0x49')]=_[_0x647d('0x48')](_0x154508[_0x647d('0x46')],qs[_0x647d('0x4a')](_0x319c13['query'][_0x647d('0x4a')]));_0x26d8a3[_0x647d('0x49')]=_0x26d8a3['attributes'][_0x647d('0x4b')]?_0x26d8a3[_0x647d('0x49')]:_0x154508[_0x647d('0x46')];if(_0x319c13['query']['includeAll']){_0x26d8a3[_0x647d('0x5c')]=[{'all':!![]}];}_0x26d8a3=_[_0x647d('0x54')]({},_0x26d8a3,_0x319c13[_0x647d('0x56')]);return db[_0x647d('0x41')][_0x647d('0x5d')](_0x26d8a3)[_0x647d('0x3c')](handleEntityNotFound(_0xb2f736,null))[_0x647d('0x3c')](respondWithResult(_0xb2f736,null))[_0x647d('0x2e')](handleError(_0xb2f736,null));};exports[_0x647d('0x5e')]=function(_0x12378b,_0x36790e){return db[_0x647d('0x41')][_0x647d('0x5e')](_0x12378b[_0x647d('0x5f')],{})[_0x647d('0x3c')](respondWithResult(_0x36790e,0xc9))[_0x647d('0x2e')](handleError(_0x36790e,null));};exports[_0x647d('0x3a')]=function(_0x378ae4,_0x4dde74){if(_0x378ae4[_0x647d('0x5f')]['id']){delete _0x378ae4[_0x647d('0x5f')]['id'];}return db['SmsMessage'][_0x647d('0x5d')]({'where':{'id':_0x378ae4[_0x647d('0x5a')]['id']}})[_0x647d('0x3c')](handleEntityNotFound(_0x4dde74,null))[_0x647d('0x3c')](saveUpdates(_0x378ae4[_0x647d('0x5f')],null))[_0x647d('0x3c')](respondWithResult(_0x4dde74,null))[_0x647d('0x2e')](handleError(_0x4dde74,null));};exports[_0x647d('0x3b')]=function(_0x2fca95,_0x58ee0f){return db[_0x647d('0x41')]['find']({'where':{'id':_0x2fca95[_0x647d('0x5a')]['id']}})[_0x647d('0x3c')](handleEntityNotFound(_0x58ee0f,null))[_0x647d('0x3c')](removeEntity(_0x58ee0f,null))[_0x647d('0x2e')](handleError(_0x58ee0f,null));};exports[_0x647d('0x60')]=function(_0x2d4298,_0xe89cbb){return db[_0x647d('0x41')][_0x647d('0x60')]()[_0x647d('0x3c')](respondWithResult(_0xe89cbb,null))[_0x647d('0x2e')](handleError(_0xe89cbb,null));};var interaction_log=require('../../config/logger')(_0x647d('0x61'));exports['accept']=function(_0x1b6afb,_0x47c38e,_0x3940d7){var _0x4bd950={'agent':{},'channel':_0x647d('0x62')};if(_0x1b6afb['body']['id']){delete _0x1b6afb[_0x647d('0x5f')]['id'];}_0x1b6afb[_0x647d('0x5f')]['read']=!![];_0x1b6afb['body'][_0x647d('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1b6afb[_0x647d('0x5f')]['UserId']=_0x1b6afb['body'][_0x647d('0x64')]||_0x1b6afb[_0x647d('0x65')]['id'];_0x4bd950[_0x647d('0x66')]['id']=_0x1b6afb[_0x647d('0x5f')][_0x647d('0x64')];return db['SmsMessage']['find']({'where':{'id':_0x1b6afb[_0x647d('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x47c38e,null))[_0x647d('0x3c')](saveUpdates(_0x1b6afb[_0x647d('0x5f')],null))[_0x647d('0x3c')](function(_0x1a6d86){if(_0x1a6d86){_0x4bd950[_0x647d('0x2c')]=_0x1a6d86[_0x647d('0x67')]({'plain':!![]});return db[_0x647d('0x68')][_0x647d('0x5d')]({'where':{'id':_0x1a6d86[_0x647d('0x69')]}});}return null;})[_0x647d('0x3c')](handleEntityNotFound(_0x47c38e,null))[_0x647d('0x3c')](function(_0xdf4a20){if(_0xdf4a20){return _0xdf4a20[_0x647d('0x3a')]({'UserId':_0x1b6afb['body'][_0x647d('0x64')],'read1stAt':_[_0x647d('0x6a')](_0xdf4a20[_0x647d('0x6b')])?moment()[_0x647d('0x6c')](_0x647d('0x6d')):undefined});}return null;})[_0x647d('0x3c')](function(_0x5e9c4d){if(_0x5e9c4d){_0x4bd950[_0x647d('0x6e')]=_0x5e9c4d[_0x647d('0x67')]({'plain':!![]});interaction_log[_0x647d('0x26')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b6afb[_0x647d('0x65')]['id'],_0x1b6afb[_0x647d('0x65')][_0x647d('0x3e')],_0x1b6afb['user'][_0x647d('0x6f')],_0x4bd950['interaction']['id'],_0x1b6afb['body']?JSON[_0x647d('0x29')](_0x1b6afb[_0x647d('0x5f')]):_0x647d('0x70'));return respondWithRpcPromise(_0x647d('0x71'),_0x647d('0x72'),_0x4bd950);}return null;})[_0x647d('0x3c')](function(_0x2b67fe){var _0xcb30b2=_0x647d('0x73')+_0x2b67fe[_0x647d('0x2c')][_0x647d('0x74')];return db[_0x647d('0x75')][_0x647d('0x47')](_0xcb30b2,{'type':db[_0x647d('0x76')][_0x647d('0x77')][_0x647d('0x78')],'raw':!![]})[_0x647d('0x3c')](function(_0x30d616){return _0x30d616;});})[_0x647d('0x3c')](function(_0x9a9850){if(_0x9a9850){_0x4bd950['message']['contact']=_0x9a9850[0x0];if(!_0x1b6afb['body'][_0x647d('0x64')])return;return db[_0x647d('0x79')][_0x647d('0x5d')]({'where':{'id':_0x1b6afb[_0x647d('0x5f')][_0x647d('0x64')],'role':_0x647d('0x66')},'attributes':['id',_0x647d('0x3e'),_0x647d('0x7a'),'email','internal'],'raw':!![]});}return null;})[_0x647d('0x3c')](function(_0x14bd91){if(!_0x14bd91)return null;_0x4bd950[_0x647d('0x2c')][_0x647d('0x66')]=_0x14bd91;return _0x4bd950;})[_0x647d('0x3c')](function(_0x20f277){if(_0x20f277){if(_0x1b6afb[_0x647d('0x5f')][_0x647d('0x7b')]){_0x4bd950[_0x647d('0x2c')][_0x647d('0x7c')]=util[_0x647d('0x6c')](_0x647d('0x7d'),_0x1b6afb[_0x647d('0x65')][_0x647d('0x3e')]);_0x4bd950['message']['channel']=_0x4bd950[_0x647d('0x7e')];_0x4bd950['message'][_0x647d('0x7f')]=_0x4bd950[_0x647d('0x7e')];_0x4bd950[_0x647d('0x2c')][_0x647d('0x80')]='accept';return respondWithRpcPromise('EventManager',_0x647d('0x81'),{'event':_0x647d('0x82'),'message':_0x4bd950[_0x647d('0x2c')]},client9002)[_0x647d('0x3c')](function(){return _0x4bd950;});}return _0x4bd950;}return null;})[_0x647d('0x3c')](respondWithResult(_0x47c38e,null))[_0x647d('0x2e')](handleError(_0x47c38e,null));};var interaction_log=require(_0x647d('0x19'))(_0x647d('0x61'));exports[_0x647d('0x38')]=function(_0x583db3,_0x23b16a,_0x1276e7){var _0x4d0268={'agent':{},'channel':_0x647d('0x62')};if(_0x583db3['body']['id']){delete _0x583db3[_0x647d('0x5f')]['id'];}_0x583db3[_0x647d('0x5f')][_0x647d('0x64')]=_0x583db3[_0x647d('0x5f')][_0x647d('0x64')]||_0x583db3[_0x647d('0x65')]['id'];_0x4d0268[_0x647d('0x66')]['id']=_0x583db3['body'][_0x647d('0x64')];return db[_0x647d('0x41')]['find']({'where':{'id':_0x583db3['params']['id'],'UserId':null}})[_0x647d('0x3c')](handleEntityNotFound(_0x23b16a,null))['then'](function(_0x50bdbb){if(_0x50bdbb){_0x4d0268[_0x647d('0x2c')]=_0x50bdbb[_0x647d('0x67')]({'plain':!![]});return db[_0x647d('0x68')][_0x647d('0x5d')]({'where':{'id':_0x50bdbb[_0x647d('0x69')]}});}return null;})[_0x647d('0x3c')](handleEntityNotFound(_0x23b16a,null))[_0x647d('0x3c')](function(_0x5aa531){if(_0x5aa531){_0x4d0268[_0x647d('0x6e')]=_0x5aa531[_0x647d('0x67')]({'plain':!![]});interaction_log[_0x647d('0x26')](_0x647d('0x83'),_0x583db3['user']['id'],_0x583db3[_0x647d('0x65')]['name'],_0x583db3[_0x647d('0x65')][_0x647d('0x6f')],_0x4d0268[_0x647d('0x6e')]['id'],_0x583db3['body']?JSON[_0x647d('0x29')](_0x583db3[_0x647d('0x5f')]):_0x647d('0x70'));return respondWithRpcPromise(_0x647d('0x84'),'rejectMessage',_0x4d0268);}return null;})[_0x647d('0x3c')](function(_0x4e1156){var _0x1d0089=_0x647d('0x73')+_0x4e1156[_0x647d('0x2c')][_0x647d('0x74')];return db[_0x647d('0x75')][_0x647d('0x47')](_0x1d0089,{'type':db[_0x647d('0x76')][_0x647d('0x77')][_0x647d('0x78')],'raw':!![]})[_0x647d('0x3c')](function(_0x357e6e){return _0x357e6e;});})['then'](function(_0x5bffda){if(_0x5bffda){_0x4d0268['message'][_0x647d('0x85')]=_0x5bffda[0x0];if(!_0x583db3[_0x647d('0x5f')][_0x647d('0x64')])return;return db[_0x647d('0x79')][_0x647d('0x5d')]({'where':{'id':_0x583db3[_0x647d('0x5f')][_0x647d('0x64')],'role':_0x647d('0x66')},'attributes':['id',_0x647d('0x3e'),_0x647d('0x7a'),_0x647d('0x86'),_0x647d('0x87')],'raw':!![]});}return null;})['then'](function(_0x364df6){if(!_0x364df6)return null;_0x4d0268[_0x647d('0x2c')][_0x647d('0x66')]=_0x364df6;return _0x4d0268;})['then'](function(_0x3bfed0){if(_0x3bfed0){_0x3bfed0[_0x647d('0x2c')][_0x647d('0x7c')]=util['format'](_0x647d('0x7d'),_0x583db3[_0x647d('0x65')][_0x647d('0x3e')]);_0x3bfed0['message'][_0x647d('0x7e')]=_0x4d0268[_0x647d('0x7e')];_0x3bfed0[_0x647d('0x2c')][_0x647d('0x7f')]=_0x4d0268[_0x647d('0x7e')];_0x3bfed0['message'][_0x647d('0x80')]=_0x647d('0x38');respondWithRpcPromise(_0x647d('0x81'),'EventManager',{'event':'rejectmessage','message':_0x3bfed0['message']},client9002);return _0x4d0268;}return null;})[_0x647d('0x3c')](respondWithResult(_0x23b16a,null))[_0x647d('0x2e')](handleError(_0x23b16a,null));};exports[_0x647d('0x30')]=function(_0x406714,_0x1681b9,_0x154f7b){if(_0x406714['body']['id']){delete _0x406714[_0x647d('0x5f')]['id'];}var _0x1c6b9b;return db[_0x647d('0x41')][_0x647d('0x5d')]({'where':{'id':_0x406714[_0x647d('0x5a')]['id']}})[_0x647d('0x3c')](handleEntityNotFound(_0x1681b9,null))['then'](function(_0x57f4eb){if(_0x57f4eb){_0x1c6b9b=_0x57f4eb;return db[_0x647d('0x88')][_0x647d('0x5d')]({'where':{'id':_0x57f4eb[_0x647d('0x89')]}});}})[_0x647d('0x3c')](handleEntityNotFound(_0x1681b9,null))[_0x647d('0x3c')](function(_0x14f996){if(_0x14f996){logger[_0x647d('0x8a')](_0x647d('0x8b'),_0x647d('0x30'),_0x647d('0x8c'),_0x14f996[_0x647d('0x44')],util[_0x647d('0x8d')](_0x406714[_0x647d('0x5f')],{'showHidden':![],'depth':null}));switch(_0x14f996[_0x647d('0x44')]){case _0x647d('0x8e'):if(_0x406714[_0x647d('0x5f')][_0x647d('0x8f')]&&_0x406714['body']['MessageSid']===_0x1c6b9b[_0x647d('0x90')]){return _0x1c6b9b[_0x647d('0x3a')]({'read':!![]});}else{logger[_0x647d('0x2a')](_0x647d('0x91'),_0x647d('0x30'),_0x647d('0x8e'),util[_0x647d('0x8d')](_0x406714[_0x647d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x647d('0x92'):if(_0x406714[_0x647d('0x5f')][_0x647d('0x93')]&&_0x406714[_0x647d('0x5f')]['MessageUUID']===_0x1c6b9b[_0x647d('0x90')]&&_[_0x647d('0x94')]([_0x647d('0x95'),_0x647d('0x96')],_0x406714[_0x647d('0x5f')][_0x647d('0x97')])>=0x0){return _0x1c6b9b['update']({'read':!![]});}else{logger[_0x647d('0x2a')](_0x647d('0x91'),'status','plivio',util[_0x647d('0x8d')](_0x406714[_0x647d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x647d('0x98'):var _0x20d8fd=_0x406714[_0x647d('0x5f')][_0x647d('0x99')][0x0];if(_0x20d8fd[_0x647d('0x30')][_0x647d('0x9a')]===_0x647d('0x9b')){return _0x1c6b9b[_0x647d('0x3a')]({'read':!![]});}else{logger[_0x647d('0x2a')](_0x647d('0x91'),_0x647d('0x30'),_0x647d('0x98'),util['inspect'](_0x406714[_0x647d('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x1c6b9b;}})[_0x647d('0x3c')](respondWithResult(_0x1681b9,null))[_0x647d('0x2e')](handleError(_0x1681b9,null));}; \ No newline at end of file +var _0x4f3d=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','params','keys','include','find','create','body','update','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','manual','format','channel','motionChannel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','internal','interface','event','rejectmessage','SmsAccount','SmsAccountId','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','delivered','Status','plivio','infobip','groupName','DELIVERED','eml-format','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','stack','name','send','index','SmsMessage','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x241bcc,_0x52d353){var _0x35f3a4=function(_0x6721d1){while(--_0x6721d1){_0x241bcc['push'](_0x241bcc['shift']());}};_0x35f3a4(++_0x52d353);}(_0x4f3d,0x171));var _0xd4f3=function(_0x563152,_0x1f71cf){_0x563152=_0x563152-0x0;var _0xe7ffd3=_0x4f3d[_0x563152];return _0xe7ffd3;};'use strict';var emlformat=require(_0xd4f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4f3('0x1'));var jsonpatch=require(_0xd4f3('0x2'));var rp=require(_0xd4f3('0x3'));var moment=require(_0xd4f3('0x4'));var BPromise=require(_0xd4f3('0x5'));var Mustache=require('mustache');var util=require(_0xd4f3('0x6'));var path=require(_0xd4f3('0x7'));var sox=require(_0xd4f3('0x8'));var csv=require(_0xd4f3('0x9'));var ejs=require(_0xd4f3('0xa'));var fs=require('fs');var fs_extra=require(_0xd4f3('0xb'));var _=require(_0xd4f3('0xc'));var squel=require(_0xd4f3('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4f3('0xe'));var deskjs=require(_0xd4f3('0xf'));var toCsv=require(_0xd4f3('0x9'));var querystring=require(_0xd4f3('0x10'));var Papa=require(_0xd4f3('0x11'));var Redis=require(_0xd4f3('0x12'));var authService=require(_0xd4f3('0x13'));var qs=require(_0xd4f3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4f3('0x15'));var logger=require(_0xd4f3('0x16'))('api');var utils=require(_0xd4f3('0x17'));var config=require(_0xd4f3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4f3('0x19'))['db'];config[_0xd4f3('0x1a')]=_['defaults'](config['redis'],{'host':_0xd4f3('0x1b'),'port':0x18eb});var socket=require(_0xd4f3('0x1c'))(new Redis(config['redis']));require(_0xd4f3('0x1d'))[_0xd4f3('0x1e')](socket);var jayson=require(_0xd4f3('0x1f'));var client=jayson[_0xd4f3('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xd4f3('0x20')][_0xd4f3('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xdee08d,_0x25a89d,_0x340498,_0x3d64a6){return new BPromise(function(_0x2b3a23,_0x2ad6e2){var _0x2c0292=_0x3d64a6||client;return _0x2c0292['request'](_0xdee08d,_0x340498)[_0xd4f3('0x22')](function(_0x566e40){logger[_0xd4f3('0x23')](_0xd4f3('0x24'),_0x25a89d,_0xd4f3('0x25'));logger[_0xd4f3('0x26')](_0xd4f3('0x27'),_0x25a89d,_0xd4f3('0x25'),JSON['stringify'](_0x566e40));if(_0x566e40[_0xd4f3('0x28')]){if(_0x566e40[_0xd4f3('0x28')][_0xd4f3('0x29')]===0x1f4){logger[_0xd4f3('0x28')](_0xd4f3('0x24'),_0x25a89d,_0x566e40['error']['message']);return _0x2ad6e2(_0x566e40['error']['message']);}logger['error'](_0xd4f3('0x24'),_0x25a89d,_0x566e40[_0xd4f3('0x28')]['message']);return _0x2b3a23(_0x566e40[_0xd4f3('0x28')][_0xd4f3('0x2a')]);}else{logger['info'](_0xd4f3('0x24'),_0x25a89d,_0xd4f3('0x25'));_0x2b3a23(_0x566e40[_0xd4f3('0x2b')][_0xd4f3('0x2a')]);}})[_0xd4f3('0x2c')](function(_0x31da07){logger[_0xd4f3('0x28')]('SmsMessage,\x20%s,\x20%s',_0x25a89d,_0x31da07);_0x2ad6e2(_0x31da07);});});}function respondWithStatusCode(_0x1aac38,_0x38dff7){_0x38dff7=_0x38dff7||0xcc;return function(_0x55278c){if(_0x55278c){return _0x1aac38[_0xd4f3('0x2d')](_0x38dff7);}return _0x1aac38[_0xd4f3('0x2e')](_0x38dff7)[_0xd4f3('0x2f')]();};}function respondWithResult(_0x2e6172,_0x53ac0c){_0x53ac0c=_0x53ac0c||0xc8;return function(_0x58dd3f){if(_0x58dd3f){return _0x2e6172['status'](_0x53ac0c)[_0xd4f3('0x30')](_0x58dd3f);}};}function respondWithFilteredResult(_0x560bb3,_0x907989){return function(_0x567404){if(_0x567404){var _0x152426=typeof _0x907989['offset']===_0xd4f3('0x31')&&typeof _0x907989[_0xd4f3('0x32')]==='undefined';var _0x258788=_0x567404[_0xd4f3('0x33')];var _0x447b86=_0x152426?0x0:_0x907989[_0xd4f3('0x34')];var _0x3c4c49=_0x152426?_0x567404[_0xd4f3('0x33')]:_0x907989[_0xd4f3('0x34')]+_0x907989[_0xd4f3('0x32')];var _0x21c129;if(_0x3c4c49>=_0x258788){_0x3c4c49=_0x258788;_0x21c129=0xc8;}else{_0x21c129=0xce;}_0x560bb3[_0xd4f3('0x2e')](_0x21c129);return _0x560bb3[_0xd4f3('0x35')](_0xd4f3('0x36'),_0x447b86+'-'+_0x3c4c49+'/'+_0x258788)['json'](_0x567404);}return null;};}function patchUpdates(_0x3f5aa0){return function(_0x32edc9){try{jsonpatch['apply'](_0x32edc9,_0x3f5aa0,!![]);}catch(_0x399dff){return BPromise[_0xd4f3('0x37')](_0x399dff);}return _0x32edc9[_0xd4f3('0x38')]();};}function saveUpdates(_0xe995b4,_0xf317f7){return function(_0x4c37f7){if(_0x4c37f7){return _0x4c37f7['update'](_0xe995b4)['then'](function(_0x17d39b){return _0x17d39b;});}return null;};}function removeEntity(_0xd5a9be,_0x580fc9){return function(_0x255cdb){if(_0x255cdb){return _0x255cdb['destroy']()[_0xd4f3('0x22')](function(){_0xd5a9be[_0xd4f3('0x2e')](0xcc)[_0xd4f3('0x2f')]();});}};}function handleEntityNotFound(_0x4ea095,_0x466620){return function(_0x4c5473){if(!_0x4c5473){_0x4ea095[_0xd4f3('0x2d')](0x194);}return _0x4c5473;};}function handleError(_0x17de9a,_0x388217){_0x388217=_0x388217||0x1f4;return function(_0x5274aa){logger[_0xd4f3('0x28')](_0x5274aa[_0xd4f3('0x39')]);if(_0x5274aa[_0xd4f3('0x3a')]){delete _0x5274aa[_0xd4f3('0x3a')];}_0x17de9a[_0xd4f3('0x2e')](_0x388217)[_0xd4f3('0x3b')](_0x5274aa);};}exports[_0xd4f3('0x3c')]=function(_0x41d25f,_0x187814){var _0x4a2e62={},_0x18aa55={},_0x44068e={'count':0x0,'rows':[]};var _0x4978af=_['map'](db[_0xd4f3('0x3d')][_0xd4f3('0x3e')],function(_0x30cf0b){return{'name':_0x30cf0b['fieldName'],'type':_0x30cf0b[_0xd4f3('0x3f')][_0xd4f3('0x40')]};});_0x18aa55[_0xd4f3('0x41')]=_[_0xd4f3('0x42')](_0x4978af,_0xd4f3('0x3a'));_0x18aa55[_0xd4f3('0x43')]=_['keys'](_0x41d25f[_0xd4f3('0x43')]);_0x18aa55[_0xd4f3('0x44')]=_[_0xd4f3('0x45')](_0x18aa55[_0xd4f3('0x41')],_0x18aa55[_0xd4f3('0x43')]);_0x4a2e62[_0xd4f3('0x46')]=_['intersection'](_0x18aa55[_0xd4f3('0x41')],qs[_0xd4f3('0x47')](_0x41d25f[_0xd4f3('0x43')][_0xd4f3('0x47')]));_0x4a2e62[_0xd4f3('0x46')]=_0x4a2e62['attributes'][_0xd4f3('0x48')]?_0x4a2e62[_0xd4f3('0x46')]:_0x18aa55[_0xd4f3('0x41')];if(!_0x41d25f[_0xd4f3('0x43')][_0xd4f3('0x49')](_0xd4f3('0x4a'))){_0x4a2e62['limit']=qs[_0xd4f3('0x32')](_0x41d25f['query'][_0xd4f3('0x32')]);_0x4a2e62[_0xd4f3('0x34')]=qs[_0xd4f3('0x34')](_0x41d25f[_0xd4f3('0x43')][_0xd4f3('0x34')]);}_0x4a2e62[_0xd4f3('0x4b')]=qs[_0xd4f3('0x4c')](_0x41d25f[_0xd4f3('0x43')][_0xd4f3('0x4c')]);_0x4a2e62[_0xd4f3('0x4d')]=qs['filters'](_[_0xd4f3('0x4e')](_0x41d25f[_0xd4f3('0x43')],_0x18aa55['filters']),_0x4978af);if(_0x41d25f[_0xd4f3('0x43')][_0xd4f3('0x4f')]){_0x4a2e62['where']=_['merge'](_0x4a2e62[_0xd4f3('0x4d')],{'$or':_[_0xd4f3('0x42')](_0x4978af,function(_0x274ef6){if(_0x274ef6[_0xd4f3('0x3f')]!=='VIRTUAL'){var _0x291f9b={};_0x291f9b[_0x274ef6[_0xd4f3('0x3a')]]={'$like':'%'+_0x41d25f[_0xd4f3('0x43')][_0xd4f3('0x4f')]+'%'};return _0x291f9b;}})});}_0x4a2e62=_[_0xd4f3('0x50')]({},_0x4a2e62,_0x41d25f[_0xd4f3('0x51')]);var _0x458938={'where':_0x4a2e62[_0xd4f3('0x4d')]};return db[_0xd4f3('0x3d')][_0xd4f3('0x33')](_0x458938)[_0xd4f3('0x22')](function(_0x20968b){_0x44068e[_0xd4f3('0x33')]=_0x20968b;if(_0x41d25f['query'][_0xd4f3('0x52')]){_0x4a2e62['include']=[{'all':!![]}];}return db[_0xd4f3('0x3d')][_0xd4f3('0x53')](_0x4a2e62);})['then'](function(_0x3f9841){_0x44068e['rows']=_0x3f9841;return _0x44068e;})[_0xd4f3('0x22')](respondWithFilteredResult(_0x187814,_0x4a2e62))[_0xd4f3('0x2c')](handleError(_0x187814,null));};exports['show']=function(_0x225972,_0x15c6f4){var _0x28085f={'raw':!![],'where':{'id':_0x225972[_0xd4f3('0x54')]['id']}},_0x49ce83={};_0x49ce83[_0xd4f3('0x41')]=_[_0xd4f3('0x55')](db['SmsMessage']['rawAttributes']);_0x49ce83['query']=_[_0xd4f3('0x55')](_0x225972['query']);_0x49ce83[_0xd4f3('0x44')]=_[_0xd4f3('0x45')](_0x49ce83['model'],_0x49ce83[_0xd4f3('0x43')]);_0x28085f[_0xd4f3('0x46')]=_[_0xd4f3('0x45')](_0x49ce83['model'],qs[_0xd4f3('0x47')](_0x225972[_0xd4f3('0x43')][_0xd4f3('0x47')]));_0x28085f['attributes']=_0x28085f[_0xd4f3('0x46')][_0xd4f3('0x48')]?_0x28085f[_0xd4f3('0x46')]:_0x49ce83[_0xd4f3('0x41')];if(_0x225972['query'][_0xd4f3('0x52')]){_0x28085f[_0xd4f3('0x56')]=[{'all':!![]}];}_0x28085f=_['merge']({},_0x28085f,_0x225972[_0xd4f3('0x51')]);return db[_0xd4f3('0x3d')][_0xd4f3('0x57')](_0x28085f)[_0xd4f3('0x22')](handleEntityNotFound(_0x15c6f4,null))[_0xd4f3('0x22')](respondWithResult(_0x15c6f4,null))[_0xd4f3('0x2c')](handleError(_0x15c6f4,null));};exports[_0xd4f3('0x58')]=function(_0x492772,_0xfce22e){return db[_0xd4f3('0x3d')][_0xd4f3('0x58')](_0x492772[_0xd4f3('0x59')],{})['then'](respondWithResult(_0xfce22e,0xc9))[_0xd4f3('0x2c')](handleError(_0xfce22e,null));};exports[_0xd4f3('0x5a')]=function(_0x205e54,_0x357ada){if(_0x205e54[_0xd4f3('0x59')]['id']){delete _0x205e54[_0xd4f3('0x59')]['id'];}return db[_0xd4f3('0x3d')][_0xd4f3('0x57')]({'where':{'id':_0x205e54[_0xd4f3('0x54')]['id']}})[_0xd4f3('0x22')](handleEntityNotFound(_0x357ada,null))[_0xd4f3('0x22')](saveUpdates(_0x205e54[_0xd4f3('0x59')],null))['then'](respondWithResult(_0x357ada,null))[_0xd4f3('0x2c')](handleError(_0x357ada,null));};exports['destroy']=function(_0x19ddcd,_0x4bb8e5){return db[_0xd4f3('0x3d')][_0xd4f3('0x57')]({'where':{'id':_0x19ddcd['params']['id']}})[_0xd4f3('0x22')](handleEntityNotFound(_0x4bb8e5,null))['then'](removeEntity(_0x4bb8e5,null))[_0xd4f3('0x2c')](handleError(_0x4bb8e5,null));};exports['describe']=function(_0x3df7d6,_0x35064a){return db[_0xd4f3('0x3d')]['describe']()['then'](respondWithResult(_0x35064a,null))[_0xd4f3('0x2c')](handleError(_0x35064a,null));};var interaction_log=require(_0xd4f3('0x16'))(_0xd4f3('0x5b'));exports[_0xd4f3('0x5c')]=function(_0x1042a2,_0x4b0a9c,_0x21c490){var _0x4f1550={'agent':{},'channel':_0xd4f3('0x5d')};if(_0x1042a2[_0xd4f3('0x59')]['id']){delete _0x1042a2['body']['id'];}_0x1042a2[_0xd4f3('0x59')][_0xd4f3('0x5e')]=!![];_0x1042a2[_0xd4f3('0x59')][_0xd4f3('0x5f')]=moment()['format'](_0xd4f3('0x60'));_0x1042a2['body'][_0xd4f3('0x61')]=_0x1042a2['body'][_0xd4f3('0x61')]||_0x1042a2[_0xd4f3('0x62')]['id'];_0x4f1550[_0xd4f3('0x63')]['id']=_0x1042a2[_0xd4f3('0x59')][_0xd4f3('0x61')];return db['SmsMessage'][_0xd4f3('0x57')]({'where':{'id':_0x1042a2['params']['id'],'UserId':null}})[_0xd4f3('0x22')](handleEntityNotFound(_0x4b0a9c,null))[_0xd4f3('0x22')](saveUpdates(_0x1042a2[_0xd4f3('0x59')],null))[_0xd4f3('0x22')](function(_0x2dd888){if(_0x2dd888){_0x4f1550['message']=_0x2dd888['get']({'plain':!![]});return db[_0xd4f3('0x64')][_0xd4f3('0x57')]({'where':{'id':_0x2dd888[_0xd4f3('0x65')]}});}return null;})[_0xd4f3('0x22')](handleEntityNotFound(_0x4b0a9c,null))['then'](function(_0x3d6ca4){if(_0x3d6ca4){return _0x3d6ca4[_0xd4f3('0x5a')]({'UserId':_0x1042a2[_0xd4f3('0x59')][_0xd4f3('0x61')],'read1stAt':_['isNil'](_0x3d6ca4[_0xd4f3('0x66')])?moment()['format'](_0xd4f3('0x60')):undefined});}return null;})['then'](function(_0x1ac7c7){if(_0x1ac7c7){_0x4f1550[_0xd4f3('0x67')]=_0x1ac7c7[_0xd4f3('0x68')]({'plain':!![]});interaction_log[_0xd4f3('0x23')](_0xd4f3('0x69'),_0x1042a2[_0xd4f3('0x62')]['id'],_0x1042a2[_0xd4f3('0x62')][_0xd4f3('0x3a')],_0x1042a2['user'][_0xd4f3('0x6a')],_0x4f1550['interaction']['id'],_0x1042a2[_0xd4f3('0x59')]?JSON[_0xd4f3('0x6b')](_0x1042a2[_0xd4f3('0x59')]):_0xd4f3('0x6c'));return respondWithRpcPromise(_0xd4f3('0x6d'),_0xd4f3('0x6e'),_0x4f1550);}return null;})[_0xd4f3('0x22')](function(_0x158703){var _0x79b057=_0xd4f3('0x6f')+_0x158703[_0xd4f3('0x2a')]['ContactId'];return db[_0xd4f3('0x70')][_0xd4f3('0x43')](_0x79b057,{'type':db[_0xd4f3('0x71')][_0xd4f3('0x72')][_0xd4f3('0x73')],'raw':!![]})[_0xd4f3('0x22')](function(_0x27aee1){return _0x27aee1;});})[_0xd4f3('0x22')](function(_0x1662ea){if(_0x1662ea){_0x4f1550['message']['contact']=_0x1662ea[0x0];if(!_0x1042a2[_0xd4f3('0x59')][_0xd4f3('0x61')])return;return db['User'][_0xd4f3('0x57')]({'where':{'id':_0x1042a2[_0xd4f3('0x59')]['UserId'],'role':_0xd4f3('0x63')},'attributes':['id','name',_0xd4f3('0x74'),_0xd4f3('0x75'),'internal'],'raw':!![]});}return null;})[_0xd4f3('0x22')](function(_0x26625c){if(!_0x26625c)return null;_0x4f1550[_0xd4f3('0x2a')][_0xd4f3('0x63')]=_0x26625c;return _0x4f1550;})[_0xd4f3('0x22')](function(_0x429bff){if(_0x429bff){if(_0x1042a2[_0xd4f3('0x59')][_0xd4f3('0x76')]){_0x4f1550['message']['interface']=util[_0xd4f3('0x77')]('SIP/%s',_0x1042a2[_0xd4f3('0x62')]['name']);_0x4f1550['message'][_0xd4f3('0x78')]=_0x4f1550['channel'];_0x4f1550[_0xd4f3('0x2a')][_0xd4f3('0x79')]=_0x4f1550['channel'];_0x4f1550[_0xd4f3('0x2a')]['event']=_0xd4f3('0x5c');return respondWithRpcPromise(_0xd4f3('0x7a'),_0xd4f3('0x7a'),{'event':_0xd4f3('0x7b'),'message':_0x4f1550[_0xd4f3('0x2a')]},client9002)[_0xd4f3('0x22')](function(){return _0x4f1550;});}return _0x4f1550;}return null;})[_0xd4f3('0x22')](respondWithResult(_0x4b0a9c,null))[_0xd4f3('0x2c')](handleError(_0x4b0a9c,null));};var interaction_log=require(_0xd4f3('0x16'))(_0xd4f3('0x5b'));exports[_0xd4f3('0x37')]=function(_0x236d3e,_0x1e814c,_0x198c8e){var _0x18c573={'agent':{},'channel':'sms'};if(_0x236d3e[_0xd4f3('0x59')]['id']){delete _0x236d3e[_0xd4f3('0x59')]['id'];}_0x236d3e[_0xd4f3('0x59')][_0xd4f3('0x61')]=_0x236d3e[_0xd4f3('0x59')][_0xd4f3('0x61')]||_0x236d3e[_0xd4f3('0x62')]['id'];_0x18c573[_0xd4f3('0x63')]['id']=_0x236d3e['body'][_0xd4f3('0x61')];return db[_0xd4f3('0x3d')][_0xd4f3('0x57')]({'where':{'id':_0x236d3e['params']['id'],'UserId':null}})[_0xd4f3('0x22')](handleEntityNotFound(_0x1e814c,null))[_0xd4f3('0x22')](function(_0x56b628){if(_0x56b628){_0x18c573[_0xd4f3('0x2a')]=_0x56b628[_0xd4f3('0x68')]({'plain':!![]});return db[_0xd4f3('0x64')][_0xd4f3('0x57')]({'where':{'id':_0x56b628[_0xd4f3('0x65')]}});}return null;})[_0xd4f3('0x22')](handleEntityNotFound(_0x1e814c,null))['then'](function(_0x49a706){if(_0x49a706){_0x18c573[_0xd4f3('0x67')]=_0x49a706[_0xd4f3('0x68')]({'plain':!![]});interaction_log[_0xd4f3('0x23')](_0xd4f3('0x7c'),_0x236d3e[_0xd4f3('0x62')]['id'],_0x236d3e[_0xd4f3('0x62')]['name'],_0x236d3e[_0xd4f3('0x62')][_0xd4f3('0x6a')],_0x18c573[_0xd4f3('0x67')]['id'],_0x236d3e[_0xd4f3('0x59')]?JSON[_0xd4f3('0x6b')](_0x236d3e['body']):_0xd4f3('0x6c'));return respondWithRpcPromise(_0xd4f3('0x7d'),_0xd4f3('0x7e'),_0x18c573);}return null;})['then'](function(_0x531836){var _0x19f112='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x531836[_0xd4f3('0x2a')][_0xd4f3('0x7f')];return db[_0xd4f3('0x70')]['query'](_0x19f112,{'type':db['Sequelize'][_0xd4f3('0x72')]['SELECT'],'raw':!![]})[_0xd4f3('0x22')](function(_0x21416f){return _0x21416f;});})[_0xd4f3('0x22')](function(_0x21fd43){if(_0x21fd43){_0x18c573[_0xd4f3('0x2a')][_0xd4f3('0x80')]=_0x21fd43[0x0];if(!_0x236d3e[_0xd4f3('0x59')][_0xd4f3('0x61')])return;return db['User'][_0xd4f3('0x57')]({'where':{'id':_0x236d3e['body'][_0xd4f3('0x61')],'role':_0xd4f3('0x63')},'attributes':['id',_0xd4f3('0x3a'),_0xd4f3('0x74'),_0xd4f3('0x75'),_0xd4f3('0x81')],'raw':!![]});}return null;})[_0xd4f3('0x22')](function(_0x470e01){if(!_0x470e01)return null;_0x18c573[_0xd4f3('0x2a')][_0xd4f3('0x63')]=_0x470e01;return _0x18c573;})[_0xd4f3('0x22')](function(_0x3888ea){if(_0x3888ea){_0x3888ea[_0xd4f3('0x2a')][_0xd4f3('0x82')]=util[_0xd4f3('0x77')]('SIP/%s',_0x236d3e[_0xd4f3('0x62')][_0xd4f3('0x3a')]);_0x3888ea['message'][_0xd4f3('0x78')]=_0x18c573[_0xd4f3('0x78')];_0x3888ea['message'][_0xd4f3('0x79')]=_0x18c573[_0xd4f3('0x78')];_0x3888ea['message'][_0xd4f3('0x83')]=_0xd4f3('0x37');respondWithRpcPromise(_0xd4f3('0x7a'),_0xd4f3('0x7a'),{'event':_0xd4f3('0x84'),'message':_0x3888ea[_0xd4f3('0x2a')]},client9002);return _0x18c573;}return null;})[_0xd4f3('0x22')](respondWithResult(_0x1e814c,null))[_0xd4f3('0x2c')](handleError(_0x1e814c,null));};exports[_0xd4f3('0x2e')]=function(_0x2e6c3a,_0x4804f9,_0x4a7026){if(_0x2e6c3a[_0xd4f3('0x59')]['id']){delete _0x2e6c3a[_0xd4f3('0x59')]['id'];}var _0x1a0926;return db[_0xd4f3('0x3d')][_0xd4f3('0x57')]({'where':{'id':_0x2e6c3a[_0xd4f3('0x54')]['id']}})[_0xd4f3('0x22')](handleEntityNotFound(_0x4804f9,null))['then'](function(_0x4df32f){if(_0x4df32f){_0x1a0926=_0x4df32f;return db[_0xd4f3('0x85')][_0xd4f3('0x57')]({'where':{'id':_0x4df32f[_0xd4f3('0x86')]}});}})[_0xd4f3('0x22')](handleEntityNotFound(_0x4804f9,null))[_0xd4f3('0x22')](function(_0x283e96){if(_0x283e96){logger[_0xd4f3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x283e96['type'],util['inspect'](_0x2e6c3a['body'],{'showHidden':![],'depth':null}));switch(_0x283e96[_0xd4f3('0x3f')]){case'twilio':if(_0x2e6c3a[_0xd4f3('0x59')][_0xd4f3('0x87')]&&_0x2e6c3a[_0xd4f3('0x59')][_0xd4f3('0x87')]===_0x1a0926['messageId']){return _0x1a0926['update']({'read':!![]});}else{logger[_0xd4f3('0x28')](_0xd4f3('0x88'),_0xd4f3('0x2e'),'twilio',util[_0xd4f3('0x89')](_0x2e6c3a[_0xd4f3('0x59')],{'showHidden':![],'depth':null}));}break;case _0xd4f3('0x8a'):if(_0x2e6c3a['body'][_0xd4f3('0x8b')]&&_0x2e6c3a[_0xd4f3('0x59')][_0xd4f3('0x8b')]===_0x1a0926[_0xd4f3('0x8c')]&&_['indexOf'](['sent',_0xd4f3('0x8d')],_0x2e6c3a['body'][_0xd4f3('0x8e')])>=0x0){return _0x1a0926[_0xd4f3('0x5a')]({'read':!![]});}else{logger[_0xd4f3('0x28')](_0xd4f3('0x88'),_0xd4f3('0x2e'),_0xd4f3('0x8f'),util['inspect'](_0x2e6c3a[_0xd4f3('0x59')],{'showHidden':![],'depth':null}));}break;case _0xd4f3('0x90'):var _0x38f872=_0x2e6c3a[_0xd4f3('0x59')]['results'][0x0];if(_0x38f872['status'][_0xd4f3('0x91')]===_0xd4f3('0x92')){return _0x1a0926['update']({'read':!![]});}else{logger[_0xd4f3('0x28')](_0xd4f3('0x88'),_0xd4f3('0x2e'),_0xd4f3('0x90'),util[_0xd4f3('0x89')](_0x2e6c3a[_0xd4f3('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1a0926;}})[_0xd4f3('0x22')](respondWithResult(_0x4804f9,null))['catch'](handleError(_0x4804f9,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f0cf77f..4f36917 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 _0xc608=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0xc608,0x6e));var _0x8c60=function(_0x4bbdbf,_0x47bae1){_0x4bbdbf=_0x4bbdbf-0x0;var _0x10c49b=_0xc608[_0x4bbdbf];return _0x10c49b;};'use strict';var EventEmitter=require(_0x8c60('0x0'));var SmsMessage=require(_0x8c60('0x1'))['db'][_0x8c60('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8c60('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8c60('0x4')};function emitEvent(_0x5bf8cf){return function(_0x40edab,_0x200583,_0x36f376){SmsMessageEvents['emit'](_0x5bf8cf+':'+_0x40edab['id'],_0x40edab);SmsMessageEvents[_0x8c60('0x5')](_0x5bf8cf,_0x40edab);_0x36f376(null);};}for(var e in events){if(events[_0x8c60('0x6')](e)){var event=events[e];SmsMessage[_0x8c60('0x7')](e,emitEvent(event));}}module[_0x8c60('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x9c0e=['exports','events','SmsMessage','save','remove','emit','hasOwnProperty','hook'];(function(_0x3faee1,_0x3a96ea){var _0xc6c957=function(_0x364d45){while(--_0x364d45){_0x3faee1['push'](_0x3faee1['shift']());}};_0xc6c957(++_0x3a96ea);}(_0x9c0e,0xd1));var _0xe9c0=function(_0x4f87bc,_0x4658be){_0x4f87bc=_0x4f87bc-0x0;var _0x106750=_0x9c0e[_0x4f87bc];return _0x106750;};'use strict';var EventEmitter=require(_0xe9c0('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xe9c0('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe9c0('0x2'),'afterUpdate':'update','afterDestroy':_0xe9c0('0x3')};function emitEvent(_0x2e2d62){return function(_0x1fdff6,_0x3e61b7,_0x52911c){SmsMessageEvents[_0xe9c0('0x4')](_0x2e2d62+':'+_0x1fdff6['id'],_0x1fdff6);SmsMessageEvents[_0xe9c0('0x4')](_0x2e2d62,_0x1fdff6);_0x52911c(null);};}for(var e in events){if(events[_0xe9c0('0x5')](e)){var event=events[e];SmsMessage[_0xe9c0('0x6')](e,emitEvent(event));}}module[_0xe9c0('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 88da3c0..a2e7841 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 _0x1408=['bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','username','password','smsMethod','sender','&password=','GET','sms','user_key','session_key','total_sent','deliveryReport','read','senderString','requestid','update','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','POST','Basic\x20%s','toString','http_code','data','queued_count','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId'];(function(_0x5d69bb,_0x133ea5){var _0x136b02=function(_0xd3e4ca){while(--_0xd3e4ca){_0x5d69bb['push'](_0x5d69bb['shift']());}};_0x136b02(++_0x133ea5);}(_0x1408,0x8a));var _0x8140=function(_0x422383,_0x56161f){_0x422383=_0x422383-0x0;var _0x554fe1=_0x1408[_0x422383];return _0x554fe1;};'use strict';var _=require('lodash');var util=require(_0x8140('0x0'));var logger=require('../../config/logger')(_0x8140('0x1'));var moment=require(_0x8140('0x2'));var BPromise=require(_0x8140('0x3'));var rp=require(_0x8140('0x4'));var fs=require('fs');var path=require(_0x8140('0x5'));var rimraf=require('rimraf');var config=require(_0x8140('0x6'));var attributes=require(_0x8140('0x7'));module[_0x8140('0x8')]=function(_0x1a802c,_0x4208a5){return _0x1a802c[_0x8140('0x9')](_0x8140('0xa'),attributes,{'tableName':_0x8140('0xb'),'paranoid':![],'indexes':[{'name':_0x8140('0xc'),'fields':['messageId']},{'name':_0x8140('0xd'),'fields':[_0x8140('0xe')],'type':_0x8140('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b2284,_0x4afd55,_0x7b25b0){var _0x5da2ff=_0x1a802c[_0x8140('0x10')];var _0x49f427=_0x3b2284[_0x8140('0x11')]({'plain':!![]});if(_0x49f427['direction'][_0x8140('0x12')]()==='in'||_0x49f427[_0x8140('0x13')][_0x8140('0x12')]()===_0x8140('0x14')&&!_0x49f427[_0x8140('0x15')]&&!_[_0x8140('0x16')](_0x49f427[_0x8140('0x17')])&&!_['isNil'](_0x49f427[_0x8140('0x18')])){_0x5da2ff[_0x8140('0x19')][_0x8140('0x1a')]({'where':{'id':_0x49f427[_0x8140('0x18')]}})[_0x8140('0x1b')](function(_0x2fe45a){if(_0x2fe45a){_0x2fe45a['update']({'lastMsgAt':_0x49f427[_0x8140('0x1c')],'lastMsgDirection':_0x49f427[_0x8140('0x13')]['toLowerCase']()});}})[_0x8140('0x1d')](function(_0x2f9eb5){console[_0x8140('0x1e')](_0x2f9eb5);});}if(_0x49f427[_0x8140('0x13')]===_0x8140('0x14')&&!_0x49f427[_0x8140('0x15')]){var _0x4346cd;_0x5da2ff['SmsAccount'][_0x8140('0x1f')]({'where':{'id':_0x49f427[_0x8140('0x20')]},'raw':!![]})[_0x8140('0x1b')](function(_0x21df7c){_0x4346cd=_0x21df7c;if(_0x4346cd&&_0x4346cd[_0x8140('0x21')]){switch(_0x4346cd['type']){case _0x8140('0x22'):var _0x593145=require(_0x8140('0x22'));if(_0x4346cd[_0x8140('0x23')]&&_0x4346cd[_0x8140('0x24')]&&_0x4346cd[_0x8140('0x25')]){var _0x424557=new _0x593145(_0x4346cd['accountSid'],_0x4346cd['authToken']);_0x424557[_0x8140('0x26')][_0x8140('0x27')]({'body':_0x49f427[_0x8140('0xe')],'to':_0x49f427['phone'],'from':_0x4346cd['phone'],'statusCallback':_0x4346cd[_0x8140('0x28')]+_0x8140('0x29')+_0x49f427['id']+_0x8140('0x2a')+_0x4346cd[_0x8140('0x2b')]})[_0x8140('0x1b')](function(_0x505073){if(_0x505073[_0x8140('0x2c')]){return _0x3b2284['update']({'messageId':_0x505073[_0x8140('0x2c')]});}})['catch'](function(_0x47bab1){logger[_0x8140('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8140('0x2d'),'twilio',util[_0x8140('0x2e')](_0x47bab1,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x8140('0x30'):var _0x5d8393='https://api.skebby.it/API/v1.0/REST/';if(_0x4346cd[_0x8140('0x31')]&&_0x4346cd[_0x8140('0x32')]){var _0x2f607b={'recipient':[_0x49f427[_0x8140('0x25')]],'message':_0x49f427[_0x8140('0xe')],'message_type':_0x4346cd[_0x8140('0x33')]};if(_0x4346cd[_0x8140('0x33')]&&_0x4346cd[_0x8140('0x33')]!=='SI'){_0x2f607b[_0x8140('0x34')]=_0x4346cd[_0x8140('0x25')];}var _0x27cc78={'url':_0x5d8393+'login?username='+_0x4346cd[_0x8140('0x31')]+_0x8140('0x35')+_0x4346cd[_0x8140('0x32')],'method':_0x8140('0x36')};rp(_0x27cc78)[_0x8140('0x1b')](function(_0x367b7d){var _0x844452=_0x367b7d['split'](';');var _0x2b80b6={'user_key':_0x844452[0x0],'session_key':_0x844452[0x1]};_0x27cc78={'url':_0x5d8393+_0x8140('0x37'),'method':'POST','headers':{'user_key':_0x2b80b6[_0x8140('0x38')],'Session_key':_0x2b80b6[_0x8140('0x39')]},'json':!![],'body':_0x2f607b};return rp(_0x27cc78);})[_0x8140('0x1b')](function(_0x416ecd){if(_0x416ecd[_0x8140('0x3a')]>=0x1){var _0x26b766={'messageId':_0x416ecd['internal_order_id']};if(_0x4346cd[_0x8140('0x33')]!=='GP'||!_0x4346cd[_0x8140('0x3b')]){_0x26b766[_0x8140('0x3c')]=!![];}return _0x3b2284['update'](_0x26b766);}else{return logger['error'](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x30'),util[_0x8140('0x2e')](_0x416ecd,{'showHidden':![],'depth':null}));}})[_0x8140('0x1d')](function(_0x4ec2d5){return logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x30'),util[_0x8140('0x2e')](_0x4ec2d5,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x4346cd[_0x8140('0x24')]){var _0x6098e7={'recipient':_0x49f427[_0x8140('0x25')],'message':_0x49f427[_0x8140('0xe')],'sender':_0x4346cd[_0x8140('0x3d')]||_0x4346cd[_0x8140('0x25')],'authorization':_0x4346cd[_0x8140('0x24')]};var _0x4afd55={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x6098e7,'json':!![]};rp(_0x4afd55)[_0x8140('0x1b')](function(_0xd30256){var _0xb2bac9={'messageId':_0xd30256[_0x8140('0x3e')]};if(!_0x4346cd[_0x8140('0x3b')]){_0xb2bac9[_0x8140('0x3c')]=!![];}return _0x3b2284[_0x8140('0x3f')](_0xb2bac9);})['catch'](function(_0x20a0d1){logger['error'](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x40'),util[_0x8140('0x2e')](_0x20a0d1,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),'connectel',_0x8140('0x41'));}break;case _0x8140('0x42'):if(_0x4346cd[_0x8140('0x31')]&&_0x4346cd[_0x8140('0x32')]){var _0x6098e7={'messages':[{'source':_0x8140('0x43'),'to':_0x49f427['phone'],'body':_0x49f427[_0x8140('0xe')],'from':_0x4346cd[_0x8140('0x3d')]||_0x4346cd[_0x8140('0x25')]}]};var _0x185ee3=util[_0x8140('0x44')](_0x8140('0x45'),_0x4346cd[_0x8140('0x31')],_0x4346cd[_0x8140('0x32')]);var _0x4afd55={'method':_0x8140('0x46'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x6098e7,'headers':{'Authorization':util[_0x8140('0x44')](_0x8140('0x47'),new Buffer(_0x185ee3)[_0x8140('0x48')]('base64'))},'json':!![]};rp(_0x4afd55)['then'](function(_0x2bbcf4){if(_0x2bbcf4[_0x8140('0x49')]>=0xc8&&_0x2bbcf4[_0x8140('0x49')]<=0xce){if(_0x2bbcf4[_0x8140('0x4a')]&&_0x2bbcf4[_0x8140('0x4a')][_0x8140('0x4b')]>0x0){var _0x1ef69d=_['head'](_0x2bbcf4[_0x8140('0x4a')][_0x8140('0x26')]);var _0x2201f2={'messageId':_0x1ef69d['message_id']};if(!_0x4346cd[_0x8140('0x3b')]){_0x2201f2['read']=!![];}return _0x3b2284[_0x8140('0x3f')](_0x2201f2);}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),'clickSend',util[_0x8140('0x2e')](_0x2bbcf4,{'showHidden':![],'depth':null}));}}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),'clickSend',util['inspect'](_0x2bbcf4,{'showHidden':![],'depth':null}));}})[_0x8140('0x1d')](function(_0x51597c){logger[_0x8140('0x1e')](_0x8140('0x2f'),'afterCreate',_0x8140('0x4c'),util[_0x8140('0x2e')](_0x51597c,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x4c'),_0x8140('0x4d'));}break;case _0x8140('0x4e'):if(_0x4346cd['authId']&&_0x4346cd[_0x8140('0x24')]){var _0x6098e7={'dst':_0x49f427[_0x8140('0x25')],'text':_0x49f427[_0x8140('0xe')],'src':_0x4346cd[_0x8140('0x3d')]||_0x4346cd['phone'],'url':_0x4346cd[_0x8140('0x28')]+_0x8140('0x29')+_0x49f427['id']+_0x8140('0x2a')+_0x4346cd['token']};var _0x185ee3=util['format']('%s:%s',_0x4346cd[_0x8140('0x4f')],_0x4346cd[_0x8140('0x24')]);var _0x4afd55={'method':'POST','uri':util[_0x8140('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4346cd[_0x8140('0x4f')]),'body':_0x6098e7,'headers':{'Authorization':util['format'](_0x8140('0x47'),new Buffer(_0x185ee3)[_0x8140('0x48')](_0x8140('0x50')))},'json':!![]};rp(_0x4afd55)['then'](function(_0x4cc6a5){var _0xf12e44={'messageId':_0x4cc6a5[_0x8140('0x51')][0x0]};return _0x3b2284[_0x8140('0x3f')](_0xf12e44);})[_0x8140('0x1d')](function(_0x591ab2){logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x4e'),util[_0x8140('0x2e')](_0x591ab2,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8140('0x2d'),_0x8140('0x4e'),_0x8140('0x52'));}break;case _0x8140('0x53'):if(_0x4346cd[_0x8140('0x31')]&&_0x4346cd[_0x8140('0x32')]){if(_0x4346cd[_0x8140('0x54')]){var _0x3112b6={'method':_0x8140('0x46'),'uri':_0x4346cd[_0x8140('0x54')]+'/auth/1/session','body':{'username':_0x4346cd[_0x8140('0x31')],'password':_0x4346cd[_0x8140('0x32')]},'json':!![]};return rp(_0x3112b6)[_0x8140('0x1b')](function(_0x9b25c6){var _0x37170a={'method':_0x8140('0x46'),'uri':_0x4346cd[_0x8140('0x54')]+_0x8140('0x55'),'body':{'messages':[{'from':_0x4346cd['phone'],'destinations':[{'to':_0x49f427['phone']}],'text':_0x49f427[_0x8140('0xe')],'notifyUrl':_0x4346cd[_0x8140('0x28')]+_0x8140('0x29')+_0x49f427['id']+_0x8140('0x2a')+_0x4346cd[_0x8140('0x2b')],'notifyContentType':_0x8140('0x56'),'callbackData':_0x4346cd[_0x8140('0x25')]+';'+_0x49f427[_0x8140('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x9b25c6[_0x8140('0x2b')]},'json':!![]};return rp(_0x37170a)[_0x8140('0x1b')](function(_0x53b55d){if(_0x53b55d[_0x8140('0x26')]){var _0x79104={'messageId':_0x53b55d[_0x8140('0x26')][0x0]['messageId']};if(!_0x4346cd[_0x8140('0x3b')]){_0x79104[_0x8140('0x3c')]=!![];}return _0x3b2284[_0x8140('0x3f')](_0x79104);}else{return logger[_0x8140('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8140('0x2d'),_0x8140('0x53'),util[_0x8140('0x2e')](_0x53b55d,{'showHidden':![],'depth':null}));}});})[_0x8140('0x1d')](function(_0x21fe3f){return logger['error'](_0x8140('0x2f'),'afterCreate',_0x8140('0x53'),util[_0x8140('0x2e')](_0x21fe3f,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),'afterCreate','infobip',_0x8140('0x57'));}}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x53'),_0x8140('0x4d'));}break;case'csc':var _0x154dec=require(_0x8140('0x58'));if(_0x4346cd[_0x8140('0x59')]){var _0x1bcd9f={};_0x1bcd9f[_0x8140('0x5a')]=_0x4346cd[_0x8140('0x31')];_0x1bcd9f[_0x8140('0x25')]=_0x49f427[_0x8140('0x25')];_0x1bcd9f[_0x8140('0x34')]=_0x4346cd['phone'];_0x1bcd9f[_0x8140('0x5b')]=_0x49f427[_0x8140('0xe')];_0x1bcd9f[_0x8140('0x5c')]=+new Date();var _0x1c0442='';var _0x236c3c='';var _0x352fbe=Object['keys'](_0x1bcd9f);_0x352fbe[_0x8140('0x5d')]();for(var _0x28de33=0x0;_0x28de33<_0x352fbe[_0x8140('0x5e')];_0x28de33++){if(_0x1c0442!=''){_0x1c0442+='&';}_0x1c0442+=_0x352fbe[_0x28de33]+'='+encodeURIComponent(_0x1bcd9f[_0x352fbe[_0x28de33]]);_0x236c3c+=_0x1bcd9f[_0x352fbe[_0x28de33]];}_0x236c3c+=_0x4346cd[_0x8140('0x59')];_0x236c3c=_0x154dec[_0x8140('0x5f')](_0x8140('0x60'))[_0x8140('0x3f')](_0x236c3c)[_0x8140('0x61')]('hex');if(_0x1c0442!==''){_0x1c0442+='&';}_0x1c0442+=_0x8140('0x62')+_0x236c3c;var _0x27cc78={'method':_0x8140('0x36'),'uri':_0x4346cd[_0x8140('0x54')]+_0x8140('0x63')+_0x1c0442,'json':!![]};return rp(_0x27cc78)[_0x8140('0x1b')](function(_0x15de9b){var _0x26a4cd=Object['keys'](_0x15de9b);if(_0x15de9b[_0x26a4cd[0x0]][_0x8140('0x1e')]&&parseInt(_0x15de9b[_0x26a4cd[0x0]]['error'])===0x0){var _0x26a4fa={'messageId':_0x15de9b[_0x26a4cd[0x0]][_0x8140('0x64')]};if(!_0x4346cd[_0x8140('0x3b')]){_0x26a4fa['read']=!![];}return _0x3b2284[_0x8140('0x3f')](_0x26a4fa);}else{return logger[_0x8140('0x1e')](_0x8140('0x2f'),'afterCreate',_0x8140('0x65'),util['inspect'](_0x15de9b[_0x8140('0x1e')],{'showHidden':![],'depth':null}));}})[_0x8140('0x1d')](function(_0x3b5f20){return logger[_0x8140('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x8140('0x2e')](_0x3b5f20,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),'csc',_0x8140('0x66'));}break;case _0x8140('0x67'):if(_0x4346cd[_0x8140('0x59')]){var _0x1f5e93={'method':'POST','uri':_0x8140('0x68'),'headers':{'Authorization':_0x4346cd[_0x8140('0x59')]},'body':{'content':_0x49f427[_0x8140('0xe')],'to':[_0x49f427['phone']],'from':_0x4346cd[_0x8140('0x25')],'binary':![],'clientMessageId':_0x8140('0x69'),'charset':_0x8140('0x6a')},'json':!![]};rp(_0x1f5e93)[_0x8140('0x1b')](function(_0x3ab125){if(!_0x3ab125[_0x8140('0x1e')]){var _0x3a2b3e={'messageId':_0x3ab125[_0x8140('0x26')][0x0][_0x8140('0x6b')]};if(!_0x4346cd[_0x8140('0x3b')]){_0x3a2b3e[_0x8140('0x3c')]=!![];}return _0x3b2284[_0x8140('0x3f')](_0x3a2b3e);}else{return logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x67'),util['inspect'](_0x3ab125[_0x8140('0x1e')],{'showHidden':![],'depth':null}));}})[_0x8140('0x1d')](function(_0x5ae817){return logger[_0x8140('0x1e')](_0x8140('0x2f'),'afterCreate',_0x8140('0x67'),util['inspect'](_0x5ae817,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8140('0x2d'),'clickatell',_0x8140('0x66'));}break;case _0x8140('0x6c'):if(_0x4346cd[_0x8140('0x31')]&&_0x4346cd[_0x8140('0x32')]){var _0x185ee3=util[_0x8140('0x44')](_0x8140('0x45'),_0x4346cd['username'],_0x4346cd[_0x8140('0x32')]);var _0x4afd55={'method':_0x8140('0x46'),'uri':_0x8140('0x6d')+_0x4346cd[_0x8140('0x6e')]+_0x8140('0x6f'),'body':{'to':[_0x49f427[_0x8140('0x25')]],'text':_0x49f427[_0x8140('0xe')],'from':_0x4346cd['phone'],'applicationId':_0x4346cd[_0x8140('0x70')]},'headers':{'Authorization':util[_0x8140('0x44')](_0x8140('0x47'),new Buffer(_0x185ee3)[_0x8140('0x48')](_0x8140('0x50')))},'json':!![]};rp(_0x4afd55)[_0x8140('0x1b')](function(_0x546cff){if(_0x546cff['id']){var _0x4ecaf3={'messageId':_0x546cff['id']};return _0x3b2284[_0x8140('0x3f')](_0x4ecaf3);}else{logger[_0x8140('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8140('0x2d'),_0x8140('0x6c'),util[_0x8140('0x2e')](_0x546cff,{'showHidden':![],'depth':null}));}})[_0x8140('0x1d')](function(_0x1b8419){logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),'bandwidth',util[_0x8140('0x2e')](_0x1b8419,{'showHidden':![],'depth':null}));});}else{logger[_0x8140('0x1e')](_0x8140('0x2f'),'afterCreate','bandwidth',_0x8140('0x4d'));}break;case _0x8140('0x71'):if(_0x4346cd[_0x8140('0x59')]){var _0x3ccd6e={};var _0x27cc78={'method':'POST','uri':_0x8140('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x4346cd['apiKey'],'Content-Type':_0x8140('0x56')},'body':{'from':_0x4346cd[_0x8140('0x25')],'to':_0x49f427[_0x8140('0x25')],'text':_0x49f427[_0x8140('0xe')]},'json':!![]};return rp(_0x27cc78)[_0x8140('0x1b')](function(_0x251b11){if(_0x251b11[_0x8140('0x73')]==0xca){_0x3ccd6e[_0x8140('0x74')]=_0x251b11;var _0x2fe5df={'method':_0x8140('0x46'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x8140('0x75')+_0x4346cd[_0x8140('0x59')],'Content-Type':'application/json'},'body':{'refid':_0x3ccd6e[_0x8140('0x74')][_0x8140('0x76')]},'json':!![]};return rp(_0x2fe5df)[_0x8140('0x1b')](function(_0x1f0b35){_0x3ccd6e[_0x8140('0x77')]=_0x1f0b35;var _0x167d95={'messageId':_0x3ccd6e[_0x8140('0x74')][_0x8140('0x76')],'read':!![]};return _0x3b2284[_0x8140('0x3f')](_0x167d95);});}else{return logger['error'](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x71'),util[_0x8140('0x2e')](_0x251b11,{'showHidden':![],'depth':null}));}})[_0x8140('0x1d')](function(_0x3e1d59){return logger[_0x8140('0x1e')](_0x8140('0x2f'),'afterCreate',_0x8140('0x71'),util[_0x8140('0x2e')](_0x3e1d59,{'showHidden':![],'depth':null}));});}else{return logger[_0x8140('0x1e')](_0x8140('0x2f'),_0x8140('0x2d'),_0x8140('0x71'),'Token\x20not\x20received');}break;}}})[_0x8140('0x78')](function(){_0x7b25b0();});}else{_0x7b25b0();}}},'charset':_0x8140('0x79'),'collate':_0x8140('0x7a')});}; \ No newline at end of file +var _0x1753=['remote','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','authId','/status?token=','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','csc','login','text','timestamp','keys','sort','length','apiKey','digest','hex','signature=','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x1753,0x140));var _0x3175=function(_0x1c5b0a,_0x5a2c37){_0x1c5b0a=_0x1c5b0a-0x0;var _0x26b7d0=_0x1753[_0x1c5b0a];return _0x26b7d0;};'use strict';var _=require(_0x3175('0x0'));var util=require('util');var logger=require(_0x3175('0x1'))('api');var moment=require(_0x3175('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3175('0x3'));var attributes=require(_0x3175('0x4'));module[_0x3175('0x5')]=function(_0xe34e1d,_0x243a72){return _0xe34e1d[_0x3175('0x6')](_0x3175('0x7'),attributes,{'tableName':_0x3175('0x8'),'paranoid':![],'indexes':[{'name':_0x3175('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x3175('0xa')],'type':_0x3175('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ae64b,_0x5d1e80,_0x4a79a2){var _0x412762=_0xe34e1d['models'];var _0x1394f3=_0x1ae64b['get']({'plain':!![]});if(_0x1394f3[_0x3175('0xc')][_0x3175('0xd')]()==='in'||_0x1394f3[_0x3175('0xc')][_0x3175('0xd')]()===_0x3175('0xe')&&!_0x1394f3[_0x3175('0xf')]&&!_[_0x3175('0x10')](_0x1394f3[_0x3175('0x11')])&&!_[_0x3175('0x10')](_0x1394f3[_0x3175('0x12')])){_0x412762[_0x3175('0x13')]['findOne']({'where':{'id':_0x1394f3[_0x3175('0x12')]}})[_0x3175('0x14')](function(_0x39ca21){if(_0x39ca21){_0x39ca21[_0x3175('0x15')]({'lastMsgAt':_0x1394f3[_0x3175('0x16')],'lastMsgDirection':_0x1394f3[_0x3175('0xc')][_0x3175('0xd')]()});}})[_0x3175('0x17')](function(_0x4941c4){console[_0x3175('0x18')](_0x4941c4);});}if(_0x1394f3[_0x3175('0xc')]===_0x3175('0xe')&&!_0x1394f3[_0x3175('0xf')]){var _0x1965a5;_0x412762['SmsAccount'][_0x3175('0x19')]({'where':{'id':_0x1394f3[_0x3175('0x1a')]},'raw':!![]})[_0x3175('0x14')](function(_0x8064f){_0x1965a5=_0x8064f;if(_0x1965a5&&_0x1965a5[_0x3175('0x1b')]){switch(_0x1965a5[_0x3175('0x1b')]){case _0x3175('0x1c'):var _0x404ed4=require(_0x3175('0x1c'));if(_0x1965a5['accountSid']&&_0x1965a5[_0x3175('0x1d')]&&_0x1965a5[_0x3175('0x1e')]){var _0x194cf5=new _0x404ed4(_0x1965a5[_0x3175('0x1f')],_0x1965a5['authToken']);_0x194cf5[_0x3175('0x20')][_0x3175('0x21')]({'body':_0x1394f3['body'],'to':_0x1394f3[_0x3175('0x1e')],'from':_0x1965a5[_0x3175('0x1e')],'statusCallback':_0x1965a5[_0x3175('0x22')]+_0x3175('0x23')+_0x1394f3['id']+'/status?token='+_0x1965a5['token']})[_0x3175('0x14')](function(_0x48bbf5){if(_0x48bbf5[_0x3175('0x24')]){return _0x1ae64b[_0x3175('0x15')]({'messageId':_0x48bbf5[_0x3175('0x24')]});}})[_0x3175('0x17')](function(_0x31783f){logger['error'](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x1c'),util[_0x3175('0x27')](_0x31783f,{'showHidden':![],'depth':null}));});}else{logger[_0x3175('0x18')](_0x3175('0x25'),'afterCreate',_0x3175('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3175('0x28'):var _0x1dd29d=_0x3175('0x29');if(_0x1965a5[_0x3175('0x2a')]&&_0x1965a5['password']){var _0x488f23={'recipient':[_0x1394f3[_0x3175('0x1e')]],'message':_0x1394f3[_0x3175('0xa')],'message_type':_0x1965a5[_0x3175('0x2b')]};if(_0x1965a5[_0x3175('0x2b')]&&_0x1965a5[_0x3175('0x2b')]!=='SI'){_0x488f23[_0x3175('0x2c')]=_0x1965a5[_0x3175('0x1e')];}var _0x1771a5={'url':_0x1dd29d+_0x3175('0x2d')+_0x1965a5[_0x3175('0x2a')]+_0x3175('0x2e')+_0x1965a5[_0x3175('0x2f')],'method':_0x3175('0x30')};rp(_0x1771a5)[_0x3175('0x14')](function(_0x2ecb41){var _0x13a21c=_0x2ecb41[_0x3175('0x31')](';');var _0x1db717={'user_key':_0x13a21c[0x0],'session_key':_0x13a21c[0x1]};_0x1771a5={'url':_0x1dd29d+_0x3175('0x32'),'method':'POST','headers':{'user_key':_0x1db717[_0x3175('0x33')],'Session_key':_0x1db717[_0x3175('0x34')]},'json':!![],'body':_0x488f23};return rp(_0x1771a5);})[_0x3175('0x14')](function(_0x17e0c3){if(_0x17e0c3[_0x3175('0x35')]>=0x1){var _0x833662={'messageId':_0x17e0c3[_0x3175('0x36')]};if(_0x1965a5['smsMethod']!=='GP'||!_0x1965a5[_0x3175('0x37')]){_0x833662[_0x3175('0x38')]=!![];}return _0x1ae64b[_0x3175('0x15')](_0x833662);}else{return logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x28'),util[_0x3175('0x27')](_0x17e0c3,{'showHidden':![],'depth':null}));}})[_0x3175('0x17')](function(_0x2a521a){return logger[_0x3175('0x18')](_0x3175('0x25'),'afterCreate',_0x3175('0x28'),util[_0x3175('0x27')](_0x2a521a,{'showHidden':![],'depth':null}));});}else{logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x28'),_0x3175('0x39'));}break;case _0x3175('0x3a'):if(_0x1965a5[_0x3175('0x1d')]){var _0x65e6bf={'recipient':_0x1394f3[_0x3175('0x1e')],'message':_0x1394f3[_0x3175('0xa')],'sender':_0x1965a5[_0x3175('0x3b')]||_0x1965a5['phone'],'authorization':_0x1965a5[_0x3175('0x1d')]};var _0x5d1e80={'method':_0x3175('0x3c'),'uri':_0x3175('0x3d'),'body':_0x65e6bf,'json':!![]};rp(_0x5d1e80)['then'](function(_0x57862d){var _0x39f400={'messageId':_0x57862d[_0x3175('0x3e')]};if(!_0x1965a5['deliveryReport']){_0x39f400[_0x3175('0x38')]=!![];}return _0x1ae64b[_0x3175('0x15')](_0x39f400);})[_0x3175('0x17')](function(_0x15be2c){logger[_0x3175('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3175('0x3a'),util['inspect'](_0x15be2c,{'showHidden':![],'depth':null}));});}else{logger[_0x3175('0x18')](_0x3175('0x25'),'afterCreate',_0x3175('0x3a'),_0x3175('0x3f'));}break;case'clicksend':if(_0x1965a5[_0x3175('0x2a')]&&_0x1965a5['password']){var _0x65e6bf={'messages':[{'source':_0x3175('0x40'),'to':_0x1394f3[_0x3175('0x1e')],'body':_0x1394f3['body'],'from':_0x1965a5[_0x3175('0x3b')]||_0x1965a5[_0x3175('0x1e')]}]};var _0x5dbfe5=util[_0x3175('0x41')](_0x3175('0x42'),_0x1965a5['username'],_0x1965a5['password']);var _0x5d1e80={'method':'POST','uri':_0x3175('0x43'),'body':_0x65e6bf,'headers':{'Authorization':util['format'](_0x3175('0x44'),new Buffer(_0x5dbfe5)[_0x3175('0x45')](_0x3175('0x46')))},'json':!![]};rp(_0x5d1e80)[_0x3175('0x14')](function(_0x33796b){if(_0x33796b[_0x3175('0x47')]>=0xc8&&_0x33796b[_0x3175('0x47')]<=0xce){if(_0x33796b['data']&&_0x33796b[_0x3175('0x48')][_0x3175('0x49')]>0x0){var _0x65f5a6=_[_0x3175('0x4a')](_0x33796b['data'][_0x3175('0x20')]);var _0xb6e5b8={'messageId':_0x65f5a6['message_id']};if(!_0x1965a5['deliveryReport']){_0xb6e5b8[_0x3175('0x38')]=!![];}return _0x1ae64b['update'](_0xb6e5b8);}else{logger[_0x3175('0x18')](_0x3175('0x25'),'afterCreate',_0x3175('0x4b'),util[_0x3175('0x27')](_0x33796b,{'showHidden':![],'depth':null}));}}else{logger[_0x3175('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3175('0x26'),_0x3175('0x4b'),util[_0x3175('0x27')](_0x33796b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x33c666){logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x4b'),util[_0x3175('0x27')](_0x33c666,{'showHidden':![],'depth':null}));});}else{logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x4b'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x1965a5[_0x3175('0x4c')]&&_0x1965a5[_0x3175('0x1d')]){var _0x65e6bf={'dst':_0x1394f3[_0x3175('0x1e')],'text':_0x1394f3[_0x3175('0xa')],'src':_0x1965a5[_0x3175('0x3b')]||_0x1965a5[_0x3175('0x1e')],'url':_0x1965a5[_0x3175('0x22')]+_0x3175('0x23')+_0x1394f3['id']+_0x3175('0x4d')+_0x1965a5[_0x3175('0x4e')]};var _0x5dbfe5=util[_0x3175('0x41')]('%s:%s',_0x1965a5[_0x3175('0x4c')],_0x1965a5[_0x3175('0x1d')]);var _0x5d1e80={'method':_0x3175('0x3c'),'uri':util[_0x3175('0x41')](_0x3175('0x4f'),_0x1965a5['authId']),'body':_0x65e6bf,'headers':{'Authorization':util['format'](_0x3175('0x44'),new Buffer(_0x5dbfe5)[_0x3175('0x45')]('base64'))},'json':!![]};rp(_0x5d1e80)['then'](function(_0x2b9bb9){var _0x35b73c={'messageId':_0x2b9bb9[_0x3175('0x50')][0x0]};return _0x1ae64b[_0x3175('0x15')](_0x35b73c);})[_0x3175('0x17')](function(_0x471228){logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x51'),util[_0x3175('0x27')](_0x471228,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3175('0x51'),_0x3175('0x52'));}break;case _0x3175('0x53'):if(_0x1965a5[_0x3175('0x2a')]&&_0x1965a5[_0x3175('0x2f')]){if(_0x1965a5[_0x3175('0x54')]){var _0x92bf00={'method':_0x3175('0x3c'),'uri':_0x1965a5[_0x3175('0x54')]+_0x3175('0x55'),'body':{'username':_0x1965a5['username'],'password':_0x1965a5[_0x3175('0x2f')]},'json':!![]};return rp(_0x92bf00)[_0x3175('0x14')](function(_0x9d6383){var _0x2c02fb={'method':'POST','uri':_0x1965a5['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1965a5[_0x3175('0x1e')],'destinations':[{'to':_0x1394f3[_0x3175('0x1e')]}],'text':_0x1394f3[_0x3175('0xa')],'notifyUrl':_0x1965a5[_0x3175('0x22')]+'/api/sms/messages/'+_0x1394f3['id']+_0x3175('0x4d')+_0x1965a5['token'],'notifyContentType':_0x3175('0x56'),'callbackData':_0x1965a5[_0x3175('0x1e')]+';'+_0x1394f3[_0x3175('0xa')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x9d6383['token']},'json':!![]};return rp(_0x2c02fb)[_0x3175('0x14')](function(_0x326771){if(_0x326771['messages']){var _0xae7df1={'messageId':_0x326771['messages'][0x0][_0x3175('0x9')]};if(!_0x1965a5['deliveryReport']){_0xae7df1['read']=!![];}return _0x1ae64b[_0x3175('0x15')](_0xae7df1);}else{return logger[_0x3175('0x18')](_0x3175('0x25'),'afterCreate',_0x3175('0x53'),util[_0x3175('0x27')](_0x326771,{'showHidden':![],'depth':null}));}});})[_0x3175('0x17')](function(_0x70a4a4){return logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),'infobip',util[_0x3175('0x27')](_0x70a4a4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3175('0x26'),'infobip',_0x3175('0x57'));}}else{logger[_0x3175('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3175('0x26'),_0x3175('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3175('0x58'):var _0x2415aa=require('crypto');if(_0x1965a5['apiKey']){var _0x456f48={};_0x456f48[_0x3175('0x59')]=_0x1965a5[_0x3175('0x2a')];_0x456f48[_0x3175('0x1e')]=_0x1394f3[_0x3175('0x1e')];_0x456f48[_0x3175('0x2c')]=_0x1965a5[_0x3175('0x1e')];_0x456f48[_0x3175('0x5a')]=_0x1394f3['body'];_0x456f48[_0x3175('0x5b')]=+new Date();var _0x5cc377='';var _0x2eb897='';var _0x3c7456=Object[_0x3175('0x5c')](_0x456f48);_0x3c7456[_0x3175('0x5d')]();for(var _0x360297=0x0;_0x360297<_0x3c7456[_0x3175('0x5e')];_0x360297++){if(_0x5cc377!=''){_0x5cc377+='&';}_0x5cc377+=_0x3c7456[_0x360297]+'='+encodeURIComponent(_0x456f48[_0x3c7456[_0x360297]]);_0x2eb897+=_0x456f48[_0x3c7456[_0x360297]];}_0x2eb897+=_0x1965a5[_0x3175('0x5f')];_0x2eb897=_0x2415aa['createHash']('md5')[_0x3175('0x15')](_0x2eb897)[_0x3175('0x60')](_0x3175('0x61'));if(_0x5cc377!==''){_0x5cc377+='&';}_0x5cc377+=_0x3175('0x62')+_0x2eb897;var _0x1771a5={'method':'GET','uri':_0x1965a5[_0x3175('0x54')]+'/external/get/send.php?'+_0x5cc377,'json':!![]};return rp(_0x1771a5)[_0x3175('0x14')](function(_0x296766){var _0x2f4fbe=Object['keys'](_0x296766);if(_0x296766[_0x2f4fbe[0x0]][_0x3175('0x18')]&&parseInt(_0x296766[_0x2f4fbe[0x0]][_0x3175('0x18')])===0x0){var _0x5d75d7={'messageId':_0x296766[_0x2f4fbe[0x0]][_0x3175('0x63')]};if(!_0x1965a5[_0x3175('0x37')]){_0x5d75d7['read']=!![];}return _0x1ae64b['update'](_0x5d75d7);}else{return logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x58'),util['inspect'](_0x296766[_0x3175('0x18')],{'showHidden':![],'depth':null}));}})[_0x3175('0x17')](function(_0x15f745){return logger[_0x3175('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3175('0x58'),util['inspect'](_0x15f745,{'showHidden':![],'depth':null}));});}else{logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x58'),'Missing\x20parameters:\x20apiKey');}break;case _0x3175('0x64'):if(_0x1965a5[_0x3175('0x5f')]){var _0x504a9a={'method':_0x3175('0x3c'),'uri':_0x3175('0x65'),'headers':{'Authorization':_0x1965a5[_0x3175('0x5f')]},'body':{'content':_0x1394f3[_0x3175('0xa')],'to':[_0x1394f3[_0x3175('0x1e')]],'from':_0x1965a5[_0x3175('0x1e')],'binary':![],'clientMessageId':'uuid','charset':_0x3175('0x66')},'json':!![]};rp(_0x504a9a)[_0x3175('0x14')](function(_0xa0534b){if(!_0xa0534b[_0x3175('0x18')]){var _0x4d2340={'messageId':_0xa0534b[_0x3175('0x20')][0x0]['apiMessageId']};if(!_0x1965a5['deliveryReport']){_0x4d2340[_0x3175('0x38')]=!![];}return _0x1ae64b[_0x3175('0x15')](_0x4d2340);}else{return logger['error'](_0x3175('0x25'),'afterCreate',_0x3175('0x64'),util['inspect'](_0xa0534b[_0x3175('0x18')],{'showHidden':![],'depth':null}));}})[_0x3175('0x17')](function(_0x1a7cc1){return logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x64'),util[_0x3175('0x27')](_0x1a7cc1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3175('0x26'),_0x3175('0x64'),_0x3175('0x67'));}break;case _0x3175('0x68'):if(_0x1965a5[_0x3175('0x2a')]&&_0x1965a5[_0x3175('0x2f')]){var _0x5dbfe5=util[_0x3175('0x41')]('%s:%s',_0x1965a5[_0x3175('0x2a')],_0x1965a5[_0x3175('0x2f')]);var _0x5d1e80={'method':_0x3175('0x3c'),'uri':_0x3175('0x69')+_0x1965a5['accountId']+_0x3175('0x6a'),'body':{'to':[_0x1394f3[_0x3175('0x1e')]],'text':_0x1394f3[_0x3175('0xa')],'from':_0x1965a5[_0x3175('0x1e')],'applicationId':_0x1965a5[_0x3175('0x6b')]},'headers':{'Authorization':util[_0x3175('0x41')]('Basic\x20%s',new Buffer(_0x5dbfe5)[_0x3175('0x45')](_0x3175('0x46')))},'json':!![]};rp(_0x5d1e80)[_0x3175('0x14')](function(_0x53cbb4){if(_0x53cbb4['id']){var _0x482efa={'messageId':_0x53cbb4['id']};return _0x1ae64b[_0x3175('0x15')](_0x482efa);}else{logger[_0x3175('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3175('0x68'),util[_0x3175('0x27')](_0x53cbb4,{'showHidden':![],'depth':null}));}})[_0x3175('0x17')](function(_0x2331c8){logger[_0x3175('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','bandwidth',util[_0x3175('0x27')](_0x2331c8,{'showHidden':![],'depth':null}));});}else{logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),'bandwidth',_0x3175('0x39'));}break;case'intelepeer':if(_0x1965a5[_0x3175('0x5f')]){var _0x295722={};var _0x1771a5={'method':_0x3175('0x3c'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x1965a5[_0x3175('0x5f')],'Content-Type':_0x3175('0x56')},'body':{'from':_0x1965a5['phone'],'to':_0x1394f3['phone'],'text':_0x1394f3[_0x3175('0xa')]},'json':!![]};return rp(_0x1771a5)[_0x3175('0x14')](function(_0x8e1086){if(_0x8e1086[_0x3175('0x6c')]==0xca){_0x295722[_0x3175('0x6d')]=_0x8e1086;var _0x1b44fe={'method':_0x3175('0x3c'),'uri':_0x3175('0x6e'),'headers':{'Authorization':_0x3175('0x6f')+_0x1965a5['apiKey'],'Content-Type':_0x3175('0x56')},'body':{'refid':_0x295722[_0x3175('0x6d')][_0x3175('0x70')]},'json':!![]};return rp(_0x1b44fe)[_0x3175('0x14')](function(_0x2f005b){_0x295722[_0x3175('0x71')]=_0x2f005b;var _0x329b7e={'messageId':_0x295722[_0x3175('0x6d')][_0x3175('0x70')],'read':!![]};return _0x1ae64b['update'](_0x329b7e);});}else{return logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x72'),util[_0x3175('0x27')](_0x8e1086,{'showHidden':![],'depth':null}));}})[_0x3175('0x17')](function(_0xbf3d36){return logger['error'](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x72'),util[_0x3175('0x27')](_0xbf3d36,{'showHidden':![],'depth':null}));});}else{return logger[_0x3175('0x18')](_0x3175('0x25'),_0x3175('0x26'),_0x3175('0x72'),'Token\x20not\x20received');}break;}}})[_0x3175('0x73')](function(){_0x4a79a2();});}else{_0x4a79a2();}}},'charset':_0x3175('0x74'),'collate':_0x3175('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e5e4f58..f1baaf1 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 _0x38b9=['create','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','CreateSmsMessage','SmsMessage'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x38b9,0x11b));var _0x938b=function(_0x13b89e,_0xefb29d){_0x13b89e=_0x13b89e-0x0;var _0x5c1631=_0x38b9[_0x13b89e];return _0x5c1631;};'use strict';var _=require('lodash');var util=require(_0x938b('0x0'));var moment=require(_0x938b('0x1'));var BPromise=require('bluebird');var rs=require(_0x938b('0x2'));var fs=require('fs');var Redis=require(_0x938b('0x3'));var db=require(_0x938b('0x4'))['db'];var utils=require(_0x938b('0x5'));var logger=require(_0x938b('0x6'))(_0x938b('0x7'));var config=require(_0x938b('0x8'));var jayson=require(_0x938b('0x9'));var client=jayson['client'][_0x938b('0xa')]({'port':0x232a});config[_0x938b('0xb')]=_[_0x938b('0xc')](config[_0x938b('0xb')],{'host':_0x938b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x938b('0xb')]));require(_0x938b('0xe'))[_0x938b('0xf')](socket);function respondWithRpcPromise(_0x324f3f,_0x265d70,_0x1b78d2){return new BPromise(function(_0x4a2cb6,_0x546847){return client['request'](_0x324f3f,_0x1b78d2)[_0x938b('0x10')](function(_0x577d32){logger['info'](_0x938b('0x11'),_0x265d70,_0x938b('0x12'));logger[_0x938b('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x265d70,'request\x20sent',JSON[_0x938b('0x14')](_0x577d32));if(_0x577d32['error']){if(_0x577d32[_0x938b('0x15')]['code']===0x1f4){logger[_0x938b('0x15')](_0x938b('0x11'),_0x265d70,_0x577d32['error'][_0x938b('0x16')]);return _0x546847(_0x577d32[_0x938b('0x15')]['message']);}logger[_0x938b('0x15')](_0x938b('0x11'),_0x265d70,_0x577d32[_0x938b('0x15')][_0x938b('0x16')]);return _0x4a2cb6(_0x577d32[_0x938b('0x15')][_0x938b('0x16')]);}else{logger[_0x938b('0x17')](_0x938b('0x11'),_0x265d70,_0x938b('0x12'));_0x4a2cb6(_0x577d32[_0x938b('0x18')][_0x938b('0x16')]);}})['catch'](function(_0x5c191d){logger[_0x938b('0x15')]('SmsMessage,\x20%s,\x20%s',_0x265d70,_0x5c191d);_0x546847(_0x5c191d);});});}exports[_0x938b('0x19')]=function(_0x5eaa42){var _0x4ef235=this;return new Promise(function(_0x307bf4,_0x18ff82){return db[_0x938b('0x1a')][_0x938b('0x1b')](_0x5eaa42['body'],{'raw':_0x5eaa42[_0x938b('0x1c')]?_0x5eaa42[_0x938b('0x1c')][_0x938b('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x116299){logger[_0x938b('0x17')](_0x938b('0x19'),_0x5eaa42);logger[_0x938b('0x13')](_0x938b('0x19'),_0x5eaa42,JSON[_0x938b('0x14')](_0x116299));_0x307bf4(_0x116299);})[_0x938b('0x1e')](function(_0x1d52c1){logger['error'](_0x938b('0x19'),_0x1d52c1[_0x938b('0x16')],_0x5eaa42);_0x18ff82(_0x4ef235[_0x938b('0x15')](0x1f4,_0x1d52c1[_0x938b('0x16')]));});});}; \ No newline at end of file +var _0x584b=['raw','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsMessage','create','body','options'];(function(_0x4cde13,_0xac6266){var _0xb999c7=function(_0x3e4544){while(--_0x3e4544){_0x4cde13['push'](_0x4cde13['shift']());}};_0xb999c7(++_0xac6266);}(_0x584b,0x12b));var _0xb584=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x584b[_0x1ff575];return _0x48fc9e;};'use strict';var _=require('lodash');var util=require(_0xb584('0x0'));var moment=require(_0xb584('0x1'));var BPromise=require(_0xb584('0x2'));var rs=require(_0xb584('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb584('0x4'));var logger=require(_0xb584('0x5'))('rpc');var config=require(_0xb584('0x6'));var jayson=require(_0xb584('0x7'));var client=jayson[_0xb584('0x8')]['http']({'port':0x232a});config[_0xb584('0x9')]=_['defaults'](config[_0xb584('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb584('0x9')]));require(_0xb584('0xa'))['register'](socket);function respondWithRpcPromise(_0x29ad2b,_0x54d3c8,_0x5dd9f6){return new BPromise(function(_0x5dc288,_0xf28f19){return client['request'](_0x29ad2b,_0x5dd9f6)[_0xb584('0xb')](function(_0x439d91){logger[_0xb584('0xc')](_0xb584('0xd'),_0x54d3c8,_0xb584('0xe'));logger['debug'](_0xb584('0xf'),_0x54d3c8,_0xb584('0xe'),JSON[_0xb584('0x10')](_0x439d91));if(_0x439d91[_0xb584('0x11')]){if(_0x439d91[_0xb584('0x11')][_0xb584('0x12')]===0x1f4){logger[_0xb584('0x11')](_0xb584('0xd'),_0x54d3c8,_0x439d91['error'][_0xb584('0x13')]);return _0xf28f19(_0x439d91[_0xb584('0x11')][_0xb584('0x13')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x54d3c8,_0x439d91[_0xb584('0x11')][_0xb584('0x13')]);return _0x5dc288(_0x439d91[_0xb584('0x11')][_0xb584('0x13')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x54d3c8,_0xb584('0xe'));_0x5dc288(_0x439d91[_0xb584('0x14')][_0xb584('0x13')]);}})['catch'](function(_0x45c5eb){logger[_0xb584('0x11')](_0xb584('0xd'),_0x54d3c8,_0x45c5eb);_0xf28f19(_0x45c5eb);});});}exports[_0xb584('0x15')]=function(_0x37bced){var _0xa0926c=this;return new Promise(function(_0x382ac4,_0x3610e8){return db['SmsMessage'][_0xb584('0x16')](_0x37bced[_0xb584('0x17')],{'raw':_0x37bced[_0xb584('0x18')]?_0x37bced[_0xb584('0x18')][_0xb584('0x19')]===undefined?!![]:![]:!![]})[_0xb584('0xb')](function(_0xe989ac){logger[_0xb584('0xc')](_0xb584('0x15'),_0x37bced);logger['debug'](_0xb584('0x15'),_0x37bced,JSON[_0xb584('0x10')](_0xe989ac));_0x382ac4(_0xe989ac);})[_0xb584('0x1a')](function(_0x1bbc0){logger['error'](_0xb584('0x15'),_0x1bbc0['message'],_0x37bced);_0x3610e8(_0xa0926c[_0xb584('0x11')](0x1f4,_0x1bbc0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b854c77..b722c14 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 _0xeb4d=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0xeb4d,0xed));var _0xdeb4=function(_0x1e8944,_0x298002){_0x1e8944=_0x1e8944-0x0;var _0x71be4b=_0xeb4d[_0x1e8944];return _0x71be4b;};'use strict';var SmsMessageEvents=require(_0xdeb4('0x0'));var events=['save',_0xdeb4('0x1'),_0xdeb4('0x2')];function createListener(_0x30c913,_0x4277ec){return function(_0x587c27){_0x4277ec[_0xdeb4('0x3')](_0x30c913,_0x587c27);};}function removeListener(_0x12351b,_0x7e51af){return function(){SmsMessageEvents[_0xdeb4('0x4')](_0x12351b,_0x7e51af);};}exports[_0xdeb4('0x5')]=function(_0x28eeeb){for(var _0x110f87=0x0,_0x2854d9=events[_0xdeb4('0x6')];_0x110f87<_0x2854d9;_0x110f87++){var _0x578f18=events[_0x110f87];var _0x548a5a=createListener(_0xdeb4('0x7')+_0x578f18,_0x28eeeb);SmsMessageEvents['on'](_0x578f18,_0x548a5a);}}; \ No newline at end of file +var _0x3978=['remove','update','emit','removeListener','length','smsMessage:','./smsMessage.events','save'];(function(_0x3315b3,_0x499c11){var _0x5595b0=function(_0xf4fc3b){while(--_0xf4fc3b){_0x3315b3['push'](_0x3315b3['shift']());}};_0x5595b0(++_0x499c11);}(_0x3978,0x1c6));var _0x8397=function(_0x249147,_0x4823c3){_0x249147=_0x249147-0x0;var _0x333916=_0x3978[_0x249147];return _0x333916;};'use strict';var SmsMessageEvents=require(_0x8397('0x0'));var events=[_0x8397('0x1'),_0x8397('0x2'),_0x8397('0x3')];function createListener(_0x561a03,_0x2fbde4){return function(_0x9c01a3){_0x2fbde4[_0x8397('0x4')](_0x561a03,_0x9c01a3);};}function removeListener(_0x43a602,_0x5f0bc4){return function(){SmsMessageEvents[_0x8397('0x5')](_0x43a602,_0x5f0bc4);};}exports['register']=function(_0x56f409){for(var _0x161da2=0x0,_0x191324=events[_0x8397('0x6')];_0x161da2<_0x191324;_0x161da2++){var _0x8f7c52=events[_0x161da2];var _0x1bb5d7=createListener(_0x8397('0x7')+_0x8f7c52,_0x56f409);SmsMessageEvents['on'](_0x8f7c52,_0x1bb5d7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index bf05ce4..7a25f04 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 _0x69a1=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./smsQueue.controller','isAuthenticated','index','/describe','describe','get','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','/:id','destroy','delete'];(function(_0x564d28,_0x43daa5){var _0x449cac=function(_0x3c6d93){while(--_0x3c6d93){_0x564d28['push'](_0x564d28['shift']());}};_0x449cac(++_0x43daa5);}(_0x69a1,0xaa));var _0x169a=function(_0x40c084,_0x3ea97d){_0x40c084=_0x40c084-0x0;var _0x2ad95f=_0x69a1[_0x40c084];return _0x2ad95f;};'use strict';var multer=require(_0x169a('0x0'));var util=require(_0x169a('0x1'));var path=require('path');var timeout=require(_0x169a('0x2'));var express=require('express');var router=express[_0x169a('0x3')]();var fs_extra=require(_0x169a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x169a('0x5'));var controller=require(_0x169a('0x6'));router['get']('/',auth[_0x169a('0x7')](),controller[_0x169a('0x8')]);router['get'](_0x169a('0x9'),auth[_0x169a('0x7')](),controller[_0x169a('0xa')]);router[_0x169a('0xb')]('/:id',auth[_0x169a('0x7')](),controller['show']);router['get']('/:id/members',auth[_0x169a('0x7')](),controller[_0x169a('0xc')]);router[_0x169a('0xb')](_0x169a('0xd'),auth[_0x169a('0x7')](),controller[_0x169a('0xe')]);router[_0x169a('0xb')]('/:id/users',auth[_0x169a('0x7')](),controller[_0x169a('0xf')]);router[_0x169a('0x10')]('/',auth[_0x169a('0x7')](),controller[_0x169a('0x11')]);router[_0x169a('0x10')](_0x169a('0xd'),auth[_0x169a('0x7')](),controller[_0x169a('0x12')]);router[_0x169a('0x10')](_0x169a('0x13'),auth[_0x169a('0x7')](),controller[_0x169a('0x14')]);router[_0x169a('0x15')]('/:id',auth[_0x169a('0x7')](),controller[_0x169a('0x16')]);router['delete'](_0x169a('0x17'),auth[_0x169a('0x7')](),controller[_0x169a('0x18')]);router[_0x169a('0x19')](_0x169a('0xd'),auth[_0x169a('0x7')](),controller['removeTeams']);router[_0x169a('0x19')](_0x169a('0x13'),auth[_0x169a('0x7')](),controller[_0x169a('0x1a')]);module[_0x169a('0x1b')]=router; \ No newline at end of file +var _0x4f07=['getTeams','/:id/users','create','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4f07,0xc0));var _0x74f0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4f07[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x74f0('0x0'));var util=require('util');var path=require(_0x74f0('0x1'));var timeout=require(_0x74f0('0x2'));var express=require('express');var router=express[_0x74f0('0x3')]();var fs_extra=require(_0x74f0('0x4'));var auth=require(_0x74f0('0x5'));var interaction=require(_0x74f0('0x6'));var config=require(_0x74f0('0x7'));var controller=require(_0x74f0('0x8'));router[_0x74f0('0x9')]('/',auth[_0x74f0('0xa')](),controller[_0x74f0('0xb')]);router[_0x74f0('0x9')](_0x74f0('0xc'),auth['isAuthenticated'](),controller[_0x74f0('0xd')]);router['get'](_0x74f0('0xe'),auth[_0x74f0('0xa')](),controller['show']);router['get'](_0x74f0('0xf'),auth['isAuthenticated'](),controller[_0x74f0('0x10')]);router[_0x74f0('0x9')](_0x74f0('0x11'),auth[_0x74f0('0xa')](),controller[_0x74f0('0x12')]);router['get'](_0x74f0('0x13'),auth[_0x74f0('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x74f0('0x14')]);router[_0x74f0('0x15')](_0x74f0('0x11'),auth['isAuthenticated'](),controller[_0x74f0('0x16')]);router[_0x74f0('0x15')]('/:id/users',auth[_0x74f0('0xa')](),controller[_0x74f0('0x17')]);router[_0x74f0('0x18')](_0x74f0('0xe'),auth[_0x74f0('0xa')](),controller[_0x74f0('0x19')]);router['delete']('/:id',auth[_0x74f0('0xa')](),controller[_0x74f0('0x1a')]);router[_0x74f0('0x1b')]('/:id/teams',auth[_0x74f0('0xa')](),controller[_0x74f0('0x1c')]);router[_0x74f0('0x1b')]('/:id/users',auth[_0x74f0('0xa')](),controller[_0x74f0('0x1d')]);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 6cc0525..18aa679 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 _0x22e5=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x3d3133,_0x284999){var _0x476738=function(_0x5c2022){while(--_0x5c2022){_0x3d3133['push'](_0x3d3133['shift']());}};_0x476738(++_0x284999);}(_0x22e5,0xc4));var _0x522e=function(_0x15fcf8,_0x21060a){_0x15fcf8=_0x15fcf8-0x0;var _0x587fe5=_0x22e5[_0x15fcf8];return _0x587fe5;};'use strict';var Sequelize=require(_0x522e('0x0'));module[_0x522e('0x1')]={'name':{'type':Sequelize[_0x522e('0x2')],'unique':_0x522e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x522e('0x4')](_0x522e('0x5'),_0x522e('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x62ed=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xf69d17,_0x7712fa){var _0x2bf178=function(_0x43236f){while(--_0x43236f){_0xf69d17['push'](_0xf69d17['shift']());}};_0x2bf178(++_0x7712fa);}(_0x62ed,0x92));var _0xd62e=function(_0x4edd88,_0x461085){_0x4edd88=_0x4edd88-0x0;var _0x127278=_0x62ed[_0x4edd88];return _0x127278;};'use strict';var Sequelize=require(_0xd62e('0x0'));module[_0xd62e('0x1')]={'name':{'type':Sequelize[_0xd62e('0x2')],'unique':_0xd62e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd62e('0x2')]},'timeout':{'type':Sequelize[_0xd62e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd62e('0x5')](_0xd62e('0x6'),'beepall',_0xd62e('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index d6dc462..d426088 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 _0x6fba=['join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','compact','value','removeTeams','isEmpty','emit','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','removeAgents','getAgents','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','SmsQueues','UserProfileResource','error','stack','name','index','SmsQueue','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','params','find','catch','create','body','get','role','user','autoAssociation','update','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','%s/%s','getTeams','rawAttributes','addTeams','ids','Agents','online','interface','sequelize','transaction','each','forEach','select','field','from','team_has_sms_queues'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x6fba,0x97));var _0xa6fb=function(_0x207c23,_0x50ce5d){_0x207c23=_0x207c23-0x0;var _0x438a20=_0x6fba[_0x207c23];return _0x438a20;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa6fb('0x0'));var BPromise=require(_0xa6fb('0x1'));var Mustache=require(_0xa6fb('0x2'));var util=require(_0xa6fb('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xa6fb('0x4'));var ejs=require(_0xa6fb('0x5'));var fs=require('fs');var fs_extra=require(_0xa6fb('0x6'));var _=require(_0xa6fb('0x7'));var squel=require(_0xa6fb('0x8'));var crypto=require(_0xa6fb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa6fb('0xa'));var toCsv=require(_0xa6fb('0x4'));var querystring=require(_0xa6fb('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa6fb('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xa6fb('0xd'));var hardwareService=require(_0xa6fb('0xe'));var logger=require(_0xa6fb('0xf'))(_0xa6fb('0x10'));var utils=require(_0xa6fb('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xa6fb('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa6fb('0x13')](config[_0xa6fb('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xa6fb('0x15'))(new Redis(config[_0xa6fb('0x14')]));require(_0xa6fb('0x16'))[_0xa6fb('0x17')](socket);function respondWithStatusCode(_0x3396ef,_0xac7d7f){_0xac7d7f=_0xac7d7f||0xcc;return function(_0x56ef8d){if(_0x56ef8d){return _0x3396ef[_0xa6fb('0x18')](_0xac7d7f);}return _0x3396ef[_0xa6fb('0x19')](_0xac7d7f)[_0xa6fb('0x1a')]();};}function respondWithResult(_0x26a6d1,_0x38c946){_0x38c946=_0x38c946||0xc8;return function(_0x211d31){if(_0x211d31){return _0x26a6d1[_0xa6fb('0x19')](_0x38c946)[_0xa6fb('0x1b')](_0x211d31);}};}function respondWithFilteredResult(_0x173498,_0x5de719){return function(_0x4fa149){if(_0x4fa149){var _0xe21734=typeof _0x5de719[_0xa6fb('0x1c')]===_0xa6fb('0x1d')&&typeof _0x5de719[_0xa6fb('0x1e')]===_0xa6fb('0x1d');var _0x4c37dd=_0x4fa149[_0xa6fb('0x1f')];var _0x301da0=_0xe21734?0x0:_0x5de719[_0xa6fb('0x1c')];var _0x2de351=_0xe21734?_0x4fa149['count']:_0x5de719[_0xa6fb('0x1c')]+_0x5de719[_0xa6fb('0x1e')];var _0x276fa4;if(_0x2de351>=_0x4c37dd){_0x2de351=_0x4c37dd;_0x276fa4=0xc8;}else{_0x276fa4=0xce;}_0x173498[_0xa6fb('0x19')](_0x276fa4);return _0x173498['set'](_0xa6fb('0x20'),_0x301da0+'-'+_0x2de351+'/'+_0x4c37dd)[_0xa6fb('0x1b')](_0x4fa149);}return null;};}function patchUpdates(_0x7a324d){return function(_0x5d26d1){try{jsonpatch[_0xa6fb('0x21')](_0x5d26d1,_0x7a324d,!![]);}catch(_0xf331b6){return BPromise[_0xa6fb('0x22')](_0xf331b6);}return _0x5d26d1['save']();};}function saveUpdates(_0x4be3e9,_0x5ae81a){return function(_0x174717){if(_0x174717){return _0x174717['update'](_0x4be3e9)['then'](function(_0x26be24){return _0x26be24;});}return null;};}function removeEntity(_0x35aef6,_0x5bbb08){return function(_0x422801){if(_0x422801){return _0x422801[_0xa6fb('0x23')]()[_0xa6fb('0x24')](function(){var _0x1414b6=_0x422801['get']({'plain':!![]});var _0x272e01=_0xa6fb('0x25');return db[_0xa6fb('0x26')][_0xa6fb('0x23')]({'where':{'type':_0x272e01,'resourceId':_0x1414b6['id']}})[_0xa6fb('0x24')](function(){return _0x422801;});})['then'](function(){_0x35aef6[_0xa6fb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18d8f8,_0x178ec6){return function(_0x131ea5){if(!_0x131ea5){_0x18d8f8[_0xa6fb('0x18')](0x194);}return _0x131ea5;};}function handleError(_0x2198d6,_0x5e111f){_0x5e111f=_0x5e111f||0x1f4;return function(_0x57b270){logger[_0xa6fb('0x27')](_0x57b270[_0xa6fb('0x28')]);if(_0x57b270[_0xa6fb('0x29')]){delete _0x57b270['name'];}_0x2198d6[_0xa6fb('0x19')](_0x5e111f)['send'](_0x57b270);};}exports[_0xa6fb('0x2a')]=function(_0x14d297,_0x4828d7){var _0x576d32={},_0x58d244={},_0x347ee5={'count':0x0,'rows':[]};var _0x3498b4=_['map'](db[_0xa6fb('0x2b')]['rawAttributes'],function(_0x37a7a9){return{'name':_0x37a7a9[_0xa6fb('0x2c')],'type':_0x37a7a9[_0xa6fb('0x2d')][_0xa6fb('0x2e')]};});_0x58d244['model']=_['map'](_0x3498b4,_0xa6fb('0x29'));_0x58d244['query']=_[_0xa6fb('0x2f')](_0x14d297[_0xa6fb('0x30')]);_0x58d244[_0xa6fb('0x31')]=_[_0xa6fb('0x32')](_0x58d244[_0xa6fb('0x33')],_0x58d244['query']);_0x576d32[_0xa6fb('0x34')]=_[_0xa6fb('0x32')](_0x58d244[_0xa6fb('0x33')],qs[_0xa6fb('0x35')](_0x14d297[_0xa6fb('0x30')][_0xa6fb('0x35')]));_0x576d32['attributes']=_0x576d32['attributes'][_0xa6fb('0x36')]?_0x576d32['attributes']:_0x58d244['model'];if(!_0x14d297[_0xa6fb('0x30')][_0xa6fb('0x37')](_0xa6fb('0x38'))){_0x576d32[_0xa6fb('0x1e')]=qs['limit'](_0x14d297[_0xa6fb('0x30')][_0xa6fb('0x1e')]);_0x576d32['offset']=qs['offset'](_0x14d297['query'][_0xa6fb('0x1c')]);}_0x576d32[_0xa6fb('0x39')]=qs[_0xa6fb('0x3a')](_0x14d297[_0xa6fb('0x30')][_0xa6fb('0x3a')]);_0x576d32[_0xa6fb('0x3b')]=qs[_0xa6fb('0x31')](_[_0xa6fb('0x3c')](_0x14d297[_0xa6fb('0x30')],_0x58d244['filters']),_0x3498b4);if(_0x14d297[_0xa6fb('0x30')]['filter']){_0x576d32[_0xa6fb('0x3b')]=_[_0xa6fb('0x3d')](_0x576d32[_0xa6fb('0x3b')],{'$or':_[_0xa6fb('0x3e')](_0x3498b4,function(_0x2a9105){if(_0x2a9105['type']!==_0xa6fb('0x3f')){var _0xb7e2d6={};_0xb7e2d6[_0x2a9105[_0xa6fb('0x29')]]={'$like':'%'+_0x14d297[_0xa6fb('0x30')][_0xa6fb('0x40')]+'%'};return _0xb7e2d6;}})});}_0x576d32=_['merge']({},_0x576d32,_0x14d297[_0xa6fb('0x41')]);var _0x4ad383={'where':_0x576d32[_0xa6fb('0x3b')]};return db[_0xa6fb('0x2b')][_0xa6fb('0x1f')](_0x4ad383)[_0xa6fb('0x24')](function(_0x38a3ab){_0x347ee5['count']=_0x38a3ab;if(_0x14d297[_0xa6fb('0x30')]['includeAll']){_0x576d32[_0xa6fb('0x42')]=[{'all':!![]}];}return db['SmsQueue'][_0xa6fb('0x43')](_0x576d32);})['then'](function(_0x4ef338){_0x347ee5['rows']=_0x4ef338;return _0x347ee5;})[_0xa6fb('0x24')](respondWithFilteredResult(_0x4828d7,_0x576d32))['catch'](handleError(_0x4828d7,null));};exports['show']=function(_0x2c0b5a,_0x57fa87){var _0x55285a={'raw':!![],'where':{'id':_0x2c0b5a[_0xa6fb('0x44')]['id']}},_0x46fc41={};_0x46fc41[_0xa6fb('0x33')]=_['keys'](db[_0xa6fb('0x2b')]['rawAttributes']);_0x46fc41['query']=_['keys'](_0x2c0b5a[_0xa6fb('0x30')]);_0x46fc41[_0xa6fb('0x31')]=_[_0xa6fb('0x32')](_0x46fc41[_0xa6fb('0x33')],_0x46fc41[_0xa6fb('0x30')]);_0x55285a[_0xa6fb('0x34')]=_[_0xa6fb('0x32')](_0x46fc41['model'],qs[_0xa6fb('0x35')](_0x2c0b5a[_0xa6fb('0x30')][_0xa6fb('0x35')]));_0x55285a[_0xa6fb('0x34')]=_0x55285a['attributes'][_0xa6fb('0x36')]?_0x55285a[_0xa6fb('0x34')]:_0x46fc41[_0xa6fb('0x33')];if(_0x2c0b5a[_0xa6fb('0x30')]['includeAll']){_0x55285a[_0xa6fb('0x42')]=[{'all':!![]}];}_0x55285a=_[_0xa6fb('0x3d')]({},_0x55285a,_0x2c0b5a[_0xa6fb('0x41')]);return db['SmsQueue'][_0xa6fb('0x45')](_0x55285a)[_0xa6fb('0x24')](handleEntityNotFound(_0x57fa87,null))['then'](respondWithResult(_0x57fa87,null))[_0xa6fb('0x46')](handleError(_0x57fa87,null));};exports[_0xa6fb('0x47')]=function(_0x410619,_0x35dc8a){return db[_0xa6fb('0x2b')][_0xa6fb('0x47')](_0x410619[_0xa6fb('0x48')],{})[_0xa6fb('0x24')](function(_0x23a44f){var _0x3802a2=_0x410619['user'][_0xa6fb('0x49')]({'plain':!![]});if(!_0x3802a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3802a2[_0xa6fb('0x4a')]===_0xa6fb('0x4b')){var _0x1a9343=_0x23a44f[_0xa6fb('0x49')]({'plain':!![]});var _0x937140=_0xa6fb('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x937140,'userProfileId':_0x3802a2['userProfileId']},'raw':!![]})[_0xa6fb('0x24')](function(_0x5d3631){if(_0x5d3631&&_0x5d3631[_0xa6fb('0x4c')]===0x0){return db[_0xa6fb('0x26')][_0xa6fb('0x47')]({'name':_0x1a9343[_0xa6fb('0x29')],'resourceId':_0x1a9343['id'],'type':_0x5d3631[_0xa6fb('0x29')],'sectionId':_0x5d3631['id']},{})['then'](function(){return _0x23a44f;});}else{return _0x23a44f;}})['catch'](function(_0x4ccdb8){logger[_0xa6fb('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ccdb8);throw _0x4ccdb8;});}return _0x23a44f;})['then'](respondWithResult(_0x35dc8a,0xc9))[_0xa6fb('0x46')](handleError(_0x35dc8a,null));};exports[_0xa6fb('0x4d')]=function(_0x37059e,_0x48f06f){if(_0x37059e[_0xa6fb('0x48')]['id']){delete _0x37059e[_0xa6fb('0x48')]['id'];}return db[_0xa6fb('0x2b')]['find']({'where':{'id':_0x37059e[_0xa6fb('0x44')]['id']}})[_0xa6fb('0x24')](handleEntityNotFound(_0x48f06f,null))['then'](saveUpdates(_0x37059e[_0xa6fb('0x48')],null))[_0xa6fb('0x24')](respondWithResult(_0x48f06f,null))[_0xa6fb('0x46')](handleError(_0x48f06f,null));};exports[_0xa6fb('0x23')]=function(_0x46b06c,_0x4cf456){return db[_0xa6fb('0x2b')][_0xa6fb('0x45')]({'where':{'id':_0x46b06c[_0xa6fb('0x44')]['id']}})[_0xa6fb('0x24')](handleEntityNotFound(_0x4cf456,null))[_0xa6fb('0x24')](removeEntity(_0x4cf456,null))[_0xa6fb('0x46')](handleError(_0x4cf456,null));};exports['describe']=function(_0x59c742,_0x1a328e){return db['SmsQueue'][_0xa6fb('0x4e')]()['then'](respondWithResult(_0x1a328e,null))[_0xa6fb('0x46')](handleError(_0x1a328e,null));};exports[_0xa6fb('0x4f')]=function(_0x1744c0,_0x1ac370,_0x59967e){var _0x1c40a7={'raw':!![],'where':{}},_0x2a1418={},_0xabb923;return db[_0xa6fb('0x2b')][_0xa6fb('0x50')]({'where':{'id':_0x1744c0[_0xa6fb('0x44')]['id']}})[_0xa6fb('0x24')](handleEntityNotFound(_0x1ac370,null))[_0xa6fb('0x24')](function(_0x2a52ae){if(_0x2a52ae){_0xabb923=_0x2a52ae[_0xa6fb('0x49')]({'plain':!![]});_0x2a1418[_0xa6fb('0x33')]=_[_0xa6fb('0x2f')](db[_0xa6fb('0x51')]['rawAttributes']);_0x2a1418[_0xa6fb('0x30')]=_[_0xa6fb('0x2f')](_0x1744c0[_0xa6fb('0x30')]);_0x2a1418[_0xa6fb('0x31')]=_[_0xa6fb('0x32')](_0x2a1418['model'],_0x2a1418['query']);_0x1c40a7[_0xa6fb('0x34')]=_[_0xa6fb('0x32')](_0x2a1418['model'],qs[_0xa6fb('0x35')](_0x1744c0['query'][_0xa6fb('0x35')]));_0x1c40a7['attributes']=_0x1c40a7[_0xa6fb('0x34')][_0xa6fb('0x36')]?_0x1c40a7[_0xa6fb('0x34')]:_0x2a1418['model'];if(!_0x1744c0['query']['hasOwnProperty'](_0xa6fb('0x38'))){_0x1c40a7[_0xa6fb('0x1e')]=qs[_0xa6fb('0x1e')](_0x1744c0[_0xa6fb('0x30')][_0xa6fb('0x1e')]);_0x1c40a7['offset']=qs['offset'](_0x1744c0[_0xa6fb('0x30')][_0xa6fb('0x1c')]);}_0x1c40a7[_0xa6fb('0x39')]=qs[_0xa6fb('0x3a')](_0x1744c0[_0xa6fb('0x30')][_0xa6fb('0x3a')]);_0x1c40a7[_0xa6fb('0x3b')]=qs['filters'](_['pick'](_0x1744c0['query'],_0x2a1418[_0xa6fb('0x31')]));_0x1c40a7['where'][_0xa6fb('0x52')]=_0x2a52ae['id'];if(_0x1744c0[_0xa6fb('0x30')][_0xa6fb('0x40')]){_0x1c40a7['where']=_[_0xa6fb('0x3d')](_0x1c40a7[_0xa6fb('0x3b')],{'$or':_['map'](_0x1c40a7[_0xa6fb('0x34')],function(_0x5135e0){var _0x693363={};_0x693363[_0x5135e0]={'$like':'%'+_0x1744c0['query'][_0xa6fb('0x40')]+'%'};return _0x693363;})});}_0x1c40a7=_['merge']({},_0x1c40a7,_0x1744c0[_0xa6fb('0x41')]);return db['UserSmsQueue'][_0xa6fb('0x43')](_0x1c40a7);}})[_0xa6fb('0x24')](function(_0x2c2b19){if(_0x2c2b19){return db[_0xa6fb('0x53')][_0xa6fb('0x54')]({'where':{'id':_['map'](_0x2c2b19,_0xa6fb('0x55')),'role':_0xa6fb('0x56')},'attributes':['id',_0xa6fb('0x29'),_0xa6fb('0x57'),_0xa6fb('0x58'),_0xa6fb('0x59')]});}})[_0xa6fb('0x24')](function(_0x56827a){if(_0x56827a){return{'count':_0x56827a['count'],'rows':_['map'](_0x56827a[_0xa6fb('0x5a')],function(_0x1b8103){return{'membername':_0x1b8103[_0xa6fb('0x29')],'UserId':_0x1b8103['id'],'queue_name':_0xabb923['name'],'SmsQueueId':_0xabb923['id'],'interface':util['format'](_0xa6fb('0x5b'),'SIP',_0x1b8103['name']),'penalty':0x0,'paused':_0x1b8103[_0xa6fb('0x57')],'createdAt':_0x1b8103[_0xa6fb('0x59')],'updatedAt':_0x1b8103[_0xa6fb('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa6fb('0x24')](respondWithFilteredResult(_0x1ac370,_0x1c40a7))[_0xa6fb('0x46')](handleError(_0x1ac370,null));};exports[_0xa6fb('0x5c')]=function(_0x34698d,_0x2a3815,_0x34b3f4){var _0x313ba4={};var _0x1e6b16={};var _0x3b8fa8;var _0x5d0956;return db[_0xa6fb('0x2b')]['findOne']({'where':{'id':_0x34698d[_0xa6fb('0x44')]['id']}})[_0xa6fb('0x24')](handleEntityNotFound(_0x2a3815,null))[_0xa6fb('0x24')](function(_0x3bcd48){if(_0x3bcd48){_0x3b8fa8=_0x3bcd48;_0x1e6b16[_0xa6fb('0x33')]=_[_0xa6fb('0x2f')](db['Team'][_0xa6fb('0x5d')]);_0x1e6b16[_0xa6fb('0x30')]=_['keys'](_0x34698d[_0xa6fb('0x30')]);_0x1e6b16['filters']=_[_0xa6fb('0x32')](_0x1e6b16[_0xa6fb('0x33')],_0x1e6b16[_0xa6fb('0x30')]);_0x313ba4['attributes']=_[_0xa6fb('0x32')](_0x1e6b16['model'],qs[_0xa6fb('0x35')](_0x34698d[_0xa6fb('0x30')][_0xa6fb('0x35')]));_0x313ba4[_0xa6fb('0x34')]=_0x313ba4['attributes'][_0xa6fb('0x36')]?_0x313ba4[_0xa6fb('0x34')]:_0x1e6b16['model'];_0x313ba4[_0xa6fb('0x39')]=qs[_0xa6fb('0x3a')](_0x34698d[_0xa6fb('0x30')][_0xa6fb('0x3a')]);_0x313ba4[_0xa6fb('0x3b')]=qs[_0xa6fb('0x31')](_[_0xa6fb('0x3c')](_0x34698d[_0xa6fb('0x30')],_0x1e6b16[_0xa6fb('0x31')]));if(_0x34698d[_0xa6fb('0x30')][_0xa6fb('0x40')]){_0x313ba4[_0xa6fb('0x3b')]=_[_0xa6fb('0x3d')](_0x313ba4[_0xa6fb('0x3b')],{'$or':_['map'](_0x313ba4['attributes'],function(_0x4050f8){var _0x513cbf={};_0x513cbf[_0x4050f8]={'$like':'%'+_0x34698d['query'][_0xa6fb('0x40')]+'%'};return _0x513cbf;})});}_0x313ba4=_[_0xa6fb('0x3d')]({},_0x313ba4,_0x34698d[_0xa6fb('0x41')]);return _0x3b8fa8[_0xa6fb('0x5c')](_0x313ba4);}})[_0xa6fb('0x24')](function(_0x204562){if(_0x204562){_0x5d0956=_0x204562[_0xa6fb('0x36')];if(!_0x34698d[_0xa6fb('0x30')][_0xa6fb('0x37')](_0xa6fb('0x38'))){_0x313ba4[_0xa6fb('0x1e')]=qs[_0xa6fb('0x1e')](_0x34698d[_0xa6fb('0x30')]['limit']);_0x313ba4[_0xa6fb('0x1c')]=qs[_0xa6fb('0x1c')](_0x34698d[_0xa6fb('0x30')][_0xa6fb('0x1c')]);}return _0x3b8fa8[_0xa6fb('0x5c')](_0x313ba4);}})['then'](function(_0x3625c9){if(_0x3625c9){return _0x3625c9?{'count':_0x5d0956,'rows':_0x3625c9}:null;}})[_0xa6fb('0x24')](respondWithResult(_0x2a3815,null))[_0xa6fb('0x46')](handleError(_0x2a3815,null));};exports[_0xa6fb('0x5e')]=function(_0x829f5,_0x44fae9,_0x28c616){var _0x109619=_0x829f5['body'][_0xa6fb('0x5f')];return db['Team'][_0xa6fb('0x43')]({'where':{'id':_0x109619},'attributes':['id'],'include':[{'model':db[_0xa6fb('0x53')],'as':_0xa6fb('0x60'),'attributes':['id',_0xa6fb('0x29'),_0xa6fb('0x61'),'voicePause',_0xa6fb('0x62')],'raw':!![]}]})[_0xa6fb('0x24')](function(_0x211d4b){if(_0x211d4b){var _0x258b5a=_['flatMap'](_0x211d4b,function(_0x25f298){var _0x3360ef=_0x25f298['get']({'plain':!![]});return _0x3360ef[_0xa6fb('0x60')];});return db[_0xa6fb('0x2b')][_0xa6fb('0x45')]({'where':{'id':_0x829f5[_0xa6fb('0x44')]['id']}})[_0xa6fb('0x24')](function(_0x3237fe){return db[_0xa6fb('0x63')][_0xa6fb('0x64')](function(_0x45b815){return _0x3237fe['addTeams'](_0x109619,{'transaction':_0x45b815})[_0xa6fb('0x24')](function(){return BPromise[_0xa6fb('0x65')](_0x258b5a,function(_0x215b17){return db[_0xa6fb('0x51')]['findOrCreate']({'where':{'UserId':_0x215b17['id'],'SmsQueueId':_0x829f5['params']['id']},'transaction':_0x45b815});});})[_0xa6fb('0x24')](function(){_0x258b5a[_0xa6fb('0x66')](function(_0x3db1df){socket['emit']('userSmsQueue:save',{'UserId':_0x3db1df['id'],'SmsQueueId':_0x3237fe['id']});});});});});}})[_0xa6fb('0x24')](respondWithStatusCode(_0x44fae9,null))[_0xa6fb('0x46')](handleError(_0x44fae9,null));};exports['removeTeams']=function(_0x42e6fd,_0x1baae4,_0x42d676){return db['Team'][_0xa6fb('0x43')]({'where':{'id':_0x42e6fd[_0xa6fb('0x30')][_0xa6fb('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa6fb('0x60'),'attributes':['id'],'raw':!![]}]})[_0xa6fb('0x24')](handleEntityNotFound(_0x1baae4,null))[_0xa6fb('0x24')](function(_0x578fb3){var _0x3e19d1=_['map'](_0x578fb3,'id');var _0x1f23a0=[];var _0x5da53a=[];var _0x2977fd=squel[_0xa6fb('0x67')]();_0x2977fd[_0xa6fb('0x68')]('tq.TeamId')[_0xa6fb('0x69')](_0xa6fb('0x6a'),'tq')[_0xa6fb('0x6b')](_0xa6fb('0x6c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa6fb('0x3b')](_0xa6fb('0x6d'),_0x42e6fd[_0xa6fb('0x44')]['id']);for(var _0x2987cd=0x0;_0x2987cd<_0x578fb3[_0xa6fb('0x36')];_0x2987cd+=0x1){let _0x2c3b9d=_0x578fb3[_0x2987cd];for(var _0x116da9=0x0;_0x116da9<_0x2c3b9d[_0xa6fb('0x60')][_0xa6fb('0x36')];_0x116da9+=0x1){let _0x3b3547=_0x2c3b9d[_0xa6fb('0x60')][_0x116da9];var _0x11b844=_0x2977fd[_0xa6fb('0x6e')]();_0x11b844[_0xa6fb('0x3b')](_0xa6fb('0x6f'),_0x3b3547['id']);_0x5da53a[_0xa6fb('0x70')](db[_0xa6fb('0x63')][_0xa6fb('0x30')](_0x11b844[_0xa6fb('0x71')](),{'type':db[_0xa6fb('0x63')][_0xa6fb('0x72')][_0xa6fb('0x73')]})['then'](function(_0x42363f){if(_0x42363f[_0xa6fb('0x36')]===0x1){return _0x3b3547['id'];}else{var _0x12b984=_[_0xa6fb('0x74')](_['map'](_0x42363f,_0xa6fb('0x75')),function(_0x3b02b5){return _['includes'](_0x3e19d1,_0x3b02b5);});if(_0x12b984){return _0x3b3547['id'];}}}));}}return BPromise['all'](_0x5da53a)[_0xa6fb('0x24')](function(_0x5082a1){_0x1f23a0=_(_0x1f23a0)['union'](_0x5082a1)[_0xa6fb('0x76')]()[_0xa6fb('0x77')]();return db['SmsQueue']['find']({'where':{'id':_0x42e6fd[_0xa6fb('0x44')]['id']}})['then'](function(_0x2b4bc7){return db[_0xa6fb('0x63')][_0xa6fb('0x64')](function(_0x42cbd2){return _0x2b4bc7[_0xa6fb('0x78')](_0x42e6fd['query'][_0xa6fb('0x5f')],{'transaction':_0x42cbd2})[_0xa6fb('0x24')](function(){if(!_[_0xa6fb('0x79')](_0x1f23a0)){return _0x2b4bc7['removeAgents'](_0x1f23a0,{'transaction':_0x42cbd2});}})[_0xa6fb('0x24')](function(){_0x1f23a0[_0xa6fb('0x66')](function(_0x5c78df){socket[_0xa6fb('0x7a')](_0xa6fb('0x7b'),{'UserId':_0x5c78df,'SmsQueueId':_0x2b4bc7['id']});});});});});});})[_0xa6fb('0x24')](respondWithStatusCode(_0x1baae4,null))[_0xa6fb('0x46')](handleError(_0x1baae4,null));};exports[_0xa6fb('0x7c')]=function(_0x2bcbfe,_0x57668a,_0x8f0a06){return db['SmsQueue'][_0xa6fb('0x45')]({'where':{'id':_0x2bcbfe[_0xa6fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x57668a,null))[_0xa6fb('0x24')](function(_0x1d2a8b){if(_0x1d2a8b){return _0x1d2a8b[_0xa6fb('0x7c')](_0x2bcbfe['body'][_0xa6fb('0x5f')],_[_0xa6fb('0x7d')](_0x2bcbfe[_0xa6fb('0x48')],['ids','id'])||{})['spread'](function(_0x3b51dc){for(var _0x32e45f=0x0;_0x32e45f<_0x2bcbfe[_0xa6fb('0x48')][_0xa6fb('0x5f')][_0xa6fb('0x36')];_0x32e45f+=0x1){socket[_0xa6fb('0x7a')](_0xa6fb('0x7e'),{'UserId':Number(_0x2bcbfe['body'][_0xa6fb('0x5f')][_0x32e45f]),'SmsQueueId':Number(_0x2bcbfe[_0xa6fb('0x44')]['id'])});}return _0x3b51dc;});}})['then'](respondWithResult(_0x57668a,null))[_0xa6fb('0x46')](handleError(_0x57668a,null));};exports[_0xa6fb('0x7f')]=function(_0x5dbcb0,_0x395cea,_0x485981){return db[_0xa6fb('0x2b')][_0xa6fb('0x45')]({'where':{'id':_0x5dbcb0[_0xa6fb('0x44')]['id']}})[_0xa6fb('0x24')](handleEntityNotFound(_0x395cea,null))['then'](function(_0x15dc4f){if(_0x15dc4f){return _0x15dc4f['removeAgents'](_0x5dbcb0[_0xa6fb('0x30')][_0xa6fb('0x5f')])[_0xa6fb('0x24')](function(){if(_['isArray'](_0x5dbcb0[_0xa6fb('0x30')]['ids'])){for(var _0x280e25=0x0;_0x280e25<_0x5dbcb0[_0xa6fb('0x30')][_0xa6fb('0x5f')][_0xa6fb('0x36')];_0x280e25+=0x1){socket[_0xa6fb('0x7a')](_0xa6fb('0x7b'),{'UserId':Number(_0x5dbcb0[_0xa6fb('0x30')][_0xa6fb('0x5f')][_0x280e25]),'SmsQueueId':Number(_0x5dbcb0['params']['id'])});}}else{socket[_0xa6fb('0x7a')](_0xa6fb('0x7b'),{'UserId':Number(_0x5dbcb0[_0xa6fb('0x30')][_0xa6fb('0x5f')]),'SmsQueueId':Number(_0x5dbcb0[_0xa6fb('0x44')]['id'])});}});}})[_0xa6fb('0x24')](respondWithStatusCode(_0x395cea,null))[_0xa6fb('0x46')](handleError(_0x395cea,null));};exports[_0xa6fb('0x80')]=function(_0x394abb,_0x672e5e,_0x16f378){var _0x59ce73={};var _0x376495={};var _0x3c9d74;var _0x41865e;return db['SmsQueue'][_0xa6fb('0x50')]({'where':{'id':_0x394abb[_0xa6fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x672e5e,null))[_0xa6fb('0x24')](function(_0x59bc61){if(_0x59bc61){_0x3c9d74=_0x59bc61;_0x376495[_0xa6fb('0x33')]=_[_0xa6fb('0x2f')](db[_0xa6fb('0x53')][_0xa6fb('0x5d')]);_0x376495[_0xa6fb('0x30')]=_[_0xa6fb('0x2f')](_0x394abb['query']);_0x376495[_0xa6fb('0x31')]=_[_0xa6fb('0x32')](_0x376495['model'],_0x376495['query']);_0x59ce73[_0xa6fb('0x34')]=_[_0xa6fb('0x32')](_0x376495[_0xa6fb('0x33')],qs[_0xa6fb('0x35')](_0x394abb['query'][_0xa6fb('0x35')]));_0x59ce73[_0xa6fb('0x34')]=_0x59ce73[_0xa6fb('0x34')][_0xa6fb('0x36')]?_0x59ce73[_0xa6fb('0x34')]:_0x376495[_0xa6fb('0x33')];_0x59ce73[_0xa6fb('0x39')]=qs['sort'](_0x394abb[_0xa6fb('0x30')][_0xa6fb('0x3a')]);_0x59ce73[_0xa6fb('0x3b')]=qs[_0xa6fb('0x31')](_[_0xa6fb('0x3c')](_0x394abb[_0xa6fb('0x30')],_0x376495[_0xa6fb('0x31')]));if(_0x394abb[_0xa6fb('0x30')]['filter']){_0x59ce73[_0xa6fb('0x3b')]=_['merge'](_0x59ce73[_0xa6fb('0x3b')],{'$or':_[_0xa6fb('0x3e')](_0x59ce73['attributes'],function(_0x1b6c44){var _0x5e925f={};_0x5e925f[_0x1b6c44]={'$like':'%'+_0x394abb[_0xa6fb('0x30')][_0xa6fb('0x40')]+'%'};return _0x5e925f;})});}_0x59ce73=_[_0xa6fb('0x3d')]({},_0x59ce73,_0x394abb['options']);return _0x3c9d74['getAgents'](_0x59ce73);}})[_0xa6fb('0x24')](function(_0x195e58){if(_0x195e58){_0x41865e=_0x195e58[_0xa6fb('0x36')];if(!_0x394abb[_0xa6fb('0x30')][_0xa6fb('0x37')]('nolimit')){_0x59ce73[_0xa6fb('0x1e')]=qs[_0xa6fb('0x1e')](_0x394abb[_0xa6fb('0x30')][_0xa6fb('0x1e')]);_0x59ce73[_0xa6fb('0x1c')]=qs['offset'](_0x394abb[_0xa6fb('0x30')][_0xa6fb('0x1c')]);}return _0x3c9d74['getAgents'](_0x59ce73);}})[_0xa6fb('0x24')](function(_0x32ee25){if(_0x32ee25){return _0x32ee25?{'count':_0x41865e,'rows':_0x32ee25}:null;}})[_0xa6fb('0x24')](respondWithResult(_0x672e5e,null))[_0xa6fb('0x46')](handleError(_0x672e5e,null));}; \ No newline at end of file +var _0x8aa7=['User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','SmsQueues','destroy','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','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','catch','update','describe','findOne','SmsQueueId','UserSmsQueue','UserId','agent','smsPause','updatedAt','createdAt','SIP','getTeams','Team','ids'];(function(_0x2c532d,_0x3b90bf){var _0x4cb027=function(_0x1ecd1b){while(--_0x1ecd1b){_0x2c532d['push'](_0x2c532d['shift']());}};_0x4cb027(++_0x3b90bf);}(_0x8aa7,0x1c4));var _0x78aa=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x8aa7[_0x49d41c];return _0xb64c5f;};'use strict';var emlformat=require(_0x78aa('0x0'));var rimraf=require(_0x78aa('0x1'));var zipdir=require(_0x78aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x78aa('0x3'));var BPromise=require(_0x78aa('0x4'));var Mustache=require(_0x78aa('0x5'));var util=require(_0x78aa('0x6'));var path=require('path');var sox=require(_0x78aa('0x7'));var csv=require('to-csv');var ejs=require(_0x78aa('0x8'));var fs=require('fs');var fs_extra=require(_0x78aa('0x9'));var _=require(_0x78aa('0xa'));var squel=require(_0x78aa('0xb'));var crypto=require(_0x78aa('0xc'));var jsforce=require(_0x78aa('0xd'));var deskjs=require(_0x78aa('0xe'));var toCsv=require(_0x78aa('0xf'));var querystring=require(_0x78aa('0x10'));var Papa=require(_0x78aa('0x11'));var Redis=require('ioredis');var authService=require(_0x78aa('0x12'));var qs=require(_0x78aa('0x13'));var as=require(_0x78aa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78aa('0x15'));var utils=require('../../config/utils');var config=require(_0x78aa('0x16'));var licenseUtil=require(_0x78aa('0x17'));var db=require(_0x78aa('0x18'))['db'];config['redis']=_[_0x78aa('0x19')](config[_0x78aa('0x1a')],{'host':_0x78aa('0x1b'),'port':0x18eb});var socket=require(_0x78aa('0x1c'))(new Redis(config['redis']));require(_0x78aa('0x1d'))[_0x78aa('0x1e')](socket);function respondWithStatusCode(_0x3c6e2e,_0x5b22ec){_0x5b22ec=_0x5b22ec||0xcc;return function(_0x42775d){if(_0x42775d){return _0x3c6e2e['sendStatus'](_0x5b22ec);}return _0x3c6e2e[_0x78aa('0x1f')](_0x5b22ec)[_0x78aa('0x20')]();};}function respondWithResult(_0x235110,_0x342a91){_0x342a91=_0x342a91||0xc8;return function(_0x42e445){if(_0x42e445){return _0x235110[_0x78aa('0x1f')](_0x342a91)[_0x78aa('0x21')](_0x42e445);}};}function respondWithFilteredResult(_0x67a4f7,_0x15cfcb){return function(_0x319317){if(_0x319317){var _0x4d3af1=typeof _0x15cfcb[_0x78aa('0x22')]==='undefined'&&typeof _0x15cfcb['limit']===_0x78aa('0x23');var _0x4bb17b=_0x319317[_0x78aa('0x24')];var _0x5688a8=_0x4d3af1?0x0:_0x15cfcb['offset'];var _0x58978a=_0x4d3af1?_0x319317[_0x78aa('0x24')]:_0x15cfcb[_0x78aa('0x22')]+_0x15cfcb[_0x78aa('0x25')];var _0x3b46ca;if(_0x58978a>=_0x4bb17b){_0x58978a=_0x4bb17b;_0x3b46ca=0xc8;}else{_0x3b46ca=0xce;}_0x67a4f7['status'](_0x3b46ca);return _0x67a4f7[_0x78aa('0x26')](_0x78aa('0x27'),_0x5688a8+'-'+_0x58978a+'/'+_0x4bb17b)[_0x78aa('0x21')](_0x319317);}return null;};}function patchUpdates(_0x408cdc){return function(_0x17b301){try{jsonpatch[_0x78aa('0x28')](_0x17b301,_0x408cdc,!![]);}catch(_0x14ca00){return BPromise['reject'](_0x14ca00);}return _0x17b301[_0x78aa('0x29')]();};}function saveUpdates(_0x547a80,_0x19e1ea){return function(_0x5c11bd){if(_0x5c11bd){return _0x5c11bd['update'](_0x547a80)['then'](function(_0x1ebc1e){return _0x1ebc1e;});}return null;};}function removeEntity(_0x2b5c0c,_0x2a8ec8){return function(_0x452b34){if(_0x452b34){return _0x452b34['destroy']()[_0x78aa('0x2a')](function(){var _0x193dea=_0x452b34[_0x78aa('0x2b')]({'plain':!![]});var _0x3bf6ff=_0x78aa('0x2c');return db['UserProfileResource'][_0x78aa('0x2d')]({'where':{'type':_0x3bf6ff,'resourceId':_0x193dea['id']}})[_0x78aa('0x2a')](function(){return _0x452b34;});})[_0x78aa('0x2a')](function(){_0x2b5c0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3aa00,_0x3dcc55){return function(_0x4151ad){if(!_0x4151ad){_0xd3aa00[_0x78aa('0x2e')](0x194);}return _0x4151ad;};}function handleError(_0x5b108b,_0x13d6df){_0x13d6df=_0x13d6df||0x1f4;return function(_0x185cc9){logger[_0x78aa('0x2f')](_0x185cc9[_0x78aa('0x30')]);if(_0x185cc9[_0x78aa('0x31')]){delete _0x185cc9['name'];}_0x5b108b[_0x78aa('0x1f')](_0x13d6df)[_0x78aa('0x32')](_0x185cc9);};}exports[_0x78aa('0x33')]=function(_0x7e54da,_0x17f859){var _0x397c35={},_0x4e83da={},_0x16fa49={'count':0x0,'rows':[]};var _0x1ac46c=_[_0x78aa('0x34')](db[_0x78aa('0x35')][_0x78aa('0x36')],function(_0x429d7b){return{'name':_0x429d7b[_0x78aa('0x37')],'type':_0x429d7b[_0x78aa('0x38')][_0x78aa('0x39')]};});_0x4e83da[_0x78aa('0x3a')]=_[_0x78aa('0x34')](_0x1ac46c,_0x78aa('0x31'));_0x4e83da['query']=_[_0x78aa('0x3b')](_0x7e54da['query']);_0x4e83da[_0x78aa('0x3c')]=_[_0x78aa('0x3d')](_0x4e83da['model'],_0x4e83da[_0x78aa('0x3e')]);_0x397c35[_0x78aa('0x3f')]=_[_0x78aa('0x3d')](_0x4e83da[_0x78aa('0x3a')],qs[_0x78aa('0x40')](_0x7e54da[_0x78aa('0x3e')][_0x78aa('0x40')]));_0x397c35['attributes']=_0x397c35[_0x78aa('0x3f')][_0x78aa('0x41')]?_0x397c35[_0x78aa('0x3f')]:_0x4e83da[_0x78aa('0x3a')];if(!_0x7e54da[_0x78aa('0x3e')][_0x78aa('0x42')](_0x78aa('0x43'))){_0x397c35[_0x78aa('0x25')]=qs[_0x78aa('0x25')](_0x7e54da['query'][_0x78aa('0x25')]);_0x397c35[_0x78aa('0x22')]=qs[_0x78aa('0x22')](_0x7e54da[_0x78aa('0x3e')][_0x78aa('0x22')]);}_0x397c35[_0x78aa('0x44')]=qs[_0x78aa('0x45')](_0x7e54da[_0x78aa('0x3e')][_0x78aa('0x45')]);_0x397c35[_0x78aa('0x46')]=qs['filters'](_[_0x78aa('0x47')](_0x7e54da['query'],_0x4e83da[_0x78aa('0x3c')]),_0x1ac46c);if(_0x7e54da['query'][_0x78aa('0x48')]){_0x397c35[_0x78aa('0x46')]=_['merge'](_0x397c35[_0x78aa('0x46')],{'$or':_['map'](_0x1ac46c,function(_0x5dd1f9){if(_0x5dd1f9['type']!=='VIRTUAL'){var _0x23f511={};_0x23f511[_0x5dd1f9[_0x78aa('0x31')]]={'$like':'%'+_0x7e54da[_0x78aa('0x3e')]['filter']+'%'};return _0x23f511;}})});}_0x397c35=_[_0x78aa('0x49')]({},_0x397c35,_0x7e54da[_0x78aa('0x4a')]);var _0x5ab11b={'where':_0x397c35['where']};return db[_0x78aa('0x35')]['count'](_0x5ab11b)[_0x78aa('0x2a')](function(_0x569cea){_0x16fa49[_0x78aa('0x24')]=_0x569cea;if(_0x7e54da[_0x78aa('0x3e')][_0x78aa('0x4b')]){_0x397c35[_0x78aa('0x4c')]=[{'all':!![]}];}return db[_0x78aa('0x35')][_0x78aa('0x4d')](_0x397c35);})[_0x78aa('0x2a')](function(_0x3fc664){_0x16fa49['rows']=_0x3fc664;return _0x16fa49;})[_0x78aa('0x2a')](respondWithFilteredResult(_0x17f859,_0x397c35))['catch'](handleError(_0x17f859,null));};exports[_0x78aa('0x4e')]=function(_0xb3c72d,_0xd12901){var _0x7086c={'raw':!![],'where':{'id':_0xb3c72d[_0x78aa('0x4f')]['id']}},_0x2baa5f={};_0x2baa5f[_0x78aa('0x3a')]=_[_0x78aa('0x3b')](db[_0x78aa('0x35')][_0x78aa('0x36')]);_0x2baa5f[_0x78aa('0x3e')]=_[_0x78aa('0x3b')](_0xb3c72d[_0x78aa('0x3e')]);_0x2baa5f[_0x78aa('0x3c')]=_[_0x78aa('0x3d')](_0x2baa5f['model'],_0x2baa5f[_0x78aa('0x3e')]);_0x7086c[_0x78aa('0x3f')]=_[_0x78aa('0x3d')](_0x2baa5f['model'],qs[_0x78aa('0x40')](_0xb3c72d['query']['fields']));_0x7086c[_0x78aa('0x3f')]=_0x7086c['attributes'][_0x78aa('0x41')]?_0x7086c['attributes']:_0x2baa5f[_0x78aa('0x3a')];if(_0xb3c72d[_0x78aa('0x3e')][_0x78aa('0x4b')]){_0x7086c[_0x78aa('0x4c')]=[{'all':!![]}];}_0x7086c=_[_0x78aa('0x49')]({},_0x7086c,_0xb3c72d['options']);return db[_0x78aa('0x35')][_0x78aa('0x50')](_0x7086c)['then'](handleEntityNotFound(_0xd12901,null))[_0x78aa('0x2a')](respondWithResult(_0xd12901,null))['catch'](handleError(_0xd12901,null));};exports['create']=function(_0x42319f,_0x3f55fe){return db['SmsQueue'][_0x78aa('0x51')](_0x42319f[_0x78aa('0x52')],{})[_0x78aa('0x2a')](function(_0x4d0f40){var _0x19f3e8=_0x42319f[_0x78aa('0x53')][_0x78aa('0x2b')]({'plain':!![]});if(!_0x19f3e8)throw new Error(_0x78aa('0x54'));if(_0x19f3e8[_0x78aa('0x55')]===_0x78aa('0x53')){var _0x30c5ca=_0x4d0f40[_0x78aa('0x2b')]({'plain':!![]});var _0x529b98='SmsQueues';return db[_0x78aa('0x56')][_0x78aa('0x50')]({'where':{'name':_0x529b98,'userProfileId':_0x19f3e8['userProfileId']},'raw':!![]})['then'](function(_0x39d7a5){if(_0x39d7a5&&_0x39d7a5[_0x78aa('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x30c5ca[_0x78aa('0x31')],'resourceId':_0x30c5ca['id'],'type':_0x39d7a5[_0x78aa('0x31')],'sectionId':_0x39d7a5['id']},{})[_0x78aa('0x2a')](function(){return _0x4d0f40;});}else{return _0x4d0f40;}})['catch'](function(_0x3a00ed){logger[_0x78aa('0x2f')](_0x78aa('0x58'),_0x3a00ed);throw _0x3a00ed;});}return _0x4d0f40;})[_0x78aa('0x2a')](respondWithResult(_0x3f55fe,0xc9))[_0x78aa('0x59')](handleError(_0x3f55fe,null));};exports[_0x78aa('0x5a')]=function(_0x3573d6,_0x3d0305){if(_0x3573d6[_0x78aa('0x52')]['id']){delete _0x3573d6[_0x78aa('0x52')]['id'];}return db['SmsQueue'][_0x78aa('0x50')]({'where':{'id':_0x3573d6[_0x78aa('0x4f')]['id']}})[_0x78aa('0x2a')](handleEntityNotFound(_0x3d0305,null))[_0x78aa('0x2a')](saveUpdates(_0x3573d6['body'],null))[_0x78aa('0x2a')](respondWithResult(_0x3d0305,null))[_0x78aa('0x59')](handleError(_0x3d0305,null));};exports[_0x78aa('0x2d')]=function(_0x2358ce,_0x475e2c){return db[_0x78aa('0x35')][_0x78aa('0x50')]({'where':{'id':_0x2358ce['params']['id']}})['then'](handleEntityNotFound(_0x475e2c,null))[_0x78aa('0x2a')](removeEntity(_0x475e2c,null))[_0x78aa('0x59')](handleError(_0x475e2c,null));};exports['describe']=function(_0x3c5829,_0x44b246){return db[_0x78aa('0x35')][_0x78aa('0x5b')]()['then'](respondWithResult(_0x44b246,null))['catch'](handleError(_0x44b246,null));};exports['getMembers']=function(_0x1f374c,_0x231a43,_0x2c1c65){var _0xbcbd42={'raw':!![],'where':{}},_0x140def={},_0xbe862b;return db[_0x78aa('0x35')][_0x78aa('0x5c')]({'where':{'id':_0x1f374c[_0x78aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x231a43,null))['then'](function(_0x163648){if(_0x163648){_0xbe862b=_0x163648[_0x78aa('0x2b')]({'plain':!![]});_0x140def[_0x78aa('0x3a')]=_[_0x78aa('0x3b')](db['UserSmsQueue']['rawAttributes']);_0x140def[_0x78aa('0x3e')]=_['keys'](_0x1f374c[_0x78aa('0x3e')]);_0x140def[_0x78aa('0x3c')]=_['intersection'](_0x140def[_0x78aa('0x3a')],_0x140def[_0x78aa('0x3e')]);_0xbcbd42[_0x78aa('0x3f')]=_[_0x78aa('0x3d')](_0x140def[_0x78aa('0x3a')],qs[_0x78aa('0x40')](_0x1f374c[_0x78aa('0x3e')][_0x78aa('0x40')]));_0xbcbd42['attributes']=_0xbcbd42[_0x78aa('0x3f')][_0x78aa('0x41')]?_0xbcbd42[_0x78aa('0x3f')]:_0x140def[_0x78aa('0x3a')];if(!_0x1f374c[_0x78aa('0x3e')]['hasOwnProperty'](_0x78aa('0x43'))){_0xbcbd42[_0x78aa('0x25')]=qs[_0x78aa('0x25')](_0x1f374c[_0x78aa('0x3e')][_0x78aa('0x25')]);_0xbcbd42['offset']=qs[_0x78aa('0x22')](_0x1f374c[_0x78aa('0x3e')][_0x78aa('0x22')]);}_0xbcbd42[_0x78aa('0x44')]=qs[_0x78aa('0x45')](_0x1f374c[_0x78aa('0x3e')][_0x78aa('0x45')]);_0xbcbd42['where']=qs['filters'](_[_0x78aa('0x47')](_0x1f374c[_0x78aa('0x3e')],_0x140def[_0x78aa('0x3c')]));_0xbcbd42['where'][_0x78aa('0x5d')]=_0x163648['id'];if(_0x1f374c[_0x78aa('0x3e')][_0x78aa('0x48')]){_0xbcbd42[_0x78aa('0x46')]=_[_0x78aa('0x49')](_0xbcbd42[_0x78aa('0x46')],{'$or':_['map'](_0xbcbd42['attributes'],function(_0x112f1e){var _0x1a8472={};_0x1a8472[_0x112f1e]={'$like':'%'+_0x1f374c[_0x78aa('0x3e')]['filter']+'%'};return _0x1a8472;})});}_0xbcbd42=_['merge']({},_0xbcbd42,_0x1f374c[_0x78aa('0x4a')]);return db[_0x78aa('0x5e')][_0x78aa('0x4d')](_0xbcbd42);}})['then'](function(_0x3d4d94){if(_0x3d4d94){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x3d4d94,_0x78aa('0x5f')),'role':_0x78aa('0x60')},'attributes':['id','name',_0x78aa('0x61'),_0x78aa('0x62'),_0x78aa('0x63')]});}})['then'](function(_0x1e3de7){if(_0x1e3de7){return{'count':_0x1e3de7['count'],'rows':_[_0x78aa('0x34')](_0x1e3de7['rows'],function(_0x278e00){return{'membername':_0x278e00[_0x78aa('0x31')],'UserId':_0x278e00['id'],'queue_name':_0xbe862b[_0x78aa('0x31')],'SmsQueueId':_0xbe862b['id'],'interface':util['format']('%s/%s',_0x78aa('0x64'),_0x278e00[_0x78aa('0x31')]),'penalty':0x0,'paused':_0x278e00[_0x78aa('0x61')],'createdAt':_0x278e00[_0x78aa('0x63')],'updatedAt':_0x278e00[_0x78aa('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x78aa('0x2a')](respondWithFilteredResult(_0x231a43,_0xbcbd42))[_0x78aa('0x59')](handleError(_0x231a43,null));};exports[_0x78aa('0x65')]=function(_0x26613a,_0x580ecf,_0x103dcd){var _0x38a74a={};var _0x5dc303={};var _0x41917a;var _0x5e1662;return db[_0x78aa('0x35')][_0x78aa('0x5c')]({'where':{'id':_0x26613a[_0x78aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x580ecf,null))[_0x78aa('0x2a')](function(_0xc377fc){if(_0xc377fc){_0x41917a=_0xc377fc;_0x5dc303[_0x78aa('0x3a')]=_[_0x78aa('0x3b')](db[_0x78aa('0x66')][_0x78aa('0x36')]);_0x5dc303[_0x78aa('0x3e')]=_[_0x78aa('0x3b')](_0x26613a[_0x78aa('0x3e')]);_0x5dc303[_0x78aa('0x3c')]=_['intersection'](_0x5dc303[_0x78aa('0x3a')],_0x5dc303[_0x78aa('0x3e')]);_0x38a74a['attributes']=_['intersection'](_0x5dc303[_0x78aa('0x3a')],qs[_0x78aa('0x40')](_0x26613a[_0x78aa('0x3e')][_0x78aa('0x40')]));_0x38a74a['attributes']=_0x38a74a['attributes'][_0x78aa('0x41')]?_0x38a74a[_0x78aa('0x3f')]:_0x5dc303[_0x78aa('0x3a')];_0x38a74a[_0x78aa('0x44')]=qs['sort'](_0x26613a[_0x78aa('0x3e')][_0x78aa('0x45')]);_0x38a74a[_0x78aa('0x46')]=qs[_0x78aa('0x3c')](_['pick'](_0x26613a[_0x78aa('0x3e')],_0x5dc303[_0x78aa('0x3c')]));if(_0x26613a['query'][_0x78aa('0x48')]){_0x38a74a['where']=_[_0x78aa('0x49')](_0x38a74a['where'],{'$or':_['map'](_0x38a74a[_0x78aa('0x3f')],function(_0xb52880){var _0x15115f={};_0x15115f[_0xb52880]={'$like':'%'+_0x26613a[_0x78aa('0x3e')][_0x78aa('0x48')]+'%'};return _0x15115f;})});}_0x38a74a=_[_0x78aa('0x49')]({},_0x38a74a,_0x26613a['options']);return _0x41917a[_0x78aa('0x65')](_0x38a74a);}})['then'](function(_0x31e719){if(_0x31e719){_0x5e1662=_0x31e719[_0x78aa('0x41')];if(!_0x26613a[_0x78aa('0x3e')][_0x78aa('0x42')](_0x78aa('0x43'))){_0x38a74a[_0x78aa('0x25')]=qs[_0x78aa('0x25')](_0x26613a[_0x78aa('0x3e')]['limit']);_0x38a74a['offset']=qs['offset'](_0x26613a[_0x78aa('0x3e')][_0x78aa('0x22')]);}return _0x41917a[_0x78aa('0x65')](_0x38a74a);}})[_0x78aa('0x2a')](function(_0x1edb3c){if(_0x1edb3c){return _0x1edb3c?{'count':_0x5e1662,'rows':_0x1edb3c}:null;}})[_0x78aa('0x2a')](respondWithResult(_0x580ecf,null))['catch'](handleError(_0x580ecf,null));};exports['addTeams']=function(_0x4d24b9,_0x5c78d1,_0x245e8e){var _0x512f79=_0x4d24b9['body'][_0x78aa('0x67')];return db[_0x78aa('0x66')][_0x78aa('0x4d')]({'where':{'id':_0x512f79},'attributes':['id'],'include':[{'model':db[_0x78aa('0x68')],'as':_0x78aa('0x69'),'attributes':['id',_0x78aa('0x31'),_0x78aa('0x6a'),_0x78aa('0x6b'),_0x78aa('0x6c')],'raw':!![]}]})[_0x78aa('0x2a')](function(_0x37054d){if(_0x37054d){var _0x16445a=_[_0x78aa('0x6d')](_0x37054d,function(_0x5be7cd){var _0x2b254f=_0x5be7cd[_0x78aa('0x2b')]({'plain':!![]});return _0x2b254f[_0x78aa('0x69')];});return db['SmsQueue']['find']({'where':{'id':_0x4d24b9['params']['id']}})[_0x78aa('0x2a')](function(_0x149e11){return db[_0x78aa('0x6e')][_0x78aa('0x6f')](function(_0x877da4){return _0x149e11['addTeams'](_0x512f79,{'transaction':_0x877da4})[_0x78aa('0x2a')](function(){return BPromise[_0x78aa('0x70')](_0x16445a,function(_0xc4977b){return db['UserSmsQueue'][_0x78aa('0x71')]({'where':{'UserId':_0xc4977b['id'],'SmsQueueId':_0x4d24b9['params']['id']},'transaction':_0x877da4});});})[_0x78aa('0x2a')](function(){_0x16445a[_0x78aa('0x72')](function(_0x11e402){socket[_0x78aa('0x73')](_0x78aa('0x74'),{'UserId':_0x11e402['id'],'SmsQueueId':_0x149e11['id']});});});});});}})[_0x78aa('0x2a')](respondWithStatusCode(_0x5c78d1,null))[_0x78aa('0x59')](handleError(_0x5c78d1,null));};exports[_0x78aa('0x75')]=function(_0x2e9703,_0x597e5e,_0x549516){return db['Team']['findAll']({'where':{'id':_0x2e9703[_0x78aa('0x3e')][_0x78aa('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x78aa('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x597e5e,null))['then'](function(_0x2fed02){var _0x58134c=_['map'](_0x2fed02,'id');var _0x464d68=[];var _0x37c077=[];var _0x580050=squel['select']();_0x580050['field'](_0x78aa('0x76'))[_0x78aa('0x77')](_0x78aa('0x78'),'tq')[_0x78aa('0x79')](_0x78aa('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x78aa('0x46')]('SmsQueueId\x20=\x20?',_0x2e9703[_0x78aa('0x4f')]['id']);for(var _0x4f6c1e=0x0;_0x4f6c1e<_0x2fed02[_0x78aa('0x41')];_0x4f6c1e+=0x1){let _0x271368=_0x2fed02[_0x4f6c1e];for(var _0x921142=0x0;_0x921142<_0x271368[_0x78aa('0x69')][_0x78aa('0x41')];_0x921142+=0x1){let _0x414523=_0x271368[_0x78aa('0x69')][_0x921142];var _0x35aa70=_0x580050[_0x78aa('0x7b')]();_0x35aa70[_0x78aa('0x46')](_0x78aa('0x7c'),_0x414523['id']);_0x37c077['push'](db['sequelize'][_0x78aa('0x3e')](_0x35aa70[_0x78aa('0x7d')](),{'type':db[_0x78aa('0x6e')]['QueryTypes']['SELECT']})['then'](function(_0x41a351){if(_0x41a351[_0x78aa('0x41')]===0x1){return _0x414523['id'];}else{var _0x50ac04=_[_0x78aa('0x7e')](_[_0x78aa('0x34')](_0x41a351,_0x78aa('0x7f')),function(_0x336163){return _['includes'](_0x58134c,_0x336163);});if(_0x50ac04){return _0x414523['id'];}}}));}}return BPromise[_0x78aa('0x80')](_0x37c077)[_0x78aa('0x2a')](function(_0x3fb478){_0x464d68=_(_0x464d68)[_0x78aa('0x81')](_0x3fb478)[_0x78aa('0x82')]()[_0x78aa('0x83')]();return db['SmsQueue']['find']({'where':{'id':_0x2e9703[_0x78aa('0x4f')]['id']}})[_0x78aa('0x2a')](function(_0x2b259e){return db['sequelize'][_0x78aa('0x6f')](function(_0x379513){return _0x2b259e['removeTeams'](_0x2e9703['query'][_0x78aa('0x67')],{'transaction':_0x379513})['then'](function(){if(!_[_0x78aa('0x84')](_0x464d68)){return _0x2b259e[_0x78aa('0x85')](_0x464d68,{'transaction':_0x379513});}})[_0x78aa('0x2a')](function(){_0x464d68[_0x78aa('0x72')](function(_0x34cb57){socket[_0x78aa('0x73')](_0x78aa('0x86'),{'UserId':_0x34cb57,'SmsQueueId':_0x2b259e['id']});});});});});});})[_0x78aa('0x2a')](respondWithStatusCode(_0x597e5e,null))[_0x78aa('0x59')](handleError(_0x597e5e,null));};exports[_0x78aa('0x87')]=function(_0x4e6160,_0x53b47a,_0x1822ee){return db[_0x78aa('0x35')][_0x78aa('0x50')]({'where':{'id':_0x4e6160[_0x78aa('0x4f')]['id']}})[_0x78aa('0x2a')](handleEntityNotFound(_0x53b47a,null))[_0x78aa('0x2a')](function(_0x492a3a){if(_0x492a3a){return _0x492a3a[_0x78aa('0x87')](_0x4e6160[_0x78aa('0x52')]['ids'],_[_0x78aa('0x88')](_0x4e6160[_0x78aa('0x52')],[_0x78aa('0x67'),'id'])||{})[_0x78aa('0x89')](function(_0xcdac8d){for(var _0x505000=0x0;_0x505000<_0x4e6160[_0x78aa('0x52')][_0x78aa('0x67')][_0x78aa('0x41')];_0x505000+=0x1){socket[_0x78aa('0x73')](_0x78aa('0x74'),{'UserId':Number(_0x4e6160['body'][_0x78aa('0x67')][_0x505000]),'SmsQueueId':Number(_0x4e6160[_0x78aa('0x4f')]['id'])});}return _0xcdac8d;});}})[_0x78aa('0x2a')](respondWithResult(_0x53b47a,null))[_0x78aa('0x59')](handleError(_0x53b47a,null));};exports[_0x78aa('0x85')]=function(_0x15e5d4,_0x1a63d1,_0xb8d13e){return db[_0x78aa('0x35')][_0x78aa('0x50')]({'where':{'id':_0x15e5d4['params']['id']}})[_0x78aa('0x2a')](handleEntityNotFound(_0x1a63d1,null))[_0x78aa('0x2a')](function(_0x378304){if(_0x378304){return _0x378304['removeAgents'](_0x15e5d4[_0x78aa('0x3e')][_0x78aa('0x67')])[_0x78aa('0x2a')](function(){if(_['isArray'](_0x15e5d4[_0x78aa('0x3e')]['ids'])){for(var _0x37ab98=0x0;_0x37ab98<_0x15e5d4['query'][_0x78aa('0x67')]['length'];_0x37ab98+=0x1){socket[_0x78aa('0x73')](_0x78aa('0x86'),{'UserId':Number(_0x15e5d4[_0x78aa('0x3e')]['ids'][_0x37ab98]),'SmsQueueId':Number(_0x15e5d4[_0x78aa('0x4f')]['id'])});}}else{socket[_0x78aa('0x73')](_0x78aa('0x86'),{'UserId':Number(_0x15e5d4['query'][_0x78aa('0x67')]),'SmsQueueId':Number(_0x15e5d4[_0x78aa('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a63d1,null))['catch'](handleError(_0x1a63d1,null));};exports[_0x78aa('0x8a')]=function(_0x1f49e4,_0x13a5ff,_0x33c697){var _0x2d7516={};var _0x3ea6db={};var _0x273f1f;var _0x4270c1;return db['SmsQueue'][_0x78aa('0x5c')]({'where':{'id':_0x1f49e4[_0x78aa('0x4f')]['id']}})[_0x78aa('0x2a')](handleEntityNotFound(_0x13a5ff,null))['then'](function(_0x27d51c){if(_0x27d51c){_0x273f1f=_0x27d51c;_0x3ea6db['model']=_[_0x78aa('0x3b')](db['User'][_0x78aa('0x36')]);_0x3ea6db[_0x78aa('0x3e')]=_[_0x78aa('0x3b')](_0x1f49e4[_0x78aa('0x3e')]);_0x3ea6db[_0x78aa('0x3c')]=_[_0x78aa('0x3d')](_0x3ea6db[_0x78aa('0x3a')],_0x3ea6db[_0x78aa('0x3e')]);_0x2d7516['attributes']=_[_0x78aa('0x3d')](_0x3ea6db['model'],qs['fields'](_0x1f49e4[_0x78aa('0x3e')]['fields']));_0x2d7516[_0x78aa('0x3f')]=_0x2d7516[_0x78aa('0x3f')][_0x78aa('0x41')]?_0x2d7516[_0x78aa('0x3f')]:_0x3ea6db[_0x78aa('0x3a')];_0x2d7516['order']=qs[_0x78aa('0x45')](_0x1f49e4['query']['sort']);_0x2d7516[_0x78aa('0x46')]=qs['filters'](_[_0x78aa('0x47')](_0x1f49e4[_0x78aa('0x3e')],_0x3ea6db['filters']));if(_0x1f49e4['query']['filter']){_0x2d7516[_0x78aa('0x46')]=_[_0x78aa('0x49')](_0x2d7516[_0x78aa('0x46')],{'$or':_['map'](_0x2d7516[_0x78aa('0x3f')],function(_0x71e421){var _0x22b580={};_0x22b580[_0x71e421]={'$like':'%'+_0x1f49e4['query'][_0x78aa('0x48')]+'%'};return _0x22b580;})});}_0x2d7516=_[_0x78aa('0x49')]({},_0x2d7516,_0x1f49e4[_0x78aa('0x4a')]);return _0x273f1f['getAgents'](_0x2d7516);}})[_0x78aa('0x2a')](function(_0x5b71da){if(_0x5b71da){_0x4270c1=_0x5b71da[_0x78aa('0x41')];if(!_0x1f49e4[_0x78aa('0x3e')][_0x78aa('0x42')](_0x78aa('0x43'))){_0x2d7516[_0x78aa('0x25')]=qs[_0x78aa('0x25')](_0x1f49e4[_0x78aa('0x3e')]['limit']);_0x2d7516[_0x78aa('0x22')]=qs[_0x78aa('0x22')](_0x1f49e4['query']['offset']);}return _0x273f1f[_0x78aa('0x8a')](_0x2d7516);}})['then'](function(_0x3d38ee){if(_0x3d38ee){return _0x3d38ee?{'count':_0x4270c1,'rows':_0x3d38ee}:null;}})['then'](respondWithResult(_0x13a5ff,null))[_0x78aa('0x59')](handleError(_0x13a5ff,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index fa2b7ee..6ff4fad 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 _0x6748=['emit','hasOwnProperty','hook','exports','SmsQueue','setMaxListeners','save','update','remove'];(function(_0xc2d478,_0x16562d){var _0x246875=function(_0x9a354a){while(--_0x9a354a){_0xc2d478['push'](_0xc2d478['shift']());}};_0x246875(++_0x16562d);}(_0x6748,0x94));var _0x8674=function(_0x4bda1a,_0x27b7a3){_0x4bda1a=_0x4bda1a-0x0;var _0x2c9b5e=_0x6748[_0x4bda1a];return _0x2c9b5e;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x8674('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8674('0x1')](0x0);var events={'afterCreate':_0x8674('0x2'),'afterUpdate':_0x8674('0x3'),'afterDestroy':_0x8674('0x4')};function emitEvent(_0x272edc){return function(_0x41846b,_0x5e956a,_0x3e6690){SmsQueueEvents[_0x8674('0x5')](_0x272edc+':'+_0x41846b['id'],_0x41846b);SmsQueueEvents[_0x8674('0x5')](_0x272edc,_0x41846b);_0x3e6690(null);};}for(var e in events){if(events[_0x8674('0x6')](e)){var event=events[e];SmsQueue[_0x8674('0x7')](e,emitEvent(event));}}module[_0x8674('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x6aa2=['hook','exports','SmsQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x6aa2,0xa2));var _0x26aa=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0x6aa2[_0x3fd275];return _0xe4f14f;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x26aa('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x26aa('0x1'),'afterUpdate':_0x26aa('0x2'),'afterDestroy':_0x26aa('0x3')};function emitEvent(_0x2ab695){return function(_0x522fe5,_0x200d19,_0x1dfdac){SmsQueueEvents['emit'](_0x2ab695+':'+_0x522fe5['id'],_0x522fe5);SmsQueueEvents[_0x26aa('0x4')](_0x2ab695,_0x522fe5);_0x1dfdac(null);};}for(var e in events){if(events[_0x26aa('0x5')](e)){var event=events[e];SmsQueue[_0x26aa('0x6')](e,emitEvent(event));}}module[_0x26aa('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index ed345f4..5c135ae 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 _0x6b7c=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b7c,0x198));var _0xc6b7=function(_0x4c6f44,_0x413a03){_0x4c6f44=_0x4c6f44-0x0;var _0x5ee4b9=_0x6b7c[_0x4c6f44];return _0x5ee4b9;};'use strict';var _=require(_0xc6b7('0x0'));var util=require(_0xc6b7('0x1'));var logger=require(_0xc6b7('0x2'))(_0xc6b7('0x3'));var moment=require('moment');var BPromise=require(_0xc6b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6b7('0x5'));var rimraf=require(_0xc6b7('0x6'));var config=require(_0xc6b7('0x7'));var attributes=require(_0xc6b7('0x8'));module[_0xc6b7('0x9')]=function(_0x16d4ac,_0x2a6f36){return _0x16d4ac[_0xc6b7('0xa')](_0xc6b7('0xb'),attributes,{'tableName':_0xc6b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1598=['sms_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x233811,_0x1283e9){var _0x292f41=function(_0xe78d9d){while(--_0xe78d9d){_0x233811['push'](_0x233811['shift']());}};_0x292f41(++_0x1283e9);}(_0x1598,0x1c3));var _0x8159=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1598[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8159('0x0'));var util=require('util');var logger=require(_0x8159('0x1'))(_0x8159('0x2'));var moment=require('moment');var BPromise=require(_0x8159('0x3'));var rp=require(_0x8159('0x4'));var fs=require('fs');var path=require(_0x8159('0x5'));var rimraf=require(_0x8159('0x6'));var config=require(_0x8159('0x7'));var attributes=require('./smsQueue.attributes');module[_0x8159('0x8')]=function(_0x5dacf8,_0x55dcef){return _0x5dacf8['define']('SmsQueue',attributes,{'tableName':_0x8159('0x9'),'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 8c8e97c..2ed43c1 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 _0x4ca7=['limit','include','map','model','then','info','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes'];(function(_0x5f0225,_0x52631a){var _0x2cef4b=function(_0x5a29c6){while(--_0x5a29c6){_0x5f0225['push'](_0x5f0225['shift']());}};_0x2cef4b(++_0x52631a);}(_0x4ca7,0x103));var _0x74ca=function(_0x88c968,_0x320548){_0x88c968=_0x88c968-0x0;var _0x52f893=_0x4ca7[_0x88c968];return _0x52f893;};'use strict';var _=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var moment=require(_0x74ca('0x2'));var BPromise=require(_0x74ca('0x3'));var rs=require(_0x74ca('0x4'));var fs=require('fs');var Redis=require(_0x74ca('0x5'));var db=require(_0x74ca('0x6'))['db'];var utils=require(_0x74ca('0x7'));var logger=require(_0x74ca('0x8'))(_0x74ca('0x9'));var config=require(_0x74ca('0xa'));var jayson=require(_0x74ca('0xb'));var client=jayson['client'][_0x74ca('0xc')]({'port':0x232a});config[_0x74ca('0xd')]=_[_0x74ca('0xe')](config[_0x74ca('0xd')],{'host':_0x74ca('0xf'),'port':0x18eb});var socket=require(_0x74ca('0x10'))(new Redis(config[_0x74ca('0xd')]));require(_0x74ca('0x11'))['register'](socket);function respondWithRpcPromise(_0xcac23b,_0x548ed2,_0x3f15fa){return new BPromise(function(_0x5e6de5,_0x22f0c2){return client[_0x74ca('0x12')](_0xcac23b,_0x3f15fa)['then'](function(_0x4e56eb){logger['info'](_0x74ca('0x13'),_0x548ed2,_0x74ca('0x14'));logger[_0x74ca('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x548ed2,_0x74ca('0x14'),JSON[_0x74ca('0x16')](_0x4e56eb));if(_0x4e56eb[_0x74ca('0x17')]){if(_0x4e56eb['error'][_0x74ca('0x18')]===0x1f4){logger[_0x74ca('0x17')]('SmsQueue,\x20%s,\x20%s',_0x548ed2,_0x4e56eb[_0x74ca('0x17')][_0x74ca('0x19')]);return _0x22f0c2(_0x4e56eb[_0x74ca('0x17')][_0x74ca('0x19')]);}logger[_0x74ca('0x17')](_0x74ca('0x13'),_0x548ed2,_0x4e56eb[_0x74ca('0x17')][_0x74ca('0x19')]);return _0x5e6de5(_0x4e56eb[_0x74ca('0x17')][_0x74ca('0x19')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x548ed2,_0x74ca('0x14'));_0x5e6de5(_0x4e56eb[_0x74ca('0x1a')]['message']);}})[_0x74ca('0x1b')](function(_0x50390d){logger[_0x74ca('0x17')](_0x74ca('0x13'),_0x548ed2,_0x50390d);_0x22f0c2(_0x50390d);});});}exports[_0x74ca('0x1c')]=function(_0x1c4a67){var _0x108420=this;return new Promise(function(_0x145525,_0x3f7a31){return db[_0x74ca('0x1d')][_0x74ca('0x1e')]({'raw':_0x1c4a67[_0x74ca('0x1f')]?_0x1c4a67[_0x74ca('0x1f')][_0x74ca('0x20')]===undefined?!![]:![]:!![],'where':_0x1c4a67['options']?_0x1c4a67[_0x74ca('0x1f')][_0x74ca('0x21')]||null:null,'attributes':_0x1c4a67[_0x74ca('0x1f')]?_0x1c4a67['options'][_0x74ca('0x22')]||null:null,'limit':_0x1c4a67['options']?_0x1c4a67[_0x74ca('0x1f')][_0x74ca('0x23')]||null:null,'include':_0x1c4a67[_0x74ca('0x1f')]?_0x1c4a67[_0x74ca('0x1f')][_0x74ca('0x24')]?_[_0x74ca('0x25')](_0x1c4a67['options'][_0x74ca('0x24')],function(_0x7d1b13){return{'model':db[_0x7d1b13['model']],'as':_0x7d1b13['as'],'attributes':_0x7d1b13[_0x74ca('0x22')],'include':_0x7d1b13[_0x74ca('0x24')]?_['map'](_0x7d1b13[_0x74ca('0x24')],function(_0x2512f6){return{'model':db[_0x2512f6[_0x74ca('0x26')]],'as':_0x2512f6['as'],'attributes':_0x2512f6[_0x74ca('0x22')],'include':_0x2512f6[_0x74ca('0x24')]?_[_0x74ca('0x25')](_0x2512f6[_0x74ca('0x24')],function(_0x49c112){return{'model':db[_0x49c112[_0x74ca('0x26')]],'as':_0x49c112['as'],'attributes':_0x49c112[_0x74ca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x74ca('0x27')](function(_0x16d750){logger[_0x74ca('0x28')](_0x74ca('0x1c'),_0x1c4a67);logger[_0x74ca('0x15')]('GetSmsQueue',_0x1c4a67,JSON[_0x74ca('0x16')](_0x16d750));_0x145525(_0x16d750);})[_0x74ca('0x1b')](function(_0x45ccb1){logger[_0x74ca('0x17')](_0x74ca('0x1c'),_0x45ccb1[_0x74ca('0x19')],_0x1c4a67);_0x3f7a31(_0x108420['error'](0x1f4,_0x45ccb1['message']));});});};exports[_0x74ca('0x29')]=function(_0x537bb9){var _0x3b8f4c=this;return new Promise(function(_0x39e8a9,_0xac737a){return db[_0x74ca('0x1d')]['find']({'raw':_0x537bb9['options']?_0x537bb9[_0x74ca('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x537bb9[_0x74ca('0x1f')]?_0x537bb9[_0x74ca('0x1f')][_0x74ca('0x21')]||null:null,'attributes':_0x537bb9[_0x74ca('0x1f')]?_0x537bb9[_0x74ca('0x1f')][_0x74ca('0x22')]||null:null,'include':_0x537bb9['options']?_0x537bb9[_0x74ca('0x1f')][_0x74ca('0x24')]?_['map'](_0x537bb9['options'][_0x74ca('0x24')],function(_0xaa515f){return{'model':db[_0xaa515f['model']],'as':_0xaa515f['as'],'attributes':_0xaa515f[_0x74ca('0x22')],'include':_0xaa515f[_0x74ca('0x24')]?_[_0x74ca('0x25')](_0xaa515f['include'],function(_0x29dbbc){return{'model':db[_0x29dbbc[_0x74ca('0x26')]],'as':_0x29dbbc['as'],'attributes':_0x29dbbc['attributes'],'include':_0x29dbbc[_0x74ca('0x24')]?_[_0x74ca('0x25')](_0x29dbbc[_0x74ca('0x24')],function(_0xa33cbd){return{'model':db[_0xa33cbd[_0x74ca('0x26')]],'as':_0xa33cbd['as'],'attributes':_0xa33cbd[_0x74ca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x74ca('0x27')](function(_0x1c7b42){logger[_0x74ca('0x28')]('ShowSmsQueue',_0x537bb9);logger[_0x74ca('0x15')](_0x74ca('0x29'),_0x537bb9,JSON[_0x74ca('0x16')](_0x1c7b42));_0x39e8a9(_0x1c7b42);})[_0x74ca('0x1b')](function(_0x4b576e){logger[_0x74ca('0x17')]('ShowSmsQueue',_0x4b576e[_0x74ca('0x19')],_0x537bb9);_0xac737a(_0x3b8f4c[_0x74ca('0x17')](0x1f4,_0x4b576e[_0x74ca('0x19')]));});});}; \ No newline at end of file +var _0xe271=['redis','defaults','localhost','./smsQueue.socket','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','ShowSmsQueue','find','where','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x214105,_0x506777){var _0x1cbe79=function(_0x24d4dd){while(--_0x24d4dd){_0x214105['push'](_0x214105['shift']());}};_0x1cbe79(++_0x506777);}(_0xe271,0x9a));var _0x1e27=function(_0x4738b8,_0x44ca3f){_0x4738b8=_0x4738b8-0x0;var _0x2488bf=_0xe271[_0x4738b8];return _0x2488bf;};'use strict';var _=require('lodash');var util=require(_0x1e27('0x0'));var moment=require(_0x1e27('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e27('0x2'));var fs=require('fs');var Redis=require(_0x1e27('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e27('0x4'));var logger=require(_0x1e27('0x5'))(_0x1e27('0x6'));var config=require(_0x1e27('0x7'));var jayson=require(_0x1e27('0x8'));var client=jayson['client'][_0x1e27('0x9')]({'port':0x232a});config[_0x1e27('0xa')]=_[_0x1e27('0xb')](config[_0x1e27('0xa')],{'host':_0x1e27('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e27('0xa')]));require(_0x1e27('0xd'))[_0x1e27('0xe')](socket);function respondWithRpcPromise(_0x493881,_0x4700c2,_0x1bb795){return new BPromise(function(_0x483d94,_0x399914){return client[_0x1e27('0xf')](_0x493881,_0x1bb795)[_0x1e27('0x10')](function(_0x40ea6b){logger[_0x1e27('0x11')]('SmsQueue,\x20%s,\x20%s',_0x4700c2,_0x1e27('0x12'));logger['debug'](_0x1e27('0x13'),_0x4700c2,_0x1e27('0x12'),JSON['stringify'](_0x40ea6b));if(_0x40ea6b[_0x1e27('0x14')]){if(_0x40ea6b[_0x1e27('0x14')][_0x1e27('0x15')]===0x1f4){logger[_0x1e27('0x14')]('SmsQueue,\x20%s,\x20%s',_0x4700c2,_0x40ea6b[_0x1e27('0x14')][_0x1e27('0x16')]);return _0x399914(_0x40ea6b[_0x1e27('0x14')][_0x1e27('0x16')]);}logger['error'](_0x1e27('0x17'),_0x4700c2,_0x40ea6b['error'][_0x1e27('0x16')]);return _0x483d94(_0x40ea6b[_0x1e27('0x14')][_0x1e27('0x16')]);}else{logger[_0x1e27('0x11')]('SmsQueue,\x20%s,\x20%s',_0x4700c2,_0x1e27('0x12'));_0x483d94(_0x40ea6b[_0x1e27('0x18')]['message']);}})[_0x1e27('0x19')](function(_0x2d6759){logger['error'](_0x1e27('0x17'),_0x4700c2,_0x2d6759);_0x399914(_0x2d6759);});});}exports[_0x1e27('0x1a')]=function(_0x4f1cfc){var _0x31fa15=this;return new Promise(function(_0x1d055b,_0x380988){return db[_0x1e27('0x1b')][_0x1e27('0x1c')]({'raw':_0x4f1cfc[_0x1e27('0x1d')]?_0x4f1cfc[_0x1e27('0x1d')][_0x1e27('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f1cfc['options']?_0x4f1cfc['options']['where']||null:null,'attributes':_0x4f1cfc[_0x1e27('0x1d')]?_0x4f1cfc[_0x1e27('0x1d')][_0x1e27('0x1f')]||null:null,'limit':_0x4f1cfc[_0x1e27('0x1d')]?_0x4f1cfc[_0x1e27('0x1d')][_0x1e27('0x20')]||null:null,'include':_0x4f1cfc[_0x1e27('0x1d')]?_0x4f1cfc[_0x1e27('0x1d')][_0x1e27('0x21')]?_[_0x1e27('0x22')](_0x4f1cfc[_0x1e27('0x1d')][_0x1e27('0x21')],function(_0x295e16){return{'model':db[_0x295e16[_0x1e27('0x23')]],'as':_0x295e16['as'],'attributes':_0x295e16[_0x1e27('0x1f')],'include':_0x295e16['include']?_[_0x1e27('0x22')](_0x295e16['include'],function(_0x20ffa6){return{'model':db[_0x20ffa6[_0x1e27('0x23')]],'as':_0x20ffa6['as'],'attributes':_0x20ffa6[_0x1e27('0x1f')],'include':_0x20ffa6[_0x1e27('0x21')]?_[_0x1e27('0x22')](_0x20ffa6['include'],function(_0x44be16){return{'model':db[_0x44be16[_0x1e27('0x23')]],'as':_0x44be16['as'],'attributes':_0x44be16[_0x1e27('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1e27('0x10')](function(_0x302b31){logger[_0x1e27('0x11')](_0x1e27('0x1a'),_0x4f1cfc);logger[_0x1e27('0x24')](_0x1e27('0x1a'),_0x4f1cfc,JSON[_0x1e27('0x25')](_0x302b31));_0x1d055b(_0x302b31);})[_0x1e27('0x19')](function(_0xf0525b){logger[_0x1e27('0x14')](_0x1e27('0x1a'),_0xf0525b['message'],_0x4f1cfc);_0x380988(_0x31fa15[_0x1e27('0x14')](0x1f4,_0xf0525b['message']));});});};exports[_0x1e27('0x26')]=function(_0xd8ab1e){var _0x2e4f29=this;return new Promise(function(_0x6fb339,_0x18d5bc){return db[_0x1e27('0x1b')][_0x1e27('0x27')]({'raw':_0xd8ab1e[_0x1e27('0x1d')]?_0xd8ab1e['options'][_0x1e27('0x1e')]===undefined?!![]:![]:!![],'where':_0xd8ab1e[_0x1e27('0x1d')]?_0xd8ab1e[_0x1e27('0x1d')][_0x1e27('0x28')]||null:null,'attributes':_0xd8ab1e[_0x1e27('0x1d')]?_0xd8ab1e[_0x1e27('0x1d')][_0x1e27('0x1f')]||null:null,'include':_0xd8ab1e[_0x1e27('0x1d')]?_0xd8ab1e[_0x1e27('0x1d')][_0x1e27('0x21')]?_[_0x1e27('0x22')](_0xd8ab1e['options'][_0x1e27('0x21')],function(_0x473548){return{'model':db[_0x473548[_0x1e27('0x23')]],'as':_0x473548['as'],'attributes':_0x473548['attributes'],'include':_0x473548[_0x1e27('0x21')]?_[_0x1e27('0x22')](_0x473548['include'],function(_0x501623){return{'model':db[_0x501623[_0x1e27('0x23')]],'as':_0x501623['as'],'attributes':_0x501623['attributes'],'include':_0x501623['include']?_[_0x1e27('0x22')](_0x501623[_0x1e27('0x21')],function(_0x350e16){return{'model':db[_0x350e16[_0x1e27('0x23')]],'as':_0x350e16['as'],'attributes':_0x350e16[_0x1e27('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x66e701){logger[_0x1e27('0x11')]('ShowSmsQueue',_0xd8ab1e);logger[_0x1e27('0x24')](_0x1e27('0x26'),_0xd8ab1e,JSON[_0x1e27('0x25')](_0x66e701));_0x6fb339(_0x66e701);})[_0x1e27('0x19')](function(_0x27e9d1){logger[_0x1e27('0x14')](_0x1e27('0x26'),_0x27e9d1[_0x1e27('0x16')],_0xd8ab1e);_0x18d5bc(_0x2e4f29[_0x1e27('0x14')](0x1f4,_0x27e9d1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e08cd0a..f468ab5 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 _0x3d5f=['save','remove','update','emit','removeListener','register','length','smsQueue:'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x3d5f,0x120));var _0xf3d5=function(_0x6bec84,_0x1decb6){_0x6bec84=_0x6bec84-0x0;var _0x49957c=_0x3d5f[_0x6bec84];return _0x49957c;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xf3d5('0x0'),_0xf3d5('0x1'),_0xf3d5('0x2')];function createListener(_0x23506b,_0x45f1bd){return function(_0x1d0fa7){_0x45f1bd[_0xf3d5('0x3')](_0x23506b,_0x1d0fa7);};}function removeListener(_0x33e6d7,_0x44c253){return function(){SmsQueueEvents[_0xf3d5('0x4')](_0x33e6d7,_0x44c253);};}exports[_0xf3d5('0x5')]=function(_0x8e219f){for(var _0x435173=0x0,_0x194255=events[_0xf3d5('0x6')];_0x435173<_0x194255;_0x435173++){var _0x4aa268=events[_0x435173];var _0x5ed4e7=createListener(_0xf3d5('0x7')+_0x4aa268,_0x8e219f);SmsQueueEvents['on'](_0x4aa268,_0x5ed4e7);}}; \ No newline at end of file +var _0x347f=['remove','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x341eca,_0x3b58aa){var _0x18c18a=function(_0x148874){while(--_0x148874){_0x341eca['push'](_0x341eca['shift']());}};_0x18c18a(++_0x3b58aa);}(_0x347f,0x1ba));var _0xf347=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x347f[_0x3947c9];return _0x2e7871;};'use strict';var SmsQueueEvents=require(_0xf347('0x0'));var events=[_0xf347('0x1'),_0xf347('0x2'),'update'];function createListener(_0x2fc58f,_0x580569){return function(_0x155acd){_0x580569['emit'](_0x2fc58f,_0x155acd);};}function removeListener(_0x571e4a,_0x26bc04){return function(){SmsQueueEvents['removeListener'](_0x571e4a,_0x26bc04);};}exports[_0xf347('0x3')]=function(_0x3fc475){for(var _0x55c907=0x0,_0x34467a=events[_0xf347('0x4')];_0x55c907<_0x34467a;_0x55c907++){var _0x6b37f0=events[_0x55c907];var _0x463388=createListener(_0xf347('0x5')+_0x6b37f0,_0x3fc475);SmsQueueEvents['on'](_0x6b37f0,_0x463388);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2140143..6aa902b 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 _0x83ed=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','put','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4b42ce,_0x349b42){var _0x309829=function(_0x30a279){while(--_0x30a279){_0x4b42ce['push'](_0x4b42ce['shift']());}};_0x309829(++_0x349b42);}(_0x83ed,0x66));var _0xd83e=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x83ed[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require(_0xd83e('0x0'));var util=require('util');var path=require(_0xd83e('0x1'));var timeout=require(_0xd83e('0x2'));var express=require(_0xd83e('0x3'));var router=express['Router']();var fs_extra=require(_0xd83e('0x4'));var auth=require(_0xd83e('0x5'));var interaction=require(_0xd83e('0x6'));var config=require(_0xd83e('0x7'));var controller=require(_0xd83e('0x8'));router[_0xd83e('0x9')]('/',auth[_0xd83e('0xa')](),controller[_0xd83e('0xb')]);router[_0xd83e('0x9')]('/describe',auth[_0xd83e('0xa')](),controller[_0xd83e('0xc')]);router['get'](_0xd83e('0xd'),auth[_0xd83e('0xa')](),controller[_0xd83e('0xe')]);router['post']('/',auth[_0xd83e('0xa')](),controller['create']);router[_0xd83e('0xf')]('/:id',auth[_0xd83e('0xa')](),controller[_0xd83e('0x10')]);router['delete'](_0xd83e('0xd'),auth[_0xd83e('0xa')](),controller[_0xd83e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x78e0=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x4fbd39,_0x3a1f2b){var _0x2a6fe9=function(_0x2c182e){while(--_0x2c182e){_0x4fbd39['push'](_0x4fbd39['shift']());}};_0x2a6fe9(++_0x3a1f2b);}(_0x78e0,0x13e));var _0x078e=function(_0x5252a1,_0x32b917){_0x5252a1=_0x5252a1-0x0;var _0x39973f=_0x78e0[_0x5252a1];return _0x39973f;};'use strict';var multer=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var path=require(_0x078e('0x2'));var timeout=require(_0x078e('0x3'));var express=require(_0x078e('0x4'));var router=express[_0x078e('0x5')]();var fs_extra=require(_0x078e('0x6'));var auth=require(_0x078e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x078e('0x8'));router[_0x078e('0x9')]('/',auth[_0x078e('0xa')](),controller[_0x078e('0xb')]);router[_0x078e('0x9')]('/describe',auth[_0x078e('0xa')](),controller[_0x078e('0xc')]);router[_0x078e('0x9')](_0x078e('0xd'),auth[_0x078e('0xa')](),controller[_0x078e('0xe')]);router[_0x078e('0xf')]('/',auth['isAuthenticated'](),controller[_0x078e('0x10')]);router[_0x078e('0x11')](_0x078e('0xd'),auth[_0x078e('0xa')](),controller[_0x078e('0x12')]);router[_0x078e('0x13')](_0x078e('0xd'),auth[_0x078e('0xa')](),controller[_0x078e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 622184a..7ea2c07 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 _0xb916=['sequelize','exports','STRING','DATE','moment'];(function(_0x3a018,_0x50aac6){var _0x22ae0a=function(_0x5dd70e){while(--_0x5dd70e){_0x3a018['push'](_0x3a018['shift']());}};_0x22ae0a(++_0x50aac6);}(_0xb916,0x126));var _0x6b91=function(_0x23b7e4,_0x1c9417){_0x23b7e4=_0x23b7e4-0x0;var _0x40d91b=_0xb916[_0x23b7e4];return _0x40d91b;};'use strict';var moment=require(_0x6b91('0x0'));var Sequelize=require(_0x6b91('0x1'));module[_0x6b91('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6b91('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6b91('0x4')]},'acceptAt':{'type':Sequelize[_0x6b91('0x4')]},'exitAt':{'type':Sequelize[_0x6b91('0x4')]},'reason':{'type':Sequelize[_0x6b91('0x3')]}}; \ No newline at end of file +var _0x1ca1=['STRING','DATE','moment','sequelize'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x1ca1,0x15a));var _0x11ca=function(_0x4653c7,_0x38862d){_0x4653c7=_0x4653c7-0x0;var _0x2bbaed=_0x1ca1[_0x4653c7];return _0x2bbaed;};'use strict';var moment=require(_0x11ca('0x0'));var Sequelize=require(_0x11ca('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x11ca('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x11ca('0x2')]},'joinAt':{'type':Sequelize[_0x11ca('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x11ca('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 92f42c6..28aff41 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 _0x7bc3=['nolimit','order','sort','where','filter','options','includeAll','include','findAll','rows','show','params','keys','merge','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xbf5636,_0x1bbc76){var _0x5e0def=function(_0xa89a03){while(--_0xa89a03){_0xbf5636['push'](_0xbf5636['shift']());}};_0x5e0def(++_0x1bbc76);}(_0x7bc3,0x143));var _0x37bc=function(_0x3f45bb,_0x50de24){_0x3f45bb=_0x3f45bb-0x0;var _0x35b8a3=_0x7bc3[_0x3f45bb];return _0x35b8a3;};'use strict';var emlformat=require(_0x37bc('0x0'));var rimraf=require(_0x37bc('0x1'));var zipdir=require(_0x37bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37bc('0x3'));var moment=require(_0x37bc('0x4'));var BPromise=require(_0x37bc('0x5'));var Mustache=require('mustache');var util=require(_0x37bc('0x6'));var path=require(_0x37bc('0x7'));var sox=require(_0x37bc('0x8'));var csv=require(_0x37bc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37bc('0xa'));var _=require(_0x37bc('0xb'));var squel=require(_0x37bc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x37bc('0x9'));var querystring=require(_0x37bc('0xd'));var Papa=require(_0x37bc('0xe'));var Redis=require(_0x37bc('0xf'));var authService=require(_0x37bc('0x10'));var qs=require(_0x37bc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37bc('0x12'));var logger=require(_0x37bc('0x13'))(_0x37bc('0x14'));var utils=require(_0x37bc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x37bc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1505c9,_0x48926f){_0x48926f=_0x48926f||0xcc;return function(_0x1feedc){if(_0x1feedc){return _0x1505c9['sendStatus'](_0x48926f);}return _0x1505c9['status'](_0x48926f)[_0x37bc('0x17')]();};}function respondWithResult(_0x1041f4,_0xebcfad){_0xebcfad=_0xebcfad||0xc8;return function(_0x232d33){if(_0x232d33){return _0x1041f4[_0x37bc('0x18')](_0xebcfad)['json'](_0x232d33);}};}function respondWithFilteredResult(_0x1e6efa,_0x42c321){return function(_0x54e41a){if(_0x54e41a){var _0x5d5d50=typeof _0x42c321[_0x37bc('0x19')]===_0x37bc('0x1a')&&typeof _0x42c321[_0x37bc('0x1b')]===_0x37bc('0x1a');var _0x4bd923=_0x54e41a['count'];var _0x3d7c33=_0x5d5d50?0x0:_0x42c321['offset'];var _0x46fe41=_0x5d5d50?_0x54e41a[_0x37bc('0x1c')]:_0x42c321[_0x37bc('0x19')]+_0x42c321['limit'];var _0x35e2d8;if(_0x46fe41>=_0x4bd923){_0x46fe41=_0x4bd923;_0x35e2d8=0xc8;}else{_0x35e2d8=0xce;}_0x1e6efa[_0x37bc('0x18')](_0x35e2d8);return _0x1e6efa[_0x37bc('0x1d')](_0x37bc('0x1e'),_0x3d7c33+'-'+_0x46fe41+'/'+_0x4bd923)[_0x37bc('0x1f')](_0x54e41a);}return null;};}function patchUpdates(_0x566f9c){return function(_0x17e8fa){try{jsonpatch[_0x37bc('0x20')](_0x17e8fa,_0x566f9c,!![]);}catch(_0x5e271d){return BPromise[_0x37bc('0x21')](_0x5e271d);}return _0x17e8fa[_0x37bc('0x22')]();};}function saveUpdates(_0x1c0855,_0x481ed9){return function(_0x25dac8){if(_0x25dac8){return _0x25dac8[_0x37bc('0x23')](_0x1c0855)[_0x37bc('0x24')](function(_0x5a1f59){return _0x5a1f59;});}return null;};}function removeEntity(_0x5acd08,_0x3c1fea){return function(_0x2e9da3){if(_0x2e9da3){return _0x2e9da3[_0x37bc('0x25')]()[_0x37bc('0x24')](function(){_0x5acd08[_0x37bc('0x18')](0xcc)[_0x37bc('0x17')]();});}};}function handleEntityNotFound(_0x229640,_0x4b5b03){return function(_0x3e32f7){if(!_0x3e32f7){_0x229640[_0x37bc('0x26')](0x194);}return _0x3e32f7;};}function handleError(_0x25de9c,_0x3b2543){_0x3b2543=_0x3b2543||0x1f4;return function(_0x1fa6c7){logger['error'](_0x1fa6c7[_0x37bc('0x27')]);if(_0x1fa6c7['name']){delete _0x1fa6c7[_0x37bc('0x28')];}_0x25de9c[_0x37bc('0x18')](_0x3b2543)[_0x37bc('0x29')](_0x1fa6c7);};}exports[_0x37bc('0x2a')]=function(_0xe3b9e9,_0x489412){var _0x2560c3={},_0xbcd32d={},_0x366538={'count':0x0,'rows':[]};var _0x233dd7=_[_0x37bc('0x2b')](db[_0x37bc('0x2c')][_0x37bc('0x2d')],function(_0x189c97){return{'name':_0x189c97[_0x37bc('0x2e')],'type':_0x189c97[_0x37bc('0x2f')][_0x37bc('0x30')]};});_0xbcd32d[_0x37bc('0x31')]=_[_0x37bc('0x2b')](_0x233dd7,'name');_0xbcd32d[_0x37bc('0x32')]=_['keys'](_0xe3b9e9[_0x37bc('0x32')]);_0xbcd32d[_0x37bc('0x33')]=_[_0x37bc('0x34')](_0xbcd32d['model'],_0xbcd32d[_0x37bc('0x32')]);_0x2560c3[_0x37bc('0x35')]=_[_0x37bc('0x34')](_0xbcd32d[_0x37bc('0x31')],qs['fields'](_0xe3b9e9[_0x37bc('0x32')][_0x37bc('0x36')]));_0x2560c3[_0x37bc('0x35')]=_0x2560c3['attributes'][_0x37bc('0x37')]?_0x2560c3['attributes']:_0xbcd32d[_0x37bc('0x31')];if(!_0xe3b9e9['query'][_0x37bc('0x38')](_0x37bc('0x39'))){_0x2560c3['limit']=qs[_0x37bc('0x1b')](_0xe3b9e9[_0x37bc('0x32')][_0x37bc('0x1b')]);_0x2560c3[_0x37bc('0x19')]=qs[_0x37bc('0x19')](_0xe3b9e9[_0x37bc('0x32')]['offset']);}_0x2560c3[_0x37bc('0x3a')]=qs[_0x37bc('0x3b')](_0xe3b9e9[_0x37bc('0x32')][_0x37bc('0x3b')]);_0x2560c3[_0x37bc('0x3c')]=qs['filters'](_['pick'](_0xe3b9e9[_0x37bc('0x32')],_0xbcd32d['filters']),_0x233dd7);if(_0xe3b9e9[_0x37bc('0x32')]['filter']){_0x2560c3[_0x37bc('0x3c')]=_['merge'](_0x2560c3['where'],{'$or':_[_0x37bc('0x2b')](_0x233dd7,function(_0x141ef8){if(_0x141ef8['type']!=='VIRTUAL'){var _0x238b94={};_0x238b94[_0x141ef8[_0x37bc('0x28')]]={'$like':'%'+_0xe3b9e9[_0x37bc('0x32')][_0x37bc('0x3d')]+'%'};return _0x238b94;}})});}_0x2560c3=_['merge']({},_0x2560c3,_0xe3b9e9[_0x37bc('0x3e')]);var _0x14fe04={'where':_0x2560c3[_0x37bc('0x3c')]};return db[_0x37bc('0x2c')][_0x37bc('0x1c')](_0x14fe04)[_0x37bc('0x24')](function(_0x28a4d9){_0x366538['count']=_0x28a4d9;if(_0xe3b9e9[_0x37bc('0x32')][_0x37bc('0x3f')]){_0x2560c3[_0x37bc('0x40')]=[{'all':!![]}];}return db[_0x37bc('0x2c')][_0x37bc('0x41')](_0x2560c3);})[_0x37bc('0x24')](function(_0x12f0a4){_0x366538[_0x37bc('0x42')]=_0x12f0a4;return _0x366538;})['then'](respondWithFilteredResult(_0x489412,_0x2560c3))['catch'](handleError(_0x489412,null));};exports[_0x37bc('0x43')]=function(_0x46448a,_0x4bf18c){var _0x229621={'raw':!![],'where':{'id':_0x46448a[_0x37bc('0x44')]['id']}},_0xcbfc8a={};_0xcbfc8a[_0x37bc('0x31')]=_[_0x37bc('0x45')](db['SmsQueueReport']['rawAttributes']);_0xcbfc8a['query']=_[_0x37bc('0x45')](_0x46448a['query']);_0xcbfc8a[_0x37bc('0x33')]=_[_0x37bc('0x34')](_0xcbfc8a['model'],_0xcbfc8a['query']);_0x229621[_0x37bc('0x35')]=_['intersection'](_0xcbfc8a[_0x37bc('0x31')],qs['fields'](_0x46448a[_0x37bc('0x32')][_0x37bc('0x36')]));_0x229621[_0x37bc('0x35')]=_0x229621['attributes']['length']?_0x229621['attributes']:_0xcbfc8a[_0x37bc('0x31')];if(_0x46448a[_0x37bc('0x32')][_0x37bc('0x3f')]){_0x229621['include']=[{'all':!![]}];}_0x229621=_[_0x37bc('0x46')]({},_0x229621,_0x46448a[_0x37bc('0x3e')]);return db[_0x37bc('0x2c')][_0x37bc('0x47')](_0x229621)[_0x37bc('0x24')](handleEntityNotFound(_0x4bf18c,null))[_0x37bc('0x24')](respondWithResult(_0x4bf18c,null))[_0x37bc('0x48')](handleError(_0x4bf18c,null));};exports[_0x37bc('0x49')]=function(_0x29e4e1,_0x5c4c3c){return db['SmsQueueReport'][_0x37bc('0x49')](_0x29e4e1['body'],{})[_0x37bc('0x24')](respondWithResult(_0x5c4c3c,0xc9))[_0x37bc('0x48')](handleError(_0x5c4c3c,null));};exports['update']=function(_0x38b901,_0xa83faf){if(_0x38b901['body']['id']){delete _0x38b901['body']['id'];}return db[_0x37bc('0x2c')]['find']({'where':{'id':_0x38b901[_0x37bc('0x44')]['id']}})[_0x37bc('0x24')](handleEntityNotFound(_0xa83faf,null))[_0x37bc('0x24')](saveUpdates(_0x38b901[_0x37bc('0x4a')],null))[_0x37bc('0x24')](respondWithResult(_0xa83faf,null))[_0x37bc('0x48')](handleError(_0xa83faf,null));};exports[_0x37bc('0x25')]=function(_0x260d0c,_0x56f465){return db[_0x37bc('0x2c')][_0x37bc('0x47')]({'where':{'id':_0x260d0c[_0x37bc('0x44')]['id']}})['then'](handleEntityNotFound(_0x56f465,null))['then'](removeEntity(_0x56f465,null))['catch'](handleError(_0x56f465,null));};exports[_0x37bc('0x4b')]=function(_0x437e19,_0x19c789){return db[_0x37bc('0x2c')][_0x37bc('0x4b')]()[_0x37bc('0x24')](respondWithResult(_0x19c789,null))[_0x37bc('0x48')](handleError(_0x19c789,null));}; \ No newline at end of file +var _0x2365=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','keys','options','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs'];(function(_0x47dbb8,_0x1dc4bb){var _0x360258=function(_0x2ea2c5){while(--_0x2ea2c5){_0x47dbb8['push'](_0x47dbb8['shift']());}};_0x360258(++_0x1dc4bb);}(_0x2365,0x127));var _0x5236=function(_0xd713c7,_0x159277){_0xd713c7=_0xd713c7-0x0;var _0x801cad=_0x2365[_0xd713c7];return _0x801cad;};'use strict';var emlformat=require(_0x5236('0x0'));var rimraf=require(_0x5236('0x1'));var zipdir=require(_0x5236('0x2'));var jsonpatch=require(_0x5236('0x3'));var rp=require('request-promise');var moment=require(_0x5236('0x4'));var BPromise=require(_0x5236('0x5'));var Mustache=require('mustache');var util=require(_0x5236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5236('0x7'));var ejs=require(_0x5236('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5236('0x9'));var squel=require(_0x5236('0xa'));var crypto=require(_0x5236('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5236('0xc'));var toCsv=require(_0x5236('0x7'));var querystring=require(_0x5236('0xd'));var Papa=require(_0x5236('0xe'));var Redis=require(_0x5236('0xf'));var authService=require(_0x5236('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5236('0x11'));var hardwareService=require(_0x5236('0x12'));var logger=require(_0x5236('0x13'))(_0x5236('0x14'));var utils=require(_0x5236('0x15'));var config=require(_0x5236('0x16'));var licenseUtil=require(_0x5236('0x17'));var db=require(_0x5236('0x18'))['db'];function respondWithStatusCode(_0x257c8e,_0x18ae05){_0x18ae05=_0x18ae05||0xcc;return function(_0x50b455){if(_0x50b455){return _0x257c8e['sendStatus'](_0x18ae05);}return _0x257c8e[_0x5236('0x19')](_0x18ae05)[_0x5236('0x1a')]();};}function respondWithResult(_0x180edf,_0x4d090f){_0x4d090f=_0x4d090f||0xc8;return function(_0x4255f0){if(_0x4255f0){return _0x180edf[_0x5236('0x19')](_0x4d090f)[_0x5236('0x1b')](_0x4255f0);}};}function respondWithFilteredResult(_0x4cff8f,_0xcbad2e){return function(_0x9abaa4){if(_0x9abaa4){var _0xa8b0d3=typeof _0xcbad2e[_0x5236('0x1c')]==='undefined'&&typeof _0xcbad2e[_0x5236('0x1d')]===_0x5236('0x1e');var _0x34288c=_0x9abaa4[_0x5236('0x1f')];var _0x313ae6=_0xa8b0d3?0x0:_0xcbad2e[_0x5236('0x1c')];var _0x4ed1b9=_0xa8b0d3?_0x9abaa4[_0x5236('0x1f')]:_0xcbad2e[_0x5236('0x1c')]+_0xcbad2e[_0x5236('0x1d')];var _0x500f7c;if(_0x4ed1b9>=_0x34288c){_0x4ed1b9=_0x34288c;_0x500f7c=0xc8;}else{_0x500f7c=0xce;}_0x4cff8f[_0x5236('0x19')](_0x500f7c);return _0x4cff8f[_0x5236('0x20')](_0x5236('0x21'),_0x313ae6+'-'+_0x4ed1b9+'/'+_0x34288c)[_0x5236('0x1b')](_0x9abaa4);}return null;};}function patchUpdates(_0x40ebf1){return function(_0x4d7aa9){try{jsonpatch[_0x5236('0x22')](_0x4d7aa9,_0x40ebf1,!![]);}catch(_0x43f7c3){return BPromise[_0x5236('0x23')](_0x43f7c3);}return _0x4d7aa9[_0x5236('0x24')]();};}function saveUpdates(_0x2c2b9d,_0x51de89){return function(_0x250197){if(_0x250197){return _0x250197[_0x5236('0x25')](_0x2c2b9d)[_0x5236('0x26')](function(_0xa56e7){return _0xa56e7;});}return null;};}function removeEntity(_0x3d8bdc,_0xfe7854){return function(_0x1cc524){if(_0x1cc524){return _0x1cc524['destroy']()[_0x5236('0x26')](function(){_0x3d8bdc[_0x5236('0x19')](0xcc)[_0x5236('0x1a')]();});}};}function handleEntityNotFound(_0x14fbad,_0x6b5d32){return function(_0x5317d4){if(!_0x5317d4){_0x14fbad['sendStatus'](0x194);}return _0x5317d4;};}function handleError(_0x241d03,_0x5dfeb4){_0x5dfeb4=_0x5dfeb4||0x1f4;return function(_0x3820c0){logger[_0x5236('0x27')](_0x3820c0[_0x5236('0x28')]);if(_0x3820c0[_0x5236('0x29')]){delete _0x3820c0[_0x5236('0x29')];}_0x241d03[_0x5236('0x19')](_0x5dfeb4)['send'](_0x3820c0);};}exports[_0x5236('0x2a')]=function(_0x2363be,_0x355d7b){var _0x152d3e={},_0x1b59e3={},_0x27fe94={'count':0x0,'rows':[]};var _0x3b8696=_[_0x5236('0x2b')](db[_0x5236('0x2c')][_0x5236('0x2d')],function(_0xce13d7){return{'name':_0xce13d7[_0x5236('0x2e')],'type':_0xce13d7[_0x5236('0x2f')][_0x5236('0x30')]};});_0x1b59e3[_0x5236('0x31')]=_[_0x5236('0x2b')](_0x3b8696,_0x5236('0x29'));_0x1b59e3[_0x5236('0x32')]=_['keys'](_0x2363be[_0x5236('0x32')]);_0x1b59e3[_0x5236('0x33')]=_['intersection'](_0x1b59e3['model'],_0x1b59e3[_0x5236('0x32')]);_0x152d3e[_0x5236('0x34')]=_[_0x5236('0x35')](_0x1b59e3[_0x5236('0x31')],qs['fields'](_0x2363be['query'][_0x5236('0x36')]));_0x152d3e['attributes']=_0x152d3e[_0x5236('0x34')]['length']?_0x152d3e['attributes']:_0x1b59e3[_0x5236('0x31')];if(!_0x2363be['query'][_0x5236('0x37')](_0x5236('0x38'))){_0x152d3e['limit']=qs[_0x5236('0x1d')](_0x2363be[_0x5236('0x32')]['limit']);_0x152d3e['offset']=qs[_0x5236('0x1c')](_0x2363be[_0x5236('0x32')][_0x5236('0x1c')]);}_0x152d3e['order']=qs[_0x5236('0x39')](_0x2363be['query'][_0x5236('0x39')]);_0x152d3e[_0x5236('0x3a')]=qs[_0x5236('0x33')](_[_0x5236('0x3b')](_0x2363be['query'],_0x1b59e3[_0x5236('0x33')]),_0x3b8696);if(_0x2363be['query']['filter']){_0x152d3e['where']=_[_0x5236('0x3c')](_0x152d3e[_0x5236('0x3a')],{'$or':_[_0x5236('0x2b')](_0x3b8696,function(_0x333c71){if(_0x333c71['type']!==_0x5236('0x3d')){var _0x4e0b90={};_0x4e0b90[_0x333c71[_0x5236('0x29')]]={'$like':'%'+_0x2363be[_0x5236('0x32')][_0x5236('0x3e')]+'%'};return _0x4e0b90;}})});}_0x152d3e=_[_0x5236('0x3c')]({},_0x152d3e,_0x2363be['options']);var _0x5aa872={'where':_0x152d3e[_0x5236('0x3a')]};return db[_0x5236('0x2c')][_0x5236('0x1f')](_0x5aa872)[_0x5236('0x26')](function(_0x479600){_0x27fe94[_0x5236('0x1f')]=_0x479600;if(_0x2363be['query'][_0x5236('0x3f')]){_0x152d3e[_0x5236('0x40')]=[{'all':!![]}];}return db[_0x5236('0x2c')][_0x5236('0x41')](_0x152d3e);})[_0x5236('0x26')](function(_0x5cd245){_0x27fe94['rows']=_0x5cd245;return _0x27fe94;})[_0x5236('0x26')](respondWithFilteredResult(_0x355d7b,_0x152d3e))['catch'](handleError(_0x355d7b,null));};exports[_0x5236('0x42')]=function(_0x35a516,_0x5418b0){var _0x508427={'raw':!![],'where':{'id':_0x35a516[_0x5236('0x43')]['id']}},_0x285378={};_0x285378[_0x5236('0x31')]=_['keys'](db[_0x5236('0x2c')]['rawAttributes']);_0x285378[_0x5236('0x32')]=_[_0x5236('0x44')](_0x35a516['query']);_0x285378['filters']=_[_0x5236('0x35')](_0x285378[_0x5236('0x31')],_0x285378[_0x5236('0x32')]);_0x508427[_0x5236('0x34')]=_[_0x5236('0x35')](_0x285378['model'],qs[_0x5236('0x36')](_0x35a516['query'][_0x5236('0x36')]));_0x508427[_0x5236('0x34')]=_0x508427[_0x5236('0x34')]['length']?_0x508427[_0x5236('0x34')]:_0x285378[_0x5236('0x31')];if(_0x35a516[_0x5236('0x32')][_0x5236('0x3f')]){_0x508427[_0x5236('0x40')]=[{'all':!![]}];}_0x508427=_[_0x5236('0x3c')]({},_0x508427,_0x35a516[_0x5236('0x45')]);return db[_0x5236('0x2c')][_0x5236('0x46')](_0x508427)[_0x5236('0x26')](handleEntityNotFound(_0x5418b0,null))[_0x5236('0x26')](respondWithResult(_0x5418b0,null))[_0x5236('0x47')](handleError(_0x5418b0,null));};exports[_0x5236('0x48')]=function(_0x59516b,_0x308a50){return db[_0x5236('0x2c')][_0x5236('0x48')](_0x59516b['body'],{})[_0x5236('0x26')](respondWithResult(_0x308a50,0xc9))[_0x5236('0x47')](handleError(_0x308a50,null));};exports[_0x5236('0x25')]=function(_0x3b025b,_0x6d2f44){if(_0x3b025b[_0x5236('0x49')]['id']){delete _0x3b025b[_0x5236('0x49')]['id'];}return db[_0x5236('0x2c')][_0x5236('0x46')]({'where':{'id':_0x3b025b[_0x5236('0x43')]['id']}})['then'](handleEntityNotFound(_0x6d2f44,null))[_0x5236('0x26')](saveUpdates(_0x3b025b['body'],null))['then'](respondWithResult(_0x6d2f44,null))[_0x5236('0x47')](handleError(_0x6d2f44,null));};exports[_0x5236('0x4a')]=function(_0x5430ca,_0x139d39){return db[_0x5236('0x2c')][_0x5236('0x46')]({'where':{'id':_0x5430ca[_0x5236('0x43')]['id']}})[_0x5236('0x26')](handleEntityNotFound(_0x139d39,null))[_0x5236('0x26')](removeEntity(_0x139d39,null))[_0x5236('0x47')](handleError(_0x139d39,null));};exports[_0x5236('0x4b')]=function(_0x795b50,_0x32b0fb){return db[_0x5236('0x2c')][_0x5236('0x4b')]()[_0x5236('0x26')](respondWithResult(_0x32b0fb,null))[_0x5236('0x47')](handleError(_0x32b0fb,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1ef441a..59ec7f5 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 9a94656..383f02a 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 _0xa28e=['info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsQueueReport','create','options','raw','catch','UpdateSmsQueueReport','SmsQueueReport','body','where','attributes','limit','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x4ca187,_0x15500b){var _0x4134e0=function(_0x2c553a){while(--_0x2c553a){_0x4ca187['push'](_0x4ca187['shift']());}};_0x4134e0(++_0x15500b);}(_0xa28e,0x17c));var _0xea28=function(_0x4b92c3,_0x23be84){_0x4b92c3=_0x4b92c3-0x0;var _0x57d180=_0xa28e[_0x4b92c3];return _0x57d180;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea28('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea28('0x1'));var db=require(_0xea28('0x2'))['db'];var utils=require(_0xea28('0x3'));var logger=require(_0xea28('0x4'))(_0xea28('0x5'));var config=require('../../config/environment');var jayson=require(_0xea28('0x6'));var client=jayson['client'][_0xea28('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1be05d,_0x2c79dd,_0x49e652){return new BPromise(function(_0x2f037c,_0x319669){return client[_0xea28('0x8')](_0x1be05d,_0x49e652)[_0xea28('0x9')](function(_0x509cd2){logger[_0xea28('0xa')](_0xea28('0xb'),_0x2c79dd,_0xea28('0xc'));logger[_0xea28('0xd')](_0xea28('0xe'),_0x2c79dd,'request\x20sent',JSON[_0xea28('0xf')](_0x509cd2));if(_0x509cd2[_0xea28('0x10')]){if(_0x509cd2[_0xea28('0x10')][_0xea28('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x2c79dd,_0x509cd2[_0xea28('0x10')]['message']);return _0x319669(_0x509cd2['error'][_0xea28('0x12')]);}logger[_0xea28('0x10')](_0xea28('0xb'),_0x2c79dd,_0x509cd2[_0xea28('0x10')]['message']);return _0x2f037c(_0x509cd2['error'][_0xea28('0x12')]);}else{logger[_0xea28('0xa')](_0xea28('0xb'),_0x2c79dd,_0xea28('0xc'));_0x2f037c(_0x509cd2['result'][_0xea28('0x12')]);}})['catch'](function(_0x452402){logger[_0xea28('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x2c79dd,_0x452402);_0x319669(_0x452402);});});}exports[_0xea28('0x13')]=function(_0x1e32bc){var _0x20804e=this;return new Promise(function(_0x555504,_0x2e2b1a){return db['SmsQueueReport'][_0xea28('0x14')](_0x1e32bc['body'],{'raw':_0x1e32bc['options']?_0x1e32bc[_0xea28('0x15')][_0xea28('0x16')]===undefined?!![]:![]:!![]})[_0xea28('0x9')](function(_0x5e1e52){logger[_0xea28('0xa')](_0xea28('0x13'),_0x1e32bc);logger[_0xea28('0xd')](_0xea28('0x13'),_0x1e32bc,JSON['stringify'](_0x5e1e52));_0x555504(_0x5e1e52);})[_0xea28('0x17')](function(_0x3a7bb5){logger['error'](_0xea28('0x13'),_0x3a7bb5[_0xea28('0x12')],_0x1e32bc);_0x2e2b1a(_0x20804e[_0xea28('0x10')](0x1f4,_0x3a7bb5[_0xea28('0x12')]));});});};exports[_0xea28('0x18')]=function(_0x771dca){var _0x10d1e7=this;return new Promise(function(_0x2f7a79,_0x5aba89){return db[_0xea28('0x19')]['update'](_0x771dca[_0xea28('0x1a')],{'raw':_0x771dca['options']?_0x771dca[_0xea28('0x15')][_0xea28('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x771dca['options']?_0x771dca['options'][_0xea28('0x1b')]||null:null,'attributes':_0x771dca['options']?_0x771dca[_0xea28('0x15')][_0xea28('0x1c')]||null:null,'limit':_0x771dca[_0xea28('0x15')]?_0x771dca[_0xea28('0x15')][_0xea28('0x1d')]||null:null})[_0xea28('0x9')](function(_0x344240){logger['info'](_0xea28('0x18'),_0x771dca);logger[_0xea28('0xd')]('UpdateSmsQueueReport',_0x771dca,JSON[_0xea28('0xf')](_0x344240));_0x2f7a79(_0x344240);})[_0xea28('0x17')](function(_0x565b33){logger[_0xea28('0x10')]('UpdateSmsQueueReport',_0x565b33[_0xea28('0x12')],_0x771dca);_0x5aba89(_0x10d1e7[_0xea28('0x10')](0x1f4,_0x565b33[_0xea28('0x12')]));});});}; \ No newline at end of file +var _0x85b9=['request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3daa57,_0x44e38d){var _0x158686=function(_0x249754){while(--_0x249754){_0x3daa57['push'](_0x3daa57['shift']());}};_0x158686(++_0x44e38d);}(_0x85b9,0x15d));var _0x985b=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x85b9[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x985b('0x0'));var util=require(_0x985b('0x1'));var moment=require(_0x985b('0x2'));var BPromise=require(_0x985b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x985b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x985b('0x5'))(_0x985b('0x6'));var config=require('../../config/environment');var jayson=require(_0x985b('0x7'));var client=jayson['client'][_0x985b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55f21b,_0x3299f3,_0x30bbde){return new BPromise(function(_0x170090,_0x575b76){return client[_0x985b('0x9')](_0x55f21b,_0x30bbde)['then'](function(_0x2fd0bf){logger[_0x985b('0xa')](_0x985b('0xb'),_0x3299f3,'request\x20sent');logger[_0x985b('0xc')](_0x985b('0xd'),_0x3299f3,_0x985b('0xe'),JSON[_0x985b('0xf')](_0x2fd0bf));if(_0x2fd0bf[_0x985b('0x10')]){if(_0x2fd0bf[_0x985b('0x10')][_0x985b('0x11')]===0x1f4){logger[_0x985b('0x10')](_0x985b('0xb'),_0x3299f3,_0x2fd0bf['error'][_0x985b('0x12')]);return _0x575b76(_0x2fd0bf[_0x985b('0x10')][_0x985b('0x12')]);}logger['error'](_0x985b('0xb'),_0x3299f3,_0x2fd0bf['error'][_0x985b('0x12')]);return _0x170090(_0x2fd0bf[_0x985b('0x10')][_0x985b('0x12')]);}else{logger[_0x985b('0xa')]('SmsQueueReport,\x20%s,\x20%s',_0x3299f3,_0x985b('0xe'));_0x170090(_0x2fd0bf[_0x985b('0x13')][_0x985b('0x12')]);}})[_0x985b('0x14')](function(_0x4b68b6){logger[_0x985b('0x10')](_0x985b('0xb'),_0x3299f3,_0x4b68b6);_0x575b76(_0x4b68b6);});});}exports[_0x985b('0x15')]=function(_0x4b63eb){var _0x16ee77=this;return new Promise(function(_0x4533a4,_0x4c1b11){return db[_0x985b('0x16')][_0x985b('0x17')](_0x4b63eb[_0x985b('0x18')],{'raw':_0x4b63eb[_0x985b('0x19')]?_0x4b63eb[_0x985b('0x19')][_0x985b('0x1a')]===undefined?!![]:![]:!![]})[_0x985b('0x1b')](function(_0x2ff30a){logger[_0x985b('0xa')](_0x985b('0x15'),_0x4b63eb);logger[_0x985b('0xc')](_0x985b('0x15'),_0x4b63eb,JSON[_0x985b('0xf')](_0x2ff30a));_0x4533a4(_0x2ff30a);})[_0x985b('0x14')](function(_0x1a31bf){logger[_0x985b('0x10')](_0x985b('0x15'),_0x1a31bf[_0x985b('0x12')],_0x4b63eb);_0x4c1b11(_0x16ee77[_0x985b('0x10')](0x1f4,_0x1a31bf[_0x985b('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x4ef401){var _0x38c16e=this;return new Promise(function(_0x250a50,_0x17ed0f){return db[_0x985b('0x16')][_0x985b('0x1c')](_0x4ef401['body'],{'raw':_0x4ef401[_0x985b('0x19')]?_0x4ef401['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ef401[_0x985b('0x19')]?_0x4ef401['options'][_0x985b('0x1d')]||null:null,'attributes':_0x4ef401[_0x985b('0x19')]?_0x4ef401[_0x985b('0x19')][_0x985b('0x1e')]||null:null,'limit':_0x4ef401[_0x985b('0x19')]?_0x4ef401[_0x985b('0x19')][_0x985b('0x1f')]||null:null})['then'](function(_0x14490c){logger['info']('UpdateSmsQueueReport',_0x4ef401);logger[_0x985b('0xc')](_0x985b('0x20'),_0x4ef401,JSON[_0x985b('0xf')](_0x14490c));_0x250a50(_0x14490c);})[_0x985b('0x14')](function(_0x1918ec){logger[_0x985b('0x10')](_0x985b('0x20'),_0x1918ec['message'],_0x4ef401);_0x17ed0f(_0x38c16e['error'](0x1f4,_0x1918ec[_0x985b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index b52d1f2..abaf424 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 _0x24ca=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x24ca[_0x3438cf];return _0x278698;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['show']);router[_0xa24c('0xe')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);module[_0xa24c('0x14')]=router; \ No newline at end of file +var _0x5577=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5577,0x1b4));var _0x7557=function(_0x13eed5,_0x106414){_0x13eed5=_0x13eed5-0x0;var _0x3d6cab=_0x5577[_0x13eed5];return _0x3d6cab;};'use strict';var multer=require(_0x7557('0x0'));var util=require('util');var path=require(_0x7557('0x1'));var timeout=require(_0x7557('0x2'));var express=require('express');var router=express[_0x7557('0x3')]();var fs_extra=require(_0x7557('0x4'));var auth=require(_0x7557('0x5'));var interaction=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var controller=require(_0x7557('0x8'));router['get']('/',auth[_0x7557('0x9')](),controller[_0x7557('0xa')]);router[_0x7557('0xb')](_0x7557('0xc'),auth[_0x7557('0x9')](),controller[_0x7557('0xd')]);router[_0x7557('0xb')](_0x7557('0xe'),auth[_0x7557('0x9')](),controller[_0x7557('0xf')]);router[_0x7557('0x10')]('/',auth[_0x7557('0x9')](),controller[_0x7557('0x11')]);router[_0x7557('0x12')](_0x7557('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x7557('0x13')](_0x7557('0xe'),auth[_0x7557('0x9')](),controller[_0x7557('0x14')]);module[_0x7557('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 65fbdde..5268d6b 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x9a6004,_0x37044e){var _0x3fd463=function(_0x2217a2){while(--_0x2217a2){_0x9a6004['push'](_0x9a6004['shift']());}};_0x3fd463(++_0x37044e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x275f01,_0x83245e){var _0x523eaf=function(_0x2e7ba6){while(--_0x2e7ba6){_0x275f01['push'](_0x275f01['shift']());}};_0x523eaf(++_0x83245e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5dacea,_0x246bf3){_0x5dacea=_0x5dacea-0x0;var _0x429a5d=_0xf4eb[_0x5dacea];return _0x429a5d;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3737eed..d836aae 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 _0xbf85=['util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../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','stack','name','send','map','SmsTransferReport','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','rawAttributes','length','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xbf85,0x11b));var _0x5bf8=function(_0x267d29,_0x27f1fe){_0x267d29=_0x267d29-0x0;var _0x4cd7c9=_0xbf85[_0x267d29];return _0x4cd7c9;};'use strict';var emlformat=require(_0x5bf8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bf8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bf8('0x2'));var moment=require(_0x5bf8('0x3'));var BPromise=require(_0x5bf8('0x4'));var Mustache=require('mustache');var util=require(_0x5bf8('0x5'));var path=require('path');var sox=require(_0x5bf8('0x6'));var csv=require(_0x5bf8('0x7'));var ejs=require(_0x5bf8('0x8'));var fs=require('fs');var fs_extra=require(_0x5bf8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5bf8('0xa'));var jsforce=require(_0x5bf8('0xb'));var deskjs=require(_0x5bf8('0xc'));var toCsv=require(_0x5bf8('0x7'));var querystring=require(_0x5bf8('0xd'));var Papa=require('papaparse');var Redis=require(_0x5bf8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5bf8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bf8('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x5bf8('0x11'));var config=require(_0x5bf8('0x12'));var licenseUtil=require(_0x5bf8('0x13'));var db=require(_0x5bf8('0x14'))['db'];function respondWithStatusCode(_0x16ea81,_0x2393e1){_0x2393e1=_0x2393e1||0xcc;return function(_0x4648d6){if(_0x4648d6){return _0x16ea81[_0x5bf8('0x15')](_0x2393e1);}return _0x16ea81['status'](_0x2393e1)[_0x5bf8('0x16')]();};}function respondWithResult(_0x4ec759,_0x48bc7e){_0x48bc7e=_0x48bc7e||0xc8;return function(_0x2bce60){if(_0x2bce60){return _0x4ec759[_0x5bf8('0x17')](_0x48bc7e)[_0x5bf8('0x18')](_0x2bce60);}};}function respondWithFilteredResult(_0x162de0,_0x3caa42){return function(_0x160ef8){if(_0x160ef8){var _0x33ee4f=typeof _0x3caa42[_0x5bf8('0x19')]==='undefined'&&typeof _0x3caa42[_0x5bf8('0x1a')]===_0x5bf8('0x1b');var _0x39e772=_0x160ef8[_0x5bf8('0x1c')];var _0x342003=_0x33ee4f?0x0:_0x3caa42[_0x5bf8('0x19')];var _0x1ce194=_0x33ee4f?_0x160ef8[_0x5bf8('0x1c')]:_0x3caa42[_0x5bf8('0x19')]+_0x3caa42['limit'];var _0x2e6f9c;if(_0x1ce194>=_0x39e772){_0x1ce194=_0x39e772;_0x2e6f9c=0xc8;}else{_0x2e6f9c=0xce;}_0x162de0[_0x5bf8('0x17')](_0x2e6f9c);return _0x162de0[_0x5bf8('0x1d')](_0x5bf8('0x1e'),_0x342003+'-'+_0x1ce194+'/'+_0x39e772)[_0x5bf8('0x18')](_0x160ef8);}return null;};}function patchUpdates(_0x53c292){return function(_0x269d2c){try{jsonpatch[_0x5bf8('0x1f')](_0x269d2c,_0x53c292,!![]);}catch(_0xf7275d){return BPromise[_0x5bf8('0x20')](_0xf7275d);}return _0x269d2c[_0x5bf8('0x21')]();};}function saveUpdates(_0xdcdc91,_0x5a0165){return function(_0x150ae6){if(_0x150ae6){return _0x150ae6[_0x5bf8('0x22')](_0xdcdc91)[_0x5bf8('0x23')](function(_0x6830c9){return _0x6830c9;});}return null;};}function removeEntity(_0x1ffd8d,_0x785c45){return function(_0x50ca59){if(_0x50ca59){return _0x50ca59[_0x5bf8('0x24')]()['then'](function(){_0x1ffd8d[_0x5bf8('0x17')](0xcc)[_0x5bf8('0x16')]();});}};}function handleEntityNotFound(_0x113c48,_0x106460){return function(_0x26101d){if(!_0x26101d){_0x113c48[_0x5bf8('0x15')](0x194);}return _0x26101d;};}function handleError(_0x19a338,_0x419704){_0x419704=_0x419704||0x1f4;return function(_0x540736){logger[_0x5bf8('0x25')](_0x540736[_0x5bf8('0x26')]);if(_0x540736[_0x5bf8('0x27')]){delete _0x540736[_0x5bf8('0x27')];}_0x19a338[_0x5bf8('0x17')](_0x419704)[_0x5bf8('0x28')](_0x540736);};}exports['index']=function(_0x2621c6,_0x168ea4){var _0x2f09ae={},_0x2e33c6={},_0x5ad18b={'count':0x0,'rows':[]};var _0x471987=_[_0x5bf8('0x29')](db[_0x5bf8('0x2a')]['rawAttributes'],function(_0xf444fb){return{'name':_0xf444fb[_0x5bf8('0x2b')],'type':_0xf444fb['type']['key']};});_0x2e33c6['model']=_[_0x5bf8('0x29')](_0x471987,_0x5bf8('0x27'));_0x2e33c6[_0x5bf8('0x2c')]=_[_0x5bf8('0x2d')](_0x2621c6[_0x5bf8('0x2c')]);_0x2e33c6[_0x5bf8('0x2e')]=_[_0x5bf8('0x2f')](_0x2e33c6[_0x5bf8('0x30')],_0x2e33c6['query']);_0x2f09ae[_0x5bf8('0x31')]=_[_0x5bf8('0x2f')](_0x2e33c6['model'],qs[_0x5bf8('0x32')](_0x2621c6['query'][_0x5bf8('0x32')]));_0x2f09ae[_0x5bf8('0x31')]=_0x2f09ae['attributes']['length']?_0x2f09ae['attributes']:_0x2e33c6[_0x5bf8('0x30')];if(!_0x2621c6['query'][_0x5bf8('0x33')](_0x5bf8('0x34'))){_0x2f09ae[_0x5bf8('0x1a')]=qs[_0x5bf8('0x1a')](_0x2621c6[_0x5bf8('0x2c')]['limit']);_0x2f09ae[_0x5bf8('0x19')]=qs['offset'](_0x2621c6['query'][_0x5bf8('0x19')]);}_0x2f09ae[_0x5bf8('0x35')]=qs['sort'](_0x2621c6[_0x5bf8('0x2c')][_0x5bf8('0x36')]);_0x2f09ae[_0x5bf8('0x37')]=qs[_0x5bf8('0x2e')](_[_0x5bf8('0x38')](_0x2621c6[_0x5bf8('0x2c')],_0x2e33c6[_0x5bf8('0x2e')]),_0x471987);if(_0x2621c6['query'][_0x5bf8('0x39')]){_0x2f09ae[_0x5bf8('0x37')]=_[_0x5bf8('0x3a')](_0x2f09ae[_0x5bf8('0x37')],{'$or':_[_0x5bf8('0x29')](_0x471987,function(_0x35a20d){if(_0x35a20d[_0x5bf8('0x3b')]!=='VIRTUAL'){var _0x5e4a47={};_0x5e4a47[_0x35a20d[_0x5bf8('0x27')]]={'$like':'%'+_0x2621c6[_0x5bf8('0x2c')][_0x5bf8('0x39')]+'%'};return _0x5e4a47;}})});}_0x2f09ae=_[_0x5bf8('0x3a')]({},_0x2f09ae,_0x2621c6['options']);var _0x4044f3={'where':_0x2f09ae[_0x5bf8('0x37')]};return db[_0x5bf8('0x2a')]['count'](_0x4044f3)[_0x5bf8('0x23')](function(_0xbf9d7d){_0x5ad18b[_0x5bf8('0x1c')]=_0xbf9d7d;if(_0x2621c6[_0x5bf8('0x2c')][_0x5bf8('0x3c')]){_0x2f09ae[_0x5bf8('0x3d')]=[{'all':!![]}];}return db[_0x5bf8('0x2a')]['findAll'](_0x2f09ae);})[_0x5bf8('0x23')](function(_0x1e853d){_0x5ad18b[_0x5bf8('0x3e')]=_0x1e853d;return _0x5ad18b;})[_0x5bf8('0x23')](respondWithFilteredResult(_0x168ea4,_0x2f09ae))[_0x5bf8('0x3f')](handleError(_0x168ea4,null));};exports[_0x5bf8('0x40')]=function(_0x29acea,_0x2afe2c){var _0x7cb410={'raw':!![],'where':{'id':_0x29acea['params']['id']}},_0x18fe23={};_0x18fe23[_0x5bf8('0x30')]=_[_0x5bf8('0x2d')](db[_0x5bf8('0x2a')][_0x5bf8('0x41')]);_0x18fe23[_0x5bf8('0x2c')]=_[_0x5bf8('0x2d')](_0x29acea[_0x5bf8('0x2c')]);_0x18fe23[_0x5bf8('0x2e')]=_[_0x5bf8('0x2f')](_0x18fe23[_0x5bf8('0x30')],_0x18fe23[_0x5bf8('0x2c')]);_0x7cb410[_0x5bf8('0x31')]=_[_0x5bf8('0x2f')](_0x18fe23['model'],qs[_0x5bf8('0x32')](_0x29acea['query'][_0x5bf8('0x32')]));_0x7cb410[_0x5bf8('0x31')]=_0x7cb410[_0x5bf8('0x31')][_0x5bf8('0x42')]?_0x7cb410[_0x5bf8('0x31')]:_0x18fe23[_0x5bf8('0x30')];if(_0x29acea[_0x5bf8('0x2c')][_0x5bf8('0x3c')]){_0x7cb410[_0x5bf8('0x3d')]=[{'all':!![]}];}_0x7cb410=_[_0x5bf8('0x3a')]({},_0x7cb410,_0x29acea['options']);return db[_0x5bf8('0x2a')][_0x5bf8('0x43')](_0x7cb410)[_0x5bf8('0x23')](handleEntityNotFound(_0x2afe2c,null))[_0x5bf8('0x23')](respondWithResult(_0x2afe2c,null))[_0x5bf8('0x3f')](handleError(_0x2afe2c,null));};exports[_0x5bf8('0x44')]=function(_0x416ded,_0x32e871){return db[_0x5bf8('0x2a')][_0x5bf8('0x44')](_0x416ded[_0x5bf8('0x45')],{})[_0x5bf8('0x23')](respondWithResult(_0x32e871,0xc9))[_0x5bf8('0x3f')](handleError(_0x32e871,null));};exports[_0x5bf8('0x22')]=function(_0x7d9bc9,_0x259e54){if(_0x7d9bc9[_0x5bf8('0x45')]['id']){delete _0x7d9bc9['body']['id'];}return db[_0x5bf8('0x2a')][_0x5bf8('0x43')]({'where':{'id':_0x7d9bc9[_0x5bf8('0x46')]['id']}})[_0x5bf8('0x23')](handleEntityNotFound(_0x259e54,null))[_0x5bf8('0x23')](saveUpdates(_0x7d9bc9[_0x5bf8('0x45')],null))[_0x5bf8('0x23')](respondWithResult(_0x259e54,null))[_0x5bf8('0x3f')](handleError(_0x259e54,null));};exports[_0x5bf8('0x24')]=function(_0x160b63,_0x6c3c40){return db['SmsTransferReport']['find']({'where':{'id':_0x160b63[_0x5bf8('0x46')]['id']}})[_0x5bf8('0x23')](handleEntityNotFound(_0x6c3c40,null))['then'](removeEntity(_0x6c3c40,null))[_0x5bf8('0x3f')](handleError(_0x6c3c40,null));};exports[_0x5bf8('0x47')]=function(_0x1ef8d1,_0x121a7d){return db[_0x5bf8('0x2a')]['describe']()[_0x5bf8('0x23')](respondWithResult(_0x121a7d,null))[_0x5bf8('0x3f')](handleError(_0x121a7d,null));}; \ No newline at end of file +var _0x2317=['bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','count','limit','set','Content-Range','apply','update','then','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2317,0x11c));var _0x7231=function(_0x44ff17,_0xcda55d){_0x44ff17=_0x44ff17-0x0;var _0xca15e2=_0x2317[_0x44ff17];return _0xca15e2;};'use strict';var emlformat=require(_0x7231('0x0'));var rimraf=require(_0x7231('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7231('0x2'));var rp=require(_0x7231('0x3'));var moment=require('moment');var BPromise=require(_0x7231('0x4'));var Mustache=require('mustache');var util=require(_0x7231('0x5'));var path=require(_0x7231('0x6'));var sox=require(_0x7231('0x7'));var csv=require(_0x7231('0x8'));var ejs=require(_0x7231('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7231('0xa'));var squel=require(_0x7231('0xb'));var crypto=require('crypto');var jsforce=require(_0x7231('0xc'));var deskjs=require(_0x7231('0xd'));var toCsv=require(_0x7231('0x8'));var querystring=require('querystring');var Papa=require(_0x7231('0xe'));var Redis=require(_0x7231('0xf'));var authService=require(_0x7231('0x10'));var qs=require(_0x7231('0x11'));var as=require(_0x7231('0x12'));var hardwareService=require(_0x7231('0x13'));var logger=require('../../config/logger')(_0x7231('0x14'));var utils=require('../../config/utils');var config=require(_0x7231('0x15'));var licenseUtil=require(_0x7231('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd41bd0,_0x373eb7){_0x373eb7=_0x373eb7||0xcc;return function(_0x31f9e1){if(_0x31f9e1){return _0xd41bd0['sendStatus'](_0x373eb7);}return _0xd41bd0[_0x7231('0x17')](_0x373eb7)[_0x7231('0x18')]();};}function respondWithResult(_0x47b4bc,_0x4fd218){_0x4fd218=_0x4fd218||0xc8;return function(_0x579107){if(_0x579107){return _0x47b4bc[_0x7231('0x17')](_0x4fd218)[_0x7231('0x19')](_0x579107);}};}function respondWithFilteredResult(_0x13f5dd,_0x478f76){return function(_0x4e5cbf){if(_0x4e5cbf){var _0x31bda5=typeof _0x478f76[_0x7231('0x1a')]==='undefined'&&typeof _0x478f76['limit']==='undefined';var _0x5d000c=_0x4e5cbf['count'];var _0x4037b2=_0x31bda5?0x0:_0x478f76[_0x7231('0x1a')];var _0x30ecbb=_0x31bda5?_0x4e5cbf[_0x7231('0x1b')]:_0x478f76['offset']+_0x478f76[_0x7231('0x1c')];var _0x2687ba;if(_0x30ecbb>=_0x5d000c){_0x30ecbb=_0x5d000c;_0x2687ba=0xc8;}else{_0x2687ba=0xce;}_0x13f5dd[_0x7231('0x17')](_0x2687ba);return _0x13f5dd[_0x7231('0x1d')](_0x7231('0x1e'),_0x4037b2+'-'+_0x30ecbb+'/'+_0x5d000c)[_0x7231('0x19')](_0x4e5cbf);}return null;};}function patchUpdates(_0x12bf5b){return function(_0x109cc8){try{jsonpatch[_0x7231('0x1f')](_0x109cc8,_0x12bf5b,!![]);}catch(_0x4aacab){return BPromise['reject'](_0x4aacab);}return _0x109cc8['save']();};}function saveUpdates(_0x1b1901,_0x17affb){return function(_0x57d164){if(_0x57d164){return _0x57d164[_0x7231('0x20')](_0x1b1901)['then'](function(_0x4b284b){return _0x4b284b;});}return null;};}function removeEntity(_0x29519d,_0x55a122){return function(_0x54f572){if(_0x54f572){return _0x54f572['destroy']()[_0x7231('0x21')](function(){_0x29519d[_0x7231('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e8c8a,_0x1b19a4){return function(_0x5696de){if(!_0x5696de){_0x1e8c8a['sendStatus'](0x194);}return _0x5696de;};}function handleError(_0x380818,_0x5f3009){_0x5f3009=_0x5f3009||0x1f4;return function(_0x1824de){logger[_0x7231('0x22')](_0x1824de[_0x7231('0x23')]);if(_0x1824de[_0x7231('0x24')]){delete _0x1824de[_0x7231('0x24')];}_0x380818[_0x7231('0x17')](_0x5f3009)['send'](_0x1824de);};}exports[_0x7231('0x25')]=function(_0x10d515,_0xa35c14){var _0x1d869e={},_0x20a18a={},_0x5992ff={'count':0x0,'rows':[]};var _0x9b87fb=_[_0x7231('0x26')](db[_0x7231('0x27')][_0x7231('0x28')],function(_0x2bf7a0){return{'name':_0x2bf7a0[_0x7231('0x29')],'type':_0x2bf7a0[_0x7231('0x2a')][_0x7231('0x2b')]};});_0x20a18a['model']=_[_0x7231('0x26')](_0x9b87fb,_0x7231('0x24'));_0x20a18a[_0x7231('0x2c')]=_[_0x7231('0x2d')](_0x10d515[_0x7231('0x2c')]);_0x20a18a['filters']=_[_0x7231('0x2e')](_0x20a18a[_0x7231('0x2f')],_0x20a18a[_0x7231('0x2c')]);_0x1d869e[_0x7231('0x30')]=_['intersection'](_0x20a18a[_0x7231('0x2f')],qs[_0x7231('0x31')](_0x10d515[_0x7231('0x2c')][_0x7231('0x31')]));_0x1d869e[_0x7231('0x30')]=_0x1d869e['attributes'][_0x7231('0x32')]?_0x1d869e[_0x7231('0x30')]:_0x20a18a[_0x7231('0x2f')];if(!_0x10d515[_0x7231('0x2c')][_0x7231('0x33')](_0x7231('0x34'))){_0x1d869e[_0x7231('0x1c')]=qs[_0x7231('0x1c')](_0x10d515[_0x7231('0x2c')]['limit']);_0x1d869e['offset']=qs['offset'](_0x10d515[_0x7231('0x2c')][_0x7231('0x1a')]);}_0x1d869e[_0x7231('0x35')]=qs[_0x7231('0x36')](_0x10d515[_0x7231('0x2c')][_0x7231('0x36')]);_0x1d869e[_0x7231('0x37')]=qs['filters'](_[_0x7231('0x38')](_0x10d515[_0x7231('0x2c')],_0x20a18a[_0x7231('0x39')]),_0x9b87fb);if(_0x10d515['query'][_0x7231('0x3a')]){_0x1d869e[_0x7231('0x37')]=_['merge'](_0x1d869e[_0x7231('0x37')],{'$or':_[_0x7231('0x26')](_0x9b87fb,function(_0x4d79bd){if(_0x4d79bd['type']!==_0x7231('0x3b')){var _0x22254d={};_0x22254d[_0x4d79bd['name']]={'$like':'%'+_0x10d515[_0x7231('0x2c')]['filter']+'%'};return _0x22254d;}})});}_0x1d869e=_['merge']({},_0x1d869e,_0x10d515[_0x7231('0x3c')]);var _0xd9c87e={'where':_0x1d869e[_0x7231('0x37')]};return db['SmsTransferReport']['count'](_0xd9c87e)['then'](function(_0x2d0cf7){_0x5992ff[_0x7231('0x1b')]=_0x2d0cf7;if(_0x10d515[_0x7231('0x2c')][_0x7231('0x3d')]){_0x1d869e[_0x7231('0x3e')]=[{'all':!![]}];}return db[_0x7231('0x27')]['findAll'](_0x1d869e);})[_0x7231('0x21')](function(_0x479b51){_0x5992ff[_0x7231('0x3f')]=_0x479b51;return _0x5992ff;})['then'](respondWithFilteredResult(_0xa35c14,_0x1d869e))[_0x7231('0x40')](handleError(_0xa35c14,null));};exports[_0x7231('0x41')]=function(_0x5e19df,_0x412727){var _0x4c224c={'raw':!![],'where':{'id':_0x5e19df[_0x7231('0x42')]['id']}},_0x54df59={};_0x54df59[_0x7231('0x2f')]=_[_0x7231('0x2d')](db['SmsTransferReport']['rawAttributes']);_0x54df59[_0x7231('0x2c')]=_[_0x7231('0x2d')](_0x5e19df[_0x7231('0x2c')]);_0x54df59[_0x7231('0x39')]=_[_0x7231('0x2e')](_0x54df59[_0x7231('0x2f')],_0x54df59['query']);_0x4c224c[_0x7231('0x30')]=_['intersection'](_0x54df59[_0x7231('0x2f')],qs[_0x7231('0x31')](_0x5e19df[_0x7231('0x2c')][_0x7231('0x31')]));_0x4c224c[_0x7231('0x30')]=_0x4c224c[_0x7231('0x30')][_0x7231('0x32')]?_0x4c224c[_0x7231('0x30')]:_0x54df59['model'];if(_0x5e19df['query'][_0x7231('0x3d')]){_0x4c224c['include']=[{'all':!![]}];}_0x4c224c=_['merge']({},_0x4c224c,_0x5e19df[_0x7231('0x3c')]);return db[_0x7231('0x27')][_0x7231('0x43')](_0x4c224c)[_0x7231('0x21')](handleEntityNotFound(_0x412727,null))[_0x7231('0x21')](respondWithResult(_0x412727,null))['catch'](handleError(_0x412727,null));};exports['create']=function(_0x2ca64d,_0x336db9){return db[_0x7231('0x27')][_0x7231('0x44')](_0x2ca64d['body'],{})['then'](respondWithResult(_0x336db9,0xc9))[_0x7231('0x40')](handleError(_0x336db9,null));};exports[_0x7231('0x20')]=function(_0xd65217,_0x7fdf3d){if(_0xd65217[_0x7231('0x45')]['id']){delete _0xd65217[_0x7231('0x45')]['id'];}return db['SmsTransferReport'][_0x7231('0x43')]({'where':{'id':_0xd65217['params']['id']}})[_0x7231('0x21')](handleEntityNotFound(_0x7fdf3d,null))[_0x7231('0x21')](saveUpdates(_0xd65217['body'],null))[_0x7231('0x21')](respondWithResult(_0x7fdf3d,null))[_0x7231('0x40')](handleError(_0x7fdf3d,null));};exports[_0x7231('0x46')]=function(_0x34e928,_0x33ab1f){return db[_0x7231('0x27')]['find']({'where':{'id':_0x34e928[_0x7231('0x42')]['id']}})[_0x7231('0x21')](handleEntityNotFound(_0x33ab1f,null))[_0x7231('0x21')](removeEntity(_0x33ab1f,null))[_0x7231('0x40')](handleError(_0x33ab1f,null));};exports[_0x7231('0x47')]=function(_0x479892,_0x26b014){return db['SmsTransferReport'][_0x7231('0x47')]()[_0x7231('0x21')](respondWithResult(_0x26b014,null))[_0x7231('0x40')](handleError(_0x26b014,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 634f50f..7763b01 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 _0x2036=['../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e48c0,_0x24ca49){var _0x569e99=function(_0x152a23){while(--_0x152a23){_0x4e48c0['push'](_0x4e48c0['shift']());}};_0x569e99(++_0x24ca49);}(_0x2036,0x11e));var _0x6203=function(_0x2cc6bf,_0x4849a3){_0x2cc6bf=_0x2cc6bf-0x0;var _0x320f3c=_0x2036[_0x2cc6bf];return _0x320f3c;};'use strict';var _=require(_0x6203('0x0'));var util=require('util');var logger=require(_0x6203('0x1'))(_0x6203('0x2'));var moment=require(_0x6203('0x3'));var BPromise=require(_0x6203('0x4'));var rp=require(_0x6203('0x5'));var fs=require('fs');var path=require(_0x6203('0x6'));var rimraf=require(_0x6203('0x7'));var config=require(_0x6203('0x8'));var attributes=require(_0x6203('0x9'));module[_0x6203('0xa')]=function(_0x25e4f6,_0x44aa30){return _0x25e4f6[_0x6203('0xb')]('SmsTransferReport',attributes,{'tableName':_0x6203('0xc'),'paranoid':![],'indexes':[{'name':_0x6203('0xd'),'fields':[_0x6203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8406=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport'];(function(_0x14860a,_0x4ca4c7){var _0x300f02=function(_0x27181d){while(--_0x27181d){_0x14860a['push'](_0x14860a['shift']());}};_0x300f02(++_0x4ca4c7);}(_0x8406,0x10c));var _0x6840=function(_0x48cc4c,_0x10ee68){_0x48cc4c=_0x48cc4c-0x0;var _0xaa74fd=_0x8406[_0x48cc4c];return _0xaa74fd;};'use strict';var _=require(_0x6840('0x0'));var util=require(_0x6840('0x1'));var logger=require(_0x6840('0x2'))(_0x6840('0x3'));var moment=require(_0x6840('0x4'));var BPromise=require(_0x6840('0x5'));var rp=require(_0x6840('0x6'));var fs=require('fs');var path=require(_0x6840('0x7'));var rimraf=require('rimraf');var config=require(_0x6840('0x8'));var attributes=require(_0x6840('0x9'));module['exports']=function(_0x4a33be,_0xf0cbcb){return _0x4a33be[_0x6840('0xa')](_0x6840('0xb'),attributes,{'tableName':_0x6840('0xc'),'paranoid':![],'indexes':[{'name':_0x6840('0xd'),'fields':[_0x6840('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 adc13a5..4ec5597 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 _0xc6ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','stringify','error','code','SmsTransferReport,\x20%s,\x20%s'];(function(_0x5b95d7,_0x239b0a){var _0x18da1f=function(_0x376baa){while(--_0x376baa){_0x5b95d7['push'](_0x5b95d7['shift']());}};_0x18da1f(++_0x239b0a);}(_0xc6ab,0x96));var _0xbc6a=function(_0x36a5c8,_0x2bbf14){_0x36a5c8=_0x36a5c8-0x0;var _0x198753=_0xc6ab[_0x36a5c8];return _0x198753;};'use strict';var _=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var moment=require(_0xbc6a('0x2'));var BPromise=require(_0xbc6a('0x3'));var rs=require(_0xbc6a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbc6a('0x5'));var logger=require(_0xbc6a('0x6'))(_0xbc6a('0x7'));var config=require(_0xbc6a('0x8'));var jayson=require(_0xbc6a('0x9'));var client=jayson['client'][_0xbc6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263f4b,_0x325592,_0x1b7a4c){return new BPromise(function(_0x2f7f5f,_0x529b73){return client['request'](_0x263f4b,_0x1b7a4c)[_0xbc6a('0xb')](function(_0x2a1ba6){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x325592,_0xbc6a('0xc'));logger[_0xbc6a('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x325592,_0xbc6a('0xc'),JSON[_0xbc6a('0xe')](_0x2a1ba6));if(_0x2a1ba6[_0xbc6a('0xf')]){if(_0x2a1ba6['error'][_0xbc6a('0x10')]===0x1f4){logger[_0xbc6a('0xf')](_0xbc6a('0x11'),_0x325592,_0x2a1ba6[_0xbc6a('0xf')]['message']);return _0x529b73(_0x2a1ba6['error']['message']);}logger[_0xbc6a('0xf')](_0xbc6a('0x11'),_0x325592,_0x2a1ba6['error'][_0xbc6a('0x12')]);return _0x2f7f5f(_0x2a1ba6['error'][_0xbc6a('0x12')]);}else{logger['info'](_0xbc6a('0x11'),_0x325592,_0xbc6a('0xc'));_0x2f7f5f(_0x2a1ba6[_0xbc6a('0x13')][_0xbc6a('0x12')]);}})[_0xbc6a('0x14')](function(_0x3e6393){logger[_0xbc6a('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x325592,_0x3e6393);_0x529b73(_0x3e6393);});});} \ No newline at end of file +var _0x3036=['moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x148783,_0x1ac458){var _0x85329a=function(_0x52afd8){while(--_0x52afd8){_0x148783['push'](_0x148783['shift']());}};_0x85329a(++_0x1ac458);}(_0x3036,0x1a9));var _0x6303=function(_0x4bd688,_0x6126fb){_0x4bd688=_0x4bd688-0x0;var _0xef916b=_0x3036[_0x4bd688];return _0xef916b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6303('0x0'));var BPromise=require(_0x6303('0x1'));var rs=require(_0x6303('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6303('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6303('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x6303('0x5')][_0x6303('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x25a0ce,_0x48c936,_0x8a0038){return new BPromise(function(_0x420da8,_0x2e2be8){return client[_0x6303('0x7')](_0x25a0ce,_0x8a0038)[_0x6303('0x8')](function(_0x2684ac){logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));logger['debug'](_0x6303('0xc'),_0x48c936,_0x6303('0xb'),JSON[_0x6303('0xd')](_0x2684ac));if(_0x2684ac[_0x6303('0xe')]){if(_0x2684ac[_0x6303('0xe')]['code']===0x1f4){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x2e2be8(_0x2684ac[_0x6303('0xe')]['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x420da8(_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);}else{logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));_0x420da8(_0x2684ac[_0x6303('0x10')][_0x6303('0xf')]);}})['catch'](function(_0x50a19c){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x50a19c);_0x2e2be8(_0x50a19c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index dc61473..4a1101d 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 _0x9ec3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','join','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','update','delete'];(function(_0x5dda65,_0x4f4c68){var _0x14af1f=function(_0x135bda){while(--_0x135bda){_0x5dda65['push'](_0x5dda65['shift']());}};_0x14af1f(++_0x4f4c68);}(_0x9ec3,0x13f));var _0x39ec=function(_0x162f62,_0x1a0ab1){_0x162f62=_0x162f62-0x0;var _0x26c56e=_0x9ec3[_0x162f62];return _0x26c56e;};'use strict';var multer=require(_0x39ec('0x0'));var util=require(_0x39ec('0x1'));var path=require(_0x39ec('0x2'));var timeout=require(_0x39ec('0x3'));var express=require(_0x39ec('0x4'));var router=express[_0x39ec('0x5')]();var fs_extra=require(_0x39ec('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x39ec('0x7'));var config=require(_0x39ec('0x8'));var controller=require('./sound.controller');router[_0x39ec('0x9')]('/',auth[_0x39ec('0xa')](),controller[_0x39ec('0xb')]);router[_0x39ec('0x9')](_0x39ec('0xc'),auth['isAuthenticated'](),controller[_0x39ec('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x39ec('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3bf0bc,_0x16be66,_0x4e9266){_0x4e9266(null,path[_0x39ec('0xf')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x4c1e89,_0x1d518b,_0x91bf11){_0x1d518b[_0x39ec('0x10')]=_0x1d518b[_0x39ec('0x10')][_0x39ec('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x91bf11(null,util[_0x39ec('0x12')](_0x39ec('0x13'),path[_0x39ec('0x14')](_0x1d518b[_0x39ec('0x10')],path[_0x39ec('0x15')](_0x1d518b[_0x39ec('0x10')])),Date[_0x39ec('0x16')](),path[_0x39ec('0x15')](_0x1d518b['originalname'])));}})});router[_0x39ec('0x17')]('/',upload[_0x39ec('0x18')](_0x39ec('0x19')),controller['create']);router[_0x39ec('0x1a')](_0x39ec('0xc'),auth[_0x39ec('0xa')](),controller[_0x39ec('0x1b')]);router['delete']('/:id',auth[_0x39ec('0xa')](),controller[_0x39ec('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xa60a=['create','put','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id/download','download','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file'];(function(_0x4d6694,_0x1c5573){var _0xcbb37e=function(_0x5b9521){while(--_0x5b9521){_0x4d6694['push'](_0x4d6694['shift']());}};_0xcbb37e(++_0x1c5573);}(_0xa60a,0x13b));var _0xaa60=function(_0xe7dcd4,_0x3b834c){_0xe7dcd4=_0xe7dcd4-0x0;var _0x2ea79b=_0xa60a[_0xe7dcd4];return _0x2ea79b;};'use strict';var multer=require(_0xaa60('0x0'));var util=require(_0xaa60('0x1'));var path=require('path');var timeout=require(_0xaa60('0x2'));var express=require(_0xaa60('0x3'));var router=express[_0xaa60('0x4')]();var fs_extra=require(_0xaa60('0x5'));var auth=require(_0xaa60('0x6'));var interaction=require(_0xaa60('0x7'));var config=require('../../config/environment');var controller=require(_0xaa60('0x8'));router[_0xaa60('0x9')]('/',auth[_0xaa60('0xa')](),controller[_0xaa60('0xb')]);router[_0xaa60('0x9')]('/:id',auth[_0xaa60('0xa')](),controller['show']);router[_0xaa60('0x9')](_0xaa60('0xc'),auth[_0xaa60('0xa')](),controller[_0xaa60('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5eed4f,_0x5f015d,_0x27cc1b){_0x27cc1b(null,path[_0xaa60('0xe')](config['root'],_0xaa60('0xf')));},'filename':function(_0x4e2124,_0x1578f7,_0x1f07fa){_0x1578f7[_0xaa60('0x10')]=_0x1578f7[_0xaa60('0x10')][_0xaa60('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f07fa(null,util[_0xaa60('0x12')](_0xaa60('0x13'),path[_0xaa60('0x14')](_0x1578f7[_0xaa60('0x10')],path['extname'](_0x1578f7[_0xaa60('0x10')])),Date[_0xaa60('0x15')](),path[_0xaa60('0x16')](_0x1578f7[_0xaa60('0x10')])));}})});router[_0xaa60('0x17')]('/',upload[_0xaa60('0x18')](_0xaa60('0x19')),controller[_0xaa60('0x1a')]);router[_0xaa60('0x1b')](_0xaa60('0x1c'),auth[_0xaa60('0xa')](),controller[_0xaa60('0x1d')]);router['delete']('/:id',auth[_0xaa60('0xa')](),controller['delete']);module[_0xaa60('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0f25a55..364ff1a 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 _0xbb8b=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x579e43,_0x26f81d){var _0x39a0e9=function(_0x42d939){while(--_0x42d939){_0x579e43['push'](_0x579e43['shift']());}};_0x39a0e9(++_0x26f81d);}(_0xbb8b,0x12d));var _0xbbb8=function(_0x46a3e9,_0x373d46){_0x46a3e9=_0x46a3e9-0x0;var _0x4e3f80=_0xbb8b[_0x46a3e9];return _0x4e3f80;};'use strict';var Sequelize=require(_0xbbb8('0x0'));module[_0xbbb8('0x1')]={'name':{'type':Sequelize[_0xbbb8('0x2')],'unique':_0xbbb8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xbbb8('0x2')]},'display_name':{'type':Sequelize[_0xbbb8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xbbb8('0x2')]},'original_format':{'type':Sequelize[_0xbbb8('0x2')]},'original_duration':{'type':Sequelize[_0xbbb8('0x4')]},'original_sampleCount':{'type':Sequelize[_0xbbb8('0x5')]},'original_channelCount':{'type':Sequelize[_0xbbb8('0x6')]},'original_bitRate':{'type':Sequelize[_0xbbb8('0x5')]},'original_sampleRate':{'type':Sequelize[_0xbbb8('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xbbb8('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xbbb8('0x5')]},'converted_channelCount':{'type':Sequelize[_0xbbb8('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xbbb8('0x6')]}}; \ No newline at end of file +var _0xe4b3=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports','name'];(function(_0x47c17d,_0x1653f8){var _0x14eb2a=function(_0x5bdba4){while(--_0x5bdba4){_0x47c17d['push'](_0x47c17d['shift']());}};_0x14eb2a(++_0x1653f8);}(_0xe4b3,0x17e));var _0x3e4b=function(_0x28031d,_0x159c5e){_0x28031d=_0x28031d-0x0;var _0x4c8396=_0xe4b3[_0x28031d];return _0x4c8396;};'use strict';var Sequelize=require(_0x3e4b('0x0'));module[_0x3e4b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3e4b('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3e4b('0x3')]},'display_name':{'type':Sequelize[_0x3e4b('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x3e4b('0x3')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x3e4b('0x4')]},'original_sampleCount':{'type':Sequelize[_0x3e4b('0x5')]},'original_channelCount':{'type':Sequelize[_0x3e4b('0x6')]},'original_bitRate':{'type':Sequelize[_0x3e4b('0x5')]},'original_sampleRate':{'type':Sequelize[_0x3e4b('0x6')]},'converted_format':{'type':Sequelize[_0x3e4b('0x3')]},'converted_duration':{'type':Sequelize[_0x3e4b('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x3e4b('0x5')]},'converted_channelCount':{'type':Sequelize[_0x3e4b('0x6')]},'converted_bitRate':{'type':Sequelize[_0x3e4b('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x3e4b('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 46ea5d2..3698476 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 _0xa96f=['info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','send','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','options','count','includeAll','include','show','params','merge','find','catch','download','save_name','ValidationError','Sound\x20not\x20found','join','root','server/files/sounds/converted','format','%s.%s','converted_format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original'];(function(_0x31d4a2,_0x318ca2){var _0x33fd3f=function(_0xad25c9){while(--_0xad25c9){_0x31d4a2['push'](_0x31d4a2['shift']());}};_0x33fd3f(++_0x318ca2);}(_0xa96f,0xa5));var _0xfa96=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xa96f[_0x3a9661];return _0x5bb119;};'use strict';var emlformat=require(_0xfa96('0x0'));var rimraf=require(_0xfa96('0x1'));var zipdir=require(_0xfa96('0x2'));var jsonpatch=require(_0xfa96('0x3'));var rp=require(_0xfa96('0x4'));var moment=require(_0xfa96('0x5'));var BPromise=require(_0xfa96('0x6'));var Mustache=require(_0xfa96('0x7'));var util=require(_0xfa96('0x8'));var path=require(_0xfa96('0x9'));var sox=require(_0xfa96('0xa'));var csv=require(_0xfa96('0xb'));var ejs=require(_0xfa96('0xc'));var fs=require('fs');var fs_extra=require(_0xfa96('0xd'));var _=require(_0xfa96('0xe'));var squel=require(_0xfa96('0xf'));var crypto=require(_0xfa96('0x10'));var jsforce=require(_0xfa96('0x11'));var deskjs=require(_0xfa96('0x12'));var toCsv=require('to-csv');var querystring=require(_0xfa96('0x13'));var Papa=require(_0xfa96('0x14'));var Redis=require(_0xfa96('0x15'));var authService=require(_0xfa96('0x16'));var qs=require(_0xfa96('0x17'));var as=require(_0xfa96('0x18'));var hardwareService=require(_0xfa96('0x19'));var logger=require(_0xfa96('0x1a'))(_0xfa96('0x1b'));var utils=require(_0xfa96('0x1c'));var config=require(_0xfa96('0x1d'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x470347,_0x55e814){_0x55e814=_0x55e814||0xcc;return function(_0x4843e8){if(_0x4843e8){return _0x470347[_0xfa96('0x1e')](_0x55e814);}return _0x470347['status'](_0x55e814)['end']();};}function respondWithResult(_0x146bd0,_0x1d47c2){_0x1d47c2=_0x1d47c2||0xc8;return function(_0x3983b2){if(_0x3983b2){return _0x146bd0[_0xfa96('0x1f')](_0x1d47c2)['json'](_0x3983b2);}};}function respondWithFilteredResult(_0x16de3d,_0x3510b7){return function(_0x3f1548){if(_0x3f1548){var _0x4b3b13=typeof _0x3510b7[_0xfa96('0x20')]==='undefined'&&typeof _0x3510b7[_0xfa96('0x21')]===_0xfa96('0x22');var _0x1e6eb0=_0x3f1548['count'];var _0x5e56d5=_0x4b3b13?0x0:_0x3510b7[_0xfa96('0x20')];var _0x545f48=_0x4b3b13?_0x3f1548['count']:_0x3510b7['offset']+_0x3510b7[_0xfa96('0x21')];var _0x15f6cf;if(_0x545f48>=_0x1e6eb0){_0x545f48=_0x1e6eb0;_0x15f6cf=0xc8;}else{_0x15f6cf=0xce;}_0x16de3d[_0xfa96('0x1f')](_0x15f6cf);return _0x16de3d[_0xfa96('0x23')](_0xfa96('0x24'),_0x5e56d5+'-'+_0x545f48+'/'+_0x1e6eb0)[_0xfa96('0x25')](_0x3f1548);}return null;};}function patchUpdates(_0x2bc172){return function(_0x4fb5f2){try{jsonpatch[_0xfa96('0x26')](_0x4fb5f2,_0x2bc172,!![]);}catch(_0x12fe21){return BPromise['reject'](_0x12fe21);}return _0x4fb5f2['save']();};}function saveUpdates(_0x4c8028,_0x62c0eb){return function(_0x109693){if(_0x109693){return _0x109693['update'](_0x4c8028)[_0xfa96('0x27')](function(_0x228685){return _0x228685;});}return null;};}function removeEntity(_0xe4264,_0xca832e){return function(_0x2660aa){if(_0x2660aa){return _0x2660aa[_0xfa96('0x28')]()[_0xfa96('0x27')](function(){var _0x2da472=_0x2660aa[_0xfa96('0x29')]({'plain':!![]});var _0x11b560='Sounds';return db[_0xfa96('0x2a')][_0xfa96('0x28')]({'where':{'type':_0x11b560,'resourceId':_0x2da472['id']}})[_0xfa96('0x27')](function(){return _0x2660aa;});})[_0xfa96('0x27')](function(){_0xe4264[_0xfa96('0x1f')](0xcc)[_0xfa96('0x2b')]();});}};}function handleEntityNotFound(_0x621b1b,_0x39ce9f){return function(_0x55cf1c){if(!_0x55cf1c){_0x621b1b[_0xfa96('0x1e')](0x194);}return _0x55cf1c;};}function handleError(_0x5b9647,_0x14e417){_0x14e417=_0x14e417||0x1f4;return function(_0x567edc){logger[_0xfa96('0x2c')](_0x567edc[_0xfa96('0x2d')]);if(_0x567edc[_0xfa96('0x2e')]){delete _0x567edc['name'];}_0x5b9647[_0xfa96('0x1f')](_0x14e417)['send'](_0x567edc);};}exports[_0xfa96('0x2f')]=function(_0x168359,_0x30ae72){var _0x501140={},_0x35968c={},_0x538e87={'count':0x0,'rows':[]};var _0x578512=_[_0xfa96('0x30')](db[_0xfa96('0x31')][_0xfa96('0x32')],function(_0x4ecdab){return{'name':_0x4ecdab[_0xfa96('0x33')],'type':_0x4ecdab[_0xfa96('0x34')]['key']};});_0x35968c[_0xfa96('0x35')]=_[_0xfa96('0x30')](_0x578512,_0xfa96('0x2e'));_0x35968c['query']=_[_0xfa96('0x36')](_0x168359[_0xfa96('0x37')]);_0x35968c['filters']=_[_0xfa96('0x38')](_0x35968c[_0xfa96('0x35')],_0x35968c[_0xfa96('0x37')]);_0x501140['attributes']=_['intersection'](_0x35968c['model'],qs[_0xfa96('0x39')](_0x168359[_0xfa96('0x37')]['fields']));_0x501140[_0xfa96('0x3a')]=_0x501140[_0xfa96('0x3a')][_0xfa96('0x3b')]?_0x501140[_0xfa96('0x3a')]:_0x35968c['model'];if(!_0x168359[_0xfa96('0x37')][_0xfa96('0x3c')]('nolimit')){_0x501140[_0xfa96('0x21')]=qs[_0xfa96('0x21')](_0x168359[_0xfa96('0x37')]['limit']);_0x501140[_0xfa96('0x20')]=qs[_0xfa96('0x20')](_0x168359[_0xfa96('0x37')][_0xfa96('0x20')]);}_0x501140[_0xfa96('0x3d')]=qs[_0xfa96('0x3e')](_0x168359['query'][_0xfa96('0x3e')]);_0x501140[_0xfa96('0x3f')]=qs['filters'](_[_0xfa96('0x40')](_0x168359[_0xfa96('0x37')],_0x35968c[_0xfa96('0x41')]),_0x578512);if(_0x168359[_0xfa96('0x37')][_0xfa96('0x42')]){_0x501140[_0xfa96('0x3f')]=_['merge'](_0x501140['where'],{'$or':_['map'](_0x578512,function(_0x9db98f){if(_0x9db98f[_0xfa96('0x34')]!==_0xfa96('0x43')){var _0x483c11={};_0x483c11[_0x9db98f[_0xfa96('0x2e')]]={'$like':'%'+_0x168359['query'][_0xfa96('0x42')]+'%'};return _0x483c11;}})});}_0x501140=_['merge']({},_0x501140,_0x168359[_0xfa96('0x44')]);var _0x2d1fda={'where':_0x501140['where']};return db['Sound'][_0xfa96('0x45')](_0x2d1fda)['then'](function(_0x396a99){_0x538e87[_0xfa96('0x45')]=_0x396a99;if(_0x168359['query'][_0xfa96('0x46')]){_0x501140[_0xfa96('0x47')]=[{'all':!![]}];}return db[_0xfa96('0x31')]['findAll'](_0x501140);})[_0xfa96('0x27')](function(_0x49564d){_0x538e87['rows']=_0x49564d;return _0x538e87;})[_0xfa96('0x27')](respondWithFilteredResult(_0x30ae72,_0x501140))['catch'](handleError(_0x30ae72,null));};exports[_0xfa96('0x48')]=function(_0x1c63da,_0x27b5f5){var _0x44a98c={'raw':!![],'where':{'id':_0x1c63da[_0xfa96('0x49')]['id']}},_0x545daa={};_0x545daa['model']=_[_0xfa96('0x36')](db[_0xfa96('0x31')][_0xfa96('0x32')]);_0x545daa[_0xfa96('0x37')]=_[_0xfa96('0x36')](_0x1c63da[_0xfa96('0x37')]);_0x545daa[_0xfa96('0x41')]=_['intersection'](_0x545daa['model'],_0x545daa[_0xfa96('0x37')]);_0x44a98c[_0xfa96('0x3a')]=_['intersection'](_0x545daa['model'],qs[_0xfa96('0x39')](_0x1c63da[_0xfa96('0x37')][_0xfa96('0x39')]));_0x44a98c['attributes']=_0x44a98c['attributes'][_0xfa96('0x3b')]?_0x44a98c['attributes']:_0x545daa[_0xfa96('0x35')];if(_0x1c63da['query'][_0xfa96('0x46')]){_0x44a98c[_0xfa96('0x47')]=[{'all':!![]}];}_0x44a98c=_[_0xfa96('0x4a')]({},_0x44a98c,_0x1c63da['options']);return db[_0xfa96('0x31')][_0xfa96('0x4b')](_0x44a98c)[_0xfa96('0x27')](handleEntityNotFound(_0x27b5f5,null))[_0xfa96('0x27')](respondWithResult(_0x27b5f5,null))[_0xfa96('0x4c')](handleError(_0x27b5f5,null));};exports[_0xfa96('0x4d')]=function(_0x11131a,_0x161930,_0x3fa424){return db[_0xfa96('0x31')][_0xfa96('0x4b')]({'where':{'id':_0x11131a[_0xfa96('0x49')]['id']},'attributes':['name',_0xfa96('0x4e'),'converted_format'],'raw':!![]})[_0xfa96('0x27')](handleEntityNotFound(_0x161930,null))['then'](function(_0x287aa4){if(_0x287aa4){if(!fs['existsSync'](path['join'](config['root'],'server/files/sounds/converted',_0x287aa4['save_name']+'.'+_0x287aa4['converted_format']))){throw new db['Sequelize'][(_0xfa96('0x4f'))](_0xfa96('0x50'));}return _0x161930['download'](path[_0xfa96('0x51')](config[_0xfa96('0x52')],_0xfa96('0x53'),util[_0xfa96('0x54')](_0xfa96('0x55'),_0x287aa4['save_name'],_0x287aa4[_0xfa96('0x56')])),util['format']('%s.%s',_0x287aa4[_0xfa96('0x2e')],_0x287aa4['converted_format']));}return null;})[_0xfa96('0x4c')](handleError(_0x161930,null));};exports['create']=function(_0x4d3f3b,_0x52cfe4,_0xc68cd1){var _0x37389d={'name':path[_0xfa96('0x57')](_0x4d3f3b[_0xfa96('0x58')][_0xfa96('0x59')],path[_0xfa96('0x5a')](_0x4d3f3b[_0xfa96('0x58')][_0xfa96('0x59')])),'save_name':path[_0xfa96('0x57')](_0x4d3f3b['file'][_0xfa96('0x5b')],path['extname'](_0x4d3f3b[_0xfa96('0x58')][_0xfa96('0x5b')])),'original_format':path[_0xfa96('0x5a')](_0x4d3f3b['file'][_0xfa96('0x59')])[_0xfa96('0x5c')](0x1),'converted_format':_0xfa96('0x5d')};var _0x2998b8=path[_0xfa96('0x51')](config[_0xfa96('0x52')],_0xfa96('0x5e'),_0x4d3f3b[_0xfa96('0x58')][_0xfa96('0x5b')]);var _0x2a8008=path['join'](config[_0xfa96('0x52')],_0xfa96('0x53'),util['format'](_0xfa96('0x55'),path[_0xfa96('0x57')](_0x4d3f3b[_0xfa96('0x58')][_0xfa96('0x5b')],path[_0xfa96('0x5a')](_0x4d3f3b[_0xfa96('0x58')][_0xfa96('0x5b')])),_0x37389d['converted_format']));logger[_0xfa96('0x5f')](_0xfa96('0x60'),_0x2998b8);logger[_0xfa96('0x5f')](_0xfa96('0x61'),_0x2a8008);try{fs[_0xfa96('0x62')](_0x2998b8,parseInt(_0xfa96('0x63'),0x8));var _0x74ed7c=sox['transcode'](_0x2998b8,_0x2a8008,{'sampleRate':0x1f40,'format':_0xfa96('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x74ed7c['on'](_0xfa96('0x2c'),function(_0x5394a4){fs[_0xfa96('0x64')](_0x2998b8);_0x52cfe4[_0xfa96('0x1f')](0x1f4)[_0xfa96('0x65')](_0x5394a4);});_0x74ed7c['on']('src',function(_0xda74bd){_0x37389d[_0xfa96('0x66')]=isNaN(_0xda74bd[_0xfa96('0x67')])?null:_0xda74bd['duration']*0x3e8;_0x37389d['original_sampleCount']=isNaN(_0xda74bd['sampleCount'])?null:_0xda74bd[_0xfa96('0x68')];_0x37389d[_0xfa96('0x69')]=isNaN(_0xda74bd[_0xfa96('0x6a')])?null:_0xda74bd['channelCount'];_0x37389d[_0xfa96('0x6b')]=isNaN(_0xda74bd[_0xfa96('0x6c')])?null:_0xda74bd[_0xfa96('0x6c')];_0x37389d[_0xfa96('0x6d')]=isNaN(_0xda74bd['sampleRate'])?null:_0xda74bd[_0xfa96('0x6e')];});_0x74ed7c['on'](_0xfa96('0x6f'),function(_0x253119){_0x37389d[_0xfa96('0x70')]=isNaN(_0x253119[_0xfa96('0x67')])?null:_0x253119['duration']*0x3e8;_0x37389d['converted_sampleCount']=isNaN(_0x253119[_0xfa96('0x68')])?null:_0x253119['sampleCount'];_0x37389d['converted_channelCount']=isNaN(_0x253119[_0xfa96('0x6a')])?null:_0x253119['channelCount'];_0x37389d[_0xfa96('0x71')]=isNaN(_0x253119[_0xfa96('0x6c')])?null:_0x253119[_0xfa96('0x6c')];_0x37389d[_0xfa96('0x72')]=isNaN(_0x253119['sampleRate'])?null:_0x253119['sampleRate'];});_0x74ed7c['on']('end',function(){fs[_0xfa96('0x62')](_0x2a8008,parseInt(_0xfa96('0x63'),0x8));return db[_0xfa96('0x31')][_0xfa96('0x73')](_0x37389d)[_0xfa96('0x27')](function(_0x2de53c){var _0x4095d5={'role':_0x4d3f3b[_0xfa96('0x74')][_0xfa96('0x75')],'userProfileId':_0x4d3f3b[_0xfa96('0x74')][_0xfa96('0x76')]};if(!_0x4095d5)throw new Error(_0xfa96('0x77'));if(_0x4095d5[_0xfa96('0x75')]===_0xfa96('0x78')){var _0x528c58=_0x2de53c[_0xfa96('0x29')]({'plain':!![]});return db[_0xfa96('0x79')][_0xfa96('0x4b')]({'where':{'name':_0xfa96('0x7a'),'userProfileId':_0x4095d5['userProfileId']},'raw':!![]})[_0xfa96('0x27')](function(_0x126b50){if(_0x126b50&&_0x126b50[_0xfa96('0x7b')]===0x0){return db[_0xfa96('0x2a')][_0xfa96('0x73')]({'name':_0x528c58['name'],'resourceId':_0x528c58['id'],'type':_0x126b50[_0xfa96('0x2e')],'sectionId':_0x126b50['id']},{})[_0xfa96('0x27')](function(){return _0x2de53c;});}else{return _0x2de53c;}})[_0xfa96('0x4c')](function(_0x3f1fa2){logger[_0xfa96('0x2c')](_0xfa96('0x7c'),_0x3f1fa2);throw _0x3f1fa2;});}return _0x2de53c;})[_0xfa96('0x27')](respondWithResult(_0x52cfe4,null))[_0xfa96('0x4c')](handleError(_0x52cfe4,null));});_0x74ed7c[_0xfa96('0x7d')]();}catch(_0x2d8f0e){_0x52cfe4[_0xfa96('0x1f')](0x1f4)[_0xfa96('0x65')](_0x2d8f0e);}};exports[_0xfa96('0x7e')]=function(_0x2fe8d6,_0x240e0f,_0x4a82e0){return db[_0xfa96('0x31')][_0xfa96('0x4b')]({'where':{'id':_0x2fe8d6[_0xfa96('0x49')]['id']}})[_0xfa96('0x27')](handleEntityNotFound(_0x240e0f,null))[_0xfa96('0x27')](saveUpdates(_[_0xfa96('0x40')](_0x2fe8d6[_0xfa96('0x74')],[_0xfa96('0x2e'),_0xfa96('0x7f')]),null))[_0xfa96('0x27')](respondWithResult(_0x240e0f,null))[_0xfa96('0x4c')](handleError(_0x240e0f,null));};exports[_0xfa96('0x80')]=function(_0x3110b9,_0x5bb516,_0x453d4a){return db[_0xfa96('0x31')][_0xfa96('0x4b')]({'where':{'id':_0x3110b9[_0xfa96('0x49')]['id']}})['then'](function(_0x223937){if(_0x223937){return _0x223937[_0xfa96('0x28')]();}})[_0xfa96('0x27')](function(_0x39d70b){var _0x16999e=path[_0xfa96('0x51')](config[_0xfa96('0x52')],_0xfa96('0x5e'),util[_0xfa96('0x54')](_0xfa96('0x55'),_0x39d70b['save_name'],_0x39d70b[_0xfa96('0x81')]));var _0x4d153b=path[_0xfa96('0x51')](config['root'],'server/files/sounds/converted',util[_0xfa96('0x54')](_0xfa96('0x55'),_0x39d70b[_0xfa96('0x4e')],_0x39d70b[_0xfa96('0x56')]));fs[_0xfa96('0x64')](_0x16999e);fs[_0xfa96('0x64')](_0x4d153b);return _0x39d70b;})['then'](function(_0x4b6326){if(_0x4b6326){return _0x5bb516['status'](0xcc)['end']();}})[_0xfa96('0x27')](handleEntityNotFound(_0x5bb516,null))[_0xfa96('0x4c')](handleError(_0x5bb516,null));}; \ No newline at end of file +var _0x002c=['findAll','catch','show','params','keys','rawAttributes','find','download','converted_format','existsSync','join','root','save_name','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','file','originalname','filename','extname','substring','wav','server/files/sounds/converted','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_channelCount','sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Sound'];(function(_0x55e659,_0x233aa4){var _0xca08c7=function(_0xe1c5b0){while(--_0xe1c5b0){_0x55e659['push'](_0x55e659['shift']());}};_0xca08c7(++_0x233aa4);}(_0x002c,0x1c0));var _0xc002=function(_0x3184a0,_0x3de9bb){_0x3184a0=_0x3184a0-0x0;var _0x30f781=_0x002c[_0x3184a0];return _0x30f781;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc002('0x0'));var zipdir=require(_0xc002('0x1'));var jsonpatch=require(_0xc002('0x2'));var rp=require(_0xc002('0x3'));var moment=require('moment');var BPromise=require(_0xc002('0x4'));var Mustache=require(_0xc002('0x5'));var util=require(_0xc002('0x6'));var path=require(_0xc002('0x7'));var sox=require(_0xc002('0x8'));var csv=require(_0xc002('0x9'));var ejs=require(_0xc002('0xa'));var fs=require('fs');var fs_extra=require(_0xc002('0xb'));var _=require(_0xc002('0xc'));var squel=require('squel');var crypto=require(_0xc002('0xd'));var jsforce=require(_0xc002('0xe'));var deskjs=require(_0xc002('0xf'));var toCsv=require(_0xc002('0x9'));var querystring=require(_0xc002('0x10'));var Papa=require(_0xc002('0x11'));var Redis=require('ioredis');var authService=require(_0xc002('0x12'));var qs=require(_0xc002('0x13'));var as=require(_0xc002('0x14'));var hardwareService=require(_0xc002('0x15'));var logger=require('../../config/logger')(_0xc002('0x16'));var utils=require(_0xc002('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc002('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b90d2,_0x353dcb){_0x353dcb=_0x353dcb||0xcc;return function(_0xcc085e){if(_0xcc085e){return _0x4b90d2[_0xc002('0x19')](_0x353dcb);}return _0x4b90d2[_0xc002('0x1a')](_0x353dcb)[_0xc002('0x1b')]();};}function respondWithResult(_0x2bb714,_0x13762f){_0x13762f=_0x13762f||0xc8;return function(_0x3a52cd){if(_0x3a52cd){return _0x2bb714[_0xc002('0x1a')](_0x13762f)[_0xc002('0x1c')](_0x3a52cd);}};}function respondWithFilteredResult(_0x457c17,_0x51bb78){return function(_0x38befd){if(_0x38befd){var _0x15c14f=typeof _0x51bb78[_0xc002('0x1d')]===_0xc002('0x1e')&&typeof _0x51bb78[_0xc002('0x1f')]===_0xc002('0x1e');var _0x494d35=_0x38befd[_0xc002('0x20')];var _0x83509a=_0x15c14f?0x0:_0x51bb78[_0xc002('0x1d')];var _0x513eb0=_0x15c14f?_0x38befd[_0xc002('0x20')]:_0x51bb78['offset']+_0x51bb78['limit'];var _0x1d73b5;if(_0x513eb0>=_0x494d35){_0x513eb0=_0x494d35;_0x1d73b5=0xc8;}else{_0x1d73b5=0xce;}_0x457c17[_0xc002('0x1a')](_0x1d73b5);return _0x457c17[_0xc002('0x21')](_0xc002('0x22'),_0x83509a+'-'+_0x513eb0+'/'+_0x494d35)[_0xc002('0x1c')](_0x38befd);}return null;};}function patchUpdates(_0x32bf31){return function(_0x313dd4){try{jsonpatch[_0xc002('0x23')](_0x313dd4,_0x32bf31,!![]);}catch(_0x21e5cc){return BPromise[_0xc002('0x24')](_0x21e5cc);}return _0x313dd4[_0xc002('0x25')]();};}function saveUpdates(_0x14b0e3,_0x1d6a08){return function(_0x250fbb){if(_0x250fbb){return _0x250fbb[_0xc002('0x26')](_0x14b0e3)[_0xc002('0x27')](function(_0x454a2b){return _0x454a2b;});}return null;};}function removeEntity(_0x262113,_0x5c7b26){return function(_0x44521e){if(_0x44521e){return _0x44521e[_0xc002('0x28')]()[_0xc002('0x27')](function(){var _0x4641b1=_0x44521e[_0xc002('0x29')]({'plain':!![]});var _0xf89089='Sounds';return db[_0xc002('0x2a')][_0xc002('0x28')]({'where':{'type':_0xf89089,'resourceId':_0x4641b1['id']}})[_0xc002('0x27')](function(){return _0x44521e;});})[_0xc002('0x27')](function(){_0x262113[_0xc002('0x1a')](0xcc)[_0xc002('0x1b')]();});}};}function handleEntityNotFound(_0xf6d54d,_0xf5f91c){return function(_0x4dc305){if(!_0x4dc305){_0xf6d54d[_0xc002('0x19')](0x194);}return _0x4dc305;};}function handleError(_0x14f36,_0x53cfa4){_0x53cfa4=_0x53cfa4||0x1f4;return function(_0x262d4b){logger['error'](_0x262d4b[_0xc002('0x2b')]);if(_0x262d4b[_0xc002('0x2c')]){delete _0x262d4b[_0xc002('0x2c')];}_0x14f36[_0xc002('0x1a')](_0x53cfa4)['send'](_0x262d4b);};}exports[_0xc002('0x2d')]=function(_0x2a8f3d,_0x4e1057){var _0x5d3031={},_0x235acc={},_0x7efe11={'count':0x0,'rows':[]};var _0x4de6bc=_[_0xc002('0x2e')](db['Sound']['rawAttributes'],function(_0x412715){return{'name':_0x412715[_0xc002('0x2f')],'type':_0x412715[_0xc002('0x30')]['key']};});_0x235acc[_0xc002('0x31')]=_[_0xc002('0x2e')](_0x4de6bc,_0xc002('0x2c'));_0x235acc[_0xc002('0x32')]=_['keys'](_0x2a8f3d[_0xc002('0x32')]);_0x235acc[_0xc002('0x33')]=_[_0xc002('0x34')](_0x235acc[_0xc002('0x31')],_0x235acc[_0xc002('0x32')]);_0x5d3031[_0xc002('0x35')]=_['intersection'](_0x235acc[_0xc002('0x31')],qs['fields'](_0x2a8f3d[_0xc002('0x32')][_0xc002('0x36')]));_0x5d3031['attributes']=_0x5d3031[_0xc002('0x35')][_0xc002('0x37')]?_0x5d3031[_0xc002('0x35')]:_0x235acc[_0xc002('0x31')];if(!_0x2a8f3d['query'][_0xc002('0x38')](_0xc002('0x39'))){_0x5d3031['limit']=qs[_0xc002('0x1f')](_0x2a8f3d['query'][_0xc002('0x1f')]);_0x5d3031['offset']=qs[_0xc002('0x1d')](_0x2a8f3d[_0xc002('0x32')][_0xc002('0x1d')]);}_0x5d3031['order']=qs[_0xc002('0x3a')](_0x2a8f3d[_0xc002('0x32')]['sort']);_0x5d3031[_0xc002('0x3b')]=qs['filters'](_[_0xc002('0x3c')](_0x2a8f3d[_0xc002('0x32')],_0x235acc[_0xc002('0x33')]),_0x4de6bc);if(_0x2a8f3d[_0xc002('0x32')][_0xc002('0x3d')]){_0x5d3031[_0xc002('0x3b')]=_[_0xc002('0x3e')](_0x5d3031['where'],{'$or':_[_0xc002('0x2e')](_0x4de6bc,function(_0x220622){if(_0x220622['type']!==_0xc002('0x3f')){var _0x4aefad={};_0x4aefad[_0x220622[_0xc002('0x2c')]]={'$like':'%'+_0x2a8f3d[_0xc002('0x32')][_0xc002('0x3d')]+'%'};return _0x4aefad;}})});}_0x5d3031=_['merge']({},_0x5d3031,_0x2a8f3d[_0xc002('0x40')]);var _0x5db33f={'where':_0x5d3031[_0xc002('0x3b')]};return db['Sound'][_0xc002('0x20')](_0x5db33f)[_0xc002('0x27')](function(_0x19a392){_0x7efe11[_0xc002('0x20')]=_0x19a392;if(_0x2a8f3d[_0xc002('0x32')][_0xc002('0x41')]){_0x5d3031[_0xc002('0x42')]=[{'all':!![]}];}return db[_0xc002('0x43')][_0xc002('0x44')](_0x5d3031);})['then'](function(_0x415a92){_0x7efe11['rows']=_0x415a92;return _0x7efe11;})[_0xc002('0x27')](respondWithFilteredResult(_0x4e1057,_0x5d3031))[_0xc002('0x45')](handleError(_0x4e1057,null));};exports[_0xc002('0x46')]=function(_0x1b9c32,_0xb02237){var _0x316a44={'raw':!![],'where':{'id':_0x1b9c32[_0xc002('0x47')]['id']}},_0x44f802={};_0x44f802[_0xc002('0x31')]=_[_0xc002('0x48')](db[_0xc002('0x43')][_0xc002('0x49')]);_0x44f802[_0xc002('0x32')]=_['keys'](_0x1b9c32['query']);_0x44f802[_0xc002('0x33')]=_['intersection'](_0x44f802[_0xc002('0x31')],_0x44f802[_0xc002('0x32')]);_0x316a44[_0xc002('0x35')]=_[_0xc002('0x34')](_0x44f802[_0xc002('0x31')],qs[_0xc002('0x36')](_0x1b9c32['query']['fields']));_0x316a44[_0xc002('0x35')]=_0x316a44[_0xc002('0x35')][_0xc002('0x37')]?_0x316a44[_0xc002('0x35')]:_0x44f802[_0xc002('0x31')];if(_0x1b9c32[_0xc002('0x32')]['includeAll']){_0x316a44[_0xc002('0x42')]=[{'all':!![]}];}_0x316a44=_['merge']({},_0x316a44,_0x1b9c32['options']);return db[_0xc002('0x43')][_0xc002('0x4a')](_0x316a44)['then'](handleEntityNotFound(_0xb02237,null))[_0xc002('0x27')](respondWithResult(_0xb02237,null))[_0xc002('0x45')](handleError(_0xb02237,null));};exports[_0xc002('0x4b')]=function(_0x512996,_0x137021,_0x5bd7fc){return db[_0xc002('0x43')]['find']({'where':{'id':_0x512996['params']['id']},'attributes':['name','save_name',_0xc002('0x4c')],'raw':!![]})[_0xc002('0x27')](handleEntityNotFound(_0x137021,null))[_0xc002('0x27')](function(_0x536474){if(_0x536474){if(!fs[_0xc002('0x4d')](path[_0xc002('0x4e')](config[_0xc002('0x4f')],'server/files/sounds/converted',_0x536474[_0xc002('0x50')]+'.'+_0x536474['converted_format']))){throw new db[(_0xc002('0x51'))][(_0xc002('0x52'))](_0xc002('0x53'));}return _0x137021['download'](path[_0xc002('0x4e')](config['root'],'server/files/sounds/converted',util['format'](_0xc002('0x54'),_0x536474['save_name'],_0x536474[_0xc002('0x4c')])),util[_0xc002('0x55')](_0xc002('0x54'),_0x536474['name'],_0x536474[_0xc002('0x4c')]));}return null;})[_0xc002('0x45')](handleError(_0x137021,null));};exports[_0xc002('0x56')]=function(_0x329dee,_0x1c1c12,_0x30e9de){var _0x1111c3={'name':path['basename'](_0x329dee[_0xc002('0x57')][_0xc002('0x58')],path['extname'](_0x329dee[_0xc002('0x57')][_0xc002('0x58')])),'save_name':path['basename'](_0x329dee['file'][_0xc002('0x59')],path[_0xc002('0x5a')](_0x329dee[_0xc002('0x57')][_0xc002('0x59')])),'original_format':path['extname'](_0x329dee[_0xc002('0x57')][_0xc002('0x58')])[_0xc002('0x5b')](0x1),'converted_format':_0xc002('0x5c')};var _0x49d4d7=path['join'](config[_0xc002('0x4f')],'server/files/sounds/original',_0x329dee[_0xc002('0x57')][_0xc002('0x59')]);var _0x18f430=path['join'](config['root'],_0xc002('0x5d'),util[_0xc002('0x55')](_0xc002('0x54'),path['basename'](_0x329dee['file'][_0xc002('0x59')],path['extname'](_0x329dee[_0xc002('0x57')][_0xc002('0x59')])),_0x1111c3[_0xc002('0x4c')]));logger[_0xc002('0x5e')](_0xc002('0x5f'),_0x49d4d7);logger[_0xc002('0x5e')](_0xc002('0x60'),_0x18f430);try{fs[_0xc002('0x61')](_0x49d4d7,parseInt(_0xc002('0x62'),0x8));var _0x145e83=sox[_0xc002('0x63')](_0x49d4d7,_0x18f430,{'sampleRate':0x1f40,'format':_0xc002('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x145e83['on'](_0xc002('0x64'),function(_0x2c1c32){fs[_0xc002('0x65')](_0x49d4d7);_0x1c1c12[_0xc002('0x1a')](0x1f4)[_0xc002('0x66')](_0x2c1c32);});_0x145e83['on'](_0xc002('0x67'),function(_0x441adc){_0x1111c3[_0xc002('0x68')]=isNaN(_0x441adc[_0xc002('0x69')])?null:_0x441adc['duration']*0x3e8;_0x1111c3[_0xc002('0x6a')]=isNaN(_0x441adc[_0xc002('0x6b')])?null:_0x441adc[_0xc002('0x6b')];_0x1111c3[_0xc002('0x6c')]=isNaN(_0x441adc[_0xc002('0x6d')])?null:_0x441adc[_0xc002('0x6d')];_0x1111c3[_0xc002('0x6e')]=isNaN(_0x441adc[_0xc002('0x6f')])?null:_0x441adc[_0xc002('0x6f')];_0x1111c3[_0xc002('0x70')]=isNaN(_0x441adc['sampleRate'])?null:_0x441adc['sampleRate'];});_0x145e83['on'](_0xc002('0x71'),function(_0x5013d3){_0x1111c3['converted_duration']=isNaN(_0x5013d3[_0xc002('0x69')])?null:_0x5013d3['duration']*0x3e8;_0x1111c3['converted_sampleCount']=isNaN(_0x5013d3[_0xc002('0x6b')])?null:_0x5013d3['sampleCount'];_0x1111c3[_0xc002('0x72')]=isNaN(_0x5013d3['channelCount'])?null:_0x5013d3['channelCount'];_0x1111c3['converted_bitRate']=isNaN(_0x5013d3['bitRate'])?null:_0x5013d3[_0xc002('0x6f')];_0x1111c3['converted_sampleRate']=isNaN(_0x5013d3[_0xc002('0x73')])?null:_0x5013d3[_0xc002('0x73')];});_0x145e83['on'](_0xc002('0x1b'),function(){fs[_0xc002('0x61')](_0x18f430,parseInt(_0xc002('0x62'),0x8));return db[_0xc002('0x43')][_0xc002('0x56')](_0x1111c3)[_0xc002('0x27')](function(_0x57ad07){var _0x1d97e2={'role':_0x329dee[_0xc002('0x74')][_0xc002('0x75')],'userProfileId':_0x329dee[_0xc002('0x74')][_0xc002('0x76')]};if(!_0x1d97e2)throw new Error(_0xc002('0x77'));if(_0x1d97e2[_0xc002('0x75')]===_0xc002('0x78')){var _0x28d4ad=_0x57ad07[_0xc002('0x29')]({'plain':!![]});return db[_0xc002('0x79')][_0xc002('0x4a')]({'where':{'name':_0xc002('0x7a'),'userProfileId':_0x1d97e2[_0xc002('0x76')]},'raw':!![]})[_0xc002('0x27')](function(_0x4e2fb6){if(_0x4e2fb6&&_0x4e2fb6['autoAssociation']===0x0){return db[_0xc002('0x2a')][_0xc002('0x56')]({'name':_0x28d4ad['name'],'resourceId':_0x28d4ad['id'],'type':_0x4e2fb6[_0xc002('0x2c')],'sectionId':_0x4e2fb6['id']},{})[_0xc002('0x27')](function(){return _0x57ad07;});}else{return _0x57ad07;}})[_0xc002('0x45')](function(_0x2b45a1){logger[_0xc002('0x64')](_0xc002('0x7b'),_0x2b45a1);throw _0x2b45a1;});}return _0x57ad07;})[_0xc002('0x27')](respondWithResult(_0x1c1c12,null))['catch'](handleError(_0x1c1c12,null));});_0x145e83[_0xc002('0x7c')]();}catch(_0x3d8db5){_0x1c1c12[_0xc002('0x1a')](0x1f4)['send'](_0x3d8db5);}};exports[_0xc002('0x26')]=function(_0x480c9d,_0x415b3a,_0x298919){return db[_0xc002('0x43')][_0xc002('0x4a')]({'where':{'id':_0x480c9d['params']['id']}})[_0xc002('0x27')](handleEntityNotFound(_0x415b3a,null))[_0xc002('0x27')](saveUpdates(_[_0xc002('0x3c')](_0x480c9d['body'],[_0xc002('0x2c'),_0xc002('0x7d')]),null))[_0xc002('0x27')](respondWithResult(_0x415b3a,null))[_0xc002('0x45')](handleError(_0x415b3a,null));};exports[_0xc002('0x7e')]=function(_0xe0718a,_0x2fac62,_0x139096){return db[_0xc002('0x43')][_0xc002('0x4a')]({'where':{'id':_0xe0718a[_0xc002('0x47')]['id']}})[_0xc002('0x27')](function(_0xee596d){if(_0xee596d){return _0xee596d[_0xc002('0x28')]();}})['then'](function(_0x5c7ac8){var _0x1b6caa=path['join'](config[_0xc002('0x4f')],_0xc002('0x7f'),util[_0xc002('0x55')](_0xc002('0x54'),_0x5c7ac8[_0xc002('0x50')],_0x5c7ac8[_0xc002('0x80')]));var _0x251da1=path[_0xc002('0x4e')](config['root'],_0xc002('0x5d'),util[_0xc002('0x55')](_0xc002('0x54'),_0x5c7ac8[_0xc002('0x50')],_0x5c7ac8['converted_format']));fs[_0xc002('0x65')](_0x1b6caa);fs[_0xc002('0x65')](_0x251da1);return _0x5c7ac8;})[_0xc002('0x27')](function(_0x4b98f3){if(_0x4b98f3){return _0x2fac62[_0xc002('0x1a')](0xcc)[_0xc002('0x1b')]();}})['then'](handleEntityNotFound(_0x2fac62,null))[_0xc002('0x45')](handleError(_0x2fac62,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 98cb117..1e985d9 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 _0x1247=['bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds','lodash','api'];(function(_0x419de8,_0x3c21a4){var _0x3fd763=function(_0x537429){while(--_0x537429){_0x419de8['push'](_0x419de8['shift']());}};_0x3fd763(++_0x3c21a4);}(_0x1247,0xf0));var _0x7124=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x1247[_0x3bab09];return _0x164376;};'use strict';var _=require(_0x7124('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7124('0x1'));var moment=require('moment');var BPromise=require(_0x7124('0x2'));var rp=require(_0x7124('0x3'));var fs=require('fs');var path=require(_0x7124('0x4'));var rimraf=require(_0x7124('0x5'));var config=require(_0x7124('0x6'));var attributes=require(_0x7124('0x7'));module[_0x7124('0x8')]=function(_0x2f1ab2,_0x15d95e){return _0x2f1ab2['define'](_0x7124('0x9'),attributes,{'tableName':_0x7124('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4878=['Sound','lodash','util','../../config/logger','api','rimraf','./sound.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4878,0x160));var _0x8487=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4878[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x8487('0x0'));var util=require(_0x8487('0x1'));var logger=require(_0x8487('0x2'))(_0x8487('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8487('0x4'));var config=require('../../config/environment');var attributes=require(_0x8487('0x5'));module[_0x8487('0x6')]=function(_0x1b1fb7,_0x56f61d){return _0x1b1fb7[_0x8487('0x7')](_0x8487('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 262659b..9c819c3 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 _0xf9e4=['options','attributes','include','model','map','info','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Sound','find','raw'];(function(_0x1343e4,_0x339a61){var _0x508ee0=function(_0x310612){while(--_0x310612){_0x1343e4['push'](_0x1343e4['shift']());}};_0x508ee0(++_0x339a61);}(_0xf9e4,0x167));var _0x4f9e=function(_0x497c26,_0x22cf5f){_0x497c26=_0x497c26-0x0;var _0x261f4d=_0xf9e4[_0x497c26];return _0x261f4d;};'use strict';var _=require(_0x4f9e('0x0'));var util=require(_0x4f9e('0x1'));var moment=require(_0x4f9e('0x2'));var BPromise=require(_0x4f9e('0x3'));var rs=require(_0x4f9e('0x4'));var fs=require('fs');var Redis=require(_0x4f9e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f9e('0x6'));var logger=require(_0x4f9e('0x7'))(_0x4f9e('0x8'));var config=require(_0x4f9e('0x9'));var jayson=require(_0x4f9e('0xa'));var client=jayson['client'][_0x4f9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x559113,_0x101d68,_0x5c8c77){return new BPromise(function(_0x4f0af0,_0x1daade){return client[_0x4f9e('0xc')](_0x559113,_0x5c8c77)['then'](function(_0x2c3eb4){logger['info'](_0x4f9e('0xd'),_0x101d68,_0x4f9e('0xe'));logger[_0x4f9e('0xf')](_0x4f9e('0x10'),_0x101d68,_0x4f9e('0xe'),JSON[_0x4f9e('0x11')](_0x2c3eb4));if(_0x2c3eb4[_0x4f9e('0x12')]){if(_0x2c3eb4['error']['code']===0x1f4){logger[_0x4f9e('0x12')]('Sound,\x20%s,\x20%s',_0x101d68,_0x2c3eb4[_0x4f9e('0x12')][_0x4f9e('0x13')]);return _0x1daade(_0x2c3eb4[_0x4f9e('0x12')][_0x4f9e('0x13')]);}logger['error']('Sound,\x20%s,\x20%s',_0x101d68,_0x2c3eb4['error'][_0x4f9e('0x13')]);return _0x4f0af0(_0x2c3eb4[_0x4f9e('0x12')][_0x4f9e('0x13')]);}else{logger['info'](_0x4f9e('0xd'),_0x101d68,_0x4f9e('0xe'));_0x4f0af0(_0x2c3eb4[_0x4f9e('0x14')]['message']);}})[_0x4f9e('0x15')](function(_0x182a22){logger[_0x4f9e('0x12')](_0x4f9e('0xd'),_0x101d68,_0x182a22);_0x1daade(_0x182a22);});});}exports['ShowSound']=function(_0x3bb840){var _0x2e14d2=this;return new Promise(function(_0x21f367,_0x1f8387){return db[_0x4f9e('0x16')][_0x4f9e('0x17')]({'raw':_0x3bb840['options']?_0x3bb840['options'][_0x4f9e('0x18')]===undefined?!![]:![]:!![],'where':_0x3bb840[_0x4f9e('0x19')]?_0x3bb840[_0x4f9e('0x19')]['where']||null:null,'attributes':_0x3bb840[_0x4f9e('0x19')]?_0x3bb840['options'][_0x4f9e('0x1a')]||null:null,'include':_0x3bb840[_0x4f9e('0x19')]?_0x3bb840[_0x4f9e('0x19')][_0x4f9e('0x1b')]?_['map'](_0x3bb840[_0x4f9e('0x19')][_0x4f9e('0x1b')],function(_0x511363){return{'model':db[_0x511363[_0x4f9e('0x1c')]],'as':_0x511363['as'],'attributes':_0x511363['attributes'],'include':_0x511363[_0x4f9e('0x1b')]?_[_0x4f9e('0x1d')](_0x511363[_0x4f9e('0x1b')],function(_0x2f9120){return{'model':db[_0x2f9120[_0x4f9e('0x1c')]],'as':_0x2f9120['as'],'attributes':_0x2f9120[_0x4f9e('0x1a')],'include':_0x2f9120[_0x4f9e('0x1b')]?_['map'](_0x2f9120['include'],function(_0x1040e9){return{'model':db[_0x1040e9[_0x4f9e('0x1c')]],'as':_0x1040e9['as'],'attributes':_0x1040e9[_0x4f9e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1662fe){logger[_0x4f9e('0x1e')](_0x4f9e('0x1f'),_0x3bb840);logger['debug'](_0x4f9e('0x1f'),_0x3bb840,JSON[_0x4f9e('0x11')](_0x1662fe));_0x21f367(_0x1662fe);})['catch'](function(_0x26e6c5){logger[_0x4f9e('0x12')](_0x4f9e('0x1f'),_0x26e6c5[_0x4f9e('0x13')],_0x3bb840);_0x1f8387(_0x2e14d2['error'](0x1f4,_0x26e6c5[_0x4f9e('0x13')]));});});}; \ No newline at end of file +var _0xaf95=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSound','options','raw','where','attributes','include','map','model','then','stringify','moment','bluebird','randomstring','ioredis'];(function(_0x44c742,_0x5d69a4){var _0x40fcf0=function(_0x453d3c){while(--_0x453d3c){_0x44c742['push'](_0x44c742['shift']());}};_0x40fcf0(++_0x5d69a4);}(_0xaf95,0xaa));var _0x5af9=function(_0x2c32fb,_0x45b9a8){_0x2c32fb=_0x2c32fb-0x0;var _0x1f2836=_0xaf95[_0x2c32fb];return _0x1f2836;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5af9('0x0'));var BPromise=require(_0x5af9('0x1'));var rs=require(_0x5af9('0x2'));var fs=require('fs');var Redis=require(_0x5af9('0x3'));var db=require(_0x5af9('0x4'))['db'];var utils=require(_0x5af9('0x5'));var logger=require(_0x5af9('0x6'))(_0x5af9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5af9('0x8')][_0x5af9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fab0c,_0x46f563,_0x2efc83){return new BPromise(function(_0x2e8edc,_0x45b03f){return client['request'](_0x4fab0c,_0x2efc83)['then'](function(_0x4bc4e8){logger[_0x5af9('0xa')](_0x5af9('0xb'),_0x46f563,_0x5af9('0xc'));logger[_0x5af9('0xd')](_0x5af9('0xe'),_0x46f563,_0x5af9('0xc'),JSON['stringify'](_0x4bc4e8));if(_0x4bc4e8[_0x5af9('0xf')]){if(_0x4bc4e8['error'][_0x5af9('0x10')]===0x1f4){logger[_0x5af9('0xf')](_0x5af9('0xb'),_0x46f563,_0x4bc4e8[_0x5af9('0xf')][_0x5af9('0x11')]);return _0x45b03f(_0x4bc4e8[_0x5af9('0xf')][_0x5af9('0x11')]);}logger['error']('Sound,\x20%s,\x20%s',_0x46f563,_0x4bc4e8['error'][_0x5af9('0x11')]);return _0x2e8edc(_0x4bc4e8[_0x5af9('0xf')]['message']);}else{logger[_0x5af9('0xa')](_0x5af9('0xb'),_0x46f563,_0x5af9('0xc'));_0x2e8edc(_0x4bc4e8['result'][_0x5af9('0x11')]);}})[_0x5af9('0x12')](function(_0xcf6ed2){logger['error'](_0x5af9('0xb'),_0x46f563,_0xcf6ed2);_0x45b03f(_0xcf6ed2);});});}exports[_0x5af9('0x13')]=function(_0x17632d){var _0x446cd9=this;return new Promise(function(_0x54c64c,_0x1c5e9f){return db['Sound']['find']({'raw':_0x17632d[_0x5af9('0x14')]?_0x17632d[_0x5af9('0x14')][_0x5af9('0x15')]===undefined?!![]:![]:!![],'where':_0x17632d[_0x5af9('0x14')]?_0x17632d[_0x5af9('0x14')][_0x5af9('0x16')]||null:null,'attributes':_0x17632d[_0x5af9('0x14')]?_0x17632d['options'][_0x5af9('0x17')]||null:null,'include':_0x17632d[_0x5af9('0x14')]?_0x17632d[_0x5af9('0x14')][_0x5af9('0x18')]?_[_0x5af9('0x19')](_0x17632d[_0x5af9('0x14')][_0x5af9('0x18')],function(_0x43b922){return{'model':db[_0x43b922[_0x5af9('0x1a')]],'as':_0x43b922['as'],'attributes':_0x43b922[_0x5af9('0x17')],'include':_0x43b922['include']?_[_0x5af9('0x19')](_0x43b922[_0x5af9('0x18')],function(_0x364ba0){return{'model':db[_0x364ba0[_0x5af9('0x1a')]],'as':_0x364ba0['as'],'attributes':_0x364ba0[_0x5af9('0x17')],'include':_0x364ba0[_0x5af9('0x18')]?_[_0x5af9('0x19')](_0x364ba0[_0x5af9('0x18')],function(_0x14e3d2){return{'model':db[_0x14e3d2[_0x5af9('0x1a')]],'as':_0x14e3d2['as'],'attributes':_0x14e3d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5af9('0x1b')](function(_0x3a3a03){logger[_0x5af9('0xa')](_0x5af9('0x13'),_0x17632d);logger[_0x5af9('0xd')](_0x5af9('0x13'),_0x17632d,JSON[_0x5af9('0x1c')](_0x3a3a03));_0x54c64c(_0x3a3a03);})[_0x5af9('0x12')](function(_0x3c5a2d){logger['error'](_0x5af9('0x13'),_0x3c5a2d[_0x5af9('0x11')],_0x17632d);_0x1c5e9f(_0x446cd9['error'](0x1f4,_0x3c5a2d[_0x5af9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 50d3c9e..ae6f9fb 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45777f,_0x3b8948){var _0x5e61b3=function(_0x2b4f67){while(--_0x2b4f67){_0x45777f['push'](_0x45777f['shift']());}};_0x5e61b3(++_0x3b8948);}(_0xb10b,0x12a));var _0xbb10=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xb10b[_0x54b283];return _0x2462b3;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x302265,_0x661193){var _0xedef6a=function(_0x439a27){while(--_0x439a27){_0x302265['push'](_0x302265['shift']());}};_0xedef6a(++_0x661193);}(_0xac4a,0x13f));var _0xaac4=function(_0x3b47ae,_0x5a4782){_0x3b47ae=_0x3b47ae-0x0;var _0x362719=_0xac4a[_0x3b47ae];return _0x362719;};'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['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d03ada4..fa0e068 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 _0xef39=['STRING','medium','out','TEXT','sequelize','exports'];(function(_0x2329bb,_0x29e3a8){var _0xcebd8d=function(_0x23aa7e){while(--_0x23aa7e){_0x2329bb['push'](_0x2329bb['shift']());}};_0xcebd8d(++_0x29e3a8);}(_0xef39,0x1cc));var _0x9ef3=function(_0x130682,_0x8ab784){_0x130682=_0x130682-0x0;var _0x110074=_0xef39[_0x130682];return _0x110074;};'use strict';var Sequelize=require(_0x9ef3('0x0'));module[_0x9ef3('0x1')]={'uniqueid':{'type':Sequelize[_0x9ef3('0x2')]},'body':{'type':Sequelize['TEXT'](_0x9ef3('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9ef3('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9ef3('0x5')]}}; \ No newline at end of file +var _0xf134=['medium','ENUM','out','sequelize','TEXT'];(function(_0x39fd42,_0x54d325){var _0x1671ee=function(_0x10028f){while(--_0x10028f){_0x39fd42['push'](_0x39fd42['shift']());}};_0x1671ee(++_0x54d325);}(_0xf134,0x1a2));var _0x4f13=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xf134[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0x4f13('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x4f13('0x1')](_0x4f13('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x4f13('0x3')]('in',_0x4f13('0x4')),'defaultValue':_0x4f13('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4f13('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 982012c..2930d36 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 _0x4b0f=['reject','save','update','destroy','then','error','stack','name','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','offset','count','Content-Range','apply'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0x4b0f,0xba));var _0xf4b0=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x4b0f[_0x24679e];return _0x291f21;};'use strict';var emlformat=require(_0xf4b0('0x0'));var rimraf=require(_0xf4b0('0x1'));var zipdir=require(_0xf4b0('0x2'));var jsonpatch=require(_0xf4b0('0x3'));var rp=require(_0xf4b0('0x4'));var moment=require('moment');var BPromise=require(_0xf4b0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf4b0('0x6'));var sox=require(_0xf4b0('0x7'));var csv=require(_0xf4b0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4b0('0x9'));var squel=require(_0xf4b0('0xa'));var crypto=require(_0xf4b0('0xb'));var jsforce=require(_0xf4b0('0xc'));var deskjs=require(_0xf4b0('0xd'));var toCsv=require(_0xf4b0('0x8'));var querystring=require(_0xf4b0('0xe'));var Papa=require(_0xf4b0('0xf'));var Redis=require('ioredis');var authService=require(_0xf4b0('0x10'));var qs=require(_0xf4b0('0x11'));var as=require(_0xf4b0('0x12'));var hardwareService=require(_0xf4b0('0x13'));var logger=require(_0xf4b0('0x14'))(_0xf4b0('0x15'));var utils=require(_0xf4b0('0x16'));var config=require(_0xf4b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16fb6f,_0x5849fd){_0x5849fd=_0x5849fd||0xcc;return function(_0x3d58a5){if(_0x3d58a5){return _0x16fb6f[_0xf4b0('0x18')](_0x5849fd);}return _0x16fb6f[_0xf4b0('0x19')](_0x5849fd)[_0xf4b0('0x1a')]();};}function respondWithResult(_0x478d3e,_0xf6faa2){_0xf6faa2=_0xf6faa2||0xc8;return function(_0x13f82f){if(_0x13f82f){return _0x478d3e[_0xf4b0('0x19')](_0xf6faa2)[_0xf4b0('0x1b')](_0x13f82f);}};}function respondWithFilteredResult(_0x15f527,_0x51789e){return function(_0x5e97a7){if(_0x5e97a7){var _0x2fb990=typeof _0x51789e['offset']==='undefined'&&typeof _0x51789e['limit']===_0xf4b0('0x1c');var _0x62f154=_0x5e97a7['count'];var _0x14c31d=_0x2fb990?0x0:_0x51789e[_0xf4b0('0x1d')];var _0x5c28da=_0x2fb990?_0x5e97a7[_0xf4b0('0x1e')]:_0x51789e[_0xf4b0('0x1d')]+_0x51789e['limit'];var _0x5b6553;if(_0x5c28da>=_0x62f154){_0x5c28da=_0x62f154;_0x5b6553=0xc8;}else{_0x5b6553=0xce;}_0x15f527['status'](_0x5b6553);return _0x15f527['set'](_0xf4b0('0x1f'),_0x14c31d+'-'+_0x5c28da+'/'+_0x62f154)[_0xf4b0('0x1b')](_0x5e97a7);}return null;};}function patchUpdates(_0x1b5cdc){return function(_0x317c18){try{jsonpatch[_0xf4b0('0x20')](_0x317c18,_0x1b5cdc,!![]);}catch(_0x2dd3c3){return BPromise[_0xf4b0('0x21')](_0x2dd3c3);}return _0x317c18[_0xf4b0('0x22')]();};}function saveUpdates(_0x12ea10,_0x4f3556){return function(_0x46bbba){if(_0x46bbba){return _0x46bbba[_0xf4b0('0x23')](_0x12ea10)['then'](function(_0x2a2bb3){return _0x2a2bb3;});}return null;};}function removeEntity(_0x420f7f,_0x113ef1){return function(_0x5999a3){if(_0x5999a3){return _0x5999a3[_0xf4b0('0x24')]()[_0xf4b0('0x25')](function(){_0x420f7f[_0xf4b0('0x19')](0xcc)[_0xf4b0('0x1a')]();});}};}function handleEntityNotFound(_0x46fb24,_0x4fde7f){return function(_0x58ae68){if(!_0x58ae68){_0x46fb24[_0xf4b0('0x18')](0x194);}return _0x58ae68;};}function handleError(_0x5aa1d5,_0x25c22f){_0x25c22f=_0x25c22f||0x1f4;return function(_0x499d6c){logger[_0xf4b0('0x26')](_0x499d6c[_0xf4b0('0x27')]);if(_0x499d6c[_0xf4b0('0x28')]){delete _0x499d6c['name'];}_0x5aa1d5[_0xf4b0('0x19')](_0x25c22f)['send'](_0x499d6c);};}exports['index']=function(_0x2190d2,_0x2aeafb){var _0x536c0f={},_0x124348={},_0x184cf8={'count':0x0,'rows':[]};var _0x2d7e90=_[_0xf4b0('0x29')](db[_0xf4b0('0x2a')][_0xf4b0('0x2b')],function(_0x24cbf5){return{'name':_0x24cbf5[_0xf4b0('0x2c')],'type':_0x24cbf5['type'][_0xf4b0('0x2d')]};});_0x124348[_0xf4b0('0x2e')]=_[_0xf4b0('0x29')](_0x2d7e90,_0xf4b0('0x28'));_0x124348[_0xf4b0('0x2f')]=_[_0xf4b0('0x30')](_0x2190d2[_0xf4b0('0x2f')]);_0x124348[_0xf4b0('0x31')]=_[_0xf4b0('0x32')](_0x124348[_0xf4b0('0x2e')],_0x124348[_0xf4b0('0x2f')]);_0x536c0f[_0xf4b0('0x33')]=_['intersection'](_0x124348[_0xf4b0('0x2e')],qs[_0xf4b0('0x34')](_0x2190d2[_0xf4b0('0x2f')][_0xf4b0('0x34')]));_0x536c0f[_0xf4b0('0x33')]=_0x536c0f[_0xf4b0('0x33')][_0xf4b0('0x35')]?_0x536c0f[_0xf4b0('0x33')]:_0x124348[_0xf4b0('0x2e')];if(!_0x2190d2[_0xf4b0('0x2f')][_0xf4b0('0x36')]('nolimit')){_0x536c0f[_0xf4b0('0x37')]=qs[_0xf4b0('0x37')](_0x2190d2[_0xf4b0('0x2f')]['limit']);_0x536c0f[_0xf4b0('0x1d')]=qs[_0xf4b0('0x1d')](_0x2190d2[_0xf4b0('0x2f')]['offset']);}_0x536c0f[_0xf4b0('0x38')]=qs[_0xf4b0('0x39')](_0x2190d2['query'][_0xf4b0('0x39')]);_0x536c0f[_0xf4b0('0x3a')]=qs['filters'](_['pick'](_0x2190d2[_0xf4b0('0x2f')],_0x124348[_0xf4b0('0x31')]),_0x2d7e90);if(_0x2190d2['query'][_0xf4b0('0x3b')]){_0x536c0f[_0xf4b0('0x3a')]=_[_0xf4b0('0x3c')](_0x536c0f[_0xf4b0('0x3a')],{'$or':_['map'](_0x2d7e90,function(_0x575110){if(_0x575110['type']!==_0xf4b0('0x3d')){var _0x594e65={};_0x594e65[_0x575110['name']]={'$like':'%'+_0x2190d2[_0xf4b0('0x2f')][_0xf4b0('0x3b')]+'%'};return _0x594e65;}})});}_0x536c0f=_[_0xf4b0('0x3c')]({},_0x536c0f,_0x2190d2['options']);var _0x20b902={'where':_0x536c0f[_0xf4b0('0x3a')]};return db[_0xf4b0('0x2a')]['count'](_0x20b902)[_0xf4b0('0x25')](function(_0x21cb29){_0x184cf8[_0xf4b0('0x1e')]=_0x21cb29;if(_0x2190d2[_0xf4b0('0x2f')][_0xf4b0('0x3e')]){_0x536c0f[_0xf4b0('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0xf4b0('0x40')](_0x536c0f);})[_0xf4b0('0x25')](function(_0x537a95){_0x184cf8[_0xf4b0('0x41')]=_0x537a95;return _0x184cf8;})[_0xf4b0('0x25')](respondWithFilteredResult(_0x2aeafb,_0x536c0f))[_0xf4b0('0x42')](handleError(_0x2aeafb,null));};exports[_0xf4b0('0x43')]=function(_0x228d06,_0x1ff8ef){var _0xb9d239={'raw':!![],'where':{'id':_0x228d06[_0xf4b0('0x44')]['id']}},_0x47a691={};_0x47a691[_0xf4b0('0x2e')]=_[_0xf4b0('0x30')](db[_0xf4b0('0x2a')][_0xf4b0('0x2b')]);_0x47a691['query']=_[_0xf4b0('0x30')](_0x228d06[_0xf4b0('0x2f')]);_0x47a691[_0xf4b0('0x31')]=_[_0xf4b0('0x32')](_0x47a691[_0xf4b0('0x2e')],_0x47a691[_0xf4b0('0x2f')]);_0xb9d239[_0xf4b0('0x33')]=_['intersection'](_0x47a691[_0xf4b0('0x2e')],qs[_0xf4b0('0x34')](_0x228d06[_0xf4b0('0x2f')][_0xf4b0('0x34')]));_0xb9d239['attributes']=_0xb9d239[_0xf4b0('0x33')][_0xf4b0('0x35')]?_0xb9d239[_0xf4b0('0x33')]:_0x47a691[_0xf4b0('0x2e')];if(_0x228d06['query'][_0xf4b0('0x3e')]){_0xb9d239[_0xf4b0('0x3f')]=[{'all':!![]}];}_0xb9d239=_[_0xf4b0('0x3c')]({},_0xb9d239,_0x228d06[_0xf4b0('0x45')]);return db[_0xf4b0('0x2a')][_0xf4b0('0x46')](_0xb9d239)[_0xf4b0('0x25')](handleEntityNotFound(_0x1ff8ef,null))[_0xf4b0('0x25')](respondWithResult(_0x1ff8ef,null))[_0xf4b0('0x42')](handleError(_0x1ff8ef,null));};exports[_0xf4b0('0x47')]=function(_0x306d7d,_0x3caf35){return db['SquareMessage'][_0xf4b0('0x47')](_0x306d7d[_0xf4b0('0x48')],{})['then'](respondWithResult(_0x3caf35,0xc9))['catch'](handleError(_0x3caf35,null));};exports[_0xf4b0('0x23')]=function(_0x565e0a,_0x47da2b){if(_0x565e0a[_0xf4b0('0x48')]['id']){delete _0x565e0a['body']['id'];}return db[_0xf4b0('0x2a')][_0xf4b0('0x46')]({'where':{'id':_0x565e0a[_0xf4b0('0x44')]['id']}})[_0xf4b0('0x25')](handleEntityNotFound(_0x47da2b,null))['then'](saveUpdates(_0x565e0a[_0xf4b0('0x48')],null))[_0xf4b0('0x25')](respondWithResult(_0x47da2b,null))['catch'](handleError(_0x47da2b,null));};exports[_0xf4b0('0x24')]=function(_0x5c824e,_0x4d05c4){return db['SquareMessage'][_0xf4b0('0x46')]({'where':{'id':_0x5c824e['params']['id']}})[_0xf4b0('0x25')](handleEntityNotFound(_0x4d05c4,null))[_0xf4b0('0x25')](removeEntity(_0x4d05c4,null))[_0xf4b0('0x42')](handleError(_0x4d05c4,null));}; \ No newline at end of file +var _0xcad5=['rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','name','includeAll','findAll','rows','catch','params','keys','include','options','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','SquareMessage'];(function(_0x1f788e,_0x6307c1){var _0x5d0ae1=function(_0x415d02){while(--_0x415d02){_0x1f788e['push'](_0x1f788e['shift']());}};_0x5d0ae1(++_0x6307c1);}(_0xcad5,0x1cf));var _0x5cad=function(_0x68ae32,_0x537674){_0x68ae32=_0x68ae32-0x0;var _0x28c18d=_0xcad5[_0x68ae32];return _0x28c18d;};'use strict';var emlformat=require(_0x5cad('0x0'));var rimraf=require(_0x5cad('0x1'));var zipdir=require(_0x5cad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cad('0x3'));var moment=require(_0x5cad('0x4'));var BPromise=require(_0x5cad('0x5'));var Mustache=require(_0x5cad('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5cad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cad('0x8'));var squel=require(_0x5cad('0x9'));var crypto=require(_0x5cad('0xa'));var jsforce=require(_0x5cad('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5cad('0xc'));var Papa=require(_0x5cad('0xd'));var Redis=require(_0x5cad('0xe'));var authService=require(_0x5cad('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5cad('0x10'));var utils=require(_0x5cad('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5cad('0x12'));var db=require(_0x5cad('0x13'))['db'];function respondWithStatusCode(_0x614fa9,_0xba2132){_0xba2132=_0xba2132||0xcc;return function(_0x13e1c5){if(_0x13e1c5){return _0x614fa9[_0x5cad('0x14')](_0xba2132);}return _0x614fa9[_0x5cad('0x15')](_0xba2132)[_0x5cad('0x16')]();};}function respondWithResult(_0x55d99c,_0x437633){_0x437633=_0x437633||0xc8;return function(_0x39e549){if(_0x39e549){return _0x55d99c[_0x5cad('0x15')](_0x437633)[_0x5cad('0x17')](_0x39e549);}};}function respondWithFilteredResult(_0x125ddc,_0x26eec5){return function(_0x46f7bf){if(_0x46f7bf){var _0x343623=typeof _0x26eec5[_0x5cad('0x18')]===_0x5cad('0x19')&&typeof _0x26eec5[_0x5cad('0x1a')]==='undefined';var _0x313166=_0x46f7bf[_0x5cad('0x1b')];var _0x21853e=_0x343623?0x0:_0x26eec5[_0x5cad('0x18')];var _0x18cf06=_0x343623?_0x46f7bf['count']:_0x26eec5[_0x5cad('0x18')]+_0x26eec5['limit'];var _0x104d01;if(_0x18cf06>=_0x313166){_0x18cf06=_0x313166;_0x104d01=0xc8;}else{_0x104d01=0xce;}_0x125ddc[_0x5cad('0x15')](_0x104d01);return _0x125ddc['set'](_0x5cad('0x1c'),_0x21853e+'-'+_0x18cf06+'/'+_0x313166)[_0x5cad('0x17')](_0x46f7bf);}return null;};}function patchUpdates(_0x3f6dc4){return function(_0x108aee){try{jsonpatch[_0x5cad('0x1d')](_0x108aee,_0x3f6dc4,!![]);}catch(_0x308939){return BPromise[_0x5cad('0x1e')](_0x308939);}return _0x108aee[_0x5cad('0x1f')]();};}function saveUpdates(_0x244b71,_0x4f55c7){return function(_0x5523af){if(_0x5523af){return _0x5523af[_0x5cad('0x20')](_0x244b71)['then'](function(_0x32ccdd){return _0x32ccdd;});}return null;};}function removeEntity(_0x25e145,_0x18df3c){return function(_0x3080dd){if(_0x3080dd){return _0x3080dd[_0x5cad('0x21')]()[_0x5cad('0x22')](function(){_0x25e145[_0x5cad('0x15')](0xcc)[_0x5cad('0x16')]();});}};}function handleEntityNotFound(_0x356c73,_0x34e398){return function(_0x125755){if(!_0x125755){_0x356c73[_0x5cad('0x14')](0x194);}return _0x125755;};}function handleError(_0x119e02,_0xaecd71){_0xaecd71=_0xaecd71||0x1f4;return function(_0x4fa905){logger[_0x5cad('0x23')](_0x4fa905[_0x5cad('0x24')]);if(_0x4fa905['name']){delete _0x4fa905['name'];}_0x119e02['status'](_0xaecd71)[_0x5cad('0x25')](_0x4fa905);};}exports[_0x5cad('0x26')]=function(_0x27c27d,_0x1f7597){var _0x40a70d={},_0x35a4cb={},_0x311dbc={'count':0x0,'rows':[]};var _0x5d1da5=_[_0x5cad('0x27')](db[_0x5cad('0x28')][_0x5cad('0x29')],function(_0x2b1aac){return{'name':_0x2b1aac[_0x5cad('0x2a')],'type':_0x2b1aac['type'][_0x5cad('0x2b')]};});_0x35a4cb[_0x5cad('0x2c')]=_[_0x5cad('0x27')](_0x5d1da5,'name');_0x35a4cb[_0x5cad('0x2d')]=_['keys'](_0x27c27d[_0x5cad('0x2d')]);_0x35a4cb['filters']=_[_0x5cad('0x2e')](_0x35a4cb[_0x5cad('0x2c')],_0x35a4cb[_0x5cad('0x2d')]);_0x40a70d[_0x5cad('0x2f')]=_[_0x5cad('0x2e')](_0x35a4cb[_0x5cad('0x2c')],qs[_0x5cad('0x30')](_0x27c27d['query'][_0x5cad('0x30')]));_0x40a70d['attributes']=_0x40a70d[_0x5cad('0x2f')][_0x5cad('0x31')]?_0x40a70d[_0x5cad('0x2f')]:_0x35a4cb[_0x5cad('0x2c')];if(!_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x32')](_0x5cad('0x33'))){_0x40a70d[_0x5cad('0x1a')]=qs[_0x5cad('0x1a')](_0x27c27d[_0x5cad('0x2d')]['limit']);_0x40a70d[_0x5cad('0x18')]=qs['offset'](_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x18')]);}_0x40a70d[_0x5cad('0x34')]=qs[_0x5cad('0x35')](_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x35')]);_0x40a70d[_0x5cad('0x36')]=qs[_0x5cad('0x37')](_[_0x5cad('0x38')](_0x27c27d[_0x5cad('0x2d')],_0x35a4cb[_0x5cad('0x37')]),_0x5d1da5);if(_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x39')]){_0x40a70d['where']=_[_0x5cad('0x3a')](_0x40a70d['where'],{'$or':_['map'](_0x5d1da5,function(_0x5a21e1){if(_0x5a21e1[_0x5cad('0x3b')]!==_0x5cad('0x3c')){var _0x51a81c={};_0x51a81c[_0x5a21e1[_0x5cad('0x3d')]]={'$like':'%'+_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x39')]+'%'};return _0x51a81c;}})});}_0x40a70d=_[_0x5cad('0x3a')]({},_0x40a70d,_0x27c27d['options']);var _0x257062={'where':_0x40a70d[_0x5cad('0x36')]};return db[_0x5cad('0x28')]['count'](_0x257062)[_0x5cad('0x22')](function(_0xb1e3f9){_0x311dbc[_0x5cad('0x1b')]=_0xb1e3f9;if(_0x27c27d['query'][_0x5cad('0x3e')]){_0x40a70d['include']=[{'all':!![]}];}return db[_0x5cad('0x28')][_0x5cad('0x3f')](_0x40a70d);})[_0x5cad('0x22')](function(_0xb8c97){_0x311dbc[_0x5cad('0x40')]=_0xb8c97;return _0x311dbc;})[_0x5cad('0x22')](respondWithFilteredResult(_0x1f7597,_0x40a70d))[_0x5cad('0x41')](handleError(_0x1f7597,null));};exports['show']=function(_0x219ca3,_0x2bac1e){var _0x424cb6={'raw':!![],'where':{'id':_0x219ca3[_0x5cad('0x42')]['id']}},_0x316300={};_0x316300[_0x5cad('0x2c')]=_['keys'](db[_0x5cad('0x28')][_0x5cad('0x29')]);_0x316300[_0x5cad('0x2d')]=_[_0x5cad('0x43')](_0x219ca3[_0x5cad('0x2d')]);_0x316300['filters']=_[_0x5cad('0x2e')](_0x316300[_0x5cad('0x2c')],_0x316300[_0x5cad('0x2d')]);_0x424cb6[_0x5cad('0x2f')]=_[_0x5cad('0x2e')](_0x316300[_0x5cad('0x2c')],qs[_0x5cad('0x30')](_0x219ca3['query'][_0x5cad('0x30')]));_0x424cb6[_0x5cad('0x2f')]=_0x424cb6[_0x5cad('0x2f')][_0x5cad('0x31')]?_0x424cb6[_0x5cad('0x2f')]:_0x316300['model'];if(_0x219ca3[_0x5cad('0x2d')][_0x5cad('0x3e')]){_0x424cb6[_0x5cad('0x44')]=[{'all':!![]}];}_0x424cb6=_['merge']({},_0x424cb6,_0x219ca3[_0x5cad('0x45')]);return db['SquareMessage']['find'](_0x424cb6)['then'](handleEntityNotFound(_0x2bac1e,null))['then'](respondWithResult(_0x2bac1e,null))[_0x5cad('0x41')](handleError(_0x2bac1e,null));};exports['create']=function(_0x1efc57,_0x33ea29){return db[_0x5cad('0x28')]['create'](_0x1efc57[_0x5cad('0x46')],{})[_0x5cad('0x22')](respondWithResult(_0x33ea29,0xc9))[_0x5cad('0x41')](handleError(_0x33ea29,null));};exports['update']=function(_0x11d9ff,_0x50094b){if(_0x11d9ff[_0x5cad('0x46')]['id']){delete _0x11d9ff['body']['id'];}return db[_0x5cad('0x28')]['find']({'where':{'id':_0x11d9ff[_0x5cad('0x42')]['id']}})[_0x5cad('0x22')](handleEntityNotFound(_0x50094b,null))[_0x5cad('0x22')](saveUpdates(_0x11d9ff['body'],null))[_0x5cad('0x22')](respondWithResult(_0x50094b,null))['catch'](handleError(_0x50094b,null));};exports[_0x5cad('0x21')]=function(_0xa8ebdc,_0x44716f){return db['SquareMessage'][_0x5cad('0x47')]({'where':{'id':_0xa8ebdc[_0x5cad('0x42')]['id']}})[_0x5cad('0x22')](handleEntityNotFound(_0x44716f,null))[_0x5cad('0x22')](removeEntity(_0x44716f,null))[_0x5cad('0x41')](handleError(_0x44716f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5972e7a..b9282cd 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 _0x3e2e=['./squareMessage.attributes','SquareMessage','square_messages','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3e0aac,_0x187611){var _0x379a2e=function(_0xa57cf1){while(--_0xa57cf1){_0x3e0aac['push'](_0x3e0aac['shift']());}};_0x379a2e(++_0x187611);}(_0x3e2e,0x7c));var _0xe3e2=function(_0x3bec73,_0x1aceb2){_0x3bec73=_0x3bec73-0x0;var _0x191fcf=_0x3e2e[_0x3bec73];return _0x191fcf;};'use strict';var _=require(_0xe3e2('0x0'));var util=require(_0xe3e2('0x1'));var logger=require(_0xe3e2('0x2'))(_0xe3e2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3e2('0x4'));var fs=require('fs');var path=require(_0xe3e2('0x5'));var rimraf=require(_0xe3e2('0x6'));var config=require(_0xe3e2('0x7'));var attributes=require(_0xe3e2('0x8'));module['exports']=function(_0x43ee89,_0x5478d9){return _0x43ee89['define'](_0xe3e2('0x9'),attributes,{'tableName':_0xe3e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4412=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','util'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x4412,0x102));var _0x2441=function(_0x4e6b5e,_0x17b2f1){_0x4e6b5e=_0x4e6b5e-0x0;var _0x4c9460=_0x4412[_0x4e6b5e];return _0x4c9460;};'use strict';var _=require(_0x2441('0x0'));var util=require(_0x2441('0x1'));var logger=require(_0x2441('0x2'))(_0x2441('0x3'));var moment=require(_0x2441('0x4'));var BPromise=require(_0x2441('0x5'));var rp=require(_0x2441('0x6'));var fs=require('fs');var path=require(_0x2441('0x7'));var rimraf=require('rimraf');var config=require(_0x2441('0x8'));var attributes=require(_0x2441('0x9'));module[_0x2441('0xa')]=function(_0x57bd50,_0x5d63e9){return _0x57bd50[_0x2441('0xb')]('SquareMessage',attributes,{'tableName':_0x2441('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index bcba283..bac292e 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 _0x6592=['client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x6592,0x1de));var _0x2659=function(_0x41fc67,_0x578bed){_0x41fc67=_0x41fc67-0x0;var _0x54c03a=_0x6592[_0x41fc67];return _0x54c03a;};'use strict';var _=require(_0x2659('0x0'));var util=require(_0x2659('0x1'));var moment=require('moment');var BPromise=require(_0x2659('0x2'));var rs=require(_0x2659('0x3'));var fs=require('fs');var Redis=require(_0x2659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2659('0x5'));var logger=require(_0x2659('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2659('0x7'));var client=jayson[_0x2659('0x8')][_0x2659('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4625c3,_0x36cc2e,_0x35c49a){return new BPromise(function(_0x4bd961,_0x4ffe99){return client[_0x2659('0xa')](_0x4625c3,_0x35c49a)[_0x2659('0xb')](function(_0x27863c){logger[_0x2659('0xc')](_0x2659('0xd'),_0x36cc2e,'request\x20sent');logger['debug'](_0x2659('0xe'),_0x36cc2e,_0x2659('0xf'),JSON[_0x2659('0x10')](_0x27863c));if(_0x27863c[_0x2659('0x11')]){if(_0x27863c[_0x2659('0x11')][_0x2659('0x12')]===0x1f4){logger[_0x2659('0x11')](_0x2659('0xd'),_0x36cc2e,_0x27863c[_0x2659('0x11')][_0x2659('0x13')]);return _0x4ffe99(_0x27863c[_0x2659('0x11')][_0x2659('0x13')]);}logger[_0x2659('0x11')](_0x2659('0xd'),_0x36cc2e,_0x27863c[_0x2659('0x11')][_0x2659('0x13')]);return _0x4bd961(_0x27863c['error']['message']);}else{logger[_0x2659('0xc')]('SquareMessage,\x20%s,\x20%s',_0x36cc2e,_0x2659('0xf'));_0x4bd961(_0x27863c[_0x2659('0x14')][_0x2659('0x13')]);}})[_0x2659('0x15')](function(_0x325655){logger[_0x2659('0x11')]('SquareMessage,\x20%s,\x20%s',_0x36cc2e,_0x325655);_0x4ffe99(_0x325655);});});}exports[_0x2659('0x16')]=function(_0x236f74){var _0x205966=this;return new Promise(function(_0x2e6a80,_0x2ed3a9){return db[_0x2659('0x17')][_0x2659('0x18')](_0x236f74['body'],{'raw':_0x236f74[_0x2659('0x19')]?_0x236f74[_0x2659('0x19')][_0x2659('0x1a')]===undefined?!![]:![]:!![]})[_0x2659('0xb')](function(_0x13f763){logger[_0x2659('0xc')]('CreateSquareMessage',_0x236f74);logger['debug']('CreateSquareMessage',_0x236f74,JSON[_0x2659('0x10')](_0x13f763));_0x2e6a80(_0x13f763);})[_0x2659('0x15')](function(_0x4df913){logger['error']('CreateSquareMessage',_0x4df913[_0x2659('0x13')],_0x236f74);_0x2ed3a9(_0x205966['error'](0x1f4,_0x4df913[_0x2659('0x13')]));});});}; \ No newline at end of file +var _0xceee=['request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','create','options','raw','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','SquareMessage,\x20%s,\x20%s'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xceee,0xa3));var _0xecee=function(_0x2dcc57,_0x436a7f){_0x2dcc57=_0x2dcc57-0x0;var _0x5adb28=_0xceee[_0x2dcc57];return _0x5adb28;};'use strict';var _=require(_0xecee('0x0'));var util=require('util');var moment=require(_0xecee('0x1'));var BPromise=require(_0xecee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecee('0x3'));var db=require(_0xecee('0x4'))['db'];var utils=require(_0xecee('0x5'));var logger=require('../../config/logger')(_0xecee('0x6'));var config=require(_0xecee('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xecee('0x8')][_0xecee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56900b,_0x351ffb,_0x103fb9){return new BPromise(function(_0xb78c4b,_0x2faf30){return client['request'](_0x56900b,_0x103fb9)['then'](function(_0x5817ff){logger[_0xecee('0xa')](_0xecee('0xb'),_0x351ffb,_0xecee('0xc'));logger[_0xecee('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x351ffb,'request\x20sent',JSON[_0xecee('0xe')](_0x5817ff));if(_0x5817ff['error']){if(_0x5817ff[_0xecee('0xf')][_0xecee('0x10')]===0x1f4){logger[_0xecee('0xf')]('SquareMessage,\x20%s,\x20%s',_0x351ffb,_0x5817ff[_0xecee('0xf')][_0xecee('0x11')]);return _0x2faf30(_0x5817ff['error'][_0xecee('0x11')]);}logger[_0xecee('0xf')](_0xecee('0xb'),_0x351ffb,_0x5817ff[_0xecee('0xf')][_0xecee('0x11')]);return _0xb78c4b(_0x5817ff['error']['message']);}else{logger[_0xecee('0xa')](_0xecee('0xb'),_0x351ffb,_0xecee('0xc'));_0xb78c4b(_0x5817ff[_0xecee('0x12')]['message']);}})[_0xecee('0x13')](function(_0xec1d32){logger[_0xecee('0xf')](_0xecee('0xb'),_0x351ffb,_0xec1d32);_0x2faf30(_0xec1d32);});});}exports[_0xecee('0x14')]=function(_0x10f05b){var _0x4bdd65=this;return new Promise(function(_0x2c8389,_0x17190c){return db['SquareMessage'][_0xecee('0x15')](_0x10f05b['body'],{'raw':_0x10f05b[_0xecee('0x16')]?_0x10f05b['options'][_0xecee('0x17')]===undefined?!![]:![]:!![]})[_0xecee('0x18')](function(_0x44e6a0){logger[_0xecee('0xa')](_0xecee('0x14'),_0x10f05b);logger[_0xecee('0xd')]('CreateSquareMessage',_0x10f05b,JSON[_0xecee('0xe')](_0x44e6a0));_0x2c8389(_0x44e6a0);})[_0xecee('0x13')](function(_0x93cc97){logger[_0xecee('0xf')](_0xecee('0x14'),_0x93cc97[_0xecee('0x11')],_0x10f05b);_0x17190c(_0x4bdd65[_0xecee('0xf')](0x1f4,_0x93cc97[_0xecee('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7e1ffa7..bcebf5f 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 _0x28ab=['isAuthenticated','index','/:id','/:id/test','test','put','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x449a05,_0x678c5a){var _0x59915e=function(_0x47a67c){while(--_0x47a67c){_0x449a05['push'](_0x449a05['shift']());}};_0x59915e(++_0x678c5a);}(_0x28ab,0xf6));var _0xb28a=function(_0x30e914,_0x22dafe){_0x30e914=_0x30e914-0x0;var _0x5c9421=_0x28ab[_0x30e914];return _0x5c9421;};'use strict';var multer=require('multer');var util=require(_0xb28a('0x0'));var path=require(_0xb28a('0x1'));var timeout=require(_0xb28a('0x2'));var express=require('express');var router=express[_0xb28a('0x3')]();var fs_extra=require(_0xb28a('0x4'));var auth=require(_0xb28a('0x5'));var interaction=require(_0xb28a('0x6'));var config=require(_0xb28a('0x7'));var controller=require('./squareOdbc.controller');router[_0xb28a('0x8')]('/',auth[_0xb28a('0x9')](),controller[_0xb28a('0xa')]);router[_0xb28a('0x8')](_0xb28a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb28a('0x8')](_0xb28a('0xc'),auth['isAuthenticated'](),timeout('15s'),controller[_0xb28a('0xd')]);router['post']('/',auth[_0xb28a('0x9')](),controller['create']);router[_0xb28a('0xe')](_0xb28a('0xb'),auth[_0xb28a('0x9')](),controller['update']);router[_0xb28a('0xf')](_0xb28a('0xb'),auth[_0xb28a('0x9')](),controller['destroy']);module[_0xb28a('0x10')]=router; \ No newline at end of file +var _0x24a6=['/:id','show','/:id/test','15s','test','post','create','put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated'];(function(_0x1b2161,_0x3d9f64){var _0x4e5851=function(_0x5aabe1){while(--_0x5aabe1){_0x1b2161['push'](_0x1b2161['shift']());}};_0x4e5851(++_0x3d9f64);}(_0x24a6,0x89));var _0x624a=function(_0x46e565,_0x5618e2){_0x46e565=_0x46e565-0x0;var _0xcc9452=_0x24a6[_0x46e565];return _0xcc9452;};'use strict';var multer=require(_0x624a('0x0'));var util=require(_0x624a('0x1'));var path=require(_0x624a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x624a('0x3'));var auth=require(_0x624a('0x4'));var interaction=require(_0x624a('0x5'));var config=require(_0x624a('0x6'));var controller=require(_0x624a('0x7'));router[_0x624a('0x8')]('/',auth[_0x624a('0x9')](),controller['index']);router[_0x624a('0x8')](_0x624a('0xa'),auth[_0x624a('0x9')](),controller[_0x624a('0xb')]);router['get'](_0x624a('0xc'),auth[_0x624a('0x9')](),timeout(_0x624a('0xd')),controller[_0x624a('0xe')]);router[_0x624a('0xf')]('/',auth['isAuthenticated'](),controller[_0x624a('0x10')]);router[_0x624a('0x11')](_0x624a('0xa'),auth[_0x624a('0x9')](),controller[_0x624a('0x12')]);router[_0x624a('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x624a('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 73b6e73..ad74c78 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 _0x6de6=['sequelize','exports','STRING','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6de6,0x64));var _0x66de=function(_0x290aa5,_0x201fcc){_0x290aa5=_0x290aa5-0x0;var _0x425aec=_0x6de6[_0x290aa5];return _0x425aec;};'use strict';var Sequelize=require(_0x66de('0x0'));module[_0x66de('0x1')]={'name':{'type':Sequelize[_0x66de('0x2')],'unique':_0x66de('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c08=['STRING','exports','name'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x9c08,0x1ba));var _0x89c0=function(_0x5f201e,_0x2d5e5b){_0x5f201e=_0x5f201e-0x0;var _0x958c7a=_0x9c08[_0x5f201e];return _0x958c7a;};'use strict';var Sequelize=require('sequelize');module[_0x89c0('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x89c0('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x89c0('0x2')]},'description':{'type':Sequelize[_0x89c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index ca256d0..34c97ef 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 _0x98f1=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','closeSync','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','get','ODBC','destroy','error','stack','name','send','index','map','SquareOdbc','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0x98f1,0x11d));var _0x198f=function(_0x57b90c,_0x36d5e8){_0x57b90c=_0x57b90c-0x0;var _0x15eefd=_0x98f1[_0x57b90c];return _0x15eefd;};'use strict';var emlformat=require(_0x198f('0x0'));var rimraf=require(_0x198f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x198f('0x2'));var BPromise=require(_0x198f('0x3'));var Mustache=require(_0x198f('0x4'));var util=require(_0x198f('0x5'));var path=require('path');var sox=require(_0x198f('0x6'));var csv=require(_0x198f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x198f('0x8'));var _=require(_0x198f('0x9'));var squel=require('squel');var crypto=require(_0x198f('0xa'));var jsforce=require(_0x198f('0xb'));var deskjs=require(_0x198f('0xc'));var toCsv=require(_0x198f('0x7'));var querystring=require('querystring');var Papa=require(_0x198f('0xd'));var Redis=require(_0x198f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x198f('0xf'));var hardwareService=require(_0x198f('0x10'));var logger=require('../../config/logger')(_0x198f('0x11'));var utils=require('../../config/utils');var config=require(_0x198f('0x12'));var licenseUtil=require(_0x198f('0x13'));var db=require(_0x198f('0x14'))['db'];function respondWithStatusCode(_0x17c418,_0x436e05){_0x436e05=_0x436e05||0xcc;return function(_0x5e3302){if(_0x5e3302){return _0x17c418[_0x198f('0x15')](_0x436e05);}return _0x17c418[_0x198f('0x16')](_0x436e05)[_0x198f('0x17')]();};}function respondWithResult(_0x9c9b00,_0x2068f7){_0x2068f7=_0x2068f7||0xc8;return function(_0x597c6b){if(_0x597c6b){return _0x9c9b00['status'](_0x2068f7)['json'](_0x597c6b);}};}function respondWithFilteredResult(_0x4df78a,_0x3d6029){return function(_0x103c59){if(_0x103c59){var _0x3721a3=typeof _0x3d6029[_0x198f('0x18')]===_0x198f('0x19')&&typeof _0x3d6029[_0x198f('0x1a')]==='undefined';var _0x160ea9=_0x103c59[_0x198f('0x1b')];var _0x5a6d4e=_0x3721a3?0x0:_0x3d6029[_0x198f('0x18')];var _0xbb25d=_0x3721a3?_0x103c59[_0x198f('0x1b')]:_0x3d6029[_0x198f('0x18')]+_0x3d6029[_0x198f('0x1a')];var _0x40131f;if(_0xbb25d>=_0x160ea9){_0xbb25d=_0x160ea9;_0x40131f=0xc8;}else{_0x40131f=0xce;}_0x4df78a[_0x198f('0x16')](_0x40131f);return _0x4df78a[_0x198f('0x1c')](_0x198f('0x1d'),_0x5a6d4e+'-'+_0xbb25d+'/'+_0x160ea9)[_0x198f('0x1e')](_0x103c59);}return null;};}function patchUpdates(_0x185c88){return function(_0x316d62){try{jsonpatch['apply'](_0x316d62,_0x185c88,!![]);}catch(_0x19b5e5){return BPromise[_0x198f('0x1f')](_0x19b5e5);}return _0x316d62[_0x198f('0x20')]();};}function saveUpdates(_0x15c157,_0xd8186c){return function(_0x2cc657){if(_0x2cc657){return _0x2cc657['update'](_0x15c157)[_0x198f('0x21')](function(_0x128e1c){return _0x128e1c;});}return null;};}function removeEntity(_0x47115f,_0x1a1c47){return function(_0x1e50c4){if(_0x1e50c4){return _0x1e50c4['destroy']()[_0x198f('0x21')](function(){var _0x4f7f70=_0x1e50c4[_0x198f('0x22')]({'plain':!![]});var _0x1cc0e1=_0x198f('0x23');return db['UserProfileResource'][_0x198f('0x24')]({'where':{'type':_0x1cc0e1,'resourceId':_0x4f7f70['id']}})[_0x198f('0x21')](function(){return _0x1e50c4;});})['then'](function(){_0x47115f[_0x198f('0x16')](0xcc)[_0x198f('0x17')]();});}};}function handleEntityNotFound(_0x21e4f2,_0x234a32){return function(_0x1be597){if(!_0x1be597){_0x21e4f2['sendStatus'](0x194);}return _0x1be597;};}function handleError(_0x54c355,_0x50c495){_0x50c495=_0x50c495||0x1f4;return function(_0x35a7bd){logger[_0x198f('0x25')](_0x35a7bd[_0x198f('0x26')]);if(_0x35a7bd[_0x198f('0x27')]){delete _0x35a7bd[_0x198f('0x27')];}_0x54c355[_0x198f('0x16')](_0x50c495)[_0x198f('0x28')](_0x35a7bd);};}exports[_0x198f('0x29')]=function(_0x2d1c14,_0x1ff775){var _0x3ae64d={},_0x2bc24a={},_0x512ccf={'count':0x0,'rows':[]};var _0x1ea539=_[_0x198f('0x2a')](db[_0x198f('0x2b')]['rawAttributes'],function(_0x520018){return{'name':_0x520018[_0x198f('0x2c')],'type':_0x520018['type'][_0x198f('0x2d')]};});_0x2bc24a[_0x198f('0x2e')]=_['map'](_0x1ea539,_0x198f('0x27'));_0x2bc24a[_0x198f('0x2f')]=_['keys'](_0x2d1c14['query']);_0x2bc24a[_0x198f('0x30')]=_[_0x198f('0x31')](_0x2bc24a[_0x198f('0x2e')],_0x2bc24a[_0x198f('0x2f')]);_0x3ae64d[_0x198f('0x32')]=_[_0x198f('0x31')](_0x2bc24a[_0x198f('0x2e')],qs['fields'](_0x2d1c14[_0x198f('0x2f')][_0x198f('0x33')]));_0x3ae64d[_0x198f('0x32')]=_0x3ae64d[_0x198f('0x32')]['length']?_0x3ae64d[_0x198f('0x32')]:_0x2bc24a[_0x198f('0x2e')];if(!_0x2d1c14[_0x198f('0x2f')][_0x198f('0x34')](_0x198f('0x35'))){_0x3ae64d['limit']=qs[_0x198f('0x1a')](_0x2d1c14['query'][_0x198f('0x1a')]);_0x3ae64d[_0x198f('0x18')]=qs[_0x198f('0x18')](_0x2d1c14[_0x198f('0x2f')][_0x198f('0x18')]);}_0x3ae64d[_0x198f('0x36')]=qs[_0x198f('0x37')](_0x2d1c14['query'][_0x198f('0x37')]);_0x3ae64d['where']=qs[_0x198f('0x30')](_[_0x198f('0x38')](_0x2d1c14[_0x198f('0x2f')],_0x2bc24a[_0x198f('0x30')]),_0x1ea539);if(_0x2d1c14['query'][_0x198f('0x39')]){_0x3ae64d[_0x198f('0x3a')]=_[_0x198f('0x3b')](_0x3ae64d['where'],{'$or':_['map'](_0x1ea539,function(_0x4071fc){if(_0x4071fc['type']!==_0x198f('0x3c')){var _0x19abb5={};_0x19abb5[_0x4071fc[_0x198f('0x27')]]={'$like':'%'+_0x2d1c14[_0x198f('0x2f')][_0x198f('0x39')]+'%'};return _0x19abb5;}})});}_0x3ae64d=_[_0x198f('0x3b')]({},_0x3ae64d,_0x2d1c14[_0x198f('0x3d')]);var _0x254687={'where':_0x3ae64d[_0x198f('0x3a')]};return db[_0x198f('0x2b')]['count'](_0x254687)[_0x198f('0x21')](function(_0xc2c294){_0x512ccf[_0x198f('0x1b')]=_0xc2c294;if(_0x2d1c14['query'][_0x198f('0x3e')]){_0x3ae64d[_0x198f('0x3f')]=[{'all':!![]}];}return db[_0x198f('0x2b')][_0x198f('0x40')](_0x3ae64d);})[_0x198f('0x21')](function(_0xeea6d3){_0x512ccf[_0x198f('0x41')]=_0xeea6d3;return _0x512ccf;})[_0x198f('0x21')](respondWithFilteredResult(_0x1ff775,_0x3ae64d))[_0x198f('0x42')](handleError(_0x1ff775,null));};exports['show']=function(_0x44fbb3,_0x5ff9d2){var _0xae67b={'raw':!![],'where':{'id':_0x44fbb3[_0x198f('0x43')]['id']}},_0x2292b4={};_0x2292b4['model']=_[_0x198f('0x44')](db[_0x198f('0x2b')][_0x198f('0x45')]);_0x2292b4[_0x198f('0x2f')]=_[_0x198f('0x44')](_0x44fbb3[_0x198f('0x2f')]);_0x2292b4['filters']=_['intersection'](_0x2292b4[_0x198f('0x2e')],_0x2292b4['query']);_0xae67b['attributes']=_[_0x198f('0x31')](_0x2292b4[_0x198f('0x2e')],qs['fields'](_0x44fbb3[_0x198f('0x2f')][_0x198f('0x33')]));_0xae67b[_0x198f('0x32')]=_0xae67b[_0x198f('0x32')][_0x198f('0x46')]?_0xae67b['attributes']:_0x2292b4['model'];if(_0x44fbb3['query']['includeAll']){_0xae67b[_0x198f('0x3f')]=[{'all':!![]}];}_0xae67b=_[_0x198f('0x3b')]({},_0xae67b,_0x44fbb3[_0x198f('0x3d')]);return db[_0x198f('0x2b')][_0x198f('0x47')](_0xae67b)[_0x198f('0x21')](handleEntityNotFound(_0x5ff9d2,null))[_0x198f('0x21')](respondWithResult(_0x5ff9d2,null))['catch'](handleError(_0x5ff9d2,null));};exports[_0x198f('0x48')]=function(_0xe02d0,_0x440907){return db[_0x198f('0x2b')][_0x198f('0x48')](_0xe02d0[_0x198f('0x49')],{})[_0x198f('0x21')](function(_0x1d5730){var _0xf326da=_0xe02d0[_0x198f('0x4a')][_0x198f('0x22')]({'plain':!![]});if(!_0xf326da)throw new Error(_0x198f('0x4b'));if(_0xf326da[_0x198f('0x4c')]==='user'){var _0x4b1277=_0x1d5730[_0x198f('0x22')]({'plain':!![]});var _0x24ddff='ODBC';return db[_0x198f('0x4d')]['find']({'where':{'name':_0x24ddff,'userProfileId':_0xf326da[_0x198f('0x4e')]},'raw':!![]})[_0x198f('0x21')](function(_0x138a70){if(_0x138a70&&_0x138a70[_0x198f('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b1277['name'],'resourceId':_0x4b1277['id'],'type':_0x138a70[_0x198f('0x27')],'sectionId':_0x138a70['id']},{})['then'](function(){return _0x1d5730;});}else{return _0x1d5730;}})[_0x198f('0x42')](function(_0x2f3c0a){logger[_0x198f('0x25')](_0x198f('0x50'),_0x2f3c0a);throw _0x2f3c0a;});}return _0x1d5730;})[_0x198f('0x21')](respondWithResult(_0x440907,0xc9))['catch'](handleError(_0x440907,null));};exports[_0x198f('0x51')]=function(_0x370143,_0x4e82b6){if(_0x370143[_0x198f('0x49')]['id']){delete _0x370143[_0x198f('0x49')]['id'];}return db[_0x198f('0x2b')][_0x198f('0x47')]({'where':{'id':_0x370143[_0x198f('0x43')]['id']}})[_0x198f('0x21')](handleEntityNotFound(_0x4e82b6,null))[_0x198f('0x21')](saveUpdates(_0x370143[_0x198f('0x49')],null))['then'](respondWithResult(_0x4e82b6,null))['catch'](handleError(_0x4e82b6,null));};exports[_0x198f('0x24')]=function(_0x353417,_0x33736a){return db[_0x198f('0x2b')][_0x198f('0x47')]({'where':{'id':_0x353417[_0x198f('0x43')]['id']}})[_0x198f('0x21')](handleEntityNotFound(_0x33736a,null))[_0x198f('0x21')](removeEntity(_0x33736a,null))[_0x198f('0x42')](handleError(_0x33736a,null));};exports[_0x198f('0x52')]=function(_0x177d6b,_0x197fe4,_0x5c02c6){var _0x362015;return db['SquareOdbc'][_0x198f('0x47')]({'where':{'id':_0x177d6b['params']['id']},'attributes':['id',_0x198f('0x53')]})[_0x198f('0x21')](handleEntityNotFound(_0x197fe4,null))[_0x198f('0x21')](function(_0x4f3206){if(_0x4f3206){var _0x4f8cd0=require(_0x198f('0x54'))();_0x4f8cd0['openSync'](_0x4f3206['dsn']);_0x4f8cd0[_0x198f('0x55')]();return _0x4f3206;}})[_0x198f('0x21')](respondWithResult(_0x197fe4,null))[_0x198f('0x42')](handleError(_0x197fe4,null));}; \ No newline at end of file +var _0xc9aa=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','offset','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','SquareOdbc','include','findAll','show','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','find','userProfileId'];(function(_0x51ce97,_0x2e869d){var _0x183bdb=function(_0x59be80){while(--_0x59be80){_0x51ce97['push'](_0x51ce97['shift']());}};_0x183bdb(++_0x2e869d);}(_0xc9aa,0x65));var _0xac9a=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0xc9aa[_0x595604];return _0x1466f3;};'use strict';var emlformat=require(_0xac9a('0x0'));var rimraf=require(_0xac9a('0x1'));var zipdir=require(_0xac9a('0x2'));var jsonpatch=require(_0xac9a('0x3'));var rp=require(_0xac9a('0x4'));var moment=require(_0xac9a('0x5'));var BPromise=require(_0xac9a('0x6'));var Mustache=require(_0xac9a('0x7'));var util=require('util');var path=require(_0xac9a('0x8'));var sox=require(_0xac9a('0x9'));var csv=require(_0xac9a('0xa'));var ejs=require(_0xac9a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac9a('0xc'));var crypto=require(_0xac9a('0xd'));var jsforce=require(_0xac9a('0xe'));var deskjs=require(_0xac9a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xac9a('0x10'));var Papa=require(_0xac9a('0x11'));var Redis=require(_0xac9a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xac9a('0x13'));var as=require(_0xac9a('0x14'));var hardwareService=require(_0xac9a('0x15'));var logger=require(_0xac9a('0x16'))(_0xac9a('0x17'));var utils=require('../../config/utils');var config=require(_0xac9a('0x18'));var licenseUtil=require(_0xac9a('0x19'));var db=require(_0xac9a('0x1a'))['db'];function respondWithStatusCode(_0x1c614e,_0x40c0fe){_0x40c0fe=_0x40c0fe||0xcc;return function(_0x442b3f){if(_0x442b3f){return _0x1c614e[_0xac9a('0x1b')](_0x40c0fe);}return _0x1c614e['status'](_0x40c0fe)[_0xac9a('0x1c')]();};}function respondWithResult(_0x3564f6,_0x377c6e){_0x377c6e=_0x377c6e||0xc8;return function(_0x5f3f47){if(_0x5f3f47){return _0x3564f6['status'](_0x377c6e)[_0xac9a('0x1d')](_0x5f3f47);}};}function respondWithFilteredResult(_0xb7f34a,_0x583d6e){return function(_0x4c69a2){if(_0x4c69a2){var _0xd1ba0e=typeof _0x583d6e['offset']==='undefined'&&typeof _0x583d6e[_0xac9a('0x1e')]===_0xac9a('0x1f');var _0x37cc9f=_0x4c69a2['count'];var _0x3a44c9=_0xd1ba0e?0x0:_0x583d6e[_0xac9a('0x20')];var _0x21940e=_0xd1ba0e?_0x4c69a2[_0xac9a('0x21')]:_0x583d6e[_0xac9a('0x20')]+_0x583d6e['limit'];var _0x372730;if(_0x21940e>=_0x37cc9f){_0x21940e=_0x37cc9f;_0x372730=0xc8;}else{_0x372730=0xce;}_0xb7f34a[_0xac9a('0x22')](_0x372730);return _0xb7f34a[_0xac9a('0x23')](_0xac9a('0x24'),_0x3a44c9+'-'+_0x21940e+'/'+_0x37cc9f)[_0xac9a('0x1d')](_0x4c69a2);}return null;};}function patchUpdates(_0x468833){return function(_0x565a22){try{jsonpatch[_0xac9a('0x25')](_0x565a22,_0x468833,!![]);}catch(_0x1889e4){return BPromise[_0xac9a('0x26')](_0x1889e4);}return _0x565a22[_0xac9a('0x27')]();};}function saveUpdates(_0x348a86,_0x4eb07e){return function(_0x1926e5){if(_0x1926e5){return _0x1926e5[_0xac9a('0x28')](_0x348a86)[_0xac9a('0x29')](function(_0xc03cfe){return _0xc03cfe;});}return null;};}function removeEntity(_0x3fbd02,_0x432a61){return function(_0xf7b84a){if(_0xf7b84a){return _0xf7b84a[_0xac9a('0x2a')]()[_0xac9a('0x29')](function(){var _0x145bb9=_0xf7b84a[_0xac9a('0x2b')]({'plain':!![]});var _0x2dde6e='ODBC';return db[_0xac9a('0x2c')][_0xac9a('0x2a')]({'where':{'type':_0x2dde6e,'resourceId':_0x145bb9['id']}})[_0xac9a('0x29')](function(){return _0xf7b84a;});})[_0xac9a('0x29')](function(){_0x3fbd02[_0xac9a('0x22')](0xcc)[_0xac9a('0x1c')]();});}};}function handleEntityNotFound(_0x1afa98,_0x461225){return function(_0x262255){if(!_0x262255){_0x1afa98[_0xac9a('0x1b')](0x194);}return _0x262255;};}function handleError(_0x492bfb,_0x4406f2){_0x4406f2=_0x4406f2||0x1f4;return function(_0x2fcc29){logger[_0xac9a('0x2d')](_0x2fcc29['stack']);if(_0x2fcc29[_0xac9a('0x2e')]){delete _0x2fcc29[_0xac9a('0x2e')];}_0x492bfb['status'](_0x4406f2)[_0xac9a('0x2f')](_0x2fcc29);};}exports[_0xac9a('0x30')]=function(_0x6fdc10,_0xe199ae){var _0x38a8af={},_0x33db44={},_0x2474e4={'count':0x0,'rows':[]};var _0x4cc71b=_[_0xac9a('0x31')](db['SquareOdbc'][_0xac9a('0x32')],function(_0x25e366){return{'name':_0x25e366[_0xac9a('0x33')],'type':_0x25e366[_0xac9a('0x34')][_0xac9a('0x35')]};});_0x33db44[_0xac9a('0x36')]=_[_0xac9a('0x31')](_0x4cc71b,_0xac9a('0x2e'));_0x33db44['query']=_[_0xac9a('0x37')](_0x6fdc10[_0xac9a('0x38')]);_0x33db44[_0xac9a('0x39')]=_[_0xac9a('0x3a')](_0x33db44['model'],_0x33db44['query']);_0x38a8af[_0xac9a('0x3b')]=_[_0xac9a('0x3a')](_0x33db44[_0xac9a('0x36')],qs[_0xac9a('0x3c')](_0x6fdc10['query'][_0xac9a('0x3c')]));_0x38a8af[_0xac9a('0x3b')]=_0x38a8af['attributes'][_0xac9a('0x3d')]?_0x38a8af[_0xac9a('0x3b')]:_0x33db44[_0xac9a('0x36')];if(!_0x6fdc10['query'][_0xac9a('0x3e')](_0xac9a('0x3f'))){_0x38a8af[_0xac9a('0x1e')]=qs[_0xac9a('0x1e')](_0x6fdc10[_0xac9a('0x38')][_0xac9a('0x1e')]);_0x38a8af[_0xac9a('0x20')]=qs[_0xac9a('0x20')](_0x6fdc10[_0xac9a('0x38')][_0xac9a('0x20')]);}_0x38a8af['order']=qs[_0xac9a('0x40')](_0x6fdc10[_0xac9a('0x38')]['sort']);_0x38a8af[_0xac9a('0x41')]=qs[_0xac9a('0x39')](_[_0xac9a('0x42')](_0x6fdc10[_0xac9a('0x38')],_0x33db44[_0xac9a('0x39')]),_0x4cc71b);if(_0x6fdc10[_0xac9a('0x38')][_0xac9a('0x43')]){_0x38a8af[_0xac9a('0x41')]=_['merge'](_0x38a8af[_0xac9a('0x41')],{'$or':_[_0xac9a('0x31')](_0x4cc71b,function(_0x389693){if(_0x389693[_0xac9a('0x34')]!=='VIRTUAL'){var _0x3af573={};_0x3af573[_0x389693['name']]={'$like':'%'+_0x6fdc10['query'][_0xac9a('0x43')]+'%'};return _0x3af573;}})});}_0x38a8af=_['merge']({},_0x38a8af,_0x6fdc10['options']);var _0x7b7139={'where':_0x38a8af[_0xac9a('0x41')]};return db[_0xac9a('0x44')][_0xac9a('0x21')](_0x7b7139)[_0xac9a('0x29')](function(_0x44cf01){_0x2474e4['count']=_0x44cf01;if(_0x6fdc10['query']['includeAll']){_0x38a8af[_0xac9a('0x45')]=[{'all':!![]}];}return db[_0xac9a('0x44')][_0xac9a('0x46')](_0x38a8af);})[_0xac9a('0x29')](function(_0x337086){_0x2474e4['rows']=_0x337086;return _0x2474e4;})[_0xac9a('0x29')](respondWithFilteredResult(_0xe199ae,_0x38a8af))['catch'](handleError(_0xe199ae,null));};exports[_0xac9a('0x47')]=function(_0x1591f6,_0x398a0a){var _0x34d634={'raw':!![],'where':{'id':_0x1591f6['params']['id']}},_0xd2d473={};_0xd2d473[_0xac9a('0x36')]=_['keys'](db['SquareOdbc'][_0xac9a('0x32')]);_0xd2d473[_0xac9a('0x38')]=_[_0xac9a('0x37')](_0x1591f6[_0xac9a('0x38')]);_0xd2d473['filters']=_[_0xac9a('0x3a')](_0xd2d473[_0xac9a('0x36')],_0xd2d473[_0xac9a('0x38')]);_0x34d634[_0xac9a('0x3b')]=_[_0xac9a('0x3a')](_0xd2d473[_0xac9a('0x36')],qs[_0xac9a('0x3c')](_0x1591f6[_0xac9a('0x38')][_0xac9a('0x3c')]));_0x34d634[_0xac9a('0x3b')]=_0x34d634[_0xac9a('0x3b')][_0xac9a('0x3d')]?_0x34d634['attributes']:_0xd2d473[_0xac9a('0x36')];if(_0x1591f6[_0xac9a('0x38')][_0xac9a('0x48')]){_0x34d634[_0xac9a('0x45')]=[{'all':!![]}];}_0x34d634=_[_0xac9a('0x49')]({},_0x34d634,_0x1591f6[_0xac9a('0x4a')]);return db['SquareOdbc']['find'](_0x34d634)[_0xac9a('0x29')](handleEntityNotFound(_0x398a0a,null))['then'](respondWithResult(_0x398a0a,null))[_0xac9a('0x4b')](handleError(_0x398a0a,null));};exports[_0xac9a('0x4c')]=function(_0x5b233d,_0x1f0177){return db['SquareOdbc'][_0xac9a('0x4c')](_0x5b233d[_0xac9a('0x4d')],{})[_0xac9a('0x29')](function(_0x2c1e7a){var _0x37a0ef=_0x5b233d[_0xac9a('0x4e')]['get']({'plain':!![]});if(!_0x37a0ef)throw new Error(_0xac9a('0x4f'));if(_0x37a0ef[_0xac9a('0x50')]===_0xac9a('0x4e')){var _0x13f0c0=_0x2c1e7a[_0xac9a('0x2b')]({'plain':!![]});var _0x4baeb3=_0xac9a('0x51');return db[_0xac9a('0x52')][_0xac9a('0x53')]({'where':{'name':_0x4baeb3,'userProfileId':_0x37a0ef[_0xac9a('0x54')]},'raw':!![]})['then'](function(_0x75742e){if(_0x75742e&&_0x75742e[_0xac9a('0x55')]===0x0){return db['UserProfileResource'][_0xac9a('0x4c')]({'name':_0x13f0c0[_0xac9a('0x2e')],'resourceId':_0x13f0c0['id'],'type':_0x75742e[_0xac9a('0x2e')],'sectionId':_0x75742e['id']},{})[_0xac9a('0x29')](function(){return _0x2c1e7a;});}else{return _0x2c1e7a;}})[_0xac9a('0x4b')](function(_0x4e6060){logger[_0xac9a('0x2d')](_0xac9a('0x56'),_0x4e6060);throw _0x4e6060;});}return _0x2c1e7a;})[_0xac9a('0x29')](respondWithResult(_0x1f0177,0xc9))['catch'](handleError(_0x1f0177,null));};exports[_0xac9a('0x28')]=function(_0x5ecb31,_0x6378bb){if(_0x5ecb31[_0xac9a('0x4d')]['id']){delete _0x5ecb31[_0xac9a('0x4d')]['id'];}return db[_0xac9a('0x44')][_0xac9a('0x53')]({'where':{'id':_0x5ecb31['params']['id']}})['then'](handleEntityNotFound(_0x6378bb,null))[_0xac9a('0x29')](saveUpdates(_0x5ecb31[_0xac9a('0x4d')],null))[_0xac9a('0x29')](respondWithResult(_0x6378bb,null))['catch'](handleError(_0x6378bb,null));};exports[_0xac9a('0x2a')]=function(_0x59ec07,_0x1ecca2){return db['SquareOdbc'][_0xac9a('0x53')]({'where':{'id':_0x59ec07[_0xac9a('0x57')]['id']}})[_0xac9a('0x29')](handleEntityNotFound(_0x1ecca2,null))[_0xac9a('0x29')](removeEntity(_0x1ecca2,null))[_0xac9a('0x4b')](handleError(_0x1ecca2,null));};exports[_0xac9a('0x58')]=function(_0x10424b,_0x51e3fb,_0x51b367){var _0xeed3c1;return db['SquareOdbc'][_0xac9a('0x53')]({'where':{'id':_0x10424b[_0xac9a('0x57')]['id']},'attributes':['id',_0xac9a('0x59')]})[_0xac9a('0x29')](handleEntityNotFound(_0x51e3fb,null))[_0xac9a('0x29')](function(_0x400c9c){if(_0x400c9c){var _0x2123e7=require(_0xac9a('0x5a'))();_0x2123e7[_0xac9a('0x5b')](_0x400c9c[_0xac9a('0x59')]);_0x2123e7[_0xac9a('0x5c')]();return _0x400c9c;}})[_0xac9a('0x29')](respondWithResult(_0x51e3fb,null))[_0xac9a('0x4b')](handleError(_0x51e3fb,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index eec6727..e710e2e 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 _0x8dbc=['request-promise','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird'];(function(_0x42e6d0,_0x43fbfd){var _0x390d30=function(_0x9be537){while(--_0x9be537){_0x42e6d0['push'](_0x42e6d0['shift']());}};_0x390d30(++_0x43fbfd);}(_0x8dbc,0x157));var _0xc8db=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x8dbc[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xc8db('0x0'));var util=require('util');var logger=require(_0xc8db('0x1'))(_0xc8db('0x2'));var moment=require(_0xc8db('0x3'));var BPromise=require(_0xc8db('0x4'));var rp=require(_0xc8db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8db('0x6'));var config=require(_0xc8db('0x7'));var attributes=require(_0xc8db('0x8'));module['exports']=function(_0x538462,_0x55573a){return _0x538462[_0xc8db('0x9')](_0xc8db('0xa'),attributes,{'tableName':_0xc8db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe29b=['moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api'];(function(_0x105e2f,_0x32f707){var _0x422a76=function(_0xe0841e){while(--_0xe0841e){_0x105e2f['push'](_0x105e2f['shift']());}};_0x422a76(++_0x32f707);}(_0xe29b,0x81));var _0xbe29=function(_0x5d2d1b,_0x340346){_0x5d2d1b=_0x5d2d1b-0x0;var _0x1a33a8=_0xe29b[_0x5d2d1b];return _0x1a33a8;};'use strict';var _=require('lodash');var util=require(_0xbe29('0x0'));var logger=require(_0xbe29('0x1'))(_0xbe29('0x2'));var moment=require(_0xbe29('0x3'));var BPromise=require(_0xbe29('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe29('0x5'));var rimraf=require(_0xbe29('0x6'));var config=require(_0xbe29('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xbe29('0x8')]=function(_0x1b8291,_0x3fc6fd){return _0x1b8291[_0xbe29('0x9')](_0xbe29('0xa'),attributes,{'tableName':_0xbe29('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 1f06d0f..706a900 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 _0xf501=['options','raw','attributes','include','model','map','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xf501,0xf6));var _0x1f50=function(_0x34ee01,_0x1e496a){_0x34ee01=_0x34ee01-0x0;var _0x40bfd9=_0xf501[_0x34ee01];return _0x40bfd9;};'use strict';var _=require(_0x1f50('0x0'));var util=require(_0x1f50('0x1'));var moment=require(_0x1f50('0x2'));var BPromise=require(_0x1f50('0x3'));var rs=require(_0x1f50('0x4'));var fs=require('fs');var Redis=require(_0x1f50('0x5'));var db=require(_0x1f50('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f50('0x7'))(_0x1f50('0x8'));var config=require(_0x1f50('0x9'));var jayson=require(_0x1f50('0xa'));var client=jayson[_0x1f50('0xb')][_0x1f50('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43385f,_0x492e66,_0x31b2a3){return new BPromise(function(_0x229910,_0x3ec950){return client[_0x1f50('0xd')](_0x43385f,_0x31b2a3)[_0x1f50('0xe')](function(_0x48ca68){logger[_0x1f50('0xf')](_0x1f50('0x10'),_0x492e66,_0x1f50('0x11'));logger['debug'](_0x1f50('0x12'),_0x492e66,_0x1f50('0x11'),JSON['stringify'](_0x48ca68));if(_0x48ca68['error']){if(_0x48ca68[_0x1f50('0x13')][_0x1f50('0x14')]===0x1f4){logger[_0x1f50('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x492e66,_0x48ca68[_0x1f50('0x13')][_0x1f50('0x15')]);return _0x3ec950(_0x48ca68[_0x1f50('0x13')]['message']);}logger['error'](_0x1f50('0x10'),_0x492e66,_0x48ca68[_0x1f50('0x13')][_0x1f50('0x15')]);return _0x229910(_0x48ca68['error']['message']);}else{logger[_0x1f50('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x492e66,_0x1f50('0x11'));_0x229910(_0x48ca68['result'][_0x1f50('0x15')]);}})[_0x1f50('0x16')](function(_0x52f716){logger[_0x1f50('0x13')](_0x1f50('0x10'),_0x492e66,_0x52f716);_0x3ec950(_0x52f716);});});}exports[_0x1f50('0x17')]=function(_0x4d7cbd){var _0x3195c6=this;return new Promise(function(_0x4a6e1c,_0x2ab1d9){return db[_0x1f50('0x18')][_0x1f50('0x19')]({'raw':_0x4d7cbd[_0x1f50('0x1a')]?_0x4d7cbd[_0x1f50('0x1a')][_0x1f50('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d7cbd[_0x1f50('0x1a')]?_0x4d7cbd['options']['where']||null:null,'attributes':_0x4d7cbd[_0x1f50('0x1a')]?_0x4d7cbd[_0x1f50('0x1a')][_0x1f50('0x1c')]||null:null,'include':_0x4d7cbd[_0x1f50('0x1a')]?_0x4d7cbd['options'][_0x1f50('0x1d')]?_['map'](_0x4d7cbd[_0x1f50('0x1a')][_0x1f50('0x1d')],function(_0x5bcbf0){return{'model':db[_0x5bcbf0[_0x1f50('0x1e')]],'as':_0x5bcbf0['as'],'attributes':_0x5bcbf0[_0x1f50('0x1c')],'include':_0x5bcbf0[_0x1f50('0x1d')]?_[_0x1f50('0x1f')](_0x5bcbf0[_0x1f50('0x1d')],function(_0x522c04){return{'model':db[_0x522c04[_0x1f50('0x1e')]],'as':_0x522c04['as'],'attributes':_0x522c04['attributes'],'include':_0x522c04[_0x1f50('0x1d')]?_[_0x1f50('0x1f')](_0x522c04['include'],function(_0x6467){return{'model':db[_0x6467['model']],'as':_0x6467['as'],'attributes':_0x6467[_0x1f50('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f852b){logger['info'](_0x1f50('0x17'),_0x4d7cbd);logger[_0x1f50('0x20')](_0x1f50('0x17'),_0x4d7cbd,JSON[_0x1f50('0x21')](_0x1f852b));_0x4a6e1c(_0x1f852b);})[_0x1f50('0x16')](function(_0x4dbc8b){logger[_0x1f50('0x13')]('ShowSquareOdbc',_0x4dbc8b[_0x1f50('0x15')],_0x4d7cbd);_0x2ab1d9(_0x3195c6['error'](0x1f4,_0x4dbc8b['message']));});});}; \ No newline at end of file +var _0x613e=['catch','util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','attributes','include','map','model'];(function(_0xe13ba4,_0x32a65b){var _0x3d4b8d=function(_0x259415){while(--_0x259415){_0xe13ba4['push'](_0xe13ba4['shift']());}};_0x3d4b8d(++_0x32a65b);}(_0x613e,0x1c1));var _0xe613=function(_0xd45c67,_0x5c59a4){_0xd45c67=_0xd45c67-0x0;var _0x341300=_0x613e[_0xd45c67];return _0x341300;};'use strict';var _=require('lodash');var util=require(_0xe613('0x0'));var moment=require('moment');var BPromise=require(_0xe613('0x1'));var rs=require(_0xe613('0x2'));var fs=require('fs');var Redis=require(_0xe613('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe613('0x4'));var config=require(_0xe613('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe613('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dcf1e,_0x4c239b,_0x3b694a){return new BPromise(function(_0x31c9a1,_0xea3469){return client[_0xe613('0x7')](_0x5dcf1e,_0x3b694a)[_0xe613('0x8')](function(_0x15f78b){logger[_0xe613('0x9')](_0xe613('0xa'),_0x4c239b,'request\x20sent');logger[_0xe613('0xb')](_0xe613('0xc'),_0x4c239b,_0xe613('0xd'),JSON[_0xe613('0xe')](_0x15f78b));if(_0x15f78b[_0xe613('0xf')]){if(_0x15f78b[_0xe613('0xf')][_0xe613('0x10')]===0x1f4){logger['error'](_0xe613('0xa'),_0x4c239b,_0x15f78b[_0xe613('0xf')][_0xe613('0x11')]);return _0xea3469(_0x15f78b[_0xe613('0xf')][_0xe613('0x11')]);}logger[_0xe613('0xf')](_0xe613('0xa'),_0x4c239b,_0x15f78b[_0xe613('0xf')][_0xe613('0x11')]);return _0x31c9a1(_0x15f78b['error'][_0xe613('0x11')]);}else{logger[_0xe613('0x9')](_0xe613('0xa'),_0x4c239b,'request\x20sent');_0x31c9a1(_0x15f78b[_0xe613('0x12')][_0xe613('0x11')]);}})['catch'](function(_0x33a83b){logger[_0xe613('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x4c239b,_0x33a83b);_0xea3469(_0x33a83b);});});}exports[_0xe613('0x13')]=function(_0x16f9e7){var _0x360f96=this;return new Promise(function(_0x3b9fc5,_0x249606){return db[_0xe613('0x14')][_0xe613('0x15')]({'raw':_0x16f9e7[_0xe613('0x16')]?_0x16f9e7[_0xe613('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x16f9e7[_0xe613('0x16')]?_0x16f9e7[_0xe613('0x16')]['where']||null:null,'attributes':_0x16f9e7[_0xe613('0x16')]?_0x16f9e7['options'][_0xe613('0x17')]||null:null,'include':_0x16f9e7[_0xe613('0x16')]?_0x16f9e7['options'][_0xe613('0x18')]?_[_0xe613('0x19')](_0x16f9e7['options'][_0xe613('0x18')],function(_0x5656e0){return{'model':db[_0x5656e0[_0xe613('0x1a')]],'as':_0x5656e0['as'],'attributes':_0x5656e0['attributes'],'include':_0x5656e0[_0xe613('0x18')]?_[_0xe613('0x19')](_0x5656e0[_0xe613('0x18')],function(_0x37300d){return{'model':db[_0x37300d[_0xe613('0x1a')]],'as':_0x37300d['as'],'attributes':_0x37300d['attributes'],'include':_0x37300d[_0xe613('0x18')]?_[_0xe613('0x19')](_0x37300d['include'],function(_0x26e24e){return{'model':db[_0x26e24e[_0xe613('0x1a')]],'as':_0x26e24e['as'],'attributes':_0x26e24e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe613('0x8')](function(_0xaddf7d){logger[_0xe613('0x9')](_0xe613('0x13'),_0x16f9e7);logger[_0xe613('0xb')](_0xe613('0x13'),_0x16f9e7,JSON[_0xe613('0xe')](_0xaddf7d));_0x3b9fc5(_0xaddf7d);})[_0xe613('0x1b')](function(_0x25610c){logger['error'](_0xe613('0x13'),_0x25610c[_0xe613('0x11')],_0x16f9e7);_0x249606(_0x360f96[_0xe613('0xf')](0x1f4,_0x25610c[_0xe613('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8123390..7c15c54 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 _0xde44=['addUsers','put','update','delete','/:id','destroy','removeUsers','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/users','getUsers','isAuthenticated','post'];(function(_0x42a3eb,_0x45b400){var _0x4d9114=function(_0x459ec5){while(--_0x459ec5){_0x42a3eb['push'](_0x42a3eb['shift']());}};_0x4d9114(++_0x45b400);}(_0xde44,0x160));var _0x4de4=function(_0x22a646,_0x2a83c4){_0x22a646=_0x22a646-0x0;var _0x4402ec=_0xde44[_0x22a646];return _0x4402ec;};'use strict';var multer=require(_0x4de4('0x0'));var util=require(_0x4de4('0x1'));var path=require(_0x4de4('0x2'));var timeout=require(_0x4de4('0x3'));var express=require('express');var router=express[_0x4de4('0x4')]();var fs_extra=require(_0x4de4('0x5'));var auth=require(_0x4de4('0x6'));var interaction=require(_0x4de4('0x7'));var config=require(_0x4de4('0x8'));var controller=require('./squareProject.controller');router[_0x4de4('0x9')]('/',auth['isAuthenticated'](),controller[_0x4de4('0xa')]);router[_0x4de4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4de4('0xb')]);router[_0x4de4('0x9')](_0x4de4('0xc'),auth['isAuthenticated'](),controller[_0x4de4('0xd')]);router['post']('/',auth[_0x4de4('0xe')](),controller['create']);router[_0x4de4('0xf')](_0x4de4('0xc'),auth['isAuthenticated'](),controller[_0x4de4('0x10')]);router[_0x4de4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4de4('0x12')]);router[_0x4de4('0x13')](_0x4de4('0x14'),auth['isAuthenticated'](),controller[_0x4de4('0x15')]);router[_0x4de4('0x13')](_0x4de4('0xc'),auth['isAuthenticated'](),controller[_0x4de4('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1527=['addUsers','delete','removeUsers','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','index','/:id','show','/:id/users','isAuthenticated','getUsers','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1527,0xc1));var _0x7152=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x1527[_0x1265ed];return _0x5ac459;};'use strict';var multer=require('multer');var util=require(_0x7152('0x0'));var path=require(_0x7152('0x1'));var timeout=require(_0x7152('0x2'));var express=require(_0x7152('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7152('0x4'));var interaction=require(_0x7152('0x5'));var config=require('../../config/environment');var controller=require(_0x7152('0x6'));router[_0x7152('0x7')]('/',auth['isAuthenticated'](),controller[_0x7152('0x8')]);router[_0x7152('0x7')](_0x7152('0x9'),auth['isAuthenticated'](),controller[_0x7152('0xa')]);router[_0x7152('0x7')](_0x7152('0xb'),auth[_0x7152('0xc')](),controller[_0x7152('0xd')]);router[_0x7152('0xe')]('/',auth['isAuthenticated'](),controller[_0x7152('0xf')]);router[_0x7152('0xe')](_0x7152('0xb'),auth[_0x7152('0xc')](),controller[_0x7152('0x10')]);router['put'](_0x7152('0x9'),auth[_0x7152('0xc')](),controller['update']);router[_0x7152('0x11')](_0x7152('0x9'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x7152('0xb'),auth[_0x7152('0xc')](),controller[_0x7152('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 53ed7f6..07d3ae7 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 _0x0ebd=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x0ebd,0xa9));var _0xd0eb=function(_0x5ae5d9,_0x2925a6){_0x5ae5d9=_0x5ae5d9-0x0;var _0xbbebfe=_0x0ebd[_0x5ae5d9];return _0xbbebfe;};'use strict';var Sequelize=require(_0xd0eb('0x0'));module[_0xd0eb('0x1')]={'name':{'type':Sequelize[_0xd0eb('0x2')],'unique':_0xd0eb('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xd0eb('0x2')]},'notes':{'type':Sequelize[_0xd0eb('0x4')]},'preproduction':{'type':Sequelize[_0xd0eb('0x5')](_0xd0eb('0x6')),'get':function(){if(this[_0xd0eb('0x7')]('preproduction')){return this['getDataValue'](_0xd0eb('0x8'))[_0xd0eb('0x9')](_0xd0eb('0xa'));}}},'production':{'type':Sequelize[_0xd0eb('0x5')](_0xd0eb('0x6')),'get':function(){if(this['getDataValue'](_0xd0eb('0xb'))){return this[_0xd0eb('0x7')]('production')[_0xd0eb('0x9')](_0xd0eb('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xd0eb('0xc')]}}; \ No newline at end of file +var _0xf42f=['TEXT','BLOB','getDataValue','utf8','long','production','toString','DATE','sequelize','exports','STRING','name'];(function(_0x17af7c,_0x366cfa){var _0x4c9d61=function(_0x5c0e5f){while(--_0x5c0e5f){_0x17af7c['push'](_0x17af7c['shift']());}};_0x4c9d61(++_0x366cfa);}(_0xf42f,0xbc));var _0xff42=function(_0x21a081,_0x588198){_0x21a081=_0x21a081-0x0;var _0x3ed98c=_0xf42f[_0x21a081];return _0x3ed98c;};'use strict';var Sequelize=require(_0xff42('0x0'));module[_0xff42('0x1')]={'name':{'type':Sequelize[_0xff42('0x2')],'unique':_0xff42('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xff42('0x4')]},'preproduction':{'type':Sequelize[_0xff42('0x5')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xff42('0x6')]('preproduction')['toString'](_0xff42('0x7'));}}},'production':{'type':Sequelize[_0xff42('0x5')](_0xff42('0x8')),'get':function(){if(this[_0xff42('0x6')](_0xff42('0x9'))){return this['getDataValue']('production')[_0xff42('0xa')](_0xff42('0x7'));}}},'savedAt':{'type':Sequelize[_0xff42('0xb')]},'publishedAt':{'type':Sequelize[_0xff42('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 85e5429..8c5c052 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 _0x8563=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','params','keys','include','find','create','body','user','userProfileId','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x8563,0x143));var _0x3856=function(_0x1fe1cc,_0x23d9cf){_0x1fe1cc=_0x1fe1cc-0x0;var _0x1611b9=_0x8563[_0x1fe1cc];return _0x1611b9;};'use strict';var emlformat=require(_0x3856('0x0'));var rimraf=require(_0x3856('0x1'));var zipdir=require(_0x3856('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3856('0x3'));var moment=require(_0x3856('0x4'));var BPromise=require(_0x3856('0x5'));var Mustache=require(_0x3856('0x6'));var util=require('util');var path=require(_0x3856('0x7'));var sox=require(_0x3856('0x8'));var csv=require(_0x3856('0x9'));var ejs=require(_0x3856('0xa'));var fs=require('fs');var fs_extra=require(_0x3856('0xb'));var _=require(_0x3856('0xc'));var squel=require(_0x3856('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3856('0x9'));var querystring=require(_0x3856('0xe'));var Papa=require(_0x3856('0xf'));var Redis=require(_0x3856('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3856('0x11'));var as=require(_0x3856('0x12'));var hardwareService=require(_0x3856('0x13'));var logger=require(_0x3856('0x14'))(_0x3856('0x15'));var utils=require(_0x3856('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3856('0x17'))['db'];config[_0x3856('0x18')]=_[_0x3856('0x19')](config['redis'],{'host':_0x3856('0x1a'),'port':0x18eb});var socket=require(_0x3856('0x1b'))(new Redis(config[_0x3856('0x18')]));require(_0x3856('0x1c'))[_0x3856('0x1d')](socket);function respondWithStatusCode(_0xc228a,_0x11986e){_0x11986e=_0x11986e||0xcc;return function(_0x1504ab){if(_0x1504ab){return _0xc228a[_0x3856('0x1e')](_0x11986e);}return _0xc228a['status'](_0x11986e)[_0x3856('0x1f')]();};}function respondWithResult(_0x5852f9,_0x2385fa){_0x2385fa=_0x2385fa||0xc8;return function(_0x41d2a6){if(_0x41d2a6){return _0x5852f9['status'](_0x2385fa)[_0x3856('0x20')](_0x41d2a6);}};}function respondWithFilteredResult(_0xffea45,_0x33ce87){return function(_0x4bebe9){if(_0x4bebe9){var _0x531f95=typeof _0x33ce87[_0x3856('0x21')]===_0x3856('0x22')&&typeof _0x33ce87[_0x3856('0x23')]==='undefined';var _0xa9f13c=_0x4bebe9[_0x3856('0x24')];var _0x3383c9=_0x531f95?0x0:_0x33ce87[_0x3856('0x21')];var _0x4a657c=_0x531f95?_0x4bebe9[_0x3856('0x24')]:_0x33ce87[_0x3856('0x21')]+_0x33ce87[_0x3856('0x23')];var _0x19282e;if(_0x4a657c>=_0xa9f13c){_0x4a657c=_0xa9f13c;_0x19282e=0xc8;}else{_0x19282e=0xce;}_0xffea45[_0x3856('0x25')](_0x19282e);return _0xffea45[_0x3856('0x26')](_0x3856('0x27'),_0x3383c9+'-'+_0x4a657c+'/'+_0xa9f13c)['json'](_0x4bebe9);}return null;};}function patchUpdates(_0x39b1e8){return function(_0x1684f4){try{jsonpatch[_0x3856('0x28')](_0x1684f4,_0x39b1e8,!![]);}catch(_0x3e7386){return BPromise['reject'](_0x3e7386);}return _0x1684f4[_0x3856('0x29')]();};}function saveUpdates(_0x258f05,_0x334db6){return function(_0x3f5fa2){if(_0x3f5fa2){return _0x3f5fa2[_0x3856('0x2a')](_0x258f05)[_0x3856('0x2b')](function(_0x5a132f){return _0x5a132f;});}return null;};}function removeEntity(_0x388715,_0x55a3f3){return function(_0x4d1be6){if(_0x4d1be6){return _0x4d1be6[_0x3856('0x2c')]()[_0x3856('0x2b')](function(){var _0x563625=_0x4d1be6[_0x3856('0x2d')]({'plain':!![]});var _0x8999cb=_0x3856('0x2e');return db[_0x3856('0x2f')][_0x3856('0x2c')]({'where':{'type':_0x8999cb,'resourceId':_0x563625['id']}})[_0x3856('0x2b')](function(){return _0x4d1be6;});})['then'](function(){_0x388715['status'](0xcc)[_0x3856('0x1f')]();});}};}function handleEntityNotFound(_0x560048,_0x4c0031){return function(_0x41dc89){if(!_0x41dc89){_0x560048['sendStatus'](0x194);}return _0x41dc89;};}function handleError(_0x41e231,_0x359680){_0x359680=_0x359680||0x1f4;return function(_0x18d63f){logger[_0x3856('0x30')](_0x18d63f[_0x3856('0x31')]);if(_0x18d63f[_0x3856('0x32')]){delete _0x18d63f[_0x3856('0x32')];}_0x41e231['status'](_0x359680)[_0x3856('0x33')](_0x18d63f);};}exports['index']=function(_0x56f832,_0x11bb35){var _0x294e67={},_0x516078={},_0x3f80d1={'count':0x0,'rows':[]};var _0x3af878=_[_0x3856('0x34')](db[_0x3856('0x35')][_0x3856('0x36')],function(_0x248ea6){return{'name':_0x248ea6[_0x3856('0x37')],'type':_0x248ea6[_0x3856('0x38')][_0x3856('0x39')]};});_0x516078[_0x3856('0x3a')]=_[_0x3856('0x34')](_0x3af878,'name');_0x516078[_0x3856('0x3b')]=_['keys'](_0x56f832['query']);_0x516078[_0x3856('0x3c')]=_[_0x3856('0x3d')](_0x516078[_0x3856('0x3a')],_0x516078[_0x3856('0x3b')]);_0x294e67[_0x3856('0x3e')]=_[_0x3856('0x3d')](_0x516078[_0x3856('0x3a')],qs[_0x3856('0x3f')](_0x56f832[_0x3856('0x3b')][_0x3856('0x3f')]));_0x294e67['attributes']=_0x294e67['attributes'][_0x3856('0x40')]?_0x294e67[_0x3856('0x3e')]:_0x516078[_0x3856('0x3a')];if(!_0x56f832[_0x3856('0x3b')][_0x3856('0x41')](_0x3856('0x42'))){_0x294e67['limit']=qs[_0x3856('0x23')](_0x56f832[_0x3856('0x3b')][_0x3856('0x23')]);_0x294e67[_0x3856('0x21')]=qs['offset'](_0x56f832[_0x3856('0x3b')][_0x3856('0x21')]);}_0x294e67['order']=qs[_0x3856('0x43')](_0x56f832[_0x3856('0x3b')][_0x3856('0x43')]);_0x294e67['where']=qs[_0x3856('0x3c')](_[_0x3856('0x44')](_0x56f832['query'],_0x516078[_0x3856('0x3c')]),_0x3af878);if(_0x56f832[_0x3856('0x3b')][_0x3856('0x45')]){_0x294e67['where']=_[_0x3856('0x46')](_0x294e67['where'],{'$or':_[_0x3856('0x34')](_0x3af878,function(_0x1545ed){if(_0x1545ed[_0x3856('0x38')]!==_0x3856('0x47')){var _0x5d8eed={};_0x5d8eed[_0x1545ed[_0x3856('0x32')]]={'$like':'%'+_0x56f832[_0x3856('0x3b')][_0x3856('0x45')]+'%'};return _0x5d8eed;}})});}_0x294e67=_[_0x3856('0x46')]({},_0x294e67,_0x56f832[_0x3856('0x48')]);var _0x3f0714={'where':_0x294e67[_0x3856('0x49')]};return db[_0x3856('0x35')]['count'](_0x3f0714)[_0x3856('0x2b')](function(_0x8cde64){_0x3f80d1['count']=_0x8cde64;if(_0x56f832[_0x3856('0x3b')][_0x3856('0x4a')]){_0x294e67['include']=[{'all':!![]}];}return db['SquareProject'][_0x3856('0x4b')](_0x294e67);})[_0x3856('0x2b')](function(_0x1bca73){_0x3f80d1[_0x3856('0x4c')]=_0x1bca73;return _0x3f80d1;})['then'](respondWithFilteredResult(_0x11bb35,_0x294e67))[_0x3856('0x4d')](handleError(_0x11bb35,null));};exports['show']=function(_0x3d8e6f,_0x5430fb){var _0x3967e9={'raw':![],'where':{'id':_0x3d8e6f[_0x3856('0x4e')]['id']}},_0x4a2259={};_0x4a2259[_0x3856('0x3a')]=_[_0x3856('0x4f')](db[_0x3856('0x35')][_0x3856('0x36')]);_0x4a2259[_0x3856('0x3b')]=_[_0x3856('0x4f')](_0x3d8e6f[_0x3856('0x3b')]);_0x4a2259['filters']=_[_0x3856('0x3d')](_0x4a2259[_0x3856('0x3a')],_0x4a2259['query']);_0x3967e9[_0x3856('0x3e')]=_[_0x3856('0x3d')](_0x4a2259[_0x3856('0x3a')],qs['fields'](_0x3d8e6f[_0x3856('0x3b')][_0x3856('0x3f')]));_0x3967e9[_0x3856('0x3e')]=_0x3967e9['attributes']['length']?_0x3967e9[_0x3856('0x3e')]:_0x4a2259['model'];if(_0x3d8e6f['query'][_0x3856('0x4a')]){_0x3967e9[_0x3856('0x50')]=[{'all':!![]}];}_0x3967e9=_[_0x3856('0x46')]({},_0x3967e9,_0x3d8e6f[_0x3856('0x48')]);return db[_0x3856('0x35')][_0x3856('0x51')](_0x3967e9)[_0x3856('0x2b')](handleEntityNotFound(_0x5430fb,null))[_0x3856('0x2b')](respondWithResult(_0x5430fb,null))[_0x3856('0x4d')](handleError(_0x5430fb,null));};exports[_0x3856('0x52')]=function(_0x254f93,_0xd30b34){return db['SquareProject'][_0x3856('0x52')](_0x254f93[_0x3856('0x53')],{})['then'](function(_0x36c276){var _0x34318b=_0x254f93[_0x3856('0x54')][_0x3856('0x2d')]({'plain':!![]});if(!_0x34318b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34318b['role']===_0x3856('0x54')){var _0x327f5a=_0x36c276['get']({'plain':!![]});var _0x17cd78=_0x3856('0x2e');return db['UserProfileSection'][_0x3856('0x51')]({'where':{'name':_0x17cd78,'userProfileId':_0x34318b[_0x3856('0x55')]},'raw':!![]})[_0x3856('0x2b')](function(_0x162e59){if(_0x162e59&&_0x162e59['autoAssociation']===0x0){return db[_0x3856('0x2f')]['create']({'name':_0x327f5a[_0x3856('0x32')],'resourceId':_0x327f5a['id'],'type':_0x162e59[_0x3856('0x32')],'sectionId':_0x162e59['id']},{})['then'](function(){return _0x36c276;});}else{return _0x36c276;}})['catch'](function(_0x2f34f0){logger[_0x3856('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f34f0);throw _0x2f34f0;});}return _0x36c276;})['then'](respondWithResult(_0xd30b34,0xc9))[_0x3856('0x4d')](handleError(_0xd30b34,null));};exports['update']=function(_0x3cfeef,_0x1a46ef){if(_0x3cfeef[_0x3856('0x53')]['id']){delete _0x3cfeef[_0x3856('0x53')]['id'];}return db[_0x3856('0x35')][_0x3856('0x51')]({'where':{'id':_0x3cfeef[_0x3856('0x4e')]['id']}})[_0x3856('0x2b')](handleEntityNotFound(_0x1a46ef,null))[_0x3856('0x2b')](saveUpdates(_0x3cfeef[_0x3856('0x53')],null))[_0x3856('0x2b')](respondWithResult(_0x1a46ef,null))[_0x3856('0x4d')](handleError(_0x1a46ef,null));};exports[_0x3856('0x2c')]=function(_0x14a567,_0x527028){return db[_0x3856('0x35')][_0x3856('0x51')]({'where':{'id':_0x14a567[_0x3856('0x4e')]['id']}})['then'](handleEntityNotFound(_0x527028,null))[_0x3856('0x2b')](removeEntity(_0x527028,null))[_0x3856('0x4d')](handleError(_0x527028,null));};exports[_0x3856('0x56')]=function(_0x1316c6,_0x512c4f,_0x56f041){return db['SquareProject'][_0x3856('0x51')]({'where':{'id':_0x1316c6[_0x3856('0x4e')]['id']}})[_0x3856('0x2b')](handleEntityNotFound(_0x512c4f,null))[_0x3856('0x2b')](function(_0x118b62){if(_0x118b62){return _0x118b62[_0x3856('0x56')](_0x1316c6['body'][_0x3856('0x57')],_[_0x3856('0x58')](_0x1316c6['body'],[_0x3856('0x57'),'id'])||{});}})[_0x3856('0x2b')](respondWithResult(_0x512c4f,null))[_0x3856('0x4d')](handleError(_0x512c4f,null));};exports[_0x3856('0x59')]=function(_0xc13fba,_0xba72e4,_0x400cd2){return db[_0x3856('0x35')][_0x3856('0x51')]({'where':{'id':_0xc13fba[_0x3856('0x4e')]['id']}})['then'](handleEntityNotFound(_0xba72e4,null))[_0x3856('0x2b')](function(_0x109d0f){if(_0x109d0f){return _0x109d0f['removeUsers'](_0xc13fba[_0x3856('0x3b')]['ids'])[_0x3856('0x2b')](function(){if(_[_0x3856('0x5a')](_0xc13fba['query'][_0x3856('0x57')])){for(var _0x541c74=0x0;_0x541c74<_0xc13fba[_0x3856('0x3b')][_0x3856('0x57')][_0x3856('0x40')];_0x541c74+=0x1){socket[_0x3856('0x5b')]('userSquareProject:remove',{'UserId':Number(_0xc13fba[_0x3856('0x3b')][_0x3856('0x57')][_0x541c74]),'SquareProjectId':Number(_0xc13fba[_0x3856('0x4e')]['id'])});}}else{socket[_0x3856('0x5b')](_0x3856('0x5c'),{'UserId':Number(_0xc13fba['query'][_0x3856('0x57')]),'SquareProjectId':Number(_0xc13fba['params']['id'])});}});}})[_0x3856('0x2b')](respondWithStatusCode(_0xba72e4,null))['catch'](handleError(_0xba72e4,null));};exports[_0x3856('0x5d')]=function(_0x542d64,_0x37a3e0,_0x5aba91){var _0x3752e8={};var _0x4bbe4a={};var _0x52ef14;var _0x259e52;return db[_0x3856('0x35')][_0x3856('0x5e')]({'where':{'id':_0x542d64[_0x3856('0x4e')]['id']}})[_0x3856('0x2b')](handleEntityNotFound(_0x37a3e0,null))[_0x3856('0x2b')](function(_0x5552b6){if(_0x5552b6){_0x52ef14=_0x5552b6;_0x4bbe4a[_0x3856('0x3a')]=_['keys'](db['User'][_0x3856('0x36')]);_0x4bbe4a['query']=_[_0x3856('0x4f')](_0x542d64[_0x3856('0x3b')]);_0x4bbe4a['filters']=_['intersection'](_0x4bbe4a[_0x3856('0x3a')],_0x4bbe4a['query']);_0x3752e8[_0x3856('0x3e')]=_[_0x3856('0x3d')](_0x4bbe4a[_0x3856('0x3a')],qs[_0x3856('0x3f')](_0x542d64[_0x3856('0x3b')][_0x3856('0x3f')]));_0x3752e8[_0x3856('0x3e')]=_0x3752e8[_0x3856('0x3e')][_0x3856('0x40')]?_0x3752e8[_0x3856('0x3e')]:_0x4bbe4a[_0x3856('0x3a')];_0x3752e8['order']=qs[_0x3856('0x43')](_0x542d64[_0x3856('0x3b')][_0x3856('0x43')]);_0x3752e8['where']=qs[_0x3856('0x3c')](_[_0x3856('0x44')](_0x542d64['query'],_0x4bbe4a[_0x3856('0x3c')]));if(_0x542d64[_0x3856('0x3b')][_0x3856('0x45')]){_0x3752e8['where']=_[_0x3856('0x46')](_0x3752e8[_0x3856('0x49')],{'$or':_[_0x3856('0x34')](_0x3752e8[_0x3856('0x3e')],function(_0xba0e9a){var _0x286c49={};_0x286c49[_0xba0e9a]={'$like':'%'+_0x542d64[_0x3856('0x3b')]['filter']+'%'};return _0x286c49;})});}_0x3752e8=_['merge']({},_0x3752e8,_0x542d64[_0x3856('0x48')]);return _0x52ef14[_0x3856('0x5d')](_0x3752e8);}})['then'](function(_0x257fd8){if(_0x257fd8){_0x259e52=_0x257fd8[_0x3856('0x40')];if(!_0x542d64[_0x3856('0x3b')]['hasOwnProperty'](_0x3856('0x42'))){_0x3752e8[_0x3856('0x23')]=qs[_0x3856('0x23')](_0x542d64[_0x3856('0x3b')][_0x3856('0x23')]);_0x3752e8[_0x3856('0x21')]=qs[_0x3856('0x21')](_0x542d64[_0x3856('0x3b')][_0x3856('0x21')]);}return _0x52ef14[_0x3856('0x5d')](_0x3752e8);}})[_0x3856('0x2b')](function(_0x435983){if(_0x435983){return _0x435983?{'count':_0x259e52,'rows':_0x435983}:null;}})[_0x3856('0x2b')](respondWithResult(_0x37a3e0,null))[_0x3856('0x4d')](handleError(_0x37a3e0,null));}; \ No newline at end of file +var _0x6525=['register','status','end','json','offset','undefined','count','limit','set','reject','update','then','SquareProjects','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','params','keys','intersection','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket'];(function(_0xe2c1a7,_0x6fb2c7){var _0x57cbdd=function(_0x81ba83){while(--_0x81ba83){_0xe2c1a7['push'](_0xe2c1a7['shift']());}};_0x57cbdd(++_0x6fb2c7);}(_0x6525,0xa2));var _0x5652=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x6525[_0x283127];return _0x43da5d;};'use strict';var emlformat=require(_0x5652('0x0'));var rimraf=require(_0x5652('0x1'));var zipdir=require(_0x5652('0x2'));var jsonpatch=require(_0x5652('0x3'));var rp=require(_0x5652('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5652('0x5'));var util=require('util');var path=require(_0x5652('0x6'));var sox=require(_0x5652('0x7'));var csv=require(_0x5652('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5652('0x9'));var squel=require(_0x5652('0xa'));var crypto=require(_0x5652('0xb'));var jsforce=require(_0x5652('0xc'));var deskjs=require(_0x5652('0xd'));var toCsv=require(_0x5652('0x8'));var querystring=require('querystring');var Papa=require(_0x5652('0xe'));var Redis=require(_0x5652('0xf'));var authService=require(_0x5652('0x10'));var qs=require(_0x5652('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5652('0x12'));var logger=require(_0x5652('0x13'))(_0x5652('0x14'));var utils=require('../../config/utils');var config=require(_0x5652('0x15'));var licenseUtil=require(_0x5652('0x16'));var db=require(_0x5652('0x17'))['db'];config[_0x5652('0x18')]=_[_0x5652('0x19')](config['redis'],{'host':_0x5652('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5652('0x18')]));require(_0x5652('0x1b'))[_0x5652('0x1c')](socket);function respondWithStatusCode(_0x2cfc81,_0x55912c){_0x55912c=_0x55912c||0xcc;return function(_0x3125db){if(_0x3125db){return _0x2cfc81['sendStatus'](_0x55912c);}return _0x2cfc81[_0x5652('0x1d')](_0x55912c)[_0x5652('0x1e')]();};}function respondWithResult(_0x272636,_0x38a4c9){_0x38a4c9=_0x38a4c9||0xc8;return function(_0x2824b6){if(_0x2824b6){return _0x272636['status'](_0x38a4c9)[_0x5652('0x1f')](_0x2824b6);}};}function respondWithFilteredResult(_0x259192,_0x3648e3){return function(_0x487dc6){if(_0x487dc6){var _0x275e86=typeof _0x3648e3[_0x5652('0x20')]==='undefined'&&typeof _0x3648e3['limit']===_0x5652('0x21');var _0x12e588=_0x487dc6[_0x5652('0x22')];var _0x4e1443=_0x275e86?0x0:_0x3648e3[_0x5652('0x20')];var _0x54d648=_0x275e86?_0x487dc6['count']:_0x3648e3[_0x5652('0x20')]+_0x3648e3[_0x5652('0x23')];var _0x24f883;if(_0x54d648>=_0x12e588){_0x54d648=_0x12e588;_0x24f883=0xc8;}else{_0x24f883=0xce;}_0x259192['status'](_0x24f883);return _0x259192[_0x5652('0x24')]('Content-Range',_0x4e1443+'-'+_0x54d648+'/'+_0x12e588)[_0x5652('0x1f')](_0x487dc6);}return null;};}function patchUpdates(_0x260dc8){return function(_0x2680ac){try{jsonpatch['apply'](_0x2680ac,_0x260dc8,!![]);}catch(_0x23e5f6){return BPromise[_0x5652('0x25')](_0x23e5f6);}return _0x2680ac['save']();};}function saveUpdates(_0x12c604,_0x1bb4ca){return function(_0x3b6647){if(_0x3b6647){return _0x3b6647[_0x5652('0x26')](_0x12c604)[_0x5652('0x27')](function(_0x269231){return _0x269231;});}return null;};}function removeEntity(_0x580c2f,_0x1f6945){return function(_0x5bb77e){if(_0x5bb77e){return _0x5bb77e['destroy']()['then'](function(){var _0x2a9146=_0x5bb77e['get']({'plain':!![]});var _0x5934eb=_0x5652('0x28');return db[_0x5652('0x29')][_0x5652('0x2a')]({'where':{'type':_0x5934eb,'resourceId':_0x2a9146['id']}})[_0x5652('0x27')](function(){return _0x5bb77e;});})[_0x5652('0x27')](function(){_0x580c2f[_0x5652('0x1d')](0xcc)[_0x5652('0x1e')]();});}};}function handleEntityNotFound(_0x3f372b,_0x3feb18){return function(_0x286b2b){if(!_0x286b2b){_0x3f372b[_0x5652('0x2b')](0x194);}return _0x286b2b;};}function handleError(_0x4cfe1f,_0x37977e){_0x37977e=_0x37977e||0x1f4;return function(_0xf60c5){logger[_0x5652('0x2c')](_0xf60c5[_0x5652('0x2d')]);if(_0xf60c5[_0x5652('0x2e')]){delete _0xf60c5[_0x5652('0x2e')];}_0x4cfe1f[_0x5652('0x1d')](_0x37977e)[_0x5652('0x2f')](_0xf60c5);};}exports[_0x5652('0x30')]=function(_0x39a7a9,_0x324a26){var _0x86b81a={},_0x12fb60={},_0xabd93a={'count':0x0,'rows':[]};var _0x513d5a=_[_0x5652('0x31')](db[_0x5652('0x32')][_0x5652('0x33')],function(_0x2783ea){return{'name':_0x2783ea[_0x5652('0x34')],'type':_0x2783ea['type'][_0x5652('0x35')]};});_0x12fb60[_0x5652('0x36')]=_[_0x5652('0x31')](_0x513d5a,_0x5652('0x2e'));_0x12fb60[_0x5652('0x37')]=_['keys'](_0x39a7a9[_0x5652('0x37')]);_0x12fb60[_0x5652('0x38')]=_['intersection'](_0x12fb60[_0x5652('0x36')],_0x12fb60['query']);_0x86b81a[_0x5652('0x39')]=_['intersection'](_0x12fb60[_0x5652('0x36')],qs[_0x5652('0x3a')](_0x39a7a9[_0x5652('0x37')][_0x5652('0x3a')]));_0x86b81a[_0x5652('0x39')]=_0x86b81a[_0x5652('0x39')][_0x5652('0x3b')]?_0x86b81a['attributes']:_0x12fb60[_0x5652('0x36')];if(!_0x39a7a9[_0x5652('0x37')]['hasOwnProperty'](_0x5652('0x3c'))){_0x86b81a[_0x5652('0x23')]=qs[_0x5652('0x23')](_0x39a7a9[_0x5652('0x37')][_0x5652('0x23')]);_0x86b81a[_0x5652('0x20')]=qs[_0x5652('0x20')](_0x39a7a9[_0x5652('0x37')][_0x5652('0x20')]);}_0x86b81a['order']=qs[_0x5652('0x3d')](_0x39a7a9[_0x5652('0x37')][_0x5652('0x3d')]);_0x86b81a[_0x5652('0x3e')]=qs[_0x5652('0x38')](_[_0x5652('0x3f')](_0x39a7a9[_0x5652('0x37')],_0x12fb60[_0x5652('0x38')]),_0x513d5a);if(_0x39a7a9[_0x5652('0x37')][_0x5652('0x40')]){_0x86b81a[_0x5652('0x3e')]=_[_0x5652('0x41')](_0x86b81a['where'],{'$or':_[_0x5652('0x31')](_0x513d5a,function(_0x3e0153){if(_0x3e0153[_0x5652('0x42')]!==_0x5652('0x43')){var _0x32c8ae={};_0x32c8ae[_0x3e0153[_0x5652('0x2e')]]={'$like':'%'+_0x39a7a9[_0x5652('0x37')][_0x5652('0x40')]+'%'};return _0x32c8ae;}})});}_0x86b81a=_[_0x5652('0x41')]({},_0x86b81a,_0x39a7a9['options']);var _0x2f2e74={'where':_0x86b81a[_0x5652('0x3e')]};return db[_0x5652('0x32')]['count'](_0x2f2e74)[_0x5652('0x27')](function(_0x57e3e8){_0xabd93a[_0x5652('0x22')]=_0x57e3e8;if(_0x39a7a9[_0x5652('0x37')][_0x5652('0x44')]){_0x86b81a[_0x5652('0x45')]=[{'all':!![]}];}return db[_0x5652('0x32')]['findAll'](_0x86b81a);})[_0x5652('0x27')](function(_0x2e9e42){_0xabd93a['rows']=_0x2e9e42;return _0xabd93a;})[_0x5652('0x27')](respondWithFilteredResult(_0x324a26,_0x86b81a))[_0x5652('0x46')](handleError(_0x324a26,null));};exports['show']=function(_0x50d822,_0x496dce){var _0x147c7e={'raw':![],'where':{'id':_0x50d822[_0x5652('0x47')]['id']}},_0x4eb9d7={};_0x4eb9d7[_0x5652('0x36')]=_[_0x5652('0x48')](db[_0x5652('0x32')]['rawAttributes']);_0x4eb9d7[_0x5652('0x37')]=_['keys'](_0x50d822[_0x5652('0x37')]);_0x4eb9d7[_0x5652('0x38')]=_[_0x5652('0x49')](_0x4eb9d7['model'],_0x4eb9d7[_0x5652('0x37')]);_0x147c7e[_0x5652('0x39')]=_[_0x5652('0x49')](_0x4eb9d7[_0x5652('0x36')],qs[_0x5652('0x3a')](_0x50d822[_0x5652('0x37')]['fields']));_0x147c7e[_0x5652('0x39')]=_0x147c7e[_0x5652('0x39')][_0x5652('0x3b')]?_0x147c7e[_0x5652('0x39')]:_0x4eb9d7['model'];if(_0x50d822[_0x5652('0x37')][_0x5652('0x44')]){_0x147c7e[_0x5652('0x45')]=[{'all':!![]}];}_0x147c7e=_['merge']({},_0x147c7e,_0x50d822[_0x5652('0x4a')]);return db[_0x5652('0x32')][_0x5652('0x4b')](_0x147c7e)[_0x5652('0x27')](handleEntityNotFound(_0x496dce,null))[_0x5652('0x27')](respondWithResult(_0x496dce,null))[_0x5652('0x46')](handleError(_0x496dce,null));};exports['create']=function(_0x4dee4b,_0x5b3785){return db[_0x5652('0x32')][_0x5652('0x4c')](_0x4dee4b[_0x5652('0x4d')],{})[_0x5652('0x27')](function(_0x1b257f){var _0x5cc21e=_0x4dee4b[_0x5652('0x4e')][_0x5652('0x4f')]({'plain':!![]});if(!_0x5cc21e)throw new Error(_0x5652('0x50'));if(_0x5cc21e['role']===_0x5652('0x4e')){var _0x3fa397=_0x1b257f[_0x5652('0x4f')]({'plain':!![]});var _0x1b868f=_0x5652('0x28');return db[_0x5652('0x51')][_0x5652('0x4b')]({'where':{'name':_0x1b868f,'userProfileId':_0x5cc21e[_0x5652('0x52')]},'raw':!![]})['then'](function(_0x230af8){if(_0x230af8&&_0x230af8[_0x5652('0x53')]===0x0){return db['UserProfileResource'][_0x5652('0x4c')]({'name':_0x3fa397[_0x5652('0x2e')],'resourceId':_0x3fa397['id'],'type':_0x230af8['name'],'sectionId':_0x230af8['id']},{})['then'](function(){return _0x1b257f;});}else{return _0x1b257f;}})[_0x5652('0x46')](function(_0x309ac2){logger['error'](_0x5652('0x54'),_0x309ac2);throw _0x309ac2;});}return _0x1b257f;})[_0x5652('0x27')](respondWithResult(_0x5b3785,0xc9))['catch'](handleError(_0x5b3785,null));};exports[_0x5652('0x26')]=function(_0x513f98,_0xb2c37a){if(_0x513f98[_0x5652('0x4d')]['id']){delete _0x513f98[_0x5652('0x4d')]['id'];}return db[_0x5652('0x32')][_0x5652('0x4b')]({'where':{'id':_0x513f98['params']['id']}})[_0x5652('0x27')](handleEntityNotFound(_0xb2c37a,null))['then'](saveUpdates(_0x513f98[_0x5652('0x4d')],null))[_0x5652('0x27')](respondWithResult(_0xb2c37a,null))[_0x5652('0x46')](handleError(_0xb2c37a,null));};exports['destroy']=function(_0x5c7769,_0x191f58){return db[_0x5652('0x32')][_0x5652('0x4b')]({'where':{'id':_0x5c7769[_0x5652('0x47')]['id']}})['then'](handleEntityNotFound(_0x191f58,null))['then'](removeEntity(_0x191f58,null))[_0x5652('0x46')](handleError(_0x191f58,null));};exports[_0x5652('0x55')]=function(_0x4df704,_0xe842e8,_0x245068){return db[_0x5652('0x32')][_0x5652('0x4b')]({'where':{'id':_0x4df704[_0x5652('0x47')]['id']}})[_0x5652('0x27')](handleEntityNotFound(_0xe842e8,null))[_0x5652('0x27')](function(_0x4e402f){if(_0x4e402f){return _0x4e402f[_0x5652('0x55')](_0x4df704[_0x5652('0x4d')][_0x5652('0x56')],_[_0x5652('0x57')](_0x4df704[_0x5652('0x4d')],['ids','id'])||{});}})[_0x5652('0x27')](respondWithResult(_0xe842e8,null))[_0x5652('0x46')](handleError(_0xe842e8,null));};exports[_0x5652('0x58')]=function(_0x43b9c2,_0x4a68c6,_0x43e5b5){return db['SquareProject'][_0x5652('0x4b')]({'where':{'id':_0x43b9c2['params']['id']}})[_0x5652('0x27')](handleEntityNotFound(_0x4a68c6,null))[_0x5652('0x27')](function(_0x5bc710){if(_0x5bc710){return _0x5bc710['removeUsers'](_0x43b9c2[_0x5652('0x37')]['ids'])[_0x5652('0x27')](function(){if(_[_0x5652('0x59')](_0x43b9c2[_0x5652('0x37')][_0x5652('0x56')])){for(var _0x31c7ad=0x0;_0x31c7ad<_0x43b9c2[_0x5652('0x37')][_0x5652('0x56')][_0x5652('0x3b')];_0x31c7ad+=0x1){socket['emit'](_0x5652('0x5a'),{'UserId':Number(_0x43b9c2[_0x5652('0x37')]['ids'][_0x31c7ad]),'SquareProjectId':Number(_0x43b9c2[_0x5652('0x47')]['id'])});}}else{socket[_0x5652('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x43b9c2['query'][_0x5652('0x56')]),'SquareProjectId':Number(_0x43b9c2[_0x5652('0x47')]['id'])});}});}})[_0x5652('0x27')](respondWithStatusCode(_0x4a68c6,null))[_0x5652('0x46')](handleError(_0x4a68c6,null));};exports[_0x5652('0x5c')]=function(_0x1d8c8e,_0x50e0af,_0x43d2a6){var _0x20fbff={};var _0x2ea915={};var _0x28fe9b;var _0x52e6d2;return db[_0x5652('0x32')][_0x5652('0x5d')]({'where':{'id':_0x1d8c8e[_0x5652('0x47')]['id']}})[_0x5652('0x27')](handleEntityNotFound(_0x50e0af,null))[_0x5652('0x27')](function(_0x3e3fea){if(_0x3e3fea){_0x28fe9b=_0x3e3fea;_0x2ea915['model']=_[_0x5652('0x48')](db['User'][_0x5652('0x33')]);_0x2ea915[_0x5652('0x37')]=_[_0x5652('0x48')](_0x1d8c8e['query']);_0x2ea915[_0x5652('0x38')]=_[_0x5652('0x49')](_0x2ea915['model'],_0x2ea915[_0x5652('0x37')]);_0x20fbff[_0x5652('0x39')]=_[_0x5652('0x49')](_0x2ea915[_0x5652('0x36')],qs['fields'](_0x1d8c8e[_0x5652('0x37')][_0x5652('0x3a')]));_0x20fbff['attributes']=_0x20fbff['attributes'][_0x5652('0x3b')]?_0x20fbff[_0x5652('0x39')]:_0x2ea915[_0x5652('0x36')];_0x20fbff[_0x5652('0x5e')]=qs[_0x5652('0x3d')](_0x1d8c8e[_0x5652('0x37')]['sort']);_0x20fbff[_0x5652('0x3e')]=qs[_0x5652('0x38')](_[_0x5652('0x3f')](_0x1d8c8e['query'],_0x2ea915[_0x5652('0x38')]));if(_0x1d8c8e[_0x5652('0x37')][_0x5652('0x40')]){_0x20fbff[_0x5652('0x3e')]=_[_0x5652('0x41')](_0x20fbff[_0x5652('0x3e')],{'$or':_[_0x5652('0x31')](_0x20fbff[_0x5652('0x39')],function(_0x15dfc2){var _0x1b68a3={};_0x1b68a3[_0x15dfc2]={'$like':'%'+_0x1d8c8e[_0x5652('0x37')][_0x5652('0x40')]+'%'};return _0x1b68a3;})});}_0x20fbff=_[_0x5652('0x41')]({},_0x20fbff,_0x1d8c8e[_0x5652('0x4a')]);return _0x28fe9b[_0x5652('0x5c')](_0x20fbff);}})[_0x5652('0x27')](function(_0x4c65af){if(_0x4c65af){_0x52e6d2=_0x4c65af[_0x5652('0x3b')];if(!_0x1d8c8e[_0x5652('0x37')]['hasOwnProperty'](_0x5652('0x3c'))){_0x20fbff[_0x5652('0x23')]=qs[_0x5652('0x23')](_0x1d8c8e[_0x5652('0x37')]['limit']);_0x20fbff['offset']=qs['offset'](_0x1d8c8e['query']['offset']);}return _0x28fe9b[_0x5652('0x5c')](_0x20fbff);}})['then'](function(_0x3b9eed){if(_0x3b9eed){return _0x3b9eed?{'count':_0x52e6d2,'rows':_0x3b9eed}:null;}})['then'](respondWithResult(_0x50e0af,null))[_0x5652('0x46')](handleError(_0x50e0af,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9d9be1d..f916add 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 _0xac16=['exports','events','../../mysqldb','SquareProject','save','update','emit','hasOwnProperty','hook'];(function(_0x53d583,_0x45c5e0){var _0x30a04c=function(_0x25f79f){while(--_0x25f79f){_0x53d583['push'](_0x53d583['shift']());}};_0x30a04c(++_0x45c5e0);}(_0xac16,0x13c));var _0x6ac1=function(_0x79a69b,_0x3f32f7){_0x79a69b=_0x79a69b-0x0;var _0x3d8e33=_0xac16[_0x79a69b];return _0x3d8e33;};'use strict';var EventEmitter=require(_0x6ac1('0x0'));var SquareProject=require(_0x6ac1('0x1'))['db'][_0x6ac1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ac1('0x3'),'afterUpdate':_0x6ac1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21723d){return function(_0x2d731c,_0x345c52,_0x1b0cb5){SquareProjectEvents['emit'](_0x21723d+':'+_0x2d731c['id'],_0x2d731c);SquareProjectEvents[_0x6ac1('0x5')](_0x21723d,_0x2d731c);_0x1b0cb5(null);};}for(var e in events){if(events[_0x6ac1('0x6')](e)){var event=events[e];SquareProject[_0x6ac1('0x7')](e,emitEvent(event));}}module[_0x6ac1('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x503d=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x127316,_0x2774a8){var _0x34d919=function(_0x22691d){while(--_0x22691d){_0x127316['push'](_0x127316['shift']());}};_0x34d919(++_0x2774a8);}(_0x503d,0x1b7));var _0xd503=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x503d[_0x38e177];return _0x1faf15;};'use strict';var EventEmitter=require(_0xd503('0x0'));var SquareProject=require(_0xd503('0x1'))['db'][_0xd503('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd503('0x3')](0x0);var events={'afterCreate':_0xd503('0x4'),'afterUpdate':_0xd503('0x5'),'afterDestroy':_0xd503('0x6')};function emitEvent(_0x2ec5b2){return function(_0x38fce5,_0x1c88c3,_0x4177ff){SquareProjectEvents[_0xd503('0x7')](_0x2ec5b2+':'+_0x38fce5['id'],_0x38fce5);SquareProjectEvents[_0xd503('0x7')](_0x2ec5b2,_0x38fce5);_0x4177ff(null);};}for(var e in events){if(events[_0xd503('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2d126eb..fd86aca 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 _0x4ab9=['./squareProject.attributes','exports','define','SquareProject','changed','preproduction','savedAt','format','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','api','path','../../config/environment'];(function(_0x49c63b,_0x39a1e6){var _0x63b9af=function(_0x1633ba){while(--_0x1633ba){_0x49c63b['push'](_0x49c63b['shift']());}};_0x63b9af(++_0x39a1e6);}(_0x4ab9,0x184));var _0x94ab=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4ab9[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x94ab('0x0'));var logger=require('../../config/logger')(_0x94ab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x94ab('0x2'));var rimraf=require('rimraf');var config=require(_0x94ab('0x3'));var attributes=require(_0x94ab('0x4'));module[_0x94ab('0x5')]=function(_0x45231f,_0x5d5bdf){return _0x45231f[_0x94ab('0x6')](_0x94ab('0x7'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x319494,_0x61a243,_0x20e195){if(_0x319494[_0x94ab('0x8')](_0x94ab('0x9'))){_0x319494[_0x94ab('0xa')]=moment()[_0x94ab('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x319494[_0x94ab('0x8')]('production')){_0x319494[_0x94ab('0xc')]=moment()[_0x94ab('0xb')](_0x94ab('0xd'));}_0x20e195(null,_0x319494);}}});}; \ No newline at end of file +var _0x825b=['changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','production','format','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','exports','define','SquareProject'];(function(_0x5c7e53,_0x174ce5){var _0x1c9af9=function(_0x38895d){while(--_0x38895d){_0x5c7e53['push'](_0x5c7e53['shift']());}};_0x1c9af9(++_0x174ce5);}(_0x825b,0x17f));var _0xb825=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x825b[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb825('0x0'));var BPromise=require(_0xb825('0x1'));var rp=require(_0xb825('0x2'));var fs=require('fs');var path=require(_0xb825('0x3'));var rimraf=require(_0xb825('0x4'));var config=require('../../config/environment');var attributes=require(_0xb825('0x5'));module[_0xb825('0x6')]=function(_0x240904,_0x57aca6){return _0x240904[_0xb825('0x7')](_0xb825('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a21a5,_0x5135a1,_0x396f2e){if(_0x3a21a5[_0xb825('0x9')](_0xb825('0xa'))){_0x3a21a5['savedAt']=moment()['format'](_0xb825('0xb'));}if(_0x3a21a5[_0xb825('0x9')](_0xb825('0xc'))){_0x3a21a5['publishedAt']=moment()[_0xb825('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x396f2e(null,_0x3a21a5);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b41dabf..c0a4da4 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 _0x2a37=['message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2a37,0x174));var _0x72a3=function(_0x421f36,_0x1d54d2){_0x421f36=_0x421f36-0x0;var _0x1f1647=_0x2a37[_0x421f36];return _0x1f1647;};'use strict';var _=require(_0x72a3('0x0'));var util=require(_0x72a3('0x1'));var moment=require(_0x72a3('0x2'));var BPromise=require(_0x72a3('0x3'));var rs=require(_0x72a3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a3('0x5'))['db'];var utils=require(_0x72a3('0x6'));var logger=require(_0x72a3('0x7'))('rpc');var config=require(_0x72a3('0x8'));var jayson=require(_0x72a3('0x9'));var client=jayson[_0x72a3('0xa')][_0x72a3('0xb')]({'port':0x232a});config['redis']=_[_0x72a3('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x72a3('0xd'))(new Redis(config['redis']));require('./squareProject.socket')[_0x72a3('0xe')](socket);function respondWithRpcPromise(_0x2c84e3,_0x3e0503,_0x272621){return new BPromise(function(_0x3ca083,_0x161718){return client[_0x72a3('0xf')](_0x2c84e3,_0x272621)[_0x72a3('0x10')](function(_0x32e77a){logger[_0x72a3('0x11')](_0x72a3('0x12'),_0x3e0503,_0x72a3('0x13'));logger['debug'](_0x72a3('0x14'),_0x3e0503,_0x72a3('0x13'),JSON[_0x72a3('0x15')](_0x32e77a));if(_0x32e77a['error']){if(_0x32e77a[_0x72a3('0x16')][_0x72a3('0x17')]===0x1f4){logger[_0x72a3('0x16')](_0x72a3('0x12'),_0x3e0503,_0x32e77a[_0x72a3('0x16')][_0x72a3('0x18')]);return _0x161718(_0x32e77a[_0x72a3('0x16')][_0x72a3('0x18')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x3e0503,_0x32e77a[_0x72a3('0x16')][_0x72a3('0x18')]);return _0x3ca083(_0x32e77a[_0x72a3('0x16')][_0x72a3('0x18')]);}else{logger['info'](_0x72a3('0x12'),_0x3e0503,'request\x20sent');_0x3ca083(_0x32e77a['result'][_0x72a3('0x18')]);}})[_0x72a3('0x19')](function(_0x2faaaa){logger['error'](_0x72a3('0x12'),_0x3e0503,_0x2faaaa);_0x161718(_0x2faaaa);});});}exports[_0x72a3('0x1a')]=function(_0x3b1d00){var _0x7e0e97=this;return new Promise(function(_0x22eb1c,_0x2d03b0){return db[_0x72a3('0x1b')][_0x72a3('0x1c')]({'raw':_0x3b1d00[_0x72a3('0x1d')]?_0x3b1d00['options'][_0x72a3('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b1d00[_0x72a3('0x1d')]?_0x3b1d00[_0x72a3('0x1d')][_0x72a3('0x1f')]||null:null,'attributes':_0x3b1d00['options']?_0x3b1d00[_0x72a3('0x1d')][_0x72a3('0x20')]||null:null,'include':_0x3b1d00['options']?_0x3b1d00[_0x72a3('0x1d')][_0x72a3('0x21')]?_['map'](_0x3b1d00[_0x72a3('0x1d')]['include'],function(_0x41d3c8){return{'model':db[_0x41d3c8[_0x72a3('0x22')]],'as':_0x41d3c8['as'],'attributes':_0x41d3c8[_0x72a3('0x20')],'include':_0x41d3c8[_0x72a3('0x21')]?_['map'](_0x41d3c8[_0x72a3('0x21')],function(_0x2eeb38){return{'model':db[_0x2eeb38[_0x72a3('0x22')]],'as':_0x2eeb38['as'],'attributes':_0x2eeb38[_0x72a3('0x20')],'include':_0x2eeb38[_0x72a3('0x21')]?_[_0x72a3('0x23')](_0x2eeb38['include'],function(_0x1fa83f){return{'model':db[_0x1fa83f[_0x72a3('0x22')]],'as':_0x1fa83f['as'],'attributes':_0x1fa83f[_0x72a3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x72a3('0x10')](function(_0x573c6d){logger[_0x72a3('0x11')]('ShowSquareProject',_0x3b1d00);logger['debug']('ShowSquareProject',_0x3b1d00,JSON['stringify'](_0x573c6d));_0x22eb1c(_0x573c6d);})[_0x72a3('0x19')](function(_0x37c94d){logger[_0x72a3('0x16')](_0x72a3('0x1a'),_0x37c94d[_0x72a3('0x18')],_0x3b1d00);_0x2d03b0(_0x7e0e97['error'](0x1f4,_0x37c94d[_0x72a3('0x18')]));});});}; \ No newline at end of file +var _0x7d81=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','request\x20sent','debug','stringify','error','code','SquareProject,\x20%s,\x20%s','message','info','result','catch','ShowSquareProject','SquareProject','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x36a635,_0x9ce8f1){var _0x2bbbf5=function(_0x33d8e9){while(--_0x33d8e9){_0x36a635['push'](_0x36a635['shift']());}};_0x2bbbf5(++_0x9ce8f1);}(_0x7d81,0x179));var _0x17d8=function(_0x9731b4,_0x26aac3){_0x9731b4=_0x9731b4-0x0;var _0x3d7a66=_0x7d81[_0x9731b4];return _0x3d7a66;};'use strict';var _=require('lodash');var util=require(_0x17d8('0x0'));var moment=require('moment');var BPromise=require(_0x17d8('0x1'));var rs=require(_0x17d8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17d8('0x3'))['db'];var utils=require(_0x17d8('0x4'));var logger=require(_0x17d8('0x5'))(_0x17d8('0x6'));var config=require(_0x17d8('0x7'));var jayson=require(_0x17d8('0x8'));var client=jayson['client'][_0x17d8('0x9')]({'port':0x232a});config[_0x17d8('0xa')]=_[_0x17d8('0xb')](config[_0x17d8('0xa')],{'host':_0x17d8('0xc'),'port':0x18eb});var socket=require(_0x17d8('0xd'))(new Redis(config[_0x17d8('0xa')]));require('./squareProject.socket')[_0x17d8('0xe')](socket);function respondWithRpcPromise(_0x4c90e1,_0x3f0c14,_0x3c2ca5){return new BPromise(function(_0x1cc69f,_0x553277){return client['request'](_0x4c90e1,_0x3c2ca5)[_0x17d8('0xf')](function(_0x44ee89){logger['info']('SquareProject,\x20%s,\x20%s',_0x3f0c14,_0x17d8('0x10'));logger[_0x17d8('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3f0c14,_0x17d8('0x10'),JSON[_0x17d8('0x12')](_0x44ee89));if(_0x44ee89[_0x17d8('0x13')]){if(_0x44ee89['error'][_0x17d8('0x14')]===0x1f4){logger[_0x17d8('0x13')](_0x17d8('0x15'),_0x3f0c14,_0x44ee89['error']['message']);return _0x553277(_0x44ee89['error']['message']);}logger['error'](_0x17d8('0x15'),_0x3f0c14,_0x44ee89[_0x17d8('0x13')][_0x17d8('0x16')]);return _0x1cc69f(_0x44ee89[_0x17d8('0x13')]['message']);}else{logger[_0x17d8('0x17')](_0x17d8('0x15'),_0x3f0c14,_0x17d8('0x10'));_0x1cc69f(_0x44ee89[_0x17d8('0x18')][_0x17d8('0x16')]);}})[_0x17d8('0x19')](function(_0x545500){logger[_0x17d8('0x13')](_0x17d8('0x15'),_0x3f0c14,_0x545500);_0x553277(_0x545500);});});}exports[_0x17d8('0x1a')]=function(_0x3fb7f0){var _0x19310d=this;return new Promise(function(_0x1cbfa1,_0xfc7ea5){return db[_0x17d8('0x1b')]['find']({'raw':_0x3fb7f0[_0x17d8('0x1c')]?_0x3fb7f0[_0x17d8('0x1c')][_0x17d8('0x1d')]===undefined?!![]:![]:!![],'where':_0x3fb7f0['options']?_0x3fb7f0[_0x17d8('0x1c')][_0x17d8('0x1e')]||null:null,'attributes':_0x3fb7f0[_0x17d8('0x1c')]?_0x3fb7f0['options'][_0x17d8('0x1f')]||null:null,'include':_0x3fb7f0[_0x17d8('0x1c')]?_0x3fb7f0['options'][_0x17d8('0x20')]?_[_0x17d8('0x21')](_0x3fb7f0['options'][_0x17d8('0x20')],function(_0x1d3583){return{'model':db[_0x1d3583[_0x17d8('0x22')]],'as':_0x1d3583['as'],'attributes':_0x1d3583[_0x17d8('0x1f')],'include':_0x1d3583[_0x17d8('0x20')]?_[_0x17d8('0x21')](_0x1d3583[_0x17d8('0x20')],function(_0xe1a427){return{'model':db[_0xe1a427[_0x17d8('0x22')]],'as':_0xe1a427['as'],'attributes':_0xe1a427[_0x17d8('0x1f')],'include':_0xe1a427['include']?_['map'](_0xe1a427[_0x17d8('0x20')],function(_0x2c0b5c){return{'model':db[_0x2c0b5c['model']],'as':_0x2c0b5c['as'],'attributes':_0x2c0b5c[_0x17d8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x17d8('0xf')](function(_0x4fd88f){logger[_0x17d8('0x17')](_0x17d8('0x1a'),_0x3fb7f0);logger['debug'](_0x17d8('0x1a'),_0x3fb7f0,JSON[_0x17d8('0x12')](_0x4fd88f));_0x1cbfa1(_0x4fd88f);})[_0x17d8('0x19')](function(_0x5540c6){logger[_0x17d8('0x13')](_0x17d8('0x1a'),_0x5540c6[_0x17d8('0x16')],_0x3fb7f0);_0xfc7ea5(_0x19310d['error'](0x1f4,_0x5540c6[_0x17d8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 3f04004..d0d1a6f 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 _0x26ea=['remove','update','emit','removeListener','register','length','./squareProject.events','save'];(function(_0x24afc5,_0x519271){var _0x1d1599=function(_0x28e31d){while(--_0x28e31d){_0x24afc5['push'](_0x24afc5['shift']());}};_0x1d1599(++_0x519271);}(_0x26ea,0xfe));var _0xa26e=function(_0x992ecf,_0x125534){_0x992ecf=_0x992ecf-0x0;var _0x41f20f=_0x26ea[_0x992ecf];return _0x41f20f;};'use strict';var SquareProjectEvents=require(_0xa26e('0x0'));var events=[_0xa26e('0x1'),_0xa26e('0x2'),_0xa26e('0x3')];function createListener(_0x132573,_0x38cf2d){return function(_0x3c2dee){_0x38cf2d[_0xa26e('0x4')](_0x132573,_0x3c2dee);};}function removeListener(_0x4e62f0,_0x104786){return function(){SquareProjectEvents[_0xa26e('0x5')](_0x4e62f0,_0x104786);};}exports[_0xa26e('0x6')]=function(_0x236cc7){for(var _0x589774=0x0,_0x5a1405=events[_0xa26e('0x7')];_0x589774<_0x5a1405;_0x589774++){var _0x1d54cd=events[_0x589774];var _0x156cfc=createListener('squareProject:'+_0x1d54cd,_0x236cc7);SquareProjectEvents['on'](_0x1d54cd,_0x156cfc);}}; \ No newline at end of file +var _0x0e93=['emit','register','length','squareProject:'];(function(_0x52ec54,_0x429d29){var _0x2a5789=function(_0x3ef446){while(--_0x3ef446){_0x52ec54['push'](_0x52ec54['shift']());}};_0x2a5789(++_0x429d29);}(_0x0e93,0x84));var _0x30e9=function(_0x51c44a,_0x1c09d2){_0x51c44a=_0x51c44a-0x0;var _0x1b6343=_0x0e93[_0x51c44a];return _0x1b6343;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove','update'];function createListener(_0x34378b,_0x445f5e){return function(_0x39e85f){_0x445f5e[_0x30e9('0x0')](_0x34378b,_0x39e85f);};}function removeListener(_0xe031ca,_0x14f339){return function(){SquareProjectEvents['removeListener'](_0xe031ca,_0x14f339);};}exports[_0x30e9('0x1')]=function(_0x539bb8){for(var _0xe340=0x0,_0x3c484d=events[_0x30e9('0x2')];_0xe340<_0x3c484d;_0xe340++){var _0x2aa919=events[_0xe340];var _0x595379=createListener(_0x30e9('0x3')+_0x2aa919,_0x539bb8);SquareProjectEvents['on'](_0x2aa919,_0x595379);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9afb657..a250821 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x5ba060,_0x1c8775){var _0x482ae0=function(_0x1a394c){while(--_0x1a394c){_0x5ba060['push'](_0x5ba060['shift']());}};_0x482ae0(++_0x1c8775);}(_0x1cb9,0x14e));var _0x91cb=function(_0x36cacd,_0x55e343){_0x36cacd=_0x36cacd-0x0;var _0x41a3be=_0x1cb9[_0x36cacd];return _0x41a3be;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x0295,0x1f0));var _0x5029=function(_0x3a03be,_0x597b9a){_0x3a03be=_0x3a03be-0x0;var _0xd572b8=_0x0295[_0x3a03be];return _0xd572b8;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 54ca21d..623fc0f 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 _0xae24=['VIRTUAL','savePath','sequelize','STRING'];(function(_0x4393c6,_0x25035c){var _0x456ff1=function(_0x27aca5){while(--_0x27aca5){_0x4393c6['push'](_0x4393c6['shift']());}};_0x456ff1(++_0x25035c);}(_0xae24,0x182));var _0x4ae2=function(_0x4cf7f2,_0x56c96a){_0x4cf7f2=_0x4cf7f2-0x0;var _0x2cb9dc=_0xae24[_0x4cf7f2];return _0x2cb9dc;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ae2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ae2('0x1')]},'context':{'type':Sequelize[_0x4ae2('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ae2('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4ae2('0x1')]},'saveName':{'type':Sequelize[_0x4ae2('0x1')]},'filename':{'type':Sequelize[_0x4ae2('0x1')]},'savePath':{'type':Sequelize[_0x4ae2('0x1')]},'format':{'type':Sequelize[_0x4ae2('0x2')],'get':function(){var _0x307247='';var _0x4f2e84=this['getDataValue'](_0x4ae2('0x3'));if(_0x4f2e84){_0x307247=_0x4f2e84['substring'](_0x4f2e84['lastIndexOf']('.'));}return _0x307247;}}}; \ No newline at end of file +var _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xf494,0x1c6));var _0x4f49=function(_0x3d71d3,_0x11caf1){_0x3d71d3=_0x3d71d3-0x0;var _0x30ec87=_0xf494[_0x3d71d3];return _0x30ec87;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4fa56db..55d3156 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 _0x92ee=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareRecording','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','send','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x39053b,_0x22d1c9){var _0x187421=function(_0x146304){while(--_0x146304){_0x39053b['push'](_0x39053b['shift']());}};_0x187421(++_0x22d1c9);}(_0x92ee,0x106));var _0xe92e=function(_0x2f06e0,_0x2e1c2a){_0x2f06e0=_0x2f06e0-0x0;var _0xf2711b=_0x92ee[_0x2f06e0];return _0xf2711b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe92e('0x0'));var zipdir=require(_0xe92e('0x1'));var jsonpatch=require(_0xe92e('0x2'));var rp=require(_0xe92e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe92e('0x4'));var util=require(_0xe92e('0x5'));var path=require(_0xe92e('0x6'));var sox=require(_0xe92e('0x7'));var csv=require('to-csv');var ejs=require(_0xe92e('0x8'));var fs=require('fs');var fs_extra=require(_0xe92e('0x9'));var _=require(_0xe92e('0xa'));var squel=require(_0xe92e('0xb'));var crypto=require(_0xe92e('0xc'));var jsforce=require(_0xe92e('0xd'));var deskjs=require(_0xe92e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe92e('0xf'));var Redis=require(_0xe92e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe92e('0x11'));var hardwareService=require(_0xe92e('0x12'));var logger=require(_0xe92e('0x13'))(_0xe92e('0x14'));var utils=require(_0xe92e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe92e('0x16'))['db'];function respondWithStatusCode(_0x44d216,_0x29bbbd){_0x29bbbd=_0x29bbbd||0xcc;return function(_0x13c3c6){if(_0x13c3c6){return _0x44d216[_0xe92e('0x17')](_0x29bbbd);}return _0x44d216[_0xe92e('0x18')](_0x29bbbd)[_0xe92e('0x19')]();};}function respondWithResult(_0x32d17b,_0x18cb45){_0x18cb45=_0x18cb45||0xc8;return function(_0x33b180){if(_0x33b180){return _0x32d17b['status'](_0x18cb45)[_0xe92e('0x1a')](_0x33b180);}};}function respondWithFilteredResult(_0x525619,_0x313ee9){return function(_0x1d4c99){if(_0x1d4c99){var _0x1714cc=typeof _0x313ee9[_0xe92e('0x1b')]===_0xe92e('0x1c')&&typeof _0x313ee9['limit']===_0xe92e('0x1c');var _0x2e2451=_0x1d4c99[_0xe92e('0x1d')];var _0x3693bd=_0x1714cc?0x0:_0x313ee9['offset'];var _0x1c9081=_0x1714cc?_0x1d4c99[_0xe92e('0x1d')]:_0x313ee9[_0xe92e('0x1b')]+_0x313ee9[_0xe92e('0x1e')];var _0x3c9de4;if(_0x1c9081>=_0x2e2451){_0x1c9081=_0x2e2451;_0x3c9de4=0xc8;}else{_0x3c9de4=0xce;}_0x525619[_0xe92e('0x18')](_0x3c9de4);return _0x525619[_0xe92e('0x1f')](_0xe92e('0x20'),_0x3693bd+'-'+_0x1c9081+'/'+_0x2e2451)[_0xe92e('0x1a')](_0x1d4c99);}return null;};}function patchUpdates(_0x2f55de){return function(_0x4b844e){try{jsonpatch[_0xe92e('0x21')](_0x4b844e,_0x2f55de,!![]);}catch(_0x12feb1){return BPromise[_0xe92e('0x22')](_0x12feb1);}return _0x4b844e[_0xe92e('0x23')]();};}function saveUpdates(_0xebcd43,_0x5df0a6){return function(_0x3128a1){if(_0x3128a1){return _0x3128a1[_0xe92e('0x24')](_0xebcd43)[_0xe92e('0x25')](function(_0x653b19){return _0x653b19;});}return null;};}function removeEntity(_0xcca1d8,_0x2ee9c3){return function(_0x3064ad){if(_0x3064ad){return _0x3064ad[_0xe92e('0x26')]()['then'](function(){_0xcca1d8['status'](0xcc)[_0xe92e('0x19')]();});}};}function handleEntityNotFound(_0x1ab090,_0x3dbfcd){return function(_0x5c313){if(!_0x5c313){_0x1ab090[_0xe92e('0x17')](0x194);}return _0x5c313;};}function handleError(_0x5b7724,_0x4a56c3){_0x4a56c3=_0x4a56c3||0x1f4;return function(_0x4013ca){logger[_0xe92e('0x27')](_0x4013ca[_0xe92e('0x28')]);if(_0x4013ca[_0xe92e('0x29')]){delete _0x4013ca[_0xe92e('0x29')];}_0x5b7724['status'](_0x4a56c3)['send'](_0x4013ca);};}exports[_0xe92e('0x2a')]=function(_0x424889,_0x463feb){var _0x339b20={},_0x21a02b={},_0x4ebb2c={'count':0x0,'rows':[]};var _0x2203e3=_[_0xe92e('0x2b')](db[_0xe92e('0x2c')]['rawAttributes'],function(_0x39d473){return{'name':_0x39d473[_0xe92e('0x2d')],'type':_0x39d473[_0xe92e('0x2e')]['key']};});_0x21a02b[_0xe92e('0x2f')]=_['map'](_0x2203e3,_0xe92e('0x29'));_0x21a02b['query']=_[_0xe92e('0x30')](_0x424889[_0xe92e('0x31')]);_0x21a02b[_0xe92e('0x32')]=_[_0xe92e('0x33')](_0x21a02b[_0xe92e('0x2f')],_0x21a02b[_0xe92e('0x31')]);_0x339b20[_0xe92e('0x34')]=_['intersection'](_0x21a02b['model'],qs[_0xe92e('0x35')](_0x424889['query'][_0xe92e('0x35')]));_0x339b20[_0xe92e('0x34')]=_0x339b20['attributes'][_0xe92e('0x36')]?_0x339b20[_0xe92e('0x34')]:_0x21a02b['model'];if(!_0x424889['query'][_0xe92e('0x37')](_0xe92e('0x38'))){_0x339b20[_0xe92e('0x1e')]=qs[_0xe92e('0x1e')](_0x424889[_0xe92e('0x31')][_0xe92e('0x1e')]);_0x339b20[_0xe92e('0x1b')]=qs[_0xe92e('0x1b')](_0x424889[_0xe92e('0x31')][_0xe92e('0x1b')]);}_0x339b20['order']=qs[_0xe92e('0x39')](_0x424889['query'][_0xe92e('0x39')]);_0x339b20[_0xe92e('0x3a')]=qs[_0xe92e('0x32')](_[_0xe92e('0x3b')](_0x424889[_0xe92e('0x31')],_0x21a02b[_0xe92e('0x32')]),_0x2203e3);if(_0x424889['query'][_0xe92e('0x3c')]){_0x339b20['where']=_['merge'](_0x339b20['where'],{'$or':_['map'](_0x2203e3,function(_0x48e3cb){if(_0x48e3cb['type']!==_0xe92e('0x3d')){var _0xe12412={};_0xe12412[_0x48e3cb[_0xe92e('0x29')]]={'$like':'%'+_0x424889['query']['filter']+'%'};return _0xe12412;}})});}_0x339b20=_[_0xe92e('0x3e')]({},_0x339b20,_0x424889[_0xe92e('0x3f')]);var _0x5af267={'where':_0x339b20[_0xe92e('0x3a')]};return db[_0xe92e('0x2c')][_0xe92e('0x1d')](_0x5af267)[_0xe92e('0x25')](function(_0x1ebf93){_0x4ebb2c[_0xe92e('0x1d')]=_0x1ebf93;if(_0x424889[_0xe92e('0x31')][_0xe92e('0x40')]){_0x339b20[_0xe92e('0x41')]=[{'all':!![]}];}return db[_0xe92e('0x2c')][_0xe92e('0x42')](_0x339b20);})[_0xe92e('0x25')](function(_0x1b55aa){_0x4ebb2c[_0xe92e('0x43')]=_0x1b55aa;return _0x4ebb2c;})[_0xe92e('0x25')](respondWithFilteredResult(_0x463feb,_0x339b20))[_0xe92e('0x44')](handleError(_0x463feb,null));};exports[_0xe92e('0x45')]=function(_0xbe83d6,_0x4663c6){var _0x326a4a={'raw':!![],'where':{'id':_0xbe83d6[_0xe92e('0x46')]['id']}},_0x3accf8={};_0x3accf8['model']=_[_0xe92e('0x30')](db[_0xe92e('0x2c')][_0xe92e('0x47')]);_0x3accf8[_0xe92e('0x31')]=_['keys'](_0xbe83d6[_0xe92e('0x31')]);_0x3accf8[_0xe92e('0x32')]=_[_0xe92e('0x33')](_0x3accf8[_0xe92e('0x2f')],_0x3accf8['query']);_0x326a4a[_0xe92e('0x34')]=_[_0xe92e('0x33')](_0x3accf8[_0xe92e('0x2f')],qs[_0xe92e('0x35')](_0xbe83d6[_0xe92e('0x31')][_0xe92e('0x35')]));_0x326a4a[_0xe92e('0x34')]=_0x326a4a['attributes'][_0xe92e('0x36')]?_0x326a4a[_0xe92e('0x34')]:_0x3accf8[_0xe92e('0x2f')];if(_0xbe83d6[_0xe92e('0x31')][_0xe92e('0x40')]){_0x326a4a[_0xe92e('0x41')]=[{'all':!![]}];}_0x326a4a=_[_0xe92e('0x3e')]({},_0x326a4a,_0xbe83d6['options']);return db['SquareRecording'][_0xe92e('0x48')](_0x326a4a)[_0xe92e('0x25')](handleEntityNotFound(_0x4663c6,null))[_0xe92e('0x25')](respondWithResult(_0x4663c6,null))['catch'](handleError(_0x4663c6,null));};exports[_0xe92e('0x49')]=function(_0x4ae9ef,_0x566454){return db[_0xe92e('0x2c')][_0xe92e('0x49')](_0x4ae9ef[_0xe92e('0x4a')],{})[_0xe92e('0x25')](respondWithResult(_0x566454,0xc9))[_0xe92e('0x44')](handleError(_0x566454,null));};exports[_0xe92e('0x24')]=function(_0x525d07,_0x4cbc93){if(_0x525d07[_0xe92e('0x4a')]['id']){delete _0x525d07[_0xe92e('0x4a')]['id'];}return db[_0xe92e('0x2c')][_0xe92e('0x48')]({'where':{'id':_0x525d07[_0xe92e('0x46')]['id']}})[_0xe92e('0x25')](handleEntityNotFound(_0x4cbc93,null))['then'](saveUpdates(_0x525d07[_0xe92e('0x4a')],null))[_0xe92e('0x25')](respondWithResult(_0x4cbc93,null))['catch'](handleError(_0x4cbc93,null));};exports[_0xe92e('0x4b')]=function(_0x12258b,_0x210d17,_0x35fbe3){var _0x4af6d7=require('../../components/encryptor');var _0x408ea0=![];var _0x3670a0={};if(_0x12258b[_0xe92e('0x31')][_0xe92e('0x2e')]&&_0x12258b[_0xe92e('0x31')][_0xe92e('0x2e')]===_0xe92e('0x4c')){_0x3670a0['uniqueid']=_0x12258b[_0xe92e('0x46')]['id'];}else{_0x3670a0['id']=_0x12258b[_0xe92e('0x46')]['id'];}return db['SquareRecording'][_0xe92e('0x48')]({'where':_0x3670a0,'attributes':['id',_0xe92e('0x4d'),_0xe92e('0x4e')],'raw':!![]})[_0xe92e('0x25')](handleEntityNotFound(_0x210d17,null))[_0xe92e('0x25')](function(_0x49cb76){if(_0x49cb76){var _0x3bb88e=_0x49cb76[_0xe92e('0x4d')];var _0x253c23=util[_0xe92e('0x4f')](_0xe92e('0x50'),_0x3bb88e);if(fs['existsSync'](_0x253c23)){_0x408ea0=!![];return _0x4af6d7[_0xe92e('0x51')](_0x253c23,_0x3bb88e,config['secrets'][_0xe92e('0x52')])[_0xe92e('0x25')](function(){return _0x49cb76;});}return _0x49cb76;}})[_0xe92e('0x25')](function(_0x4326be){if(_0x4326be){var _0x26fea2=_0x4326be['savePath'];if(!fs[_0xe92e('0x53')](_0x26fea2)){throw new db[(_0xe92e('0x54'))][(_0xe92e('0x55'))](_0xe92e('0x56'));}if(_0x4326be[_0xe92e('0x4e')]){return _0x210d17[_0xe92e('0x4b')](_0x26fea2,_0x4326be[_0xe92e('0x4e')]+path['extname'](_0x26fea2),function(){if(_0x408ea0){fs[_0xe92e('0x57')](_0x26fea2);}});}else{return _0x210d17[_0xe92e('0x4b')](_0x26fea2,function(_0x37d836){if(_0x408ea0){fs[_0xe92e('0x57')](_0x26fea2);}});}}})[_0xe92e('0x44')](function(_0x5be3e6){if(_0x5be3e6[_0xe92e('0x58')]==='SquareRecording\x20not\x20found'){_0x210d17[_0xe92e('0x18')](0x194)[_0xe92e('0x59')](_0xe92e('0x5a'));}else{return handleError(_0x210d17,null);}});};exports[_0xe92e('0x26')]=function(_0x4c5ab2,_0x1dad7f){return db[_0xe92e('0x2c')][_0xe92e('0x48')]({'where':{'id':_0x4c5ab2['params']['id']}})['then'](function(_0x490687){if(_[_0xe92e('0x5b')](_0x490687)){throw new ReferenceError('Entity\x20not\x20found');}return _0x490687;})[_0xe92e('0x25')](function(_0x411732){var _0x28fdf2=_0x411732['savePath'];logger[_0xe92e('0x5c')](_0xe92e('0x5d'),_0x28fdf2);if(!_[_0xe92e('0x5b')](_0x411732[_0xe92e('0x4d')])&&fs[_0xe92e('0x53')](_0x28fdf2)){logger[_0xe92e('0x5c')](_0xe92e('0x5e')+_0x28fdf2+_0xe92e('0x5f'));fs[_0xe92e('0x60')](_0x28fdf2);}_0x28fdf2=_0x28fdf2+_0xe92e('0x61');if(!_['isNil'](_0x411732[_0xe92e('0x4d')])&&fs[_0xe92e('0x53')](_0x28fdf2)){logger[_0xe92e('0x5c')](_0xe92e('0x5e')+_0x28fdf2+_0xe92e('0x5f'));fs[_0xe92e('0x60')](_0x28fdf2);}return _0x411732;})[_0xe92e('0x25')](function(_0x224441){if(!_0x224441)throw new InternalError();return _0x224441[_0xe92e('0x26')]();})[_0xe92e('0x25')](function(){_0x1dad7f['status'](0xcc)['end']();})[_0xe92e('0x44')](handleError(_0x1dad7f,null));}; \ No newline at end of file +var _0xe4ec=['.cypher','File:\x20\x22','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','end','error','stack','send','index','map','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','pick','merge','VIRTUAL','filter','options','where','SquareRecording','includeAll','include','params','find','catch','body','../../components/encryptor','uniqueid','filename','savePath','format','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x58f1ef,_0x4cf4d5){var _0x2ef772=function(_0x3b04ab){while(--_0x3b04ab){_0x58f1ef['push'](_0x58f1ef['shift']());}};_0x2ef772(++_0x4cf4d5);}(_0xe4ec,0xbc));var _0xce4e=function(_0xcc8d4e,_0xb59e64){_0xcc8d4e=_0xcc8d4e-0x0;var _0x56aca9=_0xe4ec[_0xcc8d4e];return _0x56aca9;};'use strict';var emlformat=require(_0xce4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce4e('0x1'));var jsonpatch=require(_0xce4e('0x2'));var rp=require('request-promise');var moment=require(_0xce4e('0x3'));var BPromise=require(_0xce4e('0x4'));var Mustache=require(_0xce4e('0x5'));var util=require(_0xce4e('0x6'));var path=require(_0xce4e('0x7'));var sox=require(_0xce4e('0x8'));var csv=require('to-csv');var ejs=require(_0xce4e('0x9'));var fs=require('fs');var fs_extra=require(_0xce4e('0xa'));var _=require(_0xce4e('0xb'));var squel=require(_0xce4e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xce4e('0xd'));var toCsv=require(_0xce4e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce4e('0xf'));var authService=require(_0xce4e('0x10'));var qs=require(_0xce4e('0x11'));var as=require(_0xce4e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce4e('0x13'))(_0xce4e('0x14'));var utils=require(_0xce4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xce4e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c0bda,_0x321d76){_0x321d76=_0x321d76||0xcc;return function(_0x4db360){if(_0x4db360){return _0x5c0bda[_0xce4e('0x17')](_0x321d76);}return _0x5c0bda[_0xce4e('0x18')](_0x321d76)['end']();};}function respondWithResult(_0x47f914,_0x212e79){_0x212e79=_0x212e79||0xc8;return function(_0x18ddc8){if(_0x18ddc8){return _0x47f914[_0xce4e('0x18')](_0x212e79)[_0xce4e('0x19')](_0x18ddc8);}};}function respondWithFilteredResult(_0x579bf3,_0x149046){return function(_0x5b8247){if(_0x5b8247){var _0xfc96e9=typeof _0x149046[_0xce4e('0x1a')]===_0xce4e('0x1b')&&typeof _0x149046['limit']===_0xce4e('0x1b');var _0x4bf377=_0x5b8247[_0xce4e('0x1c')];var _0x310e41=_0xfc96e9?0x0:_0x149046[_0xce4e('0x1a')];var _0x26ee4f=_0xfc96e9?_0x5b8247[_0xce4e('0x1c')]:_0x149046[_0xce4e('0x1a')]+_0x149046['limit'];var _0x5e1474;if(_0x26ee4f>=_0x4bf377){_0x26ee4f=_0x4bf377;_0x5e1474=0xc8;}else{_0x5e1474=0xce;}_0x579bf3['status'](_0x5e1474);return _0x579bf3[_0xce4e('0x1d')](_0xce4e('0x1e'),_0x310e41+'-'+_0x26ee4f+'/'+_0x4bf377)[_0xce4e('0x19')](_0x5b8247);}return null;};}function patchUpdates(_0x2b8107){return function(_0x4c135b){try{jsonpatch['apply'](_0x4c135b,_0x2b8107,!![]);}catch(_0x545e54){return BPromise['reject'](_0x545e54);}return _0x4c135b[_0xce4e('0x1f')]();};}function saveUpdates(_0x263797,_0x4e7b7f){return function(_0x4732b8){if(_0x4732b8){return _0x4732b8[_0xce4e('0x20')](_0x263797)['then'](function(_0x2613ea){return _0x2613ea;});}return null;};}function removeEntity(_0xdbd19a,_0x3b8b91){return function(_0x5be81e){if(_0x5be81e){return _0x5be81e[_0xce4e('0x21')]()[_0xce4e('0x22')](function(){_0xdbd19a[_0xce4e('0x18')](0xcc)[_0xce4e('0x23')]();});}};}function handleEntityNotFound(_0x3a6797,_0x460619){return function(_0x1afb0d){if(!_0x1afb0d){_0x3a6797['sendStatus'](0x194);}return _0x1afb0d;};}function handleError(_0xb5dd1b,_0x41c9ad){_0x41c9ad=_0x41c9ad||0x1f4;return function(_0x40a06d){logger[_0xce4e('0x24')](_0x40a06d[_0xce4e('0x25')]);if(_0x40a06d['name']){delete _0x40a06d['name'];}_0xb5dd1b[_0xce4e('0x18')](_0x41c9ad)[_0xce4e('0x26')](_0x40a06d);};}exports[_0xce4e('0x27')]=function(_0x3788f5,_0x1bd0da){var _0x4663f0={},_0x103568={},_0x3f9fc4={'count':0x0,'rows':[]};var _0x240033=_[_0xce4e('0x28')](db['SquareRecording'][_0xce4e('0x29')],function(_0x292fbf){return{'name':_0x292fbf['fieldName'],'type':_0x292fbf[_0xce4e('0x2a')]['key']};});_0x103568[_0xce4e('0x2b')]=_['map'](_0x240033,_0xce4e('0x2c'));_0x103568[_0xce4e('0x2d')]=_[_0xce4e('0x2e')](_0x3788f5[_0xce4e('0x2d')]);_0x103568[_0xce4e('0x2f')]=_[_0xce4e('0x30')](_0x103568[_0xce4e('0x2b')],_0x103568[_0xce4e('0x2d')]);_0x4663f0['attributes']=_[_0xce4e('0x30')](_0x103568['model'],qs[_0xce4e('0x31')](_0x3788f5[_0xce4e('0x2d')]['fields']));_0x4663f0[_0xce4e('0x32')]=_0x4663f0[_0xce4e('0x32')]['length']?_0x4663f0[_0xce4e('0x32')]:_0x103568['model'];if(!_0x3788f5[_0xce4e('0x2d')][_0xce4e('0x33')]('nolimit')){_0x4663f0[_0xce4e('0x34')]=qs[_0xce4e('0x34')](_0x3788f5[_0xce4e('0x2d')][_0xce4e('0x34')]);_0x4663f0[_0xce4e('0x1a')]=qs['offset'](_0x3788f5[_0xce4e('0x2d')][_0xce4e('0x1a')]);}_0x4663f0[_0xce4e('0x35')]=qs['sort'](_0x3788f5[_0xce4e('0x2d')][_0xce4e('0x36')]);_0x4663f0['where']=qs[_0xce4e('0x2f')](_[_0xce4e('0x37')](_0x3788f5['query'],_0x103568['filters']),_0x240033);if(_0x3788f5[_0xce4e('0x2d')]['filter']){_0x4663f0['where']=_[_0xce4e('0x38')](_0x4663f0['where'],{'$or':_[_0xce4e('0x28')](_0x240033,function(_0x594d46){if(_0x594d46['type']!==_0xce4e('0x39')){var _0x7e620d={};_0x7e620d[_0x594d46[_0xce4e('0x2c')]]={'$like':'%'+_0x3788f5[_0xce4e('0x2d')][_0xce4e('0x3a')]+'%'};return _0x7e620d;}})});}_0x4663f0=_[_0xce4e('0x38')]({},_0x4663f0,_0x3788f5[_0xce4e('0x3b')]);var _0x5665f0={'where':_0x4663f0[_0xce4e('0x3c')]};return db[_0xce4e('0x3d')][_0xce4e('0x1c')](_0x5665f0)['then'](function(_0xc15c4f){_0x3f9fc4[_0xce4e('0x1c')]=_0xc15c4f;if(_0x3788f5[_0xce4e('0x2d')][_0xce4e('0x3e')]){_0x4663f0[_0xce4e('0x3f')]=[{'all':!![]}];}return db[_0xce4e('0x3d')]['findAll'](_0x4663f0);})[_0xce4e('0x22')](function(_0x5f3ef7){_0x3f9fc4['rows']=_0x5f3ef7;return _0x3f9fc4;})[_0xce4e('0x22')](respondWithFilteredResult(_0x1bd0da,_0x4663f0))['catch'](handleError(_0x1bd0da,null));};exports['show']=function(_0xae243d,_0x2b3698){var _0x41800b={'raw':!![],'where':{'id':_0xae243d[_0xce4e('0x40')]['id']}},_0x3e1ad6={};_0x3e1ad6[_0xce4e('0x2b')]=_[_0xce4e('0x2e')](db[_0xce4e('0x3d')][_0xce4e('0x29')]);_0x3e1ad6[_0xce4e('0x2d')]=_[_0xce4e('0x2e')](_0xae243d[_0xce4e('0x2d')]);_0x3e1ad6[_0xce4e('0x2f')]=_['intersection'](_0x3e1ad6[_0xce4e('0x2b')],_0x3e1ad6[_0xce4e('0x2d')]);_0x41800b[_0xce4e('0x32')]=_[_0xce4e('0x30')](_0x3e1ad6['model'],qs[_0xce4e('0x31')](_0xae243d[_0xce4e('0x2d')][_0xce4e('0x31')]));_0x41800b[_0xce4e('0x32')]=_0x41800b[_0xce4e('0x32')]['length']?_0x41800b[_0xce4e('0x32')]:_0x3e1ad6[_0xce4e('0x2b')];if(_0xae243d[_0xce4e('0x2d')][_0xce4e('0x3e')]){_0x41800b[_0xce4e('0x3f')]=[{'all':!![]}];}_0x41800b=_['merge']({},_0x41800b,_0xae243d['options']);return db[_0xce4e('0x3d')][_0xce4e('0x41')](_0x41800b)[_0xce4e('0x22')](handleEntityNotFound(_0x2b3698,null))[_0xce4e('0x22')](respondWithResult(_0x2b3698,null))[_0xce4e('0x42')](handleError(_0x2b3698,null));};exports['create']=function(_0x5baf3d,_0x8d76b){return db[_0xce4e('0x3d')]['create'](_0x5baf3d[_0xce4e('0x43')],{})['then'](respondWithResult(_0x8d76b,0xc9))[_0xce4e('0x42')](handleError(_0x8d76b,null));};exports[_0xce4e('0x20')]=function(_0x8d330b,_0x584278){if(_0x8d330b['body']['id']){delete _0x8d330b[_0xce4e('0x43')]['id'];}return db['SquareRecording'][_0xce4e('0x41')]({'where':{'id':_0x8d330b[_0xce4e('0x40')]['id']}})[_0xce4e('0x22')](handleEntityNotFound(_0x584278,null))[_0xce4e('0x22')](saveUpdates(_0x8d330b[_0xce4e('0x43')],null))[_0xce4e('0x22')](respondWithResult(_0x584278,null))[_0xce4e('0x42')](handleError(_0x584278,null));};exports['download']=function(_0x94673b,_0x1d8676,_0x4eae08){var _0x3de9de=require(_0xce4e('0x44'));var _0x2e51ea=![];var _0x3e15ea={};if(_0x94673b[_0xce4e('0x2d')][_0xce4e('0x2a')]&&_0x94673b['query']['type']===_0xce4e('0x45')){_0x3e15ea['uniqueid']=_0x94673b[_0xce4e('0x40')]['id'];}else{_0x3e15ea['id']=_0x94673b[_0xce4e('0x40')]['id'];}return db[_0xce4e('0x3d')][_0xce4e('0x41')]({'where':_0x3e15ea,'attributes':['id','savePath',_0xce4e('0x46')],'raw':!![]})[_0xce4e('0x22')](handleEntityNotFound(_0x1d8676,null))[_0xce4e('0x22')](function(_0x19d62c){if(_0x19d62c){var _0x4012a1=_0x19d62c[_0xce4e('0x47')];var _0x2b1126=util[_0xce4e('0x48')]('%s.cypher',_0x4012a1);if(fs['existsSync'](_0x2b1126)){_0x2e51ea=!![];return _0x3de9de[_0xce4e('0x49')](_0x2b1126,_0x4012a1,config[_0xce4e('0x4a')][_0xce4e('0x4b')])[_0xce4e('0x22')](function(){return _0x19d62c;});}return _0x19d62c;}})[_0xce4e('0x22')](function(_0x36df77){if(_0x36df77){var _0xe754df=_0x36df77[_0xce4e('0x47')];if(!fs['existsSync'](_0xe754df)){throw new db[(_0xce4e('0x4c'))][(_0xce4e('0x4d'))](_0xce4e('0x4e'));}if(_0x36df77[_0xce4e('0x46')]){return _0x1d8676[_0xce4e('0x4f')](_0xe754df,_0x36df77[_0xce4e('0x46')]+path[_0xce4e('0x50')](_0xe754df),function(){if(_0x2e51ea){fs[_0xce4e('0x51')](_0xe754df);}});}else{return _0x1d8676['download'](_0xe754df,function(_0x4fbc39){if(_0x2e51ea){fs[_0xce4e('0x51')](_0xe754df);}});}}})[_0xce4e('0x42')](function(_0x400cea){if(_0x400cea[_0xce4e('0x52')]===_0xce4e('0x4e')){_0x1d8676['status'](0x194)[_0xce4e('0x26')](_0xce4e('0x53'));}else{return handleError(_0x1d8676,null);}});};exports['destroy']=function(_0x2954ce,_0x3d690e){return db[_0xce4e('0x3d')][_0xce4e('0x41')]({'where':{'id':_0x2954ce[_0xce4e('0x40')]['id']}})['then'](function(_0x4df582){if(_['isNil'](_0x4df582)){throw new ReferenceError(_0xce4e('0x54'));}return _0x4df582;})[_0xce4e('0x22')](function(_0x5c20c0){var _0x4abf9c=_0x5c20c0[_0xce4e('0x47')];logger[_0xce4e('0x55')](_0xce4e('0x56'),_0x4abf9c);if(!_[_0xce4e('0x57')](_0x5c20c0[_0xce4e('0x47')])&&fs[_0xce4e('0x58')](_0x4abf9c)){logger[_0xce4e('0x55')]('File:\x20\x22'+_0x4abf9c+_0xce4e('0x59'));fs[_0xce4e('0x5a')](_0x4abf9c);}_0x4abf9c=_0x4abf9c+_0xce4e('0x5b');if(!_[_0xce4e('0x57')](_0x5c20c0['savePath'])&&fs[_0xce4e('0x58')](_0x4abf9c)){logger[_0xce4e('0x55')](_0xce4e('0x5c')+_0x4abf9c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xce4e('0x5a')](_0x4abf9c);}return _0x5c20c0;})[_0xce4e('0x22')](function(_0x5cd6ac){if(!_0x5cd6ac)throw new InternalError();return _0x5cd6ac['destroy']();})[_0xce4e('0x22')](function(){_0x3d690e[_0xce4e('0x18')](0xcc)[_0xce4e('0x23')]();})['catch'](handleError(_0x3d690e,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 66431cb..3da7f66 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 _0xe714=['path','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','../../config/logger','api','moment','bluebird'];(function(_0x43955a,_0x176c18){var _0x360669=function(_0x55949f){while(--_0x55949f){_0x43955a['push'](_0x43955a['shift']());}};_0x360669(++_0x176c18);}(_0xe714,0xe2));var _0x4e71=function(_0x539333,_0x8abe9c){_0x539333=_0x539333-0x0;var _0x5bcb6a=_0xe714[_0x539333];return _0x5bcb6a;};'use strict';var _=require(_0x4e71('0x0'));var util=require('util');var logger=require(_0x4e71('0x1'))(_0x4e71('0x2'));var moment=require(_0x4e71('0x3'));var BPromise=require(_0x4e71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e71('0x5'));var rimraf=require('rimraf');var config=require(_0x4e71('0x6'));var attributes=require(_0x4e71('0x7'));module[_0x4e71('0x8')]=function(_0x204a19,_0xfe1559){return _0x204a19[_0x4e71('0x9')]('SquareRecording',attributes,{'tableName':_0x4e71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x292c=['define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x3f1718,_0x5360ad){var _0x29627e=function(_0x18abc1){while(--_0x18abc1){_0x3f1718['push'](_0x3f1718['shift']());}};_0x29627e(++_0x5360ad);}(_0x292c,0x66));var _0xc292=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x292c[_0x5b6cf1];return _0x46278c;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var logger=require(_0xc292('0x1'))(_0xc292('0x2'));var moment=require(_0xc292('0x3'));var BPromise=require(_0xc292('0x4'));var rp=require(_0xc292('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc292('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xc292('0x7')]=function(_0x1c45ed,_0x2c01eb){return _0x1c45ed[_0xc292('0x8')](_0xc292('0x9'),attributes,{'tableName':_0xc292('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index cf4557c..86c42c5 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 _0x0ebf=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','body','options','debug','stringify','util','moment'];(function(_0x16cfb0,_0x28d646){var _0x3d8504=function(_0x415941){while(--_0x415941){_0x16cfb0['push'](_0x16cfb0['shift']());}};_0x3d8504(++_0x28d646);}(_0x0ebf,0xce));var _0xf0eb=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x0ebf[_0x280f4a];return _0x1bb157;};'use strict';var _=require('lodash');var util=require(_0xf0eb('0x0'));var moment=require(_0xf0eb('0x1'));var BPromise=require('bluebird');var rs=require(_0xf0eb('0x2'));var fs=require('fs');var Redis=require(_0xf0eb('0x3'));var db=require(_0xf0eb('0x4'))['db'];var utils=require(_0xf0eb('0x5'));var logger=require('../../config/logger')(_0xf0eb('0x6'));var config=require(_0xf0eb('0x7'));var jayson=require(_0xf0eb('0x8'));var client=jayson[_0xf0eb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23daae,_0x3cb5a0,_0x5e439e){return new BPromise(function(_0x1297b0,_0x184041){return client['request'](_0x23daae,_0x5e439e)[_0xf0eb('0xa')](function(_0x301682){logger[_0xf0eb('0xb')]('SquareRecording,\x20%s,\x20%s',_0x3cb5a0,'request\x20sent');logger['debug'](_0xf0eb('0xc'),_0x3cb5a0,_0xf0eb('0xd'),JSON['stringify'](_0x301682));if(_0x301682[_0xf0eb('0xe')]){if(_0x301682[_0xf0eb('0xe')][_0xf0eb('0xf')]===0x1f4){logger[_0xf0eb('0xe')](_0xf0eb('0x10'),_0x3cb5a0,_0x301682[_0xf0eb('0xe')][_0xf0eb('0x11')]);return _0x184041(_0x301682[_0xf0eb('0xe')][_0xf0eb('0x11')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x3cb5a0,_0x301682[_0xf0eb('0xe')][_0xf0eb('0x11')]);return _0x1297b0(_0x301682[_0xf0eb('0xe')][_0xf0eb('0x11')]);}else{logger['info'](_0xf0eb('0x10'),_0x3cb5a0,'request\x20sent');_0x1297b0(_0x301682['result'][_0xf0eb('0x11')]);}})[_0xf0eb('0x12')](function(_0x39b983){logger[_0xf0eb('0xe')](_0xf0eb('0x10'),_0x3cb5a0,_0x39b983);_0x184041(_0x39b983);});});}exports[_0xf0eb('0x13')]=function(_0x65b8e5){var _0x6bcd7b=this;return new Promise(function(_0x178d67,_0x2bdfd6){return db[_0xf0eb('0x14')][_0xf0eb('0x15')](_0x65b8e5[_0xf0eb('0x16')],{'raw':_0x65b8e5['options']?_0x65b8e5[_0xf0eb('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf0eb('0xa')](function(_0x1a89cb){logger['info'](_0xf0eb('0x13'),_0x65b8e5);logger[_0xf0eb('0x18')](_0xf0eb('0x13'),_0x65b8e5,JSON[_0xf0eb('0x19')](_0x1a89cb));_0x178d67(_0x1a89cb);})[_0xf0eb('0x12')](function(_0x1139ac){logger[_0xf0eb('0xe')](_0xf0eb('0x13'),_0x1139ac[_0xf0eb('0x11')],_0x65b8e5);_0x2bdfd6(_0x6bcd7b[_0xf0eb('0xe')](0x1f4,_0x1139ac[_0xf0eb('0x11')]));});});}; \ No newline at end of file +var _0xfde2=['SquareRecording','create','body','options','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareRecording'];(function(_0x52cade,_0x48ab23){var _0xe4b4a1=function(_0x2fafaa){while(--_0x2fafaa){_0x52cade['push'](_0x52cade['shift']());}};_0xe4b4a1(++_0x48ab23);}(_0xfde2,0xea));var _0x2fde=function(_0x4bd64d,_0x3c2b8a){_0x4bd64d=_0x4bd64d-0x0;var _0x37db2d=_0xfde2[_0x4bd64d];return _0x37db2d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2fde('0x0'));var fs=require('fs');var Redis=require(_0x2fde('0x1'));var db=require(_0x2fde('0x2'))['db'];var utils=require(_0x2fde('0x3'));var logger=require('../../config/logger')(_0x2fde('0x4'));var config=require('../../config/environment');var jayson=require(_0x2fde('0x5'));var client=jayson[_0x2fde('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eb6c8,_0x4e5d60,_0x319a03){return new BPromise(function(_0x32c9f7,_0x3d21b7){return client[_0x2fde('0x7')](_0x4eb6c8,_0x319a03)[_0x2fde('0x8')](function(_0x557e0c){logger[_0x2fde('0x9')](_0x2fde('0xa'),_0x4e5d60,_0x2fde('0xb'));logger[_0x2fde('0xc')](_0x2fde('0xd'),_0x4e5d60,_0x2fde('0xb'),JSON['stringify'](_0x557e0c));if(_0x557e0c[_0x2fde('0xe')]){if(_0x557e0c[_0x2fde('0xe')]['code']===0x1f4){logger[_0x2fde('0xe')](_0x2fde('0xa'),_0x4e5d60,_0x557e0c[_0x2fde('0xe')][_0x2fde('0xf')]);return _0x3d21b7(_0x557e0c[_0x2fde('0xe')][_0x2fde('0xf')]);}logger[_0x2fde('0xe')]('SquareRecording,\x20%s,\x20%s',_0x4e5d60,_0x557e0c[_0x2fde('0xe')][_0x2fde('0xf')]);return _0x32c9f7(_0x557e0c[_0x2fde('0xe')]['message']);}else{logger[_0x2fde('0x9')](_0x2fde('0xa'),_0x4e5d60,_0x2fde('0xb'));_0x32c9f7(_0x557e0c[_0x2fde('0x10')][_0x2fde('0xf')]);}})[_0x2fde('0x11')](function(_0xf04f2e){logger[_0x2fde('0xe')](_0x2fde('0xa'),_0x4e5d60,_0xf04f2e);_0x3d21b7(_0xf04f2e);});});}exports[_0x2fde('0x12')]=function(_0x2b2e0a){var _0x3c9d79=this;return new Promise(function(_0xa7f1fe,_0xd1988){return db[_0x2fde('0x13')][_0x2fde('0x14')](_0x2b2e0a[_0x2fde('0x15')],{'raw':_0x2b2e0a[_0x2fde('0x16')]?_0x2b2e0a['options']['raw']===undefined?!![]:![]:!![]})[_0x2fde('0x8')](function(_0x4dd173){logger['info'](_0x2fde('0x12'),_0x2b2e0a);logger[_0x2fde('0xc')](_0x2fde('0x12'),_0x2b2e0a,JSON['stringify'](_0x4dd173));_0xa7f1fe(_0x4dd173);})[_0x2fde('0x11')](function(_0x117135){logger['error'](_0x2fde('0x12'),_0x117135[_0x2fde('0xf')],_0x2b2e0a);_0xd1988(_0x3c9d79[_0x2fde('0xe')](0x1f4,_0x117135[_0x2fde('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 038a820..2bade3b 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(_0x3899a3,_0xcb527){var _0x13e1ce=function(_0x19cdb4){while(--_0x19cdb4){_0x3899a3['push'](_0x3899a3['shift']());}};_0x13e1ce(++_0xcb527);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x58c053,_0x51c43f){var _0xe1079=function(_0x172345){while(--_0x172345){_0x58c053['push'](_0x58c053['shift']());}};_0xe1079(++_0x51c43f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 34e16a7..ea38853 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 _0x26c2=['DATE','BOOLEAN','exports','STRING'];(function(_0x2923a7,_0xf9682b){var _0x3679f0=function(_0x5f5408){while(--_0x5f5408){_0x2923a7['push'](_0x2923a7['shift']());}};_0x3679f0(++_0xf9682b);}(_0x26c2,0x1d6));var _0x226c=function(_0x48d7c8,_0x5ecbf5){_0x48d7c8=_0x48d7c8-0x0;var _0x463ded=_0x26c2[_0x48d7c8];return _0x463ded;};'use strict';var Sequelize=require('sequelize');module[_0x226c('0x0')]={'network':{'type':Sequelize[_0x226c('0x1')]},'network_script':{'type':Sequelize[_0x226c('0x1')]},'request':{'type':Sequelize[_0x226c('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x226c('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x226c('0x1')]},'version':{'type':Sequelize[_0x226c('0x1')]},'callerid':{'type':Sequelize[_0x226c('0x1')]},'calleridname':{'type':Sequelize[_0x226c('0x1')]},'callingpres':{'type':Sequelize[_0x226c('0x1')]},'callingani2':{'type':Sequelize[_0x226c('0x1')]},'callington':{'type':Sequelize[_0x226c('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x226c('0x1')]},'extension':{'type':Sequelize[_0x226c('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x226c('0x1')]},'accountcode':{'type':Sequelize[_0x226c('0x1')]},'threadid':{'type':Sequelize[_0x226c('0x1')]},'project_name':{'type':Sequelize[_0x226c('0x1')]},'joinAt':{'type':Sequelize[_0x226c('0x2')]},'leaveAt':{'type':Sequelize[_0x226c('0x2')]},'bot':{'type':Sequelize[_0x226c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x12ff=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x53bcd4,_0x4dc740){var _0x455aff=function(_0x103f0e){while(--_0x103f0e){_0x53bcd4['push'](_0x53bcd4['shift']());}};_0x455aff(++_0x4dc740);}(_0x12ff,0xab));var _0xf12f=function(_0x23d5d5,_0x113300){_0x23d5d5=_0x23d5d5-0x0;var _0x590cf0=_0x12ff[_0x23d5d5];return _0x590cf0;};'use strict';var Sequelize=require(_0xf12f('0x0'));module['exports']={'network':{'type':Sequelize[_0xf12f('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xf12f('0x1')]},'channel':{'type':Sequelize[_0xf12f('0x1')]},'language':{'type':Sequelize[_0xf12f('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf12f('0x1')]},'version':{'type':Sequelize[_0xf12f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xf12f('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xf12f('0x1')]},'dnid':{'type':Sequelize[_0xf12f('0x1')]},'rdnis':{'type':Sequelize[_0xf12f('0x1')]},'context':{'type':Sequelize[_0xf12f('0x1')]},'extension':{'type':Sequelize[_0xf12f('0x1')]},'priority':{'type':Sequelize[_0xf12f('0x1')]},'enhanced':{'type':Sequelize[_0xf12f('0x1')]},'accountcode':{'type':Sequelize[_0xf12f('0x1')]},'threadid':{'type':Sequelize[_0xf12f('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf12f('0x2')]},'leaveAt':{'type':Sequelize[_0xf12f('0x2')]},'bot':{'type':Sequelize[_0xf12f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6079628..d2646ec 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 _0xb59e=['count','limit','Content-Range','json','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SquareReport','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0xbdaf7f,_0x425432){var _0x374cc4=function(_0x4c46ed){while(--_0x4c46ed){_0xbdaf7f['push'](_0xbdaf7f['shift']());}};_0x374cc4(++_0x425432);}(_0xb59e,0xbe));var _0xeb59=function(_0x344a76,_0x373cbe){_0x344a76=_0x344a76-0x0;var _0x165cb3=_0xb59e[_0x344a76];return _0x165cb3;};'use strict';var emlformat=require(_0xeb59('0x0'));var rimraf=require(_0xeb59('0x1'));var zipdir=require(_0xeb59('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb59('0x3'));var moment=require('moment');var BPromise=require(_0xeb59('0x4'));var Mustache=require(_0xeb59('0x5'));var util=require(_0xeb59('0x6'));var path=require(_0xeb59('0x7'));var sox=require(_0xeb59('0x8'));var csv=require('to-csv');var ejs=require(_0xeb59('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb59('0xa'));var squel=require(_0xeb59('0xb'));var crypto=require(_0xeb59('0xc'));var jsforce=require(_0xeb59('0xd'));var deskjs=require(_0xeb59('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb59('0xf'));var Papa=require('papaparse');var Redis=require(_0xeb59('0x10'));var authService=require(_0xeb59('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb59('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xeb59('0x13'));var licenseUtil=require(_0xeb59('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c64b,_0xceea9c){_0xceea9c=_0xceea9c||0xcc;return function(_0x5c4bd4){if(_0x5c4bd4){return _0x45c64b[_0xeb59('0x15')](_0xceea9c);}return _0x45c64b[_0xeb59('0x16')](_0xceea9c)[_0xeb59('0x17')]();};}function respondWithResult(_0x528f05,_0x2b71f7){_0x2b71f7=_0x2b71f7||0xc8;return function(_0x2e9feb){if(_0x2e9feb){return _0x528f05['status'](_0x2b71f7)['json'](_0x2e9feb);}};}function respondWithFilteredResult(_0x263500,_0x3c71a4){return function(_0x5b30e5){if(_0x5b30e5){var _0x50e95f=typeof _0x3c71a4[_0xeb59('0x18')]===_0xeb59('0x19')&&typeof _0x3c71a4['limit']==='undefined';var _0x1e9557=_0x5b30e5[_0xeb59('0x1a')];var _0x2f010a=_0x50e95f?0x0:_0x3c71a4[_0xeb59('0x18')];var _0x2610f3=_0x50e95f?_0x5b30e5[_0xeb59('0x1a')]:_0x3c71a4[_0xeb59('0x18')]+_0x3c71a4[_0xeb59('0x1b')];var _0x44ce70;if(_0x2610f3>=_0x1e9557){_0x2610f3=_0x1e9557;_0x44ce70=0xc8;}else{_0x44ce70=0xce;}_0x263500[_0xeb59('0x16')](_0x44ce70);return _0x263500['set'](_0xeb59('0x1c'),_0x2f010a+'-'+_0x2610f3+'/'+_0x1e9557)[_0xeb59('0x1d')](_0x5b30e5);}return null;};}function patchUpdates(_0x3a228d){return function(_0x194f72){try{jsonpatch['apply'](_0x194f72,_0x3a228d,!![]);}catch(_0x1cc639){return BPromise[_0xeb59('0x1e')](_0x1cc639);}return _0x194f72[_0xeb59('0x1f')]();};}function saveUpdates(_0x17ea5c,_0x45cb49){return function(_0x22ea64){if(_0x22ea64){return _0x22ea64['update'](_0x17ea5c)[_0xeb59('0x20')](function(_0x19cb74){return _0x19cb74;});}return null;};}function removeEntity(_0x138127,_0xd509ac){return function(_0x48b96a){if(_0x48b96a){return _0x48b96a[_0xeb59('0x21')]()[_0xeb59('0x20')](function(){_0x138127[_0xeb59('0x16')](0xcc)[_0xeb59('0x17')]();});}};}function handleEntityNotFound(_0x18681f,_0x6c6332){return function(_0x36caa5){if(!_0x36caa5){_0x18681f[_0xeb59('0x15')](0x194);}return _0x36caa5;};}function handleError(_0x166681,_0x2efa6b){_0x2efa6b=_0x2efa6b||0x1f4;return function(_0x4a1685){logger[_0xeb59('0x22')](_0x4a1685[_0xeb59('0x23')]);if(_0x4a1685[_0xeb59('0x24')]){delete _0x4a1685['name'];}_0x166681['status'](_0x2efa6b)[_0xeb59('0x25')](_0x4a1685);};}exports['index']=function(_0x35de54,_0x1ad4da){var _0x5db872={},_0x822c74={},_0x1442d7={'count':0x0,'rows':[]};var _0x116111=_[_0xeb59('0x26')](db['SquareReport'][_0xeb59('0x27')],function(_0x45b05a){return{'name':_0x45b05a[_0xeb59('0x28')],'type':_0x45b05a['type'][_0xeb59('0x29')]};});_0x822c74[_0xeb59('0x2a')]=_[_0xeb59('0x26')](_0x116111,'name');_0x822c74[_0xeb59('0x2b')]=_[_0xeb59('0x2c')](_0x35de54[_0xeb59('0x2b')]);_0x822c74[_0xeb59('0x2d')]=_[_0xeb59('0x2e')](_0x822c74[_0xeb59('0x2a')],_0x822c74[_0xeb59('0x2b')]);_0x5db872['attributes']=_['intersection'](_0x822c74[_0xeb59('0x2a')],qs['fields'](_0x35de54[_0xeb59('0x2b')][_0xeb59('0x2f')]));_0x5db872[_0xeb59('0x30')]=_0x5db872[_0xeb59('0x30')][_0xeb59('0x31')]?_0x5db872['attributes']:_0x822c74[_0xeb59('0x2a')];if(!_0x35de54['query']['hasOwnProperty'](_0xeb59('0x32'))){_0x5db872[_0xeb59('0x1b')]=qs[_0xeb59('0x1b')](_0x35de54['query'][_0xeb59('0x1b')]);_0x5db872[_0xeb59('0x18')]=qs[_0xeb59('0x18')](_0x35de54[_0xeb59('0x2b')][_0xeb59('0x18')]);}_0x5db872[_0xeb59('0x33')]=qs[_0xeb59('0x34')](_0x35de54[_0xeb59('0x2b')]['sort']);_0x5db872[_0xeb59('0x35')]=qs[_0xeb59('0x2d')](_[_0xeb59('0x36')](_0x35de54['query'],_0x822c74[_0xeb59('0x2d')]),_0x116111);if(_0x35de54['query'][_0xeb59('0x37')]){_0x5db872[_0xeb59('0x35')]=_[_0xeb59('0x38')](_0x5db872[_0xeb59('0x35')],{'$or':_[_0xeb59('0x26')](_0x116111,function(_0x45a24f){if(_0x45a24f[_0xeb59('0x39')]!==_0xeb59('0x3a')){var _0x5639f9={};_0x5639f9[_0x45a24f[_0xeb59('0x24')]]={'$like':'%'+_0x35de54[_0xeb59('0x2b')][_0xeb59('0x37')]+'%'};return _0x5639f9;}})});}_0x5db872=_[_0xeb59('0x38')]({},_0x5db872,_0x35de54['options']);var _0x376826={'where':_0x5db872[_0xeb59('0x35')]};return db[_0xeb59('0x3b')][_0xeb59('0x1a')](_0x376826)[_0xeb59('0x20')](function(_0x4a42e6){_0x1442d7[_0xeb59('0x1a')]=_0x4a42e6;if(_0x35de54[_0xeb59('0x2b')]['includeAll']){_0x5db872[_0xeb59('0x3c')]=[{'all':!![]}];}return db[_0xeb59('0x3b')][_0xeb59('0x3d')](_0x5db872);})[_0xeb59('0x20')](function(_0x3f9fa3){_0x1442d7[_0xeb59('0x3e')]=_0x3f9fa3;return _0x1442d7;})[_0xeb59('0x20')](respondWithFilteredResult(_0x1ad4da,_0x5db872))[_0xeb59('0x3f')](handleError(_0x1ad4da,null));};exports[_0xeb59('0x40')]=function(_0x28a554,_0x5b5d20){var _0x3b087a={'raw':!![],'where':{'id':_0x28a554[_0xeb59('0x41')]['id']}},_0x3508f2={};_0x3508f2[_0xeb59('0x2a')]=_['keys'](db[_0xeb59('0x3b')][_0xeb59('0x27')]);_0x3508f2[_0xeb59('0x2b')]=_[_0xeb59('0x2c')](_0x28a554[_0xeb59('0x2b')]);_0x3508f2['filters']=_['intersection'](_0x3508f2[_0xeb59('0x2a')],_0x3508f2[_0xeb59('0x2b')]);_0x3b087a['attributes']=_['intersection'](_0x3508f2[_0xeb59('0x2a')],qs['fields'](_0x28a554['query'][_0xeb59('0x2f')]));_0x3b087a[_0xeb59('0x30')]=_0x3b087a[_0xeb59('0x30')][_0xeb59('0x31')]?_0x3b087a[_0xeb59('0x30')]:_0x3508f2[_0xeb59('0x2a')];if(_0x28a554[_0xeb59('0x2b')]['includeAll']){_0x3b087a[_0xeb59('0x3c')]=[{'all':!![]}];}_0x3b087a=_[_0xeb59('0x38')]({},_0x3b087a,_0x28a554[_0xeb59('0x42')]);return db['SquareReport'][_0xeb59('0x43')](_0x3b087a)[_0xeb59('0x20')](handleEntityNotFound(_0x5b5d20,null))[_0xeb59('0x20')](respondWithResult(_0x5b5d20,null))[_0xeb59('0x3f')](handleError(_0x5b5d20,null));};exports['create']=function(_0x6c53d7,_0x32dfb2){return db[_0xeb59('0x3b')][_0xeb59('0x44')](_0x6c53d7[_0xeb59('0x45')],{})[_0xeb59('0x20')](respondWithResult(_0x32dfb2,0xc9))[_0xeb59('0x3f')](handleError(_0x32dfb2,null));};exports[_0xeb59('0x46')]=function(_0x3ce87e,_0x1e7ece){if(_0x3ce87e[_0xeb59('0x45')]['id']){delete _0x3ce87e[_0xeb59('0x45')]['id'];}return db[_0xeb59('0x3b')][_0xeb59('0x43')]({'where':{'id':_0x3ce87e[_0xeb59('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e7ece,null))[_0xeb59('0x20')](saveUpdates(_0x3ce87e[_0xeb59('0x45')],null))[_0xeb59('0x20')](respondWithResult(_0x1e7ece,null))[_0xeb59('0x3f')](handleError(_0x1e7ece,null));};exports[_0xeb59('0x21')]=function(_0x3a59c0,_0x1de702){return db[_0xeb59('0x3b')][_0xeb59('0x43')]({'where':{'id':_0x3a59c0[_0xeb59('0x41')]['id']}})[_0xeb59('0x20')](handleEntityNotFound(_0x1de702,null))[_0xeb59('0x20')](removeEntity(_0x1de702,null))['catch'](handleError(_0x1de702,null));};exports[_0xeb59('0x47')]=function(_0x491915,_0x2ef69b){return db['SquareReport'][_0xeb59('0x47')]()['then'](respondWithResult(_0x2ef69b,null))[_0xeb59('0x3f')](handleError(_0x2ef69b,null));}; \ No newline at end of file +var _0x0477=['undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','options','include','findAll','rows','catch','includeAll','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json'];(function(_0x2a9694,_0x27b729){var _0x1d58bb=function(_0x32160b){while(--_0x32160b){_0x2a9694['push'](_0x2a9694['shift']());}};_0x1d58bb(++_0x27b729);}(_0x0477,0x19e));var _0x7047=function(_0xcd4d8e,_0x1fc2fd){_0xcd4d8e=_0xcd4d8e-0x0;var _0x1c3c61=_0x0477[_0xcd4d8e];return _0x1c3c61;};'use strict';var emlformat=require(_0x7047('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7047('0x1'));var jsonpatch=require(_0x7047('0x2'));var rp=require(_0x7047('0x3'));var moment=require(_0x7047('0x4'));var BPromise=require(_0x7047('0x5'));var Mustache=require(_0x7047('0x6'));var util=require(_0x7047('0x7'));var path=require(_0x7047('0x8'));var sox=require(_0x7047('0x9'));var csv=require(_0x7047('0xa'));var ejs=require(_0x7047('0xb'));var fs=require('fs');var fs_extra=require(_0x7047('0xc'));var _=require(_0x7047('0xd'));var squel=require('squel');var crypto=require(_0x7047('0xe'));var jsforce=require(_0x7047('0xf'));var deskjs=require(_0x7047('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7047('0x11'));var Papa=require(_0x7047('0x12'));var Redis=require(_0x7047('0x13'));var authService=require(_0x7047('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7047('0x15'));var hardwareService=require(_0x7047('0x16'));var logger=require(_0x7047('0x17'))(_0x7047('0x18'));var utils=require('../../config/utils');var config=require(_0x7047('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34e05b,_0x1e2f73){_0x1e2f73=_0x1e2f73||0xcc;return function(_0x536d91){if(_0x536d91){return _0x34e05b[_0x7047('0x1a')](_0x1e2f73);}return _0x34e05b[_0x7047('0x1b')](_0x1e2f73)[_0x7047('0x1c')]();};}function respondWithResult(_0x41babe,_0x228bb8){_0x228bb8=_0x228bb8||0xc8;return function(_0x54087d){if(_0x54087d){return _0x41babe[_0x7047('0x1b')](_0x228bb8)[_0x7047('0x1d')](_0x54087d);}};}function respondWithFilteredResult(_0x17917c,_0x1d315f){return function(_0x698d66){if(_0x698d66){var _0x3ecdf9=typeof _0x1d315f['offset']===_0x7047('0x1e')&&typeof _0x1d315f[_0x7047('0x1f')]===_0x7047('0x1e');var _0x5541d0=_0x698d66[_0x7047('0x20')];var _0x18ad98=_0x3ecdf9?0x0:_0x1d315f[_0x7047('0x21')];var _0x4268a1=_0x3ecdf9?_0x698d66[_0x7047('0x20')]:_0x1d315f['offset']+_0x1d315f[_0x7047('0x1f')];var _0x220b77;if(_0x4268a1>=_0x5541d0){_0x4268a1=_0x5541d0;_0x220b77=0xc8;}else{_0x220b77=0xce;}_0x17917c[_0x7047('0x1b')](_0x220b77);return _0x17917c['set'](_0x7047('0x22'),_0x18ad98+'-'+_0x4268a1+'/'+_0x5541d0)['json'](_0x698d66);}return null;};}function patchUpdates(_0x5cc1ae){return function(_0xe86a74){try{jsonpatch[_0x7047('0x23')](_0xe86a74,_0x5cc1ae,!![]);}catch(_0x1e4656){return BPromise['reject'](_0x1e4656);}return _0xe86a74[_0x7047('0x24')]();};}function saveUpdates(_0x3d7871,_0x5069e8){return function(_0xb7212e){if(_0xb7212e){return _0xb7212e[_0x7047('0x25')](_0x3d7871)[_0x7047('0x26')](function(_0x2064f4){return _0x2064f4;});}return null;};}function removeEntity(_0xa4bfb9,_0x28ec5e){return function(_0x1443c2){if(_0x1443c2){return _0x1443c2[_0x7047('0x27')]()[_0x7047('0x26')](function(){_0xa4bfb9[_0x7047('0x1b')](0xcc)[_0x7047('0x1c')]();});}};}function handleEntityNotFound(_0x3707b7,_0x233ae7){return function(_0x172b66){if(!_0x172b66){_0x3707b7[_0x7047('0x1a')](0x194);}return _0x172b66;};}function handleError(_0xaa41af,_0x3feadc){_0x3feadc=_0x3feadc||0x1f4;return function(_0x121947){logger[_0x7047('0x28')](_0x121947[_0x7047('0x29')]);if(_0x121947['name']){delete _0x121947[_0x7047('0x2a')];}_0xaa41af[_0x7047('0x1b')](_0x3feadc)[_0x7047('0x2b')](_0x121947);};}exports[_0x7047('0x2c')]=function(_0x48c538,_0x84a64b){var _0x582066={},_0x920b3c={},_0x201bbd={'count':0x0,'rows':[]};var _0x5acad5=_[_0x7047('0x2d')](db[_0x7047('0x2e')][_0x7047('0x2f')],function(_0x5b8933){return{'name':_0x5b8933[_0x7047('0x30')],'type':_0x5b8933[_0x7047('0x31')][_0x7047('0x32')]};});_0x920b3c[_0x7047('0x33')]=_['map'](_0x5acad5,'name');_0x920b3c[_0x7047('0x34')]=_[_0x7047('0x35')](_0x48c538[_0x7047('0x34')]);_0x920b3c[_0x7047('0x36')]=_[_0x7047('0x37')](_0x920b3c[_0x7047('0x33')],_0x920b3c[_0x7047('0x34')]);_0x582066[_0x7047('0x38')]=_[_0x7047('0x37')](_0x920b3c[_0x7047('0x33')],qs[_0x7047('0x39')](_0x48c538[_0x7047('0x34')][_0x7047('0x39')]));_0x582066[_0x7047('0x38')]=_0x582066[_0x7047('0x38')][_0x7047('0x3a')]?_0x582066[_0x7047('0x38')]:_0x920b3c[_0x7047('0x33')];if(!_0x48c538[_0x7047('0x34')]['hasOwnProperty'](_0x7047('0x3b'))){_0x582066[_0x7047('0x1f')]=qs[_0x7047('0x1f')](_0x48c538[_0x7047('0x34')][_0x7047('0x1f')]);_0x582066[_0x7047('0x21')]=qs['offset'](_0x48c538['query']['offset']);}_0x582066['order']=qs[_0x7047('0x3c')](_0x48c538[_0x7047('0x34')]['sort']);_0x582066[_0x7047('0x3d')]=qs[_0x7047('0x36')](_['pick'](_0x48c538[_0x7047('0x34')],_0x920b3c[_0x7047('0x36')]),_0x5acad5);if(_0x48c538[_0x7047('0x34')][_0x7047('0x3e')]){_0x582066['where']=_[_0x7047('0x3f')](_0x582066[_0x7047('0x3d')],{'$or':_[_0x7047('0x2d')](_0x5acad5,function(_0x39a384){if(_0x39a384[_0x7047('0x31')]!=='VIRTUAL'){var _0x8ca023={};_0x8ca023[_0x39a384['name']]={'$like':'%'+_0x48c538['query'][_0x7047('0x3e')]+'%'};return _0x8ca023;}})});}_0x582066=_[_0x7047('0x3f')]({},_0x582066,_0x48c538[_0x7047('0x40')]);var _0x252b1d={'where':_0x582066[_0x7047('0x3d')]};return db[_0x7047('0x2e')][_0x7047('0x20')](_0x252b1d)[_0x7047('0x26')](function(_0x8a6ca6){_0x201bbd[_0x7047('0x20')]=_0x8a6ca6;if(_0x48c538[_0x7047('0x34')]['includeAll']){_0x582066[_0x7047('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0x7047('0x42')](_0x582066);})[_0x7047('0x26')](function(_0x53fa96){_0x201bbd[_0x7047('0x43')]=_0x53fa96;return _0x201bbd;})[_0x7047('0x26')](respondWithFilteredResult(_0x84a64b,_0x582066))[_0x7047('0x44')](handleError(_0x84a64b,null));};exports['show']=function(_0x297cdf,_0xfc3529){var _0x598f4={'raw':!![],'where':{'id':_0x297cdf['params']['id']}},_0x23fbf7={};_0x23fbf7[_0x7047('0x33')]=_[_0x7047('0x35')](db[_0x7047('0x2e')][_0x7047('0x2f')]);_0x23fbf7['query']=_[_0x7047('0x35')](_0x297cdf['query']);_0x23fbf7[_0x7047('0x36')]=_['intersection'](_0x23fbf7[_0x7047('0x33')],_0x23fbf7[_0x7047('0x34')]);_0x598f4[_0x7047('0x38')]=_[_0x7047('0x37')](_0x23fbf7['model'],qs['fields'](_0x297cdf['query'][_0x7047('0x39')]));_0x598f4[_0x7047('0x38')]=_0x598f4[_0x7047('0x38')][_0x7047('0x3a')]?_0x598f4['attributes']:_0x23fbf7[_0x7047('0x33')];if(_0x297cdf['query'][_0x7047('0x45')]){_0x598f4['include']=[{'all':!![]}];}_0x598f4=_[_0x7047('0x3f')]({},_0x598f4,_0x297cdf['options']);return db['SquareReport'][_0x7047('0x46')](_0x598f4)['then'](handleEntityNotFound(_0xfc3529,null))[_0x7047('0x26')](respondWithResult(_0xfc3529,null))[_0x7047('0x44')](handleError(_0xfc3529,null));};exports['create']=function(_0x537b2c,_0x11a68c){return db[_0x7047('0x2e')]['create'](_0x537b2c[_0x7047('0x47')],{})[_0x7047('0x26')](respondWithResult(_0x11a68c,0xc9))[_0x7047('0x44')](handleError(_0x11a68c,null));};exports[_0x7047('0x25')]=function(_0x20f028,_0x179cd4){if(_0x20f028[_0x7047('0x47')]['id']){delete _0x20f028[_0x7047('0x47')]['id'];}return db[_0x7047('0x2e')]['find']({'where':{'id':_0x20f028[_0x7047('0x48')]['id']}})[_0x7047('0x26')](handleEntityNotFound(_0x179cd4,null))[_0x7047('0x26')](saveUpdates(_0x20f028[_0x7047('0x47')],null))[_0x7047('0x26')](respondWithResult(_0x179cd4,null))[_0x7047('0x44')](handleError(_0x179cd4,null));};exports[_0x7047('0x27')]=function(_0x5851e6,_0x5e79a0){return db['SquareReport'][_0x7047('0x46')]({'where':{'id':_0x5851e6[_0x7047('0x48')]['id']}})[_0x7047('0x26')](handleEntityNotFound(_0x5e79a0,null))[_0x7047('0x26')](removeEntity(_0x5e79a0,null))['catch'](handleError(_0x5e79a0,null));};exports[_0x7047('0x49')]=function(_0x3fa459,_0x2f7d3a){return db[_0x7047('0x2e')][_0x7047('0x49')]()[_0x7047('0x26')](respondWithResult(_0x2f7d3a,null))[_0x7047('0x44')](handleError(_0x2f7d3a,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e720911..0261ca7 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 _0x5e82=['rimraf','./squareReport.attributes','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x5e82,0x1d9));var _0x25e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25e8('0x0'));var util=require(_0x25e8('0x1'));var logger=require(_0x25e8('0x2'))(_0x25e8('0x3'));var moment=require(_0x25e8('0x4'));var BPromise=require(_0x25e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25e8('0x6'));var rimraf=require(_0x25e8('0x7'));var config=require('../../config/environment');var attributes=require(_0x25e8('0x8'));module['exports']=function(_0x106a95,_0x123c34){return _0x106a95[_0x25e8('0x9')](_0x25e8('0xa'),attributes,{'tableName':_0x25e8('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x25e8('0xc'),_0x25e8('0xd')]},{'name':_0x25e8('0xe'),'fields':[_0x25e8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf846=['path','../../config/environment','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5abb00,_0x342d70){var _0xf9b854=function(_0x43ac30){while(--_0x43ac30){_0x5abb00['push'](_0x5abb00['shift']());}};_0xf9b854(++_0x342d70);}(_0xf846,0xf9));var _0x6f84=function(_0x456be1,_0x15afe2){_0x456be1=_0x456be1-0x0;var _0x141535=_0xf846[_0x456be1];return _0x141535;};'use strict';var _=require(_0x6f84('0x0'));var util=require(_0x6f84('0x1'));var logger=require(_0x6f84('0x2'))(_0x6f84('0x3'));var moment=require(_0x6f84('0x4'));var BPromise=require(_0x6f84('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f84('0x6'));var rimraf=require('rimraf');var config=require(_0x6f84('0x7'));var attributes=require('./squareReport.attributes');module[_0x6f84('0x8')]=function(_0x2104b4,_0x347366){return _0x2104b4[_0x6f84('0x9')](_0x6f84('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x6f84('0xb'),'fields':[_0x6f84('0xc'),_0x6f84('0xd')]},{'name':_0x6f84('0xe'),'fields':[_0x6f84('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index dc6aa8c..033575d 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 _0x7d38=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','SquareReport','create','options','raw','CreateSquareReport','UpdateSquareReport','body','where'];(function(_0x287cbb,_0x4d7146){var _0x5dc20b=function(_0x3c4e8d){while(--_0x3c4e8d){_0x287cbb['push'](_0x287cbb['shift']());}};_0x5dc20b(++_0x4d7146);}(_0x7d38,0x6e));var _0x87d3=function(_0x19bbbe,_0x28cbae){_0x19bbbe=_0x19bbbe-0x0;var _0x255c08=_0x7d38[_0x19bbbe];return _0x255c08;};'use strict';var _=require(_0x87d3('0x0'));var util=require(_0x87d3('0x1'));var moment=require(_0x87d3('0x2'));var BPromise=require(_0x87d3('0x3'));var rs=require(_0x87d3('0x4'));var fs=require('fs');var Redis=require(_0x87d3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d3('0x6'));var logger=require(_0x87d3('0x7'))(_0x87d3('0x8'));var config=require(_0x87d3('0x9'));var jayson=require(_0x87d3('0xa'));var client=jayson[_0x87d3('0xb')][_0x87d3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56ab97,_0x205092,_0x55aba3){return new BPromise(function(_0x1a4442,_0x2dd8b0){return client[_0x87d3('0xd')](_0x56ab97,_0x55aba3)[_0x87d3('0xe')](function(_0x444a23){logger[_0x87d3('0xf')]('SquareReport,\x20%s,\x20%s',_0x205092,'request\x20sent');logger[_0x87d3('0x10')](_0x87d3('0x11'),_0x205092,_0x87d3('0x12'),JSON[_0x87d3('0x13')](_0x444a23));if(_0x444a23[_0x87d3('0x14')]){if(_0x444a23['error'][_0x87d3('0x15')]===0x1f4){logger[_0x87d3('0x14')]('SquareReport,\x20%s,\x20%s',_0x205092,_0x444a23[_0x87d3('0x14')][_0x87d3('0x16')]);return _0x2dd8b0(_0x444a23[_0x87d3('0x14')]['message']);}logger[_0x87d3('0x14')](_0x87d3('0x17'),_0x205092,_0x444a23[_0x87d3('0x14')][_0x87d3('0x16')]);return _0x1a4442(_0x444a23['error'][_0x87d3('0x16')]);}else{logger[_0x87d3('0xf')](_0x87d3('0x17'),_0x205092,'request\x20sent');_0x1a4442(_0x444a23[_0x87d3('0x18')][_0x87d3('0x16')]);}})[_0x87d3('0x19')](function(_0x15ab58){logger[_0x87d3('0x14')]('SquareReport,\x20%s,\x20%s',_0x205092,_0x15ab58);_0x2dd8b0(_0x15ab58);});});}exports['CreateSquareReport']=function(_0x37e952){var _0x549574=this;return new Promise(function(_0x4fc916,_0x521a9b){return db[_0x87d3('0x1a')][_0x87d3('0x1b')](_0x37e952['body'],{'raw':_0x37e952[_0x87d3('0x1c')]?_0x37e952[_0x87d3('0x1c')][_0x87d3('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5cf145){logger['info'](_0x87d3('0x1e'),_0x37e952);logger[_0x87d3('0x10')](_0x87d3('0x1e'),_0x37e952,JSON[_0x87d3('0x13')](_0x5cf145));_0x4fc916(_0x5cf145);})[_0x87d3('0x19')](function(_0x404af9){logger[_0x87d3('0x14')](_0x87d3('0x1e'),_0x404af9[_0x87d3('0x16')],_0x37e952);_0x521a9b(_0x549574['error'](0x1f4,_0x404af9[_0x87d3('0x16')]));});});};exports[_0x87d3('0x1f')]=function(_0x24fbc6){var _0xd262c3=this;return new Promise(function(_0x24d287,_0x468f52){return db[_0x87d3('0x1a')]['update'](_0x24fbc6[_0x87d3('0x20')],{'raw':_0x24fbc6[_0x87d3('0x1c')]?_0x24fbc6[_0x87d3('0x1c')][_0x87d3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24fbc6[_0x87d3('0x1c')]?_0x24fbc6[_0x87d3('0x1c')][_0x87d3('0x21')]||null:null,'attributes':_0x24fbc6[_0x87d3('0x1c')]?_0x24fbc6[_0x87d3('0x1c')][_0x87d3('0x22')]||null:null,'limit':_0x24fbc6[_0x87d3('0x1c')]?_0x24fbc6[_0x87d3('0x1c')][_0x87d3('0x23')]||null:null})[_0x87d3('0xe')](function(_0x27adf5){logger['info'](_0x87d3('0x1f'),_0x24fbc6);logger['debug'](_0x87d3('0x1f'),_0x24fbc6,JSON[_0x87d3('0x13')](_0x27adf5));_0x24d287(_0x27adf5);})[_0x87d3('0x19')](function(_0x5a0b9b){logger[_0x87d3('0x14')](_0x87d3('0x1f'),_0x5a0b9b['message'],_0x24fbc6);_0x468f52(_0xd262c3[_0x87d3('0x14')](0x1f4,_0x5a0b9b['message']));});});}; \ No newline at end of file +var _0x5afa=['http','request','then','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','CreateSquareReport','SquareReport','options','raw','info','UpdateSquareReport','where','limit','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x5afa,0x8a));var _0xa5af=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x5afa[_0x38a7ac];return _0x53061a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa5af('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5af('0x1'));var db=require(_0xa5af('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5af('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa5af('0x4'));var client=jayson[_0xa5af('0x5')][_0xa5af('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x324e75,_0x3f5f35,_0x45aa0d){return new BPromise(function(_0x87a9f1,_0x127640){return client[_0xa5af('0x7')](_0x324e75,_0x45aa0d)[_0xa5af('0x8')](function(_0x44741f){logger['info'](_0xa5af('0x9'),_0x3f5f35,'request\x20sent');logger[_0xa5af('0xa')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x3f5f35,_0xa5af('0xb'),JSON[_0xa5af('0xc')](_0x44741f));if(_0x44741f[_0xa5af('0xd')]){if(_0x44741f[_0xa5af('0xd')][_0xa5af('0xe')]===0x1f4){logger['error'](_0xa5af('0x9'),_0x3f5f35,_0x44741f[_0xa5af('0xd')][_0xa5af('0xf')]);return _0x127640(_0x44741f['error'][_0xa5af('0xf')]);}logger[_0xa5af('0xd')](_0xa5af('0x9'),_0x3f5f35,_0x44741f[_0xa5af('0xd')][_0xa5af('0xf')]);return _0x87a9f1(_0x44741f[_0xa5af('0xd')]['message']);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x3f5f35,_0xa5af('0xb'));_0x87a9f1(_0x44741f['result'][_0xa5af('0xf')]);}})['catch'](function(_0xca3b3a){logger[_0xa5af('0xd')](_0xa5af('0x9'),_0x3f5f35,_0xca3b3a);_0x127640(_0xca3b3a);});});}exports[_0xa5af('0x10')]=function(_0x37c887){var _0x527077=this;return new Promise(function(_0xfe1a31,_0x5581af){return db[_0xa5af('0x11')]['create'](_0x37c887['body'],{'raw':_0x37c887[_0xa5af('0x12')]?_0x37c887[_0xa5af('0x12')][_0xa5af('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x1703c0){logger[_0xa5af('0x14')](_0xa5af('0x10'),_0x37c887);logger[_0xa5af('0xa')](_0xa5af('0x10'),_0x37c887,JSON[_0xa5af('0xc')](_0x1703c0));_0xfe1a31(_0x1703c0);})['catch'](function(_0xfd79e4){logger['error'](_0xa5af('0x10'),_0xfd79e4[_0xa5af('0xf')],_0x37c887);_0x5581af(_0x527077[_0xa5af('0xd')](0x1f4,_0xfd79e4[_0xa5af('0xf')]));});});};exports[_0xa5af('0x15')]=function(_0x44839a){var _0x1feb1d=this;return new Promise(function(_0x251009,_0x2d7ac9){return db[_0xa5af('0x11')]['update'](_0x44839a['body'],{'raw':_0x44839a['options']?_0x44839a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44839a[_0xa5af('0x12')]?_0x44839a[_0xa5af('0x12')][_0xa5af('0x16')]||null:null,'attributes':_0x44839a[_0xa5af('0x12')]?_0x44839a['options']['attributes']||null:null,'limit':_0x44839a[_0xa5af('0x12')]?_0x44839a[_0xa5af('0x12')][_0xa5af('0x17')]||null:null})[_0xa5af('0x8')](function(_0x2a5e0e){logger[_0xa5af('0x14')](_0xa5af('0x15'),_0x44839a);logger['debug']('UpdateSquareReport',_0x44839a,JSON['stringify'](_0x2a5e0e));_0x251009(_0x2a5e0e);})['catch'](function(_0x2be771){logger[_0xa5af('0xd')](_0xa5af('0x15'),_0x2be771['message'],_0x44839a);_0x2d7ac9(_0x1feb1d[_0xa5af('0xd')](0x1f4,_0x2be771[_0xa5af('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b1a70be..6353f7d 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 _0x97d2=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','update','destroy','exports','util','path'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x97d2,0xd0));var _0x297d=function(_0x1e6966,_0x14b1da){_0x1e6966=_0x1e6966-0x0;var _0x2e7a15=_0x97d2[_0x1e6966];return _0x2e7a15;};'use strict';var multer=require('multer');var util=require(_0x297d('0x0'));var path=require(_0x297d('0x1'));var timeout=require(_0x297d('0x2'));var express=require(_0x297d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x297d('0x4'));var interaction=require(_0x297d('0x5'));var config=require(_0x297d('0x6'));var controller=require('./squareReportDetail.controller');router[_0x297d('0x7')]('/',auth[_0x297d('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x297d('0x7')](_0x297d('0x9'),auth[_0x297d('0x8')](),controller[_0x297d('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x297d('0xb')]);router['put']('/:id',auth[_0x297d('0x8')](),controller[_0x297d('0xc')]);router['delete'](_0x297d('0x9'),auth[_0x297d('0x8')](),controller[_0x297d('0xd')]);module[_0x297d('0xe')]=router; \ No newline at end of file +var _0x77dc=['/:id','show','post','create','put','delete','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','/describe','describe','get'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0x77dc,0x106));var _0xc77d=function(_0x5e97e0,_0x2f27d4){_0x5e97e0=_0x5e97e0-0x0;var _0x430fa5=_0x77dc[_0x5e97e0];return _0x430fa5;};'use strict';var multer=require(_0xc77d('0x0'));var util=require('util');var path=require(_0xc77d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc77d('0x2'));var auth=require(_0xc77d('0x3'));var interaction=require(_0xc77d('0x4'));var config=require('../../config/environment');var controller=require(_0xc77d('0x5'));router['get']('/',auth[_0xc77d('0x6')](),controller['index']);router['get'](_0xc77d('0x7'),auth[_0xc77d('0x6')](),controller[_0xc77d('0x8')]);router[_0xc77d('0x9')](_0xc77d('0xa'),auth[_0xc77d('0x6')](),controller[_0xc77d('0xb')]);router[_0xc77d('0xc')]('/',auth[_0xc77d('0x6')](),controller[_0xc77d('0xd')]);router[_0xc77d('0xe')](_0xc77d('0xa'),auth[_0xc77d('0x6')](),controller['update']);router[_0xc77d('0xf')](_0xc77d('0xa'),auth[_0xc77d('0x6')](),controller['destroy']);module[_0xc77d('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b09969e..f94c019 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 _0x53b2=['sequelize','exports','STRING','TEXT'];(function(_0x240562,_0x4bbe51){var _0x27424d=function(_0x573d09){while(--_0x573d09){_0x240562['push'](_0x240562['shift']());}};_0x27424d(++_0x4bbe51);}(_0x53b2,0xa8));var _0x253b=function(_0x1e9b04,_0x1898d2){_0x1e9b04=_0x1e9b04-0x0;var _0x86c82c=_0x53b2[_0x1e9b04];return _0x86c82c;};'use strict';var Sequelize=require(_0x253b('0x0'));module[_0x253b('0x1')]={'uniqueid':{'type':Sequelize[_0x253b('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x253b('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x253b('0x2')]}}; \ No newline at end of file +var _0x036d=['TEXT','STRING'];(function(_0x7a8365,_0x563ade){var _0x55359f=function(_0x344dc2){while(--_0x344dc2){_0x7a8365['push'](_0x7a8365['shift']());}};_0x55359f(++_0x563ade);}(_0x036d,0x14f));var _0xd036=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x036d[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xd036('0x0')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xd036('0x0')]},'data':{'type':Sequelize[_0xd036('0x1')]},'project_name':{'type':Sequelize[_0xd036('0x0')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 81d175b..c4cb9e5 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 _0x2861=['model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','intersection','find','create','body','describe','rimraf','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','SquareDetailsReport','rawAttributes','fieldName','type','key'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x2861,0x138));var _0x1286=function(_0x300915,_0x320ae4){_0x300915=_0x300915-0x0;var _0x5887ed=_0x2861[_0x300915];return _0x5887ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1286('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1286('0x1'));var Mustache=require(_0x1286('0x2'));var util=require(_0x1286('0x3'));var path=require('path');var sox=require(_0x1286('0x4'));var csv=require(_0x1286('0x5'));var ejs=require(_0x1286('0x6'));var fs=require('fs');var fs_extra=require(_0x1286('0x7'));var _=require(_0x1286('0x8'));var squel=require(_0x1286('0x9'));var crypto=require(_0x1286('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1286('0xb'));var toCsv=require(_0x1286('0x5'));var querystring=require(_0x1286('0xc'));var Papa=require(_0x1286('0xd'));var Redis=require(_0x1286('0xe'));var authService=require(_0x1286('0xf'));var qs=require(_0x1286('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1286('0x11'));var logger=require(_0x1286('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1286('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43c956,_0x3cadd2){_0x3cadd2=_0x3cadd2||0xcc;return function(_0x2922d5){if(_0x2922d5){return _0x43c956['sendStatus'](_0x3cadd2);}return _0x43c956[_0x1286('0x14')](_0x3cadd2)[_0x1286('0x15')]();};}function respondWithResult(_0x42a351,_0x43665b){_0x43665b=_0x43665b||0xc8;return function(_0x5c6cad){if(_0x5c6cad){return _0x42a351[_0x1286('0x14')](_0x43665b)['json'](_0x5c6cad);}};}function respondWithFilteredResult(_0x134a31,_0x2a4afe){return function(_0x5a0c00){if(_0x5a0c00){var _0x4e6a51=typeof _0x2a4afe['offset']==='undefined'&&typeof _0x2a4afe[_0x1286('0x16')]===_0x1286('0x17');var _0x3d854c=_0x5a0c00[_0x1286('0x18')];var _0x5c00c7=_0x4e6a51?0x0:_0x2a4afe[_0x1286('0x19')];var _0x234a8d=_0x4e6a51?_0x5a0c00[_0x1286('0x18')]:_0x2a4afe[_0x1286('0x19')]+_0x2a4afe[_0x1286('0x16')];var _0x1eedf0;if(_0x234a8d>=_0x3d854c){_0x234a8d=_0x3d854c;_0x1eedf0=0xc8;}else{_0x1eedf0=0xce;}_0x134a31['status'](_0x1eedf0);return _0x134a31[_0x1286('0x1a')](_0x1286('0x1b'),_0x5c00c7+'-'+_0x234a8d+'/'+_0x3d854c)[_0x1286('0x1c')](_0x5a0c00);}return null;};}function patchUpdates(_0x1fc312){return function(_0x1984c2){try{jsonpatch[_0x1286('0x1d')](_0x1984c2,_0x1fc312,!![]);}catch(_0x19af89){return BPromise['reject'](_0x19af89);}return _0x1984c2[_0x1286('0x1e')]();};}function saveUpdates(_0x2b8772,_0x41ce53){return function(_0x56bdbf){if(_0x56bdbf){return _0x56bdbf[_0x1286('0x1f')](_0x2b8772)[_0x1286('0x20')](function(_0x425da6){return _0x425da6;});}return null;};}function removeEntity(_0x47147e,_0xef9ddd){return function(_0x45f4d7){if(_0x45f4d7){return _0x45f4d7[_0x1286('0x21')]()[_0x1286('0x20')](function(){_0x47147e[_0x1286('0x14')](0xcc)[_0x1286('0x15')]();});}};}function handleEntityNotFound(_0x436a90,_0x19b7a2){return function(_0x5147e8){if(!_0x5147e8){_0x436a90[_0x1286('0x22')](0x194);}return _0x5147e8;};}function handleError(_0xd89311,_0x47e286){_0x47e286=_0x47e286||0x1f4;return function(_0x33083e){logger[_0x1286('0x23')](_0x33083e[_0x1286('0x24')]);if(_0x33083e[_0x1286('0x25')]){delete _0x33083e[_0x1286('0x25')];}_0xd89311['status'](_0x47e286)['send'](_0x33083e);};}exports['index']=function(_0x282e0a,_0x52f906){var _0x56bf25={},_0x4493ac={},_0x3b337b={'count':0x0,'rows':[]};var _0x192233=_['map'](db[_0x1286('0x26')][_0x1286('0x27')],function(_0x4ce868){return{'name':_0x4ce868[_0x1286('0x28')],'type':_0x4ce868[_0x1286('0x29')][_0x1286('0x2a')]};});_0x4493ac[_0x1286('0x2b')]=_[_0x1286('0x2c')](_0x192233,_0x1286('0x25'));_0x4493ac[_0x1286('0x2d')]=_[_0x1286('0x2e')](_0x282e0a[_0x1286('0x2d')]);_0x4493ac['filters']=_['intersection'](_0x4493ac[_0x1286('0x2b')],_0x4493ac[_0x1286('0x2d')]);_0x56bf25[_0x1286('0x2f')]=_['intersection'](_0x4493ac[_0x1286('0x2b')],qs[_0x1286('0x30')](_0x282e0a[_0x1286('0x2d')][_0x1286('0x30')]));_0x56bf25['attributes']=_0x56bf25[_0x1286('0x2f')][_0x1286('0x31')]?_0x56bf25['attributes']:_0x4493ac[_0x1286('0x2b')];if(!_0x282e0a[_0x1286('0x2d')][_0x1286('0x32')](_0x1286('0x33'))){_0x56bf25['limit']=qs[_0x1286('0x16')](_0x282e0a[_0x1286('0x2d')][_0x1286('0x16')]);_0x56bf25['offset']=qs[_0x1286('0x19')](_0x282e0a[_0x1286('0x2d')]['offset']);}_0x56bf25[_0x1286('0x34')]=qs[_0x1286('0x35')](_0x282e0a[_0x1286('0x2d')][_0x1286('0x35')]);_0x56bf25['where']=qs['filters'](_[_0x1286('0x36')](_0x282e0a[_0x1286('0x2d')],_0x4493ac[_0x1286('0x37')]),_0x192233);if(_0x282e0a[_0x1286('0x2d')][_0x1286('0x38')]){_0x56bf25[_0x1286('0x39')]=_[_0x1286('0x3a')](_0x56bf25[_0x1286('0x39')],{'$or':_[_0x1286('0x2c')](_0x192233,function(_0x8f01ee){if(_0x8f01ee['type']!==_0x1286('0x3b')){var _0x923ab4={};_0x923ab4[_0x8f01ee[_0x1286('0x25')]]={'$like':'%'+_0x282e0a[_0x1286('0x2d')][_0x1286('0x38')]+'%'};return _0x923ab4;}})});}_0x56bf25=_[_0x1286('0x3a')]({},_0x56bf25,_0x282e0a['options']);var _0x5b7a49={'where':_0x56bf25['where']};return db['SquareDetailsReport']['count'](_0x5b7a49)[_0x1286('0x20')](function(_0x241e4a){_0x3b337b[_0x1286('0x18')]=_0x241e4a;if(_0x282e0a[_0x1286('0x2d')][_0x1286('0x3c')]){_0x56bf25[_0x1286('0x3d')]=[{'all':!![]}];}return db[_0x1286('0x26')]['findAll'](_0x56bf25);})[_0x1286('0x20')](function(_0x7e2f51){_0x3b337b[_0x1286('0x3e')]=_0x7e2f51;return _0x3b337b;})[_0x1286('0x20')](respondWithFilteredResult(_0x52f906,_0x56bf25))[_0x1286('0x3f')](handleError(_0x52f906,null));};exports[_0x1286('0x40')]=function(_0xb7a5d5,_0x11de57){var _0x486130={'raw':!![],'where':{'id':_0xb7a5d5[_0x1286('0x41')]['id']}},_0x21117a={};_0x21117a[_0x1286('0x2b')]=_[_0x1286('0x2e')](db[_0x1286('0x26')][_0x1286('0x27')]);_0x21117a[_0x1286('0x2d')]=_['keys'](_0xb7a5d5[_0x1286('0x2d')]);_0x21117a[_0x1286('0x37')]=_[_0x1286('0x42')](_0x21117a['model'],_0x21117a['query']);_0x486130[_0x1286('0x2f')]=_[_0x1286('0x42')](_0x21117a[_0x1286('0x2b')],qs['fields'](_0xb7a5d5['query'][_0x1286('0x30')]));_0x486130[_0x1286('0x2f')]=_0x486130[_0x1286('0x2f')]['length']?_0x486130[_0x1286('0x2f')]:_0x21117a[_0x1286('0x2b')];if(_0xb7a5d5['query'][_0x1286('0x3c')]){_0x486130[_0x1286('0x3d')]=[{'all':!![]}];}_0x486130=_[_0x1286('0x3a')]({},_0x486130,_0xb7a5d5['options']);return db[_0x1286('0x26')][_0x1286('0x43')](_0x486130)[_0x1286('0x20')](handleEntityNotFound(_0x11de57,null))['then'](respondWithResult(_0x11de57,null))['catch'](handleError(_0x11de57,null));};exports[_0x1286('0x44')]=function(_0x3d9ed4,_0x465fe8){return db[_0x1286('0x26')][_0x1286('0x44')](_0x3d9ed4[_0x1286('0x45')],{})[_0x1286('0x20')](respondWithResult(_0x465fe8,0xc9))[_0x1286('0x3f')](handleError(_0x465fe8,null));};exports[_0x1286('0x1f')]=function(_0x230b87,_0x3971c3){if(_0x230b87[_0x1286('0x45')]['id']){delete _0x230b87[_0x1286('0x45')]['id'];}return db[_0x1286('0x26')][_0x1286('0x43')]({'where':{'id':_0x230b87[_0x1286('0x41')]['id']}})[_0x1286('0x20')](handleEntityNotFound(_0x3971c3,null))['then'](saveUpdates(_0x230b87[_0x1286('0x45')],null))[_0x1286('0x20')](respondWithResult(_0x3971c3,null))[_0x1286('0x3f')](handleError(_0x3971c3,null));};exports[_0x1286('0x21')]=function(_0x4818a7,_0x3102dd){return db[_0x1286('0x26')][_0x1286('0x43')]({'where':{'id':_0x4818a7[_0x1286('0x41')]['id']}})[_0x1286('0x20')](handleEntityNotFound(_0x3102dd,null))[_0x1286('0x20')](removeEntity(_0x3102dd,null))[_0x1286('0x3f')](handleError(_0x3102dd,null));};exports[_0x1286('0x46')]=function(_0xb6831f,_0x24d802){return db[_0x1286('0x26')][_0x1286('0x46')]()['then'](respondWithResult(_0x24d802,null))[_0x1286('0x3f')](handleError(_0x24d802,null));}; \ No newline at end of file +var _0x385a=['body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','length','options','find','create'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x385a,0xa1));var _0xa385=function(_0x35f3e6,_0x21f2f4){_0x35f3e6=_0x35f3e6-0x0;var _0x5dd2c6=_0x385a[_0x35f3e6];return _0x5dd2c6;};'use strict';var emlformat=require(_0xa385('0x0'));var rimraf=require(_0xa385('0x1'));var zipdir=require(_0xa385('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa385('0x3'));var moment=require(_0xa385('0x4'));var BPromise=require(_0xa385('0x5'));var Mustache=require(_0xa385('0x6'));var util=require(_0xa385('0x7'));var path=require('path');var sox=require(_0xa385('0x8'));var csv=require(_0xa385('0x9'));var ejs=require(_0xa385('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa385('0xb'));var squel=require(_0xa385('0xc'));var crypto=require(_0xa385('0xd'));var jsforce=require(_0xa385('0xe'));var deskjs=require(_0xa385('0xf'));var toCsv=require(_0xa385('0x9'));var querystring=require(_0xa385('0x10'));var Papa=require('papaparse');var Redis=require(_0xa385('0x11'));var authService=require(_0xa385('0x12'));var qs=require(_0xa385('0x13'));var as=require(_0xa385('0x14'));var hardwareService=require(_0xa385('0x15'));var logger=require(_0xa385('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xa385('0x17'));var licenseUtil=require(_0xa385('0x18'));var db=require(_0xa385('0x19'))['db'];function respondWithStatusCode(_0x37a07f,_0x439ae7){_0x439ae7=_0x439ae7||0xcc;return function(_0x7b2821){if(_0x7b2821){return _0x37a07f['sendStatus'](_0x439ae7);}return _0x37a07f[_0xa385('0x1a')](_0x439ae7)['end']();};}function respondWithResult(_0x10f7f8,_0x149697){_0x149697=_0x149697||0xc8;return function(_0x2cc2fc){if(_0x2cc2fc){return _0x10f7f8[_0xa385('0x1a')](_0x149697)[_0xa385('0x1b')](_0x2cc2fc);}};}function respondWithFilteredResult(_0x460468,_0x187fce){return function(_0x2cf1fc){if(_0x2cf1fc){var _0xd000a3=typeof _0x187fce[_0xa385('0x1c')]===_0xa385('0x1d')&&typeof _0x187fce[_0xa385('0x1e')]===_0xa385('0x1d');var _0x109ded=_0x2cf1fc['count'];var _0x1f5931=_0xd000a3?0x0:_0x187fce[_0xa385('0x1c')];var _0x3ecae2=_0xd000a3?_0x2cf1fc[_0xa385('0x1f')]:_0x187fce[_0xa385('0x1c')]+_0x187fce['limit'];var _0x1aee23;if(_0x3ecae2>=_0x109ded){_0x3ecae2=_0x109ded;_0x1aee23=0xc8;}else{_0x1aee23=0xce;}_0x460468[_0xa385('0x1a')](_0x1aee23);return _0x460468['set'](_0xa385('0x20'),_0x1f5931+'-'+_0x3ecae2+'/'+_0x109ded)['json'](_0x2cf1fc);}return null;};}function patchUpdates(_0xd537df){return function(_0x4e4b33){try{jsonpatch[_0xa385('0x21')](_0x4e4b33,_0xd537df,!![]);}catch(_0x5afaf3){return BPromise[_0xa385('0x22')](_0x5afaf3);}return _0x4e4b33[_0xa385('0x23')]();};}function saveUpdates(_0xfbd71f,_0x1c1600){return function(_0x126e38){if(_0x126e38){return _0x126e38[_0xa385('0x24')](_0xfbd71f)[_0xa385('0x25')](function(_0x4683a9){return _0x4683a9;});}return null;};}function removeEntity(_0x2b94b2,_0xb0bf1a){return function(_0x316a5a){if(_0x316a5a){return _0x316a5a[_0xa385('0x26')]()['then'](function(){_0x2b94b2[_0xa385('0x1a')](0xcc)[_0xa385('0x27')]();});}};}function handleEntityNotFound(_0x2eaa00,_0x5e52e5){return function(_0x58a58f){if(!_0x58a58f){_0x2eaa00[_0xa385('0x28')](0x194);}return _0x58a58f;};}function handleError(_0x3a2873,_0x401bbf){_0x401bbf=_0x401bbf||0x1f4;return function(_0xe3c8af){logger[_0xa385('0x29')](_0xe3c8af[_0xa385('0x2a')]);if(_0xe3c8af[_0xa385('0x2b')]){delete _0xe3c8af[_0xa385('0x2b')];}_0x3a2873[_0xa385('0x1a')](_0x401bbf)[_0xa385('0x2c')](_0xe3c8af);};}exports[_0xa385('0x2d')]=function(_0x22b959,_0x48700){var _0x57b8c0={},_0x198ac7={},_0x57b2b7={'count':0x0,'rows':[]};var _0x34f07a=_[_0xa385('0x2e')](db[_0xa385('0x2f')][_0xa385('0x30')],function(_0x3f8367){return{'name':_0x3f8367[_0xa385('0x31')],'type':_0x3f8367[_0xa385('0x32')][_0xa385('0x33')]};});_0x198ac7['model']=_['map'](_0x34f07a,_0xa385('0x2b'));_0x198ac7[_0xa385('0x34')]=_[_0xa385('0x35')](_0x22b959[_0xa385('0x34')]);_0x198ac7[_0xa385('0x36')]=_[_0xa385('0x37')](_0x198ac7['model'],_0x198ac7[_0xa385('0x34')]);_0x57b8c0[_0xa385('0x38')]=_['intersection'](_0x198ac7[_0xa385('0x39')],qs['fields'](_0x22b959[_0xa385('0x34')][_0xa385('0x3a')]));_0x57b8c0[_0xa385('0x38')]=_0x57b8c0[_0xa385('0x38')]['length']?_0x57b8c0[_0xa385('0x38')]:_0x198ac7[_0xa385('0x39')];if(!_0x22b959[_0xa385('0x34')][_0xa385('0x3b')]('nolimit')){_0x57b8c0[_0xa385('0x1e')]=qs['limit'](_0x22b959[_0xa385('0x34')][_0xa385('0x1e')]);_0x57b8c0['offset']=qs[_0xa385('0x1c')](_0x22b959[_0xa385('0x34')]['offset']);}_0x57b8c0[_0xa385('0x3c')]=qs[_0xa385('0x3d')](_0x22b959[_0xa385('0x34')][_0xa385('0x3d')]);_0x57b8c0[_0xa385('0x3e')]=qs[_0xa385('0x36')](_[_0xa385('0x3f')](_0x22b959[_0xa385('0x34')],_0x198ac7['filters']),_0x34f07a);if(_0x22b959[_0xa385('0x34')][_0xa385('0x40')]){_0x57b8c0[_0xa385('0x3e')]=_['merge'](_0x57b8c0['where'],{'$or':_['map'](_0x34f07a,function(_0x3e0d17){if(_0x3e0d17[_0xa385('0x32')]!==_0xa385('0x41')){var _0x20db76={};_0x20db76[_0x3e0d17[_0xa385('0x2b')]]={'$like':'%'+_0x22b959[_0xa385('0x34')]['filter']+'%'};return _0x20db76;}})});}_0x57b8c0=_[_0xa385('0x42')]({},_0x57b8c0,_0x22b959['options']);var _0x3a304a={'where':_0x57b8c0[_0xa385('0x3e')]};return db[_0xa385('0x2f')][_0xa385('0x1f')](_0x3a304a)['then'](function(_0x2c41b6){_0x57b2b7['count']=_0x2c41b6;if(_0x22b959[_0xa385('0x34')][_0xa385('0x43')]){_0x57b8c0[_0xa385('0x44')]=[{'all':!![]}];}return db[_0xa385('0x2f')][_0xa385('0x45')](_0x57b8c0);})[_0xa385('0x25')](function(_0x2f894d){_0x57b2b7['rows']=_0x2f894d;return _0x57b2b7;})[_0xa385('0x25')](respondWithFilteredResult(_0x48700,_0x57b8c0))[_0xa385('0x46')](handleError(_0x48700,null));};exports[_0xa385('0x47')]=function(_0x455060,_0x408d66){var _0x461c40={'raw':!![],'where':{'id':_0x455060['params']['id']}},_0xe76dbe={};_0xe76dbe[_0xa385('0x39')]=_[_0xa385('0x35')](db['SquareDetailsReport'][_0xa385('0x30')]);_0xe76dbe['query']=_['keys'](_0x455060[_0xa385('0x34')]);_0xe76dbe[_0xa385('0x36')]=_[_0xa385('0x37')](_0xe76dbe[_0xa385('0x39')],_0xe76dbe['query']);_0x461c40[_0xa385('0x38')]=_[_0xa385('0x37')](_0xe76dbe['model'],qs[_0xa385('0x3a')](_0x455060[_0xa385('0x34')][_0xa385('0x3a')]));_0x461c40['attributes']=_0x461c40[_0xa385('0x38')][_0xa385('0x48')]?_0x461c40[_0xa385('0x38')]:_0xe76dbe[_0xa385('0x39')];if(_0x455060[_0xa385('0x34')][_0xa385('0x43')]){_0x461c40[_0xa385('0x44')]=[{'all':!![]}];}_0x461c40=_[_0xa385('0x42')]({},_0x461c40,_0x455060[_0xa385('0x49')]);return db[_0xa385('0x2f')][_0xa385('0x4a')](_0x461c40)[_0xa385('0x25')](handleEntityNotFound(_0x408d66,null))[_0xa385('0x25')](respondWithResult(_0x408d66,null))[_0xa385('0x46')](handleError(_0x408d66,null));};exports[_0xa385('0x4b')]=function(_0x1917be,_0x36963e){return db['SquareDetailsReport'][_0xa385('0x4b')](_0x1917be[_0xa385('0x4c')],{})['then'](respondWithResult(_0x36963e,0xc9))[_0xa385('0x46')](handleError(_0x36963e,null));};exports[_0xa385('0x24')]=function(_0x2464a0,_0x4793b4){if(_0x2464a0[_0xa385('0x4c')]['id']){delete _0x2464a0[_0xa385('0x4c')]['id'];}return db[_0xa385('0x2f')]['find']({'where':{'id':_0x2464a0[_0xa385('0x4d')]['id']}})[_0xa385('0x25')](handleEntityNotFound(_0x4793b4,null))['then'](saveUpdates(_0x2464a0['body'],null))[_0xa385('0x25')](respondWithResult(_0x4793b4,null))[_0xa385('0x46')](handleError(_0x4793b4,null));};exports[_0xa385('0x26')]=function(_0x54270c,_0x4f7bdf){return db[_0xa385('0x2f')][_0xa385('0x4a')]({'where':{'id':_0x54270c[_0xa385('0x4d')]['id']}})[_0xa385('0x25')](handleEntityNotFound(_0x4f7bdf,null))[_0xa385('0x25')](removeEntity(_0x4f7bdf,null))['catch'](handleError(_0x4f7bdf,null));};exports['describe']=function(_0x50d4cb,_0x142ad4){return db[_0xa385('0x2f')][_0xa385('0x4e')]()[_0xa385('0x25')](respondWithResult(_0x142ad4,null))[_0xa385('0x46')](handleError(_0x142ad4,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 3a0ee33..2b034ae 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 _0x39a2=['report_square_details','lodash','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x39a2,0x161));var _0x239a=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0x39a2[_0x5651ef];return _0x392fba;};'use strict';var _=require(_0x239a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x239a('0x1'));var moment=require(_0x239a('0x2'));var BPromise=require(_0x239a('0x3'));var rp=require(_0x239a('0x4'));var fs=require('fs');var path=require(_0x239a('0x5'));var rimraf=require(_0x239a('0x6'));var config=require('../../config/environment');var attributes=require(_0x239a('0x7'));module[_0x239a('0x8')]=function(_0x2bd087,_0x10be70){return _0x2bd087[_0x239a('0x9')]('SquareDetailsReport',attributes,{'tableName':_0x239a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62d4=['bluebird','rimraf','exports','define','SquareDetailsReport','lodash','util','api','moment'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x62d4,0x9e));var _0x462d=function(_0x3feb87,_0x16c62a){_0x3feb87=_0x3feb87-0x0;var _0x3259f5=_0x62d4[_0x3feb87];return _0x3259f5;};'use strict';var _=require(_0x462d('0x0'));var util=require(_0x462d('0x1'));var logger=require('../../config/logger')(_0x462d('0x2'));var moment=require(_0x462d('0x3'));var BPromise=require(_0x462d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x462d('0x5'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x462d('0x6')]=function(_0x44a171,_0x4ec8f9){return _0x44a171[_0x462d('0x7')](_0x462d('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 454f7b2..c12da3e 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 _0x3c66=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SquareDetailsReport','options','CreateSquareDetailsReport','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x3c66,0x8b));var _0x63c6=function(_0x4524f6,_0x445a4d){_0x4524f6=_0x4524f6-0x0;var _0x2d5fad=_0x3c66[_0x4524f6];return _0x2d5fad;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x63c6('0x0'));var rs=require(_0x63c6('0x1'));var fs=require('fs');var Redis=require(_0x63c6('0x2'));var db=require(_0x63c6('0x3'))['db'];var utils=require(_0x63c6('0x4'));var logger=require(_0x63c6('0x5'))(_0x63c6('0x6'));var config=require(_0x63c6('0x7'));var jayson=require(_0x63c6('0x8'));var client=jayson[_0x63c6('0x9')][_0x63c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b33e8,_0x47b438,_0x232099){return new BPromise(function(_0x50ff5c,_0x44e826){return client[_0x63c6('0xb')](_0x2b33e8,_0x232099)['then'](function(_0x386110){logger[_0x63c6('0xc')](_0x63c6('0xd'),_0x47b438,_0x63c6('0xe'));logger[_0x63c6('0xf')](_0x63c6('0x10'),_0x47b438,'request\x20sent',JSON[_0x63c6('0x11')](_0x386110));if(_0x386110[_0x63c6('0x12')]){if(_0x386110[_0x63c6('0x12')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x47b438,_0x386110['error']['message']);return _0x44e826(_0x386110['error'][_0x63c6('0x13')]);}logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x386110[_0x63c6('0x12')][_0x63c6('0x13')]);return _0x50ff5c(_0x386110['error'][_0x63c6('0x13')]);}else{logger[_0x63c6('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x47b438,_0x63c6('0xe'));_0x50ff5c(_0x386110['result']['message']);}})[_0x63c6('0x14')](function(_0x571022){logger[_0x63c6('0x12')](_0x63c6('0xd'),_0x47b438,_0x571022);_0x44e826(_0x571022);});});}exports['CreateSquareDetailsReport']=function(_0xd5a3b5){var _0x2bbda5=this;return new Promise(function(_0x377f6e,_0x35ee57){return db[_0x63c6('0x15')]['create'](_0xd5a3b5['body'],{'raw':_0xd5a3b5['options']?_0xd5a3b5[_0x63c6('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb7ba4f){logger[_0x63c6('0xc')]('CreateSquareDetailsReport',_0xd5a3b5);logger[_0x63c6('0xf')](_0x63c6('0x17'),_0xd5a3b5,JSON[_0x63c6('0x11')](_0xb7ba4f));_0x377f6e(_0xb7ba4f);})[_0x63c6('0x14')](function(_0x430a6e){logger['error'](_0x63c6('0x17'),_0x430a6e[_0x63c6('0x13')],_0xd5a3b5);_0x35ee57(_0x2bbda5[_0x63c6('0x12')](0x1f4,_0x430a6e[_0x63c6('0x13')]));});});}; \ No newline at end of file +var _0x2b65=['info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x39a823,_0x100f92){var _0x5005bb=function(_0x94269b){while(--_0x94269b){_0x39a823['push'](_0x39a823['shift']());}};_0x5005bb(++_0x100f92);}(_0x2b65,0x131));var _0x52b6=function(_0x258b00,_0x28e9b0){_0x258b00=_0x258b00-0x0;var _0x3ca676=_0x2b65[_0x258b00];return _0x3ca676;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d451f,_0x70579,_0x1af78f){return new BPromise(function(_0x432726,_0x27c5b9){return client['request'](_0x2d451f,_0x1af78f)[_0x52b6('0xd')](function(_0x1c2cb5){logger[_0x52b6('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x70579,_0x52b6('0xf'));logger[_0x52b6('0x10')](_0x52b6('0x11'),_0x70579,_0x52b6('0xf'),JSON['stringify'](_0x1c2cb5));if(_0x1c2cb5[_0x52b6('0x12')]){if(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x13')]===0x1f4){logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')]['message']);return _0x27c5b9(_0x1c2cb5[_0x52b6('0x12')]['message']);}logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);return _0x432726(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);}else{logger[_0x52b6('0xe')](_0x52b6('0x14'),_0x70579,_0x52b6('0xf'));_0x432726(_0x1c2cb5[_0x52b6('0x16')][_0x52b6('0x15')]);}})[_0x52b6('0x17')](function(_0x307594){logger[_0x52b6('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x70579,_0x307594);_0x27c5b9(_0x307594);});});}exports[_0x52b6('0x18')]=function(_0x2fa3ed){var _0x9bab0a=this;return new Promise(function(_0x47d203,_0x36d376){return db[_0x52b6('0x19')]['create'](_0x2fa3ed['body'],{'raw':_0x2fa3ed[_0x52b6('0x1a')]?_0x2fa3ed['options'][_0x52b6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2e472f){logger[_0x52b6('0xe')](_0x52b6('0x18'),_0x2fa3ed);logger[_0x52b6('0x10')]('CreateSquareDetailsReport',_0x2fa3ed,JSON[_0x52b6('0x1c')](_0x2e472f));_0x47d203(_0x2e472f);})[_0x52b6('0x17')](function(_0x1246db){logger[_0x52b6('0x12')](_0x52b6('0x18'),_0x1246db[_0x52b6('0x15')],_0x2fa3ed);_0x36d376(_0x9bab0a[_0x52b6('0x12')](0x1f4,_0x1246db[_0x52b6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a20d248..1eb273d 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 _0x160f=['isAuthenticated','index','get','/process/:pid/kill','killProcess','express','../../components/auth/service','./system.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x160f,0xfd));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xf160('0x0'));var router=express['Router']();var auth=require(_0xf160('0x1'));var controller=require(_0xf160('0x2'));router['get']('/',auth[_0xf160('0x3')](),controller[_0xf160('0x4')]);router[_0xf160('0x5')](_0xf160('0x6'),auth['isAuthenticated'](),controller[_0xf160('0x7')]);module['exports']=router; \ No newline at end of file +var _0x3311=['exports','express','../../components/auth/service','get','isAuthenticated'];(function(_0x2dfa69,_0x5c0938){var _0x1823e2=function(_0x3fd7dc){while(--_0x3fd7dc){_0x2dfa69['push'](_0x2dfa69['shift']());}};_0x1823e2(++_0x5c0938);}(_0x3311,0x92));var _0x1331=function(_0xcff792,_0x131f62){_0xcff792=_0xcff792-0x0;var _0x24d6dd=_0x3311[_0xcff792];return _0x24d6dd;};'use strict';var express=require(_0x1331('0x0'));var router=express['Router']();var auth=require(_0x1331('0x1'));var controller=require('./system.controller');router[_0x1331('0x2')]('/',auth[_0x1331('0x3')](),controller['index']);router[_0x1331('0x2')]('/process/:pid/kill',auth[_0x1331('0x3')](),controller['killProcess']);module[_0x1331('0x4')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8dceef3..4f21d41 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 _0xf5cd=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','pid','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','lodash','error'];(function(_0x2a6420,_0x39d364){var _0x10becd=function(_0x25642f){while(--_0x25642f){_0x2a6420['push'](_0x2a6420['shift']());}};_0x10becd(++_0x39d364);}(_0xf5cd,0xf5));var _0xdf5c=function(_0x194550,_0x254d9e){_0x194550=_0x194550-0x0;var _0x278dc5=_0xf5cd[_0x194550];return _0x278dc5;};'use strict';var info=require('systeminformation');var exec=require(_0xdf5c('0x0'))[_0xdf5c('0x1')];var logger=require(_0xdf5c('0x2'))(_0xdf5c('0x3'));var util=require(_0xdf5c('0x4'));var BPromise=require('bluebird');var _=require(_0xdf5c('0x5'));function handleError(_0x3009b8,_0x56ce20,_0xce75b4){_0x56ce20=_0x56ce20||0x1f4;return function(_0x50afde){logger[_0xdf5c('0x6')](_0xdf5c('0x7'),_0xce75b4,_0x56ce20,util[_0xdf5c('0x8')](_0x50afde,{'showHidden':![],'depth':null}));delete _0x50afde['name'];_0x3009b8[_0xdf5c('0x9')](_0x56ce20)[_0xdf5c('0xa')](_0x50afde);};}exports[_0xdf5c('0xb')]=function(_0x3bde50,_0x449e44){return info[_0xdf5c('0xc')]()[_0xdf5c('0xd')](function(_0x1b4aad){return _0x449e44[_0xdf5c('0x9')](0xc8)['json'](_0x1b4aad);})[_0xdf5c('0xe')](function(_0x42ebba){return _0x449e44['status'](0x1f4)['json'](_0x42ebba);});};exports[_0xdf5c('0xf')]=function(_0x206d17,_0x14dd40){var _0x847223=['components/import/cm'];return new BPromise(function(_0x3aeac,_0x4ba70){return exec(util[_0xdf5c('0x10')](_0xdf5c('0x11'),_0x206d17['params']['pid']),function(_0x4a649f,_0x151a21,_0x162118){if(_0x4a649f){return _0x4ba70(_0x4a649f);}return _0x3aeac(_0x151a21);});})[_0xdf5c('0xd')](function(_0x34af68){var _0x58d52b=![];var _0x2c6101=_0x34af68[_0xdf5c('0x12')](/\n/);for(var _0x24247d=0x0,_0x338818=_0x847223[_0xdf5c('0x13')];_0x24247d<_0x338818,_0x58d52b===![];_0x24247d+=0x1){if(_0x34af68[_0xdf5c('0x14')](_0x847223[_0x24247d])>=0x0){_0x58d52b=!![];}}if(!_0x58d52b){throw new Error(util[_0xdf5c('0x10')](_0xdf5c('0x15'),_0x206d17[_0xdf5c('0x16')]['pid']));}process[_0xdf5c('0x17')](_0x206d17[_0xdf5c('0x16')][_0xdf5c('0x18')],_0xdf5c('0x19'));return _0x14dd40['status'](0xc8)[_0xdf5c('0x1a')]({'message':util[_0xdf5c('0x10')](_0xdf5c('0x1b'),_0x206d17['params'][_0xdf5c('0x18')])});})['catch'](handleError(_0x14dd40,null,_0xdf5c('0xf')));}; \ No newline at end of file +var _0xf5ff=['then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','killProcess','systeminformation','exec','../../config/logger','api','error','name','status','send','index','getAllData'];(function(_0x411659,_0x40a15a){var _0x110ca6=function(_0x500f0c){while(--_0x500f0c){_0x411659['push'](_0x411659['shift']());}};_0x110ca6(++_0x40a15a);}(_0xf5ff,0xbe));var _0xff5f=function(_0x408871,_0xf41b6b){_0x408871=_0x408871-0x0;var _0x5bf187=_0xf5ff[_0x408871];return _0x5bf187;};'use strict';var info=require(_0xff5f('0x0'));var exec=require('child_process')[_0xff5f('0x1')];var logger=require(_0xff5f('0x2'))(_0xff5f('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x7f44f2,_0x1cc84f,_0x4606a2){_0x1cc84f=_0x1cc84f||0x1f4;return function(_0x87f61c){logger[_0xff5f('0x4')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4606a2,_0x1cc84f,util['inspect'](_0x87f61c,{'showHidden':![],'depth':null}));delete _0x87f61c[_0xff5f('0x5')];_0x7f44f2[_0xff5f('0x6')](_0x1cc84f)[_0xff5f('0x7')](_0x87f61c);};}exports[_0xff5f('0x8')]=function(_0x49e70e,_0x39385f){return info[_0xff5f('0x9')]()[_0xff5f('0xa')](function(_0x3b6aaa){return _0x39385f[_0xff5f('0x6')](0xc8)[_0xff5f('0xb')](_0x3b6aaa);})[_0xff5f('0xc')](function(_0x2c8d22){return _0x39385f[_0xff5f('0x6')](0x1f4)[_0xff5f('0xb')](_0x2c8d22);});};exports['killProcess']=function(_0x50851a,_0x215543){var _0x143703=[_0xff5f('0xd')];return new BPromise(function(_0xe3ae12,_0x346968){return exec(util[_0xff5f('0xe')](_0xff5f('0xf'),_0x50851a[_0xff5f('0x10')][_0xff5f('0x11')]),function(_0x5ecb19,_0x34055e,_0x58ff26){if(_0x5ecb19){return _0x346968(_0x5ecb19);}return _0xe3ae12(_0x34055e);});})[_0xff5f('0xa')](function(_0x41a553){var _0x19aa1b=![];var _0x311199=_0x41a553[_0xff5f('0x12')](/\n/);for(var _0x28f08b=0x0,_0x1f1d09=_0x143703[_0xff5f('0x13')];_0x28f08b<_0x1f1d09,_0x19aa1b===![];_0x28f08b+=0x1){if(_0x41a553[_0xff5f('0x14')](_0x143703[_0x28f08b])>=0x0){_0x19aa1b=!![];}}if(!_0x19aa1b){throw new Error(util['format'](_0xff5f('0x15'),_0x50851a[_0xff5f('0x10')][_0xff5f('0x11')]));}process[_0xff5f('0x16')](_0x50851a[_0xff5f('0x10')]['pid'],_0xff5f('0x17'));return _0x215543[_0xff5f('0x6')](0xc8)[_0xff5f('0xb')]({'message':util[_0xff5f('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x50851a['params'][_0xff5f('0x11')])});})[_0xff5f('0xc')](handleError(_0x215543,null,_0xff5f('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3a8329b..fc48fda 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 _0x7da6=['/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','show','put'];(function(_0x1caa0e,_0x319468){var _0x577d87=function(_0x3d8285){while(--_0x3d8285){_0x1caa0e['push'](_0x1caa0e['shift']());}};_0x577d87(++_0x319468);}(_0x7da6,0x124));var _0x67da=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x7da6[_0x4b0290];return _0x4bd9f4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x67da('0x0'));var timeout=require(_0x67da('0x1'));var express=require(_0x67da('0x2'));var router=express[_0x67da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x67da('0x4'));var interaction=require(_0x67da('0x5'));var config=require(_0x67da('0x6'));var controller=require(_0x67da('0x7'));router[_0x67da('0x8')]('/',auth[_0x67da('0x9')](),controller['index']);router[_0x67da('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x67da('0xa')]);router['post']('/',auth[_0x67da('0x9')](),controller['create']);router[_0x67da('0xb')](_0x67da('0xc'),auth[_0x67da('0x9')](),controller[_0x67da('0xd')]);router[_0x67da('0xe')](_0x67da('0xc'),auth[_0x67da('0x9')](),controller['destroy']);module[_0x67da('0xf')]=router; \ No newline at end of file +var _0x1504=['./tag.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x853c7b,_0x14641e){var _0x56def9=function(_0xdbaf77){while(--_0xdbaf77){_0x853c7b['push'](_0x853c7b['shift']());}};_0x56def9(++_0x14641e);}(_0x1504,0x1da));var _0x4150=function(_0x49d27a,_0x166543){_0x49d27a=_0x49d27a-0x0;var _0x3f0b62=_0x1504[_0x49d27a];return _0x3f0b62;};'use strict';var multer=require(_0x4150('0x0'));var util=require('util');var path=require(_0x4150('0x1'));var timeout=require(_0x4150('0x2'));var express=require('express');var router=express[_0x4150('0x3')]();var fs_extra=require(_0x4150('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4150('0x5'));var controller=require(_0x4150('0x6'));router[_0x4150('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4150('0x7')](_0x4150('0x8'),auth[_0x4150('0x9')](),controller[_0x4150('0xa')]);router[_0x4150('0xb')]('/',auth[_0x4150('0x9')](),controller[_0x4150('0xc')]);router[_0x4150('0xd')](_0x4150('0x8'),auth[_0x4150('0x9')](),controller['update']);router[_0x4150('0xe')](_0x4150('0x8'),auth['isAuthenticated'](),controller[_0x4150('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9444e67..f4ad482 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 _0x151b=['name','#0091EA','STRING','sequelize'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x151b,0x153));var _0xb151=function(_0x479ced,_0x1c5401){_0x479ced=_0x479ced-0x0;var _0x459d4c=_0x151b[_0x479ced];return _0x459d4c;};'use strict';var Sequelize=require(_0xb151('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb151('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xb151('0x2')},'description':{'type':Sequelize[_0xb151('0x3')]}}; \ No newline at end of file +var _0xb4f4=['name','STRING','#0091EA','sequelize','exports'];(function(_0xab8a65,_0x439ac7){var _0x121b2f=function(_0x181979){while(--_0x181979){_0xab8a65['push'](_0xab8a65['shift']());}};_0x121b2f(++_0x439ac7);}(_0xb4f4,0xda));var _0x4b4f=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xb4f4[_0x725b8e];return _0x43ac45;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module[_0x4b4f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4b4f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4b4f('0x3')],'defaultValue':_0x4b4f('0x4')},'description':{'type':Sequelize[_0x4b4f('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0142061..df5bcf7 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 _0x54f3=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','get','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x4efab4,_0xc7598d){var _0xce4819=function(_0x1a7a38){while(--_0x1a7a38){_0x4efab4['push'](_0x4efab4['shift']());}};_0xce4819(++_0xc7598d);}(_0x54f3,0x120));var _0x354f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x54f3[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){var _0x519d66=_0x273603['get']({'plain':!![]});var _0x22594b='Tags';return db['UserProfileResource'][_0x354f('0x22')]({'where':{'type':_0x22594b,'resourceId':_0x519d66['id']}})['then'](function(){return _0x273603;});})[_0x354f('0x21')](function(){_0xc0d4ca[_0x354f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73c95e,_0x3c5c38){return function(_0x1467e7){if(!_0x1467e7){_0x73c95e['sendStatus'](0x194);}return _0x1467e7;};}function handleError(_0x1a968d,_0x503b2d){_0x503b2d=_0x503b2d||0x1f4;return function(_0x227d9b){logger[_0x354f('0x23')](_0x227d9b[_0x354f('0x24')]);if(_0x227d9b[_0x354f('0x25')]){delete _0x227d9b['name'];}_0x1a968d[_0x354f('0x16')](_0x503b2d)[_0x354f('0x26')](_0x227d9b);};}exports[_0x354f('0x27')]=function(_0x34a498,_0x223464){var _0x55afe1={},_0x5a8208={},_0x42caa2={'count':0x0,'rows':[]};var _0x156dba=_[_0x354f('0x28')](db[_0x354f('0x29')]['rawAttributes'],function(_0x576a95){return{'name':_0x576a95[_0x354f('0x2a')],'type':_0x576a95[_0x354f('0x2b')][_0x354f('0x2c')]};});_0x5a8208[_0x354f('0x2d')]=_['map'](_0x156dba,_0x354f('0x25'));_0x5a8208[_0x354f('0x2e')]=_[_0x354f('0x2f')](_0x34a498[_0x354f('0x2e')]);_0x5a8208['filters']=_['intersection'](_0x5a8208[_0x354f('0x2d')],_0x5a8208[_0x354f('0x2e')]);_0x55afe1[_0x354f('0x30')]=_[_0x354f('0x31')](_0x5a8208[_0x354f('0x2d')],qs[_0x354f('0x32')](_0x34a498[_0x354f('0x2e')][_0x354f('0x32')]));_0x55afe1[_0x354f('0x30')]=_0x55afe1[_0x354f('0x30')][_0x354f('0x33')]?_0x55afe1['attributes']:_0x5a8208[_0x354f('0x2d')];if(!_0x34a498['query'][_0x354f('0x34')](_0x354f('0x35'))){_0x55afe1[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x34a498[_0x354f('0x2e')][_0x354f('0x19')]);_0x55afe1['offset']=qs[_0x354f('0x1b')](_0x34a498[_0x354f('0x2e')]['offset']);}_0x55afe1[_0x354f('0x36')]=qs[_0x354f('0x37')](_0x34a498[_0x354f('0x2e')]['sort']);_0x55afe1[_0x354f('0x38')]=qs[_0x354f('0x39')](_[_0x354f('0x3a')](_0x34a498[_0x354f('0x2e')],_0x5a8208['filters']),_0x156dba);if(_0x34a498[_0x354f('0x2e')]['filter']){_0x55afe1[_0x354f('0x38')]=_[_0x354f('0x3b')](_0x55afe1[_0x354f('0x38')],{'$or':_[_0x354f('0x28')](_0x156dba,function(_0x27c208){if(_0x27c208['type']!=='VIRTUAL'){var _0x162a10={};_0x162a10[_0x27c208[_0x354f('0x25')]]={'$like':'%'+_0x34a498[_0x354f('0x2e')][_0x354f('0x3c')]+'%'};return _0x162a10;}})});}_0x55afe1=_[_0x354f('0x3b')]({},_0x55afe1,_0x34a498[_0x354f('0x3d')]);var _0x58ae82={'where':_0x55afe1[_0x354f('0x38')]};return db[_0x354f('0x29')][_0x354f('0x1a')](_0x58ae82)[_0x354f('0x21')](function(_0x512592){_0x42caa2[_0x354f('0x1a')]=_0x512592;if(_0x34a498[_0x354f('0x2e')][_0x354f('0x3e')]){_0x55afe1[_0x354f('0x3f')]=[{'all':!![]}];}return db[_0x354f('0x29')][_0x354f('0x40')](_0x55afe1);})['then'](function(_0x66b4cc){_0x42caa2[_0x354f('0x41')]=_0x66b4cc;return _0x42caa2;})[_0x354f('0x21')](respondWithFilteredResult(_0x223464,_0x55afe1))['catch'](handleError(_0x223464,null));};exports['show']=function(_0x7835a0,_0x433ff0){var _0xff4402={'raw':!![],'where':{'id':_0x7835a0[_0x354f('0x42')]['id']}},_0x3b34ca={};_0x3b34ca[_0x354f('0x2d')]=_[_0x354f('0x2f')](db[_0x354f('0x29')]['rawAttributes']);_0x3b34ca[_0x354f('0x2e')]=_[_0x354f('0x2f')](_0x7835a0[_0x354f('0x2e')]);_0x3b34ca[_0x354f('0x39')]=_[_0x354f('0x31')](_0x3b34ca[_0x354f('0x2d')],_0x3b34ca[_0x354f('0x2e')]);_0xff4402[_0x354f('0x30')]=_[_0x354f('0x31')](_0x3b34ca['model'],qs[_0x354f('0x32')](_0x7835a0[_0x354f('0x2e')]['fields']));_0xff4402['attributes']=_0xff4402[_0x354f('0x30')][_0x354f('0x33')]?_0xff4402[_0x354f('0x30')]:_0x3b34ca[_0x354f('0x2d')];if(_0x7835a0[_0x354f('0x2e')][_0x354f('0x3e')]){_0xff4402['include']=[{'all':!![]}];}_0xff4402=_['merge']({},_0xff4402,_0x7835a0[_0x354f('0x3d')]);return db[_0x354f('0x29')][_0x354f('0x43')](_0xff4402)[_0x354f('0x21')](handleEntityNotFound(_0x433ff0,null))[_0x354f('0x21')](respondWithResult(_0x433ff0,null))[_0x354f('0x44')](handleError(_0x433ff0,null));};exports['create']=function(_0x55f2c9,_0x6b7a2c){return db['Tag'][_0x354f('0x45')](_0x55f2c9[_0x354f('0x46')],{})[_0x354f('0x21')](function(_0x4e270d){var _0x59963e=_0x55f2c9[_0x354f('0x47')][_0x354f('0x48')]({'plain':!![]});if(!_0x59963e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59963e[_0x354f('0x49')]===_0x354f('0x47')){var _0xf71a4f=_0x4e270d[_0x354f('0x48')]({'plain':!![]});var _0xf46a61=_0x354f('0x4a');return db[_0x354f('0x4b')]['find']({'where':{'name':_0xf46a61,'userProfileId':_0x59963e[_0x354f('0x4c')]},'raw':!![]})[_0x354f('0x21')](function(_0x9ccdaa){if(_0x9ccdaa&&_0x9ccdaa[_0x354f('0x4d')]===0x0){return db[_0x354f('0x4e')]['create']({'name':_0xf71a4f[_0x354f('0x25')],'resourceId':_0xf71a4f['id'],'type':_0x9ccdaa[_0x354f('0x25')],'sectionId':_0x9ccdaa['id']},{})['then'](function(){return _0x4e270d;});}else{return _0x4e270d;}})['catch'](function(_0x44495b){logger[_0x354f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44495b);throw _0x44495b;});}return _0x4e270d;})['then'](respondWithResult(_0x6b7a2c,0xc9))[_0x354f('0x44')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x20')]=function(_0x4df08f,_0x43a0b1){if(_0x4df08f[_0x354f('0x46')]['id']){delete _0x4df08f[_0x354f('0x46')]['id'];}return db[_0x354f('0x29')][_0x354f('0x43')]({'where':{'id':_0x4df08f[_0x354f('0x42')]['id']}})[_0x354f('0x21')](handleEntityNotFound(_0x43a0b1,null))['then'](saveUpdates(_0x4df08f[_0x354f('0x46')],null))[_0x354f('0x21')](respondWithResult(_0x43a0b1,null))[_0x354f('0x44')](handleError(_0x43a0b1,null));};exports[_0x354f('0x22')]=function(_0x5a6baf,_0x2edb7c){return db[_0x354f('0x29')][_0x354f('0x43')]({'where':{'id':_0x5a6baf[_0x354f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2edb7c,null))[_0x354f('0x21')](removeEntity(_0x2edb7c,null))[_0x354f('0x44')](handleError(_0x2edb7c,null));}; \ No newline at end of file +var _0x66fa=['status','offset','undefined','limit','count','Content-Range','reject','update','then','get','Tags','UserProfileResource','end','error','name','map','Tag','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4dbcba,_0x34a8e4){var _0x15256a=function(_0x495163){while(--_0x495163){_0x4dbcba['push'](_0x4dbcba['shift']());}};_0x15256a(++_0x34a8e4);}(_0x66fa,0x168));var _0xa66f=function(_0x453191,_0x125ccb){_0x453191=_0x453191-0x0;var _0x12683e=_0x66fa[_0x453191];return _0x12683e;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require(_0xa66f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var Mustache=require(_0xa66f('0x5'));var util=require(_0xa66f('0x6'));var path=require(_0xa66f('0x7'));var sox=require(_0xa66f('0x8'));var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var fs_extra=require(_0xa66f('0xb'));var _=require(_0xa66f('0xc'));var squel=require(_0xa66f('0xd'));var crypto=require('crypto');var jsforce=require(_0xa66f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa66f('0x9'));var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require(_0xa66f('0x11'));var qs=require(_0xa66f('0x12'));var as=require(_0xa66f('0x13'));var hardwareService=require(_0xa66f('0x14'));var logger=require(_0xa66f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa66f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66f('0x17'))['db'];function respondWithStatusCode(_0x6ad626,_0x1162c0){_0x1162c0=_0x1162c0||0xcc;return function(_0x4b0dad){if(_0x4b0dad){return _0x6ad626[_0xa66f('0x18')](_0x1162c0);}return _0x6ad626[_0xa66f('0x19')](_0x1162c0)['end']();};}function respondWithResult(_0xaa9ef5,_0x24423a){_0x24423a=_0x24423a||0xc8;return function(_0x263e64){if(_0x263e64){return _0xaa9ef5[_0xa66f('0x19')](_0x24423a)['json'](_0x263e64);}};}function respondWithFilteredResult(_0x3795cb,_0x27f04e){return function(_0x5685c4){if(_0x5685c4){var _0x2d9ec7=typeof _0x27f04e[_0xa66f('0x1a')]===_0xa66f('0x1b')&&typeof _0x27f04e[_0xa66f('0x1c')]===_0xa66f('0x1b');var _0x362988=_0x5685c4['count'];var _0x4d5e31=_0x2d9ec7?0x0:_0x27f04e[_0xa66f('0x1a')];var _0x16648b=_0x2d9ec7?_0x5685c4[_0xa66f('0x1d')]:_0x27f04e[_0xa66f('0x1a')]+_0x27f04e['limit'];var _0x1e448e;if(_0x16648b>=_0x362988){_0x16648b=_0x362988;_0x1e448e=0xc8;}else{_0x1e448e=0xce;}_0x3795cb[_0xa66f('0x19')](_0x1e448e);return _0x3795cb['set'](_0xa66f('0x1e'),_0x4d5e31+'-'+_0x16648b+'/'+_0x362988)['json'](_0x5685c4);}return null;};}function patchUpdates(_0x3f4977){return function(_0x32d0a9){try{jsonpatch['apply'](_0x32d0a9,_0x3f4977,!![]);}catch(_0x585208){return BPromise[_0xa66f('0x1f')](_0x585208);}return _0x32d0a9['save']();};}function saveUpdates(_0x5b2cf0,_0x59f7aa){return function(_0x535359){if(_0x535359){return _0x535359[_0xa66f('0x20')](_0x5b2cf0)[_0xa66f('0x21')](function(_0x1aeaf2){return _0x1aeaf2;});}return null;};}function removeEntity(_0x4cfec6,_0x20bf81){return function(_0xe5e0f1){if(_0xe5e0f1){return _0xe5e0f1['destroy']()[_0xa66f('0x21')](function(){var _0x473b00=_0xe5e0f1[_0xa66f('0x22')]({'plain':!![]});var _0x29dfe5=_0xa66f('0x23');return db[_0xa66f('0x24')]['destroy']({'where':{'type':_0x29dfe5,'resourceId':_0x473b00['id']}})['then'](function(){return _0xe5e0f1;});})[_0xa66f('0x21')](function(){_0x4cfec6['status'](0xcc)[_0xa66f('0x25')]();});}};}function handleEntityNotFound(_0x278531,_0x2cf4c9){return function(_0x49e1b3){if(!_0x49e1b3){_0x278531[_0xa66f('0x18')](0x194);}return _0x49e1b3;};}function handleError(_0x4ca0a4,_0x52c615){_0x52c615=_0x52c615||0x1f4;return function(_0x4c7b82){logger[_0xa66f('0x26')](_0x4c7b82['stack']);if(_0x4c7b82[_0xa66f('0x27')]){delete _0x4c7b82[_0xa66f('0x27')];}_0x4ca0a4[_0xa66f('0x19')](_0x52c615)['send'](_0x4c7b82);};}exports['index']=function(_0x3ad042,_0x416c25){var _0xb7a0a3={},_0x5583eb={},_0x46c525={'count':0x0,'rows':[]};var _0x56116a=_[_0xa66f('0x28')](db[_0xa66f('0x29')][_0xa66f('0x2a')],function(_0x36525b){return{'name':_0x36525b[_0xa66f('0x2b')],'type':_0x36525b[_0xa66f('0x2c')]['key']};});_0x5583eb[_0xa66f('0x2d')]=_[_0xa66f('0x28')](_0x56116a,'name');_0x5583eb[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x3ad042['query']);_0x5583eb['filters']=_[_0xa66f('0x30')](_0x5583eb[_0xa66f('0x2d')],_0x5583eb[_0xa66f('0x2e')]);_0xb7a0a3[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x5583eb[_0xa66f('0x2d')],qs['fields'](_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x32')]));_0xb7a0a3[_0xa66f('0x31')]=_0xb7a0a3[_0xa66f('0x31')]['length']?_0xb7a0a3['attributes']:_0x5583eb[_0xa66f('0x2d')];if(!_0x3ad042['query'][_0xa66f('0x33')](_0xa66f('0x34'))){_0xb7a0a3[_0xa66f('0x1c')]=qs[_0xa66f('0x1c')](_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x1c')]);_0xb7a0a3[_0xa66f('0x1a')]=qs[_0xa66f('0x1a')](_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x1a')]);}_0xb7a0a3[_0xa66f('0x35')]=qs[_0xa66f('0x36')](_0x3ad042['query'][_0xa66f('0x36')]);_0xb7a0a3[_0xa66f('0x37')]=qs['filters'](_[_0xa66f('0x38')](_0x3ad042['query'],_0x5583eb[_0xa66f('0x39')]),_0x56116a);if(_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x3a')]){_0xb7a0a3[_0xa66f('0x37')]=_['merge'](_0xb7a0a3[_0xa66f('0x37')],{'$or':_[_0xa66f('0x28')](_0x56116a,function(_0x1d68ae){if(_0x1d68ae[_0xa66f('0x2c')]!=='VIRTUAL'){var _0x111e80={};_0x111e80[_0x1d68ae['name']]={'$like':'%'+_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x3a')]+'%'};return _0x111e80;}})});}_0xb7a0a3=_[_0xa66f('0x3b')]({},_0xb7a0a3,_0x3ad042[_0xa66f('0x3c')]);var _0x48c375={'where':_0xb7a0a3[_0xa66f('0x37')]};return db['Tag'][_0xa66f('0x1d')](_0x48c375)[_0xa66f('0x21')](function(_0x2f9b5f){_0x46c525[_0xa66f('0x1d')]=_0x2f9b5f;if(_0x3ad042[_0xa66f('0x2e')][_0xa66f('0x3d')]){_0xb7a0a3[_0xa66f('0x3e')]=[{'all':!![]}];}return db[_0xa66f('0x29')][_0xa66f('0x3f')](_0xb7a0a3);})[_0xa66f('0x21')](function(_0x324818){_0x46c525[_0xa66f('0x40')]=_0x324818;return _0x46c525;})[_0xa66f('0x21')](respondWithFilteredResult(_0x416c25,_0xb7a0a3))[_0xa66f('0x41')](handleError(_0x416c25,null));};exports[_0xa66f('0x42')]=function(_0x4f43e1,_0x2a2f46){var _0x3fe92d={'raw':!![],'where':{'id':_0x4f43e1['params']['id']}},_0x70f6da={};_0x70f6da[_0xa66f('0x2d')]=_['keys'](db[_0xa66f('0x29')][_0xa66f('0x2a')]);_0x70f6da[_0xa66f('0x2e')]=_['keys'](_0x4f43e1['query']);_0x70f6da[_0xa66f('0x39')]=_[_0xa66f('0x30')](_0x70f6da[_0xa66f('0x2d')],_0x70f6da[_0xa66f('0x2e')]);_0x3fe92d[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x70f6da['model'],qs[_0xa66f('0x32')](_0x4f43e1[_0xa66f('0x2e')]['fields']));_0x3fe92d['attributes']=_0x3fe92d[_0xa66f('0x31')][_0xa66f('0x43')]?_0x3fe92d[_0xa66f('0x31')]:_0x70f6da[_0xa66f('0x2d')];if(_0x4f43e1[_0xa66f('0x2e')]['includeAll']){_0x3fe92d[_0xa66f('0x3e')]=[{'all':!![]}];}_0x3fe92d=_[_0xa66f('0x3b')]({},_0x3fe92d,_0x4f43e1[_0xa66f('0x3c')]);return db[_0xa66f('0x29')][_0xa66f('0x44')](_0x3fe92d)['then'](handleEntityNotFound(_0x2a2f46,null))[_0xa66f('0x21')](respondWithResult(_0x2a2f46,null))[_0xa66f('0x41')](handleError(_0x2a2f46,null));};exports[_0xa66f('0x45')]=function(_0x2dc004,_0x35108c){return db['Tag']['create'](_0x2dc004[_0xa66f('0x46')],{})[_0xa66f('0x21')](function(_0x35d81f){var _0x312f1a=_0x2dc004[_0xa66f('0x47')][_0xa66f('0x22')]({'plain':!![]});if(!_0x312f1a)throw new Error(_0xa66f('0x48'));if(_0x312f1a[_0xa66f('0x49')]==='user'){var _0x396f4c=_0x35d81f[_0xa66f('0x22')]({'plain':!![]});var _0xb0c56=_0xa66f('0x23');return db[_0xa66f('0x4a')]['find']({'where':{'name':_0xb0c56,'userProfileId':_0x312f1a[_0xa66f('0x4b')]},'raw':!![]})[_0xa66f('0x21')](function(_0xc195b1){if(_0xc195b1&&_0xc195b1['autoAssociation']===0x0){return db['UserProfileResource'][_0xa66f('0x45')]({'name':_0x396f4c[_0xa66f('0x27')],'resourceId':_0x396f4c['id'],'type':_0xc195b1[_0xa66f('0x27')],'sectionId':_0xc195b1['id']},{})[_0xa66f('0x21')](function(){return _0x35d81f;});}else{return _0x35d81f;}})[_0xa66f('0x41')](function(_0x5b800e){logger[_0xa66f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b800e);throw _0x5b800e;});}return _0x35d81f;})[_0xa66f('0x21')](respondWithResult(_0x35108c,0xc9))[_0xa66f('0x41')](handleError(_0x35108c,null));};exports[_0xa66f('0x20')]=function(_0x4f3406,_0x11b725){if(_0x4f3406['body']['id']){delete _0x4f3406[_0xa66f('0x46')]['id'];}return db[_0xa66f('0x29')][_0xa66f('0x44')]({'where':{'id':_0x4f3406[_0xa66f('0x4c')]['id']}})[_0xa66f('0x21')](handleEntityNotFound(_0x11b725,null))[_0xa66f('0x21')](saveUpdates(_0x4f3406[_0xa66f('0x46')],null))['then'](respondWithResult(_0x11b725,null))['catch'](handleError(_0x11b725,null));};exports['destroy']=function(_0x1a057b,_0x334eca){return db[_0xa66f('0x29')][_0xa66f('0x44')]({'where':{'id':_0x1a057b[_0xa66f('0x4c')]['id']}})[_0xa66f('0x21')](handleEntityNotFound(_0x334eca,null))[_0xa66f('0x21')](removeEntity(_0x334eca,null))['catch'](handleError(_0x334eca,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1d1d4fe..10948bc 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 _0x496b=['Tag','tools_tags','lodash','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define'];(function(_0x117d8d,_0x28d62d){var _0x40b7a2=function(_0x3471e8){while(--_0x3471e8){_0x117d8d['push'](_0x117d8d['shift']());}};_0x40b7a2(++_0x28d62d);}(_0x496b,0x1c4));var _0xb496=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x496b[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xb496('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb496('0x1'));var rp=require(_0xb496('0x2'));var fs=require('fs');var path=require(_0xb496('0x3'));var rimraf=require(_0xb496('0x4'));var config=require('../../config/environment');var attributes=require(_0xb496('0x5'));module[_0xb496('0x6')]=function(_0x1b7fc5,_0x24e7e7){return _0x1b7fc5[_0xb496('0x7')](_0xb496('0x8'),attributes,{'tableName':_0xb496('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdcb=['define','Tag','tools_tags','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x558f5f,_0x55215e){var _0x1172ac=function(_0x2de4f2){while(--_0x2de4f2){_0x558f5f['push'](_0x558f5f['shift']());}};_0x1172ac(++_0x55215e);}(_0xbdcb,0x1e3));var _0xbbdc=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xbdcb[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xbbdc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbbdc('0x1'));var moment=require(_0xbbdc('0x2'));var BPromise=require(_0xbbdc('0x3'));var rp=require(_0xbbdc('0x4'));var fs=require('fs');var path=require(_0xbbdc('0x5'));var rimraf=require(_0xbbdc('0x6'));var config=require(_0xbbdc('0x7'));var attributes=require(_0xbbdc('0x8'));module['exports']=function(_0x2bab02,_0xa1ec24){return _0x2bab02[_0xbbdc('0x9')](_0xbbdc('0xa'),attributes,{'tableName':_0xbbdc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index fd35fde..380d87c 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 _0xa8a8=['stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x583112,_0x417785){var _0x23b27c=function(_0x44f2d0){while(--_0x44f2d0){_0x583112['push'](_0x583112['shift']());}};_0x23b27c(++_0x417785);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1a8e5a,_0x224d83){_0x1a8e5a=_0x1a8e5a-0x0;var _0x234e20=_0xa8a8[_0x1a8e5a];return _0x234e20;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('Tag,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('Tag,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0xd382=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','Tag,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x349c7c,_0x593549){var _0x378552=function(_0x31c92d){while(--_0x31c92d){_0x349c7c['push'](_0x349c7c['shift']());}};_0x378552(++_0x593549);}(_0xd382,0x1b6));var _0x2d38=function(_0x8e1578,_0x55015e){_0x8e1578=_0x8e1578-0x0;var _0x3bdd31=_0xd382[_0x8e1578];return _0x3bdd31;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2919,_0x55ae65,_0x1296cb){return new BPromise(function(_0x3fb88f,_0x39ebfd){return client['request'](_0x1e2919,_0x1296cb)['then'](function(_0x5f20a4){logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,'request\x20sent');logger[_0x2d38('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x55ae65,_0x2d38('0xe'),JSON[_0x2d38('0xf')](_0x5f20a4));if(_0x5f20a4[_0x2d38('0x10')]){if(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x11')]===0x1f4){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x39ebfd(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x5f20a4['error'][_0x2d38('0x12')]);return _0x3fb88f(_0x5f20a4[_0x2d38('0x10')][_0x2d38('0x12')]);}else{logger[_0x2d38('0xb')](_0x2d38('0xc'),_0x55ae65,_0x2d38('0xe'));_0x3fb88f(_0x5f20a4[_0x2d38('0x13')][_0x2d38('0x12')]);}})[_0x2d38('0x14')](function(_0x6d2a9a){logger[_0x2d38('0x10')](_0x2d38('0xc'),_0x55ae65,_0x6d2a9a);_0x39ebfd(_0x6d2a9a);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b036cc1..0a5269d 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_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['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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 045ed74..61d4b01 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 _0xb10b=['name','sequelize','STRING'];(function(_0x2106e3,_0x49b1cb){var _0x5b961c=function(_0x40910d){while(--_0x40910d){_0x2106e3['push'](_0x2106e3['shift']());}};_0x5b961c(++_0x49b1cb);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0xb10b[_0x4d821c];return _0x15dd5b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x12f763,_0x1965bf){var _0x475eed=function(_0x5605ed){while(--_0x5605ed){_0x12f763['push'](_0x12f763['shift']());}};_0x475eed(++_0x1965bf);}(_0x2032,0xd9));var _0x2203=function(_0x31d803,_0x2ca91d){_0x31d803=_0x31d803-0x0;var _0x348c7d=_0x2032[_0x31d803];return _0x348c7d;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c5931e1..0b847e6 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 _0xa512=['sequelize','Sequelize','QueryTypes','UserId','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','pick','Queues','addQueues','add','capitalize','remove','ids','addAgents','isArray','Voice','Mail','Fax','transaction','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','penalty','all','VoicePrefixId','spread','removeAgents','Sms','Whatsapp','getAgents','eml-format','rimraf','zip-dir','request-promise','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','Team','includeAll','findAll','rows','catch','show','include','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy'];(function(_0x283b55,_0x279bee){var _0x192e58=function(_0x535c7c){while(--_0x535c7c){_0x283b55['push'](_0x283b55['shift']());}};_0x192e58(++_0x279bee);}(_0xa512,0x165));var _0x2a51=function(_0x14ee69,_0x436a8a){_0x14ee69=_0x14ee69-0x0;var _0x4d5664=_0xa512[_0x14ee69];return _0x4d5664;};'use strict';var emlformat=require(_0x2a51('0x0'));var rimraf=require(_0x2a51('0x1'));var zipdir=require(_0x2a51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a51('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a51('0x4'));var path=require(_0x2a51('0x5'));var sox=require('sox');var csv=require(_0x2a51('0x6'));var ejs=require(_0x2a51('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a51('0x8'));var crypto=require(_0x2a51('0x9'));var jsforce=require(_0x2a51('0xa'));var deskjs=require(_0x2a51('0xb'));var toCsv=require(_0x2a51('0x6'));var querystring=require(_0x2a51('0xc'));var Papa=require(_0x2a51('0xd'));var Redis=require(_0x2a51('0xe'));var authService=require(_0x2a51('0xf'));var qs=require(_0x2a51('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a51('0x11'));var logger=require(_0x2a51('0x12'))(_0x2a51('0x13'));var utils=require('../../config/utils');var config=require(_0x2a51('0x14'));var licenseUtil=require(_0x2a51('0x15'));var db=require(_0x2a51('0x16'))['db'];config[_0x2a51('0x17')]=_[_0x2a51('0x18')](config['redis'],{'host':_0x2a51('0x19'),'port':0x18eb});var socket=require(_0x2a51('0x1a'))(new Redis(config[_0x2a51('0x17')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x33c2e3,_0x1b3017){_0x1b3017=_0x1b3017||0xcc;return function(_0x399970){if(_0x399970){return _0x33c2e3[_0x2a51('0x1b')](_0x1b3017);}return _0x33c2e3[_0x2a51('0x1c')](_0x1b3017)[_0x2a51('0x1d')]();};}function respondWithResult(_0x1e888b,_0x3b7ace){_0x3b7ace=_0x3b7ace||0xc8;return function(_0x3a4f9e){if(_0x3a4f9e){return _0x1e888b[_0x2a51('0x1c')](_0x3b7ace)['json'](_0x3a4f9e);}};}function respondWithFilteredResult(_0x2e2afc,_0x5f5746){return function(_0x1271a2){if(_0x1271a2){var _0x5365f9=typeof _0x5f5746[_0x2a51('0x1e')]==='undefined'&&typeof _0x5f5746['limit']===_0x2a51('0x1f');var _0x5a4b42=_0x1271a2[_0x2a51('0x20')];var _0x53023b=_0x5365f9?0x0:_0x5f5746['offset'];var _0x121f2c=_0x5365f9?_0x1271a2[_0x2a51('0x20')]:_0x5f5746['offset']+_0x5f5746['limit'];var _0xeff82a;if(_0x121f2c>=_0x5a4b42){_0x121f2c=_0x5a4b42;_0xeff82a=0xc8;}else{_0xeff82a=0xce;}_0x2e2afc[_0x2a51('0x1c')](_0xeff82a);return _0x2e2afc[_0x2a51('0x21')](_0x2a51('0x22'),_0x53023b+'-'+_0x121f2c+'/'+_0x5a4b42)[_0x2a51('0x23')](_0x1271a2);}return null;};}function patchUpdates(_0x5ade76){return function(_0x197634){try{jsonpatch[_0x2a51('0x24')](_0x197634,_0x5ade76,!![]);}catch(_0x315efd){return BPromise[_0x2a51('0x25')](_0x315efd);}return _0x197634[_0x2a51('0x26')]();};}function saveUpdates(_0x48ca20,_0x2ada8f){return function(_0x49f63e){if(_0x49f63e){return _0x49f63e[_0x2a51('0x27')](_0x48ca20)[_0x2a51('0x28')](function(_0x4157d9){return _0x4157d9;});}return null;};}function handleEntityNotFound(_0x58430a,_0x189539){return function(_0x5a852e){if(!_0x5a852e){_0x58430a[_0x2a51('0x1b')](0x194);}return _0x5a852e;};}function handleError(_0x43ec5e,_0x38a514){_0x38a514=_0x38a514||0x1f4;return function(_0x32e289){logger[_0x2a51('0x29')](_0x32e289[_0x2a51('0x2a')]);if(_0x32e289['name']){delete _0x32e289[_0x2a51('0x2b')];}_0x43ec5e['status'](_0x38a514)['send'](_0x32e289);};}exports['index']=function(_0x13c871,_0x169c9b){var _0x39be6d={},_0x5424af={},_0x433678={'count':0x0,'rows':[]};var _0x1f09b5=_['map'](db['Team'][_0x2a51('0x2c')],function(_0x4c267d){return{'name':_0x4c267d[_0x2a51('0x2d')],'type':_0x4c267d[_0x2a51('0x2e')][_0x2a51('0x2f')]};});_0x5424af[_0x2a51('0x30')]=_[_0x2a51('0x31')](_0x1f09b5,_0x2a51('0x2b'));_0x5424af[_0x2a51('0x32')]=_[_0x2a51('0x33')](_0x13c871[_0x2a51('0x32')]);_0x5424af[_0x2a51('0x34')]=_[_0x2a51('0x35')](_0x5424af[_0x2a51('0x30')],_0x5424af['query']);_0x39be6d[_0x2a51('0x36')]=_[_0x2a51('0x35')](_0x5424af[_0x2a51('0x30')],qs[_0x2a51('0x37')](_0x13c871['query'][_0x2a51('0x37')]));_0x39be6d['attributes']=_0x39be6d['attributes'][_0x2a51('0x38')]?_0x39be6d[_0x2a51('0x36')]:_0x5424af[_0x2a51('0x30')];if(!_0x13c871[_0x2a51('0x32')][_0x2a51('0x39')](_0x2a51('0x3a'))){_0x39be6d[_0x2a51('0x3b')]=qs[_0x2a51('0x3b')](_0x13c871['query'][_0x2a51('0x3b')]);_0x39be6d[_0x2a51('0x1e')]=qs[_0x2a51('0x1e')](_0x13c871[_0x2a51('0x32')]['offset']);}_0x39be6d[_0x2a51('0x3c')]=qs[_0x2a51('0x3d')](_0x13c871[_0x2a51('0x32')][_0x2a51('0x3d')]);_0x39be6d['where']=qs[_0x2a51('0x34')](_['pick'](_0x13c871['query'],_0x5424af[_0x2a51('0x34')]),_0x1f09b5);if(_0x13c871[_0x2a51('0x32')][_0x2a51('0x3e')]){_0x39be6d[_0x2a51('0x3f')]=_[_0x2a51('0x40')](_0x39be6d[_0x2a51('0x3f')],{'$or':_[_0x2a51('0x31')](_0x1f09b5,function(_0x13435f){if(_0x13435f['type']!=='VIRTUAL'){var _0x41f1e6={};_0x41f1e6[_0x13435f['name']]={'$like':'%'+_0x13c871[_0x2a51('0x32')][_0x2a51('0x3e')]+'%'};return _0x41f1e6;}})});}_0x39be6d=_['merge']({},_0x39be6d,_0x13c871[_0x2a51('0x41')]);var _0x11e251={'where':_0x39be6d[_0x2a51('0x3f')]};return db[_0x2a51('0x42')][_0x2a51('0x20')](_0x11e251)[_0x2a51('0x28')](function(_0x25d545){_0x433678[_0x2a51('0x20')]=_0x25d545;if(_0x13c871[_0x2a51('0x32')][_0x2a51('0x43')]){_0x39be6d['include']=[{'all':!![]}];}return db['Team'][_0x2a51('0x44')](_0x39be6d);})['then'](function(_0x510f09){_0x433678[_0x2a51('0x45')]=_0x510f09;return _0x433678;})[_0x2a51('0x28')](respondWithFilteredResult(_0x169c9b,_0x39be6d))[_0x2a51('0x46')](handleError(_0x169c9b,null));};exports[_0x2a51('0x47')]=function(_0x467c9b,_0x2b7c8d){var _0x2c7abc={'raw':![],'where':{'id':_0x467c9b['params']['id']}},_0x57ac5f={};_0x57ac5f[_0x2a51('0x30')]=_[_0x2a51('0x33')](db[_0x2a51('0x42')]['rawAttributes']);_0x57ac5f[_0x2a51('0x32')]=_[_0x2a51('0x33')](_0x467c9b[_0x2a51('0x32')]);_0x57ac5f[_0x2a51('0x34')]=_[_0x2a51('0x35')](_0x57ac5f[_0x2a51('0x30')],_0x57ac5f[_0x2a51('0x32')]);_0x2c7abc[_0x2a51('0x36')]=_[_0x2a51('0x35')](_0x57ac5f[_0x2a51('0x30')],qs[_0x2a51('0x37')](_0x467c9b[_0x2a51('0x32')][_0x2a51('0x37')]));_0x2c7abc[_0x2a51('0x36')]=_0x2c7abc[_0x2a51('0x36')][_0x2a51('0x38')]?_0x2c7abc[_0x2a51('0x36')]:_0x57ac5f[_0x2a51('0x30')];if(_0x467c9b[_0x2a51('0x32')]['includeAll']){_0x2c7abc[_0x2a51('0x48')]=[{'all':!![]}];}_0x2c7abc=_[_0x2a51('0x40')]({},_0x2c7abc,_0x467c9b['options']);return db['Team'][_0x2a51('0x49')](_0x2c7abc)[_0x2a51('0x28')](handleEntityNotFound(_0x2b7c8d,null))[_0x2a51('0x28')](respondWithResult(_0x2b7c8d,null))[_0x2a51('0x46')](handleError(_0x2b7c8d,null));};exports[_0x2a51('0x4a')]=function(_0x4998a2,_0x10723d){return db[_0x2a51('0x42')][_0x2a51('0x4a')](_0x4998a2[_0x2a51('0x4b')],{})[_0x2a51('0x28')](function(_0x6998fa){var _0x22a78e=_0x4998a2[_0x2a51('0x4c')][_0x2a51('0x4d')]({'plain':!![]});if(!_0x22a78e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22a78e[_0x2a51('0x4e')]===_0x2a51('0x4c')){var _0x42e236=_0x6998fa[_0x2a51('0x4d')]({'plain':!![]});var _0x50415b=_0x2a51('0x4f');return db[_0x2a51('0x50')][_0x2a51('0x49')]({'where':{'name':_0x50415b,'userProfileId':_0x22a78e[_0x2a51('0x51')]},'raw':!![]})[_0x2a51('0x28')](function(_0x3baebe){if(_0x3baebe&&_0x3baebe[_0x2a51('0x52')]===0x0){return db[_0x2a51('0x53')][_0x2a51('0x4a')]({'name':_0x42e236['name'],'resourceId':_0x42e236['id'],'type':_0x3baebe[_0x2a51('0x2b')],'sectionId':_0x3baebe['id']},{})[_0x2a51('0x28')](function(){return _0x6998fa;});}else{return _0x6998fa;}})['catch'](function(_0x1c53d0){logger[_0x2a51('0x29')](_0x2a51('0x54'),_0x1c53d0);throw _0x1c53d0;});}return _0x6998fa;})[_0x2a51('0x28')](respondWithResult(_0x10723d,0xc9))[_0x2a51('0x46')](handleError(_0x10723d,null));};exports[_0x2a51('0x27')]=function(_0x463148,_0x500718){if(_0x463148[_0x2a51('0x4b')]['id']){delete _0x463148[_0x2a51('0x4b')]['id'];}return db[_0x2a51('0x42')][_0x2a51('0x49')]({'where':{'id':_0x463148[_0x2a51('0x55')]['id']}})[_0x2a51('0x28')](handleEntityNotFound(_0x500718,null))[_0x2a51('0x28')](saveUpdates(_0x463148[_0x2a51('0x4b')],null))[_0x2a51('0x28')](respondWithResult(_0x500718,null))[_0x2a51('0x46')](handleError(_0x500718,null));};exports[_0x2a51('0x56')]=function(_0x1f0e4a,_0x4fce9f){var _0x1b8d0f=_0x1f0e4a[_0x2a51('0x55')]['id'];var _0x4d61a9=[];return db[_0x2a51('0x57')]['transaction'](function(_0x388d8a){var _0x5276de='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1b8d0f;return db[_0x2a51('0x57')][_0x2a51('0x32')](_0x5276de,{'type':db[_0x2a51('0x58')][_0x2a51('0x59')]['SELECT'],'raw':!![],'transaction':_0x388d8a})[_0x2a51('0x28')](function(_0x625521){_0x4d61a9=_['map'](_0x625521,function(_0x1b79e3){return Number(_0x1b79e3[_0x2a51('0x5a')]);});})[_0x2a51('0x28')](function(){var _0x5636b2='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1b8d0f;return db['sequelize'][_0x2a51('0x32')](_0x5636b2,{'type':db[_0x2a51('0x58')]['QueryTypes'][_0x2a51('0x5b')],'raw':!![],'transaction':_0x388d8a});})[_0x2a51('0x28')](function(_0x68af49){var _0x19e1de=_[_0x2a51('0x31')](_0x68af49,function(_0x126fed){return Number(_0x126fed['VoiceQueueId']);});return db[_0x2a51('0x5c')]['destroy']({'where':{'UserId':{'$in':_0x4d61a9},'VoiceQueueId':{'$in':_0x19e1de}},'transaction':_0x388d8a});})[_0x2a51('0x28')](function(){var _0x24092b=_0x2a51('0x5d')+_0x1b8d0f;return db[_0x2a51('0x57')][_0x2a51('0x32')](_0x24092b,{'type':db[_0x2a51('0x58')][_0x2a51('0x59')][_0x2a51('0x5b')],'raw':!![],'transaction':_0x388d8a});})[_0x2a51('0x28')](function(_0x4ea3e9){var _0x4eed3b=_[_0x2a51('0x31')](_0x4ea3e9,function(_0x238f8d){return Number(_0x238f8d['MailQueueId']);});return db[_0x2a51('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x4d61a9},'MailQueueId':{'$in':_0x4eed3b}},'transaction':_0x388d8a});})[_0x2a51('0x28')](function(){var _0x4db72d=_0x2a51('0x5f')+_0x1b8d0f;return db[_0x2a51('0x57')][_0x2a51('0x32')](_0x4db72d,{'type':db[_0x2a51('0x58')][_0x2a51('0x59')][_0x2a51('0x5b')],'raw':!![],'transaction':_0x388d8a});})[_0x2a51('0x28')](function(_0x4103e1){var _0x12ff87=_['map'](_0x4103e1,function(_0x4492b0){return Number(_0x4492b0[_0x2a51('0x60')]);});return db[_0x2a51('0x61')][_0x2a51('0x56')]({'where':{'UserId':{'$in':_0x4d61a9},'SmsQueueId':{'$in':_0x12ff87}},'transaction':_0x388d8a});})[_0x2a51('0x28')](function(){var _0x459bb2='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1b8d0f;return db[_0x2a51('0x57')][_0x2a51('0x32')](_0x459bb2,{'type':db[_0x2a51('0x58')][_0x2a51('0x59')][_0x2a51('0x5b')],'raw':!![],'transaction':_0x388d8a});})['then'](function(_0x1adc81){var _0xada3f6=_[_0x2a51('0x31')](_0x1adc81,function(_0x52d517){return Number(_0x52d517['ChatQueueId']);});return db[_0x2a51('0x62')][_0x2a51('0x56')]({'where':{'UserId':{'$in':_0x4d61a9},'ChatQueueId':{'$in':_0xada3f6}},'transaction':_0x388d8a});})[_0x2a51('0x28')](function(){var _0x5016f7=_0x2a51('0x63')+_0x1b8d0f;return db[_0x2a51('0x57')][_0x2a51('0x32')](_0x5016f7,{'type':db[_0x2a51('0x58')][_0x2a51('0x59')][_0x2a51('0x5b')],'raw':!![],'transaction':_0x388d8a});})[_0x2a51('0x28')](function(_0x602b6c){var _0x29f6a0=_[_0x2a51('0x31')](_0x602b6c,function(_0x1617d0){return Number(_0x1617d0['FaxQueueId']);});return db['UserFaxQueue'][_0x2a51('0x56')]({'where':{'UserId':{'$in':_0x4d61a9},'FaxQueueId':{'$in':_0x29f6a0}},'transaction':_0x388d8a});})[_0x2a51('0x28')](function(){var _0x15af11=_0x2a51('0x64')+_0x1b8d0f;return db[_0x2a51('0x57')][_0x2a51('0x32')](_0x15af11,{'type':db[_0x2a51('0x58')]['QueryTypes'][_0x2a51('0x5b')],'raw':!![],'transaction':_0x388d8a});})[_0x2a51('0x28')](function(_0x17ad78){var _0x9a87ee=_[_0x2a51('0x31')](_0x17ad78,function(_0x49229a){return Number(_0x49229a[_0x2a51('0x65')]);});return db['UserOpenchannelQueue'][_0x2a51('0x56')]({'where':{'UserId':{'$in':_0x4d61a9},'OpenchannelQueueId':{'$in':_0x9a87ee}},'transaction':_0x388d8a});})['then'](function(){var _0x3f47f5=_0x2a51('0x66')+_0x1b8d0f;return db[_0x2a51('0x57')][_0x2a51('0x32')](_0x3f47f5,{'type':db['Sequelize']['QueryTypes'][_0x2a51('0x5b')],'raw':!![],'transaction':_0x388d8a});})[_0x2a51('0x28')](function(_0x3bc814){var _0x5e3051=_[_0x2a51('0x31')](_0x3bc814,function(_0x3ce268){return Number(_0x3ce268[_0x2a51('0x67')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x4d61a9},'WhatsappQueueId':{'$in':_0x5e3051}},'transaction':_0x388d8a});})[_0x2a51('0x28')](function(){return db[_0x2a51('0x68')][_0x2a51('0x49')]({'where':{'TeamId':_0x1b8d0f}});})[_0x2a51('0x28')](function(_0x44a53c){if(_0x44a53c===null){return;}return db[_0x2a51('0x69')][_0x2a51('0x56')]({'where':{'UserId':{'$in':_0x4d61a9},'VoicePrefixId':_0x44a53c['VoicePrefixId']},'transaction':_0x388d8a});})[_0x2a51('0x28')](function(){return db[_0x2a51('0x42')][_0x2a51('0x56')]({'where':{'id':_0x1b8d0f},'cascade':!![],'transaction':_0x388d8a});})[_0x2a51('0x28')](function(_0x50e1c4){if(_0x50e1c4===0x0){_0x4fce9f['sendStatus'](0x194);}else{return db[_0x2a51('0x53')][_0x2a51('0x56')]({'where':{'type':_0x2a51('0x4f'),'resourceId':_0x1b8d0f},'cascade':!![],'transaction':_0x388d8a})[_0x2a51('0x28')](function(){_0x4fce9f[_0x2a51('0x1c')](0xcc)[_0x2a51('0x1d')]();});}})[_0x2a51('0x46')](function(_0x16fd1c){_0x4fce9f[_0x2a51('0x1c')](0x1f4)['send'](_0x16fd1c);});});};exports[_0x2a51('0x6a')]=function(_0x339ece,_0x5c9a57,_0x37db3e){return db[_0x2a51('0x42')][_0x2a51('0x6b')]({'where':{'id':_0x339ece[_0x2a51('0x55')]['id']}})[_0x2a51('0x28')](handleEntityNotFound(_0x5c9a57,null))[_0x2a51('0x28')](function(_0x52eb88){if(!_0x339ece[_0x2a51('0x32')][_0x2a51('0x6c')]||!utils[_0x2a51('0x6d')](_0x339ece['query'][_0x2a51('0x6c')])){throw new db[(_0x2a51('0x58'))][(_0x2a51('0x6e'))](_0x2a51('0x6f'));}var _0x3851c5={};var _0x5beca4={};_0x5beca4['model']=_['keys'](db[_['capitalize'](_0x339ece[_0x2a51('0x32')][_0x2a51('0x6c')][_0x2a51('0x70')]())+_0x2a51('0x71')][_0x2a51('0x2c')]);_0x5beca4['query']=_[_0x2a51('0x33')](_0x339ece[_0x2a51('0x32')]);_0x5beca4[_0x2a51('0x34')]=_['intersection'](_0x5beca4[_0x2a51('0x30')],_0x5beca4[_0x2a51('0x32')]);_0x3851c5[_0x2a51('0x36')]=_[_0x2a51('0x35')](_0x5beca4[_0x2a51('0x30')],qs[_0x2a51('0x37')](_0x339ece['query']['fields']));_0x3851c5[_0x2a51('0x36')]=_0x3851c5[_0x2a51('0x36')][_0x2a51('0x38')]?_0x3851c5[_0x2a51('0x36')]:_0x5beca4[_0x2a51('0x30')];_0x3851c5['limit']=qs['limit'](_0x339ece[_0x2a51('0x32')]['limit']);_0x3851c5[_0x2a51('0x1e')]=qs['offset'](_0x339ece[_0x2a51('0x32')][_0x2a51('0x1e')]);_0x3851c5[_0x2a51('0x3c')]=qs[_0x2a51('0x3d')](_0x339ece[_0x2a51('0x32')][_0x2a51('0x3d')]);_0x3851c5['where']=qs[_0x2a51('0x34')](_[_0x2a51('0x72')](_0x339ece[_0x2a51('0x32')],_0x5beca4[_0x2a51('0x34')]));_0x3851c5=_[_0x2a51('0x40')]({},_0x3851c5,_0x339ece[_0x2a51('0x41')]);return _0x52eb88[_0x2a51('0x4d')+_['capitalize'](_0x339ece[_0x2a51('0x32')][_0x2a51('0x6c')]['toLowerCase']())+_0x2a51('0x73')](_0x3851c5);})[_0x2a51('0x28')](respondWithResult(_0x5c9a57,null))[_0x2a51('0x46')](handleError(_0x5c9a57,null));};exports[_0x2a51('0x74')]=function(_0xdf84bb,_0x8388a2,_0x578724){return db[_0x2a51('0x42')][_0x2a51('0x6b')]({'where':{'id':_0xdf84bb['params']['id']}})[_0x2a51('0x28')](function(_0x4fccaf){if(_0x4fccaf){if(!_0xdf84bb[_0x2a51('0x4b')]['channel']||!utils['isValidChannel'](_0xdf84bb[_0x2a51('0x4b')][_0x2a51('0x6c')])){throw new db[(_0x2a51('0x58'))][(_0x2a51('0x6e'))]('Unknown\x20channel');}return _0x4fccaf[_0x2a51('0x75')+_[_0x2a51('0x76')](_0xdf84bb['body'][_0x2a51('0x6c')][_0x2a51('0x70')]())+_0x2a51('0x73')](_0xdf84bb[_0x2a51('0x4b')]['ids']);}return null;})[_0x2a51('0x28')](handleEntityNotFound(_0x8388a2,null))[_0x2a51('0x28')](respondWithStatusCode(_0x8388a2,null))[_0x2a51('0x46')](handleError(_0x8388a2,null));};exports['removeQueues']=function(_0x138251,_0x546e45,_0x25dec0){return db[_0x2a51('0x42')][_0x2a51('0x6b')]({'where':{'id':_0x138251[_0x2a51('0x55')]['id']}})[_0x2a51('0x28')](function(_0x49f288){if(_0x49f288){if(!_0x138251[_0x2a51('0x32')]['channel']||!utils['isValidChannel'](_0x138251[_0x2a51('0x32')][_0x2a51('0x6c')])){throw new db[(_0x2a51('0x58'))][(_0x2a51('0x6e'))](_0x2a51('0x6f'));}return _0x49f288[_0x2a51('0x77')+_[_0x2a51('0x76')](_0x138251[_0x2a51('0x32')]['channel'][_0x2a51('0x70')]())+_0x2a51('0x73')](_0x138251[_0x2a51('0x32')][_0x2a51('0x78')]);}return null;})[_0x2a51('0x28')](handleEntityNotFound(_0x546e45,null))[_0x2a51('0x28')](respondWithStatusCode(_0x546e45,null))[_0x2a51('0x46')](handleError(_0x546e45,null));};exports[_0x2a51('0x79')]=function(_0x51b5b0,_0x271891){var _0x416a87=_[_0x2a51('0x7a')](_0x51b5b0[_0x2a51('0x4b')][_0x2a51('0x78')])?_0x51b5b0['body']['ids']:[_0x51b5b0[_0x2a51('0x4b')][_0x2a51('0x78')]];var _0x390b74=_0x51b5b0[_0x2a51('0x55')]['id'];return db[_0x2a51('0x42')][_0x2a51('0x49')]({'where':{'id':_0x390b74}})[_0x2a51('0x28')](handleEntityNotFound(_0x271891,null))[_0x2a51('0x28')](function(_0x586645){if(_0x586645){var _0x20b7bb=[_0x2a51('0x7b'),'Chat',_0x2a51('0x7c'),'Sms',_0x2a51('0x7d'),'Openchannel','Whatsapp'];return db[_0x2a51('0x57')][_0x2a51('0x7e')](function(_0x4470d6){var _0x1cc713=_[_0x2a51('0x31')](_0x20b7bb,function(_0x29a2aa){var _0x434676={'attributes':['id',_0x2a51('0x2b')]};if(_0x29a2aa===_0x2a51('0x7b')){_0x434676['through']={'attributes':['penalty']};}return _0x586645['get'+_0x29a2aa+_0x2a51('0x73')](_0x434676)['then'](function(_0x3df062){var _0x213fd3=_[_0x2a51('0x31')](_0x3df062,function(_0x4abffe){var _0x294dfa=_['map'](_0x416a87,function(_0x1910e2){var _0x15ad2a={'where':{'UserId':_0x1910e2,[_0x29a2aa+_0x2a51('0x7f')]:_0x4abffe['id']},'transaction':_0x4470d6};if(_0x29a2aa===_0x2a51('0x7b')){_0x15ad2a[_0x2a51('0x18')]={'penalty':_0x4abffe[_0x2a51('0x80')]['penalty']};}return db[_0x2a51('0x81')+_0x29a2aa+'Queue'][_0x2a51('0x82')](_0x15ad2a)[_0x2a51('0x28')](function(){socket[_0x2a51('0x83')](_0x2a51('0x4c')+_0x29a2aa+_0x2a51('0x84'),{'UserId':_0x1910e2,[_0x29a2aa+_0x2a51('0x7f')]:_0x4abffe['id']});if(_0x29a2aa!=='Voice'){return;}return db[_0x2a51('0x81')]['findAll']({'where':{'id':_0x416a87,'online':0x1},'attributes':['id','name',_0x2a51('0x85'),_0x2a51('0x86'),_0x2a51('0x87')],'raw':!![]})[_0x2a51('0x28')](function(_0x4e58a1){var _0x519876=_[_0x2a51('0x31')](_0x4e58a1,function(_0x2c289a){return db[_0x2a51('0x88')][_0x2a51('0x89')]({'membername':_0x2c289a[_0x2a51('0x2b')],'UserId':_0x2c289a['id'],'queue_name':_0x4abffe[_0x2a51('0x2b')],'VoiceQueueId':_0x4abffe['id'],'interface':_[_0x2a51('0x8a')](_0x2c289a['interface'])?util[_0x2a51('0x8b')]('SIP/%s',_0x2c289a['name']):_0x2c289a[_0x2a51('0x87')],'paused':_0x2c289a[_0x2a51('0x86')]||![],'penalty':_0x4abffe[_0x2a51('0x80')][_0x2a51('0x8c')]},{'transaction':_0x4470d6});});return Promise[_0x2a51('0x8d')](_0x519876);});});});return Promise[_0x2a51('0x8d')](_0x294dfa);});return Promise[_0x2a51('0x8d')](_0x213fd3);})['then'](function(){return db[_0x2a51('0x68')][_0x2a51('0x6b')]({'where':{'teamId':_0x390b74}})[_0x2a51('0x28')](function(_0x579905){if(_0x579905){var _0x549526=_[_0x2a51('0x31')](_0x416a87,function(_0x409126){db['UserVoicePrefix']['upsert']({'UserId':_0x409126,'VoicePrefixId':_0x579905[_0x2a51('0x8e')]});});return Promise['all'](_0x549526);}});});});return Promise[_0x2a51('0x8d')](_0x1cc713)['then'](function(){return _0x586645[_0x2a51('0x79')](_0x416a87,{'transaction':_0x4470d6})[_0x2a51('0x8f')](function(_0x35a07a){return _0x35a07a;});});});}})['then'](respondWithResult(_0x271891,null))[_0x2a51('0x46')](handleError(_0x271891,null));};exports[_0x2a51('0x90')]=function(_0x4ae7b7,_0x511a07){var _0x1b572b=_[_0x2a51('0x7a')](_0x4ae7b7['query'][_0x2a51('0x78')])?_0x4ae7b7[_0x2a51('0x32')]['ids']:[_0x4ae7b7['query']['ids']];var _0x3eb819=_0x4ae7b7[_0x2a51('0x55')]['id'];return db[_0x2a51('0x42')][_0x2a51('0x49')]({'where':{'id':_0x3eb819}})['then'](handleEntityNotFound(_0x511a07,null))[_0x2a51('0x28')](function(_0x2caa6b){if(_0x2caa6b){var _0x119564=[_0x2a51('0x7b'),'Chat',_0x2a51('0x7c'),_0x2a51('0x91'),_0x2a51('0x7d'),'Openchannel',_0x2a51('0x92')];return db['sequelize'][_0x2a51('0x7e')](function(_0x4e3a1d){var _0xf380d6=_[_0x2a51('0x31')](_0x119564,function(_0x1ed1df){var _0xc9cb3c={'attributes':['id','name']};return _0x2caa6b[_0x2a51('0x4d')+_0x1ed1df+_0x2a51('0x73')](_0xc9cb3c)[_0x2a51('0x28')](function(_0x24ad30){var _0x17ebf8=_[_0x2a51('0x31')](_0x24ad30,function(_0x5ca90d){return _0x5ca90d[_0x2a51('0x90')](_0x1b572b,{'transaction':_0x4e3a1d})[_0x2a51('0x28')](function(){var _0x25cea9=_[_0x2a51('0x31')](_0x1b572b,function(_0x463268){socket[_0x2a51('0x83')](_0x2a51('0x4c')+_0x1ed1df+'Queue:remove',{'UserId':Number(_0x463268),[_0x1ed1df+_0x2a51('0x7f')]:_0x5ca90d['id']});if(_0x1ed1df!==_0x2a51('0x7b')){return;}return db[_0x2a51('0x88')][_0x2a51('0x56')]({'where':{'VoiceQueueId':_0x5ca90d['id'],'UserId':_0x463268},'transaction':_0x4e3a1d});});return Promise[_0x2a51('0x8d')](_0x25cea9);});});return Promise[_0x2a51('0x8d')](_0x17ebf8);});});return Promise[_0x2a51('0x8d')](_0xf380d6)[_0x2a51('0x28')](function(){return _0x2caa6b[_0x2a51('0x90')](_0x1b572b,{'transaction':_0x4e3a1d});})['then'](function(){return db['TeamVoicePrefix'][_0x2a51('0x6b')]({'where':{'teamId':_0x3eb819}})[_0x2a51('0x28')](function(_0x3b6c29){if(_0x3b6c29){var _0x2f01d9=_[_0x2a51('0x31')](_0x1b572b,function(_0x5f149b){db[_0x2a51('0x69')][_0x2a51('0x56')]({'where':{'UserId':_0x5f149b,'VoicePrefixId':_0x3b6c29['VoicePrefixId']}});});return Promise[_0x2a51('0x8d')](_0x2f01d9);}});});});}})['then'](respondWithStatusCode(_0x511a07,null))['catch'](handleError(_0x511a07,null));};exports[_0x2a51('0x93')]=function(_0x360d34,_0x358b73,_0x2b17ca){var _0x46d387={};var _0x275155={};var _0x826e08;var _0x33edb1;return db[_0x2a51('0x42')][_0x2a51('0x6b')]({'where':{'id':_0x360d34['params']['id']}})['then'](handleEntityNotFound(_0x358b73,null))[_0x2a51('0x28')](function(_0x389c75){if(_0x389c75){_0x826e08=_0x389c75;_0x275155['model']=_[_0x2a51('0x33')](db[_0x2a51('0x81')]['rawAttributes']);_0x275155[_0x2a51('0x32')]=_['keys'](_0x360d34[_0x2a51('0x32')]);_0x275155[_0x2a51('0x34')]=_[_0x2a51('0x35')](_0x275155['model'],_0x275155[_0x2a51('0x32')]);_0x46d387[_0x2a51('0x36')]=_[_0x2a51('0x35')](_0x275155['model'],qs[_0x2a51('0x37')](_0x360d34[_0x2a51('0x32')]['fields']));_0x46d387[_0x2a51('0x36')]=_0x46d387[_0x2a51('0x36')]['length']?_0x46d387[_0x2a51('0x36')]:_0x275155[_0x2a51('0x30')];_0x46d387['order']=qs[_0x2a51('0x3d')](_0x360d34[_0x2a51('0x32')]['sort']);_0x46d387[_0x2a51('0x3f')]=qs[_0x2a51('0x34')](_[_0x2a51('0x72')](_0x360d34[_0x2a51('0x32')],_0x275155[_0x2a51('0x34')]));if(_0x360d34['query'][_0x2a51('0x3e')]){_0x46d387['where']=_[_0x2a51('0x40')](_0x46d387[_0x2a51('0x3f')],{'$or':_[_0x2a51('0x31')](_0x46d387['attributes'],function(_0x28c20a){var _0x33491f={};_0x33491f[_0x28c20a]={'$like':'%'+_0x360d34['query'][_0x2a51('0x3e')]+'%'};return _0x33491f;})});}_0x46d387=_[_0x2a51('0x40')]({},_0x46d387,_0x360d34['options']);return _0x826e08[_0x2a51('0x93')](_0x46d387);}})[_0x2a51('0x28')](function(_0x3d819e){if(_0x3d819e){_0x33edb1=_0x3d819e[_0x2a51('0x38')];if(!_0x360d34['query'][_0x2a51('0x39')](_0x2a51('0x3a'))){_0x46d387[_0x2a51('0x3b')]=qs[_0x2a51('0x3b')](_0x360d34[_0x2a51('0x32')]['limit']);_0x46d387['offset']=qs[_0x2a51('0x1e')](_0x360d34[_0x2a51('0x32')][_0x2a51('0x1e')]);}return _0x826e08[_0x2a51('0x93')](_0x46d387);}})[_0x2a51('0x28')](function(_0x3b4744){if(_0x3b4744){return _0x3b4744?{'count':_0x33edb1,'rows':_0x3b4744}:null;}})['then'](respondWithResult(_0x358b73,null))[_0x2a51('0x46')](handleError(_0x358b73,null));}; \ No newline at end of file +var _0x8a1b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','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','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','length','capitalize','toLowerCase','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','isArray','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','penalty','TeamVoiceQueue','User','Queue','findOrCreate','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','Mail','removeAgents','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x374cbc,_0x37460){var _0x45e20b=function(_0x400563){while(--_0x400563){_0x374cbc['push'](_0x374cbc['shift']());}};_0x45e20b(++_0x37460);}(_0x8a1b,0x91));var _0xb8a1=function(_0x56bf60,_0x284344){_0x56bf60=_0x56bf60-0x0;var _0x1d3fb9=_0x8a1b[_0x56bf60];return _0x1d3fb9;};'use strict';var emlformat=require(_0xb8a1('0x0'));var rimraf=require(_0xb8a1('0x1'));var zipdir=require(_0xb8a1('0x2'));var jsonpatch=require(_0xb8a1('0x3'));var rp=require(_0xb8a1('0x4'));var moment=require(_0xb8a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb8a1('0x6'));var util=require('util');var path=require(_0xb8a1('0x7'));var sox=require('sox');var csv=require(_0xb8a1('0x8'));var ejs=require(_0xb8a1('0x9'));var fs=require('fs');var fs_extra=require(_0xb8a1('0xa'));var _=require(_0xb8a1('0xb'));var squel=require(_0xb8a1('0xc'));var crypto=require(_0xb8a1('0xd'));var jsforce=require(_0xb8a1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb8a1('0x8'));var querystring=require(_0xb8a1('0xf'));var Papa=require(_0xb8a1('0x10'));var Redis=require(_0xb8a1('0x11'));var authService=require(_0xb8a1('0x12'));var qs=require(_0xb8a1('0x13'));var as=require(_0xb8a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8a1('0x15'))(_0xb8a1('0x16'));var utils=require(_0xb8a1('0x17'));var config=require(_0xb8a1('0x18'));var licenseUtil=require(_0xb8a1('0x19'));var db=require('../../mysqldb')['db'];config[_0xb8a1('0x1a')]=_[_0xb8a1('0x1b')](config[_0xb8a1('0x1a')],{'host':_0xb8a1('0x1c'),'port':0x18eb});var socket=require(_0xb8a1('0x1d'))(new Redis(config[_0xb8a1('0x1a')]));require(_0xb8a1('0x1e'))[_0xb8a1('0x1f')](socket);function respondWithStatusCode(_0x50061d,_0x44e286){_0x44e286=_0x44e286||0xcc;return function(_0x5699fe){if(_0x5699fe){return _0x50061d[_0xb8a1('0x20')](_0x44e286);}return _0x50061d['status'](_0x44e286)[_0xb8a1('0x21')]();};}function respondWithResult(_0x3469ca,_0xf3e7f5){_0xf3e7f5=_0xf3e7f5||0xc8;return function(_0x3dcbcf){if(_0x3dcbcf){return _0x3469ca['status'](_0xf3e7f5)['json'](_0x3dcbcf);}};}function respondWithFilteredResult(_0x4fb885,_0x39087a){return function(_0x1c84c1){if(_0x1c84c1){var _0x13025e=typeof _0x39087a[_0xb8a1('0x22')]===_0xb8a1('0x23')&&typeof _0x39087a[_0xb8a1('0x24')]===_0xb8a1('0x23');var _0x686b6d=_0x1c84c1[_0xb8a1('0x25')];var _0x4c8572=_0x13025e?0x0:_0x39087a['offset'];var _0x12c100=_0x13025e?_0x1c84c1[_0xb8a1('0x25')]:_0x39087a['offset']+_0x39087a['limit'];var _0x153954;if(_0x12c100>=_0x686b6d){_0x12c100=_0x686b6d;_0x153954=0xc8;}else{_0x153954=0xce;}_0x4fb885[_0xb8a1('0x26')](_0x153954);return _0x4fb885[_0xb8a1('0x27')](_0xb8a1('0x28'),_0x4c8572+'-'+_0x12c100+'/'+_0x686b6d)[_0xb8a1('0x29')](_0x1c84c1);}return null;};}function patchUpdates(_0x1a454a){return function(_0x121333){try{jsonpatch[_0xb8a1('0x2a')](_0x121333,_0x1a454a,!![]);}catch(_0x5db0e7){return BPromise[_0xb8a1('0x2b')](_0x5db0e7);}return _0x121333[_0xb8a1('0x2c')]();};}function saveUpdates(_0x2ff567,_0x39e6ee){return function(_0xeefd67){if(_0xeefd67){return _0xeefd67[_0xb8a1('0x2d')](_0x2ff567)[_0xb8a1('0x2e')](function(_0x425521){return _0x425521;});}return null;};}function handleEntityNotFound(_0x2bad38,_0x191c73){return function(_0x201481){if(!_0x201481){_0x2bad38['sendStatus'](0x194);}return _0x201481;};}function handleError(_0x309d30,_0x4ab472){_0x4ab472=_0x4ab472||0x1f4;return function(_0x38ed06){logger[_0xb8a1('0x2f')](_0x38ed06[_0xb8a1('0x30')]);if(_0x38ed06['name']){delete _0x38ed06[_0xb8a1('0x31')];}_0x309d30[_0xb8a1('0x26')](_0x4ab472)[_0xb8a1('0x32')](_0x38ed06);};}exports[_0xb8a1('0x33')]=function(_0x2a871b,_0x3c22fa){var _0x1dc940={},_0x3be476={},_0x1f56b5={'count':0x0,'rows':[]};var _0x2a02e7=_[_0xb8a1('0x34')](db[_0xb8a1('0x35')][_0xb8a1('0x36')],function(_0x259e09){return{'name':_0x259e09[_0xb8a1('0x37')],'type':_0x259e09['type'][_0xb8a1('0x38')]};});_0x3be476[_0xb8a1('0x39')]=_[_0xb8a1('0x34')](_0x2a02e7,'name');_0x3be476[_0xb8a1('0x3a')]=_['keys'](_0x2a871b['query']);_0x3be476['filters']=_[_0xb8a1('0x3b')](_0x3be476[_0xb8a1('0x39')],_0x3be476[_0xb8a1('0x3a')]);_0x1dc940['attributes']=_[_0xb8a1('0x3b')](_0x3be476[_0xb8a1('0x39')],qs[_0xb8a1('0x3c')](_0x2a871b['query'][_0xb8a1('0x3c')]));_0x1dc940[_0xb8a1('0x3d')]=_0x1dc940[_0xb8a1('0x3d')]['length']?_0x1dc940[_0xb8a1('0x3d')]:_0x3be476[_0xb8a1('0x39')];if(!_0x2a871b['query'][_0xb8a1('0x3e')](_0xb8a1('0x3f'))){_0x1dc940[_0xb8a1('0x24')]=qs['limit'](_0x2a871b[_0xb8a1('0x3a')][_0xb8a1('0x24')]);_0x1dc940[_0xb8a1('0x22')]=qs[_0xb8a1('0x22')](_0x2a871b[_0xb8a1('0x3a')][_0xb8a1('0x22')]);}_0x1dc940[_0xb8a1('0x40')]=qs[_0xb8a1('0x41')](_0x2a871b[_0xb8a1('0x3a')][_0xb8a1('0x41')]);_0x1dc940[_0xb8a1('0x42')]=qs[_0xb8a1('0x43')](_[_0xb8a1('0x44')](_0x2a871b['query'],_0x3be476[_0xb8a1('0x43')]),_0x2a02e7);if(_0x2a871b[_0xb8a1('0x3a')][_0xb8a1('0x45')]){_0x1dc940[_0xb8a1('0x42')]=_[_0xb8a1('0x46')](_0x1dc940[_0xb8a1('0x42')],{'$or':_[_0xb8a1('0x34')](_0x2a02e7,function(_0x46e481){if(_0x46e481['type']!=='VIRTUAL'){var _0x43fc58={};_0x43fc58[_0x46e481[_0xb8a1('0x31')]]={'$like':'%'+_0x2a871b['query'][_0xb8a1('0x45')]+'%'};return _0x43fc58;}})});}_0x1dc940=_[_0xb8a1('0x46')]({},_0x1dc940,_0x2a871b['options']);var _0x235a71={'where':_0x1dc940[_0xb8a1('0x42')]};return db[_0xb8a1('0x35')][_0xb8a1('0x25')](_0x235a71)['then'](function(_0x2958d9){_0x1f56b5[_0xb8a1('0x25')]=_0x2958d9;if(_0x2a871b[_0xb8a1('0x3a')][_0xb8a1('0x47')]){_0x1dc940['include']=[{'all':!![]}];}return db['Team'][_0xb8a1('0x48')](_0x1dc940);})[_0xb8a1('0x2e')](function(_0x2f8fed){_0x1f56b5['rows']=_0x2f8fed;return _0x1f56b5;})[_0xb8a1('0x2e')](respondWithFilteredResult(_0x3c22fa,_0x1dc940))[_0xb8a1('0x49')](handleError(_0x3c22fa,null));};exports[_0xb8a1('0x4a')]=function(_0x2e9f5c,_0xc270c0){var _0x279947={'raw':![],'where':{'id':_0x2e9f5c[_0xb8a1('0x4b')]['id']}},_0x5560f9={};_0x5560f9[_0xb8a1('0x39')]=_[_0xb8a1('0x4c')](db[_0xb8a1('0x35')][_0xb8a1('0x36')]);_0x5560f9[_0xb8a1('0x3a')]=_[_0xb8a1('0x4c')](_0x2e9f5c[_0xb8a1('0x3a')]);_0x5560f9[_0xb8a1('0x43')]=_[_0xb8a1('0x3b')](_0x5560f9[_0xb8a1('0x39')],_0x5560f9[_0xb8a1('0x3a')]);_0x279947['attributes']=_[_0xb8a1('0x3b')](_0x5560f9[_0xb8a1('0x39')],qs['fields'](_0x2e9f5c[_0xb8a1('0x3a')][_0xb8a1('0x3c')]));_0x279947[_0xb8a1('0x3d')]=_0x279947[_0xb8a1('0x3d')]['length']?_0x279947['attributes']:_0x5560f9[_0xb8a1('0x39')];if(_0x2e9f5c[_0xb8a1('0x3a')][_0xb8a1('0x47')]){_0x279947[_0xb8a1('0x4d')]=[{'all':!![]}];}_0x279947=_['merge']({},_0x279947,_0x2e9f5c[_0xb8a1('0x4e')]);return db[_0xb8a1('0x35')][_0xb8a1('0x4f')](_0x279947)[_0xb8a1('0x2e')](handleEntityNotFound(_0xc270c0,null))[_0xb8a1('0x2e')](respondWithResult(_0xc270c0,null))[_0xb8a1('0x49')](handleError(_0xc270c0,null));};exports[_0xb8a1('0x50')]=function(_0x2f106e,_0x2f1394){return db[_0xb8a1('0x35')][_0xb8a1('0x50')](_0x2f106e[_0xb8a1('0x51')],{})[_0xb8a1('0x2e')](function(_0x4e0a67){var _0x4e108d=_0x2f106e[_0xb8a1('0x52')][_0xb8a1('0x53')]({'plain':!![]});if(!_0x4e108d)throw new Error(_0xb8a1('0x54'));if(_0x4e108d[_0xb8a1('0x55')]===_0xb8a1('0x52')){var _0x1c6bee=_0x4e0a67[_0xb8a1('0x53')]({'plain':!![]});var _0x24f320=_0xb8a1('0x56');return db[_0xb8a1('0x57')]['find']({'where':{'name':_0x24f320,'userProfileId':_0x4e108d[_0xb8a1('0x58')]},'raw':!![]})[_0xb8a1('0x2e')](function(_0x25ef2c){if(_0x25ef2c&&_0x25ef2c[_0xb8a1('0x59')]===0x0){return db[_0xb8a1('0x5a')]['create']({'name':_0x1c6bee[_0xb8a1('0x31')],'resourceId':_0x1c6bee['id'],'type':_0x25ef2c['name'],'sectionId':_0x25ef2c['id']},{})[_0xb8a1('0x2e')](function(){return _0x4e0a67;});}else{return _0x4e0a67;}})[_0xb8a1('0x49')](function(_0xc256d8){logger[_0xb8a1('0x2f')](_0xb8a1('0x5b'),_0xc256d8);throw _0xc256d8;});}return _0x4e0a67;})[_0xb8a1('0x2e')](respondWithResult(_0x2f1394,0xc9))[_0xb8a1('0x49')](handleError(_0x2f1394,null));};exports[_0xb8a1('0x2d')]=function(_0x154c3f,_0x66b9a){if(_0x154c3f[_0xb8a1('0x51')]['id']){delete _0x154c3f['body']['id'];}return db[_0xb8a1('0x35')][_0xb8a1('0x4f')]({'where':{'id':_0x154c3f[_0xb8a1('0x4b')]['id']}})[_0xb8a1('0x2e')](handleEntityNotFound(_0x66b9a,null))[_0xb8a1('0x2e')](saveUpdates(_0x154c3f[_0xb8a1('0x51')],null))[_0xb8a1('0x2e')](respondWithResult(_0x66b9a,null))[_0xb8a1('0x49')](handleError(_0x66b9a,null));};exports['destroy']=function(_0x36593d,_0xa7e98e){var _0x5a5b40=_0x36593d[_0xb8a1('0x4b')]['id'];var _0x271324=[];return db[_0xb8a1('0x5c')][_0xb8a1('0x5d')](function(_0xac743f){var _0x302b5b=_0xb8a1('0x5e')+_0x5a5b40;return db['sequelize'][_0xb8a1('0x3a')](_0x302b5b,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')][_0xb8a1('0x61')],'raw':!![],'transaction':_0xac743f})[_0xb8a1('0x2e')](function(_0x145a6b){_0x271324=_['map'](_0x145a6b,function(_0x2cf5a2){return Number(_0x2cf5a2[_0xb8a1('0x62')]);});})[_0xb8a1('0x2e')](function(){var _0x47aa2c=_0xb8a1('0x63')+_0x5a5b40;return db[_0xb8a1('0x5c')][_0xb8a1('0x3a')](_0x47aa2c,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')]['SELECT'],'raw':!![],'transaction':_0xac743f});})['then'](function(_0x226408){var _0x1be8c1=_[_0xb8a1('0x34')](_0x226408,function(_0x1b0709){return Number(_0x1b0709[_0xb8a1('0x64')]);});return db[_0xb8a1('0x65')][_0xb8a1('0x66')]({'where':{'UserId':{'$in':_0x271324},'VoiceQueueId':{'$in':_0x1be8c1}},'transaction':_0xac743f});})['then'](function(){var _0x60fe38=_0xb8a1('0x67')+_0x5a5b40;return db[_0xb8a1('0x5c')][_0xb8a1('0x3a')](_0x60fe38,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')][_0xb8a1('0x61')],'raw':!![],'transaction':_0xac743f});})['then'](function(_0x752ccc){var _0x27760c=_[_0xb8a1('0x34')](_0x752ccc,function(_0x32586f){return Number(_0x32586f[_0xb8a1('0x68')]);});return db['UserMailQueue'][_0xb8a1('0x66')]({'where':{'UserId':{'$in':_0x271324},'MailQueueId':{'$in':_0x27760c}},'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(){var _0x1102bc=_0xb8a1('0x69')+_0x5a5b40;return db[_0xb8a1('0x5c')][_0xb8a1('0x3a')](_0x1102bc,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')]['SELECT'],'raw':!![],'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(_0x17973a){var _0x51f969=_[_0xb8a1('0x34')](_0x17973a,function(_0x12986d){return Number(_0x12986d[_0xb8a1('0x6a')]);});return db[_0xb8a1('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x271324},'SmsQueueId':{'$in':_0x51f969}},'transaction':_0xac743f});})['then'](function(){var _0x167ea0=_0xb8a1('0x6c')+_0x5a5b40;return db[_0xb8a1('0x5c')][_0xb8a1('0x3a')](_0x167ea0,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')]['SELECT'],'raw':!![],'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(_0x4fba63){var _0x17d7c3=_[_0xb8a1('0x34')](_0x4fba63,function(_0x5e1ddc){return Number(_0x5e1ddc[_0xb8a1('0x6d')]);});return db['UserChatQueue'][_0xb8a1('0x66')]({'where':{'UserId':{'$in':_0x271324},'ChatQueueId':{'$in':_0x17d7c3}},'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(){var _0x296704=_0xb8a1('0x6e')+_0x5a5b40;return db[_0xb8a1('0x5c')][_0xb8a1('0x3a')](_0x296704,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')][_0xb8a1('0x61')],'raw':!![],'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(_0x4490c6){var _0x42122c=_[_0xb8a1('0x34')](_0x4490c6,function(_0x4d0f75){return Number(_0x4d0f75[_0xb8a1('0x6f')]);});return db['UserFaxQueue'][_0xb8a1('0x66')]({'where':{'UserId':{'$in':_0x271324},'FaxQueueId':{'$in':_0x42122c}},'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(){var _0x2705aa=_0xb8a1('0x70')+_0x5a5b40;return db[_0xb8a1('0x5c')][_0xb8a1('0x3a')](_0x2705aa,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')]['SELECT'],'raw':!![],'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(_0x41aa72){var _0x136caf=_[_0xb8a1('0x34')](_0x41aa72,function(_0x267d18){return Number(_0x267d18['OpenchannelQueueId']);});return db[_0xb8a1('0x71')][_0xb8a1('0x66')]({'where':{'UserId':{'$in':_0x271324},'OpenchannelQueueId':{'$in':_0x136caf}},'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(){var _0x7c1332=_0xb8a1('0x72')+_0x5a5b40;return db[_0xb8a1('0x5c')][_0xb8a1('0x3a')](_0x7c1332,{'type':db[_0xb8a1('0x5f')][_0xb8a1('0x60')][_0xb8a1('0x61')],'raw':!![],'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(_0x5f4d59){var _0xbb2cde=_[_0xb8a1('0x34')](_0x5f4d59,function(_0x4a575a){return Number(_0x4a575a[_0xb8a1('0x73')]);});return db[_0xb8a1('0x74')][_0xb8a1('0x66')]({'where':{'UserId':{'$in':_0x271324},'WhatsappQueueId':{'$in':_0xbb2cde}},'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(){return db[_0xb8a1('0x75')][_0xb8a1('0x4f')]({'where':{'TeamId':_0x5a5b40}});})['then'](function(_0x57e400){if(_0x57e400===null){return;}return db[_0xb8a1('0x76')]['destroy']({'where':{'UserId':{'$in':_0x271324},'VoicePrefixId':_0x57e400[_0xb8a1('0x77')]},'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(){return db['Team'][_0xb8a1('0x66')]({'where':{'id':_0x5a5b40},'cascade':!![],'transaction':_0xac743f});})[_0xb8a1('0x2e')](function(_0x16d0d5){if(_0x16d0d5===0x0){_0xa7e98e[_0xb8a1('0x20')](0x194);}else{return db[_0xb8a1('0x5a')][_0xb8a1('0x66')]({'where':{'type':'Teams','resourceId':_0x5a5b40},'cascade':!![],'transaction':_0xac743f})[_0xb8a1('0x2e')](function(){_0xa7e98e[_0xb8a1('0x26')](0xcc)['end']();});}})[_0xb8a1('0x49')](function(_0x4f500d){_0xa7e98e[_0xb8a1('0x26')](0x1f4)[_0xb8a1('0x32')](_0x4f500d);});});};exports[_0xb8a1('0x78')]=function(_0x3453c8,_0x388b27,_0x2725c7){return db[_0xb8a1('0x35')][_0xb8a1('0x79')]({'where':{'id':_0x3453c8[_0xb8a1('0x4b')]['id']}})[_0xb8a1('0x2e')](handleEntityNotFound(_0x388b27,null))['then'](function(_0x405d2e){if(!_0x3453c8['query'][_0xb8a1('0x7a')]||!utils['isValidChannel'](_0x3453c8[_0xb8a1('0x3a')]['channel'])){throw new db[(_0xb8a1('0x5f'))][(_0xb8a1('0x7b'))](_0xb8a1('0x7c'));}var _0x2fbef3={};var _0x5bb283={};_0x5bb283['model']=_[_0xb8a1('0x4c')](db[_['capitalize'](_0x3453c8[_0xb8a1('0x3a')][_0xb8a1('0x7a')]['toLowerCase']())+'Queue'][_0xb8a1('0x36')]);_0x5bb283[_0xb8a1('0x3a')]=_[_0xb8a1('0x4c')](_0x3453c8['query']);_0x5bb283[_0xb8a1('0x43')]=_[_0xb8a1('0x3b')](_0x5bb283[_0xb8a1('0x39')],_0x5bb283['query']);_0x2fbef3[_0xb8a1('0x3d')]=_[_0xb8a1('0x3b')](_0x5bb283[_0xb8a1('0x39')],qs['fields'](_0x3453c8[_0xb8a1('0x3a')][_0xb8a1('0x3c')]));_0x2fbef3[_0xb8a1('0x3d')]=_0x2fbef3[_0xb8a1('0x3d')][_0xb8a1('0x7d')]?_0x2fbef3[_0xb8a1('0x3d')]:_0x5bb283[_0xb8a1('0x39')];_0x2fbef3[_0xb8a1('0x24')]=qs[_0xb8a1('0x24')](_0x3453c8[_0xb8a1('0x3a')][_0xb8a1('0x24')]);_0x2fbef3['offset']=qs[_0xb8a1('0x22')](_0x3453c8[_0xb8a1('0x3a')][_0xb8a1('0x22')]);_0x2fbef3[_0xb8a1('0x40')]=qs[_0xb8a1('0x41')](_0x3453c8[_0xb8a1('0x3a')][_0xb8a1('0x41')]);_0x2fbef3[_0xb8a1('0x42')]=qs[_0xb8a1('0x43')](_['pick'](_0x3453c8[_0xb8a1('0x3a')],_0x5bb283['filters']));_0x2fbef3=_[_0xb8a1('0x46')]({},_0x2fbef3,_0x3453c8[_0xb8a1('0x4e')]);return _0x405d2e['get'+_[_0xb8a1('0x7e')](_0x3453c8[_0xb8a1('0x3a')][_0xb8a1('0x7a')][_0xb8a1('0x7f')]())+_0xb8a1('0x80')](_0x2fbef3);})[_0xb8a1('0x2e')](respondWithResult(_0x388b27,null))[_0xb8a1('0x49')](handleError(_0x388b27,null));};exports[_0xb8a1('0x81')]=function(_0x1cc9eb,_0x35a291,_0x1462e1){return db[_0xb8a1('0x35')][_0xb8a1('0x79')]({'where':{'id':_0x1cc9eb[_0xb8a1('0x4b')]['id']}})[_0xb8a1('0x2e')](function(_0x4318ef){if(_0x4318ef){if(!_0x1cc9eb[_0xb8a1('0x51')]['channel']||!utils[_0xb8a1('0x82')](_0x1cc9eb[_0xb8a1('0x51')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x4318ef[_0xb8a1('0x83')+_[_0xb8a1('0x7e')](_0x1cc9eb['body'][_0xb8a1('0x7a')]['toLowerCase']())+_0xb8a1('0x80')](_0x1cc9eb[_0xb8a1('0x51')][_0xb8a1('0x84')]);}return null;})[_0xb8a1('0x2e')](handleEntityNotFound(_0x35a291,null))[_0xb8a1('0x2e')](respondWithStatusCode(_0x35a291,null))[_0xb8a1('0x49')](handleError(_0x35a291,null));};exports[_0xb8a1('0x85')]=function(_0x2c40f5,_0x123d02,_0x341143){return db[_0xb8a1('0x35')][_0xb8a1('0x79')]({'where':{'id':_0x2c40f5[_0xb8a1('0x4b')]['id']}})[_0xb8a1('0x2e')](function(_0x99d02f){if(_0x99d02f){if(!_0x2c40f5[_0xb8a1('0x3a')]['channel']||!utils[_0xb8a1('0x82')](_0x2c40f5[_0xb8a1('0x3a')][_0xb8a1('0x7a')])){throw new db[(_0xb8a1('0x5f'))][(_0xb8a1('0x7b'))]('Unknown\x20channel');}return _0x99d02f[_0xb8a1('0x86')+_[_0xb8a1('0x7e')](_0x2c40f5[_0xb8a1('0x3a')][_0xb8a1('0x7a')][_0xb8a1('0x7f')]())+_0xb8a1('0x80')](_0x2c40f5[_0xb8a1('0x3a')]['ids']);}return null;})[_0xb8a1('0x2e')](handleEntityNotFound(_0x123d02,null))[_0xb8a1('0x2e')](respondWithStatusCode(_0x123d02,null))['catch'](handleError(_0x123d02,null));};exports['addAgents']=function(_0x2671e3,_0x4fe9c2){var _0x2b608d=_[_0xb8a1('0x87')](_0x2671e3[_0xb8a1('0x51')]['ids'])?_0x2671e3[_0xb8a1('0x51')]['ids']:[_0x2671e3['body'][_0xb8a1('0x84')]];var _0x2e6e64=_0x2671e3[_0xb8a1('0x4b')]['id'];return db[_0xb8a1('0x35')][_0xb8a1('0x4f')]({'where':{'id':_0x2e6e64}})[_0xb8a1('0x2e')](handleEntityNotFound(_0x4fe9c2,null))[_0xb8a1('0x2e')](function(_0x49d3df){if(_0x49d3df){var _0x421f9c=[_0xb8a1('0x88'),_0xb8a1('0x89'),'Mail',_0xb8a1('0x8a'),_0xb8a1('0x8b'),_0xb8a1('0x8c'),_0xb8a1('0x8d')];return db['sequelize'][_0xb8a1('0x5d')](function(_0x2fd83a){var _0x19ddd8=_['map'](_0x421f9c,function(_0x21dc5e){var _0x43142f={'attributes':['id',_0xb8a1('0x31')]};if(_0x21dc5e===_0xb8a1('0x88')){_0x43142f['through']={'attributes':[_0xb8a1('0x8e')]};}return _0x49d3df['get'+_0x21dc5e+_0xb8a1('0x80')](_0x43142f)[_0xb8a1('0x2e')](function(_0x14791d){var _0x4b1e4d=_['map'](_0x14791d,function(_0x5b6576){var _0x4af290=_[_0xb8a1('0x34')](_0x2b608d,function(_0x43969c){var _0x267a37={'where':{'UserId':_0x43969c,[_0x21dc5e+'QueueId']:_0x5b6576['id']},'transaction':_0x2fd83a};if(_0x21dc5e==='Voice'){_0x267a37[_0xb8a1('0x1b')]={'penalty':_0x5b6576[_0xb8a1('0x8f')][_0xb8a1('0x8e')]};}return db[_0xb8a1('0x90')+_0x21dc5e+_0xb8a1('0x91')][_0xb8a1('0x92')](_0x267a37)[_0xb8a1('0x2e')](function(){socket['emit'](_0xb8a1('0x52')+_0x21dc5e+'Queue:save',{'UserId':_0x43969c,[_0x21dc5e+'QueueId']:_0x5b6576['id']});if(_0x21dc5e!==_0xb8a1('0x88')){return;}return db['User']['findAll']({'where':{'id':_0x2b608d,'online':0x1},'attributes':['id',_0xb8a1('0x31'),'online',_0xb8a1('0x93'),_0xb8a1('0x94')],'raw':!![]})['then'](function(_0x5a2f3a){var _0x54d9b6=_[_0xb8a1('0x34')](_0x5a2f3a,function(_0x190567){return db[_0xb8a1('0x95')][_0xb8a1('0x96')]({'membername':_0x190567['name'],'UserId':_0x190567['id'],'queue_name':_0x5b6576[_0xb8a1('0x31')],'VoiceQueueId':_0x5b6576['id'],'interface':_[_0xb8a1('0x97')](_0x190567[_0xb8a1('0x94')])?util[_0xb8a1('0x98')](_0xb8a1('0x99'),_0x190567[_0xb8a1('0x31')]):_0x190567['interface'],'paused':_0x190567[_0xb8a1('0x93')]||![],'penalty':_0x5b6576['TeamVoiceQueue'][_0xb8a1('0x8e')]},{'transaction':_0x2fd83a});});return Promise[_0xb8a1('0x9a')](_0x54d9b6);});});});return Promise[_0xb8a1('0x9a')](_0x4af290);});return Promise['all'](_0x4b1e4d);})[_0xb8a1('0x2e')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x2e6e64}})[_0xb8a1('0x2e')](function(_0x2a95a5){if(_0x2a95a5){var _0xd4d5d7=_[_0xb8a1('0x34')](_0x2b608d,function(_0x4f4280){db[_0xb8a1('0x76')][_0xb8a1('0x96')]({'UserId':_0x4f4280,'VoicePrefixId':_0x2a95a5[_0xb8a1('0x77')]});});return Promise['all'](_0xd4d5d7);}});});});return Promise[_0xb8a1('0x9a')](_0x19ddd8)[_0xb8a1('0x2e')](function(){return _0x49d3df['addAgents'](_0x2b608d,{'transaction':_0x2fd83a})[_0xb8a1('0x9b')](function(_0x6a53a5){return _0x6a53a5;});});});}})[_0xb8a1('0x2e')](respondWithResult(_0x4fe9c2,null))[_0xb8a1('0x49')](handleError(_0x4fe9c2,null));};exports['removeAgents']=function(_0x2a1d95,_0x3da121){var _0xdd67d8=_['isArray'](_0x2a1d95[_0xb8a1('0x3a')][_0xb8a1('0x84')])?_0x2a1d95[_0xb8a1('0x3a')][_0xb8a1('0x84')]:[_0x2a1d95[_0xb8a1('0x3a')]['ids']];var _0x5935c1=_0x2a1d95[_0xb8a1('0x4b')]['id'];return db[_0xb8a1('0x35')][_0xb8a1('0x4f')]({'where':{'id':_0x5935c1}})[_0xb8a1('0x2e')](handleEntityNotFound(_0x3da121,null))[_0xb8a1('0x2e')](function(_0x3e08aa){if(_0x3e08aa){var _0x5564ba=[_0xb8a1('0x88'),_0xb8a1('0x89'),_0xb8a1('0x9c'),_0xb8a1('0x8a'),'Fax',_0xb8a1('0x8c'),_0xb8a1('0x8d')];return db[_0xb8a1('0x5c')][_0xb8a1('0x5d')](function(_0x16168e){var _0x4ad88d=_[_0xb8a1('0x34')](_0x5564ba,function(_0x315b1b){var _0x577f92={'attributes':['id',_0xb8a1('0x31')]};return _0x3e08aa[_0xb8a1('0x53')+_0x315b1b+_0xb8a1('0x80')](_0x577f92)[_0xb8a1('0x2e')](function(_0x13b9a9){var _0x1d96ca=_['map'](_0x13b9a9,function(_0x4bffd1){return _0x4bffd1[_0xb8a1('0x9d')](_0xdd67d8,{'transaction':_0x16168e})[_0xb8a1('0x2e')](function(){var _0x3111a5=_[_0xb8a1('0x34')](_0xdd67d8,function(_0x8f2339){socket[_0xb8a1('0x9e')](_0xb8a1('0x52')+_0x315b1b+_0xb8a1('0x9f'),{'UserId':Number(_0x8f2339),[_0x315b1b+'QueueId']:_0x4bffd1['id']});if(_0x315b1b!=='Voice'){return;}return db[_0xb8a1('0x95')][_0xb8a1('0x66')]({'where':{'VoiceQueueId':_0x4bffd1['id'],'UserId':_0x8f2339},'transaction':_0x16168e});});return Promise[_0xb8a1('0x9a')](_0x3111a5);});});return Promise[_0xb8a1('0x9a')](_0x1d96ca);});});return Promise[_0xb8a1('0x9a')](_0x4ad88d)[_0xb8a1('0x2e')](function(){return _0x3e08aa['removeAgents'](_0xdd67d8,{'transaction':_0x16168e});})['then'](function(){return db[_0xb8a1('0x75')][_0xb8a1('0x79')]({'where':{'teamId':_0x5935c1}})[_0xb8a1('0x2e')](function(_0x4e3164){if(_0x4e3164){var _0x11b4c3=_[_0xb8a1('0x34')](_0xdd67d8,function(_0x8b69a2){db[_0xb8a1('0x76')][_0xb8a1('0x66')]({'where':{'UserId':_0x8b69a2,'VoicePrefixId':_0x4e3164[_0xb8a1('0x77')]}});});return Promise[_0xb8a1('0x9a')](_0x11b4c3);}});});});}})[_0xb8a1('0x2e')](respondWithStatusCode(_0x3da121,null))['catch'](handleError(_0x3da121,null));};exports[_0xb8a1('0xa0')]=function(_0x578752,_0x48cdfe,_0x4f1a51){var _0x227436={};var _0xcd23a5={};var _0x4bf8b5;var _0x4f4ce3;return db[_0xb8a1('0x35')][_0xb8a1('0x79')]({'where':{'id':_0x578752[_0xb8a1('0x4b')]['id']}})[_0xb8a1('0x2e')](handleEntityNotFound(_0x48cdfe,null))[_0xb8a1('0x2e')](function(_0x411bee){if(_0x411bee){_0x4bf8b5=_0x411bee;_0xcd23a5[_0xb8a1('0x39')]=_[_0xb8a1('0x4c')](db['User'][_0xb8a1('0x36')]);_0xcd23a5[_0xb8a1('0x3a')]=_[_0xb8a1('0x4c')](_0x578752[_0xb8a1('0x3a')]);_0xcd23a5[_0xb8a1('0x43')]=_['intersection'](_0xcd23a5['model'],_0xcd23a5[_0xb8a1('0x3a')]);_0x227436[_0xb8a1('0x3d')]=_[_0xb8a1('0x3b')](_0xcd23a5[_0xb8a1('0x39')],qs[_0xb8a1('0x3c')](_0x578752[_0xb8a1('0x3a')][_0xb8a1('0x3c')]));_0x227436[_0xb8a1('0x3d')]=_0x227436[_0xb8a1('0x3d')][_0xb8a1('0x7d')]?_0x227436['attributes']:_0xcd23a5[_0xb8a1('0x39')];_0x227436['order']=qs[_0xb8a1('0x41')](_0x578752[_0xb8a1('0x3a')][_0xb8a1('0x41')]);_0x227436[_0xb8a1('0x42')]=qs[_0xb8a1('0x43')](_[_0xb8a1('0x44')](_0x578752[_0xb8a1('0x3a')],_0xcd23a5[_0xb8a1('0x43')]));if(_0x578752['query'][_0xb8a1('0x45')]){_0x227436[_0xb8a1('0x42')]=_[_0xb8a1('0x46')](_0x227436[_0xb8a1('0x42')],{'$or':_['map'](_0x227436['attributes'],function(_0x38ce73){var _0x857ef9={};_0x857ef9[_0x38ce73]={'$like':'%'+_0x578752[_0xb8a1('0x3a')]['filter']+'%'};return _0x857ef9;})});}_0x227436=_[_0xb8a1('0x46')]({},_0x227436,_0x578752[_0xb8a1('0x4e')]);return _0x4bf8b5[_0xb8a1('0xa0')](_0x227436);}})[_0xb8a1('0x2e')](function(_0x90c586){if(_0x90c586){_0x4f4ce3=_0x90c586['length'];if(!_0x578752[_0xb8a1('0x3a')][_0xb8a1('0x3e')](_0xb8a1('0x3f'))){_0x227436[_0xb8a1('0x24')]=qs[_0xb8a1('0x24')](_0x578752[_0xb8a1('0x3a')][_0xb8a1('0x24')]);_0x227436['offset']=qs['offset'](_0x578752[_0xb8a1('0x3a')]['offset']);}return _0x4bf8b5['getAgents'](_0x227436);}})[_0xb8a1('0x2e')](function(_0x1954ed){if(_0x1954ed){return _0x1954ed?{'count':_0x4f4ce3,'rows':_0x1954ed}:null;}})[_0xb8a1('0x2e')](respondWithResult(_0x48cdfe,null))[_0xb8a1('0x49')](handleError(_0x48cdfe,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a88a2ae..a8ad9d7 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 _0x75f0=['exports','../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x246380,_0x4b2a12){var _0x10fef8=function(_0x1a051c){while(--_0x1a051c){_0x246380['push'](_0x246380['shift']());}};_0x10fef8(++_0x4b2a12);}(_0x75f0,0x18d));var _0x075f=function(_0x4564ff,_0xd39a3c){_0x4564ff=_0x4564ff-0x0;var _0x35b8b9=_0x75f0[_0x4564ff];return _0x35b8b9;};'use strict';var EventEmitter=require('events');var Team=require(_0x075f('0x0'))['db'][_0x075f('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x075f('0x2')](0x0);var events={'afterCreate':_0x075f('0x3'),'afterUpdate':_0x075f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x113a00){return function(_0x1afbb3,_0xf39e53,_0x220239){TeamEvents[_0x075f('0x5')](_0x113a00+':'+_0x1afbb3['id'],_0x1afbb3);TeamEvents['emit'](_0x113a00,_0x1afbb3);_0x220239(null);};}for(var e in events){if(events[_0x075f('0x6')](e)){var event=events[e];Team[_0x075f('0x7')](e,emitEvent(event));}}module[_0x075f('0x8')]=TeamEvents; \ No newline at end of file +var _0x8289=['hasOwnProperty','hook','exports','events','../../mysqldb','Team','update','remove','emit'];(function(_0x55c8e3,_0x4addd4){var _0x7e6c2c=function(_0x8a08f2){while(--_0x8a08f2){_0x55c8e3['push'](_0x55c8e3['shift']());}};_0x7e6c2c(++_0x4addd4);}(_0x8289,0x135));var _0x9828=function(_0x229523,_0x9f4e91){_0x229523=_0x229523-0x0;var _0x359cd0=_0x8289[_0x229523];return _0x359cd0;};'use strict';var EventEmitter=require(_0x9828('0x0'));var Team=require(_0x9828('0x1'))['db'][_0x9828('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9828('0x3'),'afterDestroy':_0x9828('0x4')};function emitEvent(_0x4da2fc){return function(_0x4db423,_0x20c06c,_0x881db2){TeamEvents[_0x9828('0x5')](_0x4da2fc+':'+_0x4db423['id'],_0x4db423);TeamEvents[_0x9828('0x5')](_0x4da2fc,_0x4db423);_0x881db2(null);};}for(var e in events){if(events[_0x9828('0x6')](e)){var event=events[e];Team[_0x9828('0x7')](e,emitEvent(event));}}module[_0x9828('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 b5cc9b4..26c9773 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 _0x9f3b=['exports','define','Team','teams','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9f3b,0xe1));var _0xb9f3=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0x9f3b[_0x3a13cf];return _0x4817c;};'use strict';var _=require(_0xb9f3('0x0'));var util=require(_0xb9f3('0x1'));var logger=require(_0xb9f3('0x2'))('api');var moment=require(_0xb9f3('0x3'));var BPromise=require(_0xb9f3('0x4'));var rp=require(_0xb9f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb9f3('0x6'));var config=require(_0xb9f3('0x7'));var attributes=require(_0xb9f3('0x8'));module[_0xb9f3('0x9')]=function(_0x32a6f7,_0x277bc1){return _0x32a6f7[_0xb9f3('0xa')](_0xb9f3('0xb'),attributes,{'tableName':_0xb9f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95ae=['teams','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','exports','define','Team'];(function(_0x1329e6,_0x195a9d){var _0x48938a=function(_0x5530a0){while(--_0x5530a0){_0x1329e6['push'](_0x1329e6['shift']());}};_0x48938a(++_0x195a9d);}(_0x95ae,0x169));var _0xe95a=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x95ae[_0x172747];return _0x509692;};'use strict';var _=require(_0xe95a('0x0'));var util=require(_0xe95a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe95a('0x2'));var BPromise=require(_0xe95a('0x3'));var rp=require(_0xe95a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe95a('0x5'));var config=require(_0xe95a('0x6'));var attributes=require(_0xe95a('0x7'));module[_0xe95a('0x8')]=function(_0x13bbc4,_0x2f85af){return _0x13bbc4[_0xe95a('0x9')](_0xe95a('0xa'),attributes,{'tableName':_0xe95a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index fe4dd96..aa0babd 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 _0xfeec=['../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','moment','randomstring'];(function(_0x539807,_0x1811d6){var _0x37d298=function(_0x4d1516){while(--_0x4d1516){_0x539807['push'](_0x539807['shift']());}};_0x37d298(++_0x1811d6);}(_0xfeec,0xd9));var _0xcfee=function(_0x360e3a,_0x3aaf9a){_0x360e3a=_0x360e3a-0x0;var _0x536d34=_0xfeec[_0x360e3a];return _0x536d34;};'use strict';var _=require(_0xcfee('0x0'));var util=require('util');var moment=require(_0xcfee('0x1'));var BPromise=require('bluebird');var rs=require(_0xcfee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfee('0x4'))(_0xcfee('0x5'));var config=require(_0xcfee('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xcfee('0x7')]=_[_0xcfee('0x8')](config[_0xcfee('0x7')],{'host':_0xcfee('0x9'),'port':0x18eb});var socket=require(_0xcfee('0xa'))(new Redis(config[_0xcfee('0x7')]));require(_0xcfee('0xb'))['register'](socket);function respondWithRpcPromise(_0x14f556,_0x3a62c6,_0x144fa6){return new BPromise(function(_0x523d4b,_0x4b3fca){return client[_0xcfee('0xc')](_0x14f556,_0x144fa6)[_0xcfee('0xd')](function(_0x488f0f){logger['info'](_0xcfee('0xe'),_0x3a62c6,_0xcfee('0xf'));logger[_0xcfee('0x10')](_0xcfee('0x11'),_0x3a62c6,'request\x20sent',JSON['stringify'](_0x488f0f));if(_0x488f0f[_0xcfee('0x12')]){if(_0x488f0f[_0xcfee('0x12')]['code']===0x1f4){logger[_0xcfee('0x12')]('Team,\x20%s,\x20%s',_0x3a62c6,_0x488f0f[_0xcfee('0x12')][_0xcfee('0x13')]);return _0x4b3fca(_0x488f0f[_0xcfee('0x12')][_0xcfee('0x13')]);}logger['error'](_0xcfee('0xe'),_0x3a62c6,_0x488f0f[_0xcfee('0x12')][_0xcfee('0x13')]);return _0x523d4b(_0x488f0f[_0xcfee('0x12')][_0xcfee('0x13')]);}else{logger[_0xcfee('0x14')](_0xcfee('0xe'),_0x3a62c6,_0xcfee('0xf'));_0x523d4b(_0x488f0f['result']['message']);}})[_0xcfee('0x15')](function(_0x44151d){logger[_0xcfee('0x12')](_0xcfee('0xe'),_0x3a62c6,_0x44151d);_0x4b3fca(_0x44151d);});});} \ No newline at end of file +var _0x6347=['ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0x6347,0xd4));var _0x7634=function(_0x27f3f6,_0x38518d){_0x27f3f6=_0x27f3f6-0x0;var _0xebaccc=_0x6347[_0x27f3f6];return _0xebaccc;};'use strict';var _=require(_0x7634('0x0'));var util=require('util');var moment=require(_0x7634('0x1'));var BPromise=require(_0x7634('0x2'));var rs=require(_0x7634('0x3'));var fs=require('fs');var Redis=require(_0x7634('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7634('0x5'));var logger=require(_0x7634('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7634('0x7'));var client=jayson[_0x7634('0x8')]['http']({'port':0x232a});config[_0x7634('0x9')]=_[_0x7634('0xa')](config[_0x7634('0x9')],{'host':_0x7634('0xb'),'port':0x18eb});var socket=require(_0x7634('0xc'))(new Redis(config[_0x7634('0x9')]));require('./team.socket')[_0x7634('0xd')](socket);function respondWithRpcPromise(_0x25ac0e,_0x3c8f4b,_0x4d4971){return new BPromise(function(_0x2f17a4,_0x667bf8){return client[_0x7634('0xe')](_0x25ac0e,_0x4d4971)[_0x7634('0xf')](function(_0x3ff36d){logger[_0x7634('0x10')](_0x7634('0x11'),_0x3c8f4b,_0x7634('0x12'));logger['debug'](_0x7634('0x13'),_0x3c8f4b,_0x7634('0x12'),JSON[_0x7634('0x14')](_0x3ff36d));if(_0x3ff36d[_0x7634('0x15')]){if(_0x3ff36d['error']['code']===0x1f4){logger['error'](_0x7634('0x11'),_0x3c8f4b,_0x3ff36d[_0x7634('0x15')][_0x7634('0x16')]);return _0x667bf8(_0x3ff36d[_0x7634('0x15')][_0x7634('0x16')]);}logger['error'](_0x7634('0x11'),_0x3c8f4b,_0x3ff36d['error'][_0x7634('0x16')]);return _0x2f17a4(_0x3ff36d[_0x7634('0x15')][_0x7634('0x16')]);}else{logger[_0x7634('0x10')](_0x7634('0x11'),_0x3c8f4b,_0x7634('0x12'));_0x2f17a4(_0x3ff36d[_0x7634('0x17')][_0x7634('0x16')]);}})['catch'](function(_0x9822ac){logger['error']('Team,\x20%s,\x20%s',_0x3c8f4b,_0x9822ac);_0x667bf8(_0x9822ac);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 81f4d35..fb94d8d 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 _0xda5b=['update','emit','removeListener','length','team:','./team.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda5b,0x12d));var _0xbda5=function(_0xc315de,_0x5dc877){_0xc315de=_0xc315de-0x0;var _0x11a627=_0xda5b[_0xc315de];return _0x11a627;};'use strict';var TeamEvents=require(_0xbda5('0x0'));var events=[_0xbda5('0x1'),_0xbda5('0x2'),_0xbda5('0x3')];function createListener(_0x5de962,_0x12ba72){return function(_0x583278){_0x12ba72[_0xbda5('0x4')](_0x5de962,_0x583278);};}function removeListener(_0x2046ca,_0x3a15f6){return function(){TeamEvents[_0xbda5('0x5')](_0x2046ca,_0x3a15f6);};}exports['register']=function(_0x201ebf){for(var _0x496fd0=0x0,_0x37028f=events[_0xbda5('0x6')];_0x496fd0<_0x37028f;_0x496fd0++){var _0x2969ec=events[_0x496fd0];var _0x209ee9=createListener(_0xbda5('0x7')+_0x2969ec,_0x201ebf);TeamEvents['on'](_0x2969ec,_0x209ee9);}}; \ No newline at end of file +var _0x7d06=['./team.events','save','remove','update','emit','removeListener','length','team:'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x7d06,0x158));var _0x67d0=function(_0x3c154c,_0x2bdf5e){_0x3c154c=_0x3c154c-0x0;var _0x4b3bed=_0x7d06[_0x3c154c];return _0x4b3bed;};'use strict';var TeamEvents=require(_0x67d0('0x0'));var events=[_0x67d0('0x1'),_0x67d0('0x2'),_0x67d0('0x3')];function createListener(_0x362738,_0x5c7201){return function(_0x3a80da){_0x5c7201[_0x67d0('0x4')](_0x362738,_0x3a80da);};}function removeListener(_0x2fa05c,_0x58e193){return function(){TeamEvents[_0x67d0('0x5')](_0x2fa05c,_0x58e193);};}exports['register']=function(_0x1ba2b3){for(var _0x1f4dc9=0x0,_0x367f1d=events[_0x67d0('0x6')];_0x1f4dc9<_0x367f1d;_0x1f4dc9++){var _0x3c9976=events[_0x1f4dc9];var _0x481a08=createListener(_0x67d0('0x7')+_0x3c9976,_0x1ba2b3);TeamEvents['on'](_0x3c9976,_0x481a08);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4c02d88..c54c9d8 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 _0xded4=['INTEGER','sequelize','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xded4,0x19c));var _0x4ded=function(_0xb5206c,_0x58242d){_0xb5206c=_0xb5206c-0x0;var _0x24aff7=_0xded4[_0xb5206c];return _0x24aff7;};'use strict';var Sequelize=require(_0x4ded('0x0'));module[_0x4ded('0x1')]={'TeamId':{'type':Sequelize[_0x4ded('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4ded('0x2')]}}; \ No newline at end of file +var _0x1978=['exports','INTEGER'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x1978,0x174));var _0x8197=function(_0x435a9f,_0x171050){_0x435a9f=_0x435a9f-0x0;var _0x41420=_0x1978[_0x435a9f];return _0x41420;};'use strict';var Sequelize=require('sequelize');module[_0x8197('0x0')]={'TeamId':{'type':Sequelize[_0x8197('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8197('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index b89d507..944c79a 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 _0x0ca5=['../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x0ca5,0xfc));var _0x50ca=function(_0x4ec82a,_0x2bd67f){_0x4ec82a=_0x4ec82a-0x0;var _0x2902d3=_0x0ca5[_0x4ec82a];return _0x2902d3;};'use strict';var _=require(_0x50ca('0x0'));var util=require(_0x50ca('0x1'));var logger=require(_0x50ca('0x2'))(_0x50ca('0x3'));var moment=require(_0x50ca('0x4'));var BPromise=require(_0x50ca('0x5'));var rp=require(_0x50ca('0x6'));var fs=require('fs');var path=require(_0x50ca('0x7'));var rimraf=require('rimraf');var config=require(_0x50ca('0x8'));var attributes=require(_0x50ca('0x9'));module[_0x50ca('0xa')]=function(_0x404ab9,_0x4815d3){return _0x404ab9[_0x50ca('0xb')](_0x50ca('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf2f=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x348086,_0x5cf17e){var _0x15dff7=function(_0xef3a43){while(--_0xef3a43){_0x348086['push'](_0x348086['shift']());}};_0x15dff7(++_0x5cf17e);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x3b4b66,_0x48aa36){_0x3b4b66=_0x3b4b66-0x0;var _0x3aaa65=_0xcf2f[_0x3b4b66];return _0x3aaa65;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var logger=require(_0xfcf2('0x2'))(_0xfcf2('0x3'));var moment=require(_0xfcf2('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcf2('0x5'));var fs=require('fs');var path=require(_0xfcf2('0x6'));var rimraf=require(_0xfcf2('0x7'));var config=require(_0xfcf2('0x8'));var attributes=require(_0xfcf2('0x9'));module[_0xfcf2('0xa')]=function(_0x1e6d99,_0x3a4950){return _0x1e6d99[_0xfcf2('0xb')](_0xfcf2('0xc'),attributes,{'tableName':_0xfcf2('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 ab60e55..54d9a8e 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x632ea2,_0x54b7d2){var _0x319deb=function(_0x402f51){while(--_0x402f51){_0x632ea2['push'](_0x632ea2['shift']());}};_0x319deb(++_0x54b7d2);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5196c7,_0x1300b1){var _0x1680fd=function(_0x411885){while(--_0x411885){_0x5196c7['push'](_0x5196c7['shift']());}};_0x1680fd(++_0x1300b1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0xcb91[_0x3ed054];return _0x16dd95;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 9b20abe..dbce88b 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 _0x243f=['INTEGER'];(function(_0x4eb620,_0x4a1da3){var _0x54af67=function(_0x43666e){while(--_0x43666e){_0x4eb620['push'](_0x4eb620['shift']());}};_0x54af67(++_0x4a1da3);}(_0x243f,0x1eb));var _0xf243=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0x243f[_0x5c78d9];return _0x69ae1f;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xf243('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a12=['INTEGER','sequelize','exports'];(function(_0x49d756,_0x40b9f0){var _0x27360b=function(_0x5d0488){while(--_0x5d0488){_0x49d756['push'](_0x49d756['shift']());}};_0x27360b(++_0x40b9f0);}(_0x0a12,0x1cc));var _0x20a1=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0a12[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0x20a1('0x0'));module[_0x20a1('0x1')]={'penalty':{'type':Sequelize[_0x20a1('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 b2aa66d..48c1332 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 _0xfd7b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','util'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xfd7b[_0x1ca9e9];return _0x309f3c;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var logger=require(_0xbfd7('0x1'))(_0xbfd7('0x2'));var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require(_0xbfd7('0x6'));var rimraf=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var attributes=require(_0xbfd7('0x9'));module[_0xbfd7('0xa')]=function(_0x2ad158,_0x639dd4){return _0x2ad158['define'](_0xbfd7('0xb'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf822=['path','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0xf822,0x19e));var _0x2f82=function(_0x2e463e,_0x55dcb9){_0x2e463e=_0x2e463e-0x0;var _0x39db52=_0xf822[_0x2e463e];return _0x39db52;};'use strict';var _=require(_0x2f82('0x0'));var util=require('util');var logger=require(_0x2f82('0x1'))(_0x2f82('0x2'));var moment=require(_0x2f82('0x3'));var BPromise=require(_0x2f82('0x4'));var rp=require(_0x2f82('0x5'));var fs=require('fs');var path=require(_0x2f82('0x6'));var rimraf=require('rimraf');var config=require(_0x2f82('0x7'));var attributes=require(_0x2f82('0x8'));module[_0x2f82('0x9')]=function(_0x5b73e5,_0x360c8f){return _0x5b73e5['define'](_0x2f82('0xa'),attributes,{'tableName':_0x2f82('0xb'),'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 bc86808..f71dc33 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 _0xad36=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3c1ed4,_0x511273){var _0x1111cf=function(_0x15e4f4){while(--_0x15e4f4){_0x3c1ed4['push'](_0x3c1ed4['shift']());}};_0x1111cf(++_0x511273);}(_0xad36,0x11c));var _0x6ad3=function(_0x2e92ea,_0x1e63a8){_0x2e92ea=_0x2e92ea-0x0;var _0x1ea2bb=_0xad36[_0x2e92ea];return _0x1ea2bb;};'use strict';var _=require('lodash');var util=require(_0x6ad3('0x0'));var moment=require(_0x6ad3('0x1'));var BPromise=require(_0x6ad3('0x2'));var rs=require(_0x6ad3('0x3'));var fs=require('fs');var Redis=require(_0x6ad3('0x4'));var db=require(_0x6ad3('0x5'))['db'];var utils=require(_0x6ad3('0x6'));var logger=require(_0x6ad3('0x7'))(_0x6ad3('0x8'));var config=require('../../config/environment');var jayson=require(_0x6ad3('0x9'));var client=jayson[_0x6ad3('0xa')][_0x6ad3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb38339,_0x4a4ad8,_0x5693c1){return new BPromise(function(_0x50913c,_0x563396){return client[_0x6ad3('0xc')](_0xb38339,_0x5693c1)[_0x6ad3('0xd')](function(_0x363032){logger[_0x6ad3('0xe')](_0x6ad3('0xf'),_0x4a4ad8,_0x6ad3('0x10'));logger[_0x6ad3('0x11')](_0x6ad3('0x12'),_0x4a4ad8,_0x6ad3('0x10'),JSON['stringify'](_0x363032));if(_0x363032[_0x6ad3('0x13')]){if(_0x363032[_0x6ad3('0x13')][_0x6ad3('0x14')]===0x1f4){logger[_0x6ad3('0x13')](_0x6ad3('0xf'),_0x4a4ad8,_0x363032[_0x6ad3('0x13')][_0x6ad3('0x15')]);return _0x563396(_0x363032[_0x6ad3('0x13')]['message']);}logger[_0x6ad3('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a4ad8,_0x363032[_0x6ad3('0x13')][_0x6ad3('0x15')]);return _0x50913c(_0x363032[_0x6ad3('0x13')][_0x6ad3('0x15')]);}else{logger[_0x6ad3('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4a4ad8,_0x6ad3('0x10'));_0x50913c(_0x363032[_0x6ad3('0x16')][_0x6ad3('0x15')]);}})['catch'](function(_0x5479b8){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4a4ad8,_0x5479b8);_0x563396(_0x5479b8);});});} \ No newline at end of file +var _0x756e=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x90e575,_0x48c2ec){var _0x1aae60=function(_0x4e40cf){while(--_0x4e40cf){_0x90e575['push'](_0x90e575['shift']());}};_0x1aae60(++_0x48c2ec);}(_0x756e,0x94));var _0xe756=function(_0x35df20,_0x3d7e5a){_0x35df20=_0x35df20-0x0;var _0x450423=_0x756e[_0x35df20];return _0x450423;};'use strict';var _=require(_0xe756('0x0'));var util=require(_0xe756('0x1'));var moment=require(_0xe756('0x2'));var BPromise=require(_0xe756('0x3'));var rs=require(_0xe756('0x4'));var fs=require('fs');var Redis=require(_0xe756('0x5'));var db=require(_0xe756('0x6'))['db'];var utils=require(_0xe756('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe756('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe756('0x9')][_0xe756('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e5a4b,_0x3952a4,_0x5b8595){return new BPromise(function(_0x40a651,_0x25bc10){return client[_0xe756('0xb')](_0x1e5a4b,_0x5b8595)['then'](function(_0x132d12){logger[_0xe756('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3952a4,_0xe756('0xd'));logger[_0xe756('0xe')](_0xe756('0xf'),_0x3952a4,_0xe756('0xd'),JSON[_0xe756('0x10')](_0x132d12));if(_0x132d12[_0xe756('0x11')]){if(_0x132d12['error'][_0xe756('0x12')]===0x1f4){logger['error'](_0xe756('0x13'),_0x3952a4,_0x132d12['error'][_0xe756('0x14')]);return _0x25bc10(_0x132d12[_0xe756('0x11')][_0xe756('0x14')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3952a4,_0x132d12[_0xe756('0x11')][_0xe756('0x14')]);return _0x40a651(_0x132d12[_0xe756('0x11')][_0xe756('0x14')]);}else{logger['info'](_0xe756('0x13'),_0x3952a4,_0xe756('0xd'));_0x40a651(_0x132d12[_0xe756('0x15')]['message']);}})['catch'](function(_0x4e6be4){logger[_0xe756('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3952a4,_0x4e6be4);_0x25bc10(_0x4e6be4);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7802359..5b2eebf 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 _0x0447=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer'];(function(_0x2e4a09,_0x2be3cc){var _0x23bb54=function(_0x26e4d3){while(--_0x26e4d3){_0x2e4a09['push'](_0x2e4a09['shift']());}};_0x23bb54(++_0x2be3cc);}(_0x0447,0x8b));var _0x7044=function(_0x13a5a8,_0x186495){_0x13a5a8=_0x13a5a8-0x0;var _0x397582=_0x0447[_0x13a5a8];return _0x397582;};'use strict';var multer=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var path=require(_0x7044('0x2'));var timeout=require(_0x7044('0x3'));var express=require(_0x7044('0x4'));var router=express['Router']();var fs_extra=require(_0x7044('0x5'));var auth=require(_0x7044('0x6'));var interaction=require(_0x7044('0x7'));var config=require(_0x7044('0x8'));var controller=require(_0x7044('0x9'));router[_0x7044('0xa')]('/',auth[_0x7044('0xb')](),controller[_0x7044('0xc')]);router[_0x7044('0xa')]('/:id',auth[_0x7044('0xb')](),controller[_0x7044('0xd')]);router[_0x7044('0xe')]('/',auth[_0x7044('0xb')](),controller['create']);router[_0x7044('0xf')](_0x7044('0x10'),auth['isAuthenticated'](),controller[_0x7044('0x11')]);router[_0x7044('0x12')](_0x7044('0x10'),auth[_0x7044('0xb')](),controller['destroy']);module[_0x7044('0x13')]=router; \ No newline at end of file +var _0xb89c=['get','/:id','show','post','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','index'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0xb89c,0x198));var _0xcb89=function(_0x3e02c5,_0x1fa525){_0x3e02c5=_0x3e02c5-0x0;var _0x3cf724=_0xb89c[_0x3e02c5];return _0x3cf724;};'use strict';var multer=require(_0xcb89('0x0'));var util=require(_0xcb89('0x1'));var path=require(_0xcb89('0x2'));var timeout=require(_0xcb89('0x3'));var express=require('express');var router=express[_0xcb89('0x4')]();var fs_extra=require(_0xcb89('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb89('0x6'));var config=require(_0xcb89('0x7'));var controller=require(_0xcb89('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcb89('0x9')]);router[_0xcb89('0xa')](_0xcb89('0xb'),auth['isAuthenticated'](),controller[_0xcb89('0xc')]);router[_0xcb89('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb89('0xe')]('/:id',auth[_0xcb89('0xf')](),controller[_0xcb89('0x10')]);router[_0xcb89('0x11')](_0xcb89('0xb'),auth[_0xcb89('0xf')](),controller[_0xcb89('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index d3ca0c4..2fde04b 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 _0x6a59=['exports','STRING','TEXT','sequelize'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0x6a59,0x1db));var _0x96a5=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x6a59[_0x2cc569];return _0x1bfc2e;};'use strict';var Sequelize=require(_0x96a5('0x0'));module[_0x96a5('0x1')]={'name':{'type':Sequelize[_0x96a5('0x2')]},'description':{'type':Sequelize[_0x96a5('0x2')]},'html':{'type':Sequelize[_0x96a5('0x3')]}}; \ No newline at end of file +var _0x28a8=['STRING','TEXT'];(function(_0x2941a2,_0x579554){var _0x54df67=function(_0x553b7e){while(--_0x553b7e){_0x2941a2['push'](_0x2941a2['shift']());}};_0x54df67(++_0x579554);}(_0x28a8,0xa4));var _0x828a=function(_0x175f46,_0x94c9a2){_0x175f46=_0x175f46-0x0;var _0x2c1c5d=_0x28a8[_0x175f46];return _0x2c1c5d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x828a('0x0')]},'description':{'type':Sequelize[_0x828a('0x0')]},'html':{'type':Sequelize[_0x828a('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 3c6b51b..faf6e07 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 _0xa1d2=['rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','filters','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','find','destroy'];(function(_0x3f58e4,_0x4a274b){var _0x35f321=function(_0xb6e8ef){while(--_0xb6e8ef){_0x3f58e4['push'](_0x3f58e4['shift']());}};_0x35f321(++_0x4a274b);}(_0xa1d2,0x1b8));var _0x2a1d=function(_0xf1ef87,_0x5b75bb){_0xf1ef87=_0xf1ef87-0x0;var _0x259afe=_0xa1d2[_0xf1ef87];return _0x259afe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a1d('0x0'));var zipdir=require(_0x2a1d('0x1'));var jsonpatch=require(_0x2a1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a1d('0x3'));var Mustache=require(_0x2a1d('0x4'));var util=require('util');var path=require(_0x2a1d('0x5'));var sox=require(_0x2a1d('0x6'));var csv=require(_0x2a1d('0x7'));var ejs=require(_0x2a1d('0x8'));var fs=require('fs');var fs_extra=require(_0x2a1d('0x9'));var _=require(_0x2a1d('0xa'));var squel=require(_0x2a1d('0xb'));var crypto=require(_0x2a1d('0xc'));var jsforce=require(_0x2a1d('0xd'));var deskjs=require(_0x2a1d('0xe'));var toCsv=require(_0x2a1d('0x7'));var querystring=require(_0x2a1d('0xf'));var Papa=require('papaparse');var Redis=require(_0x2a1d('0x10'));var authService=require(_0x2a1d('0x11'));var qs=require(_0x2a1d('0x12'));var as=require(_0x2a1d('0x13'));var hardwareService=require(_0x2a1d('0x14'));var logger=require(_0x2a1d('0x15'))(_0x2a1d('0x16'));var utils=require(_0x2a1d('0x17'));var config=require(_0x2a1d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a1d('0x19'))['db'];function respondWithStatusCode(_0x1045e7,_0x555041){_0x555041=_0x555041||0xcc;return function(_0x48747e){if(_0x48747e){return _0x1045e7[_0x2a1d('0x1a')](_0x555041);}return _0x1045e7[_0x2a1d('0x1b')](_0x555041)[_0x2a1d('0x1c')]();};}function respondWithResult(_0x43e7d6,_0xb463dc){_0xb463dc=_0xb463dc||0xc8;return function(_0x45ff1a){if(_0x45ff1a){return _0x43e7d6[_0x2a1d('0x1b')](_0xb463dc)[_0x2a1d('0x1d')](_0x45ff1a);}};}function respondWithFilteredResult(_0x2c7f7a,_0x531a50){return function(_0xb462b0){if(_0xb462b0){var _0x2cdf5a=typeof _0x531a50[_0x2a1d('0x1e')]===_0x2a1d('0x1f')&&typeof _0x531a50[_0x2a1d('0x20')]===_0x2a1d('0x1f');var _0x3ea627=_0xb462b0[_0x2a1d('0x21')];var _0x45a6db=_0x2cdf5a?0x0:_0x531a50[_0x2a1d('0x1e')];var _0x17d242=_0x2cdf5a?_0xb462b0[_0x2a1d('0x21')]:_0x531a50['offset']+_0x531a50['limit'];var _0x20f751;if(_0x17d242>=_0x3ea627){_0x17d242=_0x3ea627;_0x20f751=0xc8;}else{_0x20f751=0xce;}_0x2c7f7a[_0x2a1d('0x1b')](_0x20f751);return _0x2c7f7a[_0x2a1d('0x22')](_0x2a1d('0x23'),_0x45a6db+'-'+_0x17d242+'/'+_0x3ea627)[_0x2a1d('0x1d')](_0xb462b0);}return null;};}function patchUpdates(_0x28d677){return function(_0x2222a1){try{jsonpatch[_0x2a1d('0x24')](_0x2222a1,_0x28d677,!![]);}catch(_0x46f003){return BPromise[_0x2a1d('0x25')](_0x46f003);}return _0x2222a1[_0x2a1d('0x26')]();};}function saveUpdates(_0x164f45,_0x76b736){return function(_0x5356a3){if(_0x5356a3){return _0x5356a3[_0x2a1d('0x27')](_0x164f45)[_0x2a1d('0x28')](function(_0x11cc11){return _0x11cc11;});}return null;};}function removeEntity(_0x491d51,_0x42fc1f){return function(_0x4fadc0){if(_0x4fadc0){return _0x4fadc0['destroy']()[_0x2a1d('0x28')](function(){var _0x42ec03=_0x4fadc0[_0x2a1d('0x29')]({'plain':!![]});var _0x5a740e='Templates';return db[_0x2a1d('0x2a')]['destroy']({'where':{'type':_0x5a740e,'resourceId':_0x42ec03['id']}})['then'](function(){return _0x4fadc0;});})['then'](function(){_0x491d51[_0x2a1d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c0df,_0x6eebc){return function(_0xd5af4e){if(!_0xd5af4e){_0x58c0df[_0x2a1d('0x1a')](0x194);}return _0xd5af4e;};}function handleError(_0x15197c,_0x35ebd6){_0x35ebd6=_0x35ebd6||0x1f4;return function(_0x2b8e64){logger[_0x2a1d('0x2b')](_0x2b8e64[_0x2a1d('0x2c')]);if(_0x2b8e64[_0x2a1d('0x2d')]){delete _0x2b8e64[_0x2a1d('0x2d')];}_0x15197c[_0x2a1d('0x1b')](_0x35ebd6)[_0x2a1d('0x2e')](_0x2b8e64);};}exports[_0x2a1d('0x2f')]=function(_0x32c59b,_0x5adf77){var _0x3aaaa4={},_0xa41432={},_0x62a243={'count':0x0,'rows':[]};var _0x2485ec=_['map'](db[_0x2a1d('0x30')][_0x2a1d('0x31')],function(_0x577d5a){return{'name':_0x577d5a[_0x2a1d('0x32')],'type':_0x577d5a[_0x2a1d('0x33')][_0x2a1d('0x34')]};});_0xa41432['model']=_[_0x2a1d('0x35')](_0x2485ec,'name');_0xa41432[_0x2a1d('0x36')]=_['keys'](_0x32c59b[_0x2a1d('0x36')]);_0xa41432['filters']=_[_0x2a1d('0x37')](_0xa41432[_0x2a1d('0x38')],_0xa41432[_0x2a1d('0x36')]);_0x3aaaa4[_0x2a1d('0x39')]=_['intersection'](_0xa41432[_0x2a1d('0x38')],qs['fields'](_0x32c59b['query'][_0x2a1d('0x3a')]));_0x3aaaa4[_0x2a1d('0x39')]=_0x3aaaa4[_0x2a1d('0x39')][_0x2a1d('0x3b')]?_0x3aaaa4[_0x2a1d('0x39')]:_0xa41432[_0x2a1d('0x38')];if(!_0x32c59b[_0x2a1d('0x36')]['hasOwnProperty'](_0x2a1d('0x3c'))){_0x3aaaa4['limit']=qs['limit'](_0x32c59b[_0x2a1d('0x36')][_0x2a1d('0x20')]);_0x3aaaa4[_0x2a1d('0x1e')]=qs[_0x2a1d('0x1e')](_0x32c59b['query'][_0x2a1d('0x1e')]);}_0x3aaaa4[_0x2a1d('0x3d')]=qs[_0x2a1d('0x3e')](_0x32c59b['query'][_0x2a1d('0x3e')]);_0x3aaaa4[_0x2a1d('0x3f')]=qs['filters'](_[_0x2a1d('0x40')](_0x32c59b['query'],_0xa41432['filters']),_0x2485ec);if(_0x32c59b['query'][_0x2a1d('0x41')]){_0x3aaaa4[_0x2a1d('0x3f')]=_['merge'](_0x3aaaa4[_0x2a1d('0x3f')],{'$or':_['map'](_0x2485ec,function(_0x4f8242){if(_0x4f8242['type']!==_0x2a1d('0x42')){var _0x144d7f={};_0x144d7f[_0x4f8242['name']]={'$like':'%'+_0x32c59b[_0x2a1d('0x36')][_0x2a1d('0x41')]+'%'};return _0x144d7f;}})});}_0x3aaaa4=_[_0x2a1d('0x43')]({},_0x3aaaa4,_0x32c59b[_0x2a1d('0x44')]);var _0x555561={'where':_0x3aaaa4[_0x2a1d('0x3f')]};return db[_0x2a1d('0x30')]['count'](_0x555561)[_0x2a1d('0x28')](function(_0x5e1021){_0x62a243[_0x2a1d('0x21')]=_0x5e1021;if(_0x32c59b['query'][_0x2a1d('0x45')]){_0x3aaaa4[_0x2a1d('0x46')]=[{'all':!![]}];}return db[_0x2a1d('0x30')][_0x2a1d('0x47')](_0x3aaaa4);})['then'](function(_0x784058){_0x62a243[_0x2a1d('0x48')]=_0x784058;return _0x62a243;})[_0x2a1d('0x28')](respondWithFilteredResult(_0x5adf77,_0x3aaaa4))[_0x2a1d('0x49')](handleError(_0x5adf77,null));};exports[_0x2a1d('0x4a')]=function(_0x279ce3,_0x5543f3){var _0x401ce5={'raw':!![],'where':{'id':_0x279ce3[_0x2a1d('0x4b')]['id']}},_0x4695e4={};_0x4695e4[_0x2a1d('0x38')]=_['keys'](db['Template'][_0x2a1d('0x31')]);_0x4695e4[_0x2a1d('0x36')]=_[_0x2a1d('0x4c')](_0x279ce3[_0x2a1d('0x36')]);_0x4695e4[_0x2a1d('0x4d')]=_[_0x2a1d('0x37')](_0x4695e4[_0x2a1d('0x38')],_0x4695e4[_0x2a1d('0x36')]);_0x401ce5['attributes']=_['intersection'](_0x4695e4['model'],qs[_0x2a1d('0x3a')](_0x279ce3['query']['fields']));_0x401ce5[_0x2a1d('0x39')]=_0x401ce5[_0x2a1d('0x39')][_0x2a1d('0x3b')]?_0x401ce5[_0x2a1d('0x39')]:_0x4695e4[_0x2a1d('0x38')];if(_0x279ce3['query']['includeAll']){_0x401ce5[_0x2a1d('0x46')]=[{'all':!![]}];}_0x401ce5=_[_0x2a1d('0x43')]({},_0x401ce5,_0x279ce3[_0x2a1d('0x44')]);return db[_0x2a1d('0x30')]['find'](_0x401ce5)['then'](handleEntityNotFound(_0x5543f3,null))[_0x2a1d('0x28')](respondWithResult(_0x5543f3,null))[_0x2a1d('0x49')](handleError(_0x5543f3,null));};exports[_0x2a1d('0x4e')]=function(_0xa25abe,_0xe7a6cf){return db['Template'][_0x2a1d('0x4e')](_0xa25abe[_0x2a1d('0x4f')],{})[_0x2a1d('0x28')](function(_0x54645a){var _0x3e0832=_0xa25abe['user'][_0x2a1d('0x29')]({'plain':!![]});if(!_0x3e0832)throw new Error(_0x2a1d('0x50'));if(_0x3e0832[_0x2a1d('0x51')]==='user'){var _0x331a87=_0x54645a[_0x2a1d('0x29')]({'plain':!![]});var _0x1fbb80=_0x2a1d('0x52');return db[_0x2a1d('0x53')]['find']({'where':{'name':_0x1fbb80,'userProfileId':_0x3e0832[_0x2a1d('0x54')]},'raw':!![]})['then'](function(_0x30396a){if(_0x30396a&&_0x30396a[_0x2a1d('0x55')]===0x0){return db['UserProfileResource'][_0x2a1d('0x4e')]({'name':_0x331a87[_0x2a1d('0x2d')],'resourceId':_0x331a87['id'],'type':_0x30396a[_0x2a1d('0x2d')],'sectionId':_0x30396a['id']},{})[_0x2a1d('0x28')](function(){return _0x54645a;});}else{return _0x54645a;}})[_0x2a1d('0x49')](function(_0x429c1e){logger[_0x2a1d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x429c1e);throw _0x429c1e;});}return _0x54645a;})[_0x2a1d('0x28')](respondWithResult(_0xe7a6cf,0xc9))[_0x2a1d('0x49')](handleError(_0xe7a6cf,null));};exports[_0x2a1d('0x27')]=function(_0x129da9,_0x4179b7){if(_0x129da9[_0x2a1d('0x4f')]['id']){delete _0x129da9[_0x2a1d('0x4f')]['id'];}return db[_0x2a1d('0x30')][_0x2a1d('0x56')]({'where':{'id':_0x129da9[_0x2a1d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4179b7,null))[_0x2a1d('0x28')](saveUpdates(_0x129da9[_0x2a1d('0x4f')],null))[_0x2a1d('0x28')](respondWithResult(_0x4179b7,null))['catch'](handleError(_0x4179b7,null));};exports[_0x2a1d('0x57')]=function(_0x104d4b,_0x246953){return db['Template'][_0x2a1d('0x56')]({'where':{'id':_0x104d4b[_0x2a1d('0x4b')]['id']}})[_0x2a1d('0x28')](handleEntityNotFound(_0x246953,null))[_0x2a1d('0x28')](removeEntity(_0x246953,null))[_0x2a1d('0x49')](handleError(_0x246953,null));}; \ No newline at end of file +var _0x6179=['Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6179,0xdb));var _0x9617=function(_0x98b7ff,_0x51065a){_0x98b7ff=_0x98b7ff-0x0;var _0xa2df96=_0x6179[_0x98b7ff];return _0xa2df96;};'use strict';var emlformat=require(_0x9617('0x0'));var rimraf=require(_0x9617('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9617('0x2'));var rp=require(_0x9617('0x3'));var moment=require(_0x9617('0x4'));var BPromise=require(_0x9617('0x5'));var Mustache=require(_0x9617('0x6'));var util=require(_0x9617('0x7'));var path=require(_0x9617('0x8'));var sox=require('sox');var csv=require(_0x9617('0x9'));var ejs=require(_0x9617('0xa'));var fs=require('fs');var fs_extra=require(_0x9617('0xb'));var _=require(_0x9617('0xc'));var squel=require(_0x9617('0xd'));var crypto=require(_0x9617('0xe'));var jsforce=require(_0x9617('0xf'));var deskjs=require(_0x9617('0x10'));var toCsv=require(_0x9617('0x9'));var querystring=require('querystring');var Papa=require(_0x9617('0x11'));var Redis=require(_0x9617('0x12'));var authService=require(_0x9617('0x13'));var qs=require(_0x9617('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9617('0x15'));var logger=require(_0x9617('0x16'))(_0x9617('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9617('0x18'))['db'];function respondWithStatusCode(_0x3634a9,_0x1ab7b7){_0x1ab7b7=_0x1ab7b7||0xcc;return function(_0x289c11){if(_0x289c11){return _0x3634a9[_0x9617('0x19')](_0x1ab7b7);}return _0x3634a9[_0x9617('0x1a')](_0x1ab7b7)[_0x9617('0x1b')]();};}function respondWithResult(_0x15475d,_0x1f6331){_0x1f6331=_0x1f6331||0xc8;return function(_0x5a1665){if(_0x5a1665){return _0x15475d[_0x9617('0x1a')](_0x1f6331)[_0x9617('0x1c')](_0x5a1665);}};}function respondWithFilteredResult(_0x282aed,_0x24018f){return function(_0x3b0f5d){if(_0x3b0f5d){var _0x2e487f=typeof _0x24018f[_0x9617('0x1d')]===_0x9617('0x1e')&&typeof _0x24018f[_0x9617('0x1f')]===_0x9617('0x1e');var _0x2805fc=_0x3b0f5d[_0x9617('0x20')];var _0x226253=_0x2e487f?0x0:_0x24018f[_0x9617('0x1d')];var _0x1c38cb=_0x2e487f?_0x3b0f5d[_0x9617('0x20')]:_0x24018f['offset']+_0x24018f['limit'];var _0x2aa09e;if(_0x1c38cb>=_0x2805fc){_0x1c38cb=_0x2805fc;_0x2aa09e=0xc8;}else{_0x2aa09e=0xce;}_0x282aed[_0x9617('0x1a')](_0x2aa09e);return _0x282aed['set'](_0x9617('0x21'),_0x226253+'-'+_0x1c38cb+'/'+_0x2805fc)['json'](_0x3b0f5d);}return null;};}function patchUpdates(_0xb83976){return function(_0x5d0bfe){try{jsonpatch[_0x9617('0x22')](_0x5d0bfe,_0xb83976,!![]);}catch(_0x3e10c1){return BPromise[_0x9617('0x23')](_0x3e10c1);}return _0x5d0bfe[_0x9617('0x24')]();};}function saveUpdates(_0x4548bc,_0x251e7b){return function(_0x598546){if(_0x598546){return _0x598546[_0x9617('0x25')](_0x4548bc)[_0x9617('0x26')](function(_0x5e2aca){return _0x5e2aca;});}return null;};}function removeEntity(_0x48ad39,_0x334726){return function(_0x5f1e37){if(_0x5f1e37){return _0x5f1e37[_0x9617('0x27')]()[_0x9617('0x26')](function(){var _0x271709=_0x5f1e37[_0x9617('0x28')]({'plain':!![]});var _0x12b82a=_0x9617('0x29');return db[_0x9617('0x2a')]['destroy']({'where':{'type':_0x12b82a,'resourceId':_0x271709['id']}})['then'](function(){return _0x5f1e37;});})['then'](function(){_0x48ad39[_0x9617('0x1a')](0xcc)[_0x9617('0x1b')]();});}};}function handleEntityNotFound(_0xdc8457,_0x523df3){return function(_0x302e8a){if(!_0x302e8a){_0xdc8457[_0x9617('0x19')](0x194);}return _0x302e8a;};}function handleError(_0x5c422a,_0x20a2d2){_0x20a2d2=_0x20a2d2||0x1f4;return function(_0x1aecb1){logger[_0x9617('0x2b')](_0x1aecb1[_0x9617('0x2c')]);if(_0x1aecb1['name']){delete _0x1aecb1[_0x9617('0x2d')];}_0x5c422a[_0x9617('0x1a')](_0x20a2d2)[_0x9617('0x2e')](_0x1aecb1);};}exports[_0x9617('0x2f')]=function(_0x523492,_0x3adf4a){var _0x3eb951={},_0x1e4f21={},_0x2cf161={'count':0x0,'rows':[]};var _0x1a7318=_[_0x9617('0x30')](db[_0x9617('0x31')]['rawAttributes'],function(_0x4807b2){return{'name':_0x4807b2[_0x9617('0x32')],'type':_0x4807b2[_0x9617('0x33')][_0x9617('0x34')]};});_0x1e4f21['model']=_['map'](_0x1a7318,_0x9617('0x2d'));_0x1e4f21[_0x9617('0x35')]=_[_0x9617('0x36')](_0x523492[_0x9617('0x35')]);_0x1e4f21['filters']=_[_0x9617('0x37')](_0x1e4f21['model'],_0x1e4f21[_0x9617('0x35')]);_0x3eb951[_0x9617('0x38')]=_[_0x9617('0x37')](_0x1e4f21[_0x9617('0x39')],qs[_0x9617('0x3a')](_0x523492[_0x9617('0x35')][_0x9617('0x3a')]));_0x3eb951[_0x9617('0x38')]=_0x3eb951[_0x9617('0x38')][_0x9617('0x3b')]?_0x3eb951[_0x9617('0x38')]:_0x1e4f21[_0x9617('0x39')];if(!_0x523492['query'][_0x9617('0x3c')](_0x9617('0x3d'))){_0x3eb951[_0x9617('0x1f')]=qs[_0x9617('0x1f')](_0x523492[_0x9617('0x35')][_0x9617('0x1f')]);_0x3eb951[_0x9617('0x1d')]=qs[_0x9617('0x1d')](_0x523492[_0x9617('0x35')][_0x9617('0x1d')]);}_0x3eb951[_0x9617('0x3e')]=qs[_0x9617('0x3f')](_0x523492[_0x9617('0x35')]['sort']);_0x3eb951[_0x9617('0x40')]=qs['filters'](_['pick'](_0x523492[_0x9617('0x35')],_0x1e4f21[_0x9617('0x41')]),_0x1a7318);if(_0x523492[_0x9617('0x35')][_0x9617('0x42')]){_0x3eb951[_0x9617('0x40')]=_[_0x9617('0x43')](_0x3eb951['where'],{'$or':_[_0x9617('0x30')](_0x1a7318,function(_0x2a2c9e){if(_0x2a2c9e[_0x9617('0x33')]!=='VIRTUAL'){var _0x54a6cb={};_0x54a6cb[_0x2a2c9e[_0x9617('0x2d')]]={'$like':'%'+_0x523492[_0x9617('0x35')][_0x9617('0x42')]+'%'};return _0x54a6cb;}})});}_0x3eb951=_[_0x9617('0x43')]({},_0x3eb951,_0x523492[_0x9617('0x44')]);var _0x1f7ca9={'where':_0x3eb951['where']};return db['Template'][_0x9617('0x20')](_0x1f7ca9)[_0x9617('0x26')](function(_0x9bc8be){_0x2cf161['count']=_0x9bc8be;if(_0x523492[_0x9617('0x35')][_0x9617('0x45')]){_0x3eb951[_0x9617('0x46')]=[{'all':!![]}];}return db[_0x9617('0x31')][_0x9617('0x47')](_0x3eb951);})[_0x9617('0x26')](function(_0x1eb56a){_0x2cf161['rows']=_0x1eb56a;return _0x2cf161;})['then'](respondWithFilteredResult(_0x3adf4a,_0x3eb951))[_0x9617('0x48')](handleError(_0x3adf4a,null));};exports['show']=function(_0xd34c8d,_0x2fdc71){var _0x544dcd={'raw':!![],'where':{'id':_0xd34c8d[_0x9617('0x49')]['id']}},_0x2df706={};_0x2df706[_0x9617('0x39')]=_[_0x9617('0x36')](db[_0x9617('0x31')][_0x9617('0x4a')]);_0x2df706[_0x9617('0x35')]=_['keys'](_0xd34c8d[_0x9617('0x35')]);_0x2df706['filters']=_[_0x9617('0x37')](_0x2df706[_0x9617('0x39')],_0x2df706[_0x9617('0x35')]);_0x544dcd[_0x9617('0x38')]=_[_0x9617('0x37')](_0x2df706[_0x9617('0x39')],qs[_0x9617('0x3a')](_0xd34c8d['query'][_0x9617('0x3a')]));_0x544dcd[_0x9617('0x38')]=_0x544dcd[_0x9617('0x38')][_0x9617('0x3b')]?_0x544dcd[_0x9617('0x38')]:_0x2df706[_0x9617('0x39')];if(_0xd34c8d[_0x9617('0x35')][_0x9617('0x45')]){_0x544dcd['include']=[{'all':!![]}];}_0x544dcd=_['merge']({},_0x544dcd,_0xd34c8d[_0x9617('0x44')]);return db[_0x9617('0x31')]['find'](_0x544dcd)['then'](handleEntityNotFound(_0x2fdc71,null))[_0x9617('0x26')](respondWithResult(_0x2fdc71,null))[_0x9617('0x48')](handleError(_0x2fdc71,null));};exports[_0x9617('0x4b')]=function(_0x41c2cb,_0x47d9aa){return db[_0x9617('0x31')][_0x9617('0x4b')](_0x41c2cb[_0x9617('0x4c')],{})[_0x9617('0x26')](function(_0x18fdee){var _0x296ce1=_0x41c2cb[_0x9617('0x4d')][_0x9617('0x28')]({'plain':!![]});if(!_0x296ce1)throw new Error(_0x9617('0x4e'));if(_0x296ce1[_0x9617('0x4f')]===_0x9617('0x4d')){var _0x4c075e=_0x18fdee[_0x9617('0x28')]({'plain':!![]});var _0x125b23='Templates';return db[_0x9617('0x50')][_0x9617('0x51')]({'where':{'name':_0x125b23,'userProfileId':_0x296ce1['userProfileId']},'raw':!![]})[_0x9617('0x26')](function(_0x3334f9){if(_0x3334f9&&_0x3334f9[_0x9617('0x52')]===0x0){return db['UserProfileResource'][_0x9617('0x4b')]({'name':_0x4c075e[_0x9617('0x2d')],'resourceId':_0x4c075e['id'],'type':_0x3334f9[_0x9617('0x2d')],'sectionId':_0x3334f9['id']},{})[_0x9617('0x26')](function(){return _0x18fdee;});}else{return _0x18fdee;}})[_0x9617('0x48')](function(_0x2bba18){logger[_0x9617('0x2b')](_0x9617('0x53'),_0x2bba18);throw _0x2bba18;});}return _0x18fdee;})['then'](respondWithResult(_0x47d9aa,0xc9))[_0x9617('0x48')](handleError(_0x47d9aa,null));};exports[_0x9617('0x25')]=function(_0x39630e,_0x5d47f7){if(_0x39630e[_0x9617('0x4c')]['id']){delete _0x39630e['body']['id'];}return db[_0x9617('0x31')][_0x9617('0x51')]({'where':{'id':_0x39630e[_0x9617('0x49')]['id']}})[_0x9617('0x26')](handleEntityNotFound(_0x5d47f7,null))[_0x9617('0x26')](saveUpdates(_0x39630e[_0x9617('0x4c')],null))[_0x9617('0x26')](respondWithResult(_0x5d47f7,null))[_0x9617('0x48')](handleError(_0x5d47f7,null));};exports['destroy']=function(_0x5060b4,_0x2a0001){return db[_0x9617('0x31')][_0x9617('0x51')]({'where':{'id':_0x5060b4[_0x9617('0x49')]['id']}})[_0x9617('0x26')](handleEntityNotFound(_0x2a0001,null))['then'](removeEntity(_0x2a0001,null))[_0x9617('0x48')](handleError(_0x2a0001,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 09f2929..1fe778a 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 _0xc5b8=['../../config/environment','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x43f4c8,_0x22a037){var _0x3a2e0c=function(_0x182023){while(--_0x182023){_0x43f4c8['push'](_0x43f4c8['shift']());}};_0x3a2e0c(++_0x22a037);}(_0xc5b8,0x1dd));var _0x8c5b=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xc5b8[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x8c5b('0x0'));var util=require(_0x8c5b('0x1'));var logger=require(_0x8c5b('0x2'))(_0x8c5b('0x3'));var moment=require(_0x8c5b('0x4'));var BPromise=require('bluebird');var rp=require(_0x8c5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c5b('0x6'));var config=require(_0x8c5b('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x1c6178,_0x123aef){return _0x1c6178[_0x8c5b('0x8')](_0x8c5b('0x9'),attributes,{'tableName':_0x8c5b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e07=['./template.attributes','exports','define','tools_templates','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x53481a,_0x3d17f9){var _0x52893f=function(_0x5991c0){while(--_0x5991c0){_0x53481a['push'](_0x53481a['shift']());}};_0x52893f(++_0x3d17f9);}(_0x7e07,0x70));var _0x77e0=function(_0x376ac6,_0x1ffc75){_0x376ac6=_0x376ac6-0x0;var _0x59cd4c=_0x7e07[_0x376ac6];return _0x59cd4c;};'use strict';var _=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var logger=require('../../config/logger')(_0x77e0('0x2'));var moment=require(_0x77e0('0x3'));var BPromise=require(_0x77e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x77e0('0x5'));var rimraf=require(_0x77e0('0x6'));var config=require(_0x77e0('0x7'));var attributes=require(_0x77e0('0x8'));module[_0x77e0('0x9')]=function(_0x3ec0eb,_0x516c30){return _0x3ec0eb[_0x77e0('0xa')]('Template',attributes,{'tableName':_0x77e0('0xb'),'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 d782840..ced8648 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 _0xca39=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','Template','findAll','options','raw','where','limit','map','include','model','attributes','catch','GetTemplate','lodash','util','moment','randomstring','ioredis'];(function(_0x485352,_0x269f0b){var _0x331cac=function(_0x211897){while(--_0x211897){_0x485352['push'](_0x485352['shift']());}};_0x331cac(++_0x269f0b);}(_0xca39,0xf0));var _0x9ca3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xca39[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x9ca3('0x0'));var util=require(_0x9ca3('0x1'));var moment=require(_0x9ca3('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ca3('0x3'));var fs=require('fs');var Redis=require(_0x9ca3('0x4'));var db=require(_0x9ca3('0x5'))['db'];var utils=require(_0x9ca3('0x6'));var logger=require(_0x9ca3('0x7'))(_0x9ca3('0x8'));var config=require('../../config/environment');var jayson=require(_0x9ca3('0x9'));var client=jayson[_0x9ca3('0xa')][_0x9ca3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36bea6,_0xe100ef,_0x37b94a){return new BPromise(function(_0x2cc09e,_0x30d86e){return client[_0x9ca3('0xc')](_0x36bea6,_0x37b94a)[_0x9ca3('0xd')](function(_0x48555d){logger['info'](_0x9ca3('0xe'),_0xe100ef,_0x9ca3('0xf'));logger[_0x9ca3('0x10')](_0x9ca3('0x11'),_0xe100ef,_0x9ca3('0xf'),JSON[_0x9ca3('0x12')](_0x48555d));if(_0x48555d[_0x9ca3('0x13')]){if(_0x48555d['error']['code']===0x1f4){logger[_0x9ca3('0x13')](_0x9ca3('0xe'),_0xe100ef,_0x48555d['error'][_0x9ca3('0x14')]);return _0x30d86e(_0x48555d[_0x9ca3('0x13')][_0x9ca3('0x14')]);}logger['error'](_0x9ca3('0xe'),_0xe100ef,_0x48555d[_0x9ca3('0x13')][_0x9ca3('0x14')]);return _0x2cc09e(_0x48555d[_0x9ca3('0x13')][_0x9ca3('0x14')]);}else{logger[_0x9ca3('0x15')](_0x9ca3('0xe'),_0xe100ef,_0x9ca3('0xf'));_0x2cc09e(_0x48555d[_0x9ca3('0x16')][_0x9ca3('0x14')]);}})['catch'](function(_0x4bc050){logger[_0x9ca3('0x13')](_0x9ca3('0xe'),_0xe100ef,_0x4bc050);_0x30d86e(_0x4bc050);});});}exports['GetTemplate']=function(_0x29335e){var _0x5b9571=this;return new Promise(function(_0x3789c1,_0x5a2e39){return db[_0x9ca3('0x17')][_0x9ca3('0x18')]({'raw':_0x29335e[_0x9ca3('0x19')]?_0x29335e[_0x9ca3('0x19')][_0x9ca3('0x1a')]===undefined?!![]:![]:!![],'where':_0x29335e[_0x9ca3('0x19')]?_0x29335e[_0x9ca3('0x19')][_0x9ca3('0x1b')]||null:null,'attributes':_0x29335e['options']?_0x29335e[_0x9ca3('0x19')]['attributes']||null:null,'limit':_0x29335e[_0x9ca3('0x19')]?_0x29335e[_0x9ca3('0x19')][_0x9ca3('0x1c')]||null:null,'include':_0x29335e[_0x9ca3('0x19')]?_0x29335e[_0x9ca3('0x19')]['include']?_[_0x9ca3('0x1d')](_0x29335e[_0x9ca3('0x19')][_0x9ca3('0x1e')],function(_0x5ac77d){return{'model':db[_0x5ac77d[_0x9ca3('0x1f')]],'as':_0x5ac77d['as'],'attributes':_0x5ac77d[_0x9ca3('0x20')],'include':_0x5ac77d[_0x9ca3('0x1e')]?_[_0x9ca3('0x1d')](_0x5ac77d[_0x9ca3('0x1e')],function(_0xc2c504){return{'model':db[_0xc2c504[_0x9ca3('0x1f')]],'as':_0xc2c504['as'],'attributes':_0xc2c504[_0x9ca3('0x20')],'include':_0xc2c504[_0x9ca3('0x1e')]?_[_0x9ca3('0x1d')](_0xc2c504[_0x9ca3('0x1e')],function(_0x68a00d){return{'model':db[_0x68a00d['model']],'as':_0x68a00d['as'],'attributes':_0x68a00d[_0x9ca3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9ca3('0xd')](function(_0x2a6355){logger[_0x9ca3('0x15')]('GetTemplate',_0x29335e);logger[_0x9ca3('0x10')]('GetTemplate',_0x29335e,JSON['stringify'](_0x2a6355));_0x3789c1(_0x2a6355);})[_0x9ca3('0x21')](function(_0x367885){logger[_0x9ca3('0x13')](_0x9ca3('0x22'),_0x367885[_0x9ca3('0x14')],_0x29335e);_0x5a2e39(_0x5b9571[_0x9ca3('0x13')](0x1f4,_0x367885[_0x9ca3('0x14')]));});});}; \ No newline at end of file +var _0xaebe=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','then','info','lodash'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xaebe,0xed));var _0xeaeb=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xaebe[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0xeaeb('0x0'));var util=require(_0xeaeb('0x1'));var moment=require(_0xeaeb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeaeb('0x3'));var db=require(_0xeaeb('0x4'))['db'];var utils=require(_0xeaeb('0x5'));var logger=require(_0xeaeb('0x6'))('rpc');var config=require(_0xeaeb('0x7'));var jayson=require(_0xeaeb('0x8'));var client=jayson[_0xeaeb('0x9')][_0xeaeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21fd10,_0x4a0772,_0x2fb29c){return new BPromise(function(_0x4a479c,_0x56c34c){return client[_0xeaeb('0xb')](_0x21fd10,_0x2fb29c)['then'](function(_0x1d29b6){logger['info'](_0xeaeb('0xc'),_0x4a0772,_0xeaeb('0xd'));logger[_0xeaeb('0xe')](_0xeaeb('0xf'),_0x4a0772,_0xeaeb('0xd'),JSON[_0xeaeb('0x10')](_0x1d29b6));if(_0x1d29b6[_0xeaeb('0x11')]){if(_0x1d29b6['error'][_0xeaeb('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x4a0772,_0x1d29b6[_0xeaeb('0x11')]['message']);return _0x56c34c(_0x1d29b6[_0xeaeb('0x11')][_0xeaeb('0x13')]);}logger[_0xeaeb('0x11')](_0xeaeb('0xc'),_0x4a0772,_0x1d29b6['error'][_0xeaeb('0x13')]);return _0x4a479c(_0x1d29b6[_0xeaeb('0x11')]['message']);}else{logger['info'](_0xeaeb('0xc'),_0x4a0772,_0xeaeb('0xd'));_0x4a479c(_0x1d29b6['result'][_0xeaeb('0x13')]);}})[_0xeaeb('0x14')](function(_0x4b81bd){logger['error'](_0xeaeb('0xc'),_0x4a0772,_0x4b81bd);_0x56c34c(_0x4b81bd);});});}exports[_0xeaeb('0x15')]=function(_0x192e74){var _0x4d946e=this;return new Promise(function(_0x4bd9e1,_0x2f559d){return db[_0xeaeb('0x16')][_0xeaeb('0x17')]({'raw':_0x192e74[_0xeaeb('0x18')]?_0x192e74[_0xeaeb('0x18')][_0xeaeb('0x19')]===undefined?!![]:![]:!![],'where':_0x192e74[_0xeaeb('0x18')]?_0x192e74[_0xeaeb('0x18')][_0xeaeb('0x1a')]||null:null,'attributes':_0x192e74[_0xeaeb('0x18')]?_0x192e74[_0xeaeb('0x18')][_0xeaeb('0x1b')]||null:null,'limit':_0x192e74[_0xeaeb('0x18')]?_0x192e74[_0xeaeb('0x18')][_0xeaeb('0x1c')]||null:null,'include':_0x192e74[_0xeaeb('0x18')]?_0x192e74[_0xeaeb('0x18')][_0xeaeb('0x1d')]?_['map'](_0x192e74[_0xeaeb('0x18')][_0xeaeb('0x1d')],function(_0x51f06){return{'model':db[_0x51f06[_0xeaeb('0x1e')]],'as':_0x51f06['as'],'attributes':_0x51f06[_0xeaeb('0x1b')],'include':_0x51f06[_0xeaeb('0x1d')]?_[_0xeaeb('0x1f')](_0x51f06[_0xeaeb('0x1d')],function(_0x5f27cd){return{'model':db[_0x5f27cd[_0xeaeb('0x1e')]],'as':_0x5f27cd['as'],'attributes':_0x5f27cd[_0xeaeb('0x1b')],'include':_0x5f27cd[_0xeaeb('0x1d')]?_[_0xeaeb('0x1f')](_0x5f27cd[_0xeaeb('0x1d')],function(_0xb93cb4){return{'model':db[_0xb93cb4[_0xeaeb('0x1e')]],'as':_0xb93cb4['as'],'attributes':_0xb93cb4['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaeb('0x20')](function(_0x59f117){logger[_0xeaeb('0x21')]('GetTemplate',_0x192e74);logger[_0xeaeb('0xe')]('GetTemplate',_0x192e74,JSON[_0xeaeb('0x10')](_0x59f117));_0x4bd9e1(_0x59f117);})['catch'](function(_0x2e88db){logger[_0xeaeb('0x11')](_0xeaeb('0x15'),_0x2e88db[_0xeaeb('0x13')],_0x192e74);_0x2f559d(_0x4d946e[_0xeaeb('0x11')](0x1f4,_0x2e88db[_0xeaeb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9e4da5d..bc26774 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 _0x8eba=['delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','index','/:id','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','addAnyCondition','/:id/actions','addAction','put'];(function(_0x4f57c1,_0x442bb1){var _0x399195=function(_0x5ac3cb){while(--_0x5ac3cb){_0x4f57c1['push'](_0x4f57c1['shift']());}};_0x399195(++_0x442bb1);}(_0x8eba,0xc3));var _0xa8eb=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x8eba[_0x50f0a9];return _0x5a33d9;};'use strict';var multer=require(_0xa8eb('0x0'));var util=require(_0xa8eb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa8eb('0x2')]();var fs_extra=require(_0xa8eb('0x3'));var auth=require(_0xa8eb('0x4'));var interaction=require(_0xa8eb('0x5'));var config=require('../../config/environment');var controller=require(_0xa8eb('0x6'));router[_0xa8eb('0x7')]('/',auth['isAuthenticated'](),controller[_0xa8eb('0x8')]);router['get'](_0xa8eb('0x9'),auth[_0xa8eb('0xa')](),controller[_0xa8eb('0xb')]);router[_0xa8eb('0x7')]('/:id/all_conditions',auth[_0xa8eb('0xa')](),controller[_0xa8eb('0xc')]);router['get'](_0xa8eb('0xd'),auth[_0xa8eb('0xa')](),controller[_0xa8eb('0xe')]);router[_0xa8eb('0x7')]('/:id/actions',auth[_0xa8eb('0xa')](),controller['getActions']);router[_0xa8eb('0xf')]('/',auth['isAuthenticated'](),controller[_0xa8eb('0x10')]);router[_0xa8eb('0xf')]('/:id/all_conditions',auth[_0xa8eb('0xa')](),controller['addAllCondition']);router[_0xa8eb('0xf')](_0xa8eb('0xd'),auth[_0xa8eb('0xa')](),controller[_0xa8eb('0x11')]);router['post'](_0xa8eb('0x12'),auth['isAuthenticated'](),controller[_0xa8eb('0x13')]);router[_0xa8eb('0x14')](_0xa8eb('0x9'),auth[_0xa8eb('0xa')](),controller['update']);router[_0xa8eb('0x15')](_0xa8eb('0x9'),auth[_0xa8eb('0xa')](),controller[_0xa8eb('0x16')]);module[_0xa8eb('0x17')]=router; \ No newline at end of file +var _0x8bf1=['addAnyCondition','addAction','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/actions','getActions','create','post'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x8bf1,0xd5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x18bf('0x0'));var util=require(_0x18bf('0x1'));var path=require(_0x18bf('0x2'));var timeout=require(_0x18bf('0x3'));var express=require(_0x18bf('0x4'));var router=express[_0x18bf('0x5')]();var fs_extra=require(_0x18bf('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x18bf('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x18bf('0x8')]('/',auth[_0x18bf('0x9')](),controller['index']);router[_0x18bf('0x8')](_0x18bf('0xa'),auth[_0x18bf('0x9')](),controller[_0x18bf('0xb')]);router['get'](_0x18bf('0xc'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x18bf('0x8')]('/:id/any_conditions',auth[_0x18bf('0x9')](),controller['getAnyConditions']);router['get'](_0x18bf('0xd'),auth[_0x18bf('0x9')](),controller[_0x18bf('0xe')]);router['post']('/',auth[_0x18bf('0x9')](),controller[_0x18bf('0xf')]);router['post'](_0x18bf('0xc'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x18bf('0x10')]('/:id/any_conditions',auth[_0x18bf('0x9')](),controller[_0x18bf('0x11')]);router[_0x18bf('0x10')]('/:id/actions',auth[_0x18bf('0x9')](),controller[_0x18bf('0x12')]);router[_0x18bf('0x13')](_0x18bf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x18bf('0x14')](_0x18bf('0xa'),auth[_0x18bf('0x9')](),controller[_0x18bf('0x15')]);module[_0x18bf('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 0be8e5b..30d5885 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 _0x7199=['exports','STRING','BOOLEAN','sequelize'];(function(_0xb1fe96,_0x169303){var _0x4b1c8c=function(_0x2c1343){while(--_0x2c1343){_0xb1fe96['push'](_0xb1fe96['shift']());}};_0x4b1c8c(++_0x169303);}(_0x7199,0x197));var _0x9719=function(_0x2fedf5,_0x24c746){_0x2fedf5=_0x2fedf5-0x0;var _0x5cb126=_0x7199[_0x2fedf5];return _0x5cb126;};'use strict';var Sequelize=require(_0x9719('0x0'));module[_0x9719('0x1')]={'name':{'type':Sequelize[_0x9719('0x2')]},'channel':{'type':Sequelize[_0x9719('0x2')]},'description':{'type':Sequelize[_0x9719('0x2')]},'status':{'type':Sequelize[_0x9719('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3d5=['exports','STRING','BOOLEAN'];(function(_0x573a98,_0x1abb39){var _0x3ecead=function(_0x457bb7){while(--_0x457bb7){_0x573a98['push'](_0x573a98['shift']());}};_0x3ecead(++_0x1abb39);}(_0xf3d5,0x15c));var _0x5f3d=function(_0x45c81e,_0x3e9068){_0x45c81e=_0x45c81e-0x0;var _0x2a99c7=_0xf3d5[_0x45c81e];return _0x2a99c7;};'use strict';var Sequelize=require('sequelize');module[_0x5f3d('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5f3d('0x1')]},'description':{'type':Sequelize[_0x5f3d('0x1')]},'status':{'type':Sequelize[_0x5f3d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 8c4501f..8ce6e3f 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 _0xb1b2=['Condition','TriggerAnyId','findOne','getAllConditions','nolimit','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','json','reject','save','update','destroy','then','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0xb1b2,0x191));var _0x2b1b=function(_0x3ec4a6,_0x12e1ee){_0x3ec4a6=_0x3ec4a6-0x0;var _0x125c9e=_0xb1b2[_0x3ec4a6];return _0x125c9e;};'use strict';var emlformat=require(_0x2b1b('0x0'));var rimraf=require(_0x2b1b('0x1'));var zipdir=require(_0x2b1b('0x2'));var jsonpatch=require(_0x2b1b('0x3'));var rp=require('request-promise');var moment=require(_0x2b1b('0x4'));var BPromise=require(_0x2b1b('0x5'));var Mustache=require(_0x2b1b('0x6'));var util=require('util');var path=require(_0x2b1b('0x7'));var sox=require(_0x2b1b('0x8'));var csv=require(_0x2b1b('0x9'));var ejs=require(_0x2b1b('0xa'));var fs=require('fs');var fs_extra=require(_0x2b1b('0xb'));var _=require(_0x2b1b('0xc'));var squel=require(_0x2b1b('0xd'));var crypto=require(_0x2b1b('0xe'));var jsforce=require(_0x2b1b('0xf'));var deskjs=require(_0x2b1b('0x10'));var toCsv=require(_0x2b1b('0x9'));var querystring=require(_0x2b1b('0x11'));var Papa=require('papaparse');var Redis=require(_0x2b1b('0x12'));var authService=require(_0x2b1b('0x13'));var qs=require(_0x2b1b('0x14'));var as=require(_0x2b1b('0x15'));var hardwareService=require(_0x2b1b('0x16'));var logger=require(_0x2b1b('0x17'))(_0x2b1b('0x18'));var utils=require(_0x2b1b('0x19'));var config=require(_0x2b1b('0x1a'));var licenseUtil=require(_0x2b1b('0x1b'));var db=require(_0x2b1b('0x1c'))['db'];function respondWithStatusCode(_0x2f01eb,_0x3e6436){_0x3e6436=_0x3e6436||0xcc;return function(_0x3f159d){if(_0x3f159d){return _0x2f01eb[_0x2b1b('0x1d')](_0x3e6436);}return _0x2f01eb[_0x2b1b('0x1e')](_0x3e6436)['end']();};}function respondWithResult(_0x169cd0,_0x4207b3){_0x4207b3=_0x4207b3||0xc8;return function(_0x102323){if(_0x102323){return _0x169cd0['status'](_0x4207b3)['json'](_0x102323);}};}function respondWithFilteredResult(_0x28e10a,_0x1c4eea){return function(_0x284af1){if(_0x284af1){var _0x2a54ad=typeof _0x1c4eea[_0x2b1b('0x1f')]===_0x2b1b('0x20')&&typeof _0x1c4eea['limit']==='undefined';var _0x383f78=_0x284af1['count'];var _0x3a79b7=_0x2a54ad?0x0:_0x1c4eea[_0x2b1b('0x1f')];var _0x1d0407=_0x2a54ad?_0x284af1['count']:_0x1c4eea[_0x2b1b('0x1f')]+_0x1c4eea[_0x2b1b('0x21')];var _0x594569;if(_0x1d0407>=_0x383f78){_0x1d0407=_0x383f78;_0x594569=0xc8;}else{_0x594569=0xce;}_0x28e10a[_0x2b1b('0x1e')](_0x594569);return _0x28e10a[_0x2b1b('0x22')]('Content-Range',_0x3a79b7+'-'+_0x1d0407+'/'+_0x383f78)[_0x2b1b('0x23')](_0x284af1);}return null;};}function patchUpdates(_0x2de150){return function(_0x18283b){try{jsonpatch['apply'](_0x18283b,_0x2de150,!![]);}catch(_0xe09a8){return BPromise[_0x2b1b('0x24')](_0xe09a8);}return _0x18283b[_0x2b1b('0x25')]();};}function saveUpdates(_0x46c2c7,_0x5a969f){return function(_0x4f1ca3){if(_0x4f1ca3){return _0x4f1ca3[_0x2b1b('0x26')](_0x46c2c7)['then'](function(_0x49b96e){return _0x49b96e;});}return null;};}function removeEntity(_0x521d5e,_0x5963ab){return function(_0x3bc940){if(_0x3bc940){return _0x3bc940[_0x2b1b('0x27')]()[_0x2b1b('0x28')](function(){var _0x5082c3=_0x3bc940[_0x2b1b('0x29')]({'plain':!![]});var _0x447f53=_0x2b1b('0x2a');return db[_0x2b1b('0x2b')][_0x2b1b('0x27')]({'where':{'type':_0x447f53,'resourceId':_0x5082c3['id']}})[_0x2b1b('0x28')](function(){return _0x3bc940;});})[_0x2b1b('0x28')](function(){_0x521d5e[_0x2b1b('0x1e')](0xcc)[_0x2b1b('0x2c')]();});}};}function handleEntityNotFound(_0x1ccd00,_0x11e751){return function(_0x5b2b06){if(!_0x5b2b06){_0x1ccd00[_0x2b1b('0x1d')](0x194);}return _0x5b2b06;};}function handleError(_0x561f19,_0x24bbb5){_0x24bbb5=_0x24bbb5||0x1f4;return function(_0x4c1ad9){logger[_0x2b1b('0x2d')](_0x4c1ad9[_0x2b1b('0x2e')]);if(_0x4c1ad9[_0x2b1b('0x2f')]){delete _0x4c1ad9[_0x2b1b('0x2f')];}_0x561f19[_0x2b1b('0x1e')](_0x24bbb5)[_0x2b1b('0x30')](_0x4c1ad9);};}exports[_0x2b1b('0x31')]=function(_0x314b83,_0x371f93){var _0x2d5708={},_0x4d3fb2={},_0x3ab554={'count':0x0,'rows':[]};var _0x51721b=_[_0x2b1b('0x32')](db[_0x2b1b('0x33')][_0x2b1b('0x34')],function(_0x206fa9){return{'name':_0x206fa9[_0x2b1b('0x35')],'type':_0x206fa9['type']['key']};});_0x4d3fb2[_0x2b1b('0x36')]=_[_0x2b1b('0x32')](_0x51721b,_0x2b1b('0x2f'));_0x4d3fb2[_0x2b1b('0x37')]=_[_0x2b1b('0x38')](_0x314b83[_0x2b1b('0x37')]);_0x4d3fb2[_0x2b1b('0x39')]=_[_0x2b1b('0x3a')](_0x4d3fb2[_0x2b1b('0x36')],_0x4d3fb2['query']);_0x2d5708[_0x2b1b('0x3b')]=_[_0x2b1b('0x3a')](_0x4d3fb2[_0x2b1b('0x36')],qs[_0x2b1b('0x3c')](_0x314b83[_0x2b1b('0x37')][_0x2b1b('0x3c')]));_0x2d5708[_0x2b1b('0x3b')]=_0x2d5708[_0x2b1b('0x3b')][_0x2b1b('0x3d')]?_0x2d5708['attributes']:_0x4d3fb2['model'];if(!_0x314b83['query'][_0x2b1b('0x3e')]('nolimit')){_0x2d5708[_0x2b1b('0x21')]=qs[_0x2b1b('0x21')](_0x314b83['query'][_0x2b1b('0x21')]);_0x2d5708[_0x2b1b('0x1f')]=qs[_0x2b1b('0x1f')](_0x314b83[_0x2b1b('0x37')]['offset']);}_0x2d5708[_0x2b1b('0x3f')]=qs['sort'](_0x314b83['query'][_0x2b1b('0x40')]);_0x2d5708[_0x2b1b('0x41')]=qs[_0x2b1b('0x39')](_[_0x2b1b('0x42')](_0x314b83[_0x2b1b('0x37')],_0x4d3fb2[_0x2b1b('0x39')]),_0x51721b);if(_0x314b83[_0x2b1b('0x37')][_0x2b1b('0x43')]){_0x2d5708[_0x2b1b('0x41')]=_[_0x2b1b('0x44')](_0x2d5708['where'],{'$or':_[_0x2b1b('0x32')](_0x51721b,function(_0x1b7196){if(_0x1b7196[_0x2b1b('0x45')]!==_0x2b1b('0x46')){var _0x3286f7={};_0x3286f7[_0x1b7196['name']]={'$like':'%'+_0x314b83[_0x2b1b('0x37')][_0x2b1b('0x43')]+'%'};return _0x3286f7;}})});}_0x2d5708=_[_0x2b1b('0x44')]({},_0x2d5708,_0x314b83[_0x2b1b('0x47')]);var _0x33c2a1={'where':_0x2d5708[_0x2b1b('0x41')]};return db[_0x2b1b('0x33')][_0x2b1b('0x48')](_0x33c2a1)[_0x2b1b('0x28')](function(_0x4eae3a){_0x3ab554[_0x2b1b('0x48')]=_0x4eae3a;if(_0x314b83[_0x2b1b('0x37')]['includeAll']){_0x2d5708['include']=[{'all':!![]}];}return db[_0x2b1b('0x33')][_0x2b1b('0x49')](_0x2d5708);})[_0x2b1b('0x28')](function(_0x5e021f){_0x3ab554[_0x2b1b('0x4a')]=_0x5e021f;return _0x3ab554;})[_0x2b1b('0x28')](respondWithFilteredResult(_0x371f93,_0x2d5708))['catch'](handleError(_0x371f93,null));};exports[_0x2b1b('0x4b')]=function(_0x340035,_0x3b07a6){var _0x3ebb92={'raw':![],'where':{'id':_0x340035[_0x2b1b('0x4c')]['id']}},_0x459a96={};_0x459a96['model']=_[_0x2b1b('0x38')](db[_0x2b1b('0x33')][_0x2b1b('0x34')]);_0x459a96[_0x2b1b('0x37')]=_[_0x2b1b('0x38')](_0x340035['query']);_0x459a96[_0x2b1b('0x39')]=_[_0x2b1b('0x3a')](_0x459a96['model'],_0x459a96['query']);_0x3ebb92['attributes']=_[_0x2b1b('0x3a')](_0x459a96[_0x2b1b('0x36')],qs[_0x2b1b('0x3c')](_0x340035['query'][_0x2b1b('0x3c')]));_0x3ebb92['attributes']=_0x3ebb92['attributes'][_0x2b1b('0x3d')]?_0x3ebb92[_0x2b1b('0x3b')]:_0x459a96[_0x2b1b('0x36')];if(_0x340035[_0x2b1b('0x37')]['includeAll']){_0x3ebb92['include']=[{'all':!![]}];}_0x3ebb92=_[_0x2b1b('0x44')]({},_0x3ebb92,_0x340035[_0x2b1b('0x47')]);return db['Trigger'][_0x2b1b('0x4d')](_0x3ebb92)[_0x2b1b('0x28')](handleEntityNotFound(_0x3b07a6,null))['then'](respondWithResult(_0x3b07a6,null))[_0x2b1b('0x4e')](handleError(_0x3b07a6,null));};exports[_0x2b1b('0x4f')]=function(_0x1fe7ea,_0xf13412){return db[_0x2b1b('0x33')][_0x2b1b('0x4f')](_0x1fe7ea['body'],{})[_0x2b1b('0x28')](function(_0x1a9da7){var _0x14c22c=_0x1fe7ea[_0x2b1b('0x50')][_0x2b1b('0x29')]({'plain':!![]});if(!_0x14c22c)throw new Error(_0x2b1b('0x51'));if(_0x14c22c[_0x2b1b('0x52')]===_0x2b1b('0x50')){var _0x130bf2=_0x1a9da7[_0x2b1b('0x29')]({'plain':!![]});var _0x4b7d32=_0x2b1b('0x2a');return db[_0x2b1b('0x53')]['find']({'where':{'name':_0x4b7d32,'userProfileId':_0x14c22c['userProfileId']},'raw':!![]})[_0x2b1b('0x28')](function(_0xf94729){if(_0xf94729&&_0xf94729[_0x2b1b('0x54')]===0x0){return db[_0x2b1b('0x2b')]['create']({'name':_0x130bf2[_0x2b1b('0x2f')],'resourceId':_0x130bf2['id'],'type':_0xf94729[_0x2b1b('0x2f')],'sectionId':_0xf94729['id']},{})['then'](function(){return _0x1a9da7;});}else{return _0x1a9da7;}})[_0x2b1b('0x4e')](function(_0x4beea0){logger[_0x2b1b('0x2d')](_0x2b1b('0x55'),_0x4beea0);throw _0x4beea0;});}return _0x1a9da7;})[_0x2b1b('0x28')](respondWithResult(_0xf13412,0xc9))['catch'](handleError(_0xf13412,null));};exports[_0x2b1b('0x26')]=function(_0x13a4c2,_0x2e9f2d){if(_0x13a4c2['body']['id']){delete _0x13a4c2['body']['id'];}return db[_0x2b1b('0x33')][_0x2b1b('0x4d')]({'where':{'id':_0x13a4c2[_0x2b1b('0x4c')]['id']}})[_0x2b1b('0x28')](handleEntityNotFound(_0x2e9f2d,null))[_0x2b1b('0x28')](saveUpdates(_0x13a4c2[_0x2b1b('0x56')],null))[_0x2b1b('0x28')](respondWithResult(_0x2e9f2d,null))['catch'](handleError(_0x2e9f2d,null));};exports['destroy']=function(_0x31612b,_0x406665){return db['Trigger'][_0x2b1b('0x4d')]({'where':{'id':_0x31612b['params']['id']}})[_0x2b1b('0x28')](handleEntityNotFound(_0x406665,null))['then'](removeEntity(_0x406665,null))[_0x2b1b('0x4e')](handleError(_0x406665,null));};exports[_0x2b1b('0x57')]=function(_0x7efeea,_0x4f938f,_0x507cfb){if(_0x7efeea[_0x2b1b('0x56')]['id']){delete _0x7efeea[_0x2b1b('0x56')]['id'];}return db[_0x2b1b('0x33')][_0x2b1b('0x4d')]({'where':{'id':_0x7efeea[_0x2b1b('0x4c')]['id']}})[_0x2b1b('0x28')](handleEntityNotFound(_0x4f938f,null))[_0x2b1b('0x28')](function(_0x582871){if(_0x582871){_0x7efeea[_0x2b1b('0x56')][_0x2b1b('0x58')]=_0x582871['id'];return db[_0x2b1b('0x59')][_0x2b1b('0x4f')](_0x7efeea[_0x2b1b('0x56')]);}})[_0x2b1b('0x28')](respondWithResult(_0x4f938f,null))[_0x2b1b('0x4e')](handleError(_0x4f938f,null));};exports['addAnyCondition']=function(_0x3489d1,_0x481174,_0x12cd8f){if(_0x3489d1[_0x2b1b('0x56')]['id']){delete _0x3489d1[_0x2b1b('0x56')]['id'];}return db['Trigger'][_0x2b1b('0x4d')]({'where':{'id':_0x3489d1[_0x2b1b('0x4c')]['id']}})[_0x2b1b('0x28')](handleEntityNotFound(_0x481174,null))[_0x2b1b('0x28')](function(_0x5d0020){if(_0x5d0020){_0x3489d1[_0x2b1b('0x56')][_0x2b1b('0x5a')]=_0x5d0020['id'];return db[_0x2b1b('0x59')][_0x2b1b('0x4f')](_0x3489d1[_0x2b1b('0x56')]);}})[_0x2b1b('0x28')](respondWithResult(_0x481174,null))[_0x2b1b('0x4e')](handleError(_0x481174,null));};exports['getAllConditions']=function(_0x3c8bbe,_0x189c75,_0x4d796c){var _0x17126a={};var _0x31a4f4={};var _0x4a36e0;var _0x3ed68d;return db['Trigger'][_0x2b1b('0x5b')]({'where':{'id':_0x3c8bbe['params']['id']}})['then'](handleEntityNotFound(_0x189c75,null))[_0x2b1b('0x28')](function(_0x25fc13){if(_0x25fc13){_0x4a36e0=_0x25fc13;_0x31a4f4['model']=_[_0x2b1b('0x38')](db[_0x2b1b('0x59')][_0x2b1b('0x34')]);_0x31a4f4[_0x2b1b('0x37')]=_['keys'](_0x3c8bbe[_0x2b1b('0x37')]);_0x31a4f4['filters']=_['intersection'](_0x31a4f4['model'],_0x31a4f4[_0x2b1b('0x37')]);_0x17126a['attributes']=_[_0x2b1b('0x3a')](_0x31a4f4[_0x2b1b('0x36')],qs[_0x2b1b('0x3c')](_0x3c8bbe[_0x2b1b('0x37')][_0x2b1b('0x3c')]));_0x17126a['attributes']=_0x17126a[_0x2b1b('0x3b')][_0x2b1b('0x3d')]?_0x17126a[_0x2b1b('0x3b')]:_0x31a4f4[_0x2b1b('0x36')];_0x17126a['order']=qs[_0x2b1b('0x40')](_0x3c8bbe['query']['sort']);_0x17126a[_0x2b1b('0x41')]=qs['filters'](_[_0x2b1b('0x42')](_0x3c8bbe[_0x2b1b('0x37')],_0x31a4f4[_0x2b1b('0x39')]));if(_0x3c8bbe[_0x2b1b('0x37')]['filter']){_0x17126a[_0x2b1b('0x41')]=_[_0x2b1b('0x44')](_0x17126a[_0x2b1b('0x41')],{'$or':_[_0x2b1b('0x32')](_0x17126a[_0x2b1b('0x3b')],function(_0x3e93e6){var _0x1c6a0b={};_0x1c6a0b[_0x3e93e6]={'$like':'%'+_0x3c8bbe['query']['filter']+'%'};return _0x1c6a0b;})});}_0x17126a=_[_0x2b1b('0x44')]({},_0x17126a,_0x3c8bbe[_0x2b1b('0x47')]);return _0x4a36e0[_0x2b1b('0x5c')](_0x17126a);}})['then'](function(_0x1f8d15){if(_0x1f8d15){_0x3ed68d=_0x1f8d15['length'];if(!_0x3c8bbe[_0x2b1b('0x37')]['hasOwnProperty'](_0x2b1b('0x5d'))){_0x17126a[_0x2b1b('0x21')]=qs[_0x2b1b('0x21')](_0x3c8bbe['query'][_0x2b1b('0x21')]);_0x17126a[_0x2b1b('0x1f')]=qs[_0x2b1b('0x1f')](_0x3c8bbe[_0x2b1b('0x37')][_0x2b1b('0x1f')]);}return _0x4a36e0[_0x2b1b('0x5c')](_0x17126a);}})['then'](function(_0x29f7bc){if(_0x29f7bc){return _0x29f7bc?{'count':_0x3ed68d,'rows':_0x29f7bc}:null;}})[_0x2b1b('0x28')](respondWithResult(_0x189c75,null))['catch'](handleError(_0x189c75,null));};exports[_0x2b1b('0x5e')]=function(_0x32de37,_0x4404b0,_0x4e349f){var _0x213ebc={};var _0x3555d6={};var _0x5bb4af;var _0x1f74cf;return db['Trigger'][_0x2b1b('0x5b')]({'where':{'id':_0x32de37[_0x2b1b('0x4c')]['id']}})[_0x2b1b('0x28')](handleEntityNotFound(_0x4404b0,null))['then'](function(_0xfe3d60){if(_0xfe3d60){_0x5bb4af=_0xfe3d60;_0x3555d6[_0x2b1b('0x36')]=_['keys'](db[_0x2b1b('0x59')][_0x2b1b('0x34')]);_0x3555d6[_0x2b1b('0x37')]=_[_0x2b1b('0x38')](_0x32de37[_0x2b1b('0x37')]);_0x3555d6[_0x2b1b('0x39')]=_[_0x2b1b('0x3a')](_0x3555d6[_0x2b1b('0x36')],_0x3555d6['query']);_0x213ebc[_0x2b1b('0x3b')]=_[_0x2b1b('0x3a')](_0x3555d6['model'],qs[_0x2b1b('0x3c')](_0x32de37['query']['fields']));_0x213ebc[_0x2b1b('0x3b')]=_0x213ebc[_0x2b1b('0x3b')][_0x2b1b('0x3d')]?_0x213ebc[_0x2b1b('0x3b')]:_0x3555d6[_0x2b1b('0x36')];_0x213ebc[_0x2b1b('0x3f')]=qs[_0x2b1b('0x40')](_0x32de37[_0x2b1b('0x37')][_0x2b1b('0x40')]);_0x213ebc[_0x2b1b('0x41')]=qs[_0x2b1b('0x39')](_[_0x2b1b('0x42')](_0x32de37[_0x2b1b('0x37')],_0x3555d6[_0x2b1b('0x39')]));if(_0x32de37[_0x2b1b('0x37')]['filter']){_0x213ebc[_0x2b1b('0x41')]=_[_0x2b1b('0x44')](_0x213ebc[_0x2b1b('0x41')],{'$or':_[_0x2b1b('0x32')](_0x213ebc['attributes'],function(_0x330a93){var _0x5017c1={};_0x5017c1[_0x330a93]={'$like':'%'+_0x32de37['query']['filter']+'%'};return _0x5017c1;})});}_0x213ebc=_[_0x2b1b('0x44')]({},_0x213ebc,_0x32de37[_0x2b1b('0x47')]);return _0x5bb4af[_0x2b1b('0x5e')](_0x213ebc);}})[_0x2b1b('0x28')](function(_0x676a84){if(_0x676a84){_0x1f74cf=_0x676a84['length'];if(!_0x32de37['query']['hasOwnProperty'](_0x2b1b('0x5d'))){_0x213ebc[_0x2b1b('0x21')]=qs[_0x2b1b('0x21')](_0x32de37['query'][_0x2b1b('0x21')]);_0x213ebc[_0x2b1b('0x1f')]=qs[_0x2b1b('0x1f')](_0x32de37[_0x2b1b('0x37')]['offset']);}return _0x5bb4af[_0x2b1b('0x5e')](_0x213ebc);}})[_0x2b1b('0x28')](function(_0xb06ac5){if(_0xb06ac5){return _0xb06ac5?{'count':_0x1f74cf,'rows':_0xb06ac5}:null;}})[_0x2b1b('0x28')](respondWithResult(_0x4404b0,null))[_0x2b1b('0x4e')](handleError(_0x4404b0,null));};exports['addAction']=function(_0x8ff412,_0x56edbc,_0x7ad853){if(_0x8ff412[_0x2b1b('0x56')]['id']){delete _0x8ff412[_0x2b1b('0x56')]['id'];}return db[_0x2b1b('0x33')]['find']({'where':{'id':_0x8ff412[_0x2b1b('0x4c')]['id']}})[_0x2b1b('0x28')](handleEntityNotFound(_0x56edbc,null))['then'](function(_0x1b1153){if(_0x1b1153){_0x8ff412[_0x2b1b('0x56')][_0x2b1b('0x5f')]=_0x1b1153['id'];return db[_0x2b1b('0x60')]['create'](_0x8ff412['body']);}})['then'](respondWithResult(_0x56edbc,null))[_0x2b1b('0x4e')](handleError(_0x56edbc,null));};exports[_0x2b1b('0x61')]=function(_0x56ad9e,_0x2242d0,_0x4aefb1){var _0x4d3ab8={};var _0x565930={};var _0x2193f0;var _0x4de503;return db['Trigger'][_0x2b1b('0x5b')]({'where':{'id':_0x56ad9e[_0x2b1b('0x4c')]['id']}})[_0x2b1b('0x28')](handleEntityNotFound(_0x2242d0,null))[_0x2b1b('0x28')](function(_0x2777ed){if(_0x2777ed){_0x2193f0=_0x2777ed;_0x565930[_0x2b1b('0x36')]=_[_0x2b1b('0x38')](db[_0x2b1b('0x60')][_0x2b1b('0x34')]);_0x565930['query']=_[_0x2b1b('0x38')](_0x56ad9e[_0x2b1b('0x37')]);_0x565930['filters']=_[_0x2b1b('0x3a')](_0x565930['model'],_0x565930['query']);_0x4d3ab8[_0x2b1b('0x3b')]=_[_0x2b1b('0x3a')](_0x565930[_0x2b1b('0x36')],qs[_0x2b1b('0x3c')](_0x56ad9e['query'][_0x2b1b('0x3c')]));_0x4d3ab8[_0x2b1b('0x3b')]=_0x4d3ab8[_0x2b1b('0x3b')][_0x2b1b('0x3d')]?_0x4d3ab8[_0x2b1b('0x3b')]:_0x565930[_0x2b1b('0x36')];_0x4d3ab8[_0x2b1b('0x3f')]=qs[_0x2b1b('0x40')](_0x56ad9e[_0x2b1b('0x37')][_0x2b1b('0x40')]);_0x4d3ab8[_0x2b1b('0x41')]=qs[_0x2b1b('0x39')](_[_0x2b1b('0x42')](_0x56ad9e[_0x2b1b('0x37')],_0x565930['filters']));if(_0x56ad9e['query'][_0x2b1b('0x43')]){_0x4d3ab8[_0x2b1b('0x41')]=_[_0x2b1b('0x44')](_0x4d3ab8[_0x2b1b('0x41')],{'$or':_[_0x2b1b('0x32')](_0x4d3ab8[_0x2b1b('0x3b')],function(_0x16269d){var _0x33c7d0={};_0x33c7d0[_0x16269d]={'$like':'%'+_0x56ad9e[_0x2b1b('0x37')]['filter']+'%'};return _0x33c7d0;})});}_0x4d3ab8=_['merge']({},_0x4d3ab8,_0x56ad9e[_0x2b1b('0x47')]);return _0x2193f0[_0x2b1b('0x61')](_0x4d3ab8);}})['then'](function(_0x1d2a81){if(_0x1d2a81){_0x4de503=_0x1d2a81[_0x2b1b('0x3d')];if(!_0x56ad9e[_0x2b1b('0x37')][_0x2b1b('0x3e')](_0x2b1b('0x5d'))){_0x4d3ab8[_0x2b1b('0x21')]=qs['limit'](_0x56ad9e[_0x2b1b('0x37')][_0x2b1b('0x21')]);_0x4d3ab8['offset']=qs[_0x2b1b('0x1f')](_0x56ad9e[_0x2b1b('0x37')][_0x2b1b('0x1f')]);}return _0x2193f0[_0x2b1b('0x61')](_0x4d3ab8);}})['then'](function(_0x216dd5){if(_0x216dd5){return _0x216dd5?{'count':_0x4de503,'rows':_0x216dd5}:null;}})[_0x2b1b('0x28')](respondWithResult(_0x2242d0,null))[_0x2b1b('0x4e')](handleError(_0x2242d0,null));}; \ No newline at end of file +var _0x9df7=['TriggerAnyId','length','getAnyConditions','addAction','TriggerId','Action','getActions','findOne','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','Triggers','UserProfileResource','error','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','params','TriggerAllId','Condition'];(function(_0x4e9fda,_0x1cca06){var _0x89454d=function(_0x2e2648){while(--_0x2e2648){_0x4e9fda['push'](_0x4e9fda['shift']());}};_0x89454d(++_0x1cca06);}(_0x9df7,0x1bb));var _0x79df=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x9df7[_0x1ee62e];return _0x27c6c8;};'use strict';var emlformat=require(_0x79df('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x79df('0x1'));var rp=require('request-promise');var moment=require(_0x79df('0x2'));var BPromise=require(_0x79df('0x3'));var Mustache=require(_0x79df('0x4'));var util=require(_0x79df('0x5'));var path=require(_0x79df('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x79df('0x7'));var crypto=require('crypto');var jsforce=require(_0x79df('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x79df('0x9'));var querystring=require(_0x79df('0xa'));var Papa=require(_0x79df('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x79df('0xc'));var as=require(_0x79df('0xd'));var hardwareService=require(_0x79df('0xe'));var logger=require(_0x79df('0xf'))(_0x79df('0x10'));var utils=require(_0x79df('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x79df('0x12'));var db=require(_0x79df('0x13'))['db'];function respondWithStatusCode(_0x427c71,_0x2ce3e4){_0x2ce3e4=_0x2ce3e4||0xcc;return function(_0x4bf807){if(_0x4bf807){return _0x427c71[_0x79df('0x14')](_0x2ce3e4);}return _0x427c71[_0x79df('0x15')](_0x2ce3e4)[_0x79df('0x16')]();};}function respondWithResult(_0x1ba557,_0x3e2489){_0x3e2489=_0x3e2489||0xc8;return function(_0x14b0ba){if(_0x14b0ba){return _0x1ba557[_0x79df('0x15')](_0x3e2489)[_0x79df('0x17')](_0x14b0ba);}};}function respondWithFilteredResult(_0x1cdd7e,_0x5b879b){return function(_0x40d2a9){if(_0x40d2a9){var _0x58353d=typeof _0x5b879b[_0x79df('0x18')]===_0x79df('0x19')&&typeof _0x5b879b[_0x79df('0x1a')]===_0x79df('0x19');var _0x5c94ff=_0x40d2a9['count'];var _0x2e15fa=_0x58353d?0x0:_0x5b879b[_0x79df('0x18')];var _0x412a06=_0x58353d?_0x40d2a9[_0x79df('0x1b')]:_0x5b879b['offset']+_0x5b879b['limit'];var _0x1284af;if(_0x412a06>=_0x5c94ff){_0x412a06=_0x5c94ff;_0x1284af=0xc8;}else{_0x1284af=0xce;}_0x1cdd7e[_0x79df('0x15')](_0x1284af);return _0x1cdd7e[_0x79df('0x1c')]('Content-Range',_0x2e15fa+'-'+_0x412a06+'/'+_0x5c94ff)[_0x79df('0x17')](_0x40d2a9);}return null;};}function patchUpdates(_0x48e736){return function(_0x42ad13){try{jsonpatch[_0x79df('0x1d')](_0x42ad13,_0x48e736,!![]);}catch(_0x5f3a07){return BPromise[_0x79df('0x1e')](_0x5f3a07);}return _0x42ad13[_0x79df('0x1f')]();};}function saveUpdates(_0x51f91f,_0x404b1a){return function(_0x498869){if(_0x498869){return _0x498869[_0x79df('0x20')](_0x51f91f)['then'](function(_0x2c6f32){return _0x2c6f32;});}return null;};}function removeEntity(_0x3aa7fd,_0x19c719){return function(_0x4acaf6){if(_0x4acaf6){return _0x4acaf6['destroy']()[_0x79df('0x21')](function(){var _0x4fce6a=_0x4acaf6['get']({'plain':!![]});var _0x2d870d=_0x79df('0x22');return db[_0x79df('0x23')]['destroy']({'where':{'type':_0x2d870d,'resourceId':_0x4fce6a['id']}})[_0x79df('0x21')](function(){return _0x4acaf6;});})[_0x79df('0x21')](function(){_0x3aa7fd['status'](0xcc)[_0x79df('0x16')]();});}};}function handleEntityNotFound(_0x50c7c8,_0x1e005a){return function(_0x46ffd6){if(!_0x46ffd6){_0x50c7c8['sendStatus'](0x194);}return _0x46ffd6;};}function handleError(_0xf995f7,_0x438332){_0x438332=_0x438332||0x1f4;return function(_0x2dc812){logger[_0x79df('0x24')](_0x2dc812['stack']);if(_0x2dc812[_0x79df('0x25')]){delete _0x2dc812['name'];}_0xf995f7[_0x79df('0x15')](_0x438332)[_0x79df('0x26')](_0x2dc812);};}exports[_0x79df('0x27')]=function(_0x70e839,_0x2858f6){var _0x343cd3={},_0x305f79={},_0x216a21={'count':0x0,'rows':[]};var _0x223058=_[_0x79df('0x28')](db[_0x79df('0x29')][_0x79df('0x2a')],function(_0x5b1478){return{'name':_0x5b1478[_0x79df('0x2b')],'type':_0x5b1478[_0x79df('0x2c')][_0x79df('0x2d')]};});_0x305f79[_0x79df('0x2e')]=_[_0x79df('0x28')](_0x223058,_0x79df('0x25'));_0x305f79[_0x79df('0x2f')]=_[_0x79df('0x30')](_0x70e839[_0x79df('0x2f')]);_0x305f79[_0x79df('0x31')]=_[_0x79df('0x32')](_0x305f79[_0x79df('0x2e')],_0x305f79[_0x79df('0x2f')]);_0x343cd3[_0x79df('0x33')]=_[_0x79df('0x32')](_0x305f79[_0x79df('0x2e')],qs[_0x79df('0x34')](_0x70e839[_0x79df('0x2f')][_0x79df('0x34')]));_0x343cd3['attributes']=_0x343cd3['attributes']['length']?_0x343cd3['attributes']:_0x305f79[_0x79df('0x2e')];if(!_0x70e839[_0x79df('0x2f')][_0x79df('0x35')](_0x79df('0x36'))){_0x343cd3[_0x79df('0x1a')]=qs[_0x79df('0x1a')](_0x70e839[_0x79df('0x2f')][_0x79df('0x1a')]);_0x343cd3['offset']=qs[_0x79df('0x18')](_0x70e839['query']['offset']);}_0x343cd3[_0x79df('0x37')]=qs[_0x79df('0x38')](_0x70e839[_0x79df('0x2f')]['sort']);_0x343cd3[_0x79df('0x39')]=qs[_0x79df('0x31')](_[_0x79df('0x3a')](_0x70e839[_0x79df('0x2f')],_0x305f79[_0x79df('0x31')]),_0x223058);if(_0x70e839['query'][_0x79df('0x3b')]){_0x343cd3[_0x79df('0x39')]=_[_0x79df('0x3c')](_0x343cd3[_0x79df('0x39')],{'$or':_['map'](_0x223058,function(_0x10669b){if(_0x10669b[_0x79df('0x2c')]!==_0x79df('0x3d')){var _0x55acc4={};_0x55acc4[_0x10669b[_0x79df('0x25')]]={'$like':'%'+_0x70e839[_0x79df('0x2f')][_0x79df('0x3b')]+'%'};return _0x55acc4;}})});}_0x343cd3=_[_0x79df('0x3c')]({},_0x343cd3,_0x70e839[_0x79df('0x3e')]);var _0x497a3c={'where':_0x343cd3['where']};return db['Trigger'][_0x79df('0x1b')](_0x497a3c)['then'](function(_0x1e4e87){_0x216a21[_0x79df('0x1b')]=_0x1e4e87;if(_0x70e839['query'][_0x79df('0x3f')]){_0x343cd3[_0x79df('0x40')]=[{'all':!![]}];}return db['Trigger'][_0x79df('0x41')](_0x343cd3);})['then'](function(_0xeb11d3){_0x216a21[_0x79df('0x42')]=_0xeb11d3;return _0x216a21;})[_0x79df('0x21')](respondWithFilteredResult(_0x2858f6,_0x343cd3))[_0x79df('0x43')](handleError(_0x2858f6,null));};exports['show']=function(_0x5536f5,_0x329e04){var _0x486ec0={'raw':![],'where':{'id':_0x5536f5['params']['id']}},_0x1dc8cd={};_0x1dc8cd[_0x79df('0x2e')]=_[_0x79df('0x30')](db[_0x79df('0x29')]['rawAttributes']);_0x1dc8cd[_0x79df('0x2f')]=_['keys'](_0x5536f5[_0x79df('0x2f')]);_0x1dc8cd['filters']=_['intersection'](_0x1dc8cd[_0x79df('0x2e')],_0x1dc8cd['query']);_0x486ec0[_0x79df('0x33')]=_[_0x79df('0x32')](_0x1dc8cd[_0x79df('0x2e')],qs[_0x79df('0x34')](_0x5536f5[_0x79df('0x2f')][_0x79df('0x34')]));_0x486ec0[_0x79df('0x33')]=_0x486ec0[_0x79df('0x33')]['length']?_0x486ec0[_0x79df('0x33')]:_0x1dc8cd[_0x79df('0x2e')];if(_0x5536f5[_0x79df('0x2f')]['includeAll']){_0x486ec0['include']=[{'all':!![]}];}_0x486ec0=_[_0x79df('0x3c')]({},_0x486ec0,_0x5536f5['options']);return db[_0x79df('0x29')]['find'](_0x486ec0)[_0x79df('0x21')](handleEntityNotFound(_0x329e04,null))[_0x79df('0x21')](respondWithResult(_0x329e04,null))[_0x79df('0x43')](handleError(_0x329e04,null));};exports[_0x79df('0x44')]=function(_0x3bd82e,_0x18b314){return db[_0x79df('0x29')]['create'](_0x3bd82e[_0x79df('0x45')],{})[_0x79df('0x21')](function(_0x501cf7){var _0x4d8c83=_0x3bd82e[_0x79df('0x46')]['get']({'plain':!![]});if(!_0x4d8c83)throw new Error(_0x79df('0x47'));if(_0x4d8c83['role']===_0x79df('0x46')){var _0x491105=_0x501cf7[_0x79df('0x48')]({'plain':!![]});var _0x40f029=_0x79df('0x22');return db[_0x79df('0x49')][_0x79df('0x4a')]({'where':{'name':_0x40f029,'userProfileId':_0x4d8c83['userProfileId']},'raw':!![]})[_0x79df('0x21')](function(_0x5ebebe){if(_0x5ebebe&&_0x5ebebe[_0x79df('0x4b')]===0x0){return db[_0x79df('0x23')][_0x79df('0x44')]({'name':_0x491105['name'],'resourceId':_0x491105['id'],'type':_0x5ebebe[_0x79df('0x25')],'sectionId':_0x5ebebe['id']},{})[_0x79df('0x21')](function(){return _0x501cf7;});}else{return _0x501cf7;}})[_0x79df('0x43')](function(_0x36e04e){logger[_0x79df('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36e04e);throw _0x36e04e;});}return _0x501cf7;})[_0x79df('0x21')](respondWithResult(_0x18b314,0xc9))['catch'](handleError(_0x18b314,null));};exports[_0x79df('0x20')]=function(_0x55bd95,_0x5ad2e3){if(_0x55bd95[_0x79df('0x45')]['id']){delete _0x55bd95['body']['id'];}return db[_0x79df('0x29')][_0x79df('0x4a')]({'where':{'id':_0x55bd95[_0x79df('0x4c')]['id']}})[_0x79df('0x21')](handleEntityNotFound(_0x5ad2e3,null))[_0x79df('0x21')](saveUpdates(_0x55bd95[_0x79df('0x45')],null))[_0x79df('0x21')](respondWithResult(_0x5ad2e3,null))['catch'](handleError(_0x5ad2e3,null));};exports['destroy']=function(_0x2edb74,_0x2fa621){return db[_0x79df('0x29')][_0x79df('0x4a')]({'where':{'id':_0x2edb74['params']['id']}})[_0x79df('0x21')](handleEntityNotFound(_0x2fa621,null))[_0x79df('0x21')](removeEntity(_0x2fa621,null))[_0x79df('0x43')](handleError(_0x2fa621,null));};exports['addAllCondition']=function(_0x5a4ef9,_0x2e1b44,_0x2b9903){if(_0x5a4ef9[_0x79df('0x45')]['id']){delete _0x5a4ef9[_0x79df('0x45')]['id'];}return db[_0x79df('0x29')]['find']({'where':{'id':_0x5a4ef9[_0x79df('0x4c')]['id']}})[_0x79df('0x21')](handleEntityNotFound(_0x2e1b44,null))['then'](function(_0x2d2eea){if(_0x2d2eea){_0x5a4ef9[_0x79df('0x45')][_0x79df('0x4d')]=_0x2d2eea['id'];return db[_0x79df('0x4e')]['create'](_0x5a4ef9['body']);}})[_0x79df('0x21')](respondWithResult(_0x2e1b44,null))[_0x79df('0x43')](handleError(_0x2e1b44,null));};exports['addAnyCondition']=function(_0x58ae88,_0x33000e,_0x15fbe1){if(_0x58ae88['body']['id']){delete _0x58ae88[_0x79df('0x45')]['id'];}return db[_0x79df('0x29')][_0x79df('0x4a')]({'where':{'id':_0x58ae88[_0x79df('0x4c')]['id']}})[_0x79df('0x21')](handleEntityNotFound(_0x33000e,null))[_0x79df('0x21')](function(_0x16588f){if(_0x16588f){_0x58ae88['body'][_0x79df('0x4f')]=_0x16588f['id'];return db['Condition'][_0x79df('0x44')](_0x58ae88[_0x79df('0x45')]);}})[_0x79df('0x21')](respondWithResult(_0x33000e,null))[_0x79df('0x43')](handleError(_0x33000e,null));};exports['getAllConditions']=function(_0x5ab81a,_0x364295,_0x171d2a){var _0x11d1cd={};var _0x5018a3={};var _0x4da591;var _0x164594;return db[_0x79df('0x29')]['findOne']({'where':{'id':_0x5ab81a[_0x79df('0x4c')]['id']}})['then'](handleEntityNotFound(_0x364295,null))[_0x79df('0x21')](function(_0x509410){if(_0x509410){_0x4da591=_0x509410;_0x5018a3[_0x79df('0x2e')]=_[_0x79df('0x30')](db['Condition'][_0x79df('0x2a')]);_0x5018a3[_0x79df('0x2f')]=_['keys'](_0x5ab81a[_0x79df('0x2f')]);_0x5018a3[_0x79df('0x31')]=_[_0x79df('0x32')](_0x5018a3[_0x79df('0x2e')],_0x5018a3[_0x79df('0x2f')]);_0x11d1cd[_0x79df('0x33')]=_['intersection'](_0x5018a3[_0x79df('0x2e')],qs[_0x79df('0x34')](_0x5ab81a[_0x79df('0x2f')][_0x79df('0x34')]));_0x11d1cd['attributes']=_0x11d1cd[_0x79df('0x33')]['length']?_0x11d1cd[_0x79df('0x33')]:_0x5018a3[_0x79df('0x2e')];_0x11d1cd[_0x79df('0x37')]=qs['sort'](_0x5ab81a[_0x79df('0x2f')][_0x79df('0x38')]);_0x11d1cd[_0x79df('0x39')]=qs[_0x79df('0x31')](_['pick'](_0x5ab81a[_0x79df('0x2f')],_0x5018a3[_0x79df('0x31')]));if(_0x5ab81a[_0x79df('0x2f')][_0x79df('0x3b')]){_0x11d1cd['where']=_[_0x79df('0x3c')](_0x11d1cd[_0x79df('0x39')],{'$or':_[_0x79df('0x28')](_0x11d1cd[_0x79df('0x33')],function(_0x126cb9){var _0x5f3a5f={};_0x5f3a5f[_0x126cb9]={'$like':'%'+_0x5ab81a[_0x79df('0x2f')][_0x79df('0x3b')]+'%'};return _0x5f3a5f;})});}_0x11d1cd=_[_0x79df('0x3c')]({},_0x11d1cd,_0x5ab81a[_0x79df('0x3e')]);return _0x4da591['getAllConditions'](_0x11d1cd);}})['then'](function(_0x5b0231){if(_0x5b0231){_0x164594=_0x5b0231[_0x79df('0x50')];if(!_0x5ab81a['query'][_0x79df('0x35')]('nolimit')){_0x11d1cd[_0x79df('0x1a')]=qs['limit'](_0x5ab81a[_0x79df('0x2f')][_0x79df('0x1a')]);_0x11d1cd[_0x79df('0x18')]=qs[_0x79df('0x18')](_0x5ab81a[_0x79df('0x2f')][_0x79df('0x18')]);}return _0x4da591['getAllConditions'](_0x11d1cd);}})[_0x79df('0x21')](function(_0x3be77e){if(_0x3be77e){return _0x3be77e?{'count':_0x164594,'rows':_0x3be77e}:null;}})[_0x79df('0x21')](respondWithResult(_0x364295,null))[_0x79df('0x43')](handleError(_0x364295,null));};exports[_0x79df('0x51')]=function(_0x552fef,_0x3cf01f,_0x17887c){var _0x305291={};var _0x201754={};var _0x1b8b93;var _0x4132c2;return db[_0x79df('0x29')]['findOne']({'where':{'id':_0x552fef[_0x79df('0x4c')]['id']}})[_0x79df('0x21')](handleEntityNotFound(_0x3cf01f,null))[_0x79df('0x21')](function(_0x505681){if(_0x505681){_0x1b8b93=_0x505681;_0x201754['model']=_[_0x79df('0x30')](db['Condition'][_0x79df('0x2a')]);_0x201754[_0x79df('0x2f')]=_[_0x79df('0x30')](_0x552fef[_0x79df('0x2f')]);_0x201754['filters']=_['intersection'](_0x201754[_0x79df('0x2e')],_0x201754[_0x79df('0x2f')]);_0x305291['attributes']=_[_0x79df('0x32')](_0x201754[_0x79df('0x2e')],qs['fields'](_0x552fef[_0x79df('0x2f')][_0x79df('0x34')]));_0x305291[_0x79df('0x33')]=_0x305291[_0x79df('0x33')][_0x79df('0x50')]?_0x305291[_0x79df('0x33')]:_0x201754['model'];_0x305291['order']=qs[_0x79df('0x38')](_0x552fef[_0x79df('0x2f')]['sort']);_0x305291[_0x79df('0x39')]=qs[_0x79df('0x31')](_[_0x79df('0x3a')](_0x552fef[_0x79df('0x2f')],_0x201754[_0x79df('0x31')]));if(_0x552fef['query'][_0x79df('0x3b')]){_0x305291['where']=_['merge'](_0x305291[_0x79df('0x39')],{'$or':_[_0x79df('0x28')](_0x305291['attributes'],function(_0x3f40da){var _0x56ebf8={};_0x56ebf8[_0x3f40da]={'$like':'%'+_0x552fef[_0x79df('0x2f')]['filter']+'%'};return _0x56ebf8;})});}_0x305291=_[_0x79df('0x3c')]({},_0x305291,_0x552fef['options']);return _0x1b8b93['getAnyConditions'](_0x305291);}})[_0x79df('0x21')](function(_0x1c6193){if(_0x1c6193){_0x4132c2=_0x1c6193[_0x79df('0x50')];if(!_0x552fef[_0x79df('0x2f')][_0x79df('0x35')]('nolimit')){_0x305291[_0x79df('0x1a')]=qs['limit'](_0x552fef['query'][_0x79df('0x1a')]);_0x305291['offset']=qs['offset'](_0x552fef[_0x79df('0x2f')]['offset']);}return _0x1b8b93['getAnyConditions'](_0x305291);}})[_0x79df('0x21')](function(_0x5928a5){if(_0x5928a5){return _0x5928a5?{'count':_0x4132c2,'rows':_0x5928a5}:null;}})[_0x79df('0x21')](respondWithResult(_0x3cf01f,null))[_0x79df('0x43')](handleError(_0x3cf01f,null));};exports[_0x79df('0x52')]=function(_0x2a3200,_0x272748,_0x538a1d){if(_0x2a3200['body']['id']){delete _0x2a3200['body']['id'];}return db[_0x79df('0x29')][_0x79df('0x4a')]({'where':{'id':_0x2a3200[_0x79df('0x4c')]['id']}})['then'](handleEntityNotFound(_0x272748,null))[_0x79df('0x21')](function(_0x2d0678){if(_0x2d0678){_0x2a3200[_0x79df('0x45')][_0x79df('0x53')]=_0x2d0678['id'];return db[_0x79df('0x54')][_0x79df('0x44')](_0x2a3200['body']);}})[_0x79df('0x21')](respondWithResult(_0x272748,null))[_0x79df('0x43')](handleError(_0x272748,null));};exports[_0x79df('0x55')]=function(_0x2902d0,_0x3801c5,_0x43e27f){var _0x53acb9={};var _0x5a8eab={};var _0xc8bb6d;var _0x3c1ffa;return db['Trigger'][_0x79df('0x56')]({'where':{'id':_0x2902d0['params']['id']}})['then'](handleEntityNotFound(_0x3801c5,null))['then'](function(_0x331cee){if(_0x331cee){_0xc8bb6d=_0x331cee;_0x5a8eab[_0x79df('0x2e')]=_[_0x79df('0x30')](db[_0x79df('0x54')][_0x79df('0x2a')]);_0x5a8eab[_0x79df('0x2f')]=_[_0x79df('0x30')](_0x2902d0[_0x79df('0x2f')]);_0x5a8eab[_0x79df('0x31')]=_[_0x79df('0x32')](_0x5a8eab['model'],_0x5a8eab[_0x79df('0x2f')]);_0x53acb9[_0x79df('0x33')]=_[_0x79df('0x32')](_0x5a8eab['model'],qs[_0x79df('0x34')](_0x2902d0[_0x79df('0x2f')][_0x79df('0x34')]));_0x53acb9[_0x79df('0x33')]=_0x53acb9['attributes'][_0x79df('0x50')]?_0x53acb9['attributes']:_0x5a8eab[_0x79df('0x2e')];_0x53acb9[_0x79df('0x37')]=qs['sort'](_0x2902d0['query']['sort']);_0x53acb9[_0x79df('0x39')]=qs[_0x79df('0x31')](_[_0x79df('0x3a')](_0x2902d0[_0x79df('0x2f')],_0x5a8eab['filters']));if(_0x2902d0[_0x79df('0x2f')]['filter']){_0x53acb9['where']=_[_0x79df('0x3c')](_0x53acb9[_0x79df('0x39')],{'$or':_[_0x79df('0x28')](_0x53acb9[_0x79df('0x33')],function(_0x41c791){var _0x1b629d={};_0x1b629d[_0x41c791]={'$like':'%'+_0x2902d0[_0x79df('0x2f')][_0x79df('0x3b')]+'%'};return _0x1b629d;})});}_0x53acb9=_[_0x79df('0x3c')]({},_0x53acb9,_0x2902d0[_0x79df('0x3e')]);return _0xc8bb6d[_0x79df('0x55')](_0x53acb9);}})[_0x79df('0x21')](function(_0x2aa2e3){if(_0x2aa2e3){_0x3c1ffa=_0x2aa2e3[_0x79df('0x50')];if(!_0x2902d0[_0x79df('0x2f')]['hasOwnProperty'](_0x79df('0x36'))){_0x53acb9[_0x79df('0x1a')]=qs[_0x79df('0x1a')](_0x2902d0[_0x79df('0x2f')][_0x79df('0x1a')]);_0x53acb9[_0x79df('0x18')]=qs[_0x79df('0x18')](_0x2902d0[_0x79df('0x2f')]['offset']);}return _0xc8bb6d[_0x79df('0x55')](_0x53acb9);}})['then'](function(_0x439d57){if(_0x439d57){return _0x439d57?{'count':_0x3c1ffa,'rows':_0x439d57}:null;}})[_0x79df('0x21')](respondWithResult(_0x3801c5,null))[_0x79df('0x43')](handleError(_0x3801c5,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 097438f..9ece762 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 _0xd67b=['bluebird','path','../../config/environment','exports','define','Trigger','tools_triggers','util','api','moment'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd67b,0x133));var _0xbd67=function(_0x1601f6,_0x2342e2){_0x1601f6=_0x1601f6-0x0;var _0x544d6a=_0xd67b[_0x1601f6];return _0x544d6a;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./trigger.attributes');module[_0xbd67('0x6')]=function(_0xa5c384,_0x2ad142){return _0xa5c384[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':_0xbd67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdfd=['tools_triggers','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Trigger'];(function(_0x2e0efa,_0x53830a){var _0xe2fa11=function(_0x5488b9){while(--_0x5488b9){_0x2e0efa['push'](_0x2e0efa['shift']());}};_0xe2fa11(++_0x53830a);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbdf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbdf('0x1'));var moment=require(_0xdbdf('0x2'));var BPromise=require(_0xdbdf('0x3'));var rp=require(_0xdbdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbdf('0x5'));var config=require(_0xdbdf('0x6'));var attributes=require('./trigger.attributes');module[_0xdbdf('0x7')]=function(_0xa743ff,_0x484034){return _0xa743ff[_0xdbdf('0x8')](_0xdbdf('0x9'),attributes,{'tableName':_0xdbdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 68c48ee..dc03aff 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 _0x5a3a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','map','include','model','attributes','find','ShowTrigger','debug','lodash'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x5a3a,0x110));var _0xa5a3=function(_0xf71e0c,_0x5529dd){_0xf71e0c=_0xf71e0c-0x0;var _0x162412=_0x5a3a[_0xf71e0c];return _0x162412;};'use strict';var _=require(_0xa5a3('0x0'));var util=require(_0xa5a3('0x1'));var moment=require(_0xa5a3('0x2'));var BPromise=require(_0xa5a3('0x3'));var rs=require(_0xa5a3('0x4'));var fs=require('fs');var Redis=require(_0xa5a3('0x5'));var db=require(_0xa5a3('0x6'))['db'];var utils=require(_0xa5a3('0x7'));var logger=require(_0xa5a3('0x8'))(_0xa5a3('0x9'));var config=require('../../config/environment');var jayson=require(_0xa5a3('0xa'));var client=jayson[_0xa5a3('0xb')][_0xa5a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x729267,_0x5d16fb,_0x2934ec){return new BPromise(function(_0x3c2aff,_0x1aefdc){return client[_0xa5a3('0xd')](_0x729267,_0x2934ec)[_0xa5a3('0xe')](function(_0x134805){logger['info'](_0xa5a3('0xf'),_0x5d16fb,_0xa5a3('0x10'));logger['debug'](_0xa5a3('0x11'),_0x5d16fb,_0xa5a3('0x10'),JSON[_0xa5a3('0x12')](_0x134805));if(_0x134805[_0xa5a3('0x13')]){if(_0x134805['error'][_0xa5a3('0x14')]===0x1f4){logger[_0xa5a3('0x13')](_0xa5a3('0xf'),_0x5d16fb,_0x134805['error'][_0xa5a3('0x15')]);return _0x1aefdc(_0x134805[_0xa5a3('0x13')]['message']);}logger[_0xa5a3('0x13')]('Trigger,\x20%s,\x20%s',_0x5d16fb,_0x134805[_0xa5a3('0x13')][_0xa5a3('0x15')]);return _0x3c2aff(_0x134805[_0xa5a3('0x13')]['message']);}else{logger[_0xa5a3('0x16')](_0xa5a3('0xf'),_0x5d16fb,_0xa5a3('0x10'));_0x3c2aff(_0x134805[_0xa5a3('0x17')]['message']);}})[_0xa5a3('0x18')](function(_0x12e573){logger['error']('Trigger,\x20%s,\x20%s',_0x5d16fb,_0x12e573);_0x1aefdc(_0x12e573);});});}exports[_0xa5a3('0x19')]=function(_0x5e82c0){var _0x1836cc=this;return new Promise(function(_0x13e166,_0x45058a){return db[_0xa5a3('0x1a')][_0xa5a3('0x1b')]({'raw':_0x5e82c0[_0xa5a3('0x1c')]?_0x5e82c0[_0xa5a3('0x1c')][_0xa5a3('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e82c0['options']?_0x5e82c0[_0xa5a3('0x1c')][_0xa5a3('0x1e')]||null:null,'attributes':_0x5e82c0['options']?_0x5e82c0[_0xa5a3('0x1c')]['attributes']||null:null,'limit':_0x5e82c0[_0xa5a3('0x1c')]?_0x5e82c0[_0xa5a3('0x1c')][_0xa5a3('0x1f')]||null:null,'include':_0x5e82c0['options']?_0x5e82c0[_0xa5a3('0x1c')]['include']?_[_0xa5a3('0x20')](_0x5e82c0[_0xa5a3('0x1c')][_0xa5a3('0x21')],function(_0x4b26ca){return{'model':db[_0x4b26ca[_0xa5a3('0x22')]],'as':_0x4b26ca['as'],'attributes':_0x4b26ca['attributes'],'include':_0x4b26ca[_0xa5a3('0x21')]?_[_0xa5a3('0x20')](_0x4b26ca[_0xa5a3('0x21')],function(_0xbce206){return{'model':db[_0xbce206[_0xa5a3('0x22')]],'as':_0xbce206['as'],'attributes':_0xbce206[_0xa5a3('0x23')],'include':_0xbce206[_0xa5a3('0x21')]?_[_0xa5a3('0x20')](_0xbce206[_0xa5a3('0x21')],function(_0x593929){return{'model':db[_0x593929['model']],'as':_0x593929['as'],'attributes':_0x593929[_0xa5a3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19cb64){logger[_0xa5a3('0x16')](_0xa5a3('0x19'),_0x5e82c0);logger['debug'](_0xa5a3('0x19'),_0x5e82c0,JSON[_0xa5a3('0x12')](_0x19cb64));_0x13e166(_0x19cb64);})[_0xa5a3('0x18')](function(_0x3d7ed5){logger['error'](_0xa5a3('0x19'),_0x3d7ed5[_0xa5a3('0x15')],_0x5e82c0);_0x45058a(_0x1836cc[_0xa5a3('0x13')](0x1f4,_0x3d7ed5[_0xa5a3('0x15')]));});});};exports['ShowTrigger']=function(_0x2b0b8c){var _0x14ec8a=this;return new Promise(function(_0x439a60,_0x3e6ec5){return db['Trigger'][_0xa5a3('0x24')]({'raw':_0x2b0b8c['options']?_0x2b0b8c[_0xa5a3('0x1c')][_0xa5a3('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b0b8c[_0xa5a3('0x1c')]?_0x2b0b8c[_0xa5a3('0x1c')][_0xa5a3('0x1e')]||null:null,'attributes':_0x2b0b8c[_0xa5a3('0x1c')]?_0x2b0b8c[_0xa5a3('0x1c')][_0xa5a3('0x23')]||null:null,'include':_0x2b0b8c['options']?_0x2b0b8c[_0xa5a3('0x1c')][_0xa5a3('0x21')]?_[_0xa5a3('0x20')](_0x2b0b8c['options']['include'],function(_0x490f3c){return{'model':db[_0x490f3c['model']],'as':_0x490f3c['as'],'attributes':_0x490f3c['attributes'],'include':_0x490f3c[_0xa5a3('0x21')]?_[_0xa5a3('0x20')](_0x490f3c[_0xa5a3('0x21')],function(_0x39b9c3){return{'model':db[_0x39b9c3[_0xa5a3('0x22')]],'as':_0x39b9c3['as'],'attributes':_0x39b9c3['attributes'],'include':_0x39b9c3[_0xa5a3('0x21')]?_['map'](_0x39b9c3[_0xa5a3('0x21')],function(_0x457b2a){return{'model':db[_0x457b2a[_0xa5a3('0x22')]],'as':_0x457b2a['as'],'attributes':_0x457b2a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5a3('0xe')](function(_0x41d65c){logger[_0xa5a3('0x16')](_0xa5a3('0x25'),_0x2b0b8c);logger[_0xa5a3('0x26')](_0xa5a3('0x25'),_0x2b0b8c,JSON[_0xa5a3('0x12')](_0x41d65c));_0x439a60(_0x41d65c);})[_0xa5a3('0x18')](function(_0x3084d2){logger['error']('ShowTrigger',_0x3084d2[_0xa5a3('0x15')],_0x2b0b8c);_0x3e6ec5(_0x14ec8a[_0xa5a3('0x13')](0x1f4,_0x3084d2['message']));});});}; \ No newline at end of file +var _0x6719=['include','model','map','then','catch','ShowTrigger','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','GetTrigger','Trigger','options','where','attributes'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x6719,0x1ac));var _0x9671=function(_0x353856,_0x5ce89d){_0x353856=_0x353856-0x0;var _0xa58048=_0x6719[_0x353856];return _0xa58048;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9671('0x0'));var BPromise=require(_0x9671('0x1'));var rs=require(_0x9671('0x2'));var fs=require('fs');var Redis=require(_0x9671('0x3'));var db=require(_0x9671('0x4'))['db'];var utils=require(_0x9671('0x5'));var logger=require(_0x9671('0x6'))(_0x9671('0x7'));var config=require(_0x9671('0x8'));var jayson=require(_0x9671('0x9'));var client=jayson[_0x9671('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5754f8,_0x54cd47,_0xcd12b3){return new BPromise(function(_0x27acd7,_0x2214e9){return client[_0x9671('0xb')](_0x5754f8,_0xcd12b3)['then'](function(_0x52b616){logger['info'](_0x9671('0xc'),_0x54cd47,_0x9671('0xd'));logger[_0x9671('0xe')](_0x9671('0xf'),_0x54cd47,'request\x20sent',JSON[_0x9671('0x10')](_0x52b616));if(_0x52b616['error']){if(_0x52b616['error'][_0x9671('0x11')]===0x1f4){logger['error'](_0x9671('0xc'),_0x54cd47,_0x52b616['error'][_0x9671('0x12')]);return _0x2214e9(_0x52b616[_0x9671('0x13')]['message']);}logger['error'](_0x9671('0xc'),_0x54cd47,_0x52b616[_0x9671('0x13')][_0x9671('0x12')]);return _0x27acd7(_0x52b616[_0x9671('0x13')]['message']);}else{logger[_0x9671('0x14')]('Trigger,\x20%s,\x20%s',_0x54cd47,_0x9671('0xd'));_0x27acd7(_0x52b616[_0x9671('0x15')][_0x9671('0x12')]);}})['catch'](function(_0x1a023a){logger['error'](_0x9671('0xc'),_0x54cd47,_0x1a023a);_0x2214e9(_0x1a023a);});});}exports[_0x9671('0x16')]=function(_0x2ca757){var _0x3e61fb=this;return new Promise(function(_0xa55d29,_0x3464e9){return db[_0x9671('0x17')]['findAll']({'raw':_0x2ca757['options']?_0x2ca757[_0x9671('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ca757[_0x9671('0x18')]?_0x2ca757[_0x9671('0x18')][_0x9671('0x19')]||null:null,'attributes':_0x2ca757[_0x9671('0x18')]?_0x2ca757['options'][_0x9671('0x1a')]||null:null,'limit':_0x2ca757['options']?_0x2ca757[_0x9671('0x18')]['limit']||null:null,'include':_0x2ca757[_0x9671('0x18')]?_0x2ca757[_0x9671('0x18')][_0x9671('0x1b')]?_['map'](_0x2ca757['options']['include'],function(_0x1ae3c6){return{'model':db[_0x1ae3c6[_0x9671('0x1c')]],'as':_0x1ae3c6['as'],'attributes':_0x1ae3c6[_0x9671('0x1a')],'include':_0x1ae3c6[_0x9671('0x1b')]?_[_0x9671('0x1d')](_0x1ae3c6[_0x9671('0x1b')],function(_0x4ae1f4){return{'model':db[_0x4ae1f4[_0x9671('0x1c')]],'as':_0x4ae1f4['as'],'attributes':_0x4ae1f4['attributes'],'include':_0x4ae1f4[_0x9671('0x1b')]?_[_0x9671('0x1d')](_0x4ae1f4['include'],function(_0x38ef55){return{'model':db[_0x38ef55[_0x9671('0x1c')]],'as':_0x38ef55['as'],'attributes':_0x38ef55[_0x9671('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9671('0x1e')](function(_0x38b756){logger[_0x9671('0x14')](_0x9671('0x16'),_0x2ca757);logger['debug'](_0x9671('0x16'),_0x2ca757,JSON[_0x9671('0x10')](_0x38b756));_0xa55d29(_0x38b756);})[_0x9671('0x1f')](function(_0x2f5e0e){logger[_0x9671('0x13')]('GetTrigger',_0x2f5e0e[_0x9671('0x12')],_0x2ca757);_0x3464e9(_0x3e61fb[_0x9671('0x13')](0x1f4,_0x2f5e0e[_0x9671('0x12')]));});});};exports[_0x9671('0x20')]=function(_0xcb1f2c){var _0x4f8753=this;return new Promise(function(_0x595e23,_0x464dae){return db[_0x9671('0x17')][_0x9671('0x21')]({'raw':_0xcb1f2c[_0x9671('0x18')]?_0xcb1f2c[_0x9671('0x18')][_0x9671('0x22')]===undefined?!![]:![]:!![],'where':_0xcb1f2c[_0x9671('0x18')]?_0xcb1f2c[_0x9671('0x18')]['where']||null:null,'attributes':_0xcb1f2c[_0x9671('0x18')]?_0xcb1f2c['options'][_0x9671('0x1a')]||null:null,'include':_0xcb1f2c['options']?_0xcb1f2c['options'][_0x9671('0x1b')]?_[_0x9671('0x1d')](_0xcb1f2c[_0x9671('0x18')][_0x9671('0x1b')],function(_0x534434){return{'model':db[_0x534434[_0x9671('0x1c')]],'as':_0x534434['as'],'attributes':_0x534434[_0x9671('0x1a')],'include':_0x534434['include']?_[_0x9671('0x1d')](_0x534434[_0x9671('0x1b')],function(_0x5b4615){return{'model':db[_0x5b4615[_0x9671('0x1c')]],'as':_0x5b4615['as'],'attributes':_0x5b4615[_0x9671('0x1a')],'include':_0x5b4615['include']?_[_0x9671('0x1d')](_0x5b4615[_0x9671('0x1b')],function(_0x53f658){return{'model':db[_0x53f658['model']],'as':_0x53f658['as'],'attributes':_0x53f658[_0x9671('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9671('0x1e')](function(_0x59bb3f){logger['info'](_0x9671('0x20'),_0xcb1f2c);logger['debug'](_0x9671('0x20'),_0xcb1f2c,JSON['stringify'](_0x59bb3f));_0x595e23(_0x59bb3f);})[_0x9671('0x1f')](function(_0x29ce0f){logger[_0x9671('0x13')](_0x9671('0x20'),_0x29ce0f[_0x9671('0x12')],_0xcb1f2c);_0x464dae(_0x4f8753[_0x9671('0x13')](0x1f4,_0x29ce0f[_0x9671('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 42a13d4..f3ad370 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 _0x2889=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','delete','destroy'];(function(_0x2ecaa2,_0x2e62c4){var _0x49c038=function(_0x3912a6){while(--_0x3912a6){_0x2ecaa2['push'](_0x2ecaa2['shift']());}};_0x49c038(++_0x2e62c4);}(_0x2889,0x169));var _0x9288=function(_0x4e9e83,_0x3ae158){_0x4e9e83=_0x4e9e83-0x0;var _0x220779=_0x2889[_0x4e9e83];return _0x220779;};'use strict';var multer=require('multer');var util=require(_0x9288('0x0'));var path=require(_0x9288('0x1'));var timeout=require(_0x9288('0x2'));var express=require(_0x9288('0x3'));var router=express['Router']();var fs_extra=require(_0x9288('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9288('0x5'));var config=require(_0x9288('0x6'));var controller=require(_0x9288('0x7'));router[_0x9288('0x8')]('/',auth[_0x9288('0x9')](),controller[_0x9288('0xa')]);router[_0x9288('0x8')](_0x9288('0xb'),auth[_0x9288('0x9')](),controller[_0x9288('0xc')]);router[_0x9288('0xd')](_0x9288('0xe'),auth[_0x9288('0x9')](),controller['clone']);router[_0x9288('0xd')]('/',auth['isAuthenticated'](),controller[_0x9288('0xf')]);router[_0x9288('0x10')](_0x9288('0xb'),auth[_0x9288('0x9')](),controller['update']);router[_0x9288('0x11')](_0x9288('0xb'),auth['isAuthenticated'](),controller[_0x9288('0x12')]);module[_0x9288('0x13')]=router; \ No newline at end of file +var _0xe48e=['isAuthenticated','show','post','/:id/clone','clone','create','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id'];(function(_0x451878,_0x20619f){var _0x3e4531=function(_0x4b1bf4){while(--_0x4b1bf4){_0x451878['push'](_0x451878['shift']());}};_0x3e4531(++_0x20619f);}(_0xe48e,0x16a));var _0xee48=function(_0x38be6c,_0x34ce81){_0x38be6c=_0x38be6c-0x0;var _0x3b22fc=_0xe48e[_0x38be6c];return _0x3b22fc;};'use strict';var multer=require(_0xee48('0x0'));var util=require(_0xee48('0x1'));var path=require('path');var timeout=require(_0xee48('0x2'));var express=require(_0xee48('0x3'));var router=express['Router']();var fs_extra=require(_0xee48('0x4'));var auth=require(_0xee48('0x5'));var interaction=require(_0xee48('0x6'));var config=require(_0xee48('0x7'));var controller=require(_0xee48('0x8'));router[_0xee48('0x9')]('/',auth['isAuthenticated'](),controller[_0xee48('0xa')]);router[_0xee48('0x9')](_0xee48('0xb'),auth[_0xee48('0xc')](),controller[_0xee48('0xd')]);router[_0xee48('0xe')](_0xee48('0xf'),auth[_0xee48('0xc')](),controller[_0xee48('0x10')]);router[_0xee48('0xe')]('/',auth[_0xee48('0xc')](),controller[_0xee48('0x11')]);router[_0xee48('0x12')](_0xee48('0xb'),auth[_0xee48('0xc')](),controller['update']);router[_0xee48('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xee48('0x14')]);module[_0xee48('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7589544..5489ff2 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 _0x7cbf=['uas','pai','fingerprint','certificate','active','actpass','dynamic','update','update,nonat','BOOLEAN','exports','name','friend','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','STRING','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','nonat','force_rport,comedia','setDataValue','nat','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac'];(function(_0x453536,_0x46622b){var _0x252fb0=function(_0x14e766){while(--_0x14e766){_0x453536['push'](_0x453536['shift']());}};_0x252fb0(++_0x46622b);}(_0x7cbf,0xca));var _0xf7cb=function(_0x199038,_0x2a18f5){_0x199038=_0x199038-0x0;var _0x21fa55=_0x7cbf[_0x199038];return _0x21fa55;};'use strict';var Sequelize=require('sequelize');module[_0xf7cb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf7cb('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf7cb('0x2'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf7cb('0x3')},'callingpres':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x5'),_0xf7cb('0x6'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xf7cb('0x7'),_0xf7cb('0x8'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xf7cb('0x9')]},'permit':{'type':Sequelize[_0xf7cb('0x9')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xf7cb('0x9')]},'remotesecret':{'type':Sequelize[_0xf7cb('0x9')]},'transport':{'type':Sequelize[_0xf7cb('0x9')],'defaultValue':_0xf7cb('0xa'),'set':function(_0x7500e5){this['setDataValue'](_0xf7cb('0xb'),_0x7500e5?_0x7500e5[_0xf7cb('0xc')](','):null);},'get':function(){return this[_0xf7cb('0xd')]('transport')?this[_0xf7cb('0xd')](_0xf7cb('0xb'))[_0xf7cb('0xe')](','):null;},'comment':_0xf7cb('0xf')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xf7cb('0x10'),_0xf7cb('0x11'),_0xf7cb('0x12'),_0xf7cb('0x13')),'defaultValue':_0xf7cb('0x14')},'directmedia':{'type':Sequelize[_0xf7cb('0x4')]('yes','no',_0xf7cb('0x15'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf7cb('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf7cb('0x9')]},'directmediadeny':{'type':Sequelize[_0xf7cb('0x9')]},'nat':{'type':Sequelize[_0xf7cb('0x9')],'defaultValue':_0xf7cb('0x16'),'set':function(_0x485d41){this[_0xf7cb('0x17')]('nat',_0x485d41?_0x485d41[_0xf7cb('0xc')](','):null);},'get':function(){return this[_0xf7cb('0xd')](_0xf7cb('0x18'))?this[_0xf7cb('0xd')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xf7cb('0x9')]},'namedcallgroup':{'type':Sequelize[_0xf7cb('0x9')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xf7cb('0x9')]},'language':{'type':Sequelize[_0xf7cb('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf7cb('0x9')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf7cb('0x9')],'defaultValue':_0xf7cb('0x19')},'allow':{'type':Sequelize[_0xf7cb('0x9')],'allowNull':![],'defaultValue':_0xf7cb('0x1a'),'set':function(_0x2f816b){this['setDataValue'](_0xf7cb('0x1b'),_0x2f816b?_0x2f816b[_0xf7cb('0xc')](';'):_0xf7cb('0x1a'));},'get':function(){return this['getDataValue'](_0xf7cb('0x1b'))?this[_0xf7cb('0xd')](_0xf7cb('0x1b'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xf7cb('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xf7cb('0x9')],'defaultValue':_0xf7cb('0x1c'),'set':function(_0x832bb8){this['setDataValue']('insecure',_0x832bb8?_0x832bb8[_0xf7cb('0xc')](','):null);},'get':function(){return this['getDataValue'](_0xf7cb('0x1d'))?this[_0xf7cb('0xd')](_0xf7cb('0x1d'))[_0xf7cb('0xe')](','):null;},'comment':_0xf7cb('0x1e')},'trustrpid':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no',_0xf7cb('0x20'))},'promiscredir':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'setvar':{'type':Sequelize[_0xf7cb('0x9')]},'callerid':{'type':Sequelize[_0xf7cb('0x9')],'defaultValue':_0xf7cb('0x22')},'amaflags':{'type':Sequelize[_0xf7cb('0x9')]},'callcounter':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no'),'defaultValue':_0xf7cb('0x1f')},'busylevel':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no')},'allowsubscribe':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no')},'subscribecontext':{'type':Sequelize[_0xf7cb('0x9')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xf7cb('0x4')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no')},'mailbox':{'type':Sequelize[_0xf7cb('0x9')]},'session_timers':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x23'),_0xf7cb('0x24'),'originate')},'session_expires':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x25'),_0xf7cb('0x26')),'defaultValue':_0xf7cb('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xf7cb('0x9')]},'regexten':{'type':Sequelize[_0xf7cb('0x9')]},'fromdomain':{'type':Sequelize[_0xf7cb('0x9')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf7cb('0x21')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no'),'defaultValue':_0xf7cb('0x1f')},'keepalive':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xf7cb('0x9')]},'defaultuser':{'type':Sequelize[_0xf7cb('0x9')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no',_0xf7cb('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf7cb('0x9')]},'callbackextension':{'type':Sequelize[_0xf7cb('0x9')]},'timert1':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'timerb':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0xf7cb('0x9')]},'contactdeny':{'type':Sequelize[_0xf7cb('0x9')]},'contactacl':{'type':Sequelize[_0xf7cb('0x9')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xf7cb('0x9')]},'maxforwards':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'encryption':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xf7cb('0x1f'),'no')},'icesupport':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no')},'dtlsenable':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no')},'dtlsverify':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no',_0xf7cb('0x28'),_0xf7cb('0x29'))},'dtlsrekey':{'type':Sequelize[_0xf7cb('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf7cb('0x9')]},'dtlsprivatekey':{'type':Sequelize[_0xf7cb('0x9')]},'dtlscipher':{'type':Sequelize[_0xf7cb('0x9')]},'dtlscafile':{'type':Sequelize[_0xf7cb('0x9')]},'dtlscapath':{'type':Sequelize[_0xf7cb('0x9')]},'dtlssetup':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x2a'),'passive',_0xf7cb('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf7cb('0x9')]},'usereqphone':{'type':Sequelize[_0xf7cb('0x4')](_0xf7cb('0x1f'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf7cb('0x9')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xf7cb('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf7cb('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0xf7cb('0x9')]},'mohinterpret':{'type':Sequelize[_0xf7cb('0x9')]},'mohsuggest':{'type':Sequelize[_0xf7cb('0x9')]},'parkinglot':{'type':Sequelize[_0xf7cb('0x9')]},'description':{'type':Sequelize[_0xf7cb('0x9')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xf7cb('0x2c')},'canreinvite':{'type':Sequelize[_0xf7cb('0x4')]('yes','no',_0xf7cb('0x15'),_0xf7cb('0x2d'),_0xf7cb('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf7cb('0x9')]},'otherFields':{'type':Sequelize[_0xf7cb('0x9')]},'active':{'type':Sequelize[_0xf7cb('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf7cb('0x9')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4445=['fingerprint','certificate','active','passive','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','nonat','update','outgoing','yes','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','originate','uas','pai'];(function(_0xe52a77,_0x371a4a){var _0x2560ef=function(_0x5bb039){while(--_0x5bb039){_0xe52a77['push'](_0xe52a77['shift']());}};_0x2560ef(++_0x371a4a);}(_0x4445,0x16b));var _0x5444=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0x4445[_0xf31767];return _0x24bd0c;};'use strict';var Sequelize=require('sequelize');module[_0x5444('0x0')]={'name':{'type':Sequelize[_0x5444('0x1')],'allowNull':![],'unique':_0x5444('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5444('0x3')]('friend','user','peer'),'allowNull':![],'defaultValue':_0x5444('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5444('0x5')},'callingpres':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x6'),_0x5444('0x7'),'ALLOWED_FAILED_SCREEN',_0x5444('0x8'),_0x5444('0x9'),_0x5444('0xa'),_0x5444('0xb'),_0x5444('0xc'))},'deny':{'type':Sequelize[_0x5444('0x1')]},'permit':{'type':Sequelize[_0x5444('0x1')]},'secret':{'type':Sequelize[_0x5444('0x1')]},'md5secret':{'type':Sequelize[_0x5444('0x1')]},'remotesecret':{'type':Sequelize[_0x5444('0x1')]},'transport':{'type':Sequelize[_0x5444('0x1')],'defaultValue':_0x5444('0xd'),'set':function(_0x314bc5){this[_0x5444('0xe')](_0x5444('0xf'),_0x314bc5?_0x314bc5['join'](','):null);},'get':function(){return this[_0x5444('0x10')]('transport')?this[_0x5444('0x10')](_0x5444('0xf'))[_0x5444('0x11')](','):null;},'comment':_0x5444('0x12')},'dtmfmode':{'type':Sequelize[_0x5444('0x3')]('rfc2833',_0x5444('0x13'),_0x5444('0x14'),_0x5444('0x15'),_0x5444('0x16')),'defaultValue':_0x5444('0x17')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x5444('0x18'),_0x5444('0x19'),_0x5444('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5444('0x1')]},'directmediadeny':{'type':Sequelize[_0x5444('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x5444('0x1c'),'set':function(_0x5017ca){this[_0x5444('0xe')](_0x5444('0x1d'),_0x5017ca?_0x5017ca[_0x5444('0x1e')](','):null);},'get':function(){return this[_0x5444('0x10')](_0x5444('0x1d'))?this[_0x5444('0x10')](_0x5444('0x1d'))['split'](','):null;},'comment':_0x5444('0x1f')},'callgroup':{'type':Sequelize[_0x5444('0x1')]},'namedcallgroup':{'type':Sequelize[_0x5444('0x1')]},'pickupgroup':{'type':Sequelize[_0x5444('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x5444('0x1')]},'language':{'type':Sequelize[_0x5444('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5444('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5444('0x1')],'defaultValue':_0x5444('0x20')},'allow':{'type':Sequelize[_0x5444('0x1')],'allowNull':![],'defaultValue':_0x5444('0x21'),'set':function(_0x6f1c93){this[_0x5444('0xe')](_0x5444('0x22'),_0x6f1c93?_0x6f1c93[_0x5444('0x1e')](';'):_0x5444('0x21'));},'get':function(){return this[_0x5444('0x10')](_0x5444('0x22'))?this[_0x5444('0x10')](_0x5444('0x22'))[_0x5444('0x11')](';'):null;},'comment':_0x5444('0x23')},'autoframing':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x5444('0x24'),'set':function(_0x1056c4){this['setDataValue'](_0x5444('0x25'),_0x1056c4?_0x1056c4[_0x5444('0x1e')](','):null);},'get':function(){return this[_0x5444('0x10')](_0x5444('0x25'))?this[_0x5444('0x10')](_0x5444('0x25'))[_0x5444('0x11')](','):null;},'comment':_0x5444('0x26')},'trustrpid':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no',_0x5444('0x27'))},'promiscredir':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x5444('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x5444('0x28')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5444('0x1')],'defaultValue':_0x5444('0x29')},'amaflags':{'type':Sequelize[_0x5444('0x1')]},'callcounter':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x5444('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x5444('0x1')]},'template':{'type':Sequelize[_0x5444('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x5444('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5444('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x5444('0x1')]},'session_timers':{'type':Sequelize[_0x5444('0x3')]('accept','refuse',_0x5444('0x2a'))},'session_expires':{'type':Sequelize[_0x5444('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x5444('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x5444('0x3')]('uac',_0x5444('0x2b')),'defaultValue':_0x5444('0x2b')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x5444('0x1')]},'fromdomain':{'type':Sequelize[_0x5444('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5444('0x28')](0x5)},'qualify':{'type':Sequelize[_0x5444('0x3')]('yes','no'),'defaultValue':_0x5444('0x1b')},'keepalive':{'type':Sequelize[_0x5444('0x28')](0xb)},'defaultip':{'type':Sequelize[_0x5444('0x1')]},'defaultuser':{'type':Sequelize[_0x5444('0x1')]},'rtptimeout':{'type':Sequelize[_0x5444('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5444('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5444('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no',_0x5444('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5444('0x1')]},'callbackextension':{'type':Sequelize[_0x5444('0x1')]},'timert1':{'type':Sequelize[_0x5444('0x28')](0xb)},'timerb':{'type':Sequelize[_0x5444('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5444('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x5444('0x1')]},'contactacl':{'type':Sequelize[_0x5444('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x5444('0x1')]},'use_q850_reason':{'type':Sequelize[_0x5444('0x1')]},'maxforwards':{'type':Sequelize[_0x5444('0x28')](0xb)},'encryption':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5444('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x5444('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0x5444('0x3')]('yes','no',_0x5444('0x2d'),_0x5444('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x5444('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5444('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x5444('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x2f'),_0x5444('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5444('0x1')]},'usereqphone':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5444('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5444('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x5444('0x1b'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x5444('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x5444('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5444('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x5444('0x3')](_0x5444('0x1b'),'no',_0x5444('0x18'),_0x5444('0x19'),_0x5444('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5444('0x1')]},'otherFields':{'type':Sequelize[_0x5444('0x1')]},'active':{'type':Sequelize[_0x5444('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index bb55ee6..38b6aa9 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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x193ace,_0x440a6f){var _0x18da0e=function(_0x18aae6){while(--_0x18aae6){_0x193ace['push'](_0x193ace['shift']());}};_0x18da0e(++_0x440a6f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x13b57f,_0xe57e66){_0x13b57f=_0x13b57f-0x0;var _0x46ec94=_0x8ef6[_0x13b57f];return _0x46ec94;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','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','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x81bd,0x7c));var _0xd81b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x81bd[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5cae740..369030c 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 _0x07c1=['request-promise','rimraf','../../config/environment','exports','define','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3421c6,_0x260d60){var _0x15c30c=function(_0x3ea3fb){while(--_0x3ea3fb){_0x3421c6['push'](_0x3421c6['shift']());}};_0x15c30c(++_0x260d60);}(_0x07c1,0x1e6));var _0x107c=function(_0x370116,_0x335221){_0x370116=_0x370116-0x0;var _0x3cc116=_0x07c1[_0x370116];return _0x3cc116;};'use strict';var _=require(_0x107c('0x0'));var util=require(_0x107c('0x1'));var logger=require(_0x107c('0x2'))(_0x107c('0x3'));var moment=require(_0x107c('0x4'));var BPromise=require(_0x107c('0x5'));var rp=require(_0x107c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x107c('0x7'));var config=require(_0x107c('0x8'));var attributes=require('./trunk.attributes');module[_0x107c('0x9')]=function(_0x450ff8,_0x5be7b3){return _0x450ff8[_0x107c('0xa')]('Trunk',attributes,{'tableName':_0x107c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f24=['define','Trunk','tools_trunks','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x23e63b,_0x3acd0a){var _0x11bcf2=function(_0x2e6993){while(--_0x2e6993){_0x23e63b['push'](_0x23e63b['shift']());}};_0x11bcf2(++_0x3acd0a);}(_0x6f24,0x114));var _0x46f2=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x6f24[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require('lodash');var util=require(_0x46f2('0x0'));var logger=require(_0x46f2('0x1'))(_0x46f2('0x2'));var moment=require('moment');var BPromise=require(_0x46f2('0x3'));var rp=require(_0x46f2('0x4'));var fs=require('fs');var path=require(_0x46f2('0x5'));var rimraf=require(_0x46f2('0x6'));var config=require(_0x46f2('0x7'));var attributes=require(_0x46f2('0x8'));module[_0x46f2('0x9')]=function(_0x7c1c3a,_0x19104e){return _0x7c1c3a[_0x46f2('0xa')](_0x46f2('0xb'),attributes,{'tableName':_0x46f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index b01fe58..6c10411 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 _0xea92=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','GetTrunk','Trunk','options','raw','map','include','model','attributes','then','ShowTrunk','find','where','stringify','catch','moment','randomstring','ioredis'];(function(_0x41c83d,_0x2422c9){var _0x284ad6=function(_0x536429){while(--_0x536429){_0x41c83d['push'](_0x41c83d['shift']());}};_0x284ad6(++_0x2422c9);}(_0xea92,0x189));var _0x2ea9=function(_0x1ac883,_0x374a37){_0x1ac883=_0x1ac883-0x0;var _0x5f0855=_0xea92[_0x1ac883];return _0x5f0855;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ea9('0x0'));var BPromise=require('bluebird');var rs=require(_0x2ea9('0x1'));var fs=require('fs');var Redis=require(_0x2ea9('0x2'));var db=require(_0x2ea9('0x3'))['db'];var utils=require(_0x2ea9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2ea9('0x5'));var jayson=require(_0x2ea9('0x6'));var client=jayson[_0x2ea9('0x7')][_0x2ea9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b1383,_0x2d91fa,_0x3bf504){return new BPromise(function(_0xff4259,_0x3d7761){return client[_0x2ea9('0x9')](_0x4b1383,_0x3bf504)['then'](function(_0x512cf6){logger['info'](_0x2ea9('0xa'),_0x2d91fa,'request\x20sent');logger[_0x2ea9('0xb')](_0x2ea9('0xc'),_0x2d91fa,'request\x20sent',JSON['stringify'](_0x512cf6));if(_0x512cf6[_0x2ea9('0xd')]){if(_0x512cf6[_0x2ea9('0xd')][_0x2ea9('0xe')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2d91fa,_0x512cf6[_0x2ea9('0xd')][_0x2ea9('0xf')]);return _0x3d7761(_0x512cf6[_0x2ea9('0xd')][_0x2ea9('0xf')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2d91fa,_0x512cf6[_0x2ea9('0xd')]['message']);return _0xff4259(_0x512cf6['error']['message']);}else{logger[_0x2ea9('0x10')](_0x2ea9('0xa'),_0x2d91fa,_0x2ea9('0x11'));_0xff4259(_0x512cf6[_0x2ea9('0x12')][_0x2ea9('0xf')]);}})['catch'](function(_0x4053cc){logger[_0x2ea9('0xd')](_0x2ea9('0xa'),_0x2d91fa,_0x4053cc);_0x3d7761(_0x4053cc);});});}exports[_0x2ea9('0x13')]=function(_0x57b294){var _0x4b9b47=this;return new Promise(function(_0x40d139,_0x180905){return db[_0x2ea9('0x14')]['findAll']({'raw':_0x57b294[_0x2ea9('0x15')]?_0x57b294[_0x2ea9('0x15')][_0x2ea9('0x16')]===undefined?!![]:![]:!![],'where':_0x57b294[_0x2ea9('0x15')]?_0x57b294['options']['where']||null:null,'attributes':_0x57b294[_0x2ea9('0x15')]?_0x57b294[_0x2ea9('0x15')]['attributes']||null:null,'limit':_0x57b294[_0x2ea9('0x15')]?_0x57b294[_0x2ea9('0x15')]['limit']||null:null,'include':_0x57b294[_0x2ea9('0x15')]?_0x57b294[_0x2ea9('0x15')]['include']?_[_0x2ea9('0x17')](_0x57b294[_0x2ea9('0x15')][_0x2ea9('0x18')],function(_0x165730){return{'model':db[_0x165730[_0x2ea9('0x19')]],'as':_0x165730['as'],'attributes':_0x165730[_0x2ea9('0x1a')],'include':_0x165730[_0x2ea9('0x18')]?_[_0x2ea9('0x17')](_0x165730[_0x2ea9('0x18')],function(_0x578b78){return{'model':db[_0x578b78['model']],'as':_0x578b78['as'],'attributes':_0x578b78[_0x2ea9('0x1a')],'include':_0x578b78[_0x2ea9('0x18')]?_[_0x2ea9('0x17')](_0x578b78[_0x2ea9('0x18')],function(_0x4e5b6b){return{'model':db[_0x4e5b6b['model']],'as':_0x4e5b6b['as'],'attributes':_0x4e5b6b[_0x2ea9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2ea9('0x1b')](function(_0x463aa8){logger[_0x2ea9('0x10')]('GetTrunk',_0x57b294);logger[_0x2ea9('0xb')](_0x2ea9('0x13'),_0x57b294,JSON['stringify'](_0x463aa8));_0x40d139(_0x463aa8);})['catch'](function(_0x3383af){logger[_0x2ea9('0xd')](_0x2ea9('0x13'),_0x3383af['message'],_0x57b294);_0x180905(_0x4b9b47['error'](0x1f4,_0x3383af[_0x2ea9('0xf')]));});});};exports[_0x2ea9('0x1c')]=function(_0x2b87f8){var _0x9f259d=this;return new Promise(function(_0x55eb04,_0x5acd5a){return db[_0x2ea9('0x14')][_0x2ea9('0x1d')]({'raw':_0x2b87f8[_0x2ea9('0x15')]?_0x2b87f8[_0x2ea9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2b87f8['options']?_0x2b87f8[_0x2ea9('0x15')][_0x2ea9('0x1e')]||null:null,'attributes':_0x2b87f8[_0x2ea9('0x15')]?_0x2b87f8['options'][_0x2ea9('0x1a')]||null:null,'include':_0x2b87f8['options']?_0x2b87f8[_0x2ea9('0x15')][_0x2ea9('0x18')]?_[_0x2ea9('0x17')](_0x2b87f8[_0x2ea9('0x15')][_0x2ea9('0x18')],function(_0x583d85){return{'model':db[_0x583d85[_0x2ea9('0x19')]],'as':_0x583d85['as'],'attributes':_0x583d85[_0x2ea9('0x1a')],'include':_0x583d85[_0x2ea9('0x18')]?_[_0x2ea9('0x17')](_0x583d85[_0x2ea9('0x18')],function(_0x5e72b4){return{'model':db[_0x5e72b4[_0x2ea9('0x19')]],'as':_0x5e72b4['as'],'attributes':_0x5e72b4[_0x2ea9('0x1a')],'include':_0x5e72b4[_0x2ea9('0x18')]?_[_0x2ea9('0x17')](_0x5e72b4[_0x2ea9('0x18')],function(_0x4781eb){return{'model':db[_0x4781eb[_0x2ea9('0x19')]],'as':_0x4781eb['as'],'attributes':_0x4781eb[_0x2ea9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2ea9('0x1b')](function(_0x399fde){logger[_0x2ea9('0x10')]('ShowTrunk',_0x2b87f8);logger[_0x2ea9('0xb')](_0x2ea9('0x1c'),_0x2b87f8,JSON[_0x2ea9('0x1f')](_0x399fde));_0x55eb04(_0x399fde);})[_0x2ea9('0x20')](function(_0x1462e8){logger['error'](_0x2ea9('0x1c'),_0x1462e8[_0x2ea9('0xf')],_0x2b87f8);_0x5acd5a(_0x9f259d[_0x2ea9('0xd')](0x1f4,_0x1462e8['message']));});});}; \ No newline at end of file +var _0xaab2=['Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','find','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s'];(function(_0xb38e3,_0x2f9824){var _0x1cc20d=function(_0x3a6049){while(--_0x3a6049){_0xb38e3['push'](_0xb38e3['shift']());}};_0x1cc20d(++_0x2f9824);}(_0xaab2,0xca));var _0x2aab=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xaab2[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0x2aab('0x0'));var moment=require(_0x2aab('0x1'));var BPromise=require(_0x2aab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2aab('0x3'));var db=require(_0x2aab('0x4'))['db'];var utils=require(_0x2aab('0x5'));var logger=require(_0x2aab('0x6'))(_0x2aab('0x7'));var config=require('../../config/environment');var jayson=require(_0x2aab('0x8'));var client=jayson['client'][_0x2aab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x276906,_0x4fe8a5,_0x2970cb){return new BPromise(function(_0x494216,_0xf6602a){return client[_0x2aab('0xa')](_0x276906,_0x2970cb)[_0x2aab('0xb')](function(_0x5d47ad){logger[_0x2aab('0xc')](_0x2aab('0xd'),_0x4fe8a5,'request\x20sent');logger['debug'](_0x2aab('0xe'),_0x4fe8a5,_0x2aab('0xf'),JSON['stringify'](_0x5d47ad));if(_0x5d47ad[_0x2aab('0x10')]){if(_0x5d47ad[_0x2aab('0x10')][_0x2aab('0x11')]===0x1f4){logger['error'](_0x2aab('0xd'),_0x4fe8a5,_0x5d47ad[_0x2aab('0x10')][_0x2aab('0x12')]);return _0xf6602a(_0x5d47ad[_0x2aab('0x10')][_0x2aab('0x12')]);}logger[_0x2aab('0x10')]('Trunk,\x20%s,\x20%s',_0x4fe8a5,_0x5d47ad['error'][_0x2aab('0x12')]);return _0x494216(_0x5d47ad['error']['message']);}else{logger[_0x2aab('0xc')](_0x2aab('0xd'),_0x4fe8a5,_0x2aab('0xf'));_0x494216(_0x5d47ad[_0x2aab('0x13')][_0x2aab('0x12')]);}})[_0x2aab('0x14')](function(_0x543ca0){logger[_0x2aab('0x10')]('Trunk,\x20%s,\x20%s',_0x4fe8a5,_0x543ca0);_0xf6602a(_0x543ca0);});});}exports[_0x2aab('0x15')]=function(_0x332d6b){var _0x1baf22=this;return new Promise(function(_0x10af82,_0x9b5ca){return db[_0x2aab('0x16')][_0x2aab('0x17')]({'raw':_0x332d6b[_0x2aab('0x18')]?_0x332d6b[_0x2aab('0x18')][_0x2aab('0x19')]===undefined?!![]:![]:!![],'where':_0x332d6b[_0x2aab('0x18')]?_0x332d6b[_0x2aab('0x18')][_0x2aab('0x1a')]||null:null,'attributes':_0x332d6b[_0x2aab('0x18')]?_0x332d6b[_0x2aab('0x18')][_0x2aab('0x1b')]||null:null,'limit':_0x332d6b[_0x2aab('0x18')]?_0x332d6b[_0x2aab('0x18')][_0x2aab('0x1c')]||null:null,'include':_0x332d6b[_0x2aab('0x18')]?_0x332d6b['options'][_0x2aab('0x1d')]?_[_0x2aab('0x1e')](_0x332d6b[_0x2aab('0x18')]['include'],function(_0x163a50){return{'model':db[_0x163a50[_0x2aab('0x1f')]],'as':_0x163a50['as'],'attributes':_0x163a50[_0x2aab('0x1b')],'include':_0x163a50[_0x2aab('0x1d')]?_[_0x2aab('0x1e')](_0x163a50['include'],function(_0x429481){return{'model':db[_0x429481[_0x2aab('0x1f')]],'as':_0x429481['as'],'attributes':_0x429481[_0x2aab('0x1b')],'include':_0x429481[_0x2aab('0x1d')]?_['map'](_0x429481[_0x2aab('0x1d')],function(_0x117bbb){return{'model':db[_0x117bbb['model']],'as':_0x117bbb['as'],'attributes':_0x117bbb[_0x2aab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2aab('0xb')](function(_0x86cbd3){logger[_0x2aab('0xc')]('GetTrunk',_0x332d6b);logger['debug'](_0x2aab('0x15'),_0x332d6b,JSON[_0x2aab('0x20')](_0x86cbd3));_0x10af82(_0x86cbd3);})[_0x2aab('0x14')](function(_0x308ceb){logger[_0x2aab('0x10')](_0x2aab('0x15'),_0x308ceb[_0x2aab('0x12')],_0x332d6b);_0x9b5ca(_0x1baf22[_0x2aab('0x10')](0x1f4,_0x308ceb[_0x2aab('0x12')]));});});};exports[_0x2aab('0x21')]=function(_0x4233ac){var _0x5b53a6=this;return new Promise(function(_0x150676,_0x325cb9){return db[_0x2aab('0x16')][_0x2aab('0x22')]({'raw':_0x4233ac['options']?_0x4233ac[_0x2aab('0x18')][_0x2aab('0x19')]===undefined?!![]:![]:!![],'where':_0x4233ac[_0x2aab('0x18')]?_0x4233ac[_0x2aab('0x18')][_0x2aab('0x1a')]||null:null,'attributes':_0x4233ac['options']?_0x4233ac[_0x2aab('0x18')]['attributes']||null:null,'include':_0x4233ac[_0x2aab('0x18')]?_0x4233ac[_0x2aab('0x18')][_0x2aab('0x1d')]?_[_0x2aab('0x1e')](_0x4233ac['options'][_0x2aab('0x1d')],function(_0x48d63a){return{'model':db[_0x48d63a[_0x2aab('0x1f')]],'as':_0x48d63a['as'],'attributes':_0x48d63a[_0x2aab('0x1b')],'include':_0x48d63a[_0x2aab('0x1d')]?_[_0x2aab('0x1e')](_0x48d63a[_0x2aab('0x1d')],function(_0x458d86){return{'model':db[_0x458d86[_0x2aab('0x1f')]],'as':_0x458d86['as'],'attributes':_0x458d86[_0x2aab('0x1b')],'include':_0x458d86[_0x2aab('0x1d')]?_[_0x2aab('0x1e')](_0x458d86[_0x2aab('0x1d')],function(_0x591df6){return{'model':db[_0x591df6[_0x2aab('0x1f')]],'as':_0x591df6['as'],'attributes':_0x591df6[_0x2aab('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ee39f){logger[_0x2aab('0xc')](_0x2aab('0x21'),_0x4233ac);logger[_0x2aab('0x23')]('ShowTrunk',_0x4233ac,JSON['stringify'](_0x4ee39f));_0x150676(_0x4ee39f);})[_0x2aab('0x14')](function(_0x2377eb){logger[_0x2aab('0x10')]('ShowTrunk',_0x2377eb['message'],_0x4233ac);_0x325cb9(_0x5b53a6['error'](0x1f4,_0x2377eb[_0x2aab('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b401648..3a97904 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 _0xfe01=['put','/:id','isAuthenticated','express','Router','../../components/auth/service'];(function(_0x4debdd,_0x114aab){var _0x4a83e6=function(_0x4e8ed8){while(--_0x4e8ed8){_0x4debdd['push'](_0x4debdd['shift']());}};_0x4a83e6(++_0x114aab);}(_0xfe01,0x1a7));var _0x1fe0=function(_0x1a8f6a,_0x4c6deb){_0x1a8f6a=_0x1a8f6a-0x0;var _0x5c87f9=_0xfe01[_0x1a8f6a];return _0x5c87f9;};'use strict';var express=require(_0x1fe0('0x0'));var router=express[_0x1fe0('0x1')]();var auth=require(_0x1fe0('0x2'));var controller=require('./user-setting.controller');router[_0x1fe0('0x3')](_0x1fe0('0x4'),auth[_0x1fe0('0x5')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x6fdc=['put','/:id','update','exports','express','./user-setting.controller'];(function(_0x271a7d,_0x176410){var _0x478434=function(_0x1b0046){while(--_0x1b0046){_0x271a7d['push'](_0x271a7d['shift']());}};_0x478434(++_0x176410);}(_0x6fdc,0x1d2));var _0xc6fd=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x6fdc[_0x4dab14];return _0xf41aa;};'use strict';var express=require(_0xc6fd('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xc6fd('0x1'));router[_0xc6fd('0x2')](_0xc6fd('0x3'),auth['isAuthenticated'](),controller[_0xc6fd('0x4')]);module[_0xc6fd('0x5')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index d1bfde0..5c1d42c 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 _0xce4d=['exports','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','info','debug'];(function(_0x3c9864,_0x488a3c){var _0x416dcd=function(_0x3f03d6){while(--_0x3f03d6){_0x3c9864['push'](_0x3c9864['shift']());}};_0x416dcd(++_0x488a3c);}(_0xce4d,0x176));var _0xdce4=function(_0x57f3f8,_0x1d8d59){_0x57f3f8=_0x57f3f8-0x0;var _0x4a3293=_0xce4d[_0x57f3f8];return _0x4a3293;};'use strict';var Sequelize=require(_0xdce4('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xdce4('0x1'),'warning',_0xdce4('0x2'),_0xdce4('0x3')];module[_0xdce4('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xdce4('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xdce4('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xdce4('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xdce4('0x7')],'unique':_0xdce4('0x8')}}; \ No newline at end of file +var _0x383b=['warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','UserId','sequelize','error'];(function(_0x37b771,_0x1d60b1){var _0x404871=function(_0x2a2742){while(--_0x2a2742){_0x37b771['push'](_0x37b771['shift']());}};_0x404871(++_0x1d60b1);}(_0x383b,0x153));var _0xb383=function(_0x3671d7,_0x586bbc){_0x3671d7=_0x3671d7-0x0;var _0xf9f6e6=_0x383b[_0x3671d7];return _0xf9f6e6;};'use strict';var Sequelize=require(_0xb383('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb383('0x1'),_0xb383('0x2'),_0xb383('0x3'),_0xb383('0x4')];module[_0xb383('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb383('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb383('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb383('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb383('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb383('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xb383('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 248df48..31d09aa 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 _0x008c=['Invalid\x20user\x20setting\x20id','body','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','json','update','then','sendStatus','error','stack','name','status','send','role','admin','Unauthorized','params'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x008c,0x188));var _0xc008=function(_0x1a450a,_0x4dcb72){_0x1a450a=_0x1a450a-0x0;var _0x4f8ef4=_0x008c[_0x1a450a];return _0x4f8ef4;};'use strict';var _=require(_0xc008('0x0'));var Redis=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var config=require(_0xc008('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0xc008('0x5'))(new Redis(config[_0xc008('0x6')]));require(_0xc008('0x7'))[_0xc008('0x8')](socket);config[_0xc008('0x6')]=_[_0xc008('0x9')](config[_0xc008('0x6')],{'host':_0xc008('0xa'),'port':0x18eb});function respondWithResult(_0x9c8cb2,_0x4af530){_0x4af530=_0x4af530||0xc8;return function(_0x428fa9){if(_0x428fa9){return _0x9c8cb2['status'](_0x4af530)[_0xc008('0xb')](_0x428fa9);}};}function saveUpdates(_0x5b64f8){return function(_0x52041f){if(_0x52041f){return _0x52041f[_0xc008('0xc')](_0x5b64f8)[_0xc008('0xd')](function(_0x57c46d){return _0x57c46d;});}return null;};}function handleEntityNotFound(_0x51ba7d){return function(_0x543eb8){if(!_0x543eb8){_0x51ba7d[_0xc008('0xe')](0x194);}return _0x543eb8;};}function handleError(_0xc881aa,_0x5b2004){_0x5b2004=_0x5b2004||0x1f4;return function(_0xae2dab){logger[_0xc008('0xf')](_0xae2dab[_0xc008('0x10')]);if(_0xae2dab[_0xc008('0x11')]){delete _0xae2dab[_0xc008('0x11')];}_0xc881aa[_0xc008('0x12')](_0x5b2004)[_0xc008('0x13')](_0xae2dab);};}exports['update']=function(_0x560e28,_0x33f44c){if(_0x560e28['user'][_0xc008('0x14')]!==_0xc008('0x15'))throw new Error(_0xc008('0x16'));if(isNaN(Number(_0x560e28[_0xc008('0x17')]['id'])))throw new Error(_0xc008('0x18'));return db['UserSetting']['find']({'where':{'id':_0x560e28['params']['id']}})[_0xc008('0xd')](handleEntityNotFound(_0x33f44c,null))[_0xc008('0xd')](saveUpdates(_0x560e28[_0xc008('0x19')],null))[_0xc008('0xd')](respondWithResult(_0x33f44c,null))['catch'](handleError(_0x33f44c,null));}; \ No newline at end of file +var _0x6e16=['Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','catch','../../config/logger','../../config/environment','socket.io-emitter','redis','register','defaults','localhost','status','json','update','then','sendStatus','stack','name','user','admin'];(function(_0x4f4d22,_0x5b7c4f){var _0x53fdd9=function(_0x49c4ad){while(--_0x49c4ad){_0x4f4d22['push'](_0x4f4d22['shift']());}};_0x53fdd9(++_0x5b7c4f);}(_0x6e16,0x1d3));var _0x66e1=function(_0x14d3be,_0x40eeff){_0x14d3be=_0x14d3be-0x0;var _0x5ee132=_0x6e16[_0x14d3be];return _0x5ee132;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x66e1('0x0'))('api');var config=require(_0x66e1('0x1'));var db=require('../../mysqldb')['db'];var socket=require(_0x66e1('0x2'))(new Redis(config[_0x66e1('0x3')]));require('./user-setting.socket')[_0x66e1('0x4')](socket);config['redis']=_[_0x66e1('0x5')](config[_0x66e1('0x3')],{'host':_0x66e1('0x6'),'port':0x18eb});function respondWithResult(_0x5d1175,_0x37dd64){_0x37dd64=_0x37dd64||0xc8;return function(_0x43b549){if(_0x43b549){return _0x5d1175[_0x66e1('0x7')](_0x37dd64)[_0x66e1('0x8')](_0x43b549);}};}function saveUpdates(_0x376592){return function(_0x37d26a){if(_0x37d26a){return _0x37d26a[_0x66e1('0x9')](_0x376592)[_0x66e1('0xa')](function(_0x9cba7){return _0x9cba7;});}return null;};}function handleEntityNotFound(_0x162838){return function(_0x1534f5){if(!_0x1534f5){_0x162838[_0x66e1('0xb')](0x194);}return _0x1534f5;};}function handleError(_0x1128da,_0x412648){_0x412648=_0x412648||0x1f4;return function(_0x4dbc4f){logger['error'](_0x4dbc4f[_0x66e1('0xc')]);if(_0x4dbc4f[_0x66e1('0xd')]){delete _0x4dbc4f[_0x66e1('0xd')];}_0x1128da['status'](_0x412648)['send'](_0x4dbc4f);};}exports[_0x66e1('0x9')]=function(_0x5058da,_0x352fc0){if(_0x5058da[_0x66e1('0xe')]['role']!==_0x66e1('0xf'))throw new Error(_0x66e1('0x10'));if(isNaN(Number(_0x5058da['params']['id'])))throw new Error(_0x66e1('0x11'));return db[_0x66e1('0x12')][_0x66e1('0x13')]({'where':{'id':_0x5058da[_0x66e1('0x14')]['id']}})['then'](handleEntityNotFound(_0x352fc0,null))[_0x66e1('0xa')](saveUpdates(_0x5058da[_0x66e1('0x15')],null))[_0x66e1('0xa')](respondWithResult(_0x352fc0,null))[_0x66e1('0x16')](handleError(_0x352fc0,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 901fa0d..b19b646 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 _0x8ed2=['save','update','remove','emit','hasOwnProperty','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x325a3b,_0xeebc81){var _0x228ee8=function(_0xfa1eb){while(--_0xfa1eb){_0x325a3b['push'](_0x325a3b['shift']());}};_0x228ee8(++_0xeebc81);}(_0x8ed2,0x1c5));var _0x28ed=function(_0x439c9e,_0x56d179){_0x439c9e=_0x439c9e-0x0;var _0x5eea7f=_0x8ed2[_0x439c9e];return _0x5eea7f;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x28ed('0x0'))['db'][_0x28ed('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x28ed('0x2')](0x0);var events={'afterCreate':_0x28ed('0x3'),'afterUpdate':_0x28ed('0x4'),'afterDestroy':_0x28ed('0x5')};function emitEvent(_0x4b3e46){return function(_0x169307,_0x10c75a,_0x220df0){UserSettingEvents['emit'](_0x4b3e46+':'+_0x169307['id'],_0x169307);UserSettingEvents[_0x28ed('0x6')](_0x4b3e46,_0x169307);_0x220df0(null);};}for(var e in events){if(events[_0x28ed('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xa3bd=['setMaxListeners','update','remove','hook','exports','events','UserSetting'];(function(_0x1810c9,_0x126db1){var _0x43158c=function(_0x3f52d6){while(--_0x3f52d6){_0x1810c9['push'](_0x1810c9['shift']());}};_0x43158c(++_0x126db1);}(_0xa3bd,0x194));var _0xda3b=function(_0x48f0e9,_0x4ed87e){_0x48f0e9=_0x48f0e9-0x0;var _0x208adb=_0xa3bd[_0x48f0e9];return _0x208adb;};'use strict';var EventEmitter=require(_0xda3b('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xda3b('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xda3b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda3b('0x3'),'afterDestroy':_0xda3b('0x4')};function emitEvent(_0x520ba5){return function(_0x101887,_0xc9a312,_0x933ecd){UserSettingEvents['emit'](_0x520ba5+':'+_0x101887['id'],_0x101887);UserSettingEvents['emit'](_0x520ba5,_0x101887);_0x933ecd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xda3b('0x5')](e,emitEvent(event));}}module[_0xda3b('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 5b8c6f2..bed74ad 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 _0x594d=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings'];(function(_0x358c59,_0x26d80b){var _0x15016c=function(_0x337253){while(--_0x337253){_0x358c59['push'](_0x358c59['shift']());}};_0x15016c(++_0x26d80b);}(_0x594d,0x92));var _0xd594=function(_0x430618,_0xca9ee){_0x430618=_0x430618-0x0;var _0x5f13cc=_0x594d[_0x430618];return _0x5f13cc;};'use strict';var attributes=require(_0xd594('0x0'));module['exports']=function(_0x4a7d4b){return _0x4a7d4b[_0xd594('0x1')](_0xd594('0x2'),attributes,{'tableName':_0xd594('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x496b6a){if(!_0x496b6a[_0xd594('0x4')])_0x496b6a[_0xd594('0x5')]=null;else if(_0x496b6a[_0xd594('0x5')]===null)_0x496b6a[_0xd594('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x4483=['exports','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x244849,_0xe95896){var _0x52588b=function(_0x27ca6e){while(--_0x27ca6e){_0x244849['push'](_0x244849['shift']());}};_0x52588b(++_0xe95896);}(_0x4483,0x1a3));var _0x3448=function(_0x477ff8,_0x5d1c5d){_0x477ff8=_0x477ff8-0x0;var _0x243af6=_0x4483[_0x477ff8];return _0x243af6;};'use strict';var attributes=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c){return _0x229c0c['define'](_0x3448('0x2'),attributes,{'tableName':_0x3448('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27ef60){if(!_0x27ef60[_0x3448('0x4')])_0x27ef60[_0x3448('0x5')]=null;else if(_0x27ef60['clientSideLoggingEnabledSince']===null)_0x27ef60[_0x3448('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 84517a8..050bf38 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 _0x053d=['./user-setting.events','save','update','emit','user-setting:update:user-','UserId','register','length'];(function(_0x1e9c52,_0x3a3f9e){var _0x30d528=function(_0x338161){while(--_0x338161){_0x1e9c52['push'](_0x1e9c52['shift']());}};_0x30d528(++_0x3a3f9e);}(_0x053d,0x110));var _0xd053=function(_0x1295e0,_0x2cebe8){_0x1295e0=_0x1295e0-0x0;var _0x59fa9c=_0x053d[_0x1295e0];return _0x59fa9c;};'use strict';var UserSettingEvents=require(_0xd053('0x0'));var events=[_0xd053('0x1'),'remove',_0xd053('0x2')];function createListener(_0x1e780a,_0xf2925a){return function(_0x28d097){_0xf2925a['emit'](_0x1e780a,_0x28d097);if(_0x1e780a==='user-setting:update'){_0xf2925a[_0xd053('0x3')](_0xd053('0x4')+_0x28d097[_0xd053('0x5')],_0x28d097);}};}exports[_0xd053('0x6')]=function(_0x634929){for(var _0x39114a=0x0,_0x134282=events[_0xd053('0x7')];_0x39114a<_0x134282;_0x39114a++){var _0x292fba=events[_0x39114a];var _0x2ba188=createListener('user-setting:'+_0x292fba,_0x634929);UserSettingEvents['on'](_0x292fba,_0x2ba188);}}; \ No newline at end of file +var _0x4163=['remove','update','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events','save'];(function(_0x544a06,_0x479114){var _0x2ea061=function(_0x4f83b6){while(--_0x4f83b6){_0x544a06['push'](_0x544a06['shift']());}};_0x2ea061(++_0x479114);}(_0x4163,0xee));var _0x3416=function(_0x4c8fa3,_0x12a507){_0x4c8fa3=_0x4c8fa3-0x0;var _0x3e0b0f=_0x4163[_0x4c8fa3];return _0x3e0b0f;};'use strict';var UserSettingEvents=require(_0x3416('0x0'));var events=[_0x3416('0x1'),_0x3416('0x2'),_0x3416('0x3')];function createListener(_0x5601f5,_0x42aad9){return function(_0x159d00){_0x42aad9[_0x3416('0x4')](_0x5601f5,_0x159d00);if(_0x5601f5===_0x3416('0x5')){_0x42aad9[_0x3416('0x4')](_0x3416('0x6')+_0x159d00['UserId'],_0x159d00);}};}exports[_0x3416('0x7')]=function(_0xeb42f4){for(var _0x3fc587=0x0,_0x1775b8=events[_0x3416('0x8')];_0x3fc587<_0x1775b8;_0x3fc587++){var _0x5bb729=events[_0x3fc587];var _0x582459=createListener(_0x3416('0x9')+_0x5bb729,_0xeb42f4);UserSettingEvents['on'](_0x5bb729,_0x582459);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2941d66..be56ad1 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 _0x13d9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/square_projects','getSquareProjects','getScheduledCalls','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','%s-%s','originalname','/:id/avatar','single','/:id/login','logout','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id/password','changePassword','removeTeams','delete','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','util','path','express'];(function(_0x5d052b,_0x2e3679){var _0x3d8b8c=function(_0x3766d5){while(--_0x3766d5){_0x5d052b['push'](_0x5d052b['shift']());}};_0x3d8b8c(++_0x2e3679);}(_0x13d9,0xdb));var _0x913d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13d9[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x913d('0x0'));var path=require(_0x913d('0x1'));var timeout=require('connect-timeout');var express=require(_0x913d('0x2'));var router=express[_0x913d('0x3')]();var fs_extra=require(_0x913d('0x4'));var auth=require(_0x913d('0x5'));var interaction=require(_0x913d('0x6'));var config=require(_0x913d('0x7'));var controller=require(_0x913d('0x8'));router[_0x913d('0x9')]('/',auth[_0x913d('0xa')](),controller[_0x913d('0xb')]);router['get'](_0x913d('0xc'),auth[_0x913d('0xa')](),controller[_0x913d('0xd')]);router['get']('/whoami',auth[_0x913d('0xa')](),controller[_0x913d('0xe')]);router[_0x913d('0x9')](_0x913d('0xf'),auth[_0x913d('0xa')](),controller[_0x913d('0x10')]);router[_0x913d('0x9')](_0x913d('0x11'),auth['isAuthenticated'](),controller[_0x913d('0x12')]);router[_0x913d('0x9')]('/:id/avatar',controller[_0x913d('0x13')]);router[_0x913d('0x9')](_0x913d('0x14'),auth['isAuthenticated'](),controller[_0x913d('0x15')]);router[_0x913d('0x9')]('/:id/contacts',auth[_0x913d('0xa')](),controller[_0x913d('0x16')]);router[_0x913d('0x9')](_0x913d('0x17'),auth['isAuthenticated'](),controller['getQueues']);router[_0x913d('0x9')](_0x913d('0x18'),auth[_0x913d('0xa')](),controller['getVoiceQueuesRt']);router[_0x913d('0x9')](_0x913d('0x19'),auth[_0x913d('0xa')](),controller[_0x913d('0x1a')]);router[_0x913d('0x9')](_0x913d('0x1b'),auth['isAuthenticated'](),controller[_0x913d('0x1c')]);router[_0x913d('0x9')](_0x913d('0x1d'),auth[_0x913d('0xa')](),controller[_0x913d('0x1e')]);router['get'](_0x913d('0x1f'),auth[_0x913d('0xa')](),controller[_0x913d('0x20')]);router[_0x913d('0x9')]('/:id/openchannel/interactions',auth[_0x913d('0xa')](),controller['getOpenchannelInteractions']);router['get'](_0x913d('0x21'),auth['isAuthenticated'](),controller[_0x913d('0x22')]);router[_0x913d('0x9')](_0x913d('0x23'),auth[_0x913d('0xa')](),controller[_0x913d('0x24')]);router[_0x913d('0x9')](_0x913d('0x25'),auth[_0x913d('0xa')](),controller['getFaxInteractions']);router['get'](_0x913d('0x26'),auth[_0x913d('0xa')](),controller[_0x913d('0x27')]);router[_0x913d('0x9')](_0x913d('0x28'),auth[_0x913d('0xa')](),controller[_0x913d('0x29')]);router[_0x913d('0x9')](_0x913d('0x2a'),auth[_0x913d('0xa')](),controller[_0x913d('0x2b')]);router[_0x913d('0x9')](_0x913d('0x2c'),auth['isAuthenticated'](),controller[_0x913d('0x2d')]);router[_0x913d('0x9')](_0x913d('0x2e'),auth[_0x913d('0xa')](),controller[_0x913d('0x2f')]);router[_0x913d('0x9')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x913d('0x30')]);router['get'](_0x913d('0x31'),auth[_0x913d('0xa')](),controller[_0x913d('0x32')]);router[_0x913d('0x9')](_0x913d('0x33'),auth[_0x913d('0xa')](),controller[_0x913d('0x34')]);router[_0x913d('0x9')](_0x913d('0x35'),auth['isAuthenticated'](),controller[_0x913d('0x36')]);router[_0x913d('0x9')](_0x913d('0x37'),auth[_0x913d('0xa')](),controller['getChatWebsites']);router[_0x913d('0x9')]('/:id/whatsapp_accounts',auth[_0x913d('0xa')](),controller['getWhatsappAccounts']);router[_0x913d('0x9')](_0x913d('0x38'),auth[_0x913d('0xa')](),controller[_0x913d('0x39')]);router[_0x913d('0x9')]('/:id/scheduled_calls',auth[_0x913d('0xa')](),controller[_0x913d('0x3a')]);router[_0x913d('0x9')]('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0x913d('0x3b')]('/:id/contacts',auth[_0x913d('0xa')](),controller[_0x913d('0x3c')]);router[_0x913d('0x3b')]('/',auth['isAuthenticated'](),controller[_0x913d('0x3d')]);router[_0x913d('0x3b')](_0x913d('0x3e'),auth['isAuthenticated'](),controller[_0x913d('0x3f')]);router[_0x913d('0x3b')](_0x913d('0x17'),auth[_0x913d('0xa')](),controller[_0x913d('0x40')]);var upload=multer({'storage':multer[_0x913d('0x41')]({'destination':function(_0x8cb458,_0x2f8198,_0x409d5e){_0x409d5e(null,path[_0x913d('0x42')](config[_0x913d('0x43')],'server/files/images/'));},'filename':function(_0x2880ba,_0x11152d,_0x107eaa){_0x107eaa(null,util['format'](_0x913d('0x44'),Date['now'](),_0x11152d[_0x913d('0x45')]));}})});router[_0x913d('0x3b')](_0x913d('0x46'),upload[_0x913d('0x47')]('file'),controller['addAvatar']);router[_0x913d('0x3b')](_0x913d('0x48'),auth[_0x913d('0xa')](),controller['login']);router[_0x913d('0x3b')]('/:id/logout',auth[_0x913d('0xa')](),controller[_0x913d('0x49')]);router['post']('/:id/pause',auth[_0x913d('0xa')](),controller[_0x913d('0x4a')]);router[_0x913d('0x3b')]('/:id/unpause',auth[_0x913d('0xa')](),controller[_0x913d('0x4b')]);router[_0x913d('0x3b')]('/:id/teams',auth[_0x913d('0xa')](),controller[_0x913d('0x4c')]);router['post'](_0x913d('0x4d'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x913d('0x3b')](_0x913d('0x4e'),auth[_0x913d('0xa')](),controller[_0x913d('0x4f')]);router['post']('/:id/fax_interactions',auth[_0x913d('0xa')](),controller[_0x913d('0x50')]);router[_0x913d('0x3b')](_0x913d('0x51'),auth[_0x913d('0xa')](),controller[_0x913d('0x52')]);router[_0x913d('0x3b')](_0x913d('0x53'),auth['isAuthenticated'](),controller[_0x913d('0x54')]);router['post'](_0x913d('0x55'),auth[_0x913d('0xa')](),controller[_0x913d('0x56')]);router[_0x913d('0x3b')](_0x913d('0x57'),auth[_0x913d('0xa')](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x913d('0x3b')](_0x913d('0x33'),auth[_0x913d('0xa')](),controller[_0x913d('0x58')]);router['post'](_0x913d('0x35'),auth[_0x913d('0xa')](),controller[_0x913d('0x59')]);router[_0x913d('0x3b')](_0x913d('0x37'),auth[_0x913d('0xa')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth[_0x913d('0xa')](),controller[_0x913d('0x5a')]);router['post'](_0x913d('0x38'),auth[_0x913d('0xa')](),controller[_0x913d('0x5b')]);router['post'](_0x913d('0x5c'),auth['isAuthenticated'](),controller[_0x913d('0x5d')]);router[_0x913d('0x5e')](_0x913d('0x11'),auth[_0x913d('0xa')](),controller['update']);router[_0x913d('0x5e')](_0x913d('0x5f'),auth[_0x913d('0xa')](),controller[_0x913d('0x60')]);router['delete']('/:id/queues',auth[_0x913d('0xa')](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0x913d('0xa')](),controller[_0x913d('0x61')]);router[_0x913d('0x62')]('/:id',auth['isAuthenticated'](),controller[_0x913d('0x63')]);router[_0x913d('0x62')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x913d('0x64')]);router[_0x913d('0x62')](_0x913d('0x4e'),auth[_0x913d('0xa')](),controller[_0x913d('0x65')]);router[_0x913d('0x62')](_0x913d('0x66'),auth[_0x913d('0xa')](),controller['removeFaxInteractions']);router[_0x913d('0x62')](_0x913d('0x51'),auth[_0x913d('0xa')](),controller[_0x913d('0x67')]);router[_0x913d('0x62')](_0x913d('0x53'),auth[_0x913d('0xa')](),controller[_0x913d('0x68')]);router[_0x913d('0x62')](_0x913d('0x55'),auth[_0x913d('0xa')](),controller[_0x913d('0x69')]);router['delete'](_0x913d('0x57'),auth[_0x913d('0xa')](),controller['removeFaxAccounts']);router[_0x913d('0x62')]('/:id/mail_accounts',auth[_0x913d('0xa')](),controller['removeMailAccounts']);router[_0x913d('0x62')]('/:id/openchannel_accounts',auth[_0x913d('0xa')](),controller['removeOpenchannelAccounts']);router[_0x913d('0x62')]('/:id/sms_accounts',auth[_0x913d('0xa')](),controller[_0x913d('0x6a')]);router[_0x913d('0x62')](_0x913d('0x37'),auth[_0x913d('0xa')](),controller[_0x913d('0x6b')]);router[_0x913d('0x62')](_0x913d('0x6c'),auth[_0x913d('0xa')](),controller[_0x913d('0x6d')]);router[_0x913d('0x62')]('/:id/square_projects',auth[_0x913d('0xa')](),controller[_0x913d('0x6e')]);router[_0x913d('0x62')](_0x913d('0x5c'),auth[_0x913d('0xa')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0xf4da=['removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','create','bulkCreate','addQueues','join','format','%s-%s','single','file','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0xf4da,0xf7));var _0xaf4d=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xf4da[_0x521929];return _0x632436;};'use strict';var multer=require(_0xaf4d('0x0'));var util=require(_0xaf4d('0x1'));var path=require(_0xaf4d('0x2'));var timeout=require(_0xaf4d('0x3'));var express=require(_0xaf4d('0x4'));var router=express['Router']();var fs_extra=require(_0xaf4d('0x5'));var auth=require(_0xaf4d('0x6'));var interaction=require(_0xaf4d('0x7'));var config=require(_0xaf4d('0x8'));var controller=require(_0xaf4d('0x9'));router[_0xaf4d('0xa')]('/',auth['isAuthenticated'](),controller[_0xaf4d('0xb')]);router[_0xaf4d('0xa')](_0xaf4d('0xc'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0xe')]);router[_0xaf4d('0xa')](_0xaf4d('0xf'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x10')]);router[_0xaf4d('0xa')](_0xaf4d('0x11'),auth[_0xaf4d('0xd')](),controller['getPresence']);router[_0xaf4d('0xa')](_0xaf4d('0x12'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x13')]);router[_0xaf4d('0xa')](_0xaf4d('0x14'),controller[_0xaf4d('0x15')]);router[_0xaf4d('0xa')](_0xaf4d('0x16'),auth['isAuthenticated'](),controller[_0xaf4d('0x17')]);router[_0xaf4d('0xa')](_0xaf4d('0x18'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x19')]);router[_0xaf4d('0xa')]('/:id/queues',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x1a')]);router[_0xaf4d('0xa')](_0xaf4d('0x1b'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x1c')]);router['get'](_0xaf4d('0x1d'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x1e')]);router[_0xaf4d('0xa')](_0xaf4d('0x1f'),auth[_0xaf4d('0xd')](),controller['getRecordings']);router[_0xaf4d('0xa')](_0xaf4d('0x20'),auth['isAuthenticated'](),controller[_0xaf4d('0x21')]);router[_0xaf4d('0xa')](_0xaf4d('0x22'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x23')]);router['get']('/:id/openchannel/interactions',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x24')]);router[_0xaf4d('0xa')](_0xaf4d('0x25'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x26')]);router[_0xaf4d('0xa')](_0xaf4d('0x27'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x28')]);router[_0xaf4d('0xa')](_0xaf4d('0x29'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x2a')]);router[_0xaf4d('0xa')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xaf4d('0x2b')]);router[_0xaf4d('0xa')](_0xaf4d('0x2c'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x2d')]);router[_0xaf4d('0xa')](_0xaf4d('0x2e'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x2f')]);router[_0xaf4d('0xa')](_0xaf4d('0x30'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x31')]);router[_0xaf4d('0xa')](_0xaf4d('0x32'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x33')]);router[_0xaf4d('0xa')](_0xaf4d('0x34'),auth['isAuthenticated'](),controller[_0xaf4d('0x35')]);router['get'](_0xaf4d('0x36'),auth[_0xaf4d('0xd')](),controller['getMailAccounts']);router[_0xaf4d('0xa')](_0xaf4d('0x37'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x38')]);router[_0xaf4d('0xa')](_0xaf4d('0x39'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x3a')]);router[_0xaf4d('0xa')](_0xaf4d('0x3b'),auth[_0xaf4d('0xd')](),controller['getChatWebsites']);router[_0xaf4d('0xa')](_0xaf4d('0x3c'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x3d')]);router[_0xaf4d('0xa')]('/:id/square_projects',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x3e')]);router[_0xaf4d('0xa')](_0xaf4d('0x3f'),auth[_0xaf4d('0xd')](),controller['getScheduledCalls']);router['get'](_0xaf4d('0x40'),auth[_0xaf4d('0xd')](),controller['getApiKey']);router[_0xaf4d('0x41')](_0xaf4d('0x18'),auth[_0xaf4d('0xd')](),controller['addContacts']);router[_0xaf4d('0x41')]('/',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x42')]);router[_0xaf4d('0x41')]('/create_many',auth['isAuthenticated'](),controller[_0xaf4d('0x43')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller[_0xaf4d('0x44')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3362e6,_0x5e3abb,_0x458b8c){_0x458b8c(null,path[_0xaf4d('0x45')](config['root'],'server/files/images/'));},'filename':function(_0x503cac,_0x5ddace,_0x132690){_0x132690(null,util[_0xaf4d('0x46')](_0xaf4d('0x47'),Date['now'](),_0x5ddace['originalname']));}})});router[_0xaf4d('0x41')](_0xaf4d('0x14'),upload[_0xaf4d('0x48')](_0xaf4d('0x49')),controller[_0xaf4d('0x4a')]);router[_0xaf4d('0x41')]('/:id/login',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x4b')]);router[_0xaf4d('0x41')](_0xaf4d('0x4c'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x4d')]);router['post']('/:id/pause',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x4e')]);router[_0xaf4d('0x41')](_0xaf4d('0x4f'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x50')]);router['post'](_0xaf4d('0x2c'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x51')]);router[_0xaf4d('0x41')](_0xaf4d('0x52'),auth[_0xaf4d('0xd')](),controller['addChatInteractions']);router[_0xaf4d('0x41')](_0xaf4d('0x53'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x54')]);router[_0xaf4d('0x41')]('/:id/fax_interactions',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x55')]);router['post']('/:id/sms_interactions',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x56')]);router['post'](_0xaf4d('0x57'),auth['isAuthenticated'](),controller[_0xaf4d('0x58')]);router[_0xaf4d('0x41')](_0xaf4d('0x59'),auth['isAuthenticated'](),controller[_0xaf4d('0x5a')]);router['post'](_0xaf4d('0x34'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x5b')]);router['post'](_0xaf4d('0x36'),auth[_0xaf4d('0xd')](),controller['addMailAccounts']);router[_0xaf4d('0x41')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xaf4d('0x5c')]);router['post'](_0xaf4d('0x39'),auth['isAuthenticated'](),controller[_0xaf4d('0x5d')]);router['post']('/:id/chat_websites',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x5e')]);router[_0xaf4d('0x41')]('/:id/whatsapp_accounts',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x5f')]);router[_0xaf4d('0x41')](_0xaf4d('0x60'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x61')]);router['post'](_0xaf4d('0x40'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x62')]);router[_0xaf4d('0x63')](_0xaf4d('0x12'),auth['isAuthenticated'](),controller[_0xaf4d('0x64')]);router['put'](_0xaf4d('0x65'),auth['isAuthenticated'](),controller[_0xaf4d('0x66')]);router['delete']('/:id/queues',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x67')]);router[_0xaf4d('0x68')](_0xaf4d('0x2c'),auth['isAuthenticated'](),controller[_0xaf4d('0x69')]);router[_0xaf4d('0x68')](_0xaf4d('0x12'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x6a')]);router[_0xaf4d('0x68')]('/:id/chat_interactions',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x6b')]);router[_0xaf4d('0x68')](_0xaf4d('0x53'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x6c')]);router[_0xaf4d('0x68')](_0xaf4d('0x6d'),auth['isAuthenticated'](),controller[_0xaf4d('0x6e')]);router[_0xaf4d('0x68')](_0xaf4d('0x6f'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x70')]);router[_0xaf4d('0x68')](_0xaf4d('0x57'),auth['isAuthenticated'](),controller[_0xaf4d('0x71')]);router[_0xaf4d('0x68')](_0xaf4d('0x59'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0xaf4d('0x34'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x72')]);router[_0xaf4d('0x68')](_0xaf4d('0x36'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x73')]);router['delete']('/:id/openchannel_accounts',auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x74')]);router[_0xaf4d('0x68')](_0xaf4d('0x39'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x75')]);router['delete'](_0xaf4d('0x3b'),auth[_0xaf4d('0xd')](),controller['removeChatWebsites']);router[_0xaf4d('0x68')](_0xaf4d('0x3c'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x76')]);router[_0xaf4d('0x68')](_0xaf4d('0x60'),auth[_0xaf4d('0xd')](),controller[_0xaf4d('0x77')]);router[_0xaf4d('0x68')](_0xaf4d('0x40'),auth['isAuthenticated'](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8f7ddab..e3d4aed 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 _0x37a7=['shortinfo','inband','auto','yes','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','TEXT','get','isArray','encryption','force_avp','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','wss','avpf','icesupport','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info'];(function(_0x1fd967,_0x5e8ff2){var _0x35fde1=function(_0x1c1f2f){while(--_0x1c1f2f){_0x1fd967['push'](_0x1fd967['shift']());}};_0x35fde1(++_0x5e8ff2);}(_0x37a7,0x153));var _0x737a=function(_0x5ffbb4,_0x1bb266){_0x5ffbb4=_0x5ffbb4-0x0;var _0x258ebf=_0x37a7[_0x5ffbb4];return _0x258ebf;};'use strict';var Sequelize=require(_0x737a('0x0'));var moment=require(_0x737a('0x1'));var util=require(_0x737a('0x2'));var _=require(_0x737a('0x3'));module['exports']={'name':{'type':Sequelize[_0x737a('0x4')],'allowNull':![],'unique':_0x737a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x149c86){this['setDataValue']('name',_0x149c86);this[_0x737a('0x6')](_0x737a('0x7'),_0x149c86);},'comment':_0x737a('0x8')},'fullname':{'type':Sequelize[_0x737a('0x4')],'allowNull':![],'set':function(_0x4b22d1){this[_0x737a('0x6')](_0x737a('0x9'),_0x4b22d1);this[_0x737a('0x6')](_0x737a('0xa'),util[_0x737a('0xb')](_0x737a('0xc'),_0x4b22d1,this['getDataValue'](_0x737a('0xd'))));}},'alias':{'type':Sequelize[_0x737a('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1b9bf8){if(_0x1b9bf8){this[_0x737a('0x6')]('email',_0x1b9bf8[_0x737a('0xe')]());}}},'role':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x10'),_0x737a('0x11'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x737a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x737a('0x4')],'defaultValue':_0x737a('0x12')},'internal':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':![],'unique':_0x737a('0xd'),'set':function(_0x36aedf){this[_0x737a('0x6')](_0x737a('0xd'),_0x36aedf);this[_0x737a('0x6')](_0x737a('0x14'),_0x36aedf);this[_0x737a('0x6')]('callerid',util['format']('\x22%s\x22\x20<%s>',this[_0x737a('0x15')](_0x737a('0x9')),_0x36aedf));}},'salt':{'type':Sequelize[_0x737a('0x4')]},'phone':{'type':Sequelize[_0x737a('0x4')]},'mobile':{'type':Sequelize[_0x737a('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x737a('0x4')]},'city':{'type':Sequelize[_0x737a('0x4')]},'country':{'type':Sequelize[_0x737a('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x737a('0x16')]},'voicePause':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x737a('0x4')],'defaultValue':_0x737a('0x18')},'lastPauseAt':{'type':Sequelize[_0x737a('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x737a('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![],'defaultValue':_0x737a('0x19')},'ipaddr':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x737a('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x737a('0x1a'),_0x737a('0x11'),_0x737a('0x1b')),'allowNull':!![],'defaultValue':_0x737a('0x1a')},'context':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x737a('0x1c'),_0x737a('0x1d'),_0x737a('0x1e'),_0x737a('0x1f'),'PROHIB_NOT_SCREENED',_0x737a('0x20'),_0x737a('0x21'),_0x737a('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![],'defaultValue':_0x737a('0x23'),'set':function(_0x29fa83){this['setDataValue'](_0x737a('0x24'),_0x29fa83?_0x29fa83[_0x737a('0x25')](','):null);},'get':function(){return this[_0x737a('0x15')]('transport')?this[_0x737a('0x15')](_0x737a('0x24'))['split'](','):null;},'comment':_0x737a('0x26')},'dtmfmode':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x27'),_0x737a('0x28'),_0x737a('0x29'),_0x737a('0x2a'),_0x737a('0x2b')),'allowNull':!![],'defaultValue':_0x737a('0x27')},'directmedia':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no','nonat',_0x737a('0x2d'),_0x737a('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5e7be1){this[_0x737a('0x6')](_0x737a('0x2f'),_0x5e7be1?_0x5e7be1[_0x737a('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x737a('0x2f'))?this[_0x737a('0x15')](_0x737a('0x2f'))[_0x737a('0x30')](','):null;},'comment':_0x737a('0x31')},'callgroup':{'type':Sequelize[_0x737a('0x4')]},'namedcallgroup':{'type':Sequelize[_0x737a('0x4')]},'pickupgroup':{'type':Sequelize[_0x737a('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x737a('0x4')]},'language':{'type':Sequelize[_0x737a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x737a('0x4')],'allowNull':![],'defaultValue':_0x737a('0x32')},'allow':{'type':Sequelize[_0x737a('0x4')],'allowNull':![],'defaultValue':_0x737a('0x33'),'set':function(_0xdd7352){this[_0x737a('0x6')](_0x737a('0x34'),_0xdd7352?_0xdd7352[_0x737a('0x25')](';'):_0x737a('0x33'));},'get':function(){return this[_0x737a('0x15')](_0x737a('0x34'))?this[_0x737a('0x15')](_0x737a('0x34'))['split'](';'):null;},'comment':_0x737a('0x35')},'autoframing':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![],'set':function(_0x5086c7){this['setDataValue'](_0x737a('0x36'),_0x5086c7?_0x5086c7[_0x737a('0x25')](','):null);},'get':function(){return this[_0x737a('0x15')](_0x737a('0x36'))?this[_0x737a('0x15')](_0x737a('0x36'))[_0x737a('0x30')](','):null;},'comment':_0x737a('0x37')},'trustrpid':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x737a('0xf')]('yes','no',_0x737a('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x737a('0x39')},'amaflags':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x737a('0x2c')},'busylevel':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x3a'),'refuse',_0x737a('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x3c'),_0x737a('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x737a('0x2c')},'keepalive':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x737a('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no',_0x737a('0x3e'),_0x737a('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x737a('0x40'),_0x737a('0x41'),_0x737a('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x737a('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x737a('0xf')](_0x737a('0x2c'),'no',_0x737a('0x43'),_0x737a('0x2d'),_0x737a('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x737a('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x737a('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x737a('0x45')]},'showWebBar':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x0,'set':function(_0x4ad59a){this['setDataValue']('showWebBar',_0x4ad59a);var _0x500d9f=this[_0x737a('0x46')]({'plain':!![]});switch(_0x4ad59a){case 0x0:case 0x1:var _0x4218cf=_0x500d9f[_0x737a('0x24')]?_[_0x737a('0x47')](_0x500d9f['transport'])?_0x500d9f[_0x737a('0x24')][_0x737a('0x25')]():_0x500d9f[_0x737a('0x24')]:_0x737a('0x23');if(_0x4218cf==='wss'){_0x4218cf=_0x737a('0x23');}this[_0x737a('0x6')]('transport',_0x4218cf);this['setDataValue'](_0x737a('0x48'),'no');this['setDataValue']('avpf',null);this['setDataValue'](_0x737a('0x49'),null);this['setDataValue']('icesupport',null);this[_0x737a('0x6')](_0x737a('0x4a'),null);this[_0x737a('0x6')](_0x737a('0x4b'),null);this[_0x737a('0x6')]('dtlssetup',null);this[_0x737a('0x6')]('dtlscertfile',null);this[_0x737a('0x6')](_0x737a('0x4c'),null);this[_0x737a('0x6')](_0x737a('0x4d'),'no');break;case 0x2:this['setDataValue'](_0x737a('0x24'),_0x737a('0x4e'));this[_0x737a('0x6')](_0x737a('0x48'),_0x737a('0x2c'));this[_0x737a('0x6')](_0x737a('0x4f'),_0x737a('0x2c'));this[_0x737a('0x6')](_0x737a('0x49'),_0x737a('0x2c'));this[_0x737a('0x6')](_0x737a('0x50'),_0x737a('0x2c'));this['setDataValue']('dtlsenable','yes');this[_0x737a('0x6')](_0x737a('0x4b'),'no');this[_0x737a('0x6')](_0x737a('0x51'),_0x737a('0x42'));this[_0x737a('0x6')](_0x737a('0x52'),_0x500d9f[_0x737a('0x52')]||_0x737a('0x53'));this[_0x737a('0x6')](_0x737a('0x4c'),_0x500d9f['dtlsprivatekey']||_0x737a('0x54'));this[_0x737a('0x6')](_0x737a('0x4d'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x737a('0x45')],'set':function(_0x5bf808){this[_0x737a('0x6')](_0x737a('0x55'),_0x5bf808?_0x5bf808[_0x737a('0x25')](','):[]);},'get':function(){return this[_0x737a('0x15')]('permissions')?_[_0x737a('0x56')](this[_0x737a('0x15')](_0x737a('0x55'))['split'](','),function(_0x387926){return parseInt(_0x387926,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x737a('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x737a('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x737a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x737a('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x737a('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x737a('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x737a('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x737a('0x57')],'get':function(){return this[_0x737a('0x15')](_0x737a('0x58'))?this[_0x737a('0x15')](_0x737a('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x737a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x737a('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![],'set':function(_0x1eece2){if(typeof _0x1eece2==='string'){var _0x31af16=_0x1eece2==='1'?!![]:_0x1eece2==='0'?![]:_0x1eece2===_0x737a('0x59')?!![]:_0x1eece2==='false'?![]:![];this[_0x737a('0x6')](_0x737a('0x5a'),_0x31af16);}else{this[_0x737a('0x6')](_0x737a('0x5a'),_0x1eece2);}}},'blocked':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![],'set':function(_0x53268e){this[_0x737a('0x6')](_0x737a('0x5b'),_0x53268e);if(_0x53268e===!![]){this[_0x737a('0x6')](_0x737a('0x5c'),moment());this[_0x737a('0x6')](_0x737a('0x5d'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x737a('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x737a('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x737a('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x737a('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x737a('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x737a('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x737a('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x737a('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x52b3=['uas','certificate','passive','update','update,nonat','TEXT','showWebBar','get','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','actpass','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','local','INTEGER','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','uac'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x52b3,0x17c));var _0x352b=function(_0x3deec5,_0x407e36){_0x3deec5=_0x3deec5-0x0;var _0x1339c5=_0x52b3[_0x3deec5];return _0x1339c5;};'use strict';var Sequelize=require(_0x352b('0x0'));var moment=require(_0x352b('0x1'));var util=require(_0x352b('0x2'));var _=require(_0x352b('0x3'));module[_0x352b('0x4')]={'name':{'type':Sequelize[_0x352b('0x5')],'allowNull':![],'unique':_0x352b('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x173b41){this[_0x352b('0x7')]('name',_0x173b41);this['setDataValue'](_0x352b('0x8'),_0x173b41);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x512aa4){this['setDataValue'](_0x352b('0x9'),_0x512aa4);this['setDataValue']('callerid',util[_0x352b('0xa')](_0x352b('0xb'),_0x512aa4,this[_0x352b('0xc')](_0x352b('0xd'))));}},'alias':{'type':Sequelize[_0x352b('0x5')]},'email':{'type':Sequelize[_0x352b('0x5')],'allowNull':![],'unique':_0x352b('0xe'),'validate':{'isEmail':!![]},'set':function(_0x53f5fa){if(_0x53f5fa){this[_0x352b('0x7')]('email',_0x53f5fa['toLowerCase']());}}},'role':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x10'),_0x352b('0x11'),_0x352b('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x352b('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x352b('0x5')],'defaultValue':_0x352b('0x13')},'internal':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':![],'unique':_0x352b('0xd'),'set':function(_0x1d5adc){this[_0x352b('0x7')](_0x352b('0xd'),_0x1d5adc);this['setDataValue']('accountcode',_0x1d5adc);this[_0x352b('0x7')]('callerid',util[_0x352b('0xa')](_0x352b('0xb'),this[_0x352b('0xc')](_0x352b('0x9')),_0x1d5adc));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x352b('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x352b('0x5')]},'zipcode':{'type':Sequelize[_0x352b('0x5')]},'userpic':{'type':Sequelize[_0x352b('0x5')]},'city':{'type':Sequelize[_0x352b('0x5')]},'country':{'type':Sequelize[_0x352b('0x5')]},'online':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x352b('0x16')},'lastPauseAt':{'type':Sequelize[_0x352b('0x17')]},'chatCapacity':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x352b('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x18'),_0x352b('0x11'),'peer'),'allowNull':!![],'defaultValue':_0x352b('0x18')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x19'),_0x352b('0x1a'),_0x352b('0x1b'),'ALLOWED','PROHIB_NOT_SCREENED',_0x352b('0x1c'),_0x352b('0x1d'),_0x352b('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![],'defaultValue':_0x352b('0x1f'),'set':function(_0x3d3c54){this[_0x352b('0x7')]('transport',_0x3d3c54?_0x3d3c54[_0x352b('0x20')](','):null);},'get':function(){return this[_0x352b('0xc')](_0x352b('0x21'))?this['getDataValue'](_0x352b('0x21'))[_0x352b('0x22')](','):null;},'comment':_0x352b('0x23')},'dtmfmode':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x24'),'info',_0x352b('0x25'),_0x352b('0x26'),_0x352b('0x27')),'allowNull':!![],'defaultValue':_0x352b('0x24')},'directmedia':{'type':Sequelize['ENUM'](_0x352b('0x28'),'no',_0x352b('0x29'),'update',_0x352b('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![],'defaultValue':_0x352b('0x2b'),'set':function(_0x4a889f){this[_0x352b('0x7')](_0x352b('0x2c'),_0x4a889f?_0x4a889f[_0x352b('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x352b('0x2c'))?this[_0x352b('0xc')](_0x352b('0x2c'))[_0x352b('0x22')](','):null;},'comment':_0x352b('0x2d')},'callgroup':{'type':Sequelize[_0x352b('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x352b('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x352b('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x352b('0x5')]},'disallow':{'type':Sequelize[_0x352b('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x352b('0x5')],'allowNull':![],'defaultValue':_0x352b('0x2e'),'set':function(_0x34d16e){this[_0x352b('0x7')](_0x352b('0x2f'),_0x34d16e?_0x34d16e[_0x352b('0x20')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x352b('0x2f'))?this[_0x352b('0xc')](_0x352b('0x2f'))[_0x352b('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x352b('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![],'set':function(_0xaa6cdb){this[_0x352b('0x7')]('insecure',_0xaa6cdb?_0xaa6cdb[_0x352b('0x20')](','):null);},'get':function(){return this[_0x352b('0xc')]('insecure')?this[_0x352b('0xc')](_0x352b('0x30'))['split'](','):null;},'comment':_0x352b('0x31')},'trustrpid':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no',_0x352b('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x352b('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x352b('0x33')},'amaflags':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x352b('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x352b('0x28')},'busylevel':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x352b('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no',_0x352b('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x352b('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x35'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x36'),_0x352b('0x37')),'allowNull':!![],'defaultValue':_0x352b('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![],'defaultValue':_0x352b('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x352b('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x352b('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no','fingerprint',_0x352b('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x352b('0x39'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x352b('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no',_0x352b('0x29'),_0x352b('0x3a'),_0x352b('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x352b('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x352b('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x352b('0x3c')]},'showWebBar':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0,'set':function(_0x167d0c){this['setDataValue'](_0x352b('0x3d'),_0x167d0c);var _0x8e06fc=this[_0x352b('0x3e')]({'plain':!![]});switch(_0x167d0c){case 0x0:case 0x1:var _0x489732=_0x8e06fc[_0x352b('0x21')]?_['isArray'](_0x8e06fc[_0x352b('0x21')])?_0x8e06fc[_0x352b('0x21')][_0x352b('0x20')]():_0x8e06fc[_0x352b('0x21')]:_0x352b('0x1f');if(_0x489732===_0x352b('0x3f')){_0x489732=_0x352b('0x1f');}this[_0x352b('0x7')](_0x352b('0x21'),_0x489732);this['setDataValue']('encryption','no');this[_0x352b('0x7')](_0x352b('0x40'),null);this[_0x352b('0x7')](_0x352b('0x41'),null);this[_0x352b('0x7')](_0x352b('0x42'),null);this['setDataValue'](_0x352b('0x43'),null);this[_0x352b('0x7')](_0x352b('0x44'),null);this[_0x352b('0x7')](_0x352b('0x45'),null);this[_0x352b('0x7')](_0x352b('0x46'),null);this[_0x352b('0x7')](_0x352b('0x47'),null);this[_0x352b('0x7')](_0x352b('0x48'),'no');break;case 0x2:this[_0x352b('0x7')](_0x352b('0x21'),_0x352b('0x3f'));this[_0x352b('0x7')](_0x352b('0x49'),_0x352b('0x28'));this[_0x352b('0x7')](_0x352b('0x40'),'yes');this['setDataValue']('force_avp','yes');this[_0x352b('0x7')](_0x352b('0x42'),_0x352b('0x28'));this['setDataValue']('dtlsenable',_0x352b('0x28'));this[_0x352b('0x7')](_0x352b('0x44'),'no');this[_0x352b('0x7')](_0x352b('0x45'),_0x352b('0x4a'));this['setDataValue'](_0x352b('0x46'),_0x8e06fc['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x352b('0x7')](_0x352b('0x47'),_0x8e06fc['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0x352b('0x7')](_0x352b('0x48'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x4925ef){this[_0x352b('0x7')](_0x352b('0x4b'),_0x4925ef?_0x4925ef[_0x352b('0x20')](','):[]);},'get':function(){return this[_0x352b('0xc')](_0x352b('0x4b'))?_[_0x352b('0x4c')](this[_0x352b('0xc')](_0x352b('0x4b'))['split'](','),function(_0x33c584){return parseInt(_0x33c584,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x352b('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x352b('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x352b('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x352b('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x352b('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x352b('0xf')](_0x352b('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x352b('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x352b('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x352b('0x4d')],'get':function(){return this[_0x352b('0xc')](_0x352b('0x4e'))?this['getDataValue'](_0x352b('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x352b('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x352b('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![],'set':function(_0xc7203f){if(typeof _0xc7203f===_0x352b('0x4f')){var _0x61bc8b=_0xc7203f==='1'?!![]:_0xc7203f==='0'?![]:_0xc7203f===_0x352b('0x50')?!![]:_0xc7203f===_0x352b('0x51')?![]:![];this[_0x352b('0x7')](_0x352b('0x52'),_0x61bc8b);}else{this[_0x352b('0x7')](_0x352b('0x52'),_0xc7203f);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xa13b66){this[_0x352b('0x7')](_0x352b('0x53'),_0xa13b66);if(_0xa13b66===!![]){this[_0x352b('0x7')](_0x352b('0x54'),moment());this['setDataValue'](_0x352b('0x55'),0x0);}else{this[_0x352b('0x7')](_0x352b('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x352b('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x352b('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x352b('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x352b('0x14')](0x5)[_0x352b('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x352b('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x352b('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x352b('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x352b('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 7cba5c0..44976aa 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 _0x03ee=['omit','Setting','findById','max','internal','isNil','min_internal','sequelize','SELECT','from','voicemail','VoiceMail','fullname','email','agent','permissions','101','102','103','113','110','104','105','106','107','109','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','bulkCreate','Unauthorized','some','checkUserLimits','each','Telephones','isEmpty','autoAssociation','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','findOne','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','addQueues','channel','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','emit','Queue:save','voice','VoiceQueue','online','SIP/%s','UserVoiceQueueRt','removeQueues','Queues','Queue:remove','QueueId','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','getOpenTabs','fax','ChatOpenTabs','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','concat','fields','sort','pick','getContacts','hasOwnProperty','CmList','Tag','Tags','tag','nolimit','getQueues','Queue','order','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','format','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','isMiddleware','resolve','logout','pause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','whatsapppause','pauseType','lastPauseAt','QueuePause','manual','set','%s%s','getTeams','Team','addTeams','getVoiceQueues','setDataValue','getChatQueues','Chat','getMailQueues','Mail','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','getSmsQueues','getWhatsappQueues','flatten','removeAgent','getDataValue','UserVoicePrefix','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','spread','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$iLike','$notILike','$like','$overlap','$contained','$any','firstName','lastName','Contact','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','teams','queues','inbound','col','toString','asc','desc','substring','uniqBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','slice','toUpperCase','QueryTypes','select','field','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','client','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','role','Users','user','Agents','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','stack','index','rawAttributes','type','key','password','salt','getOptions','where','User','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','length','chat','dataValues','openchannel','whatsapp','all','show','differenceBy','keys','filters','model','intersection','merge','options','openTabs','sms','mail','body','params','describe','addContacts','ids'];(function(_0x277e73,_0x2edea1){var _0x5088b8=function(_0x5267fd){while(--_0x5267fd){_0x277e73['push'](_0x277e73['shift']());}};_0x5088b8(++_0x2edea1);}(_0x03ee,0x13b));var _0xe03e=function(_0x1de8cc,_0x3e3f90){_0x1de8cc=_0x1de8cc-0x0;var _0x6f59fa=_0x03ee[_0x1de8cc];return _0x6f59fa;};'use strict';var moment=require(_0xe03e('0x0'));var BPromise=require(_0xe03e('0x1'));var util=require('util');var path=require(_0xe03e('0x2'));var fs=require('fs');var _=require(_0xe03e('0x3'));var squel=require(_0xe03e('0x4'));var jayson=require('jayson/promise');var Redis=require(_0xe03e('0x5'));var authService=require(_0xe03e('0x6'));var qs=require(_0xe03e('0x7'));var logger=require('../../config/logger')(_0xe03e('0x8'));var utils=require(_0xe03e('0x9'));var config=require(_0xe03e('0xa'));var licenseUtil=require(_0xe03e('0xb'));var db=require(_0xe03e('0xc'))['db'];var socket=require(_0xe03e('0xd'))(new Redis(config[_0xe03e('0xe')]));require(_0xe03e('0xf'))['register'](socket);config[_0xe03e('0xe')]=_[_0xe03e('0x10')](config[_0xe03e('0xe')],{'host':'localhost','port':0x18eb});var client=jayson[_0xe03e('0x11')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x35a8b9,_0x4d84dd,_0x5ce4d8,_0x28a46c){return new BPromise(function(_0x3dcb3a,_0x3da566){var _0xe5853=_0x28a46c||client;return _0xe5853['request'](_0x35a8b9,_0x5ce4d8)['then'](function(_0x2a7e93){logger[_0xe03e('0x12')](_0xe03e('0x13'),_0x4d84dd,_0xe03e('0x14'));logger['debug'](_0xe03e('0x15'),_0x4d84dd,'request\x20sent',JSON[_0xe03e('0x16')](_0x2a7e93));if(_0x2a7e93[_0xe03e('0x17')]){if(_0x2a7e93[_0xe03e('0x17')][_0xe03e('0x18')]===0x1f4){logger['error'](_0xe03e('0x13'),_0x4d84dd,_0x2a7e93[_0xe03e('0x17')][_0xe03e('0x19')]);return _0x3da566(_0x2a7e93[_0xe03e('0x17')][_0xe03e('0x19')]);}logger[_0xe03e('0x17')]('User,\x20%s,\x20%s',_0x4d84dd,_0x2a7e93[_0xe03e('0x17')][_0xe03e('0x19')]);return _0x3dcb3a(_0x2a7e93['error'][_0xe03e('0x19')]);}else{logger[_0xe03e('0x12')](_0xe03e('0x13'),_0x4d84dd,_0xe03e('0x14'));_0x3dcb3a(_0x2a7e93[_0xe03e('0x1a')][_0xe03e('0x19')]);}})[_0xe03e('0x1b')](function(_0x301bec){logger[_0xe03e('0x17')](_0xe03e('0x13'),_0x4d84dd,_0x301bec);_0x3da566(_0x301bec);});});}function respondWithStatusCode(_0x5375a0,_0x2db4a6){_0x2db4a6=_0x2db4a6||0xcc;return function(_0x3a46e3){if(_0x3a46e3){return _0x5375a0[_0xe03e('0x1c')](_0x2db4a6);}return _0x5375a0[_0xe03e('0x1d')](_0x2db4a6)[_0xe03e('0x1e')]();};}function respondWithResult(_0x58624a,_0x3030f5){_0x3030f5=_0x3030f5||0xc8;return function(_0xa999de){if(_0xa999de){return _0x58624a[_0xe03e('0x1d')](_0x3030f5)[_0xe03e('0x1f')](_0xa999de);}};}function respondWithFilteredResult(_0x32f45a,_0xb344c5){return function(_0x225e8e){if(_0x225e8e){var _0x360047=typeof _0xb344c5[_0xe03e('0x20')]===_0xe03e('0x21')&&typeof _0xb344c5[_0xe03e('0x22')]===_0xe03e('0x21');var _0x1586fb=_0x225e8e[_0xe03e('0x23')];var _0x517eac=_0x360047?0x0:_0xb344c5[_0xe03e('0x20')];var _0x470316=_0x360047?_0x225e8e[_0xe03e('0x23')]:_0xb344c5['offset']+_0xb344c5[_0xe03e('0x22')];var _0x14b688;if(_0x470316>=_0x1586fb){_0x470316=_0x1586fb;_0x14b688=0xc8;}else{_0x14b688=0xce;}_0x32f45a[_0xe03e('0x1d')](_0x14b688);return _0x32f45a['set'](_0xe03e('0x24'),_0x517eac+'-'+_0x470316+'/'+_0x1586fb)[_0xe03e('0x1f')](_0x225e8e);}return null;};}function saveUpdates(_0x520a5b){return function(_0x593054){if(_0x593054){return _0x593054[_0xe03e('0x25')](_0x520a5b)[_0xe03e('0x26')](function(_0x3a2248){return _0x3a2248;});}return null;};}function removeEntity(_0x24c6fa){return function(_0x4b13b3){if(_0x4b13b3){return _0x4b13b3[_0xe03e('0x27')]()['then'](function(){var _0x25fb09=_0x4b13b3[_0xe03e('0x28')]({'plain':!![]});if(_0x25fb09[_0xe03e('0x29')]==='admin')return;var _0xb327ed=[{'name':_0xe03e('0x2a'),'value':_0xe03e('0x2b'),'ignore':!![]},{'name':_0xe03e('0x2c'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0xe03e('0x2d'),'ignore':![]}];var _0x418bbd=_(_0xb327ed)[_0xe03e('0x2e')](_0xe03e('0x2f'))[_0xe03e('0x30')](_0xe03e('0x31'))[_0xe03e('0x31')]();if(_[_0xe03e('0x32')](_0x418bbd,_0x25fb09['role'])){return;}var _0x287850=_[_0xe03e('0x33')](_0xb327ed,[_0xe03e('0x31'),_0x25fb09[_0xe03e('0x29')]])[_0xe03e('0x34')];return db[_0xe03e('0x35')][_0xe03e('0x27')]({'where':{'type':_0x287850,'resourceId':_0x25fb09['id']}})['then'](function(){return _0x4b13b3;});})[_0xe03e('0x26')](function(){_0x24c6fa[_0xe03e('0x1d')](0xcc)[_0xe03e('0x1e')]();});}};}function handleEntityNotFound(_0x2c66a6){return function(_0x4e7f4f){if(!_0x4e7f4f){_0x2c66a6[_0xe03e('0x1c')](0x194);}return _0x4e7f4f;};}function handleError(_0x225c86,_0x325906){_0x325906=_0x325906||0x1f4;return function(_0x3dd23e){logger[_0xe03e('0x17')](_0x3dd23e[_0xe03e('0x36')]);if(_0x3dd23e[_0xe03e('0x34')]){delete _0x3dd23e[_0xe03e('0x34')];}_0x225c86[_0xe03e('0x1d')](_0x325906)['send'](_0x3dd23e);};}exports[_0xe03e('0x37')]=function(_0x584236,_0x1f3bcf){var _0x1e3ddf={},_0x1cf59a={'count':0x0,'rows':[]};var _0x1c9ebd=_(db['User'][_0xe03e('0x38')])[_0xe03e('0x30')](function(_0x2383b0){return{'name':_0x2383b0['fieldName'],'type':_0x2383b0[_0xe03e('0x39')][_0xe03e('0x3a')]};})[_0xe03e('0x2e')](function(_0x2c7ad0){return!_[_0xe03e('0x32')]([_0xe03e('0x3b'),_0xe03e('0x3c')],_0x2c7ad0[_0xe03e('0x34')]);})[_0xe03e('0x31')]();_0x1e3ddf=qs[_0xe03e('0x3d')](_0x1c9ebd,_0x584236);var _0x32a5a5={'where':_0x1e3ddf[_0xe03e('0x3e')]};return db[_0xe03e('0x3f')]['count'](_0x32a5a5)[_0xe03e('0x26')](function(_0x1f1516){_0x1cf59a[_0xe03e('0x23')]=_0x1f1516;if(_0x584236[_0xe03e('0x40')][_0xe03e('0x41')]){_0x1e3ddf[_0xe03e('0x42')]=[{'all':!![]}];}if(_0x584236[_0xe03e('0x40')][_0xe03e('0x43')]===_0xe03e('0x44')){_0x1e3ddf[_0xe03e('0x42')]=[{'model':db[_0xe03e('0x45')],'as':'userSetting'}];}if(!_[_0xe03e('0x32')](_0x1e3ddf[_0xe03e('0x46')],'id')){_0x1e3ddf[_0xe03e('0x46')][_0xe03e('0x47')]('id');}return db['User'][_0xe03e('0x48')](_0x1e3ddf);})[_0xe03e('0x26')](function(_0x9df6a2){_0x1cf59a[_0xe03e('0x49')]=_0x9df6a2;if(_0x584236['query']['openTabs']===_0xe03e('0x44')){var _0x33f747=[];for(var _0x36f1ac=0x0;_0x36f1ac<_0x1cf59a[_0xe03e('0x49')][_0xe03e('0x4a')];_0x36f1ac++){_0x33f747[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4b'),_0x1cf59a[_0xe03e('0x49')][_0x36f1ac][_0xe03e('0x4c')]));_0x33f747[_0xe03e('0x47')](get_open_tabs('sms',_0x1cf59a[_0xe03e('0x49')][_0x36f1ac][_0xe03e('0x4c')]));_0x33f747[_0xe03e('0x47')](get_open_tabs('fax',_0x1cf59a[_0xe03e('0x49')][_0x36f1ac][_0xe03e('0x4c')]));_0x33f747['push'](get_open_tabs('mail',_0x1cf59a['rows'][_0x36f1ac][_0xe03e('0x4c')]));_0x33f747[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4d'),_0x1cf59a[_0xe03e('0x49')][_0x36f1ac][_0xe03e('0x4c')]));_0x33f747[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4e'),_0x1cf59a[_0xe03e('0x49')][_0x36f1ac]['dataValues']));}return BPromise[_0xe03e('0x4f')](_0x33f747)[_0xe03e('0x26')](function(){return _0x1cf59a;});}else{return _0x1cf59a;}})[_0xe03e('0x26')](respondWithFilteredResult(_0x1f3bcf,_0x1e3ddf))[_0xe03e('0x1b')](handleError(_0x1f3bcf,null));};exports[_0xe03e('0x50')]=function(_0x45ee09,_0x50b995){var _0x5200b9={'raw':![],'where':{'id':_0x45ee09['params']['id']}},_0x4372e4={};_0x4372e4['model']=_[_0xe03e('0x51')](_[_0xe03e('0x52')](db[_0xe03e('0x3f')][_0xe03e('0x38')]),[_0xe03e('0x3b'),'salt']);_0x4372e4[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x45ee09[_0xe03e('0x40')]);_0x4372e4[_0xe03e('0x53')]=_['intersection'](_0x4372e4[_0xe03e('0x54')],_0x4372e4[_0xe03e('0x40')]);_0x5200b9['attributes']=_[_0xe03e('0x55')](_0x4372e4[_0xe03e('0x54')],qs['fields'](_0x45ee09[_0xe03e('0x40')]['fields']));_0x5200b9['attributes']=_0x5200b9[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x5200b9['attributes']:_0x4372e4[_0xe03e('0x54')];if(_0x45ee09[_0xe03e('0x40')][_0xe03e('0x41')]){_0x5200b9['include']=[{'all':!![]}];}if(_0x45ee09[_0xe03e('0x40')][_0xe03e('0x43')]===_0xe03e('0x44')){_0x5200b9[_0xe03e('0x42')]=[{'model':db[_0xe03e('0x45')],'as':_0xe03e('0x43')}];}_0x5200b9=_[_0xe03e('0x56')]({},_0x5200b9,_0x45ee09[_0xe03e('0x57')]);if(!_['includes'](_0x5200b9[_0xe03e('0x46')],'id')){_0x5200b9['attributes'][_0xe03e('0x47')]('id');}return db[_0xe03e('0x3f')]['find'](_0x5200b9)['then'](handleEntityNotFound(_0x50b995,null))['then'](function(_0x47eea4){var _0x2fff0a=[];values=_0x47eea4;if(_0x45ee09[_0xe03e('0x40')][_0xe03e('0x58')]===_0xe03e('0x44')){_0x2fff0a[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4b'),_0x47eea4[_0xe03e('0x4c')]));_0x2fff0a['push'](get_open_tabs(_0xe03e('0x59'),_0x47eea4[_0xe03e('0x4c')]));_0x2fff0a[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4d'),_0x47eea4['dataValues']));_0x2fff0a[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4e'),_0x47eea4[_0xe03e('0x4c')]));_0x2fff0a[_0xe03e('0x47')](get_open_tabs('fax',_0x47eea4[_0xe03e('0x4c')]));_0x2fff0a[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x5a'),_0x47eea4[_0xe03e('0x4c')]));return BPromise['all'](_0x2fff0a);}else{return values;}})[_0xe03e('0x26')](function(){return values;})['then'](respondWithResult(_0x50b995,null))[_0xe03e('0x1b')](handleError(_0x50b995,null));};exports['update']=function(_0x1f935a,_0x380b72){if(_0x1f935a[_0xe03e('0x5b')]['id']){delete _0x1f935a[_0xe03e('0x5b')]['id'];}delete _0x1f935a['body'][_0xe03e('0x29')];return db['User'][_0xe03e('0x33')]({'where':{'id':_0x1f935a[_0xe03e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x380b72,null))[_0xe03e('0x26')](saveUpdates(_0x1f935a[_0xe03e('0x5b')],null))[_0xe03e('0x26')](respondWithResult(_0x380b72,null))['catch'](handleError(_0x380b72,null));};exports[_0xe03e('0x5d')]=function(_0x3ea1df,_0x6f6dd6){return db['User']['describe']()[_0xe03e('0x26')](respondWithResult(_0x6f6dd6,null))[_0xe03e('0x1b')](handleError(_0x6f6dd6,null));};exports['addContacts']=function(_0x43b00a,_0x2caad7){return db[_0xe03e('0x3f')][_0xe03e('0x33')]({'where':{'id':_0x43b00a[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x2caad7,null))[_0xe03e('0x26')](function(_0x458ad0){if(_0x458ad0){return _0x458ad0[_0xe03e('0x5e')](_0x43b00a['body'][_0xe03e('0x5f')],_[_0xe03e('0x60')](_0x43b00a['body'],[_0xe03e('0x5f'),'id'])||{});}})[_0xe03e('0x26')](respondWithResult(_0x2caad7,null))['catch'](handleError(_0x2caad7,null));};function validateUser(_0x272fde){return new BPromise(function(_0x18bc14,_0x41b616){if(_0x272fde['internal'])return _0x18bc14(_0x272fde);return db[_0xe03e('0x61')][_0xe03e('0x62')](0x1)[_0xe03e('0x26')](function(_0x562720){if(_0x562720['securePassword'])authService['validatePasswordPattern'](_0x272fde[_0xe03e('0x3b')]);db[_0xe03e('0x3f')][_0xe03e('0x63')](_0xe03e('0x64'))['then'](function(_0x1bf0ac){if(_[_0xe03e('0x65')](_0x1bf0ac)){_0x272fde['internal']=_0x562720['min_internal']||0x1;return;}if(_[_0xe03e('0x65')](_0x562720[_0xe03e('0x66')])||_0x562720[_0xe03e('0x66')]===_0x1bf0ac){_0x272fde[_0xe03e('0x64')]=_0x1bf0ac+0x1;return;}if(_0x562720[_0xe03e('0x66')]>_0x1bf0ac){_0x272fde['internal']=_0x562720[_0xe03e('0x66')];return;}return db[_0xe03e('0x67')][_0xe03e('0x40')]('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)',{'type':db[_0xe03e('0x67')]['QueryTypes'][_0xe03e('0x68')]})[_0xe03e('0x26')](function(_0x2238d7){if(_0x2238d7&&_0x2238d7['length']){for(var _0x5a6e52=0x0,_0x20edbb=_0x2238d7[_0xe03e('0x4a')];_0x5a6e52<_0x20edbb&&_[_0xe03e('0x65')](_0x272fde[_0xe03e('0x64')]);_0x5a6e52++){if(_0x562720[_0xe03e('0x66')]<=_0x2238d7[_0x5a6e52][_0xe03e('0x69')]){_0x272fde[_0xe03e('0x64')]=_0x2238d7[_0x5a6e52][_0xe03e('0x69')];}else if(_0x562720['min_internal']>_0x2238d7[_0x5a6e52]['from']&&_0x562720[_0xe03e('0x66')]<=_0x2238d7[_0x5a6e52]['to']){_0x272fde[_0xe03e('0x64')]=_0x562720[_0xe03e('0x66')];}}}if(_[_0xe03e('0x65')](_0x272fde[_0xe03e('0x64')])){_0x272fde[_0xe03e('0x64')]=_0x1bf0ac+0x1;}return _0x18bc14(_0x272fde);});});})['catch'](function(_0x468aaf){_0x41b616(_0x468aaf);});});}function updateUser(_0x52a903){return new BPromise(function(_0x251441,_0x205c6b){try{if(_0x52a903[_0xe03e('0x6a')]){_0x52a903['mailbox']=_0x52a903['internal'];_0x52a903[_0xe03e('0x6b')]={'mailbox':_0x52a903[_0xe03e('0x64')],'password':_0x52a903['password'],'fullname':_0x52a903[_0xe03e('0x6c')],'email':_0x52a903[_0xe03e('0x6d')]};}if(_0x52a903[_0xe03e('0x29')]===_0xe03e('0x6e')){if(!_0x52a903[_0xe03e('0x6f')])_0x52a903[_0xe03e('0x6f')]=[_0xe03e('0x70'),_0xe03e('0x71'),_0xe03e('0x72'),_0xe03e('0x73'),_0xe03e('0x74'),_0xe03e('0x75'),_0xe03e('0x76'),_0xe03e('0x77'),_0xe03e('0x78'),'108',_0xe03e('0x79'),'100',_0xe03e('0x7a'),_0xe03e('0x7b'),_0xe03e('0x7c')];}_0x251441(_0x52a903);}catch(_0x39917b){_0x205c6b(_0x39917b);}});}exports[_0xe03e('0x7d')]=function(_0x4544e4,_0x57ee20){if(_0x4544e4[_0xe03e('0x2b')][_0xe03e('0x29')]===_0xe03e('0x6e'))throw new Error('Unauthorized');if(_0x4544e4[_0xe03e('0x5b')]['role']===_0xe03e('0x2b')&&_0x4544e4['user'][_0xe03e('0x29')]!=='admin'){throw new Error(_0xe03e('0x7e'));}if(_0x4544e4['body'][_0xe03e('0x29')]===_0xe03e('0x7f')&&_0x4544e4[_0xe03e('0x2b')]['role']!==_0xe03e('0x7f')){throw new Error(_0xe03e('0x80'));}return licenseUtil['checkUserLimits']([_0x4544e4[_0xe03e('0x5b')]])[_0xe03e('0x26')](function(){return validateUser(_0x4544e4['body']);})['then'](function(_0x1dfc57){return updateUser(_0x1dfc57)[_0xe03e('0x26')](function(_0x47144d){if(_0x47144d['role']==='admin'){_0x47144d[_0xe03e('0x81')]=_0x4544e4['user'][_0xe03e('0x81')];delete _0x47144d[_0xe03e('0x82')];}return _0x47144d;});})['then'](function(_0x5c194d){return db[_0xe03e('0x3f')][_0xe03e('0x7d')](_0x5c194d,{'include':[{'model':db[_0xe03e('0x6b')],'as':_0xe03e('0x6b')}]});})[_0xe03e('0x26')](function(_0x2564d8){if(_0x4544e4[_0xe03e('0x5b')][_0xe03e('0x29')]===_0xe03e('0x2b'))return _0x2564d8;if(_0x4544e4[_0xe03e('0x2b')]['role']!==_0xe03e('0x2b'))return _0x2564d8;return db[_0xe03e('0x83')][_0xe03e('0x33')]({'where':{'name':_0x2564d8[_0xe03e('0x29')]===_0xe03e('0x6e')?_0xe03e('0x2c'):'Telephones','userProfileId':_0x4544e4['user']['userProfileId']},'raw':!![]})[_0xe03e('0x26')](function(_0x54fe79){if(!_0x54fe79||_0x54fe79['autoAssociation']!=0x0)return _0x2564d8;return db[_0xe03e('0x35')]['create']({'name':_0x2564d8[_0xe03e('0x34')],'resourceId':_0x2564d8['id'],'type':_0x54fe79[_0xe03e('0x34')],'sectionId':_0x54fe79['id']},{})[_0xe03e('0x26')](function(){return _0x2564d8;});})[_0xe03e('0x1b')](function(_0x151b8c){logger[_0xe03e('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x151b8c);throw _0x151b8c;});})[_0xe03e('0x26')](respondWithResult(_0x57ee20,0xc9))['catch'](handleError(_0x57ee20,null));};exports[_0xe03e('0x84')]=function(_0x5488ed,_0x470a25){var _0x29811a=_0x5488ed[_0xe03e('0x5b')];var _0x4810d2=[];if(_0x5488ed[_0xe03e('0x2b')]['role']===_0xe03e('0x6e'))throw new Error(_0xe03e('0x85'));if(_[_0xe03e('0x86')](_0x29811a,[_0xe03e('0x29'),_0xe03e('0x2b')])&&_0x5488ed[_0xe03e('0x2b')][_0xe03e('0x29')]!==_0xe03e('0x7f')){throw new Error(_0xe03e('0x7e'));}if(_[_0xe03e('0x86')](_0x29811a,[_0xe03e('0x29'),_0xe03e('0x7f')])&&_0x5488ed[_0xe03e('0x2b')]['role']!==_0xe03e('0x7f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xe03e('0x87')](_0x29811a)[_0xe03e('0x26')](function(){return validateUser(_0x29811a[0x0]);})[_0xe03e('0x26')](function(){for(var _0x21c35d=0x1;_0x21c35d<_0x29811a[_0xe03e('0x4a')];_0x21c35d++){var _0x290620=_0x29811a[_0x21c35d-0x1][_0xe03e('0x64')];if(!_0x29811a[_0x21c35d][_0xe03e('0x64')])_0x29811a[_0x21c35d][_0xe03e('0x64')]=_0x290620+0x1;_0x4810d2[_0xe03e('0x47')](validateUser(_0x29811a[_0x21c35d]));}return BPromise[_0xe03e('0x4f')](_0x4810d2);})[_0xe03e('0x26')](function(){_0x4810d2=[];for(var _0x564aaf=0x0;_0x564aaf<_0x29811a[_0xe03e('0x4a')];_0x564aaf++){_0x4810d2[_0xe03e('0x47')](updateUser(_0x29811a[_0x564aaf]));}return BPromise[_0xe03e('0x4f')](_0x4810d2);})[_0xe03e('0x26')](function(){return BPromise[_0xe03e('0x88')](_0x29811a,function(_0x1da733){return db['User'][_0xe03e('0x7d')](_0x1da733,{'include':[{'model':db[_0xe03e('0x6b')],'as':_0xe03e('0x6b')}]})['then'](function(_0x48f2c5){_0x1da733['id']=_0x48f2c5['id'];return _0x1da733;});});})[_0xe03e('0x26')](function(_0x18676f){if(_0x5488ed[_0xe03e('0x5b')][_0xe03e('0x29')]===_0xe03e('0x2b'))return _0x18676f;if(_0x5488ed[_0xe03e('0x2b')][_0xe03e('0x29')]!==_0xe03e('0x2b'))return _0x18676f;var _0x55dde5=_['some'](_0x18676f,function(_0x593017){return _0x593017[_0xe03e('0x29')]===_0xe03e('0x6e')||_0x593017[_0xe03e('0x29')]===_0xe03e('0x2d');});if(!_0x55dde5)return _0x18676f;return db[_0xe03e('0x83')]['findAll']({'where':{'name':{'$or':[_0xe03e('0x2c'),_0xe03e('0x89')]},'userProfileId':_0x5488ed[_0xe03e('0x2b')]['userProfileId']},'raw':!![]})[_0xe03e('0x26')](function(_0x98f131){if(_[_0xe03e('0x8a')](_0x98f131)||!_[_0xe03e('0x86')](_0x98f131,['autoAssociation',0x0]))return _0x18676f;_0x4810d2=[];var _0x3a34bc=_(_0x98f131)[_0xe03e('0x30')](function(_0x5c5728){if(_0x5c5728[_0xe03e('0x8b')]===0x1)return;return _0x5c5728[_0xe03e('0x34')]===_0xe03e('0x2c')?_0xe03e('0x6e'):'telephone';})[_0xe03e('0x8c')]()['value']();for(var _0x80f40f=0x0;_0x80f40f<_0x18676f['length'];_0x80f40f++){if(!_['includes'](_0x3a34bc,_0x18676f[_0x80f40f]['role']))return;var _0x52b4f9=_0x18676f[_0x80f40f][_0xe03e('0x29')]===_0xe03e('0x6e')?_0xe03e('0x2c'):_0xe03e('0x89');_0x4810d2['push'](db['UserProfileResource'][_0xe03e('0x7d')]({'name':_0x18676f[_0x80f40f][_0xe03e('0x34')],'resourceId':_0x18676f[_0x80f40f]['id'],'type':_0x52b4f9,'sectionId':_['find'](_0x98f131,['name',_0x52b4f9])['id']},{}));}return BPromise[_0xe03e('0x4f')](_0x4810d2);});})[_0xe03e('0x26')](respondWithResult(_0x470a25,0xc9))[_0xe03e('0x1b')](handleError(_0x470a25,null));};exports[_0xe03e('0x8d')]=function(_0x355ff3,_0x55cd94){if(_0x355ff3[_0xe03e('0x5b')]['id']){delete _0x355ff3[_0xe03e('0x5b')]['id'];}return db[_0xe03e('0x3f')][_0xe03e('0x33')]({'where':{'id':_0x355ff3['params']['id']}})[_0xe03e('0x26')](function(_0x4de9c4){if(!_0x4de9c4)return null;if(_0x4de9c4['id']===_0x355ff3[_0xe03e('0x2b')]['id']){if(!_0x355ff3[_0xe03e('0x5b')]['oldPassword']||!_0x355ff3[_0xe03e('0x5b')][_0xe03e('0x8e')]){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))](_0xe03e('0x91'));}if(!_0x4de9c4[_0xe03e('0x92')](_0x355ff3[_0xe03e('0x5b')]['oldPassword'])){throw new db[(_0xe03e('0x8f'))]['ValidationError'](_0xe03e('0x93'));}if(_0x355ff3[_0xe03e('0x5b')][_0xe03e('0x94')]===_0x355ff3['body'][_0xe03e('0x8e')]){throw new db['Sequelize'][(_0xe03e('0x90'))](_0xe03e('0x95'));}}else if(_0x355ff3[_0xe03e('0x2b')][_0xe03e('0x29')]===_0xe03e('0x7f')){if(!_0x355ff3[_0xe03e('0x5b')][_0xe03e('0x8e')]){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x355ff3[_0xe03e('0x2b')][_0xe03e('0x29')]===_0xe03e('0x2b')){if(!_0x355ff3['body'][_0xe03e('0x8e')]){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4de9c4[_0xe03e('0x29')]!==_0xe03e('0x6e')){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))]('Unauthorized');}}else{throw new db['Sequelize']['ValidationError'](_0xe03e('0x85'));}return _0x4de9c4;})[_0xe03e('0x26')](handleEntityNotFound(_0x55cd94,null))[_0xe03e('0x26')](function(_0x3be734){return db['Setting'][_0xe03e('0x96')]({'attributes':['id',_0xe03e('0x97'),'enforcePasswordHistory',_0xe03e('0x98')]})['then'](function(_0x301469){if(_0x301469['securePassword'])authService[_0xe03e('0x99')](_0x355ff3['body'][_0xe03e('0x8e')]);if(!_0x301469[_0xe03e('0x9a')]||!_0x3be734[_0xe03e('0x9b')])return _0x3be734;authService[_0xe03e('0x9c')](_0x355ff3[_0xe03e('0x5b')][_0xe03e('0x8e')],_0x3be734['previousPasswords'],_0x301469[_0xe03e('0x98')]);return _0x3be734;})['then'](saveUpdates({'password':_0x355ff3[_0xe03e('0x5b')][_0xe03e('0x8e')],'passwordResetAt':_0x355ff3[_0xe03e('0x2b')]['id']==_0x355ff3[_0xe03e('0x5c')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x355ff3[_0xe03e('0x5b')][_0xe03e('0x8e')],_0x3be734[_0xe03e('0x9b')])},null));})['then'](respondWithResult(_0x55cd94,null))[_0xe03e('0x1b')](handleError(_0x55cd94,null));};exports[_0xe03e('0x9d')]=function(_0x3309a7,_0x3a76a6){var _0x16c522=_0x3309a7['body'][_0xe03e('0x9e')];return db[_0xe03e('0x3f')][_0xe03e('0x33')]({'where':{'id':_0x3309a7[_0xe03e('0x5c')]['id']},'attributes':['id',_0xe03e('0x34'),'role','online','loginInPause',_0xe03e('0x9f'),_0xe03e('0xa0')]})[_0xe03e('0x26')](handleEntityNotFound(_0x3a76a6,null))['then'](function(_0x55f03a){if(_0x55f03a){if(!utils[_0xe03e('0xa1')](_0x16c522)){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))](_0xe03e('0xa2'));}return _0x55f03a[_0xe03e('0xa3')+_[_0xe03e('0xa4')](_0x16c522[_0xe03e('0xa5')]())+'Queues'](_0x3309a7[_0xe03e('0x5b')][_0xe03e('0x5f')],{'penalty':_0x3309a7[_0xe03e('0x5b')][_0xe03e('0xa6')]||0x0})['spread'](function(_0x501914){for(var _0x3a6d23=0x0;_0x3a6d23<_0x3309a7[_0xe03e('0x5b')]['ids']['length'];_0x3a6d23+=0x1){var _0x51e68b={'UserId':Number(_0x3309a7[_0xe03e('0x5c')]['id'])};_0x51e68b[_['capitalize'](_0x16c522['toLowerCase']())+'QueueId']=Number(_0x3309a7['body']['ids'][_0x3a6d23]);socket[_0xe03e('0xa7')](_0xe03e('0x2b')+_[_0xe03e('0xa4')](_0x16c522[_0xe03e('0xa5')]())+_0xe03e('0xa8'),_0x51e68b);}return _0x501914;})[_0xe03e('0x26')](function(){if(_0x16c522===_0xe03e('0xa9')){return db[_0xe03e('0xaa')][_0xe03e('0x48')]({'where':{'id':_0x3309a7[_0xe03e('0x5b')][_0xe03e('0x5f')]||[]},'raw':!![],'attributes':['id',_0xe03e('0x34')]});}})[_0xe03e('0x26')](function(_0x37109c){var _0x5556db=_0x55f03a['get']({'plain':!![]});var _0x1bcee4=[];if(_0x16c522===_0xe03e('0xa9')&&_0x5556db['role']===_0xe03e('0x6e')&&_0x5556db[_0xe03e('0xab')]){for(var _0x237465=0x0;_0x237465<_0x37109c[_0xe03e('0x4a')];_0x237465+=0x1){_0x1bcee4[_0xe03e('0x47')]({'membername':_0x5556db[_0xe03e('0x34')],'UserId':_0x5556db['id'],'queue_name':_0x37109c[_0x237465]['name'],'VoiceQueueId':_0x37109c[_0x237465]['id'],'interface':_[_0xe03e('0x65')](_0x5556db['interface'])?util['format'](_0xe03e('0xac'),_0x5556db[_0xe03e('0x34')]):_0x5556db[_0xe03e('0xa0')],'paused':_0x5556db['voicePause']||![],'penalty':_0x3309a7[_0xe03e('0x5b')][_0xe03e('0xa6')]||0x0});}return BPromise[_0xe03e('0x88')](_0x1bcee4,function(_0x3f69de){return db[_0xe03e('0xad')]['upsert'](_0x3f69de);});}return _0x55f03a;});}})[_0xe03e('0x26')](respondWithStatusCode(_0x3a76a6,null))[_0xe03e('0x1b')](handleError(_0x3a76a6,null));};exports[_0xe03e('0xae')]=function(_0x4f6898,_0x20cd05){var _0x5e45cb,_0x32960f;return db['User'][_0xe03e('0x33')]({'where':{'id':_0x4f6898[_0xe03e('0x5c')]['id']},'attributes':['id',_0xe03e('0x34'),_0xe03e('0x29')]})[_0xe03e('0x26')](handleEntityNotFound(_0x20cd05,null))[_0xe03e('0x26')](function(_0xc69e77){if(_0xc69e77){_0x5e45cb=_0xc69e77;if(!_0x4f6898[_0xe03e('0x40')]['channel']||!utils[_0xe03e('0xa1')](_0x4f6898['query'][_0xe03e('0x9e')])){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))](_0xe03e('0xa2'));}return _0xc69e77['remove'+_[_0xe03e('0xa4')](_0x4f6898[_0xe03e('0x40')][_0xe03e('0x9e')][_0xe03e('0xa5')]())+_0xe03e('0xaf')](_0x4f6898[_0xe03e('0x40')][_0xe03e('0x5f')]);}})[_0xe03e('0x26')](function(_0x257cf7){if(_['isArray'](_0x4f6898['query'][_0xe03e('0x5f')])){for(var _0x11cd1f=0x0;_0x11cd1f<_0x4f6898['query'][_0xe03e('0x5f')][_0xe03e('0x4a')];_0x11cd1f+=0x1){_0x32960f={'UserId':Number(_0x4f6898[_0xe03e('0x5c')]['id'])};_0x32960f[_['capitalize'](_0x4f6898[_0xe03e('0x40')][_0xe03e('0x9e')][_0xe03e('0xa5')]())+'QueueId']=Number(_0x4f6898[_0xe03e('0x40')][_0xe03e('0x5f')][_0x11cd1f]);socket[_0xe03e('0xa7')](_0xe03e('0x2b')+_['capitalize'](_0x4f6898['query'][_0xe03e('0x9e')][_0xe03e('0xa5')]())+_0xe03e('0xb0'),_0x32960f);}}else{_0x32960f={'UserId':Number(_0x4f6898[_0xe03e('0x5c')]['id'])};_0x32960f[_[_0xe03e('0xa4')](_0x4f6898['query']['channel'][_0xe03e('0xa5')]())+_0xe03e('0xb1')]=Number(_0x4f6898['query'][_0xe03e('0x5f')]);socket[_0xe03e('0xa7')](_0xe03e('0x2b')+_['capitalize'](_0x4f6898['query'][_0xe03e('0x9e')][_0xe03e('0xa5')]())+'Queue:remove',_0x32960f);}return _0x257cf7;})[_0xe03e('0x26')](function(){if(_0x4f6898[_0xe03e('0x40')][_0xe03e('0x9e')]===_0xe03e('0xa9')){return db[_0xe03e('0xad')][_0xe03e('0x27')]({'where':{'UserId':_0x4f6898['params']['id'],'VoiceQueueId':_0x4f6898[_0xe03e('0x40')][_0xe03e('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x5e45cb;});}return _0x5e45cb;})['then'](respondWithStatusCode(_0x20cd05,null))[_0xe03e('0x1b')](handleError(_0x20cd05,null));};exports[_0xe03e('0xb2')]=function(_0x289574,_0x1bb131){_0x289574[_0xe03e('0x5b')][_0xe03e('0xb3')]=_0x289574['file'][_0xe03e('0xb4')];return db['User'][_0xe03e('0x33')]({'where':{'id':_0x289574['params']['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x1bb131,null))[_0xe03e('0x26')](saveUpdates(_0x289574[_0xe03e('0x5b')],null))[_0xe03e('0x26')](respondWithResult(_0x1bb131,null))[_0xe03e('0x1b')](handleError(_0x1bb131,null));};exports[_0xe03e('0xb5')]=function(_0x46898d,_0x5dbc52){var _0x2c4401=path[_0xe03e('0xb6')](config[_0xe03e('0xb7')],_0xe03e('0xb8'));return db['User'][_0xe03e('0x33')]({'where':{'id':_0x46898d[_0xe03e('0x5c')]['id']},'attributes':['id',_0xe03e('0xb3')],'raw':!![]})[_0xe03e('0x26')](handleEntityNotFound(_0x5dbc52,null))[_0xe03e('0x26')](function(_0x2b9221){if(_0x2b9221){if(_['isNil'](_0x2b9221['userpic'])){return _0x5dbc52['download'](_0x2c4401);}else{if(!fs[_0xe03e('0xb9')](path[_0xe03e('0xb6')](config['root'],_0xe03e('0xba'),_0x2b9221[_0xe03e('0xb3')]))){return _0x5dbc52[_0xe03e('0xbb')](_0x2c4401);}return _0x5dbc52[_0xe03e('0xbb')](path[_0xe03e('0xb6')](config['root'],_0xe03e('0xba'),_0x2b9221[_0xe03e('0xb3')]));}}})[_0xe03e('0x1b')](handleError(_0x5dbc52,null));};exports[_0xe03e('0xbc')]=function(_0x5b0eba,_0xeb384b){return db[_0xe03e('0x3f')]['find']({'where':{'id':_0x5b0eba[_0xe03e('0x5c')]['id']},'attributes':['id']})[_0xe03e('0x26')](handleEntityNotFound(_0xeb384b,null))[_0xe03e('0x26')](function(_0x43d5c4){var _0x311d75=[];values=_0x43d5c4[_0xe03e('0x4c')];_0x311d75[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4b'),_0x43d5c4[_0xe03e('0x4c')]));_0x311d75[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x59'),_0x43d5c4[_0xe03e('0x4c')]));_0x311d75[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4d'),_0x43d5c4['dataValues']));_0x311d75[_0xe03e('0x47')](get_open_tabs(_0xe03e('0x4e'),_0x43d5c4[_0xe03e('0x4c')]));_0x311d75[_0xe03e('0x47')](get_open_tabs(_0xe03e('0xbd'),_0x43d5c4[_0xe03e('0x4c')]));_0x311d75[_0xe03e('0x47')](get_open_tabs('mail',_0x43d5c4[_0xe03e('0x4c')]));return BPromise[_0xe03e('0x4f')](_0x311d75);})[_0xe03e('0x26')](function(_0x2661d6){if(_0x2661d6){var _0x5059dc=_[_0xe03e('0x30')](values[_0xe03e('0xbe')],function(_0x4d2ae9){return{'channel':'CHAT','id':_0x4d2ae9['id'],'createdAt':_0x4d2ae9[_0xe03e('0xbf')]};});var _0xffe027=_[_0xe03e('0x30')](values['FaxOpenTabs'],function(_0x8e9c33){return{'channel':_0xe03e('0xc0'),'id':_0x8e9c33['id'],'createdAt':_0x8e9c33[_0xe03e('0xbf')]};});var _0x211e7f=_[_0xe03e('0x30')](values[_0xe03e('0xc1')],function(_0x3c321a){return{'channel':_0xe03e('0xc2'),'id':_0x3c321a['id'],'createdAt':_0x3c321a['createdAt']};});var _0x33b68a=_['map'](values[_0xe03e('0xc3')],function(_0x1a8e7f){return{'channel':_0xe03e('0xc4'),'id':_0x1a8e7f['id'],'createdAt':_0x1a8e7f[_0xe03e('0xbf')]};});var _0x489af0=_[_0xe03e('0x30')](values[_0xe03e('0xc5')],function(_0x43c384){return{'channel':'SMS','id':_0x43c384['id'],'createdAt':_0x43c384['createdAt']};});var _0x2f9cff=_[_0xe03e('0x30')](values[_0xe03e('0xc6')],function(_0x33ce86){return{'channel':'WHATSAPP','id':_0x33ce86['id'],'createdAt':_0x33ce86[_0xe03e('0xbf')]};});var _0x200f8b=_[_0xe03e('0xc7')](_0x5059dc,_0xffe027,_0x211e7f,_0x33b68a,_0x489af0,_0x2f9cff);var _0x4ce297={'count':_0x200f8b[_0xe03e('0x4a')],'rows':_0x200f8b};return _0x4ce297;}else return null;})[_0xe03e('0x26')](respondWithResult(_0xeb384b,null))[_0xe03e('0x1b')](handleError(_0xeb384b,null));};exports['getContacts']=function(_0x1e45e8,_0x52d2a6){var _0xee2634={};var _0x228a58={};var _0x4124d8;var _0xa39dcd;return db['User'][_0xe03e('0x96')]({'where':{'id':_0x1e45e8[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x52d2a6,null))['then'](function(_0x48e5f3){if(_0x48e5f3){_0x4124d8=_0x48e5f3;_0x228a58[_0xe03e('0x54')]=_[_0xe03e('0x52')](db['CmContact'][_0xe03e('0x38')]);_0x228a58[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x1e45e8[_0xe03e('0x40')]);_0x228a58[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x228a58[_0xe03e('0x54')],_0x228a58[_0xe03e('0x40')]);_0xee2634[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x228a58['model'],qs[_0xe03e('0xc8')](_0x1e45e8['query'][_0xe03e('0xc8')]));_0xee2634[_0xe03e('0x46')]=_0xee2634[_0xe03e('0x46')][_0xe03e('0x4a')]?_0xee2634[_0xe03e('0x46')]:_0x228a58[_0xe03e('0x54')];_0xee2634['order']=qs[_0xe03e('0xc9')](_0x1e45e8['query'][_0xe03e('0xc9')]);_0xee2634[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x1e45e8['query'],_0x228a58['filters']));if(_0x1e45e8[_0xe03e('0x40')][_0xe03e('0x2e')]){_0xee2634[_0xe03e('0x3e')]=_['merge'](_0xee2634['where'],{'$or':_[_0xe03e('0x30')](_0xee2634[_0xe03e('0x46')],function(_0x2b1128){var _0x585059={};_0x585059[_0x2b1128]={'$like':'%'+_0x1e45e8[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0x585059;})});}_0xee2634=_[_0xe03e('0x56')]({},_0xee2634,_0x1e45e8[_0xe03e('0x57')]);return _0x4124d8[_0xe03e('0xcb')](_0xee2634);}})[_0xe03e('0x26')](function(_0x4d95a8){if(_0x4d95a8){_0xa39dcd=_0x4d95a8[_0xe03e('0x4a')];if(_0x1e45e8['query'][_0xe03e('0xcc')]('includeAll')){_0xee2634[_0xe03e('0x42')]=[{'model':db[_0xe03e('0xcd')],'as':'List','required':![]},{'model':db[_0xe03e('0xce')],'as':_0xe03e('0xcf'),'attributes':['id','name','color'],'where':_0x1e45e8[_0xe03e('0x40')][_0xe03e('0xd0')]?{'id':_0x1e45e8[_0xe03e('0x40')][_0xe03e('0xd0')]}:undefined,'required':_0x1e45e8['query'][_0xe03e('0xd0')]?!![]:![]}];}if(!_0x1e45e8[_0xe03e('0x40')][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0xee2634[_0xe03e('0x22')]=qs[_0xe03e('0x22')](_0x1e45e8['query'][_0xe03e('0x22')]);_0xee2634[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x1e45e8[_0xe03e('0x40')]['offset']);}return _0x4124d8['getContacts'](_0xee2634);}})[_0xe03e('0x26')](function(_0x44113f){if(_0x44113f){return _0x44113f?{'count':_0xa39dcd,'rows':_0x44113f}:null;}})[_0xe03e('0x26')](respondWithResult(_0x52d2a6,null))[_0xe03e('0x1b')](handleError(_0x52d2a6,null));};exports[_0xe03e('0xd2')]=function(_0x430a5f,_0x1f9b24){var _0x13eadd;var _0x5476d3={};var _0x3b5f17;return db['User'][_0xe03e('0x96')]({'where':{'id':_0x430a5f['params']['id']},'attributes':['id',_0xe03e('0x34'),_0xe03e('0x29')]})[_0xe03e('0x26')](handleEntityNotFound(_0x1f9b24,null))[_0xe03e('0x26')](function(_0x3feafb){if(!utils[_0xe03e('0xa1')](_0x430a5f[_0xe03e('0x40')][_0xe03e('0x9e')])){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))]('Unknown\x20channel');}_0x13eadd=_0x3feafb;var _0x12472c={};_0x12472c['model']=_[_0xe03e('0x52')](db[_['capitalize'](_0x430a5f[_0xe03e('0x40')][_0xe03e('0x9e')])+_0xe03e('0xd3')][_0xe03e('0x38')]);_0x12472c['query']=_[_0xe03e('0x52')](_0x430a5f[_0xe03e('0x40')]);_0x12472c[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x12472c[_0xe03e('0x54')],_0x12472c['query']);_0x5476d3[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x12472c[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x430a5f[_0xe03e('0x40')][_0xe03e('0xc8')]));_0x5476d3[_0xe03e('0x46')]=_0x5476d3[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x5476d3[_0xe03e('0x46')]:_0x12472c[_0xe03e('0x54')];_0x5476d3[_0xe03e('0xd4')]=qs['sort'](_0x430a5f[_0xe03e('0x40')]['sort']);_0x5476d3['where']=qs['filters'](_[_0xe03e('0xca')](_0x430a5f['query'],_0x12472c['filters']));if(_0x430a5f['query'][_0xe03e('0x2e')]){_0x5476d3[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x5476d3[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x5476d3[_0xe03e('0x46')],function(_0x5785c8){var _0x2b7c8d={};_0x2b7c8d[_0x5785c8]={'$like':'%'+_0x430a5f['query'][_0xe03e('0x2e')]+'%'};return _0x2b7c8d;})});}_0x5476d3=_[_0xe03e('0x56')]({},_0x5476d3,_0x430a5f[_0xe03e('0x57')]);switch(_0x13eadd[_0xe03e('0x29')]){case _0xe03e('0x7f'):return db[_[_0xe03e('0xa4')](_0x430a5f[_0xe03e('0x40')][_0xe03e('0x9e')])+_0xe03e('0xd3')]['findAll'](_0x5476d3);case'user':case _0xe03e('0x6e'):return _0x13eadd['get'+_['capitalize'](_0x430a5f[_0xe03e('0x40')][_0xe03e('0x9e')])+'Queues'](_0x5476d3);default:throw new db[(_0xe03e('0x8f'))]['ValidationError'](_0xe03e('0xd5'));}})['then'](function(_0x6dd217){_0x3b5f17=_0x6dd217['length'];if(!_0x430a5f[_0xe03e('0x40')][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x5476d3['limit']=qs['limit'](_0x430a5f[_0xe03e('0x40')][_0xe03e('0x22')]);_0x5476d3[_0xe03e('0x20')]=qs['offset'](_0x430a5f['query'][_0xe03e('0x20')]);}switch(_0x13eadd[_0xe03e('0x29')]){case'admin':return db[_[_0xe03e('0xa4')](_0x430a5f[_0xe03e('0x40')][_0xe03e('0x9e')])+_0xe03e('0xd3')][_0xe03e('0x48')](_0x5476d3);case'user':case'agent':return _0x13eadd[_0xe03e('0x28')+_[_0xe03e('0xa4')](_0x430a5f['query'][_0xe03e('0x9e')])+_0xe03e('0xaf')](_0x5476d3);}})[_0xe03e('0x26')](function(_0x28e4d8){return{'count':_0x3b5f17,'rows':_0x28e4d8};})['then'](respondWithResult(_0x1f9b24,null))[_0xe03e('0x1b')](handleError(_0x1f9b24,null));};exports[_0xe03e('0xd6')]=function(_0x3ecac2,_0x19b334){var _0x31915d={};var _0x734eed={};var _0x4823ea;var _0x1489eb;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x3ecac2['params']['id']}})['then'](handleEntityNotFound(_0x19b334,null))[_0xe03e('0x26')](function(_0x4e6f9d){if(_0x4e6f9d){_0x4823ea=_0x4e6f9d;_0x734eed['model']=_['keys'](db[_0xe03e('0xad')]['rawAttributes']);_0x734eed[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x3ecac2[_0xe03e('0x40')]);_0x734eed[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x734eed[_0xe03e('0x54')],_0x734eed[_0xe03e('0x40')]);_0x31915d[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x734eed[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x3ecac2['query'][_0xe03e('0xc8')]));_0x31915d[_0xe03e('0x46')]=_0x31915d[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x31915d[_0xe03e('0x46')]:_0x734eed[_0xe03e('0x54')];_0x31915d[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x3ecac2[_0xe03e('0x40')]['sort']);_0x31915d[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x3ecac2[_0xe03e('0x40')],_0x734eed['filters']));if(_0x3ecac2['query'][_0xe03e('0x2e')]){_0x31915d[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x31915d[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x31915d[_0xe03e('0x46')],function(_0x1e7000){var _0x551f74={};_0x551f74[_0x1e7000]={'$like':'%'+_0x3ecac2[_0xe03e('0x40')]['filter']+'%'};return _0x551f74;})});}_0x31915d=_['merge']({},_0x31915d,_0x3ecac2['options']);return _0x4823ea[_0xe03e('0xd6')](_0x31915d);}})['then'](function(_0xd5e91f){if(_0xd5e91f){_0x1489eb=_0xd5e91f[_0xe03e('0x4a')];if(!_0x3ecac2[_0xe03e('0x40')][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x31915d[_0xe03e('0x22')]=qs[_0xe03e('0x22')](_0x3ecac2[_0xe03e('0x40')][_0xe03e('0x22')]);_0x31915d[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x3ecac2[_0xe03e('0x40')]['offset']);}return _0x4823ea[_0xe03e('0xd6')](_0x31915d);}})[_0xe03e('0x26')](function(_0x10c4f8){if(_0x10c4f8){return _0x10c4f8?{'count':_0x1489eb,'rows':_0x10c4f8}:null;}})[_0xe03e('0x26')](respondWithResult(_0x19b334,null))[_0xe03e('0x1b')](handleError(_0x19b334,null));};exports[_0xe03e('0xd7')]=function(_0x1cfc31,_0x363ed1){var _0x4ade59={};var _0x5789a0={};var _0x510e40;var _0x2ba08a;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x1cfc31[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x363ed1,null))[_0xe03e('0x26')](function(_0x36c1b0){if(_0x36c1b0){_0x510e40=_0x36c1b0;_0x5789a0[_0xe03e('0x54')]=_[_0xe03e('0x52')](db[_0xe03e('0xd8')]['rawAttributes']);_0x5789a0[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x1cfc31['query']);_0x5789a0['filters']=_[_0xe03e('0x55')](_0x5789a0[_0xe03e('0x54')],_0x5789a0[_0xe03e('0x40')]);_0x4ade59[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x5789a0[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x1cfc31[_0xe03e('0x40')][_0xe03e('0xc8')]));_0x4ade59[_0xe03e('0x46')]=_0x4ade59[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x4ade59['attributes']:_0x5789a0['model'];_0x4ade59[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x1cfc31[_0xe03e('0x40')]['sort']);_0x4ade59[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x1cfc31['query'],_0x5789a0['filters']));if(_0x1cfc31[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x4ade59[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x4ade59['where'],{'$or':_[_0xe03e('0x30')](_0x4ade59[_0xe03e('0x46')],function(_0x4078ff){var _0x3bf847={};_0x3bf847[_0x4078ff]={'$like':'%'+_0x1cfc31['query'][_0xe03e('0x2e')]+'%'};return _0x3bf847;})});}_0x4ade59=_[_0xe03e('0x56')]({},_0x4ade59,_0x1cfc31['options']);return _0x510e40[_0xe03e('0xd7')](_0x4ade59);}})[_0xe03e('0x26')](function(_0x19c6ed){if(_0x19c6ed){_0x2ba08a=_0x19c6ed[_0xe03e('0x4a')];if(!_0x1cfc31[_0xe03e('0x40')][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x4ade59[_0xe03e('0x22')]=qs[_0xe03e('0x22')](_0x1cfc31[_0xe03e('0x40')][_0xe03e('0x22')]);_0x4ade59[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x1cfc31[_0xe03e('0x40')][_0xe03e('0x20')]);}return _0x510e40['getGroups'](_0x4ade59);}})[_0xe03e('0x26')](function(_0x4e1419){if(_0x4e1419){return _0x4e1419?{'count':_0x2ba08a,'rows':_0x4e1419}:null;}})['then'](respondWithResult(_0x363ed1,null))[_0xe03e('0x1b')](handleError(_0x363ed1,null));};exports[_0xe03e('0xd9')]=function(_0x106ac5,_0x55baee){var _0x3efe99={'raw':!![],'where':{}};var _0x28ebda={};var _0x4e684c={'count':0x0,'rows':[]};return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x106ac5[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x55baee,null))[_0xe03e('0x26')](function(_0x17a131){if(_0x17a131){_0x28ebda['model']=_[_0xe03e('0x52')](db[_0xe03e('0xda')][_0xe03e('0x38')]);_0x28ebda[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x106ac5[_0xe03e('0x40')]);_0x28ebda[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x28ebda[_0xe03e('0x54')],_0x28ebda['query']);_0x3efe99[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x28ebda['model'],qs[_0xe03e('0xc8')](_0x106ac5[_0xe03e('0x40')]['fields']));_0x3efe99['attributes']=_0x3efe99[_0xe03e('0x46')]['length']?_0x3efe99['attributes']:_0x28ebda[_0xe03e('0x54')];if(!_0x106ac5[_0xe03e('0x40')]['hasOwnProperty'](_0xe03e('0xd1'))){_0x3efe99['limit']=qs[_0xe03e('0x22')](_0x106ac5[_0xe03e('0x40')][_0xe03e('0x22')]);_0x3efe99[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x106ac5[_0xe03e('0x40')][_0xe03e('0x20')]);}_0x3efe99[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x106ac5['query']['sort']);_0x3efe99[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x106ac5[_0xe03e('0x40')],_0x28ebda[_0xe03e('0x53')]));_0x3efe99['where'][_0xe03e('0xdb')]=_0x17a131['id'];if(_0x106ac5[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x3efe99[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x3efe99['where'],{'$or':_['map'](_0x3efe99[_0xe03e('0x46')],function(_0x622e0c){var _0x1b5161={};_0x1b5161[_0x622e0c]={'$like':'%'+_0x106ac5[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0x1b5161;})});}_0x3efe99=_['merge']({},_0x3efe99,_0x106ac5[_0xe03e('0x57')]);return db[_0xe03e('0xda')]['count']({'where':_0x3efe99[_0xe03e('0x3e')]})[_0xe03e('0x26')](function(_0x5f5dcf){_0x4e684c[_0xe03e('0x23')]=_0x5f5dcf;if(_0x106ac5['query'][_0xe03e('0x41')]){_0x3efe99['include']=[{'all':!![]}];}return db[_0xe03e('0xda')]['findAll'](_0x3efe99);})[_0xe03e('0x26')](function(_0x4854a1){_0x4e684c['rows']=_0x4854a1;return _0x4e684c;});}})[_0xe03e('0x26')](respondWithFilteredResult(_0x55baee,_0x3efe99))[_0xe03e('0x1b')](handleError(_0x55baee,null));};exports[_0xe03e('0xdc')]=function(_0x100ae4,_0x51f1b5){var _0x27d8f8={'raw':!![],'where':{}};var _0x453826={};var _0x2550fd={'count':0x0,'rows':[]};return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x100ae4[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x51f1b5,null))['then'](function(_0x4ea005){if(_0x4ea005){_0x453826[_0xe03e('0x54')]=_['keys'](db[_0xe03e('0xdd')][_0xe03e('0x38')]);_0x453826[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x100ae4[_0xe03e('0x40')]);_0x453826[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x453826['model'],_0x453826[_0xe03e('0x40')]);_0x27d8f8[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x453826[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x100ae4['query'][_0xe03e('0xc8')]));_0x27d8f8[_0xe03e('0x46')]=_0x27d8f8[_0xe03e('0x46')]['length']?_0x27d8f8[_0xe03e('0x46')]:_0x453826[_0xe03e('0x54')];if(!_0x100ae4[_0xe03e('0x40')]['hasOwnProperty'](_0xe03e('0xd1'))){_0x27d8f8['limit']=qs['limit'](_0x100ae4[_0xe03e('0x40')][_0xe03e('0x22')]);_0x27d8f8[_0xe03e('0x20')]=qs['offset'](_0x100ae4['query']['offset']);}_0x27d8f8[_0xe03e('0xd4')]=qs['sort'](_0x100ae4[_0xe03e('0x40')][_0xe03e('0xc9')]);_0x27d8f8['where']=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x100ae4['query'],_0x453826[_0xe03e('0x53')]));_0x27d8f8[_0xe03e('0x3e')][_0xe03e('0xdb')]=_0x4ea005['id'];if(_0x100ae4[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x27d8f8['where']=_[_0xe03e('0x56')](_0x27d8f8[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x27d8f8[_0xe03e('0x46')],function(_0x3b04df){var _0x1bcdf5={};_0x1bcdf5[_0x3b04df]={'$like':'%'+_0x100ae4['query'][_0xe03e('0x2e')]+'%'};return _0x1bcdf5;})});}_0x27d8f8=_['merge']({},_0x27d8f8,_0x100ae4[_0xe03e('0x57')]);return db[_0xe03e('0xdd')][_0xe03e('0x23')]({'where':_0x27d8f8['where']})[_0xe03e('0x26')](function(_0x4fdf43){_0x2550fd[_0xe03e('0x23')]=_0x4fdf43;if(_0x100ae4[_0xe03e('0x40')][_0xe03e('0x41')]){_0x27d8f8['include']=[{'all':!![]}];}return db[_0xe03e('0xdd')][_0xe03e('0x48')](_0x27d8f8);})[_0xe03e('0x26')](function(_0x38c0d6){_0x2550fd[_0xe03e('0x49')]=_0x38c0d6;return _0x2550fd;});}})[_0xe03e('0x26')](respondWithFilteredResult(_0x51f1b5,_0x27d8f8))['catch'](handleError(_0x51f1b5,null));};exports['getChatInteractions']=function(_0x55f0de,_0x4ff3e4){var _0x4e5b56={};var _0xd4c1a={};var _0x5a9ee6;var _0x81f6f0;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x55f0de['params']['id']}})['then'](handleEntityNotFound(_0x4ff3e4,null))['then'](function(_0x2e5432){if(_0x2e5432){_0x5a9ee6=_0x2e5432;_0xd4c1a[_0xe03e('0x54')]=_[_0xe03e('0x52')](db[_0xe03e('0xde')][_0xe03e('0x38')]);_0xd4c1a[_0xe03e('0x40')]=_['keys'](_0x55f0de[_0xe03e('0x40')]);_0xd4c1a[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0xd4c1a[_0xe03e('0x54')],_0xd4c1a[_0xe03e('0x40')]);_0x4e5b56[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0xd4c1a[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x55f0de[_0xe03e('0x40')][_0xe03e('0xc8')]));_0x4e5b56[_0xe03e('0x46')]=_0x4e5b56['attributes'][_0xe03e('0x4a')]?_0x4e5b56[_0xe03e('0x46')]:_0xd4c1a[_0xe03e('0x54')];_0x4e5b56[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x55f0de[_0xe03e('0x40')]['sort']);_0x4e5b56[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x55f0de['query'],_0xd4c1a[_0xe03e('0x53')]));if(_0x55f0de[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x4e5b56['where']=_[_0xe03e('0x56')](_0x4e5b56[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x4e5b56[_0xe03e('0x46')],function(_0x557824){var _0x25b6b1={};_0x25b6b1[_0x557824]={'$like':'%'+_0x55f0de[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0x25b6b1;})});}_0x4e5b56=_['merge']({},_0x4e5b56,_0x55f0de[_0xe03e('0x57')]);return _0x5a9ee6['getChatInteractions'](_0x4e5b56);}})['then'](function(_0x347d7f){if(_0x347d7f){_0x81f6f0=_0x347d7f[_0xe03e('0x4a')];if(!_0x55f0de[_0xe03e('0x40')][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x4e5b56[_0xe03e('0x22')]=qs[_0xe03e('0x22')](_0x55f0de[_0xe03e('0x40')][_0xe03e('0x22')]);_0x4e5b56[_0xe03e('0x20')]=qs['offset'](_0x55f0de[_0xe03e('0x40')][_0xe03e('0x20')]);}return _0x5a9ee6['getChatInteractions'](_0x4e5b56);}})[_0xe03e('0x26')](function(_0x4e6cc8){if(_0x4e6cc8){return _0x4e6cc8?{'count':_0x81f6f0,'rows':_0x4e6cc8}:null;}})[_0xe03e('0x26')](respondWithResult(_0x4ff3e4,null))['catch'](handleError(_0x4ff3e4,null));};exports[_0xe03e('0xdf')]=function(_0x138b48,_0x3810c4){var _0x251d10={};var _0x399e33={};var _0x38a5b3;var _0x24ad44;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x138b48[_0xe03e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3810c4,null))[_0xe03e('0x26')](function(_0x2cfa9b){if(_0x2cfa9b){_0x38a5b3=_0x2cfa9b;_0x399e33[_0xe03e('0x54')]=_[_0xe03e('0x52')](db['OpenchannelInteraction'][_0xe03e('0x38')]);_0x399e33[_0xe03e('0x40')]=_['keys'](_0x138b48[_0xe03e('0x40')]);_0x399e33['filters']=_[_0xe03e('0x55')](_0x399e33['model'],_0x399e33[_0xe03e('0x40')]);_0x251d10['attributes']=_['intersection'](_0x399e33['model'],qs['fields'](_0x138b48[_0xe03e('0x40')][_0xe03e('0xc8')]));_0x251d10[_0xe03e('0x46')]=_0x251d10[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x251d10[_0xe03e('0x46')]:_0x399e33[_0xe03e('0x54')];_0x251d10['order']=qs[_0xe03e('0xc9')](_0x138b48['query'][_0xe03e('0xc9')]);_0x251d10[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x138b48[_0xe03e('0x40')],_0x399e33[_0xe03e('0x53')]));if(_0x138b48[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x251d10[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x251d10[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x251d10['attributes'],function(_0x32172a){var _0x425213={};_0x425213[_0x32172a]={'$like':'%'+_0x138b48[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0x425213;})});}_0x251d10=_[_0xe03e('0x56')]({},_0x251d10,_0x138b48[_0xe03e('0x57')]);return _0x38a5b3[_0xe03e('0xdf')](_0x251d10);}})[_0xe03e('0x26')](function(_0x286a0a){if(_0x286a0a){_0x24ad44=_0x286a0a[_0xe03e('0x4a')];if(!_0x138b48[_0xe03e('0x40')]['hasOwnProperty'](_0xe03e('0xd1'))){_0x251d10[_0xe03e('0x22')]=qs[_0xe03e('0x22')](_0x138b48[_0xe03e('0x40')][_0xe03e('0x22')]);_0x251d10[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x138b48[_0xe03e('0x40')]['offset']);}return _0x38a5b3['getOpenchannelInteractions'](_0x251d10);}})['then'](function(_0x312248){if(_0x312248){return _0x312248?{'count':_0x24ad44,'rows':_0x312248}:null;}})[_0xe03e('0x26')](respondWithResult(_0x3810c4,null))['catch'](handleError(_0x3810c4,null));};exports[_0xe03e('0xe0')]=function(_0x59af98,_0x4b7908){var _0x234df2={'raw':!![],'where':{}};var _0x13e7da={};var _0x5ecc0c={'count':0x0,'rows':[]};return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x59af98[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x4b7908,null))[_0xe03e('0x26')](function(_0xf4e3f7){if(_0xf4e3f7){_0x13e7da['model']=_[_0xe03e('0x52')](db[_0xe03e('0xe1')][_0xe03e('0x38')]);_0x13e7da[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x59af98['query']);_0x13e7da['filters']=_['intersection'](_0x13e7da['model'],_0x13e7da[_0xe03e('0x40')]);_0x234df2[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x13e7da[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x59af98['query'][_0xe03e('0xc8')]));_0x234df2['attributes']=_0x234df2['attributes']['length']?_0x234df2[_0xe03e('0x46')]:_0x13e7da[_0xe03e('0x54')];if(!_0x59af98['query']['hasOwnProperty'](_0xe03e('0xd1'))){_0x234df2['limit']=qs[_0xe03e('0x22')](_0x59af98[_0xe03e('0x40')]['limit']);_0x234df2[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x59af98[_0xe03e('0x40')][_0xe03e('0x20')]);}_0x234df2[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x59af98['query'][_0xe03e('0xc9')]);_0x234df2[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x59af98[_0xe03e('0x40')],_0x13e7da[_0xe03e('0x53')]));_0x234df2[_0xe03e('0x3e')][_0xe03e('0xdb')]=_0xf4e3f7['id'];if(_0x59af98[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x234df2[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x234df2['where'],{'$or':_[_0xe03e('0x30')](_0x234df2[_0xe03e('0x46')],function(_0x4c4e33){var _0xf9a568={};_0xf9a568[_0x4c4e33]={'$like':'%'+_0x59af98[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0xf9a568;})});}_0x234df2=_['merge']({},_0x234df2,_0x59af98[_0xe03e('0x57')]);return db[_0xe03e('0xe1')][_0xe03e('0x23')]({'where':_0x234df2[_0xe03e('0x3e')]})[_0xe03e('0x26')](function(_0x58b351){_0x5ecc0c[_0xe03e('0x23')]=_0x58b351;if(_0x59af98['query'][_0xe03e('0x41')]){_0x234df2[_0xe03e('0x42')]=[{'all':!![]}];}return db['MailInteraction'][_0xe03e('0x48')](_0x234df2);})[_0xe03e('0x26')](function(_0x527f2b){_0x5ecc0c['rows']=_0x527f2b;return _0x5ecc0c;});}})[_0xe03e('0x26')](respondWithFilteredResult(_0x4b7908,_0x234df2))[_0xe03e('0x1b')](handleError(_0x4b7908,null));};exports['getSmsInteractions']=function(_0x251d04,_0x567e42){var _0x426f05={};var _0x3d0614={};var _0x292840;var _0x1acc7e;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x251d04[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x567e42,null))[_0xe03e('0x26')](function(_0xd7fd5c){if(_0xd7fd5c){_0x292840=_0xd7fd5c;_0x3d0614[_0xe03e('0x54')]=_[_0xe03e('0x52')](db['SmsInteraction'][_0xe03e('0x38')]);_0x3d0614[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x251d04[_0xe03e('0x40')]);_0x3d0614[_0xe03e('0x53')]=_['intersection'](_0x3d0614[_0xe03e('0x54')],_0x3d0614[_0xe03e('0x40')]);_0x426f05[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x3d0614[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x251d04['query']['fields']));_0x426f05[_0xe03e('0x46')]=_0x426f05[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x426f05[_0xe03e('0x46')]:_0x3d0614[_0xe03e('0x54')];_0x426f05[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x251d04[_0xe03e('0x40')][_0xe03e('0xc9')]);_0x426f05[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x251d04[_0xe03e('0x40')],_0x3d0614[_0xe03e('0x53')]));if(_0x251d04['query'][_0xe03e('0x2e')]){_0x426f05[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x426f05[_0xe03e('0x3e')],{'$or':_['map'](_0x426f05[_0xe03e('0x46')],function(_0xb743fc){var _0xb6d492={};_0xb6d492[_0xb743fc]={'$like':'%'+_0x251d04[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0xb6d492;})});}_0x426f05=_['merge']({},_0x426f05,_0x251d04[_0xe03e('0x57')]);return _0x292840[_0xe03e('0xe2')](_0x426f05);}})[_0xe03e('0x26')](function(_0x34e7d1){if(_0x34e7d1){_0x1acc7e=_0x34e7d1[_0xe03e('0x4a')];if(!_0x251d04['query'][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x426f05[_0xe03e('0x22')]=qs[_0xe03e('0x22')](_0x251d04['query'][_0xe03e('0x22')]);_0x426f05[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x251d04['query'][_0xe03e('0x20')]);}return _0x292840[_0xe03e('0xe2')](_0x426f05);}})[_0xe03e('0x26')](function(_0x6af644){if(_0x6af644){return _0x6af644?{'count':_0x1acc7e,'rows':_0x6af644}:null;}})['then'](respondWithResult(_0x567e42,null))[_0xe03e('0x1b')](handleError(_0x567e42,null));};exports[_0xe03e('0xe3')]=function(_0x56e84c,_0x11fd25){var _0x55e0d5={};var _0x534289={};var _0x45b278;var _0x16ae64;return db[_0xe03e('0x3f')]['findOne']({'where':{'id':_0x56e84c[_0xe03e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x11fd25,null))['then'](function(_0x43a4ab){if(_0x43a4ab){_0x45b278=_0x43a4ab;_0x534289[_0xe03e('0x54')]=_[_0xe03e('0x52')](db[_0xe03e('0xe4')]['rawAttributes']);_0x534289['query']=_['keys'](_0x56e84c[_0xe03e('0x40')]);_0x534289[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x534289['model'],_0x534289[_0xe03e('0x40')]);_0x55e0d5[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x534289[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x56e84c[_0xe03e('0x40')][_0xe03e('0xc8')]));_0x55e0d5[_0xe03e('0x46')]=_0x55e0d5[_0xe03e('0x46')]['length']?_0x55e0d5[_0xe03e('0x46')]:_0x534289['model'];_0x55e0d5[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x56e84c[_0xe03e('0x40')][_0xe03e('0xc9')]);_0x55e0d5[_0xe03e('0x3e')]=qs['filters'](_[_0xe03e('0xca')](_0x56e84c[_0xe03e('0x40')],_0x534289[_0xe03e('0x53')]));if(_0x56e84c[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x55e0d5[_0xe03e('0x3e')]=_['merge'](_0x55e0d5[_0xe03e('0x3e')],{'$or':_['map'](_0x55e0d5[_0xe03e('0x46')],function(_0x3ffe3d){var _0x585fca={};_0x585fca[_0x3ffe3d]={'$like':'%'+_0x56e84c[_0xe03e('0x40')]['filter']+'%'};return _0x585fca;})});}_0x55e0d5=_['merge']({},_0x55e0d5,_0x56e84c['options']);return _0x45b278[_0xe03e('0xe3')](_0x55e0d5);}})[_0xe03e('0x26')](function(_0x101709){if(_0x101709){_0x16ae64=_0x101709[_0xe03e('0x4a')];if(!_0x56e84c['query'][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x55e0d5[_0xe03e('0x22')]=qs[_0xe03e('0x22')](_0x56e84c['query'][_0xe03e('0x22')]);_0x55e0d5[_0xe03e('0x20')]=qs['offset'](_0x56e84c[_0xe03e('0x40')]['offset']);}return _0x45b278[_0xe03e('0xe3')](_0x55e0d5);}})[_0xe03e('0x26')](function(_0x84ae28){if(_0x84ae28){return _0x84ae28?{'count':_0x16ae64,'rows':_0x84ae28}:null;}})[_0xe03e('0x26')](respondWithResult(_0x11fd25,null))[_0xe03e('0x1b')](handleError(_0x11fd25,null));};exports[_0xe03e('0xe5')]=function(_0x334831,_0x454e4b){var _0x1bdd13={};var _0x249a3c={};var _0x51c86e;var _0x540bff;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x334831[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x454e4b,null))[_0xe03e('0x26')](function(_0x4e615e){if(_0x4e615e){_0x51c86e=_0x4e615e;_0x249a3c[_0xe03e('0x54')]=_[_0xe03e('0x52')](db[_0xe03e('0xe6')][_0xe03e('0x38')]);_0x249a3c[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x334831['query']);_0x249a3c[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x249a3c[_0xe03e('0x54')],_0x249a3c[_0xe03e('0x40')]);_0x1bdd13[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x249a3c[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0x334831[_0xe03e('0x40')][_0xe03e('0xc8')]));_0x1bdd13[_0xe03e('0x46')]=_0x1bdd13[_0xe03e('0x46')]['length']?_0x1bdd13[_0xe03e('0x46')]:_0x249a3c[_0xe03e('0x54')];_0x1bdd13[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0x334831[_0xe03e('0x40')][_0xe03e('0xc9')]);_0x1bdd13['where']=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x334831[_0xe03e('0x40')],_0x249a3c[_0xe03e('0x53')]));if(_0x334831[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x1bdd13[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x1bdd13[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x1bdd13[_0xe03e('0x46')],function(_0x1bf92d){var _0x4f3f1c={};_0x4f3f1c[_0x1bf92d]={'$like':'%'+_0x334831['query'][_0xe03e('0x2e')]+'%'};return _0x4f3f1c;})});}_0x1bdd13=_['merge']({},_0x1bdd13,_0x334831[_0xe03e('0x57')]);return _0x51c86e[_0xe03e('0xe5')](_0x1bdd13);}})['then'](function(_0x247859){if(_0x247859){_0x540bff=_0x247859[_0xe03e('0x4a')];if(!_0x334831['query'][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x1bdd13[_0xe03e('0x22')]=qs['limit'](_0x334831['query'][_0xe03e('0x22')]);_0x1bdd13[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x334831['query'][_0xe03e('0x20')]);}return _0x51c86e[_0xe03e('0xe5')](_0x1bdd13);}})[_0xe03e('0x26')](function(_0x2e641d){if(_0x2e641d){return _0x2e641d?{'count':_0x540bff,'rows':_0x2e641d}:null;}})['then'](respondWithResult(_0x454e4b,null))[_0xe03e('0x1b')](handleError(_0x454e4b,null));};exports[_0xe03e('0xe7')]=function(_0xdbf8a8,_0x11aa31,_0x5a554b){var _0x2b246a;var _0x445c19;var _0x306c4c;var _0x1e2d72=!_[_0xe03e('0x65')](_0xdbf8a8['params']['id'])?_0xdbf8a8['params']['id']:!_[_0xe03e('0x65')](_0xdbf8a8[_0xe03e('0x2b')]['id'])?_0xdbf8a8[_0xe03e('0x2b')]['id']:null;return db[_0xe03e('0x3f')][_0xe03e('0x33')]({'where':{'id':_0x1e2d72,'role':{'$or':[_0xe03e('0x7f'),_0xe03e('0x2b'),_0xe03e('0x6e')]}},'attributes':['id',_0xe03e('0x34'),_0xe03e('0xe8'),_0xe03e('0xe9'),_0xe03e('0x29'),'internal',_0xe03e('0xea')]})[_0xe03e('0x26')](function(_0x16dc9d){if(_0x16dc9d){if(_0x16dc9d['role']===_0xe03e('0x6e')){_0x2b246a=_0x16dc9d;if(_0xdbf8a8[_0xe03e('0x5b')]['interface']){_0x306c4c=util[_0xe03e('0xeb')](_0xe03e('0xec'),_0x2b246a[_0xdbf8a8[_0xe03e('0x5b')][_0xe03e('0xa0')]]);}else if(_0xdbf8a8[_0xe03e('0x5b')][_0xe03e('0xed')]){_0x306c4c=util['format']('SIP/%s',_0xdbf8a8[_0xe03e('0x5b')][_0xe03e('0xed')]);}else{_0x306c4c=util['format']('SIP/%s',_0x2b246a[_0xe03e('0x34')]);}socket['to'](util[_0xe03e('0xeb')]('user:%s',_0x2b246a[_0xe03e('0x34')]))[_0xe03e('0xa7')](_0xe03e('0xee'),{'user':{'id':_0x2b246a['id'],'name':_0x2b246a[_0xe03e('0x34')]},'ip':_0xdbf8a8[_0xe03e('0xef')][_0xe03e('0xf0')]||_0xdbf8a8[_0xe03e('0xf1')][_0xe03e('0xf2')]||_0xdbf8a8[_0xe03e('0xf3')][_0xe03e('0xf2')]||_0xdbf8a8[_0xe03e('0xf1')][_0xe03e('0xf3')][_0xe03e('0xf2')]});return db[_0xe03e('0xad')][_0xe03e('0x27')]({'where':{'membername':_0x2b246a[_0xe03e('0x34')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xe03e('0x90'))](_0xe03e('0xf4'));}})[_0xe03e('0x26')](function(){if(_0x2b246a){return _0x2b246a['getVoiceQueues']({'raw':!![]});}})[_0xe03e('0x26')](function(_0x19cd0e){if(_0x2b246a){var _0x4921fc=[];if(_0x19cd0e){_0x445c19=_0x19cd0e;if(_0x445c19['length']){for(var _0x542904=0x0;_0x542904<_0x445c19[_0xe03e('0x4a')];_0x542904++){_0x4921fc['push']({'membername':_0x2b246a[_0xe03e('0x34')],'UserId':_0x2b246a['id'],'queue_name':_0x445c19[_0x542904]['name'],'VoiceQueueId':_0x445c19[_0x542904]['id'],'interface':_0x306c4c,'paused':_0x2b246a[_0xe03e('0xea')]||![],'penalty':_0x445c19[_0x542904][_0xe03e('0xf5')]||0x0});}return BPromise[_0xe03e('0x88')](_0x4921fc,function(_0x1f3f22){return db[_0xe03e('0xad')][_0xe03e('0xf6')](_0x1f3f22);});}}}})[_0xe03e('0x26')](function(){if(_0x2b246a){return db[_0xe03e('0xf7')][_0xe03e('0x48')]({'where':{'membername':_0x2b246a[_0xe03e('0x34')],'exitAt':null}});}})[_0xe03e('0x26')](function(_0x32d587){if(_0x2b246a){var _0xc7fe53=[];_0x32d587[_0xe03e('0xf8')](function(_0x3ad0ff){_0xc7fe53[_0xe03e('0x47')](_0x3ad0ff[_0xe03e('0x25')]({'exitAt':moment()[_0xe03e('0xeb')](_0xe03e('0xf9'))}));});return BPromise['all'](_0xc7fe53);}})[_0xe03e('0x26')](function(){if(_0x2b246a){var _0x5d818d=[];var _0xb35aee=[];var _0x28bd8f=utils[_0xe03e('0xfa')]();var _0x2daba={'membername':_0x2b246a[_0xe03e('0x34')],'interface':_0x306c4c,'enterAt':moment()[_0xe03e('0xeb')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2b246a[_0xe03e('0x29')],'internal':_0x2b246a['internal']};_0x28bd8f[_0xe03e('0xf8')](function(_0x166904){_0x5d818d['push'](_[_0xe03e('0x56')]({'channel':_0x166904,'type':'LOGIN','data1':_0xdbf8a8[_0xe03e('0x5b')][_0xe03e('0xfb')],'data2':_0x306c4c},_0x2daba));if(_0x2b246a[_0xe03e('0xea')]){_0xb35aee['push'](_[_0xe03e('0x56')]({'channel':_0x166904,'type':_0xe03e('0xfc'),'data1':'LOGININPAUSE'},_0x2daba));}});return db['MemberReport'][_0xe03e('0x84')](_0x5d818d[_0xe03e('0xc7')](_0xb35aee),{'individualHooks':!![]});}})[_0xe03e('0x26')](function(){if(_0x2b246a){return _0x2b246a[_0xe03e('0x25')]({'online':!![],'lastLoginAt':moment()[_0xe03e('0xeb')](_0xe03e('0xf9')),'voicePause':_0x2b246a['loginInPause']||![],'mailPause':_0x2b246a[_0xe03e('0xea')]||![],'chatPause':_0x2b246a[_0xe03e('0xea')]||![],'faxPause':_0x2b246a['loginInPause']||![],'smsPause':_0x2b246a[_0xe03e('0xea')]||![],'openchannelPause':_0x2b246a[_0xe03e('0xea')]||![],'whatsappPause':_0x2b246a[_0xe03e('0xea')]||![],'pauseType':_0x2b246a[_0xe03e('0xea')]?'LOGININPAUSE':null,'interface':_0x306c4c,'lastPauseAt':moment()[_0xe03e('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xe03e('0x26')](function(_0x1ac304){if(_0xdbf8a8[_0xe03e('0xfd')]){return _0x5a554b();}else{return BPromise[_0xe03e('0xfe')](_0x1ac304)[_0xe03e('0x26')](respondWithResult(_0x11aa31,null));}})['catch'](handleError(_0x11aa31,null));};exports[_0xe03e('0xff')]=function(_0x2edb89,_0xa2c0c2){var _0x4174e4;return db[_0xe03e('0x3f')][_0xe03e('0x33')]({'where':{'id':_0x2edb89[_0xe03e('0x5c')]['id'],'role':_0xe03e('0x6e')},'attributes':['id',_0xe03e('0x34'),_0xe03e('0x29')]})['then'](handleEntityNotFound(_0xa2c0c2,null))['then'](function(_0x52b8a3){if(_0x52b8a3){_0x4174e4=_0x52b8a3;return db[_0xe03e('0xad')][_0xe03e('0x27')]({'where':{'membername':_0x4174e4['name']},'individualHooks':!![]});}})[_0xe03e('0x26')](function(){return db[_0xe03e('0xf7')]['findAll']({'where':{'membername':_0x4174e4[_0xe03e('0x34')],'exitAt':null}});})['then'](function(_0x8b96de){var _0x524f19=[];_0x8b96de['forEach'](function(_0x4aa624){_0x524f19[_0xe03e('0x47')](_0x4aa624['update']({'exitAt':moment()['format'](_0xe03e('0xf9'))}));});return BPromise[_0xe03e('0x4f')](_0x524f19);})[_0xe03e('0x26')](function(){return _0x4174e4[_0xe03e('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe03e('0x26')](respondWithResult(_0xa2c0c2,null))[_0xe03e('0x1b')](handleError(_0xa2c0c2,null));};exports[_0xe03e('0x100')]=function(_0x252920,_0x464836){var _0x91a7f2;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x252920[_0xe03e('0x5c')]['id']},'individualHooks':!![]})[_0xe03e('0x26')](function(){return db[_0xe03e('0x3f')]['find']({'where':{'id':_0x252920[_0xe03e('0x5c')]['id'],'role':_0xe03e('0x6e')},'attributes':['id',_0xe03e('0x34'),'role','internal',_0xe03e('0xa0')]});})[_0xe03e('0x26')](handleEntityNotFound(_0x464836,null))[_0xe03e('0x26')](function(_0x4406c2){if(_0x4406c2){_0x91a7f2=_0x4406c2;return respondWithRpcPromise('QueuePause',_0xe03e('0x100'),{'id':_0x91a7f2['id'],'name':_0x91a7f2[_0xe03e('0x34')],'pause':!![]});}})['then'](function(){if(_0x91a7f2){return db[_0xe03e('0xf7')][_0xe03e('0x48')]({'where':{'membername':_0x91a7f2[_0xe03e('0x34')],'type':_0xe03e('0xfc'),'exitAt':null}});}})[_0xe03e('0x26')](function(_0x119ceb){if(_0x119ceb[_0xe03e('0x4a')]){var _0x57972c=moment()[_0xe03e('0xeb')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x453d6c=0x0,_0x5079b6=_0x119ceb['length'];_0x453d6c<_0x5079b6;_0x453d6c++){_0x119ceb[_0x453d6c]['updateAttributes']({'exitAt':_0x57972c});}}})[_0xe03e('0x26')](function(){var _0x426184=[];var _0x2e9f36=utils['getChannels']();_0x2e9f36[_0xe03e('0xf8')](function(_0xfe3d0){_0x426184[_0xe03e('0x47')]({'channel':_0xfe3d0,'membername':_0x91a7f2[_0xe03e('0x34')],'interface':_[_0xe03e('0x65')](_0x91a7f2[_0xe03e('0xa0')])?util[_0xe03e('0xeb')](_0xe03e('0xac'),_0x91a7f2[_0xe03e('0x34')]):_0x91a7f2[_0xe03e('0xa0')],'type':_0xe03e('0xfc'),'enterAt':moment()['format'](_0xe03e('0xf9')),'data1':_0x252920[_0xe03e('0x5b')]['type']||_0xe03e('0x101'),'role':_0x91a7f2[_0xe03e('0x29')],'internal':_0x91a7f2[_0xe03e('0x64')]});});return db[_0xe03e('0xf7')][_0xe03e('0x84')](_0x426184,{'individualHooks':!![]});})['then'](function(){return _0x91a7f2[_0xe03e('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x252920[_0xe03e('0x5b')][_0xe03e('0x39')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xe03e('0xeb')](_0xe03e('0xf9'))});})[_0xe03e('0x26')](respondWithResult(_0x464836,null))[_0xe03e('0x1b')](handleError(_0x464836,null));};exports[_0xe03e('0x102')]=function(_0x289282,_0x4ba3a3){var _0x1cee9d;return db['User'][_0xe03e('0x33')]({'where':{'id':_0x289282['params']['id']},'attributes':['id',_0xe03e('0x34'),'role',_0xe03e('0x9f'),_0xe03e('0x103'),_0xe03e('0x104'),_0xe03e('0x105'),'openchannelPause','smsPause',_0xe03e('0x106'),_0xe03e('0x107'),_0xe03e('0x108')]})[_0xe03e('0x26')](handleEntityNotFound(_0x4ba3a3,null))[_0xe03e('0x26')](function(_0x7ac724){if(_0x7ac724){_0x1cee9d=_0x7ac724;if(_0x289282[_0xe03e('0x5b')][_0xe03e('0x9e')]&&!utils[_0xe03e('0xa1')](_0x289282[_0xe03e('0x5b')]['channel'])){throw new db[(_0xe03e('0x8f'))][(_0xe03e('0x90'))]('Unknown\x20channel');}switch(_0x289282[_0xe03e('0x5b')][_0xe03e('0x9e')]){case _0xe03e('0xa9'):return respondWithRpcPromise(_0xe03e('0x109'),'unpause',{'id':_0x1cee9d['id'],'name':_0x1cee9d[_0xe03e('0x34')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0xe03e('0x25')]({'paused':0x0},{'where':{'UserId':_0x1cee9d['id']},'individualHooks':!![]});})[_0xe03e('0x26')](function(){return db['MemberReport']['find']({'where':{'channel':_0x289282[_0xe03e('0x5b')][_0xe03e('0x9e')],'membername':_0x1cee9d['name'],'type':_0xe03e('0xfc'),'exitAt':null}});})[_0xe03e('0x26')](function(_0x9c8e9f){if(_0x9c8e9f){return _0x9c8e9f[_0xe03e('0x25')]({'exitAt':moment()['format'](_0xe03e('0xf9')),'data2':_0xe03e('0x10a')},{'individualHooks':!![]});}return null;})[_0xe03e('0x26')](function(){return _0x1cee9d[_0xe03e('0x25')]({'voicePause':![]});});case _0xe03e('0x5a'):case'chat':case'fax':case'sms':case _0xe03e('0x4e'):case _0xe03e('0x4d'):return db[_0xe03e('0xf7')][_0xe03e('0x33')]({'where':{'channel':_0x289282[_0xe03e('0x5b')][_0xe03e('0x9e')],'membername':_0x1cee9d[_0xe03e('0x34')],'type':'PAUSE','exitAt':null}})[_0xe03e('0x26')](function(_0x33c438){if(_0x33c438){return _0x33c438['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xe03e('0x26')](function(){var _0x1d3d2b={};_[_0xe03e('0x10b')](_0x1d3d2b,util[_0xe03e('0xeb')](_0xe03e('0x10c'),_0x289282['body'][_0xe03e('0x9e')],'Pause'),![]);return _0x1cee9d[_0xe03e('0x25')](_0x1d3d2b);});default:return respondWithRpcPromise(_0xe03e('0x109'),_0xe03e('0x102'),{'id':_0x1cee9d['id'],'name':_0x1cee9d[_0xe03e('0x34')],'pause':![]})[_0xe03e('0x26')](function(){return db[_0xe03e('0xad')]['update']({'paused':0x0},{'where':{'UserId':_0x1cee9d['id']}});})[_0xe03e('0x26')](function(){return db[_0xe03e('0xf7')][_0xe03e('0x48')]({'where':{'membername':_0x1cee9d[_0xe03e('0x34')],'type':_0xe03e('0xfc'),'exitAt':null}});})['then'](function(_0x2391eb){var _0x50dbfc=[];_0x2391eb['forEach'](function(_0x1a5a91){_0x50dbfc[_0xe03e('0x47')](_0x1a5a91[_0xe03e('0x25')]({'exitAt':moment()['format'](_0xe03e('0xf9')),'data2':'manual'}));});return BPromise[_0xe03e('0x4f')](_0x50dbfc);})[_0xe03e('0x26')](function(){return _0x1cee9d[_0xe03e('0x25')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x4ba3a3,null))[_0xe03e('0x1b')](handleError(_0x4ba3a3,null));};exports[_0xe03e('0x10d')]=function(_0xabbab3,_0x5a429e){var _0x6beaf={};var _0x3d477e={};var _0xc1a54a;var _0x5ca486;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0xabbab3['params']['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x5a429e,null))[_0xe03e('0x26')](function(_0x107861){if(_0x107861){_0xc1a54a=_0x107861;_0x3d477e[_0xe03e('0x54')]=_[_0xe03e('0x52')](db[_0xe03e('0x10e')][_0xe03e('0x38')]);_0x3d477e[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0xabbab3['query']);_0x3d477e[_0xe03e('0x53')]=_['intersection'](_0x3d477e[_0xe03e('0x54')],_0x3d477e['query']);_0x6beaf[_0xe03e('0x46')]=_['intersection'](_0x3d477e[_0xe03e('0x54')],qs[_0xe03e('0xc8')](_0xabbab3[_0xe03e('0x40')][_0xe03e('0xc8')]));_0x6beaf[_0xe03e('0x46')]=_0x6beaf[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x6beaf[_0xe03e('0x46')]:_0x3d477e['model'];_0x6beaf[_0xe03e('0xd4')]=qs[_0xe03e('0xc9')](_0xabbab3['query'][_0xe03e('0xc9')]);_0x6beaf['where']=qs['filters'](_[_0xe03e('0xca')](_0xabbab3[_0xe03e('0x40')],_0x3d477e['filters']));if(_0xabbab3[_0xe03e('0x40')][_0xe03e('0x2e')]){_0x6beaf[_0xe03e('0x3e')]=_[_0xe03e('0x56')](_0x6beaf[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x6beaf[_0xe03e('0x46')],function(_0x5f55bb){var _0xdf5690={};_0xdf5690[_0x5f55bb]={'$like':'%'+_0xabbab3['query'][_0xe03e('0x2e')]+'%'};return _0xdf5690;})});}_0x6beaf=_[_0xe03e('0x56')]({},_0x6beaf,_0xabbab3['options']);return _0xc1a54a[_0xe03e('0x10d')](_0x6beaf);}})[_0xe03e('0x26')](function(_0x5f3fda){if(_0x5f3fda){_0x5ca486=_0x5f3fda[_0xe03e('0x4a')];if(!_0xabbab3[_0xe03e('0x40')][_0xe03e('0xcc')](_0xe03e('0xd1'))){_0x6beaf['limit']=qs['limit'](_0xabbab3[_0xe03e('0x40')][_0xe03e('0x22')]);_0x6beaf['offset']=qs[_0xe03e('0x20')](_0xabbab3[_0xe03e('0x40')]['offset']);}return _0xc1a54a[_0xe03e('0x10d')](_0x6beaf);}})[_0xe03e('0x26')](function(_0x860279){if(_0x860279){return _0x860279?{'count':_0x5ca486,'rows':_0x860279}:null;}})['then'](respondWithResult(_0x5a429e,null))[_0xe03e('0x1b')](handleError(_0x5a429e,null));};exports[_0xe03e('0x10f')]=function(_0x49e76f,_0x200e96){return db[_0xe03e('0x3f')][_0xe03e('0x33')]({'where':{'id':_0x49e76f[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x200e96,null))[_0xe03e('0x26')](function(_0x4ce011){if(_0x4ce011){var _0x567294=_0x4ce011[_0xe03e('0x28')]({'plain':!![]});return _0x4ce011[_0xe03e('0x10f')](_0x49e76f[_0xe03e('0x5b')][_0xe03e('0x5f')],_['omit'](_0x49e76f[_0xe03e('0x5b')],[_0xe03e('0x5f'),'id'])||{})['then'](function(){for(var _0xa15dd1=0x0;_0xa15dd1<_0x49e76f[_0xe03e('0x5b')][_0xe03e('0x5f')]['length'];_0xa15dd1++){var _0x1c1ca1=[];var _0x5ae697={};db[_0xe03e('0x10e')][_0xe03e('0x96')]({'where':{'id':_0x49e76f['body']['ids'][_0xa15dd1]}})[_0xe03e('0x26')](function(_0x3c8be9){_0x5ae697=_0x3c8be9[_0xe03e('0x4c')];_0x1c1ca1['push'](_0x3c8be9[_0xe03e('0x110')]()[_0xe03e('0x26')](function(_0x20480c){for(var _0x591136=0x0;_0x591136<_0x20480c['length'];_0x591136++){_0x20480c[_0x591136][_0xe03e('0x111')](_0xe03e('0x9e'),'Voice');}return _0x20480c;}));_0x1c1ca1[_0xe03e('0x47')](_0x3c8be9[_0xe03e('0x112')]()[_0xe03e('0x26')](function(_0x1ef075){for(var _0x2daa07=0x0;_0x2daa07<_0x1ef075[_0xe03e('0x4a')];_0x2daa07++){_0x1ef075[_0x2daa07][_0xe03e('0x111')](_0xe03e('0x9e'),_0xe03e('0x113'));}return _0x1ef075;}));_0x1c1ca1['push'](_0x3c8be9[_0xe03e('0x114')]()[_0xe03e('0x26')](function(_0x51ebf6){for(var _0x2e507a=0x0;_0x2e507a<_0x51ebf6[_0xe03e('0x4a')];_0x2e507a++){_0x51ebf6[_0x2e507a][_0xe03e('0x111')](_0xe03e('0x9e'),_0xe03e('0x115'));}return _0x51ebf6;}));_0x1c1ca1['push'](_0x3c8be9['getSmsQueues']()[_0xe03e('0x26')](function(_0x4184ab){for(var _0x199d1b=0x0;_0x199d1b<_0x4184ab[_0xe03e('0x4a')];_0x199d1b++){_0x4184ab[_0x199d1b][_0xe03e('0x111')](_0xe03e('0x9e'),_0xe03e('0x116'));}return _0x4184ab;}));_0x1c1ca1[_0xe03e('0x47')](_0x3c8be9['getWhatsappQueues']()[_0xe03e('0x26')](function(_0x2f7c9f){for(var _0x2a15f1=0x0;_0x2a15f1<_0x2f7c9f[_0xe03e('0x4a')];_0x2a15f1++){_0x2f7c9f[_0x2a15f1][_0xe03e('0x111')](_0xe03e('0x9e'),_0xe03e('0x117'));}return _0x2f7c9f;}));_0x1c1ca1['push'](_0x3c8be9[_0xe03e('0x118')]()[_0xe03e('0x26')](function(_0x197237){for(var _0x2003b8=0x0;_0x2003b8<_0x197237[_0xe03e('0x4a')];_0x2003b8++){_0x197237[_0x2003b8][_0xe03e('0x111')](_0xe03e('0x9e'),_0xe03e('0x119'));}return _0x197237;}));_0x1c1ca1[_0xe03e('0x47')](_0x3c8be9[_0xe03e('0x11a')]()[_0xe03e('0x26')](function(_0x50de86){for(var _0x53c8e2=0x0;_0x53c8e2<_0x50de86[_0xe03e('0x4a')];_0x53c8e2++){_0x50de86[_0x53c8e2][_0xe03e('0x111')](_0xe03e('0x9e'),_0xe03e('0x11b'));}return _0x50de86;}));return BPromise[_0xe03e('0x4f')](_0x1c1ca1);})[_0xe03e('0x26')](function(_0x1a7220){var _0xd04914=_['flatten'](_0x1a7220);_0x1c1ca1=[];return db[_0xe03e('0x67')][_0xe03e('0x11c')](function(_0xec55cb){for(var _0x16813d=0x0;_0x16813d<_0xd04914[_0xe03e('0x4a')];_0x16813d++){_0x1c1ca1[_0xe03e('0x47')](_0xd04914[_0x16813d]['addAgent'](_0x567294['id']),{'transaction':_0xec55cb});}return BPromise[_0xe03e('0x4f')](_0x1c1ca1)[_0xe03e('0x26')](function(){if(_0x567294[_0xe03e('0xab')]){return BPromise['each'](_[_0xe03e('0x2e')](_0xd04914,function(_0x271d8b){return _0x271d8b['getDataValue'](_0xe03e('0x9e'))===_0xe03e('0x11d');}),function(_0x4f0ee8){return db[_0xe03e('0xad')][_0xe03e('0xf6')]({'membername':_0x567294[_0xe03e('0x34')],'UserId':_0x567294['id'],'queue_name':_0x4f0ee8[_0xe03e('0x34')],'VoiceQueueId':_0x4f0ee8['id'],'interface':_[_0xe03e('0x65')](_0x567294['interface'])?util[_0xe03e('0xeb')]('SIP/%s',_0x567294[_0xe03e('0x34')]):_0x567294[_0xe03e('0xa0')],'paused':_0x567294[_0xe03e('0x9f')]||![],'penalty':_0x567294[_0xe03e('0xa6')]},{'transaction':_0xec55cb});});}else{return;}})[_0xe03e('0x26')](function(){for(var _0xff5eb5=0x0;_0xff5eb5<_0xd04914[_0xe03e('0x4a')];_0xff5eb5++){var _0x924c=_0xd04914[_0xff5eb5]['getDataValue'](_0xe03e('0x9e'));var _0x34ff0a=_0x924c+_0xe03e('0xb1');socket[_0xe03e('0xa7')]('user'+_0x924c+'Queue:save',{'UserId':_0x567294['id'],['queueField']:_0xd04914[_0xff5eb5]['id']});}});});})[_0xe03e('0x26')](function(){db[_0xe03e('0x11e')]['findOne']({'where':{'teamId':_0x5ae697['id']}})['then'](function(_0x90be92){if(_0x90be92){db['UserVoicePrefix'][_0xe03e('0x7d')]({'UserId':_0x49e76f[_0xe03e('0x5c')]['id'],'VoicePrefixId':_0x90be92[_0xe03e('0x11f')]});}});});}});}})[_0xe03e('0x26')](respondWithStatusCode(_0x200e96,null))[_0xe03e('0x1b')](handleError(_0x200e96,null));};exports[_0xe03e('0x120')]=function(_0x4c6ddf,_0x11d1da){return db['User'][_0xe03e('0x96')]({'where':{'id':_0x4c6ddf[_0xe03e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x11d1da,null))[_0xe03e('0x26')](function(_0x14ca65){if(_0x14ca65){var _0x2fdb57=_0x14ca65[_0xe03e('0x28')]({'plain':!![]});var _0x4a24b3=_0x4c6ddf['query'][_0xe03e('0x5f')];return _0x14ca65[_0xe03e('0x120')](_0x4a24b3)[_0xe03e('0x26')](function(){for(var _0xc4d68b=0x0;_0xc4d68b<_0x4a24b3[_0xe03e('0x4a')];_0xc4d68b++){var _0x1bf4d1=[];var _0x3bf91a={};db[_0xe03e('0x10e')][_0xe03e('0x96')]({'where':{'id':_0x4a24b3[_0xc4d68b]}})[_0xe03e('0x26')](function(_0x568035){_0x3bf91a=_0x568035[_0xe03e('0x4c')];_0x1bf4d1['push'](_0x568035[_0xe03e('0x110')]()[_0xe03e('0x26')](function(_0x201022){for(var _0x5b26d1=0x0;_0x5b26d1<_0x201022['length'];_0x5b26d1++){_0x201022[_0x5b26d1][_0xe03e('0x111')]('channel',_0xe03e('0x11d'));}return _0x201022;}));_0x1bf4d1[_0xe03e('0x47')](_0x568035[_0xe03e('0x112')]()[_0xe03e('0x26')](function(_0x711ae7){for(var _0x49507c=0x0;_0x49507c<_0x711ae7[_0xe03e('0x4a')];_0x49507c++){_0x711ae7[_0x49507c]['setDataValue'](_0xe03e('0x9e'),_0xe03e('0x113'));}return _0x711ae7;}));_0x1bf4d1[_0xe03e('0x47')](_0x568035[_0xe03e('0x114')]()[_0xe03e('0x26')](function(_0x46403e){for(var _0x5e0c10=0x0;_0x5e0c10<_0x46403e['length'];_0x5e0c10++){_0x46403e[_0x5e0c10]['setDataValue'](_0xe03e('0x9e'),_0xe03e('0x115'));}return _0x46403e;}));_0x1bf4d1[_0xe03e('0x47')](_0x568035[_0xe03e('0x121')]()['then'](function(_0x59cf90){for(var _0x532ae5=0x0;_0x532ae5<_0x59cf90['length'];_0x532ae5++){_0x59cf90[_0x532ae5][_0xe03e('0x111')](_0xe03e('0x9e'),'Sms');}return _0x59cf90;}));_0x1bf4d1[_0xe03e('0x47')](_0x568035[_0xe03e('0x122')]()[_0xe03e('0x26')](function(_0x1cd2a2){for(var _0x165fc6=0x0;_0x165fc6<_0x1cd2a2[_0xe03e('0x4a')];_0x165fc6++){_0x1cd2a2[_0x165fc6]['setDataValue'](_0xe03e('0x9e'),_0xe03e('0x117'));}return _0x1cd2a2;}));_0x1bf4d1[_0xe03e('0x47')](_0x568035[_0xe03e('0x118')]()[_0xe03e('0x26')](function(_0x5a4d90){for(var _0xf7d4d3=0x0;_0xf7d4d3<_0x5a4d90[_0xe03e('0x4a')];_0xf7d4d3++){_0x5a4d90[_0xf7d4d3]['setDataValue']('channel',_0xe03e('0x119'));}return _0x5a4d90;}));_0x1bf4d1[_0xe03e('0x47')](_0x568035['getOpenchannelQueues']()[_0xe03e('0x26')](function(_0x11451e){for(var _0x5e5d34=0x0;_0x5e5d34<_0x11451e['length'];_0x5e5d34++){_0x11451e[_0x5e5d34][_0xe03e('0x111')](_0xe03e('0x9e'),_0xe03e('0x11b'));}return _0x11451e;}));return BPromise[_0xe03e('0x4f')](_0x1bf4d1);})[_0xe03e('0x26')](function(_0x248e71){var _0xca2220=_[_0xe03e('0x123')](_0x248e71);_0x1bf4d1=[];return db['sequelize'][_0xe03e('0x11c')](function(_0x3b43b2){for(var _0x5be2be=0x0;_0x5be2be<_0xca2220['length'];_0x5be2be++){_0x1bf4d1[_0xe03e('0x47')](_0xca2220[_0x5be2be][_0xe03e('0x124')](_0x2fdb57['id']),{'transaction':_0x3b43b2});}return BPromise[_0xe03e('0x4f')](_0x1bf4d1)[_0xe03e('0x26')](function(){if(_0x2fdb57['online']){return BPromise['each'](_[_0xe03e('0x2e')](_0xca2220,function(_0x27b746){return _0x27b746[_0xe03e('0x125')](_0xe03e('0x9e'))===_0xe03e('0x11d');}),function(_0x30f9be){return db[_0xe03e('0xad')][_0xe03e('0x27')]({'where':{'VoiceQueueId':_0x30f9be['id'],'UserId':_0x2fdb57['id']},'transaction':_0x3b43b2});});}else{return;}})[_0xe03e('0x26')](function(){db[_0xe03e('0x11e')][_0xe03e('0x96')]({'where':{'teamId':_0x3bf91a['id']}})[_0xe03e('0x26')](function(_0x5a3f30){if(_0x5a3f30){return db[_0xe03e('0x126')][_0xe03e('0x27')]({'where':{'UserId':_0x2fdb57['id'],'VoicePrefixId':_0x5a3f30['dataValues']['VoicePrefixId']}});}});})['then'](function(){for(var _0x11d0b4=0x0;_0x11d0b4<_0xca2220[_0xe03e('0x4a')];_0x11d0b4++){var _0x5eb857=_0xca2220[_0x11d0b4][_0xe03e('0x125')](_0xe03e('0x9e'));var _0x2e97c1=_0x5eb857+_0xe03e('0xb1');socket[_0xe03e('0xa7')](_0xe03e('0x2b')+_0x5eb857+_0xe03e('0xb0'),{'UserId':_0x2fdb57['id'],['queueField']:_0xca2220[_0x11d0b4]['id']});}});});});}});}})[_0xe03e('0x26')](respondWithStatusCode(_0x11d1da,null))[_0xe03e('0x1b')](handleError(_0x11d1da,null));};exports[_0xe03e('0x127')]=function(_0x5070c8,_0xd5a8c6){var _0x3c3a00={};var _0x12d55b={};var _0xc4d1d4;var _0x56d82e;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x5070c8[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0xd5a8c6,null))[_0xe03e('0x26')](function(_0x24d020){if(_0x24d020){_0xc4d1d4=_0x24d020;_0x12d55b['model']=_[_0xe03e('0x52')](db[_0xe03e('0xcd')][_0xe03e('0x38')]);_0x12d55b[_0xe03e('0x40')]=_['keys'](_0x5070c8[_0xe03e('0x40')]);_0x12d55b['filters']=_[_0xe03e('0x55')](_0x12d55b[_0xe03e('0x54')],_0x12d55b[_0xe03e('0x40')]);_0x3c3a00[_0xe03e('0x46')]=_['intersection'](_0x12d55b[_0xe03e('0x54')],qs['fields'](_0x5070c8[_0xe03e('0x40')]['fields']));_0x3c3a00[_0xe03e('0x46')]=_0x3c3a00[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x3c3a00['attributes']:_0x12d55b[_0xe03e('0x54')];_0x3c3a00[_0xe03e('0xd4')]=qs['sort'](_0x5070c8[_0xe03e('0x40')][_0xe03e('0xc9')]);_0x3c3a00[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_['pick'](_0x5070c8[_0xe03e('0x40')],_0x12d55b[_0xe03e('0x53')]));if(_0x5070c8[_0xe03e('0x40')]['filter']){_0x3c3a00['where']=_[_0xe03e('0x56')](_0x3c3a00[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x3c3a00['attributes'],function(_0x17bf29){var _0x220aef={};_0x220aef[_0x17bf29]={'$like':'%'+_0x5070c8[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0x220aef;})});}_0x3c3a00=_[_0xe03e('0x56')]({},_0x3c3a00,_0x5070c8[_0xe03e('0x57')]);return _0xc4d1d4[_0xe03e('0x127')](_0x3c3a00);}})['then'](function(_0xba2a8d){if(_0xba2a8d){_0x56d82e=_0xba2a8d[_0xe03e('0x4a')];if(!_0x5070c8[_0xe03e('0x40')][_0xe03e('0xcc')]('nolimit')){_0x3c3a00[_0xe03e('0x22')]=qs['limit'](_0x5070c8[_0xe03e('0x40')][_0xe03e('0x22')]);_0x3c3a00[_0xe03e('0x20')]=qs[_0xe03e('0x20')](_0x5070c8[_0xe03e('0x40')][_0xe03e('0x20')]);}return _0xc4d1d4[_0xe03e('0x127')](_0x3c3a00);}})[_0xe03e('0x26')](function(_0x34566f){if(_0x34566f){return _0x34566f?{'count':_0x56d82e,'rows':_0x34566f}:null;}})[_0xe03e('0x26')](respondWithResult(_0xd5a8c6,null))['catch'](handleError(_0xd5a8c6,null));};exports[_0xe03e('0x128')]=function(_0x2250ff,_0x21b5b3){var _0x283b3f={};var _0x339db2={};var _0x2bf206;return db[_0xe03e('0x3f')][_0xe03e('0x96')]({'where':{'id':_0x2250ff[_0xe03e('0x5c')]['id']}})[_0xe03e('0x26')](handleEntityNotFound(_0x21b5b3,null))['then'](function(_0x19db5f){if(_0x19db5f){_0x2bf206=_0x19db5f;_0x339db2[_0xe03e('0x54')]=_[_0xe03e('0x52')](db[_0xe03e('0x3f')][_0xe03e('0x38')]);_0x339db2[_0xe03e('0x40')]=_[_0xe03e('0x52')](_0x2250ff['query']);_0x339db2[_0xe03e('0x53')]=_[_0xe03e('0x55')](_0x339db2['model'],_0x339db2[_0xe03e('0x40')]);_0x283b3f[_0xe03e('0x46')]=_[_0xe03e('0x55')](_0x339db2['model'],qs[_0xe03e('0xc8')](_0x2250ff['query'][_0xe03e('0xc8')]));_0x283b3f[_0xe03e('0x46')]=_0x283b3f[_0xe03e('0x46')][_0xe03e('0x4a')]?_0x283b3f[_0xe03e('0x46')]:_0x339db2[_0xe03e('0x54')];_0x283b3f[_0xe03e('0xd4')]=qs['sort'](_0x2250ff[_0xe03e('0x40')][_0xe03e('0xc9')]);_0x283b3f[_0xe03e('0x3e')]=qs[_0xe03e('0x53')](_[_0xe03e('0xca')](_0x2250ff[_0xe03e('0x40')],_0x339db2[_0xe03e('0x53')]));if(_0x2250ff[_0xe03e('0x40')]['filter']){_0x283b3f['where']=_[_0xe03e('0x56')](_0x283b3f[_0xe03e('0x3e')],{'$or':_[_0xe03e('0x30')](_0x283b3f[_0xe03e('0x46')],function(_0x30885b){var _0x151f64={};_0x151f64[_0x30885b]={'$like':'%'+_0x2250ff[_0xe03e('0x40')][_0xe03e('0x2e')]+'%'};return _0x151f64;})});}_0x283b3f[_0xe03e('0x54')]=db[_0xe03e('0x3f')];_0x283b3f['as']=_0xe03e('0x2c');_0x283b3f=_[_0xe03e('0x56')]({},_0x283b3f,_0x2250ff[_0xe03e('0x57')]);return _0x2bf206[_0xe03e('0x110')]({'include':[_0x283b3f]});}})[_0xe03e('0x26')](function(_0x17ea68){if(_0x17ea68){var _0x382c70={},_0x510c99=[];for(var _0x35cc24=0x0;_0x35cc24<_0x17ea68[_0xe03e('0x4a')];_0x35cc24+=0x1){for(var _0x1a351a=0x0,_0x4347f0;_0x1a351a<_0x17ea68[_0x35cc24][_0xe03e('0x2c')][_0xe03e('0x4a')];_0x1a351a+=0x1){_0x4347f0=_0x17ea68[_0x35cc24]['Agents'][_0x1a351a][_0xe03e('0x28')]({'plain':!![]});_0x382c70[_0x4347f0['id']]=_0x4347f0;}}_0x382c70=_[_0xe03e('0x129')](_0x382c70);for(var _0x5a1dd7=qs['offset'](_0x2250ff[_0xe03e('0x40')][_0xe03e('0x20')]);_0x5a1dd7<_0x382c70[_0xe03e('0x4a')]&&_0x510c99[_0xe03e('0x4a')]=_0x44355c){_0x47155e=_0x44355c;_0x4bdfcb=0xc8;}else{_0x4bdfcb=0xce;}_0x5cca1b['status'](_0x4bdfcb);return _0x5cca1b[_0x1c9f('0x23')](_0x1c9f('0x24'),_0x5b2fd7+'-'+_0x47155e+'/'+_0x44355c)['json'](_0x126d1b);}return null;};}function saveUpdates(_0xa9d224){return function(_0x2ec164){if(_0x2ec164){return _0x2ec164[_0x1c9f('0x25')](_0xa9d224)[_0x1c9f('0x26')](function(_0xb6efcb){return _0xb6efcb;});}return null;};}function removeEntity(_0x39311e){return function(_0x5e69b7){if(_0x5e69b7){return _0x5e69b7[_0x1c9f('0x27')]()[_0x1c9f('0x26')](function(){var _0x3c091b=_0x5e69b7[_0x1c9f('0x28')]({'plain':!![]});if(_0x3c091b[_0x1c9f('0x29')]===_0x1c9f('0x2a'))return;var _0x1293d3=[{'name':_0x1c9f('0x2b'),'value':_0x1c9f('0x2c'),'ignore':!![]},{'name':_0x1c9f('0x2d'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x1c9f('0x2e'),'ignore':![]}];var _0x25933e=_(_0x1293d3)['filter'](_0x1c9f('0x2f'))['map'](_0x1c9f('0x30'))[_0x1c9f('0x30')]();if(_[_0x1c9f('0x31')](_0x25933e,_0x3c091b[_0x1c9f('0x29')])){return;}var _0x3ed09c=_[_0x1c9f('0x32')](_0x1293d3,[_0x1c9f('0x30'),_0x3c091b[_0x1c9f('0x29')]])[_0x1c9f('0x33')];return db[_0x1c9f('0x34')][_0x1c9f('0x27')]({'where':{'type':_0x3ed09c,'resourceId':_0x3c091b['id']}})[_0x1c9f('0x26')](function(){return _0x5e69b7;});})['then'](function(){_0x39311e[_0x1c9f('0x35')](0xcc)[_0x1c9f('0x1d')]();});}};}function handleEntityNotFound(_0x5b03bb){return function(_0xacbd78){if(!_0xacbd78){_0x5b03bb[_0x1c9f('0x36')](0x194);}return _0xacbd78;};}function handleError(_0x39bbfe,_0x525ff9){_0x525ff9=_0x525ff9||0x1f4;return function(_0x567c55){logger[_0x1c9f('0x17')](_0x567c55['stack']);if(_0x567c55[_0x1c9f('0x33')]){delete _0x567c55[_0x1c9f('0x33')];}_0x39bbfe['status'](_0x525ff9)[_0x1c9f('0x37')](_0x567c55);};}exports[_0x1c9f('0x38')]=function(_0x5282b2,_0xf76d05){var _0x151467={},_0x1d6474={'count':0x0,'rows':[]};var _0x5e7da7=_(db[_0x1c9f('0x39')][_0x1c9f('0x3a')])['map'](function(_0x2bdc3d){return{'name':_0x2bdc3d[_0x1c9f('0x3b')],'type':_0x2bdc3d[_0x1c9f('0x3c')][_0x1c9f('0x3d')]};})['filter'](function(_0x4da7c9){return!_['includes']([_0x1c9f('0x3e'),'salt'],_0x4da7c9[_0x1c9f('0x33')]);})[_0x1c9f('0x30')]();_0x151467=qs[_0x1c9f('0x3f')](_0x5e7da7,_0x5282b2);var _0x182edd={'where':_0x151467[_0x1c9f('0x40')]};return db[_0x1c9f('0x39')]['count'](_0x182edd)[_0x1c9f('0x26')](function(_0x288878){_0x1d6474['count']=_0x288878;if(_0x5282b2[_0x1c9f('0x41')][_0x1c9f('0x42')]){_0x151467[_0x1c9f('0x43')]=[{'all':!![]}];}if(_0x5282b2[_0x1c9f('0x41')][_0x1c9f('0x44')]===_0x1c9f('0x45')){_0x151467['include']=[{'model':db[_0x1c9f('0x46')],'as':_0x1c9f('0x44')}];}if(!_[_0x1c9f('0x31')](_0x151467[_0x1c9f('0x47')],'id')){_0x151467[_0x1c9f('0x47')][_0x1c9f('0x48')]('id');}return db[_0x1c9f('0x39')][_0x1c9f('0x49')](_0x151467);})[_0x1c9f('0x26')](function(_0xef0dba){_0x1d6474[_0x1c9f('0x4a')]=_0xef0dba;if(_0x5282b2['query']['openTabs']===_0x1c9f('0x45')){var _0x2bd3ec=[];for(var _0x283908=0x0;_0x283908<_0x1d6474[_0x1c9f('0x4a')][_0x1c9f('0x4b')];_0x283908++){_0x2bd3ec['push'](get_open_tabs(_0x1c9f('0x4c'),_0x1d6474['rows'][_0x283908][_0x1c9f('0x4d')]));_0x2bd3ec[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x4e'),_0x1d6474['rows'][_0x283908][_0x1c9f('0x4d')]));_0x2bd3ec[_0x1c9f('0x48')](get_open_tabs('fax',_0x1d6474[_0x1c9f('0x4a')][_0x283908][_0x1c9f('0x4d')]));_0x2bd3ec[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x4f'),_0x1d6474[_0x1c9f('0x4a')][_0x283908][_0x1c9f('0x4d')]));_0x2bd3ec['push'](get_open_tabs(_0x1c9f('0x50'),_0x1d6474[_0x1c9f('0x4a')][_0x283908]['dataValues']));_0x2bd3ec[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x51'),_0x1d6474[_0x1c9f('0x4a')][_0x283908][_0x1c9f('0x4d')]));}return BPromise[_0x1c9f('0x52')](_0x2bd3ec)[_0x1c9f('0x26')](function(){return _0x1d6474;});}else{return _0x1d6474;}})[_0x1c9f('0x26')](respondWithFilteredResult(_0xf76d05,_0x151467))['catch'](handleError(_0xf76d05,null));};exports[_0x1c9f('0x53')]=function(_0x35afdf,_0x502412){var _0x3a4c01={'raw':![],'where':{'id':_0x35afdf[_0x1c9f('0x54')]['id']}},_0x404f79={};_0x404f79[_0x1c9f('0x55')]=_[_0x1c9f('0x56')](_[_0x1c9f('0x57')](db[_0x1c9f('0x39')]['rawAttributes']),[_0x1c9f('0x3e'),_0x1c9f('0x58')]);_0x404f79[_0x1c9f('0x41')]=_[_0x1c9f('0x57')](_0x35afdf['query']);_0x404f79[_0x1c9f('0x59')]=_[_0x1c9f('0x5a')](_0x404f79[_0x1c9f('0x55')],_0x404f79[_0x1c9f('0x41')]);_0x3a4c01[_0x1c9f('0x47')]=_['intersection'](_0x404f79['model'],qs[_0x1c9f('0x5b')](_0x35afdf['query'][_0x1c9f('0x5b')]));_0x3a4c01[_0x1c9f('0x47')]=_0x3a4c01[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x3a4c01[_0x1c9f('0x47')]:_0x404f79[_0x1c9f('0x55')];if(_0x35afdf[_0x1c9f('0x41')][_0x1c9f('0x42')]){_0x3a4c01[_0x1c9f('0x43')]=[{'all':!![]}];}if(_0x35afdf[_0x1c9f('0x41')][_0x1c9f('0x44')]===_0x1c9f('0x45')){_0x3a4c01[_0x1c9f('0x43')]=[{'model':db[_0x1c9f('0x46')],'as':_0x1c9f('0x44')}];}_0x3a4c01=_[_0x1c9f('0x5c')]({},_0x3a4c01,_0x35afdf[_0x1c9f('0x5d')]);if(!_[_0x1c9f('0x31')](_0x3a4c01['attributes'],'id')){_0x3a4c01[_0x1c9f('0x47')][_0x1c9f('0x48')]('id');}return db[_0x1c9f('0x39')][_0x1c9f('0x32')](_0x3a4c01)[_0x1c9f('0x26')](handleEntityNotFound(_0x502412,null))[_0x1c9f('0x26')](function(_0x450c2b){var _0x3f387d=[];values=_0x450c2b;if(_0x35afdf['query'][_0x1c9f('0x5e')]===_0x1c9f('0x45')){_0x3f387d[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x4c'),_0x450c2b[_0x1c9f('0x4d')]));_0x3f387d[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x4e'),_0x450c2b[_0x1c9f('0x4d')]));_0x3f387d[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x50'),_0x450c2b['dataValues']));_0x3f387d[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x51'),_0x450c2b[_0x1c9f('0x4d')]));_0x3f387d[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x5f'),_0x450c2b[_0x1c9f('0x4d')]));_0x3f387d[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x4f'),_0x450c2b['dataValues']));return BPromise['all'](_0x3f387d);}else{return values;}})[_0x1c9f('0x26')](function(){return values;})[_0x1c9f('0x26')](respondWithResult(_0x502412,null))[_0x1c9f('0x1c')](handleError(_0x502412,null));};exports[_0x1c9f('0x25')]=function(_0x273ea5,_0x182ff2){if(_0x273ea5[_0x1c9f('0x60')]['id']){delete _0x273ea5[_0x1c9f('0x60')]['id'];}delete _0x273ea5['body'][_0x1c9f('0x29')];return db[_0x1c9f('0x39')]['find']({'where':{'id':_0x273ea5[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x182ff2,null))[_0x1c9f('0x26')](saveUpdates(_0x273ea5[_0x1c9f('0x60')],null))[_0x1c9f('0x26')](respondWithResult(_0x182ff2,null))['catch'](handleError(_0x182ff2,null));};exports[_0x1c9f('0x61')]=function(_0x56d922,_0xa4a56c){return db[_0x1c9f('0x39')][_0x1c9f('0x61')]()['then'](respondWithResult(_0xa4a56c,null))[_0x1c9f('0x1c')](handleError(_0xa4a56c,null));};exports[_0x1c9f('0x62')]=function(_0x1fdfec,_0x17be90){return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x1fdfec[_0x1c9f('0x54')]['id']}})['then'](handleEntityNotFound(_0x17be90,null))[_0x1c9f('0x26')](function(_0x5c755b){if(_0x5c755b){return _0x5c755b[_0x1c9f('0x62')](_0x1fdfec[_0x1c9f('0x60')][_0x1c9f('0x63')],_[_0x1c9f('0x64')](_0x1fdfec['body'],[_0x1c9f('0x63'),'id'])||{});}})['then'](respondWithResult(_0x17be90,null))[_0x1c9f('0x1c')](handleError(_0x17be90,null));};function validateUser(_0x418a47){return new BPromise(function(_0x2cea0b,_0x4154cb){if(_0x418a47[_0x1c9f('0x65')])return _0x2cea0b(_0x418a47);return db[_0x1c9f('0x66')][_0x1c9f('0x67')](0x1)['then'](function(_0x5f02f2){if(_0x5f02f2[_0x1c9f('0x68')])authService['validatePasswordPattern'](_0x418a47[_0x1c9f('0x3e')]);db[_0x1c9f('0x39')][_0x1c9f('0x69')](_0x1c9f('0x65'))[_0x1c9f('0x26')](function(_0x50122e){if(_[_0x1c9f('0x6a')](_0x50122e)){_0x418a47['internal']=_0x5f02f2[_0x1c9f('0x6b')]||0x1;return;}if(_[_0x1c9f('0x6a')](_0x5f02f2['min_internal'])||_0x5f02f2['min_internal']===_0x50122e){_0x418a47[_0x1c9f('0x65')]=_0x50122e+0x1;return;}if(_0x5f02f2[_0x1c9f('0x6b')]>_0x50122e){_0x418a47[_0x1c9f('0x65')]=_0x5f02f2['min_internal'];return;}return db[_0x1c9f('0x6c')][_0x1c9f('0x41')](_0x1c9f('0x6d'),{'type':db[_0x1c9f('0x6c')]['QueryTypes']['SELECT']})[_0x1c9f('0x26')](function(_0x1bf73f){if(_0x1bf73f&&_0x1bf73f[_0x1c9f('0x4b')]){for(var _0x7ae93c=0x0,_0x932f15=_0x1bf73f[_0x1c9f('0x4b')];_0x7ae93c<_0x932f15&&_['isNil'](_0x418a47['internal']);_0x7ae93c++){if(_0x5f02f2['min_internal']<=_0x1bf73f[_0x7ae93c]['from']){_0x418a47[_0x1c9f('0x65')]=_0x1bf73f[_0x7ae93c][_0x1c9f('0x6e')];}else if(_0x5f02f2[_0x1c9f('0x6b')]>_0x1bf73f[_0x7ae93c][_0x1c9f('0x6e')]&&_0x5f02f2['min_internal']<=_0x1bf73f[_0x7ae93c]['to']){_0x418a47['internal']=_0x5f02f2[_0x1c9f('0x6b')];}}}if(_[_0x1c9f('0x6a')](_0x418a47[_0x1c9f('0x65')])){_0x418a47[_0x1c9f('0x65')]=_0x50122e+0x1;}return _0x2cea0b(_0x418a47);});});})[_0x1c9f('0x1c')](function(_0x4f45c3){_0x4154cb(_0x4f45c3);});});}function updateUser(_0x16b29c){return new BPromise(function(_0x5ae7a9,_0x114cf6){try{if(_0x16b29c[_0x1c9f('0x6f')]){_0x16b29c[_0x1c9f('0x70')]=_0x16b29c['internal'];_0x16b29c[_0x1c9f('0x71')]={'mailbox':_0x16b29c[_0x1c9f('0x65')],'password':_0x16b29c[_0x1c9f('0x3e')],'fullname':_0x16b29c['fullname'],'email':_0x16b29c[_0x1c9f('0x72')]};}if(_0x16b29c['role']==='agent'){if(!_0x16b29c[_0x1c9f('0x73')])_0x16b29c[_0x1c9f('0x73')]=[_0x1c9f('0x74'),_0x1c9f('0x75'),_0x1c9f('0x76'),_0x1c9f('0x77'),_0x1c9f('0x78'),'104',_0x1c9f('0x79'),_0x1c9f('0x7a'),_0x1c9f('0x7b'),'108','109',_0x1c9f('0x7c'),_0x1c9f('0x7d'),'114',_0x1c9f('0x7e')];}_0x5ae7a9(_0x16b29c);}catch(_0xdb1cd7){_0x114cf6(_0xdb1cd7);}});}exports[_0x1c9f('0x7f')]=function(_0xa67f9b,_0x55b55f){if(_0xa67f9b[_0x1c9f('0x2c')][_0x1c9f('0x29')]===_0x1c9f('0x80'))throw new Error(_0x1c9f('0x81'));if(_0xa67f9b[_0x1c9f('0x60')]['role']==='user'&&_0xa67f9b[_0x1c9f('0x2c')][_0x1c9f('0x29')]!==_0x1c9f('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0xa67f9b[_0x1c9f('0x60')]['role']===_0x1c9f('0x2a')&&_0xa67f9b[_0x1c9f('0x2c')]['role']!=='admin'){throw new Error(_0x1c9f('0x82'));}return licenseUtil[_0x1c9f('0x83')]([_0xa67f9b['body']])[_0x1c9f('0x26')](function(){return validateUser(_0xa67f9b[_0x1c9f('0x60')]);})[_0x1c9f('0x26')](function(_0x23b742){return updateUser(_0x23b742)[_0x1c9f('0x26')](function(_0x56a836){if(_0x56a836[_0x1c9f('0x29')]==='admin'){_0x56a836[_0x1c9f('0x84')]=_0xa67f9b['user'][_0x1c9f('0x84')];delete _0x56a836[_0x1c9f('0x85')];}return _0x56a836;});})[_0x1c9f('0x26')](function(_0x182456){return db['User'][_0x1c9f('0x7f')](_0x182456,{'include':[{'model':db['VoiceMail'],'as':_0x1c9f('0x71')}]});})['then'](function(_0x25fc2a){if(_0xa67f9b[_0x1c9f('0x60')][_0x1c9f('0x29')]===_0x1c9f('0x2c'))return _0x25fc2a;if(_0xa67f9b['user'][_0x1c9f('0x29')]!==_0x1c9f('0x2c'))return _0x25fc2a;return db['UserProfileSection'][_0x1c9f('0x32')]({'where':{'name':_0x25fc2a['role']===_0x1c9f('0x80')?_0x1c9f('0x2d'):_0x1c9f('0x86'),'userProfileId':_0xa67f9b[_0x1c9f('0x2c')][_0x1c9f('0x85')]},'raw':!![]})[_0x1c9f('0x26')](function(_0x2269b6){if(!_0x2269b6||_0x2269b6[_0x1c9f('0x87')]!=0x0)return _0x25fc2a;return db[_0x1c9f('0x34')][_0x1c9f('0x7f')]({'name':_0x25fc2a[_0x1c9f('0x33')],'resourceId':_0x25fc2a['id'],'type':_0x2269b6[_0x1c9f('0x33')],'sectionId':_0x2269b6['id']},{})[_0x1c9f('0x26')](function(){return _0x25fc2a;});})['catch'](function(_0x33ff4f){logger[_0x1c9f('0x17')](_0x1c9f('0x88'),_0x33ff4f);throw _0x33ff4f;});})[_0x1c9f('0x26')](respondWithResult(_0x55b55f,0xc9))[_0x1c9f('0x1c')](handleError(_0x55b55f,null));};exports['bulkCreate']=function(_0x3207bb,_0x1421ca){var _0x5ce05a=_0x3207bb[_0x1c9f('0x60')];var _0x4e6969=[];if(_0x3207bb[_0x1c9f('0x2c')][_0x1c9f('0x29')]==='agent')throw new Error(_0x1c9f('0x81'));if(_['some'](_0x5ce05a,[_0x1c9f('0x29'),_0x1c9f('0x2c')])&&_0x3207bb['user'][_0x1c9f('0x29')]!==_0x1c9f('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x1c9f('0x89')](_0x5ce05a,[_0x1c9f('0x29'),_0x1c9f('0x2a')])&&_0x3207bb[_0x1c9f('0x2c')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x1c9f('0x83')](_0x5ce05a)['then'](function(){return validateUser(_0x5ce05a[0x0]);})['then'](function(){for(var _0x23782f=0x1;_0x23782f<_0x5ce05a[_0x1c9f('0x4b')];_0x23782f++){var _0x52c562=_0x5ce05a[_0x23782f-0x1][_0x1c9f('0x65')];if(!_0x5ce05a[_0x23782f][_0x1c9f('0x65')])_0x5ce05a[_0x23782f]['internal']=_0x52c562+0x1;_0x4e6969[_0x1c9f('0x48')](validateUser(_0x5ce05a[_0x23782f]));}return BPromise[_0x1c9f('0x52')](_0x4e6969);})[_0x1c9f('0x26')](function(){_0x4e6969=[];for(var _0x21ca43=0x0;_0x21ca43<_0x5ce05a[_0x1c9f('0x4b')];_0x21ca43++){_0x4e6969['push'](updateUser(_0x5ce05a[_0x21ca43]));}return BPromise[_0x1c9f('0x52')](_0x4e6969);})[_0x1c9f('0x26')](function(){return BPromise[_0x1c9f('0x8a')](_0x5ce05a,function(_0x8c1759){return db['User'][_0x1c9f('0x7f')](_0x8c1759,{'include':[{'model':db[_0x1c9f('0x71')],'as':'VoiceMail'}]})[_0x1c9f('0x26')](function(_0x1c7c54){_0x8c1759['id']=_0x1c7c54['id'];return _0x8c1759;});});})[_0x1c9f('0x26')](function(_0x5b24d8){if(_0x3207bb[_0x1c9f('0x60')][_0x1c9f('0x29')]===_0x1c9f('0x2c'))return _0x5b24d8;if(_0x3207bb[_0x1c9f('0x2c')][_0x1c9f('0x29')]!==_0x1c9f('0x2c'))return _0x5b24d8;var _0x40ea34=_['some'](_0x5b24d8,function(_0x24e825){return _0x24e825[_0x1c9f('0x29')]===_0x1c9f('0x80')||_0x24e825[_0x1c9f('0x29')]==='telephone';});if(!_0x40ea34)return _0x5b24d8;return db[_0x1c9f('0x8b')]['findAll']({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x3207bb[_0x1c9f('0x2c')]['userProfileId']},'raw':!![]})[_0x1c9f('0x26')](function(_0x17b1b4){if(_['isEmpty'](_0x17b1b4)||!_[_0x1c9f('0x89')](_0x17b1b4,['autoAssociation',0x0]))return _0x5b24d8;_0x4e6969=[];var _0x2191c8=_(_0x17b1b4)[_0x1c9f('0x8c')](function(_0x304aa3){if(_0x304aa3['autoAssociation']===0x1)return;return _0x304aa3[_0x1c9f('0x33')]==='Agents'?_0x1c9f('0x80'):_0x1c9f('0x2e');})[_0x1c9f('0x8d')]()[_0x1c9f('0x30')]();for(var _0x2cf921=0x0;_0x2cf921<_0x5b24d8[_0x1c9f('0x4b')];_0x2cf921++){if(!_[_0x1c9f('0x31')](_0x2191c8,_0x5b24d8[_0x2cf921][_0x1c9f('0x29')]))return;var _0x2de4ec=_0x5b24d8[_0x2cf921][_0x1c9f('0x29')]===_0x1c9f('0x80')?_0x1c9f('0x2d'):'Telephones';_0x4e6969['push'](db['UserProfileResource'][_0x1c9f('0x7f')]({'name':_0x5b24d8[_0x2cf921][_0x1c9f('0x33')],'resourceId':_0x5b24d8[_0x2cf921]['id'],'type':_0x2de4ec,'sectionId':_[_0x1c9f('0x32')](_0x17b1b4,[_0x1c9f('0x33'),_0x2de4ec])['id']},{}));}return BPromise[_0x1c9f('0x52')](_0x4e6969);});})['then'](respondWithResult(_0x1421ca,0xc9))['catch'](handleError(_0x1421ca,null));};exports['changePassword']=function(_0x52f508,_0x142787){if(_0x52f508[_0x1c9f('0x60')]['id']){delete _0x52f508['body']['id'];}return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x52f508[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](function(_0x23bf32){if(!_0x23bf32)return null;if(_0x23bf32['id']===_0x52f508[_0x1c9f('0x2c')]['id']){if(!_0x52f508['body']['oldPassword']||!_0x52f508[_0x1c9f('0x60')]['newPassword']){throw new db['Sequelize'][(_0x1c9f('0x8e'))](_0x1c9f('0x8f'));}if(!_0x23bf32[_0x1c9f('0x90')](_0x52f508['body'][_0x1c9f('0x91')])){throw new db['Sequelize'][(_0x1c9f('0x8e'))]('Wrong\x20credentials');}if(_0x52f508[_0x1c9f('0x60')][_0x1c9f('0x91')]===_0x52f508['body'][_0x1c9f('0x92')]){throw new db[(_0x1c9f('0x93'))][(_0x1c9f('0x8e'))](_0x1c9f('0x94'));}}else if(_0x52f508[_0x1c9f('0x2c')]['role']===_0x1c9f('0x2a')){if(!_0x52f508[_0x1c9f('0x60')][_0x1c9f('0x92')]){throw new db['Sequelize'][(_0x1c9f('0x8e'))](_0x1c9f('0x95'));}}else if(_0x52f508[_0x1c9f('0x2c')]['role']==='user'){if(!_0x52f508[_0x1c9f('0x60')]['newPassword']){throw new db[(_0x1c9f('0x93'))][(_0x1c9f('0x8e'))](_0x1c9f('0x95'));}if(_0x23bf32[_0x1c9f('0x29')]!==_0x1c9f('0x80')){throw new db[(_0x1c9f('0x93'))][(_0x1c9f('0x8e'))](_0x1c9f('0x81'));}}else{throw new db[(_0x1c9f('0x93'))][(_0x1c9f('0x8e'))](_0x1c9f('0x81'));}return _0x23bf32;})[_0x1c9f('0x26')](handleEntityNotFound(_0x142787,null))[_0x1c9f('0x26')](function(_0x408cf6){return db[_0x1c9f('0x66')][_0x1c9f('0x96')]({'attributes':['id',_0x1c9f('0x68'),_0x1c9f('0x97'),_0x1c9f('0x98')]})[_0x1c9f('0x26')](function(_0x596b1a){if(_0x596b1a[_0x1c9f('0x68')])authService[_0x1c9f('0x99')](_0x52f508['body'][_0x1c9f('0x92')]);if(!_0x596b1a[_0x1c9f('0x97')]||!_0x408cf6['previousPasswords'])return _0x408cf6;authService[_0x1c9f('0x9a')](_0x52f508[_0x1c9f('0x60')][_0x1c9f('0x92')],_0x408cf6[_0x1c9f('0x9b')],_0x596b1a[_0x1c9f('0x98')]);return _0x408cf6;})['then'](saveUpdates({'password':_0x52f508[_0x1c9f('0x60')][_0x1c9f('0x92')],'passwordResetAt':_0x52f508[_0x1c9f('0x2c')]['id']==_0x52f508[_0x1c9f('0x54')]['id']?moment():null,'previousPasswords':authService[_0x1c9f('0x9c')](_0x52f508['body'][_0x1c9f('0x92')],_0x408cf6[_0x1c9f('0x9b')])},null));})[_0x1c9f('0x26')](respondWithResult(_0x142787,null))[_0x1c9f('0x1c')](handleError(_0x142787,null));};exports[_0x1c9f('0x9d')]=function(_0x58c886,_0x20ec64){var _0x599912=_0x58c886[_0x1c9f('0x60')]['channel'];return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x58c886[_0x1c9f('0x54')]['id']},'attributes':['id',_0x1c9f('0x33'),_0x1c9f('0x29'),_0x1c9f('0x9e'),_0x1c9f('0x9f'),_0x1c9f('0xa0'),_0x1c9f('0xa1')]})[_0x1c9f('0x26')](handleEntityNotFound(_0x20ec64,null))[_0x1c9f('0x26')](function(_0x29276a){if(_0x29276a){if(!utils[_0x1c9f('0xa2')](_0x599912)){throw new db[(_0x1c9f('0x93'))][(_0x1c9f('0x8e'))]('Unknown\x20channel');}return _0x29276a[_0x1c9f('0xa3')+_[_0x1c9f('0xa4')](_0x599912[_0x1c9f('0xa5')]())+_0x1c9f('0xa6')](_0x58c886['body'][_0x1c9f('0x63')],{'penalty':_0x58c886[_0x1c9f('0x60')][_0x1c9f('0xa7')]||0x0})[_0x1c9f('0xa8')](function(_0x3add07){for(var _0x4528b3=0x0;_0x4528b3<_0x58c886[_0x1c9f('0x60')][_0x1c9f('0x63')][_0x1c9f('0x4b')];_0x4528b3+=0x1){var _0x30779a={'UserId':Number(_0x58c886[_0x1c9f('0x54')]['id'])};_0x30779a[_[_0x1c9f('0xa4')](_0x599912[_0x1c9f('0xa5')]())+'QueueId']=Number(_0x58c886[_0x1c9f('0x60')][_0x1c9f('0x63')][_0x4528b3]);socket['emit'](_0x1c9f('0x2c')+_[_0x1c9f('0xa4')](_0x599912[_0x1c9f('0xa5')]())+_0x1c9f('0xa9'),_0x30779a);}return _0x3add07;})[_0x1c9f('0x26')](function(){if(_0x599912==='voice'){return db[_0x1c9f('0xaa')]['findAll']({'where':{'id':_0x58c886[_0x1c9f('0x60')][_0x1c9f('0x63')]||[]},'raw':!![],'attributes':['id',_0x1c9f('0x33')]});}})[_0x1c9f('0x26')](function(_0x2780a3){var _0x5d3bae=_0x29276a[_0x1c9f('0x28')]({'plain':!![]});var _0x48cbbb=[];if(_0x599912===_0x1c9f('0xab')&&_0x5d3bae[_0x1c9f('0x29')]===_0x1c9f('0x80')&&_0x5d3bae[_0x1c9f('0x9e')]){for(var _0x26af61=0x0;_0x26af61<_0x2780a3['length'];_0x26af61+=0x1){_0x48cbbb['push']({'membername':_0x5d3bae[_0x1c9f('0x33')],'UserId':_0x5d3bae['id'],'queue_name':_0x2780a3[_0x26af61][_0x1c9f('0x33')],'VoiceQueueId':_0x2780a3[_0x26af61]['id'],'interface':_[_0x1c9f('0x6a')](_0x5d3bae[_0x1c9f('0xa1')])?util[_0x1c9f('0xac')](_0x1c9f('0xad'),_0x5d3bae['name']):_0x5d3bae[_0x1c9f('0xa1')],'paused':_0x5d3bae['voicePause']||![],'penalty':_0x58c886['body'][_0x1c9f('0xa7')]||0x0});}return BPromise[_0x1c9f('0x8a')](_0x48cbbb,function(_0x1cbd40){return db['UserVoiceQueueRt']['upsert'](_0x1cbd40);});}return _0x29276a;});}})[_0x1c9f('0x26')](respondWithStatusCode(_0x20ec64,null))['catch'](handleError(_0x20ec64,null));};exports[_0x1c9f('0xae')]=function(_0x4f46c2,_0x346d55){var _0xa0c03,_0x323b97;return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x4f46c2[_0x1c9f('0x54')]['id']},'attributes':['id',_0x1c9f('0x33'),_0x1c9f('0x29')]})[_0x1c9f('0x26')](handleEntityNotFound(_0x346d55,null))[_0x1c9f('0x26')](function(_0xacbf68){if(_0xacbf68){_0xa0c03=_0xacbf68;if(!_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0xaf')]||!utils['isValidChannel'](_0x4f46c2[_0x1c9f('0x41')]['channel'])){throw new db[(_0x1c9f('0x93'))]['ValidationError'](_0x1c9f('0xb0'));}return _0xacbf68[_0x1c9f('0xb1')+_[_0x1c9f('0xa4')](_0x4f46c2[_0x1c9f('0x41')]['channel'][_0x1c9f('0xa5')]())+_0x1c9f('0xa6')](_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0x63')]);}})[_0x1c9f('0x26')](function(_0x330ed2){if(_[_0x1c9f('0xb2')](_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0x63')])){for(var _0x13b02b=0x0;_0x13b02b<_0x4f46c2['query'][_0x1c9f('0x63')]['length'];_0x13b02b+=0x1){_0x323b97={'UserId':Number(_0x4f46c2[_0x1c9f('0x54')]['id'])};_0x323b97[_[_0x1c9f('0xa4')](_0x4f46c2['query'][_0x1c9f('0xaf')]['toLowerCase']())+'QueueId']=Number(_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0x63')][_0x13b02b]);socket[_0x1c9f('0xb3')](_0x1c9f('0x2c')+_[_0x1c9f('0xa4')](_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0xaf')][_0x1c9f('0xa5')]())+_0x1c9f('0xb4'),_0x323b97);}}else{_0x323b97={'UserId':Number(_0x4f46c2[_0x1c9f('0x54')]['id'])};_0x323b97[_['capitalize'](_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0xaf')][_0x1c9f('0xa5')]())+_0x1c9f('0xb5')]=Number(_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0x63')]);socket[_0x1c9f('0xb3')](_0x1c9f('0x2c')+_[_0x1c9f('0xa4')](_0x4f46c2['query']['channel'][_0x1c9f('0xa5')]())+_0x1c9f('0xb4'),_0x323b97);}return _0x330ed2;})[_0x1c9f('0x26')](function(){if(_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0xaf')]==='voice'){return db[_0x1c9f('0xb6')][_0x1c9f('0x27')]({'where':{'UserId':_0x4f46c2[_0x1c9f('0x54')]['id'],'VoiceQueueId':_0x4f46c2[_0x1c9f('0x41')][_0x1c9f('0x63')]},'individualHooks':!![]})[_0x1c9f('0x26')](function(){return _0xa0c03;});}return _0xa0c03;})[_0x1c9f('0x26')](respondWithStatusCode(_0x346d55,null))[_0x1c9f('0x1c')](handleError(_0x346d55,null));};exports[_0x1c9f('0xb7')]=function(_0x1d964d,_0x2108f4){_0x1d964d[_0x1c9f('0x60')][_0x1c9f('0xb8')]=_0x1d964d[_0x1c9f('0xb9')][_0x1c9f('0xba')];return db['User'][_0x1c9f('0x32')]({'where':{'id':_0x1d964d['params']['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x2108f4,null))['then'](saveUpdates(_0x1d964d['body'],null))[_0x1c9f('0x26')](respondWithResult(_0x2108f4,null))['catch'](handleError(_0x2108f4,null));};exports[_0x1c9f('0xbb')]=function(_0x2c2b0c,_0xb669){var _0x1ba45d=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x1c9f('0x39')]['find']({'where':{'id':_0x2c2b0c[_0x1c9f('0x54')]['id']},'attributes':['id',_0x1c9f('0xb8')],'raw':!![]})[_0x1c9f('0x26')](handleEntityNotFound(_0xb669,null))[_0x1c9f('0x26')](function(_0x156a71){if(_0x156a71){if(_[_0x1c9f('0x6a')](_0x156a71[_0x1c9f('0xb8')])){return _0xb669[_0x1c9f('0xbc')](_0x1ba45d);}else{if(!fs[_0x1c9f('0xbd')](path['join'](config['root'],_0x1c9f('0xbe'),_0x156a71[_0x1c9f('0xb8')]))){return _0xb669['download'](_0x1ba45d);}return _0xb669[_0x1c9f('0xbc')](path[_0x1c9f('0xbf')](config[_0x1c9f('0xc0')],_0x1c9f('0xbe'),_0x156a71['userpic']));}}})[_0x1c9f('0x1c')](handleError(_0xb669,null));};exports[_0x1c9f('0xc1')]=function(_0x281b8a,_0xa55616){return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x281b8a[_0x1c9f('0x54')]['id']},'attributes':['id']})[_0x1c9f('0x26')](handleEntityNotFound(_0xa55616,null))[_0x1c9f('0x26')](function(_0xe61a4f){var _0x2f1814=[];values=_0xe61a4f[_0x1c9f('0x4d')];_0x2f1814[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x4c'),_0xe61a4f['dataValues']));_0x2f1814[_0x1c9f('0x48')](get_open_tabs('sms',_0xe61a4f[_0x1c9f('0x4d')]));_0x2f1814[_0x1c9f('0x48')](get_open_tabs('openchannel',_0xe61a4f[_0x1c9f('0x4d')]));_0x2f1814[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x51'),_0xe61a4f[_0x1c9f('0x4d')]));_0x2f1814[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x5f'),_0xe61a4f[_0x1c9f('0x4d')]));_0x2f1814[_0x1c9f('0x48')](get_open_tabs(_0x1c9f('0x4f'),_0xe61a4f['dataValues']));return BPromise[_0x1c9f('0x52')](_0x2f1814);})[_0x1c9f('0x26')](function(_0x54d939){if(_0x54d939){var _0x10276a=_[_0x1c9f('0x8c')](values[_0x1c9f('0xc2')],function(_0x36d031){return{'channel':_0x1c9f('0xc3'),'id':_0x36d031['id'],'createdAt':_0x36d031['createdAt']};});var _0x32083e=_[_0x1c9f('0x8c')](values['FaxOpenTabs'],function(_0x2668e3){return{'channel':_0x1c9f('0xc4'),'id':_0x2668e3['id'],'createdAt':_0x2668e3[_0x1c9f('0xc5')]};});var _0x36dd7a=_[_0x1c9f('0x8c')](values[_0x1c9f('0xc6')],function(_0x3648a1){return{'channel':'OPENCHANNEL','id':_0x3648a1['id'],'createdAt':_0x3648a1[_0x1c9f('0xc5')]};});var _0x4fd664=_[_0x1c9f('0x8c')](values[_0x1c9f('0xc7')],function(_0x29a7c2){return{'channel':'MAIL','id':_0x29a7c2['id'],'createdAt':_0x29a7c2[_0x1c9f('0xc5')]};});var _0x14fd00=_[_0x1c9f('0x8c')](values[_0x1c9f('0xc8')],function(_0x5abf43){return{'channel':_0x1c9f('0xc9'),'id':_0x5abf43['id'],'createdAt':_0x5abf43[_0x1c9f('0xc5')]};});var _0x521eb4=_[_0x1c9f('0x8c')](values['WhatsappOpenTabs'],function(_0x1c79dd){return{'channel':'WHATSAPP','id':_0x1c79dd['id'],'createdAt':_0x1c79dd['createdAt']};});var _0x4491c4=_[_0x1c9f('0xca')](_0x10276a,_0x32083e,_0x36dd7a,_0x4fd664,_0x14fd00,_0x521eb4);var _0x2c0855={'count':_0x4491c4['length'],'rows':_0x4491c4};return _0x2c0855;}else return null;})[_0x1c9f('0x26')](respondWithResult(_0xa55616,null))[_0x1c9f('0x1c')](handleError(_0xa55616,null));};exports[_0x1c9f('0xcb')]=function(_0x14ee86,_0x2c63fb){var _0x4af7ec={};var _0xb60431={};var _0x20cafc;var _0x188856;return db[_0x1c9f('0x39')][_0x1c9f('0x96')]({'where':{'id':_0x14ee86[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x2c63fb,null))[_0x1c9f('0x26')](function(_0x1bc797){if(_0x1bc797){_0x20cafc=_0x1bc797;_0xb60431['model']=_[_0x1c9f('0x57')](db[_0x1c9f('0xcc')][_0x1c9f('0x3a')]);_0xb60431['query']=_['keys'](_0x14ee86[_0x1c9f('0x41')]);_0xb60431['filters']=_[_0x1c9f('0x5a')](_0xb60431['model'],_0xb60431[_0x1c9f('0x41')]);_0x4af7ec[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0xb60431[_0x1c9f('0x55')],qs['fields'](_0x14ee86['query'][_0x1c9f('0x5b')]));_0x4af7ec[_0x1c9f('0x47')]=_0x4af7ec['attributes'][_0x1c9f('0x4b')]?_0x4af7ec[_0x1c9f('0x47')]:_0xb60431[_0x1c9f('0x55')];_0x4af7ec['order']=qs['sort'](_0x14ee86[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x4af7ec[_0x1c9f('0x40')]=qs[_0x1c9f('0x59')](_[_0x1c9f('0xce')](_0x14ee86['query'],_0xb60431[_0x1c9f('0x59')]));if(_0x14ee86[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x4af7ec[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x4af7ec[_0x1c9f('0x40')],{'$or':_['map'](_0x4af7ec['attributes'],function(_0x457e63){var _0xb7fc70={};_0xb7fc70[_0x457e63]={'$like':'%'+_0x14ee86[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0xb7fc70;})});}_0x4af7ec=_['merge']({},_0x4af7ec,_0x14ee86[_0x1c9f('0x5d')]);return _0x20cafc['getContacts'](_0x4af7ec);}})[_0x1c9f('0x26')](function(_0x351279){if(_0x351279){_0x188856=_0x351279[_0x1c9f('0x4b')];if(_0x14ee86[_0x1c9f('0x41')][_0x1c9f('0xd0')](_0x1c9f('0x42'))){_0x4af7ec['include']=[{'model':db[_0x1c9f('0xd1')],'as':_0x1c9f('0xd2'),'required':![]},{'model':db[_0x1c9f('0xd3')],'as':_0x1c9f('0xd4'),'attributes':['id',_0x1c9f('0x33'),_0x1c9f('0xd5')],'where':_0x14ee86['query'][_0x1c9f('0xd6')]?{'id':_0x14ee86['query'][_0x1c9f('0xd6')]}:undefined,'required':_0x14ee86['query'][_0x1c9f('0xd6')]?!![]:![]}];}if(!_0x14ee86['query'][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0x4af7ec['limit']=qs[_0x1c9f('0x20')](_0x14ee86[_0x1c9f('0x41')][_0x1c9f('0x20')]);_0x4af7ec[_0x1c9f('0x22')]=qs[_0x1c9f('0x22')](_0x14ee86[_0x1c9f('0x41')][_0x1c9f('0x22')]);}return _0x20cafc[_0x1c9f('0xcb')](_0x4af7ec);}})['then'](function(_0xd7f9b3){if(_0xd7f9b3){return _0xd7f9b3?{'count':_0x188856,'rows':_0xd7f9b3}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x2c63fb,null))[_0x1c9f('0x1c')](handleError(_0x2c63fb,null));};exports[_0x1c9f('0xd8')]=function(_0x19dd5c,_0x11c567){var _0x57c0e2;var _0x4dbe3f={};var _0x5d34eb;return db['User'][_0x1c9f('0x96')]({'where':{'id':_0x19dd5c[_0x1c9f('0x54')]['id']},'attributes':['id',_0x1c9f('0x33'),'role']})[_0x1c9f('0x26')](handleEntityNotFound(_0x11c567,null))[_0x1c9f('0x26')](function(_0x1d2686){if(!utils[_0x1c9f('0xa2')](_0x19dd5c[_0x1c9f('0x41')][_0x1c9f('0xaf')])){throw new db[(_0x1c9f('0x93'))][(_0x1c9f('0x8e'))](_0x1c9f('0xb0'));}_0x57c0e2=_0x1d2686;var _0x8303d5={};_0x8303d5['model']=_['keys'](db[_['capitalize'](_0x19dd5c[_0x1c9f('0x41')]['channel'])+_0x1c9f('0xd9')][_0x1c9f('0x3a')]);_0x8303d5[_0x1c9f('0x41')]=_[_0x1c9f('0x57')](_0x19dd5c['query']);_0x8303d5[_0x1c9f('0x59')]=_['intersection'](_0x8303d5[_0x1c9f('0x55')],_0x8303d5[_0x1c9f('0x41')]);_0x4dbe3f[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x8303d5[_0x1c9f('0x55')],qs[_0x1c9f('0x5b')](_0x19dd5c[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x4dbe3f[_0x1c9f('0x47')]=_0x4dbe3f[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x4dbe3f['attributes']:_0x8303d5[_0x1c9f('0x55')];_0x4dbe3f[_0x1c9f('0xda')]=qs['sort'](_0x19dd5c[_0x1c9f('0x41')]['sort']);_0x4dbe3f[_0x1c9f('0x40')]=qs['filters'](_[_0x1c9f('0xce')](_0x19dd5c['query'],_0x8303d5['filters']));if(_0x19dd5c[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x4dbe3f[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x4dbe3f[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x4dbe3f[_0x1c9f('0x47')],function(_0x470893){var _0x381f99={};_0x381f99[_0x470893]={'$like':'%'+_0x19dd5c[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0x381f99;})});}_0x4dbe3f=_[_0x1c9f('0x5c')]({},_0x4dbe3f,_0x19dd5c['options']);switch(_0x57c0e2[_0x1c9f('0x29')]){case'admin':return db[_[_0x1c9f('0xa4')](_0x19dd5c[_0x1c9f('0x41')][_0x1c9f('0xaf')])+_0x1c9f('0xd9')][_0x1c9f('0x49')](_0x4dbe3f);case _0x1c9f('0x2c'):case _0x1c9f('0x80'):return _0x57c0e2['get'+_[_0x1c9f('0xa4')](_0x19dd5c['query'][_0x1c9f('0xaf')])+_0x1c9f('0xa6')](_0x4dbe3f);default:throw new db[(_0x1c9f('0x93'))][(_0x1c9f('0x8e'))](_0x1c9f('0xdb'));}})[_0x1c9f('0x26')](function(_0x4ce9b5){_0x5d34eb=_0x4ce9b5['length'];if(!_0x19dd5c['query'][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0x4dbe3f[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0x19dd5c['query'][_0x1c9f('0x20')]);_0x4dbe3f['offset']=qs[_0x1c9f('0x22')](_0x19dd5c['query'][_0x1c9f('0x22')]);}switch(_0x57c0e2[_0x1c9f('0x29')]){case _0x1c9f('0x2a'):return db[_[_0x1c9f('0xa4')](_0x19dd5c[_0x1c9f('0x41')][_0x1c9f('0xaf')])+_0x1c9f('0xd9')][_0x1c9f('0x49')](_0x4dbe3f);case _0x1c9f('0x2c'):case _0x1c9f('0x80'):return _0x57c0e2[_0x1c9f('0x28')+_[_0x1c9f('0xa4')](_0x19dd5c[_0x1c9f('0x41')][_0x1c9f('0xaf')])+_0x1c9f('0xa6')](_0x4dbe3f);}})[_0x1c9f('0x26')](function(_0x397d39){return{'count':_0x5d34eb,'rows':_0x397d39};})[_0x1c9f('0x26')](respondWithResult(_0x11c567,null))['catch'](handleError(_0x11c567,null));};exports[_0x1c9f('0xdc')]=function(_0x2ec929,_0x161f56){var _0x1fb02c={};var _0x47d3ea={};var _0x43b635;var _0x133b65;return db[_0x1c9f('0x39')][_0x1c9f('0x96')]({'where':{'id':_0x2ec929[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x161f56,null))['then'](function(_0x234864){if(_0x234864){_0x43b635=_0x234864;_0x47d3ea[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db['UserVoiceQueueRt']['rawAttributes']);_0x47d3ea[_0x1c9f('0x41')]=_[_0x1c9f('0x57')](_0x2ec929[_0x1c9f('0x41')]);_0x47d3ea['filters']=_[_0x1c9f('0x5a')](_0x47d3ea[_0x1c9f('0x55')],_0x47d3ea[_0x1c9f('0x41')]);_0x1fb02c[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x47d3ea[_0x1c9f('0x55')],qs['fields'](_0x2ec929['query']['fields']));_0x1fb02c[_0x1c9f('0x47')]=_0x1fb02c[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x1fb02c['attributes']:_0x47d3ea['model'];_0x1fb02c[_0x1c9f('0xda')]=qs['sort'](_0x2ec929[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x1fb02c[_0x1c9f('0x40')]=qs['filters'](_[_0x1c9f('0xce')](_0x2ec929[_0x1c9f('0x41')],_0x47d3ea['filters']));if(_0x2ec929[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x1fb02c[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x1fb02c[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x1fb02c[_0x1c9f('0x47')],function(_0x5e3b73){var _0x38e9cd={};_0x38e9cd[_0x5e3b73]={'$like':'%'+_0x2ec929['query']['filter']+'%'};return _0x38e9cd;})});}_0x1fb02c=_[_0x1c9f('0x5c')]({},_0x1fb02c,_0x2ec929[_0x1c9f('0x5d')]);return _0x43b635[_0x1c9f('0xdc')](_0x1fb02c);}})['then'](function(_0x23ddd6){if(_0x23ddd6){_0x133b65=_0x23ddd6[_0x1c9f('0x4b')];if(!_0x2ec929[_0x1c9f('0x41')][_0x1c9f('0xd0')]('nolimit')){_0x1fb02c['limit']=qs[_0x1c9f('0x20')](_0x2ec929[_0x1c9f('0x41')][_0x1c9f('0x20')]);_0x1fb02c[_0x1c9f('0x22')]=qs[_0x1c9f('0x22')](_0x2ec929[_0x1c9f('0x41')][_0x1c9f('0x22')]);}return _0x43b635['getVoiceQueuesRt'](_0x1fb02c);}})[_0x1c9f('0x26')](function(_0x12b6d6){if(_0x12b6d6){return _0x12b6d6?{'count':_0x133b65,'rows':_0x12b6d6}:null;}})['then'](respondWithResult(_0x161f56,null))['catch'](handleError(_0x161f56,null));};exports[_0x1c9f('0xdd')]=function(_0x1d1683,_0x1c560f){var _0x40143b={};var _0x51899a={};var _0x299b3f;var _0x26d3d1;return db[_0x1c9f('0x39')][_0x1c9f('0x96')]({'where':{'id':_0x1d1683[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x1c560f,null))[_0x1c9f('0x26')](function(_0x490e16){if(_0x490e16){_0x299b3f=_0x490e16;_0x51899a[_0x1c9f('0x55')]=_['keys'](db[_0x1c9f('0xde')][_0x1c9f('0x3a')]);_0x51899a['query']=_[_0x1c9f('0x57')](_0x1d1683[_0x1c9f('0x41')]);_0x51899a['filters']=_[_0x1c9f('0x5a')](_0x51899a[_0x1c9f('0x55')],_0x51899a['query']);_0x40143b[_0x1c9f('0x47')]=_['intersection'](_0x51899a['model'],qs[_0x1c9f('0x5b')](_0x1d1683[_0x1c9f('0x41')]['fields']));_0x40143b[_0x1c9f('0x47')]=_0x40143b[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x40143b[_0x1c9f('0x47')]:_0x51899a[_0x1c9f('0x55')];_0x40143b[_0x1c9f('0xda')]=qs[_0x1c9f('0xcd')](_0x1d1683['query'][_0x1c9f('0xcd')]);_0x40143b[_0x1c9f('0x40')]=qs[_0x1c9f('0x59')](_[_0x1c9f('0xce')](_0x1d1683[_0x1c9f('0x41')],_0x51899a[_0x1c9f('0x59')]));if(_0x1d1683[_0x1c9f('0x41')]['filter']){_0x40143b['where']=_[_0x1c9f('0x5c')](_0x40143b['where'],{'$or':_['map'](_0x40143b[_0x1c9f('0x47')],function(_0x34804b){var _0x52341c={};_0x52341c[_0x34804b]={'$like':'%'+_0x1d1683['query'][_0x1c9f('0xcf')]+'%'};return _0x52341c;})});}_0x40143b=_[_0x1c9f('0x5c')]({},_0x40143b,_0x1d1683[_0x1c9f('0x5d')]);return _0x299b3f[_0x1c9f('0xdd')](_0x40143b);}})['then'](function(_0x48f2a2){if(_0x48f2a2){_0x26d3d1=_0x48f2a2[_0x1c9f('0x4b')];if(!_0x1d1683[_0x1c9f('0x41')][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0x40143b[_0x1c9f('0x20')]=qs['limit'](_0x1d1683[_0x1c9f('0x41')][_0x1c9f('0x20')]);_0x40143b[_0x1c9f('0x22')]=qs[_0x1c9f('0x22')](_0x1d1683[_0x1c9f('0x41')]['offset']);}return _0x299b3f[_0x1c9f('0xdd')](_0x40143b);}})['then'](function(_0x49c56b){if(_0x49c56b){return _0x49c56b?{'count':_0x26d3d1,'rows':_0x49c56b}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x1c560f,null))[_0x1c9f('0x1c')](handleError(_0x1c560f,null));};exports[_0x1c9f('0xdf')]=function(_0x335bd2,_0x3afb6d){var _0x302824={'raw':!![],'where':{}};var _0x564439={};var _0x376aa7={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x335bd2[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x3afb6d,null))[_0x1c9f('0x26')](function(_0x3742dd){if(_0x3742dd){_0x564439[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db[_0x1c9f('0xe0')][_0x1c9f('0x3a')]);_0x564439['query']=_['keys'](_0x335bd2[_0x1c9f('0x41')]);_0x564439[_0x1c9f('0x59')]=_[_0x1c9f('0x5a')](_0x564439[_0x1c9f('0x55')],_0x564439[_0x1c9f('0x41')]);_0x302824[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x564439['model'],qs[_0x1c9f('0x5b')](_0x335bd2[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x302824[_0x1c9f('0x47')]=_0x302824['attributes'][_0x1c9f('0x4b')]?_0x302824[_0x1c9f('0x47')]:_0x564439[_0x1c9f('0x55')];if(!_0x335bd2[_0x1c9f('0x41')]['hasOwnProperty'](_0x1c9f('0xd7'))){_0x302824[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0x335bd2['query'][_0x1c9f('0x20')]);_0x302824['offset']=qs[_0x1c9f('0x22')](_0x335bd2[_0x1c9f('0x41')][_0x1c9f('0x22')]);}_0x302824[_0x1c9f('0xda')]=qs['sort'](_0x335bd2[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x302824[_0x1c9f('0x40')]=qs[_0x1c9f('0x59')](_['pick'](_0x335bd2[_0x1c9f('0x41')],_0x564439[_0x1c9f('0x59')]));_0x302824[_0x1c9f('0x40')]['UserId']=_0x3742dd['id'];if(_0x335bd2[_0x1c9f('0x41')]['filter']){_0x302824[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x302824[_0x1c9f('0x40')],{'$or':_['map'](_0x302824[_0x1c9f('0x47')],function(_0x302e32){var _0x14a38c={};_0x14a38c[_0x302e32]={'$like':'%'+_0x335bd2['query'][_0x1c9f('0xcf')]+'%'};return _0x14a38c;})});}_0x302824=_['merge']({},_0x302824,_0x335bd2['options']);return db['VoiceRecording'][_0x1c9f('0x21')]({'where':_0x302824['where']})[_0x1c9f('0x26')](function(_0x916820){_0x376aa7[_0x1c9f('0x21')]=_0x916820;if(_0x335bd2[_0x1c9f('0x41')][_0x1c9f('0x42')]){_0x302824[_0x1c9f('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1c9f('0x49')](_0x302824);})['then'](function(_0x38630e){_0x376aa7[_0x1c9f('0x4a')]=_0x38630e;return _0x376aa7;});}})[_0x1c9f('0x26')](respondWithFilteredResult(_0x3afb6d,_0x302824))[_0x1c9f('0x1c')](handleError(_0x3afb6d,null));};exports[_0x1c9f('0xe1')]=function(_0xfcd40,_0x29bdfb){var _0x4010d3={'raw':!![],'where':{}};var _0x52f818={};var _0x4a0469={'count':0x0,'rows':[]};return db['User'][_0x1c9f('0x96')]({'where':{'id':_0xfcd40['params']['id']}})['then'](handleEntityNotFound(_0x29bdfb,null))[_0x1c9f('0x26')](function(_0x4492ea){if(_0x4492ea){_0x52f818[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db['ScreenRecording'][_0x1c9f('0x3a')]);_0x52f818[_0x1c9f('0x41')]=_['keys'](_0xfcd40[_0x1c9f('0x41')]);_0x52f818['filters']=_[_0x1c9f('0x5a')](_0x52f818['model'],_0x52f818['query']);_0x4010d3[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x52f818[_0x1c9f('0x55')],qs[_0x1c9f('0x5b')](_0xfcd40[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x4010d3['attributes']=_0x4010d3[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x4010d3[_0x1c9f('0x47')]:_0x52f818[_0x1c9f('0x55')];if(!_0xfcd40[_0x1c9f('0x41')][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0x4010d3[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0xfcd40[_0x1c9f('0x41')][_0x1c9f('0x20')]);_0x4010d3['offset']=qs[_0x1c9f('0x22')](_0xfcd40['query'][_0x1c9f('0x22')]);}_0x4010d3[_0x1c9f('0xda')]=qs['sort'](_0xfcd40[_0x1c9f('0x41')]['sort']);_0x4010d3[_0x1c9f('0x40')]=qs['filters'](_[_0x1c9f('0xce')](_0xfcd40[_0x1c9f('0x41')],_0x52f818['filters']));_0x4010d3['where'][_0x1c9f('0xe2')]=_0x4492ea['id'];if(_0xfcd40['query'][_0x1c9f('0xcf')]){_0x4010d3['where']=_[_0x1c9f('0x5c')](_0x4010d3[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x4010d3[_0x1c9f('0x47')],function(_0x297eb0){var _0x404c82={};_0x404c82[_0x297eb0]={'$like':'%'+_0xfcd40[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0x404c82;})});}_0x4010d3=_[_0x1c9f('0x5c')]({},_0x4010d3,_0xfcd40[_0x1c9f('0x5d')]);return db['ScreenRecording']['count']({'where':_0x4010d3[_0x1c9f('0x40')]})[_0x1c9f('0x26')](function(_0x407343){_0x4a0469[_0x1c9f('0x21')]=_0x407343;if(_0xfcd40[_0x1c9f('0x41')][_0x1c9f('0x42')]){_0x4010d3[_0x1c9f('0x43')]=[{'all':!![]}];}return db[_0x1c9f('0xe3')][_0x1c9f('0x49')](_0x4010d3);})[_0x1c9f('0x26')](function(_0x195820){_0x4a0469[_0x1c9f('0x4a')]=_0x195820;return _0x4a0469;});}})[_0x1c9f('0x26')](respondWithFilteredResult(_0x29bdfb,_0x4010d3))[_0x1c9f('0x1c')](handleError(_0x29bdfb,null));};exports[_0x1c9f('0xe4')]=function(_0x1a38a6,_0x121c65){var _0xc700dc={};var _0x4c30af={};var _0x48a39d;var _0x4975b0;return db[_0x1c9f('0x39')]['findOne']({'where':{'id':_0x1a38a6['params']['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x121c65,null))['then'](function(_0x1ce2ae){if(_0x1ce2ae){_0x48a39d=_0x1ce2ae;_0x4c30af[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db[_0x1c9f('0xe5')][_0x1c9f('0x3a')]);_0x4c30af[_0x1c9f('0x41')]=_[_0x1c9f('0x57')](_0x1a38a6[_0x1c9f('0x41')]);_0x4c30af[_0x1c9f('0x59')]=_[_0x1c9f('0x5a')](_0x4c30af[_0x1c9f('0x55')],_0x4c30af[_0x1c9f('0x41')]);_0xc700dc[_0x1c9f('0x47')]=_['intersection'](_0x4c30af['model'],qs[_0x1c9f('0x5b')](_0x1a38a6[_0x1c9f('0x41')]['fields']));_0xc700dc[_0x1c9f('0x47')]=_0xc700dc[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0xc700dc[_0x1c9f('0x47')]:_0x4c30af[_0x1c9f('0x55')];_0xc700dc[_0x1c9f('0xda')]=qs[_0x1c9f('0xcd')](_0x1a38a6[_0x1c9f('0x41')]['sort']);_0xc700dc[_0x1c9f('0x40')]=qs['filters'](_[_0x1c9f('0xce')](_0x1a38a6['query'],_0x4c30af[_0x1c9f('0x59')]));if(_0x1a38a6[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0xc700dc[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0xc700dc[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0xc700dc[_0x1c9f('0x47')],function(_0x64bdd3){var _0x46cd4d={};_0x46cd4d[_0x64bdd3]={'$like':'%'+_0x1a38a6[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0x46cd4d;})});}_0xc700dc=_['merge']({},_0xc700dc,_0x1a38a6[_0x1c9f('0x5d')]);return _0x48a39d['getChatInteractions'](_0xc700dc);}})[_0x1c9f('0x26')](function(_0x3ec0c5){if(_0x3ec0c5){_0x4975b0=_0x3ec0c5[_0x1c9f('0x4b')];if(!_0x1a38a6['query'][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0xc700dc[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0x1a38a6['query'][_0x1c9f('0x20')]);_0xc700dc[_0x1c9f('0x22')]=qs[_0x1c9f('0x22')](_0x1a38a6[_0x1c9f('0x41')]['offset']);}return _0x48a39d[_0x1c9f('0xe4')](_0xc700dc);}})[_0x1c9f('0x26')](function(_0x18daa9){if(_0x18daa9){return _0x18daa9?{'count':_0x4975b0,'rows':_0x18daa9}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x121c65,null))[_0x1c9f('0x1c')](handleError(_0x121c65,null));};exports[_0x1c9f('0xe6')]=function(_0x282e9f,_0x44226d){var _0x32ad12={};var _0x21e7c0={};var _0x32482e;var _0x13ab47;return db[_0x1c9f('0x39')][_0x1c9f('0x96')]({'where':{'id':_0x282e9f[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x44226d,null))[_0x1c9f('0x26')](function(_0x7d8f7b){if(_0x7d8f7b){_0x32482e=_0x7d8f7b;_0x21e7c0[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db[_0x1c9f('0xe7')][_0x1c9f('0x3a')]);_0x21e7c0[_0x1c9f('0x41')]=_['keys'](_0x282e9f['query']);_0x21e7c0[_0x1c9f('0x59')]=_['intersection'](_0x21e7c0[_0x1c9f('0x55')],_0x21e7c0['query']);_0x32ad12['attributes']=_[_0x1c9f('0x5a')](_0x21e7c0[_0x1c9f('0x55')],qs[_0x1c9f('0x5b')](_0x282e9f[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x32ad12[_0x1c9f('0x47')]=_0x32ad12[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x32ad12[_0x1c9f('0x47')]:_0x21e7c0['model'];_0x32ad12[_0x1c9f('0xda')]=qs[_0x1c9f('0xcd')](_0x282e9f[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x32ad12['where']=qs[_0x1c9f('0x59')](_[_0x1c9f('0xce')](_0x282e9f[_0x1c9f('0x41')],_0x21e7c0[_0x1c9f('0x59')]));if(_0x282e9f[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x32ad12[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x32ad12[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x32ad12[_0x1c9f('0x47')],function(_0x4ea687){var _0x4a835d={};_0x4a835d[_0x4ea687]={'$like':'%'+_0x282e9f[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0x4a835d;})});}_0x32ad12=_[_0x1c9f('0x5c')]({},_0x32ad12,_0x282e9f['options']);return _0x32482e[_0x1c9f('0xe6')](_0x32ad12);}})[_0x1c9f('0x26')](function(_0x268183){if(_0x268183){_0x13ab47=_0x268183['length'];if(!_0x282e9f[_0x1c9f('0x41')][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0x32ad12[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0x282e9f['query'][_0x1c9f('0x20')]);_0x32ad12[_0x1c9f('0x22')]=qs['offset'](_0x282e9f[_0x1c9f('0x41')][_0x1c9f('0x22')]);}return _0x32482e[_0x1c9f('0xe6')](_0x32ad12);}})[_0x1c9f('0x26')](function(_0x2a17a0){if(_0x2a17a0){return _0x2a17a0?{'count':_0x13ab47,'rows':_0x2a17a0}:null;}})['then'](respondWithResult(_0x44226d,null))[_0x1c9f('0x1c')](handleError(_0x44226d,null));};exports[_0x1c9f('0xe8')]=function(_0x304e81,_0x5df6d9){var _0x4b9c10={'raw':!![],'where':{}};var _0x4548e3={};var _0x248879={'count':0x0,'rows':[]};return db['User'][_0x1c9f('0x96')]({'where':{'id':_0x304e81[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x5df6d9,null))[_0x1c9f('0x26')](function(_0x4db516){if(_0x4db516){_0x4548e3[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db[_0x1c9f('0xe9')][_0x1c9f('0x3a')]);_0x4548e3['query']=_[_0x1c9f('0x57')](_0x304e81['query']);_0x4548e3[_0x1c9f('0x59')]=_[_0x1c9f('0x5a')](_0x4548e3['model'],_0x4548e3['query']);_0x4b9c10[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x4548e3[_0x1c9f('0x55')],qs[_0x1c9f('0x5b')](_0x304e81['query']['fields']));_0x4b9c10[_0x1c9f('0x47')]=_0x4b9c10[_0x1c9f('0x47')]['length']?_0x4b9c10[_0x1c9f('0x47')]:_0x4548e3[_0x1c9f('0x55')];if(!_0x304e81[_0x1c9f('0x41')][_0x1c9f('0xd0')]('nolimit')){_0x4b9c10[_0x1c9f('0x20')]=qs['limit'](_0x304e81['query']['limit']);_0x4b9c10['offset']=qs['offset'](_0x304e81['query'][_0x1c9f('0x22')]);}_0x4b9c10[_0x1c9f('0xda')]=qs[_0x1c9f('0xcd')](_0x304e81[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x4b9c10[_0x1c9f('0x40')]=qs['filters'](_[_0x1c9f('0xce')](_0x304e81[_0x1c9f('0x41')],_0x4548e3[_0x1c9f('0x59')]));_0x4b9c10['where'][_0x1c9f('0xe2')]=_0x4db516['id'];if(_0x304e81[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x4b9c10[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x4b9c10['where'],{'$or':_[_0x1c9f('0x8c')](_0x4b9c10['attributes'],function(_0x4ecf02){var _0x5d544d={};_0x5d544d[_0x4ecf02]={'$like':'%'+_0x304e81[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0x5d544d;})});}_0x4b9c10=_[_0x1c9f('0x5c')]({},_0x4b9c10,_0x304e81['options']);return db[_0x1c9f('0xe9')][_0x1c9f('0x21')]({'where':_0x4b9c10[_0x1c9f('0x40')]})['then'](function(_0x4371e9){_0x248879[_0x1c9f('0x21')]=_0x4371e9;if(_0x304e81[_0x1c9f('0x41')]['includeAll']){_0x4b9c10[_0x1c9f('0x43')]=[{'all':!![]}];}return db[_0x1c9f('0xe9')]['findAll'](_0x4b9c10);})[_0x1c9f('0x26')](function(_0x211c62){_0x248879[_0x1c9f('0x4a')]=_0x211c62;return _0x248879;});}})['then'](respondWithFilteredResult(_0x5df6d9,_0x4b9c10))[_0x1c9f('0x1c')](handleError(_0x5df6d9,null));};exports[_0x1c9f('0xea')]=function(_0x3210f3,_0x174853){var _0x5e2e89={};var _0x4ffc39={};var _0x2198a4;var _0x2a9fe3;return db[_0x1c9f('0x39')]['findOne']({'where':{'id':_0x3210f3[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x174853,null))[_0x1c9f('0x26')](function(_0x2e5775){if(_0x2e5775){_0x2198a4=_0x2e5775;_0x4ffc39[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db[_0x1c9f('0xeb')][_0x1c9f('0x3a')]);_0x4ffc39['query']=_['keys'](_0x3210f3[_0x1c9f('0x41')]);_0x4ffc39['filters']=_[_0x1c9f('0x5a')](_0x4ffc39[_0x1c9f('0x55')],_0x4ffc39[_0x1c9f('0x41')]);_0x5e2e89['attributes']=_[_0x1c9f('0x5a')](_0x4ffc39[_0x1c9f('0x55')],qs['fields'](_0x3210f3[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x5e2e89[_0x1c9f('0x47')]=_0x5e2e89[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x5e2e89[_0x1c9f('0x47')]:_0x4ffc39[_0x1c9f('0x55')];_0x5e2e89[_0x1c9f('0xda')]=qs[_0x1c9f('0xcd')](_0x3210f3[_0x1c9f('0x41')]['sort']);_0x5e2e89['where']=qs['filters'](_[_0x1c9f('0xce')](_0x3210f3[_0x1c9f('0x41')],_0x4ffc39[_0x1c9f('0x59')]));if(_0x3210f3[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x5e2e89[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x5e2e89['where'],{'$or':_['map'](_0x5e2e89[_0x1c9f('0x47')],function(_0x527829){var _0x5c6687={};_0x5c6687[_0x527829]={'$like':'%'+_0x3210f3[_0x1c9f('0x41')]['filter']+'%'};return _0x5c6687;})});}_0x5e2e89=_['merge']({},_0x5e2e89,_0x3210f3[_0x1c9f('0x5d')]);return _0x2198a4[_0x1c9f('0xea')](_0x5e2e89);}})[_0x1c9f('0x26')](function(_0x21f080){if(_0x21f080){_0x2a9fe3=_0x21f080[_0x1c9f('0x4b')];if(!_0x3210f3[_0x1c9f('0x41')][_0x1c9f('0xd0')]('nolimit')){_0x5e2e89[_0x1c9f('0x20')]=qs['limit'](_0x3210f3[_0x1c9f('0x41')]['limit']);_0x5e2e89[_0x1c9f('0x22')]=qs[_0x1c9f('0x22')](_0x3210f3['query'][_0x1c9f('0x22')]);}return _0x2198a4[_0x1c9f('0xea')](_0x5e2e89);}})[_0x1c9f('0x26')](function(_0x4ffcbd){if(_0x4ffcbd){return _0x4ffcbd?{'count':_0x2a9fe3,'rows':_0x4ffcbd}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x174853,null))[_0x1c9f('0x1c')](handleError(_0x174853,null));};exports['getFaxInteractions']=function(_0x51e8d3,_0x2810ed){var _0x4c9c22={};var _0x32446c={};var _0x33ceee;var _0x3930d3;return db[_0x1c9f('0x39')]['findOne']({'where':{'id':_0x51e8d3[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x2810ed,null))[_0x1c9f('0x26')](function(_0x45b257){if(_0x45b257){_0x33ceee=_0x45b257;_0x32446c['model']=_[_0x1c9f('0x57')](db[_0x1c9f('0xec')][_0x1c9f('0x3a')]);_0x32446c[_0x1c9f('0x41')]=_[_0x1c9f('0x57')](_0x51e8d3[_0x1c9f('0x41')]);_0x32446c[_0x1c9f('0x59')]=_[_0x1c9f('0x5a')](_0x32446c[_0x1c9f('0x55')],_0x32446c[_0x1c9f('0x41')]);_0x4c9c22[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x32446c['model'],qs[_0x1c9f('0x5b')](_0x51e8d3[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x4c9c22[_0x1c9f('0x47')]=_0x4c9c22[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x4c9c22[_0x1c9f('0x47')]:_0x32446c[_0x1c9f('0x55')];_0x4c9c22[_0x1c9f('0xda')]=qs['sort'](_0x51e8d3[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x4c9c22[_0x1c9f('0x40')]=qs[_0x1c9f('0x59')](_['pick'](_0x51e8d3[_0x1c9f('0x41')],_0x32446c[_0x1c9f('0x59')]));if(_0x51e8d3[_0x1c9f('0x41')]['filter']){_0x4c9c22['where']=_[_0x1c9f('0x5c')](_0x4c9c22[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x4c9c22['attributes'],function(_0x2e9c24){var _0x34e1a5={};_0x34e1a5[_0x2e9c24]={'$like':'%'+_0x51e8d3[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0x34e1a5;})});}_0x4c9c22=_[_0x1c9f('0x5c')]({},_0x4c9c22,_0x51e8d3['options']);return _0x33ceee[_0x1c9f('0xed')](_0x4c9c22);}})[_0x1c9f('0x26')](function(_0xba088b){if(_0xba088b){_0x3930d3=_0xba088b[_0x1c9f('0x4b')];if(!_0x51e8d3[_0x1c9f('0x41')][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0x4c9c22[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0x51e8d3['query']['limit']);_0x4c9c22['offset']=qs['offset'](_0x51e8d3[_0x1c9f('0x41')][_0x1c9f('0x22')]);}return _0x33ceee[_0x1c9f('0xed')](_0x4c9c22);}})[_0x1c9f('0x26')](function(_0x5c8e68){if(_0x5c8e68){return _0x5c8e68?{'count':_0x3930d3,'rows':_0x5c8e68}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x2810ed,null))[_0x1c9f('0x1c')](handleError(_0x2810ed,null));};exports['getWhatsappInteractions']=function(_0xf89b35,_0x1b67b3){var _0xe0df2e={};var _0xf48d1b={};var _0x5d7df8;var _0x595879;return db[_0x1c9f('0x39')]['findOne']({'where':{'id':_0xf89b35[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x1b67b3,null))[_0x1c9f('0x26')](function(_0x344f6e){if(_0x344f6e){_0x5d7df8=_0x344f6e;_0xf48d1b[_0x1c9f('0x55')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0xf48d1b[_0x1c9f('0x41')]=_[_0x1c9f('0x57')](_0xf89b35[_0x1c9f('0x41')]);_0xf48d1b[_0x1c9f('0x59')]=_[_0x1c9f('0x5a')](_0xf48d1b[_0x1c9f('0x55')],_0xf48d1b['query']);_0xe0df2e['attributes']=_[_0x1c9f('0x5a')](_0xf48d1b[_0x1c9f('0x55')],qs[_0x1c9f('0x5b')](_0xf89b35[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0xe0df2e[_0x1c9f('0x47')]=_0xe0df2e[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0xe0df2e['attributes']:_0xf48d1b[_0x1c9f('0x55')];_0xe0df2e['order']=qs[_0x1c9f('0xcd')](_0xf89b35['query'][_0x1c9f('0xcd')]);_0xe0df2e['where']=qs[_0x1c9f('0x59')](_['pick'](_0xf89b35[_0x1c9f('0x41')],_0xf48d1b[_0x1c9f('0x59')]));if(_0xf89b35[_0x1c9f('0x41')]['filter']){_0xe0df2e[_0x1c9f('0x40')]=_['merge'](_0xe0df2e[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0xe0df2e['attributes'],function(_0x4c4432){var _0x32be55={};_0x32be55[_0x4c4432]={'$like':'%'+_0xf89b35[_0x1c9f('0x41')]['filter']+'%'};return _0x32be55;})});}_0xe0df2e=_['merge']({},_0xe0df2e,_0xf89b35[_0x1c9f('0x5d')]);return _0x5d7df8[_0x1c9f('0xee')](_0xe0df2e);}})['then'](function(_0x48cffa){if(_0x48cffa){_0x595879=_0x48cffa['length'];if(!_0xf89b35[_0x1c9f('0x41')][_0x1c9f('0xd0')](_0x1c9f('0xd7'))){_0xe0df2e[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0xf89b35[_0x1c9f('0x41')][_0x1c9f('0x20')]);_0xe0df2e[_0x1c9f('0x22')]=qs[_0x1c9f('0x22')](_0xf89b35['query']['offset']);}return _0x5d7df8['getWhatsappInteractions'](_0xe0df2e);}})[_0x1c9f('0x26')](function(_0x3fb9f4){if(_0x3fb9f4){return _0x3fb9f4?{'count':_0x595879,'rows':_0x3fb9f4}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x1b67b3,null))[_0x1c9f('0x1c')](handleError(_0x1b67b3,null));};exports[_0x1c9f('0xef')]=function(_0x596921,_0xf49da6,_0x541ada){var _0x5c3cd9;var _0xcdbade;var _0x1081bc;var _0x4a0635=!_['isNil'](_0x596921['params']['id'])?_0x596921[_0x1c9f('0x54')]['id']:!_[_0x1c9f('0x6a')](_0x596921[_0x1c9f('0x2c')]['id'])?_0x596921[_0x1c9f('0x2c')]['id']:null;return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x4a0635,'role':{'$or':[_0x1c9f('0x2a'),_0x1c9f('0x2c'),_0x1c9f('0x80')]}},'attributes':['id',_0x1c9f('0x33'),_0x1c9f('0xf0'),_0x1c9f('0xf1'),_0x1c9f('0x29'),_0x1c9f('0x65'),_0x1c9f('0x9f')]})['then'](function(_0x2c9f0e){if(_0x2c9f0e){if(_0x2c9f0e['role']===_0x1c9f('0x80')){_0x5c3cd9=_0x2c9f0e;if(_0x596921[_0x1c9f('0x60')]['interface']){_0x1081bc=util['format'](_0x1c9f('0xf2'),_0x5c3cd9[_0x596921['body'][_0x1c9f('0xa1')]]);}else if(_0x596921[_0x1c9f('0x60')][_0x1c9f('0xf3')]){_0x1081bc=util[_0x1c9f('0xac')](_0x1c9f('0xad'),_0x596921[_0x1c9f('0x60')][_0x1c9f('0xf3')]);}else{_0x1081bc=util['format'](_0x1c9f('0xad'),_0x5c3cd9['name']);}socket['to'](util[_0x1c9f('0xac')](_0x1c9f('0xf4'),_0x5c3cd9[_0x1c9f('0x33')]))[_0x1c9f('0xb3')]('user:forcelogout',{'user':{'id':_0x5c3cd9['id'],'name':_0x5c3cd9[_0x1c9f('0x33')]},'ip':_0x596921[_0x1c9f('0xf5')][_0x1c9f('0xf6')]||_0x596921['connection'][_0x1c9f('0xf7')]||_0x596921[_0x1c9f('0xf8')][_0x1c9f('0xf7')]||_0x596921['connection'][_0x1c9f('0xf8')][_0x1c9f('0xf7')]});return db[_0x1c9f('0xb6')][_0x1c9f('0x27')]({'where':{'membername':_0x5c3cd9[_0x1c9f('0x33')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x1c9f('0x8e'))](_0x1c9f('0xf9'));}})[_0x1c9f('0x26')](function(){if(_0x5c3cd9){return _0x5c3cd9[_0x1c9f('0xfa')]({'raw':!![]});}})[_0x1c9f('0x26')](function(_0x22b1d4){if(_0x5c3cd9){var _0x27aa8b=[];if(_0x22b1d4){_0xcdbade=_0x22b1d4;if(_0xcdbade[_0x1c9f('0x4b')]){for(var _0x590094=0x0;_0x590094<_0xcdbade[_0x1c9f('0x4b')];_0x590094++){_0x27aa8b[_0x1c9f('0x48')]({'membername':_0x5c3cd9['name'],'UserId':_0x5c3cd9['id'],'queue_name':_0xcdbade[_0x590094][_0x1c9f('0x33')],'VoiceQueueId':_0xcdbade[_0x590094]['id'],'interface':_0x1081bc,'paused':_0x5c3cd9[_0x1c9f('0x9f')]||![],'penalty':_0xcdbade[_0x590094]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x27aa8b,function(_0x1bdf70){return db[_0x1c9f('0xb6')][_0x1c9f('0xfb')](_0x1bdf70);});}}}})[_0x1c9f('0x26')](function(){if(_0x5c3cd9){return db[_0x1c9f('0xfc')][_0x1c9f('0x49')]({'where':{'membername':_0x5c3cd9[_0x1c9f('0x33')],'exitAt':null}});}})['then'](function(_0x491fad){if(_0x5c3cd9){var _0x135c33=[];_0x491fad[_0x1c9f('0xfd')](function(_0x1275c9){_0x135c33[_0x1c9f('0x48')](_0x1275c9[_0x1c9f('0x25')]({'exitAt':moment()[_0x1c9f('0xac')](_0x1c9f('0xfe'))}));});return BPromise[_0x1c9f('0x52')](_0x135c33);}})['then'](function(){if(_0x5c3cd9){var _0x16ef8d=[];var _0x2e5424=[];var _0x121f90=utils['getChannels']();var _0x41b260={'membername':_0x5c3cd9[_0x1c9f('0x33')],'interface':_0x1081bc,'enterAt':moment()[_0x1c9f('0xac')](_0x1c9f('0xfe')),'role':_0x5c3cd9[_0x1c9f('0x29')],'internal':_0x5c3cd9[_0x1c9f('0x65')]};_0x121f90[_0x1c9f('0xfd')](function(_0x42f207){_0x16ef8d[_0x1c9f('0x48')](_[_0x1c9f('0x5c')]({'channel':_0x42f207,'type':_0x1c9f('0xff'),'data1':_0x596921[_0x1c9f('0x60')][_0x1c9f('0x100')],'data2':_0x1081bc},_0x41b260));if(_0x5c3cd9['loginInPause']){_0x2e5424[_0x1c9f('0x48')](_[_0x1c9f('0x5c')]({'channel':_0x42f207,'type':_0x1c9f('0x101'),'data1':'LOGININPAUSE'},_0x41b260));}});return db[_0x1c9f('0xfc')][_0x1c9f('0x102')](_0x16ef8d[_0x1c9f('0xca')](_0x2e5424),{'individualHooks':!![]});}})[_0x1c9f('0x26')](function(){if(_0x5c3cd9){return _0x5c3cd9[_0x1c9f('0x25')]({'online':!![],'lastLoginAt':moment()[_0x1c9f('0xac')](_0x1c9f('0xfe')),'voicePause':_0x5c3cd9[_0x1c9f('0x9f')]||![],'mailPause':_0x5c3cd9[_0x1c9f('0x9f')]||![],'chatPause':_0x5c3cd9['loginInPause']||![],'faxPause':_0x5c3cd9[_0x1c9f('0x9f')]||![],'smsPause':_0x5c3cd9[_0x1c9f('0x9f')]||![],'openchannelPause':_0x5c3cd9[_0x1c9f('0x9f')]||![],'whatsappPause':_0x5c3cd9[_0x1c9f('0x9f')]||![],'pauseType':_0x5c3cd9[_0x1c9f('0x9f')]?_0x1c9f('0x103'):null,'interface':_0x1081bc,'lastPauseAt':moment()['format'](_0x1c9f('0xfe'))});}})[_0x1c9f('0x26')](function(_0x32f31c){if(_0x596921[_0x1c9f('0x104')]){return _0x541ada();}else{return BPromise[_0x1c9f('0x105')](_0x32f31c)[_0x1c9f('0x26')](respondWithResult(_0xf49da6,null));}})[_0x1c9f('0x1c')](handleError(_0xf49da6,null));};exports['logout']=function(_0x3a6df0,_0x24d8f5){var _0x468176;return db['User'][_0x1c9f('0x32')]({'where':{'id':_0x3a6df0[_0x1c9f('0x54')]['id'],'role':'agent'},'attributes':['id','name',_0x1c9f('0x29')]})['then'](handleEntityNotFound(_0x24d8f5,null))[_0x1c9f('0x26')](function(_0x523382){if(_0x523382){_0x468176=_0x523382;return db['UserVoiceQueueRt'][_0x1c9f('0x27')]({'where':{'membername':_0x468176[_0x1c9f('0x33')]},'individualHooks':!![]});}})['then'](function(){return db[_0x1c9f('0xfc')][_0x1c9f('0x49')]({'where':{'membername':_0x468176[_0x1c9f('0x33')],'exitAt':null}});})[_0x1c9f('0x26')](function(_0x1cb488){var _0x33a17b=[];_0x1cb488[_0x1c9f('0xfd')](function(_0x585d52){_0x33a17b[_0x1c9f('0x48')](_0x585d52[_0x1c9f('0x25')]({'exitAt':moment()[_0x1c9f('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1c9f('0x52')](_0x33a17b);})['then'](function(){return _0x468176['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x24d8f5,null))[_0x1c9f('0x1c')](handleError(_0x24d8f5,null));};exports['pause']=function(_0x111ff6,_0x4c5e4f){var _0x4c9b84;return db['UserVoiceQueueRt'][_0x1c9f('0x25')]({'paused':0x1},{'where':{'UserId':_0x111ff6[_0x1c9f('0x54')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x111ff6[_0x1c9f('0x54')]['id'],'role':_0x1c9f('0x80')},'attributes':['id',_0x1c9f('0x33'),_0x1c9f('0x29'),_0x1c9f('0x65'),'interface']});})['then'](handleEntityNotFound(_0x4c5e4f,null))[_0x1c9f('0x26')](function(_0x4c6eb7){if(_0x4c6eb7){_0x4c9b84=_0x4c6eb7;return respondWithRpcPromise(_0x1c9f('0x106'),_0x1c9f('0x107'),{'id':_0x4c9b84['id'],'name':_0x4c9b84[_0x1c9f('0x33')],'pause':!![]});}})[_0x1c9f('0x26')](function(){if(_0x4c9b84){return db[_0x1c9f('0xfc')][_0x1c9f('0x49')]({'where':{'membername':_0x4c9b84['name'],'type':'PAUSE','exitAt':null}});}})[_0x1c9f('0x26')](function(_0x5704b8){if(_0x5704b8['length']){var _0x549cf4=moment()[_0x1c9f('0xac')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x30c24a=0x0,_0x2492ac=_0x5704b8[_0x1c9f('0x4b')];_0x30c24a<_0x2492ac;_0x30c24a++){_0x5704b8[_0x30c24a][_0x1c9f('0x108')]({'exitAt':_0x549cf4});}}})[_0x1c9f('0x26')](function(){var _0x4956a1=[];var _0x2385f3=utils[_0x1c9f('0x109')]();_0x2385f3[_0x1c9f('0xfd')](function(_0x337d2c){_0x4956a1['push']({'channel':_0x337d2c,'membername':_0x4c9b84[_0x1c9f('0x33')],'interface':_[_0x1c9f('0x6a')](_0x4c9b84[_0x1c9f('0xa1')])?util[_0x1c9f('0xac')](_0x1c9f('0xad'),_0x4c9b84['name']):_0x4c9b84[_0x1c9f('0xa1')],'type':_0x1c9f('0x101'),'enterAt':moment()[_0x1c9f('0xac')](_0x1c9f('0xfe')),'data1':_0x111ff6['body'][_0x1c9f('0x3c')]||'DEFAULT\x20PAUSE','role':_0x4c9b84[_0x1c9f('0x29')],'internal':_0x4c9b84['internal']});});return db[_0x1c9f('0xfc')][_0x1c9f('0x102')](_0x4956a1,{'individualHooks':!![]});})[_0x1c9f('0x26')](function(){return _0x4c9b84[_0x1c9f('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x111ff6[_0x1c9f('0x60')][_0x1c9f('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x1c9f('0xfe'))});})['then'](respondWithResult(_0x4c5e4f,null))['catch'](handleError(_0x4c5e4f,null));};exports[_0x1c9f('0x10a')]=function(_0x52dadd,_0x5452a1){var _0x278458;return db['User'][_0x1c9f('0x32')]({'where':{'id':_0x52dadd[_0x1c9f('0x54')]['id']},'attributes':['id',_0x1c9f('0x33'),'role',_0x1c9f('0xa0'),_0x1c9f('0x10b'),_0x1c9f('0x10c'),_0x1c9f('0x10d'),_0x1c9f('0x10e'),_0x1c9f('0x10f'),'whatsapppause',_0x1c9f('0x110'),_0x1c9f('0x111')]})[_0x1c9f('0x26')](handleEntityNotFound(_0x5452a1,null))['then'](function(_0x4f64b6){if(_0x4f64b6){_0x278458=_0x4f64b6;if(_0x52dadd['body'][_0x1c9f('0xaf')]&&!utils['isValidChannel'](_0x52dadd[_0x1c9f('0x60')][_0x1c9f('0xaf')])){throw new db['Sequelize']['ValidationError'](_0x1c9f('0xb0'));}switch(_0x52dadd[_0x1c9f('0x60')][_0x1c9f('0xaf')]){case _0x1c9f('0xab'):return respondWithRpcPromise(_0x1c9f('0x106'),_0x1c9f('0x10a'),{'id':_0x278458['id'],'name':_0x278458[_0x1c9f('0x33')],'pause':![]})[_0x1c9f('0x26')](function(){return db[_0x1c9f('0xb6')][_0x1c9f('0x25')]({'paused':0x0},{'where':{'UserId':_0x278458['id']},'individualHooks':!![]});})[_0x1c9f('0x26')](function(){return db['MemberReport'][_0x1c9f('0x32')]({'where':{'channel':_0x52dadd[_0x1c9f('0x60')][_0x1c9f('0xaf')],'membername':_0x278458[_0x1c9f('0x33')],'type':_0x1c9f('0x101'),'exitAt':null}});})['then'](function(_0x2dc16c){if(_0x2dc16c){return _0x2dc16c[_0x1c9f('0x25')]({'exitAt':moment()[_0x1c9f('0xac')](_0x1c9f('0xfe')),'data2':_0x1c9f('0x112')},{'individualHooks':!![]});}return null;})[_0x1c9f('0x26')](function(){return _0x278458['update']({'voicePause':![]});});case _0x1c9f('0x4f'):case _0x1c9f('0x4c'):case _0x1c9f('0x5f'):case _0x1c9f('0x4e'):case _0x1c9f('0x51'):case'openchannel':return db[_0x1c9f('0xfc')][_0x1c9f('0x32')]({'where':{'channel':_0x52dadd[_0x1c9f('0x60')]['channel'],'membername':_0x278458[_0x1c9f('0x33')],'type':_0x1c9f('0x101'),'exitAt':null}})[_0x1c9f('0x26')](function(_0x5ceb37){if(_0x5ceb37){return _0x5ceb37[_0x1c9f('0x25')]({'exitAt':moment()['format'](_0x1c9f('0xfe')),'data2':_0x1c9f('0x112')},{'individualHooks':!![]});}return null;})[_0x1c9f('0x26')](function(){var _0x4e4e66={};_[_0x1c9f('0x23')](_0x4e4e66,util[_0x1c9f('0xac')](_0x1c9f('0x113'),_0x52dadd[_0x1c9f('0x60')][_0x1c9f('0xaf')],_0x1c9f('0x114')),![]);return _0x278458[_0x1c9f('0x25')](_0x4e4e66);});default:return respondWithRpcPromise(_0x1c9f('0x106'),_0x1c9f('0x10a'),{'id':_0x278458['id'],'name':_0x278458[_0x1c9f('0x33')],'pause':![]})['then'](function(){return db[_0x1c9f('0xb6')][_0x1c9f('0x25')]({'paused':0x0},{'where':{'UserId':_0x278458['id']}});})[_0x1c9f('0x26')](function(){return db[_0x1c9f('0xfc')][_0x1c9f('0x49')]({'where':{'membername':_0x278458[_0x1c9f('0x33')],'type':_0x1c9f('0x101'),'exitAt':null}});})[_0x1c9f('0x26')](function(_0x502db5){var _0x3f020c=[];_0x502db5[_0x1c9f('0xfd')](function(_0x1cf91e){_0x3f020c[_0x1c9f('0x48')](_0x1cf91e[_0x1c9f('0x25')]({'exitAt':moment()[_0x1c9f('0xac')](_0x1c9f('0xfe')),'data2':'manual'}));});return BPromise['all'](_0x3f020c);})[_0x1c9f('0x26')](function(){return _0x278458[_0x1c9f('0x25')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x1c9f('0x26')](respondWithResult(_0x5452a1,null))[_0x1c9f('0x1c')](handleError(_0x5452a1,null));};exports['getTeams']=function(_0x358904,_0x1b2f4f){var _0x2f6469={};var _0x160ad2={};var _0x3df7dd;var _0x23a4e3;return db[_0x1c9f('0x39')][_0x1c9f('0x96')]({'where':{'id':_0x358904[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x1b2f4f,null))[_0x1c9f('0x26')](function(_0x32fafb){if(_0x32fafb){_0x3df7dd=_0x32fafb;_0x160ad2[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db[_0x1c9f('0x115')][_0x1c9f('0x3a')]);_0x160ad2[_0x1c9f('0x41')]=_['keys'](_0x358904['query']);_0x160ad2[_0x1c9f('0x59')]=_['intersection'](_0x160ad2['model'],_0x160ad2[_0x1c9f('0x41')]);_0x2f6469[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x160ad2['model'],qs[_0x1c9f('0x5b')](_0x358904[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x2f6469['attributes']=_0x2f6469['attributes'][_0x1c9f('0x4b')]?_0x2f6469[_0x1c9f('0x47')]:_0x160ad2['model'];_0x2f6469[_0x1c9f('0xda')]=qs['sort'](_0x358904[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x2f6469[_0x1c9f('0x40')]=qs['filters'](_[_0x1c9f('0xce')](_0x358904[_0x1c9f('0x41')],_0x160ad2[_0x1c9f('0x59')]));if(_0x358904[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x2f6469[_0x1c9f('0x40')]=_[_0x1c9f('0x5c')](_0x2f6469[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x2f6469[_0x1c9f('0x47')],function(_0x2820b5){var _0x41203c={};_0x41203c[_0x2820b5]={'$like':'%'+_0x358904[_0x1c9f('0x41')][_0x1c9f('0xcf')]+'%'};return _0x41203c;})});}_0x2f6469=_['merge']({},_0x2f6469,_0x358904[_0x1c9f('0x5d')]);return _0x3df7dd['getTeams'](_0x2f6469);}})[_0x1c9f('0x26')](function(_0x433d75){if(_0x433d75){_0x23a4e3=_0x433d75[_0x1c9f('0x4b')];if(!_0x358904[_0x1c9f('0x41')]['hasOwnProperty'](_0x1c9f('0xd7'))){_0x2f6469[_0x1c9f('0x20')]=qs[_0x1c9f('0x20')](_0x358904['query'][_0x1c9f('0x20')]);_0x2f6469['offset']=qs[_0x1c9f('0x22')](_0x358904[_0x1c9f('0x41')][_0x1c9f('0x22')]);}return _0x3df7dd[_0x1c9f('0x116')](_0x2f6469);}})['then'](function(_0x54dab5){if(_0x54dab5){return _0x54dab5?{'count':_0x23a4e3,'rows':_0x54dab5}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x1b2f4f,null))[_0x1c9f('0x1c')](handleError(_0x1b2f4f,null));};exports[_0x1c9f('0x117')]=function(_0x5ca033,_0x44b032){return db[_0x1c9f('0x39')][_0x1c9f('0x32')]({'where':{'id':_0x5ca033[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x44b032,null))[_0x1c9f('0x26')](function(_0x147aac){if(_0x147aac){var _0x46ad98=_0x147aac[_0x1c9f('0x28')]({'plain':!![]});return _0x147aac[_0x1c9f('0x117')](_0x5ca033['body'][_0x1c9f('0x63')],_[_0x1c9f('0x64')](_0x5ca033[_0x1c9f('0x60')],['ids','id'])||{})[_0x1c9f('0x26')](function(){for(var _0xa1f6db=0x0;_0xa1f6db<_0x5ca033[_0x1c9f('0x60')][_0x1c9f('0x63')][_0x1c9f('0x4b')];_0xa1f6db++){var _0x3b7a06=[];var _0x134a45={};db[_0x1c9f('0x115')][_0x1c9f('0x96')]({'where':{'id':_0x5ca033[_0x1c9f('0x60')]['ids'][_0xa1f6db]}})['then'](function(_0x1e0039){_0x134a45=_0x1e0039[_0x1c9f('0x4d')];_0x3b7a06[_0x1c9f('0x48')](_0x1e0039[_0x1c9f('0xfa')]()[_0x1c9f('0x26')](function(_0x36b64b){for(var _0x3307ea=0x0;_0x3307ea<_0x36b64b[_0x1c9f('0x4b')];_0x3307ea++){_0x36b64b[_0x3307ea][_0x1c9f('0x118')](_0x1c9f('0xaf'),_0x1c9f('0x119'));}return _0x36b64b;}));_0x3b7a06[_0x1c9f('0x48')](_0x1e0039['getChatQueues']()['then'](function(_0x4d80e3){for(var _0xaff318=0x0;_0xaff318<_0x4d80e3[_0x1c9f('0x4b')];_0xaff318++){_0x4d80e3[_0xaff318][_0x1c9f('0x118')](_0x1c9f('0xaf'),'Chat');}return _0x4d80e3;}));_0x3b7a06[_0x1c9f('0x48')](_0x1e0039['getMailQueues']()[_0x1c9f('0x26')](function(_0x59498f){for(var _0x49caa9=0x0;_0x49caa9<_0x59498f['length'];_0x49caa9++){_0x59498f[_0x49caa9][_0x1c9f('0x118')]('channel',_0x1c9f('0x11a'));}return _0x59498f;}));_0x3b7a06[_0x1c9f('0x48')](_0x1e0039[_0x1c9f('0x11b')]()['then'](function(_0x1d1f0c){for(var _0x5ba6db=0x0;_0x5ba6db<_0x1d1f0c[_0x1c9f('0x4b')];_0x5ba6db++){_0x1d1f0c[_0x5ba6db][_0x1c9f('0x118')]('channel','Sms');}return _0x1d1f0c;}));_0x3b7a06[_0x1c9f('0x48')](_0x1e0039[_0x1c9f('0x11c')]()[_0x1c9f('0x26')](function(_0x38594d){for(var _0x302a95=0x0;_0x302a95<_0x38594d[_0x1c9f('0x4b')];_0x302a95++){_0x38594d[_0x302a95][_0x1c9f('0x118')]('channel',_0x1c9f('0x11d'));}return _0x38594d;}));_0x3b7a06['push'](_0x1e0039[_0x1c9f('0x11e')]()[_0x1c9f('0x26')](function(_0xe2d6ed){for(var _0x1f9791=0x0;_0x1f9791<_0xe2d6ed[_0x1c9f('0x4b')];_0x1f9791++){_0xe2d6ed[_0x1f9791][_0x1c9f('0x118')]('channel',_0x1c9f('0x11f'));}return _0xe2d6ed;}));_0x3b7a06[_0x1c9f('0x48')](_0x1e0039[_0x1c9f('0x120')]()['then'](function(_0x1676e7){for(var _0x20fef0=0x0;_0x20fef0<_0x1676e7['length'];_0x20fef0++){_0x1676e7[_0x20fef0]['setDataValue'](_0x1c9f('0xaf'),_0x1c9f('0x121'));}return _0x1676e7;}));return BPromise['all'](_0x3b7a06);})['then'](function(_0x19ec4d){var _0x5e5f4b=_[_0x1c9f('0x122')](_0x19ec4d);_0x3b7a06=[];return db[_0x1c9f('0x6c')][_0x1c9f('0x123')](function(_0xa70e8a){for(var _0x41a1f2=0x0;_0x41a1f2<_0x5e5f4b[_0x1c9f('0x4b')];_0x41a1f2++){_0x3b7a06['push'](_0x5e5f4b[_0x41a1f2]['addAgent'](_0x46ad98['id']),{'transaction':_0xa70e8a});}return BPromise['all'](_0x3b7a06)['then'](function(){if(_0x46ad98['online']){return BPromise[_0x1c9f('0x8a')](_[_0x1c9f('0xcf')](_0x5e5f4b,function(_0x1a45b5){return _0x1a45b5[_0x1c9f('0x124')](_0x1c9f('0xaf'))==='Voice';}),function(_0x2742c7){return db[_0x1c9f('0xb6')][_0x1c9f('0xfb')]({'membername':_0x46ad98['name'],'UserId':_0x46ad98['id'],'queue_name':_0x2742c7[_0x1c9f('0x33')],'VoiceQueueId':_0x2742c7['id'],'interface':_[_0x1c9f('0x6a')](_0x46ad98[_0x1c9f('0xa1')])?util[_0x1c9f('0xac')](_0x1c9f('0xad'),_0x46ad98['name']):_0x46ad98['interface'],'paused':_0x46ad98[_0x1c9f('0xa0')]||![],'penalty':_0x46ad98[_0x1c9f('0xa7')]},{'transaction':_0xa70e8a});});}else{return;}})[_0x1c9f('0x26')](function(){for(var _0x26f1cd=0x0;_0x26f1cd<_0x5e5f4b[_0x1c9f('0x4b')];_0x26f1cd++){var _0x555109=_0x5e5f4b[_0x26f1cd][_0x1c9f('0x124')](_0x1c9f('0xaf'));var _0x583206=_0x555109+_0x1c9f('0xb5');socket[_0x1c9f('0xb3')](_0x1c9f('0x2c')+_0x555109+_0x1c9f('0xa9'),{'UserId':_0x46ad98['id'],['queueField']:_0x5e5f4b[_0x26f1cd]['id']});}});});})[_0x1c9f('0x26')](function(){db[_0x1c9f('0x125')][_0x1c9f('0x96')]({'where':{'teamId':_0x134a45['id']}})[_0x1c9f('0x26')](function(_0x4c8847){if(_0x4c8847){db[_0x1c9f('0x126')][_0x1c9f('0x7f')]({'UserId':_0x5ca033[_0x1c9f('0x54')]['id'],'VoicePrefixId':_0x4c8847[_0x1c9f('0x127')]});}});});}});}})[_0x1c9f('0x26')](respondWithStatusCode(_0x44b032,null))[_0x1c9f('0x1c')](handleError(_0x44b032,null));};exports[_0x1c9f('0x128')]=function(_0x1d8d44,_0x360b31){return db[_0x1c9f('0x39')][_0x1c9f('0x96')]({'where':{'id':_0x1d8d44['params']['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x360b31,null))[_0x1c9f('0x26')](function(_0x30b63f){if(_0x30b63f){var _0x30a57f=_0x30b63f[_0x1c9f('0x28')]({'plain':!![]});var _0x20106a=_0x1d8d44[_0x1c9f('0x41')][_0x1c9f('0x63')];return _0x30b63f[_0x1c9f('0x128')](_0x20106a)['then'](function(){for(var _0x184310=0x0;_0x184310<_0x20106a[_0x1c9f('0x4b')];_0x184310++){var _0x303973=[];var _0x4a849e={};db[_0x1c9f('0x115')][_0x1c9f('0x96')]({'where':{'id':_0x20106a[_0x184310]}})[_0x1c9f('0x26')](function(_0x5c0c7c){_0x4a849e=_0x5c0c7c['dataValues'];_0x303973[_0x1c9f('0x48')](_0x5c0c7c[_0x1c9f('0xfa')]()[_0x1c9f('0x26')](function(_0x36cb62){for(var _0x59e847=0x0;_0x59e847<_0x36cb62[_0x1c9f('0x4b')];_0x59e847++){_0x36cb62[_0x59e847]['setDataValue'](_0x1c9f('0xaf'),_0x1c9f('0x119'));}return _0x36cb62;}));_0x303973[_0x1c9f('0x48')](_0x5c0c7c[_0x1c9f('0x129')]()[_0x1c9f('0x26')](function(_0xe13f09){for(var _0x143872=0x0;_0x143872<_0xe13f09['length'];_0x143872++){_0xe13f09[_0x143872]['setDataValue']('channel',_0x1c9f('0x12a'));}return _0xe13f09;}));_0x303973['push'](_0x5c0c7c['getMailQueues']()[_0x1c9f('0x26')](function(_0xa678b4){for(var _0x56c2ff=0x0;_0x56c2ff<_0xa678b4[_0x1c9f('0x4b')];_0x56c2ff++){_0xa678b4[_0x56c2ff][_0x1c9f('0x118')](_0x1c9f('0xaf'),'Mail');}return _0xa678b4;}));_0x303973[_0x1c9f('0x48')](_0x5c0c7c[_0x1c9f('0x11b')]()[_0x1c9f('0x26')](function(_0x35f58f){for(var _0x57e1ff=0x0;_0x57e1ff<_0x35f58f[_0x1c9f('0x4b')];_0x57e1ff++){_0x35f58f[_0x57e1ff][_0x1c9f('0x118')]('channel',_0x1c9f('0x12b'));}return _0x35f58f;}));_0x303973[_0x1c9f('0x48')](_0x5c0c7c['getWhatsappQueues']()[_0x1c9f('0x26')](function(_0x37fdf9){for(var _0x488fc9=0x0;_0x488fc9<_0x37fdf9[_0x1c9f('0x4b')];_0x488fc9++){_0x37fdf9[_0x488fc9]['setDataValue'](_0x1c9f('0xaf'),_0x1c9f('0x11d'));}return _0x37fdf9;}));_0x303973[_0x1c9f('0x48')](_0x5c0c7c[_0x1c9f('0x11e')]()['then'](function(_0x5c2c57){for(var _0x3a64c1=0x0;_0x3a64c1<_0x5c2c57['length'];_0x3a64c1++){_0x5c2c57[_0x3a64c1][_0x1c9f('0x118')](_0x1c9f('0xaf'),_0x1c9f('0x11f'));}return _0x5c2c57;}));_0x303973['push'](_0x5c0c7c[_0x1c9f('0x120')]()[_0x1c9f('0x26')](function(_0x55d570){for(var _0x291cad=0x0;_0x291cad<_0x55d570[_0x1c9f('0x4b')];_0x291cad++){_0x55d570[_0x291cad][_0x1c9f('0x118')]('channel',_0x1c9f('0x121'));}return _0x55d570;}));return BPromise[_0x1c9f('0x52')](_0x303973);})['then'](function(_0x173da4){var _0x15e7b3=_[_0x1c9f('0x122')](_0x173da4);_0x303973=[];return db['sequelize'][_0x1c9f('0x123')](function(_0x262dc9){for(var _0x427e02=0x0;_0x427e02<_0x15e7b3[_0x1c9f('0x4b')];_0x427e02++){_0x303973['push'](_0x15e7b3[_0x427e02][_0x1c9f('0x12c')](_0x30a57f['id']),{'transaction':_0x262dc9});}return BPromise[_0x1c9f('0x52')](_0x303973)['then'](function(){if(_0x30a57f[_0x1c9f('0x9e')]){return BPromise[_0x1c9f('0x8a')](_[_0x1c9f('0xcf')](_0x15e7b3,function(_0xd384ec){return _0xd384ec[_0x1c9f('0x124')](_0x1c9f('0xaf'))==='Voice';}),function(_0x1e4754){return db['UserVoiceQueueRt'][_0x1c9f('0x27')]({'where':{'VoiceQueueId':_0x1e4754['id'],'UserId':_0x30a57f['id']},'transaction':_0x262dc9});});}else{return;}})[_0x1c9f('0x26')](function(){db[_0x1c9f('0x125')][_0x1c9f('0x96')]({'where':{'teamId':_0x4a849e['id']}})['then'](function(_0x4186c3){if(_0x4186c3){return db[_0x1c9f('0x126')]['destroy']({'where':{'UserId':_0x30a57f['id'],'VoicePrefixId':_0x4186c3[_0x1c9f('0x4d')][_0x1c9f('0x127')]}});}});})[_0x1c9f('0x26')](function(){for(var _0x2a4ce0=0x0;_0x2a4ce0<_0x15e7b3[_0x1c9f('0x4b')];_0x2a4ce0++){var _0x10a01d=_0x15e7b3[_0x2a4ce0][_0x1c9f('0x124')](_0x1c9f('0xaf'));var _0x500c29=_0x10a01d+_0x1c9f('0xb5');socket[_0x1c9f('0xb3')]('user'+_0x10a01d+_0x1c9f('0xb4'),{'UserId':_0x30a57f['id'],['queueField']:_0x15e7b3[_0x2a4ce0]['id']});}});});});}});}})[_0x1c9f('0x26')](respondWithStatusCode(_0x360b31,null))[_0x1c9f('0x1c')](handleError(_0x360b31,null));};exports[_0x1c9f('0x12d')]=function(_0x4fe45b,_0x2c7732){var _0x41c8e3={};var _0x5d0c56={};var _0x3da4b6;var _0x25f5a2;return db['User'][_0x1c9f('0x96')]({'where':{'id':_0x4fe45b['params']['id']}})['then'](handleEntityNotFound(_0x2c7732,null))[_0x1c9f('0x26')](function(_0x441a1b){if(_0x441a1b){_0x3da4b6=_0x441a1b;_0x5d0c56[_0x1c9f('0x55')]=_[_0x1c9f('0x57')](db[_0x1c9f('0xd1')][_0x1c9f('0x3a')]);_0x5d0c56[_0x1c9f('0x41')]=_[_0x1c9f('0x57')](_0x4fe45b['query']);_0x5d0c56[_0x1c9f('0x59')]=_[_0x1c9f('0x5a')](_0x5d0c56[_0x1c9f('0x55')],_0x5d0c56['query']);_0x41c8e3[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x5d0c56[_0x1c9f('0x55')],qs[_0x1c9f('0x5b')](_0x4fe45b[_0x1c9f('0x41')]['fields']));_0x41c8e3[_0x1c9f('0x47')]=_0x41c8e3[_0x1c9f('0x47')]['length']?_0x41c8e3['attributes']:_0x5d0c56[_0x1c9f('0x55')];_0x41c8e3[_0x1c9f('0xda')]=qs[_0x1c9f('0xcd')](_0x4fe45b[_0x1c9f('0x41')]['sort']);_0x41c8e3[_0x1c9f('0x40')]=qs[_0x1c9f('0x59')](_[_0x1c9f('0xce')](_0x4fe45b[_0x1c9f('0x41')],_0x5d0c56[_0x1c9f('0x59')]));if(_0x4fe45b[_0x1c9f('0x41')][_0x1c9f('0xcf')]){_0x41c8e3[_0x1c9f('0x40')]=_['merge'](_0x41c8e3[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x41c8e3['attributes'],function(_0x396221){var _0x1173e1={};_0x1173e1[_0x396221]={'$like':'%'+_0x4fe45b[_0x1c9f('0x41')]['filter']+'%'};return _0x1173e1;})});}_0x41c8e3=_[_0x1c9f('0x5c')]({},_0x41c8e3,_0x4fe45b[_0x1c9f('0x5d')]);return _0x3da4b6[_0x1c9f('0x12d')](_0x41c8e3);}})[_0x1c9f('0x26')](function(_0x58c786){if(_0x58c786){_0x25f5a2=_0x58c786[_0x1c9f('0x4b')];if(!_0x4fe45b[_0x1c9f('0x41')][_0x1c9f('0xd0')]('nolimit')){_0x41c8e3['limit']=qs[_0x1c9f('0x20')](_0x4fe45b['query'][_0x1c9f('0x20')]);_0x41c8e3[_0x1c9f('0x22')]=qs[_0x1c9f('0x22')](_0x4fe45b[_0x1c9f('0x41')][_0x1c9f('0x22')]);}return _0x3da4b6[_0x1c9f('0x12d')](_0x41c8e3);}})[_0x1c9f('0x26')](function(_0xd90e0e){if(_0xd90e0e){return _0xd90e0e?{'count':_0x25f5a2,'rows':_0xd90e0e}:null;}})[_0x1c9f('0x26')](respondWithResult(_0x2c7732,null))['catch'](handleError(_0x2c7732,null));};exports[_0x1c9f('0x12e')]=function(_0x4c6af7,_0x4b3a70){var _0x52a502={};var _0x38e90e={};var _0x594b5a;return db[_0x1c9f('0x39')][_0x1c9f('0x96')]({'where':{'id':_0x4c6af7[_0x1c9f('0x54')]['id']}})[_0x1c9f('0x26')](handleEntityNotFound(_0x4b3a70,null))[_0x1c9f('0x26')](function(_0x413c6a){if(_0x413c6a){_0x594b5a=_0x413c6a;_0x38e90e['model']=_[_0x1c9f('0x57')](db[_0x1c9f('0x39')][_0x1c9f('0x3a')]);_0x38e90e[_0x1c9f('0x41')]=_['keys'](_0x4c6af7[_0x1c9f('0x41')]);_0x38e90e['filters']=_['intersection'](_0x38e90e[_0x1c9f('0x55')],_0x38e90e[_0x1c9f('0x41')]);_0x52a502[_0x1c9f('0x47')]=_[_0x1c9f('0x5a')](_0x38e90e[_0x1c9f('0x55')],qs[_0x1c9f('0x5b')](_0x4c6af7[_0x1c9f('0x41')][_0x1c9f('0x5b')]));_0x52a502[_0x1c9f('0x47')]=_0x52a502[_0x1c9f('0x47')][_0x1c9f('0x4b')]?_0x52a502[_0x1c9f('0x47')]:_0x38e90e[_0x1c9f('0x55')];_0x52a502['order']=qs[_0x1c9f('0xcd')](_0x4c6af7[_0x1c9f('0x41')][_0x1c9f('0xcd')]);_0x52a502[_0x1c9f('0x40')]=qs[_0x1c9f('0x59')](_[_0x1c9f('0xce')](_0x4c6af7['query'],_0x38e90e[_0x1c9f('0x59')]));if(_0x4c6af7['query'][_0x1c9f('0xcf')]){_0x52a502[_0x1c9f('0x40')]=_['merge'](_0x52a502[_0x1c9f('0x40')],{'$or':_[_0x1c9f('0x8c')](_0x52a502['attributes'],function(_0xe81dfe){var _0x3eafb7={};_0x3eafb7[_0xe81dfe]={'$like':'%'+_0x4c6af7['query'][_0x1c9f('0xcf')]+'%'};return _0x3eafb7;})});}_0x52a502[_0x1c9f('0x55')]=db[_0x1c9f('0x39')];_0x52a502['as']=_0x1c9f('0x2d');_0x52a502=_['merge']({},_0x52a502,_0x4c6af7[_0x1c9f('0x5d')]);return _0x594b5a[_0x1c9f('0xfa')]({'include':[_0x52a502]});}})[_0x1c9f('0x26')](function(_0x19a23b){if(_0x19a23b){var _0x29bd16={},_0x573e39=[];for(var _0x4dcad4=0x0;_0x4dcad4<_0x19a23b[_0x1c9f('0x4b')];_0x4dcad4+=0x1){for(var _0x51ddd9=0x0,_0x327f9c;_0x51ddd9<_0x19a23b[_0x4dcad4]['Agents'][_0x1c9f('0x4b')];_0x51ddd9+=0x1){_0x327f9c=_0x19a23b[_0x4dcad4]['Agents'][_0x51ddd9][_0x1c9f('0x28')]({'plain':!![]});_0x29bd16[_0x327f9c['id']]=_0x327f9c;}}_0x29bd16=_[_0x1c9f('0x12f')](_0x29bd16);for(var _0x346377=qs[_0x1c9f('0x22')](_0x4c6af7[_0x1c9f('0x41')][_0x1c9f('0x22')]);_0x346377<_0x29bd16[_0x1c9f('0x4b')]&&_0x573e39[_0x1c9f('0x4b')]=_0x278f35[_0x173d('0x4d')]){throw new Error(_0x173d('0x4e'));}})[_0x173d('0x23')](function(){if(_0x2fd51b){return db[_0x173d('0x2b')]['destroy']({'where':{'membername':_0x2fd51b[_0x173d('0x35')]},'individualHooks':!![]});}})[_0x173d('0x23')](function(){if(_0x2fd51b){return _0x2fd51b[_0x173d('0x4f')]({'raw':!![]});}})['then'](function(_0x2e54b6){if(_0x2fd51b){if(_0x2e54b6){var _0xb214db=[];_0x466f6e=_0x2e54b6;if(_0x466f6e[_0x173d('0x2e')]){for(var _0x497c9b=0x0;_0x497c9b<_0x466f6e['length'];_0x497c9b++){_0xb214db[_0x173d('0x45')](db['UserVoiceQueueRt'][_0x173d('0x50')]({'membername':_0x2fd51b[_0x173d('0x35')],'UserId':_0x2fd51b['id'],'queue_name':_0x466f6e[_0x497c9b][_0x173d('0x35')],'VoiceQueueId':_0x466f6e[_0x497c9b]['id'],'interface':_0x5e57bf,'paused':_0x2fd51b['loginInPause']||![],'penalty':_0x466f6e[_0x497c9b][_0x173d('0x51')]||0x0}));}return BPromise['all'](_0xb214db);}}}})[_0x173d('0x23')](function(){if(_0x2fd51b){return db['MemberReport'][_0x173d('0x1d')]({'where':{'membername':_0x2fd51b[_0x173d('0x35')],'exitAt':null}});}})[_0x173d('0x23')](function(_0x44bddb){if(_0x2fd51b){if(_0x44bddb&&_0x44bddb[_0x173d('0x2e')]){var _0x32ee6a=[];_0x44bddb[_0x173d('0x47')](function(_0x75b52e){_0x32ee6a[_0x173d('0x45')](_0x75b52e[_0x173d('0x3a')]({'exitAt':moment()['format'](_0x173d('0x30'))}));});return BPromise[_0x173d('0x46')](_0x32ee6a);}}})[_0x173d('0x23')](function(_0x12a750){if(_0x2fd51b){var _0x336873=[];var _0x53108d=[];var _0x4e3758=utils[_0x173d('0x32')]();var _0xaf6192={'membername':_0x2fd51b[_0x173d('0x35')],'interface':_0x5e57bf,'enterAt':moment()[_0x173d('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2fd51b[_0x173d('0x28')],'internal':_0x2fd51b[_0x173d('0x29')]};_0x4e3758[_0x173d('0x47')](function(_0x12fc79){_0x336873[_0x173d('0x45')](_[_0x173d('0x52')]({'channel':_0x12fc79,'type':_0x173d('0x53'),'data1':_0x173d('0x54'),'data2':_0x5e57bf},_0xaf6192));if(_0x2fd51b[_0x173d('0x49')]){_0x53108d[_0x173d('0x45')](_[_0x173d('0x52')]({'channel':_0x12fc79,'type':_0x173d('0x2d'),'data1':_0x173d('0x55')},_0xaf6192));}});return db[_0x173d('0x2c')][_0x173d('0x56')](_0x336873[_0x173d('0x57')](_0x53108d),{'individualHooks':!![]});}})[_0x173d('0x23')](function(){if(_0x2fd51b){return _0x2fd51b[_0x173d('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x173d('0x2f')](_0x173d('0x30')),'voicePause':_0x2fd51b['loginInPause']||![],'mailPause':_0x2fd51b[_0x173d('0x49')]||![],'chatPause':_0x2fd51b[_0x173d('0x49')]||![],'faxPause':_0x2fd51b[_0x173d('0x49')]||![],'smsPause':_0x2fd51b[_0x173d('0x49')]||![],'openchannelPause':_0x2fd51b[_0x173d('0x49')]||![],'pauseType':_0x2fd51b['loginInPause']?_0x173d('0x55'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x5e57bf});}})['then'](function(_0x571c41){_0x4c8ffd(_0x571c41);})[_0x173d('0x1a')](function(_0x111f46){_0x19b8cc(_0x161db1[_0x173d('0x17')](0x1f4,_0x111f46[_0x173d('0x18')]));});});}; \ No newline at end of file +var _0x9fcf=['stringify','User','find','ShowUser','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','findOne','channel','isValidChannel','voice','system','mail','fax','sms','openchannel','whatsapp','PAUSE','set','%s%s','Pause','forEach','push','all','LogoutUser','destroy','loginInPause','count','agent','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','LOGIN','callysquare','merge','LOGININPAUSE','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetUser','options','raw','where','attributes','map','include','model','then'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9fcf,0xe9));var _0xf9fc=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x9fcf[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xf9fc('0x0'));var util=require(_0xf9fc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf9fc('0x2'));var fs=require('fs');var Redis=require(_0xf9fc('0x3'));var db=require(_0xf9fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9fc('0x5'))(_0xf9fc('0x6'));var config=require(_0xf9fc('0x7'));var jayson=require(_0xf9fc('0x8'));var client=jayson['client'][_0xf9fc('0x9')]({'port':0x232a});config[_0xf9fc('0xa')]=_[_0xf9fc('0xb')](config[_0xf9fc('0xa')],{'host':_0xf9fc('0xc'),'port':0x18eb});var socket=require(_0xf9fc('0xd'))(new Redis(config[_0xf9fc('0xa')]));require(_0xf9fc('0xe'))[_0xf9fc('0xf')](socket);function respondWithRpcPromise(_0x56397c,_0x32a7cc,_0x4174c1){return new BPromise(function(_0xd0244a,_0x13c66b){return client['request'](_0x56397c,_0x4174c1)['then'](function(_0x1c1f63){logger['info'](_0xf9fc('0x10'),_0x32a7cc,_0xf9fc('0x11'));logger[_0xf9fc('0x12')](_0xf9fc('0x13'),_0x32a7cc,_0xf9fc('0x11'),JSON['stringify'](_0x1c1f63));if(_0x1c1f63[_0xf9fc('0x14')]){if(_0x1c1f63[_0xf9fc('0x14')]['code']===0x1f4){logger[_0xf9fc('0x14')](_0xf9fc('0x10'),_0x32a7cc,_0x1c1f63[_0xf9fc('0x14')][_0xf9fc('0x15')]);return _0x13c66b(_0x1c1f63[_0xf9fc('0x14')][_0xf9fc('0x15')]);}logger[_0xf9fc('0x14')](_0xf9fc('0x10'),_0x32a7cc,_0x1c1f63['error'][_0xf9fc('0x15')]);return _0xd0244a(_0x1c1f63['error']['message']);}else{logger[_0xf9fc('0x16')](_0xf9fc('0x10'),_0x32a7cc,_0xf9fc('0x11'));_0xd0244a(_0x1c1f63[_0xf9fc('0x17')]['message']);}})[_0xf9fc('0x18')](function(_0x21dc13){logger[_0xf9fc('0x14')](_0xf9fc('0x10'),_0x32a7cc,_0x21dc13);_0x13c66b(_0x21dc13);});});}exports[_0xf9fc('0x19')]=function(_0x24ea8a){var _0x100f16=this;return new Promise(function(_0x330348,_0x506a71){return db['User']['findAll']({'raw':_0x24ea8a[_0xf9fc('0x1a')]?_0x24ea8a[_0xf9fc('0x1a')][_0xf9fc('0x1b')]===undefined?!![]:![]:!![],'where':_0x24ea8a['options']?_0x24ea8a[_0xf9fc('0x1a')][_0xf9fc('0x1c')]||null:null,'attributes':_0x24ea8a[_0xf9fc('0x1a')]?_0x24ea8a[_0xf9fc('0x1a')][_0xf9fc('0x1d')]||null:null,'limit':_0x24ea8a[_0xf9fc('0x1a')]?_0x24ea8a[_0xf9fc('0x1a')]['limit']||null:null,'include':_0x24ea8a['options']?_0x24ea8a[_0xf9fc('0x1a')]['include']?_[_0xf9fc('0x1e')](_0x24ea8a[_0xf9fc('0x1a')][_0xf9fc('0x1f')],function(_0x3d13fa){return{'model':db[_0x3d13fa[_0xf9fc('0x20')]],'as':_0x3d13fa['as'],'attributes':_0x3d13fa['attributes'],'include':_0x3d13fa['include']?_[_0xf9fc('0x1e')](_0x3d13fa[_0xf9fc('0x1f')],function(_0x3b705b){return{'model':db[_0x3b705b[_0xf9fc('0x20')]],'as':_0x3b705b['as'],'attributes':_0x3b705b[_0xf9fc('0x1d')],'include':_0x3b705b[_0xf9fc('0x1f')]?_[_0xf9fc('0x1e')](_0x3b705b[_0xf9fc('0x1f')],function(_0x42274e){return{'model':db[_0x42274e['model']],'as':_0x42274e['as'],'attributes':_0x42274e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9fc('0x21')](function(_0x22badd){logger[_0xf9fc('0x16')](_0xf9fc('0x19'),_0x24ea8a);logger[_0xf9fc('0x12')](_0xf9fc('0x19'),_0x24ea8a,JSON[_0xf9fc('0x22')](_0x22badd));_0x330348(_0x22badd);})[_0xf9fc('0x18')](function(_0x52c93e){logger[_0xf9fc('0x14')](_0xf9fc('0x19'),_0x52c93e[_0xf9fc('0x15')],_0x24ea8a);_0x506a71(_0x100f16['error'](0x1f4,_0x52c93e[_0xf9fc('0x15')]));});});};exports['ShowUser']=function(_0x1bc166){var _0x3ee729=this;return new Promise(function(_0x304ebb,_0x146139){return db[_0xf9fc('0x23')][_0xf9fc('0x24')]({'raw':_0x1bc166[_0xf9fc('0x1a')]?_0x1bc166['options']['raw']===undefined?!![]:![]:!![],'where':_0x1bc166[_0xf9fc('0x1a')]?_0x1bc166[_0xf9fc('0x1a')][_0xf9fc('0x1c')]||null:null,'attributes':_0x1bc166[_0xf9fc('0x1a')]?_0x1bc166[_0xf9fc('0x1a')]['attributes']||null:null,'include':_0x1bc166['options']?_0x1bc166[_0xf9fc('0x1a')][_0xf9fc('0x1f')]?_['map'](_0x1bc166[_0xf9fc('0x1a')][_0xf9fc('0x1f')],function(_0x5bad3f){return{'model':db[_0x5bad3f[_0xf9fc('0x20')]],'as':_0x5bad3f['as'],'attributes':_0x5bad3f['attributes'],'include':_0x5bad3f['include']?_['map'](_0x5bad3f['include'],function(_0x4756b7){return{'model':db[_0x4756b7[_0xf9fc('0x20')]],'as':_0x4756b7['as'],'attributes':_0x4756b7['attributes'],'include':_0x4756b7[_0xf9fc('0x1f')]?_[_0xf9fc('0x1e')](_0x4756b7[_0xf9fc('0x1f')],function(_0x207dd7){return{'model':db[_0x207dd7[_0xf9fc('0x20')]],'as':_0x207dd7['as'],'attributes':_0x207dd7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9fc('0x21')](function(_0x204473){logger['info']('ShowUser',_0x1bc166);logger['debug'](_0xf9fc('0x25'),_0x1bc166,JSON[_0xf9fc('0x22')](_0x204473));_0x304ebb(_0x204473);})[_0xf9fc('0x18')](function(_0x379e90){logger['error'](_0xf9fc('0x25'),_0x379e90[_0xf9fc('0x15')],_0x1bc166);_0x146139(_0x3ee729['error'](0x1f4,_0x379e90['message']));});});};exports[_0xf9fc('0x26')]=function(_0x35cd77){var _0x438b3c=this;return new Promise(function(_0x3d688f,_0x50d071){var _0x46ebd3;return db[_0xf9fc('0x23')][_0xf9fc('0x24')]({'where':_0x35cd77[_0xf9fc('0x1a')]['where']||{},'attributes':['id',_0xf9fc('0x27'),_0xf9fc('0x28'),_0xf9fc('0x29'),_0xf9fc('0x2a')]})[_0xf9fc('0x21')](function(_0x533b42){if(_0x533b42){_0x46ebd3=_0x533b42;return db[_0xf9fc('0x2b')][_0xf9fc('0x2c')]({'paused':0x1},{'where':{'UserId':_0x46ebd3['id']},'individualHooks':!![]});}})['then'](function(){if(_0x46ebd3){return db[_0xf9fc('0x2d')][_0xf9fc('0x2e')]({'where':{'membername':_0x46ebd3['name'],'type':'PAUSE','exitAt':null}});}})[_0xf9fc('0x21')](function(_0x43e2a0){if(_0x46ebd3){if(_0x43e2a0&&_0x43e2a0[_0xf9fc('0x2f')]){var _0x55f6a1=moment()[_0xf9fc('0x30')](_0xf9fc('0x31'));for(var _0x560446=0x0,_0x5a569f=_0x43e2a0[_0xf9fc('0x2f')];_0x560446<_0x5a569f;_0x560446++){_0x43e2a0[_0x560446]['updateAttributes']({'exitAt':_0x55f6a1});}}}})['then'](function(){if(_0x46ebd3){var _0x4e88ba=[];var _0x541500=utils['getChannels']();_0x541500['forEach'](function(_0x160284){_0x4e88ba['push']({'channel':_0x160284,'membername':_0x46ebd3[_0xf9fc('0x27')],'interface':_[_0xf9fc('0x32')](_0x46ebd3[_0xf9fc('0x2a')])?util[_0xf9fc('0x30')](_0xf9fc('0x33'),_0x46ebd3[_0xf9fc('0x27')]):_0x46ebd3[_0xf9fc('0x2a')],'type':'PAUSE','enterAt':moment()[_0xf9fc('0x30')](_0xf9fc('0x31')),'data1':_0x35cd77[_0xf9fc('0x34')]['type']||_0xf9fc('0x35'),'role':_0x46ebd3[_0xf9fc('0x28')],'internal':_0x46ebd3[_0xf9fc('0x29')],'uniqueid':_0x35cd77[_0xf9fc('0x34')][_0xf9fc('0x36')]||null});});return db[_0xf9fc('0x2d')][_0xf9fc('0x37')](_0x4e88ba,{'individualHooks':!![]});}})[_0xf9fc('0x21')](function(){if(_0x46ebd3){return _0x46ebd3[_0xf9fc('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x35cd77[_0xf9fc('0x34')][_0xf9fc('0x38')]||_0xf9fc('0x35'),'lastPauseAt':moment()['format'](_0xf9fc('0x31'))});}})[_0xf9fc('0x21')](function(_0x16c0ab){_0x3d688f(_0x16c0ab);})['catch'](function(_0x51ae6f){_0x50d071(_0x438b3c['error'](0x1f4,_0x51ae6f[_0xf9fc('0x15')]));});});};exports['UnpauseUser']=function(_0x5bec74){var _0x597ba5=this;return new Promise(function(_0xaca88a,_0x50acbe){var _0x27218c;return db['User'][_0xf9fc('0x39')]({'where':_0x5bec74[_0xf9fc('0x1a')][_0xf9fc('0x1c')]||{},'attributes':['id',_0xf9fc('0x27')]})[_0xf9fc('0x21')](function(_0x29fdf9){if(_0x29fdf9){_0x27218c=_0x29fdf9;if(_0x5bec74[_0xf9fc('0x34')][_0xf9fc('0x3a')]&&!utils[_0xf9fc('0x3b')](_0x5bec74['body'][_0xf9fc('0x3a')])){throw new Error('Unknown\x20channel');}switch(_0x5bec74[_0xf9fc('0x34')]['channel']){case _0xf9fc('0x3c'):return db['UserVoiceQueueRt'][_0xf9fc('0x2c')]({'paused':0x0},{'where':{'UserId':_0x27218c['id']}})['then'](function(){return db[_0xf9fc('0x2d')][_0xf9fc('0x24')]({'where':{'channel':_0x5bec74[_0xf9fc('0x34')]['channel'],'membername':_0x27218c[_0xf9fc('0x27')],'type':'PAUSE','exitAt':null}});})[_0xf9fc('0x21')](function(_0x50edf5){if(_0x50edf5){return _0x50edf5['update']({'exitAt':moment()[_0xf9fc('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xf9fc('0x3d')},{'individualHooks':!![]});}return null;})[_0xf9fc('0x21')](function(){return _0x27218c[_0xf9fc('0x2c')]({'voicePause':![]});});case _0xf9fc('0x3e'):case'chat':case _0xf9fc('0x3f'):case _0xf9fc('0x40'):case _0xf9fc('0x41'):case _0xf9fc('0x42'):return db[_0xf9fc('0x2d')]['find']({'where':{'channel':_0x5bec74['body'][_0xf9fc('0x3a')],'membername':_0x27218c['name'],'type':_0xf9fc('0x43'),'exitAt':null}})[_0xf9fc('0x21')](function(_0x64f671){return _0x64f671['update']({'exitAt':moment()[_0xf9fc('0x30')](_0xf9fc('0x31')),'data2':'system'},{'individualHooks':!![]});})[_0xf9fc('0x21')](function(){var _0x421c54={};_[_0xf9fc('0x44')](_0x421c54,util[_0xf9fc('0x30')](_0xf9fc('0x45'),_0x5bec74[_0xf9fc('0x34')][_0xf9fc('0x3a')],_0xf9fc('0x46')),![]);return _0x27218c[_0xf9fc('0x2c')](_0x421c54);});default:return db[_0xf9fc('0x2b')][_0xf9fc('0x2c')]({'paused':0x0},{'where':{'UserId':_0x27218c['id']}})[_0xf9fc('0x21')](function(){return db[_0xf9fc('0x2d')][_0xf9fc('0x2e')]({'where':{'membername':_0x27218c[_0xf9fc('0x27')],'type':_0xf9fc('0x43'),'exitAt':null}});})[_0xf9fc('0x21')](function(_0x4b0696){var _0x185f88=[];_0x4b0696[_0xf9fc('0x47')](function(_0x4d2ce3){_0x185f88[_0xf9fc('0x48')](_0x4d2ce3['update']({'exitAt':moment()[_0xf9fc('0x30')](_0xf9fc('0x31')),'data2':_0xf9fc('0x3d')}));});return BPromise[_0xf9fc('0x49')](_0x185f88);})['then'](function(){return _0x27218c['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xf9fc('0x21')](function(_0x22bcb1){_0xaca88a(_0x22bcb1);})[_0xf9fc('0x18')](function(_0x4c1a1c){_0x50acbe(_0x597ba5[_0xf9fc('0x14')](0x1f4,_0x4c1a1c[_0xf9fc('0x15')]));});});};exports[_0xf9fc('0x4a')]=function(_0x48e96d){var _0xa07cbc=this;return new Promise(function(_0x1e0021,_0x5d5f98){var _0x43fa26;return db[_0xf9fc('0x23')][_0xf9fc('0x39')]({'where':_0x48e96d[_0xf9fc('0x1a')]['where']||{},'attributes':['id',_0xf9fc('0x27')]})[_0xf9fc('0x21')](function(_0x372193){if(_0x372193){_0x43fa26=_0x372193;return db[_0xf9fc('0x2b')][_0xf9fc('0x4b')]({'where':{'membername':_0x43fa26[_0xf9fc('0x27')]},'individualHooks':!![]});}})[_0xf9fc('0x21')](function(){if(_0x43fa26){return db[_0xf9fc('0x2d')][_0xf9fc('0x2e')]({'where':{'membername':_0x43fa26[_0xf9fc('0x27')],'exitAt':null}});}})['then'](function(_0x4b1a9b){if(_0x43fa26){if(_0x4b1a9b&&_0x4b1a9b[_0xf9fc('0x2f')]){var _0x5e2c0c=[];_0x4b1a9b[_0xf9fc('0x47')](function(_0x310225){_0x5e2c0c[_0xf9fc('0x48')](_0x310225['update']({'exitAt':moment()[_0xf9fc('0x30')](_0xf9fc('0x31'))}));});return BPromise['all'](_0x5e2c0c);}}})['then'](function(){if(_0x43fa26){return _0x43fa26['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x48b7f5){_0x1e0021(_0x48b7f5);})[_0xf9fc('0x18')](function(_0xfa626c){_0x5d5f98(_0xa07cbc[_0xf9fc('0x14')](0x1f4,_0xfa626c[_0xf9fc('0x15')]));});});};exports['LoginUser']=function(_0x73297){var _0x20b88=this;return new Promise(function(_0x1cdd5a,_0x4ac259){var _0x58e9f2;var _0x3b5675;var _0x45e474;var _0x25d910;return db[_0xf9fc('0x23')][_0xf9fc('0x39')]({'where':_0x73297[_0xf9fc('0x1a')]['where']||{},'attributes':['id',_0xf9fc('0x27'),_0xf9fc('0x28'),'mobile','phone','internal',_0xf9fc('0x4c'),_0xf9fc('0x2a')]})[_0xf9fc('0x21')](function(_0x449293){if(_0x449293){_0x58e9f2=_0x449293;_0x25d910=_0x73297[_0xf9fc('0x34')]['interface']?_0x73297[_0xf9fc('0x34')][_0xf9fc('0x2a')]:util['format'](_0xf9fc('0x33'),_0x58e9f2[_0xf9fc('0x27')]);return db[_0xf9fc('0x23')][_0xf9fc('0x4d')]({'where':{'role':_0xf9fc('0x4e'),'online':!![],'id':{'$ne':_0x58e9f2['id']}}});}})['then'](function(_0xa54f3a){if(_0xa54f3a){_0x45e474=_0xa54f3a;return require('../../config/license/util')[_0xf9fc('0x4f')]();}})[_0xf9fc('0x21')](function(_0x185897){if(_0x185897&&_0x185897['agents']&&_0x45e474>=_0x185897[_0xf9fc('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x58e9f2){return db[_0xf9fc('0x2b')]['destroy']({'where':{'membername':_0x58e9f2[_0xf9fc('0x27')]},'individualHooks':!![]});}})[_0xf9fc('0x21')](function(){if(_0x58e9f2){return _0x58e9f2[_0xf9fc('0x51')]({'raw':!![]});}})[_0xf9fc('0x21')](function(_0x287204){if(_0x58e9f2){if(_0x287204){var _0x342a3e=[];_0x3b5675=_0x287204;if(_0x3b5675[_0xf9fc('0x2f')]){for(var _0x3a4272=0x0;_0x3a4272<_0x3b5675[_0xf9fc('0x2f')];_0x3a4272++){_0x342a3e['push'](db['UserVoiceQueueRt'][_0xf9fc('0x52')]({'membername':_0x58e9f2[_0xf9fc('0x27')],'UserId':_0x58e9f2['id'],'queue_name':_0x3b5675[_0x3a4272][_0xf9fc('0x27')],'VoiceQueueId':_0x3b5675[_0x3a4272]['id'],'interface':_0x25d910,'paused':_0x58e9f2[_0xf9fc('0x4c')]||![],'penalty':_0x3b5675[_0x3a4272][_0xf9fc('0x53')]||0x0}));}return BPromise[_0xf9fc('0x49')](_0x342a3e);}}}})[_0xf9fc('0x21')](function(){if(_0x58e9f2){return db[_0xf9fc('0x2d')][_0xf9fc('0x2e')]({'where':{'membername':_0x58e9f2[_0xf9fc('0x27')],'exitAt':null}});}})[_0xf9fc('0x21')](function(_0x5872f2){if(_0x58e9f2){if(_0x5872f2&&_0x5872f2['length']){var _0x101d78=[];_0x5872f2[_0xf9fc('0x47')](function(_0x1acba8){_0x101d78[_0xf9fc('0x48')](_0x1acba8['update']({'exitAt':moment()[_0xf9fc('0x30')](_0xf9fc('0x31'))}));});return BPromise['all'](_0x101d78);}}})[_0xf9fc('0x21')](function(_0x14e625){if(_0x58e9f2){var _0x191bfe=[];var _0x3e3ff0=[];var _0x2ac1ff=utils[_0xf9fc('0x54')]();var _0x197a2e={'membername':_0x58e9f2['name'],'interface':_0x25d910,'enterAt':moment()[_0xf9fc('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x58e9f2[_0xf9fc('0x28')],'internal':_0x58e9f2[_0xf9fc('0x29')]};_0x2ac1ff[_0xf9fc('0x47')](function(_0x217758){_0x191bfe[_0xf9fc('0x48')](_['merge']({'channel':_0x217758,'type':_0xf9fc('0x55'),'data1':_0xf9fc('0x56'),'data2':_0x25d910},_0x197a2e));if(_0x58e9f2[_0xf9fc('0x4c')]){_0x3e3ff0[_0xf9fc('0x48')](_[_0xf9fc('0x57')]({'channel':_0x217758,'type':_0xf9fc('0x43'),'data1':_0xf9fc('0x58')},_0x197a2e));}});return db[_0xf9fc('0x2d')][_0xf9fc('0x37')](_0x191bfe['concat'](_0x3e3ff0),{'individualHooks':!![]});}})[_0xf9fc('0x21')](function(){if(_0x58e9f2){return _0x58e9f2[_0xf9fc('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xf9fc('0x30')](_0xf9fc('0x31')),'voicePause':_0x58e9f2[_0xf9fc('0x4c')]||![],'mailPause':_0x58e9f2['loginInPause']||![],'chatPause':_0x58e9f2[_0xf9fc('0x4c')]||![],'faxPause':_0x58e9f2[_0xf9fc('0x4c')]||![],'smsPause':_0x58e9f2[_0xf9fc('0x4c')]||![],'openchannelPause':_0x58e9f2[_0xf9fc('0x4c')]||![],'pauseType':_0x58e9f2[_0xf9fc('0x4c')]?_0xf9fc('0x58'):null,'lastPauseAt':moment()[_0xf9fc('0x30')](_0xf9fc('0x31')),'interface':_0x25d910});}})[_0xf9fc('0x21')](function(_0x2ba3f8){_0x1cdd5a(_0x2ba3f8);})[_0xf9fc('0x18')](function(_0x3c5082){_0x4ac259(_0x20b88[_0xf9fc('0x14')](0x1f4,_0x3c5082[_0xf9fc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e02fcb8..2fc7ca6 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 _0x3ef1=['./user.events','save','remove','update','emit','removeListener','register','length','user:'];(function(_0x30d4be,_0xfde357){var _0x3fcd9b=function(_0x186b77){while(--_0x186b77){_0x30d4be['push'](_0x30d4be['shift']());}};_0x3fcd9b(++_0xfde357);}(_0x3ef1,0x10e));var _0x13ef=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3ef1[_0x1694f5];return _0x5b4321;};'use strict';var UserEvents=require(_0x13ef('0x0'));var events=[_0x13ef('0x1'),_0x13ef('0x2'),_0x13ef('0x3')];function createListener(_0x3f27bf,_0x1c234d){return function(_0x6b0658){_0x1c234d[_0x13ef('0x4')](_0x3f27bf,_0x6b0658);};}function removeListener(_0x3fd86a,_0x5d8841){return function(){UserEvents[_0x13ef('0x5')](_0x3fd86a,_0x5d8841);};}exports[_0x13ef('0x6')]=function(_0x4b855d){for(var _0x1ab600=0x0,_0x473a29=events[_0x13ef('0x7')];_0x1ab600<_0x473a29;_0x1ab600++){var _0xba45aa=events[_0x1ab600];var _0x268792=createListener(_0x13ef('0x8')+_0xba45aa,_0x4b855d);UserEvents['on'](_0xba45aa,_0x268792);}}; \ No newline at end of file +var _0x7325=['removeListener','register','length','save','remove'];(function(_0x178c2c,_0x1f1665){var _0x278a06=function(_0xeca6d8){while(--_0xeca6d8){_0x178c2c['push'](_0x178c2c['shift']());}};_0x278a06(++_0x1f1665);}(_0x7325,0x67));var _0x5732=function(_0x424e9c,_0x349762){_0x424e9c=_0x424e9c-0x0;var _0x107d75=_0x7325[_0x424e9c];return _0x107d75;};'use strict';var UserEvents=require('./user.events');var events=[_0x5732('0x0'),_0x5732('0x1'),'update'];function createListener(_0x49d122,_0x1a53c1){return function(_0x147ffc){_0x1a53c1['emit'](_0x49d122,_0x147ffc);};}function removeListener(_0x43bf6a,_0x57d710){return function(){UserEvents[_0x5732('0x2')](_0x43bf6a,_0x57d710);};}exports[_0x5732('0x3')]=function(_0x1c511d){for(var _0x1e2243=0x0,_0x63d78e=events[_0x5732('0x4')];_0x1e2243<_0x63d78e;_0x1e2243++){var _0x3a8b11=events[_0x1e2243];var _0x3898a4=createListener('user:'+_0x3a8b11,_0x1c511d);UserEvents['on'](_0x3a8b11,_0x3898a4);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6a04cbb..b65ec0c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x58adc2,_0x122a8e){var _0x16436e=function(_0xa61315){while(--_0xa61315){_0x58adc2['push'](_0x58adc2['shift']());}};_0x16436e(++_0x122a8e);}(_0x70e0,0x17b));var _0x070e=function(_0x27136c,_0x21bbc6){_0x27136c=_0x27136c-0x0;var _0x500912=_0x70e0[_0x27136c];return _0x500912;};'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(_0x12aa50,_0x4dd91b){var _0x26d55c=function(_0x5a3643){while(--_0x5a3643){_0x12aa50['push'](_0x12aa50['shift']());}};_0x26d55c(++_0x4dd91b);}(_0xe706,0xa3));var _0x6e70=function(_0x350ec3,_0x1dcb41){_0x350ec3=_0x350ec3-0x0;var _0x1eef31=_0xe706[_0x350ec3];return _0x1eef31;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ddf9827..9a10d05 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 _0x708c=['sequelize'];(function(_0x49a1fe,_0x826c8d){var _0x43d5e3=function(_0x322ec3){while(--_0x322ec3){_0x49a1fe['push'](_0x49a1fe['shift']());}};_0x43d5e3(++_0x826c8d);}(_0x708c,0x9b));var _0xc708=function(_0x572bf4,_0x265d57){_0x572bf4=_0x572bf4-0x0;var _0x3b1bf6=_0x708c[_0x572bf4];return _0x3b1bf6;};'use strict';var Sequelize=require(_0xc708('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf725=['sequelize','exports','INTEGER'];(function(_0x130a81,_0x358b64){var _0x2fab8b=function(_0x115ecc){while(--_0x115ecc){_0x130a81['push'](_0x130a81['shift']());}};_0x2fab8b(++_0x358b64);}(_0xf725,0x7e));var _0x5f72=function(_0x4dadd8,_0x75bd65){_0x4dadd8=_0x4dadd8-0x0;var _0x3327e6=_0xf725[_0x4dadd8];return _0x3327e6;};'use strict';var Sequelize=require(_0x5f72('0x0'));module[_0x5f72('0x1')]={'penalty':{'type':Sequelize[_0x5f72('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 20726a9..a3a4b2f 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 _0x0a2c=['UserChatQueue','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','define'];(function(_0x2a97de,_0x32f85b){var _0x2101e0=function(_0x22c519){while(--_0x22c519){_0x2a97de['push'](_0x2a97de['shift']());}};_0x2101e0(++_0x32f85b);}(_0x0a2c,0x97));var _0xc0a2=function(_0x1cf389,_0x36fb99){_0x1cf389=_0x1cf389-0x0;var _0x16be15=_0x0a2c[_0x1cf389];return _0x16be15;};'use strict';var _=require(_0xc0a2('0x0'));var util=require(_0xc0a2('0x1'));var logger=require(_0xc0a2('0x2'))('api');var moment=require(_0xc0a2('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0a2('0x4'));var fs=require('fs');var path=require(_0xc0a2('0x5'));var rimraf=require(_0xc0a2('0x6'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xc0a2('0x7')]=function(_0x401afb,_0x2dbcef){return _0x401afb[_0xc0a2('0x8')](_0xc0a2('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd916=['exports','UserChatQueue','user_has_chat_queues','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd916,0xff));var _0x6d91=function(_0x482b6f,_0x4019d4){_0x482b6f=_0x482b6f-0x0;var _0x249ffa=_0xd916[_0x482b6f];return _0x249ffa;};'use strict';var _=require('lodash');var util=require(_0x6d91('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6d91('0x1'));var BPromise=require('bluebird');var rp=require(_0x6d91('0x2'));var fs=require('fs');var path=require(_0x6d91('0x3'));var rimraf=require(_0x6d91('0x4'));var config=require(_0x6d91('0x5'));var attributes=require('./userChatQueue.attributes');module[_0x6d91('0x6')]=function(_0x1a1eb8,_0x5eec79){return _0x1a1eb8['define'](_0x6d91('0x7'),attributes,{'tableName':_0x6d91('0x8'),'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 0f9b242..10c8fcc 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 _0x8f05=['http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3d4827,_0x5ea52f){var _0x9f2d9d=function(_0x10381a){while(--_0x10381a){_0x3d4827['push'](_0x3d4827['shift']());}};_0x9f2d9d(++_0x5ea52f);}(_0x8f05,0x16d));var _0x58f0=function(_0xec7717,_0x1bc4dc){_0xec7717=_0xec7717-0x0;var _0x45810f=_0x8f05[_0xec7717];return _0x45810f;};'use strict';var _=require(_0x58f0('0x0'));var util=require('util');var moment=require(_0x58f0('0x1'));var BPromise=require('bluebird');var rs=require(_0x58f0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f0('0x3'))['db'];var utils=require(_0x58f0('0x4'));var logger=require(_0x58f0('0x5'))(_0x58f0('0x6'));var config=require(_0x58f0('0x7'));var jayson=require(_0x58f0('0x8'));var client=jayson['client'][_0x58f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b0e15,_0x5f43d3,_0x4ea151){return new BPromise(function(_0x4fa4f1,_0x307801){return client['request'](_0x1b0e15,_0x4ea151)[_0x58f0('0xa')](function(_0x26c09f){logger[_0x58f0('0xb')](_0x58f0('0xc'),_0x5f43d3,_0x58f0('0xd'));logger[_0x58f0('0xe')](_0x58f0('0xf'),_0x5f43d3,_0x58f0('0xd'),JSON[_0x58f0('0x10')](_0x26c09f));if(_0x26c09f[_0x58f0('0x11')]){if(_0x26c09f[_0x58f0('0x11')][_0x58f0('0x12')]===0x1f4){logger[_0x58f0('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x5f43d3,_0x26c09f['error']['message']);return _0x307801(_0x26c09f[_0x58f0('0x11')][_0x58f0('0x13')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5f43d3,_0x26c09f[_0x58f0('0x11')][_0x58f0('0x13')]);return _0x4fa4f1(_0x26c09f[_0x58f0('0x11')][_0x58f0('0x13')]);}else{logger['info'](_0x58f0('0xc'),_0x5f43d3,_0x58f0('0xd'));_0x4fa4f1(_0x26c09f[_0x58f0('0x14')][_0x58f0('0x13')]);}})[_0x58f0('0x15')](function(_0x867204){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5f43d3,_0x867204);_0x307801(_0x867204);});});} \ No newline at end of file +var _0x86fb=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserChatQueue,\x20%s,\x20%s'];(function(_0x598bed,_0x270c70){var _0xc5766f=function(_0x49ed35){while(--_0x49ed35){_0x598bed['push'](_0x598bed['shift']());}};_0xc5766f(++_0x270c70);}(_0x86fb,0x77));var _0xb86f=function(_0x27cc54,_0x37d1e8){_0x27cc54=_0x27cc54-0x0;var _0x190349=_0x86fb[_0x27cc54];return _0x190349;};'use strict';var _=require(_0xb86f('0x0'));var util=require('util');var moment=require(_0xb86f('0x1'));var BPromise=require(_0xb86f('0x2'));var rs=require(_0xb86f('0x3'));var fs=require('fs');var Redis=require(_0xb86f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb86f('0x5'));var logger=require(_0xb86f('0x6'))(_0xb86f('0x7'));var config=require(_0xb86f('0x8'));var jayson=require(_0xb86f('0x9'));var client=jayson['client'][_0xb86f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x595e5e,_0xce8607,_0x12fab5){return new BPromise(function(_0x3dfc1f,_0x306f79){return client['request'](_0x595e5e,_0x12fab5)[_0xb86f('0xb')](function(_0x124dd1){logger['info'](_0xb86f('0xc'),_0xce8607,'request\x20sent');logger[_0xb86f('0xd')](_0xb86f('0xe'),_0xce8607,'request\x20sent',JSON[_0xb86f('0xf')](_0x124dd1));if(_0x124dd1['error']){if(_0x124dd1[_0xb86f('0x10')][_0xb86f('0x11')]===0x1f4){logger[_0xb86f('0x10')](_0xb86f('0xc'),_0xce8607,_0x124dd1['error'][_0xb86f('0x12')]);return _0x306f79(_0x124dd1[_0xb86f('0x10')]['message']);}logger['error'](_0xb86f('0xc'),_0xce8607,_0x124dd1[_0xb86f('0x10')][_0xb86f('0x12')]);return _0x3dfc1f(_0x124dd1[_0xb86f('0x10')][_0xb86f('0x12')]);}else{logger['info'](_0xb86f('0xc'),_0xce8607,_0xb86f('0x13'));_0x3dfc1f(_0x124dd1[_0xb86f('0x14')][_0xb86f('0x12')]);}})[_0xb86f('0x15')](function(_0x1c3fd4){logger[_0xb86f('0x10')]('UserChatQueue,\x20%s,\x20%s',_0xce8607,_0x1c3fd4);_0x306f79(_0x1c3fd4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index bb86f72..832b534 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2d5dfe,_0x185f91){var _0x21534d=function(_0x181893){while(--_0x181893){_0x2d5dfe['push'](_0x2d5dfe['shift']());}};_0x21534d(++_0x185f91);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x40b66c,_0x578758){var _0x2fd22b=function(_0x3b721b){while(--_0x3b721b){_0x40b66c['push'](_0x40b66c['shift']());}};_0x2fd22b(++_0x578758);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index f5c4da2..530fdcb 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 _0x00af=['sequelize','exports','INTEGER'];(function(_0x25f503,_0x59dd25){var _0xef4862=function(_0x1c8c31){while(--_0x1c8c31){_0x25f503['push'](_0x25f503['shift']());}};_0xef4862(++_0x59dd25);}(_0x00af,0xf3));var _0xf00a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x00af[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xf00a('0x0'));module[_0xf00a('0x1')]={'penalty':{'type':Sequelize[_0xf00a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf00a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea0b=['INTEGER','STRING','sequelize','exports'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xea0b,0x9e));var _0xbea0=function(_0x53c707,_0x4f907f){_0x53c707=_0x53c707-0x0;var _0x7cd86=_0xea0b[_0x53c707];return _0x7cd86;};'use strict';var Sequelize=require(_0xbea0('0x0'));module[_0xbea0('0x1')]={'penalty':{'type':Sequelize[_0xbea0('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbea0('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbea0('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 076d7d5..41e5807 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 _0x6002=['exports','define','UserFaxQueue','lodash','api','bluebird','../../config/environment','./userFaxQueue.attributes'];(function(_0x9793b1,_0xbc3a68){var _0x400148=function(_0x42e6ca){while(--_0x42e6ca){_0x9793b1['push'](_0x9793b1['shift']());}};_0x400148(++_0xbc3a68);}(_0x6002,0x17b));var _0x2600=function(_0x5ef236,_0x4deae0){_0x5ef236=_0x5ef236-0x0;var _0x1d45dc=_0x6002[_0x5ef236];return _0x1d45dc;};'use strict';var _=require(_0x2600('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2600('0x1'));var moment=require('moment');var BPromise=require(_0x2600('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2600('0x3'));var attributes=require(_0x2600('0x4'));module[_0x2600('0x5')]=function(_0x502488,_0x14ef7e){return _0x502488[_0x2600('0x6')](_0x2600('0x7'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b89=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x0b89,0x1b5));var _0x90b8=function(_0x3ab694,_0x483922){_0x3ab694=_0x3ab694-0x0;var _0x4f7c0c=_0x0b89[_0x3ab694];return _0x4f7c0c;};'use strict';var _=require(_0x90b8('0x0'));var util=require(_0x90b8('0x1'));var logger=require(_0x90b8('0x2'))(_0x90b8('0x3'));var moment=require(_0x90b8('0x4'));var BPromise=require(_0x90b8('0x5'));var rp=require(_0x90b8('0x6'));var fs=require('fs');var path=require(_0x90b8('0x7'));var rimraf=require(_0x90b8('0x8'));var config=require(_0x90b8('0x9'));var attributes=require(_0x90b8('0xa'));module['exports']=function(_0x5ca9d0,_0x34e131){return _0x5ca9d0[_0x90b8('0xb')](_0x90b8('0xc'),attributes,{'tableName':_0x90b8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 1dd8ddc..7f4d3f2 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 _0x3bc6=['rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2c97e1,_0x7e6a2c){var _0x3e83c3=function(_0x423dbb){while(--_0x423dbb){_0x2c97e1['push'](_0x2c97e1['shift']());}};_0x3e83c3(++_0x7e6a2c);}(_0x3bc6,0xe8));var _0x63bc=function(_0x360b69,_0x136e85){_0x360b69=_0x360b69-0x0;var _0x322f4f=_0x3bc6[_0x360b69];return _0x322f4f;};'use strict';var _=require(_0x63bc('0x0'));var util=require(_0x63bc('0x1'));var moment=require('moment');var BPromise=require(_0x63bc('0x2'));var rs=require(_0x63bc('0x3'));var fs=require('fs');var Redis=require(_0x63bc('0x4'));var db=require(_0x63bc('0x5'))['db'];var utils=require(_0x63bc('0x6'));var logger=require(_0x63bc('0x7'))(_0x63bc('0x8'));var config=require(_0x63bc('0x9'));var jayson=require(_0x63bc('0xa'));var client=jayson[_0x63bc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3267a2,_0x319372,_0x435878){return new BPromise(function(_0x13c90f,_0xe8084a){return client[_0x63bc('0xc')](_0x3267a2,_0x435878)[_0x63bc('0xd')](function(_0x225c35){logger[_0x63bc('0xe')](_0x63bc('0xf'),_0x319372,'request\x20sent');logger[_0x63bc('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x319372,_0x63bc('0x11'),JSON[_0x63bc('0x12')](_0x225c35));if(_0x225c35['error']){if(_0x225c35[_0x63bc('0x13')][_0x63bc('0x14')]===0x1f4){logger[_0x63bc('0x13')](_0x63bc('0xf'),_0x319372,_0x225c35[_0x63bc('0x13')]['message']);return _0xe8084a(_0x225c35['error']['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x319372,_0x225c35[_0x63bc('0x13')][_0x63bc('0x15')]);return _0x13c90f(_0x225c35[_0x63bc('0x13')][_0x63bc('0x15')]);}else{logger[_0x63bc('0xe')](_0x63bc('0xf'),_0x319372,_0x63bc('0x11'));_0x13c90f(_0x225c35[_0x63bc('0x16')][_0x63bc('0x15')]);}})[_0x63bc('0x17')](function(_0x1d197d){logger['error'](_0x63bc('0xf'),_0x319372,_0x1d197d);_0xe8084a(_0x1d197d);});});} \ No newline at end of file +var _0x1a19=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2a8e84,_0x3084ae){var _0x11e05c=function(_0x771f5c){while(--_0x771f5c){_0x2a8e84['push'](_0x2a8e84['shift']());}};_0x11e05c(++_0x3084ae);}(_0x1a19,0x90));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x91a1('0x0'));var moment=require(_0x91a1('0x1'));var BPromise=require(_0x91a1('0x2'));var rs=require(_0x91a1('0x3'));var fs=require('fs');var Redis=require(_0x91a1('0x4'));var db=require(_0x91a1('0x5'))['db'];var utils=require(_0x91a1('0x6'));var logger=require(_0x91a1('0x7'))('rpc');var config=require(_0x91a1('0x8'));var jayson=require(_0x91a1('0x9'));var client=jayson[_0x91a1('0xa')][_0x91a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f801e,_0x2303ed,_0x2b8f33){return new BPromise(function(_0x5ab3fd,_0x32b490){return client[_0x91a1('0xc')](_0x2f801e,_0x2b8f33)[_0x91a1('0xd')](function(_0x23a884){logger[_0x91a1('0xe')](_0x91a1('0xf'),_0x2303ed,_0x91a1('0x10'));logger[_0x91a1('0x11')](_0x91a1('0x12'),_0x2303ed,_0x91a1('0x10'),JSON['stringify'](_0x23a884));if(_0x23a884['error']){if(_0x23a884[_0x91a1('0x13')][_0x91a1('0x14')]===0x1f4){logger['error'](_0x91a1('0xf'),_0x2303ed,_0x23a884[_0x91a1('0x13')][_0x91a1('0x15')]);return _0x32b490(_0x23a884['error'][_0x91a1('0x15')]);}logger[_0x91a1('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2303ed,_0x23a884[_0x91a1('0x13')]['message']);return _0x5ab3fd(_0x23a884[_0x91a1('0x13')][_0x91a1('0x15')]);}else{logger['info'](_0x91a1('0xf'),_0x2303ed,_0x91a1('0x10'));_0x5ab3fd(_0x23a884[_0x91a1('0x16')][_0x91a1('0x15')]);}})[_0x91a1('0x17')](function(_0xcbad3a){logger[_0x91a1('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2303ed,_0xcbad3a);_0x32b490(_0xcbad3a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6f4301d..5f64d61 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x425bd4,_0xe26761){var _0xd1993=function(_0x5b6836){while(--_0x5b6836){_0x425bd4['push'](_0x425bd4['shift']());}};_0xd1993(++_0xe26761);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x24b660,_0x37fe7c){var _0x338eaa=function(_0x512970){while(--_0x512970){_0x24b660['push'](_0x24b660['shift']());}};_0x338eaa(++_0x37fe7c);}(_0xe706,0xa3));var _0x6e70=function(_0x1d3046,_0x8b14e1){_0x1d3046=_0x1d3046-0x0;var _0x3b9b62=_0xe706[_0x1d3046];return _0x3b9b62;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index da47cba..9c9d3b6 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 _0x1ad9=['exports','sequelize'];(function(_0x455f87,_0x5c3a78){var _0x287124=function(_0x2a00f0){while(--_0x2a00f0){_0x455f87['push'](_0x455f87['shift']());}};_0x287124(++_0x5c3a78);}(_0x1ad9,0x69));var _0x91ad=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x1ad9[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x91ad('0x0'));module[_0x91ad('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd5af=['INTEGER','sequelize'];(function(_0x15ef99,_0x24457c){var _0x7e1818=function(_0x24c27e){while(--_0x24c27e){_0x15ef99['push'](_0x15ef99['shift']());}};_0x7e1818(++_0x24457c);}(_0xd5af,0x71));var _0xfd5a=function(_0x32bf96,_0x1e5a0d){_0x32bf96=_0x32bf96-0x0;var _0x1854e3=_0xd5af[_0x32bf96];return _0x1854e3;};'use strict';var Sequelize=require(_0xfd5a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xfd5a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 4836472..d40d8a6 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 _0xc6bc=['user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x5563d2,_0x40ec1a){var _0x276409=function(_0x247fe9){while(--_0x247fe9){_0x5563d2['push'](_0x5563d2['shift']());}};_0x276409(++_0x40ec1a);}(_0xc6bc,0x187));var _0xcc6b=function(_0x2da034,_0x333dd8){_0x2da034=_0x2da034-0x0;var _0x4019b6=_0xc6bc[_0x2da034];return _0x4019b6;};'use strict';var _=require(_0xcc6b('0x0'));var util=require(_0xcc6b('0x1'));var logger=require(_0xcc6b('0x2'))(_0xcc6b('0x3'));var moment=require(_0xcc6b('0x4'));var BPromise=require(_0xcc6b('0x5'));var rp=require(_0xcc6b('0x6'));var fs=require('fs');var path=require(_0xcc6b('0x7'));var rimraf=require(_0xcc6b('0x8'));var config=require(_0xcc6b('0x9'));var attributes=require(_0xcc6b('0xa'));module[_0xcc6b('0xb')]=function(_0x454312,_0xc82242){return _0x454312[_0xcc6b('0xc')](_0xcc6b('0xd'),attributes,{'tableName':_0xcc6b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21fa=['define','UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','request-promise','path','rimraf','./userMailQueue.attributes','exports'];(function(_0xc4f684,_0x4050f3){var _0x354481=function(_0x378246){while(--_0x378246){_0xc4f684['push'](_0xc4f684['shift']());}};_0x354481(++_0x4050f3);}(_0x21fa,0xea));var _0xa21f=function(_0xa55f65,_0x1b6a9a){_0xa55f65=_0xa55f65-0x0;var _0x4ff923=_0x21fa[_0xa55f65];return _0x4ff923;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa21f('0x0'))(_0xa21f('0x1'));var moment=require(_0xa21f('0x2'));var BPromise=require('bluebird');var rp=require(_0xa21f('0x3'));var fs=require('fs');var path=require(_0xa21f('0x4'));var rimraf=require(_0xa21f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa21f('0x6'));module[_0xa21f('0x7')]=function(_0x1bcd95,_0x1a5498){return _0x1bcd95[_0xa21f('0x8')](_0xa21f('0x9'),attributes,{'tableName':_0xa21f('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 a7f0f78..4e70f9b 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x008c,0x188));var _0xc008=function(_0x34bb68,_0x5b0079){_0x34bb68=_0x34bb68-0x0;var _0x3db9fb=_0x008c[_0x34bb68];return _0x3db9fb;};'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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x43de26,_0x260dfc){var _0x171d45=function(_0x341573){while(--_0x341573){_0x43de26['push'](_0x43de26['shift']());}};_0x171d45(++_0x260dfc);}(_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']('UserMailQueue,\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/userNotification/index.js b/server/api/userNotification/index.js index 5bb50ea..d0c1d27 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 _0x9a1f=['sendUserNotification','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated'];(function(_0xe70e5,_0x42cc8d){var _0x2a9926=function(_0x44537f){while(--_0x44537f){_0xe70e5['push'](_0xe70e5['shift']());}};_0x2a9926(++_0x42cc8d);}(_0x9a1f,0xc2));var _0xf9a1=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x9a1f[_0x37c22c];return _0x119d79;};'use strict';var multer=require(_0xf9a1('0x0'));var util=require(_0xf9a1('0x1'));var path=require('path');var timeout=require(_0xf9a1('0x2'));var express=require(_0xf9a1('0x3'));var router=express['Router']();var fs_extra=require(_0xf9a1('0x4'));var auth=require(_0xf9a1('0x5'));var interaction=require(_0xf9a1('0x6'));var config=require('../../config/environment');var controller=require(_0xf9a1('0x7'));router[_0xf9a1('0x8')]('/',auth[_0xf9a1('0x9')](),controller[_0xf9a1('0xa')]);module[_0xf9a1('0xb')]=router; \ No newline at end of file +var _0x5202=['isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post'];(function(_0x49aede,_0x3bc8e1){var _0x3de22d=function(_0xb15eed){while(--_0xb15eed){_0x49aede['push'](_0x49aede['shift']());}};_0x3de22d(++_0x3bc8e1);}(_0x5202,0x137));var _0x2520=function(_0x59d11b,_0x8e6ad7){_0x59d11b=_0x59d11b-0x0;var _0x261be4=_0x5202[_0x59d11b];return _0x261be4;};'use strict';var multer=require(_0x2520('0x0'));var util=require(_0x2520('0x1'));var path=require(_0x2520('0x2'));var timeout=require(_0x2520('0x3'));var express=require(_0x2520('0x4'));var router=express[_0x2520('0x5')]();var fs_extra=require(_0x2520('0x6'));var auth=require(_0x2520('0x7'));var interaction=require(_0x2520('0x8'));var config=require(_0x2520('0x9'));var controller=require('./userNotification.controller');router[_0x2520('0xa')]('/',auth[_0x2520('0xb')](),controller[_0x2520('0xc')]);module[_0x2520('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 6925b17..e87612d 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 _0xd583=['sequelize','exports','STRING','BOOLEAN'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd583,0x68));var _0x3d58=function(_0x9d1b9c,_0x28cb00){_0x9d1b9c=_0x9d1b9c-0x0;var _0x1b2bdd=_0xd583[_0x9d1b9c];return _0x1b2bdd;};'use strict';var Sequelize=require(_0x3d58('0x0'));module[_0x3d58('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x3d58('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x3d58('0x2')]},'beep':{'type':Sequelize[_0x3d58('0x3')]}}; \ No newline at end of file +var _0xea16=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0xea16,0x77));var _0x6ea1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xea16[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x6ea1('0x0'));module[_0x6ea1('0x1')]={'body':{'type':Sequelize[_0x6ea1('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x6ea1('0x2')]},'recipientsDescription':{'type':Sequelize[_0x6ea1('0x3')]},'beep':{'type':Sequelize[_0x6ea1('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5dd8dd8..3678ae5 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 _0x216c=['util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name','send','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','transaction','UserNotification','recipient','emit','userNotification:send','catch','findOne','html','render','forEach','startCase','User','ids','Queue','push','all','union','flatten','map','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x176683,_0x168eb1){var _0x41ab61=function(_0x30b18e){while(--_0x30b18e){_0x176683['push'](_0x176683['shift']());}};_0x41ab61(++_0x168eb1);}(_0x216c,0x16c));var _0xc216=function(_0x2ccdf5,_0x5b73f4){_0x2ccdf5=_0x2ccdf5-0x0;var _0x5e7609=_0x216c[_0x2ccdf5];return _0x5e7609;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc216('0x0'));var jsonpatch=require(_0xc216('0x1'));var rp=require(_0xc216('0x2'));var moment=require(_0xc216('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc216('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xc216('0x5'));var ejs=require(_0xc216('0x6'));var fs=require('fs');var fs_extra=require(_0xc216('0x7'));var _=require(_0xc216('0x8'));var squel=require('squel');var crypto=require(_0xc216('0x9'));var jsforce=require(_0xc216('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc216('0x5'));var querystring=require(_0xc216('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc216('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc216('0xd'));var logger=require('../../config/logger')(_0xc216('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc216('0xf'))['db'];config['redis']=_[_0xc216('0x10')](config['redis'],{'host':_0xc216('0x11'),'port':0x18eb});var socket=require(_0xc216('0x12'))(new Redis(config[_0xc216('0x13')]));require(_0xc216('0x14'))[_0xc216('0x15')](socket);function respondWithStatusCode(_0x5c663b,_0x14e11d){_0x14e11d=_0x14e11d||0xcc;return function(_0x472f79){if(_0x472f79){return _0x5c663b[_0xc216('0x16')](_0x14e11d);}return _0x5c663b[_0xc216('0x17')](_0x14e11d)[_0xc216('0x18')]();};}function respondWithResult(_0x571c60,_0x424d87){_0x424d87=_0x424d87||0xc8;return function(_0x421124){if(_0x421124){return _0x571c60[_0xc216('0x17')](_0x424d87)[_0xc216('0x19')](_0x421124);}};}function respondWithFilteredResult(_0x3c0f7,_0x312601){return function(_0x381fe2){if(_0x381fe2){var _0x5cf280=typeof _0x312601[_0xc216('0x1a')]===_0xc216('0x1b')&&typeof _0x312601[_0xc216('0x1c')]===_0xc216('0x1b');var _0xcd6f9f=_0x381fe2['count'];var _0x1e6d0e=_0x5cf280?0x0:_0x312601[_0xc216('0x1a')];var _0x400e69=_0x5cf280?_0x381fe2[_0xc216('0x1d')]:_0x312601[_0xc216('0x1a')]+_0x312601['limit'];var _0xcd1d57;if(_0x400e69>=_0xcd6f9f){_0x400e69=_0xcd6f9f;_0xcd1d57=0xc8;}else{_0xcd1d57=0xce;}_0x3c0f7[_0xc216('0x17')](_0xcd1d57);return _0x3c0f7[_0xc216('0x1e')](_0xc216('0x1f'),_0x1e6d0e+'-'+_0x400e69+'/'+_0xcd6f9f)[_0xc216('0x19')](_0x381fe2);}return null;};}function patchUpdates(_0x59dc2c){return function(_0xaef689){try{jsonpatch['apply'](_0xaef689,_0x59dc2c,!![]);}catch(_0x3d0794){return BPromise[_0xc216('0x20')](_0x3d0794);}return _0xaef689[_0xc216('0x21')]();};}function saveUpdates(_0x1f7f41,_0x581b11){return function(_0x6911ae){if(_0x6911ae){return _0x6911ae[_0xc216('0x22')](_0x1f7f41)[_0xc216('0x23')](function(_0x497281){return _0x497281;});}return null;};}function removeEntity(_0x2d5112,_0x50ee98){return function(_0x4c9da5){if(_0x4c9da5){return _0x4c9da5['destroy']()[_0xc216('0x23')](function(){_0x2d5112[_0xc216('0x17')](0xcc)[_0xc216('0x18')]();});}};}function handleEntityNotFound(_0x4a555f,_0x4a30c5){return function(_0xc6dc60){if(!_0xc6dc60){_0x4a555f[_0xc216('0x16')](0x194);}return _0xc6dc60;};}function handleError(_0x157444,_0x2bea96){_0x2bea96=_0x2bea96||0x1f4;return function(_0x5817fc){logger['error'](_0x5817fc[_0xc216('0x24')]);if(_0x5817fc['name']){delete _0x5817fc[_0xc216('0x25')];}_0x157444[_0xc216('0x17')](_0x2bea96)[_0xc216('0x26')](_0x5817fc);};}exports['sendUserNotification']=function(_0x4643c2,_0x384ad1,_0x258bbe){if(!_0x4643c2[_0xc216('0x27')][_0xc216('0x28')](_0xc216('0x29'))&&!_0x4643c2['body'][_0xc216('0x28')](_0xc216('0x2a'))){throw new db['Sequelize'][(_0xc216('0x2b'))](_0xc216('0x2c'));}else{if(_0x4643c2['body'][_0xc216('0x28')]('TemplateId')&&!_0x4643c2['body'][_0xc216('0x28')](_0xc216('0x2d'))){throw new db[(_0xc216('0x2e'))][(_0xc216('0x2b'))](_0xc216('0x2f'));}if(!_0x4643c2[_0xc216('0x27')][_0xc216('0x28')](_0xc216('0x30'))){throw new db['Sequelize'][(_0xc216('0x2b'))](_0xc216('0x31'));}else{try{var _0x244da8=JSON[_0xc216('0x32')](_0x4643c2[_0xc216('0x27')]['recipients']);}catch(_0x41d4f3){logger[_0xc216('0x33')](_0x41d4f3);throw new db[(_0xc216('0x2e'))][(_0xc216('0x2b'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x4e3027=[_0xc216('0x34'),_0xc216('0x35'),_0xc216('0x36'),_0xc216('0x37'),_0xc216('0x38'),_0xc216('0x39'),_0xc216('0x3a'),_0xc216('0x3b'),_0xc216('0x3c')];if(_[_0xc216('0x3d')](_0x244da8,function(_0x123d8b){return!_[_0xc216('0x3e')](_0x4e3027,_0x123d8b[_0xc216('0x3f')][_0xc216('0x40')]());})){throw new db[(_0xc216('0x2e'))][(_0xc216('0x2b'))](_0xc216('0x41'));}}}var _0x58fb30={};_0x58fb30[_0xc216('0x42')]=_0x4643c2['body'][_0xc216('0x28')](_0xc216('0x42'))?_0x4643c2[_0xc216('0x27')][_0xc216('0x42')]:_0x4643c2[_0xc216('0x3c')]['fullname'];_0x58fb30[_0xc216('0x43')]=_[_0xc216('0x44')](_0x4643c2['body'][_0xc216('0x43')])?null:_0x4643c2['body'][_0xc216('0x43')];_0x58fb30['beep']=_0x4643c2['body'][_0xc216('0x45')]||![];_0x58fb30[_0xc216('0x46')]=_0x4643c2[_0xc216('0x3c')]['id'];return getContent(_0x4643c2[_0xc216('0x27')])[_0xc216('0x23')](function(_0x2e422d){_0x58fb30[_0xc216('0x27')]=_0x2e422d;return getRecipients(_0x244da8);})[_0xc216('0x23')](function(_0x4a41b4){_0x58fb30[_0xc216('0x47')]=_['sortBy'](_0x4a41b4)[_0xc216('0x48')](',');return db['sequelize'][_0xc216('0x49')](function(_0x3da5fe){return db[_0xc216('0x4a')]['create'](_0x58fb30,{'raw':!![],'transaction':_0x3da5fe})[_0xc216('0x23')](function(_0x2f4437){var _0x34a050={'sender':_0x58fb30[_0xc216('0x42')],'description':_0x58fb30[_0xc216('0x43')],'content':_0x58fb30['body'],'beep':_0x58fb30['beep']};_0x4a41b4['forEach'](function(_0x5916ac){_0x34a050[_0xc216('0x4b')]=_0x5916ac;socket[_0xc216('0x4c')](_0xc216('0x4d'),_0x34a050);});return _0x2f4437;});});})['then'](respondWithResult(_0x384ad1,0xc9))[_0xc216('0x4e')](handleError(_0x384ad1,null));};function getContent(_0x3b2457){return new BPromise(function(_0xe8ddf0,_0x412e25){if(_0x3b2457[_0xc216('0x29')]){_0xe8ddf0(_0x3b2457[_0xc216('0x29')]);return;}return db['Template'][_0xc216('0x4f')]({'attributes':[_0xc216('0x50')],'where':{'id':_0x3b2457[_0xc216('0x2a')]},'raw':!![]})[_0xc216('0x23')](function(_0x82fc15){if(!_0x82fc15)throw new db[(_0xc216('0x2e'))][(_0xc216('0x2b'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2d69c9=Mustache[_0xc216('0x51')](_0x82fc15[_0xc216('0x50')],_0x3b2457[_0xc216('0x2d')]);_0xe8ddf0(_0x2d69c9);})[_0xc216('0x4e')](function(_0x3308e5){_0x412e25(_0x3308e5);});});}function getRecipients(_0x12eaa7){return new BPromise(function(_0x27530f,_0x4ae914){var _0x2942fb=[];var _0x5e5cb9=[];_0x12eaa7[_0xc216('0x52')](function(_0x56ad7b){var _0x170e85=_[_0xc216('0x53')](_0x56ad7b[_0xc216('0x3f')][_0xc216('0x40')]());if(_0x170e85===_0xc216('0x54')){_0x2942fb=_['union'](_0x2942fb,_0x56ad7b[_0xc216('0x55')]);}else{if(_[_0xc216('0x3e')](_0x170e85,'queue'))_0x170e85=_0x170e85['replace']('queue',_0xc216('0x56'));_0x56ad7b[_0xc216('0x55')][_0xc216('0x52')](function(_0x4ffcca){_0x5e5cb9[_0xc216('0x57')](getAgents(_0x170e85,_0x4ffcca));});}});return BPromise[_0xc216('0x58')](_0x5e5cb9)[_0xc216('0x23')](function(_0x39f746){_0x2942fb=_[_0xc216('0x59')](_0x2942fb,_[_0xc216('0x5a')](_0x39f746));_0x27530f(_0x2942fb);})['catch'](function(_0x558e07){_0x4ae914(_0x558e07);});});}function getAgents(_0x1bd6c9,_0x245644){return new BPromise(function(_0x2d54e3,_0x1fa6ee){return db[_0x1bd6c9][_0xc216('0x4f')]({'where':{'id':_0x245644}})['then'](function(_0x50ec8f){return _0x50ec8f['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x270e50){var _0x5d0292=_[_0xc216('0x5b')](_0x270e50,'id');_0x2d54e3(_0x5d0292);});})[_0xc216('0x4e')](function(_0x2437c0){_0x1fa6ee(_0x2437c0);});});} \ No newline at end of file +var _0x542f=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','ids','includes','replace','queue','Queue','push','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3cba80,_0x3024e7){var _0x11cb67=function(_0x56f8c8){while(--_0x56f8c8){_0x3cba80['push'](_0x3cba80['shift']());}};_0x11cb67(++_0x3024e7);}(_0x542f,0xcb));var _0xf542=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x542f[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require(_0xf542('0x0'));var rimraf=require(_0xf542('0x1'));var zipdir=require(_0xf542('0x2'));var jsonpatch=require(_0xf542('0x3'));var rp=require(_0xf542('0x4'));var moment=require(_0xf542('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf542('0x6'));var util=require(_0xf542('0x7'));var path=require(_0xf542('0x8'));var sox=require('sox');var csv=require(_0xf542('0x9'));var ejs=require(_0xf542('0xa'));var fs=require('fs');var fs_extra=require(_0xf542('0xb'));var _=require(_0xf542('0xc'));var squel=require(_0xf542('0xd'));var crypto=require(_0xf542('0xe'));var jsforce=require(_0xf542('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf542('0x9'));var querystring=require(_0xf542('0x10'));var Papa=require(_0xf542('0x11'));var Redis=require(_0xf542('0x12'));var authService=require(_0xf542('0x13'));var qs=require(_0xf542('0x14'));var as=require(_0xf542('0x15'));var hardwareService=require(_0xf542('0x16'));var logger=require('../../config/logger')(_0xf542('0x17'));var utils=require(_0xf542('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf542('0x19'));var db=require('../../mysqldb')['db'];config[_0xf542('0x1a')]=_[_0xf542('0x1b')](config[_0xf542('0x1a')],{'host':_0xf542('0x1c'),'port':0x18eb});var socket=require(_0xf542('0x1d'))(new Redis(config[_0xf542('0x1a')]));require(_0xf542('0x1e'))[_0xf542('0x1f')](socket);function respondWithStatusCode(_0x2802fa,_0x2809f2){_0x2809f2=_0x2809f2||0xcc;return function(_0x492ca0){if(_0x492ca0){return _0x2802fa[_0xf542('0x20')](_0x2809f2);}return _0x2802fa[_0xf542('0x21')](_0x2809f2)[_0xf542('0x22')]();};}function respondWithResult(_0x4e85d9,_0xc8dc44){_0xc8dc44=_0xc8dc44||0xc8;return function(_0x4e0635){if(_0x4e0635){return _0x4e85d9['status'](_0xc8dc44)['json'](_0x4e0635);}};}function respondWithFilteredResult(_0x13f520,_0x150bd5){return function(_0x18871d){if(_0x18871d){var _0x2bdec2=typeof _0x150bd5[_0xf542('0x23')]===_0xf542('0x24')&&typeof _0x150bd5[_0xf542('0x25')]===_0xf542('0x24');var _0x30c4ad=_0x18871d[_0xf542('0x26')];var _0x141e1e=_0x2bdec2?0x0:_0x150bd5[_0xf542('0x23')];var _0x22c257=_0x2bdec2?_0x18871d['count']:_0x150bd5[_0xf542('0x23')]+_0x150bd5[_0xf542('0x25')];var _0x33b1d0;if(_0x22c257>=_0x30c4ad){_0x22c257=_0x30c4ad;_0x33b1d0=0xc8;}else{_0x33b1d0=0xce;}_0x13f520[_0xf542('0x21')](_0x33b1d0);return _0x13f520['set']('Content-Range',_0x141e1e+'-'+_0x22c257+'/'+_0x30c4ad)[_0xf542('0x27')](_0x18871d);}return null;};}function patchUpdates(_0x2da639){return function(_0x5f3145){try{jsonpatch[_0xf542('0x28')](_0x5f3145,_0x2da639,!![]);}catch(_0x1b15e6){return BPromise[_0xf542('0x29')](_0x1b15e6);}return _0x5f3145[_0xf542('0x2a')]();};}function saveUpdates(_0x2a46e8,_0x29bdb2){return function(_0x2565cf){if(_0x2565cf){return _0x2565cf[_0xf542('0x2b')](_0x2a46e8)[_0xf542('0x2c')](function(_0x351d87){return _0x351d87;});}return null;};}function removeEntity(_0x93af14,_0x28c293){return function(_0x11ea54){if(_0x11ea54){return _0x11ea54[_0xf542('0x2d')]()[_0xf542('0x2c')](function(){_0x93af14[_0xf542('0x21')](0xcc)[_0xf542('0x22')]();});}};}function handleEntityNotFound(_0x3aaa4c,_0x1e136e){return function(_0x401aa4){if(!_0x401aa4){_0x3aaa4c[_0xf542('0x20')](0x194);}return _0x401aa4;};}function handleError(_0x22a569,_0x3fa4a4){_0x3fa4a4=_0x3fa4a4||0x1f4;return function(_0x3f527b){logger[_0xf542('0x2e')](_0x3f527b[_0xf542('0x2f')]);if(_0x3f527b[_0xf542('0x30')]){delete _0x3f527b[_0xf542('0x30')];}_0x22a569['status'](_0x3fa4a4)[_0xf542('0x31')](_0x3f527b);};}exports[_0xf542('0x32')]=function(_0x33cd35,_0x18f722,_0xdb50db){if(!_0x33cd35[_0xf542('0x33')][_0xf542('0x34')](_0xf542('0x35'))&&!_0x33cd35['body'][_0xf542('0x34')](_0xf542('0x36'))){throw new db[(_0xf542('0x37'))][(_0xf542('0x38'))](_0xf542('0x39'));}else{if(_0x33cd35[_0xf542('0x33')][_0xf542('0x34')](_0xf542('0x36'))&&!_0x33cd35['body'][_0xf542('0x34')](_0xf542('0x3a'))){throw new db['Sequelize'][(_0xf542('0x38'))](_0xf542('0x3b'));}if(!_0x33cd35[_0xf542('0x33')][_0xf542('0x34')]('recipients')){throw new db['Sequelize'][(_0xf542('0x38'))](_0xf542('0x3c'));}else{try{var _0x37bda5=JSON[_0xf542('0x3d')](_0x33cd35[_0xf542('0x33')]['recipients']);}catch(_0x255ff7){logger[_0xf542('0x2e')](_0x255ff7);throw new db[(_0xf542('0x37'))][(_0xf542('0x38'))](_0xf542('0x3e'));}var _0x4f2422=['chatqueue',_0xf542('0x3f'),'mailqueue','openchannelqueue',_0xf542('0x40'),_0xf542('0x41'),_0xf542('0x42'),_0xf542('0x43'),_0xf542('0x44')];if(_['some'](_0x37bda5,function(_0x3a32d0){return!_['includes'](_0x4f2422,_0x3a32d0[_0xf542('0x45')]['toLowerCase']());})){throw new db['Sequelize']['ValidationError'](_0xf542('0x46'));}}}var _0x170869={};_0x170869[_0xf542('0x47')]=_0x33cd35[_0xf542('0x33')][_0xf542('0x34')]('senderName')?_0x33cd35[_0xf542('0x33')][_0xf542('0x47')]:_0x33cd35[_0xf542('0x44')]['fullname'];_0x170869['recipientsDescription']=_[_0xf542('0x48')](_0x33cd35[_0xf542('0x33')][_0xf542('0x49')])?null:_0x33cd35[_0xf542('0x33')]['recipientsDescription'];_0x170869['beep']=_0x33cd35[_0xf542('0x33')][_0xf542('0x4a')]||![];_0x170869[_0xf542('0x4b')]=_0x33cd35[_0xf542('0x44')]['id'];return getContent(_0x33cd35[_0xf542('0x33')])['then'](function(_0x31a23c){_0x170869['body']=_0x31a23c;return getRecipients(_0x37bda5);})['then'](function(_0x17b53a){_0x170869[_0xf542('0x4c')]=_[_0xf542('0x4d')](_0x17b53a)[_0xf542('0x4e')](',');return db[_0xf542('0x4f')][_0xf542('0x50')](function(_0x23bad0){return db[_0xf542('0x51')][_0xf542('0x52')](_0x170869,{'raw':!![],'transaction':_0x23bad0})['then'](function(_0x576663){var _0x1a209a={'sender':_0x170869[_0xf542('0x47')],'description':_0x170869['recipientsDescription'],'content':_0x170869[_0xf542('0x33')],'beep':_0x170869['beep']};_0x17b53a[_0xf542('0x53')](function(_0x2a0dac){_0x1a209a[_0xf542('0x54')]=_0x2a0dac;socket[_0xf542('0x55')](_0xf542('0x56'),_0x1a209a);});return _0x576663;});});})[_0xf542('0x2c')](respondWithResult(_0x18f722,0xc9))['catch'](handleError(_0x18f722,null));};function getContent(_0xc9be6b){return new BPromise(function(_0xca736d,_0x100160){if(_0xc9be6b['text']){_0xca736d(_0xc9be6b['text']);return;}return db[_0xf542('0x57')][_0xf542('0x58')]({'attributes':[_0xf542('0x59')],'where':{'id':_0xc9be6b[_0xf542('0x36')]},'raw':!![]})[_0xf542('0x2c')](function(_0x46bb4b){if(!_0x46bb4b)throw new db['Sequelize'][(_0xf542('0x38'))](_0xf542('0x5a'));var _0x2dd29e=Mustache[_0xf542('0x5b')](_0x46bb4b['html'],_0xc9be6b[_0xf542('0x3a')]);_0xca736d(_0x2dd29e);})[_0xf542('0x5c')](function(_0x438461){_0x100160(_0x438461);});});}function getRecipients(_0x6dd9b9){return new BPromise(function(_0x49f4c7,_0x12e98d){var _0x25fad9=[];var _0x22e4e0=[];_0x6dd9b9[_0xf542('0x53')](function(_0xca9b32){var _0x5f1013=_[_0xf542('0x5d')](_0xca9b32['model']['toLowerCase']());if(_0x5f1013===_0xf542('0x5e')){_0x25fad9=_[_0xf542('0x5f')](_0x25fad9,_0xca9b32[_0xf542('0x60')]);}else{if(_[_0xf542('0x61')](_0x5f1013,'queue'))_0x5f1013=_0x5f1013[_0xf542('0x62')](_0xf542('0x63'),_0xf542('0x64'));_0xca9b32[_0xf542('0x60')][_0xf542('0x53')](function(_0x4c5cdc){_0x22e4e0[_0xf542('0x65')](getAgents(_0x5f1013,_0x4c5cdc));});}});return BPromise['all'](_0x22e4e0)[_0xf542('0x2c')](function(_0x555b96){_0x25fad9=_[_0xf542('0x5f')](_0x25fad9,_[_0xf542('0x66')](_0x555b96));_0x49f4c7(_0x25fad9);})[_0xf542('0x5c')](function(_0x1a28ae){_0x12e98d(_0x1a28ae);});});}function getAgents(_0x4eccfd,_0x131211){return new BPromise(function(_0x24ee55,_0x238e2d){return db[_0x4eccfd][_0xf542('0x58')]({'where':{'id':_0x131211}})[_0xf542('0x2c')](function(_0x50d621){return _0x50d621[_0xf542('0x67')]({'attributes':['id'],'raw':!![]})[_0xf542('0x2c')](function(_0x549636){var _0x100cf3=_[_0xf542('0x68')](_0x549636,'id');_0x24ee55(_0x100cf3);});})[_0xf542('0x5c')](function(_0x14716f){_0x238e2d(_0x14716f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 25e9b7e..2196257 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 _0x60ee=['../../mysqldb','UserNotification','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x235a9c,_0x559838){var _0x1e9163=function(_0x541a0a){while(--_0x541a0a){_0x235a9c['push'](_0x235a9c['shift']());}};_0x1e9163(++_0x559838);}(_0x60ee,0xd7));var _0xe60e=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x60ee[_0x5e238b];return _0x389bea;};'use strict';var EventEmitter=require(_0xe60e('0x0'));var UserNotification=require(_0xe60e('0x1'))['db'][_0xe60e('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xe60e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe60e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b20d1){return function(_0x17ad31,_0x4013cf,_0x5c6065){UserNotificationEvents['emit'](_0x3b20d1+':'+_0x17ad31['id'],_0x17ad31);UserNotificationEvents[_0xe60e('0x5')](_0x3b20d1,_0x17ad31);_0x5c6065(null);};}for(var e in events){if(events[_0xe60e('0x6')](e)){var event=events[e];UserNotification[_0xe60e('0x7')](e,emitEvent(event));}}module[_0xe60e('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x94ea=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x2e6b64,_0xccbf5e){var _0x41f346=function(_0x333e5b){while(--_0x333e5b){_0x2e6b64['push'](_0x2e6b64['shift']());}};_0x41f346(++_0xccbf5e);}(_0x94ea,0xac));var _0xa94e=function(_0x49e0e5,_0x1f1f6b){_0x49e0e5=_0x49e0e5-0x0;var _0x249c90=_0x94ea[_0x49e0e5];return _0x249c90;};'use strict';var EventEmitter=require(_0xa94e('0x0'));var UserNotification=require(_0xa94e('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa94e('0x2'),'afterUpdate':_0xa94e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x542f71){return function(_0x58a825,_0x2402ed,_0x32c242){UserNotificationEvents[_0xa94e('0x4')](_0x542f71+':'+_0x58a825['id'],_0x58a825);UserNotificationEvents[_0xa94e('0x4')](_0x542f71,_0x58a825);_0x32c242(null);};}for(var e in events){if(events[_0xa94e('0x5')](e)){var event=events[e];UserNotification[_0xa94e('0x6')](e,emitEvent(event));}}module[_0xa94e('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index bac9a7a..3e9f92e 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 _0xee1d=['utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x5eaafa,_0x179efc){var _0x2dcf62=function(_0x1f0661){while(--_0x1f0661){_0x5eaafa['push'](_0x5eaafa['shift']());}};_0x2dcf62(++_0x179efc);}(_0xee1d,0x146));var _0xdee1=function(_0x38555b,_0x2088f6){_0x38555b=_0x38555b-0x0;var _0x54803d=_0xee1d[_0x38555b];return _0x54803d;};'use strict';var _=require('lodash');var util=require(_0xdee1('0x0'));var logger=require(_0xdee1('0x1'))('api');var moment=require(_0xdee1('0x2'));var BPromise=require(_0xdee1('0x3'));var rp=require(_0xdee1('0x4'));var fs=require('fs');var path=require(_0xdee1('0x5'));var rimraf=require(_0xdee1('0x6'));var config=require(_0xdee1('0x7'));var attributes=require(_0xdee1('0x8'));module[_0xdee1('0x9')]=function(_0x10b862,_0x29435c){return _0x10b862[_0xdee1('0xa')](_0xdee1('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdee1('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdfba=['./userNotification.attributes','define','UserNotification','utf8mb4_unicode_ci','lodash','api','bluebird','path','rimraf','../../config/environment'];(function(_0x473738,_0x15ea31){var _0x1df4ae=function(_0x417a72){while(--_0x417a72){_0x473738['push'](_0x473738['shift']());}};_0x1df4ae(++_0x15ea31);}(_0xdfba,0xf4));var _0xadfb=function(_0x4a1022,_0x4435a6){_0x4a1022=_0x4a1022-0x0;var _0x562d12=_0xdfba[_0x4a1022];return _0x562d12;};'use strict';var _=require(_0xadfb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xadfb('0x1'));var moment=require('moment');var BPromise=require(_0xadfb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadfb('0x3'));var rimraf=require(_0xadfb('0x4'));var config=require(_0xadfb('0x5'));var attributes=require(_0xadfb('0x6'));module['exports']=function(_0xd7639c,_0x5d25ea){return _0xd7639c[_0xadfb('0x7')](_0xadfb('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xadfb('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index cd4aeb8..52c3ffc 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 _0xf205=['then','UserNotification,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x14376a,_0x543b9b){var _0xb05db5=function(_0x7f4bca){while(--_0x7f4bca){_0x14376a['push'](_0x14376a['shift']());}};_0xb05db5(++_0x543b9b);}(_0xf205,0x1dd));var _0x5f20=function(_0x1c6b57,_0xba0ce6){_0x1c6b57=_0x1c6b57-0x0;var _0x4acbb1=_0xf205[_0x1c6b57];return _0x4acbb1;};'use strict';var _=require(_0x5f20('0x0'));var util=require(_0x5f20('0x1'));var moment=require(_0x5f20('0x2'));var BPromise=require(_0x5f20('0x3'));var rs=require(_0x5f20('0x4'));var fs=require('fs');var Redis=require(_0x5f20('0x5'));var db=require(_0x5f20('0x6'))['db'];var utils=require(_0x5f20('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f20('0x8'));var jayson=require(_0x5f20('0x9'));var client=jayson['client'][_0x5f20('0xa')]({'port':0x232a});config[_0x5f20('0xb')]=_[_0x5f20('0xc')](config[_0x5f20('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f20('0xd'))(new Redis(config[_0x5f20('0xb')]));require(_0x5f20('0xe'))[_0x5f20('0xf')](socket);function respondWithRpcPromise(_0x347d26,_0x2730f6,_0xde7548){return new BPromise(function(_0xeb6ddd,_0x18b5ee){return client[_0x5f20('0x10')](_0x347d26,_0xde7548)[_0x5f20('0x11')](function(_0x3e653e){logger['info'](_0x5f20('0x12'),_0x2730f6,'request\x20sent');logger[_0x5f20('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x2730f6,_0x5f20('0x14'),JSON[_0x5f20('0x15')](_0x3e653e));if(_0x3e653e[_0x5f20('0x16')]){if(_0x3e653e[_0x5f20('0x16')]['code']===0x1f4){logger[_0x5f20('0x16')]('UserNotification,\x20%s,\x20%s',_0x2730f6,_0x3e653e[_0x5f20('0x16')]['message']);return _0x18b5ee(_0x3e653e[_0x5f20('0x16')][_0x5f20('0x17')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x2730f6,_0x3e653e[_0x5f20('0x16')]['message']);return _0xeb6ddd(_0x3e653e[_0x5f20('0x16')][_0x5f20('0x17')]);}else{logger[_0x5f20('0x18')](_0x5f20('0x12'),_0x2730f6,'request\x20sent');_0xeb6ddd(_0x3e653e[_0x5f20('0x19')]['message']);}})['catch'](function(_0x3b554a){logger[_0x5f20('0x16')]('UserNotification,\x20%s,\x20%s',_0x2730f6,_0x3b554a);_0x18b5ee(_0x3b554a);});});} \ No newline at end of file +var _0xc0c4=['redis','defaults','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0xfea09c,_0x25186e){var _0x225ff4=function(_0x366ead){while(--_0x366ead){_0xfea09c['push'](_0xfea09c['shift']());}};_0x225ff4(++_0x25186e);}(_0xc0c4,0x104));var _0x4c0c=function(_0x23d369,_0x347fea){_0x23d369=_0x23d369-0x0;var _0x134d6d=_0xc0c4[_0x23d369];return _0x134d6d;};'use strict';var _=require('lodash');var util=require(_0x4c0c('0x0'));var moment=require(_0x4c0c('0x1'));var BPromise=require(_0x4c0c('0x2'));var rs=require(_0x4c0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c0c('0x4'))['db'];var utils=require(_0x4c0c('0x5'));var logger=require(_0x4c0c('0x6'))(_0x4c0c('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c0c('0x8'));var client=jayson['client'][_0x4c0c('0x9')]({'port':0x232a});config[_0x4c0c('0xa')]=_[_0x4c0c('0xb')](config[_0x4c0c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4c0c('0xc'))(new Redis(config[_0x4c0c('0xa')]));require(_0x4c0c('0xd'))[_0x4c0c('0xe')](socket);function respondWithRpcPromise(_0x3d8ff4,_0x19e923,_0x3dadf3){return new BPromise(function(_0x47e2ac,_0x266cc1){return client[_0x4c0c('0xf')](_0x3d8ff4,_0x3dadf3)['then'](function(_0x90b025){logger[_0x4c0c('0x10')](_0x4c0c('0x11'),_0x19e923,_0x4c0c('0x12'));logger[_0x4c0c('0x13')](_0x4c0c('0x14'),_0x19e923,_0x4c0c('0x12'),JSON[_0x4c0c('0x15')](_0x90b025));if(_0x90b025[_0x4c0c('0x16')]){if(_0x90b025[_0x4c0c('0x16')][_0x4c0c('0x17')]===0x1f4){logger[_0x4c0c('0x16')]('UserNotification,\x20%s,\x20%s',_0x19e923,_0x90b025[_0x4c0c('0x16')][_0x4c0c('0x18')]);return _0x266cc1(_0x90b025[_0x4c0c('0x16')][_0x4c0c('0x18')]);}logger[_0x4c0c('0x16')](_0x4c0c('0x11'),_0x19e923,_0x90b025[_0x4c0c('0x16')][_0x4c0c('0x18')]);return _0x47e2ac(_0x90b025[_0x4c0c('0x16')][_0x4c0c('0x18')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x19e923,_0x4c0c('0x12'));_0x47e2ac(_0x90b025[_0x4c0c('0x19')][_0x4c0c('0x18')]);}})[_0x4c0c('0x1a')](function(_0xc36a1b){logger['error'](_0x4c0c('0x11'),_0x19e923,_0xc36a1b);_0x266cc1(_0xc36a1b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1fa0907..af88039 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 _0xf5b2=['register','length','userNotification:','save','remove','update','emit'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xf5b2,0x15a));var _0x2f5b=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0xf5b2[_0x37e886];return _0x57c5cd;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x2f5b('0x0'),_0x2f5b('0x1'),_0x2f5b('0x2')];function createListener(_0x52f346,_0x332654){return function(_0x2ef7df){_0x332654[_0x2f5b('0x3')](_0x52f346,_0x2ef7df);};}function removeListener(_0x4dbd3a,_0x4c5387){return function(){UserNotificationEvents['removeListener'](_0x4dbd3a,_0x4c5387);};}exports[_0x2f5b('0x4')]=function(_0x36b2b6){for(var _0x39ace4=0x0,_0x117db8=events[_0x2f5b('0x5')];_0x39ace4<_0x117db8;_0x39ace4++){var _0x27fb77=events[_0x39ace4];var _0x2530d4=createListener(_0x2f5b('0x6')+_0x27fb77,_0x36b2b6);UserNotificationEvents['on'](_0x27fb77,_0x2530d4);}}; \ No newline at end of file +var _0xf28d=['register','userNotification:','./userNotification.events','save','remove','emit','removeListener'];(function(_0x3af45a,_0x37454f){var _0xca1682=function(_0x1d95c1){while(--_0x1d95c1){_0x3af45a['push'](_0x3af45a['shift']());}};_0xca1682(++_0x37454f);}(_0xf28d,0x136));var _0xdf28=function(_0x3144c7,_0x11fa4a){_0x3144c7=_0x3144c7-0x0;var _0x7c263=_0xf28d[_0x3144c7];return _0x7c263;};'use strict';var UserNotificationEvents=require(_0xdf28('0x0'));var events=[_0xdf28('0x1'),_0xdf28('0x2'),'update'];function createListener(_0x13fe07,_0x395d51){return function(_0x32969e){_0x395d51[_0xdf28('0x3')](_0x13fe07,_0x32969e);};}function removeListener(_0x397e90,_0x2e13dc){return function(){UserNotificationEvents[_0xdf28('0x4')](_0x397e90,_0x2e13dc);};}exports[_0xdf28('0x5')]=function(_0x374bca){for(var _0x295ea3=0x0,_0x4413b9=events['length'];_0x295ea3<_0x4413b9;_0x295ea3++){var _0x2fe146=events[_0x295ea3];var _0xa09653=createListener(_0xdf28('0x6')+_0x2fe146,_0x374bca);UserNotificationEvents['on'](_0x2fe146,_0xa09653);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1c5cde4..92a2b71 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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(_0x2f6648,_0x44c706){var _0x186a93=function(_0x37732b){while(--_0x37732b){_0x2f6648['push'](_0x2f6648['shift']());}};_0x186a93(++_0x44c706);}(_0xe706,0xa3));var _0x6e70=function(_0x2902c2,_0x40150){_0x2902c2=_0x2902c2-0x0;var _0x16f4fb=_0xe706[_0x2902c2];return _0x16f4fb;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fccd82c..99b50da 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 _0x42eb=['exports','INTEGER','sequelize'];(function(_0x532a69,_0x1cd3f3){var _0x5def44=function(_0x581255){while(--_0x581255){_0x532a69['push'](_0x532a69['shift']());}};_0x5def44(++_0x1cd3f3);}(_0x42eb,0xf5));var _0xb42e=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x42eb[_0x2c7dc6];return _0x10002b;};'use strict';var Sequelize=require(_0xb42e('0x0'));module[_0xb42e('0x1')]={'penalty':{'type':Sequelize[_0xb42e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xad24=['sequelize','INTEGER'];(function(_0x372c65,_0x417421){var _0x5eea8a=function(_0x13d33b){while(--_0x13d33b){_0x372c65['push'](_0x372c65['shift']());}};_0x5eea8a(++_0x417421);}(_0xad24,0x1e6));var _0x4ad2=function(_0x5ab27f,_0x21a462){_0x5ab27f=_0x5ab27f-0x0;var _0x23826c=_0xad24[_0x5ab27f];return _0x23826c;};'use strict';var Sequelize=require(_0x4ad2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4ad2('0x1')],'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 85a3ab6..7c871f8 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 _0x37c7=['define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x25859f,_0x192f03){var _0x3fd3e4=function(_0x4249ac){while(--_0x4249ac){_0x25859f['push'](_0x25859f['shift']());}};_0x3fd3e4(++_0x192f03);}(_0x37c7,0xa1));var _0x737c=function(_0xbd2356,_0x441dc9){_0xbd2356=_0xbd2356-0x0;var _0xf0b100=_0x37c7[_0xbd2356];return _0xf0b100;};'use strict';var _=require('lodash');var util=require(_0x737c('0x0'));var logger=require(_0x737c('0x1'))('api');var moment=require(_0x737c('0x2'));var BPromise=require(_0x737c('0x3'));var rp=require(_0x737c('0x4'));var fs=require('fs');var path=require(_0x737c('0x5'));var rimraf=require(_0x737c('0x6'));var config=require('../../config/environment');var attributes=require(_0x737c('0x7'));module[_0x737c('0x8')]=function(_0x3c9b84,_0x2eb673){return _0x3c9b84[_0x737c('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66c0=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports'];(function(_0x55c455,_0x2ec309){var _0x161e3c=function(_0xc4ab43){while(--_0xc4ab43){_0x55c455['push'](_0x55c455['shift']());}};_0x161e3c(++_0x2ec309);}(_0x66c0,0x18e));var _0x066c=function(_0x32920a,_0x501815){_0x32920a=_0x32920a-0x0;var _0x120eca=_0x66c0[_0x32920a];return _0x120eca;};'use strict';var _=require(_0x066c('0x0'));var util=require(_0x066c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x066c('0x2'));var BPromise=require(_0x066c('0x3'));var rp=require(_0x066c('0x4'));var fs=require('fs');var path=require(_0x066c('0x5'));var rimraf=require(_0x066c('0x6'));var config=require('../../config/environment');var attributes=require(_0x066c('0x7'));module[_0x066c('0x8')]=function(_0x4127a4,_0x337293){return _0x4127a4['define'](_0x066c('0x9'),attributes,{'tableName':_0x066c('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 22a66b2..80e5fc4 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 _0x0d8f=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x2ae459,_0x1d0dbf){var _0xdc1320=function(_0x121138){while(--_0x121138){_0x2ae459['push'](_0x2ae459['shift']());}};_0xdc1320(++_0x1d0dbf);}(_0x0d8f,0xc0));var _0xf0d8=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x0d8f[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xf0d8('0x0'));var util=require(_0xf0d8('0x1'));var moment=require(_0xf0d8('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0d8('0x3'));var fs=require('fs');var Redis=require(_0xf0d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0d8('0x5'));var logger=require(_0xf0d8('0x6'))('rpc');var config=require(_0xf0d8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf0d8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e6bc7,_0x57427a,_0x26e648){return new BPromise(function(_0x594dff,_0x32e9aa){return client['request'](_0x5e6bc7,_0x26e648)[_0xf0d8('0x9')](function(_0x500ff9){logger[_0xf0d8('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x57427a,_0xf0d8('0xb'));logger[_0xf0d8('0xc')](_0xf0d8('0xd'),_0x57427a,_0xf0d8('0xb'),JSON[_0xf0d8('0xe')](_0x500ff9));if(_0x500ff9['error']){if(_0x500ff9[_0xf0d8('0xf')][_0xf0d8('0x10')]===0x1f4){logger[_0xf0d8('0xf')](_0xf0d8('0x11'),_0x57427a,_0x500ff9[_0xf0d8('0xf')][_0xf0d8('0x12')]);return _0x32e9aa(_0x500ff9[_0xf0d8('0xf')][_0xf0d8('0x12')]);}logger[_0xf0d8('0xf')](_0xf0d8('0x11'),_0x57427a,_0x500ff9[_0xf0d8('0xf')]['message']);return _0x594dff(_0x500ff9[_0xf0d8('0xf')][_0xf0d8('0x12')]);}else{logger[_0xf0d8('0xa')](_0xf0d8('0x11'),_0x57427a,'request\x20sent');_0x594dff(_0x500ff9[_0xf0d8('0x13')]['message']);}})[_0xf0d8('0x14')](function(_0x556780){logger[_0xf0d8('0xf')](_0xf0d8('0x11'),_0x57427a,_0x556780);_0x32e9aa(_0x556780);});});} \ No newline at end of file +var _0xa203=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xa203,0x181));var _0x3a20=function(_0x535b69,_0x4c4fdb){_0x535b69=_0x535b69-0x0;var _0x1c4848=_0xa203[_0x535b69];return _0x1c4848;};'use strict';var _=require(_0x3a20('0x0'));var util=require(_0x3a20('0x1'));var moment=require(_0x3a20('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a20('0x3'))['db'];var utils=require(_0x3a20('0x4'));var logger=require(_0x3a20('0x5'))(_0x3a20('0x6'));var config=require(_0x3a20('0x7'));var jayson=require(_0x3a20('0x8'));var client=jayson[_0x3a20('0x9')][_0x3a20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4382d7,_0x2aca84,_0x25c887){return new BPromise(function(_0x1abb4d,_0x36f577){return client['request'](_0x4382d7,_0x25c887)[_0x3a20('0xb')](function(_0x40844a){logger[_0x3a20('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2aca84,_0x3a20('0xd'));logger[_0x3a20('0xe')](_0x3a20('0xf'),_0x2aca84,_0x3a20('0xd'),JSON[_0x3a20('0x10')](_0x40844a));if(_0x40844a['error']){if(_0x40844a['error']['code']===0x1f4){logger[_0x3a20('0x11')](_0x3a20('0x12'),_0x2aca84,_0x40844a['error'][_0x3a20('0x13')]);return _0x36f577(_0x40844a[_0x3a20('0x11')][_0x3a20('0x13')]);}logger[_0x3a20('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2aca84,_0x40844a[_0x3a20('0x11')][_0x3a20('0x13')]);return _0x1abb4d(_0x40844a[_0x3a20('0x11')][_0x3a20('0x13')]);}else{logger[_0x3a20('0xc')](_0x3a20('0x12'),_0x2aca84,_0x3a20('0xd'));_0x1abb4d(_0x40844a['result'][_0x3a20('0x13')]);}})[_0x3a20('0x14')](function(_0x1aff3b){logger['error'](_0x3a20('0x12'),_0x2aca84,_0x1aff3b);_0x36f577(_0x1aff3b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d40f6d9..09da2e8 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 _0x3587=['update','delete','destroy','removeSections','removeResources','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','describe','/:id','show','/:id/sections','getSections','/:id/resources','create','post','/:id/clone','addResources'];(function(_0x5bb000,_0x2698f9){var _0xab95e9=function(_0x26dcbe){while(--_0x26dcbe){_0x5bb000['push'](_0x5bb000['shift']());}};_0xab95e9(++_0x2698f9);}(_0x3587,0x17d));var _0x7358=function(_0x16c3bb,_0x4058fa){_0x16c3bb=_0x16c3bb-0x0;var _0x57f470=_0x3587[_0x16c3bb];return _0x57f470;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7358('0x0'));var express=require('express');var router=express[_0x7358('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x7358('0x2'));var interaction=require(_0x7358('0x3'));var config=require(_0x7358('0x4'));var controller=require(_0x7358('0x5'));router['get']('/',auth[_0x7358('0x6')](),controller[_0x7358('0x7')]);router[_0x7358('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7358('0x9')]);router[_0x7358('0x8')](_0x7358('0xa'),auth[_0x7358('0x6')](),controller[_0x7358('0xb')]);router['get'](_0x7358('0xc'),auth['isAuthenticated'](),controller[_0x7358('0xd')]);router['get'](_0x7358('0xe'),auth[_0x7358('0x6')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0x7358('0xf')]);router[_0x7358('0x10')](_0x7358('0x11'),auth[_0x7358('0x6')](),controller['clone']);router[_0x7358('0x10')](_0x7358('0xc'),auth[_0x7358('0x6')](),controller['addSections']);router[_0x7358('0x10')](_0x7358('0xe'),auth['isAuthenticated'](),controller[_0x7358('0x12')]);router['put'](_0x7358('0xa'),auth[_0x7358('0x6')](),controller[_0x7358('0x13')]);router[_0x7358('0x14')](_0x7358('0xa'),auth['isAuthenticated'](),controller[_0x7358('0x15')]);router[_0x7358('0x14')](_0x7358('0xc'),auth[_0x7358('0x6')](),controller[_0x7358('0x16')]);router[_0x7358('0x14')](_0x7358('0xe'),auth[_0x7358('0x6')](),controller[_0x7358('0x17')]);module[_0x7358('0x18')]=router; \ No newline at end of file +var _0xd7ad=['clone','addSections','/:id/resources','put','/:id','update','delete','destroy','removeSections','removeResources','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id/sections','getSections','post','/:id/clone'];(function(_0x29d7ad,_0x46b5b3){var _0x509e52=function(_0x5cbc3c){while(--_0x5cbc3c){_0x29d7ad['push'](_0x29d7ad['shift']());}};_0x509e52(++_0x46b5b3);}(_0xd7ad,0x15c));var _0xdd7a=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xd7ad[_0x14fad0];return _0x5c665f;};'use strict';var multer=require(_0xdd7a('0x0'));var util=require(_0xdd7a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd7a('0x2'));var router=express[_0xdd7a('0x3')]();var fs_extra=require(_0xdd7a('0x4'));var auth=require(_0xdd7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdd7a('0x6'));var controller=require(_0xdd7a('0x7'));router[_0xdd7a('0x8')]('/',auth[_0xdd7a('0x9')](),controller['index']);router[_0xdd7a('0x8')](_0xdd7a('0xa'),auth['isAuthenticated'](),controller[_0xdd7a('0xb')]);router[_0xdd7a('0x8')]('/:id',auth[_0xdd7a('0x9')](),controller['show']);router['get'](_0xdd7a('0xc'),auth['isAuthenticated'](),controller[_0xdd7a('0xd')]);router[_0xdd7a('0x8')]('/:id/resources',auth[_0xdd7a('0x9')](),controller['getResources']);router[_0xdd7a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdd7a('0xe')](_0xdd7a('0xf'),auth[_0xdd7a('0x9')](),controller[_0xdd7a('0x10')]);router[_0xdd7a('0xe')](_0xdd7a('0xc'),auth[_0xdd7a('0x9')](),controller[_0xdd7a('0x11')]);router[_0xdd7a('0xe')](_0xdd7a('0x12'),auth['isAuthenticated'](),controller['addResources']);router[_0xdd7a('0x13')](_0xdd7a('0x14'),auth[_0xdd7a('0x9')](),controller[_0xdd7a('0x15')]);router[_0xdd7a('0x16')](_0xdd7a('0x14'),auth[_0xdd7a('0x9')](),controller[_0xdd7a('0x17')]);router['delete'](_0xdd7a('0xc'),auth[_0xdd7a('0x9')](),controller[_0xdd7a('0x18')]);router['delete'](_0xdd7a('0x12'),auth[_0xdd7a('0x9')](),controller[_0xdd7a('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 92d8bba..dab6a8a 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 _0xe771=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','exports','STRING','name'];(function(_0x1611cc,_0x3d4ce5){var _0x379497=function(_0x2ea046){while(--_0x2ea046){_0x1611cc['push'](_0x1611cc['shift']());}};_0x379497(++_0x3d4ce5);}(_0xe771,0x19b));var _0x1e77=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xe771[_0x9e0cb3];return _0x5926b7;};'use strict';var Sequelize=require('sequelize');module[_0x1e77('0x0')]={'name':{'type':Sequelize[_0x1e77('0x1')],'allowNull':![],'unique':_0x1e77('0x2')},'crudPermissions':{'type':Sequelize[_0x1e77('0x1')],'set':function(_0x178daf){this[_0x1e77('0x3')](_0x1e77('0x4'),_0x178daf?_0x178daf[_0x1e77('0x5')](''):[]);},'get':function(){return this[_0x1e77('0x6')](_0x1e77('0x4'))?this[_0x1e77('0x6')](_0x1e77('0x4'))[_0x1e77('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1e77('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x1e77('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x1e77('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x1e77('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x1e77('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1e77('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcfcc=['name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x223fe1,_0x3217c1){var _0x1834fa=function(_0x11e665){while(--_0x11e665){_0x223fe1['push'](_0x223fe1['shift']());}};_0x1834fa(++_0x3217c1);}(_0xcfcc,0x1b6));var _0xccfc=function(_0x1d9c27,_0x2dd3ee){_0x1d9c27=_0x1d9c27-0x0;var _0x52c0db=_0xcfcc[_0x1d9c27];return _0x52c0db;};'use strict';var Sequelize=require(_0xccfc('0x0'));module[_0xccfc('0x1')]={'name':{'type':Sequelize[_0xccfc('0x2')],'allowNull':![],'unique':_0xccfc('0x3')},'crudPermissions':{'type':Sequelize[_0xccfc('0x2')],'set':function(_0x33340e){this[_0xccfc('0x4')](_0xccfc('0x5'),_0x33340e?_0x33340e[_0xccfc('0x6')](''):[]);},'get':function(){return this[_0xccfc('0x7')](_0xccfc('0x5'))?this[_0xccfc('0x7')](_0xccfc('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xccfc('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xccfc('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xccfc('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xccfc('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xccfc('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xccfc('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xccfc('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xccfc('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2bde37d..860bb44 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 _0x4f9b=['Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','limit','count','offset','set','reject','save','then','name','send','map','UserProfile','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','clone','params','omit','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','destroy','describe','addSections','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section'];(function(_0x58f923,_0x2ac4a7){var _0x12088c=function(_0x415533){while(--_0x415533){_0x58f923['push'](_0x58f923['shift']());}};_0x12088c(++_0x2ac4a7);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x459494,_0x801df){_0x459494=_0x459494-0x0;var _0x1043ea=_0x4f9b[_0x459494];return _0x1043ea;};'use strict';var emlformat=require(_0xb4f9('0x0'));var rimraf=require(_0xb4f9('0x1'));var zipdir=require(_0xb4f9('0x2'));var jsonpatch=require(_0xb4f9('0x3'));var rp=require(_0xb4f9('0x4'));var moment=require(_0xb4f9('0x5'));var BPromise=require(_0xb4f9('0x6'));var Mustache=require(_0xb4f9('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb4f9('0x8'));var ejs=require(_0xb4f9('0x9'));var fs=require('fs');var fs_extra=require(_0xb4f9('0xa'));var _=require(_0xb4f9('0xb'));var squel=require(_0xb4f9('0xc'));var crypto=require(_0xb4f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb4f9('0xe'));var toCsv=require(_0xb4f9('0x8'));var querystring=require(_0xb4f9('0xf'));var Papa=require('papaparse');var Redis=require(_0xb4f9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4f9('0x11'));var as=require(_0xb4f9('0x12'));var hardwareService=require(_0xb4f9('0x13'));var logger=require(_0xb4f9('0x14'))(_0xb4f9('0x15'));var utils=require(_0xb4f9('0x16'));var config=require(_0xb4f9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4f9('0x18'))['db'];config[_0xb4f9('0x19')]=_[_0xb4f9('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb4f9('0x1b'))(new Redis(config[_0xb4f9('0x19')]));require(_0xb4f9('0x1c'))[_0xb4f9('0x1d')](socket);function respondWithStatusCode(_0x25b8d9,_0x2214e1){_0x2214e1=_0x2214e1||0xcc;return function(_0x3569c5){if(_0x3569c5){return _0x25b8d9[_0xb4f9('0x1e')](_0x2214e1);}return _0x25b8d9[_0xb4f9('0x1f')](_0x2214e1)[_0xb4f9('0x20')]();};}function respondWithResult(_0xc6e4da,_0x3e80f1){_0x3e80f1=_0x3e80f1||0xc8;return function(_0x5e6472){if(_0x5e6472){return _0xc6e4da[_0xb4f9('0x1f')](_0x3e80f1)[_0xb4f9('0x21')](_0x5e6472);}};}function respondWithFilteredResult(_0x127b63,_0x232667){return function(_0x53a012){if(_0x53a012){var _0x4d7c24=typeof _0x232667['offset']==='undefined'&&typeof _0x232667[_0xb4f9('0x22')]==='undefined';var _0x32a6e5=_0x53a012[_0xb4f9('0x23')];var _0x4953f4=_0x4d7c24?0x0:_0x232667[_0xb4f9('0x24')];var _0x539699=_0x4d7c24?_0x53a012[_0xb4f9('0x23')]:_0x232667[_0xb4f9('0x24')]+_0x232667[_0xb4f9('0x22')];var _0x1a87aa;if(_0x539699>=_0x32a6e5){_0x539699=_0x32a6e5;_0x1a87aa=0xc8;}else{_0x1a87aa=0xce;}_0x127b63[_0xb4f9('0x1f')](_0x1a87aa);return _0x127b63[_0xb4f9('0x25')]('Content-Range',_0x4953f4+'-'+_0x539699+'/'+_0x32a6e5)['json'](_0x53a012);}return null;};}function patchUpdates(_0x5e7f7c){return function(_0x444ec0){try{jsonpatch['apply'](_0x444ec0,_0x5e7f7c,!![]);}catch(_0x106350){return BPromise[_0xb4f9('0x26')](_0x106350);}return _0x444ec0[_0xb4f9('0x27')]();};}function saveUpdates(_0x475050,_0x8b7f04){return function(_0xff221d){if(_0xff221d){return _0xff221d['update'](_0x475050)[_0xb4f9('0x28')](function(_0x4e428d){return _0x4e428d;});}return null;};}function removeEntity(_0x3f9f58,_0x4333c8){return function(_0x482ddf){if(_0x482ddf){return _0x482ddf['destroy']()[_0xb4f9('0x28')](function(){_0x3f9f58['status'](0xcc)[_0xb4f9('0x20')]();});}};}function handleEntityNotFound(_0x41346f,_0x1c8a38){return function(_0xe5175a){if(!_0xe5175a){_0x41346f[_0xb4f9('0x1e')](0x194);}return _0xe5175a;};}function handleError(_0x3dd3aa,_0x3bac61){_0x3bac61=_0x3bac61||0x1f4;return function(_0x18d528){logger['error'](_0x18d528['stack']);if(_0x18d528['name']){delete _0x18d528[_0xb4f9('0x29')];}_0x3dd3aa[_0xb4f9('0x1f')](_0x3bac61)[_0xb4f9('0x2a')](_0x18d528);};}exports['index']=function(_0x3d01da,_0x2a3cc5){var _0x6e9371={},_0x264a55={},_0x399df5={'count':0x0,'rows':[]};var _0x2d2f9d=_[_0xb4f9('0x2b')](db[_0xb4f9('0x2c')]['rawAttributes'],function(_0x1f2a40){return{'name':_0x1f2a40['fieldName'],'type':_0x1f2a40[_0xb4f9('0x2d')]['key']};});_0x264a55['model']=_[_0xb4f9('0x2b')](_0x2d2f9d,_0xb4f9('0x29'));_0x264a55[_0xb4f9('0x2e')]=_[_0xb4f9('0x2f')](_0x3d01da['query']);_0x264a55[_0xb4f9('0x30')]=_[_0xb4f9('0x31')](_0x264a55[_0xb4f9('0x32')],_0x264a55[_0xb4f9('0x2e')]);_0x6e9371[_0xb4f9('0x33')]=_[_0xb4f9('0x31')](_0x264a55[_0xb4f9('0x32')],qs[_0xb4f9('0x34')](_0x3d01da[_0xb4f9('0x2e')][_0xb4f9('0x34')]));_0x6e9371[_0xb4f9('0x33')]=_0x6e9371[_0xb4f9('0x33')][_0xb4f9('0x35')]?_0x6e9371['attributes']:_0x264a55[_0xb4f9('0x32')];if(!_0x3d01da[_0xb4f9('0x2e')]['hasOwnProperty'](_0xb4f9('0x36'))){_0x6e9371[_0xb4f9('0x22')]=qs[_0xb4f9('0x22')](_0x3d01da[_0xb4f9('0x2e')]['limit']);_0x6e9371[_0xb4f9('0x24')]=qs['offset'](_0x3d01da[_0xb4f9('0x2e')]['offset']);}_0x6e9371[_0xb4f9('0x37')]=qs['sort'](_0x3d01da[_0xb4f9('0x2e')]['sort']);_0x6e9371[_0xb4f9('0x38')]=qs[_0xb4f9('0x30')](_[_0xb4f9('0x39')](_0x3d01da[_0xb4f9('0x2e')],_0x264a55[_0xb4f9('0x30')]),_0x2d2f9d);if(_0x3d01da[_0xb4f9('0x2e')]['filter']){_0x6e9371[_0xb4f9('0x38')]=_[_0xb4f9('0x3a')](_0x6e9371['where'],{'$or':_[_0xb4f9('0x2b')](_0x2d2f9d,function(_0x1faafc){if(_0x1faafc[_0xb4f9('0x2d')]!==_0xb4f9('0x3b')){var _0x198093={};_0x198093[_0x1faafc[_0xb4f9('0x29')]]={'$like':'%'+_0x3d01da[_0xb4f9('0x2e')][_0xb4f9('0x3c')]+'%'};return _0x198093;}})});}_0x6e9371=_[_0xb4f9('0x3a')]({},_0x6e9371,_0x3d01da[_0xb4f9('0x3d')]);var _0x86a448={'where':_0x6e9371[_0xb4f9('0x38')]};return db[_0xb4f9('0x2c')][_0xb4f9('0x23')](_0x86a448)[_0xb4f9('0x28')](function(_0x1b2286){_0x399df5[_0xb4f9('0x23')]=_0x1b2286;if(_0x3d01da[_0xb4f9('0x2e')][_0xb4f9('0x3e')]){_0x6e9371['include']=[{'all':!![]}];}return db[_0xb4f9('0x2c')][_0xb4f9('0x3f')](_0x6e9371);})[_0xb4f9('0x28')](function(_0x504056){_0x399df5[_0xb4f9('0x40')]=_0x504056;return _0x399df5;})[_0xb4f9('0x28')](respondWithFilteredResult(_0x2a3cc5,_0x6e9371))[_0xb4f9('0x41')](handleError(_0x2a3cc5,null));};exports[_0xb4f9('0x42')]=function(_0x1755e4,_0x269a7b){var _0x513903={'raw':![],'where':{'id':_0x1755e4['params']['id']}},_0x3635d6={};_0x3635d6['model']=_[_0xb4f9('0x2f')](db[_0xb4f9('0x2c')][_0xb4f9('0x43')]);_0x3635d6[_0xb4f9('0x2e')]=_[_0xb4f9('0x2f')](_0x1755e4[_0xb4f9('0x2e')]);_0x3635d6[_0xb4f9('0x30')]=_['intersection'](_0x3635d6[_0xb4f9('0x32')],_0x3635d6[_0xb4f9('0x2e')]);_0x513903['attributes']=_[_0xb4f9('0x31')](_0x3635d6[_0xb4f9('0x32')],qs[_0xb4f9('0x34')](_0x1755e4[_0xb4f9('0x2e')][_0xb4f9('0x34')]));_0x513903[_0xb4f9('0x33')]=_0x513903['attributes'][_0xb4f9('0x35')]?_0x513903[_0xb4f9('0x33')]:_0x3635d6[_0xb4f9('0x32')];if(_0x1755e4['query'][_0xb4f9('0x3e')]){_0x513903[_0xb4f9('0x44')]=[{'all':!![]}];}_0x513903=_['merge']({},_0x513903,_0x1755e4[_0xb4f9('0x3d')]);return db[_0xb4f9('0x2c')][_0xb4f9('0x45')](_0x513903)[_0xb4f9('0x28')](handleEntityNotFound(_0x269a7b,null))[_0xb4f9('0x28')](respondWithResult(_0x269a7b,null))['catch'](handleError(_0x269a7b,null));};exports[_0xb4f9('0x46')]=function(_0x3612b6,_0x4a99cf){return db['UserProfile'][_0xb4f9('0x46')](_0x3612b6[_0xb4f9('0x47')],{})[_0xb4f9('0x28')](respondWithResult(_0x4a99cf,0xc9))['catch'](handleError(_0x4a99cf,null));};exports[_0xb4f9('0x48')]=function(_0x3cd65c,_0x3fd407){var _0x4a6f96={'where':{'id':_0x3cd65c[_0xb4f9('0x49')]['id']}},_0x368466={};_0x368466[_0xb4f9('0x32')]=_[_0xb4f9('0x2f')](db['UserProfile'][_0xb4f9('0x43')]);_0x4a6f96[_0xb4f9('0x33')]=_[_0xb4f9('0x31')](_0x368466['model'],qs[_0xb4f9('0x34')](_0x3cd65c[_0xb4f9('0x2e')]['fields']));_0x4a6f96[_0xb4f9('0x33')]=_0x4a6f96['attributes']['length']?_0x4a6f96[_0xb4f9('0x33')]:_0x368466['model'];if(_0x3cd65c[_0xb4f9('0x2e')]['includeAll']){_0x4a6f96[_0xb4f9('0x44')]=[{'all':!![]}];}_0x4a6f96=_[_0xb4f9('0x3a')]({},_0x4a6f96,_0x3cd65c[_0xb4f9('0x3d')]);return db['UserProfile'][_0xb4f9('0x45')](_0x4a6f96)['then'](handleEntityNotFound(_0x3fd407,null))[_0xb4f9('0x28')](function(_0x2bd4d9){if(_0x2bd4d9){var _0x9a402f=_0x2bd4d9['get']({'plain':!![]});_0x9a402f=qs[_0xb4f9('0x4a')](_0x9a402f,['id',_0xb4f9('0x4b'),'updatedAt','crudPermissions']);_0x3cd65c['body']=_['omit'](_0x3cd65c[_0xb4f9('0x47')],['id','createdAt',_0xb4f9('0x4c')]);return db[_0xb4f9('0x4d')][_0xb4f9('0x4e')](function(_0x404f52){return db['UserProfile']['create'](_[_0xb4f9('0x3a')](_0x9a402f,_0x3cd65c[_0xb4f9('0x47')]),{'include':_0x3cd65c[_0xb4f9('0x2e')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x404f52})[_0xb4f9('0x28')](function(_0x376ace){var _0xd8913c=_0x376ace[_0xb4f9('0x4f')]({'plain':!![]});return db[_0xb4f9('0x50')][_0xb4f9('0x3f')]({'where':{'userProfileId':_0x3cd65c['params']['id']},'raw':!![]})['then'](function(_0x4f1129){if(_0x4f1129){return BPromise[_0xb4f9('0x51')](_0x4f1129,function(_0x5c29d5){return new BPromise(function(_0x3b597f,_0x2c05d){if(_0x5c29d5['autoAssociation']===null||_0x5c29d5[_0xb4f9('0x52')]===0x1)_0x3b597f(null);return db[_0xb4f9('0x53')]['findAll']({'where':{'sectionId':_0x5c29d5['id']},'raw':!![]})[_0xb4f9('0x28')](function(_0x44e99b){var _0x4db1a0=_['map'](_0x44e99b,function(_0x983c9a){return qs[_0xb4f9('0x4a')](_0x983c9a,['id','createdAt','updatedAt',_0xb4f9('0x54')]);});_0x3b597f(_0x4db1a0);})[_0xb4f9('0x41')](function(_0x283a0d){_0x2c05d(_0x283a0d);});})[_0xb4f9('0x28')](function(_0x298f03){var _0x1be01c=qs['omit'](_0x5c29d5,['id',_0xb4f9('0x4b'),_0xb4f9('0x4c')]);_0x1be01c[_0xb4f9('0x55')]=_0xd8913c['id'];if(_0x298f03)_0x1be01c[_0xb4f9('0x56')]=_0x298f03;return _0x1be01c;})[_0xb4f9('0x28')](function(_0x3c5dff){return db[_0xb4f9('0x50')]['create'](_0x3c5dff,{'include':[{'model':db['UserProfileResource'],'as':_0xb4f9('0x56')}],'raw':!![],'transaction':_0x404f52});});})[_0xb4f9('0x28')](function(){return _0xd8913c;});}});});});}})[_0xb4f9('0x28')](respondWithResult(_0x3fd407,0xc9))[_0xb4f9('0x41')](handleError(_0x3fd407,null));};exports[_0xb4f9('0x57')]=function(_0x118d8d,_0x51e1dc){if(_0x118d8d[_0xb4f9('0x47')]['id']){delete _0x118d8d[_0xb4f9('0x47')]['id'];}return db[_0xb4f9('0x2c')]['find']({'where':{'id':_0x118d8d[_0xb4f9('0x49')]['id']}})[_0xb4f9('0x28')](handleEntityNotFound(_0x51e1dc,null))[_0xb4f9('0x28')](saveUpdates(_0x118d8d['body'],null))[_0xb4f9('0x28')](respondWithResult(_0x51e1dc,null))[_0xb4f9('0x41')](handleError(_0x51e1dc,null));};exports[_0xb4f9('0x58')]=function(_0x5acc44,_0x1cb52a){return db[_0xb4f9('0x2c')][_0xb4f9('0x45')]({'where':{'id':_0x5acc44[_0xb4f9('0x49')]['id']}})[_0xb4f9('0x28')](handleEntityNotFound(_0x1cb52a,null))[_0xb4f9('0x28')](removeEntity(_0x1cb52a,null))[_0xb4f9('0x41')](handleError(_0x1cb52a,null));};exports[_0xb4f9('0x59')]=function(_0x3169b5,_0x16e947){return db[_0xb4f9('0x2c')]['describe']()[_0xb4f9('0x28')](respondWithResult(_0x16e947,null))[_0xb4f9('0x41')](handleError(_0x16e947,null));};exports[_0xb4f9('0x5a')]=function(_0x5293d0,_0x15bbb6){var _0x33d0a2=_0x5293d0[_0xb4f9('0x47')];return db[_0xb4f9('0x2c')][_0xb4f9('0x45')]({'where':{'id':_0x5293d0[_0xb4f9('0x49')]['id']}})[_0xb4f9('0x28')](handleEntityNotFound(_0x15bbb6,null))[_0xb4f9('0x28')](function(_0x555f8f){if(_0x555f8f){return db[_0xb4f9('0x4d')]['transaction'](function(_0x493203){return db[_0xb4f9('0x50')][_0xb4f9('0x58')]({'where':{'userProfileId':_0x5293d0[_0xb4f9('0x49')]['id'],'sectionId':_['map'](_0x33d0a2,function(_0x113beb){return _0x113beb[_0xb4f9('0x54')];})},'transaction':_0x493203})[_0xb4f9('0x28')](function(){var _0x4cccff=_[_0xb4f9('0x2b')](_0x33d0a2,function(_0x87ba72){_0x87ba72[_0xb4f9('0x55')]=_0x5293d0[_0xb4f9('0x49')]['id'];return _0x87ba72;});var _0x112e5e=[];return BPromise['each'](_0x4cccff,function(_0x3337b7){return db['UserProfileSection'][_0xb4f9('0x46')](_0x3337b7,{'include':[{'model':db[_0xb4f9('0x53')],'as':'Resources'}],'raw':!![],'transaction':_0x493203})[_0xb4f9('0x28')](function(_0x5eff73){_0x112e5e[_0xb4f9('0x5b')](_0x5eff73[_0xb4f9('0x4f')]({'plain':!![]}));});})['then'](function(){return _0x112e5e;});});});}})[_0xb4f9('0x28')](function(_0x1547b8){return _0x1547b8;})[_0xb4f9('0x28')](respondWithResult(_0x15bbb6,null))[_0xb4f9('0x41')](handleError(_0x15bbb6,null));};exports[_0xb4f9('0x5c')]=function(_0x559000,_0x27ce9d){var _0x2ba87a;return db[_0xb4f9('0x2c')][_0xb4f9('0x45')]({'where':{'id':_0x559000[_0xb4f9('0x49')]['id']},'attributes':['id','name']})[_0xb4f9('0x28')](handleEntityNotFound(_0x27ce9d,null))[_0xb4f9('0x28')](function(_0x118de3){if(_0x118de3){_0x2ba87a=_0x118de3;return db[_0xb4f9('0x50')][_0xb4f9('0x58')]({'where':{'userProfileId':_0x559000[_0xb4f9('0x49')]['id'],'sectionId':_0x559000[_0xb4f9('0x2e')]['ids']}});}})[_0xb4f9('0x28')](function(){return _0x2ba87a;})[_0xb4f9('0x28')](respondWithStatusCode(_0x27ce9d,null))[_0xb4f9('0x41')](handleError(_0x27ce9d,null));};exports['getSections']=function(_0x12ad47,_0x31b650){var _0x468e1b=[];var _0x2aaaaf=[];return db[_0xb4f9('0x50')][_0xb4f9('0x3f')]({'where':{'userProfileId':_0x12ad47[_0xb4f9('0x49')]['id']},'raw':!![]})[_0xb4f9('0x28')](function(_0x5424f3){_0x468e1b=_[_0xb4f9('0x3c')](_0x5424f3,function(_0x25cafc){return _0x25cafc[_0xb4f9('0x5d')]===0x1||_[_0xb4f9('0x5e')]([0x3eb,0x709],_0x25cafc[_0xb4f9('0x54')]);});if(!_[_0xb4f9('0x5f')](_0x468e1b)){return _[_0xb4f9('0x2b')](_0x468e1b,function(_0x394272){return _0x394272[_0xb4f9('0x54')];});}else{return;}})[_0xb4f9('0x28')](function(_0x21119a){if(_0x21119a)_0x2aaaaf=_0x21119a;if(_[_0xb4f9('0x5e')](_0x2aaaaf,0x64)){var _0x2884cb=_[_0xb4f9('0x45')](_0x468e1b,{'sectionId':0x64});return hasDefaultDashboard(_0x2884cb)['then'](function(_0x2da9a9){return _[_0xb4f9('0x2b')](_0x468e1b,function(_0x1dbac7){if(_0x1dbac7[_0xb4f9('0x54')]===0x64){_0x1dbac7['subsections']=_0x2da9a9;}return _0x1dbac7;});});}else{return;}})[_0xb4f9('0x28')](function(_0x104224){if(_0x104224)_0x468e1b=_0x104224;if(_[_0xb4f9('0x5e')](_0x2aaaaf,0x3eb)){var _0x5761f9=_['find'](_0x468e1b,{'sectionId':0x3eb});return getCustomDashboards(_0x5761f9)[_0xb4f9('0x28')](function(_0x3d6acf){return _['map'](_0x468e1b,function(_0x489925){if(_0x5761f9[_0xb4f9('0x5d')]){if(_0x489925[_0xb4f9('0x54')]===0x3eb){_0x489925[_0xb4f9('0x60')]=_0x3d6acf;}}else{if(_0x489925[_0xb4f9('0x54')]===0x64){_0x489925[_0xb4f9('0x60')]=_0x3d6acf;}}return _0x489925;});});}else{return;}})[_0xb4f9('0x28')](function(_0x19c09a){if(_0x19c09a)_0x468e1b=_0x19c09a;if(_['includes'](_0x2aaaaf,0x709)){var _0x110a3a=_[_0xb4f9('0x45')](_0x468e1b,{'sectionId':0x709});return getPlugins(_0x110a3a)['then'](function(_0xec84c9){if(_0x110a3a[_0xb4f9('0x5d')]){return _[_0xb4f9('0x2b')](_0x468e1b,function(_0xfd50c){if(_0xfd50c[_0xb4f9('0x54')]===0x709){_0xfd50c[_0xb4f9('0x60')]=_0xec84c9;}return _0xfd50c;});}else{var _0x10b062={'sectionId':0x76c,'enabled':0x1,'subsections':_0xec84c9};var _0x3391e7=_[_0xb4f9('0x2b')](_0x468e1b);_0x3391e7['push'](_0x10b062);return _0x3391e7;}});}else{return;}})[_0xb4f9('0x28')](function(_0x4e148e){if(_0x4e148e)_0x468e1b=_0x4e148e;return _[_0xb4f9('0x3c')](_0x468e1b,[_0xb4f9('0x5d'),0x1]);})[_0xb4f9('0x28')](respondWithResult(_0x31b650,null))['catch'](handleError(_0x31b650,null));};function hasDefaultDashboard(_0x1d55c4){var _0x56491a=[0x65];return new BPromise(function(_0x3e7aeb,_0x4d8b8a){try{if(_0x1d55c4['autoAssociation']){_0x3e7aeb(_0x56491a);}else{return db[_0xb4f9('0x53')][_0xb4f9('0x61')]({'where':{'sectionId':_0x1d55c4['id']},'raw':!![]})[_0xb4f9('0x28')](function(_0x531423){_0x531423?_0x3e7aeb(_0x56491a):_0x3e7aeb();});}}catch(_0x93958e){_0x4d8b8a(_0x93958e);}});}function getCustomDashboards(_0x2ff8c1){var _0x2d262c=[];return new BPromise(function(_0x41848e,_0x2b2e32){try{if(_0x2ff8c1['autoAssociation']){return db[_0xb4f9('0x62')][_0xb4f9('0x3f')]({'raw':!![]})['then'](function(_0x5c3bcd){_0x5c3bcd['forEach'](function(_0x205d44){_0x2d262c[_0xb4f9('0x5b')](_0x205d44['id']+0x1869f);});_0x41848e(_0x2d262c);});}else{return db[_0xb4f9('0x53')][_0xb4f9('0x3f')]({'where':{'sectionId':_0x2ff8c1['id']},'raw':!![]})[_0xb4f9('0x28')](function(_0x522b4d){_0x522b4d[_0xb4f9('0x63')](function(_0x448c3c){_0x2d262c[_0xb4f9('0x5b')](_0x448c3c[_0xb4f9('0x64')]+0x1869f);});_0x41848e(_0x2d262c);});}}catch(_0x1c0081){_0x2b2e32(_0x1c0081);}});}function getPlugins(_0x51fb40){var _0x4e4284=[];return new BPromise(function(_0x51c54f,_0x402ddd){try{if(_0x51fb40[_0xb4f9('0x52')]){return db[_0xb4f9('0x65')][_0xb4f9('0x3f')]({'raw':!![]})[_0xb4f9('0x28')](function(_0x53d135){_0x53d135[_0xb4f9('0x63')](function(_0x5ea00c){_0x4e4284[_0xb4f9('0x5b')](_0x5ea00c['id']+0x15b38);});_0x51c54f(_0x4e4284);});}else{return db[_0xb4f9('0x53')][_0xb4f9('0x3f')]({'where':{'sectionId':_0x51fb40['id']},'raw':!![]})[_0xb4f9('0x28')](function(_0x10400c){_0x10400c[_0xb4f9('0x63')](function(_0x54bc05){_0x4e4284['push'](_0x54bc05[_0xb4f9('0x64')]+0x15b38);});_0x51c54f(_0x4e4284);});}}catch(_0x475c57){_0x402ddd(_0x475c57);}});}exports['addResources']=function(_0x3f069a,_0x4d6c95){return db['UserProfile'][_0xb4f9('0x45')]({'where':{'id':_0x3f069a[_0xb4f9('0x49')]['id']}})[_0xb4f9('0x28')](handleEntityNotFound(_0x4d6c95,null))[_0xb4f9('0x28')](function(_0x48609c){if(_0x48609c){return db[_0xb4f9('0x4d')][_0xb4f9('0x4e')](function(_0x5239c2){return db['UserProfileSection'][_0xb4f9('0x3f')]({'where':{'userProfileId':_0x3f069a[_0xb4f9('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xb4f9('0x28')](function(_0x2ca26e){if(_0x2ca26e){return db[_0xb4f9('0x50')][_0xb4f9('0x58')]({'where':{'userProfileId':_0x3f069a['params']['id'],'id':_[_0xb4f9('0x2b')](_0x2ca26e,function(_0x5414f7){return _0x5414f7['id'];})},'transaction':_0x5239c2});}})[_0xb4f9('0x28')](function(_0x120df9){var _0x420d8b=_['map'](_0x3f069a[_0xb4f9('0x47')],function(_0x3bca1d){_0x3bca1d['userProfileId']=_0x3f069a['params']['id'];return _0x3bca1d;});return db[_0xb4f9('0x50')][_0xb4f9('0x66')](_0x420d8b,{'raw':!![],'transaction':_0x5239c2});})[_0xb4f9('0x28')](function(_0x5c3247){var _0x1087d2=_[_0xb4f9('0x3c')](_[_0xb4f9('0x2b')](_0x5c3247,function(_0x432e50){return _0x432e50['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1087d2){return db['UserProfileSection'][_0xb4f9('0x3f')]({'where':{'userProfileId':_0x3f069a[_0xb4f9('0x49')]['id'],'sectionId':_[_0xb4f9('0x2b')](_0x1087d2,function(_0x1bc5e1){return _0x1bc5e1['sectionId'];})},'attributes':['id',_0xb4f9('0x54')],'raw':!![]})[_0xb4f9('0x28')](function(_0xb8d3b5){var _0x282c86=_[_0xb4f9('0x2b')](_0x3f069a[_0xb4f9('0x47')],function(_0x579087){_0x579087['userProfileId']=_0x3f069a[_0xb4f9('0x49')]['id'];return _0x579087;});return db[_0xb4f9('0x53')][_0xb4f9('0x66')](_0x282c86,{'raw':!![],'transaction':_0x5239c2});});}})[_0xb4f9('0x41')](handleError(_0x4d6c95,null));});}})[_0xb4f9('0x28')](function(_0x2c4ac1){var _0x597251=_[_0xb4f9('0x2b')](_0x2c4ac1,function(_0x22f268){return _0x22f268['get']({'plain':!![]});});})[_0xb4f9('0x28')](respondWithResult(_0x4d6c95,null))['catch'](handleError(_0x4d6c95,null));};exports[_0xb4f9('0x67')]=function(_0x26eb47,_0x366aec,_0x3054e6){return db[_0xb4f9('0x2c')][_0xb4f9('0x45')]({'where':{'id':_0x26eb47[_0xb4f9('0x49')]['id']}})['then'](handleEntityNotFound(_0x366aec,null))['then'](function(_0x8d99fe){if(_0x8d99fe){return _0x8d99fe[_0xb4f9('0x67')](_0x26eb47['query'][_0xb4f9('0x68')]);}})[_0xb4f9('0x28')](respondWithStatusCode(_0x366aec,null))['catch'](handleError(_0x366aec,null));};exports[_0xb4f9('0x69')]=function(_0x40ba4d,_0x66341a){var _0x35c1cf={};if(!_0x40ba4d['query'][_0xb4f9('0x6a')])throw new Error(_0xb4f9('0x6b'));if(!_0x40ba4d[_0xb4f9('0x2e')]['hasOwnProperty'](_0xb4f9('0x36'))){_0x35c1cf['limit']=qs['limit'](_0x40ba4d[_0xb4f9('0x2e')]['limit']);_0x35c1cf['offset']=qs[_0xb4f9('0x24')](_0x40ba4d[_0xb4f9('0x2e')][_0xb4f9('0x24')]);}return db[_0xb4f9('0x2c')][_0xb4f9('0x45')]({'where':{'id':_0x40ba4d[_0xb4f9('0x49')]['id']}})[_0xb4f9('0x28')](function(_0x59bd23){if(!_0x59bd23)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x40ba4d[_0xb4f9('0x49')]['id']);return db[_0xb4f9('0x2c')][_0xb4f9('0x69')](_0x40ba4d);})[_0xb4f9('0x28')](respondWithFilteredResult(_0x66341a,_0x35c1cf))[_0xb4f9('0x41')](handleError(_0x66341a,null));}; \ No newline at end of file +var _0xacc6=['findOne','Dashboard','forEach','resourceId','Plugin','addResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','send','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','body','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','UserProfileSection','each','sectionId','userProfileId','Resources','UserProfileResource','update','describe','addSections','push','removeSections','ids','enabled','includes','isEmpty','subsections','autoAssociation'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xacc6,0x150));var _0x6acc=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0xacc6[_0x3c4a7c];return _0xf13d1e;};'use strict';var emlformat=require(_0x6acc('0x0'));var rimraf=require(_0x6acc('0x1'));var zipdir=require(_0x6acc('0x2'));var jsonpatch=require(_0x6acc('0x3'));var rp=require(_0x6acc('0x4'));var moment=require('moment');var BPromise=require(_0x6acc('0x5'));var Mustache=require(_0x6acc('0x6'));var util=require(_0x6acc('0x7'));var path=require('path');var sox=require(_0x6acc('0x8'));var csv=require('to-csv');var ejs=require(_0x6acc('0x9'));var fs=require('fs');var fs_extra=require(_0x6acc('0xa'));var _=require('lodash');var squel=require(_0x6acc('0xb'));var crypto=require('crypto');var jsforce=require(_0x6acc('0xc'));var deskjs=require(_0x6acc('0xd'));var toCsv=require(_0x6acc('0xe'));var querystring=require(_0x6acc('0xf'));var Papa=require('papaparse');var Redis=require(_0x6acc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6acc('0x11'));var as=require(_0x6acc('0x12'));var hardwareService=require(_0x6acc('0x13'));var logger=require(_0x6acc('0x14'))(_0x6acc('0x15'));var utils=require(_0x6acc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6acc('0x17'));var db=require(_0x6acc('0x18'))['db'];config[_0x6acc('0x19')]=_[_0x6acc('0x1a')](config[_0x6acc('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6acc('0x19')]));require(_0x6acc('0x1b'))[_0x6acc('0x1c')](socket);function respondWithStatusCode(_0x230318,_0x3c0afb){_0x3c0afb=_0x3c0afb||0xcc;return function(_0x2e3e01){if(_0x2e3e01){return _0x230318[_0x6acc('0x1d')](_0x3c0afb);}return _0x230318[_0x6acc('0x1e')](_0x3c0afb)[_0x6acc('0x1f')]();};}function respondWithResult(_0xc07208,_0x1fe0ac){_0x1fe0ac=_0x1fe0ac||0xc8;return function(_0x14312b){if(_0x14312b){return _0xc07208[_0x6acc('0x1e')](_0x1fe0ac)[_0x6acc('0x20')](_0x14312b);}};}function respondWithFilteredResult(_0x24f513,_0x4c7f9f){return function(_0x3818d8){if(_0x3818d8){var _0x17e367=typeof _0x4c7f9f['offset']===_0x6acc('0x21')&&typeof _0x4c7f9f[_0x6acc('0x22')]===_0x6acc('0x21');var _0x151282=_0x3818d8['count'];var _0x342043=_0x17e367?0x0:_0x4c7f9f['offset'];var _0x51dea7=_0x17e367?_0x3818d8[_0x6acc('0x23')]:_0x4c7f9f['offset']+_0x4c7f9f[_0x6acc('0x22')];var _0x3edf4a;if(_0x51dea7>=_0x151282){_0x51dea7=_0x151282;_0x3edf4a=0xc8;}else{_0x3edf4a=0xce;}_0x24f513[_0x6acc('0x1e')](_0x3edf4a);return _0x24f513[_0x6acc('0x24')](_0x6acc('0x25'),_0x342043+'-'+_0x51dea7+'/'+_0x151282)['json'](_0x3818d8);}return null;};}function patchUpdates(_0x3e4a71){return function(_0x1ebc54){try{jsonpatch['apply'](_0x1ebc54,_0x3e4a71,!![]);}catch(_0x334416){return BPromise['reject'](_0x334416);}return _0x1ebc54[_0x6acc('0x26')]();};}function saveUpdates(_0x1db7bd,_0x217c40){return function(_0x205bda){if(_0x205bda){return _0x205bda['update'](_0x1db7bd)[_0x6acc('0x27')](function(_0xa4d97c){return _0xa4d97c;});}return null;};}function removeEntity(_0x4a4ca1,_0x10f286){return function(_0x1cec1e){if(_0x1cec1e){return _0x1cec1e[_0x6acc('0x28')]()[_0x6acc('0x27')](function(){_0x4a4ca1[_0x6acc('0x1e')](0xcc)[_0x6acc('0x1f')]();});}};}function handleEntityNotFound(_0x31b849,_0xa15e0f){return function(_0x4d1c18){if(!_0x4d1c18){_0x31b849[_0x6acc('0x1d')](0x194);}return _0x4d1c18;};}function handleError(_0x54519d,_0x15be7c){_0x15be7c=_0x15be7c||0x1f4;return function(_0x490ce6){logger[_0x6acc('0x29')](_0x490ce6[_0x6acc('0x2a')]);if(_0x490ce6[_0x6acc('0x2b')]){delete _0x490ce6[_0x6acc('0x2b')];}_0x54519d[_0x6acc('0x1e')](_0x15be7c)[_0x6acc('0x2c')](_0x490ce6);};}exports['index']=function(_0x4bd95a,_0x47ff48){var _0x5b6fab={},_0x1658fb={},_0x23a581={'count':0x0,'rows':[]};var _0x3b8ef2=_[_0x6acc('0x2d')](db[_0x6acc('0x2e')][_0x6acc('0x2f')],function(_0x5e4feb){return{'name':_0x5e4feb['fieldName'],'type':_0x5e4feb[_0x6acc('0x30')][_0x6acc('0x31')]};});_0x1658fb[_0x6acc('0x32')]=_[_0x6acc('0x2d')](_0x3b8ef2,'name');_0x1658fb[_0x6acc('0x33')]=_[_0x6acc('0x34')](_0x4bd95a['query']);_0x1658fb[_0x6acc('0x35')]=_[_0x6acc('0x36')](_0x1658fb[_0x6acc('0x32')],_0x1658fb['query']);_0x5b6fab['attributes']=_[_0x6acc('0x36')](_0x1658fb[_0x6acc('0x32')],qs['fields'](_0x4bd95a['query'][_0x6acc('0x37')]));_0x5b6fab[_0x6acc('0x38')]=_0x5b6fab[_0x6acc('0x38')]['length']?_0x5b6fab[_0x6acc('0x38')]:_0x1658fb[_0x6acc('0x32')];if(!_0x4bd95a[_0x6acc('0x33')][_0x6acc('0x39')](_0x6acc('0x3a'))){_0x5b6fab['limit']=qs[_0x6acc('0x22')](_0x4bd95a['query'][_0x6acc('0x22')]);_0x5b6fab[_0x6acc('0x3b')]=qs['offset'](_0x4bd95a[_0x6acc('0x33')]['offset']);}_0x5b6fab['order']=qs[_0x6acc('0x3c')](_0x4bd95a[_0x6acc('0x33')][_0x6acc('0x3c')]);_0x5b6fab['where']=qs[_0x6acc('0x35')](_['pick'](_0x4bd95a[_0x6acc('0x33')],_0x1658fb['filters']),_0x3b8ef2);if(_0x4bd95a[_0x6acc('0x33')][_0x6acc('0x3d')]){_0x5b6fab['where']=_[_0x6acc('0x3e')](_0x5b6fab[_0x6acc('0x3f')],{'$or':_[_0x6acc('0x2d')](_0x3b8ef2,function(_0x30d01d){if(_0x30d01d[_0x6acc('0x30')]!==_0x6acc('0x40')){var _0x6032ec={};_0x6032ec[_0x30d01d['name']]={'$like':'%'+_0x4bd95a['query'][_0x6acc('0x3d')]+'%'};return _0x6032ec;}})});}_0x5b6fab=_[_0x6acc('0x3e')]({},_0x5b6fab,_0x4bd95a[_0x6acc('0x41')]);var _0x540820={'where':_0x5b6fab[_0x6acc('0x3f')]};return db[_0x6acc('0x2e')][_0x6acc('0x23')](_0x540820)[_0x6acc('0x27')](function(_0x3f848c){_0x23a581[_0x6acc('0x23')]=_0x3f848c;if(_0x4bd95a[_0x6acc('0x33')][_0x6acc('0x42')]){_0x5b6fab[_0x6acc('0x43')]=[{'all':!![]}];}return db[_0x6acc('0x2e')][_0x6acc('0x44')](_0x5b6fab);})[_0x6acc('0x27')](function(_0x5c938d){_0x23a581['rows']=_0x5c938d;return _0x23a581;})['then'](respondWithFilteredResult(_0x47ff48,_0x5b6fab))[_0x6acc('0x45')](handleError(_0x47ff48,null));};exports['show']=function(_0x48f3ef,_0x20369a){var _0x25f84c={'raw':![],'where':{'id':_0x48f3ef[_0x6acc('0x46')]['id']}},_0x25f4d8={};_0x25f4d8[_0x6acc('0x32')]=_[_0x6acc('0x34')](db[_0x6acc('0x2e')][_0x6acc('0x2f')]);_0x25f4d8[_0x6acc('0x33')]=_[_0x6acc('0x34')](_0x48f3ef[_0x6acc('0x33')]);_0x25f4d8[_0x6acc('0x35')]=_[_0x6acc('0x36')](_0x25f4d8['model'],_0x25f4d8[_0x6acc('0x33')]);_0x25f84c[_0x6acc('0x38')]=_['intersection'](_0x25f4d8[_0x6acc('0x32')],qs['fields'](_0x48f3ef[_0x6acc('0x33')][_0x6acc('0x37')]));_0x25f84c['attributes']=_0x25f84c[_0x6acc('0x38')][_0x6acc('0x47')]?_0x25f84c[_0x6acc('0x38')]:_0x25f4d8[_0x6acc('0x32')];if(_0x48f3ef[_0x6acc('0x33')]['includeAll']){_0x25f84c[_0x6acc('0x43')]=[{'all':!![]}];}_0x25f84c=_[_0x6acc('0x3e')]({},_0x25f84c,_0x48f3ef[_0x6acc('0x41')]);return db[_0x6acc('0x2e')][_0x6acc('0x48')](_0x25f84c)[_0x6acc('0x27')](handleEntityNotFound(_0x20369a,null))[_0x6acc('0x27')](respondWithResult(_0x20369a,null))[_0x6acc('0x45')](handleError(_0x20369a,null));};exports[_0x6acc('0x49')]=function(_0x28e601,_0x1989a6){return db[_0x6acc('0x2e')][_0x6acc('0x49')](_0x28e601[_0x6acc('0x4a')],{})[_0x6acc('0x27')](respondWithResult(_0x1989a6,0xc9))[_0x6acc('0x45')](handleError(_0x1989a6,null));};exports[_0x6acc('0x4b')]=function(_0x594cc4,_0x5ab4af){var _0x5e1fe6={'where':{'id':_0x594cc4[_0x6acc('0x46')]['id']}},_0x3c93f0={};_0x3c93f0['model']=_[_0x6acc('0x34')](db[_0x6acc('0x2e')][_0x6acc('0x2f')]);_0x5e1fe6[_0x6acc('0x38')]=_['intersection'](_0x3c93f0[_0x6acc('0x32')],qs[_0x6acc('0x37')](_0x594cc4[_0x6acc('0x33')][_0x6acc('0x37')]));_0x5e1fe6[_0x6acc('0x38')]=_0x5e1fe6['attributes'][_0x6acc('0x47')]?_0x5e1fe6[_0x6acc('0x38')]:_0x3c93f0[_0x6acc('0x32')];if(_0x594cc4['query'][_0x6acc('0x42')]){_0x5e1fe6[_0x6acc('0x43')]=[{'all':!![]}];}_0x5e1fe6=_[_0x6acc('0x3e')]({},_0x5e1fe6,_0x594cc4[_0x6acc('0x41')]);return db['UserProfile'][_0x6acc('0x48')](_0x5e1fe6)[_0x6acc('0x27')](handleEntityNotFound(_0x5ab4af,null))['then'](function(_0x362613){if(_0x362613){var _0x48b8e1=_0x362613['get']({'plain':!![]});_0x48b8e1=qs[_0x6acc('0x4c')](_0x48b8e1,['id',_0x6acc('0x4d'),_0x6acc('0x4e'),_0x6acc('0x4f')]);_0x594cc4['body']=_[_0x6acc('0x4c')](_0x594cc4[_0x6acc('0x4a')],['id','createdAt',_0x6acc('0x4e')]);return db[_0x6acc('0x50')][_0x6acc('0x51')](function(_0x396d46){return db[_0x6acc('0x2e')][_0x6acc('0x49')](_[_0x6acc('0x3e')](_0x48b8e1,_0x594cc4['body']),{'include':_0x594cc4['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x396d46})[_0x6acc('0x27')](function(_0x43d3d){var _0x493bb9=_0x43d3d[_0x6acc('0x52')]({'plain':!![]});return db[_0x6acc('0x53')]['findAll']({'where':{'userProfileId':_0x594cc4[_0x6acc('0x46')]['id']},'raw':!![]})['then'](function(_0x385d8e){if(_0x385d8e){return BPromise[_0x6acc('0x54')](_0x385d8e,function(_0x457d78){return new BPromise(function(_0xd231ba,_0x4b27b0){if(_0x457d78['autoAssociation']===null||_0x457d78['autoAssociation']===0x1)_0xd231ba(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x457d78['id']},'raw':!![]})[_0x6acc('0x27')](function(_0x6a2d56){var _0x1eb10e=_[_0x6acc('0x2d')](_0x6a2d56,function(_0x53c90b){return qs['omit'](_0x53c90b,['id',_0x6acc('0x4d'),'updatedAt',_0x6acc('0x55')]);});_0xd231ba(_0x1eb10e);})['catch'](function(_0x263c2a){_0x4b27b0(_0x263c2a);});})[_0x6acc('0x27')](function(_0x7e28ff){var _0x40435c=qs[_0x6acc('0x4c')](_0x457d78,['id',_0x6acc('0x4d'),_0x6acc('0x4e')]);_0x40435c[_0x6acc('0x56')]=_0x493bb9['id'];if(_0x7e28ff)_0x40435c[_0x6acc('0x57')]=_0x7e28ff;return _0x40435c;})[_0x6acc('0x27')](function(_0x271eeb){return db[_0x6acc('0x53')][_0x6acc('0x49')](_0x271eeb,{'include':[{'model':db[_0x6acc('0x58')],'as':_0x6acc('0x57')}],'raw':!![],'transaction':_0x396d46});});})[_0x6acc('0x27')](function(){return _0x493bb9;});}});});});}})[_0x6acc('0x27')](respondWithResult(_0x5ab4af,0xc9))[_0x6acc('0x45')](handleError(_0x5ab4af,null));};exports[_0x6acc('0x59')]=function(_0x47a4e8,_0x320580){if(_0x47a4e8['body']['id']){delete _0x47a4e8[_0x6acc('0x4a')]['id'];}return db['UserProfile'][_0x6acc('0x48')]({'where':{'id':_0x47a4e8['params']['id']}})[_0x6acc('0x27')](handleEntityNotFound(_0x320580,null))['then'](saveUpdates(_0x47a4e8['body'],null))[_0x6acc('0x27')](respondWithResult(_0x320580,null))[_0x6acc('0x45')](handleError(_0x320580,null));};exports['destroy']=function(_0x218c35,_0x32fd81){return db[_0x6acc('0x2e')]['find']({'where':{'id':_0x218c35[_0x6acc('0x46')]['id']}})[_0x6acc('0x27')](handleEntityNotFound(_0x32fd81,null))[_0x6acc('0x27')](removeEntity(_0x32fd81,null))[_0x6acc('0x45')](handleError(_0x32fd81,null));};exports['describe']=function(_0x591e53,_0x1269b2){return db[_0x6acc('0x2e')][_0x6acc('0x5a')]()['then'](respondWithResult(_0x1269b2,null))['catch'](handleError(_0x1269b2,null));};exports[_0x6acc('0x5b')]=function(_0x3aefe2,_0x211f48){var _0x4eb598=_0x3aefe2['body'];return db[_0x6acc('0x2e')][_0x6acc('0x48')]({'where':{'id':_0x3aefe2[_0x6acc('0x46')]['id']}})['then'](handleEntityNotFound(_0x211f48,null))[_0x6acc('0x27')](function(_0xb8a3db){if(_0xb8a3db){return db[_0x6acc('0x50')][_0x6acc('0x51')](function(_0xf3f6c4){return db[_0x6acc('0x53')][_0x6acc('0x28')]({'where':{'userProfileId':_0x3aefe2[_0x6acc('0x46')]['id'],'sectionId':_[_0x6acc('0x2d')](_0x4eb598,function(_0xbc01f3){return _0xbc01f3[_0x6acc('0x55')];})},'transaction':_0xf3f6c4})[_0x6acc('0x27')](function(){var _0x5181f6=_[_0x6acc('0x2d')](_0x4eb598,function(_0x984b92){_0x984b92[_0x6acc('0x56')]=_0x3aefe2[_0x6acc('0x46')]['id'];return _0x984b92;});var _0x47db86=[];return BPromise[_0x6acc('0x54')](_0x5181f6,function(_0x1334a1){return db[_0x6acc('0x53')][_0x6acc('0x49')](_0x1334a1,{'include':[{'model':db[_0x6acc('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0xf3f6c4})[_0x6acc('0x27')](function(_0x5e8fe6){_0x47db86[_0x6acc('0x5c')](_0x5e8fe6[_0x6acc('0x52')]({'plain':!![]}));});})[_0x6acc('0x27')](function(){return _0x47db86;});});});}})[_0x6acc('0x27')](function(_0x312fab){return _0x312fab;})[_0x6acc('0x27')](respondWithResult(_0x211f48,null))[_0x6acc('0x45')](handleError(_0x211f48,null));};exports[_0x6acc('0x5d')]=function(_0x1c0b28,_0x4cc475){var _0x1c5853;return db[_0x6acc('0x2e')]['find']({'where':{'id':_0x1c0b28[_0x6acc('0x46')]['id']},'attributes':['id',_0x6acc('0x2b')]})['then'](handleEntityNotFound(_0x4cc475,null))[_0x6acc('0x27')](function(_0x2e7b89){if(_0x2e7b89){_0x1c5853=_0x2e7b89;return db['UserProfileSection'][_0x6acc('0x28')]({'where':{'userProfileId':_0x1c0b28['params']['id'],'sectionId':_0x1c0b28[_0x6acc('0x33')][_0x6acc('0x5e')]}});}})['then'](function(){return _0x1c5853;})['then'](respondWithStatusCode(_0x4cc475,null))[_0x6acc('0x45')](handleError(_0x4cc475,null));};exports['getSections']=function(_0x40b7d1,_0x2a01c4){var _0x35892e=[];var _0x4214ea=[];return db[_0x6acc('0x53')][_0x6acc('0x44')]({'where':{'userProfileId':_0x40b7d1[_0x6acc('0x46')]['id']},'raw':!![]})[_0x6acc('0x27')](function(_0x4d36f5){_0x35892e=_[_0x6acc('0x3d')](_0x4d36f5,function(_0x260130){return _0x260130[_0x6acc('0x5f')]===0x1||_[_0x6acc('0x60')]([0x3eb,0x709],_0x260130[_0x6acc('0x55')]);});if(!_[_0x6acc('0x61')](_0x35892e)){return _[_0x6acc('0x2d')](_0x35892e,function(_0x528ede){return _0x528ede['sectionId'];});}else{return;}})[_0x6acc('0x27')](function(_0x230cbe){if(_0x230cbe)_0x4214ea=_0x230cbe;if(_[_0x6acc('0x60')](_0x4214ea,0x64)){var _0x3e0506=_[_0x6acc('0x48')](_0x35892e,{'sectionId':0x64});return hasDefaultDashboard(_0x3e0506)[_0x6acc('0x27')](function(_0x4ed717){return _[_0x6acc('0x2d')](_0x35892e,function(_0x3d2345){if(_0x3d2345['sectionId']===0x64){_0x3d2345[_0x6acc('0x62')]=_0x4ed717;}return _0x3d2345;});});}else{return;}})['then'](function(_0x34b009){if(_0x34b009)_0x35892e=_0x34b009;if(_[_0x6acc('0x60')](_0x4214ea,0x3eb)){var _0x37b950=_[_0x6acc('0x48')](_0x35892e,{'sectionId':0x3eb});return getCustomDashboards(_0x37b950)[_0x6acc('0x27')](function(_0x5ca4e8){return _[_0x6acc('0x2d')](_0x35892e,function(_0x3c4664){if(_0x37b950['enabled']){if(_0x3c4664[_0x6acc('0x55')]===0x3eb){_0x3c4664[_0x6acc('0x62')]=_0x5ca4e8;}}else{if(_0x3c4664[_0x6acc('0x55')]===0x64){_0x3c4664[_0x6acc('0x62')]=_0x5ca4e8;}}return _0x3c4664;});});}else{return;}})[_0x6acc('0x27')](function(_0x5c9761){if(_0x5c9761)_0x35892e=_0x5c9761;if(_[_0x6acc('0x60')](_0x4214ea,0x709)){var _0x1ee72b=_[_0x6acc('0x48')](_0x35892e,{'sectionId':0x709});return getPlugins(_0x1ee72b)[_0x6acc('0x27')](function(_0x140f1f){if(_0x1ee72b[_0x6acc('0x5f')]){return _[_0x6acc('0x2d')](_0x35892e,function(_0x47b118){if(_0x47b118['sectionId']===0x709){_0x47b118[_0x6acc('0x62')]=_0x140f1f;}return _0x47b118;});}else{var _0xdb076e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x140f1f};var _0x3a2f75=_[_0x6acc('0x2d')](_0x35892e);_0x3a2f75[_0x6acc('0x5c')](_0xdb076e);return _0x3a2f75;}});}else{return;}})[_0x6acc('0x27')](function(_0x511964){if(_0x511964)_0x35892e=_0x511964;return _['filter'](_0x35892e,[_0x6acc('0x5f'),0x1]);})[_0x6acc('0x27')](respondWithResult(_0x2a01c4,null))['catch'](handleError(_0x2a01c4,null));};function hasDefaultDashboard(_0x208e2f){var _0xbfe87b=[0x65];return new BPromise(function(_0x3433eb,_0x3612aa){try{if(_0x208e2f[_0x6acc('0x63')]){_0x3433eb(_0xbfe87b);}else{return db['UserProfileResource'][_0x6acc('0x64')]({'where':{'sectionId':_0x208e2f['id']},'raw':!![]})['then'](function(_0x286fb5){_0x286fb5?_0x3433eb(_0xbfe87b):_0x3433eb();});}}catch(_0x21664d){_0x3612aa(_0x21664d);}});}function getCustomDashboards(_0x15cd95){var _0x30aef7=[];return new BPromise(function(_0x1029a5,_0x57a316){try{if(_0x15cd95[_0x6acc('0x63')]){return db[_0x6acc('0x65')]['findAll']({'raw':!![]})[_0x6acc('0x27')](function(_0x2c5c12){_0x2c5c12[_0x6acc('0x66')](function(_0x1ad48a){_0x30aef7[_0x6acc('0x5c')](_0x1ad48a['id']+0x1869f);});_0x1029a5(_0x30aef7);});}else{return db[_0x6acc('0x58')][_0x6acc('0x44')]({'where':{'sectionId':_0x15cd95['id']},'raw':!![]})[_0x6acc('0x27')](function(_0x2c51fb){_0x2c51fb[_0x6acc('0x66')](function(_0x11407e){_0x30aef7['push'](_0x11407e[_0x6acc('0x67')]+0x1869f);});_0x1029a5(_0x30aef7);});}}catch(_0x53a756){_0x57a316(_0x53a756);}});}function getPlugins(_0x8edd99){var _0x5908ca=[];return new BPromise(function(_0x14b2b6,_0x263b83){try{if(_0x8edd99[_0x6acc('0x63')]){return db[_0x6acc('0x68')][_0x6acc('0x44')]({'raw':!![]})['then'](function(_0x1c1924){_0x1c1924[_0x6acc('0x66')](function(_0x4fc2fb){_0x5908ca['push'](_0x4fc2fb['id']+0x15b38);});_0x14b2b6(_0x5908ca);});}else{return db[_0x6acc('0x58')]['findAll']({'where':{'sectionId':_0x8edd99['id']},'raw':!![]})[_0x6acc('0x27')](function(_0x52fe71){_0x52fe71[_0x6acc('0x66')](function(_0x380991){_0x5908ca[_0x6acc('0x5c')](_0x380991['resourceId']+0x15b38);});_0x14b2b6(_0x5908ca);});}}catch(_0x13850e){_0x263b83(_0x13850e);}});}exports[_0x6acc('0x69')]=function(_0x2c459a,_0x133ca2){return db[_0x6acc('0x2e')][_0x6acc('0x48')]({'where':{'id':_0x2c459a[_0x6acc('0x46')]['id']}})[_0x6acc('0x27')](handleEntityNotFound(_0x133ca2,null))['then'](function(_0x2fffcd){if(_0x2fffcd){return db['sequelize'][_0x6acc('0x51')](function(_0x244eb8){return db[_0x6acc('0x53')][_0x6acc('0x44')]({'where':{'userProfileId':_0x2c459a[_0x6acc('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x24701f){if(_0x24701f){return db[_0x6acc('0x53')][_0x6acc('0x28')]({'where':{'userProfileId':_0x2c459a[_0x6acc('0x46')]['id'],'id':_[_0x6acc('0x2d')](_0x24701f,function(_0x2b0a4d){return _0x2b0a4d['id'];})},'transaction':_0x244eb8});}})[_0x6acc('0x27')](function(_0x4849c2){var _0x1a141a=_[_0x6acc('0x2d')](_0x2c459a[_0x6acc('0x4a')],function(_0x383521){_0x383521[_0x6acc('0x56')]=_0x2c459a[_0x6acc('0x46')]['id'];return _0x383521;});return db[_0x6acc('0x53')]['bulkCreate'](_0x1a141a,{'raw':!![],'transaction':_0x244eb8});})[_0x6acc('0x27')](function(_0x1ea3c1){var _0x1c17eb=_['filter'](_[_0x6acc('0x2d')](_0x1ea3c1,function(_0x54d1d2){return _0x54d1d2['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1c17eb){return db[_0x6acc('0x53')][_0x6acc('0x44')]({'where':{'userProfileId':_0x2c459a[_0x6acc('0x46')]['id'],'sectionId':_[_0x6acc('0x2d')](_0x1c17eb,function(_0x440ab7){return _0x440ab7['sectionId'];})},'attributes':['id',_0x6acc('0x55')],'raw':!![]})[_0x6acc('0x27')](function(_0x19b1e1){var _0x4a4864=_['map'](_0x2c459a['body'],function(_0x3f356b){_0x3f356b[_0x6acc('0x56')]=_0x2c459a['params']['id'];return _0x3f356b;});return db[_0x6acc('0x58')]['bulkCreate'](_0x4a4864,{'raw':!![],'transaction':_0x244eb8});});}})[_0x6acc('0x45')](handleError(_0x133ca2,null));});}})[_0x6acc('0x27')](function(_0x493377){var _0x30d1c5=_[_0x6acc('0x2d')](_0x493377,function(_0xf3f99e){return _0xf3f99e['get']({'plain':!![]});});})['then'](respondWithResult(_0x133ca2,null))[_0x6acc('0x45')](handleError(_0x133ca2,null));};exports['removeResources']=function(_0x7d1955,_0xbdcb5d,_0x68ecfa){return db['UserProfile'][_0x6acc('0x48')]({'where':{'id':_0x7d1955['params']['id']}})['then'](handleEntityNotFound(_0xbdcb5d,null))['then'](function(_0xbe73ef){if(_0xbe73ef){return _0xbe73ef['removeResources'](_0x7d1955[_0x6acc('0x33')]['ids']);}})['then'](respondWithStatusCode(_0xbdcb5d,null))[_0x6acc('0x45')](handleError(_0xbdcb5d,null));};exports[_0x6acc('0x6a')]=function(_0xb5f64c,_0x4da24b){var _0x37200e={};if(!_0xb5f64c[_0x6acc('0x33')][_0x6acc('0x6b')])throw new Error('Missing\x20section\x20parameter');if(!_0xb5f64c['query'][_0x6acc('0x39')](_0x6acc('0x3a'))){_0x37200e['limit']=qs[_0x6acc('0x22')](_0xb5f64c['query'][_0x6acc('0x22')]);_0x37200e[_0x6acc('0x3b')]=qs['offset'](_0xb5f64c[_0x6acc('0x33')][_0x6acc('0x3b')]);}return db[_0x6acc('0x2e')][_0x6acc('0x48')]({'where':{'id':_0xb5f64c[_0x6acc('0x46')]['id']}})[_0x6acc('0x27')](function(_0x37f9cf){if(!_0x37f9cf)throw new Error(_0x6acc('0x6c')+_0xb5f64c[_0x6acc('0x46')]['id']);return db[_0x6acc('0x2e')][_0x6acc('0x6a')](_0xb5f64c);})[_0x6acc('0x27')](respondWithFilteredResult(_0x4da24b,_0x37200e))[_0x6acc('0x45')](handleError(_0x4da24b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e7892a6..368d145 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 _0xacf4=['update','remove','emit','hasOwnProperty','hook','exports','UserProfile','setMaxListeners','save'];(function(_0x4f2986,_0xfdc46b){var _0x2ed634=function(_0x37de5d){while(--_0x37de5d){_0x4f2986['push'](_0x4f2986['shift']());}};_0x2ed634(++_0xfdc46b);}(_0xacf4,0xe7));var _0x4acf=function(_0x2b771e,_0x36c9ae){_0x2b771e=_0x2b771e-0x0;var _0x34d59c=_0xacf4[_0x2b771e];return _0x34d59c;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x4acf('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4acf('0x1')](0x0);var events={'afterCreate':_0x4acf('0x2'),'afterUpdate':_0x4acf('0x3'),'afterDestroy':_0x4acf('0x4')};function emitEvent(_0x4138f0){return function(_0x145264,_0x5cf22d,_0x380435){UserProfileEvents[_0x4acf('0x5')](_0x4138f0+':'+_0x145264['id'],_0x145264);UserProfileEvents['emit'](_0x4138f0,_0x145264);_0x380435(null);};}for(var e in events){if(events[_0x4acf('0x6')](e)){var event=events[e];UserProfile[_0x4acf('0x7')](e,emitEvent(event));}}module[_0x4acf('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x3fc6=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','UserProfile'];(function(_0x334c0d,_0x42ab7d){var _0x20ab22=function(_0x12ef20){while(--_0x12ef20){_0x334c0d['push'](_0x334c0d['shift']());}};_0x20ab22(++_0x42ab7d);}(_0x3fc6,0x115));var _0x63fc=function(_0x504cf3,_0x81c843){_0x504cf3=_0x504cf3-0x0;var _0x27f1f6=_0x3fc6[_0x504cf3];return _0x27f1f6;};'use strict';var EventEmitter=require(_0x63fc('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x63fc('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x63fc('0x2')](0x0);var events={'afterCreate':_0x63fc('0x3'),'afterUpdate':_0x63fc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3ceadb){return function(_0x26d57e,_0x237af7,_0x5ce071){UserProfileEvents[_0x63fc('0x5')](_0x3ceadb+':'+_0x26d57e['id'],_0x26d57e);UserProfileEvents['emit'](_0x3ceadb,_0x26d57e);_0x5ce071(null);};}for(var e in events){if(events[_0x63fc('0x6')](e)){var event=events[e];UserProfile[_0x63fc('0x7')](e,emitEvent(event));}}module[_0x63fc('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b39923f..bd361d5 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 _0xaee8=['custom','count','rows','Tags','tag','ThroughTags','color','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','./userProfile.attributes','squel','exports','models','filter','value','findAll','then','map','catch','field','model','associatedResources','name','resolve','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','Telephones','telephone','queue','VoiceQueue','type','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','tags','Tag','templates','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','select','InteractionId','ui.createdAt','from','_interactions','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','all','union','ignore','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','sort','where','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','DefaultReports'];(function(_0xd1f920,_0x18dbc8){var _0x11fd3c=function(_0x550f37){while(--_0x550f37){_0xd1f920['push'](_0xd1f920['shift']());}};_0x11fd3c(++_0x18dbc8);}(_0xaee8,0xcb));var _0x8aee=function(_0x38ed42,_0x3d9a37){_0x38ed42=_0x38ed42-0x0;var _0x474931=_0xaee8[_0x38ed42];return _0x474931;};'use strict';var _=require('lodash');var attributes=require(_0x8aee('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x8aee('0x1'));module[_0x8aee('0x2')]=function(_0x4e6040){var _0x326726=_0x4e6040[_0x8aee('0x3')];function _0x343f72(_0xb5af5,_0x390566){return new Promise(function(_0x5953d4,_0x469523){if(!_0x390566)return _0x5953d4(null);var _0x1482b5=_0x390566[_0x8aee('0x4')]?{[_0x390566[_0x8aee('0x4')]['field']]:_0x390566[_0x8aee('0x4')][_0x8aee('0x5')]}:undefined;return _0x326726[_0xb5af5][_0x8aee('0x6')]({'where':_0x1482b5,'raw':!![]})[_0x8aee('0x7')](function(_0x2da088){_0x390566['associatedResources']=_[_0x8aee('0x8')](_0x2da088,'id');_0x5953d4(_0x390566);})[_0x8aee('0x9')](function(_0x58665c){_0x469523(_0x58665c);});});}function _0x5e2ada(_0x561d0a,_0x49ec72){return new Promise(function(_0x33d024,_0x5a3790){var _0x2bf398=_0x561d0a[_0x8aee('0x4')]?{[_0x561d0a[_0x8aee('0x4')][_0x8aee('0xa')]]:_0x561d0a[_0x8aee('0x4')][_0x8aee('0x5')]}:undefined;return _0x326726[_0x561d0a[_0x8aee('0xb')]][_0x8aee('0x6')]({'where':_0x2bf398,'raw':!![]})[_0x8aee('0x7')](function(_0x510c97){_0x49ec72[_0x8aee('0xc')]=_[_0x8aee('0x8')](_0x510c97,function(_0x519df7){return _0x519df7[_0x8aee('0xd')];});_0x33d024(_0x49ec72);})[_0x8aee('0x9')](function(_0x324d0f){_0x5a3790(_0x324d0f);});});}function _0x48332b(_0x7169f1,_0x1ac4e6,_0x222d01){if(!_0x1ac4e6)return Promise[_0x8aee('0xe')](null);return new Promise(function(_0x1479b3,_0x2e4778){return _0x326726['UserProfileResource'][_0x8aee('0x6')]({'where':{'sectionId':_0x1ac4e6['id']},'raw':!![]})[_0x8aee('0x7')](function(_0x170041){if(_0x7169f1[_0x8aee('0xa')]&&_0x7169f1[_0x8aee('0xa')]!=='id'){_0x1ac4e6['associatedResources']=_[_0x8aee('0x8')](_0x170041,function(_0x326487){return _0x326487[_0x7169f1[_0x8aee('0xa')]];});}else{if(_0x222d01===_0x8aee('0xf')){_0x1ac4e6['associatedResources']=_[_0x8aee('0x8')](_0x170041,function(_0x48422c){return{'id':_0x48422c[_0x8aee('0x10')],'type':_0x48422c['type']};});}else{_0x1ac4e6[_0x8aee('0xc')]=_['map'](_0x170041,function(_0x4f3469){return _0x4f3469['resourceId'];});}}_0x1479b3(_0x1ac4e6);})[_0x8aee('0x9')](function(_0x31f5d7){_0x2e4778(_0x31f5d7);});});}function _0x132ac8(_0x5dc264,_0x413624){var _0x316427={'parentSections':[]};switch(_0x5dc264[_0x8aee('0x11')]()){case _0x8aee('0x12'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x14');break;case _0x8aee('0x15'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x16');break;case _0x8aee('0x17'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x18');_0x316427[_0x8aee('0x19')]=[{'name':_0x8aee('0x1a'),'field':_0x8aee('0xd'),'foreignKey':_0x8aee('0x1b')}];break;case'projects':_0x316427['childModel']='JscriptyProject';break;case _0x8aee('0x1c'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x1d');_0x316427[_0x8aee('0x19')]=[{'name':_0x8aee('0x1e'),'field':'id','foreignKey':_0x8aee('0x1f')}];break;case _0x8aee('0x20'):_0x316427['childModel']=_0x8aee('0x21');break;case _0x8aee('0x22'):_0x316427[_0x8aee('0x13')]='CmCompany';break;case'globalcustomfields':_0x316427[_0x8aee('0x13')]=_0x8aee('0x23');break;case _0x8aee('0x24'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x25');break;case _0x8aee('0x26'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x27');break;case _0x8aee('0x28'):_0x316427[_0x8aee('0x13')]='FaxQueue';break;case _0x8aee('0x29'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x2a');break;case'inboundroutes':case _0x8aee('0x2b'):case _0x8aee('0x2c'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x2d');break;case _0x8aee('0x2e'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x2f');break;case _0x8aee('0x30'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x31');break;case _0x8aee('0x32'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x33');_0x316427[_0x8aee('0x19')]=[{'name':'Agents','field':_0x8aee('0xd'),'foreignKey':_0x8aee('0x34'),'model':_0x8aee('0x35'),'filter':{'field':_0x8aee('0x36'),'value':['agent']}},{'name':_0x8aee('0x37'),'field':'name','foreignKey':_0x8aee('0x34'),'model':'User','filter':{'field':_0x8aee('0x36'),'value':[_0x8aee('0x38')]}},{'name':'VoiceQueues','field':_0x8aee('0xd'),'foreignKey':_0x8aee('0x39'),'model':_0x8aee('0x3a'),'filter':{'field':_0x8aee('0x3b'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x8aee('0xd'),'foreignKey':_0x8aee('0x39'),'model':_0x8aee('0x3a'),'filter':{'field':'type','value':[_0x8aee('0x3c')]}}];break;case'musiconholds':_0x316427['childModel']=_0x8aee('0x3d');break;case _0x8aee('0x3e'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x3f');break;case'voiceprefixes':_0x316427[_0x8aee('0x13')]='VoicePrefix';break;case _0x8aee('0x40'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x41');break;case _0x8aee('0x42'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x43');break;case _0x8aee('0x44'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x45');break;case'mailsubstatuses':_0x316427[_0x8aee('0x13')]='MailSubstatus';break;case _0x8aee('0x46'):_0x316427[_0x8aee('0x13')]='OpenchannelQueue';break;case'openchannelaccounts':_0x316427[_0x8aee('0x13')]='OpenchannelAccount';break;case _0x8aee('0x47'):_0x316427['childModel']=_0x8aee('0x48');break;case _0x8aee('0x49'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x4a');break;case _0x8aee('0x4b'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x4c');break;case _0x8aee('0x4d'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x4e');break;case _0x8aee('0x4f'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x50');break;case _0x8aee('0x51'):case _0x8aee('0x52'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x3a');if(_0x413624){_0x316427[_0x8aee('0x19')]=[{'name':_0x8aee('0x53')},{'name':_0x8aee('0x54')}];}break;case _0x8aee('0x55'):case _0x8aee('0x56'):case'telephones':_0x316427[_0x8aee('0x13')]=_0x8aee('0x35');if(_0x413624){_0x316427['parentSections']=[{'name':_0x8aee('0x57'),'filter':{'field':'role','value':[_0x8aee('0x58'),_0x8aee('0x59')]},'ignore':!![]},{'name':'Agents'},{'name':_0x8aee('0x37')}];}break;case _0x8aee('0x5a'):_0x316427[_0x8aee('0x13')]='ZendeskAccount';break;case _0x8aee('0x5b'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x5c');break;case _0x8aee('0x5d'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x5e');break;case'sugarcrmaccounts':_0x316427[_0x8aee('0x13')]=_0x8aee('0x5f');break;case _0x8aee('0x60'):_0x316427['childModel']=_0x8aee('0x61');break;case _0x8aee('0x62'):_0x316427['childModel']=_0x8aee('0x63');break;case'vtigeraccounts':_0x316427[_0x8aee('0x13')]='User';break;case'cannedanswers':_0x316427['childModel']=_0x8aee('0x64');break;case _0x8aee('0x65'):_0x316427['childModel']=_0x8aee('0x66');break;case _0x8aee('0x67'):_0x316427['childModel']=_0x8aee('0x68');break;case _0x8aee('0x69'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x6a');break;case _0x8aee('0x6b'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x6c');break;case _0x8aee('0x6d'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x6e');break;case'sounds':_0x316427[_0x8aee('0x13')]='Sound';break;case _0x8aee('0x6f'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x70');break;case _0x8aee('0x71'):_0x316427['childModel']='Template';break;case'triggers':_0x316427[_0x8aee('0x13')]=_0x8aee('0x72');break;case _0x8aee('0x73'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x74');break;case _0x8aee('0x75'):_0x316427[_0x8aee('0x13')]='Variable';break;case _0x8aee('0x76'):_0x316427['childModel']=_0x8aee('0x77');break;case _0x8aee('0x78'):_0x316427[_0x8aee('0x13')]='AnalyticExtractedReport';_0x316427[_0x8aee('0x19')]=[{'name':'Reports','field':'id','foreignKey':_0x8aee('0x79')}];break;case _0x8aee('0x7a'):_0x316427[_0x8aee('0x13')]=_0x8aee('0x7b');break;}return _0x316427;}function _0x303f3d(_0x32a193,_0xc238b6){var _0x18170e=_0x32a193[_0x8aee('0x7c')](0x0)['toUpperCase']()+_0x32a193[_0x8aee('0x7d')](0x1);var _0x27c9cc={'type':_0x326726[_0x8aee('0x7e')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x96102e,_0x379c4f){var _0x58d202=squel[_0x8aee('0x7f')]()[_0x8aee('0xa')]('ui.'+_0x18170e+_0x8aee('0x80'),'id')[_0x8aee('0xa')](_0x8aee('0x81'))[_0x8aee('0x82')]('user_has_'+_0x32a193+_0x8aee('0x83'),'ui')['where']('ui.UserId\x20=\x20?',_0xc238b6['id']);return _0x326726[_0x8aee('0x84')][_0x8aee('0x85')](_0x58d202[_0x8aee('0x86')](),_0x27c9cc)[_0x8aee('0x7')](function(_0x1e34cb){_0xc238b6[_0x18170e+_0x8aee('0x87')]=_0x1e34cb;_0x96102e(_0x1e34cb);})[_0x8aee('0x9')](function(_0x33a797){_0x379c4f(_0x33a797);});});}return _0x4e6040[_0x8aee('0x88')](_0x8aee('0x89'),attributes,{'tableName':_0x8aee('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x28ecec){var _0x5e60d2={'raw':_0x28ecec[_0x8aee('0x85')][_0x8aee('0x8b')],'where':{}};var _0xd5cc47={};var _0x4d0466={'count':0x0,'rows':[]};var _0x4a85d6=_0x28ecec[_0x8aee('0x85')][_0x8aee('0x8c')];var _0x48a157=_0x28ecec['query'][_0x8aee('0x8d')]||![];var _0x46c3cd=_0x132ac8(_0x4a85d6,_0x48a157);if(!_0x46c3cd[_0x8aee('0x13')])throw new Error(_0x8aee('0x8e')+_0x4a85d6+'\x27');var _0x2fad2d=[{'name':_0x4a85d6}];if(!_[_0x8aee('0x8f')](_0x46c3cd[_0x8aee('0x19')]))_0x2fad2d=_0x46c3cd[_0x8aee('0x19')];var _0x2c9de8=[];for(var _0x5b8e49=0x0;_0x5b8e49<_0x2fad2d[_0x8aee('0x90')];_0x5b8e49++){_0x2c9de8[_0x8aee('0x91')](_0x326726[_0x8aee('0x92')][_0x8aee('0x93')]({'where':{'userProfileId':_0x28ecec['params']['id'],'name':_0x2fad2d[_0x5b8e49][_0x8aee('0xd')]},'raw':!![]}));}return Promise[_0x8aee('0x94')](_0x2c9de8)[_0x8aee('0x7')](function(_0x2896de){var _0x5297ca=_[_0x8aee('0x4')](_0x2896de,function(_0x599b56){return _0x599b56?_0x599b56:undefined;});var _0x33c037=_[_0x8aee('0x4')](_0x2fad2d,['ignore',!![]]);var _0x458527=_[_0x8aee('0x8f')](_0x5297ca)&&_[_0x8aee('0x8f')](_0x33c037)?null:_[_0x8aee('0x95')](_0x33c037,_0x5297ca);if(!_0x458527)return null;var _0x4404de=[];for(var _0x30e6cf=0x0;_0x30e6cf<_0x458527[_0x8aee('0x90')];_0x30e6cf++){var _0x1b6174=_[_0x8aee('0x93')](_0x2fad2d,function(_0x4ac256){return _0x458527[_0x30e6cf]?_0x4ac256['name']===_0x458527[_0x30e6cf][_0x8aee('0xd')]:null;});if(_0x1b6174){if(_0x458527[_0x30e6cf][_0x8aee('0x96')]){_0x4404de['push'](_0x343f72(_0x46c3cd['childModel'],_0x458527[_0x30e6cf]));}else{if(!_0x458527[_0x30e6cf][_0x8aee('0x97')]){_0x4404de['push'](_0x48332b(_0x1b6174,_0x458527[_0x30e6cf],_0x46c3cd[_0x8aee('0x13')]));}else{if(_0x1b6174[_0x8aee('0xb')]){_0x4404de[_0x8aee('0x91')](_0x5e2ada(_0x1b6174,_0x458527[_0x30e6cf]));}}}}}return Promise[_0x8aee('0x94')](_0x4404de);})[_0x8aee('0x7')](function(_0x533532){var _0x2f292e=_0x533532;var _0x288322=null;if(_0x2f292e){_0x288322=_0x2f292e['length']===0x1?_0x2f292e[0x0]:null;}if(!_0x288322&&!_0x2f292e)return _0x4d0466;var _0xb0c26a=_0x326726[_0x46c3cd[_0x8aee('0x13')]][_0x8aee('0x98')];_0xd5cc47[_0x8aee('0xb')]=_[_0x8aee('0x99')](_0xb0c26a);_0xd5cc47[_0x8aee('0x85')]=_[_0x8aee('0x99')](_0x28ecec[_0x8aee('0x85')]);_0xd5cc47[_0x8aee('0x9a')]=_['intersection'](_0xd5cc47[_0x8aee('0xb')],_0xd5cc47['query']);_0x5e60d2[_0x8aee('0x9b')]=_[_0x8aee('0x9c')](_0xd5cc47[_0x8aee('0xb')],qs[_0x8aee('0x9d')](_0x28ecec['query']['fields']));_0x5e60d2[_0x8aee('0x9b')]=_0x5e60d2[_0x8aee('0x9b')][_0x8aee('0x90')]?_0x5e60d2[_0x8aee('0x9b')]:_0xd5cc47[_0x8aee('0xb')];if(!_0x28ecec[_0x8aee('0x85')][_0x8aee('0x9e')](_0x8aee('0x9f'))){_0x5e60d2[_0x8aee('0xa0')]=qs[_0x8aee('0xa0')](_0x28ecec[_0x8aee('0x85')][_0x8aee('0xa0')]);_0x5e60d2[_0x8aee('0xa1')]=qs[_0x8aee('0xa1')](_0x28ecec['query'][_0x8aee('0xa1')]);}_0x5e60d2['order']=qs[_0x8aee('0xa2')](_0x28ecec[_0x8aee('0x85')][_0x8aee('0xa2')]);_0x5e60d2['where']=qs[_0x8aee('0x9a')](_['pick'](_0x28ecec[_0x8aee('0x85')],_0xd5cc47[_0x8aee('0x9a')]));if(_0x28ecec[_0x8aee('0x85')]['filter']){_0x5e60d2[_0x8aee('0xa3')]=_[_0x8aee('0xa4')](_0x5e60d2[_0x8aee('0xa3')],{'$or':_[_0x8aee('0x8')](_0xb0c26a,function(_0x4899ee){if(_0x4899ee[_0x8aee('0x3b')]['key']!==_0x8aee('0xa5')){var _0x103c58={};_0x103c58[_0x4899ee[_0x8aee('0xa')]]={'$like':'%'+_0x28ecec['query'][_0x8aee('0x4')]+'%'};return _0x103c58;}})});}var _0x517b4c=[];var _0x4d8900=null;var _0x5d6900={};if(_0x288322){_0x4d8900=_[_0x8aee('0x93')](_0x2fad2d,[_0x8aee('0xd'),_0x288322[_0x8aee('0xd')]]);if(_0x4d8900['field']){_0x5d6900={};if(_0x46c3cd[_0x8aee('0x13')]===_0x8aee('0xf')){_0x5d6900[_0x4d8900[_0x8aee('0xa6')]]=_[_0x8aee('0x8')](_0x288322[_0x8aee('0xc')],'id');}else{_0x5d6900[_0x4d8900[_0x8aee('0xa6')]]=_0x288322[_0x8aee('0xc')];}_0x517b4c['push'](_0x5d6900);}else{_0x5e60d2[_0x8aee('0xa3')]['id']=_0x288322[_0x8aee('0xc')];}}else{for(var _0x46ad36=0x0;_0x46ad36<_0x2f292e[_0x8aee('0x90')];_0x46ad36++){_0x4d8900=_[_0x8aee('0x93')](_0x2fad2d,[_0x8aee('0xd'),_0x2f292e[_0x46ad36]['name']]);if(_0x4d8900[_0x8aee('0xa')]){_0x5d6900={};_0x5d6900[_0x4d8900[_0x8aee('0xa6')]]=_0x2f292e[_0x46ad36][_0x8aee('0xc')];_0x517b4c['push'](_0x5d6900);}else{if(!_0x5e60d2[_0x8aee('0xa3')]['id'])_0x5e60d2['where']['id']=[];_0x2f292e[_0x46ad36][_0x8aee('0xc')][_0x8aee('0xa7')](function(_0x32ead0){_0x5e60d2[_0x8aee('0xa3')]['id']['push'](_0x32ead0);});}}}if(!_[_0x8aee('0x8f')](_0x517b4c)){_0x5e60d2[_0x8aee('0xa3')]=_[_0x8aee('0xa4')](_0x5e60d2[_0x8aee('0xa3')],{'$and':{'$or':_0x517b4c}});}_0x5e60d2=_[_0x8aee('0xa4')]({},_0x5e60d2,_0x28ecec[_0x8aee('0xa8')]);if(_0x288322&&!_0x288322[_0x8aee('0x97')]&&_0x46c3cd['childModel']===_0x8aee('0xf')){if(_0x28ecec[_0x8aee('0x85')][_0x8aee('0xa9')]){_0x5e60d2[_0x8aee('0xaa')]=[{'all':!![]}];}return _0x326726[_0x46c3cd[_0x8aee('0x13')]][_0x8aee('0x6')](_0x5e60d2)['then'](function(_0x2a0c37){var _0xe7714a=[];_0x2a0c37[_0x8aee('0xa7')](function(_0x10fd77){var _0x2b5033;switch(_0x10fd77[_0x8aee('0xab')]){case'default':_0x2b5033=_['find'](_0x288322['associatedResources'],function(_0x421324){return _0x421324['id']===_0x10fd77[_0x8aee('0x79')]&&_0x421324[_0x8aee('0x3b')]===_0x8aee('0xac');});break;case _0x8aee('0xad'):_0x2b5033=_[_0x8aee('0x93')](_0x288322[_0x8aee('0xc')],function(_0x355dd5){return _0x355dd5['id']===_0x10fd77['reportId']&&_0x355dd5[_0x8aee('0x3b')]==='CustomReports';});break;}if(_0x2b5033)_0xe7714a['push'](_0x10fd77);});_0x4d0466[_0x8aee('0xae')]=_0xe7714a[_0x8aee('0x90')];_0x4d0466[_0x8aee('0xaf')]=_0xe7714a;return _0x4d0466;});}else{return _0x326726[_0x46c3cd[_0x8aee('0x13')]][_0x8aee('0xae')]({'where':_0x5e60d2[_0x8aee('0xa3')]})[_0x8aee('0x7')](function(_0x268b2e){_0x4d0466[_0x8aee('0xae')]=_0x268b2e;if(_0x28ecec[_0x8aee('0x85')][_0x8aee('0xa9')]){if(_0x46c3cd[_0x8aee('0x13')]===_0x8aee('0x1d')){_0x5e60d2['include']=[{'model':_0x326726[_0x8aee('0x70')],'as':_0x8aee('0xb0'),'attributes':['id','name','color'],'required':_0x28ecec['query'][_0x8aee('0xb1')]?!![]:![]},{'model':_0x326726['Tag'],'as':_0x8aee('0xb2'),'attributes':['id',_0x8aee('0xd'),_0x8aee('0xb3')],'through':_0x28ecec[_0x8aee('0x85')][_0x8aee('0xb1')]?{'attributes':[],'where':{'TagId':_0x28ecec[_0x8aee('0x85')][_0x8aee('0xb1')]||undefined}}:{},'required':_0x28ecec[_0x8aee('0x85')][_0x8aee('0xb1')]?!![]:![]}];}else{_0x5e60d2['include']=[{'all':!![]}];}}return _0x326726[_0x46c3cd['childModel']][_0x8aee('0x6')](_0x5e60d2);})['then'](function(_0x2326f1){_0x4d0466[_0x8aee('0xaf')]=_0x2326f1;if(_0x4a85d6==='Agents'&&_0x28ecec[_0x8aee('0x85')][_0x8aee('0xb4')]===_0x8aee('0xb5')){var _0x535665=[];for(var _0xdf6271=0x0;_0xdf6271<_0x4d0466[_0x8aee('0xaf')][_0x8aee('0x90')];_0xdf6271++){_0x535665['push'](_0x303f3d(_0x8aee('0xb6'),_0x4d0466[_0x8aee('0xaf')][_0xdf6271][_0x8aee('0xb7')]));_0x535665[_0x8aee('0x91')](_0x303f3d(_0x8aee('0xb8'),_0x4d0466[_0x8aee('0xaf')][_0xdf6271]['dataValues']));_0x535665[_0x8aee('0x91')](_0x303f3d(_0x8aee('0xb9'),_0x4d0466[_0x8aee('0xaf')][_0xdf6271][_0x8aee('0xb7')]));_0x535665[_0x8aee('0x91')](_0x303f3d(_0x8aee('0xba'),_0x4d0466['rows'][_0xdf6271][_0x8aee('0xb7')]));_0x535665[_0x8aee('0x91')](_0x303f3d('openchannel',_0x4d0466[_0x8aee('0xaf')][_0xdf6271][_0x8aee('0xb7')]));_0x535665[_0x8aee('0x91')](_0x303f3d(_0x8aee('0xbb'),_0x4d0466[_0x8aee('0xaf')][_0xdf6271][_0x8aee('0xb7')]));}return Promise[_0x8aee('0x94')](_0x535665)[_0x8aee('0x7')](function(){return _0x4d0466;});}return _0x4d0466;});}});}}});}; \ No newline at end of file +var _0x106b=['ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','queue','VoiceQueue','QueueCampaigns','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','users','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','all','union','length','find','push','autoAssociation','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','pick','key','VIRTUAL','foreignKey','forEach','merge','includeAll','include','reportType','default','DefaultReports','custom','reportId','CustomReports','count','Tags','color','tag','ThroughTags','rows','openTabs','chat','dataValues','sms','fax','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','findAll','then','associatedResources','map','catch','value','name','resolve','UserProfileResource','field','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x106b,0xa0));var _0xb106=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x106b[_0x5be795];return _0x4e8a3b;};'use strict';var _=require(_0xb106('0x0'));var attributes=require(_0xb106('0x1'));var qs=require(_0xb106('0x2'));var squel=require(_0xb106('0x3'));module['exports']=function(_0x40e519){var _0x4ee447=_0x40e519[_0xb106('0x4')];function _0x166d95(_0x1418db,_0x2136c4){return new Promise(function(_0x1d3131,_0x45f7cd){if(!_0x2136c4)return _0x1d3131(null);var _0x18fc4e=_0x2136c4[_0xb106('0x5')]?{[_0x2136c4['filter']['field']]:_0x2136c4[_0xb106('0x5')]['value']}:undefined;return _0x4ee447[_0x1418db][_0xb106('0x6')]({'where':_0x18fc4e,'raw':!![]})[_0xb106('0x7')](function(_0xf42212){_0x2136c4[_0xb106('0x8')]=_[_0xb106('0x9')](_0xf42212,'id');_0x1d3131(_0x2136c4);})[_0xb106('0xa')](function(_0x246211){_0x45f7cd(_0x246211);});});}function _0x150502(_0x435b10,_0x290bdd){return new Promise(function(_0x1e4874,_0x43471c){var _0x3cd347=_0x435b10['filter']?{[_0x435b10[_0xb106('0x5')]['field']]:_0x435b10[_0xb106('0x5')][_0xb106('0xb')]}:undefined;return _0x4ee447[_0x435b10['model']][_0xb106('0x6')]({'where':_0x3cd347,'raw':!![]})[_0xb106('0x7')](function(_0x2b0259){_0x290bdd[_0xb106('0x8')]=_[_0xb106('0x9')](_0x2b0259,function(_0x3d3279){return _0x3d3279[_0xb106('0xc')];});_0x1e4874(_0x290bdd);})['catch'](function(_0x20340d){_0x43471c(_0x20340d);});});}function _0x33a37b(_0x4d0043,_0x4fec0e,_0x48c47b){if(!_0x4fec0e)return Promise[_0xb106('0xd')](null);return new Promise(function(_0x524bba,_0x1b10f9){return _0x4ee447[_0xb106('0xe')][_0xb106('0x6')]({'where':{'sectionId':_0x4fec0e['id']},'raw':!![]})['then'](function(_0x24301e){if(_0x4d0043[_0xb106('0xf')]&&_0x4d0043[_0xb106('0xf')]!=='id'){_0x4fec0e[_0xb106('0x8')]=_[_0xb106('0x9')](_0x24301e,function(_0x3cef8e){return _0x3cef8e[_0x4d0043[_0xb106('0xf')]];});}else{if(_0x48c47b===_0xb106('0x10')){_0x4fec0e[_0xb106('0x8')]=_[_0xb106('0x9')](_0x24301e,function(_0xc91552){return{'id':_0xc91552[_0xb106('0x11')],'type':_0xc91552[_0xb106('0x12')]};});}else{_0x4fec0e['associatedResources']=_[_0xb106('0x9')](_0x24301e,function(_0x307614){return _0x307614[_0xb106('0x11')];});}}_0x524bba(_0x4fec0e);})['catch'](function(_0x267b53){_0x1b10f9(_0x267b53);});});}function _0x197f62(_0x514d55,_0x46cf74){var _0x24dace={'parentSections':[]};switch(_0x514d55[_0xb106('0x13')]()){case _0xb106('0x14'):_0x24dace[_0xb106('0x15')]='SquareProject';break;case _0xb106('0x16'):_0x24dace['childModel']=_0xb106('0x17');break;case _0xb106('0x18'):_0x24dace[_0xb106('0x15')]=_0xb106('0x19');_0x24dace[_0xb106('0x1a')]=[{'name':_0xb106('0x1b'),'field':'name','foreignKey':_0xb106('0x1c')}];break;case'projects':_0x24dace[_0xb106('0x15')]=_0xb106('0x1d');break;case _0xb106('0x1e'):_0x24dace['childModel']=_0xb106('0x1f');_0x24dace[_0xb106('0x1a')]=[{'name':_0xb106('0x20'),'field':'id','foreignKey':_0xb106('0x21')}];break;case _0xb106('0x22'):_0x24dace[_0xb106('0x15')]=_0xb106('0x23');break;case _0xb106('0x24'):_0x24dace[_0xb106('0x15')]=_0xb106('0x25');break;case _0xb106('0x26'):_0x24dace[_0xb106('0x15')]=_0xb106('0x27');break;case _0xb106('0x28'):_0x24dace[_0xb106('0x15')]=_0xb106('0x29');break;case _0xb106('0x2a'):_0x24dace[_0xb106('0x15')]=_0xb106('0x2b');break;case'faxqueues':_0x24dace[_0xb106('0x15')]=_0xb106('0x2c');break;case _0xb106('0x2d'):_0x24dace[_0xb106('0x15')]=_0xb106('0x2e');break;case _0xb106('0x2f'):case _0xb106('0x30'):case'outboundroutes':_0x24dace[_0xb106('0x15')]='VoiceExtension';break;case _0xb106('0x31'):_0x24dace['childModel']=_0xb106('0x32');break;case _0xb106('0x33'):_0x24dace[_0xb106('0x15')]=_0xb106('0x34');break;case _0xb106('0x35'):_0x24dace[_0xb106('0x15')]=_0xb106('0x36');_0x24dace[_0xb106('0x1a')]=[{'name':_0xb106('0x37'),'field':_0xb106('0xc'),'foreignKey':_0xb106('0x38'),'model':'User','filter':{'field':_0xb106('0x39'),'value':[_0xb106('0x3a')]}},{'name':_0xb106('0x3b'),'field':_0xb106('0xc'),'foreignKey':_0xb106('0x38'),'model':_0xb106('0x3c'),'filter':{'field':_0xb106('0x39'),'value':[_0xb106('0x3d')]}},{'name':'VoiceQueues','field':_0xb106('0xc'),'foreignKey':_0xb106('0x3e'),'model':_0xb106('0x3f'),'filter':{'field':_0xb106('0x12'),'value':['inbound']}},{'name':_0xb106('0x40'),'field':_0xb106('0xc'),'foreignKey':_0xb106('0x3e'),'model':_0xb106('0x3f'),'filter':{'field':_0xb106('0x12'),'value':['outbound']}}];break;case'musiconholds':_0x24dace[_0xb106('0x15')]='VoiceMusicOnHold';break;case _0xb106('0x41'):_0x24dace[_0xb106('0x15')]=_0xb106('0x42');break;case _0xb106('0x43'):_0x24dace['childModel']=_0xb106('0x44');break;case _0xb106('0x45'):_0x24dace[_0xb106('0x15')]=_0xb106('0x46');break;case _0xb106('0x47'):_0x24dace[_0xb106('0x15')]=_0xb106('0x48');break;case _0xb106('0x49'):_0x24dace[_0xb106('0x15')]='MailAccount';break;case _0xb106('0x4a'):_0x24dace[_0xb106('0x15')]=_0xb106('0x4b');break;case _0xb106('0x4c'):_0x24dace[_0xb106('0x15')]='OpenchannelQueue';break;case _0xb106('0x4d'):_0x24dace[_0xb106('0x15')]=_0xb106('0x4e');break;case _0xb106('0x4f'):_0x24dace[_0xb106('0x15')]=_0xb106('0x50');break;case _0xb106('0x51'):_0x24dace[_0xb106('0x15')]='SmsAccount';break;case'whatsappqueues':_0x24dace[_0xb106('0x15')]=_0xb106('0x52');break;case _0xb106('0x53'):_0x24dace[_0xb106('0x15')]=_0xb106('0x54');break;case _0xb106('0x55'):_0x24dace[_0xb106('0x15')]=_0xb106('0x56');break;case'voicequeues':case _0xb106('0x57'):_0x24dace[_0xb106('0x15')]=_0xb106('0x3f');if(_0x46cf74){_0x24dace[_0xb106('0x1a')]=[{'name':_0xb106('0x58')},{'name':_0xb106('0x40')}];}break;case _0xb106('0x59'):case'agents':case'telephones':_0x24dace['childModel']=_0xb106('0x3c');if(_0x46cf74){_0x24dace[_0xb106('0x1a')]=[{'name':_0xb106('0x5a'),'filter':{'field':_0xb106('0x39'),'value':[_0xb106('0x5b'),_0xb106('0x5c')]},'ignore':!![]},{'name':_0xb106('0x37')},{'name':'Telephones'}];}break;case _0xb106('0x5d'):_0x24dace[_0xb106('0x15')]=_0xb106('0x5e');break;case _0xb106('0x5f'):_0x24dace[_0xb106('0x15')]='SalesforceAccount';break;case _0xb106('0x60'):_0x24dace[_0xb106('0x15')]='FreshdeskAccount';break;case _0xb106('0x61'):_0x24dace['childModel']=_0xb106('0x62');break;case _0xb106('0x63'):_0x24dace['childModel']='DeskAccount';break;case _0xb106('0x64'):_0x24dace[_0xb106('0x15')]=_0xb106('0x65');break;case _0xb106('0x66'):_0x24dace['childModel']=_0xb106('0x3c');break;case _0xb106('0x67'):_0x24dace['childModel']='CannedAnswer';break;case _0xb106('0x68'):_0x24dace[_0xb106('0x15')]=_0xb106('0x69');break;case _0xb106('0x6a'):_0x24dace['childModel']='Dashboard';break;case'intervals':_0x24dace[_0xb106('0x15')]=_0xb106('0x6b');break;case _0xb106('0x6c'):_0x24dace[_0xb106('0x15')]=_0xb106('0x6d');break;case _0xb106('0x6e'):_0x24dace[_0xb106('0x15')]=_0xb106('0x6f');break;case _0xb106('0x70'):_0x24dace['childModel']='Sound';break;case _0xb106('0x71'):_0x24dace[_0xb106('0x15')]=_0xb106('0x72');break;case _0xb106('0x73'):_0x24dace[_0xb106('0x15')]=_0xb106('0x74');break;case _0xb106('0x75'):_0x24dace['childModel']=_0xb106('0x76');break;case _0xb106('0x77'):_0x24dace[_0xb106('0x15')]='Trunk';break;case'variables':_0x24dace[_0xb106('0x15')]=_0xb106('0x78');break;case _0xb106('0x79'):_0x24dace[_0xb106('0x15')]='Plugin';break;case _0xb106('0x7a'):_0x24dace['childModel']=_0xb106('0x10');_0x24dace['parentSections']=[{'name':_0xb106('0x7b'),'field':'id','foreignKey':'reportId'}];break;case _0xb106('0x7c'):_0x24dace[_0xb106('0x15')]=_0xb106('0x7d');break;}return _0x24dace;}function _0x5c9430(_0x28c0bf,_0x59cc28){var _0x1d80d6=_0x28c0bf[_0xb106('0x7e')](0x0)[_0xb106('0x7f')]()+_0x28c0bf['slice'](0x1);var _0x35fa8c={'type':_0x4ee447[_0xb106('0x80')][_0xb106('0x81')][_0xb106('0x82')],'raw':!![]};return new Promise(function(_0x214b4c,_0x3380ac){var _0x441d6e=squel[_0xb106('0x83')]()[_0xb106('0xf')]('ui.'+_0x1d80d6+_0xb106('0x84'),'id')[_0xb106('0xf')](_0xb106('0x85'))[_0xb106('0x86')](_0xb106('0x87')+_0x28c0bf+_0xb106('0x88'),'ui')[_0xb106('0x89')](_0xb106('0x8a'),_0x59cc28['id']);return _0x4ee447[_0xb106('0x8b')][_0xb106('0x8c')](_0x441d6e[_0xb106('0x8d')](),_0x35fa8c)['then'](function(_0x2fcedb){_0x59cc28[_0x1d80d6+_0xb106('0x8e')]=_0x2fcedb;_0x214b4c(_0x2fcedb);})['catch'](function(_0x5a54f6){_0x3380ac(_0x5a54f6);});});}return _0x40e519[_0xb106('0x8f')](_0xb106('0x90'),attributes,{'tableName':_0xb106('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf7f322){var _0x1b7dae={'raw':_0xf7f322['query'][_0xb106('0x92')],'where':{}};var _0x20b348={};var _0x488446={'count':0x0,'rows':[]};var _0x260eb1=_0xf7f322[_0xb106('0x8c')][_0xb106('0x93')];var _0xdf29e8=_0xf7f322[_0xb106('0x8c')][_0xb106('0x94')]||![];var _0x46ff67=_0x197f62(_0x260eb1,_0xdf29e8);if(!_0x46ff67[_0xb106('0x15')])throw new Error(_0xb106('0x95')+_0x260eb1+'\x27');var _0x51329b=[{'name':_0x260eb1}];if(!_[_0xb106('0x96')](_0x46ff67['parentSections']))_0x51329b=_0x46ff67[_0xb106('0x1a')];var _0x52696b=[];for(var _0x1f7c5e=0x0;_0x1f7c5e<_0x51329b['length'];_0x1f7c5e++){_0x52696b['push'](_0x4ee447[_0xb106('0x97')]['find']({'where':{'userProfileId':_0xf7f322['params']['id'],'name':_0x51329b[_0x1f7c5e][_0xb106('0xc')]},'raw':!![]}));}return Promise[_0xb106('0x98')](_0x52696b)[_0xb106('0x7')](function(_0xa3550f){var _0x5ddce0=_[_0xb106('0x5')](_0xa3550f,function(_0x5d44b5){return _0x5d44b5?_0x5d44b5:undefined;});var _0xb77e62=_[_0xb106('0x5')](_0x51329b,['ignore',!![]]);var _0x4972a2=_[_0xb106('0x96')](_0x5ddce0)&&_['isEmpty'](_0xb77e62)?null:_[_0xb106('0x99')](_0xb77e62,_0x5ddce0);if(!_0x4972a2)return null;var _0x28c76c=[];for(var _0x59aa3f=0x0;_0x59aa3f<_0x4972a2[_0xb106('0x9a')];_0x59aa3f++){var _0x5c0fe5=_[_0xb106('0x9b')](_0x51329b,function(_0x5c1965){return _0x4972a2[_0x59aa3f]?_0x5c1965[_0xb106('0xc')]===_0x4972a2[_0x59aa3f][_0xb106('0xc')]:null;});if(_0x5c0fe5){if(_0x4972a2[_0x59aa3f]['ignore']){_0x28c76c[_0xb106('0x9c')](_0x166d95(_0x46ff67['childModel'],_0x4972a2[_0x59aa3f]));}else{if(!_0x4972a2[_0x59aa3f][_0xb106('0x9d')]){_0x28c76c[_0xb106('0x9c')](_0x33a37b(_0x5c0fe5,_0x4972a2[_0x59aa3f],_0x46ff67[_0xb106('0x15')]));}else{if(_0x5c0fe5[_0xb106('0x9e')]){_0x28c76c[_0xb106('0x9c')](_0x150502(_0x5c0fe5,_0x4972a2[_0x59aa3f]));}}}}}return Promise['all'](_0x28c76c);})[_0xb106('0x7')](function(_0x58f7ba){var _0xd3fbb8=_0x58f7ba;var _0x3dcd2a=null;if(_0xd3fbb8){_0x3dcd2a=_0xd3fbb8[_0xb106('0x9a')]===0x1?_0xd3fbb8[0x0]:null;}if(!_0x3dcd2a&&!_0xd3fbb8)return _0x488446;var _0x5ccf81=_0x4ee447[_0x46ff67[_0xb106('0x15')]]['rawAttributes'];_0x20b348['model']=_['keys'](_0x5ccf81);_0x20b348[_0xb106('0x8c')]=_[_0xb106('0x9f')](_0xf7f322['query']);_0x20b348[_0xb106('0xa0')]=_[_0xb106('0xa1')](_0x20b348[_0xb106('0x9e')],_0x20b348['query']);_0x1b7dae[_0xb106('0xa2')]=_[_0xb106('0xa1')](_0x20b348[_0xb106('0x9e')],qs[_0xb106('0xa3')](_0xf7f322[_0xb106('0x8c')][_0xb106('0xa3')]));_0x1b7dae[_0xb106('0xa2')]=_0x1b7dae[_0xb106('0xa2')][_0xb106('0x9a')]?_0x1b7dae[_0xb106('0xa2')]:_0x20b348['model'];if(!_0xf7f322[_0xb106('0x8c')]['hasOwnProperty'](_0xb106('0xa4'))){_0x1b7dae[_0xb106('0xa5')]=qs[_0xb106('0xa5')](_0xf7f322[_0xb106('0x8c')]['limit']);_0x1b7dae[_0xb106('0xa6')]=qs[_0xb106('0xa6')](_0xf7f322[_0xb106('0x8c')][_0xb106('0xa6')]);}_0x1b7dae['order']=qs['sort'](_0xf7f322[_0xb106('0x8c')]['sort']);_0x1b7dae[_0xb106('0x89')]=qs[_0xb106('0xa0')](_[_0xb106('0xa7')](_0xf7f322[_0xb106('0x8c')],_0x20b348['filters']));if(_0xf7f322['query'][_0xb106('0x5')]){_0x1b7dae[_0xb106('0x89')]=_['merge'](_0x1b7dae['where'],{'$or':_['map'](_0x5ccf81,function(_0x150b6c){if(_0x150b6c[_0xb106('0x12')][_0xb106('0xa8')]!==_0xb106('0xa9')){var _0x47fbac={};_0x47fbac[_0x150b6c[_0xb106('0xf')]]={'$like':'%'+_0xf7f322[_0xb106('0x8c')][_0xb106('0x5')]+'%'};return _0x47fbac;}})});}var _0x5569f8=[];var _0x8582e8=null;var _0x24f1cf={};if(_0x3dcd2a){_0x8582e8=_[_0xb106('0x9b')](_0x51329b,[_0xb106('0xc'),_0x3dcd2a[_0xb106('0xc')]]);if(_0x8582e8[_0xb106('0xf')]){_0x24f1cf={};if(_0x46ff67[_0xb106('0x15')]==='AnalyticExtractedReport'){_0x24f1cf[_0x8582e8[_0xb106('0xaa')]]=_['map'](_0x3dcd2a['associatedResources'],'id');}else{_0x24f1cf[_0x8582e8[_0xb106('0xaa')]]=_0x3dcd2a[_0xb106('0x8')];}_0x5569f8[_0xb106('0x9c')](_0x24f1cf);}else{_0x1b7dae[_0xb106('0x89')]['id']=_0x3dcd2a[_0xb106('0x8')];}}else{for(var _0x4b4ffb=0x0;_0x4b4ffb<_0xd3fbb8[_0xb106('0x9a')];_0x4b4ffb++){_0x8582e8=_[_0xb106('0x9b')](_0x51329b,[_0xb106('0xc'),_0xd3fbb8[_0x4b4ffb][_0xb106('0xc')]]);if(_0x8582e8['field']){_0x24f1cf={};_0x24f1cf[_0x8582e8[_0xb106('0xaa')]]=_0xd3fbb8[_0x4b4ffb][_0xb106('0x8')];_0x5569f8[_0xb106('0x9c')](_0x24f1cf);}else{if(!_0x1b7dae[_0xb106('0x89')]['id'])_0x1b7dae[_0xb106('0x89')]['id']=[];_0xd3fbb8[_0x4b4ffb][_0xb106('0x8')][_0xb106('0xab')](function(_0x474557){_0x1b7dae[_0xb106('0x89')]['id'][_0xb106('0x9c')](_0x474557);});}}}if(!_[_0xb106('0x96')](_0x5569f8)){_0x1b7dae['where']=_[_0xb106('0xac')](_0x1b7dae['where'],{'$and':{'$or':_0x5569f8}});}_0x1b7dae=_[_0xb106('0xac')]({},_0x1b7dae,_0xf7f322['options']);if(_0x3dcd2a&&!_0x3dcd2a['autoAssociation']&&_0x46ff67[_0xb106('0x15')]===_0xb106('0x10')){if(_0xf7f322[_0xb106('0x8c')][_0xb106('0xad')]){_0x1b7dae[_0xb106('0xae')]=[{'all':!![]}];}return _0x4ee447[_0x46ff67['childModel']][_0xb106('0x6')](_0x1b7dae)[_0xb106('0x7')](function(_0x235e81){var _0x11d241=[];_0x235e81['forEach'](function(_0xbe4b40){var _0x1c61a8;switch(_0xbe4b40[_0xb106('0xaf')]){case _0xb106('0xb0'):_0x1c61a8=_[_0xb106('0x9b')](_0x3dcd2a[_0xb106('0x8')],function(_0x1a1acc){return _0x1a1acc['id']===_0xbe4b40['reportId']&&_0x1a1acc[_0xb106('0x12')]===_0xb106('0xb1');});break;case _0xb106('0xb2'):_0x1c61a8=_[_0xb106('0x9b')](_0x3dcd2a[_0xb106('0x8')],function(_0x1347c9){return _0x1347c9['id']===_0xbe4b40[_0xb106('0xb3')]&&_0x1347c9[_0xb106('0x12')]===_0xb106('0xb4');});break;}if(_0x1c61a8)_0x11d241[_0xb106('0x9c')](_0xbe4b40);});_0x488446[_0xb106('0xb5')]=_0x11d241[_0xb106('0x9a')];_0x488446['rows']=_0x11d241;return _0x488446;});}else{return _0x4ee447[_0x46ff67[_0xb106('0x15')]][_0xb106('0xb5')]({'where':_0x1b7dae[_0xb106('0x89')]})[_0xb106('0x7')](function(_0x1352d6){_0x488446[_0xb106('0xb5')]=_0x1352d6;if(_0xf7f322[_0xb106('0x8c')][_0xb106('0xad')]){if(_0x46ff67[_0xb106('0x15')]===_0xb106('0x1f')){_0x1b7dae[_0xb106('0xae')]=[{'model':_0x4ee447[_0xb106('0x72')],'as':_0xb106('0xb6'),'attributes':['id',_0xb106('0xc'),_0xb106('0xb7')],'required':_0xf7f322[_0xb106('0x8c')][_0xb106('0xb8')]?!![]:![]},{'model':_0x4ee447[_0xb106('0x72')],'as':_0xb106('0xb9'),'attributes':['id',_0xb106('0xc'),_0xb106('0xb7')],'through':_0xf7f322['query'][_0xb106('0xb8')]?{'attributes':[],'where':{'TagId':_0xf7f322['query']['tag']||undefined}}:{},'required':_0xf7f322[_0xb106('0x8c')][_0xb106('0xb8')]?!![]:![]}];}else{_0x1b7dae[_0xb106('0xae')]=[{'all':!![]}];}}return _0x4ee447[_0x46ff67[_0xb106('0x15')]][_0xb106('0x6')](_0x1b7dae);})[_0xb106('0x7')](function(_0x251802){_0x488446[_0xb106('0xba')]=_0x251802;if(_0x260eb1===_0xb106('0x37')&&_0xf7f322[_0xb106('0x8c')][_0xb106('0xbb')]==='true'){var _0x160583=[];for(var _0x1a9792=0x0;_0x1a9792<_0x488446[_0xb106('0xba')][_0xb106('0x9a')];_0x1a9792++){_0x160583[_0xb106('0x9c')](_0x5c9430(_0xb106('0xbc'),_0x488446['rows'][_0x1a9792][_0xb106('0xbd')]));_0x160583[_0xb106('0x9c')](_0x5c9430(_0xb106('0xbe'),_0x488446['rows'][_0x1a9792][_0xb106('0xbd')]));_0x160583[_0xb106('0x9c')](_0x5c9430(_0xb106('0xbf'),_0x488446[_0xb106('0xba')][_0x1a9792][_0xb106('0xbd')]));_0x160583[_0xb106('0x9c')](_0x5c9430('mail',_0x488446[_0xb106('0xba')][_0x1a9792]['dataValues']));_0x160583['push'](_0x5c9430('openchannel',_0x488446[_0xb106('0xba')][_0x1a9792][_0xb106('0xbd')]));_0x160583[_0xb106('0x9c')](_0x5c9430(_0xb106('0xc0'),_0x488446[_0xb106('0xba')][_0x1a9792][_0xb106('0xbd')]));}return Promise[_0xb106('0x98')](_0x160583)[_0xb106('0x7')](function(){return _0x488446;});}return _0x488446;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index f6df076..6cfd992 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 _0xd7d5=['localhost','socket.io-emitter','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x30ba61,_0x48b905){var _0x7300ad=function(_0x3b4f73){while(--_0x3b4f73){_0x30ba61['push'](_0x30ba61['shift']());}};_0x7300ad(++_0x48b905);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x116278,_0x5d5ee5){_0x116278=_0x116278-0x0;var _0x4a4b2d=_0xd7d5[_0x116278];return _0x4a4b2d;};'use strict';var _=require(_0x5d7d('0x0'));var util=require(_0x5d7d('0x1'));var moment=require(_0x5d7d('0x2'));var BPromise=require(_0x5d7d('0x3'));var rs=require(_0x5d7d('0x4'));var fs=require('fs');var Redis=require(_0x5d7d('0x5'));var db=require(_0x5d7d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d7d('0x7'))('rpc');var config=require(_0x5d7d('0x8'));var jayson=require(_0x5d7d('0x9'));var client=jayson[_0x5d7d('0xa')][_0x5d7d('0xb')]({'port':0x232a});config[_0x5d7d('0xc')]=_[_0x5d7d('0xd')](config[_0x5d7d('0xc')],{'host':_0x5d7d('0xe'),'port':0x18eb});var socket=require(_0x5d7d('0xf'))(new Redis(config[_0x5d7d('0xc')]));require('./userProfile.socket')[_0x5d7d('0x10')](socket);function respondWithRpcPromise(_0x2d1bc4,_0x32bf2c,_0x307eb8){return new BPromise(function(_0x4b890d,_0x17512e){return client[_0x5d7d('0x11')](_0x2d1bc4,_0x307eb8)[_0x5d7d('0x12')](function(_0x139664){logger['info'](_0x5d7d('0x13'),_0x32bf2c,_0x5d7d('0x14'));logger[_0x5d7d('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x32bf2c,_0x5d7d('0x14'),JSON['stringify'](_0x139664));if(_0x139664['error']){if(_0x139664['error'][_0x5d7d('0x16')]===0x1f4){logger[_0x5d7d('0x17')]('UserProfile,\x20%s,\x20%s',_0x32bf2c,_0x139664['error'][_0x5d7d('0x18')]);return _0x17512e(_0x139664[_0x5d7d('0x17')][_0x5d7d('0x18')]);}logger[_0x5d7d('0x17')](_0x5d7d('0x13'),_0x32bf2c,_0x139664['error']['message']);return _0x4b890d(_0x139664['error'][_0x5d7d('0x18')]);}else{logger[_0x5d7d('0x19')](_0x5d7d('0x13'),_0x32bf2c,_0x5d7d('0x14'));_0x4b890d(_0x139664[_0x5d7d('0x1a')][_0x5d7d('0x18')]);}})[_0x5d7d('0x1b')](function(_0x36edec){logger[_0x5d7d('0x17')](_0x5d7d('0x13'),_0x32bf2c,_0x36edec);_0x17512e(_0x36edec);});});} \ No newline at end of file +var _0xad5f=['code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xad5f,0x1a8));var _0xfad5=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xad5f[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var moment=require(_0xfad5('0x2'));var BPromise=require(_0xfad5('0x3'));var rs=require(_0xfad5('0x4'));var fs=require('fs');var Redis=require(_0xfad5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfad5('0x6'));var logger=require(_0xfad5('0x7'))(_0xfad5('0x8'));var config=require(_0xfad5('0x9'));var jayson=require(_0xfad5('0xa'));var client=jayson[_0xfad5('0xb')][_0xfad5('0xc')]({'port':0x232a});config['redis']=_[_0xfad5('0xd')](config[_0xfad5('0xe')],{'host':_0xfad5('0xf'),'port':0x18eb});var socket=require(_0xfad5('0x10'))(new Redis(config['redis']));require(_0xfad5('0x11'))[_0xfad5('0x12')](socket);function respondWithRpcPromise(_0x35e8d3,_0x84b640,_0x1baeb8){return new BPromise(function(_0x154840,_0x23d032){return client['request'](_0x35e8d3,_0x1baeb8)[_0xfad5('0x13')](function(_0x3dd0f7){logger[_0xfad5('0x14')]('UserProfile,\x20%s,\x20%s',_0x84b640,'request\x20sent');logger[_0xfad5('0x15')](_0xfad5('0x16'),_0x84b640,_0xfad5('0x17'),JSON[_0xfad5('0x18')](_0x3dd0f7));if(_0x3dd0f7[_0xfad5('0x19')]){if(_0x3dd0f7['error'][_0xfad5('0x1a')]===0x1f4){logger[_0xfad5('0x19')](_0xfad5('0x1b'),_0x84b640,_0x3dd0f7[_0xfad5('0x19')][_0xfad5('0x1c')]);return _0x23d032(_0x3dd0f7[_0xfad5('0x19')][_0xfad5('0x1c')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x84b640,_0x3dd0f7[_0xfad5('0x19')][_0xfad5('0x1c')]);return _0x154840(_0x3dd0f7[_0xfad5('0x19')][_0xfad5('0x1c')]);}else{logger[_0xfad5('0x14')](_0xfad5('0x1b'),_0x84b640,_0xfad5('0x17'));_0x154840(_0x3dd0f7[_0xfad5('0x1d')][_0xfad5('0x1c')]);}})['catch'](function(_0x492ab7){logger[_0xfad5('0x19')](_0xfad5('0x1b'),_0x84b640,_0x492ab7);_0x23d032(_0x492ab7);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 16e1006..1995dd7 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 _0x6d56=['./userProfile.events','save','remove','update','register','length','userProfile:'];(function(_0x5e0823,_0x146024){var _0x592fbb=function(_0x5ec112){while(--_0x5ec112){_0x5e0823['push'](_0x5e0823['shift']());}};_0x592fbb(++_0x146024);}(_0x6d56,0x93));var _0x66d5=function(_0x2bb8ab,_0x1f304f){_0x2bb8ab=_0x2bb8ab-0x0;var _0x3f7c08=_0x6d56[_0x2bb8ab];return _0x3f7c08;};'use strict';var UserProfileEvents=require(_0x66d5('0x0'));var events=[_0x66d5('0x1'),_0x66d5('0x2'),_0x66d5('0x3')];function createListener(_0x51c0d6,_0x246c79){return function(_0x4de2ec){_0x246c79['emit'](_0x51c0d6,_0x4de2ec);};}function removeListener(_0x119606,_0x566e47){return function(){UserProfileEvents['removeListener'](_0x119606,_0x566e47);};}exports[_0x66d5('0x4')]=function(_0x388b3c){for(var _0x584295=0x0,_0xf88f92=events[_0x66d5('0x5')];_0x584295<_0xf88f92;_0x584295++){var _0x28166d=events[_0x584295];var _0x591609=createListener(_0x66d5('0x6')+_0x28166d,_0x388b3c);UserProfileEvents['on'](_0x28166d,_0x591609);}}; \ No newline at end of file +var _0x4387=['./userProfile.events','save','remove','emit','removeListener','length'];(function(_0xde75c7,_0x567d3b){var _0x57e511=function(_0x39df62){while(--_0x39df62){_0xde75c7['push'](_0xde75c7['shift']());}};_0x57e511(++_0x567d3b);}(_0x4387,0x1bc));var _0x7438=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4387[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0x7438('0x0'));var events=[_0x7438('0x1'),_0x7438('0x2'),'update'];function createListener(_0x321783,_0x33219c){return function(_0x39c1bf){_0x33219c[_0x7438('0x3')](_0x321783,_0x39c1bf);};}function removeListener(_0x577daa,_0x2db963){return function(){UserProfileEvents[_0x7438('0x4')](_0x577daa,_0x2db963);};}exports['register']=function(_0x53e6f1){for(var _0x5a3279=0x0,_0x338088=events[_0x7438('0x5')];_0x5a3279<_0x338088;_0x5a3279++){var _0x35474d=events[_0x5a3279];var _0x40ab5b=createListener('userProfile:'+_0x35474d,_0x53e6f1);UserProfileEvents['on'](_0x35474d,_0x40ab5b);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 91a74b5..6983582 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 _0x9f1b=['describe','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x9f1b,0xbd));var _0xb9f1=function(_0x2bf299,_0x34a502){_0x2bf299=_0x2bf299-0x0;var _0x238ed8=_0x9f1b[_0x2bf299];return _0x238ed8;};'use strict';var multer=require('multer');var util=require(_0xb9f1('0x0'));var path=require('path');var timeout=require(_0xb9f1('0x1'));var express=require(_0xb9f1('0x2'));var router=express['Router']();var fs_extra=require(_0xb9f1('0x3'));var auth=require(_0xb9f1('0x4'));var interaction=require(_0xb9f1('0x5'));var config=require(_0xb9f1('0x6'));var controller=require(_0xb9f1('0x7'));router[_0xb9f1('0x8')]('/',auth[_0xb9f1('0x9')](),controller['index']);router[_0xb9f1('0x8')](_0xb9f1('0xa'),auth[_0xb9f1('0x9')](),controller[_0xb9f1('0xb')]);router[_0xb9f1('0x8')](_0xb9f1('0xc'),auth[_0xb9f1('0x9')](),controller[_0xb9f1('0xd')]);router['post']('/',auth[_0xb9f1('0x9')](),controller[_0xb9f1('0xe')]);router[_0xb9f1('0xf')](_0xb9f1('0xc'),auth[_0xb9f1('0x9')](),controller[_0xb9f1('0x10')]);router[_0xb9f1('0x11')](_0xb9f1('0xc'),auth[_0xb9f1('0x9')](),controller[_0xb9f1('0x12')]);module[_0xb9f1('0x13')]=router; \ No newline at end of file +var _0x8984=['put','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x58761e,_0x1bc5ea){var _0x449f09=function(_0x5f4580){while(--_0x5f4580){_0x58761e['push'](_0x58761e['shift']());}};_0x449f09(++_0x1bc5ea);}(_0x8984,0x16b));var _0x4898=function(_0x436916,_0x42de09){_0x436916=_0x436916-0x0;var _0x5ca56d=_0x8984[_0x436916];return _0x5ca56d;};'use strict';var multer=require(_0x4898('0x0'));var util=require('util');var path=require(_0x4898('0x1'));var timeout=require(_0x4898('0x2'));var express=require(_0x4898('0x3'));var router=express['Router']();var fs_extra=require(_0x4898('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4898('0x5'));var config=require(_0x4898('0x6'));var controller=require(_0x4898('0x7'));router[_0x4898('0x8')]('/',auth[_0x4898('0x9')](),controller[_0x4898('0xa')]);router[_0x4898('0x8')](_0x4898('0xb'),auth[_0x4898('0x9')](),controller[_0x4898('0xc')]);router[_0x4898('0x8')](_0x4898('0xd'),auth[_0x4898('0x9')](),controller[_0x4898('0xe')]);router[_0x4898('0xf')]('/',auth[_0x4898('0x9')](),controller[_0x4898('0x10')]);router[_0x4898('0x11')](_0x4898('0xd'),auth[_0x4898('0x9')](),controller['update']);router['delete'](_0x4898('0xd'),auth[_0x4898('0x9')](),controller['destroy']);module[_0x4898('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 12065d1..5330376 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 _0x1248=['STRING','sequelize','exports','INTEGER'];(function(_0x20c1fb,_0x2bf7f6){var _0x9cea18=function(_0x2b7ba0){while(--_0x2b7ba0){_0x20c1fb['push'](_0x20c1fb['shift']());}};_0x9cea18(++_0x2bf7f6);}(_0x1248,0x1b9));var _0x8124=function(_0x363ed2,_0x45a57c){_0x363ed2=_0x363ed2-0x0;var _0x153071=_0x1248[_0x363ed2];return _0x153071;};'use strict';var Sequelize=require(_0x8124('0x0'));module[_0x8124('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8124('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8124('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x5cc3=['sequelize','exports','STRING'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x5cc3,0x132));var _0x35cc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5cc3[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x35cc('0x0'));module[_0x35cc('0x1')]={'name':{'type':Sequelize[_0x35cc('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x35cc('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 414cc60..8c0009e 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 _0x4888=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','UserProfileResource','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x4888,0x198));var _0x8488=function(_0x2d21cc,_0x27ef2a){_0x2d21cc=_0x2d21cc-0x0;var _0x7ab87e=_0x4888[_0x2d21cc];return _0x7ab87e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));};exports[_0x8488('0x46')]=function(_0x313e00,_0x186747){return db[_0x8488('0x3a')]['describe']()[_0x8488('0x21')](respondWithResult(_0x186747,null))[_0x8488('0x3e')](handleError(_0x186747,null));}; \ No newline at end of file +var _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','UserProfileResource','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','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x536068,_0x3de52c){var _0x4a5db2=function(_0x1a8091){while(--_0x1a8091){_0x536068['push'](_0x536068['shift']());}};_0x4a5db2(++_0x3de52c);}(_0x430c,0x1a1));var _0xc430=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x430c[_0x5f42f1];return _0x5534ee;};'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));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b9e7f9f..ca9caa8 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 _0x32e6=['rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x36cdff,_0x118473){var _0x4f7391=function(_0x41af6a){while(--_0x41af6a){_0x36cdff['push'](_0x36cdff['shift']());}};_0x4f7391(++_0x118473);}(_0x32e6,0x1c8));var _0x632e=function(_0x23c59f,_0x3ce9f1){_0x23c59f=_0x23c59f-0x0;var _0x28929c=_0x32e6[_0x23c59f];return _0x28929c;};'use strict';var _=require(_0x632e('0x0'));var util=require(_0x632e('0x1'));var logger=require(_0x632e('0x2'))(_0x632e('0x3'));var moment=require(_0x632e('0x4'));var BPromise=require(_0x632e('0x5'));var rp=require(_0x632e('0x6'));var fs=require('fs');var path=require(_0x632e('0x7'));var rimraf=require(_0x632e('0x8'));var config=require(_0x632e('0x9'));var attributes=require(_0x632e('0xa'));module[_0x632e('0xb')]=function(_0x245efe,_0x3a412d){return _0x245efe['define'](_0x632e('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x632e('0xd'),'fields':[_0x632e('0xe'),_0x632e('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d98=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','sectionId','lodash'];(function(_0x91340d,_0x13ee89){var _0x4d935f=function(_0x31222f){while(--_0x31222f){_0x91340d['push'](_0x91340d['shift']());}};_0x4d935f(++_0x13ee89);}(_0x9d98,0x1ee));var _0x89d9=function(_0x2f16f3,_0x17791e){_0x2f16f3=_0x2f16f3-0x0;var _0x2d6811=_0x9d98[_0x2f16f3];return _0x2d6811;};'use strict';var _=require(_0x89d9('0x0'));var util=require(_0x89d9('0x1'));var logger=require(_0x89d9('0x2'))(_0x89d9('0x3'));var moment=require(_0x89d9('0x4'));var BPromise=require(_0x89d9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89d9('0x6'));var rimraf=require(_0x89d9('0x7'));var config=require(_0x89d9('0x8'));var attributes=require(_0x89d9('0x9'));module[_0x89d9('0xa')]=function(_0x14e41d,_0x49df7d){return _0x14e41d[_0x89d9('0xb')](_0x89d9('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x89d9('0xd'),'fields':['resourceId',_0x89d9('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 5b9a92b..1abc85d 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 _0xa5bf=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','moment','bluebird'];(function(_0x12a6d8,_0x3eeb6d){var _0x1a95d4=function(_0x19e7fe){while(--_0x19e7fe){_0x12a6d8['push'](_0x12a6d8['shift']());}};_0x1a95d4(++_0x3eeb6d);}(_0xa5bf,0x101));var _0xfa5b=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa5bf[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xfa5b('0x0'));var util=require('util');var moment=require(_0xfa5b('0x1'));var BPromise=require(_0xfa5b('0x2'));var rs=require(_0xfa5b('0x3'));var fs=require('fs');var Redis=require(_0xfa5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa5b('0x5'));var logger=require('../../config/logger')(_0xfa5b('0x6'));var config=require(_0xfa5b('0x7'));var jayson=require(_0xfa5b('0x8'));var client=jayson[_0xfa5b('0x9')][_0xfa5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e2bab,_0x5f1f80,_0xa1c37a){return new BPromise(function(_0x5cccb5,_0x10d545){return client[_0xfa5b('0xb')](_0x5e2bab,_0xa1c37a)['then'](function(_0x541822){logger[_0xfa5b('0xc')](_0xfa5b('0xd'),_0x5f1f80,'request\x20sent');logger[_0xfa5b('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5f1f80,_0xfa5b('0xf'),JSON['stringify'](_0x541822));if(_0x541822['error']){if(_0x541822[_0xfa5b('0x10')]['code']===0x1f4){logger[_0xfa5b('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x5f1f80,_0x541822[_0xfa5b('0x10')][_0xfa5b('0x11')]);return _0x10d545(_0x541822[_0xfa5b('0x10')][_0xfa5b('0x11')]);}logger['error'](_0xfa5b('0xd'),_0x5f1f80,_0x541822[_0xfa5b('0x10')]['message']);return _0x5cccb5(_0x541822[_0xfa5b('0x10')][_0xfa5b('0x11')]);}else{logger[_0xfa5b('0xc')](_0xfa5b('0xd'),_0x5f1f80,_0xfa5b('0xf'));_0x5cccb5(_0x541822[_0xfa5b('0x12')][_0xfa5b('0x11')]);}})[_0xfa5b('0x13')](function(_0x21cfc6){logger[_0xfa5b('0x10')](_0xfa5b('0xd'),_0x5f1f80,_0x21cfc6);_0x10d545(_0x21cfc6);});});} \ No newline at end of file +var _0xd865=['result','util','moment','randomstring','ioredis','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xd865,0xef));var _0x5d86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd865[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x5d86('0x0'));var moment=require(_0x5d86('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d86('0x2'));var fs=require('fs');var Redis=require(_0x5d86('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5d86('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x2c0f35,_0x12c15d,_0x111407){return new BPromise(function(_0x324f2b,_0x59e2e6){return client[_0x5d86('0x5')](_0x2c0f35,_0x111407)[_0x5d86('0x6')](function(_0xad91f8){logger[_0x5d86('0x7')](_0x5d86('0x8'),_0x12c15d,_0x5d86('0x9'));logger[_0x5d86('0xa')](_0x5d86('0xb'),_0x12c15d,_0x5d86('0x9'),JSON[_0x5d86('0xc')](_0xad91f8));if(_0xad91f8['error']){if(_0xad91f8[_0x5d86('0xd')][_0x5d86('0xe')]===0x1f4){logger[_0x5d86('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x12c15d,_0xad91f8[_0x5d86('0xd')][_0x5d86('0xf')]);return _0x59e2e6(_0xad91f8[_0x5d86('0xd')][_0x5d86('0xf')]);}logger[_0x5d86('0xd')](_0x5d86('0x8'),_0x12c15d,_0xad91f8[_0x5d86('0xd')][_0x5d86('0xf')]);return _0x324f2b(_0xad91f8[_0x5d86('0xd')][_0x5d86('0xf')]);}else{logger[_0x5d86('0x7')](_0x5d86('0x8'),_0x12c15d,_0x5d86('0x9'));_0x324f2b(_0xad91f8[_0x5d86('0x10')][_0x5d86('0xf')]);}})['catch'](function(_0x129f38){logger[_0x5d86('0xd')](_0x5d86('0x8'),_0x12c15d,_0x129f38);_0x59e2e6(_0x129f38);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8463f81..69604dc 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 _0xe11a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x472517,_0x85c3b4){var _0x139432=function(_0x11843a){while(--_0x11843a){_0x472517['push'](_0x472517['shift']());}};_0x139432(++_0x85c3b4);}(_0xe11a,0x19b));var _0xae11=function(_0x544784,_0x22d003){_0x544784=_0x544784-0x0;var _0x172387=_0xe11a[_0x544784];return _0x172387;};'use strict';var multer=require(_0xae11('0x0'));var util=require(_0xae11('0x1'));var path=require(_0xae11('0x2'));var timeout=require(_0xae11('0x3'));var express=require(_0xae11('0x4'));var router=express[_0xae11('0x5')]();var fs_extra=require(_0xae11('0x6'));var auth=require(_0xae11('0x7'));var interaction=require(_0xae11('0x8'));var config=require(_0xae11('0x9'));var controller=require(_0xae11('0xa'));router[_0xae11('0xb')]('/',auth[_0xae11('0xc')](),controller[_0xae11('0xd')]);router['get'](_0xae11('0xe'),auth[_0xae11('0xc')](),controller['describe']);router[_0xae11('0xb')](_0xae11('0xf'),auth['isAuthenticated'](),controller[_0xae11('0x10')]);router[_0xae11('0x11')]('/',auth[_0xae11('0xc')](),controller['create']);router['put'](_0xae11('0xf'),auth[_0xae11('0xc')](),controller[_0xae11('0x12')]);router[_0xae11('0x13')](_0xae11('0xf'),auth[_0xae11('0xc')](),controller[_0xae11('0x14')]);module[_0xae11('0x15')]=router; \ No newline at end of file +var _0xd6c6=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x2a8f66,_0x360a96){var _0x447b74=function(_0xb37087){while(--_0xb37087){_0x2a8f66['push'](_0x2a8f66['shift']());}};_0x447b74(++_0x360a96);}(_0xd6c6,0xa8));var _0x6d6c=function(_0x42e84a,_0x5e16ec){_0x42e84a=_0x42e84a-0x0;var _0x409e42=_0xd6c6[_0x42e84a];return _0x409e42;};'use strict';var multer=require(_0x6d6c('0x0'));var util=require(_0x6d6c('0x1'));var path=require('path');var timeout=require(_0x6d6c('0x2'));var express=require(_0x6d6c('0x3'));var router=express[_0x6d6c('0x4')]();var fs_extra=require(_0x6d6c('0x5'));var auth=require(_0x6d6c('0x6'));var interaction=require(_0x6d6c('0x7'));var config=require(_0x6d6c('0x8'));var controller=require(_0x6d6c('0x9'));router[_0x6d6c('0xa')]('/',auth[_0x6d6c('0xb')](),controller[_0x6d6c('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6d6c('0xd')]);router[_0x6d6c('0xa')](_0x6d6c('0xe'),auth[_0x6d6c('0xb')](),controller[_0x6d6c('0xf')]);router[_0x6d6c('0x10')]('/',auth[_0x6d6c('0xb')](),controller[_0x6d6c('0x11')]);router[_0x6d6c('0x12')](_0x6d6c('0xe'),auth[_0x6d6c('0xb')](),controller[_0x6d6c('0x13')]);router[_0x6d6c('0x14')](_0x6d6c('0xe'),auth['isAuthenticated'](),controller[_0x6d6c('0x15')]);module[_0x6d6c('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f384656..95bc9fb 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split','exports'];(function(_0x6c44c3,_0x97a995){var _0x32572b=function(_0x2f81bf){while(--_0x2f81bf){_0x6c44c3['push'](_0x6c44c3['shift']());}};_0x32572b(++_0x97a995);}(_0xb688,0xcf));var _0x8b68=function(_0x1e2d89,_0x42c783){_0x1e2d89=_0x1e2d89-0x0;var _0x155fa7=_0xb688[_0x1e2d89];return _0x155fa7;};'use strict';var Sequelize=require('sequelize');module[_0x8b68('0x0')]={'name':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x8b68('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8b68('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8b68('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x41030e){this[_0x8b68('0x4')](_0x8b68('0x5'),_0x41030e?_0x41030e[_0x8b68('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x8b68('0x5'))?this['getDataValue'](_0x8b68('0x5'))[_0x8b68('0x7')](''):[];}}}; \ No newline at end of file +var _0x7072=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x57992f,_0x3fb432){var _0x362c86=function(_0x2e3662){while(--_0x2e3662){_0x57992f['push'](_0x57992f['shift']());}};_0x362c86(++_0x3fb432);}(_0x7072,0x138));var _0x2707=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x7072[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'name':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2707('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x2707('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xfdfa7a){this['setDataValue'](_0x2707('0x4'),_0xfdfa7a?_0xfdfa7a[_0x2707('0x5')](''):[]);},'get':function(){return this[_0x2707('0x6')](_0x2707('0x4'))?this[_0x2707('0x6')](_0x2707('0x4'))[_0x2707('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b015ddf..e292f5b 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 _0x0ff7=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','rows','catch','show','params','keys','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','error','name','send','UserProfileSection','rawAttributes','fieldName','type','key','map','query','filters'];(function(_0x23e5fd,_0x2c6da6){var _0xab592b=function(_0x75559a){while(--_0x75559a){_0x23e5fd['push'](_0x23e5fd['shift']());}};_0xab592b(++_0x2c6da6);}(_0x0ff7,0x68));var _0x70ff=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x0ff7[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x70ff('0x0'));var rimraf=require(_0x70ff('0x1'));var zipdir=require(_0x70ff('0x2'));var jsonpatch=require(_0x70ff('0x3'));var rp=require(_0x70ff('0x4'));var moment=require(_0x70ff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x70ff('0x6'));var util=require(_0x70ff('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x70ff('0x8'));var ejs=require(_0x70ff('0x9'));var fs=require('fs');var fs_extra=require(_0x70ff('0xa'));var _=require(_0x70ff('0xb'));var squel=require('squel');var crypto=require(_0x70ff('0xc'));var jsforce=require(_0x70ff('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x70ff('0x8'));var querystring=require('querystring');var Papa=require(_0x70ff('0xe'));var Redis=require(_0x70ff('0xf'));var authService=require(_0x70ff('0x10'));var qs=require(_0x70ff('0x11'));var as=require(_0x70ff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70ff('0x13'))(_0x70ff('0x14'));var utils=require(_0x70ff('0x15'));var config=require(_0x70ff('0x16'));var licenseUtil=require(_0x70ff('0x17'));var db=require(_0x70ff('0x18'))['db'];function respondWithStatusCode(_0x236e32,_0x22cece){_0x22cece=_0x22cece||0xcc;return function(_0x1523d7){if(_0x1523d7){return _0x236e32[_0x70ff('0x19')](_0x22cece);}return _0x236e32[_0x70ff('0x1a')](_0x22cece)[_0x70ff('0x1b')]();};}function respondWithResult(_0x413b9f,_0x26251d){_0x26251d=_0x26251d||0xc8;return function(_0x24db0f){if(_0x24db0f){return _0x413b9f[_0x70ff('0x1a')](_0x26251d)[_0x70ff('0x1c')](_0x24db0f);}};}function respondWithFilteredResult(_0x228c2c,_0x425fad){return function(_0x59ecf6){if(_0x59ecf6){var _0x268ae1=typeof _0x425fad[_0x70ff('0x1d')]===_0x70ff('0x1e')&&typeof _0x425fad[_0x70ff('0x1f')]===_0x70ff('0x1e');var _0x59bde9=_0x59ecf6[_0x70ff('0x20')];var _0x3e0232=_0x268ae1?0x0:_0x425fad[_0x70ff('0x1d')];var _0x533add=_0x268ae1?_0x59ecf6['count']:_0x425fad[_0x70ff('0x1d')]+_0x425fad['limit'];var _0x542ad3;if(_0x533add>=_0x59bde9){_0x533add=_0x59bde9;_0x542ad3=0xc8;}else{_0x542ad3=0xce;}_0x228c2c[_0x70ff('0x1a')](_0x542ad3);return _0x228c2c[_0x70ff('0x21')](_0x70ff('0x22'),_0x3e0232+'-'+_0x533add+'/'+_0x59bde9)[_0x70ff('0x1c')](_0x59ecf6);}return null;};}function patchUpdates(_0x56ad12){return function(_0x262db3){try{jsonpatch[_0x70ff('0x23')](_0x262db3,_0x56ad12,!![]);}catch(_0x3ce4e8){return BPromise['reject'](_0x3ce4e8);}return _0x262db3[_0x70ff('0x24')]();};}function saveUpdates(_0x31e699,_0xfd7143){return function(_0x571823){if(_0x571823){return _0x571823['update'](_0x31e699)['then'](function(_0x56f82c){return _0x56f82c;});}return null;};}function removeEntity(_0x417a32,_0x25a1dc){return function(_0x334bbc){if(_0x334bbc){return _0x334bbc['destroy']()['then'](function(){_0x417a32[_0x70ff('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x214614,_0x1c97a7){return function(_0x2226f4){if(!_0x2226f4){_0x214614[_0x70ff('0x19')](0x194);}return _0x2226f4;};}function handleError(_0x2cecc7,_0x210a4d){_0x210a4d=_0x210a4d||0x1f4;return function(_0x3e310d){logger[_0x70ff('0x25')](_0x3e310d['stack']);if(_0x3e310d[_0x70ff('0x26')]){delete _0x3e310d[_0x70ff('0x26')];}_0x2cecc7[_0x70ff('0x1a')](_0x210a4d)[_0x70ff('0x27')](_0x3e310d);};}exports['index']=function(_0x481a79,_0x4798fb){var _0x242897={},_0x56b58d={},_0x130248={'count':0x0,'rows':[]};var _0x9e7235=_['map'](db[_0x70ff('0x28')][_0x70ff('0x29')],function(_0x21fe92){return{'name':_0x21fe92[_0x70ff('0x2a')],'type':_0x21fe92[_0x70ff('0x2b')][_0x70ff('0x2c')]};});_0x56b58d['model']=_[_0x70ff('0x2d')](_0x9e7235,_0x70ff('0x26'));_0x56b58d[_0x70ff('0x2e')]=_['keys'](_0x481a79['query']);_0x56b58d[_0x70ff('0x2f')]=_[_0x70ff('0x30')](_0x56b58d[_0x70ff('0x31')],_0x56b58d['query']);_0x242897[_0x70ff('0x32')]=_[_0x70ff('0x30')](_0x56b58d[_0x70ff('0x31')],qs[_0x70ff('0x33')](_0x481a79[_0x70ff('0x2e')][_0x70ff('0x33')]));_0x242897[_0x70ff('0x32')]=_0x242897[_0x70ff('0x32')][_0x70ff('0x34')]?_0x242897['attributes']:_0x56b58d[_0x70ff('0x31')];if(!_0x481a79[_0x70ff('0x2e')][_0x70ff('0x35')](_0x70ff('0x36'))){_0x242897[_0x70ff('0x1f')]=qs[_0x70ff('0x1f')](_0x481a79[_0x70ff('0x2e')]['limit']);_0x242897['offset']=qs[_0x70ff('0x1d')](_0x481a79[_0x70ff('0x2e')][_0x70ff('0x1d')]);}_0x242897[_0x70ff('0x37')]=qs[_0x70ff('0x38')](_0x481a79[_0x70ff('0x2e')][_0x70ff('0x38')]);_0x242897[_0x70ff('0x39')]=qs['filters'](_[_0x70ff('0x3a')](_0x481a79[_0x70ff('0x2e')],_0x56b58d[_0x70ff('0x2f')]),_0x9e7235);if(_0x481a79[_0x70ff('0x2e')][_0x70ff('0x3b')]){_0x242897[_0x70ff('0x39')]=_['merge'](_0x242897['where'],{'$or':_[_0x70ff('0x2d')](_0x9e7235,function(_0x577322){if(_0x577322[_0x70ff('0x2b')]!==_0x70ff('0x3c')){var _0x22b137={};_0x22b137[_0x577322[_0x70ff('0x26')]]={'$like':'%'+_0x481a79[_0x70ff('0x2e')][_0x70ff('0x3b')]+'%'};return _0x22b137;}})});}_0x242897=_[_0x70ff('0x3d')]({},_0x242897,_0x481a79[_0x70ff('0x3e')]);var _0x3dd6e9={'where':_0x242897['where']};return db[_0x70ff('0x28')][_0x70ff('0x20')](_0x3dd6e9)[_0x70ff('0x3f')](function(_0x161ee0){_0x130248[_0x70ff('0x20')]=_0x161ee0;if(_0x481a79[_0x70ff('0x2e')][_0x70ff('0x40')]){_0x242897[_0x70ff('0x41')]=[{'all':!![]}];}return db[_0x70ff('0x28')]['findAll'](_0x242897);})[_0x70ff('0x3f')](function(_0x528e60){_0x130248[_0x70ff('0x42')]=_0x528e60;return _0x130248;})[_0x70ff('0x3f')](respondWithFilteredResult(_0x4798fb,_0x242897))[_0x70ff('0x43')](handleError(_0x4798fb,null));};exports[_0x70ff('0x44')]=function(_0x35bb3f,_0x35a3a5){var _0x34873d={'raw':![],'where':{'id':_0x35bb3f[_0x70ff('0x45')]['id']}},_0x579935={};_0x579935[_0x70ff('0x31')]=_[_0x70ff('0x46')](db['UserProfileSection'][_0x70ff('0x29')]);_0x579935['query']=_['keys'](_0x35bb3f[_0x70ff('0x2e')]);_0x579935[_0x70ff('0x2f')]=_[_0x70ff('0x30')](_0x579935[_0x70ff('0x31')],_0x579935[_0x70ff('0x2e')]);_0x34873d['attributes']=_['intersection'](_0x579935[_0x70ff('0x31')],qs['fields'](_0x35bb3f[_0x70ff('0x2e')]['fields']));_0x34873d[_0x70ff('0x32')]=_0x34873d[_0x70ff('0x32')][_0x70ff('0x34')]?_0x34873d['attributes']:_0x579935[_0x70ff('0x31')];if(_0x35bb3f[_0x70ff('0x2e')][_0x70ff('0x40')]){_0x34873d[_0x70ff('0x41')]=[{'all':!![]}];}_0x34873d=_['merge']({},_0x34873d,_0x35bb3f[_0x70ff('0x3e')]);return db[_0x70ff('0x28')]['find'](_0x34873d)[_0x70ff('0x3f')](handleEntityNotFound(_0x35a3a5,null))['then'](respondWithResult(_0x35a3a5,null))[_0x70ff('0x43')](handleError(_0x35a3a5,null));};exports[_0x70ff('0x47')]=function(_0x35ebbe,_0x561b28){return db['UserProfileSection'][_0x70ff('0x47')](_0x35ebbe[_0x70ff('0x48')],{})[_0x70ff('0x3f')](respondWithResult(_0x561b28,0xc9))[_0x70ff('0x43')](handleError(_0x561b28,null));};exports[_0x70ff('0x49')]=function(_0x5db3bb,_0x34c293){if(_0x5db3bb[_0x70ff('0x48')]['id']){delete _0x5db3bb['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x5db3bb[_0x70ff('0x45')]['id']}})[_0x70ff('0x3f')](handleEntityNotFound(_0x34c293,null))['then'](saveUpdates(_0x5db3bb[_0x70ff('0x48')],null))['then'](respondWithResult(_0x34c293,null))[_0x70ff('0x43')](handleError(_0x34c293,null));};exports['destroy']=function(_0x420848,_0x598705){return db[_0x70ff('0x28')][_0x70ff('0x4a')]({'where':{'id':_0x420848['params']['id']}})['then'](handleEntityNotFound(_0x598705,null))[_0x70ff('0x3f')](removeEntity(_0x598705,null))[_0x70ff('0x43')](handleError(_0x598705,null));};exports[_0x70ff('0x4b')]=function(_0x68abd8,_0x32da6d){return db[_0x70ff('0x28')][_0x70ff('0x4b')]()['then'](respondWithResult(_0x32da6d,null))['catch'](handleError(_0x32da6d,null));}; \ No newline at end of file +var _0x5d5e=['model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','keys','length','include','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','UserProfileSection','rawAttributes','fieldName','type'];(function(_0x14f001,_0x454e4e){var _0x467bb1=function(_0x289612){while(--_0x289612){_0x14f001['push'](_0x14f001['shift']());}};_0x467bb1(++_0x454e4e);}(_0x5d5e,0xb7));var _0xe5d5=function(_0x57f9b5,_0x6020aa){_0x57f9b5=_0x57f9b5-0x0;var _0xd69a3b=_0x5d5e[_0x57f9b5];return _0xd69a3b;};'use strict';var emlformat=require(_0xe5d5('0x0'));var rimraf=require(_0xe5d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe5d5('0x2'));var moment=require(_0xe5d5('0x3'));var BPromise=require(_0xe5d5('0x4'));var Mustache=require(_0xe5d5('0x5'));var util=require(_0xe5d5('0x6'));var path=require('path');var sox=require(_0xe5d5('0x7'));var csv=require('to-csv');var ejs=require(_0xe5d5('0x8'));var fs=require('fs');var fs_extra=require(_0xe5d5('0x9'));var _=require(_0xe5d5('0xa'));var squel=require(_0xe5d5('0xb'));var crypto=require(_0xe5d5('0xc'));var jsforce=require(_0xe5d5('0xd'));var deskjs=require(_0xe5d5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe5d5('0xf'));var Papa=require(_0xe5d5('0x10'));var Redis=require(_0xe5d5('0x11'));var authService=require(_0xe5d5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe5d5('0x13'));var hardwareService=require(_0xe5d5('0x14'));var logger=require(_0xe5d5('0x15'))(_0xe5d5('0x16'));var utils=require(_0xe5d5('0x17'));var config=require(_0xe5d5('0x18'));var licenseUtil=require(_0xe5d5('0x19'));var db=require(_0xe5d5('0x1a'))['db'];function respondWithStatusCode(_0x47e659,_0x3e247b){_0x3e247b=_0x3e247b||0xcc;return function(_0x44af4f){if(_0x44af4f){return _0x47e659[_0xe5d5('0x1b')](_0x3e247b);}return _0x47e659[_0xe5d5('0x1c')](_0x3e247b)[_0xe5d5('0x1d')]();};}function respondWithResult(_0x40d285,_0x7b31d7){_0x7b31d7=_0x7b31d7||0xc8;return function(_0x352b52){if(_0x352b52){return _0x40d285['status'](_0x7b31d7)[_0xe5d5('0x1e')](_0x352b52);}};}function respondWithFilteredResult(_0x416628,_0xe4e985){return function(_0x37e6c7){if(_0x37e6c7){var _0x5607c7=typeof _0xe4e985[_0xe5d5('0x1f')]===_0xe5d5('0x20')&&typeof _0xe4e985['limit']==='undefined';var _0xf511fd=_0x37e6c7[_0xe5d5('0x21')];var _0x14a8b8=_0x5607c7?0x0:_0xe4e985[_0xe5d5('0x1f')];var _0x17e7c8=_0x5607c7?_0x37e6c7[_0xe5d5('0x21')]:_0xe4e985[_0xe5d5('0x1f')]+_0xe4e985[_0xe5d5('0x22')];var _0x470663;if(_0x17e7c8>=_0xf511fd){_0x17e7c8=_0xf511fd;_0x470663=0xc8;}else{_0x470663=0xce;}_0x416628[_0xe5d5('0x1c')](_0x470663);return _0x416628[_0xe5d5('0x23')](_0xe5d5('0x24'),_0x14a8b8+'-'+_0x17e7c8+'/'+_0xf511fd)['json'](_0x37e6c7);}return null;};}function patchUpdates(_0x3d12cd){return function(_0x16cbab){try{jsonpatch['apply'](_0x16cbab,_0x3d12cd,!![]);}catch(_0x574008){return BPromise[_0xe5d5('0x25')](_0x574008);}return _0x16cbab[_0xe5d5('0x26')]();};}function saveUpdates(_0x357347,_0x5ad889){return function(_0x17149e){if(_0x17149e){return _0x17149e[_0xe5d5('0x27')](_0x357347)[_0xe5d5('0x28')](function(_0x5baa74){return _0x5baa74;});}return null;};}function removeEntity(_0x1797f2,_0x32307a){return function(_0x195e58){if(_0x195e58){return _0x195e58['destroy']()[_0xe5d5('0x28')](function(){_0x1797f2['status'](0xcc)[_0xe5d5('0x1d')]();});}};}function handleEntityNotFound(_0x516b58,_0x126cff){return function(_0x523a58){if(!_0x523a58){_0x516b58[_0xe5d5('0x1b')](0x194);}return _0x523a58;};}function handleError(_0x106de3,_0x56bab5){_0x56bab5=_0x56bab5||0x1f4;return function(_0x109023){logger[_0xe5d5('0x29')](_0x109023['stack']);if(_0x109023[_0xe5d5('0x2a')]){delete _0x109023[_0xe5d5('0x2a')];}_0x106de3[_0xe5d5('0x1c')](_0x56bab5)[_0xe5d5('0x2b')](_0x109023);};}exports['index']=function(_0x49a403,_0x21b757){var _0x337b9b={},_0x33dca6={},_0x35e170={'count':0x0,'rows':[]};var _0x57f473=_['map'](db[_0xe5d5('0x2c')][_0xe5d5('0x2d')],function(_0xb0935f){return{'name':_0xb0935f[_0xe5d5('0x2e')],'type':_0xb0935f[_0xe5d5('0x2f')]['key']};});_0x33dca6[_0xe5d5('0x30')]=_[_0xe5d5('0x31')](_0x57f473,_0xe5d5('0x2a'));_0x33dca6[_0xe5d5('0x32')]=_['keys'](_0x49a403[_0xe5d5('0x32')]);_0x33dca6['filters']=_['intersection'](_0x33dca6['model'],_0x33dca6[_0xe5d5('0x32')]);_0x337b9b[_0xe5d5('0x33')]=_[_0xe5d5('0x34')](_0x33dca6[_0xe5d5('0x30')],qs[_0xe5d5('0x35')](_0x49a403[_0xe5d5('0x32')][_0xe5d5('0x35')]));_0x337b9b['attributes']=_0x337b9b[_0xe5d5('0x33')]['length']?_0x337b9b[_0xe5d5('0x33')]:_0x33dca6[_0xe5d5('0x30')];if(!_0x49a403[_0xe5d5('0x32')][_0xe5d5('0x36')](_0xe5d5('0x37'))){_0x337b9b[_0xe5d5('0x22')]=qs[_0xe5d5('0x22')](_0x49a403[_0xe5d5('0x32')][_0xe5d5('0x22')]);_0x337b9b[_0xe5d5('0x1f')]=qs[_0xe5d5('0x1f')](_0x49a403['query'][_0xe5d5('0x1f')]);}_0x337b9b[_0xe5d5('0x38')]=qs['sort'](_0x49a403[_0xe5d5('0x32')][_0xe5d5('0x39')]);_0x337b9b['where']=qs[_0xe5d5('0x3a')](_['pick'](_0x49a403[_0xe5d5('0x32')],_0x33dca6[_0xe5d5('0x3a')]),_0x57f473);if(_0x49a403[_0xe5d5('0x32')][_0xe5d5('0x3b')]){_0x337b9b[_0xe5d5('0x3c')]=_['merge'](_0x337b9b['where'],{'$or':_['map'](_0x57f473,function(_0x4145f7){if(_0x4145f7['type']!==_0xe5d5('0x3d')){var _0xc7152c={};_0xc7152c[_0x4145f7['name']]={'$like':'%'+_0x49a403[_0xe5d5('0x32')][_0xe5d5('0x3b')]+'%'};return _0xc7152c;}})});}_0x337b9b=_[_0xe5d5('0x3e')]({},_0x337b9b,_0x49a403[_0xe5d5('0x3f')]);var _0x376b5b={'where':_0x337b9b[_0xe5d5('0x3c')]};return db[_0xe5d5('0x2c')][_0xe5d5('0x21')](_0x376b5b)[_0xe5d5('0x28')](function(_0x346607){_0x35e170['count']=_0x346607;if(_0x49a403[_0xe5d5('0x32')][_0xe5d5('0x40')]){_0x337b9b['include']=[{'all':!![]}];}return db[_0xe5d5('0x2c')][_0xe5d5('0x41')](_0x337b9b);})[_0xe5d5('0x28')](function(_0x3bafe9){_0x35e170[_0xe5d5('0x42')]=_0x3bafe9;return _0x35e170;})[_0xe5d5('0x28')](respondWithFilteredResult(_0x21b757,_0x337b9b))[_0xe5d5('0x43')](handleError(_0x21b757,null));};exports[_0xe5d5('0x44')]=function(_0x471547,_0x5c486f){var _0x5158be={'raw':![],'where':{'id':_0x471547['params']['id']}},_0x9a3c6e={};_0x9a3c6e['model']=_[_0xe5d5('0x45')](db[_0xe5d5('0x2c')][_0xe5d5('0x2d')]);_0x9a3c6e[_0xe5d5('0x32')]=_['keys'](_0x471547[_0xe5d5('0x32')]);_0x9a3c6e['filters']=_[_0xe5d5('0x34')](_0x9a3c6e['model'],_0x9a3c6e['query']);_0x5158be[_0xe5d5('0x33')]=_[_0xe5d5('0x34')](_0x9a3c6e['model'],qs['fields'](_0x471547[_0xe5d5('0x32')][_0xe5d5('0x35')]));_0x5158be['attributes']=_0x5158be[_0xe5d5('0x33')][_0xe5d5('0x46')]?_0x5158be[_0xe5d5('0x33')]:_0x9a3c6e[_0xe5d5('0x30')];if(_0x471547[_0xe5d5('0x32')][_0xe5d5('0x40')]){_0x5158be[_0xe5d5('0x47')]=[{'all':!![]}];}_0x5158be=_[_0xe5d5('0x3e')]({},_0x5158be,_0x471547['options']);return db[_0xe5d5('0x2c')][_0xe5d5('0x48')](_0x5158be)[_0xe5d5('0x28')](handleEntityNotFound(_0x5c486f,null))['then'](respondWithResult(_0x5c486f,null))[_0xe5d5('0x43')](handleError(_0x5c486f,null));};exports['create']=function(_0x970e64,_0x1fc2a9){return db[_0xe5d5('0x2c')][_0xe5d5('0x49')](_0x970e64[_0xe5d5('0x4a')],{})[_0xe5d5('0x28')](respondWithResult(_0x1fc2a9,0xc9))[_0xe5d5('0x43')](handleError(_0x1fc2a9,null));};exports[_0xe5d5('0x27')]=function(_0x529d75,_0x57596f){if(_0x529d75[_0xe5d5('0x4a')]['id']){delete _0x529d75[_0xe5d5('0x4a')]['id'];}return db[_0xe5d5('0x2c')][_0xe5d5('0x48')]({'where':{'id':_0x529d75[_0xe5d5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57596f,null))[_0xe5d5('0x28')](saveUpdates(_0x529d75[_0xe5d5('0x4a')],null))[_0xe5d5('0x28')](respondWithResult(_0x57596f,null))['catch'](handleError(_0x57596f,null));};exports['destroy']=function(_0x3c8311,_0x2fcff9){return db[_0xe5d5('0x2c')][_0xe5d5('0x48')]({'where':{'id':_0x3c8311[_0xe5d5('0x4b')]['id']}})[_0xe5d5('0x28')](handleEntityNotFound(_0x2fcff9,null))[_0xe5d5('0x28')](removeEntity(_0x2fcff9,null))[_0xe5d5('0x43')](handleError(_0x2fcff9,null));};exports[_0xe5d5('0x4c')]=function(_0x8604f9,_0x269c79){return db[_0xe5d5('0x2c')]['describe']()[_0xe5d5('0x28')](respondWithResult(_0x269c79,null))[_0xe5d5('0x43')](handleError(_0x269c79,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 593b7af..7072d88 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 _0x80f4=['./userProfileSection.attributes','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0x80f4,0xaa));var _0x480f=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0x80f4[_0x1f5143];return _0x383a38;};'use strict';var _=require(_0x480f('0x0'));var util=require(_0x480f('0x1'));var logger=require(_0x480f('0x2'))(_0x480f('0x3'));var moment=require(_0x480f('0x4'));var BPromise=require(_0x480f('0x5'));var rp=require(_0x480f('0x6'));var fs=require('fs');var path=require(_0x480f('0x7'));var rimraf=require(_0x480f('0x8'));var config=require(_0x480f('0x9'));var attributes=require(_0x480f('0xa'));module['exports']=function(_0x5cc479,_0x49cde5){return _0x5cc479['define']('UserProfileSection',attributes,{'tableName':_0x480f('0xb'),'paranoid':![],'indexes':[{'name':_0x480f('0xc'),'fields':[_0x480f('0xd'),_0x480f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84d0=['moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api'];(function(_0x4a5635,_0x443b90){var _0x18d602=function(_0x1ddd38){while(--_0x1ddd38){_0x4a5635['push'](_0x4a5635['shift']());}};_0x18d602(++_0x443b90);}(_0x84d0,0x75));var _0x084d=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x84d0[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x084d('0x0'));var util=require(_0x084d('0x1'));var logger=require('../../config/logger')(_0x084d('0x2'));var moment=require(_0x084d('0x3'));var BPromise=require(_0x084d('0x4'));var rp=require(_0x084d('0x5'));var fs=require('fs');var path=require(_0x084d('0x6'));var rimraf=require('rimraf');var config=require(_0x084d('0x7'));var attributes=require(_0x084d('0x8'));module[_0x084d('0x9')]=function(_0x432ece,_0x4ca1b8){return _0x432ece['define'](_0x084d('0xa'),attributes,{'tableName':_0x084d('0xb'),'paranoid':![],'indexes':[{'name':_0x084d('0xc'),'fields':[_0x084d('0xd'),_0x084d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3910d18..1163ab4 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 _0xd9eb=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xd9eb,0x11d));var _0xbd9e=function(_0x316e2b,_0x40efd7){_0x316e2b=_0x316e2b-0x0;var _0x2e4809=_0xd9eb[_0x316e2b];return _0x2e4809;};'use strict';var _=require('lodash');var util=require(_0xbd9e('0x0'));var moment=require(_0xbd9e('0x1'));var BPromise=require(_0xbd9e('0x2'));var rs=require(_0xbd9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd9e('0x4'))['db'];var utils=require(_0xbd9e('0x5'));var logger=require(_0xbd9e('0x6'))(_0xbd9e('0x7'));var config=require(_0xbd9e('0x8'));var jayson=require(_0xbd9e('0x9'));var client=jayson[_0xbd9e('0xa')][_0xbd9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x351301,_0x249352,_0x5c56d3){return new BPromise(function(_0x46d4cb,_0x1054b5){return client[_0xbd9e('0xc')](_0x351301,_0x5c56d3)[_0xbd9e('0xd')](function(_0x3cae89){logger[_0xbd9e('0xe')](_0xbd9e('0xf'),_0x249352,_0xbd9e('0x10'));logger['debug'](_0xbd9e('0x11'),_0x249352,'request\x20sent',JSON[_0xbd9e('0x12')](_0x3cae89));if(_0x3cae89[_0xbd9e('0x13')]){if(_0x3cae89[_0xbd9e('0x13')][_0xbd9e('0x14')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x249352,_0x3cae89[_0xbd9e('0x13')]['message']);return _0x1054b5(_0x3cae89[_0xbd9e('0x13')][_0xbd9e('0x15')]);}logger[_0xbd9e('0x13')](_0xbd9e('0xf'),_0x249352,_0x3cae89[_0xbd9e('0x13')][_0xbd9e('0x15')]);return _0x46d4cb(_0x3cae89[_0xbd9e('0x13')][_0xbd9e('0x15')]);}else{logger[_0xbd9e('0xe')](_0xbd9e('0xf'),_0x249352,_0xbd9e('0x10'));_0x46d4cb(_0x3cae89[_0xbd9e('0x16')][_0xbd9e('0x15')]);}})[_0xbd9e('0x17')](function(_0x475b6a){logger[_0xbd9e('0x13')](_0xbd9e('0xf'),_0x249352,_0x475b6a);_0x1054b5(_0x475b6a);});});} \ No newline at end of file +var _0x7063=['jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x31a68b,_0x2c7ea6){var _0x5057ea=function(_0x3c1c58){while(--_0x3c1c58){_0x31a68b['push'](_0x31a68b['shift']());}};_0x5057ea(++_0x2c7ea6);}(_0x7063,0x157));var _0x3706=function(_0x75ad11,_0x52eb49){_0x75ad11=_0x75ad11-0x0;var _0x26cfb2=_0x7063[_0x75ad11];return _0x26cfb2;};'use strict';var _=require('lodash');var util=require(_0x3706('0x0'));var moment=require(_0x3706('0x1'));var BPromise=require(_0x3706('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3706('0x3'));var db=require(_0x3706('0x4'))['db'];var utils=require(_0x3706('0x5'));var logger=require(_0x3706('0x6'))(_0x3706('0x7'));var config=require(_0x3706('0x8'));var jayson=require(_0x3706('0x9'));var client=jayson[_0x3706('0xa')][_0x3706('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401dd8,_0x407a0f,_0x2ee834){return new BPromise(function(_0x46da06,_0x1e0840){return client['request'](_0x401dd8,_0x2ee834)[_0x3706('0xc')](function(_0x81168d){logger['info'](_0x3706('0xd'),_0x407a0f,_0x3706('0xe'));logger[_0x3706('0xf')](_0x3706('0x10'),_0x407a0f,_0x3706('0xe'),JSON[_0x3706('0x11')](_0x81168d));if(_0x81168d[_0x3706('0x12')]){if(_0x81168d[_0x3706('0x12')]['code']===0x1f4){logger[_0x3706('0x12')](_0x3706('0xd'),_0x407a0f,_0x81168d[_0x3706('0x12')]['message']);return _0x1e0840(_0x81168d['error'][_0x3706('0x13')]);}logger[_0x3706('0x12')](_0x3706('0xd'),_0x407a0f,_0x81168d[_0x3706('0x12')][_0x3706('0x13')]);return _0x46da06(_0x81168d[_0x3706('0x12')][_0x3706('0x13')]);}else{logger['info'](_0x3706('0xd'),_0x407a0f,_0x3706('0xe'));_0x46da06(_0x81168d[_0x3706('0x14')]['message']);}})[_0x3706('0x15')](function(_0x119e9e){logger['error'](_0x3706('0xd'),_0x407a0f,_0x119e9e);_0x1e0840(_0x119e9e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 64ac38b..8d311be 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x37713a,_0x37b041){var _0x4f4f8a=function(_0x41c92c){while(--_0x41c92c){_0x37713a['push'](_0x37713a['shift']());}};_0x4f4f8a(++_0x37b041);}(_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(_0x426dd2,_0x4b0012){var _0x4bc76c=function(_0x4c0732){while(--_0x4c0732){_0x426dd2['push'](_0x426dd2['shift']());}};_0x4bc76c(++_0x4b0012);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7fc3af9..7e43737 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 _0x22f2=['INTEGER','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x22f2,0xd6));var _0x222f=function(_0x4570a3,_0x4f8d6e){_0x4570a3=_0x4570a3-0x0;var _0x1ddbd3=_0x22f2[_0x4570a3];return _0x1ddbd3;};'use strict';var Sequelize=require(_0x222f('0x0'));module[_0x222f('0x1')]={'penalty':{'type':Sequelize[_0x222f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1952=['exports','INTEGER'];(function(_0x321938,_0x2e0290){var _0x57b3ba=function(_0x5c0844){while(--_0x5c0844){_0x321938['push'](_0x321938['shift']());}};_0x57b3ba(++_0x2e0290);}(_0x1952,0x92));var _0x2195=function(_0x1e6e9c,_0x43663f){_0x1e6e9c=_0x1e6e9c-0x0;var _0x11716d=_0x1952[_0x1e6e9c];return _0x11716d;};'use strict';var Sequelize=require('sequelize');module[_0x2195('0x0')]={'penalty':{'type':Sequelize[_0x2195('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 921ce15..6f3af25 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 _0x9bd9=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x258d6e,_0x54387b){_0x258d6e=_0x258d6e-0x0;var _0x1654f2=_0x9bd9[_0x258d6e];return _0x1654f2;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var logger=require(_0x99bd('0x2'))(_0x99bd('0x3'));var moment=require(_0x99bd('0x4'));var BPromise=require(_0x99bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bd('0x6'));var rimraf=require('rimraf');var config=require(_0x99bd('0x7'));var attributes=require(_0x99bd('0x8'));module['exports']=function(_0xa1cd99,_0x45b939){return _0xa1cd99[_0x99bd('0x9')](_0x99bd('0xa'),attributes,{'tableName':_0x99bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','util','api','moment'];(function(_0x4cd50d,_0x56f06b){var _0x31fe7b=function(_0x18ae3a){while(--_0x18ae3a){_0x4cd50d['push'](_0x4cd50d['shift']());}};_0x31fe7b(++_0x56f06b);}(_0xadb5,0xad));var _0x5adb=function(_0x1ece28,_0x3faaab){_0x1ece28=_0x1ece28-0x0;var _0x435898=_0xadb5[_0x1ece28];return _0x435898;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'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 0891dad..5857776 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 _0x6384=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x6384,0x189));var _0x4638=function(_0x53758c,_0x3f5260){_0x53758c=_0x53758c-0x0;var _0x297de2=_0x6384[_0x53758c];return _0x297de2;};'use strict';var _=require(_0x4638('0x0'));var util=require(_0x4638('0x1'));var moment=require('moment');var BPromise=require(_0x4638('0x2'));var rs=require(_0x4638('0x3'));var fs=require('fs');var Redis=require(_0x4638('0x4'));var db=require(_0x4638('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4638('0x6'))(_0x4638('0x7'));var config=require(_0x4638('0x8'));var jayson=require(_0x4638('0x9'));var client=jayson['client'][_0x4638('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x82198e,_0x13d961,_0x56e376){return new BPromise(function(_0x5a889d,_0x31e5a7){return client[_0x4638('0xb')](_0x82198e,_0x56e376)[_0x4638('0xc')](function(_0x238a85){logger[_0x4638('0xd')](_0x4638('0xe'),_0x13d961,_0x4638('0xf'));logger[_0x4638('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x13d961,_0x4638('0xf'),JSON[_0x4638('0x11')](_0x238a85));if(_0x238a85['error']){if(_0x238a85['error'][_0x4638('0x12')]===0x1f4){logger['error'](_0x4638('0xe'),_0x13d961,_0x238a85[_0x4638('0x13')]['message']);return _0x31e5a7(_0x238a85['error'][_0x4638('0x14')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x13d961,_0x238a85[_0x4638('0x13')][_0x4638('0x14')]);return _0x5a889d(_0x238a85[_0x4638('0x13')][_0x4638('0x14')]);}else{logger[_0x4638('0xd')](_0x4638('0xe'),_0x13d961,'request\x20sent');_0x5a889d(_0x238a85[_0x4638('0x15')]['message']);}})[_0x4638('0x16')](function(_0x48f3cc){logger[_0x4638('0x13')](_0x4638('0xe'),_0x13d961,_0x48f3cc);_0x31e5a7(_0x48f3cc);});});} \ No newline at end of file +var _0x3c4e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x3c4e,0x144));var _0xe3c4=function(_0x8882c7,_0xae4838){_0x8882c7=_0x8882c7-0x0;var _0x2b6334=_0x3c4e[_0x8882c7];return _0x2b6334;};'use strict';var _=require(_0xe3c4('0x0'));var util=require(_0xe3c4('0x1'));var moment=require(_0xe3c4('0x2'));var BPromise=require(_0xe3c4('0x3'));var rs=require(_0xe3c4('0x4'));var fs=require('fs');var Redis=require(_0xe3c4('0x5'));var db=require(_0xe3c4('0x6'))['db'];var utils=require(_0xe3c4('0x7'));var logger=require(_0xe3c4('0x8'))(_0xe3c4('0x9'));var config=require(_0xe3c4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe3c4('0xb')][_0xe3c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x211a7d,_0xddbda,_0x36be54){return new BPromise(function(_0x4a3020,_0x2bf023){return client[_0xe3c4('0xd')](_0x211a7d,_0x36be54)[_0xe3c4('0xe')](function(_0xbd7d01){logger[_0xe3c4('0xf')](_0xe3c4('0x10'),_0xddbda,'request\x20sent');logger['debug'](_0xe3c4('0x11'),_0xddbda,'request\x20sent',JSON['stringify'](_0xbd7d01));if(_0xbd7d01['error']){if(_0xbd7d01[_0xe3c4('0x12')]['code']===0x1f4){logger['error'](_0xe3c4('0x10'),_0xddbda,_0xbd7d01[_0xe3c4('0x12')]['message']);return _0x2bf023(_0xbd7d01[_0xe3c4('0x12')][_0xe3c4('0x13')]);}logger[_0xe3c4('0x12')](_0xe3c4('0x10'),_0xddbda,_0xbd7d01[_0xe3c4('0x12')]['message']);return _0x4a3020(_0xbd7d01[_0xe3c4('0x12')][_0xe3c4('0x13')]);}else{logger[_0xe3c4('0xf')](_0xe3c4('0x10'),_0xddbda,_0xe3c4('0x14'));_0x4a3020(_0xbd7d01[_0xe3c4('0x15')][_0xe3c4('0x13')]);}})[_0xe3c4('0x16')](function(_0x3f4a7e){logger[_0xe3c4('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0xddbda,_0x3f4a7e);_0x2bf023(_0x3f4a7e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6d7d394..2ace489 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 _0x152d=['INTEGER','exports'];(function(_0x2a58e9,_0x53778f){var _0x55d13a=function(_0x29f4f8){while(--_0x29f4f8){_0x2a58e9['push'](_0x2a58e9['shift']());}};_0x55d13a(++_0x53778f);}(_0x152d,0x1ef));var _0xd152=function(_0x216659,_0x2c4edc){_0x216659=_0x216659-0x0;var _0x3f05aa=_0x152d[_0x216659];return _0x3f05aa;};'use strict';var Sequelize=require('sequelize');module[_0xd152('0x0')]={'UserId':{'type':Sequelize[_0xd152('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd152('0x1')]}}; \ No newline at end of file +var _0xf8f7=['exports','INTEGER','sequelize'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0xf8f7,0x191));var _0x7f8f=function(_0x3b5edf,_0x34d8df){_0x3b5edf=_0x3b5edf-0x0;var _0x44283b=_0xf8f7[_0x3b5edf];return _0x44283b;};'use strict';var Sequelize=require(_0x7f8f('0x0'));module[_0x7f8f('0x1')]={'UserId':{'type':Sequelize[_0x7f8f('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5f5ec4c..58ce027 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(_0x250891,_0x196ce6){var _0x43eecb=function(_0x2e6bcb){while(--_0x2e6bcb){_0x250891['push'](_0x250891['shift']());}};_0x43eecb(++_0x196ce6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x5d2ead,_0x903d98){var _0x1dd121=function(_0x108d74){while(--_0x108d74){_0x5d2ead['push'](_0x5d2ead['shift']());}};_0x1dd121(++_0x903d98);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 8fb1697..80dcf6f 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x57a55d,_0x33b129){var _0x1e0edb=function(_0x30c663){while(--_0x30c663){_0x57a55d['push'](_0x57a55d['shift']());}};_0x1e0edb(++_0x33b129);}(_0x70e0,0x17b));var _0x070e=function(_0xfef5a6,_0x40a99a){_0xfef5a6=_0xfef5a6-0x0;var _0xbce66b=_0x70e0[_0xfef5a6];return _0xbce66b;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x14b2c2,_0x2cc1f6){var _0x45ea1e=function(_0x3af32e){while(--_0x3af32e){_0x14b2c2['push'](_0x14b2c2['shift']());}};_0x45ea1e(++_0x2cc1f6);}(_0x70e0,0x17b));var _0x070e=function(_0x36edd7,_0x299394){_0x36edd7=_0x36edd7-0x0;var _0x58677b=_0x70e0[_0x36edd7];return _0x58677b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2f21503..86a3d99 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 _0x8055=['exports'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x8055,0x1c2));var _0x5805=function(_0x33ab09,_0x113067){_0x33ab09=_0x33ab09-0x0;var _0x14460b=_0x8055[_0x33ab09];return _0x14460b;};'use strict';var Sequelize=require('sequelize');module[_0x5805('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb854=['INTEGER','sequelize','exports'];(function(_0x5da6f1,_0x11b5e8){var _0x5dfc96=function(_0x4e0d10){while(--_0x4e0d10){_0x5da6f1['push'](_0x5da6f1['shift']());}};_0x5dfc96(++_0x11b5e8);}(_0xb854,0x151));var _0x4b85=function(_0x5ce929,_0xc8db55){_0x5ce929=_0x5ce929-0x0;var _0x49c26a=_0xb854[_0x5ce929];return _0x49c26a;};'use strict';var Sequelize=require(_0x4b85('0x0'));module[_0x4b85('0x1')]={'penalty':{'type':Sequelize[_0x4b85('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 88aa38e..be5b0c0 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 _0x03bf=['bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x03bf,0x1b7));var _0xf03b=function(_0x3a0ccd,_0x2e4e84){_0x3a0ccd=_0x3a0ccd-0x0;var _0x5d85e5=_0x03bf[_0x3a0ccd];return _0x5d85e5;};'use strict';var _=require(_0xf03b('0x0'));var util=require(_0xf03b('0x1'));var logger=require(_0xf03b('0x2'))(_0xf03b('0x3'));var moment=require(_0xf03b('0x4'));var BPromise=require(_0xf03b('0x5'));var rp=require(_0xf03b('0x6'));var fs=require('fs');var path=require(_0xf03b('0x7'));var rimraf=require(_0xf03b('0x8'));var config=require('../../config/environment');var attributes=require(_0xf03b('0x9'));module['exports']=function(_0x256c64,_0x4a327d){return _0x256c64['define'](_0xf03b('0xa'),attributes,{'tableName':_0xf03b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7729=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3f4b24,_0x452f8e){var _0x40b434=function(_0x2712c4){while(--_0x2712c4){_0x3f4b24['push'](_0x3f4b24['shift']());}};_0x40b434(++_0x452f8e);}(_0x7729,0x18b));var _0x9772=function(_0x40375c,_0x57ea2f){_0x40375c=_0x40375c-0x0;var _0xdca3fb=_0x7729[_0x40375c];return _0xdca3fb;};'use strict';var _=require('lodash');var util=require(_0x9772('0x0'));var logger=require(_0x9772('0x1'))(_0x9772('0x2'));var moment=require(_0x9772('0x3'));var BPromise=require('bluebird');var rp=require(_0x9772('0x4'));var fs=require('fs');var path=require(_0x9772('0x5'));var rimraf=require(_0x9772('0x6'));var config=require(_0x9772('0x7'));var attributes=require(_0x9772('0x8'));module[_0x9772('0x9')]=function(_0x5172e1,_0x305db8){return _0x5172e1[_0x9772('0xa')](_0x9772('0xb'),attributes,{'tableName':_0x9772('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 7a518b7..e1ae6ce 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 _0xe518=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x56a074,_0x25fd2b){var _0x542bc0=function(_0x2c86ab){while(--_0x2c86ab){_0x56a074['push'](_0x56a074['shift']());}};_0x542bc0(++_0x25fd2b);}(_0xe518,0xbf));var _0x8e51=function(_0x5be852,_0x5398c7){_0x5be852=_0x5be852-0x0;var _0x2f27e1=_0xe518[_0x5be852];return _0x2f27e1;};'use strict';var _=require('lodash');var util=require(_0x8e51('0x0'));var moment=require(_0x8e51('0x1'));var BPromise=require(_0x8e51('0x2'));var rs=require(_0x8e51('0x3'));var fs=require('fs');var Redis=require(_0x8e51('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e51('0x5'));var logger=require(_0x8e51('0x6'))('rpc');var config=require(_0x8e51('0x7'));var jayson=require(_0x8e51('0x8'));var client=jayson[_0x8e51('0x9')][_0x8e51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dbc7d,_0xb3c84c,_0x592371){return new BPromise(function(_0x5e2cd5,_0x265feb){return client[_0x8e51('0xb')](_0x1dbc7d,_0x592371)[_0x8e51('0xc')](function(_0x359b62){logger[_0x8e51('0xd')](_0x8e51('0xe'),_0xb3c84c,_0x8e51('0xf'));logger[_0x8e51('0x10')](_0x8e51('0x11'),_0xb3c84c,_0x8e51('0xf'),JSON[_0x8e51('0x12')](_0x359b62));if(_0x359b62[_0x8e51('0x13')]){if(_0x359b62[_0x8e51('0x13')][_0x8e51('0x14')]===0x1f4){logger[_0x8e51('0x13')](_0x8e51('0xe'),_0xb3c84c,_0x359b62[_0x8e51('0x13')]['message']);return _0x265feb(_0x359b62[_0x8e51('0x13')][_0x8e51('0x15')]);}logger[_0x8e51('0x13')](_0x8e51('0xe'),_0xb3c84c,_0x359b62['error']['message']);return _0x5e2cd5(_0x359b62[_0x8e51('0x13')][_0x8e51('0x15')]);}else{logger['info'](_0x8e51('0xe'),_0xb3c84c,_0x8e51('0xf'));_0x5e2cd5(_0x359b62[_0x8e51('0x16')]['message']);}})[_0x8e51('0x17')](function(_0x533618){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0xb3c84c,_0x533618);_0x265feb(_0x533618);});});} \ No newline at end of file +var _0x4eca=['info','UserVoiceQueue,\x20%s,\x20%s','stringify','code','error','result','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x22cf2e,_0x159a2d){var _0x513a90=function(_0x8b26af){while(--_0x8b26af){_0x22cf2e['push'](_0x22cf2e['shift']());}};_0x513a90(++_0x159a2d);}(_0x4eca,0x158));var _0xa4ec=function(_0x2e3c59,_0x113d7d){_0x2e3c59=_0x2e3c59-0x0;var _0x556761=_0x4eca[_0x2e3c59];return _0x556761;};'use strict';var _=require(_0xa4ec('0x0'));var util=require(_0xa4ec('0x1'));var moment=require('moment');var BPromise=require(_0xa4ec('0x2'));var rs=require(_0xa4ec('0x3'));var fs=require('fs');var Redis=require(_0xa4ec('0x4'));var db=require(_0xa4ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4ec('0x6'))(_0xa4ec('0x7'));var config=require('../../config/environment');var jayson=require(_0xa4ec('0x8'));var client=jayson[_0xa4ec('0x9')][_0xa4ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd513,_0x2f673e,_0x27845d){return new BPromise(function(_0x517acd,_0x25930e){return client[_0xa4ec('0xb')](_0xdd513,_0x27845d)[_0xa4ec('0xc')](function(_0x5c4cd5){logger[_0xa4ec('0xd')](_0xa4ec('0xe'),_0x2f673e,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2f673e,'request\x20sent',JSON[_0xa4ec('0xf')](_0x5c4cd5));if(_0x5c4cd5['error']){if(_0x5c4cd5['error'][_0xa4ec('0x10')]===0x1f4){logger['error'](_0xa4ec('0xe'),_0x2f673e,_0x5c4cd5[_0xa4ec('0x11')]['message']);return _0x25930e(_0x5c4cd5[_0xa4ec('0x11')]['message']);}logger['error'](_0xa4ec('0xe'),_0x2f673e,_0x5c4cd5[_0xa4ec('0x11')]['message']);return _0x517acd(_0x5c4cd5[_0xa4ec('0x11')]['message']);}else{logger[_0xa4ec('0xd')](_0xa4ec('0xe'),_0x2f673e,'request\x20sent');_0x517acd(_0x5c4cd5[_0xa4ec('0x12')][_0xa4ec('0x13')]);}})[_0xa4ec('0x14')](function(_0x4a5d6a){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x2f673e,_0x4a5d6a);_0x25930e(_0x4a5d6a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b2e9166..f6b3874 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1fe559,_0x25fba7){var _0xb5b18c=function(_0x5ca09d){while(--_0x5ca09d){_0x1fe559['push'](_0x1fe559['shift']());}};_0xb5b18c(++_0x25fba7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x18427f,_0x1dbd1a){var _0x26ae8d=function(_0x4ed9a5){while(--_0x4ed9a5){_0x18427f['push'](_0x18427f['shift']());}};_0x26ae8d(++_0x1dbd1a);}(_0x70e0,0x17b));var _0x070e=function(_0xf72e61,_0x5d97df){_0xf72e61=_0xf72e61-0x0;var _0x348ce5=_0x70e0[_0xf72e61];return _0x348ce5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index cf8acf4..7952ad0 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 _0xcde1=['Required\x20by\x20Asterisk','STRING','sequelize','exports','INTEGER'];(function(_0x48f382,_0x5527f5){var _0x42fdbd=function(_0x23d828){while(--_0x23d828){_0x48f382['push'](_0x48f382['shift']());}};_0x42fdbd(++_0x5527f5);}(_0xcde1,0x165));var _0x1cde=function(_0x4217b1,_0x1cf1ab){_0x4217b1=_0x4217b1-0x0;var _0xf47fbb=_0xcde1[_0x4217b1];return _0xf47fbb;};'use strict';var Sequelize=require(_0x1cde('0x0'));module[_0x1cde('0x1')]={'uniqueid':{'type':Sequelize[_0x1cde('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1cde('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1cde('0x3')},'UserId':{'type':Sequelize[_0x1cde('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1cde('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x1cde('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x1cde('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x1cde('0x3')},'penalty':{'type':Sequelize[_0x1cde('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x1cde('0x2')](0xb),'defaultValue':0x0,'comment':_0x1cde('0x3')}}; \ No newline at end of file +var _0x8173=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x8173,0x1db));var _0x3817=function(_0x403f25,_0x5dc12a){_0x403f25=_0x403f25-0x0;var _0x2ce0bd=_0x8173[_0x403f25];return _0x2ce0bd;};'use strict';var Sequelize=require(_0x3817('0x0'));module[_0x3817('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3817('0x2')},'membername':{'type':Sequelize[_0x3817('0x3')],'allowNull':![],'comment':_0x3817('0x2')},'UserId':{'type':Sequelize[_0x3817('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3817('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x3817('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x3817('0x2')},'penalty':{'type':Sequelize[_0x3817('0x4')](0xb),'defaultValue':0x0,'comment':_0x3817('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x3817('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index dedf9f1..4b00ea3 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 _0xc3cc=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','exports','events'];(function(_0x1eed89,_0x54697b){var _0x5c1877=function(_0x1df699){while(--_0x1df699){_0x1eed89['push'](_0x1eed89['shift']());}};_0x5c1877(++_0x54697b);}(_0xc3cc,0x6f));var _0xcc3c=function(_0x466dee,_0x4c9527){_0x466dee=_0x466dee-0x0;var _0x4997c0=_0xc3cc[_0x466dee];return _0x4997c0;};'use strict';var EventEmitter=require(_0xcc3c('0x0'));var UserVoiceQueueRt=require(_0xcc3c('0x1'))['db'][_0xcc3c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xcc3c('0x3')](0x0);var events={'afterCreate':_0xcc3c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4b038b){return function(_0x3f5e58,_0x5c0801,_0x19fbe7){UserVoiceQueueRtEvents['emit'](_0x4b038b+':'+_0x3f5e58['id'],_0x3f5e58);UserVoiceQueueRtEvents[_0xcc3c('0x5')](_0x4b038b,_0x3f5e58);_0x19fbe7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xcc3c('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x99cd=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','save','update','remove','emit'];(function(_0xd8375,_0x4a6e0e){var _0x256094=function(_0x2e1fdc){while(--_0x2e1fdc){_0xd8375['push'](_0xd8375['shift']());}};_0x256094(++_0x4a6e0e);}(_0x99cd,0x89));var _0xd99c=function(_0xfbc931,_0x2fb6bc){_0xfbc931=_0xfbc931-0x0;var _0x4e11f8=_0x99cd[_0xfbc931];return _0x4e11f8;};'use strict';var EventEmitter=require(_0xd99c('0x0'));var UserVoiceQueueRt=require(_0xd99c('0x1'))['db'][_0xd99c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd99c('0x3'),'afterUpdate':_0xd99c('0x4'),'afterDestroy':_0xd99c('0x5')};function emitEvent(_0x2e8c10){return function(_0x563b1d,_0x12debd,_0x5ad398){UserVoiceQueueRtEvents[_0xd99c('0x6')](_0x2e8c10+':'+_0x563b1d['id'],_0x563b1d);UserVoiceQueueRtEvents[_0xd99c('0x6')](_0x2e8c10,_0x563b1d);_0x5ad398(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xd99c('0x7')](e,emitEvent(event));}}module[_0xd99c('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 6e2c378..433b6db 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 _0xe497=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird'];(function(_0x21b08a,_0x4fc3c9){var _0x7b0759=function(_0x34cdf4){while(--_0x34cdf4){_0x21b08a['push'](_0x21b08a['shift']());}};_0x7b0759(++_0x4fc3c9);}(_0xe497,0xa4));var _0x7e49=function(_0xd24f9e,_0x7f2cc1){_0xd24f9e=_0xd24f9e-0x0;var _0x39da54=_0xe497[_0xd24f9e];return _0x39da54;};'use strict';var _=require(_0x7e49('0x0'));var util=require(_0x7e49('0x1'));var logger=require('../../config/logger')(_0x7e49('0x2'));var moment=require(_0x7e49('0x3'));var BPromise=require(_0x7e49('0x4'));var rp=require(_0x7e49('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e49('0x6'));var config=require(_0x7e49('0x7'));var attributes=require(_0x7e49('0x8'));module[_0x7e49('0x9')]=function(_0xce02a1,_0xa4663c){return _0xce02a1[_0x7e49('0xa')](_0x7e49('0xb'),attributes,{'tableName':_0x7e49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9151=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x57f48e,_0xacfd15){var _0x23c6f1=function(_0x898f7e){while(--_0x898f7e){_0x57f48e['push'](_0x57f48e['shift']());}};_0x23c6f1(++_0xacfd15);}(_0x9151,0x104));var _0x1915=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x9151[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x1915('0x0'));var util=require(_0x1915('0x1'));var logger=require(_0x1915('0x2'))(_0x1915('0x3'));var moment=require(_0x1915('0x4'));var BPromise=require(_0x1915('0x5'));var rp=require(_0x1915('0x6'));var fs=require('fs');var path=require(_0x1915('0x7'));var rimraf=require(_0x1915('0x8'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x1915('0x9')]=function(_0xdd9697,_0x1d15bf){return _0xdd9697[_0x1915('0xa')](_0x1915('0xb'),attributes,{'tableName':_0x1915('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8182f4b..39f4f28 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 _0x8d59=['redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults'];(function(_0x502b34,_0x1e10d7){var _0x4ba114=function(_0x562762){while(--_0x562762){_0x502b34['push'](_0x502b34['shift']());}};_0x4ba114(++_0x1e10d7);}(_0x8d59,0x105));var _0x98d5=function(_0x4ef63d,_0x351af1){_0x4ef63d=_0x4ef63d-0x0;var _0x237ec5=_0x8d59[_0x4ef63d];return _0x237ec5;};'use strict';var _=require(_0x98d5('0x0'));var util=require(_0x98d5('0x1'));var moment=require(_0x98d5('0x2'));var BPromise=require(_0x98d5('0x3'));var rs=require(_0x98d5('0x4'));var fs=require('fs');var Redis=require(_0x98d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98d5('0x6'));var logger=require(_0x98d5('0x7'))(_0x98d5('0x8'));var config=require(_0x98d5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x98d5('0xa')]({'port':0x232a});config['redis']=_[_0x98d5('0xb')](config[_0x98d5('0xc')],{'host':_0x98d5('0xd'),'port':0x18eb});var socket=require(_0x98d5('0xe'))(new Redis(config[_0x98d5('0xc')]));require(_0x98d5('0xf'))['register'](socket);function respondWithRpcPromise(_0x4be8ac,_0x16d0a8,_0x1fcc8d){return new BPromise(function(_0x4f8f7b,_0x4af22d){return client[_0x98d5('0x10')](_0x4be8ac,_0x1fcc8d)[_0x98d5('0x11')](function(_0x4174de){logger[_0x98d5('0x12')](_0x98d5('0x13'),_0x16d0a8,_0x98d5('0x14'));logger[_0x98d5('0x15')](_0x98d5('0x16'),_0x16d0a8,_0x98d5('0x14'),JSON[_0x98d5('0x17')](_0x4174de));if(_0x4174de['error']){if(_0x4174de['error'][_0x98d5('0x18')]===0x1f4){logger[_0x98d5('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x16d0a8,_0x4174de[_0x98d5('0x19')]['message']);return _0x4af22d(_0x4174de[_0x98d5('0x19')][_0x98d5('0x1a')]);}logger[_0x98d5('0x19')](_0x98d5('0x13'),_0x16d0a8,_0x4174de['error'][_0x98d5('0x1a')]);return _0x4f8f7b(_0x4174de[_0x98d5('0x19')][_0x98d5('0x1a')]);}else{logger[_0x98d5('0x12')](_0x98d5('0x13'),_0x16d0a8,_0x98d5('0x14'));_0x4f8f7b(_0x4174de[_0x98d5('0x1b')]['message']);}})[_0x98d5('0x1c')](function(_0x1855b8){logger[_0x98d5('0x19')](_0x98d5('0x13'),_0x16d0a8,_0x1855b8);_0x4af22d(_0x1855b8);});});}exports[_0x98d5('0x1d')]=function(_0x536861){var _0x53c43=this;return new Promise(function(_0x470248,_0x391b85){return db[_0x98d5('0x1e')][_0x98d5('0x1f')]({'raw':_0x536861[_0x98d5('0x20')]?_0x536861['options'][_0x98d5('0x21')]===undefined?!![]:![]:!![],'where':_0x536861['options']?_0x536861[_0x98d5('0x20')]['where']||null:null,'attributes':[[db[_0x98d5('0x22')]['fn'](_0x98d5('0x23'),db[_0x98d5('0x22')]['fn']('IF',db[_0x98d5('0x22')][_0x98d5('0x24')](_0x98d5('0x25')))),_0x98d5('0x26')]]})[_0x98d5('0x11')](function(_0x4a0c6d){logger[_0x98d5('0x12')](_0x98d5('0x1d'),_0x536861);logger[_0x98d5('0x15')](_0x98d5('0x1d'),_0x536861,JSON[_0x98d5('0x17')](_0x4a0c6d));_0x470248(_0x4a0c6d);})[_0x98d5('0x1c')](function(_0x5d9bcc){logger[_0x98d5('0x19')]('GetVoiceQueueRtPauses',_0x5d9bcc[_0x98d5('0x1a')],_0x536861);_0x391b85(_0x53c43[_0x98d5('0x19')](0x1f4,_0x5d9bcc['message']));});});}; \ No newline at end of file +var _0x4d14=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4d14,0x116));var _0x44d1=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x4d14[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x44d1('0x0'));var util=require(_0x44d1('0x1'));var moment=require(_0x44d1('0x2'));var BPromise=require(_0x44d1('0x3'));var rs=require(_0x44d1('0x4'));var fs=require('fs');var Redis=require(_0x44d1('0x5'));var db=require(_0x44d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x44d1('0x7'))('rpc');var config=require(_0x44d1('0x8'));var jayson=require(_0x44d1('0x9'));var client=jayson[_0x44d1('0xa')][_0x44d1('0xb')]({'port':0x232a});config['redis']=_[_0x44d1('0xc')](config[_0x44d1('0xd')],{'host':_0x44d1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x44d1('0xd')]));require(_0x44d1('0xf'))[_0x44d1('0x10')](socket);function respondWithRpcPromise(_0x19e72d,_0x273e76,_0x7c6289){return new BPromise(function(_0x4f3fe6,_0xd57ac9){return client[_0x44d1('0x11')](_0x19e72d,_0x7c6289)['then'](function(_0x27d45c){logger[_0x44d1('0x12')](_0x44d1('0x13'),_0x273e76,'request\x20sent');logger[_0x44d1('0x14')](_0x44d1('0x15'),_0x273e76,_0x44d1('0x16'),JSON[_0x44d1('0x17')](_0x27d45c));if(_0x27d45c['error']){if(_0x27d45c[_0x44d1('0x18')]['code']===0x1f4){logger[_0x44d1('0x18')](_0x44d1('0x13'),_0x273e76,_0x27d45c['error'][_0x44d1('0x19')]);return _0xd57ac9(_0x27d45c['error']['message']);}logger['error'](_0x44d1('0x13'),_0x273e76,_0x27d45c[_0x44d1('0x18')][_0x44d1('0x19')]);return _0x4f3fe6(_0x27d45c[_0x44d1('0x18')][_0x44d1('0x19')]);}else{logger[_0x44d1('0x12')](_0x44d1('0x13'),_0x273e76,_0x44d1('0x16'));_0x4f3fe6(_0x27d45c[_0x44d1('0x1a')][_0x44d1('0x19')]);}})[_0x44d1('0x1b')](function(_0x2a3cf5){logger['error'](_0x44d1('0x13'),_0x273e76,_0x2a3cf5);_0xd57ac9(_0x2a3cf5);});});}exports[_0x44d1('0x1c')]=function(_0x3cafd1){var _0x1b9f3f=this;return new Promise(function(_0x148017,_0x3a36a3){return db[_0x44d1('0x1d')][_0x44d1('0x1e')]({'raw':_0x3cafd1['options']?_0x3cafd1[_0x44d1('0x1f')][_0x44d1('0x20')]===undefined?!![]:![]:!![],'where':_0x3cafd1[_0x44d1('0x1f')]?_0x3cafd1[_0x44d1('0x1f')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x44d1('0x21'),db[_0x44d1('0x22')]['fn']('IF',db[_0x44d1('0x22')][_0x44d1('0x23')](_0x44d1('0x24')))),_0x44d1('0x25')]]})['then'](function(_0x1e4610){logger[_0x44d1('0x12')](_0x44d1('0x1c'),_0x3cafd1);logger[_0x44d1('0x14')]('GetVoiceQueueRtPauses',_0x3cafd1,JSON[_0x44d1('0x17')](_0x1e4610));_0x148017(_0x1e4610);})[_0x44d1('0x1b')](function(_0x36a420){logger[_0x44d1('0x18')](_0x44d1('0x1c'),_0x36a420[_0x44d1('0x19')],_0x3cafd1);_0x3a36a3(_0x1b9f3f[_0x44d1('0x18')](0x1f4,_0x36a420[_0x44d1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f00f497..3369f96 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 _0x9485=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x2c3f08,_0x380f2b){var _0x4ea2ab=function(_0x4b198a){while(--_0x4b198a){_0x2c3f08['push'](_0x2c3f08['shift']());}};_0x4ea2ab(++_0x380f2b);}(_0x9485,0x8b));var _0x5948=function(_0x1fb802,_0x2aa9e9){_0x1fb802=_0x1fb802-0x0;var _0x34205b=_0x9485[_0x1fb802];return _0x34205b;};'use strict';var UserVoiceQueueRtEvents=require(_0x5948('0x0'));var events=[_0x5948('0x1'),_0x5948('0x2'),_0x5948('0x3')];function createListener(_0x5ca17a,_0x42393d){return function(_0xc057c8){_0x42393d[_0x5948('0x4')](_0x5ca17a,_0xc057c8);};}function removeListener(_0x47b3f3,_0xcfd4b6){return function(){UserVoiceQueueRtEvents[_0x5948('0x5')](_0x47b3f3,_0xcfd4b6);};}exports[_0x5948('0x6')]=function(_0x4312a8){for(var _0x19ccdd=0x0,_0x283a13=events['length'];_0x19ccdd<_0x283a13;_0x19ccdd++){var _0x2cf314=events[_0x19ccdd];var _0x4e7f15=createListener(_0x5948('0x7')+_0x2cf314,_0x4312a8);UserVoiceQueueRtEvents['on'](_0x2cf314,_0x4e7f15);}}; \ No newline at end of file +var _0xc1c6=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','register'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1dcf75,_0x4398bc){_0x1dcf75=_0x1dcf75-0x0;var _0x31044a=_0xc1c6[_0x1dcf75];return _0x31044a;};'use strict';var UserVoiceQueueRtEvents=require(_0x6c1c('0x0'));var events=[_0x6c1c('0x1'),_0x6c1c('0x2'),'update'];function createListener(_0x114c93,_0x4c33ca){return function(_0x426398){_0x4c33ca[_0x6c1c('0x3')](_0x114c93,_0x426398);};}function removeListener(_0x265d2c,_0x59f799){return function(){UserVoiceQueueRtEvents['removeListener'](_0x265d2c,_0x59f799);};}exports[_0x6c1c('0x4')]=function(_0x524a6b){for(var _0x50c1bb=0x0,_0x582bec=events[_0x6c1c('0x5')];_0x50c1bb<_0x582bec;_0x50c1bb++){var _0x2eb1ba=events[_0x50c1bb];var _0x38369d=createListener(_0x6c1c('0x6')+_0x2eb1ba,_0x524a6b);UserVoiceQueueRtEvents['on'](_0x2eb1ba,_0x38369d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 5b2aa22..4b6b650 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x32eb47,_0x998598){var _0xdc7860=function(_0x29cf41){while(--_0x29cf41){_0x32eb47['push'](_0x32eb47['shift']());}};_0xdc7860(++_0x998598);}(_0x70e0,0x17b));var _0x070e=function(_0x43ac88,_0x1b8d7e){_0x43ac88=_0x43ac88-0x0;var _0x56c980=_0x70e0[_0x43ac88];return _0x56c980;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x697b6e,_0xd5ab09){var _0x4ea11c=function(_0x1ab3cf){while(--_0x1ab3cf){_0x697b6e['push'](_0x697b6e['shift']());}};_0x4ea11c(++_0xd5ab09);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 993ef41..7e275ab 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 _0x7968=['sequelize','exports','INTEGER'];(function(_0x3e21f6,_0x41194a){var _0x3bc368=function(_0x589f25){while(--_0x589f25){_0x3e21f6['push'](_0x3e21f6['shift']());}};_0x3bc368(++_0x41194a);}(_0x7968,0x105));var _0x8796=function(_0x34f08a,_0x5ad62d){_0x34f08a=_0x34f08a-0x0;var _0x5aa1a5=_0x7968[_0x34f08a];return _0x5aa1a5;};'use strict';var Sequelize=require(_0x8796('0x0'));module[_0x8796('0x1')]={'penalty':{'type':Sequelize[_0x8796('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd035=['INTEGER','sequelize','exports'];(function(_0x341054,_0x4cd6ea){var _0x3c1730=function(_0x4ac0ad){while(--_0x4ac0ad){_0x341054['push'](_0x341054['shift']());}};_0x3c1730(++_0x4cd6ea);}(_0xd035,0xdc));var _0x5d03=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xd035[_0x199c03];return _0x11a7d4;};'use strict';var Sequelize=require(_0x5d03('0x0'));module[_0x5d03('0x1')]={'penalty':{'type':Sequelize[_0x5d03('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index cbe381f..7619dfb 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 _0xcd28=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','../../config/logger','moment','bluebird'];(function(_0x1e65ab,_0x4c3321){var _0x1d68ed=function(_0x54bd45){while(--_0x54bd45){_0x1e65ab['push'](_0x1e65ab['shift']());}};_0x1d68ed(++_0x4c3321);}(_0xcd28,0x168));var _0x8cd2=function(_0xa8520c,_0x3e2a0e){_0xa8520c=_0xa8520c-0x0;var _0x5aa000=_0xcd28[_0xa8520c];return _0x5aa000;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8cd2('0x0'))('api');var moment=require(_0x8cd2('0x1'));var BPromise=require(_0x8cd2('0x2'));var rp=require(_0x8cd2('0x3'));var fs=require('fs');var path=require(_0x8cd2('0x4'));var rimraf=require(_0x8cd2('0x5'));var config=require(_0x8cd2('0x6'));var attributes=require(_0x8cd2('0x7'));module[_0x8cd2('0x8')]=function(_0x3410b0,_0xebc8fc){return _0x3410b0[_0x8cd2('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0x8cd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb10=['request-promise','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','moment'];(function(_0x501078,_0x5bb1e9){var _0x18eaac=function(_0x496e1c){while(--_0x496e1c){_0x501078['push'](_0x501078['shift']());}};_0x18eaac(++_0x5bb1e9);}(_0xbb10,0x103));var _0x0bb1=function(_0x6705fd,_0x439708){_0x6705fd=_0x6705fd-0x0;var _0x1dc197=_0xbb10[_0x6705fd];return _0x1dc197;};'use strict';var _=require('lodash');var util=require(_0x0bb1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0bb1('0x1'));var BPromise=require('bluebird');var rp=require(_0x0bb1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bb1('0x3'));var config=require('../../config/environment');var attributes=require(_0x0bb1('0x4'));module[_0x0bb1('0x5')]=function(_0xdca5ca,_0x1686db){return _0xdca5ca[_0x0bb1('0x6')](_0x0bb1('0x7'),attributes,{'tableName':_0x0bb1('0x8'),'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 0d63e10..49af2e7 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 _0x5533=['message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0xabd0bc,_0x203b56){var _0xdbde42=function(_0x45bfed){while(--_0x45bfed){_0xabd0bc['push'](_0xabd0bc['shift']());}};_0xdbde42(++_0x203b56);}(_0x5533,0x1e5));var _0x3553=function(_0x2d370d,_0x54dde8){_0x2d370d=_0x2d370d-0x0;var _0x40819d=_0x5533[_0x2d370d];return _0x40819d;};'use strict';var _=require(_0x3553('0x0'));var util=require(_0x3553('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3553('0x2'));var fs=require('fs');var Redis=require(_0x3553('0x3'));var db=require(_0x3553('0x4'))['db'];var utils=require(_0x3553('0x5'));var logger=require(_0x3553('0x6'))(_0x3553('0x7'));var config=require(_0x3553('0x8'));var jayson=require(_0x3553('0x9'));var client=jayson[_0x3553('0xa')][_0x3553('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39a876,_0x431073,_0x3ca1ce){return new BPromise(function(_0x1a0404,_0x2b6d06){return client[_0x3553('0xc')](_0x39a876,_0x3ca1ce)[_0x3553('0xd')](function(_0x3e9ae4){logger[_0x3553('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x431073,_0x3553('0xf'));logger[_0x3553('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x431073,_0x3553('0xf'),JSON[_0x3553('0x11')](_0x3e9ae4));if(_0x3e9ae4[_0x3553('0x12')]){if(_0x3e9ae4[_0x3553('0x12')][_0x3553('0x13')]===0x1f4){logger[_0x3553('0x12')](_0x3553('0x14'),_0x431073,_0x3e9ae4[_0x3553('0x12')]['message']);return _0x2b6d06(_0x3e9ae4[_0x3553('0x12')][_0x3553('0x15')]);}logger['error'](_0x3553('0x14'),_0x431073,_0x3e9ae4['error']['message']);return _0x1a0404(_0x3e9ae4['error'][_0x3553('0x15')]);}else{logger[_0x3553('0xe')](_0x3553('0x14'),_0x431073,_0x3553('0xf'));_0x1a0404(_0x3e9ae4['result'][_0x3553('0x15')]);}})['catch'](function(_0xfcb70c){logger['error'](_0x3553('0x14'),_0x431073,_0xfcb70c);_0x2b6d06(_0xfcb70c);});});} \ No newline at end of file +var _0x7c10=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x21c80a,_0x275d41){var _0x4a7719=function(_0xffe07b){while(--_0xffe07b){_0x21c80a['push'](_0x21c80a['shift']());}};_0x4a7719(++_0x275d41);}(_0x7c10,0xbc));var _0x07c1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7c10[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x07c1('0x0'));var util=require('util');var moment=require(_0x07c1('0x1'));var BPromise=require(_0x07c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07c1('0x3'));var db=require(_0x07c1('0x4'))['db'];var utils=require(_0x07c1('0x5'));var logger=require(_0x07c1('0x6'))(_0x07c1('0x7'));var config=require(_0x07c1('0x8'));var jayson=require(_0x07c1('0x9'));var client=jayson[_0x07c1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b44e7,_0x42ff07,_0x1037e0){return new BPromise(function(_0x87439b,_0x5b4ef9){return client[_0x07c1('0xb')](_0x4b44e7,_0x1037e0)[_0x07c1('0xc')](function(_0x4f7a50){logger['info'](_0x07c1('0xd'),_0x42ff07,'request\x20sent');logger[_0x07c1('0xe')](_0x07c1('0xf'),_0x42ff07,_0x07c1('0x10'),JSON[_0x07c1('0x11')](_0x4f7a50));if(_0x4f7a50['error']){if(_0x4f7a50[_0x07c1('0x12')][_0x07c1('0x13')]===0x1f4){logger['error'](_0x07c1('0xd'),_0x42ff07,_0x4f7a50[_0x07c1('0x12')]['message']);return _0x5b4ef9(_0x4f7a50[_0x07c1('0x12')][_0x07c1('0x14')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x42ff07,_0x4f7a50[_0x07c1('0x12')][_0x07c1('0x14')]);return _0x87439b(_0x4f7a50[_0x07c1('0x12')][_0x07c1('0x14')]);}else{logger[_0x07c1('0x15')](_0x07c1('0xd'),_0x42ff07,_0x07c1('0x10'));_0x87439b(_0x4f7a50[_0x07c1('0x16')][_0x07c1('0x14')]);}})[_0x07c1('0x17')](function(_0x228544){logger[_0x07c1('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x42ff07,_0x228544);_0x5b4ef9(_0x228544);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 08e7e92..19c9504 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 _0xbe22=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x272d97,_0x3cb745){var _0x40fc01=function(_0x1ad071){while(--_0x1ad071){_0x272d97['push'](_0x272d97['shift']());}};_0x40fc01(++_0x3cb745);}(_0xbe22,0x1c1));var _0x2be2=function(_0x4bc3df,_0x67dfc3){_0x4bc3df=_0x4bc3df-0x0;var _0x43fc60=_0xbe22[_0x4bc3df];return _0x43fc60;};'use strict';var multer=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2be2('0x2'));var router=express[_0x2be2('0x3')]();var fs_extra=require(_0x2be2('0x4'));var auth=require(_0x2be2('0x5'));var interaction=require(_0x2be2('0x6'));var config=require(_0x2be2('0x7'));var controller=require(_0x2be2('0x8'));router[_0x2be2('0x9')]('/',auth[_0x2be2('0xa')](),controller[_0x2be2('0xb')]);router['get'](_0x2be2('0xc'),auth[_0x2be2('0xa')](),controller[_0x2be2('0xd')]);router['post']('/',auth[_0x2be2('0xa')](),controller[_0x2be2('0xe')]);router[_0x2be2('0xf')](_0x2be2('0xc'),auth[_0x2be2('0xa')](),controller[_0x2be2('0x10')]);router[_0x2be2('0x11')](_0x2be2('0xc'),auth['isAuthenticated'](),controller[_0x2be2('0x12')]);module[_0x2be2('0x13')]=router; \ No newline at end of file +var _0xbd3b=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','post','create','put','update','delete'];(function(_0x28fea9,_0x9d92c7){var _0x5cdc4b=function(_0x5822cb){while(--_0x5822cb){_0x28fea9['push'](_0x28fea9['shift']());}};_0x5cdc4b(++_0x9d92c7);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x1ce924,_0x220d57){_0x1ce924=_0x1ce924-0x0;var _0x2a8240=_0xbd3b[_0x1ce924];return _0x2a8240;};'use strict';var multer=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var path=require(_0xbbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbd3('0x3'));var router=express[_0xbbd3('0x4')]();var fs_extra=require(_0xbbd3('0x5'));var auth=require(_0xbbd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd3('0x7'));var controller=require(_0xbbd3('0x8'));router['get']('/',auth[_0xbbd3('0x9')](),controller['index']);router[_0xbbd3('0xa')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller['show']);router[_0xbbd3('0xc')]('/',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xd')]);router[_0xbbd3('0xe')]('/:id',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xf')]);router[_0xbbd3('0x10')](_0xbbd3('0xb'),auth['isAuthenticated'](),controller[_0xbbd3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 93b90aa..8456f80 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 _0x636d=['sequelize','exports','STRING','name'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x636d,0xf0));var _0xd636=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x636d[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0xd636('0x0'));module[_0xd636('0x1')]={'name':{'type':Sequelize[_0xd636('0x2')],'unique':_0xd636('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2308=['STRING','sequelize','exports'];(function(_0x3612d5,_0xba7292){var _0x2febbf=function(_0x15a004){while(--_0x15a004){_0x3612d5['push'](_0x3612d5['shift']());}};_0x2febbf(++_0xba7292);}(_0x2308,0x193));var _0x8230=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x2308[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x8230('0x0'));module[_0x8230('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8230('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b38833d..ef3261b 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 _0xdb40=['map','Variable','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Variables','UserProfileSection','autoAssociation','UserProfileResource','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','get','error','name','send','index'];(function(_0x4b7f4e,_0x449f4e){var _0x4fa0d6=function(_0x36bbee){while(--_0x36bbee){_0x4b7f4e['push'](_0x4b7f4e['shift']());}};_0x4fa0d6(++_0x449f4e);}(_0xdb40,0x1b9));var _0x0db4=function(_0x133804,_0x46eafb){_0x133804=_0x133804-0x0;var _0x45b070=_0xdb40[_0x133804];return _0x45b070;};'use strict';var emlformat=require(_0x0db4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0db4('0x1'));var rp=require(_0x0db4('0x2'));var moment=require(_0x0db4('0x3'));var BPromise=require(_0x0db4('0x4'));var Mustache=require(_0x0db4('0x5'));var util=require(_0x0db4('0x6'));var path=require(_0x0db4('0x7'));var sox=require(_0x0db4('0x8'));var csv=require('to-csv');var ejs=require(_0x0db4('0x9'));var fs=require('fs');var fs_extra=require(_0x0db4('0xa'));var _=require('lodash');var squel=require(_0x0db4('0xb'));var crypto=require(_0x0db4('0xc'));var jsforce=require(_0x0db4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0db4('0xe'));var querystring=require(_0x0db4('0xf'));var Papa=require(_0x0db4('0x10'));var Redis=require(_0x0db4('0x11'));var authService=require(_0x0db4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0db4('0x13'));var hardwareService=require(_0x0db4('0x14'));var logger=require(_0x0db4('0x15'))(_0x0db4('0x16'));var utils=require(_0x0db4('0x17'));var config=require(_0x0db4('0x18'));var licenseUtil=require(_0x0db4('0x19'));var db=require(_0x0db4('0x1a'))['db'];function respondWithStatusCode(_0x30e893,_0x5b0f4e){_0x5b0f4e=_0x5b0f4e||0xcc;return function(_0x57beff){if(_0x57beff){return _0x30e893[_0x0db4('0x1b')](_0x5b0f4e);}return _0x30e893[_0x0db4('0x1c')](_0x5b0f4e)[_0x0db4('0x1d')]();};}function respondWithResult(_0x5ad7b6,_0xdb85c6){_0xdb85c6=_0xdb85c6||0xc8;return function(_0x5e938f){if(_0x5e938f){return _0x5ad7b6['status'](_0xdb85c6)[_0x0db4('0x1e')](_0x5e938f);}};}function respondWithFilteredResult(_0x481bb4,_0x124853){return function(_0x128190){if(_0x128190){var _0x39a8ec=typeof _0x124853[_0x0db4('0x1f')]===_0x0db4('0x20')&&typeof _0x124853[_0x0db4('0x21')]==='undefined';var _0x7a6442=_0x128190[_0x0db4('0x22')];var _0x265fc8=_0x39a8ec?0x0:_0x124853[_0x0db4('0x1f')];var _0x483216=_0x39a8ec?_0x128190[_0x0db4('0x22')]:_0x124853[_0x0db4('0x1f')]+_0x124853[_0x0db4('0x21')];var _0xdbca06;if(_0x483216>=_0x7a6442){_0x483216=_0x7a6442;_0xdbca06=0xc8;}else{_0xdbca06=0xce;}_0x481bb4[_0x0db4('0x1c')](_0xdbca06);return _0x481bb4['set'](_0x0db4('0x23'),_0x265fc8+'-'+_0x483216+'/'+_0x7a6442)[_0x0db4('0x1e')](_0x128190);}return null;};}function patchUpdates(_0xaec855){return function(_0x183f2e){try{jsonpatch[_0x0db4('0x24')](_0x183f2e,_0xaec855,!![]);}catch(_0x9028e){return BPromise[_0x0db4('0x25')](_0x9028e);}return _0x183f2e['save']();};}function saveUpdates(_0x5c0c4f,_0x5c22cb){return function(_0x1d8b2c){if(_0x1d8b2c){return _0x1d8b2c['update'](_0x5c0c4f)['then'](function(_0x561f67){return _0x561f67;});}return null;};}function removeEntity(_0x25a3c1,_0x34c666){return function(_0x2ba5cd){if(_0x2ba5cd){return _0x2ba5cd[_0x0db4('0x26')]()[_0x0db4('0x27')](function(){var _0x6847ab=_0x2ba5cd[_0x0db4('0x28')]({'plain':!![]});var _0x4444f0='Variables';return db['UserProfileResource'][_0x0db4('0x26')]({'where':{'type':_0x4444f0,'resourceId':_0x6847ab['id']}})[_0x0db4('0x27')](function(){return _0x2ba5cd;});})[_0x0db4('0x27')](function(){_0x25a3c1[_0x0db4('0x1c')](0xcc)[_0x0db4('0x1d')]();});}};}function handleEntityNotFound(_0x114c8a,_0x12ff54){return function(_0x4e54ff){if(!_0x4e54ff){_0x114c8a[_0x0db4('0x1b')](0x194);}return _0x4e54ff;};}function handleError(_0x524e39,_0x69eede){_0x69eede=_0x69eede||0x1f4;return function(_0x34c642){logger[_0x0db4('0x29')](_0x34c642['stack']);if(_0x34c642[_0x0db4('0x2a')]){delete _0x34c642['name'];}_0x524e39['status'](_0x69eede)[_0x0db4('0x2b')](_0x34c642);};}exports[_0x0db4('0x2c')]=function(_0xe00b59,_0x58fa80){var _0x561ca8={},_0x25b06f={},_0x367e7f={'count':0x0,'rows':[]};var _0x54d3d2=_[_0x0db4('0x2d')](db[_0x0db4('0x2e')][_0x0db4('0x2f')],function(_0x2c7984){return{'name':_0x2c7984[_0x0db4('0x30')],'type':_0x2c7984[_0x0db4('0x31')][_0x0db4('0x32')]};});_0x25b06f['model']=_[_0x0db4('0x2d')](_0x54d3d2,'name');_0x25b06f[_0x0db4('0x33')]=_['keys'](_0xe00b59[_0x0db4('0x33')]);_0x25b06f[_0x0db4('0x34')]=_[_0x0db4('0x35')](_0x25b06f[_0x0db4('0x36')],_0x25b06f['query']);_0x561ca8[_0x0db4('0x37')]=_['intersection'](_0x25b06f[_0x0db4('0x36')],qs[_0x0db4('0x38')](_0xe00b59[_0x0db4('0x33')][_0x0db4('0x38')]));_0x561ca8[_0x0db4('0x37')]=_0x561ca8[_0x0db4('0x37')][_0x0db4('0x39')]?_0x561ca8['attributes']:_0x25b06f[_0x0db4('0x36')];if(!_0xe00b59[_0x0db4('0x33')][_0x0db4('0x3a')](_0x0db4('0x3b'))){_0x561ca8[_0x0db4('0x21')]=qs[_0x0db4('0x21')](_0xe00b59[_0x0db4('0x33')][_0x0db4('0x21')]);_0x561ca8[_0x0db4('0x1f')]=qs[_0x0db4('0x1f')](_0xe00b59['query']['offset']);}_0x561ca8[_0x0db4('0x3c')]=qs[_0x0db4('0x3d')](_0xe00b59[_0x0db4('0x33')]['sort']);_0x561ca8['where']=qs[_0x0db4('0x34')](_['pick'](_0xe00b59[_0x0db4('0x33')],_0x25b06f[_0x0db4('0x34')]),_0x54d3d2);if(_0xe00b59['query'][_0x0db4('0x3e')]){_0x561ca8[_0x0db4('0x3f')]=_[_0x0db4('0x40')](_0x561ca8['where'],{'$or':_[_0x0db4('0x2d')](_0x54d3d2,function(_0xfa9493){if(_0xfa9493[_0x0db4('0x31')]!=='VIRTUAL'){var _0x3ac3e0={};_0x3ac3e0[_0xfa9493[_0x0db4('0x2a')]]={'$like':'%'+_0xe00b59[_0x0db4('0x33')][_0x0db4('0x3e')]+'%'};return _0x3ac3e0;}})});}_0x561ca8=_['merge']({},_0x561ca8,_0xe00b59[_0x0db4('0x41')]);var _0xc1c7c3={'where':_0x561ca8[_0x0db4('0x3f')]};return db[_0x0db4('0x2e')][_0x0db4('0x22')](_0xc1c7c3)[_0x0db4('0x27')](function(_0x29ba96){_0x367e7f[_0x0db4('0x22')]=_0x29ba96;if(_0xe00b59[_0x0db4('0x33')]['includeAll']){_0x561ca8[_0x0db4('0x42')]=[{'all':!![]}];}return db[_0x0db4('0x2e')][_0x0db4('0x43')](_0x561ca8);})[_0x0db4('0x27')](function(_0x54ded6){_0x367e7f[_0x0db4('0x44')]=_0x54ded6;return _0x367e7f;})[_0x0db4('0x27')](respondWithFilteredResult(_0x58fa80,_0x561ca8))[_0x0db4('0x45')](handleError(_0x58fa80,null));};exports['show']=function(_0x8bdc38,_0x563233){var _0x10b1b9={'raw':!![],'where':{'id':_0x8bdc38['params']['id']}},_0x8dd58={};_0x8dd58[_0x0db4('0x36')]=_[_0x0db4('0x46')](db[_0x0db4('0x2e')][_0x0db4('0x2f')]);_0x8dd58[_0x0db4('0x33')]=_[_0x0db4('0x46')](_0x8bdc38[_0x0db4('0x33')]);_0x8dd58[_0x0db4('0x34')]=_[_0x0db4('0x35')](_0x8dd58[_0x0db4('0x36')],_0x8dd58[_0x0db4('0x33')]);_0x10b1b9[_0x0db4('0x37')]=_[_0x0db4('0x35')](_0x8dd58[_0x0db4('0x36')],qs['fields'](_0x8bdc38[_0x0db4('0x33')][_0x0db4('0x38')]));_0x10b1b9[_0x0db4('0x37')]=_0x10b1b9[_0x0db4('0x37')][_0x0db4('0x39')]?_0x10b1b9['attributes']:_0x8dd58[_0x0db4('0x36')];if(_0x8bdc38[_0x0db4('0x33')]['includeAll']){_0x10b1b9[_0x0db4('0x42')]=[{'all':!![]}];}_0x10b1b9=_[_0x0db4('0x40')]({},_0x10b1b9,_0x8bdc38[_0x0db4('0x41')]);return db[_0x0db4('0x2e')][_0x0db4('0x47')](_0x10b1b9)['then'](handleEntityNotFound(_0x563233,null))[_0x0db4('0x27')](respondWithResult(_0x563233,null))['catch'](handleError(_0x563233,null));};exports[_0x0db4('0x48')]=function(_0x2c0064,_0x412bd9){return db[_0x0db4('0x2e')][_0x0db4('0x48')](_0x2c0064[_0x0db4('0x49')],{})['then'](function(_0x59b74e){var _0x5810d8=_0x2c0064['user'][_0x0db4('0x28')]({'plain':!![]});if(!_0x5810d8)throw new Error(_0x0db4('0x4a'));if(_0x5810d8['role']==='user'){var _0x1998e0=_0x59b74e[_0x0db4('0x28')]({'plain':!![]});var _0x471573=_0x0db4('0x4b');return db[_0x0db4('0x4c')]['find']({'where':{'name':_0x471573,'userProfileId':_0x5810d8['userProfileId']},'raw':!![]})['then'](function(_0x25ca3f){if(_0x25ca3f&&_0x25ca3f[_0x0db4('0x4d')]===0x0){return db[_0x0db4('0x4e')][_0x0db4('0x48')]({'name':_0x1998e0[_0x0db4('0x2a')],'resourceId':_0x1998e0['id'],'type':_0x25ca3f['name'],'sectionId':_0x25ca3f['id']},{})[_0x0db4('0x27')](function(){return _0x59b74e;});}else{return _0x59b74e;}})[_0x0db4('0x45')](function(_0x123f7a){logger[_0x0db4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x123f7a);throw _0x123f7a;});}return _0x59b74e;})['then'](respondWithResult(_0x412bd9,0xc9))[_0x0db4('0x45')](handleError(_0x412bd9,null));};exports[_0x0db4('0x4f')]=function(_0x6d4d6e,_0x36a7cd){if(_0x6d4d6e[_0x0db4('0x49')]['id']){delete _0x6d4d6e['body']['id'];}return db[_0x0db4('0x2e')]['find']({'where':{'id':_0x6d4d6e['params']['id']}})[_0x0db4('0x27')](handleEntityNotFound(_0x36a7cd,null))[_0x0db4('0x27')](saveUpdates(_0x6d4d6e[_0x0db4('0x49')],null))[_0x0db4('0x27')](respondWithResult(_0x36a7cd,null))['catch'](handleError(_0x36a7cd,null));};exports[_0x0db4('0x26')]=function(_0x31e124,_0x71bd5){return db[_0x0db4('0x2e')]['find']({'where':{'id':_0x31e124[_0x0db4('0x50')]['id']}})['then'](handleEntityNotFound(_0x71bd5,null))[_0x0db4('0x27')](removeEntity(_0x71bd5,null))[_0x0db4('0x45')](handleError(_0x71bd5,null));}; \ No newline at end of file +var _0xc66e=['merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','count','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','stack','name','map','Variable','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','type'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xc66e,0xb4));var _0xec66=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xc66e[_0x3a0c4f];return _0x247049;};'use strict';var emlformat=require(_0xec66('0x0'));var rimraf=require(_0xec66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xec66('0x2'));var moment=require(_0xec66('0x3'));var BPromise=require(_0xec66('0x4'));var Mustache=require(_0xec66('0x5'));var util=require(_0xec66('0x6'));var path=require(_0xec66('0x7'));var sox=require(_0xec66('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec66('0x9'));var squel=require(_0xec66('0xa'));var crypto=require(_0xec66('0xb'));var jsforce=require(_0xec66('0xc'));var deskjs=require(_0xec66('0xd'));var toCsv=require(_0xec66('0xe'));var querystring=require(_0xec66('0xf'));var Papa=require('papaparse');var Redis=require(_0xec66('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xec66('0x11'));var as=require(_0xec66('0x12'));var hardwareService=require(_0xec66('0x13'));var logger=require(_0xec66('0x14'))('api');var utils=require(_0xec66('0x15'));var config=require(_0xec66('0x16'));var licenseUtil=require(_0xec66('0x17'));var db=require(_0xec66('0x18'))['db'];function respondWithStatusCode(_0x185933,_0x3d3781){_0x3d3781=_0x3d3781||0xcc;return function(_0x162169){if(_0x162169){return _0x185933['sendStatus'](_0x3d3781);}return _0x185933[_0xec66('0x19')](_0x3d3781)[_0xec66('0x1a')]();};}function respondWithResult(_0x36cceb,_0x5e5bcc){_0x5e5bcc=_0x5e5bcc||0xc8;return function(_0x2aec9b){if(_0x2aec9b){return _0x36cceb[_0xec66('0x19')](_0x5e5bcc)[_0xec66('0x1b')](_0x2aec9b);}};}function respondWithFilteredResult(_0x20192c,_0x2bc999){return function(_0x2eac37){if(_0x2eac37){var _0xc200b=typeof _0x2bc999['offset']==='undefined'&&typeof _0x2bc999[_0xec66('0x1c')]===_0xec66('0x1d');var _0x5c1705=_0x2eac37['count'];var _0x5953d7=_0xc200b?0x0:_0x2bc999[_0xec66('0x1e')];var _0x582c9e=_0xc200b?_0x2eac37[_0xec66('0x1f')]:_0x2bc999[_0xec66('0x1e')]+_0x2bc999[_0xec66('0x1c')];var _0x59e177;if(_0x582c9e>=_0x5c1705){_0x582c9e=_0x5c1705;_0x59e177=0xc8;}else{_0x59e177=0xce;}_0x20192c['status'](_0x59e177);return _0x20192c['set']('Content-Range',_0x5953d7+'-'+_0x582c9e+'/'+_0x5c1705)[_0xec66('0x1b')](_0x2eac37);}return null;};}function patchUpdates(_0x23ea07){return function(_0x364abc){try{jsonpatch['apply'](_0x364abc,_0x23ea07,!![]);}catch(_0x3bd4d5){return BPromise[_0xec66('0x20')](_0x3bd4d5);}return _0x364abc[_0xec66('0x21')]();};}function saveUpdates(_0x319578,_0x57c5a7){return function(_0x39020d){if(_0x39020d){return _0x39020d[_0xec66('0x22')](_0x319578)[_0xec66('0x23')](function(_0x4a1924){return _0x4a1924;});}return null;};}function removeEntity(_0x199338,_0x144578){return function(_0x58c2d3){if(_0x58c2d3){return _0x58c2d3['destroy']()[_0xec66('0x23')](function(){var _0x518701=_0x58c2d3[_0xec66('0x24')]({'plain':!![]});var _0x5bbefe=_0xec66('0x25');return db[_0xec66('0x26')][_0xec66('0x27')]({'where':{'type':_0x5bbefe,'resourceId':_0x518701['id']}})['then'](function(){return _0x58c2d3;});})[_0xec66('0x23')](function(){_0x199338[_0xec66('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42f886,_0x31ca1d){return function(_0xfe7993){if(!_0xfe7993){_0x42f886[_0xec66('0x28')](0x194);}return _0xfe7993;};}function handleError(_0x24652d,_0x36815a){_0x36815a=_0x36815a||0x1f4;return function(_0x3e8d52){logger['error'](_0x3e8d52[_0xec66('0x29')]);if(_0x3e8d52[_0xec66('0x2a')]){delete _0x3e8d52['name'];}_0x24652d['status'](_0x36815a)['send'](_0x3e8d52);};}exports['index']=function(_0x4a92a4,_0x3d61a6){var _0x2e8a12={},_0x3dd0f9={},_0x29f008={'count':0x0,'rows':[]};var _0x33545d=_[_0xec66('0x2b')](db[_0xec66('0x2c')]['rawAttributes'],function(_0x4f5654){return{'name':_0x4f5654[_0xec66('0x2d')],'type':_0x4f5654['type']['key']};});_0x3dd0f9['model']=_[_0xec66('0x2b')](_0x33545d,_0xec66('0x2a'));_0x3dd0f9[_0xec66('0x2e')]=_[_0xec66('0x2f')](_0x4a92a4['query']);_0x3dd0f9[_0xec66('0x30')]=_[_0xec66('0x31')](_0x3dd0f9[_0xec66('0x32')],_0x3dd0f9[_0xec66('0x2e')]);_0x2e8a12[_0xec66('0x33')]=_[_0xec66('0x31')](_0x3dd0f9[_0xec66('0x32')],qs[_0xec66('0x34')](_0x4a92a4[_0xec66('0x2e')][_0xec66('0x34')]));_0x2e8a12['attributes']=_0x2e8a12[_0xec66('0x33')]['length']?_0x2e8a12[_0xec66('0x33')]:_0x3dd0f9[_0xec66('0x32')];if(!_0x4a92a4[_0xec66('0x2e')][_0xec66('0x35')](_0xec66('0x36'))){_0x2e8a12[_0xec66('0x1c')]=qs[_0xec66('0x1c')](_0x4a92a4[_0xec66('0x2e')]['limit']);_0x2e8a12[_0xec66('0x1e')]=qs[_0xec66('0x1e')](_0x4a92a4[_0xec66('0x2e')][_0xec66('0x1e')]);}_0x2e8a12[_0xec66('0x37')]=qs['sort'](_0x4a92a4['query']['sort']);_0x2e8a12[_0xec66('0x38')]=qs[_0xec66('0x30')](_[_0xec66('0x39')](_0x4a92a4[_0xec66('0x2e')],_0x3dd0f9[_0xec66('0x30')]),_0x33545d);if(_0x4a92a4[_0xec66('0x2e')][_0xec66('0x3a')]){_0x2e8a12['where']=_['merge'](_0x2e8a12[_0xec66('0x38')],{'$or':_[_0xec66('0x2b')](_0x33545d,function(_0x4381cd){if(_0x4381cd[_0xec66('0x3b')]!=='VIRTUAL'){var _0x2f4fe6={};_0x2f4fe6[_0x4381cd['name']]={'$like':'%'+_0x4a92a4[_0xec66('0x2e')][_0xec66('0x3a')]+'%'};return _0x2f4fe6;}})});}_0x2e8a12=_[_0xec66('0x3c')]({},_0x2e8a12,_0x4a92a4[_0xec66('0x3d')]);var _0x1f5fab={'where':_0x2e8a12['where']};return db['Variable'][_0xec66('0x1f')](_0x1f5fab)['then'](function(_0x3790e4){_0x29f008[_0xec66('0x1f')]=_0x3790e4;if(_0x4a92a4['query'][_0xec66('0x3e')]){_0x2e8a12[_0xec66('0x3f')]=[{'all':!![]}];}return db[_0xec66('0x2c')][_0xec66('0x40')](_0x2e8a12);})[_0xec66('0x23')](function(_0x206edf){_0x29f008[_0xec66('0x41')]=_0x206edf;return _0x29f008;})[_0xec66('0x23')](respondWithFilteredResult(_0x3d61a6,_0x2e8a12))[_0xec66('0x42')](handleError(_0x3d61a6,null));};exports[_0xec66('0x43')]=function(_0x3543f7,_0x3e69d3){var _0x529646={'raw':!![],'where':{'id':_0x3543f7[_0xec66('0x44')]['id']}},_0x4ad69e={};_0x4ad69e['model']=_['keys'](db['Variable']['rawAttributes']);_0x4ad69e[_0xec66('0x2e')]=_[_0xec66('0x2f')](_0x3543f7[_0xec66('0x2e')]);_0x4ad69e[_0xec66('0x30')]=_[_0xec66('0x31')](_0x4ad69e['model'],_0x4ad69e[_0xec66('0x2e')]);_0x529646[_0xec66('0x33')]=_[_0xec66('0x31')](_0x4ad69e[_0xec66('0x32')],qs[_0xec66('0x34')](_0x3543f7[_0xec66('0x2e')]['fields']));_0x529646['attributes']=_0x529646[_0xec66('0x33')][_0xec66('0x45')]?_0x529646[_0xec66('0x33')]:_0x4ad69e['model'];if(_0x3543f7[_0xec66('0x2e')][_0xec66('0x3e')]){_0x529646[_0xec66('0x3f')]=[{'all':!![]}];}_0x529646=_[_0xec66('0x3c')]({},_0x529646,_0x3543f7['options']);return db[_0xec66('0x2c')][_0xec66('0x46')](_0x529646)[_0xec66('0x23')](handleEntityNotFound(_0x3e69d3,null))[_0xec66('0x23')](respondWithResult(_0x3e69d3,null))[_0xec66('0x42')](handleError(_0x3e69d3,null));};exports['create']=function(_0x13bd87,_0x38e93f){return db[_0xec66('0x2c')][_0xec66('0x47')](_0x13bd87[_0xec66('0x48')],{})[_0xec66('0x23')](function(_0x3721ae){var _0x36286c=_0x13bd87[_0xec66('0x49')][_0xec66('0x24')]({'plain':!![]});if(!_0x36286c)throw new Error(_0xec66('0x4a'));if(_0x36286c[_0xec66('0x4b')]===_0xec66('0x49')){var _0x118b7d=_0x3721ae['get']({'plain':!![]});var _0x1c4e87=_0xec66('0x25');return db[_0xec66('0x4c')][_0xec66('0x46')]({'where':{'name':_0x1c4e87,'userProfileId':_0x36286c[_0xec66('0x4d')]},'raw':!![]})[_0xec66('0x23')](function(_0x5418e3){if(_0x5418e3&&_0x5418e3['autoAssociation']===0x0){return db[_0xec66('0x26')][_0xec66('0x47')]({'name':_0x118b7d[_0xec66('0x2a')],'resourceId':_0x118b7d['id'],'type':_0x5418e3['name'],'sectionId':_0x5418e3['id']},{})[_0xec66('0x23')](function(){return _0x3721ae;});}else{return _0x3721ae;}})[_0xec66('0x42')](function(_0x1b12c9){logger[_0xec66('0x4e')](_0xec66('0x4f'),_0x1b12c9);throw _0x1b12c9;});}return _0x3721ae;})[_0xec66('0x23')](respondWithResult(_0x38e93f,0xc9))[_0xec66('0x42')](handleError(_0x38e93f,null));};exports['update']=function(_0x208f9d,_0x431612){if(_0x208f9d[_0xec66('0x48')]['id']){delete _0x208f9d[_0xec66('0x48')]['id'];}return db[_0xec66('0x2c')][_0xec66('0x46')]({'where':{'id':_0x208f9d['params']['id']}})['then'](handleEntityNotFound(_0x431612,null))[_0xec66('0x23')](saveUpdates(_0x208f9d[_0xec66('0x48')],null))['then'](respondWithResult(_0x431612,null))[_0xec66('0x42')](handleError(_0x431612,null));};exports[_0xec66('0x27')]=function(_0x5553dc,_0x5e4bea){return db[_0xec66('0x2c')][_0xec66('0x46')]({'where':{'id':_0x5553dc['params']['id']}})['then'](handleEntityNotFound(_0x5e4bea,null))[_0xec66('0x23')](removeEntity(_0x5e4bea,null))[_0xec66('0x42')](handleError(_0x5e4bea,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 77cc94d..31eb52c 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 _0x5923=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','util','../../config/logger'];(function(_0x1d5f43,_0x56277f){var _0xea8d41=function(_0x1248a3){while(--_0x1248a3){_0x1d5f43['push'](_0x1d5f43['shift']());}};_0xea8d41(++_0x56277f);}(_0x5923,0xdd));var _0x3592=function(_0x16c824,_0x363c1d){_0x16c824=_0x16c824-0x0;var _0x267974=_0x5923[_0x16c824];return _0x267974;};'use strict';var _=require(_0x3592('0x0'));var util=require(_0x3592('0x1'));var logger=require(_0x3592('0x2'))(_0x3592('0x3'));var moment=require(_0x3592('0x4'));var BPromise=require(_0x3592('0x5'));var rp=require(_0x3592('0x6'));var fs=require('fs');var path=require(_0x3592('0x7'));var rimraf=require(_0x3592('0x8'));var config=require(_0x3592('0x9'));var attributes=require(_0x3592('0xa'));module[_0x3592('0xb')]=function(_0x551370,_0x58156d){return _0x551370[_0x3592('0xc')]('Variable',attributes,{'tableName':_0x3592('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37a5=['path','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash','api','bluebird','request-promise'];(function(_0x3b820d,_0x13718c){var _0x1e23a7=function(_0x40c658){while(--_0x40c658){_0x3b820d['push'](_0x3b820d['shift']());}};_0x1e23a7(++_0x13718c);}(_0x37a5,0x167));var _0x537a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x37a5[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x537a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x537a('0x1'));var moment=require('moment');var BPromise=require(_0x537a('0x2'));var rp=require(_0x537a('0x3'));var fs=require('fs');var path=require(_0x537a('0x4'));var rimraf=require(_0x537a('0x5'));var config=require('../../config/environment');var attributes=require(_0x537a('0x6'));module[_0x537a('0x7')]=function(_0x320ed4,_0x577428){return _0x320ed4[_0x537a('0x8')](_0x537a('0x9'),attributes,{'tableName':_0x537a('0xa'),'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 8af9a0e..8b41c93 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x3f7855,_0x535342){var _0x301fb7=function(_0x1d59c3){while(--_0x1d59c3){_0x3f7855['push'](_0x3f7855['shift']());}};_0x301fb7(++_0x535342);}(_0x55ca,0x126));var _0xa55c=function(_0x566c5a,_0x42e09c){_0x566c5a=_0x566c5a-0x0;var _0x3c4abe=_0x55ca[_0x566c5a];return _0x3c4abe;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x326f,0xd1));var _0xf326=function(_0x339070,_0x5cf3f2){_0x339070=_0x339070-0x0;var _0xa66e7e=_0x326f[_0x339070];return _0xa66e7e;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 32aa041..786cb42 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 _0xe49e=['restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull'];(function(_0x5e6ebe,_0x373752){var _0x5d80a0=function(_0x145677){while(--_0x145677){_0x5e6ebe['push'](_0x5e6ebe['shift']());}};_0x5d80a0(++_0x373752);}(_0xe49e,0x112));var _0xee49=function(_0x281b8c,_0x47de6f){_0x281b8c=_0x281b8c-0x0;var _0x1adce8=_0xe49e[_0x281b8c];return _0x1adce8;};'use strict';var express=require('express');var router=express[_0xee49('0x0')]();var auth=require(_0xee49('0x1'));var controller=require(_0xee49('0x2'));router[_0xee49('0x3')]('/',controller[_0xee49('0x4')]);router[_0xee49('0x3')](_0xee49('0x5'),auth[_0xee49('0x6')](),auth[_0xee49('0x7')](),controller['fetch']);router[_0xee49('0x3')](_0xee49('0x8'),auth[_0xee49('0x6')](),auth[_0xee49('0x7')](),controller[_0xee49('0x9')]);router[_0xee49('0x3')](_0xee49('0xa'),auth[_0xee49('0x6')](),auth['canUpdate'](),controller['pull']);router['get']('/restart',auth[_0xee49('0x6')](),controller[_0xee49('0xb')]);router['get'](_0xee49('0xc'),controller[_0xee49('0xd')]);module[_0xee49('0xe')]=router; \ No newline at end of file +var _0x8391=['express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/restart','restart','/migrations','exports'];(function(_0x5bc710,_0x5c0f96){var _0x4fd9a4=function(_0x1e4783){while(--_0x1e4783){_0x5bc710['push'](_0x5bc710['shift']());}};_0x4fd9a4(++_0x5c0f96);}(_0x8391,0xd0));var _0x1839=function(_0x3572ba,_0x5c6abb){_0x3572ba=_0x3572ba-0x0;var _0x45dc60=_0x8391[_0x3572ba];return _0x45dc60;};'use strict';var express=require(_0x1839('0x0'));var router=express[_0x1839('0x1')]();var auth=require(_0x1839('0x2'));var controller=require(_0x1839('0x3'));router[_0x1839('0x4')]('/',controller[_0x1839('0x5')]);router['get'](_0x1839('0x6'),auth[_0x1839('0x7')](),auth[_0x1839('0x8')](),controller[_0x1839('0x9')]);router[_0x1839('0x4')](_0x1839('0xa'),auth['isAuthenticated'](),auth[_0x1839('0x8')](),controller[_0x1839('0xb')]);router[_0x1839('0x4')]('/pull',auth[_0x1839('0x7')](),auth[_0x1839('0x8')](),controller['pull']);router['get'](_0x1839('0xc'),auth[_0x1839('0x7')](),controller[_0x1839('0xd')]);router['get'](_0x1839('0xe'),controller['migrations']);module[_0x1839('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b8c78d7..fea4045 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 _0xbe9a=['exec','../../mysqldb','../../config/pm2','update','simple-git','index','query','latest','fetch','tags','2.0.0','json','status','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','length','replace','.js','exports','push','sort','sequelize','Migration','getQueryInterface','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions'];(function(_0x496c54,_0x35888b){var _0x25a638=function(_0x12b93f){while(--_0x12b93f){_0x496c54['push'](_0x496c54['shift']());}};_0x25a638(++_0x35888b);}(_0xbe9a,0xf6));var _0xabe9=function(_0x3c135d,_0x2e81dd){_0x3c135d=_0x3c135d-0x0;var _0x359dc0=_0xbe9a[_0x3c135d];return _0x359dc0;};'use strict';var Umzug=require(_0xabe9('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xabe9('0x1'));var pkginfo=require('pkginfo')(module,_0xabe9('0x2'));var compareVersions=require(_0xabe9('0x3'));var exec=require('child_process')[_0xabe9('0x4')];var db=require(_0xabe9('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0xabe9('0x6'));var logger=require('../../config/logger')(_0xabe9('0x7'));var git=require(_0xabe9('0x8'))(config['root']);exports[_0xabe9('0x9')]=function(_0x5f1e6c,_0x114404){var _0x304ca3={'current':module['exports']['version'],'phonebar':0x2};if(_0x5f1e6c['query']&&_0x5f1e6c[_0xabe9('0xa')][_0xabe9('0xb')]){return git[_0xabe9('0xc')]()[_0xabe9('0xd')](function(_0x2d189d,_0x5ded3d){_0x304ca3[_0xabe9('0xb')]=(_0x2d189d?module['exports'][_0xabe9('0x2')]:_0x5ded3d[_0xabe9('0xb')])||_0xabe9('0xe');return _0x114404['status'](0xc8)[_0xabe9('0xf')](_0x304ca3);});}else{return _0x114404[_0xabe9('0x10')](0xc8)[_0xabe9('0xf')](_0x304ca3);}};exports[_0xabe9('0xc')]=function(_0x57d18e,_0x1ad069){return git[_0xabe9('0xc')](['origin','master'],function(_0x1c55a2){if(_0x1c55a2){logger[_0xabe9('0x11')](_0x1c55a2);return _0x1ad069[_0xabe9('0x10')](0x1f4)[_0xabe9('0xf')](_0x1c55a2);}logger[_0xabe9('0x12')](_0xabe9('0x13'));return _0x1ad069[_0xabe9('0x10')](0xc8)[_0xabe9('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xabe9('0x14')]=function(_0x5b268b,_0x51ff78){return git['reset']([_0xabe9('0x15'),_0xabe9('0x16')],function(_0x3bf3cc){if(_0x3bf3cc){logger[_0xabe9('0x11')](_0x3bf3cc);return _0x51ff78[_0xabe9('0x10')](0x1f4)[_0xabe9('0xf')](_0x3bf3cc);}logger[_0xabe9('0x12')](_0xabe9('0x17'));return _0x51ff78[_0xabe9('0x10')](0xc8)[_0xabe9('0xf')]({'output':_0xabe9('0x18')});});};exports['pull']=function(_0x320784,_0x52aad1){exec(_0xabe9('0x19'),function(_0x4d8072,_0x5e25a9,_0x4c497d){logger[_0xabe9('0x12')](_0x5e25a9);logger['info'](_0x4c497d);if(_0x4d8072){logger[_0xabe9('0x11')](_0x4d8072);return _0x52aad1[_0xabe9('0x10')](0x1f4)[_0xabe9('0xf')](_0x4d8072);}return _0x52aad1[_0xabe9('0x10')](0xc8)[_0xabe9('0xf')]({'output':_0x5e25a9});});};exports['restart']=function(_0x5d5f8e,_0x5462fb){return pm2[_0xabe9('0x1a')](_0xabe9('0x1b'))[_0xabe9('0x1c')](function(_0x3314e1){logger[_0xabe9('0x12')](_0xabe9('0x1d'),_0x3314e1);return _0x5462fb[_0xabe9('0x10')](0xc8)[_0xabe9('0xf')]({'output':_0xabe9('0x1e')});})[_0xabe9('0x1f')](function(_0x393226){logger[_0xabe9('0x11')](_0x393226);return _0x5462fb[_0xabe9('0x10')](0x1f4)[_0xabe9('0xf')](_0x393226);});};exports[_0xabe9('0x20')]=function(_0xa3be43,_0x1759ce){var _0x3186be=fs[_0xabe9('0x21')](path[_0xabe9('0x22')](config[_0xabe9('0x23')],'server',_0xabe9('0x20')));var _0x482032=[];for(var _0x531473=0x0;_0x531473<_0x3186be[_0xabe9('0x24')];_0x531473++){var _0x2adc9e=_0x3186be[_0x531473][_0xabe9('0x25')](_0xabe9('0x26'),'');if(compareVersions(module[_0xabe9('0x27')][_0xabe9('0x2')],_0x2adc9e)===-0x1){_0x482032[_0xabe9('0x28')](_0x2adc9e);}}if(_0x482032[_0xabe9('0x24')]){var _0x1c968a=_0x482032[_0xabe9('0x29')](compareVersions);var _0x39936c=new Umzug({'storage':_0xabe9('0x2a'),'storageOptions':{'model':db[_0xabe9('0x2b')],'modelName':'Migration','columnName':_0xabe9('0x2')},'migrations':{'params':[db[_0xabe9('0x2a')][_0xabe9('0x2c')](),db[_0xabe9('0x2a')]['constructor'],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[_0xabe9('0x22')](config[_0xabe9('0x23')],_0xabe9('0x2d'),_0xabe9('0x20')),'pattern':/\.js$/}});_0x39936c['up']({'migrations':_[_0xabe9('0x2e')](_0x1c968a,function(_0x261837){return _0x261837+_0xabe9('0x26');})})[_0xabe9('0x1c')](function(){return _0x1759ce[_0xabe9('0x10')](0xc8)[_0xabe9('0xf')]({'output':_0xabe9('0x2f')+module['exports']['version']+'\x20to\x20'+_['last'](_0x1c968a),'migrations':_['join'](_0x1c968a)});})[_0xabe9('0x1f')](function(_0x3e8d97){if(_0x3e8d97 instanceof db[_0xabe9('0x2a')][_0xabe9('0x30')]){return _0x1759ce['status'](0xc8)[_0xabe9('0xf')]({'output':_0xabe9('0x31')});}else{return _0x1759ce[_0xabe9('0x10')](0x1f4)[_0xabe9('0xf')](_0x3e8d97);}});}else{return _0x1759ce[_0xabe9('0x10')](0xc8)[_0xabe9('0xf')]({'output':_0xabe9('0x31')});}}; \ No newline at end of file +var _0xe45a=['root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','then','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0xe45a,0x19c));var _0xae45=function(_0x43d187,_0x5d7568){_0x43d187=_0x43d187-0x0;var _0x31db94=_0xe45a[_0x43d187];return _0x31db94;};'use strict';var Umzug=require(_0xae45('0x0'));var path=require(_0xae45('0x1'));var fs=require('fs');var _=require(_0xae45('0x2'));var pkginfo=require(_0xae45('0x3'))(module,_0xae45('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xae45('0x5'))[_0xae45('0x6')];var db=require(_0xae45('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xae45('0x8'));var logger=require(_0xae45('0x9'))(_0xae45('0xa'));var git=require(_0xae45('0xb'))(config[_0xae45('0xc')]);exports[_0xae45('0xd')]=function(_0x377e62,_0xc778b){var _0x225941={'current':module[_0xae45('0xe')]['version'],'phonebar':0x2};if(_0x377e62[_0xae45('0xf')]&&_0x377e62[_0xae45('0xf')]['latest']){return git[_0xae45('0x10')]()[_0xae45('0x11')](function(_0x358bf0,_0x3e1828){_0x225941[_0xae45('0x12')]=(_0x358bf0?module[_0xae45('0xe')][_0xae45('0x4')]:_0x3e1828[_0xae45('0x12')])||_0xae45('0x13');return _0xc778b[_0xae45('0x14')](0xc8)[_0xae45('0x15')](_0x225941);});}else{return _0xc778b[_0xae45('0x14')](0xc8)['json'](_0x225941);}};exports['fetch']=function(_0x38c190,_0x2c0c5a){return git['fetch']([_0xae45('0x16'),_0xae45('0x17')],function(_0x2e400d){if(_0x2e400d){logger[_0xae45('0x18')](_0x2e400d);return _0x2c0c5a[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x2e400d);}logger[_0xae45('0x19')](_0xae45('0x1a'));return _0x2c0c5a[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x1b')});});};exports[_0xae45('0x1c')]=function(_0x3b4f2b,_0x3c26c2){return git[_0xae45('0x1c')](['--hard',_0xae45('0x1d')],function(_0x383df5){if(_0x383df5){logger['error'](_0x383df5);return _0x3c26c2[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x383df5);}logger['info'](_0xae45('0x1e'));return _0x3c26c2[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0xae45('0x1f')]=function(_0x1c66f0,_0x37cde0){exec(_0xae45('0x20'),function(_0x23f4f8,_0x15b560,_0x1540fa){logger['info'](_0x15b560);logger[_0xae45('0x19')](_0x1540fa);if(_0x23f4f8){logger[_0xae45('0x18')](_0x23f4f8);return _0x37cde0[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x23f4f8);}return _0x37cde0[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':_0x15b560});});};exports[_0xae45('0x21')]=function(_0x41d951,_0x4e60f0){return pm2['restart']('motion2')['then'](function(_0x145be0){logger[_0xae45('0x19')]('pm2\x20restart\x20motion\x20%s',_0x145be0);return _0x4e60f0['status'](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x22')});})[_0xae45('0x23')](function(_0x242bbb){logger['error'](_0x242bbb);return _0x4e60f0[_0xae45('0x14')](0x1f4)[_0xae45('0x15')](_0x242bbb);});};exports['migrations']=function(_0x2bd985,_0x18a08f){var _0x26ffa0=fs[_0xae45('0x24')](path[_0xae45('0x25')](config[_0xae45('0xc')],_0xae45('0x26'),'migrations'));var _0x5b9ea2=[];for(var _0x2ce848=0x0;_0x2ce848<_0x26ffa0[_0xae45('0x27')];_0x2ce848++){var _0x3c7a5d=_0x26ffa0[_0x2ce848][_0xae45('0x28')](_0xae45('0x29'),'');if(compareVersions(module[_0xae45('0xe')]['version'],_0x3c7a5d)===-0x1){_0x5b9ea2[_0xae45('0x2a')](_0x3c7a5d);}}if(_0x5b9ea2[_0xae45('0x27')]){var _0x35de72=_0x5b9ea2['sort'](compareVersions);var _0x404cfc=new Umzug({'storage':_0xae45('0x2b'),'storageOptions':{'model':db[_0xae45('0x2c')],'modelName':_0xae45('0x2c'),'columnName':_0xae45('0x4')},'migrations':{'params':[db['sequelize'][_0xae45('0x2d')](),db[_0xae45('0x2b')]['constructor'],function(){throw new Error(_0xae45('0x2e'));}],'path':path[_0xae45('0x25')](config[_0xae45('0xc')],_0xae45('0x26'),_0xae45('0x2f')),'pattern':/\.js$/}});_0x404cfc['up']({'migrations':_['map'](_0x35de72,function(_0x56c9e9){return _0x56c9e9+_0xae45('0x29');})})[_0xae45('0x30')](function(){return _0x18a08f['status'](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x31')+module[_0xae45('0xe')][_0xae45('0x4')]+'\x20to\x20'+_[_0xae45('0x32')](_0x35de72),'migrations':_[_0xae45('0x25')](_0x35de72)});})[_0xae45('0x23')](function(_0x50e8d6){if(_0x50e8d6 instanceof db['sequelize'][_0xae45('0x33')]){return _0x18a08f[_0xae45('0x14')](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x34')});}else{return _0x18a08f['status'](0x1f4)[_0xae45('0x15')](_0x50e8d6);}});}else{return _0x18a08f['status'](0xc8)[_0xae45('0x15')]({'output':_0xae45('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9131b4e..b7b6a89 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 _0x6132=['destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete'];(function(_0x109e39,_0x27f91c){var _0x3b142f=function(_0xec4d82){while(--_0xec4d82){_0x109e39['push'](_0x109e39['shift']());}};_0x3b142f(++_0x27f91c);}(_0x6132,0x105));var _0x2613=function(_0x5c9ba8,_0x520603){_0x5c9ba8=_0x5c9ba8-0x0;var _0x84b33c=_0x6132[_0x5c9ba8];return _0x84b33c;};'use strict';var multer=require(_0x2613('0x0'));var util=require(_0x2613('0x1'));var path=require('path');var timeout=require(_0x2613('0x2'));var express=require(_0x2613('0x3'));var router=express[_0x2613('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2613('0x5'));var interaction=require(_0x2613('0x6'));var config=require(_0x2613('0x7'));var controller=require(_0x2613('0x8'));router[_0x2613('0x9')]('/',auth[_0x2613('0xa')](),controller[_0x2613('0xb')]);router[_0x2613('0x9')](_0x2613('0xc'),auth[_0x2613('0xa')](),controller[_0x2613('0xd')]);router[_0x2613('0x9')](_0x2613('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2613('0xf')]('/',auth[_0x2613('0xa')](),controller['create']);router[_0x2613('0x10')](_0x2613('0xe'),auth[_0x2613('0xa')](),controller[_0x2613('0x11')]);router[_0x2613('0x12')](_0x2613('0xe'),auth[_0x2613('0xa')](),controller[_0x2613('0x13')]);module['exports']=router; \ No newline at end of file +var _0x722d=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x722d,0x6f));var _0xd722=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x722d[_0x1c0f41];return _0x369a9f;};'use strict';var multer=require(_0xd722('0x0'));var util=require(_0xd722('0x1'));var path=require(_0xd722('0x2'));var timeout=require(_0xd722('0x3'));var express=require('express');var router=express[_0xd722('0x4')]();var fs_extra=require(_0xd722('0x5'));var auth=require(_0xd722('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd722('0x7'));router['get']('/',auth[_0xd722('0x8')](),controller['index']);router[_0xd722('0x9')](_0xd722('0xa'),auth[_0xd722('0x8')](),controller[_0xd722('0xb')]);router[_0xd722('0x9')](_0xd722('0xc'),auth[_0xd722('0x8')](),controller[_0xd722('0xd')]);router[_0xd722('0xe')]('/',auth['isAuthenticated'](),controller[_0xd722('0xf')]);router[_0xd722('0x10')](_0xd722('0xc'),auth[_0xd722('0x8')](),controller[_0xd722('0x11')]);router[_0xd722('0x12')](_0xd722('0xc'),auth[_0xd722('0x8')](),controller[_0xd722('0x13')]);module[_0xd722('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 28a0796..d31621a 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 _0xe493=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3d8539,_0x54e646){var _0x26a973=function(_0x129e79){while(--_0x129e79){_0x3d8539['push'](_0x3d8539['shift']());}};_0x26a973(++_0x54e646);}(_0xe493,0x7e));var _0x3e49=function(_0xef5f79,_0x478d76){_0xef5f79=_0xef5f79-0x0;var _0x46052f=_0xe493[_0xef5f79];return _0x46052f;};'use strict';var Sequelize=require(_0x3e49('0x0'));module[_0x3e49('0x1')]={'type':{'type':Sequelize[_0x3e49('0x2')]},'uniqueid':{'type':Sequelize[_0x3e49('0x2')]},'calleridnum':{'type':Sequelize[_0x3e49('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3e49('0x2')]},'interface':{'type':Sequelize[_0x3e49('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x3e49('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x3e49('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x3e49('0x3')]},'agentdumpAt':{'type':Sequelize[_0x3e49('0x3')]},'holdtime':{'type':Sequelize[_0x3e49('0x4')]},'agentcomplete':{'type':Sequelize[_0x3e49('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x3e49('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3e49('0x4')]},'reason':{'type':Sequelize[_0x3e49('0x2')]},'lastevent':{'type':Sequelize[_0x3e49('0x2')]},'channel':{'type':Sequelize[_0x3e49('0x2')]},'channelstate':{'type':Sequelize[_0x3e49('0x4')]},'channelstatedesc':{'type':Sequelize[_0x3e49('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3e49('0x2')]},'connectedlinename':{'type':Sequelize[_0x3e49('0x2')]},'language':{'type':Sequelize[_0x3e49('0x2')]},'accountcode':{'type':Sequelize[_0x3e49('0x2')]},'context':{'type':Sequelize[_0x3e49('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3e49('0x2')]},'destchannel':{'type':Sequelize[_0x3e49('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x3e49('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3e49('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e49('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3e49('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x3e49('0x2')]},'destcontext':{'type':Sequelize[_0x3e49('0x2')]},'destexten':{'type':Sequelize[_0x3e49('0x2')]},'destpriority':{'type':Sequelize[_0x3e49('0x2')]},'destuniqueid':{'type':Sequelize[_0x3e49('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x3e49('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x3e49('0x2')]},'transfer':{'type':Sequelize[_0x3e49('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3e49('0x2')],'comment':_0x3e49('0x6')},'transferexten':{'type':Sequelize[_0x3e49('0x2')]},'transferuniqueid':{'type':Sequelize[_0x3e49('0x2')]},'agententerreason':{'type':Sequelize[_0x3e49('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeef7=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x12b449,_0x2b8a36){var _0x4e3784=function(_0xf2848c){while(--_0xf2848c){_0x12b449['push'](_0x12b449['shift']());}};_0x4e3784(++_0x2b8a36);}(_0xeef7,0x7d));var _0x7eef=function(_0x237548,_0x3d2733){_0x237548=_0x237548-0x0;var _0x374cca=_0xeef7[_0x237548];return _0x374cca;};'use strict';var Sequelize=require(_0x7eef('0x0'));module[_0x7eef('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7eef('0x2')]},'calleridnum':{'type':Sequelize[_0x7eef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7eef('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7eef('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7eef('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7eef('0x4')]},'agentcomplete':{'type':Sequelize[_0x7eef('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7eef('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7eef('0x4')]},'agentacw':{'type':Sequelize[_0x7eef('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7eef('0x4')]},'reason':{'type':Sequelize[_0x7eef('0x2')]},'lastevent':{'type':Sequelize[_0x7eef('0x2')]},'channel':{'type':Sequelize[_0x7eef('0x2')]},'channelstate':{'type':Sequelize[_0x7eef('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7eef('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7eef('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7eef('0x2')]},'accountcode':{'type':Sequelize[_0x7eef('0x2')]},'context':{'type':Sequelize[_0x7eef('0x2')]},'exten':{'type':Sequelize[_0x7eef('0x2')]},'priority':{'type':Sequelize[_0x7eef('0x2')]},'destchannel':{'type':Sequelize[_0x7eef('0x2')]},'destchannelstate':{'type':Sequelize[_0x7eef('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7eef('0x2')]},'destcalleridname':{'type':Sequelize[_0x7eef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7eef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7eef('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7eef('0x2')]},'destexten':{'type':Sequelize[_0x7eef('0x2')]},'destpriority':{'type':Sequelize[_0x7eef('0x2')]},'destuniqueid':{'type':Sequelize[_0x7eef('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7eef('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7eef('0x2')]},'transfer':{'type':Sequelize[_0x7eef('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7eef('0x2')],'comment':_0x7eef('0x6')},'transferexten':{'type':Sequelize[_0x7eef('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7eef('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 9f8a07c..4d86811 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 48b6c83..294f055 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 _0xbd51=['VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','./voiceAgentReport.attributes','exports','define'];(function(_0x870f5d,_0x197522){var _0x2324c8=function(_0x250793){while(--_0x250793){_0x870f5d['push'](_0x870f5d['shift']());}};_0x2324c8(++_0x197522);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x306e65,_0x4642f1){_0x306e65=_0x306e65-0x0;var _0x545c14=_0xbd51[_0x306e65];return _0x545c14;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1bd5('0xa'),_0x1bd5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe132=['report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','VoiceAgentReport'];(function(_0x148d7b,_0x9b8a78){var _0x6d5ee8=function(_0x42e65e){while(--_0x42e65e){_0x148d7b['push'](_0x148d7b['shift']());}};_0x6d5ee8(++_0x9b8a78);}(_0xe132,0x162));var _0x2e13=function(_0x209cb1,_0x7a6eb5){_0x209cb1=_0x209cb1-0x0;var _0x42b3a6=_0xe132[_0x209cb1];return _0x42b3a6;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var logger=require(_0x2e13('0x1'))(_0x2e13('0x2'));var moment=require(_0x2e13('0x3'));var BPromise=require(_0x2e13('0x4'));var rp=require(_0x2e13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x260dc1,_0x2f9d00){return _0x260dc1[_0x2e13('0x8')](_0x2e13('0x9'),attributes,{'tableName':_0x2e13('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2e13('0xb'),_0x2e13('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 eec269b..40f3f45 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 _0x86ca=['VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','then','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x34a6e9,_0x25cabe){var _0x11015c=function(_0x5c2ced){while(--_0x5c2ced){_0x34a6e9['push'](_0x34a6e9['shift']());}};_0x11015c(++_0x25cabe);}(_0x86ca,0x10e));var _0xa86c=function(_0x1e070d,_0x2bec16){_0x1e070d=_0x1e070d-0x0;var _0x4e0534=_0x86ca[_0x1e070d];return _0x4e0534;};'use strict';var _=require(_0xa86c('0x0'));var util=require(_0xa86c('0x1'));var moment=require(_0xa86c('0x2'));var BPromise=require(_0xa86c('0x3'));var rs=require(_0xa86c('0x4'));var fs=require('fs');var Redis=require(_0xa86c('0x5'));var db=require(_0xa86c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa86c('0x7'))('rpc');var config=require(_0xa86c('0x8'));var jayson=require(_0xa86c('0x9'));var client=jayson[_0xa86c('0xa')][_0xa86c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4674e5,_0x1dda2a,_0x276e23){return new BPromise(function(_0x419f51,_0xbd9d5d){return client['request'](_0x4674e5,_0x276e23)['then'](function(_0x390d34){logger[_0xa86c('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x1dda2a,'request\x20sent');logger[_0xa86c('0xd')](_0xa86c('0xe'),_0x1dda2a,_0xa86c('0xf'),JSON[_0xa86c('0x10')](_0x390d34));if(_0x390d34[_0xa86c('0x11')]){if(_0x390d34[_0xa86c('0x11')]['code']===0x1f4){logger[_0xa86c('0x11')](_0xa86c('0x12'),_0x1dda2a,_0x390d34[_0xa86c('0x11')]['message']);return _0xbd9d5d(_0x390d34[_0xa86c('0x11')][_0xa86c('0x13')]);}logger[_0xa86c('0x11')](_0xa86c('0x12'),_0x1dda2a,_0x390d34[_0xa86c('0x11')][_0xa86c('0x13')]);return _0x419f51(_0x390d34[_0xa86c('0x11')]['message']);}else{logger[_0xa86c('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x1dda2a,_0xa86c('0xf'));_0x419f51(_0x390d34[_0xa86c('0x14')][_0xa86c('0x13')]);}})[_0xa86c('0x15')](function(_0x47adac){logger[_0xa86c('0x11')](_0xa86c('0x12'),_0x1dda2a,_0x47adac);_0xbd9d5d(_0x47adac);});});}exports[_0xa86c('0x16')]=function(_0x11f627){var _0x2850af=this;return new Promise(function(_0x18649a,_0x29f190){return db[_0xa86c('0x17')][_0xa86c('0x18')](_0x11f627[_0xa86c('0x19')],{'raw':_0x11f627['options']?_0x11f627[_0xa86c('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa86c('0x1b')](function(_0xa3622a){logger['info'](_0xa86c('0x16'),_0x11f627);logger['debug'](_0xa86c('0x16'),_0x11f627,JSON[_0xa86c('0x10')](_0xa3622a));_0x18649a(_0xa3622a);})[_0xa86c('0x15')](function(_0x5852e6){logger[_0xa86c('0x11')](_0xa86c('0x16'),_0x5852e6['message'],_0x11f627);_0x29f190(_0x2850af['error'](0x1f4,_0x5852e6['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x13630a){var _0x2dca0e=this;return new Promise(function(_0x4102ef,_0x27f5b4){return db['VoiceAgentReport']['update'](_0x13630a[_0xa86c('0x19')],{'raw':_0x13630a[_0xa86c('0x1a')]?_0x13630a[_0xa86c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13630a['options']?_0x13630a[_0xa86c('0x1a')][_0xa86c('0x1c')]||null:null,'attributes':_0x13630a[_0xa86c('0x1a')]?_0x13630a[_0xa86c('0x1a')][_0xa86c('0x1d')]||null:null,'limit':_0x13630a['options']?_0x13630a[_0xa86c('0x1a')][_0xa86c('0x1e')]||null:null})['then'](function(_0x314d24){logger[_0xa86c('0xc')](_0xa86c('0x1f'),_0x13630a);logger['debug'](_0xa86c('0x1f'),_0x13630a,JSON[_0xa86c('0x10')](_0x314d24));_0x4102ef(_0x314d24);})[_0xa86c('0x15')](function(_0x155413){logger[_0xa86c('0x11')](_0xa86c('0x1f'),_0x155413[_0xa86c('0x13')],_0x13630a);_0x27f5b4(_0x2dca0e[_0xa86c('0x11')](0x1f4,_0x155413[_0xa86c('0x13')]));});});}; \ No newline at end of file +var _0x8ef6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','UpdateVoiceAgentReport','update','raw','where','attributes','limit'];(function(_0xaad393,_0x4f7b67){var _0xe4c710=function(_0x3b258a){while(--_0x3b258a){_0xaad393['push'](_0xaad393['shift']());}};_0xe4c710(++_0x4f7b67);}(_0x8ef6,0x176));var _0x68ef=function(_0x5547fd,_0x4b91fe){_0x5547fd=_0x5547fd-0x0;var _0x2b2343=_0x8ef6[_0x5547fd];return _0x2b2343;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x6'))(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var jayson=require(_0x68ef('0x9'));var client=jayson[_0x68ef('0xa')][_0x68ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35320a,_0x416f28,_0x32bbbf){return new BPromise(function(_0x47d1b0,_0x152c66){return client[_0x68ef('0xc')](_0x35320a,_0x32bbbf)[_0x68ef('0xd')](function(_0x4217d4){logger[_0x68ef('0xe')](_0x68ef('0xf'),_0x416f28,_0x68ef('0x10'));logger[_0x68ef('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x416f28,_0x68ef('0x10'),JSON[_0x68ef('0x12')](_0x4217d4));if(_0x4217d4[_0x68ef('0x13')]){if(_0x4217d4[_0x68ef('0x13')][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xf'),_0x416f28,_0x4217d4[_0x68ef('0x13')]['message']);return _0x152c66(_0x4217d4[_0x68ef('0x13')][_0x68ef('0x15')]);}logger[_0x68ef('0x13')](_0x68ef('0xf'),_0x416f28,_0x4217d4[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x47d1b0(_0x4217d4['error'][_0x68ef('0x15')]);}else{logger[_0x68ef('0xe')](_0x68ef('0xf'),_0x416f28,_0x68ef('0x10'));_0x47d1b0(_0x4217d4[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x37a039){logger[_0x68ef('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x416f28,_0x37a039);_0x152c66(_0x37a039);});});}exports[_0x68ef('0x18')]=function(_0x388dd1){var _0x3ea703=this;return new Promise(function(_0x214fc9,_0x34e670){return db[_0x68ef('0x19')]['create'](_0x388dd1[_0x68ef('0x1a')],{'raw':_0x388dd1['options']?_0x388dd1[_0x68ef('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x68ef('0xd')](function(_0x47d1f1){logger[_0x68ef('0xe')](_0x68ef('0x18'),_0x388dd1);logger[_0x68ef('0x11')](_0x68ef('0x18'),_0x388dd1,JSON[_0x68ef('0x12')](_0x47d1f1));_0x214fc9(_0x47d1f1);})[_0x68ef('0x17')](function(_0x1df9c6){logger[_0x68ef('0x13')](_0x68ef('0x18'),_0x1df9c6[_0x68ef('0x15')],_0x388dd1);_0x34e670(_0x3ea703[_0x68ef('0x13')](0x1f4,_0x1df9c6[_0x68ef('0x15')]));});});};exports[_0x68ef('0x1c')]=function(_0x21eaaf){var _0x31f4c4=this;return new Promise(function(_0x931a65,_0x4a7053){return db[_0x68ef('0x19')][_0x68ef('0x1d')](_0x21eaaf[_0x68ef('0x1a')],{'raw':_0x21eaaf[_0x68ef('0x1b')]?_0x21eaaf[_0x68ef('0x1b')][_0x68ef('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21eaaf[_0x68ef('0x1b')]?_0x21eaaf['options'][_0x68ef('0x1f')]||null:null,'attributes':_0x21eaaf[_0x68ef('0x1b')]?_0x21eaaf['options'][_0x68ef('0x20')]||null:null,'limit':_0x21eaaf[_0x68ef('0x1b')]?_0x21eaaf['options'][_0x68ef('0x21')]||null:null})[_0x68ef('0xd')](function(_0x1f6ff7){logger['info'](_0x68ef('0x1c'),_0x21eaaf);logger[_0x68ef('0x11')](_0x68ef('0x1c'),_0x21eaaf,JSON[_0x68ef('0x12')](_0x1f6ff7));_0x931a65(_0x1f6ff7);})[_0x68ef('0x17')](function(_0x20ccf9){logger[_0x68ef('0x13')](_0x68ef('0x1c'),_0x20ccf9['message'],_0x21eaaf);_0x4a7053(_0x31f4c4[_0x68ef('0x13')](0x1f4,_0x20ccf9[_0x68ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5646b0a..5d99c74 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 _0x81bd=['../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a5755,_0x17f587){var _0x1700da=function(_0x40c908){while(--_0x40c908){_0x2a5755['push'](_0x2a5755['shift']());}};_0x1700da(++_0x17f587);}(_0x81bd,0x7c));var _0xd81b=function(_0x56b3a3,_0x77b2d){_0x56b3a3=_0x56b3a3-0x0;var _0x5315cf=_0x81bd[_0x56b3a3];return _0x5315cf;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xd81b('0xd')]);router['get'](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x13')]);router[_0xd81b('0x14')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller['destroy']);module[_0xd81b('0x15')]=router; \ No newline at end of file +var _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe'];(function(_0x33da5c,_0x49a734){var _0xeca54=function(_0x25af94){while(--_0x25af94){_0x33da5c['push'](_0x33da5c['shift']());}};_0xeca54(++_0x49a734);}(_0xa630,0xbe));var _0x0a63=function(_0x417209,_0x5bbb99){_0x417209=_0x417209-0x0;var _0x2846c7=_0xa630[_0x417209];return _0x2846c7;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ea2ee9b..1ad1ca9 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 _0x6e7d=['sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x56be45,_0x10cd0e){var _0x1b75d3=function(_0x314616){while(--_0x314616){_0x56be45['push'](_0x56be45['shift']());}};_0x1b75d3(++_0x10cd0e);}(_0x6e7d,0x1a0));var _0xd6e7=function(_0xb53a7f,_0x3e7e76){_0xb53a7f=_0xb53a7f-0x0;var _0xdb22f3=_0x6e7d[_0xb53a7f];return _0xdb22f3;};'use strict';var Sequelize=require(_0xd6e7('0x0'));module[_0xd6e7('0x1')]={'uniqueid':{'type':Sequelize[_0xd6e7('0x2')]},'type':{'type':Sequelize[_0xd6e7('0x3')](_0xd6e7('0x4'),_0xd6e7('0x5'),_0xd6e7('0x6'),_0xd6e7('0x7'),_0xd6e7('0x8'),_0xd6e7('0x9'))},'tag':{'type':Sequelize[_0xd6e7('0x2')]},'accountcode':{'type':Sequelize[_0xd6e7('0x2')]},'source':{'type':Sequelize[_0xd6e7('0x2')]},'destination':{'type':Sequelize[_0xd6e7('0x2')]},'destinationcontext':{'type':Sequelize[_0xd6e7('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd6e7('0x2')]},'destinationchannel':{'type':Sequelize[_0xd6e7('0x2')]},'lastapplication':{'type':Sequelize[_0xd6e7('0x2')]},'lastdata':{'type':Sequelize[_0xd6e7('0xa')]},'starttime':{'type':Sequelize[_0xd6e7('0xb')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd6e7('0xb')]},'endtime':{'type':Sequelize[_0xd6e7('0xb')]},'duration':{'type':Sequelize[_0xd6e7('0xc')]},'billableseconds':{'type':Sequelize[_0xd6e7('0xc')]},'mohtime':{'type':Sequelize[_0xd6e7('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd6e7('0x2')]},'amaflags':{'type':Sequelize[_0xd6e7('0x2')]},'userfield':{'type':Sequelize[_0xd6e7('0x2')]},'userDisposition':{'type':Sequelize[_0xd6e7('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xd6e7('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xd6e7('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xd6e7('0x2')]},'routeid':{'type':Sequelize[_0xd6e7('0xc')]},'sipcallid':{'type':Sequelize[_0xd6e7('0x2')]}}; \ No newline at end of file +var _0x761c=['dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','internal','outbound','inbound-fax'];(function(_0x56c3e4,_0x3120b1){var _0xd3d09f=function(_0x37ad54){while(--_0x37ad54){_0x56c3e4['push'](_0x56c3e4['shift']());}};_0xd3d09f(++_0x3120b1);}(_0x761c,0x18a));var _0xc761=function(_0xd3b25e,_0x481aad){_0xd3b25e=_0xd3b25e-0x0;var _0x262923=_0x761c[_0xd3b25e];return _0x262923;};'use strict';var Sequelize=require(_0xc761('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc761('0x1')]},'type':{'type':Sequelize[_0xc761('0x2')]('inbound',_0xc761('0x3'),_0xc761('0x4'),_0xc761('0x5'),'outbound-fax',_0xc761('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc761('0x1')]},'source':{'type':Sequelize[_0xc761('0x1')]},'destination':{'type':Sequelize[_0xc761('0x1')]},'destinationcontext':{'type':Sequelize[_0xc761('0x1')]},'callerid':{'type':Sequelize[_0xc761('0x1')]},'channel':{'type':Sequelize[_0xc761('0x1')]},'destinationchannel':{'type':Sequelize[_0xc761('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc761('0x7')]},'starttime':{'type':Sequelize[_0xc761('0x8')]},'systemanswertime':{'type':Sequelize[_0xc761('0x8')]},'answertime':{'type':Sequelize[_0xc761('0x8')]},'endtime':{'type':Sequelize[_0xc761('0x8')]},'duration':{'type':Sequelize[_0xc761('0x9')]},'billableseconds':{'type':Sequelize[_0xc761('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc761('0x1')]},'userfield':{'type':Sequelize[_0xc761('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc761('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc761('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xc761('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 553252f..28ce12e 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x2f5bb0,_0x458bb0){var _0x9cd649=function(_0x5b5e0d){while(--_0x5b5e0d){_0x2f5bb0['push'](_0x2f5bb0['shift']());}};_0x9cd649(++_0x458bb0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0x0b0e[_0x2ac71a];return _0x3ee904;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,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(_0x161f55,_0xc638a1){var _0x4ca025=function(_0x218283){while(--_0x218283){_0x161f55['push'](_0x161f55['shift']());}};_0x4ca025(++_0xc638a1);}(_0xdb28,0x106));var _0x8db2=function(_0x17adaa,_0x116857){_0x17adaa=_0x17adaa-0x0;var _0x1837c0=_0xdb28[_0x17adaa];return _0x1837c0;};'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 aec9339..2f85d59 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 _0xa157=['api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa157,0xf5));var _0x7a15=function(_0x429106,_0x49b168){_0x429106=_0x429106-0x0;var _0x1468e5=_0xa157[_0x429106];return _0x1468e5;};'use strict';var _=require(_0x7a15('0x0'));var util=require(_0x7a15('0x1'));var logger=require('../../config/logger')(_0x7a15('0x2'));var moment=require('moment');var BPromise=require(_0x7a15('0x3'));var rp=require(_0x7a15('0x4'));var fs=require('fs');var path=require(_0x7a15('0x5'));var rimraf=require(_0x7a15('0x6'));var config=require(_0x7a15('0x7'));var attributes=require(_0x7a15('0x8'));module[_0x7a15('0x9')]=function(_0x3b87be,_0xabbc28){return _0x3b87be[_0x7a15('0xa')](_0x7a15('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x7a15('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48c3=['moment','bluebird','request-promise','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','../../config/logger'];(function(_0x227901,_0x1d8fca){var _0x5a55e4=function(_0x528862){while(--_0x528862){_0x227901['push'](_0x227901['shift']());}};_0x5a55e4(++_0x1d8fca);}(_0x48c3,0x16a));var _0x348c=function(_0x1522e3,_0x346e1d){_0x1522e3=_0x1522e3-0x0;var _0x12c66e=_0x48c3[_0x1522e3];return _0x12c66e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x348c('0x0'))('api');var moment=require(_0x348c('0x1'));var BPromise=require(_0x348c('0x2'));var rp=require(_0x348c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x348c('0x4'));var attributes=require(_0x348c('0x5'));module[_0x348c('0x6')]=function(_0xb73007,_0xca8ae8){return _0xb73007[_0x348c('0x7')](_0x348c('0x8'),attributes,{'tableName':_0x348c('0x9'),'paranoid':![],'indexes':[{'fields':[_0x348c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c46079c..e759e66 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 _0x9851=['model','attributes','GetVoiceCallReport','CreateVoiceCallReport','create','body','stringify','UpdateVoiceCallReport','update','where','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceCallReport','findAll','options','raw','limit','include','map'];(function(_0x4f977b,_0x48cc0f){var _0x298926=function(_0x2b1f70){while(--_0x2b1f70){_0x4f977b['push'](_0x4f977b['shift']());}};_0x298926(++_0x48cc0f);}(_0x9851,0x169));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1985('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1985('0x1'));var fs=require('fs');var Redis=require(_0x1985('0x2'));var db=require(_0x1985('0x3'))['db'];var utils=require(_0x1985('0x4'));var logger=require(_0x1985('0x5'))(_0x1985('0x6'));var config=require(_0x1985('0x7'));var jayson=require(_0x1985('0x8'));var client=jayson[_0x1985('0x9')][_0x1985('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ff56,_0x24c24d,_0x431745){return new BPromise(function(_0x3a7e94,_0x149f2b){return client[_0x1985('0xb')](_0x57ff56,_0x431745)[_0x1985('0xc')](function(_0xdee359){logger[_0x1985('0xd')](_0x1985('0xe'),_0x24c24d,_0x1985('0xf'));logger[_0x1985('0x10')](_0x1985('0x11'),_0x24c24d,'request\x20sent',JSON['stringify'](_0xdee359));if(_0xdee359[_0x1985('0x12')]){if(_0xdee359['error']['code']===0x1f4){logger[_0x1985('0x12')](_0x1985('0xe'),_0x24c24d,_0xdee359[_0x1985('0x12')][_0x1985('0x13')]);return _0x149f2b(_0xdee359[_0x1985('0x12')][_0x1985('0x13')]);}logger[_0x1985('0x12')](_0x1985('0xe'),_0x24c24d,_0xdee359[_0x1985('0x12')][_0x1985('0x13')]);return _0x3a7e94(_0xdee359[_0x1985('0x12')]['message']);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x24c24d,'request\x20sent');_0x3a7e94(_0xdee359[_0x1985('0x14')][_0x1985('0x13')]);}})[_0x1985('0x15')](function(_0x1a5dde){logger[_0x1985('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x24c24d,_0x1a5dde);_0x149f2b(_0x1a5dde);});});}exports['GetVoiceCallReport']=function(_0x19bbaf){var _0x550b81=this;return new Promise(function(_0x1d063b,_0x53677a){return db[_0x1985('0x16')][_0x1985('0x17')]({'raw':_0x19bbaf[_0x1985('0x18')]?_0x19bbaf[_0x1985('0x18')][_0x1985('0x19')]===undefined?!![]:![]:!![],'where':_0x19bbaf['options']?_0x19bbaf[_0x1985('0x18')]['where']||null:null,'attributes':_0x19bbaf[_0x1985('0x18')]?_0x19bbaf['options']['attributes']||null:null,'limit':_0x19bbaf['options']?_0x19bbaf[_0x1985('0x18')][_0x1985('0x1a')]||null:null,'include':_0x19bbaf[_0x1985('0x18')]?_0x19bbaf['options'][_0x1985('0x1b')]?_[_0x1985('0x1c')](_0x19bbaf[_0x1985('0x18')]['include'],function(_0x4c7f50){return{'model':db[_0x4c7f50[_0x1985('0x1d')]],'as':_0x4c7f50['as'],'attributes':_0x4c7f50[_0x1985('0x1e')],'include':_0x4c7f50[_0x1985('0x1b')]?_[_0x1985('0x1c')](_0x4c7f50[_0x1985('0x1b')],function(_0x19c2a2){return{'model':db[_0x19c2a2[_0x1985('0x1d')]],'as':_0x19c2a2['as'],'attributes':_0x19c2a2[_0x1985('0x1e')],'include':_0x19c2a2[_0x1985('0x1b')]?_[_0x1985('0x1c')](_0x19c2a2['include'],function(_0x3a3e87){return{'model':db[_0x3a3e87['model']],'as':_0x3a3e87['as'],'attributes':_0x3a3e87[_0x1985('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1985('0xc')](function(_0xe69b27){logger[_0x1985('0xd')](_0x1985('0x1f'),_0x19bbaf);logger[_0x1985('0x10')](_0x1985('0x1f'),_0x19bbaf,JSON['stringify'](_0xe69b27));_0x1d063b(_0xe69b27);})[_0x1985('0x15')](function(_0x5ab605){logger['error'](_0x1985('0x1f'),_0x5ab605['message'],_0x19bbaf);_0x53677a(_0x550b81['error'](0x1f4,_0x5ab605[_0x1985('0x13')]));});});};exports[_0x1985('0x20')]=function(_0x3259a3){var _0x1fddcb=this;return new Promise(function(_0xe6988,_0x49f6c6){return db[_0x1985('0x16')][_0x1985('0x21')](_0x3259a3[_0x1985('0x22')],{'raw':_0x3259a3[_0x1985('0x18')]?_0x3259a3[_0x1985('0x18')][_0x1985('0x19')]===undefined?!![]:![]:!![]})[_0x1985('0xc')](function(_0x163212){logger[_0x1985('0xd')](_0x1985('0x20'),_0x3259a3);logger[_0x1985('0x10')](_0x1985('0x20'),_0x3259a3,JSON[_0x1985('0x23')](_0x163212));_0xe6988(_0x163212);})['catch'](function(_0x4fc031){logger[_0x1985('0x12')](_0x1985('0x20'),_0x4fc031[_0x1985('0x13')],_0x3259a3);_0x49f6c6(_0x1fddcb['error'](0x1f4,_0x4fc031[_0x1985('0x13')]));});});};exports[_0x1985('0x24')]=function(_0x1ec151){var _0x119fd1=this;return new Promise(function(_0x3fbe6d,_0x3fa097){return db[_0x1985('0x16')][_0x1985('0x25')](_0x1ec151[_0x1985('0x22')],{'raw':_0x1ec151[_0x1985('0x18')]?_0x1ec151[_0x1985('0x18')][_0x1985('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec151[_0x1985('0x18')]?_0x1ec151[_0x1985('0x18')][_0x1985('0x26')]||null:null,'attributes':_0x1ec151[_0x1985('0x18')]?_0x1ec151[_0x1985('0x18')]['attributes']||null:null,'limit':_0x1ec151[_0x1985('0x18')]?_0x1ec151[_0x1985('0x18')][_0x1985('0x1a')]||null:null})['then'](function(_0x3e3066){logger[_0x1985('0xd')]('UpdateVoiceCallReport',_0x1ec151);logger[_0x1985('0x10')](_0x1985('0x24'),_0x1ec151,JSON[_0x1985('0x23')](_0x3e3066));_0x3fbe6d(_0x3e3066);})[_0x1985('0x15')](function(_0x313df4){logger[_0x1985('0x12')](_0x1985('0x24'),_0x313df4[_0x1985('0x13')],_0x1ec151);_0x3fa097(_0x119fd1[_0x1985('0x12')](0x1f4,_0x313df4[_0x1985('0x13')]));});});}; \ No newline at end of file +var _0xaf59=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','include','model','then','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug'];(function(_0x14f542,_0x500d61){var _0x4fa208=function(_0x1446c5){while(--_0x1446c5){_0x14f542['push'](_0x14f542['shift']());}};_0x4fa208(++_0x500d61);}(_0xaf59,0xdc));var _0x9af5=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xaf59[_0x207811];return _0x170d56;};'use strict';var _=require(_0x9af5('0x0'));var util=require(_0x9af5('0x1'));var moment=require(_0x9af5('0x2'));var BPromise=require(_0x9af5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9af5('0x4'));var db=require(_0x9af5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9af5('0x6'))(_0x9af5('0x7'));var config=require(_0x9af5('0x8'));var jayson=require(_0x9af5('0x9'));var client=jayson[_0x9af5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x153422,_0x103954,_0x244511){return new BPromise(function(_0x2851b8,_0x3597ee){return client[_0x9af5('0xb')](_0x153422,_0x244511)['then'](function(_0x1ea251){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x103954,_0x9af5('0xc'));logger[_0x9af5('0xd')](_0x9af5('0xe'),_0x103954,_0x9af5('0xc'),JSON[_0x9af5('0xf')](_0x1ea251));if(_0x1ea251['error']){if(_0x1ea251[_0x9af5('0x10')][_0x9af5('0x11')]===0x1f4){logger[_0x9af5('0x10')](_0x9af5('0x12'),_0x103954,_0x1ea251['error']['message']);return _0x3597ee(_0x1ea251[_0x9af5('0x10')]['message']);}logger[_0x9af5('0x10')](_0x9af5('0x12'),_0x103954,_0x1ea251[_0x9af5('0x10')][_0x9af5('0x13')]);return _0x2851b8(_0x1ea251[_0x9af5('0x10')]['message']);}else{logger[_0x9af5('0x14')](_0x9af5('0x12'),_0x103954,_0x9af5('0xc'));_0x2851b8(_0x1ea251[_0x9af5('0x15')]['message']);}})[_0x9af5('0x16')](function(_0x2f82ff){logger[_0x9af5('0x10')](_0x9af5('0x12'),_0x103954,_0x2f82ff);_0x3597ee(_0x2f82ff);});});}exports[_0x9af5('0x17')]=function(_0x4e4951){var _0x17b4b1=this;return new Promise(function(_0x296fe8,_0xdc0705){return db[_0x9af5('0x18')]['findAll']({'raw':_0x4e4951[_0x9af5('0x19')]?_0x4e4951[_0x9af5('0x19')][_0x9af5('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e4951[_0x9af5('0x19')]?_0x4e4951[_0x9af5('0x19')][_0x9af5('0x1b')]||null:null,'attributes':_0x4e4951[_0x9af5('0x19')]?_0x4e4951[_0x9af5('0x19')][_0x9af5('0x1c')]||null:null,'limit':_0x4e4951['options']?_0x4e4951[_0x9af5('0x19')][_0x9af5('0x1d')]||null:null,'include':_0x4e4951[_0x9af5('0x19')]?_0x4e4951[_0x9af5('0x19')]['include']?_[_0x9af5('0x1e')](_0x4e4951[_0x9af5('0x19')][_0x9af5('0x1f')],function(_0x1292ee){return{'model':db[_0x1292ee[_0x9af5('0x20')]],'as':_0x1292ee['as'],'attributes':_0x1292ee[_0x9af5('0x1c')],'include':_0x1292ee[_0x9af5('0x1f')]?_['map'](_0x1292ee[_0x9af5('0x1f')],function(_0x8f2064){return{'model':db[_0x8f2064[_0x9af5('0x20')]],'as':_0x8f2064['as'],'attributes':_0x8f2064[_0x9af5('0x1c')],'include':_0x8f2064[_0x9af5('0x1f')]?_[_0x9af5('0x1e')](_0x8f2064[_0x9af5('0x1f')],function(_0xe1fbea){return{'model':db[_0xe1fbea[_0x9af5('0x20')]],'as':_0xe1fbea['as'],'attributes':_0xe1fbea[_0x9af5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9af5('0x21')](function(_0x35b5f6){logger[_0x9af5('0x14')](_0x9af5('0x17'),_0x4e4951);logger[_0x9af5('0xd')](_0x9af5('0x17'),_0x4e4951,JSON[_0x9af5('0xf')](_0x35b5f6));_0x296fe8(_0x35b5f6);})[_0x9af5('0x16')](function(_0x36a66c){logger[_0x9af5('0x10')](_0x9af5('0x17'),_0x36a66c[_0x9af5('0x13')],_0x4e4951);_0xdc0705(_0x17b4b1[_0x9af5('0x10')](0x1f4,_0x36a66c['message']));});});};exports[_0x9af5('0x22')]=function(_0x4f2606){var _0x5c00fa=this;return new Promise(function(_0x3b382,_0x4364b0){return db[_0x9af5('0x18')][_0x9af5('0x23')](_0x4f2606[_0x9af5('0x24')],{'raw':_0x4f2606['options']?_0x4f2606[_0x9af5('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x7da040){logger[_0x9af5('0x14')](_0x9af5('0x22'),_0x4f2606);logger[_0x9af5('0xd')](_0x9af5('0x22'),_0x4f2606,JSON[_0x9af5('0xf')](_0x7da040));_0x3b382(_0x7da040);})[_0x9af5('0x16')](function(_0x5e4712){logger['error']('CreateVoiceCallReport',_0x5e4712[_0x9af5('0x13')],_0x4f2606);_0x4364b0(_0x5c00fa[_0x9af5('0x10')](0x1f4,_0x5e4712['message']));});});};exports[_0x9af5('0x25')]=function(_0x1a02c9){var _0x229d5f=this;return new Promise(function(_0x35406c,_0x5f4b64){return db[_0x9af5('0x18')][_0x9af5('0x26')](_0x1a02c9[_0x9af5('0x24')],{'raw':_0x1a02c9[_0x9af5('0x19')]?_0x1a02c9['options'][_0x9af5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a02c9[_0x9af5('0x19')]?_0x1a02c9[_0x9af5('0x19')]['where']||null:null,'attributes':_0x1a02c9[_0x9af5('0x19')]?_0x1a02c9[_0x9af5('0x19')][_0x9af5('0x1c')]||null:null,'limit':_0x1a02c9['options']?_0x1a02c9[_0x9af5('0x19')]['limit']||null:null})[_0x9af5('0x21')](function(_0x125c29){logger[_0x9af5('0x14')](_0x9af5('0x25'),_0x1a02c9);logger[_0x9af5('0xd')](_0x9af5('0x25'),_0x1a02c9,JSON[_0x9af5('0xf')](_0x125c29));_0x35406c(_0x125c29);})['catch'](function(_0x19c9bd){logger[_0x9af5('0x10')]('UpdateVoiceCallReport',_0x19c9bd['message'],_0x1a02c9);_0x5f4b64(_0x229d5f[_0x9af5('0x10')](0x1f4,_0x19c9bd[_0x9af5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5000677..34d52c8 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 _0x9920=['/:id','show','post','create','put','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x9920,0xa0));var _0x0992=function(_0x55cff6,_0x573095){_0x55cff6=_0x55cff6-0x0;var _0x5e712d=_0x9920[_0x55cff6];return _0x5e712d;};'use strict';var multer=require(_0x0992('0x0'));var util=require(_0x0992('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0992('0x2'));var router=express[_0x0992('0x3')]();var fs_extra=require(_0x0992('0x4'));var auth=require(_0x0992('0x5'));var interaction=require(_0x0992('0x6'));var config=require(_0x0992('0x7'));var controller=require('./voiceChanSpy.controller');router[_0x0992('0x8')]('/',auth[_0x0992('0x9')](),controller['index']);router['get'](_0x0992('0xa'),auth['isAuthenticated'](),controller[_0x0992('0xb')]);router[_0x0992('0xc')]('/',auth['isAuthenticated'](),controller[_0x0992('0xd')]);router[_0x0992('0xe')](_0x0992('0xa'),auth[_0x0992('0x9')](),controller['update']);router[_0x0992('0xf')]('/:id',auth[_0x0992('0x9')](),controller[_0x0992('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3c99=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','/:id','show'];(function(_0x296e1f,_0x23d147){var _0x431db2=function(_0x57b3b1){while(--_0x57b3b1){_0x296e1f['push'](_0x296e1f['shift']());}};_0x431db2(++_0x23d147);}(_0x3c99,0x15c));var _0x93c9=function(_0x37f364,_0x3d4f9c){_0x37f364=_0x37f364-0x0;var _0x163e96=_0x3c99[_0x37f364];return _0x163e96;};'use strict';var multer=require(_0x93c9('0x0'));var util=require(_0x93c9('0x1'));var path=require(_0x93c9('0x2'));var timeout=require(_0x93c9('0x3'));var express=require('express');var router=express[_0x93c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x93c9('0x5'));var interaction=require(_0x93c9('0x6'));var config=require('../../config/environment');var controller=require(_0x93c9('0x7'));router[_0x93c9('0x8')]('/',auth[_0x93c9('0x9')](),controller['index']);router['get'](_0x93c9('0xa'),auth[_0x93c9('0x9')](),controller[_0x93c9('0xb')]);router[_0x93c9('0xc')]('/',auth[_0x93c9('0x9')](),controller[_0x93c9('0xd')]);router[_0x93c9('0xe')](_0x93c9('0xa'),auth[_0x93c9('0x9')](),controller['update']);router[_0x93c9('0xf')]('/:id',auth[_0x93c9('0x9')](),controller[_0x93c9('0x10')]);module[_0x93c9('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 0a0051a..da43d48 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 _0x73b2=['getDataValue','split','BOOLEAN','exports','STRING','name','options','join'];(function(_0x3e41c4,_0x2b7c74){var _0x489f9f=function(_0x994973){while(--_0x994973){_0x3e41c4['push'](_0x3e41c4['shift']());}};_0x489f9f(++_0x2b7c74);}(_0x73b2,0xf3));var _0x273b=function(_0x2cc225,_0x1bf68d){_0x2cc225=_0x2cc225-0x0;var _0x5292db=_0x73b2[_0x2cc225];return _0x5292db;};'use strict';var Sequelize=require('sequelize');module[_0x273b('0x0')]={'name':{'type':Sequelize[_0x273b('0x1')]},'prefix':{'type':Sequelize[_0x273b('0x1')],'unique':_0x273b('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x273b('0x1')],'set':function(_0xc3e2d6){this['setDataValue'](_0x273b('0x3'),_0xc3e2d6?_0xc3e2d6[_0x273b('0x4')](''):[]);},'get':function(){return this[_0x273b('0x5')](_0x273b('0x3'))?this[_0x273b('0x5')](_0x273b('0x3'))[_0x273b('0x6')](''):[];}},'auth':{'type':Sequelize[_0x273b('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x273b('0x1')]},'record':{'type':Sequelize[_0x273b('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x273b('0x1')]}}; \ No newline at end of file +var _0xf841=['name','setDataValue','options','split','sequelize','exports','STRING'];(function(_0x42f7ba,_0x24dbce){var _0x56e138=function(_0x483767){while(--_0x483767){_0x42f7ba['push'](_0x42f7ba['shift']());}};_0x56e138(++_0x24dbce);}(_0xf841,0x177));var _0x1f84=function(_0x4c5076,_0x52c9fc){_0x4c5076=_0x4c5076-0x0;var _0x58ac33=_0xf841[_0x4c5076];return _0x58ac33;};'use strict';var Sequelize=require(_0x1f84('0x0'));module[_0x1f84('0x1')]={'name':{'type':Sequelize[_0x1f84('0x2')]},'prefix':{'type':Sequelize[_0x1f84('0x2')],'unique':_0x1f84('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x1f84('0x2')],'set':function(_0x32cb83){this[_0x1f84('0x4')](_0x1f84('0x5'),_0x32cb83?_0x32cb83['join'](''):[]);},'get':function(){return this['getDataValue'](_0x1f84('0x5'))?this['getDataValue'](_0x1f84('0x5'))[_0x1f84('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x1f84('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1f84('0x2')]},'description':{'type':Sequelize[_0x1f84('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8e36bfd..393d1f6 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 _0x26c2=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x504f15,_0x23a1ca){var _0x2a92c1=function(_0x298472){while(--_0x298472){_0x504f15['push'](_0x504f15['shift']());}};_0x2a92c1(++_0x23a1ca);}(_0x26c2,0x130));var _0x226c=function(_0x90c0a0,_0x1f6929){_0x90c0a0=_0x90c0a0-0x0;var _0x455bdb=_0x26c2[_0x90c0a0];return _0x455bdb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x226c('0x0'));var rp=require(_0x226c('0x1'));var moment=require(_0x226c('0x2'));var BPromise=require(_0x226c('0x3'));var Mustache=require('mustache');var util=require(_0x226c('0x4'));var path=require(_0x226c('0x5'));var sox=require('sox');var csv=require(_0x226c('0x6'));var ejs=require(_0x226c('0x7'));var fs=require('fs');var fs_extra=require(_0x226c('0x8'));var _=require(_0x226c('0x9'));var squel=require(_0x226c('0xa'));var crypto=require('crypto');var jsforce=require(_0x226c('0xb'));var deskjs=require(_0x226c('0xc'));var toCsv=require(_0x226c('0x6'));var querystring=require(_0x226c('0xd'));var Papa=require(_0x226c('0xe'));var Redis=require('ioredis');var authService=require(_0x226c('0xf'));var qs=require(_0x226c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x226c('0x11'))(_0x226c('0x12'));var utils=require(_0x226c('0x13'));var config=require(_0x226c('0x14'));var licenseUtil=require(_0x226c('0x15'));var db=require(_0x226c('0x16'))['db'];function respondWithStatusCode(_0x2964c2,_0x57dbc4){_0x57dbc4=_0x57dbc4||0xcc;return function(_0x481496){if(_0x481496){return _0x2964c2[_0x226c('0x17')](_0x57dbc4);}return _0x2964c2[_0x226c('0x18')](_0x57dbc4)[_0x226c('0x19')]();};}function respondWithResult(_0x36af55,_0x4eb557){_0x4eb557=_0x4eb557||0xc8;return function(_0x4bfd5c){if(_0x4bfd5c){return _0x36af55[_0x226c('0x18')](_0x4eb557)[_0x226c('0x1a')](_0x4bfd5c);}};}function respondWithFilteredResult(_0x15e13b,_0x55697c){return function(_0x5d6c21){if(_0x5d6c21){var _0x694eef=typeof _0x55697c[_0x226c('0x1b')]===_0x226c('0x1c')&&typeof _0x55697c[_0x226c('0x1d')]===_0x226c('0x1c');var _0x4832f5=_0x5d6c21['count'];var _0x5989e0=_0x694eef?0x0:_0x55697c[_0x226c('0x1b')];var _0x813b69=_0x694eef?_0x5d6c21[_0x226c('0x1e')]:_0x55697c[_0x226c('0x1b')]+_0x55697c['limit'];var _0x7fc168;if(_0x813b69>=_0x4832f5){_0x813b69=_0x4832f5;_0x7fc168=0xc8;}else{_0x7fc168=0xce;}_0x15e13b[_0x226c('0x18')](_0x7fc168);return _0x15e13b[_0x226c('0x1f')](_0x226c('0x20'),_0x5989e0+'-'+_0x813b69+'/'+_0x4832f5)[_0x226c('0x1a')](_0x5d6c21);}return null;};}function patchUpdates(_0x3d412a){return function(_0x4dabf3){try{jsonpatch[_0x226c('0x21')](_0x4dabf3,_0x3d412a,!![]);}catch(_0x34253b){return BPromise[_0x226c('0x22')](_0x34253b);}return _0x4dabf3[_0x226c('0x23')]();};}function saveUpdates(_0x272f26,_0x57eb9f){return function(_0x575c7a){if(_0x575c7a){return _0x575c7a['update'](_0x272f26)[_0x226c('0x24')](function(_0x52985c){return _0x52985c;});}return null;};}function removeEntity(_0x4da72c,_0xbaee21){return function(_0x5b3919){if(_0x5b3919){return _0x5b3919[_0x226c('0x25')]()[_0x226c('0x24')](function(){var _0x2a570a=_0x5b3919['get']({'plain':!![]});var _0x25165d='ChanSpies';return db[_0x226c('0x26')]['destroy']({'where':{'type':_0x25165d,'resourceId':_0x2a570a['id']}})[_0x226c('0x24')](function(){return _0x5b3919;});})[_0x226c('0x24')](function(){_0x4da72c[_0x226c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c49b,_0x4a0b38){return function(_0xbe7c35){if(!_0xbe7c35){_0x14c49b['sendStatus'](0x194);}return _0xbe7c35;};}function handleError(_0x431875,_0x539e59){_0x539e59=_0x539e59||0x1f4;return function(_0x40a095){logger[_0x226c('0x27')](_0x40a095['stack']);if(_0x40a095['name']){delete _0x40a095[_0x226c('0x28')];}_0x431875[_0x226c('0x18')](_0x539e59)[_0x226c('0x29')](_0x40a095);};}exports[_0x226c('0x2a')]=function(_0x1e78f5,_0x253aeb){var _0x2ff83b={},_0x3a28d8={},_0x5fdaf5={'count':0x0,'rows':[]};var _0x1bd25d=_[_0x226c('0x2b')](db[_0x226c('0x2c')]['rawAttributes'],function(_0xabaf14){return{'name':_0xabaf14[_0x226c('0x2d')],'type':_0xabaf14[_0x226c('0x2e')][_0x226c('0x2f')]};});_0x3a28d8[_0x226c('0x30')]=_['map'](_0x1bd25d,_0x226c('0x28'));_0x3a28d8[_0x226c('0x31')]=_[_0x226c('0x32')](_0x1e78f5['query']);_0x3a28d8[_0x226c('0x33')]=_['intersection'](_0x3a28d8[_0x226c('0x30')],_0x3a28d8[_0x226c('0x31')]);_0x2ff83b[_0x226c('0x34')]=_[_0x226c('0x35')](_0x3a28d8[_0x226c('0x30')],qs[_0x226c('0x36')](_0x1e78f5[_0x226c('0x31')][_0x226c('0x36')]));_0x2ff83b[_0x226c('0x34')]=_0x2ff83b[_0x226c('0x34')][_0x226c('0x37')]?_0x2ff83b[_0x226c('0x34')]:_0x3a28d8[_0x226c('0x30')];if(!_0x1e78f5[_0x226c('0x31')]['hasOwnProperty'](_0x226c('0x38'))){_0x2ff83b[_0x226c('0x1d')]=qs[_0x226c('0x1d')](_0x1e78f5[_0x226c('0x31')][_0x226c('0x1d')]);_0x2ff83b[_0x226c('0x1b')]=qs[_0x226c('0x1b')](_0x1e78f5[_0x226c('0x31')][_0x226c('0x1b')]);}_0x2ff83b['order']=qs['sort'](_0x1e78f5[_0x226c('0x31')][_0x226c('0x39')]);_0x2ff83b[_0x226c('0x3a')]=qs[_0x226c('0x33')](_[_0x226c('0x3b')](_0x1e78f5[_0x226c('0x31')],_0x3a28d8[_0x226c('0x33')]),_0x1bd25d);if(_0x1e78f5[_0x226c('0x31')][_0x226c('0x3c')]){_0x2ff83b['where']=_[_0x226c('0x3d')](_0x2ff83b['where'],{'$or':_[_0x226c('0x2b')](_0x1bd25d,function(_0x1a7d0d){if(_0x1a7d0d[_0x226c('0x2e')]!=='VIRTUAL'){var _0x507aa8={};_0x507aa8[_0x1a7d0d[_0x226c('0x28')]]={'$like':'%'+_0x1e78f5[_0x226c('0x31')]['filter']+'%'};return _0x507aa8;}})});}_0x2ff83b=_[_0x226c('0x3d')]({},_0x2ff83b,_0x1e78f5[_0x226c('0x3e')]);var _0x190605={'where':_0x2ff83b[_0x226c('0x3a')]};return db['VoiceChanSpy'][_0x226c('0x1e')](_0x190605)[_0x226c('0x24')](function(_0x12f34d){_0x5fdaf5['count']=_0x12f34d;if(_0x1e78f5[_0x226c('0x31')][_0x226c('0x3f')]){_0x2ff83b[_0x226c('0x40')]=[{'all':!![]}];}return db[_0x226c('0x2c')][_0x226c('0x41')](_0x2ff83b);})['then'](function(_0x5ea01f){_0x5fdaf5['rows']=_0x5ea01f;return _0x5fdaf5;})[_0x226c('0x24')](respondWithFilteredResult(_0x253aeb,_0x2ff83b))[_0x226c('0x42')](handleError(_0x253aeb,null));};exports[_0x226c('0x43')]=function(_0x17e1a8,_0x345514){var _0x3145f4={'raw':![],'where':{'id':_0x17e1a8[_0x226c('0x44')]['id']}},_0x16ae23={};_0x16ae23[_0x226c('0x30')]=_['keys'](db['VoiceChanSpy'][_0x226c('0x45')]);_0x16ae23[_0x226c('0x31')]=_['keys'](_0x17e1a8[_0x226c('0x31')]);_0x16ae23['filters']=_['intersection'](_0x16ae23[_0x226c('0x30')],_0x16ae23['query']);_0x3145f4[_0x226c('0x34')]=_[_0x226c('0x35')](_0x16ae23[_0x226c('0x30')],qs[_0x226c('0x36')](_0x17e1a8[_0x226c('0x31')][_0x226c('0x36')]));_0x3145f4['attributes']=_0x3145f4[_0x226c('0x34')]['length']?_0x3145f4[_0x226c('0x34')]:_0x16ae23[_0x226c('0x30')];if(_0x17e1a8[_0x226c('0x31')][_0x226c('0x3f')]){_0x3145f4['include']=[{'all':!![]}];}_0x3145f4=_[_0x226c('0x3d')]({},_0x3145f4,_0x17e1a8['options']);return db[_0x226c('0x2c')][_0x226c('0x46')](_0x3145f4)[_0x226c('0x24')](handleEntityNotFound(_0x345514,null))[_0x226c('0x24')](respondWithResult(_0x345514,null))[_0x226c('0x42')](handleError(_0x345514,null));};exports[_0x226c('0x47')]=function(_0x4f99f5,_0x21c046){return db[_0x226c('0x2c')][_0x226c('0x47')](_0x4f99f5[_0x226c('0x48')],{})[_0x226c('0x24')](function(_0x27ccb8){var _0xfa1394=_0x4f99f5[_0x226c('0x49')][_0x226c('0x4a')]({'plain':!![]});if(!_0xfa1394)throw new Error(_0x226c('0x4b'));if(_0xfa1394[_0x226c('0x4c')]===_0x226c('0x49')){var _0x5f3434=_0x27ccb8['get']({'plain':!![]});var _0x486510=_0x226c('0x4d');return db[_0x226c('0x4e')][_0x226c('0x46')]({'where':{'name':_0x486510,'userProfileId':_0xfa1394['userProfileId']},'raw':!![]})[_0x226c('0x24')](function(_0x42710d){if(_0x42710d&&_0x42710d['autoAssociation']===0x0){return db[_0x226c('0x26')][_0x226c('0x47')]({'name':_0x5f3434[_0x226c('0x28')],'resourceId':_0x5f3434['id'],'type':_0x42710d[_0x226c('0x28')],'sectionId':_0x42710d['id']},{})[_0x226c('0x24')](function(){return _0x27ccb8;});}else{return _0x27ccb8;}})[_0x226c('0x42')](function(_0x3e60bf){logger[_0x226c('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e60bf);throw _0x3e60bf;});}return _0x27ccb8;})[_0x226c('0x24')](respondWithResult(_0x21c046,0xc9))[_0x226c('0x42')](handleError(_0x21c046,null));};exports['update']=function(_0x3b902a,_0x3e5304){if(_0x3b902a[_0x226c('0x48')]['id']){delete _0x3b902a[_0x226c('0x48')]['id'];}return db[_0x226c('0x2c')][_0x226c('0x46')]({'where':{'id':_0x3b902a['params']['id']}})[_0x226c('0x24')](handleEntityNotFound(_0x3e5304,null))['then'](saveUpdates(_0x3b902a['body'],null))[_0x226c('0x24')](respondWithResult(_0x3e5304,null))[_0x226c('0x42')](handleError(_0x3e5304,null));};exports['destroy']=function(_0x3861be,_0x17cfc1){return db[_0x226c('0x2c')]['find']({'where':{'id':_0x3861be[_0x226c('0x44')]['id']}})[_0x226c('0x24')](handleEntityNotFound(_0x17cfc1,null))[_0x226c('0x24')](removeEntity(_0x17cfc1,null))[_0x226c('0x42')](handleError(_0x17cfc1,null));}; \ No newline at end of file +var _0x9993=['model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','VoiceChanSpy','include','findAll','rows','catch','show','params','includeAll','find','create','user','role','UserProfileSection','userProfileId','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','get','ChanSpies','destroy','error','stack','name','map','rawAttributes','fieldName','type','key'];(function(_0x475f4d,_0x402711){var _0x5e89a6=function(_0x4dd9e3){while(--_0x4dd9e3){_0x475f4d['push'](_0x475f4d['shift']());}};_0x5e89a6(++_0x402711);}(_0x9993,0x109));var _0x3999=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x9993[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x3999('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3999('0x1'));var jsonpatch=require(_0x3999('0x2'));var rp=require(_0x3999('0x3'));var moment=require('moment');var BPromise=require(_0x3999('0x4'));var Mustache=require('mustache');var util=require(_0x3999('0x5'));var path=require(_0x3999('0x6'));var sox=require(_0x3999('0x7'));var csv=require('to-csv');var ejs=require(_0x3999('0x8'));var fs=require('fs');var fs_extra=require(_0x3999('0x9'));var _=require('lodash');var squel=require(_0x3999('0xa'));var crypto=require(_0x3999('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3999('0xc'));var toCsv=require(_0x3999('0xd'));var querystring=require('querystring');var Papa=require(_0x3999('0xe'));var Redis=require('ioredis');var authService=require(_0x3999('0xf'));var qs=require(_0x3999('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3999('0x11'));var logger=require(_0x3999('0x12'))(_0x3999('0x13'));var utils=require(_0x3999('0x14'));var config=require(_0x3999('0x15'));var licenseUtil=require(_0x3999('0x16'));var db=require(_0x3999('0x17'))['db'];function respondWithStatusCode(_0x52c26b,_0x7f35f5){_0x7f35f5=_0x7f35f5||0xcc;return function(_0x3e34e9){if(_0x3e34e9){return _0x52c26b['sendStatus'](_0x7f35f5);}return _0x52c26b[_0x3999('0x18')](_0x7f35f5)[_0x3999('0x19')]();};}function respondWithResult(_0x335b4b,_0x30ca58){_0x30ca58=_0x30ca58||0xc8;return function(_0x5a36b0){if(_0x5a36b0){return _0x335b4b[_0x3999('0x18')](_0x30ca58)['json'](_0x5a36b0);}};}function respondWithFilteredResult(_0x2072bf,_0x5803af){return function(_0x1756e7){if(_0x1756e7){var _0x56787c=typeof _0x5803af[_0x3999('0x1a')]===_0x3999('0x1b')&&typeof _0x5803af[_0x3999('0x1c')]===_0x3999('0x1b');var _0x51f56a=_0x1756e7['count'];var _0xdd19a=_0x56787c?0x0:_0x5803af[_0x3999('0x1a')];var _0x5705f6=_0x56787c?_0x1756e7[_0x3999('0x1d')]:_0x5803af[_0x3999('0x1a')]+_0x5803af['limit'];var _0x1afedd;if(_0x5705f6>=_0x51f56a){_0x5705f6=_0x51f56a;_0x1afedd=0xc8;}else{_0x1afedd=0xce;}_0x2072bf['status'](_0x1afedd);return _0x2072bf[_0x3999('0x1e')]('Content-Range',_0xdd19a+'-'+_0x5705f6+'/'+_0x51f56a)['json'](_0x1756e7);}return null;};}function patchUpdates(_0x5c414){return function(_0x3e4509){try{jsonpatch[_0x3999('0x1f')](_0x3e4509,_0x5c414,!![]);}catch(_0x367dd8){return BPromise[_0x3999('0x20')](_0x367dd8);}return _0x3e4509[_0x3999('0x21')]();};}function saveUpdates(_0x560c2d,_0xb7a29f){return function(_0x53ea75){if(_0x53ea75){return _0x53ea75[_0x3999('0x22')](_0x560c2d)[_0x3999('0x23')](function(_0xf34704){return _0xf34704;});}return null;};}function removeEntity(_0x39858b,_0xb17e81){return function(_0x553535){if(_0x553535){return _0x553535['destroy']()[_0x3999('0x23')](function(){var _0x402615=_0x553535[_0x3999('0x24')]({'plain':!![]});var _0x11a394=_0x3999('0x25');return db['UserProfileResource'][_0x3999('0x26')]({'where':{'type':_0x11a394,'resourceId':_0x402615['id']}})[_0x3999('0x23')](function(){return _0x553535;});})[_0x3999('0x23')](function(){_0x39858b[_0x3999('0x18')](0xcc)[_0x3999('0x19')]();});}};}function handleEntityNotFound(_0x23bfef,_0x249da1){return function(_0x593458){if(!_0x593458){_0x23bfef['sendStatus'](0x194);}return _0x593458;};}function handleError(_0x256d39,_0x1ff346){_0x1ff346=_0x1ff346||0x1f4;return function(_0x31d7c0){logger[_0x3999('0x27')](_0x31d7c0[_0x3999('0x28')]);if(_0x31d7c0['name']){delete _0x31d7c0[_0x3999('0x29')];}_0x256d39[_0x3999('0x18')](_0x1ff346)['send'](_0x31d7c0);};}exports['index']=function(_0x5ba951,_0x6d71fb){var _0x29e3c8={},_0x19a40={},_0x4525c2={'count':0x0,'rows':[]};var _0x3a657e=_[_0x3999('0x2a')](db['VoiceChanSpy'][_0x3999('0x2b')],function(_0x451162){return{'name':_0x451162[_0x3999('0x2c')],'type':_0x451162[_0x3999('0x2d')][_0x3999('0x2e')]};});_0x19a40[_0x3999('0x2f')]=_['map'](_0x3a657e,'name');_0x19a40[_0x3999('0x30')]=_[_0x3999('0x31')](_0x5ba951[_0x3999('0x30')]);_0x19a40['filters']=_['intersection'](_0x19a40[_0x3999('0x2f')],_0x19a40[_0x3999('0x30')]);_0x29e3c8[_0x3999('0x32')]=_[_0x3999('0x33')](_0x19a40[_0x3999('0x2f')],qs[_0x3999('0x34')](_0x5ba951[_0x3999('0x30')][_0x3999('0x34')]));_0x29e3c8[_0x3999('0x32')]=_0x29e3c8[_0x3999('0x32')][_0x3999('0x35')]?_0x29e3c8[_0x3999('0x32')]:_0x19a40['model'];if(!_0x5ba951['query'][_0x3999('0x36')](_0x3999('0x37'))){_0x29e3c8[_0x3999('0x1c')]=qs[_0x3999('0x1c')](_0x5ba951[_0x3999('0x30')]['limit']);_0x29e3c8[_0x3999('0x1a')]=qs[_0x3999('0x1a')](_0x5ba951[_0x3999('0x30')]['offset']);}_0x29e3c8[_0x3999('0x38')]=qs[_0x3999('0x39')](_0x5ba951[_0x3999('0x30')]['sort']);_0x29e3c8[_0x3999('0x3a')]=qs['filters'](_['pick'](_0x5ba951[_0x3999('0x30')],_0x19a40[_0x3999('0x3b')]),_0x3a657e);if(_0x5ba951[_0x3999('0x30')][_0x3999('0x3c')]){_0x29e3c8['where']=_[_0x3999('0x3d')](_0x29e3c8[_0x3999('0x3a')],{'$or':_[_0x3999('0x2a')](_0x3a657e,function(_0xf89251){if(_0xf89251[_0x3999('0x2d')]!=='VIRTUAL'){var _0xed9d52={};_0xed9d52[_0xf89251[_0x3999('0x29')]]={'$like':'%'+_0x5ba951['query'][_0x3999('0x3c')]+'%'};return _0xed9d52;}})});}_0x29e3c8=_[_0x3999('0x3d')]({},_0x29e3c8,_0x5ba951[_0x3999('0x3e')]);var _0x133a61={'where':_0x29e3c8[_0x3999('0x3a')]};return db[_0x3999('0x3f')][_0x3999('0x1d')](_0x133a61)[_0x3999('0x23')](function(_0x21b8bb){_0x4525c2[_0x3999('0x1d')]=_0x21b8bb;if(_0x5ba951[_0x3999('0x30')]['includeAll']){_0x29e3c8[_0x3999('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x3999('0x41')](_0x29e3c8);})[_0x3999('0x23')](function(_0x15ddcb){_0x4525c2[_0x3999('0x42')]=_0x15ddcb;return _0x4525c2;})['then'](respondWithFilteredResult(_0x6d71fb,_0x29e3c8))[_0x3999('0x43')](handleError(_0x6d71fb,null));};exports[_0x3999('0x44')]=function(_0x1a4a12,_0x50eb55){var _0x4b161b={'raw':![],'where':{'id':_0x1a4a12[_0x3999('0x45')]['id']}},_0x29f24b={};_0x29f24b[_0x3999('0x2f')]=_[_0x3999('0x31')](db[_0x3999('0x3f')]['rawAttributes']);_0x29f24b[_0x3999('0x30')]=_['keys'](_0x1a4a12[_0x3999('0x30')]);_0x29f24b['filters']=_[_0x3999('0x33')](_0x29f24b[_0x3999('0x2f')],_0x29f24b[_0x3999('0x30')]);_0x4b161b['attributes']=_[_0x3999('0x33')](_0x29f24b[_0x3999('0x2f')],qs[_0x3999('0x34')](_0x1a4a12[_0x3999('0x30')][_0x3999('0x34')]));_0x4b161b[_0x3999('0x32')]=_0x4b161b[_0x3999('0x32')][_0x3999('0x35')]?_0x4b161b[_0x3999('0x32')]:_0x29f24b[_0x3999('0x2f')];if(_0x1a4a12[_0x3999('0x30')][_0x3999('0x46')]){_0x4b161b[_0x3999('0x40')]=[{'all':!![]}];}_0x4b161b=_[_0x3999('0x3d')]({},_0x4b161b,_0x1a4a12[_0x3999('0x3e')]);return db[_0x3999('0x3f')][_0x3999('0x47')](_0x4b161b)[_0x3999('0x23')](handleEntityNotFound(_0x50eb55,null))[_0x3999('0x23')](respondWithResult(_0x50eb55,null))[_0x3999('0x43')](handleError(_0x50eb55,null));};exports[_0x3999('0x48')]=function(_0x45d08a,_0x58ab03){return db[_0x3999('0x3f')][_0x3999('0x48')](_0x45d08a['body'],{})[_0x3999('0x23')](function(_0x275a80){var _0x4acddd=_0x45d08a[_0x3999('0x49')][_0x3999('0x24')]({'plain':!![]});if(!_0x4acddd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4acddd[_0x3999('0x4a')]==='user'){var _0x58f509=_0x275a80[_0x3999('0x24')]({'plain':!![]});var _0x34c650=_0x3999('0x25');return db[_0x3999('0x4b')][_0x3999('0x47')]({'where':{'name':_0x34c650,'userProfileId':_0x4acddd[_0x3999('0x4c')]},'raw':!![]})[_0x3999('0x23')](function(_0x9b3aed){if(_0x9b3aed&&_0x9b3aed['autoAssociation']===0x0){return db['UserProfileResource'][_0x3999('0x48')]({'name':_0x58f509[_0x3999('0x29')],'resourceId':_0x58f509['id'],'type':_0x9b3aed[_0x3999('0x29')],'sectionId':_0x9b3aed['id']},{})[_0x3999('0x23')](function(){return _0x275a80;});}else{return _0x275a80;}})['catch'](function(_0x3deb72){logger[_0x3999('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3deb72);throw _0x3deb72;});}return _0x275a80;})[_0x3999('0x23')](respondWithResult(_0x58ab03,0xc9))[_0x3999('0x43')](handleError(_0x58ab03,null));};exports['update']=function(_0x1dfbe9,_0x454dd1){if(_0x1dfbe9[_0x3999('0x4d')]['id']){delete _0x1dfbe9[_0x3999('0x4d')]['id'];}return db['VoiceChanSpy'][_0x3999('0x47')]({'where':{'id':_0x1dfbe9['params']['id']}})[_0x3999('0x23')](handleEntityNotFound(_0x454dd1,null))[_0x3999('0x23')](saveUpdates(_0x1dfbe9[_0x3999('0x4d')],null))[_0x3999('0x23')](respondWithResult(_0x454dd1,null))[_0x3999('0x43')](handleError(_0x454dd1,null));};exports[_0x3999('0x26')]=function(_0x41e901,_0xf33edb){return db[_0x3999('0x3f')][_0x3999('0x47')]({'where':{'id':_0x41e901['params']['id']}})['then'](handleEntityNotFound(_0xf33edb,null))[_0x3999('0x23')](removeEntity(_0xf33edb,null))[_0x3999('0x43')](handleError(_0xf33edb,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 58ed634..f9f8133 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 _0x202d=['util','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy','record','merge','MixMonitor','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash'];(function(_0x2e8b77,_0x5d473c){var _0xe01d2b=function(_0x508187){while(--_0x508187){_0x2e8b77['push'](_0x2e8b77['shift']());}};_0xe01d2b(++_0x5d473c);}(_0x202d,0x1e0));var _0xd202=function(_0x45a06f,_0x254a92){_0x45a06f=_0x45a06f-0x0;var _0x1dd577=_0x202d[_0x45a06f];return _0x1dd577;};'use strict';var _=require(_0xd202('0x0'));var util=require(_0xd202('0x1'));var BPromise=require(_0xd202('0x2'));var attributes=require(_0xd202('0x3'));var getUserApplications=function(_0x16e2ed,_0x4e448c,_0x2b5424){var _0x12c3f3=0x1;var _0x4f988d=[];var _0x3bca9f={'context':_0x4e448c[_0xd202('0x4')]||'from-sip','exten':util['format'](_0xd202('0x5'),_0x16e2ed[_0xd202('0x6')],_0x2b5424),'type':_0xd202('0x7'),'isApp':![],'ChanSpyId':_0x16e2ed['id'],'UserId':_0x4e448c['id']};_0x4f988d[_0xd202('0x8')](_['merge']({'app':_0xd202('0x9'),'appdata':util[_0xd202('0xa')](_0xd202('0xb'),_0xd202('0xc')),'priority':_0x12c3f3++},_0x3bca9f));if(_0x16e2ed[_0xd202('0xd')]){_0x4f988d[_0xd202('0x8')](_[_0xd202('0xe')]({'app':_0xd202('0xf'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x16e2ed['recordingFormat']),'priority':_0x12c3f3++},_0x3bca9f));}if(_0x16e2ed['auth']){_0x4f988d[_0xd202('0x8')](_['merge']({'app':_0xd202('0x10'),'appdata':_0x16e2ed[_0xd202('0x11')],'priority':_0x12c3f3++},_0x3bca9f));}_0x4f988d[_0xd202('0x8')](_[_0xd202('0xe')]({'app':_0xd202('0x12'),'appdata':util['format'](_0xd202('0x13'),_0x4e448c[_0xd202('0x14')],_0x16e2ed[_0xd202('0x15')]?_0x16e2ed[_0xd202('0x15')][_0xd202('0x16')](''):''),'priority':_0x12c3f3++},_0x3bca9f));if(_0x16e2ed[_0xd202('0xd')]){_0x4f988d[_0xd202('0x8')](_['merge']({'app':_0xd202('0x17'),'priority':_0x12c3f3++},_0x3bca9f));}return _0x4f988d;};var getChanSpyApplications=function(_0x5a7dcf,_0x1fd61e){var _0x55d6e8=[];for(var _0x5926f6=0x0,_0x1e9624=0x1;_0x5926f6<_0x1fd61e[_0xd202('0x18')];_0x5926f6++,_0x1e9624=0x1){_0x55d6e8=_0x55d6e8[_0xd202('0x19')](getUserApplications(_0x5a7dcf,_0x1fd61e[_0x5926f6],_0x1fd61e[_0x5926f6]['internal']));if(_0x1fd61e[_0x5926f6][_0xd202('0x1a')]!=_0x1fd61e[_0x5926f6][_0xd202('0x14')]){_0x55d6e8=_0x55d6e8[_0xd202('0x19')](getUserApplications(_0x5a7dcf,_0x1fd61e[_0x5926f6],_0x1fd61e[_0x5926f6][_0xd202('0x14')]));}}return _0x55d6e8;};var getChanSpyPromise=function(_0x372ed9,_0x3f3c32){return new BPromise(function(_0x2f416b,_0xb7ed65){return _0x372ed9['User'][_0xd202('0x1b')]({'attributes':['id',_0xd202('0x14'),_0xd202('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xd202('0x1c')](function(_0x14f20e){if(_0x14f20e){return _0x2f416b(getChanSpyApplications(_0x3f3c32,_0x14f20e));}return _0x2f416b([]);})[_0xd202('0x1d')](function(_0x5a7f5b){_0xb7ed65(_0x5a7f5b);});});};module[_0xd202('0x1e')]=function(_0x51e311,_0x35fc5e){var _0x57878c=_0x51e311[_0xd202('0x1f')];return _0x51e311[_0xd202('0x20')]('VoiceChanSpy',attributes,{'tableName':_0xd202('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4334b7,_0x280dd1,_0x49b449){return getChanSpyPromise(_0x57878c,_0x4334b7)[_0xd202('0x1c')](function(_0x2ba756){if(_0x2ba756&&_0x2ba756[_0xd202('0x18')]){return _0x57878c[_0xd202('0x22')][_0xd202('0x23')](_0x2ba756);}})[_0xd202('0x1c')](function(){_0x49b449();})[_0xd202('0x1d')](function(_0x1e393e){_0x49b449(_0x1e393e);});},'afterUpdate':function(_0xffc880,_0x5d7703,_0x42c864){return _0x57878c['VoiceExtension'][_0xd202('0x24')]({'where':{'ChanSpyId':_0xffc880['id']}})[_0xd202('0x1c')](function(){return getChanSpyPromise(_0x57878c,_0xffc880);})[_0xd202('0x1c')](function(_0x3a136a){if(_0x3a136a&&_0x3a136a[_0xd202('0x18')]){return _0x57878c[_0xd202('0x22')][_0xd202('0x23')](_0x3a136a);}})[_0xd202('0x1c')](function(){_0x42c864();})[_0xd202('0x1d')](function(_0xd2ea00){_0x42c864(_0xd2ea00);});},'afterDestroy':function(_0x34c81d,_0x1f095b,_0x522e99){return _0x57878c[_0xd202('0x22')]['destroy']({'where':{'ChanSpyId':_0x34c81d['id']}})[_0xd202('0x1c')](function(){_0x522e99();})['catch'](function(_0x1ec296){_0x522e99(_0x1ec296);});}}});}; \ No newline at end of file +var _0xeda3=['system','merge','Set','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','concat','internal','agent','then','catch','models','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeda3,0x10f));var _0x3eda=function(_0x103a83,_0x28180b){_0x103a83=_0x103a83-0x0;var _0x5a181e=_0xeda3[_0x103a83];return _0x5a181e;};'use strict';var _=require(_0x3eda('0x0'));var util=require(_0x3eda('0x1'));var BPromise=require(_0x3eda('0x2'));var attributes=require(_0x3eda('0x3'));var getUserApplications=function(_0x4e9def,_0x58cfaf,_0xcb2565){var _0x11a96d=0x1;var _0x51cbe4=[];var _0x30c774={'context':_0x58cfaf[_0x3eda('0x4')]||_0x3eda('0x5'),'exten':util[_0x3eda('0x6')](_0x3eda('0x7'),_0x4e9def[_0x3eda('0x8')],_0xcb2565),'type':_0x3eda('0x9'),'isApp':![],'ChanSpyId':_0x4e9def['id'],'UserId':_0x58cfaf['id']};_0x51cbe4['push'](_[_0x3eda('0xa')]({'app':_0x3eda('0xb'),'appdata':util['format']('CDR(type)=%s',_0x3eda('0xc')),'priority':_0x11a96d++},_0x30c774));if(_0x4e9def[_0x3eda('0xd')]){_0x51cbe4[_0x3eda('0xe')](_[_0x3eda('0xa')]({'app':_0x3eda('0xf'),'appdata':util[_0x3eda('0x6')](_0x3eda('0x10'),_0x4e9def['recordingFormat']),'priority':_0x11a96d++},_0x30c774));}if(_0x4e9def[_0x3eda('0x11')]){_0x51cbe4[_0x3eda('0xe')](_[_0x3eda('0xa')]({'app':_0x3eda('0x12'),'appdata':_0x4e9def[_0x3eda('0x13')],'priority':_0x11a96d++},_0x30c774));}_0x51cbe4[_0x3eda('0xe')](_['merge']({'app':_0x3eda('0x14'),'appdata':util[_0x3eda('0x6')](_0x3eda('0x15'),_0x58cfaf[_0x3eda('0x16')],_0x4e9def['options']?_0x4e9def['options'][_0x3eda('0x17')](''):''),'priority':_0x11a96d++},_0x30c774));if(_0x4e9def[_0x3eda('0xd')]){_0x51cbe4[_0x3eda('0xe')](_['merge']({'app':'StopMixMonitor','priority':_0x11a96d++},_0x30c774));}return _0x51cbe4;};var getChanSpyApplications=function(_0x399296,_0x2dc801){var _0x16b24f=[];for(var _0x385557=0x0,_0x30a612=0x1;_0x385557<_0x2dc801['length'];_0x385557++,_0x30a612=0x1){_0x16b24f=_0x16b24f[_0x3eda('0x18')](getUserApplications(_0x399296,_0x2dc801[_0x385557],_0x2dc801[_0x385557]['internal']));if(_0x2dc801[_0x385557][_0x3eda('0x19')]!=_0x2dc801[_0x385557][_0x3eda('0x16')]){_0x16b24f=_0x16b24f[_0x3eda('0x18')](getUserApplications(_0x399296,_0x2dc801[_0x385557],_0x2dc801[_0x385557][_0x3eda('0x16')]));}}return _0x16b24f;};var getChanSpyPromise=function(_0x257a13,_0x4aa1b8){return new BPromise(function(_0x3fdc9b,_0x2afe35){return _0x257a13['User']['findAll']({'attributes':['id',_0x3eda('0x16'),_0x3eda('0x19')],'where':{'role':_0x3eda('0x1a'),'chanspy':!![]},'raw':!![]})[_0x3eda('0x1b')](function(_0x5a1a8c){if(_0x5a1a8c){return _0x3fdc9b(getChanSpyApplications(_0x4aa1b8,_0x5a1a8c));}return _0x3fdc9b([]);})[_0x3eda('0x1c')](function(_0x1d8d38){_0x2afe35(_0x1d8d38);});});};module['exports']=function(_0x1ec46b,_0x4816fc){var _0x39ec56=_0x1ec46b[_0x3eda('0x1d')];return _0x1ec46b['define']('VoiceChanSpy',attributes,{'tableName':_0x3eda('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x44cde5,_0x2e126a,_0x555037){return getChanSpyPromise(_0x39ec56,_0x44cde5)[_0x3eda('0x1b')](function(_0x2d81ea){if(_0x2d81ea&&_0x2d81ea[_0x3eda('0x1f')]){return _0x39ec56[_0x3eda('0x20')][_0x3eda('0x21')](_0x2d81ea);}})[_0x3eda('0x1b')](function(){_0x555037();})['catch'](function(_0x1db070){_0x555037(_0x1db070);});},'afterUpdate':function(_0x42545c,_0x2fd78d,_0xd6209e){return _0x39ec56[_0x3eda('0x20')][_0x3eda('0x22')]({'where':{'ChanSpyId':_0x42545c['id']}})[_0x3eda('0x1b')](function(){return getChanSpyPromise(_0x39ec56,_0x42545c);})[_0x3eda('0x1b')](function(_0x1ef455){if(_0x1ef455&&_0x1ef455[_0x3eda('0x1f')]){return _0x39ec56[_0x3eda('0x20')][_0x3eda('0x21')](_0x1ef455);}})[_0x3eda('0x1b')](function(){_0xd6209e();})[_0x3eda('0x1c')](function(_0x2e0894){_0xd6209e(_0x2e0894);});},'afterDestroy':function(_0x532238,_0x494c74,_0x201da8){return _0x39ec56['VoiceExtension'][_0x3eda('0x22')]({'where':{'ChanSpyId':_0x532238['id']}})['then'](function(){_0x201da8();})[_0x3eda('0x1c')](function(_0x2c032c){_0x201da8(_0x2c032c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7bf5c1a..bb4ebf2 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 _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file +var _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x2f1699,_0x207bf1){var _0x565cbb=function(_0x37f711){while(--_0x37f711){_0x2f1699['push'](_0x2f1699['shift']());}};_0x565cbb(++_0x207bf1);}(_0x4483,0x1a3));var _0x3448=function(_0x1bafaa,_0x46a1ef){_0x1bafaa=_0x1bafaa-0x0;var _0x328216=_0x4483[_0x1bafaa];return _0x328216;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 001f920..b2909ef 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 _0xf178=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id','show','post','create','put','update','multer'];(function(_0x31b99a,_0x50b61a){var _0x3f6b83=function(_0x4b41fc){while(--_0x4b41fc){_0x31b99a['push'](_0x31b99a['shift']());}};_0x3f6b83(++_0x50b61a);}(_0xf178,0x1af));var _0x8f17=function(_0x397fd3,_0x32a108){_0x397fd3=_0x397fd3-0x0;var _0x55242f=_0xf178[_0x397fd3];return _0x55242f;};'use strict';var multer=require(_0x8f17('0x0'));var util=require('util');var path=require(_0x8f17('0x1'));var timeout=require(_0x8f17('0x2'));var express=require(_0x8f17('0x3'));var router=express['Router']();var fs_extra=require(_0x8f17('0x4'));var auth=require(_0x8f17('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8f17('0x6'));var controller=require(_0x8f17('0x7'));router['get']('/',auth[_0x8f17('0x8')](),controller['index']);router[_0x8f17('0x9')](_0x8f17('0xa'),auth[_0x8f17('0x8')](),controller[_0x8f17('0xb')]);router[_0x8f17('0xc')]('/',auth['isAuthenticated'](),controller[_0x8f17('0xd')]);router[_0x8f17('0xe')](_0x8f17('0xa'),auth[_0x8f17('0x8')](),controller[_0x8f17('0xf')]);router['delete'](_0x8f17('0xa'),auth[_0x8f17('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9278=['delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','post','isAuthenticated','create','put','update'];(function(_0x542381,_0x397052){var _0x195754=function(_0x461494){while(--_0x461494){_0x542381['push'](_0x542381['shift']());}};_0x195754(++_0x397052);}(_0x9278,0xa8));var _0x8927=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9278[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x8927('0x0'));var util=require(_0x8927('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8927('0x2'));var router=express[_0x8927('0x3')]();var fs_extra=require(_0x8927('0x4'));var auth=require(_0x8927('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8927('0x6'));var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8927('0x7')]('/',auth[_0x8927('0x8')](),controller[_0x8927('0x9')]);router[_0x8927('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8927('0xb')]);router[_0x8927('0xc')](_0x8927('0xd'),auth[_0x8927('0x8')](),controller['destroy']);module[_0x8927('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8037010..a237bcc 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 _0x7804=['BOOLEAN','STRING','name'];(function(_0x390dc2,_0x3ead0b){var _0x3b2582=function(_0xbebe51){while(--_0xbebe51){_0x390dc2['push'](_0x390dc2['shift']());}};_0x3b2582(++_0x3ead0b);}(_0x7804,0x9d));var _0x4780=function(_0x17ca87,_0x2e1c33){_0x17ca87=_0x17ca87-0x0;var _0x57abc4=_0x7804[_0x17ca87];return _0x57abc4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4780('0x0')],'unique':_0x4780('0x1')},'description':{'type':Sequelize[_0x4780('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4780('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf6dc=['sequelize','exports','name','STRING'];(function(_0x37dd8d,_0x26920a){var _0x3c3c74=function(_0x42914b){while(--_0x42914b){_0x37dd8d['push'](_0x37dd8d['shift']());}};_0x3c3c74(++_0x26920a);}(_0xf6dc,0x1e0));var _0xcf6d=function(_0x17fdee,_0x43a0d7){_0x17fdee=_0x17fdee-0x0;var _0x1ff7c7=_0xf6dc[_0x17fdee];return _0x1ff7c7;};'use strict';var Sequelize=require(_0xcf6d('0x0'));module[_0xcf6d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcf6d('0x2')},'description':{'type':Sequelize[_0xcf6d('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 819ad2e..62ccaa7 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 _0x8c62=['request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','info','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','Contexts','UserProfileResource','stack','name','index','VoiceContext','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','Reload','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x8c62,0x17d));var _0x28c6=function(_0x2572cf,_0x288f79){_0x2572cf=_0x2572cf-0x0;var _0x1455f8=_0x8c62[_0x2572cf];return _0x1455f8;};'use strict';var emlformat=require(_0x28c6('0x0'));var rimraf=require(_0x28c6('0x1'));var zipdir=require(_0x28c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28c6('0x3'));var moment=require(_0x28c6('0x4'));var BPromise=require(_0x28c6('0x5'));var Mustache=require(_0x28c6('0x6'));var util=require('util');var path=require(_0x28c6('0x7'));var sox=require(_0x28c6('0x8'));var csv=require(_0x28c6('0x9'));var ejs=require(_0x28c6('0xa'));var fs=require('fs');var fs_extra=require(_0x28c6('0xb'));var _=require(_0x28c6('0xc'));var squel=require(_0x28c6('0xd'));var crypto=require('crypto');var jsforce=require(_0x28c6('0xe'));var deskjs=require(_0x28c6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x28c6('0x10'));var Papa=require(_0x28c6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x28c6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x28c6('0x13'))(_0x28c6('0x14'));var utils=require(_0x28c6('0x15'));var config=require(_0x28c6('0x16'));var licenseUtil=require(_0x28c6('0x17'));var db=require(_0x28c6('0x18'))['db'];var jayson=require(_0x28c6('0x19'));var client=jayson['client'][_0x28c6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x148415,_0x43fbe7,_0x476bec,_0x4313b9){return new BPromise(function(_0x15b9b1,_0x2f1525){var _0x1de881=_0x4313b9||client;return _0x1de881[_0x28c6('0x1b')](_0x148415,_0x476bec)[_0x28c6('0x1c')](function(_0x42d5fe){logger['info'](_0x28c6('0x1d'),_0x43fbe7,'request\x20sent');logger[_0x28c6('0x1e')](_0x28c6('0x1f'),_0x43fbe7,'request\x20sent',JSON[_0x28c6('0x20')](_0x42d5fe));if(_0x42d5fe['error']){if(_0x42d5fe[_0x28c6('0x21')]['code']===0x1f4){logger[_0x28c6('0x21')]('VoiceContext,\x20%s,\x20%s',_0x43fbe7,_0x42d5fe[_0x28c6('0x21')][_0x28c6('0x22')]);return _0x2f1525(_0x42d5fe['error'][_0x28c6('0x22')]);}logger[_0x28c6('0x21')](_0x28c6('0x1d'),_0x43fbe7,_0x42d5fe[_0x28c6('0x21')][_0x28c6('0x22')]);return _0x15b9b1(_0x42d5fe[_0x28c6('0x21')][_0x28c6('0x22')]);}else{logger[_0x28c6('0x23')](_0x28c6('0x1d'),_0x43fbe7,'request\x20sent');_0x15b9b1(_0x42d5fe['result'][_0x28c6('0x22')]);}})['catch'](function(_0x39f6c2){logger[_0x28c6('0x21')](_0x28c6('0x1d'),_0x43fbe7,_0x39f6c2);_0x2f1525(_0x39f6c2);});});}function respondWithStatusCode(_0x5413fc,_0x10f46f){_0x10f46f=_0x10f46f||0xcc;return function(_0x62c735){if(_0x62c735){return _0x5413fc[_0x28c6('0x24')](_0x10f46f);}return _0x5413fc['status'](_0x10f46f)[_0x28c6('0x25')]();};}function respondWithResult(_0x5a2247,_0x36432a){_0x36432a=_0x36432a||0xc8;return function(_0x13b424){if(_0x13b424){return _0x5a2247[_0x28c6('0x26')](_0x36432a)[_0x28c6('0x27')](_0x13b424);}};}function respondWithFilteredResult(_0x5f058b,_0xda3871){return function(_0x281199){if(_0x281199){var _0x65fe=typeof _0xda3871[_0x28c6('0x28')]===_0x28c6('0x29')&&typeof _0xda3871[_0x28c6('0x2a')]===_0x28c6('0x29');var _0x1fc435=_0x281199[_0x28c6('0x2b')];var _0x117f32=_0x65fe?0x0:_0xda3871[_0x28c6('0x28')];var _0x98696e=_0x65fe?_0x281199[_0x28c6('0x2b')]:_0xda3871[_0x28c6('0x28')]+_0xda3871[_0x28c6('0x2a')];var _0x1d3da6;if(_0x98696e>=_0x1fc435){_0x98696e=_0x1fc435;_0x1d3da6=0xc8;}else{_0x1d3da6=0xce;}_0x5f058b[_0x28c6('0x26')](_0x1d3da6);return _0x5f058b[_0x28c6('0x2c')](_0x28c6('0x2d'),_0x117f32+'-'+_0x98696e+'/'+_0x1fc435)[_0x28c6('0x27')](_0x281199);}return null;};}function patchUpdates(_0x81a611){return function(_0x50d52e){try{jsonpatch[_0x28c6('0x2e')](_0x50d52e,_0x81a611,!![]);}catch(_0x150f4d){return BPromise[_0x28c6('0x2f')](_0x150f4d);}return _0x50d52e['save']();};}function saveUpdates(_0x29de2d,_0x4849ad){return function(_0x6108c0){if(_0x6108c0){return _0x6108c0[_0x28c6('0x30')](_0x29de2d)[_0x28c6('0x1c')](function(_0x157780){return _0x157780;});}return null;};}function removeEntity(_0x594d1c,_0x5f1402){return function(_0x332944){if(_0x332944){return _0x332944[_0x28c6('0x31')]()['then'](function(){var _0x1dfad8=_0x332944[_0x28c6('0x32')]({'plain':!![]});var _0x36b775=_0x28c6('0x33');return db[_0x28c6('0x34')][_0x28c6('0x31')]({'where':{'type':_0x36b775,'resourceId':_0x1dfad8['id']}})['then'](function(){return _0x332944;});})[_0x28c6('0x1c')](function(){_0x594d1c[_0x28c6('0x26')](0xcc)[_0x28c6('0x25')]();});}};}function handleEntityNotFound(_0x3caf0e,_0x4a8a24){return function(_0x58ec45){if(!_0x58ec45){_0x3caf0e[_0x28c6('0x24')](0x194);}return _0x58ec45;};}function handleError(_0x5e02ed,_0xad30a7){_0xad30a7=_0xad30a7||0x1f4;return function(_0x56fc2d){logger[_0x28c6('0x21')](_0x56fc2d[_0x28c6('0x35')]);if(_0x56fc2d[_0x28c6('0x36')]){delete _0x56fc2d[_0x28c6('0x36')];}_0x5e02ed[_0x28c6('0x26')](_0xad30a7)['send'](_0x56fc2d);};}exports[_0x28c6('0x37')]=function(_0x59bb81,_0x237f52){var _0x45a32c={},_0x1e2a48={},_0x178da2={'count':0x0,'rows':[]};var _0x394452=_['map'](db[_0x28c6('0x38')][_0x28c6('0x39')],function(_0x5b427b){return{'name':_0x5b427b['fieldName'],'type':_0x5b427b[_0x28c6('0x3a')][_0x28c6('0x3b')]};});_0x1e2a48[_0x28c6('0x3c')]=_[_0x28c6('0x3d')](_0x394452,_0x28c6('0x36'));_0x1e2a48['query']=_[_0x28c6('0x3e')](_0x59bb81[_0x28c6('0x3f')]);_0x1e2a48[_0x28c6('0x40')]=_[_0x28c6('0x41')](_0x1e2a48[_0x28c6('0x3c')],_0x1e2a48[_0x28c6('0x3f')]);_0x45a32c[_0x28c6('0x42')]=_[_0x28c6('0x41')](_0x1e2a48[_0x28c6('0x3c')],qs[_0x28c6('0x43')](_0x59bb81[_0x28c6('0x3f')][_0x28c6('0x43')]));_0x45a32c['attributes']=_0x45a32c[_0x28c6('0x42')][_0x28c6('0x44')]?_0x45a32c['attributes']:_0x1e2a48['model'];if(!_0x59bb81['query'][_0x28c6('0x45')](_0x28c6('0x46'))){_0x45a32c['limit']=qs['limit'](_0x59bb81[_0x28c6('0x3f')][_0x28c6('0x2a')]);_0x45a32c[_0x28c6('0x28')]=qs[_0x28c6('0x28')](_0x59bb81['query']['offset']);}_0x45a32c[_0x28c6('0x47')]=qs['sort'](_0x59bb81[_0x28c6('0x3f')][_0x28c6('0x48')]);_0x45a32c[_0x28c6('0x49')]=qs['filters'](_['pick'](_0x59bb81[_0x28c6('0x3f')],_0x1e2a48[_0x28c6('0x40')]),_0x394452);if(_0x59bb81[_0x28c6('0x3f')][_0x28c6('0x4a')]){_0x45a32c['where']=_[_0x28c6('0x4b')](_0x45a32c[_0x28c6('0x49')],{'$or':_['map'](_0x394452,function(_0x569dd5){if(_0x569dd5[_0x28c6('0x3a')]!==_0x28c6('0x4c')){var _0x11d124={};_0x11d124[_0x569dd5['name']]={'$like':'%'+_0x59bb81[_0x28c6('0x3f')][_0x28c6('0x4a')]+'%'};return _0x11d124;}})});}_0x45a32c=_[_0x28c6('0x4b')]({},_0x45a32c,_0x59bb81[_0x28c6('0x4d')]);var _0x55bd88={'where':_0x45a32c[_0x28c6('0x49')]};return db[_0x28c6('0x38')]['count'](_0x55bd88)['then'](function(_0x2ddaf9){_0x178da2['count']=_0x2ddaf9;if(_0x59bb81[_0x28c6('0x3f')][_0x28c6('0x4e')]){_0x45a32c['include']=[{'all':!![]}];}return db[_0x28c6('0x38')][_0x28c6('0x4f')](_0x45a32c);})[_0x28c6('0x1c')](function(_0x444a78){_0x178da2[_0x28c6('0x50')]=_0x444a78;return _0x178da2;})[_0x28c6('0x1c')](respondWithFilteredResult(_0x237f52,_0x45a32c))[_0x28c6('0x51')](handleError(_0x237f52,null));};exports[_0x28c6('0x52')]=function(_0x1f2fc7,_0x234db8){var _0x40e76a={'raw':![],'where':{'id':_0x1f2fc7['params']['id']}},_0xd4574e={};_0xd4574e[_0x28c6('0x3c')]=_['keys'](db['VoiceContext'][_0x28c6('0x39')]);_0xd4574e[_0x28c6('0x3f')]=_[_0x28c6('0x3e')](_0x1f2fc7[_0x28c6('0x3f')]);_0xd4574e[_0x28c6('0x40')]=_[_0x28c6('0x41')](_0xd4574e['model'],_0xd4574e[_0x28c6('0x3f')]);_0x40e76a[_0x28c6('0x42')]=_[_0x28c6('0x41')](_0xd4574e[_0x28c6('0x3c')],qs['fields'](_0x1f2fc7[_0x28c6('0x3f')][_0x28c6('0x43')]));_0x40e76a['attributes']=_0x40e76a['attributes']['length']?_0x40e76a[_0x28c6('0x42')]:_0xd4574e[_0x28c6('0x3c')];if(_0x1f2fc7[_0x28c6('0x3f')][_0x28c6('0x4e')]){_0x40e76a['include']=[{'all':!![]}];}_0x40e76a=_[_0x28c6('0x4b')]({},_0x40e76a,_0x1f2fc7['options']);return db[_0x28c6('0x38')][_0x28c6('0x53')](_0x40e76a)[_0x28c6('0x1c')](handleEntityNotFound(_0x234db8,null))[_0x28c6('0x1c')](respondWithResult(_0x234db8,null))[_0x28c6('0x51')](handleError(_0x234db8,null));};exports['create']=function(_0x4fe09b,_0x22c9c6,_0x574ea5){var _0x21da0c;return db[_0x28c6('0x38')][_0x28c6('0x54')](_0x4fe09b[_0x28c6('0x55')],{'raw':!![]})['then'](function(_0x309155){_0x21da0c=_0x309155;return db[_0x28c6('0x38')][_0x28c6('0x4f')]({'raw':!![]});})[_0x28c6('0x1c')](function(_0x3fe06e){var _0x112c21=fs[_0x28c6('0x56')](path[_0x28c6('0x57')](config[_0x28c6('0x58')],_0x28c6('0x59')),_0x28c6('0x5a'));var _0x2e7943=ejs[_0x28c6('0x5b')](_0x112c21,{'contexts':_0x3fe06e||[]});fs[_0x28c6('0x5c')](_0x28c6('0x5d'),_0x2e7943);})[_0x28c6('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x28c6('0x5e')});})[_0x28c6('0x1c')](function(){var _0x5e8fa3=_0x4fe09b[_0x28c6('0x5f')]['get']({'plain':!![]});if(!_0x5e8fa3)throw new Error(_0x28c6('0x60'));if(_0x5e8fa3[_0x28c6('0x61')]===_0x28c6('0x5f')){var _0xb154df=_0x21da0c[_0x28c6('0x32')]({'plain':!![]});return db[_0x28c6('0x62')][_0x28c6('0x53')]({'where':{'name':_0x28c6('0x33'),'userProfileId':_0x5e8fa3[_0x28c6('0x63')]},'raw':!![]})['then'](function(_0x2611ee){if(_0x2611ee&&_0x2611ee['autoAssociation']===0x0){return db[_0x28c6('0x34')][_0x28c6('0x54')]({'name':_0xb154df[_0x28c6('0x36')],'resourceId':_0xb154df['id'],'type':_0x2611ee[_0x28c6('0x36')],'sectionId':_0x2611ee['id']},{})['then'](function(){return _0x21da0c;});}else{return _0x21da0c;}})['catch'](function(_0x5943e3){logger[_0x28c6('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5943e3);throw _0x5943e3;});}return _0x21da0c;})[_0x28c6('0x1c')](respondWithResult(_0x22c9c6,0xc9))['catch'](handleError(_0x22c9c6,null));};exports[_0x28c6('0x30')]=function(_0x56067c,_0x39d0c4,_0x575275){var _0x215bb0;return db[_0x28c6('0x38')][_0x28c6('0x53')]({'where':{'id':_0x56067c[_0x28c6('0x64')]['id']}})['then'](handleEntityNotFound(_0x39d0c4,null))['then'](saveUpdates(_0x56067c[_0x28c6('0x55')],null))['then'](function(_0x143a87){if(_0x143a87){_0x215bb0=_0x143a87;return db[_0x28c6('0x38')][_0x28c6('0x4f')]({'raw':!![]});}})[_0x28c6('0x1c')](function(_0x433459){var _0x7df511=fs['readFileSync'](path['join'](config[_0x28c6('0x58')],_0x28c6('0x59')),_0x28c6('0x5a'));var _0x505013=ejs[_0x28c6('0x5b')](_0x7df511,{'contexts':_0x433459||[]});fs[_0x28c6('0x5c')](_0x28c6('0x5d'),_0x505013);})[_0x28c6('0x1c')](function(){return respondWithRpcPromise(_0x28c6('0x65'),_0x28c6('0x30'),{'module':_0x28c6('0x5e')});})['then'](function(){return _0x215bb0;})[_0x28c6('0x1c')](respondWithResult(_0x39d0c4,null))[_0x28c6('0x51')](handleError(_0x39d0c4,null));};exports['destroy']=function(_0x5ea2a5,_0x15ebbc,_0x5712d2){var _0x24603f;return db[_0x28c6('0x38')][_0x28c6('0x53')]({'where':{'id':_0x5ea2a5[_0x28c6('0x64')]['id']}})[_0x28c6('0x1c')](handleEntityNotFound(_0x15ebbc,null))['then'](removeEntity(_0x15ebbc,null))[_0x28c6('0x1c')](function(){return db[_0x28c6('0x38')][_0x28c6('0x4f')]({'raw':!![]});})[_0x28c6('0x1c')](function(_0x51a145){var _0x512adb=fs['readFileSync'](path[_0x28c6('0x57')](config[_0x28c6('0x58')],_0x28c6('0x59')),'utf8');var _0x459bdc=ejs[_0x28c6('0x5b')](_0x512adb,{'contexts':_0x51a145});fs[_0x28c6('0x5c')](_0x28c6('0x5d'),_0x459bdc);return respondWithRpcPromise(_0x28c6('0x65'),'destroy',{'module':_0x28c6('0x5e')});})[_0x28c6('0x51')](handleError(_0x15ebbc,null));}; \ No newline at end of file +var _0x7719=['UserProfileSection','userProfileId','autoAssociation','params','readFileSync','root','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','Contexts','UserProfileResource','destroy','stack','name','send','index','map','VoiceContext','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','create','body','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7719,0x1cb));var _0x9771=function(_0x26da93,_0x2e4c55){_0x26da93=_0x26da93-0x0;var _0x2a6d5c=_0x7719[_0x26da93];return _0x2a6d5c;};'use strict';var emlformat=require(_0x9771('0x0'));var rimraf=require(_0x9771('0x1'));var zipdir=require(_0x9771('0x2'));var jsonpatch=require(_0x9771('0x3'));var rp=require(_0x9771('0x4'));var moment=require(_0x9771('0x5'));var BPromise=require(_0x9771('0x6'));var Mustache=require(_0x9771('0x7'));var util=require(_0x9771('0x8'));var path=require(_0x9771('0x9'));var sox=require(_0x9771('0xa'));var csv=require(_0x9771('0xb'));var ejs=require(_0x9771('0xc'));var fs=require('fs');var fs_extra=require(_0x9771('0xd'));var _=require(_0x9771('0xe'));var squel=require(_0x9771('0xf'));var crypto=require(_0x9771('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x9771('0x11'));var toCsv=require(_0x9771('0xb'));var querystring=require('querystring');var Papa=require(_0x9771('0x12'));var Redis=require('ioredis');var authService=require(_0x9771('0x13'));var qs=require(_0x9771('0x14'));var as=require(_0x9771('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9771('0x16'))(_0x9771('0x17'));var utils=require(_0x9771('0x18'));var config=require(_0x9771('0x19'));var licenseUtil=require(_0x9771('0x1a'));var db=require(_0x9771('0x1b'))['db'];var jayson=require(_0x9771('0x1c'));var client=jayson[_0x9771('0x1d')][_0x9771('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xf42743,_0x114bf0,_0x572b8d,_0x9159d1){return new BPromise(function(_0x423ddf,_0x1aa268){var _0x631018=_0x9159d1||client;return _0x631018[_0x9771('0x1f')](_0xf42743,_0x572b8d)[_0x9771('0x20')](function(_0x130909){logger[_0x9771('0x21')](_0x9771('0x22'),_0x114bf0,'request\x20sent');logger[_0x9771('0x23')](_0x9771('0x24'),_0x114bf0,_0x9771('0x25'),JSON[_0x9771('0x26')](_0x130909));if(_0x130909[_0x9771('0x27')]){if(_0x130909[_0x9771('0x27')][_0x9771('0x28')]===0x1f4){logger[_0x9771('0x27')](_0x9771('0x22'),_0x114bf0,_0x130909[_0x9771('0x27')][_0x9771('0x29')]);return _0x1aa268(_0x130909[_0x9771('0x27')][_0x9771('0x29')]);}logger[_0x9771('0x27')](_0x9771('0x22'),_0x114bf0,_0x130909[_0x9771('0x27')][_0x9771('0x29')]);return _0x423ddf(_0x130909[_0x9771('0x27')][_0x9771('0x29')]);}else{logger[_0x9771('0x21')]('VoiceContext,\x20%s,\x20%s',_0x114bf0,_0x9771('0x25'));_0x423ddf(_0x130909[_0x9771('0x2a')][_0x9771('0x29')]);}})[_0x9771('0x2b')](function(_0x3bc6cc){logger['error'](_0x9771('0x22'),_0x114bf0,_0x3bc6cc);_0x1aa268(_0x3bc6cc);});});}function respondWithStatusCode(_0x4921af,_0x65e56c){_0x65e56c=_0x65e56c||0xcc;return function(_0x340ea4){if(_0x340ea4){return _0x4921af[_0x9771('0x2c')](_0x65e56c);}return _0x4921af[_0x9771('0x2d')](_0x65e56c)[_0x9771('0x2e')]();};}function respondWithResult(_0xb8ffed,_0x5c7801){_0x5c7801=_0x5c7801||0xc8;return function(_0x580e89){if(_0x580e89){return _0xb8ffed[_0x9771('0x2d')](_0x5c7801)[_0x9771('0x2f')](_0x580e89);}};}function respondWithFilteredResult(_0x4de73d,_0x12eea2){return function(_0x441059){if(_0x441059){var _0x136f43=typeof _0x12eea2[_0x9771('0x30')]===_0x9771('0x31')&&typeof _0x12eea2[_0x9771('0x32')]===_0x9771('0x31');var _0x35c86e=_0x441059[_0x9771('0x33')];var _0x5e8472=_0x136f43?0x0:_0x12eea2[_0x9771('0x30')];var _0x5b56d6=_0x136f43?_0x441059[_0x9771('0x33')]:_0x12eea2[_0x9771('0x30')]+_0x12eea2[_0x9771('0x32')];var _0x59f198;if(_0x5b56d6>=_0x35c86e){_0x5b56d6=_0x35c86e;_0x59f198=0xc8;}else{_0x59f198=0xce;}_0x4de73d['status'](_0x59f198);return _0x4de73d[_0x9771('0x34')]('Content-Range',_0x5e8472+'-'+_0x5b56d6+'/'+_0x35c86e)['json'](_0x441059);}return null;};}function patchUpdates(_0x2890bf){return function(_0x5d2220){try{jsonpatch[_0x9771('0x35')](_0x5d2220,_0x2890bf,!![]);}catch(_0x487be1){return BPromise[_0x9771('0x36')](_0x487be1);}return _0x5d2220[_0x9771('0x37')]();};}function saveUpdates(_0x245a70,_0x32ea63){return function(_0x3dd5b9){if(_0x3dd5b9){return _0x3dd5b9[_0x9771('0x38')](_0x245a70)['then'](function(_0x53d6f1){return _0x53d6f1;});}return null;};}function removeEntity(_0x592a06,_0x43477b){return function(_0x5e172f){if(_0x5e172f){return _0x5e172f['destroy']()['then'](function(){var _0x3e2c6e=_0x5e172f['get']({'plain':!![]});var _0x23cad9=_0x9771('0x39');return db[_0x9771('0x3a')][_0x9771('0x3b')]({'where':{'type':_0x23cad9,'resourceId':_0x3e2c6e['id']}})[_0x9771('0x20')](function(){return _0x5e172f;});})[_0x9771('0x20')](function(){_0x592a06['status'](0xcc)[_0x9771('0x2e')]();});}};}function handleEntityNotFound(_0xf9939d,_0x7d7bb7){return function(_0x25e5f8){if(!_0x25e5f8){_0xf9939d['sendStatus'](0x194);}return _0x25e5f8;};}function handleError(_0x282ef4,_0x127584){_0x127584=_0x127584||0x1f4;return function(_0x3a205c){logger[_0x9771('0x27')](_0x3a205c[_0x9771('0x3c')]);if(_0x3a205c[_0x9771('0x3d')]){delete _0x3a205c[_0x9771('0x3d')];}_0x282ef4[_0x9771('0x2d')](_0x127584)[_0x9771('0x3e')](_0x3a205c);};}exports[_0x9771('0x3f')]=function(_0x71e9cb,_0x49bae7){var _0x4f9f9c={},_0x207363={},_0x2a7762={'count':0x0,'rows':[]};var _0x317d85=_[_0x9771('0x40')](db[_0x9771('0x41')]['rawAttributes'],function(_0x29909c){return{'name':_0x29909c['fieldName'],'type':_0x29909c[_0x9771('0x42')][_0x9771('0x43')]};});_0x207363[_0x9771('0x44')]=_[_0x9771('0x40')](_0x317d85,_0x9771('0x3d'));_0x207363[_0x9771('0x45')]=_[_0x9771('0x46')](_0x71e9cb[_0x9771('0x45')]);_0x207363[_0x9771('0x47')]=_[_0x9771('0x48')](_0x207363[_0x9771('0x44')],_0x207363[_0x9771('0x45')]);_0x4f9f9c[_0x9771('0x49')]=_[_0x9771('0x48')](_0x207363[_0x9771('0x44')],qs['fields'](_0x71e9cb[_0x9771('0x45')][_0x9771('0x4a')]));_0x4f9f9c['attributes']=_0x4f9f9c[_0x9771('0x49')][_0x9771('0x4b')]?_0x4f9f9c[_0x9771('0x49')]:_0x207363['model'];if(!_0x71e9cb[_0x9771('0x45')][_0x9771('0x4c')](_0x9771('0x4d'))){_0x4f9f9c[_0x9771('0x32')]=qs[_0x9771('0x32')](_0x71e9cb['query'][_0x9771('0x32')]);_0x4f9f9c[_0x9771('0x30')]=qs[_0x9771('0x30')](_0x71e9cb[_0x9771('0x45')]['offset']);}_0x4f9f9c[_0x9771('0x4e')]=qs[_0x9771('0x4f')](_0x71e9cb['query'][_0x9771('0x4f')]);_0x4f9f9c[_0x9771('0x50')]=qs['filters'](_[_0x9771('0x51')](_0x71e9cb['query'],_0x207363[_0x9771('0x47')]),_0x317d85);if(_0x71e9cb[_0x9771('0x45')][_0x9771('0x52')]){_0x4f9f9c[_0x9771('0x50')]=_[_0x9771('0x53')](_0x4f9f9c[_0x9771('0x50')],{'$or':_[_0x9771('0x40')](_0x317d85,function(_0xaecc4c){if(_0xaecc4c[_0x9771('0x42')]!==_0x9771('0x54')){var _0xd97386={};_0xd97386[_0xaecc4c[_0x9771('0x3d')]]={'$like':'%'+_0x71e9cb[_0x9771('0x45')][_0x9771('0x52')]+'%'};return _0xd97386;}})});}_0x4f9f9c=_[_0x9771('0x53')]({},_0x4f9f9c,_0x71e9cb[_0x9771('0x55')]);var _0x99280f={'where':_0x4f9f9c[_0x9771('0x50')]};return db[_0x9771('0x41')]['count'](_0x99280f)['then'](function(_0x55b2a1){_0x2a7762['count']=_0x55b2a1;if(_0x71e9cb['query'][_0x9771('0x56')]){_0x4f9f9c[_0x9771('0x57')]=[{'all':!![]}];}return db[_0x9771('0x41')]['findAll'](_0x4f9f9c);})[_0x9771('0x20')](function(_0x3522b6){_0x2a7762[_0x9771('0x58')]=_0x3522b6;return _0x2a7762;})[_0x9771('0x20')](respondWithFilteredResult(_0x49bae7,_0x4f9f9c))[_0x9771('0x2b')](handleError(_0x49bae7,null));};exports[_0x9771('0x59')]=function(_0x43c298,_0x5eb73d){var _0xfe9fbc={'raw':![],'where':{'id':_0x43c298['params']['id']}},_0x294831={};_0x294831[_0x9771('0x44')]=_[_0x9771('0x46')](db[_0x9771('0x41')][_0x9771('0x5a')]);_0x294831[_0x9771('0x45')]=_[_0x9771('0x46')](_0x43c298[_0x9771('0x45')]);_0x294831[_0x9771('0x47')]=_['intersection'](_0x294831[_0x9771('0x44')],_0x294831[_0x9771('0x45')]);_0xfe9fbc[_0x9771('0x49')]=_[_0x9771('0x48')](_0x294831[_0x9771('0x44')],qs[_0x9771('0x4a')](_0x43c298[_0x9771('0x45')]['fields']));_0xfe9fbc[_0x9771('0x49')]=_0xfe9fbc[_0x9771('0x49')]['length']?_0xfe9fbc[_0x9771('0x49')]:_0x294831['model'];if(_0x43c298['query']['includeAll']){_0xfe9fbc['include']=[{'all':!![]}];}_0xfe9fbc=_[_0x9771('0x53')]({},_0xfe9fbc,_0x43c298[_0x9771('0x55')]);return db[_0x9771('0x41')][_0x9771('0x5b')](_0xfe9fbc)['then'](handleEntityNotFound(_0x5eb73d,null))[_0x9771('0x20')](respondWithResult(_0x5eb73d,null))['catch'](handleError(_0x5eb73d,null));};exports[_0x9771('0x5c')]=function(_0x680c8d,_0x5f0159,_0x9da4a2){var _0x5769c7;return db[_0x9771('0x41')][_0x9771('0x5c')](_0x680c8d[_0x9771('0x5d')],{'raw':!![]})[_0x9771('0x20')](function(_0x4a35ba){_0x5769c7=_0x4a35ba;return db[_0x9771('0x41')]['findAll']({'raw':!![]});})[_0x9771('0x20')](function(_0x366e26){var _0x5ed266=fs['readFileSync'](path[_0x9771('0x5e')](config['root'],_0x9771('0x5f')),_0x9771('0x60'));var _0x488b36=ejs[_0x9771('0x61')](_0x5ed266,{'contexts':_0x366e26||[]});fs[_0x9771('0x62')](_0x9771('0x63'),_0x488b36);})[_0x9771('0x20')](function(){return respondWithRpcPromise(_0x9771('0x64'),'create',{'module':_0x9771('0x65')});})[_0x9771('0x20')](function(){var _0x196cf1=_0x680c8d[_0x9771('0x66')][_0x9771('0x67')]({'plain':!![]});if(!_0x196cf1)throw new Error(_0x9771('0x68'));if(_0x196cf1[_0x9771('0x69')]==='user'){var _0xac71f9=_0x5769c7[_0x9771('0x67')]({'plain':!![]});return db[_0x9771('0x6a')][_0x9771('0x5b')]({'where':{'name':_0x9771('0x39'),'userProfileId':_0x196cf1[_0x9771('0x6b')]},'raw':!![]})[_0x9771('0x20')](function(_0xc0151f){if(_0xc0151f&&_0xc0151f[_0x9771('0x6c')]===0x0){return db[_0x9771('0x3a')][_0x9771('0x5c')]({'name':_0xac71f9['name'],'resourceId':_0xac71f9['id'],'type':_0xc0151f[_0x9771('0x3d')],'sectionId':_0xc0151f['id']},{})[_0x9771('0x20')](function(){return _0x5769c7;});}else{return _0x5769c7;}})['catch'](function(_0x2edeb2){logger[_0x9771('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2edeb2);throw _0x2edeb2;});}return _0x5769c7;})[_0x9771('0x20')](respondWithResult(_0x5f0159,0xc9))[_0x9771('0x2b')](handleError(_0x5f0159,null));};exports[_0x9771('0x38')]=function(_0x4014b1,_0x3e6356,_0xd5eeae){var _0xde7b10;return db['VoiceContext'][_0x9771('0x5b')]({'where':{'id':_0x4014b1[_0x9771('0x6d')]['id']}})['then'](handleEntityNotFound(_0x3e6356,null))['then'](saveUpdates(_0x4014b1[_0x9771('0x5d')],null))['then'](function(_0x591504){if(_0x591504){_0xde7b10=_0x591504;return db[_0x9771('0x41')]['findAll']({'raw':!![]});}})[_0x9771('0x20')](function(_0x11bdc0){var _0x51154f=fs[_0x9771('0x6e')](path[_0x9771('0x5e')](config[_0x9771('0x6f')],_0x9771('0x5f')),'utf8');var _0x2ad7a3=ejs[_0x9771('0x61')](_0x51154f,{'contexts':_0x11bdc0||[]});fs[_0x9771('0x62')](_0x9771('0x63'),_0x2ad7a3);})['then'](function(){return respondWithRpcPromise(_0x9771('0x64'),_0x9771('0x38'),{'module':_0x9771('0x65')});})[_0x9771('0x20')](function(){return _0xde7b10;})[_0x9771('0x20')](respondWithResult(_0x3e6356,null))[_0x9771('0x2b')](handleError(_0x3e6356,null));};exports[_0x9771('0x3b')]=function(_0x369b79,_0x53a21f,_0x96cc3e){var _0x23822c;return db[_0x9771('0x41')]['find']({'where':{'id':_0x369b79['params']['id']}})[_0x9771('0x20')](handleEntityNotFound(_0x53a21f,null))[_0x9771('0x20')](removeEntity(_0x53a21f,null))['then'](function(){return db[_0x9771('0x41')][_0x9771('0x70')]({'raw':!![]});})['then'](function(_0x4a1e71){var _0x1a9f6c=fs[_0x9771('0x6e')](path['join'](config[_0x9771('0x6f')],_0x9771('0x5f')),_0x9771('0x60'));var _0x28554b=ejs['render'](_0x1a9f6c,{'contexts':_0x4a1e71});fs[_0x9771('0x62')](_0x9771('0x63'),_0x28554b);return respondWithRpcPromise('Reload','destroy',{'module':_0x9771('0x65')});})['catch'](handleError(_0x53a21f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9815de0..1d3930f 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 _0x2ccd=['lodash','../../config/logger','bluebird','request-promise','rimraf','exports','VoiceContext','voice_contexts'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2ccd,0x148));var _0xd2cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd2cc('0x0'));var util=require('util');var logger=require(_0xd2cc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd2cc('0x2'));var rp=require(_0xd2cc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2cc('0x4'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xd2cc('0x5')]=function(_0x29c8ff,_0x52fec2){return _0x29c8ff['define'](_0xd2cc('0x6'),attributes,{'tableName':_0xd2cc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe924=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash'];(function(_0x3f0ce8,_0x572a37){var _0x317892=function(_0x1b5582){while(--_0x1b5582){_0x3f0ce8['push'](_0x3f0ce8['shift']());}};_0x317892(++_0x572a37);}(_0xe924,0x141));var _0x4e92=function(_0xce3e98,_0x5698b6){_0xce3e98=_0xce3e98-0x0;var _0xf14e29=_0xe924[_0xce3e98];return _0xf14e29;};'use strict';var _=require(_0x4e92('0x0'));var util=require(_0x4e92('0x1'));var logger=require(_0x4e92('0x2'))(_0x4e92('0x3'));var moment=require(_0x4e92('0x4'));var BPromise=require(_0x4e92('0x5'));var rp=require(_0x4e92('0x6'));var fs=require('fs');var path=require(_0x4e92('0x7'));var rimraf=require(_0x4e92('0x8'));var config=require(_0x4e92('0x9'));var attributes=require(_0x4e92('0xa'));module['exports']=function(_0x401987,_0x5ebf4b){return _0x401987[_0x4e92('0xb')](_0x4e92('0xc'),attributes,{'tableName':_0x4e92('0xd'),'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 37486b1..4878374 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 _0x9ccd=['catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5cb441,_0x1dbe7a){var _0x33d36e=function(_0x4a81c3){while(--_0x4a81c3){_0x5cb441['push'](_0x5cb441['shift']());}};_0x33d36e(++_0x1dbe7a);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var moment=require(_0xd9cc('0x1'));var BPromise=require(_0xd9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x4'))(_0xd9cc('0x5'));var config=require(_0xd9cc('0x6'));var jayson=require(_0xd9cc('0x7'));var client=jayson[_0xd9cc('0x8')][_0xd9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7b2b,_0x23b70a,_0x9e1e10){return new BPromise(function(_0x1a1bd1,_0x20282c){return client[_0xd9cc('0xa')](_0x1f7b2b,_0x9e1e10)[_0xd9cc('0xb')](function(_0x1737e5){logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,'request\x20sent');logger[_0xd9cc('0xe')](_0xd9cc('0xf'),_0x23b70a,_0xd9cc('0x10'),JSON[_0xd9cc('0x11')](_0x1737e5));if(_0x1737e5[_0xd9cc('0x12')]){if(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x13')]===0x1f4){logger[_0xd9cc('0x12')]('VoiceContext,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')]['message']);return _0x20282c(_0x1737e5['error']['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);return _0x1a1bd1(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);}else{logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,_0xd9cc('0x10'));_0x1a1bd1(_0x1737e5['result'][_0xd9cc('0x14')]);}})[_0xd9cc('0x15')](function(_0x513635){logger[_0xd9cc('0x12')](_0xd9cc('0xd'),_0x23b70a,_0x513635);_0x20282c(_0x513635);});});} \ No newline at end of file +var _0xbd99=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd99,0x1df));var _0x9bd9=function(_0x5237f0,_0xf27dd4){_0x5237f0=_0x5237f0-0x0;var _0x20a089=_0xbd99[_0x5237f0];return _0x20a089;};'use strict';var _=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var moment=require('moment');var BPromise=require(_0x9bd9('0x2'));var rs=require(_0x9bd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bd9('0x4'))['db'];var utils=require(_0x9bd9('0x5'));var logger=require(_0x9bd9('0x6'))(_0x9bd9('0x7'));var config=require(_0x9bd9('0x8'));var jayson=require(_0x9bd9('0x9'));var client=jayson[_0x9bd9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b41ea,_0x241303,_0x28b83f){return new BPromise(function(_0x7ddd62,_0x441225){return client[_0x9bd9('0xb')](_0x3b41ea,_0x28b83f)['then'](function(_0x865dc1){logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));logger[_0x9bd9('0xe')](_0x9bd9('0xf'),_0x241303,_0x9bd9('0xd'),JSON[_0x9bd9('0x10')](_0x865dc1));if(_0x865dc1[_0x9bd9('0x11')]){if(_0x865dc1['error'][_0x9bd9('0x12')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x441225(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}logger[_0x9bd9('0x11')]('VoiceContext,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x7ddd62(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}else{logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));_0x7ddd62(_0x865dc1[_0x9bd9('0x14')][_0x9bd9('0x13')]);}})['catch'](function(_0x57ffcb){logger[_0x9bd9('0x11')](_0x9bd9('0xc'),_0x241303,_0x57ffcb);_0x441225(_0x57ffcb);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 2bc9908..ec4d99a 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 _0x6900=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','describe','/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2da70d,_0x41d664){var _0x5abc01=function(_0x145831){while(--_0x145831){_0x2da70d['push'](_0x2da70d['shift']());}};_0x5abc01(++_0x41d664);}(_0x6900,0x189));var _0x0690=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x6900[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0x0690('0x0'));var util=require(_0x0690('0x1'));var path=require(_0x0690('0x2'));var timeout=require(_0x0690('0x3'));var express=require('express');var router=express[_0x0690('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0690('0x5'));var interaction=require(_0x0690('0x6'));var config=require(_0x0690('0x7'));var controller=require(_0x0690('0x8'));router[_0x0690('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0690('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0690('0xa')]);router[_0x0690('0x9')](_0x0690('0xb'),auth[_0x0690('0xc')](),controller[_0x0690('0xd')]);router[_0x0690('0xe')]('/',auth[_0x0690('0xc')](),controller[_0x0690('0xf')]);router['put'](_0x0690('0xb'),auth[_0x0690('0xc')](),controller[_0x0690('0x10')]);router[_0x0690('0x11')](_0x0690('0xb'),auth[_0x0690('0xc')](),controller[_0x0690('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc540=['index','/describe','describe','/:id','show','post','create','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x128938,_0xed57a3){var _0x1f3b7c=function(_0x4e5de3){while(--_0x4e5de3){_0x128938['push'](_0x128938['shift']());}};_0x1f3b7c(++_0xed57a3);}(_0xc540,0x184));var _0x0c54=function(_0x5beda0,_0x5aea2a){_0x5beda0=_0x5beda0-0x0;var _0x5b6941=_0xc540[_0x5beda0];return _0x5b6941;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0c54('0x0'));var express=require('express');var router=express[_0x0c54('0x1')]();var fs_extra=require(_0x0c54('0x2'));var auth=require(_0x0c54('0x3'));var interaction=require(_0x0c54('0x4'));var config=require(_0x0c54('0x5'));var controller=require('./voiceDialReport.controller');router[_0x0c54('0x6')]('/',auth[_0x0c54('0x7')](),controller[_0x0c54('0x8')]);router[_0x0c54('0x6')](_0x0c54('0x9'),auth[_0x0c54('0x7')](),controller[_0x0c54('0xa')]);router[_0x0c54('0x6')](_0x0c54('0xb'),auth[_0x0c54('0x7')](),controller[_0x0c54('0xc')]);router[_0x0c54('0xd')]('/',auth['isAuthenticated'](),controller[_0x0c54('0xe')]);router['put'](_0x0c54('0xb'),auth[_0x0c54('0x7')](),controller[_0x0c54('0xf')]);router['delete']('/:id',auth[_0x0c54('0x7')](),controller[_0x0c54('0x10')]);module[_0x0c54('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 419411e..fcf3452 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 _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x4bc05e,_0x47fb48){var _0x5065de=function(_0x1439b5){while(--_0x1439b5){_0x4bc05e['push'](_0x4bc05e['shift']());}};_0x5065de(++_0x47fb48);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x47199b,_0x16e824){var _0x390911=function(_0x2f874d){while(--_0x2f874d){_0x47199b['push'](_0x47199b['shift']());}};_0x390911(++_0x16e824);}(_0x81bd,0x7c));var _0xd81b=function(_0x25e65e,_0x2039aa){_0x25e65e=_0x25e65e-0x0;var _0x5c69a6=_0x81bd[_0x25e65e];return _0x5c69a6;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f197dc4..1bcb620 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 _0x7fbd=['fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','count','include','rows','catch','params','includeAll','merge','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','to-csv','ejs'];(function(_0x29f0da,_0xf8e78a){var _0x4a76f5=function(_0x473202){while(--_0x473202){_0x29f0da['push'](_0x29f0da['shift']());}};_0x4a76f5(++_0xf8e78a);}(_0x7fbd,0xdc));var _0xd7fb=function(_0xe2a1aa,_0x525d7b){_0xe2a1aa=_0xe2a1aa-0x0;var _0x5a8362=_0x7fbd[_0xe2a1aa];return _0x5a8362;};'use strict';var emlformat=require(_0xd7fb('0x0'));var rimraf=require(_0xd7fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7fb('0x2'));var rp=require(_0xd7fb('0x3'));var moment=require('moment');var BPromise=require(_0xd7fb('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd7fb('0x5'));var sox=require('sox');var csv=require(_0xd7fb('0x6'));var ejs=require(_0xd7fb('0x7'));var fs=require('fs');var fs_extra=require(_0xd7fb('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd7fb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd7fb('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd7fb('0xb'));var Papa=require(_0xd7fb('0xc'));var Redis=require(_0xd7fb('0xd'));var authService=require(_0xd7fb('0xe'));var qs=require(_0xd7fb('0xf'));var as=require(_0xd7fb('0x10'));var hardwareService=require(_0xd7fb('0x11'));var logger=require(_0xd7fb('0x12'))(_0xd7fb('0x13'));var utils=require(_0xd7fb('0x14'));var config=require(_0xd7fb('0x15'));var licenseUtil=require(_0xd7fb('0x16'));var db=require(_0xd7fb('0x17'))['db'];function respondWithStatusCode(_0x32075f,_0x20ae75){_0x20ae75=_0x20ae75||0xcc;return function(_0x4029d9){if(_0x4029d9){return _0x32075f['sendStatus'](_0x20ae75);}return _0x32075f[_0xd7fb('0x18')](_0x20ae75)[_0xd7fb('0x19')]();};}function respondWithResult(_0x2b5013,_0x42d865){_0x42d865=_0x42d865||0xc8;return function(_0x2924b5){if(_0x2924b5){return _0x2b5013['status'](_0x42d865)[_0xd7fb('0x1a')](_0x2924b5);}};}function respondWithFilteredResult(_0x55c7bc,_0x35fa20){return function(_0x27a0dd){if(_0x27a0dd){var _0x2684bd=typeof _0x35fa20['offset']===_0xd7fb('0x1b')&&typeof _0x35fa20[_0xd7fb('0x1c')]===_0xd7fb('0x1b');var _0x559a08=_0x27a0dd['count'];var _0x531165=_0x2684bd?0x0:_0x35fa20[_0xd7fb('0x1d')];var _0x40ec6f=_0x2684bd?_0x27a0dd['count']:_0x35fa20['offset']+_0x35fa20[_0xd7fb('0x1c')];var _0x4ceb4a;if(_0x40ec6f>=_0x559a08){_0x40ec6f=_0x559a08;_0x4ceb4a=0xc8;}else{_0x4ceb4a=0xce;}_0x55c7bc[_0xd7fb('0x18')](_0x4ceb4a);return _0x55c7bc[_0xd7fb('0x1e')](_0xd7fb('0x1f'),_0x531165+'-'+_0x40ec6f+'/'+_0x559a08)['json'](_0x27a0dd);}return null;};}function patchUpdates(_0x3136a4){return function(_0x5b230e){try{jsonpatch[_0xd7fb('0x20')](_0x5b230e,_0x3136a4,!![]);}catch(_0x2e2afb){return BPromise[_0xd7fb('0x21')](_0x2e2afb);}return _0x5b230e[_0xd7fb('0x22')]();};}function saveUpdates(_0x32ddc7,_0x5194c8){return function(_0x3e2c37){if(_0x3e2c37){return _0x3e2c37[_0xd7fb('0x23')](_0x32ddc7)[_0xd7fb('0x24')](function(_0x45d262){return _0x45d262;});}return null;};}function removeEntity(_0x304c6f,_0x243575){return function(_0x1429e1){if(_0x1429e1){return _0x1429e1['destroy']()[_0xd7fb('0x24')](function(){_0x304c6f[_0xd7fb('0x18')](0xcc)[_0xd7fb('0x19')]();});}};}function handleEntityNotFound(_0x4d3da9,_0x24d18f){return function(_0x47c0e7){if(!_0x47c0e7){_0x4d3da9[_0xd7fb('0x25')](0x194);}return _0x47c0e7;};}function handleError(_0x476f0e,_0xfa2b43){_0xfa2b43=_0xfa2b43||0x1f4;return function(_0x39ec76){logger[_0xd7fb('0x26')](_0x39ec76[_0xd7fb('0x27')]);if(_0x39ec76[_0xd7fb('0x28')]){delete _0x39ec76[_0xd7fb('0x28')];}_0x476f0e[_0xd7fb('0x18')](_0xfa2b43)[_0xd7fb('0x29')](_0x39ec76);};}exports['index']=function(_0x15a432,_0x43b9ec){var _0x7668ad={},_0x223d85={},_0x1dccf0={'count':0x0,'rows':[]};var _0x40ad21=_['map'](db[_0xd7fb('0x2a')][_0xd7fb('0x2b')],function(_0xa931b5){return{'name':_0xa931b5[_0xd7fb('0x2c')],'type':_0xa931b5[_0xd7fb('0x2d')][_0xd7fb('0x2e')]};});_0x223d85[_0xd7fb('0x2f')]=_[_0xd7fb('0x30')](_0x40ad21,_0xd7fb('0x28'));_0x223d85[_0xd7fb('0x31')]=_[_0xd7fb('0x32')](_0x15a432[_0xd7fb('0x31')]);_0x223d85[_0xd7fb('0x33')]=_[_0xd7fb('0x34')](_0x223d85[_0xd7fb('0x2f')],_0x223d85['query']);_0x7668ad[_0xd7fb('0x35')]=_['intersection'](_0x223d85[_0xd7fb('0x2f')],qs[_0xd7fb('0x36')](_0x15a432[_0xd7fb('0x31')][_0xd7fb('0x36')]));_0x7668ad['attributes']=_0x7668ad['attributes'][_0xd7fb('0x37')]?_0x7668ad[_0xd7fb('0x35')]:_0x223d85[_0xd7fb('0x2f')];if(!_0x15a432[_0xd7fb('0x31')][_0xd7fb('0x38')](_0xd7fb('0x39'))){_0x7668ad[_0xd7fb('0x1c')]=qs['limit'](_0x15a432[_0xd7fb('0x31')][_0xd7fb('0x1c')]);_0x7668ad[_0xd7fb('0x1d')]=qs[_0xd7fb('0x1d')](_0x15a432[_0xd7fb('0x31')][_0xd7fb('0x1d')]);}_0x7668ad['order']=qs[_0xd7fb('0x3a')](_0x15a432[_0xd7fb('0x31')]['sort']);_0x7668ad['where']=qs[_0xd7fb('0x33')](_[_0xd7fb('0x3b')](_0x15a432[_0xd7fb('0x31')],_0x223d85['filters']),_0x40ad21);if(_0x15a432[_0xd7fb('0x31')][_0xd7fb('0x3c')]){_0x7668ad[_0xd7fb('0x3d')]=_['merge'](_0x7668ad['where'],{'$or':_[_0xd7fb('0x30')](_0x40ad21,function(_0x4d0e4d){if(_0x4d0e4d[_0xd7fb('0x2d')]!==_0xd7fb('0x3e')){var _0x3fa0be={};_0x3fa0be[_0x4d0e4d[_0xd7fb('0x28')]]={'$like':'%'+_0x15a432[_0xd7fb('0x31')]['filter']+'%'};return _0x3fa0be;}})});}_0x7668ad=_['merge']({},_0x7668ad,_0x15a432[_0xd7fb('0x3f')]);var _0x5cd682={'where':_0x7668ad['where']};return db[_0xd7fb('0x2a')][_0xd7fb('0x40')](_0x5cd682)[_0xd7fb('0x24')](function(_0x1b27d9){_0x1dccf0['count']=_0x1b27d9;if(_0x15a432['query']['includeAll']){_0x7668ad[_0xd7fb('0x41')]=[{'all':!![]}];}return db[_0xd7fb('0x2a')]['findAll'](_0x7668ad);})[_0xd7fb('0x24')](function(_0x3519e9){_0x1dccf0[_0xd7fb('0x42')]=_0x3519e9;return _0x1dccf0;})['then'](respondWithFilteredResult(_0x43b9ec,_0x7668ad))[_0xd7fb('0x43')](handleError(_0x43b9ec,null));};exports['show']=function(_0x2423d1,_0x5651c1){var _0x50246d={'raw':!![],'where':{'id':_0x2423d1[_0xd7fb('0x44')]['id']}},_0x1b5f08={};_0x1b5f08[_0xd7fb('0x2f')]=_[_0xd7fb('0x32')](db['VoiceDialReport']['rawAttributes']);_0x1b5f08[_0xd7fb('0x31')]=_[_0xd7fb('0x32')](_0x2423d1['query']);_0x1b5f08[_0xd7fb('0x33')]=_[_0xd7fb('0x34')](_0x1b5f08['model'],_0x1b5f08[_0xd7fb('0x31')]);_0x50246d[_0xd7fb('0x35')]=_[_0xd7fb('0x34')](_0x1b5f08[_0xd7fb('0x2f')],qs['fields'](_0x2423d1[_0xd7fb('0x31')][_0xd7fb('0x36')]));_0x50246d[_0xd7fb('0x35')]=_0x50246d['attributes'][_0xd7fb('0x37')]?_0x50246d[_0xd7fb('0x35')]:_0x1b5f08[_0xd7fb('0x2f')];if(_0x2423d1[_0xd7fb('0x31')][_0xd7fb('0x45')]){_0x50246d[_0xd7fb('0x41')]=[{'all':!![]}];}_0x50246d=_[_0xd7fb('0x46')]({},_0x50246d,_0x2423d1[_0xd7fb('0x3f')]);return db[_0xd7fb('0x2a')]['find'](_0x50246d)[_0xd7fb('0x24')](handleEntityNotFound(_0x5651c1,null))[_0xd7fb('0x24')](respondWithResult(_0x5651c1,null))[_0xd7fb('0x43')](handleError(_0x5651c1,null));};exports[_0xd7fb('0x47')]=function(_0x203fe5,_0x554775){return db[_0xd7fb('0x2a')][_0xd7fb('0x47')](_0x203fe5[_0xd7fb('0x48')],{})['then'](respondWithResult(_0x554775,0xc9))['catch'](handleError(_0x554775,null));};exports['update']=function(_0x4d3a77,_0x2c0e93){if(_0x4d3a77[_0xd7fb('0x48')]['id']){delete _0x4d3a77['body']['id'];}return db[_0xd7fb('0x2a')][_0xd7fb('0x49')]({'where':{'id':_0x4d3a77['params']['id']}})[_0xd7fb('0x24')](handleEntityNotFound(_0x2c0e93,null))[_0xd7fb('0x24')](saveUpdates(_0x4d3a77['body'],null))[_0xd7fb('0x24')](respondWithResult(_0x2c0e93,null))[_0xd7fb('0x43')](handleError(_0x2c0e93,null));};exports[_0xd7fb('0x4a')]=function(_0x1f0f53,_0x11b93f){return db['VoiceDialReport'][_0xd7fb('0x49')]({'where':{'id':_0x1f0f53[_0xd7fb('0x44')]['id']}})[_0xd7fb('0x24')](handleEntityNotFound(_0x11b93f,null))[_0xd7fb('0x24')](removeEntity(_0x11b93f,null))[_0xd7fb('0x43')](handleError(_0x11b93f,null));};exports['describe']=function(_0x46a7ec,_0x1d37ce){return db[_0xd7fb('0x2a')][_0xd7fb('0x4b')]()[_0xd7fb('0x24')](respondWithResult(_0x1d37ce,null))['catch'](handleError(_0x1d37ce,null));}; \ No newline at end of file +var _0x3e03=['../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','then','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x541866,_0x2499d3){var _0x4761f0=function(_0x333433){while(--_0x333433){_0x541866['push'](_0x541866['shift']());}};_0x4761f0(++_0x2499d3);}(_0x3e03,0x1a7));var _0x33e0=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x3e03[_0x5a2d3f];return _0x5c65d8;};'use strict';var emlformat=require(_0x33e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33e0('0x1'));var jsonpatch=require(_0x33e0('0x2'));var rp=require(_0x33e0('0x3'));var moment=require(_0x33e0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x33e0('0x5'));var sox=require(_0x33e0('0x6'));var csv=require(_0x33e0('0x7'));var ejs=require(_0x33e0('0x8'));var fs=require('fs');var fs_extra=require(_0x33e0('0x9'));var _=require('lodash');var squel=require(_0x33e0('0xa'));var crypto=require(_0x33e0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x33e0('0xc'));var toCsv=require(_0x33e0('0x7'));var querystring=require(_0x33e0('0xd'));var Papa=require(_0x33e0('0xe'));var Redis=require(_0x33e0('0xf'));var authService=require(_0x33e0('0x10'));var qs=require(_0x33e0('0x11'));var as=require(_0x33e0('0x12'));var hardwareService=require(_0x33e0('0x13'));var logger=require('../../config/logger')(_0x33e0('0x14'));var utils=require('../../config/utils');var config=require(_0x33e0('0x15'));var licenseUtil=require(_0x33e0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3880d2,_0x457411){_0x457411=_0x457411||0xcc;return function(_0x2b08ca){if(_0x2b08ca){return _0x3880d2['sendStatus'](_0x457411);}return _0x3880d2[_0x33e0('0x17')](_0x457411)[_0x33e0('0x18')]();};}function respondWithResult(_0x419434,_0x344a3a){_0x344a3a=_0x344a3a||0xc8;return function(_0x597315){if(_0x597315){return _0x419434[_0x33e0('0x17')](_0x344a3a)['json'](_0x597315);}};}function respondWithFilteredResult(_0xb237a4,_0x11e5cc){return function(_0xde623a){if(_0xde623a){var _0x4605b3=typeof _0x11e5cc['offset']===_0x33e0('0x19')&&typeof _0x11e5cc[_0x33e0('0x1a')]==='undefined';var _0x5ce127=_0xde623a[_0x33e0('0x1b')];var _0x18af0c=_0x4605b3?0x0:_0x11e5cc[_0x33e0('0x1c')];var _0x2c1eb5=_0x4605b3?_0xde623a['count']:_0x11e5cc[_0x33e0('0x1c')]+_0x11e5cc[_0x33e0('0x1a')];var _0x4a848d;if(_0x2c1eb5>=_0x5ce127){_0x2c1eb5=_0x5ce127;_0x4a848d=0xc8;}else{_0x4a848d=0xce;}_0xb237a4['status'](_0x4a848d);return _0xb237a4['set'](_0x33e0('0x1d'),_0x18af0c+'-'+_0x2c1eb5+'/'+_0x5ce127)[_0x33e0('0x1e')](_0xde623a);}return null;};}function patchUpdates(_0x3da4bc){return function(_0x504d77){try{jsonpatch[_0x33e0('0x1f')](_0x504d77,_0x3da4bc,!![]);}catch(_0x3ec6ae){return BPromise['reject'](_0x3ec6ae);}return _0x504d77[_0x33e0('0x20')]();};}function saveUpdates(_0x520c39,_0x3db0bf){return function(_0x24a9fb){if(_0x24a9fb){return _0x24a9fb['update'](_0x520c39)[_0x33e0('0x21')](function(_0x36c02d){return _0x36c02d;});}return null;};}function removeEntity(_0x4ca4af,_0x11e4b9){return function(_0x549e1b){if(_0x549e1b){return _0x549e1b['destroy']()[_0x33e0('0x21')](function(){_0x4ca4af['status'](0xcc)[_0x33e0('0x18')]();});}};}function handleEntityNotFound(_0x1e3a29,_0x2a8b9b){return function(_0x44bb4a){if(!_0x44bb4a){_0x1e3a29[_0x33e0('0x22')](0x194);}return _0x44bb4a;};}function handleError(_0x44ab6d,_0x4a0df1){_0x4a0df1=_0x4a0df1||0x1f4;return function(_0x3748e9){logger['error'](_0x3748e9[_0x33e0('0x23')]);if(_0x3748e9['name']){delete _0x3748e9['name'];}_0x44ab6d[_0x33e0('0x17')](_0x4a0df1)[_0x33e0('0x24')](_0x3748e9);};}exports[_0x33e0('0x25')]=function(_0x4ee7d2,_0x42ee34){var _0x525973={},_0x5635b4={},_0x2151bc={'count':0x0,'rows':[]};var _0xa182d3=_[_0x33e0('0x26')](db['VoiceDialReport'][_0x33e0('0x27')],function(_0x3a4775){return{'name':_0x3a4775[_0x33e0('0x28')],'type':_0x3a4775[_0x33e0('0x29')]['key']};});_0x5635b4[_0x33e0('0x2a')]=_[_0x33e0('0x26')](_0xa182d3,_0x33e0('0x2b'));_0x5635b4['query']=_[_0x33e0('0x2c')](_0x4ee7d2[_0x33e0('0x2d')]);_0x5635b4[_0x33e0('0x2e')]=_[_0x33e0('0x2f')](_0x5635b4[_0x33e0('0x2a')],_0x5635b4[_0x33e0('0x2d')]);_0x525973[_0x33e0('0x30')]=_[_0x33e0('0x2f')](_0x5635b4['model'],qs[_0x33e0('0x31')](_0x4ee7d2[_0x33e0('0x2d')][_0x33e0('0x31')]));_0x525973[_0x33e0('0x30')]=_0x525973[_0x33e0('0x30')][_0x33e0('0x32')]?_0x525973[_0x33e0('0x30')]:_0x5635b4[_0x33e0('0x2a')];if(!_0x4ee7d2[_0x33e0('0x2d')][_0x33e0('0x33')](_0x33e0('0x34'))){_0x525973[_0x33e0('0x1a')]=qs['limit'](_0x4ee7d2['query']['limit']);_0x525973[_0x33e0('0x1c')]=qs[_0x33e0('0x1c')](_0x4ee7d2[_0x33e0('0x2d')][_0x33e0('0x1c')]);}_0x525973[_0x33e0('0x35')]=qs[_0x33e0('0x36')](_0x4ee7d2[_0x33e0('0x2d')][_0x33e0('0x36')]);_0x525973['where']=qs[_0x33e0('0x2e')](_[_0x33e0('0x37')](_0x4ee7d2['query'],_0x5635b4['filters']),_0xa182d3);if(_0x4ee7d2[_0x33e0('0x2d')][_0x33e0('0x38')]){_0x525973[_0x33e0('0x39')]=_[_0x33e0('0x3a')](_0x525973[_0x33e0('0x39')],{'$or':_[_0x33e0('0x26')](_0xa182d3,function(_0x559eb5){if(_0x559eb5[_0x33e0('0x29')]!==_0x33e0('0x3b')){var _0x3fadeb={};_0x3fadeb[_0x559eb5[_0x33e0('0x2b')]]={'$like':'%'+_0x4ee7d2[_0x33e0('0x2d')]['filter']+'%'};return _0x3fadeb;}})});}_0x525973=_['merge']({},_0x525973,_0x4ee7d2[_0x33e0('0x3c')]);var _0x4827fa={'where':_0x525973[_0x33e0('0x39')]};return db[_0x33e0('0x3d')][_0x33e0('0x1b')](_0x4827fa)[_0x33e0('0x21')](function(_0x56c2f5){_0x2151bc['count']=_0x56c2f5;if(_0x4ee7d2['query'][_0x33e0('0x3e')]){_0x525973[_0x33e0('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x33e0('0x40')](_0x525973);})[_0x33e0('0x21')](function(_0x2f5ab8){_0x2151bc[_0x33e0('0x41')]=_0x2f5ab8;return _0x2151bc;})[_0x33e0('0x21')](respondWithFilteredResult(_0x42ee34,_0x525973))[_0x33e0('0x42')](handleError(_0x42ee34,null));};exports['show']=function(_0x311a14,_0x1e723f){var _0x476098={'raw':!![],'where':{'id':_0x311a14[_0x33e0('0x43')]['id']}},_0x3ec786={};_0x3ec786[_0x33e0('0x2a')]=_['keys'](db['VoiceDialReport'][_0x33e0('0x27')]);_0x3ec786[_0x33e0('0x2d')]=_[_0x33e0('0x2c')](_0x311a14[_0x33e0('0x2d')]);_0x3ec786[_0x33e0('0x2e')]=_[_0x33e0('0x2f')](_0x3ec786['model'],_0x3ec786[_0x33e0('0x2d')]);_0x476098['attributes']=_[_0x33e0('0x2f')](_0x3ec786['model'],qs[_0x33e0('0x31')](_0x311a14[_0x33e0('0x2d')][_0x33e0('0x31')]));_0x476098[_0x33e0('0x30')]=_0x476098['attributes'][_0x33e0('0x32')]?_0x476098['attributes']:_0x3ec786[_0x33e0('0x2a')];if(_0x311a14[_0x33e0('0x2d')][_0x33e0('0x3e')]){_0x476098[_0x33e0('0x3f')]=[{'all':!![]}];}_0x476098=_['merge']({},_0x476098,_0x311a14[_0x33e0('0x3c')]);return db[_0x33e0('0x3d')][_0x33e0('0x44')](_0x476098)[_0x33e0('0x21')](handleEntityNotFound(_0x1e723f,null))[_0x33e0('0x21')](respondWithResult(_0x1e723f,null))['catch'](handleError(_0x1e723f,null));};exports[_0x33e0('0x45')]=function(_0x21eba1,_0x22cdc7){return db['VoiceDialReport'][_0x33e0('0x45')](_0x21eba1['body'],{})[_0x33e0('0x21')](respondWithResult(_0x22cdc7,0xc9))[_0x33e0('0x42')](handleError(_0x22cdc7,null));};exports[_0x33e0('0x46')]=function(_0x4d05ef,_0x420efd){if(_0x4d05ef[_0x33e0('0x47')]['id']){delete _0x4d05ef[_0x33e0('0x47')]['id'];}return db[_0x33e0('0x3d')]['find']({'where':{'id':_0x4d05ef[_0x33e0('0x43')]['id']}})[_0x33e0('0x21')](handleEntityNotFound(_0x420efd,null))[_0x33e0('0x21')](saveUpdates(_0x4d05ef[_0x33e0('0x47')],null))[_0x33e0('0x21')](respondWithResult(_0x420efd,null))[_0x33e0('0x42')](handleError(_0x420efd,null));};exports[_0x33e0('0x48')]=function(_0x5e5fe5,_0xe9d40b){return db['VoiceDialReport'][_0x33e0('0x44')]({'where':{'id':_0x5e5fe5[_0x33e0('0x43')]['id']}})[_0x33e0('0x21')](handleEntityNotFound(_0xe9d40b,null))[_0x33e0('0x21')](removeEntity(_0xe9d40b,null))[_0x33e0('0x42')](handleError(_0xe9d40b,null));};exports[_0x33e0('0x49')]=function(_0x43344c,_0x1e35a9){return db['VoiceDialReport'][_0x33e0('0x49')]()[_0x33e0('0x21')](respondWithResult(_0x1e35a9,null))[_0x33e0('0x42')](handleError(_0x1e35a9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5bbf444..ab45886 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 _0x0f09=['report_dial','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','VoiceDialReport'];(function(_0x518538,_0x1e52e6){var _0x2629be=function(_0x2a88a4){while(--_0x2a88a4){_0x518538['push'](_0x518538['shift']());}};_0x2629be(++_0x1e52e6);}(_0x0f09,0x1a5));var _0x90f0=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0f09[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x90f0('0x0'));var logger=require(_0x90f0('0x1'))(_0x90f0('0x2'));var moment=require(_0x90f0('0x3'));var BPromise=require(_0x90f0('0x4'));var rp=require(_0x90f0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x90f0('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x32a8c2,_0x58878c){return _0x32a8c2[_0x90f0('0x7')](_0x90f0('0x8'),attributes,{'tableName':_0x90f0('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x49da=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5e92d4,_0x577e31){var _0x3f3ddf=function(_0x1079d9){while(--_0x1079d9){_0x5e92d4['push'](_0x5e92d4['shift']());}};_0x3f3ddf(++_0x577e31);}(_0x49da,0x1c1));var _0xa49d=function(_0x2f619d,_0x340ec7){_0x2f619d=_0x2f619d-0x0;var _0xea1a26=_0x49da[_0x2f619d];return _0xea1a26;};'use strict';var _=require('lodash');var util=require(_0xa49d('0x0'));var logger=require(_0xa49d('0x1'))(_0xa49d('0x2'));var moment=require('moment');var BPromise=require(_0xa49d('0x3'));var rp=require(_0xa49d('0x4'));var fs=require('fs');var path=require(_0xa49d('0x5'));var rimraf=require(_0xa49d('0x6'));var config=require(_0xa49d('0x7'));var attributes=require(_0xa49d('0x8'));module[_0xa49d('0x9')]=function(_0x33ec48,_0x46d93e){return _0x33ec48[_0xa49d('0xa')](_0xa49d('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xa49d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index be20079..69eda9c 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 _0xd8ee=['request','then','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','VoiceDialReport','create','options','raw','CreateVoiceDialReport','update','body','where','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0xf71d98,_0x51e619){var _0x3fec71=function(_0x87fb35){while(--_0x87fb35){_0xf71d98['push'](_0xf71d98['shift']());}};_0x3fec71(++_0x51e619);}(_0xd8ee,0x17c));var _0xed8e=function(_0x34474e,_0x254467){_0x34474e=_0x34474e-0x0;var _0x4c2f6f=_0xd8ee[_0x34474e];return _0x4c2f6f;};'use strict';var _=require(_0xed8e('0x0'));var util=require(_0xed8e('0x1'));var moment=require(_0xed8e('0x2'));var BPromise=require(_0xed8e('0x3'));var rs=require(_0xed8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xed8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed8e('0x6'));var config=require(_0xed8e('0x7'));var jayson=require(_0xed8e('0x8'));var client=jayson['client'][_0xed8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xee3765,_0x269620,_0x456eda){return new BPromise(function(_0x231bd8,_0x2f7a54){return client[_0xed8e('0xa')](_0xee3765,_0x456eda)[_0xed8e('0xb')](function(_0x5ceb71){logger['info'](_0xed8e('0xc'),_0x269620,'request\x20sent');logger[_0xed8e('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x269620,_0xed8e('0xe'),JSON[_0xed8e('0xf')](_0x5ceb71));if(_0x5ceb71[_0xed8e('0x10')]){if(_0x5ceb71['error'][_0xed8e('0x11')]===0x1f4){logger[_0xed8e('0x10')](_0xed8e('0xc'),_0x269620,_0x5ceb71[_0xed8e('0x10')]['message']);return _0x2f7a54(_0x5ceb71['error']['message']);}logger['error'](_0xed8e('0xc'),_0x269620,_0x5ceb71[_0xed8e('0x10')][_0xed8e('0x12')]);return _0x231bd8(_0x5ceb71['error'][_0xed8e('0x12')]);}else{logger[_0xed8e('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x269620,_0xed8e('0xe'));_0x231bd8(_0x5ceb71['result'][_0xed8e('0x12')]);}})[_0xed8e('0x14')](function(_0x56983d){logger[_0xed8e('0x10')](_0xed8e('0xc'),_0x269620,_0x56983d);_0x2f7a54(_0x56983d);});});}exports['CreateVoiceDialReport']=function(_0x59dcda){var _0x418b18=this;return new Promise(function(_0x1a7664,_0x5067b7){return db[_0xed8e('0x15')][_0xed8e('0x16')](_0x59dcda['body'],{'raw':_0x59dcda['options']?_0x59dcda[_0xed8e('0x17')][_0xed8e('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x9b219b){logger['info'](_0xed8e('0x19'),_0x59dcda);logger[_0xed8e('0xd')](_0xed8e('0x19'),_0x59dcda,JSON[_0xed8e('0xf')](_0x9b219b));_0x1a7664(_0x9b219b);})['catch'](function(_0x3306be){logger[_0xed8e('0x10')](_0xed8e('0x19'),_0x3306be[_0xed8e('0x12')],_0x59dcda);_0x5067b7(_0x418b18[_0xed8e('0x10')](0x1f4,_0x3306be[_0xed8e('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x31e1c3){var _0x5139a8=this;return new Promise(function(_0x20caa9,_0x84ed97){return db[_0xed8e('0x15')][_0xed8e('0x1a')](_0x31e1c3[_0xed8e('0x1b')],{'raw':_0x31e1c3[_0xed8e('0x17')]?_0x31e1c3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e1c3[_0xed8e('0x17')]?_0x31e1c3[_0xed8e('0x17')][_0xed8e('0x1c')]||null:null,'attributes':_0x31e1c3['options']?_0x31e1c3[_0xed8e('0x17')]['attributes']||null:null,'limit':_0x31e1c3[_0xed8e('0x17')]?_0x31e1c3['options']['limit']||null:null})['then'](function(_0x2562cd){logger[_0xed8e('0x13')](_0xed8e('0x1d'),_0x31e1c3);logger[_0xed8e('0xd')](_0xed8e('0x1d'),_0x31e1c3,JSON['stringify'](_0x2562cd));_0x20caa9(_0x2562cd);})[_0xed8e('0x14')](function(_0x2660df){logger[_0xed8e('0x10')]('UpdateVoiceDialReport',_0x2660df['message'],_0x31e1c3);_0x84ed97(_0x5139a8['error'](0x1f4,_0x2660df['message']));});});}; \ No newline at end of file +var _0x3dfd=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','create','body','raw','CreateVoiceDialReport','UpdateVoiceDialReport','options','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3dfd,0x6d));var _0xd3df=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x3dfd[_0x3070dc];return _0x431489;};'use strict';var _=require(_0xd3df('0x0'));var util=require('util');var moment=require(_0xd3df('0x1'));var BPromise=require('bluebird');var rs=require(_0xd3df('0x2'));var fs=require('fs');var Redis=require(_0xd3df('0x3'));var db=require(_0xd3df('0x4'))['db'];var utils=require(_0xd3df('0x5'));var logger=require('../../config/logger')(_0xd3df('0x6'));var config=require(_0xd3df('0x7'));var jayson=require(_0xd3df('0x8'));var client=jayson['client'][_0xd3df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20faae,_0x51f282,_0x11340f){return new BPromise(function(_0x2e83f6,_0x3b1879){return client[_0xd3df('0xa')](_0x20faae,_0x11340f)[_0xd3df('0xb')](function(_0x3f8886){logger[_0xd3df('0xc')](_0xd3df('0xd'),_0x51f282,_0xd3df('0xe'));logger[_0xd3df('0xf')](_0xd3df('0x10'),_0x51f282,_0xd3df('0xe'),JSON[_0xd3df('0x11')](_0x3f8886));if(_0x3f8886[_0xd3df('0x12')]){if(_0x3f8886[_0xd3df('0x12')][_0xd3df('0x13')]===0x1f4){logger[_0xd3df('0x12')](_0xd3df('0xd'),_0x51f282,_0x3f8886['error'][_0xd3df('0x14')]);return _0x3b1879(_0x3f8886[_0xd3df('0x12')][_0xd3df('0x14')]);}logger[_0xd3df('0x12')](_0xd3df('0xd'),_0x51f282,_0x3f8886['error'][_0xd3df('0x14')]);return _0x2e83f6(_0x3f8886[_0xd3df('0x12')]['message']);}else{logger[_0xd3df('0xc')](_0xd3df('0xd'),_0x51f282,'request\x20sent');_0x2e83f6(_0x3f8886[_0xd3df('0x15')][_0xd3df('0x14')]);}})[_0xd3df('0x16')](function(_0x161a3c){logger['error'](_0xd3df('0xd'),_0x51f282,_0x161a3c);_0x3b1879(_0x161a3c);});});}exports['CreateVoiceDialReport']=function(_0x22f9f5){var _0x4eb685=this;return new Promise(function(_0x141444,_0x4418c8){return db[_0xd3df('0x17')][_0xd3df('0x18')](_0x22f9f5[_0xd3df('0x19')],{'raw':_0x22f9f5['options']?_0x22f9f5['options'][_0xd3df('0x1a')]===undefined?!![]:![]:!![]})[_0xd3df('0xb')](function(_0x3f0ba3){logger[_0xd3df('0xc')](_0xd3df('0x1b'),_0x22f9f5);logger[_0xd3df('0xf')](_0xd3df('0x1b'),_0x22f9f5,JSON['stringify'](_0x3f0ba3));_0x141444(_0x3f0ba3);})[_0xd3df('0x16')](function(_0x1b163d){logger['error'](_0xd3df('0x1b'),_0x1b163d[_0xd3df('0x14')],_0x22f9f5);_0x4418c8(_0x4eb685[_0xd3df('0x12')](0x1f4,_0x1b163d[_0xd3df('0x14')]));});});};exports[_0xd3df('0x1c')]=function(_0x2ea290){var _0x17a873=this;return new Promise(function(_0x422cf0,_0xaab432){return db['VoiceDialReport']['update'](_0x2ea290['body'],{'raw':_0x2ea290[_0xd3df('0x1d')]?_0x2ea290[_0xd3df('0x1d')][_0xd3df('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ea290[_0xd3df('0x1d')]?_0x2ea290[_0xd3df('0x1d')][_0xd3df('0x1e')]||null:null,'attributes':_0x2ea290[_0xd3df('0x1d')]?_0x2ea290[_0xd3df('0x1d')]['attributes']||null:null,'limit':_0x2ea290[_0xd3df('0x1d')]?_0x2ea290[_0xd3df('0x1d')]['limit']||null:null})[_0xd3df('0xb')](function(_0x4fb0cf){logger[_0xd3df('0xc')](_0xd3df('0x1c'),_0x2ea290);logger[_0xd3df('0xf')](_0xd3df('0x1c'),_0x2ea290,JSON[_0xd3df('0x11')](_0x4fb0cf));_0x422cf0(_0x4fb0cf);})[_0xd3df('0x16')](function(_0x325089){logger[_0xd3df('0x12')](_0xd3df('0x1c'),_0x325089['message'],_0x2ea290);_0xaab432(_0x17a873[_0xd3df('0x12')](0x1f4,_0x325089['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1c696bc..1d3c043 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 _0x218a=['../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','index','isAuthenticated','show','post','create','/:id/applications','addApplications','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x218a,0x13b));var _0xa218=function(_0x3c5209,_0x24fbff){_0x3c5209=_0x3c5209-0x0;var _0x2ba6fc=_0x218a[_0x3c5209];return _0x2ba6fc;};'use strict';var multer=require(_0xa218('0x0'));var util=require(_0xa218('0x1'));var path=require(_0xa218('0x2'));var timeout=require(_0xa218('0x3'));var express=require(_0xa218('0x4'));var router=express[_0xa218('0x5')]();var fs_extra=require(_0xa218('0x6'));var auth=require(_0xa218('0x7'));var interaction=require(_0xa218('0x8'));var config=require('../../config/environment');var controller=require(_0xa218('0x9'));router[_0xa218('0xa')]('/',auth['isAuthenticated'](),controller[_0xa218('0xb')]);router[_0xa218('0xa')]('/:id',auth[_0xa218('0xc')](),controller[_0xa218('0xd')]);router[_0xa218('0xe')]('/',auth[_0xa218('0xc')](),controller[_0xa218('0xf')]);router[_0xa218('0xe')](_0xa218('0x10'),auth[_0xa218('0xc')](),controller[_0xa218('0x11')]);router['put'](_0xa218('0x12'),auth['isAuthenticated'](),controller[_0xa218('0x13')]);router[_0xa218('0x14')](_0xa218('0x12'),auth['isAuthenticated'](),controller[_0xa218('0x15')]);module[_0xa218('0x16')]=router; \ No newline at end of file +var _0xb47e=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','/:id','show','isAuthenticated','post','/:id/applications','addApplications','put','delete','destroy','exports','multer','../../components/auth/service'];(function(_0x36dd9e,_0x713616){var _0x49ccee=function(_0x1d219e){while(--_0x1d219e){_0x36dd9e['push'](_0x36dd9e['shift']());}};_0x49ccee(++_0x713616);}(_0xb47e,0x12a));var _0xeb47=function(_0x2b4844,_0x52be0e){_0x2b4844=_0x2b4844-0x0;var _0x19be1e=_0xb47e[_0x2b4844];return _0x19be1e;};'use strict';var multer=require(_0xeb47('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb47('0x1'));var interaction=require(_0xeb47('0x2'));var config=require(_0xeb47('0x3'));var controller=require(_0xeb47('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xeb47('0x5'),auth['isAuthenticated'](),controller[_0xeb47('0x6')]);router['post']('/',auth[_0xeb47('0x7')](),controller['create']);router[_0xeb47('0x8')](_0xeb47('0x9'),auth[_0xeb47('0x7')](),controller[_0xeb47('0xa')]);router[_0xeb47('0xb')](_0xeb47('0x5'),auth[_0xeb47('0x7')](),controller['update']);router[_0xeb47('0xc')](_0xeb47('0x5'),auth[_0xeb47('0x7')](),controller[_0xeb47('0xd')]);module[_0xeb47('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index cae4c30..e6ce202 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 _0xc043=['STRING','compositeIndex','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exports'];(function(_0x2b04eb,_0x496171){var _0x1ec29b=function(_0x54480f){while(--_0x54480f){_0x2b04eb['push'](_0x2b04eb['shift']());}};_0x1ec29b(++_0x496171);}(_0xc043,0x133));var _0x3c04=function(_0x30df94,_0x45e76f){_0x30df94=_0x30df94-0x0;var _0x4b2dd8=_0xc043[_0x30df94];return _0x4b2dd8;};'use strict';var Sequelize=require('sequelize');module[_0x3c04('0x0')]={'context':{'type':Sequelize[_0x3c04('0x1')],'allowNull':![],'unique':_0x3c04('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3c04('0x1')],'allowNull':![],'unique':_0x3c04('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x3c04('0x2')},'tag':{'type':Sequelize[_0x3c04('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3c04('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3c04('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x3c04('0x3'),_0x3c04('0x4'),_0x3c04('0x5'),'inbound-fax',_0x3c04('0x6'),_0x3c04('0x7'),_0x3c04('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x3c04('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3c04('0x9')},'IntervalId':{'type':Sequelize[_0x3c04('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3c04('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3c04('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x3c04('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3c04('0xa')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x3c04('0xc')],'get':function(_0x185c83){return this[_0x3c04('0xd')]('exten');}},'alias':{'type':Sequelize[_0x3c04('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xe8e4=['BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','outbound','internal','system','any','*,*,*,*'];(function(_0x7c39e9,_0x8a9160){var _0x595a15=function(_0x3a74c6){while(--_0x3a74c6){_0x7c39e9['push'](_0x7c39e9['shift']());}};_0x595a15(++_0x8a9160);}(_0xe8e4,0x147));var _0x4e8e=function(_0x4f6948,_0x58df27){_0x4f6948=_0x4f6948-0x0;var _0xecdf79=_0xe8e4[_0x4f6948];return _0xecdf79;};'use strict';var Sequelize=require(_0x4e8e('0x0'));module[_0x4e8e('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4e8e('0x2')],'allowNull':![],'unique':_0x4e8e('0x3')},'priority':{'type':Sequelize[_0x4e8e('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x4e8e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4e8e('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x4e8e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x4e8e('0x4'),_0x4e8e('0x5'),'inbound-fax','outbound-fax',_0x4e8e('0x6'),_0x4e8e('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0x4e8e('0x2')]},'interval':{'type':Sequelize[_0x4e8e('0x2')],'allowNull':![],'defaultValue':_0x4e8e('0x8')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x4e8e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x4e8e('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4e8e('0xa')]},'recordingFormat':{'type':Sequelize[_0x4e8e('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x4e8e('0x9')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4e8e('0xb')],'get':function(_0x58ddfc){return this[_0x4e8e('0xc')](_0x4e8e('0xd'));}},'alias':{'type':Sequelize[_0x4e8e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 79448f8..fc71023 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 _0xdb16=['fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','destroy','catch','create','startsWith','exten','body','user','get','role','InboundRoutes','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','recordingFormat','mandatoryDisposition','alias','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','lodash','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','inbound','outbound','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','then','sendStatus','error','send','index','VoiceExtension','rawAttributes'];(function(_0x365549,_0x150448){var _0x3a6750=function(_0x41d48e){while(--_0x41d48e){_0x365549['push'](_0x365549['shift']());}};_0x3a6750(++_0x150448);}(_0xdb16,0x8f));var _0x6db1=function(_0x59f066,_0x3d8a42){_0x59f066=_0x59f066-0x0;var _0x21187c=_0xdb16[_0x59f066];return _0x21187c;};'use strict';var _=require(_0x6db1('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x6db1('0x1'))('api');var config=require(_0x6db1('0x2'));var db=require(_0x6db1('0x3'))['db'];config[_0x6db1('0x4')]=_[_0x6db1('0x5')](config[_0x6db1('0x4')],{'host':_0x6db1('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6db1('0x7'))[_0x6db1('0x8')](socket);function respondWithStatusCode(_0x478564,_0x21cba2){_0x21cba2=_0x21cba2||0xcc;return function(_0xf14d1d){if(_0xf14d1d){return _0x478564['sendStatus'](_0x21cba2);}return _0x478564['status'](_0x21cba2)[_0x6db1('0x9')]();};}function respondWithResult(_0x157a37,_0x4aa3c6){_0x4aa3c6=_0x4aa3c6||0xc8;return function(_0x5302fc){if(_0x5302fc){return _0x157a37['status'](_0x4aa3c6)[_0x6db1('0xa')](_0x5302fc);}};}function respondWithFilteredResult(_0x1f78ed,_0x1f31e2){return function(_0x57330d){if(_0x57330d){var _0x4ddca6=typeof _0x1f31e2[_0x6db1('0xb')]===_0x6db1('0xc')&&typeof _0x1f31e2[_0x6db1('0xd')]===_0x6db1('0xc');var _0x443b18=_0x57330d[_0x6db1('0xe')];var _0x155a2e=_0x4ddca6?0x0:_0x1f31e2['offset'];var _0xdd7b94=_0x4ddca6?_0x57330d[_0x6db1('0xe')]:_0x1f31e2[_0x6db1('0xb')]+_0x1f31e2[_0x6db1('0xd')];var _0xc661aa;if(_0xdd7b94>=_0x443b18){_0xdd7b94=_0x443b18;_0xc661aa=0xc8;}else{_0xc661aa=0xce;}_0x1f78ed[_0x6db1('0xf')](_0xc661aa);return _0x1f78ed[_0x6db1('0x10')](_0x6db1('0x11'),_0x155a2e+'-'+_0xdd7b94+'/'+_0x443b18)['json'](_0x57330d);}return null;};}function removeEntity(_0x56df64){return function(_0x559a41){if(_0x559a41){return _0x559a41['destroy']()['then'](function(){var _0x357822=_0x559a41['get']({'plain':!![]});var _0x4c1e1b=[{'name':'InboundRoutes','value':_0x6db1('0x12'),'ignore':![]},{'name':'OutboundRoutes','value':_0x6db1('0x13'),'ignore':![]},{'name':'InternalRoutes','value':_0x6db1('0x14'),'ignore':![]}];var _0x117210=_(_0x4c1e1b)[_0x6db1('0x15')](_0x6db1('0x16'))[_0x6db1('0x17')](_0x6db1('0x18'))[_0x6db1('0x18')]();if(_[_0x6db1('0x19')](_0x117210,_0x357822['type'])){return;}var _0xc946e4=_[_0x6db1('0x1a')](_0x4c1e1b,[_0x6db1('0x18'),_0x357822[_0x6db1('0x1b')]])[_0x6db1('0x1c')];return db[_0x6db1('0x1d')]['destroy']({'where':{'type':_0xc946e4,'resourceId':_0x357822['id']}})[_0x6db1('0x1e')](function(){return _0x559a41;});})[_0x6db1('0x1e')](function(){_0x56df64['status'](0xcc)[_0x6db1('0x9')]();});}};}function handleEntityNotFound(_0x1ade0b){return function(_0x4d9a8d){if(!_0x4d9a8d){_0x1ade0b[_0x6db1('0x1f')](0x194);}return _0x4d9a8d;};}function handleError(_0x522ac4,_0x222859){_0x222859=_0x222859||0x1f4;return function(_0x4254cf){logger[_0x6db1('0x20')](_0x4254cf['stack']);if(_0x4254cf[_0x6db1('0x1c')]){delete _0x4254cf[_0x6db1('0x1c')];}_0x522ac4[_0x6db1('0xf')](_0x222859)[_0x6db1('0x21')](_0x4254cf);};}exports[_0x6db1('0x22')]=function(_0x3133dc,_0x18f870){var _0x41d14e={},_0x20591e={},_0x51defe={'count':0x0,'rows':[]};var _0x5172fe=_[_0x6db1('0x17')](db[_0x6db1('0x23')][_0x6db1('0x24')],function(_0x14a70f){return{'name':_0x14a70f[_0x6db1('0x25')],'type':_0x14a70f[_0x6db1('0x1b')]['key']};});_0x20591e['model']=_[_0x6db1('0x17')](_0x5172fe,_0x6db1('0x1c'));_0x20591e[_0x6db1('0x26')]=_[_0x6db1('0x27')](_0x3133dc[_0x6db1('0x26')]);_0x20591e[_0x6db1('0x28')]=_[_0x6db1('0x29')](_0x20591e[_0x6db1('0x2a')],_0x20591e[_0x6db1('0x26')]);_0x41d14e['attributes']=_[_0x6db1('0x29')](_0x20591e[_0x6db1('0x2a')],qs[_0x6db1('0x2b')](_0x3133dc[_0x6db1('0x26')][_0x6db1('0x2b')]));_0x41d14e[_0x6db1('0x2c')]=_0x41d14e['attributes'][_0x6db1('0x2d')]?_0x41d14e[_0x6db1('0x2c')]:_0x20591e[_0x6db1('0x2a')];if(!_0x3133dc['query'][_0x6db1('0x2e')](_0x6db1('0x2f'))){_0x41d14e['limit']=qs[_0x6db1('0xd')](_0x3133dc[_0x6db1('0x26')]['limit']);_0x41d14e[_0x6db1('0xb')]=qs[_0x6db1('0xb')](_0x3133dc[_0x6db1('0x26')][_0x6db1('0xb')]);}_0x41d14e[_0x6db1('0x30')]=qs[_0x6db1('0x31')](_0x3133dc[_0x6db1('0x26')][_0x6db1('0x31')]);_0x41d14e[_0x6db1('0x32')]=qs[_0x6db1('0x28')](_['pick'](_0x3133dc[_0x6db1('0x26')],_0x20591e[_0x6db1('0x28')]),_0x5172fe);if(_0x3133dc[_0x6db1('0x26')]['filter']){_0x41d14e[_0x6db1('0x32')]=_['merge'](_0x41d14e[_0x6db1('0x32')],{'$or':_['map'](_0x5172fe,function(_0x9986ea){if(_0x9986ea[_0x6db1('0x1b')]!==_0x6db1('0x33')){var _0x5e024a={};_0x5e024a[_0x9986ea[_0x6db1('0x1c')]]={'$like':'%'+_0x3133dc[_0x6db1('0x26')][_0x6db1('0x15')]+'%'};return _0x5e024a;}})});}_0x41d14e=_[_0x6db1('0x34')]({},_0x41d14e,_0x3133dc['options']);var _0x18d8ce={'where':_0x41d14e[_0x6db1('0x32')]};return db[_0x6db1('0x23')]['count'](_0x18d8ce)[_0x6db1('0x1e')](function(_0x4b7383){_0x51defe[_0x6db1('0xe')]=_0x4b7383;if(_0x3133dc['query'][_0x6db1('0x35')]){_0x41d14e[_0x6db1('0x36')]=[{'all':!![]}];}return db[_0x6db1('0x23')][_0x6db1('0x37')](_0x41d14e);})[_0x6db1('0x1e')](function(_0x443c1e){_0x51defe[_0x6db1('0x38')]=_0x443c1e;return _0x51defe;})[_0x6db1('0x1e')](respondWithFilteredResult(_0x18f870,_0x41d14e))['catch'](handleError(_0x18f870,null));};exports[_0x6db1('0x39')]=function(_0x44afb4,_0x37dc26){var _0xf8429b={'raw':![],'where':{'id':_0x44afb4[_0x6db1('0x3a')]['id']}},_0x11a2ac={};_0x11a2ac[_0x6db1('0x2a')]=_[_0x6db1('0x27')](db[_0x6db1('0x23')][_0x6db1('0x24')]);_0x11a2ac[_0x6db1('0x26')]=_[_0x6db1('0x27')](_0x44afb4[_0x6db1('0x26')]);_0x11a2ac[_0x6db1('0x28')]=_['intersection'](_0x11a2ac['model'],_0x11a2ac[_0x6db1('0x26')]);_0xf8429b[_0x6db1('0x2c')]=_[_0x6db1('0x29')](_0x11a2ac[_0x6db1('0x2a')],qs[_0x6db1('0x2b')](_0x44afb4[_0x6db1('0x26')][_0x6db1('0x2b')]));_0xf8429b[_0x6db1('0x2c')]=_0xf8429b[_0x6db1('0x2c')][_0x6db1('0x2d')]?_0xf8429b[_0x6db1('0x2c')]:_0x11a2ac[_0x6db1('0x2a')];if(_0x44afb4[_0x6db1('0x26')]['includeAll']){_0xf8429b[_0x6db1('0x36')]=[{'all':!![]}];}_0xf8429b=_[_0x6db1('0x34')]({},_0xf8429b,_0x44afb4[_0x6db1('0x3b')]);return db[_0x6db1('0x23')][_0x6db1('0x1a')](_0xf8429b)['then'](handleEntityNotFound(_0x37dc26,null))[_0x6db1('0x1e')](respondWithResult(_0x37dc26,null))['catch'](handleError(_0x37dc26,null));};exports[_0x6db1('0x3c')]=function(_0xf0273e,_0x576140){return db[_0x6db1('0x23')][_0x6db1('0x1a')]({'where':{'id':_0xf0273e[_0x6db1('0x3a')]['id']}})[_0x6db1('0x1e')](handleEntityNotFound(_0x576140,null))['then'](removeEntity(_0x576140,null))[_0x6db1('0x3d')](handleError(_0x576140,null));};exports[_0x6db1('0x3e')]=function(_0x5e6c25,_0x2ad530){if(_0x5e6c25['body'][_0x6db1('0x1b')]===_0x6db1('0x13')&&!_[_0x6db1('0x3f')](_0x5e6c25['body'][_0x6db1('0x40')],'_')){_0x5e6c25['body'][_0x6db1('0x40')]='_'['concat'](_0x5e6c25[_0x6db1('0x41')][_0x6db1('0x40')]);}return db[_0x6db1('0x23')][_0x6db1('0x3e')](_0x5e6c25[_0x6db1('0x41')],{'raw':![]})[_0x6db1('0x1e')](function(_0x18adb4){var _0x3d85ab=_0x5e6c25[_0x6db1('0x42')][_0x6db1('0x43')]({'plain':!![]});if(!_0x3d85ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d85ab[_0x6db1('0x44')]===_0x6db1('0x42')){var _0x49279c=_0x18adb4[_0x6db1('0x43')]({'plain':!![]});var _0x516447=[{'name':_0x6db1('0x45'),'value':_0x6db1('0x12')},{'name':_0x6db1('0x46'),'value':_0x6db1('0x13')},{'name':'InternalRoutes','value':_0x6db1('0x14')}];var _0x4a0883=_[_0x6db1('0x1a')](_0x516447,[_0x6db1('0x18'),_0x49279c[_0x6db1('0x1b')]])[_0x6db1('0x1c')];return db[_0x6db1('0x47')][_0x6db1('0x1a')]({'where':{'name':_0x4a0883,'userProfileId':_0x3d85ab[_0x6db1('0x48')]},'raw':!![]})[_0x6db1('0x1e')](function(_0x2545b5){if(_0x2545b5&&_0x2545b5[_0x6db1('0x49')]===0x0){return db[_0x6db1('0x1d')][_0x6db1('0x3e')]({'name':_0x49279c['name'],'resourceId':_0x49279c['id'],'type':_0x2545b5['name'],'sectionId':_0x2545b5['id']},{})[_0x6db1('0x1e')](function(){return _0x18adb4;});}else{return _0x18adb4;}})[_0x6db1('0x3d')](function(_0x2fc4f7){logger['error'](_0x6db1('0x4a'),_0x2fc4f7);throw _0x2fc4f7;});}return _0x18adb4;})[_0x6db1('0x1e')](respondWithResult(_0x2ad530,0xc9))['catch'](handleError(_0x2ad530,null));};exports['update']=function(_0x58867,_0x1823c1){if(_0x58867[_0x6db1('0x41')]['id']){delete _0x58867['body']['id'];}return db[_0x6db1('0x23')][_0x6db1('0x1a')]({'where':{'id':_0x58867['params']['id']}})['then'](handleEntityNotFound(_0x1823c1,null))[_0x6db1('0x1e')](function(_0x438799){if(_0x438799){return db[_0x6db1('0x23')]['update'](_[_0x6db1('0x4b')](_0x58867[_0x6db1('0x41')],[_0x6db1('0x40'),_0x6db1('0x4c'),_0x6db1('0x4d'),_0x6db1('0x4e'),'cutdigits',_0x6db1('0x4f'),_0x6db1('0x50')]),{'where':{'context':_0x438799['context'],'exten':_0x438799[_0x6db1('0x40')]},'individualHooks':!![]})[_0x6db1('0x1e')](function(_0x299517){return _0x299517;});}return null;})[_0x6db1('0x1e')](respondWithStatusCode(_0x1823c1,null))['catch'](handleError(_0x1823c1,null));};exports['addApplications']=function(_0x4a9afc,_0x19d21f){var _0x151171=_0x4a9afc['params']['id'];var _0x5994e3=_0x4a9afc['body'];var _0x258eac=0xc8;var _0x2ca9c1=null;return db[_0x6db1('0x51')][_0x6db1('0x52')]({'isolationLevel':db[_0x6db1('0x51')]['Transaction'][_0x6db1('0x53')][_0x6db1('0x54')]},function(_0x35299f){return db[_0x6db1('0x23')][_0x6db1('0x55')]({'where':{'id':_0x151171},'transaction':_0x35299f})[_0x6db1('0x1e')](function(_0x96cf02){if(_0x96cf02){return db[_0x6db1('0x23')][_0x6db1('0x3c')]({'where':{'VoiceExtensionId':_0x151171},'transaction':_0x35299f})[_0x6db1('0x1e')](function(){var _0x4aadbf=_[_0x6db1('0x17')](_0x5994e3,function(_0x2707bc){_0x2707bc[_0x6db1('0x56')]=_0x151171;_0x2707bc['isApp']=!![];return _0x2707bc;});return _0x96cf02[_0x6db1('0x57')](_0x4aadbf);})[_0x6db1('0x1e')](function(_0x4d6c63){return db[_0x6db1('0x23')][_0x6db1('0x58')](_0x4d6c63,{'transaction':_0x35299f});});}else{_0x258eac=0x194;_0x2ca9c1=[];}});})['then'](function(){if(_0x258eac!==0x194){return db[_0x6db1('0x23')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x151171},'order':_0x6db1('0x59')})['then'](function(_0x167f29){_0x2ca9c1=_0x167f29;});}})[_0x6db1('0x3d')](function(_0x274f3e){_0x258eac=0x1f4;logger['error'](_0x274f3e['stack']);if(_0x274f3e[_0x6db1('0x1c')]){delete _0x274f3e[_0x6db1('0x1c')];}_0x2ca9c1=_0x274f3e;})['finally'](function(){if(_0x2ca9c1===null){_0x19d21f[_0x6db1('0x1f')](_0x258eac);}else{if(_0x258eac===0x1f4){_0x19d21f['status'](_0x258eac)[_0x6db1('0x21')](_0x2ca9c1);}else{_0x19d21f['status'](_0x258eac)[_0x6db1('0xa')](_0x2ca9c1);}}});}; \ No newline at end of file +var _0x7867=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','destroy','create','startsWith','exten','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x3a9468,_0x2b6266){var _0x1d2345=function(_0x499728){while(--_0x499728){_0x3a9468['push'](_0x3a9468['shift']());}};_0x1d2345(++_0x2b6266);}(_0x7867,0x12c));var _0x7786=function(_0x37481f,_0x47c0c0){_0x37481f=_0x37481f-0x0;var _0x161fcb=_0x7867[_0x37481f];return _0x161fcb;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x7786('0x0'));var logger=require('../../config/logger')(_0x7786('0x1'));var config=require(_0x7786('0x2'));var db=require(_0x7786('0x3'))['db'];config[_0x7786('0x4')]=_['defaults'](config[_0x7786('0x4')],{'host':_0x7786('0x5'),'port':0x18eb});var socket=require(_0x7786('0x6'))(new Redis(config[_0x7786('0x4')]));require(_0x7786('0x7'))[_0x7786('0x8')](socket);function respondWithStatusCode(_0x23320c,_0x30ffe3){_0x30ffe3=_0x30ffe3||0xcc;return function(_0x5a2bc1){if(_0x5a2bc1){return _0x23320c['sendStatus'](_0x30ffe3);}return _0x23320c[_0x7786('0x9')](_0x30ffe3)[_0x7786('0xa')]();};}function respondWithResult(_0x14bff6,_0x36cbb9){_0x36cbb9=_0x36cbb9||0xc8;return function(_0x3e7813){if(_0x3e7813){return _0x14bff6[_0x7786('0x9')](_0x36cbb9)[_0x7786('0xb')](_0x3e7813);}};}function respondWithFilteredResult(_0x58857e,_0x171f1e){return function(_0x577708){if(_0x577708){var _0x83bb57=typeof _0x171f1e[_0x7786('0xc')]===_0x7786('0xd')&&typeof _0x171f1e[_0x7786('0xe')]===_0x7786('0xd');var _0x1bd67e=_0x577708['count'];var _0x4d29fe=_0x83bb57?0x0:_0x171f1e[_0x7786('0xc')];var _0x5c23b2=_0x83bb57?_0x577708[_0x7786('0xf')]:_0x171f1e['offset']+_0x171f1e[_0x7786('0xe')];var _0x199e07;if(_0x5c23b2>=_0x1bd67e){_0x5c23b2=_0x1bd67e;_0x199e07=0xc8;}else{_0x199e07=0xce;}_0x58857e[_0x7786('0x9')](_0x199e07);return _0x58857e[_0x7786('0x10')](_0x7786('0x11'),_0x4d29fe+'-'+_0x5c23b2+'/'+_0x1bd67e)[_0x7786('0xb')](_0x577708);}return null;};}function removeEntity(_0x4f2cbd){return function(_0x636a79){if(_0x636a79){return _0x636a79['destroy']()[_0x7786('0x12')](function(){var _0x4aedbb=_0x636a79[_0x7786('0x13')]({'plain':!![]});var _0x44efc7=[{'name':_0x7786('0x14'),'value':_0x7786('0x15'),'ignore':![]},{'name':_0x7786('0x16'),'value':_0x7786('0x17'),'ignore':![]},{'name':_0x7786('0x18'),'value':_0x7786('0x19'),'ignore':![]}];var _0x4070d7=_(_0x44efc7)[_0x7786('0x1a')](_0x7786('0x1b'))[_0x7786('0x1c')]('value')[_0x7786('0x1d')]();if(_['includes'](_0x4070d7,_0x4aedbb[_0x7786('0x1e')])){return;}var _0x4ecb44=_['find'](_0x44efc7,[_0x7786('0x1d'),_0x4aedbb['type']])[_0x7786('0x1f')];return db[_0x7786('0x20')]['destroy']({'where':{'type':_0x4ecb44,'resourceId':_0x4aedbb['id']}})[_0x7786('0x12')](function(){return _0x636a79;});})['then'](function(){_0x4f2cbd[_0x7786('0x9')](0xcc)[_0x7786('0xa')]();});}};}function handleEntityNotFound(_0x331a80){return function(_0x5f0436){if(!_0x5f0436){_0x331a80[_0x7786('0x21')](0x194);}return _0x5f0436;};}function handleError(_0x3fadc3,_0x8c30c4){_0x8c30c4=_0x8c30c4||0x1f4;return function(_0x5ebc05){logger[_0x7786('0x22')](_0x5ebc05[_0x7786('0x23')]);if(_0x5ebc05['name']){delete _0x5ebc05[_0x7786('0x1f')];}_0x3fadc3[_0x7786('0x9')](_0x8c30c4)[_0x7786('0x24')](_0x5ebc05);};}exports[_0x7786('0x25')]=function(_0x944e95,_0x2c1211){var _0x1f2165={},_0x4753f7={},_0x21e89f={'count':0x0,'rows':[]};var _0x55527b=_[_0x7786('0x1c')](db[_0x7786('0x26')][_0x7786('0x27')],function(_0x16c4cc){return{'name':_0x16c4cc[_0x7786('0x28')],'type':_0x16c4cc['type'][_0x7786('0x29')]};});_0x4753f7['model']=_[_0x7786('0x1c')](_0x55527b,'name');_0x4753f7[_0x7786('0x2a')]=_[_0x7786('0x2b')](_0x944e95['query']);_0x4753f7[_0x7786('0x2c')]=_[_0x7786('0x2d')](_0x4753f7[_0x7786('0x2e')],_0x4753f7[_0x7786('0x2a')]);_0x1f2165[_0x7786('0x2f')]=_['intersection'](_0x4753f7[_0x7786('0x2e')],qs[_0x7786('0x30')](_0x944e95[_0x7786('0x2a')][_0x7786('0x30')]));_0x1f2165[_0x7786('0x2f')]=_0x1f2165[_0x7786('0x2f')][_0x7786('0x31')]?_0x1f2165[_0x7786('0x2f')]:_0x4753f7['model'];if(!_0x944e95[_0x7786('0x2a')][_0x7786('0x32')](_0x7786('0x33'))){_0x1f2165[_0x7786('0xe')]=qs[_0x7786('0xe')](_0x944e95['query'][_0x7786('0xe')]);_0x1f2165[_0x7786('0xc')]=qs[_0x7786('0xc')](_0x944e95['query']['offset']);}_0x1f2165['order']=qs[_0x7786('0x34')](_0x944e95[_0x7786('0x2a')][_0x7786('0x34')]);_0x1f2165[_0x7786('0x35')]=qs[_0x7786('0x2c')](_[_0x7786('0x36')](_0x944e95[_0x7786('0x2a')],_0x4753f7['filters']),_0x55527b);if(_0x944e95['query']['filter']){_0x1f2165[_0x7786('0x35')]=_[_0x7786('0x37')](_0x1f2165[_0x7786('0x35')],{'$or':_[_0x7786('0x1c')](_0x55527b,function(_0x53ca68){if(_0x53ca68[_0x7786('0x1e')]!==_0x7786('0x38')){var _0x199721={};_0x199721[_0x53ca68['name']]={'$like':'%'+_0x944e95[_0x7786('0x2a')]['filter']+'%'};return _0x199721;}})});}_0x1f2165=_[_0x7786('0x37')]({},_0x1f2165,_0x944e95['options']);var _0x5d2893={'where':_0x1f2165[_0x7786('0x35')]};return db[_0x7786('0x26')]['count'](_0x5d2893)[_0x7786('0x12')](function(_0x5a5243){_0x21e89f[_0x7786('0xf')]=_0x5a5243;if(_0x944e95[_0x7786('0x2a')][_0x7786('0x39')]){_0x1f2165[_0x7786('0x3a')]=[{'all':!![]}];}return db[_0x7786('0x26')][_0x7786('0x3b')](_0x1f2165);})[_0x7786('0x12')](function(_0x4c6b9a){_0x21e89f[_0x7786('0x3c')]=_0x4c6b9a;return _0x21e89f;})[_0x7786('0x12')](respondWithFilteredResult(_0x2c1211,_0x1f2165))['catch'](handleError(_0x2c1211,null));};exports[_0x7786('0x3d')]=function(_0x55db6f,_0x279a8b){var _0x11b4a1={'raw':![],'where':{'id':_0x55db6f[_0x7786('0x3e')]['id']}},_0x154cd3={};_0x154cd3[_0x7786('0x2e')]=_[_0x7786('0x2b')](db[_0x7786('0x26')][_0x7786('0x27')]);_0x154cd3['query']=_['keys'](_0x55db6f['query']);_0x154cd3[_0x7786('0x2c')]=_[_0x7786('0x2d')](_0x154cd3[_0x7786('0x2e')],_0x154cd3[_0x7786('0x2a')]);_0x11b4a1[_0x7786('0x2f')]=_['intersection'](_0x154cd3[_0x7786('0x2e')],qs['fields'](_0x55db6f[_0x7786('0x2a')][_0x7786('0x30')]));_0x11b4a1[_0x7786('0x2f')]=_0x11b4a1['attributes'][_0x7786('0x31')]?_0x11b4a1[_0x7786('0x2f')]:_0x154cd3[_0x7786('0x2e')];if(_0x55db6f[_0x7786('0x2a')][_0x7786('0x39')]){_0x11b4a1[_0x7786('0x3a')]=[{'all':!![]}];}_0x11b4a1=_[_0x7786('0x37')]({},_0x11b4a1,_0x55db6f['options']);return db[_0x7786('0x26')][_0x7786('0x3f')](_0x11b4a1)[_0x7786('0x12')](handleEntityNotFound(_0x279a8b,null))['then'](respondWithResult(_0x279a8b,null))[_0x7786('0x40')](handleError(_0x279a8b,null));};exports[_0x7786('0x41')]=function(_0x1ec772,_0x5b80cf){return db['VoiceExtension'][_0x7786('0x3f')]({'where':{'id':_0x1ec772[_0x7786('0x3e')]['id']}})[_0x7786('0x12')](handleEntityNotFound(_0x5b80cf,null))['then'](removeEntity(_0x5b80cf,null))[_0x7786('0x40')](handleError(_0x5b80cf,null));};exports[_0x7786('0x42')]=function(_0x4ef541,_0x3c1220){if(_0x4ef541['body'][_0x7786('0x1e')]===_0x7786('0x17')&&!_[_0x7786('0x43')](_0x4ef541['body'][_0x7786('0x44')],'_')){_0x4ef541[_0x7786('0x45')][_0x7786('0x44')]='_'['concat'](_0x4ef541[_0x7786('0x45')][_0x7786('0x44')]);}return db[_0x7786('0x26')][_0x7786('0x42')](_0x4ef541['body'],{'raw':![]})[_0x7786('0x12')](function(_0x12d586){var _0x2a2e7e=_0x4ef541[_0x7786('0x46')][_0x7786('0x13')]({'plain':!![]});if(!_0x2a2e7e)throw new Error(_0x7786('0x47'));if(_0x2a2e7e[_0x7786('0x48')]===_0x7786('0x46')){var _0x135251=_0x12d586[_0x7786('0x13')]({'plain':!![]});var _0x516006=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x7786('0x16'),'value':_0x7786('0x17')},{'name':'InternalRoutes','value':_0x7786('0x19')}];var _0x2ed55c=_[_0x7786('0x3f')](_0x516006,['value',_0x135251['type']])[_0x7786('0x1f')];return db[_0x7786('0x49')]['find']({'where':{'name':_0x2ed55c,'userProfileId':_0x2a2e7e[_0x7786('0x4a')]},'raw':!![]})['then'](function(_0x40eb28){if(_0x40eb28&&_0x40eb28[_0x7786('0x4b')]===0x0){return db[_0x7786('0x20')]['create']({'name':_0x135251[_0x7786('0x1f')],'resourceId':_0x135251['id'],'type':_0x40eb28[_0x7786('0x1f')],'sectionId':_0x40eb28['id']},{})[_0x7786('0x12')](function(){return _0x12d586;});}else{return _0x12d586;}})['catch'](function(_0x5c9ebe){logger[_0x7786('0x22')](_0x7786('0x4c'),_0x5c9ebe);throw _0x5c9ebe;});}return _0x12d586;})['then'](respondWithResult(_0x3c1220,0xc9))[_0x7786('0x40')](handleError(_0x3c1220,null));};exports[_0x7786('0x4d')]=function(_0x5e1e34,_0x5601ff){if(_0x5e1e34[_0x7786('0x45')]['id']){delete _0x5e1e34[_0x7786('0x45')]['id'];}return db[_0x7786('0x26')][_0x7786('0x3f')]({'where':{'id':_0x5e1e34[_0x7786('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5601ff,null))[_0x7786('0x12')](function(_0x20a57a){if(_0x20a57a){return db[_0x7786('0x26')][_0x7786('0x4d')](_[_0x7786('0x36')](_0x5e1e34[_0x7786('0x45')],[_0x7786('0x44'),'context','description',_0x7786('0x4e'),_0x7786('0x4f'),_0x7786('0x50'),'alias']),{'where':{'context':_0x20a57a['context'],'exten':_0x20a57a[_0x7786('0x44')]},'individualHooks':!![]})[_0x7786('0x12')](function(_0x4474bd){return _0x4474bd;});}return null;})[_0x7786('0x12')](respondWithStatusCode(_0x5601ff,null))[_0x7786('0x40')](handleError(_0x5601ff,null));};exports[_0x7786('0x51')]=function(_0x43b4dd,_0x36657e){var _0x5b0c6c=_0x43b4dd['params']['id'];var _0x1c38d4=_0x43b4dd[_0x7786('0x45')];var _0x2f478f=0xc8;var _0x36e0b1=null;return db['sequelize'][_0x7786('0x52')]({'isolationLevel':db[_0x7786('0x53')]['Transaction'][_0x7786('0x54')][_0x7786('0x55')]},function(_0x28fe0c){return db['VoiceExtension']['findOne']({'where':{'id':_0x5b0c6c},'transaction':_0x28fe0c})[_0x7786('0x12')](function(_0x2395b0){if(_0x2395b0){return db[_0x7786('0x26')][_0x7786('0x41')]({'where':{'VoiceExtensionId':_0x5b0c6c},'transaction':_0x28fe0c})['then'](function(){var _0x475082=_[_0x7786('0x1c')](_0x1c38d4,function(_0x541ef0){_0x541ef0[_0x7786('0x56')]=_0x5b0c6c;_0x541ef0[_0x7786('0x57')]=!![];return _0x541ef0;});return _0x2395b0[_0x7786('0x58')](_0x475082);})[_0x7786('0x12')](function(_0x2a758f){return db[_0x7786('0x26')][_0x7786('0x59')](_0x2a758f,{'transaction':_0x28fe0c});});}else{_0x2f478f=0x194;_0x36e0b1=[];}});})[_0x7786('0x12')](function(){if(_0x2f478f!==0x194){return db[_0x7786('0x26')][_0x7786('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5b0c6c},'order':_0x7786('0x5b')})[_0x7786('0x12')](function(_0x2148e5){_0x36e0b1=_0x2148e5;});}})[_0x7786('0x40')](function(_0x9af238){_0x2f478f=0x1f4;logger[_0x7786('0x22')](_0x9af238[_0x7786('0x23')]);if(_0x9af238['name']){delete _0x9af238[_0x7786('0x1f')];}_0x36e0b1=_0x9af238;})[_0x7786('0x5c')](function(){if(_0x36e0b1===null){_0x36657e[_0x7786('0x21')](_0x2f478f);}else{if(_0x2f478f===0x1f4){_0x36657e[_0x7786('0x9')](_0x2f478f)[_0x7786('0x24')](_0x36e0b1);}else{_0x36657e[_0x7786('0x9')](_0x2f478f)[_0x7786('0xb')](_0x36e0b1);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index dcbf8a7..4d30a5a 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 _0x81bb=['exports','events','../../mysqldb','VoiceExtension','emit','hook'];(function(_0x1a16cc,_0x1784cb){var _0x523f97=function(_0x252ca3){while(--_0x252ca3){_0x1a16cc['push'](_0x1a16cc['shift']());}};_0x523f97(++_0x1784cb);}(_0x81bb,0xc7));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb81b('0x0'));var VoiceExtension=require(_0xb81b('0x1'))['db'][_0xb81b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3f7d43){return function(_0x3eb5b6,_0x1667bb,_0x2fe151){VoiceExtensionEvents[_0xb81b('0x3')](_0x3f7d43+':'+_0x3eb5b6['id'],_0x3eb5b6);VoiceExtensionEvents[_0xb81b('0x3')](_0x3f7d43,_0x3eb5b6);_0x2fe151(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb81b('0x4')](e,emitEvent(event));}}module[_0xb81b('0x5')]=VoiceExtensionEvents; \ No newline at end of file +var _0x2396=['hasOwnProperty','hook','VoiceExtension','setMaxListeners','update','remove','emit'];(function(_0x232e66,_0x55700c){var _0x523640=function(_0x495da0){while(--_0x495da0){_0x232e66['push'](_0x232e66['shift']());}};_0x523640(++_0x55700c);}(_0x2396,0x6b));var _0x6239=function(_0x448313,_0x2b5e0f){_0x448313=_0x448313-0x0;var _0x3740be=_0x2396[_0x448313];return _0x3740be;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x6239('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6239('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6239('0x2'),'afterDestroy':_0x6239('0x3')};function emitEvent(_0x2b32e2){return function(_0x16416d,_0x2fbbfb,_0x590f95){VoiceExtensionEvents[_0x6239('0x4')](_0x2b32e2+':'+_0x16416d['id'],_0x16416d);VoiceExtensionEvents['emit'](_0x2b32e2,_0x16416d);_0x590f95(null);};}for(var e in events){if(events[_0x6239('0x5')](e)){var event=events[e];VoiceExtension[_0x6239('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 438dec0..e567ba1 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 _0x28aa=['exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','param','split','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','then','Hangup','./voiceExtension.attributes'];(function(_0x32563a,_0x19560b){var _0x4cc9cf=function(_0x4ffa0a){while(--_0x4ffa0a){_0x32563a['push'](_0x32563a['shift']());}};_0x4cc9cf(++_0x19560b);}(_0x28aa,0xf8));var _0xa28a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x28aa[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var attributes=require(_0xa28a('0x0'));module[_0xa28a('0x1')]=function(_0x8af9dd){var _0x36c789=_0x8af9dd[_0xa28a('0x2')];function _0x3227b6(_0x50ad8c){var _0x3e0341=0x2;var _0x318600=[{'type':_0x50ad8c[_0xa28a('0x3')],'app':_0xa28a('0x4'),'appdata':'CDR(type)='+_0x50ad8c[_0xa28a('0x3')],'context':_0x50ad8c[_0xa28a('0x5')],'exten':_0x50ad8c[_0xa28a('0x6')],'priority':_0x3e0341++,'VoiceExtensionId':_0x50ad8c['id']},{'type':_0x50ad8c[_0xa28a('0x3')],'app':_0x50ad8c[_0xa28a('0x7')]?_0xa28a('0x4'):_0xa28a('0x8'),'appdata':_0x50ad8c[_0xa28a('0x7')]?_0xa28a('0x9')+_0x50ad8c[_0xa28a('0x7')]:_0xa28a('0xa'),'context':_0x50ad8c[_0xa28a('0x5')],'exten':_0x50ad8c[_0xa28a('0x6')],'priority':_0x3e0341++,'VoiceExtensionId':_0x50ad8c['id']}];if(_0x50ad8c[_0xa28a('0x3')]===_0xa28a('0xb')){_0x318600['push']({'type':_0xa28a('0xb'),'app':_0xa28a('0x4'),'appdata':_0xa28a('0xc')+_0x50ad8c['id'],'context':_0x50ad8c[_0xa28a('0x5')],'exten':_0x50ad8c['exten'],'priority':_0x3e0341++,'VoiceExtensionId':_0x50ad8c['id']});}_0x318600[_0xa28a('0xd')]({'type':_0x50ad8c[_0xa28a('0x3')],'app':'Set','appdata':_0xa28a('0xe'),'context':_0x50ad8c[_0xa28a('0x5')],'exten':_0x50ad8c[_0xa28a('0x6')],'priority':_0x3e0341++,'VoiceExtensionId':_0x50ad8c['id']},{'type':_0x50ad8c[_0xa28a('0x3')],'app':_0xa28a('0x4'),'appdata':_0xa28a('0xf'),'context':_0x50ad8c[_0xa28a('0x5')],'exten':_0x50ad8c[_0xa28a('0x6')],'priority':_0x3e0341++,'VoiceExtensionId':_0x50ad8c['id']},{'type':_0x50ad8c[_0xa28a('0x3')],'app':_0xa28a('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x50ad8c[_0xa28a('0x5')],'exten':_0x50ad8c[_0xa28a('0x6')],'priority':_0x3e0341++,'VoiceExtensionId':_0x50ad8c['id']});return _0x318600;}function _0x15116a(_0x5ee2ee){var _0x15d22f=0x2;var _0x121d4e=[{'type':_0xa28a('0x10'),'app':_0xa28a('0x4'),'appdata':_0xa28a('0x11'),'context':_0x5ee2ee['context'],'exten':_0x5ee2ee['exten'],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':_0x5ee2ee['alias']?'Set':_0xa28a('0x8'),'appdata':_0x5ee2ee[_0xa28a('0x7')]?_0xa28a('0x9')+_0x5ee2ee[_0xa28a('0x7')]:_0xa28a('0xa'),'context':_0x5ee2ee[_0xa28a('0x5')],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':_0xa28a('0x4'),'appdata':_0xa28a('0x12')+(_0x5ee2ee[_0xa28a('0x13')]?_0xa28a('0x14')+_0x5ee2ee['cutdigits']+'}':_0xa28a('0x15')),'context':_0x5ee2ee[_0xa28a('0x5')],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':'outbound','app':_0xa28a('0x4'),'appdata':_0xa28a('0xc')+_0x5ee2ee['id'],'context':_0x5ee2ee['context'],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':_0xa28a('0x16'),'appdata':_0xa28a('0x17')+(_0x15d22f+0x2)+_0xa28a('0x18')+(_0x15d22f+0x1)+')','context':_0x5ee2ee['context'],'exten':_0x5ee2ee['exten'],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':'Set','appdata':_0x5ee2ee[_0xa28a('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x5ee2ee['cutdigits']+'}':_0xa28a('0x19'),'context':_0x5ee2ee[_0xa28a('0x5')],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':'Set','appdata':_0xa28a('0xe'),'context':_0x5ee2ee['context'],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':_0xa28a('0x4'),'appdata':_0xa28a('0xf'),'context':_0x5ee2ee[_0xa28a('0x5')],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':_0xa28a('0x4'),'appdata':_0xa28a('0x1a'),'context':_0x5ee2ee[_0xa28a('0x5')],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':'outbound','app':_0xa28a('0x4'),'appdata':'outboundrouteid='+_0x5ee2ee['id'],'context':_0x5ee2ee[_0xa28a('0x5')],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']}];if(_0x5ee2ee[_0xa28a('0x1b')]('recordingFormat')&&_0x5ee2ee[_0xa28a('0x1c')]!==_0xa28a('0x1d')){_0x121d4e[_0xa28a('0xd')]({'type':_0xa28a('0x10'),'app':'Set','appdata':_0xa28a('0x1e'),'context':_0x5ee2ee[_0xa28a('0x5')],'exten':_0x5ee2ee['exten'],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']},{'type':_0xa28a('0x10'),'app':_0xa28a('0x4'),'appdata':_0xa28a('0x1f')+_0x5ee2ee[_0xa28a('0x1c')]||_0xa28a('0x20'),'context':_0x5ee2ee['context'],'exten':_0x5ee2ee[_0xa28a('0x6')],'priority':_0x15d22f++,'VoiceExtensionId':_0x5ee2ee['id']});}return _0x121d4e;}function _0xb7819c(_0xec3151,_0x501dbf){var _0x451c05=[{'name':_0xa28a('0x21'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xa28a('0x22'),'param':0x2},{'name':_0xa28a('0x23'),'param':0x3}];var _0x304efd={};var _0x3ecd09=_0x501dbf['split'](',');var _0x2d74d1=[];for(var _0x41fe6c=0x0;_0x41fe6c<_0x451c05[_0xa28a('0x24')];_0x41fe6c++){switch(_0x451c05[_0x41fe6c][_0xa28a('0x25')]){case _0xa28a('0x21'):_0x304efd['trunk']=_0x3ecd09[_0x451c05[_0x41fe6c][_0xa28a('0x26')]][_0xa28a('0x27')]('/')[0x1];_0x304efd[_0xa28a('0x28')]=_0x3ecd09[_0x451c05[_0x41fe6c]['param']][_0xa28a('0x27')]('/')[0x2];_0x304efd['prefix']=_0x304efd['phone']?_0x304efd[_0xa28a('0x28')][_0xa28a('0x27')]('$')[0x0]:undefined;_0x304efd[_0xa28a('0x28')]=_0xec3151[_0xa28a('0x13')]?(_0x304efd['prefix']||'')+_0xa28a('0x14')+_0xec3151['cutdigits']+'}':(_0x304efd[_0xa28a('0x29')]||'')+'${EXTEN}';_0x2d74d1[_0x451c05[_0x41fe6c][_0xa28a('0x26')]]=[_0xa28a('0x2a'),_0x304efd[_0xa28a('0x21')],_0x304efd[_0xa28a('0x28')]][_0xa28a('0x2b')]('/');break;case _0xa28a('0x22'):_0x304efd['options']=_0x3ecd09[_0x451c05[_0x41fe6c][_0xa28a('0x26')]];if(_0xec3151[_0xa28a('0x1c')]!=='none'){if(_0x304efd[_0xa28a('0x22')][_0xa28a('0x2c')](_0xa28a('0x2d'))<0x0){_0x304efd[_0xa28a('0x22')]+=_0xa28a('0x2d');}}else{_0x304efd[_0xa28a('0x22')]=_0x304efd[_0xa28a('0x22')][_0xa28a('0x2e')](_0xa28a('0x2d'),'');}_0x2d74d1[_0x451c05[_0x41fe6c][_0xa28a('0x26')]]=_0x304efd[_0xa28a('0x22')];break;default:_0x2d74d1[_0x451c05[_0x41fe6c][_0xa28a('0x26')]]=_0x3ecd09[_0x451c05[_0x41fe6c][_0xa28a('0x26')]];}}return _0x2d74d1[_0xa28a('0x2b')](',');}function _0x5716e0(_0x7efa20,_0x4b1b1a,_0x30d188){return new Promise(function(_0x3cd2db,_0x5b4dfe){var _0x4db2f7=[];if(_[_0xa28a('0x2f')](_0x4b1b1a))return _0x3cd2db(_0x4db2f7);_0x36c789[_0xa28a('0x30')]['findAll']({'attributes':['id',_0xa28a('0x31'),_0xa28a('0x32')],'raw':!![]})['then'](function(_0x2ebe46){for(var _0x4e2e4e=0x0,_0x1dcc40=0x0;_0x4e2e4e<_0x4b1b1a['length'];_0x4e2e4e++,_0x1dcc40=0x0){var _0x588be2=_0x4b1b1a[_0x4e2e4e];var _0x536da8=[];var _0x3b7520=[];delete _0x588be2['id'];if(_0x588be2[_0xa28a('0x31')]!==_0xa28a('0x33')){_0x588be2[_0xa28a('0x34')]=[_0x588be2[_0xa28a('0x31')]];}else{_0x588be2['intervals']=_0x588be2[_0xa28a('0x32')]?_[_0xa28a('0x35')](_[_0xa28a('0x36')](_0x2ebe46,{'IntervalId':_0x588be2[_0xa28a('0x32')]}),_0xa28a('0x31')):[];}_0x588be2[_0xa28a('0x5')]=_0x7efa20[_0xa28a('0x5')];_0x588be2[_0xa28a('0x6')]=_0x7efa20[_0xa28a('0x6')];if(_0x588be2[_0xa28a('0x3')])_0x588be2[_0xa28a('0x3')]=_0x588be2['type'][_0xa28a('0x37')]();if(_0x7efa20[_0xa28a('0x3')]==='outbound'){if(_0x588be2[_0xa28a('0x1b')](_0xa28a('0x38'))&&_0x588be2[_0xa28a('0x38')]&&_0x588be2['tag']!=='--'){_0x536da8['push']({'type':_0x588be2[_0xa28a('0x3')][_0xa28a('0x37')](),'app':'Set','appdata':_0xa28a('0x39')+_0x588be2['tag'],'context':_0x7efa20['context'],'exten':_0x7efa20[_0xa28a('0x6')],'priority':_0x588be2[_0xa28a('0x34')][_0xa28a('0x24')]+_0x30d188+_0x1dcc40++,'VoiceExtensionId':_0x7efa20['id']});}_0x536da8[_0xa28a('0xd')]({'type':_0x588be2[_0xa28a('0x3')][_0xa28a('0x37')](),'app':_0xa28a('0x16'),'appdata':_0xa28a('0x3a')+(_0x588be2['callerID']?_0xa28a('0x3b')+_0x588be2[_0xa28a('0x3c')]+')':_0xa28a('0x3d')),'context':_0x7efa20[_0xa28a('0x5')],'exten':_0x7efa20[_0xa28a('0x6')],'priority':_0x588be2[_0xa28a('0x34')][_0xa28a('0x24')]+_0x30d188+_0x1dcc40++,'VoiceExtensionId':_0x7efa20['id']});}else{if(_0x588be2[_0xa28a('0x1b')](_0xa28a('0x3e'))){if([_0xa28a('0x3f'),_0xa28a('0x40')][_0xa28a('0x41')](_0x588be2['app'][_0xa28a('0x37')]())&&_0x588be2[_0xa28a('0x42')]!==_0xa28a('0x43')){if(_0x588be2['answer']){_0x536da8['push']({'type':_0x588be2[_0xa28a('0x3')][_0xa28a('0x37')](),'app':_0xa28a('0x16'),'appdata':_0xa28a('0x44'),'context':_0x7efa20[_0xa28a('0x5')],'exten':_0x7efa20[_0xa28a('0x6')],'priority':_0x588be2['intervals']['length']+_0x30d188+_0x1dcc40++,'VoiceExtensionId':_0x7efa20['id']});_0x536da8[_0xa28a('0xd')]({'type':_0x588be2[_0xa28a('0x3')][_0xa28a('0x37')](),'app':_0xa28a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x7efa20[_0xa28a('0x5')],'exten':_0x7efa20['exten'],'priority':_0x588be2[_0xa28a('0x34')][_0xa28a('0x24')]+_0x30d188+_0x1dcc40++,'VoiceExtensionId':_0x7efa20['id']});}else{_0x536da8['push']({'type':_0x588be2[_0xa28a('0x3')][_0xa28a('0x37')](),'app':_0xa28a('0x16'),'appdata':_0xa28a('0x45'),'context':_0x7efa20['context'],'exten':_0x7efa20[_0xa28a('0x6')],'priority':_0x588be2[_0xa28a('0x34')]['length']+_0x30d188+_0x1dcc40++,'VoiceExtensionId':_0x7efa20['id']});_0x536da8['push']({'type':_0x588be2[_0xa28a('0x3')][_0xa28a('0x37')](),'app':_0xa28a('0x4'),'appdata':_0xa28a('0x46'),'context':_0x7efa20[_0xa28a('0x5')],'exten':_0x7efa20['exten'],'priority':_0x588be2[_0xa28a('0x34')]['length']+_0x30d188+_0x1dcc40++,'VoiceExtensionId':_0x7efa20['id']});}}}}for(var _0x3cb7d3=0x0;_0x3cb7d3<_0x588be2[_0xa28a('0x34')][_0xa28a('0x24')];_0x3cb7d3++){var _0x3d6e0a=_0x30d188+_0x588be2[_0xa28a('0x34')][_0xa28a('0x24')];var _0x355eb9=_0x3cb7d3===_0x588be2['intervals'][_0xa28a('0x24')]-0x1?_0x30d188+_0x536da8[_0xa28a('0x24')]+_0x3b7520['length']+0x2:_0x30d188+_0x3cb7d3+0x1;_0x536da8[_0xa28a('0x47')](_0x3cb7d3,0x0,{'type':_0x7efa20['type'],'app':_0xa28a('0x48'),'appdata':_0x588be2[_0xa28a('0x34')][_0x3cb7d3]+'?'+_0x7efa20[_0xa28a('0x5')]+',${EXTEN},'+_0x3d6e0a+':'+_0x7efa20['context']+_0xa28a('0x49')+_0x355eb9,'exten':_0x7efa20[_0xa28a('0x6')],'context':_0x7efa20[_0xa28a('0x5')],'priority':_0x30d188+_0x3cb7d3,'VoiceExtensionId':_0x7efa20['id']});}if(_0x588be2[_0xa28a('0x42')]===_0xa28a('0x4a'))_0x588be2[_0xa28a('0x4b')]=_0xb7819c(_0x7efa20,_0x588be2[_0xa28a('0x4b')]);_0x588be2[_0xa28a('0x4c')]=_0x536da8['length']?_[_0xa28a('0x4d')](_0x536da8)[_0xa28a('0x4c')]+0x1:_0x30d188;_0x4db2f7=_[_0xa28a('0x4e')](_0x4db2f7,_0x536da8,[_0x588be2],_0x3b7520);_0x30d188=_[_0xa28a('0x4d')](_0x4db2f7)[_0xa28a('0x4c')]+0x1;}return _0x3cd2db(_0x4db2f7);})[_0xa28a('0x4f')](function(_0x5a2c0a){_0x5b4dfe(_0x5a2c0a);});});}return _0x8af9dd[_0xa28a('0x50')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x432f55){var _0x35c7ff=this['get']({'plain':!![]});var _0x3771a7=_0x35c7ff[_0xa28a('0x3')]==='outbound'?_0x15116a(_0x35c7ff):_0x3227b6(_0x35c7ff);return _0x5716e0(_0x35c7ff,_0x432f55,_[_0xa28a('0x4d')](_0x3771a7)[_0xa28a('0x4c')]+0x1)[_0xa28a('0x51')](function(_0x3dcb78){var _0xe2df20=_['concat'](_0x3771a7,_0x3dcb78);_0xe2df20[_0xa28a('0xd')]({'type':_0x35c7ff[_0xa28a('0x3')],'app':_0xa28a('0x52'),'exten':_0x35c7ff[_0xa28a('0x6')],'context':_0x35c7ff[_0xa28a('0x5')],'priority':_[_0xa28a('0x4d')](_0xe2df20)['priority']+0x1,'VoiceExtensionId':_0x35c7ff['id']});return _0xe2df20;});}}});}; \ No newline at end of file +var _0xe8a4=['param','phone','prefix','${EXTEN:','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','intervals','map','hasOwnProperty','tag','toLowerCase','CDR(tag)=','ExecIf','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','priority','concat','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','split','name'];(function(_0x145ccf,_0x5e670a){var _0x2967ab=function(_0x157795){while(--_0x157795){_0x145ccf['push'](_0x145ccf['shift']());}};_0x2967ab(++_0x5e670a);}(_0xe8a4,0x158));var _0x4e8a=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xe8a4[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x4e8a('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x4e8a('0x1')]=function(_0x5737b5){var _0x31cd4d=_0x5737b5[_0x4e8a('0x2')];function _0x44933f(_0x51ee1e){var _0x9d4261=0x2;var _0x2131a1=[{'type':_0x51ee1e['type'],'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x4')+_0x51ee1e[_0x4e8a('0x5')],'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']},{'type':_0x51ee1e[_0x4e8a('0x5')],'app':_0x51ee1e[_0x4e8a('0x8')]?_0x4e8a('0x3'):_0x4e8a('0x9'),'appdata':_0x51ee1e[_0x4e8a('0x8')]?'CDR(routeAlias)='+_0x51ee1e[_0x4e8a('0x8')]:_0x4e8a('0xa'),'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']}];if(_0x51ee1e['type']===_0x4e8a('0xb')){_0x2131a1[_0x4e8a('0xc')]({'type':'inbound','app':_0x4e8a('0x3'),'appdata':_0x4e8a('0xd')+_0x51ee1e['id'],'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']});}_0x2131a1['push']({'type':_0x51ee1e[_0x4e8a('0x5')],'app':'Set','appdata':_0x4e8a('0xe'),'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']},{'type':_0x51ee1e['type'],'app':_0x4e8a('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']},{'type':_0x51ee1e[_0x4e8a('0x5')],'app':'Set','appdata':_0x4e8a('0xf'),'context':_0x51ee1e[_0x4e8a('0x6')],'exten':_0x51ee1e[_0x4e8a('0x7')],'priority':_0x9d4261++,'VoiceExtensionId':_0x51ee1e['id']});return _0x2131a1;}function _0x13eb23(_0x5460e8){var _0x2390e4=0x2;var _0x541bdb=[{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x11'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x5460e8[_0x4e8a('0x8')]?_0x4e8a('0x3'):_0x4e8a('0x9'),'appdata':_0x5460e8['alias']?'CDR(routeAlias)='+_0x5460e8['alias']:_0x4e8a('0xa'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':'CDR(destination)='+(_0x5460e8['cutdigits']?'${EXTEN:'+_0x5460e8['cutdigits']+'}':_0x4e8a('0x12')),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':_0x4e8a('0xd')+_0x5460e8['id'],'context':_0x5460e8['context'],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':'ExecIf','appdata':_0x4e8a('0x13')+(_0x2390e4+0x2)+'):Goto('+(_0x2390e4+0x1)+')','context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x5460e8['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x5460e8[_0x4e8a('0x14')]+'}':_0x4e8a('0x15'),'context':_0x5460e8['context'],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x16'),'context':_0x5460e8['context'],'exten':_0x5460e8['exten'],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':_0x4e8a('0xf'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8['exten'],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':_0x4e8a('0x10'),'app':'Set','appdata':_0x4e8a('0x17')+_0x5460e8['id'],'context':_0x5460e8['context'],'exten':_0x5460e8['exten'],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']}];if(_0x5460e8['hasOwnProperty']('recordingFormat')&&_0x5460e8[_0x4e8a('0x18')]!==_0x4e8a('0x19')){_0x541bdb[_0x4e8a('0xc')]({'type':_0x4e8a('0x10'),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x1a'),'context':_0x5460e8[_0x4e8a('0x6')],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']},{'type':'outbound','app':_0x4e8a('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5460e8[_0x4e8a('0x18')]||_0x4e8a('0x1b'),'context':_0x5460e8['context'],'exten':_0x5460e8[_0x4e8a('0x7')],'priority':_0x2390e4++,'VoiceExtensionId':_0x5460e8['id']});}return _0x541bdb;}function _0x5168b2(_0x363c63,_0x21af7d){var _0x82a02c=[{'name':_0x4e8a('0x1c'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x17340f={};var _0x5e79ea=_0x21af7d[_0x4e8a('0x1d')](',');var _0xc4e355=[];for(var _0x37ca6e=0x0;_0x37ca6e<_0x82a02c['length'];_0x37ca6e++){switch(_0x82a02c[_0x37ca6e][_0x4e8a('0x1e')]){case _0x4e8a('0x1c'):_0x17340f[_0x4e8a('0x1c')]=_0x5e79ea[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]][_0x4e8a('0x1d')]('/')[0x1];_0x17340f[_0x4e8a('0x20')]=_0x5e79ea[_0x82a02c[_0x37ca6e]['param']]['split']('/')[0x2];_0x17340f['prefix']=_0x17340f[_0x4e8a('0x20')]?_0x17340f[_0x4e8a('0x20')][_0x4e8a('0x1d')]('$')[0x0]:undefined;_0x17340f[_0x4e8a('0x20')]=_0x363c63[_0x4e8a('0x14')]?(_0x17340f[_0x4e8a('0x21')]||'')+_0x4e8a('0x22')+_0x363c63[_0x4e8a('0x14')]+'}':(_0x17340f['prefix']||'')+'${EXTEN}';_0xc4e355[_0x82a02c[_0x37ca6e]['param']]=['SIP',_0x17340f[_0x4e8a('0x1c')],_0x17340f['phone']][_0x4e8a('0x23')]('/');break;case _0x4e8a('0x24'):_0x17340f[_0x4e8a('0x24')]=_0x5e79ea[_0x82a02c[_0x37ca6e]['param']];if(_0x363c63[_0x4e8a('0x18')]!==_0x4e8a('0x19')){if(_0x17340f['options'][_0x4e8a('0x25')](_0x4e8a('0x26'))<0x0){_0x17340f['options']+='U(xcally-mixmonitor-context)';}}else{_0x17340f[_0x4e8a('0x24')]=_0x17340f[_0x4e8a('0x24')]['replace'](_0x4e8a('0x26'),'');}_0xc4e355[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]]=_0x17340f[_0x4e8a('0x24')];break;default:_0xc4e355[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]]=_0x5e79ea[_0x82a02c[_0x37ca6e][_0x4e8a('0x1f')]];}}return _0xc4e355[_0x4e8a('0x23')](',');}function _0x584188(_0x2e389f,_0x503838,_0x18aa1a){return new Promise(function(_0x21e2b9,_0x5c00d3){var _0x896114=[];if(_[_0x4e8a('0x27')](_0x503838))return _0x21e2b9(_0x896114);_0x31cd4d[_0x4e8a('0x28')][_0x4e8a('0x29')]({'attributes':['id',_0x4e8a('0x2a'),_0x4e8a('0x2b')],'raw':!![]})[_0x4e8a('0x2c')](function(_0x52b2be){for(var _0x1309bd=0x0,_0x47c1fa=0x0;_0x1309bd<_0x503838[_0x4e8a('0x2d')];_0x1309bd++,_0x47c1fa=0x0){var _0x599b80=_0x503838[_0x1309bd];var _0x32d99d=[];var _0x37f7df=[];delete _0x599b80['id'];if(_0x599b80[_0x4e8a('0x2a')]!=='*,*,*,*'){_0x599b80[_0x4e8a('0x2e')]=[_0x599b80['interval']];}else{_0x599b80['intervals']=_0x599b80[_0x4e8a('0x2b')]?_[_0x4e8a('0x2f')](_['filter'](_0x52b2be,{'IntervalId':_0x599b80['IntervalId']}),'interval'):[];}_0x599b80[_0x4e8a('0x6')]=_0x2e389f[_0x4e8a('0x6')];_0x599b80[_0x4e8a('0x7')]=_0x2e389f[_0x4e8a('0x7')];if(_0x599b80[_0x4e8a('0x5')])_0x599b80['type']=_0x599b80[_0x4e8a('0x5')]['toLowerCase']();if(_0x2e389f['type']===_0x4e8a('0x10')){if(_0x599b80[_0x4e8a('0x30')](_0x4e8a('0x31'))&&_0x599b80[_0x4e8a('0x31')]&&_0x599b80[_0x4e8a('0x31')]!=='--'){_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':_0x4e8a('0x3'),'appdata':_0x4e8a('0x33')+_0x599b80[_0x4e8a('0x31')],'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f['exten'],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}_0x32d99d['push']({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':_0x4e8a('0x34'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x599b80[_0x4e8a('0x35')]?_0x4e8a('0x36')+_0x599b80[_0x4e8a('0x35')]+')':_0x4e8a('0x37')),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f['exten'],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}else{if(_0x599b80[_0x4e8a('0x30')](_0x4e8a('0x38'))){if([_0x4e8a('0x39'),_0x4e8a('0x3a')]['includes'](_0x599b80[_0x4e8a('0x3b')][_0x4e8a('0x32')]())&&_0x599b80[_0x4e8a('0x3c')]!=='custom'){if(_0x599b80[_0x4e8a('0x38')]){_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':_0x4e8a('0x34'),'appdata':_0x4e8a('0x3d'),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f['exten'],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80['type']['toLowerCase'](),'app':'Set','appdata':_0x4e8a('0x3e'),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f[_0x4e8a('0x7')],'priority':_0x599b80['intervals']['length']+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}else{_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80['type']['toLowerCase'](),'app':_0x4e8a('0x34'),'appdata':_0x4e8a('0x3f'),'context':_0x2e389f['context'],'exten':_0x2e389f[_0x4e8a('0x7')],'priority':_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')]+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});_0x32d99d[_0x4e8a('0xc')]({'type':_0x599b80[_0x4e8a('0x5')][_0x4e8a('0x32')](),'app':'Set','appdata':_0x4e8a('0x40'),'context':_0x2e389f[_0x4e8a('0x6')],'exten':_0x2e389f[_0x4e8a('0x7')],'priority':_0x599b80['intervals']['length']+_0x18aa1a+_0x47c1fa++,'VoiceExtensionId':_0x2e389f['id']});}}}}for(var _0x3f04ce=0x0;_0x3f04ce<_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')];_0x3f04ce++){var _0xd3785a=_0x18aa1a+_0x599b80[_0x4e8a('0x2e')][_0x4e8a('0x2d')];var _0x4b5831=_0x3f04ce===_0x599b80[_0x4e8a('0x2e')]['length']-0x1?_0x18aa1a+_0x32d99d[_0x4e8a('0x2d')]+_0x37f7df[_0x4e8a('0x2d')]+0x2:_0x18aa1a+_0x3f04ce+0x1;_0x32d99d[_0x4e8a('0x41')](_0x3f04ce,0x0,{'type':_0x2e389f['type'],'app':'GotoIfTime','appdata':_0x599b80[_0x4e8a('0x2e')][_0x3f04ce]+'?'+_0x2e389f[_0x4e8a('0x6')]+',${EXTEN},'+_0xd3785a+':'+_0x2e389f[_0x4e8a('0x6')]+_0x4e8a('0x42')+_0x4b5831,'exten':_0x2e389f[_0x4e8a('0x7')],'context':_0x2e389f['context'],'priority':_0x18aa1a+_0x3f04ce,'VoiceExtensionId':_0x2e389f['id']});}if(_0x599b80['appType']==='outboundDial')_0x599b80['appdata']=_0x5168b2(_0x2e389f,_0x599b80['appdata']);_0x599b80['priority']=_0x32d99d[_0x4e8a('0x2d')]?_[_0x4e8a('0x43')](_0x32d99d)[_0x4e8a('0x44')]+0x1:_0x18aa1a;_0x896114=_[_0x4e8a('0x45')](_0x896114,_0x32d99d,[_0x599b80],_0x37f7df);_0x18aa1a=_['last'](_0x896114)[_0x4e8a('0x44')]+0x1;}return _0x21e2b9(_0x896114);})[_0x4e8a('0x46')](function(_0x30ce5a){_0x5c00d3(_0x30ce5a);});});}return _0x5737b5[_0x4e8a('0x47')](_0x4e8a('0x48'),attributes,{'tableName':_0x4e8a('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1a807a){var _0x182c57=this['get']({'plain':!![]});var _0x20752d=_0x182c57[_0x4e8a('0x5')]===_0x4e8a('0x10')?_0x13eb23(_0x182c57):_0x44933f(_0x182c57);return _0x584188(_0x182c57,_0x1a807a,_[_0x4e8a('0x43')](_0x20752d)[_0x4e8a('0x44')]+0x1)[_0x4e8a('0x2c')](function(_0x3976de){var _0x5ad7f7=_[_0x4e8a('0x45')](_0x20752d,_0x3976de);_0x5ad7f7['push']({'type':_0x182c57['type'],'app':_0x4e8a('0x4a'),'exten':_0x182c57['exten'],'context':_0x182c57['context'],'priority':_[_0x4e8a('0x43')](_0x5ad7f7)[_0x4e8a('0x44')]+0x1,'VoiceExtensionId':_0x182c57['id']});return _0x5ad7f7;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index a6fbc19..cd8ce1a 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 _0x6003=['../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x38cb39,_0x252cab){var _0x1da539=function(_0x3cff6a){while(--_0x3cff6a){_0x38cb39['push'](_0x38cb39['shift']());}};_0x1da539(++_0x252cab);}(_0x6003,0xae));var _0x3600=function(_0x1149f3,_0x24d796){_0x1149f3=_0x1149f3-0x0;var _0x277503=_0x6003[_0x1149f3];return _0x277503;};'use strict';var _=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var moment=require(_0x3600('0x2'));var BPromise=require(_0x3600('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3600('0x4'))['db'];var utils=require(_0x3600('0x5'));var logger=require(_0x3600('0x6'))('rpc');var config=require(_0x3600('0x7'));var jayson=require(_0x3600('0x8'));var client=jayson['client'][_0x3600('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3600('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3600('0xb'))(new Redis(config['redis']));require(_0x3600('0xc'))[_0x3600('0xd')](socket);function respondWithRpcPromise(_0xb42a2f,_0x18f52a,_0x5b30c1){return new BPromise(function(_0x1ae5d2,_0x2c4b45){return client[_0x3600('0xe')](_0xb42a2f,_0x5b30c1)[_0x3600('0xf')](function(_0x43b701){logger[_0x3600('0x10')](_0x3600('0x11'),_0x18f52a,_0x3600('0x12'));logger[_0x3600('0x13')](_0x3600('0x14'),_0x18f52a,_0x3600('0x12'),JSON[_0x3600('0x15')](_0x43b701));if(_0x43b701['error']){if(_0x43b701[_0x3600('0x16')]['code']===0x1f4){logger['error'](_0x3600('0x11'),_0x18f52a,_0x43b701[_0x3600('0x16')][_0x3600('0x17')]);return _0x2c4b45(_0x43b701['error'][_0x3600('0x17')]);}logger['error'](_0x3600('0x11'),_0x18f52a,_0x43b701['error'][_0x3600('0x17')]);return _0x1ae5d2(_0x43b701[_0x3600('0x16')][_0x3600('0x17')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x18f52a,_0x3600('0x12'));_0x1ae5d2(_0x43b701[_0x3600('0x18')][_0x3600('0x17')]);}})[_0x3600('0x19')](function(_0x4bfb07){logger[_0x3600('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x18f52a,_0x4bfb07);_0x2c4b45(_0x4bfb07);});});}exports[_0x3600('0x1a')]=function(_0x3d2830){var _0xaaa5a9=this;return new Promise(function(_0x4827c4,_0x8390c1){return db['VoiceExtension'][_0x3600('0x1b')]({'raw':_0x3d2830[_0x3600('0x1c')]?_0x3d2830[_0x3600('0x1c')][_0x3600('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d2830[_0x3600('0x1c')]?_0x3d2830['options'][_0x3600('0x1e')]||null:null,'attributes':_0x3d2830[_0x3600('0x1c')]?_0x3d2830[_0x3600('0x1c')][_0x3600('0x1f')]||null:null,'limit':_0x3d2830[_0x3600('0x1c')]?_0x3d2830[_0x3600('0x1c')][_0x3600('0x20')]||null:null,'include':_0x3d2830[_0x3600('0x1c')]?_0x3d2830[_0x3600('0x1c')][_0x3600('0x21')]?_[_0x3600('0x22')](_0x3d2830['options'][_0x3600('0x21')],function(_0x50a222){return{'model':db[_0x50a222[_0x3600('0x23')]],'as':_0x50a222['as'],'attributes':_0x50a222['attributes'],'include':_0x50a222[_0x3600('0x21')]?_[_0x3600('0x22')](_0x50a222[_0x3600('0x21')],function(_0x32bfef){return{'model':db[_0x32bfef[_0x3600('0x23')]],'as':_0x32bfef['as'],'attributes':_0x32bfef[_0x3600('0x1f')],'include':_0x32bfef['include']?_[_0x3600('0x22')](_0x32bfef[_0x3600('0x21')],function(_0x5580b9){return{'model':db[_0x5580b9[_0x3600('0x23')]],'as':_0x5580b9['as'],'attributes':_0x5580b9[_0x3600('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3600('0xf')](function(_0x861d1){logger[_0x3600('0x10')](_0x3600('0x1a'),_0x3d2830);logger[_0x3600('0x13')](_0x3600('0x1a'),_0x3d2830,JSON['stringify'](_0x861d1));_0x4827c4(_0x861d1);})['catch'](function(_0x386e47){logger['error'](_0x3600('0x1a'),_0x386e47[_0x3600('0x17')],_0x3d2830);_0x8390c1(_0xaaa5a9[_0x3600('0x16')](0x1f4,_0x386e47['message']));});});}; \ No newline at end of file +var _0x44e8=['../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetVoiceExtension','findAll','raw','options','where','attributes','limit','include','map','model','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x497e1f,_0x465ee5){var _0x3c7b2a=function(_0x3cb5c5){while(--_0x3cb5c5){_0x497e1f['push'](_0x497e1f['shift']());}};_0x3c7b2a(++_0x465ee5);}(_0x44e8,0xd7));var _0x844e=function(_0x255f70,_0x4f3c97){_0x255f70=_0x255f70-0x0;var _0x3e153b=_0x44e8[_0x255f70];return _0x3e153b;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x844e('0x1'));var rs=require(_0x844e('0x2'));var fs=require('fs');var Redis=require(_0x844e('0x3'));var db=require(_0x844e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x844e('0x5'))(_0x844e('0x6'));var config=require(_0x844e('0x7'));var jayson=require(_0x844e('0x8'));var client=jayson['client'][_0x844e('0x9')]({'port':0x232a});config[_0x844e('0xa')]=_[_0x844e('0xb')](config[_0x844e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x844e('0xc'))(new Redis(config[_0x844e('0xa')]));require(_0x844e('0xd'))[_0x844e('0xe')](socket);function respondWithRpcPromise(_0x32c6c7,_0x1f9921,_0x536601){return new BPromise(function(_0x39ef28,_0x1b4cf6){return client[_0x844e('0xf')](_0x32c6c7,_0x536601)[_0x844e('0x10')](function(_0x14909f){logger[_0x844e('0x11')](_0x844e('0x12'),_0x1f9921,'request\x20sent');logger[_0x844e('0x13')](_0x844e('0x14'),_0x1f9921,'request\x20sent',JSON[_0x844e('0x15')](_0x14909f));if(_0x14909f[_0x844e('0x16')]){if(_0x14909f['error'][_0x844e('0x17')]===0x1f4){logger[_0x844e('0x16')](_0x844e('0x12'),_0x1f9921,_0x14909f['error'][_0x844e('0x18')]);return _0x1b4cf6(_0x14909f[_0x844e('0x16')][_0x844e('0x18')]);}logger[_0x844e('0x16')](_0x844e('0x12'),_0x1f9921,_0x14909f[_0x844e('0x16')][_0x844e('0x18')]);return _0x39ef28(_0x14909f[_0x844e('0x16')]['message']);}else{logger[_0x844e('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x1f9921,_0x844e('0x19'));_0x39ef28(_0x14909f['result'][_0x844e('0x18')]);}})['catch'](function(_0x43f05d){logger[_0x844e('0x16')](_0x844e('0x12'),_0x1f9921,_0x43f05d);_0x1b4cf6(_0x43f05d);});});}exports[_0x844e('0x1a')]=function(_0x3ea7da){var _0x2b58c7=this;return new Promise(function(_0x181afd,_0x243aeb){return db['VoiceExtension'][_0x844e('0x1b')]({'raw':_0x3ea7da['options']?_0x3ea7da['options'][_0x844e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ea7da[_0x844e('0x1d')]?_0x3ea7da[_0x844e('0x1d')][_0x844e('0x1e')]||null:null,'attributes':_0x3ea7da['options']?_0x3ea7da[_0x844e('0x1d')][_0x844e('0x1f')]||null:null,'limit':_0x3ea7da['options']?_0x3ea7da[_0x844e('0x1d')][_0x844e('0x20')]||null:null,'include':_0x3ea7da[_0x844e('0x1d')]?_0x3ea7da[_0x844e('0x1d')][_0x844e('0x21')]?_[_0x844e('0x22')](_0x3ea7da['options'][_0x844e('0x21')],function(_0xadf0d8){return{'model':db[_0xadf0d8[_0x844e('0x23')]],'as':_0xadf0d8['as'],'attributes':_0xadf0d8[_0x844e('0x1f')],'include':_0xadf0d8[_0x844e('0x21')]?_['map'](_0xadf0d8[_0x844e('0x21')],function(_0x5080c1){return{'model':db[_0x5080c1['model']],'as':_0x5080c1['as'],'attributes':_0x5080c1[_0x844e('0x1f')],'include':_0x5080c1[_0x844e('0x21')]?_[_0x844e('0x22')](_0x5080c1['include'],function(_0x489349){return{'model':db[_0x489349[_0x844e('0x23')]],'as':_0x489349['as'],'attributes':_0x489349[_0x844e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x228cc1){logger[_0x844e('0x11')](_0x844e('0x1a'),_0x3ea7da);logger[_0x844e('0x13')](_0x844e('0x1a'),_0x3ea7da,JSON[_0x844e('0x15')](_0x228cc1));_0x181afd(_0x228cc1);})[_0x844e('0x24')](function(_0x2a06a){logger[_0x844e('0x16')](_0x844e('0x1a'),_0x2a06a['message'],_0x3ea7da);_0x243aeb(_0x2b58c7[_0x844e('0x16')](0x1f4,_0x2a06a[_0x844e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 383633a..22b6eec 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x2556b8,_0x1a8b1b){var _0xaa49be=function(_0x49f8ff){while(--_0x49f8ff){_0x2556b8['push'](_0x2556b8['shift']());}};_0xaa49be(++_0x1a8b1b);}(_0x7a54,0x106));var _0x47a5=function(_0x19d876,_0x2cc8c3){_0x19d876=_0x19d876-0x0;var _0x51f98d=_0x7a54[_0x19d876];return _0x51f98d;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x43f9f1,_0xb7b8c6){var _0x57cc9b=function(_0x1afefb){while(--_0x1afefb){_0x43f9f1['push'](_0x43f9f1['shift']());}};_0x57cc9b(++_0xb7b8c6);}(_0x7a54,0x106));var _0x47a5=function(_0x5b4b5e,_0x51f5e8){_0x5b4b5e=_0x5b4b5e-0x0;var _0x4fe8e8=_0x7a54[_0x5b4b5e];return _0x4fe8e8;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 6cff3f8..52a91b5 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','/:id/messages','getMessages','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x19c09d,_0x5c2b4a){var _0x4f05ea=function(_0x2d128d){while(--_0x2d128d){_0x19c09d['push'](_0x19c09d['shift']());}};_0x4f05ea(++_0x5c2b4a);}(_0x4975,0x86));var _0x5497=function(_0x58c246,_0x14083b){_0x58c246=_0x58c246-0x0;var _0x513235=_0x4975[_0x58c246];return _0x513235;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x6455=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller'];(function(_0x59a120,_0x1a7c28){var _0x127790=function(_0x2f9b0b){while(--_0x2f9b0b){_0x59a120['push'](_0x59a120['shift']());}};_0x127790(++_0x1a7c28);}(_0x6455,0x97));var _0x5645=function(_0x2fbe65,_0x21a8c6){_0x2fbe65=_0x2fbe65-0x0;var _0x19bc59=_0x6455[_0x2fbe65];return _0x19bc59;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['show']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0xf')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0x10')]);router['put'](_0x5645('0xc'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);router[_0x5645('0x12')]('/:id',auth[_0x5645('0xa')](),controller['destroy']);module[_0x5645('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 82d69e1..ac0b769 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 _0xdeb2=['string','trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email'];(function(_0x1c8c03,_0x10e357){var _0x5ad1fc=function(_0x2358d9){while(--_0x2358d9){_0x1c8c03['push'](_0x1c8c03['shift']());}};_0x5ad1fc(++_0x10e357);}(_0xdeb2,0x1bc));var _0x2deb=function(_0x4ec0bc,_0x47c2a6){_0x4ec0bc=_0x4ec0bc-0x0;var _0x196598=_0xdeb2[_0x4ec0bc];return _0x196598;};'use strict';var Sequelize=require(_0x2deb('0x0'));module[_0x2deb('0x1')]={'customer_id':{'type':Sequelize[_0x2deb('0x2')]},'context':{'type':Sequelize[_0x2deb('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x2deb('0x2')],'defaultValue':'','allowNull':![],'unique':_0x2deb('0x3')},'password':{'type':Sequelize[_0x2deb('0x2')]},'fullname':{'type':Sequelize[_0x2deb('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x501023){this[_0x2deb('0x4')](_0x2deb('0x5'),typeof _0x501023===_0x2deb('0x6')&&_0x501023[_0x2deb('0x7')]()?_0x501023[_0x2deb('0x7')]():null);}},'pager':{'type':Sequelize[_0x2deb('0x2')]},'tz':{'type':Sequelize[_0x2deb('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2deb('0x8')](_0x2deb('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x2deb('0x9'),'no'),'defaultValue':_0x2deb('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2deb('0x2')]},'callback':{'type':Sequelize[_0x2deb('0x2')]},'review':{'type':Sequelize[_0x2deb('0x8')](_0x2deb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x2deb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x2deb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2deb('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2deb('0x8')](_0x2deb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2deb('0x8')](_0x2deb('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x2deb('0x8')](_0x2deb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2deb('0x8')](_0x2deb('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2deb('0x8')](_0x2deb('0x9'),'no'),'defaultValue':_0x2deb('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x2deb('0x2')]},'emailbody':{'type':Sequelize[_0x2deb('0x2')]},'maxsecs':{'type':Sequelize[_0x2deb('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x2deb('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2deb('0xc')],'get':function(){return this[_0x2deb('0xd')]('fullname')+'\x20-\x20'+this[_0x2deb('0xd')](_0x2deb('0xe'));}}}; \ No newline at end of file +var _0x03c6=['email','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x599367,_0x285c06){var _0x1dfcca=function(_0x3d9331){while(--_0x3d9331){_0x599367['push'](_0x599367['shift']());}};_0x1dfcca(++_0x285c06);}(_0x03c6,0x8a));var _0x603c=function(_0x146d41,_0x201c19){_0x146d41=_0x146d41-0x0;var _0x14c98f=_0x03c6[_0x146d41];return _0x14c98f;};'use strict';var Sequelize=require(_0x603c('0x0'));module[_0x603c('0x1')]={'customer_id':{'type':Sequelize[_0x603c('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x603c('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x603c('0x4')},'password':{'type':Sequelize[_0x603c('0x2')]},'fullname':{'type':Sequelize[_0x603c('0x2')]},'email':{'type':Sequelize[_0x603c('0x2')],'validate':{'isEmail':!![]},'set':function(_0xe916a8){this[_0x603c('0x5')](_0x603c('0x6'),typeof _0xe916a8===_0x603c('0x7')&&_0xe916a8[_0x603c('0x8')]()?_0xe916a8[_0x603c('0x8')]():null);}},'pager':{'type':Sequelize[_0x603c('0x2')]},'tz':{'type':Sequelize[_0x603c('0x2')],'defaultValue':_0x603c('0x9')},'attach':{'type':Sequelize['ENUM'](_0x603c('0xa'),'no'),'defaultValue':_0x603c('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x603c('0xb')](_0x603c('0xa'),'no'),'defaultValue':_0x603c('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x603c('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x603c('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x603c('0xb')](_0x603c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x603c('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x603c('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x603c('0xb')](_0x603c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x603c('0xb')](_0x603c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x603c('0xa'),'no'),'defaultValue':_0x603c('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x603c('0xb')](_0x603c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x603c('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x603c('0xb')](_0x603c('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x603c('0xc')},'emailsubject':{'type':Sequelize[_0x603c('0x2')]},'emailbody':{'type':Sequelize[_0x603c('0x2')]},'maxsecs':{'type':Sequelize[_0x603c('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x603c('0xe'))+_0x603c('0xf')+this[_0x603c('0x10')](_0x603c('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c646dc1..5b9493e 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 _0x80ed=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','end','sendStatus','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x4e37bc,_0x8174e7){var _0x48a8b7=function(_0x458409){while(--_0x458409){_0x4e37bc['push'](_0x4e37bc['shift']());}};_0x48a8b7(++_0x8174e7);}(_0x80ed,0x11c));var _0xd80e=function(_0x5e6198,_0x100615){_0x5e6198=_0x5e6198-0x0;var _0xc6b617=_0x80ed[_0x5e6198];return _0xc6b617;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];function respondWithStatusCode(_0x118f53,_0x1d3fcf){_0x1d3fcf=_0x1d3fcf||0xcc;return function(_0x4fb01c){if(_0x4fb01c){return _0x118f53['sendStatus'](_0x1d3fcf);}return _0x118f53['status'](_0x1d3fcf)['end']();};}function respondWithResult(_0x145766,_0x3d233b){_0x3d233b=_0x3d233b||0xc8;return function(_0x3096ae){if(_0x3096ae){return _0x145766[_0xd80e('0x1b')](_0x3d233b)[_0xd80e('0x1c')](_0x3096ae);}};}function respondWithFilteredResult(_0x58a17e,_0x595683){return function(_0x2c8c61){if(_0x2c8c61){var _0x3124e8=typeof _0x595683[_0xd80e('0x1d')]===_0xd80e('0x1e')&&typeof _0x595683[_0xd80e('0x1f')]===_0xd80e('0x1e');var _0x22ab67=_0x2c8c61['count'];var _0x21ceec=_0x3124e8?0x0:_0x595683[_0xd80e('0x1d')];var _0x3b543d=_0x3124e8?_0x2c8c61[_0xd80e('0x20')]:_0x595683['offset']+_0x595683[_0xd80e('0x1f')];var _0x175c67;if(_0x3b543d>=_0x22ab67){_0x3b543d=_0x22ab67;_0x175c67=0xc8;}else{_0x175c67=0xce;}_0x58a17e[_0xd80e('0x1b')](_0x175c67);return _0x58a17e['set'](_0xd80e('0x21'),_0x21ceec+'-'+_0x3b543d+'/'+_0x22ab67)[_0xd80e('0x1c')](_0x2c8c61);}return null;};}function patchUpdates(_0x2765ea){return function(_0x147134){try{jsonpatch[_0xd80e('0x22')](_0x147134,_0x2765ea,!![]);}catch(_0x5509d4){return BPromise['reject'](_0x5509d4);}return _0x147134[_0xd80e('0x23')]();};}function saveUpdates(_0x3fa159,_0x3b39bf){return function(_0x2d46e7){if(_0x2d46e7){return _0x2d46e7[_0xd80e('0x24')](_0x3fa159)[_0xd80e('0x25')](function(_0x43152c){return _0x43152c;});}return null;};}function removeEntity(_0x5430b6,_0x1fbf8a){return function(_0x57d70){if(_0x57d70){return _0x57d70[_0xd80e('0x26')]()['then'](function(){var _0x635ce0=_0x57d70[_0xd80e('0x27')]({'plain':!![]});var _0xe9bb59='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0xe9bb59,'resourceId':_0x635ce0['id']}})[_0xd80e('0x25')](function(){return _0x57d70;});})['then'](function(){_0x5430b6[_0xd80e('0x1b')](0xcc)[_0xd80e('0x28')]();});}};}function handleEntityNotFound(_0x4e8ed9,_0x24bafb){return function(_0xe1c04a){if(!_0xe1c04a){_0x4e8ed9[_0xd80e('0x29')](0x194);}return _0xe1c04a;};}function handleError(_0x46c05d,_0x5376eb){_0x5376eb=_0x5376eb||0x1f4;return function(_0x15f317){logger[_0xd80e('0x2a')](_0x15f317[_0xd80e('0x2b')]);if(_0x15f317[_0xd80e('0x2c')]){delete _0x15f317[_0xd80e('0x2c')];}_0x46c05d[_0xd80e('0x1b')](_0x5376eb)[_0xd80e('0x2d')](_0x15f317);};}exports[_0xd80e('0x2e')]=function(_0x5522dd,_0x54504e){var _0x30f9bd={},_0x1303eb={},_0x400220={'count':0x0,'rows':[]};var _0x32360c=_[_0xd80e('0x2f')](db[_0xd80e('0x30')]['rawAttributes'],function(_0x568d82){return{'name':_0x568d82[_0xd80e('0x31')],'type':_0x568d82[_0xd80e('0x32')][_0xd80e('0x33')]};});_0x1303eb[_0xd80e('0x34')]=_[_0xd80e('0x2f')](_0x32360c,_0xd80e('0x2c'));_0x1303eb[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x5522dd['query']);_0x1303eb['filters']=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],_0x1303eb[_0xd80e('0x35')]);_0x30f9bd[_0xd80e('0x38')]=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x5522dd[_0xd80e('0x35')][_0xd80e('0x39')]));_0x30f9bd[_0xd80e('0x38')]=_0x30f9bd['attributes'][_0xd80e('0x3a')]?_0x30f9bd['attributes']:_0x1303eb[_0xd80e('0x34')];if(!_0x5522dd[_0xd80e('0x35')][_0xd80e('0x3b')](_0xd80e('0x3c'))){_0x30f9bd['limit']=qs[_0xd80e('0x1f')](_0x5522dd['query'][_0xd80e('0x1f')]);_0x30f9bd['offset']=qs[_0xd80e('0x1d')](_0x5522dd[_0xd80e('0x35')]['offset']);}_0x30f9bd[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x5522dd[_0xd80e('0x35')]['sort']);_0x30f9bd[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x5522dd[_0xd80e('0x35')],_0x1303eb[_0xd80e('0x40')]),_0x32360c);if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x42')]){_0x30f9bd[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x30f9bd['where'],{'$or':_['map'](_0x32360c,function(_0x4e92f6){if(_0x4e92f6[_0xd80e('0x32')]!==_0xd80e('0x44')){var _0x55925e={};_0x55925e[_0x4e92f6[_0xd80e('0x2c')]]={'$like':'%'+_0x5522dd['query'][_0xd80e('0x42')]+'%'};return _0x55925e;}})});}_0x30f9bd=_['merge']({},_0x30f9bd,_0x5522dd[_0xd80e('0x45')]);var _0xae1514={'where':_0x30f9bd['where']};return db['VoiceMail'][_0xd80e('0x20')](_0xae1514)[_0xd80e('0x25')](function(_0x439673){_0x400220[_0xd80e('0x20')]=_0x439673;if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x46')]){_0x30f9bd[_0xd80e('0x47')]=[{'all':!![]}];}return db[_0xd80e('0x30')][_0xd80e('0x48')](_0x30f9bd);})[_0xd80e('0x25')](function(_0x1bbb36){_0x400220[_0xd80e('0x49')]=_0x1bbb36;return _0x400220;})[_0xd80e('0x25')](respondWithFilteredResult(_0x54504e,_0x30f9bd))[_0xd80e('0x4a')](handleError(_0x54504e,null));};exports[_0xd80e('0x4b')]=function(_0x7f80a,_0x558911){var _0x52213c={'raw':!![],'where':{'id':_0x7f80a[_0xd80e('0x4c')]['id']}},_0x5bdea5={};_0x5bdea5['model']=_[_0xd80e('0x36')](db[_0xd80e('0x30')][_0xd80e('0x4d')]);_0x5bdea5[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x7f80a[_0xd80e('0x35')]);_0x5bdea5['filters']=_['intersection'](_0x5bdea5['model'],_0x5bdea5[_0xd80e('0x35')]);_0x52213c['attributes']=_[_0xd80e('0x37')](_0x5bdea5[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x7f80a[_0xd80e('0x35')][_0xd80e('0x39')]));_0x52213c['attributes']=_0x52213c[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x52213c[_0xd80e('0x38')]:_0x5bdea5['model'];if(_0x7f80a[_0xd80e('0x35')][_0xd80e('0x46')]){_0x52213c[_0xd80e('0x47')]=[{'all':!![]}];}_0x52213c=_['merge']({},_0x52213c,_0x7f80a[_0xd80e('0x45')]);return db[_0xd80e('0x30')][_0xd80e('0x4e')](_0x52213c)[_0xd80e('0x25')](handleEntityNotFound(_0x558911,null))[_0xd80e('0x25')](respondWithResult(_0x558911,null))[_0xd80e('0x4a')](handleError(_0x558911,null));};exports['create']=function(_0x5aad1b,_0x275985){return db[_0xd80e('0x30')][_0xd80e('0x4f')](_0x5aad1b['body'],{})['then'](function(_0x1762a8){var _0xff0980=_0x5aad1b[_0xd80e('0x50')][_0xd80e('0x27')]({'plain':!![]});if(!_0xff0980)throw new Error(_0xd80e('0x51'));if(_0xff0980['role']===_0xd80e('0x50')){var _0x5c392d=_0x1762a8[_0xd80e('0x27')]({'plain':!![]});var _0x31107b='Voicemails';return db[_0xd80e('0x52')][_0xd80e('0x4e')]({'where':{'name':_0x31107b,'userProfileId':_0xff0980[_0xd80e('0x53')]},'raw':!![]})[_0xd80e('0x25')](function(_0x44b2f5){if(_0x44b2f5&&_0x44b2f5[_0xd80e('0x54')]===0x0){return db[_0xd80e('0x55')]['create']({'name':_0x5c392d[_0xd80e('0x2c')],'resourceId':_0x5c392d['id'],'type':_0x44b2f5[_0xd80e('0x2c')],'sectionId':_0x44b2f5['id']},{})[_0xd80e('0x25')](function(){return _0x1762a8;});}else{return _0x1762a8;}})['catch'](function(_0x52ab04){logger[_0xd80e('0x2a')](_0xd80e('0x56'),_0x52ab04);throw _0x52ab04;});}return _0x1762a8;})[_0xd80e('0x25')](respondWithResult(_0x275985,0xc9))[_0xd80e('0x4a')](handleError(_0x275985,null));};exports[_0xd80e('0x24')]=function(_0x8b7a70,_0x53b2b8){if(_0x8b7a70[_0xd80e('0x57')]['id']){delete _0x8b7a70['body']['id'];}return db[_0xd80e('0x30')]['find']({'where':{'id':_0x8b7a70[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x53b2b8,null))[_0xd80e('0x25')](saveUpdates(_0x8b7a70[_0xd80e('0x57')],null))[_0xd80e('0x25')](respondWithResult(_0x53b2b8,null))[_0xd80e('0x4a')](handleError(_0x53b2b8,null));};exports['destroy']=function(_0x13270c,_0x4e7edd){return db[_0xd80e('0x30')][_0xd80e('0x4e')]({'where':{'id':_0x13270c['params']['id']}})['then'](handleEntityNotFound(_0x4e7edd,null))[_0xd80e('0x25')](removeEntity(_0x4e7edd,null))[_0xd80e('0x4a')](handleError(_0x4e7edd,null));};exports[_0xd80e('0x58')]=function(_0x570a02,_0x568770,_0x1ba0ed){return db[_0xd80e('0x30')]['findOne']({'where':{'id':_0x570a02[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x568770,null))[_0xd80e('0x25')](function(_0x539390){var _0x41dda0;var _0x589c0b={},_0x720eab={};_0x720eab[_0xd80e('0x34')]=_[_0xd80e('0x36')](db[_0xd80e('0x59')]['rawAttributes']);_0x720eab[_0xd80e('0x35')]=_['keys'](_0x570a02[_0xd80e('0x35')]);_0x720eab['filters']=_[_0xd80e('0x37')](_0x720eab[_0xd80e('0x34')],_0x720eab[_0xd80e('0x35')]);_0x589c0b[_0xd80e('0x38')]=_['intersection'](_0x720eab[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x570a02['query'][_0xd80e('0x39')]));_0x589c0b[_0xd80e('0x38')]=_0x589c0b[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x589c0b['attributes']:_0x720eab[_0xd80e('0x34')];if(!_0x570a02[_0xd80e('0x35')]['hasOwnProperty'](_0xd80e('0x3c'))){_0x589c0b[_0xd80e('0x1f')]=qs[_0xd80e('0x1f')](_0x570a02['query']['limit']);_0x589c0b['offset']=qs['offset'](_0x570a02[_0xd80e('0x35')]['offset']);}_0x589c0b[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x570a02[_0xd80e('0x35')]['sort']);_0x589c0b[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x570a02[_0xd80e('0x35')],_0x720eab[_0xd80e('0x40')]));if(_0x570a02[_0xd80e('0x35')][_0xd80e('0x42')]){_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b['where'],{'$or':_['map'](_0x589c0b[_0xd80e('0x38')],function(_0x410ed6){var _0x10104c={};_0x10104c[_0x410ed6]={'$like':'%'+_0x570a02[_0xd80e('0x35')]['filter']+'%'};return _0x10104c;})});}_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b[_0xd80e('0x3f')],{'mailboxuser':_0x539390[_0xd80e('0x5a')]});_0x589c0b=_[_0xd80e('0x43')]({},_0x589c0b,_0x570a02['options']);return db[_0xd80e('0x59')][_0xd80e('0x5b')](_0x589c0b)[_0xd80e('0x25')](respondWithFilteredResult(_0x568770,_0x589c0b));})[_0xd80e('0x4a')](handleError(_0x568770,null));}; \ No newline at end of file +var _0xc900=['body','params','findOne','VoiceMailMessage','findAndCountAll','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','Voicemails','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','catch','show','rawAttributes','keys','find','user','get','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xc900,0xb3));var _0x0c90=function(_0x1fc0d7,_0x103769){_0x1fc0d7=_0x1fc0d7-0x0;var _0xe52c21=_0xc900[_0x1fc0d7];return _0xe52c21;};'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(){var _0x5695a2=_0x4dfbc3['get']({'plain':!![]});var _0x28d005=_0x0c90('0x27');return db[_0x0c90('0x28')][_0x0c90('0x26')]({'where':{'type':_0x28d005,'resourceId':_0x5695a2['id']}})['then'](function(){return _0x4dfbc3;});})[_0x0c90('0x25')](function(){_0x212164[_0x0c90('0x1a')](0xcc)[_0x0c90('0x1b')]();});}};}function handleEntityNotFound(_0x277d4a,_0x427c2b){return function(_0x114589){if(!_0x114589){_0x277d4a['sendStatus'](0x194);}return _0x114589;};}function handleError(_0x15de68,_0x22a47d){_0x22a47d=_0x22a47d||0x1f4;return function(_0x39f1b2){logger[_0x0c90('0x29')](_0x39f1b2['stack']);if(_0x39f1b2['name']){delete _0x39f1b2[_0x0c90('0x2a')];}_0x15de68[_0x0c90('0x1a')](_0x22a47d)[_0x0c90('0x2b')](_0x39f1b2);};}exports[_0x0c90('0x2c')]=function(_0x119e09,_0x562664){var _0x120136={},_0x50b156={},_0x478002={'count':0x0,'rows':[]};var _0x47a935=_[_0x0c90('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x886634){return{'name':_0x886634[_0x0c90('0x2e')],'type':_0x886634[_0x0c90('0x2f')][_0x0c90('0x30')]};});_0x50b156['model']=_[_0x0c90('0x2d')](_0x47a935,'name');_0x50b156[_0x0c90('0x31')]=_['keys'](_0x119e09[_0x0c90('0x31')]);_0x50b156[_0x0c90('0x32')]=_['intersection'](_0x50b156[_0x0c90('0x33')],_0x50b156[_0x0c90('0x31')]);_0x120136[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x50b156[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x36')]));_0x120136['attributes']=_0x120136[_0x0c90('0x34')][_0x0c90('0x37')]?_0x120136[_0x0c90('0x34')]:_0x50b156[_0x0c90('0x33')];if(!_0x119e09['query'][_0x0c90('0x38')](_0x0c90('0x39'))){_0x120136[_0x0c90('0x1f')]=qs[_0x0c90('0x1f')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x120136[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x119e09['query'][_0x0c90('0x1d')]);}_0x120136[_0x0c90('0x3a')]=qs['sort'](_0x119e09[_0x0c90('0x31')][_0x0c90('0x3b')]);_0x120136[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x119e09['query'],_0x50b156[_0x0c90('0x32')]),_0x47a935);if(_0x119e09[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x120136[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x120136[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x47a935,function(_0x1695dd){if(_0x1695dd[_0x0c90('0x2f')]!=='VIRTUAL'){var _0x2cd2c2={};_0x2cd2c2[_0x1695dd['name']]={'$like':'%'+_0x119e09[_0x0c90('0x31')]['filter']+'%'};return _0x2cd2c2;}})});}_0x120136=_[_0x0c90('0x3f')]({},_0x120136,_0x119e09[_0x0c90('0x40')]);var _0x49f8b4={'where':_0x120136['where']};return db[_0x0c90('0x41')]['count'](_0x49f8b4)[_0x0c90('0x25')](function(_0x4545bb){_0x478002[_0x0c90('0x20')]=_0x4545bb;if(_0x119e09['query'][_0x0c90('0x42')]){_0x120136[_0x0c90('0x43')]=[{'all':!![]}];}return db[_0x0c90('0x41')][_0x0c90('0x44')](_0x120136);})[_0x0c90('0x25')](function(_0x1184c4){_0x478002['rows']=_0x1184c4;return _0x478002;})[_0x0c90('0x25')](respondWithFilteredResult(_0x562664,_0x120136))[_0x0c90('0x45')](handleError(_0x562664,null));};exports[_0x0c90('0x46')]=function(_0x399115,_0x3c47c9){var _0x15d040={'raw':!![],'where':{'id':_0x399115['params']['id']}},_0x30b9df={};_0x30b9df[_0x0c90('0x33')]=_['keys'](db[_0x0c90('0x41')][_0x0c90('0x47')]);_0x30b9df[_0x0c90('0x31')]=_[_0x0c90('0x48')](_0x399115[_0x0c90('0x31')]);_0x30b9df[_0x0c90('0x32')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],_0x30b9df[_0x0c90('0x31')]);_0x15d040[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x399115[_0x0c90('0x31')][_0x0c90('0x36')]));_0x15d040['attributes']=_0x15d040[_0x0c90('0x34')][_0x0c90('0x37')]?_0x15d040[_0x0c90('0x34')]:_0x30b9df[_0x0c90('0x33')];if(_0x399115[_0x0c90('0x31')][_0x0c90('0x42')]){_0x15d040[_0x0c90('0x43')]=[{'all':!![]}];}_0x15d040=_[_0x0c90('0x3f')]({},_0x15d040,_0x399115[_0x0c90('0x40')]);return db[_0x0c90('0x41')][_0x0c90('0x49')](_0x15d040)[_0x0c90('0x25')](handleEntityNotFound(_0x3c47c9,null))[_0x0c90('0x25')](respondWithResult(_0x3c47c9,null))[_0x0c90('0x45')](handleError(_0x3c47c9,null));};exports['create']=function(_0x1b4aac,_0x38f492){return db['VoiceMail']['create'](_0x1b4aac['body'],{})[_0x0c90('0x25')](function(_0x1205d0){var _0x460cf9=_0x1b4aac[_0x0c90('0x4a')][_0x0c90('0x4b')]({'plain':!![]});if(!_0x460cf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460cf9[_0x0c90('0x4c')]===_0x0c90('0x4a')){var _0x2b756d=_0x1205d0['get']({'plain':!![]});var _0x119776=_0x0c90('0x27');return db[_0x0c90('0x4d')][_0x0c90('0x49')]({'where':{'name':_0x119776,'userProfileId':_0x460cf9[_0x0c90('0x4e')]},'raw':!![]})[_0x0c90('0x25')](function(_0x42c121){if(_0x42c121&&_0x42c121[_0x0c90('0x4f')]===0x0){return db[_0x0c90('0x28')][_0x0c90('0x50')]({'name':_0x2b756d['name'],'resourceId':_0x2b756d['id'],'type':_0x42c121[_0x0c90('0x2a')],'sectionId':_0x42c121['id']},{})['then'](function(){return _0x1205d0;});}else{return _0x1205d0;}})[_0x0c90('0x45')](function(_0x67539d){logger[_0x0c90('0x29')](_0x0c90('0x51'),_0x67539d);throw _0x67539d;});}return _0x1205d0;})[_0x0c90('0x25')](respondWithResult(_0x38f492,0xc9))[_0x0c90('0x45')](handleError(_0x38f492,null));};exports['update']=function(_0x4930fc,_0x5382d9){if(_0x4930fc['body']['id']){delete _0x4930fc[_0x0c90('0x52')]['id'];}return db[_0x0c90('0x41')][_0x0c90('0x49')]({'where':{'id':_0x4930fc['params']['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x5382d9,null))[_0x0c90('0x25')](saveUpdates(_0x4930fc['body'],null))[_0x0c90('0x25')](respondWithResult(_0x5382d9,null))['catch'](handleError(_0x5382d9,null));};exports[_0x0c90('0x26')]=function(_0x8951f2,_0x42398b){return db[_0x0c90('0x41')]['find']({'where':{'id':_0x8951f2[_0x0c90('0x53')]['id']}})['then'](handleEntityNotFound(_0x42398b,null))[_0x0c90('0x25')](removeEntity(_0x42398b,null))[_0x0c90('0x45')](handleError(_0x42398b,null));};exports['getMessages']=function(_0x52b437,_0x51c356,_0x221fba){return db[_0x0c90('0x41')][_0x0c90('0x54')]({'where':{'id':_0x52b437[_0x0c90('0x53')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x51c356,null))['then'](function(_0x3bfd01){var _0x25ab13;var _0x5ee971={},_0x3eb725={};_0x3eb725['model']=_[_0x0c90('0x48')](db[_0x0c90('0x55')]['rawAttributes']);_0x3eb725[_0x0c90('0x31')]=_['keys'](_0x52b437['query']);_0x3eb725['filters']=_[_0x0c90('0x35')](_0x3eb725[_0x0c90('0x33')],_0x3eb725[_0x0c90('0x31')]);_0x5ee971[_0x0c90('0x34')]=_['intersection'](_0x3eb725['model'],qs[_0x0c90('0x36')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x36')]));_0x5ee971['attributes']=_0x5ee971[_0x0c90('0x34')][_0x0c90('0x37')]?_0x5ee971[_0x0c90('0x34')]:_0x3eb725['model'];if(!_0x52b437[_0x0c90('0x31')][_0x0c90('0x38')](_0x0c90('0x39'))){_0x5ee971['limit']=qs[_0x0c90('0x1f')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x5ee971[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1d')]);}_0x5ee971[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x52b437['query']['sort']);_0x5ee971[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x52b437[_0x0c90('0x31')],_0x3eb725[_0x0c90('0x32')]));if(_0x52b437[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x5ee971[_0x0c90('0x34')],function(_0x309152){var _0x164d4d={};_0x164d4d[_0x309152]={'$like':'%'+_0x52b437[_0x0c90('0x31')]['filter']+'%'};return _0x164d4d;})});}_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'mailboxuser':_0x3bfd01['mailbox']});_0x5ee971=_['merge']({},_0x5ee971,_0x52b437[_0x0c90('0x40')]);return db['VoiceMailMessage'][_0x0c90('0x56')](_0x5ee971)[_0x0c90('0x25')](respondWithFilteredResult(_0x51c356,_0x5ee971));})['catch'](handleError(_0x51c356,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ceca146..f0699fa 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 _0x2969=['context','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./voiceMail.attributes','define','voice_voicemail','mailbox_context'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x2969,0x114));var _0x9296=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2969[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9296('0x0'));var util=require('util');var logger=require(_0x9296('0x1'))('api');var moment=require(_0x9296('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9296('0x3'));var rimraf=require(_0x9296('0x4'));var config=require(_0x9296('0x5'));var attributes=require(_0x9296('0x6'));module['exports']=function(_0x5422a8,_0x1a6287){return _0x5422a8[_0x9296('0x7')]('VoiceMail',attributes,{'tableName':_0x9296('0x8'),'paranoid':![],'indexes':[{'name':_0x9296('0x9'),'fields':['mailbox',_0x9296('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4489=['exports','define','voice_voicemail','mailbox','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4489,0x1d2));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9448('0x0'));var util=require('util');var logger=require(_0x9448('0x1'))('api');var moment=require(_0x9448('0x2'));var BPromise=require(_0x9448('0x3'));var rp=require(_0x9448('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9448('0x5'));var config=require(_0x9448('0x6'));var attributes=require('./voiceMail.attributes');module[_0x9448('0x7')]=function(_0x2cf7b9,_0x163759){return _0x2cf7b9[_0x9448('0x8')]('VoiceMail',attributes,{'tableName':_0x9448('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x9448('0xa'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index e3f8ee9..8775f33 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 _0xf308=['error','code','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xab0515,_0x4b8ab2){var _0x443d59=function(_0xfd6c59){while(--_0xfd6c59){_0xab0515['push'](_0xab0515['shift']());}};_0x443d59(++_0x4b8ab2);}(_0xf308,0xcc));var _0x8f30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf308[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8f30('0x0'));var util=require(_0x8f30('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f30('0x3'))['db'];var utils=require(_0x8f30('0x4'));var logger=require('../../config/logger')(_0x8f30('0x5'));var config=require(_0x8f30('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8f30('0x7')][_0x8f30('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x436855,_0x49759c,_0x34b63c){return new BPromise(function(_0x1f70cb,_0x384cb0){return client[_0x8f30('0x9')](_0x436855,_0x34b63c)['then'](function(_0x2c592e){logger[_0x8f30('0xa')](_0x8f30('0xb'),_0x49759c,'request\x20sent');logger[_0x8f30('0xc')](_0x8f30('0xd'),_0x49759c,_0x8f30('0xe'),JSON[_0x8f30('0xf')](_0x2c592e));if(_0x2c592e[_0x8f30('0x10')]){if(_0x2c592e[_0x8f30('0x10')][_0x8f30('0x11')]===0x1f4){logger['error'](_0x8f30('0xb'),_0x49759c,_0x2c592e[_0x8f30('0x10')][_0x8f30('0x12')]);return _0x384cb0(_0x2c592e[_0x8f30('0x10')][_0x8f30('0x12')]);}logger[_0x8f30('0x10')](_0x8f30('0xb'),_0x49759c,_0x2c592e['error'][_0x8f30('0x12')]);return _0x1f70cb(_0x2c592e['error'][_0x8f30('0x12')]);}else{logger['info'](_0x8f30('0xb'),_0x49759c,'request\x20sent');_0x1f70cb(_0x2c592e['result'][_0x8f30('0x12')]);}})[_0x8f30('0x13')](function(_0x4f19c6){logger['error'](_0x8f30('0xb'),_0x49759c,_0x4f19c6);_0x384cb0(_0x4f19c6);});});} \ No newline at end of file +var _0xcd33=['client','http','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x1c7586,_0x1d46bd){var _0x3bd9a1=function(_0x2f2d4d){while(--_0x2f2d4d){_0x1c7586['push'](_0x1c7586['shift']());}};_0x3bd9a1(++_0x1d46bd);}(_0xcd33,0x8a));var _0x3cd3=function(_0x52f9d9,_0x5a1c6e){_0x52f9d9=_0x52f9d9-0x0;var _0x57f095=_0xcd33[_0x52f9d9];return _0x57f095;};'use strict';var _=require(_0x3cd3('0x0'));var util=require(_0x3cd3('0x1'));var moment=require(_0x3cd3('0x2'));var BPromise=require(_0x3cd3('0x3'));var rs=require(_0x3cd3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cd3('0x5'))['db'];var utils=require(_0x3cd3('0x6'));var logger=require(_0x3cd3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3cd3('0x8'));var client=jayson[_0x3cd3('0x9')][_0x3cd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17d7b6,_0x430248,_0x384a){return new BPromise(function(_0x57cfcc,_0x529bc7){return client['request'](_0x17d7b6,_0x384a)['then'](function(_0x3585c7){logger[_0x3cd3('0xb')](_0x3cd3('0xc'),_0x430248,_0x3cd3('0xd'));logger[_0x3cd3('0xe')](_0x3cd3('0xf'),_0x430248,_0x3cd3('0xd'),JSON[_0x3cd3('0x10')](_0x3585c7));if(_0x3585c7['error']){if(_0x3585c7[_0x3cd3('0x11')][_0x3cd3('0x12')]===0x1f4){logger['error'](_0x3cd3('0xc'),_0x430248,_0x3585c7[_0x3cd3('0x11')]['message']);return _0x529bc7(_0x3585c7[_0x3cd3('0x11')][_0x3cd3('0x13')]);}logger['error'](_0x3cd3('0xc'),_0x430248,_0x3585c7[_0x3cd3('0x11')][_0x3cd3('0x13')]);return _0x57cfcc(_0x3585c7[_0x3cd3('0x11')][_0x3cd3('0x13')]);}else{logger[_0x3cd3('0xb')](_0x3cd3('0xc'),_0x430248,_0x3cd3('0xd'));_0x57cfcc(_0x3585c7['result']['message']);}})[_0x3cd3('0x14')](function(_0x579830){logger[_0x3cd3('0x11')]('VoiceMail,\x20%s,\x20%s',_0x430248,_0x579830);_0x529bc7(_0x579830);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 33aec3b..8ee033f 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 _0x624f=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','/:id/download','create','put','update','exports'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x624f,0xb0));var _0xf624=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x624f[_0x55d58f];return _0x1ad6e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf624('0x0'));var timeout=require(_0xf624('0x1'));var express=require(_0xf624('0x2'));var router=express[_0xf624('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf624('0x4'));var config=require(_0xf624('0x5'));var controller=require(_0xf624('0x6'));router['get']('/',auth[_0xf624('0x7')](),controller[_0xf624('0x8')]);router[_0xf624('0x9')](_0xf624('0xa'),auth[_0xf624('0x7')](),controller['show']);router[_0xf624('0x9')](_0xf624('0xb'),auth[_0xf624('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xf624('0xc')]);router[_0xf624('0xd')](_0xf624('0xa'),auth[_0xf624('0x7')](),controller[_0xf624('0xe')]);router['delete'](_0xf624('0xa'),auth[_0xf624('0x7')](),controller['destroy']);module[_0xf624('0xf')]=router; \ No newline at end of file +var _0x5c5f=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','multer','util'];(function(_0x5c2220,_0x3240b3){var _0x40b8ab=function(_0x4c534e){while(--_0x4c534e){_0x5c2220['push'](_0x5c2220['shift']());}};_0x40b8ab(++_0x3240b3);}(_0x5c5f,0x124));var _0xf5c5=function(_0x21dbe0,_0x2eb1ef){_0x21dbe0=_0x21dbe0-0x0;var _0x1db26e=_0x5c5f[_0x21dbe0];return _0x1db26e;};'use strict';var multer=require(_0xf5c5('0x0'));var util=require(_0xf5c5('0x1'));var path=require(_0xf5c5('0x2'));var timeout=require('connect-timeout');var express=require(_0xf5c5('0x3'));var router=express[_0xf5c5('0x4')]();var fs_extra=require(_0xf5c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf5c5('0x6'));var config=require(_0xf5c5('0x7'));var controller=require(_0xf5c5('0x8'));router[_0xf5c5('0x9')]('/',auth[_0xf5c5('0xa')](),controller[_0xf5c5('0xb')]);router[_0xf5c5('0x9')](_0xf5c5('0xc'),auth[_0xf5c5('0xa')](),controller['show']);router[_0xf5c5('0x9')](_0xf5c5('0xd'),auth['isAuthenticated'](),controller[_0xf5c5('0xe')]);router[_0xf5c5('0xf')]('/',auth[_0xf5c5('0xa')](),controller[_0xf5c5('0x10')]);router[_0xf5c5('0x11')](_0xf5c5('0xc'),auth['isAuthenticated'](),controller[_0xf5c5('0x12')]);router[_0xf5c5('0x13')]('/:id',auth[_0xf5c5('0xa')](),controller[_0xf5c5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3359c6a..30f848b 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 _0x8b5e=['long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING','BLOB'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0x8b5e,0x1ce));var _0xe8b5=function(_0x1fc322,_0x57dee2){_0x1fc322=_0x1fc322-0x0;var _0x29b957=_0x8b5e[_0x1fc322];return _0x29b957;};'use strict';var Sequelize=require(_0xe8b5('0x0'));module[_0xe8b5('0x1')]={'name':{'type':Sequelize[_0xe8b5('0x2')],'get':function(_0x3b410d){return this[_0xe8b5('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe8b5('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe8b5('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe8b5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe8b5('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xe8b5('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe8b5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xe8b5('0x5')](_0xe8b5('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe8b5('0x4')],'defaultValue':''},'stamp':{'type':_0xe8b5('0x7'),'defaultValue':Sequelize['literal'](_0xe8b5('0x8'))}}; \ No newline at end of file +var _0x6ad3=['INTEGER','STRING','BLOB','long','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue'];(function(_0x549c56,_0xc02b6a){var _0x385a97=function(_0x5f5c22){while(--_0x5f5c22){_0x549c56['push'](_0x549c56['shift']());}};_0x385a97(++_0xc02b6a);}(_0x6ad3,0x1ed));var _0x36ad=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0x6ad3[_0xe480f0];return _0x57b198;};'use strict';var Sequelize=require(_0x36ad('0x0'));module[_0x36ad('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3b57d8){return this[_0x36ad('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x36ad('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x36ad('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x36ad('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x36ad('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x36ad('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x36ad('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x36ad('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x36ad('0x5')](_0x36ad('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x36ad('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x36ad('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 7fa6f25..ea63aa5 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 _0xe241=['keys','options','create','body','find','download','recording','Sequelize','ValidationError','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','rawAttributes','fieldName','key','model','differenceBy','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','VoiceMailMessage','catch','show','params'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0xe241,0xfb));var _0x1e24=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xe241[_0x4ed520];return _0x4415a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e24('0x1'));var rp=require('request-promise');var moment=require(_0x1e24('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1e24('0x3'));var util=require('util');var path=require('path');var sox=require(_0x1e24('0x4'));var csv=require(_0x1e24('0x5'));var ejs=require(_0x1e24('0x6'));var fs=require('fs');var fs_extra=require(_0x1e24('0x7'));var _=require(_0x1e24('0x8'));var squel=require(_0x1e24('0x9'));var crypto=require('crypto');var jsforce=require(_0x1e24('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1e24('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e24('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1e24('0xd'));var hardwareService=require(_0x1e24('0xe'));var logger=require(_0x1e24('0xf'))(_0x1e24('0x10'));var utils=require(_0x1e24('0x11'));var config=require(_0x1e24('0x12'));var licenseUtil=require(_0x1e24('0x13'));var db=require(_0x1e24('0x14'))['db'];function respondWithStatusCode(_0x395238,_0x16bdfa){_0x16bdfa=_0x16bdfa||0xcc;return function(_0x3a147e){if(_0x3a147e){return _0x395238[_0x1e24('0x15')](_0x16bdfa);}return _0x395238[_0x1e24('0x16')](_0x16bdfa)['end']();};}function respondWithResult(_0x3f1f91,_0x4db32d){_0x4db32d=_0x4db32d||0xc8;return function(_0x41f2e3){if(_0x41f2e3){return _0x3f1f91[_0x1e24('0x16')](_0x4db32d)[_0x1e24('0x17')](_0x41f2e3);}};}function respondWithFilteredResult(_0x53a3dd,_0x1f5d04){return function(_0x178841){if(_0x178841){var _0xf0960d=typeof _0x1f5d04[_0x1e24('0x18')]===_0x1e24('0x19')&&typeof _0x1f5d04[_0x1e24('0x1a')]===_0x1e24('0x19');var _0x4ee856=_0x178841[_0x1e24('0x1b')];var _0x153bac=_0xf0960d?0x0:_0x1f5d04[_0x1e24('0x18')];var _0x5cd2e5=_0xf0960d?_0x178841[_0x1e24('0x1b')]:_0x1f5d04['offset']+_0x1f5d04[_0x1e24('0x1a')];var _0x5ba1af;if(_0x5cd2e5>=_0x4ee856){_0x5cd2e5=_0x4ee856;_0x5ba1af=0xc8;}else{_0x5ba1af=0xce;}_0x53a3dd[_0x1e24('0x16')](_0x5ba1af);return _0x53a3dd[_0x1e24('0x1c')]('Content-Range',_0x153bac+'-'+_0x5cd2e5+'/'+_0x4ee856)['json'](_0x178841);}return null;};}function patchUpdates(_0x42e83c){return function(_0x417533){try{jsonpatch[_0x1e24('0x1d')](_0x417533,_0x42e83c,!![]);}catch(_0x44c786){return BPromise['reject'](_0x44c786);}return _0x417533[_0x1e24('0x1e')]();};}function saveUpdates(_0x89f015,_0x522368){return function(_0x5dc52a){if(_0x5dc52a){return _0x5dc52a[_0x1e24('0x1f')](_0x89f015)[_0x1e24('0x20')](function(_0x53b55e){return _0x53b55e;});}return null;};}function removeEntity(_0x152f45,_0x2f5aaa){return function(_0x1e395a){if(_0x1e395a){return _0x1e395a[_0x1e24('0x21')]()[_0x1e24('0x20')](function(){_0x152f45['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x164ca1,_0x41b8ff){return function(_0x47620b){if(!_0x47620b){_0x164ca1[_0x1e24('0x15')](0x194);}return _0x47620b;};}function handleError(_0x948768,_0x198e50){_0x198e50=_0x198e50||0x1f4;return function(_0x41e0a1){logger[_0x1e24('0x22')](_0x41e0a1['stack']);if(_0x41e0a1[_0x1e24('0x23')]){delete _0x41e0a1[_0x1e24('0x23')];}_0x948768[_0x1e24('0x16')](_0x198e50)[_0x1e24('0x24')](_0x41e0a1);};}exports['index']=function(_0x127de1,_0x3d0e5e){var _0x26f69f={},_0x1f41d7={},_0x165a2b={'count':0x0,'rows':[]};var _0x37a0f9=_['map'](db['VoiceMailMessage'][_0x1e24('0x25')],function(_0x4441a2){return{'name':_0x4441a2[_0x1e24('0x26')],'type':_0x4441a2['type'][_0x1e24('0x27')]};});_0x1f41d7[_0x1e24('0x28')]=_[_0x1e24('0x29')](_[_0x1e24('0x2a')](_0x37a0f9,'name'),[_0x1e24('0x23')]);_0x1f41d7[_0x1e24('0x2b')]=_['keys'](_0x127de1[_0x1e24('0x2b')]);_0x1f41d7['filters']=_[_0x1e24('0x2c')](_0x1f41d7[_0x1e24('0x28')],_0x1f41d7[_0x1e24('0x2b')]);_0x26f69f['attributes']=_['intersection'](_0x1f41d7[_0x1e24('0x28')],qs[_0x1e24('0x2d')](_0x127de1[_0x1e24('0x2b')][_0x1e24('0x2d')]));_0x26f69f[_0x1e24('0x2e')]=_0x26f69f[_0x1e24('0x2e')][_0x1e24('0x2f')]?_0x26f69f[_0x1e24('0x2e')]:_0x1f41d7[_0x1e24('0x28')];if(!_0x127de1[_0x1e24('0x2b')][_0x1e24('0x30')](_0x1e24('0x31'))){_0x26f69f['limit']=qs[_0x1e24('0x1a')](_0x127de1[_0x1e24('0x2b')]['limit']);_0x26f69f[_0x1e24('0x18')]=qs[_0x1e24('0x18')](_0x127de1['query'][_0x1e24('0x18')]);}_0x26f69f[_0x1e24('0x32')]=qs[_0x1e24('0x33')](_0x127de1['query'][_0x1e24('0x33')]);_0x26f69f[_0x1e24('0x34')]=qs[_0x1e24('0x35')](_[_0x1e24('0x36')](_0x127de1[_0x1e24('0x2b')],_0x1f41d7[_0x1e24('0x35')]),_0x37a0f9);if(_0x127de1[_0x1e24('0x2b')][_0x1e24('0x37')]){_0x26f69f[_0x1e24('0x34')]=_[_0x1e24('0x38')](_0x26f69f[_0x1e24('0x34')],{'$or':_[_0x1e24('0x2a')](_0x37a0f9,function(_0x2fd0b0){if(_0x2fd0b0[_0x1e24('0x39')]!==_0x1e24('0x3a')){var _0x294705={};_0x294705[_0x2fd0b0[_0x1e24('0x23')]]={'$like':'%'+_0x127de1[_0x1e24('0x2b')]['filter']+'%'};return _0x294705;}})});}_0x26f69f=_[_0x1e24('0x38')]({},_0x26f69f,_0x127de1['options']);var _0x45a14e={'where':_0x26f69f[_0x1e24('0x34')]};return db['VoiceMailMessage']['count'](_0x45a14e)[_0x1e24('0x20')](function(_0x2ef794){_0x165a2b[_0x1e24('0x1b')]=_0x2ef794;if(_0x127de1[_0x1e24('0x2b')][_0x1e24('0x3b')]){_0x26f69f[_0x1e24('0x3c')]=[{'all':!![]}];}return db[_0x1e24('0x3d')]['findAll'](_0x26f69f);})[_0x1e24('0x20')](function(_0x25ce33){_0x165a2b['rows']=_0x25ce33;return _0x165a2b;})[_0x1e24('0x20')](respondWithFilteredResult(_0x3d0e5e,_0x26f69f))[_0x1e24('0x3e')](handleError(_0x3d0e5e,null));};exports[_0x1e24('0x3f')]=function(_0x5d2b79,_0x5676b9){var _0x241e58={'raw':!![],'where':{'id':_0x5d2b79[_0x1e24('0x40')]['id']}},_0x398a66={};_0x398a66[_0x1e24('0x28')]=_[_0x1e24('0x41')](db[_0x1e24('0x3d')]['rawAttributes']);_0x398a66[_0x1e24('0x2b')]=_[_0x1e24('0x41')](_0x5d2b79['query']);_0x398a66['filters']=_[_0x1e24('0x2c')](_0x398a66[_0x1e24('0x28')],_0x398a66[_0x1e24('0x2b')]);_0x241e58[_0x1e24('0x2e')]=_[_0x1e24('0x2c')](_0x398a66[_0x1e24('0x28')],qs['fields'](_0x5d2b79[_0x1e24('0x2b')][_0x1e24('0x2d')]));_0x241e58[_0x1e24('0x2e')]=_0x241e58[_0x1e24('0x2e')]['length']?_0x241e58[_0x1e24('0x2e')]:_0x398a66['model'];if(_0x5d2b79[_0x1e24('0x2b')][_0x1e24('0x3b')]){_0x241e58[_0x1e24('0x3c')]=[{'all':!![]}];}_0x241e58=_[_0x1e24('0x38')]({},_0x241e58,_0x5d2b79[_0x1e24('0x42')]);return db[_0x1e24('0x3d')]['find'](_0x241e58)['then'](handleEntityNotFound(_0x5676b9,null))[_0x1e24('0x20')](respondWithResult(_0x5676b9,null))[_0x1e24('0x3e')](handleError(_0x5676b9,null));};exports[_0x1e24('0x43')]=function(_0x277bf2,_0x323cd1){return db[_0x1e24('0x3d')]['create'](_0x277bf2['body'],{})[_0x1e24('0x20')](respondWithResult(_0x323cd1,0xc9))[_0x1e24('0x3e')](handleError(_0x323cd1,null));};exports['update']=function(_0x2f0552,_0x12be0a){if(_0x2f0552[_0x1e24('0x44')]['id']){delete _0x2f0552['body']['id'];}return db['VoiceMailMessage'][_0x1e24('0x45')]({'where':{'id':_0x2f0552[_0x1e24('0x40')]['id']}})[_0x1e24('0x20')](handleEntityNotFound(_0x12be0a,null))[_0x1e24('0x20')](saveUpdates(_0x2f0552[_0x1e24('0x44')],null))['then'](respondWithResult(_0x12be0a,null))[_0x1e24('0x3e')](handleError(_0x12be0a,null));};exports['destroy']=function(_0x524c6c,_0x2c40aa){return db[_0x1e24('0x3d')][_0x1e24('0x45')]({'where':{'id':_0x524c6c[_0x1e24('0x40')]['id']}})[_0x1e24('0x20')](handleEntityNotFound(_0x2c40aa,null))[_0x1e24('0x20')](removeEntity(_0x2c40aa,null))[_0x1e24('0x3e')](handleError(_0x2c40aa,null));};exports[_0x1e24('0x46')]=function(_0xc26c0f,_0x5e14b5,_0x4d17e0){return db['VoiceMailMessage']['find']({'where':{'id':_0xc26c0f[_0x1e24('0x40')]['id']},'attributes':['id',_0x1e24('0x47'),'msg_id']})[_0x1e24('0x20')](handleEntityNotFound(_0x5e14b5,null))[_0x1e24('0x20')](function(_0x3e1f06){if(_0x3e1f06){if(!_0x3e1f06['recording']){throw new db[(_0x1e24('0x48'))][(_0x1e24('0x49'))]('VoiceMailMessage\x20not\x20found');}var _0x136c77={'Content-Type':_0x1e24('0x4a'),'Content-Disposition':'attachment'};if(_0x3e1f06[_0x1e24('0x4b')]){_0x136c77[_0x1e24('0x4c')]=_0x1e24('0x4d')+_0x3e1f06[_0x1e24('0x4b')]+_0x1e24('0x4e');}_0x5e14b5[_0x1e24('0x1c')](_0x136c77);return _0x5e14b5[_0x1e24('0x24')](new Buffer(_0x3e1f06[_0x1e24('0x47')]));}})[_0x1e24('0x3e')](handleError(_0x5e14b5,null));}; \ No newline at end of file +var _0x4a3f=['then','end','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','find','body','params','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','set','apply','save','update'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x4a3f,0x1dc));var _0xf4a3=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0x4a3f[_0x16dbfd];return _0x382254;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4a3('0x0'));var zipdir=require(_0xf4a3('0x1'));var jsonpatch=require(_0xf4a3('0x2'));var rp=require('request-promise');var moment=require(_0xf4a3('0x3'));var BPromise=require(_0xf4a3('0x4'));var Mustache=require('mustache');var util=require(_0xf4a3('0x5'));var path=require(_0xf4a3('0x6'));var sox=require('sox');var csv=require(_0xf4a3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4a3('0x8'));var _=require(_0xf4a3('0x9'));var squel=require(_0xf4a3('0xa'));var crypto=require(_0xf4a3('0xb'));var jsforce=require(_0xf4a3('0xc'));var deskjs=require(_0xf4a3('0xd'));var toCsv=require(_0xf4a3('0x7'));var querystring=require(_0xf4a3('0xe'));var Papa=require(_0xf4a3('0xf'));var Redis=require('ioredis');var authService=require(_0xf4a3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf4a3('0x11'));var hardwareService=require(_0xf4a3('0x12'));var logger=require(_0xf4a3('0x13'))(_0xf4a3('0x14'));var utils=require(_0xf4a3('0x15'));var config=require(_0xf4a3('0x16'));var licenseUtil=require(_0xf4a3('0x17'));var db=require(_0xf4a3('0x18'))['db'];function respondWithStatusCode(_0x332d96,_0x59b5bd){_0x59b5bd=_0x59b5bd||0xcc;return function(_0x123ece){if(_0x123ece){return _0x332d96[_0xf4a3('0x19')](_0x59b5bd);}return _0x332d96[_0xf4a3('0x1a')](_0x59b5bd)['end']();};}function respondWithResult(_0x5b8a17,_0xd18690){_0xd18690=_0xd18690||0xc8;return function(_0x30b34e){if(_0x30b34e){return _0x5b8a17['status'](_0xd18690)[_0xf4a3('0x1b')](_0x30b34e);}};}function respondWithFilteredResult(_0x10c771,_0x193814){return function(_0x45ad99){if(_0x45ad99){var _0x55ffaa=typeof _0x193814['offset']==='undefined'&&typeof _0x193814['limit']===_0xf4a3('0x1c');var _0x38da5b=_0x45ad99[_0xf4a3('0x1d')];var _0x45744d=_0x55ffaa?0x0:_0x193814['offset'];var _0x28b64c=_0x55ffaa?_0x45ad99[_0xf4a3('0x1d')]:_0x193814['offset']+_0x193814['limit'];var _0x160589;if(_0x28b64c>=_0x38da5b){_0x28b64c=_0x38da5b;_0x160589=0xc8;}else{_0x160589=0xce;}_0x10c771[_0xf4a3('0x1a')](_0x160589);return _0x10c771[_0xf4a3('0x1e')]('Content-Range',_0x45744d+'-'+_0x28b64c+'/'+_0x38da5b)[_0xf4a3('0x1b')](_0x45ad99);}return null;};}function patchUpdates(_0x11f859){return function(_0x18c9f1){try{jsonpatch[_0xf4a3('0x1f')](_0x18c9f1,_0x11f859,!![]);}catch(_0x45f2a2){return BPromise['reject'](_0x45f2a2);}return _0x18c9f1[_0xf4a3('0x20')]();};}function saveUpdates(_0x4f99f3,_0x4e496e){return function(_0xe69320){if(_0xe69320){return _0xe69320[_0xf4a3('0x21')](_0x4f99f3)[_0xf4a3('0x22')](function(_0x5e0472){return _0x5e0472;});}return null;};}function removeEntity(_0x5b2117,_0x15abd8){return function(_0x1902f0){if(_0x1902f0){return _0x1902f0['destroy']()['then'](function(){_0x5b2117[_0xf4a3('0x1a')](0xcc)[_0xf4a3('0x23')]();});}};}function handleEntityNotFound(_0x38f952,_0x570577){return function(_0x12d8de){if(!_0x12d8de){_0x38f952[_0xf4a3('0x19')](0x194);}return _0x12d8de;};}function handleError(_0x17072c,_0x5db94c){_0x5db94c=_0x5db94c||0x1f4;return function(_0x310431){logger[_0xf4a3('0x24')](_0x310431['stack']);if(_0x310431['name']){delete _0x310431[_0xf4a3('0x25')];}_0x17072c[_0xf4a3('0x1a')](_0x5db94c)[_0xf4a3('0x26')](_0x310431);};}exports[_0xf4a3('0x27')]=function(_0x39a72c,_0x35109d){var _0x323214={},_0x3e1371={},_0x46f698={'count':0x0,'rows':[]};var _0x125770=_[_0xf4a3('0x28')](db[_0xf4a3('0x29')][_0xf4a3('0x2a')],function(_0x4bfa9b){return{'name':_0x4bfa9b[_0xf4a3('0x2b')],'type':_0x4bfa9b[_0xf4a3('0x2c')]['key']};});_0x3e1371[_0xf4a3('0x2d')]=_[_0xf4a3('0x2e')](_[_0xf4a3('0x28')](_0x125770,'name'),[_0xf4a3('0x25')]);_0x3e1371[_0xf4a3('0x2f')]=_['keys'](_0x39a72c['query']);_0x3e1371[_0xf4a3('0x30')]=_[_0xf4a3('0x31')](_0x3e1371[_0xf4a3('0x2d')],_0x3e1371[_0xf4a3('0x2f')]);_0x323214[_0xf4a3('0x32')]=_[_0xf4a3('0x31')](_0x3e1371[_0xf4a3('0x2d')],qs[_0xf4a3('0x33')](_0x39a72c['query'][_0xf4a3('0x33')]));_0x323214[_0xf4a3('0x32')]=_0x323214[_0xf4a3('0x32')][_0xf4a3('0x34')]?_0x323214[_0xf4a3('0x32')]:_0x3e1371[_0xf4a3('0x2d')];if(!_0x39a72c['query'][_0xf4a3('0x35')]('nolimit')){_0x323214[_0xf4a3('0x36')]=qs[_0xf4a3('0x36')](_0x39a72c['query'][_0xf4a3('0x36')]);_0x323214[_0xf4a3('0x37')]=qs[_0xf4a3('0x37')](_0x39a72c[_0xf4a3('0x2f')][_0xf4a3('0x37')]);}_0x323214[_0xf4a3('0x38')]=qs[_0xf4a3('0x39')](_0x39a72c[_0xf4a3('0x2f')][_0xf4a3('0x39')]);_0x323214[_0xf4a3('0x3a')]=qs['filters'](_['pick'](_0x39a72c[_0xf4a3('0x2f')],_0x3e1371[_0xf4a3('0x30')]),_0x125770);if(_0x39a72c['query']['filter']){_0x323214[_0xf4a3('0x3a')]=_[_0xf4a3('0x3b')](_0x323214[_0xf4a3('0x3a')],{'$or':_[_0xf4a3('0x28')](_0x125770,function(_0x16252a){if(_0x16252a[_0xf4a3('0x2c')]!==_0xf4a3('0x3c')){var _0x544216={};_0x544216[_0x16252a[_0xf4a3('0x25')]]={'$like':'%'+_0x39a72c[_0xf4a3('0x2f')][_0xf4a3('0x3d')]+'%'};return _0x544216;}})});}_0x323214=_[_0xf4a3('0x3b')]({},_0x323214,_0x39a72c[_0xf4a3('0x3e')]);var _0x5b1426={'where':_0x323214['where']};return db['VoiceMailMessage'][_0xf4a3('0x1d')](_0x5b1426)['then'](function(_0x314a30){_0x46f698['count']=_0x314a30;if(_0x39a72c[_0xf4a3('0x2f')][_0xf4a3('0x3f')]){_0x323214['include']=[{'all':!![]}];}return db[_0xf4a3('0x29')][_0xf4a3('0x40')](_0x323214);})['then'](function(_0x2db616){_0x46f698[_0xf4a3('0x41')]=_0x2db616;return _0x46f698;})[_0xf4a3('0x22')](respondWithFilteredResult(_0x35109d,_0x323214))[_0xf4a3('0x42')](handleError(_0x35109d,null));};exports[_0xf4a3('0x43')]=function(_0x3ca15c,_0x35d33d){var _0x1d56a7={'raw':!![],'where':{'id':_0x3ca15c['params']['id']}},_0x5954fb={};_0x5954fb['model']=_[_0xf4a3('0x44')](db[_0xf4a3('0x29')][_0xf4a3('0x2a')]);_0x5954fb[_0xf4a3('0x2f')]=_[_0xf4a3('0x44')](_0x3ca15c[_0xf4a3('0x2f')]);_0x5954fb['filters']=_[_0xf4a3('0x31')](_0x5954fb['model'],_0x5954fb[_0xf4a3('0x2f')]);_0x1d56a7[_0xf4a3('0x32')]=_['intersection'](_0x5954fb[_0xf4a3('0x2d')],qs[_0xf4a3('0x33')](_0x3ca15c[_0xf4a3('0x2f')][_0xf4a3('0x33')]));_0x1d56a7[_0xf4a3('0x32')]=_0x1d56a7[_0xf4a3('0x32')][_0xf4a3('0x34')]?_0x1d56a7[_0xf4a3('0x32')]:_0x5954fb[_0xf4a3('0x2d')];if(_0x3ca15c['query'][_0xf4a3('0x3f')]){_0x1d56a7[_0xf4a3('0x45')]=[{'all':!![]}];}_0x1d56a7=_[_0xf4a3('0x3b')]({},_0x1d56a7,_0x3ca15c['options']);return db[_0xf4a3('0x29')][_0xf4a3('0x46')](_0x1d56a7)[_0xf4a3('0x22')](handleEntityNotFound(_0x35d33d,null))['then'](respondWithResult(_0x35d33d,null))[_0xf4a3('0x42')](handleError(_0x35d33d,null));};exports['create']=function(_0x3ff632,_0x3adc55){return db[_0xf4a3('0x29')]['create'](_0x3ff632[_0xf4a3('0x47')],{})[_0xf4a3('0x22')](respondWithResult(_0x3adc55,0xc9))[_0xf4a3('0x42')](handleError(_0x3adc55,null));};exports[_0xf4a3('0x21')]=function(_0x101234,_0x5ca4f4){if(_0x101234[_0xf4a3('0x47')]['id']){delete _0x101234['body']['id'];}return db['VoiceMailMessage'][_0xf4a3('0x46')]({'where':{'id':_0x101234[_0xf4a3('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ca4f4,null))[_0xf4a3('0x22')](saveUpdates(_0x101234['body'],null))['then'](respondWithResult(_0x5ca4f4,null))[_0xf4a3('0x42')](handleError(_0x5ca4f4,null));};exports[_0xf4a3('0x49')]=function(_0x28350c,_0x12e637){return db[_0xf4a3('0x29')]['find']({'where':{'id':_0x28350c['params']['id']}})[_0xf4a3('0x22')](handleEntityNotFound(_0x12e637,null))[_0xf4a3('0x22')](removeEntity(_0x12e637,null))[_0xf4a3('0x42')](handleError(_0x12e637,null));};exports[_0xf4a3('0x4a')]=function(_0x3d2cf5,_0x5d9571,_0x50a6c2){return db[_0xf4a3('0x29')][_0xf4a3('0x46')]({'where':{'id':_0x3d2cf5[_0xf4a3('0x48')]['id']},'attributes':['id',_0xf4a3('0x4b'),_0xf4a3('0x4c')]})[_0xf4a3('0x22')](handleEntityNotFound(_0x5d9571,null))['then'](function(_0x4497e5){if(_0x4497e5){if(!_0x4497e5[_0xf4a3('0x4b')]){throw new db[(_0xf4a3('0x4d'))][(_0xf4a3('0x4e'))](_0xf4a3('0x4f'));}var _0x464478={'Content-Type':_0xf4a3('0x50'),'Content-Disposition':_0xf4a3('0x51')};if(_0x4497e5['msg_id']){_0x464478[_0xf4a3('0x52')]=_0xf4a3('0x53')+_0x4497e5['msg_id']+_0xf4a3('0x54');}_0x5d9571[_0xf4a3('0x1e')](_0x464478);return _0x5d9571[_0xf4a3('0x26')](new Buffer(_0x4497e5[_0xf4a3('0x4b')]));}})[_0xf4a3('0x42')](handleError(_0x5d9571,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f2dfcc3..a19fc46 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 _0x3c28=['path','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','api','moment','bluebird','request-promise'];(function(_0x41723a,_0x4f60ee){var _0x13f078=function(_0x482419){while(--_0x482419){_0x41723a['push'](_0x41723a['shift']());}};_0x13f078(++_0x4f60ee);}(_0x3c28,0xd3));var _0x83c2=function(_0x434e94,_0x27a471){_0x434e94=_0x434e94-0x0;var _0x15fa33=_0x3c28[_0x434e94];return _0x15fa33;};'use strict';var _=require(_0x83c2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x83c2('0x1'));var moment=require(_0x83c2('0x2'));var BPromise=require(_0x83c2('0x3'));var rp=require(_0x83c2('0x4'));var fs=require('fs');var path=require(_0x83c2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x83c2('0x6'));module[_0x83c2('0x7')]=function(_0x56e63e,_0x232a1a){return _0x56e63e[_0x83c2('0x8')](_0x83c2('0x9'),attributes,{'tableName':_0x83c2('0xa'),'paranoid':![],'indexes':[{'name':_0x83c2('0xb'),'fields':[_0x83c2('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xdd8d=['../../config/logger','api','bluebird','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xdd8d,0x83));var _0xddd8=function(_0x3d1244,_0x156028){_0x3d1244=_0x3d1244-0x0;var _0x5d6372=_0xdd8d[_0x3d1244];return _0x5d6372;};'use strict';var _=require(_0xddd8('0x0'));var util=require('util');var logger=require(_0xddd8('0x1'))(_0xddd8('0x2'));var moment=require('moment');var BPromise=require(_0xddd8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xddd8('0x4'));var attributes=require(_0xddd8('0x5'));module[_0xddd8('0x6')]=function(_0x28dcde,_0x2ddbd9){return _0x28dcde[_0xddd8('0x7')](_0xddd8('0x8'),attributes,{'tableName':_0xddd8('0x9'),'paranoid':![],'indexes':[{'name':_0xddd8('0xa'),'fields':[_0xddd8('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 461c53a..5bad32c 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 _0x80aa=['client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x582e5a,_0x2777b5){var _0x1df092=function(_0x431537){while(--_0x431537){_0x582e5a['push'](_0x582e5a['shift']());}};_0x1df092(++_0x2777b5);}(_0x80aa,0x11f));var _0xa80a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa80a('0x0'));var util=require('util');var moment=require(_0xa80a('0x1'));var BPromise=require(_0xa80a('0x2'));var rs=require(_0xa80a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa80a('0x4'))(_0xa80a('0x5'));var config=require(_0xa80a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa80a('0x7')][_0xa80a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d7dfe,_0x161e70,_0x197fa6){return new BPromise(function(_0x3586e9,_0x116517){return client[_0xa80a('0x9')](_0x3d7dfe,_0x197fa6)[_0xa80a('0xa')](function(_0x47b52d){logger[_0xa80a('0xb')](_0xa80a('0xc'),_0x161e70,'request\x20sent');logger[_0xa80a('0xd')](_0xa80a('0xe'),_0x161e70,_0xa80a('0xf'),JSON[_0xa80a('0x10')](_0x47b52d));if(_0x47b52d[_0xa80a('0x11')]){if(_0x47b52d[_0xa80a('0x11')][_0xa80a('0x12')]===0x1f4){logger[_0xa80a('0x11')](_0xa80a('0xc'),_0x161e70,_0x47b52d[_0xa80a('0x11')][_0xa80a('0x13')]);return _0x116517(_0x47b52d[_0xa80a('0x11')][_0xa80a('0x13')]);}logger[_0xa80a('0x11')](_0xa80a('0xc'),_0x161e70,_0x47b52d['error'][_0xa80a('0x13')]);return _0x3586e9(_0x47b52d[_0xa80a('0x11')]['message']);}else{logger[_0xa80a('0xb')](_0xa80a('0xc'),_0x161e70,_0xa80a('0xf'));_0x3586e9(_0x47b52d['result']['message']);}})[_0xa80a('0x14')](function(_0x164380){logger[_0xa80a('0x11')](_0xa80a('0xc'),_0x161e70,_0x164380);_0x116517(_0x164380);});});} \ No newline at end of file +var _0xd2df=['moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util'];(function(_0x3cd29c,_0x3cc121){var _0x4b7d3b=function(_0x4aa3d0){while(--_0x4aa3d0){_0x3cd29c['push'](_0x3cd29c['shift']());}};_0x4b7d3b(++_0x3cc121);}(_0xd2df,0x11c));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfd2d('0x0'));var moment=require(_0xfd2d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd2d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd2d('0x3'));var logger=require(_0xfd2d('0x4'))(_0xfd2d('0x5'));var config=require(_0xfd2d('0x6'));var jayson=require(_0xfd2d('0x7'));var client=jayson[_0xfd2d('0x8')][_0xfd2d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5579d7,_0x6b2ebc,_0x20f803){return new BPromise(function(_0x38cdec,_0x46c6b7){return client[_0xfd2d('0xa')](_0x5579d7,_0x20f803)[_0xfd2d('0xb')](function(_0x2e4679){logger['info'](_0xfd2d('0xc'),_0x6b2ebc,_0xfd2d('0xd'));logger[_0xfd2d('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x6b2ebc,_0xfd2d('0xd'),JSON[_0xfd2d('0xf')](_0x2e4679));if(_0x2e4679[_0xfd2d('0x10')]){if(_0x2e4679[_0xfd2d('0x10')]['code']===0x1f4){logger[_0xfd2d('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x6b2ebc,_0x2e4679[_0xfd2d('0x10')][_0xfd2d('0x11')]);return _0x46c6b7(_0x2e4679[_0xfd2d('0x10')][_0xfd2d('0x11')]);}logger[_0xfd2d('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x6b2ebc,_0x2e4679[_0xfd2d('0x10')][_0xfd2d('0x11')]);return _0x38cdec(_0x2e4679[_0xfd2d('0x10')]['message']);}else{logger['info'](_0xfd2d('0xc'),_0x6b2ebc,'request\x20sent');_0x38cdec(_0x2e4679[_0xfd2d('0x12')][_0xfd2d('0x11')]);}})['catch'](function(_0x76a8a0){logger[_0xfd2d('0x10')](_0xfd2d('0xc'),_0x6b2ebc,_0x76a8a0);_0x46c6b7(_0x76a8a0);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3aff297..e229044 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 _0x18c7=['show','/:id/sounds','getSounds','post','put','update','destroy','delete','/:id/sounds/:id2','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id'];(function(_0x522418,_0x3a7859){var _0x34aedb=function(_0x1e0987){while(--_0x1e0987){_0x522418['push'](_0x522418['shift']());}};_0x34aedb(++_0x3a7859);}(_0x18c7,0x14c));var _0x718c=function(_0x1e624c,_0x26a9e7){_0x1e624c=_0x1e624c-0x0;var _0x2b90b2=_0x18c7[_0x1e624c];return _0x2b90b2;};'use strict';var multer=require(_0x718c('0x0'));var util=require(_0x718c('0x1'));var path=require(_0x718c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x718c('0x3')]();var fs_extra=require(_0x718c('0x4'));var auth=require(_0x718c('0x5'));var interaction=require(_0x718c('0x6'));var config=require(_0x718c('0x7'));var controller=require(_0x718c('0x8'));router[_0x718c('0x9')]('/',auth[_0x718c('0xa')](),controller[_0x718c('0xb')]);router[_0x718c('0x9')](_0x718c('0xc'),auth[_0x718c('0xa')](),controller[_0x718c('0xd')]);router[_0x718c('0x9')](_0x718c('0xe'),auth[_0x718c('0xa')](),controller[_0x718c('0xf')]);router[_0x718c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x718c('0x10')](_0x718c('0xe'),auth[_0x718c('0xa')](),controller['addSound']);router[_0x718c('0x11')]('/:id',auth[_0x718c('0xa')](),controller[_0x718c('0x12')]);router['delete'](_0x718c('0xc'),auth['isAuthenticated'](),controller[_0x718c('0x13')]);router[_0x718c('0x14')](_0x718c('0x15'),auth[_0x718c('0xa')](),controller['removeSound']);module[_0x718c('0x16')]=router; \ No newline at end of file +var _0xeedb=['delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','/:id/sounds','addSound','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeedb,0xb4));var _0xbeed=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xeedb[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0xbeed('0x0'));var util=require(_0xbeed('0x1'));var path=require('path');var timeout=require(_0xbeed('0x2'));var express=require(_0xbeed('0x3'));var router=express[_0xbeed('0x4')]();var fs_extra=require(_0xbeed('0x5'));var auth=require(_0xbeed('0x6'));var interaction=require(_0xbeed('0x7'));var config=require('../../config/environment');var controller=require(_0xbeed('0x8'));router[_0xbeed('0x9')]('/',auth[_0xbeed('0xa')](),controller[_0xbeed('0xb')]);router[_0xbeed('0x9')](_0xbeed('0xc'),auth[_0xbeed('0xa')](),controller[_0xbeed('0xd')]);router['get']('/:id/sounds',auth['isAuthenticated'](),controller[_0xbeed('0xe')]);router[_0xbeed('0xf')]('/',auth[_0xbeed('0xa')](),controller['create']);router[_0xbeed('0xf')](_0xbeed('0x10'),auth[_0xbeed('0xa')](),controller[_0xbeed('0x11')]);router[_0xbeed('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbeed('0x13')]);router[_0xbeed('0x14')](_0xbeed('0xc'),auth['isAuthenticated'](),controller[_0xbeed('0x15')]);router[_0xbeed('0x14')](_0xbeed('0x16'),auth['isAuthenticated'](),controller[_0xbeed('0x17')]);module[_0xbeed('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 3871df2..56e5269 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 _0x6c86=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','STRING','name','ENUM','custom'];(function(_0xba94cc,_0x2b17c3){var _0x5e0170=function(_0xd22d58){while(--_0xd22d58){_0xba94cc['push'](_0xba94cc['shift']());}};_0x5e0170(++_0x2b17c3);}(_0x6c86,0x1b7));var _0x66c8=function(_0x4f9c46,_0x361afe){_0x4f9c46=_0x4f9c46-0x0;var _0x155365=_0x6c86[_0x4f9c46];return _0x155365;};'use strict';var Sequelize=require(_0x66c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x66c8('0x1')],'allowNull':![],'unique':_0x66c8('0x2')},'mode':{'type':Sequelize[_0x66c8('0x3')](_0x66c8('0x4'),_0x66c8('0x5'),_0x66c8('0x6'),_0x66c8('0x7'),_0x66c8('0x8'),_0x66c8('0x9')),'allowNull':!![],'defaultValue':_0x66c8('0x5')},'directory':{'type':Sequelize[_0x66c8('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x66c8('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x66c8('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x66c8('0x1')],'allowNull':!![],'defaultValue':_0x66c8('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x66c8('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc770=['name','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x131aa1,_0x400b56){var _0x429a89=function(_0x166d38){while(--_0x166d38){_0x131aa1['push'](_0x131aa1['shift']());}};_0x429a89(++_0x400b56);}(_0xc770,0x18b));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0c77('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0c77('0x1')},'mode':{'type':Sequelize['ENUM'](_0x0c77('0x2'),'files',_0x0c77('0x3'),_0x0c77('0x4'),_0x0c77('0x5'),_0x0c77('0x6')),'allowNull':!![],'defaultValue':_0x0c77('0x7')},'directory':{'type':Sequelize[_0x0c77('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x0c77('0x8')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0c77('0x9')},'format':{'type':Sequelize[_0x0c77('0x8')],'allowNull':!![]},'stamp':{'type':_0x0c77('0xa')},'defaultEntry':{'type':Sequelize[_0x0c77('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 9955f08..b9736b5 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 _0x38c7=['server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','%s.%s','basename','extname','converted_format','format','symlinkSync','removeSound','id2','order','getSounds','nolimit','eml-format','rimraf','zip-dir','moment','bluebird','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','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','body','params','transaction','mode','files','directory','join','root'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38c7,0x10b));var _0x738c=function(_0x4fef17,_0x3c399d){_0x4fef17=_0x4fef17-0x0;var _0x5be22d=_0x38c7[_0x4fef17];return _0x5be22d;};'use strict';var emlformat=require(_0x738c('0x0'));var rimraf=require(_0x738c('0x1'));var zipdir=require(_0x738c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x738c('0x3'));var BPromise=require(_0x738c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x738c('0x5'));var sox=require(_0x738c('0x6'));var csv=require(_0x738c('0x7'));var ejs=require(_0x738c('0x8'));var fs=require('fs');var fs_extra=require(_0x738c('0x9'));var _=require('lodash');var squel=require(_0x738c('0xa'));var crypto=require(_0x738c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x738c('0xc'));var toCsv=require(_0x738c('0x7'));var querystring=require(_0x738c('0xd'));var Papa=require(_0x738c('0xe'));var Redis=require(_0x738c('0xf'));var authService=require(_0x738c('0x10'));var qs=require(_0x738c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x738c('0x12'));var logger=require(_0x738c('0x13'))(_0x738c('0x14'));var utils=require(_0x738c('0x15'));var config=require(_0x738c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x738c('0x17'))['db'];function respondWithStatusCode(_0x568d0f,_0x584053){_0x584053=_0x584053||0xcc;return function(_0x1dd564){if(_0x1dd564){return _0x568d0f[_0x738c('0x18')](_0x584053);}return _0x568d0f[_0x738c('0x19')](_0x584053)['end']();};}function respondWithResult(_0x3033aa,_0x5d8622){_0x5d8622=_0x5d8622||0xc8;return function(_0xbbf975){if(_0xbbf975){return _0x3033aa[_0x738c('0x19')](_0x5d8622)['json'](_0xbbf975);}};}function respondWithFilteredResult(_0x1bde49,_0x10ec24){return function(_0x45c55b){if(_0x45c55b){var _0x24fa3d=typeof _0x10ec24[_0x738c('0x1a')]===_0x738c('0x1b')&&typeof _0x10ec24[_0x738c('0x1c')]===_0x738c('0x1b');var _0x364873=_0x45c55b[_0x738c('0x1d')];var _0xf2ffd0=_0x24fa3d?0x0:_0x10ec24[_0x738c('0x1a')];var _0x229126=_0x24fa3d?_0x45c55b[_0x738c('0x1d')]:_0x10ec24[_0x738c('0x1a')]+_0x10ec24['limit'];var _0x3fa63f;if(_0x229126>=_0x364873){_0x229126=_0x364873;_0x3fa63f=0xc8;}else{_0x3fa63f=0xce;}_0x1bde49[_0x738c('0x19')](_0x3fa63f);return _0x1bde49[_0x738c('0x1e')]('Content-Range',_0xf2ffd0+'-'+_0x229126+'/'+_0x364873)[_0x738c('0x1f')](_0x45c55b);}return null;};}function patchUpdates(_0x5d7861){return function(_0x3a5fc6){try{jsonpatch[_0x738c('0x20')](_0x3a5fc6,_0x5d7861,!![]);}catch(_0xee5b9f){return BPromise['reject'](_0xee5b9f);}return _0x3a5fc6[_0x738c('0x21')]();};}function saveUpdates(_0x3e6239,_0x30f6ee){return function(_0x502dc7){if(_0x502dc7){return _0x502dc7[_0x738c('0x22')](_0x3e6239)[_0x738c('0x23')](function(_0x8e1356){return _0x8e1356;});}return null;};}function removeEntity(_0x389b46,_0x3c0715){return function(_0x255e9b){if(_0x255e9b){return _0x255e9b[_0x738c('0x24')]()[_0x738c('0x23')](function(){var _0x1fb11c=_0x255e9b[_0x738c('0x25')]({'plain':!![]});var _0x569453=_0x738c('0x26');return db[_0x738c('0x27')][_0x738c('0x24')]({'where':{'type':_0x569453,'resourceId':_0x1fb11c['id']}})[_0x738c('0x23')](function(){return _0x255e9b;});})['then'](function(){_0x389b46[_0x738c('0x19')](0xcc)[_0x738c('0x28')]();});}};}function handleEntityNotFound(_0x2d0a61,_0x39dcf5){return function(_0x37f429){if(!_0x37f429){_0x2d0a61[_0x738c('0x18')](0x194);}return _0x37f429;};}function handleError(_0x1a98a9,_0x4870ed){_0x4870ed=_0x4870ed||0x1f4;return function(_0x56be26){logger[_0x738c('0x29')](_0x56be26[_0x738c('0x2a')]);if(_0x56be26[_0x738c('0x2b')]){delete _0x56be26[_0x738c('0x2b')];}_0x1a98a9[_0x738c('0x19')](_0x4870ed)['send'](_0x56be26);};}exports[_0x738c('0x2c')]=function(_0xa230de,_0x17bbdf){var _0x17d61b={},_0x3e0d41={},_0x257bde={'count':0x0,'rows':[]};var _0x4e0124=_[_0x738c('0x2d')](db[_0x738c('0x2e')][_0x738c('0x2f')],function(_0x112164){return{'name':_0x112164[_0x738c('0x30')],'type':_0x112164[_0x738c('0x31')][_0x738c('0x32')]};});_0x3e0d41[_0x738c('0x33')]=_['map'](_0x4e0124,_0x738c('0x2b'));_0x3e0d41[_0x738c('0x34')]=_['keys'](_0xa230de['query']);_0x3e0d41[_0x738c('0x35')]=_[_0x738c('0x36')](_0x3e0d41[_0x738c('0x33')],_0x3e0d41[_0x738c('0x34')]);_0x17d61b[_0x738c('0x37')]=_['intersection'](_0x3e0d41[_0x738c('0x33')],qs['fields'](_0xa230de[_0x738c('0x34')]['fields']));_0x17d61b[_0x738c('0x37')]=_0x17d61b[_0x738c('0x37')][_0x738c('0x38')]?_0x17d61b[_0x738c('0x37')]:_0x3e0d41[_0x738c('0x33')];if(!_0xa230de[_0x738c('0x34')][_0x738c('0x39')]('nolimit')){_0x17d61b[_0x738c('0x1c')]=qs[_0x738c('0x1c')](_0xa230de[_0x738c('0x34')]['limit']);_0x17d61b[_0x738c('0x1a')]=qs[_0x738c('0x1a')](_0xa230de[_0x738c('0x34')][_0x738c('0x1a')]);}_0x17d61b['order']=qs[_0x738c('0x3a')](_0xa230de[_0x738c('0x34')]['sort']);delete _0xa230de[_0x738c('0x34')][_0x738c('0x3a')];_0x17d61b[_0x738c('0x3b')]=qs['filters'](_[_0x738c('0x3c')](_0xa230de[_0x738c('0x34')],_0x3e0d41[_0x738c('0x35')]),_0x4e0124);if(_0xa230de[_0x738c('0x34')][_0x738c('0x3d')]){_0x17d61b['where']=_[_0x738c('0x3e')](_0x17d61b[_0x738c('0x3b')],{'$or':_['map'](_0x4e0124,function(_0x530b35){if(_0x530b35['type']!=='VIRTUAL'){var _0x203e60={};_0x203e60[_0x530b35[_0x738c('0x2b')]]={'$like':'%'+_0xa230de[_0x738c('0x34')][_0x738c('0x3d')]+'%'};return _0x203e60;}})});}_0x17d61b=_['merge']({},_0x17d61b,_0xa230de[_0x738c('0x3f')]);var _0x413817={'where':_0x17d61b[_0x738c('0x3b')]};return db[_0x738c('0x2e')][_0x738c('0x1d')](_0x413817)[_0x738c('0x23')](function(_0x2cf5d4){_0x257bde[_0x738c('0x1d')]=_0x2cf5d4;if(_0xa230de[_0x738c('0x34')][_0x738c('0x40')]){_0x17d61b[_0x738c('0x41')]=[{'all':!![]}];}return db[_0x738c('0x2e')][_0x738c('0x42')](_0x17d61b);})[_0x738c('0x23')](function(_0x1c7432){_0x257bde[_0x738c('0x43')]=_0x1c7432;return _0x257bde;})[_0x738c('0x23')](respondWithFilteredResult(_0x17bbdf,_0x17d61b))[_0x738c('0x44')](handleError(_0x17bbdf,null));};exports[_0x738c('0x45')]=function(_0xc35d51,_0x40046e){var _0x5ca55a={'raw':![],'where':{'id':_0xc35d51['params']['id']}},_0x264ca3={};_0x264ca3['model']=_[_0x738c('0x46')](db[_0x738c('0x2e')][_0x738c('0x2f')]);_0x264ca3[_0x738c('0x34')]=_[_0x738c('0x46')](_0xc35d51[_0x738c('0x34')]);_0x264ca3[_0x738c('0x35')]=_[_0x738c('0x36')](_0x264ca3[_0x738c('0x33')],_0x264ca3['query']);_0x5ca55a['attributes']=_[_0x738c('0x36')](_0x264ca3[_0x738c('0x33')],qs[_0x738c('0x47')](_0xc35d51['query'][_0x738c('0x47')]));_0x5ca55a[_0x738c('0x37')]=_0x5ca55a[_0x738c('0x37')]['length']?_0x5ca55a[_0x738c('0x37')]:_0x264ca3[_0x738c('0x33')];if(_0xc35d51['query'][_0x738c('0x40')]){_0x5ca55a[_0x738c('0x41')]=[{'all':!![]}];}_0x5ca55a=_[_0x738c('0x3e')]({},_0x5ca55a,_0xc35d51[_0x738c('0x3f')]);return db[_0x738c('0x2e')][_0x738c('0x48')](_0x5ca55a)[_0x738c('0x23')](handleEntityNotFound(_0x40046e,null))['then'](respondWithResult(_0x40046e,null))[_0x738c('0x44')](handleError(_0x40046e,null));};exports[_0x738c('0x22')]=function(_0x1ec41f,_0x3b3c79){if(_0x1ec41f[_0x738c('0x49')]['id']){delete _0x1ec41f[_0x738c('0x49')]['id'];}return db[_0x738c('0x2e')][_0x738c('0x48')]({'where':{'id':_0x1ec41f[_0x738c('0x4a')]['id']}})[_0x738c('0x23')](handleEntityNotFound(_0x3b3c79,null))['then'](saveUpdates(_0x1ec41f[_0x738c('0x49')],null))[_0x738c('0x23')](respondWithResult(_0x3b3c79,null))['catch'](handleError(_0x3b3c79,null));};exports['create']=function(_0x30bdfe,_0x49cf85,_0x11593e){return db['sequelize'][_0x738c('0x4b')](function(_0x49c91d){if(_0x30bdfe[_0x738c('0x49')][_0x738c('0x4c')]===_0x738c('0x4d')){_0x30bdfe[_0x738c('0x49')][_0x738c('0x4e')]=path[_0x738c('0x4f')](config[_0x738c('0x50')],_0x738c('0x51'),_0x30bdfe[_0x738c('0x49')]['name']);}return db[_0x738c('0x2e')][_0x738c('0x52')](_0x30bdfe[_0x738c('0x49')],{'transaction':_0x49c91d})[_0x738c('0x23')](function(_0x4c5722){if(_0x30bdfe[_0x738c('0x49')]['mode']===_0x738c('0x4d')){fs[_0x738c('0x53')](_0x4c5722[_0x738c('0x4e')],parseInt(_0x738c('0x54'),0x8));}var _0x451689=_0x30bdfe[_0x738c('0x55')][_0x738c('0x25')]({'plain':!![]});if(!_0x451689)throw new Error(_0x738c('0x56'));if(_0x451689['role']===_0x738c('0x55')){var _0x115fa1=_0x4c5722[_0x738c('0x25')]({'plain':!![]});return db[_0x738c('0x57')][_0x738c('0x48')]({'where':{'name':_0x738c('0x26'),'userProfileId':_0x451689[_0x738c('0x58')]},'raw':!![]})[_0x738c('0x23')](function(_0x1844cf){if(_0x1844cf&&_0x1844cf[_0x738c('0x59')]===0x0){return db[_0x738c('0x27')][_0x738c('0x52')]({'name':_0x115fa1[_0x738c('0x2b')],'resourceId':_0x115fa1['id'],'type':_0x1844cf[_0x738c('0x2b')],'sectionId':_0x1844cf['id']},{})[_0x738c('0x23')](function(){return _0x4c5722;});}else{return _0x4c5722;}})[_0x738c('0x44')](function(_0x3460bb){logger[_0x738c('0x29')](_0x738c('0x5a'),_0x3460bb);});}return _0x4c5722;});})[_0x738c('0x23')](respondWithResult(_0x49cf85,0xc9))[_0x738c('0x44')](handleError(_0x49cf85,null));};exports[_0x738c('0x24')]=function(_0x149c17,_0x459a2c,_0x1a4a29){var _0x325466;return db[_0x738c('0x2e')][_0x738c('0x48')]({'where':{'id':_0x149c17[_0x738c('0x4a')]['id']}})[_0x738c('0x23')](function(_0x20af55){if(_0x20af55){return db[_0x738c('0x5b')]['transaction'](function(_0x461301){return _0x20af55[_0x738c('0x24')]({'transaction':_0x461301,'raw':!![]})[_0x738c('0x23')](function(_0x42d94a){if(_0x42d94a[_0x738c('0x4e')]){fs[_0x738c('0x5c')](_0x42d94a[_0x738c('0x4e')])[_0x738c('0x5d')](function(_0x1de8f0){fs[_0x738c('0x5e')](path[_0x738c('0x4f')](_0x42d94a[_0x738c('0x4e')],_0x1de8f0));});fs[_0x738c('0x5f')](_0x42d94a['directory']);}return _0x42d94a;});})[_0x738c('0x44')](function(_0x2944de){throw new db[(_0x738c('0x60'))][(_0x738c('0x61'))](_0x2944de[_0x738c('0x62')]);});}})['then'](handleEntityNotFound(_0x459a2c,null))[_0x738c('0x23')](removeEntity(_0x459a2c,null))['catch'](handleError(_0x459a2c,null));};exports[_0x738c('0x63')]=function(_0x28eea3,_0xab7539,_0x7b258c){return db[_0x738c('0x5b')][_0x738c('0x4b')](function(_0x4571e4){var _0x5cda5b;return db[_0x738c('0x2e')]['find']({'where':{'id':_0x28eea3[_0x738c('0x4a')]['id']}})[_0x738c('0x23')](function(_0x184eeb){if(_0x184eeb){_0x5cda5b=_0x184eeb;return _0x184eeb[_0x738c('0x63')](_0x28eea3[_0x738c('0x49')]['id'],{'transaction':_0x4571e4});}})[_0x738c('0x23')](function(_0x2bec5e){if(_0x2bec5e){return db[_0x738c('0x64')][_0x738c('0x65')]({'where':{'id':_0x28eea3[_0x738c('0x49')]['id']},'attributes':['id',_0x738c('0x2b'),_0x738c('0x66'),'converted_format',_0x738c('0x67')],'raw':!![]});}})['then'](function(_0x5a4af5){if(_0x5a4af5){var _0x435147=path[_0x738c('0x4f')](config['root'],_0x738c('0x68'),util['format'](_0x738c('0x69'),path[_0x738c('0x6a')](_0x5a4af5['save_name'],path[_0x738c('0x6b')](_0x5a4af5[_0x738c('0x66')])),_0x5a4af5[_0x738c('0x6c')]));var _0x2972e3=path['join'](config['root'],'server/files/moh',_0x5cda5b[_0x738c('0x2b')],util[_0x738c('0x6d')](_0x738c('0x69'),_0x5a4af5[_0x738c('0x2b')],_0x5a4af5['converted_format']));fs[_0x738c('0x6e')](_0x435147,_0x2972e3);return _0x5a4af5;}})['catch'](function(_0x11cf88){throw new db['Sequelize'][(_0x738c('0x61'))](_0x11cf88[_0x738c('0x62')]);});})[_0x738c('0x23')](handleEntityNotFound(_0xab7539,null))[_0x738c('0x23')](respondWithResult(_0xab7539,0xc9))[_0x738c('0x44')](handleError(_0xab7539,null));};exports[_0x738c('0x6f')]=function(_0x58bc9,_0x5dcbd3,_0x5dd4ff){return db[_0x738c('0x5b')][_0x738c('0x4b')](function(_0x2fc8e3){var _0x1d2dd9;return db[_0x738c('0x2e')][_0x738c('0x65')]({'where':{'id':_0x58bc9['params']['id']}})['then'](handleEntityNotFound(_0x5dcbd3,null))['then'](function(_0x11d326){if(_0x11d326){_0x1d2dd9=_0x11d326;return _0x11d326[_0x738c('0x6f')](_0x58bc9[_0x738c('0x4a')][_0x738c('0x70')]);}})[_0x738c('0x23')](function(_0x2de905){if(_0x2de905){return db[_0x738c('0x64')][_0x738c('0x65')]({'where':{'id':_0x58bc9[_0x738c('0x4a')][_0x738c('0x70')]},'attributes':['id','name',_0x738c('0x66'),'converted_format',_0x738c('0x67')],'raw':!![]});}})[_0x738c('0x23')](function(_0x1ed5d6){if(_0x1ed5d6){fs['unlinkSync'](path['join'](_0x1d2dd9[_0x738c('0x4e')],util[_0x738c('0x6d')](_0x738c('0x69'),_0x1ed5d6[_0x738c('0x2b')],_0x1ed5d6['converted_format'])));return _0x1ed5d6;}})[_0x738c('0x44')](function(_0x2f390b){throw new db['Sequelize']['ValidationError'](_0x2f390b[_0x738c('0x62')]);});})[_0x738c('0x23')](handleEntityNotFound(_0x5dcbd3,null))[_0x738c('0x23')](respondWithStatusCode(_0x5dcbd3,0xcc))[_0x738c('0x44')](handleError(_0x5dcbd3,null));};exports['getSounds']=function(_0x7feea0,_0x4a6dd4,_0x290417){var _0x366795={};var _0x3fb452={};var _0x417961;var _0xc245;return db[_0x738c('0x2e')][_0x738c('0x65')]({'where':{'id':_0x7feea0['params']['id']}})['then'](handleEntityNotFound(_0x4a6dd4,null))['then'](function(_0x337db8){if(_0x337db8){_0x417961=_0x337db8;_0x3fb452[_0x738c('0x33')]=_[_0x738c('0x46')](db['Sound'][_0x738c('0x2f')]);_0x3fb452[_0x738c('0x34')]=_[_0x738c('0x46')](_0x7feea0[_0x738c('0x34')]);_0x3fb452['filters']=_[_0x738c('0x36')](_0x3fb452[_0x738c('0x33')],_0x3fb452[_0x738c('0x34')]);_0x366795[_0x738c('0x37')]=_[_0x738c('0x36')](_0x3fb452[_0x738c('0x33')],qs[_0x738c('0x47')](_0x7feea0[_0x738c('0x34')][_0x738c('0x47')]));_0x366795[_0x738c('0x37')]=_0x366795[_0x738c('0x37')][_0x738c('0x38')]?_0x366795[_0x738c('0x37')]:_0x3fb452[_0x738c('0x33')];_0x366795[_0x738c('0x71')]=qs[_0x738c('0x3a')](_0x7feea0[_0x738c('0x34')]['sort']);_0x366795[_0x738c('0x3b')]=qs[_0x738c('0x35')](_[_0x738c('0x3c')](_0x7feea0[_0x738c('0x34')],_0x3fb452[_0x738c('0x35')]));if(_0x7feea0[_0x738c('0x34')][_0x738c('0x3d')]){_0x366795[_0x738c('0x3b')]=_[_0x738c('0x3e')](_0x366795[_0x738c('0x3b')],{'$or':_[_0x738c('0x2d')](_0x366795[_0x738c('0x37')],function(_0x21fb05){var _0x5de235={};_0x5de235[_0x21fb05]={'$like':'%'+_0x7feea0['query'][_0x738c('0x3d')]+'%'};return _0x5de235;})});}_0x366795=_[_0x738c('0x3e')]({},_0x366795,_0x7feea0[_0x738c('0x3f')]);return _0x417961[_0x738c('0x72')](_0x366795);}})[_0x738c('0x23')](function(_0x3cd31a){if(_0x3cd31a){_0xc245=_0x3cd31a[_0x738c('0x38')];if(!_0x7feea0[_0x738c('0x34')][_0x738c('0x39')](_0x738c('0x73'))){_0x366795['limit']=qs['limit'](_0x7feea0[_0x738c('0x34')]['limit']);_0x366795[_0x738c('0x1a')]=qs[_0x738c('0x1a')](_0x7feea0['query']['offset']);}return _0x417961['getSounds'](_0x366795);}})['then'](function(_0x442dbc){if(_0x442dbc){return _0x442dbc?{'count':_0xc245,'rows':_0x442dbc}:null;}})[_0x738c('0x23')](respondWithResult(_0x4a6dd4,null))[_0x738c('0x44')](handleError(_0x4a6dd4,null));}; \ No newline at end of file +var _0xbf67=['symlinkSync','removeSound','id2','Sound','unlinkSync','getSounds','eml-format','zip-dir','request-promise','moment','bluebird','util','path','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/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','then','destroy','MusicOnHolds','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','rows','params','find','catch','update','body','create','sequelize','transaction','mode','files','server/files/moh','mkdirSync','directory','0777','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','converted_format','createdAt','join','root','server/files/sounds/converted','format','%s.%s','save_name','extname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbf67,0xe4));var _0x7bf6=function(_0x5647d2,_0x13291d){_0x5647d2=_0x5647d2-0x0;var _0x771d31=_0xbf67[_0x5647d2];return _0x771d31;};'use strict';var emlformat=require(_0x7bf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7bf6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7bf6('0x2'));var moment=require(_0x7bf6('0x3'));var BPromise=require(_0x7bf6('0x4'));var Mustache=require('mustache');var util=require(_0x7bf6('0x5'));var path=require(_0x7bf6('0x6'));var sox=require(_0x7bf6('0x7'));var csv=require(_0x7bf6('0x8'));var ejs=require(_0x7bf6('0x9'));var fs=require('fs');var fs_extra=require(_0x7bf6('0xa'));var _=require(_0x7bf6('0xb'));var squel=require('squel');var crypto=require(_0x7bf6('0xc'));var jsforce=require(_0x7bf6('0xd'));var deskjs=require(_0x7bf6('0xe'));var toCsv=require(_0x7bf6('0x8'));var querystring=require(_0x7bf6('0xf'));var Papa=require(_0x7bf6('0x10'));var Redis=require(_0x7bf6('0x11'));var authService=require(_0x7bf6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bf6('0x13'));var logger=require(_0x7bf6('0x14'))(_0x7bf6('0x15'));var utils=require(_0x7bf6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7bf6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55128e,_0x1e62c3){_0x1e62c3=_0x1e62c3||0xcc;return function(_0x5a6853){if(_0x5a6853){return _0x55128e[_0x7bf6('0x18')](_0x1e62c3);}return _0x55128e[_0x7bf6('0x19')](_0x1e62c3)[_0x7bf6('0x1a')]();};}function respondWithResult(_0x2507d5,_0x1a6f29){_0x1a6f29=_0x1a6f29||0xc8;return function(_0x1717db){if(_0x1717db){return _0x2507d5[_0x7bf6('0x19')](_0x1a6f29)['json'](_0x1717db);}};}function respondWithFilteredResult(_0x352d0c,_0x1e5eaf){return function(_0x2a8330){if(_0x2a8330){var _0x20d151=typeof _0x1e5eaf[_0x7bf6('0x1b')]===_0x7bf6('0x1c')&&typeof _0x1e5eaf['limit']==='undefined';var _0xf656a6=_0x2a8330[_0x7bf6('0x1d')];var _0x3c262c=_0x20d151?0x0:_0x1e5eaf['offset'];var _0x14f59c=_0x20d151?_0x2a8330[_0x7bf6('0x1d')]:_0x1e5eaf[_0x7bf6('0x1b')]+_0x1e5eaf[_0x7bf6('0x1e')];var _0x2e9e91;if(_0x14f59c>=_0xf656a6){_0x14f59c=_0xf656a6;_0x2e9e91=0xc8;}else{_0x2e9e91=0xce;}_0x352d0c[_0x7bf6('0x19')](_0x2e9e91);return _0x352d0c[_0x7bf6('0x1f')]('Content-Range',_0x3c262c+'-'+_0x14f59c+'/'+_0xf656a6)[_0x7bf6('0x20')](_0x2a8330);}return null;};}function patchUpdates(_0x293e7d){return function(_0x40b783){try{jsonpatch['apply'](_0x40b783,_0x293e7d,!![]);}catch(_0xca99a9){return BPromise['reject'](_0xca99a9);}return _0x40b783['save']();};}function saveUpdates(_0x50417e,_0x58918a){return function(_0x18c4d6){if(_0x18c4d6){return _0x18c4d6['update'](_0x50417e)[_0x7bf6('0x21')](function(_0x317f5b){return _0x317f5b;});}return null;};}function removeEntity(_0x50a601,_0x58dd67){return function(_0x3d9bc4){if(_0x3d9bc4){return _0x3d9bc4[_0x7bf6('0x22')]()[_0x7bf6('0x21')](function(){var _0x29980e=_0x3d9bc4['get']({'plain':!![]});var _0x1c35f5=_0x7bf6('0x23');return db[_0x7bf6('0x24')][_0x7bf6('0x22')]({'where':{'type':_0x1c35f5,'resourceId':_0x29980e['id']}})[_0x7bf6('0x21')](function(){return _0x3d9bc4;});})['then'](function(){_0x50a601[_0x7bf6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54989b,_0x4a09e2){return function(_0x30c9be){if(!_0x30c9be){_0x54989b[_0x7bf6('0x18')](0x194);}return _0x30c9be;};}function handleError(_0xd9ac73,_0x24baac){_0x24baac=_0x24baac||0x1f4;return function(_0x266419){logger[_0x7bf6('0x25')](_0x266419['stack']);if(_0x266419[_0x7bf6('0x26')]){delete _0x266419[_0x7bf6('0x26')];}_0xd9ac73[_0x7bf6('0x19')](_0x24baac)[_0x7bf6('0x27')](_0x266419);};}exports[_0x7bf6('0x28')]=function(_0x254a17,_0x31aa1c){var _0x50ced9={},_0x3514a9={},_0x193bc1={'count':0x0,'rows':[]};var _0x3065fc=_[_0x7bf6('0x29')](db['VoiceMusicOnHold'][_0x7bf6('0x2a')],function(_0x470819){return{'name':_0x470819[_0x7bf6('0x2b')],'type':_0x470819[_0x7bf6('0x2c')][_0x7bf6('0x2d')]};});_0x3514a9[_0x7bf6('0x2e')]=_[_0x7bf6('0x29')](_0x3065fc,_0x7bf6('0x26'));_0x3514a9[_0x7bf6('0x2f')]=_[_0x7bf6('0x30')](_0x254a17['query']);_0x3514a9[_0x7bf6('0x31')]=_['intersection'](_0x3514a9[_0x7bf6('0x2e')],_0x3514a9[_0x7bf6('0x2f')]);_0x50ced9[_0x7bf6('0x32')]=_[_0x7bf6('0x33')](_0x3514a9[_0x7bf6('0x2e')],qs[_0x7bf6('0x34')](_0x254a17['query']['fields']));_0x50ced9[_0x7bf6('0x32')]=_0x50ced9[_0x7bf6('0x32')][_0x7bf6('0x35')]?_0x50ced9[_0x7bf6('0x32')]:_0x3514a9[_0x7bf6('0x2e')];if(!_0x254a17[_0x7bf6('0x2f')][_0x7bf6('0x36')](_0x7bf6('0x37'))){_0x50ced9[_0x7bf6('0x1e')]=qs['limit'](_0x254a17[_0x7bf6('0x2f')][_0x7bf6('0x1e')]);_0x50ced9[_0x7bf6('0x1b')]=qs[_0x7bf6('0x1b')](_0x254a17[_0x7bf6('0x2f')][_0x7bf6('0x1b')]);}_0x50ced9[_0x7bf6('0x38')]=qs[_0x7bf6('0x39')](_0x254a17['query'][_0x7bf6('0x39')]);delete _0x254a17[_0x7bf6('0x2f')]['sort'];_0x50ced9[_0x7bf6('0x3a')]=qs[_0x7bf6('0x31')](_[_0x7bf6('0x3b')](_0x254a17['query'],_0x3514a9[_0x7bf6('0x31')]),_0x3065fc);if(_0x254a17[_0x7bf6('0x2f')][_0x7bf6('0x3c')]){_0x50ced9[_0x7bf6('0x3a')]=_[_0x7bf6('0x3d')](_0x50ced9[_0x7bf6('0x3a')],{'$or':_[_0x7bf6('0x29')](_0x3065fc,function(_0x16aa74){if(_0x16aa74[_0x7bf6('0x2c')]!==_0x7bf6('0x3e')){var _0x61b619={};_0x61b619[_0x16aa74[_0x7bf6('0x26')]]={'$like':'%'+_0x254a17[_0x7bf6('0x2f')][_0x7bf6('0x3c')]+'%'};return _0x61b619;}})});}_0x50ced9=_[_0x7bf6('0x3d')]({},_0x50ced9,_0x254a17[_0x7bf6('0x3f')]);var _0x4bcb23={'where':_0x50ced9[_0x7bf6('0x3a')]};return db[_0x7bf6('0x40')][_0x7bf6('0x1d')](_0x4bcb23)[_0x7bf6('0x21')](function(_0x113161){_0x193bc1['count']=_0x113161;if(_0x254a17['query'][_0x7bf6('0x41')]){_0x50ced9[_0x7bf6('0x42')]=[{'all':!![]}];}return db[_0x7bf6('0x40')]['findAll'](_0x50ced9);})[_0x7bf6('0x21')](function(_0xfd2ed8){_0x193bc1[_0x7bf6('0x43')]=_0xfd2ed8;return _0x193bc1;})[_0x7bf6('0x21')](respondWithFilteredResult(_0x31aa1c,_0x50ced9))['catch'](handleError(_0x31aa1c,null));};exports['show']=function(_0x538969,_0x17f2cf){var _0x256416={'raw':![],'where':{'id':_0x538969[_0x7bf6('0x44')]['id']}},_0x2bedf3={};_0x2bedf3[_0x7bf6('0x2e')]=_[_0x7bf6('0x30')](db[_0x7bf6('0x40')][_0x7bf6('0x2a')]);_0x2bedf3[_0x7bf6('0x2f')]=_[_0x7bf6('0x30')](_0x538969[_0x7bf6('0x2f')]);_0x2bedf3['filters']=_[_0x7bf6('0x33')](_0x2bedf3[_0x7bf6('0x2e')],_0x2bedf3['query']);_0x256416[_0x7bf6('0x32')]=_[_0x7bf6('0x33')](_0x2bedf3[_0x7bf6('0x2e')],qs['fields'](_0x538969[_0x7bf6('0x2f')][_0x7bf6('0x34')]));_0x256416[_0x7bf6('0x32')]=_0x256416[_0x7bf6('0x32')][_0x7bf6('0x35')]?_0x256416[_0x7bf6('0x32')]:_0x2bedf3['model'];if(_0x538969[_0x7bf6('0x2f')][_0x7bf6('0x41')]){_0x256416[_0x7bf6('0x42')]=[{'all':!![]}];}_0x256416=_[_0x7bf6('0x3d')]({},_0x256416,_0x538969[_0x7bf6('0x3f')]);return db[_0x7bf6('0x40')][_0x7bf6('0x45')](_0x256416)[_0x7bf6('0x21')](handleEntityNotFound(_0x17f2cf,null))[_0x7bf6('0x21')](respondWithResult(_0x17f2cf,null))[_0x7bf6('0x46')](handleError(_0x17f2cf,null));};exports[_0x7bf6('0x47')]=function(_0x1be249,_0x26789a){if(_0x1be249[_0x7bf6('0x48')]['id']){delete _0x1be249[_0x7bf6('0x48')]['id'];}return db['VoiceMusicOnHold'][_0x7bf6('0x45')]({'where':{'id':_0x1be249[_0x7bf6('0x44')]['id']}})[_0x7bf6('0x21')](handleEntityNotFound(_0x26789a,null))[_0x7bf6('0x21')](saveUpdates(_0x1be249[_0x7bf6('0x48')],null))[_0x7bf6('0x21')](respondWithResult(_0x26789a,null))['catch'](handleError(_0x26789a,null));};exports[_0x7bf6('0x49')]=function(_0x3c42c6,_0x5645f8,_0x5a59d8){return db[_0x7bf6('0x4a')][_0x7bf6('0x4b')](function(_0x2865d2){if(_0x3c42c6['body'][_0x7bf6('0x4c')]===_0x7bf6('0x4d')){_0x3c42c6[_0x7bf6('0x48')]['directory']=path['join'](config['root'],_0x7bf6('0x4e'),_0x3c42c6[_0x7bf6('0x48')]['name']);}return db[_0x7bf6('0x40')][_0x7bf6('0x49')](_0x3c42c6[_0x7bf6('0x48')],{'transaction':_0x2865d2})['then'](function(_0x46d937){if(_0x3c42c6[_0x7bf6('0x48')][_0x7bf6('0x4c')]===_0x7bf6('0x4d')){fs[_0x7bf6('0x4f')](_0x46d937[_0x7bf6('0x50')],parseInt(_0x7bf6('0x51'),0x8));}var _0x525456=_0x3c42c6[_0x7bf6('0x52')][_0x7bf6('0x53')]({'plain':!![]});if(!_0x525456)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x525456[_0x7bf6('0x54')]===_0x7bf6('0x52')){var _0x2ee214=_0x46d937[_0x7bf6('0x53')]({'plain':!![]});return db['UserProfileSection'][_0x7bf6('0x45')]({'where':{'name':'MusicOnHolds','userProfileId':_0x525456[_0x7bf6('0x55')]},'raw':!![]})[_0x7bf6('0x21')](function(_0x45c854){if(_0x45c854&&_0x45c854[_0x7bf6('0x56')]===0x0){return db[_0x7bf6('0x24')][_0x7bf6('0x49')]({'name':_0x2ee214[_0x7bf6('0x26')],'resourceId':_0x2ee214['id'],'type':_0x45c854[_0x7bf6('0x26')],'sectionId':_0x45c854['id']},{})[_0x7bf6('0x21')](function(){return _0x46d937;});}else{return _0x46d937;}})[_0x7bf6('0x46')](function(_0x1a1bdd){logger[_0x7bf6('0x25')](_0x7bf6('0x57'),_0x1a1bdd);});}return _0x46d937;});})[_0x7bf6('0x21')](respondWithResult(_0x5645f8,0xc9))[_0x7bf6('0x46')](handleError(_0x5645f8,null));};exports[_0x7bf6('0x22')]=function(_0xc19175,_0x4467c1,_0x261817){var _0x584fe1;return db[_0x7bf6('0x40')]['find']({'where':{'id':_0xc19175[_0x7bf6('0x44')]['id']}})[_0x7bf6('0x21')](function(_0x202278){if(_0x202278){return db['sequelize']['transaction'](function(_0xef7684){return _0x202278['destroy']({'transaction':_0xef7684,'raw':!![]})[_0x7bf6('0x21')](function(_0x14570a){if(_0x14570a[_0x7bf6('0x50')]){fs[_0x7bf6('0x58')](_0x14570a[_0x7bf6('0x50')])[_0x7bf6('0x59')](function(_0x21b1a6){fs['unlinkSync'](path['join'](_0x14570a[_0x7bf6('0x50')],_0x21b1a6));});fs[_0x7bf6('0x5a')](_0x14570a['directory']);}return _0x14570a;});})[_0x7bf6('0x46')](function(_0x2ececf){throw new db[(_0x7bf6('0x5b'))][(_0x7bf6('0x5c'))](_0x2ececf[_0x7bf6('0x5d')]);});}})['then'](handleEntityNotFound(_0x4467c1,null))['then'](removeEntity(_0x4467c1,null))[_0x7bf6('0x46')](handleError(_0x4467c1,null));};exports[_0x7bf6('0x5e')]=function(_0x20841c,_0xb31a00,_0x1d0ba3){return db['sequelize'][_0x7bf6('0x4b')](function(_0x43e160){var _0x3b6546;return db[_0x7bf6('0x40')]['find']({'where':{'id':_0x20841c[_0x7bf6('0x44')]['id']}})[_0x7bf6('0x21')](function(_0x3903ab){if(_0x3903ab){_0x3b6546=_0x3903ab;return _0x3903ab[_0x7bf6('0x5e')](_0x20841c[_0x7bf6('0x48')]['id'],{'transaction':_0x43e160});}})['then'](function(_0x2a3e62){if(_0x2a3e62){return db['Sound'][_0x7bf6('0x5f')]({'where':{'id':_0x20841c[_0x7bf6('0x48')]['id']},'attributes':['id',_0x7bf6('0x26'),'save_name',_0x7bf6('0x60'),_0x7bf6('0x61')],'raw':!![]});}})[_0x7bf6('0x21')](function(_0x2c5920){if(_0x2c5920){var _0x1304a7=path[_0x7bf6('0x62')](config[_0x7bf6('0x63')],_0x7bf6('0x64'),util[_0x7bf6('0x65')](_0x7bf6('0x66'),path['basename'](_0x2c5920[_0x7bf6('0x67')],path[_0x7bf6('0x68')](_0x2c5920[_0x7bf6('0x67')])),_0x2c5920[_0x7bf6('0x60')]));var _0x2efdfb=path[_0x7bf6('0x62')](config[_0x7bf6('0x63')],'server/files/moh',_0x3b6546[_0x7bf6('0x26')],util[_0x7bf6('0x65')]('%s.%s',_0x2c5920['name'],_0x2c5920[_0x7bf6('0x60')]));fs[_0x7bf6('0x69')](_0x1304a7,_0x2efdfb);return _0x2c5920;}})[_0x7bf6('0x46')](function(_0x324fb8){throw new db[(_0x7bf6('0x5b'))][(_0x7bf6('0x5c'))](_0x324fb8[_0x7bf6('0x5d')]);});})[_0x7bf6('0x21')](handleEntityNotFound(_0xb31a00,null))[_0x7bf6('0x21')](respondWithResult(_0xb31a00,0xc9))[_0x7bf6('0x46')](handleError(_0xb31a00,null));};exports[_0x7bf6('0x6a')]=function(_0x224d62,_0x1aafc1,_0x25f1c2){return db[_0x7bf6('0x4a')][_0x7bf6('0x4b')](function(_0x17f8e6){var _0x4c029a;return db[_0x7bf6('0x40')]['findOne']({'where':{'id':_0x224d62['params']['id']}})[_0x7bf6('0x21')](handleEntityNotFound(_0x1aafc1,null))[_0x7bf6('0x21')](function(_0x10f7be){if(_0x10f7be){_0x4c029a=_0x10f7be;return _0x10f7be['removeSound'](_0x224d62[_0x7bf6('0x44')][_0x7bf6('0x6b')]);}})[_0x7bf6('0x21')](function(_0x481583){if(_0x481583){return db[_0x7bf6('0x6c')][_0x7bf6('0x5f')]({'where':{'id':_0x224d62[_0x7bf6('0x44')][_0x7bf6('0x6b')]},'attributes':['id','name',_0x7bf6('0x67'),_0x7bf6('0x60'),_0x7bf6('0x61')],'raw':!![]});}})[_0x7bf6('0x21')](function(_0x14e10a){if(_0x14e10a){fs[_0x7bf6('0x6d')](path[_0x7bf6('0x62')](_0x4c029a[_0x7bf6('0x50')],util[_0x7bf6('0x65')](_0x7bf6('0x66'),_0x14e10a[_0x7bf6('0x26')],_0x14e10a[_0x7bf6('0x60')])));return _0x14e10a;}})['catch'](function(_0x56769f){throw new db[(_0x7bf6('0x5b'))][(_0x7bf6('0x5c'))](_0x56769f[_0x7bf6('0x5d')]);});})[_0x7bf6('0x21')](handleEntityNotFound(_0x1aafc1,null))['then'](respondWithStatusCode(_0x1aafc1,0xcc))[_0x7bf6('0x46')](handleError(_0x1aafc1,null));};exports[_0x7bf6('0x6e')]=function(_0x3565fa,_0x1c5d6f,_0x286612){var _0x1e7c1f={};var _0x17543f={};var _0x5c8c61;var _0x50239e;return db[_0x7bf6('0x40')][_0x7bf6('0x5f')]({'where':{'id':_0x3565fa[_0x7bf6('0x44')]['id']}})[_0x7bf6('0x21')](handleEntityNotFound(_0x1c5d6f,null))[_0x7bf6('0x21')](function(_0x10e6dd){if(_0x10e6dd){_0x5c8c61=_0x10e6dd;_0x17543f[_0x7bf6('0x2e')]=_[_0x7bf6('0x30')](db['Sound'][_0x7bf6('0x2a')]);_0x17543f['query']=_['keys'](_0x3565fa[_0x7bf6('0x2f')]);_0x17543f[_0x7bf6('0x31')]=_[_0x7bf6('0x33')](_0x17543f[_0x7bf6('0x2e')],_0x17543f[_0x7bf6('0x2f')]);_0x1e7c1f['attributes']=_[_0x7bf6('0x33')](_0x17543f[_0x7bf6('0x2e')],qs[_0x7bf6('0x34')](_0x3565fa['query'][_0x7bf6('0x34')]));_0x1e7c1f[_0x7bf6('0x32')]=_0x1e7c1f[_0x7bf6('0x32')][_0x7bf6('0x35')]?_0x1e7c1f[_0x7bf6('0x32')]:_0x17543f[_0x7bf6('0x2e')];_0x1e7c1f[_0x7bf6('0x38')]=qs[_0x7bf6('0x39')](_0x3565fa['query'][_0x7bf6('0x39')]);_0x1e7c1f['where']=qs[_0x7bf6('0x31')](_[_0x7bf6('0x3b')](_0x3565fa[_0x7bf6('0x2f')],_0x17543f['filters']));if(_0x3565fa[_0x7bf6('0x2f')][_0x7bf6('0x3c')]){_0x1e7c1f[_0x7bf6('0x3a')]=_[_0x7bf6('0x3d')](_0x1e7c1f[_0x7bf6('0x3a')],{'$or':_[_0x7bf6('0x29')](_0x1e7c1f['attributes'],function(_0x2a13d2){var _0x4b8f1a={};_0x4b8f1a[_0x2a13d2]={'$like':'%'+_0x3565fa[_0x7bf6('0x2f')][_0x7bf6('0x3c')]+'%'};return _0x4b8f1a;})});}_0x1e7c1f=_[_0x7bf6('0x3d')]({},_0x1e7c1f,_0x3565fa[_0x7bf6('0x3f')]);return _0x5c8c61[_0x7bf6('0x6e')](_0x1e7c1f);}})[_0x7bf6('0x21')](function(_0x449664){if(_0x449664){_0x50239e=_0x449664[_0x7bf6('0x35')];if(!_0x3565fa[_0x7bf6('0x2f')][_0x7bf6('0x36')](_0x7bf6('0x37'))){_0x1e7c1f[_0x7bf6('0x1e')]=qs[_0x7bf6('0x1e')](_0x3565fa[_0x7bf6('0x2f')][_0x7bf6('0x1e')]);_0x1e7c1f['offset']=qs[_0x7bf6('0x1b')](_0x3565fa[_0x7bf6('0x2f')][_0x7bf6('0x1b')]);}return _0x5c8c61[_0x7bf6('0x6e')](_0x1e7c1f);}})['then'](function(_0x3b6326){if(_0x3b6326){return _0x3b6326?{'count':_0x50239e,'rows':_0x3b6326}:null;}})[_0x7bf6('0x21')](respondWithResult(_0x1c5d6f,null))[_0x7bf6('0x46')](handleError(_0x1c5d6f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0b38060..df97a7f 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 _0xc8ba=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','../../config/logger','moment','request-promise','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc8ba,0x150));var _0xac8b=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xc8ba[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0xac8b('0x0'));var util=require('util');var logger=require(_0xac8b('0x1'))('api');var moment=require(_0xac8b('0x2'));var BPromise=require('bluebird');var rp=require(_0xac8b('0x3'));var fs=require('fs');var path=require(_0xac8b('0x4'));var rimraf=require(_0xac8b('0x5'));var config=require(_0xac8b('0x6'));var attributes=require(_0xac8b('0x7'));module[_0xac8b('0x8')]=function(_0x71958c,_0x3f51bd){return _0x71958c[_0xac8b('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0xac8b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b09=['moment','request-promise','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api'];(function(_0x75ad68,_0xc75b2a){var _0x469c7d=function(_0x2feecf){while(--_0x2feecf){_0x75ad68['push'](_0x75ad68['shift']());}};_0x469c7d(++_0xc75b2a);}(_0x0b09,0x1aa));var _0x90b0=function(_0x1f7eb3,_0x5ba961){_0x1f7eb3=_0x1f7eb3-0x0;var _0x5efa3d=_0x0b09[_0x1f7eb3];return _0x5efa3d;};'use strict';var _=require('lodash');var util=require(_0x90b0('0x0'));var logger=require(_0x90b0('0x1'))(_0x90b0('0x2'));var moment=require(_0x90b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x90b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90b0('0x5'));var config=require(_0x90b0('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x90b0('0x7')]=function(_0x4be1d9,_0x513a28){return _0x4be1d9[_0x90b0('0x8')](_0x90b0('0x9'),attributes,{'tableName':_0x90b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 3bad6e6..90a6775 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x5f2ef6,_0x3c50f4){var _0x539a6e=function(_0x407a4f){while(--_0x407a4f){_0x5f2ef6['push'](_0x5f2ef6['shift']());}};_0x539a6e(++_0x3c50f4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xcb91[_0xa8883];return _0x479426;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x401d79,_0x232775){var _0x30c8f4=function(_0x509699){while(--_0x509699){_0x401d79['push'](_0x401d79['shift']());}};_0x30c8f4(++_0x232775);}(_0xe706,0xa3));var _0x6e70=function(_0x96b9f1,_0x100578){_0x96b9f1=_0x96b9f1-0x0;var _0x1943fe=_0xe706[_0x96b9f1];return _0x1943fe;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 884bcab..9f45f6b 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 _0xd01a=['delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','put'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xd01a,0x1ae));var _0xad01=function(_0x2e04af,_0x321050){_0x2e04af=_0x2e04af-0x0;var _0x6b201=_0xd01a[_0x2e04af];return _0x6b201;};'use strict';var multer=require(_0xad01('0x0'));var util=require('util');var path=require(_0xad01('0x1'));var timeout=require(_0xad01('0x2'));var express=require('express');var router=express[_0xad01('0x3')]();var fs_extra=require(_0xad01('0x4'));var auth=require(_0xad01('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad01('0x6'));router[_0xad01('0x7')]('/',auth[_0xad01('0x8')](),controller['index']);router['get'](_0xad01('0x9'),auth[_0xad01('0x8')](),controller[_0xad01('0xa')]);router[_0xad01('0x7')](_0xad01('0xb'),auth[_0xad01('0x8')](),controller['show']);router[_0xad01('0x7')](_0xad01('0xc'),auth['isAuthenticated'](),controller[_0xad01('0xd')]);router[_0xad01('0x7')](_0xad01('0xe'),auth[_0xad01('0x8')](),controller[_0xad01('0xf')]);router[_0xad01('0x10')]('/',auth[_0xad01('0x8')](),controller[_0xad01('0x11')]);router['post'](_0xad01('0xc'),auth[_0xad01('0x8')](),controller[_0xad01('0x12')]);router[_0xad01('0x10')](_0xad01('0xe'),auth[_0xad01('0x8')](),controller['addTeams']);router[_0xad01('0x13')](_0xad01('0xb'),auth[_0xad01('0x8')](),controller['update']);router[_0xad01('0x14')]('/:id',auth[_0xad01('0x8')](),controller[_0xad01('0x15')]);router[_0xad01('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xad01('0x16')]);router[_0xad01('0x14')](_0xad01('0xe'),auth[_0xad01('0x8')](),controller[_0xad01('0x17')]);module[_0xad01('0x18')]=router; \ No newline at end of file +var _0xd737=['/:id','/:id/users','getAgents','/:id/teams','getTeams','create','addAgents','post','update','destroy','delete','removeAgents','exports','multer','path','express','Router','fs-extra','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x1df1e0,_0x133731){var _0x342f7c=function(_0x23fd71){while(--_0x23fd71){_0x1df1e0['push'](_0x1df1e0['shift']());}};_0x342f7c(++_0x133731);}(_0xd737,0x85));var _0x7d73=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0xd737[_0x2ee790];return _0x5a54a5;};'use strict';var multer=require(_0x7d73('0x0'));var util=require('util');var path=require(_0x7d73('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d73('0x2'));var router=express[_0x7d73('0x3')]();var fs_extra=require(_0x7d73('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d73('0x5'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x7d73('0x6')](),controller[_0x7d73('0x7')]);router[_0x7d73('0x8')](_0x7d73('0x9'),auth[_0x7d73('0x6')](),controller[_0x7d73('0xa')]);router[_0x7d73('0x8')](_0x7d73('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7d73('0x8')](_0x7d73('0xc'),auth['isAuthenticated'](),controller[_0x7d73('0xd')]);router['get'](_0x7d73('0xe'),auth[_0x7d73('0x6')](),controller[_0x7d73('0xf')]);router['post']('/',auth[_0x7d73('0x6')](),controller[_0x7d73('0x10')]);router['post'](_0x7d73('0xc'),auth[_0x7d73('0x6')](),controller[_0x7d73('0x11')]);router[_0x7d73('0x12')]('/:id/teams',auth[_0x7d73('0x6')](),controller['addTeams']);router['put'](_0x7d73('0xb'),auth[_0x7d73('0x6')](),controller[_0x7d73('0x13')]);router['delete'](_0x7d73('0xb'),auth[_0x7d73('0x6')](),controller[_0x7d73('0x14')]);router[_0x7d73('0x15')](_0x7d73('0xc'),auth[_0x7d73('0x6')](),controller[_0x7d73('0x16')]);router['delete'](_0x7d73('0xe'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x7d73('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6f25461..78df424 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 _0x8b5b=['STRING','name','VIRTUAL','getDataValue','sequelize','exports'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x8b5b,0xca));var _0xb8b5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8b5b[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xb8b5('0x0'));module[_0xb8b5('0x1')]={'name':{'type':Sequelize[_0xb8b5('0x2')],'allowNull':![],'unique':_0xb8b5('0x3')},'prefix':{'type':Sequelize[_0xb8b5('0x4')],'get':function(_0x1a79d8){return'system-'+this[_0xb8b5('0x5')](_0xb8b5('0x3'))+'-';}},'description':{'type':Sequelize[_0xb8b5('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa9af=['name','VIRTUAL','system-','getDataValue','sequelize','exports','STRING'];(function(_0x5e02eb,_0x6aa77b){var _0x102d0a=function(_0x370686){while(--_0x370686){_0x5e02eb['push'](_0x5e02eb['shift']());}};_0x102d0a(++_0x6aa77b);}(_0xa9af,0x146));var _0xfa9a=function(_0x5188b4,_0x182193){_0x5188b4=_0x5188b4-0x0;var _0x16eb05=_0xa9af[_0x5188b4];return _0x16eb05;};'use strict';var Sequelize=require(_0xfa9a('0x0'));module[_0xfa9a('0x1')]={'name':{'type':Sequelize[_0xfa9a('0x2')],'allowNull':![],'unique':_0xfa9a('0x3')},'prefix':{'type':Sequelize[_0xfa9a('0x4')],'get':function(_0x9b109e){return _0xfa9a('0x5')+this[_0xfa9a('0x6')](_0xfa9a('0x3'))+'-';}},'description':{'type':Sequelize[_0xfa9a('0x2')]},'callerIdAll':{'type':Sequelize[_0xfa9a('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 11c8a4d..1994d72 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 _0xfff0=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','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','redis','socket.io-emitter','./voicePrefix.socket','register','status','json','offset','undefined','limit','set','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','includeAll','options','find','catch','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','transaction','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch'];(function(_0x34b245,_0xfe65b4){var _0x3a8984=function(_0x12c6a8){while(--_0x12c6a8){_0x34b245['push'](_0x34b245['shift']());}};_0x3a8984(++_0xfe65b4);}(_0xfff0,0x139));var _0x0fff=function(_0x59b5d2,_0x23c268){_0x59b5d2=_0x59b5d2-0x0;var _0x2d19fb=_0xfff0[_0x59b5d2];return _0x2d19fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];config[_0x0fff('0x19')]=_['defaults'](config[_0x0fff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0x1a'))(new Redis(config[_0x0fff('0x19')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x55e5fa,_0x53bde9){_0x53bde9=_0x53bde9||0xcc;return function(_0x1daf30){if(_0x1daf30){return _0x55e5fa['sendStatus'](_0x53bde9);}return _0x55e5fa['status'](_0x53bde9)['end']();};}function respondWithResult(_0x1fb430,_0x41e2e7){_0x41e2e7=_0x41e2e7||0xc8;return function(_0x5eab2e){if(_0x5eab2e){return _0x1fb430[_0x0fff('0x1d')](_0x41e2e7)[_0x0fff('0x1e')](_0x5eab2e);}};}function respondWithFilteredResult(_0x540a67,_0x528071){return function(_0x48f36d){if(_0x48f36d){var _0x2337f=typeof _0x528071[_0x0fff('0x1f')]===_0x0fff('0x20')&&typeof _0x528071[_0x0fff('0x21')]===_0x0fff('0x20');var _0xe89b4a=_0x48f36d['count'];var _0x44a54a=_0x2337f?0x0:_0x528071[_0x0fff('0x1f')];var _0x48e6f9=_0x2337f?_0x48f36d['count']:_0x528071['offset']+_0x528071[_0x0fff('0x21')];var _0x330e29;if(_0x48e6f9>=_0xe89b4a){_0x48e6f9=_0xe89b4a;_0x330e29=0xc8;}else{_0x330e29=0xce;}_0x540a67[_0x0fff('0x1d')](_0x330e29);return _0x540a67[_0x0fff('0x22')]('Content-Range',_0x44a54a+'-'+_0x48e6f9+'/'+_0xe89b4a)[_0x0fff('0x1e')](_0x48f36d);}return null;};}function patchUpdates(_0x2f8665){return function(_0x29d703){try{jsonpatch[_0x0fff('0x23')](_0x29d703,_0x2f8665,!![]);}catch(_0x16e7f4){return BPromise[_0x0fff('0x24')](_0x16e7f4);}return _0x29d703['save']();};}function saveUpdates(_0x6a116c,_0x29f702){return function(_0x37e090){if(_0x37e090){return _0x37e090[_0x0fff('0x25')](_0x6a116c)[_0x0fff('0x26')](function(_0x23d9f8){return _0x23d9f8;});}return null;};}function removeEntity(_0x482e1e,_0x2c9725){return function(_0x87b3a6){if(_0x87b3a6){return _0x87b3a6[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){var _0x36d268=_0x87b3a6[_0x0fff('0x28')]({'plain':!![]});var _0x27bd76=_0x0fff('0x29');return db[_0x0fff('0x2a')][_0x0fff('0x27')]({'where':{'type':_0x27bd76,'resourceId':_0x36d268['id']}})[_0x0fff('0x26')](function(){return _0x87b3a6;});})[_0x0fff('0x26')](function(){_0x482e1e['status'](0xcc)[_0x0fff('0x2b')]();});}};}function handleEntityNotFound(_0x2d1800,_0x17ab6f){return function(_0x42441e){if(!_0x42441e){_0x2d1800[_0x0fff('0x2c')](0x194);}return _0x42441e;};}function handleError(_0x125844,_0x47dde0){_0x47dde0=_0x47dde0||0x1f4;return function(_0x31f9a4){logger[_0x0fff('0x2d')](_0x31f9a4[_0x0fff('0x2e')]);if(_0x31f9a4['name']){delete _0x31f9a4[_0x0fff('0x2f')];}_0x125844[_0x0fff('0x1d')](_0x47dde0)['send'](_0x31f9a4);};}exports[_0x0fff('0x30')]=function(_0x433de6,_0x15bb46){var _0x15ae24={},_0x25ab2a={},_0x263e9e={'count':0x0,'rows':[]};var _0x1da352=_[_0x0fff('0x31')](db[_0x0fff('0x32')][_0x0fff('0x33')],function(_0x58469b){return{'name':_0x58469b[_0x0fff('0x34')],'type':_0x58469b[_0x0fff('0x35')][_0x0fff('0x36')]};});_0x25ab2a[_0x0fff('0x37')]=_[_0x0fff('0x31')](_0x1da352,'name');_0x25ab2a['query']=_[_0x0fff('0x38')](_0x433de6[_0x0fff('0x39')]);_0x25ab2a[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x25ab2a['model'],_0x25ab2a[_0x0fff('0x39')]);_0x15ae24[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x25ab2a[_0x0fff('0x37')],qs['fields'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x15ae24[_0x0fff('0x3c')]=_0x15ae24[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x15ae24[_0x0fff('0x3c')]:_0x25ab2a[_0x0fff('0x37')];if(!_0x433de6[_0x0fff('0x39')][_0x0fff('0x3f')](_0x0fff('0x40'))){_0x15ae24[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x433de6['query'][_0x0fff('0x21')]);_0x15ae24[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x433de6[_0x0fff('0x39')][_0x0fff('0x1f')]);}_0x15ae24[_0x0fff('0x41')]=qs['sort'](_0x433de6[_0x0fff('0x39')][_0x0fff('0x42')]);_0x15ae24[_0x0fff('0x43')]=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x433de6[_0x0fff('0x39')],_0x25ab2a[_0x0fff('0x3a')]),_0x1da352);if(_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]){_0x15ae24['where']=_[_0x0fff('0x46')](_0x15ae24['where'],{'$or':_[_0x0fff('0x31')](_0x1da352,function(_0x30f329){if(_0x30f329[_0x0fff('0x35')]!=='VIRTUAL'){var _0x5d4c24={};_0x5d4c24[_0x30f329[_0x0fff('0x2f')]]={'$like':'%'+_0x433de6[_0x0fff('0x39')][_0x0fff('0x45')]+'%'};return _0x5d4c24;}})});}_0x15ae24=_['merge']({},_0x15ae24,_0x433de6['options']);var _0x4668b3={'where':_0x15ae24['where']};return db[_0x0fff('0x32')][_0x0fff('0x47')](_0x4668b3)[_0x0fff('0x26')](function(_0x309d75){_0x263e9e[_0x0fff('0x47')]=_0x309d75;if(_0x433de6[_0x0fff('0x39')]['includeAll']){_0x15ae24[_0x0fff('0x48')]=[{'all':!![]}];}return db[_0x0fff('0x32')][_0x0fff('0x49')](_0x15ae24);})[_0x0fff('0x26')](function(_0x7157e5){_0x263e9e[_0x0fff('0x4a')]=_0x7157e5;return _0x263e9e;})[_0x0fff('0x26')](respondWithFilteredResult(_0x15bb46,_0x15ae24))['catch'](handleError(_0x15bb46,null));};exports[_0x0fff('0x4b')]=function(_0x244a27,_0x101b3a){var _0x56a121={'raw':![],'where':{'id':_0x244a27[_0x0fff('0x4c')]['id']}},_0x2de540={};_0x2de540[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x32')][_0x0fff('0x33')]);_0x2de540[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x244a27[_0x0fff('0x39')]);_0x2de540[_0x0fff('0x3a')]=_[_0x0fff('0x3b')](_0x2de540['model'],_0x2de540[_0x0fff('0x39')]);_0x56a121[_0x0fff('0x3c')]=_['intersection'](_0x2de540[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x244a27[_0x0fff('0x39')]['fields']));_0x56a121['attributes']=_0x56a121[_0x0fff('0x3c')]['length']?_0x56a121['attributes']:_0x2de540[_0x0fff('0x37')];if(_0x244a27[_0x0fff('0x39')][_0x0fff('0x4d')]){_0x56a121[_0x0fff('0x48')]=[{'all':!![]}];}_0x56a121=_[_0x0fff('0x46')]({},_0x56a121,_0x244a27[_0x0fff('0x4e')]);return db['VoicePrefix'][_0x0fff('0x4f')](_0x56a121)[_0x0fff('0x26')](handleEntityNotFound(_0x101b3a,null))[_0x0fff('0x26')](respondWithResult(_0x101b3a,null))[_0x0fff('0x50')](handleError(_0x101b3a,null));};exports[_0x0fff('0x27')]=function(_0x2c725c,_0x5d1739){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x2c725c['params']['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5d1739,null))['then'](removeEntity(_0x5d1739,null))['catch'](handleError(_0x5d1739,null));};exports['describe']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x32')][_0x0fff('0x51')]()[_0x0fff('0x26')](respondWithResult(_0x30967c,null))['catch'](handleError(_0x30967c,null));};exports[_0x0fff('0x52')]=function(_0x2c765f,_0x2cbe43){var _0x3b6c98;return db[_0x0fff('0x53')]['transaction'](function(_0x3b401c){return db[_0x0fff('0x32')][_0x0fff('0x52')](_0x2c765f[_0x0fff('0x54')],{'transaction':_0x3b401c})[_0x0fff('0x26')](function(_0x2e8242){_0x3b6c98=_0x2e8242[_0x0fff('0x28')]({'plain':!![]});return db[_0x0fff('0x55')][_0x0fff('0x4f')]({'where':{'id':_0x3b6c98[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x38168e){return createVoicePrefixExtensions(_0x3b6c98,_0x38168e,_0x3b401c);});});})[_0x0fff('0x26')](function(){var _0x2608be=_0x2c765f[_0x0fff('0x57')][_0x0fff('0x28')]({'plain':!![]});if(!_0x2608be)throw new Error(_0x0fff('0x58'));if(_0x2608be[_0x0fff('0x59')]===_0x0fff('0x57')){var _0x398513=_0x3b6c98;return db[_0x0fff('0x5a')]['find']({'where':{'name':_0x0fff('0x29'),'userProfileId':_0x2608be[_0x0fff('0x5b')]},'raw':!![]})[_0x0fff('0x26')](function(_0x2744b4){if(_0x2744b4&&_0x2744b4['autoAssociation']===0x0){return db[_0x0fff('0x2a')]['create']({'name':_0x398513[_0x0fff('0x2f')],'resourceId':_0x398513['id'],'type':_0x2744b4[_0x0fff('0x2f')],'sectionId':_0x2744b4['id']},{})[_0x0fff('0x26')](function(){return _0x3b6c98;});}else{return _0x3b6c98;}})[_0x0fff('0x50')](function(_0x4bf865){logger[_0x0fff('0x2d')](_0x0fff('0x5c'),_0x4bf865);throw _0x4bf865;});}return _0x3b6c98;})[_0x0fff('0x26')](respondWithResult(_0x2cbe43,null))[_0x0fff('0x50')](handleError(_0x2cbe43,null));};function Extension(_0x4cf619,_0x5ba7e7,_0x449da4,_0x40b8f0){this[_0x0fff('0x5d')]=_0x0fff('0x5e');this[_0x0fff('0x5f')]=_0x4cf619;this[_0x0fff('0x60')]=_0x449da4;this['type']='system';this[_0x0fff('0x61')]=_0x0fff('0x62');this[_0x0fff('0x63')]=_0x5ba7e7;this[_0x0fff('0x64')]=_0x40b8f0;}function createVoicePrefixExtensions(_0x28403f,_0x6a37c9,_0x33eb07){return new BPromise(function(_0x40e5ec,_0x5f2fcc){var _0x12fe95=new Extension(formatPrefixName(_0x28403f['prefix']),0x1,_0x0fff('0x65'),_0x0fff('0x66'));_0x12fe95[_0x0fff('0x67')]=_0x28403f['id'];return db['VoiceExtension']['create'](_0x12fe95,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x504212){var _0x140a35=_0x504212[_0x0fff('0x28')]({'plain':!![]});var _0x452160=_[_0x0fff('0x31')](addVoicePrefixExtensions(_0x28403f,_0x6a37c9),function(_0x4e3a31){_0x4e3a31[_0x0fff('0x56')]=_0x140a35['id'];_0x4e3a31[_0x0fff('0x67')]=_0x28403f['id'];return _0x4e3a31;});return db['VoiceExtension'][_0x0fff('0x68')](_0x452160,{'transaction':_0x33eb07})[_0x0fff('0x26')](function(_0x1111c8){if(!_0x1111c8){return _0x5f2fcc('Extensions\x20creation\x20failed');}else{return _0x40e5ec(_0x1111c8);}})[_0x0fff('0x50')](function(_0x1dc3d6){return _0x5f2fcc(_0x1dc3d6);});});;});};function addVoicePrefixExtensions(_0x1414af,_0x383d78){var _0x3bb183=[];var _0xf4fb1e=formatPrefixName(_0x1414af[_0x0fff('0x69')]);_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x2,_0x0fff('0x6b'),_0x0fff('0x6c')+_0x1414af[_0x0fff('0x2f')]));if(_0x1414af[_0x0fff('0x6d')]){_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,'Set',_0x0fff('0x6e')+_0x1414af['callerIdAll']));}else{_0x3bb183['push'](new Extension(_0xf4fb1e,0x3,_0x0fff('0x65'),_0x0fff('0x6f')));}_0x3bb183[_0x0fff('0x6a')](new Extension(_0xf4fb1e,0x4,'goto',_0x383d78['context']+','+_0x0fff('0x70')+(0x8+_0x1414af[_0x0fff('0x2f')][_0x0fff('0x3e')])+'}'+','+0x1));return _0x3bb183;}function formatPrefixName(_0x2586c6){var _0x5af278='_';for(var _0x2f865a=0x0;_0x2f865a<_0x2586c6[_0x0fff('0x3e')];_0x2f865a++){if(_0x2586c6[_0x0fff('0x71')](_0x2f865a)=='-'){_0x5af278+=_0x2586c6[_0x0fff('0x71')](_0x2f865a);}else{_0x5af278+='['+_0x2586c6['charAt'](_0x2f865a)+']';}}_0x5af278+='.';return _0x5af278;}exports[_0x0fff('0x25')]=function(_0x1858fb,_0x4c08c3,_0x51fbf5){var _0x33ed23=_0x1858fb[_0x0fff('0x54')];_0x33ed23[_0x0fff('0x69')]=_0x0fff('0x72')+_0x33ed23[_0x0fff('0x2f')]+'-';return db['sequelize'][_0x0fff('0x73')](function(_0x7b040){return db[_0x0fff('0x32')][_0x0fff('0x25')](_0x33ed23,{'where':{'id':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x33ed23['id']},'transaction':_0x7b040})[_0x0fff('0x26')](function(){return db['VoiceExtension'][_0x0fff('0x4f')]({'where':{'id':_0x33ed23[_0x0fff('0x56')]},'raw':!![]})[_0x0fff('0x26')](function(_0x712db4){return createVoicePrefixExtensions(_0x33ed23,_0x712db4,_0x7b040);});});});})[_0x0fff('0x26')](function(){return db['VoicePrefix'][_0x0fff('0x74')](_0x33ed23['id']);})[_0x0fff('0x26')](respondWithResult(_0x4c08c3,null))[_0x0fff('0x50')](handleError(_0x4c08c3,null));};exports[_0x0fff('0x75')]=function(_0x31ff4e,_0x15ab8e,_0x38e2e9){return db[_0x0fff('0x32')][_0x0fff('0x4f')]({'where':{'id':_0x31ff4e[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x15ab8e,null))['then'](function(_0x134012){if(_0x134012){return _0x134012[_0x0fff('0x75')](_0x31ff4e['body'][_0x0fff('0x76')],_['omit'](_0x31ff4e[_0x0fff('0x54')],[_0x0fff('0x76'),'id'])||{})[_0x0fff('0x77')](function(_0x8799c2){for(var _0x13d90e=0x0;_0x13d90e<_0x31ff4e['body'][_0x0fff('0x76')][_0x0fff('0x3e')];_0x13d90e+=0x1){socket['emit'](_0x0fff('0x78'),{'UserId':Number(_0x31ff4e[_0x0fff('0x54')][_0x0fff('0x76')][_0x13d90e]),'VoicePrefixId':Number(_0x31ff4e['params']['id'])});}return _0x8799c2;});}})[_0x0fff('0x26')](respondWithResult(_0x15ab8e,null))[_0x0fff('0x50')](handleError(_0x15ab8e,null));};exports['removeAgents']=function(_0x567544,_0x404b97,_0x49711a){return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x567544[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x404b97,null))['then'](function(_0x4f7282){if(_0x4f7282){return _0x4f7282[_0x0fff('0x79')](_0x567544['query'][_0x0fff('0x76')])[_0x0fff('0x26')](function(){if(_[_0x0fff('0x7a')](_0x567544[_0x0fff('0x39')][_0x0fff('0x76')])){for(var _0x1e940c=0x0;_0x1e940c<_0x567544[_0x0fff('0x39')]['ids'][_0x0fff('0x3e')];_0x1e940c+=0x1){socket[_0x0fff('0x7b')](_0x0fff('0x7c'),{'UserId':Number(_0x567544[_0x0fff('0x39')][_0x0fff('0x76')][_0x1e940c]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}}else{socket['emit'](_0x0fff('0x7c'),{'UserId':Number(_0x567544['query'][_0x0fff('0x76')]),'VoicePrefixId':Number(_0x567544[_0x0fff('0x4c')]['id'])});}});}})[_0x0fff('0x26')](respondWithStatusCode(_0x404b97,null))[_0x0fff('0x50')](handleError(_0x404b97,null));};exports['getAgents']=function(_0x4fc7c7,_0x34dd99,_0x5baf7f){var _0x3d820e={};var _0x125b12={};var _0x5093fc;var _0x5b04f2;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x4fc7c7[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x34dd99,null))['then'](function(_0x407f0a){if(_0x407f0a){_0x5093fc=_0x407f0a;_0x125b12['model']=_[_0x0fff('0x38')](db[_0x0fff('0x7e')][_0x0fff('0x33')]);_0x125b12['query']=_['keys'](_0x4fc7c7['query']);_0x125b12[_0x0fff('0x3a')]=_['intersection'](_0x125b12[_0x0fff('0x37')],_0x125b12[_0x0fff('0x39')]);_0x3d820e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x125b12[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x3d')]));_0x3d820e[_0x0fff('0x3c')]=_0x3d820e[_0x0fff('0x3c')][_0x0fff('0x3e')]?_0x3d820e['attributes']:_0x125b12[_0x0fff('0x37')];_0x3d820e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x42')]);_0x3d820e['where']=qs[_0x0fff('0x3a')](_[_0x0fff('0x44')](_0x4fc7c7['query'],_0x125b12[_0x0fff('0x3a')]));if(_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x45')]){_0x3d820e[_0x0fff('0x43')]=_[_0x0fff('0x46')](_0x3d820e[_0x0fff('0x43')],{'$or':_[_0x0fff('0x31')](_0x3d820e[_0x0fff('0x3c')],function(_0x40c4f3){var _0x1c059b={};_0x1c059b[_0x40c4f3]={'$like':'%'+_0x4fc7c7['query'][_0x0fff('0x45')]+'%'};return _0x1c059b;})});}_0x3d820e=_[_0x0fff('0x46')]({},_0x3d820e,_0x4fc7c7[_0x0fff('0x4e')]);return _0x5093fc[_0x0fff('0x7f')](_0x3d820e);}})[_0x0fff('0x26')](function(_0x2fdf96){if(_0x2fdf96){_0x5b04f2=_0x2fdf96[_0x0fff('0x3e')];if(!_0x4fc7c7['query'][_0x0fff('0x3f')]('nolimit')){_0x3d820e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x4fc7c7[_0x0fff('0x39')][_0x0fff('0x21')]);_0x3d820e[_0x0fff('0x1f')]=qs['offset'](_0x4fc7c7[_0x0fff('0x39')]['offset']);}return _0x5093fc['getAgents'](_0x3d820e);}})[_0x0fff('0x26')](function(_0x173b44){if(_0x173b44){return _0x173b44?{'count':_0x5b04f2,'rows':_0x173b44}:null;}})[_0x0fff('0x26')](respondWithResult(_0x34dd99,null))[_0x0fff('0x50')](handleError(_0x34dd99,null));};exports[_0x0fff('0x80')]=function(_0x3995b9,_0x5bc4e1,_0x50f95c){var _0x5b637e={};var _0x1bd02a={};var _0x41b755;var _0x4012aa;return db[_0x0fff('0x32')][_0x0fff('0x7d')]({'where':{'id':_0x3995b9[_0x0fff('0x4c')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x5bc4e1,null))[_0x0fff('0x26')](function(_0xed7e93){if(_0xed7e93){_0x41b755=_0xed7e93;_0x1bd02a[_0x0fff('0x37')]=_[_0x0fff('0x38')](db[_0x0fff('0x81')][_0x0fff('0x33')]);_0x1bd02a[_0x0fff('0x39')]=_[_0x0fff('0x38')](_0x3995b9[_0x0fff('0x39')]);_0x1bd02a[_0x0fff('0x3a')]=_['intersection'](_0x1bd02a[_0x0fff('0x37')],_0x1bd02a[_0x0fff('0x39')]);_0x5b637e[_0x0fff('0x3c')]=_[_0x0fff('0x3b')](_0x1bd02a[_0x0fff('0x37')],qs[_0x0fff('0x3d')](_0x3995b9[_0x0fff('0x39')]['fields']));_0x5b637e[_0x0fff('0x3c')]=_0x5b637e[_0x0fff('0x3c')]['length']?_0x5b637e[_0x0fff('0x3c')]:_0x1bd02a['model'];_0x5b637e[_0x0fff('0x41')]=qs[_0x0fff('0x42')](_0x3995b9['query']['sort']);_0x5b637e['where']=qs[_0x0fff('0x3a')](_['pick'](_0x3995b9['query'],_0x1bd02a['filters']));if(_0x3995b9['query'][_0x0fff('0x45')]){_0x5b637e['where']=_[_0x0fff('0x46')](_0x5b637e['where'],{'$or':_[_0x0fff('0x31')](_0x5b637e['attributes'],function(_0x465dde){var _0x9ca531={};_0x9ca531[_0x465dde]={'$like':'%'+_0x3995b9['query']['filter']+'%'};return _0x9ca531;})});}_0x5b637e=_[_0x0fff('0x46')]({},_0x5b637e,_0x3995b9[_0x0fff('0x4e')]);return _0x41b755[_0x0fff('0x80')](_0x5b637e);}})[_0x0fff('0x26')](function(_0x675250){if(_0x675250){_0x4012aa=_0x675250[_0x0fff('0x3e')];if(!_0x3995b9[_0x0fff('0x39')]['hasOwnProperty'](_0x0fff('0x40'))){_0x5b637e[_0x0fff('0x21')]=qs[_0x0fff('0x21')](_0x3995b9[_0x0fff('0x39')]['limit']);_0x5b637e[_0x0fff('0x1f')]=qs[_0x0fff('0x1f')](_0x3995b9[_0x0fff('0x39')]['offset']);}return _0x41b755['getTeams'](_0x5b637e);}})[_0x0fff('0x26')](function(_0x37b5b4){if(_0x37b5b4){return _0x37b5b4?{'count':_0x4012aa,'rows':_0x37b5b4}:null;}})['then'](respondWithResult(_0x5bc4e1,null))[_0x0fff('0x50')](handleError(_0x5bc4e1,null));};exports[_0x0fff('0x82')]=function(_0x4ab665,_0x2ab827,_0x2a2af9){var _0x2ca40b=_0x4ab665['body']['ids'];var _0x2eeee9;return db[_0x0fff('0x81')]['findAll']({'where':{'id':_0x2ca40b},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7e')],'as':_0x0fff('0x83'),'attributes':['id',_0x0fff('0x2f'),_0x0fff('0x84'),_0x0fff('0x85'),_0x0fff('0x86')],'raw':!![]}]})[_0x0fff('0x26')](function(_0x1b500a){if(_0x1b500a){_0x2eeee9=_0x1b500a;var _0x327b5=_[_0x0fff('0x87')](_0x1b500a,function(_0x10aa61){var _0xc99224=_0x10aa61['get']({'plain':!![]});return _0xc99224[_0x0fff('0x83')];});return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x4ab665['params']['id']}})[_0x0fff('0x26')](function(_0x5336){return db[_0x0fff('0x53')][_0x0fff('0x73')](function(_0x42fbff){return _0x5336[_0x0fff('0x82')](_0x2ca40b,{'transaction':_0x42fbff})['then'](function(){return BPromise[_0x0fff('0x88')](_0x2eeee9,function(_0x39565f){return db['TeamVoicePrefix'][_0x0fff('0x89')]({'TeamId':_0x39565f['id'],'VoicePrefixId':_0x4ab665['params']['id']},{'transaction':_0x42fbff});});})['then'](function(){return BPromise[_0x0fff('0x88')](_0x327b5,function(_0x2e38c3){return db[_0x0fff('0x8a')][_0x0fff('0x8b')]({'where':{'UserId':_0x2e38c3['id'],'VoicePrefixId':_0x4ab665[_0x0fff('0x4c')]['id']},'transaction':_0x42fbff});});})[_0x0fff('0x26')](function(){_0x327b5['forEach'](function(_0xe02ca6){socket[_0x0fff('0x7b')](_0x0fff('0x78'),{'UserId':_0xe02ca6['id'],'VoicePrefixId':_0x5336['id']});});});});});}})[_0x0fff('0x26')](respondWithStatusCode(_0x2ab827,null))[_0x0fff('0x50')](handleError(_0x2ab827,null));};exports['removeTeams']=function(_0x25e9f2,_0xf73eb6,_0x87df03){return db[_0x0fff('0x81')][_0x0fff('0x49')]({'where':{'id':_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x26')](handleEntityNotFound(_0xf73eb6,null))['then'](function(_0x2d206c){var _0x5ed120=_['map'](_0x2d206c,'id');var _0x592341=[];var _0x2e1625=[];var _0x128fe1=squel[_0x0fff('0x8c')]();_0x128fe1[_0x0fff('0x8d')](_0x0fff('0x8e'))['from'](_0x0fff('0x8f'),'tq')[_0x0fff('0x90')](_0x0fff('0x91'),'ut',_0x0fff('0x92'))[_0x0fff('0x43')](_0x0fff('0x93'),_0x25e9f2[_0x0fff('0x4c')]['id']);for(var _0x115445=0x0;_0x115445<_0x2d206c['length'];_0x115445+=0x1){let _0x596074=_0x2d206c[_0x115445];for(var _0x1f1946=0x0;_0x1f1946<_0x596074[_0x0fff('0x83')][_0x0fff('0x3e')];_0x1f1946+=0x1){let _0x47ff09=_0x596074[_0x0fff('0x83')][_0x1f1946];var _0x2ae986=_0x128fe1[_0x0fff('0x94')]();_0x2ae986['where'](_0x0fff('0x95'),_0x47ff09['id']);_0x2e1625[_0x0fff('0x6a')](db[_0x0fff('0x53')][_0x0fff('0x39')](_0x2ae986[_0x0fff('0x96')](),{'type':db[_0x0fff('0x53')][_0x0fff('0x97')]['SELECT']})['then'](function(_0x4a70ee){if(_0x4a70ee[_0x0fff('0x3e')]===0x1){return _0x47ff09['id'];}else{var _0x425412=_[_0x0fff('0x98')](_[_0x0fff('0x31')](_0x4a70ee,_0x0fff('0x99')),function(_0x41afce){return _['includes'](_0x5ed120,_0x41afce);});if(_0x425412){return _0x47ff09['id'];}}}));}}return BPromise[_0x0fff('0x9a')](_0x2e1625)[_0x0fff('0x26')](function(_0x7928f7){_0x592341=_(_0x592341)['union'](_0x7928f7)['compact']()[_0x0fff('0x9b')]();return db['VoicePrefix'][_0x0fff('0x4f')]({'where':{'id':_0x25e9f2[_0x0fff('0x4c')]['id']}})['then'](function(_0x1bf39f){return db[_0x0fff('0x53')]['transaction'](function(_0xb6faf){return _0x1bf39f[_0x0fff('0x9c')](_0x25e9f2[_0x0fff('0x39')][_0x0fff('0x76')],{'transaction':_0xb6faf})[_0x0fff('0x26')](function(){if(!_[_0x0fff('0x9d')](_0x592341)){return _0x1bf39f['removeAgents'](_0x592341,{'transaction':_0xb6faf});}})[_0x0fff('0x26')](function(){_0x592341['forEach'](function(_0xf72b2b){socket['emit'](_0x0fff('0x7c'),{'UserId':_0xf72b2b,'VoicePrefixId':_0x1bf39f['id']});});});});});});})['then'](respondWithStatusCode(_0xf73eb6,null))[_0x0fff('0x50')](handleError(_0xf73eb6,null));}; \ No newline at end of file +var _0x1893=['compact','value','isEmpty','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','error','name','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','VoicePrefix','includeAll','findAll','rows','show','length','options','find','catch','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','context','${EXTEN:','charAt','body','system-','findById','addAgents','params','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','rawAttributes','pick','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1893,0xa2));var _0x3189=function(_0xd0f42d,_0x5beaab){_0xd0f42d=_0xd0f42d-0x0;var _0x26534c=_0x1893[_0xd0f42d];return _0x26534c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];config['redis']=_[_0x3189('0x19')](config[_0x3189('0x1a')],{'host':_0x3189('0x1b'),'port':0x18eb});var socket=require(_0x3189('0x1c'))(new Redis(config[_0x3189('0x1a')]));require(_0x3189('0x1d'))[_0x3189('0x1e')](socket);function respondWithStatusCode(_0x25a917,_0x5521bb){_0x5521bb=_0x5521bb||0xcc;return function(_0x220b18){if(_0x220b18){return _0x25a917[_0x3189('0x1f')](_0x5521bb);}return _0x25a917[_0x3189('0x20')](_0x5521bb)[_0x3189('0x21')]();};}function respondWithResult(_0x486dd2,_0x40195d){_0x40195d=_0x40195d||0xc8;return function(_0x5f2e82){if(_0x5f2e82){return _0x486dd2['status'](_0x40195d)[_0x3189('0x22')](_0x5f2e82);}};}function respondWithFilteredResult(_0x49b1bc,_0x42c3a3){return function(_0xf8aed7){if(_0xf8aed7){var _0x22c7ba=typeof _0x42c3a3[_0x3189('0x23')]==='undefined'&&typeof _0x42c3a3[_0x3189('0x24')]===_0x3189('0x25');var _0x16edd7=_0xf8aed7['count'];var _0x561265=_0x22c7ba?0x0:_0x42c3a3[_0x3189('0x23')];var _0x306ed3=_0x22c7ba?_0xf8aed7[_0x3189('0x26')]:_0x42c3a3[_0x3189('0x23')]+_0x42c3a3['limit'];var _0x1771a8;if(_0x306ed3>=_0x16edd7){_0x306ed3=_0x16edd7;_0x1771a8=0xc8;}else{_0x1771a8=0xce;}_0x49b1bc[_0x3189('0x20')](_0x1771a8);return _0x49b1bc[_0x3189('0x27')]('Content-Range',_0x561265+'-'+_0x306ed3+'/'+_0x16edd7)[_0x3189('0x22')](_0xf8aed7);}return null;};}function patchUpdates(_0x47abb4){return function(_0x4bfc03){try{jsonpatch[_0x3189('0x28')](_0x4bfc03,_0x47abb4,!![]);}catch(_0x200f16){return BPromise[_0x3189('0x29')](_0x200f16);}return _0x4bfc03[_0x3189('0x2a')]();};}function saveUpdates(_0x393fcb,_0x5a08dc){return function(_0x4b03ad){if(_0x4b03ad){return _0x4b03ad[_0x3189('0x2b')](_0x393fcb)[_0x3189('0x2c')](function(_0x1dc1c8){return _0x1dc1c8;});}return null;};}function removeEntity(_0x3cc1e5,_0x103de4){return function(_0x3f4789){if(_0x3f4789){return _0x3f4789[_0x3189('0x2d')]()[_0x3189('0x2c')](function(){var _0x17b540=_0x3f4789[_0x3189('0x2e')]({'plain':!![]});var _0x5ce5f5='VoicePrefixes';return db['UserProfileResource'][_0x3189('0x2d')]({'where':{'type':_0x5ce5f5,'resourceId':_0x17b540['id']}})[_0x3189('0x2c')](function(){return _0x3f4789;});})[_0x3189('0x2c')](function(){_0x3cc1e5[_0x3189('0x20')](0xcc)[_0x3189('0x21')]();});}};}function handleEntityNotFound(_0x2f7504,_0x4d453a){return function(_0x1ab94b){if(!_0x1ab94b){_0x2f7504[_0x3189('0x1f')](0x194);}return _0x1ab94b;};}function handleError(_0x4bd677,_0x173f18){_0x173f18=_0x173f18||0x1f4;return function(_0x3744ff){logger[_0x3189('0x2f')](_0x3744ff['stack']);if(_0x3744ff[_0x3189('0x30')]){delete _0x3744ff[_0x3189('0x30')];}_0x4bd677[_0x3189('0x20')](_0x173f18)['send'](_0x3744ff);};}exports[_0x3189('0x31')]=function(_0x47f7a7,_0x51ce54){var _0x32ca90={},_0x34007b={},_0x374f23={'count':0x0,'rows':[]};var _0x3bdc84=_[_0x3189('0x32')](db['VoicePrefix']['rawAttributes'],function(_0x7d7745){return{'name':_0x7d7745['fieldName'],'type':_0x7d7745[_0x3189('0x33')][_0x3189('0x34')]};});_0x34007b[_0x3189('0x35')]=_[_0x3189('0x32')](_0x3bdc84,_0x3189('0x30'));_0x34007b[_0x3189('0x36')]=_[_0x3189('0x37')](_0x47f7a7[_0x3189('0x36')]);_0x34007b[_0x3189('0x38')]=_['intersection'](_0x34007b[_0x3189('0x35')],_0x34007b[_0x3189('0x36')]);_0x32ca90[_0x3189('0x39')]=_[_0x3189('0x3a')](_0x34007b[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x47f7a7[_0x3189('0x36')]['fields']));_0x32ca90['attributes']=_0x32ca90[_0x3189('0x39')]['length']?_0x32ca90[_0x3189('0x39')]:_0x34007b[_0x3189('0x35')];if(!_0x47f7a7['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x32ca90[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x47f7a7['query'][_0x3189('0x24')]);_0x32ca90['offset']=qs['offset'](_0x47f7a7[_0x3189('0x36')][_0x3189('0x23')]);}_0x32ca90[_0x3189('0x3e')]=qs[_0x3189('0x3f')](_0x47f7a7[_0x3189('0x36')][_0x3189('0x3f')]);_0x32ca90[_0x3189('0x40')]=qs[_0x3189('0x38')](_['pick'](_0x47f7a7['query'],_0x34007b[_0x3189('0x38')]),_0x3bdc84);if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]){_0x32ca90[_0x3189('0x40')]=_[_0x3189('0x42')](_0x32ca90[_0x3189('0x40')],{'$or':_['map'](_0x3bdc84,function(_0x280146){if(_0x280146[_0x3189('0x33')]!==_0x3189('0x43')){var _0xaf76f1={};_0xaf76f1[_0x280146['name']]={'$like':'%'+_0x47f7a7[_0x3189('0x36')][_0x3189('0x41')]+'%'};return _0xaf76f1;}})});}_0x32ca90=_['merge']({},_0x32ca90,_0x47f7a7['options']);var _0x1ef1b2={'where':_0x32ca90['where']};return db[_0x3189('0x44')][_0x3189('0x26')](_0x1ef1b2)[_0x3189('0x2c')](function(_0x9593f3){_0x374f23['count']=_0x9593f3;if(_0x47f7a7[_0x3189('0x36')][_0x3189('0x45')]){_0x32ca90['include']=[{'all':!![]}];}return db[_0x3189('0x44')][_0x3189('0x46')](_0x32ca90);})[_0x3189('0x2c')](function(_0x3a6a36){_0x374f23[_0x3189('0x47')]=_0x3a6a36;return _0x374f23;})['then'](respondWithFilteredResult(_0x51ce54,_0x32ca90))['catch'](handleError(_0x51ce54,null));};exports[_0x3189('0x48')]=function(_0x5ca360,_0x44e45f){var _0xf095fe={'raw':![],'where':{'id':_0x5ca360['params']['id']}},_0x1a3e51={};_0x1a3e51[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x44')]['rawAttributes']);_0x1a3e51[_0x3189('0x36')]=_[_0x3189('0x37')](_0x5ca360[_0x3189('0x36')]);_0x1a3e51[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x1a3e51[_0x3189('0x35')],_0x1a3e51['query']);_0xf095fe['attributes']=_[_0x3189('0x3a')](_0x1a3e51['model'],qs['fields'](_0x5ca360[_0x3189('0x36')]['fields']));_0xf095fe[_0x3189('0x39')]=_0xf095fe[_0x3189('0x39')][_0x3189('0x49')]?_0xf095fe['attributes']:_0x1a3e51[_0x3189('0x35')];if(_0x5ca360['query'][_0x3189('0x45')]){_0xf095fe['include']=[{'all':!![]}];}_0xf095fe=_['merge']({},_0xf095fe,_0x5ca360[_0x3189('0x4a')]);return db['VoicePrefix'][_0x3189('0x4b')](_0xf095fe)['then'](handleEntityNotFound(_0x44e45f,null))['then'](respondWithResult(_0x44e45f,null))[_0x3189('0x4c')](handleError(_0x44e45f,null));};exports[_0x3189('0x2d')]=function(_0x4373f6,_0x35cb23){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4373f6['params']['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x35cb23,null))['then'](removeEntity(_0x35cb23,null))['catch'](handleError(_0x35cb23,null));};exports[_0x3189('0x4d')]=function(_0x4f641a,_0xd90868){return db[_0x3189('0x44')][_0x3189('0x4d')]()[_0x3189('0x2c')](respondWithResult(_0xd90868,null))['catch'](handleError(_0xd90868,null));};exports[_0x3189('0x4e')]=function(_0x4ad892,_0x35fdb2){var _0x242ec4;return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x4f41e5){return db[_0x3189('0x44')][_0x3189('0x4e')](_0x4ad892['body'],{'transaction':_0x4f41e5})[_0x3189('0x2c')](function(_0xbf07c5){_0x242ec4=_0xbf07c5[_0x3189('0x2e')]({'plain':!![]});return db[_0x3189('0x51')]['find']({'where':{'id':_0x242ec4[_0x3189('0x52')]},'raw':!![]})['then'](function(_0x1ebb0d){return createVoicePrefixExtensions(_0x242ec4,_0x1ebb0d,_0x4f41e5);});});})['then'](function(){var _0x460c6e=_0x4ad892[_0x3189('0x53')]['get']({'plain':!![]});if(!_0x460c6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460c6e['role']===_0x3189('0x53')){var _0x5b14ac=_0x242ec4;return db[_0x3189('0x54')][_0x3189('0x4b')]({'where':{'name':_0x3189('0x55'),'userProfileId':_0x460c6e[_0x3189('0x56')]},'raw':!![]})[_0x3189('0x2c')](function(_0x40623f){if(_0x40623f&&_0x40623f[_0x3189('0x57')]===0x0){return db[_0x3189('0x58')][_0x3189('0x4e')]({'name':_0x5b14ac['name'],'resourceId':_0x5b14ac['id'],'type':_0x40623f[_0x3189('0x30')],'sectionId':_0x40623f['id']},{})[_0x3189('0x2c')](function(){return _0x242ec4;});}else{return _0x242ec4;}})[_0x3189('0x4c')](function(_0x429de3){logger[_0x3189('0x2f')](_0x3189('0x59'),_0x429de3);throw _0x429de3;});}return _0x242ec4;})[_0x3189('0x2c')](respondWithResult(_0x35fdb2,null))[_0x3189('0x4c')](handleError(_0x35fdb2,null));};function Extension(_0xa1316a,_0x68de3c,_0x187877,_0x3a2fe6){this['context']='from-sip';this[_0x3189('0x5a')]=_0xa1316a;this[_0x3189('0x5b')]=_0x187877;this[_0x3189('0x33')]=_0x3189('0x5c');this[_0x3189('0x5d')]=_0x3189('0x5e');this[_0x3189('0x5f')]=_0x68de3c;this[_0x3189('0x60')]=_0x3a2fe6;}function createVoicePrefixExtensions(_0x120a8a,_0x1472b6,_0xd45395){return new BPromise(function(_0x4f0ccb,_0x5b31dd){var _0x57aae5=new Extension(formatPrefixName(_0x120a8a[_0x3189('0x61')]),0x1,_0x3189('0x62'),'Voice\x20Prefix');_0x57aae5[_0x3189('0x63')]=_0x120a8a['id'];return db[_0x3189('0x51')][_0x3189('0x4e')](_0x57aae5,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x26fdf2){var _0x4875a2=_0x26fdf2[_0x3189('0x2e')]({'plain':!![]});var _0x35a4d1=_[_0x3189('0x32')](addVoicePrefixExtensions(_0x120a8a,_0x1472b6),function(_0x228dfc){_0x228dfc['VoiceExtensionId']=_0x4875a2['id'];_0x228dfc[_0x3189('0x63')]=_0x120a8a['id'];return _0x228dfc;});return db[_0x3189('0x51')][_0x3189('0x64')](_0x35a4d1,{'transaction':_0xd45395})[_0x3189('0x2c')](function(_0x4a7172){if(!_0x4a7172){return _0x5b31dd(_0x3189('0x65'));}else{return _0x4f0ccb(_0x4a7172);}})['catch'](function(_0x1d7a44){return _0x5b31dd(_0x1d7a44);});});;});};function addVoicePrefixExtensions(_0x448635,_0x10fe1b){var _0xb02b4f=[];var _0x55bcf0=formatPrefixName(_0x448635[_0x3189('0x61')]);_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x2,_0x3189('0x67'),_0x3189('0x68')+_0x448635[_0x3189('0x30')]));if(_0x448635[_0x3189('0x69')]){_0xb02b4f['push'](new Extension(_0x55bcf0,0x3,_0x3189('0x67'),_0x3189('0x6a')+_0x448635[_0x3189('0x69')]));}else{_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x3,_0x3189('0x62'),'No\x20callerid\x20available'));}_0xb02b4f[_0x3189('0x66')](new Extension(_0x55bcf0,0x4,'goto',_0x10fe1b[_0x3189('0x6b')]+','+_0x3189('0x6c')+(0x8+_0x448635[_0x3189('0x30')][_0x3189('0x49')])+'}'+','+0x1));return _0xb02b4f;}function formatPrefixName(_0x46faac){var _0x458db9='_';for(var _0x403d31=0x0;_0x403d31<_0x46faac[_0x3189('0x49')];_0x403d31++){if(_0x46faac['charAt'](_0x403d31)=='-'){_0x458db9+=_0x46faac[_0x3189('0x6d')](_0x403d31);}else{_0x458db9+='['+_0x46faac['charAt'](_0x403d31)+']';}}_0x458db9+='.';return _0x458db9;}exports[_0x3189('0x2b')]=function(_0x2eedf4,_0xf740b0,_0x1e08f4){var _0x3d11ac=_0x2eedf4[_0x3189('0x6e')];_0x3d11ac['prefix']=_0x3189('0x6f')+_0x3d11ac[_0x3189('0x30')]+'-';return db['sequelize'][_0x3189('0x50')](function(_0x50438f){return db[_0x3189('0x44')][_0x3189('0x2b')](_0x3d11ac,{'where':{'id':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x3d11ac['id']},'transaction':_0x50438f})[_0x3189('0x2c')](function(){return db[_0x3189('0x51')][_0x3189('0x4b')]({'where':{'id':_0x3d11ac['VoiceExtensionId']},'raw':!![]})[_0x3189('0x2c')](function(_0x285b0d){return createVoicePrefixExtensions(_0x3d11ac,_0x285b0d,_0x50438f);});});});})['then'](function(){return db[_0x3189('0x44')][_0x3189('0x70')](_0x3d11ac['id']);})[_0x3189('0x2c')](respondWithResult(_0xf740b0,null))['catch'](handleError(_0xf740b0,null));};exports[_0x3189('0x71')]=function(_0x28bbe6,_0x3ab88e,_0x5d3478){return db['VoicePrefix'][_0x3189('0x4b')]({'where':{'id':_0x28bbe6[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x3ab88e,null))['then'](function(_0x1f57c7){if(_0x1f57c7){return _0x1f57c7[_0x3189('0x71')](_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')],_[_0x3189('0x74')](_0x28bbe6[_0x3189('0x6e')],[_0x3189('0x73'),'id'])||{})[_0x3189('0x75')](function(_0x2c110e){for(var _0x41d415=0x0;_0x41d415<_0x28bbe6['body'][_0x3189('0x73')][_0x3189('0x49')];_0x41d415+=0x1){socket[_0x3189('0x76')](_0x3189('0x77'),{'UserId':Number(_0x28bbe6[_0x3189('0x6e')][_0x3189('0x73')][_0x41d415]),'VoicePrefixId':Number(_0x28bbe6[_0x3189('0x72')]['id'])});}return _0x2c110e;});}})[_0x3189('0x2c')](respondWithResult(_0x3ab88e,null))['catch'](handleError(_0x3ab88e,null));};exports[_0x3189('0x78')]=function(_0x4861ba,_0x226a58,_0x176c44){return db[_0x3189('0x44')][_0x3189('0x4b')]({'where':{'id':_0x4861ba['params']['id']}})['then'](handleEntityNotFound(_0x226a58,null))[_0x3189('0x2c')](function(_0x2c0e85){if(_0x2c0e85){return _0x2c0e85[_0x3189('0x78')](_0x4861ba[_0x3189('0x36')]['ids'])[_0x3189('0x2c')](function(){if(_[_0x3189('0x79')](_0x4861ba['query'][_0x3189('0x73')])){for(var _0x65c13f=0x0;_0x65c13f<_0x4861ba['query'][_0x3189('0x73')][_0x3189('0x49')];_0x65c13f+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x4861ba[_0x3189('0x36')]['ids'][_0x65c13f]),'VoicePrefixId':Number(_0x4861ba[_0x3189('0x72')]['id'])});}}else{socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':Number(_0x4861ba[_0x3189('0x36')][_0x3189('0x73')]),'VoicePrefixId':Number(_0x4861ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x226a58,null))[_0x3189('0x4c')](handleError(_0x226a58,null));};exports['getAgents']=function(_0x33b271,_0x5c138a,_0x583d35){var _0x51303a={};var _0x278553={};var _0x4917e3;var _0x2d3d78;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x33b271[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5c138a,null))[_0x3189('0x2c')](function(_0x4d3554){if(_0x4d3554){_0x4917e3=_0x4d3554;_0x278553[_0x3189('0x35')]=_[_0x3189('0x37')](db[_0x3189('0x7c')][_0x3189('0x7d')]);_0x278553[_0x3189('0x36')]=_['keys'](_0x33b271[_0x3189('0x36')]);_0x278553[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],_0x278553[_0x3189('0x36')]);_0x51303a['attributes']=_[_0x3189('0x3a')](_0x278553[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x33b271[_0x3189('0x36')][_0x3189('0x3b')]));_0x51303a[_0x3189('0x39')]=_0x51303a[_0x3189('0x39')][_0x3189('0x49')]?_0x51303a[_0x3189('0x39')]:_0x278553[_0x3189('0x35')];_0x51303a['order']=qs[_0x3189('0x3f')](_0x33b271[_0x3189('0x36')][_0x3189('0x3f')]);_0x51303a[_0x3189('0x40')]=qs[_0x3189('0x38')](_[_0x3189('0x7e')](_0x33b271['query'],_0x278553[_0x3189('0x38')]));if(_0x33b271['query'][_0x3189('0x41')]){_0x51303a['where']=_[_0x3189('0x42')](_0x51303a['where'],{'$or':_[_0x3189('0x32')](_0x51303a['attributes'],function(_0x3a84e8){var _0x17b46a={};_0x17b46a[_0x3a84e8]={'$like':'%'+_0x33b271['query'][_0x3189('0x41')]+'%'};return _0x17b46a;})});}_0x51303a=_[_0x3189('0x42')]({},_0x51303a,_0x33b271[_0x3189('0x4a')]);return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x549bbd){if(_0x549bbd){_0x2d3d78=_0x549bbd['length'];if(!_0x33b271[_0x3189('0x36')][_0x3189('0x3c')](_0x3189('0x3d'))){_0x51303a[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x33b271[_0x3189('0x36')]['limit']);_0x51303a[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x33b271['query'][_0x3189('0x23')]);}return _0x4917e3[_0x3189('0x7f')](_0x51303a);}})[_0x3189('0x2c')](function(_0x5d10f8){if(_0x5d10f8){return _0x5d10f8?{'count':_0x2d3d78,'rows':_0x5d10f8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5c138a,null))[_0x3189('0x4c')](handleError(_0x5c138a,null));};exports[_0x3189('0x80')]=function(_0x24fec5,_0x5a7cf4,_0x2ef30c){var _0x14cecc={};var _0x2165f1={};var _0x1b8666;var _0x5bbf36;return db[_0x3189('0x44')][_0x3189('0x7b')]({'where':{'id':_0x24fec5[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](handleEntityNotFound(_0x5a7cf4,null))['then'](function(_0x4371b7){if(_0x4371b7){_0x1b8666=_0x4371b7;_0x2165f1[_0x3189('0x35')]=_[_0x3189('0x37')](db['Team'][_0x3189('0x7d')]);_0x2165f1['query']=_[_0x3189('0x37')](_0x24fec5['query']);_0x2165f1[_0x3189('0x38')]=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],_0x2165f1[_0x3189('0x36')]);_0x14cecc['attributes']=_[_0x3189('0x3a')](_0x2165f1[_0x3189('0x35')],qs[_0x3189('0x3b')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3b')]));_0x14cecc[_0x3189('0x39')]=_0x14cecc['attributes']['length']?_0x14cecc[_0x3189('0x39')]:_0x2165f1[_0x3189('0x35')];_0x14cecc['order']=qs[_0x3189('0x3f')](_0x24fec5[_0x3189('0x36')][_0x3189('0x3f')]);_0x14cecc[_0x3189('0x40')]=qs['filters'](_[_0x3189('0x7e')](_0x24fec5[_0x3189('0x36')],_0x2165f1[_0x3189('0x38')]));if(_0x24fec5[_0x3189('0x36')]['filter']){_0x14cecc[_0x3189('0x40')]=_[_0x3189('0x42')](_0x14cecc['where'],{'$or':_[_0x3189('0x32')](_0x14cecc[_0x3189('0x39')],function(_0x5eeb3d){var _0xe94bda={};_0xe94bda[_0x5eeb3d]={'$like':'%'+_0x24fec5[_0x3189('0x36')]['filter']+'%'};return _0xe94bda;})});}_0x14cecc=_[_0x3189('0x42')]({},_0x14cecc,_0x24fec5[_0x3189('0x4a')]);return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})[_0x3189('0x2c')](function(_0x23d34e){if(_0x23d34e){_0x5bbf36=_0x23d34e[_0x3189('0x49')];if(!_0x24fec5['query'][_0x3189('0x3c')](_0x3189('0x3d'))){_0x14cecc[_0x3189('0x24')]=qs[_0x3189('0x24')](_0x24fec5[_0x3189('0x36')][_0x3189('0x24')]);_0x14cecc[_0x3189('0x23')]=qs[_0x3189('0x23')](_0x24fec5['query'][_0x3189('0x23')]);}return _0x1b8666[_0x3189('0x80')](_0x14cecc);}})['then'](function(_0x418ef8){if(_0x418ef8){return _0x418ef8?{'count':_0x5bbf36,'rows':_0x418ef8}:null;}})[_0x3189('0x2c')](respondWithResult(_0x5a7cf4,null))['catch'](handleError(_0x5a7cf4,null));};exports[_0x3189('0x81')]=function(_0x85c195,_0x4917ee,_0x2a8f73){var _0x464843=_0x85c195[_0x3189('0x6e')][_0x3189('0x73')];var _0x429bc1;return db[_0x3189('0x82')]['findAll']({'where':{'id':_0x464843},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id','name',_0x3189('0x84'),_0x3189('0x85'),'interface'],'raw':!![]}]})['then'](function(_0x158199){if(_0x158199){_0x429bc1=_0x158199;var _0x431e68=_[_0x3189('0x86')](_0x158199,function(_0x18d525){var _0x5e565c=_0x18d525['get']({'plain':!![]});return _0x5e565c[_0x3189('0x83')];});return db[_0x3189('0x44')]['find']({'where':{'id':_0x85c195[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x36262a){return db['sequelize'][_0x3189('0x50')](function(_0xd24f4a){return _0x36262a[_0x3189('0x81')](_0x464843,{'transaction':_0xd24f4a})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x429bc1,function(_0x33f64c){return db['TeamVoicePrefix'][_0x3189('0x88')]({'TeamId':_0x33f64c['id'],'VoicePrefixId':_0x85c195['params']['id']},{'transaction':_0xd24f4a});});})[_0x3189('0x2c')](function(){return BPromise[_0x3189('0x87')](_0x431e68,function(_0x1c919f){return db['UserVoicePrefix'][_0x3189('0x89')]({'where':{'UserId':_0x1c919f['id'],'VoicePrefixId':_0x85c195[_0x3189('0x72')]['id']},'transaction':_0xd24f4a});});})['then'](function(){_0x431e68[_0x3189('0x8a')](function(_0x2bab94){socket['emit'](_0x3189('0x77'),{'UserId':_0x2bab94['id'],'VoicePrefixId':_0x36262a['id']});});});});});}})[_0x3189('0x2c')](respondWithStatusCode(_0x4917ee,null))[_0x3189('0x4c')](handleError(_0x4917ee,null));};exports[_0x3189('0x8b')]=function(_0x39fe89,_0x4f564d,_0x341e23){return db['Team'][_0x3189('0x46')]({'where':{'id':_0x39fe89[_0x3189('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3189('0x7c')],'as':_0x3189('0x83'),'attributes':['id'],'raw':!![]}]})[_0x3189('0x2c')](handleEntityNotFound(_0x4f564d,null))['then'](function(_0x4fb475){var _0x522aa5=_[_0x3189('0x32')](_0x4fb475,'id');var _0x1f0c98=[];var _0x3f5cf9=[];var _0x47ce18=squel['select']();_0x47ce18[_0x3189('0x8c')](_0x3189('0x8d'))[_0x3189('0x8e')](_0x3189('0x8f'),'tq')[_0x3189('0x90')]('user_has_teams','ut',_0x3189('0x91'))['where'](_0x3189('0x92'),_0x39fe89['params']['id']);for(var _0x241a67=0x0;_0x241a67<_0x4fb475[_0x3189('0x49')];_0x241a67+=0x1){let _0x51913c=_0x4fb475[_0x241a67];for(var _0x1a07d7=0x0;_0x1a07d7<_0x51913c[_0x3189('0x83')][_0x3189('0x49')];_0x1a07d7+=0x1){let _0x36602c=_0x51913c['Agents'][_0x1a07d7];var _0x1f9018=_0x47ce18[_0x3189('0x93')]();_0x1f9018[_0x3189('0x40')]('ut.UserId\x20=\x20?',_0x36602c['id']);_0x3f5cf9[_0x3189('0x66')](db[_0x3189('0x4f')][_0x3189('0x36')](_0x1f9018[_0x3189('0x94')](),{'type':db['sequelize'][_0x3189('0x95')][_0x3189('0x96')]})[_0x3189('0x2c')](function(_0x13fc9f){if(_0x13fc9f[_0x3189('0x49')]===0x1){return _0x36602c['id'];}else{var _0x516164=_[_0x3189('0x97')](_['map'](_0x13fc9f,_0x3189('0x98')),function(_0x1f506c){return _[_0x3189('0x99')](_0x522aa5,_0x1f506c);});if(_0x516164){return _0x36602c['id'];}}}));}}return BPromise[_0x3189('0x9a')](_0x3f5cf9)[_0x3189('0x2c')](function(_0x48835c){_0x1f0c98=_(_0x1f0c98)[_0x3189('0x9b')](_0x48835c)[_0x3189('0x9c')]()[_0x3189('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x39fe89[_0x3189('0x72')]['id']}})[_0x3189('0x2c')](function(_0x4c19e2){return db[_0x3189('0x4f')][_0x3189('0x50')](function(_0x5d89ec){return _0x4c19e2[_0x3189('0x8b')](_0x39fe89[_0x3189('0x36')][_0x3189('0x73')],{'transaction':_0x5d89ec})['then'](function(){if(!_[_0x3189('0x9e')](_0x1f0c98)){return _0x4c19e2[_0x3189('0x78')](_0x1f0c98,{'transaction':_0x5d89ec});}})['then'](function(){_0x1f0c98[_0x3189('0x8a')](function(_0xab746c){socket[_0x3189('0x76')](_0x3189('0x7a'),{'UserId':_0xab746c,'VoicePrefixId':_0x4c19e2['id']});});});});});});})[_0x3189('0x2c')](respondWithStatusCode(_0x4f564d,null))[_0x3189('0x4c')](handleError(_0x4f564d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 132a56a..48a8e7d 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 _0xb440=['../../mysqldb','setMaxListeners','save','update','hasOwnProperty','hook','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb440,0x76));var _0x0b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb440[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0b44('0x0'));var VoicePrefix=require(_0x0b44('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0b44('0x2')](0x0);var events={'afterCreate':_0x0b44('0x3'),'afterUpdate':_0x0b44('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5ca573){return function(_0x509dd4,_0xb998fc,_0x4570e7){VoicePrefixEvents['emit'](_0x5ca573+':'+_0x509dd4['id'],_0x509dd4);VoicePrefixEvents['emit'](_0x5ca573,_0x509dd4);_0x4570e7(null);};}for(var e in events){if(events[_0x0b44('0x5')](e)){var event=events[e];VoicePrefix[_0x0b44('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x445e=['remove','emit','hasOwnProperty','events','../../mysqldb','save','update'];(function(_0x259541,_0x566260){var _0x10b4d6=function(_0x519961){while(--_0x519961){_0x259541['push'](_0x259541['shift']());}};_0x10b4d6(++_0x566260);}(_0x445e,0x1e6));var _0xe445=function(_0x142e7b,_0x56c7c1){_0x142e7b=_0x142e7b-0x0;var _0xf91352=_0x445e[_0x142e7b];return _0xf91352;};'use strict';var EventEmitter=require(_0xe445('0x0'));var VoicePrefix=require(_0xe445('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe445('0x2'),'afterUpdate':_0xe445('0x3'),'afterDestroy':_0xe445('0x4')};function emitEvent(_0x1d9ca7){return function(_0x48d9f6,_0x267876,_0x8f7de8){VoicePrefixEvents['emit'](_0x1d9ca7+':'+_0x48d9f6['id'],_0x48d9f6);VoicePrefixEvents[_0xe445('0x5')](_0x1d9ca7,_0x48d9f6);_0x8f7de8(null);};}for(var e in events){if(events[_0xe445('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index bddb25e..713afc7 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 _0x6720=['api','moment','bluebird','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger'];(function(_0x3b9859,_0x52b534){var _0x3bc080=function(_0x5c4e2e){while(--_0x5c4e2e){_0x3b9859['push'](_0x3b9859['shift']());}};_0x3bc080(++_0x52b534);}(_0x6720,0x1ab));var _0x0672=function(_0x11fee6,_0x27330c){_0x11fee6=_0x11fee6-0x0;var _0x3c9095=_0x6720[_0x11fee6];return _0x3c9095;};'use strict';var _=require(_0x0672('0x0'));var util=require(_0x0672('0x1'));var logger=require(_0x0672('0x2'))(_0x0672('0x3'));var moment=require(_0x0672('0x4'));var BPromise=require(_0x0672('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0672('0x6'));module[_0x0672('0x7')]=function(_0xcf92ab,_0x4b7bc0){return _0xcf92ab[_0x0672('0x8')]('VoicePrefix',attributes,{'tableName':_0x0672('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe2b=['rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe2b,0x188));var _0xbfe2=function(_0x4e0733,_0xdd89d1){_0x4e0733=_0x4e0733-0x0;var _0x1879b8=_0xfe2b[_0x4e0733];return _0x1879b8;};'use strict';var _=require('lodash');var util=require(_0xbfe2('0x0'));var logger=require('../../config/logger')(_0xbfe2('0x1'));var moment=require(_0xbfe2('0x2'));var BPromise=require('bluebird');var rp=require(_0xbfe2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfe2('0x4'));var config=require(_0xbfe2('0x5'));var attributes=require(_0xbfe2('0x6'));module[_0xbfe2('0x7')]=function(_0x322af7,_0x51b1ac){return _0x322af7[_0xbfe2('0x8')](_0xbfe2('0x9'),attributes,{'tableName':_0xbfe2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 6fea0c1..c349ec9 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 _0xbd36=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1e4cdc,_0x3fddbb){var _0x7e7c8d=function(_0x51ecfe){while(--_0x51ecfe){_0x1e4cdc['push'](_0x1e4cdc['shift']());}};_0x7e7c8d(++_0x3fddbb);}(_0xbd36,0x65));var _0x6bd3=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xbd36[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var moment=require(_0x6bd3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd3('0x3'));var db=require(_0x6bd3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bd3('0x5'))(_0x6bd3('0x6'));var config=require(_0x6bd3('0x7'));var jayson=require(_0x6bd3('0x8'));var client=jayson['client'][_0x6bd3('0x9')]({'port':0x232a});config[_0x6bd3('0xa')]=_[_0x6bd3('0xb')](config[_0x6bd3('0xa')],{'host':_0x6bd3('0xc'),'port':0x18eb});var socket=require(_0x6bd3('0xd'))(new Redis(config[_0x6bd3('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x310f54,_0x50f7f4,_0x2ce148){return new BPromise(function(_0x18004a,_0x25056a){return client[_0x6bd3('0xe')](_0x310f54,_0x2ce148)[_0x6bd3('0xf')](function(_0x56e88f){logger[_0x6bd3('0x10')](_0x6bd3('0x11'),_0x50f7f4,'request\x20sent');logger[_0x6bd3('0x12')](_0x6bd3('0x13'),_0x50f7f4,_0x6bd3('0x14'),JSON[_0x6bd3('0x15')](_0x56e88f));if(_0x56e88f[_0x6bd3('0x16')]){if(_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x17')]===0x1f4){logger[_0x6bd3('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x50f7f4,_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x18')]);return _0x25056a(_0x56e88f['error']['message']);}logger['error'](_0x6bd3('0x11'),_0x50f7f4,_0x56e88f['error'][_0x6bd3('0x18')]);return _0x18004a(_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x18')]);}else{logger[_0x6bd3('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x50f7f4,'request\x20sent');_0x18004a(_0x56e88f[_0x6bd3('0x19')][_0x6bd3('0x18')]);}})[_0x6bd3('0x1a')](function(_0x45ae0e){logger[_0x6bd3('0x16')](_0x6bd3('0x11'),_0x50f7f4,_0x45ae0e);_0x25056a(_0x45ae0e);});});} \ No newline at end of file +var _0xcaef=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcaef,0x1c9));var _0xfcae=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xcaef[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));var moment=require(_0xfcae('0x1'));var BPromise=require(_0xfcae('0x2'));var rs=require(_0xfcae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcae('0x5'))(_0xfcae('0x6'));var config=require('../../config/environment');var jayson=require(_0xfcae('0x7'));var client=jayson[_0xfcae('0x8')]['http']({'port':0x232a});config[_0xfcae('0x9')]=_['defaults'](config['redis'],{'host':_0xfcae('0xa'),'port':0x18eb});var socket=require(_0xfcae('0xb'))(new Redis(config[_0xfcae('0x9')]));require('./voicePrefix.socket')[_0xfcae('0xc')](socket);function respondWithRpcPromise(_0x551d80,_0x5bbe56,_0x4065c9){return new BPromise(function(_0x360d42,_0x434288){return client[_0xfcae('0xd')](_0x551d80,_0x4065c9)[_0xfcae('0xe')](function(_0x25f440){logger[_0xfcae('0xf')](_0xfcae('0x10'),_0x5bbe56,_0xfcae('0x11'));logger['debug'](_0xfcae('0x12'),_0x5bbe56,_0xfcae('0x11'),JSON[_0xfcae('0x13')](_0x25f440));if(_0x25f440[_0xfcae('0x14')]){if(_0x25f440[_0xfcae('0x14')][_0xfcae('0x15')]===0x1f4){logger[_0xfcae('0x14')](_0xfcae('0x10'),_0x5bbe56,_0x25f440['error'][_0xfcae('0x16')]);return _0x434288(_0x25f440['error'][_0xfcae('0x16')]);}logger[_0xfcae('0x14')](_0xfcae('0x10'),_0x5bbe56,_0x25f440[_0xfcae('0x14')][_0xfcae('0x16')]);return _0x360d42(_0x25f440[_0xfcae('0x14')][_0xfcae('0x16')]);}else{logger[_0xfcae('0xf')](_0xfcae('0x10'),_0x5bbe56,'request\x20sent');_0x360d42(_0x25f440[_0xfcae('0x17')]['message']);}})[_0xfcae('0x18')](function(_0xb79156){logger[_0xfcae('0x14')](_0xfcae('0x10'),_0x5bbe56,_0xb79156);_0x434288(_0xb79156);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 07541db..ebcd0ea 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 _0x4b6c=['./voicePrefix.events','save','update','emit','register'];(function(_0xd4fcda,_0xa31518){var _0x3f2647=function(_0x48f588){while(--_0x48f588){_0xd4fcda['push'](_0xd4fcda['shift']());}};_0x3f2647(++_0xa31518);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0xc4b6('0x0'));var events=[_0xc4b6('0x1'),'remove',_0xc4b6('0x2')];function createListener(_0x36f354,_0x116336){return function(_0x5aef7d){_0x116336[_0xc4b6('0x3')](_0x36f354,_0x5aef7d);};}function removeListener(_0x26d2d9,_0x3c532b){return function(){VoicePrefixEvents['removeListener'](_0x26d2d9,_0x3c532b);};}exports[_0xc4b6('0x4')]=function(_0x1d5e09){for(var _0x21f368=0x0,_0x2948c6=events['length'];_0x21f368<_0x2948c6;_0x21f368++){var _0x443998=events[_0x21f368];var _0x4b935f=createListener('voicePrefix:'+_0x443998,_0x1d5e09);VoicePrefixEvents['on'](_0x443998,_0x4b935f);}}; \ No newline at end of file +var _0x86f5=['update','emit','register','length','./voicePrefix.events','remove'];(function(_0x38d883,_0x3be1ae){var _0x5e1601=function(_0x54e09b){while(--_0x54e09b){_0x38d883['push'](_0x38d883['shift']());}};_0x5e1601(++_0x3be1ae);}(_0x86f5,0x178));var _0x586f=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x86f5[_0xb0de07];return _0x4633d8;};'use strict';var VoicePrefixEvents=require(_0x586f('0x0'));var events=['save',_0x586f('0x1'),_0x586f('0x2')];function createListener(_0x49a4fd,_0x9bb313){return function(_0x2ce1db){_0x9bb313[_0x586f('0x3')](_0x49a4fd,_0x2ce1db);};}function removeListener(_0x160aa1,_0x52eeff){return function(){VoicePrefixEvents['removeListener'](_0x160aa1,_0x52eeff);};}exports[_0x586f('0x4')]=function(_0x2155f1){for(var _0x18f144=0x0,_0x5d8d74=events[_0x586f('0x5')];_0x18f144<_0x5d8d74;_0x18f144++){var _0x15b372=events[_0x18f144];var _0x315fd9=createListener('voicePrefix:'+_0x15b372,_0x2155f1);VoicePrefixEvents['on'](_0x15b372,_0x315fd9);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 30e5dad..c043227 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x56feee,_0x4d26c7){var _0x554d3e=function(_0x4f25bf){while(--_0x4f25bf){_0x56feee['push'](_0x56feee['shift']());}};_0x554d3e(++_0x4d26c7);}(_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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2eb941,_0x5dd5ae){var _0x325399=function(_0x3c1023){while(--_0x3c1023){_0x2eb941['push'](_0x2eb941['shift']());}};_0x325399(++_0x5dd5ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index e6d142b..a47f517 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 _0x484b=['split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','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)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#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','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','inbound','outbound','default','ENUM','ringall','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','predictive','INTEGER','yes','all','once','TEXT','join','periodic_announce'];(function(_0xab2468,_0x38964a){var _0x5eef99=function(_0x4a3607){while(--_0x4a3607){_0xab2468['push'](_0xab2468['shift']());}};_0x5eef99(++_0x38964a);}(_0x484b,0x81));var _0xb484=function(_0x5f3314,_0x5ebe07){_0x5f3314=_0x5f3314-0x0;var _0x271b3c=_0x484b[_0x5f3314];return _0x271b3c;};'use strict';var Sequelize=require(_0xb484('0x0'));module[_0xb484('0x1')]={'name':{'type':Sequelize[_0xb484('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xb484('0x3'),_0xb484('0x4')),'allowNull':![],'defaultValue':_0xb484('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xb484('0x5')},'announce':{'type':Sequelize[_0xb484('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xb484('0x6')]('rr',_0xb484('0x7'),'leastrecent','fewestcalls','random',_0xb484('0x8'),_0xb484('0x9'),_0xb484('0xa'),_0xb484('0xb')),'allowNull':![],'defaultValue':_0xb484('0x7'),'set':function(_0x2fd2cf){this[_0xb484('0xc')](_0xb484('0xd'),_0x2fd2cf?_0x2fd2cf:_0xb484('0x8'));},'get':function(){var _0x5d9e60=this[_0xb484('0xe')](_0xb484('0xf'));var _0x4f692b=this[_0xb484('0xe')](_0xb484('0x10'));var _0x33b1d3=this[_0xb484('0xe')]('strategy');if(_0x5d9e60===_0xb484('0x3')){return _0x33b1d3;}if(_0x4f692b===_0xb484('0x11')&&_0x33b1d3===_0xb484('0x8')||_0x4f692b===_0xb484('0x11')&&_0x33b1d3===_0xb484('0x12')){return _0x33b1d3;}if(_0x4f692b==='progressive'||_0x4f692b===_0xb484('0x13')||_0x4f692b==='power'){return _0x33b1d3;}return null;}},'servicelevel':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xb484('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xb484('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xb484('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no'),'defaultValue':_0xb484('0x15')},'autopause':{'type':Sequelize[_0xb484('0x6')]('yes','no',_0xb484('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xb484('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xb484('0x6')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xb484('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xb484('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xb484('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no'),'defaultValue':_0xb484('0x15')},'announce_holdtime':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no',_0xb484('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xb484('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xb484('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xb484('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xb484('0x2')]},'queue_youarenext':{'type':Sequelize[_0xb484('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xb484('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xb484('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xb484('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xb484('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xb484('0x2')]},'queue_quantity1':{'type':Sequelize[_0xb484('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xb484('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xb484('0x18')],'set':function(_0x3f5ed9){this['setDataValue']('periodic_announce',_0x3f5ed9?_0x3f5ed9[_0xb484('0x19')](','):[]);},'get':function(){return this[_0xb484('0xe')](_0xb484('0x1a'))?this['getDataValue'](_0xb484('0x1a'))[_0xb484('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xb484('0x2')],'defaultValue':'yes','set':function(_0x247780){this['setDataValue']('joinempty',_0x247780?_0x247780[_0xb484('0x19')](','):undefined);},'get':function(){return this[_0xb484('0xe')]('joinempty')?this['getDataValue']('joinempty')[_0xb484('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1d0998){this[_0xb484('0xc')]('leavewhenempty',_0x1d0998?_0x1d0998['join'](','):undefined);},'get':function(){return this[_0xb484('0xe')]('leavewhenempty')?this[_0xb484('0xe')](_0xb484('0x1c'))[_0xb484('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xb484('0x6')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xb484('0x2')]},'description':{'type':Sequelize[_0xb484('0x2')]},'acw':{'type':Sequelize[_0xb484('0x1d')],'defaultValue':0x0,'set':function(_0x39f41a){this['setDataValue'](_0xb484('0x1e'),_0x39f41a);if(_0x39f41a){if(this['getDataValue'](_0xb484('0x1f'))<0x2){this[_0xb484('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xb484('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xb484('0x1d')],'defaultValue':0x0,'comment':_0xb484('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xb484('0x21'),_0xb484('0x22'),'predictive','booked'),'defaultValue':_0xb484('0x21'),'comment':_0xb484('0x23')},'dialLimitChannel':{'type':Sequelize[_0xb484('0x14')](0x4)[_0xb484('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xb484('0x14')](0x4)[_0xb484('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb484('0x25')},'dialPowerLevel':{'type':Sequelize[_0xb484('0x26')](0x2)[_0xb484('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xb484('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x28'),_0xb484('0x29')),'defaultValue':_0xb484('0x29'),'comment':_0xb484('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xb484('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xb484('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xb484('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xb484('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb484('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xb484('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0xb484('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb484('0x2e')},'dialQueueProject':{'type':Sequelize[_0xb484('0x2')],'comment':_0xb484('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb484('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb484('0x14')](0x5)[_0xb484('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb484('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xb484('0x14')](0x5)[_0xb484('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb484('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb484('0x24')],'defaultValue':0x3,'comment':_0xb484('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb484('0x14')](0x5)[_0xb484('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb484('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb484('0x35')},'dialTimezone':{'type':Sequelize[_0xb484('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xb484('0x36')},'dialPrefix':{'type':Sequelize[_0xb484('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xb484('0x6')]('always','never',_0xb484('0x37')),'defaultValue':_0xb484('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb484('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xb484('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xb484('0x14')](0x9)[_0xb484('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb484('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb484('0x14')](0x9)[_0xb484('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb484('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb484('0x14')](0x9)[_0xb484('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb484('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xb484('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb484('0x14')](0x9)[_0xb484('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb484('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb484('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xb484('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb484('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb484('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb484('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xb484('0x14')](0x5)[_0xb484('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xb484('0x1d')],'defaultValue':0x0,'comment':_0xb484('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb484('0x6')](_0xb484('0x41'),_0xb484('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xb484('0x2')],'comment':_0xb484('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xb484('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb484('0x43')},'dialCutDigit':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb484('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb484('0x14')](0x5)[_0xb484('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb484('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb484('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xb484('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb484('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb484('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb484('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb484('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb484('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb484('0x14')](0x5)[_0xb484('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb484('0x14')](0x3)[_0xb484('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb484('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb484('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb484('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5aaa13){if(!_0x5aaa13)this[_0xb484('0xc')](_0xb484('0x4c'),null);this[_0xb484('0xc')](_0xb484('0x4d'),_0x5aaa13);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xb484('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xb484('0x1d')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe518=['dialMethod','inbound','booked','roundrobin','INTEGER','yes','all','periodic_announce','join','joinempty','leavewhenempty','split','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','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)','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xe518,0x196));var _0x8e51=function(_0x7202fc,_0x4de9ff){_0x7202fc=_0x7202fc-0x0;var _0x2cc291=_0xe518[_0x7202fc];return _0x2cc291;};'use strict';var Sequelize=require(_0x8e51('0x0'));module[_0x8e51('0x1')]={'name':{'type':Sequelize[_0x8e51('0x2')],'allowNull':![],'unique':_0x8e51('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8e51('0x4')]('inbound',_0x8e51('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':_0x8e51('0x6')},'announce':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x8e51('0x7'),_0x8e51('0x8'),_0x8e51('0x9'),_0x8e51('0xa'),_0x8e51('0xb'),_0x8e51('0xc'),_0x8e51('0xd'),_0x8e51('0xe')),'allowNull':![],'defaultValue':_0x8e51('0x7'),'set':function(_0xcd34db){this[_0x8e51('0xf')](_0x8e51('0x10'),_0xcd34db?_0xcd34db:_0x8e51('0xb'));},'get':function(){var _0x1e16a1=this[_0x8e51('0x11')](_0x8e51('0x12'));var _0x2967c4=this['getDataValue'](_0x8e51('0x13'));var _0x4ecd47=this['getDataValue'](_0x8e51('0x10'));if(_0x1e16a1===_0x8e51('0x14')){return _0x4ecd47;}if(_0x2967c4===_0x8e51('0x15')&&_0x4ecd47==='rrmemory'||_0x2967c4==='booked'&&_0x4ecd47===_0x8e51('0x16')){return _0x4ecd47;}if(_0x2967c4==='progressive'||_0x2967c4==='predictive'||_0x2967c4==='power'){return _0x4ecd47;}return null;}},'servicelevel':{'type':Sequelize[_0x8e51('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x8e51('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8e51('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x8e51('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x8e51('0x18')},'autopause':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no',_0x8e51('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8e51('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8e51('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8e51('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8e51('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8e51('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8e51('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8e51('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x8e51('0x18'),'no'),'defaultValue':_0x8e51('0x18')},'announce_holdtime':{'type':Sequelize[_0x8e51('0x4')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8e51('0x2')]},'queue_youarenext':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x8e51('0x2')]},'queue_less_than':{'type':Sequelize[_0x8e51('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2281b9){this[_0x8e51('0xf')](_0x8e51('0x1a'),_0x2281b9?_0x2281b9[_0x8e51('0x1b')](','):[]);},'get':function(){return this[_0x8e51('0x11')]('periodic_announce')?this['getDataValue'](_0x8e51('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':_0x8e51('0x18'),'set':function(_0x4a8dcc){this[_0x8e51('0xf')](_0x8e51('0x1c'),_0x4a8dcc?_0x4a8dcc[_0x8e51('0x1b')](','):undefined);},'get':function(){return this[_0x8e51('0x11')]('joinempty')?this[_0x8e51('0x11')](_0x8e51('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':'no','set':function(_0x1b922c){this[_0x8e51('0xf')](_0x8e51('0x1d'),_0x1b922c?_0x1b922c[_0x8e51('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0x8e51('0x1d'))?this[_0x8e51('0x11')](_0x8e51('0x1d'))[_0x8e51('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8e51('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8e51('0x2')]},'description':{'type':Sequelize[_0x8e51('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x262513){this[_0x8e51('0xf')](_0x8e51('0x1f'),_0x262513);if(_0x262513){if(this['getDataValue'](_0x8e51('0x20'))<0x2){this[_0x8e51('0xf')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8e51('0x21')},'dialMethod':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x22'),_0x8e51('0x23'),'power',_0x8e51('0x24'),_0x8e51('0x15')),'defaultValue':'progressive','comment':_0x8e51('0x25')},'dialLimitChannel':{'type':Sequelize[_0x8e51('0x17')](0x4)[_0x8e51('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8e51('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x8e51('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8e51('0x28')},'dialPowerLevel':{'type':Sequelize[_0x8e51('0x29')](0x2)[_0x8e51('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8e51('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x2b'),'dropRate'),'defaultValue':_0x8e51('0x2c'),'comment':_0x8e51('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8e51('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8e51('0x2e')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8e51('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8e51('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x8e51('0x17')](0x3)[_0x8e51('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e51('0x30')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x8e51('0x31'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x8e51('0x17')](0x3)[_0x8e51('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x8e51('0x2')],'comment':_0x8e51('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8e51('0x17')](0x3)[_0x8e51('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8e51('0x17')](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x8e51('0x17')](0x3)[_0x8e51('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8e51('0x17')](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e51('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8e51('0x17')](0x3)[_0x8e51('0x26')],'defaultValue':0x3,'comment':_0x8e51('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e51('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8e51('0x17')](0x3)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x8e51('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x36'),_0x8e51('0x37'),_0x8e51('0x38')),'defaultValue':_0x8e51('0x36')},'dialAMDActive':{'type':Sequelize[_0x8e51('0x39')],'defaultValue':0x0,'comment':_0x8e51('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x8e51('0x17')](0x9)[_0x8e51('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8e51('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x8e51('0x17')](0x9)[_0x8e51('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8e51('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8e51('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x8e51('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8e51('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0x8e51('0x17')](0x9)[_0x8e51('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8e51('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8e51('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8e51('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8e51('0x17')](0x9)[_0x8e51('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8e51('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8e51('0x17')](0x5)[_0x8e51('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8e51('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8e51('0x17')](0x9)[_0x8e51('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8e51('0x43')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8e51('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x8e51('0x39')],'defaultValue':0x0,'comment':_0x8e51('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8e51('0x4')](_0x8e51('0x46'),'ASC'),'defaultValue':_0x8e51('0x46')},'dialQueueProject2':{'type':Sequelize[_0x8e51('0x2')],'comment':_0x8e51('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8e51('0x39')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8e51('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8e51('0x47')},'dialCutDigit':{'type':Sequelize[_0x8e51('0x17')](0x3)[_0x8e51('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8e51('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8e51('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e51('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e51('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0x8e51('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e51('0x4b')},'dialDropRetryFrequency':{'type':Sequelize[_0x8e51('0x17')](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e51('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8e51('0x17')](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e51('0x4d')},'dialMachineMaxRetry':{'type':Sequelize[_0x8e51('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e51('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8e51('0x17')](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e51('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8e51('0x50')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8e51('0x17')](0x5)[_0x8e51('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8e51('0x51')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8e51('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8e51('0x39')],'defaultValue':![],'comment':_0x8e51('0x52'),'set':function(_0x5cc907){if(!_0x5cc907)this[_0x8e51('0xf')](_0x8e51('0x53'),null);this['setDataValue'](_0x8e51('0x54'),_0x5cc907);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8e51('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8e51('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x8e51('0x39')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8e51('0x39')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index a0045ce..a60ebae 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 _0x27db=['removeLists','addBlackLists','cm_hopper_black','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','end','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','offset','order','sort','where','merge','VIRTUAL','options','findAll','rows','catch','params','filters','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','intersection','include','createdAt','updatedAt','autoAssociation','getHoppers','findOne','nolimit','pick','VoiceQueueId','CmHopper','getHopperHistories','hasOwnProperty','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','toString','QueryTypes','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','push','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','ContactId','select','CmListId','ListId','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','into','fromQuery','scheduledAt'];(function(_0x190c08,_0x522ee2){var _0x3a1def=function(_0x17f029){while(--_0x17f029){_0x190c08['push'](_0x190c08['shift']());}};_0x3a1def(++_0x522ee2);}(_0x27db,0x179));var _0xb27d=function(_0x5e186d,_0x4cbcb4){_0x5e186d=_0x5e186d-0x0;var _0x20e313=_0x27db[_0x5e186d];return _0x20e313;};'use strict';var emlformat=require(_0xb27d('0x0'));var rimraf=require(_0xb27d('0x1'));var zipdir=require(_0xb27d('0x2'));var jsonpatch=require(_0xb27d('0x3'));var rp=require('request-promise');var moment=require(_0xb27d('0x4'));var BPromise=require(_0xb27d('0x5'));var Mustache=require(_0xb27d('0x6'));var util=require(_0xb27d('0x7'));var path=require(_0xb27d('0x8'));var sox=require('sox');var csv=require(_0xb27d('0x9'));var ejs=require(_0xb27d('0xa'));var fs=require('fs');var fs_extra=require(_0xb27d('0xb'));var _=require(_0xb27d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb27d('0xd'));var Redis=require(_0xb27d('0xe'));var authService=require(_0xb27d('0xf'));var qs=require(_0xb27d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb27d('0x11'));var logger=require(_0xb27d('0x12'))(_0xb27d('0x13'));var utils=require(_0xb27d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb27d('0x15'));var db=require(_0xb27d('0x16'))['db'];config[_0xb27d('0x17')]=_['defaults'](config[_0xb27d('0x17')],{'host':_0xb27d('0x18'),'port':0x18eb});var socket=require(_0xb27d('0x19'))(new Redis(config[_0xb27d('0x17')]));require(_0xb27d('0x1a'))[_0xb27d('0x1b')](socket);function respondWithStatusCode(_0x7c76cd,_0x5034ea){_0x5034ea=_0x5034ea||0xcc;return function(_0x20c09f){if(_0x20c09f){return _0x7c76cd[_0xb27d('0x1c')](_0x5034ea);}return _0x7c76cd['status'](_0x5034ea)['end']();};}function respondWithResult(_0x317802,_0x25ee2e){_0x25ee2e=_0x25ee2e||0xc8;return function(_0x2db162){if(_0x2db162){return _0x317802[_0xb27d('0x1d')](_0x25ee2e)[_0xb27d('0x1e')](_0x2db162);}};}function respondWithFilteredResult(_0x16f2df,_0x2fa38a){return function(_0x34defc){if(_0x34defc){var _0x350450=typeof _0x2fa38a['offset']===_0xb27d('0x1f')&&typeof _0x2fa38a[_0xb27d('0x20')]===_0xb27d('0x1f');var _0x1a82ea=_0x34defc[_0xb27d('0x21')];var _0x1f5823=_0x350450?0x0:_0x2fa38a['offset'];var _0x26f14b=_0x350450?_0x34defc[_0xb27d('0x21')]:_0x2fa38a['offset']+_0x2fa38a['limit'];var _0x37008c;if(_0x26f14b>=_0x1a82ea){_0x26f14b=_0x1a82ea;_0x37008c=0xc8;}else{_0x37008c=0xce;}_0x16f2df['status'](_0x37008c);return _0x16f2df[_0xb27d('0x22')](_0xb27d('0x23'),_0x1f5823+'-'+_0x26f14b+'/'+_0x1a82ea)['json'](_0x34defc);}return null;};}function patchUpdates(_0x503f79){return function(_0x809a7b){try{jsonpatch['apply'](_0x809a7b,_0x503f79,!![]);}catch(_0x32c5da){return BPromise[_0xb27d('0x24')](_0x32c5da);}return _0x809a7b[_0xb27d('0x25')]();};}function saveUpdates(_0x7514f7,_0x181984){return function(_0x549ffe){if(_0x549ffe){return _0x549ffe[_0xb27d('0x26')](_0x7514f7)[_0xb27d('0x27')](function(_0x5a9d69){return _0x5a9d69;});}return null;};}function removeEntity(_0x5423f0,_0x2d768d){return function(_0x1fbc43){if(_0x1fbc43){return _0x1fbc43[_0xb27d('0x28')]()[_0xb27d('0x27')](function(){var _0x18b6c0=_0x1fbc43[_0xb27d('0x29')]({'plain':!![]});var _0x4e57d2=[{'name':_0xb27d('0x2a'),'value':_0xb27d('0x2b'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb27d('0x2c'),'ignore':![]}];var _0x4c9bf8=_(_0x4e57d2)[_0xb27d('0x2d')](_0xb27d('0x2e'))[_0xb27d('0x2f')](_0xb27d('0x30'))[_0xb27d('0x30')]();if(_['includes'](_0x4c9bf8,_0x18b6c0[_0xb27d('0x31')])){return;}var _0x568fc2=_[_0xb27d('0x32')](_0x4e57d2,[_0xb27d('0x30'),_0x18b6c0[_0xb27d('0x31')]])[_0xb27d('0x33')];return db[_0xb27d('0x34')][_0xb27d('0x28')]({'where':{'type':_0x568fc2,'resourceId':_0x18b6c0['id']}})[_0xb27d('0x27')](function(){return _0x1fbc43;});})['then'](function(){_0x5423f0[_0xb27d('0x1d')](0xcc)[_0xb27d('0x35')]();});}};}function handleEntityNotFound(_0x480e54,_0x40486c){return function(_0x5bdf66){if(!_0x5bdf66){_0x480e54['sendStatus'](0x194);}return _0x5bdf66;};}function handleError(_0x56ff8b,_0x107901){_0x107901=_0x107901||0x1f4;return function(_0x36324b){logger['error'](_0x36324b[_0xb27d('0x36')]);if(_0x36324b[_0xb27d('0x33')]){delete _0x36324b[_0xb27d('0x33')];}_0x56ff8b['status'](_0x107901)[_0xb27d('0x37')](_0x36324b);};}exports[_0xb27d('0x38')]=function(_0x93e39d,_0x4686bd){var _0x53766c={},_0x314644={},_0x23ecbd={'count':0x0,'rows':[]};var _0x2d8f2e=_[_0xb27d('0x2f')](db[_0xb27d('0x39')][_0xb27d('0x3a')],function(_0x5cf5d9){return{'name':_0x5cf5d9[_0xb27d('0x3b')],'type':_0x5cf5d9[_0xb27d('0x31')][_0xb27d('0x3c')]};});_0x314644['model']=_[_0xb27d('0x2f')](_0x2d8f2e,_0xb27d('0x33'));_0x314644[_0xb27d('0x3d')]=_[_0xb27d('0x3e')](_0x93e39d['query']);_0x314644['filters']=_['intersection'](_0x314644[_0xb27d('0x3f')],_0x314644[_0xb27d('0x3d')]);_0x53766c[_0xb27d('0x40')]=_['intersection'](_0x314644[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0x93e39d['query'][_0xb27d('0x41')]));_0x53766c['attributes']=_0x53766c['attributes'][_0xb27d('0x42')]?_0x53766c[_0xb27d('0x40')]:_0x314644[_0xb27d('0x3f')];if(!_0x93e39d[_0xb27d('0x3d')]['hasOwnProperty']('nolimit')){_0x53766c[_0xb27d('0x20')]=qs[_0xb27d('0x20')](_0x93e39d[_0xb27d('0x3d')][_0xb27d('0x20')]);_0x53766c[_0xb27d('0x43')]=qs[_0xb27d('0x43')](_0x93e39d[_0xb27d('0x3d')]['offset']);}_0x53766c[_0xb27d('0x44')]=qs[_0xb27d('0x45')](_0x93e39d['query'][_0xb27d('0x45')]);_0x53766c[_0xb27d('0x46')]=qs['filters'](_['pick'](_0x93e39d[_0xb27d('0x3d')],_0x314644['filters']),_0x2d8f2e);if(_0x93e39d[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0x53766c[_0xb27d('0x46')]=_[_0xb27d('0x47')](_0x53766c[_0xb27d('0x46')],{'$or':_[_0xb27d('0x2f')](_0x2d8f2e,function(_0xf2d855){if(_0xf2d855[_0xb27d('0x31')]!==_0xb27d('0x48')){var _0x37410c={};_0x37410c[_0xf2d855[_0xb27d('0x33')]]={'$like':'%'+_0x93e39d['query']['filter']+'%'};return _0x37410c;}})});}_0x53766c=_[_0xb27d('0x47')]({},_0x53766c,_0x93e39d[_0xb27d('0x49')]);var _0x1bcf63={'where':_0x53766c[_0xb27d('0x46')]};return db[_0xb27d('0x39')][_0xb27d('0x21')](_0x1bcf63)[_0xb27d('0x27')](function(_0x225b04){_0x23ecbd['count']=_0x225b04;if(_0x93e39d[_0xb27d('0x3d')]['includeAll']){_0x53766c['include']=[{'all':!![]}];}return db[_0xb27d('0x39')][_0xb27d('0x4a')](_0x53766c);})[_0xb27d('0x27')](function(_0x4c697c){_0x23ecbd[_0xb27d('0x4b')]=_0x4c697c;return _0x23ecbd;})[_0xb27d('0x27')](respondWithFilteredResult(_0x4686bd,_0x53766c))[_0xb27d('0x4c')](handleError(_0x4686bd,null));};exports['show']=function(_0x34ac20,_0x2a14dd){var _0x345c86={'raw':![],'where':{'id':_0x34ac20[_0xb27d('0x4d')]['id']}},_0x1db458={};_0x1db458[_0xb27d('0x3f')]=_[_0xb27d('0x3e')](db[_0xb27d('0x39')]['rawAttributes']);_0x1db458['query']=_[_0xb27d('0x3e')](_0x34ac20[_0xb27d('0x3d')]);_0x1db458[_0xb27d('0x4e')]=_['intersection'](_0x1db458[_0xb27d('0x3f')],_0x1db458[_0xb27d('0x3d')]);_0x345c86[_0xb27d('0x40')]=_['intersection'](_0x1db458['model'],qs['fields'](_0x34ac20[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x345c86[_0xb27d('0x40')]=_0x345c86['attributes'][_0xb27d('0x42')]?_0x345c86[_0xb27d('0x40')]:_0x1db458[_0xb27d('0x3f')];if(_0x34ac20['query'][_0xb27d('0x4f')]){_0x345c86['include']=[{'all':!![]}];}_0x345c86=_[_0xb27d('0x47')]({},_0x345c86,_0x34ac20['options']);return db['VoiceQueue'][_0xb27d('0x32')](_0x345c86)[_0xb27d('0x27')](handleEntityNotFound(_0x2a14dd,null))[_0xb27d('0x27')](respondWithResult(_0x2a14dd,null))[_0xb27d('0x4c')](handleError(_0x2a14dd,null));};exports[_0xb27d('0x50')]=function(_0x36d23e,_0x29b59e){return db[_0xb27d('0x39')][_0xb27d('0x50')](_0x36d23e[_0xb27d('0x51')],{})[_0xb27d('0x27')](function(_0x103617){var _0xb5212a=_0x36d23e[_0xb27d('0x52')][_0xb27d('0x29')]({'plain':!![]});if(!_0xb5212a)throw new Error(_0xb27d('0x53'));if(_0xb5212a[_0xb27d('0x54')]==='user'){var _0x153009=_0x103617[_0xb27d('0x29')]({'plain':!![]});var _0xb6cf55=[{'name':_0xb27d('0x2a'),'value':_0xb27d('0x2b')},{'name':_0xb27d('0x55'),'value':_0xb27d('0x2c')}];var _0x244c58=_[_0xb27d('0x32')](_0xb6cf55,[_0xb27d('0x30'),_0x153009['type']])[_0xb27d('0x33')];return db[_0xb27d('0x56')][_0xb27d('0x32')]({'where':{'name':_0x244c58,'userProfileId':_0xb5212a[_0xb27d('0x57')]},'raw':!![]})[_0xb27d('0x27')](function(_0x269314){if(_0x269314&&_0x269314['autoAssociation']===0x0){return db[_0xb27d('0x34')][_0xb27d('0x50')]({'name':_0x153009[_0xb27d('0x33')],'resourceId':_0x153009['id'],'type':_0x269314['name'],'sectionId':_0x269314['id']},{})['then'](function(){return _0x103617;});}else{return _0x103617;}})[_0xb27d('0x4c')](function(_0x3c7c79){logger[_0xb27d('0x58')](_0xb27d('0x59'),_0x3c7c79);throw _0x3c7c79;});}return _0x103617;})['then'](respondWithResult(_0x29b59e,0xc9))[_0xb27d('0x4c')](handleError(_0x29b59e,null));};exports[_0xb27d('0x5a')]=function(_0x53bc74,_0x2fc3e9){var _0x178b1c={'where':{'id':_0x53bc74['params']['id']}},_0x377e71={};_0x377e71['model']=_['keys'](db[_0xb27d('0x39')]['rawAttributes']);_0x178b1c['attributes']=_[_0xb27d('0x5b')](_0x377e71[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0x53bc74[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x178b1c[_0xb27d('0x40')]=_0x178b1c[_0xb27d('0x40')][_0xb27d('0x42')]?_0x178b1c['attributes']:_0x377e71[_0xb27d('0x3f')];if(_0x53bc74['query'][_0xb27d('0x4f')]){_0x178b1c[_0xb27d('0x5c')]=[{'all':!![]}];}_0x178b1c=_[_0xb27d('0x47')]({},_0x178b1c,_0x53bc74[_0xb27d('0x49')]);return db[_0xb27d('0x39')][_0xb27d('0x32')](_0x178b1c)['then'](handleEntityNotFound(_0x2fc3e9,null))[_0xb27d('0x27')](function(_0xc86c3e){if(_0xc86c3e){var _0x5c84cb=_0xc86c3e['get']({'plain':!![]});_0x5c84cb=qs['omit'](_0x5c84cb,['id',_0xb27d('0x5d'),_0xb27d('0x5e')]);_0x53bc74[_0xb27d('0x51')]=_['omit'](_0x53bc74[_0xb27d('0x51')],['id',_0xb27d('0x5d'),_0xb27d('0x5e')]);return db[_0xb27d('0x39')][_0xb27d('0x50')](_[_0xb27d('0x47')](_0x5c84cb,_0x53bc74[_0xb27d('0x51')]),{'include':_0x53bc74[_0xb27d('0x3d')][_0xb27d('0x4f')]?[{'all':!![]}]:undefined})[_0xb27d('0x27')](function(_0x1d2e4b){var _0x202966=_0x53bc74[_0xb27d('0x52')]['get']({'plain':!![]});if(!_0x202966)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x202966[_0xb27d('0x54')]===_0xb27d('0x52')){var _0xea88f0=_0x1d2e4b[_0xb27d('0x29')]({'plain':!![]});var _0xcd13a9=[{'name':_0xb27d('0x2a'),'value':_0xb27d('0x2b')},{'name':'QueueCampaigns','value':_0xb27d('0x2c')}];var _0x275890=_[_0xb27d('0x32')](_0xcd13a9,[_0xb27d('0x30'),_0xea88f0[_0xb27d('0x31')]])[_0xb27d('0x33')];return db[_0xb27d('0x56')][_0xb27d('0x32')]({'where':{'name':_0x275890,'userProfileId':_0x202966[_0xb27d('0x57')]},'raw':!![]})[_0xb27d('0x27')](function(_0x3d00ce){if(_0x3d00ce&&_0x3d00ce[_0xb27d('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0xea88f0[_0xb27d('0x33')],'resourceId':_0xea88f0['id'],'type':_0x3d00ce[_0xb27d('0x33')],'sectionId':_0x3d00ce['id']},{})[_0xb27d('0x27')](function(){return _0x1d2e4b;});}else{return _0x1d2e4b;}})['catch'](function(_0x486a3f){logger[_0xb27d('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x486a3f);throw _0x486a3f;});}return _0x1d2e4b;});}})[_0xb27d('0x27')](respondWithResult(_0x2fc3e9,0xc9))[_0xb27d('0x4c')](handleError(_0x2fc3e9,null));};exports['update']=function(_0x50de4d,_0x58f643){if(_0x50de4d[_0xb27d('0x51')]['id']){delete _0x50de4d['body']['id'];}return db[_0xb27d('0x39')][_0xb27d('0x32')]({'where':{'id':_0x50de4d[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x58f643,null))[_0xb27d('0x27')](saveUpdates(_0x50de4d[_0xb27d('0x51')],null))[_0xb27d('0x27')](respondWithResult(_0x58f643,null))[_0xb27d('0x4c')](handleError(_0x58f643,null));};exports[_0xb27d('0x28')]=function(_0x149256,_0x169c47){return db['VoiceQueue'][_0xb27d('0x32')]({'where':{'id':_0x149256[_0xb27d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x169c47,null))[_0xb27d('0x27')](removeEntity(_0x169c47,null))['catch'](handleError(_0x169c47,null));};exports[_0xb27d('0x60')]=function(_0x8f7570,_0x2776cd,_0x236952){var _0x1104ac={'raw':![],'where':{}};var _0x585403={};var _0x5d181c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb27d('0x61')]({'where':{'id':_0x8f7570[_0xb27d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2776cd,null))[_0xb27d('0x27')](function(_0x163e97){if(_0x163e97){_0x585403[_0xb27d('0x3f')]=_[_0xb27d('0x3e')](db['CmHopper']['rawAttributes']);_0x585403['query']=_[_0xb27d('0x3e')](_0x8f7570['query']);_0x585403[_0xb27d('0x4e')]=_[_0xb27d('0x5b')](_0x585403[_0xb27d('0x3f')],_0x585403[_0xb27d('0x3d')]);_0x1104ac['attributes']=_[_0xb27d('0x5b')](_0x585403[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0x8f7570[_0xb27d('0x3d')]['fields']));_0x1104ac['attributes']=_0x1104ac['attributes'][_0xb27d('0x42')]?_0x1104ac[_0xb27d('0x40')]:_0x585403[_0xb27d('0x3f')];if(!_0x8f7570[_0xb27d('0x3d')]['hasOwnProperty'](_0xb27d('0x62'))){_0x1104ac[_0xb27d('0x20')]=qs[_0xb27d('0x20')](_0x8f7570['query'][_0xb27d('0x20')]);_0x1104ac['offset']=qs[_0xb27d('0x43')](_0x8f7570['query'][_0xb27d('0x43')]);}_0x1104ac[_0xb27d('0x44')]=qs[_0xb27d('0x45')](_0x8f7570[_0xb27d('0x3d')][_0xb27d('0x45')]);_0x1104ac[_0xb27d('0x46')]=qs[_0xb27d('0x4e')](_[_0xb27d('0x63')](_0x8f7570[_0xb27d('0x3d')],_0x585403[_0xb27d('0x4e')]));_0x1104ac[_0xb27d('0x46')][_0xb27d('0x64')]=_0x163e97['id'];if(_0x8f7570[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0x1104ac[_0xb27d('0x46')]=_[_0xb27d('0x47')](_0x1104ac[_0xb27d('0x46')],{'$or':_[_0xb27d('0x2f')](_0x1104ac[_0xb27d('0x40')],function(_0x45c721){var _0x484ee1={};_0x484ee1[_0x45c721]={'$like':'%'+_0x8f7570[_0xb27d('0x3d')][_0xb27d('0x2d')]+'%'};return _0x484ee1;})});}_0x1104ac=_[_0xb27d('0x47')]({},_0x1104ac,_0x8f7570[_0xb27d('0x49')]);return db[_0xb27d('0x65')][_0xb27d('0x21')]({'where':_0x1104ac[_0xb27d('0x46')]})[_0xb27d('0x27')](function(_0x314f04){_0x5d181c[_0xb27d('0x21')]=_0x314f04;if(_0x8f7570[_0xb27d('0x3d')][_0xb27d('0x4f')]){_0x1104ac[_0xb27d('0x5c')]=[{'all':!![]}];}return db['CmHopper'][_0xb27d('0x4a')](_0x1104ac);})[_0xb27d('0x27')](function(_0x16fa04){_0x5d181c['rows']=_0x16fa04;return _0x5d181c;});}})['then'](respondWithFilteredResult(_0x2776cd,_0x1104ac))[_0xb27d('0x4c')](handleError(_0x2776cd,null));};exports[_0xb27d('0x66')]=function(_0x44576f,_0xd712f1,_0x5abd62){var _0x2e51de={'raw':!![],'where':{}};var _0x12ebc0={};var _0x2bb70c={'count':0x0,'rows':[]};return db[_0xb27d('0x39')][_0xb27d('0x61')]({'where':{'id':_0x44576f[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0xd712f1,null))[_0xb27d('0x27')](function(_0xb3108){if(_0xb3108){_0x12ebc0['model']=_[_0xb27d('0x3e')](db['CmHopperHistory']['rawAttributes']);_0x12ebc0[_0xb27d('0x3d')]=_[_0xb27d('0x3e')](_0x44576f[_0xb27d('0x3d')]);_0x12ebc0[_0xb27d('0x4e')]=_[_0xb27d('0x5b')](_0x12ebc0['model'],_0x12ebc0[_0xb27d('0x3d')]);_0x2e51de[_0xb27d('0x40')]=_[_0xb27d('0x5b')](_0x12ebc0[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0x44576f[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x2e51de[_0xb27d('0x40')]=_0x2e51de[_0xb27d('0x40')][_0xb27d('0x42')]?_0x2e51de[_0xb27d('0x40')]:_0x12ebc0[_0xb27d('0x3f')];if(!_0x44576f[_0xb27d('0x3d')][_0xb27d('0x67')](_0xb27d('0x62'))){_0x2e51de['limit']=qs[_0xb27d('0x20')](_0x44576f[_0xb27d('0x3d')][_0xb27d('0x20')]);_0x2e51de[_0xb27d('0x43')]=qs[_0xb27d('0x43')](_0x44576f['query']['offset']);}_0x2e51de[_0xb27d('0x44')]=qs[_0xb27d('0x45')](_0x44576f['query']['sort']);_0x2e51de[_0xb27d('0x46')]=qs[_0xb27d('0x4e')](_[_0xb27d('0x63')](_0x44576f[_0xb27d('0x3d')],_0x12ebc0[_0xb27d('0x4e')]));_0x2e51de[_0xb27d('0x46')][_0xb27d('0x64')]=_0xb3108['id'];if(_0x44576f[_0xb27d('0x3d')]['filter']){_0x2e51de[_0xb27d('0x46')]=_[_0xb27d('0x47')](_0x2e51de[_0xb27d('0x46')],{'$or':_[_0xb27d('0x2f')](_0x2e51de['attributes'],function(_0xb6fcfe){var _0x2138ad={};_0x2138ad[_0xb6fcfe]={'$like':'%'+_0x44576f[_0xb27d('0x3d')]['filter']+'%'};return _0x2138ad;})});}_0x2e51de=_[_0xb27d('0x47')]({},_0x2e51de,_0x44576f[_0xb27d('0x49')]);return db[_0xb27d('0x68')][_0xb27d('0x21')]({'where':_0x2e51de[_0xb27d('0x46')]})[_0xb27d('0x27')](function(_0x3e9052){_0x2bb70c[_0xb27d('0x21')]=_0x3e9052;if(_0x44576f[_0xb27d('0x3d')][_0xb27d('0x4f')]){_0x2e51de['include']=[{'all':!![]}];}return db[_0xb27d('0x68')][_0xb27d('0x4a')](_0x2e51de);})[_0xb27d('0x27')](function(_0x251c87){_0x2bb70c[_0xb27d('0x4b')]=_0x251c87;return _0x2bb70c;});}})['then'](respondWithFilteredResult(_0xd712f1,_0x2e51de))[_0xb27d('0x4c')](handleError(_0xd712f1,null));};exports[_0xb27d('0x69')]=function(_0x450145,_0x2b9267,_0x5d9529){var _0x38b6dc={'raw':!![],'where':{}};var _0x5e2dbb={};var _0x1eb866={'count':0x0,'rows':[]};return db[_0xb27d('0x39')][_0xb27d('0x61')]({'where':{'id':_0x450145[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x2b9267,null))['then'](function(_0x512a39){if(_0x512a39){_0x5e2dbb[_0xb27d('0x3f')]=_[_0xb27d('0x3e')](db[_0xb27d('0x6a')][_0xb27d('0x3a')]);_0x5e2dbb['query']=_[_0xb27d('0x3e')](_0x450145['query']);_0x5e2dbb[_0xb27d('0x4e')]=_['intersection'](_0x5e2dbb[_0xb27d('0x3f')],_0x5e2dbb[_0xb27d('0x3d')]);_0x38b6dc['attributes']=_[_0xb27d('0x5b')](_0x5e2dbb['model'],qs['fields'](_0x450145[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x38b6dc[_0xb27d('0x40')]=_0x38b6dc['attributes']['length']?_0x38b6dc[_0xb27d('0x40')]:_0x5e2dbb['model'];if(!_0x450145[_0xb27d('0x3d')]['hasOwnProperty'](_0xb27d('0x62'))){_0x38b6dc[_0xb27d('0x20')]=qs[_0xb27d('0x20')](_0x450145[_0xb27d('0x3d')][_0xb27d('0x20')]);_0x38b6dc[_0xb27d('0x43')]=qs[_0xb27d('0x43')](_0x450145[_0xb27d('0x3d')][_0xb27d('0x43')]);}_0x38b6dc[_0xb27d('0x44')]=qs['sort'](_0x450145['query'][_0xb27d('0x45')]);_0x38b6dc[_0xb27d('0x46')]=qs[_0xb27d('0x4e')](_['pick'](_0x450145[_0xb27d('0x3d')],_0x5e2dbb[_0xb27d('0x4e')]));_0x38b6dc['where'][_0xb27d('0x64')]=_0x512a39['id'];if(_0x450145[_0xb27d('0x3d')]['filter']){_0x38b6dc[_0xb27d('0x46')]=_[_0xb27d('0x47')](_0x38b6dc[_0xb27d('0x46')],{'$or':_['map'](_0x38b6dc[_0xb27d('0x40')],function(_0x2dd8cd){var _0x32e73b={};_0x32e73b[_0x2dd8cd]={'$like':'%'+_0x450145[_0xb27d('0x3d')]['filter']+'%'};return _0x32e73b;})});}_0x38b6dc=_['merge']({},_0x38b6dc,_0x450145['options']);return db[_0xb27d('0x6a')][_0xb27d('0x21')]({'where':_0x38b6dc[_0xb27d('0x46')]})[_0xb27d('0x27')](function(_0x13cefb){_0x1eb866[_0xb27d('0x21')]=_0x13cefb;if(_0x450145[_0xb27d('0x3d')][_0xb27d('0x4f')]){_0x38b6dc['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xb27d('0x4a')](_0x38b6dc);})[_0xb27d('0x27')](function(_0x150434){_0x1eb866[_0xb27d('0x4b')]=_0x150434;return _0x1eb866;});}})[_0xb27d('0x27')](respondWithFilteredResult(_0x2b9267,_0x38b6dc))[_0xb27d('0x4c')](handleError(_0x2b9267,null));};exports[_0xb27d('0x6b')]=function(_0x292d86,_0x44252c,_0x14949c){var _0x35be72={'raw':!![],'where':{}};var _0x41de39={};var _0x5b59c2={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb27d('0x61')]({'where':{'id':_0x292d86['params']['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x44252c,null))[_0xb27d('0x27')](function(_0x1cf377){if(_0x1cf377){_0x41de39['model']=_[_0xb27d('0x3e')](db[_0xb27d('0x6c')][_0xb27d('0x3a')]);_0x41de39[_0xb27d('0x3d')]=_[_0xb27d('0x3e')](_0x292d86[_0xb27d('0x3d')]);_0x41de39[_0xb27d('0x4e')]=_[_0xb27d('0x5b')](_0x41de39[_0xb27d('0x3f')],_0x41de39[_0xb27d('0x3d')]);_0x35be72[_0xb27d('0x40')]=_['intersection'](_0x41de39[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0x292d86[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x35be72[_0xb27d('0x40')]=_0x35be72['attributes'][_0xb27d('0x42')]?_0x35be72[_0xb27d('0x40')]:_0x41de39['model'];if(!_0x292d86[_0xb27d('0x3d')][_0xb27d('0x67')](_0xb27d('0x62'))){_0x35be72[_0xb27d('0x20')]=qs[_0xb27d('0x20')](_0x292d86[_0xb27d('0x3d')][_0xb27d('0x20')]);_0x35be72['offset']=qs[_0xb27d('0x43')](_0x292d86[_0xb27d('0x3d')][_0xb27d('0x43')]);}_0x35be72[_0xb27d('0x44')]=qs['sort'](_0x292d86['query'][_0xb27d('0x45')]);_0x35be72['where']=qs[_0xb27d('0x4e')](_[_0xb27d('0x63')](_0x292d86['query'],_0x41de39[_0xb27d('0x4e')]));_0x35be72['where']['VoiceQueueId']=_0x1cf377['id'];if(_0x292d86[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0x35be72[_0xb27d('0x46')]=_[_0xb27d('0x47')](_0x35be72[_0xb27d('0x46')],{'$or':_['map'](_0x35be72[_0xb27d('0x40')],function(_0x5111c8){var _0x52197e={};_0x52197e[_0x5111c8]={'$like':'%'+_0x292d86[_0xb27d('0x3d')]['filter']+'%'};return _0x52197e;})});}_0x35be72=_[_0xb27d('0x47')]({},_0x35be72,_0x292d86[_0xb27d('0x49')]);return db['CmHopperBlack'][_0xb27d('0x21')]({'where':_0x35be72[_0xb27d('0x46')]})[_0xb27d('0x27')](function(_0x11c6e5){_0x5b59c2[_0xb27d('0x21')]=_0x11c6e5;if(_0x292d86['query'][_0xb27d('0x4f')]){_0x35be72[_0xb27d('0x5c')]=[{'all':!![]}];}return db[_0xb27d('0x6c')]['findAll'](_0x35be72);})['then'](function(_0x24c0ef){_0x5b59c2[_0xb27d('0x4b')]=_0x24c0ef;return _0x5b59c2;});}})['then'](respondWithFilteredResult(_0x44252c,_0x35be72))[_0xb27d('0x4c')](handleError(_0x44252c,null));};exports[_0xb27d('0x6d')]=function(_0xee823b,_0x324ac5,_0xcff08a){var _0x5083c0={};var _0x295c97={};var _0x5accaa;var _0x5def9e;return db['VoiceQueue'][_0xb27d('0x61')]({'where':{'id':_0xee823b['params']['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x324ac5,null))[_0xb27d('0x27')](function(_0x26fa3a){if(_0x26fa3a){_0x5accaa=_0x26fa3a;_0x295c97[_0xb27d('0x3f')]=_['keys'](db[_0xb27d('0x6e')]['rawAttributes']);_0x295c97['query']=_[_0xb27d('0x3e')](_0xee823b[_0xb27d('0x3d')]);_0x295c97[_0xb27d('0x4e')]=_[_0xb27d('0x5b')](_0x295c97[_0xb27d('0x3f')],_0x295c97[_0xb27d('0x3d')]);_0x5083c0[_0xb27d('0x40')]=_['intersection'](_0x295c97[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0xee823b['query'][_0xb27d('0x41')]));_0x5083c0[_0xb27d('0x40')]=_0x5083c0[_0xb27d('0x40')][_0xb27d('0x42')]?_0x5083c0[_0xb27d('0x40')]:_0x295c97[_0xb27d('0x3f')];_0x5083c0[_0xb27d('0x44')]=qs[_0xb27d('0x45')](_0xee823b[_0xb27d('0x3d')]['sort']);_0x5083c0['where']=qs[_0xb27d('0x4e')](_[_0xb27d('0x63')](_0xee823b['query'],_0x295c97[_0xb27d('0x4e')]));if(_0xee823b[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0x5083c0[_0xb27d('0x46')]=_['merge'](_0x5083c0['where'],{'$or':_[_0xb27d('0x2f')](_0x5083c0[_0xb27d('0x40')],function(_0x538afd){var _0x538c6a={};_0x538c6a[_0x538afd]={'$like':'%'+_0xee823b['query'][_0xb27d('0x2d')]+'%'};return _0x538c6a;})});}_0x5083c0=_[_0xb27d('0x47')]({},_0x5083c0,_0xee823b[_0xb27d('0x49')]);return _0x5accaa[_0xb27d('0x6d')](_0x5083c0);}})[_0xb27d('0x27')](function(_0x426448){if(_0x426448){_0x5def9e=_0x426448[_0xb27d('0x42')];if(!_0xee823b['query'][_0xb27d('0x67')]('nolimit')){_0x5083c0[_0xb27d('0x20')]=qs[_0xb27d('0x20')](_0xee823b[_0xb27d('0x3d')][_0xb27d('0x20')]);_0x5083c0[_0xb27d('0x43')]=qs[_0xb27d('0x43')](_0xee823b[_0xb27d('0x3d')][_0xb27d('0x43')]);}return _0x5accaa[_0xb27d('0x6d')](_0x5083c0);}})[_0xb27d('0x27')](function(_0x11d913){if(_0x11d913){return _0x11d913?{'count':_0x5def9e,'rows':_0x11d913}:null;}})[_0xb27d('0x27')](respondWithResult(_0x324ac5,null))[_0xb27d('0x4c')](handleError(_0x324ac5,null));};exports[_0xb27d('0x6f')]=function(_0x2e7b03,_0x5d6edf,_0x57e6d1){var _0x433cdb=_0x2e7b03[_0xb27d('0x51')][_0xb27d('0x70')];var _0x6b2f30=_[_0xb27d('0x2f')](_0x433cdb,'id');return db[_0xb27d('0x6e')][_0xb27d('0x4a')]({'where':{'id':_0x6b2f30},'attributes':['id'],'include':[{'model':db[_0xb27d('0x71')],'as':_0xb27d('0x72'),'attributes':['id','name',_0xb27d('0x73'),'voicePause','interface'],'raw':!![]}]})[_0xb27d('0x27')](function(_0xa81573){if(_0xa81573){var _0x211c7a=_[_0xb27d('0x74')](_0xa81573,function(_0x3603f3){var _0x2d4225=_0x3603f3[_0xb27d('0x29')]({'plain':!![]});_0x2d4225['Agents'][_0xb27d('0x75')](function(_0x4f7695){_0x4f7695[_0xb27d('0x76')]=_[_0xb27d('0x32')](_0x433cdb,{'id':_0x2d4225['id']})[_0xb27d('0x76')];});return _0x2d4225[_0xb27d('0x72')];});return db[_0xb27d('0x39')][_0xb27d('0x32')]({'where':{'id':_0x2e7b03[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](function(_0x13fe52){return db[_0xb27d('0x77')][_0xb27d('0x78')](function(_0x32b9d5){return _0x13fe52['addTeams'](_0x6b2f30,{'transaction':_0x32b9d5})[_0xb27d('0x27')](function(){return BPromise[_0xb27d('0x79')](_0x433cdb,function(_0x58856b){return db[_0xb27d('0x7a')][_0xb27d('0x7b')]({'TeamId':_0x58856b['id'],'VoiceQueueId':_0x2e7b03['params']['id'],'penalty':_0x58856b[_0xb27d('0x76')]},{'transaction':_0x32b9d5});});})[_0xb27d('0x27')](function(){return BPromise[_0xb27d('0x79')](_0x211c7a,function(_0x5a7a24){return db[_0xb27d('0x7c')][_0xb27d('0x7d')]({'where':{'UserId':_0x5a7a24['id'],'VoiceQueueId':_0x2e7b03['params']['id']},'defaults':{'penalty':_0x5a7a24[_0xb27d('0x76')]},'transaction':_0x32b9d5});});})[_0xb27d('0x27')](function(){return BPromise['each'](_[_0xb27d('0x2d')](_0x211c7a,{'online':!![]}),function(_0x553c38){return db[_0xb27d('0x7e')][_0xb27d('0x7b')]({'membername':_0x553c38[_0xb27d('0x33')],'UserId':_0x553c38['id'],'queue_name':_0x13fe52[_0xb27d('0x33')],'VoiceQueueId':_0x13fe52['id'],'interface':_[_0xb27d('0x7f')](_0x553c38[_0xb27d('0x80')])?util[_0xb27d('0x81')](_0xb27d('0x82'),_0x553c38[_0xb27d('0x33')]):_0x553c38[_0xb27d('0x80')],'paused':_0x553c38[_0xb27d('0x83')]||![],'penalty':_0x553c38[_0xb27d('0x76')]},{'transaction':_0x32b9d5});});})[_0xb27d('0x27')](function(){_0x211c7a['forEach'](function(_0x543189){socket[_0xb27d('0x84')](_0xb27d('0x85'),{'UserId':_0x543189['id'],'VoiceQueueId':_0x13fe52['id']});});});});});}})[_0xb27d('0x27')](respondWithStatusCode(_0x5d6edf,null))['catch'](handleError(_0x5d6edf,null));};exports[_0xb27d('0x86')]=function(_0x3c9de8,_0x3f41c8,_0xf25631){return db['Team'][_0xb27d('0x4a')]({'where':{'id':_0x3c9de8['query'][_0xb27d('0x87')]},'attributes':['id'],'include':[{'model':db[_0xb27d('0x71')],'as':_0xb27d('0x72'),'attributes':['id'],'raw':!![]}]})[_0xb27d('0x27')](handleEntityNotFound(_0x3f41c8,null))['then'](function(_0x3adc9a){var _0x4c7477=_[_0xb27d('0x2f')](_0x3adc9a,'id');var _0x379ced=[];var _0x194fd8=[];var _0x3fb4b3=squel['select']();_0x3fb4b3[_0xb27d('0x88')](_0xb27d('0x89'))['from']('team_has_voice_queues','tq')[_0xb27d('0x8a')]('user_has_teams','ut',_0xb27d('0x8b'))['where'](_0xb27d('0x8c'),_0x3c9de8[_0xb27d('0x4d')]['id']);for(var _0x30029d=0x0;_0x30029d<_0x3adc9a[_0xb27d('0x42')];_0x30029d+=0x1){let _0x49abd9=_0x3adc9a[_0x30029d];for(var _0x5bc15c=0x0;_0x5bc15c<_0x49abd9[_0xb27d('0x72')]['length'];_0x5bc15c+=0x1){let _0x5d64b9=_0x49abd9['Agents'][_0x5bc15c];var _0x3ac339=_0x3fb4b3['clone']();_0x3ac339['where']('ut.UserId\x20=\x20?',_0x5d64b9['id']);_0x194fd8['push'](db['sequelize'][_0xb27d('0x3d')](_0x3ac339[_0xb27d('0x8d')](),{'type':db[_0xb27d('0x77')][_0xb27d('0x8e')]['SELECT']})[_0xb27d('0x27')](function(_0x5d083b){if(_0x5d083b['length']===0x1){return _0x5d64b9['id'];}else{var _0x20252b=_['every'](_[_0xb27d('0x2f')](_0x5d083b,'TeamId'),function(_0x486fb0){return _[_0xb27d('0x8f')](_0x4c7477,_0x486fb0);});if(_0x20252b){return _0x5d64b9['id'];}}}));}}return BPromise[_0xb27d('0x90')](_0x194fd8)[_0xb27d('0x27')](function(_0x3f1abd){_0x379ced=_(_0x379ced)[_0xb27d('0x91')](_0x3f1abd)[_0xb27d('0x92')]()['value']();return db[_0xb27d('0x39')][_0xb27d('0x32')]({'where':{'id':_0x3c9de8[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](function(_0x167ac3){return db[_0xb27d('0x77')]['transaction'](function(_0x407f00){return _0x167ac3[_0xb27d('0x86')](_0x3c9de8['query']['ids'],{'transaction':_0x407f00})['then'](function(){if(!_[_0xb27d('0x93')](_0x379ced)){return _0x167ac3[_0xb27d('0x94')](_0x379ced,{'transaction':_0x407f00})[_0xb27d('0x27')](function(){return db[_0xb27d('0x7e')][_0xb27d('0x28')]({'where':{'VoiceQueueId':_0x3c9de8[_0xb27d('0x4d')]['id'],'UserId':_0x379ced},'transaction':_0x407f00});});}})[_0xb27d('0x27')](function(){_0x379ced['forEach'](function(_0xcccc9){socket[_0xb27d('0x84')](_0xb27d('0x95'),{'UserId':_0xcccc9,'VoiceQueueId':_0x167ac3['id']});});});});});});})['then'](respondWithStatusCode(_0x3f41c8,null))['catch'](handleError(_0x3f41c8,null));};exports['addAgents']=function(_0x2af39b,_0xe1baa0,_0x2b3192){var _0x392882,_0x3cff5d;return db[_0xb27d('0x39')][_0xb27d('0x32')]({'where':{'id':_0x2af39b[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0xe1baa0,null))['then'](function(_0x4e116c){if(_0x4e116c){_0x3cff5d=_0x4e116c;return _0x4e116c[_0xb27d('0x96')](_0x2af39b[_0xb27d('0x51')][_0xb27d('0x87')],_[_0xb27d('0x97')](_0x2af39b[_0xb27d('0x51')],[_0xb27d('0x87'),'id'])||{})[_0xb27d('0x98')](function(_0x460d22){for(var _0x30ab30=0x0;_0x30ab30<_0x2af39b['body'][_0xb27d('0x87')][_0xb27d('0x42')];_0x30ab30+=0x1){socket['emit'](_0xb27d('0x85'),{'UserId':Number(_0x2af39b[_0xb27d('0x51')][_0xb27d('0x87')][_0x30ab30]),'VoiceQueueId':Number(_0x2af39b[_0xb27d('0x4d')]['id'])});}return _0x460d22;});}})[_0xb27d('0x27')](function(_0x4b2332){_0x392882=_0x4b2332||[];if(_0x3cff5d){return db[_0xb27d('0x71')]['findAll']({'where':{'id':_0x2af39b[_0xb27d('0x51')]['ids']},'attributes':['id','name',_0xb27d('0x73'),_0xb27d('0x83'),_0xb27d('0x80')],'raw':!![]});}})[_0xb27d('0x27')](function(_0x1c206d){if(!_['isEmpty'](_0x1c206d)){var _0x362b70=[];for(var _0x594557=0x0;_0x594557<_0x1c206d[_0xb27d('0x42')];_0x594557++){if(_0x1c206d[_0x594557][_0xb27d('0x73')]){_0x362b70[_0xb27d('0x99')](db[_0xb27d('0x7e')][_0xb27d('0x7b')]({'membername':_0x1c206d[_0x594557][_0xb27d('0x33')],'UserId':_0x1c206d[_0x594557]['id'],'queue_name':_0x3cff5d[_0xb27d('0x33')],'VoiceQueueId':_0x3cff5d['id'],'interface':_[_0xb27d('0x7f')](_0x1c206d[_0x594557][_0xb27d('0x80')])?util[_0xb27d('0x81')](_0xb27d('0x82'),_0x1c206d[_0x594557][_0xb27d('0x33')]):_0x1c206d[_0x594557]['interface'],'paused':_0x1c206d[_0x594557]['voicePause']||![],'penalty':_0x2af39b['body'][_0xb27d('0x76')]||0x0}));}}return BPromise[_0xb27d('0x90')](_0x362b70);}})[_0xb27d('0x27')](function(){return _0x392882;})[_0xb27d('0x27')](respondWithResult(_0xe1baa0,null))['catch'](handleError(_0xe1baa0,null));};exports['removeAgents']=function(_0x2d1070,_0x5cfb5c,_0x118171){return db['VoiceQueue'][_0xb27d('0x32')]({'where':{'id':_0x2d1070['params']['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x5cfb5c,null))['then'](function(_0x3a3aa1){if(_0x3a3aa1){return _0x3a3aa1[_0xb27d('0x94')](_0x2d1070[_0xb27d('0x3d')][_0xb27d('0x87')])['then'](function(){if(_[_0xb27d('0x9a')](_0x2d1070['query'][_0xb27d('0x87')])){for(var _0x702585=0x0;_0x702585<_0x2d1070['query'][_0xb27d('0x87')][_0xb27d('0x42')];_0x702585+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x2d1070[_0xb27d('0x3d')][_0xb27d('0x87')][_0x702585]),'VoiceQueueId':Number(_0x2d1070[_0xb27d('0x4d')]['id'])});}}else{socket['emit'](_0xb27d('0x95'),{'UserId':Number(_0x2d1070[_0xb27d('0x3d')][_0xb27d('0x87')]),'VoiceQueueId':Number(_0x2d1070[_0xb27d('0x4d')]['id'])});}});}})[_0xb27d('0x27')](function(_0x3161cf){return db[_0xb27d('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x2d1070[_0xb27d('0x4d')]['id'],'UserId':_0x2d1070['query'][_0xb27d('0x87')]}})[_0xb27d('0x27')](function(){return _0x3161cf;});})[_0xb27d('0x27')](respondWithStatusCode(_0x5cfb5c,null))[_0xb27d('0x4c')](handleError(_0x5cfb5c,null));};exports[_0xb27d('0x9b')]=function(_0x4f510a,_0x68dbbf,_0x3e5580){var _0x5bf9f6={};var _0x4b6950={};var _0x238cc9;var _0x187773;return db[_0xb27d('0x39')]['findOne']({'where':{'id':_0x4f510a[_0xb27d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x68dbbf,null))[_0xb27d('0x27')](function(_0x1684ae){if(_0x1684ae){_0x238cc9=_0x1684ae;_0x4b6950[_0xb27d('0x3f')]=_['keys'](db[_0xb27d('0x71')][_0xb27d('0x3a')]);_0x4b6950[_0xb27d('0x3d')]=_[_0xb27d('0x3e')](_0x4f510a[_0xb27d('0x3d')]);_0x4b6950[_0xb27d('0x4e')]=_[_0xb27d('0x5b')](_0x4b6950[_0xb27d('0x3f')],_0x4b6950[_0xb27d('0x3d')]);_0x5bf9f6[_0xb27d('0x40')]=_[_0xb27d('0x5b')](_0x4b6950[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0x4f510a[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x5bf9f6['attributes']=_0x5bf9f6[_0xb27d('0x40')]['length']?_0x5bf9f6['attributes']:_0x4b6950[_0xb27d('0x3f')];_0x5bf9f6[_0xb27d('0x44')]=qs['sort'](_0x4f510a['query'][_0xb27d('0x45')]);_0x5bf9f6[_0xb27d('0x46')]=qs[_0xb27d('0x4e')](_['pick'](_0x4f510a['query'],_0x4b6950[_0xb27d('0x4e')]));if(_0x4f510a[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0x5bf9f6[_0xb27d('0x46')]=_[_0xb27d('0x47')](_0x5bf9f6[_0xb27d('0x46')],{'$or':_[_0xb27d('0x2f')](_0x5bf9f6[_0xb27d('0x40')],function(_0x445dea){var _0x4690a5={};_0x4690a5[_0x445dea]={'$like':'%'+_0x4f510a[_0xb27d('0x3d')][_0xb27d('0x2d')]+'%'};return _0x4690a5;})});}_0x5bf9f6=_[_0xb27d('0x47')]({},_0x5bf9f6,_0x4f510a[_0xb27d('0x49')]);return _0x238cc9[_0xb27d('0x9b')](_0x5bf9f6);}})[_0xb27d('0x27')](function(_0x412e80){if(_0x412e80){_0x187773=_0x412e80[_0xb27d('0x42')];if(!_0x4f510a['query'][_0xb27d('0x67')](_0xb27d('0x62'))){_0x5bf9f6['limit']=qs[_0xb27d('0x20')](_0x4f510a[_0xb27d('0x3d')]['limit']);_0x5bf9f6[_0xb27d('0x43')]=qs[_0xb27d('0x43')](_0x4f510a[_0xb27d('0x3d')][_0xb27d('0x43')]);}return _0x238cc9[_0xb27d('0x9b')](_0x5bf9f6);}})[_0xb27d('0x27')](function(_0x2577e4){if(_0x2577e4){return _0x2577e4?{'count':_0x187773,'rows':_0x2577e4}:null;}})[_0xb27d('0x27')](respondWithResult(_0x68dbbf,null))[_0xb27d('0x4c')](handleError(_0x68dbbf,null));};exports[_0xb27d('0x9c')]=function(_0x1fb6e9,_0xd07fa1,_0x19a7ec){var _0x69a298={};var _0x149dba={};var _0x55bb97;var _0x1d307c;return db[_0xb27d('0x39')][_0xb27d('0x61')]({'where':{'id':_0x1fb6e9[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0xd07fa1,null))['then'](function(_0x42accd){if(_0x42accd){_0x55bb97=_0x42accd;_0x149dba[_0xb27d('0x3f')]=_[_0xb27d('0x3e')](db['UserVoiceQueueRt']['rawAttributes']);_0x149dba[_0xb27d('0x3d')]=_['keys'](_0x1fb6e9[_0xb27d('0x3d')]);_0x149dba[_0xb27d('0x4e')]=_['intersection'](_0x149dba['model'],_0x149dba[_0xb27d('0x3d')]);_0x69a298[_0xb27d('0x40')]=_[_0xb27d('0x5b')](_0x149dba['model'],qs['fields'](_0x1fb6e9[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x69a298[_0xb27d('0x40')]=_0x69a298['attributes'][_0xb27d('0x42')]?_0x69a298[_0xb27d('0x40')]:_0x149dba[_0xb27d('0x3f')];_0x69a298[_0xb27d('0x44')]=qs[_0xb27d('0x45')](_0x1fb6e9['query'][_0xb27d('0x45')]);_0x69a298[_0xb27d('0x46')]=qs[_0xb27d('0x4e')](_[_0xb27d('0x63')](_0x1fb6e9['query'],_0x149dba[_0xb27d('0x4e')]));if(_0x1fb6e9[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0x69a298[_0xb27d('0x46')]=_['merge'](_0x69a298[_0xb27d('0x46')],{'$or':_[_0xb27d('0x2f')](_0x69a298[_0xb27d('0x40')],function(_0x2ce88e){var _0x1a2859={};_0x1a2859[_0x2ce88e]={'$like':'%'+_0x1fb6e9[_0xb27d('0x3d')][_0xb27d('0x2d')]+'%'};return _0x1a2859;})});}_0x69a298=_[_0xb27d('0x47')]({},_0x69a298,_0x1fb6e9[_0xb27d('0x49')]);return _0x55bb97[_0xb27d('0x9c')](_0x69a298);}})[_0xb27d('0x27')](function(_0x7b3bf8){if(_0x7b3bf8){_0x1d307c=_0x7b3bf8['length'];if(!_0x1fb6e9[_0xb27d('0x3d')]['hasOwnProperty']('nolimit')){_0x69a298[_0xb27d('0x20')]=qs[_0xb27d('0x20')](_0x1fb6e9[_0xb27d('0x3d')][_0xb27d('0x20')]);_0x69a298['offset']=qs[_0xb27d('0x43')](_0x1fb6e9[_0xb27d('0x3d')][_0xb27d('0x43')]);}return _0x55bb97['getMembers'](_0x69a298);}})['then'](function(_0x45bf07){return _0x45bf07?{'count':_0x1d307c,'rows':_0x45bf07}:null;})[_0xb27d('0x27')](respondWithResult(_0xd07fa1,null))[_0xb27d('0x4c')](handleError(_0xd07fa1,null));};exports[_0xb27d('0x9d')]=function(_0xef6b5c,_0x39ae50,_0x24416e){var _0x484315={};var _0x2a284d={};var _0x1ab880;var _0x57c31c;return db[_0xb27d('0x39')]['findOne']({'where':{'id':_0xef6b5c[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x39ae50,null))['then'](function(_0x2ea33c){if(_0x2ea33c){_0x1ab880=_0x2ea33c;_0x2a284d['model']=_[_0xb27d('0x3e')](db[_0xb27d('0x9e')]['rawAttributes']);_0x2a284d['query']=_[_0xb27d('0x3e')](_0xef6b5c[_0xb27d('0x3d')]);_0x2a284d[_0xb27d('0x4e')]=_['intersection'](_0x2a284d[_0xb27d('0x3f')],_0x2a284d[_0xb27d('0x3d')]);_0x484315['attributes']=_[_0xb27d('0x5b')](_0x2a284d[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0xef6b5c[_0xb27d('0x3d')][_0xb27d('0x41')]));_0x484315[_0xb27d('0x40')]=_0x484315['attributes'][_0xb27d('0x42')]?_0x484315[_0xb27d('0x40')]:_0x2a284d['model'];_0x484315[_0xb27d('0x44')]=qs[_0xb27d('0x45')](_0xef6b5c['query']['sort']);_0x484315[_0xb27d('0x46')]=qs[_0xb27d('0x4e')](_['pick'](_0xef6b5c['query'],_0x2a284d[_0xb27d('0x4e')]));if(_0xef6b5c[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0x484315['where']=_[_0xb27d('0x47')](_0x484315[_0xb27d('0x46')],{'$or':_[_0xb27d('0x2f')](_0x484315[_0xb27d('0x40')],function(_0x437811){var _0x45aeb6={};_0x45aeb6[_0x437811]={'$like':'%'+_0xef6b5c['query'][_0xb27d('0x2d')]+'%'};return _0x45aeb6;})});}_0x484315=_[_0xb27d('0x47')]({},_0x484315,_0xef6b5c['options']);return _0x1ab880['getLists'](_0x484315);}})['then'](function(_0xab01d3){if(_0xab01d3){_0x57c31c=_0xab01d3[_0xb27d('0x42')];if(!_0xef6b5c[_0xb27d('0x3d')][_0xb27d('0x67')](_0xb27d('0x62'))){_0x484315[_0xb27d('0x20')]=qs[_0xb27d('0x20')](_0xef6b5c[_0xb27d('0x3d')][_0xb27d('0x20')]);_0x484315['offset']=qs[_0xb27d('0x43')](_0xef6b5c[_0xb27d('0x3d')][_0xb27d('0x43')]);}return _0x1ab880['getLists'](_0x484315);}})[_0xb27d('0x27')](function(_0x428519){if(_0x428519){return _0x428519?{'count':_0x57c31c,'rows':_0x428519}:null;}})['then'](respondWithResult(_0x39ae50,null))[_0xb27d('0x4c')](handleError(_0x39ae50,null));};exports['addLists']=function(_0x126e2e,_0x4d9cb0,_0x3a0e00){var _0x483774,_0x41cd9a;return db[_0xb27d('0x39')][_0xb27d('0x32')]({'where':{'id':_0x126e2e['params']['id']}})['then'](handleEntityNotFound(_0x4d9cb0,null))[_0xb27d('0x27')](function(_0x1e717e){if(_0x1e717e){_0x41cd9a=_0x1e717e;return _0x1e717e[_0xb27d('0x9f')](_0x126e2e['body'][_0xb27d('0x87')],_[_0xb27d('0x97')](_0x126e2e['body'],[_0xb27d('0x87'),'id'])||{});}return null;})[_0xb27d('0x98')](function(_0xa1eba6){var _0x5ddb59;_0x483774=_0xa1eba6||[];var _0x2e599a=[];if(_0xa1eba6){for(var _0x196cee=0x0;_0x196cee<_0xa1eba6['length'];_0x196cee+=0x1){var _0x4fe62e=_0xa1eba6[_0x196cee]['get']({'plain':!![]});_0x41cd9a[_0xb27d('0xa0')]=_0x126e2e['body']['dialCheckDuplicateType']?_0x126e2e['body'][_0xb27d('0xa0')]:_0x41cd9a[_0xb27d('0xa0')];switch(_0x41cd9a['dialCheckDuplicateType']){case _0xb27d('0xa1'):_0x5ddb59=squel[_0xb27d('0xa2')]()['into'](_0xb27d('0xa3'))['fromQuery']([_0xb27d('0xa4'),'scheduledAt',_0xb27d('0xa5'),'ListId',_0xb27d('0x64'),'createdAt',_0xb27d('0x5e')],squel[_0xb27d('0xa6')]()['field'](_0xb27d('0xa4'),_0xb27d('0xa4'))[_0xb27d('0x88')]('NOW()','scheduledAt')['field']('id','ContactId')[_0xb27d('0x88')](_0x4fe62e[_0xb27d('0xa7')]['toString'](),_0xb27d('0xa8'))[_0xb27d('0x88')](_0x126e2e[_0xb27d('0x4d')]['id'][_0xb27d('0x8d')](),_0xb27d('0x64'))[_0xb27d('0x88')](_0xb27d('0xa9'),_0xb27d('0x5d'))['field'](_0xb27d('0xa9'),_0xb27d('0x5e'))[_0xb27d('0xaa')](_0xb27d('0xab'))[_0xb27d('0x46')](_0xb27d('0xac'))[_0xb27d('0x46')]('ListId\x20=\x20?',_0x4fe62e[_0xb27d('0xa7')][_0xb27d('0x8d')]())[_0xb27d('0x46')](_0xb27d('0xad'))[_0xb27d('0x46')](_0xb27d('0xae'),squel[_0xb27d('0xa6')]()[_0xb27d('0x88')](_0xb27d('0xaf'))[_0xb27d('0xaa')](_0xb27d('0xb0'))[_0xb27d('0x46')]('VoiceQueueId\x20=\x20?',_0x126e2e['params']['id'][_0xb27d('0x8d')]()))[_0xb27d('0x46')](_0xb27d('0xae'),squel[_0xb27d('0xa6')]()[_0xb27d('0x88')](_0xb27d('0xb1'))[_0xb27d('0xaa')]('cm_hopper')[_0xb27d('0x46')](_0xb27d('0x8c'),_0x126e2e[_0xb27d('0x4d')]['id'][_0xb27d('0x8d')]())))[_0xb27d('0x8d')]();break;case'onlyIfOpen':_0x5ddb59=squel[_0xb27d('0xa2')]()[_0xb27d('0xb2')](_0xb27d('0xa3'))[_0xb27d('0xb3')](['phone',_0xb27d('0xb4'),_0xb27d('0xa5'),_0xb27d('0xa8'),'VoiceQueueId','createdAt',_0xb27d('0x5e')],squel[_0xb27d('0xa6')]()[_0xb27d('0x88')](_0xb27d('0xa4'),_0xb27d('0xa4'))[_0xb27d('0x88')](_0xb27d('0xa9'),_0xb27d('0xb4'))[_0xb27d('0x88')]('id','ContactId')[_0xb27d('0x88')](_0x4fe62e['CmListId'][_0xb27d('0x8d')](),_0xb27d('0xa8'))[_0xb27d('0x88')](_0x126e2e[_0xb27d('0x4d')]['id'][_0xb27d('0x8d')](),_0xb27d('0x64'))[_0xb27d('0x88')]('NOW()','createdAt')['field'](_0xb27d('0xa9'),_0xb27d('0x5e'))[_0xb27d('0xaa')]('cm_contacts')[_0xb27d('0x46')](_0xb27d('0xac'))[_0xb27d('0x46')]('ListId\x20=\x20?',_0x4fe62e[_0xb27d('0xa7')]['toString']())[_0xb27d('0x46')](_0xb27d('0xad'))[_0xb27d('0x46')](_0xb27d('0xae'),squel[_0xb27d('0xa6')]()[_0xb27d('0x88')](_0xb27d('0xb1'))['from'](_0xb27d('0xa3'))['where'](_0xb27d('0x8c'),_0x126e2e[_0xb27d('0x4d')]['id'][_0xb27d('0x8d')]())))[_0xb27d('0x8d')]();break;default:_0x5ddb59=squel[_0xb27d('0xa2')]()[_0xb27d('0xb2')](_0xb27d('0xa3'))[_0xb27d('0xb3')](['phone',_0xb27d('0xb4'),'ContactId',_0xb27d('0xa8'),_0xb27d('0x64'),_0xb27d('0x5d'),_0xb27d('0x5e')],squel[_0xb27d('0xa6')]()['field'](_0xb27d('0xa4'),_0xb27d('0xa4'))[_0xb27d('0x88')](_0xb27d('0xa9'),_0xb27d('0xb4'))['field']('id',_0xb27d('0xa5'))['field'](_0x4fe62e['CmListId'][_0xb27d('0x8d')](),_0xb27d('0xa8'))[_0xb27d('0x88')](_0x126e2e[_0xb27d('0x4d')]['id'][_0xb27d('0x8d')](),'VoiceQueueId')[_0xb27d('0x88')]('NOW()',_0xb27d('0x5d'))[_0xb27d('0x88')](_0xb27d('0xa9'),_0xb27d('0x5e'))[_0xb27d('0xaa')](_0xb27d('0xab'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4fe62e['CmListId'][_0xb27d('0x8d')]())[_0xb27d('0x46')](_0xb27d('0xad')))[_0xb27d('0x8d')]();}_0x2e599a[_0xb27d('0x99')](db[_0xb27d('0x77')][_0xb27d('0x3d')](_0x5ddb59));}return BPromise[_0xb27d('0x90')](_0x2e599a);}})[_0xb27d('0x27')](function(){return _0x483774;})[_0xb27d('0x27')](respondWithResult(_0x4d9cb0,null))['catch'](handleError(_0x4d9cb0,null));};exports[_0xb27d('0xb5')]=function(_0x184c3d,_0x2271de,_0x343053){return db[_0xb27d('0x39')]['find']({'where':{'id':_0x184c3d[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x2271de,null))[_0xb27d('0x27')](function(_0x15b096){if(_0x15b096){return _0x15b096['removeLists'](_0x184c3d[_0xb27d('0x3d')][_0xb27d('0x87')]);}})['then'](function(_0x20e0a7){if(_0x20e0a7){return db[_0xb27d('0x65')][_0xb27d('0x28')]({'where':{'ListId':_0x184c3d[_0xb27d('0x3d')]['ids'],'VoiceQueueId':_0x184c3d[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](function(){return _0x20e0a7;});}})[_0xb27d('0x27')](respondWithStatusCode(_0x2271de,null))[_0xb27d('0x4c')](handleError(_0x2271de,null));};exports['getBlackLists']=function(_0x30c527,_0x3b1ba3,_0x21f4fe){var _0xfc6baf={};var _0x263684={};var _0xb6ef51;var _0x5e8863;return db[_0xb27d('0x39')]['findOne']({'where':{'id':_0x30c527['params']['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x3b1ba3,null))[_0xb27d('0x27')](function(_0x5ec306){if(_0x5ec306){_0xb6ef51=_0x5ec306;_0x263684['model']=_['keys'](db[_0xb27d('0x9e')][_0xb27d('0x3a')]);_0x263684[_0xb27d('0x3d')]=_['keys'](_0x30c527[_0xb27d('0x3d')]);_0x263684[_0xb27d('0x4e')]=_[_0xb27d('0x5b')](_0x263684[_0xb27d('0x3f')],_0x263684[_0xb27d('0x3d')]);_0xfc6baf['attributes']=_['intersection'](_0x263684[_0xb27d('0x3f')],qs[_0xb27d('0x41')](_0x30c527[_0xb27d('0x3d')][_0xb27d('0x41')]));_0xfc6baf[_0xb27d('0x40')]=_0xfc6baf['attributes']['length']?_0xfc6baf['attributes']:_0x263684[_0xb27d('0x3f')];_0xfc6baf['order']=qs['sort'](_0x30c527['query']['sort']);_0xfc6baf[_0xb27d('0x46')]=qs[_0xb27d('0x4e')](_[_0xb27d('0x63')](_0x30c527[_0xb27d('0x3d')],_0x263684['filters']));if(_0x30c527[_0xb27d('0x3d')][_0xb27d('0x2d')]){_0xfc6baf['where']=_[_0xb27d('0x47')](_0xfc6baf[_0xb27d('0x46')],{'$or':_[_0xb27d('0x2f')](_0xfc6baf[_0xb27d('0x40')],function(_0x45e3af){var _0x5aecc9={};_0x5aecc9[_0x45e3af]={'$like':'%'+_0x30c527[_0xb27d('0x3d')][_0xb27d('0x2d')]+'%'};return _0x5aecc9;})});}_0xfc6baf=_[_0xb27d('0x47')]({},_0xfc6baf,_0x30c527['options']);return _0xb6ef51['getBlackLists'](_0xfc6baf);}})[_0xb27d('0x27')](function(_0x4e1159){if(_0x4e1159){_0x5e8863=_0x4e1159[_0xb27d('0x42')];if(!_0x30c527[_0xb27d('0x3d')][_0xb27d('0x67')](_0xb27d('0x62'))){_0xfc6baf['limit']=qs[_0xb27d('0x20')](_0x30c527[_0xb27d('0x3d')][_0xb27d('0x20')]);_0xfc6baf['offset']=qs[_0xb27d('0x43')](_0x30c527[_0xb27d('0x3d')]['offset']);}return _0xb6ef51['getBlackLists'](_0xfc6baf);}})[_0xb27d('0x27')](function(_0x409ba3){if(_0x409ba3){return _0x409ba3?{'count':_0x5e8863,'rows':_0x409ba3}:null;}})[_0xb27d('0x27')](respondWithResult(_0x3b1ba3,null))['catch'](handleError(_0x3b1ba3,null));};exports[_0xb27d('0xb6')]=function(_0x5788fb,_0x1ab9e3,_0x2ff421){var _0x5ce138,_0x366151;return db['VoiceQueue'][_0xb27d('0x32')]({'where':{'id':_0x5788fb[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x1ab9e3,null))[_0xb27d('0x27')](function(_0x2ef7ec){if(_0x2ef7ec){_0x366151=_0x2ef7ec;return _0x2ef7ec[_0xb27d('0xb6')](_0x5788fb['body'][_0xb27d('0x87')],_['omit'](_0x5788fb[_0xb27d('0x51')],[_0xb27d('0x87'),'id'])||{});}return null;})[_0xb27d('0x98')](function(_0x25d155){var _0x151a6d;_0x5ce138=_0x25d155||[];var _0x1d913e=[];if(_0x25d155){for(var _0x196683=0x0;_0x196683<_0x25d155[_0xb27d('0x42')];_0x196683+=0x1){var _0x3bec4f=_0x25d155[_0x196683][_0xb27d('0x29')]({'plain':!![]});_0x151a6d=squel['insert']()[_0xb27d('0xb2')](_0xb27d('0xb7'))['fromQuery']([_0xb27d('0xa4'),'ContactId',_0xb27d('0xa8'),_0xb27d('0x64'),_0xb27d('0x5d'),'updatedAt'],squel['select']()[_0xb27d('0x88')](_0xb27d('0xa4'),_0xb27d('0xa4'))[_0xb27d('0x88')]('id',_0xb27d('0xa5'))[_0xb27d('0x88')](_0x3bec4f[_0xb27d('0xa7')][_0xb27d('0x8d')](),_0xb27d('0xa8'))['field'](_0x5788fb[_0xb27d('0x4d')]['id'][_0xb27d('0x8d')](),_0xb27d('0x64'))[_0xb27d('0x88')]('NOW()',_0xb27d('0x5d'))[_0xb27d('0x88')](_0xb27d('0xa9'),_0xb27d('0x5e'))[_0xb27d('0xaa')](_0xb27d('0xab'))[_0xb27d('0x46')](_0xb27d('0xac'))[_0xb27d('0x46')](_0xb27d('0xb8'),_0x3bec4f[_0xb27d('0xa7')][_0xb27d('0x8d')]())[_0xb27d('0x46')](_0xb27d('0xad')))['toString']();_0x1d913e[_0xb27d('0x99')](db['sequelize'][_0xb27d('0x3d')](_0x151a6d));}return BPromise['all'](_0x1d913e);}})[_0xb27d('0x27')](function(){return _0x5ce138;})[_0xb27d('0x27')](respondWithResult(_0x1ab9e3,null))['catch'](handleError(_0x1ab9e3,null));};exports[_0xb27d('0xb9')]=function(_0x401eeb,_0x1c9259,_0x520831){return db[_0xb27d('0x39')][_0xb27d('0x32')]({'where':{'id':_0x401eeb[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](handleEntityNotFound(_0x1c9259,null))[_0xb27d('0x27')](function(_0x40a37a){if(_0x40a37a){return _0x40a37a[_0xb27d('0xb9')](_0x401eeb[_0xb27d('0x3d')][_0xb27d('0x87')]);}})[_0xb27d('0x27')](function(_0x234e89){if(_0x234e89){return db[_0xb27d('0x6c')][_0xb27d('0x28')]({'where':{'ListId':_0x401eeb[_0xb27d('0x3d')][_0xb27d('0x87')],'VoiceQueueId':_0x401eeb[_0xb27d('0x4d')]['id']}})[_0xb27d('0x27')](function(){return _0x234e89;});}})[_0xb27d('0x27')](respondWithStatusCode(_0x1c9259,null))['catch'](handleError(_0x1c9259,null));}; \ No newline at end of file +var _0x71a9=['map','value','includes','type','find','UserProfileResource','end','sendStatus','stack','name','index','VoiceQueue','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','userProfileId','update','CmHopper','nolimit','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','User','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','ids','userVoiceQueue:save','all','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','phone','NOW()','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','status','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore'];(function(_0x506e7e,_0x2882ee){var _0x5d7e24=function(_0x31ca07){while(--_0x31ca07){_0x506e7e['push'](_0x506e7e['shift']());}};_0x5d7e24(++_0x2882ee);}(_0x71a9,0x14a));var _0x971a=function(_0x35e6fa,_0x21a7aa){_0x35e6fa=_0x35e6fa-0x0;var _0x44d431=_0x71a9[_0x35e6fa];return _0x44d431;};'use strict';var emlformat=require(_0x971a('0x0'));var rimraf=require(_0x971a('0x1'));var zipdir=require(_0x971a('0x2'));var jsonpatch=require(_0x971a('0x3'));var rp=require(_0x971a('0x4'));var moment=require(_0x971a('0x5'));var BPromise=require(_0x971a('0x6'));var Mustache=require(_0x971a('0x7'));var util=require('util');var path=require(_0x971a('0x8'));var sox=require('sox');var csv=require(_0x971a('0x9'));var ejs=require(_0x971a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x971a('0xb'));var squel=require('squel');var crypto=require(_0x971a('0xc'));var jsforce=require(_0x971a('0xd'));var deskjs=require(_0x971a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x971a('0xf'));var Papa=require(_0x971a('0x10'));var Redis=require(_0x971a('0x11'));var authService=require(_0x971a('0x12'));var qs=require(_0x971a('0x13'));var as=require(_0x971a('0x14'));var hardwareService=require(_0x971a('0x15'));var logger=require(_0x971a('0x16'))(_0x971a('0x17'));var utils=require('../../config/utils');var config=require(_0x971a('0x18'));var licenseUtil=require(_0x971a('0x19'));var db=require(_0x971a('0x1a'))['db'];config[_0x971a('0x1b')]=_[_0x971a('0x1c')](config[_0x971a('0x1b')],{'host':_0x971a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x971a('0x1e'))[_0x971a('0x1f')](socket);function respondWithStatusCode(_0x55e003,_0x4ad688){_0x4ad688=_0x4ad688||0xcc;return function(_0x200bff){if(_0x200bff){return _0x55e003['sendStatus'](_0x4ad688);}return _0x55e003[_0x971a('0x20')](_0x4ad688)['end']();};}function respondWithResult(_0x30b144,_0x3a6c42){_0x3a6c42=_0x3a6c42||0xc8;return function(_0x207ab1){if(_0x207ab1){return _0x30b144[_0x971a('0x20')](_0x3a6c42)[_0x971a('0x21')](_0x207ab1);}};}function respondWithFilteredResult(_0x4a68b7,_0x5de42a){return function(_0x413e61){if(_0x413e61){var _0x557a19=typeof _0x5de42a[_0x971a('0x22')]==='undefined'&&typeof _0x5de42a[_0x971a('0x23')]==='undefined';var _0x28f3f3=_0x413e61[_0x971a('0x24')];var _0x4b1932=_0x557a19?0x0:_0x5de42a[_0x971a('0x22')];var _0x96d34b=_0x557a19?_0x413e61[_0x971a('0x24')]:_0x5de42a[_0x971a('0x22')]+_0x5de42a['limit'];var _0x18fe5f;if(_0x96d34b>=_0x28f3f3){_0x96d34b=_0x28f3f3;_0x18fe5f=0xc8;}else{_0x18fe5f=0xce;}_0x4a68b7[_0x971a('0x20')](_0x18fe5f);return _0x4a68b7[_0x971a('0x25')](_0x971a('0x26'),_0x4b1932+'-'+_0x96d34b+'/'+_0x28f3f3)['json'](_0x413e61);}return null;};}function patchUpdates(_0x4b7ab5){return function(_0x468a24){try{jsonpatch[_0x971a('0x27')](_0x468a24,_0x4b7ab5,!![]);}catch(_0x1acaab){return BPromise['reject'](_0x1acaab);}return _0x468a24[_0x971a('0x28')]();};}function saveUpdates(_0x42ee1e,_0x3b7b9e){return function(_0x49bf1c){if(_0x49bf1c){return _0x49bf1c['update'](_0x42ee1e)[_0x971a('0x29')](function(_0x487e9d){return _0x487e9d;});}return null;};}function removeEntity(_0x53b124,_0x4ff605){return function(_0x3e297f){if(_0x3e297f){return _0x3e297f[_0x971a('0x2a')]()[_0x971a('0x29')](function(){var _0x442389=_0x3e297f[_0x971a('0x2b')]({'plain':!![]});var _0x562e23=[{'name':_0x971a('0x2c'),'value':_0x971a('0x2d'),'ignore':![]},{'name':_0x971a('0x2e'),'value':_0x971a('0x2f'),'ignore':![]}];var _0x58d6ae=_(_0x562e23)[_0x971a('0x30')](_0x971a('0x31'))[_0x971a('0x32')]('value')[_0x971a('0x33')]();if(_[_0x971a('0x34')](_0x58d6ae,_0x442389[_0x971a('0x35')])){return;}var _0x3180be=_[_0x971a('0x36')](_0x562e23,[_0x971a('0x33'),_0x442389[_0x971a('0x35')]])['name'];return db[_0x971a('0x37')][_0x971a('0x2a')]({'where':{'type':_0x3180be,'resourceId':_0x442389['id']}})['then'](function(){return _0x3e297f;});})[_0x971a('0x29')](function(){_0x53b124[_0x971a('0x20')](0xcc)[_0x971a('0x38')]();});}};}function handleEntityNotFound(_0x307e53,_0x3be5dd){return function(_0x48ffa8){if(!_0x48ffa8){_0x307e53[_0x971a('0x39')](0x194);}return _0x48ffa8;};}function handleError(_0x1a325f,_0xc3abbe){_0xc3abbe=_0xc3abbe||0x1f4;return function(_0x5b240b){logger['error'](_0x5b240b[_0x971a('0x3a')]);if(_0x5b240b['name']){delete _0x5b240b[_0x971a('0x3b')];}_0x1a325f[_0x971a('0x20')](_0xc3abbe)['send'](_0x5b240b);};}exports[_0x971a('0x3c')]=function(_0x39f98f,_0x32276a){var _0x507d0a={},_0x5027e7={},_0x150934={'count':0x0,'rows':[]};var _0x45158c=_[_0x971a('0x32')](db[_0x971a('0x3d')][_0x971a('0x3e')],function(_0x30b71b){return{'name':_0x30b71b[_0x971a('0x3f')],'type':_0x30b71b[_0x971a('0x35')]['key']};});_0x5027e7['model']=_[_0x971a('0x32')](_0x45158c,_0x971a('0x3b'));_0x5027e7[_0x971a('0x40')]=_[_0x971a('0x41')](_0x39f98f[_0x971a('0x40')]);_0x5027e7[_0x971a('0x42')]=_[_0x971a('0x43')](_0x5027e7[_0x971a('0x44')],_0x5027e7['query']);_0x507d0a[_0x971a('0x45')]=_['intersection'](_0x5027e7[_0x971a('0x44')],qs['fields'](_0x39f98f['query'][_0x971a('0x46')]));_0x507d0a[_0x971a('0x45')]=_0x507d0a[_0x971a('0x45')][_0x971a('0x47')]?_0x507d0a[_0x971a('0x45')]:_0x5027e7['model'];if(!_0x39f98f[_0x971a('0x40')][_0x971a('0x48')]('nolimit')){_0x507d0a[_0x971a('0x23')]=qs[_0x971a('0x23')](_0x39f98f[_0x971a('0x40')][_0x971a('0x23')]);_0x507d0a[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x39f98f[_0x971a('0x40')][_0x971a('0x22')]);}_0x507d0a[_0x971a('0x49')]=qs[_0x971a('0x4a')](_0x39f98f[_0x971a('0x40')][_0x971a('0x4a')]);_0x507d0a[_0x971a('0x4b')]=qs[_0x971a('0x42')](_[_0x971a('0x4c')](_0x39f98f[_0x971a('0x40')],_0x5027e7[_0x971a('0x42')]),_0x45158c);if(_0x39f98f[_0x971a('0x40')][_0x971a('0x30')]){_0x507d0a[_0x971a('0x4b')]=_[_0x971a('0x4d')](_0x507d0a[_0x971a('0x4b')],{'$or':_['map'](_0x45158c,function(_0x4243a5){if(_0x4243a5[_0x971a('0x35')]!==_0x971a('0x4e')){var _0x1678d2={};_0x1678d2[_0x4243a5[_0x971a('0x3b')]]={'$like':'%'+_0x39f98f['query'][_0x971a('0x30')]+'%'};return _0x1678d2;}})});}_0x507d0a=_['merge']({},_0x507d0a,_0x39f98f[_0x971a('0x4f')]);var _0x37330a={'where':_0x507d0a['where']};return db[_0x971a('0x3d')][_0x971a('0x24')](_0x37330a)[_0x971a('0x29')](function(_0x547b59){_0x150934[_0x971a('0x24')]=_0x547b59;if(_0x39f98f[_0x971a('0x40')][_0x971a('0x50')]){_0x507d0a[_0x971a('0x51')]=[{'all':!![]}];}return db[_0x971a('0x3d')][_0x971a('0x52')](_0x507d0a);})[_0x971a('0x29')](function(_0x258d2d){_0x150934[_0x971a('0x53')]=_0x258d2d;return _0x150934;})['then'](respondWithFilteredResult(_0x32276a,_0x507d0a))[_0x971a('0x54')](handleError(_0x32276a,null));};exports[_0x971a('0x55')]=function(_0x52e6ed,_0x6f56e){var _0x19aed8={'raw':![],'where':{'id':_0x52e6ed[_0x971a('0x56')]['id']}},_0x46ca1c={};_0x46ca1c[_0x971a('0x44')]=_[_0x971a('0x41')](db[_0x971a('0x3d')][_0x971a('0x3e')]);_0x46ca1c['query']=_[_0x971a('0x41')](_0x52e6ed[_0x971a('0x40')]);_0x46ca1c[_0x971a('0x42')]=_[_0x971a('0x43')](_0x46ca1c['model'],_0x46ca1c[_0x971a('0x40')]);_0x19aed8[_0x971a('0x45')]=_['intersection'](_0x46ca1c[_0x971a('0x44')],qs[_0x971a('0x46')](_0x52e6ed['query']['fields']));_0x19aed8[_0x971a('0x45')]=_0x19aed8[_0x971a('0x45')][_0x971a('0x47')]?_0x19aed8[_0x971a('0x45')]:_0x46ca1c['model'];if(_0x52e6ed[_0x971a('0x40')][_0x971a('0x50')]){_0x19aed8[_0x971a('0x51')]=[{'all':!![]}];}_0x19aed8=_[_0x971a('0x4d')]({},_0x19aed8,_0x52e6ed[_0x971a('0x4f')]);return db[_0x971a('0x3d')]['find'](_0x19aed8)[_0x971a('0x29')](handleEntityNotFound(_0x6f56e,null))['then'](respondWithResult(_0x6f56e,null))[_0x971a('0x54')](handleError(_0x6f56e,null));};exports[_0x971a('0x57')]=function(_0xab41a7,_0x1ebea2){return db[_0x971a('0x3d')][_0x971a('0x57')](_0xab41a7['body'],{})[_0x971a('0x29')](function(_0x5379bd){var _0x5c068b=_0xab41a7[_0x971a('0x58')]['get']({'plain':!![]});if(!_0x5c068b)throw new Error(_0x971a('0x59'));if(_0x5c068b[_0x971a('0x5a')]===_0x971a('0x58')){var _0x56ed3a=_0x5379bd[_0x971a('0x2b')]({'plain':!![]});var _0x3e1faa=[{'name':'VoiceQueues','value':_0x971a('0x2d')},{'name':_0x971a('0x2e'),'value':_0x971a('0x2f')}];var _0x3980ec=_[_0x971a('0x36')](_0x3e1faa,[_0x971a('0x33'),_0x56ed3a['type']])['name'];return db['UserProfileSection'][_0x971a('0x36')]({'where':{'name':_0x3980ec,'userProfileId':_0x5c068b['userProfileId']},'raw':!![]})[_0x971a('0x29')](function(_0x4ea9ed){if(_0x4ea9ed&&_0x4ea9ed[_0x971a('0x5b')]===0x0){return db['UserProfileResource'][_0x971a('0x57')]({'name':_0x56ed3a['name'],'resourceId':_0x56ed3a['id'],'type':_0x4ea9ed[_0x971a('0x3b')],'sectionId':_0x4ea9ed['id']},{})[_0x971a('0x29')](function(){return _0x5379bd;});}else{return _0x5379bd;}})['catch'](function(_0x183a9b){logger[_0x971a('0x5c')](_0x971a('0x5d'),_0x183a9b);throw _0x183a9b;});}return _0x5379bd;})[_0x971a('0x29')](respondWithResult(_0x1ebea2,0xc9))[_0x971a('0x54')](handleError(_0x1ebea2,null));};exports[_0x971a('0x5e')]=function(_0x1450f1,_0x223027){var _0x536d05={'where':{'id':_0x1450f1['params']['id']}},_0x1cb340={};_0x1cb340['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0x536d05[_0x971a('0x45')]=_[_0x971a('0x43')](_0x1cb340[_0x971a('0x44')],qs[_0x971a('0x46')](_0x1450f1[_0x971a('0x40')][_0x971a('0x46')]));_0x536d05[_0x971a('0x45')]=_0x536d05[_0x971a('0x45')][_0x971a('0x47')]?_0x536d05[_0x971a('0x45')]:_0x1cb340[_0x971a('0x44')];if(_0x1450f1[_0x971a('0x40')][_0x971a('0x50')]){_0x536d05[_0x971a('0x51')]=[{'all':!![]}];}_0x536d05=_[_0x971a('0x4d')]({},_0x536d05,_0x1450f1[_0x971a('0x4f')]);return db[_0x971a('0x3d')][_0x971a('0x36')](_0x536d05)[_0x971a('0x29')](handleEntityNotFound(_0x223027,null))['then'](function(_0x27ee33){if(_0x27ee33){var _0x531708=_0x27ee33[_0x971a('0x2b')]({'plain':!![]});_0x531708=qs[_0x971a('0x5f')](_0x531708,['id',_0x971a('0x60'),_0x971a('0x61')]);_0x1450f1[_0x971a('0x62')]=_[_0x971a('0x5f')](_0x1450f1[_0x971a('0x62')],['id',_0x971a('0x60'),_0x971a('0x61')]);return db[_0x971a('0x3d')][_0x971a('0x57')](_[_0x971a('0x4d')](_0x531708,_0x1450f1[_0x971a('0x62')]),{'include':_0x1450f1[_0x971a('0x40')]['includeAll']?[{'all':!![]}]:undefined})[_0x971a('0x29')](function(_0x591463){var _0x18a481=_0x1450f1[_0x971a('0x58')]['get']({'plain':!![]});if(!_0x18a481)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18a481[_0x971a('0x5a')]==='user'){var _0x499484=_0x591463[_0x971a('0x2b')]({'plain':!![]});var _0x5928a5=[{'name':_0x971a('0x2c'),'value':_0x971a('0x2d')},{'name':_0x971a('0x2e'),'value':_0x971a('0x2f')}];var _0xc8c10f=_['find'](_0x5928a5,[_0x971a('0x33'),_0x499484[_0x971a('0x35')]])[_0x971a('0x3b')];return db['UserProfileSection'][_0x971a('0x36')]({'where':{'name':_0xc8c10f,'userProfileId':_0x18a481[_0x971a('0x63')]},'raw':!![]})['then'](function(_0x5a2728){if(_0x5a2728&&_0x5a2728[_0x971a('0x5b')]===0x0){return db[_0x971a('0x37')][_0x971a('0x57')]({'name':_0x499484[_0x971a('0x3b')],'resourceId':_0x499484['id'],'type':_0x5a2728[_0x971a('0x3b')],'sectionId':_0x5a2728['id']},{})[_0x971a('0x29')](function(){return _0x591463;});}else{return _0x591463;}})[_0x971a('0x54')](function(_0x1a7576){logger['error'](_0x971a('0x5d'),_0x1a7576);throw _0x1a7576;});}return _0x591463;});}})['then'](respondWithResult(_0x223027,0xc9))[_0x971a('0x54')](handleError(_0x223027,null));};exports[_0x971a('0x64')]=function(_0x37636e,_0x211152){if(_0x37636e[_0x971a('0x62')]['id']){delete _0x37636e[_0x971a('0x62')]['id'];}return db['VoiceQueue'][_0x971a('0x36')]({'where':{'id':_0x37636e[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x211152,null))[_0x971a('0x29')](saveUpdates(_0x37636e[_0x971a('0x62')],null))['then'](respondWithResult(_0x211152,null))[_0x971a('0x54')](handleError(_0x211152,null));};exports[_0x971a('0x2a')]=function(_0x45cca0,_0x4b92ec){return db['VoiceQueue']['find']({'where':{'id':_0x45cca0[_0x971a('0x56')]['id']}})['then'](handleEntityNotFound(_0x4b92ec,null))['then'](removeEntity(_0x4b92ec,null))['catch'](handleError(_0x4b92ec,null));};exports['getHoppers']=function(_0x5aafc5,_0x553db4,_0x2da801){var _0x24fd22={'raw':![],'where':{}};var _0x37dffc={};var _0x4a1065={'count':0x0,'rows':[]};return db[_0x971a('0x3d')]['findOne']({'where':{'id':_0x5aafc5[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x553db4,null))[_0x971a('0x29')](function(_0x49af2d){if(_0x49af2d){_0x37dffc[_0x971a('0x44')]=_['keys'](db[_0x971a('0x65')][_0x971a('0x3e')]);_0x37dffc[_0x971a('0x40')]=_[_0x971a('0x41')](_0x5aafc5[_0x971a('0x40')]);_0x37dffc['filters']=_[_0x971a('0x43')](_0x37dffc[_0x971a('0x44')],_0x37dffc[_0x971a('0x40')]);_0x24fd22[_0x971a('0x45')]=_[_0x971a('0x43')](_0x37dffc['model'],qs[_0x971a('0x46')](_0x5aafc5['query'][_0x971a('0x46')]));_0x24fd22[_0x971a('0x45')]=_0x24fd22[_0x971a('0x45')][_0x971a('0x47')]?_0x24fd22[_0x971a('0x45')]:_0x37dffc[_0x971a('0x44')];if(!_0x5aafc5[_0x971a('0x40')][_0x971a('0x48')](_0x971a('0x66'))){_0x24fd22[_0x971a('0x23')]=qs['limit'](_0x5aafc5[_0x971a('0x40')]['limit']);_0x24fd22['offset']=qs['offset'](_0x5aafc5[_0x971a('0x40')][_0x971a('0x22')]);}_0x24fd22['order']=qs['sort'](_0x5aafc5['query'][_0x971a('0x4a')]);_0x24fd22['where']=qs[_0x971a('0x42')](_[_0x971a('0x4c')](_0x5aafc5[_0x971a('0x40')],_0x37dffc[_0x971a('0x42')]));_0x24fd22[_0x971a('0x4b')]['VoiceQueueId']=_0x49af2d['id'];if(_0x5aafc5['query'][_0x971a('0x30')]){_0x24fd22[_0x971a('0x4b')]=_[_0x971a('0x4d')](_0x24fd22['where'],{'$or':_[_0x971a('0x32')](_0x24fd22['attributes'],function(_0x559b27){var _0x4a162b={};_0x4a162b[_0x559b27]={'$like':'%'+_0x5aafc5['query']['filter']+'%'};return _0x4a162b;})});}_0x24fd22=_[_0x971a('0x4d')]({},_0x24fd22,_0x5aafc5['options']);return db[_0x971a('0x65')][_0x971a('0x24')]({'where':_0x24fd22[_0x971a('0x4b')]})['then'](function(_0x2b57e3){_0x4a1065[_0x971a('0x24')]=_0x2b57e3;if(_0x5aafc5[_0x971a('0x40')][_0x971a('0x50')]){_0x24fd22[_0x971a('0x51')]=[{'all':!![]}];}return db[_0x971a('0x65')][_0x971a('0x52')](_0x24fd22);})['then'](function(_0x5cc561){_0x4a1065[_0x971a('0x53')]=_0x5cc561;return _0x4a1065;});}})[_0x971a('0x29')](respondWithFilteredResult(_0x553db4,_0x24fd22))[_0x971a('0x54')](handleError(_0x553db4,null));};exports[_0x971a('0x67')]=function(_0x4de0d2,_0x537221,_0x4b1bed){var _0x3e15b5={'raw':!![],'where':{}};var _0x580d71={};var _0x428186={'count':0x0,'rows':[]};return db[_0x971a('0x3d')][_0x971a('0x68')]({'where':{'id':_0x4de0d2['params']['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x537221,null))[_0x971a('0x29')](function(_0x4607ee){if(_0x4607ee){_0x580d71[_0x971a('0x44')]=_[_0x971a('0x41')](db[_0x971a('0x69')][_0x971a('0x3e')]);_0x580d71['query']=_[_0x971a('0x41')](_0x4de0d2['query']);_0x580d71[_0x971a('0x42')]=_['intersection'](_0x580d71[_0x971a('0x44')],_0x580d71['query']);_0x3e15b5[_0x971a('0x45')]=_['intersection'](_0x580d71[_0x971a('0x44')],qs[_0x971a('0x46')](_0x4de0d2[_0x971a('0x40')][_0x971a('0x46')]));_0x3e15b5[_0x971a('0x45')]=_0x3e15b5[_0x971a('0x45')][_0x971a('0x47')]?_0x3e15b5['attributes']:_0x580d71[_0x971a('0x44')];if(!_0x4de0d2[_0x971a('0x40')][_0x971a('0x48')]('nolimit')){_0x3e15b5[_0x971a('0x23')]=qs[_0x971a('0x23')](_0x4de0d2[_0x971a('0x40')][_0x971a('0x23')]);_0x3e15b5[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x4de0d2[_0x971a('0x40')][_0x971a('0x22')]);}_0x3e15b5['order']=qs[_0x971a('0x4a')](_0x4de0d2[_0x971a('0x40')][_0x971a('0x4a')]);_0x3e15b5[_0x971a('0x4b')]=qs[_0x971a('0x42')](_[_0x971a('0x4c')](_0x4de0d2[_0x971a('0x40')],_0x580d71[_0x971a('0x42')]));_0x3e15b5[_0x971a('0x4b')][_0x971a('0x6a')]=_0x4607ee['id'];if(_0x4de0d2['query'][_0x971a('0x30')]){_0x3e15b5[_0x971a('0x4b')]=_[_0x971a('0x4d')](_0x3e15b5[_0x971a('0x4b')],{'$or':_['map'](_0x3e15b5[_0x971a('0x45')],function(_0x477819){var _0x29b3d4={};_0x29b3d4[_0x477819]={'$like':'%'+_0x4de0d2['query'][_0x971a('0x30')]+'%'};return _0x29b3d4;})});}_0x3e15b5=_['merge']({},_0x3e15b5,_0x4de0d2[_0x971a('0x4f')]);return db[_0x971a('0x69')][_0x971a('0x24')]({'where':_0x3e15b5[_0x971a('0x4b')]})['then'](function(_0x537538){_0x428186['count']=_0x537538;if(_0x4de0d2['query'][_0x971a('0x50')]){_0x3e15b5[_0x971a('0x51')]=[{'all':!![]}];}return db[_0x971a('0x69')][_0x971a('0x52')](_0x3e15b5);})[_0x971a('0x29')](function(_0x11427b){_0x428186[_0x971a('0x53')]=_0x11427b;return _0x428186;});}})[_0x971a('0x29')](respondWithFilteredResult(_0x537221,_0x3e15b5))[_0x971a('0x54')](handleError(_0x537221,null));};exports[_0x971a('0x6b')]=function(_0x2aa466,_0x1dfc16,_0x2d8f02){var _0x280f93={'raw':!![],'where':{}};var _0x561fb8={};var _0x3dbc5b={'count':0x0,'rows':[]};return db[_0x971a('0x3d')][_0x971a('0x68')]({'where':{'id':_0x2aa466['params']['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x1dfc16,null))[_0x971a('0x29')](function(_0x21c89e){if(_0x21c89e){_0x561fb8[_0x971a('0x44')]=_[_0x971a('0x41')](db[_0x971a('0x6c')][_0x971a('0x3e')]);_0x561fb8[_0x971a('0x40')]=_[_0x971a('0x41')](_0x2aa466[_0x971a('0x40')]);_0x561fb8[_0x971a('0x42')]=_[_0x971a('0x43')](_0x561fb8['model'],_0x561fb8['query']);_0x280f93['attributes']=_[_0x971a('0x43')](_0x561fb8[_0x971a('0x44')],qs[_0x971a('0x46')](_0x2aa466['query'][_0x971a('0x46')]));_0x280f93[_0x971a('0x45')]=_0x280f93['attributes'][_0x971a('0x47')]?_0x280f93['attributes']:_0x561fb8[_0x971a('0x44')];if(!_0x2aa466[_0x971a('0x40')][_0x971a('0x48')](_0x971a('0x66'))){_0x280f93['limit']=qs[_0x971a('0x23')](_0x2aa466['query'][_0x971a('0x23')]);_0x280f93[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x2aa466['query'][_0x971a('0x22')]);}_0x280f93[_0x971a('0x49')]=qs[_0x971a('0x4a')](_0x2aa466['query'][_0x971a('0x4a')]);_0x280f93[_0x971a('0x4b')]=qs[_0x971a('0x42')](_[_0x971a('0x4c')](_0x2aa466['query'],_0x561fb8['filters']));_0x280f93[_0x971a('0x4b')]['VoiceQueueId']=_0x21c89e['id'];if(_0x2aa466['query'][_0x971a('0x30')]){_0x280f93['where']=_[_0x971a('0x4d')](_0x280f93['where'],{'$or':_['map'](_0x280f93['attributes'],function(_0x2cd4b0){var _0x36737f={};_0x36737f[_0x2cd4b0]={'$like':'%'+_0x2aa466[_0x971a('0x40')][_0x971a('0x30')]+'%'};return _0x36737f;})});}_0x280f93=_['merge']({},_0x280f93,_0x2aa466['options']);return db[_0x971a('0x6c')]['count']({'where':_0x280f93[_0x971a('0x4b')]})['then'](function(_0x17b475){_0x3dbc5b[_0x971a('0x24')]=_0x17b475;if(_0x2aa466[_0x971a('0x40')][_0x971a('0x50')]){_0x280f93['include']=[{'all':!![]}];}return db[_0x971a('0x6c')][_0x971a('0x52')](_0x280f93);})[_0x971a('0x29')](function(_0x4d3489){_0x3dbc5b[_0x971a('0x53')]=_0x4d3489;return _0x3dbc5b;});}})[_0x971a('0x29')](respondWithFilteredResult(_0x1dfc16,_0x280f93))['catch'](handleError(_0x1dfc16,null));};exports[_0x971a('0x6d')]=function(_0x58c6c8,_0xfabbd6,_0x1dea33){var _0x2030b9={'raw':!![],'where':{}};var _0x492448={};var _0x49ac0a={'count':0x0,'rows':[]};return db[_0x971a('0x3d')][_0x971a('0x68')]({'where':{'id':_0x58c6c8[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0xfabbd6,null))[_0x971a('0x29')](function(_0x3beb76){if(_0x3beb76){_0x492448[_0x971a('0x44')]=_[_0x971a('0x41')](db['CmHopperBlack'][_0x971a('0x3e')]);_0x492448[_0x971a('0x40')]=_[_0x971a('0x41')](_0x58c6c8['query']);_0x492448['filters']=_[_0x971a('0x43')](_0x492448[_0x971a('0x44')],_0x492448[_0x971a('0x40')]);_0x2030b9[_0x971a('0x45')]=_[_0x971a('0x43')](_0x492448[_0x971a('0x44')],qs[_0x971a('0x46')](_0x58c6c8[_0x971a('0x40')][_0x971a('0x46')]));_0x2030b9['attributes']=_0x2030b9['attributes']['length']?_0x2030b9[_0x971a('0x45')]:_0x492448[_0x971a('0x44')];if(!_0x58c6c8[_0x971a('0x40')][_0x971a('0x48')](_0x971a('0x66'))){_0x2030b9[_0x971a('0x23')]=qs['limit'](_0x58c6c8[_0x971a('0x40')][_0x971a('0x23')]);_0x2030b9[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x58c6c8[_0x971a('0x40')]['offset']);}_0x2030b9[_0x971a('0x49')]=qs[_0x971a('0x4a')](_0x58c6c8['query']['sort']);_0x2030b9['where']=qs[_0x971a('0x42')](_[_0x971a('0x4c')](_0x58c6c8[_0x971a('0x40')],_0x492448[_0x971a('0x42')]));_0x2030b9[_0x971a('0x4b')][_0x971a('0x6a')]=_0x3beb76['id'];if(_0x58c6c8['query'][_0x971a('0x30')]){_0x2030b9['where']=_[_0x971a('0x4d')](_0x2030b9[_0x971a('0x4b')],{'$or':_[_0x971a('0x32')](_0x2030b9[_0x971a('0x45')],function(_0x2e76e1){var _0x47ba78={};_0x47ba78[_0x2e76e1]={'$like':'%'+_0x58c6c8['query']['filter']+'%'};return _0x47ba78;})});}_0x2030b9=_[_0x971a('0x4d')]({},_0x2030b9,_0x58c6c8[_0x971a('0x4f')]);return db['CmHopperBlack'][_0x971a('0x24')]({'where':_0x2030b9[_0x971a('0x4b')]})[_0x971a('0x29')](function(_0x4a5906){_0x49ac0a[_0x971a('0x24')]=_0x4a5906;if(_0x58c6c8['query'][_0x971a('0x50')]){_0x2030b9['include']=[{'all':!![]}];}return db[_0x971a('0x6e')][_0x971a('0x52')](_0x2030b9);})['then'](function(_0x1cbf70){_0x49ac0a['rows']=_0x1cbf70;return _0x49ac0a;});}})['then'](respondWithFilteredResult(_0xfabbd6,_0x2030b9))['catch'](handleError(_0xfabbd6,null));};exports[_0x971a('0x6f')]=function(_0x1f00c3,_0x13e0d9,_0x488212){var _0x3a79b3={};var _0x1bd5ef={};var _0x2b1ff0;var _0x6ef92;return db[_0x971a('0x3d')]['findOne']({'where':{'id':_0x1f00c3[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x13e0d9,null))[_0x971a('0x29')](function(_0x3176fe){if(_0x3176fe){_0x2b1ff0=_0x3176fe;_0x1bd5ef[_0x971a('0x44')]=_[_0x971a('0x41')](db[_0x971a('0x70')][_0x971a('0x3e')]);_0x1bd5ef['query']=_[_0x971a('0x41')](_0x1f00c3['query']);_0x1bd5ef['filters']=_['intersection'](_0x1bd5ef[_0x971a('0x44')],_0x1bd5ef[_0x971a('0x40')]);_0x3a79b3['attributes']=_[_0x971a('0x43')](_0x1bd5ef[_0x971a('0x44')],qs[_0x971a('0x46')](_0x1f00c3[_0x971a('0x40')][_0x971a('0x46')]));_0x3a79b3['attributes']=_0x3a79b3[_0x971a('0x45')][_0x971a('0x47')]?_0x3a79b3[_0x971a('0x45')]:_0x1bd5ef[_0x971a('0x44')];_0x3a79b3[_0x971a('0x49')]=qs[_0x971a('0x4a')](_0x1f00c3[_0x971a('0x40')][_0x971a('0x4a')]);_0x3a79b3[_0x971a('0x4b')]=qs[_0x971a('0x42')](_['pick'](_0x1f00c3['query'],_0x1bd5ef['filters']));if(_0x1f00c3['query'][_0x971a('0x30')]){_0x3a79b3['where']=_[_0x971a('0x4d')](_0x3a79b3[_0x971a('0x4b')],{'$or':_['map'](_0x3a79b3[_0x971a('0x45')],function(_0x3739a0){var _0x2d7c54={};_0x2d7c54[_0x3739a0]={'$like':'%'+_0x1f00c3[_0x971a('0x40')]['filter']+'%'};return _0x2d7c54;})});}_0x3a79b3=_['merge']({},_0x3a79b3,_0x1f00c3[_0x971a('0x4f')]);return _0x2b1ff0[_0x971a('0x6f')](_0x3a79b3);}})[_0x971a('0x29')](function(_0x200d3c){if(_0x200d3c){_0x6ef92=_0x200d3c[_0x971a('0x47')];if(!_0x1f00c3['query']['hasOwnProperty'](_0x971a('0x66'))){_0x3a79b3[_0x971a('0x23')]=qs['limit'](_0x1f00c3[_0x971a('0x40')][_0x971a('0x23')]);_0x3a79b3[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x1f00c3['query'][_0x971a('0x22')]);}return _0x2b1ff0[_0x971a('0x6f')](_0x3a79b3);}})['then'](function(_0x10517f){if(_0x10517f){return _0x10517f?{'count':_0x6ef92,'rows':_0x10517f}:null;}})[_0x971a('0x29')](respondWithResult(_0x13e0d9,null))[_0x971a('0x54')](handleError(_0x13e0d9,null));};exports[_0x971a('0x71')]=function(_0x55e8dc,_0x57a401,_0x4fd659){var _0x524414=_0x55e8dc['body'][_0x971a('0x72')];var _0x592d24=_[_0x971a('0x32')](_0x524414,'id');return db[_0x971a('0x70')][_0x971a('0x52')]({'where':{'id':_0x592d24},'attributes':['id'],'include':[{'model':db['User'],'as':_0x971a('0x73'),'attributes':['id','name',_0x971a('0x74'),_0x971a('0x75'),_0x971a('0x76')],'raw':!![]}]})[_0x971a('0x29')](function(_0x5e0dd6){if(_0x5e0dd6){var _0x4c4c92=_[_0x971a('0x77')](_0x5e0dd6,function(_0x1ce649){var _0x1b9c8f=_0x1ce649[_0x971a('0x2b')]({'plain':!![]});_0x1b9c8f[_0x971a('0x73')][_0x971a('0x78')](function(_0x2de75a){_0x2de75a[_0x971a('0x79')]=_[_0x971a('0x36')](_0x524414,{'id':_0x1b9c8f['id']})[_0x971a('0x79')];});return _0x1b9c8f[_0x971a('0x73')];});return db[_0x971a('0x3d')][_0x971a('0x36')]({'where':{'id':_0x55e8dc[_0x971a('0x56')]['id']}})[_0x971a('0x29')](function(_0x541743){return db[_0x971a('0x7a')][_0x971a('0x7b')](function(_0x5600de){return _0x541743[_0x971a('0x71')](_0x592d24,{'transaction':_0x5600de})['then'](function(){return BPromise['each'](_0x524414,function(_0x33e371){return db[_0x971a('0x7c')]['upsert']({'TeamId':_0x33e371['id'],'VoiceQueueId':_0x55e8dc[_0x971a('0x56')]['id'],'penalty':_0x33e371[_0x971a('0x79')]},{'transaction':_0x5600de});});})['then'](function(){return BPromise['each'](_0x4c4c92,function(_0x2bb1bc){return db[_0x971a('0x7d')][_0x971a('0x7e')]({'where':{'UserId':_0x2bb1bc['id'],'VoiceQueueId':_0x55e8dc[_0x971a('0x56')]['id']},'defaults':{'penalty':_0x2bb1bc[_0x971a('0x79')]},'transaction':_0x5600de});});})[_0x971a('0x29')](function(){return BPromise[_0x971a('0x7f')](_['filter'](_0x4c4c92,{'online':!![]}),function(_0x3ce29e){return db[_0x971a('0x80')][_0x971a('0x81')]({'membername':_0x3ce29e[_0x971a('0x3b')],'UserId':_0x3ce29e['id'],'queue_name':_0x541743['name'],'VoiceQueueId':_0x541743['id'],'interface':_[_0x971a('0x82')](_0x3ce29e[_0x971a('0x76')])?util[_0x971a('0x83')](_0x971a('0x84'),_0x3ce29e['name']):_0x3ce29e[_0x971a('0x76')],'paused':_0x3ce29e[_0x971a('0x75')]||![],'penalty':_0x3ce29e[_0x971a('0x79')]},{'transaction':_0x5600de});});})[_0x971a('0x29')](function(){_0x4c4c92[_0x971a('0x78')](function(_0x1db535){socket[_0x971a('0x85')]('userVoiceQueue:save',{'UserId':_0x1db535['id'],'VoiceQueueId':_0x541743['id']});});});});});}})[_0x971a('0x29')](respondWithStatusCode(_0x57a401,null))[_0x971a('0x54')](handleError(_0x57a401,null));};exports['removeTeams']=function(_0x46e348,_0x1519f6,_0x35a5af){return db[_0x971a('0x70')][_0x971a('0x52')]({'where':{'id':_0x46e348[_0x971a('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x971a('0x86')],'as':_0x971a('0x73'),'attributes':['id'],'raw':!![]}]})[_0x971a('0x29')](handleEntityNotFound(_0x1519f6,null))['then'](function(_0xc41fce){var _0x307a8e=_['map'](_0xc41fce,'id');var _0x500b87=[];var _0x51e7dd=[];var _0x364224=squel[_0x971a('0x87')]();_0x364224[_0x971a('0x88')](_0x971a('0x89'))[_0x971a('0x8a')](_0x971a('0x8b'),'tq')['join'](_0x971a('0x8c'),'ut',_0x971a('0x8d'))[_0x971a('0x4b')]('VoiceQueueId\x20=\x20?',_0x46e348[_0x971a('0x56')]['id']);for(var _0x16992d=0x0;_0x16992d<_0xc41fce[_0x971a('0x47')];_0x16992d+=0x1){let _0x5b206d=_0xc41fce[_0x16992d];for(var _0x2ba218=0x0;_0x2ba218<_0x5b206d[_0x971a('0x73')][_0x971a('0x47')];_0x2ba218+=0x1){let _0x596688=_0x5b206d[_0x971a('0x73')][_0x2ba218];var _0x3b64b3=_0x364224[_0x971a('0x5e')]();_0x3b64b3['where'](_0x971a('0x8e'),_0x596688['id']);_0x51e7dd[_0x971a('0x8f')](db['sequelize'][_0x971a('0x40')](_0x3b64b3['toString'](),{'type':db[_0x971a('0x7a')][_0x971a('0x90')][_0x971a('0x91')]})[_0x971a('0x29')](function(_0x7f7e51){if(_0x7f7e51[_0x971a('0x47')]===0x1){return _0x596688['id'];}else{var _0x23f464=_[_0x971a('0x92')](_[_0x971a('0x32')](_0x7f7e51,_0x971a('0x93')),function(_0x545245){return _['includes'](_0x307a8e,_0x545245);});if(_0x23f464){return _0x596688['id'];}}}));}}return BPromise['all'](_0x51e7dd)[_0x971a('0x29')](function(_0x2d656b){_0x500b87=_(_0x500b87)[_0x971a('0x94')](_0x2d656b)['compact']()[_0x971a('0x33')]();return db['VoiceQueue'][_0x971a('0x36')]({'where':{'id':_0x46e348['params']['id']}})['then'](function(_0x22fe79){return db[_0x971a('0x7a')][_0x971a('0x7b')](function(_0x2791f0){return _0x22fe79['removeTeams'](_0x46e348[_0x971a('0x40')]['ids'],{'transaction':_0x2791f0})[_0x971a('0x29')](function(){if(!_[_0x971a('0x95')](_0x500b87)){return _0x22fe79[_0x971a('0x96')](_0x500b87,{'transaction':_0x2791f0})['then'](function(){return db[_0x971a('0x80')]['destroy']({'where':{'VoiceQueueId':_0x46e348[_0x971a('0x56')]['id'],'UserId':_0x500b87},'transaction':_0x2791f0});});}})[_0x971a('0x29')](function(){_0x500b87['forEach'](function(_0x182d57){socket['emit'](_0x971a('0x97'),{'UserId':_0x182d57,'VoiceQueueId':_0x22fe79['id']});});});});});});})[_0x971a('0x29')](respondWithStatusCode(_0x1519f6,null))[_0x971a('0x54')](handleError(_0x1519f6,null));};exports[_0x971a('0x98')]=function(_0xb3b839,_0x30522a,_0x148172){var _0x50c911,_0x40c70a;return db['VoiceQueue'][_0x971a('0x36')]({'where':{'id':_0xb3b839[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x30522a,null))[_0x971a('0x29')](function(_0x4ac8c7){if(_0x4ac8c7){_0x40c70a=_0x4ac8c7;return _0x4ac8c7[_0x971a('0x98')](_0xb3b839[_0x971a('0x62')][_0x971a('0x99')],_[_0x971a('0x5f')](_0xb3b839[_0x971a('0x62')],[_0x971a('0x99'),'id'])||{})['spread'](function(_0x26b860){for(var _0x1711d4=0x0;_0x1711d4<_0xb3b839[_0x971a('0x62')][_0x971a('0x99')][_0x971a('0x47')];_0x1711d4+=0x1){socket['emit'](_0x971a('0x9a'),{'UserId':Number(_0xb3b839['body']['ids'][_0x1711d4]),'VoiceQueueId':Number(_0xb3b839['params']['id'])});}return _0x26b860;});}})[_0x971a('0x29')](function(_0x46af2b){_0x50c911=_0x46af2b||[];if(_0x40c70a){return db[_0x971a('0x86')][_0x971a('0x52')]({'where':{'id':_0xb3b839[_0x971a('0x62')][_0x971a('0x99')]},'attributes':['id',_0x971a('0x3b'),_0x971a('0x74'),_0x971a('0x75'),_0x971a('0x76')],'raw':!![]});}})[_0x971a('0x29')](function(_0x3062a6){if(!_[_0x971a('0x95')](_0x3062a6)){var _0x2fc390=[];for(var _0x5e4df9=0x0;_0x5e4df9<_0x3062a6['length'];_0x5e4df9++){if(_0x3062a6[_0x5e4df9][_0x971a('0x74')]){_0x2fc390[_0x971a('0x8f')](db[_0x971a('0x80')][_0x971a('0x81')]({'membername':_0x3062a6[_0x5e4df9][_0x971a('0x3b')],'UserId':_0x3062a6[_0x5e4df9]['id'],'queue_name':_0x40c70a[_0x971a('0x3b')],'VoiceQueueId':_0x40c70a['id'],'interface':_[_0x971a('0x82')](_0x3062a6[_0x5e4df9][_0x971a('0x76')])?util[_0x971a('0x83')]('SIP/%s',_0x3062a6[_0x5e4df9][_0x971a('0x3b')]):_0x3062a6[_0x5e4df9][_0x971a('0x76')],'paused':_0x3062a6[_0x5e4df9][_0x971a('0x75')]||![],'penalty':_0xb3b839[_0x971a('0x62')]['penalty']||0x0}));}}return BPromise[_0x971a('0x9b')](_0x2fc390);}})['then'](function(){return _0x50c911;})[_0x971a('0x29')](respondWithResult(_0x30522a,null))[_0x971a('0x54')](handleError(_0x30522a,null));};exports[_0x971a('0x96')]=function(_0x535722,_0x673a55,_0x368181){return db['VoiceQueue'][_0x971a('0x36')]({'where':{'id':_0x535722['params']['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x673a55,null))[_0x971a('0x29')](function(_0x30a469){if(_0x30a469){return _0x30a469[_0x971a('0x96')](_0x535722[_0x971a('0x40')]['ids'])['then'](function(){if(_[_0x971a('0x9c')](_0x535722['query']['ids'])){for(var _0x4af527=0x0;_0x4af527<_0x535722[_0x971a('0x40')][_0x971a('0x99')][_0x971a('0x47')];_0x4af527+=0x1){socket[_0x971a('0x85')](_0x971a('0x97'),{'UserId':Number(_0x535722[_0x971a('0x40')][_0x971a('0x99')][_0x4af527]),'VoiceQueueId':Number(_0x535722[_0x971a('0x56')]['id'])});}}else{socket['emit'](_0x971a('0x97'),{'UserId':Number(_0x535722[_0x971a('0x40')][_0x971a('0x99')]),'VoiceQueueId':Number(_0x535722[_0x971a('0x56')]['id'])});}});}})[_0x971a('0x29')](function(_0x4bfd5d){return db[_0x971a('0x80')][_0x971a('0x2a')]({'where':{'VoiceQueueId':_0x535722[_0x971a('0x56')]['id'],'UserId':_0x535722[_0x971a('0x40')]['ids']}})['then'](function(){return _0x4bfd5d;});})[_0x971a('0x29')](respondWithStatusCode(_0x673a55,null))[_0x971a('0x54')](handleError(_0x673a55,null));};exports[_0x971a('0x9d')]=function(_0x1efbd1,_0x17d8bb,_0x2d6fbb){var _0x23d32e={};var _0x16dad2={};var _0x49b711;var _0x1c3571;return db[_0x971a('0x3d')][_0x971a('0x68')]({'where':{'id':_0x1efbd1[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x17d8bb,null))[_0x971a('0x29')](function(_0x3dda68){if(_0x3dda68){_0x49b711=_0x3dda68;_0x16dad2[_0x971a('0x44')]=_[_0x971a('0x41')](db[_0x971a('0x86')]['rawAttributes']);_0x16dad2['query']=_['keys'](_0x1efbd1['query']);_0x16dad2['filters']=_[_0x971a('0x43')](_0x16dad2[_0x971a('0x44')],_0x16dad2[_0x971a('0x40')]);_0x23d32e[_0x971a('0x45')]=_[_0x971a('0x43')](_0x16dad2['model'],qs['fields'](_0x1efbd1[_0x971a('0x40')][_0x971a('0x46')]));_0x23d32e[_0x971a('0x45')]=_0x23d32e['attributes'][_0x971a('0x47')]?_0x23d32e[_0x971a('0x45')]:_0x16dad2['model'];_0x23d32e['order']=qs[_0x971a('0x4a')](_0x1efbd1[_0x971a('0x40')][_0x971a('0x4a')]);_0x23d32e[_0x971a('0x4b')]=qs[_0x971a('0x42')](_['pick'](_0x1efbd1[_0x971a('0x40')],_0x16dad2['filters']));if(_0x1efbd1[_0x971a('0x40')][_0x971a('0x30')]){_0x23d32e['where']=_['merge'](_0x23d32e['where'],{'$or':_[_0x971a('0x32')](_0x23d32e[_0x971a('0x45')],function(_0x10a8a0){var _0x162189={};_0x162189[_0x10a8a0]={'$like':'%'+_0x1efbd1[_0x971a('0x40')][_0x971a('0x30')]+'%'};return _0x162189;})});}_0x23d32e=_[_0x971a('0x4d')]({},_0x23d32e,_0x1efbd1['options']);return _0x49b711[_0x971a('0x9d')](_0x23d32e);}})['then'](function(_0x4d9391){if(_0x4d9391){_0x1c3571=_0x4d9391[_0x971a('0x47')];if(!_0x1efbd1['query'][_0x971a('0x48')](_0x971a('0x66'))){_0x23d32e[_0x971a('0x23')]=qs[_0x971a('0x23')](_0x1efbd1['query']['limit']);_0x23d32e[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x1efbd1[_0x971a('0x40')][_0x971a('0x22')]);}return _0x49b711[_0x971a('0x9d')](_0x23d32e);}})[_0x971a('0x29')](function(_0x4f41ad){if(_0x4f41ad){return _0x4f41ad?{'count':_0x1c3571,'rows':_0x4f41ad}:null;}})[_0x971a('0x29')](respondWithResult(_0x17d8bb,null))['catch'](handleError(_0x17d8bb,null));};exports[_0x971a('0x9e')]=function(_0x7b41c2,_0x206be9,_0x45bd48){var _0x215822={};var _0x27d91c={};var _0x28f2f3;var _0x648c2d;return db[_0x971a('0x3d')][_0x971a('0x68')]({'where':{'id':_0x7b41c2[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x206be9,null))[_0x971a('0x29')](function(_0x38442b){if(_0x38442b){_0x28f2f3=_0x38442b;_0x27d91c['model']=_[_0x971a('0x41')](db['UserVoiceQueueRt'][_0x971a('0x3e')]);_0x27d91c[_0x971a('0x40')]=_[_0x971a('0x41')](_0x7b41c2['query']);_0x27d91c[_0x971a('0x42')]=_[_0x971a('0x43')](_0x27d91c[_0x971a('0x44')],_0x27d91c['query']);_0x215822[_0x971a('0x45')]=_[_0x971a('0x43')](_0x27d91c[_0x971a('0x44')],qs[_0x971a('0x46')](_0x7b41c2[_0x971a('0x40')][_0x971a('0x46')]));_0x215822[_0x971a('0x45')]=_0x215822[_0x971a('0x45')][_0x971a('0x47')]?_0x215822[_0x971a('0x45')]:_0x27d91c['model'];_0x215822[_0x971a('0x49')]=qs['sort'](_0x7b41c2[_0x971a('0x40')][_0x971a('0x4a')]);_0x215822[_0x971a('0x4b')]=qs[_0x971a('0x42')](_[_0x971a('0x4c')](_0x7b41c2[_0x971a('0x40')],_0x27d91c['filters']));if(_0x7b41c2[_0x971a('0x40')][_0x971a('0x30')]){_0x215822[_0x971a('0x4b')]=_[_0x971a('0x4d')](_0x215822[_0x971a('0x4b')],{'$or':_[_0x971a('0x32')](_0x215822['attributes'],function(_0xaed944){var _0x3dd456={};_0x3dd456[_0xaed944]={'$like':'%'+_0x7b41c2['query'][_0x971a('0x30')]+'%'};return _0x3dd456;})});}_0x215822=_[_0x971a('0x4d')]({},_0x215822,_0x7b41c2[_0x971a('0x4f')]);return _0x28f2f3[_0x971a('0x9e')](_0x215822);}})[_0x971a('0x29')](function(_0x308688){if(_0x308688){_0x648c2d=_0x308688[_0x971a('0x47')];if(!_0x7b41c2[_0x971a('0x40')][_0x971a('0x48')](_0x971a('0x66'))){_0x215822[_0x971a('0x23')]=qs[_0x971a('0x23')](_0x7b41c2[_0x971a('0x40')][_0x971a('0x23')]);_0x215822[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x7b41c2[_0x971a('0x40')][_0x971a('0x22')]);}return _0x28f2f3[_0x971a('0x9e')](_0x215822);}})[_0x971a('0x29')](function(_0x1107b8){return _0x1107b8?{'count':_0x648c2d,'rows':_0x1107b8}:null;})[_0x971a('0x29')](respondWithResult(_0x206be9,null))[_0x971a('0x54')](handleError(_0x206be9,null));};exports[_0x971a('0x9f')]=function(_0x2b676e,_0x10c705,_0x4ffdeb){var _0x4a41a1={};var _0x4cb31b={};var _0x331fb7;var _0x4db8a5;return db[_0x971a('0x3d')][_0x971a('0x68')]({'where':{'id':_0x2b676e[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x10c705,null))[_0x971a('0x29')](function(_0x2cede4){if(_0x2cede4){_0x331fb7=_0x2cede4;_0x4cb31b['model']=_[_0x971a('0x41')](db[_0x971a('0xa0')][_0x971a('0x3e')]);_0x4cb31b['query']=_[_0x971a('0x41')](_0x2b676e[_0x971a('0x40')]);_0x4cb31b['filters']=_[_0x971a('0x43')](_0x4cb31b[_0x971a('0x44')],_0x4cb31b[_0x971a('0x40')]);_0x4a41a1['attributes']=_[_0x971a('0x43')](_0x4cb31b['model'],qs['fields'](_0x2b676e['query']['fields']));_0x4a41a1[_0x971a('0x45')]=_0x4a41a1[_0x971a('0x45')][_0x971a('0x47')]?_0x4a41a1[_0x971a('0x45')]:_0x4cb31b[_0x971a('0x44')];_0x4a41a1[_0x971a('0x49')]=qs[_0x971a('0x4a')](_0x2b676e[_0x971a('0x40')][_0x971a('0x4a')]);_0x4a41a1[_0x971a('0x4b')]=qs[_0x971a('0x42')](_['pick'](_0x2b676e[_0x971a('0x40')],_0x4cb31b[_0x971a('0x42')]));if(_0x2b676e['query'][_0x971a('0x30')]){_0x4a41a1[_0x971a('0x4b')]=_['merge'](_0x4a41a1[_0x971a('0x4b')],{'$or':_[_0x971a('0x32')](_0x4a41a1[_0x971a('0x45')],function(_0x39be1b){var _0x392c6e={};_0x392c6e[_0x39be1b]={'$like':'%'+_0x2b676e[_0x971a('0x40')][_0x971a('0x30')]+'%'};return _0x392c6e;})});}_0x4a41a1=_[_0x971a('0x4d')]({},_0x4a41a1,_0x2b676e[_0x971a('0x4f')]);return _0x331fb7[_0x971a('0x9f')](_0x4a41a1);}})['then'](function(_0x4a32ac){if(_0x4a32ac){_0x4db8a5=_0x4a32ac[_0x971a('0x47')];if(!_0x2b676e[_0x971a('0x40')][_0x971a('0x48')](_0x971a('0x66'))){_0x4a41a1[_0x971a('0x23')]=qs[_0x971a('0x23')](_0x2b676e[_0x971a('0x40')][_0x971a('0x23')]);_0x4a41a1[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x2b676e[_0x971a('0x40')][_0x971a('0x22')]);}return _0x331fb7[_0x971a('0x9f')](_0x4a41a1);}})[_0x971a('0x29')](function(_0x241a9c){if(_0x241a9c){return _0x241a9c?{'count':_0x4db8a5,'rows':_0x241a9c}:null;}})[_0x971a('0x29')](respondWithResult(_0x10c705,null))[_0x971a('0x54')](handleError(_0x10c705,null));};exports[_0x971a('0xa1')]=function(_0x5a75cc,_0x3b848c,_0x34726f){var _0x1451f0,_0x42b549;return db[_0x971a('0x3d')][_0x971a('0x36')]({'where':{'id':_0x5a75cc[_0x971a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b848c,null))[_0x971a('0x29')](function(_0x22d1b1){if(_0x22d1b1){_0x42b549=_0x22d1b1;return _0x22d1b1['addLists'](_0x5a75cc['body'][_0x971a('0x99')],_[_0x971a('0x5f')](_0x5a75cc['body'],[_0x971a('0x99'),'id'])||{});}return null;})[_0x971a('0xa2')](function(_0x4d9524){var _0x25ae12;_0x1451f0=_0x4d9524||[];var _0x35bad9=[];if(_0x4d9524){for(var _0x37b040=0x0;_0x37b040<_0x4d9524[_0x971a('0x47')];_0x37b040+=0x1){var _0x59ba7b=_0x4d9524[_0x37b040][_0x971a('0x2b')]({'plain':!![]});_0x42b549[_0x971a('0xa3')]=_0x5a75cc[_0x971a('0x62')][_0x971a('0xa3')]?_0x5a75cc[_0x971a('0x62')]['dialCheckDuplicateType']:_0x42b549[_0x971a('0xa3')];switch(_0x42b549[_0x971a('0xa3')]){case _0x971a('0xa4'):_0x25ae12=squel[_0x971a('0xa5')]()[_0x971a('0xa6')](_0x971a('0xa7'))[_0x971a('0xa8')](['phone','scheduledAt',_0x971a('0xa9'),_0x971a('0xaa'),'VoiceQueueId',_0x971a('0x60'),'updatedAt'],squel[_0x971a('0x87')]()[_0x971a('0x88')](_0x971a('0xab'),'phone')[_0x971a('0x88')](_0x971a('0xac'),_0x971a('0xad'))[_0x971a('0x88')]('id',_0x971a('0xa9'))[_0x971a('0x88')](_0x59ba7b[_0x971a('0xae')]['toString'](),_0x971a('0xaa'))[_0x971a('0x88')](_0x5a75cc['params']['id']['toString'](),_0x971a('0x6a'))[_0x971a('0x88')](_0x971a('0xac'),_0x971a('0x60'))[_0x971a('0x88')]('NOW()',_0x971a('0x61'))[_0x971a('0x8a')](_0x971a('0xaf'))['where'](_0x971a('0xb0'))[_0x971a('0x4b')](_0x971a('0xb1'),_0x59ba7b[_0x971a('0xae')][_0x971a('0xb2')]())[_0x971a('0x4b')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x971a('0x88')](_0x971a('0xb3'))[_0x971a('0x8a')]('cm_hopper_final')[_0x971a('0x4b')](_0x971a('0xb4'),_0x5a75cc[_0x971a('0x56')]['id']['toString']()))[_0x971a('0x4b')](_0x971a('0xb5'),squel[_0x971a('0x87')]()[_0x971a('0x88')]('COALESCE(phone,\x27\x27)')[_0x971a('0x8a')](_0x971a('0xa7'))['where'](_0x971a('0xb4'),_0x5a75cc[_0x971a('0x56')]['id'][_0x971a('0xb2')]())))['toString']();break;case _0x971a('0xb6'):_0x25ae12=squel[_0x971a('0xa5')]()['into'](_0x971a('0xa7'))['fromQuery'](['phone',_0x971a('0xad'),_0x971a('0xa9'),_0x971a('0xaa'),_0x971a('0x6a'),_0x971a('0x60'),_0x971a('0x61')],squel['select']()['field']('phone',_0x971a('0xab'))[_0x971a('0x88')]('NOW()',_0x971a('0xad'))[_0x971a('0x88')]('id',_0x971a('0xa9'))['field'](_0x59ba7b['CmListId'][_0x971a('0xb2')](),_0x971a('0xaa'))[_0x971a('0x88')](_0x5a75cc[_0x971a('0x56')]['id'][_0x971a('0xb2')](),_0x971a('0x6a'))[_0x971a('0x88')](_0x971a('0xac'),_0x971a('0x60'))[_0x971a('0x88')](_0x971a('0xac'),'updatedAt')[_0x971a('0x8a')](_0x971a('0xaf'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x971a('0xb1'),_0x59ba7b[_0x971a('0xae')]['toString']())[_0x971a('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0x971a('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x971a('0x87')]()['field'](_0x971a('0xb7'))[_0x971a('0x8a')](_0x971a('0xa7'))['where'](_0x971a('0xb4'),_0x5a75cc[_0x971a('0x56')]['id'][_0x971a('0xb2')]())))[_0x971a('0xb2')]();break;default:_0x25ae12=squel['insert']()[_0x971a('0xa6')](_0x971a('0xa7'))[_0x971a('0xa8')](['phone',_0x971a('0xad'),_0x971a('0xa9'),_0x971a('0xaa'),_0x971a('0x6a'),_0x971a('0x60'),'updatedAt'],squel['select']()[_0x971a('0x88')](_0x971a('0xab'),_0x971a('0xab'))[_0x971a('0x88')](_0x971a('0xac'),_0x971a('0xad'))[_0x971a('0x88')]('id','ContactId')[_0x971a('0x88')](_0x59ba7b[_0x971a('0xae')][_0x971a('0xb2')](),_0x971a('0xaa'))[_0x971a('0x88')](_0x5a75cc[_0x971a('0x56')]['id'][_0x971a('0xb2')](),_0x971a('0x6a'))[_0x971a('0x88')](_0x971a('0xac'),_0x971a('0x60'))[_0x971a('0x88')](_0x971a('0xac'),'updatedAt')[_0x971a('0x8a')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x971a('0x4b')](_0x971a('0xb1'),_0x59ba7b[_0x971a('0xae')][_0x971a('0xb2')]())['where'](_0x971a('0xb8')))[_0x971a('0xb2')]();}_0x35bad9[_0x971a('0x8f')](db['sequelize']['query'](_0x25ae12));}return BPromise[_0x971a('0x9b')](_0x35bad9);}})[_0x971a('0x29')](function(){return _0x1451f0;})[_0x971a('0x29')](respondWithResult(_0x3b848c,null))[_0x971a('0x54')](handleError(_0x3b848c,null));};exports['removeLists']=function(_0x151ff9,_0x53b03f,_0x13de1a){return db[_0x971a('0x3d')][_0x971a('0x36')]({'where':{'id':_0x151ff9['params']['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x53b03f,null))[_0x971a('0x29')](function(_0x54e84f){if(_0x54e84f){return _0x54e84f[_0x971a('0xb9')](_0x151ff9[_0x971a('0x40')][_0x971a('0x99')]);}})[_0x971a('0x29')](function(_0x35a1b6){if(_0x35a1b6){return db[_0x971a('0x65')][_0x971a('0x2a')]({'where':{'ListId':_0x151ff9[_0x971a('0x40')][_0x971a('0x99')],'VoiceQueueId':_0x151ff9[_0x971a('0x56')]['id']}})['then'](function(){return _0x35a1b6;});}})['then'](respondWithStatusCode(_0x53b03f,null))[_0x971a('0x54')](handleError(_0x53b03f,null));};exports['getBlackLists']=function(_0x24dd6c,_0x4f516b,_0x214dd1){var _0x1481bc={};var _0x1db81d={};var _0x1a63f8;var _0x3b81fe;return db['VoiceQueue']['findOne']({'where':{'id':_0x24dd6c[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x4f516b,null))['then'](function(_0x4bb71f){if(_0x4bb71f){_0x1a63f8=_0x4bb71f;_0x1db81d[_0x971a('0x44')]=_[_0x971a('0x41')](db[_0x971a('0xa0')][_0x971a('0x3e')]);_0x1db81d[_0x971a('0x40')]=_['keys'](_0x24dd6c['query']);_0x1db81d[_0x971a('0x42')]=_[_0x971a('0x43')](_0x1db81d['model'],_0x1db81d[_0x971a('0x40')]);_0x1481bc[_0x971a('0x45')]=_[_0x971a('0x43')](_0x1db81d[_0x971a('0x44')],qs[_0x971a('0x46')](_0x24dd6c['query']['fields']));_0x1481bc['attributes']=_0x1481bc['attributes'][_0x971a('0x47')]?_0x1481bc[_0x971a('0x45')]:_0x1db81d[_0x971a('0x44')];_0x1481bc[_0x971a('0x49')]=qs[_0x971a('0x4a')](_0x24dd6c[_0x971a('0x40')][_0x971a('0x4a')]);_0x1481bc['where']=qs[_0x971a('0x42')](_[_0x971a('0x4c')](_0x24dd6c[_0x971a('0x40')],_0x1db81d[_0x971a('0x42')]));if(_0x24dd6c[_0x971a('0x40')][_0x971a('0x30')]){_0x1481bc[_0x971a('0x4b')]=_[_0x971a('0x4d')](_0x1481bc[_0x971a('0x4b')],{'$or':_[_0x971a('0x32')](_0x1481bc['attributes'],function(_0x3aadc4){var _0x2d9ae1={};_0x2d9ae1[_0x3aadc4]={'$like':'%'+_0x24dd6c[_0x971a('0x40')][_0x971a('0x30')]+'%'};return _0x2d9ae1;})});}_0x1481bc=_['merge']({},_0x1481bc,_0x24dd6c[_0x971a('0x4f')]);return _0x1a63f8[_0x971a('0xba')](_0x1481bc);}})[_0x971a('0x29')](function(_0x1fcd2c){if(_0x1fcd2c){_0x3b81fe=_0x1fcd2c[_0x971a('0x47')];if(!_0x24dd6c[_0x971a('0x40')][_0x971a('0x48')](_0x971a('0x66'))){_0x1481bc[_0x971a('0x23')]=qs[_0x971a('0x23')](_0x24dd6c[_0x971a('0x40')][_0x971a('0x23')]);_0x1481bc[_0x971a('0x22')]=qs[_0x971a('0x22')](_0x24dd6c[_0x971a('0x40')]['offset']);}return _0x1a63f8['getBlackLists'](_0x1481bc);}})[_0x971a('0x29')](function(_0xe18012){if(_0xe18012){return _0xe18012?{'count':_0x3b81fe,'rows':_0xe18012}:null;}})[_0x971a('0x29')](respondWithResult(_0x4f516b,null))[_0x971a('0x54')](handleError(_0x4f516b,null));};exports[_0x971a('0xbb')]=function(_0x1d7cb9,_0xbe50e9,_0x2c374b){var _0xb465bc,_0x4170e4;return db['VoiceQueue']['find']({'where':{'id':_0x1d7cb9[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0xbe50e9,null))['then'](function(_0x4e099b){if(_0x4e099b){_0x4170e4=_0x4e099b;return _0x4e099b[_0x971a('0xbb')](_0x1d7cb9[_0x971a('0x62')][_0x971a('0x99')],_['omit'](_0x1d7cb9[_0x971a('0x62')],[_0x971a('0x99'),'id'])||{});}return null;})[_0x971a('0xa2')](function(_0x3bde72){var _0x1eb3ce;_0xb465bc=_0x3bde72||[];var _0x1ed32c=[];if(_0x3bde72){for(var _0x48b134=0x0;_0x48b134<_0x3bde72['length'];_0x48b134+=0x1){var _0x5f02b4=_0x3bde72[_0x48b134]['get']({'plain':!![]});_0x1eb3ce=squel[_0x971a('0xa5')]()['into'](_0x971a('0xbc'))[_0x971a('0xa8')]([_0x971a('0xab'),_0x971a('0xa9'),'ListId',_0x971a('0x6a'),_0x971a('0x60'),_0x971a('0x61')],squel['select']()[_0x971a('0x88')](_0x971a('0xab'),_0x971a('0xab'))['field']('id',_0x971a('0xa9'))[_0x971a('0x88')](_0x5f02b4[_0x971a('0xae')][_0x971a('0xb2')](),_0x971a('0xaa'))[_0x971a('0x88')](_0x1d7cb9['params']['id'][_0x971a('0xb2')](),'VoiceQueueId')[_0x971a('0x88')](_0x971a('0xac'),'createdAt')[_0x971a('0x88')](_0x971a('0xac'),_0x971a('0x61'))[_0x971a('0x8a')](_0x971a('0xaf'))[_0x971a('0x4b')](_0x971a('0xb0'))[_0x971a('0x4b')](_0x971a('0xb1'),_0x5f02b4[_0x971a('0xae')]['toString']())[_0x971a('0x4b')](_0x971a('0xb8')))[_0x971a('0xb2')]();_0x1ed32c['push'](db[_0x971a('0x7a')][_0x971a('0x40')](_0x1eb3ce));}return BPromise[_0x971a('0x9b')](_0x1ed32c);}})['then'](function(){return _0xb465bc;})[_0x971a('0x29')](respondWithResult(_0xbe50e9,null))[_0x971a('0x54')](handleError(_0xbe50e9,null));};exports[_0x971a('0xbd')]=function(_0x4b3bcd,_0x1ece68,_0x2c493e){return db[_0x971a('0x3d')][_0x971a('0x36')]({'where':{'id':_0x4b3bcd[_0x971a('0x56')]['id']}})[_0x971a('0x29')](handleEntityNotFound(_0x1ece68,null))['then'](function(_0x206ae2){if(_0x206ae2){return _0x206ae2[_0x971a('0xbd')](_0x4b3bcd[_0x971a('0x40')][_0x971a('0x99')]);}})[_0x971a('0x29')](function(_0x3824be){if(_0x3824be){return db[_0x971a('0x6e')][_0x971a('0x2a')]({'where':{'ListId':_0x4b3bcd[_0x971a('0x40')][_0x971a('0x99')],'VoiceQueueId':_0x4b3bcd[_0x971a('0x56')]['id']}})[_0x971a('0x29')](function(){return _0x3824be;});}})['then'](respondWithStatusCode(_0x1ece68,null))[_0x971a('0x54')](handleError(_0x1ece68,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 54602a4..006f5e7 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 _0xf53b=['emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','save','remove'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0xf53b,0x113));var _0xbf53=function(_0x5a2f8f,_0xe2bcde){_0x5a2f8f=_0x5a2f8f-0x0;var _0x460f76=_0xf53b[_0x5a2f8f];return _0x460f76;};'use strict';var EventEmitter=require(_0xbf53('0x0'));var VoiceQueue=require(_0xbf53('0x1'))['db'][_0xbf53('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbf53('0x3'),'afterUpdate':'update','afterDestroy':_0xbf53('0x4')};function emitEvent(_0x45f369){return function(_0x42c7c4,_0x19eafb,_0x360e7c){VoiceQueueEvents['emit'](_0x45f369+':'+_0x42c7c4['id'],_0x42c7c4);VoiceQueueEvents[_0xbf53('0x5')](_0x45f369,_0x42c7c4);_0x360e7c(null);};}for(var e in events){if(events[_0xbf53('0x6')](e)){var event=events[e];VoiceQueue[_0xbf53('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x168b=['save','update','remove','emit','hook','setMaxListeners'];(function(_0x2f653f,_0x1cef4e){var _0x479836=function(_0x4182c2){while(--_0x4182c2){_0x2f653f['push'](_0x2f653f['shift']());}};_0x479836(++_0x1cef4e);}(_0x168b,0x71));var _0xb168=function(_0x36c762,_0x27e3c7){_0x36c762=_0x36c762-0x0;var _0x88a1f9=_0x168b[_0x36c762];return _0x88a1f9;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb168('0x0')](0x0);var events={'afterCreate':_0xb168('0x1'),'afterUpdate':_0xb168('0x2'),'afterDestroy':_0xb168('0x3')};function emitEvent(_0x33ff62){return function(_0x11a4c0,_0x36af2e,_0x3958d2){VoiceQueueEvents['emit'](_0x33ff62+':'+_0x11a4c0['id'],_0x11a4c0);VoiceQueueEvents[_0xb168('0x4')](_0x33ff62,_0x11a4c0);_0x3958d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xb168('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index ce0ee36..106cf52 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x1a6a76,_0x1e52a5){var _0x586032=function(_0x1d9bda){while(--_0x1d9bda){_0x1a6a76['push'](_0x1a6a76['shift']());}};_0x586032(++_0x1e52a5);}(_0xedd9,0xfc));var _0x9edd=function(_0x23d96e,_0x20e988){_0x23d96e=_0x23d96e-0x0;var _0x581713=_0xedd9[_0x23d96e];return _0x581713;};'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':'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(_0x3f3934,_0x5dff9e){var _0x2765ea=function(_0x45f2af){while(--_0x45f2af){_0x3f3934['push'](_0x3f3934['shift']());}};_0x2765ea(++_0x5dff9e);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 039090f..0ee7f8d 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 _0xa17d=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','limit','include','map','attributes','model','stringify','where','ShowVoiceQueue','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x107e79,_0x54b614){var _0x5fe8d0=function(_0x301b21){while(--_0x301b21){_0x107e79['push'](_0x107e79['shift']());}};_0x5fe8d0(++_0x54b614);}(_0xa17d,0xbd));var _0xda17=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0xa17d[_0x1dd82f];return _0x353ca4;};'use strict';var _=require(_0xda17('0x0'));var util=require(_0xda17('0x1'));var moment=require('moment');var BPromise=require(_0xda17('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda17('0x3'));var db=require(_0xda17('0x4'))['db'];var utils=require(_0xda17('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xda17('0x6'));var jayson=require(_0xda17('0x7'));var client=jayson['client'][_0xda17('0x8')]({'port':0x232a});config[_0xda17('0x9')]=_[_0xda17('0xa')](config[_0xda17('0x9')],{'host':_0xda17('0xb'),'port':0x18eb});var socket=require(_0xda17('0xc'))(new Redis(config[_0xda17('0x9')]));require(_0xda17('0xd'))[_0xda17('0xe')](socket);function respondWithRpcPromise(_0x24f590,_0x318fb2,_0x156515){return new BPromise(function(_0x1dd9a9,_0x532031){return client[_0xda17('0xf')](_0x24f590,_0x156515)[_0xda17('0x10')](function(_0x1e970f){logger[_0xda17('0x11')](_0xda17('0x12'),_0x318fb2,_0xda17('0x13'));logger[_0xda17('0x14')](_0xda17('0x15'),_0x318fb2,'request\x20sent',JSON['stringify'](_0x1e970f));if(_0x1e970f[_0xda17('0x16')]){if(_0x1e970f[_0xda17('0x16')][_0xda17('0x17')]===0x1f4){logger[_0xda17('0x16')](_0xda17('0x12'),_0x318fb2,_0x1e970f[_0xda17('0x16')][_0xda17('0x18')]);return _0x532031(_0x1e970f['error'][_0xda17('0x18')]);}logger[_0xda17('0x16')](_0xda17('0x12'),_0x318fb2,_0x1e970f[_0xda17('0x16')]['message']);return _0x1dd9a9(_0x1e970f[_0xda17('0x16')][_0xda17('0x18')]);}else{logger[_0xda17('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x318fb2,'request\x20sent');_0x1dd9a9(_0x1e970f['result']['message']);}})[_0xda17('0x19')](function(_0x37ec70){logger[_0xda17('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x318fb2,_0x37ec70);_0x532031(_0x37ec70);});});}exports[_0xda17('0x1a')]=function(_0x3656ca){var _0x1efb5c=this;return new Promise(function(_0x45f680,_0x4c2a89){return db[_0xda17('0x1b')][_0xda17('0x1c')]({'raw':_0x3656ca['options']?_0x3656ca[_0xda17('0x1d')][_0xda17('0x1e')]===undefined?!![]:![]:!![],'where':_0x3656ca[_0xda17('0x1d')]?_0x3656ca[_0xda17('0x1d')]['where']||null:null,'attributes':_0x3656ca[_0xda17('0x1d')]?_0x3656ca['options']['attributes']||null:null,'limit':_0x3656ca[_0xda17('0x1d')]?_0x3656ca[_0xda17('0x1d')][_0xda17('0x1f')]||null:null,'include':_0x3656ca[_0xda17('0x1d')]?_0x3656ca[_0xda17('0x1d')][_0xda17('0x20')]?_[_0xda17('0x21')](_0x3656ca[_0xda17('0x1d')][_0xda17('0x20')],function(_0x36968a){return{'model':db[_0x36968a['model']],'as':_0x36968a['as'],'attributes':_0x36968a[_0xda17('0x22')],'include':_0x36968a[_0xda17('0x20')]?_[_0xda17('0x21')](_0x36968a[_0xda17('0x20')],function(_0x3c0497){return{'model':db[_0x3c0497[_0xda17('0x23')]],'as':_0x3c0497['as'],'attributes':_0x3c0497[_0xda17('0x22')],'include':_0x3c0497[_0xda17('0x20')]?_[_0xda17('0x21')](_0x3c0497['include'],function(_0x50cdc8){return{'model':db[_0x50cdc8[_0xda17('0x23')]],'as':_0x50cdc8['as'],'attributes':_0x50cdc8[_0xda17('0x22')]};}):[]};}):[]};}):[]:[]})[_0xda17('0x10')](function(_0x2b8bc4){logger[_0xda17('0x11')](_0xda17('0x1a'),_0x3656ca);logger['debug']('GetVoiceQueue',_0x3656ca,JSON[_0xda17('0x24')](_0x2b8bc4));_0x45f680(_0x2b8bc4);})[_0xda17('0x19')](function(_0x4c12ac){logger['error']('GetVoiceQueue',_0x4c12ac['message'],_0x3656ca);_0x4c2a89(_0x1efb5c[_0xda17('0x16')](0x1f4,_0x4c12ac[_0xda17('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x41d5fe){var _0x161d4a=this;return new Promise(function(_0x2c72f5,_0x1865b9){return db['VoiceQueue']['find']({'raw':_0x41d5fe['options']?_0x41d5fe[_0xda17('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x41d5fe[_0xda17('0x1d')]?_0x41d5fe[_0xda17('0x1d')][_0xda17('0x25')]||null:null,'attributes':_0x41d5fe['options']?_0x41d5fe[_0xda17('0x1d')][_0xda17('0x22')]||null:null,'include':_0x41d5fe[_0xda17('0x1d')]?_0x41d5fe[_0xda17('0x1d')][_0xda17('0x20')]?_[_0xda17('0x21')](_0x41d5fe[_0xda17('0x1d')]['include'],function(_0x4417bd){return{'model':db[_0x4417bd[_0xda17('0x23')]],'as':_0x4417bd['as'],'attributes':_0x4417bd[_0xda17('0x22')],'include':_0x4417bd[_0xda17('0x20')]?_[_0xda17('0x21')](_0x4417bd[_0xda17('0x20')],function(_0x2ebbdf){return{'model':db[_0x2ebbdf['model']],'as':_0x2ebbdf['as'],'attributes':_0x2ebbdf[_0xda17('0x22')],'include':_0x2ebbdf['include']?_[_0xda17('0x21')](_0x2ebbdf['include'],function(_0x2f303a){return{'model':db[_0x2f303a[_0xda17('0x23')]],'as':_0x2f303a['as'],'attributes':_0x2f303a[_0xda17('0x22')]};}):[]};}):[]};}):[]:[]})[_0xda17('0x10')](function(_0x188213){logger[_0xda17('0x11')]('ShowVoiceQueue',_0x41d5fe);logger[_0xda17('0x14')](_0xda17('0x26'),_0x41d5fe,JSON[_0xda17('0x24')](_0x188213));_0x2c72f5(_0x188213);})[_0xda17('0x19')](function(_0x25eb37){logger[_0xda17('0x16')]('ShowVoiceQueue',_0x25eb37[_0xda17('0x18')],_0x41d5fe);_0x1865b9(_0x161d4a[_0xda17('0x16')](0x1f4,_0x25eb37[_0xda17('0x18')]));});});}; \ No newline at end of file +var _0x1f30=['register','then','info','VoiceQueue,\x20%s,\x20%s','debug','stringify','error','code','message','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','include','model','map','catch','find','ShowVoiceQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x380386,_0x5f602){var _0x2033e5=function(_0x240c8a){while(--_0x240c8a){_0x380386['push'](_0x380386['shift']());}};_0x2033e5(++_0x5f602);}(_0x1f30,0x173));var _0x01f3=function(_0x44e19e,_0x512f7){_0x44e19e=_0x44e19e-0x0;var _0x5cc1e5=_0x1f30[_0x44e19e];return _0x5cc1e5;};'use strict';var _=require('lodash');var util=require(_0x01f3('0x0'));var moment=require(_0x01f3('0x1'));var BPromise=require(_0x01f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01f3('0x3'));var db=require(_0x01f3('0x4'))['db'];var utils=require(_0x01f3('0x5'));var logger=require('../../config/logger')(_0x01f3('0x6'));var config=require('../../config/environment');var jayson=require(_0x01f3('0x7'));var client=jayson['client'][_0x01f3('0x8')]({'port':0x232a});config[_0x01f3('0x9')]=_[_0x01f3('0xa')](config[_0x01f3('0x9')],{'host':_0x01f3('0xb'),'port':0x18eb});var socket=require(_0x01f3('0xc'))(new Redis(config['redis']));require(_0x01f3('0xd'))[_0x01f3('0xe')](socket);function respondWithRpcPromise(_0x417c3a,_0x49c090,_0x4bf232){return new BPromise(function(_0x2d62bf,_0x572101){return client['request'](_0x417c3a,_0x4bf232)[_0x01f3('0xf')](function(_0x4600f3){logger[_0x01f3('0x10')](_0x01f3('0x11'),_0x49c090,'request\x20sent');logger[_0x01f3('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x49c090,'request\x20sent',JSON[_0x01f3('0x13')](_0x4600f3));if(_0x4600f3[_0x01f3('0x14')]){if(_0x4600f3[_0x01f3('0x14')][_0x01f3('0x15')]===0x1f4){logger[_0x01f3('0x14')](_0x01f3('0x11'),_0x49c090,_0x4600f3[_0x01f3('0x14')][_0x01f3('0x16')]);return _0x572101(_0x4600f3[_0x01f3('0x14')][_0x01f3('0x16')]);}logger['error'](_0x01f3('0x11'),_0x49c090,_0x4600f3[_0x01f3('0x14')][_0x01f3('0x16')]);return _0x2d62bf(_0x4600f3[_0x01f3('0x14')][_0x01f3('0x16')]);}else{logger[_0x01f3('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x49c090,'request\x20sent');_0x2d62bf(_0x4600f3['result']['message']);}})['catch'](function(_0x28f7b9){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x49c090,_0x28f7b9);_0x572101(_0x28f7b9);});});}exports[_0x01f3('0x17')]=function(_0x203f67){var _0x89b8c=this;return new Promise(function(_0x14d4b7,_0x3379ee){return db[_0x01f3('0x18')]['findAll']({'raw':_0x203f67['options']?_0x203f67[_0x01f3('0x19')][_0x01f3('0x1a')]===undefined?!![]:![]:!![],'where':_0x203f67[_0x01f3('0x19')]?_0x203f67[_0x01f3('0x19')][_0x01f3('0x1b')]||null:null,'attributes':_0x203f67[_0x01f3('0x19')]?_0x203f67[_0x01f3('0x19')][_0x01f3('0x1c')]||null:null,'limit':_0x203f67[_0x01f3('0x19')]?_0x203f67[_0x01f3('0x19')]['limit']||null:null,'include':_0x203f67['options']?_0x203f67[_0x01f3('0x19')][_0x01f3('0x1d')]?_['map'](_0x203f67[_0x01f3('0x19')][_0x01f3('0x1d')],function(_0x473d4e){return{'model':db[_0x473d4e[_0x01f3('0x1e')]],'as':_0x473d4e['as'],'attributes':_0x473d4e[_0x01f3('0x1c')],'include':_0x473d4e[_0x01f3('0x1d')]?_[_0x01f3('0x1f')](_0x473d4e['include'],function(_0x3e2ad8){return{'model':db[_0x3e2ad8[_0x01f3('0x1e')]],'as':_0x3e2ad8['as'],'attributes':_0x3e2ad8[_0x01f3('0x1c')],'include':_0x3e2ad8[_0x01f3('0x1d')]?_[_0x01f3('0x1f')](_0x3e2ad8['include'],function(_0x3dab76){return{'model':db[_0x3dab76[_0x01f3('0x1e')]],'as':_0x3dab76['as'],'attributes':_0x3dab76[_0x01f3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31609e){logger[_0x01f3('0x10')]('GetVoiceQueue',_0x203f67);logger[_0x01f3('0x12')]('GetVoiceQueue',_0x203f67,JSON[_0x01f3('0x13')](_0x31609e));_0x14d4b7(_0x31609e);})[_0x01f3('0x20')](function(_0x481314){logger[_0x01f3('0x14')](_0x01f3('0x17'),_0x481314['message'],_0x203f67);_0x3379ee(_0x89b8c[_0x01f3('0x14')](0x1f4,_0x481314['message']));});});};exports['ShowVoiceQueue']=function(_0x3b1409){var _0x30b22b=this;return new Promise(function(_0x395265,_0x3cc7ab){return db['VoiceQueue'][_0x01f3('0x21')]({'raw':_0x3b1409[_0x01f3('0x19')]?_0x3b1409[_0x01f3('0x19')][_0x01f3('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b1409[_0x01f3('0x19')]?_0x3b1409['options'][_0x01f3('0x1b')]||null:null,'attributes':_0x3b1409['options']?_0x3b1409[_0x01f3('0x19')]['attributes']||null:null,'include':_0x3b1409[_0x01f3('0x19')]?_0x3b1409['options'][_0x01f3('0x1d')]?_[_0x01f3('0x1f')](_0x3b1409[_0x01f3('0x19')][_0x01f3('0x1d')],function(_0xf239a3){return{'model':db[_0xf239a3[_0x01f3('0x1e')]],'as':_0xf239a3['as'],'attributes':_0xf239a3['attributes'],'include':_0xf239a3[_0x01f3('0x1d')]?_[_0x01f3('0x1f')](_0xf239a3[_0x01f3('0x1d')],function(_0xe09220){return{'model':db[_0xe09220[_0x01f3('0x1e')]],'as':_0xe09220['as'],'attributes':_0xe09220[_0x01f3('0x1c')],'include':_0xe09220[_0x01f3('0x1d')]?_[_0x01f3('0x1f')](_0xe09220[_0x01f3('0x1d')],function(_0x3fc855){return{'model':db[_0x3fc855[_0x01f3('0x1e')]],'as':_0x3fc855['as'],'attributes':_0x3fc855['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x224644){logger['info']('ShowVoiceQueue',_0x3b1409);logger[_0x01f3('0x12')](_0x01f3('0x22'),_0x3b1409,JSON[_0x01f3('0x13')](_0x224644));_0x395265(_0x224644);})[_0x01f3('0x20')](function(_0x8506d1){logger['error'](_0x01f3('0x22'),_0x8506d1[_0x01f3('0x16')],_0x3b1409);_0x3cc7ab(_0x30b22b[_0x01f3('0x14')](0x1f4,_0x8506d1[_0x01f3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 2e081d3..552bba5 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 _0x2223=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x3b6d62,_0x400296){var _0x4ddeb1=function(_0x1dd714){while(--_0x1dd714){_0x3b6d62['push'](_0x3b6d62['shift']());}};_0x4ddeb1(++_0x400296);}(_0x2223,0x1d1));var _0x3222=function(_0x5e8236,_0x14d6b4){_0x5e8236=_0x5e8236-0x0;var _0x535777=_0x2223[_0x5e8236];return _0x535777;};'use strict';var VoiceQueueEvents=require(_0x3222('0x0'));var events=[_0x3222('0x1'),_0x3222('0x2'),_0x3222('0x3')];function createListener(_0x38e2a4,_0x43b552){return function(_0x28c8c0){_0x43b552[_0x3222('0x4')](_0x38e2a4,_0x28c8c0);};}function removeListener(_0x1ec1d8,_0x5b02bc){return function(){VoiceQueueEvents[_0x3222('0x5')](_0x1ec1d8,_0x5b02bc);};}exports[_0x3222('0x6')]=function(_0x552819){for(var _0x142b26=0x0,_0x43ea57=events[_0x3222('0x7')];_0x142b26<_0x43ea57;_0x142b26++){var _0x2624df=events[_0x142b26];var _0x2bab47=createListener(_0x3222('0x8')+_0x2624df,_0x552819);VoiceQueueEvents['on'](_0x2624df,_0x2bab47);}}; \ No newline at end of file +var _0x46f3=['emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x2baeea,_0xd90238){var _0x52f2b1=function(_0x147439){while(--_0x147439){_0x2baeea['push'](_0x2baeea['shift']());}};_0x52f2b1(++_0xd90238);}(_0x46f3,0x137));var _0x346f=function(_0x4e1186,_0x180bfb){_0x4e1186=_0x4e1186-0x0;var _0x40078e=_0x46f3[_0x4e1186];return _0x40078e;};'use strict';var VoiceQueueEvents=require(_0x346f('0x0'));var events=[_0x346f('0x1'),_0x346f('0x2'),_0x346f('0x3')];function createListener(_0x42bf39,_0x46ae03){return function(_0x2636f5){_0x46ae03[_0x346f('0x4')](_0x42bf39,_0x2636f5);};}function removeListener(_0x292700,_0x1074ce){return function(){VoiceQueueEvents[_0x346f('0x5')](_0x292700,_0x1074ce);};}exports[_0x346f('0x6')]=function(_0x4b5779){for(var _0x213bcf=0x0,_0x126a4c=events[_0x346f('0x7')];_0x213bcf<_0x126a4c;_0x213bcf++){var _0x2e3281=events[_0x213bcf];var _0x1c19cf=createListener(_0x346f('0x8')+_0x2e3281,_0x4b5779);VoiceQueueEvents['on'](_0x2e3281,_0x1c19cf);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 256bd5a..2b120c5 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 _0x9fc0=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/describe','/index','getVoiceQueuesReport','/:id','show','post'];(function(_0x3f9f94,_0x34646f){var _0xa416=function(_0xfb212c){while(--_0xfb212c){_0x3f9f94['push'](_0x3f9f94['shift']());}};_0xa416(++_0x34646f);}(_0x9fc0,0x14f));var _0x09fc=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x9fc0[_0x9307ea];return _0x295554;};'use strict';var multer=require(_0x09fc('0x0'));var util=require(_0x09fc('0x1'));var path=require(_0x09fc('0x2'));var timeout=require(_0x09fc('0x3'));var express=require(_0x09fc('0x4'));var router=express[_0x09fc('0x5')]();var fs_extra=require(_0x09fc('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x09fc('0x7'));var controller=require(_0x09fc('0x8'));router['get']('/',auth[_0x09fc('0x9')](),controller['index']);router[_0x09fc('0xa')](_0x09fc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x09fc('0xa')](_0x09fc('0xc'),auth['isAuthenticated'](),controller[_0x09fc('0xd')]);router[_0x09fc('0xa')](_0x09fc('0xe'),auth['isAuthenticated'](),controller[_0x09fc('0xf')]);router[_0x09fc('0x10')]('/',auth[_0x09fc('0x9')](),controller['create']);router[_0x09fc('0x11')]('/:id',auth[_0x09fc('0x9')](),controller[_0x09fc('0x12')]);router[_0x09fc('0x13')]('/:id',auth[_0x09fc('0x9')](),controller[_0x09fc('0x14')]);module[_0x09fc('0x15')]=router; \ No newline at end of file +var _0x2169=['/index','getVoiceQueuesReport','/:id','show','post','create','delete','multer','util','path','express','Router','fs-extra','./voiceQueueReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x1ff784,_0x16ed43){var _0x5ad957=function(_0xcfdb65){while(--_0xcfdb65){_0x1ff784['push'](_0x1ff784['shift']());}};_0x5ad957(++_0x16ed43);}(_0x2169,0x15d));var _0x9216=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x2169[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x9216('0x0'));var util=require(_0x9216('0x1'));var path=require(_0x9216('0x2'));var timeout=require('connect-timeout');var express=require(_0x9216('0x3'));var router=express[_0x9216('0x4')]();var fs_extra=require(_0x9216('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9216('0x6'));router['get']('/',auth[_0x9216('0x7')](),controller['index']);router[_0x9216('0x8')](_0x9216('0x9'),auth[_0x9216('0x7')](),controller[_0x9216('0xa')]);router[_0x9216('0x8')](_0x9216('0xb'),auth[_0x9216('0x7')](),controller[_0x9216('0xc')]);router[_0x9216('0x8')](_0x9216('0xd'),auth[_0x9216('0x7')](),controller[_0x9216('0xe')]);router[_0x9216('0xf')]('/',auth[_0x9216('0x7')](),controller[_0x9216('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9216('0x11')](_0x9216('0xd'),auth[_0x9216('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 015da1b..2269502 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 _0xf636=['holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt'];(function(_0x5a3c3b,_0x1b9410){var _0x22bc9a=function(_0x12065){while(--_0x12065){_0x5a3c3b['push'](_0x5a3c3b['shift']());}};_0x22bc9a(++_0x1b9410);}(_0xf636,0x16b));var _0x6f63=function(_0x5981fc,_0x576008){_0x5981fc=_0x5981fc-0x0;var _0x5147b8=_0xf636[_0x5981fc];return _0x5147b8;};'use strict';var Sequelize=require(_0x6f63('0x0'));var moment=require(_0x6f63('0x1'));module[_0x6f63('0x2')]={'type':{'type':Sequelize[_0x6f63('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6f63('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3c20da){var _0x50b5ef=moment(_0x3c20da);var _0x5e5043=moment(this[_0x6f63('0x4')](_0x6f63('0x5')))[_0x6f63('0x6')](_0x6f63('0x7'));var _0x8980b4=_0x50b5ef['diff'](_0x5e5043,_0x6f63('0x8'));this[_0x6f63('0x9')](_0x6f63('0xa'),_0x3c20da);this[_0x6f63('0x9')](_0x6f63('0xb'),_0x8980b4||null);}},'position':{'type':Sequelize[_0x6f63('0xc')]},'count':{'type':Sequelize[_0x6f63('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x6f63('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6f63('0xe')]},'queuecallercomplete':{'type':Sequelize[_0x6f63('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6f63('0xe')]},'queuecallerexit':{'type':Sequelize[_0x6f63('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6f63('0xe')]},'queuecallerexitreason':{'type':Sequelize[_0x6f63('0x3')],'comment':_0x6f63('0xf')},'originalposition':{'type':Sequelize[_0x6f63('0xc')]},'channel':{'type':Sequelize[_0x6f63('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6f63('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6f63('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6f63('0x3')]},'holdtime':{'type':Sequelize[_0x6f63('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6f63('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6f63('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x6f63('0x10')},'transferexten':{'type':Sequelize[_0x6f63('0x3')]},'transferuniqueid':{'type':Sequelize[_0x6f63('0x3')]},'disposition':{'type':Sequelize[_0x6f63('0x3')]},'secondDisposition':{'type':Sequelize[_0x6f63('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6f63('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x6f63('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3860=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x22ac92,_0x5b15e8){var _0x489cde=function(_0xa927cf){while(--_0xa927cf){_0x22ac92['push'](_0x22ac92['shift']());}};_0x489cde(++_0x5b15e8);}(_0x3860,0x10c));var _0x0386=function(_0x5a5305,_0x20ded6){_0x5a5305=_0x5a5305-0x0;var _0x4227e8=_0x3860[_0x5a5305];return _0x4227e8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0386('0x0'));module[_0x0386('0x1')]={'type':{'type':Sequelize[_0x0386('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0386('0x2')]},'calleridname':{'type':Sequelize[_0x0386('0x2')]},'queue':{'type':Sequelize[_0x0386('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0386('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x14594f){var _0x38cfc2=moment(_0x14594f);var _0x2d1a8e=moment(this[_0x0386('0x4')]('queuecallerjoinAt'))[_0x0386('0x5')](_0x0386('0x6'));var _0x130b09=_0x38cfc2['diff'](_0x2d1a8e,_0x0386('0x7'));this['setDataValue'](_0x0386('0x8'),_0x14594f);this['setDataValue'](_0x0386('0x9'),_0x130b09||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x0386('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x0386('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0386('0x3')]},'queuecallerexit':{'type':Sequelize[_0x0386('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x0386('0x2')],'comment':_0x0386('0xb')},'originalposition':{'type':Sequelize[_0x0386('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0386('0x2')]},'accountcode':{'type':Sequelize[_0x0386('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0386('0x2')]},'priority':{'type':Sequelize[_0x0386('0x2')]},'holdtime':{'type':Sequelize[_0x0386('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0386('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0386('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0386('0x2')],'comment':_0x0386('0xd')},'transferexten':{'type':Sequelize[_0x0386('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0386('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0386('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 045ca29..ca27677 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 _0xec86=['socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','VoiceQueueReport','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','rawAttributes','length','include','find','create','body','params','describe','getVoiceQueuesReport','findAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost'];(function(_0x530827,_0x6b6943){var _0x4c07c4=function(_0xb274af){while(--_0xb274af){_0x530827['push'](_0x530827['shift']());}};_0x4c07c4(++_0x6b6943);}(_0xec86,0xe3));var _0x6ec8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xec86[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x6ec8('0x0'));var rimraf=require(_0x6ec8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ec8('0x2'));var rp=require('request-promise');var moment=require(_0x6ec8('0x3'));var BPromise=require(_0x6ec8('0x4'));var Mustache=require(_0x6ec8('0x5'));var util=require(_0x6ec8('0x6'));var path=require(_0x6ec8('0x7'));var sox=require(_0x6ec8('0x8'));var csv=require('to-csv');var ejs=require(_0x6ec8('0x9'));var fs=require('fs');var fs_extra=require(_0x6ec8('0xa'));var _=require(_0x6ec8('0xb'));var squel=require(_0x6ec8('0xc'));var crypto=require('crypto');var jsforce=require(_0x6ec8('0xd'));var deskjs=require(_0x6ec8('0xe'));var toCsv=require(_0x6ec8('0xf'));var querystring=require(_0x6ec8('0x10'));var Papa=require(_0x6ec8('0x11'));var Redis=require(_0x6ec8('0x12'));var authService=require(_0x6ec8('0x13'));var qs=require(_0x6ec8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ec8('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6ec8('0x16'));var licenseUtil=require(_0x6ec8('0x17'));var db=require(_0x6ec8('0x18'))['db'];config['redis']=_[_0x6ec8('0x19')](config[_0x6ec8('0x1a')],{'host':_0x6ec8('0x1b'),'port':0x18eb});var socket=require(_0x6ec8('0x1c'))(new Redis(config['redis']));require(_0x6ec8('0x1d'))[_0x6ec8('0x1e')](socket);function respondWithStatusCode(_0x17d2f2,_0x54f7f8){_0x54f7f8=_0x54f7f8||0xcc;return function(_0xcb76fd){if(_0xcb76fd){return _0x17d2f2[_0x6ec8('0x1f')](_0x54f7f8);}return _0x17d2f2[_0x6ec8('0x20')](_0x54f7f8)[_0x6ec8('0x21')]();};}function respondWithResult(_0x4fc13d,_0x5b24fa){_0x5b24fa=_0x5b24fa||0xc8;return function(_0x38ba95){if(_0x38ba95){return _0x4fc13d[_0x6ec8('0x20')](_0x5b24fa)[_0x6ec8('0x22')](_0x38ba95);}};}function respondWithFilteredResult(_0x2ebe09,_0x401504){return function(_0x265691){if(_0x265691){var _0x416dd4=typeof _0x401504[_0x6ec8('0x23')]===_0x6ec8('0x24')&&typeof _0x401504[_0x6ec8('0x25')]===_0x6ec8('0x24');var _0x1ac7a6=_0x265691[_0x6ec8('0x26')];var _0x48bbe9=_0x416dd4?0x0:_0x401504[_0x6ec8('0x23')];var _0x5ebf9a=_0x416dd4?_0x265691['count']:_0x401504[_0x6ec8('0x23')]+_0x401504[_0x6ec8('0x25')];var _0x25ad19;if(_0x5ebf9a>=_0x1ac7a6){_0x5ebf9a=_0x1ac7a6;_0x25ad19=0xc8;}else{_0x25ad19=0xce;}_0x2ebe09['status'](_0x25ad19);return _0x2ebe09[_0x6ec8('0x27')](_0x6ec8('0x28'),_0x48bbe9+'-'+_0x5ebf9a+'/'+_0x1ac7a6)[_0x6ec8('0x22')](_0x265691);}return null;};}function patchUpdates(_0x1728c9){return function(_0x337c3f){try{jsonpatch[_0x6ec8('0x29')](_0x337c3f,_0x1728c9,!![]);}catch(_0x5b8adc){return BPromise[_0x6ec8('0x2a')](_0x5b8adc);}return _0x337c3f[_0x6ec8('0x2b')]();};}function saveUpdates(_0x38b1b8,_0x53979e){return function(_0x5d81de){if(_0x5d81de){return _0x5d81de[_0x6ec8('0x2c')](_0x38b1b8)[_0x6ec8('0x2d')](function(_0x8380b0){return _0x8380b0;});}return null;};}function removeEntity(_0x46698c,_0x119512){return function(_0x54e635){if(_0x54e635){return _0x54e635['destroy']()[_0x6ec8('0x2d')](function(){_0x46698c['status'](0xcc)[_0x6ec8('0x21')]();});}};}function handleEntityNotFound(_0x4f9578,_0xe36edc){return function(_0x2e2426){if(!_0x2e2426){_0x4f9578[_0x6ec8('0x1f')](0x194);}return _0x2e2426;};}function handleError(_0x6d1445,_0x44c172){_0x44c172=_0x44c172||0x1f4;return function(_0x658873){logger[_0x6ec8('0x2e')](_0x658873['stack']);if(_0x658873[_0x6ec8('0x2f')]){delete _0x658873[_0x6ec8('0x2f')];}_0x6d1445['status'](_0x44c172)[_0x6ec8('0x30')](_0x658873);};}exports[_0x6ec8('0x31')]=function(_0x39dfa1,_0x2ce504){var _0x18c50c={},_0x46c0a3={},_0x49921a={'count':0x0,'rows':[]};var _0x58f62a=_['map'](db[_0x6ec8('0x32')]['rawAttributes'],function(_0x29965d){return{'name':_0x29965d[_0x6ec8('0x33')],'type':_0x29965d[_0x6ec8('0x34')][_0x6ec8('0x35')]};});_0x46c0a3['model']=_[_0x6ec8('0x36')](_0x58f62a,'name');_0x46c0a3[_0x6ec8('0x37')]=_[_0x6ec8('0x38')](_0x39dfa1['query']);_0x46c0a3['filters']=_[_0x6ec8('0x39')](_0x46c0a3[_0x6ec8('0x3a')],_0x46c0a3['query']);_0x18c50c[_0x6ec8('0x3b')]=_[_0x6ec8('0x39')](_0x46c0a3[_0x6ec8('0x3a')],qs[_0x6ec8('0x3c')](_0x39dfa1[_0x6ec8('0x37')][_0x6ec8('0x3c')]));_0x18c50c[_0x6ec8('0x3b')]=_0x18c50c[_0x6ec8('0x3b')]['length']?_0x18c50c[_0x6ec8('0x3b')]:_0x46c0a3[_0x6ec8('0x3a')];if(!_0x39dfa1[_0x6ec8('0x37')][_0x6ec8('0x3d')](_0x6ec8('0x3e'))){_0x18c50c['limit']=qs[_0x6ec8('0x25')](_0x39dfa1[_0x6ec8('0x37')][_0x6ec8('0x25')]);_0x18c50c[_0x6ec8('0x23')]=qs['offset'](_0x39dfa1[_0x6ec8('0x37')][_0x6ec8('0x23')]);}_0x18c50c[_0x6ec8('0x3f')]=qs['sort'](_0x39dfa1[_0x6ec8('0x37')]['sort']);_0x18c50c[_0x6ec8('0x40')]=qs[_0x6ec8('0x41')](_[_0x6ec8('0x42')](_0x39dfa1[_0x6ec8('0x37')],_0x46c0a3['filters']),_0x58f62a);if(_0x39dfa1[_0x6ec8('0x37')][_0x6ec8('0x43')]){_0x18c50c['where']=_[_0x6ec8('0x44')](_0x18c50c[_0x6ec8('0x40')],{'$or':_[_0x6ec8('0x36')](_0x58f62a,function(_0x4514e7){if(_0x4514e7[_0x6ec8('0x34')]!==_0x6ec8('0x45')){var _0x3be016={};_0x3be016[_0x4514e7[_0x6ec8('0x2f')]]={'$like':'%'+_0x39dfa1['query'][_0x6ec8('0x43')]+'%'};return _0x3be016;}})});}_0x18c50c=_[_0x6ec8('0x44')]({},_0x18c50c,_0x39dfa1[_0x6ec8('0x46')]);var _0x12bdd5={'where':_0x18c50c[_0x6ec8('0x40')]};return db['VoiceQueueReport'][_0x6ec8('0x26')](_0x12bdd5)[_0x6ec8('0x2d')](function(_0x5cfdd8){_0x49921a[_0x6ec8('0x26')]=_0x5cfdd8;if(_0x39dfa1[_0x6ec8('0x37')][_0x6ec8('0x47')]){_0x18c50c['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x18c50c);})[_0x6ec8('0x2d')](function(_0x5a2836){_0x49921a[_0x6ec8('0x48')]=_0x5a2836;return _0x49921a;})[_0x6ec8('0x2d')](respondWithFilteredResult(_0x2ce504,_0x18c50c))[_0x6ec8('0x49')](handleError(_0x2ce504,null));};exports[_0x6ec8('0x4a')]=function(_0x1b304c,_0x30e77f){var _0x315b8d={'raw':![],'where':{'id':_0x1b304c['params']['id']}},_0x197eed={};_0x197eed['model']=_[_0x6ec8('0x38')](db['VoiceQueueReport'][_0x6ec8('0x4b')]);_0x197eed[_0x6ec8('0x37')]=_[_0x6ec8('0x38')](_0x1b304c['query']);_0x197eed[_0x6ec8('0x41')]=_[_0x6ec8('0x39')](_0x197eed[_0x6ec8('0x3a')],_0x197eed[_0x6ec8('0x37')]);_0x315b8d[_0x6ec8('0x3b')]=_['intersection'](_0x197eed['model'],qs[_0x6ec8('0x3c')](_0x1b304c[_0x6ec8('0x37')][_0x6ec8('0x3c')]));_0x315b8d[_0x6ec8('0x3b')]=_0x315b8d['attributes'][_0x6ec8('0x4c')]?_0x315b8d[_0x6ec8('0x3b')]:_0x197eed[_0x6ec8('0x3a')];if(_0x1b304c[_0x6ec8('0x37')][_0x6ec8('0x47')]){_0x315b8d[_0x6ec8('0x4d')]=[{'all':!![]}];}_0x315b8d=_[_0x6ec8('0x44')]({},_0x315b8d,_0x1b304c[_0x6ec8('0x46')]);return db[_0x6ec8('0x32')][_0x6ec8('0x4e')](_0x315b8d)['then'](handleEntityNotFound(_0x30e77f,null))[_0x6ec8('0x2d')](respondWithResult(_0x30e77f,null))[_0x6ec8('0x49')](handleError(_0x30e77f,null));};exports['create']=function(_0x47b72a,_0x5bc9d0){return db[_0x6ec8('0x32')][_0x6ec8('0x4f')](_0x47b72a['body'],{})[_0x6ec8('0x2d')](respondWithResult(_0x5bc9d0,0xc9))[_0x6ec8('0x49')](handleError(_0x5bc9d0,null));};exports[_0x6ec8('0x2c')]=function(_0x1fcfd1,_0x4a43aa){if(_0x1fcfd1[_0x6ec8('0x50')]['id']){delete _0x1fcfd1['body']['id'];}return db[_0x6ec8('0x32')][_0x6ec8('0x4e')]({'where':{'id':_0x1fcfd1[_0x6ec8('0x51')]['id']}})[_0x6ec8('0x2d')](handleEntityNotFound(_0x4a43aa,null))[_0x6ec8('0x2d')](saveUpdates(_0x1fcfd1['body'],null))[_0x6ec8('0x2d')](respondWithResult(_0x4a43aa,null))[_0x6ec8('0x49')](handleError(_0x4a43aa,null));};exports['destroy']=function(_0x5a4779,_0x5c67f4){return db[_0x6ec8('0x32')][_0x6ec8('0x4e')]({'where':{'id':_0x5a4779[_0x6ec8('0x51')]['id']}})[_0x6ec8('0x2d')](handleEntityNotFound(_0x5c67f4,null))[_0x6ec8('0x2d')](removeEntity(_0x5c67f4,null))['catch'](handleError(_0x5c67f4,null));};exports[_0x6ec8('0x52')]=function(_0x4e3e10,_0x2e5692){return db[_0x6ec8('0x32')][_0x6ec8('0x52')]()[_0x6ec8('0x2d')](respondWithResult(_0x2e5692,null))['catch'](handleError(_0x2e5692,null));};exports[_0x6ec8('0x53')]=function(_0x451197,_0x3e1840){var _0x703ca1={},_0x4a0196={},_0x1b4b22={'count':0x0,'rows':[]};_0x4a0196[_0x6ec8('0x3a')]=_['keys'](db['VoiceQueueReport'][_0x6ec8('0x4b')]);_0x4a0196[_0x6ec8('0x37')]=_[_0x6ec8('0x38')](_0x451197[_0x6ec8('0x37')]);_0x4a0196[_0x6ec8('0x41')]=_[_0x6ec8('0x39')](_0x4a0196[_0x6ec8('0x3a')],_0x4a0196[_0x6ec8('0x37')]);_0x703ca1['attributes']=_[_0x6ec8('0x39')](_0x4a0196[_0x6ec8('0x3a')],qs['fields'](_0x451197[_0x6ec8('0x37')][_0x6ec8('0x3c')]));_0x703ca1[_0x6ec8('0x3b')]=_0x703ca1[_0x6ec8('0x3b')][_0x6ec8('0x4c')]?_0x703ca1['attributes']:_0x4a0196[_0x6ec8('0x3a')];if(!_0x451197[_0x6ec8('0x37')]['hasOwnProperty'](_0x6ec8('0x3e'))){_0x703ca1[_0x6ec8('0x25')]=qs[_0x6ec8('0x25')](_0x451197[_0x6ec8('0x37')][_0x6ec8('0x25')]);_0x703ca1[_0x6ec8('0x23')]=qs[_0x6ec8('0x23')](_0x451197[_0x6ec8('0x37')][_0x6ec8('0x23')]);}_0x703ca1[_0x6ec8('0x3f')]=qs['sort'](_0x451197['query']['sort']);_0x703ca1[_0x6ec8('0x40')]=qs[_0x6ec8('0x41')](_[_0x6ec8('0x42')](_0x451197[_0x6ec8('0x37')],_0x4a0196[_0x6ec8('0x41')]));if(_0x451197[_0x6ec8('0x37')][_0x6ec8('0x43')]){_0x703ca1[_0x6ec8('0x40')]=_[_0x6ec8('0x44')](_0x703ca1['where'],{'$or':_[_0x6ec8('0x36')](_0x703ca1['attributes'],function(_0x584d67){var _0xca4cf9={};_0xca4cf9[_0x584d67]={'$like':'%'+_0x451197[_0x6ec8('0x37')][_0x6ec8('0x43')]+'%'};return _0xca4cf9;})});}_0x703ca1=_[_0x6ec8('0x44')]({},_0x703ca1,_0x451197[_0x6ec8('0x46')]);var _0x3983e2={'where':_0x703ca1[_0x6ec8('0x40')]};return db[_0x6ec8('0x32')][_0x6ec8('0x26')](_0x3983e2)[_0x6ec8('0x2d')](function(_0x4f2835){_0x1b4b22['count']=_0x4f2835;if(_0x451197['query']['includeAll']){_0x703ca1[_0x6ec8('0x4d')]=[{'all':!![]}];}return db[_0x6ec8('0x32')][_0x6ec8('0x54')](_0x703ca1);})[_0x6ec8('0x2d')](function(_0x59a7fa){_0x1b4b22[_0x6ec8('0x48')]=_0x59a7fa;return _0x1b4b22;})[_0x6ec8('0x2d')](respondWithFilteredResult(_0x3e1840,_0x703ca1,_0x6ec8('0x53')))['catch'](handleError(_0x3e1840,null,_0x6ec8('0x53')));}; \ No newline at end of file +var _0x32b2=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','VoiceQueueReport','includeAll','findAll','params','include','options','find','catch','create','body','describe','getVoiceQueuesReport','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status'];(function(_0xaa0356,_0x4d58a8){var _0x21c861=function(_0x152591){while(--_0x152591){_0xaa0356['push'](_0xaa0356['shift']());}};_0x21c861(++_0x4d58a8);}(_0x32b2,0x190));var _0x232b=function(_0x3158d2,_0x277d23){_0x3158d2=_0x3158d2-0x0;var _0x57c15a=_0x32b2[_0x3158d2];return _0x57c15a;};'use strict';var emlformat=require(_0x232b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x232b('0x1'));var jsonpatch=require(_0x232b('0x2'));var rp=require(_0x232b('0x3'));var moment=require(_0x232b('0x4'));var BPromise=require(_0x232b('0x5'));var Mustache=require(_0x232b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x232b('0x7'));var csv=require(_0x232b('0x8'));var ejs=require(_0x232b('0x9'));var fs=require('fs');var fs_extra=require(_0x232b('0xa'));var _=require(_0x232b('0xb'));var squel=require('squel');var crypto=require(_0x232b('0xc'));var jsforce=require(_0x232b('0xd'));var deskjs=require(_0x232b('0xe'));var toCsv=require(_0x232b('0x8'));var querystring=require(_0x232b('0xf'));var Papa=require(_0x232b('0x10'));var Redis=require(_0x232b('0x11'));var authService=require(_0x232b('0x12'));var qs=require(_0x232b('0x13'));var as=require(_0x232b('0x14'));var hardwareService=require(_0x232b('0x15'));var logger=require(_0x232b('0x16'))(_0x232b('0x17'));var utils=require(_0x232b('0x18'));var config=require(_0x232b('0x19'));var licenseUtil=require(_0x232b('0x1a'));var db=require(_0x232b('0x1b'))['db'];config[_0x232b('0x1c')]=_['defaults'](config[_0x232b('0x1c')],{'host':_0x232b('0x1d'),'port':0x18eb});var socket=require(_0x232b('0x1e'))(new Redis(config[_0x232b('0x1c')]));require(_0x232b('0x1f'))[_0x232b('0x20')](socket);function respondWithStatusCode(_0x536634,_0x1971c1){_0x1971c1=_0x1971c1||0xcc;return function(_0x20a5be){if(_0x20a5be){return _0x536634[_0x232b('0x21')](_0x1971c1);}return _0x536634[_0x232b('0x22')](_0x1971c1)['end']();};}function respondWithResult(_0x4fef1e,_0x229a20){_0x229a20=_0x229a20||0xc8;return function(_0x2f0c00){if(_0x2f0c00){return _0x4fef1e[_0x232b('0x22')](_0x229a20)[_0x232b('0x23')](_0x2f0c00);}};}function respondWithFilteredResult(_0xfcf8cd,_0x1dd223){return function(_0xd661d5){if(_0xd661d5){var _0x46c42e=typeof _0x1dd223[_0x232b('0x24')]===_0x232b('0x25')&&typeof _0x1dd223['limit']===_0x232b('0x25');var _0x31d669=_0xd661d5['count'];var _0x177470=_0x46c42e?0x0:_0x1dd223[_0x232b('0x24')];var _0x463c67=_0x46c42e?_0xd661d5[_0x232b('0x26')]:_0x1dd223[_0x232b('0x24')]+_0x1dd223[_0x232b('0x27')];var _0x419e20;if(_0x463c67>=_0x31d669){_0x463c67=_0x31d669;_0x419e20=0xc8;}else{_0x419e20=0xce;}_0xfcf8cd[_0x232b('0x22')](_0x419e20);return _0xfcf8cd[_0x232b('0x28')](_0x232b('0x29'),_0x177470+'-'+_0x463c67+'/'+_0x31d669)[_0x232b('0x23')](_0xd661d5);}return null;};}function patchUpdates(_0x1fa52f){return function(_0x183e07){try{jsonpatch[_0x232b('0x2a')](_0x183e07,_0x1fa52f,!![]);}catch(_0x487a91){return BPromise[_0x232b('0x2b')](_0x487a91);}return _0x183e07[_0x232b('0x2c')]();};}function saveUpdates(_0x85e606,_0x139f2c){return function(_0x519d6f){if(_0x519d6f){return _0x519d6f['update'](_0x85e606)[_0x232b('0x2d')](function(_0x1326fa){return _0x1326fa;});}return null;};}function removeEntity(_0xb1cb6a,_0x2d21ac){return function(_0x4a720a){if(_0x4a720a){return _0x4a720a[_0x232b('0x2e')]()[_0x232b('0x2d')](function(){_0xb1cb6a[_0x232b('0x22')](0xcc)[_0x232b('0x2f')]();});}};}function handleEntityNotFound(_0x29fa1d,_0x3e3f37){return function(_0x20581f){if(!_0x20581f){_0x29fa1d[_0x232b('0x21')](0x194);}return _0x20581f;};}function handleError(_0x32dd9e,_0x43b947){_0x43b947=_0x43b947||0x1f4;return function(_0x7c45d1){logger[_0x232b('0x30')](_0x7c45d1[_0x232b('0x31')]);if(_0x7c45d1['name']){delete _0x7c45d1[_0x232b('0x32')];}_0x32dd9e['status'](_0x43b947)[_0x232b('0x33')](_0x7c45d1);};}exports[_0x232b('0x34')]=function(_0x441dd7,_0x298a20){var _0x326848={},_0x5cb1b5={},_0x162511={'count':0x0,'rows':[]};var _0x19dd15=_['map'](db['VoiceQueueReport'][_0x232b('0x35')],function(_0x260530){return{'name':_0x260530[_0x232b('0x36')],'type':_0x260530['type'][_0x232b('0x37')]};});_0x5cb1b5[_0x232b('0x38')]=_[_0x232b('0x39')](_0x19dd15,'name');_0x5cb1b5[_0x232b('0x3a')]=_[_0x232b('0x3b')](_0x441dd7[_0x232b('0x3a')]);_0x5cb1b5['filters']=_[_0x232b('0x3c')](_0x5cb1b5['model'],_0x5cb1b5[_0x232b('0x3a')]);_0x326848[_0x232b('0x3d')]=_['intersection'](_0x5cb1b5[_0x232b('0x38')],qs[_0x232b('0x3e')](_0x441dd7[_0x232b('0x3a')]['fields']));_0x326848[_0x232b('0x3d')]=_0x326848[_0x232b('0x3d')][_0x232b('0x3f')]?_0x326848[_0x232b('0x3d')]:_0x5cb1b5[_0x232b('0x38')];if(!_0x441dd7[_0x232b('0x3a')][_0x232b('0x40')](_0x232b('0x41'))){_0x326848['limit']=qs[_0x232b('0x27')](_0x441dd7[_0x232b('0x3a')]['limit']);_0x326848[_0x232b('0x24')]=qs[_0x232b('0x24')](_0x441dd7[_0x232b('0x3a')][_0x232b('0x24')]);}_0x326848[_0x232b('0x42')]=qs[_0x232b('0x43')](_0x441dd7['query'][_0x232b('0x43')]);_0x326848[_0x232b('0x44')]=qs['filters'](_[_0x232b('0x45')](_0x441dd7[_0x232b('0x3a')],_0x5cb1b5[_0x232b('0x46')]),_0x19dd15);if(_0x441dd7[_0x232b('0x3a')][_0x232b('0x47')]){_0x326848[_0x232b('0x44')]=_[_0x232b('0x48')](_0x326848[_0x232b('0x44')],{'$or':_['map'](_0x19dd15,function(_0xca9759){if(_0xca9759['type']!==_0x232b('0x49')){var _0x5d2ab9={};_0x5d2ab9[_0xca9759[_0x232b('0x32')]]={'$like':'%'+_0x441dd7[_0x232b('0x3a')][_0x232b('0x47')]+'%'};return _0x5d2ab9;}})});}_0x326848=_['merge']({},_0x326848,_0x441dd7['options']);var _0x55a504={'where':_0x326848[_0x232b('0x44')]};return db[_0x232b('0x4a')][_0x232b('0x26')](_0x55a504)[_0x232b('0x2d')](function(_0x2a2ec6){_0x162511[_0x232b('0x26')]=_0x2a2ec6;if(_0x441dd7['query'][_0x232b('0x4b')]){_0x326848['include']=[{'all':!![]}];}return db[_0x232b('0x4a')][_0x232b('0x4c')](_0x326848);})['then'](function(_0x27c0cc){_0x162511['rows']=_0x27c0cc;return _0x162511;})[_0x232b('0x2d')](respondWithFilteredResult(_0x298a20,_0x326848))['catch'](handleError(_0x298a20,null));};exports['show']=function(_0x241ac2,_0xef4cee){var _0x20c64d={'raw':![],'where':{'id':_0x241ac2[_0x232b('0x4d')]['id']}},_0x521e05={};_0x521e05[_0x232b('0x38')]=_[_0x232b('0x3b')](db[_0x232b('0x4a')][_0x232b('0x35')]);_0x521e05[_0x232b('0x3a')]=_[_0x232b('0x3b')](_0x241ac2[_0x232b('0x3a')]);_0x521e05['filters']=_[_0x232b('0x3c')](_0x521e05['model'],_0x521e05['query']);_0x20c64d[_0x232b('0x3d')]=_['intersection'](_0x521e05[_0x232b('0x38')],qs['fields'](_0x241ac2['query'][_0x232b('0x3e')]));_0x20c64d[_0x232b('0x3d')]=_0x20c64d[_0x232b('0x3d')][_0x232b('0x3f')]?_0x20c64d[_0x232b('0x3d')]:_0x521e05['model'];if(_0x241ac2[_0x232b('0x3a')][_0x232b('0x4b')]){_0x20c64d[_0x232b('0x4e')]=[{'all':!![]}];}_0x20c64d=_[_0x232b('0x48')]({},_0x20c64d,_0x241ac2[_0x232b('0x4f')]);return db['VoiceQueueReport'][_0x232b('0x50')](_0x20c64d)[_0x232b('0x2d')](handleEntityNotFound(_0xef4cee,null))[_0x232b('0x2d')](respondWithResult(_0xef4cee,null))[_0x232b('0x51')](handleError(_0xef4cee,null));};exports[_0x232b('0x52')]=function(_0x252a11,_0x260858){return db['VoiceQueueReport'][_0x232b('0x52')](_0x252a11['body'],{})[_0x232b('0x2d')](respondWithResult(_0x260858,0xc9))[_0x232b('0x51')](handleError(_0x260858,null));};exports['update']=function(_0xf54e27,_0x3b3903){if(_0xf54e27[_0x232b('0x53')]['id']){delete _0xf54e27[_0x232b('0x53')]['id'];}return db[_0x232b('0x4a')]['find']({'where':{'id':_0xf54e27[_0x232b('0x4d')]['id']}})[_0x232b('0x2d')](handleEntityNotFound(_0x3b3903,null))[_0x232b('0x2d')](saveUpdates(_0xf54e27[_0x232b('0x53')],null))[_0x232b('0x2d')](respondWithResult(_0x3b3903,null))[_0x232b('0x51')](handleError(_0x3b3903,null));};exports[_0x232b('0x2e')]=function(_0x4fa587,_0x50fa5e){return db['VoiceQueueReport'][_0x232b('0x50')]({'where':{'id':_0x4fa587['params']['id']}})[_0x232b('0x2d')](handleEntityNotFound(_0x50fa5e,null))[_0x232b('0x2d')](removeEntity(_0x50fa5e,null))[_0x232b('0x51')](handleError(_0x50fa5e,null));};exports[_0x232b('0x54')]=function(_0x4ea4b4,_0x481a4c){return db[_0x232b('0x4a')][_0x232b('0x54')]()[_0x232b('0x2d')](respondWithResult(_0x481a4c,null))[_0x232b('0x51')](handleError(_0x481a4c,null));};exports[_0x232b('0x55')]=function(_0x3de120,_0x35da87){var _0x33eb8a={},_0xba9ed7={},_0x576824={'count':0x0,'rows':[]};_0xba9ed7[_0x232b('0x38')]=_['keys'](db[_0x232b('0x4a')][_0x232b('0x35')]);_0xba9ed7['query']=_[_0x232b('0x3b')](_0x3de120[_0x232b('0x3a')]);_0xba9ed7[_0x232b('0x46')]=_[_0x232b('0x3c')](_0xba9ed7[_0x232b('0x38')],_0xba9ed7[_0x232b('0x3a')]);_0x33eb8a[_0x232b('0x3d')]=_[_0x232b('0x3c')](_0xba9ed7[_0x232b('0x38')],qs[_0x232b('0x3e')](_0x3de120['query']['fields']));_0x33eb8a[_0x232b('0x3d')]=_0x33eb8a['attributes'][_0x232b('0x3f')]?_0x33eb8a[_0x232b('0x3d')]:_0xba9ed7[_0x232b('0x38')];if(!_0x3de120['query'][_0x232b('0x40')](_0x232b('0x41'))){_0x33eb8a[_0x232b('0x27')]=qs['limit'](_0x3de120['query'][_0x232b('0x27')]);_0x33eb8a[_0x232b('0x24')]=qs[_0x232b('0x24')](_0x3de120[_0x232b('0x3a')][_0x232b('0x24')]);}_0x33eb8a[_0x232b('0x42')]=qs[_0x232b('0x43')](_0x3de120[_0x232b('0x3a')][_0x232b('0x43')]);_0x33eb8a[_0x232b('0x44')]=qs['filters'](_[_0x232b('0x45')](_0x3de120[_0x232b('0x3a')],_0xba9ed7[_0x232b('0x46')]));if(_0x3de120[_0x232b('0x3a')][_0x232b('0x47')]){_0x33eb8a[_0x232b('0x44')]=_[_0x232b('0x48')](_0x33eb8a[_0x232b('0x44')],{'$or':_[_0x232b('0x39')](_0x33eb8a[_0x232b('0x3d')],function(_0x2a4d15){var _0x2c90ef={};_0x2c90ef[_0x2a4d15]={'$like':'%'+_0x3de120[_0x232b('0x3a')][_0x232b('0x47')]+'%'};return _0x2c90ef;})});}_0x33eb8a=_[_0x232b('0x48')]({},_0x33eb8a,_0x3de120[_0x232b('0x4f')]);var _0x1469c={'where':_0x33eb8a[_0x232b('0x44')]};return db[_0x232b('0x4a')]['count'](_0x1469c)[_0x232b('0x2d')](function(_0x31f658){_0x576824['count']=_0x31f658;if(_0x3de120['query'][_0x232b('0x4b')]){_0x33eb8a[_0x232b('0x4e')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x232b('0x4c')](_0x33eb8a);})[_0x232b('0x2d')](function(_0x40ae7f){_0x576824[_0x232b('0x56')]=_0x40ae7f;return _0x576824;})[_0x232b('0x2d')](respondWithFilteredResult(_0x35da87,_0x33eb8a,_0x232b('0x55')))[_0x232b('0x51')](handleError(_0x35da87,null,_0x232b('0x55')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3f8a7b1..6ca085e 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 _0x2ad3=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','hook','exports'];(function(_0x141a90,_0x592251){var _0x5637a1=function(_0x33fac5){while(--_0x33fac5){_0x141a90['push'](_0x141a90['shift']());}};_0x5637a1(++_0x592251);}(_0x2ad3,0xb8));var _0x32ad=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x2ad3[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require(_0x32ad('0x0'));var VoiceQueueReport=require(_0x32ad('0x1'))['db'][_0x32ad('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x32ad('0x3')](0x0);var events={'afterCreate':_0x32ad('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x339846){return function(_0x4999ad,_0x195e46,_0x5b3d94){VoiceQueueReportEvents[_0x32ad('0x5')](_0x339846+':'+_0x4999ad['id'],_0x4999ad);VoiceQueueReportEvents[_0x32ad('0x5')](_0x339846,_0x4999ad);_0x5b3d94(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x32ad('0x6')](e,emitEvent(event));}}module[_0x32ad('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x67d3=['exports','events','../../mysqldb','VoiceQueueReport','save','update','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x67d3,0x191));var _0x367d=function(_0x473185,_0x25a0f4){_0x473185=_0x473185-0x0;var _0x33e569=_0x67d3[_0x473185];return _0x33e569;};'use strict';var EventEmitter=require(_0x367d('0x0'));var VoiceQueueReport=require(_0x367d('0x1'))['db'][_0x367d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x367d('0x3'),'afterUpdate':_0x367d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5954db){return function(_0x2a1ba7,_0x8a98af,_0x1d3969){VoiceQueueReportEvents[_0x367d('0x5')](_0x5954db+':'+_0x2a1ba7['id'],_0x2a1ba7);VoiceQueueReportEvents[_0x367d('0x5')](_0x5954db,_0x2a1ba7);_0x1d3969(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x367d('0x6')](e,emitEvent(event));}}module[_0x367d('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index a8d0622..72e9e33 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 _0xf604=['util','../../config/logger','api','bluebird','path','rimraf','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash'];(function(_0xe9637,_0x4343ba){var _0x41162c=function(_0x113a73){while(--_0x113a73){_0xe9637['push'](_0xe9637['shift']());}};_0x41162c(++_0x4343ba);}(_0xf604,0xdc));var _0x4f60=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xf604[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x4f60('0x0'));var util=require(_0x4f60('0x1'));var logger=require(_0x4f60('0x2'))(_0x4f60('0x3'));var moment=require('moment');var BPromise=require(_0x4f60('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f60('0x5'));var rimraf=require(_0x4f60('0x6'));var config=require('../../config/environment');var attributes=require(_0x4f60('0x7'));module[_0x4f60('0x8')]=function(_0x554459,_0x15b305){return _0x554459[_0x4f60('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x4f60('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4f60('0xb')]},{'fields':[_0x4f60('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x728d=['uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x2c01e9,_0x352585){var _0x224176=function(_0x25da45){while(--_0x25da45){_0x2c01e9['push'](_0x2c01e9['shift']());}};_0x224176(++_0x352585);}(_0x728d,0x1c2));var _0xd728=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x728d[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0xd728('0x0'));var util=require(_0xd728('0x1'));var logger=require(_0xd728('0x2'))(_0xd728('0x3'));var moment=require(_0xd728('0x4'));var BPromise=require(_0xd728('0x5'));var rp=require(_0xd728('0x6'));var fs=require('fs');var path=require(_0xd728('0x7'));var rimraf=require('rimraf');var config=require(_0xd728('0x8'));var attributes=require(_0xd728('0x9'));module[_0xd728('0xa')]=function(_0x253997,_0x38a7ec){return _0x253997[_0xd728('0xb')](_0xd728('0xc'),attributes,{'tableName':_0xd728('0xd'),'paranoid':![],'indexes':[{'fields':[_0xd728('0xe')]},{'fields':[_0xd728('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2d4a0ea..769f772 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 _0xdc49=['findAll','options','raw','where','limit','include','map','model','attributes','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','VoiceQueueReport','update','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc49,0x16d));var _0x9dc4=function(_0x31b7e,_0x25523b){_0x31b7e=_0x31b7e-0x0;var _0x746dc9=_0xdc49[_0x31b7e];return _0x746dc9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9dc4('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dc4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x9dc4('0x2'));var logger=require(_0x9dc4('0x3'))('rpc');var config=require(_0x9dc4('0x4'));var jayson=require(_0x9dc4('0x5'));var client=jayson[_0x9dc4('0x6')]['http']({'port':0x232a});config[_0x9dc4('0x7')]=_[_0x9dc4('0x8')](config[_0x9dc4('0x7')],{'host':_0x9dc4('0x9'),'port':0x18eb});var socket=require(_0x9dc4('0xa'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x9dc4('0xb')](socket);function respondWithRpcPromise(_0x852099,_0x2bf1a3,_0x50f907){return new BPromise(function(_0x47cd1f,_0x11cf00){return client[_0x9dc4('0xc')](_0x852099,_0x50f907)[_0x9dc4('0xd')](function(_0x258d0d){logger[_0x9dc4('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x2bf1a3,_0x9dc4('0xf'));logger[_0x9dc4('0x10')](_0x9dc4('0x11'),_0x2bf1a3,_0x9dc4('0xf'),JSON['stringify'](_0x258d0d));if(_0x258d0d[_0x9dc4('0x12')]){if(_0x258d0d[_0x9dc4('0x12')][_0x9dc4('0x13')]===0x1f4){logger['error'](_0x9dc4('0x14'),_0x2bf1a3,_0x258d0d[_0x9dc4('0x12')]['message']);return _0x11cf00(_0x258d0d['error'][_0x9dc4('0x15')]);}logger[_0x9dc4('0x12')](_0x9dc4('0x14'),_0x2bf1a3,_0x258d0d[_0x9dc4('0x12')][_0x9dc4('0x15')]);return _0x47cd1f(_0x258d0d[_0x9dc4('0x12')][_0x9dc4('0x15')]);}else{logger[_0x9dc4('0xe')](_0x9dc4('0x14'),_0x2bf1a3,_0x9dc4('0xf'));_0x47cd1f(_0x258d0d[_0x9dc4('0x16')][_0x9dc4('0x15')]);}})[_0x9dc4('0x17')](function(_0xb185bb){logger[_0x9dc4('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x2bf1a3,_0xb185bb);_0x11cf00(_0xb185bb);});});}exports[_0x9dc4('0x18')]=function(_0x2095bf){var _0x4f747d=this;return new Promise(function(_0x2fa8c9,_0x25c983){return db['VoiceQueueReport'][_0x9dc4('0x19')]({'raw':_0x2095bf['options']?_0x2095bf[_0x9dc4('0x1a')][_0x9dc4('0x1b')]===undefined?!![]:![]:!![],'where':_0x2095bf[_0x9dc4('0x1a')]?_0x2095bf['options'][_0x9dc4('0x1c')]||null:null,'attributes':_0x2095bf[_0x9dc4('0x1a')]?_0x2095bf['options']['attributes']||null:null,'limit':_0x2095bf[_0x9dc4('0x1a')]?_0x2095bf[_0x9dc4('0x1a')][_0x9dc4('0x1d')]||null:null,'include':_0x2095bf[_0x9dc4('0x1a')]?_0x2095bf[_0x9dc4('0x1a')][_0x9dc4('0x1e')]?_[_0x9dc4('0x1f')](_0x2095bf['options']['include'],function(_0x4ca9ce){return{'model':db[_0x4ca9ce[_0x9dc4('0x20')]],'as':_0x4ca9ce['as'],'attributes':_0x4ca9ce[_0x9dc4('0x21')],'include':_0x4ca9ce[_0x9dc4('0x1e')]?_[_0x9dc4('0x1f')](_0x4ca9ce[_0x9dc4('0x1e')],function(_0x34b202){return{'model':db[_0x34b202[_0x9dc4('0x20')]],'as':_0x34b202['as'],'attributes':_0x34b202[_0x9dc4('0x21')],'include':_0x34b202['include']?_[_0x9dc4('0x1f')](_0x34b202[_0x9dc4('0x1e')],function(_0x1edbb6){return{'model':db[_0x1edbb6['model']],'as':_0x1edbb6['as'],'attributes':_0x1edbb6[_0x9dc4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9dc4('0xd')](function(_0x315769){logger[_0x9dc4('0xe')](_0x9dc4('0x18'),_0x2095bf);logger[_0x9dc4('0x10')]('GetVoiceQueueReport',_0x2095bf,JSON['stringify'](_0x315769));_0x2fa8c9(_0x315769);})['catch'](function(_0x35e9b5){logger[_0x9dc4('0x12')]('GetVoiceQueueReport',_0x35e9b5[_0x9dc4('0x15')],_0x2095bf);_0x25c983(_0x4f747d['error'](0x1f4,_0x35e9b5[_0x9dc4('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x1ecd49){var _0x13eb91=this;return new Promise(function(_0x108e57,_0x4a6792){return db['VoiceQueueReport']['create'](_0x1ecd49[_0x9dc4('0x22')],{'raw':_0x1ecd49[_0x9dc4('0x1a')]?_0x1ecd49[_0x9dc4('0x1a')][_0x9dc4('0x1b')]===undefined?!![]:![]:!![]})[_0x9dc4('0xd')](function(_0x48ee6b){logger[_0x9dc4('0xe')](_0x9dc4('0x23'),_0x1ecd49);logger[_0x9dc4('0x10')](_0x9dc4('0x23'),_0x1ecd49,JSON['stringify'](_0x48ee6b));_0x108e57(_0x48ee6b);})['catch'](function(_0x1817dd){logger[_0x9dc4('0x12')](_0x9dc4('0x23'),_0x1817dd[_0x9dc4('0x15')],_0x1ecd49);_0x4a6792(_0x13eb91[_0x9dc4('0x12')](0x1f4,_0x1817dd[_0x9dc4('0x15')]));});});};exports[_0x9dc4('0x24')]=function(_0x322e4b){var _0x411cef=this;return new Promise(function(_0x5bdafe,_0x428675){return db[_0x9dc4('0x25')][_0x9dc4('0x26')](_0x322e4b[_0x9dc4('0x22')],{'raw':_0x322e4b['options']?_0x322e4b[_0x9dc4('0x1a')][_0x9dc4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x322e4b[_0x9dc4('0x1a')]?_0x322e4b[_0x9dc4('0x1a')][_0x9dc4('0x1c')]||null:null,'attributes':_0x322e4b[_0x9dc4('0x1a')]?_0x322e4b['options'][_0x9dc4('0x21')]||null:null,'limit':_0x322e4b['options']?_0x322e4b[_0x9dc4('0x1a')][_0x9dc4('0x1d')]||null:null})[_0x9dc4('0xd')](function(_0x3b25f6){logger['info'](_0x9dc4('0x24'),_0x322e4b);logger[_0x9dc4('0x10')](_0x9dc4('0x24'),_0x322e4b,JSON['stringify'](_0x3b25f6));_0x5bdafe(_0x3b25f6);})[_0x9dc4('0x17')](function(_0x4eb4f8){logger[_0x9dc4('0x12')](_0x9dc4('0x24'),_0x4eb4f8[_0x9dc4('0x15')],_0x322e4b);_0x428675(_0x411cef['error'](0x1f4,_0x4eb4f8[_0x9dc4('0x15')]));});});}; \ No newline at end of file +var _0x24ef=['VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetVoiceQueueReport','findAll','options','attributes','limit','include','map','model','then','debug','catch','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket'];(function(_0x5a58af,_0x2fd0e0){var _0x40b593=function(_0x354331){while(--_0x354331){_0x5a58af['push'](_0x5a58af['shift']());}};_0x40b593(++_0x2fd0e0);}(_0x24ef,0x1a8));var _0xf24e=function(_0x1df89,_0x56987f){_0x1df89=_0x1df89-0x0;var _0x1f3f81=_0x24ef[_0x1df89];return _0x1f3f81;};'use strict';var _=require(_0xf24e('0x0'));var util=require(_0xf24e('0x1'));var moment=require(_0xf24e('0x2'));var BPromise=require(_0xf24e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf24e('0x4'))['db'];var utils=require(_0xf24e('0x5'));var logger=require(_0xf24e('0x6'))(_0xf24e('0x7'));var config=require(_0xf24e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf24e('0x9')][_0xf24e('0xa')]({'port':0x232a});config['redis']=_[_0xf24e('0xb')](config['redis'],{'host':_0xf24e('0xc'),'port':0x18eb});var socket=require(_0xf24e('0xd'))(new Redis(config[_0xf24e('0xe')]));require(_0xf24e('0xf'))['register'](socket);function respondWithRpcPromise(_0x1557d2,_0x594b72,_0x2e0b13){return new BPromise(function(_0x1b27e5,_0x1e3c63){return client['request'](_0x1557d2,_0x2e0b13)['then'](function(_0x2f4d6d){logger['info'](_0xf24e('0x10'),_0x594b72,'request\x20sent');logger['debug'](_0xf24e('0x11'),_0x594b72,_0xf24e('0x12'),JSON[_0xf24e('0x13')](_0x2f4d6d));if(_0x2f4d6d['error']){if(_0x2f4d6d[_0xf24e('0x14')][_0xf24e('0x15')]===0x1f4){logger['error'](_0xf24e('0x10'),_0x594b72,_0x2f4d6d['error'][_0xf24e('0x16')]);return _0x1e3c63(_0x2f4d6d[_0xf24e('0x14')][_0xf24e('0x16')]);}logger[_0xf24e('0x14')](_0xf24e('0x10'),_0x594b72,_0x2f4d6d[_0xf24e('0x14')][_0xf24e('0x16')]);return _0x1b27e5(_0x2f4d6d['error']['message']);}else{logger[_0xf24e('0x17')](_0xf24e('0x10'),_0x594b72,_0xf24e('0x12'));_0x1b27e5(_0x2f4d6d[_0xf24e('0x18')][_0xf24e('0x16')]);}})['catch'](function(_0x28bad5){logger[_0xf24e('0x14')](_0xf24e('0x10'),_0x594b72,_0x28bad5);_0x1e3c63(_0x28bad5);});});}exports[_0xf24e('0x19')]=function(_0x54e434){var _0x4b501f=this;return new Promise(function(_0x9ce962,_0x145890){return db['VoiceQueueReport'][_0xf24e('0x1a')]({'raw':_0x54e434[_0xf24e('0x1b')]?_0x54e434[_0xf24e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x54e434[_0xf24e('0x1b')]?_0x54e434[_0xf24e('0x1b')]['where']||null:null,'attributes':_0x54e434['options']?_0x54e434['options'][_0xf24e('0x1c')]||null:null,'limit':_0x54e434[_0xf24e('0x1b')]?_0x54e434[_0xf24e('0x1b')][_0xf24e('0x1d')]||null:null,'include':_0x54e434[_0xf24e('0x1b')]?_0x54e434[_0xf24e('0x1b')][_0xf24e('0x1e')]?_[_0xf24e('0x1f')](_0x54e434['options'][_0xf24e('0x1e')],function(_0x153136){return{'model':db[_0x153136[_0xf24e('0x20')]],'as':_0x153136['as'],'attributes':_0x153136['attributes'],'include':_0x153136[_0xf24e('0x1e')]?_[_0xf24e('0x1f')](_0x153136[_0xf24e('0x1e')],function(_0x1f58d6){return{'model':db[_0x1f58d6[_0xf24e('0x20')]],'as':_0x1f58d6['as'],'attributes':_0x1f58d6[_0xf24e('0x1c')],'include':_0x1f58d6[_0xf24e('0x1e')]?_[_0xf24e('0x1f')](_0x1f58d6['include'],function(_0x1e7d04){return{'model':db[_0x1e7d04['model']],'as':_0x1e7d04['as'],'attributes':_0x1e7d04[_0xf24e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf24e('0x21')](function(_0x1557ee){logger[_0xf24e('0x17')](_0xf24e('0x19'),_0x54e434);logger[_0xf24e('0x22')](_0xf24e('0x19'),_0x54e434,JSON[_0xf24e('0x13')](_0x1557ee));_0x9ce962(_0x1557ee);})[_0xf24e('0x23')](function(_0x4dec9b){logger[_0xf24e('0x14')]('GetVoiceQueueReport',_0x4dec9b[_0xf24e('0x16')],_0x54e434);_0x145890(_0x4b501f['error'](0x1f4,_0x4dec9b[_0xf24e('0x16')]));});});};exports[_0xf24e('0x24')]=function(_0x583812){var _0x11812b=this;return new Promise(function(_0x4302a4,_0x149569){return db[_0xf24e('0x25')][_0xf24e('0x26')](_0x583812[_0xf24e('0x27')],{'raw':_0x583812[_0xf24e('0x1b')]?_0x583812[_0xf24e('0x1b')][_0xf24e('0x28')]===undefined?!![]:![]:!![]})[_0xf24e('0x21')](function(_0x4e08b6){logger[_0xf24e('0x17')](_0xf24e('0x24'),_0x583812);logger[_0xf24e('0x22')]('CreateVoiceQueueReport',_0x583812,JSON['stringify'](_0x4e08b6));_0x4302a4(_0x4e08b6);})[_0xf24e('0x23')](function(_0x335a46){logger['error'](_0xf24e('0x24'),_0x335a46[_0xf24e('0x16')],_0x583812);_0x149569(_0x11812b[_0xf24e('0x14')](0x1f4,_0x335a46[_0xf24e('0x16')]));});});};exports[_0xf24e('0x29')]=function(_0x4afc60){var _0x3e61ae=this;return new Promise(function(_0xbb6063,_0x2f5eaa){return db[_0xf24e('0x25')][_0xf24e('0x2a')](_0x4afc60[_0xf24e('0x27')],{'raw':_0x4afc60[_0xf24e('0x1b')]?_0x4afc60['options'][_0xf24e('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4afc60[_0xf24e('0x1b')]?_0x4afc60[_0xf24e('0x1b')][_0xf24e('0x2b')]||null:null,'attributes':_0x4afc60[_0xf24e('0x1b')]?_0x4afc60[_0xf24e('0x1b')]['attributes']||null:null,'limit':_0x4afc60[_0xf24e('0x1b')]?_0x4afc60[_0xf24e('0x1b')][_0xf24e('0x1d')]||null:null})['then'](function(_0xef2cb5){logger[_0xf24e('0x17')]('UpdateVoiceQueueReport',_0x4afc60);logger[_0xf24e('0x22')](_0xf24e('0x29'),_0x4afc60,JSON[_0xf24e('0x13')](_0xef2cb5));_0xbb6063(_0xef2cb5);})[_0xf24e('0x23')](function(_0x165a0e){logger[_0xf24e('0x14')]('UpdateVoiceQueueReport',_0x165a0e[_0xf24e('0x16')],_0x4afc60);_0x2f5eaa(_0x3e61ae['error'](0x1f4,_0x165a0e[_0xf24e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 288f08b..784f693 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 _0x9491=['./voiceQueueReport.events','save','remove','update','emit','register','voiceQueueReport:'];(function(_0x222f42,_0x3df2b2){var _0x7a7660=function(_0xda492f){while(--_0xda492f){_0x222f42['push'](_0x222f42['shift']());}};_0x7a7660(++_0x3df2b2);}(_0x9491,0xb6));var _0x1949=function(_0x5d1216,_0x4a576b){_0x5d1216=_0x5d1216-0x0;var _0x143a48=_0x9491[_0x5d1216];return _0x143a48;};'use strict';var VoiceQueueReportEvents=require(_0x1949('0x0'));var events=[_0x1949('0x1'),_0x1949('0x2'),_0x1949('0x3')];function createListener(_0x46e060,_0x1f05db){return function(_0x28621a){_0x1f05db[_0x1949('0x4')](_0x46e060,_0x28621a);};}function removeListener(_0x4270d7,_0x358907){return function(){VoiceQueueReportEvents['removeListener'](_0x4270d7,_0x358907);};}exports[_0x1949('0x5')]=function(_0x5b01b9){for(var _0x14c30e=0x0,_0x2d39a3=events['length'];_0x14c30e<_0x2d39a3;_0x14c30e++){var _0x28b2b6=events[_0x14c30e];var _0x3665b6=createListener(_0x1949('0x6')+_0x28b2b6,_0x5b01b9);VoiceQueueReportEvents['on'](_0x28b2b6,_0x3665b6);}}; \ No newline at end of file +var _0x05dc=['update','emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0x05dc,0xcd));var _0xc05d=function(_0x128188,_0x418a16){_0x128188=_0x128188-0x0;var _0x4bc209=_0x05dc[_0x128188];return _0x4bc209;};'use strict';var VoiceQueueReportEvents=require(_0xc05d('0x0'));var events=[_0xc05d('0x1'),_0xc05d('0x2'),_0xc05d('0x3')];function createListener(_0x2c5725,_0x4c5839){return function(_0x2dd6e6){_0x4c5839[_0xc05d('0x4')](_0x2c5725,_0x2dd6e6);};}function removeListener(_0x52d1df,_0x384248){return function(){VoiceQueueReportEvents['removeListener'](_0x52d1df,_0x384248);};}exports[_0xc05d('0x5')]=function(_0x4b51aa){for(var _0x4c62ff=0x0,_0x376ad4=events[_0xc05d('0x6')];_0x4c62ff<_0x376ad4;_0x4c62ff++){var _0x2b09d5=events[_0x4c62ff];var _0x11fe6e=createListener(_0xc05d('0x7')+_0x2b09d5,_0x4b51aa);VoiceQueueReportEvents['on'](_0x2b09d5,_0x11fe6e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a9b8f6e..126e52e 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 _0x9ab9=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','show','create','put','update','delete','destroy','exports','multer'];(function(_0x318ca1,_0x263b46){var _0x380e6e=function(_0x550173){while(--_0x550173){_0x318ca1['push'](_0x318ca1['shift']());}};_0x380e6e(++_0x263b46);}(_0x9ab9,0x71));var _0x99ab=function(_0x144f4c,_0x5a506c){_0x144f4c=_0x144f4c-0x0;var _0x2f4da5=_0x9ab9[_0x144f4c];return _0x2f4da5;};'use strict';var multer=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var path=require(_0x99ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x99ab('0x3'));var router=express[_0x99ab('0x4')]();var fs_extra=require(_0x99ab('0x5'));var auth=require(_0x99ab('0x6'));var interaction=require(_0x99ab('0x7'));var config=require('../../config/environment');var controller=require(_0x99ab('0x8'));router[_0x99ab('0x9')]('/',auth[_0x99ab('0xa')](),controller[_0x99ab('0xb')]);router[_0x99ab('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x99ab('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x99ab('0xd')]);router[_0x99ab('0xe')]('/:id',auth[_0x99ab('0xa')](),controller[_0x99ab('0xf')]);router[_0x99ab('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x99ab('0x11')]);module[_0x99ab('0x12')]=router; \ No newline at end of file +var _0x934a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2d7ea9,_0x305b4){var _0x5dfa93=function(_0x245384){while(--_0x245384){_0x2d7ea9['push'](_0x2d7ea9['shift']());}};_0x5dfa93(++_0x305b4);}(_0x934a,0x127));var _0xa934=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x934a[_0x14a862];return _0x245eb5;};'use strict';var multer=require(_0xa934('0x0'));var util=require('util');var path=require(_0xa934('0x1'));var timeout=require(_0xa934('0x2'));var express=require(_0xa934('0x3'));var router=express[_0xa934('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa934('0x5'));var interaction=require(_0xa934('0x6'));var config=require(_0xa934('0x7'));var controller=require(_0xa934('0x8'));router['get']('/',auth[_0xa934('0x9')](),controller[_0xa934('0xa')]);router[_0xa934('0xb')]('/:id',auth[_0xa934('0x9')](),controller['show']);router[_0xa934('0xc')]('/',auth[_0xa934('0x9')](),controller[_0xa934('0xd')]);router[_0xa934('0xe')](_0xa934('0xf'),auth[_0xa934('0x9')](),controller[_0xa934('0x10')]);router[_0xa934('0x11')](_0xa934('0xf'),auth[_0xa934('0x9')](),controller[_0xa934('0x12')]);module[_0xa934('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index ef058f0..5b6fdcc 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 _0x9131=['sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x155add,_0xb28467){var _0x5c2d00=function(_0x3554e4){while(--_0x3554e4){_0x155add['push'](_0x155add['shift']());}};_0x5c2d00(++_0xb28467);}(_0x9131,0xc6));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1913('0x0'));var moment=require(_0x1913('0x1'));module[_0x1913('0x2')]={'time':{'type':Sequelize[_0x1913('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1913('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1913('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1913('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1913('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1913('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1913('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x1913('0x5'))}}; \ No newline at end of file +var _0x14a3=['moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x3c5cc4,_0x17eece){var _0x53ff4d=function(_0x4391f9){while(--_0x4391f9){_0x3c5cc4['push'](_0x3c5cc4['shift']());}};_0x53ff4d(++_0x17eece);}(_0x14a3,0x161));var _0x314a=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x14a3[_0x256b72];return _0x2183e3;};'use strict';var Sequelize=require(_0x314a('0x0'));var moment=require(_0x314a('0x1'));module[_0x314a('0x2')]={'time':{'type':Sequelize[_0x314a('0x3')]},'callid':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x314a('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x314a('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x314a('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 90e947d..71f96bb 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 _0x01e4=['model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','show','params','intersection','length','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','end','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','map','query','keys','filters'];(function(_0x3d2a25,_0x1b51b2){var _0x335a2a=function(_0x501ae5){while(--_0x501ae5){_0x3d2a25['push'](_0x3d2a25['shift']());}};_0x335a2a(++_0x1b51b2);}(_0x01e4,0x1df));var _0x401e=function(_0x2c1c8,_0x4a52b0){_0x2c1c8=_0x2c1c8-0x0;var _0x495de6=_0x01e4[_0x2c1c8];return _0x495de6;};'use strict';var emlformat=require(_0x401e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x401e('0x1'));var jsonpatch=require(_0x401e('0x2'));var rp=require(_0x401e('0x3'));var moment=require(_0x401e('0x4'));var BPromise=require(_0x401e('0x5'));var Mustache=require(_0x401e('0x6'));var util=require(_0x401e('0x7'));var path=require(_0x401e('0x8'));var sox=require(_0x401e('0x9'));var csv=require(_0x401e('0xa'));var ejs=require(_0x401e('0xb'));var fs=require('fs');var fs_extra=require(_0x401e('0xc'));var _=require(_0x401e('0xd'));var squel=require(_0x401e('0xe'));var crypto=require(_0x401e('0xf'));var jsforce=require(_0x401e('0x10'));var deskjs=require(_0x401e('0x11'));var toCsv=require(_0x401e('0xa'));var querystring=require('querystring');var Papa=require(_0x401e('0x12'));var Redis=require(_0x401e('0x13'));var authService=require(_0x401e('0x14'));var qs=require(_0x401e('0x15'));var as=require(_0x401e('0x16'));var hardwareService=require(_0x401e('0x17'));var logger=require(_0x401e('0x18'))(_0x401e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x401e('0x1a'));var db=require(_0x401e('0x1b'))['db'];function respondWithStatusCode(_0x57fa25,_0x559030){_0x559030=_0x559030||0xcc;return function(_0x1fb6ac){if(_0x1fb6ac){return _0x57fa25[_0x401e('0x1c')](_0x559030);}return _0x57fa25[_0x401e('0x1d')](_0x559030)['end']();};}function respondWithResult(_0x1c4581,_0x28b969){_0x28b969=_0x28b969||0xc8;return function(_0x48efa4){if(_0x48efa4){return _0x1c4581[_0x401e('0x1d')](_0x28b969)[_0x401e('0x1e')](_0x48efa4);}};}function respondWithFilteredResult(_0x1f5f2d,_0x2b3f5d){return function(_0x259b6c){if(_0x259b6c){var _0x423e67=typeof _0x2b3f5d['offset']===_0x401e('0x1f')&&typeof _0x2b3f5d[_0x401e('0x20')]==='undefined';var _0x21a31f=_0x259b6c['count'];var _0x45f8c6=_0x423e67?0x0:_0x2b3f5d[_0x401e('0x21')];var _0x3ee039=_0x423e67?_0x259b6c[_0x401e('0x22')]:_0x2b3f5d['offset']+_0x2b3f5d[_0x401e('0x20')];var _0x59a249;if(_0x3ee039>=_0x21a31f){_0x3ee039=_0x21a31f;_0x59a249=0xc8;}else{_0x59a249=0xce;}_0x1f5f2d[_0x401e('0x1d')](_0x59a249);return _0x1f5f2d['set'](_0x401e('0x23'),_0x45f8c6+'-'+_0x3ee039+'/'+_0x21a31f)[_0x401e('0x1e')](_0x259b6c);}return null;};}function patchUpdates(_0x457049){return function(_0x28f8bf){try{jsonpatch[_0x401e('0x24')](_0x28f8bf,_0x457049,!![]);}catch(_0x5416fa){return BPromise['reject'](_0x5416fa);}return _0x28f8bf[_0x401e('0x25')]();};}function saveUpdates(_0x552e0a,_0x3502eb){return function(_0xfd89ef){if(_0xfd89ef){return _0xfd89ef[_0x401e('0x26')](_0x552e0a)['then'](function(_0x4f71a7){return _0x4f71a7;});}return null;};}function removeEntity(_0x2f9302,_0x4c8ca7){return function(_0x36640e){if(_0x36640e){return _0x36640e['destroy']()[_0x401e('0x27')](function(){_0x2f9302[_0x401e('0x1d')](0xcc)[_0x401e('0x28')]();});}};}function handleEntityNotFound(_0x4721cf,_0x5bbf90){return function(_0x2f6f7b){if(!_0x2f6f7b){_0x4721cf[_0x401e('0x1c')](0x194);}return _0x2f6f7b;};}function handleError(_0x36015b,_0x5b09bd){_0x5b09bd=_0x5b09bd||0x1f4;return function(_0x15c2e8){logger['error'](_0x15c2e8[_0x401e('0x29')]);if(_0x15c2e8[_0x401e('0x2a')]){delete _0x15c2e8['name'];}_0x36015b['status'](_0x5b09bd)[_0x401e('0x2b')](_0x15c2e8);};}exports[_0x401e('0x2c')]=function(_0x116904,_0x149a6d){var _0x1c0851={},_0x46bb58={},_0x97643b={'count':0x0,'rows':[]};var _0x1b0775=_['map'](db[_0x401e('0x2d')][_0x401e('0x2e')],function(_0x2eb239){return{'name':_0x2eb239[_0x401e('0x2f')],'type':_0x2eb239[_0x401e('0x30')]['key']};});_0x46bb58['model']=_[_0x401e('0x31')](_0x1b0775,_0x401e('0x2a'));_0x46bb58[_0x401e('0x32')]=_[_0x401e('0x33')](_0x116904[_0x401e('0x32')]);_0x46bb58[_0x401e('0x34')]=_['intersection'](_0x46bb58[_0x401e('0x35')],_0x46bb58[_0x401e('0x32')]);_0x1c0851[_0x401e('0x36')]=_['intersection'](_0x46bb58[_0x401e('0x35')],qs[_0x401e('0x37')](_0x116904[_0x401e('0x32')][_0x401e('0x37')]));_0x1c0851[_0x401e('0x36')]=_0x1c0851['attributes']['length']?_0x1c0851['attributes']:_0x46bb58[_0x401e('0x35')];if(!_0x116904[_0x401e('0x32')][_0x401e('0x38')]('nolimit')){_0x1c0851[_0x401e('0x20')]=qs[_0x401e('0x20')](_0x116904[_0x401e('0x32')][_0x401e('0x20')]);_0x1c0851['offset']=qs[_0x401e('0x21')](_0x116904[_0x401e('0x32')][_0x401e('0x21')]);}_0x1c0851[_0x401e('0x39')]=qs[_0x401e('0x3a')](_0x116904[_0x401e('0x32')][_0x401e('0x3a')]);_0x1c0851[_0x401e('0x3b')]=qs[_0x401e('0x34')](_[_0x401e('0x3c')](_0x116904[_0x401e('0x32')],_0x46bb58[_0x401e('0x34')]),_0x1b0775);if(_0x116904['query']['filter']){_0x1c0851['where']=_[_0x401e('0x3d')](_0x1c0851[_0x401e('0x3b')],{'$or':_['map'](_0x1b0775,function(_0x4be911){if(_0x4be911['type']!=='VIRTUAL'){var _0xba2d6c={};_0xba2d6c[_0x4be911['name']]={'$like':'%'+_0x116904['query'][_0x401e('0x3e')]+'%'};return _0xba2d6c;}})});}_0x1c0851=_[_0x401e('0x3d')]({},_0x1c0851,_0x116904[_0x401e('0x3f')]);var _0x3b65ec={'where':_0x1c0851['where']};return db[_0x401e('0x2d')][_0x401e('0x22')](_0x3b65ec)[_0x401e('0x27')](function(_0x52a4c2){_0x97643b['count']=_0x52a4c2;if(_0x116904['query'][_0x401e('0x40')]){_0x1c0851[_0x401e('0x41')]=[{'all':!![]}];}return db[_0x401e('0x2d')][_0x401e('0x42')](_0x1c0851);})['then'](function(_0x23b957){_0x97643b['rows']=_0x23b957;return _0x97643b;})[_0x401e('0x27')](respondWithFilteredResult(_0x149a6d,_0x1c0851))['catch'](handleError(_0x149a6d,null));};exports[_0x401e('0x43')]=function(_0x224647,_0x36c44b){var _0x23597e={'raw':!![],'where':{'id':_0x224647[_0x401e('0x44')]['id']}},_0x4fcfec={};_0x4fcfec[_0x401e('0x35')]=_[_0x401e('0x33')](db['VoiceQueuesLog'][_0x401e('0x2e')]);_0x4fcfec[_0x401e('0x32')]=_[_0x401e('0x33')](_0x224647['query']);_0x4fcfec[_0x401e('0x34')]=_['intersection'](_0x4fcfec['model'],_0x4fcfec[_0x401e('0x32')]);_0x23597e[_0x401e('0x36')]=_[_0x401e('0x45')](_0x4fcfec[_0x401e('0x35')],qs['fields'](_0x224647[_0x401e('0x32')][_0x401e('0x37')]));_0x23597e['attributes']=_0x23597e[_0x401e('0x36')][_0x401e('0x46')]?_0x23597e[_0x401e('0x36')]:_0x4fcfec['model'];if(_0x224647[_0x401e('0x32')][_0x401e('0x40')]){_0x23597e[_0x401e('0x41')]=[{'all':!![]}];}_0x23597e=_[_0x401e('0x3d')]({},_0x23597e,_0x224647['options']);return db[_0x401e('0x2d')][_0x401e('0x47')](_0x23597e)[_0x401e('0x27')](handleEntityNotFound(_0x36c44b,null))['then'](respondWithResult(_0x36c44b,null))[_0x401e('0x48')](handleError(_0x36c44b,null));};exports['create']=function(_0x5a4ee7,_0x3285b5){return db[_0x401e('0x2d')][_0x401e('0x49')](_0x5a4ee7[_0x401e('0x4a')],{})['then'](respondWithResult(_0x3285b5,0xc9))[_0x401e('0x48')](handleError(_0x3285b5,null));};exports[_0x401e('0x26')]=function(_0x2afdb1,_0x48baae){if(_0x2afdb1[_0x401e('0x4a')]['id']){delete _0x2afdb1[_0x401e('0x4a')]['id'];}return db[_0x401e('0x2d')][_0x401e('0x47')]({'where':{'id':_0x2afdb1[_0x401e('0x44')]['id']}})['then'](handleEntityNotFound(_0x48baae,null))[_0x401e('0x27')](saveUpdates(_0x2afdb1['body'],null))[_0x401e('0x27')](respondWithResult(_0x48baae,null))['catch'](handleError(_0x48baae,null));};exports[_0x401e('0x4b')]=function(_0x119015,_0x503b32){return db[_0x401e('0x2d')][_0x401e('0x47')]({'where':{'id':_0x119015[_0x401e('0x44')]['id']}})[_0x401e('0x27')](handleEntityNotFound(_0x503b32,null))[_0x401e('0x27')](removeEntity(_0x503b32,null))[_0x401e('0x48')](handleError(_0x503b32,null));}; \ No newline at end of file +var _0x6a8d=['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','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','VoiceQueuesLog','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','pick','filter','where','merge','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x6a8d,0x161));var _0xd6a8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6a8d[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0xd6a8('0x0'));var rimraf=require(_0xd6a8('0x1'));var zipdir=require(_0xd6a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6a8('0x3'));var moment=require(_0xd6a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd6a8('0x5'));var util=require(_0xd6a8('0x6'));var path=require(_0xd6a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd6a8('0x8'));var fs=require('fs');var fs_extra=require(_0xd6a8('0x9'));var _=require(_0xd6a8('0xa'));var squel=require(_0xd6a8('0xb'));var crypto=require(_0xd6a8('0xc'));var jsforce=require(_0xd6a8('0xd'));var deskjs=require(_0xd6a8('0xe'));var toCsv=require(_0xd6a8('0xf'));var querystring=require(_0xd6a8('0x10'));var Papa=require(_0xd6a8('0x11'));var Redis=require(_0xd6a8('0x12'));var authService=require(_0xd6a8('0x13'));var qs=require(_0xd6a8('0x14'));var as=require(_0xd6a8('0x15'));var hardwareService=require(_0xd6a8('0x16'));var logger=require(_0xd6a8('0x17'))('api');var utils=require(_0xd6a8('0x18'));var config=require(_0xd6a8('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c88f0,_0x59c2d2){_0x59c2d2=_0x59c2d2||0xcc;return function(_0x1742c8){if(_0x1742c8){return _0x5c88f0['sendStatus'](_0x59c2d2);}return _0x5c88f0[_0xd6a8('0x1a')](_0x59c2d2)[_0xd6a8('0x1b')]();};}function respondWithResult(_0xaa5d97,_0x3885ff){_0x3885ff=_0x3885ff||0xc8;return function(_0x195315){if(_0x195315){return _0xaa5d97[_0xd6a8('0x1a')](_0x3885ff)[_0xd6a8('0x1c')](_0x195315);}};}function respondWithFilteredResult(_0x71191b,_0x19d5c1){return function(_0x2bbd0e){if(_0x2bbd0e){var _0x3d4c1b=typeof _0x19d5c1[_0xd6a8('0x1d')]===_0xd6a8('0x1e')&&typeof _0x19d5c1[_0xd6a8('0x1f')]===_0xd6a8('0x1e');var _0x1f445d=_0x2bbd0e[_0xd6a8('0x20')];var _0x366bfe=_0x3d4c1b?0x0:_0x19d5c1[_0xd6a8('0x1d')];var _0x4ab646=_0x3d4c1b?_0x2bbd0e[_0xd6a8('0x20')]:_0x19d5c1['offset']+_0x19d5c1[_0xd6a8('0x1f')];var _0x2b5dd1;if(_0x4ab646>=_0x1f445d){_0x4ab646=_0x1f445d;_0x2b5dd1=0xc8;}else{_0x2b5dd1=0xce;}_0x71191b[_0xd6a8('0x1a')](_0x2b5dd1);return _0x71191b[_0xd6a8('0x21')](_0xd6a8('0x22'),_0x366bfe+'-'+_0x4ab646+'/'+_0x1f445d)[_0xd6a8('0x1c')](_0x2bbd0e);}return null;};}function patchUpdates(_0x1020be){return function(_0x3090f1){try{jsonpatch[_0xd6a8('0x23')](_0x3090f1,_0x1020be,!![]);}catch(_0x1caf6d){return BPromise['reject'](_0x1caf6d);}return _0x3090f1[_0xd6a8('0x24')]();};}function saveUpdates(_0x2bcac0,_0x3b3034){return function(_0xe97ae7){if(_0xe97ae7){return _0xe97ae7[_0xd6a8('0x25')](_0x2bcac0)[_0xd6a8('0x26')](function(_0x5f5a31){return _0x5f5a31;});}return null;};}function removeEntity(_0x73e340,_0x1668a0){return function(_0x233bb3){if(_0x233bb3){return _0x233bb3[_0xd6a8('0x27')]()['then'](function(){_0x73e340[_0xd6a8('0x1a')](0xcc)[_0xd6a8('0x1b')]();});}};}function handleEntityNotFound(_0x37a849,_0x38e3f8){return function(_0x4a95ba){if(!_0x4a95ba){_0x37a849[_0xd6a8('0x28')](0x194);}return _0x4a95ba;};}function handleError(_0xe9c93b,_0x1d5517){_0x1d5517=_0x1d5517||0x1f4;return function(_0x44fe82){logger[_0xd6a8('0x29')](_0x44fe82[_0xd6a8('0x2a')]);if(_0x44fe82[_0xd6a8('0x2b')]){delete _0x44fe82['name'];}_0xe9c93b[_0xd6a8('0x1a')](_0x1d5517)[_0xd6a8('0x2c')](_0x44fe82);};}exports['index']=function(_0x1ddac1,_0x3899e1){var _0x2918c2={},_0x39bfec={},_0x196235={'count':0x0,'rows':[]};var _0x5eec4a=_['map'](db[_0xd6a8('0x2d')]['rawAttributes'],function(_0x2784d3){return{'name':_0x2784d3['fieldName'],'type':_0x2784d3[_0xd6a8('0x2e')][_0xd6a8('0x2f')]};});_0x39bfec[_0xd6a8('0x30')]=_[_0xd6a8('0x31')](_0x5eec4a,_0xd6a8('0x2b'));_0x39bfec[_0xd6a8('0x32')]=_[_0xd6a8('0x33')](_0x1ddac1[_0xd6a8('0x32')]);_0x39bfec[_0xd6a8('0x34')]=_[_0xd6a8('0x35')](_0x39bfec[_0xd6a8('0x30')],_0x39bfec[_0xd6a8('0x32')]);_0x2918c2[_0xd6a8('0x36')]=_['intersection'](_0x39bfec[_0xd6a8('0x30')],qs['fields'](_0x1ddac1[_0xd6a8('0x32')][_0xd6a8('0x37')]));_0x2918c2[_0xd6a8('0x36')]=_0x2918c2['attributes'][_0xd6a8('0x38')]?_0x2918c2[_0xd6a8('0x36')]:_0x39bfec['model'];if(!_0x1ddac1[_0xd6a8('0x32')]['hasOwnProperty'](_0xd6a8('0x39'))){_0x2918c2['limit']=qs[_0xd6a8('0x1f')](_0x1ddac1[_0xd6a8('0x32')]['limit']);_0x2918c2[_0xd6a8('0x1d')]=qs[_0xd6a8('0x1d')](_0x1ddac1[_0xd6a8('0x32')][_0xd6a8('0x1d')]);}_0x2918c2['order']=qs['sort'](_0x1ddac1[_0xd6a8('0x32')]['sort']);_0x2918c2['where']=qs['filters'](_[_0xd6a8('0x3a')](_0x1ddac1[_0xd6a8('0x32')],_0x39bfec[_0xd6a8('0x34')]),_0x5eec4a);if(_0x1ddac1[_0xd6a8('0x32')][_0xd6a8('0x3b')]){_0x2918c2[_0xd6a8('0x3c')]=_[_0xd6a8('0x3d')](_0x2918c2[_0xd6a8('0x3c')],{'$or':_['map'](_0x5eec4a,function(_0x236fa7){if(_0x236fa7[_0xd6a8('0x2e')]!=='VIRTUAL'){var _0x4c239={};_0x4c239[_0x236fa7[_0xd6a8('0x2b')]]={'$like':'%'+_0x1ddac1[_0xd6a8('0x32')][_0xd6a8('0x3b')]+'%'};return _0x4c239;}})});}_0x2918c2=_[_0xd6a8('0x3d')]({},_0x2918c2,_0x1ddac1['options']);var _0x15c893={'where':_0x2918c2[_0xd6a8('0x3c')]};return db[_0xd6a8('0x2d')]['count'](_0x15c893)[_0xd6a8('0x26')](function(_0x249576){_0x196235[_0xd6a8('0x20')]=_0x249576;if(_0x1ddac1['query'][_0xd6a8('0x3e')]){_0x2918c2[_0xd6a8('0x3f')]=[{'all':!![]}];}return db[_0xd6a8('0x2d')]['findAll'](_0x2918c2);})[_0xd6a8('0x26')](function(_0x3e3a8f){_0x196235[_0xd6a8('0x40')]=_0x3e3a8f;return _0x196235;})['then'](respondWithFilteredResult(_0x3899e1,_0x2918c2))[_0xd6a8('0x41')](handleError(_0x3899e1,null));};exports[_0xd6a8('0x42')]=function(_0x2a9420,_0x1c64c7){var _0x473a5c={'raw':!![],'where':{'id':_0x2a9420[_0xd6a8('0x43')]['id']}},_0x574df4={};_0x574df4[_0xd6a8('0x30')]=_[_0xd6a8('0x33')](db['VoiceQueuesLog'][_0xd6a8('0x44')]);_0x574df4['query']=_[_0xd6a8('0x33')](_0x2a9420['query']);_0x574df4[_0xd6a8('0x34')]=_['intersection'](_0x574df4[_0xd6a8('0x30')],_0x574df4['query']);_0x473a5c[_0xd6a8('0x36')]=_[_0xd6a8('0x35')](_0x574df4[_0xd6a8('0x30')],qs[_0xd6a8('0x37')](_0x2a9420['query'][_0xd6a8('0x37')]));_0x473a5c['attributes']=_0x473a5c[_0xd6a8('0x36')][_0xd6a8('0x38')]?_0x473a5c[_0xd6a8('0x36')]:_0x574df4[_0xd6a8('0x30')];if(_0x2a9420[_0xd6a8('0x32')][_0xd6a8('0x3e')]){_0x473a5c['include']=[{'all':!![]}];}_0x473a5c=_[_0xd6a8('0x3d')]({},_0x473a5c,_0x2a9420['options']);return db['VoiceQueuesLog'][_0xd6a8('0x45')](_0x473a5c)[_0xd6a8('0x26')](handleEntityNotFound(_0x1c64c7,null))[_0xd6a8('0x26')](respondWithResult(_0x1c64c7,null))[_0xd6a8('0x41')](handleError(_0x1c64c7,null));};exports['create']=function(_0x14228a,_0x10a4e4){return db[_0xd6a8('0x2d')][_0xd6a8('0x46')](_0x14228a[_0xd6a8('0x47')],{})[_0xd6a8('0x26')](respondWithResult(_0x10a4e4,0xc9))[_0xd6a8('0x41')](handleError(_0x10a4e4,null));};exports[_0xd6a8('0x25')]=function(_0xa365db,_0x23f548){if(_0xa365db[_0xd6a8('0x47')]['id']){delete _0xa365db[_0xd6a8('0x47')]['id'];}return db[_0xd6a8('0x2d')][_0xd6a8('0x45')]({'where':{'id':_0xa365db['params']['id']}})[_0xd6a8('0x26')](handleEntityNotFound(_0x23f548,null))['then'](saveUpdates(_0xa365db['body'],null))[_0xd6a8('0x26')](respondWithResult(_0x23f548,null))['catch'](handleError(_0x23f548,null));};exports['destroy']=function(_0x346903,_0x484a6c){return db['VoiceQueuesLog'][_0xd6a8('0x45')]({'where':{'id':_0x346903[_0xd6a8('0x43')]['id']}})[_0xd6a8('0x26')](handleEntityNotFound(_0x484a6c,null))['then'](removeEntity(_0x484a6c,null))[_0xd6a8('0x41')](handleError(_0x484a6c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 40fca73..1bc2eee 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 _0x0da2=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x0da2,0x85));var _0x20da=function(_0x57ac7c,_0x13eb14){_0x57ac7c=_0x57ac7c-0x0;var _0x52d72c=_0x0da2[_0x57ac7c];return _0x52d72c;};'use strict';var _=require(_0x20da('0x0'));var util=require(_0x20da('0x1'));var logger=require(_0x20da('0x2'))('api');var moment=require(_0x20da('0x3'));var BPromise=require(_0x20da('0x4'));var rp=require(_0x20da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20da('0x6'));var config=require(_0x20da('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x20da('0x8')]=function(_0x400afa,_0x4461b8){return _0x400afa[_0x20da('0x9')](_0x20da('0xa'),attributes,{'tableName':_0x20da('0xb'),'paranoid':![],'indexes':[{'name':_0x20da('0xc'),'fields':[_0x20da('0xd'),_0x20da('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7ad8=['exports','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x8ed2fe,_0x19ca78){var _0x23a751=function(_0x412f75){while(--_0x412f75){_0x8ed2fe['push'](_0x8ed2fe['shift']());}};_0x23a751(++_0x19ca78);}(_0x7ad8,0xb9));var _0x87ad=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7ad8[_0xbb091];return _0x467a04;};'use strict';var _=require('lodash');var util=require(_0x87ad('0x0'));var logger=require(_0x87ad('0x1'))(_0x87ad('0x2'));var moment=require(_0x87ad('0x3'));var BPromise=require(_0x87ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x87ad('0x5'));var attributes=require(_0x87ad('0x6'));module[_0x87ad('0x7')]=function(_0x100b41,_0x23ef78){return _0x100b41['define']('VoiceQueuesLog',attributes,{'tableName':_0x87ad('0x8'),'paranoid':![],'indexes':[{'name':_0x87ad('0x9'),'fields':[_0x87ad('0xa'),_0x87ad('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index f398fdb..9516266 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 _0xac55=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x35035e,_0x26bc1d){var _0x3a042f=function(_0x38d4e3){while(--_0x38d4e3){_0x35035e['push'](_0x35035e['shift']());}};_0x3a042f(++_0x26bc1d);}(_0xac55,0x1c8));var _0x5ac5=function(_0x59c351,_0x37b65c){_0x59c351=_0x59c351-0x0;var _0x5a17a0=_0xac55[_0x59c351];return _0x5a17a0;};'use strict';var _=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var moment=require(_0x5ac5('0x2'));var BPromise=require(_0x5ac5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ac5('0x4'));var db=require(_0x5ac5('0x5'))['db'];var utils=require(_0x5ac5('0x6'));var logger=require(_0x5ac5('0x7'))(_0x5ac5('0x8'));var config=require(_0x5ac5('0x9'));var jayson=require(_0x5ac5('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34093b,_0x247752,_0x2bee03){return new BPromise(function(_0x42551a,_0x455a94){return client[_0x5ac5('0xb')](_0x34093b,_0x2bee03)[_0x5ac5('0xc')](function(_0x5b84a3){logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));logger['debug'](_0x5ac5('0xf'),_0x247752,_0x5ac5('0xe'),JSON['stringify'](_0x5b84a3));if(_0x5b84a3[_0x5ac5('0x10')]){if(_0x5b84a3[_0x5ac5('0x10')]['code']===0x1f4){logger[_0x5ac5('0x10')](_0x5ac5('0xd'),_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x455a94(_0x5b84a3[_0x5ac5('0x10')]['message']);}logger[_0x5ac5('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x247752,_0x5b84a3[_0x5ac5('0x10')][_0x5ac5('0x11')]);return _0x42551a(_0x5b84a3['error'][_0x5ac5('0x11')]);}else{logger['info'](_0x5ac5('0xd'),_0x247752,_0x5ac5('0xe'));_0x42551a(_0x5b84a3[_0x5ac5('0x12')][_0x5ac5('0x11')]);}})[_0x5ac5('0x13')](function(_0x3e35e9){logger[_0x5ac5('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x247752,_0x3e35e9);_0x455a94(_0x3e35e9);});});} \ No newline at end of file +var _0xf1cc=['then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x13ee29,_0x200187){var _0x2161d4=function(_0x464013){while(--_0x464013){_0x13ee29['push'](_0x13ee29['shift']());}};_0x2161d4(++_0x200187);}(_0xf1cc,0x1ae));var _0xcf1c=function(_0x3fe5a1,_0x331779){_0x3fe5a1=_0x3fe5a1-0x0;var _0x2fb269=_0xf1cc[_0x3fe5a1];return _0x2fb269;};'use strict';var _=require('lodash');var util=require(_0xcf1c('0x0'));var moment=require(_0xcf1c('0x1'));var BPromise=require(_0xcf1c('0x2'));var rs=require(_0xcf1c('0x3'));var fs=require('fs');var Redis=require(_0xcf1c('0x4'));var db=require(_0xcf1c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf1c('0x6'))(_0xcf1c('0x7'));var config=require('../../config/environment');var jayson=require(_0xcf1c('0x8'));var client=jayson['client'][_0xcf1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x584ab4,_0x1e0a4a,_0x3f058d){return new BPromise(function(_0x2ff2c8,_0x1232b3){return client[_0xcf1c('0xa')](_0x584ab4,_0x3f058d)[_0xcf1c('0xb')](function(_0x436388){logger[_0xcf1c('0xc')](_0xcf1c('0xd'),_0x1e0a4a,_0xcf1c('0xe'));logger[_0xcf1c('0xf')](_0xcf1c('0x10'),_0x1e0a4a,_0xcf1c('0xe'),JSON[_0xcf1c('0x11')](_0x436388));if(_0x436388[_0xcf1c('0x12')]){if(_0x436388['error'][_0xcf1c('0x13')]===0x1f4){logger['error'](_0xcf1c('0xd'),_0x1e0a4a,_0x436388[_0xcf1c('0x12')][_0xcf1c('0x14')]);return _0x1232b3(_0x436388['error'][_0xcf1c('0x14')]);}logger[_0xcf1c('0x12')](_0xcf1c('0xd'),_0x1e0a4a,_0x436388[_0xcf1c('0x12')][_0xcf1c('0x14')]);return _0x2ff2c8(_0x436388[_0xcf1c('0x12')][_0xcf1c('0x14')]);}else{logger['info'](_0xcf1c('0xd'),_0x1e0a4a,'request\x20sent');_0x2ff2c8(_0x436388['result'][_0xcf1c('0x14')]);}})['catch'](function(_0x40e496){logger[_0xcf1c('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1e0a4a,_0x40e496);_0x1232b3(_0x40e496);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 1329953..2c4bbff 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 _0x7991=['/describe','describe','/:id','show','/:id/download','isAuthenticated','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x167721,_0xb745cd){var _0x1c45d8=function(_0x1fa181){while(--_0x1fa181){_0x167721['push'](_0x167721['shift']());}};_0x1c45d8(++_0xb745cd);}(_0x7991,0x149));var _0x1799=function(_0x9d37d7,_0x3e2cfa){_0x9d37d7=_0x9d37d7-0x0;var _0x400c50=_0x7991[_0x9d37d7];return _0x400c50;};'use strict';var multer=require('multer');var util=require(_0x1799('0x0'));var path=require('path');var timeout=require(_0x1799('0x1'));var express=require(_0x1799('0x2'));var router=express['Router']();var fs_extra=require(_0x1799('0x3'));var auth=require(_0x1799('0x4'));var interaction=require(_0x1799('0x5'));var config=require(_0x1799('0x6'));var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1799('0x7')]);router[_0x1799('0x8')](_0x1799('0x9'),auth['isAuthenticated'](),controller[_0x1799('0xa')]);router['get'](_0x1799('0xb'),auth['isAuthenticated'](),controller[_0x1799('0xc')]);router[_0x1799('0x8')](_0x1799('0xd'),auth[_0x1799('0xe')](),controller[_0x1799('0xf')]);router[_0x1799('0x8')](_0x1799('0x10'),controller[_0x1799('0x11')]);router['get'](_0x1799('0x12'),auth['isAuthenticated'](),controller[_0x1799('0x13')]);router[_0x1799('0x14')]('/',auth[_0x1799('0xe')](),controller['create']);router['post'](_0x1799('0x12'),auth['isAuthenticated'](),controller[_0x1799('0x15')]);router['put'](_0x1799('0xb'),auth['isAuthenticated'](),controller[_0x1799('0x16')]);router[_0x1799('0x17')]('/:id',auth[_0x1799('0xe')](),controller[_0x1799('0x18')]);module[_0x1799('0x19')]=router; \ No newline at end of file +var _0xcbf1=['/:id/transcribe','downloadTranscribe','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/downloads','downloads'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbf1,0x81));var _0x1cbf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcbf1[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x1cbf('0x0'));var path=require(_0x1cbf('0x1'));var timeout=require(_0x1cbf('0x2'));var express=require('express');var router=express[_0x1cbf('0x3')]();var fs_extra=require(_0x1cbf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1cbf('0x5'));var config=require('../../config/environment');var controller=require(_0x1cbf('0x6'));router[_0x1cbf('0x7')]('/',auth[_0x1cbf('0x8')](),controller['index']);router[_0x1cbf('0x7')](_0x1cbf('0x9'),auth['isAuthenticated'](),controller[_0x1cbf('0xa')]);router[_0x1cbf('0x7')](_0x1cbf('0xb'),auth[_0x1cbf('0x8')](),controller[_0x1cbf('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x1cbf('0x7')](_0x1cbf('0xd'),controller[_0x1cbf('0xe')]);router[_0x1cbf('0x7')](_0x1cbf('0xf'),auth[_0x1cbf('0x8')](),controller[_0x1cbf('0x10')]);router[_0x1cbf('0x11')]('/',auth[_0x1cbf('0x8')](),controller[_0x1cbf('0x12')]);router[_0x1cbf('0x11')](_0x1cbf('0xf'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x1cbf('0x13')](_0x1cbf('0xb'),auth[_0x1cbf('0x8')](),controller[_0x1cbf('0x14')]);router[_0x1cbf('0x15')]('/:id',auth[_0x1cbf('0x8')](),controller[_0x1cbf('0x16')]);module[_0x1cbf('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 55730c8..de1a589 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(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 45446ff..cfb282b 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 _0x1401=['Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','describe','uniqueid','value','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','download','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','%s.cypher','decryptFile','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x1401,0x13b));var _0x1140=function(_0x2e014c,_0x3cf186){_0x2e014c=_0x2e014c-0x0;var _0x460e32=_0x1401[_0x2e014c];return _0x460e32;};'use strict';var emlformat=require(_0x1140('0x0'));var rimraf=require(_0x1140('0x1'));var zipdir=require(_0x1140('0x2'));var jsonpatch=require(_0x1140('0x3'));var rp=require(_0x1140('0x4'));var moment=require('moment');var BPromise=require(_0x1140('0x5'));var Mustache=require(_0x1140('0x6'));var util=require(_0x1140('0x7'));var path=require(_0x1140('0x8'));var sox=require(_0x1140('0x9'));var csv=require(_0x1140('0xa'));var ejs=require(_0x1140('0xb'));var fs=require('fs');var fs_extra=require(_0x1140('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1140('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1140('0xe'));var Papa=require(_0x1140('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x1140('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1140('0x11'));var as=require(_0x1140('0x12'));var hardwareService=require(_0x1140('0x13'));var logger=require('../../config/logger')(_0x1140('0x14'));var utils=require(_0x1140('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1140('0x16'))['db'];function respondWithStatusCode(_0x3fd9bc,_0x1d26ed){_0x1d26ed=_0x1d26ed||0xcc;return function(_0x55a45a){if(_0x55a45a){return _0x3fd9bc[_0x1140('0x17')](_0x1d26ed);}return _0x3fd9bc[_0x1140('0x18')](_0x1d26ed)[_0x1140('0x19')]();};}function respondWithResult(_0x226625,_0x266758){_0x266758=_0x266758||0xc8;return function(_0x1da5ee){if(_0x1da5ee){return _0x226625[_0x1140('0x18')](_0x266758)['json'](_0x1da5ee);}};}function respondWithFilteredResult(_0x564039,_0x175820){return function(_0x46351d){if(_0x46351d){var _0x3b32fc=typeof _0x175820[_0x1140('0x1a')]===_0x1140('0x1b')&&typeof _0x175820[_0x1140('0x1c')]===_0x1140('0x1b');var _0x524580=_0x46351d[_0x1140('0x1d')];var _0x4c51dc=_0x3b32fc?0x0:_0x175820[_0x1140('0x1a')];var _0x2f4bb3=_0x3b32fc?_0x46351d[_0x1140('0x1d')]:_0x175820[_0x1140('0x1a')]+_0x175820[_0x1140('0x1c')];var _0x305596;if(_0x2f4bb3>=_0x524580){_0x2f4bb3=_0x524580;_0x305596=0xc8;}else{_0x305596=0xce;}_0x564039[_0x1140('0x18')](_0x305596);return _0x564039[_0x1140('0x1e')](_0x1140('0x1f'),_0x4c51dc+'-'+_0x2f4bb3+'/'+_0x524580)['json'](_0x46351d);}return null;};}function patchUpdates(_0x2a00b1){return function(_0x1b44d4){try{jsonpatch['apply'](_0x1b44d4,_0x2a00b1,!![]);}catch(_0x4f6db1){return BPromise[_0x1140('0x20')](_0x4f6db1);}return _0x1b44d4[_0x1140('0x21')]();};}function saveUpdates(_0x527ca3,_0x44f98d){return function(_0x3de229){if(_0x3de229){return _0x3de229[_0x1140('0x22')](_0x527ca3)[_0x1140('0x23')](function(_0xdb4bd5){return _0xdb4bd5;});}return null;};}function removeEntity(_0x38d59c,_0xebb6f5){return function(_0x4c537d){if(_0x4c537d){return _0x4c537d[_0x1140('0x24')]()[_0x1140('0x23')](function(){_0x38d59c[_0x1140('0x18')](0xcc)[_0x1140('0x19')]();});}};}function handleEntityNotFound(_0x346163,_0x2acc6b){return function(_0x4fb6c2){if(!_0x4fb6c2){_0x346163['sendStatus'](0x194);}return _0x4fb6c2;};}function handleError(_0x223214,_0x508c5a){_0x508c5a=_0x508c5a||0x1f4;return function(_0x579cf8){logger[_0x1140('0x25')](_0x579cf8[_0x1140('0x26')]);if(_0x579cf8['name']){delete _0x579cf8[_0x1140('0x27')];}_0x223214[_0x1140('0x18')](_0x508c5a)[_0x1140('0x28')](_0x579cf8);};}exports[_0x1140('0x29')]=function(_0x4ccf14,_0x2d2ed3){var _0x53529f={},_0x4f707f={},_0xd06a3d={'count':0x0,'rows':[]};var _0x43bc4a=_[_0x1140('0x2a')](db[_0x1140('0x2b')][_0x1140('0x2c')],function(_0x16d876){return{'name':_0x16d876['fieldName'],'type':_0x16d876[_0x1140('0x2d')][_0x1140('0x2e')]};});_0x4f707f[_0x1140('0x2f')]=_['differenceBy'](_[_0x1140('0x2a')](_0x43bc4a,_0x1140('0x27')),[_0x1140('0x30')]);_0x4f707f[_0x1140('0x31')]=_[_0x1140('0x32')](_0x4ccf14[_0x1140('0x31')]);_0x4f707f[_0x1140('0x33')]=_[_0x1140('0x34')](_0x4f707f['model'],_0x4f707f[_0x1140('0x31')]);_0x53529f['attributes']=_[_0x1140('0x34')](_0x4f707f[_0x1140('0x2f')],qs['fields'](_0x4ccf14[_0x1140('0x31')][_0x1140('0x35')]));_0x53529f[_0x1140('0x36')]=_0x53529f[_0x1140('0x36')]['length']?_0x53529f[_0x1140('0x36')]:_0x4f707f[_0x1140('0x2f')];if(!_0x4ccf14[_0x1140('0x31')][_0x1140('0x37')]('nolimit')){_0x53529f[_0x1140('0x1c')]=qs[_0x1140('0x1c')](_0x4ccf14[_0x1140('0x31')][_0x1140('0x1c')]);_0x53529f['offset']=qs[_0x1140('0x1a')](_0x4ccf14['query'][_0x1140('0x1a')]);}_0x53529f['order']=qs[_0x1140('0x38')](_0x4ccf14[_0x1140('0x31')][_0x1140('0x38')]);_0x53529f[_0x1140('0x39')]=qs[_0x1140('0x33')](_[_0x1140('0x3a')](_0x4ccf14['query'],_0x4f707f[_0x1140('0x33')]),_0x43bc4a);if(_0x4ccf14[_0x1140('0x31')][_0x1140('0x3b')]){_0x53529f[_0x1140('0x39')]=_['merge'](_0x53529f[_0x1140('0x39')],{'$or':_['map'](_0x43bc4a,function(_0x2aed2e){if(_0x2aed2e[_0x1140('0x2d')]!==_0x1140('0x3c')){var _0x2a7f4f={};_0x2a7f4f[_0x2aed2e[_0x1140('0x27')]]={'$like':'%'+_0x4ccf14['query'][_0x1140('0x3b')]+'%'};return _0x2a7f4f;}})});}_0x53529f=_['merge']({},_0x53529f,_0x4ccf14['options']);var _0x58ae20={'where':_0x53529f[_0x1140('0x39')]};return db[_0x1140('0x2b')][_0x1140('0x1d')](_0x58ae20)[_0x1140('0x23')](function(_0x56be67){_0xd06a3d[_0x1140('0x1d')]=_0x56be67;if(_0x4ccf14[_0x1140('0x31')][_0x1140('0x3d')]){_0x53529f[_0x1140('0x3e')]=[{'all':!![]}];}return db[_0x1140('0x2b')][_0x1140('0x3f')](_0x53529f);})[_0x1140('0x23')](function(_0x34d0e0){_0xd06a3d[_0x1140('0x40')]=_0x34d0e0;return _0xd06a3d;})[_0x1140('0x23')](respondWithFilteredResult(_0x2d2ed3,_0x53529f))[_0x1140('0x41')](handleError(_0x2d2ed3,null));};exports[_0x1140('0x42')]=function(_0x4934c4,_0x984e06){var _0x5beb54={'raw':![],'where':{'id':_0x4934c4[_0x1140('0x43')]['id']}},_0x523def={};_0x523def[_0x1140('0x2f')]=_[_0x1140('0x32')](db[_0x1140('0x2b')][_0x1140('0x2c')]);_0x523def[_0x1140('0x31')]=_[_0x1140('0x32')](_0x4934c4[_0x1140('0x31')]);_0x523def[_0x1140('0x33')]=_[_0x1140('0x34')](_0x523def[_0x1140('0x2f')],_0x523def['query']);_0x5beb54[_0x1140('0x36')]=_[_0x1140('0x34')](_0x523def['model'],qs[_0x1140('0x35')](_0x4934c4['query'][_0x1140('0x35')]));_0x5beb54[_0x1140('0x36')]=_0x5beb54[_0x1140('0x36')][_0x1140('0x44')]?_0x5beb54[_0x1140('0x36')]:_0x523def['model'];if(_0x4934c4['query'][_0x1140('0x3d')]){_0x5beb54['include']=[{'all':!![]}];}_0x5beb54=_[_0x1140('0x45')]({},_0x5beb54,_0x4934c4['options']);return db[_0x1140('0x2b')][_0x1140('0x46')](_0x5beb54)['then'](handleEntityNotFound(_0x984e06,null))[_0x1140('0x23')](respondWithResult(_0x984e06,null))[_0x1140('0x41')](handleError(_0x984e06,null));};exports['create']=function(_0x5657f0,_0x2a743c){return db[_0x1140('0x2b')][_0x1140('0x47')](_0x5657f0[_0x1140('0x48')],{})['then'](respondWithResult(_0x2a743c,0xc9))['catch'](handleError(_0x2a743c,null));};exports[_0x1140('0x22')]=function(_0x35f7ff,_0x25ef12){if(_0x35f7ff['body']['id']){delete _0x35f7ff[_0x1140('0x48')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x35f7ff['params']['id']}})[_0x1140('0x23')](handleEntityNotFound(_0x25ef12,null))[_0x1140('0x23')](saveUpdates(_0x35f7ff[_0x1140('0x48')],null))[_0x1140('0x23')](respondWithResult(_0x25ef12,null))[_0x1140('0x41')](handleError(_0x25ef12,null));};exports[_0x1140('0x49')]=function(_0x241292,_0x4f5cd8){return db[_0x1140('0x2b')][_0x1140('0x49')]()[_0x1140('0x23')](respondWithResult(_0x4f5cd8,null))[_0x1140('0x41')](handleError(_0x4f5cd8,null));};exports['download']=function(_0x453f7c,_0x35f4f2,_0x2aa92d){var _0x5cbbdc=require('../../components/encryptor');var _0x4f8ca7=![];var _0x5c3370={};if(_0x453f7c[_0x1140('0x31')][_0x1140('0x2d')]&&_0x453f7c[_0x1140('0x31')]['type']===_0x1140('0x4a')){_0x5c3370[_0x1140('0x4a')]=_0x453f7c[_0x1140('0x43')]['id'];}else{_0x5c3370['id']=_0x453f7c[_0x1140('0x43')]['id'];}return db['VoiceRecording'][_0x1140('0x46')]({'where':_0x5c3370,'attributes':['id',_0x1140('0x4b')],'raw':!![]})[_0x1140('0x23')](handleEntityNotFound(_0x35f4f2,null))['then'](function(_0x474789){if(_0x474789){var _0x5c10dd=_0x474789['value'];var _0x4e8066=util[_0x1140('0x30')]('%s.cypher',_0x5c10dd);if(fs[_0x1140('0x4c')](_0x4e8066)){_0x4f8ca7=!![];return _0x5cbbdc['decryptFile'](_0x4e8066,_0x5c10dd,config['secrets'][_0x1140('0x4d')])[_0x1140('0x23')](function(){return _0x474789;});}return _0x474789;}})['then'](function(_0x22bda1){if(_0x22bda1){var _0x1cd4b7=_0x22bda1[_0x1140('0x4b')];if(!fs['existsSync'](_0x1cd4b7)){throw new db[(_0x1140('0x4e'))][(_0x1140('0x4f'))](_0x1140('0x50'));}if(_0x22bda1['filename']){return _0x35f4f2[_0x1140('0x51')](_0x1cd4b7,_0x22bda1[_0x1140('0x52')]+path[_0x1140('0x53')](_0x1cd4b7),function(){if(_0x4f8ca7){fs['unlink'](_0x1cd4b7);}});}else{return _0x35f4f2[_0x1140('0x51')](_0x1cd4b7,function(_0x1a7310){if(_0x4f8ca7){fs[_0x1140('0x54')](_0x1cd4b7);}});}}})['catch'](function(_0x545d4f){if(_0x545d4f[_0x1140('0x55')]===_0x1140('0x50')){_0x35f4f2[_0x1140('0x18')](0x194)['send'](_0x1140('0x56'));}else{return handleError(_0x35f4f2,null);}});};exports[_0x1140('0x57')]=function(_0xa36c8a,_0x4abefd,_0x5a89b7){var _0x2e2d57=require(_0x1140('0x58'));var _0x6e98bd=![];var _0x26d549={'$and':[db[_0x1140('0x59')][_0x1140('0x39')](db[_0x1140('0x59')]['fn'](_0x1140('0x5a'),db[_0x1140('0x59')][_0x1140('0x5b')](_0x1140('0x4a'))),_0xa36c8a['query']['token'])]};if(_0xa36c8a['query'][_0x1140('0x2d')]&&_0xa36c8a[_0x1140('0x31')]['type']==='uniqueid'){_0x26d549['$and']['push']({'uniqueid':_0xa36c8a[_0x1140('0x43')]['id']});}else{_0x26d549[_0x1140('0x5c')][_0x1140('0x5d')]({'id':_0xa36c8a[_0x1140('0x43')]['id']});}return db[_0x1140('0x2b')][_0x1140('0x46')]({'where':_0x26d549,'attributes':['id','value'],'raw':!![]})[_0x1140('0x23')](handleEntityNotFound(_0x4abefd,null))[_0x1140('0x23')](function(_0x10ccad){if(_0x10ccad){var _0x496035=util[_0x1140('0x30')](_0x1140('0x5e'),_0x10ccad[_0x1140('0x4b')]);if(fs['existsSync'](_0x496035)){_0x6e98bd=!![];return _0x2e2d57[_0x1140('0x5f')](_0x496035,_0x10ccad[_0x1140('0x4b')],config[_0x1140('0x60')][_0x1140('0x4d')])['then'](function(){return _0x10ccad;});}return _0x10ccad;}})['then'](function(_0x111fdd){if(_0x111fdd){if(!fs[_0x1140('0x4c')](_0x111fdd[_0x1140('0x4b')])){throw new db[(_0x1140('0x4e'))][(_0x1140('0x4f'))](_0x1140('0x50'));}if(_0x111fdd[_0x1140('0x52')]){return _0x4abefd[_0x1140('0x51')](_0x111fdd[_0x1140('0x4b')],_0x111fdd[_0x1140('0x52')]+path['extname'](_0x111fdd[_0x1140('0x4b')]),function(){if(_0x6e98bd){fs[_0x1140('0x54')](_0x111fdd['value']);}});}else{return _0x4abefd[_0x1140('0x51')](_0x111fdd[_0x1140('0x4b')],function(_0x1bd6ed){if(_0x6e98bd){fs[_0x1140('0x54')](_0x111fdd[_0x1140('0x4b')]);}});}}})['catch'](handleError(_0x4abefd,null));};exports[_0x1140('0x24')]=function(_0x224e56,_0x19f87c){return db['VoiceRecording'][_0x1140('0x46')]({'where':{'id':_0x224e56[_0x1140('0x43')]['id']}})['then'](function(_0x591b0c){if(_[_0x1140('0x61')](_0x591b0c)){throw new ReferenceError(_0x1140('0x62'));}return _0x591b0c;})[_0x1140('0x23')](function(_0x34ad11){var _0x38d6e7=_0x34ad11[_0x1140('0x4b')];logger[_0x1140('0x63')](_0x1140('0x64'),_0x38d6e7);if(!_[_0x1140('0x61')](_0x34ad11[_0x1140('0x4b')])&&fs[_0x1140('0x4c')](_0x38d6e7)){logger['info'](_0x1140('0x65')+_0x38d6e7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1140('0x66')](_0x38d6e7);}_0x38d6e7=_0x38d6e7+_0x1140('0x67');if(!_[_0x1140('0x61')](_0x34ad11[_0x1140('0x4b')])&&fs[_0x1140('0x4c')](_0x38d6e7)){logger[_0x1140('0x63')](_0x1140('0x65')+_0x38d6e7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x38d6e7);}return _0x34ad11;})[_0x1140('0x23')](function(_0x2edffd){if(!_0x2edffd)throw new InternalError();return _0x2edffd[_0x1140('0x24')]();})[_0x1140('0x23')](function(){_0x19f87c[_0x1140('0x18')](0xcc)[_0x1140('0x19')]();})[_0x1140('0x41')](handleError(_0x19f87c,null));};function getBucketslist(_0x3dee3d,_0x350a09,_0x8deace){return new Promise(function(_0x4220b2,_0x49fb05){var _0x31ea85=new AWS['S3']({'accessKeyId':_0x350a09,'secretAccessKey':_0x3dee3d,'region':_0x8deace});_0x31ea85[_0x1140('0x68')]({},function(_0x5c6817,_0x28f07c){if(_0x5c6817){return _0x49fb05(_0x5c6817);}else{return _0x4220b2(_0x28f07c);}});});}function createBucket(_0x4e8ae0,_0x1ed165,_0x204aa1,_0x556c91){return new Promise(function(_0x563575,_0x1dfbc6){var _0xd4003e=new AWS['S3']({'accessKeyId':_0x1ed165,'secretAccessKey':_0x4e8ae0,'region':_0x204aa1});_0xd4003e['createBucket']({'Bucket':_0x556c91},function(_0x3a587e,_0x1efb66){if(_0x3a587e){return _0x1dfbc6(_0x3a587e);}else{return _0x563575(_0x1efb66);}});});}function uploadFile(_0x5eea69,_0xe93951,_0x1e1ae3,_0x12c7e0,_0x1f7428,_0x57ae46){return new Promise(function(_0xd5959b,_0x1a60ee){var _0x48fdb3=new AWS['S3']({'accessKeyId':_0xe93951,'secretAccessKey':_0x5eea69,'region':_0x1e1ae3});_0x48fdb3[_0x1140('0x69')]({'Bucket':_0x12c7e0,'Key':_0x1f7428,'Body':_0x57ae46},function(_0x5222d6,_0x588458){if(_0x5222d6){return _0x1a60ee(_0x5222d6);}else{return _0xd5959b(_0x588458);}});});}function startTranscribe(_0x40ce12,_0x6c7e4d,_0x40568d,_0x5483d2,_0x405957,_0x21f68d){return new Promise(function(_0x5cbdb6,_0x1942e2){var _0x51bf24=new AWS[(_0x1140('0x6a'))]({'accessKeyId':_0x6c7e4d,'secretAccessKey':_0x40ce12,'region':_0x40568d});_0x51bf24[_0x1140('0x6b')]({'TranscriptionJobName':_0x5483d2,'LanguageCode':_0x405957,'Media':{'MediaFileUri':_0x21f68d}},function(_0x4b5c99,_0x3a000d){if(_0x4b5c99){return _0x1942e2(_0x4b5c99);}else{return _0x5cbdb6(_0x3a000d);}});});}function transcribe(_0x1511ec,_0x17ad6b,_0x22149f,_0x2921e5,_0x29238d,_0x5cc61f,_0x4d5d31){return new Promise(function(_0xbdf89c,_0x66c538){var _0x242ade={};logger[_0x1140('0x63')](util[_0x1140('0x30')](_0x1140('0x6c'),_0x1511ec,_0x29238d));return uploadFile(_0x17ad6b,_0x22149f,_0x2921e5,_0x29238d,path[_0x1140('0x6d')](_0x5cc61f),fs[_0x1140('0x6e')](_0x5cc61f))[_0x1140('0x23')](function(_0x42bd52){logger[_0x1140('0x63')](util['format'](_0x1140('0x6f'),_0x1511ec,_0x29238d,_0x42bd52['Location']));_0x242ade[_0x1140('0x70')]=_0x42bd52[_0x1140('0x71')];_0x242ade[_0x1140('0x72')]=_0x42bd52[_0x1140('0x73')];logger[_0x1140('0x63')](util['format'](_0x1140('0x74'),_0x1511ec));return startTranscribe(_0x17ad6b,_0x22149f,_0x2921e5,uuidv4(),_0x4d5d31,_0x42bd52[_0x1140('0x73')]);})[_0x1140('0x23')](function(_0x4ba0e8){logger[_0x1140('0x63')](util[_0x1140('0x30')](_0x1140('0x75'),_0x1511ec,_0x4ba0e8[_0x1140('0x76')][_0x1140('0x77')]));_0x242ade['transcribeName']=_0x4ba0e8[_0x1140('0x76')][_0x1140('0x77')];_0x242ade[_0x1140('0x78')]=_0x4ba0e8[_0x1140('0x76')]['TranscriptionJobStatus'];return _0xbdf89c(_0x242ade);})['catch'](function(_0x454864){return _0x66c538(_0x454864);});});}exports['runTranscribe']=function(_0x27bc30,_0x1b71af,_0x176d93){var _0x5d6d8f;var _0x497fbf;var _0x3d913b;var _0x3e362e=require(_0x1140('0x58'));return db[_0x1140('0x2b')]['findOne']({'where':{'id':_0x27bc30[_0x1140('0x43')]['id']}})[_0x1140('0x23')](function(_0x1c9b69){if(_0x1c9b69){var _0x4ecfd2=util[_0x1140('0x30')](_0x1140('0x5e'),_0x1c9b69['value']);if(fs[_0x1140('0x4c')](_0x4ecfd2)){cypher=!![];return _0x3e362e[_0x1140('0x5f')](_0x4ecfd2,_0x1c9b69[_0x1140('0x4b')],config[_0x1140('0x60')][_0x1140('0x4d')])[_0x1140('0x23')](function(){return _0x1c9b69;});}return _0x1c9b69;}})['then'](function(_0x1d4058){if(!_0x1d4058){throw new db[(_0x1140('0x4e'))]['ValidationError'](_0x1140('0x79'));}_0x497fbf=_0x1d4058;return db[_0x1140('0x7a')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1b71af,null))['then'](function(_0x2bb4ac){if(_0x2bb4ac){_0x5d6d8f=_0x2bb4ac;if(!_0x5d6d8f[_0x1140('0x7b')]||!_0x5d6d8f[_0x1140('0x7c')]||!_0x5d6d8f['transcribeRegion']||!_0x5d6d8f[_0x1140('0x7d')]||!_0x5d6d8f[_0x1140('0x70')]){throw new db[(_0x1140('0x4e'))][(_0x1140('0x4f'))](_0x1140('0x7e'));}if(_0x27bc30[_0x1140('0x48')][_0x1140('0x7f')]&&(!_0x5d6d8f[_0x1140('0x80')]||!_0x5d6d8f[_0x1140('0x81')]||!_0x5d6d8f[_0x1140('0x82')]||!_0x5d6d8f[_0x1140('0x7d')]||!_0x5d6d8f[_0x1140('0x70')])){throw new db[(_0x1140('0x4e'))]['ValidationError'](_0x1140('0x83'));}return db[_0x1140('0x84')][_0x1140('0x85')]({'where':{'id':_0x5d6d8f[_0x1140('0x7c')]}});}})[_0x1140('0x23')](function(_0x9e3902){if(!_0x9e3902){throw new db[(_0x1140('0x4e'))][(_0x1140('0x4f'))](_0x1140('0x86'));}if(!_0x9e3902[_0x1140('0x87')]||!_0x9e3902[_0x1140('0x88')]){throw new db[(_0x1140('0x4e'))]['ValidationError'](_0x1140('0x89'));}_0x3d913b=_0x9e3902;return getBucketslist(_0x3d913b[_0x1140('0x87')],_0x3d913b[_0x1140('0x88')],_0x5d6d8f['transcribeRegion']);})[_0x1140('0x23')](function(_0xdc81f4){if(_0xdc81f4&&_0xdc81f4[_0x1140('0x8a')]){var _0x8706ec=_['find'](_0xdc81f4[_0x1140('0x8a')],function(_0x2045e9){return _0x2045e9['Name']===_0x5d6d8f[_0x1140('0x70')];});if(!_0x8706ec){logger[_0x1140('0x63')](util[_0x1140('0x30')](_0x1140('0x8b'),_0x27bc30[_0x1140('0x43')]['id'],_0x5d6d8f[_0x1140('0x70')]));return createBucket(_0x3d913b[_0x1140('0x87')],_0x3d913b[_0x1140('0x88')],_0x5d6d8f['transcribeRegion'],_0x5d6d8f['bucket']);}logger['info'](util[_0x1140('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x27bc30[_0x1140('0x43')]['id'],_0x5d6d8f['bucket']));return;}})[_0x1140('0x23')](function(_0x5274fb){if(_0x497fbf[_0x1140('0x78')]===_0x1140('0x8c')){return transcribe(_0x27bc30[_0x1140('0x43')]['id'],_0x3d913b[_0x1140('0x87')],_0x3d913b[_0x1140('0x88')],_0x5d6d8f[_0x1140('0x8d')],_0x5d6d8f[_0x1140('0x70')],_0x497fbf['value'],_0x5d6d8f[_0x1140('0x7d')]);}else{logger['info'](util[_0x1140('0x30')](_0x1140('0x8e'),_0x27bc30[_0x1140('0x43')]['id']));return{'transcribeStatus':_0x1140('0x8f')};}})[_0x1140('0x23')](function(_0x52833a){if(_0x52833a){_0x52833a[_0x1140('0x90')]=_0x27bc30[_0x1140('0x48')][_0x1140('0x7f')];return _0x497fbf[_0x1140('0x91')](_0x52833a);}})[_0x1140('0x23')](respondWithResult(_0x1b71af,null))[_0x1140('0x41')](handleError(_0x1b71af,null));};function writeFile(_0x4feefa,_0x2d69ed){return new Promise(function(_0x43150d,_0x518bfd){fs['writeFile'](_0x2d69ed,_0x4feefa,function(_0x571f27,_0x7b83ea){if(_0x571f27){return _0x518bfd(_0x571f27);}else{return _0x43150d(_0x7b83ea);}});});}exports[_0x1140('0x92')]=function(_0x2cdce1,_0x52b873,_0x269cd){return db[_0x1140('0x2b')][_0x1140('0x85')]({'where':{'id':_0x2cdce1[_0x1140('0x43')]['id']}})[_0x1140('0x23')](handleEntityNotFound(_0x52b873))[_0x1140('0x23')](function(_0x2b1326){if(_0x2b1326&&_0x2b1326[_0x1140('0x93')]){var _0x12c4af=_0x2b1326[_0x1140('0x93')];var _0x261a2b=config['root']+_0x1140('0x94')+_0x2b1326['id']+_0x1140('0x95');if(fs[_0x1140('0x4c')](_0x261a2b)){return _0x261a2b;}return writeFile(_0x12c4af,_0x261a2b)['then'](function(){return _0x261a2b;});}else{throw new db['Sequelize'][(_0x1140('0x4f'))](_0x1140('0x96'));}})[_0x1140('0x23')](function(_0x49fc57){return _0x52b873[_0x1140('0x51')](_0x49fc57);})[_0x1140('0x41')](handleError(_0x52b873));}; \ No newline at end of file +var _0xb5d0=['type','key','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','../../components/encryptor','uniqueid','value','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','download','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','%s.cypher','secrets','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','downloadTranscribe','fileText','root','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','fieldName'];(function(_0x2d84fb,_0x4eab4f){var _0x1c6c9b=function(_0x1079b3){while(--_0x1079b3){_0x2d84fb['push'](_0x2d84fb['shift']());}};_0x1c6c9b(++_0x4eab4f);}(_0xb5d0,0x189));var _0x0b5d=function(_0x50ebe8,_0x452474){_0x50ebe8=_0x50ebe8-0x0;var _0x5276fd=_0xb5d0[_0x50ebe8];return _0x5276fd;};'use strict';var emlformat=require(_0x0b5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b5d('0x1'));var jsonpatch=require(_0x0b5d('0x2'));var rp=require(_0x0b5d('0x3'));var moment=require(_0x0b5d('0x4'));var BPromise=require(_0x0b5d('0x5'));var Mustache=require(_0x0b5d('0x6'));var util=require(_0x0b5d('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0b5d('0x8'));var fs=require('fs');var fs_extra=require(_0x0b5d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b5d('0xa'));var jsforce=require(_0x0b5d('0xb'));var deskjs=require(_0x0b5d('0xc'));var toCsv=require(_0x0b5d('0xd'));var querystring=require('querystring');var Papa=require(_0x0b5d('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x0b5d('0xf'));var Redis=require(_0x0b5d('0x10'));var authService=require(_0x0b5d('0x11'));var qs=require(_0x0b5d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b5d('0x13'));var logger=require(_0x0b5d('0x14'))(_0x0b5d('0x15'));var utils=require(_0x0b5d('0x16'));var config=require(_0x0b5d('0x17'));var licenseUtil=require(_0x0b5d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5eae96,_0x379148){_0x379148=_0x379148||0xcc;return function(_0x44818d){if(_0x44818d){return _0x5eae96[_0x0b5d('0x19')](_0x379148);}return _0x5eae96[_0x0b5d('0x1a')](_0x379148)[_0x0b5d('0x1b')]();};}function respondWithResult(_0x23423a,_0xe37f56){_0xe37f56=_0xe37f56||0xc8;return function(_0xfe55f0){if(_0xfe55f0){return _0x23423a[_0x0b5d('0x1a')](_0xe37f56)['json'](_0xfe55f0);}};}function respondWithFilteredResult(_0x2d76b0,_0x6f67a4){return function(_0x59037d){if(_0x59037d){var _0xb2cb82=typeof _0x6f67a4[_0x0b5d('0x1c')]==='undefined'&&typeof _0x6f67a4['limit']==='undefined';var _0x4fe71c=_0x59037d[_0x0b5d('0x1d')];var _0x4c6291=_0xb2cb82?0x0:_0x6f67a4['offset'];var _0x10c7ec=_0xb2cb82?_0x59037d[_0x0b5d('0x1d')]:_0x6f67a4[_0x0b5d('0x1c')]+_0x6f67a4[_0x0b5d('0x1e')];var _0x5edacc;if(_0x10c7ec>=_0x4fe71c){_0x10c7ec=_0x4fe71c;_0x5edacc=0xc8;}else{_0x5edacc=0xce;}_0x2d76b0[_0x0b5d('0x1a')](_0x5edacc);return _0x2d76b0[_0x0b5d('0x1f')](_0x0b5d('0x20'),_0x4c6291+'-'+_0x10c7ec+'/'+_0x4fe71c)[_0x0b5d('0x21')](_0x59037d);}return null;};}function patchUpdates(_0x35c407){return function(_0xab291a){try{jsonpatch[_0x0b5d('0x22')](_0xab291a,_0x35c407,!![]);}catch(_0x551c7e){return BPromise[_0x0b5d('0x23')](_0x551c7e);}return _0xab291a['save']();};}function saveUpdates(_0xa4ef56,_0x4e640d){return function(_0x2bd630){if(_0x2bd630){return _0x2bd630[_0x0b5d('0x24')](_0xa4ef56)[_0x0b5d('0x25')](function(_0x561e63){return _0x561e63;});}return null;};}function removeEntity(_0x225854,_0x36690d){return function(_0x29230f){if(_0x29230f){return _0x29230f[_0x0b5d('0x26')]()[_0x0b5d('0x25')](function(){_0x225854['status'](0xcc)[_0x0b5d('0x1b')]();});}};}function handleEntityNotFound(_0x910d95,_0x642b68){return function(_0x190c4d){if(!_0x190c4d){_0x910d95[_0x0b5d('0x19')](0x194);}return _0x190c4d;};}function handleError(_0x1ab58c,_0x30a465){_0x30a465=_0x30a465||0x1f4;return function(_0x5e6386){logger['error'](_0x5e6386[_0x0b5d('0x27')]);if(_0x5e6386['name']){delete _0x5e6386[_0x0b5d('0x28')];}_0x1ab58c[_0x0b5d('0x1a')](_0x30a465)[_0x0b5d('0x29')](_0x5e6386);};}exports['index']=function(_0x5475ce,_0xd840f2){var _0x17b2d9={},_0x2a503d={},_0x222aea={'count':0x0,'rows':[]};var _0x31dc91=_[_0x0b5d('0x2a')](db['VoiceRecording'][_0x0b5d('0x2b')],function(_0x434199){return{'name':_0x434199[_0x0b5d('0x2c')],'type':_0x434199[_0x0b5d('0x2d')][_0x0b5d('0x2e')]};});_0x2a503d[_0x0b5d('0x2f')]=_[_0x0b5d('0x30')](_['map'](_0x31dc91,'name'),[_0x0b5d('0x31')]);_0x2a503d[_0x0b5d('0x32')]=_['keys'](_0x5475ce['query']);_0x2a503d[_0x0b5d('0x33')]=_[_0x0b5d('0x34')](_0x2a503d[_0x0b5d('0x2f')],_0x2a503d[_0x0b5d('0x32')]);_0x17b2d9[_0x0b5d('0x35')]=_[_0x0b5d('0x34')](_0x2a503d[_0x0b5d('0x2f')],qs[_0x0b5d('0x36')](_0x5475ce[_0x0b5d('0x32')][_0x0b5d('0x36')]));_0x17b2d9[_0x0b5d('0x35')]=_0x17b2d9['attributes'][_0x0b5d('0x37')]?_0x17b2d9[_0x0b5d('0x35')]:_0x2a503d[_0x0b5d('0x2f')];if(!_0x5475ce['query'][_0x0b5d('0x38')]('nolimit')){_0x17b2d9[_0x0b5d('0x1e')]=qs[_0x0b5d('0x1e')](_0x5475ce['query'][_0x0b5d('0x1e')]);_0x17b2d9[_0x0b5d('0x1c')]=qs[_0x0b5d('0x1c')](_0x5475ce[_0x0b5d('0x32')][_0x0b5d('0x1c')]);}_0x17b2d9[_0x0b5d('0x39')]=qs[_0x0b5d('0x3a')](_0x5475ce['query'][_0x0b5d('0x3a')]);_0x17b2d9[_0x0b5d('0x3b')]=qs['filters'](_[_0x0b5d('0x3c')](_0x5475ce[_0x0b5d('0x32')],_0x2a503d[_0x0b5d('0x33')]),_0x31dc91);if(_0x5475ce[_0x0b5d('0x32')][_0x0b5d('0x3d')]){_0x17b2d9[_0x0b5d('0x3b')]=_[_0x0b5d('0x3e')](_0x17b2d9[_0x0b5d('0x3b')],{'$or':_[_0x0b5d('0x2a')](_0x31dc91,function(_0x10a59b){if(_0x10a59b[_0x0b5d('0x2d')]!==_0x0b5d('0x3f')){var _0x45cb14={};_0x45cb14[_0x10a59b['name']]={'$like':'%'+_0x5475ce['query'][_0x0b5d('0x3d')]+'%'};return _0x45cb14;}})});}_0x17b2d9=_['merge']({},_0x17b2d9,_0x5475ce[_0x0b5d('0x40')]);var _0x1034fe={'where':_0x17b2d9['where']};return db[_0x0b5d('0x41')]['count'](_0x1034fe)[_0x0b5d('0x25')](function(_0x715c73){_0x222aea[_0x0b5d('0x1d')]=_0x715c73;if(_0x5475ce['query'][_0x0b5d('0x42')]){_0x17b2d9[_0x0b5d('0x43')]=[{'all':!![]}];}return db[_0x0b5d('0x41')][_0x0b5d('0x44')](_0x17b2d9);})[_0x0b5d('0x25')](function(_0x2b0805){_0x222aea[_0x0b5d('0x45')]=_0x2b0805;return _0x222aea;})[_0x0b5d('0x25')](respondWithFilteredResult(_0xd840f2,_0x17b2d9))['catch'](handleError(_0xd840f2,null));};exports[_0x0b5d('0x46')]=function(_0x3d8264,_0x3b535d){var _0x33b33e={'raw':![],'where':{'id':_0x3d8264[_0x0b5d('0x47')]['id']}},_0x58e29a={};_0x58e29a['model']=_[_0x0b5d('0x48')](db['VoiceRecording'][_0x0b5d('0x2b')]);_0x58e29a['query']=_['keys'](_0x3d8264[_0x0b5d('0x32')]);_0x58e29a[_0x0b5d('0x33')]=_[_0x0b5d('0x34')](_0x58e29a[_0x0b5d('0x2f')],_0x58e29a['query']);_0x33b33e['attributes']=_[_0x0b5d('0x34')](_0x58e29a[_0x0b5d('0x2f')],qs[_0x0b5d('0x36')](_0x3d8264[_0x0b5d('0x32')]['fields']));_0x33b33e['attributes']=_0x33b33e['attributes'][_0x0b5d('0x37')]?_0x33b33e[_0x0b5d('0x35')]:_0x58e29a[_0x0b5d('0x2f')];if(_0x3d8264[_0x0b5d('0x32')][_0x0b5d('0x42')]){_0x33b33e[_0x0b5d('0x43')]=[{'all':!![]}];}_0x33b33e=_[_0x0b5d('0x3e')]({},_0x33b33e,_0x3d8264[_0x0b5d('0x40')]);return db[_0x0b5d('0x41')]['find'](_0x33b33e)[_0x0b5d('0x25')](handleEntityNotFound(_0x3b535d,null))['then'](respondWithResult(_0x3b535d,null))[_0x0b5d('0x49')](handleError(_0x3b535d,null));};exports[_0x0b5d('0x4a')]=function(_0x5219d7,_0x2b3503){return db[_0x0b5d('0x41')]['create'](_0x5219d7[_0x0b5d('0x4b')],{})['then'](respondWithResult(_0x2b3503,0xc9))[_0x0b5d('0x49')](handleError(_0x2b3503,null));};exports[_0x0b5d('0x24')]=function(_0x3a4bee,_0xf2d0a0){if(_0x3a4bee['body']['id']){delete _0x3a4bee[_0x0b5d('0x4b')]['id'];}return db[_0x0b5d('0x41')][_0x0b5d('0x4c')]({'where':{'id':_0x3a4bee[_0x0b5d('0x47')]['id']}})['then'](handleEntityNotFound(_0xf2d0a0,null))[_0x0b5d('0x25')](saveUpdates(_0x3a4bee[_0x0b5d('0x4b')],null))[_0x0b5d('0x25')](respondWithResult(_0xf2d0a0,null))[_0x0b5d('0x49')](handleError(_0xf2d0a0,null));};exports[_0x0b5d('0x4d')]=function(_0x4d3168,_0x43d32d){return db['VoiceRecording'][_0x0b5d('0x4d')]()[_0x0b5d('0x25')](respondWithResult(_0x43d32d,null))[_0x0b5d('0x49')](handleError(_0x43d32d,null));};exports['download']=function(_0x500c08,_0x1201c2,_0x16712d){var _0x4821de=require(_0x0b5d('0x4e'));var _0x1a86c5=![];var _0x4435fa={};if(_0x500c08[_0x0b5d('0x32')][_0x0b5d('0x2d')]&&_0x500c08['query'][_0x0b5d('0x2d')]==='uniqueid'){_0x4435fa[_0x0b5d('0x4f')]=_0x500c08[_0x0b5d('0x47')]['id'];}else{_0x4435fa['id']=_0x500c08[_0x0b5d('0x47')]['id'];}return db[_0x0b5d('0x41')][_0x0b5d('0x4c')]({'where':_0x4435fa,'attributes':['id',_0x0b5d('0x50')],'raw':!![]})[_0x0b5d('0x25')](handleEntityNotFound(_0x1201c2,null))[_0x0b5d('0x25')](function(_0x1b0269){if(_0x1b0269){var _0x4fe064=_0x1b0269[_0x0b5d('0x50')];var _0x53ee38=util['format']('%s.cypher',_0x4fe064);if(fs[_0x0b5d('0x51')](_0x53ee38)){_0x1a86c5=!![];return _0x4821de['decryptFile'](_0x53ee38,_0x4fe064,config['secrets'][_0x0b5d('0x52')])[_0x0b5d('0x25')](function(){return _0x1b0269;});}return _0x1b0269;}})[_0x0b5d('0x25')](function(_0x1f8743){if(_0x1f8743){var _0x25b6d1=_0x1f8743[_0x0b5d('0x50')];if(!fs[_0x0b5d('0x51')](_0x25b6d1)){throw new db[(_0x0b5d('0x53'))][(_0x0b5d('0x54'))](_0x0b5d('0x55'));}if(_0x1f8743['filename']){return _0x1201c2[_0x0b5d('0x56')](_0x25b6d1,_0x1f8743[_0x0b5d('0x57')]+path[_0x0b5d('0x58')](_0x25b6d1),function(){if(_0x1a86c5){fs[_0x0b5d('0x59')](_0x25b6d1);}});}else{return _0x1201c2['download'](_0x25b6d1,function(_0xbda4d0){if(_0x1a86c5){fs[_0x0b5d('0x59')](_0x25b6d1);}});}}})[_0x0b5d('0x49')](function(_0x345ba6){if(_0x345ba6[_0x0b5d('0x5a')]===_0x0b5d('0x55')){_0x1201c2[_0x0b5d('0x1a')](0x194)[_0x0b5d('0x29')](_0x0b5d('0x5b'));}else{return handleError(_0x1201c2,null);}});};exports[_0x0b5d('0x5c')]=function(_0x193654,_0x4fd940,_0x443430){var _0x514529=require(_0x0b5d('0x4e'));var _0xb24a44=![];var _0x4fcfdd={'$and':[db[_0x0b5d('0x5d')][_0x0b5d('0x3b')](db[_0x0b5d('0x5d')]['fn'](_0x0b5d('0x5e'),db[_0x0b5d('0x5d')][_0x0b5d('0x5f')]('uniqueid')),_0x193654[_0x0b5d('0x32')][_0x0b5d('0x60')])]};if(_0x193654[_0x0b5d('0x32')]['type']&&_0x193654[_0x0b5d('0x32')][_0x0b5d('0x2d')]===_0x0b5d('0x4f')){_0x4fcfdd[_0x0b5d('0x61')][_0x0b5d('0x62')]({'uniqueid':_0x193654[_0x0b5d('0x47')]['id']});}else{_0x4fcfdd[_0x0b5d('0x61')][_0x0b5d('0x62')]({'id':_0x193654[_0x0b5d('0x47')]['id']});}return db[_0x0b5d('0x41')][_0x0b5d('0x4c')]({'where':_0x4fcfdd,'attributes':['id',_0x0b5d('0x50')],'raw':!![]})[_0x0b5d('0x25')](handleEntityNotFound(_0x4fd940,null))['then'](function(_0x559e20){if(_0x559e20){var _0x452eaf=util['format']('%s.cypher',_0x559e20['value']);if(fs[_0x0b5d('0x51')](_0x452eaf)){_0xb24a44=!![];return _0x514529[_0x0b5d('0x63')](_0x452eaf,_0x559e20[_0x0b5d('0x50')],config['secrets'][_0x0b5d('0x52')])[_0x0b5d('0x25')](function(){return _0x559e20;});}return _0x559e20;}})['then'](function(_0x30b2ca){if(_0x30b2ca){if(!fs[_0x0b5d('0x51')](_0x30b2ca['value'])){throw new db['Sequelize'][(_0x0b5d('0x54'))](_0x0b5d('0x55'));}if(_0x30b2ca['filename']){return _0x4fd940[_0x0b5d('0x56')](_0x30b2ca['value'],_0x30b2ca[_0x0b5d('0x57')]+path[_0x0b5d('0x58')](_0x30b2ca[_0x0b5d('0x50')]),function(){if(_0xb24a44){fs[_0x0b5d('0x59')](_0x30b2ca['value']);}});}else{return _0x4fd940[_0x0b5d('0x56')](_0x30b2ca[_0x0b5d('0x50')],function(_0x26dc68){if(_0xb24a44){fs[_0x0b5d('0x59')](_0x30b2ca[_0x0b5d('0x50')]);}});}}})[_0x0b5d('0x49')](handleError(_0x4fd940,null));};exports[_0x0b5d('0x26')]=function(_0x4c8243,_0x275a58){return db[_0x0b5d('0x41')][_0x0b5d('0x4c')]({'where':{'id':_0x4c8243[_0x0b5d('0x47')]['id']}})['then'](function(_0x559020){if(_[_0x0b5d('0x64')](_0x559020)){throw new ReferenceError('Entity\x20not\x20found');}return _0x559020;})[_0x0b5d('0x25')](function(_0x3d3dd4){var _0x3d87a8=_0x3d3dd4['value'];logger[_0x0b5d('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x3d87a8);if(!_['isNil'](_0x3d3dd4[_0x0b5d('0x50')])&&fs[_0x0b5d('0x51')](_0x3d87a8)){logger[_0x0b5d('0x65')]('File:\x20\x22'+_0x3d87a8+_0x0b5d('0x66'));fs[_0x0b5d('0x67')](_0x3d87a8);}_0x3d87a8=_0x3d87a8+'.cypher';if(!_[_0x0b5d('0x64')](_0x3d3dd4[_0x0b5d('0x50')])&&fs[_0x0b5d('0x51')](_0x3d87a8)){logger['info']('File:\x20\x22'+_0x3d87a8+_0x0b5d('0x66'));fs['unlinkSync'](_0x3d87a8);}return _0x3d3dd4;})[_0x0b5d('0x25')](function(_0x1cf9f9){if(!_0x1cf9f9)throw new InternalError();return _0x1cf9f9['destroy']();})[_0x0b5d('0x25')](function(){_0x275a58[_0x0b5d('0x1a')](0xcc)[_0x0b5d('0x1b')]();})['catch'](handleError(_0x275a58,null));};function getBucketslist(_0x1efb26,_0x40272b,_0x40d578){return new Promise(function(_0x3fb951,_0x2a40f7){var _0x3e3d4e=new AWS['S3']({'accessKeyId':_0x40272b,'secretAccessKey':_0x1efb26,'region':_0x40d578});_0x3e3d4e['listBuckets']({},function(_0x479060,_0x5ce8e8){if(_0x479060){return _0x2a40f7(_0x479060);}else{return _0x3fb951(_0x5ce8e8);}});});}function createBucket(_0x71194f,_0x279b5b,_0x350bb8,_0x4c4035){return new Promise(function(_0x78c3a8,_0x504d20){var _0x3ae6d4=new AWS['S3']({'accessKeyId':_0x279b5b,'secretAccessKey':_0x71194f,'region':_0x350bb8});_0x3ae6d4[_0x0b5d('0x68')]({'Bucket':_0x4c4035},function(_0x3cc518,_0x4d5996){if(_0x3cc518){return _0x504d20(_0x3cc518);}else{return _0x78c3a8(_0x4d5996);}});});}function uploadFile(_0x39b92f,_0x247459,_0x47a359,_0x4692b5,_0x555468,_0x44bb02){return new Promise(function(_0x4f6ce4,_0x3cbfca){var _0x460bc3=new AWS['S3']({'accessKeyId':_0x247459,'secretAccessKey':_0x39b92f,'region':_0x47a359});_0x460bc3[_0x0b5d('0x69')]({'Bucket':_0x4692b5,'Key':_0x555468,'Body':_0x44bb02},function(_0x454267,_0x2cf608){if(_0x454267){return _0x3cbfca(_0x454267);}else{return _0x4f6ce4(_0x2cf608);}});});}function startTranscribe(_0x179957,_0x25362f,_0x4ff1ce,_0x1f2b7a,_0x5c5400,_0x3b130e){return new Promise(function(_0x5eed07,_0x17dce6){var _0x46abc9=new AWS[(_0x0b5d('0x6a'))]({'accessKeyId':_0x25362f,'secretAccessKey':_0x179957,'region':_0x4ff1ce});_0x46abc9[_0x0b5d('0x6b')]({'TranscriptionJobName':_0x1f2b7a,'LanguageCode':_0x5c5400,'Media':{'MediaFileUri':_0x3b130e}},function(_0x4b1ef1,_0x548511){if(_0x4b1ef1){return _0x17dce6(_0x4b1ef1);}else{return _0x5eed07(_0x548511);}});});}function transcribe(_0x1a09d8,_0x43ecde,_0x2b5941,_0x15870e,_0x4f8d97,_0x17c4e4,_0x34aa7a){return new Promise(function(_0x1e3b4d,_0x32d586){var _0x55fb15={};logger[_0x0b5d('0x65')](util[_0x0b5d('0x31')](_0x0b5d('0x6c'),_0x1a09d8,_0x4f8d97));return uploadFile(_0x43ecde,_0x2b5941,_0x15870e,_0x4f8d97,path['basename'](_0x17c4e4),fs[_0x0b5d('0x6d')](_0x17c4e4))['then'](function(_0x4501d1){logger[_0x0b5d('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1a09d8,_0x4f8d97,_0x4501d1[_0x0b5d('0x6e')]));_0x55fb15[_0x0b5d('0x6f')]=_0x4501d1['Bucket'];_0x55fb15[_0x0b5d('0x70')]=_0x4501d1[_0x0b5d('0x6e')];logger[_0x0b5d('0x65')](util['format'](_0x0b5d('0x71'),_0x1a09d8));return startTranscribe(_0x43ecde,_0x2b5941,_0x15870e,uuidv4(),_0x34aa7a,_0x4501d1[_0x0b5d('0x6e')]);})[_0x0b5d('0x25')](function(_0x19a472){logger[_0x0b5d('0x65')](util[_0x0b5d('0x31')](_0x0b5d('0x72'),_0x1a09d8,_0x19a472[_0x0b5d('0x73')][_0x0b5d('0x74')]));_0x55fb15['transcribeName']=_0x19a472[_0x0b5d('0x73')][_0x0b5d('0x74')];_0x55fb15[_0x0b5d('0x75')]=_0x19a472[_0x0b5d('0x73')]['TranscriptionJobStatus'];return _0x1e3b4d(_0x55fb15);})[_0x0b5d('0x49')](function(_0x1148d1){return _0x32d586(_0x1148d1);});});}exports[_0x0b5d('0x76')]=function(_0x26d6db,_0x448424,_0x37427a){var _0x4fac25;var _0x5484ac;var _0x51bbd9;var _0x5427f2=require(_0x0b5d('0x4e'));return db[_0x0b5d('0x41')][_0x0b5d('0x77')]({'where':{'id':_0x26d6db[_0x0b5d('0x47')]['id']}})[_0x0b5d('0x25')](function(_0x2e6a36){if(_0x2e6a36){var _0x371728=util[_0x0b5d('0x31')](_0x0b5d('0x78'),_0x2e6a36[_0x0b5d('0x50')]);if(fs['existsSync'](_0x371728)){cypher=!![];return _0x5427f2[_0x0b5d('0x63')](_0x371728,_0x2e6a36[_0x0b5d('0x50')],config[_0x0b5d('0x79')][_0x0b5d('0x52')])['then'](function(){return _0x2e6a36;});}return _0x2e6a36;}})[_0x0b5d('0x25')](function(_0x21f5ea){if(!_0x21f5ea){throw new db[(_0x0b5d('0x53'))]['ValidationError'](_0x0b5d('0x7a'));}_0x5484ac=_0x21f5ea;return db[_0x0b5d('0x7b')][_0x0b5d('0x77')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x448424,null))[_0x0b5d('0x25')](function(_0x4744ac){if(_0x4744ac){_0x4fac25=_0x4744ac;if(!_0x4fac25[_0x0b5d('0x7c')]||!_0x4fac25[_0x0b5d('0x7d')]||!_0x4fac25[_0x0b5d('0x7e')]||!_0x4fac25[_0x0b5d('0x7f')]||!_0x4fac25[_0x0b5d('0x6f')]){throw new db[(_0x0b5d('0x53'))][(_0x0b5d('0x54'))](_0x0b5d('0x80'));}if(_0x26d6db[_0x0b5d('0x4b')][_0x0b5d('0x81')]&&(!_0x4fac25[_0x0b5d('0x82')]||!_0x4fac25['sentimentAccountId']||!_0x4fac25[_0x0b5d('0x83')]||!_0x4fac25[_0x0b5d('0x7f')]||!_0x4fac25[_0x0b5d('0x6f')])){throw new db['Sequelize'][(_0x0b5d('0x54'))](_0x0b5d('0x84'));}return db[_0x0b5d('0x85')][_0x0b5d('0x77')]({'where':{'id':_0x4fac25[_0x0b5d('0x7d')]}});}})['then'](function(_0x5172b2){if(!_0x5172b2){throw new db[(_0x0b5d('0x53'))][(_0x0b5d('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5172b2[_0x0b5d('0x86')]||!_0x5172b2[_0x0b5d('0x87')]){throw new db[(_0x0b5d('0x53'))][(_0x0b5d('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x51bbd9=_0x5172b2;return getBucketslist(_0x51bbd9['data1'],_0x51bbd9[_0x0b5d('0x87')],_0x4fac25[_0x0b5d('0x7e')]);})[_0x0b5d('0x25')](function(_0x2f6503){if(_0x2f6503&&_0x2f6503[_0x0b5d('0x88')]){var _0x5f0314=_[_0x0b5d('0x4c')](_0x2f6503[_0x0b5d('0x88')],function(_0x1a90b4){return _0x1a90b4[_0x0b5d('0x89')]===_0x4fac25[_0x0b5d('0x6f')];});if(!_0x5f0314){logger[_0x0b5d('0x65')](util[_0x0b5d('0x31')](_0x0b5d('0x8a'),_0x26d6db[_0x0b5d('0x47')]['id'],_0x4fac25[_0x0b5d('0x6f')]));return createBucket(_0x51bbd9[_0x0b5d('0x86')],_0x51bbd9[_0x0b5d('0x87')],_0x4fac25[_0x0b5d('0x7e')],_0x4fac25['bucket']);}logger[_0x0b5d('0x65')](util[_0x0b5d('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x26d6db[_0x0b5d('0x47')]['id'],_0x4fac25[_0x0b5d('0x6f')]));return;}})[_0x0b5d('0x25')](function(_0x101b46){if(_0x5484ac['transcribeStatus']===_0x0b5d('0x8b')){return transcribe(_0x26d6db[_0x0b5d('0x47')]['id'],_0x51bbd9[_0x0b5d('0x86')],_0x51bbd9[_0x0b5d('0x87')],_0x4fac25[_0x0b5d('0x7e')],_0x4fac25[_0x0b5d('0x6f')],_0x5484ac[_0x0b5d('0x50')],_0x4fac25[_0x0b5d('0x7f')]);}else{logger[_0x0b5d('0x65')](util[_0x0b5d('0x31')](_0x0b5d('0x8c'),_0x26d6db['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x0b5d('0x25')](function(_0x5eb278){if(_0x5eb278){_0x5eb278['tempSentiment']=_0x26d6db[_0x0b5d('0x4b')]['runSentiment'];return _0x5484ac[_0x0b5d('0x8d')](_0x5eb278);}})[_0x0b5d('0x25')](respondWithResult(_0x448424,null))[_0x0b5d('0x49')](handleError(_0x448424,null));};function writeFile(_0x1acfe7,_0x41ce26){return new Promise(function(_0x500dc0,_0x3468c2){fs['writeFile'](_0x41ce26,_0x1acfe7,function(_0x3c1163,_0x244478){if(_0x3c1163){return _0x3468c2(_0x3c1163);}else{return _0x500dc0(_0x244478);}});});}exports[_0x0b5d('0x8e')]=function(_0x46ac94,_0x314482,_0x337223){return db[_0x0b5d('0x41')][_0x0b5d('0x77')]({'where':{'id':_0x46ac94[_0x0b5d('0x47')]['id']}})[_0x0b5d('0x25')](handleEntityNotFound(_0x314482))['then'](function(_0x257d78){if(_0x257d78&&_0x257d78[_0x0b5d('0x8f')]){var _0x18a27c=_0x257d78['fileText'];var _0x5182cf=config[_0x0b5d('0x90')]+'/server/files/transcribes/transcribe_'+_0x257d78['id']+_0x0b5d('0x91');if(fs[_0x0b5d('0x51')](_0x5182cf)){return _0x5182cf;}return writeFile(_0x18a27c,_0x5182cf)[_0x0b5d('0x25')](function(){return _0x5182cf;});}else{throw new db[(_0x0b5d('0x53'))][(_0x0b5d('0x54'))]('Transcript\x20not\x20available');}})[_0x0b5d('0x25')](function(_0x26a4e6){return _0x314482['download'](_0x26a4e6);})[_0x0b5d('0x49')](handleError(_0x314482));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f7535ad..dbbee10 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 _0xe4c0=['request-promise','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0xe4c0,0x10c));var _0x0e4c=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xe4c0[_0x280ae7];return _0x418b9e;};'use strict';var _=require(_0x0e4c('0x0'));var util=require(_0x0e4c('0x1'));var logger=require(_0x0e4c('0x2'))(_0x0e4c('0x3'));var moment=require(_0x0e4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e4c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e4c('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e4c('0x7'));module[_0x0e4c('0x8')]=function(_0xb4c166,_0x94230a){return _0xb4c166[_0x0e4c('0x9')](_0x0e4c('0xa'),attributes,{'tableName':_0x0e4c('0xb'),'paranoid':![],'indexes':[{'name':_0x0e4c('0xc'),'fields':[_0x0e4c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4760=['lodash','util','api','moment','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0xed4e3c,_0x39e976){var _0x4297cc=function(_0x5a0cb8){while(--_0x5a0cb8){_0xed4e3c['push'](_0xed4e3c['shift']());}};_0x4297cc(++_0x39e976);}(_0x4760,0x120));var _0x0476=function(_0x33ac62,_0x2b15fc){_0x33ac62=_0x33ac62-0x0;var _0x6adf8=_0x4760[_0x33ac62];return _0x6adf8;};'use strict';var _=require(_0x0476('0x0'));var util=require(_0x0476('0x1'));var logger=require('../../config/logger')(_0x0476('0x2'));var moment=require(_0x0476('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0476('0x4'));var rimraf=require(_0x0476('0x5'));var config=require(_0x0476('0x6'));var attributes=require(_0x0476('0x7'));module[_0x0476('0x8')]=function(_0x328021,_0x476fed){return _0x328021[_0x0476('0x9')](_0x0476('0xa'),attributes,{'tableName':_0x0476('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6219d7a..13435c4 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 _0xdf55=['create','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','info','result','catch','UpdateVoiceRecording','update','options','raw','attributes','limit','debug','stringify','CreateVoiceRecording','findOne','callRecordingEncryption'];(function(_0x17b834,_0x5ba689){var _0x547c2d=function(_0x37ab9a){while(--_0x37ab9a){_0x17b834['push'](_0x17b834['shift']());}};_0x547c2d(++_0x5ba689);}(_0xdf55,0x83));var _0x5df5=function(_0x5aedbc,_0x41eab8){_0x5aedbc=_0x5aedbc-0x0;var _0xc9a701=_0xdf55[_0x5aedbc];return _0xc9a701;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['VoiceRecording'][_0x5df5('0x17')](_0xb7e1c2['body'],{'raw':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')]['where']||null:null,'attributes':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null})['then'](function(_0x2e99a1){logger[_0x5df5('0x13')](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x1c')]('UpdateVoiceRecording',_0xb7e1c2,JSON[_0x5df5('0x1d')](_0x2e99a1));_0x215d59(_0x2e99a1);})[_0x5df5('0x15')](function(_0x395f3e){logger['error']('UpdateVoiceRecording',_0x395f3e['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0x395f3e[_0x5df5('0x12')]));});});};exports[_0x5df5('0x1e')]=function(_0xa7f4b3){var _0x1baf52=this;return new Promise(function(_0x1fd83c,_0x210d20){var _0x28723e=require('../../components/encryptor');var _0x18bb61;return db['Setting'][_0x5df5('0x1f')]({'attributes':['id',_0x5df5('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3854d0){_0x18bb61=_0x3854d0;return db['VoiceRecording'][_0x5df5('0x21')](_0xa7f4b3['body']);})[_0x5df5('0xc')](function(_0x4afe36){if(_0x18bb61[_0x5df5('0x20')]&&fs['existsSync'](_0x4afe36[_0x5df5('0x22')])){var _0x47bebb=util[_0x5df5('0x23')]('%s.cypher',_0x4afe36[_0x5df5('0x22')]);return _0x28723e[_0x5df5('0x24')](_0x4afe36[_0x5df5('0x22')],_0x47bebb,config[_0x5df5('0x25')][_0x5df5('0x26')])[_0x5df5('0xc')](function(){fs[_0x5df5('0x27')](_0x4afe36['value']);logger['info'](_0x5df5('0x28'));return _0x4afe36;});}return _0x4afe36;})[_0x5df5('0xc')](function(_0x3bbd2b){logger[_0x5df5('0x13')](_0x5df5('0x1e'),_0xa7f4b3);logger[_0x5df5('0x1c')]('CreateVoiceRecording',_0xa7f4b3,JSON[_0x5df5('0x1d')](_0x3bbd2b));_0x1fd83c(_0x3bbd2b);})[_0x5df5('0x15')](function(_0x2f1001){logger[_0x5df5('0xf')]('CreateVoiceRecording',_0x2f1001[_0x5df5('0x12')],_0xa7f4b3);_0x210d20(_0x1baf52['error'](0x1f4,_0x2f1001[_0x5df5('0x12')]));});});}; \ No newline at end of file +var _0xba34=['body','options','attributes','limit','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update'];(function(_0x49f995,_0x165553){var _0x36c5da=function(_0x2d6f66){while(--_0x2d6f66){_0x49f995['push'](_0x49f995['shift']());}};_0x36c5da(++_0x165553);}(_0xba34,0x119));var _0x4ba3=function(_0x439fbd,_0x1cfbad){_0x439fbd=_0x439fbd-0x0;var _0x12b323=_0xba34[_0x439fbd];return _0x12b323;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')](_0x5ff7ce[_0x4ba3('0x1b')],{'raw':_0x5ff7ce[_0x4ba3('0x1c')]?_0x5ff7ce[_0x4ba3('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1c')]['where']||null:null,'attributes':_0x5ff7ce[_0x4ba3('0x1c')]?_0x5ff7ce[_0x4ba3('0x1c')][_0x4ba3('0x1d')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1c')]?_0x5ff7ce[_0x4ba3('0x1c')][_0x4ba3('0x1e')]||null:null})['then'](function(_0x143c78){logger[_0x4ba3('0xd')]('UpdateVoiceRecording',_0x5ff7ce);logger[_0x4ba3('0x10')]('UpdateVoiceRecording',_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x143c78));_0x556290(_0x143c78);})[_0x4ba3('0x17')](function(_0x11a917){logger[_0x4ba3('0x13')](_0x4ba3('0x18'),_0x11a917[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x11a917[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x1f')]=function(_0x2e67a0){var _0x50c729=this;return new Promise(function(_0x252f37,_0x13c353){var _0x2311ed=require('../../components/encryptor');var _0x10537e;return db[_0x4ba3('0x20')][_0x4ba3('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4ba3('0xc')](function(_0x843276){_0x10537e=_0x843276;return db[_0x4ba3('0x19')][_0x4ba3('0x22')](_0x2e67a0['body']);})['then'](function(_0x38ef88){if(_0x10537e[_0x4ba3('0x23')]&&fs[_0x4ba3('0x24')](_0x38ef88[_0x4ba3('0x25')])){var _0x2cb5d5=util[_0x4ba3('0x26')]('%s.cypher',_0x38ef88[_0x4ba3('0x25')]);return _0x2311ed[_0x4ba3('0x27')](_0x38ef88[_0x4ba3('0x25')],_0x2cb5d5,config[_0x4ba3('0x28')][_0x4ba3('0x29')])[_0x4ba3('0xc')](function(){fs[_0x4ba3('0x2a')](_0x38ef88[_0x4ba3('0x25')]);logger[_0x4ba3('0xd')](_0x4ba3('0x2b'));return _0x38ef88;});}return _0x38ef88;})['then'](function(_0x5a453f){logger['info'](_0x4ba3('0x1f'),_0x2e67a0);logger[_0x4ba3('0x10')](_0x4ba3('0x1f'),_0x2e67a0,JSON[_0x4ba3('0x12')](_0x5a453f));_0x252f37(_0x5a453f);})[_0x4ba3('0x17')](function(_0x137f9b){logger[_0x4ba3('0x13')](_0x4ba3('0x1f'),_0x137f9b[_0x4ba3('0x15')],_0x2e67a0);_0x13c353(_0x50c729[_0x4ba3('0x13')](0x1f4,_0x137f9b[_0x4ba3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index aed0b16..a3c6743 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 _0x7bba=['exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update'];(function(_0x3543e7,_0x501fcf){var _0x42df23=function(_0x467049){while(--_0x467049){_0x3543e7['push'](_0x3543e7['shift']());}};_0x42df23(++_0x501fcf);}(_0x7bba,0x101));var _0xa7bb=function(_0x4a16aa,_0x46f661){_0x4a16aa=_0x4a16aa-0x0;var _0x4e9af4=_0x7bba[_0x4a16aa];return _0x4e9af4;};'use strict';var multer=require('multer');var util=require(_0xa7bb('0x0'));var path=require('path');var timeout=require(_0xa7bb('0x1'));var express=require(_0xa7bb('0x2'));var router=express['Router']();var fs_extra=require(_0xa7bb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa7bb('0x4'));var config=require(_0xa7bb('0x5'));var controller=require('./voiceTransferReport.controller');router[_0xa7bb('0x6')]('/',auth[_0xa7bb('0x7')](),controller[_0xa7bb('0x8')]);router[_0xa7bb('0x6')](_0xa7bb('0x9'),auth[_0xa7bb('0x7')](),controller[_0xa7bb('0xa')]);router[_0xa7bb('0x6')](_0xa7bb('0xb'),auth[_0xa7bb('0x7')](),controller[_0xa7bb('0xc')]);router['post']('/',auth[_0xa7bb('0x7')](),controller['create']);router[_0xa7bb('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xa7bb('0xe')]);router['delete'](_0xa7bb('0xb'),auth[_0xa7bb('0x7')](),controller['destroy']);module[_0xa7bb('0xf')]=router; \ No newline at end of file +var _0xcbe4=['destroy','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0x1298d4,_0x2d7428){var _0x15234e=function(_0x48f2e3){while(--_0x48f2e3){_0x1298d4['push'](_0x1298d4['shift']());}};_0x15234e(++_0x2d7428);}(_0xcbe4,0xa4));var _0x4cbe=function(_0x3a22e3,_0x5d8171){_0x3a22e3=_0x3a22e3-0x0;var _0x2e3523=_0xcbe4[_0x3a22e3];return _0x2e3523;};'use strict';var multer=require(_0x4cbe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4cbe('0x1'));var express=require('express');var router=express[_0x4cbe('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4cbe('0x3'));var interaction=require(_0x4cbe('0x4'));var config=require(_0x4cbe('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x4cbe('0x6')]('/',auth[_0x4cbe('0x7')](),controller['index']);router[_0x4cbe('0x6')](_0x4cbe('0x8'),auth[_0x4cbe('0x7')](),controller[_0x4cbe('0x9')]);router[_0x4cbe('0x6')](_0x4cbe('0xa'),auth[_0x4cbe('0x7')](),controller[_0x4cbe('0xb')]);router[_0x4cbe('0xc')]('/',auth[_0x4cbe('0x7')](),controller[_0x4cbe('0xd')]);router[_0x4cbe('0xe')](_0x4cbe('0xa'),auth[_0x4cbe('0x7')](),controller[_0x4cbe('0xf')]);router['delete'](_0x4cbe('0xa'),auth[_0x4cbe('0x7')](),controller[_0x4cbe('0x10')]);module[_0x4cbe('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5599276..e2cc752 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 _0x7198=['attended','STRING','Yes','sequelize','moment','ENUM','blind'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x7198,0xe3));var _0x8719=function(_0x29ba01,_0x112748){_0x29ba01=_0x29ba01-0x0;var _0x226d21=_0x7198[_0x29ba01];return _0x226d21;};'use strict';var Sequelize=require(_0x8719('0x0'));var moment=require(_0x8719('0x1'));module['exports']={'type':{'type':Sequelize[_0x8719('0x2')](_0x8719('0x3'),_0x8719('0x4'))},'result':{'type':Sequelize[_0x8719('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x8719('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x8719('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x8719('0x5')]},'transferercontext':{'type':Sequelize[_0x8719('0x5')]},'transfererexten':{'type':Sequelize[_0x8719('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8719('0x5')]},'transfereechannel':{'type':Sequelize[_0x8719('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8719('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8719('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8719('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8719('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x8719('0x5')]},'transfereecontext':{'type':Sequelize[_0x8719('0x5')]},'transfereeexten':{'type':Sequelize[_0x8719('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8719('0x5')]},'isexternal':{'type':Sequelize[_0x8719('0x2')](_0x8719('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8719('0x5')]}}; \ No newline at end of file +var _0x96e6=['ENUM','STRING','sequelize','moment'];(function(_0x501551,_0x29daa0){var _0x31b67e=function(_0xb9ed74){while(--_0xb9ed74){_0x501551['push'](_0x501551['shift']());}};_0x31b67e(++_0x29daa0);}(_0x96e6,0x6a));var _0x696e=function(_0x4d1b78,_0x29e2cb){_0x4d1b78=_0x4d1b78-0x0;var _0x271274=_0x96e6[_0x4d1b78];return _0x271274;};'use strict';var Sequelize=require(_0x696e('0x0'));var moment=require(_0x696e('0x1'));module['exports']={'type':{'type':Sequelize[_0x696e('0x2')]('blind','attended')},'result':{'type':Sequelize[_0x696e('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x696e('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x696e('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x696e('0x3')]},'transferercontext':{'type':Sequelize[_0x696e('0x3')]},'transfererexten':{'type':Sequelize[_0x696e('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x696e('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x696e('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x696e('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x696e('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x696e('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x696e('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x696e('0x3')]},'extension':{'type':Sequelize[_0x696e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 00b51c2..3cac39f 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 _0xc3b8=['then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update'];(function(_0x1714b7,_0x209818){var _0x5bbddb=function(_0x49aac0){while(--_0x49aac0){_0x1714b7['push'](_0x1714b7['shift']());}};_0x5bbddb(++_0x209818);}(_0xc3b8,0x72));var _0x8c3b=function(_0x2e757c,_0x1a5278){_0x2e757c=_0x2e757c-0x0;var _0xd912fd=_0xc3b8[_0x2e757c];return _0xd912fd;};'use strict';var emlformat=require(_0x8c3b('0x0'));var rimraf=require(_0x8c3b('0x1'));var zipdir=require(_0x8c3b('0x2'));var jsonpatch=require(_0x8c3b('0x3'));var rp=require(_0x8c3b('0x4'));var moment=require('moment');var BPromise=require(_0x8c3b('0x5'));var Mustache=require(_0x8c3b('0x6'));var util=require(_0x8c3b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8c3b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c3b('0x9'));var squel=require(_0x8c3b('0xa'));var crypto=require(_0x8c3b('0xb'));var jsforce=require(_0x8c3b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8c3b('0xd'));var Papa=require(_0x8c3b('0xe'));var Redis=require(_0x8c3b('0xf'));var authService=require(_0x8c3b('0x10'));var qs=require(_0x8c3b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c3b('0x12'))(_0x8c3b('0x13'));var utils=require(_0x8c3b('0x14'));var config=require(_0x8c3b('0x15'));var licenseUtil=require(_0x8c3b('0x16'));var db=require(_0x8c3b('0x17'))['db'];function respondWithStatusCode(_0x22014b,_0x227efd){_0x227efd=_0x227efd||0xcc;return function(_0x1c7c1a){if(_0x1c7c1a){return _0x22014b['sendStatus'](_0x227efd);}return _0x22014b[_0x8c3b('0x18')](_0x227efd)[_0x8c3b('0x19')]();};}function respondWithResult(_0x90a404,_0x3ae7de){_0x3ae7de=_0x3ae7de||0xc8;return function(_0x2d20cb){if(_0x2d20cb){return _0x90a404[_0x8c3b('0x18')](_0x3ae7de)[_0x8c3b('0x1a')](_0x2d20cb);}};}function respondWithFilteredResult(_0x26a89c,_0x5dd9b2){return function(_0x105cfb){if(_0x105cfb){var _0x4158b9=typeof _0x5dd9b2['offset']===_0x8c3b('0x1b')&&typeof _0x5dd9b2['limit']===_0x8c3b('0x1b');var _0x5304be=_0x105cfb[_0x8c3b('0x1c')];var _0x47824c=_0x4158b9?0x0:_0x5dd9b2[_0x8c3b('0x1d')];var _0x57785f=_0x4158b9?_0x105cfb['count']:_0x5dd9b2[_0x8c3b('0x1d')]+_0x5dd9b2[_0x8c3b('0x1e')];var _0x59604c;if(_0x57785f>=_0x5304be){_0x57785f=_0x5304be;_0x59604c=0xc8;}else{_0x59604c=0xce;}_0x26a89c[_0x8c3b('0x18')](_0x59604c);return _0x26a89c[_0x8c3b('0x1f')]('Content-Range',_0x47824c+'-'+_0x57785f+'/'+_0x5304be)[_0x8c3b('0x1a')](_0x105cfb);}return null;};}function patchUpdates(_0x3e1c4f){return function(_0x2a0cc7){try{jsonpatch[_0x8c3b('0x20')](_0x2a0cc7,_0x3e1c4f,!![]);}catch(_0x36a737){return BPromise[_0x8c3b('0x21')](_0x36a737);}return _0x2a0cc7[_0x8c3b('0x22')]();};}function saveUpdates(_0x167024,_0x4045a4){return function(_0x4b7821){if(_0x4b7821){return _0x4b7821[_0x8c3b('0x23')](_0x167024)[_0x8c3b('0x24')](function(_0x4cf49a){return _0x4cf49a;});}return null;};}function removeEntity(_0x3a4232,_0x5f167b){return function(_0x4eb1ae){if(_0x4eb1ae){return _0x4eb1ae[_0x8c3b('0x25')]()[_0x8c3b('0x24')](function(){_0x3a4232[_0x8c3b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc976,_0x12720c){return function(_0x545763){if(!_0x545763){_0x2fc976[_0x8c3b('0x26')](0x194);}return _0x545763;};}function handleError(_0x2db45c,_0x2f7710){_0x2f7710=_0x2f7710||0x1f4;return function(_0x153a58){logger[_0x8c3b('0x27')](_0x153a58[_0x8c3b('0x28')]);if(_0x153a58['name']){delete _0x153a58[_0x8c3b('0x29')];}_0x2db45c[_0x8c3b('0x18')](_0x2f7710)[_0x8c3b('0x2a')](_0x153a58);};}exports[_0x8c3b('0x2b')]=function(_0x38ec73,_0x381989){var _0xaee722={},_0x225c0a={},_0x4b4307={'count':0x0,'rows':[]};var _0x591c79=_[_0x8c3b('0x2c')](db[_0x8c3b('0x2d')][_0x8c3b('0x2e')],function(_0x23209f){return{'name':_0x23209f['fieldName'],'type':_0x23209f[_0x8c3b('0x2f')][_0x8c3b('0x30')]};});_0x225c0a['model']=_['map'](_0x591c79,_0x8c3b('0x29'));_0x225c0a[_0x8c3b('0x31')]=_[_0x8c3b('0x32')](_0x38ec73[_0x8c3b('0x31')]);_0x225c0a[_0x8c3b('0x33')]=_[_0x8c3b('0x34')](_0x225c0a[_0x8c3b('0x35')],_0x225c0a[_0x8c3b('0x31')]);_0xaee722['attributes']=_[_0x8c3b('0x34')](_0x225c0a['model'],qs[_0x8c3b('0x36')](_0x38ec73[_0x8c3b('0x31')]['fields']));_0xaee722[_0x8c3b('0x37')]=_0xaee722[_0x8c3b('0x37')]['length']?_0xaee722['attributes']:_0x225c0a[_0x8c3b('0x35')];if(!_0x38ec73[_0x8c3b('0x31')]['hasOwnProperty'](_0x8c3b('0x38'))){_0xaee722[_0x8c3b('0x1e')]=qs[_0x8c3b('0x1e')](_0x38ec73[_0x8c3b('0x31')][_0x8c3b('0x1e')]);_0xaee722['offset']=qs[_0x8c3b('0x1d')](_0x38ec73[_0x8c3b('0x31')]['offset']);}_0xaee722['order']=qs[_0x8c3b('0x39')](_0x38ec73['query'][_0x8c3b('0x39')]);_0xaee722[_0x8c3b('0x3a')]=qs[_0x8c3b('0x33')](_[_0x8c3b('0x3b')](_0x38ec73[_0x8c3b('0x31')],_0x225c0a['filters']),_0x591c79);if(_0x38ec73['query'][_0x8c3b('0x3c')]){_0xaee722[_0x8c3b('0x3a')]=_['merge'](_0xaee722[_0x8c3b('0x3a')],{'$or':_['map'](_0x591c79,function(_0x1560e0){if(_0x1560e0['type']!==_0x8c3b('0x3d')){var _0x446495={};_0x446495[_0x1560e0[_0x8c3b('0x29')]]={'$like':'%'+_0x38ec73[_0x8c3b('0x31')][_0x8c3b('0x3c')]+'%'};return _0x446495;}})});}_0xaee722=_['merge']({},_0xaee722,_0x38ec73[_0x8c3b('0x3e')]);var _0x4d1e7c={'where':_0xaee722['where']};return db[_0x8c3b('0x2d')][_0x8c3b('0x1c')](_0x4d1e7c)['then'](function(_0x532fbc){_0x4b4307[_0x8c3b('0x1c')]=_0x532fbc;if(_0x38ec73[_0x8c3b('0x31')][_0x8c3b('0x3f')]){_0xaee722[_0x8c3b('0x40')]=[{'all':!![]}];}return db[_0x8c3b('0x2d')][_0x8c3b('0x41')](_0xaee722);})[_0x8c3b('0x24')](function(_0x2d13ea){_0x4b4307[_0x8c3b('0x42')]=_0x2d13ea;return _0x4b4307;})[_0x8c3b('0x24')](respondWithFilteredResult(_0x381989,_0xaee722))[_0x8c3b('0x43')](handleError(_0x381989,null));};exports[_0x8c3b('0x44')]=function(_0x59100a,_0x5404fb){var _0x26cdf8={'raw':!![],'where':{'id':_0x59100a['params']['id']}},_0x341dfd={};_0x341dfd[_0x8c3b('0x35')]=_['keys'](db[_0x8c3b('0x2d')][_0x8c3b('0x2e')]);_0x341dfd['query']=_[_0x8c3b('0x32')](_0x59100a[_0x8c3b('0x31')]);_0x341dfd[_0x8c3b('0x33')]=_[_0x8c3b('0x34')](_0x341dfd[_0x8c3b('0x35')],_0x341dfd['query']);_0x26cdf8[_0x8c3b('0x37')]=_[_0x8c3b('0x34')](_0x341dfd[_0x8c3b('0x35')],qs[_0x8c3b('0x36')](_0x59100a[_0x8c3b('0x31')][_0x8c3b('0x36')]));_0x26cdf8[_0x8c3b('0x37')]=_0x26cdf8[_0x8c3b('0x37')]['length']?_0x26cdf8[_0x8c3b('0x37')]:_0x341dfd[_0x8c3b('0x35')];if(_0x59100a[_0x8c3b('0x31')][_0x8c3b('0x3f')]){_0x26cdf8[_0x8c3b('0x40')]=[{'all':!![]}];}_0x26cdf8=_[_0x8c3b('0x45')]({},_0x26cdf8,_0x59100a['options']);return db[_0x8c3b('0x2d')][_0x8c3b('0x46')](_0x26cdf8)[_0x8c3b('0x24')](handleEntityNotFound(_0x5404fb,null))[_0x8c3b('0x24')](respondWithResult(_0x5404fb,null))[_0x8c3b('0x43')](handleError(_0x5404fb,null));};exports['create']=function(_0x386d1b,_0x3cd0e9){return db[_0x8c3b('0x2d')][_0x8c3b('0x47')](_0x386d1b[_0x8c3b('0x48')],{})[_0x8c3b('0x24')](respondWithResult(_0x3cd0e9,0xc9))[_0x8c3b('0x43')](handleError(_0x3cd0e9,null));};exports[_0x8c3b('0x23')]=function(_0x3f38fa,_0x26ea75){if(_0x3f38fa[_0x8c3b('0x48')]['id']){delete _0x3f38fa[_0x8c3b('0x48')]['id'];}return db['VoiceTransferReport'][_0x8c3b('0x46')]({'where':{'id':_0x3f38fa[_0x8c3b('0x49')]['id']}})[_0x8c3b('0x24')](handleEntityNotFound(_0x26ea75,null))[_0x8c3b('0x24')](saveUpdates(_0x3f38fa['body'],null))[_0x8c3b('0x24')](respondWithResult(_0x26ea75,null))['catch'](handleError(_0x26ea75,null));};exports[_0x8c3b('0x25')]=function(_0x5c0fd0,_0x3112b2){return db[_0x8c3b('0x2d')][_0x8c3b('0x46')]({'where':{'id':_0x5c0fd0[_0x8c3b('0x49')]['id']}})['then'](handleEntityNotFound(_0x3112b2,null))[_0x8c3b('0x24')](removeEntity(_0x3112b2,null))['catch'](handleError(_0x3112b2,null));};exports['describe']=function(_0xba3a91,_0x36c130){return db['VoiceTransferReport'][_0x8c3b('0x4a')]()['then'](respondWithResult(_0x36c130,null))['catch'](handleError(_0x36c130,null));}; \ No newline at end of file +var _0x21cc=['../../config/utils','../../config/environment','sendStatus','end','status','offset','count','limit','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x21cc,0x1f0));var _0xc21c=function(_0x5f48ca,_0x3e9316){_0x5f48ca=_0x5f48ca-0x0;var _0x19fe64=_0x21cc[_0x5f48ca];return _0x19fe64;};'use strict';var emlformat=require(_0xc21c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc21c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc21c('0x2'));var moment=require('moment');var BPromise=require(_0xc21c('0x3'));var Mustache=require(_0xc21c('0x4'));var util=require(_0xc21c('0x5'));var path=require(_0xc21c('0x6'));var sox=require(_0xc21c('0x7'));var csv=require('to-csv');var ejs=require(_0xc21c('0x8'));var fs=require('fs');var fs_extra=require(_0xc21c('0x9'));var _=require(_0xc21c('0xa'));var squel=require(_0xc21c('0xb'));var crypto=require(_0xc21c('0xc'));var jsforce=require(_0xc21c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc21c('0xe'));var querystring=require(_0xc21c('0xf'));var Papa=require(_0xc21c('0x10'));var Redis=require(_0xc21c('0x11'));var authService=require(_0xc21c('0x12'));var qs=require(_0xc21c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc21c('0x14'));var logger=require('../../config/logger')(_0xc21c('0x15'));var utils=require(_0xc21c('0x16'));var config=require(_0xc21c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d52a3,_0x4fc7cc){_0x4fc7cc=_0x4fc7cc||0xcc;return function(_0x66dd30){if(_0x66dd30){return _0x1d52a3[_0xc21c('0x18')](_0x4fc7cc);}return _0x1d52a3['status'](_0x4fc7cc)[_0xc21c('0x19')]();};}function respondWithResult(_0x3f7073,_0x8bad5c){_0x8bad5c=_0x8bad5c||0xc8;return function(_0x338ea5){if(_0x338ea5){return _0x3f7073[_0xc21c('0x1a')](_0x8bad5c)['json'](_0x338ea5);}};}function respondWithFilteredResult(_0x531d13,_0x3d9534){return function(_0x2e507a){if(_0x2e507a){var _0x23d604=typeof _0x3d9534[_0xc21c('0x1b')]==='undefined'&&typeof _0x3d9534['limit']==='undefined';var _0x3f6d90=_0x2e507a[_0xc21c('0x1c')];var _0x2071aa=_0x23d604?0x0:_0x3d9534[_0xc21c('0x1b')];var _0x350578=_0x23d604?_0x2e507a[_0xc21c('0x1c')]:_0x3d9534[_0xc21c('0x1b')]+_0x3d9534[_0xc21c('0x1d')];var _0x1baa57;if(_0x350578>=_0x3f6d90){_0x350578=_0x3f6d90;_0x1baa57=0xc8;}else{_0x1baa57=0xce;}_0x531d13['status'](_0x1baa57);return _0x531d13[_0xc21c('0x1e')](_0xc21c('0x1f'),_0x2071aa+'-'+_0x350578+'/'+_0x3f6d90)[_0xc21c('0x20')](_0x2e507a);}return null;};}function patchUpdates(_0x4d9653){return function(_0x4345b3){try{jsonpatch['apply'](_0x4345b3,_0x4d9653,!![]);}catch(_0x41eda1){return BPromise['reject'](_0x41eda1);}return _0x4345b3[_0xc21c('0x21')]();};}function saveUpdates(_0x33e208,_0x164bad){return function(_0x22941f){if(_0x22941f){return _0x22941f[_0xc21c('0x22')](_0x33e208)[_0xc21c('0x23')](function(_0x342020){return _0x342020;});}return null;};}function removeEntity(_0x20e63c,_0x137606){return function(_0xb19699){if(_0xb19699){return _0xb19699[_0xc21c('0x24')]()[_0xc21c('0x23')](function(){_0x20e63c[_0xc21c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd11c26,_0x45ba2b){return function(_0x2ff6fc){if(!_0x2ff6fc){_0xd11c26[_0xc21c('0x18')](0x194);}return _0x2ff6fc;};}function handleError(_0x19a95b,_0x2ebdd9){_0x2ebdd9=_0x2ebdd9||0x1f4;return function(_0x3ac61e){logger[_0xc21c('0x25')](_0x3ac61e[_0xc21c('0x26')]);if(_0x3ac61e[_0xc21c('0x27')]){delete _0x3ac61e[_0xc21c('0x27')];}_0x19a95b['status'](_0x2ebdd9)[_0xc21c('0x28')](_0x3ac61e);};}exports[_0xc21c('0x29')]=function(_0x369257,_0x454fd0){var _0x1381b4={},_0x4a5857={},_0xc68192={'count':0x0,'rows':[]};var _0x5b3beb=_[_0xc21c('0x2a')](db[_0xc21c('0x2b')][_0xc21c('0x2c')],function(_0x4813ab){return{'name':_0x4813ab[_0xc21c('0x2d')],'type':_0x4813ab['type'][_0xc21c('0x2e')]};});_0x4a5857[_0xc21c('0x2f')]=_[_0xc21c('0x2a')](_0x5b3beb,'name');_0x4a5857[_0xc21c('0x30')]=_['keys'](_0x369257[_0xc21c('0x30')]);_0x4a5857[_0xc21c('0x31')]=_[_0xc21c('0x32')](_0x4a5857[_0xc21c('0x2f')],_0x4a5857['query']);_0x1381b4[_0xc21c('0x33')]=_[_0xc21c('0x32')](_0x4a5857[_0xc21c('0x2f')],qs[_0xc21c('0x34')](_0x369257[_0xc21c('0x30')][_0xc21c('0x34')]));_0x1381b4[_0xc21c('0x33')]=_0x1381b4[_0xc21c('0x33')][_0xc21c('0x35')]?_0x1381b4['attributes']:_0x4a5857['model'];if(!_0x369257[_0xc21c('0x30')]['hasOwnProperty'](_0xc21c('0x36'))){_0x1381b4[_0xc21c('0x1d')]=qs[_0xc21c('0x1d')](_0x369257['query'][_0xc21c('0x1d')]);_0x1381b4[_0xc21c('0x1b')]=qs['offset'](_0x369257[_0xc21c('0x30')]['offset']);}_0x1381b4[_0xc21c('0x37')]=qs['sort'](_0x369257[_0xc21c('0x30')][_0xc21c('0x38')]);_0x1381b4[_0xc21c('0x39')]=qs['filters'](_[_0xc21c('0x3a')](_0x369257['query'],_0x4a5857['filters']),_0x5b3beb);if(_0x369257[_0xc21c('0x30')][_0xc21c('0x3b')]){_0x1381b4['where']=_['merge'](_0x1381b4['where'],{'$or':_['map'](_0x5b3beb,function(_0x1ff37c){if(_0x1ff37c['type']!==_0xc21c('0x3c')){var _0x4c2675={};_0x4c2675[_0x1ff37c[_0xc21c('0x27')]]={'$like':'%'+_0x369257['query'][_0xc21c('0x3b')]+'%'};return _0x4c2675;}})});}_0x1381b4=_[_0xc21c('0x3d')]({},_0x1381b4,_0x369257['options']);var _0x188a3c={'where':_0x1381b4[_0xc21c('0x39')]};return db['VoiceTransferReport'][_0xc21c('0x1c')](_0x188a3c)[_0xc21c('0x23')](function(_0x4ea9de){_0xc68192[_0xc21c('0x1c')]=_0x4ea9de;if(_0x369257[_0xc21c('0x30')][_0xc21c('0x3e')]){_0x1381b4[_0xc21c('0x3f')]=[{'all':!![]}];}return db[_0xc21c('0x2b')][_0xc21c('0x40')](_0x1381b4);})[_0xc21c('0x23')](function(_0x557561){_0xc68192[_0xc21c('0x41')]=_0x557561;return _0xc68192;})[_0xc21c('0x23')](respondWithFilteredResult(_0x454fd0,_0x1381b4))[_0xc21c('0x42')](handleError(_0x454fd0,null));};exports[_0xc21c('0x43')]=function(_0xd59b7f,_0x5c0170){var _0x52b1d9={'raw':!![],'where':{'id':_0xd59b7f[_0xc21c('0x44')]['id']}},_0x507327={};_0x507327[_0xc21c('0x2f')]=_[_0xc21c('0x45')](db[_0xc21c('0x2b')]['rawAttributes']);_0x507327[_0xc21c('0x30')]=_['keys'](_0xd59b7f[_0xc21c('0x30')]);_0x507327[_0xc21c('0x31')]=_[_0xc21c('0x32')](_0x507327['model'],_0x507327['query']);_0x52b1d9[_0xc21c('0x33')]=_[_0xc21c('0x32')](_0x507327[_0xc21c('0x2f')],qs[_0xc21c('0x34')](_0xd59b7f[_0xc21c('0x30')][_0xc21c('0x34')]));_0x52b1d9[_0xc21c('0x33')]=_0x52b1d9[_0xc21c('0x33')][_0xc21c('0x35')]?_0x52b1d9[_0xc21c('0x33')]:_0x507327[_0xc21c('0x2f')];if(_0xd59b7f['query'][_0xc21c('0x3e')]){_0x52b1d9[_0xc21c('0x3f')]=[{'all':!![]}];}_0x52b1d9=_[_0xc21c('0x3d')]({},_0x52b1d9,_0xd59b7f[_0xc21c('0x46')]);return db[_0xc21c('0x2b')][_0xc21c('0x47')](_0x52b1d9)[_0xc21c('0x23')](handleEntityNotFound(_0x5c0170,null))[_0xc21c('0x23')](respondWithResult(_0x5c0170,null))[_0xc21c('0x42')](handleError(_0x5c0170,null));};exports[_0xc21c('0x48')]=function(_0x40e7c6,_0x452391){return db['VoiceTransferReport']['create'](_0x40e7c6[_0xc21c('0x49')],{})[_0xc21c('0x23')](respondWithResult(_0x452391,0xc9))[_0xc21c('0x42')](handleError(_0x452391,null));};exports[_0xc21c('0x22')]=function(_0x4f3ab4,_0x43817f){if(_0x4f3ab4[_0xc21c('0x49')]['id']){delete _0x4f3ab4[_0xc21c('0x49')]['id'];}return db[_0xc21c('0x2b')][_0xc21c('0x47')]({'where':{'id':_0x4f3ab4[_0xc21c('0x44')]['id']}})['then'](handleEntityNotFound(_0x43817f,null))['then'](saveUpdates(_0x4f3ab4['body'],null))['then'](respondWithResult(_0x43817f,null))[_0xc21c('0x42')](handleError(_0x43817f,null));};exports[_0xc21c('0x24')]=function(_0x4ca0eb,_0xf3d3ae){return db[_0xc21c('0x2b')][_0xc21c('0x47')]({'where':{'id':_0x4ca0eb[_0xc21c('0x44')]['id']}})[_0xc21c('0x23')](handleEntityNotFound(_0xf3d3ae,null))[_0xc21c('0x23')](removeEntity(_0xf3d3ae,null))[_0xc21c('0x42')](handleError(_0xf3d3ae,null));};exports['describe']=function(_0x1d5b46,_0x43d1e6){return db[_0xc21c('0x2b')]['describe']()[_0xc21c('0x23')](respondWithResult(_0x43d1e6,null))[_0xc21c('0x42')](handleError(_0x43d1e6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1e60600..62aa55c 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 _0x5dae=['define','VoiceTransferReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x50f8d8,_0x2e0cfd){var _0x5f1d6a=function(_0x3b7b61){while(--_0x3b7b61){_0x50f8d8['push'](_0x50f8d8['shift']());}};_0x5f1d6a(++_0x2e0cfd);}(_0x5dae,0x138));var _0xe5da=function(_0x405c9c,_0x559fe0){_0x405c9c=_0x405c9c-0x0;var _0x5ebeab=_0x5dae[_0x405c9c];return _0x5ebeab;};'use strict';var _=require(_0xe5da('0x0'));var util=require('util');var logger=require(_0xe5da('0x1'))(_0xe5da('0x2'));var moment=require(_0xe5da('0x3'));var BPromise=require(_0xe5da('0x4'));var rp=require(_0xe5da('0x5'));var fs=require('fs');var path=require(_0xe5da('0x6'));var rimraf=require('rimraf');var config=require(_0xe5da('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x49e9e2,_0x4ffcf5){return _0x49e9e2[_0xe5da('0x8')](_0xe5da('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb1=['define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0xebb1,0x163));var _0x1ebb=function(_0x3205ee,_0x598178){_0x3205ee=_0x3205ee-0x0;var _0x39ddeb=_0xebb1[_0x3205ee];return _0x39ddeb;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var logger=require('../../config/logger')(_0x1ebb('0x2'));var moment=require(_0x1ebb('0x3'));var BPromise=require(_0x1ebb('0x4'));var rp=require(_0x1ebb('0x5'));var fs=require('fs');var path=require(_0x1ebb('0x6'));var rimraf=require('rimraf');var config=require(_0x1ebb('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x50ed20,_0x48d18d){return _0x50ed20[_0x1ebb('0x8')](_0x1ebb('0x9'),attributes,{'tableName':_0x1ebb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 1f40bd2..c4ecd77 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 _0xe6a3=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','body','options','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4b9c51,_0x443773){var _0x284c5f=function(_0x33d8f8){while(--_0x33d8f8){_0x4b9c51['push'](_0x4b9c51['shift']());}};_0x284c5f(++_0x443773);}(_0xe6a3,0x110));var _0x3e6a=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0xe6a3[_0x51ed62];return _0x34aee3;};'use strict';var _=require(_0x3e6a('0x0'));var util=require('util');var moment=require(_0x3e6a('0x1'));var BPromise=require(_0x3e6a('0x2'));var rs=require(_0x3e6a('0x3'));var fs=require('fs');var Redis=require(_0x3e6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3e6a('0x5'))(_0x3e6a('0x6'));var config=require(_0x3e6a('0x7'));var jayson=require(_0x3e6a('0x8'));var client=jayson[_0x3e6a('0x9')][_0x3e6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x96523d,_0xfd9e84,_0x483aa0){return new BPromise(function(_0x4d645a,_0x33cead){return client[_0x3e6a('0xb')](_0x96523d,_0x483aa0)[_0x3e6a('0xc')](function(_0x516aaf){logger[_0x3e6a('0xd')](_0x3e6a('0xe'),_0xfd9e84,_0x3e6a('0xf'));logger['debug'](_0x3e6a('0x10'),_0xfd9e84,_0x3e6a('0xf'),JSON[_0x3e6a('0x11')](_0x516aaf));if(_0x516aaf['error']){if(_0x516aaf[_0x3e6a('0x12')][_0x3e6a('0x13')]===0x1f4){logger['error'](_0x3e6a('0xe'),_0xfd9e84,_0x516aaf['error'][_0x3e6a('0x14')]);return _0x33cead(_0x516aaf[_0x3e6a('0x12')][_0x3e6a('0x14')]);}logger[_0x3e6a('0x12')](_0x3e6a('0xe'),_0xfd9e84,_0x516aaf['error'][_0x3e6a('0x14')]);return _0x4d645a(_0x516aaf[_0x3e6a('0x12')]['message']);}else{logger[_0x3e6a('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0xfd9e84,_0x3e6a('0xf'));_0x4d645a(_0x516aaf['result'][_0x3e6a('0x14')]);}})[_0x3e6a('0x15')](function(_0x1eb542){logger[_0x3e6a('0x12')](_0x3e6a('0xe'),_0xfd9e84,_0x1eb542);_0x33cead(_0x1eb542);});});}exports[_0x3e6a('0x16')]=function(_0x284b02){var _0xe01497=this;return new Promise(function(_0x4ed347,_0x5e9755){return db['VoiceTransferReport']['create'](_0x284b02[_0x3e6a('0x17')],{'raw':_0x284b02['options']?_0x284b02[_0x3e6a('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3e6a('0xc')](function(_0x5009f1){logger[_0x3e6a('0xd')]('CreateVoiceTransferReport',_0x284b02);logger[_0x3e6a('0x19')](_0x3e6a('0x16'),_0x284b02,JSON[_0x3e6a('0x11')](_0x5009f1));_0x4ed347(_0x5009f1);})['catch'](function(_0xdb93){logger[_0x3e6a('0x12')]('CreateVoiceTransferReport',_0xdb93[_0x3e6a('0x14')],_0x284b02);_0x5e9755(_0xe01497['error'](0x1f4,_0xdb93[_0x3e6a('0x14')]));});});}; \ No newline at end of file +var _0x5681=['rpc','../../config/environment','jayson/promise','client','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f9ba5,_0x49a9e5){var _0x5395cb=function(_0x1b4caf){while(--_0x1b4caf){_0x2f9ba5['push'](_0x2f9ba5['shift']());}};_0x5395cb(++_0x49a9e5);}(_0x5681,0x1ab));var _0x1568=function(_0x157c7c,_0x1a90df){_0x157c7c=_0x157c7c-0x0;var _0x111947=_0x5681[_0x157c7c];return _0x111947;};'use strict';var _=require(_0x1568('0x0'));var util=require(_0x1568('0x1'));var moment=require('moment');var BPromise=require(_0x1568('0x2'));var rs=require(_0x1568('0x3'));var fs=require('fs');var Redis=require(_0x1568('0x4'));var db=require(_0x1568('0x5'))['db'];var utils=require(_0x1568('0x6'));var logger=require(_0x1568('0x7'))(_0x1568('0x8'));var config=require(_0x1568('0x9'));var jayson=require(_0x1568('0xa'));var client=jayson[_0x1568('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355e2b,_0x3eb401,_0x216fa5){return new BPromise(function(_0x45c571,_0x29b83a){return client[_0x1568('0xc')](_0x355e2b,_0x216fa5)['then'](function(_0x31d7c8){logger['info'](_0x1568('0xd'),_0x3eb401,_0x1568('0xe'));logger['debug'](_0x1568('0xf'),_0x3eb401,_0x1568('0xe'),JSON[_0x1568('0x10')](_0x31d7c8));if(_0x31d7c8[_0x1568('0x11')]){if(_0x31d7c8[_0x1568('0x11')]['code']===0x1f4){logger[_0x1568('0x11')](_0x1568('0xd'),_0x3eb401,_0x31d7c8[_0x1568('0x11')][_0x1568('0x12')]);return _0x29b83a(_0x31d7c8[_0x1568('0x11')][_0x1568('0x12')]);}logger['error'](_0x1568('0xd'),_0x3eb401,_0x31d7c8['error'][_0x1568('0x12')]);return _0x45c571(_0x31d7c8['error'][_0x1568('0x12')]);}else{logger[_0x1568('0x13')](_0x1568('0xd'),_0x3eb401,_0x1568('0xe'));_0x45c571(_0x31d7c8[_0x1568('0x14')]['message']);}})['catch'](function(_0x8f0607){logger[_0x1568('0x11')](_0x1568('0xd'),_0x3eb401,_0x8f0607);_0x29b83a(_0x8f0607);});});}exports[_0x1568('0x15')]=function(_0x223e81){var _0x2c5bf6=this;return new Promise(function(_0x18834e,_0x1efd7d){return db[_0x1568('0x16')][_0x1568('0x17')](_0x223e81[_0x1568('0x18')],{'raw':_0x223e81[_0x1568('0x19')]?_0x223e81[_0x1568('0x19')][_0x1568('0x1a')]===undefined?!![]:![]:!![]})[_0x1568('0x1b')](function(_0x4f8f65){logger[_0x1568('0x13')](_0x1568('0x15'),_0x223e81);logger['debug']('CreateVoiceTransferReport',_0x223e81,JSON[_0x1568('0x10')](_0x4f8f65));_0x18834e(_0x4f8f65);})[_0x1568('0x1c')](function(_0x79fa9e){logger['error']('CreateVoiceTransferReport',_0x79fa9e[_0x1568('0x12')],_0x223e81);_0x1efd7d(_0x2c5bf6[_0x1568('0x11')](0x1f4,_0x79fa9e[_0x1568('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 89967f4..b0b26e5 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 _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x214a82,_0x39afb9){var _0x59aa24=function(_0x3b15b9){while(--_0x3b15b9){_0x214a82['push'](_0x214a82['shift']());}};_0x59aa24(++_0x39afb9);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3c9855,_0x3459e6){_0x3c9855=_0x3c9855-0x0;var _0x1987ad=_0xf4eb[_0x3c9855];return _0x1987ad;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x247453,_0x156536){var _0x44cd9f=function(_0x352f0f){while(--_0x352f0f){_0x247453['push'](_0x247453['shift']());}};_0x44cd9f(++_0x156536);}(_0xdace,0xc5));var _0xedac=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0xdace[_0x235482];return _0x5f5bea;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1027b20..b057a26 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 _0xf109=['message','result','catch','then','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','emit','log','error','name','send','status','NotFound','request'];(function(_0x6dca33,_0x13a4a5){var _0x24a4a3=function(_0x835740){while(--_0x835740){_0x6dca33['push'](_0x6dca33['shift']());}};_0x24a4a3(++_0x13a4a5);}(_0xf109,0xce));var _0x9f10=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xf109[_0x8a969d];return _0x1d8dc7;};'use strict';var path=require(_0x9f10('0x0'));var fs=require('fs');var _=require(_0x9f10('0x1'));var db=require(_0x9f10('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x9f10('0x3'));var amiClient=jayson[_0x9f10('0x4')][_0x9f10('0x5')]({'port':0x232a});var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var Redis=require(_0x9f10('0x8'));config[_0x9f10('0x9')]=_[_0x9f10('0xa')](config[_0x9f10('0x9')],{'host':_0x9f10('0xb'),'port':0x18eb});var io=require(_0x9f10('0xc'))(new Redis(config['redis']));var Schema=require(_0x9f10('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'callNumber':{'type':_0x9f10('0x10'),'required':[!![],_0x9f10('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x9f10('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9f10('0xf')]},'sessionId':{'type':_0x9f10('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9f10('0x10'),'required':[!![],_0x9f10('0x12')]},'transferNumber':{'type':_0x9f10('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],_0x9f10('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9f10('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x9f10('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x11154b,_0x5ae255,_0x14d3fe){logger[_0x9f10('0x13')](_0x11154b,_0x5ae255,JSON['stringify'](_0x14d3fe));io['to'](_0x11154b)[_0x9f10('0x14')](_0x5ae255,_0x14d3fe);}function handleError(_0xd2950c){return function(_0x509fba){console[_0x9f10('0x15')]('handleError:',_0x509fba,_0x509fba instanceof RangeError);logger[_0x9f10('0x16')](_0x509fba['stack']);if(_0x509fba instanceof RangeError){if(_0x509fba[_0x9f10('0x17')]){delete _0x509fba['name'];}_0xd2950c['status'](0x194)[_0x9f10('0x18')](_0x509fba);}else{if(_0x509fba[_0x9f10('0x17')]){delete _0x509fba[_0x9f10('0x17')];}_0xd2950c[_0x9f10('0x19')](0x1f4)[_0x9f10('0x18')](_0x509fba);}};}function checkError(){return function(_0x332575){if(!_0x332575){throw new RangeError(_0x9f10('0x1a'));}return _0x332575;};}function respondWithRpcPromise(_0x4cdc00,_0x366044){return new BPromise(function(_0x58e6ba,_0x293990){var _0x36ace4=amiClient;return _0x36ace4[_0x9f10('0x1b')](_0x4cdc00,_0x366044)['then'](function(_0x2f31fb){if(_0x2f31fb[_0x9f10('0x16')]){if(_0x2f31fb[_0x9f10('0x16')]['code']===0x1f4){return _0x293990(_0x2f31fb[_0x9f10('0x16')][_0x9f10('0x1c')]);}return _0x58e6ba(_0x2f31fb[_0x9f10('0x16')]['message']);}else{_0x58e6ba(_0x2f31fb[_0x9f10('0x1d')]);}})[_0x9f10('0x1e')](function(_0x11cae7){_0x293990(_0x11cae7);});});}function getAgent(_0x1647c0){return db['User']['findOne']({'where':{'id':_0x1647c0,'role':'agent'}})[_0x9f10('0x1f')](checkError());}function getAgentCheckSession(_0x4a0407,_0x314794){return new BPromise(function(_0x1de75a,_0x45fffc){var _0x2ed95b=respondWithRpcPromise(_0x9f10('0x20'));var _0x4f6b0c=getAgent(_0x4a0407);Promise[_0x9f10('0x21')]([_0x2ed95b,_0x4f6b0c])[_0x9f10('0x1f')](function(_0x40f96b){var _0xfbb37f=_0x40f96b[0x0];var _0x181aec=_0x40f96b[0x1];var _0x2c4373=_['filter'](_0xfbb37f[_0x9f10('0x22')],function(_0x501ee){return _0x501ee[_0x9f10('0x23')]==_0x181aec['id']&&_0x501ee[_0x9f10('0x24')]==_0x314794;});if(_0x2c4373['length']==0x1){_0x1de75a(_0x181aec);}else{_0x45fffc(new RangeError(_0x9f10('0x25')+_0x314794+_0x9f10('0x26')));}});});}exports[_0x9f10('0x27')]=function(_0x5dd404,_0x434128){logger['info'](_0x9f10('0x28'),_0x5dd404[_0x9f10('0x29')]);var _0x13532b=originateValidation['validate'](_0x5dd404[_0x9f10('0x29')]);if(_0x13532b[_0x9f10('0x2a')]>0x0){return _0x434128[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x13532b);}var _0x148a5b=_0x5dd404['body'][_0x9f10('0x2c')];var _0x4b54b7=_0x5dd404[_0x9f10('0x29')][_0x9f10('0x2d')];var _0x1990da=_0x5dd404[_0x9f10('0x29')][_0x9f10('0x2e')];var _0x12c486=_0x5dd404['body'][_0x9f10('0x2f')];return getAgent(_0x148a5b)[_0x9f10('0x1f')](function(_0x1b8018){logger['info'](_0x9f10('0x30'),_0x1b8018[_0x9f10('0x17')]);emit(util['format'](_0x9f10('0x31'),_0x1b8018['name']),_0x9f10('0x32'),{'callNumber':_0x4b54b7,'callerId':_0x1990da,'callbackUrl':_0x12c486});return _0x434128[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x33')});})[_0x9f10('0x1e')](handleError(_0x434128));};exports[_0x9f10('0x34')]=function(_0x12036c,_0x1db955){logger['info'](_0x9f10('0x35'),_0x12036c[_0x9f10('0x29')]);var _0x2fa4bf=hangupValidation['validate'](_0x12036c[_0x9f10('0x29')]);if(_0x2fa4bf[_0x9f10('0x2a')]>0x0){return _0x1db955['status'](0x190)[_0x9f10('0x2b')](_0x2fa4bf);}var _0x26f0ba=_0x12036c[_0x9f10('0x29')]['userId'];var _0x5c516c=_0x12036c[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x26f0ba)[_0x9f10('0x1f')](function(_0x433e70){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x433e70[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x433e70[_0x9f10('0x17')]),_0x9f10('0x37'),{'sessionId':_0x5c516c});return _0x1db955[_0x9f10('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x1db955));};exports[_0x9f10('0x38')]=function(_0x5c8c44,_0x420027){logger[_0x9f10('0x13')](_0x9f10('0x39'),_0x5c8c44['body']);var _0x3cfce6=answerValidation[_0x9f10('0xd')](_0x5c8c44[_0x9f10('0x29')]);if(_0x3cfce6[_0x9f10('0x2a')]>0x0){return _0x420027[_0x9f10('0x19')](0x190)['json'](_0x3cfce6);}var _0x578368=_0x5c8c44['body'][_0x9f10('0x2c')];var _0x5d08fb=_0x5c8c44[_0x9f10('0x29')]['sessionId'];return getAgent(_0x578368)[_0x9f10('0x1f')](function(_0x3e8d3c){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x3e8d3c['name']);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x3e8d3c['name']),_0x9f10('0x3a'),{'sessionId':_0x5d08fb});return _0x420027[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x3b')});})[_0x9f10('0x1e')](handleError(_0x420027));};exports[_0x9f10('0x3c')]=function(_0x4bedbe,_0x281da4){logger[_0x9f10('0x13')](_0x9f10('0x3d'),_0x4bedbe['body']);var _0x181eab=holdValidation[_0x9f10('0xd')](_0x4bedbe['body']);if(_0x181eab[_0x9f10('0x2a')]>0x0){return _0x281da4[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x181eab);}var _0x1807b3=_0x4bedbe['body'][_0x9f10('0x2c')];var _0x2ae710=_0x4bedbe[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x1807b3)[_0x9f10('0x1f')](function(_0x43cb31){logger['info'](_0x9f10('0x30'),_0x43cb31[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')](_0x9f10('0x31'),_0x43cb31[_0x9f10('0x17')]),_0x9f10('0x3e'),{'sessionId':_0x2ae710});return _0x281da4['status'](0xc8)[_0x9f10('0x2b')]({'error':![],'message':_0x9f10('0x3f')});})[_0x9f10('0x1e')](handleError(_0x281da4));};exports[_0x9f10('0x40')]=function(_0x39dae3,_0x15d676){logger[_0x9f10('0x13')](_0x9f10('0x41'),_0x39dae3['body']);var _0xd1da11=unholdValidation['validate'](_0x39dae3[_0x9f10('0x29')]);if(_0xd1da11['length']>0x0){return _0x15d676[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0xd1da11);}var _0x30fad9=_0x39dae3[_0x9f10('0x29')][_0x9f10('0x2c')];var _0x497260=_0x39dae3[_0x9f10('0x29')][_0x9f10('0x24')];return getAgent(_0x30fad9)[_0x9f10('0x1f')](function(_0x3818dc){logger['info']('entityFound:',_0x3818dc[_0x9f10('0x17')]);emit(util[_0x9f10('0x36')]('user:%s',_0x3818dc['name']),_0x9f10('0x42'),{'sessionId':_0x497260});return _0x15d676[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':'unhold\x20executed!'});})[_0x9f10('0x1e')](handleError(_0x15d676));};exports[_0x9f10('0x43')]=function(_0x7611e8,_0x4c3d18){logger[_0x9f10('0x13')](_0x9f10('0x44'),_0x4c3d18[_0x9f10('0x29')]);var _0x48a76e=callsValidation[_0x9f10('0xd')](_0x7611e8[_0x9f10('0x29')]);if(_0x48a76e['length']>0x0){return _0x4c3d18[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x48a76e);}var _0xcd8ae7=_0x7611e8[_0x9f10('0x29')][_0x9f10('0x2c')];var _0x55cb99=respondWithRpcPromise(_0x9f10('0x20'));var _0x53c384=getAgent(_0xcd8ae7);return Promise['all']([_0x55cb99,_0x53c384])[_0x9f10('0x1f')](function(_0x19b489){var _0x1f109a=_0x19b489[0x0];var _0x277a86=_0x19b489[0x1];var _0x2ed385=_[_0x9f10('0x45')](_0x1f109a[_0x9f10('0x22')],function(_0x4ef6c3){return _0x4ef6c3['UserId']==_0x277a86['id'];});return _0x4c3d18[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'count':_0x2ed385[_0x9f10('0x2a')],'rows':_0x2ed385});})[_0x9f10('0x1e')](handleError(_0x4c3d18));};exports[_0x9f10('0x46')]=function(_0x2094c9,_0x35460a){logger['info'](_0x9f10('0x47'),_0x2094c9[_0x9f10('0x29')]);var _0x5a777a=conferenceValidation[_0x9f10('0xd')](_0x2094c9[_0x9f10('0x29')]);if(_0x5a777a['length']>0x0){return _0x35460a[_0x9f10('0x19')](0x190)[_0x9f10('0x2b')](_0x5a777a);}var _0x58b3b4=_0x2094c9[_0x9f10('0x29')]['userId'];return getAgent(_0x58b3b4)[_0x9f10('0x1f')](function(_0x2325aa){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x2325aa[_0x9f10('0x17')]);emit(util['format'](_0x9f10('0x31'),_0x2325aa[_0x9f10('0x17')]),_0x9f10('0x48'));return _0x35460a['status'](0xc8)['json']({'error':![],'message':_0x9f10('0x49')});})[_0x9f10('0x1e')](handleError(_0x35460a));};exports[_0x9f10('0x4a')]=function(_0x20045f,_0xd627a2){logger[_0x9f10('0x13')](_0x9f10('0x4b'),_0x20045f['body']);var _0x3635f9=transferValidation[_0x9f10('0xd')](_0x20045f['body']);if(_0x3635f9[_0x9f10('0x2a')]>0x0){return _0xd627a2['status'](0x190)[_0x9f10('0x2b')](_0x3635f9);}var _0x354220=_0x20045f['body'][_0x9f10('0x2c')];var _0x4cbe80=_0x20045f[_0x9f10('0x29')][_0x9f10('0x24')];var _0x163165=_0x20045f['body'][_0x9f10('0x4c')];return getAgent(_0x354220)['then'](function(_0x2d704b){logger[_0x9f10('0x13')](_0x9f10('0x30'),_0x2d704b['name']);emit(util[_0x9f10('0x36')]('user:%s',_0x2d704b['name']),_0x9f10('0x4d'),{'sessionId':_0x4cbe80,'transferNumber':_0x163165});return _0xd627a2[_0x9f10('0x19')](0xc8)[_0x9f10('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0x9f10('0x1e')](handleError(_0xd627a2));}; \ No newline at end of file +var _0x1b32=['emit','log','handleError:','error','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','validate','length','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','hangup\x20executed!','catch','answer','answer\x20fired:','webbar:answer','hold','sessionId','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x280fc6,_0x41200){var _0x4a40ae=function(_0x2699ea){while(--_0x2699ea){_0x280fc6['push'](_0x280fc6['shift']());}};_0x4a40ae(++_0x41200);}(_0x1b32,0x85));var _0x21b3=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x1b32[_0x9fd887];return _0x1a54ab;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x21b3('0x0'));var db=require(_0x21b3('0x1'))['db'];var config=require(_0x21b3('0x2'));var util=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var jayson=require(_0x21b3('0x5'));var amiClient=jayson[_0x21b3('0x6')][_0x21b3('0x7')]({'port':0x232a});var logger=require(_0x21b3('0x8'))(_0x21b3('0x9'));var Redis=require(_0x21b3('0xa'));config[_0x21b3('0xb')]=_[_0x21b3('0xc')](config[_0x21b3('0xb')],{'host':_0x21b3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21b3('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x12')]},'transferNumber':{'type':_0x21b3('0xe'),'required':[!![],_0x21b3('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x21b3('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],_0x21b3('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x21b3('0x10'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x15662a,_0xe6b2b7,_0x29f286){logger[_0x21b3('0x14')](_0x15662a,_0xe6b2b7,JSON['stringify'](_0x29f286));io['to'](_0x15662a)[_0x21b3('0x15')](_0xe6b2b7,_0x29f286);}function handleError(_0x47ae6c){return function(_0x408c17){console[_0x21b3('0x16')](_0x21b3('0x17'),_0x408c17,_0x408c17 instanceof RangeError);logger[_0x21b3('0x18')](_0x408c17['stack']);if(_0x408c17 instanceof RangeError){if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x194)['send'](_0x408c17);}else{if(_0x408c17[_0x21b3('0x19')]){delete _0x408c17[_0x21b3('0x19')];}_0x47ae6c[_0x21b3('0x1a')](0x1f4)[_0x21b3('0x1b')](_0x408c17);}};}function checkError(){return function(_0x360e57){if(!_0x360e57){throw new RangeError(_0x21b3('0x1c'));}return _0x360e57;};}function respondWithRpcPromise(_0x1e5181,_0x4cc8e0){return new BPromise(function(_0xbb78f3,_0x54695b){var _0x139672=amiClient;return _0x139672[_0x21b3('0x1d')](_0x1e5181,_0x4cc8e0)[_0x21b3('0x1e')](function(_0x4fcb87){if(_0x4fcb87[_0x21b3('0x18')]){if(_0x4fcb87['error'][_0x21b3('0x1f')]===0x1f4){return _0x54695b(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}return _0xbb78f3(_0x4fcb87[_0x21b3('0x18')][_0x21b3('0x20')]);}else{_0xbb78f3(_0x4fcb87[_0x21b3('0x21')]);}})['catch'](function(_0x5b752c){_0x54695b(_0x5b752c);});});}function getAgent(_0x49aab8){return db[_0x21b3('0x22')][_0x21b3('0x23')]({'where':{'id':_0x49aab8,'role':_0x21b3('0x24')}})[_0x21b3('0x1e')](checkError());}function getAgentCheckSession(_0x18eba4,_0x58a356){return new BPromise(function(_0x170e78,_0x564313){var _0x16d012=respondWithRpcPromise('VoiceChannels');var _0x469e42=getAgent(_0x18eba4);Promise[_0x21b3('0x25')]([_0x16d012,_0x469e42])[_0x21b3('0x1e')](function(_0x4f6432){var _0x291e52=_0x4f6432[0x0];var _0x300977=_0x4f6432[0x1];var _0x336b1e=_[_0x21b3('0x26')](_0x291e52[_0x21b3('0x27')],function(_0x210c49){return _0x210c49[_0x21b3('0x28')]==_0x300977['id']&&_0x210c49['sessionId']==_0x58a356;});if(_0x336b1e['length']==0x1){_0x170e78(_0x300977);}else{_0x564313(new RangeError(_0x21b3('0x29')+_0x58a356+_0x21b3('0x2a')));}});});}exports['originate']=function(_0x45c753,_0xa04ac7){logger[_0x21b3('0x14')](_0x21b3('0x2b'),_0x45c753[_0x21b3('0x2c')]);var _0x6c56f5=originateValidation[_0x21b3('0x2d')](_0x45c753[_0x21b3('0x2c')]);if(_0x6c56f5[_0x21b3('0x2e')]>0x0){return _0xa04ac7['status'](0x190)['json'](_0x6c56f5);}var _0x18946f=_0x45c753['body'][_0x21b3('0x2f')];var _0x2d8c12=_0x45c753['body'][_0x21b3('0x30')];var _0x403cec=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x31')];var _0x4c4239=_0x45c753[_0x21b3('0x2c')][_0x21b3('0x32')];return getAgent(_0x18946f)[_0x21b3('0x1e')](function(_0x118b9b){logger['info'](_0x21b3('0x33'),_0x118b9b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x118b9b[_0x21b3('0x19')]),_0x21b3('0x36'),{'callNumber':_0x2d8c12,'callerId':_0x403cec,'callbackUrl':_0x4c4239});return _0xa04ac7[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x38')});})['catch'](handleError(_0xa04ac7));};exports['hangup']=function(_0x28641f,_0x86027e){logger[_0x21b3('0x14')](_0x21b3('0x39'),_0x28641f['body']);var _0x1c190e=hangupValidation[_0x21b3('0x2d')](_0x28641f[_0x21b3('0x2c')]);if(_0x1c190e[_0x21b3('0x2e')]>0x0){return _0x86027e[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x1c190e);}var _0xbb93cd=_0x28641f[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x3145b2=_0x28641f[_0x21b3('0x2c')]['sessionId'];return getAgent(_0xbb93cd)[_0x21b3('0x1e')](function(_0x321050){logger['info'](_0x21b3('0x33'),_0x321050['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x321050['name']),'webbar:hangup',{'sessionId':_0x3145b2});return _0x86027e['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x3a')});})[_0x21b3('0x3b')](handleError(_0x86027e));};exports[_0x21b3('0x3c')]=function(_0x548652,_0x5d310c){logger[_0x21b3('0x14')](_0x21b3('0x3d'),_0x548652[_0x21b3('0x2c')]);var _0x28adbc=answerValidation[_0x21b3('0x2d')](_0x548652[_0x21b3('0x2c')]);if(_0x28adbc[_0x21b3('0x2e')]>0x0){return _0x5d310c['status'](0x190)[_0x21b3('0x37')](_0x28adbc);}var _0x44cf7d=_0x548652[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x119b43=_0x548652[_0x21b3('0x2c')]['sessionId'];return getAgent(_0x44cf7d)['then'](function(_0x1e7e1b){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x1e7e1b['name']);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x1e7e1b[_0x21b3('0x19')]),_0x21b3('0x3e'),{'sessionId':_0x119b43});return _0x5d310c[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'answer\x20executed!'});})[_0x21b3('0x3b')](handleError(_0x5d310c));};exports[_0x21b3('0x3f')]=function(_0x3bc4ef,_0x4e3d2b){logger['info']('hold\x20fired:',_0x3bc4ef[_0x21b3('0x2c')]);var _0x17b878=holdValidation[_0x21b3('0x2d')](_0x3bc4ef[_0x21b3('0x2c')]);if(_0x17b878[_0x21b3('0x2e')]>0x0){return _0x4e3d2b[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x17b878);}var _0x30d48b=_0x3bc4ef[_0x21b3('0x2c')]['userId'];var _0x542ef4=_0x3bc4ef['body'][_0x21b3('0x40')];return getAgent(_0x30d48b)[_0x21b3('0x1e')](function(_0x4046cd){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0x4046cd[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x4046cd[_0x21b3('0x19')]),_0x21b3('0x41'),{'sessionId':_0x542ef4});return _0x4e3d2b['status'](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x42')});})[_0x21b3('0x3b')](handleError(_0x4e3d2b));};exports[_0x21b3('0x43')]=function(_0x34509e,_0x2c7019){logger[_0x21b3('0x14')](_0x21b3('0x44'),_0x34509e[_0x21b3('0x2c')]);var _0x58c568=unholdValidation[_0x21b3('0x2d')](_0x34509e[_0x21b3('0x2c')]);if(_0x58c568[_0x21b3('0x2e')]>0x0){return _0x2c7019[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x58c568);}var _0x5d7ee7=_0x34509e['body'][_0x21b3('0x2f')];var _0x4bd19f=_0x34509e[_0x21b3('0x2c')][_0x21b3('0x40')];return getAgent(_0x5d7ee7)[_0x21b3('0x1e')](function(_0x412536){logger['info']('entityFound:',_0x412536[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x412536[_0x21b3('0x19')]),'webbar:unhold',{'sessionId':_0x4bd19f});return _0x2c7019[_0x21b3('0x1a')](0xc8)['json']({'error':![],'message':_0x21b3('0x45')});})[_0x21b3('0x3b')](handleError(_0x2c7019));};exports['calls']=function(_0x5f55ff,_0x3fd841){logger[_0x21b3('0x14')](_0x21b3('0x46'),_0x3fd841[_0x21b3('0x2c')]);var _0xc612b5=callsValidation[_0x21b3('0x2d')](_0x5f55ff[_0x21b3('0x2c')]);if(_0xc612b5['length']>0x0){return _0x3fd841[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0xc612b5);}var _0x166a31=_0x5f55ff[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x49a40e=respondWithRpcPromise('VoiceChannels');var _0x31c8f8=getAgent(_0x166a31);return Promise[_0x21b3('0x25')]([_0x49a40e,_0x31c8f8])[_0x21b3('0x1e')](function(_0x279b7d){var _0x18582e=_0x279b7d[0x0];var _0x4f728=_0x279b7d[0x1];var _0x5b1611=_[_0x21b3('0x26')](_0x18582e[_0x21b3('0x27')],function(_0x552141){return _0x552141[_0x21b3('0x28')]==_0x4f728['id'];});return _0x3fd841['status'](0xc8)[_0x21b3('0x37')]({'count':_0x5b1611[_0x21b3('0x2e')],'rows':_0x5b1611});})[_0x21b3('0x3b')](handleError(_0x3fd841));};exports[_0x21b3('0x47')]=function(_0x542c4e,_0x193317){logger['info'](_0x21b3('0x48'),_0x542c4e[_0x21b3('0x2c')]);var _0x3d285f=conferenceValidation[_0x21b3('0x2d')](_0x542c4e[_0x21b3('0x2c')]);if(_0x3d285f['length']>0x0){return _0x193317[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3d285f);}var _0x1821bf=_0x542c4e[_0x21b3('0x2c')][_0x21b3('0x2f')];return getAgent(_0x1821bf)[_0x21b3('0x1e')](function(_0xf6eb3){logger[_0x21b3('0x14')](_0x21b3('0x33'),_0xf6eb3[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0xf6eb3[_0x21b3('0x19')]),_0x21b3('0x49'));return _0x193317[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':_0x21b3('0x4a')});})[_0x21b3('0x3b')](handleError(_0x193317));};exports['transfer']=function(_0x412e3b,_0xc0c8f){logger[_0x21b3('0x14')]('transfer\x20fired:',_0x412e3b[_0x21b3('0x2c')]);var _0x3572e1=transferValidation[_0x21b3('0x2d')](_0x412e3b['body']);if(_0x3572e1[_0x21b3('0x2e')]>0x0){return _0xc0c8f[_0x21b3('0x1a')](0x190)[_0x21b3('0x37')](_0x3572e1);}var _0x1655e4=_0x412e3b[_0x21b3('0x2c')][_0x21b3('0x2f')];var _0x2d33a7=_0x412e3b['body']['sessionId'];var _0x31c511=_0x412e3b['body'][_0x21b3('0x4b')];return getAgent(_0x1655e4)[_0x21b3('0x1e')](function(_0x164d9f){logger['info'](_0x21b3('0x33'),_0x164d9f[_0x21b3('0x19')]);emit(util[_0x21b3('0x34')](_0x21b3('0x35'),_0x164d9f[_0x21b3('0x19')]),_0x21b3('0x4c'),{'sessionId':_0x2d33a7,'transferNumber':_0x31c511});return _0xc0c8f[_0x21b3('0x1a')](0xc8)[_0x21b3('0x37')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc0c8f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 36cfa09..ad7daf6 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 _0x9536=['getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addApplications','/:id/notify','notify','send','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x1ffd3c,_0x80c2c8){var _0x53e7ad=function(_0x211853){while(--_0x211853){_0x1ffd3c['push'](_0x1ffd3c['shift']());}};_0x53e7ad(++_0x80c2c8);}(_0x9536,0x179));var _0x6953=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9536[_0x279d37];return _0x530173;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x11')]);router[_0x6953('0x9')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x13')]);router[_0x6953('0x9')](_0x6953('0x14'),auth['isAuthenticated'](),controller[_0x6953('0x15')]);router['get'](_0x6953('0x16'),auth[_0x6953('0xc')](),controller[_0x6953('0x17')]);router[_0x6953('0x18')]('/',auth[_0x6953('0xc')](),controller[_0x6953('0x19')]);router[_0x6953('0x18')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x1a')]);router[_0x6953('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6953('0x1b')]);router[_0x6953('0x18')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller['addAgents']);router[_0x6953('0x18')](_0x6953('0x16'),auth['isAuthenticated'](),controller[_0x6953('0x1c')]);router[_0x6953('0x18')](_0x6953('0x1d'),controller[_0x6953('0x1e')]);router[_0x6953('0x18')]('/:id/send',auth[_0x6953('0xc')](),controller[_0x6953('0x1f')]);router[_0x6953('0x20')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller['update']);router[_0x6953('0x21')](_0x6953('0xe'),auth['isAuthenticated'](),controller[_0x6953('0x22')]);router[_0x6953('0x21')](_0x6953('0x10'),auth[_0x6953('0xc')](),controller['removeDispositions']);router[_0x6953('0x21')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x6953('0xc')](),controller[_0x6953('0x23')]);module['exports']=router; \ No newline at end of file +var _0x4975=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated'];(function(_0x4ce0f4,_0x7eb8f0){var _0x5941d9=function(_0x5ed96c){while(--_0x5ed96c){_0x4ce0f4['push'](_0x4ce0f4['shift']());}};_0x5941d9(++_0x7eb8f0);}(_0x4975,0x86));var _0x5497=function(_0x149264,_0x34a83b){_0x149264=_0x149264-0x0;var _0x39f17d=_0x4975[_0x149264];return _0x39f17d;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router[_0x5497('0xa')](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x17')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x18')]);router[_0x5497('0x17')]('/:id/dispositions',auth[_0x5497('0xd')](),controller['addDisposition']);router[_0x5497('0x17')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller[_0x5497('0x19')]);router[_0x5497('0x17')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller['addAgents']);router['post'](_0x5497('0x15'),auth[_0x5497('0xd')](),controller[_0x5497('0x1b')]);router['post'](_0x5497('0x1c'),controller[_0x5497('0x1d')]);router[_0x5497('0x17')](_0x5497('0x1e'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);router[_0x5497('0x20')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x21')]);router[_0x5497('0x22')]('/:id',auth[_0x5497('0xd')](),controller['destroy']);router[_0x5497('0x22')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x23')]);router[_0x5497('0x22')](_0x5497('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5497('0x22')](_0x5497('0x1a'),auth[_0x5497('0xd')](),controller[_0x5497('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f53a3f8..a88c71b 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 _0x0196=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x31a330,_0x3eea21){var _0x15794c=function(_0x416da6){while(--_0x416da6){_0x31a330['push'](_0x31a330['shift']());}};_0x15794c(++_0x3eea21);}(_0x0196,0x114));var _0x6019=function(_0x388c59,_0x5763c2){_0x388c59=_0x388c59-0x0;var _0x1fadb1=_0x0196[_0x388c59];return _0x1fadb1;};'use strict';var Sequelize=require(_0x6019('0x0'));var rs=require(_0x6019('0x1'));module[_0x6019('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x6019('0x3')],'defaultValue':function(){return rs[_0x6019('0x4')]();}},'phone':{'type':Sequelize[_0x6019('0x3')]},'type':{'type':Sequelize['ENUM'](_0x6019('0x5'),_0x6019('0x6'))},'accountSid':{'type':Sequelize[_0x6019('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6019('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6019('0x7')],'defaultValue':function(){return _0x6019('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6019('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6019('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6019('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6019('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6019('0x9')],'comment':_0x6019('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x6019('0xa')],'defaultValue':![],'comment':_0x6019('0xc'),'set':function(_0x28ebf3){if(!_0x28ebf3){this[_0x6019('0xd')](_0x6019('0xe'),null);}this[_0x6019('0xd')](_0x6019('0xf'),_0x28ebf3);}},'description':{'type':Sequelize[_0x6019('0x3')]}}; \ No newline at end of file +var _0xb065=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','generate','ENUM'];(function(_0x2eeccd,_0x1c73af){var _0x21e0e2=function(_0x5ecd3b){while(--_0x5ecd3b){_0x2eeccd['push'](_0x2eeccd['shift']());}};_0x21e0e2(++_0x1c73af);}(_0xb065,0x180));var _0x5b06=function(_0x3949a5,_0x42edd9){_0x3949a5=_0x3949a5-0x0;var _0x48c8e5=_0xb065[_0x3949a5];return _0x48c8e5;};'use strict';var Sequelize=require(_0x5b06('0x0'));var rs=require(_0x5b06('0x1'));module[_0x5b06('0x2')]={'name':{'type':Sequelize[_0x5b06('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5b06('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5b06('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5b06('0x3')],'defaultValue':function(){return rs[_0x5b06('0x4')]();}},'phone':{'type':Sequelize[_0x5b06('0x3')]},'type':{'type':Sequelize[_0x5b06('0x5')](_0x5b06('0x6'),_0x5b06('0x7'))},'accountSid':{'type':Sequelize[_0x5b06('0x3')]},'baseUrl':{'type':Sequelize[_0x5b06('0x3')]},'authToken':{'type':Sequelize[_0x5b06('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5b06('0x8')],'defaultValue':function(){return _0x5b06('0x9');}},'notificationSound':{'type':Sequelize[_0x5b06('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5b06('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b06('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b06('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5b06('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b06('0xb')],'comment':_0x5b06('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x5b06('0xa')],'defaultValue':![],'comment':_0x5b06('0xd'),'set':function(_0xc8963d){if(!_0xc8963d){this[_0x5b06('0xe')]('mandatoryDispositionPauseId',null);}this['setDataValue']('mandatoryDisposition',_0xc8963d);}},'description':{'type':Sequelize[_0x5b06('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 517dbe2..853ae62 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 _0x26eb=['hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','Pause','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','params','destroy','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','pick','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','notifications','messageId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','get','WhatsappAccounts','stack','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x599366,_0x42e7ac){var _0x1ef57b=function(_0x54ea09){while(--_0x54ea09){_0x599366['push'](_0x599366['shift']());}};_0x1ef57b(++_0x42e7ac);}(_0x26eb,0x7e));var _0xb26e=function(_0xb70c0b,_0x112451){_0xb70c0b=_0xb70c0b-0x0;var _0x26ea8e=_0x26eb[_0xb70c0b];return _0x26ea8e;};'use strict';var emlformat=require(_0xb26e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb26e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb26e('0x2'));var moment=require(_0xb26e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb26e('0x4'));var util=require('util');var path=require(_0xb26e('0x5'));var sox=require('sox');var csv=require(_0xb26e('0x6'));var ejs=require(_0xb26e('0x7'));var fs=require('fs');var fs_extra=require(_0xb26e('0x8'));var _=require(_0xb26e('0x9'));var squel=require(_0xb26e('0xa'));var crypto=require(_0xb26e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb26e('0xc'));var toCsv=require(_0xb26e('0x6'));var querystring=require(_0xb26e('0xd'));var Papa=require(_0xb26e('0xe'));var Redis=require(_0xb26e('0xf'));var authService=require(_0xb26e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb26e('0x11'));var hardwareService=require(_0xb26e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb26e('0x13'));var licenseUtil=require(_0xb26e('0x14'));var db=require(_0xb26e('0x15'))['db'];config[_0xb26e('0x16')]=_[_0xb26e('0x17')](config['redis'],{'host':_0xb26e('0x18'),'port':0x18eb});var socket=require(_0xb26e('0x19'))(new Redis(config[_0xb26e('0x16')]));require(_0xb26e('0x1a'))['register'](socket);var jayson=require(_0xb26e('0x1b'));var client=jayson[_0xb26e('0x1c')][_0xb26e('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1a5d29,_0x48273c,_0x4f31a2,_0x2b94aa){return new BPromise(function(_0x59ba3e,_0x120646){var _0x1fc83e=_0x2b94aa||client;return _0x1fc83e[_0xb26e('0x1e')](_0x1a5d29,_0x4f31a2)[_0xb26e('0x1f')](function(_0x3cf2f9){logger[_0xb26e('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x48273c,'request\x20sent');logger['debug'](_0xb26e('0x21'),_0x48273c,_0xb26e('0x22'),JSON[_0xb26e('0x23')](_0x3cf2f9));if(_0x3cf2f9[_0xb26e('0x24')]){if(_0x3cf2f9[_0xb26e('0x24')]['code']===0x1f4){logger[_0xb26e('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x48273c,_0x3cf2f9['error'][_0xb26e('0x25')]);return _0x120646(_0x3cf2f9['error'][_0xb26e('0x25')]);}logger[_0xb26e('0x24')](_0xb26e('0x26'),_0x48273c,_0x3cf2f9[_0xb26e('0x24')][_0xb26e('0x25')]);return _0x59ba3e(_0x3cf2f9['error'][_0xb26e('0x25')]);}else{logger[_0xb26e('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x48273c,_0xb26e('0x22'));_0x59ba3e(_0x3cf2f9[_0xb26e('0x27')]['message']);}})[_0xb26e('0x28')](function(_0x1f2bd0){logger[_0xb26e('0x24')](_0xb26e('0x26'),_0x48273c,_0x1f2bd0);_0x120646(_0x1f2bd0);});});}function respondWithStatusCode(_0xde4c87,_0x5d2618){_0x5d2618=_0x5d2618||0xcc;return function(_0x20a60a){if(_0x20a60a){return _0xde4c87[_0xb26e('0x29')](_0x5d2618);}return _0xde4c87[_0xb26e('0x2a')](_0x5d2618)[_0xb26e('0x2b')]();};}function respondWithResult(_0x477056,_0x1e6c62){_0x1e6c62=_0x1e6c62||0xc8;return function(_0x4935f2){if(_0x4935f2){return _0x477056[_0xb26e('0x2a')](_0x1e6c62)[_0xb26e('0x2c')](_0x4935f2);}};}function respondWithFilteredResult(_0x331ebf,_0x16da36){return function(_0x4c1ed2){if(_0x4c1ed2){var _0x31c3be=typeof _0x16da36[_0xb26e('0x2d')]===_0xb26e('0x2e')&&typeof _0x16da36['limit']===_0xb26e('0x2e');var _0x2a1728=_0x4c1ed2[_0xb26e('0x2f')];var _0x1c6bfe=_0x31c3be?0x0:_0x16da36[_0xb26e('0x2d')];var _0x50b22f=_0x31c3be?_0x4c1ed2[_0xb26e('0x2f')]:_0x16da36[_0xb26e('0x2d')]+_0x16da36[_0xb26e('0x30')];var _0x4b8cdb;if(_0x50b22f>=_0x2a1728){_0x50b22f=_0x2a1728;_0x4b8cdb=0xc8;}else{_0x4b8cdb=0xce;}_0x331ebf[_0xb26e('0x2a')](_0x4b8cdb);return _0x331ebf[_0xb26e('0x31')]('Content-Range',_0x1c6bfe+'-'+_0x50b22f+'/'+_0x2a1728)[_0xb26e('0x2c')](_0x4c1ed2);}return null;};}function patchUpdates(_0x59d1df){return function(_0x438993){try{jsonpatch[_0xb26e('0x32')](_0x438993,_0x59d1df,!![]);}catch(_0x33e125){return BPromise['reject'](_0x33e125);}return _0x438993[_0xb26e('0x33')]();};}function saveUpdates(_0x17c1b8,_0x34ed0f){return function(_0x2f0a01){if(_0x2f0a01){return _0x2f0a01['update'](_0x17c1b8)[_0xb26e('0x1f')](function(_0x589de2){return _0x589de2;});}return null;};}function removeEntity(_0x1b04e0,_0x51b4ff){return function(_0x3ef0d9){if(_0x3ef0d9){return _0x3ef0d9['destroy']()[_0xb26e('0x1f')](function(){var _0x2a49a5=_0x3ef0d9[_0xb26e('0x34')]({'plain':!![]});var _0x2c5307=_0xb26e('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x2c5307,'resourceId':_0x2a49a5['id']}})[_0xb26e('0x1f')](function(){return _0x3ef0d9;});})[_0xb26e('0x1f')](function(){_0x1b04e0[_0xb26e('0x2a')](0xcc)[_0xb26e('0x2b')]();});}};}function handleEntityNotFound(_0x1ea5b2,_0x5cd8c9){return function(_0x3e138b){if(!_0x3e138b){_0x1ea5b2[_0xb26e('0x29')](0x194);}return _0x3e138b;};}function handleError(_0x1bbda9,_0x32c418){_0x32c418=_0x32c418||0x1f4;return function(_0x44ce2e){logger[_0xb26e('0x24')](_0x44ce2e[_0xb26e('0x36')]);if(_0x44ce2e[_0xb26e('0x37')]){delete _0x44ce2e['name'];}_0x1bbda9['status'](_0x32c418)[_0xb26e('0x38')](_0x44ce2e);};}exports['index']=function(_0x350576,_0x4adb5b){var _0x2bf908={'include':[{'model':db['Pause'],'as':_0xb26e('0x39')}]},_0x14acea={},_0x16f082={'count':0x0,'rows':[]};var _0xd4d6b=_[_0xb26e('0x3a')](db['WhatsappAccount'][_0xb26e('0x3b')],function(_0x5ebb40){return{'name':_0x5ebb40[_0xb26e('0x3c')],'type':_0x5ebb40[_0xb26e('0x3d')]['key']};});_0x14acea[_0xb26e('0x3e')]=_['map'](_0xd4d6b,_0xb26e('0x37'));_0x14acea[_0xb26e('0x3f')]=_[_0xb26e('0x40')](_0x350576[_0xb26e('0x3f')]);_0x14acea['filters']=_[_0xb26e('0x41')](_0x14acea[_0xb26e('0x3e')],_0x14acea['query']);_0x2bf908[_0xb26e('0x42')]=_[_0xb26e('0x41')](_0x14acea[_0xb26e('0x3e')],qs['fields'](_0x350576[_0xb26e('0x3f')][_0xb26e('0x43')]));_0x2bf908['attributes']=_0x2bf908[_0xb26e('0x42')][_0xb26e('0x44')]?_0x2bf908[_0xb26e('0x42')]:_0x14acea[_0xb26e('0x3e')];if(!_0x350576['query'][_0xb26e('0x45')](_0xb26e('0x46'))){_0x2bf908['limit']=qs[_0xb26e('0x30')](_0x350576[_0xb26e('0x3f')][_0xb26e('0x30')]);_0x2bf908[_0xb26e('0x2d')]=qs[_0xb26e('0x2d')](_0x350576[_0xb26e('0x3f')][_0xb26e('0x2d')]);}_0x2bf908['order']=qs[_0xb26e('0x47')](_0x350576[_0xb26e('0x3f')][_0xb26e('0x47')]);_0x2bf908[_0xb26e('0x48')]=qs['filters'](_['pick'](_0x350576[_0xb26e('0x3f')],_0x14acea[_0xb26e('0x49')]),_0xd4d6b);if(_0x350576[_0xb26e('0x3f')][_0xb26e('0x4a')]){_0x2bf908[_0xb26e('0x48')]=_[_0xb26e('0x4b')](_0x2bf908['where'],{'$or':_[_0xb26e('0x3a')](_0xd4d6b,function(_0x170d55){if(_0x170d55[_0xb26e('0x3d')]!==_0xb26e('0x4c')){var _0x16fe5d={};_0x16fe5d[_0x170d55[_0xb26e('0x37')]]={'$like':'%'+_0x350576['query'][_0xb26e('0x4a')]+'%'};return _0x16fe5d;}})});}_0x2bf908=_[_0xb26e('0x4b')]({},_0x2bf908,_0x350576[_0xb26e('0x4d')]);var _0x388b6e={'where':_0x2bf908[_0xb26e('0x48')]};return db[_0xb26e('0x4e')]['count'](_0x388b6e)[_0xb26e('0x1f')](function(_0x309553){_0x16f082['count']=_0x309553;if(_0x350576[_0xb26e('0x3f')][_0xb26e('0x4f')]){_0x2bf908[_0xb26e('0x50')]=[{'all':!![]}];}return db[_0xb26e('0x4e')][_0xb26e('0x51')](_0x2bf908);})[_0xb26e('0x1f')](function(_0x31f7c6){_0x16f082[_0xb26e('0x52')]=_0x31f7c6;return _0x16f082;})[_0xb26e('0x1f')](respondWithFilteredResult(_0x4adb5b,_0x2bf908))[_0xb26e('0x28')](handleError(_0x4adb5b,null));};exports[_0xb26e('0x53')]=function(_0x47a9b3,_0x346ed1){var _0x2c6255={'raw':![],'where':{'id':_0x47a9b3['params']['id']},'include':[{'model':db[_0xb26e('0x54')],'as':_0xb26e('0x39')}]},_0x2138bd={};_0x2138bd['model']=_['keys'](db['WhatsappAccount'][_0xb26e('0x3b')]);_0x2138bd[_0xb26e('0x3f')]=_['keys'](_0x47a9b3['query']);_0x2138bd[_0xb26e('0x49')]=_[_0xb26e('0x41')](_0x2138bd['model'],_0x2138bd['query']);_0x2c6255[_0xb26e('0x42')]=_[_0xb26e('0x41')](_0x2138bd[_0xb26e('0x3e')],qs[_0xb26e('0x43')](_0x47a9b3['query'][_0xb26e('0x43')]));_0x2c6255[_0xb26e('0x42')]=_0x2c6255['attributes'][_0xb26e('0x44')]?_0x2c6255[_0xb26e('0x42')]:_0x2138bd[_0xb26e('0x3e')];if(_0x47a9b3[_0xb26e('0x3f')]['includeAll']){_0x2c6255['include']=[{'all':!![]}];}_0x2c6255=_['merge']({},_0x2c6255,_0x47a9b3[_0xb26e('0x4d')]);return db['WhatsappAccount'][_0xb26e('0x55')](_0x2c6255)[_0xb26e('0x1f')](handleEntityNotFound(_0x346ed1,null))[_0xb26e('0x1f')](respondWithResult(_0x346ed1,null))[_0xb26e('0x28')](handleError(_0x346ed1,null));};exports[_0xb26e('0x56')]=function(_0x4c74ee,_0x1ea16d){return db['WhatsappAccount']['create'](_0x4c74ee[_0xb26e('0x57')],{})[_0xb26e('0x1f')](function(_0x3b8c58){var _0x119645=_0x4c74ee['user'][_0xb26e('0x34')]({'plain':!![]});if(!_0x119645)throw new Error(_0xb26e('0x58'));if(_0x119645[_0xb26e('0x59')]===_0xb26e('0x5a')){var _0x40720f=_0x3b8c58[_0xb26e('0x34')]({'plain':!![]});var _0x577dfe=_0xb26e('0x35');return db[_0xb26e('0x5b')][_0xb26e('0x55')]({'where':{'name':_0x577dfe,'userProfileId':_0x119645[_0xb26e('0x5c')]},'raw':!![]})[_0xb26e('0x1f')](function(_0x2c857f){if(_0x2c857f&&_0x2c857f[_0xb26e('0x5d')]===0x0){return db[_0xb26e('0x5e')][_0xb26e('0x56')]({'name':_0x40720f[_0xb26e('0x37')],'resourceId':_0x40720f['id'],'type':_0x2c857f[_0xb26e('0x37')],'sectionId':_0x2c857f['id']},{})[_0xb26e('0x1f')](function(){return _0x3b8c58;});}else{return _0x3b8c58;}})[_0xb26e('0x28')](function(_0x41a859){logger['error'](_0xb26e('0x5f'),_0x41a859);throw _0x41a859;});}return _0x3b8c58;})[_0xb26e('0x1f')](respondWithResult(_0x1ea16d,0xc9))[_0xb26e('0x28')](handleError(_0x1ea16d,null));};exports[_0xb26e('0x60')]=function(_0x692761,_0x4938d7){if(_0x692761['body']['id']){delete _0x692761[_0xb26e('0x57')]['id'];}return db[_0xb26e('0x4e')][_0xb26e('0x55')]({'where':{'id':_0x692761[_0xb26e('0x61')]['id']},'include':[{'model':db[_0xb26e('0x54')],'as':'mandatoryDispositionPause'}]})[_0xb26e('0x1f')](handleEntityNotFound(_0x4938d7,null))[_0xb26e('0x1f')](saveUpdates(_0x692761[_0xb26e('0x57')],null))[_0xb26e('0x1f')](respondWithResult(_0x4938d7,null))[_0xb26e('0x28')](handleError(_0x4938d7,null));};exports[_0xb26e('0x62')]=function(_0x54fa53,_0x3e282b){return db[_0xb26e('0x4e')][_0xb26e('0x55')]({'where':{'id':_0x54fa53[_0xb26e('0x61')]['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x3e282b,null))[_0xb26e('0x1f')](removeEntity(_0x3e282b,null))['catch'](handleError(_0x3e282b,null));};exports[_0xb26e('0x63')]=function(_0x3e582a,_0x483933){return db[_0xb26e('0x4e')]['describe']()[_0xb26e('0x1f')](respondWithResult(_0x483933,null))[_0xb26e('0x28')](handleError(_0x483933,null));};exports[_0xb26e('0x64')]=function(_0x3971d6,_0x1a5586,_0x37b894){if(_0x3971d6['body']['id']){delete _0x3971d6[_0xb26e('0x57')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x3971d6['params']['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x1a5586,null))[_0xb26e('0x1f')](function(_0x2b5c56){if(_0x2b5c56){_0x3971d6['body'][_0xb26e('0x65')]=_0x2b5c56['id'];return db[_0xb26e('0x66')][_0xb26e('0x56')](_0x3971d6[_0xb26e('0x57')]);}})['then'](respondWithResult(_0x1a5586,null))[_0xb26e('0x28')](handleError(_0x1a5586,null));};exports[_0xb26e('0x67')]=function(_0x2074fc,_0x49f2a5,_0x3dd1e0){var _0x537d64={'raw':![],'where':{}};var _0x564fd5={};var _0x57342f={'count':0x0,'rows':[]};return db[_0xb26e('0x4e')][_0xb26e('0x68')]({'where':{'id':_0x2074fc[_0xb26e('0x61')]['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x49f2a5,null))[_0xb26e('0x1f')](function(_0x207729){if(_0x207729){_0x564fd5[_0xb26e('0x3e')]=_[_0xb26e('0x40')](db[_0xb26e('0x66')]['rawAttributes']);_0x564fd5[_0xb26e('0x3f')]=_['keys'](_0x2074fc[_0xb26e('0x3f')]);_0x564fd5[_0xb26e('0x49')]=_[_0xb26e('0x41')](_0x564fd5[_0xb26e('0x3e')],_0x564fd5[_0xb26e('0x3f')]);_0x537d64[_0xb26e('0x42')]=_[_0xb26e('0x41')](_0x564fd5[_0xb26e('0x3e')],qs[_0xb26e('0x43')](_0x2074fc['query'][_0xb26e('0x43')]));_0x537d64['attributes']=_0x537d64[_0xb26e('0x42')][_0xb26e('0x44')]?_0x537d64[_0xb26e('0x42')]:_0x564fd5[_0xb26e('0x3e')];if(!_0x2074fc['query'][_0xb26e('0x45')](_0xb26e('0x46'))){_0x537d64[_0xb26e('0x30')]=qs[_0xb26e('0x30')](_0x2074fc[_0xb26e('0x3f')]['limit']);_0x537d64[_0xb26e('0x2d')]=qs['offset'](_0x2074fc[_0xb26e('0x3f')][_0xb26e('0x2d')]);}_0x537d64[_0xb26e('0x69')]=qs[_0xb26e('0x47')](_0x2074fc[_0xb26e('0x3f')][_0xb26e('0x47')]);_0x537d64[_0xb26e('0x48')]=qs[_0xb26e('0x49')](_[_0xb26e('0x6a')](_0x2074fc[_0xb26e('0x3f')],_0x564fd5[_0xb26e('0x49')]));_0x537d64[_0xb26e('0x48')][_0xb26e('0x65')]=_0x207729['id'];if(_0x2074fc[_0xb26e('0x3f')][_0xb26e('0x4a')]){_0x537d64[_0xb26e('0x48')]=_[_0xb26e('0x4b')](_0x537d64[_0xb26e('0x48')],{'$or':_[_0xb26e('0x3a')](_0x537d64[_0xb26e('0x42')],function(_0x2b7439){var _0x2ed4c5={};_0x2ed4c5[_0x2b7439]={'$like':'%'+_0x2074fc['query']['filter']+'%'};return _0x2ed4c5;})});}_0x537d64=_['merge']({},_0x537d64,_0x2074fc['options']);return db[_0xb26e('0x66')][_0xb26e('0x2f')]({'where':_0x537d64[_0xb26e('0x48')]})[_0xb26e('0x1f')](function(_0x13c157){_0x57342f['count']=_0x13c157;if(_0x2074fc[_0xb26e('0x3f')][_0xb26e('0x4f')]){_0x537d64['include']=[{'all':!![]}];}return db[_0xb26e('0x66')]['findAll'](_0x537d64);})[_0xb26e('0x1f')](function(_0x5e9819){_0x57342f['rows']=_0x5e9819;return _0x57342f;});}})['then'](respondWithFilteredResult(_0x49f2a5,_0x537d64))['catch'](handleError(_0x49f2a5,null));};exports[_0xb26e('0x6b')]=function(_0x55c428,_0x5882fd,_0x4889bc){return db['WhatsappAccount'][_0xb26e('0x55')]({'where':{'id':_0x55c428[_0xb26e('0x61')]['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x5882fd,null))[_0xb26e('0x1f')](function(_0x3bf174){if(_0x3bf174){return _0x3bf174['removeDispositions'](_0x55c428['query']['ids']);}})['then'](respondWithStatusCode(_0x5882fd,null))[_0xb26e('0x28')](handleError(_0x5882fd,null));};exports['addAnswer']=function(_0x564e54,_0x459d8,_0x56e954){if(_0x564e54[_0xb26e('0x57')]['id']){delete _0x564e54[_0xb26e('0x57')]['id'];}return db[_0xb26e('0x4e')][_0xb26e('0x55')]({'where':{'id':_0x564e54['params']['id']}})['then'](handleEntityNotFound(_0x459d8,null))[_0xb26e('0x1f')](function(_0x3687f6){if(_0x3687f6){_0x564e54['body']['WhatsappAccountId']=_0x3687f6['id'];return db['CannedAnswer'][_0xb26e('0x56')](_0x564e54[_0xb26e('0x57')]);}})['then'](respondWithResult(_0x459d8,null))[_0xb26e('0x28')](handleError(_0x459d8,null));};exports[_0xb26e('0x6c')]=function(_0x1d1598,_0x15746f,_0x29be92){var _0x31e122={'raw':![],'where':{}};var _0xebdb24={};var _0x205f4c={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xb26e('0x68')]({'where':{'id':_0x1d1598[_0xb26e('0x61')]['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x15746f,null))['then'](function(_0x45829a){if(_0x45829a){_0xebdb24[_0xb26e('0x3e')]=_[_0xb26e('0x40')](db[_0xb26e('0x6d')]['rawAttributes']);_0xebdb24[_0xb26e('0x3f')]=_[_0xb26e('0x40')](_0x1d1598['query']);_0xebdb24[_0xb26e('0x49')]=_[_0xb26e('0x41')](_0xebdb24['model'],_0xebdb24[_0xb26e('0x3f')]);_0x31e122[_0xb26e('0x42')]=_['intersection'](_0xebdb24['model'],qs[_0xb26e('0x43')](_0x1d1598['query'][_0xb26e('0x43')]));_0x31e122['attributes']=_0x31e122[_0xb26e('0x42')][_0xb26e('0x44')]?_0x31e122[_0xb26e('0x42')]:_0xebdb24['model'];if(!_0x1d1598[_0xb26e('0x3f')][_0xb26e('0x45')](_0xb26e('0x46'))){_0x31e122[_0xb26e('0x30')]=qs['limit'](_0x1d1598['query'][_0xb26e('0x30')]);_0x31e122[_0xb26e('0x2d')]=qs['offset'](_0x1d1598[_0xb26e('0x3f')]['offset']);}_0x31e122[_0xb26e('0x69')]=qs[_0xb26e('0x47')](_0x1d1598[_0xb26e('0x3f')][_0xb26e('0x47')]);_0x31e122['where']=qs['filters'](_[_0xb26e('0x6a')](_0x1d1598[_0xb26e('0x3f')],_0xebdb24[_0xb26e('0x49')]));_0x31e122['where'][_0xb26e('0x65')]=_0x45829a['id'];if(_0x1d1598['query'][_0xb26e('0x4a')]){_0x31e122[_0xb26e('0x48')]=_[_0xb26e('0x4b')](_0x31e122[_0xb26e('0x48')],{'$or':_[_0xb26e('0x3a')](_0x31e122[_0xb26e('0x42')],function(_0x57087f){var _0xeecbf0={};_0xeecbf0[_0x57087f]={'$like':'%'+_0x1d1598[_0xb26e('0x3f')][_0xb26e('0x4a')]+'%'};return _0xeecbf0;})});}_0x31e122=_['merge']({},_0x31e122,_0x1d1598['options']);return db[_0xb26e('0x6d')]['count']({'where':_0x31e122[_0xb26e('0x48')]})[_0xb26e('0x1f')](function(_0x2c0969){_0x205f4c['count']=_0x2c0969;if(_0x1d1598[_0xb26e('0x3f')][_0xb26e('0x4f')]){_0x31e122['include']=[{'all':!![]}];}return db[_0xb26e('0x6d')][_0xb26e('0x51')](_0x31e122);})[_0xb26e('0x1f')](function(_0x53e3d6){_0x205f4c['rows']=_0x53e3d6;return _0x205f4c;});}})['then'](respondWithFilteredResult(_0x15746f,_0x31e122))['catch'](handleError(_0x15746f,null));};exports[_0xb26e('0x6e')]=function(_0x143269,_0x1ae4bf,_0x2b4c01){return db[_0xb26e('0x4e')][_0xb26e('0x55')]({'where':{'id':_0x143269[_0xb26e('0x61')]['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x1ae4bf,null))['then'](function(_0x4b47f1){if(_0x4b47f1){return _0x4b47f1[_0xb26e('0x6e')](_0x143269[_0xb26e('0x3f')][_0xb26e('0x6f')]);}})[_0xb26e('0x1f')](respondWithStatusCode(_0x1ae4bf,null))['catch'](handleError(_0x1ae4bf,null));};exports[_0xb26e('0x70')]=function(_0x33788d,_0xed3984,_0x32f68b){return db[_0xb26e('0x4e')]['find']({'where':{'id':_0x33788d[_0xb26e('0x61')]['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0xed3984,null))[_0xb26e('0x1f')](function(_0x536247){if(_0x536247){return _0x536247[_0xb26e('0x70')](_0x33788d['body']['ids'],_['omit'](_0x33788d[_0xb26e('0x57')],[_0xb26e('0x6f'),'id'])||{})[_0xb26e('0x71')](function(_0x1af292){for(var _0x2a24d9=0x0;_0x2a24d9<_0x33788d[_0xb26e('0x57')]['ids'][_0xb26e('0x44')];_0x2a24d9+=0x1){socket['emit'](_0xb26e('0x72'),{'UserId':Number(_0x33788d[_0xb26e('0x57')]['ids'][_0x2a24d9]),'WhatsappAccountId':Number(_0x33788d[_0xb26e('0x61')]['id'])});}return _0x1af292;});}})[_0xb26e('0x1f')](respondWithResult(_0xed3984,null))[_0xb26e('0x28')](handleError(_0xed3984,null));};exports[_0xb26e('0x73')]=function(_0xfb90e,_0x2ae4b2,_0xd409ee){return db[_0xb26e('0x4e')][_0xb26e('0x55')]({'where':{'id':_0xfb90e['params']['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x2ae4b2,null))[_0xb26e('0x1f')](function(_0x2ba3b3){if(_0x2ba3b3){return _0x2ba3b3[_0xb26e('0x73')](_0xfb90e['query'][_0xb26e('0x6f')])[_0xb26e('0x1f')](function(){if(_[_0xb26e('0x74')](_0xfb90e[_0xb26e('0x3f')][_0xb26e('0x6f')])){for(var _0x2062de=0x0;_0x2062de<_0xfb90e['query'][_0xb26e('0x6f')][_0xb26e('0x44')];_0x2062de+=0x1){socket[_0xb26e('0x75')](_0xb26e('0x76'),{'UserId':Number(_0xfb90e[_0xb26e('0x3f')][_0xb26e('0x6f')][_0x2062de]),'WhatsappAccountId':Number(_0xfb90e[_0xb26e('0x61')]['id'])});}}else{socket[_0xb26e('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0xfb90e['query'][_0xb26e('0x6f')]),'WhatsappAccountId':Number(_0xfb90e['params']['id'])});}});}})[_0xb26e('0x1f')](respondWithStatusCode(_0x2ae4b2,null))[_0xb26e('0x28')](handleError(_0x2ae4b2,null));};exports['getAgents']=function(_0x2be014,_0x29d22e,_0x10912f){var _0x62359f={};var _0x5a558c={};var _0x171114;var _0x278797;return db['WhatsappAccount'][_0xb26e('0x68')]({'where':{'id':_0x2be014['params']['id']}})['then'](handleEntityNotFound(_0x29d22e,null))['then'](function(_0x428031){if(_0x428031){_0x171114=_0x428031;_0x5a558c[_0xb26e('0x3e')]=_[_0xb26e('0x40')](db[_0xb26e('0x77')]['rawAttributes']);_0x5a558c['query']=_[_0xb26e('0x40')](_0x2be014['query']);_0x5a558c['filters']=_[_0xb26e('0x41')](_0x5a558c[_0xb26e('0x3e')],_0x5a558c[_0xb26e('0x3f')]);_0x62359f[_0xb26e('0x42')]=_['intersection'](_0x5a558c[_0xb26e('0x3e')],qs[_0xb26e('0x43')](_0x2be014['query']['fields']));_0x62359f['attributes']=_0x62359f[_0xb26e('0x42')][_0xb26e('0x44')]?_0x62359f[_0xb26e('0x42')]:_0x5a558c[_0xb26e('0x3e')];_0x62359f[_0xb26e('0x69')]=qs[_0xb26e('0x47')](_0x2be014['query'][_0xb26e('0x47')]);_0x62359f[_0xb26e('0x48')]=qs[_0xb26e('0x49')](_['pick'](_0x2be014[_0xb26e('0x3f')],_0x5a558c[_0xb26e('0x49')]));if(_0x2be014[_0xb26e('0x3f')]['filter']){_0x62359f[_0xb26e('0x48')]=_[_0xb26e('0x4b')](_0x62359f['where'],{'$or':_[_0xb26e('0x3a')](_0x62359f[_0xb26e('0x42')],function(_0x190355){var _0x4c73b7={};_0x4c73b7[_0x190355]={'$like':'%'+_0x2be014[_0xb26e('0x3f')]['filter']+'%'};return _0x4c73b7;})});}_0x62359f=_[_0xb26e('0x4b')]({},_0x62359f,_0x2be014[_0xb26e('0x4d')]);return _0x171114[_0xb26e('0x78')](_0x62359f);}})['then'](function(_0x4e0985){if(_0x4e0985){_0x278797=_0x4e0985[_0xb26e('0x44')];if(!_0x2be014['query'][_0xb26e('0x45')](_0xb26e('0x46'))){_0x62359f['limit']=qs['limit'](_0x2be014[_0xb26e('0x3f')][_0xb26e('0x30')]);_0x62359f['offset']=qs[_0xb26e('0x2d')](_0x2be014[_0xb26e('0x3f')][_0xb26e('0x2d')]);}return _0x171114['getAgents'](_0x62359f);}})['then'](function(_0x3c668f){if(_0x3c668f){return _0x3c668f?{'count':_0x278797,'rows':_0x3c668f}:null;}})[_0xb26e('0x1f')](respondWithResult(_0x29d22e,null))[_0xb26e('0x28')](handleError(_0x29d22e,null));};exports[_0xb26e('0x79')]=function(_0x478b65,_0x5aa08f){var _0x3b95e4=_0x478b65['params']['id'];var _0x389c35=_0x478b65[_0xb26e('0x57')];var _0x388dbb=0xc8;var _0x4a0115=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xb26e('0x7a')]['Transaction'][_0xb26e('0x7b')][_0xb26e('0x7c')]},function(_0x16279b){return db[_0xb26e('0x4e')][_0xb26e('0x68')]({'where':{'id':_0x3b95e4},'transaction':_0x16279b})['then'](function(_0x792c5){if(_0x792c5){return db[_0xb26e('0x7d')][_0xb26e('0x62')]({'where':{'WhatsappAccountId':_0x3b95e4},'transaction':_0x16279b})[_0xb26e('0x1f')](function(){var _0x24764b=_[_0xb26e('0x3a')](_0x389c35,function(_0x3a4635){_0x3a4635['WhatsappAccountId']=_0x3b95e4;return _0x3a4635;});return db[_0xb26e('0x7d')][_0xb26e('0x7e')](_0x24764b,{'transaction':_0x16279b});});}else{_0x388dbb=0x194;_0x4a0115=[];}});})[_0xb26e('0x1f')](function(){if(_0x388dbb!==0x194){return db[_0xb26e('0x7d')][_0xb26e('0x7f')]({'where':{'WhatsappAccountId':_0x3b95e4},'order':_0xb26e('0x80')})['then'](function(_0x469c29){_0x4a0115=_0x469c29;});}})[_0xb26e('0x28')](function(_0x33f1c9){_0x388dbb=0x1f4;logger[_0xb26e('0x24')](_0x33f1c9[_0xb26e('0x36')]);if(_0x33f1c9[_0xb26e('0x37')]){delete _0x33f1c9['name'];}_0x4a0115=_0x33f1c9;})[_0xb26e('0x81')](function(){if(_0x4a0115===null){_0x5aa08f[_0xb26e('0x29')](_0x388dbb);}else{if(_0x388dbb===0x1f4){_0x5aa08f[_0xb26e('0x2a')](_0x388dbb)['send'](_0x4a0115);}else{_0x5aa08f[_0xb26e('0x2a')](_0x388dbb)['json'](_0x4a0115);}}});};exports['getApplications']=function(_0x125fdc,_0x402c70,_0x3ee768){var _0x3c8d21={};var _0xdfd6d3={};var _0x2d4bf8;var _0x1fa06e;return db[_0xb26e('0x4e')][_0xb26e('0x68')]({'where':{'id':_0x125fdc[_0xb26e('0x61')]['id']}})[_0xb26e('0x1f')](handleEntityNotFound(_0x402c70,null))['then'](function(_0xc0c09b){if(_0xc0c09b){_0x2d4bf8=_0xc0c09b;_0xdfd6d3['model']=_['keys'](db['WhatsappApplication'][_0xb26e('0x3b')]);_0xdfd6d3[_0xb26e('0x3f')]=_['keys'](_0x125fdc[_0xb26e('0x3f')]);_0xdfd6d3['filters']=_[_0xb26e('0x41')](_0xdfd6d3[_0xb26e('0x3e')],_0xdfd6d3['query']);_0x3c8d21[_0xb26e('0x42')]=_[_0xb26e('0x41')](_0xdfd6d3[_0xb26e('0x3e')],qs[_0xb26e('0x43')](_0x125fdc[_0xb26e('0x3f')]['fields']));_0x3c8d21[_0xb26e('0x42')]=_0x3c8d21[_0xb26e('0x42')][_0xb26e('0x44')]?_0x3c8d21[_0xb26e('0x42')]:_0xdfd6d3[_0xb26e('0x3e')];_0x3c8d21[_0xb26e('0x69')]=qs[_0xb26e('0x47')](_0x125fdc[_0xb26e('0x3f')]['sort']);_0x3c8d21[_0xb26e('0x48')]=qs[_0xb26e('0x49')](_[_0xb26e('0x6a')](_0x125fdc['query'],_0xdfd6d3[_0xb26e('0x49')]));if(_0x125fdc['query'][_0xb26e('0x4a')]){_0x3c8d21['where']=_[_0xb26e('0x4b')](_0x3c8d21[_0xb26e('0x48')],{'$or':_[_0xb26e('0x3a')](_0x3c8d21[_0xb26e('0x42')],function(_0x41e5e1){var _0xce2aa3={};_0xce2aa3[_0x41e5e1]={'$like':'%'+_0x125fdc['query']['filter']+'%'};return _0xce2aa3;})});}_0x3c8d21=_[_0xb26e('0x4b')]({},_0x3c8d21,_0x125fdc['options']);return _0x2d4bf8['getApplications'](_0x3c8d21);}})[_0xb26e('0x1f')](function(_0x4c2576){if(_0x4c2576){_0x1fa06e=_0x4c2576[_0xb26e('0x44')];if(!_0x125fdc[_0xb26e('0x3f')][_0xb26e('0x45')](_0xb26e('0x46'))){_0x3c8d21[_0xb26e('0x30')]=qs[_0xb26e('0x30')](_0x125fdc[_0xb26e('0x3f')][_0xb26e('0x30')]);_0x3c8d21[_0xb26e('0x2d')]=qs[_0xb26e('0x2d')](_0x125fdc['query'][_0xb26e('0x2d')]);}return _0x2d4bf8[_0xb26e('0x82')](_0x3c8d21);}})[_0xb26e('0x1f')](function(_0xff3948){if(_0xff3948){return _0xff3948?{'count':_0x1fa06e,'rows':_0xff3948}:null;}})[_0xb26e('0x1f')](respondWithResult(_0x402c70,null))[_0xb26e('0x28')](handleError(_0x402c70,null));};exports[_0xb26e('0x83')]=function(_0x15da03,_0x57fb37,_0x199cbd){var _0x55a764={'channel':_0xb26e('0x84')};var _0x941047=[];var _0x4672a4=[];var _0x5cc04e={};return db[_0xb26e('0x4e')][_0xb26e('0x55')]({'where':{'id':_0x15da03['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xb26e('0x85')}]})[_0xb26e('0x1f')](handleEntityNotFound(_0x57fb37,null))[_0xb26e('0x1f')](function(_0x2aa4f5){_0x55a764[_0xb26e('0x86')]=_0x2aa4f5;if(_0x55a764[_0xb26e('0x86')]&&_0x55a764['account']['type']===_0xb26e('0x87')&&_0x15da03[_0xb26e('0x57')][_0xb26e('0x88')]){if(_0x15da03[_0xb26e('0x57')][_0xb26e('0x88')][_0xb26e('0x44')]===0x0)return;if(_0x15da03[_0xb26e('0x57')][_0xb26e('0x88')][0x0]['state']!==_0xb26e('0x89'))return;return db[_0xb26e('0x8a')][_0xb26e('0x60')]({'read':!![],'readAt':_0x15da03[_0xb26e('0x57')][_0xb26e('0x88')][0x0][_0xb26e('0x8b')]},{'where':{'messageId':_0x15da03[_0xb26e('0x57')][_0xb26e('0x88')][0x0]['message_id']},'individualHooks':!![]})[_0xb26e('0x1f')](function(_0x4a7f0c){return _0x57fb37['status'](0xc8)[_0xb26e('0x2c')](_0x4a7f0c);});}_0x55a764[_0xb26e('0x8c')]=_[_0xb26e('0x8d')](_0x2aa4f5[_0xb26e('0x85')],[_0xb26e('0x80')],[_0xb26e('0x8e')]);if(_0x55a764[_0xb26e('0x86')][_0xb26e('0x85')]){delete _0x55a764['account']['Applications'];}return db[_0xb26e('0x8f')][_0xb26e('0x63')]()[_0xb26e('0x1f')](function(_0x38a8b0){if(!_0x38a8b0){throw new db[(_0xb26e('0x90'))][(_0xb26e('0x91'))](_0xb26e('0x92'));}_0x941047=_[_0xb26e('0x93')](_['keys'](_0x38a8b0),[_0xb26e('0x94'),_0xb26e('0x95')]);_0x4672a4=_['difference'](_[_0xb26e('0x40')](_0x38a8b0),[_0xb26e('0x94'),_0xb26e('0x95'),_0xb26e('0x96'),_0xb26e('0x97')]);_0x55a764[_0xb26e('0x57')]={'mapKey':_0xb26e('0x98')};if(_0x55a764[_0xb26e('0x86')]&&_0x55a764['account']['type']===_0xb26e('0x99')){_0x55a764[_0xb26e('0x57')][_0xb26e('0x9a')]=_0x15da03['body'][_0xb26e('0x9b')]['replace'](_0xb26e('0x9c'),'');_0x55a764['body'][_0xb26e('0x57')]=_0x15da03[_0xb26e('0x57')][_0xb26e('0x9d')];_0x55a764[_0xb26e('0x57')]['messageId']=_0x15da03[_0xb26e('0x57')]['MessageSid'];}if(_0x55a764[_0xb26e('0x86')]&&_0x55a764[_0xb26e('0x86')][_0xb26e('0x3d')]===_0xb26e('0x87')){_0x55a764[_0xb26e('0x57')][_0xb26e('0x9a')]=_0x15da03['body']['notifications'][0x0][_0xb26e('0x9a')];_0x55a764[_0xb26e('0x57')][_0xb26e('0x57')]=_0x15da03[_0xb26e('0x57')][_0xb26e('0x9e')][0x0][_0xb26e('0x25')]['body'];_0x55a764[_0xb26e('0x57')][_0xb26e('0x9f')]=_0x15da03['body'][_0xb26e('0x9e')][0x0]['message_id'];}if(_0x55a764[_0xb26e('0x57')]['id']){delete _0x55a764['body']['id'];}if(_[_0xb26e('0xa0')](_0x55a764[_0xb26e('0x57')][_0xb26e('0x9a')])){throw new db[(_0xb26e('0x90'))][(_0xb26e('0x91'))](_0xb26e('0xa1'));}if(_[_0xb26e('0xa0')](_0x55a764['body'][_0xb26e('0x57')])||_0x55a764['body']['body']===''){throw new db[(_0xb26e('0x90'))][(_0xb26e('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb26e('0xa0')](_0x55a764[_0xb26e('0x57')][_0xb26e('0xa2')])){throw new db['Sequelize']['ValidationError'](_0xb26e('0xa3')+_0x4672a4);}if(!_['includes'](_0x4672a4,_0x55a764[_0xb26e('0x57')][_0xb26e('0xa2')])){throw new db[(_0xb26e('0x90'))][(_0xb26e('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4672a4);}_0x5cc04e[_0x55a764[_0xb26e('0x57')][_0xb26e('0xa2')]]=_0x55a764[_0xb26e('0x57')][_0xb26e('0x9a')];return db[_0xb26e('0xa4')][_0xb26e('0x55')]({'where':{'id':_0x55a764[_0xb26e('0x86')][_0xb26e('0x97')]},'include':[{'model':db[_0xb26e('0x8f')],'as':_0xb26e('0xa5'),'where':_0x5cc04e,'limit':0x1,'order':[[_0xb26e('0x95'),'DESC']]}]});})[_0xb26e('0x1f')](handleEntityNotFound(_0x57fb37,null))['then'](function(_0x196d8d){if(_0x196d8d){_0x55a764[_0xb26e('0xa6')]=_[_0xb26e('0xa7')](_0x196d8d,[_0xb26e('0xa5')]);if(_0x196d8d['Contacts'][_0xb26e('0x44')]){return _0x196d8d[_0xb26e('0xa5')][0x0];}var _0x1c2f46=_[_0xb26e('0x17')](_0x55a764['body'],{'firstName':_0x55a764[_0xb26e('0x57')][_0xb26e('0x9a')],'ListId':_0x196d8d['id']});_0x1c2f46[_0x55a764[_0xb26e('0x57')][_0xb26e('0xa2')]]=_0x55a764[_0xb26e('0x57')][_0xb26e('0x9a')];return db[_0xb26e('0x8f')][_0xb26e('0x56')](_0x1c2f46,{'fields':_0x941047,'raw':!![]});}})['then'](handleEntityNotFound(_0x57fb37,null))[_0xb26e('0x1f')](function(_0x7bba3f){if(_0x7bba3f){_0x55a764[_0xb26e('0xa8')]=_0x7bba3f;var _0x1bb4e9={'ContactId':_0x7bba3f['id'],'phone':_0x55a764['body'][_0xb26e('0x9a')],'WhatsappAccountId':_0x15da03[_0xb26e('0x61')]['id']};var _0x5bb2c4={'ContactId':_0x7bba3f['id'],'WhatsappAccountId':_0x15da03['params']['id'],'closed':![]};return db[_0xb26e('0xa9')][_0xb26e('0x55')]({'where':_0x5bb2c4})[_0xb26e('0x1f')](function(_0x149c3b){if(_0x149c3b){return[_0x149c3b,![]];}return db[_0xb26e('0xa9')][_0xb26e('0x56')](_0x1bb4e9)['then'](function(_0x13d520){return[_0x13d520,!![]];});});}})[_0xb26e('0x71')](function(_0x10ed9e,_0x29a287){_0x55a764[_0xb26e('0xaa')]=_0x10ed9e[_0xb26e('0x34')]({'plain':!![]});_0x55a764[_0xb26e('0xaa')][_0xb26e('0xab')]=![];if(_0x29a287){if(_0x55a764[_0xb26e('0x86')][_0xb26e('0xac')]){_0x55a764[_0xb26e('0x8c')][_0xb26e('0xad')]({'id':0x0,'priority':_0x55a764['applications'][_0xb26e('0x44')]+0x1,'app':_0xb26e('0xae'),'appdata':_0xb26e('0xaf'),'interval':_0xb26e('0xb0')});}_0x55a764[_0xb26e('0xaa')]['created']=!![];}return db[_0xb26e('0x8a')][_0xb26e('0x56')]({'phone':_0x55a764[_0xb26e('0x57')]['from'],'messageId':_0x55a764[_0xb26e('0x57')][_0xb26e('0x9f')],'body':_0x55a764['body']['body'],'WhatsappAccountId':_0x15da03[_0xb26e('0x61')]['id'],'WhatsappInteractionId':_0x10ed9e['id'],'direction':'in','ContactId':_0x10ed9e[_0xb26e('0xb1')],'AttachmentId':_0x55a764[_0xb26e('0x57')][_0xb26e('0xb2')]});})[_0xb26e('0x1f')](function(_0x18307d){_0x55a764[_0xb26e('0x25')]=_0x18307d;if(_0x55a764[_0xb26e('0xaa')]['UserId']){return db[_0xb26e('0x77')][_0xb26e('0x55')]({'attributes':['id',_0xb26e('0x37')],'where':{'id':_0x55a764[_0xb26e('0xaa')]['UserId']}})[_0xb26e('0x1f')](function(_0x15e2d4){if(_0x15e2d4){_0x55a764[_0xb26e('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb26e('0xb3'),'appdata':_0x15e2d4[_0xb26e('0x37')]+','+(_0x55a764['account'][_0xb26e('0xb4')]||0xa),'interval':_0xb26e('0xb0')});}return respondWithRpcPromise(_0xb26e('0xb5'),_0xb26e('0xb6'),_0x55a764);});}return respondWithRpcPromise(_0xb26e('0xb5'),_0xb26e('0xb6'),_0x55a764);})[_0xb26e('0x1f')](function(_0x54a94c){if(_0x54a94c){var _0x303154=0xc8;var _0x1fdb6e=_0xb26e('0xb7');logger[_0xb26e('0x20')](_0xb26e('0x21'),_0x1fdb6e,_0x303154,_0xb26e('0xb8'));logger[_0xb26e('0xb9')](_0xb26e('0xba'),_0x1fdb6e,_0x303154,'entity\x20found',JSON[_0xb26e('0x23')](_0x54a94c));if(_0x55a764[_0xb26e('0x86')][_0xb26e('0x3d')]===_0xb26e('0x99')){return _0x57fb37['status'](_0x303154)[_0xb26e('0x31')](_0xb26e('0xbb'),_0xb26e('0xbc'))[_0xb26e('0x38')](_0xb26e('0xbd'));}else{return _0x57fb37[_0xb26e('0x2a')](_0x303154)['json'](_0x54a94c);}}});})[_0xb26e('0x28')](handleError(_0x57fb37,null));};exports['send']=function(_0x176b04,_0x377540,_0xf45b0e){var _0xc07732,_0xc3d12a,_0x2bb0e1;if(_[_0xb26e('0xa0')](_0x176b04[_0xb26e('0x57')][_0xb26e('0x57')])||_0x176b04['body'][_0xb26e('0x57')]===''){throw new db['Sequelize'][(_0xb26e('0x91'))](_0xb26e('0xbe'));}if(_['isNil'](_0x176b04[_0xb26e('0x57')]['to'])){throw new db[(_0xb26e('0x90'))][(_0xb26e('0x91'))]('to\x20is\x20mandatory');}_0xc07732=_0x176b04[_0xb26e('0x57')]['to'];return db[_0xb26e('0x4e')][_0xb26e('0x55')]({'where':{'id':_0x176b04['params']['id']},'include':[{'model':db[_0xb26e('0xa4')],'as':_0xb26e('0xbf'),'include':[{'model':db[_0xb26e('0x8f')],'as':_0xb26e('0xa5'),'where':{'mobile':_0xc07732},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x377540,null))[_0xb26e('0x1f')](function(_0x18fdfa){if(_0x18fdfa&&_0x18fdfa[_0xb26e('0xbf')]){_0xc3d12a=_0x18fdfa[_0xb26e('0x34')]({'plain':!![]});if(_0xc3d12a['List']&&_0xc3d12a['List']['Contacts'][_0xb26e('0x44')]){return _0xc3d12a[_0xb26e('0xbf')]['Contacts'][0x0];}return db['CmContact'][_0xb26e('0x56')](_[_0xb26e('0x17')](_0x176b04[_0xb26e('0x57')],{'firstName':_0xc07732,'mobile':_0xc07732,'phone':_0xc07732,'ListId':_0xc3d12a[_0xb26e('0x97')]}));}})[_0xb26e('0x1f')](handleEntityNotFound(_0x377540,null))[_0xb26e('0x1f')](function(_0x21a44a){if(_0x21a44a){_0x2bb0e1=_0x21a44a;return db[_0xb26e('0xa9')][_0xb26e('0x55')]({'where':{'ContactId':_0x2bb0e1['id'],'closed':![],'WhatsappAccountId':_0xc3d12a['id']}})[_0xb26e('0x1f')](function(_0x4c6f15){if(_0x4c6f15){return[_0x4c6f15,![]];}return db[_0xb26e('0xa9')][_0xb26e('0x56')]({'UserId':_0x176b04[_0xb26e('0x5a')]['id'],'ContactId':_0x2bb0e1['id'],'WhatsappAccountId':_0xc3d12a['id'],'phone':_0xc07732,'firstMsgDirection':_0xb26e('0xc0'),'Messages':[_[_0xb26e('0x4b')](_0x176b04[_0xb26e('0x57')],{'read':![],'body':_0x176b04['body']['body'],'phone':_0xc07732,'WhatsappAccountId':_0xc3d12a['id'],'UserId':_0x176b04[_0xb26e('0x5a')]['id'],'ContactId':_0x2bb0e1['id']})]},{'include':[{'model':db[_0xb26e('0x8a')],'as':_0xb26e('0xc1')}]})['then'](function(_0x41f2da){return[_0x41f2da,!![]];});});}})[_0xb26e('0x71')](function(_0x5b6f83,_0x566a55){if(_0x566a55){return _0x5b6f83;}return db['WhatsappMessage'][_0xb26e('0x56')](_['merge'](_0x176b04[_0xb26e('0x57')],{'read':![],'body':_0x176b04[_0xb26e('0x57')][_0xb26e('0x57')],'phone':_0xc07732,'WhatsappAccountId':_0xc3d12a['id'],'WhatsappInteractionId':_0x5b6f83['id'],'UserId':_0x176b04[_0xb26e('0x5a')]['id'],'ContactId':_0x2bb0e1['id']}))[_0xb26e('0x1f')](function(_0x2dd811){_0x5b6f83['dataValues'][_0xb26e('0xc1')]=[];_0x5b6f83[_0xb26e('0xc2')][_0xb26e('0xc1')][_0xb26e('0xad')](_0x2dd811[_0xb26e('0xc2')]);return _0x5b6f83;});})[_0xb26e('0x1f')](respondWithResult(_0x377540,null))[_0xb26e('0x28')](handleError(_0x377540,null));}; \ No newline at end of file +var _0x5052=['\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','name','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','WhatsappAccount','includeAll','include','show','params','mandatoryDispositionPause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','interaction','UserId','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send'];(function(_0x5bf597,_0x4de812){var _0x13f5a3=function(_0x379ba7){while(--_0x379ba7){_0x5bf597['push'](_0x5bf597['shift']());}};_0x13f5a3(++_0x4de812);}(_0x5052,0x19d));var _0x2505=function(_0x28cef5,_0x5ed280){_0x28cef5=_0x28cef5-0x0;var _0x5b4cf3=_0x5052[_0x28cef5];return _0x5b4cf3;};'use strict';var emlformat=require(_0x2505('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2505('0x1'));var rp=require(_0x2505('0x2'));var moment=require(_0x2505('0x3'));var BPromise=require(_0x2505('0x4'));var Mustache=require(_0x2505('0x5'));var util=require(_0x2505('0x6'));var path=require(_0x2505('0x7'));var sox=require(_0x2505('0x8'));var csv=require(_0x2505('0x9'));var ejs=require(_0x2505('0xa'));var fs=require('fs');var fs_extra=require(_0x2505('0xb'));var _=require('lodash');var squel=require(_0x2505('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2505('0xd'));var toCsv=require(_0x2505('0x9'));var querystring=require('querystring');var Papa=require(_0x2505('0xe'));var Redis=require(_0x2505('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2505('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2505('0x11'))(_0x2505('0x12'));var utils=require(_0x2505('0x13'));var config=require(_0x2505('0x14'));var licenseUtil=require(_0x2505('0x15'));var db=require(_0x2505('0x16'))['db'];config[_0x2505('0x17')]=_[_0x2505('0x18')](config[_0x2505('0x17')],{'host':_0x2505('0x19'),'port':0x18eb});var socket=require(_0x2505('0x1a'))(new Redis(config[_0x2505('0x17')]));require(_0x2505('0x1b'))['register'](socket);var jayson=require(_0x2505('0x1c'));var client=jayson[_0x2505('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2454da,_0x1d3c8f,_0x3d06ca,_0x1246b4){return new BPromise(function(_0x45fd72,_0x502a9f){var _0x4bb3a8=_0x1246b4||client;return _0x4bb3a8[_0x2505('0x1e')](_0x2454da,_0x3d06ca)[_0x2505('0x1f')](function(_0x55998c){logger[_0x2505('0x20')](_0x2505('0x21'),_0x1d3c8f,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1d3c8f,_0x2505('0x22'),JSON[_0x2505('0x23')](_0x55998c));if(_0x55998c[_0x2505('0x24')]){if(_0x55998c['error'][_0x2505('0x25')]===0x1f4){logger[_0x2505('0x24')](_0x2505('0x21'),_0x1d3c8f,_0x55998c[_0x2505('0x24')][_0x2505('0x26')]);return _0x502a9f(_0x55998c[_0x2505('0x24')][_0x2505('0x26')]);}logger['error'](_0x2505('0x21'),_0x1d3c8f,_0x55998c[_0x2505('0x24')][_0x2505('0x26')]);return _0x45fd72(_0x55998c[_0x2505('0x24')]['message']);}else{logger[_0x2505('0x20')](_0x2505('0x21'),_0x1d3c8f,_0x2505('0x22'));_0x45fd72(_0x55998c[_0x2505('0x27')][_0x2505('0x26')]);}})[_0x2505('0x28')](function(_0x310b70){logger[_0x2505('0x24')](_0x2505('0x21'),_0x1d3c8f,_0x310b70);_0x502a9f(_0x310b70);});});}function respondWithStatusCode(_0x42cf10,_0x31b295){_0x31b295=_0x31b295||0xcc;return function(_0x414ffb){if(_0x414ffb){return _0x42cf10['sendStatus'](_0x31b295);}return _0x42cf10[_0x2505('0x29')](_0x31b295)[_0x2505('0x2a')]();};}function respondWithResult(_0x3cd4cb,_0x3c7ea8){_0x3c7ea8=_0x3c7ea8||0xc8;return function(_0x1c0dc1){if(_0x1c0dc1){return _0x3cd4cb[_0x2505('0x29')](_0x3c7ea8)[_0x2505('0x2b')](_0x1c0dc1);}};}function respondWithFilteredResult(_0x322cc7,_0x46e1ff){return function(_0x2f6e5f){if(_0x2f6e5f){var _0x93d94a=typeof _0x46e1ff[_0x2505('0x2c')]===_0x2505('0x2d')&&typeof _0x46e1ff['limit']==='undefined';var _0x3ae469=_0x2f6e5f[_0x2505('0x2e')];var _0x189d92=_0x93d94a?0x0:_0x46e1ff[_0x2505('0x2c')];var _0x4515f4=_0x93d94a?_0x2f6e5f['count']:_0x46e1ff[_0x2505('0x2c')]+_0x46e1ff[_0x2505('0x2f')];var _0x34bba5;if(_0x4515f4>=_0x3ae469){_0x4515f4=_0x3ae469;_0x34bba5=0xc8;}else{_0x34bba5=0xce;}_0x322cc7[_0x2505('0x29')](_0x34bba5);return _0x322cc7[_0x2505('0x30')](_0x2505('0x31'),_0x189d92+'-'+_0x4515f4+'/'+_0x3ae469)[_0x2505('0x2b')](_0x2f6e5f);}return null;};}function patchUpdates(_0x50a0c3){return function(_0x57c5d0){try{jsonpatch[_0x2505('0x32')](_0x57c5d0,_0x50a0c3,!![]);}catch(_0x3d52f9){return BPromise[_0x2505('0x33')](_0x3d52f9);}return _0x57c5d0[_0x2505('0x34')]();};}function saveUpdates(_0x195b90,_0x4b560c){return function(_0x3dde24){if(_0x3dde24){return _0x3dde24[_0x2505('0x35')](_0x195b90)[_0x2505('0x1f')](function(_0x2edb78){return _0x2edb78;});}return null;};}function removeEntity(_0x5dc552,_0x502c6f){return function(_0x28f4e4){if(_0x28f4e4){return _0x28f4e4[_0x2505('0x36')]()[_0x2505('0x1f')](function(){var _0x3bd503=_0x28f4e4[_0x2505('0x37')]({'plain':!![]});var _0x487e15=_0x2505('0x38');return db[_0x2505('0x39')][_0x2505('0x36')]({'where':{'type':_0x487e15,'resourceId':_0x3bd503['id']}})['then'](function(){return _0x28f4e4;});})[_0x2505('0x1f')](function(){_0x5dc552[_0x2505('0x29')](0xcc)[_0x2505('0x2a')]();});}};}function handleEntityNotFound(_0x22fbb8,_0x2a9dd5){return function(_0x1b59f2){if(!_0x1b59f2){_0x22fbb8[_0x2505('0x3a')](0x194);}return _0x1b59f2;};}function handleError(_0x247388,_0xdebd84){_0xdebd84=_0xdebd84||0x1f4;return function(_0x3d54de){logger[_0x2505('0x24')](_0x3d54de['stack']);if(_0x3d54de[_0x2505('0x3b')]){delete _0x3d54de['name'];}_0x247388[_0x2505('0x29')](_0xdebd84)['send'](_0x3d54de);};}exports['index']=function(_0x3ac8c1,_0x1440c7){var _0x37b0a6={'include':[{'model':db[_0x2505('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4d047f={},_0x10ec37={'count':0x0,'rows':[]};var _0x4799bb=_[_0x2505('0x3d')](db['WhatsappAccount'][_0x2505('0x3e')],function(_0x5c463f){return{'name':_0x5c463f[_0x2505('0x3f')],'type':_0x5c463f[_0x2505('0x40')][_0x2505('0x41')]};});_0x4d047f[_0x2505('0x42')]=_[_0x2505('0x3d')](_0x4799bb,_0x2505('0x3b'));_0x4d047f[_0x2505('0x43')]=_[_0x2505('0x44')](_0x3ac8c1[_0x2505('0x43')]);_0x4d047f[_0x2505('0x45')]=_['intersection'](_0x4d047f[_0x2505('0x42')],_0x4d047f[_0x2505('0x43')]);_0x37b0a6[_0x2505('0x46')]=_[_0x2505('0x47')](_0x4d047f[_0x2505('0x42')],qs['fields'](_0x3ac8c1[_0x2505('0x43')][_0x2505('0x48')]));_0x37b0a6[_0x2505('0x46')]=_0x37b0a6[_0x2505('0x46')][_0x2505('0x49')]?_0x37b0a6[_0x2505('0x46')]:_0x4d047f['model'];if(!_0x3ac8c1[_0x2505('0x43')][_0x2505('0x4a')](_0x2505('0x4b'))){_0x37b0a6['limit']=qs['limit'](_0x3ac8c1[_0x2505('0x43')]['limit']);_0x37b0a6[_0x2505('0x2c')]=qs[_0x2505('0x2c')](_0x3ac8c1[_0x2505('0x43')][_0x2505('0x2c')]);}_0x37b0a6[_0x2505('0x4c')]=qs['sort'](_0x3ac8c1['query'][_0x2505('0x4d')]);_0x37b0a6[_0x2505('0x4e')]=qs[_0x2505('0x45')](_['pick'](_0x3ac8c1['query'],_0x4d047f['filters']),_0x4799bb);if(_0x3ac8c1['query']['filter']){_0x37b0a6[_0x2505('0x4e')]=_[_0x2505('0x4f')](_0x37b0a6[_0x2505('0x4e')],{'$or':_[_0x2505('0x3d')](_0x4799bb,function(_0x456809){if(_0x456809[_0x2505('0x40')]!==_0x2505('0x50')){var _0x2f1b6d={};_0x2f1b6d[_0x456809[_0x2505('0x3b')]]={'$like':'%'+_0x3ac8c1['query'][_0x2505('0x51')]+'%'};return _0x2f1b6d;}})});}_0x37b0a6=_[_0x2505('0x4f')]({},_0x37b0a6,_0x3ac8c1[_0x2505('0x52')]);var _0x17898a={'where':_0x37b0a6[_0x2505('0x4e')]};return db[_0x2505('0x53')][_0x2505('0x2e')](_0x17898a)['then'](function(_0x994ec8){_0x10ec37[_0x2505('0x2e')]=_0x994ec8;if(_0x3ac8c1[_0x2505('0x43')][_0x2505('0x54')]){_0x37b0a6[_0x2505('0x55')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x37b0a6);})['then'](function(_0x40d8bc){_0x10ec37['rows']=_0x40d8bc;return _0x10ec37;})[_0x2505('0x1f')](respondWithFilteredResult(_0x1440c7,_0x37b0a6))[_0x2505('0x28')](handleError(_0x1440c7,null));};exports[_0x2505('0x56')]=function(_0x59514a,_0x5ce59b){var _0x200cac={'raw':![],'where':{'id':_0x59514a[_0x2505('0x57')]['id']},'include':[{'model':db[_0x2505('0x3c')],'as':_0x2505('0x58')}]},_0x1eaa88={};_0x1eaa88[_0x2505('0x42')]=_[_0x2505('0x44')](db[_0x2505('0x53')][_0x2505('0x3e')]);_0x1eaa88['query']=_[_0x2505('0x44')](_0x59514a[_0x2505('0x43')]);_0x1eaa88[_0x2505('0x45')]=_[_0x2505('0x47')](_0x1eaa88[_0x2505('0x42')],_0x1eaa88[_0x2505('0x43')]);_0x200cac[_0x2505('0x46')]=_[_0x2505('0x47')](_0x1eaa88['model'],qs[_0x2505('0x48')](_0x59514a[_0x2505('0x43')][_0x2505('0x48')]));_0x200cac[_0x2505('0x46')]=_0x200cac['attributes'][_0x2505('0x49')]?_0x200cac[_0x2505('0x46')]:_0x1eaa88[_0x2505('0x42')];if(_0x59514a[_0x2505('0x43')][_0x2505('0x54')]){_0x200cac[_0x2505('0x55')]=[{'all':!![]}];}_0x200cac=_[_0x2505('0x4f')]({},_0x200cac,_0x59514a['options']);return db['WhatsappAccount'][_0x2505('0x59')](_0x200cac)['then'](handleEntityNotFound(_0x5ce59b,null))[_0x2505('0x1f')](respondWithResult(_0x5ce59b,null))[_0x2505('0x28')](handleError(_0x5ce59b,null));};exports[_0x2505('0x5a')]=function(_0xf8780a,_0x32964d){return db[_0x2505('0x53')][_0x2505('0x5a')](_0xf8780a[_0x2505('0x5b')],{})[_0x2505('0x1f')](function(_0x1ed83d){var _0x43792a=_0xf8780a['user']['get']({'plain':!![]});if(!_0x43792a)throw new Error(_0x2505('0x5c'));if(_0x43792a[_0x2505('0x5d')]===_0x2505('0x5e')){var _0x237fa0=_0x1ed83d[_0x2505('0x37')]({'plain':!![]});var _0x32d831=_0x2505('0x38');return db['UserProfileSection'][_0x2505('0x59')]({'where':{'name':_0x32d831,'userProfileId':_0x43792a['userProfileId']},'raw':!![]})['then'](function(_0x5712ab){if(_0x5712ab&&_0x5712ab[_0x2505('0x5f')]===0x0){return db['UserProfileResource'][_0x2505('0x5a')]({'name':_0x237fa0['name'],'resourceId':_0x237fa0['id'],'type':_0x5712ab[_0x2505('0x3b')],'sectionId':_0x5712ab['id']},{})[_0x2505('0x1f')](function(){return _0x1ed83d;});}else{return _0x1ed83d;}})['catch'](function(_0x1a86fa){logger[_0x2505('0x24')](_0x2505('0x60'),_0x1a86fa);throw _0x1a86fa;});}return _0x1ed83d;})[_0x2505('0x1f')](respondWithResult(_0x32964d,0xc9))[_0x2505('0x28')](handleError(_0x32964d,null));};exports['update']=function(_0x541d06,_0x2b2fe2){if(_0x541d06[_0x2505('0x5b')]['id']){delete _0x541d06[_0x2505('0x5b')]['id'];}return db[_0x2505('0x53')][_0x2505('0x59')]({'where':{'id':_0x541d06[_0x2505('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x2505('0x58')}]})[_0x2505('0x1f')](handleEntityNotFound(_0x2b2fe2,null))['then'](saveUpdates(_0x541d06[_0x2505('0x5b')],null))[_0x2505('0x1f')](respondWithResult(_0x2b2fe2,null))['catch'](handleError(_0x2b2fe2,null));};exports[_0x2505('0x36')]=function(_0x432b08,_0x37e4ed){return db[_0x2505('0x53')][_0x2505('0x59')]({'where':{'id':_0x432b08[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x37e4ed,null))['then'](removeEntity(_0x37e4ed,null))[_0x2505('0x28')](handleError(_0x37e4ed,null));};exports[_0x2505('0x61')]=function(_0x242808,_0x4fe5dd){return db[_0x2505('0x53')][_0x2505('0x61')]()[_0x2505('0x1f')](respondWithResult(_0x4fe5dd,null))[_0x2505('0x28')](handleError(_0x4fe5dd,null));};exports[_0x2505('0x62')]=function(_0x350760,_0x408278,_0x2e102c){if(_0x350760[_0x2505('0x5b')]['id']){delete _0x350760[_0x2505('0x5b')]['id'];}return db['WhatsappAccount'][_0x2505('0x59')]({'where':{'id':_0x350760['params']['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x408278,null))[_0x2505('0x1f')](function(_0xc88e67){if(_0xc88e67){_0x350760[_0x2505('0x5b')][_0x2505('0x63')]=_0xc88e67['id'];return db[_0x2505('0x64')][_0x2505('0x5a')](_0x350760[_0x2505('0x5b')]);}})[_0x2505('0x1f')](respondWithResult(_0x408278,null))[_0x2505('0x28')](handleError(_0x408278,null));};exports[_0x2505('0x65')]=function(_0x22f61b,_0x54269e,_0x5a1ac5){var _0x3cb6d1={'raw':![],'where':{}};var _0x8a469d={};var _0x9a617b={'count':0x0,'rows':[]};return db[_0x2505('0x53')][_0x2505('0x66')]({'where':{'id':_0x22f61b[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x54269e,null))[_0x2505('0x1f')](function(_0x33d62d){if(_0x33d62d){_0x8a469d[_0x2505('0x42')]=_[_0x2505('0x44')](db['Disposition']['rawAttributes']);_0x8a469d[_0x2505('0x43')]=_[_0x2505('0x44')](_0x22f61b[_0x2505('0x43')]);_0x8a469d[_0x2505('0x45')]=_[_0x2505('0x47')](_0x8a469d['model'],_0x8a469d[_0x2505('0x43')]);_0x3cb6d1[_0x2505('0x46')]=_[_0x2505('0x47')](_0x8a469d[_0x2505('0x42')],qs['fields'](_0x22f61b[_0x2505('0x43')][_0x2505('0x48')]));_0x3cb6d1[_0x2505('0x46')]=_0x3cb6d1['attributes'][_0x2505('0x49')]?_0x3cb6d1['attributes']:_0x8a469d[_0x2505('0x42')];if(!_0x22f61b['query'][_0x2505('0x4a')]('nolimit')){_0x3cb6d1[_0x2505('0x2f')]=qs[_0x2505('0x2f')](_0x22f61b[_0x2505('0x43')]['limit']);_0x3cb6d1['offset']=qs[_0x2505('0x2c')](_0x22f61b[_0x2505('0x43')]['offset']);}_0x3cb6d1['order']=qs['sort'](_0x22f61b[_0x2505('0x43')]['sort']);_0x3cb6d1[_0x2505('0x4e')]=qs[_0x2505('0x45')](_['pick'](_0x22f61b[_0x2505('0x43')],_0x8a469d['filters']));_0x3cb6d1[_0x2505('0x4e')][_0x2505('0x63')]=_0x33d62d['id'];if(_0x22f61b[_0x2505('0x43')][_0x2505('0x51')]){_0x3cb6d1[_0x2505('0x4e')]=_[_0x2505('0x4f')](_0x3cb6d1[_0x2505('0x4e')],{'$or':_[_0x2505('0x3d')](_0x3cb6d1['attributes'],function(_0x4c5683){var _0x57460c={};_0x57460c[_0x4c5683]={'$like':'%'+_0x22f61b[_0x2505('0x43')]['filter']+'%'};return _0x57460c;})});}_0x3cb6d1=_[_0x2505('0x4f')]({},_0x3cb6d1,_0x22f61b[_0x2505('0x52')]);return db[_0x2505('0x64')][_0x2505('0x2e')]({'where':_0x3cb6d1[_0x2505('0x4e')]})[_0x2505('0x1f')](function(_0x30ba14){_0x9a617b['count']=_0x30ba14;if(_0x22f61b['query']['includeAll']){_0x3cb6d1['include']=[{'all':!![]}];}return db['Disposition'][_0x2505('0x67')](_0x3cb6d1);})[_0x2505('0x1f')](function(_0x17ec56){_0x9a617b[_0x2505('0x68')]=_0x17ec56;return _0x9a617b;});}})[_0x2505('0x1f')](respondWithFilteredResult(_0x54269e,_0x3cb6d1))['catch'](handleError(_0x54269e,null));};exports[_0x2505('0x69')]=function(_0x32cc56,_0x4a552c,_0x3f6aeb){return db[_0x2505('0x53')]['find']({'where':{'id':_0x32cc56[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x4a552c,null))['then'](function(_0x475f33){if(_0x475f33){return _0x475f33[_0x2505('0x69')](_0x32cc56[_0x2505('0x43')][_0x2505('0x6a')]);}})['then'](respondWithStatusCode(_0x4a552c,null))['catch'](handleError(_0x4a552c,null));};exports[_0x2505('0x6b')]=function(_0x188145,_0x55fdf2,_0x47681d){if(_0x188145[_0x2505('0x5b')]['id']){delete _0x188145['body']['id'];}return db['WhatsappAccount'][_0x2505('0x59')]({'where':{'id':_0x188145['params']['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x55fdf2,null))['then'](function(_0x277471){if(_0x277471){_0x188145[_0x2505('0x5b')]['WhatsappAccountId']=_0x277471['id'];return db[_0x2505('0x6c')]['create'](_0x188145[_0x2505('0x5b')]);}})[_0x2505('0x1f')](respondWithResult(_0x55fdf2,null))[_0x2505('0x28')](handleError(_0x55fdf2,null));};exports[_0x2505('0x6d')]=function(_0x3412b5,_0x4ef1a4,_0x204e07){var _0x69d438={'raw':![],'where':{}};var _0x516a94={};var _0x1744a8={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x3412b5[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x4ef1a4,null))[_0x2505('0x1f')](function(_0x110c8e){if(_0x110c8e){_0x516a94[_0x2505('0x42')]=_[_0x2505('0x44')](db['CannedAnswer'][_0x2505('0x3e')]);_0x516a94[_0x2505('0x43')]=_[_0x2505('0x44')](_0x3412b5[_0x2505('0x43')]);_0x516a94['filters']=_[_0x2505('0x47')](_0x516a94[_0x2505('0x42')],_0x516a94[_0x2505('0x43')]);_0x69d438[_0x2505('0x46')]=_['intersection'](_0x516a94[_0x2505('0x42')],qs[_0x2505('0x48')](_0x3412b5[_0x2505('0x43')][_0x2505('0x48')]));_0x69d438['attributes']=_0x69d438['attributes']['length']?_0x69d438['attributes']:_0x516a94['model'];if(!_0x3412b5[_0x2505('0x43')][_0x2505('0x4a')](_0x2505('0x4b'))){_0x69d438[_0x2505('0x2f')]=qs[_0x2505('0x2f')](_0x3412b5['query'][_0x2505('0x2f')]);_0x69d438['offset']=qs[_0x2505('0x2c')](_0x3412b5['query'][_0x2505('0x2c')]);}_0x69d438['order']=qs[_0x2505('0x4d')](_0x3412b5['query']['sort']);_0x69d438[_0x2505('0x4e')]=qs[_0x2505('0x45')](_[_0x2505('0x6e')](_0x3412b5[_0x2505('0x43')],_0x516a94['filters']));_0x69d438[_0x2505('0x4e')]['WhatsappAccountId']=_0x110c8e['id'];if(_0x3412b5[_0x2505('0x43')][_0x2505('0x51')]){_0x69d438['where']=_['merge'](_0x69d438[_0x2505('0x4e')],{'$or':_[_0x2505('0x3d')](_0x69d438[_0x2505('0x46')],function(_0x328a53){var _0x35d45f={};_0x35d45f[_0x328a53]={'$like':'%'+_0x3412b5[_0x2505('0x43')][_0x2505('0x51')]+'%'};return _0x35d45f;})});}_0x69d438=_[_0x2505('0x4f')]({},_0x69d438,_0x3412b5[_0x2505('0x52')]);return db[_0x2505('0x6c')][_0x2505('0x2e')]({'where':_0x69d438[_0x2505('0x4e')]})[_0x2505('0x1f')](function(_0x12444d){_0x1744a8[_0x2505('0x2e')]=_0x12444d;if(_0x3412b5[_0x2505('0x43')][_0x2505('0x54')]){_0x69d438[_0x2505('0x55')]=[{'all':!![]}];}return db[_0x2505('0x6c')][_0x2505('0x67')](_0x69d438);})['then'](function(_0x51ce01){_0x1744a8[_0x2505('0x68')]=_0x51ce01;return _0x1744a8;});}})[_0x2505('0x1f')](respondWithFilteredResult(_0x4ef1a4,_0x69d438))[_0x2505('0x28')](handleError(_0x4ef1a4,null));};exports[_0x2505('0x6f')]=function(_0x593ee8,_0x2fc731,_0x19161e){return db[_0x2505('0x53')]['find']({'where':{'id':_0x593ee8[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x2fc731,null))[_0x2505('0x1f')](function(_0x3d9dc8){if(_0x3d9dc8){return _0x3d9dc8[_0x2505('0x6f')](_0x593ee8['query']['ids']);}})[_0x2505('0x1f')](respondWithStatusCode(_0x2fc731,null))[_0x2505('0x28')](handleError(_0x2fc731,null));};exports[_0x2505('0x70')]=function(_0x2439bf,_0x501ebc,_0x8dad58){return db[_0x2505('0x53')]['find']({'where':{'id':_0x2439bf[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x501ebc,null))['then'](function(_0x82e6b2){if(_0x82e6b2){return _0x82e6b2[_0x2505('0x70')](_0x2439bf[_0x2505('0x5b')]['ids'],_[_0x2505('0x71')](_0x2439bf[_0x2505('0x5b')],[_0x2505('0x6a'),'id'])||{})[_0x2505('0x72')](function(_0x3019cb){for(var _0x3df030=0x0;_0x3df030<_0x2439bf['body'][_0x2505('0x6a')]['length'];_0x3df030+=0x1){socket['emit'](_0x2505('0x73'),{'UserId':Number(_0x2439bf['body']['ids'][_0x3df030]),'WhatsappAccountId':Number(_0x2439bf['params']['id'])});}return _0x3019cb;});}})[_0x2505('0x1f')](respondWithResult(_0x501ebc,null))['catch'](handleError(_0x501ebc,null));};exports[_0x2505('0x74')]=function(_0x196e65,_0xc29bf1,_0x5f1cf1){return db['WhatsappAccount'][_0x2505('0x59')]({'where':{'id':_0x196e65[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0xc29bf1,null))['then'](function(_0x1fd090){if(_0x1fd090){return _0x1fd090['removeAgents'](_0x196e65[_0x2505('0x43')][_0x2505('0x6a')])['then'](function(){if(_['isArray'](_0x196e65[_0x2505('0x43')]['ids'])){for(var _0xc1febe=0x0;_0xc1febe<_0x196e65[_0x2505('0x43')][_0x2505('0x6a')][_0x2505('0x49')];_0xc1febe+=0x1){socket[_0x2505('0x75')](_0x2505('0x76'),{'UserId':Number(_0x196e65[_0x2505('0x43')][_0x2505('0x6a')][_0xc1febe]),'WhatsappAccountId':Number(_0x196e65[_0x2505('0x57')]['id'])});}}else{socket[_0x2505('0x75')](_0x2505('0x76'),{'UserId':Number(_0x196e65['query']['ids']),'WhatsappAccountId':Number(_0x196e65[_0x2505('0x57')]['id'])});}});}})[_0x2505('0x1f')](respondWithStatusCode(_0xc29bf1,null))['catch'](handleError(_0xc29bf1,null));};exports[_0x2505('0x77')]=function(_0xfaf520,_0x487dd9,_0x44b456){var _0x581f29={};var _0x5e7ed4={};var _0x20c7e3;var _0x3bf8f2;return db[_0x2505('0x53')][_0x2505('0x66')]({'where':{'id':_0xfaf520[_0x2505('0x57')]['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x487dd9,null))[_0x2505('0x1f')](function(_0x1d466d){if(_0x1d466d){_0x20c7e3=_0x1d466d;_0x5e7ed4[_0x2505('0x42')]=_[_0x2505('0x44')](db[_0x2505('0x78')][_0x2505('0x3e')]);_0x5e7ed4[_0x2505('0x43')]=_[_0x2505('0x44')](_0xfaf520[_0x2505('0x43')]);_0x5e7ed4[_0x2505('0x45')]=_['intersection'](_0x5e7ed4[_0x2505('0x42')],_0x5e7ed4[_0x2505('0x43')]);_0x581f29['attributes']=_[_0x2505('0x47')](_0x5e7ed4[_0x2505('0x42')],qs['fields'](_0xfaf520[_0x2505('0x43')]['fields']));_0x581f29[_0x2505('0x46')]=_0x581f29['attributes']['length']?_0x581f29[_0x2505('0x46')]:_0x5e7ed4['model'];_0x581f29[_0x2505('0x4c')]=qs[_0x2505('0x4d')](_0xfaf520[_0x2505('0x43')][_0x2505('0x4d')]);_0x581f29[_0x2505('0x4e')]=qs[_0x2505('0x45')](_['pick'](_0xfaf520[_0x2505('0x43')],_0x5e7ed4[_0x2505('0x45')]));if(_0xfaf520[_0x2505('0x43')]['filter']){_0x581f29['where']=_[_0x2505('0x4f')](_0x581f29['where'],{'$or':_[_0x2505('0x3d')](_0x581f29[_0x2505('0x46')],function(_0x4e87dc){var _0x142548={};_0x142548[_0x4e87dc]={'$like':'%'+_0xfaf520['query'][_0x2505('0x51')]+'%'};return _0x142548;})});}_0x581f29=_['merge']({},_0x581f29,_0xfaf520[_0x2505('0x52')]);return _0x20c7e3[_0x2505('0x77')](_0x581f29);}})['then'](function(_0x1625d6){if(_0x1625d6){_0x3bf8f2=_0x1625d6[_0x2505('0x49')];if(!_0xfaf520[_0x2505('0x43')][_0x2505('0x4a')](_0x2505('0x4b'))){_0x581f29['limit']=qs[_0x2505('0x2f')](_0xfaf520[_0x2505('0x43')][_0x2505('0x2f')]);_0x581f29[_0x2505('0x2c')]=qs[_0x2505('0x2c')](_0xfaf520['query']['offset']);}return _0x20c7e3['getAgents'](_0x581f29);}})[_0x2505('0x1f')](function(_0x5a7313){if(_0x5a7313){return _0x5a7313?{'count':_0x3bf8f2,'rows':_0x5a7313}:null;}})[_0x2505('0x1f')](respondWithResult(_0x487dd9,null))['catch'](handleError(_0x487dd9,null));};exports['addApplications']=function(_0x4c92ec,_0x5c4bae){var _0x47761d=_0x4c92ec[_0x2505('0x57')]['id'];var _0x30be08=_0x4c92ec[_0x2505('0x5b')];var _0x47bc13=0xc8;var _0x419ae0=null;return db[_0x2505('0x79')][_0x2505('0x7a')]({'isolationLevel':db['sequelize'][_0x2505('0x7b')][_0x2505('0x7c')][_0x2505('0x7d')]},function(_0x103a0b){return db[_0x2505('0x53')][_0x2505('0x66')]({'where':{'id':_0x47761d},'transaction':_0x103a0b})[_0x2505('0x1f')](function(_0x4814db){if(_0x4814db){return db[_0x2505('0x7e')][_0x2505('0x36')]({'where':{'WhatsappAccountId':_0x47761d},'transaction':_0x103a0b})[_0x2505('0x1f')](function(){var _0xa8fb7c=_[_0x2505('0x3d')](_0x30be08,function(_0x2c52e8){_0x2c52e8[_0x2505('0x63')]=_0x47761d;return _0x2c52e8;});return db['WhatsappApplication'][_0x2505('0x7f')](_0xa8fb7c,{'transaction':_0x103a0b});});}else{_0x47bc13=0x194;_0x419ae0=[];}});})[_0x2505('0x1f')](function(){if(_0x47bc13!==0x194){return db['WhatsappApplication'][_0x2505('0x80')]({'where':{'WhatsappAccountId':_0x47761d},'order':'priority'})[_0x2505('0x1f')](function(_0x1ef84c){_0x419ae0=_0x1ef84c;});}})['catch'](function(_0x14285a){_0x47bc13=0x1f4;logger[_0x2505('0x24')](_0x14285a[_0x2505('0x81')]);if(_0x14285a[_0x2505('0x3b')]){delete _0x14285a['name'];}_0x419ae0=_0x14285a;})[_0x2505('0x82')](function(){if(_0x419ae0===null){_0x5c4bae[_0x2505('0x3a')](_0x47bc13);}else{if(_0x47bc13===0x1f4){_0x5c4bae[_0x2505('0x29')](_0x47bc13)['send'](_0x419ae0);}else{_0x5c4bae[_0x2505('0x29')](_0x47bc13)['json'](_0x419ae0);}}});};exports[_0x2505('0x83')]=function(_0x5b80b2,_0x53236a,_0x5eec0d){var _0x35f0bf={};var _0x5dc83b={};var _0x36bc2f;var _0x2b5930;return db[_0x2505('0x53')][_0x2505('0x66')]({'where':{'id':_0x5b80b2['params']['id']}})[_0x2505('0x1f')](handleEntityNotFound(_0x53236a,null))['then'](function(_0xec2f26){if(_0xec2f26){_0x36bc2f=_0xec2f26;_0x5dc83b[_0x2505('0x42')]=_[_0x2505('0x44')](db[_0x2505('0x7e')][_0x2505('0x3e')]);_0x5dc83b[_0x2505('0x43')]=_[_0x2505('0x44')](_0x5b80b2[_0x2505('0x43')]);_0x5dc83b[_0x2505('0x45')]=_['intersection'](_0x5dc83b[_0x2505('0x42')],_0x5dc83b[_0x2505('0x43')]);_0x35f0bf['attributes']=_[_0x2505('0x47')](_0x5dc83b[_0x2505('0x42')],qs[_0x2505('0x48')](_0x5b80b2[_0x2505('0x43')][_0x2505('0x48')]));_0x35f0bf[_0x2505('0x46')]=_0x35f0bf[_0x2505('0x46')][_0x2505('0x49')]?_0x35f0bf[_0x2505('0x46')]:_0x5dc83b[_0x2505('0x42')];_0x35f0bf['order']=qs[_0x2505('0x4d')](_0x5b80b2['query'][_0x2505('0x4d')]);_0x35f0bf[_0x2505('0x4e')]=qs['filters'](_[_0x2505('0x6e')](_0x5b80b2[_0x2505('0x43')],_0x5dc83b[_0x2505('0x45')]));if(_0x5b80b2[_0x2505('0x43')][_0x2505('0x51')]){_0x35f0bf[_0x2505('0x4e')]=_[_0x2505('0x4f')](_0x35f0bf[_0x2505('0x4e')],{'$or':_[_0x2505('0x3d')](_0x35f0bf[_0x2505('0x46')],function(_0x5732d8){var _0x5a944b={};_0x5a944b[_0x5732d8]={'$like':'%'+_0x5b80b2[_0x2505('0x43')][_0x2505('0x51')]+'%'};return _0x5a944b;})});}_0x35f0bf=_[_0x2505('0x4f')]({},_0x35f0bf,_0x5b80b2[_0x2505('0x52')]);return _0x36bc2f[_0x2505('0x83')](_0x35f0bf);}})[_0x2505('0x1f')](function(_0x1ca6ec){if(_0x1ca6ec){_0x2b5930=_0x1ca6ec[_0x2505('0x49')];if(!_0x5b80b2['query']['hasOwnProperty'](_0x2505('0x4b'))){_0x35f0bf[_0x2505('0x2f')]=qs[_0x2505('0x2f')](_0x5b80b2[_0x2505('0x43')][_0x2505('0x2f')]);_0x35f0bf[_0x2505('0x2c')]=qs[_0x2505('0x2c')](_0x5b80b2[_0x2505('0x43')][_0x2505('0x2c')]);}return _0x36bc2f['getApplications'](_0x35f0bf);}})[_0x2505('0x1f')](function(_0x550c8a){if(_0x550c8a){return _0x550c8a?{'count':_0x2b5930,'rows':_0x550c8a}:null;}})[_0x2505('0x1f')](respondWithResult(_0x53236a,null))[_0x2505('0x28')](handleError(_0x53236a,null));};exports['notify']=function(_0x385b80,_0x1d1b16,_0x64beb7){var _0x2bb80b={'channel':'whatsapp'};var _0x15d001=[];var _0x1b15ae=[];var _0x987b15={};return db[_0x2505('0x53')]['find']({'where':{'id':_0x385b80['params']['id']},'include':[{'model':db[_0x2505('0x7e')],'as':_0x2505('0x84')}]})['then'](handleEntityNotFound(_0x1d1b16,null))[_0x2505('0x1f')](function(_0x286f60){_0x2bb80b['account']=_0x286f60;if(_0x2bb80b[_0x2505('0x85')]&&_0x2bb80b[_0x2505('0x85')][_0x2505('0x40')]===_0x2505('0x86')&&_0x385b80[_0x2505('0x5b')][_0x2505('0x87')]){if(_0x385b80[_0x2505('0x5b')][_0x2505('0x87')]['length']===0x0)return;if(_0x385b80[_0x2505('0x5b')][_0x2505('0x87')][0x0][_0x2505('0x88')]!==_0x2505('0x89'))return;return db[_0x2505('0x8a')][_0x2505('0x35')]({'read':!![],'readAt':_0x385b80['body']['statuses'][0x0][_0x2505('0x8b')]},{'where':{'messageId':_0x385b80[_0x2505('0x5b')][_0x2505('0x87')][0x0][_0x2505('0x8c')]},'individualHooks':!![]})['then'](function(_0x5e97d2){return _0x1d1b16[_0x2505('0x29')](0xc8)['json'](_0x5e97d2);});}_0x2bb80b[_0x2505('0x8d')]=_[_0x2505('0x8e')](_0x286f60[_0x2505('0x84')],['priority'],[_0x2505('0x8f')]);if(_0x2bb80b['account'][_0x2505('0x84')]){delete _0x2bb80b[_0x2505('0x85')]['Applications'];}return db[_0x2505('0x90')]['describe']()[_0x2505('0x1f')](function(_0x29b62c){if(!_0x29b62c){throw new db[(_0x2505('0x91'))][(_0x2505('0x92'))](_0x2505('0x93'));}_0x15d001=_[_0x2505('0x94')](_[_0x2505('0x44')](_0x29b62c),[_0x2505('0x95'),'updatedAt']);_0x1b15ae=_[_0x2505('0x94')](_[_0x2505('0x44')](_0x29b62c),['createdAt',_0x2505('0x96'),_0x2505('0x97'),_0x2505('0x98')]);_0x2bb80b[_0x2505('0x5b')]={'mapKey':_0x2505('0x99')};if(_0x2bb80b[_0x2505('0x85')]&&_0x2bb80b[_0x2505('0x85')]['type']===_0x2505('0x9a')){_0x2bb80b[_0x2505('0x5b')][_0x2505('0x9b')]=_0x385b80[_0x2505('0x5b')][_0x2505('0x9c')][_0x2505('0x9d')](_0x2505('0x9e'),'');_0x2bb80b[_0x2505('0x5b')][_0x2505('0x5b')]=_0x385b80[_0x2505('0x5b')][_0x2505('0x9f')];_0x2bb80b[_0x2505('0x5b')][_0x2505('0xa0')]=_0x385b80[_0x2505('0x5b')][_0x2505('0xa1')];}if(_0x2bb80b[_0x2505('0x85')]&&_0x2bb80b['account'][_0x2505('0x40')]===_0x2505('0x86')){_0x2bb80b[_0x2505('0x5b')]['from']=_0x385b80[_0x2505('0x5b')]['notifications'][0x0][_0x2505('0x9b')];_0x2bb80b[_0x2505('0x5b')][_0x2505('0x5b')]=_0x385b80[_0x2505('0x5b')]['notifications'][0x0][_0x2505('0x26')][_0x2505('0x5b')];_0x2bb80b[_0x2505('0x5b')]['messageId']=_0x385b80[_0x2505('0x5b')][_0x2505('0xa2')][0x0][_0x2505('0x8c')];}if(_0x2bb80b[_0x2505('0x5b')]['id']){delete _0x2bb80b[_0x2505('0x5b')]['id'];}if(_[_0x2505('0xa3')](_0x2bb80b[_0x2505('0x5b')][_0x2505('0x9b')])){throw new db[(_0x2505('0x91'))][(_0x2505('0x92'))](_0x2505('0xa4'));}if(_[_0x2505('0xa3')](_0x2bb80b[_0x2505('0x5b')][_0x2505('0x5b')])||_0x2bb80b[_0x2505('0x5b')][_0x2505('0x5b')]===''){throw new db[(_0x2505('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2505('0xa3')](_0x2bb80b['body'][_0x2505('0xa5')])){throw new db[(_0x2505('0x91'))][(_0x2505('0x92'))](_0x2505('0xa6')+_0x1b15ae);}if(!_[_0x2505('0xa7')](_0x1b15ae,_0x2bb80b[_0x2505('0x5b')][_0x2505('0xa5')])){throw new db[(_0x2505('0x91'))]['ValidationError'](_0x2505('0xa8')+_0x1b15ae);}_0x987b15[_0x2bb80b[_0x2505('0x5b')][_0x2505('0xa5')]]=_0x2bb80b[_0x2505('0x5b')][_0x2505('0x9b')];return db[_0x2505('0xa9')][_0x2505('0x59')]({'where':{'id':_0x2bb80b[_0x2505('0x85')][_0x2505('0x98')]},'include':[{'model':db['CmContact'],'as':_0x2505('0xaa'),'where':_0x987b15,'limit':0x1,'order':[[_0x2505('0x96'),_0x2505('0xab')]]}]});})[_0x2505('0x1f')](handleEntityNotFound(_0x1d1b16,null))[_0x2505('0x1f')](function(_0x1b4c21){if(_0x1b4c21){_0x2bb80b[_0x2505('0xac')]=_['omit'](_0x1b4c21,[_0x2505('0xaa')]);if(_0x1b4c21['Contacts'][_0x2505('0x49')]){return _0x1b4c21['Contacts'][0x0];}var _0x36b43b=_[_0x2505('0x18')](_0x2bb80b[_0x2505('0x5b')],{'firstName':_0x2bb80b[_0x2505('0x5b')][_0x2505('0x9b')],'ListId':_0x1b4c21['id']});_0x36b43b[_0x2bb80b[_0x2505('0x5b')]['mapKey']]=_0x2bb80b[_0x2505('0x5b')][_0x2505('0x9b')];return db['CmContact'][_0x2505('0x5a')](_0x36b43b,{'fields':_0x15d001,'raw':!![]});}})[_0x2505('0x1f')](handleEntityNotFound(_0x1d1b16,null))[_0x2505('0x1f')](function(_0x36e420){if(_0x36e420){_0x2bb80b[_0x2505('0xad')]=_0x36e420;var _0x4ed67a={'ContactId':_0x36e420['id'],'phone':_0x2bb80b['body'][_0x2505('0x9b')],'WhatsappAccountId':_0x385b80['params']['id']};var _0x275143={'ContactId':_0x36e420['id'],'WhatsappAccountId':_0x385b80[_0x2505('0x57')]['id'],'closed':![]};return db[_0x2505('0xae')]['find']({'where':_0x275143})['then'](function(_0x3ac66a){if(_0x3ac66a){return[_0x3ac66a,![]];}return db[_0x2505('0xae')]['create'](_0x4ed67a)[_0x2505('0x1f')](function(_0x92c90c){return[_0x92c90c,!![]];});});}})[_0x2505('0x72')](function(_0x457651,_0x16b337){_0x2bb80b['interaction']=_0x457651['get']({'plain':!![]});_0x2bb80b['interaction'][_0x2505('0xaf')]=![];if(_0x16b337){if(_0x2bb80b['account'][_0x2505('0xb0')]){_0x2bb80b[_0x2505('0x8d')][_0x2505('0xb1')]({'id':0x0,'priority':_0x2bb80b[_0x2505('0x8d')][_0x2505('0x49')]+0x1,'app':_0x2505('0xb2'),'appdata':_0x2505('0xb3'),'interval':_0x2505('0xb4')});}_0x2bb80b['interaction'][_0x2505('0xaf')]=!![];}return db[_0x2505('0x8a')][_0x2505('0x5a')]({'phone':_0x2bb80b[_0x2505('0x5b')]['from'],'messageId':_0x2bb80b[_0x2505('0x5b')]['messageId'],'body':_0x2bb80b['body']['body'],'WhatsappAccountId':_0x385b80[_0x2505('0x57')]['id'],'WhatsappInteractionId':_0x457651['id'],'direction':'in','ContactId':_0x457651[_0x2505('0xb5')],'AttachmentId':_0x2bb80b['body'][_0x2505('0xb6')]});})[_0x2505('0x1f')](function(_0x53fd38){_0x2bb80b['message']=_0x53fd38;if(_0x2bb80b[_0x2505('0xb7')][_0x2505('0xb8')]){return db['User'][_0x2505('0x59')]({'attributes':['id','name'],'where':{'id':_0x2bb80b[_0x2505('0xb7')][_0x2505('0xb8')]}})[_0x2505('0x1f')](function(_0x753648){if(_0x753648){_0x2bb80b[_0x2505('0x8d')][_0x2505('0xb9')]({'id':0x0,'priority':0x0,'app':_0x2505('0xba'),'appdata':_0x753648['name']+','+(_0x2bb80b[_0x2505('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x2505('0xb4')});}return respondWithRpcPromise('Start','startRouting',_0x2bb80b);});}return respondWithRpcPromise(_0x2505('0xbb'),_0x2505('0xbc'),_0x2bb80b);})[_0x2505('0x1f')](function(_0x5018e){if(_0x5018e){var _0x5e5bb2=0xc8;var _0x1b6621=_0x2505('0xbd');logger['info'](_0x2505('0xbe'),_0x1b6621,_0x5e5bb2,_0x2505('0xbf'));logger[_0x2505('0xc0')](_0x2505('0xc1'),_0x1b6621,_0x5e5bb2,_0x2505('0xbf'),JSON[_0x2505('0x23')](_0x5018e));if(_0x2bb80b[_0x2505('0x85')][_0x2505('0x40')]==='twilio'){return _0x1d1b16[_0x2505('0x29')](_0x5e5bb2)[_0x2505('0x30')](_0x2505('0xc2'),'text/xml')[_0x2505('0xc3')](_0x2505('0xc4'));}else{return _0x1d1b16[_0x2505('0x29')](_0x5e5bb2)['json'](_0x5018e);}}});})[_0x2505('0x28')](handleError(_0x1d1b16,null));};exports['send']=function(_0x1c1c9a,_0xc6b2a4,_0x716f22){var _0x59b937,_0x45a2b8,_0x11c11e;if(_['isNil'](_0x1c1c9a[_0x2505('0x5b')]['body'])||_0x1c1c9a['body'][_0x2505('0x5b')]===''){throw new db['Sequelize'][(_0x2505('0x92'))](_0x2505('0xc5'));}if(_['isNil'](_0x1c1c9a['body']['to'])){throw new db[(_0x2505('0x91'))][(_0x2505('0x92'))](_0x2505('0xc6'));}_0x59b937=_0x1c1c9a[_0x2505('0x5b')]['to'];return db[_0x2505('0x53')][_0x2505('0x59')]({'where':{'id':_0x1c1c9a['params']['id']},'include':[{'model':db[_0x2505('0xa9')],'as':_0x2505('0xc7'),'include':[{'model':db[_0x2505('0x90')],'as':_0x2505('0xaa'),'where':{'mobile':_0x59b937},'limit':0x1,'order':[['updatedAt',_0x2505('0xab')]]}]}]})[_0x2505('0x1f')](handleEntityNotFound(_0xc6b2a4,null))[_0x2505('0x1f')](function(_0x289f88){if(_0x289f88&&_0x289f88[_0x2505('0xc7')]){_0x45a2b8=_0x289f88['get']({'plain':!![]});if(_0x45a2b8[_0x2505('0xc7')]&&_0x45a2b8[_0x2505('0xc7')][_0x2505('0xaa')][_0x2505('0x49')]){return _0x45a2b8['List'][_0x2505('0xaa')][0x0];}return db[_0x2505('0x90')]['create'](_[_0x2505('0x18')](_0x1c1c9a['body'],{'firstName':_0x59b937,'mobile':_0x59b937,'phone':_0x59b937,'ListId':_0x45a2b8[_0x2505('0x98')]}));}})[_0x2505('0x1f')](handleEntityNotFound(_0xc6b2a4,null))['then'](function(_0xad7bb0){if(_0xad7bb0){_0x11c11e=_0xad7bb0;return db['WhatsappInteraction'][_0x2505('0x59')]({'where':{'ContactId':_0x11c11e['id'],'closed':![],'WhatsappAccountId':_0x45a2b8['id']}})[_0x2505('0x1f')](function(_0xb02b80){if(_0xb02b80){return[_0xb02b80,![]];}return db['WhatsappInteraction'][_0x2505('0x5a')]({'UserId':_0x1c1c9a[_0x2505('0x5e')]['id'],'ContactId':_0x11c11e['id'],'WhatsappAccountId':_0x45a2b8['id'],'phone':_0x59b937,'firstMsgDirection':_0x2505('0xc8'),'Messages':[_['merge'](_0x1c1c9a['body'],{'read':![],'body':_0x1c1c9a['body'][_0x2505('0x5b')],'phone':_0x59b937,'WhatsappAccountId':_0x45a2b8['id'],'UserId':_0x1c1c9a[_0x2505('0x5e')]['id'],'ContactId':_0x11c11e['id']})]},{'include':[{'model':db[_0x2505('0x8a')],'as':_0x2505('0xc9')}]})[_0x2505('0x1f')](function(_0x473549){return[_0x473549,!![]];});});}})['spread'](function(_0x285780,_0x5cebf8){if(_0x5cebf8){return _0x285780;}return db[_0x2505('0x8a')][_0x2505('0x5a')](_['merge'](_0x1c1c9a[_0x2505('0x5b')],{'read':![],'body':_0x1c1c9a[_0x2505('0x5b')][_0x2505('0x5b')],'phone':_0x59b937,'WhatsappAccountId':_0x45a2b8['id'],'WhatsappInteractionId':_0x285780['id'],'UserId':_0x1c1c9a[_0x2505('0x5e')]['id'],'ContactId':_0x11c11e['id']}))[_0x2505('0x1f')](function(_0x23439c){_0x285780[_0x2505('0xca')][_0x2505('0xc9')]=[];_0x285780[_0x2505('0xca')]['Messages'][_0x2505('0xb1')](_0x23439c[_0x2505('0xca')]);return _0x285780;});})[_0x2505('0x1f')](respondWithResult(_0xc6b2a4,null))[_0x2505('0x28')](handleError(_0xc6b2a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index facce92..aa8df97 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 _0x9119=['WhatsappAccount','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x9119,0x1d9));var _0x9911=function(_0x68eb5d,_0x490bac){_0x68eb5d=_0x68eb5d-0x0;var _0x4561dc=_0x9119[_0x68eb5d];return _0x4561dc;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x9911('0x0'))['db'][_0x9911('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32f6a4){return function(_0x1ce8b9,_0x124413,_0x348cf7){WhatsappAccountEvents[_0x9911('0x2')](_0x32f6a4+':'+_0x1ce8b9['id'],_0x1ce8b9);WhatsappAccountEvents[_0x9911('0x2')](_0x32f6a4,_0x1ce8b9);_0x348cf7(null);};}for(var e in events){if(events[_0x9911('0x3')](e)){var event=events[e];WhatsappAccount[_0x9911('0x4')](e,emitEvent(event));}}module[_0x9911('0x5')]=WhatsappAccountEvents; \ No newline at end of file +var _0xef21=['events','save','update','emit','hasOwnProperty','hook','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef21,0x1a4));var _0x1ef2=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xef21[_0x17928f];return _0x500b63;};'use strict';var EventEmitter=require(_0x1ef2('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ef2('0x1'),'afterUpdate':_0x1ef2('0x2'),'afterDestroy':'remove'};function emitEvent(_0x47dac0){return function(_0x10f42f,_0x56a5cd,_0x3f41c3){WhatsappAccountEvents[_0x1ef2('0x3')](_0x47dac0+':'+_0x10f42f['id'],_0x10f42f);WhatsappAccountEvents[_0x1ef2('0x3')](_0x47dac0,_0x10f42f);_0x3f41c3(null);};}for(var e in events){if(events[_0x1ef2('0x4')](e)){var event=events[e];WhatsappAccount[_0x1ef2('0x5')](e,emitEvent(event));}}module[_0x1ef2('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f6bf60e..fcf671c 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 _0x8da7=['./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x8da7,0xe8));var _0x78da=function(_0x37edd6,_0x10c041){_0x37edd6=_0x37edd6-0x0;var _0x519017=_0x8da7[_0x37edd6];return _0x519017;};'use strict';var _=require(_0x78da('0x0'));var util=require(_0x78da('0x1'));var logger=require(_0x78da('0x2'))(_0x78da('0x3'));var moment=require(_0x78da('0x4'));var BPromise=require(_0x78da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78da('0x6'));var rimraf=require('rimraf');var config=require(_0x78da('0x7'));var attributes=require(_0x78da('0x8'));module[_0x78da('0x9')]=function(_0x2382fa,_0x5018c4){return _0x2382fa[_0x78da('0xa')]('WhatsappAccount',attributes,{'tableName':_0x78da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b53=['WhatsappAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0xd1a5ff,_0x267b33){var _0x2aa281=function(_0x190d47){while(--_0x190d47){_0xd1a5ff['push'](_0xd1a5ff['shift']());}};_0x2aa281(++_0x267b33);}(_0x7b53,0xbf));var _0x37b5=function(_0x29597e,_0x5435e9){_0x29597e=_0x29597e-0x0;var _0x2a40e1=_0x7b53[_0x29597e];return _0x2a40e1;};'use strict';var _=require(_0x37b5('0x0'));var util=require(_0x37b5('0x1'));var logger=require(_0x37b5('0x2'))('api');var moment=require(_0x37b5('0x3'));var BPromise=require(_0x37b5('0x4'));var rp=require(_0x37b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37b5('0x6'));var config=require(_0x37b5('0x7'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x23350c,_0x3ea03e){return _0x23350c[_0x37b5('0x8')](_0x37b5('0x9'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 5d55604..dbe65bd 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 _0xc529=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','options','raw','attributes','include','map','model','ShowWhatsappAccount','stringify','catch','lodash'];(function(_0x325512,_0x5e5233){var _0x5b1b4c=function(_0x4d0ffa){while(--_0x4d0ffa){_0x325512['push'](_0x325512['shift']());}};_0x5b1b4c(++_0x5e5233);}(_0xc529,0x1ef));var _0x9c52=function(_0x362882,_0x3012cf){_0x362882=_0x362882-0x0;var _0x4632c9=_0xc529[_0x362882];return _0x4632c9;};'use strict';var _=require(_0x9c52('0x0'));var util=require('util');var moment=require(_0x9c52('0x1'));var BPromise=require(_0x9c52('0x2'));var rs=require(_0x9c52('0x3'));var fs=require('fs');var Redis=require(_0x9c52('0x4'));var db=require(_0x9c52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c52('0x6'))('rpc');var config=require(_0x9c52('0x7'));var jayson=require(_0x9c52('0x8'));var client=jayson['client'][_0x9c52('0x9')]({'port':0x232a});config[_0x9c52('0xa')]=_[_0x9c52('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c52('0xa')]));require('./whatsappAccount.socket')[_0x9c52('0xc')](socket);function respondWithRpcPromise(_0x500820,_0x194e74,_0x43dcc3){return new BPromise(function(_0x504da8,_0x16f289){return client['request'](_0x500820,_0x43dcc3)[_0x9c52('0xd')](function(_0x1bfed2){logger[_0x9c52('0xe')](_0x9c52('0xf'),_0x194e74,_0x9c52('0x10'));logger[_0x9c52('0x11')](_0x9c52('0x12'),_0x194e74,'request\x20sent',JSON['stringify'](_0x1bfed2));if(_0x1bfed2[_0x9c52('0x13')]){if(_0x1bfed2[_0x9c52('0x13')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x194e74,_0x1bfed2['error'][_0x9c52('0x14')]);return _0x16f289(_0x1bfed2[_0x9c52('0x13')][_0x9c52('0x14')]);}logger[_0x9c52('0x13')](_0x9c52('0xf'),_0x194e74,_0x1bfed2[_0x9c52('0x13')][_0x9c52('0x14')]);return _0x504da8(_0x1bfed2[_0x9c52('0x13')][_0x9c52('0x14')]);}else{logger[_0x9c52('0xe')](_0x9c52('0xf'),_0x194e74,_0x9c52('0x10'));_0x504da8(_0x1bfed2[_0x9c52('0x15')][_0x9c52('0x14')]);}})['catch'](function(_0x33cc2a){logger[_0x9c52('0x13')](_0x9c52('0xf'),_0x194e74,_0x33cc2a);_0x16f289(_0x33cc2a);});});}exports['ShowWhatsappAccount']=function(_0x35f1a6){var _0xaefb1=this;return new Promise(function(_0x4be444,_0x49848c){return db['WhatsappAccount']['find']({'raw':_0x35f1a6[_0x9c52('0x16')]?_0x35f1a6[_0x9c52('0x16')][_0x9c52('0x17')]===undefined?!![]:![]:!![],'where':_0x35f1a6[_0x9c52('0x16')]?_0x35f1a6['options']['where']||null:null,'attributes':_0x35f1a6['options']?_0x35f1a6['options'][_0x9c52('0x18')]||null:null,'include':_0x35f1a6[_0x9c52('0x16')]?_0x35f1a6[_0x9c52('0x16')][_0x9c52('0x19')]?_[_0x9c52('0x1a')](_0x35f1a6[_0x9c52('0x16')][_0x9c52('0x19')],function(_0x129e47){return{'model':db[_0x129e47['model']],'as':_0x129e47['as'],'attributes':_0x129e47[_0x9c52('0x18')],'include':_0x129e47[_0x9c52('0x19')]?_[_0x9c52('0x1a')](_0x129e47[_0x9c52('0x19')],function(_0x37cb0c){return{'model':db[_0x37cb0c[_0x9c52('0x1b')]],'as':_0x37cb0c['as'],'attributes':_0x37cb0c[_0x9c52('0x18')],'include':_0x37cb0c[_0x9c52('0x19')]?_['map'](_0x37cb0c['include'],function(_0x16b4b7){return{'model':db[_0x16b4b7[_0x9c52('0x1b')]],'as':_0x16b4b7['as'],'attributes':_0x16b4b7[_0x9c52('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9c52('0xd')](function(_0x38bd0d){logger[_0x9c52('0xe')]('ShowWhatsappAccount',_0x35f1a6);logger[_0x9c52('0x11')](_0x9c52('0x1c'),_0x35f1a6,JSON[_0x9c52('0x1d')](_0x38bd0d));_0x4be444(_0x38bd0d);})[_0x9c52('0x1e')](function(_0x3ad8ef){logger[_0x9c52('0x13')]('ShowWhatsappAccount',_0x3ad8ef[_0x9c52('0x14')],_0x35f1a6);_0x49848c(_0xaefb1[_0x9c52('0x13')](0x1f4,_0x3ad8ef[_0x9c52('0x14')]));});});}; \ No newline at end of file +var _0x88a4=['where','attributes','include','model','map','then','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','register','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options'];(function(_0x172c1b,_0x5830ec){var _0x35a2dd=function(_0x423de4){while(--_0x423de4){_0x172c1b['push'](_0x172c1b['shift']());}};_0x35a2dd(++_0x5830ec);}(_0x88a4,0x12f));var _0x488a=function(_0x1841aa,_0x171934){_0x1841aa=_0x1841aa-0x0;var _0x4f1439=_0x88a4[_0x1841aa];return _0x4f1439;};'use strict';var _=require(_0x488a('0x0'));var util=require(_0x488a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x488a('0x2'));var db=require(_0x488a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x488a('0x4'))(_0x488a('0x5'));var config=require(_0x488a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x488a('0x7')]({'port':0x232a});config[_0x488a('0x8')]=_[_0x488a('0x9')](config[_0x488a('0x8')],{'host':_0x488a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x488a('0x8')]));require('./whatsappAccount.socket')[_0x488a('0xb')](socket);function respondWithRpcPromise(_0x1e92b1,_0x152376,_0x2f8065){return new BPromise(function(_0x38a80e,_0x1aeac3){return client['request'](_0x1e92b1,_0x2f8065)['then'](function(_0x558a69){logger['info'](_0x488a('0xc'),_0x152376,_0x488a('0xd'));logger[_0x488a('0xe')](_0x488a('0xf'),_0x152376,_0x488a('0xd'),JSON[_0x488a('0x10')](_0x558a69));if(_0x558a69['error']){if(_0x558a69[_0x488a('0x11')][_0x488a('0x12')]===0x1f4){logger['error'](_0x488a('0xc'),_0x152376,_0x558a69[_0x488a('0x11')][_0x488a('0x13')]);return _0x1aeac3(_0x558a69[_0x488a('0x11')][_0x488a('0x13')]);}logger['error'](_0x488a('0xc'),_0x152376,_0x558a69[_0x488a('0x11')][_0x488a('0x13')]);return _0x38a80e(_0x558a69[_0x488a('0x11')][_0x488a('0x13')]);}else{logger[_0x488a('0x14')](_0x488a('0xc'),_0x152376,'request\x20sent');_0x38a80e(_0x558a69[_0x488a('0x15')]['message']);}})[_0x488a('0x16')](function(_0x151a30){logger[_0x488a('0x11')](_0x488a('0xc'),_0x152376,_0x151a30);_0x1aeac3(_0x151a30);});});}exports[_0x488a('0x17')]=function(_0x182d06){var _0x1c0e43=this;return new Promise(function(_0x4db50b,_0xdd9c38){return db[_0x488a('0x18')][_0x488a('0x19')]({'raw':_0x182d06['options']?_0x182d06[_0x488a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x182d06[_0x488a('0x1a')]?_0x182d06[_0x488a('0x1a')][_0x488a('0x1b')]||null:null,'attributes':_0x182d06['options']?_0x182d06['options'][_0x488a('0x1c')]||null:null,'include':_0x182d06[_0x488a('0x1a')]?_0x182d06[_0x488a('0x1a')][_0x488a('0x1d')]?_['map'](_0x182d06[_0x488a('0x1a')]['include'],function(_0x2771ae){return{'model':db[_0x2771ae[_0x488a('0x1e')]],'as':_0x2771ae['as'],'attributes':_0x2771ae['attributes'],'include':_0x2771ae['include']?_['map'](_0x2771ae['include'],function(_0x3c2d9e){return{'model':db[_0x3c2d9e['model']],'as':_0x3c2d9e['as'],'attributes':_0x3c2d9e['attributes'],'include':_0x3c2d9e[_0x488a('0x1d')]?_[_0x488a('0x1f')](_0x3c2d9e[_0x488a('0x1d')],function(_0x236fb7){return{'model':db[_0x236fb7[_0x488a('0x1e')]],'as':_0x236fb7['as'],'attributes':_0x236fb7[_0x488a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x488a('0x20')](function(_0x291ea3){logger[_0x488a('0x14')](_0x488a('0x17'),_0x182d06);logger[_0x488a('0xe')](_0x488a('0x17'),_0x182d06,JSON['stringify'](_0x291ea3));_0x4db50b(_0x291ea3);})[_0x488a('0x16')](function(_0x346330){logger[_0x488a('0x11')](_0x488a('0x17'),_0x346330[_0x488a('0x13')],_0x182d06);_0xdd9c38(_0x1c0e43[_0x488a('0x11')](0x1f4,_0x346330[_0x488a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 30caaf9..fff29a3 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 _0x4805=['save','remove','update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x17e0ff,_0x385864){var _0x2c8e95=function(_0x4e468f){while(--_0x4e468f){_0x17e0ff['push'](_0x17e0ff['shift']());}};_0x2c8e95(++_0x385864);}(_0x4805,0x104));var _0x5480=function(_0x35c3e3,_0x5256fc){_0x35c3e3=_0x35c3e3-0x0;var _0x31cbb7=_0x4805[_0x35c3e3];return _0x31cbb7;};'use strict';var WhatsappAccountEvents=require(_0x5480('0x0'));var events=[_0x5480('0x1'),_0x5480('0x2'),_0x5480('0x3')];function createListener(_0x3cdf6f,_0x1d64ce){return function(_0x2f8ba1){_0x1d64ce[_0x5480('0x4')](_0x3cdf6f,_0x2f8ba1);};}function removeListener(_0x5ed950,_0x26f6af){return function(){WhatsappAccountEvents[_0x5480('0x5')](_0x5ed950,_0x26f6af);};}exports[_0x5480('0x6')]=function(_0x33a6f1){for(var _0x435c27=0x0,_0xeff269=events[_0x5480('0x7')];_0x435c27<_0xeff269;_0x435c27++){var _0x210fe8=events[_0x435c27];var _0x4125a4=createListener(_0x5480('0x8')+_0x210fe8,_0x33a6f1);WhatsappAccountEvents['on'](_0x210fe8,_0x4125a4);}}; \ No newline at end of file +var _0xbc26=['removeListener','register','length','remove','update','emit'];(function(_0x3673be,_0x1dbb0b){var _0x5bd2ec=function(_0x1e2ddc){while(--_0x1e2ddc){_0x3673be['push'](_0x3673be['shift']());}};_0x5bd2ec(++_0x1dbb0b);}(_0xbc26,0x99));var _0x6bc2=function(_0x2f6b68,_0x21754a){_0x2f6b68=_0x2f6b68-0x0;var _0xd6f065=_0xbc26[_0x2f6b68];return _0xd6f065;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x6bc2('0x0'),_0x6bc2('0x1')];function createListener(_0x1586e9,_0x8b2bce){return function(_0xf3b988){_0x8b2bce[_0x6bc2('0x2')](_0x1586e9,_0xf3b988);};}function removeListener(_0x3f2fba,_0x57a3a9){return function(){WhatsappAccountEvents[_0x6bc2('0x3')](_0x3f2fba,_0x57a3a9);};}exports[_0x6bc2('0x4')]=function(_0xf9d5e5){for(var _0x436b53=0x0,_0x195f84=events[_0x6bc2('0x5')];_0x436b53<_0x195f84;_0x436b53++){var _0x3e2e82=events[_0x436b53];var _0x1951b8=createListener('whatsappAccount:'+_0x3e2e82,_0xf9d5e5);WhatsappAccountEvents['on'](_0x3e2e82,_0x1951b8);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3350fe8..68a8e7b 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 _0x5928=['index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x5928,0xf9));var _0x8592=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5928[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8592('0x0'));var util=require('util');var path=require(_0x8592('0x1'));var timeout=require(_0x8592('0x2'));var express=require(_0x8592('0x3'));var router=express['Router']();var fs_extra=require(_0x8592('0x4'));var auth=require(_0x8592('0x5'));var interaction=require(_0x8592('0x6'));var config=require(_0x8592('0x7'));var controller=require(_0x8592('0x8'));router[_0x8592('0x9')]('/',auth[_0x8592('0xa')](),controller[_0x8592('0xb')]);router[_0x8592('0x9')](_0x8592('0xc'),auth[_0x8592('0xa')](),controller[_0x8592('0xd')]);router[_0x8592('0xe')]('/',auth[_0x8592('0xa')](),controller[_0x8592('0xf')]);router[_0x8592('0x10')]('/:id',auth[_0x8592('0xa')](),controller['update']);router[_0x8592('0x11')](_0x8592('0xc'),auth['isAuthenticated'](),controller[_0x8592('0x12')]);module[_0x8592('0x13')]=router; \ No newline at end of file +var _0x0d69=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0d69,0xf6));var _0x90d6=function(_0x2e0d28,_0xef0f5d){_0x2e0d28=_0x2e0d28-0x0;var _0x5ef4c7=_0x0d69[_0x2e0d28];return _0x5ef4c7;};'use strict';var multer=require(_0x90d6('0x0'));var util=require(_0x90d6('0x1'));var path=require(_0x90d6('0x2'));var timeout=require(_0x90d6('0x3'));var express=require(_0x90d6('0x4'));var router=express[_0x90d6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x90d6('0x6'));var config=require(_0x90d6('0x7'));var controller=require(_0x90d6('0x8'));router[_0x90d6('0x9')]('/',auth['isAuthenticated'](),controller[_0x90d6('0xa')]);router[_0x90d6('0x9')]('/:id',auth[_0x90d6('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x90d6('0xc')]);router['put'](_0x90d6('0xd'),auth[_0x90d6('0xb')](),controller[_0x90d6('0xe')]);router[_0x90d6('0xf')](_0x90d6('0xd'),auth[_0x90d6('0xb')](),controller[_0x90d6('0x10')]);module[_0x90d6('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 69794d2..df49564 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 _0x35d7=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x35d7,0x190));var _0x735d=function(_0x2f139c,_0x110eb9){_0x2f139c=_0x2f139c-0x0;var _0xd58ac9=_0x35d7[_0x2f139c];return _0xd58ac9;};'use strict';var Sequelize=require(_0x735d('0x0'));module[_0x735d('0x1')]={'priority':{'type':Sequelize[_0x735d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x735d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x735d('0x4')]()},'description':{'type':Sequelize[_0x735d('0x3')]},'interval':{'type':Sequelize[_0x735d('0x3')],'defaultValue':_0x735d('0x5')}}; \ No newline at end of file +var _0xaa59=['noop','exports','INTEGER','STRING'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xaa59,0x1e5));var _0x9aa5=function(_0x42ffb8,_0x51ff4e){_0x42ffb8=_0x42ffb8-0x0;var _0x503045=_0xaa59[_0x42ffb8];return _0x503045;};'use strict';var Sequelize=require('sequelize');module[_0x9aa5('0x0')]={'priority':{'type':Sequelize[_0x9aa5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9aa5('0x2')],'allowNull':![],'defaultValue':_0x9aa5('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9aa5('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index be839fd..46af598 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 _0xf108=['model','fields','attributes','limit','order','sort','merge','type','filter','options','where','includeAll','include','WhatsappApplication','findAll','rows','catch','show','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','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','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','name','map','rawAttributes','fieldName','key','query','keys','filters','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf108,0x1d9));var _0x8f10=function(_0x18cc35,_0x43b1ef){_0x18cc35=_0x18cc35-0x0;var _0x1881a6=_0xf108[_0x18cc35];return _0x1881a6;};'use strict';var emlformat=require(_0x8f10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f10('0x1'));var jsonpatch=require(_0x8f10('0x2'));var rp=require(_0x8f10('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8f10('0x4'));var path=require(_0x8f10('0x5'));var sox=require(_0x8f10('0x6'));var csv=require(_0x8f10('0x7'));var ejs=require(_0x8f10('0x8'));var fs=require('fs');var fs_extra=require(_0x8f10('0x9'));var _=require(_0x8f10('0xa'));var squel=require(_0x8f10('0xb'));var crypto=require(_0x8f10('0xc'));var jsforce=require(_0x8f10('0xd'));var deskjs=require(_0x8f10('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8f10('0xf'));var Papa=require(_0x8f10('0x10'));var Redis=require(_0x8f10('0x11'));var authService=require(_0x8f10('0x12'));var qs=require(_0x8f10('0x13'));var as=require(_0x8f10('0x14'));var hardwareService=require(_0x8f10('0x15'));var logger=require(_0x8f10('0x16'))(_0x8f10('0x17'));var utils=require(_0x8f10('0x18'));var config=require(_0x8f10('0x19'));var licenseUtil=require(_0x8f10('0x1a'));var db=require(_0x8f10('0x1b'))['db'];function respondWithStatusCode(_0x170036,_0x15f79d){_0x15f79d=_0x15f79d||0xcc;return function(_0x4ae80e){if(_0x4ae80e){return _0x170036['sendStatus'](_0x15f79d);}return _0x170036[_0x8f10('0x1c')](_0x15f79d)[_0x8f10('0x1d')]();};}function respondWithResult(_0x472b6f,_0x9b9e1f){_0x9b9e1f=_0x9b9e1f||0xc8;return function(_0x1eaced){if(_0x1eaced){return _0x472b6f[_0x8f10('0x1c')](_0x9b9e1f)[_0x8f10('0x1e')](_0x1eaced);}};}function respondWithFilteredResult(_0x15bae4,_0x295dfc){return function(_0x4cf096){if(_0x4cf096){var _0x17882d=typeof _0x295dfc[_0x8f10('0x1f')]===_0x8f10('0x20')&&typeof _0x295dfc['limit']===_0x8f10('0x20');var _0x22e5fe=_0x4cf096['count'];var _0xdfd335=_0x17882d?0x0:_0x295dfc[_0x8f10('0x1f')];var _0x255e75=_0x17882d?_0x4cf096[_0x8f10('0x21')]:_0x295dfc['offset']+_0x295dfc['limit'];var _0x266a86;if(_0x255e75>=_0x22e5fe){_0x255e75=_0x22e5fe;_0x266a86=0xc8;}else{_0x266a86=0xce;}_0x15bae4[_0x8f10('0x1c')](_0x266a86);return _0x15bae4[_0x8f10('0x22')](_0x8f10('0x23'),_0xdfd335+'-'+_0x255e75+'/'+_0x22e5fe)[_0x8f10('0x1e')](_0x4cf096);}return null;};}function patchUpdates(_0xfdb66e){return function(_0x468fa9){try{jsonpatch[_0x8f10('0x24')](_0x468fa9,_0xfdb66e,!![]);}catch(_0x7bde34){return BPromise[_0x8f10('0x25')](_0x7bde34);}return _0x468fa9[_0x8f10('0x26')]();};}function saveUpdates(_0x506a8f,_0x2550e1){return function(_0x485e83){if(_0x485e83){return _0x485e83['update'](_0x506a8f)['then'](function(_0x24dacc){return _0x24dacc;});}return null;};}function removeEntity(_0x4cc92f,_0x185f2){return function(_0xdaa7dd){if(_0xdaa7dd){return _0xdaa7dd[_0x8f10('0x27')]()[_0x8f10('0x28')](function(){_0x4cc92f[_0x8f10('0x1c')](0xcc)[_0x8f10('0x1d')]();});}};}function handleEntityNotFound(_0x25d3e3,_0x3f0659){return function(_0x20bdfa){if(!_0x20bdfa){_0x25d3e3[_0x8f10('0x29')](0x194);}return _0x20bdfa;};}function handleError(_0x3458a8,_0x4631ac){_0x4631ac=_0x4631ac||0x1f4;return function(_0x27e2dd){logger[_0x8f10('0x2a')](_0x27e2dd['stack']);if(_0x27e2dd[_0x8f10('0x2b')]){delete _0x27e2dd[_0x8f10('0x2b')];}_0x3458a8['status'](_0x4631ac)['send'](_0x27e2dd);};}exports['index']=function(_0x3c1685,_0x11db52){var _0x41fe92={},_0x31033a={},_0x88b61c={'count':0x0,'rows':[]};var _0x4ae723=_[_0x8f10('0x2c')](db['WhatsappApplication'][_0x8f10('0x2d')],function(_0x3126ec){return{'name':_0x3126ec[_0x8f10('0x2e')],'type':_0x3126ec['type'][_0x8f10('0x2f')]};});_0x31033a['model']=_['map'](_0x4ae723,_0x8f10('0x2b'));_0x31033a[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x3c1685[_0x8f10('0x30')]);_0x31033a[_0x8f10('0x32')]=_[_0x8f10('0x33')](_0x31033a[_0x8f10('0x34')],_0x31033a['query']);_0x41fe92['attributes']=_[_0x8f10('0x33')](_0x31033a['model'],qs[_0x8f10('0x35')](_0x3c1685[_0x8f10('0x30')]['fields']));_0x41fe92['attributes']=_0x41fe92[_0x8f10('0x36')]['length']?_0x41fe92[_0x8f10('0x36')]:_0x31033a['model'];if(!_0x3c1685[_0x8f10('0x30')]['hasOwnProperty']('nolimit')){_0x41fe92[_0x8f10('0x37')]=qs['limit'](_0x3c1685[_0x8f10('0x30')][_0x8f10('0x37')]);_0x41fe92[_0x8f10('0x1f')]=qs[_0x8f10('0x1f')](_0x3c1685[_0x8f10('0x30')]['offset']);}_0x41fe92[_0x8f10('0x38')]=qs[_0x8f10('0x39')](_0x3c1685['query'][_0x8f10('0x39')]);_0x41fe92['where']=qs[_0x8f10('0x32')](_['pick'](_0x3c1685[_0x8f10('0x30')],_0x31033a['filters']),_0x4ae723);if(_0x3c1685[_0x8f10('0x30')]['filter']){_0x41fe92['where']=_[_0x8f10('0x3a')](_0x41fe92['where'],{'$or':_[_0x8f10('0x2c')](_0x4ae723,function(_0x31f76e){if(_0x31f76e[_0x8f10('0x3b')]!=='VIRTUAL'){var _0x3df580={};_0x3df580[_0x31f76e[_0x8f10('0x2b')]]={'$like':'%'+_0x3c1685[_0x8f10('0x30')][_0x8f10('0x3c')]+'%'};return _0x3df580;}})});}_0x41fe92=_[_0x8f10('0x3a')]({},_0x41fe92,_0x3c1685[_0x8f10('0x3d')]);var _0x236ad6={'where':_0x41fe92[_0x8f10('0x3e')]};return db['WhatsappApplication'][_0x8f10('0x21')](_0x236ad6)[_0x8f10('0x28')](function(_0x529a6b){_0x88b61c[_0x8f10('0x21')]=_0x529a6b;if(_0x3c1685['query'][_0x8f10('0x3f')]){_0x41fe92[_0x8f10('0x40')]=[{'all':!![]}];}return db[_0x8f10('0x41')][_0x8f10('0x42')](_0x41fe92);})[_0x8f10('0x28')](function(_0x38b49d){_0x88b61c[_0x8f10('0x43')]=_0x38b49d;return _0x88b61c;})[_0x8f10('0x28')](respondWithFilteredResult(_0x11db52,_0x41fe92))[_0x8f10('0x44')](handleError(_0x11db52,null));};exports[_0x8f10('0x45')]=function(_0x14d527,_0x34299b){var _0x148792={'raw':!![],'where':{'id':_0x14d527['params']['id']}},_0x3bb739={};_0x3bb739[_0x8f10('0x34')]=_[_0x8f10('0x31')](db['WhatsappApplication'][_0x8f10('0x2d')]);_0x3bb739[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x14d527[_0x8f10('0x30')]);_0x3bb739[_0x8f10('0x32')]=_[_0x8f10('0x33')](_0x3bb739[_0x8f10('0x34')],_0x3bb739['query']);_0x148792[_0x8f10('0x36')]=_[_0x8f10('0x33')](_0x3bb739[_0x8f10('0x34')],qs['fields'](_0x14d527['query'][_0x8f10('0x35')]));_0x148792[_0x8f10('0x36')]=_0x148792['attributes'][_0x8f10('0x46')]?_0x148792[_0x8f10('0x36')]:_0x3bb739[_0x8f10('0x34')];if(_0x14d527[_0x8f10('0x30')][_0x8f10('0x3f')]){_0x148792[_0x8f10('0x40')]=[{'all':!![]}];}_0x148792=_['merge']({},_0x148792,_0x14d527[_0x8f10('0x3d')]);return db[_0x8f10('0x41')][_0x8f10('0x47')](_0x148792)['then'](handleEntityNotFound(_0x34299b,null))[_0x8f10('0x28')](respondWithResult(_0x34299b,null))[_0x8f10('0x44')](handleError(_0x34299b,null));};exports[_0x8f10('0x48')]=function(_0x455d3a,_0x488b2d){return db[_0x8f10('0x41')][_0x8f10('0x48')](_0x455d3a['body'],{})[_0x8f10('0x28')](respondWithResult(_0x488b2d,0xc9))['catch'](handleError(_0x488b2d,null));};exports['update']=function(_0x414b4b,_0x351b47){if(_0x414b4b[_0x8f10('0x49')]['id']){delete _0x414b4b[_0x8f10('0x49')]['id'];}return db[_0x8f10('0x41')]['find']({'where':{'id':_0x414b4b[_0x8f10('0x4a')]['id']}})[_0x8f10('0x28')](handleEntityNotFound(_0x351b47,null))[_0x8f10('0x28')](saveUpdates(_0x414b4b[_0x8f10('0x49')],null))[_0x8f10('0x28')](respondWithResult(_0x351b47,null))[_0x8f10('0x44')](handleError(_0x351b47,null));};exports[_0x8f10('0x27')]=function(_0x3995a3,_0x3988b5){return db[_0x8f10('0x41')][_0x8f10('0x47')]({'where':{'id':_0x3995a3[_0x8f10('0x4a')]['id']}})[_0x8f10('0x28')](handleEntityNotFound(_0x3988b5,null))['then'](removeEntity(_0x3988b5,null))[_0x8f10('0x44')](handleError(_0x3988b5,null));}; \ No newline at end of file +var _0x0598=['merge','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x0598,0x92));var _0x8059=function(_0x7badea,_0x4e2356){_0x7badea=_0x7badea-0x0;var _0xcaa907=_0x0598[_0x7badea];return _0xcaa907;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['WhatsappApplication']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['WhatsappApplication'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index a8bf21c..b2211fa 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 _0x6c32=['exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var logger=require(_0x26c3('0x2'))(_0x26c3('0x3'));var moment=require(_0x26c3('0x4'));var BPromise=require(_0x26c3('0x5'));var rp=require(_0x26c3('0x6'));var fs=require('fs');var path=require(_0x26c3('0x7'));var rimraf=require(_0x26c3('0x8'));var config=require('../../config/environment');var attributes=require(_0x26c3('0x9'));module[_0x26c3('0xa')]=function(_0x15ac36,_0x57d915){return _0x15ac36[_0x26c3('0xb')]('WhatsappApplication',attributes,{'tableName':_0x26c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x26c3('0xd'),'collate':_0x26c3('0xe')});}; \ No newline at end of file +var _0xfcbd=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xfcbd,0x160));var _0xdfcb=function(_0x2c52a5,_0x350627){_0x2c52a5=_0x2c52a5-0x0;var _0x55f434=_0xfcbd[_0x2c52a5];return _0x55f434;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var attributes=require(_0xdfcb('0x8'));module[_0xdfcb('0x9')]=function(_0x4bdf76,_0x5615a6){return _0x4bdf76[_0xdfcb('0xa')](_0xdfcb('0xb'),attributes,{'tableName':_0xdfcb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdfcb('0xd'),'collate':_0xdfcb('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7344368..a621001 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 _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3d2287,_0x31fd09){var _0x1d69e4=function(_0x1b9963){while(--_0x1b9963){_0x3d2287['push'](_0x3d2287['shift']());}};_0x1d69e4(++_0x31fd09);}(_0x9bde,0xe1));var _0xe9bd=function(_0x7c198b,_0x37f7b9){_0x7c198b=_0x7c198b-0x0;var _0x3ef26f=_0x9bde[_0x7c198b];return _0x3ef26f;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a5f29,_0x923e49){var _0x396203=function(_0x51af5e){while(--_0x51af5e){_0x3a5f29['push'](_0x3a5f29['shift']());}};_0x396203(++_0x923e49);}(_0xa41a,0x6b));var _0xaa41=function(_0x1dd7e1,_0xea6753){_0x1dd7e1=_0x1dd7e1-0x0;var _0x4f7fd0=_0xa41a[_0x1dd7e1];return _0x4f7fd0;};'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);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2fae053..0d33d37 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 _0x84e7=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','/:id/messages','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','/:id/tags','removeTags','exports'];(function(_0x510b09,_0x46d0fb){var _0x13baf1=function(_0x54699a){while(--_0x54699a){_0x510b09['push'](_0x510b09['shift']());}};_0x13baf1(++_0x46d0fb);}(_0x84e7,0x122));var _0x784e=function(_0x25a8e2,_0x186f11){_0x25a8e2=_0x25a8e2-0x0;var _0x1d0949=_0x84e7[_0x25a8e2];return _0x1d0949;};'use strict';var multer=require('multer');var util=require(_0x784e('0x0'));var path=require(_0x784e('0x1'));var timeout=require('connect-timeout');var express=require(_0x784e('0x2'));var router=express[_0x784e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x784e('0x4'));var interaction=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var controller=require(_0x784e('0x7'));router[_0x784e('0x8')]('/',auth[_0x784e('0x9')](),controller['index']);router[_0x784e('0x8')]('/describe',auth[_0x784e('0x9')](),controller[_0x784e('0xa')]);router['get'](_0x784e('0xb'),auth[_0x784e('0x9')](),controller[_0x784e('0xc')]);router[_0x784e('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x784e('0xd')]);router[_0x784e('0x8')](_0x784e('0xe'),auth[_0x784e('0x9')](),controller['download']);router[_0x784e('0xf')]('/',auth[_0x784e('0x9')](),controller[_0x784e('0x10')]);router[_0x784e('0xf')](_0x784e('0x11'),auth[_0x784e('0x9')](),controller['addMessage']);router[_0x784e('0xf')]('/:id/tags',auth[_0x784e('0x9')](),interaction[_0x784e('0x12')](_0x784e('0x13'),_0x784e('0x14')),controller[_0x784e('0x15')]);router[_0x784e('0x16')](_0x784e('0xb'),auth[_0x784e('0x9')](),interaction[_0x784e('0x12')]('whatsapp','whatsappinteraction:update'),controller[_0x784e('0x17')]);router[_0x784e('0x18')](_0x784e('0xb'),auth[_0x784e('0x9')](),interaction[_0x784e('0x12')](_0x784e('0x13'),_0x784e('0x19')),controller['destroy']);router[_0x784e('0x18')](_0x784e('0x1a'),auth[_0x784e('0x9')](),controller[_0x784e('0x1b')]);module[_0x784e('0x1c')]=router; \ No newline at end of file +var _0x06f4=['connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','destroy','delete','multer','util'];(function(_0x2f0dfa,_0x54156b){var _0x384250=function(_0x5ec1e0){while(--_0x5ec1e0){_0x2f0dfa['push'](_0x2f0dfa['shift']());}};_0x384250(++_0x54156b);}(_0x06f4,0x136));var _0x406f=function(_0x367921,_0x2be838){_0x367921=_0x367921-0x0;var _0x2aed3e=_0x06f4[_0x367921];return _0x2aed3e;};'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['get'](_0x406f('0xa'),auth['isAuthenticated'](),controller[_0x406f('0xb')]);router['get'](_0x406f('0xc'),auth['isAuthenticated'](),controller[_0x406f('0xd')]);router[_0x406f('0xe')]('/',auth['isAuthenticated'](),controller[_0x406f('0xf')]);router[_0x406f('0xe')](_0x406f('0xa'),auth[_0x406f('0x8')](),controller[_0x406f('0x10')]);router[_0x406f('0xe')](_0x406f('0x11'),auth[_0x406f('0x8')](),interaction[_0x406f('0x12')](_0x406f('0x13'),_0x406f('0x14')),controller['addTags']);router[_0x406f('0x15')](_0x406f('0x16'),auth[_0x406f('0x8')](),interaction['tracked'](_0x406f('0x13'),_0x406f('0x17')),controller['update']);router['delete'](_0x406f('0x16'),auth[_0x406f('0x8')](),interaction['tracked'](_0x406f('0x13'),'whatsappinteraction:destroy'),controller[_0x406f('0x18')]);router[_0x406f('0x19')](_0x406f('0x11'),auth[_0x406f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 520e345..8838595 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 _0x448b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x448b,0x125));var _0xb448=function(_0x15b65e,_0x1f0a24){_0x15b65e=_0x15b65e-0x0;var _0xd94909=_0x448b[_0x15b65e];return _0xd94909;};'use strict';var Sequelize=require(_0xb448('0x0'));var moment=require(_0xb448('0x1'));module[_0xb448('0x2')]={'closed':{'type':Sequelize[_0xb448('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb448('0x4')]},'disposition':{'type':Sequelize[_0xb448('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb448('0x5')]},'note':{'type':Sequelize[_0xb448('0x5')]},'phone':{'type':Sequelize[_0xb448('0x5')]},'read1stAt':{'type':Sequelize[_0xb448('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb448('0x6')]('in',_0xb448('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb448('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb448('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb448('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xef8b=['STRING','ENUM','out','moment','exports','BOOLEAN','DATE'];(function(_0x113138,_0xa6bd5b){var _0x5b3bf3=function(_0x17c728){while(--_0x17c728){_0x113138['push'](_0x113138['shift']());}};_0x5b3bf3(++_0xa6bd5b);}(_0xef8b,0x192));var _0xbef8=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0xef8b[_0x134448];return _0x2d52a1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbef8('0x0'));module[_0xbef8('0x1')]={'closed':{'type':Sequelize[_0xbef8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbef8('0x3')]},'disposition':{'type':Sequelize[_0xbef8('0x4')]},'secondDisposition':{'type':Sequelize[_0xbef8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbef8('0x4')]},'note':{'type':Sequelize[_0xbef8('0x4')]},'phone':{'type':Sequelize[_0xbef8('0x4')]},'read1stAt':{'type':Sequelize[_0xbef8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbef8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbef8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xbef8('0x5')]('in',_0xbef8('0x6')),'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 9a7f39a..dda4b04 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 _0x8a21=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','status','end','json','undefined','count','offset','limit','set','apply','then','destroy','sendStatus','error','name','send','Users','map','TagIds','Tags','split','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','WhatsappInteraction','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','text','Tag','union','body','buildExpression','start','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','params','include','merge','create','update','describe','WhatsappMessage','addMessage','ids','omit','findOne','pick','$gte','format','options','includeAll','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','unix','join','root','files','tmp','attachments','User','fullname','firstName','lastName','Attachment','Messages','createdAt','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','createReadStream','pipe','createWriteStream','direction','out','System','basename','renderFile','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8a21,0x1d8));var _0x18a2=function(_0x5f34a3,_0x4ba871){_0x5f34a3=_0x5f34a3-0x0;var _0xeabd05=_0x8a21[_0x5f34a3];return _0xeabd05;};'use strict';var emlformat=require(_0x18a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x18a2('0x1'));var rp=require(_0x18a2('0x2'));var moment=require(_0x18a2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x18a2('0x4'));var path=require(_0x18a2('0x5'));var sox=require(_0x18a2('0x6'));var csv=require(_0x18a2('0x7'));var ejs=require(_0x18a2('0x8'));var fs=require('fs');var fs_extra=require(_0x18a2('0x9'));var _=require(_0x18a2('0xa'));var squel=require(_0x18a2('0xb'));var crypto=require('crypto');var jsforce=require(_0x18a2('0xc'));var deskjs=require(_0x18a2('0xd'));var toCsv=require(_0x18a2('0x7'));var querystring=require('querystring');var Papa=require(_0x18a2('0xe'));var Redis=require(_0x18a2('0xf'));var authService=require(_0x18a2('0x10'));var qs=require(_0x18a2('0x11'));var as=require(_0x18a2('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x18a2('0x13'));var logger=require(_0x18a2('0x14'))('api');var utils=require(_0x18a2('0x15'));var config=require(_0x18a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x18a2('0x17'))['db'];config[_0x18a2('0x18')]=_['defaults'](config[_0x18a2('0x18')],{'host':_0x18a2('0x19'),'port':0x18eb});var socket=require(_0x18a2('0x1a'))(new Redis(config[_0x18a2('0x18')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1c5302,_0x537943){_0x537943=_0x537943||0xcc;return function(_0x29e733){if(_0x29e733){return _0x1c5302['sendStatus'](_0x537943);}return _0x1c5302[_0x18a2('0x1b')](_0x537943)[_0x18a2('0x1c')]();};}function respondWithResult(_0x2633f0,_0x523bd8){_0x523bd8=_0x523bd8||0xc8;return function(_0x12b11f){if(_0x12b11f){return _0x2633f0[_0x18a2('0x1b')](_0x523bd8)[_0x18a2('0x1d')](_0x12b11f);}};}function respondWithFilteredResult(_0xa5894d,_0x22296a){return function(_0x4e5da2){if(_0x4e5da2){var _0x26929f=typeof _0x22296a['offset']===_0x18a2('0x1e')&&typeof _0x22296a['limit']===_0x18a2('0x1e');var _0x45840e=_0x4e5da2[_0x18a2('0x1f')];var _0x2c418d=_0x26929f?0x0:_0x22296a[_0x18a2('0x20')];var _0x227fd0=_0x26929f?_0x4e5da2[_0x18a2('0x1f')]:_0x22296a[_0x18a2('0x20')]+_0x22296a[_0x18a2('0x21')];var _0x2ac173;if(_0x227fd0>=_0x45840e){_0x227fd0=_0x45840e;_0x2ac173=0xc8;}else{_0x2ac173=0xce;}_0xa5894d[_0x18a2('0x1b')](_0x2ac173);return _0xa5894d[_0x18a2('0x22')]('Content-Range',_0x2c418d+'-'+_0x227fd0+'/'+_0x45840e)[_0x18a2('0x1d')](_0x4e5da2);}return null;};}function patchUpdates(_0x357693){return function(_0x123254){try{jsonpatch[_0x18a2('0x23')](_0x123254,_0x357693,!![]);}catch(_0x3fdf6c){return BPromise['reject'](_0x3fdf6c);}return _0x123254['save']();};}function saveUpdates(_0x53c982,_0x2f6484){return function(_0x1c0da1){if(_0x1c0da1){return _0x1c0da1['update'](_0x53c982)[_0x18a2('0x24')](function(_0x3be4db){return _0x3be4db;});}return null;};}function removeEntity(_0x531eb3,_0x4e7003){return function(_0x327d81){if(_0x327d81){return _0x327d81[_0x18a2('0x25')]()[_0x18a2('0x24')](function(){_0x531eb3[_0x18a2('0x1b')](0xcc)[_0x18a2('0x1c')]();});}};}function handleEntityNotFound(_0xa36477,_0x3e9543){return function(_0x3c17c1){if(!_0x3c17c1){_0xa36477[_0x18a2('0x26')](0x194);}return _0x3c17c1;};}function handleError(_0x335b0b,_0x562df1){_0x562df1=_0x562df1||0x1f4;return function(_0x43a4f8){logger[_0x18a2('0x27')](_0x43a4f8['stack']);if(_0x43a4f8[_0x18a2('0x28')]){delete _0x43a4f8[_0x18a2('0x28')];}_0x335b0b[_0x18a2('0x1b')](_0x562df1)[_0x18a2('0x29')](_0x43a4f8);};}function getInteractionUsers(_0x42567c,_0x56b765){return new BPromise(function(_0x2bad4c,_0xf8983d){try{if(_0x56b765[_0x42567c['id']]){_0x42567c[_0x18a2('0x2a')]=_[_0x18a2('0x2b')](_0x56b765[_0x42567c['id']],function(_0xedeb1b){return{'id':_0xedeb1b['id'],'fullname':_0xedeb1b['fullname']};});}}catch(_0x29d703){_0xf8983d(_0x29d703);}_0x2bad4c(_0x42567c);});}function getInteractionTags(_0x29e477,_0x1fa180){return new BPromise(function(_0x11a086,_0x589d46){try{if(_0x29e477[_0x18a2('0x2c')]){_0x29e477[_0x18a2('0x2d')]=[];_0x29e477[_0x18a2('0x2c')][_0x18a2('0x2e')](',')['forEach'](function(_0x2f3701){_0x29e477[_0x18a2('0x2d')][_0x18a2('0x2f')](_0x1fa180[_0x2f3701]);});}delete _0x29e477[_0x18a2('0x2c')];}catch(_0x380c99){_0x589d46(_0x380c99);}_0x11a086(_0x29e477);});}function updateWhatsappInteraction(_0x311559,_0x547091,_0x206252){return new BPromise(function(_0x37c56e,_0x2a74e9){return getInteractionUsers(_0x311559,_0x206252)[_0x18a2('0x24')](function(_0x500210){return getInteractionTags(_0x500210,_0x547091);})['then'](function(_0x2a06e0){return getStateInteraction(_0x2a06e0);})['then'](function(_0x1a9437){_0x37c56e(_0x1a9437);})[_0x18a2('0x30')](function(_0x42a851){_0x2a74e9(_0x42a851);});});}function getStateInteraction(_0x3961f5){return new BPromise(function(_0x50dc2c){_0x3961f5[_0x18a2('0x31')]=0x0;_0x3961f5[_0x18a2('0x32')]=0x0;_0x3961f5['answered']=0x0;_0x3961f5[_0x18a2('0x33')]=0x0;_0x3961f5[_0x18a2('0x34')]=0x0;if(!_0x3961f5[_0x18a2('0x35')]&&!_0x3961f5[_0x18a2('0x36')]){_0x3961f5[_0x18a2('0x31')]+=0x1;}if(!_0x3961f5['closed']&&_0x3961f5[_0x18a2('0x36')]){_0x3961f5[_0x18a2('0x32')]+=0x1;if(_0x3961f5[_0x18a2('0x31')]){_0x3961f5[_0x18a2('0x31')]-=0x1;}}if(_0x3961f5['closed']&&_0x3961f5['UserId']){_0x3961f5[_0x18a2('0x37')]+=0x1;if(_0x3961f5['talking']){_0x3961f5[_0x18a2('0x32')]-=0x1;}}if(_0x3961f5[_0x18a2('0x35')]&&!_0x3961f5[_0x18a2('0x36')]){_0x3961f5[_0x18a2('0x33')]+=0x1;if(_0x3961f5[_0x18a2('0x31')]){_0x3961f5[_0x18a2('0x31')]-=0x1;}}_0x3961f5[_0x18a2('0x34')]+=0x1;_0x50dc2c(_0x3961f5);});}exports['index']=function(_0x1239ca,_0x2e94d6){var _0x50134d={},_0x1a8461={},_0x3631a9={'count':0x0,'rows':[]};var _0x55f902=_[_0x18a2('0x2b')](db[_0x18a2('0x38')][_0x18a2('0x39')],function(_0x200080){return{'name':_0x200080['fieldName'],'type':_0x200080[_0x18a2('0x3a')]['key']};});_0x1a8461[_0x18a2('0x3b')]=_[_0x18a2('0x2b')](_0x55f902,_0x18a2('0x28'));_0x1a8461[_0x18a2('0x3c')]=_[_0x18a2('0x3d')](_0x1239ca[_0x18a2('0x3c')]);_0x1a8461[_0x18a2('0x3e')]=_[_0x18a2('0x3f')](_0x1a8461[_0x18a2('0x3b')],_0x1a8461[_0x18a2('0x3c')]);_0x50134d[_0x18a2('0x40')]=_['intersection'](_0x1a8461['model'],qs[_0x18a2('0x41')](_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x41')]));_0x50134d['attributes']=_0x50134d[_0x18a2('0x40')][_0x18a2('0x42')]?_0x50134d[_0x18a2('0x40')]:_0x1a8461[_0x18a2('0x3b')];if(!_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x43')](_0x18a2('0x44'))){_0x50134d[_0x18a2('0x21')]=qs[_0x18a2('0x21')](_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x21')]);_0x50134d[_0x18a2('0x20')]=qs[_0x18a2('0x20')](_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x20')]);}_0x50134d[_0x18a2('0x45')]=qs[_0x18a2('0x46')](_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x46')]);_0x50134d[_0x18a2('0x47')]=qs[_0x18a2('0x3e')](_['pick'](_0x1239ca['query'],_0x1a8461[_0x18a2('0x3e')]),_0x55f902);var _0x57eca3=[];var _0x592add=squel[_0x18a2('0x48')]()[_0x18a2('0x49')]('id')[_0x18a2('0x49')]('name')[_0x18a2('0x49')](_0x18a2('0x4a'))[_0x18a2('0x4b')]('tools_tags');var _0x31c192=squel['select']()[_0x18a2('0x49')](_0x18a2('0x4c'))[_0x18a2('0x49')](_0x18a2('0x4d'))[_0x18a2('0x49')](_0x18a2('0x4e'))[_0x18a2('0x4b')](_0x18a2('0x4f'),'ui')[_0x18a2('0x50')](_0x18a2('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x18b348=squel[_0x18a2('0x48')]()['from'](_0x18a2('0x52'),'i')[_0x18a2('0x50')](_0x18a2('0x53'),'c',_0x18a2('0x54'))[_0x18a2('0x50')](_0x18a2('0x51'),'o',_0x18a2('0x55'))[_0x18a2('0x50')](_0x18a2('0x56'),'a',_0x18a2('0x57'))[_0x18a2('0x50')](_0x18a2('0x58'),'me',_0x18a2('0x59'))[_0x18a2('0x50')](_0x18a2('0x5a'),'it',_0x18a2('0x5b'))[_0x18a2('0x50')](_0x18a2('0x5c'),'t',_0x18a2('0x5d'));var _0x1398e4=squel[_0x18a2('0x5e')]();var _0x43c3f3=[];var _0x15a3b9=squel[_0x18a2('0x5e')]();var _0xb331bc;if(_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x5f')]){_0xb331bc=as['parseSearch'](_0x1239ca['query'][_0x18a2('0x5f')]);var _0x4c228c=_0xb331bc[_0x18a2('0x60')];for(var _0x329221=0x0;_0x329221<_0xb331bc[_0x18a2('0x61')][_0x18a2('0x42')];_0x329221++){var _0xbb8d68=_0xb331bc[_0x18a2('0x61')][_0x329221];var _0x5f0688='i';var _0x156871=_[_0x18a2('0x62')](_0x55f902,[_0x18a2('0x28'),_0xbb8d68[_0x18a2('0x49')]]);if(!_0x156871){switch(_0xbb8d68[_0x18a2('0x49')]){case _0x18a2('0x63'):if(_0xbb8d68[_0x18a2('0x64')]==0x1){_0x18b348[_0x18a2('0x65')]('`'+_0xbb8d68[_0x18a2('0x49')]+_0x18a2('0x66'));}else{_0x18b348['having']('`'+_0xbb8d68[_0x18a2('0x49')]+_0x18a2('0x67'));}break;case _0x18a2('0x68'):if(_0xbb8d68[_0x18a2('0x69')]===_0x18a2('0x6a')){if(_0xbb8d68[_0x18a2('0x64')]['split']('\x20')[_0x18a2('0x42')]>0x1){_0x1398e4[_0x4c228c](_0x18a2('0x6b'),qs[_0x18a2('0x6c')](_0xbb8d68['value']),null);}else{var _0x2509e0='%'+_0xbb8d68[_0x18a2('0x64')]+'%';_0x1398e4[_0x4c228c](_0x18a2('0x6d'),_0x2509e0,_0x2509e0,_0x2509e0);}}else{_0x156871=_['find'](_0x55f902,[_0x18a2('0x28'),'ContactId']);_0xbb8d68[_0x18a2('0x49')]='ContactId';_0x5790c6=as['buildExpression'](_0x5f0688,_0x156871[_0x18a2('0x3a')],_0xbb8d68);_0x1398e4[_0x4c228c](_0x5790c6[_0x18a2('0x6e')],_0x5790c6[_0x18a2('0x64')]['start'],_0x5790c6[_0x18a2('0x64')][_0x18a2('0x1c')]);}break;case _0x18a2('0x6f'):var _0x455280=_0xbb8d68['value'][_0x18a2('0x2e')](',')[_0x18a2('0x2b')](function(_0x47666b){return Number(_0x47666b);});_0x455280['forEach'](function(_0x537c9e){_0x15a3b9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x537c9e+',%');});_0x43c3f3=_[_0x18a2('0x70')](_0x43c3f3,_0x455280);break;case'User':if(_0xbb8d68[_0x18a2('0x69')]===_0x18a2('0x6a')){_0x1398e4[_0x4c228c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xbb8d68['value']+'%',null);}else{_0x156871=_[_0x18a2('0x62')](_0x55f902,[_0x18a2('0x28'),_0x18a2('0x36')]);_0xbb8d68[_0x18a2('0x49')]=_0x18a2('0x36');_0x5790c6=as['buildExpression'](_0x5f0688,_0x156871[_0x18a2('0x3a')],_0xbb8d68);_0x1398e4[_0x4c228c](_0x5790c6['text'],_0x5790c6[_0x18a2('0x64')]['start'],_0x5790c6[_0x18a2('0x64')]['end']);}break;case _0x18a2('0x71'):_0x5790c6=as[_0x18a2('0x72')]('me',null,_0xbb8d68);_0x1398e4[_0x4c228c](_0x5790c6[_0x18a2('0x6e')],_0x5790c6[_0x18a2('0x64')]['start'],_0x5790c6[_0x18a2('0x64')]['end']);break;}}else{var _0x5790c6=as[_0x18a2('0x72')](_0x5f0688,_0x156871[_0x18a2('0x3a')],_0xbb8d68);_0x1398e4[_0x4c228c](_0x5790c6['text'],_0x5790c6[_0x18a2('0x64')][_0x18a2('0x73')],_0x5790c6[_0x18a2('0x64')][_0x18a2('0x1c')]);}}}else{var _0x4e904e=_(_0x1239ca[_0x18a2('0x3c')])[_0x18a2('0x3d')]()[_0x18a2('0x2b')](function(_0x1d500a){return _[_0x18a2('0x74')](_0x55f902,[_0x18a2('0x28'),_0x1d500a])?_0x1d500a:undefined;})[_0x18a2('0x75')]()[_0x18a2('0x64')]();if(!_[_0x18a2('0x76')](_0x4e904e)){_0x4e904e['forEach'](function(_0x445d72){if(_0x445d72===_0x18a2('0x77')){_0x18b348[_0x18a2('0x47')](_0x18a2('0x78'),[][_0x18a2('0x79')](_0x1239ca['query'][_0x445d72]));}else if(_0x445d72==='createdAt'){var _0x504e81=JSON[_0x18a2('0x7a')](_0x1239ca[_0x18a2('0x3c')][_0x445d72])['$gte'];var _0x12cc4b=JSON[_0x18a2('0x7a')](_0x1239ca[_0x18a2('0x3c')][_0x445d72])[_0x18a2('0x7b')];_0x18b348['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x504e81,_0x12cc4b);}else{if(_0x1239ca[_0x18a2('0x3c')][_0x445d72]===_0x18a2('0x7c')){_0x18b348[_0x18a2('0x47')]('i.'+_0x445d72+_0x18a2('0x7d'));}else{_0x18b348[_0x18a2('0x47')]('i.'+_0x445d72+_0x18a2('0x7e'),_0x1239ca[_0x18a2('0x3c')][_0x445d72]);}}});}if(_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x7f')]){if(_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x7f')]==0x1){_0x18b348[_0x18a2('0x65')](_0x18a2('0x80'));}else{_0x18b348[_0x18a2('0x65')](_0x18a2('0x81'));}}if(_0x1239ca[_0x18a2('0x3c')]['tag']){_0x43c3f3=_[_0x18a2('0x82')](_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x83')])?_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x83')]:new Array(_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x83')]);_0x43c3f3[_0x18a2('0x84')](function(_0x389d9d){_0x15a3b9['or'](_0x18a2('0x85'),'%,'+_0x389d9d+',%');});}if(_0x1239ca['query'][_0x18a2('0x86')]){var _0x49c322=_0x1239ca[_0x18a2('0x3c')]['filter'][_0x18a2('0x87')]('\x5c','\x5c\x5c')[_0x18a2('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x49c322)){_0x1398e4['or'](_0x18a2('0x88'),_0x49c322+'%')['or'](_0x18a2('0x89'),_0x49c322+'%');}else{_0x1398e4['or'](_0x18a2('0x8a'),qs[_0x18a2('0x6c')](_0x49c322))['or'](_0x18a2('0x8b'),_0x49c322+'%');}}}_0x18b348[_0x18a2('0x47')](_0x1398e4);_0x18b348[_0x18a2('0x8c')](_0x18a2('0x8d'));var _0x44f88e={'type':db[_0x18a2('0x8e')][_0x18a2('0x8f')][_0x18a2('0x90')],'raw':!![]};var _0x1adfb5=_0x18b348['clone']();_0x1adfb5['field'](_0x18a2('0x8d'));_0x1adfb5[_0x18a2('0x49')](_0x18a2('0x91'),_0x18a2('0x63'));if(_0x50134d[_0x18a2('0x45')]){_0x50134d[_0x18a2('0x45')][_0x18a2('0x84')](function(_0x551db2){var _0xc02426=_0x551db2[0x0]===_0x18a2('0x92')?_0x551db2[0x0]:'i.'+_0x551db2[0x0];_0x18b348[_0x18a2('0x45')](_0xc02426,_0x551db2[0x1]===_0x18a2('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x43c3f3)){_0x18b348['having'](_0x15a3b9);_0x1adfb5[_0x18a2('0x47')]('t.id\x20IN\x20?',_0x43c3f3);}BPromise[_0x18a2('0x94')]()['then'](function(){if(!_0xb331bc){if(_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x77')])return;_0x1adfb5[_0x18a2('0x47')](_0x18a2('0x95'));_0x18b348['where'](_0x18a2('0x95'));return;}if(_0x1239ca[_0x18a2('0x96')][_0x18a2('0x97')]!==_0x18a2('0x98'))return;return _0x1239ca[_0x18a2('0x96')][_0x18a2('0x99')]({'attributes':['id'],'raw':!![]})[_0x18a2('0x24')](function(_0x82e5a9){if(_[_0x18a2('0x76')](_0x82e5a9)){_0x1adfb5[_0x18a2('0x47')](_0x18a2('0x9a'));_0x18b348['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x1adfb5[_0x18a2('0x47')](_0x18a2('0x78'),_[_0x18a2('0x2b')](_0x82e5a9,'id'));_0x18b348[_0x18a2('0x47')](_0x18a2('0x78'),_['map'](_0x82e5a9,'id'));}});})['then'](function(){if(_0x1239ca[_0x18a2('0x96')][_0x18a2('0x97')]==='agent'&&!_0xb331bc&&!_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x77')])return[];return db[_0x18a2('0x9b')][_0x18a2('0x3c')](_0x1adfb5[_0x18a2('0x9c')](),_0x44f88e);})[_0x18a2('0x24')](function(_0x39255f){_0x3631a9[_0x18a2('0x1f')]=_0x39255f['length'];if(_0x3631a9[_0x18a2('0x1f')]===0x0)return[];return db[_0x18a2('0x9b')][_0x18a2('0x3c')](_0x592add[_0x18a2('0x9c')](),_0x44f88e)[_0x18a2('0x24')](function(_0x5d0f6a){_0x57eca3=_[_0x18a2('0x9d')](_0x5d0f6a,'id');_0x44f88e=_['merge'](_0x44f88e,{'model':db[_0x18a2('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1239ca[_0x18a2('0x3c')][_0x18a2('0x41')]){_0x50134d[_0x18a2('0x40')]['forEach'](function(_0x2d4527){_0x18b348[_0x18a2('0x49')]('i.'+_0x2d4527);});}else{_0x18b348['field'](_0x18a2('0x91'),_0x18a2('0x63'));_0x18b348['field'](_0x18a2('0x9e'),_0x18a2('0x9f'));_0x18b348[_0x18a2('0x49')](_0x18a2('0xa0'),_0x18a2('0xa1'));_0x18b348[_0x18a2('0x49')](_0x18a2('0xa2'),_0x18a2('0x92'));_0x18b348[_0x18a2('0x49')](_0x18a2('0xa3'));_0x18b348[_0x18a2('0x49')](_0x18a2('0xa4'),'Contact.firstName');_0x18b348['field'](_0x18a2('0xa5'),_0x18a2('0xa6'));_0x18b348[_0x18a2('0x49')]('c.email',_0x18a2('0xa7'));_0x18b348[_0x18a2('0x49')](_0x18a2('0xa8'),_0x18a2('0xa9'));_0x18b348[_0x18a2('0x49')]('c.mobile',_0x18a2('0xaa'));_0x18b348[_0x18a2('0x49')]('c.fax',_0x18a2('0xab'));_0x18b348[_0x18a2('0x49')](_0x18a2('0xac'),'Owner.fullname');_0x18b348[_0x18a2('0x49')]('o.internal',_0x18a2('0xad'));_0x18b348[_0x18a2('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x18a2('0x2c'));}if(_0x50134d[_0x18a2('0x21')])_0x18b348[_0x18a2('0x21')](_0x50134d[_0x18a2('0x21')]);if(_0x50134d[_0x18a2('0x20')])_0x18b348['offset'](_0x50134d[_0x18a2('0x20')]);return db['sequelize'][_0x18a2('0x3c')](_0x18b348[_0x18a2('0x9c')](),_0x44f88e);})['then'](function(_0x48b6ce){if(_0x48b6ce[_0x18a2('0x42')]>0x0)_0x31c192[_0x18a2('0x47')](_0x18a2('0xae'),_['map'](_0x48b6ce,'id'));return db['sequelize']['query'](_0x31c192[_0x18a2('0x9c')](),_0x44f88e)[_0x18a2('0x24')](function(_0x7ae51b){var _0x2e6e8d=_[_0x18a2('0xaf')](_0x7ae51b,_0x18a2('0xb0'));var _0x45341d=[];_0x48b6ce[_0x18a2('0x84')](function(_0x17cb08){_0x45341d[_0x18a2('0x2f')](updateWhatsappInteraction(_0x17cb08,_0x57eca3,_0x2e6e8d));});return BPromise['all'](_0x45341d);});});})[_0x18a2('0x24')](function(_0x491039){_0x3631a9[_0x18a2('0xb1')]=_0x491039;return _0x3631a9;})[_0x18a2('0x24')](respondWithFilteredResult(_0x2e94d6,_0x50134d))[_0x18a2('0x30')](handleError(_0x2e94d6,null));};exports[_0x18a2('0xb2')]=function(_0x3c24e0,_0x3f39e3){var _0x28151c={'raw':![],'where':{'id':_0x3c24e0[_0x18a2('0xb3')]['id']}},_0x95dab3={};_0x95dab3[_0x18a2('0x3b')]=_[_0x18a2('0x3d')](db[_0x18a2('0x38')][_0x18a2('0x39')]);_0x95dab3['query']=_[_0x18a2('0x3d')](_0x3c24e0[_0x18a2('0x3c')]);_0x95dab3['filters']=_[_0x18a2('0x3f')](_0x95dab3[_0x18a2('0x3b')],_0x95dab3[_0x18a2('0x3c')]);_0x28151c[_0x18a2('0x40')]=_['intersection'](_0x95dab3['model'],qs[_0x18a2('0x41')](_0x3c24e0[_0x18a2('0x3c')][_0x18a2('0x41')]));_0x28151c[_0x18a2('0x40')]=_0x28151c[_0x18a2('0x40')]['length']?_0x28151c['attributes']:_0x95dab3['model'];if(_0x3c24e0[_0x18a2('0x3c')]['includeAll']){_0x28151c[_0x18a2('0xb4')]=[{'all':!![]}];}_0x28151c=_[_0x18a2('0xb5')]({},_0x28151c,_0x3c24e0['options']);return db[_0x18a2('0x38')][_0x18a2('0x62')](_0x28151c)[_0x18a2('0x24')](handleEntityNotFound(_0x3f39e3,null))[_0x18a2('0x24')](respondWithResult(_0x3f39e3,null))[_0x18a2('0x30')](handleError(_0x3f39e3,null));};exports[_0x18a2('0xb6')]=function(_0x4b7205,_0x5d3d69){return db[_0x18a2('0x38')][_0x18a2('0xb6')](_0x4b7205[_0x18a2('0x71')],{})[_0x18a2('0x24')](respondWithResult(_0x5d3d69,0xc9))[_0x18a2('0x30')](handleError(_0x5d3d69,null));};exports[_0x18a2('0xb7')]=function(_0xe33188,_0x14ebd3){if(_0xe33188[_0x18a2('0x71')]['id']){delete _0xe33188[_0x18a2('0x71')]['id'];}return db['WhatsappInteraction'][_0x18a2('0x62')]({'where':{'id':_0xe33188['params']['id']}})[_0x18a2('0x24')](handleEntityNotFound(_0x14ebd3,null))[_0x18a2('0x24')](saveUpdates(_0xe33188[_0x18a2('0x71')],null))['then'](respondWithResult(_0x14ebd3,null))[_0x18a2('0x30')](handleError(_0x14ebd3,null));};exports[_0x18a2('0x25')]=function(_0x2ed9ba,_0x1cbd89){return db['WhatsappInteraction']['find']({'where':{'id':_0x2ed9ba[_0x18a2('0xb3')]['id']}})[_0x18a2('0x24')](handleEntityNotFound(_0x1cbd89,null))['then'](removeEntity(_0x1cbd89,null))['catch'](handleError(_0x1cbd89,null));};exports[_0x18a2('0xb8')]=function(_0x3db6cd,_0x2f0716){return db['WhatsappInteraction']['describe']()[_0x18a2('0x24')](respondWithResult(_0x2f0716,null))[_0x18a2('0x30')](handleError(_0x2f0716,null));};exports['addMessage']=function(_0x238293,_0x21832e,_0x542f27){return db[_0x18a2('0xb9')]['find']({'where':{'id':_0x238293[_0x18a2('0xb3')]['id']}})[_0x18a2('0x24')](handleEntityNotFound(_0x21832e,null))['then'](function(_0x4bd815){if(_0x4bd815){return _0x4bd815[_0x18a2('0xba')](_0x238293[_0x18a2('0x71')][_0x18a2('0xbb')],_[_0x18a2('0xbc')](_0x238293[_0x18a2('0x71')],['ids','id'])||{});}})[_0x18a2('0x24')](respondWithResult(_0x21832e,null))[_0x18a2('0x30')](handleError(_0x21832e,null));};exports['getMessages']=function(_0x3715d0,_0x204d04,_0x3720f3){var _0xd253b3={'raw':![],'where':{}};var _0x17e5bc={};var _0x108e85={'count':0x0,'rows':[]};return db[_0x18a2('0x38')][_0x18a2('0xbd')]({'where':{'id':_0x3715d0['params']['id']}})['then'](handleEntityNotFound(_0x204d04,null))[_0x18a2('0x24')](function(_0x4b71b0){if(_0x4b71b0){_0x17e5bc[_0x18a2('0x3b')]=_[_0x18a2('0x3d')](db[_0x18a2('0xb9')][_0x18a2('0x39')]);_0x17e5bc[_0x18a2('0x3c')]=_[_0x18a2('0x3d')](_0x3715d0['query']);_0x17e5bc[_0x18a2('0x3e')]=_['intersection'](_0x17e5bc['model'],_0x17e5bc[_0x18a2('0x3c')]);_0xd253b3[_0x18a2('0x40')]=_[_0x18a2('0x3f')](_0x17e5bc['model'],qs[_0x18a2('0x41')](_0x3715d0['query'][_0x18a2('0x41')]));_0xd253b3[_0x18a2('0x40')]=_0xd253b3[_0x18a2('0x40')][_0x18a2('0x42')]?_0xd253b3[_0x18a2('0x40')]:_0x17e5bc['model'];if(!_0x3715d0[_0x18a2('0x3c')][_0x18a2('0x43')](_0x18a2('0x44'))){_0xd253b3[_0x18a2('0x21')]=qs[_0x18a2('0x21')](_0x3715d0[_0x18a2('0x3c')][_0x18a2('0x21')]);_0xd253b3[_0x18a2('0x20')]=qs[_0x18a2('0x20')](_0x3715d0[_0x18a2('0x3c')][_0x18a2('0x20')]);}_0xd253b3['order']=qs[_0x18a2('0x46')](_0x3715d0[_0x18a2('0x3c')][_0x18a2('0x46')]);_0xd253b3[_0x18a2('0x47')]=qs[_0x18a2('0x3e')](_[_0x18a2('0xbe')](_0x3715d0['query'],_0x17e5bc['filters']));_0xd253b3[_0x18a2('0x47')]['WhatsappInteractionId']=_0x4b71b0['id'];if(_0x3715d0[_0x18a2('0x3c')][_0x18a2('0x86')]){_0xd253b3['where']=_[_0x18a2('0xb5')](_0xd253b3['where'],{'$or':_['map'](_0xd253b3['attributes'],function(_0x52da3b){var _0x279f16={};_0x279f16[_0x52da3b]={'$like':'%'+_0x3715d0[_0x18a2('0x3c')][_0x18a2('0x86')]+'%'};return _0x279f16;})});}if(_0x3715d0[_0x18a2('0x3c')][_0x18a2('0xbf')]){var _0x570c5b=_0x3715d0[_0x18a2('0x3c')][_0x18a2('0xbf')][_0x18a2('0x2e')](',');var _0x4bc346={};_0x4bc346[_0x570c5b[0x0]]={'$gte':moment(_0x570c5b[0x1])[_0x18a2('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0xd253b3[_0x18a2('0x47')]=_['merge'](_0xd253b3[_0x18a2('0x47')],_0x4bc346);}_0xd253b3=_['merge']({},_0xd253b3,_0x3715d0[_0x18a2('0xc1')]);return db['WhatsappMessage'][_0x18a2('0x1f')]({'where':_0xd253b3[_0x18a2('0x47')]})['then'](function(_0x6ff18b){_0x108e85[_0x18a2('0x1f')]=_0x6ff18b;if(_0x3715d0['query'][_0x18a2('0xc2')]){_0xd253b3['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0xd253b3);})[_0x18a2('0x24')](function(_0x2715e0){_0x108e85[_0x18a2('0xb1')]=_0x2715e0;return _0x108e85;});}})[_0x18a2('0x24')](respondWithFilteredResult(_0x204d04,_0xd253b3))[_0x18a2('0x30')](handleError(_0x204d04,null));};exports['addTags']=function(_0x208d50,_0x300ac7,_0x287337){return db[_0x18a2('0x38')][_0x18a2('0x62')]({'where':{'id':_0x208d50[_0x18a2('0xb3')]['id']}})[_0x18a2('0x24')](handleEntityNotFound(_0x300ac7,null))[_0x18a2('0x24')](function(_0x24dc07){if(_0x24dc07){return _0x24dc07[_0x18a2('0xc3')](_0x208d50[_0x18a2('0x71')][_0x18a2('0xbb')],_[_0x18a2('0xbc')](_0x208d50[_0x18a2('0x71')],['ids','id'])||{})[_0x18a2('0xc4')](function(){return db[_0x18a2('0x6f')][_0x18a2('0xc5')]({'attributes':['id',_0x18a2('0x28'),_0x18a2('0x4a')],'where':{'id':_0x208d50[_0x18a2('0x71')]['ids']}});})[_0x18a2('0x24')](function(_0x2a53d8){socket[_0x18a2('0xc6')](_0x18a2('0xc7'),{'id':Number(_0x208d50['params']['id']),'tags':_0x2a53d8||[]});return{'id':Number(_0x208d50[_0x18a2('0xb3')]['id']),'tags':_0x2a53d8||[]};});}})['then'](respondWithResult(_0x300ac7,null))[_0x18a2('0x30')](handleError(_0x300ac7,null));};exports[_0x18a2('0xc8')]=function(_0x481358,_0xb8f389,_0x322093){return db['WhatsappInteraction'][_0x18a2('0x62')]({'where':{'id':_0x481358[_0x18a2('0xb3')]['id']}})['then'](handleEntityNotFound(_0xb8f389,null))[_0x18a2('0x24')](function(_0x414e3a){if(_0x414e3a){return _0x414e3a[_0x18a2('0xc8')](_0x481358[_0x18a2('0x3c')][_0x18a2('0xbb')]);}})[_0x18a2('0x24')](respondWithStatusCode(_0xb8f389,null))['catch'](handleError(_0xb8f389,null));};exports['download']=function(_0x278f39,_0x596327){var _0x5bdde4=moment()[_0x18a2('0xc9')]()[_0x18a2('0x9c')]();var _0x2171ba=path[_0x18a2('0xca')](config[_0x18a2('0xcb')],'server',_0x18a2('0xcc'),_0x18a2('0xcd'));var _0x416e23=path[_0x18a2('0xca')](config[_0x18a2('0xcb')],'server',_0x18a2('0xcc'),_0x18a2('0xce'));var _0x206a3d=path['join'](_0x2171ba,_0x5bdde4);var _0x53e356=util['format']('transcript-%d-%s.zip',_0x278f39[_0x18a2('0xb3')]['id'],_0x5bdde4);var _0x1d5a9b=path[_0x18a2('0xca')](_0x2171ba,_0x53e356);var _0xad4474=[];_0xad4474[_0x18a2('0x2f')]({'model':db[_0x18a2('0xcf')],'as':_0x18a2('0xcf'),'attributes':['id',_0x18a2('0xd0')],'raw':!![]});_0xad4474[_0x18a2('0x2f')]({'model':db['CmContact'],'as':_0x18a2('0x68'),'attributes':['id',_0x18a2('0xd1'),_0x18a2('0xd2')],'raw':!![]});if(_0x278f39[_0x18a2('0x3c')][_0x18a2('0xce')]){_0xad4474[_0x18a2('0x2f')]({'model':db[_0x18a2('0xd3')],'as':'Attachment','raw':!![]});}var _0x430b0a=[{'model':db[_0x18a2('0xb9')],'as':_0x18a2('0xd4'),'attributes':['id',_0x18a2('0x71'),_0x18a2('0xd5'),'direction',_0x18a2('0xd6'),'read'],'include':_0xad4474}];_0x430b0a[_0x18a2('0x2f')]({'model':db[_0x18a2('0xd7')],'as':_0x18a2('0xd8'),'attributes':['id','name']});_0x430b0a[_0x18a2('0x2f')]({'model':db['User'],'as':_0x18a2('0xd9'),'attributes':['id','fullname']});return db[_0x18a2('0x38')][_0x18a2('0x62')]({'where':{'id':_0x278f39[_0x18a2('0xb3')]['id']},'include':_0x430b0a})['then'](handleEntityNotFound(_0x596327,null))[_0x18a2('0x24')](function(_0x4f271e){if(_0x4f271e){var _0x5a2b1f=_0x4f271e[_0x18a2('0xda')]({'plain':!![]});fs[_0x18a2('0xdb')](_0x206a3d);var _0x2bcfa6={'channel':_0x18a2('0xdc'),'account':_0x5a2b1f[_0x18a2('0xd8')][_0x18a2('0x28')],'agent':_0x5a2b1f[_0x18a2('0xd9')]?_0x5a2b1f[_0x18a2('0xd9')][_0x18a2('0xd0')]:_0x18a2('0xdd'),'createdAt':moment(_0x5a2b1f[_0x18a2('0xd5')])[_0x18a2('0xc0')](_0x18a2('0xde'))[_0x18a2('0x9c')](),'closedAt':_0x5a2b1f[_0x18a2('0x35')]?moment(_0x5a2b1f[_0x18a2('0xdf')])[_0x18a2('0xc0')](_0x18a2('0xde'))['toString']():'','disposition':_0x5a2b1f[_0x18a2('0xe0')],'messages':_(_0x5a2b1f[_0x18a2('0xd4')])['filter']({'secret':![]})['map'](function(_0x4a06ad){if(_0x4a06ad[_0x18a2('0xd3')]){var _0x53057b=path[_0x18a2('0xca')](_0x416e23,_0x4a06ad['Attachment']['basename']);if(fs['existsSync'](_0x53057b)){fs[_0x18a2('0xe1')](_0x53057b)[_0x18a2('0xe2')](fs[_0x18a2('0xe3')](path['join'](_0x206a3d,_0x4a06ad['Attachment']['basename'])));}}return{'date':moment(_0x4a06ad[_0x18a2('0xd5')])[_0x18a2('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x18a2('0x9c')](),'sender':_0x4a06ad[_0x18a2('0xe4')]===_0x18a2('0xe5')?_0x4a06ad[_0x18a2('0xcf')]?_0x4a06ad['User'][_0x18a2('0xd0')]:_0x18a2('0xe6'):_0x4a06ad['Contact'][_0x18a2('0xd1')]+(_0x4a06ad[_0x18a2('0x68')][_0x18a2('0xd2')]?'\x20'+_0x4a06ad[_0x18a2('0x68')][_0x18a2('0xd2')]:''),'body':_0x4a06ad[_0x18a2('0xd3')]?_0x4a06ad[_0x18a2('0xd3')][_0x18a2('0xe7')]:_0x4a06ad[_0x18a2('0x71')],'direction':_0x4a06ad[_0x18a2('0xe4')]===_0x18a2('0xe5')?'A':'C','secret':_0x4a06ad[_0x18a2('0xd6')],'read':_0x4a06ad[_0x18a2('0x7f')],'attachment':_0x4a06ad[_0x18a2('0xd3')]};})[_0x18a2('0x64')]()};return ejs[_0x18a2('0xe8')](path[_0x18a2('0xca')](config[_0x18a2('0xcb')],_0x18a2('0xe9'),_0x18a2('0xea'),_0x18a2('0xeb')),{'interaction':_0x2bcfa6})[_0x18a2('0x24')](function(_0x1c543e){var _0x239650=path[_0x18a2('0xca')](_0x206a3d,'transcript-'+_0x5a2b1f['id']+'-'+_0x5bdde4+_0x18a2('0xec'));var _0x2e4e56={'path':_0x239650,'channel':_0x18a2('0xdc'),'interactionId':_0x5a2b1f['id']};return pdf[_0x18a2('0xed')](_0x1c543e,_0x2e4e56);})['then'](function(){return new BPromise(function(_0x4c82e9,_0x429545){zipdir(_0x206a3d,{'saveTo':_0x1d5a9b},function(_0x2a2a7f,_0x1446e3){if(_0x2a2a7f)return _0x429545(_0x2a2a7f);return _0x4c82e9(_0x1446e3);});})[_0x18a2('0x24')](function(){return new BPromise(function(_0x1b8ade,_0x5ac3d0){rimraf(_0x206a3d,function(_0x32fd17){if(_0x32fd17)_0x5ac3d0(_0x32fd17);return _0x1b8ade();});});})[_0x18a2('0x24')](function(){return _0x596327[_0x18a2('0xee')](_0x1d5a9b,_0x53e356,function(_0x3882e4){if(_0x3882e4){console[_0x18a2('0xef')](_0x18a2('0xf0'),_0x3882e4);}else{fs[_0x18a2('0xf1')](_0x1d5a9b);}});});});}else{return _0x596327['sendStatus'](0xc8);}})[_0x18a2('0x30')](handleError(_0x596327,null));}; \ No newline at end of file +var _0x87bc=['fields','length','hasOwnProperty','order','sort','where','filters','select','field','color','u.id','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','some','compact','isEmpty','WhatsappAccountId','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','Sequelize','QueryTypes','SELECT','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','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','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','options','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','pick','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','mkdirSync','Whatsapp','Owner','closedAt','disposition','createReadStream','pipe','basename','System','firstName','renderFile','views','downloadInteraction.ejs','transcript-','eml-format','rimraf','fast-json-patch','bluebird','util','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','update','then','destroy','error','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','total','closed','UserId','unmanaged','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x7450d2,_0x46afc8){var _0x5987aa=function(_0x5cd719){while(--_0x5cd719){_0x7450d2['push'](_0x7450d2['shift']());}};_0x5987aa(++_0x46afc8);}(_0x87bc,0x189));var _0xc87b=function(_0x428149,_0x20c5a4){_0x428149=_0x428149-0x0;var _0x5ecf4f=_0x87bc[_0x428149];return _0x5ecf4f;};'use strict';var emlformat=require(_0xc87b('0x0'));var rimraf=require(_0xc87b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc87b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc87b('0x3'));var Mustache=require('mustache');var util=require(_0xc87b('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc87b('0x5'));var fs=require('fs');var fs_extra=require(_0xc87b('0x6'));var _=require(_0xc87b('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc87b('0x8'));var toCsv=require(_0xc87b('0x9'));var querystring=require(_0xc87b('0xa'));var Papa=require(_0xc87b('0xb'));var Redis=require(_0xc87b('0xc'));var authService=require(_0xc87b('0xd'));var qs=require(_0xc87b('0xe'));var as=require(_0xc87b('0xf'));var pdf=require(_0xc87b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc87b('0x11'));var utils=require('../../config/utils');var config=require(_0xc87b('0x12'));var licenseUtil=require(_0xc87b('0x13'));var db=require(_0xc87b('0x14'))['db'];config[_0xc87b('0x15')]=_['defaults'](config[_0xc87b('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xc87b('0x16'))(new Redis(config[_0xc87b('0x15')]));require('./whatsappInteraction.socket')[_0xc87b('0x17')](socket);function respondWithStatusCode(_0x25006a,_0x496cab){_0x496cab=_0x496cab||0xcc;return function(_0x430121){if(_0x430121){return _0x25006a[_0xc87b('0x18')](_0x496cab);}return _0x25006a[_0xc87b('0x19')](_0x496cab)[_0xc87b('0x1a')]();};}function respondWithResult(_0x212813,_0x3e6461){_0x3e6461=_0x3e6461||0xc8;return function(_0x4009ef){if(_0x4009ef){return _0x212813[_0xc87b('0x19')](_0x3e6461)['json'](_0x4009ef);}};}function respondWithFilteredResult(_0x124962,_0x5b5a36){return function(_0x30179b){if(_0x30179b){var _0x67e40e=typeof _0x5b5a36['offset']===_0xc87b('0x1b')&&typeof _0x5b5a36[_0xc87b('0x1c')]==='undefined';var _0x35b58f=_0x30179b['count'];var _0x36c8c4=_0x67e40e?0x0:_0x5b5a36[_0xc87b('0x1d')];var _0x2a42ab=_0x67e40e?_0x30179b[_0xc87b('0x1e')]:_0x5b5a36[_0xc87b('0x1d')]+_0x5b5a36[_0xc87b('0x1c')];var _0x100159;if(_0x2a42ab>=_0x35b58f){_0x2a42ab=_0x35b58f;_0x100159=0xc8;}else{_0x100159=0xce;}_0x124962[_0xc87b('0x19')](_0x100159);return _0x124962[_0xc87b('0x1f')]('Content-Range',_0x36c8c4+'-'+_0x2a42ab+'/'+_0x35b58f)[_0xc87b('0x20')](_0x30179b);}return null;};}function patchUpdates(_0x5266c2){return function(_0x3c6d50){try{jsonpatch[_0xc87b('0x21')](_0x3c6d50,_0x5266c2,!![]);}catch(_0x147731){return BPromise['reject'](_0x147731);}return _0x3c6d50['save']();};}function saveUpdates(_0x31b14,_0x2306f6){return function(_0x452cdd){if(_0x452cdd){return _0x452cdd[_0xc87b('0x22')](_0x31b14)[_0xc87b('0x23')](function(_0x557efe){return _0x557efe;});}return null;};}function removeEntity(_0x1e08db,_0x2d4787){return function(_0x19d383){if(_0x19d383){return _0x19d383[_0xc87b('0x24')]()[_0xc87b('0x23')](function(){_0x1e08db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56d3d8,_0x9507c0){return function(_0x1c4a82){if(!_0x1c4a82){_0x56d3d8['sendStatus'](0x194);}return _0x1c4a82;};}function handleError(_0x580a7a,_0x281692){_0x281692=_0x281692||0x1f4;return function(_0x5900ad){logger[_0xc87b('0x25')](_0x5900ad['stack']);if(_0x5900ad[_0xc87b('0x26')]){delete _0x5900ad[_0xc87b('0x26')];}_0x580a7a[_0xc87b('0x19')](_0x281692)['send'](_0x5900ad);};}function getInteractionUsers(_0x41d212,_0x24fd6f){return new BPromise(function(_0x166456,_0x384230){try{if(_0x24fd6f[_0x41d212['id']]){_0x41d212[_0xc87b('0x27')]=_[_0xc87b('0x28')](_0x24fd6f[_0x41d212['id']],function(_0x215be4){return{'id':_0x215be4['id'],'fullname':_0x215be4[_0xc87b('0x29')]};});}}catch(_0x25af81){_0x384230(_0x25af81);}_0x166456(_0x41d212);});}function getInteractionTags(_0x38b5ec,_0x210522){return new BPromise(function(_0x160cc9,_0x4e807a){try{if(_0x38b5ec[_0xc87b('0x2a')]){_0x38b5ec[_0xc87b('0x2b')]=[];_0x38b5ec['TagIds'][_0xc87b('0x2c')](',')[_0xc87b('0x2d')](function(_0x224025){_0x38b5ec['Tags'][_0xc87b('0x2e')](_0x210522[_0x224025]);});}delete _0x38b5ec[_0xc87b('0x2a')];}catch(_0x347c45){_0x4e807a(_0x347c45);}_0x160cc9(_0x38b5ec);});}function updateWhatsappInteraction(_0x2ba3e6,_0x1fb569,_0x4f9cd9){return new BPromise(function(_0x592ab8,_0xd610b4){return getInteractionUsers(_0x2ba3e6,_0x4f9cd9)['then'](function(_0xd3b016){return getInteractionTags(_0xd3b016,_0x1fb569);})[_0xc87b('0x23')](function(_0x259344){return getStateInteraction(_0x259344);})[_0xc87b('0x23')](function(_0x589fd8){_0x592ab8(_0x589fd8);})[_0xc87b('0x2f')](function(_0x2925d2){_0xd610b4(_0x2925d2);});});}function getStateInteraction(_0xd54abc){return new BPromise(function(_0x199a16){_0xd54abc[_0xc87b('0x30')]=0x0;_0xd54abc[_0xc87b('0x31')]=0x0;_0xd54abc[_0xc87b('0x32')]=0x0;_0xd54abc['unmanaged']=0x0;_0xd54abc[_0xc87b('0x33')]=0x0;if(!_0xd54abc['closed']&&!_0xd54abc['UserId']){_0xd54abc[_0xc87b('0x30')]+=0x1;}if(!_0xd54abc[_0xc87b('0x34')]&&_0xd54abc[_0xc87b('0x35')]){_0xd54abc[_0xc87b('0x31')]+=0x1;if(_0xd54abc[_0xc87b('0x30')]){_0xd54abc[_0xc87b('0x30')]-=0x1;}}if(_0xd54abc['closed']&&_0xd54abc[_0xc87b('0x35')]){_0xd54abc[_0xc87b('0x32')]+=0x1;if(_0xd54abc[_0xc87b('0x31')]){_0xd54abc[_0xc87b('0x31')]-=0x1;}}if(_0xd54abc['closed']&&!_0xd54abc[_0xc87b('0x35')]){_0xd54abc[_0xc87b('0x36')]+=0x1;if(_0xd54abc[_0xc87b('0x30')]){_0xd54abc[_0xc87b('0x30')]-=0x1;}}_0xd54abc['total']+=0x1;_0x199a16(_0xd54abc);});}exports['index']=function(_0x5bc4ae,_0x1295fa){var _0x4640a3={},_0x47b4ea={},_0x1f23a1={'count':0x0,'rows':[]};var _0x37f162=_[_0xc87b('0x28')](db[_0xc87b('0x37')][_0xc87b('0x38')],function(_0x2f34c6){return{'name':_0x2f34c6[_0xc87b('0x39')],'type':_0x2f34c6[_0xc87b('0x3a')][_0xc87b('0x3b')]};});_0x47b4ea[_0xc87b('0x3c')]=_[_0xc87b('0x28')](_0x37f162,_0xc87b('0x26'));_0x47b4ea[_0xc87b('0x3d')]=_[_0xc87b('0x3e')](_0x5bc4ae[_0xc87b('0x3d')]);_0x47b4ea['filters']=_[_0xc87b('0x3f')](_0x47b4ea[_0xc87b('0x3c')],_0x47b4ea[_0xc87b('0x3d')]);_0x4640a3[_0xc87b('0x40')]=_[_0xc87b('0x3f')](_0x47b4ea['model'],qs['fields'](_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x41')]));_0x4640a3['attributes']=_0x4640a3[_0xc87b('0x40')][_0xc87b('0x42')]?_0x4640a3[_0xc87b('0x40')]:_0x47b4ea[_0xc87b('0x3c')];if(!_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x43')]('nolimit')){_0x4640a3['limit']=qs[_0xc87b('0x1c')](_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x1c')]);_0x4640a3[_0xc87b('0x1d')]=qs[_0xc87b('0x1d')](_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x1d')]);}_0x4640a3[_0xc87b('0x44')]=qs[_0xc87b('0x45')](_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x45')]);_0x4640a3[_0xc87b('0x46')]=qs[_0xc87b('0x47')](_['pick'](_0x5bc4ae[_0xc87b('0x3d')],_0x47b4ea[_0xc87b('0x47')]),_0x37f162);var _0x4b98d4=[];var _0xd42213=squel[_0xc87b('0x48')]()[_0xc87b('0x49')]('id')[_0xc87b('0x49')](_0xc87b('0x26'))[_0xc87b('0x49')](_0xc87b('0x4a'))['from']('tools_tags');var _0x114ef7=squel['select']()[_0xc87b('0x49')](_0xc87b('0x4b'))[_0xc87b('0x49')]('u.fullname')[_0xc87b('0x49')](_0xc87b('0x4c'))[_0xc87b('0x4d')](_0xc87b('0x4e'),'ui')[_0xc87b('0x4f')](_0xc87b('0x50'),'u',_0xc87b('0x51'));var _0x47ca07=squel['select']()[_0xc87b('0x4d')](_0xc87b('0x52'),'i')[_0xc87b('0x4f')](_0xc87b('0x53'),'c',_0xc87b('0x54'))['left_join']('users','o',_0xc87b('0x55'))[_0xc87b('0x4f')]('whatsapp_accounts','a',_0xc87b('0x56'))[_0xc87b('0x4f')](_0xc87b('0x57'),'me',_0xc87b('0x58'))['left_join'](_0xc87b('0x59'),'it',_0xc87b('0x5a'))[_0xc87b('0x4f')]('tools_tags','t',_0xc87b('0x5b'));var _0x1d5a58=squel['expr']();var _0x25636c=[];var _0x33e892=squel[_0xc87b('0x5c')]();var _0x440442;if(_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x5d')]){_0x440442=as[_0xc87b('0x5e')](_0x5bc4ae['query']['search']);var _0x27f74d=_0x440442[_0xc87b('0x5f')];for(var _0x306a56=0x0;_0x306a56<_0x440442[_0xc87b('0x60')][_0xc87b('0x42')];_0x306a56++){var _0xd9d7a3=_0x440442['conditions'][_0x306a56];var _0x5ed89b='i';var _0x44afe3=_['find'](_0x37f162,['name',_0xd9d7a3[_0xc87b('0x49')]]);if(!_0x44afe3){switch(_0xd9d7a3[_0xc87b('0x49')]){case _0xc87b('0x61'):if(_0xd9d7a3[_0xc87b('0x62')]==0x1){_0x47ca07[_0xc87b('0x63')]('`'+_0xd9d7a3[_0xc87b('0x49')]+_0xc87b('0x64'));}else{_0x47ca07['having']('`'+_0xd9d7a3[_0xc87b('0x49')]+_0xc87b('0x65'));}break;case _0xc87b('0x66'):if(_0xd9d7a3[_0xc87b('0x67')]===_0xc87b('0x68')){if(_0xd9d7a3[_0xc87b('0x62')][_0xc87b('0x2c')]('\x20')[_0xc87b('0x42')]>0x1){_0x1d5a58[_0x27f74d](_0xc87b('0x69'),qs['getFullTextValue'](_0xd9d7a3[_0xc87b('0x62')]),null);}else{var _0x43c400='%'+_0xd9d7a3[_0xc87b('0x62')]+'%';_0x1d5a58[_0x27f74d](_0xc87b('0x6a'),_0x43c400,_0x43c400,_0x43c400);}}else{_0x44afe3=_['find'](_0x37f162,[_0xc87b('0x26'),'ContactId']);_0xd9d7a3[_0xc87b('0x49')]=_0xc87b('0x6b');_0x296c54=as[_0xc87b('0x6c')](_0x5ed89b,_0x44afe3['type'],_0xd9d7a3);_0x1d5a58[_0x27f74d](_0x296c54[_0xc87b('0x6d')],_0x296c54[_0xc87b('0x62')][_0xc87b('0x6e')],_0x296c54[_0xc87b('0x62')][_0xc87b('0x1a')]);}break;case _0xc87b('0x6f'):var _0x342f05=_0xd9d7a3[_0xc87b('0x62')][_0xc87b('0x2c')](',')[_0xc87b('0x28')](function(_0x45eb0e){return Number(_0x45eb0e);});_0x342f05[_0xc87b('0x2d')](function(_0x10372c){_0x33e892['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x10372c+',%');});_0x25636c=_['union'](_0x25636c,_0x342f05);break;case _0xc87b('0x70'):if(_0xd9d7a3[_0xc87b('0x67')]===_0xc87b('0x68')){_0x1d5a58[_0x27f74d](_0xc87b('0x71'),'%'+_0xd9d7a3['value']+'%',null);}else{_0x44afe3=_[_0xc87b('0x72')](_0x37f162,[_0xc87b('0x26'),'UserId']);_0xd9d7a3[_0xc87b('0x49')]=_0xc87b('0x35');_0x296c54=as[_0xc87b('0x6c')](_0x5ed89b,_0x44afe3[_0xc87b('0x3a')],_0xd9d7a3);_0x1d5a58[_0x27f74d](_0x296c54[_0xc87b('0x6d')],_0x296c54[_0xc87b('0x62')][_0xc87b('0x6e')],_0x296c54[_0xc87b('0x62')][_0xc87b('0x1a')]);}break;case'body':_0x296c54=as['buildExpression']('me',null,_0xd9d7a3);_0x1d5a58[_0x27f74d](_0x296c54[_0xc87b('0x6d')],_0x296c54[_0xc87b('0x62')][_0xc87b('0x6e')],_0x296c54[_0xc87b('0x62')][_0xc87b('0x1a')]);break;}}else{var _0x296c54=as[_0xc87b('0x6c')](_0x5ed89b,_0x44afe3[_0xc87b('0x3a')],_0xd9d7a3);_0x1d5a58[_0x27f74d](_0x296c54['text'],_0x296c54[_0xc87b('0x62')][_0xc87b('0x6e')],_0x296c54[_0xc87b('0x62')][_0xc87b('0x1a')]);}}}else{var _0x525259=_(_0x5bc4ae[_0xc87b('0x3d')])[_0xc87b('0x3e')]()[_0xc87b('0x28')](function(_0x4d6ea2){return _[_0xc87b('0x73')](_0x37f162,[_0xc87b('0x26'),_0x4d6ea2])?_0x4d6ea2:undefined;})[_0xc87b('0x74')]()[_0xc87b('0x62')]();if(!_[_0xc87b('0x75')](_0x525259)){_0x525259[_0xc87b('0x2d')](function(_0x90124){if(_0x90124===_0xc87b('0x76')){_0x47ca07['where']('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x5bc4ae[_0xc87b('0x3d')][_0x90124]));}else if(_0x90124===_0xc87b('0x77')){var _0x8343c5=JSON['parse'](_0x5bc4ae[_0xc87b('0x3d')][_0x90124])[_0xc87b('0x78')];var _0x1a106e=JSON[_0xc87b('0x79')](_0x5bc4ae[_0xc87b('0x3d')][_0x90124])[_0xc87b('0x7a')];_0x47ca07[_0xc87b('0x46')](_0xc87b('0x7b'),_0x8343c5,_0x1a106e);}else{if(_0x5bc4ae[_0xc87b('0x3d')][_0x90124]===_0xc87b('0x7c')){_0x47ca07[_0xc87b('0x46')]('i.'+_0x90124+'\x20IS\x20NULL');}else{_0x47ca07[_0xc87b('0x46')]('i.'+_0x90124+'\x20=\x20?',_0x5bc4ae[_0xc87b('0x3d')][_0x90124]);}}});}if(_0x5bc4ae[_0xc87b('0x3d')]['read']){if(_0x5bc4ae[_0xc87b('0x3d')]['read']==0x1){_0x47ca07['having'](_0xc87b('0x7d'));}else{_0x47ca07[_0xc87b('0x63')](_0xc87b('0x7e'));}}if(_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x7f')]){_0x25636c=_[_0xc87b('0x80')](_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x7f')])?_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x7f')]:new Array(_0x5bc4ae[_0xc87b('0x3d')]['tag']);_0x25636c[_0xc87b('0x2d')](function(_0x2edb82){_0x33e892['or'](_0xc87b('0x81'),'%,'+_0x2edb82+',%');});}if(_0x5bc4ae['query']['filter']){var _0x47f2f5=_0x5bc4ae['query'][_0xc87b('0x82')][_0xc87b('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc87b('0x84')](_0x47f2f5)){_0x1d5a58['or'](_0xc87b('0x85'),_0x47f2f5+'%')['or']('i.phone\x20LIKE\x20?',_0x47f2f5+'%');}else{_0x1d5a58['or'](_0xc87b('0x86'),qs[_0xc87b('0x87')](_0x47f2f5))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x47f2f5+'%');}}}_0x47ca07[_0xc87b('0x46')](_0x1d5a58);_0x47ca07[_0xc87b('0x88')]('i.id');var _0xa38a36={'type':db[_0xc87b('0x89')][_0xc87b('0x8a')][_0xc87b('0x8b')],'raw':!![]};var _0x337e9f=_0x47ca07['clone']();_0x337e9f['field'](_0xc87b('0x8c'));_0x337e9f['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc87b('0x61'));if(_0x4640a3[_0xc87b('0x44')]){_0x4640a3['order']['forEach'](function(_0x2114b6){var _0x1f2672=_0x2114b6[0x0]===_0xc87b('0x8d')?_0x2114b6[0x0]:'i.'+_0x2114b6[0x0];_0x47ca07[_0xc87b('0x44')](_0x1f2672,_0x2114b6[0x1]===_0xc87b('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x25636c)){_0x47ca07[_0xc87b('0x63')](_0x33e892);_0x337e9f['where'](_0xc87b('0x8f'),_0x25636c);}BPromise[_0xc87b('0x90')]()[_0xc87b('0x23')](function(){if(!_0x440442){if(_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x76')])return;_0x337e9f[_0xc87b('0x46')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x47ca07[_0xc87b('0x46')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5bc4ae[_0xc87b('0x91')][_0xc87b('0x92')]!==_0xc87b('0x93'))return;return _0x5bc4ae['user'][_0xc87b('0x94')]({'attributes':['id'],'raw':!![]})[_0xc87b('0x23')](function(_0x4e9cdd){if(_['isEmpty'](_0x4e9cdd)){_0x337e9f[_0xc87b('0x46')]('i.WhatsappAccountId\x20IS\x20NULL');_0x47ca07[_0xc87b('0x46')](_0xc87b('0x95'));}else{_0x337e9f[_0xc87b('0x46')](_0xc87b('0x96'),_['map'](_0x4e9cdd,'id'));_0x47ca07[_0xc87b('0x46')](_0xc87b('0x96'),_[_0xc87b('0x28')](_0x4e9cdd,'id'));}});})[_0xc87b('0x23')](function(){if(_0x5bc4ae[_0xc87b('0x91')]['role']==='agent'&&!_0x440442&&!_0x5bc4ae['query'][_0xc87b('0x76')])return[];return db['sequelize'][_0xc87b('0x3d')](_0x337e9f[_0xc87b('0x97')](),_0xa38a36);})[_0xc87b('0x23')](function(_0x347c16){_0x1f23a1[_0xc87b('0x1e')]=_0x347c16[_0xc87b('0x42')];if(_0x1f23a1['count']===0x0)return[];return db[_0xc87b('0x98')][_0xc87b('0x3d')](_0xd42213[_0xc87b('0x97')](),_0xa38a36)[_0xc87b('0x23')](function(_0x421487){_0x4b98d4=_[_0xc87b('0x99')](_0x421487,'id');_0xa38a36=_[_0xc87b('0x9a')](_0xa38a36,{'model':db[_0xc87b('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5bc4ae[_0xc87b('0x3d')][_0xc87b('0x41')]){_0x4640a3['attributes'][_0xc87b('0x2d')](function(_0x38455c){_0x47ca07[_0xc87b('0x49')]('i.'+_0x38455c);});}else{_0x47ca07[_0xc87b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x47ca07[_0xc87b('0x49')]('a.key','Account.key');_0x47ca07[_0xc87b('0x49')](_0xc87b('0x9b'),_0xc87b('0x9c'));_0x47ca07[_0xc87b('0x49')](_0xc87b('0x9d'),'contactName');_0x47ca07[_0xc87b('0x49')](_0xc87b('0x9e'));_0x47ca07[_0xc87b('0x49')](_0xc87b('0x9f'),'Contact.firstName');_0x47ca07['field']('c.lastName','Contact.lastName');_0x47ca07[_0xc87b('0x49')](_0xc87b('0xa0'),_0xc87b('0xa1'));_0x47ca07[_0xc87b('0x49')](_0xc87b('0xa2'),'Contact.phone');_0x47ca07[_0xc87b('0x49')](_0xc87b('0xa3'),_0xc87b('0xa4'));_0x47ca07[_0xc87b('0x49')](_0xc87b('0xa5'),_0xc87b('0xa6'));_0x47ca07['field']('o.fullname','Owner.fullname');_0x47ca07[_0xc87b('0x49')](_0xc87b('0xa7'),_0xc87b('0xa8'));_0x47ca07['field'](_0xc87b('0xa9'),_0xc87b('0x2a'));}if(_0x4640a3['limit'])_0x47ca07['limit'](_0x4640a3['limit']);if(_0x4640a3[_0xc87b('0x1d')])_0x47ca07[_0xc87b('0x1d')](_0x4640a3[_0xc87b('0x1d')]);return db[_0xc87b('0x98')][_0xc87b('0x3d')](_0x47ca07[_0xc87b('0x97')](),_0xa38a36);})['then'](function(_0x2ae800){if(_0x2ae800[_0xc87b('0x42')]>0x0)_0x114ef7[_0xc87b('0x46')](_0xc87b('0xaa'),_[_0xc87b('0x28')](_0x2ae800,'id'));return db[_0xc87b('0x98')]['query'](_0x114ef7[_0xc87b('0x97')](),_0xa38a36)['then'](function(_0x388433){var _0x22c649=_[_0xc87b('0xab')](_0x388433,'WhatsappInteractionId');var _0x819209=[];_0x2ae800[_0xc87b('0x2d')](function(_0x4002aa){_0x819209[_0xc87b('0x2e')](updateWhatsappInteraction(_0x4002aa,_0x4b98d4,_0x22c649));});return BPromise[_0xc87b('0xac')](_0x819209);});});})[_0xc87b('0x23')](function(_0x52a221){_0x1f23a1[_0xc87b('0xad')]=_0x52a221;return _0x1f23a1;})['then'](respondWithFilteredResult(_0x1295fa,_0x4640a3))['catch'](handleError(_0x1295fa,null));};exports[_0xc87b('0xae')]=function(_0x2c6baf,_0x4de339){var _0x30cb19={'raw':![],'where':{'id':_0x2c6baf[_0xc87b('0xaf')]['id']}},_0x405196={};_0x405196[_0xc87b('0x3c')]=_[_0xc87b('0x3e')](db[_0xc87b('0x37')][_0xc87b('0x38')]);_0x405196[_0xc87b('0x3d')]=_[_0xc87b('0x3e')](_0x2c6baf[_0xc87b('0x3d')]);_0x405196[_0xc87b('0x47')]=_['intersection'](_0x405196['model'],_0x405196[_0xc87b('0x3d')]);_0x30cb19['attributes']=_[_0xc87b('0x3f')](_0x405196['model'],qs[_0xc87b('0x41')](_0x2c6baf['query'][_0xc87b('0x41')]));_0x30cb19[_0xc87b('0x40')]=_0x30cb19[_0xc87b('0x40')][_0xc87b('0x42')]?_0x30cb19['attributes']:_0x405196[_0xc87b('0x3c')];if(_0x2c6baf[_0xc87b('0x3d')][_0xc87b('0xb0')]){_0x30cb19['include']=[{'all':!![]}];}_0x30cb19=_['merge']({},_0x30cb19,_0x2c6baf[_0xc87b('0xb1')]);return db[_0xc87b('0x37')][_0xc87b('0x72')](_0x30cb19)[_0xc87b('0x23')](handleEntityNotFound(_0x4de339,null))[_0xc87b('0x23')](respondWithResult(_0x4de339,null))['catch'](handleError(_0x4de339,null));};exports[_0xc87b('0xb2')]=function(_0x1ed3da,_0x553882){return db[_0xc87b('0x37')]['create'](_0x1ed3da['body'],{})[_0xc87b('0x23')](respondWithResult(_0x553882,0xc9))[_0xc87b('0x2f')](handleError(_0x553882,null));};exports[_0xc87b('0x22')]=function(_0x5cd40f,_0x44786d){if(_0x5cd40f['body']['id']){delete _0x5cd40f[_0xc87b('0xb3')]['id'];}return db[_0xc87b('0x37')]['find']({'where':{'id':_0x5cd40f['params']['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x44786d,null))['then'](saveUpdates(_0x5cd40f[_0xc87b('0xb3')],null))[_0xc87b('0x23')](respondWithResult(_0x44786d,null))[_0xc87b('0x2f')](handleError(_0x44786d,null));};exports[_0xc87b('0x24')]=function(_0x228227,_0x2f6296){return db[_0xc87b('0x37')]['find']({'where':{'id':_0x228227[_0xc87b('0xaf')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x2f6296,null))[_0xc87b('0x23')](removeEntity(_0x2f6296,null))['catch'](handleError(_0x2f6296,null));};exports[_0xc87b('0xb4')]=function(_0x123cea,_0x331cea){return db[_0xc87b('0x37')]['describe']()[_0xc87b('0x23')](respondWithResult(_0x331cea,null))['catch'](handleError(_0x331cea,null));};exports[_0xc87b('0xb5')]=function(_0x4d9e93,_0x4a540c,_0x358d6a){return db[_0xc87b('0xb6')]['find']({'where':{'id':_0x4d9e93[_0xc87b('0xaf')]['id']}})['then'](handleEntityNotFound(_0x4a540c,null))[_0xc87b('0x23')](function(_0x5bc881){if(_0x5bc881){return _0x5bc881['addMessage'](_0x4d9e93['body'][_0xc87b('0xb7')],_[_0xc87b('0xb8')](_0x4d9e93['body'],[_0xc87b('0xb7'),'id'])||{});}})[_0xc87b('0x23')](respondWithResult(_0x4a540c,null))[_0xc87b('0x2f')](handleError(_0x4a540c,null));};exports[_0xc87b('0xb9')]=function(_0x2aa663,_0x816ec7,_0x4dbafa){var _0x5bcf4b={'raw':![],'where':{}};var _0x14c798={};var _0x43f2a7={'count':0x0,'rows':[]};return db[_0xc87b('0x37')][_0xc87b('0xba')]({'where':{'id':_0x2aa663[_0xc87b('0xaf')]['id']}})[_0xc87b('0x23')](handleEntityNotFound(_0x816ec7,null))[_0xc87b('0x23')](function(_0x600355){if(_0x600355){_0x14c798['model']=_[_0xc87b('0x3e')](db['WhatsappMessage'][_0xc87b('0x38')]);_0x14c798[_0xc87b('0x3d')]=_[_0xc87b('0x3e')](_0x2aa663['query']);_0x14c798[_0xc87b('0x47')]=_[_0xc87b('0x3f')](_0x14c798['model'],_0x14c798[_0xc87b('0x3d')]);_0x5bcf4b[_0xc87b('0x40')]=_[_0xc87b('0x3f')](_0x14c798[_0xc87b('0x3c')],qs['fields'](_0x2aa663['query'][_0xc87b('0x41')]));_0x5bcf4b[_0xc87b('0x40')]=_0x5bcf4b[_0xc87b('0x40')][_0xc87b('0x42')]?_0x5bcf4b[_0xc87b('0x40')]:_0x14c798[_0xc87b('0x3c')];if(!_0x2aa663[_0xc87b('0x3d')]['hasOwnProperty'](_0xc87b('0xbb'))){_0x5bcf4b[_0xc87b('0x1c')]=qs[_0xc87b('0x1c')](_0x2aa663[_0xc87b('0x3d')][_0xc87b('0x1c')]);_0x5bcf4b[_0xc87b('0x1d')]=qs[_0xc87b('0x1d')](_0x2aa663[_0xc87b('0x3d')][_0xc87b('0x1d')]);}_0x5bcf4b['order']=qs[_0xc87b('0x45')](_0x2aa663['query']['sort']);_0x5bcf4b['where']=qs['filters'](_[_0xc87b('0xbc')](_0x2aa663[_0xc87b('0x3d')],_0x14c798[_0xc87b('0x47')]));_0x5bcf4b[_0xc87b('0x46')][_0xc87b('0xbd')]=_0x600355['id'];if(_0x2aa663[_0xc87b('0x3d')][_0xc87b('0x82')]){_0x5bcf4b['where']=_[_0xc87b('0x9a')](_0x5bcf4b[_0xc87b('0x46')],{'$or':_['map'](_0x5bcf4b[_0xc87b('0x40')],function(_0x81072){var _0x337aa2={};_0x337aa2[_0x81072]={'$like':'%'+_0x2aa663[_0xc87b('0x3d')][_0xc87b('0x82')]+'%'};return _0x337aa2;})});}if(_0x2aa663[_0xc87b('0x3d')][_0xc87b('0x78')]){var _0x59148c=_0x2aa663['query']['$gte']['split'](',');var _0x5688da={};_0x5688da[_0x59148c[0x0]]={'$gte':moment(_0x59148c[0x1])[_0xc87b('0xbe')](_0xc87b('0xbf'))};_0x5bcf4b[_0xc87b('0x46')]=_[_0xc87b('0x9a')](_0x5bcf4b['where'],_0x5688da);}_0x5bcf4b=_[_0xc87b('0x9a')]({},_0x5bcf4b,_0x2aa663[_0xc87b('0xb1')]);return db[_0xc87b('0xb6')][_0xc87b('0x1e')]({'where':_0x5bcf4b['where']})[_0xc87b('0x23')](function(_0x3590f8){_0x43f2a7[_0xc87b('0x1e')]=_0x3590f8;if(_0x2aa663[_0xc87b('0x3d')][_0xc87b('0xb0')]){_0x5bcf4b[_0xc87b('0xc0')]=[{'all':!![]}];}return db[_0xc87b('0xb6')][_0xc87b('0xc1')](_0x5bcf4b);})['then'](function(_0x546a72){_0x43f2a7[_0xc87b('0xad')]=_0x546a72;return _0x43f2a7;});}})[_0xc87b('0x23')](respondWithFilteredResult(_0x816ec7,_0x5bcf4b))['catch'](handleError(_0x816ec7,null));};exports['addTags']=function(_0x2831d0,_0x4a373a,_0x308805){return db[_0xc87b('0x37')][_0xc87b('0x72')]({'where':{'id':_0x2831d0[_0xc87b('0xaf')]['id']}})['then'](handleEntityNotFound(_0x4a373a,null))[_0xc87b('0x23')](function(_0x340cb6){if(_0x340cb6){return _0x340cb6[_0xc87b('0xc2')](_0x2831d0[_0xc87b('0xb3')][_0xc87b('0xb7')],_[_0xc87b('0xb8')](_0x2831d0['body'],[_0xc87b('0xb7'),'id'])||{})[_0xc87b('0xc3')](function(){return db['Tag'][_0xc87b('0xc1')]({'attributes':['id',_0xc87b('0x26'),_0xc87b('0x4a')],'where':{'id':_0x2831d0[_0xc87b('0xb3')]['ids']}});})[_0xc87b('0x23')](function(_0x51cec6){socket[_0xc87b('0xc4')](_0xc87b('0xc5'),{'id':Number(_0x2831d0[_0xc87b('0xaf')]['id']),'tags':_0x51cec6||[]});return{'id':Number(_0x2831d0[_0xc87b('0xaf')]['id']),'tags':_0x51cec6||[]};});}})[_0xc87b('0x23')](respondWithResult(_0x4a373a,null))[_0xc87b('0x2f')](handleError(_0x4a373a,null));};exports[_0xc87b('0xc6')]=function(_0x341011,_0x3079bd,_0x4f53f9){return db[_0xc87b('0x37')]['find']({'where':{'id':_0x341011[_0xc87b('0xaf')]['id']}})['then'](handleEntityNotFound(_0x3079bd,null))[_0xc87b('0x23')](function(_0x320627){if(_0x320627){return _0x320627[_0xc87b('0xc6')](_0x341011['query'][_0xc87b('0xb7')]);}})[_0xc87b('0x23')](respondWithStatusCode(_0x3079bd,null))[_0xc87b('0x2f')](handleError(_0x3079bd,null));};exports[_0xc87b('0xc7')]=function(_0x43c22e,_0x314fb0){var _0x2fd195=moment()['unix']()[_0xc87b('0x97')]();var _0x1e625d=path[_0xc87b('0xc8')](config[_0xc87b('0xc9')],_0xc87b('0xca'),_0xc87b('0xcb'),_0xc87b('0xcc'));var _0x3d4ccc=path[_0xc87b('0xc8')](config[_0xc87b('0xc9')],_0xc87b('0xca'),_0xc87b('0xcb'),'attachments');var _0x1d4e5d=path[_0xc87b('0xc8')](_0x1e625d,_0x2fd195);var _0x439098=util['format'](_0xc87b('0xcd'),_0x43c22e[_0xc87b('0xaf')]['id'],_0x2fd195);var _0x534757=path[_0xc87b('0xc8')](_0x1e625d,_0x439098);var _0x2877a3=[];_0x2877a3[_0xc87b('0x2e')]({'model':db['User'],'as':_0xc87b('0x70'),'attributes':['id',_0xc87b('0x29')],'raw':!![]});_0x2877a3['push']({'model':db[_0xc87b('0xce')],'as':_0xc87b('0x66'),'attributes':['id','firstName',_0xc87b('0xcf')],'raw':!![]});if(_0x43c22e['query']['attachments']){_0x2877a3[_0xc87b('0x2e')]({'model':db[_0xc87b('0xd0')],'as':'Attachment','raw':!![]});}var _0x47811e=[{'model':db[_0xc87b('0xb6')],'as':_0xc87b('0xd1'),'attributes':['id','body','createdAt',_0xc87b('0xd2'),_0xc87b('0xd3'),_0xc87b('0xd4')],'include':_0x2877a3}];_0x47811e[_0xc87b('0x2e')]({'model':db[_0xc87b('0xd5')],'as':_0xc87b('0xd6'),'attributes':['id',_0xc87b('0x26')]});_0x47811e['push']({'model':db[_0xc87b('0x70')],'as':'Owner','attributes':['id','fullname']});return db[_0xc87b('0x37')][_0xc87b('0x72')]({'where':{'id':_0x43c22e[_0xc87b('0xaf')]['id']},'include':_0x47811e})[_0xc87b('0x23')](handleEntityNotFound(_0x314fb0,null))[_0xc87b('0x23')](function(_0x3ee606){if(_0x3ee606){var _0x3cb22c=_0x3ee606['get']({'plain':!![]});fs[_0xc87b('0xd7')](_0x1d4e5d);var _0x48925e={'channel':_0xc87b('0xd8'),'account':_0x3cb22c[_0xc87b('0xd6')]['name'],'agent':_0x3cb22c[_0xc87b('0xd9')]?_0x3cb22c['Owner'][_0xc87b('0x29')]:'N.A.','createdAt':moment(_0x3cb22c[_0xc87b('0x77')])[_0xc87b('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc87b('0x97')](),'closedAt':_0x3cb22c['closed']?moment(_0x3cb22c[_0xc87b('0xda')])[_0xc87b('0xbe')](_0xc87b('0xbf'))[_0xc87b('0x97')]():'','disposition':_0x3cb22c[_0xc87b('0xdb')],'messages':_(_0x3cb22c[_0xc87b('0xd1')])['filter']({'secret':![]})['map'](function(_0x4940b1){if(_0x4940b1['Attachment']){var _0x1ba8c7=path[_0xc87b('0xc8')](_0x3d4ccc,_0x4940b1[_0xc87b('0xd0')]['basename']);if(fs['existsSync'](_0x1ba8c7)){fs[_0xc87b('0xdc')](_0x1ba8c7)[_0xc87b('0xdd')](fs['createWriteStream'](path[_0xc87b('0xc8')](_0x1d4e5d,_0x4940b1[_0xc87b('0xd0')][_0xc87b('0xde')])));}}return{'date':moment(_0x4940b1[_0xc87b('0x77')])[_0xc87b('0xbe')](_0xc87b('0xbf'))[_0xc87b('0x97')](),'sender':_0x4940b1[_0xc87b('0xd2')]==='out'?_0x4940b1['User']?_0x4940b1[_0xc87b('0x70')]['fullname']:_0xc87b('0xdf'):_0x4940b1[_0xc87b('0x66')][_0xc87b('0xe0')]+(_0x4940b1['Contact'][_0xc87b('0xcf')]?'\x20'+_0x4940b1[_0xc87b('0x66')][_0xc87b('0xcf')]:''),'body':_0x4940b1['Attachment']?_0x4940b1[_0xc87b('0xd0')][_0xc87b('0xde')]:_0x4940b1[_0xc87b('0xb3')],'direction':_0x4940b1[_0xc87b('0xd2')]==='out'?'A':'C','secret':_0x4940b1['secret'],'read':_0x4940b1[_0xc87b('0xd4')],'attachment':_0x4940b1[_0xc87b('0xd0')]};})['value']()};return ejs[_0xc87b('0xe1')](path['join'](config[_0xc87b('0xc9')],_0xc87b('0xca'),_0xc87b('0xe2'),_0xc87b('0xe3')),{'interaction':_0x48925e})[_0xc87b('0x23')](function(_0x22c6cc){var _0xe1a9f1=path[_0xc87b('0xc8')](_0x1d4e5d,_0xc87b('0xe4')+_0x3cb22c['id']+'-'+_0x2fd195+'.pdf');var _0x4337b1={'path':_0xe1a9f1,'channel':'Whatsapp','interactionId':_0x3cb22c['id']};return pdf['createPdfFromHTML'](_0x22c6cc,_0x4337b1);})[_0xc87b('0x23')](function(){return new BPromise(function(_0x3a70bf,_0x36184f){zipdir(_0x1d4e5d,{'saveTo':_0x534757},function(_0x3bf4d3,_0x4dcda9){if(_0x3bf4d3)return _0x36184f(_0x3bf4d3);return _0x3a70bf(_0x4dcda9);});})[_0xc87b('0x23')](function(){return new BPromise(function(_0x1fa36d,_0x3ef825){rimraf(_0x1d4e5d,function(_0x4b17f4){if(_0x4b17f4)_0x3ef825(_0x4b17f4);return _0x1fa36d();});});})['then'](function(){return _0x314fb0[_0xc87b('0xc7')](_0x534757,_0x439098,function(_0x579465){if(_0x579465){console['log']('err',_0x579465);}else{fs['unlinkSync'](_0x534757);}});});});}else{return _0x314fb0[_0xc87b('0x18')](0xc8);}})['catch'](handleError(_0x314fb0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 41830ca..b4700be 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 _0x18e0=['findAll','then','length','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','setDataValue','map'];(function(_0x32cb79,_0x18632c){var _0x308933=function(_0xe844cc){while(--_0xe844cc){_0x32cb79['push'](_0x32cb79['shift']());}};_0x308933(++_0x18632c);}(_0x18e0,0xa2));var _0x018e=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x18e0[_0x1da527];return _0x40fc7c;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x018e('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x018e('0x0'))['db'][_0x018e('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x018e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x018e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x504293){return function(_0xcd2d04,_0x467ed8,_0x1b90dd){_0xcd2d04['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x36aac8){_0xcd2d04[_0x018e('0x4')]('Users',_0x36aac8[_0x018e('0x5')](function(_0x1dba25){return{'id':_0x1dba25['id']};}));return WhatsappMessage[_0x018e('0x6')]({'where':{'WhatsappInteractionId':_0xcd2d04['id'],'direction':'in','read':![]},'raw':!![]});})[_0x018e('0x7')](function(_0x20c76c){_0xcd2d04[_0x018e('0x4')]('unreadMessages',_0x20c76c[_0x018e('0x8')]);WhatsappInteractionEvents['emit'](_0x504293+':'+_0xcd2d04['id'],_0xcd2d04);WhatsappInteractionEvents['emit'](_0x504293,_0xcd2d04);_0x1b90dd(null);})['catch'](_0x1b90dd(null));};}for(var e in events){if(events[_0x018e('0x9')](e)){var event=events[e];WhatsappInteraction[_0x018e('0xa')](e,emitEvent(event));}}module[_0x018e('0xb')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x3b75=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then'];(function(_0x5a3c17,_0x4ab912){var _0x186640=function(_0x139aab){while(--_0x139aab){_0x5a3c17['push'](_0x5a3c17['shift']());}};_0x186640(++_0x4ab912);}(_0x3b75,0xdc));var _0x53b7=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x3b75[_0x5f25b3];return _0x4ab9bf;};'use strict';var EventEmitter=require(_0x53b7('0x0'));var WhatsappInteraction=require(_0x53b7('0x1'))['db'][_0x53b7('0x2')];var WhatsappMessage=require(_0x53b7('0x1'))['db'][_0x53b7('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53b7('0x4'),'afterUpdate':'update','afterDestroy':_0x53b7('0x5')};function emitEvent(_0x4c9b8f){return function(_0x357ece,_0xb78251,_0x331d88){_0x357ece[_0x53b7('0x6')]({'attributes':['id'],'raw':!![]})[_0x53b7('0x7')](function(_0x5ee630){_0x357ece[_0x53b7('0x8')](_0x53b7('0x9'),_0x5ee630[_0x53b7('0xa')](function(_0x509608){return{'id':_0x509608['id']};}));return WhatsappMessage[_0x53b7('0xb')]({'where':{'WhatsappInteractionId':_0x357ece['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a107a){_0x357ece[_0x53b7('0x8')](_0x53b7('0xc'),_0x3a107a[_0x53b7('0xd')]);WhatsappInteractionEvents[_0x53b7('0xe')](_0x4c9b8f+':'+_0x357ece['id'],_0x357ece);WhatsappInteractionEvents['emit'](_0x4c9b8f,_0x357ece);_0x331d88(null);})[_0x53b7('0xf')](_0x331d88(null));};}for(var e in events){if(events[_0x53b7('0x10')](e)){var event=events[e];WhatsappInteraction[_0x53b7('0x11')](e,emitEvent(event));}}module[_0x53b7('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6ee1c3b..beb0670 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 _0x35b8=['../../config/logger','moment','request-promise','path','rimraf','exports','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x35b8,0x1c8));var _0x835b=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x35b8[_0xaaf2e2];return _0x28bc36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x835b('0x0'))('api');var moment=require(_0x835b('0x1'));var BPromise=require('bluebird');var rp=require(_0x835b('0x2'));var fs=require('fs');var path=require(_0x835b('0x3'));var rimraf=require(_0x835b('0x4'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x835b('0x5')]=function(_0x312f2c,_0x14e3a3){return _0x312f2c['define']('WhatsappInteraction',attributes,{'tableName':_0x835b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xeb8fb4,_0x4b640a,_0xaf0c66){if(_0xeb8fb4[_0x835b('0x7')](_0x835b('0x8'))){_0xeb8fb4[_0x835b('0x9')]=moment()[_0x835b('0xa')](_0x835b('0xb'));}_0xaf0c66(null,_0xeb8fb4);}}});}; \ No newline at end of file +var _0xbd50=['format','../../config/logger','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x2e4922,_0x379872){var _0xcb0123=function(_0x23143f){while(--_0x23143f){_0x2e4922['push'](_0x2e4922['shift']());}};_0xcb0123(++_0x379872);}(_0xbd50,0x151));var _0x0bd5=function(_0x32b75c,_0x33bb45){_0x32b75c=_0x32b75c-0x0;var _0x2f06a4=_0xbd50[_0x32b75c];return _0x2f06a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bd5('0x0'))('api');var moment=require(_0x0bd5('0x1'));var BPromise=require(_0x0bd5('0x2'));var rp=require(_0x0bd5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0bd5('0x4'));var attributes=require(_0x0bd5('0x5'));module['exports']=function(_0x50aa35,_0x47deac){return _0x50aa35['define'](_0x0bd5('0x6'),attributes,{'tableName':_0x0bd5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1cf07,_0x59e145,_0x161929){if(_0x1cf07[_0x0bd5('0x8')](_0x0bd5('0x9'))){_0x1cf07[_0x0bd5('0xa')]=moment()[_0x0bd5('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x161929(null,_0x1cf07);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f679443..7435bd8 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 _0x9eb5=['addTags','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','info','result','catch','UpdateWhatsappInteraction','update','body','options','limit','message','AddTagsToWhatsappInteraction','WhatsappInteraction','find'];(function(_0x3efc6b,_0x2f3ad4){var _0x2462ea=function(_0x89fb45){while(--_0x89fb45){_0x3efc6b['push'](_0x3efc6b['shift']());}};_0x2462ea(++_0x2f3ad4);}(_0x9eb5,0x92));var _0x59eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9eb5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x59eb('0x0'));var moment=require(_0x59eb('0x1'));var BPromise=require(_0x59eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59eb('0x3'))['db'];var utils=require(_0x59eb('0x4'));var logger=require('../../config/logger')(_0x59eb('0x5'));var config=require('../../config/environment');var jayson=require(_0x59eb('0x6'));var client=jayson[_0x59eb('0x7')][_0x59eb('0x8')]({'port':0x232a});config[_0x59eb('0x9')]=_[_0x59eb('0xa')](config[_0x59eb('0x9')],{'host':_0x59eb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59eb('0x9')]));require(_0x59eb('0xc'))[_0x59eb('0xd')](socket);function respondWithRpcPromise(_0x596eeb,_0x5cb77f,_0xd11872){return new BPromise(function(_0x4437bc,_0x3f8c88){return client[_0x59eb('0xe')](_0x596eeb,_0xd11872)[_0x59eb('0xf')](function(_0x4de1cd){logger['info'](_0x59eb('0x10'),_0x5cb77f,_0x59eb('0x11'));logger[_0x59eb('0x12')](_0x59eb('0x13'),_0x5cb77f,'request\x20sent',JSON[_0x59eb('0x14')](_0x4de1cd));if(_0x4de1cd[_0x59eb('0x15')]){if(_0x4de1cd[_0x59eb('0x15')]['code']===0x1f4){logger[_0x59eb('0x15')](_0x59eb('0x10'),_0x5cb77f,_0x4de1cd[_0x59eb('0x15')]['message']);return _0x3f8c88(_0x4de1cd[_0x59eb('0x15')]['message']);}logger[_0x59eb('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x5cb77f,_0x4de1cd[_0x59eb('0x15')]['message']);return _0x4437bc(_0x4de1cd[_0x59eb('0x15')]['message']);}else{logger[_0x59eb('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x5cb77f,'request\x20sent');_0x4437bc(_0x4de1cd[_0x59eb('0x17')]['message']);}})[_0x59eb('0x18')](function(_0xf52550){logger[_0x59eb('0x15')](_0x59eb('0x10'),_0x5cb77f,_0xf52550);_0x3f8c88(_0xf52550);});});}exports[_0x59eb('0x19')]=function(_0x3a191c){var _0x846c08=this;return new Promise(function(_0xbc9bd0,_0x3302a5){return db['WhatsappInteraction'][_0x59eb('0x1a')](_0x3a191c[_0x59eb('0x1b')],{'raw':_0x3a191c[_0x59eb('0x1c')]?_0x3a191c[_0x59eb('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a191c['options']?_0x3a191c[_0x59eb('0x1c')]['where']||null:null,'attributes':_0x3a191c[_0x59eb('0x1c')]?_0x3a191c['options']['attributes']||null:null,'limit':_0x3a191c[_0x59eb('0x1c')]?_0x3a191c[_0x59eb('0x1c')][_0x59eb('0x1d')]||null:null})[_0x59eb('0xf')](function(_0x5abc16){logger[_0x59eb('0x16')](_0x59eb('0x19'),_0x3a191c);logger['debug'](_0x59eb('0x19'),_0x3a191c,JSON[_0x59eb('0x14')](_0x5abc16));_0xbc9bd0(_0x5abc16);})[_0x59eb('0x18')](function(_0x12fdd1){logger[_0x59eb('0x15')](_0x59eb('0x19'),_0x12fdd1['message'],_0x3a191c);_0x3302a5(_0x846c08[_0x59eb('0x15')](0x1f4,_0x12fdd1[_0x59eb('0x1e')]));});});};exports[_0x59eb('0x1f')]=function(_0x2a2981){return new Promise(function(_0x1f374f,_0x4cd816){return db[_0x59eb('0x20')][_0x59eb('0x21')]({'where':_0x2a2981[_0x59eb('0x1c')]?_0x2a2981[_0x59eb('0x1c')]['where']||null:null})[_0x59eb('0xf')](function(_0x3af2f0){if(_0x3af2f0){return _0x3af2f0[_0x59eb('0x22')](_0x2a2981[_0x59eb('0x1b')]['ids'],_['omit'](_0x2a2981[_0x59eb('0x1b')],['ids','id'])||{});}})['spread'](function(_0x2d88cf){logger[_0x59eb('0x16')](_0x59eb('0x23'),_0x2a2981);logger[_0x59eb('0x12')](_0x59eb('0x23'),_0x2a2981,JSON[_0x59eb('0x14')](_0x2d88cf));_0x1f374f(_0x2d88cf);})['catch'](function(_0x271f29){logger[_0x59eb('0x15')](_0x59eb('0x23'),_0x271f29[_0x59eb('0x1e')],_0x2a2981);_0x4cd816(_this[_0x59eb('0x15')](0x1f4,_0x271f29[_0x59eb('0x1e')]));});});}; \ No newline at end of file +var _0x2c78=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','attributes','limit','stringify','find','addTags','body','ids','omit','spread','AddTags','util'];(function(_0x520705,_0x1b0814){var _0x310a8b=function(_0x5b1d6b){while(--_0x5b1d6b){_0x520705['push'](_0x520705['shift']());}};_0x310a8b(++_0x1b0814);}(_0x2c78,0xab));var _0x82c7=function(_0xe9c8e4,_0x3aa2f6){_0xe9c8e4=_0xe9c8e4-0x0;var _0x2037fa=_0x2c78[_0xe9c8e4];return _0x2037fa;};'use strict';var _=require('lodash');var util=require(_0x82c7('0x0'));var moment=require(_0x82c7('0x1'));var BPromise=require(_0x82c7('0x2'));var rs=require(_0x82c7('0x3'));var fs=require('fs');var Redis=require(_0x82c7('0x4'));var db=require(_0x82c7('0x5'))['db'];var utils=require(_0x82c7('0x6'));var logger=require(_0x82c7('0x7'))(_0x82c7('0x8'));var config=require(_0x82c7('0x9'));var jayson=require(_0x82c7('0xa'));var client=jayson[_0x82c7('0xb')][_0x82c7('0xc')]({'port':0x232a});config['redis']=_[_0x82c7('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x82c7('0xe'))(new Redis(config[_0x82c7('0xf')]));require(_0x82c7('0x10'))[_0x82c7('0x11')](socket);function respondWithRpcPromise(_0x1fe7ba,_0xf07938,_0x47f309){return new BPromise(function(_0x375fbe,_0x4cf8a8){return client[_0x82c7('0x12')](_0x1fe7ba,_0x47f309)[_0x82c7('0x13')](function(_0x1a4971){logger[_0x82c7('0x14')](_0x82c7('0x15'),_0xf07938,'request\x20sent');logger[_0x82c7('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xf07938,_0x82c7('0x17'),JSON['stringify'](_0x1a4971));if(_0x1a4971[_0x82c7('0x18')]){if(_0x1a4971[_0x82c7('0x18')][_0x82c7('0x19')]===0x1f4){logger[_0x82c7('0x18')](_0x82c7('0x15'),_0xf07938,_0x1a4971['error']['message']);return _0x4cf8a8(_0x1a4971['error']['message']);}logger['error'](_0x82c7('0x15'),_0xf07938,_0x1a4971['error'][_0x82c7('0x1a')]);return _0x375fbe(_0x1a4971[_0x82c7('0x18')][_0x82c7('0x1a')]);}else{logger[_0x82c7('0x14')](_0x82c7('0x15'),_0xf07938,'request\x20sent');_0x375fbe(_0x1a4971[_0x82c7('0x1b')][_0x82c7('0x1a')]);}})[_0x82c7('0x1c')](function(_0x22539c){logger['error'](_0x82c7('0x15'),_0xf07938,_0x22539c);_0x4cf8a8(_0x22539c);});});}exports[_0x82c7('0x1d')]=function(_0x49744f){var _0x3b5f78=this;return new Promise(function(_0x1cba28,_0x7a9409){return db[_0x82c7('0x1e')][_0x82c7('0x1f')](_0x49744f['body'],{'raw':_0x49744f['options']?_0x49744f[_0x82c7('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49744f[_0x82c7('0x20')]?_0x49744f[_0x82c7('0x20')]['where']||null:null,'attributes':_0x49744f[_0x82c7('0x20')]?_0x49744f[_0x82c7('0x20')][_0x82c7('0x21')]||null:null,'limit':_0x49744f['options']?_0x49744f[_0x82c7('0x20')][_0x82c7('0x22')]||null:null})['then'](function(_0x170bbc){logger['info'](_0x82c7('0x1d'),_0x49744f);logger['debug'](_0x82c7('0x1d'),_0x49744f,JSON[_0x82c7('0x23')](_0x170bbc));_0x1cba28(_0x170bbc);})[_0x82c7('0x1c')](function(_0x56141e){logger['error']('UpdateWhatsappInteraction',_0x56141e['message'],_0x49744f);_0x7a9409(_0x3b5f78[_0x82c7('0x18')](0x1f4,_0x56141e[_0x82c7('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x33d4a6){return new Promise(function(_0x91f95a,_0x53a241){return db[_0x82c7('0x1e')][_0x82c7('0x24')]({'where':_0x33d4a6[_0x82c7('0x20')]?_0x33d4a6['options']['where']||null:null})[_0x82c7('0x13')](function(_0x5e67ca){if(_0x5e67ca){return _0x5e67ca[_0x82c7('0x25')](_0x33d4a6[_0x82c7('0x26')][_0x82c7('0x27')],_[_0x82c7('0x28')](_0x33d4a6[_0x82c7('0x26')],[_0x82c7('0x27'),'id'])||{});}})[_0x82c7('0x29')](function(_0x40d147){logger[_0x82c7('0x14')](_0x82c7('0x2a'),_0x33d4a6);logger[_0x82c7('0x16')](_0x82c7('0x2a'),_0x33d4a6,JSON[_0x82c7('0x23')](_0x40d147));_0x91f95a(_0x40d147);})[_0x82c7('0x1c')](function(_0x1473ac){logger['error'](_0x82c7('0x2a'),_0x1473ac[_0x82c7('0x1a')],_0x33d4a6);_0x53a241(_this[_0x82c7('0x18')](0x1f4,_0x1473ac['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5e817c8..52ecacb 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 _0x50f1=['save','remove','update','removeListener','whatsappInteraction:'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0x50f1,0x87));var _0x150f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x50f1[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x150f('0x0'),_0x150f('0x1'),_0x150f('0x2')];function createListener(_0x119860,_0x1d08ce){return function(_0x4cf782){_0x1d08ce['emit'](_0x119860,_0x4cf782);};}function removeListener(_0x515e4d,_0x1ab3da){return function(){WhatsappInteractionEvents[_0x150f('0x3')](_0x515e4d,_0x1ab3da);};}exports['register']=function(_0x5254ea){for(var _0x4450e6=0x0,_0x4b6e5f=events['length'];_0x4450e6<_0x4b6e5f;_0x4450e6++){var _0x5d47ff=events[_0x4450e6];var _0x468f71=createListener(_0x150f('0x4')+_0x5d47ff,_0x5254ea);WhatsappInteractionEvents['on'](_0x5d47ff,_0x468f71);}}; \ No newline at end of file +var _0x5dbf=['./whatsappInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x5dbf,0x9a));var _0xf5db=function(_0x1b436d,_0x93e0a8){_0x1b436d=_0x1b436d-0x0;var _0x34fac6=_0x5dbf[_0x1b436d];return _0x34fac6;};'use strict';var WhatsappInteractionEvents=require(_0xf5db('0x0'));var events=[_0xf5db('0x1'),_0xf5db('0x2'),_0xf5db('0x3')];function createListener(_0x22f0b4,_0x3cc1c3){return function(_0x5e3f92){_0x3cc1c3[_0xf5db('0x4')](_0x22f0b4,_0x5e3f92);};}function removeListener(_0x26f709,_0x4680ef){return function(){WhatsappInteractionEvents[_0xf5db('0x5')](_0x26f709,_0x4680ef);};}exports[_0xf5db('0x6')]=function(_0x56080f){for(var _0x4d0aba=0x0,_0x3ff793=events['length'];_0x4d0aba<_0x3ff793;_0x4d0aba++){var _0x509b3c=events[_0x4d0aba];var _0x5812cb=createListener('whatsappInteraction:'+_0x509b3c,_0x56080f);WhatsappInteractionEvents['on'](_0x509b3c,_0x5812cb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index bd0b3a7..15aa526 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 _0xa0b6=['accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept'];(function(_0x304efc,_0x2c6a48){var _0x34e2b9=function(_0x327c24){while(--_0x327c24){_0x304efc['push'](_0x304efc['shift']());}};_0x34e2b9(++_0x2c6a48);}(_0xa0b6,0xf6));var _0x6a0b=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa0b6[_0x7e2eb0];return _0xd92de4;};'use strict';var multer=require('multer');var util=require(_0x6a0b('0x0'));var path=require(_0x6a0b('0x1'));var timeout=require(_0x6a0b('0x2'));var express=require(_0x6a0b('0x3'));var router=express[_0x6a0b('0x4')]();var fs_extra=require(_0x6a0b('0x5'));var auth=require(_0x6a0b('0x6'));var interaction=require(_0x6a0b('0x7'));var config=require(_0x6a0b('0x8'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x6a0b('0x9')](),controller[_0x6a0b('0xa')]);router[_0x6a0b('0xb')]('/describe',auth[_0x6a0b('0x9')](),controller[_0x6a0b('0xc')]);router[_0x6a0b('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6a0b('0xd')]('/',auth[_0x6a0b('0x9')](),interaction[_0x6a0b('0xe')](_0x6a0b('0xf'),_0x6a0b('0x10')),controller[_0x6a0b('0x11')]);router[_0x6a0b('0xd')](_0x6a0b('0x12'),controller[_0x6a0b('0x13')]);router[_0x6a0b('0x14')](_0x6a0b('0x15'),auth['isAuthenticated'](),controller[_0x6a0b('0x16')]);router['put'](_0x6a0b('0x17'),auth[_0x6a0b('0x9')](),controller[_0x6a0b('0x18')]);router[_0x6a0b('0x14')](_0x6a0b('0x19'),auth[_0x6a0b('0x9')](),controller[_0x6a0b('0x1a')]);router[_0x6a0b('0x1b')](_0x6a0b('0x15'),auth[_0x6a0b('0x9')](),controller[_0x6a0b('0x1c')]);module[_0x6a0b('0x1d')]=router; \ No newline at end of file +var _0x0f4c=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsappmessage:create','create','status','update','/:id/accept','accept','put','reject','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2474b2,_0x54a824){var _0x22bea2=function(_0x37519e){while(--_0x37519e){_0x2474b2['push'](_0x2474b2['shift']());}};_0x22bea2(++_0x54a824);}(_0x0f4c,0x115));var _0xc0f4=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x0f4c[_0x28e74e];return _0xb45ac1;};'use strict';var multer=require('multer');var util=require(_0xc0f4('0x0'));var path=require(_0xc0f4('0x1'));var timeout=require(_0xc0f4('0x2'));var express=require(_0xc0f4('0x3'));var router=express[_0xc0f4('0x4')]();var fs_extra=require(_0xc0f4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc0f4('0x6'));var config=require(_0xc0f4('0x7'));var controller=require(_0xc0f4('0x8'));router[_0xc0f4('0x9')]('/',auth[_0xc0f4('0xa')](),controller['index']);router[_0xc0f4('0x9')](_0xc0f4('0xb'),auth[_0xc0f4('0xa')](),controller[_0xc0f4('0xc')]);router[_0xc0f4('0x9')](_0xc0f4('0xd'),auth[_0xc0f4('0xa')](),controller[_0xc0f4('0xe')]);router[_0xc0f4('0xf')]('/',auth['isAuthenticated'](),interaction[_0xc0f4('0x10')]('whatsapp',_0xc0f4('0x11')),controller[_0xc0f4('0x12')]);router[_0xc0f4('0xf')]('/:id/status',controller[_0xc0f4('0x13')]);router['put'](_0xc0f4('0xd'),auth[_0xc0f4('0xa')](),controller[_0xc0f4('0x14')]);router['put'](_0xc0f4('0x15'),auth[_0xc0f4('0xa')](),controller[_0xc0f4('0x16')]);router[_0xc0f4('0x17')]('/:id/reject',auth[_0xc0f4('0xa')](),controller[_0xc0f4('0x18')]);router[_0xc0f4('0x19')](_0xc0f4('0xd'),auth[_0xc0f4('0xa')](),controller[_0xc0f4('0x1a')]);module[_0xc0f4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 10702a0..8504173 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 _0x4291=['DATE','BOOLEAN','TEXT','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x1f53c3,_0x4e8a17){var _0x454280=function(_0x29e71e){while(--_0x29e71e){_0x1f53c3['push'](_0x1f53c3['shift']());}};_0x454280(++_0x4e8a17);}(_0x4291,0x1b3));var _0x1429=function(_0x3d4347,_0x412b60){_0x3d4347=_0x3d4347-0x0;var _0x2e2219=_0x4291[_0x3d4347];return _0x2e2219;};'use strict';var Sequelize=require(_0x1429('0x0'));module[_0x1429('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1429('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1429('0x3')]('in',_0x1429('0x4')),'defaultValue':_0x1429('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1429('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1429('0x5')]},'readAt':{'type':Sequelize[_0x1429('0x6')]},'secret':{'type':Sequelize[_0x1429('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1429('0x5')]},'providerResponse':{'type':Sequelize[_0x1429('0x8')]}}; \ No newline at end of file +var _0x5ee0=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x386a2a,_0x1e59ed){var _0x184ca7=function(_0x49df65){while(--_0x49df65){_0x386a2a['push'](_0x386a2a['shift']());}};_0x184ca7(++_0x1e59ed);}(_0x5ee0,0x17e));var _0x05ee=function(_0x518ac5,_0x124e61){_0x518ac5=_0x518ac5-0x0;var _0x52d16f=_0x5ee0[_0x518ac5];return _0x52d16f;};'use strict';var Sequelize=require(_0x05ee('0x0'));module[_0x05ee('0x1')]={'body':{'type':Sequelize[_0x05ee('0x2')](_0x05ee('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x05ee('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x05ee('0x5')]('in',_0x05ee('0x6')),'defaultValue':_0x05ee('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x05ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1661233..fa54016 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 _0xbc06=['then','includeAll','include','rows','keys','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options'];(function(_0x5869f5,_0x176fd5){var _0x6beba1=function(_0x253e04){while(--_0x253e04){_0x5869f5['push'](_0x5869f5['shift']());}};_0x6beba1(++_0x176fd5);}(_0xbc06,0x14f));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6bc0('0x0'));var rimraf=require(_0x6bc0('0x1'));var zipdir=require(_0x6bc0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6bc0('0x3'));var moment=require(_0x6bc0('0x4'));var BPromise=require(_0x6bc0('0x5'));var Mustache=require(_0x6bc0('0x6'));var util=require(_0x6bc0('0x7'));var path=require(_0x6bc0('0x8'));var sox=require(_0x6bc0('0x9'));var csv=require(_0x6bc0('0xa'));var ejs=require(_0x6bc0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6bc0('0xc'));var squel=require(_0x6bc0('0xd'));var crypto=require(_0x6bc0('0xe'));var jsforce=require(_0x6bc0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6bc0('0xa'));var querystring=require(_0x6bc0('0x10'));var Papa=require(_0x6bc0('0x11'));var Redis=require(_0x6bc0('0x12'));var authService=require(_0x6bc0('0x13'));var qs=require(_0x6bc0('0x14'));var as=require(_0x6bc0('0x15'));var hardwareService=require(_0x6bc0('0x16'));var logger=require(_0x6bc0('0x17'))(_0x6bc0('0x18'));var utils=require('../../config/utils');var config=require(_0x6bc0('0x19'));var licenseUtil=require(_0x6bc0('0x1a'));var db=require(_0x6bc0('0x1b'))['db'];config['redis']=_[_0x6bc0('0x1c')](config[_0x6bc0('0x1d')],{'host':_0x6bc0('0x1e'),'port':0x18eb});var socket=require(_0x6bc0('0x1f'))(new Redis(config[_0x6bc0('0x1d')]));require('./whatsappMessage.socket')[_0x6bc0('0x20')](socket);var jayson=require(_0x6bc0('0x21'));var client=jayson['client'][_0x6bc0('0x22')]({'port':0x232c});var client9002=jayson[_0x6bc0('0x23')][_0x6bc0('0x22')]({'port':0x232a});function respondWithRpcPromise(_0xe11c1f,_0x525786,_0x396e10,_0x4200be){return new BPromise(function(_0x172881,_0x1727c4){var _0x6a37dc=_0x4200be||client;return _0x6a37dc[_0x6bc0('0x24')](_0xe11c1f,_0x396e10)['then'](function(_0x2e7b89){logger[_0x6bc0('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x525786,_0x6bc0('0x26'));logger[_0x6bc0('0x27')](_0x6bc0('0x28'),_0x525786,_0x6bc0('0x26'),JSON[_0x6bc0('0x29')](_0x2e7b89));if(_0x2e7b89[_0x6bc0('0x2a')]){if(_0x2e7b89['error']['code']===0x1f4){logger[_0x6bc0('0x2a')](_0x6bc0('0x2b'),_0x525786,_0x2e7b89['error'][_0x6bc0('0x2c')]);return _0x1727c4(_0x2e7b89[_0x6bc0('0x2a')][_0x6bc0('0x2c')]);}logger[_0x6bc0('0x2a')](_0x6bc0('0x2b'),_0x525786,_0x2e7b89[_0x6bc0('0x2a')]['message']);return _0x172881(_0x2e7b89[_0x6bc0('0x2a')][_0x6bc0('0x2c')]);}else{logger[_0x6bc0('0x25')](_0x6bc0('0x2b'),_0x525786,_0x6bc0('0x26'));_0x172881(_0x2e7b89['result'][_0x6bc0('0x2c')]);}})[_0x6bc0('0x2d')](function(_0x2f560d){logger['error'](_0x6bc0('0x2b'),_0x525786,_0x2f560d);_0x1727c4(_0x2f560d);});});}function respondWithStatusCode(_0x5ab668,_0x1516b0){_0x1516b0=_0x1516b0||0xcc;return function(_0x10acf7){if(_0x10acf7){return _0x5ab668[_0x6bc0('0x2e')](_0x1516b0);}return _0x5ab668['status'](_0x1516b0)[_0x6bc0('0x2f')]();};}function respondWithResult(_0x3d9e6e,_0x1e9879){_0x1e9879=_0x1e9879||0xc8;return function(_0x4df729){if(_0x4df729){return _0x3d9e6e[_0x6bc0('0x30')](_0x1e9879)[_0x6bc0('0x31')](_0x4df729);}};}function respondWithFilteredResult(_0x195dd0,_0x53f97b){return function(_0x348b5c){if(_0x348b5c){var _0x539633=typeof _0x53f97b[_0x6bc0('0x32')]==='undefined'&&typeof _0x53f97b[_0x6bc0('0x33')]===_0x6bc0('0x34');var _0x5883a6=_0x348b5c['count'];var _0xf7b31b=_0x539633?0x0:_0x53f97b['offset'];var _0x5f51cb=_0x539633?_0x348b5c[_0x6bc0('0x35')]:_0x53f97b[_0x6bc0('0x32')]+_0x53f97b[_0x6bc0('0x33')];var _0x251efa;if(_0x5f51cb>=_0x5883a6){_0x5f51cb=_0x5883a6;_0x251efa=0xc8;}else{_0x251efa=0xce;}_0x195dd0[_0x6bc0('0x30')](_0x251efa);return _0x195dd0[_0x6bc0('0x36')](_0x6bc0('0x37'),_0xf7b31b+'-'+_0x5f51cb+'/'+_0x5883a6)['json'](_0x348b5c);}return null;};}function patchUpdates(_0x413702){return function(_0x1ff40c){try{jsonpatch[_0x6bc0('0x38')](_0x1ff40c,_0x413702,!![]);}catch(_0x35603f){return BPromise[_0x6bc0('0x39')](_0x35603f);}return _0x1ff40c[_0x6bc0('0x3a')]();};}function saveUpdates(_0x3dd961,_0x46bd2a){return function(_0x22efa5){if(_0x22efa5){return _0x22efa5[_0x6bc0('0x3b')](_0x3dd961)['then'](function(_0x57eae7){return _0x57eae7;});}return null;};}function removeEntity(_0x4df528,_0x3fe4fc){return function(_0x298101){if(_0x298101){return _0x298101[_0x6bc0('0x3c')]()['then'](function(){_0x4df528['status'](0xcc)[_0x6bc0('0x2f')]();});}};}function handleEntityNotFound(_0x631548,_0x4f3ffa){return function(_0x561655){if(!_0x561655){_0x631548[_0x6bc0('0x2e')](0x194);}return _0x561655;};}function handleError(_0x301d02,_0x31ce41){_0x31ce41=_0x31ce41||0x1f4;return function(_0x92c1f0){logger[_0x6bc0('0x2a')](_0x92c1f0[_0x6bc0('0x3d')]);if(_0x92c1f0['name']){delete _0x92c1f0[_0x6bc0('0x3e')];}_0x301d02['status'](_0x31ce41)['send'](_0x92c1f0);};}exports[_0x6bc0('0x3f')]=function(_0x15f833,_0x3c2892){var _0x24cab1={},_0x327477={},_0xab8bf9={'count':0x0,'rows':[]};var _0x12331e=_[_0x6bc0('0x40')](db[_0x6bc0('0x41')][_0x6bc0('0x42')],function(_0x32d01e){return{'name':_0x32d01e[_0x6bc0('0x43')],'type':_0x32d01e[_0x6bc0('0x44')][_0x6bc0('0x45')]};});_0x327477['model']=_['map'](_0x12331e,_0x6bc0('0x3e'));_0x327477[_0x6bc0('0x46')]=_['keys'](_0x15f833['query']);_0x327477['filters']=_[_0x6bc0('0x47')](_0x327477['model'],_0x327477[_0x6bc0('0x46')]);_0x24cab1[_0x6bc0('0x48')]=_[_0x6bc0('0x47')](_0x327477[_0x6bc0('0x49')],qs[_0x6bc0('0x4a')](_0x15f833[_0x6bc0('0x46')][_0x6bc0('0x4a')]));_0x24cab1[_0x6bc0('0x48')]=_0x24cab1[_0x6bc0('0x48')][_0x6bc0('0x4b')]?_0x24cab1[_0x6bc0('0x48')]:_0x327477['model'];if(!_0x15f833['query'][_0x6bc0('0x4c')]('nolimit')){_0x24cab1[_0x6bc0('0x33')]=qs[_0x6bc0('0x33')](_0x15f833[_0x6bc0('0x46')][_0x6bc0('0x33')]);_0x24cab1[_0x6bc0('0x32')]=qs[_0x6bc0('0x32')](_0x15f833[_0x6bc0('0x46')]['offset']);}_0x24cab1[_0x6bc0('0x4d')]=qs[_0x6bc0('0x4e')](_0x15f833[_0x6bc0('0x46')][_0x6bc0('0x4e')]);_0x24cab1[_0x6bc0('0x4f')]=qs[_0x6bc0('0x50')](_[_0x6bc0('0x51')](_0x15f833[_0x6bc0('0x46')],_0x327477[_0x6bc0('0x50')]),_0x12331e);if(_0x15f833['query'][_0x6bc0('0x52')]){_0x24cab1[_0x6bc0('0x4f')]=_[_0x6bc0('0x53')](_0x24cab1['where'],{'$or':_['map'](_0x12331e,function(_0x2c123a){if(_0x2c123a[_0x6bc0('0x44')]!=='VIRTUAL'){var _0x3852fe={};_0x3852fe[_0x2c123a[_0x6bc0('0x3e')]]={'$like':'%'+_0x15f833['query'][_0x6bc0('0x52')]+'%'};return _0x3852fe;}})});}_0x24cab1=_[_0x6bc0('0x53')]({},_0x24cab1,_0x15f833[_0x6bc0('0x54')]);var _0x40eca6={'where':_0x24cab1['where']};return db[_0x6bc0('0x41')][_0x6bc0('0x35')](_0x40eca6)[_0x6bc0('0x55')](function(_0x2f218d){_0xab8bf9[_0x6bc0('0x35')]=_0x2f218d;if(_0x15f833[_0x6bc0('0x46')][_0x6bc0('0x56')]){_0x24cab1[_0x6bc0('0x57')]=[{'all':!![]}];}return db[_0x6bc0('0x41')]['findAll'](_0x24cab1);})['then'](function(_0x2e290d){_0xab8bf9[_0x6bc0('0x58')]=_0x2e290d;return _0xab8bf9;})[_0x6bc0('0x55')](respondWithFilteredResult(_0x3c2892,_0x24cab1))['catch'](handleError(_0x3c2892,null));};exports['show']=function(_0x2f0e57,_0x19bda4){var _0x69a1ee={'raw':!![],'where':{'id':_0x2f0e57['params']['id']}},_0x119031={};_0x119031['model']=_['keys'](db[_0x6bc0('0x41')][_0x6bc0('0x42')]);_0x119031[_0x6bc0('0x46')]=_[_0x6bc0('0x59')](_0x2f0e57[_0x6bc0('0x46')]);_0x119031[_0x6bc0('0x50')]=_[_0x6bc0('0x47')](_0x119031[_0x6bc0('0x49')],_0x119031['query']);_0x69a1ee[_0x6bc0('0x48')]=_['intersection'](_0x119031[_0x6bc0('0x49')],qs[_0x6bc0('0x4a')](_0x2f0e57[_0x6bc0('0x46')][_0x6bc0('0x4a')]));_0x69a1ee[_0x6bc0('0x48')]=_0x69a1ee['attributes'][_0x6bc0('0x4b')]?_0x69a1ee['attributes']:_0x119031[_0x6bc0('0x49')];if(_0x2f0e57['query'][_0x6bc0('0x56')]){_0x69a1ee[_0x6bc0('0x57')]=[{'all':!![]}];}_0x69a1ee=_[_0x6bc0('0x53')]({},_0x69a1ee,_0x2f0e57['options']);return db[_0x6bc0('0x41')][_0x6bc0('0x5a')](_0x69a1ee)[_0x6bc0('0x55')](handleEntityNotFound(_0x19bda4,null))['then'](respondWithResult(_0x19bda4,null))[_0x6bc0('0x2d')](handleError(_0x19bda4,null));};exports[_0x6bc0('0x5b')]=function(_0x5e8494,_0x2a8b95){return db['WhatsappMessage']['create'](_0x5e8494[_0x6bc0('0x5c')],{})[_0x6bc0('0x55')](respondWithResult(_0x2a8b95,0xc9))[_0x6bc0('0x2d')](handleError(_0x2a8b95,null));};exports[_0x6bc0('0x3b')]=function(_0xcbfbee,_0x4aebb9){if(_0xcbfbee[_0x6bc0('0x5c')]['id']){delete _0xcbfbee['body']['id'];}return db[_0x6bc0('0x41')][_0x6bc0('0x5a')]({'where':{'id':_0xcbfbee[_0x6bc0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4aebb9,null))[_0x6bc0('0x55')](saveUpdates(_0xcbfbee[_0x6bc0('0x5c')],null))[_0x6bc0('0x55')](respondWithResult(_0x4aebb9,null))['catch'](handleError(_0x4aebb9,null));};exports[_0x6bc0('0x3c')]=function(_0x2f9e3d,_0x28d78e){return db[_0x6bc0('0x41')][_0x6bc0('0x5a')]({'where':{'id':_0x2f9e3d['params']['id']}})[_0x6bc0('0x55')](handleEntityNotFound(_0x28d78e,null))[_0x6bc0('0x55')](removeEntity(_0x28d78e,null))[_0x6bc0('0x2d')](handleError(_0x28d78e,null));};exports[_0x6bc0('0x5e')]=function(_0x1d8106,_0x43c7a1){return db[_0x6bc0('0x41')][_0x6bc0('0x5e')]()[_0x6bc0('0x55')](respondWithResult(_0x43c7a1,null))[_0x6bc0('0x2d')](handleError(_0x43c7a1,null));};var interaction_log=require(_0x6bc0('0x17'))(_0x6bc0('0x5f'));exports[_0x6bc0('0x60')]=function(_0x2d31fd,_0x3ad526,_0x2aa99d){var _0xecf234={'agent':{},'channel':_0x6bc0('0x61')};if(_0x2d31fd[_0x6bc0('0x5c')]['id']){delete _0x2d31fd['body']['id'];}_0x2d31fd[_0x6bc0('0x5c')][_0x6bc0('0x62')]=!![];_0x2d31fd['body'][_0x6bc0('0x63')]=moment()[_0x6bc0('0x64')](_0x6bc0('0x65'));_0x2d31fd[_0x6bc0('0x5c')][_0x6bc0('0x66')]=_0x2d31fd[_0x6bc0('0x5c')][_0x6bc0('0x66')]||_0x2d31fd[_0x6bc0('0x67')]['id'];_0xecf234[_0x6bc0('0x68')]['id']=_0x2d31fd[_0x6bc0('0x5c')]['UserId'];return db[_0x6bc0('0x41')][_0x6bc0('0x5a')]({'where':{'id':_0x2d31fd[_0x6bc0('0x5d')]['id'],'UserId':null}})[_0x6bc0('0x55')](handleEntityNotFound(_0x3ad526,null))[_0x6bc0('0x55')](saveUpdates(_0x2d31fd[_0x6bc0('0x5c')],null))[_0x6bc0('0x55')](function(_0x178b93){if(_0x178b93){_0xecf234[_0x6bc0('0x2c')]=_0x178b93[_0x6bc0('0x69')]({'plain':!![]});return db[_0x6bc0('0x6a')][_0x6bc0('0x5a')]({'where':{'id':_0x178b93[_0x6bc0('0x6b')]}});}return null;})[_0x6bc0('0x55')](handleEntityNotFound(_0x3ad526,null))[_0x6bc0('0x55')](function(_0x26d4dc){if(_0x26d4dc){return _0x26d4dc[_0x6bc0('0x3b')]({'UserId':_0x2d31fd[_0x6bc0('0x5c')][_0x6bc0('0x66')],'read1stAt':_['isNil'](_0x26d4dc[_0x6bc0('0x6c')])?moment()['format'](_0x6bc0('0x65')):undefined});}return null;})['then'](function(_0x520b98){if(_0x520b98){_0xecf234[_0x6bc0('0x6d')]=_0x520b98[_0x6bc0('0x69')]({'plain':!![]});interaction_log[_0x6bc0('0x25')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d31fd[_0x6bc0('0x67')]['id'],_0x2d31fd[_0x6bc0('0x67')][_0x6bc0('0x3e')],_0x2d31fd[_0x6bc0('0x67')][_0x6bc0('0x6e')],_0xecf234[_0x6bc0('0x6d')]['id'],_0x2d31fd[_0x6bc0('0x5c')]?JSON[_0x6bc0('0x29')](_0x2d31fd['body']):_0x6bc0('0x6f'));return respondWithRpcPromise(_0x6bc0('0x70'),'acceptMessage',_0xecf234);}return null;})[_0x6bc0('0x55')](function(_0x1901cc){var _0x56f763='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1901cc[_0x6bc0('0x2c')][_0x6bc0('0x71')];return db[_0x6bc0('0x72')][_0x6bc0('0x46')](_0x56f763,{'type':db[_0x6bc0('0x73')][_0x6bc0('0x74')][_0x6bc0('0x75')],'raw':!![]})[_0x6bc0('0x55')](function(_0x527f83){return _0x527f83;});})['then'](function(_0x3fb541){if(_0x3fb541){_0xecf234[_0x6bc0('0x2c')][_0x6bc0('0x76')]=_0x3fb541[0x0];if(!_0x2d31fd[_0x6bc0('0x5c')]['UserId'])return;return db[_0x6bc0('0x77')][_0x6bc0('0x5a')]({'where':{'id':_0x2d31fd[_0x6bc0('0x5c')][_0x6bc0('0x66')],'role':_0x6bc0('0x68')},'attributes':['id',_0x6bc0('0x3e'),_0x6bc0('0x78'),_0x6bc0('0x79'),_0x6bc0('0x7a')],'raw':!![]});}return null;})[_0x6bc0('0x55')](function(_0x345807){if(!_0x345807)return null;_0xecf234['message']['agent']=_0x345807;return _0xecf234;})[_0x6bc0('0x55')](function(_0x595bcd){if(_0x595bcd){if(_0x2d31fd[_0x6bc0('0x5c')][_0x6bc0('0x7b')]){_0xecf234[_0x6bc0('0x2c')][_0x6bc0('0x7c')]=util[_0x6bc0('0x64')](_0x6bc0('0x7d'),_0x2d31fd[_0x6bc0('0x67')][_0x6bc0('0x3e')]);_0xecf234[_0x6bc0('0x2c')][_0x6bc0('0x7e')]=_0xecf234[_0x6bc0('0x7e')];_0xecf234[_0x6bc0('0x2c')][_0x6bc0('0x7f')]=_0xecf234[_0x6bc0('0x7e')];_0xecf234[_0x6bc0('0x2c')][_0x6bc0('0x80')]=_0x6bc0('0x60');return respondWithRpcPromise(_0x6bc0('0x81'),_0x6bc0('0x81'),{'event':_0x6bc0('0x82'),'message':_0xecf234[_0x6bc0('0x2c')]},client9002)[_0x6bc0('0x55')](function(){return _0xecf234;});}return _0xecf234;}return null;})['then'](respondWithResult(_0x3ad526,null))[_0x6bc0('0x2d')](handleError(_0x3ad526,null));};var interaction_log=require(_0x6bc0('0x17'))(_0x6bc0('0x5f'));exports[_0x6bc0('0x39')]=function(_0x2cf9e3,_0x54cf3f,_0x7e30db){var _0x5169ca={'agent':{},'channel':_0x6bc0('0x61')};if(_0x2cf9e3[_0x6bc0('0x5c')]['id']){delete _0x2cf9e3[_0x6bc0('0x5c')]['id'];}_0x2cf9e3[_0x6bc0('0x5c')][_0x6bc0('0x66')]=_0x2cf9e3['body'][_0x6bc0('0x66')]||_0x2cf9e3[_0x6bc0('0x67')]['id'];_0x5169ca[_0x6bc0('0x68')]['id']=_0x2cf9e3['body'][_0x6bc0('0x66')];return db[_0x6bc0('0x41')][_0x6bc0('0x5a')]({'where':{'id':_0x2cf9e3[_0x6bc0('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x54cf3f,null))[_0x6bc0('0x55')](function(_0x59e477){if(_0x59e477){_0x5169ca[_0x6bc0('0x2c')]=_0x59e477[_0x6bc0('0x69')]({'plain':!![]});return db[_0x6bc0('0x6a')][_0x6bc0('0x5a')]({'where':{'id':_0x59e477[_0x6bc0('0x6b')]}});}return null;})[_0x6bc0('0x55')](handleEntityNotFound(_0x54cf3f,null))[_0x6bc0('0x55')](function(_0x274c25){if(_0x274c25){_0x5169ca[_0x6bc0('0x6d')]=_0x274c25[_0x6bc0('0x69')]({'plain':!![]});interaction_log[_0x6bc0('0x25')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2cf9e3[_0x6bc0('0x67')]['id'],_0x2cf9e3['user'][_0x6bc0('0x3e')],_0x2cf9e3[_0x6bc0('0x67')][_0x6bc0('0x6e')],_0x5169ca[_0x6bc0('0x6d')]['id'],_0x2cf9e3[_0x6bc0('0x5c')]?JSON[_0x6bc0('0x29')](_0x2cf9e3['body']):_0x6bc0('0x6f'));return respondWithRpcPromise(_0x6bc0('0x83'),_0x6bc0('0x84'),_0x5169ca);}return null;})[_0x6bc0('0x55')](function(_0x13f953){var _0x57e969=_0x6bc0('0x85')+_0x13f953[_0x6bc0('0x2c')][_0x6bc0('0x71')];return db['sequelize'][_0x6bc0('0x46')](_0x57e969,{'type':db[_0x6bc0('0x73')][_0x6bc0('0x74')][_0x6bc0('0x75')],'raw':!![]})[_0x6bc0('0x55')](function(_0x1d2619){return _0x1d2619;});})['then'](function(_0x310855){if(_0x310855){_0x5169ca[_0x6bc0('0x2c')][_0x6bc0('0x76')]=_0x310855[0x0];if(!_0x2cf9e3[_0x6bc0('0x5c')][_0x6bc0('0x66')])return;return db[_0x6bc0('0x77')][_0x6bc0('0x5a')]({'where':{'id':_0x2cf9e3[_0x6bc0('0x5c')][_0x6bc0('0x66')],'role':_0x6bc0('0x68')},'attributes':['id',_0x6bc0('0x3e'),_0x6bc0('0x78'),_0x6bc0('0x79'),_0x6bc0('0x7a')],'raw':!![]});}return null;})[_0x6bc0('0x55')](function(_0x146b8d){if(!_0x146b8d)return null;_0x5169ca[_0x6bc0('0x2c')][_0x6bc0('0x68')]=_0x146b8d;return _0x5169ca;})['then'](function(_0x5dd30d){if(_0x5dd30d){_0x5dd30d[_0x6bc0('0x2c')][_0x6bc0('0x7c')]=util[_0x6bc0('0x64')]('SIP/%s',_0x2cf9e3[_0x6bc0('0x67')][_0x6bc0('0x3e')]);_0x5dd30d[_0x6bc0('0x2c')]['channel']=_0x5169ca[_0x6bc0('0x7e')];_0x5dd30d[_0x6bc0('0x2c')][_0x6bc0('0x7f')]=_0x5169ca[_0x6bc0('0x7e')];_0x5dd30d[_0x6bc0('0x2c')]['event']='reject';respondWithRpcPromise(_0x6bc0('0x81'),'EventManager',{'event':_0x6bc0('0x86'),'message':_0x5dd30d[_0x6bc0('0x2c')]},client9002);return _0x5169ca;}return null;})[_0x6bc0('0x55')](respondWithResult(_0x54cf3f,null))[_0x6bc0('0x2d')](handleError(_0x54cf3f,null));};exports['status']=function(_0x260795,_0x2081ef,_0x47c7d0){if(_0x260795[_0x6bc0('0x5c')]['id']){delete _0x260795['body']['id'];}var _0x5cb3a8;return db[_0x6bc0('0x41')][_0x6bc0('0x5a')]({'where':{'id':_0x260795[_0x6bc0('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2081ef,null))[_0x6bc0('0x55')](function(_0x1d8d41){if(_0x1d8d41){_0x5cb3a8=_0x1d8d41;return db['WhatsappAccount']['find']({'where':{'id':_0x1d8d41['WhatsappAccountId']}});}})[_0x6bc0('0x55')](handleEntityNotFound(_0x2081ef,null))['then'](function(_0x122ffa){if(_0x122ffa){logger[_0x6bc0('0x27')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x6bc0('0x30'),'received\x20delivery\x20report\x20from',_0x122ffa[_0x6bc0('0x44')],util[_0x6bc0('0x87')](_0x260795['body'],{'showHidden':![],'depth':null}));switch(_0x122ffa[_0x6bc0('0x44')]){case _0x6bc0('0x88'):if(_0x260795[_0x6bc0('0x5c')][_0x6bc0('0x89')]&&_0x260795[_0x6bc0('0x5c')][_0x6bc0('0x89')]===_0x5cb3a8['messageId']&&_0x260795['body'][_0x6bc0('0x8a')]&&_0x260795[_0x6bc0('0x5c')][_0x6bc0('0x8a')]==='read'){return _0x5cb3a8['update']({'read':!![]});}else{logger[_0x6bc0('0x2a')](_0x6bc0('0x8b'),_0x6bc0('0x30'),_0x6bc0('0x88'),util[_0x6bc0('0x87')](_0x260795[_0x6bc0('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x5cb3a8;}})[_0x6bc0('0x55')](respondWithResult(_0x2081ef,null))[_0x6bc0('0x2d')](handleError(_0x2081ef,null));}; \ No newline at end of file +var _0x9d54=['EventManager','acceptmessage','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','User','rejectmessage','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','name','index','rawAttributes','type','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','WhatsappMessage','then','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','user','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event'];(function(_0x456790,_0x4897f9){var _0x9a82bc=function(_0x1f68a2){while(--_0x1f68a2){_0x456790['push'](_0x456790['shift']());}};_0x9a82bc(++_0x4897f9);}(_0x9d54,0x11e));var _0x49d5=function(_0x1e300c,_0x633f1f){_0x1e300c=_0x1e300c-0x0;var _0x40fe14=_0x9d54[_0x1e300c];return _0x40fe14;};'use strict';var emlformat=require(_0x49d5('0x0'));var rimraf=require(_0x49d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49d5('0x2'));var moment=require(_0x49d5('0x3'));var BPromise=require(_0x49d5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49d5('0x5'));var sox=require(_0x49d5('0x6'));var csv=require('to-csv');var ejs=require(_0x49d5('0x7'));var fs=require('fs');var fs_extra=require(_0x49d5('0x8'));var _=require('lodash');var squel=require(_0x49d5('0x9'));var crypto=require(_0x49d5('0xa'));var jsforce=require(_0x49d5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x49d5('0xc'));var querystring=require(_0x49d5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49d5('0xe'));var as=require(_0x49d5('0xf'));var hardwareService=require(_0x49d5('0x10'));var logger=require(_0x49d5('0x11'))('api');var utils=require(_0x49d5('0x12'));var config=require(_0x49d5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x49d5('0x14'))['db'];config[_0x49d5('0x15')]=_['defaults'](config['redis'],{'host':_0x49d5('0x16'),'port':0x18eb});var socket=require(_0x49d5('0x17'))(new Redis(config[_0x49d5('0x15')]));require('./whatsappMessage.socket')[_0x49d5('0x18')](socket);var jayson=require(_0x49d5('0x19'));var client=jayson[_0x49d5('0x1a')][_0x49d5('0x1b')]({'port':0x232c});var client9002=jayson[_0x49d5('0x1a')][_0x49d5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x25a912,_0x363084,_0x3453fe,_0x32747c){return new BPromise(function(_0x2923f9,_0x13ac92){var _0x157cc0=_0x32747c||client;return _0x157cc0[_0x49d5('0x1c')](_0x25a912,_0x3453fe)['then'](function(_0x1cae72){logger[_0x49d5('0x1d')](_0x49d5('0x1e'),_0x363084,_0x49d5('0x1f'));logger['debug'](_0x49d5('0x20'),_0x363084,_0x49d5('0x1f'),JSON[_0x49d5('0x21')](_0x1cae72));if(_0x1cae72['error']){if(_0x1cae72[_0x49d5('0x22')][_0x49d5('0x23')]===0x1f4){logger['error'](_0x49d5('0x1e'),_0x363084,_0x1cae72['error'][_0x49d5('0x24')]);return _0x13ac92(_0x1cae72[_0x49d5('0x22')][_0x49d5('0x24')]);}logger[_0x49d5('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x363084,_0x1cae72[_0x49d5('0x22')]['message']);return _0x2923f9(_0x1cae72[_0x49d5('0x22')]['message']);}else{logger['info'](_0x49d5('0x1e'),_0x363084,_0x49d5('0x1f'));_0x2923f9(_0x1cae72['result']['message']);}})[_0x49d5('0x25')](function(_0x2d2a91){logger[_0x49d5('0x22')](_0x49d5('0x1e'),_0x363084,_0x2d2a91);_0x13ac92(_0x2d2a91);});});}function respondWithStatusCode(_0x3a74ae,_0xebd06b){_0xebd06b=_0xebd06b||0xcc;return function(_0x30046e){if(_0x30046e){return _0x3a74ae[_0x49d5('0x26')](_0xebd06b);}return _0x3a74ae['status'](_0xebd06b)[_0x49d5('0x27')]();};}function respondWithResult(_0x1fa185,_0x2dcd94){_0x2dcd94=_0x2dcd94||0xc8;return function(_0x4a0c1d){if(_0x4a0c1d){return _0x1fa185[_0x49d5('0x28')](_0x2dcd94)['json'](_0x4a0c1d);}};}function respondWithFilteredResult(_0x26ced6,_0x4e9c60){return function(_0x556180){if(_0x556180){var _0x39980d=typeof _0x4e9c60[_0x49d5('0x29')]===_0x49d5('0x2a')&&typeof _0x4e9c60['limit']===_0x49d5('0x2a');var _0x4df5eb=_0x556180[_0x49d5('0x2b')];var _0xacadd1=_0x39980d?0x0:_0x4e9c60[_0x49d5('0x29')];var _0x297b13=_0x39980d?_0x556180[_0x49d5('0x2b')]:_0x4e9c60['offset']+_0x4e9c60[_0x49d5('0x2c')];var _0x3db756;if(_0x297b13>=_0x4df5eb){_0x297b13=_0x4df5eb;_0x3db756=0xc8;}else{_0x3db756=0xce;}_0x26ced6[_0x49d5('0x28')](_0x3db756);return _0x26ced6['set'](_0x49d5('0x2d'),_0xacadd1+'-'+_0x297b13+'/'+_0x4df5eb)[_0x49d5('0x2e')](_0x556180);}return null;};}function patchUpdates(_0x50da0b){return function(_0x1356a8){try{jsonpatch[_0x49d5('0x2f')](_0x1356a8,_0x50da0b,!![]);}catch(_0x3b1670){return BPromise[_0x49d5('0x30')](_0x3b1670);}return _0x1356a8[_0x49d5('0x31')]();};}function saveUpdates(_0x59d755,_0x440c48){return function(_0x592431){if(_0x592431){return _0x592431[_0x49d5('0x32')](_0x59d755)['then'](function(_0x13654d){return _0x13654d;});}return null;};}function removeEntity(_0x49d869,_0x3e38f4){return function(_0x48ebec){if(_0x48ebec){return _0x48ebec[_0x49d5('0x33')]()['then'](function(){_0x49d869['status'](0xcc)[_0x49d5('0x27')]();});}};}function handleEntityNotFound(_0x38bb9d,_0x5c59d2){return function(_0x35a16a){if(!_0x35a16a){_0x38bb9d[_0x49d5('0x26')](0x194);}return _0x35a16a;};}function handleError(_0x1ee715,_0x335cff){_0x335cff=_0x335cff||0x1f4;return function(_0x109720){logger[_0x49d5('0x22')](_0x109720['stack']);if(_0x109720['name']){delete _0x109720[_0x49d5('0x34')];}_0x1ee715[_0x49d5('0x28')](_0x335cff)['send'](_0x109720);};}exports[_0x49d5('0x35')]=function(_0x3ec7f9,_0x5075fd){var _0xffe1b0={},_0x4a8a39={},_0x15695c={'count':0x0,'rows':[]};var _0x800478=_['map'](db['WhatsappMessage'][_0x49d5('0x36')],function(_0x1a8efe){return{'name':_0x1a8efe['fieldName'],'type':_0x1a8efe[_0x49d5('0x37')]['key']};});_0x4a8a39['model']=_[_0x49d5('0x38')](_0x800478,_0x49d5('0x34'));_0x4a8a39[_0x49d5('0x39')]=_['keys'](_0x3ec7f9['query']);_0x4a8a39[_0x49d5('0x3a')]=_[_0x49d5('0x3b')](_0x4a8a39['model'],_0x4a8a39[_0x49d5('0x39')]);_0xffe1b0[_0x49d5('0x3c')]=_[_0x49d5('0x3b')](_0x4a8a39[_0x49d5('0x3d')],qs[_0x49d5('0x3e')](_0x3ec7f9[_0x49d5('0x39')][_0x49d5('0x3e')]));_0xffe1b0[_0x49d5('0x3c')]=_0xffe1b0['attributes'][_0x49d5('0x3f')]?_0xffe1b0['attributes']:_0x4a8a39[_0x49d5('0x3d')];if(!_0x3ec7f9['query'][_0x49d5('0x40')]('nolimit')){_0xffe1b0[_0x49d5('0x2c')]=qs[_0x49d5('0x2c')](_0x3ec7f9['query'][_0x49d5('0x2c')]);_0xffe1b0[_0x49d5('0x29')]=qs[_0x49d5('0x29')](_0x3ec7f9[_0x49d5('0x39')][_0x49d5('0x29')]);}_0xffe1b0[_0x49d5('0x41')]=qs[_0x49d5('0x42')](_0x3ec7f9['query'][_0x49d5('0x42')]);_0xffe1b0['where']=qs[_0x49d5('0x3a')](_[_0x49d5('0x43')](_0x3ec7f9[_0x49d5('0x39')],_0x4a8a39[_0x49d5('0x3a')]),_0x800478);if(_0x3ec7f9[_0x49d5('0x39')][_0x49d5('0x44')]){_0xffe1b0[_0x49d5('0x45')]=_[_0x49d5('0x46')](_0xffe1b0[_0x49d5('0x45')],{'$or':_[_0x49d5('0x38')](_0x800478,function(_0x2a418e){if(_0x2a418e['type']!=='VIRTUAL'){var _0x5a8ec0={};_0x5a8ec0[_0x2a418e[_0x49d5('0x34')]]={'$like':'%'+_0x3ec7f9[_0x49d5('0x39')]['filter']+'%'};return _0x5a8ec0;}})});}_0xffe1b0=_[_0x49d5('0x46')]({},_0xffe1b0,_0x3ec7f9[_0x49d5('0x47')]);var _0x43149b={'where':_0xffe1b0[_0x49d5('0x45')]};return db[_0x49d5('0x48')]['count'](_0x43149b)[_0x49d5('0x49')](function(_0xa8e817){_0x15695c['count']=_0xa8e817;if(_0x3ec7f9['query'][_0x49d5('0x4a')]){_0xffe1b0[_0x49d5('0x4b')]=[{'all':!![]}];}return db[_0x49d5('0x48')][_0x49d5('0x4c')](_0xffe1b0);})[_0x49d5('0x49')](function(_0x2fe8e6){_0x15695c[_0x49d5('0x4d')]=_0x2fe8e6;return _0x15695c;})['then'](respondWithFilteredResult(_0x5075fd,_0xffe1b0))[_0x49d5('0x25')](handleError(_0x5075fd,null));};exports[_0x49d5('0x4e')]=function(_0x38ae43,_0x33e26b){var _0x4a6dee={'raw':!![],'where':{'id':_0x38ae43[_0x49d5('0x4f')]['id']}},_0x2c96bb={};_0x2c96bb[_0x49d5('0x3d')]=_[_0x49d5('0x50')](db[_0x49d5('0x48')][_0x49d5('0x36')]);_0x2c96bb['query']=_[_0x49d5('0x50')](_0x38ae43['query']);_0x2c96bb[_0x49d5('0x3a')]=_[_0x49d5('0x3b')](_0x2c96bb[_0x49d5('0x3d')],_0x2c96bb['query']);_0x4a6dee[_0x49d5('0x3c')]=_[_0x49d5('0x3b')](_0x2c96bb[_0x49d5('0x3d')],qs[_0x49d5('0x3e')](_0x38ae43[_0x49d5('0x39')][_0x49d5('0x3e')]));_0x4a6dee[_0x49d5('0x3c')]=_0x4a6dee['attributes'][_0x49d5('0x3f')]?_0x4a6dee['attributes']:_0x2c96bb[_0x49d5('0x3d')];if(_0x38ae43[_0x49d5('0x39')]['includeAll']){_0x4a6dee[_0x49d5('0x4b')]=[{'all':!![]}];}_0x4a6dee=_[_0x49d5('0x46')]({},_0x4a6dee,_0x38ae43['options']);return db['WhatsappMessage'][_0x49d5('0x51')](_0x4a6dee)['then'](handleEntityNotFound(_0x33e26b,null))[_0x49d5('0x49')](respondWithResult(_0x33e26b,null))[_0x49d5('0x25')](handleError(_0x33e26b,null));};exports[_0x49d5('0x52')]=function(_0x776f3a,_0x22fb3a){return db[_0x49d5('0x48')][_0x49d5('0x52')](_0x776f3a[_0x49d5('0x53')],{})[_0x49d5('0x49')](respondWithResult(_0x22fb3a,0xc9))[_0x49d5('0x25')](handleError(_0x22fb3a,null));};exports['update']=function(_0x4a70d8,_0x3e8a22){if(_0x4a70d8[_0x49d5('0x53')]['id']){delete _0x4a70d8[_0x49d5('0x53')]['id'];}return db[_0x49d5('0x48')][_0x49d5('0x51')]({'where':{'id':_0x4a70d8[_0x49d5('0x4f')]['id']}})[_0x49d5('0x49')](handleEntityNotFound(_0x3e8a22,null))[_0x49d5('0x49')](saveUpdates(_0x4a70d8['body'],null))['then'](respondWithResult(_0x3e8a22,null))[_0x49d5('0x25')](handleError(_0x3e8a22,null));};exports[_0x49d5('0x33')]=function(_0x55bd69,_0x103dbb){return db[_0x49d5('0x48')][_0x49d5('0x51')]({'where':{'id':_0x55bd69[_0x49d5('0x4f')]['id']}})[_0x49d5('0x49')](handleEntityNotFound(_0x103dbb,null))[_0x49d5('0x49')](removeEntity(_0x103dbb,null))[_0x49d5('0x25')](handleError(_0x103dbb,null));};exports[_0x49d5('0x54')]=function(_0x4ed1f5,_0x36207b){return db[_0x49d5('0x48')][_0x49d5('0x54')]()[_0x49d5('0x49')](respondWithResult(_0x36207b,null))[_0x49d5('0x25')](handleError(_0x36207b,null));};var interaction_log=require(_0x49d5('0x11'))(_0x49d5('0x55'));exports[_0x49d5('0x56')]=function(_0x32c409,_0x4206f4,_0x222d26){var _0x2e3c67={'agent':{},'channel':_0x49d5('0x57')};if(_0x32c409[_0x49d5('0x53')]['id']){delete _0x32c409[_0x49d5('0x53')]['id'];}_0x32c409[_0x49d5('0x53')][_0x49d5('0x58')]=!![];_0x32c409[_0x49d5('0x53')][_0x49d5('0x59')]=moment()['format'](_0x49d5('0x5a'));_0x32c409[_0x49d5('0x53')][_0x49d5('0x5b')]=_0x32c409[_0x49d5('0x53')][_0x49d5('0x5b')]||_0x32c409['user']['id'];_0x2e3c67['agent']['id']=_0x32c409[_0x49d5('0x53')][_0x49d5('0x5b')];return db[_0x49d5('0x48')]['find']({'where':{'id':_0x32c409['params']['id'],'UserId':null}})[_0x49d5('0x49')](handleEntityNotFound(_0x4206f4,null))[_0x49d5('0x49')](saveUpdates(_0x32c409[_0x49d5('0x53')],null))[_0x49d5('0x49')](function(_0x5ad5b4){if(_0x5ad5b4){_0x2e3c67[_0x49d5('0x24')]=_0x5ad5b4['get']({'plain':!![]});return db[_0x49d5('0x5c')][_0x49d5('0x51')]({'where':{'id':_0x5ad5b4[_0x49d5('0x5d')]}});}return null;})[_0x49d5('0x49')](handleEntityNotFound(_0x4206f4,null))['then'](function(_0x299539){if(_0x299539){return _0x299539['update']({'UserId':_0x32c409[_0x49d5('0x53')][_0x49d5('0x5b')],'read1stAt':_[_0x49d5('0x5e')](_0x299539[_0x49d5('0x5f')])?moment()[_0x49d5('0x60')](_0x49d5('0x5a')):undefined});}return null;})[_0x49d5('0x49')](function(_0x9ac68){if(_0x9ac68){_0x2e3c67[_0x49d5('0x61')]=_0x9ac68['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x32c409[_0x49d5('0x62')]['id'],_0x32c409[_0x49d5('0x62')][_0x49d5('0x34')],_0x32c409[_0x49d5('0x62')][_0x49d5('0x63')],_0x2e3c67['interaction']['id'],_0x32c409['body']?JSON['stringify'](_0x32c409[_0x49d5('0x53')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2e3c67);}return null;})[_0x49d5('0x49')](function(_0x46f6f6){var _0x51e70a=_0x49d5('0x64')+_0x46f6f6[_0x49d5('0x24')][_0x49d5('0x65')];return db['sequelize'][_0x49d5('0x39')](_0x51e70a,{'type':db[_0x49d5('0x66')][_0x49d5('0x67')][_0x49d5('0x68')],'raw':!![]})[_0x49d5('0x49')](function(_0x3cc307){return _0x3cc307;});})[_0x49d5('0x49')](function(_0x5353b2){if(_0x5353b2){_0x2e3c67['message'][_0x49d5('0x69')]=_0x5353b2[0x0];if(!_0x32c409[_0x49d5('0x53')][_0x49d5('0x5b')])return;return db['User'][_0x49d5('0x51')]({'where':{'id':_0x32c409[_0x49d5('0x53')][_0x49d5('0x5b')],'role':'agent'},'attributes':['id',_0x49d5('0x34'),_0x49d5('0x6a'),_0x49d5('0x6b'),_0x49d5('0x6c')],'raw':!![]});}return null;})[_0x49d5('0x49')](function(_0x2b32a1){if(!_0x2b32a1)return null;_0x2e3c67['message'][_0x49d5('0x6d')]=_0x2b32a1;return _0x2e3c67;})[_0x49d5('0x49')](function(_0x1d9aa2){if(_0x1d9aa2){if(_0x32c409[_0x49d5('0x53')][_0x49d5('0x6e')]){_0x2e3c67[_0x49d5('0x24')][_0x49d5('0x6f')]=util[_0x49d5('0x60')](_0x49d5('0x70'),_0x32c409[_0x49d5('0x62')][_0x49d5('0x34')]);_0x2e3c67[_0x49d5('0x24')][_0x49d5('0x71')]=_0x2e3c67[_0x49d5('0x71')];_0x2e3c67[_0x49d5('0x24')][_0x49d5('0x72')]=_0x2e3c67[_0x49d5('0x71')];_0x2e3c67[_0x49d5('0x24')][_0x49d5('0x73')]=_0x49d5('0x56');return respondWithRpcPromise(_0x49d5('0x74'),_0x49d5('0x74'),{'event':_0x49d5('0x75'),'message':_0x2e3c67[_0x49d5('0x24')]},client9002)['then'](function(){return _0x2e3c67;});}return _0x2e3c67;}return null;})[_0x49d5('0x49')](respondWithResult(_0x4206f4,null))[_0x49d5('0x25')](handleError(_0x4206f4,null));};var interaction_log=require(_0x49d5('0x11'))(_0x49d5('0x55'));exports[_0x49d5('0x30')]=function(_0x1b7837,_0x4c08eb,_0x4eca52){var _0x28c0ae={'agent':{},'channel':_0x49d5('0x57')};if(_0x1b7837[_0x49d5('0x53')]['id']){delete _0x1b7837[_0x49d5('0x53')]['id'];}_0x1b7837[_0x49d5('0x53')][_0x49d5('0x5b')]=_0x1b7837[_0x49d5('0x53')]['UserId']||_0x1b7837[_0x49d5('0x62')]['id'];_0x28c0ae[_0x49d5('0x6d')]['id']=_0x1b7837[_0x49d5('0x53')][_0x49d5('0x5b')];return db['WhatsappMessage'][_0x49d5('0x51')]({'where':{'id':_0x1b7837[_0x49d5('0x4f')]['id'],'UserId':null}})[_0x49d5('0x49')](handleEntityNotFound(_0x4c08eb,null))[_0x49d5('0x49')](function(_0x72ae3d){if(_0x72ae3d){_0x28c0ae[_0x49d5('0x24')]=_0x72ae3d['get']({'plain':!![]});return db[_0x49d5('0x5c')][_0x49d5('0x51')]({'where':{'id':_0x72ae3d[_0x49d5('0x5d')]}});}return null;})[_0x49d5('0x49')](handleEntityNotFound(_0x4c08eb,null))[_0x49d5('0x49')](function(_0x149a07){if(_0x149a07){_0x28c0ae[_0x49d5('0x61')]=_0x149a07[_0x49d5('0x76')]({'plain':!![]});interaction_log['info'](_0x49d5('0x77'),_0x1b7837[_0x49d5('0x62')]['id'],_0x1b7837[_0x49d5('0x62')][_0x49d5('0x34')],_0x1b7837[_0x49d5('0x62')][_0x49d5('0x63')],_0x28c0ae[_0x49d5('0x61')]['id'],_0x1b7837[_0x49d5('0x53')]?JSON['stringify'](_0x1b7837[_0x49d5('0x53')]):_0x49d5('0x78'));return respondWithRpcPromise(_0x49d5('0x79'),_0x49d5('0x7a'),_0x28c0ae);}return null;})[_0x49d5('0x49')](function(_0x1e2d9a){var _0x11b70e=_0x49d5('0x64')+_0x1e2d9a[_0x49d5('0x24')]['ContactId'];return db[_0x49d5('0x7b')][_0x49d5('0x39')](_0x11b70e,{'type':db[_0x49d5('0x66')][_0x49d5('0x67')][_0x49d5('0x68')],'raw':!![]})['then'](function(_0x378050){return _0x378050;});})[_0x49d5('0x49')](function(_0x10ea36){if(_0x10ea36){_0x28c0ae['message'][_0x49d5('0x69')]=_0x10ea36[0x0];if(!_0x1b7837[_0x49d5('0x53')][_0x49d5('0x5b')])return;return db[_0x49d5('0x7c')][_0x49d5('0x51')]({'where':{'id':_0x1b7837[_0x49d5('0x53')]['UserId'],'role':'agent'},'attributes':['id',_0x49d5('0x34'),_0x49d5('0x6a'),'email','internal'],'raw':!![]});}return null;})[_0x49d5('0x49')](function(_0x5c649f){if(!_0x5c649f)return null;_0x28c0ae['message'][_0x49d5('0x6d')]=_0x5c649f;return _0x28c0ae;})[_0x49d5('0x49')](function(_0x11c6bd){if(_0x11c6bd){_0x11c6bd[_0x49d5('0x24')][_0x49d5('0x6f')]=util['format'](_0x49d5('0x70'),_0x1b7837[_0x49d5('0x62')][_0x49d5('0x34')]);_0x11c6bd[_0x49d5('0x24')][_0x49d5('0x71')]=_0x28c0ae[_0x49d5('0x71')];_0x11c6bd[_0x49d5('0x24')][_0x49d5('0x72')]=_0x28c0ae[_0x49d5('0x71')];_0x11c6bd['message'][_0x49d5('0x73')]=_0x49d5('0x30');respondWithRpcPromise('EventManager',_0x49d5('0x74'),{'event':_0x49d5('0x7d'),'message':_0x11c6bd[_0x49d5('0x24')]},client9002);return _0x28c0ae;}return null;})[_0x49d5('0x49')](respondWithResult(_0x4c08eb,null))[_0x49d5('0x25')](handleError(_0x4c08eb,null));};exports[_0x49d5('0x28')]=function(_0x26c97a,_0x33ee53,_0x424296){if(_0x26c97a[_0x49d5('0x53')]['id']){delete _0x26c97a[_0x49d5('0x53')]['id'];}var _0x39e873;return db[_0x49d5('0x48')][_0x49d5('0x51')]({'where':{'id':_0x26c97a[_0x49d5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x33ee53,null))[_0x49d5('0x49')](function(_0x5b7921){if(_0x5b7921){_0x39e873=_0x5b7921;return db['WhatsappAccount'][_0x49d5('0x51')]({'where':{'id':_0x5b7921[_0x49d5('0x7e')]}});}})[_0x49d5('0x49')](handleEntityNotFound(_0x33ee53,null))[_0x49d5('0x49')](function(_0x2980b5){if(_0x2980b5){logger[_0x49d5('0x7f')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x49d5('0x80'),_0x2980b5[_0x49d5('0x37')],util['inspect'](_0x26c97a[_0x49d5('0x53')],{'showHidden':![],'depth':null}));switch(_0x2980b5['type']){case _0x49d5('0x81'):if(_0x26c97a[_0x49d5('0x53')][_0x49d5('0x82')]&&_0x26c97a['body']['MessageSid']===_0x39e873['messageId']&&_0x26c97a[_0x49d5('0x53')][_0x49d5('0x83')]&&_0x26c97a[_0x49d5('0x53')][_0x49d5('0x83')]===_0x49d5('0x58')){return _0x39e873[_0x49d5('0x32')]({'read':!![]});}else{logger[_0x49d5('0x22')](_0x49d5('0x84'),_0x49d5('0x28'),'twilio',util[_0x49d5('0x85')](_0x26c97a[_0x49d5('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x39e873;}})[_0x49d5('0x49')](respondWithResult(_0x33ee53,null))[_0x49d5('0x25')](handleError(_0x33ee53,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8f82c65..32fba2d 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','WhatsappMessage','setMaxListeners'];(function(_0xacc81,_0x1e414e){var _0x3073ef=function(_0x40f5c8){while(--_0x40f5c8){_0xacc81['push'](_0xacc81['shift']());}};_0x3073ef(++_0x1e414e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xcb91[_0x34df4a];return _0x145c69;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x1cb9('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){WhatsappMessageEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);WhatsappMessageEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];WhatsappMessage[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x594d=['setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x2692a3,_0x229560){var _0x16deab=function(_0x5212fe){while(--_0x5212fe){_0x2692a3['push'](_0x2692a3['shift']());}};_0x16deab(++_0x229560);}(_0x594d,0x92));var _0xd594=function(_0x368cab,_0x385253){_0x368cab=_0x368cab-0x0;var _0x5a8953=_0x594d[_0x368cab];return _0x5a8953;};'use strict';var EventEmitter=require(_0xd594('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd594('0x1')](0x0);var events={'afterCreate':_0xd594('0x2'),'afterUpdate':_0xd594('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10f523){return function(_0x40d8fa,_0x10155d,_0x7f4ec6){WhatsappMessageEvents['emit'](_0x10f523+':'+_0x40d8fa['id'],_0x40d8fa);WhatsappMessageEvents[_0xd594('0x4')](_0x10f523,_0x40d8fa);_0x7f4ec6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xd594('0x5')](e,emitEvent(event));}}module[_0xd594('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 6139978..e98b5d4 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 _0xb67d=['authToken','phone','accountSid','messages','whatsapp:','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','statuses','message_id','catch','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','WhatsappInteraction','findOne','update','createdAt','error','direction','WhatsappAccount','find','WhatsappAccountId','then','type','twilio'];(function(_0x4091e2,_0x5b6d5c){var _0x265912=function(_0x5ae9c2){while(--_0x5ae9c2){_0x4091e2['push'](_0x4091e2['shift']());}};_0x265912(++_0x5b6d5c);}(_0xb67d,0x1ef));var _0xdb67=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb67d[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xdb67('0x0'));var util=require(_0xdb67('0x1'));var logger=require(_0xdb67('0x2'))(_0xdb67('0x3'));var moment=require(_0xdb67('0x4'));var BPromise=require(_0xdb67('0x5'));var rp=require('request-promise');var fetch=require(_0xdb67('0x6'));var fs=require('fs');var path=require(_0xdb67('0x7'));var rimraf=require(_0xdb67('0x8'));var config=require(_0xdb67('0x9'));var attributes=require(_0xdb67('0xa'));module[_0xdb67('0xb')]=function(_0x5761f7,_0x4170a6){return _0x5761f7[_0xdb67('0xc')](_0xdb67('0xd'),attributes,{'tableName':_0xdb67('0xe'),'paranoid':![],'indexes':[{'name':_0xdb67('0xf'),'fields':[_0xdb67('0xf')]},{'name':_0xdb67('0x10'),'fields':[_0xdb67('0x11')],'type':_0xdb67('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x202976,_0x28daf7,_0x3bf339){var _0x1b7460=_0x5761f7[_0xdb67('0x13')];var _0x43b8b7=_0x202976[_0xdb67('0x14')]({'plain':!![]});if(_0x43b8b7['direction'][_0xdb67('0x15')]()==='in'||_0x43b8b7['direction'][_0xdb67('0x15')]()===_0xdb67('0x16')&&!_0x43b8b7[_0xdb67('0x17')]&&!_['isNil'](_0x43b8b7['UserId'])){_0x1b7460[_0xdb67('0x18')][_0xdb67('0x19')]({'where':{'id':_0x43b8b7['WhatsappInteractionId']}})['then'](function(_0xf8b702){if(_0xf8b702){_0xf8b702[_0xdb67('0x1a')]({'lastMsgAt':_0x43b8b7[_0xdb67('0x1b')],'lastMsgDirection':_0x43b8b7['direction'][_0xdb67('0x15')]()});}})['catch'](function(_0x298315){console[_0xdb67('0x1c')](_0x298315);});}if(_0x43b8b7[_0xdb67('0x1d')]===_0xdb67('0x16')&&!_0x43b8b7[_0xdb67('0x17')]){var _0x290e91;_0x1b7460[_0xdb67('0x1e')][_0xdb67('0x1f')]({'where':{'id':_0x43b8b7[_0xdb67('0x20')]},'raw':!![]})[_0xdb67('0x21')](function(_0x333a13){_0x290e91=_0x333a13;if(_0x290e91&&_0x290e91[_0xdb67('0x22')]){switch(_0x290e91[_0xdb67('0x22')]){case _0xdb67('0x23'):var _0x4b3036=require(_0xdb67('0x23'));if(_0x290e91['accountSid']&&_0x290e91[_0xdb67('0x24')]&&_0x290e91[_0xdb67('0x25')]){var _0x36800f=new _0x4b3036(_0x290e91[_0xdb67('0x26')],_0x290e91[_0xdb67('0x24')]);_0x36800f[_0xdb67('0x27')]['create']({'body':_0x43b8b7['body'],'to':_0xdb67('0x28')+_0x43b8b7['phone'],'from':_0xdb67('0x28')+_0x290e91[_0xdb67('0x25')],'statusCallback':_0x290e91['remote']+'/api/whatsapp/messages/'+_0x43b8b7['id']+_0xdb67('0x29')+_0x290e91[_0xdb67('0x2a')]})[_0xdb67('0x21')](function(_0x138a48){if(_0x138a48[_0xdb67('0x2b')]){return _0x202976['update']({'messageId':_0x138a48[_0xdb67('0x2b')]});}})['catch'](function(_0x2c10e0){logger[_0xdb67('0x1c')](_0xdb67('0x2c'),'afterCreate',_0xdb67('0x23'),util['inspect'](_0x2c10e0,{'showHidden':![],'depth':null}));});}else{logger[_0xdb67('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xdb67('0x2d'),_0xdb67('0x23'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xdb67('0x2e'):var _0x24070d=_0x290e91[_0xdb67('0x26')];var _0x421adb=_0x290e91['authToken'];var _0x223932=_0x290e91[_0xdb67('0x2f')]+_0xdb67('0x30')+_0x24070d+'/messages/';var _0x54ca9e={'to':[_0x43b8b7['phone']],'message':{'type':_0xdb67('0x31'),'text':_0x43b8b7[_0xdb67('0x11')]}};var _0x8fff37={'method':_0xdb67('0x32'),'uri':_0x223932,'headers':{'Authorization':_0xdb67('0x33')+_0x421adb,'Content-Type':'application/json'},'body':_0x54ca9e,'json':!![]};rp(_0x8fff37)[_0xdb67('0x21')](function(_0x53900d){if(_0x53900d[_0xdb67('0x34')][0x0]['message_id']){return _0x202976[_0xdb67('0x1a')]({'messageId':_0x53900d[_0xdb67('0x34')][0x0][_0xdb67('0x35')]});}})[_0xdb67('0x36')](function(_0x2b4fae){logger[_0xdb67('0x37')](_0xdb67('0x38'),_0x2b4fae);});break;}}})['finally'](function(){_0x3bf339();});}else{_0x3bf339();}}},'charset':_0xdb67('0x39'),'collate':_0xdb67('0x3a')});}; \ No newline at end of file +var _0x338e=['inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','models','get','toLowerCase','out','secret','isNil','WhatsappInteraction','then','update','direction','catch','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','afterCreate'];(function(_0x53c266,_0x246496){var _0x4b37f4=function(_0x2f6a55){while(--_0x2f6a55){_0x53c266['push'](_0x53c266['shift']());}};_0x4b37f4(++_0x246496);}(_0x338e,0x137));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe338('0x0'));var util=require(_0xe338('0x1'));var logger=require(_0xe338('0x2'))(_0xe338('0x3'));var moment=require('moment');var BPromise=require(_0xe338('0x4'));var rp=require(_0xe338('0x5'));var fetch=require(_0xe338('0x6'));var fs=require('fs');var path=require(_0xe338('0x7'));var rimraf=require(_0xe338('0x8'));var config=require(_0xe338('0x9'));var attributes=require(_0xe338('0xa'));module[_0xe338('0xb')]=function(_0x43f90c,_0xd33ca7){return _0x43f90c[_0xe338('0xc')](_0xe338('0xd'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xe338('0xe'),'fields':[_0xe338('0xe')]},{'name':_0xe338('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f8fd9,_0x542cec,_0x12c7ea){var _0xa9121a=_0x43f90c[_0xe338('0x10')];var _0x544698=_0x1f8fd9[_0xe338('0x11')]({'plain':!![]});if(_0x544698['direction'][_0xe338('0x12')]()==='in'||_0x544698['direction'][_0xe338('0x12')]()===_0xe338('0x13')&&!_0x544698[_0xe338('0x14')]&&!_[_0xe338('0x15')](_0x544698['UserId'])){_0xa9121a[_0xe338('0x16')]['findOne']({'where':{'id':_0x544698['WhatsappInteractionId']}})[_0xe338('0x17')](function(_0x57dc4c){if(_0x57dc4c){_0x57dc4c[_0xe338('0x18')]({'lastMsgAt':_0x544698['createdAt'],'lastMsgDirection':_0x544698[_0xe338('0x19')]['toLowerCase']()});}})[_0xe338('0x1a')](function(_0x4dd637){console[_0xe338('0x1b')](_0x4dd637);});}if(_0x544698['direction']==='out'&&!_0x544698['secret']){var _0x56ced1;_0xa9121a['WhatsappAccount'][_0xe338('0x1c')]({'where':{'id':_0x544698[_0xe338('0x1d')]},'raw':!![]})[_0xe338('0x17')](function(_0x530580){_0x56ced1=_0x530580;if(_0x56ced1&&_0x56ced1[_0xe338('0x1e')]){switch(_0x56ced1[_0xe338('0x1e')]){case _0xe338('0x1f'):var _0x3cbd74=require(_0xe338('0x1f'));if(_0x56ced1[_0xe338('0x20')]&&_0x56ced1[_0xe338('0x21')]&&_0x56ced1[_0xe338('0x22')]){var _0x56d443=new _0x3cbd74(_0x56ced1[_0xe338('0x20')],_0x56ced1[_0xe338('0x21')]);_0x56d443[_0xe338('0x23')][_0xe338('0x24')]({'body':_0x544698['body'],'to':_0xe338('0x25')+_0x544698[_0xe338('0x22')],'from':'whatsapp:'+_0x56ced1[_0xe338('0x22')],'statusCallback':_0x56ced1[_0xe338('0x26')]+'/api/whatsapp/messages/'+_0x544698['id']+_0xe338('0x27')+_0x56ced1[_0xe338('0x28')]})[_0xe338('0x17')](function(_0x5ed542){if(_0x5ed542['sid']){return _0x1f8fd9['update']({'messageId':_0x5ed542[_0xe338('0x29')]});}})[_0xe338('0x1a')](function(_0x37a25b){logger[_0xe338('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xe338('0x2a'),_0xe338('0x1f'),util[_0xe338('0x2b')](_0x37a25b,{'showHidden':![],'depth':null}));});}else{logger[_0xe338('0x1b')](_0xe338('0x2c'),_0xe338('0x2a'),_0xe338('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe338('0x2d'):var _0x2a6cff=_0x56ced1[_0xe338('0x20')];var _0x56a0d9=_0x56ced1[_0xe338('0x21')];var _0x57f833=_0x56ced1[_0xe338('0x2e')]+_0xe338('0x2f')+_0x2a6cff+_0xe338('0x30');var _0x1b6058={'to':[_0x544698['phone']],'message':{'type':_0xe338('0x31'),'text':_0x544698['body']}};var _0x1a437b={'method':'POST','uri':_0x57f833,'headers':{'Authorization':_0xe338('0x32')+_0x56a0d9,'Content-Type':_0xe338('0x33')},'body':_0x1b6058,'json':!![]};rp(_0x1a437b)[_0xe338('0x17')](function(_0x133594){if(_0x133594[_0xe338('0x34')][0x0][_0xe338('0x35')]){return _0x1f8fd9[_0xe338('0x18')]({'messageId':_0x133594[_0xe338('0x34')][0x0][_0xe338('0x35')]});}})[_0xe338('0x1a')](function(_0x17eaf2){logger[_0xe338('0x36')](_0xe338('0x37'),_0x17eaf2);});break;}}})[_0xe338('0x38')](function(){_0x12c7ea();});}else{_0x12c7ea();}}},'charset':_0xe338('0x39'),'collate':_0xe338('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b626e49..367d216 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 _0x3af3=['info','request\x20sent','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','create','body','options','raw','then','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request'];(function(_0x44bd5,_0x33873a){var _0x50239b=function(_0x20d5a3){while(--_0x20d5a3){_0x44bd5['push'](_0x44bd5['shift']());}};_0x50239b(++_0x33873a);}(_0x3af3,0x117));var _0x33af=function(_0x291e0e,_0x792683){_0x291e0e=_0x291e0e-0x0;var _0x3f85f3=_0x3af3[_0x291e0e];return _0x3f85f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x33af('0x0'));var BPromise=require(_0x33af('0x1'));var rs=require(_0x33af('0x2'));var fs=require('fs');var Redis=require(_0x33af('0x3'));var db=require(_0x33af('0x4'))['db'];var utils=require(_0x33af('0x5'));var logger=require('../../config/logger')(_0x33af('0x6'));var config=require(_0x33af('0x7'));var jayson=require(_0x33af('0x8'));var client=jayson[_0x33af('0x9')][_0x33af('0xa')]({'port':0x232a});config['redis']=_[_0x33af('0xb')](config[_0x33af('0xc')],{'host':_0x33af('0xd'),'port':0x18eb});var socket=require(_0x33af('0xe'))(new Redis(config['redis']));require(_0x33af('0xf'))[_0x33af('0x10')](socket);function respondWithRpcPromise(_0x4daf0b,_0x196bed,_0x3e23f1){return new BPromise(function(_0x4a3ffe,_0x2dd2f5){return client[_0x33af('0x11')](_0x4daf0b,_0x3e23f1)['then'](function(_0x1a5ff0){logger[_0x33af('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x196bed,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x196bed,_0x33af('0x13'),JSON['stringify'](_0x1a5ff0));if(_0x1a5ff0['error']){if(_0x1a5ff0[_0x33af('0x14')]['code']===0x1f4){logger[_0x33af('0x14')](_0x33af('0x15'),_0x196bed,_0x1a5ff0[_0x33af('0x14')][_0x33af('0x16')]);return _0x2dd2f5(_0x1a5ff0[_0x33af('0x14')][_0x33af('0x16')]);}logger[_0x33af('0x14')](_0x33af('0x15'),_0x196bed,_0x1a5ff0['error'][_0x33af('0x16')]);return _0x4a3ffe(_0x1a5ff0[_0x33af('0x14')][_0x33af('0x16')]);}else{logger[_0x33af('0x12')](_0x33af('0x15'),_0x196bed,_0x33af('0x13'));_0x4a3ffe(_0x1a5ff0[_0x33af('0x17')][_0x33af('0x16')]);}})[_0x33af('0x18')](function(_0x5c3c0c){logger[_0x33af('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x196bed,_0x5c3c0c);_0x2dd2f5(_0x5c3c0c);});});}exports[_0x33af('0x19')]=function(_0x370179){var _0x192f11=this;return new Promise(function(_0x477f8a,_0x37127d){return db['WhatsappMessage'][_0x33af('0x1a')](_0x370179[_0x33af('0x1b')],{'raw':_0x370179[_0x33af('0x1c')]?_0x370179[_0x33af('0x1c')][_0x33af('0x1d')]===undefined?!![]:![]:!![]})[_0x33af('0x1e')](function(_0x28eaee){logger[_0x33af('0x12')](_0x33af('0x19'),_0x370179);logger[_0x33af('0x1f')](_0x33af('0x19'),_0x370179,JSON[_0x33af('0x20')](_0x28eaee));_0x477f8a(_0x28eaee);})[_0x33af('0x18')](function(_0x2cb460){logger['error'](_0x33af('0x19'),_0x2cb460['message'],_0x370179);_0x37127d(_0x192f11[_0x33af('0x14')](0x1f4,_0x2cb460['message']));});});}; \ No newline at end of file +var _0xf36e=['info','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0xa8ff2f,_0x43e207){var _0x1c27af=function(_0x1d1551){while(--_0x1d1551){_0xa8ff2f['push'](_0xa8ff2f['shift']());}};_0x1c27af(++_0x43e207);}(_0xf36e,0xbe));var _0xef36=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf36e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xef36('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xef36('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef36('0x2'));var db=require(_0xef36('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xef36('0x4'))(_0xef36('0x5'));var config=require(_0xef36('0x6'));var jayson=require(_0xef36('0x7'));var client=jayson['client'][_0xef36('0x8')]({'port':0x232a});config[_0xef36('0x9')]=_[_0xef36('0xa')](config[_0xef36('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xef36('0xb'))[_0xef36('0xc')](socket);function respondWithRpcPromise(_0x17c16f,_0xde6587,_0x3f864f){return new BPromise(function(_0x41e8b6,_0x17d804){return client[_0xef36('0xd')](_0x17c16f,_0x3f864f)['then'](function(_0x18c277){logger['info'](_0xef36('0xe'),_0xde6587,_0xef36('0xf'));logger[_0xef36('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xde6587,_0xef36('0xf'),JSON['stringify'](_0x18c277));if(_0x18c277['error']){if(_0x18c277[_0xef36('0x11')][_0xef36('0x12')]===0x1f4){logger['error'](_0xef36('0xe'),_0xde6587,_0x18c277['error'][_0xef36('0x13')]);return _0x17d804(_0x18c277[_0xef36('0x11')][_0xef36('0x13')]);}logger['error'](_0xef36('0xe'),_0xde6587,_0x18c277[_0xef36('0x11')][_0xef36('0x13')]);return _0x41e8b6(_0x18c277[_0xef36('0x11')][_0xef36('0x13')]);}else{logger[_0xef36('0x14')](_0xef36('0xe'),_0xde6587,_0xef36('0xf'));_0x41e8b6(_0x18c277[_0xef36('0x15')][_0xef36('0x13')]);}})['catch'](function(_0x396515){logger[_0xef36('0x11')](_0xef36('0xe'),_0xde6587,_0x396515);_0x17d804(_0x396515);});});}exports[_0xef36('0x16')]=function(_0x5c85f1){var _0x3bbdf9=this;return new Promise(function(_0xeb9b3,_0x2d6299){return db[_0xef36('0x17')][_0xef36('0x18')](_0x5c85f1[_0xef36('0x19')],{'raw':_0x5c85f1[_0xef36('0x1a')]?_0x5c85f1[_0xef36('0x1a')][_0xef36('0x1b')]===undefined?!![]:![]:!![]})[_0xef36('0x1c')](function(_0x40dad3){logger[_0xef36('0x14')](_0xef36('0x16'),_0x5c85f1);logger['debug']('CreateWhatsappMessage',_0x5c85f1,JSON[_0xef36('0x1d')](_0x40dad3));_0xeb9b3(_0x40dad3);})['catch'](function(_0x109aed){logger[_0xef36('0x11')]('CreateWhatsappMessage',_0x109aed['message'],_0x5c85f1);_0x2d6299(_0x3bbdf9[_0xef36('0x11')](0x1f4,_0x109aed[_0xef36('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f14fa1b..780a230 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 _0x038d=['update','removeListener','register','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x49cc72,_0x3cbe4c){var _0x4a0fa7=function(_0x1ce14d){while(--_0x1ce14d){_0x49cc72['push'](_0x49cc72['shift']());}};_0x4a0fa7(++_0x3cbe4c);}(_0x038d,0xdc));var _0xd038=function(_0x115345,_0x566300){_0x115345=_0x115345-0x0;var _0x5a11f0=_0x038d[_0x115345];return _0x5a11f0;};'use strict';var WhatsappMessageEvents=require(_0xd038('0x0'));var events=[_0xd038('0x1'),'remove',_0xd038('0x2')];function createListener(_0x2f7219,_0xb3276a){return function(_0x24b920){_0xb3276a['emit'](_0x2f7219,_0x24b920);};}function removeListener(_0x3ddddc,_0x39ebc7){return function(){WhatsappMessageEvents[_0xd038('0x3')](_0x3ddddc,_0x39ebc7);};}exports[_0xd038('0x4')]=function(_0x22899c){for(var _0x2fcd52=0x0,_0x12fbb1=events['length'];_0x2fcd52<_0x12fbb1;_0x2fcd52++){var _0x3bf24c=events[_0x2fcd52];var _0x3a28c9=createListener(_0xd038('0x5')+_0x3bf24c,_0x22899c);WhatsappMessageEvents['on'](_0x3bf24c,_0x3a28c9);}}; \ No newline at end of file +var _0x0350=['whatsappMessage:','./whatsappMessage.events','update','removeListener'];(function(_0x290062,_0x97edf3){var _0x1f520e=function(_0x1d09b8){while(--_0x1d09b8){_0x290062['push'](_0x290062['shift']());}};_0x1f520e(++_0x97edf3);}(_0x0350,0x12d));var _0x0035=function(_0x6ad863,_0x9576d5){_0x6ad863=_0x6ad863-0x0;var _0x75335e=_0x0350[_0x6ad863];return _0x75335e;};'use strict';var WhatsappMessageEvents=require(_0x0035('0x0'));var events=['save','remove',_0x0035('0x1')];function createListener(_0x504df4,_0x5b1430){return function(_0x571c45){_0x5b1430['emit'](_0x504df4,_0x571c45);};}function removeListener(_0x118505,_0x24c33c){return function(){WhatsappMessageEvents[_0x0035('0x2')](_0x118505,_0x24c33c);};}exports['register']=function(_0x45dc0c){for(var _0x2a303a=0x0,_0x4b047e=events['length'];_0x2a303a<_0x4b047e;_0x2a303a++){var _0xf74735=events[_0x2a303a];var _0x634ced=createListener(_0x0035('0x3')+_0xf74735,_0x45dc0c);WhatsappMessageEvents['on'](_0xf74735,_0x634ced);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 16eccfb..7c9b499 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 _0x8acc=['create','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/members','/:id/users','getAgents'];(function(_0x12d4df,_0x59cc7d){var _0x120775=function(_0x352938){while(--_0x352938){_0x12d4df['push'](_0x12d4df['shift']());}};_0x120775(++_0x59cc7d);}(_0x8acc,0xdb));var _0xc8ac=function(_0x465e59,_0xdf54c2){_0x465e59=_0x465e59-0x0;var _0x8501d8=_0x8acc[_0x465e59];return _0x8501d8;};'use strict';var multer=require('multer');var util=require(_0xc8ac('0x0'));var path=require(_0xc8ac('0x1'));var timeout=require(_0xc8ac('0x2'));var express=require('express');var router=express[_0xc8ac('0x3')]();var fs_extra=require(_0xc8ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc8ac('0x5'));var config=require(_0xc8ac('0x6'));var controller=require('./whatsappQueue.controller');router[_0xc8ac('0x7')]('/',auth[_0xc8ac('0x8')](),controller[_0xc8ac('0x9')]);router[_0xc8ac('0x7')](_0xc8ac('0xa'),auth[_0xc8ac('0x8')](),controller['describe']);router[_0xc8ac('0x7')](_0xc8ac('0xb'),auth[_0xc8ac('0x8')](),controller['show']);router['get'](_0xc8ac('0xc'),auth[_0xc8ac('0x8')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xc8ac('0x8')](),controller['getTeams']);router['get'](_0xc8ac('0xd'),auth['isAuthenticated'](),controller[_0xc8ac('0xe')]);router['post']('/',auth[_0xc8ac('0x8')](),controller[_0xc8ac('0xf')]);router[_0xc8ac('0x10')](_0xc8ac('0x11'),auth[_0xc8ac('0x8')](),controller[_0xc8ac('0x12')]);router[_0xc8ac('0x10')](_0xc8ac('0xd'),auth[_0xc8ac('0x8')](),controller[_0xc8ac('0x13')]);router[_0xc8ac('0x14')](_0xc8ac('0xb'),auth[_0xc8ac('0x8')](),controller[_0xc8ac('0x15')]);router[_0xc8ac('0x16')](_0xc8ac('0xb'),auth[_0xc8ac('0x8')](),controller[_0xc8ac('0x17')]);router[_0xc8ac('0x16')](_0xc8ac('0x11'),auth[_0xc8ac('0x8')](),controller[_0xc8ac('0x18')]);router[_0xc8ac('0x16')](_0xc8ac('0xd'),auth[_0xc8ac('0x8')](),controller[_0xc8ac('0x19')]);module['exports']=router; \ No newline at end of file +var _0xe4b2=['../../config/environment','./whatsappQueue.controller','get','index','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','/:id','update','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1b7e44,_0x3e2afa){var _0x803b11=function(_0x4a8aa8){while(--_0x4a8aa8){_0x1b7e44['push'](_0x1b7e44['shift']());}};_0x803b11(++_0x3e2afa);}(_0xe4b2,0x1d6));var _0x2e4b=function(_0x3d1c83,_0x574d44){_0x3d1c83=_0x3d1c83-0x0;var _0x2fb45c=_0xe4b2[_0x3d1c83];return _0x2fb45c;};'use strict';var multer=require('multer');var util=require(_0x2e4b('0x0'));var path=require('path');var timeout=require(_0x2e4b('0x1'));var express=require(_0x2e4b('0x2'));var router=express[_0x2e4b('0x3')]();var fs_extra=require(_0x2e4b('0x4'));var auth=require(_0x2e4b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2e4b('0x6'));var controller=require(_0x2e4b('0x7'));router[_0x2e4b('0x8')]('/',auth['isAuthenticated'](),controller[_0x2e4b('0x9')]);router[_0x2e4b('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x2e4b('0xa')](),controller[_0x2e4b('0xb')]);router[_0x2e4b('0x8')](_0x2e4b('0xc'),auth[_0x2e4b('0xa')](),controller[_0x2e4b('0xd')]);router[_0x2e4b('0x8')](_0x2e4b('0xe'),auth[_0x2e4b('0xa')](),controller[_0x2e4b('0xf')]);router['get']('/:id/users',auth[_0x2e4b('0xa')](),controller[_0x2e4b('0x10')]);router['post']('/',auth[_0x2e4b('0xa')](),controller[_0x2e4b('0x11')]);router[_0x2e4b('0x12')](_0x2e4b('0xe'),auth[_0x2e4b('0xa')](),controller[_0x2e4b('0x13')]);router['post'](_0x2e4b('0x14'),auth[_0x2e4b('0xa')](),controller[_0x2e4b('0x15')]);router['put'](_0x2e4b('0x16'),auth[_0x2e4b('0xa')](),controller[_0x2e4b('0x17')]);router[_0x2e4b('0x18')]('/:id',auth[_0x2e4b('0xa')](),controller[_0x2e4b('0x19')]);router[_0x2e4b('0x18')](_0x2e4b('0xe'),auth['isAuthenticated'](),controller[_0x2e4b('0x1a')]);router[_0x2e4b('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x2e4b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c903db0..997dd94 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 _0xac55=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3245bc,_0x2f2daf){var _0x33d7df=function(_0x27337a){while(--_0x27337a){_0x3245bc['push'](_0x3245bc['shift']());}};_0x33d7df(++_0x2f2daf);}(_0xac55,0x1c8));var _0x5ac5=function(_0x5d3745,_0x2969e1){_0x5d3745=_0x5d3745-0x0;var _0x1400b8=_0xac55[_0x5d3745];return _0x1400b8;};'use strict';var Sequelize=require(_0x5ac5('0x0'));module[_0x5ac5('0x1')]={'name':{'type':Sequelize[_0x5ac5('0x2')],'unique':_0x5ac5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5ac5('0x4')](_0x5ac5('0x5'),_0x5ac5('0x6'),_0x5ac5('0x7'))},'description':{'type':Sequelize[_0x5ac5('0x2')]}}; \ No newline at end of file +var _0xedd9=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x47d493,_0x3bedfb){var _0x50242a=function(_0x473bd6){while(--_0x473bd6){_0x47d493['push'](_0x47d493['shift']());}};_0x50242a(++_0x3bedfb);}(_0xedd9,0xfc));var _0x9edd=function(_0x527d09,_0x378a3a){_0x527d09=_0x527d09-0x0;var _0x53a69f=_0xedd9[_0x527d09];return _0x53a69f;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')],'unique':_0x9edd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9edd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9edd('0x4')](_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index b33dae5..542dd26 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 _0x6505=['each','findOrCreate','forEach','emit','removeTeams','ids','select','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','all','union','compact','value','sequelize','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','then','destroy','WhatsappQueues','UserProfileResource','stack','name','index','map','WhatsappQueue','type','key','model','query','filters','attributes','fields','length','nolimit','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','keys','hasOwnProperty','pick','filter','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','addTeams','Agents','online','interface','flatMap'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6505,0x1bd));var _0x5650=function(_0x1a8bdf,_0x32826a){_0x1a8bdf=_0x1a8bdf-0x0;var _0x29dcbf=_0x6505[_0x1a8bdf];return _0x29dcbf;};'use strict';var emlformat=require(_0x5650('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5650('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5650('0x2'));var Mustache=require('mustache');var util=require(_0x5650('0x3'));var path=require(_0x5650('0x4'));var sox=require(_0x5650('0x5'));var csv=require(_0x5650('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5650('0x7'));var _=require('lodash');var squel=require(_0x5650('0x8'));var crypto=require(_0x5650('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5650('0x6'));var querystring=require('querystring');var Papa=require(_0x5650('0xa'));var Redis=require(_0x5650('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x5650('0xc'));var as=require(_0x5650('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5650('0xe'));var config=require(_0x5650('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x5650('0x10'))['db'];config[_0x5650('0x11')]=_[_0x5650('0x12')](config[_0x5650('0x11')],{'host':_0x5650('0x13'),'port':0x18eb});var socket=require(_0x5650('0x14'))(new Redis(config[_0x5650('0x11')]));require(_0x5650('0x15'))[_0x5650('0x16')](socket);function respondWithStatusCode(_0x4bb188,_0x26d09f){_0x26d09f=_0x26d09f||0xcc;return function(_0x22d353){if(_0x22d353){return _0x4bb188[_0x5650('0x17')](_0x26d09f);}return _0x4bb188[_0x5650('0x18')](_0x26d09f)[_0x5650('0x19')]();};}function respondWithResult(_0x54d8a8,_0x5e0b70){_0x5e0b70=_0x5e0b70||0xc8;return function(_0x127b8f){if(_0x127b8f){return _0x54d8a8['status'](_0x5e0b70)[_0x5650('0x1a')](_0x127b8f);}};}function respondWithFilteredResult(_0x2b44cf,_0x4aa81a){return function(_0x297f36){if(_0x297f36){var _0x5e2fd5=typeof _0x4aa81a['offset']==='undefined'&&typeof _0x4aa81a['limit']===_0x5650('0x1b');var _0xf06458=_0x297f36['count'];var _0x25ddbc=_0x5e2fd5?0x0:_0x4aa81a[_0x5650('0x1c')];var _0x28c7d9=_0x5e2fd5?_0x297f36[_0x5650('0x1d')]:_0x4aa81a[_0x5650('0x1c')]+_0x4aa81a[_0x5650('0x1e')];var _0x166738;if(_0x28c7d9>=_0xf06458){_0x28c7d9=_0xf06458;_0x166738=0xc8;}else{_0x166738=0xce;}_0x2b44cf['status'](_0x166738);return _0x2b44cf['set'](_0x5650('0x1f'),_0x25ddbc+'-'+_0x28c7d9+'/'+_0xf06458)[_0x5650('0x1a')](_0x297f36);}return null;};}function patchUpdates(_0x53003b){return function(_0x589a99){try{jsonpatch[_0x5650('0x20')](_0x589a99,_0x53003b,!![]);}catch(_0x52f2f4){return BPromise[_0x5650('0x21')](_0x52f2f4);}return _0x589a99[_0x5650('0x22')]();};}function saveUpdates(_0x31811c,_0x346bb7){return function(_0x496e7f){if(_0x496e7f){return _0x496e7f['update'](_0x31811c)[_0x5650('0x23')](function(_0x3f8595){return _0x3f8595;});}return null;};}function removeEntity(_0x596f2d,_0x5df736){return function(_0x5f317d){if(_0x5f317d){return _0x5f317d[_0x5650('0x24')]()[_0x5650('0x23')](function(){var _0x171a9a=_0x5f317d['get']({'plain':!![]});var _0x39f918=_0x5650('0x25');return db[_0x5650('0x26')][_0x5650('0x24')]({'where':{'type':_0x39f918,'resourceId':_0x171a9a['id']}})['then'](function(){return _0x5f317d;});})['then'](function(){_0x596f2d[_0x5650('0x18')](0xcc)[_0x5650('0x19')]();});}};}function handleEntityNotFound(_0x20c17a,_0xcfaf1a){return function(_0x518804){if(!_0x518804){_0x20c17a[_0x5650('0x17')](0x194);}return _0x518804;};}function handleError(_0x52da60,_0x100f8f){_0x100f8f=_0x100f8f||0x1f4;return function(_0x4aa203){logger['error'](_0x4aa203[_0x5650('0x27')]);if(_0x4aa203[_0x5650('0x28')]){delete _0x4aa203['name'];}_0x52da60['status'](_0x100f8f)['send'](_0x4aa203);};}exports[_0x5650('0x29')]=function(_0x5c0dfa,_0x3a8d49){var _0x44c38e={},_0x102431={},_0x3b5a60={'count':0x0,'rows':[]};var _0x55c7b0=_[_0x5650('0x2a')](db[_0x5650('0x2b')]['rawAttributes'],function(_0x2adcf4){return{'name':_0x2adcf4['fieldName'],'type':_0x2adcf4[_0x5650('0x2c')][_0x5650('0x2d')]};});_0x102431[_0x5650('0x2e')]=_[_0x5650('0x2a')](_0x55c7b0,_0x5650('0x28'));_0x102431['query']=_['keys'](_0x5c0dfa[_0x5650('0x2f')]);_0x102431[_0x5650('0x30')]=_['intersection'](_0x102431[_0x5650('0x2e')],_0x102431['query']);_0x44c38e[_0x5650('0x31')]=_['intersection'](_0x102431[_0x5650('0x2e')],qs['fields'](_0x5c0dfa[_0x5650('0x2f')][_0x5650('0x32')]));_0x44c38e[_0x5650('0x31')]=_0x44c38e[_0x5650('0x31')][_0x5650('0x33')]?_0x44c38e[_0x5650('0x31')]:_0x102431[_0x5650('0x2e')];if(!_0x5c0dfa[_0x5650('0x2f')]['hasOwnProperty'](_0x5650('0x34'))){_0x44c38e[_0x5650('0x1e')]=qs[_0x5650('0x1e')](_0x5c0dfa[_0x5650('0x2f')][_0x5650('0x1e')]);_0x44c38e[_0x5650('0x1c')]=qs['offset'](_0x5c0dfa[_0x5650('0x2f')][_0x5650('0x1c')]);}_0x44c38e['order']=qs[_0x5650('0x35')](_0x5c0dfa[_0x5650('0x2f')]['sort']);_0x44c38e[_0x5650('0x36')]=qs[_0x5650('0x30')](_['pick'](_0x5c0dfa['query'],_0x102431[_0x5650('0x30')]),_0x55c7b0);if(_0x5c0dfa[_0x5650('0x2f')]['filter']){_0x44c38e['where']=_[_0x5650('0x37')](_0x44c38e['where'],{'$or':_[_0x5650('0x2a')](_0x55c7b0,function(_0x249990){if(_0x249990[_0x5650('0x2c')]!=='VIRTUAL'){var _0x44ae66={};_0x44ae66[_0x249990[_0x5650('0x28')]]={'$like':'%'+_0x5c0dfa['query']['filter']+'%'};return _0x44ae66;}})});}_0x44c38e=_[_0x5650('0x37')]({},_0x44c38e,_0x5c0dfa[_0x5650('0x38')]);var _0x37fdbe={'where':_0x44c38e[_0x5650('0x36')]};return db['WhatsappQueue'][_0x5650('0x1d')](_0x37fdbe)[_0x5650('0x23')](function(_0x22cdef){_0x3b5a60['count']=_0x22cdef;if(_0x5c0dfa[_0x5650('0x2f')][_0x5650('0x39')]){_0x44c38e[_0x5650('0x3a')]=[{'all':!![]}];}return db[_0x5650('0x2b')][_0x5650('0x3b')](_0x44c38e);})['then'](function(_0x2b7a39){_0x3b5a60[_0x5650('0x3c')]=_0x2b7a39;return _0x3b5a60;})[_0x5650('0x23')](respondWithFilteredResult(_0x3a8d49,_0x44c38e))[_0x5650('0x3d')](handleError(_0x3a8d49,null));};exports[_0x5650('0x3e')]=function(_0x1845a8,_0xf77a63){var _0xbef708={'raw':!![],'where':{'id':_0x1845a8[_0x5650('0x3f')]['id']}},_0x4b43a6={};_0x4b43a6[_0x5650('0x2e')]=_['keys'](db[_0x5650('0x2b')][_0x5650('0x40')]);_0x4b43a6[_0x5650('0x2f')]=_['keys'](_0x1845a8[_0x5650('0x2f')]);_0x4b43a6['filters']=_['intersection'](_0x4b43a6[_0x5650('0x2e')],_0x4b43a6[_0x5650('0x2f')]);_0xbef708['attributes']=_[_0x5650('0x41')](_0x4b43a6[_0x5650('0x2e')],qs['fields'](_0x1845a8[_0x5650('0x2f')][_0x5650('0x32')]));_0xbef708[_0x5650('0x31')]=_0xbef708['attributes'][_0x5650('0x33')]?_0xbef708[_0x5650('0x31')]:_0x4b43a6['model'];if(_0x1845a8[_0x5650('0x2f')]['includeAll']){_0xbef708[_0x5650('0x3a')]=[{'all':!![]}];}_0xbef708=_[_0x5650('0x37')]({},_0xbef708,_0x1845a8[_0x5650('0x38')]);return db[_0x5650('0x2b')][_0x5650('0x42')](_0xbef708)[_0x5650('0x23')](handleEntityNotFound(_0xf77a63,null))[_0x5650('0x23')](respondWithResult(_0xf77a63,null))[_0x5650('0x3d')](handleError(_0xf77a63,null));};exports[_0x5650('0x43')]=function(_0x36537f,_0x3cb4dd){return db['WhatsappQueue']['create'](_0x36537f[_0x5650('0x44')],{})['then'](function(_0x407e8a){var _0x28b227=_0x36537f[_0x5650('0x45')][_0x5650('0x46')]({'plain':!![]});if(!_0x28b227)throw new Error(_0x5650('0x47'));if(_0x28b227['role']===_0x5650('0x45')){var _0x23d26e=_0x407e8a[_0x5650('0x46')]({'plain':!![]});var _0x247b65=_0x5650('0x25');return db[_0x5650('0x48')][_0x5650('0x42')]({'where':{'name':_0x247b65,'userProfileId':_0x28b227[_0x5650('0x49')]},'raw':!![]})['then'](function(_0x50d5d3){if(_0x50d5d3&&_0x50d5d3[_0x5650('0x4a')]===0x0){return db[_0x5650('0x26')][_0x5650('0x43')]({'name':_0x23d26e[_0x5650('0x28')],'resourceId':_0x23d26e['id'],'type':_0x50d5d3[_0x5650('0x28')],'sectionId':_0x50d5d3['id']},{})[_0x5650('0x23')](function(){return _0x407e8a;});}else{return _0x407e8a;}})[_0x5650('0x3d')](function(_0x53434c){logger[_0x5650('0x4b')](_0x5650('0x4c'),_0x53434c);throw _0x53434c;});}return _0x407e8a;})[_0x5650('0x23')](respondWithResult(_0x3cb4dd,0xc9))[_0x5650('0x3d')](handleError(_0x3cb4dd,null));};exports[_0x5650('0x4d')]=function(_0x5ee066,_0x1b0d58){if(_0x5ee066[_0x5650('0x44')]['id']){delete _0x5ee066[_0x5650('0x44')]['id'];}return db[_0x5650('0x2b')]['find']({'where':{'id':_0x5ee066[_0x5650('0x3f')]['id']}})[_0x5650('0x23')](handleEntityNotFound(_0x1b0d58,null))[_0x5650('0x23')](saveUpdates(_0x5ee066[_0x5650('0x44')],null))[_0x5650('0x23')](respondWithResult(_0x1b0d58,null))[_0x5650('0x3d')](handleError(_0x1b0d58,null));};exports[_0x5650('0x24')]=function(_0x40f944,_0x2fd424){return db[_0x5650('0x2b')][_0x5650('0x42')]({'where':{'id':_0x40f944[_0x5650('0x3f')]['id']}})[_0x5650('0x23')](handleEntityNotFound(_0x2fd424,null))[_0x5650('0x23')](removeEntity(_0x2fd424,null))[_0x5650('0x3d')](handleError(_0x2fd424,null));};exports[_0x5650('0x4e')]=function(_0x3bde4f,_0x2a062a){return db[_0x5650('0x2b')][_0x5650('0x4e')]()[_0x5650('0x23')](respondWithResult(_0x2a062a,null))[_0x5650('0x3d')](handleError(_0x2a062a,null));};exports[_0x5650('0x4f')]=function(_0xe66c1f,_0x15352b,_0x13875d){var _0x3a0211={'raw':!![],'where':{}},_0x8eb80a={},_0x407bac;return db['WhatsappQueue'][_0x5650('0x50')]({'where':{'id':_0xe66c1f['params']['id']}})[_0x5650('0x23')](handleEntityNotFound(_0x15352b,null))[_0x5650('0x23')](function(_0x3bb569){if(_0x3bb569){_0x407bac=_0x3bb569[_0x5650('0x46')]({'plain':!![]});_0x8eb80a['model']=_['keys'](db[_0x5650('0x51')][_0x5650('0x40')]);_0x8eb80a['query']=_[_0x5650('0x52')](_0xe66c1f[_0x5650('0x2f')]);_0x8eb80a[_0x5650('0x30')]=_[_0x5650('0x41')](_0x8eb80a[_0x5650('0x2e')],_0x8eb80a['query']);_0x3a0211[_0x5650('0x31')]=_[_0x5650('0x41')](_0x8eb80a[_0x5650('0x2e')],qs[_0x5650('0x32')](_0xe66c1f[_0x5650('0x2f')][_0x5650('0x32')]));_0x3a0211[_0x5650('0x31')]=_0x3a0211[_0x5650('0x31')][_0x5650('0x33')]?_0x3a0211['attributes']:_0x8eb80a[_0x5650('0x2e')];if(!_0xe66c1f[_0x5650('0x2f')][_0x5650('0x53')](_0x5650('0x34'))){_0x3a0211['limit']=qs[_0x5650('0x1e')](_0xe66c1f[_0x5650('0x2f')][_0x5650('0x1e')]);_0x3a0211[_0x5650('0x1c')]=qs[_0x5650('0x1c')](_0xe66c1f[_0x5650('0x2f')]['offset']);}_0x3a0211['order']=qs[_0x5650('0x35')](_0xe66c1f[_0x5650('0x2f')][_0x5650('0x35')]);_0x3a0211[_0x5650('0x36')]=qs[_0x5650('0x30')](_[_0x5650('0x54')](_0xe66c1f[_0x5650('0x2f')],_0x8eb80a[_0x5650('0x30')]));_0x3a0211[_0x5650('0x36')]['WhatsappQueueId']=_0x3bb569['id'];if(_0xe66c1f[_0x5650('0x2f')][_0x5650('0x55')]){_0x3a0211[_0x5650('0x36')]=_[_0x5650('0x37')](_0x3a0211[_0x5650('0x36')],{'$or':_['map'](_0x3a0211['attributes'],function(_0x16187e){var _0x359506={};_0x359506[_0x16187e]={'$like':'%'+_0xe66c1f[_0x5650('0x2f')][_0x5650('0x55')]+'%'};return _0x359506;})});}_0x3a0211=_[_0x5650('0x37')]({},_0x3a0211,_0xe66c1f[_0x5650('0x38')]);return db[_0x5650('0x51')][_0x5650('0x3b')](_0x3a0211);}})[_0x5650('0x23')](function(_0xae9166){if(_0xae9166){return db[_0x5650('0x56')][_0x5650('0x57')]({'where':{'id':_['map'](_0xae9166,'UserId'),'role':_0x5650('0x58')},'attributes':['id',_0x5650('0x28'),_0x5650('0x59'),_0x5650('0x5a'),_0x5650('0x5b')]});}})[_0x5650('0x23')](function(_0x47fdc5){if(_0x47fdc5){return{'count':_0x47fdc5[_0x5650('0x1d')],'rows':_[_0x5650('0x2a')](_0x47fdc5[_0x5650('0x3c')],function(_0x3b6408){return{'membername':_0x3b6408[_0x5650('0x28')],'UserId':_0x3b6408['id'],'queue_name':_0x407bac[_0x5650('0x28')],'WhatsappQueueId':_0x407bac['id'],'interface':util[_0x5650('0x5c')](_0x5650('0x5d'),_0x5650('0x5e'),_0x3b6408[_0x5650('0x28')]),'penalty':0x0,'paused':_0x3b6408['whatsappPause'],'createdAt':_0x3b6408['createdAt'],'updatedAt':_0x3b6408[_0x5650('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x15352b,_0x3a0211))[_0x5650('0x3d')](handleError(_0x15352b,null));};exports[_0x5650('0x5f')]=function(_0x188f5f,_0x277b4b,_0x3f0739){var _0x2fff95={};var _0x2c57c9={};var _0x118ad6;var _0x5aa7ae;return db[_0x5650('0x2b')]['findOne']({'where':{'id':_0x188f5f['params']['id']}})[_0x5650('0x23')](handleEntityNotFound(_0x277b4b,null))[_0x5650('0x23')](function(_0xb6b15){if(_0xb6b15){_0x118ad6=_0xb6b15;_0x2c57c9[_0x5650('0x2e')]=_[_0x5650('0x52')](db[_0x5650('0x60')][_0x5650('0x40')]);_0x2c57c9[_0x5650('0x2f')]=_['keys'](_0x188f5f[_0x5650('0x2f')]);_0x2c57c9[_0x5650('0x30')]=_[_0x5650('0x41')](_0x2c57c9[_0x5650('0x2e')],_0x2c57c9[_0x5650('0x2f')]);_0x2fff95[_0x5650('0x31')]=_[_0x5650('0x41')](_0x2c57c9[_0x5650('0x2e')],qs[_0x5650('0x32')](_0x188f5f[_0x5650('0x2f')]['fields']));_0x2fff95[_0x5650('0x31')]=_0x2fff95[_0x5650('0x31')][_0x5650('0x33')]?_0x2fff95[_0x5650('0x31')]:_0x2c57c9[_0x5650('0x2e')];_0x2fff95[_0x5650('0x61')]=qs[_0x5650('0x35')](_0x188f5f['query'][_0x5650('0x35')]);_0x2fff95[_0x5650('0x36')]=qs[_0x5650('0x30')](_[_0x5650('0x54')](_0x188f5f[_0x5650('0x2f')],_0x2c57c9['filters']));if(_0x188f5f['query'][_0x5650('0x55')]){_0x2fff95[_0x5650('0x36')]=_[_0x5650('0x37')](_0x2fff95[_0x5650('0x36')],{'$or':_[_0x5650('0x2a')](_0x2fff95[_0x5650('0x31')],function(_0x173cb0){var _0x2ee2ed={};_0x2ee2ed[_0x173cb0]={'$like':'%'+_0x188f5f[_0x5650('0x2f')][_0x5650('0x55')]+'%'};return _0x2ee2ed;})});}_0x2fff95=_['merge']({},_0x2fff95,_0x188f5f['options']);return _0x118ad6['getTeams'](_0x2fff95);}})[_0x5650('0x23')](function(_0x476131){if(_0x476131){_0x5aa7ae=_0x476131[_0x5650('0x33')];if(!_0x188f5f[_0x5650('0x2f')][_0x5650('0x53')](_0x5650('0x34'))){_0x2fff95[_0x5650('0x1e')]=qs[_0x5650('0x1e')](_0x188f5f[_0x5650('0x2f')][_0x5650('0x1e')]);_0x2fff95[_0x5650('0x1c')]=qs['offset'](_0x188f5f['query']['offset']);}return _0x118ad6[_0x5650('0x5f')](_0x2fff95);}})[_0x5650('0x23')](function(_0x563a78){if(_0x563a78){return _0x563a78?{'count':_0x5aa7ae,'rows':_0x563a78}:null;}})[_0x5650('0x23')](respondWithResult(_0x277b4b,null))[_0x5650('0x3d')](handleError(_0x277b4b,null));};exports[_0x5650('0x62')]=function(_0x1c312a,_0x55f476,_0x5407d8){var _0x2c11c6=_0x1c312a[_0x5650('0x44')]['ids'];return db[_0x5650('0x60')][_0x5650('0x3b')]({'where':{'id':_0x2c11c6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5650('0x63'),'attributes':['id',_0x5650('0x28'),_0x5650('0x64'),'voicePause',_0x5650('0x65')],'raw':!![]}]})[_0x5650('0x23')](function(_0x25d175){if(_0x25d175){var _0x57e5c7=_[_0x5650('0x66')](_0x25d175,function(_0x350194){var _0x3a703a=_0x350194['get']({'plain':!![]});return _0x3a703a[_0x5650('0x63')];});return db[_0x5650('0x2b')][_0x5650('0x42')]({'where':{'id':_0x1c312a['params']['id']}})[_0x5650('0x23')](function(_0x357d0e){return db['sequelize']['transaction'](function(_0x21b06a){return _0x357d0e[_0x5650('0x62')](_0x2c11c6,{'transaction':_0x21b06a})[_0x5650('0x23')](function(){return BPromise[_0x5650('0x67')](_0x57e5c7,function(_0x57e2b7){return db[_0x5650('0x51')][_0x5650('0x68')]({'where':{'UserId':_0x57e2b7['id'],'WhatsappQueueId':_0x1c312a['params']['id']},'transaction':_0x21b06a});});})[_0x5650('0x23')](function(){_0x57e5c7[_0x5650('0x69')](function(_0x148df0){socket[_0x5650('0x6a')]('userWhatsappQueue:save',{'UserId':_0x148df0['id'],'WhatsappQueueId':_0x357d0e['id']});});});});});}})[_0x5650('0x23')](respondWithStatusCode(_0x55f476,null))['catch'](handleError(_0x55f476,null));};exports[_0x5650('0x6b')]=function(_0x42d5cc,_0x11da26,_0x545e41){return db['Team'][_0x5650('0x3b')]({'where':{'id':_0x42d5cc['query'][_0x5650('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x5650('0x56')],'as':_0x5650('0x63'),'attributes':['id'],'raw':!![]}]})[_0x5650('0x23')](handleEntityNotFound(_0x11da26,null))[_0x5650('0x23')](function(_0x35632){var _0x5104eb=_[_0x5650('0x2a')](_0x35632,'id');var _0x1f89fc=[];var _0x507db5=[];var _0x123346=squel[_0x5650('0x6d')]();_0x123346['field'](_0x5650('0x6e'))[_0x5650('0x6f')](_0x5650('0x70'),'tq')[_0x5650('0x71')](_0x5650('0x72'),'ut',_0x5650('0x73'))[_0x5650('0x36')](_0x5650('0x74'),_0x42d5cc['params']['id']);for(var _0x412492=0x0;_0x412492<_0x35632[_0x5650('0x33')];_0x412492+=0x1){let _0x32f833=_0x35632[_0x412492];for(var _0x120fe9=0x0;_0x120fe9<_0x32f833[_0x5650('0x63')][_0x5650('0x33')];_0x120fe9+=0x1){let _0x5b7971=_0x32f833[_0x5650('0x63')][_0x120fe9];var _0x2081f6=_0x123346[_0x5650('0x75')]();_0x2081f6['where'](_0x5650('0x76'),_0x5b7971['id']);_0x507db5[_0x5650('0x77')](db['sequelize']['query'](_0x2081f6[_0x5650('0x78')](),{'type':db['sequelize'][_0x5650('0x79')][_0x5650('0x7a')]})[_0x5650('0x23')](function(_0x560dec){if(_0x560dec[_0x5650('0x33')]===0x1){return _0x5b7971['id'];}else{var _0x171352=_[_0x5650('0x7b')](_[_0x5650('0x2a')](_0x560dec,'TeamId'),function(_0x4960d9){return _['includes'](_0x5104eb,_0x4960d9);});if(_0x171352){return _0x5b7971['id'];}}}));}}return BPromise[_0x5650('0x7c')](_0x507db5)[_0x5650('0x23')](function(_0x19f5af){_0x1f89fc=_(_0x1f89fc)[_0x5650('0x7d')](_0x19f5af)[_0x5650('0x7e')]()[_0x5650('0x7f')]();return db[_0x5650('0x2b')][_0x5650('0x42')]({'where':{'id':_0x42d5cc[_0x5650('0x3f')]['id']}})[_0x5650('0x23')](function(_0x46481){return db[_0x5650('0x80')][_0x5650('0x81')](function(_0x2d548b){return _0x46481[_0x5650('0x6b')](_0x42d5cc[_0x5650('0x2f')][_0x5650('0x6c')],{'transaction':_0x2d548b})[_0x5650('0x23')](function(){if(!_['isEmpty'](_0x1f89fc)){return _0x46481[_0x5650('0x82')](_0x1f89fc,{'transaction':_0x2d548b});}})['then'](function(){_0x1f89fc['forEach'](function(_0x3a74fd){socket[_0x5650('0x6a')](_0x5650('0x83'),{'UserId':_0x3a74fd,'WhatsappQueueId':_0x46481['id']});});});});});});})['then'](respondWithStatusCode(_0x11da26,null))[_0x5650('0x3d')](handleError(_0x11da26,null));};exports['addAgents']=function(_0xb3dbab,_0x52c2c0,_0x4e1b98){return db[_0x5650('0x2b')][_0x5650('0x42')]({'where':{'id':_0xb3dbab[_0x5650('0x3f')]['id']}})['then'](handleEntityNotFound(_0x52c2c0,null))[_0x5650('0x23')](function(_0x4b5a61){if(_0x4b5a61){return _0x4b5a61[_0x5650('0x84')](_0xb3dbab[_0x5650('0x44')][_0x5650('0x6c')],_[_0x5650('0x85')](_0xb3dbab['body'],[_0x5650('0x6c'),'id'])||{})[_0x5650('0x86')](function(_0x1729fd){for(var _0x58adee=0x0;_0x58adee<_0xb3dbab[_0x5650('0x44')]['ids'][_0x5650('0x33')];_0x58adee+=0x1){socket[_0x5650('0x6a')]('userWhatsappQueue:save',{'UserId':Number(_0xb3dbab[_0x5650('0x44')]['ids'][_0x58adee]),'WhatsappQueueId':Number(_0xb3dbab[_0x5650('0x3f')]['id'])});}return _0x1729fd;});}})['then'](respondWithResult(_0x52c2c0,null))[_0x5650('0x3d')](handleError(_0x52c2c0,null));};exports[_0x5650('0x82')]=function(_0x409336,_0x41e3b0,_0xe8889e){return db[_0x5650('0x2b')][_0x5650('0x42')]({'where':{'id':_0x409336[_0x5650('0x3f')]['id']}})[_0x5650('0x23')](handleEntityNotFound(_0x41e3b0,null))['then'](function(_0x25db8b){if(_0x25db8b){return _0x25db8b[_0x5650('0x82')](_0x409336[_0x5650('0x2f')]['ids'])[_0x5650('0x23')](function(){if(_[_0x5650('0x87')](_0x409336[_0x5650('0x2f')][_0x5650('0x6c')])){for(var _0x48bf7a=0x0;_0x48bf7a<_0x409336[_0x5650('0x2f')][_0x5650('0x6c')][_0x5650('0x33')];_0x48bf7a+=0x1){socket['emit'](_0x5650('0x83'),{'UserId':Number(_0x409336[_0x5650('0x2f')][_0x5650('0x6c')][_0x48bf7a]),'WhatsappQueueId':Number(_0x409336[_0x5650('0x3f')]['id'])});}}else{socket[_0x5650('0x6a')]('userWhatsappQueue:remove',{'UserId':Number(_0x409336['query']['ids']),'WhatsappQueueId':Number(_0x409336[_0x5650('0x3f')]['id'])});}});}})[_0x5650('0x23')](respondWithStatusCode(_0x41e3b0,null))[_0x5650('0x3d')](handleError(_0x41e3b0,null));};exports[_0x5650('0x88')]=function(_0x42f753,_0x17e788,_0x4c94fa){var _0x235266={};var _0x5dea36={};var _0x592dad;var _0x500c7f;return db[_0x5650('0x2b')][_0x5650('0x50')]({'where':{'id':_0x42f753[_0x5650('0x3f')]['id']}})['then'](handleEntityNotFound(_0x17e788,null))[_0x5650('0x23')](function(_0x26a498){if(_0x26a498){_0x592dad=_0x26a498;_0x5dea36[_0x5650('0x2e')]=_[_0x5650('0x52')](db[_0x5650('0x56')][_0x5650('0x40')]);_0x5dea36[_0x5650('0x2f')]=_[_0x5650('0x52')](_0x42f753['query']);_0x5dea36[_0x5650('0x30')]=_[_0x5650('0x41')](_0x5dea36[_0x5650('0x2e')],_0x5dea36[_0x5650('0x2f')]);_0x235266[_0x5650('0x31')]=_['intersection'](_0x5dea36['model'],qs[_0x5650('0x32')](_0x42f753['query']['fields']));_0x235266[_0x5650('0x31')]=_0x235266[_0x5650('0x31')]['length']?_0x235266[_0x5650('0x31')]:_0x5dea36[_0x5650('0x2e')];_0x235266[_0x5650('0x61')]=qs[_0x5650('0x35')](_0x42f753['query'][_0x5650('0x35')]);_0x235266[_0x5650('0x36')]=qs[_0x5650('0x30')](_[_0x5650('0x54')](_0x42f753[_0x5650('0x2f')],_0x5dea36['filters']));if(_0x42f753[_0x5650('0x2f')]['filter']){_0x235266[_0x5650('0x36')]=_[_0x5650('0x37')](_0x235266[_0x5650('0x36')],{'$or':_[_0x5650('0x2a')](_0x235266[_0x5650('0x31')],function(_0x5da2dd){var _0x571ff9={};_0x571ff9[_0x5da2dd]={'$like':'%'+_0x42f753[_0x5650('0x2f')][_0x5650('0x55')]+'%'};return _0x571ff9;})});}_0x235266=_[_0x5650('0x37')]({},_0x235266,_0x42f753['options']);return _0x592dad[_0x5650('0x88')](_0x235266);}})['then'](function(_0x4e54cd){if(_0x4e54cd){_0x500c7f=_0x4e54cd[_0x5650('0x33')];if(!_0x42f753[_0x5650('0x2f')][_0x5650('0x53')]('nolimit')){_0x235266[_0x5650('0x1e')]=qs[_0x5650('0x1e')](_0x42f753['query'][_0x5650('0x1e')]);_0x235266['offset']=qs[_0x5650('0x1c')](_0x42f753[_0x5650('0x2f')][_0x5650('0x1c')]);}return _0x592dad[_0x5650('0x88')](_0x235266);}})[_0x5650('0x23')](function(_0x1f1919){if(_0x1f1919){return _0x1f1919?{'count':_0x500c7f,'rows':_0x1f1919}:null;}})[_0x5650('0x23')](respondWithResult(_0x17e788,null))[_0x5650('0x3d')](handleError(_0x17e788,null));}; \ No newline at end of file +var _0xab22=['request-promise','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','filters','pick','filter','merge','VIRTUAL','where','WhatsappQueue','includeAll','include','rows','show','params','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','nolimit','sort','WhatsappQueueId','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','emit','addAgents','spread','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch'];(function(_0x4f92df,_0x5432a8){var _0x33603c=function(_0x408741){while(--_0x408741){_0x4f92df['push'](_0x4f92df['shift']());}};_0x33603c(++_0x5432a8);}(_0xab22,0x19e));var _0x2ab2=function(_0x413faa,_0x152fd0){_0x413faa=_0x413faa-0x0;var _0x3df812=_0xab22[_0x413faa];return _0x3df812;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ab2('0x0'));var zipdir=require(_0x2ab2('0x1'));var jsonpatch=require(_0x2ab2('0x2'));var rp=require(_0x2ab2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2ab2('0x4'));var ejs=require(_0x2ab2('0x5'));var fs=require('fs');var fs_extra=require(_0x2ab2('0x6'));var _=require(_0x2ab2('0x7'));var squel=require(_0x2ab2('0x8'));var crypto=require(_0x2ab2('0x9'));var jsforce=require(_0x2ab2('0xa'));var deskjs=require(_0x2ab2('0xb'));var toCsv=require(_0x2ab2('0x4'));var querystring=require(_0x2ab2('0xc'));var Papa=require('papaparse');var Redis=require(_0x2ab2('0xd'));var authService=require(_0x2ab2('0xe'));var qs=require(_0x2ab2('0xf'));var as=require(_0x2ab2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2ab2('0x11'));var utils=require('../../config/utils');var config=require(_0x2ab2('0x12'));var licenseUtil=require(_0x2ab2('0x13'));var db=require(_0x2ab2('0x14'))['db'];config[_0x2ab2('0x15')]=_[_0x2ab2('0x16')](config[_0x2ab2('0x15')],{'host':_0x2ab2('0x17'),'port':0x18eb});var socket=require(_0x2ab2('0x18'))(new Redis(config[_0x2ab2('0x15')]));require(_0x2ab2('0x19'))[_0x2ab2('0x1a')](socket);function respondWithStatusCode(_0x5ce7a9,_0x38ef40){_0x38ef40=_0x38ef40||0xcc;return function(_0x1c0b18){if(_0x1c0b18){return _0x5ce7a9[_0x2ab2('0x1b')](_0x38ef40);}return _0x5ce7a9[_0x2ab2('0x1c')](_0x38ef40)['end']();};}function respondWithResult(_0x38729a,_0x2f2a5c){_0x2f2a5c=_0x2f2a5c||0xc8;return function(_0x426f0f){if(_0x426f0f){return _0x38729a['status'](_0x2f2a5c)['json'](_0x426f0f);}};}function respondWithFilteredResult(_0x5cecda,_0x48fff5){return function(_0x49bd6){if(_0x49bd6){var _0x8ebdc5=typeof _0x48fff5[_0x2ab2('0x1d')]===_0x2ab2('0x1e')&&typeof _0x48fff5[_0x2ab2('0x1f')]===_0x2ab2('0x1e');var _0x5edfd9=_0x49bd6[_0x2ab2('0x20')];var _0x2e8fc1=_0x8ebdc5?0x0:_0x48fff5['offset'];var _0x2bb086=_0x8ebdc5?_0x49bd6[_0x2ab2('0x20')]:_0x48fff5[_0x2ab2('0x1d')]+_0x48fff5[_0x2ab2('0x1f')];var _0x39ab2b;if(_0x2bb086>=_0x5edfd9){_0x2bb086=_0x5edfd9;_0x39ab2b=0xc8;}else{_0x39ab2b=0xce;}_0x5cecda[_0x2ab2('0x1c')](_0x39ab2b);return _0x5cecda[_0x2ab2('0x21')]('Content-Range',_0x2e8fc1+'-'+_0x2bb086+'/'+_0x5edfd9)[_0x2ab2('0x22')](_0x49bd6);}return null;};}function patchUpdates(_0x26dede){return function(_0x3178ff){try{jsonpatch[_0x2ab2('0x23')](_0x3178ff,_0x26dede,!![]);}catch(_0x16a3ec){return BPromise[_0x2ab2('0x24')](_0x16a3ec);}return _0x3178ff[_0x2ab2('0x25')]();};}function saveUpdates(_0x47f151,_0x98eb44){return function(_0x464e4a){if(_0x464e4a){return _0x464e4a['update'](_0x47f151)[_0x2ab2('0x26')](function(_0x41ef19){return _0x41ef19;});}return null;};}function removeEntity(_0x21b293,_0x4d054d){return function(_0x25e680){if(_0x25e680){return _0x25e680[_0x2ab2('0x27')]()[_0x2ab2('0x26')](function(){var _0x3cdc09=_0x25e680[_0x2ab2('0x28')]({'plain':!![]});var _0x48cba7='WhatsappQueues';return db[_0x2ab2('0x29')][_0x2ab2('0x27')]({'where':{'type':_0x48cba7,'resourceId':_0x3cdc09['id']}})['then'](function(){return _0x25e680;});})['then'](function(){_0x21b293[_0x2ab2('0x1c')](0xcc)[_0x2ab2('0x2a')]();});}};}function handleEntityNotFound(_0x437e7f,_0x53d226){return function(_0x4fd61c){if(!_0x4fd61c){_0x437e7f[_0x2ab2('0x1b')](0x194);}return _0x4fd61c;};}function handleError(_0x5a0460,_0x1b3b31){_0x1b3b31=_0x1b3b31||0x1f4;return function(_0x262941){logger[_0x2ab2('0x2b')](_0x262941[_0x2ab2('0x2c')]);if(_0x262941[_0x2ab2('0x2d')]){delete _0x262941[_0x2ab2('0x2d')];}_0x5a0460[_0x2ab2('0x1c')](_0x1b3b31)['send'](_0x262941);};}exports[_0x2ab2('0x2e')]=function(_0x32a475,_0x6a414e){var _0x393b3b={},_0x5000c4={},_0x4b6e97={'count':0x0,'rows':[]};var _0x515e8f=_['map'](db['WhatsappQueue'][_0x2ab2('0x2f')],function(_0x255b8c){return{'name':_0x255b8c[_0x2ab2('0x30')],'type':_0x255b8c[_0x2ab2('0x31')]['key']};});_0x5000c4[_0x2ab2('0x32')]=_[_0x2ab2('0x33')](_0x515e8f,_0x2ab2('0x2d'));_0x5000c4['query']=_['keys'](_0x32a475[_0x2ab2('0x34')]);_0x5000c4['filters']=_[_0x2ab2('0x35')](_0x5000c4[_0x2ab2('0x32')],_0x5000c4[_0x2ab2('0x34')]);_0x393b3b[_0x2ab2('0x36')]=_[_0x2ab2('0x35')](_0x5000c4[_0x2ab2('0x32')],qs[_0x2ab2('0x37')](_0x32a475[_0x2ab2('0x34')][_0x2ab2('0x37')]));_0x393b3b[_0x2ab2('0x36')]=_0x393b3b[_0x2ab2('0x36')][_0x2ab2('0x38')]?_0x393b3b[_0x2ab2('0x36')]:_0x5000c4['model'];if(!_0x32a475['query'][_0x2ab2('0x39')]('nolimit')){_0x393b3b[_0x2ab2('0x1f')]=qs[_0x2ab2('0x1f')](_0x32a475[_0x2ab2('0x34')]['limit']);_0x393b3b[_0x2ab2('0x1d')]=qs['offset'](_0x32a475['query'][_0x2ab2('0x1d')]);}_0x393b3b[_0x2ab2('0x3a')]=qs['sort'](_0x32a475['query']['sort']);_0x393b3b['where']=qs[_0x2ab2('0x3b')](_[_0x2ab2('0x3c')](_0x32a475[_0x2ab2('0x34')],_0x5000c4[_0x2ab2('0x3b')]),_0x515e8f);if(_0x32a475['query'][_0x2ab2('0x3d')]){_0x393b3b['where']=_[_0x2ab2('0x3e')](_0x393b3b['where'],{'$or':_[_0x2ab2('0x33')](_0x515e8f,function(_0x450955){if(_0x450955[_0x2ab2('0x31')]!==_0x2ab2('0x3f')){var _0x238bff={};_0x238bff[_0x450955[_0x2ab2('0x2d')]]={'$like':'%'+_0x32a475[_0x2ab2('0x34')][_0x2ab2('0x3d')]+'%'};return _0x238bff;}})});}_0x393b3b=_[_0x2ab2('0x3e')]({},_0x393b3b,_0x32a475['options']);var _0x3a1a4b={'where':_0x393b3b[_0x2ab2('0x40')]};return db[_0x2ab2('0x41')][_0x2ab2('0x20')](_0x3a1a4b)[_0x2ab2('0x26')](function(_0xd21b1b){_0x4b6e97[_0x2ab2('0x20')]=_0xd21b1b;if(_0x32a475[_0x2ab2('0x34')][_0x2ab2('0x42')]){_0x393b3b[_0x2ab2('0x43')]=[{'all':!![]}];}return db[_0x2ab2('0x41')]['findAll'](_0x393b3b);})['then'](function(_0x25706d){_0x4b6e97[_0x2ab2('0x44')]=_0x25706d;return _0x4b6e97;})[_0x2ab2('0x26')](respondWithFilteredResult(_0x6a414e,_0x393b3b))['catch'](handleError(_0x6a414e,null));};exports[_0x2ab2('0x45')]=function(_0x262d3b,_0x26f132){var _0x606220={'raw':!![],'where':{'id':_0x262d3b[_0x2ab2('0x46')]['id']}},_0x5a946e={};_0x5a946e['model']=_['keys'](db[_0x2ab2('0x41')][_0x2ab2('0x2f')]);_0x5a946e[_0x2ab2('0x34')]=_[_0x2ab2('0x47')](_0x262d3b[_0x2ab2('0x34')]);_0x5a946e['filters']=_[_0x2ab2('0x35')](_0x5a946e[_0x2ab2('0x32')],_0x5a946e[_0x2ab2('0x34')]);_0x606220[_0x2ab2('0x36')]=_[_0x2ab2('0x35')](_0x5a946e[_0x2ab2('0x32')],qs[_0x2ab2('0x37')](_0x262d3b[_0x2ab2('0x34')][_0x2ab2('0x37')]));_0x606220[_0x2ab2('0x36')]=_0x606220[_0x2ab2('0x36')][_0x2ab2('0x38')]?_0x606220['attributes']:_0x5a946e[_0x2ab2('0x32')];if(_0x262d3b['query'][_0x2ab2('0x42')]){_0x606220[_0x2ab2('0x43')]=[{'all':!![]}];}_0x606220=_[_0x2ab2('0x3e')]({},_0x606220,_0x262d3b[_0x2ab2('0x48')]);return db[_0x2ab2('0x41')][_0x2ab2('0x49')](_0x606220)[_0x2ab2('0x26')](handleEntityNotFound(_0x26f132,null))['then'](respondWithResult(_0x26f132,null))[_0x2ab2('0x4a')](handleError(_0x26f132,null));};exports['create']=function(_0x39ffc8,_0x102c9b){return db['WhatsappQueue'][_0x2ab2('0x4b')](_0x39ffc8[_0x2ab2('0x4c')],{})[_0x2ab2('0x26')](function(_0x53bdda){var _0x9cf05e=_0x39ffc8[_0x2ab2('0x4d')]['get']({'plain':!![]});if(!_0x9cf05e)throw new Error(_0x2ab2('0x4e'));if(_0x9cf05e[_0x2ab2('0x4f')]===_0x2ab2('0x4d')){var _0x23766b=_0x53bdda[_0x2ab2('0x28')]({'plain':!![]});var _0x2a0e90='WhatsappQueues';return db[_0x2ab2('0x50')]['find']({'where':{'name':_0x2a0e90,'userProfileId':_0x9cf05e['userProfileId']},'raw':!![]})[_0x2ab2('0x26')](function(_0x42006c){if(_0x42006c&&_0x42006c[_0x2ab2('0x51')]===0x0){return db[_0x2ab2('0x29')][_0x2ab2('0x4b')]({'name':_0x23766b[_0x2ab2('0x2d')],'resourceId':_0x23766b['id'],'type':_0x42006c[_0x2ab2('0x2d')],'sectionId':_0x42006c['id']},{})[_0x2ab2('0x26')](function(){return _0x53bdda;});}else{return _0x53bdda;}})[_0x2ab2('0x4a')](function(_0x436dfd){logger['error'](_0x2ab2('0x52'),_0x436dfd);throw _0x436dfd;});}return _0x53bdda;})[_0x2ab2('0x26')](respondWithResult(_0x102c9b,0xc9))[_0x2ab2('0x4a')](handleError(_0x102c9b,null));};exports['update']=function(_0x522744,_0x57cb92){if(_0x522744[_0x2ab2('0x4c')]['id']){delete _0x522744['body']['id'];}return db[_0x2ab2('0x41')]['find']({'where':{'id':_0x522744[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](handleEntityNotFound(_0x57cb92,null))['then'](saveUpdates(_0x522744[_0x2ab2('0x4c')],null))[_0x2ab2('0x26')](respondWithResult(_0x57cb92,null))[_0x2ab2('0x4a')](handleError(_0x57cb92,null));};exports[_0x2ab2('0x27')]=function(_0x3e4178,_0x16e7f4){return db['WhatsappQueue'][_0x2ab2('0x49')]({'where':{'id':_0x3e4178[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](handleEntityNotFound(_0x16e7f4,null))['then'](removeEntity(_0x16e7f4,null))[_0x2ab2('0x4a')](handleError(_0x16e7f4,null));};exports['describe']=function(_0x5d81ae,_0x1c2f8e){return db[_0x2ab2('0x41')][_0x2ab2('0x53')]()['then'](respondWithResult(_0x1c2f8e,null))[_0x2ab2('0x4a')](handleError(_0x1c2f8e,null));};exports['getMembers']=function(_0x54864f,_0x4e372d,_0x5f15a2){var _0x560d2c={'raw':!![],'where':{}},_0x33412d={},_0xd18a5f;return db[_0x2ab2('0x41')][_0x2ab2('0x54')]({'where':{'id':_0x54864f[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](handleEntityNotFound(_0x4e372d,null))[_0x2ab2('0x26')](function(_0x9acaff){if(_0x9acaff){_0xd18a5f=_0x9acaff[_0x2ab2('0x28')]({'plain':!![]});_0x33412d[_0x2ab2('0x32')]=_[_0x2ab2('0x47')](db[_0x2ab2('0x55')][_0x2ab2('0x2f')]);_0x33412d[_0x2ab2('0x34')]=_[_0x2ab2('0x47')](_0x54864f['query']);_0x33412d[_0x2ab2('0x3b')]=_[_0x2ab2('0x35')](_0x33412d[_0x2ab2('0x32')],_0x33412d[_0x2ab2('0x34')]);_0x560d2c['attributes']=_[_0x2ab2('0x35')](_0x33412d['model'],qs[_0x2ab2('0x37')](_0x54864f[_0x2ab2('0x34')][_0x2ab2('0x37')]));_0x560d2c['attributes']=_0x560d2c[_0x2ab2('0x36')][_0x2ab2('0x38')]?_0x560d2c[_0x2ab2('0x36')]:_0x33412d[_0x2ab2('0x32')];if(!_0x54864f['query'][_0x2ab2('0x39')](_0x2ab2('0x56'))){_0x560d2c[_0x2ab2('0x1f')]=qs[_0x2ab2('0x1f')](_0x54864f[_0x2ab2('0x34')][_0x2ab2('0x1f')]);_0x560d2c[_0x2ab2('0x1d')]=qs['offset'](_0x54864f[_0x2ab2('0x34')][_0x2ab2('0x1d')]);}_0x560d2c[_0x2ab2('0x3a')]=qs['sort'](_0x54864f['query'][_0x2ab2('0x57')]);_0x560d2c[_0x2ab2('0x40')]=qs['filters'](_[_0x2ab2('0x3c')](_0x54864f['query'],_0x33412d[_0x2ab2('0x3b')]));_0x560d2c[_0x2ab2('0x40')][_0x2ab2('0x58')]=_0x9acaff['id'];if(_0x54864f[_0x2ab2('0x34')][_0x2ab2('0x3d')]){_0x560d2c[_0x2ab2('0x40')]=_['merge'](_0x560d2c[_0x2ab2('0x40')],{'$or':_[_0x2ab2('0x33')](_0x560d2c['attributes'],function(_0x30583f){var _0x456fae={};_0x456fae[_0x30583f]={'$like':'%'+_0x54864f[_0x2ab2('0x34')][_0x2ab2('0x3d')]+'%'};return _0x456fae;})});}_0x560d2c=_[_0x2ab2('0x3e')]({},_0x560d2c,_0x54864f['options']);return db[_0x2ab2('0x55')][_0x2ab2('0x59')](_0x560d2c);}})[_0x2ab2('0x26')](function(_0x438368){if(_0x438368){return db[_0x2ab2('0x5a')][_0x2ab2('0x5b')]({'where':{'id':_[_0x2ab2('0x33')](_0x438368,_0x2ab2('0x5c')),'role':'agent'},'attributes':['id',_0x2ab2('0x2d'),'whatsappPause',_0x2ab2('0x5d'),_0x2ab2('0x5e')]});}})[_0x2ab2('0x26')](function(_0x2f8718){if(_0x2f8718){return{'count':_0x2f8718[_0x2ab2('0x20')],'rows':_[_0x2ab2('0x33')](_0x2f8718[_0x2ab2('0x44')],function(_0x4063a2){return{'membername':_0x4063a2[_0x2ab2('0x2d')],'UserId':_0x4063a2['id'],'queue_name':_0xd18a5f[_0x2ab2('0x2d')],'WhatsappQueueId':_0xd18a5f['id'],'interface':util[_0x2ab2('0x5f')](_0x2ab2('0x60'),_0x2ab2('0x61'),_0x4063a2[_0x2ab2('0x2d')]),'penalty':0x0,'paused':_0x4063a2['whatsappPause'],'createdAt':_0x4063a2[_0x2ab2('0x5e')],'updatedAt':_0x4063a2[_0x2ab2('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2ab2('0x26')](respondWithFilteredResult(_0x4e372d,_0x560d2c))[_0x2ab2('0x4a')](handleError(_0x4e372d,null));};exports['getTeams']=function(_0x18b674,_0x5d0a60,_0x21c2b3){var _0x3b0288={};var _0x422585={};var _0xae69c6;var _0x38b44a;return db[_0x2ab2('0x41')]['findOne']({'where':{'id':_0x18b674[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](handleEntityNotFound(_0x5d0a60,null))[_0x2ab2('0x26')](function(_0x4fa861){if(_0x4fa861){_0xae69c6=_0x4fa861;_0x422585['model']=_[_0x2ab2('0x47')](db[_0x2ab2('0x62')][_0x2ab2('0x2f')]);_0x422585['query']=_[_0x2ab2('0x47')](_0x18b674[_0x2ab2('0x34')]);_0x422585['filters']=_['intersection'](_0x422585[_0x2ab2('0x32')],_0x422585['query']);_0x3b0288[_0x2ab2('0x36')]=_[_0x2ab2('0x35')](_0x422585[_0x2ab2('0x32')],qs[_0x2ab2('0x37')](_0x18b674['query'][_0x2ab2('0x37')]));_0x3b0288['attributes']=_0x3b0288[_0x2ab2('0x36')][_0x2ab2('0x38')]?_0x3b0288[_0x2ab2('0x36')]:_0x422585[_0x2ab2('0x32')];_0x3b0288[_0x2ab2('0x3a')]=qs[_0x2ab2('0x57')](_0x18b674[_0x2ab2('0x34')][_0x2ab2('0x57')]);_0x3b0288['where']=qs[_0x2ab2('0x3b')](_[_0x2ab2('0x3c')](_0x18b674[_0x2ab2('0x34')],_0x422585[_0x2ab2('0x3b')]));if(_0x18b674[_0x2ab2('0x34')][_0x2ab2('0x3d')]){_0x3b0288[_0x2ab2('0x40')]=_['merge'](_0x3b0288['where'],{'$or':_[_0x2ab2('0x33')](_0x3b0288[_0x2ab2('0x36')],function(_0x2a2595){var _0x4b4329={};_0x4b4329[_0x2a2595]={'$like':'%'+_0x18b674['query'][_0x2ab2('0x3d')]+'%'};return _0x4b4329;})});}_0x3b0288=_[_0x2ab2('0x3e')]({},_0x3b0288,_0x18b674[_0x2ab2('0x48')]);return _0xae69c6[_0x2ab2('0x63')](_0x3b0288);}})[_0x2ab2('0x26')](function(_0x502619){if(_0x502619){_0x38b44a=_0x502619[_0x2ab2('0x38')];if(!_0x18b674['query']['hasOwnProperty'](_0x2ab2('0x56'))){_0x3b0288[_0x2ab2('0x1f')]=qs['limit'](_0x18b674[_0x2ab2('0x34')][_0x2ab2('0x1f')]);_0x3b0288[_0x2ab2('0x1d')]=qs[_0x2ab2('0x1d')](_0x18b674['query'][_0x2ab2('0x1d')]);}return _0xae69c6[_0x2ab2('0x63')](_0x3b0288);}})[_0x2ab2('0x26')](function(_0x510f5d){if(_0x510f5d){return _0x510f5d?{'count':_0x38b44a,'rows':_0x510f5d}:null;}})[_0x2ab2('0x26')](respondWithResult(_0x5d0a60,null))['catch'](handleError(_0x5d0a60,null));};exports[_0x2ab2('0x64')]=function(_0x254dce,_0x11cd27,_0x12d4a6){var _0x527906=_0x254dce[_0x2ab2('0x4c')][_0x2ab2('0x65')];return db[_0x2ab2('0x62')][_0x2ab2('0x59')]({'where':{'id':_0x527906},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2ab2('0x66'),'attributes':['id',_0x2ab2('0x2d'),_0x2ab2('0x67'),_0x2ab2('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x226063){if(_0x226063){var _0x58174e=_['flatMap'](_0x226063,function(_0x3c716e){var _0x5c5e05=_0x3c716e[_0x2ab2('0x28')]({'plain':!![]});return _0x5c5e05['Agents'];});return db['WhatsappQueue'][_0x2ab2('0x49')]({'where':{'id':_0x254dce['params']['id']}})[_0x2ab2('0x26')](function(_0x5c97d0){return db[_0x2ab2('0x69')][_0x2ab2('0x6a')](function(_0x39b684){return _0x5c97d0[_0x2ab2('0x64')](_0x527906,{'transaction':_0x39b684})['then'](function(){return BPromise[_0x2ab2('0x6b')](_0x58174e,function(_0x3cc3ec){return db[_0x2ab2('0x55')][_0x2ab2('0x6c')]({'where':{'UserId':_0x3cc3ec['id'],'WhatsappQueueId':_0x254dce[_0x2ab2('0x46')]['id']},'transaction':_0x39b684});});})[_0x2ab2('0x26')](function(){_0x58174e['forEach'](function(_0x537867){socket['emit'](_0x2ab2('0x6d'),{'UserId':_0x537867['id'],'WhatsappQueueId':_0x5c97d0['id']});});});});});}})[_0x2ab2('0x26')](respondWithStatusCode(_0x11cd27,null))['catch'](handleError(_0x11cd27,null));};exports['removeTeams']=function(_0x2cce5d,_0x674cb5,_0x4dd146){return db[_0x2ab2('0x62')]['findAll']({'where':{'id':_0x2cce5d['query'][_0x2ab2('0x65')]},'attributes':['id'],'include':[{'model':db[_0x2ab2('0x5a')],'as':_0x2ab2('0x66'),'attributes':['id'],'raw':!![]}]})[_0x2ab2('0x26')](handleEntityNotFound(_0x674cb5,null))[_0x2ab2('0x26')](function(_0x94828b){var _0x49dd3c=_[_0x2ab2('0x33')](_0x94828b,'id');var _0xd03153=[];var _0x584b10=[];var _0x4828da=squel[_0x2ab2('0x6e')]();_0x4828da[_0x2ab2('0x6f')](_0x2ab2('0x70'))[_0x2ab2('0x71')](_0x2ab2('0x72'),'tq')[_0x2ab2('0x73')](_0x2ab2('0x74'),'ut',_0x2ab2('0x75'))[_0x2ab2('0x40')](_0x2ab2('0x76'),_0x2cce5d[_0x2ab2('0x46')]['id']);for(var _0xf2d163=0x0;_0xf2d163<_0x94828b[_0x2ab2('0x38')];_0xf2d163+=0x1){let _0x51e020=_0x94828b[_0xf2d163];for(var _0x35b205=0x0;_0x35b205<_0x51e020[_0x2ab2('0x66')][_0x2ab2('0x38')];_0x35b205+=0x1){let _0x5da099=_0x51e020['Agents'][_0x35b205];var _0x59d32f=_0x4828da['clone']();_0x59d32f[_0x2ab2('0x40')](_0x2ab2('0x77'),_0x5da099['id']);_0x584b10['push'](db[_0x2ab2('0x69')]['query'](_0x59d32f[_0x2ab2('0x78')](),{'type':db[_0x2ab2('0x69')][_0x2ab2('0x79')][_0x2ab2('0x7a')]})[_0x2ab2('0x26')](function(_0x3c9f9e){if(_0x3c9f9e['length']===0x1){return _0x5da099['id'];}else{var _0x4d27e7=_[_0x2ab2('0x7b')](_[_0x2ab2('0x33')](_0x3c9f9e,_0x2ab2('0x7c')),function(_0x553adb){return _[_0x2ab2('0x7d')](_0x49dd3c,_0x553adb);});if(_0x4d27e7){return _0x5da099['id'];}}}));}}return BPromise[_0x2ab2('0x7e')](_0x584b10)[_0x2ab2('0x26')](function(_0x2f4942){_0xd03153=_(_0xd03153)[_0x2ab2('0x7f')](_0x2f4942)[_0x2ab2('0x80')]()[_0x2ab2('0x81')]();return db[_0x2ab2('0x41')][_0x2ab2('0x49')]({'where':{'id':_0x2cce5d[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](function(_0x10d7d2){return db['sequelize']['transaction'](function(_0x1d4cd5){return _0x10d7d2[_0x2ab2('0x82')](_0x2cce5d[_0x2ab2('0x34')][_0x2ab2('0x65')],{'transaction':_0x1d4cd5})['then'](function(){if(!_[_0x2ab2('0x83')](_0xd03153)){return _0x10d7d2[_0x2ab2('0x84')](_0xd03153,{'transaction':_0x1d4cd5});}})['then'](function(){_0xd03153[_0x2ab2('0x85')](function(_0x24babf){socket[_0x2ab2('0x86')]('userWhatsappQueue:remove',{'UserId':_0x24babf,'WhatsappQueueId':_0x10d7d2['id']});});});});});});})[_0x2ab2('0x26')](respondWithStatusCode(_0x674cb5,null))[_0x2ab2('0x4a')](handleError(_0x674cb5,null));};exports[_0x2ab2('0x87')]=function(_0x32075d,_0x31c708,_0x351950){return db[_0x2ab2('0x41')][_0x2ab2('0x49')]({'where':{'id':_0x32075d[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](handleEntityNotFound(_0x31c708,null))[_0x2ab2('0x26')](function(_0x53c55e){if(_0x53c55e){return _0x53c55e[_0x2ab2('0x87')](_0x32075d[_0x2ab2('0x4c')][_0x2ab2('0x65')],_['omit'](_0x32075d[_0x2ab2('0x4c')],[_0x2ab2('0x65'),'id'])||{})[_0x2ab2('0x88')](function(_0x575599){for(var _0x4f6fec=0x0;_0x4f6fec<_0x32075d[_0x2ab2('0x4c')]['ids'][_0x2ab2('0x38')];_0x4f6fec+=0x1){socket[_0x2ab2('0x86')](_0x2ab2('0x6d'),{'UserId':Number(_0x32075d[_0x2ab2('0x4c')][_0x2ab2('0x65')][_0x4f6fec]),'WhatsappQueueId':Number(_0x32075d[_0x2ab2('0x46')]['id'])});}return _0x575599;});}})[_0x2ab2('0x26')](respondWithResult(_0x31c708,null))[_0x2ab2('0x4a')](handleError(_0x31c708,null));};exports[_0x2ab2('0x84')]=function(_0x23c3ba,_0x472491,_0x124475){return db['WhatsappQueue'][_0x2ab2('0x49')]({'where':{'id':_0x23c3ba[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](handleEntityNotFound(_0x472491,null))[_0x2ab2('0x26')](function(_0x2a2072){if(_0x2a2072){return _0x2a2072[_0x2ab2('0x84')](_0x23c3ba[_0x2ab2('0x34')][_0x2ab2('0x65')])[_0x2ab2('0x26')](function(){if(_['isArray'](_0x23c3ba['query'][_0x2ab2('0x65')])){for(var _0x1e7389=0x0;_0x1e7389<_0x23c3ba['query']['ids'][_0x2ab2('0x38')];_0x1e7389+=0x1){socket[_0x2ab2('0x86')](_0x2ab2('0x89'),{'UserId':Number(_0x23c3ba[_0x2ab2('0x34')][_0x2ab2('0x65')][_0x1e7389]),'WhatsappQueueId':Number(_0x23c3ba[_0x2ab2('0x46')]['id'])});}}else{socket[_0x2ab2('0x86')]('userWhatsappQueue:remove',{'UserId':Number(_0x23c3ba[_0x2ab2('0x34')][_0x2ab2('0x65')]),'WhatsappQueueId':Number(_0x23c3ba[_0x2ab2('0x46')]['id'])});}});}})[_0x2ab2('0x26')](respondWithStatusCode(_0x472491,null))['catch'](handleError(_0x472491,null));};exports[_0x2ab2('0x8a')]=function(_0x2af84e,_0x572f3a,_0x15418d){var _0x155ed0={};var _0x440550={};var _0x8f4b91;var _0x3b1fa6;return db[_0x2ab2('0x41')][_0x2ab2('0x54')]({'where':{'id':_0x2af84e[_0x2ab2('0x46')]['id']}})[_0x2ab2('0x26')](handleEntityNotFound(_0x572f3a,null))['then'](function(_0x384685){if(_0x384685){_0x8f4b91=_0x384685;_0x440550[_0x2ab2('0x32')]=_[_0x2ab2('0x47')](db['User'][_0x2ab2('0x2f')]);_0x440550[_0x2ab2('0x34')]=_[_0x2ab2('0x47')](_0x2af84e[_0x2ab2('0x34')]);_0x440550[_0x2ab2('0x3b')]=_[_0x2ab2('0x35')](_0x440550[_0x2ab2('0x32')],_0x440550[_0x2ab2('0x34')]);_0x155ed0[_0x2ab2('0x36')]=_[_0x2ab2('0x35')](_0x440550[_0x2ab2('0x32')],qs[_0x2ab2('0x37')](_0x2af84e['query'][_0x2ab2('0x37')]));_0x155ed0[_0x2ab2('0x36')]=_0x155ed0[_0x2ab2('0x36')][_0x2ab2('0x38')]?_0x155ed0[_0x2ab2('0x36')]:_0x440550[_0x2ab2('0x32')];_0x155ed0[_0x2ab2('0x3a')]=qs[_0x2ab2('0x57')](_0x2af84e[_0x2ab2('0x34')]['sort']);_0x155ed0[_0x2ab2('0x40')]=qs[_0x2ab2('0x3b')](_[_0x2ab2('0x3c')](_0x2af84e[_0x2ab2('0x34')],_0x440550['filters']));if(_0x2af84e['query'][_0x2ab2('0x3d')]){_0x155ed0[_0x2ab2('0x40')]=_[_0x2ab2('0x3e')](_0x155ed0['where'],{'$or':_[_0x2ab2('0x33')](_0x155ed0[_0x2ab2('0x36')],function(_0x369093){var _0x5d0a8c={};_0x5d0a8c[_0x369093]={'$like':'%'+_0x2af84e[_0x2ab2('0x34')][_0x2ab2('0x3d')]+'%'};return _0x5d0a8c;})});}_0x155ed0=_[_0x2ab2('0x3e')]({},_0x155ed0,_0x2af84e[_0x2ab2('0x48')]);return _0x8f4b91[_0x2ab2('0x8a')](_0x155ed0);}})[_0x2ab2('0x26')](function(_0x47384c){if(_0x47384c){_0x3b1fa6=_0x47384c['length'];if(!_0x2af84e[_0x2ab2('0x34')][_0x2ab2('0x39')]('nolimit')){_0x155ed0[_0x2ab2('0x1f')]=qs[_0x2ab2('0x1f')](_0x2af84e[_0x2ab2('0x34')][_0x2ab2('0x1f')]);_0x155ed0['offset']=qs[_0x2ab2('0x1d')](_0x2af84e['query'][_0x2ab2('0x1d')]);}return _0x8f4b91['getAgents'](_0x155ed0);}})[_0x2ab2('0x26')](function(_0x4b9686){if(_0x4b9686){return _0x4b9686?{'count':_0x3b1fa6,'rows':_0x4b9686}:null;}})[_0x2ab2('0x26')](respondWithResult(_0x572f3a,null))[_0x2ab2('0x4a')](handleError(_0x572f3a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c73c985..9ce06d5 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 _0x323b=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','save','update','remove','emit'];(function(_0x368441,_0x1fe475){var _0x467439=function(_0x2e980d){while(--_0x2e980d){_0x368441['push'](_0x368441['shift']());}};_0x467439(++_0x1fe475);}(_0x323b,0x99));var _0xb323=function(_0x4acc26,_0x36a1a5){_0x4acc26=_0x4acc26-0x0;var _0xee1909=_0x323b[_0x4acc26];return _0xee1909;};'use strict';var EventEmitter=require(_0xb323('0x0'));var WhatsappQueue=require(_0xb323('0x1'))['db'][_0xb323('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb323('0x3'),'afterUpdate':_0xb323('0x4'),'afterDestroy':_0xb323('0x5')};function emitEvent(_0x205590){return function(_0x2a4509,_0x6120f9,_0x1efc6d){WhatsappQueueEvents[_0xb323('0x6')](_0x205590+':'+_0x2a4509['id'],_0x2a4509);WhatsappQueueEvents[_0xb323('0x6')](_0x205590,_0x2a4509);_0x1efc6d(null);};}for(var e in events){if(events[_0xb323('0x7')](e)){var event=events[e];WhatsappQueue[_0xb323('0x8')](e,emitEvent(event));}}module[_0xb323('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x1cd0=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x2c93e2,_0x4fb5e2){var _0x57264e=function(_0x386895){while(--_0x386895){_0x2c93e2['push'](_0x2c93e2['shift']());}};_0x57264e(++_0x4fb5e2);}(_0x1cd0,0xe0));var _0x01cd=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x1cd0[_0x2c7618];return _0x5ce3f0;};'use strict';var EventEmitter=require(_0x01cd('0x0'));var WhatsappQueue=require(_0x01cd('0x1'))['db'][_0x01cd('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x01cd('0x3')](0x0);var events={'afterCreate':_0x01cd('0x4'),'afterUpdate':_0x01cd('0x5'),'afterDestroy':_0x01cd('0x6')};function emitEvent(_0x79715b){return function(_0x44271d,_0x5b9d88,_0x662265){WhatsappQueueEvents[_0x01cd('0x7')](_0x79715b+':'+_0x44271d['id'],_0x44271d);WhatsappQueueEvents[_0x01cd('0x7')](_0x79715b,_0x44271d);_0x662265(null);};}for(var e in events){if(events[_0x01cd('0x8')](e)){var event=events[e];WhatsappQueue[_0x01cd('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f62873a..365739a 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 _0x9e84=['util','api','moment','rimraf','../../config/environment'];(function(_0x25ad66,_0x46e4dc){var _0x141bc4=function(_0x3a7f8e){while(--_0x3a7f8e){_0x25ad66['push'](_0x25ad66['shift']());}};_0x141bc4(++_0x46e4dc);}(_0x9e84,0x17c));var _0x49e8=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x9e84[_0x2df507];return _0x1f7167;};'use strict';var _=require('lodash');var util=require(_0x49e8('0x0'));var logger=require('../../config/logger')(_0x49e8('0x1'));var moment=require(_0x49e8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x49e8('0x3'));var config=require(_0x49e8('0x4'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x592311,_0x2cd18d){return _0x592311['define']('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x802f=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','define','whatsapp_queues','lodash'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x802f,0x1bb));var _0xf802=function(_0x4a11fd,_0x449f7c){_0x4a11fd=_0x4a11fd-0x0;var _0x3d366e=_0x802f[_0x4a11fd];return _0x3d366e;};'use strict';var _=require(_0xf802('0x0'));var util=require(_0xf802('0x1'));var logger=require(_0xf802('0x2'))(_0xf802('0x3'));var moment=require(_0xf802('0x4'));var BPromise=require(_0xf802('0x5'));var rp=require(_0xf802('0x6'));var fs=require('fs');var path=require(_0xf802('0x7'));var rimraf=require('rimraf');var config=require(_0xf802('0x8'));var attributes=require(_0xf802('0x9'));module['exports']=function(_0x24fd88,_0x394178){return _0x24fd88[_0xf802('0xa')]('WhatsappQueue',attributes,{'tableName':_0xf802('0xb'),'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 809c023..2dc8d26 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 _0x7d36=['raw','where','limit','include','map','attributes','model','then','ShowWhatsappQueue','find','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','options'];(function(_0x2a3cd4,_0x1872dd){var _0x5800f9=function(_0x3c4d2f){while(--_0x3c4d2f){_0x2a3cd4['push'](_0x2a3cd4['shift']());}};_0x5800f9(++_0x1872dd);}(_0x7d36,0xe8));var _0x67d3=function(_0x3bb86e,_0x472537){_0x3bb86e=_0x3bb86e-0x0;var _0x23c7a7=_0x7d36[_0x3bb86e];return _0x23c7a7;};'use strict';var _=require(_0x67d3('0x0'));var util=require(_0x67d3('0x1'));var moment=require(_0x67d3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67d3('0x3'))['db'];var utils=require(_0x67d3('0x4'));var logger=require('../../config/logger')(_0x67d3('0x5'));var config=require(_0x67d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x67d3('0x7')][_0x67d3('0x8')]({'port':0x232a});config[_0x67d3('0x9')]=_[_0x67d3('0xa')](config[_0x67d3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x67d3('0xb'))(new Redis(config[_0x67d3('0x9')]));require(_0x67d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x3a9b9e,_0x44ae65,_0x1c8ed3){return new BPromise(function(_0x156c5a,_0x1ff3a6){return client[_0x67d3('0xd')](_0x3a9b9e,_0x1c8ed3)['then'](function(_0x12272e){logger[_0x67d3('0xe')](_0x67d3('0xf'),_0x44ae65,_0x67d3('0x10'));logger[_0x67d3('0x11')](_0x67d3('0x12'),_0x44ae65,_0x67d3('0x10'),JSON[_0x67d3('0x13')](_0x12272e));if(_0x12272e[_0x67d3('0x14')]){if(_0x12272e[_0x67d3('0x14')][_0x67d3('0x15')]===0x1f4){logger[_0x67d3('0x14')](_0x67d3('0xf'),_0x44ae65,_0x12272e[_0x67d3('0x14')][_0x67d3('0x16')]);return _0x1ff3a6(_0x12272e[_0x67d3('0x14')][_0x67d3('0x16')]);}logger[_0x67d3('0x14')](_0x67d3('0xf'),_0x44ae65,_0x12272e[_0x67d3('0x14')]['message']);return _0x156c5a(_0x12272e['error'][_0x67d3('0x16')]);}else{logger[_0x67d3('0xe')](_0x67d3('0xf'),_0x44ae65,_0x67d3('0x10'));_0x156c5a(_0x12272e[_0x67d3('0x17')]['message']);}})[_0x67d3('0x18')](function(_0x618a5b){logger['error'](_0x67d3('0xf'),_0x44ae65,_0x618a5b);_0x1ff3a6(_0x618a5b);});});}exports['GetWhatsappQueue']=function(_0x35c931){var _0x21fb95=this;return new Promise(function(_0x19da72,_0x5ac6fa){return db[_0x67d3('0x19')]['findAll']({'raw':_0x35c931[_0x67d3('0x1a')]?_0x35c931[_0x67d3('0x1a')][_0x67d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x35c931[_0x67d3('0x1a')]?_0x35c931[_0x67d3('0x1a')][_0x67d3('0x1c')]||null:null,'attributes':_0x35c931[_0x67d3('0x1a')]?_0x35c931[_0x67d3('0x1a')]['attributes']||null:null,'limit':_0x35c931[_0x67d3('0x1a')]?_0x35c931[_0x67d3('0x1a')][_0x67d3('0x1d')]||null:null,'include':_0x35c931[_0x67d3('0x1a')]?_0x35c931[_0x67d3('0x1a')][_0x67d3('0x1e')]?_[_0x67d3('0x1f')](_0x35c931[_0x67d3('0x1a')][_0x67d3('0x1e')],function(_0x4b0e0a){return{'model':db[_0x4b0e0a['model']],'as':_0x4b0e0a['as'],'attributes':_0x4b0e0a['attributes'],'include':_0x4b0e0a['include']?_[_0x67d3('0x1f')](_0x4b0e0a[_0x67d3('0x1e')],function(_0x337fd4){return{'model':db[_0x337fd4['model']],'as':_0x337fd4['as'],'attributes':_0x337fd4[_0x67d3('0x20')],'include':_0x337fd4[_0x67d3('0x1e')]?_[_0x67d3('0x1f')](_0x337fd4['include'],function(_0x74c578){return{'model':db[_0x74c578[_0x67d3('0x21')]],'as':_0x74c578['as'],'attributes':_0x74c578[_0x67d3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x67d3('0x22')](function(_0x14e451){logger[_0x67d3('0xe')]('GetWhatsappQueue',_0x35c931);logger['debug']('GetWhatsappQueue',_0x35c931,JSON[_0x67d3('0x13')](_0x14e451));_0x19da72(_0x14e451);})[_0x67d3('0x18')](function(_0x2a0d51){logger['error']('GetWhatsappQueue',_0x2a0d51['message'],_0x35c931);_0x5ac6fa(_0x21fb95[_0x67d3('0x14')](0x1f4,_0x2a0d51[_0x67d3('0x16')]));});});};exports[_0x67d3('0x23')]=function(_0x2745c4){var _0x4c4d86=this;return new Promise(function(_0x3cd41d,_0x2aecac){return db[_0x67d3('0x19')][_0x67d3('0x24')]({'raw':_0x2745c4[_0x67d3('0x1a')]?_0x2745c4[_0x67d3('0x1a')][_0x67d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x2745c4[_0x67d3('0x1a')]?_0x2745c4[_0x67d3('0x1a')][_0x67d3('0x1c')]||null:null,'attributes':_0x2745c4[_0x67d3('0x1a')]?_0x2745c4[_0x67d3('0x1a')]['attributes']||null:null,'include':_0x2745c4[_0x67d3('0x1a')]?_0x2745c4[_0x67d3('0x1a')][_0x67d3('0x1e')]?_[_0x67d3('0x1f')](_0x2745c4['options']['include'],function(_0x1ac202){return{'model':db[_0x1ac202[_0x67d3('0x21')]],'as':_0x1ac202['as'],'attributes':_0x1ac202[_0x67d3('0x20')],'include':_0x1ac202['include']?_['map'](_0x1ac202[_0x67d3('0x1e')],function(_0x5210db){return{'model':db[_0x5210db['model']],'as':_0x5210db['as'],'attributes':_0x5210db['attributes'],'include':_0x5210db[_0x67d3('0x1e')]?_['map'](_0x5210db[_0x67d3('0x1e')],function(_0x5c7539){return{'model':db[_0x5c7539[_0x67d3('0x21')]],'as':_0x5c7539['as'],'attributes':_0x5c7539[_0x67d3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x67d3('0x22')](function(_0x143bb8){logger[_0x67d3('0xe')](_0x67d3('0x23'),_0x2745c4);logger['debug'](_0x67d3('0x23'),_0x2745c4,JSON[_0x67d3('0x13')](_0x143bb8));_0x3cd41d(_0x143bb8);})[_0x67d3('0x18')](function(_0x5c10c8){logger['error'](_0x67d3('0x23'),_0x5c10c8[_0x67d3('0x16')],_0x2745c4);_0x2aecac(_0x4c4d86[_0x67d3('0x14')](0x1f4,_0x5c10c8[_0x67d3('0x16')]));});});}; \ No newline at end of file +var _0x654f=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info'];(function(_0x583539,_0x2f05a4){var _0x38e7fd=function(_0x7e1bf8){while(--_0x7e1bf8){_0x583539['push'](_0x583539['shift']());}};_0x38e7fd(++_0x2f05a4);}(_0x654f,0x17f));var _0xf654=function(_0x1cd32f,_0x4a3232){_0x1cd32f=_0x1cd32f-0x0;var _0x590f56=_0x654f[_0x1cd32f];return _0x590f56;};'use strict';var _=require(_0xf654('0x0'));var util=require(_0xf654('0x1'));var moment=require(_0xf654('0x2'));var BPromise=require(_0xf654('0x3'));var rs=require(_0xf654('0x4'));var fs=require('fs');var Redis=require(_0xf654('0x5'));var db=require(_0xf654('0x6'))['db'];var utils=require(_0xf654('0x7'));var logger=require(_0xf654('0x8'))(_0xf654('0x9'));var config=require(_0xf654('0xa'));var jayson=require(_0xf654('0xb'));var client=jayson[_0xf654('0xc')][_0xf654('0xd')]({'port':0x232a});config[_0xf654('0xe')]=_['defaults'](config['redis'],{'host':_0xf654('0xf'),'port':0x18eb});var socket=require(_0xf654('0x10'))(new Redis(config[_0xf654('0xe')]));require(_0xf654('0x11'))[_0xf654('0x12')](socket);function respondWithRpcPromise(_0x166707,_0x54bc99,_0x5533b9){return new BPromise(function(_0x4bf6e6,_0x1c1064){return client[_0xf654('0x13')](_0x166707,_0x5533b9)[_0xf654('0x14')](function(_0x1ce916){logger[_0xf654('0x15')](_0xf654('0x16'),_0x54bc99,_0xf654('0x17'));logger[_0xf654('0x18')](_0xf654('0x19'),_0x54bc99,'request\x20sent',JSON[_0xf654('0x1a')](_0x1ce916));if(_0x1ce916['error']){if(_0x1ce916[_0xf654('0x1b')][_0xf654('0x1c')]===0x1f4){logger['error'](_0xf654('0x16'),_0x54bc99,_0x1ce916[_0xf654('0x1b')][_0xf654('0x1d')]);return _0x1c1064(_0x1ce916[_0xf654('0x1b')][_0xf654('0x1d')]);}logger[_0xf654('0x1b')](_0xf654('0x16'),_0x54bc99,_0x1ce916[_0xf654('0x1b')][_0xf654('0x1d')]);return _0x4bf6e6(_0x1ce916[_0xf654('0x1b')][_0xf654('0x1d')]);}else{logger[_0xf654('0x15')](_0xf654('0x16'),_0x54bc99,_0xf654('0x17'));_0x4bf6e6(_0x1ce916[_0xf654('0x1e')][_0xf654('0x1d')]);}})[_0xf654('0x1f')](function(_0x4c6180){logger[_0xf654('0x1b')](_0xf654('0x16'),_0x54bc99,_0x4c6180);_0x1c1064(_0x4c6180);});});}exports[_0xf654('0x20')]=function(_0x2774f4){var _0x35774b=this;return new Promise(function(_0x1b7927,_0x2c1fd3){return db[_0xf654('0x21')][_0xf654('0x22')]({'raw':_0x2774f4[_0xf654('0x23')]?_0x2774f4[_0xf654('0x23')][_0xf654('0x24')]===undefined?!![]:![]:!![],'where':_0x2774f4[_0xf654('0x23')]?_0x2774f4['options'][_0xf654('0x25')]||null:null,'attributes':_0x2774f4['options']?_0x2774f4[_0xf654('0x23')][_0xf654('0x26')]||null:null,'limit':_0x2774f4[_0xf654('0x23')]?_0x2774f4[_0xf654('0x23')][_0xf654('0x27')]||null:null,'include':_0x2774f4[_0xf654('0x23')]?_0x2774f4[_0xf654('0x23')][_0xf654('0x28')]?_['map'](_0x2774f4[_0xf654('0x23')]['include'],function(_0x15a882){return{'model':db[_0x15a882[_0xf654('0x29')]],'as':_0x15a882['as'],'attributes':_0x15a882['attributes'],'include':_0x15a882[_0xf654('0x28')]?_['map'](_0x15a882[_0xf654('0x28')],function(_0x35cd4d){return{'model':db[_0x35cd4d[_0xf654('0x29')]],'as':_0x35cd4d['as'],'attributes':_0x35cd4d[_0xf654('0x26')],'include':_0x35cd4d[_0xf654('0x28')]?_[_0xf654('0x2a')](_0x35cd4d['include'],function(_0xca65f0){return{'model':db[_0xca65f0[_0xf654('0x29')]],'as':_0xca65f0['as'],'attributes':_0xca65f0[_0xf654('0x26')]};}):[]};}):[]};}):[]:[]})[_0xf654('0x14')](function(_0x1c4749){logger['info'](_0xf654('0x20'),_0x2774f4);logger['debug'](_0xf654('0x20'),_0x2774f4,JSON[_0xf654('0x1a')](_0x1c4749));_0x1b7927(_0x1c4749);})[_0xf654('0x1f')](function(_0x35ed87){logger[_0xf654('0x1b')](_0xf654('0x20'),_0x35ed87[_0xf654('0x1d')],_0x2774f4);_0x2c1fd3(_0x35774b[_0xf654('0x1b')](0x1f4,_0x35ed87['message']));});});};exports[_0xf654('0x2b')]=function(_0x39c11e){var _0x1245b2=this;return new Promise(function(_0x163f9b,_0x4b87f0){return db[_0xf654('0x21')][_0xf654('0x2c')]({'raw':_0x39c11e[_0xf654('0x23')]?_0x39c11e[_0xf654('0x23')][_0xf654('0x24')]===undefined?!![]:![]:!![],'where':_0x39c11e[_0xf654('0x23')]?_0x39c11e[_0xf654('0x23')][_0xf654('0x25')]||null:null,'attributes':_0x39c11e['options']?_0x39c11e[_0xf654('0x23')][_0xf654('0x26')]||null:null,'include':_0x39c11e['options']?_0x39c11e['options'][_0xf654('0x28')]?_[_0xf654('0x2a')](_0x39c11e[_0xf654('0x23')]['include'],function(_0x5d0541){return{'model':db[_0x5d0541[_0xf654('0x29')]],'as':_0x5d0541['as'],'attributes':_0x5d0541['attributes'],'include':_0x5d0541['include']?_[_0xf654('0x2a')](_0x5d0541['include'],function(_0x5408a5){return{'model':db[_0x5408a5['model']],'as':_0x5408a5['as'],'attributes':_0x5408a5['attributes'],'include':_0x5408a5['include']?_[_0xf654('0x2a')](_0x5408a5[_0xf654('0x28')],function(_0x20026d){return{'model':db[_0x20026d['model']],'as':_0x20026d['as'],'attributes':_0x20026d[_0xf654('0x26')]};}):[]};}):[]};}):[]:[]})[_0xf654('0x14')](function(_0x98cf91){logger[_0xf654('0x15')](_0xf654('0x2b'),_0x39c11e);logger[_0xf654('0x18')]('ShowWhatsappQueue',_0x39c11e,JSON[_0xf654('0x1a')](_0x98cf91));_0x163f9b(_0x98cf91);})['catch'](function(_0x2462db){logger[_0xf654('0x1b')](_0xf654('0x2b'),_0x2462db[_0xf654('0x1d')],_0x39c11e);_0x4b87f0(_0x1245b2[_0xf654('0x1b')](0x1f4,_0x2462db[_0xf654('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2dad70b..e378107 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 _0x97eb=['./whatsappQueue.events','save','update','emit','removeListener','length','whatsappQueue:'];(function(_0x48e0ae,_0x268dcf){var _0x10c209=function(_0x410863){while(--_0x410863){_0x48e0ae['push'](_0x48e0ae['shift']());}};_0x10c209(++_0x268dcf);}(_0x97eb,0x11f));var _0xb97e=function(_0x3fb331,_0x3725f0){_0x3fb331=_0x3fb331-0x0;var _0x32f183=_0x97eb[_0x3fb331];return _0x32f183;};'use strict';var WhatsappQueueEvents=require(_0xb97e('0x0'));var events=[_0xb97e('0x1'),'remove',_0xb97e('0x2')];function createListener(_0x549bc6,_0x31fb7a){return function(_0x2e2d85){_0x31fb7a[_0xb97e('0x3')](_0x549bc6,_0x2e2d85);};}function removeListener(_0x2d87e0,_0x118f76){return function(){WhatsappQueueEvents[_0xb97e('0x4')](_0x2d87e0,_0x118f76);};}exports['register']=function(_0x187d3d){for(var _0xf1160c=0x0,_0xef0c15=events[_0xb97e('0x5')];_0xf1160c<_0xef0c15;_0xf1160c++){var _0x344f05=events[_0xf1160c];var _0x42d303=createListener(_0xb97e('0x6')+_0x344f05,_0x187d3d);WhatsappQueueEvents['on'](_0x344f05,_0x42d303);}}; \ No newline at end of file +var _0x559d=['removeListener','length','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x502f0e,_0x3463b3){var _0x2522e8=function(_0x51c202){while(--_0x51c202){_0x502f0e['push'](_0x502f0e['shift']());}};_0x2522e8(++_0x3463b3);}(_0x559d,0x159));var _0xd559=function(_0x231b09,_0x4342ab){_0x231b09=_0x231b09-0x0;var _0x407bb6=_0x559d[_0x231b09];return _0x407bb6;};'use strict';var WhatsappQueueEvents=require(_0xd559('0x0'));var events=[_0xd559('0x1'),'remove',_0xd559('0x2')];function createListener(_0x1d846c,_0xa30858){return function(_0x13c467){_0xa30858['emit'](_0x1d846c,_0x13c467);};}function removeListener(_0x2343d9,_0x24c424){return function(){WhatsappQueueEvents[_0xd559('0x3')](_0x2343d9,_0x24c424);};}exports['register']=function(_0x14e6f9){for(var _0x2fc6c1=0x0,_0x9c92e8=events[_0xd559('0x4')];_0x2fc6c1<_0x9c92e8;_0x2fc6c1++){var _0x10bec7=events[_0x2fc6c1];var _0x547f9a=createListener(_0xd559('0x5')+_0x10bec7,_0x14e6f9);WhatsappQueueEvents['on'](_0x10bec7,_0x547f9a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f5469e9..b1474d6 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 _0x2ab6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','show','create','put','update','delete','multer','util','path'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x2ab6,0x18c));var _0x62ab=function(_0x54ea5f,_0x2024e0){_0x54ea5f=_0x54ea5f-0x0;var _0x265f93=_0x2ab6[_0x54ea5f];return _0x265f93;};'use strict';var multer=require(_0x62ab('0x0'));var util=require(_0x62ab('0x1'));var path=require(_0x62ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x62ab('0x3'));var router=express[_0x62ab('0x4')]();var fs_extra=require(_0x62ab('0x5'));var auth=require(_0x62ab('0x6'));var interaction=require(_0x62ab('0x7'));var config=require(_0x62ab('0x8'));var controller=require(_0x62ab('0x9'));router[_0x62ab('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x62ab('0xa')](_0x62ab('0xb'),auth[_0x62ab('0xc')](),controller[_0x62ab('0xd')]);router[_0x62ab('0xa')]('/:id',auth[_0x62ab('0xc')](),controller[_0x62ab('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x62ab('0xf')]);router[_0x62ab('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x62ab('0x11')]);router[_0x62ab('0x12')]('/:id',auth[_0x62ab('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9554=['../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x18066e,_0x3694ad){var _0x2ac149=function(_0x2ed645){while(--_0x2ed645){_0x18066e['push'](_0x18066e['shift']());}};_0x2ac149(++_0x3694ad);}(_0x9554,0x118));var _0x4955=function(_0x2dcc1b,_0xf24058){_0x2dcc1b=_0x2dcc1b-0x0;var _0x4e4d64=_0x9554[_0x2dcc1b];return _0x4e4d64;};'use strict';var multer=require(_0x4955('0x0'));var util=require('util');var path=require(_0x4955('0x1'));var timeout=require('connect-timeout');var express=require(_0x4955('0x2'));var router=express[_0x4955('0x3')]();var fs_extra=require(_0x4955('0x4'));var auth=require(_0x4955('0x5'));var interaction=require(_0x4955('0x6'));var config=require('../../config/environment');var controller=require(_0x4955('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4955('0x8')](_0x4955('0x9'),auth[_0x4955('0xa')](),controller['describe']);router[_0x4955('0x8')](_0x4955('0xb'),auth[_0x4955('0xa')](),controller[_0x4955('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4955('0xd')]);router[_0x4955('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4955('0xf')]);router[_0x4955('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4955('0x11')]);module[_0x4955('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 3e35910..b08479e 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4f6535,_0xccd089){var _0x54af96=function(_0x1e3ef3){while(--_0x1e3ef3){_0x4f6535['push'](_0x4f6535['shift']());}};_0x54af96(++_0xccd089);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x5d8767,_0x2defcd){var _0x866bcf=function(_0x4eef94){while(--_0x4eef94){_0x5d8767['push'](_0x5d8767['shift']());}};_0x866bcf(++_0x2defcd);}(_0x7a54,0x106));var _0x47a5=function(_0x19fbba,_0x5110ba){_0x19fbba=_0x19fbba-0x0;var _0xe63647=_0x7a54[_0x19fbba];return _0xe63647;};'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 5d97888..ccfd9be 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 _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x46d0c5,_0x46b358){var _0x583846=function(_0x538f23){while(--_0x538f23){_0x46d0c5['push'](_0x46d0c5['shift']());}};_0x583846(++_0x46b358);}(_0xa902,0x8d));var _0x2a90=function(_0x5140b7,_0x59635d){_0x5140b7=_0x5140b7-0x0;var _0x2bd1f1=_0xa902[_0x5140b7];return _0x2bd1f1;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file +var _0xab40=['describe','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','then','stack','name','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','WhatsappQueueReport','findAll','rows','show','params','include','catch','create','body','update','find'];(function(_0x5c785e,_0x35a68b){var _0x4da0f4=function(_0x1f815e){while(--_0x1f815e){_0x5c785e['push'](_0x5c785e['shift']());}};_0x4da0f4(++_0x35a68b);}(_0xab40,0xcd));var _0x0ab4=function(_0x24fcb8,_0x24c74c){_0x24fcb8=_0x24fcb8-0x0;var _0x1abe61=_0xab40[_0x24fcb8];return _0x1abe61;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249dc3,_0x45e6fd){_0x45e6fd=_0x45e6fd||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x249dc3[_0x0ab4('0x15')](_0x45e6fd);}return _0x249dc3[_0x0ab4('0x16')](_0x45e6fd)[_0x0ab4('0x17')]();};}function respondWithResult(_0x112162,_0x2cc644){_0x2cc644=_0x2cc644||0xc8;return function(_0x3cb1df){if(_0x3cb1df){return _0x112162[_0x0ab4('0x16')](_0x2cc644)[_0x0ab4('0x18')](_0x3cb1df);}};}function respondWithFilteredResult(_0x36d246,_0x293e20){return function(_0x45fad1){if(_0x45fad1){var _0x2a83a8=typeof _0x293e20[_0x0ab4('0x19')]===_0x0ab4('0x1a')&&typeof _0x293e20[_0x0ab4('0x1b')]==='undefined';var _0x5000d4=_0x45fad1['count'];var _0x17422f=_0x2a83a8?0x0:_0x293e20[_0x0ab4('0x19')];var _0x2f50d2=_0x2a83a8?_0x45fad1['count']:_0x293e20[_0x0ab4('0x19')]+_0x293e20[_0x0ab4('0x1b')];var _0x212ebd;if(_0x2f50d2>=_0x5000d4){_0x2f50d2=_0x5000d4;_0x212ebd=0xc8;}else{_0x212ebd=0xce;}_0x36d246[_0x0ab4('0x16')](_0x212ebd);return _0x36d246['set']('Content-Range',_0x17422f+'-'+_0x2f50d2+'/'+_0x5000d4)[_0x0ab4('0x18')](_0x45fad1);}return null;};}function patchUpdates(_0x5b1ed5){return function(_0x2b0e29){try{jsonpatch[_0x0ab4('0x1c')](_0x2b0e29,_0x5b1ed5,!![]);}catch(_0x5bb1d0){return BPromise[_0x0ab4('0x1d')](_0x5bb1d0);}return _0x2b0e29[_0x0ab4('0x1e')]();};}function saveUpdates(_0x2c55b3,_0x1d5c14){return function(_0x12d06d){if(_0x12d06d){return _0x12d06d['update'](_0x2c55b3)['then'](function(_0x24b929){return _0x24b929;});}return null;};}function removeEntity(_0x14087f,_0x392afe){return function(_0x13c882){if(_0x13c882){return _0x13c882['destroy']()[_0x0ab4('0x1f')](function(){_0x14087f[_0x0ab4('0x16')](0xcc)[_0x0ab4('0x17')]();});}};}function handleEntityNotFound(_0x4ea9aa,_0x4c5caf){return function(_0x176ff1){if(!_0x176ff1){_0x4ea9aa[_0x0ab4('0x15')](0x194);}return _0x176ff1;};}function handleError(_0x1a17ce,_0x4ae515){_0x4ae515=_0x4ae515||0x1f4;return function(_0x519b23){logger['error'](_0x519b23[_0x0ab4('0x20')]);if(_0x519b23['name']){delete _0x519b23[_0x0ab4('0x21')];}_0x1a17ce[_0x0ab4('0x16')](_0x4ae515)['send'](_0x519b23);};}exports['index']=function(_0x4d0cc1,_0x3d38a4){var _0x183bac={},_0x1cfdad={},_0x3f61cb={'count':0x0,'rows':[]};var _0x25385e=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x2e7a97){return{'name':_0x2e7a97[_0x0ab4('0x22')],'type':_0x2e7a97[_0x0ab4('0x23')][_0x0ab4('0x24')]};});_0x1cfdad[_0x0ab4('0x25')]=_['map'](_0x25385e,'name');_0x1cfdad[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0x4d0cc1[_0x0ab4('0x26')]);_0x1cfdad['filters']=_['intersection'](_0x1cfdad[_0x0ab4('0x25')],_0x1cfdad['query']);_0x183bac[_0x0ab4('0x28')]=_[_0x0ab4('0x29')](_0x1cfdad[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x183bac['attributes']=_0x183bac[_0x0ab4('0x28')][_0x0ab4('0x2b')]?_0x183bac[_0x0ab4('0x28')]:_0x1cfdad[_0x0ab4('0x25')];if(!_0x4d0cc1['query']['hasOwnProperty'](_0x0ab4('0x2c'))){_0x183bac[_0x0ab4('0x1b')]=qs[_0x0ab4('0x1b')](_0x4d0cc1['query']['limit']);_0x183bac['offset']=qs[_0x0ab4('0x19')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x19')]);}_0x183bac['order']=qs['sort'](_0x4d0cc1['query'][_0x0ab4('0x2d')]);_0x183bac[_0x0ab4('0x2e')]=qs[_0x0ab4('0x2f')](_[_0x0ab4('0x30')](_0x4d0cc1[_0x0ab4('0x26')],_0x1cfdad[_0x0ab4('0x2f')]),_0x25385e);if(_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]){_0x183bac[_0x0ab4('0x2e')]=_[_0x0ab4('0x32')](_0x183bac['where'],{'$or':_[_0x0ab4('0x33')](_0x25385e,function(_0x31e234){if(_0x31e234[_0x0ab4('0x23')]!==_0x0ab4('0x34')){var _0x2e1da9={};_0x2e1da9[_0x31e234[_0x0ab4('0x21')]]={'$like':'%'+_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]+'%'};return _0x2e1da9;}})});}_0x183bac=_[_0x0ab4('0x32')]({},_0x183bac,_0x4d0cc1[_0x0ab4('0x35')]);var _0x449437={'where':_0x183bac[_0x0ab4('0x2e')]};return db['WhatsappQueueReport'][_0x0ab4('0x36')](_0x449437)[_0x0ab4('0x1f')](function(_0x1cee1c){_0x3f61cb[_0x0ab4('0x36')]=_0x1cee1c;if(_0x4d0cc1['query'][_0x0ab4('0x37')]){_0x183bac['include']=[{'all':!![]}];}return db[_0x0ab4('0x38')][_0x0ab4('0x39')](_0x183bac);})[_0x0ab4('0x1f')](function(_0x245021){_0x3f61cb[_0x0ab4('0x3a')]=_0x245021;return _0x3f61cb;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x3d38a4,_0x183bac))['catch'](handleError(_0x3d38a4,null));};exports[_0x0ab4('0x3b')]=function(_0x3cc364,_0xe3df73){var _0x48029f={'raw':!![],'where':{'id':_0x3cc364[_0x0ab4('0x3c')]['id']}},_0x395e0b={};_0x395e0b[_0x0ab4('0x25')]=_[_0x0ab4('0x27')](db[_0x0ab4('0x38')]['rawAttributes']);_0x395e0b['query']=_['keys'](_0x3cc364[_0x0ab4('0x26')]);_0x395e0b[_0x0ab4('0x2f')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],_0x395e0b['query']);_0x48029f[_0x0ab4('0x28')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x48029f[_0x0ab4('0x28')]=_0x48029f[_0x0ab4('0x28')]['length']?_0x48029f[_0x0ab4('0x28')]:_0x395e0b[_0x0ab4('0x25')];if(_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x37')]){_0x48029f[_0x0ab4('0x3d')]=[{'all':!![]}];}_0x48029f=_[_0x0ab4('0x32')]({},_0x48029f,_0x3cc364['options']);return db[_0x0ab4('0x38')]['find'](_0x48029f)[_0x0ab4('0x1f')](handleEntityNotFound(_0xe3df73,null))[_0x0ab4('0x1f')](respondWithResult(_0xe3df73,null))[_0x0ab4('0x3e')](handleError(_0xe3df73,null));};exports['create']=function(_0x5b09e,_0x1fcc3b){return db[_0x0ab4('0x38')][_0x0ab4('0x3f')](_0x5b09e[_0x0ab4('0x40')],{})[_0x0ab4('0x1f')](respondWithResult(_0x1fcc3b,0xc9))['catch'](handleError(_0x1fcc3b,null));};exports[_0x0ab4('0x41')]=function(_0xdcc118,_0x302894){if(_0xdcc118[_0x0ab4('0x40')]['id']){delete _0xdcc118[_0x0ab4('0x40')]['id'];}return db[_0x0ab4('0x38')][_0x0ab4('0x42')]({'where':{'id':_0xdcc118[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x302894,null))[_0x0ab4('0x1f')](saveUpdates(_0xdcc118[_0x0ab4('0x40')],null))[_0x0ab4('0x1f')](respondWithResult(_0x302894,null))[_0x0ab4('0x3e')](handleError(_0x302894,null));};exports['destroy']=function(_0x2c3a0a,_0x354bc){return db['WhatsappQueueReport'][_0x0ab4('0x42')]({'where':{'id':_0x2c3a0a['params']['id']}})['then'](handleEntityNotFound(_0x354bc,null))[_0x0ab4('0x1f')](removeEntity(_0x354bc,null))[_0x0ab4('0x3e')](handleError(_0x354bc,null));};exports[_0x0ab4('0x43')]=function(_0x4966bc,_0x12a2df){return db[_0x0ab4('0x38')][_0x0ab4('0x43')]()[_0x0ab4('0x1f')](respondWithResult(_0x12a2df,null))[_0x0ab4('0x3e')](handleError(_0x12a2df,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c14a756..44fe173 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 _0x34e4=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x20bedd,_0x39694b){var _0x3041f3=function(_0x1f53ee){while(--_0x1f53ee){_0x20bedd['push'](_0x20bedd['shift']());}};_0x3041f3(++_0x39694b);}(_0x34e4,0x97));var _0x434e=function(_0x33dc75,_0x425795){_0x33dc75=_0x33dc75-0x0;var _0x1a227d=_0x34e4[_0x33dc75];return _0x1a227d;};'use strict';var _=require(_0x434e('0x0'));var util=require(_0x434e('0x1'));var logger=require(_0x434e('0x2'))('api');var moment=require(_0x434e('0x3'));var BPromise=require(_0x434e('0x4'));var rp=require(_0x434e('0x5'));var fs=require('fs');var path=require(_0x434e('0x6'));var rimraf=require(_0x434e('0x7'));var config=require(_0x434e('0x8'));var attributes=require(_0x434e('0x9'));module[_0x434e('0xa')]=function(_0x4f8a46,_0xb7ac24){return _0x4f8a46[_0x434e('0xb')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x434e('0xc'),'fields':[_0x434e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe927=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x48ef55,_0x101d9c){var _0x195568=function(_0x22fd08){while(--_0x22fd08){_0x48ef55['push'](_0x48ef55['shift']());}};_0x195568(++_0x101d9c);}(_0xe927,0xf7));var _0x7e92=function(_0x35741f,_0x1bfb4f){_0x35741f=_0x35741f-0x0;var _0x2cd2b7=_0xe927[_0x35741f];return _0x2cd2b7;};'use strict';var _=require(_0x7e92('0x0'));var util=require('util');var logger=require(_0x7e92('0x1'))(_0x7e92('0x2'));var moment=require(_0x7e92('0x3'));var BPromise=require(_0x7e92('0x4'));var rp=require(_0x7e92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e92('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e92('0x7'));module[_0x7e92('0x8')]=function(_0x532934,_0x1987b5){return _0x532934[_0x7e92('0x9')](_0x7e92('0xa'),attributes,{'tableName':_0x7e92('0xb'),'paranoid':![],'indexes':[{'name':_0x7e92('0xc'),'fields':[_0x7e92('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 16b4cc8..f219652 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 _0x75b8=['WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x440c50,_0x1d1ffb){var _0x36d412=function(_0x2a3a7e){while(--_0x2a3a7e){_0x440c50['push'](_0x440c50['shift']());}};_0x36d412(++_0x1d1ffb);}(_0x75b8,0x167));var _0x875b=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x75b8[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0x875b('0x0'));var util=require(_0x875b('0x1'));var moment=require('moment');var BPromise=require(_0x875b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x875b('0x3'));var db=require(_0x875b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x875b('0x5'))('rpc');var config=require(_0x875b('0x6'));var jayson=require(_0x875b('0x7'));var client=jayson[_0x875b('0x8')][_0x875b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31c44e,_0x35d4fb,_0x5e54e5){return new BPromise(function(_0x5dfa0d,_0x4051eb){return client[_0x875b('0xa')](_0x31c44e,_0x5e54e5)[_0x875b('0xb')](function(_0x1b5f68){logger['info'](_0x875b('0xc'),_0x35d4fb,'request\x20sent');logger['debug'](_0x875b('0xd'),_0x35d4fb,_0x875b('0xe'),JSON[_0x875b('0xf')](_0x1b5f68));if(_0x1b5f68['error']){if(_0x1b5f68['error']['code']===0x1f4){logger[_0x875b('0x10')](_0x875b('0xc'),_0x35d4fb,_0x1b5f68[_0x875b('0x10')][_0x875b('0x11')]);return _0x4051eb(_0x1b5f68[_0x875b('0x10')]['message']);}logger[_0x875b('0x10')](_0x875b('0xc'),_0x35d4fb,_0x1b5f68[_0x875b('0x10')][_0x875b('0x11')]);return _0x5dfa0d(_0x1b5f68[_0x875b('0x10')]['message']);}else{logger[_0x875b('0x12')](_0x875b('0xc'),_0x35d4fb,_0x875b('0xe'));_0x5dfa0d(_0x1b5f68[_0x875b('0x13')][_0x875b('0x11')]);}})[_0x875b('0x14')](function(_0x2addc0){logger[_0x875b('0x10')](_0x875b('0xc'),_0x35d4fb,_0x2addc0);_0x4051eb(_0x2addc0);});});}exports[_0x875b('0x15')]=function(_0xd75f26){var _0x466c67=this;return new Promise(function(_0x516b77,_0x2165c0){return db[_0x875b('0x16')]['create'](_0xd75f26[_0x875b('0x17')],{'raw':_0xd75f26[_0x875b('0x18')]?_0xd75f26[_0x875b('0x18')][_0x875b('0x19')]===undefined?!![]:![]:!![]})[_0x875b('0xb')](function(_0x1d5e30){logger['info']('CreateWhatsappQueueReport',_0xd75f26);logger[_0x875b('0x1a')](_0x875b('0x15'),_0xd75f26,JSON['stringify'](_0x1d5e30));_0x516b77(_0x1d5e30);})['catch'](function(_0x262b8c){logger[_0x875b('0x10')]('CreateWhatsappQueueReport',_0x262b8c[_0x875b('0x11')],_0xd75f26);_0x2165c0(_0x466c67[_0x875b('0x10')](0x1f4,_0x262b8c[_0x875b('0x11')]));});});};exports[_0x875b('0x1b')]=function(_0x5c8304){var _0x461442=this;return new Promise(function(_0xf12515,_0x302f8c){return db['WhatsappQueueReport']['update'](_0x5c8304[_0x875b('0x17')],{'raw':_0x5c8304[_0x875b('0x18')]?_0x5c8304[_0x875b('0x18')][_0x875b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c8304[_0x875b('0x18')]?_0x5c8304['options'][_0x875b('0x1c')]||null:null,'attributes':_0x5c8304['options']?_0x5c8304[_0x875b('0x18')][_0x875b('0x1d')]||null:null,'limit':_0x5c8304[_0x875b('0x18')]?_0x5c8304[_0x875b('0x18')][_0x875b('0x1e')]||null:null})[_0x875b('0xb')](function(_0x3b309e){logger['info'](_0x875b('0x1b'),_0x5c8304);logger[_0x875b('0x1a')]('UpdateWhatsappQueueReport',_0x5c8304,JSON[_0x875b('0xf')](_0x3b309e));_0xf12515(_0x3b309e);})[_0x875b('0x14')](function(_0x1904f3){logger[_0x875b('0x10')]('UpdateWhatsappQueueReport',_0x1904f3[_0x875b('0x11')],_0x5c8304);_0x302f8c(_0x461442[_0x875b('0x10')](0x1f4,_0x1904f3[_0x875b('0x11')]));});});}; \ No newline at end of file +var _0x718d=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','info','debug','UpdateWhatsappQueueReport','update','body','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result'];(function(_0x50d5ae,_0x22a349){var _0x1e8d74=function(_0xd256a9){while(--_0xd256a9){_0x50d5ae['push'](_0x50d5ae['shift']());}};_0x1e8d74(++_0x22a349);}(_0x718d,0x16b));var _0xd718=function(_0x3e2c2d,_0x369550){_0x3e2c2d=_0x3e2c2d-0x0;var _0x5a0e7f=_0x718d[_0x3e2c2d];return _0x5a0e7f;};'use strict';var _=require(_0xd718('0x0'));var util=require(_0xd718('0x1'));var moment=require(_0xd718('0x2'));var BPromise=require(_0xd718('0x3'));var rs=require(_0xd718('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd718('0x5'))['db'];var utils=require(_0xd718('0x6'));var logger=require(_0xd718('0x7'))(_0xd718('0x8'));var config=require(_0xd718('0x9'));var jayson=require(_0xd718('0xa'));var client=jayson['client'][_0xd718('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39c31d,_0x24b65b,_0x1cc83a){return new BPromise(function(_0x215abb,_0x1f05ec){return client[_0xd718('0xc')](_0x39c31d,_0x1cc83a)[_0xd718('0xd')](function(_0x41323d){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x24b65b,_0xd718('0xe'));logger['debug'](_0xd718('0xf'),_0x24b65b,_0xd718('0xe'),JSON[_0xd718('0x10')](_0x41323d));if(_0x41323d['error']){if(_0x41323d[_0xd718('0x11')][_0xd718('0x12')]===0x1f4){logger[_0xd718('0x11')](_0xd718('0x13'),_0x24b65b,_0x41323d[_0xd718('0x11')][_0xd718('0x14')]);return _0x1f05ec(_0x41323d[_0xd718('0x11')][_0xd718('0x14')]);}logger[_0xd718('0x11')](_0xd718('0x13'),_0x24b65b,_0x41323d[_0xd718('0x11')][_0xd718('0x14')]);return _0x215abb(_0x41323d[_0xd718('0x11')][_0xd718('0x14')]);}else{logger['info'](_0xd718('0x13'),_0x24b65b,_0xd718('0xe'));_0x215abb(_0x41323d[_0xd718('0x15')][_0xd718('0x14')]);}})[_0xd718('0x16')](function(_0x5c1116){logger[_0xd718('0x11')](_0xd718('0x13'),_0x24b65b,_0x5c1116);_0x1f05ec(_0x5c1116);});});}exports[_0xd718('0x17')]=function(_0x507402){var _0x8b1837=this;return new Promise(function(_0x161fdc,_0x5be448){return db[_0xd718('0x18')][_0xd718('0x19')](_0x507402['body'],{'raw':_0x507402[_0xd718('0x1a')]?_0x507402[_0xd718('0x1a')][_0xd718('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x27d50b){logger[_0xd718('0x1c')]('CreateWhatsappQueueReport',_0x507402);logger[_0xd718('0x1d')](_0xd718('0x17'),_0x507402,JSON[_0xd718('0x10')](_0x27d50b));_0x161fdc(_0x27d50b);})[_0xd718('0x16')](function(_0x2e30ef){logger['error'](_0xd718('0x17'),_0x2e30ef[_0xd718('0x14')],_0x507402);_0x5be448(_0x8b1837[_0xd718('0x11')](0x1f4,_0x2e30ef[_0xd718('0x14')]));});});};exports[_0xd718('0x1e')]=function(_0x3c942a){var _0x46c3ca=this;return new Promise(function(_0x462425,_0xf3546){return db[_0xd718('0x18')][_0xd718('0x1f')](_0x3c942a[_0xd718('0x20')],{'raw':_0x3c942a[_0xd718('0x1a')]?_0x3c942a[_0xd718('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c942a['options']?_0x3c942a[_0xd718('0x1a')]['where']||null:null,'attributes':_0x3c942a[_0xd718('0x1a')]?_0x3c942a[_0xd718('0x1a')][_0xd718('0x21')]||null:null,'limit':_0x3c942a[_0xd718('0x1a')]?_0x3c942a[_0xd718('0x1a')][_0xd718('0x22')]||null:null})['then'](function(_0x4d35b6){logger[_0xd718('0x1c')](_0xd718('0x1e'),_0x3c942a);logger[_0xd718('0x1d')](_0xd718('0x1e'),_0x3c942a,JSON[_0xd718('0x10')](_0x4d35b6));_0x462425(_0x4d35b6);})[_0xd718('0x16')](function(_0x4c8f20){logger['error'](_0xd718('0x1e'),_0x4c8f20[_0xd718('0x14')],_0x3c942a);_0xf3546(_0x46c3ca[_0xd718('0x11')](0x1f4,_0x4c8f20[_0xd718('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7d3794f..edc05c6 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 _0x820a=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update'];(function(_0x323c7e,_0x3d16ec){var _0x2b0f72=function(_0x5a2310){while(--_0x5a2310){_0x323c7e['push'](_0x323c7e['shift']());}};_0x2b0f72(++_0x3d16ec);}(_0x820a,0x137));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa820('0x0'));var util=require(_0xa820('0x1'));var path=require('path');var timeout=require(_0xa820('0x2'));var express=require(_0xa820('0x3'));var router=express[_0xa820('0x4')]();var fs_extra=require(_0xa820('0x5'));var auth=require(_0xa820('0x6'));var interaction=require(_0xa820('0x7'));var config=require(_0xa820('0x8'));var controller=require(_0xa820('0x9'));router[_0xa820('0xa')]('/',auth[_0xa820('0xb')](),controller[_0xa820('0xc')]);router['get'](_0xa820('0xd'),auth['isAuthenticated'](),controller[_0xa820('0xe')]);router['get'](_0xa820('0xf'),auth['isAuthenticated'](),controller[_0xa820('0x10')]);router[_0xa820('0x11')]('/',auth[_0xa820('0xb')](),controller['create']);router['put'](_0xa820('0xf'),auth['isAuthenticated'](),controller[_0xa820('0x12')]);router[_0xa820('0x13')](_0xa820('0xf'),auth['isAuthenticated'](),controller[_0xa820('0x14')]);module[_0xa820('0x15')]=router; \ No newline at end of file +var _0x99b5=['/describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index'];(function(_0x306357,_0x29f116){var _0x5d4912=function(_0x3780ab){while(--_0x3780ab){_0x306357['push'](_0x306357['shift']());}};_0x5d4912(++_0x29f116);}(_0x99b5,0xd1));var _0x599b=function(_0x47da00,_0x1e8b2c){_0x47da00=_0x47da00-0x0;var _0x3b7bb9=_0x99b5[_0x47da00];return _0x3b7bb9;};'use strict';var multer=require(_0x599b('0x0'));var util=require(_0x599b('0x1'));var path=require(_0x599b('0x2'));var timeout=require('connect-timeout');var express=require(_0x599b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x599b('0x4'));var interaction=require(_0x599b('0x5'));var config=require(_0x599b('0x6'));var controller=require(_0x599b('0x7'));router[_0x599b('0x8')]('/',auth[_0x599b('0x9')](),controller[_0x599b('0xa')]);router[_0x599b('0x8')](_0x599b('0xb'),auth[_0x599b('0x9')](),controller['describe']);router['get'](_0x599b('0xc'),auth[_0x599b('0x9')](),controller[_0x599b('0xd')]);router[_0x599b('0xe')]('/',auth[_0x599b('0x9')](),controller[_0x599b('0xf')]);router[_0x599b('0x10')](_0x599b('0xc'),auth[_0x599b('0x9')](),controller[_0x599b('0x11')]);router[_0x599b('0x12')](_0x599b('0xc'),auth[_0x599b('0x9')](),controller['destroy']);module[_0x599b('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d0cde69..e5daf23 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 _0xb67f=['exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x4d82da,_0x18d6b9){var _0x199a34=function(_0x2431e3){while(--_0x2431e3){_0x4d82da['push'](_0x4d82da['shift']());}};_0x199a34(++_0x18d6b9);}(_0xb67f,0x12d));var _0xfb67=function(_0x4b6471,_0x598f3e){_0x4b6471=_0x4b6471-0x0;var _0x2794ca=_0xb67f[_0x4b6471];return _0x2794ca;};'use strict';var Sequelize=require('sequelize');module[_0xfb67('0x0')]={'uniqueid':{'type':Sequelize[_0xfb67('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfb67('0x2')](_0xfb67('0x3'),_0xfb67('0x4'),_0xfb67('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfb67('0x6')]}}; \ No newline at end of file +var _0xd23d=['exports','STRING','ENUM','account','agent','queue','sequelize'];(function(_0x428420,_0x194189){var _0x1a366f=function(_0x5c57d5){while(--_0x5c57d5){_0x428420['push'](_0x428420['shift']());}};_0x1a366f(++_0x194189);}(_0xd23d,0xa0));var _0xdd23=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xd23d[_0x5c6299];return _0x23b564;};'use strict';var Sequelize=require(_0xdd23('0x0'));module[_0xdd23('0x1')]={'uniqueid':{'type':Sequelize[_0xdd23('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdd23('0x3')](_0xdd23('0x4'),_0xdd23('0x5'),_0xdd23('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 21a62de..39dc0d7 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 _0x8588=['reject','save','then','error','stack','name','index','WhatsappTransferReport','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','catch','show','rawAttributes','merge','find','create','update','body','destroy','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x3abeac,_0x1403a9){var _0x26a08=function(_0x3dcd79){while(--_0x3dcd79){_0x3abeac['push'](_0x3abeac['shift']());}};_0x26a08(++_0x1403a9);}(_0x8588,0x185));var _0x8858=function(_0x3adbfa,_0x13ec02){_0x3adbfa=_0x3adbfa-0x0;var _0x205240=_0x8588[_0x3adbfa];return _0x205240;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8858('0x0'));var zipdir=require(_0x8858('0x1'));var jsonpatch=require(_0x8858('0x2'));var rp=require(_0x8858('0x3'));var moment=require('moment');var BPromise=require(_0x8858('0x4'));var Mustache=require(_0x8858('0x5'));var util=require(_0x8858('0x6'));var path=require('path');var sox=require(_0x8858('0x7'));var csv=require(_0x8858('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8858('0x9'));var _=require(_0x8858('0xa'));var squel=require(_0x8858('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8858('0x8'));var querystring=require('querystring');var Papa=require(_0x8858('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8858('0xd'));var as=require(_0x8858('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8858('0xf'));var utils=require(_0x8858('0x10'));var config=require(_0x8858('0x11'));var licenseUtil=require(_0x8858('0x12'));var db=require(_0x8858('0x13'))['db'];function respondWithStatusCode(_0x1f063a,_0x1da801){_0x1da801=_0x1da801||0xcc;return function(_0x3ebff2){if(_0x3ebff2){return _0x1f063a[_0x8858('0x14')](_0x1da801);}return _0x1f063a[_0x8858('0x15')](_0x1da801)[_0x8858('0x16')]();};}function respondWithResult(_0x1f6c96,_0x32be90){_0x32be90=_0x32be90||0xc8;return function(_0x424f1d){if(_0x424f1d){return _0x1f6c96[_0x8858('0x15')](_0x32be90)['json'](_0x424f1d);}};}function respondWithFilteredResult(_0x41f883,_0x5c0a1d){return function(_0x26c0bd){if(_0x26c0bd){var _0x22b356=typeof _0x5c0a1d[_0x8858('0x17')]===_0x8858('0x18')&&typeof _0x5c0a1d[_0x8858('0x19')]===_0x8858('0x18');var _0x251b32=_0x26c0bd[_0x8858('0x1a')];var _0x159aab=_0x22b356?0x0:_0x5c0a1d[_0x8858('0x17')];var _0x5b0880=_0x22b356?_0x26c0bd[_0x8858('0x1a')]:_0x5c0a1d[_0x8858('0x17')]+_0x5c0a1d[_0x8858('0x19')];var _0xcf674a;if(_0x5b0880>=_0x251b32){_0x5b0880=_0x251b32;_0xcf674a=0xc8;}else{_0xcf674a=0xce;}_0x41f883[_0x8858('0x15')](_0xcf674a);return _0x41f883[_0x8858('0x1b')](_0x8858('0x1c'),_0x159aab+'-'+_0x5b0880+'/'+_0x251b32)[_0x8858('0x1d')](_0x26c0bd);}return null;};}function patchUpdates(_0x837d58){return function(_0x19c37d){try{jsonpatch[_0x8858('0x1e')](_0x19c37d,_0x837d58,!![]);}catch(_0x30f607){return BPromise[_0x8858('0x1f')](_0x30f607);}return _0x19c37d[_0x8858('0x20')]();};}function saveUpdates(_0x546d2c,_0x55ec5b){return function(_0x1e7ee){if(_0x1e7ee){return _0x1e7ee['update'](_0x546d2c)[_0x8858('0x21')](function(_0x3b3301){return _0x3b3301;});}return null;};}function removeEntity(_0x3e31a0,_0x580fcb){return function(_0x4d7267){if(_0x4d7267){return _0x4d7267['destroy']()[_0x8858('0x21')](function(){_0x3e31a0[_0x8858('0x15')](0xcc)[_0x8858('0x16')]();});}};}function handleEntityNotFound(_0x11e03d,_0x479254){return function(_0x113e0c){if(!_0x113e0c){_0x11e03d[_0x8858('0x14')](0x194);}return _0x113e0c;};}function handleError(_0xf748fb,_0x1303c5){_0x1303c5=_0x1303c5||0x1f4;return function(_0x1e8f99){logger[_0x8858('0x22')](_0x1e8f99[_0x8858('0x23')]);if(_0x1e8f99[_0x8858('0x24')]){delete _0x1e8f99[_0x8858('0x24')];}_0xf748fb[_0x8858('0x15')](_0x1303c5)['send'](_0x1e8f99);};}exports[_0x8858('0x25')]=function(_0x4e2459,_0x3f9191){var _0x2fa4f9={},_0xba3171={},_0x1aaae3={'count':0x0,'rows':[]};var _0x89bec7=_['map'](db[_0x8858('0x26')]['rawAttributes'],function(_0xccfb93){return{'name':_0xccfb93['fieldName'],'type':_0xccfb93[_0x8858('0x27')]['key']};});_0xba3171['model']=_[_0x8858('0x28')](_0x89bec7,'name');_0xba3171[_0x8858('0x29')]=_[_0x8858('0x2a')](_0x4e2459[_0x8858('0x29')]);_0xba3171[_0x8858('0x2b')]=_[_0x8858('0x2c')](_0xba3171['model'],_0xba3171[_0x8858('0x29')]);_0x2fa4f9['attributes']=_['intersection'](_0xba3171[_0x8858('0x2d')],qs[_0x8858('0x2e')](_0x4e2459[_0x8858('0x29')][_0x8858('0x2e')]));_0x2fa4f9['attributes']=_0x2fa4f9[_0x8858('0x2f')][_0x8858('0x30')]?_0x2fa4f9[_0x8858('0x2f')]:_0xba3171[_0x8858('0x2d')];if(!_0x4e2459[_0x8858('0x29')][_0x8858('0x31')](_0x8858('0x32'))){_0x2fa4f9[_0x8858('0x19')]=qs[_0x8858('0x19')](_0x4e2459[_0x8858('0x29')][_0x8858('0x19')]);_0x2fa4f9[_0x8858('0x17')]=qs[_0x8858('0x17')](_0x4e2459[_0x8858('0x29')][_0x8858('0x17')]);}_0x2fa4f9[_0x8858('0x33')]=qs[_0x8858('0x34')](_0x4e2459['query']['sort']);_0x2fa4f9[_0x8858('0x35')]=qs[_0x8858('0x2b')](_['pick'](_0x4e2459[_0x8858('0x29')],_0xba3171[_0x8858('0x2b')]),_0x89bec7);if(_0x4e2459[_0x8858('0x29')]['filter']){_0x2fa4f9['where']=_['merge'](_0x2fa4f9[_0x8858('0x35')],{'$or':_[_0x8858('0x28')](_0x89bec7,function(_0x341dae){if(_0x341dae[_0x8858('0x27')]!=='VIRTUAL'){var _0x1ed1e2={};_0x1ed1e2[_0x341dae[_0x8858('0x24')]]={'$like':'%'+_0x4e2459[_0x8858('0x29')][_0x8858('0x36')]+'%'};return _0x1ed1e2;}})});}_0x2fa4f9=_['merge']({},_0x2fa4f9,_0x4e2459[_0x8858('0x37')]);var _0x21903f={'where':_0x2fa4f9[_0x8858('0x35')]};return db[_0x8858('0x26')][_0x8858('0x1a')](_0x21903f)['then'](function(_0x33fd2f){_0x1aaae3[_0x8858('0x1a')]=_0x33fd2f;if(_0x4e2459[_0x8858('0x29')][_0x8858('0x38')]){_0x2fa4f9[_0x8858('0x39')]=[{'all':!![]}];}return db[_0x8858('0x26')][_0x8858('0x3a')](_0x2fa4f9);})[_0x8858('0x21')](function(_0x3cadbf){_0x1aaae3['rows']=_0x3cadbf;return _0x1aaae3;})[_0x8858('0x21')](respondWithFilteredResult(_0x3f9191,_0x2fa4f9))[_0x8858('0x3b')](handleError(_0x3f9191,null));};exports[_0x8858('0x3c')]=function(_0xc6b4db,_0x5d33d0){var _0x1bdead={'raw':!![],'where':{'id':_0xc6b4db['params']['id']}},_0x5e86bd={};_0x5e86bd[_0x8858('0x2d')]=_[_0x8858('0x2a')](db[_0x8858('0x26')][_0x8858('0x3d')]);_0x5e86bd[_0x8858('0x29')]=_['keys'](_0xc6b4db[_0x8858('0x29')]);_0x5e86bd[_0x8858('0x2b')]=_['intersection'](_0x5e86bd[_0x8858('0x2d')],_0x5e86bd[_0x8858('0x29')]);_0x1bdead[_0x8858('0x2f')]=_[_0x8858('0x2c')](_0x5e86bd[_0x8858('0x2d')],qs[_0x8858('0x2e')](_0xc6b4db[_0x8858('0x29')][_0x8858('0x2e')]));_0x1bdead[_0x8858('0x2f')]=_0x1bdead[_0x8858('0x2f')][_0x8858('0x30')]?_0x1bdead[_0x8858('0x2f')]:_0x5e86bd[_0x8858('0x2d')];if(_0xc6b4db[_0x8858('0x29')][_0x8858('0x38')]){_0x1bdead[_0x8858('0x39')]=[{'all':!![]}];}_0x1bdead=_[_0x8858('0x3e')]({},_0x1bdead,_0xc6b4db['options']);return db[_0x8858('0x26')][_0x8858('0x3f')](_0x1bdead)['then'](handleEntityNotFound(_0x5d33d0,null))[_0x8858('0x21')](respondWithResult(_0x5d33d0,null))['catch'](handleError(_0x5d33d0,null));};exports[_0x8858('0x40')]=function(_0x34217a,_0x166d4d){return db['WhatsappTransferReport'][_0x8858('0x40')](_0x34217a['body'],{})['then'](respondWithResult(_0x166d4d,0xc9))[_0x8858('0x3b')](handleError(_0x166d4d,null));};exports[_0x8858('0x41')]=function(_0xe41edd,_0x147d0e){if(_0xe41edd[_0x8858('0x42')]['id']){delete _0xe41edd[_0x8858('0x42')]['id'];}return db[_0x8858('0x26')][_0x8858('0x3f')]({'where':{'id':_0xe41edd['params']['id']}})['then'](handleEntityNotFound(_0x147d0e,null))[_0x8858('0x21')](saveUpdates(_0xe41edd[_0x8858('0x42')],null))[_0x8858('0x21')](respondWithResult(_0x147d0e,null))[_0x8858('0x3b')](handleError(_0x147d0e,null));};exports[_0x8858('0x43')]=function(_0x48a32c,_0x2df438){return db['WhatsappTransferReport'][_0x8858('0x3f')]({'where':{'id':_0x48a32c[_0x8858('0x44')]['id']}})[_0x8858('0x21')](handleEntityNotFound(_0x2df438,null))[_0x8858('0x21')](removeEntity(_0x2df438,null))[_0x8858('0x3b')](handleError(_0x2df438,null));};exports[_0x8858('0x45')]=function(_0x422a06,_0x44684b){return db[_0x8858('0x26')][_0x8858('0x45')]()[_0x8858('0x21')](respondWithResult(_0x44684b,null))[_0x8858('0x3b')](handleError(_0x44684b,null));}; \ No newline at end of file +var _0x762e=['fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','catch','show','params','create','body','find','describe','eml-format','fast-json-patch','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes'];(function(_0x375966,_0x43c55f){var _0x2d1d2f=function(_0x41843c){while(--_0x41843c){_0x375966['push'](_0x375966['shift']());}};_0x2d1d2f(++_0x43c55f);}(_0x762e,0xea));var _0xe762=function(_0x9e5e04,_0x4397a4){_0x9e5e04=_0x9e5e04-0x0;var _0x2e8dc=_0x762e[_0x9e5e04];return _0x2e8dc;};'use strict';var emlformat=require(_0xe762('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe762('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe762('0x2'));var Mustache=require(_0xe762('0x3'));var util=require(_0xe762('0x4'));var path=require('path');var sox=require(_0xe762('0x5'));var csv=require(_0xe762('0x6'));var ejs=require(_0xe762('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe762('0x8'));var squel=require(_0xe762('0x9'));var crypto=require(_0xe762('0xa'));var jsforce=require(_0xe762('0xb'));var deskjs=require(_0xe762('0xc'));var toCsv=require(_0xe762('0x6'));var querystring=require('querystring');var Papa=require(_0xe762('0xd'));var Redis=require(_0xe762('0xe'));var authService=require(_0xe762('0xf'));var qs=require(_0xe762('0x10'));var as=require(_0xe762('0x11'));var hardwareService=require(_0xe762('0x12'));var logger=require(_0xe762('0x13'))('api');var utils=require(_0xe762('0x14'));var config=require(_0xe762('0x15'));var licenseUtil=require(_0xe762('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340573,_0x4793b0){_0x4793b0=_0x4793b0||0xcc;return function(_0x3d3bd0){if(_0x3d3bd0){return _0x340573['sendStatus'](_0x4793b0);}return _0x340573[_0xe762('0x17')](_0x4793b0)[_0xe762('0x18')]();};}function respondWithResult(_0x1ebf3d,_0x533dcb){_0x533dcb=_0x533dcb||0xc8;return function(_0x50aa09){if(_0x50aa09){return _0x1ebf3d[_0xe762('0x17')](_0x533dcb)[_0xe762('0x19')](_0x50aa09);}};}function respondWithFilteredResult(_0x229d3d,_0x13c27d){return function(_0x3e6c1d){if(_0x3e6c1d){var _0x7a379=typeof _0x13c27d[_0xe762('0x1a')]===_0xe762('0x1b')&&typeof _0x13c27d['limit']===_0xe762('0x1b');var _0xe43c3e=_0x3e6c1d[_0xe762('0x1c')];var _0x27c2cf=_0x7a379?0x0:_0x13c27d['offset'];var _0xd2cb26=_0x7a379?_0x3e6c1d[_0xe762('0x1c')]:_0x13c27d['offset']+_0x13c27d['limit'];var _0x52e1de;if(_0xd2cb26>=_0xe43c3e){_0xd2cb26=_0xe43c3e;_0x52e1de=0xc8;}else{_0x52e1de=0xce;}_0x229d3d[_0xe762('0x17')](_0x52e1de);return _0x229d3d['set'](_0xe762('0x1d'),_0x27c2cf+'-'+_0xd2cb26+'/'+_0xe43c3e)['json'](_0x3e6c1d);}return null;};}function patchUpdates(_0x8775aa){return function(_0x57ad0d){try{jsonpatch[_0xe762('0x1e')](_0x57ad0d,_0x8775aa,!![]);}catch(_0x190aa3){return BPromise[_0xe762('0x1f')](_0x190aa3);}return _0x57ad0d[_0xe762('0x20')]();};}function saveUpdates(_0x3e2d00,_0x5c096c){return function(_0x58a906){if(_0x58a906){return _0x58a906['update'](_0x3e2d00)['then'](function(_0x413584){return _0x413584;});}return null;};}function removeEntity(_0x14641f,_0x31ac1a){return function(_0x604304){if(_0x604304){return _0x604304[_0xe762('0x21')]()['then'](function(){_0x14641f[_0xe762('0x17')](0xcc)[_0xe762('0x18')]();});}};}function handleEntityNotFound(_0x407d1e,_0x1f8cb1){return function(_0x411d94){if(!_0x411d94){_0x407d1e[_0xe762('0x22')](0x194);}return _0x411d94;};}function handleError(_0x46817e,_0x3dcd32){_0x3dcd32=_0x3dcd32||0x1f4;return function(_0xc05eb8){logger[_0xe762('0x23')](_0xc05eb8[_0xe762('0x24')]);if(_0xc05eb8['name']){delete _0xc05eb8['name'];}_0x46817e[_0xe762('0x17')](_0x3dcd32)['send'](_0xc05eb8);};}exports[_0xe762('0x25')]=function(_0x40a4bd,_0x5b09d0){var _0x2b0a36={},_0xa39b64={},_0x1e0b47={'count':0x0,'rows':[]};var _0x4112ba=_[_0xe762('0x26')](db[_0xe762('0x27')][_0xe762('0x28')],function(_0x3c8dcd){return{'name':_0x3c8dcd[_0xe762('0x29')],'type':_0x3c8dcd[_0xe762('0x2a')]['key']};});_0xa39b64[_0xe762('0x2b')]=_[_0xe762('0x26')](_0x4112ba,_0xe762('0x2c'));_0xa39b64[_0xe762('0x2d')]=_[_0xe762('0x2e')](_0x40a4bd[_0xe762('0x2d')]);_0xa39b64[_0xe762('0x2f')]=_[_0xe762('0x30')](_0xa39b64['model'],_0xa39b64['query']);_0x2b0a36[_0xe762('0x31')]=_[_0xe762('0x30')](_0xa39b64[_0xe762('0x2b')],qs[_0xe762('0x32')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x32')]));_0x2b0a36[_0xe762('0x31')]=_0x2b0a36['attributes'][_0xe762('0x33')]?_0x2b0a36[_0xe762('0x31')]:_0xa39b64[_0xe762('0x2b')];if(!_0x40a4bd['query'][_0xe762('0x34')](_0xe762('0x35'))){_0x2b0a36[_0xe762('0x36')]=qs[_0xe762('0x36')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x36')]);_0x2b0a36[_0xe762('0x1a')]=qs[_0xe762('0x1a')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x1a')]);}_0x2b0a36['order']=qs[_0xe762('0x37')](_0x40a4bd[_0xe762('0x2d')][_0xe762('0x37')]);_0x2b0a36[_0xe762('0x38')]=qs[_0xe762('0x2f')](_[_0xe762('0x39')](_0x40a4bd[_0xe762('0x2d')],_0xa39b64[_0xe762('0x2f')]),_0x4112ba);if(_0x40a4bd[_0xe762('0x2d')][_0xe762('0x3a')]){_0x2b0a36[_0xe762('0x38')]=_[_0xe762('0x3b')](_0x2b0a36[_0xe762('0x38')],{'$or':_[_0xe762('0x26')](_0x4112ba,function(_0xef4687){if(_0xef4687[_0xe762('0x2a')]!==_0xe762('0x3c')){var _0x4320b8={};_0x4320b8[_0xef4687[_0xe762('0x2c')]]={'$like':'%'+_0x40a4bd[_0xe762('0x2d')][_0xe762('0x3a')]+'%'};return _0x4320b8;}})});}_0x2b0a36=_['merge']({},_0x2b0a36,_0x40a4bd['options']);var _0x19cfb0={'where':_0x2b0a36[_0xe762('0x38')]};return db[_0xe762('0x27')][_0xe762('0x1c')](_0x19cfb0)[_0xe762('0x3d')](function(_0x2a5b71){_0x1e0b47[_0xe762('0x1c')]=_0x2a5b71;if(_0x40a4bd[_0xe762('0x2d')][_0xe762('0x3e')]){_0x2b0a36[_0xe762('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x2b0a36);})[_0xe762('0x3d')](function(_0x3cfe4e){_0x1e0b47['rows']=_0x3cfe4e;return _0x1e0b47;})[_0xe762('0x3d')](respondWithFilteredResult(_0x5b09d0,_0x2b0a36))[_0xe762('0x40')](handleError(_0x5b09d0,null));};exports[_0xe762('0x41')]=function(_0x3bc307,_0x4ff8c1){var _0x48caae={'raw':!![],'where':{'id':_0x3bc307[_0xe762('0x42')]['id']}},_0x2e8301={};_0x2e8301['model']=_[_0xe762('0x2e')](db[_0xe762('0x27')][_0xe762('0x28')]);_0x2e8301[_0xe762('0x2d')]=_[_0xe762('0x2e')](_0x3bc307[_0xe762('0x2d')]);_0x2e8301[_0xe762('0x2f')]=_[_0xe762('0x30')](_0x2e8301[_0xe762('0x2b')],_0x2e8301[_0xe762('0x2d')]);_0x48caae[_0xe762('0x31')]=_[_0xe762('0x30')](_0x2e8301[_0xe762('0x2b')],qs['fields'](_0x3bc307['query']['fields']));_0x48caae[_0xe762('0x31')]=_0x48caae[_0xe762('0x31')][_0xe762('0x33')]?_0x48caae[_0xe762('0x31')]:_0x2e8301[_0xe762('0x2b')];if(_0x3bc307['query']['includeAll']){_0x48caae[_0xe762('0x3f')]=[{'all':!![]}];}_0x48caae=_[_0xe762('0x3b')]({},_0x48caae,_0x3bc307['options']);return db[_0xe762('0x27')]['find'](_0x48caae)['then'](handleEntityNotFound(_0x4ff8c1,null))[_0xe762('0x3d')](respondWithResult(_0x4ff8c1,null))[_0xe762('0x40')](handleError(_0x4ff8c1,null));};exports['create']=function(_0x12e82c,_0x2b3b1d){return db[_0xe762('0x27')][_0xe762('0x43')](_0x12e82c['body'],{})[_0xe762('0x3d')](respondWithResult(_0x2b3b1d,0xc9))[_0xe762('0x40')](handleError(_0x2b3b1d,null));};exports['update']=function(_0x2eb2fb,_0x8be01b){if(_0x2eb2fb[_0xe762('0x44')]['id']){delete _0x2eb2fb[_0xe762('0x44')]['id'];}return db[_0xe762('0x27')][_0xe762('0x45')]({'where':{'id':_0x2eb2fb['params']['id']}})[_0xe762('0x3d')](handleEntityNotFound(_0x8be01b,null))[_0xe762('0x3d')](saveUpdates(_0x2eb2fb[_0xe762('0x44')],null))[_0xe762('0x3d')](respondWithResult(_0x8be01b,null))['catch'](handleError(_0x8be01b,null));};exports[_0xe762('0x21')]=function(_0x591845,_0x4c1b77){return db[_0xe762('0x27')][_0xe762('0x45')]({'where':{'id':_0x591845[_0xe762('0x42')]['id']}})[_0xe762('0x3d')](handleEntityNotFound(_0x4c1b77,null))[_0xe762('0x3d')](removeEntity(_0x4c1b77,null))[_0xe762('0x40')](handleError(_0x4c1b77,null));};exports[_0xe762('0x46')]=function(_0x459a0b,_0x43982b){return db[_0xe762('0x27')]['describe']()[_0xe762('0x3d')](respondWithResult(_0x43982b,null))[_0xe762('0x40')](handleError(_0x43982b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2e10d1b..2efa82e 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 _0xc7c4=['define','report_whatsapp_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports'];(function(_0x402902,_0x544732){var _0x2872e8=function(_0x4fadfd){while(--_0x4fadfd){_0x402902['push'](_0x402902['shift']());}};_0x2872e8(++_0x544732);}(_0xc7c4,0x183));var _0x4c7c=function(_0x39b6c5,_0xf7a2a3){_0x39b6c5=_0x39b6c5-0x0;var _0x452c8a=_0xc7c4[_0x39b6c5];return _0x452c8a;};'use strict';var _=require('lodash');var util=require(_0x4c7c('0x0'));var logger=require('../../config/logger')(_0x4c7c('0x1'));var moment=require(_0x4c7c('0x2'));var BPromise=require(_0x4c7c('0x3'));var rp=require(_0x4c7c('0x4'));var fs=require('fs');var path=require(_0x4c7c('0x5'));var rimraf=require('rimraf');var config=require(_0x4c7c('0x6'));var attributes=require(_0x4c7c('0x7'));module[_0x4c7c('0x8')]=function(_0x50d70b,_0x29149a){return _0x50d70b[_0x4c7c('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x4c7c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4c7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0728=['report_whatsapp_transfer','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x246cfa,_0x255d18){var _0x52cd7a=function(_0x4fe3ab){while(--_0x4fe3ab){_0x246cfa['push'](_0x246cfa['shift']());}};_0x52cd7a(++_0x255d18);}(_0x0728,0x92));var _0x8072=function(_0x648e67,_0xde90b9){_0x648e67=_0x648e67-0x0;var _0x1d7a29=_0x0728[_0x648e67];return _0x1d7a29;};'use strict';var _=require(_0x8072('0x0'));var util=require(_0x8072('0x1'));var logger=require('../../config/logger')(_0x8072('0x2'));var moment=require(_0x8072('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8072('0x4'));var rimraf=require(_0x8072('0x5'));var config=require(_0x8072('0x6'));var attributes=require(_0x8072('0x7'));module[_0x8072('0x8')]=function(_0x511df8,_0x393139){return _0x511df8[_0x8072('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x8072('0xa'),'paranoid':![],'indexes':[{'name':_0x8072('0xb'),'fields':[_0x8072('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 913ef0e..d29fdf6 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 _0x6a2f=['code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xb168ac,_0x356a23){var _0x21228f=function(_0x46dde0){while(--_0x46dde0){_0xb168ac['push'](_0xb168ac['shift']());}};_0x21228f(++_0x356a23);}(_0x6a2f,0xc1));var _0xf6a2=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x6a2f[_0x334651];return _0x29657c;};'use strict';var _=require('lodash');var util=require(_0xf6a2('0x0'));var moment=require(_0xf6a2('0x1'));var BPromise=require(_0xf6a2('0x2'));var rs=require(_0xf6a2('0x3'));var fs=require('fs');var Redis=require(_0xf6a2('0x4'));var db=require(_0xf6a2('0x5'))['db'];var utils=require(_0xf6a2('0x6'));var logger=require(_0xf6a2('0x7'))('rpc');var config=require(_0xf6a2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c1a61,_0x343177,_0x2d3cc0){return new BPromise(function(_0x557960,_0x5b80ab){return client['request'](_0x2c1a61,_0x2d3cc0)[_0xf6a2('0xa')](function(_0x3bc425){logger['info'](_0xf6a2('0xb'),_0x343177,_0xf6a2('0xc'));logger[_0xf6a2('0xd')](_0xf6a2('0xe'),_0x343177,_0xf6a2('0xc'),JSON[_0xf6a2('0xf')](_0x3bc425));if(_0x3bc425['error']){if(_0x3bc425[_0xf6a2('0x10')][_0xf6a2('0x11')]===0x1f4){logger[_0xf6a2('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x343177,_0x3bc425[_0xf6a2('0x10')][_0xf6a2('0x12')]);return _0x5b80ab(_0x3bc425[_0xf6a2('0x10')][_0xf6a2('0x12')]);}logger[_0xf6a2('0x10')](_0xf6a2('0xb'),_0x343177,_0x3bc425[_0xf6a2('0x10')][_0xf6a2('0x12')]);return _0x557960(_0x3bc425[_0xf6a2('0x10')][_0xf6a2('0x12')]);}else{logger[_0xf6a2('0x13')](_0xf6a2('0xb'),_0x343177,_0xf6a2('0xc'));_0x557960(_0x3bc425['result'][_0xf6a2('0x12')]);}})[_0xf6a2('0x14')](function(_0x181641){logger[_0xf6a2('0x10')](_0xf6a2('0xb'),_0x343177,_0x181641);_0x5b80ab(_0x181641);});});} \ No newline at end of file +var _0x3b4d=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','util','ioredis'];(function(_0x4787ce,_0x3f2423){var _0x19432e=function(_0x1a0ce8){while(--_0x1a0ce8){_0x4787ce['push'](_0x4787ce['shift']());}};_0x19432e(++_0x3f2423);}(_0x3b4d,0x167));var _0xd3b4=function(_0x4c8818,_0x117db7){_0x4c8818=_0x4c8818-0x0;var _0x46f3f7=_0x3b4d[_0x4c8818];return _0x46f3f7;};'use strict';var _=require('lodash');var util=require(_0xd3b4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3b4('0x1'));var db=require(_0xd3b4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3b4('0x3'))(_0xd3b4('0x4'));var config=require(_0xd3b4('0x5'));var jayson=require(_0xd3b4('0x6'));var client=jayson[_0xd3b4('0x7')][_0xd3b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20c26d,_0x399e22,_0x37738c){return new BPromise(function(_0x2b91cc,_0x1c759b){return client[_0xd3b4('0x9')](_0x20c26d,_0x37738c)[_0xd3b4('0xa')](function(_0x25f69d){logger[_0xd3b4('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x399e22,'request\x20sent');logger['debug'](_0xd3b4('0xc'),_0x399e22,_0xd3b4('0xd'),JSON[_0xd3b4('0xe')](_0x25f69d));if(_0x25f69d[_0xd3b4('0xf')]){if(_0x25f69d[_0xd3b4('0xf')]['code']===0x1f4){logger[_0xd3b4('0xf')](_0xd3b4('0x10'),_0x399e22,_0x25f69d[_0xd3b4('0xf')][_0xd3b4('0x11')]);return _0x1c759b(_0x25f69d['error'][_0xd3b4('0x11')]);}logger[_0xd3b4('0xf')](_0xd3b4('0x10'),_0x399e22,_0x25f69d[_0xd3b4('0xf')][_0xd3b4('0x11')]);return _0x2b91cc(_0x25f69d[_0xd3b4('0xf')][_0xd3b4('0x11')]);}else{logger['info'](_0xd3b4('0x10'),_0x399e22,_0xd3b4('0xd'));_0x2b91cc(_0x25f69d[_0xd3b4('0x12')]['message']);}})['catch'](function(_0x589fe3){logger['error'](_0xd3b4('0x10'),_0x399e22,_0x589fe3);_0x1c759b(_0x589fe3);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 85c4835..cc1d218 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27c9=['error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!'];(function(_0x56decc,_0x59d2db){var _0x4dc39f=function(_0x5c9952){while(--_0x5c9952){_0x56decc['push'](_0x56decc['shift']());}};_0x4dc39f(++_0x59d2db);}(_0x27c9,0x1af));var _0x927c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x27c9[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x927c('0x0'));var db=require(_0x927c('0x1'))['db'];var seedDb=require(_0x927c('0x2'));var checkLicense=require(_0x927c('0x3'));var rpc=require('./rpc');var config=require(_0x927c('0x4'));var logger=require(_0x927c('0x5'))('app');var pm2=require(_0x927c('0x6'));var pm2Config=require(_0x927c('0x7'));var schedule=require(_0x927c('0x8'));var chat=require(_0x927c('0x9'));var whatsapp=require(_0x927c('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x927c('0xb'));function main(){return db[_0x927c('0xc')][_0x927c('0xd')]()['then'](function(){if(config[_0x927c('0xe')]){return seedDb[_0x927c('0xf')]();}})[_0x927c('0x10')](function(){return checkLicense['default']();})[_0x927c('0x10')](function(){return rpc[_0x927c('0x11')]();})[_0x927c('0x10')](function(_0x106abe){logger[_0x927c('0x12')](_0x106abe);return chat[_0x927c('0x13')]();})[_0x927c('0x10')](function(){return whatsapp[_0x927c('0x13')]();})['then'](function(){return schedule['start']();})[_0x927c('0x10')](function(){return transcribe[_0x927c('0x13')]();})[_0x927c('0x10')](function(){return provider[_0x927c('0x13')]();})['then'](function(_0x175494){logger['info'](_0x175494);return pm2['start'](pm2Config);})[_0x927c('0x10')](function(_0x5c8549){var _0x3751a2=_0x5c8549[_0x927c('0x14')](function(_0x41a09b){return typeof _0x41a09b[_0x927c('0x15')]===_0x927c('0x16')&&_0x41a09b[_0x927c('0x15')]>=0x0;});if(_0x3751a2[_0x927c('0x17')]>0x0){throw new Error(_0x3751a2[_0x927c('0x17')]+_0x927c('0x18')+_[_0x927c('0x19')](_0x3751a2,function(_0x5cde06){return'\x22'+_0x5cde06[_0x927c('0x1a')][_0x927c('0x1b')]+'\x22';}));}logger['info'](_0x927c('0x1c'),_[_0x927c('0x19')](_['filter'](_0x5c8549,{'status':_0x927c('0x1d')}),_0x927c('0x1b'))[_0x927c('0x1e')]());logger[_0x927c('0x12')](_0x927c('0x1f'),_['map'](_['filter'](_0x5c8549,function(_0x4a4c72){return _0x4a4c72[_0x927c('0x20')]!==_0x927c('0x1d');}),_0x927c('0x1b'))[_0x927c('0x1e')]()||_0x927c('0x21'));console[_0x927c('0x22')]('App\x20Ready!');})[_0x927c('0x23')](function(_0x2a74e1){console[_0x927c('0x22')](_0x927c('0x24'),_0x2a74e1);logger[_0x927c('0x25')](_0x927c('0x26'),_0x2a74e1);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x0c42=['join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','seedDB','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online'];(function(_0x581c56,_0x909300){var _0x3f459e=function(_0x378421){while(--_0x378421){_0x581c56['push'](_0x581c56['shift']());}};_0x3f459e(++_0x909300);}(_0x0c42,0x191));var _0x20c4=function(_0x2a53f8,_0x7e69cf){_0x2a53f8=_0x2a53f8-0x0;var _0x22a361=_0x0c42[_0x2a53f8];return _0x22a361;};'use strict';var _=require(_0x20c4('0x0'));var db=require(_0x20c4('0x1'))['db'];var seedDb=require(_0x20c4('0x2'));var checkLicense=require(_0x20c4('0x3'));var rpc=require(_0x20c4('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x20c4('0x5'));var pm2=require(_0x20c4('0x6'));var pm2Config=require(_0x20c4('0x7'));var schedule=require(_0x20c4('0x8'));var chat=require(_0x20c4('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x20c4('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x20c4('0xb')]['sync']()[_0x20c4('0xc')](function(){if(config[_0x20c4('0xd')]){return seedDb[_0x20c4('0xe')]();}})['then'](function(){return checkLicense[_0x20c4('0xe')]();})[_0x20c4('0xc')](function(){return rpc[_0x20c4('0xf')]();})[_0x20c4('0xc')](function(_0xdc42c3){logger[_0x20c4('0x10')](_0xdc42c3);return chat[_0x20c4('0x11')]();})[_0x20c4('0xc')](function(){return whatsapp[_0x20c4('0x11')]();})[_0x20c4('0xc')](function(){return schedule[_0x20c4('0x11')]();})[_0x20c4('0xc')](function(){return transcribe[_0x20c4('0x11')]();})['then'](function(){return provider[_0x20c4('0x11')]();})['then'](function(_0x34eaf2){logger[_0x20c4('0x10')](_0x34eaf2);return pm2['start'](pm2Config);})[_0x20c4('0xc')](function(_0x4c6dae){var _0x13213d=_0x4c6dae[_0x20c4('0x12')](function(_0x30831a){return typeof _0x30831a['exitCode']===_0x20c4('0x13')&&_0x30831a[_0x20c4('0x14')]>=0x0;});if(_0x13213d[_0x20c4('0x15')]>0x0){throw new Error(_0x13213d[_0x20c4('0x15')]+_0x20c4('0x16')+_[_0x20c4('0x17')](_0x13213d,function(_0x2f79a0){return'\x22'+_0x2f79a0[_0x20c4('0x18')][_0x20c4('0x19')]+'\x22';}));}logger[_0x20c4('0x10')](_0x20c4('0x1a'),_['map'](_['filter'](_0x4c6dae,{'status':_0x20c4('0x1b')}),'name')[_0x20c4('0x1c')]());logger[_0x20c4('0x10')](_0x20c4('0x1d'),_[_0x20c4('0x17')](_[_0x20c4('0x12')](_0x4c6dae,function(_0x47071e){return _0x47071e[_0x20c4('0x1e')]!==_0x20c4('0x1b');}),_0x20c4('0x19'))[_0x20c4('0x1c')]()||_0x20c4('0x1f'));console[_0x20c4('0x20')](_0x20c4('0x21'));})[_0x20c4('0x22')](function(_0x498d4){console[_0x20c4('0x20')](_0x20c4('0x23'),_0x498d4);logger[_0x20c4('0x24')](_0x20c4('0x25'),_0x498d4);process[_0x20c4('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 39384cb..e49d297 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 _0x1928=['updatePasswordsHistory','length','splice','encryptString','join','promisify','secret','payload','options','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','then','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','motion.token','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x1928,0x183));var _0x8192=function(_0x4d1eb6,_0x38245b){_0x4d1eb6=_0x4d1eb6-0x0;var _0x5a836e=_0x1928[_0x4d1eb6];return _0x5a836e;};'use strict';var db=require(_0x8192('0x0'))['db'];var config=require(_0x8192('0x1'));var hardwareConf=require(_0x8192('0x2'));var licenseUtil=require(_0x8192('0x3'));var encryptor=require(_0x8192('0x4'));var _=require(_0x8192('0x5'));var jwt=require(_0x8192('0x6'));var expressJwt=require(_0x8192('0x7'));var compose=require(_0x8192('0x8'));var basicAuth=require(_0x8192('0x9'));var crypto=require(_0x8192('0xa'));var BPromise=require(_0x8192('0xb'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x8192('0xc')][_0x8192('0xd')]});var userAttributes=['id',_0x8192('0xe'),_0x8192('0xf'),_0x8192('0x10'),'internal','email',_0x8192('0x11'),_0x8192('0x12'),_0x8192('0x13'),_0x8192('0x14'),_0x8192('0x15'),_0x8192('0x16'),_0x8192('0x17'),_0x8192('0x18'),_0x8192('0x19'),_0x8192('0x1a'),_0x8192('0x1b'),'lastLoginAt',_0x8192('0x1c'),_0x8192('0x1d'),_0x8192('0x1e'),_0x8192('0x1f'),_0x8192('0x20'),_0x8192('0x21'),_0x8192('0x22'),_0x8192('0x23'),_0x8192('0x24'),_0x8192('0x25'),_0x8192('0x26'),_0x8192('0x27'),_0x8192('0x28'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0x8192('0x29'),_0x8192('0x2a'),_0x8192('0x2b'),'settingsEnabled',_0x8192('0x2c'),_0x8192('0x2d'),'downloadOmnichannelInteractions',_0x8192('0x2e'),_0x8192('0x2f'),_0x8192('0x30')];exports[_0x8192('0x31')]=function(){return this[_0x8192('0x32')](!![])[_0x8192('0x33')](function(_0x3f06f2,_0x2bad93,_0x2ea123){if(_0x3f06f2[_0x8192('0x34')]){_0x2ea123();}else{return db[_0x8192('0x35')][_0x8192('0x36')]({'where':{'id':_0x3f06f2[_0x8192('0x37')]['id']},'attributes':['id',_0x8192('0x38'),'disposition'],'raw':!![]})['then'](function(_0x890a85){if(_0x890a85&&_0x890a85[_0x8192('0x38')]){return _0x2bad93[_0x8192('0x39')](_0x890a85['disposition']===_0x8192('0x3a')?0x195:0x193)[_0x8192('0x3b')]({'message':_0x890a85['disposition']===_0x8192('0x3a')?_0x8192('0x3c'):_0x8192('0x3d')});}else{_0x2ea123();}})[_0x8192('0x3e')](function(_0x53ad03){_0x2ea123(_0x53ad03);});}});};exports[_0x8192('0x32')]=function isAuthenticated(_0x1e577e){return compose()['use'](function(_0x544196,_0x1d485a,_0x62bb38){var _0x5724c9;if(_0x544196[_0x8192('0x3f')][_0x8192('0x40')]){if(_[_0x8192('0x41')](_0x544196[_0x8192('0x3f')]['authorization'],_0x8192('0x42'))){var _0x2e31a5=basicAuth(_0x544196);db[_0x8192('0x43')][_0x8192('0x44')]({'where':{'name':_0x2e31a5[_0x8192('0x10')]}})['then'](function(_0x53d7df){if(!_0x53d7df||!_0x53d7df[_0x8192('0x45')](_0x2e31a5['pass'])){return _0x1d485a[_0x8192('0x39')](0x191)[_0x8192('0x3b')]({'message':'Wrong\x20credentials.'});}_0x544196[_0x8192('0x34')]={'id':_0x53d7df['id']};_0x62bb38();})[_0x8192('0x3e')](function(_0x19c607){_0x62bb38(_0x19c607);});}else if(_[_0x8192('0x41')](_0x544196[_0x8192('0x3f')][_0x8192('0x40')],_0x8192('0x46'))){validateJwt(_0x544196,_0x1d485a,_0x62bb38);}else{if(_0x1e577e){_0x62bb38();}else{return _0x1d485a['status'](0x193)[_0x8192('0x3b')]({'message':_0x8192('0x47')});}}}else if(_0x544196['query'][_0x8192('0x48')]){try{var _0x214fb8={'audience':hardwareConf[_0x8192('0x49')](),'issuer':hardwareConf[_0x8192('0x49')]()};verifyJwt(_0x544196[_0x8192('0x4a')][_0x8192('0x48')],_0x214fb8)[_0x8192('0x4b')](function(_0x245f6c){return db[_0x8192('0x43')][_0x8192('0x44')]({'where':{'id':_0x245f6c['sub']}})['then'](function(_0x38fd67){_0x5724c9=_0x38fd67;return db[_0x8192('0x4c')][_0x8192('0x36')]({'where':{'id':0x1},'attributes':[_0x8192('0x4d'),_0x8192('0x4e')],'raw':!![]});})[_0x8192('0x4b')](function(_0x59fc78){if(!_0x5724c9||!_[_0x8192('0x4f')](_0x5724c9['apiKeyNonce'],_0x245f6c[_0x8192('0x50')])){return _0x1d485a[_0x8192('0x39')](0x191)[_0x8192('0x3b')]({'message':_0x8192('0x51')});}if(_0x5724c9[_0x8192('0x52')]){return _0x1d485a[_0x8192('0x39')](0x191)[_0x8192('0x3b')]({'message':_0x8192('0x53')});}if(_0x5724c9[_0x8192('0x54')]){if(_0x59fc78[_0x8192('0x4e')]>0x0){if(moment(_0x5724c9[_0x8192('0x55')])[_0x8192('0x56')](_0x59fc78['blockDuration'],_0x8192('0x57'))>moment()){return _0x1d485a[_0x8192('0x39')](0x191)[_0x8192('0x3b')]({'message':_0x8192('0x53')});}}else{return _0x1d485a[_0x8192('0x39')](0x191)['json']({'message':_0x8192('0x53')});}}_0x544196[_0x8192('0x34')]={'id':_0x5724c9['id']};_0x62bb38();});})[_0x8192('0x3e')](function(){return _0x1d485a[_0x8192('0x39')](0x191)[_0x8192('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x28283b){_0x62bb38(_0x28283b);}}else if(_0x1e577e){_0x62bb38();}else{return _0x1d485a[_0x8192('0x39')](0x193)['json']({'message':_0x8192('0x47')});}})['use'](function(_0x5e6bd2,_0x301adb,_0x23f6a6){if(_0x5e6bd2[_0x8192('0x34')]){db[_0x8192('0x43')]['find']({'where':{'id':_0x5e6bd2['user']['id']},'attributes':userAttributes})[_0x8192('0x4b')](function(_0x1f377b){if(!_0x1f377b){return _0x301adb[_0x8192('0x39')](0x194)['json']({'message':_0x8192('0x58')});}_0x5e6bd2['user']=_0x1f377b;_0x23f6a6();})[_0x8192('0x3e')](function(_0x3ef36e){_0x23f6a6(_0x3ef36e);});}else if(_0x1e577e){_0x23f6a6();}else{return _0x301adb[_0x8192('0x39')](0x194)[_0x8192('0x3b')]({'message':_0x8192('0x59')});}});};exports[_0x8192('0x5a')]=function canUpdate(){return compose()[_0x8192('0x33')](function(_0x532559,_0x4c674b,_0xde0b68){return licenseUtil[_0x8192('0x5b')]()[_0x8192('0x4b')](function(_0x3403e9){if(_0x3403e9[_0x8192('0x5c')]){_0xde0b68();}else{return _0x4c674b[_0x8192('0x39')](0x193)[_0x8192('0x3b')]({'message':_0x8192('0x5d')});}})['catch'](function(_0x6d10db){_0xde0b68(_0x6d10db);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x8192('0x33')](function(_0x4af99b,_0x494628,_0x227d3e){return licenseUtil[_0x8192('0x5b')]()['then'](function(_0x15a069){if(_0x15a069[_0x8192('0x5e')]){_0x227d3e();}else{return _0x494628[_0x8192('0x39')](0x193)['json']({'message':_0x8192('0x5d')});}})[_0x8192('0x3e')](function(_0x50bfbe){_0x227d3e(_0x50bfbe);});});};exports[_0x8192('0x5f')]=function(_0x3e76e3,_0x2c1cc5,_0x1da0f1){_0x3e76e3[_0x8192('0x5f')]=!![];return _0x1da0f1();};exports[_0x8192('0x60')]=function signToken(_0x40084a){return signJwt(_0x40084a);};exports[_0x8192('0x61')]=function(_0x2a1a4e,_0x5b23c4){if(!_0x2a1a4e[_0x8192('0x34')]){return _0x5b23c4[_0x8192('0x39')](0x194)[_0x8192('0x3b')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1bb5c4={'payload':{'id':_0x2a1a4e[_0x8192('0x34')]['id'],'role':_0x2a1a4e[_0x8192('0x34')][_0x8192('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1bb5c4)[_0x8192('0x4b')](function(_0xbd7d65){_0x5b23c4['cookie'](_0x8192('0x62'),_0xbd7d65);_0x5b23c4['redirect']('/dashboards/general');})[_0x8192('0x3e')](function(_0x1a40c4){return _0x5b23c4[_0x8192('0x39')](0x1f4)['send'](_0x1a40c4);});};exports[_0x8192('0x63')]=function(_0x569ea4){if(_[_0x8192('0x64')](_0x569ea4[_0x8192('0x65')])||_[_0x8192('0x64')](_0x569ea4[_0x8192('0x66')])){return null;}else{return createJwt(_0x569ea4);}};exports[_0x8192('0x67')]=function(_0x4fb949){_0x4fb949[_0x8192('0x65')]=generateNonce();_0x4fb949['apiKeyIat']=generateIssuedAt();return createJwt(_0x4fb949);};exports[_0x8192('0x68')]=function(_0x3b7dc9,_0x2107dd){var _0x496661=_0x3b7dc9[_0x8192('0x4a')][_0x8192('0x48')];if(_0x496661){var _0x4c971b={'nonce':_0x2107dd['apiKeyNonce'],'iat':_0x2107dd[_0x8192('0x66')],'audience':hardwareConf[_0x8192('0x49')](),'issuer':hardwareConf[_0x8192('0x49')]()};return verifyJwt(_0x496661,_0x4c971b)[_0x8192('0x4b')](function(){return generateApiKey(_0x2107dd);});}else{throw{'message':_0x8192('0x69')};}};exports[_0x8192('0x6a')]=function(_0x28a125){var _0x168d2f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x168d2f['test'](_0x28a125))throw new db['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~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x3d5214,_0x5ea2c1,_0x1f42cd){var _0x3e6a75=encryptor[_0x8192('0x6b')](_0x5ea2c1)[_0x8192('0x6c')](',');for(var _0x224849=0x0;_0x224849<_0x1f42cd;_0x224849++){if(!_0x3e6a75[_0x224849])break;if(_0x3d5214[_0x8192('0x6d')]()===_0x3e6a75[_0x224849]['toLowerCase']()){var _0x3fcf4e=util['format'](_0x8192('0x6e'),_0x1f42cd);if(_0x1f42cd===0x1){_0x3fcf4e='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x8192('0x6f'))][(_0x8192('0x70'))](_0x3fcf4e);}}return;};exports[_0x8192('0x71')]=function(_0x5c004d,_0x40d850){var _0x552860=_0x40d850?encryptor[_0x8192('0x6b')](_0x40d850)[_0x8192('0x6c')](','):[];if(_0x552860[_0x8192('0x72')]===0x5){_0x552860[_0x8192('0x73')](-0x1,0x1);}_0x552860['unshift'](_0x5c004d);return encryptor[_0x8192('0x74')](_0x552860[_0x8192('0x75')](','));};function signJwt(_0x2e69a3){var _0x4ebf60=BPromise[_0x8192('0x76')](jwt['sign'],{'context':jwt});var _0x3bba88=_0x2e69a3[_0x8192('0x77')]||config['secrets'][_0x8192('0xd')];return new BPromise(function(_0x13ca97,_0x42e7b1){_0x4ebf60(_0x2e69a3[_0x8192('0x78')],_0x3bba88,_0x2e69a3[_0x8192('0x79')])[_0x8192('0x4b')](function(_0x297773){_0x13ca97(_0x297773);})[_0x8192('0x3e')](function(_0x1c3d26){_0x42e7b1(_0x1c3d26);});});}function verifyJwt(_0x22823c,_0x4fcc7c,_0x4a2562){var _0x7732fe=BPromise[_0x8192('0x76')](jwt['verify'],{'context':jwt});var _0x109dfc=_0x4a2562||config[_0x8192('0xc')][_0x8192('0xd')];return new BPromise(function(_0x31006b,_0xffe063){_0x7732fe(_0x22823c,_0x109dfc,_0x4fcc7c)[_0x8192('0x4b')](function(_0x5a848d){_0x31006b(_0x5a848d);})['catch'](function(_0x192e81){_0xffe063(_0x192e81);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x8192('0x7a')](_0x8192('0x7b'));}function generateIssuedAt(){return Math['floor'](Date[_0x8192('0x7c')]()/0x3e8)['toString']();}function createJwt(_0xb3c7a2){var _0x578442={'payload':{'iat':_0xb3c7a2[_0x8192('0x66')],'nonce':_0xb3c7a2[_0x8192('0x65')]},'options':{'algorithm':'HS512','subject':_0xb3c7a2['id'][_0x8192('0x7a')](),'issuer':hardwareConf[_0x8192('0x49')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x578442)[_0x8192('0x4b')](function(_0x23afa2){return{'iat':_0xb3c7a2[_0x8192('0x66')],'nonce':_0xb3c7a2[_0x8192('0x65')],'token':_0x23afa2};});} \ No newline at end of file +var _0x8010=['unshift','promisify','sign','secret','secrets','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','moment','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','isAuthenticated','use','user','ChatInteraction','findOne','disposition','then','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','pass','Bearer','query','apikey','getUuid','find','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','User\x20not\x20found.','User\x20object\x20not\x20found.','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','generateApiKey','apiKeyIat','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','length'];(function(_0x179435,_0x82f778){var _0x26d155=function(_0x18c57a){while(--_0x18c57a){_0x179435['push'](_0x179435['shift']());}};_0x26d155(++_0x82f778);}(_0x8010,0x104));var _0x0801=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8010[_0x3dd15e];return _0x231fd0;};'use strict';var db=require(_0x0801('0x0'))['db'];var config=require(_0x0801('0x1'));var hardwareConf=require(_0x0801('0x2'));var licenseUtil=require(_0x0801('0x3'));var encryptor=require('../encryptor');var _=require(_0x0801('0x4'));var jwt=require(_0x0801('0x5'));var expressJwt=require(_0x0801('0x6'));var compose=require(_0x0801('0x7'));var basicAuth=require(_0x0801('0x8'));var crypto=require('crypto');var BPromise=require(_0x0801('0x9'));var util=require('util');var moment=require(_0x0801('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0x0801('0xb')]});var userAttributes=['id',_0x0801('0xc'),_0x0801('0xd'),_0x0801('0xe'),'internal',_0x0801('0xf'),_0x0801('0x10'),_0x0801('0x11'),_0x0801('0x12'),_0x0801('0x13'),_0x0801('0x14'),_0x0801('0x15'),_0x0801('0x16'),'smsPause',_0x0801('0x17'),_0x0801('0x18'),_0x0801('0x19'),_0x0801('0x1a'),'lastPauseAt',_0x0801('0x1b'),'allowmessenger','passwordResetAt',_0x0801('0x1c'),_0x0801('0x1d'),'phoneBarAutoAnswerDelay',_0x0801('0x1e'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x0801('0x1f'),_0x0801('0x20'),_0x0801('0x21'),_0x0801('0x22'),_0x0801('0x23'),'hotdesk',_0x0801('0x24'),_0x0801('0x25'),_0x0801('0x26'),_0x0801('0x27'),'wssPort',_0x0801('0x28'),_0x0801('0x29'),'downloadAttachments',_0x0801('0x2a'),_0x0801('0x2b')];exports['isChatInteractionAuthorized']=function(){return this[_0x0801('0x2c')](!![])[_0x0801('0x2d')](function(_0x185760,_0x4d754a,_0x3d6644){if(_0x185760[_0x0801('0x2e')]){_0x3d6644();}else{return db[_0x0801('0x2f')][_0x0801('0x30')]({'where':{'id':_0x185760['params']['id']},'attributes':['id','closed',_0x0801('0x31')],'raw':!![]})[_0x0801('0x32')](function(_0x45130b){if(_0x45130b&&_0x45130b[_0x0801('0x33')]){return _0x4d754a[_0x0801('0x34')](_0x45130b[_0x0801('0x31')]===_0x0801('0x35')?0x195:0x193)[_0x0801('0x36')]({'message':_0x45130b[_0x0801('0x31')]===_0x0801('0x35')?_0x0801('0x37'):_0x0801('0x38')});}else{_0x3d6644();}})[_0x0801('0x39')](function(_0x410c84){_0x3d6644(_0x410c84);});}});};exports['isAuthenticated']=function isAuthenticated(_0x21ce2a){return compose()[_0x0801('0x2d')](function(_0x4223a9,_0x505779,_0x1e8cad){var _0x1df523;if(_0x4223a9[_0x0801('0x3a')][_0x0801('0x3b')]){if(_[_0x0801('0x3c')](_0x4223a9[_0x0801('0x3a')][_0x0801('0x3b')],_0x0801('0x3d'))){var _0x6e7ba4=basicAuth(_0x4223a9);db[_0x0801('0x3e')]['find']({'where':{'name':_0x6e7ba4['name']}})[_0x0801('0x32')](function(_0x3bcbaf){if(!_0x3bcbaf||!_0x3bcbaf[_0x0801('0x3f')](_0x6e7ba4[_0x0801('0x40')])){return _0x505779[_0x0801('0x34')](0x191)[_0x0801('0x36')]({'message':'Wrong\x20credentials.'});}_0x4223a9[_0x0801('0x2e')]={'id':_0x3bcbaf['id']};_0x1e8cad();})[_0x0801('0x39')](function(_0x2a3c26){_0x1e8cad(_0x2a3c26);});}else if(_[_0x0801('0x3c')](_0x4223a9[_0x0801('0x3a')][_0x0801('0x3b')],_0x0801('0x41'))){validateJwt(_0x4223a9,_0x505779,_0x1e8cad);}else{if(_0x21ce2a){_0x1e8cad();}else{return _0x505779[_0x0801('0x34')](0x193)[_0x0801('0x36')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4223a9[_0x0801('0x42')][_0x0801('0x43')]){try{var _0x5e7ea5={'audience':hardwareConf[_0x0801('0x44')](),'issuer':hardwareConf[_0x0801('0x44')]()};verifyJwt(_0x4223a9['query']['apikey'],_0x5e7ea5)[_0x0801('0x32')](function(_0x23d085){return db[_0x0801('0x3e')][_0x0801('0x45')]({'where':{'id':_0x23d085[_0x0801('0x46')]}})[_0x0801('0x32')](function(_0x54c5ae){_0x1df523=_0x54c5ae;return db[_0x0801('0x47')][_0x0801('0x30')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0801('0x48')],'raw':!![]});})[_0x0801('0x32')](function(_0x49b140){if(!_0x1df523||!_[_0x0801('0x49')](_0x1df523[_0x0801('0x4a')],_0x23d085[_0x0801('0x4b')])){return _0x505779[_0x0801('0x34')](0x191)[_0x0801('0x36')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1df523[_0x0801('0x4c')]){return _0x505779['status'](0x191)[_0x0801('0x36')]({'message':_0x0801('0x4d')});}if(_0x1df523[_0x0801('0x4e')]){if(_0x49b140[_0x0801('0x48')]>0x0){if(moment(_0x1df523[_0x0801('0x4f')])['add'](_0x49b140['blockDuration'],'minutes')>moment()){return _0x505779[_0x0801('0x34')](0x191)[_0x0801('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x505779[_0x0801('0x34')](0x191)[_0x0801('0x36')]({'message':_0x0801('0x4d')});}}_0x4223a9[_0x0801('0x2e')]={'id':_0x1df523['id']};_0x1e8cad();});})['catch'](function(){return _0x505779[_0x0801('0x34')](0x191)[_0x0801('0x36')]({'message':_0x0801('0x4d')});});}catch(_0x5f03c7){_0x1e8cad(_0x5f03c7);}}else if(_0x21ce2a){_0x1e8cad();}else{return _0x505779[_0x0801('0x34')](0x193)[_0x0801('0x36')]({'message':'Unknown\x20authorization\x20format'});}})[_0x0801('0x2d')](function(_0x51c2a9,_0x182448,_0x1eb940){if(_0x51c2a9[_0x0801('0x2e')]){db[_0x0801('0x3e')][_0x0801('0x45')]({'where':{'id':_0x51c2a9[_0x0801('0x2e')]['id']},'attributes':userAttributes})['then'](function(_0x2fc478){if(!_0x2fc478){return _0x182448[_0x0801('0x34')](0x194)['json']({'message':_0x0801('0x50')});}_0x51c2a9['user']=_0x2fc478;_0x1eb940();})['catch'](function(_0x437e64){_0x1eb940(_0x437e64);});}else if(_0x21ce2a){_0x1eb940();}else{return _0x182448['status'](0x194)[_0x0801('0x36')]({'message':_0x0801('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x326be4,_0x3e512e,_0x52dd10){return licenseUtil['getLicense']()[_0x0801('0x32')](function(_0x10106b){if(_0x10106b['update']){_0x52dd10();}else{return _0x3e512e['status'](0x193)[_0x0801('0x36')]({'message':_0x0801('0x52')});}})[_0x0801('0x39')](function(_0x799af7){_0x52dd10(_0x799af7);});});};exports[_0x0801('0x53')]=function isWebrtcLicence(){return compose()[_0x0801('0x2d')](function(_0x53f7a6,_0x57d7f2,_0x4a88ca){return licenseUtil[_0x0801('0x54')]()[_0x0801('0x32')](function(_0x420914){if(_0x420914[_0x0801('0x55')]){_0x4a88ca();}else{return _0x57d7f2['status'](0x193)[_0x0801('0x36')]({'message':_0x0801('0x52')});}})[_0x0801('0x39')](function(_0x421e3c){_0x4a88ca(_0x421e3c);});});};exports[_0x0801('0x56')]=function(_0x7e872b,_0x51170f,_0x15780a){_0x7e872b[_0x0801('0x56')]=!![];return _0x15780a();};exports[_0x0801('0x57')]=function signToken(_0x1f3b6b){return signJwt(_0x1f3b6b);};exports[_0x0801('0x58')]=function(_0x402fcf,_0x28e79b){if(!_0x402fcf[_0x0801('0x2e')]){return _0x28e79b[_0x0801('0x34')](0x194)['json']({'message':_0x0801('0x59')});}var _0x4fc7ad={'payload':{'id':_0x402fcf[_0x0801('0x2e')]['id'],'role':_0x402fcf['user'][_0x0801('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4fc7ad)[_0x0801('0x32')](function(_0x39bb89){_0x28e79b['cookie'](_0x0801('0x5a'),_0x39bb89);_0x28e79b[_0x0801('0x5b')](_0x0801('0x5c'));})[_0x0801('0x39')](function(_0x5a0ac5){return _0x28e79b[_0x0801('0x34')](0x1f4)[_0x0801('0x5d')](_0x5a0ac5);});};exports['retrieveApiKey']=function(_0x3a9543){if(_[_0x0801('0x5e')](_0x3a9543[_0x0801('0x4a')])||_[_0x0801('0x5e')](_0x3a9543['apiKeyIat'])){return null;}else{return createJwt(_0x3a9543);}};exports[_0x0801('0x5f')]=function(_0x5aa032){_0x5aa032['apiKeyNonce']=generateNonce();_0x5aa032['apiKeyIat']=generateIssuedAt();return createJwt(_0x5aa032);};exports['regenerateApiKey']=function(_0x226ce7,_0xdb607f){var _0x5506a6=_0x226ce7[_0x0801('0x42')]['apikey'];if(_0x5506a6){var _0x3b5068={'nonce':_0xdb607f['apiKeyNonce'],'iat':_0xdb607f[_0x0801('0x60')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0801('0x44')]()};return verifyJwt(_0x5506a6,_0x3b5068)[_0x0801('0x32')](function(){return generateApiKey(_0xdb607f);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x0801('0x61')]=function(_0x2256d0){var _0x4fefa8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4fefa8[_0x0801('0x62')](_0x2256d0))throw new db['Sequelize']['ValidationError'](_0x0801('0x63'));return;};exports[_0x0801('0x64')]=function(_0x375166,_0x1b4dbc,_0x2f4630){var _0x5db929=encryptor[_0x0801('0x65')](_0x1b4dbc)[_0x0801('0x66')](',');for(var _0x4c3962=0x0;_0x4c3962<_0x2f4630;_0x4c3962++){if(!_0x5db929[_0x4c3962])break;if(_0x375166['toLowerCase']()===_0x5db929[_0x4c3962]['toLowerCase']()){var _0x1f037a=util[_0x0801('0x67')](_0x0801('0x68'),_0x2f4630);if(_0x2f4630===0x1){_0x1f037a=_0x0801('0x69');}throw new db[(_0x0801('0x6a'))][(_0x0801('0x6b'))](_0x1f037a);}}return;};exports['updatePasswordsHistory']=function(_0x2425a0,_0x130571){var _0x211e1a=_0x130571?encryptor[_0x0801('0x65')](_0x130571)['split'](','):[];if(_0x211e1a[_0x0801('0x6c')]===0x5){_0x211e1a['splice'](-0x1,0x1);}_0x211e1a[_0x0801('0x6d')](_0x2425a0);return encryptor['encryptString'](_0x211e1a['join'](','));};function signJwt(_0x22ea29){var _0x1fe8b1=BPromise[_0x0801('0x6e')](jwt[_0x0801('0x6f')],{'context':jwt});var _0x302b2c=_0x22ea29[_0x0801('0x70')]||config[_0x0801('0x71')][_0x0801('0xb')];return new BPromise(function(_0x122c7f,_0x132db3){_0x1fe8b1(_0x22ea29[_0x0801('0x72')],_0x302b2c,_0x22ea29[_0x0801('0x73')])['then'](function(_0x5f92b9){_0x122c7f(_0x5f92b9);})[_0x0801('0x39')](function(_0x535e16){_0x132db3(_0x535e16);});});}function verifyJwt(_0x25b258,_0x44dddc,_0x49288d){var _0x102dfc=BPromise['promisify'](jwt[_0x0801('0x74')],{'context':jwt});var _0x37f76a=_0x49288d||config[_0x0801('0x71')][_0x0801('0xb')];return new BPromise(function(_0x5da218,_0x303f0a){_0x102dfc(_0x25b258,_0x37f76a,_0x44dddc)[_0x0801('0x32')](function(_0x24205c){_0x5da218(_0x24205c);})[_0x0801('0x39')](function(_0x20bdff){_0x303f0a(_0x20bdff);});});}function generateNonce(){return crypto[_0x0801('0x75')](0x10)[_0x0801('0x76')](_0x0801('0x77'));}function generateIssuedAt(){return Math[_0x0801('0x78')](Date[_0x0801('0x79')]()/0x3e8)['toString']();}function createJwt(_0x29791b){var _0x2444ee={'payload':{'iat':_0x29791b['apiKeyIat'],'nonce':_0x29791b[_0x0801('0x4a')]},'options':{'algorithm':_0x0801('0x7a'),'subject':_0x29791b['id'][_0x0801('0x76')](),'issuer':hardwareConf[_0x0801('0x44')](),'audience':hardwareConf[_0x0801('0x44')]()}};return signJwt(_0x2444ee)[_0x0801('0x32')](function(_0x571e6e){return{'iat':_0x29791b['apiKeyIat'],'nonce':_0x29791b[_0x0801('0x4a')],'token':_0x571e6e};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 7180fb6..6a3b7de 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 _0xe11d=['lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','filter','indexOf','hasOwnProperty','createWriteStream','binary','write','end','close','unlink','decryptFile','createReadStream','createDecipher','data','update','encryptString','secret','utf8','base64','final','decryptString','crypto','bluebird'];(function(_0x510fce,_0x245bd7){var _0x4db75e=function(_0x3278e4){while(--_0x3278e4){_0x510fce['push'](_0x510fce['shift']());}};_0x4db75e(++_0x245bd7);}(_0xe11d,0xa8));var _0xde11=function(_0x16938c,_0x579946){_0x16938c=_0x16938c-0x0;var _0x1e1cf1=_0xe11d[_0x16938c];return _0x1e1cf1;};'use strict';var crypto=require(_0xde11('0x0'));var fs=require('fs');var BPromise=require(_0xde11('0x1'));var _=require(_0xde11('0x2'));var config=require(_0xde11('0x3'));var logger=require(_0xde11('0x4'))(_0xde11('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xde11('0x6')],'algorithm':_0xde11('0x7')};const fileOptions={'algorithm':_0xde11('0x8')};if(config[_0xde11('0x9')]&&config['encrypt'][_0xde11('0xa')]){var isSupported=isAlgorithmSupported(config[_0xde11('0x9')][_0xde11('0xa')]);if(isSupported){fileOptions[_0xde11('0xa')]=config[_0xde11('0x9')][_0xde11('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xde11('0xb')](',\x20');logger[_0xde11('0xc')](config['encrypt'][_0xde11('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x58c127){return AES_SUPPORTED_RX[_0xde11('0xd')](_0x58c127);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xde11('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x3fd5eb){return getSupportedCiphers()[_0xde11('0xf')](_0x3fd5eb)>-0x1;}function combineOptions(_0x106934){var _0x57c47c={};for(var _0x1ab0f5 in fileOptions){if(fileOptions[_0xde11('0x10')](_0x1ab0f5)){_0x57c47c[_0x1ab0f5]=fileOptions[_0x1ab0f5];}}if(_0x106934){for(var _0x2dff83 in _0x106934){if(_0x106934['hasOwnProperty'](_0x2dff83)){_0x57c47c[_0x2dff83]=_0x106934[_0x2dff83];}}}return _0x57c47c;}exports['encryptFile']=function(_0x557ddc,_0xdbab68,_0x21748f,_0x6144b0){return new BPromise(function(_0x49578f,_0x21b8f2){_0x6144b0=combineOptions(_0x6144b0);var _0x5ce7ca=new Buffer(_0x21748f);var _0x53bcdb=fs['createReadStream'](_0x557ddc);var _0x445ab6=fs[_0xde11('0x11')](_0xdbab68);var _0x473239=crypto['createCipher'](_0x6144b0[_0xde11('0xa')],_0x5ce7ca);_0x53bcdb['on']('data',function(_0x23c07c){var _0x3da05c=new Buffer(_0x473239['update'](_0x23c07c),_0xde11('0x12'));_0x445ab6[_0xde11('0x13')](_0x3da05c);});_0x53bcdb['on'](_0xde11('0x14'),function(){try{var _0x409174=new Buffer(_0x473239['final'](_0xde11('0x12')),_0xde11('0x12'));_0x445ab6[_0xde11('0x13')](_0x409174);_0x445ab6[_0xde11('0x14')]();_0x445ab6['on'](_0xde11('0x15'),function(){return _0x49578f(_0xdbab68);});}catch(_0xda595){fs[_0xde11('0x16')](_0xdbab68);return _0x21b8f2(_0xda595);}});});};exports[_0xde11('0x17')]=function(_0x453ef0,_0xa0fea9,_0x251acf,_0x53098c){return new BPromise(function(_0x1ed01d,_0x4fb434){_0x53098c=combineOptions(_0x53098c);var _0x372ce4=new Buffer(_0x251acf);var _0x9038cb=fs[_0xde11('0x18')](_0x453ef0);var _0x4704bf=fs[_0xde11('0x11')](_0xa0fea9);var _0x5f06fa=crypto[_0xde11('0x19')](_0x53098c[_0xde11('0xa')],_0x372ce4);_0x9038cb['on'](_0xde11('0x1a'),function(_0x5533e0){var _0xfc4a72=new Buffer(_0x5f06fa[_0xde11('0x1b')](_0x5533e0),_0xde11('0x12'));_0x4704bf['write'](_0xfc4a72);});_0x9038cb['on'](_0xde11('0x14'),function(){try{var _0x195794=new Buffer(_0x5f06fa['final']('binary'),_0xde11('0x12'));_0x4704bf[_0xde11('0x13')](_0x195794);_0x4704bf[_0xde11('0x14')]();_0x4704bf['on'](_0xde11('0x15'),function(){return _0x1ed01d(_0xa0fea9);});}catch(_0x224ce7){fs[_0xde11('0x16')](_0xa0fea9);return _0x4fb434(_0x224ce7);}});});};exports[_0xde11('0x1c')]=function(_0x31198c,_0x57fc60,_0xff76fa){var _0xcbd8d0=_0xff76fa||stringOptions['algorithm'];var _0x4edf24=_0x57fc60||stringOptions[_0xde11('0x1d')];var _0x14bfe9=crypto['createCipher'](_0xcbd8d0,_0x4edf24);var _0x368a30=_0x14bfe9[_0xde11('0x1b')](_0x31198c,_0xde11('0x1e'),_0xde11('0x1f'));_0x368a30+=_0x14bfe9[_0xde11('0x20')](_0xde11('0x1f'));return _0x368a30;};exports[_0xde11('0x21')]=function(_0x56d9df,_0x286305,_0x279ac6){var _0x547cd2=_0x279ac6||stringOptions[_0xde11('0xa')];var _0x2b55e0=_0x286305||stringOptions[_0xde11('0x1d')];var _0x43b489=crypto[_0xde11('0x19')](_0x547cd2,_0x2b55e0);var _0x1ebf5a=_0x43b489[_0xde11('0x1b')](_0x56d9df,_0xde11('0x1f'),_0xde11('0x1e'));_0x1ebf5a+=_0x43b489[_0xde11('0x20')](_0xde11('0x1e'));return _0x1ebf5a;}; \ No newline at end of file +var _0x4b43=['session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','binary','write','end','final','close','decryptFile','createReadStream','createWriteStream','createDecipher','update','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets'];(function(_0x414751,_0x52f763){var _0x3d970f=function(_0x1a7ecd){while(--_0x1a7ecd){_0x414751['push'](_0x414751['shift']());}};_0x3d970f(++_0x52f763);}(_0x4b43,0xfc));var _0x34b4=function(_0x557f14,_0x10e40f){_0x557f14=_0x557f14-0x0;var _0x5e1077=_0x4b43[_0x557f14];return _0x5e1077;};'use strict';var crypto=require(_0x34b4('0x0'));var fs=require('fs');var BPromise=require(_0x34b4('0x1'));var _=require(_0x34b4('0x2'));var config=require(_0x34b4('0x3'));var logger=require(_0x34b4('0x4'))(_0x34b4('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x34b4('0x6')][_0x34b4('0x7')],'algorithm':_0x34b4('0x8')};const fileOptions={'algorithm':_0x34b4('0x9')};if(config[_0x34b4('0xa')]&&config[_0x34b4('0xa')][_0x34b4('0xb')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x34b4('0xb')]);if(isSupported){fileOptions[_0x34b4('0xb')]=config[_0x34b4('0xa')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x34b4('0xc')](config[_0x34b4('0xa')][_0x34b4('0xb')],_0x34b4('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x393239){return AES_SUPPORTED_RX[_0x34b4('0xe')](_0x393239);}function getSupportedCiphers(){return crypto[_0x34b4('0xf')]()[_0x34b4('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x540f5d){return getSupportedCiphers()[_0x34b4('0x11')](_0x540f5d)>-0x1;}function combineOptions(_0x4c9ecf){var _0x4131f3={};for(var _0x4e054d in fileOptions){if(fileOptions[_0x34b4('0x12')](_0x4e054d)){_0x4131f3[_0x4e054d]=fileOptions[_0x4e054d];}}if(_0x4c9ecf){for(var _0x46a43a in _0x4c9ecf){if(_0x4c9ecf[_0x34b4('0x12')](_0x46a43a)){_0x4131f3[_0x46a43a]=_0x4c9ecf[_0x46a43a];}}}return _0x4131f3;}exports[_0x34b4('0x13')]=function(_0x50aeae,_0x18cbce,_0x574508,_0x1ec894){return new BPromise(function(_0x3a8841,_0x27d1e7){_0x1ec894=combineOptions(_0x1ec894);var _0x163d36=new Buffer(_0x574508);var _0x80908a=fs['createReadStream'](_0x50aeae);var _0x350097=fs['createWriteStream'](_0x18cbce);var _0x336845=crypto[_0x34b4('0x14')](_0x1ec894[_0x34b4('0xb')],_0x163d36);_0x80908a['on'](_0x34b4('0x15'),function(_0x115731){var _0x1b7ca6=new Buffer(_0x336845['update'](_0x115731),_0x34b4('0x16'));_0x350097[_0x34b4('0x17')](_0x1b7ca6);});_0x80908a['on'](_0x34b4('0x18'),function(){try{var _0x449047=new Buffer(_0x336845[_0x34b4('0x19')]('binary'),_0x34b4('0x16'));_0x350097['write'](_0x449047);_0x350097[_0x34b4('0x18')]();_0x350097['on'](_0x34b4('0x1a'),function(){return _0x3a8841(_0x18cbce);});}catch(_0x3e908c){fs['unlink'](_0x18cbce);return _0x27d1e7(_0x3e908c);}});});};exports[_0x34b4('0x1b')]=function(_0xe0d598,_0x2ab951,_0x2101c2,_0x48d163){return new BPromise(function(_0xe8792f,_0x203b8a){_0x48d163=combineOptions(_0x48d163);var _0x42f42f=new Buffer(_0x2101c2);var _0x347448=fs[_0x34b4('0x1c')](_0xe0d598);var _0x30eb65=fs[_0x34b4('0x1d')](_0x2ab951);var _0x3cc5ac=crypto[_0x34b4('0x1e')](_0x48d163[_0x34b4('0xb')],_0x42f42f);_0x347448['on']('data',function(_0x697f84){var _0x19eee3=new Buffer(_0x3cc5ac[_0x34b4('0x1f')](_0x697f84),_0x34b4('0x16'));_0x30eb65['write'](_0x19eee3);});_0x347448['on'](_0x34b4('0x18'),function(){try{var _0x35fc71=new Buffer(_0x3cc5ac[_0x34b4('0x19')](_0x34b4('0x16')),_0x34b4('0x16'));_0x30eb65[_0x34b4('0x17')](_0x35fc71);_0x30eb65[_0x34b4('0x18')]();_0x30eb65['on'](_0x34b4('0x1a'),function(){return _0xe8792f(_0x2ab951);});}catch(_0x3d129a){fs['unlink'](_0x2ab951);return _0x203b8a(_0x3d129a);}});});};exports[_0x34b4('0x20')]=function(_0x5e046c,_0x1ea1a7,_0x2bfeff){var _0x13fc4f=_0x2bfeff||stringOptions[_0x34b4('0xb')];var _0xeb8166=_0x1ea1a7||stringOptions[_0x34b4('0x21')];var _0x93846e=crypto[_0x34b4('0x14')](_0x13fc4f,_0xeb8166);var _0x26fb7e=_0x93846e['update'](_0x5e046c,_0x34b4('0x22'),'base64');_0x26fb7e+=_0x93846e['final'](_0x34b4('0x23'));return _0x26fb7e;};exports[_0x34b4('0x24')]=function(_0x47df8f,_0x1fbae1,_0x333370){var _0x1ac435=_0x333370||stringOptions['algorithm'];var _0x1c296b=_0x1fbae1||stringOptions[_0x34b4('0x21')];var _0x41f3ba=crypto['createDecipher'](_0x1ac435,_0x1c296b);var _0xe33314=_0x41f3ba['update'](_0x47df8f,_0x34b4('0x23'),_0x34b4('0x22'));_0xe33314+=_0x41f3ba[_0x34b4('0x19')](_0x34b4('0x22'));return _0xe33314;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f42d6f5..1a17329 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 _0xdce9=['CSV','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','split','length','range','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','writeFileSync','%s.%s','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xdce9,0x1bd));var _0x9dce=function(_0x39d785,_0x46f1fb){_0x39d785=_0x39d785-0x0;var _0x477f7d=_0xdce9[_0x39d785];return _0x477f7d;};'use strict';var util=require(_0x9dce('0x0'));var path=require(_0x9dce('0x1'));var _=require(_0x9dce('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x9dce('0x3'));var zipdir=require(_0x9dce('0x4'));var rimraf=require('rimraf');var db=require(_0x9dce('0x5'))['db'];var dbH=require(_0x9dce('0x5'))[_0x9dce('0x6')];var logger=require(_0x9dce('0x7'))(_0x9dce('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9dce('0x9')][0x3];var PATH=process[_0x9dce('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xb05cab,_0x773e1){var _0x3619ca={'status':_0xb05cab};var _0x13157b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x773e1){_0x3619ca[_0x9dce('0xa')]=_0x773e1;}return db[_0x9dce('0xb')][_0x9dce('0xc')](_0x3619ca,_0x13157b);}function main(){var _0x31e222=0x1388;var _0x4288bf;logger[_0x9dce('0xd')](util[_0x9dce('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9dce('0xf')));return db['Setting'][_0x9dce('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x9dce('0x11')]})[_0x9dce('0x12')](function(_0x48dee8){if(_0x48dee8){_0x4288bf=_0x48dee8;_0x31e222=_0x4288bf[_0x9dce('0x11')]||0x1388;}})[_0x9dce('0x12')](function(){return dbH[_0x9dce('0x13')][_0x9dce('0x14')](util[_0x9dce('0xe')](_0x9dce('0x15'),QUERY),{'type':dbH[_0x9dce('0x13')][_0x9dce('0x16')][_0x9dce('0x17')]});})[_0x9dce('0x12')](function(_0x3fdf86){if(!_0x3fdf86[0x0]['num']){return analyticExtractedReport(_0x9dce('0x18'));}var _0x5161d3=[];var _0x307963=0x0;if(_0x4288bf[_0x9dce('0x19')]){if(_0x3fdf86&&_0x3fdf86[_0x9dce('0x1a')]){var _0x488215=_[_0x9dce('0x1b')](_0x3fdf86[0x0][_0x9dce('0x1c')]/_0x31e222);var _0x5017e2=Number['isInteger'](_0x3fdf86[0x0][_0x9dce('0x1c')]/_0x31e222)?_0x3fdf86[0x0][_0x9dce('0x1c')]%_0x31e222:0x0;_0x488215[_0x9dce('0x1d')](function(_0x567322){if(_0x567322>0x0){_0x307963+=_0x31e222;}_0x5161d3[_0x9dce('0x1e')](dbH[_0x9dce('0x13')][_0x9dce('0x14')](util[_0x9dce('0xe')](_0x9dce('0x1f'),QUERY,_0x31e222,_0x307963),{'type':dbH['sequelize'][_0x9dce('0x16')][_0x9dce('0x17')]}));});if(_0x5017e2>0x0){_0x307963+=_0x31e222;_0x5161d3['push'](dbH[_0x9dce('0x13')][_0x9dce('0x14')](util[_0x9dce('0xe')](_0x9dce('0x1f'),QUERY,_0x5017e2,_0x307963),{'type':dbH[_0x9dce('0x13')][_0x9dce('0x16')][_0x9dce('0x17')]}));}}}else{_0x5161d3[_0x9dce('0x1e')](dbH['sequelize'][_0x9dce('0x14')](QUERY,{'type':dbH[_0x9dce('0x13')][_0x9dce('0x16')]['SELECT']}));}var _0x2b08e8=path[_0x9dce('0x20')](PATH);var _0x2103af=path[_0x9dce('0x21')](PATH,_0x9dce('0x22'));var _0x4825e4=_0x4288bf[_0x9dce('0x19')]&&_0x5161d3['length']>0x1;var _0x52356c=[];if(!fs[_0x9dce('0x23')](path[_0x9dce('0x24')](_0x2b08e8,_0x2103af))&&_0x4825e4){fs['mkdirSync'](path[_0x9dce('0x24')](_0x2b08e8,_0x2103af));}return BPromise['each'](_0x5161d3,function(_0x55aa55){_0x52356c['push'](_0x55aa55);})[_0x9dce('0x12')](function(){for(var _0x38f8d7=0x0;_0x38f8d7<_0x52356c[_0x9dce('0x1a')];_0x38f8d7+=0x1){var _0x173aa7;var _0x12ceee=_0x52356c[_0x38f8d7];if(_0x4825e4){_0x173aa7=path[_0x9dce('0x24')](_0x2b08e8,_0x2103af,util['format']('%s%d.%s',_0x2103af,_0x38f8d7,'csv'));}else{_0x173aa7=path[_0x9dce('0x24')](_0x2b08e8,util['format']('%s.%s',_0x2103af,'csv'));}fs[_0x9dce('0x25')](_0x173aa7,csv(_0x12ceee));}})[_0x9dce('0x12')](function(){if(_0x4825e4){return new Promise(function(_0x26f6a0){zipdir(path[_0x9dce('0x24')](_0x2b08e8,_0x2103af),{'saveTo':path[_0x9dce('0x24')](_0x2b08e8,util['format'](_0x9dce('0x26'),_0x2103af,_0x9dce('0x27')))},function(_0x4c121f,_0x50f4d6){rimraf(path[_0x9dce('0x24')](_0x2b08e8,_0x2103af),function(){});_0x26f6a0('zip\x20finished');});});}})['then'](function(){logger[_0x9dce('0xd')](util[_0x9dce('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9dce('0xf')));return analyticExtractedReport(_0x9dce('0x28'),_0x4825e4?util[_0x9dce('0xe')]('%s.%s',_0x2103af,_0x4825e4?'zip':'csv'):null);});})['catch'](function(_0x312468){logger[_0x9dce('0xd')](util[_0x9dce('0xe')](_0x9dce('0x29'),EXTRACTED_REPORT_ID,_0x9dce('0xf')),util[_0x9dce('0x2a')](_0x312468,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9dce('0x2b'));})[_0x9dce('0x2c')](function(){process[_0x9dce('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4ba1=['split','splitSizeCsv','then','sequelize','query','QueryTypes','num','Empty','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','mkdirSync','each','join','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting'];(function(_0x46207,_0x1fa353){var _0x1acb1c=function(_0x4a4b5f){while(--_0x4a4b5f){_0x46207['push'](_0x46207['shift']());}};_0x1acb1c(++_0x1fa353);}(_0x4ba1,0x116));var _0x14ba=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4ba1[_0x53ccf2];return _0x5a2964;};'use strict';var util=require(_0x14ba('0x0'));var path=require(_0x14ba('0x1'));var _=require(_0x14ba('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x14ba('0x3'));var zipdir=require(_0x14ba('0x4'));var rimraf=require('rimraf');var db=require(_0x14ba('0x5'))['db'];var dbH=require('../../mysqldb')[_0x14ba('0x6')];var logger=require(_0x14ba('0x7'))(_0x14ba('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x14ba('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x14ba('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4e492b,_0x5ee138){var _0x379fec={'status':_0x4e492b};var _0x5e9386={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ee138){_0x379fec[_0x14ba('0xa')]=_0x5ee138;}return db['AnalyticExtractedReport']['update'](_0x379fec,_0x5e9386);}function main(){var _0x5d5730=0x1388;var _0x32892b;logger[_0x14ba('0xb')](util[_0x14ba('0xc')](_0x14ba('0xd'),EXTRACTED_REPORT_ID,_0x14ba('0xe')));return db[_0x14ba('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x14ba('0x10'),_0x14ba('0x11')]})[_0x14ba('0x12')](function(_0x85b3e0){if(_0x85b3e0){_0x32892b=_0x85b3e0;_0x5d5730=_0x32892b[_0x14ba('0x11')]||0x1388;}})[_0x14ba('0x12')](function(){return dbH[_0x14ba('0x13')][_0x14ba('0x14')](util[_0x14ba('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x14ba('0x15')]['SELECT']});})[_0x14ba('0x12')](function(_0x178d9f){if(!_0x178d9f[0x0][_0x14ba('0x16')]){return analyticExtractedReport(_0x14ba('0x17'));}var _0x32a59b=[];var _0x4a8889=0x0;if(_0x32892b['split']){if(_0x178d9f&&_0x178d9f[_0x14ba('0x18')]){var _0x356c6e=_['range'](_0x178d9f[0x0][_0x14ba('0x16')]/_0x5d5730);var _0x7d62d5=Number[_0x14ba('0x19')](_0x178d9f[0x0][_0x14ba('0x16')]/_0x5d5730)?_0x178d9f[0x0][_0x14ba('0x16')]%_0x5d5730:0x0;_0x356c6e[_0x14ba('0x1a')](function(_0x4b5d5b){if(_0x4b5d5b>0x0){_0x4a8889+=_0x5d5730;}_0x32a59b[_0x14ba('0x1b')](dbH[_0x14ba('0x13')][_0x14ba('0x14')](util[_0x14ba('0xc')](_0x14ba('0x1c'),QUERY,_0x5d5730,_0x4a8889),{'type':dbH[_0x14ba('0x13')][_0x14ba('0x15')]['SELECT']}));});if(_0x7d62d5>0x0){_0x4a8889+=_0x5d5730;_0x32a59b['push'](dbH[_0x14ba('0x13')][_0x14ba('0x14')](util[_0x14ba('0xc')](_0x14ba('0x1c'),QUERY,_0x7d62d5,_0x4a8889),{'type':dbH[_0x14ba('0x13')][_0x14ba('0x15')][_0x14ba('0x1d')]}));}}}else{_0x32a59b[_0x14ba('0x1b')](dbH[_0x14ba('0x13')][_0x14ba('0x14')](QUERY,{'type':dbH['sequelize'][_0x14ba('0x15')][_0x14ba('0x1d')]}));}var _0x43e27f=path[_0x14ba('0x1e')](PATH);var _0x27a38c=path[_0x14ba('0x1f')](PATH,_0x14ba('0x20'));var _0x209c73=_0x32892b[_0x14ba('0x10')]&&_0x32a59b[_0x14ba('0x18')]>0x1;var _0x23e8e0=[];if(!fs[_0x14ba('0x21')](path['join'](_0x43e27f,_0x27a38c))&&_0x209c73){fs[_0x14ba('0x22')](path['join'](_0x43e27f,_0x27a38c));}return BPromise[_0x14ba('0x23')](_0x32a59b,function(_0x1cc200){_0x23e8e0[_0x14ba('0x1b')](_0x1cc200);})[_0x14ba('0x12')](function(){for(var _0x4a42ce=0x0;_0x4a42ce<_0x23e8e0[_0x14ba('0x18')];_0x4a42ce+=0x1){var _0x13ef8f;var _0x2cdd1f=_0x23e8e0[_0x4a42ce];if(_0x209c73){_0x13ef8f=path[_0x14ba('0x24')](_0x43e27f,_0x27a38c,util[_0x14ba('0xc')](_0x14ba('0x25'),_0x27a38c,_0x4a42ce,_0x14ba('0x26')));}else{_0x13ef8f=path['join'](_0x43e27f,util[_0x14ba('0xc')]('%s.%s',_0x27a38c,_0x14ba('0x26')));}fs['writeFileSync'](_0x13ef8f,csv(_0x2cdd1f));}})[_0x14ba('0x12')](function(){if(_0x209c73){return new Promise(function(_0x35fd52){zipdir(path[_0x14ba('0x24')](_0x43e27f,_0x27a38c),{'saveTo':path[_0x14ba('0x24')](_0x43e27f,util['format'](_0x14ba('0x27'),_0x27a38c,_0x14ba('0x28')))},function(_0x49ff1b,_0x17edf7){rimraf(path[_0x14ba('0x24')](_0x43e27f,_0x27a38c),function(){});_0x35fd52(_0x14ba('0x29'));});});}})[_0x14ba('0x12')](function(){logger[_0x14ba('0xb')](util[_0x14ba('0xc')](_0x14ba('0x2a'),EXTRACTED_REPORT_ID,_0x14ba('0xe')));return analyticExtractedReport(_0x14ba('0x2b'),_0x209c73?util[_0x14ba('0xc')]('%s.%s',_0x27a38c,_0x209c73?_0x14ba('0x28'):'csv'):null);});})[_0x14ba('0x2c')](function(_0x5317e3){logger['info'](util[_0x14ba('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x14ba('0xe')),util[_0x14ba('0x2d')](_0x5317e3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x14ba('0x2e'));})[_0x14ba('0x2f')](function(){process[_0x14ba('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index dae247e..d12882b 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 _0x4ca4=['pageBreak','before','landscape','footer','black','right','num','find','split','splitSizePdf','then','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','PDF','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','bluebird','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','auto','body','push','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header'];(function(_0x1a82ef,_0x4b3d2a){var _0x42b015=function(_0x1efc8c){while(--_0x1efc8c){_0x1a82ef['push'](_0x1a82ef['shift']());}};_0x42b015(++_0x4b3d2a);}(_0x4ca4,0xe4));var _0x44ca=function(_0x598541,_0x2f2f4e){_0x598541=_0x598541-0x0;var _0x3dfcfa=_0x4ca4[_0x598541];return _0x3dfcfa;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x44ca('0x0'));var path=require(_0x44ca('0x1'));var moment=require(_0x44ca('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x44ca('0x3'));var zipdir=require(_0x44ca('0x4'));var rimraf=require(_0x44ca('0x5'));var JSDOM=require(_0x44ca('0x6'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x44ca('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x44ca('0x8')];var logger=require(_0x44ca('0x9'))(_0x44ca('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x44ca('0xb')][0x2]);var QUERY=process[_0x44ca('0xb')][0x3];var PATH=process[_0x44ca('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x44ca('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x543755,_0x12061b){var _0x30ab4a={'status':_0x543755};var _0x49da54={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12061b){_0x30ab4a['savename']=_0x12061b;}return db[_0x44ca('0xd')][_0x44ca('0xe')](_0x30ab4a,_0x49da54);}function getHeaders(_0x260064){return _[_0x44ca('0xf')](_0x260064,function(_0x306a3d){return{'text':_0x306a3d,'style':_0x44ca('0x10')};});}function getRows(_0x586f28,_0x424564){return _[_0x44ca('0xf')](_0x424564,function(_0x567494){return _(_0x567494)[_0x44ca('0x11')](_0x586f28)['map'](function(_0x244962){return _0x244962?_[_0x44ca('0x12')](_0x244962):'';})['value']();});}function createTable(_0x505b63,_0x28ac7e){var _0x2d0d07={'widths':_[_0x44ca('0x13')](Array(_0x505b63[_0x44ca('0x14')]),0x91),'heights':function(_0x2e1dcb){return _0x2e1dcb===0x0?_0x44ca('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1ff343=getHeaders(_0x505b63);_0x2d0d07[_0x44ca('0x16')][_0x44ca('0x17')](_0x1ff343);var _0x2900ee=getRows(_0x505b63,_0x28ac7e);_0x2d0d07[_0x44ca('0x16')]=_0x2d0d07[_0x44ca('0x16')][_0x44ca('0x18')](_0x2900ee);return _0x2d0d07;}function createTables(_0x43750d){var _0x11d566=[];var _0x16cc16=_[_0x44ca('0x19')](Object['keys'](_0x43750d[0x0]),0x5);_0x16cc16[_0x44ca('0x1a')](function(_0xc40bd3){_0x11d566[_0x44ca('0x17')](createTable(_0xc40bd3,_0x43750d));});return _0x11d566;}function getPDFDocDefinition(_0x3845da){var _0xff122b=util['format'](_0x44ca('0x1b'),NAME,EXTRACTED_REPORT[_0x44ca('0x1c')],moment(EXTRACTED_REPORT[_0x44ca('0x1d')])[_0x44ca('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x44ca('0x1f')])[_0x44ca('0x1e')](FORMAT));var _0x1cd3a5=[];for(var _0x4fbaa=0x0;_0x4fbaa<_0x3845da[_0x44ca('0x14')];_0x4fbaa++){var _0x4aba3c=[];if(_0x4fbaa===0x0){_0x4aba3c[_0x44ca('0x17')]({'text':_0xff122b,'style':_0x44ca('0x20')});}var _0x84746={'table':_0x3845da[_0x4fbaa]};if(_0x4fbaa>0x0){_0x84746[_0x44ca('0x21')]=_0x44ca('0x22');_0x84746['margin']=[0x0,0x46,0x0,0x0];}_0x4aba3c[_0x44ca('0x17')](_0x84746);_0x1cd3a5[_0x44ca('0x17')](_0x4aba3c);}return{'pageSize':'A4','pageOrientation':_0x44ca('0x23'),'content':_0x1cd3a5,'footer':function(_0x49d646,_0x43a4cd){return{'text':_0x49d646['toString']()+'\x20/\x20'+_0x43a4cd,'style':_0x44ca('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x44ca('0x25')},'footer':{'alignment':_0x44ca('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5326c2){var _0x5376b7=0x1388;var _0x5f0dc9;if(!_0x5326c2[0x0][_0x44ca('0x27')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x44ca('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x44ca('0x29'),'splitSizePdf']})['then'](function(_0x5a1297){if(_0x5a1297){_0x5f0dc9=_0x5a1297;_0x5376b7=_0x5f0dc9[_0x44ca('0x2a')]||0x3e8;}})[_0x44ca('0x2b')](function(){var _0x3a6ee1=[];var _0x55c5b3=0x0;if(_0x5f0dc9['split']){if(_0x5326c2&&_0x5326c2[_0x44ca('0x14')]){var _0x25b9a7=_[_0x44ca('0x2c')](_0x5326c2[0x0][_0x44ca('0x27')]/_0x5376b7);var _0x232b95=Number[_0x44ca('0x2d')](_0x5326c2[0x0]['num']/_0x5376b7)?_0x5326c2[0x0][_0x44ca('0x27')]%_0x5376b7:0x0;_0x25b9a7[_0x44ca('0x1a')](function(_0x2fa6ca){if(_0x2fa6ca>0x0){_0x55c5b3+=_0x5376b7;}_0x3a6ee1[_0x44ca('0x17')](dbH[_0x44ca('0x2e')][_0x44ca('0x2f')](util[_0x44ca('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5376b7,_0x55c5b3),{'type':dbH[_0x44ca('0x2e')][_0x44ca('0x30')][_0x44ca('0x31')]}));});if(_0x232b95>0x0){_0x55c5b3+=_0x5376b7;_0x3a6ee1[_0x44ca('0x17')](dbH[_0x44ca('0x2e')][_0x44ca('0x2f')](util[_0x44ca('0x1e')](_0x44ca('0x32'),QUERY,_0x232b95,_0x55c5b3),{'type':dbH[_0x44ca('0x2e')][_0x44ca('0x30')][_0x44ca('0x31')]}));}}}else{_0x3a6ee1[_0x44ca('0x17')](dbH['sequelize'][_0x44ca('0x2f')](QUERY,{'type':dbH[_0x44ca('0x2e')]['QueryTypes'][_0x44ca('0x31')]}));}var _0x456ec9=path[_0x44ca('0x33')](PATH);var _0x37ad89=path[_0x44ca('0x34')](PATH,_0x44ca('0x35'));var _0x48b68f=_0x5f0dc9[_0x44ca('0x29')]&&_0x3a6ee1['length']>0x1;var _0x301901=[];if(!fs[_0x44ca('0x36')](path[_0x44ca('0x37')](_0x456ec9,_0x37ad89))&&_0x48b68f){fs[_0x44ca('0x38')](path['join'](_0x456ec9,_0x37ad89));}return BPromise['each'](_0x3a6ee1,function(_0x33d1a1){_0x301901['push'](_0x33d1a1);})[_0x44ca('0x2b')](function(){var _0x134bc9=[];for(var _0xa39c74=0x0;_0xa39c74<_0x301901[_0x44ca('0x14')];_0xa39c74+=0x1){var _0x4d0479=_0x301901[_0xa39c74];var _0x334c36=createTables(_[_0x44ca('0x39')](_0x4d0479));var _0x28b4a0;var _0xb2bbf0=getPDFDocDefinition(_0x334c36);var _0x2b3286=getPDFPrinter();var _0x36a22c=_0x2b3286[_0x44ca('0x3a')](_0xb2bbf0);if(_0x48b68f){_0x28b4a0=path[_0x44ca('0x37')](_0x456ec9,_0x37ad89,util[_0x44ca('0x1e')](_0x44ca('0x3b'),_0x37ad89,_0xa39c74,_0x44ca('0x3c')));}else{_0x28b4a0=path[_0x44ca('0x37')](_0x456ec9,util[_0x44ca('0x1e')]('%s.%s',_0x37ad89,'pdf'));}_0x134bc9[_0x44ca('0x17')](writePDFDocument(_0x36a22c,_0x28b4a0));}return Promise[_0x44ca('0x3d')](_0x134bc9);})[_0x44ca('0x2b')](function(){if(_0x48b68f){return new Promise(function(_0x138fbf){zipdir(path[_0x44ca('0x37')](_0x456ec9,_0x37ad89),{'saveTo':path['join'](_0x456ec9,util['format'](_0x44ca('0x3e'),_0x37ad89,_0x44ca('0x3f')))},function(){rimraf(path[_0x44ca('0x37')](_0x456ec9,_0x37ad89),function(){});_0x138fbf('zip\x20finished');});});}})['then'](function(){if(!_0x48b68f)return;rimraf(path[_0x44ca('0x37')](_0x456ec9,_0x37ad89),function(){});})[_0x44ca('0x2b')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x48b68f?util[_0x44ca('0x1e')](_0x44ca('0x3e'),_0x37ad89,_0x48b68f?_0x44ca('0x3f'):_0x44ca('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x44ca('0x40')](util[_0x44ca('0x1e')](_0x44ca('0x41'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x419386){EXTRACTED_REPORT=_0x419386;return dbH['sequelize'][_0x44ca('0x2f')](util['format'](_0x44ca('0x42'),QUERY),{'type':dbH[_0x44ca('0x2e')][_0x44ca('0x30')][_0x44ca('0x31')]});})['then'](extractReport)[_0x44ca('0x43')](function(_0x37edcd){logger[_0x44ca('0x40')](util[_0x44ca('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x44ca('0x44')),util[_0x44ca('0x45')](_0x37edcd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x44ca('0x46'));})[_0x44ca('0x47')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x430899=new PdfPrinter({'Arial':{'normal':__dirname+_0x44ca('0x48'),'bold':__dirname+_0x44ca('0x49'),'italics':__dirname+_0x44ca('0x4a'),'bolditalics':__dirname+_0x44ca('0x4b')}});return _0x430899;}function getPDFDocDefinitionFromHTML(_0x1401fb,_0x5a5211){var _0x194b9a=util[_0x44ca('0x1e')](_0x44ca('0x4c'),_0x5a5211[_0x44ca('0x4d')],_0x5a5211['interactionId']);var _0x302460=moment()[_0x44ca('0x1e')](_0x44ca('0x4e'))[_0x44ca('0x12')]();var _0x787ceb=htmlToPdfmake(_0x1401fb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x787ceb],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x44ca('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x44ca('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x44ca('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x44ca('0x20')}];},'footer':function(_0x569507,_0x28a796){return[{'text':util[_0x44ca('0x1e')](_0x44ca('0x50'),_0x194b9a,_0x569507,_0x28a796,_0x302460),'style':'footer'}];}};}function writePDFDocument(_0xa4054,_0x461845){return new Promise(function(_0x150bb7,_0x4e1c23){var _0x4f8fac=_0xa4054[_0x44ca('0x51')](fs[_0x44ca('0x52')](_0x461845));_0x4f8fac['on'](_0x44ca('0x53'),function(){_0x150bb7(_0x44ca('0x53'));});_0x4f8fac['on'](_0x44ca('0x54'),function(_0x240911){_0x4e1c23(_0x240911);});_0xa4054[_0x44ca('0x55')]();});}exports[_0x44ca('0x56')]=function(_0x3375e2,_0x1cc4b0){var _0x2fb5e4=getPDFPrinter();var _0x32cfec=getPDFDocDefinitionFromHTML(_0x3375e2,_0x1cc4b0);var _0x41c909=_0x2fb5e4['createPdfKitDocument'](_0x32cfec);return writePDFDocument(_0x41c909,_0x1cc4b0[_0x44ca('0x1')])[_0x44ca('0x43')](function(_0x467770){throw _0x467770;});}; \ No newline at end of file +var _0xa224=['analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','JSDOM','../../mysqldb','dbH','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa224,0xb4));var _0x4a22=function(_0x17609e,_0x4e6fd6){_0x17609e=_0x17609e-0x0;var _0x2f29ab=_0xa224[_0x17609e];return _0x2f29ab;};'use strict';var _=require(_0x4a22('0x0'));var fs=require('fs');var util=require(_0x4a22('0x1'));var path=require(_0x4a22('0x2'));var moment=require(_0x4a22('0x3'));var htmlToPdfmake=require(_0x4a22('0x4'));var PdfPrinter=require(_0x4a22('0x5'));var zipdir=require(_0x4a22('0x6'));var rimraf=require(_0x4a22('0x7'));var JSDOM=require('jsdom')[_0x4a22('0x8')];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x4a22('0x9'))['db'];var dbH=require(_0x4a22('0x9'))[_0x4a22('0xa')];var logger=require(_0x4a22('0xb'))(_0x4a22('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x4a22('0xd')][0x2]);var QUERY=process[_0x4a22('0xd')][0x3];var PATH=process[_0x4a22('0xd')][0x4];var NAME=process[_0x4a22('0xd')][0x5];var FORMAT=_0x4a22('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x227b1d,_0x286406){var _0x43bcf5={'status':_0x227b1d};var _0x1e63ec={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x286406){_0x43bcf5['savename']=_0x286406;}return db[_0x4a22('0xf')]['update'](_0x43bcf5,_0x1e63ec);}function getHeaders(_0x231955){return _[_0x4a22('0x10')](_0x231955,function(_0x34b633){return{'text':_0x34b633,'style':_0x4a22('0x11')};});}function getRows(_0x89c31,_0xb448c){return _[_0x4a22('0x10')](_0xb448c,function(_0xa730f0){return _(_0xa730f0)[_0x4a22('0x12')](_0x89c31)[_0x4a22('0x10')](function(_0x5f087f){return _0x5f087f?_[_0x4a22('0x13')](_0x5f087f):'';})[_0x4a22('0x14')]();});}function createTable(_0x1cc1f6,_0x4e44dc){var _0x135dc8={'widths':_[_0x4a22('0x15')](Array(_0x1cc1f6[_0x4a22('0x16')]),0x91),'heights':function(_0x2df9f7){return _0x2df9f7===0x0?_0x4a22('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x506d39=getHeaders(_0x1cc1f6);_0x135dc8[_0x4a22('0x18')][_0x4a22('0x19')](_0x506d39);var _0x43b46e=getRows(_0x1cc1f6,_0x4e44dc);_0x135dc8[_0x4a22('0x18')]=_0x135dc8[_0x4a22('0x18')][_0x4a22('0x1a')](_0x43b46e);return _0x135dc8;}function createTables(_0x256ca1){var _0x233338=[];var _0x2f67c5=_[_0x4a22('0x1b')](Object['keys'](_0x256ca1[0x0]),0x5);_0x2f67c5['forEach'](function(_0x593a52){_0x233338[_0x4a22('0x19')](createTable(_0x593a52,_0x256ca1));});return _0x233338;}function getPDFDocDefinition(_0x536a7c){var _0x5e24b7=util[_0x4a22('0x1c')](_0x4a22('0x1d'),NAME,EXTRACTED_REPORT[_0x4a22('0x1e')],moment(EXTRACTED_REPORT[_0x4a22('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x4a22('0x20')])[_0x4a22('0x1c')](FORMAT));var _0x4fcbfa=[];for(var _0x334b56=0x0;_0x334b56<_0x536a7c[_0x4a22('0x16')];_0x334b56++){var _0x5c1f0f=[];if(_0x334b56===0x0){_0x5c1f0f['push']({'text':_0x5e24b7,'style':_0x4a22('0x21')});}var _0x4c236f={'table':_0x536a7c[_0x334b56]};if(_0x334b56>0x0){_0x4c236f[_0x4a22('0x22')]='before';_0x4c236f[_0x4a22('0x23')]=[0x0,0x46,0x0,0x0];}_0x5c1f0f[_0x4a22('0x19')](_0x4c236f);_0x4fcbfa[_0x4a22('0x19')](_0x5c1f0f);}return{'pageSize':'A4','pageOrientation':_0x4a22('0x24'),'content':_0x4fcbfa,'footer':function(_0x370aa0,_0x2a54ba){return{'text':_0x370aa0[_0x4a22('0x13')]()+_0x4a22('0x25')+_0x2a54ba,'style':_0x4a22('0x26')};},'defaultStyle':{'font':_0x4a22('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4a22('0x28')},'footer':{'alignment':_0x4a22('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x340af1){var _0x2e8481=0x1388;var _0x21990f;if(!_0x340af1[0x0][_0x4a22('0x2a')]){return analyticExtractedReport(_0x4a22('0x2b'));}return db[_0x4a22('0x2c')][_0x4a22('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4a22('0x2e'),_0x4a22('0x2f')]})[_0x4a22('0x30')](function(_0x209826){if(_0x209826){_0x21990f=_0x209826;_0x2e8481=_0x21990f[_0x4a22('0x2f')]||0x3e8;}})[_0x4a22('0x30')](function(){var _0x43ad82=[];var _0x1ff78d=0x0;if(_0x21990f['split']){if(_0x340af1&&_0x340af1[_0x4a22('0x16')]){var _0x1d7bb1=_[_0x4a22('0x31')](_0x340af1[0x0][_0x4a22('0x2a')]/_0x2e8481);var _0x3d8de6=Number[_0x4a22('0x32')](_0x340af1[0x0][_0x4a22('0x2a')]/_0x2e8481)?_0x340af1[0x0][_0x4a22('0x2a')]%_0x2e8481:0x0;_0x1d7bb1['forEach'](function(_0x39faad){if(_0x39faad>0x0){_0x1ff78d+=_0x2e8481;}_0x43ad82[_0x4a22('0x19')](dbH[_0x4a22('0x33')][_0x4a22('0x34')](util[_0x4a22('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e8481,_0x1ff78d),{'type':dbH[_0x4a22('0x33')][_0x4a22('0x35')][_0x4a22('0x36')]}));});if(_0x3d8de6>0x0){_0x1ff78d+=_0x2e8481;_0x43ad82[_0x4a22('0x19')](dbH[_0x4a22('0x33')]['query'](util[_0x4a22('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d8de6,_0x1ff78d),{'type':dbH[_0x4a22('0x33')][_0x4a22('0x35')]['SELECT']}));}}}else{_0x43ad82['push'](dbH[_0x4a22('0x33')][_0x4a22('0x34')](QUERY,{'type':dbH[_0x4a22('0x33')][_0x4a22('0x35')][_0x4a22('0x36')]}));}var _0x2ad101=path[_0x4a22('0x37')](PATH);var _0x3bbec2=path[_0x4a22('0x38')](PATH,_0x4a22('0x39'));var _0x414421=_0x21990f[_0x4a22('0x2e')]&&_0x43ad82['length']>0x1;var _0x49cfba=[];if(!fs[_0x4a22('0x3a')](path[_0x4a22('0x3b')](_0x2ad101,_0x3bbec2))&&_0x414421){fs[_0x4a22('0x3c')](path['join'](_0x2ad101,_0x3bbec2));}return BPromise[_0x4a22('0x3d')](_0x43ad82,function(_0x425067){_0x49cfba[_0x4a22('0x19')](_0x425067);})['then'](function(){var _0x1ef9b9=[];for(var _0x44e7ec=0x0;_0x44e7ec<_0x49cfba['length'];_0x44e7ec+=0x1){var _0x2b80e4=_0x49cfba[_0x44e7ec];var _0x173e95=createTables(_['flatten'](_0x2b80e4));var _0x1b12d8;var _0x5a7f67=getPDFDocDefinition(_0x173e95);var _0x40b64a=getPDFPrinter();var _0xc684ee=_0x40b64a['createPdfKitDocument'](_0x5a7f67);if(_0x414421){_0x1b12d8=path['join'](_0x2ad101,_0x3bbec2,util[_0x4a22('0x1c')](_0x4a22('0x3e'),_0x3bbec2,_0x44e7ec,_0x4a22('0x3f')));}else{_0x1b12d8=path[_0x4a22('0x3b')](_0x2ad101,util[_0x4a22('0x1c')](_0x4a22('0x40'),_0x3bbec2,'pdf'));}_0x1ef9b9[_0x4a22('0x19')](writePDFDocument(_0xc684ee,_0x1b12d8));}return Promise[_0x4a22('0x41')](_0x1ef9b9);})[_0x4a22('0x30')](function(){if(_0x414421){return new Promise(function(_0x30012d){zipdir(path[_0x4a22('0x3b')](_0x2ad101,_0x3bbec2),{'saveTo':path[_0x4a22('0x3b')](_0x2ad101,util['format'](_0x4a22('0x40'),_0x3bbec2,_0x4a22('0x42')))},function(){rimraf(path['join'](_0x2ad101,_0x3bbec2),function(){});_0x30012d(_0x4a22('0x43'));});});}})['then'](function(){if(!_0x414421)return;rimraf(path[_0x4a22('0x3b')](_0x2ad101,_0x3bbec2),function(){});})[_0x4a22('0x30')](function(){logger[_0x4a22('0x44')](util[_0x4a22('0x1c')](_0x4a22('0x45'),EXTRACTED_REPORT_ID,_0x4a22('0x46')));return analyticExtractedReport(_0x4a22('0x47'),_0x414421?util[_0x4a22('0x1c')](_0x4a22('0x40'),_0x3bbec2,_0x414421?_0x4a22('0x42'):_0x4a22('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4a22('0x44')](util['format'](_0x4a22('0x48'),EXTRACTED_REPORT_ID,_0x4a22('0x46')));return db[_0x4a22('0xf')][_0x4a22('0x49')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4a22('0x30')](function(_0x79c10b){EXTRACTED_REPORT=_0x79c10b;return dbH[_0x4a22('0x33')][_0x4a22('0x34')](util[_0x4a22('0x1c')](_0x4a22('0x4a'),QUERY),{'type':dbH[_0x4a22('0x33')][_0x4a22('0x35')][_0x4a22('0x36')]});})[_0x4a22('0x30')](extractReport)[_0x4a22('0x4b')](function(_0x564905){logger['info'](util[_0x4a22('0x1c')](_0x4a22('0x4c'),EXTRACTED_REPORT_ID,_0x4a22('0x46')),util['inspect'](_0x564905,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4a22('0x4d'));})[_0x4a22('0x4e')](function(){process[_0x4a22('0x4f')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x26add8=new PdfPrinter({'Arial':{'normal':__dirname+_0x4a22('0x50'),'bold':__dirname+_0x4a22('0x51'),'italics':__dirname+_0x4a22('0x52'),'bolditalics':__dirname+_0x4a22('0x53')}});return _0x26add8;}function getPDFDocDefinitionFromHTML(_0x3ef9a7,_0x4e8fd0){var _0x17188d=util[_0x4a22('0x1c')](_0x4a22('0x54'),_0x4e8fd0['channel'],_0x4e8fd0[_0x4a22('0x55')]);var _0x4d6925=moment()[_0x4a22('0x1c')](_0x4a22('0x56'))[_0x4a22('0x13')]();var _0x2ad9cf=htmlToPdfmake(_0x3ef9a7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2ad9cf],'defaultStyle':{'font':_0x4a22('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4a22('0x57'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4a22('0x57'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4a22('0x57')}},'header':function(){return[{'text':_0x4a22('0x58'),'style':_0x4a22('0x21')}];},'footer':function(_0x4dcdd1,_0x13dd76){return[{'text':util[_0x4a22('0x1c')](_0x4a22('0x59'),_0x17188d,_0x4dcdd1,_0x13dd76,_0x4d6925),'style':_0x4a22('0x26')}];}};}function writePDFDocument(_0x5cb84e,_0x1f1d0b){return new Promise(function(_0x4b718b,_0x1287c0){var _0x1f2728=_0x5cb84e['pipe'](fs[_0x4a22('0x5a')](_0x1f1d0b));_0x1f2728['on']('finish',function(){_0x4b718b(_0x4a22('0x5b'));});_0x1f2728['on'](_0x4a22('0x5c'),function(_0x47aecd){_0x1287c0(_0x47aecd);});_0x5cb84e[_0x4a22('0x5d')]();});}exports[_0x4a22('0x5e')]=function(_0x595b8e,_0x451e97){var _0x4d2bbf=getPDFPrinter();var _0x2c6421=getPDFDocDefinitionFromHTML(_0x595b8e,_0x451e97);var _0x485648=_0x4d2bbf[_0x4a22('0x5f')](_0x2c6421);return writePDFDocument(_0x485648,_0x451e97[_0x4a22('0x2')])[_0x4a22('0x4b')](function(_0x703e8d){throw _0x703e8d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 17ef06e..7dae5ac 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 _0x31b5=['Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','length','isInteger','num','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','join','mkdirSync','each','%s.%s','xlsx','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0xb2c80a,_0x3e191c){var _0x42dc72=function(_0x198e9a){while(--_0x198e9a){_0xb2c80a['push'](_0xb2c80a['shift']());}};_0x42dc72(++_0x3e191c);}(_0x31b5,0x159));var _0x531b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x31b5[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x531b('0x0'));var path=require(_0x531b('0x1'));var _=require(_0x531b('0x2'));var fs=require('fs');var json2xls=require(_0x531b('0x3'));var BPromise=require(_0x531b('0x4'));var zipdir=require(_0x531b('0x5'));var rimraf=require('rimraf');var db=require(_0x531b('0x6'))['db'];var dbH=require(_0x531b('0x6'))[_0x531b('0x7')];var logger=require(_0x531b('0x8'))(_0x531b('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x531b('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x252caf,_0x513a12){var _0x3c4230={'status':_0x252caf};var _0x353a64={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x513a12){_0x3c4230[_0x531b('0xb')]=_0x513a12;}return db[_0x531b('0xc')][_0x531b('0xd')](_0x3c4230,_0x353a64);}function main(){var _0x5bf8e1=0x1388;var _0x5a1479;logger[_0x531b('0xe')](util['format'](_0x531b('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x531b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x531b('0x11'),_0x531b('0x12')]})[_0x531b('0x13')](function(_0x12fdb6){if(_0x12fdb6){_0x5a1479=_0x12fdb6;_0x5bf8e1=_0x5a1479[_0x531b('0x12')]||0x1388;}})[_0x531b('0x13')](function(){return dbH['sequelize'][_0x531b('0x14')](util['format'](_0x531b('0x15'),QUERY),{'type':dbH[_0x531b('0x16')]['QueryTypes'][_0x531b('0x17')]});})[_0x531b('0x13')](function(_0x26512d){if(!_0x26512d[0x0]['num']){return analyticExtractedReport('Empty');}var _0x2c8924=[];var _0x3b56eb=0x0;if(_0x5a1479[_0x531b('0x11')]){if(_0x26512d&&_0x26512d[_0x531b('0x18')]){var _0x4a6051=_['range'](_0x26512d[0x0]['num']/_0x5bf8e1);var _0x3e9e0f=Number[_0x531b('0x19')](_0x26512d[0x0][_0x531b('0x1a')]/_0x5bf8e1)?_0x26512d[0x0][_0x531b('0x1a')]%_0x5bf8e1:0x0;_0x4a6051['forEach'](function(_0x2b252e){if(_0x2b252e>0x0){_0x3b56eb+=_0x5bf8e1;}_0x2c8924[_0x531b('0x1b')](dbH[_0x531b('0x16')]['query'](util[_0x531b('0x1c')](_0x531b('0x1d'),QUERY,_0x5bf8e1,_0x3b56eb),{'type':dbH[_0x531b('0x16')][_0x531b('0x1e')][_0x531b('0x17')]}));});if(_0x3e9e0f>0x0){_0x3b56eb+=_0x5bf8e1;_0x2c8924['push'](dbH['sequelize'][_0x531b('0x14')](util[_0x531b('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3e9e0f,_0x3b56eb),{'type':dbH[_0x531b('0x16')][_0x531b('0x1e')][_0x531b('0x17')]}));}}}else{_0x2c8924[_0x531b('0x1b')](dbH['sequelize'][_0x531b('0x14')](QUERY,{'type':dbH[_0x531b('0x16')][_0x531b('0x1e')][_0x531b('0x17')]}));}var _0x55d7ad=path[_0x531b('0x1f')](PATH);var _0x13455=path[_0x531b('0x20')](PATH,_0x531b('0x21'));var _0x437fd9=_0x5a1479[_0x531b('0x11')]&&_0x2c8924[_0x531b('0x18')]>0x1;var _0x3c9b6a=[];if(!fs['existsSync'](path[_0x531b('0x22')](_0x55d7ad,_0x13455))&&_0x437fd9){fs[_0x531b('0x23')](path[_0x531b('0x22')](_0x55d7ad,_0x13455));}return BPromise[_0x531b('0x24')](_0x2c8924,function(_0x408e26){_0x3c9b6a[_0x531b('0x1b')](_0x408e26);})[_0x531b('0x13')](function(){for(var _0x4e5482=0x0;_0x4e5482<_0x3c9b6a[_0x531b('0x18')];_0x4e5482+=0x1){var _0x7cc6ff;var _0x3d1068=_0x3c9b6a[_0x4e5482];if(_0x437fd9){_0x7cc6ff=path['join'](_0x55d7ad,_0x13455,util['format']('%s%d.%s',_0x13455,_0x4e5482,'xlsx'));}else{_0x7cc6ff=path['join'](_0x55d7ad,util['format'](_0x531b('0x25'),_0x13455,_0x531b('0x26')));}fs['writeFileSync'](_0x7cc6ff,json2xls(_0x3d1068),_0x531b('0x27'));}})[_0x531b('0x13')](function(){if(_0x437fd9){return new Promise(function(_0x241833){zipdir(path['join'](_0x55d7ad,_0x13455),{'saveTo':path[_0x531b('0x22')](_0x55d7ad,util['format']('%s.%s',_0x13455,_0x531b('0x28')))},function(_0x368b17,_0x2c1bf3){rimraf(path[_0x531b('0x22')](_0x55d7ad,_0x13455),function(){});_0x241833('zip\x20finished');});});}})['then'](function(){logger[_0x531b('0xe')](util['format'](_0x531b('0x29'),EXTRACTED_REPORT_ID,_0x531b('0x2a')));return analyticExtractedReport(_0x531b('0x2b'),_0x437fd9?util[_0x531b('0x1c')](_0x531b('0x25'),_0x13455,_0x437fd9?_0x531b('0x28'):_0x531b('0x26')):null);});})[_0x531b('0x2c')](function(_0x47216a){logger['info'](util[_0x531b('0x1c')](_0x531b('0x2d'),EXTRACTED_REPORT_ID,_0x531b('0x2a')),util[_0x531b('0x2e')](_0x47216a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x531b('0x2f'));})[_0x531b('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa19c=['xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','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','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','mkdirSync','each','%s.%s','writeFileSync','binary','join','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x8c89f1,_0x31cc85){var _0x553c85=function(_0x28df6a){while(--_0x28df6a){_0x8c89f1['push'](_0x8c89f1['shift']());}};_0x553c85(++_0x31cc85);}(_0xa19c,0xce));var _0xca19=function(_0x48fa89,_0x40bb61){_0x48fa89=_0x48fa89-0x0;var _0x1d9aeb=_0xa19c[_0x48fa89];return _0x1d9aeb;};'use strict';var util=require(_0xca19('0x0'));var path=require(_0xca19('0x1'));var _=require(_0xca19('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xca19('0x3'));var rimraf=require('rimraf');var db=require(_0xca19('0x4'))['db'];var dbH=require(_0xca19('0x4'))[_0xca19('0x5')];var logger=require(_0xca19('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xca19('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xca19('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x494aa7,_0x100d00){var _0x4ce76e={'status':_0x494aa7};var _0x29b5e1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x100d00){_0x4ce76e[_0xca19('0x8')]=_0x100d00;}return db[_0xca19('0x9')][_0xca19('0xa')](_0x4ce76e,_0x29b5e1);}function main(){var _0x4360e1=0x1388;var _0x53f1cf;logger[_0xca19('0xb')](util[_0xca19('0xc')](_0xca19('0xd'),EXTRACTED_REPORT_ID,_0xca19('0xe')));return db[_0xca19('0xf')][_0xca19('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xca19('0x11'),_0xca19('0x12')]})[_0xca19('0x13')](function(_0x1389ce){if(_0x1389ce){_0x53f1cf=_0x1389ce;_0x4360e1=_0x53f1cf[_0xca19('0x12')]||0x1388;}})['then'](function(){return dbH[_0xca19('0x14')][_0xca19('0x15')](util[_0xca19('0xc')](_0xca19('0x16'),QUERY),{'type':dbH[_0xca19('0x14')][_0xca19('0x17')][_0xca19('0x18')]});})[_0xca19('0x13')](function(_0x19cae1){if(!_0x19cae1[0x0][_0xca19('0x19')]){return analyticExtractedReport(_0xca19('0x1a'));}var _0x28c04e=[];var _0x191ef5=0x0;if(_0x53f1cf['split']){if(_0x19cae1&&_0x19cae1[_0xca19('0x1b')]){var _0x2c65f1=_[_0xca19('0x1c')](_0x19cae1[0x0][_0xca19('0x19')]/_0x4360e1);var _0xc81f09=Number['isInteger'](_0x19cae1[0x0]['num']/_0x4360e1)?_0x19cae1[0x0][_0xca19('0x19')]%_0x4360e1:0x0;_0x2c65f1[_0xca19('0x1d')](function(_0x329761){if(_0x329761>0x0){_0x191ef5+=_0x4360e1;}_0x28c04e[_0xca19('0x1e')](dbH[_0xca19('0x14')][_0xca19('0x15')](util['format'](_0xca19('0x1f'),QUERY,_0x4360e1,_0x191ef5),{'type':dbH[_0xca19('0x14')][_0xca19('0x17')][_0xca19('0x18')]}));});if(_0xc81f09>0x0){_0x191ef5+=_0x4360e1;_0x28c04e[_0xca19('0x1e')](dbH[_0xca19('0x14')][_0xca19('0x15')](util[_0xca19('0xc')](_0xca19('0x1f'),QUERY,_0xc81f09,_0x191ef5),{'type':dbH[_0xca19('0x14')][_0xca19('0x17')][_0xca19('0x18')]}));}}}else{_0x28c04e[_0xca19('0x1e')](dbH[_0xca19('0x14')][_0xca19('0x15')](QUERY,{'type':dbH[_0xca19('0x14')][_0xca19('0x17')][_0xca19('0x18')]}));}var _0x9d545c=path[_0xca19('0x20')](PATH);var _0x321b23=path[_0xca19('0x21')](PATH,_0xca19('0x22'));var _0x51544f=_0x53f1cf[_0xca19('0x11')]&&_0x28c04e[_0xca19('0x1b')]>0x1;var _0x5bf442=[];if(!fs['existsSync'](path['join'](_0x9d545c,_0x321b23))&&_0x51544f){fs[_0xca19('0x23')](path['join'](_0x9d545c,_0x321b23));}return BPromise[_0xca19('0x24')](_0x28c04e,function(_0x237dd9){_0x5bf442[_0xca19('0x1e')](_0x237dd9);})[_0xca19('0x13')](function(){for(var _0x557388=0x0;_0x557388<_0x5bf442['length'];_0x557388+=0x1){var _0x2370da;var _0x1750ce=_0x5bf442[_0x557388];if(_0x51544f){_0x2370da=path['join'](_0x9d545c,_0x321b23,util[_0xca19('0xc')]('%s%d.%s',_0x321b23,_0x557388,'xlsx'));}else{_0x2370da=path['join'](_0x9d545c,util[_0xca19('0xc')](_0xca19('0x25'),_0x321b23,'xlsx'));}fs[_0xca19('0x26')](_0x2370da,json2xls(_0x1750ce),_0xca19('0x27'));}})['then'](function(){if(_0x51544f){return new Promise(function(_0x2decd1){zipdir(path[_0xca19('0x28')](_0x9d545c,_0x321b23),{'saveTo':path['join'](_0x9d545c,util[_0xca19('0xc')]('%s.%s',_0x321b23,_0xca19('0x29')))},function(_0x118312,_0x1c83d0){rimraf(path[_0xca19('0x28')](_0x9d545c,_0x321b23),function(){});_0x2decd1('zip\x20finished');});});}})[_0xca19('0x13')](function(){logger[_0xca19('0xb')](util['format'](_0xca19('0x2a'),EXTRACTED_REPORT_ID,_0xca19('0xe')));return analyticExtractedReport(_0xca19('0x2b'),_0x51544f?util[_0xca19('0xc')]('%s.%s',_0x321b23,_0x51544f?_0xca19('0x29'):_0xca19('0x2c')):null);});})[_0xca19('0x2d')](function(_0x557f91){logger[_0xca19('0xb')](util[_0xca19('0xc')](_0xca19('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xca19('0x2f')](_0x557f91,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xca19('0x30')](function(){process[_0xca19('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 716a675..cebe906 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 _0xb23b=['outbound','extensions','cutdigits','${EXTEN:','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','find','push','type','Set','format','CDR(type)=%s','context','inbound'];(function(_0x2123cf,_0x1481f6){var _0x349178=function(_0xe553d9){while(--_0xe553d9){_0x2123cf['push'](_0x2123cf['shift']());}};_0x349178(++_0x1481f6);}(_0xb23b,0xb5));var _0xbb23=function(_0x230628,_0x4b01f9){_0x230628=_0x230628-0x0;var _0xd221b1=_0xb23b[_0x230628];return _0xd221b1;};'use strict';var _=require(_0xbb23('0x0'));var util=require(_0xbb23('0x1'));function rewrite(_0x402e8d,_0xcd9118){var _0x618a27=this;return _0x402e8d[_0xbb23('0x2')][_0xbb23('0x3')][_0xbb23('0x4')]({'raw':!![]})[_0xbb23('0x5')](function(_0x188540){_0x618a27['intervals']=_0x188540;return _0x402e8d['models'][_0xbb23('0x6')]['findAll']({'where':{'IntervalId':_0xcd9118[_0xbb23('0x7')]},'raw':!![]});})[_0xbb23('0x5')](function(_0x3cfcb6){return _0x402e8d[_0xbb23('0x2')][_0xbb23('0x6')][_0xbb23('0x4')]({'where':{'exten':{'$in':_[_0xbb23('0x8')](_[_0xbb23('0x9')](_0x3cfcb6,_0xbb23('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xbb23('0x5')](function(_0x209b9f){var _0x4cd680=_[_0xbb23('0xb')](_0x209b9f,{'priority':'1'});var _0x4dbe6a=_[_0xbb23('0xb')](_0x209b9f,{'isApp':0x1});var _0x20c0fb=_[_0xbb23('0xc')](_0x4dbe6a,_0xbb23('0xa'));var _0xb6e312=[_0xbb23('0xd'),_0xbb23('0xe')];var _0x48caa1=[];var _0x13b361=[];for(var _0x4eecd1 in _0x20c0fb){if(_0x20c0fb[_0xbb23('0xf')](_0x4eecd1)){_0x618a27[_0xbb23('0x10')]=0x2;_0x618a27['extensions']=[];_0x618a27[_0xbb23('0x11')]=_[_0xbb23('0x12')](_0x4cd680,{'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')]});_0x618a27['extensions'][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':_0xbb23('0x15'),'appdata':util[_0xbb23('0x16')](_0xbb23('0x17'),_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')]),'context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0]['VoiceExtensionId']});if(_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')]===_0xbb23('0x19')){_0x618a27['extensions'][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':_0xbb23('0x15'),'appdata':'CDR(routeid)='+_0x20c0fb[_0x4eecd1][0x0]['VoiceExtensionId'],'context':_0x20c0fb[_0x4eecd1][0x0]['context'],'exten':_0x20c0fb[_0x4eecd1][0x0]['exten'],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0]['VoiceExtensionId']});}else if(_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')]===_0xbb23('0x1a')){if(_0x618a27[_0xbb23('0x11')]){_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0]['type'],'app':_0xbb23('0x15'),'appdata':'CDR(destination)='+(_0x618a27[_0xbb23('0x11')][_0xbb23('0x1c')]?_0xbb23('0x1d')+_0x618a27['extension'][_0xbb23('0x1c')]+'}':'${EXTEN}'),'context':_0x20c0fb[_0x4eecd1][0x0]['context'],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});}_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0]['type'],'app':_0xbb23('0x15'),'appdata':_0xbb23('0x1f')+_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')],'context':_0x20c0fb[_0x4eecd1][0x0]['context'],'exten':_0x20c0fb[_0x4eecd1][0x0]['exten'],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0]['VoiceExtensionId']});var _0x31f0d0=_0x618a27[_0xbb23('0x10')]++;_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':_0xbb23('0x20'),'appdata':_0xbb23('0x21')+(_0x31f0d0+0x2)+_0xbb23('0x22')+(_0x31f0d0+0x1)+')','context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x31f0d0,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});if(_0x618a27[_0xbb23('0x11')]){_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':_0xbb23('0x15'),'appdata':_0x618a27[_0xbb23('0x11')][_0xbb23('0x1c')]?_0xbb23('0x23')+_0x618a27[_0xbb23('0x11')][_0xbb23('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0]['VoiceExtensionId']});}_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0]['type'],'app':_0xbb23('0x15'),'appdata':'outboundrouteid='+_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')],'context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27['priority']++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});if(_0x618a27['extension']&&_0x618a27[_0xbb23('0x11')][_0xbb23('0xf')](_0xbb23('0x24'))&&_0x618a27[_0xbb23('0x11')][_0xbb23('0x24')]!==_0xbb23('0x25')){_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0]['type'],'app':_0xbb23('0x15'),'appdata':_0xbb23('0x26'),'context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27['priority']++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});_0x618a27['extensions'][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':_0xbb23('0x15'),'appdata':_0xbb23('0x27')+_0x618a27['extension'][_0xbb23('0x24')]||'wav','context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});}}_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0]['VoiceExtensionId']});_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':'Set','appdata':_0xbb23('0x28'),'context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0]['exten'],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});_0x618a27[_0xbb23('0x1b')]['push']({'type':_0x20c0fb[_0x4eecd1][0x0]['type'],'app':_0xbb23('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'exten':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0xa')],'priority':_0x618a27[_0xbb23('0x10')]++,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});for(var _0x4bef3c=0x0,_0x39c993=0x0;_0x4bef3c<_0x20c0fb[_0x4eecd1][_0xbb23('0x29')];_0x4bef3c+=0x1,_0x39c993=0x0){var _0x5a4631=_0x20c0fb[_0x4eecd1][_0x4bef3c];if(_0x5a4631[_0xbb23('0x14')]){_0x5a4631[_0xbb23('0x14')]=_0x5a4631[_0xbb23('0x14')][_0xbb23('0x2a')]();}var _0x405040=[];var _0x52e9a6=[];delete _0x5a4631['id'];delete _0x5a4631[_0xbb23('0x2b')];delete _0x5a4631[_0xbb23('0x2c')];var _0x188158=_0x5a4631[_0xbb23('0x2d')]!=='*,*,*,*'?[_0x5a4631[_0xbb23('0x2d')]]:_0x5a4631['IntervalId']?_[_0xbb23('0x9')](_['filter'](_0x618a27[_0xbb23('0x2e')],{'IntervalId':_0x5a4631[_0xbb23('0x7')]}),_0xbb23('0x2d')):[];if(_0x5a4631[_0xbb23('0xf')](_0xbb23('0x2f'))){if(_0x5a4631[_0xbb23('0x2f')]&&_0x5a4631[_0xbb23('0x2f')]!=='--'){_0x405040[_0xbb23('0x13')]({'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x15'),'appdata':_0xbb23('0x30')+_0x5a4631[_0xbb23('0x2f')],'context':_0x5a4631[_0xbb23('0x18')],'exten':_0x5a4631['exten'],'priority':_0x188158[_0xbb23('0x29')]+_0x618a27[_0xbb23('0x10')]+_0x39c993++,'VoiceExtensionId':_0x5a4631[_0xbb23('0x1e')]});}}if(_0x5a4631[_0xbb23('0x14')]==='outbound'&&_0x5a4631[_0xbb23('0xf')](_0xbb23('0x31'))){if(_0x5a4631[_0xbb23('0x31')]){_0x405040['push']({'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5a4631['callerID']+')','context':_0x5a4631[_0xbb23('0x18')],'exten':_0x5a4631['exten'],'priority':_0x188158[_0xbb23('0x29')]+_0x618a27[_0xbb23('0x10')]+_0x39c993++,'VoiceExtensionId':_0x5a4631[_0xbb23('0x1e')]});}else{_0x405040[_0xbb23('0x13')]({'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x20'),'appdata':_0xbb23('0x32'),'context':_0x5a4631[_0xbb23('0x18')],'exten':_0x5a4631[_0xbb23('0xa')],'priority':_0x188158[_0xbb23('0x29')]+_0x618a27[_0xbb23('0x10')]+_0x39c993++,'VoiceExtensionId':_0x5a4631['VoiceExtensionId']});}}if(_0x5a4631[_0xbb23('0xf')](_0xbb23('0x33'))){if(_0xb6e312['indexOf'](_0x5a4631['app'][_0xbb23('0x2a')]())>=0x0&&_0x5a4631[_0xbb23('0x34')]!==_0xbb23('0x35')){if(_0x5a4631[_0xbb23('0x33')]){_0x405040[_0xbb23('0x13')]({'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x20'),'appdata':_0xbb23('0x36'),'context':_0x5a4631[_0xbb23('0x18')],'exten':_0x5a4631[_0xbb23('0xa')],'priority':_0x188158[_0xbb23('0x29')]+_0x618a27[_0xbb23('0x10')]+_0x39c993++,'VoiceExtensionId':_0x5a4631[_0xbb23('0x1e')]});_0x405040['push']({'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x15'),'appdata':_0xbb23('0x37'),'context':_0x5a4631['context'],'exten':_0x5a4631[_0xbb23('0xa')],'priority':_0x188158['length']+_0x618a27['priority']+_0x39c993++,'VoiceExtensionId':_0x5a4631['VoiceExtensionId']});}else{_0x405040[_0xbb23('0x13')]({'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x20'),'appdata':_0xbb23('0x38'),'context':_0x5a4631[_0xbb23('0x18')],'exten':_0x5a4631[_0xbb23('0xa')],'priority':_0x188158[_0xbb23('0x29')]+_0x618a27[_0xbb23('0x10')]+_0x39c993++,'VoiceExtensionId':_0x5a4631[_0xbb23('0x1e')]});_0x405040['push']({'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x15'),'appdata':_0xbb23('0x39'),'context':_0x5a4631['context'],'exten':_0x5a4631[_0xbb23('0xa')],'priority':_0x188158[_0xbb23('0x29')]+_0x618a27[_0xbb23('0x10')]+_0x39c993++,'VoiceExtensionId':_0x5a4631[_0xbb23('0x1e')]});}}}for(var _0x457ec2=0x0;_0x457ec2<_0x188158[_0xbb23('0x29')];_0x457ec2+=0x1){var _0x333b58=_0x618a27[_0xbb23('0x10')]+_0x188158[_0xbb23('0x29')];var _0x297ef6=_0x457ec2===_0x188158[_0xbb23('0x29')]-0x1?_0x618a27[_0xbb23('0x10')]+_0x405040[_0xbb23('0x29')]+_0x52e9a6['length']+0x2:_0x618a27['priority']+_0x457ec2+0x1;_0x405040[_0xbb23('0x3a')](_0x457ec2,0x0,{'type':_0x5a4631[_0xbb23('0x14')],'app':_0xbb23('0x3b'),'appdata':_0x188158[_0x457ec2]+'?'+_0x5a4631['context']+_0xbb23('0x3c')+_0x333b58+':'+_0x5a4631['context']+_0xbb23('0x3c')+_0x297ef6,'exten':_0x5a4631['exten'],'context':_0x5a4631[_0xbb23('0x18')],'priority':_0x618a27['priority']+_0x457ec2,'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});}_0x5a4631['priority']=_0x405040[_0xbb23('0x29')]?_[_0xbb23('0x3d')](_0x405040)[_0xbb23('0x10')]+0x1:_0x618a27[_0xbb23('0x10')];_0x618a27[_0xbb23('0x10')]=(_0x52e9a6[_0xbb23('0x29')]?_[_0xbb23('0x3d')](_0x52e9a6)[_0xbb23('0x10')]:_0x5a4631[_0xbb23('0x10')])+0x1;_0x618a27['extensions']=_[_0xbb23('0x3e')](_0x618a27[_0xbb23('0x1b')],_0x405040,[_0x5a4631],_0x52e9a6);}_0x618a27[_0xbb23('0x1b')][_0xbb23('0x13')]({'type':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x14')],'app':_0xbb23('0x3f'),'exten':_0x20c0fb[_0x4eecd1][0x0]['exten'],'context':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x18')],'priority':_0x618a27['priority'],'VoiceExtensionId':_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]});_0x48caa1[_0xbb23('0x13')](_0x20c0fb[_0x4eecd1][0x0][_0xbb23('0x1e')]);_0x13b361=_[_0xbb23('0x3e')](_0x13b361,_0x618a27[_0xbb23('0x1b')]);}}return _0x402e8d[_0xbb23('0x40')](function(_0x369015){return _0x402e8d['models'][_0xbb23('0x6')][_0xbb23('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x48caa1}},'transaction':_0x369015})[_0xbb23('0x5')](function(_0x153f2b){return _0x402e8d[_0xbb23('0x2')][_0xbb23('0x6')]['bulkCreate'](_[_0xbb23('0x42')](_0x13b361,_0xbb23('0x10')),{'transaction':_0x369015});});});})['catch'](function(_0x39c11b){console[_0xbb23('0x43')](_0x39c11b);});}exports[_0xbb23('0x44')]=rewrite; \ No newline at end of file +var _0x7509=['inbound','context','outbound','extension','CDR(destination)=','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','*,*,*,*','interval','IntervalId','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','rewrite','util','then','VoiceExtension','findAll','models','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','find','extensions','push','Set','CDR(type)=%s','type','VoiceExtensionId'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7509,0x6e));var _0x9750=function(_0x4b2845,_0x554daa){_0x4b2845=_0x4b2845-0x0;var _0x1a66a6=_0x7509[_0x4b2845];return _0x1a66a6;};'use strict';var _=require('lodash');var util=require(_0x9750('0x0'));function rewrite(_0x3832a5,_0x5b9351){var _0x1c7f8e=this;return _0x3832a5['models']['Interval']['findAll']({'raw':!![]})[_0x9750('0x1')](function(_0x1699bc){_0x1c7f8e['intervals']=_0x1699bc;return _0x3832a5['models'][_0x9750('0x2')][_0x9750('0x3')]({'where':{'IntervalId':_0x5b9351['IntervalId']},'raw':!![]});})[_0x9750('0x1')](function(_0x48fdf2){return _0x3832a5[_0x9750('0x4')][_0x9750('0x2')][_0x9750('0x3')]({'where':{'exten':{'$in':_[_0x9750('0x5')](_[_0x9750('0x6')](_0x48fdf2,_0x9750('0x7')))}},'order':[{'raw':_0x9750('0x8')}],'raw':!![]});})['then'](function(_0x1769f7){var _0x2a4f8d=_[_0x9750('0x9')](_0x1769f7,{'priority':'1'});var _0x2f4bbe=_['filter'](_0x1769f7,{'isApp':0x1});var _0x183a9e=_[_0x9750('0xa')](_0x2f4bbe,_0x9750('0x7'));var _0x54b7c9=[_0x9750('0xb'),_0x9750('0xc')];var _0x1448a3=[];var _0x49a68f=[];for(var _0x5f3e71 in _0x183a9e){if(_0x183a9e[_0x9750('0xd')](_0x5f3e71)){_0x1c7f8e[_0x9750('0xe')]=0x2;_0x1c7f8e['extensions']=[];_0x1c7f8e['extension']=_[_0x9750('0xf')](_0x2a4f8d,{'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')]});_0x1c7f8e[_0x9750('0x10')][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0]['type'],'app':_0x9750('0x12'),'appdata':util['format'](_0x9750('0x13'),_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')]),'context':_0x183a9e[_0x5f3e71][0x0]['context'],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e[_0x9750('0xe')]++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});if(_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')]===_0x9750('0x16')){_0x1c7f8e[_0x9750('0x10')][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0]['type'],'app':_0x9750('0x12'),'appdata':'CDR(routeid)='+_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')],'context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e['priority']++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});}else if(_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')]===_0x9750('0x18')){if(_0x1c7f8e[_0x9750('0x19')]){_0x1c7f8e[_0x9750('0x10')][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':_0x9750('0x12'),'appdata':_0x9750('0x1a')+(_0x1c7f8e[_0x9750('0x19')]['cutdigits']?'${EXTEN:'+_0x1c7f8e[_0x9750('0x19')]['cutdigits']+'}':_0x9750('0x1b')),'context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e[_0x9750('0xe')]++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});}_0x1c7f8e[_0x9750('0x10')]['push']({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':'Set','appdata':'CDR(routeid)='+_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')],'context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e[_0x9750('0xe')]++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});var _0x205efc=_0x1c7f8e[_0x9750('0xe')]++;_0x1c7f8e['extensions'][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':'ExecIf','appdata':_0x9750('0x1c')+(_0x205efc+0x2)+_0x9750('0x1d')+(_0x205efc+0x1)+')','context':_0x183a9e[_0x5f3e71][0x0]['context'],'exten':_0x183a9e[_0x5f3e71][0x0]['exten'],'priority':_0x205efc,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});if(_0x1c7f8e['extension']){_0x1c7f8e[_0x9750('0x10')][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':_0x9750('0x12'),'appdata':_0x1c7f8e[_0x9750('0x19')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x1c7f8e['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0]['exten'],'priority':_0x1c7f8e[_0x9750('0xe')]++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0]['VoiceExtensionId']});}_0x1c7f8e['extensions']['push']({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':_0x9750('0x12'),'appdata':_0x9750('0x1e')+_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')],'context':_0x183a9e[_0x5f3e71][0x0]['context'],'exten':_0x183a9e[_0x5f3e71][0x0]['exten'],'priority':_0x1c7f8e['priority']++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0]['VoiceExtensionId']});if(_0x1c7f8e[_0x9750('0x19')]&&_0x1c7f8e['extension'][_0x9750('0xd')](_0x9750('0x1f'))&&_0x1c7f8e['extension'][_0x9750('0x1f')]!==_0x9750('0x20')){_0x1c7f8e[_0x9750('0x10')][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0]['type'],'app':'Set','appdata':_0x9750('0x21'),'context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e[_0x9750('0xe')]++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0]['VoiceExtensionId']});_0x1c7f8e[_0x9750('0x10')]['push']({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1c7f8e[_0x9750('0x19')][_0x9750('0x1f')]||'wav','context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e['priority']++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});}}_0x1c7f8e['extensions'][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0]['type'],'app':_0x9750('0x12'),'appdata':_0x9750('0x22'),'context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e[_0x9750('0xe')]++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0]['VoiceExtensionId']});_0x1c7f8e[_0x9750('0x10')][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0]['type'],'app':_0x9750('0x12'),'appdata':_0x9750('0x23'),'context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e[_0x9750('0xe')]++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0]['VoiceExtensionId']});_0x1c7f8e[_0x9750('0x10')]['push']({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':'Set','appdata':_0x9750('0x24'),'context':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x17')],'exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'priority':_0x1c7f8e['priority']++,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0]['VoiceExtensionId']});for(var _0x2f59c6=0x0,_0x32fffa=0x0;_0x2f59c6<_0x183a9e[_0x5f3e71][_0x9750('0x25')];_0x2f59c6+=0x1,_0x32fffa=0x0){var _0x117ca0=_0x183a9e[_0x5f3e71][_0x2f59c6];if(_0x117ca0['type']){_0x117ca0[_0x9750('0x14')]=_0x117ca0[_0x9750('0x14')]['toLowerCase']();}var _0x4f2084=[];var _0x58cc35=[];delete _0x117ca0['id'];delete _0x117ca0[_0x9750('0x26')];delete _0x117ca0['updatedAt'];var _0x4e80b5=_0x117ca0['interval']!==_0x9750('0x27')?[_0x117ca0[_0x9750('0x28')]]:_0x117ca0[_0x9750('0x29')]?_['map'](_[_0x9750('0x9')](_0x1c7f8e[_0x9750('0x2a')],{'IntervalId':_0x117ca0[_0x9750('0x29')]}),'interval'):[];if(_0x117ca0[_0x9750('0xd')](_0x9750('0x2b'))){if(_0x117ca0['tag']&&_0x117ca0[_0x9750('0x2b')]!=='--'){_0x4f2084['push']({'type':_0x117ca0[_0x9750('0x14')],'app':_0x9750('0x12'),'appdata':_0x9750('0x2c')+_0x117ca0[_0x9750('0x2b')],'context':_0x117ca0['context'],'exten':_0x117ca0[_0x9750('0x7')],'priority':_0x4e80b5[_0x9750('0x25')]+_0x1c7f8e['priority']+_0x32fffa++,'VoiceExtensionId':_0x117ca0['VoiceExtensionId']});}}if(_0x117ca0[_0x9750('0x14')]===_0x9750('0x18')&&_0x117ca0[_0x9750('0xd')](_0x9750('0x2d'))){if(_0x117ca0[_0x9750('0x2d')]){_0x4f2084['push']({'type':_0x117ca0[_0x9750('0x14')],'app':_0x9750('0x2e'),'appdata':_0x9750('0x2f')+_0x117ca0[_0x9750('0x2d')]+')','context':_0x117ca0[_0x9750('0x17')],'exten':_0x117ca0[_0x9750('0x7')],'priority':_0x4e80b5[_0x9750('0x25')]+_0x1c7f8e['priority']+_0x32fffa++,'VoiceExtensionId':_0x117ca0[_0x9750('0x15')]});}else{_0x4f2084[_0x9750('0x11')]({'type':_0x117ca0[_0x9750('0x14')],'app':_0x9750('0x2e'),'appdata':_0x9750('0x30'),'context':_0x117ca0[_0x9750('0x17')],'exten':_0x117ca0[_0x9750('0x7')],'priority':_0x4e80b5[_0x9750('0x25')]+_0x1c7f8e[_0x9750('0xe')]+_0x32fffa++,'VoiceExtensionId':_0x117ca0[_0x9750('0x15')]});}}if(_0x117ca0[_0x9750('0xd')](_0x9750('0x31'))){if(_0x54b7c9['indexOf'](_0x117ca0[_0x9750('0x32')][_0x9750('0x33')]())>=0x0&&_0x117ca0[_0x9750('0x34')]!==_0x9750('0x35')){if(_0x117ca0['answer']){_0x4f2084[_0x9750('0x11')]({'type':_0x117ca0[_0x9750('0x14')],'app':_0x9750('0x2e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x117ca0['context'],'exten':_0x117ca0[_0x9750('0x7')],'priority':_0x4e80b5[_0x9750('0x25')]+_0x1c7f8e[_0x9750('0xe')]+_0x32fffa++,'VoiceExtensionId':_0x117ca0[_0x9750('0x15')]});_0x4f2084[_0x9750('0x11')]({'type':_0x117ca0['type'],'app':_0x9750('0x12'),'appdata':_0x9750('0x36'),'context':_0x117ca0['context'],'exten':_0x117ca0[_0x9750('0x7')],'priority':_0x4e80b5['length']+_0x1c7f8e['priority']+_0x32fffa++,'VoiceExtensionId':_0x117ca0[_0x9750('0x15')]});}else{_0x4f2084['push']({'type':_0x117ca0[_0x9750('0x14')],'app':_0x9750('0x2e'),'appdata':_0x9750('0x37'),'context':_0x117ca0[_0x9750('0x17')],'exten':_0x117ca0[_0x9750('0x7')],'priority':_0x4e80b5[_0x9750('0x25')]+_0x1c7f8e[_0x9750('0xe')]+_0x32fffa++,'VoiceExtensionId':_0x117ca0[_0x9750('0x15')]});_0x4f2084[_0x9750('0x11')]({'type':_0x117ca0['type'],'app':_0x9750('0x12'),'appdata':_0x9750('0x38'),'context':_0x117ca0['context'],'exten':_0x117ca0[_0x9750('0x7')],'priority':_0x4e80b5[_0x9750('0x25')]+_0x1c7f8e[_0x9750('0xe')]+_0x32fffa++,'VoiceExtensionId':_0x117ca0[_0x9750('0x15')]});}}}for(var _0x1aca3d=0x0;_0x1aca3d<_0x4e80b5[_0x9750('0x25')];_0x1aca3d+=0x1){var _0x4dca86=_0x1c7f8e['priority']+_0x4e80b5['length'];var _0x570bbe=_0x1aca3d===_0x4e80b5[_0x9750('0x25')]-0x1?_0x1c7f8e[_0x9750('0xe')]+_0x4f2084[_0x9750('0x25')]+_0x58cc35['length']+0x2:_0x1c7f8e['priority']+_0x1aca3d+0x1;_0x4f2084[_0x9750('0x39')](_0x1aca3d,0x0,{'type':_0x117ca0[_0x9750('0x14')],'app':'GotoIfTime','appdata':_0x4e80b5[_0x1aca3d]+'?'+_0x117ca0[_0x9750('0x17')]+',${EXTEN},'+_0x4dca86+':'+_0x117ca0[_0x9750('0x17')]+_0x9750('0x3a')+_0x570bbe,'exten':_0x117ca0['exten'],'context':_0x117ca0[_0x9750('0x17')],'priority':_0x1c7f8e[_0x9750('0xe')]+_0x1aca3d,'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});}_0x117ca0[_0x9750('0xe')]=_0x4f2084['length']?_['last'](_0x4f2084)['priority']+0x1:_0x1c7f8e[_0x9750('0xe')];_0x1c7f8e[_0x9750('0xe')]=(_0x58cc35[_0x9750('0x25')]?_[_0x9750('0x3b')](_0x58cc35)[_0x9750('0xe')]:_0x117ca0['priority'])+0x1;_0x1c7f8e[_0x9750('0x10')]=_[_0x9750('0x3c')](_0x1c7f8e[_0x9750('0x10')],_0x4f2084,[_0x117ca0],_0x58cc35);}_0x1c7f8e[_0x9750('0x10')][_0x9750('0x11')]({'type':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x14')],'app':'Hangup','exten':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x7')],'context':_0x183a9e[_0x5f3e71][0x0]['context'],'priority':_0x1c7f8e[_0x9750('0xe')],'VoiceExtensionId':_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]});_0x1448a3[_0x9750('0x11')](_0x183a9e[_0x5f3e71][0x0][_0x9750('0x15')]);_0x49a68f=_[_0x9750('0x3c')](_0x49a68f,_0x1c7f8e['extensions']);}}return _0x3832a5['transaction'](function(_0x217d49){return _0x3832a5['models'][_0x9750('0x2')][_0x9750('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x1448a3}},'transaction':_0x217d49})[_0x9750('0x1')](function(_0x22004e){return _0x3832a5['models'][_0x9750('0x2')][_0x9750('0x3e')](_[_0x9750('0x3f')](_0x49a68f,_0x9750('0xe')),{'transaction':_0x217d49});});});})[_0x9750('0x40')](function(_0x2a1d88){console['error'](_0x2a1d88);});}exports[_0x9750('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2ef3667..486b2d9 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 _0xdfaf=['ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','isNil','error','errors','length','map','message','join','data','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','create','push','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','ListId','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper','cm_hopper_black','ListId\x20=\x20?','str','VoiceQueue','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','BlackLists','Campaign','CampaignId','stringify','finally','emit','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','papaparse'];(function(_0x340b61,_0x457204){var _0x2640f2=function(_0x15e1cf){while(--_0x15e1cf){_0x340b61['push'](_0x340b61['shift']());}};_0x2640f2(++_0x457204);}(_0xdfaf,0xd1));var _0xfdfa=function(_0x21e1a4,_0x3f8326){_0x21e1a4=_0x21e1a4-0x0;var _0x30e56b=_0xdfaf[_0x21e1a4];return _0x30e56b;};'use strict';var BPromise=require('bluebird');var util=require(_0xfdfa('0x0'));var _=require(_0xfdfa('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xfdfa('0x2'));var Redis=require(_0xfdfa('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xfdfa('0x4'));var logger=require(_0xfdfa('0x5'))(_0xfdfa('0x6'));config['redis']=_[_0xfdfa('0x7')](config[_0xfdfa('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdfa('0x9'))(new Redis(config[_0xfdfa('0x8')]));require(_0xfdfa('0xa'))[_0xfdfa('0xb')](socket);try{if(!process[_0xfdfa('0xc')][0x2]||process[_0xfdfa('0xc')][0x2]===_0xfdfa('0xd')||process[_0xfdfa('0xc')][0x2]==='null'){throw new Error(_0xfdfa('0xe'));}var FILEPATH=process[_0xfdfa('0xc')][0x2];if(!process['argv'][0x3]||process[_0xfdfa('0xc')][0x3]===_0xfdfa('0xd')||process[_0xfdfa('0xc')][0x3]===_0xfdfa('0xf')||!process[_0xfdfa('0xc')][0x4]||process[_0xfdfa('0xc')][0x4]==='undefined'||process[_0xfdfa('0xc')][0x4]===_0xfdfa('0xf')){throw new Error(_0xfdfa('0x10'));}var FIELDS=_['zipObject'](process[_0xfdfa('0xc')][0x3]['split'](','),process[_0xfdfa('0xc')][0x4][_0xfdfa('0x11')](','));if(!process['argv'][0x5]||process[_0xfdfa('0xc')][0x5]===_0xfdfa('0xd')||process[_0xfdfa('0xc')][0x5]==='null'){throw new Error(_0xfdfa('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xfdfa('0xc')][0x6]&&process['argv'][0x6]!==_0xfdfa('0xd')&&process[_0xfdfa('0xc')][0x6]!==_0xfdfa('0xf')?process[_0xfdfa('0xc')][0x6]:null;var DUPLICATES=process[_0xfdfa('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xfdfa('0xc')][0x7]!==_0xfdfa('0xf')?process[_0xfdfa('0xc')][0x7]:null;if(!process[_0xfdfa('0xc')][0x8]||process[_0xfdfa('0xc')][0x8]===_0xfdfa('0xd')||process[_0xfdfa('0xc')][0x8]===_0xfdfa('0xf')){throw new Error(_0xfdfa('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x49b6be){logger['error'](_0x49b6be);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(_0x1420b1,_0x310663,_0x8e189c,_0x22217e){var _0x540e9d={'message':_0x310663};_0x540e9d[_0x1420b1]=!![];if(_0x8e189c){_0x540e9d[_0xfdfa('0x14')]=_0x8e189c;}if(_0x22217e){_0x540e9d[_0xfdfa('0x15')]=_0x22217e;}return _0x540e9d;}function isEmail(_0x580d89){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'](_0x580d89);}function checkRow(_0x1bc449,_0x10f0e7,_0x1a6b36){return new BPromise(function(_0x27e2de,_0x2cb396){if(_[_0xfdfa('0x16')](_0x1bc449)){return _0x2cb396(handleCheckRowError(_0xfdfa('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x1a6b36));}if(_0x1bc449[_0xfdfa('0x18')]&&_0x1bc449['errors'][_0xfdfa('0x19')]){var _0x2183f8=_[_0xfdfa('0x1a')](_0x1bc449['errors'],_0xfdfa('0x1b'))[_0xfdfa('0x1c')](';');return _0x2cb396(handleCheckRowError('error',_0x2183f8,null,_0x1a6b36));}var _0x2e1002={};for(var _0x5b56b5 in FIELDS){if(FIELDS['hasOwnProperty'](_0x5b56b5)&&FIELDS[_0x5b56b5]){_0x2e1002[_0x5b56b5]=_0x1bc449[_0xfdfa('0x1d')][0x0][FIELDS[_0x5b56b5]]||_0x1bc449[_0xfdfa('0x1d')][0x0]['\ufeff'+FIELDS[_0x5b56b5]];}}if(!_0x2e1002['firstName']){return _0x2cb396(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x1a6b36));}if(!_0x2e1002[_0xfdfa('0x1e')]){return _0x2cb396(handleCheckRowError(_0xfdfa('0x17'),_0xfdfa('0x1f'),null,_0x1a6b36));}if(_0x2e1002[_0xfdfa('0x20')]){var _0x4b6d7a=moment(_0x2e1002[_0xfdfa('0x20')],'YYYY-MM-DD');if(!_0x4b6d7a[_0xfdfa('0x21')]()){return _0x2cb396(handleCheckRowError(_0xfdfa('0x17'),_0xfdfa('0x22'),null,_0x1a6b36));}}if(_0x2e1002['email']){if(!isEmail(_0x2e1002[_0xfdfa('0x23')])){return _0x2cb396(handleCheckRowError('error',_0xfdfa('0x24'),null,_0x1a6b36));}}_0x2e1002['ListId']=LISTID;_0x2e1002[_0xfdfa('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xfdfa('0x19')]&&_0x10f0e7){var _0x2337d9={};for(var _0x213632=0x0,_0x18a5de=DUPLICATES[_0xfdfa('0x19')];_0x213632<_0x18a5de;_0x213632+=0x1){_0x2337d9[DUPLICATES[_0x213632]]=_0x2e1002[DUPLICATES[_0x213632]];}var _0x44632c=_[_0xfdfa('0x26')](_0x10f0e7,_0x2337d9);if(_0x44632c){return _0x2cb396(handleCheckRowError(_0xfdfa('0x27'),_0xfdfa('0x28'),_0x44632c,_0x1a6b36));}}return db['CmContact'][_0xfdfa('0x29')](_0x2e1002,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2e1002)})['then'](function(_0x281c3d){if(DUPLICATES&&DUPLICATES['length']&&_0x10f0e7){_0x10f0e7[_0xfdfa('0x2a')](_['pick'](_0x2e1002,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x281c3d['id'];return _0x27e2de();})[_0xfdfa('0x2b')](function(_0x3fbc77){return _0x2cb396(handleCheckRowError(_0xfdfa('0x17'),_0xfdfa('0x2c')+(_0x3fbc77[_0xfdfa('0x1b')]||JSON['stringify'](_0x3fbc77)),null,_0x1a6b36));});});}function checkHopper(){function _0x10d868(){return function(_0x5cb8c6){logger[_0xfdfa('0x17')]('cmContact',_0xfdfa('0x2d'),util[_0xfdfa('0x2e')](_0x5cb8c6,{'showHidden':![],'depth':null}));};}var _0x595223=function(_0x272c95,_0x10cd00){var _0x249926=squel[_0xfdfa('0x2f')]()[_0xfdfa('0x30')]('cm_hopper')[_0xfdfa('0x31')]([_0xfdfa('0x1e'),_0xfdfa('0x32'),_0xfdfa('0x33'),'ListId',_0x10cd00,'createdAt',_0xfdfa('0x34')],squel[_0xfdfa('0x35')]()[_0xfdfa('0x36')](_0xfdfa('0x1e'),_0xfdfa('0x1e'))[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x32'))[_0xfdfa('0x36')]('id',_0xfdfa('0x33'))[_0xfdfa('0x36')](LISTID[_0xfdfa('0x38')](),_0xfdfa('0x39'))['field'](_0x272c95['id'][_0xfdfa('0x38')](),_0x10cd00)[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x3a'))[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x34'))[_0xfdfa('0x3b')](_0xfdfa('0x3c'))[_0xfdfa('0x3d')](_0xfdfa('0x3e'))[_0xfdfa('0x3d')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0xfdfa('0x3f'))[_0xfdfa('0x3d')](_0xfdfa('0x40'),squel[_0xfdfa('0x35')]()[_0xfdfa('0x36')](_0xfdfa('0x1e'))[_0xfdfa('0x3b')]('cm_hopper')[_0xfdfa('0x3d')](_0x10cd00+_0xfdfa('0x41'),_0x272c95['id'][_0xfdfa('0x38')]())))[_0xfdfa('0x38')]();return _0x249926;};var _0x34e975=function(_0x1d064f,_0x4365e8){var _0x1bfb12=squel['insert']()[_0xfdfa('0x30')]('cm_hopper')[_0xfdfa('0x31')]([_0xfdfa('0x1e'),_0xfdfa('0x32'),'ContactId','ListId',_0x4365e8,_0xfdfa('0x3a'),_0xfdfa('0x34')],squel[_0xfdfa('0x35')]()[_0xfdfa('0x36')](_0xfdfa('0x1e'),_0xfdfa('0x1e'))[_0xfdfa('0x36')]('NOW()',_0xfdfa('0x32'))[_0xfdfa('0x36')]('id',_0xfdfa('0x33'))[_0xfdfa('0x36')](LISTID[_0xfdfa('0x38')](),_0xfdfa('0x39'))['field'](_0x1d064f['id']['toString'](),_0x4365e8)[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x3a'))[_0xfdfa('0x36')]('NOW()',_0xfdfa('0x34'))['from'](_0xfdfa('0x3c'))[_0xfdfa('0x3d')](_0xfdfa('0x3e'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xfdfa('0x3d')](_0xfdfa('0x42'),squel['str'](hopperContacts))['where'](_0xfdfa('0x3f'))[_0xfdfa('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfdfa('0x35')]()['field'](_0xfdfa('0x43'))[_0xfdfa('0x3b')]('cm_hopper_final')[_0xfdfa('0x3d')](_0x4365e8+_0xfdfa('0x41'),_0x1d064f['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xfdfa('0x35')]()[_0xfdfa('0x36')](_0xfdfa('0x1e'))[_0xfdfa('0x3b')]('cm_hopper')[_0xfdfa('0x3d')](_0x4365e8+_0xfdfa('0x41'),_0x1d064f['id']['toString']())))[_0xfdfa('0x38')]();return _0x1bfb12;};function _0x3bc8d5(_0x2b7736,_0x5be3e2){var _0x5f50cd=squel[_0xfdfa('0x2f')]()[_0xfdfa('0x30')](_0xfdfa('0x44'))['fromQuery']([_0xfdfa('0x1e'),'scheduledAt','ContactId','ListId',_0x5be3e2,'createdAt',_0xfdfa('0x34')],squel[_0xfdfa('0x35')]()[_0xfdfa('0x36')](_0xfdfa('0x1e'),_0xfdfa('0x1e'))['field'](_0xfdfa('0x37'),_0xfdfa('0x32'))[_0xfdfa('0x36')]('id',_0xfdfa('0x33'))[_0xfdfa('0x36')](LISTID['toString'](),'ListId')[_0xfdfa('0x36')](_0x2b7736['id']['toString'](),_0x5be3e2)[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x3a'))[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x34'))['from'](_0xfdfa('0x3c'))[_0xfdfa('0x3d')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xfdfa('0x38')]())[_0xfdfa('0x3d')](_0xfdfa('0x42'),squel['str'](hopperContacts))[_0xfdfa('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0xfdfa('0x38')]();return _0x5f50cd;}function _0x590336(_0x558b77,_0x3c7ded){var _0x51fe24=squel[_0xfdfa('0x2f')]()[_0xfdfa('0x30')](_0xfdfa('0x45'))[_0xfdfa('0x31')]([_0xfdfa('0x1e'),_0xfdfa('0x33'),'ListId',_0x3c7ded,_0xfdfa('0x3a'),_0xfdfa('0x34')],squel[_0xfdfa('0x35')]()[_0xfdfa('0x36')](_0xfdfa('0x1e'),_0xfdfa('0x1e'))[_0xfdfa('0x36')]('id',_0xfdfa('0x33'))[_0xfdfa('0x36')](LISTID[_0xfdfa('0x38')](),_0xfdfa('0x39'))[_0xfdfa('0x36')](_0x558b77['id'][_0xfdfa('0x38')](),_0x3c7ded)[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x3a'))[_0xfdfa('0x36')](_0xfdfa('0x37'),_0xfdfa('0x34'))[_0xfdfa('0x3b')](_0xfdfa('0x3c'))[_0xfdfa('0x3d')]('deletedAt\x20IS\x20NULL')[_0xfdfa('0x3d')](_0xfdfa('0x46'),LISTID[_0xfdfa('0x38')]())[_0xfdfa('0x3d')](_0xfdfa('0x42'),squel[_0xfdfa('0x47')](hopperContacts))[_0xfdfa('0x3d')](_0xfdfa('0x3f')))[_0xfdfa('0x38')]();return _0x51fe24;}return db[_0xfdfa('0x48')][_0xfdfa('0x49')]({'where':{'type':_0xfdfa('0x4a')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xfdfa('0x4b')],'as':_0xfdfa('0x4c'),'where':{'id':LISTID}}]})[_0xfdfa('0x4d')](function(_0x416615){var _0x26eb31=[];if(_0x416615){var _0xd37f46;for(var _0x260590=0x0,_0x1fb3e6;_0x260590<_0x416615[_0xfdfa('0x19')];_0x260590+=0x1){_0x1fb3e6=_0x416615[_0x260590][_0xfdfa('0x4e')]({'plain':!![]});switch(_0x1fb3e6[_0xfdfa('0x4f')]){case _0xfdfa('0x50'):_0x26eb31[_0xfdfa('0x2a')](db[_0xfdfa('0x51')]['query'](_0x34e975(_0x1fb3e6,_0xfdfa('0x52')))[_0xfdfa('0x4d')](function(){})[_0xfdfa('0x2b')](_0x10d868()));break;case _0xfdfa('0x53'):_0x26eb31[_0xfdfa('0x2a')](db[_0xfdfa('0x51')][_0xfdfa('0x54')](_0x595223(_0x1fb3e6,_0xfdfa('0x52')))[_0xfdfa('0x4d')](function(){})[_0xfdfa('0x2b')](_0x10d868()));break;default:_0x26eb31['push'](db[_0xfdfa('0x51')][_0xfdfa('0x54')](_0x3bc8d5(_0x1fb3e6,_0xfdfa('0x52')))[_0xfdfa('0x4d')](function(){})[_0xfdfa('0x2b')](_0x10d868()));}}}return _0x26eb31;})[_0xfdfa('0x55')]()[_0xfdfa('0x4d')](function(){return db['VoiceQueue'][_0xfdfa('0x49')]({'where':{'type':_0xfdfa('0x4a')},'attributes':['id'],'include':[{'model':db[_0xfdfa('0x4b')],'as':_0xfdfa('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x1bca9f){var _0x207f38=[];if(_0x1bca9f){var _0xb678f9;for(var _0x2177aa=0x0,_0x552125;_0x2177aa<_0x1bca9f[_0xfdfa('0x19')];_0x2177aa+=0x1){_0x552125=_0x1bca9f[_0x2177aa][_0xfdfa('0x4e')]({'plain':!![]});_0x207f38['push'](db[_0xfdfa('0x51')][_0xfdfa('0x54')](_0x590336(_0x552125,'VoiceQueueId'))['then'](function(){})[_0xfdfa('0x2b')](_0x10d868()));}}return _0x207f38;})[_0xfdfa('0x55')]();})['then'](function(){return db[_0xfdfa('0x57')]['findAll']({'attributes':['id',_0xfdfa('0x4f')],'include':[{'model':db[_0xfdfa('0x4b')],'as':_0xfdfa('0x4c'),'where':{'id':LISTID}}]})[_0xfdfa('0x4d')](function(_0x16c763){var _0xfa82a1=[];if(_0x16c763){for(var _0x539b4d=0x0,_0x56c70e;_0x539b4d<_0x16c763[_0xfdfa('0x19')];_0x539b4d+=0x1){_0x56c70e=_0x16c763[_0x539b4d][_0xfdfa('0x4e')]({'plain':!![]});switch(_0x56c70e[_0xfdfa('0x4f')]){case _0xfdfa('0x50'):_0xfa82a1[_0xfdfa('0x2a')](db[_0xfdfa('0x51')][_0xfdfa('0x54')](_0x34e975(_0x56c70e,_0xfdfa('0x58')))[_0xfdfa('0x4d')](function(){})[_0xfdfa('0x2b')](_0x10d868()));break;case _0xfdfa('0x53'):_0xfa82a1[_0xfdfa('0x2a')](db[_0xfdfa('0x51')]['query'](_0x595223(_0x56c70e,_0xfdfa('0x58')))[_0xfdfa('0x4d')](function(){})[_0xfdfa('0x2b')](_0x10d868()));break;default:_0xfa82a1[_0xfdfa('0x2a')](db[_0xfdfa('0x51')][_0xfdfa('0x54')](_0x3bc8d5(_0x56c70e,_0xfdfa('0x58')))[_0xfdfa('0x4d')](function(){})[_0xfdfa('0x2b')](_0x10d868()));}}}return _0xfa82a1;})['all']();})['then'](function(){return db['Campaign'][_0xfdfa('0x49')]({'attributes':['id'],'include':[{'model':db[_0xfdfa('0x4b')],'as':_0xfdfa('0x56'),'where':{'id':LISTID}}]})[_0xfdfa('0x4d')](function(_0x51be39){var _0x260c6e=[];if(_0x51be39){for(var _0x2812d3=0x0,_0xd4a0cf;_0x2812d3<_0x51be39[_0xfdfa('0x19')];_0x2812d3+=0x1){_0xd4a0cf=_0x51be39[_0x2812d3][_0xfdfa('0x4e')]({'plain':!![]});_0x260c6e[_0xfdfa('0x2a')](db['sequelize']['query'](_0x590336(_0xd4a0cf,_0xfdfa('0x58')))['then'](function(){})[_0xfdfa('0x2b')](_0x10d868()));}}return _0x260c6e;})[_0xfdfa('0x55')]();})['catch'](function(_0x4273e1){logger[_0xfdfa('0x17')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x4273e1['message']);});}var processPromises=function(_0x50e03a){return BPromise['all'](promises)['then'](function(_0xe55e75){})[_0xfdfa('0x2b')](function(_0xae36ad){logger[_0xfdfa('0x17')]('Error\x20processing\x20rows\x20block:',JSON[_0xfdfa('0x59')](_0xae36ad));})[_0xfdfa('0x5a')](function(){socket[_0xfdfa('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x50e03a){return _0x50e03a['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0xfdfa('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0xfdfa('0x4d')](function(){socket[_0xfdfa('0x5b')](_0xfdfa('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x102480){logger[_0xfdfa('0x17')](_0xfdfa('0x5d'),JSON[_0xfdfa('0x59')](_0x102480));}finally{process[_0xfdfa('0x5e')](0x0);}});};process['on'](_0xfdfa('0x5f'),function(){logger[_0xfdfa('0x60')](_0xfdfa('0x61'));endCsv();});function main(){return BPromise[_0xfdfa('0x62')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xfdfa('0x11')](',');return db[_0xfdfa('0x63')][_0xfdfa('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xfdfa('0x4d')](function(_0xe6f030){var _0x1291cb=fs[_0xfdfa('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfdfa('0x65')](_0x1291cb,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2b3a4d,_0x31670e){total+=0x1;var _0xe3fc46=total;promises[_0xfdfa('0x2a')](checkRow(_0x2b3a4d,_0xe6f030,_0xe3fc46)[_0xfdfa('0x4d')](function(){success+=0x1;})[_0xfdfa('0x2b')](function(_0x529c27){if(_0x529c27['error']){errors+=0x1;delete _0x529c27['error'];}else if(_0x529c27[_0xfdfa('0x27')]){duplicates+=0x1;delete _0x529c27[_0xfdfa('0x27')];}rows[_0xfdfa('0x2a')](_0x529c27);}));if(total%0xc8===0x0){_0x31670e[_0xfdfa('0x66')]();return processPromises(_0x31670e);}},'complete':function(){return processPromises()[_0xfdfa('0x4d')](function(){logger[_0xfdfa('0x60')](_0xfdfa('0x67'));endCsv();});},'error':function(_0x127457,_0x61bb3a){logger[_0xfdfa('0x60')](_0xfdfa('0x68'),JSON[_0xfdfa('0x59')](_0x127457));endCsv();}});})['catch'](function(_0x5e2039){logger[_0xfdfa('0x17')](_0xfdfa('0x69'),JSON[_0xfdfa('0x59')](_0x5e2039));});}main(); \ No newline at end of file +var _0xd561=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','toString','cm_hopper','scheduledAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','then','onlyIfOpen','sequelize','query','VoiceQueueId','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','stringify','finally','contact:csv_','resume','resolve','emit','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','localhost','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','duplicate','Duplicate\x20Contact','CmContact','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','inspect','insert','into','fromQuery','createdAt','updatedAt','select','field','NOW()','ContactId','from','cm_contacts','where','deletedAt\x20IS\x20NULL'];(function(_0x3a0f09,_0x4f981b){var _0x46c463=function(_0x478914){while(--_0x478914){_0x3a0f09['push'](_0x3a0f09['shift']());}};_0x46c463(++_0x4f981b);}(_0xd561,0xfe));var _0x1d56=function(_0x388e5e,_0x58b4c4){_0x388e5e=_0x388e5e-0x0;var _0x2bebde=_0xd561[_0x388e5e];return _0x2bebde;};'use strict';var BPromise=require(_0x1d56('0x0'));var util=require(_0x1d56('0x1'));var _=require(_0x1d56('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x1d56('0x3'));var Redis=require(_0x1d56('0x4'));var db=require(_0x1d56('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x1d56('0x6'))(_0x1d56('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x1d56('0x8'),'port':0x18eb});var socket=require(_0x1d56('0x9'))(new Redis(config[_0x1d56('0xa')]));require(_0x1d56('0xb'))[_0x1d56('0xc')](socket);try{if(!process[_0x1d56('0xd')][0x2]||process['argv'][0x2]===_0x1d56('0xe')||process[_0x1d56('0xd')][0x2]===_0x1d56('0xf')){throw new Error(_0x1d56('0x10'));}var FILEPATH=process[_0x1d56('0xd')][0x2];if(!process[_0x1d56('0xd')][0x3]||process[_0x1d56('0xd')][0x3]===_0x1d56('0xe')||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x1d56('0xd')][0x4]===_0x1d56('0xe')||process[_0x1d56('0xd')][0x4]==='null'){throw new Error(_0x1d56('0x11'));}var FIELDS=_[_0x1d56('0x12')](process[_0x1d56('0xd')][0x3][_0x1d56('0x13')](','),process[_0x1d56('0xd')][0x4][_0x1d56('0x13')](','));if(!process[_0x1d56('0xd')][0x5]||process[_0x1d56('0xd')][0x5]===_0x1d56('0xe')||process['argv'][0x5]===_0x1d56('0xf')){throw new Error(_0x1d56('0x14'));}var LISTID=process[_0x1d56('0xd')][0x5];var COMPANYID=process[_0x1d56('0xd')][0x6]&&process['argv'][0x6]!==_0x1d56('0xe')&&process[_0x1d56('0xd')][0x6]!==_0x1d56('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x1d56('0xd')][0x7]&&process['argv'][0x7]!==_0x1d56('0xe')&&process[_0x1d56('0xd')][0x7]!==_0x1d56('0xf')?process[_0x1d56('0xd')][0x7]:null;if(!process[_0x1d56('0xd')][0x8]||process['argv'][0x8]===_0x1d56('0xe')||process[_0x1d56('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1d56('0xd')][0x8];}catch(_0x50c2dc){logger[_0x1d56('0x15')](_0x50c2dc);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(_0x5c0a05,_0x31e83f,_0xf1766d,_0x1c91cb){var _0x5c74ca={'message':_0x31e83f};_0x5c74ca[_0x5c0a05]=!![];if(_0xf1766d){_0x5c74ca[_0x1d56('0x16')]=_0xf1766d;}if(_0x1c91cb){_0x5c74ca['index']=_0x1c91cb;}return _0x5c74ca;}function isEmail(_0x40dba2){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'](_0x40dba2);}function checkRow(_0x4da9d4,_0x5555d3,_0x15a01d){return new BPromise(function(_0x35d609,_0x3294db){if(_[_0x1d56('0x17')](_0x4da9d4)){return _0x3294db(handleCheckRowError('error',_0x1d56('0x18'),null,_0x15a01d));}if(_0x4da9d4[_0x1d56('0x19')]&&_0x4da9d4[_0x1d56('0x19')]['length']){var _0x58512f=_[_0x1d56('0x1a')](_0x4da9d4[_0x1d56('0x19')],_0x1d56('0x1b'))[_0x1d56('0x1c')](';');return _0x3294db(handleCheckRowError(_0x1d56('0x15'),_0x58512f,null,_0x15a01d));}var _0x3e92de={};for(var _0x5d6311 in FIELDS){if(FIELDS['hasOwnProperty'](_0x5d6311)&&FIELDS[_0x5d6311]){_0x3e92de[_0x5d6311]=_0x4da9d4[_0x1d56('0x1d')][0x0][FIELDS[_0x5d6311]]||_0x4da9d4[_0x1d56('0x1d')][0x0]['\ufeff'+FIELDS[_0x5d6311]];}}if(!_0x3e92de['firstName']){return _0x3294db(handleCheckRowError(_0x1d56('0x15'),_0x1d56('0x1e'),null,_0x15a01d));}if(!_0x3e92de[_0x1d56('0x1f')]){return _0x3294db(handleCheckRowError(_0x1d56('0x15'),_0x1d56('0x20'),null,_0x15a01d));}if(_0x3e92de[_0x1d56('0x21')]){var _0x1a7244=moment(_0x3e92de[_0x1d56('0x21')],'YYYY-MM-DD');if(!_0x1a7244[_0x1d56('0x22')]()){return _0x3294db(handleCheckRowError(_0x1d56('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x15a01d));}}if(_0x3e92de[_0x1d56('0x23')]){if(!isEmail(_0x3e92de['email'])){return _0x3294db(handleCheckRowError(_0x1d56('0x15'),_0x1d56('0x24'),null,_0x15a01d));}}_0x3e92de[_0x1d56('0x25')]=LISTID;_0x3e92de[_0x1d56('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1d56('0x27')]&&_0x5555d3){var _0x288a20={};for(var _0x2dfc80=0x0,_0x2e6618=DUPLICATES[_0x1d56('0x27')];_0x2dfc80<_0x2e6618;_0x2dfc80+=0x1){_0x288a20[DUPLICATES[_0x2dfc80]]=_0x3e92de[DUPLICATES[_0x2dfc80]];}var _0x1ebbb4=_['find'](_0x5555d3,_0x288a20);if(_0x1ebbb4){return _0x3294db(handleCheckRowError(_0x1d56('0x28'),_0x1d56('0x29'),_0x1ebbb4,_0x15a01d));}}return db[_0x1d56('0x2a')]['create'](_0x3e92de,{'raw':!![],'hooks':![],'fields':_[_0x1d56('0x2b')](_0x3e92de)})['then'](function(_0x4aae16){if(DUPLICATES&&DUPLICATES[_0x1d56('0x27')]&&_0x5555d3){_0x5555d3[_0x1d56('0x2c')](_['pick'](_0x3e92de,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4aae16['id'];return _0x35d609();})[_0x1d56('0x2d')](function(_0x204d26){return _0x3294db(handleCheckRowError(_0x1d56('0x15'),_0x1d56('0x2e')+(_0x204d26['message']||JSON['stringify'](_0x204d26)),null,_0x15a01d));});});}function checkHopper(){function _0x1021fe(){return function(_0x50b227){logger['error']('cmContact','checkHopper',util[_0x1d56('0x2f')](_0x50b227,{'showHidden':![],'depth':null}));};}var _0x299b7e=function(_0x431ec6,_0x3acc8f){var _0x272623=squel[_0x1d56('0x30')]()[_0x1d56('0x31')]('cm_hopper')[_0x1d56('0x32')](['phone','scheduledAt','ContactId','ListId',_0x3acc8f,_0x1d56('0x33'),_0x1d56('0x34')],squel[_0x1d56('0x35')]()[_0x1d56('0x36')]('phone','phone')['field'](_0x1d56('0x37'),'scheduledAt')[_0x1d56('0x36')]('id',_0x1d56('0x38'))[_0x1d56('0x36')](LISTID['toString'](),_0x1d56('0x25'))['field'](_0x431ec6['id']['toString'](),_0x3acc8f)['field'](_0x1d56('0x37'),_0x1d56('0x33'))[_0x1d56('0x36')](_0x1d56('0x37'),_0x1d56('0x34'))[_0x1d56('0x39')](_0x1d56('0x3a'))[_0x1d56('0x3b')](_0x1d56('0x3c'))[_0x1d56('0x3b')](_0x1d56('0x3d'),LISTID['toString']())['where'](_0x1d56('0x3e'))[_0x1d56('0x3b')](_0x1d56('0x3f'),squel[_0x1d56('0x35')]()['field'](_0x1d56('0x1f'))[_0x1d56('0x39')]('cm_hopper')[_0x1d56('0x3b')](_0x3acc8f+_0x1d56('0x40'),_0x431ec6['id'][_0x1d56('0x41')]())))[_0x1d56('0x41')]();return _0x272623;};var _0x507371=function(_0x2bc1fe,_0x1d45ac){var _0x592ed2=squel[_0x1d56('0x30')]()['into'](_0x1d56('0x42'))[_0x1d56('0x32')]([_0x1d56('0x1f'),_0x1d56('0x43'),_0x1d56('0x38'),'ListId',_0x1d45ac,_0x1d56('0x33'),_0x1d56('0x34')],squel[_0x1d56('0x35')]()[_0x1d56('0x36')]('phone',_0x1d56('0x1f'))[_0x1d56('0x36')]('NOW()',_0x1d56('0x43'))['field']('id','ContactId')[_0x1d56('0x36')](LISTID[_0x1d56('0x41')](),'ListId')[_0x1d56('0x36')](_0x2bc1fe['id'][_0x1d56('0x41')](),_0x1d45ac)['field'](_0x1d56('0x37'),_0x1d56('0x33'))[_0x1d56('0x36')](_0x1d56('0x37'),_0x1d56('0x34'))[_0x1d56('0x39')]('cm_contacts')[_0x1d56('0x3b')]('deletedAt\x20IS\x20NULL')[_0x1d56('0x3b')](_0x1d56('0x3d'),LISTID[_0x1d56('0x41')]())['where'](_0x1d56('0x44'),squel[_0x1d56('0x45')](hopperContacts))[_0x1d56('0x3b')](_0x1d56('0x3e'))['where'](_0x1d56('0x3f'),squel[_0x1d56('0x35')]()[_0x1d56('0x36')](_0x1d56('0x46'))[_0x1d56('0x39')](_0x1d56('0x47'))[_0x1d56('0x3b')](_0x1d45ac+_0x1d56('0x40'),_0x2bc1fe['id']['toString']()))[_0x1d56('0x3b')](_0x1d56('0x3f'),squel[_0x1d56('0x35')]()['field'](_0x1d56('0x1f'))[_0x1d56('0x39')](_0x1d56('0x42'))[_0x1d56('0x3b')](_0x1d45ac+_0x1d56('0x40'),_0x2bc1fe['id']['toString']())))[_0x1d56('0x41')]();return _0x592ed2;};function _0x3d59c8(_0x2b2abc,_0x444d34){var _0x252bff=squel[_0x1d56('0x30')]()[_0x1d56('0x31')](_0x1d56('0x42'))['fromQuery']([_0x1d56('0x1f'),_0x1d56('0x43'),_0x1d56('0x38'),_0x1d56('0x25'),_0x444d34,_0x1d56('0x33'),_0x1d56('0x34')],squel['select']()[_0x1d56('0x36')](_0x1d56('0x1f'),_0x1d56('0x1f'))['field']('NOW()',_0x1d56('0x43'))[_0x1d56('0x36')]('id',_0x1d56('0x38'))[_0x1d56('0x36')](LISTID[_0x1d56('0x41')](),_0x1d56('0x25'))[_0x1d56('0x36')](_0x2b2abc['id'][_0x1d56('0x41')](),_0x444d34)['field'](_0x1d56('0x37'),'createdAt')['field']('NOW()',_0x1d56('0x34'))[_0x1d56('0x39')](_0x1d56('0x3a'))[_0x1d56('0x3b')](_0x1d56('0x3c'))['where']('ListId\x20=\x20?',LISTID[_0x1d56('0x41')]())[_0x1d56('0x3b')](_0x1d56('0x44'),squel[_0x1d56('0x45')](hopperContacts))[_0x1d56('0x3b')](_0x1d56('0x3e')))[_0x1d56('0x41')]();return _0x252bff;}function _0x5da681(_0x3b2ba4,_0x170647){var _0x35870f=squel[_0x1d56('0x30')]()['into'](_0x1d56('0x48'))[_0x1d56('0x32')]([_0x1d56('0x1f'),_0x1d56('0x38'),_0x1d56('0x25'),_0x170647,_0x1d56('0x33'),_0x1d56('0x34')],squel[_0x1d56('0x35')]()['field'](_0x1d56('0x1f'),_0x1d56('0x1f'))['field']('id',_0x1d56('0x38'))['field'](LISTID[_0x1d56('0x41')](),_0x1d56('0x25'))[_0x1d56('0x36')](_0x3b2ba4['id'][_0x1d56('0x41')](),_0x170647)[_0x1d56('0x36')](_0x1d56('0x37'),_0x1d56('0x33'))[_0x1d56('0x36')](_0x1d56('0x37'),_0x1d56('0x34'))[_0x1d56('0x39')](_0x1d56('0x3a'))['where']('deletedAt\x20IS\x20NULL')[_0x1d56('0x3b')](_0x1d56('0x3d'),LISTID[_0x1d56('0x41')]())['where'](_0x1d56('0x44'),squel[_0x1d56('0x45')](hopperContacts))[_0x1d56('0x3b')](_0x1d56('0x3e')))[_0x1d56('0x41')]();return _0x35870f;}return db[_0x1d56('0x49')][_0x1d56('0x4a')]({'where':{'type':_0x1d56('0x4b')},'attributes':['id',_0x1d56('0x4c')],'include':[{'model':db[_0x1d56('0x4d')],'as':_0x1d56('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x11e17c){var _0x3ce65e=[];if(_0x11e17c){var _0x453521;for(var _0x1d7c1c=0x0,_0x9eb57;_0x1d7c1c<_0x11e17c[_0x1d56('0x27')];_0x1d7c1c+=0x1){_0x9eb57=_0x11e17c[_0x1d7c1c][_0x1d56('0x4f')]({'plain':!![]});switch(_0x9eb57[_0x1d56('0x4c')]){case _0x1d56('0x50'):_0x3ce65e[_0x1d56('0x2c')](db['sequelize']['query'](_0x507371(_0x9eb57,'VoiceQueueId'))[_0x1d56('0x51')](function(){})['catch'](_0x1021fe()));break;case _0x1d56('0x52'):_0x3ce65e[_0x1d56('0x2c')](db[_0x1d56('0x53')]['query'](_0x299b7e(_0x9eb57,'VoiceQueueId'))[_0x1d56('0x51')](function(){})[_0x1d56('0x2d')](_0x1021fe()));break;default:_0x3ce65e[_0x1d56('0x2c')](db[_0x1d56('0x53')][_0x1d56('0x54')](_0x3d59c8(_0x9eb57,_0x1d56('0x55')))[_0x1d56('0x51')](function(){})[_0x1d56('0x2d')](_0x1021fe()));}}}return _0x3ce65e;})[_0x1d56('0x56')]()[_0x1d56('0x51')](function(){return db[_0x1d56('0x49')][_0x1d56('0x4a')]({'where':{'type':_0x1d56('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1d56('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x1d56('0x51')](function(_0x104999){var _0x4addbe=[];if(_0x104999){var _0x51df57;for(var _0x369dae=0x0,_0x1dc60d;_0x369dae<_0x104999[_0x1d56('0x27')];_0x369dae+=0x1){_0x1dc60d=_0x104999[_0x369dae][_0x1d56('0x4f')]({'plain':!![]});_0x4addbe[_0x1d56('0x2c')](db[_0x1d56('0x53')][_0x1d56('0x54')](_0x5da681(_0x1dc60d,'VoiceQueueId'))[_0x1d56('0x51')](function(){})[_0x1d56('0x2d')](_0x1021fe()));}}return _0x4addbe;})['all']();})[_0x1d56('0x51')](function(){return db[_0x1d56('0x57')]['findAll']({'attributes':['id',_0x1d56('0x4c')],'include':[{'model':db[_0x1d56('0x4d')],'as':_0x1d56('0x4e'),'where':{'id':LISTID}}]})[_0x1d56('0x51')](function(_0x42029a){var _0x270082=[];if(_0x42029a){for(var _0x55c326=0x0,_0x4f1dce;_0x55c326<_0x42029a[_0x1d56('0x27')];_0x55c326+=0x1){_0x4f1dce=_0x42029a[_0x55c326][_0x1d56('0x4f')]({'plain':!![]});switch(_0x4f1dce[_0x1d56('0x4c')]){case'always':_0x270082[_0x1d56('0x2c')](db[_0x1d56('0x53')][_0x1d56('0x54')](_0x507371(_0x4f1dce,'CampaignId'))[_0x1d56('0x51')](function(){})[_0x1d56('0x2d')](_0x1021fe()));break;case _0x1d56('0x52'):_0x270082[_0x1d56('0x2c')](db[_0x1d56('0x53')][_0x1d56('0x54')](_0x299b7e(_0x4f1dce,_0x1d56('0x58')))[_0x1d56('0x51')](function(){})['catch'](_0x1021fe()));break;default:_0x270082[_0x1d56('0x2c')](db[_0x1d56('0x53')][_0x1d56('0x54')](_0x3d59c8(_0x4f1dce,_0x1d56('0x58')))['then'](function(){})[_0x1d56('0x2d')](_0x1021fe()));}}}return _0x270082;})[_0x1d56('0x56')]();})[_0x1d56('0x51')](function(){return db['Campaign'][_0x1d56('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1d56('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x1d56('0x51')](function(_0x1b23a6){var _0x141539=[];if(_0x1b23a6){for(var _0x5aa6d5=0x0,_0x522d0f;_0x5aa6d5<_0x1b23a6[_0x1d56('0x27')];_0x5aa6d5+=0x1){_0x522d0f=_0x1b23a6[_0x5aa6d5]['get']({'plain':!![]});_0x141539[_0x1d56('0x2c')](db[_0x1d56('0x53')]['query'](_0x5da681(_0x522d0f,_0x1d56('0x58')))[_0x1d56('0x51')](function(){})[_0x1d56('0x2d')](_0x1021fe()));}}return _0x141539;})[_0x1d56('0x56')]();})['catch'](function(_0x5b46d5){logger[_0x1d56('0x15')](_0x1d56('0x59'),'generalCheckHopper',_0x5b46d5[_0x1d56('0x1b')]);});}var processPromises=function(_0x1f2335){return BPromise['all'](promises)['then'](function(_0x2fb241){})[_0x1d56('0x2d')](function(_0x2002b9){logger[_0x1d56('0x15')]('Error\x20processing\x20rows\x20block:',JSON[_0x1d56('0x5a')](_0x2002b9));})[_0x1d56('0x5b')](function(){socket['emit'](_0x1d56('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1f2335){return _0x1f2335[_0x1d56('0x5d')]();}});};var endCsv=function(){return BPromise[_0x1d56('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x1d56('0x51')](function(){socket[_0x1d56('0x5f')](_0x1d56('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1d56('0x60')](FILEPATH);}catch(_0x3e1dc2){logger[_0x1d56('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1d56('0x5a')](_0x3e1dc2));}finally{process[_0x1d56('0x61')](0x0);}});};process['on'](_0x1d56('0x62'),function(){logger[_0x1d56('0x63')](_0x1d56('0x64'));endCsv();});function main(){return BPromise[_0x1d56('0x5e')]()[_0x1d56('0x51')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1d56('0x13')](',');return db[_0x1d56('0x2a')][_0x1d56('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1d56('0x51')](function(_0x3cefae){var _0x5220a9=fs[_0x1d56('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x5220a9,{'header':!![],'skipEmptyLines':!![],'step':function(_0xe61b99,_0x28adf4){total+=0x1;var _0x2b75f9=total;promises[_0x1d56('0x2c')](checkRow(_0xe61b99,_0x3cefae,_0x2b75f9)[_0x1d56('0x51')](function(){success+=0x1;})[_0x1d56('0x2d')](function(_0x3a6b06){if(_0x3a6b06[_0x1d56('0x15')]){errors+=0x1;delete _0x3a6b06[_0x1d56('0x15')];}else if(_0x3a6b06[_0x1d56('0x28')]){duplicates+=0x1;delete _0x3a6b06[_0x1d56('0x28')];}rows[_0x1d56('0x2c')](_0x3a6b06);}));if(total%0xc8===0x0){_0x28adf4[_0x1d56('0x66')]();return processPromises(_0x28adf4);}},'complete':function(){return processPromises()[_0x1d56('0x51')](function(){logger[_0x1d56('0x63')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2951de,_0x21f4e3){logger[_0x1d56('0x63')](_0x1d56('0x67'),JSON[_0x1d56('0x5a')](_0x2951de));endCsv();}});})[_0x1d56('0x2d')](function(_0x6ebf50){logger['error'](_0x1d56('0x68'),JSON[_0x1d56('0x5a')](_0x6ebf50));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 8e1a209..507830f 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 _0x4f6a=['firstName','\x20not\x20specified','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','each','finish','affectedRows','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','parse','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id','cm_contacts.updatedAt','createdAt','cm_hopper_black','\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','length','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','all','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','socket_timestamp','root','keys','header',',utcOffset','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD'];(function(_0x577367,_0x147ab0){var _0x2d6c75=function(_0x37df30){while(--_0x37df30){_0x577367['push'](_0x577367['shift']());}};_0x2d6c75(++_0x147ab0);}(_0x4f6a,0xc1));var _0xa4f6=function(_0x15ed84,_0x589521){_0x15ed84=_0x15ed84-0x0;var _0x426d2b=_0x4f6a[_0x15ed84];return _0x426d2b;};'use strict';var fs=require('fs');var path=require(_0xa4f6('0x0'));var _=require(_0xa4f6('0x1'));var Papa=require(_0xa4f6('0x2'));var util=require(_0xa4f6('0x3'));var BPromise=require(_0xa4f6('0x4'));var moment=require(_0xa4f6('0x5'));var squel=require(_0xa4f6('0x6'));var Redis=require(_0xa4f6('0x7'));var db=require(_0xa4f6('0x8'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0xa4f6('0x9'))('import');config['redis']=_[_0xa4f6('0xa')](config[_0xa4f6('0xb')],{'host':_0xa4f6('0xc'),'port':0x18eb});var socket=require(_0xa4f6('0xd'))(new Redis(config[_0xa4f6('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xa4f6('0xe'));function isEmail(_0x30d1d1){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))*$/[_0xa4f6('0xf')](_0x30d1d1);}function selectNotIn(_0x1d7f2e,_0x3ff335,_0x360604,_0x4046e7,_0x1e5610){return squel['select']()[_0xa4f6('0x10')](_0xa4f6('0x11'))[_0xa4f6('0x12')](_0x4046e7)['join'](_0x3ff335,null,_0x3ff335+_0xa4f6('0x13')+_0x4046e7+'.'+_0x360604)[_0xa4f6('0x14')](_0x4046e7+'.'+_0x360604+_0xa4f6('0x15')+_0x1d7f2e+'.'+_0x360604)[_0xa4f6('0x14')](_0x3ff335+'.dialCheckDuplicateType\x20IN\x20('+_0x1e5610[_0xa4f6('0x16')]()+')');}function insertCmHopper(_0x55b94d,_0xbf42ac,_0x422761,_0x107c3b,_0x4d8871){var _0x260dcc=[_0xa4f6('0x17'),_0xa4f6('0x18'),'cm_contacts.id',_0xa4f6('0x19'),_0xbf42ac+'.'+_0x107c3b,_0xa4f6('0x1a'),'cm_contacts.updatedAt',_0xa4f6('0x1b'),_0xa4f6('0x1c'),'\x22'+_0x4d8871+'\x22'];return squel[_0xa4f6('0x1d')]()[_0xa4f6('0x1e')](_0xa4f6('0x1f'))[_0xa4f6('0x20')]([_0xa4f6('0x11'),_0xa4f6('0x21'),_0xa4f6('0x22'),_0xa4f6('0x23'),_0x107c3b,'createdAt',_0xa4f6('0x24'),_0xa4f6('0x25'),_0xa4f6('0x26'),_0xa4f6('0x27')],squel[_0xa4f6('0x28')]()[_0xa4f6('0x29')](_0x260dcc)[_0xa4f6('0x12')](_0xbf42ac)[_0xa4f6('0x16')](_0xa4f6('0x2a'),null,_0xa4f6('0x2b')+_0xbf42ac+_0xa4f6('0x2c'))['join'](_0x422761,null,_0x422761+_0xa4f6('0x13')+_0xbf42ac+'.'+_0x107c3b)[_0xa4f6('0x14')](_0xbf42ac+_0xa4f6('0x2d'),_0x55b94d)['where'](_0xa4f6('0x2e'),NOW)['where'](_0xa4f6('0x2f'),selectNotIn(_0xbf42ac,_0x422761,_0x107c3b,_0xa4f6('0x1f'),[_0xa4f6('0x30'),_0xa4f6('0x31')]))['where'](_0xa4f6('0x2f'),selectNotIn(_0xbf42ac,_0x422761,_0x107c3b,_0xa4f6('0x1f'),[_0xa4f6('0x30')])))['toString']();}function insertCmHopperBlack(_0x581660,_0x32f92f,_0x5d9a41,_0x4ede41){var _0x13a249=[_0xa4f6('0x17'),_0xa4f6('0x32'),_0xa4f6('0x19'),_0x32f92f+'.'+_0x4ede41,_0xa4f6('0x1a'),_0xa4f6('0x33')];return squel[_0xa4f6('0x1d')]()['into']('cm_hopper_black')[_0xa4f6('0x20')]([_0xa4f6('0x11'),_0xa4f6('0x22'),'ListId',_0x4ede41,_0xa4f6('0x34'),_0xa4f6('0x24')],squel[_0xa4f6('0x28')]()[_0xa4f6('0x29')](_0x13a249)[_0xa4f6('0x12')](_0x32f92f)['join'](_0xa4f6('0x2a'),null,_0xa4f6('0x2b')+_0x32f92f+'.CmListId')[_0xa4f6('0x16')](_0x5d9a41,null,_0x5d9a41+_0xa4f6('0x13')+_0x32f92f+'.'+_0x4ede41)[_0xa4f6('0x14')](_0x32f92f+_0xa4f6('0x2d'),_0x581660)[_0xa4f6('0x14')](_0xa4f6('0x2e'),NOW)[_0xa4f6('0x14')](_0xa4f6('0x2f'),squel[_0xa4f6('0x28')]()[_0xa4f6('0x10')](_0xa4f6('0x11'))[_0xa4f6('0x12')](_0xa4f6('0x35'))[_0xa4f6('0x14')]('ListId\x20=\x20?',_0x581660)['where'](_0x4ede41+_0xa4f6('0x36'),_0x32f92f+'.'+_0x4ede41)))[_0xa4f6('0x37')]();}function insertTzCmHopper(_0x22138c,_0xeb56a2,_0x7acc67,_0x5d95a0,_0x4a7f79,_0xcd2035){var _0x4fdbd6=[_0xa4f6('0x17'),_0xa4f6('0x38')+_0xcd2035+_0xa4f6('0x39'),_0xa4f6('0x32'),_0xa4f6('0x19'),_0xeb56a2+'.'+_0x5d95a0,_0xa4f6('0x1a'),_0xa4f6('0x33'),_0xa4f6('0x1b'),_0xa4f6('0x1c'),'\x22'+_0x4a7f79+'\x22'];var _0x207ba2=squel['insert']()[_0xa4f6('0x1e')]('cm_hopper')[_0xa4f6('0x20')]([_0xa4f6('0x11'),_0xa4f6('0x21'),'ContactId','ListId',_0x5d95a0,_0xa4f6('0x34'),_0xa4f6('0x24'),_0xa4f6('0x25'),_0xa4f6('0x26'),_0xa4f6('0x27')],squel[_0xa4f6('0x28')]()[_0xa4f6('0x29')](_0x4fdbd6)[_0xa4f6('0x12')](_0xeb56a2)['join'](_0xa4f6('0x2a'),null,_0xa4f6('0x2b')+_0xeb56a2+_0xa4f6('0x2c'))[_0xa4f6('0x16')](_0x7acc67,null,_0x7acc67+_0xa4f6('0x13')+_0xeb56a2+'.'+_0x5d95a0)[_0xa4f6('0x16')](_0xcd2035,null,_0xcd2035+'.id\x20=\x20'+_0xeb56a2+'.'+_0x5d95a0)['where'](_0xeb56a2+_0xa4f6('0x2d'),_0x22138c)[_0xa4f6('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xa4f6('0x2f'),selectNotIn(_0xeb56a2,_0x7acc67,_0x5d95a0,_0xa4f6('0x1f'),[_0xa4f6('0x30'),'\x22onlyIfOpen\x22']))[_0xa4f6('0x14')](_0xa4f6('0x2f'),selectNotIn(_0xeb56a2,_0x7acc67,_0x5d95a0,_0xa4f6('0x1f'),[_0xa4f6('0x30')])))[_0xa4f6('0x37')]();return _0x207ba2;}function insertTzCmHopperBlack(_0x18c3c4,_0x3e088f,_0x3d0a1d,_0x6daa10){var _0x24f1fb=[_0xa4f6('0x17'),_0xa4f6('0x32'),_0xa4f6('0x19'),_0x3e088f+'.'+_0x6daa10,_0xa4f6('0x1a'),_0xa4f6('0x33')];return squel['insert']()[_0xa4f6('0x1e')]('cm_hopper_black')[_0xa4f6('0x20')]([_0xa4f6('0x11'),_0xa4f6('0x22'),_0xa4f6('0x23'),_0x6daa10,_0xa4f6('0x34'),'updatedAt'],squel['select']()['fields'](_0x24f1fb)['from'](_0x3e088f)['join'](_0xa4f6('0x2a'),null,'cm_contacts.ListId\x20=\x20'+_0x3e088f+_0xa4f6('0x2c'))['join'](_0x3d0a1d,null,_0x3d0a1d+_0xa4f6('0x13')+_0x3e088f+'.'+_0x6daa10)['where'](_0x3e088f+_0xa4f6('0x2d'),_0x18c3c4)[_0xa4f6('0x14')](_0xa4f6('0x2e'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xa4f6('0x28')]()[_0xa4f6('0x10')](_0xa4f6('0x11'))[_0xa4f6('0x12')](_0xa4f6('0x35'))['where'](_0xa4f6('0x3a'),_0x18c3c4)[_0xa4f6('0x14')](_0x6daa10+_0xa4f6('0x36'),_0x3e088f+'.'+_0x6daa10)))['toString']();}function insertCmContact(_0x3666bd,_0xab4935,_0x57eeda,_0x155e92){var _0x1342e6=_[_0xa4f6('0x3b')](_['keys'](_0x155e92),[_0xa4f6('0x23'),'CompanyId',_0xa4f6('0x34'),_0xa4f6('0x24')]);return squel[_0xa4f6('0x1d')]()['into'](_0xa4f6('0x2a'))[_0xa4f6('0x20')](_0x1342e6,squel[_0xa4f6('0x28')]()[_0xa4f6('0x29')](_0x1342e6)[_0xa4f6('0x12')](_0xab4935)[_0xa4f6('0x14')]('('+_0x57eeda['join'](',')+_0xa4f6('0x3c'),squel[_0xa4f6('0x28')]()[_0xa4f6('0x29')](_0x57eeda)['from']('cm_contacts')[_0xa4f6('0x14')](_0xa4f6('0x3a'),_0x3666bd)['where'](_0xa4f6('0x3d')))[_0xa4f6('0x14')]('id\x20IN\x20?',squel[_0xa4f6('0x28')]()[_0xa4f6('0x10')](_0xa4f6('0x3e'),_0xa4f6('0x3f'))['from'](_0xab4935)[_0xa4f6('0x40')](_0x57eeda['join'](','))))[_0xa4f6('0x37')]();}function handleStop(){logger[_0xa4f6('0x41')](_0xa4f6('0x42'));stopped=!![];}function handleUncaughtException(_0x487a0b){logger[_0xa4f6('0x43')](_0x487a0b[_0xa4f6('0x44')]);process[_0xa4f6('0x45')](0x1);}function handleError(_0x49f690,_0x4687df){stats[_0xa4f6('0x46')][_0xa4f6('0x47')]({'name':_0x4687df['code'],'message':_0x4687df[_0xa4f6('0x44')],'row':_0x49f690});}function handleQuery(_0x2e0d34){logger['info'](_0x2e0d34);return db['sequelize'][_0xa4f6('0x48')](_0x2e0d34)[_0xa4f6('0x49')](function(_0x1ec1a9){results['push'](_0x1ec1a9);})[_0xa4f6('0x4a')](function(_0x34c739){logger[_0xa4f6('0x43')](_0x34c739['message']);});}function updateTzCampaigns(_0x44b5fe){return new Promise(function(_0x40ac37,_0x50bade){var _0x2e6f72=squel[_0xa4f6('0x28')]()[_0xa4f6('0x29')]([_0xa4f6('0x4b'),_0xa4f6('0x4c')])[_0xa4f6('0x12')](_0xa4f6('0x4d'))['join']('campaigns_has_cm_lists',null,_0xa4f6('0x4e'))['where'](_0xa4f6('0x4f')+_0x44b5fe);db[_0xa4f6('0x50')][_0xa4f6('0x48')](_0x2e6f72[_0xa4f6('0x37')]())['spread'](function(_0x227262){var _0x1aada4=[];for(var _0x41391d=0x0;_0x41391d<_0x227262[_0xa4f6('0x51')];_0x41391d++){_0x1aada4[_0xa4f6('0x47')](getTimezoneData(_0x227262[_0x41391d],tmp_campaigns));}BPromise['all'](_0x1aada4)[_0xa4f6('0x52')](function(){_0x40ac37({'val':0x1});});})['catch'](function(_0xe54b35){logger['error'](_0xe54b35[_0xa4f6('0x44')]);_0x40ac37({'val':0x0});});});}function updateTzVoiceQueues(_0x48201a){return new Promise(function(_0x16f904,_0x2dfe8d){var _0x2ad7e4=squel['select']()[_0xa4f6('0x29')]([_0xa4f6('0x53'),_0xa4f6('0x54')])[_0xa4f6('0x12')](_0xa4f6('0x55'))[_0xa4f6('0x16')](_0xa4f6('0x56'),null,_0xa4f6('0x57'))[_0xa4f6('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x48201a);db['sequelize'][_0xa4f6('0x48')](_0x2ad7e4[_0xa4f6('0x37')]())[_0xa4f6('0x49')](function(_0x13d29f){var _0x5c32ee=[];for(var _0x4ebf79=0x0;_0x4ebf79<_0x13d29f[_0xa4f6('0x51')];_0x4ebf79++){_0x5c32ee[_0xa4f6('0x47')](getTimezoneData(_0x13d29f[_0x4ebf79],tmp_voice_queues));}BPromise[_0xa4f6('0x58')](_0x5c32ee)[_0xa4f6('0x52')](function(){_0x16f904({'val':0x1});});})[_0xa4f6('0x4a')](function(_0x57fd76){logger['error'](_0x57fd76['message']);_0x16f904({'val':0x0});});});}function getTimezoneData(_0x50e1f8,_0x4f68fa){return new Promise(function(_0x154e58,_0xb08ddc){var _0x5c2aee=shared[_0xa4f6('0x59')];var _0x41f993=_0x5c2aee[_0x50e1f8[_0xa4f6('0x5a')]];if(_[_0xa4f6('0x5b')](_0x41f993)){_0x154e58({'ret':0x1});}else{var _0x5783b9=_0x41f993[_0xa4f6('0x5c')];var _0x56bb79=squel['insert']()[_0xa4f6('0x1e')](_0x4f68fa)[_0xa4f6('0x5d')]('id',_0x50e1f8['id'])[_0xa4f6('0x5d')](_0xa4f6('0x5e'),_0x5783b9)[_0xa4f6('0x5d')]('dialTimezone',_0x50e1f8[_0xa4f6('0x5a')])['toString']();return db[_0xa4f6('0x50')]['query'](_0x56bb79)[_0xa4f6('0x49')](function(_0x362ee4){_0x154e58({'ret':0x1});})[_0xa4f6('0x4a')](function(_0x1363e3){logger['error'](_0x1363e3[_0xa4f6('0x44')]);_0xb08ddc({'ret':0x1});});}});}function handleTZQuery(_0x430e87){logger['info'](_0x430e87);return db[_0xa4f6('0x50')][_0xa4f6('0x48')](_0x430e87)[_0xa4f6('0x49')](function(_0x5bbe62){})[_0xa4f6('0x4a')](function(_0x5f1bbb){logger[_0xa4f6('0x43')](_0x5f1bbb[_0xa4f6('0x44')]);});}function main(_0x566b86,_0x1397e6,_0x2cd1f8,_0x28663a){logger[_0xa4f6('0x41')](_0xa4f6('0x5f'),_0x566b86,JSON[_0xa4f6('0x60')](_0x1397e6));process[_0xa4f6('0x61')](_0xa4f6('0x62'));var _0x53c6aa=_0x1397e6['binding'];var _0x1009fe=_0x1397e6[_0xa4f6('0x63')];var _0x32cc08=path[_0xa4f6('0x16')](config[_0xa4f6('0x64')],'server/files/tmp',_0x1009fe+'.csv');hasTZ=_[_0xa4f6('0x65')](_0x53c6aa)['includes']('dialTimezone');var _0x415455=_[_0xa4f6('0x65')](_0x53c6aa)[_0xa4f6('0x16')]();logger[_0xa4f6('0x41')](_0xa4f6('0x66'),_0x415455);if(hasTZ)_0x415455+=_0xa4f6('0x67');fs['writeFileSync'](_0x32cc08,_0x415455+'\x0a');Papa['parse'](fs[_0xa4f6('0x68')](_0x566b86),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a30c4,_0x51ea30){try{for(var _0x5cfb34=0x0,_0x8be3bb=[];_0x5cfb34<_0x3a30c4[_0xa4f6('0x69')][_0xa4f6('0x51')];_0x5cfb34++){stats[_0xa4f6('0x6a')]+=0x1;if(_0x3a30c4['errors'][_0x5cfb34]){handleError(_0x3a30c4['data'][_0x5cfb34],_0x3a30c4[_0xa4f6('0x46')][_0x5cfb34]);}else{var _0x21b84b=[];for(var _0x537091 in _0x53c6aa){if(_0x53c6aa[_0xa4f6('0x6b')](_0x537091)){if(_0x3a30c4[_0xa4f6('0x69')][_0x5cfb34][_0x53c6aa[_0x537091]]){var _0x9ffef=_[_0xa4f6('0x6c')](_0x3a30c4[_0xa4f6('0x69')][_0x5cfb34][_0x53c6aa[_0x537091]][_0xa4f6('0x6d')](/"/g,'\x27'));switch(_0x537091){case _0xa4f6('0x21'):var _0x1a7c11=moment(_0x9ffef,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1a7c11[_0xa4f6('0x6e')]()){_0x8be3bb[_0xa4f6('0x47')]('\x22'+_0x9ffef+'\x22');}else{_0x21b84b[_0xa4f6('0x47')](_0xa4f6('0x6f'));}break;case _0xa4f6('0x25'):var _0x2ab7fb=parseInt(_0x9ffef);_0x9ffef=_[_0xa4f6('0x70')](_0x2ab7fb)||_0x2ab7fb<0x0||_0x2ab7fb>0x4?_0x28663a?0x3:0x2:_0x2ab7fb;_0x8be3bb['push']('\x22'+_0x9ffef+'\x22');break;case _0xa4f6('0x26'):var _0x5aefd2=parseInt(_0x9ffef);if(_[_0xa4f6('0x71')](_0x5aefd2)&&_['includes'](_0x2cd1f8,_0x5aefd2)){_0x8be3bb[_0xa4f6('0x47')]('\x22'+_0x5aefd2+'\x22');}else{_0x21b84b[_0xa4f6('0x47')](_0xa4f6('0x72'));}break;case'email':if(isEmail(_0x9ffef)){_0x8be3bb[_0xa4f6('0x47')]('\x22'+_0x9ffef+'\x22');}else{_0x21b84b[_0xa4f6('0x47')](_0xa4f6('0x73'));}break;case'dateOfBirth':var _0x5892a2=moment(_0x9ffef,_0xa4f6('0x74'),!![]);if(_0x5892a2[_0xa4f6('0x6e')]()){_0x8be3bb[_0xa4f6('0x47')]('\x22'+_0x9ffef+'\x22');}else{_0x21b84b['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xa4f6('0x5a'):var _0x3ae634=shared[_0xa4f6('0x59')];var _0x147f2e=_0x3ae634[_0x9ffef];if(!_[_0xa4f6('0x5b')](_0x147f2e)){var _0x4ce722=_0x147f2e[_0xa4f6('0x5c')];_0x8be3bb[_0xa4f6('0x47')]('\x22'+_0x9ffef+'\x22');_0x8be3bb[_0xa4f6('0x47')]('\x22'+_0x4ce722+'\x22');}break;default:_0x8be3bb[_0xa4f6('0x47')]('\x22'+_0x9ffef+'\x22');}}else{switch(_0x537091){case _0xa4f6('0x75'):case _0xa4f6('0x11'):_0x21b84b[_0xa4f6('0x47')](_0x537091+_0xa4f6('0x76'));break;default:_0x8be3bb[_0xa4f6('0x47')]('\x22\x22');}}}}if(_0x21b84b[_0xa4f6('0x51')]){handleError(_0x3a30c4[_0xa4f6('0x69')][_0x5cfb34],{'code':_0xa4f6('0x77'),'message':_0x21b84b['join']()});}else{fs['appendFileSync'](_0x32cc08,_0x8be3bb[_0xa4f6('0x16')]()+'\x0a');}_0x8be3bb=[];}if(!(stats[_0xa4f6('0x6a')]%0xc8)){socket[_0xa4f6('0x78')](_0xa4f6('0x79')+_0x1009fe,stats);stats[_0xa4f6('0x46')]=[];}}if(stopped){logger['info'](_0xa4f6('0x7a'));_0x51ea30[_0xa4f6('0x7b')]();}}catch(_0x75acbb){handleError(_0x3a30c4[_0xa4f6('0x69')][_0x5cfb34],{'code':_0xa4f6('0x7c'),'message':_0x75acbb[_0xa4f6('0x44')]});logger[_0xa4f6('0x43')](_0xa4f6('0x7d'),_0x75acbb[_0xa4f6('0x44')]);}},'complete':function(){try{var _0x1b2338=[];var _0x2175f1=[];var _0x6dd393=_0xa4f6('0x2a');if(_0x1397e6[_0xa4f6('0x7e')]&&_0x1397e6[_0xa4f6('0x7e')][_0xa4f6('0x51')]){_0x6dd393=_0xa4f6('0x7f')+_0x1009fe;_0x1b2338[_0xa4f6('0x47')](_0xa4f6('0x80')+_0x6dd393+_0xa4f6('0x81'));}tmp_campaigns='campaigns_'+_0x1009fe;tmp_voice_queues='voice_queues_'+_0x1009fe;_0x2175f1[_0xa4f6('0x47')](_0xa4f6('0x80')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x2175f1[_0xa4f6('0x47')](_0xa4f6('0x80')+tmp_voice_queues+_0xa4f6('0x82'));BPromise['each'](_0x2175f1,handleTZQuery)['then'](function(_0x238440){updateTzCampaigns(_0x1397e6[_0xa4f6('0x23')])[_0xa4f6('0x52')](function(_0x16b394){updateTzVoiceQueues(_0x1397e6[_0xa4f6('0x23')])[_0xa4f6('0x52')](function(_0x46c0d2){var _0x457560=util[_0xa4f6('0x83')](_0xa4f6('0x84'),_0x32cc08,_0x6dd393,_0x415455,_0x1397e6['ListId'],_0x1397e6['CompanyId']||null,NOW,NOW);if(_[_0xa4f6('0x5b')](_0x53c6aa[_0xa4f6('0x21')])){_0x457560+=_0xa4f6('0x85');}_0x1b2338['push'](_0x457560);if(_0x1397e6[_0xa4f6('0x7e')]&&_0x1397e6[_0xa4f6('0x7e')]['length']){_0x1b2338[_0xa4f6('0x47')](insertCmContact(_0x1397e6['ListId'],_0x6dd393,_0x1397e6[_0xa4f6('0x7e')],_0x53c6aa));_0x1b2338[_0xa4f6('0x47')](_0xa4f6('0x86')+_0x6dd393+';');}if(hasTZ){_0x1b2338[_0xa4f6('0x47')](insertTzCmHopper(_0x1397e6[_0xa4f6('0x23')],_0xa4f6('0x56'),_0xa4f6('0x55'),_0xa4f6('0x87'),_0x28663a,tmp_voice_queues));_0x1b2338[_0xa4f6('0x47')](insertTzCmHopperBlack(_0x1397e6['ListId'],'voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId'));_0x1b2338[_0xa4f6('0x47')](insertTzCmHopper(_0x1397e6[_0xa4f6('0x23')],'campaigns_has_cm_lists',_0xa4f6('0x4d'),_0xa4f6('0x88'),_0x28663a,tmp_campaigns));_0x1b2338[_0xa4f6('0x47')](insertTzCmHopperBlack(_0x1397e6[_0xa4f6('0x23')],_0xa4f6('0x89'),_0xa4f6('0x4d'),_0xa4f6('0x88')));}else{_0x1b2338[_0xa4f6('0x47')](insertCmHopper(_0x1397e6[_0xa4f6('0x23')],_0xa4f6('0x56'),_0xa4f6('0x55'),_0xa4f6('0x87'),_0x28663a));_0x1b2338[_0xa4f6('0x47')](insertCmHopperBlack(_0x1397e6[_0xa4f6('0x23')],_0xa4f6('0x8a'),_0xa4f6('0x55'),'VoiceQueueId'));_0x1b2338[_0xa4f6('0x47')](insertCmHopper(_0x1397e6['ListId'],_0xa4f6('0x8b'),'campaigns',_0xa4f6('0x88'),_0x28663a));_0x1b2338[_0xa4f6('0x47')](insertCmHopperBlack(_0x1397e6[_0xa4f6('0x23')],_0xa4f6('0x89'),'campaigns','CampaignId'));}_0x1b2338[_0xa4f6('0x47')](_0xa4f6('0x86')+tmp_campaigns+';');_0x1b2338[_0xa4f6('0x47')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0xa4f6('0x8c')](_0x1b2338,handleQuery)[_0xa4f6('0x52')](function(_0xe6a30d){stats[_0xa4f6('0x8d')]=!![];stats[_0xa4f6('0x8e')]=_0x1397e6[_0xa4f6('0x7e')]&&_0x1397e6[_0xa4f6('0x7e')][_0xa4f6('0x51')]?results[0x2][_0xa4f6('0x8e')]:results[0x0][_0xa4f6('0x8e')];socket[_0xa4f6('0x78')](_0xa4f6('0x79')+_0x1009fe,stats);fs['unlink'](_0x566b86);fs['unlink'](_0x32cc08);process['exit'](0x0);})[_0xa4f6('0x4a')](function(_0x5715bb){logger[_0xa4f6('0x43')](_0x5715bb[_0xa4f6('0x44')]);process[_0xa4f6('0x45')](0x1);});});});});}catch(_0x252157){logger[_0xa4f6('0x43')]('complete',_0x252157[_0xa4f6('0x44')]);process[_0xa4f6('0x45')](0x1);}},'error':function(_0x3d70ec,_0x1ad67a,_0x551096,_0x494d71){throw new Error(_0x494d71);}});}function validate(){if(process[_0xa4f6('0x8f')]&&process[_0xa4f6('0x8f')][_0xa4f6('0x51')]<0x4){throw new Error(_0xa4f6('0x90'));}var _0x403cdf=path[_0xa4f6('0x16')](config[_0xa4f6('0x64')],_0xa4f6('0x91'),process[_0xa4f6('0x8f')][0x2]);if(!fs[_0xa4f6('0x92')](_0x403cdf)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1cc43c={};try{_0x1cc43c=JSON[_0xa4f6('0x93')](process[_0xa4f6('0x8f')][0x3]);if(!_0x1cc43c[_0xa4f6('0x94')]){throw new Error(_0xa4f6('0x95'));}if(!_0x1cc43c['binding'][_0xa4f6('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x1cc43c[_0xa4f6('0x94')]['firstName']){throw new Error(_0xa4f6('0x96'));}var _0x53ee46=0x0;if(_0x1cc43c[_0xa4f6('0x94')][_0xa4f6('0x26')]){_0x53ee46=0x1;}if(!_0x1cc43c['ListId']){throw new Error(_0xa4f6('0x97'));}}catch(_0x11328a){throw new Error(_0xa4f6('0x98'));}var _0xe89ef0=[];try{_0xe89ef0=_['map'](JSON[_0xa4f6('0x93')](process[_0xa4f6('0x8f')][0x4]),'id');}catch(_0x5c8713){logger[_0xa4f6('0x41')]('No\x20agent\x20available');}main(_0x403cdf,_0x1cc43c,_0xe89ef0,_0x53ee46);}validate();process['on'](_0xa4f6('0x99'),handleStop);process['on'](_0xa4f6('0x9a'),handleUncaughtException); \ No newline at end of file +var _0x81ee=['lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20?','cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','recallme','.CmListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','error','message','exit','errors','push','info','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','length','all','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','then','timezones','dialTimezone','isNil','set','offset','main','stringify','send','socket_timestamp','root','server/files/tmp','includes','header','data','rows','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x81ee,0x1d6));var _0xe81e=function(_0x4410f8,_0x50fa41){_0x4410f8=_0x4410f8-0x0;var _0x4bbfd1=_0x81ee[_0x4410f8];return _0x4bbfd1;};'use strict';var fs=require('fs');var path=require(_0xe81e('0x0'));var _=require(_0xe81e('0x1'));var Papa=require(_0xe81e('0x2'));var util=require(_0xe81e('0x3'));var BPromise=require(_0xe81e('0x4'));var moment=require(_0xe81e('0x5'));var squel=require(_0xe81e('0x6'));var Redis=require(_0xe81e('0x7'));var db=require(_0xe81e('0x8'))['db'];var config=require(_0xe81e('0x9'));var shared=require(_0xe81e('0xa'));var logger=require(_0xe81e('0xb'))(_0xe81e('0xc'));config['redis']=_[_0xe81e('0xd')](config[_0xe81e('0xe')],{'host':_0xe81e('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe81e('0xe')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xe81e('0x10'));function isEmail(_0x28c6a3){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'](_0x28c6a3);}function selectNotIn(_0x4c81a4,_0x2b4381,_0x5d0b87,_0x19f02e,_0x76de58){return squel['select']()[_0xe81e('0x11')](_0xe81e('0x12'))[_0xe81e('0x13')](_0x19f02e)[_0xe81e('0x14')](_0x2b4381,null,_0x2b4381+_0xe81e('0x15')+_0x19f02e+'.'+_0x5d0b87)[_0xe81e('0x16')](_0x19f02e+'.'+_0x5d0b87+'\x20=\x20'+_0x4c81a4+'.'+_0x5d0b87)[_0xe81e('0x16')](_0x2b4381+_0xe81e('0x17')+_0x76de58[_0xe81e('0x14')]()+')');}function insertCmHopper(_0x5eb80c,_0x2f4203,_0x1146f3,_0x461dba,_0x427bf5){var _0x3209fb=['cm_contacts.phone',_0xe81e('0x18'),_0xe81e('0x19'),'cm_contacts.ListId',_0x2f4203+'.'+_0x461dba,_0xe81e('0x1a'),_0xe81e('0x1b'),_0xe81e('0x1c'),_0xe81e('0x1d'),'\x22'+_0x427bf5+'\x22'];return squel[_0xe81e('0x1e')]()[_0xe81e('0x1f')](_0xe81e('0x20'))[_0xe81e('0x21')]([_0xe81e('0x12'),_0xe81e('0x22'),_0xe81e('0x23'),_0xe81e('0x24'),_0x461dba,_0xe81e('0x25'),_0xe81e('0x26'),_0xe81e('0x27'),'UserId','recallme'],squel[_0xe81e('0x28')]()['fields'](_0x3209fb)[_0xe81e('0x13')](_0x2f4203)[_0xe81e('0x14')](_0xe81e('0x29'),null,_0xe81e('0x2a')+_0x2f4203+_0xe81e('0x2b'))[_0xe81e('0x14')](_0x1146f3,null,_0x1146f3+_0xe81e('0x15')+_0x2f4203+'.'+_0x461dba)[_0xe81e('0x16')](_0x2f4203+'.CmListId\x20=\x20?',_0x5eb80c)[_0xe81e('0x16')](_0xe81e('0x2c'),NOW)[_0xe81e('0x16')](_0xe81e('0x2d'),selectNotIn(_0x2f4203,_0x1146f3,_0x461dba,_0xe81e('0x20'),[_0xe81e('0x2e'),_0xe81e('0x2f')]))[_0xe81e('0x16')](_0xe81e('0x2d'),selectNotIn(_0x2f4203,_0x1146f3,_0x461dba,_0xe81e('0x20'),[_0xe81e('0x2e')])))[_0xe81e('0x30')]();}function insertCmHopperBlack(_0x5896c9,_0xedf5b,_0x21b2e5,_0x251672){var _0x33a613=['cm_contacts.phone',_0xe81e('0x19'),_0xe81e('0x31'),_0xedf5b+'.'+_0x251672,_0xe81e('0x1a'),_0xe81e('0x1b')];return squel[_0xe81e('0x1e')]()[_0xe81e('0x1f')](_0xe81e('0x32'))[_0xe81e('0x21')](['phone',_0xe81e('0x23'),_0xe81e('0x24'),_0x251672,_0xe81e('0x25'),'updatedAt'],squel[_0xe81e('0x28')]()[_0xe81e('0x33')](_0x33a613)['from'](_0xedf5b)[_0xe81e('0x14')](_0xe81e('0x29'),null,'cm_contacts.ListId\x20=\x20'+_0xedf5b+_0xe81e('0x2b'))[_0xe81e('0x14')](_0x21b2e5,null,_0x21b2e5+_0xe81e('0x15')+_0xedf5b+'.'+_0x251672)['where'](_0xedf5b+'.CmListId\x20=\x20?',_0x5896c9)[_0xe81e('0x16')](_0xe81e('0x2c'),NOW)[_0xe81e('0x16')](_0xe81e('0x2d'),squel[_0xe81e('0x28')]()[_0xe81e('0x11')](_0xe81e('0x12'))[_0xe81e('0x13')](_0xe81e('0x32'))['where'](_0xe81e('0x34'),_0x5896c9)[_0xe81e('0x16')](_0x251672+_0xe81e('0x35'),_0xedf5b+'.'+_0x251672)))[_0xe81e('0x30')]();}function insertTzCmHopper(_0x523822,_0x3d384c,_0x2d357a,_0x41e36a,_0x5827e2,_0x3481d3){var _0x3256e1=[_0xe81e('0x36'),_0xe81e('0x37')+_0x3481d3+_0xe81e('0x38'),_0xe81e('0x19'),_0xe81e('0x31'),_0x3d384c+'.'+_0x41e36a,_0xe81e('0x1a'),_0xe81e('0x1b'),_0xe81e('0x1c'),_0xe81e('0x1d'),'\x22'+_0x5827e2+'\x22'];var _0x30d97c=squel[_0xe81e('0x1e')]()[_0xe81e('0x1f')](_0xe81e('0x20'))['fromQuery']([_0xe81e('0x12'),_0xe81e('0x22'),_0xe81e('0x23'),_0xe81e('0x24'),_0x41e36a,_0xe81e('0x25'),'updatedAt',_0xe81e('0x27'),'UserId',_0xe81e('0x39')],squel[_0xe81e('0x28')]()[_0xe81e('0x33')](_0x3256e1)['from'](_0x3d384c)[_0xe81e('0x14')](_0xe81e('0x29'),null,_0xe81e('0x2a')+_0x3d384c+_0xe81e('0x2b'))['join'](_0x2d357a,null,_0x2d357a+'.id\x20=\x20'+_0x3d384c+'.'+_0x41e36a)[_0xe81e('0x14')](_0x3481d3,null,_0x3481d3+'.id\x20=\x20'+_0x3d384c+'.'+_0x41e36a)['where'](_0x3d384c+_0xe81e('0x3a'),_0x523822)[_0xe81e('0x16')](_0xe81e('0x2c'),NOW)[_0xe81e('0x16')](_0xe81e('0x2d'),selectNotIn(_0x3d384c,_0x2d357a,_0x41e36a,_0xe81e('0x20'),['\x22always\x22',_0xe81e('0x2f')]))[_0xe81e('0x16')](_0xe81e('0x2d'),selectNotIn(_0x3d384c,_0x2d357a,_0x41e36a,_0xe81e('0x20'),[_0xe81e('0x2e')])))[_0xe81e('0x30')]();return _0x30d97c;}function insertTzCmHopperBlack(_0x4b4a03,_0x4f456c,_0x1a9f15,_0xced094){var _0x255b9b=[_0xe81e('0x36'),_0xe81e('0x19'),'cm_contacts.ListId',_0x4f456c+'.'+_0xced094,_0xe81e('0x1a'),_0xe81e('0x1b')];return squel['insert']()[_0xe81e('0x1f')](_0xe81e('0x32'))[_0xe81e('0x21')](['phone',_0xe81e('0x23'),'ListId',_0xced094,_0xe81e('0x25'),_0xe81e('0x26')],squel[_0xe81e('0x28')]()[_0xe81e('0x33')](_0x255b9b)['from'](_0x4f456c)[_0xe81e('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4f456c+'.CmListId')[_0xe81e('0x14')](_0x1a9f15,null,_0x1a9f15+_0xe81e('0x15')+_0x4f456c+'.'+_0xced094)['where'](_0x4f456c+_0xe81e('0x3a'),_0x4b4a03)['where'](_0xe81e('0x2c'),NOW)[_0xe81e('0x16')](_0xe81e('0x2d'),squel[_0xe81e('0x28')]()[_0xe81e('0x11')]('phone')[_0xe81e('0x13')]('cm_hopper_black')[_0xe81e('0x16')](_0xe81e('0x34'),_0x4b4a03)[_0xe81e('0x16')](_0xced094+_0xe81e('0x35'),_0x4f456c+'.'+_0xced094)))[_0xe81e('0x30')]();}function insertCmContact(_0x11dd1b,_0x5c53c4,_0x24a8d4,_0x2aa965){var _0x58a1db=_['concat'](_[_0xe81e('0x3b')](_0x2aa965),[_0xe81e('0x24'),_0xe81e('0x3c'),_0xe81e('0x25'),_0xe81e('0x26')]);return squel[_0xe81e('0x1e')]()[_0xe81e('0x1f')]('cm_contacts')[_0xe81e('0x21')](_0x58a1db,squel[_0xe81e('0x28')]()['fields'](_0x58a1db)[_0xe81e('0x13')](_0x5c53c4)['where']('('+_0x24a8d4[_0xe81e('0x14')](',')+_0xe81e('0x3d'),squel[_0xe81e('0x28')]()[_0xe81e('0x33')](_0x24a8d4)[_0xe81e('0x13')]('cm_contacts')[_0xe81e('0x16')](_0xe81e('0x34'),_0x11dd1b)[_0xe81e('0x16')](_0xe81e('0x3e')))[_0xe81e('0x16')](_0xe81e('0x3f'),squel['select']()[_0xe81e('0x11')]('MIN(id)','min_id')[_0xe81e('0x13')](_0x5c53c4)['group'](_0x24a8d4[_0xe81e('0x14')](','))))[_0xe81e('0x30')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3ced92){logger[_0xe81e('0x40')](_0x3ced92[_0xe81e('0x41')]);process[_0xe81e('0x42')](0x1);}function handleError(_0x3272c4,_0x1ac7a1){stats[_0xe81e('0x43')][_0xe81e('0x44')]({'name':_0x1ac7a1['code'],'message':_0x1ac7a1[_0xe81e('0x41')],'row':_0x3272c4});}function handleQuery(_0x158dd9){logger[_0xe81e('0x45')](_0x158dd9);return db[_0xe81e('0x46')]['query'](_0x158dd9)[_0xe81e('0x47')](function(_0x40efca){results[_0xe81e('0x44')](_0x40efca);})[_0xe81e('0x48')](function(_0x2969ff){logger[_0xe81e('0x40')](_0x2969ff[_0xe81e('0x41')]);});}function updateTzCampaigns(_0x1c082b){return new Promise(function(_0x107877,_0x276b30){var _0x557c19=squel[_0xe81e('0x28')]()['fields']([_0xe81e('0x49'),_0xe81e('0x4a')])[_0xe81e('0x13')](_0xe81e('0x4b'))['join'](_0xe81e('0x4c'),null,_0xe81e('0x4d'))[_0xe81e('0x16')](_0xe81e('0x4e')+_0x1c082b);db['sequelize'][_0xe81e('0x4f')](_0x557c19[_0xe81e('0x30')]())[_0xe81e('0x47')](function(_0x515114){var _0x203469=[];for(var _0xe261ea=0x0;_0xe261ea<_0x515114[_0xe81e('0x50')];_0xe261ea++){_0x203469[_0xe81e('0x44')](getTimezoneData(_0x515114[_0xe261ea],tmp_campaigns));}BPromise[_0xe81e('0x51')](_0x203469)['then'](function(){_0x107877({'val':0x1});});})[_0xe81e('0x48')](function(_0x214e24){logger[_0xe81e('0x40')](_0x214e24[_0xe81e('0x41')]);_0x107877({'val':0x0});});});}function updateTzVoiceQueues(_0x413cf1){return new Promise(function(_0x30edd6,_0x3aaf15){var _0x510845=squel[_0xe81e('0x28')]()[_0xe81e('0x33')](['voice_queues.id',_0xe81e('0x52')])[_0xe81e('0x13')]('voice_queues')[_0xe81e('0x14')]('voice_queues_has_cm_lists',null,_0xe81e('0x53'))[_0xe81e('0x16')](_0xe81e('0x54')+_0x413cf1);db[_0xe81e('0x46')]['query'](_0x510845[_0xe81e('0x30')]())[_0xe81e('0x47')](function(_0x4d5c89){var _0x180ffa=[];for(var _0x3f2639=0x0;_0x3f2639<_0x4d5c89[_0xe81e('0x50')];_0x3f2639++){_0x180ffa[_0xe81e('0x44')](getTimezoneData(_0x4d5c89[_0x3f2639],tmp_voice_queues));}BPromise['all'](_0x180ffa)[_0xe81e('0x55')](function(){_0x30edd6({'val':0x1});});})[_0xe81e('0x48')](function(_0x5c510b){logger[_0xe81e('0x40')](_0x5c510b[_0xe81e('0x41')]);_0x30edd6({'val':0x0});});});}function getTimezoneData(_0x1cda56,_0x3d903d){return new Promise(function(_0x4b28c0,_0x14b9b9){var _0x24fe1a=shared[_0xe81e('0x56')];var _0x21b784=_0x24fe1a[_0x1cda56[_0xe81e('0x57')]];if(_[_0xe81e('0x58')](_0x21b784)){_0x4b28c0({'ret':0x1});}else{var _0x1ff59e=_0x21b784['utcOffset'];var _0x15d27b=squel[_0xe81e('0x1e')]()['into'](_0x3d903d)[_0xe81e('0x59')]('id',_0x1cda56['id'])['set'](_0xe81e('0x5a'),_0x1ff59e)[_0xe81e('0x59')](_0xe81e('0x57'),_0x1cda56[_0xe81e('0x57')])[_0xe81e('0x30')]();return db[_0xe81e('0x46')]['query'](_0x15d27b)[_0xe81e('0x47')](function(_0x3b8083){_0x4b28c0({'ret':0x1});})['catch'](function(_0x311dfe){logger[_0xe81e('0x40')](_0x311dfe['message']);_0x14b9b9({'ret':0x1});});}});}function handleTZQuery(_0x4bd9e3){logger[_0xe81e('0x45')](_0x4bd9e3);return db[_0xe81e('0x46')]['query'](_0x4bd9e3)[_0xe81e('0x47')](function(_0x456887){})[_0xe81e('0x48')](function(_0x15e063){logger[_0xe81e('0x40')](_0x15e063[_0xe81e('0x41')]);});}function main(_0x1c403b,_0x21d736,_0x30cea5,_0x25c19d){logger[_0xe81e('0x45')](_0xe81e('0x5b'),_0x1c403b,JSON[_0xe81e('0x5c')](_0x21d736));process[_0xe81e('0x5d')]('start');var _0x3538a0=_0x21d736['binding'];var _0x3e8baa=_0x21d736[_0xe81e('0x5e')];var _0x3ee87f=path[_0xe81e('0x14')](config[_0xe81e('0x5f')],_0xe81e('0x60'),_0x3e8baa+'.csv');hasTZ=_['keys'](_0x3538a0)[_0xe81e('0x61')]('dialTimezone');var _0x1e98c9=_[_0xe81e('0x3b')](_0x3538a0)[_0xe81e('0x14')]();logger['info'](_0xe81e('0x62'),_0x1e98c9);if(hasTZ)_0x1e98c9+=',utcOffset';fs['writeFileSync'](_0x3ee87f,_0x1e98c9+'\x0a');Papa['parse'](fs['createReadStream'](_0x1c403b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x46cdb4,_0x1322cc){try{for(var _0x282774=0x0,_0x5b7db5=[];_0x282774<_0x46cdb4[_0xe81e('0x63')][_0xe81e('0x50')];_0x282774++){stats[_0xe81e('0x64')]+=0x1;if(_0x46cdb4['errors'][_0x282774]){handleError(_0x46cdb4[_0xe81e('0x63')][_0x282774],_0x46cdb4[_0xe81e('0x43')][_0x282774]);}else{var _0x4bc2b1=[];for(var _0x55f425 in _0x3538a0){if(_0x3538a0[_0xe81e('0x65')](_0x55f425)){if(_0x46cdb4[_0xe81e('0x63')][_0x282774][_0x3538a0[_0x55f425]]){var _0x1d0b92=_[_0xe81e('0x66')](_0x46cdb4[_0xe81e('0x63')][_0x282774][_0x3538a0[_0x55f425]][_0xe81e('0x67')](/"/g,'\x27'));switch(_0x55f425){case _0xe81e('0x22'):var _0x170a69=moment(_0x1d0b92,_0xe81e('0x10'),!![]);if(_0x170a69[_0xe81e('0x68')]()){_0x5b7db5[_0xe81e('0x44')]('\x22'+_0x1d0b92+'\x22');}else{_0x4bc2b1[_0xe81e('0x44')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xe81e('0x27'):var _0x2d94c8=parseInt(_0x1d0b92);_0x1d0b92=_[_0xe81e('0x69')](_0x2d94c8)||_0x2d94c8<0x0||_0x2d94c8>0x4?_0x25c19d?0x3:0x2:_0x2d94c8;_0x5b7db5[_0xe81e('0x44')]('\x22'+_0x1d0b92+'\x22');break;case'UserId':var _0x458368=parseInt(_0x1d0b92);if(_[_0xe81e('0x6a')](_0x458368)&&_[_0xe81e('0x61')](_0x30cea5,_0x458368)){_0x5b7db5[_0xe81e('0x44')]('\x22'+_0x458368+'\x22');}else{_0x4bc2b1[_0xe81e('0x44')](_0xe81e('0x6b'));}break;case _0xe81e('0x6c'):if(isEmail(_0x1d0b92)){_0x5b7db5[_0xe81e('0x44')]('\x22'+_0x1d0b92+'\x22');}else{_0x4bc2b1[_0xe81e('0x44')](_0xe81e('0x6d'));}break;case _0xe81e('0x6e'):var _0x50321a=moment(_0x1d0b92,_0xe81e('0x6f'),!![]);if(_0x50321a['isValid']()){_0x5b7db5[_0xe81e('0x44')]('\x22'+_0x1d0b92+'\x22');}else{_0x4bc2b1['push'](_0xe81e('0x70'));}break;case _0xe81e('0x57'):var _0x17df68=shared['timezones'];var _0x213acf=_0x17df68[_0x1d0b92];if(!_['isNil'](_0x213acf)){var _0x9a9d50=_0x213acf[_0xe81e('0x71')];_0x5b7db5['push']('\x22'+_0x1d0b92+'\x22');_0x5b7db5[_0xe81e('0x44')]('\x22'+_0x9a9d50+'\x22');}break;default:_0x5b7db5[_0xe81e('0x44')]('\x22'+_0x1d0b92+'\x22');}}else{switch(_0x55f425){case _0xe81e('0x72'):case _0xe81e('0x12'):_0x4bc2b1['push'](_0x55f425+_0xe81e('0x73'));break;default:_0x5b7db5[_0xe81e('0x44')]('\x22\x22');}}}}if(_0x4bc2b1[_0xe81e('0x50')]){handleError(_0x46cdb4[_0xe81e('0x63')][_0x282774],{'code':'SystemRow','message':_0x4bc2b1[_0xe81e('0x14')]()});}else{fs[_0xe81e('0x74')](_0x3ee87f,_0x5b7db5[_0xe81e('0x14')]()+'\x0a');}_0x5b7db5=[];}if(!(stats[_0xe81e('0x64')]%0xc8)){socket[_0xe81e('0x75')](_0xe81e('0x76')+_0x3e8baa,stats);stats[_0xe81e('0x43')]=[];}}if(stopped){logger['info'](_0xe81e('0x77'));_0x1322cc[_0xe81e('0x78')]();}}catch(_0x3c7fcf){handleError(_0x46cdb4[_0xe81e('0x63')][_0x282774],{'code':_0xe81e('0x79'),'message':_0x3c7fcf['message']});logger['error']('step',_0x3c7fcf['message']);}},'complete':function(){try{var _0x5c07b5=[];var _0x1262ed=[];var _0x5af01f=_0xe81e('0x29');if(_0x21d736[_0xe81e('0x7a')]&&_0x21d736[_0xe81e('0x7a')][_0xe81e('0x50')]){_0x5af01f=_0xe81e('0x7b')+_0x3e8baa;_0x5c07b5['push']('CREATE\x20TABLE\x20'+_0x5af01f+_0xe81e('0x7c'));}tmp_campaigns=_0xe81e('0x7d')+_0x3e8baa;tmp_voice_queues=_0xe81e('0x7e')+_0x3e8baa;_0x1262ed['push'](_0xe81e('0x7f')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x1262ed['push'](_0xe81e('0x7f')+tmp_voice_queues+_0xe81e('0x80'));BPromise[_0xe81e('0x81')](_0x1262ed,handleTZQuery)[_0xe81e('0x55')](function(_0x569ad4){updateTzCampaigns(_0x21d736[_0xe81e('0x24')])['then'](function(_0x470b24){updateTzVoiceQueues(_0x21d736[_0xe81e('0x24')])[_0xe81e('0x55')](function(_0x3474e7){var _0x3d1956=util[_0xe81e('0x82')](_0xe81e('0x83'),_0x3ee87f,_0x5af01f,_0x1e98c9,_0x21d736[_0xe81e('0x24')],_0x21d736[_0xe81e('0x3c')]||null,NOW,NOW);if(_['isNil'](_0x3538a0[_0xe81e('0x22')])){_0x3d1956+=',\x20scheduledAt\x20=\x20NOW()';}_0x5c07b5[_0xe81e('0x44')](_0x3d1956);if(_0x21d736[_0xe81e('0x7a')]&&_0x21d736[_0xe81e('0x7a')][_0xe81e('0x50')]){_0x5c07b5['push'](insertCmContact(_0x21d736[_0xe81e('0x24')],_0x5af01f,_0x21d736['duplicates'],_0x3538a0));_0x5c07b5[_0xe81e('0x44')](_0xe81e('0x84')+_0x5af01f+';');}if(hasTZ){_0x5c07b5[_0xe81e('0x44')](insertTzCmHopper(_0x21d736[_0xe81e('0x24')],_0xe81e('0x85'),_0xe81e('0x86'),_0xe81e('0x87'),_0x25c19d,tmp_voice_queues));_0x5c07b5[_0xe81e('0x44')](insertTzCmHopperBlack(_0x21d736[_0xe81e('0x24')],_0xe81e('0x88'),_0xe81e('0x86'),_0xe81e('0x87')));_0x5c07b5['push'](insertTzCmHopper(_0x21d736[_0xe81e('0x24')],_0xe81e('0x4c'),_0xe81e('0x4b'),_0xe81e('0x89'),_0x25c19d,tmp_campaigns));_0x5c07b5[_0xe81e('0x44')](insertTzCmHopperBlack(_0x21d736[_0xe81e('0x24')],_0xe81e('0x8a'),_0xe81e('0x4b'),_0xe81e('0x89')));}else{_0x5c07b5[_0xe81e('0x44')](insertCmHopper(_0x21d736[_0xe81e('0x24')],'voice_queues_has_cm_lists',_0xe81e('0x86'),_0xe81e('0x87'),_0x25c19d));_0x5c07b5[_0xe81e('0x44')](insertCmHopperBlack(_0x21d736[_0xe81e('0x24')],'voice_queues_has_cm_blacklists',_0xe81e('0x86'),_0xe81e('0x87')));_0x5c07b5[_0xe81e('0x44')](insertCmHopper(_0x21d736[_0xe81e('0x24')],_0xe81e('0x4c'),_0xe81e('0x4b'),_0xe81e('0x89'),_0x25c19d));_0x5c07b5[_0xe81e('0x44')](insertCmHopperBlack(_0x21d736['ListId'],_0xe81e('0x8a'),'campaigns',_0xe81e('0x89')));}_0x5c07b5[_0xe81e('0x44')](_0xe81e('0x84')+tmp_campaigns+';');_0x5c07b5[_0xe81e('0x44')](_0xe81e('0x84')+tmp_voice_queues+';');BPromise['each'](_0x5c07b5,handleQuery)['then'](function(_0x139d70){stats[_0xe81e('0x8b')]=!![];stats[_0xe81e('0x8c')]=_0x21d736['duplicates']&&_0x21d736[_0xe81e('0x7a')][_0xe81e('0x50')]?results[0x2]['affectedRows']:results[0x0]['affectedRows'];socket[_0xe81e('0x75')](_0xe81e('0x76')+_0x3e8baa,stats);fs['unlink'](_0x1c403b);fs['unlink'](_0x3ee87f);process[_0xe81e('0x42')](0x0);})[_0xe81e('0x48')](function(_0x56b1b3){logger[_0xe81e('0x40')](_0x56b1b3[_0xe81e('0x41')]);process['exit'](0x1);});});});});}catch(_0x3da6fd){logger[_0xe81e('0x40')](_0xe81e('0x8d'),_0x3da6fd[_0xe81e('0x41')]);process['exit'](0x1);}},'error':function(_0x3f5180,_0x4d416d,_0x130ad0,_0x2feca1){throw new Error(_0x2feca1);}});}function validate(){if(process[_0xe81e('0x8e')]&&process[_0xe81e('0x8e')][_0xe81e('0x50')]<0x4){throw new Error(_0xe81e('0x8f'));}var _0x377673=path[_0xe81e('0x14')](config[_0xe81e('0x5f')],'server/files/tmp',process[_0xe81e('0x8e')][0x2]);if(!fs[_0xe81e('0x90')](_0x377673)){throw new Error(_0xe81e('0x91'));}var _0x30b476={};try{_0x30b476=JSON[_0xe81e('0x92')](process[_0xe81e('0x8e')][0x3]);if(!_0x30b476[_0xe81e('0x93')]){throw new Error(_0xe81e('0x94'));}if(!_0x30b476[_0xe81e('0x93')]['phone']){throw new Error(_0xe81e('0x95'));}if(!_0x30b476['binding']['firstName']){throw new Error(_0xe81e('0x96'));}var _0x3d0a07=0x0;if(_0x30b476[_0xe81e('0x93')][_0xe81e('0x97')]){_0x3d0a07=0x1;}if(!_0x30b476['ListId']){throw new Error(_0xe81e('0x98'));}}catch(_0x8824ea){throw new Error('body\x20id\x20mandatory');}var _0x40bdf4=[];try{_0x40bdf4=_[_0xe81e('0x99')](JSON[_0xe81e('0x92')](process[_0xe81e('0x8e')][0x4]),'id');}catch(_0x3dc730){logger['info'](_0xe81e('0x9a'));}main(_0x377673,_0x30b476,_0x40bdf4,_0x3d0a07);}validate();process['on'](_0xe81e('0x9b'),handleStop);process['on'](_0xe81e('0x9c'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index dbb1e17..38202b6 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb834=['duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','queue','push','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','***\x20Call\x20Info\x20***','membername','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb834,0x1aa));var _0x4b83=function(_0x560924,_0x258a47){_0x560924=_0x560924-0x0;var _0x5c694d=_0xb834[_0x560924];return _0x5c694d;};'use strict';exports[_0x4b83('0x0')]=function(_0x174eee,_0x2061f8){var _0x70df76=[{'type':_0x4b83('0x1'),'content':_0x4b83('0x2'),'variableName':null}];switch(_0x174eee['toLowerCase']()){case _0x4b83('0x3'):switch(_0x2061f8[_0x4b83('0x4')]()){case _0x4b83('0x5'):_0x70df76['push']({'type':_0x4b83('0x6'),'content':'','variableName':_0x4b83('0x7')});_0x70df76['push']({'type':'variable','content':'','variableName':'calleridnum'});break;case'outbound':_0x70df76[_0x4b83('0x8')]({'type':'string','content':_0x4b83('0x9'),'variableName':null});_0x70df76[_0x4b83('0x8')]({'type':_0x4b83('0x6'),'content':'','variableName':_0x4b83('0xa')});break;}}return _0x70df76;};exports[_0x4b83('0xb')]=function(_0x491563,_0xde9658){var _0x596547=[];switch(_0x491563[_0x4b83('0x4')]()){case _0x4b83('0x3'):switch(_0xde9658[_0x4b83('0x4')]()){case'inbound':_0x596547=[{'type':_0x4b83('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0xd'),'keyType':_0x4b83('0x6'),'variableName':_0x4b83('0xe')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0xf'),'keyType':_0x4b83('0x6'),'variableName':_0x4b83('0x10')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x11'),'keyType':'variable','variableName':_0x4b83('0x12')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x13'),'keyType':'variable','variableName':_0x4b83('0x7')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x14'),'keyType':'variable','variableName':_0x4b83('0x15')},{'type':_0x4b83('0xc'),'content':'','key':'Date','keyType':_0x4b83('0x6'),'variableName':_0x4b83('0x16')},{'type':_0x4b83('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x17'),'keyType':'variable','variableName':_0x4b83('0x18')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x19'),'keyType':_0x4b83('0x6'),'variableName':_0x4b83('0xa')},{'type':_0x4b83('0x1'),'content':_0x4b83('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x1b'),'keyType':'variable','variableName':_0x4b83('0x16')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x1c'),'keyType':_0x4b83('0x6'),'variableName':_0x4b83('0x1d')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x1e'),'keyType':_0x4b83('0x6'),'variableName':'agentcompleteAt'},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x1f'),'keyType':_0x4b83('0x6'),'variableName':_0x4b83('0x20')},{'type':'keyValue','content':'','key':_0x4b83('0x21'),'keyType':_0x4b83('0x6'),'variableName':_0x4b83('0x22')}];break;case _0x4b83('0x23'):_0x596547=[{'type':_0x4b83('0x1'),'content':_0x4b83('0x24'),'variableName':null},{'type':_0x4b83('0xc'),'content':'','key':'Called\x20Number','keyType':_0x4b83('0x6'),'keyContent':'','variableName':_0x4b83('0xa')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0x4b83('0x6'),'keyContent':'','variableName':_0x4b83('0x25')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x14'),'keyType':_0x4b83('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x4b83('0x26'),'keyType':_0x4b83('0x6'),'keyContent':'','variableName':_0x4b83('0x27')},{'type':_0x4b83('0x1'),'content':_0x4b83('0x1a')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x28'),'keyType':_0x4b83('0x6'),'keyContent':'','variableName':_0x4b83('0x29')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x2a'),'keyType':_0x4b83('0x6'),'keyContent':'','variableName':_0x4b83('0x2b')},{'type':_0x4b83('0xc'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':_0x4b83('0x2c')},{'type':_0x4b83('0xc'),'content':'','key':_0x4b83('0x2d'),'keyType':_0x4b83('0x6'),'keyContent':'','variableName':_0x4b83('0x2e')}];break;}}return _0x596547;}; \ No newline at end of file +var _0xcac0=['Called\x20Number','membername','starttime','answertime','endtime','Duration','duration','billableseconds','getSubjects','toLowerCase','inbound','push','queue','variable','calleridnum','outbound','string','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','holdtime','Talk\x20Time','talktime'];(function(_0x448f76,_0x43ebce){var _0x492acd=function(_0x28ef15){while(--_0x28ef15){_0x448f76['push'](_0x448f76['shift']());}};_0x492acd(++_0x43ebce);}(_0xcac0,0x83));var _0x0cac=function(_0x5b60e5,_0x2772db){_0x5b60e5=_0x5b60e5-0x0;var _0x4f3121=_0xcac0[_0x5b60e5];return _0x4f3121;};'use strict';exports[_0x0cac('0x0')]=function(_0x2458af,_0x18d213){var _0x18034a=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x2458af[_0x0cac('0x1')]()){case'voice':switch(_0x18d213[_0x0cac('0x1')]()){case _0x0cac('0x2'):_0x18034a[_0x0cac('0x3')]({'type':'variable','content':'','variableName':_0x0cac('0x4')});_0x18034a[_0x0cac('0x3')]({'type':_0x0cac('0x5'),'content':'','variableName':_0x0cac('0x6')});break;case _0x0cac('0x7'):_0x18034a[_0x0cac('0x3')]({'type':_0x0cac('0x8'),'content':'Outbound\x20Call','variableName':null});_0x18034a[_0x0cac('0x3')]({'type':_0x0cac('0x5'),'content':'','variableName':_0x0cac('0x9')});break;}}return _0x18034a;};exports[_0x0cac('0xa')]=function(_0x1174a7,_0x36298f){var _0x541649=[];switch(_0x1174a7[_0x0cac('0x1')]()){case _0x0cac('0xb'):switch(_0x36298f[_0x0cac('0x1')]()){case _0x0cac('0x2'):_0x541649=[{'type':_0x0cac('0x8'),'content':_0x0cac('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x0cac('0xd'),'content':'','key':_0x0cac('0xe'),'keyType':_0x0cac('0x5'),'variableName':'calleridnum'},{'type':_0x0cac('0xd'),'content':'','key':_0x0cac('0xf'),'keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x10')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0x0cac('0xd'),'content':'','key':_0x0cac('0x11'),'keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x4')},{'type':_0x0cac('0xd'),'content':'','key':_0x0cac('0x12'),'keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x13')},{'type':'keyValue','content':'','key':_0x0cac('0x14'),'keyType':'variable','variableName':_0x0cac('0x15')},{'type':'string','content':_0x0cac('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0cac('0x17'),'keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x18')},{'type':_0x0cac('0xd'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0x0cac('0x9')},{'type':'string','content':_0x0cac('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x0cac('0xd'),'content':'','key':_0x0cac('0x1a'),'keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x15')},{'type':_0x0cac('0xd'),'content':'','key':_0x0cac('0x1b'),'keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x1c')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x1d')},{'type':_0x0cac('0xd'),'content':'','key':'Hold\x20Time','keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x1e')},{'type':'keyValue','content':'','key':_0x0cac('0x1f'),'keyType':_0x0cac('0x5'),'variableName':_0x0cac('0x20')}];break;case'outbound':_0x541649=[{'type':_0x0cac('0x8'),'content':_0x0cac('0xc'),'variableName':null},{'type':_0x0cac('0xd'),'content':'','key':_0x0cac('0x21'),'keyType':_0x0cac('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x0cac('0xd'),'content':'','key':'Member\x20Name','keyType':_0x0cac('0x5'),'keyContent':'','variableName':_0x0cac('0x22')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x0cac('0x5'),'keyContent':'','variableName':_0x0cac('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x0cac('0x5'),'keyContent':'','variableName':_0x0cac('0x23')},{'type':_0x0cac('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0cac('0xd'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x0cac('0x24')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0x0cac('0x5'),'keyContent':'','variableName':_0x0cac('0x25')},{'type':'keyValue','content':'','key':_0x0cac('0x26'),'keyType':_0x0cac('0x5'),'keyContent':'','variableName':_0x0cac('0x27')},{'type':_0x0cac('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x0cac('0x5'),'keyContent':'','variableName':_0x0cac('0x28')}];break;}}return _0x541649;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index ab5cc5f..73e5349 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea86=['toUpperCase','stringify','Interaction','findOne','then','catch','error','tracked','user','query','clone','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x58bae4,_0x12c75a){var _0x54e96f=function(_0x40f277){while(--_0x40f277){_0x58bae4['push'](_0x58bae4['shift']());}};_0x54e96f(++_0x12c75a);}(_0xea86,0x18a));var _0x6ea8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea86[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6ea8('0x0'));var db=require(_0x6ea8('0x1'))['db'];var loggers={'openchannel':require(_0x6ea8('0x2'))('openchannel-interactions'),'mail':require(_0x6ea8('0x2'))('mail-interactions'),'fax':require(_0x6ea8('0x2'))(_0x6ea8('0x3')),'sms':require('../../config/logger')(_0x6ea8('0x4')),'chat':require(_0x6ea8('0x2'))('chat-interactions'),'whatsapp':require(_0x6ea8('0x2'))(_0x6ea8('0x5'))};function getInteractionId(_0x183dd2,_0x654944,_0x28f660){if(_0x183dd2&&_0x183dd2[_[_0x6ea8('0x6')](_0x28f660)+_0x6ea8('0x7')]){return _0x183dd2[_[_0x6ea8('0x6')](_0x28f660)+'InteractionId'];}else if(_0x183dd2&&_0x183dd2['id']){return _0x183dd2['id'];}else if(_0x654944&&_0x654944['id']){return _0x654944['id'];}else{return _0x6ea8('0x8');}}function log(_0x4a8c6b,_0x39e8ed,_0xf66e5b,_0x20767a,_0x2f9035,_0x2ded5d){loggers[_0x2f9035[_0x6ea8('0x9')]()][_0x4a8c6b](_0x6ea8('0xa'),_0x2ded5d[_0x6ea8('0xb')](),_0x39e8ed?_0x39e8ed['id']:null,_0x39e8ed?_0x39e8ed['name']:null,_0x39e8ed?_0x39e8ed['role']:null,getInteractionId(_0xf66e5b,_0x20767a,_0x2f9035),_0xf66e5b?JSON[_0x6ea8('0xc')](_0xf66e5b):'null');}function updateUser(_0x35e7d8,_0x490c26,_0x329101,_0x5e7e71,_0x211791){db[_['upperFirst'](_0x5e7e71)+_0x6ea8('0xd')][_0x6ea8('0xe')]({'where':{'id':getInteractionId(_0x490c26,_0x329101,_0x5e7e71)}})[_0x6ea8('0xf')](function(_0xba27e){if(_0xba27e){return _0xba27e['update']({'UserId':_0x35e7d8?_0x35e7d8['id']:null});}})[_0x6ea8('0xf')](function(_0x275e04){if(_0x275e04){log('info',_0x35e7d8,_0x490c26,_0x329101,_0x5e7e71,_0x211791);}})[_0x6ea8('0x10')](function(){log(_0x6ea8('0x11'),_0x35e7d8,_0x490c26,_0x329101,_0x5e7e71,_0x211791);});}exports[_0x6ea8('0x12')]=function(_0x328d2d,_0x187a51){return function(_0x3e018d,_0x3e7d1f,_0x168349){var _0x2e909c=_0x3e018d[_0x6ea8('0x13')];var _0x363ae6={};var _0x69739b=_0x3e018d[_0x6ea8('0x14')];if(_0x363ae6){_0x363ae6=_[_0x6ea8('0x15')](_0x3e018d[_0x6ea8('0x16')]);_0x363ae6=_[_0x6ea8('0x17')](_0x363ae6,[_0x6ea8('0x16'),_0x6ea8('0x18'),_0x6ea8('0x19'),'fax',_0x6ea8('0x1a')]);}updateUser(_0x2e909c,_0x363ae6,_0x69739b,_0x328d2d,_0x187a51);_0x168349(null);};}; \ No newline at end of file +var _0x3892=['catch','error','tracked','user','query','clone','body','omit','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','findOne','then','info'];(function(_0x5cc84e,_0x886506){var _0x2f9b2d=function(_0x4a67c1){while(--_0x4a67c1){_0x5cc84e['push'](_0x5cc84e['shift']());}};_0x2f9b2d(++_0x886506);}(_0x3892,0x13f));var _0x2389=function(_0x131870,_0x7abf35){_0x131870=_0x131870-0x0;var _0x2a2f3e=_0x3892[_0x131870];return _0x2a2f3e;};'use strict';var _=require(_0x2389('0x0'));var db=require(_0x2389('0x1'))['db'];var loggers={'openchannel':require(_0x2389('0x2'))(_0x2389('0x3')),'mail':require(_0x2389('0x2'))('mail-interactions'),'fax':require(_0x2389('0x2'))(_0x2389('0x4')),'sms':require(_0x2389('0x2'))('sms-interactions'),'chat':require(_0x2389('0x2'))(_0x2389('0x5')),'whatsapp':require(_0x2389('0x2'))(_0x2389('0x6'))};function getInteractionId(_0x10a845,_0x51904c,_0x404595){if(_0x10a845&&_0x10a845[_['upperFirst'](_0x404595)+_0x2389('0x7')]){return _0x10a845[_[_0x2389('0x8')](_0x404595)+'InteractionId'];}else if(_0x10a845&&_0x10a845['id']){return _0x10a845['id'];}else if(_0x51904c&&_0x51904c['id']){return _0x51904c['id'];}else{return _0x2389('0x9');}}function log(_0x9bdf73,_0x3f3e48,_0x9d25d5,_0x23314e,_0x206d12,_0x17c527){loggers[_0x206d12[_0x2389('0xa')]()][_0x9bdf73](_0x2389('0xb'),_0x17c527['toUpperCase'](),_0x3f3e48?_0x3f3e48['id']:null,_0x3f3e48?_0x3f3e48['name']:null,_0x3f3e48?_0x3f3e48[_0x2389('0xc')]:null,getInteractionId(_0x9d25d5,_0x23314e,_0x206d12),_0x9d25d5?JSON['stringify'](_0x9d25d5):_0x2389('0xd'));}function updateUser(_0x4e7ee6,_0x42c9fa,_0x445567,_0x5c4520,_0x54de15){db[_[_0x2389('0x8')](_0x5c4520)+'Interaction'][_0x2389('0xe')]({'where':{'id':getInteractionId(_0x42c9fa,_0x445567,_0x5c4520)}})['then'](function(_0x854ace){if(_0x854ace){return _0x854ace['update']({'UserId':_0x4e7ee6?_0x4e7ee6['id']:null});}})[_0x2389('0xf')](function(_0xb53f7){if(_0xb53f7){log(_0x2389('0x10'),_0x4e7ee6,_0x42c9fa,_0x445567,_0x5c4520,_0x54de15);}})[_0x2389('0x11')](function(){log(_0x2389('0x12'),_0x4e7ee6,_0x42c9fa,_0x445567,_0x5c4520,_0x54de15);});}exports[_0x2389('0x13')]=function(_0x1c018a,_0x11b7c3){return function(_0x28e86e,_0x3e285e,_0x314c66){var _0x42d48e=_0x28e86e[_0x2389('0x14')];var _0x42fa72={};var _0x35c063=_0x28e86e[_0x2389('0x15')];if(_0x42fa72){_0x42fa72=_[_0x2389('0x16')](_0x28e86e[_0x2389('0x17')]);_0x42fa72=_[_0x2389('0x18')](_0x42fa72,['body','html',_0x2389('0x19'),_0x2389('0x1a'),_0x2389('0x1b')]);}updateUser(_0x42d48e,_0x42fa72,_0x35c063,_0x1c018a,_0x11b7c3);_0x314c66(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5d63d24..6adaf01 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 _0xab04=['update','base64','final','utf8','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','crypto','util','composable-middleware','../../config/environment','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xab04,0x1b8));var _0x4ab0=function(_0x15f590,_0x42b288){_0x15f590=_0x15f590-0x0;var _0x53671c=_0xab04[_0x15f590];return _0x53671c;};'use strict';var crypto=require(_0x4ab0('0x0'));var util=require(_0x4ab0('0x1'));var compose=require(_0x4ab0('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x4ab0('0x3'));function getValueFromLicense(_0x29c0fa,_0xf0720f){if(_0x29c0fa&&_0xf0720f){if(_0xf0720f['data1']&&_0xf0720f['license']){var _0x23f5a4=_0xf0720f[_0x4ab0('0x4')];var _0xa24735=_0xf0720f['license'];var _0x28ef60=_0x23f5a4[_0x4ab0('0x5')]('-')[0x4];var _0xbe2c7b=_0x23f5a4[_0x4ab0('0x5')]('-')[0x0];var _0x31773b=crypto[_0x4ab0('0x6')](_0x4ab0('0x7'),util[_0x4ab0('0x8')](_0x4ab0('0x9'),_0x28ef60,_0x23f5a4,_0xbe2c7b));var _0x3cca78=_0x31773b[_0x4ab0('0xa')](_0xa24735,_0x4ab0('0xb'),'utf8');_0x3cca78+=_0x31773b[_0x4ab0('0xc')](_0x4ab0('0xd'));var _0x2cb167=JSON['parse'](_0x3cca78);return _0x2cb167['hasOwnProperty'](_0x29c0fa)?_0x2cb167[_0x29c0fa]:null;}}return null;}function isLimit(_0x5f0d0c,_0x5ad0f4,_0x3d6331,_0x4ef609){var _0x4a91a8=_0x5ad0f4;return compose()[_0x4ab0('0xe')](function(_0x270ebf,_0x47aff3,_0x312bfd){return db[_0x4ab0('0xf')][_0x4ab0('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x4ab0('0x11')](function(_0x1194b1){var _0x57a2f1=getValueFromLicense(_0x5f0d0c,_0x1194b1);return _0x57a2f1?_0x57a2f1:_0x4a91a8;})[_0x4ab0('0x11')](function(_0x57892b){_0x4a91a8=_0x57892b;return _0x3d6331['count'](_0x4ef609);})[_0x4ab0('0x11')](function(_0x27fa02){if(_0x27fa02>=_0x4a91a8){return _0x47aff3[_0x4ab0('0x12')](0x193)[_0x4ab0('0x13')]({'message':util['format'](_0x4ab0('0x14'),_0x5f0d0c)});}_0x312bfd();})[_0x4ab0('0x15')](function(_0x58b238){_0x312bfd(_0x58b238);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x4ab0('0x16')],{'where':{'$or':[{'role':_0x4ab0('0x17')},{'role':_0x4ab0('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xadcf=['aes-256-ctr','format','update','base64','utf8','final','hasOwnProperty','use','License','then','count','status','json','catch','User','admin','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher'];(function(_0x5f0a46,_0x17e0d4){var _0x3929f7=function(_0x4474ee){while(--_0x4474ee){_0x5f0a46['push'](_0x5f0a46['shift']());}};_0x3929f7(++_0x17e0d4);}(_0xadcf,0xbf));var _0xfadc=function(_0x9f83b9,_0x214ceb){_0x9f83b9=_0x9f83b9-0x0;var _0x3f19da=_0xadcf[_0x9f83b9];return _0x3f19da;};'use strict';var crypto=require(_0xfadc('0x0'));var util=require(_0xfadc('0x1'));var compose=require(_0xfadc('0x2'));var db=require(_0xfadc('0x3'))['db'];var config=require(_0xfadc('0x4'));function getValueFromLicense(_0x447f8d,_0x1c9530){if(_0x447f8d&&_0x1c9530){if(_0x1c9530[_0xfadc('0x5')]&&_0x1c9530[_0xfadc('0x6')]){var _0x398a54=_0x1c9530[_0xfadc('0x5')];var _0x471ff0=_0x1c9530[_0xfadc('0x6')];var _0x41c48c=_0x398a54[_0xfadc('0x7')]('-')[0x4];var _0x3662be=_0x398a54['split']('-')[0x0];var _0x410ca9=crypto[_0xfadc('0x8')](_0xfadc('0x9'),util[_0xfadc('0xa')]('%s:%s:%s',_0x41c48c,_0x398a54,_0x3662be));var _0x126f8c=_0x410ca9[_0xfadc('0xb')](_0x471ff0,_0xfadc('0xc'),_0xfadc('0xd'));_0x126f8c+=_0x410ca9[_0xfadc('0xe')](_0xfadc('0xd'));var _0x1c7d97=JSON['parse'](_0x126f8c);return _0x1c7d97[_0xfadc('0xf')](_0x447f8d)?_0x1c7d97[_0x447f8d]:null;}}return null;}function isLimit(_0x36cbe0,_0x533b2b,_0x35adc7,_0x5ed4c0){var _0xda0b92=_0x533b2b;return compose()[_0xfadc('0x10')](function(_0xa073a,_0x164dc2,_0x1e6776){return db[_0xfadc('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xfadc('0x12')](function(_0x285549){var _0x274272=getValueFromLicense(_0x36cbe0,_0x285549);return _0x274272?_0x274272:_0xda0b92;})[_0xfadc('0x12')](function(_0x407662){_0xda0b92=_0x407662;return _0x35adc7[_0xfadc('0x13')](_0x5ed4c0);})['then'](function(_0x164a65){if(_0x164a65>=_0xda0b92){return _0x164dc2[_0xfadc('0x14')](0x193)[_0xfadc('0x15')]({'message':util[_0xfadc('0xa')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x36cbe0)});}_0x1e6776();})[_0xfadc('0x16')](function(_0x24291e){_0x1e6776(_0x24291e);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xfadc('0x17')],{'where':{'$or':[{'role':_0xfadc('0x18')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 51f2e22..ba2744b 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 _0x8ee0=['lodash','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','length','split','slice','match','forEach','indexOf','map','conditions','push','buildExpression','DATE','$between','$gt','$lte','operator','value','add','days','YYYY-MM-DD','castTo','text','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','>=\x20?','start','$substring','shift','pop','utcOffset','format','hours','minutes','seconds'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x8ee0,0xdc));var _0x08ee=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x8ee0[_0x59eacf];return _0x5d74f2;};'use strict';var _=require(_0x08ee('0x0'));var moment=require('moment');exports[_0x08ee('0x1')]=function(_0xaef7a){var _0x3a425f={'conditions':[]};_0x3a425f[_0x08ee('0x2')]=_[_0x08ee('0x3')](_0xaef7a,'[$or]')?'or':_0x08ee('0x4');var _0x428281=_0xaef7a[_0x08ee('0x5')](_0x08ee('0x6'),'')[_0x08ee('0x5')](_0x08ee('0x7'),'')['split']('||');for(var _0x1c7e5b=0x0;_0x1c7e5b<_0x428281[_0x08ee('0x8')];_0x1c7e5b++){var _0x1df076=_0x428281[_0x1c7e5b][_0x08ee('0x9')](':=');var _0x5cc34e=_0x1df076[0x0];var _0x2acba6=_0x1df076[_0x08ee('0xa')](0x1);_0x2acba6['forEach'](function(_0x59b688){var _0xaa4aee=_0x59b688[_0x08ee('0x9')]('[')['shift']();var _0x400d93=_0x59b688[_0x08ee('0xb')](/\[(.*?)\]/g);_0x400d93[_0x08ee('0xc')](function(_0x54941a){var _0x3c67d6=_0x54941a['split']('[')['filter'](function(_0x584af4){return _0x584af4[_0x08ee('0xd')](']')>-0x1;})[_0x08ee('0xe')](function(_0x3e785e){return _0x3e785e[_0x08ee('0x9')](']')[0x0];})[0x0];_0x3a425f[_0x08ee('0xf')][_0x08ee('0x10')]({'field':_0x5cc34e,'operator':_0xaa4aee,'value':_0x3c67d6});});});}return _0x3a425f;};exports[_0x08ee('0x11')]=function(_0x142526,_0x129483,_0x3f3ff1){var _0xfe3919={};if(_0x129483===_0x08ee('0x12')){if(_0x3f3ff1['operator']==='$eq'){_0x3f3ff1['operator']=_0x08ee('0x13');_0x3f3ff1['value']+=','+_0x3f3ff1['value'];}else if(_['includes']([_0x08ee('0x14'),_0x08ee('0x15')],_0x3f3ff1[_0x08ee('0x16')])){_0x3f3ff1[_0x08ee('0x17')]=moment(_0x3f3ff1['value'])[_0x08ee('0x18')](0x1,_0x08ee('0x19'))['format'](_0x08ee('0x1a'));}}if(_0x3f3ff1[_0x08ee('0x1b')]){_0x129483=_0x3f3ff1['castTo'];_0xfe3919[_0x08ee('0x1c')]='CAST('+_0x142526+'.'+_0x3f3ff1['field']+_0x08ee('0x1d')+_0x3f3ff1[_0x08ee('0x1b')]+')\x20'+parseOperator(_0x3f3ff1[_0x08ee('0x16')]);}else{_0xfe3919[_0x08ee('0x1c')]=_0x142526+'.'+_0x3f3ff1['field']+'\x20'+parseOperator(_0x3f3ff1[_0x08ee('0x16')]);}if(_[_0x08ee('0x1e')]([_0x08ee('0x1f'),_0x08ee('0x20')],_0x3f3ff1[_0x08ee('0x16')]))_0xfe3919[_0x08ee('0x1c')]='('+_0xfe3919['text']+_0x08ee('0x21')+_0x142526+'.'+_0x3f3ff1['field']+_0x08ee('0x22');_0xfe3919['value']=parseValue(_0x129483,_0x3f3ff1[_0x08ee('0x16')],_0x3f3ff1[_0x08ee('0x17')]);return _0xfe3919;};function parseOperator(_0x58e1f7){var _0x4b5f08;switch(_0x58e1f7){case _0x08ee('0x23'):_0x4b5f08='IN\x20?';break;case _0x08ee('0x20'):_0x4b5f08=_0x08ee('0x24');break;case _0x08ee('0x25'):_0x4b5f08=_0x08ee('0x26');break;case _0x08ee('0x1f'):_0x4b5f08=_0x08ee('0x27');break;case'$substring':case _0x08ee('0x28'):case _0x08ee('0x29'):_0x4b5f08=_0x08ee('0x2a');break;case'$lt':_0x4b5f08='<\x20?';break;case _0x08ee('0x14'):_0x4b5f08=_0x08ee('0x2b');break;case _0x08ee('0x15'):_0x4b5f08=_0x08ee('0x2c');break;case'$gte':_0x4b5f08=_0x08ee('0x2d');break;case _0x08ee('0x13'):_0x4b5f08='BETWEEN\x20?\x20AND\x20?';break;}return _0x4b5f08;}function parseValue(_0x4bb5ba,_0x13f01d,_0x1d5326){var _0xba306c={'start':undefined,'end':undefined};switch(_0x13f01d){case'$in':case _0x08ee('0x20'):_0xba306c[_0x08ee('0x2e')]=_0x1d5326[_0x08ee('0x9')](',');break;case _0x08ee('0x2f'):_0xba306c[_0x08ee('0x2e')]='%'+_0x1d5326+'%';break;case _0x08ee('0x28'):_0xba306c['start']=_0x1d5326+'%';break;case'$endsWith':_0xba306c[_0x08ee('0x2e')]='%'+_0x1d5326;break;case'$between':var _0x4d0b0c=_0x1d5326[_0x08ee('0x9')](',');var _0x1d5326=_0x4d0b0c[_0x08ee('0x30')]();var _0x1bfb7e=_0x4d0b0c[_0x08ee('0x31')]();if(_0x4bb5ba==='DATE'){_0x1d5326=moment(_0x1d5326)[_0x08ee('0x32')](0x0,!![])[_0x08ee('0x33')]();_0x1bfb7e=moment(_0x1bfb7e)[_0x08ee('0x32')](0x0,!![])[_0x08ee('0x18')](0x17,_0x08ee('0x34'))['add'](0x3b,_0x08ee('0x35'))[_0x08ee('0x18')](0x3b,_0x08ee('0x36'))['format']();}_0xba306c={'start':_0x1d5326,'end':_0x1bfb7e};break;default:_0xba306c['start']=_0x1d5326;break;}return _0xba306c;} \ No newline at end of file +var _0xc196=['seconds','lodash','parseSearch','sqlOperator','startsWith','replace','split','length','slice','forEach','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','$ne','$notIn','field','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','shift','pop','utcOffset','hours','minutes'];(function(_0x29f904,_0xe08408){var _0x5799d3=function(_0xe6f373){while(--_0xe6f373){_0x29f904['push'](_0x29f904['shift']());}};_0x5799d3(++_0xe08408);}(_0xc196,0x6d));var _0x6c19=function(_0x6db41a,_0x1f3575){_0x6db41a=_0x6db41a-0x0;var _0x3702c8=_0xc196[_0x6db41a];return _0x3702c8;};'use strict';var _=require(_0x6c19('0x0'));var moment=require('moment');exports[_0x6c19('0x1')]=function(_0x5e33de){var _0x4267e7={'conditions':[]};_0x4267e7[_0x6c19('0x2')]=_[_0x6c19('0x3')](_0x5e33de,'[$or]')?'or':'and';var _0x315bc7=_0x5e33de[_0x6c19('0x4')]('[$and]','')[_0x6c19('0x4')]('[$or]','')[_0x6c19('0x5')]('||');for(var _0xb6e25e=0x0;_0xb6e25e<_0x315bc7[_0x6c19('0x6')];_0xb6e25e++){var _0x3ec19f=_0x315bc7[_0xb6e25e][_0x6c19('0x5')](':=');var _0x58e065=_0x3ec19f[0x0];var _0x1bcb16=_0x3ec19f[_0x6c19('0x7')](0x1);_0x1bcb16[_0x6c19('0x8')](function(_0x4c5b66){var _0x1fb8ae=_0x4c5b66[_0x6c19('0x5')]('[')['shift']();var _0x126b9d=_0x4c5b66[_0x6c19('0x9')](/\[(.*?)\]/g);_0x126b9d[_0x6c19('0x8')](function(_0x546a1f){var _0x12090f=_0x546a1f[_0x6c19('0x5')]('[')[_0x6c19('0xa')](function(_0x5a6819){return _0x5a6819[_0x6c19('0xb')](']')>-0x1;})['map'](function(_0xf8e28b){return _0xf8e28b[_0x6c19('0x5')](']')[0x0];})[0x0];_0x4267e7[_0x6c19('0xc')][_0x6c19('0xd')]({'field':_0x58e065,'operator':_0x1fb8ae,'value':_0x12090f});});});}return _0x4267e7;};exports[_0x6c19('0xe')]=function(_0x56f383,_0x288eab,_0x2523bd){var _0xf67c4b={};if(_0x288eab===_0x6c19('0xf')){if(_0x2523bd[_0x6c19('0x10')]===_0x6c19('0x11')){_0x2523bd[_0x6c19('0x10')]=_0x6c19('0x12');_0x2523bd['value']+=','+_0x2523bd[_0x6c19('0x13')];}else if(_[_0x6c19('0x14')]([_0x6c19('0x15'),_0x6c19('0x16')],_0x2523bd[_0x6c19('0x10')])){_0x2523bd[_0x6c19('0x13')]=moment(_0x2523bd[_0x6c19('0x13')])[_0x6c19('0x17')](0x1,_0x6c19('0x18'))[_0x6c19('0x19')](_0x6c19('0x1a'));}}if(_0x2523bd[_0x6c19('0x1b')]){_0x288eab=_0x2523bd[_0x6c19('0x1b')];_0xf67c4b['text']=_0x6c19('0x1c')+_0x56f383+'.'+_0x2523bd['field']+_0x6c19('0x1d')+_0x2523bd[_0x6c19('0x1b')]+')\x20'+parseOperator(_0x2523bd[_0x6c19('0x10')]);}else{_0xf67c4b[_0x6c19('0x1e')]=_0x56f383+'.'+_0x2523bd['field']+'\x20'+parseOperator(_0x2523bd[_0x6c19('0x10')]);}if(_[_0x6c19('0x14')]([_0x6c19('0x1f'),_0x6c19('0x20')],_0x2523bd[_0x6c19('0x10')]))_0xf67c4b['text']='('+_0xf67c4b[_0x6c19('0x1e')]+'\x20OR\x20'+_0x56f383+'.'+_0x2523bd[_0x6c19('0x21')]+_0x6c19('0x22');_0xf67c4b[_0x6c19('0x13')]=parseValue(_0x288eab,_0x2523bd[_0x6c19('0x10')],_0x2523bd[_0x6c19('0x13')]);return _0xf67c4b;};function parseOperator(_0x51e661){var _0x191ad5;switch(_0x51e661){case'$in':_0x191ad5=_0x6c19('0x23');break;case _0x6c19('0x20'):_0x191ad5=_0x6c19('0x24');break;case _0x6c19('0x11'):_0x191ad5=_0x6c19('0x25');break;case _0x6c19('0x1f'):_0x191ad5=_0x6c19('0x26');break;case _0x6c19('0x27'):case'$startsWith':case _0x6c19('0x28'):_0x191ad5=_0x6c19('0x29');break;case _0x6c19('0x2a'):_0x191ad5=_0x6c19('0x2b');break;case _0x6c19('0x15'):_0x191ad5='>\x20?';break;case _0x6c19('0x16'):_0x191ad5=_0x6c19('0x2c');break;case'$gte':_0x191ad5='>=\x20?';break;case _0x6c19('0x12'):_0x191ad5=_0x6c19('0x2d');break;}return _0x191ad5;}function parseValue(_0x2d07a1,_0x27a34c,_0x48ec35){var _0xb97d80={'start':undefined,'end':undefined};switch(_0x27a34c){case _0x6c19('0x2e'):case _0x6c19('0x20'):_0xb97d80['start']=_0x48ec35[_0x6c19('0x5')](',');break;case _0x6c19('0x27'):_0xb97d80[_0x6c19('0x2f')]='%'+_0x48ec35+'%';break;case'$startsWith':_0xb97d80[_0x6c19('0x2f')]=_0x48ec35+'%';break;case _0x6c19('0x28'):_0xb97d80[_0x6c19('0x2f')]='%'+_0x48ec35;break;case _0x6c19('0x12'):var _0xa32f20=_0x48ec35[_0x6c19('0x5')](',');var _0x48ec35=_0xa32f20[_0x6c19('0x30')]();var _0x294675=_0xa32f20[_0x6c19('0x31')]();if(_0x2d07a1==='DATE'){_0x48ec35=moment(_0x48ec35)[_0x6c19('0x32')](0x0,!![])[_0x6c19('0x19')]();_0x294675=moment(_0x294675)[_0x6c19('0x32')](0x0,!![])[_0x6c19('0x17')](0x17,_0x6c19('0x33'))[_0x6c19('0x17')](0x3b,_0x6c19('0x34'))['add'](0x3b,_0x6c19('0x35'))['format']();}_0xb97d80={'start':_0x48ec35,'end':_0x294675};break;default:_0xb97d80[_0x6c19('0x2f')]=_0x48ec35;break;}return _0xb97d80;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2712b2d..09325ac 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 _0x0bde=['pick','filter','columns','where','lower','merge','options','sequelize','parse','includes','keys','fields','split','filters','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','map','indexOf','cast','col','priority','substr','unsigned','ASC','omit','isEmpty','isObject','length','unset','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','hasOwnProperty','order','sort'];(function(_0x199579,_0x1d1f9f){var _0x57ce27=function(_0x115132){while(--_0x115132){_0x199579['push'](_0x199579['shift']());}};_0x57ce27(++_0x1d1f9f);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var sequelize=require(_0xe0bd('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3fb344){var _0x3dc984=['ne'];try{var _0x1d8922=JSON[_0xe0bd('0x1')](_0x3fb344);var _0x2da4bd=Object['keys'](_0x1d8922)[0x0];return _0x3dc984[_0xe0bd('0x2')](_0x2da4bd);}catch(_0x124139){return![];}}function getOperatorValue(_0x2b9812){var _0x3b712a=JSON[_0xe0bd('0x1')](_0x2b9812);var _0x26393f=Object[_0xe0bd('0x3')](_0x3b712a)[0x0];var _0x491dc7=_0x3b712a[_0x26393f];return{['$'+_0x26393f]:_0x491dc7};}exports[_0xe0bd('0x4')]=function(_0x44cb0b){var _0xb17265=null;if(_0x44cb0b){_0xb17265=_0x44cb0b[_0xe0bd('0x5')](',');}return _0xb17265;};exports[_0xe0bd('0x6')]=function(_0x3c47c4,_0x475265){var _0x58d892={};if(!_['isEmpty'](_0x3c47c4)){_['forOwn'](_0x3c47c4,function(_0x47f96d,_0x44ffa9){try{if(_0x475265){var _0x5e2a24=_['find'](_0x475265,{'name':_0x44ffa9})||{};if(hasSequelizeOperator(_0x47f96d)){_0x58d892[_0x44ffa9]=getOperatorValue(_0x47f96d);}else if(_0x5e2a24[_0xe0bd('0x7')]===_0xe0bd('0x8')&&_['isPlainObject'](_0x47f96d)){var _0xc492b4=JSON['parse'](_0x47f96d);var _0x1bf268={'$gte':moment(moment(_0xc492b4[_0xe0bd('0x9')])[_0xe0bd('0xa')](_0xe0bd('0xb')))[_0xe0bd('0xc')]()[_0xe0bd('0xa')](),'$lte':moment(moment(_0xc492b4[_0xe0bd('0xd')])[_0xe0bd('0xa')]('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0xe0bd('0xa')]()};_0x58d892[_0x44ffa9]=_0x1bf268;}else if(_0x5e2a24[_0xe0bd('0xe')]===_0xe0bd('0xf')){_0x58d892[_0x44ffa9]=_0x47f96d;}else{_0x58d892[_0x44ffa9]=_[_0xe0bd('0x10')](_0x47f96d)?_0x47f96d:JSON[_0xe0bd('0x1')](_0x47f96d);}}else{_0x58d892[_0x44ffa9]=_['isArray'](_0x47f96d)?_0x47f96d:JSON['parse'](_0x47f96d);}}catch(_0x1becc8){_0x58d892[_0x44ffa9]=_0x47f96d['split'](',');}});}return _0x58d892;};exports[_0xe0bd('0x11')]=function(_0x418d64){_0x418d64=parseInt(_0x418d64,0xa);if(!_0x418d64||_0x418d64<0x0){_0x418d64=LIMIT_VALUE;}return _0x418d64;};exports[_0xe0bd('0x12')]=function(_0x20157b){_0x20157b=parseInt(_0x20157b,0xa);if(!_0x20157b||_0x20157b<0x0){_0x20157b=0x0;}return _0x20157b;};exports['sort']=function(_0x1311b1){var _0xe1d808,_0x2b9f93=null;if(_0x1311b1){_0xe1d808=_0x1311b1['split'](',');_0x2b9f93=_[_0xe0bd('0x13')](_0xe1d808,function(_0x25f595){if(_0x25f595[_0xe0bd('0x14')]('-')===0x0){return[_0x25f595==='priority'?sequelize[_0xe0bd('0x15')](sequelize[_0xe0bd('0x16')](_0xe0bd('0x17')),'unsigned'):_0x25f595[_0xe0bd('0x18')](0x1),'DESC'];}else{return[_0x25f595===_0xe0bd('0x17')?sequelize[_0xe0bd('0x15')](sequelize['col'](_0xe0bd('0x17')),_0xe0bd('0x19')):_0x25f595,_0xe0bd('0x1a')];}});}return _0x2b9f93;};exports[_0xe0bd('0x1b')]=function(_0x2a1f92,_0x30e9d3){if(_[_0xe0bd('0x1c')](_0x2a1f92)){return _0x2a1f92;}if(_[_0xe0bd('0x10')](_0x2a1f92)){for(var _0x537708=0x0;_0x537708<_0x2a1f92['length'];_0x537708+=0x1){_0x2a1f92[_0x537708]=this[_0xe0bd('0x1b')](_0x2a1f92[_0x537708],_0x30e9d3);}return _0x2a1f92;}if(!_[_0xe0bd('0x1d')](_0x2a1f92)){return _0x2a1f92;}if(_['isString'](_0x30e9d3)){_0x30e9d3=[_0x30e9d3];}if(!_['isArray'](_0x30e9d3)){return _0x2a1f92;}for(var _0x3bac51=0x0;_0x3bac51<_0x30e9d3[_0xe0bd('0x1e')];_0x3bac51+=0x1){_[_0xe0bd('0x1f')](_0x2a1f92,_0x30e9d3[_0x3bac51]);}for(var _0x1b5861 in _0x2a1f92){if(_0x2a1f92['hasOwnProperty'](_0x1b5861)){_0x2a1f92[_0x1b5861]=this[_0xe0bd('0x1b')](_0x2a1f92[_0x1b5861],_0x30e9d3);}}return _0x2a1f92;};exports['isNumeric']=function(_0x9146fe){return _0x9146fe[_0xe0bd('0x20')](RegExp(_0xe0bd('0x21')))?!![]:![];};exports[_0xe0bd('0x22')]=function(_0x1e2020){return _0x1e2020[_0xe0bd('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xe0bd('0x23')]=function(_0x2d31e9){var _0x25d515=[];_0x2d31e9[_0xe0bd('0x5')](/[ ,]+/)[_0xe0bd('0x24')](function(_0x12d506){_0x12d506=_0x12d506[_0xe0bd('0x25')](/([^:]")"+/g,'$1');_0x12d506='+'+_0x12d506+'*';var _0x56f310=/[ `!@#$%^&*()_\-?~]/;if(_0x12d506[_0xe0bd('0x20')](_0x56f310))_0x12d506='\x22'+_0x12d506+'\x22';_0x25d515[_0xe0bd('0x26')](_0x12d506);});return _0x25d515[_0xe0bd('0x27')]('\x20');};exports[_0xe0bd('0x28')]=function(_0x8c9de3,_0x380c13,_0x56b770){var _0x507c7a={},_0x35019d={};if(_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x2a')]){_0x380c13[_0xe0bd('0x29')]['id']=_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x2a')];delete _0x380c13[_0xe0bd('0x29')]['$id'];}_0x507c7a[_0xe0bd('0x2b')]=_[_0xe0bd('0x13')](_0x8c9de3,_0xe0bd('0xe'));_0x507c7a[_0xe0bd('0x29')]=_[_0xe0bd('0x3')](_0x380c13[_0xe0bd('0x29')]);_0x507c7a['filters']=_[_0xe0bd('0x2c')](_0x507c7a[_0xe0bd('0x2b')],_0x507c7a[_0xe0bd('0x29')]);_0x35019d[_0xe0bd('0x2d')]=_[_0xe0bd('0x2c')](_0x507c7a['model'],this['fields'](_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x4')]));_0x35019d[_0xe0bd('0x2d')]=_0x35019d['attributes'][_0xe0bd('0x1e')]?_0x35019d['attributes']:_0x507c7a['model'];if(!_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x2e')]('nolimit')){_0x35019d['limit']=this['limit'](_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x11')]);_0x35019d[_0xe0bd('0x12')]=this['offset'](_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x12')]);}_0x35019d[_0xe0bd('0x2f')]=this['sort'](_0x380c13['query'][_0xe0bd('0x30')]);_0x35019d['where']=this[_0xe0bd('0x6')](_[_0xe0bd('0x31')](_0x380c13['query'],_0x507c7a[_0xe0bd('0x6')]),_0x8c9de3);if(_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x32')]){var _0xb65059=_0x8c9de3;var _0x2a7782=_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x32')];if(typeof _0x2a7782==='object'){_0xb65059=_[_0xe0bd('0x32')](_0x8c9de3,function(_0x39b832){return _[_0xe0bd('0x2')](_0x2a7782[_0xe0bd('0x33')],_0x39b832[_0xe0bd('0xe')]);});_0x2a7782=_0x2a7782['value'];}_0x35019d['where']=_['merge'](_0x35019d[_0xe0bd('0x34')],{'$or':_[_0xe0bd('0x13')](_0xb65059,function(_0x15de49){if(_0x15de49[_0xe0bd('0x7')]!=='VIRTUAL'){if(_0x56b770){return sequelize['where'](sequelize['fn'](_0xe0bd('0x35'),sequelize[_0xe0bd('0x16')](_0x15de49[_0xe0bd('0xe')])),{'$like':sequelize['fn'](_0xe0bd('0x35'),'%'+_0x380c13[_0xe0bd('0x29')][_0xe0bd('0x32')]+'%')});}else{var _0x3d218d={};_0x3d218d[_0x15de49['name']]={'$like':'%'+_0x380c13[_0xe0bd('0x29')]['filter']+'%'};return _0x3d218d;}}})});}_0x35019d=_[_0xe0bd('0x36')]({},_0x35019d,_0x380c13[_0xe0bd('0x37')]);return _0x35019d;}; \ No newline at end of file +var _0xdb94=['forOwn','type','DATE','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','cast','col','substr','DESC','unsigned','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','query','$id','model','intersection','attributes','fields','nolimit','limit','order','pick','filter','object','columns','value','where','lower','merge','options','sequelize','moment','parse','keys','split','filters','isEmpty'];(function(_0x44124b,_0x2b2b32){var _0xafe8bf=function(_0x421d4e){while(--_0x421d4e){_0x44124b['push'](_0x44124b['shift']());}};_0xafe8bf(++_0x2b2b32);}(_0xdb94,0xe5));var _0x4db9=function(_0x28811c,_0x4d674){_0x28811c=_0x28811c-0x0;var _0x12cfd4=_0xdb94[_0x28811c];return _0x12cfd4;};'use strict';var _=require('lodash');var sequelize=require(_0x4db9('0x0'));var moment=require(_0x4db9('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5edca0){var _0x26e16b=['ne'];try{var _0x3b24a6=JSON[_0x4db9('0x2')](_0x5edca0);var _0x2e85f4=Object[_0x4db9('0x3')](_0x3b24a6)[0x0];return _0x26e16b['includes'](_0x2e85f4);}catch(_0x39eccb){return![];}}function getOperatorValue(_0x541226){var _0x1d21a8=JSON[_0x4db9('0x2')](_0x541226);var _0x1dddb9=Object[_0x4db9('0x3')](_0x1d21a8)[0x0];var _0x42a857=_0x1d21a8[_0x1dddb9];return{['$'+_0x1dddb9]:_0x42a857};}exports['fields']=function(_0x45d5a3){var _0x4376c8=null;if(_0x45d5a3){_0x4376c8=_0x45d5a3[_0x4db9('0x4')](',');}return _0x4376c8;};exports[_0x4db9('0x5')]=function(_0x402132,_0x575064){var _0x268eb5={};if(!_[_0x4db9('0x6')](_0x402132)){_[_0x4db9('0x7')](_0x402132,function(_0xe6de11,_0x34147f){try{if(_0x575064){var _0x3d1b96=_['find'](_0x575064,{'name':_0x34147f})||{};if(hasSequelizeOperator(_0xe6de11)){_0x268eb5[_0x34147f]=getOperatorValue(_0xe6de11);}else if(_0x3d1b96[_0x4db9('0x8')]===_0x4db9('0x9')&&_['isPlainObject'](_0xe6de11)){var _0x549c92=JSON[_0x4db9('0x2')](_0xe6de11);var _0x3ac147={'$gte':moment(moment(_0x549c92[_0x4db9('0xa')])['format'](_0x4db9('0xb')))[_0x4db9('0xc')]()[_0x4db9('0xd')](),'$lte':moment(moment(_0x549c92[_0x4db9('0xe')])[_0x4db9('0xd')]('YYYY-MM-DD'))[_0x4db9('0xc')]()[_0x4db9('0xf')](0x1,'s')['format']()};_0x268eb5[_0x34147f]=_0x3ac147;}else if(_0x3d1b96[_0x4db9('0x10')]===_0x4db9('0x11')){_0x268eb5[_0x34147f]=_0xe6de11;}else{_0x268eb5[_0x34147f]=_[_0x4db9('0x12')](_0xe6de11)?_0xe6de11:JSON['parse'](_0xe6de11);}}else{_0x268eb5[_0x34147f]=_[_0x4db9('0x12')](_0xe6de11)?_0xe6de11:JSON[_0x4db9('0x2')](_0xe6de11);}}catch(_0x4c5f4f){_0x268eb5[_0x34147f]=_0xe6de11['split'](',');}});}return _0x268eb5;};exports['limit']=function(_0x605552){_0x605552=parseInt(_0x605552,0xa);if(!_0x605552||_0x605552<0x0){_0x605552=LIMIT_VALUE;}return _0x605552;};exports[_0x4db9('0x13')]=function(_0x48ff99){_0x48ff99=parseInt(_0x48ff99,0xa);if(!_0x48ff99||_0x48ff99<0x0){_0x48ff99=0x0;}return _0x48ff99;};exports[_0x4db9('0x14')]=function(_0x1f6b24){var _0x353718,_0x192c5d=null;if(_0x1f6b24){_0x353718=_0x1f6b24[_0x4db9('0x4')](',');_0x192c5d=_[_0x4db9('0x15')](_0x353718,function(_0x34a6ed){if(_0x34a6ed[_0x4db9('0x16')]('-')===0x0){return[_0x34a6ed===_0x4db9('0x17')?sequelize[_0x4db9('0x18')](sequelize[_0x4db9('0x19')](_0x4db9('0x17')),'unsigned'):_0x34a6ed[_0x4db9('0x1a')](0x1),_0x4db9('0x1b')];}else{return[_0x34a6ed==='priority'?sequelize[_0x4db9('0x18')](sequelize[_0x4db9('0x19')](_0x4db9('0x17')),_0x4db9('0x1c')):_0x34a6ed,'ASC'];}});}return _0x192c5d;};exports[_0x4db9('0x1d')]=function(_0x506cc9,_0x1cf805){if(_[_0x4db9('0x6')](_0x506cc9)){return _0x506cc9;}if(_[_0x4db9('0x12')](_0x506cc9)){for(var _0x47e89c=0x0;_0x47e89c<_0x506cc9[_0x4db9('0x1e')];_0x47e89c+=0x1){_0x506cc9[_0x47e89c]=this[_0x4db9('0x1d')](_0x506cc9[_0x47e89c],_0x1cf805);}return _0x506cc9;}if(!_[_0x4db9('0x1f')](_0x506cc9)){return _0x506cc9;}if(_['isString'](_0x1cf805)){_0x1cf805=[_0x1cf805];}if(!_['isArray'](_0x1cf805)){return _0x506cc9;}for(var _0x1b2647=0x0;_0x1b2647<_0x1cf805['length'];_0x1b2647+=0x1){_[_0x4db9('0x20')](_0x506cc9,_0x1cf805[_0x1b2647]);}for(var _0x2653be in _0x506cc9){if(_0x506cc9[_0x4db9('0x21')](_0x2653be)){_0x506cc9[_0x2653be]=this[_0x4db9('0x1d')](_0x506cc9[_0x2653be],_0x1cf805);}}return _0x506cc9;};exports[_0x4db9('0x22')]=function(_0x3c3fcf){return _0x3c3fcf[_0x4db9('0x23')](RegExp(_0x4db9('0x24')))?!![]:![];};exports['isEmail']=function(_0x35f757){return _0x35f757['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x4db9('0x25')]=function(_0x33eb9e){var _0x1e7840=[];_0x33eb9e[_0x4db9('0x4')](/[ ,]+/)[_0x4db9('0x26')](function(_0x4b6130){_0x4b6130=_0x4b6130[_0x4db9('0x27')](/([^:]")"+/g,'$1');_0x4b6130='+'+_0x4b6130+'*';var _0x7ef35=/[ `!@#$%^&*()_\-?~]/;if(_0x4b6130[_0x4db9('0x23')](_0x7ef35))_0x4b6130='\x22'+_0x4b6130+'\x22';_0x1e7840[_0x4db9('0x28')](_0x4b6130);});return _0x1e7840['join']('\x20');};exports['getOptions']=function(_0x15841b,_0x39e528,_0x5c28db){var _0x5e93aa={},_0x3783f2={};if(_0x39e528['query']['$id']){_0x39e528[_0x4db9('0x29')]['id']=_0x39e528[_0x4db9('0x29')]['$id'];delete _0x39e528[_0x4db9('0x29')][_0x4db9('0x2a')];}_0x5e93aa[_0x4db9('0x2b')]=_[_0x4db9('0x15')](_0x15841b,'name');_0x5e93aa[_0x4db9('0x29')]=_['keys'](_0x39e528['query']);_0x5e93aa['filters']=_[_0x4db9('0x2c')](_0x5e93aa[_0x4db9('0x2b')],_0x5e93aa['query']);_0x3783f2[_0x4db9('0x2d')]=_[_0x4db9('0x2c')](_0x5e93aa['model'],this['fields'](_0x39e528['query'][_0x4db9('0x2e')]));_0x3783f2['attributes']=_0x3783f2[_0x4db9('0x2d')]['length']?_0x3783f2[_0x4db9('0x2d')]:_0x5e93aa[_0x4db9('0x2b')];if(!_0x39e528[_0x4db9('0x29')][_0x4db9('0x21')](_0x4db9('0x2f'))){_0x3783f2['limit']=this[_0x4db9('0x30')](_0x39e528['query'][_0x4db9('0x30')]);_0x3783f2[_0x4db9('0x13')]=this[_0x4db9('0x13')](_0x39e528[_0x4db9('0x29')][_0x4db9('0x13')]);}_0x3783f2[_0x4db9('0x31')]=this['sort'](_0x39e528[_0x4db9('0x29')][_0x4db9('0x14')]);_0x3783f2['where']=this['filters'](_[_0x4db9('0x32')](_0x39e528[_0x4db9('0x29')],_0x5e93aa[_0x4db9('0x5')]),_0x15841b);if(_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')]){var _0x36a648=_0x15841b;var _0x1a9fe7=_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')];if(typeof _0x1a9fe7===_0x4db9('0x34')){_0x36a648=_[_0x4db9('0x33')](_0x15841b,function(_0x3254d1){return _['includes'](_0x1a9fe7[_0x4db9('0x35')],_0x3254d1[_0x4db9('0x10')]);});_0x1a9fe7=_0x1a9fe7[_0x4db9('0x36')];}_0x3783f2[_0x4db9('0x37')]=_['merge'](_0x3783f2['where'],{'$or':_[_0x4db9('0x15')](_0x36a648,function(_0x2b18a2){if(_0x2b18a2[_0x4db9('0x8')]!=='VIRTUAL'){if(_0x5c28db){return sequelize[_0x4db9('0x37')](sequelize['fn']('lower',sequelize[_0x4db9('0x19')](_0x2b18a2[_0x4db9('0x10')])),{'$like':sequelize['fn'](_0x4db9('0x38'),'%'+_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')]+'%')});}else{var _0x4eeff3={};_0x4eeff3[_0x2b18a2[_0x4db9('0x10')]]={'$like':'%'+_0x39e528[_0x4db9('0x29')][_0x4db9('0x33')]+'%'};return _0x4eeff3;}}})});}_0x3783f2=_[_0x4db9('0x39')]({},_0x3783f2,_0x39e528[_0x4db9('0x3a')]);return _0x3783f2;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a5c4cdf..41eb4d2 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(_0x2f4ee6,_0x24a540){var _0x28f20e=function(_0x239715){while(--_0x239715){_0x2f4ee6['push'](_0x2f4ee6['shift']());}};_0x28f20e(++_0x24a540);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x2a36e9,_0x473667){var _0x39b108=function(_0x251b5a){while(--_0x251b5a){_0x2a36e9['push'](_0x2a36e9['shift']());}};_0x39b108(++_0x473667);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 4a59e17..b20e921 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 _0x6bf7=['platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','child_process','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','join','createHash','md5','update','digest','hex','getUuid'];(function(_0x3418b1,_0x468bb3){var _0x384c69=function(_0x35cb5e){while(--_0x35cb5e){_0x3418b1['push'](_0x3418b1['shift']());}};_0x384c69(++_0x468bb3);}(_0x6bf7,0xa3));var _0x76bf=function(_0x514045,_0x2f0e05){_0x514045=_0x514045-0x0;var _0xa866ce=_0x6bf7[_0x514045];return _0xa866ce;};'use strict';var _=require(_0x76bf('0x0'));var os=require('os');var crypto=require(_0x76bf('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x76bf('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x314fb9=[];var _0x4345c4=os[_0x76bf('0x3')]();var _0x452120=_['orderBy'](_[_0x76bf('0x4')](_0x4345c4));for(var _0x549e40=0x0;_0x549e40<_0x452120[_0x76bf('0x5')];_0x549e40++){var _0x2be6f1=_0x4345c4[_0x452120[_0x549e40]][_0x76bf('0x6')](function(_0x489896){return _0x489896[_0x76bf('0x7')]===_0x76bf('0x8')&&_0x489896[_0x76bf('0x9')]===![];});_0x314fb9=_0x314fb9[_0x76bf('0xa')](_0x2be6f1);}return _0x314fb9;}function getFirstInterface(){var _0x366918=_[_0x76bf('0xb')](getInterfaces());return{'macAddress':_0x366918&&_0x366918[_0x76bf('0xc')]?_0x366918['mac']:_0x76bf('0xd'),'ipAddress':_0x366918&&_0x366918[_0x76bf('0xe')]?_0x366918[_0x76bf('0xe')]:_0x76bf('0xf')};}exports[_0x76bf('0x10')]=getFirstInterface;function getCPUhash(){var _0x361ae4=_[_0x76bf('0x11')](os[_0x76bf('0x12')]()[_0x76bf('0x13')](function(_0x746711){return _0x746711['model'];}))[_0x76bf('0x14')](':');return crypto[_0x76bf('0x15')](_0x76bf('0x16'))[_0x76bf('0x17')](_0x361ae4)[_0x76bf('0x18')](_0x76bf('0x19'));}exports[_0x76bf('0x1a')]=function(){var _0x4740d0=os[_0x76bf('0x1b')]();var _0x10e5eb=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x10e5eb[_0x76bf('0x1c')](config[_0x76bf('0x1d')])){return config[_0x76bf('0x1d')];}else if(_0x4740d0===_0x76bf('0x1e')){return exec(_0x76bf('0x1f'),{'encoding':_0x76bf('0x20')})[_0x76bf('0x21')]('\x0d\x0a','');}else{var _0x2ac3c2=getFirstInterface();var _0x39337f=getCPUhash();var _0x2d3691=_0x39337f+'|'+os[_0x76bf('0x22')]()+'|'+_0x2ac3c2[_0x76bf('0x23')]+'|'+_0x2ac3c2[_0x76bf('0x24')];var _0x396c39=crypto[_0x76bf('0x15')](_0x76bf('0x16'))[_0x76bf('0x17')](_0x2d3691)['digest']('hex');return _0x396c39[_0x76bf('0x25')](0x0,0x8)+'-'+_0x396c39[_0x76bf('0x25')](0x8,0xc)+'-'+_0x396c39[_0x76bf('0x25')](0xc,0x10)+'-'+_0x396c39[_0x76bf('0x25')](0x10,0x14)+'-'+_0x396c39['substring'](0x14);}}; \ No newline at end of file +var _0x3267=['update','platform','licenseToken','win32','utf8','replace','hostname','macAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5'];(function(_0x46a8f3,_0x2edec3){var _0x47483f=function(_0x33d722){while(--_0x33d722){_0x46a8f3['push'](_0x46a8f3['shift']());}};_0x47483f(++_0x2edec3);}(_0x3267,0x18b));var _0x7326=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x3267[_0x37ae26];return _0x1b1902;};'use strict';var _=require(_0x7326('0x0'));var os=require('os');var crypto=require(_0x7326('0x1'));var machine=require(_0x7326('0x2'));var exec=require(_0x7326('0x3'))[_0x7326('0x4')];var config=require(_0x7326('0x5'));function getInterfaces(){var _0x2fe465=[];var _0x39639e=os[_0x7326('0x6')]();var _0xfeb885=_[_0x7326('0x7')](_[_0x7326('0x8')](_0x39639e));for(var _0x4a3847=0x0;_0x4a3847<_0xfeb885[_0x7326('0x9')];_0x4a3847++){var _0x3bbc49=_0x39639e[_0xfeb885[_0x4a3847]][_0x7326('0xa')](function(_0x1655be){return _0x1655be[_0x7326('0xb')]===_0x7326('0xc')&&_0x1655be[_0x7326('0xd')]===![];});_0x2fe465=_0x2fe465['concat'](_0x3bbc49);}return _0x2fe465;}function getFirstInterface(){var _0x28a76f=_[_0x7326('0xe')](getInterfaces());return{'macAddress':_0x28a76f&&_0x28a76f[_0x7326('0xf')]?_0x28a76f['mac']:_0x7326('0x10'),'ipAddress':_0x28a76f&&_0x28a76f[_0x7326('0x11')]?_0x28a76f['address']:_0x7326('0x12')};}exports[_0x7326('0x13')]=getFirstInterface;function getCPUhash(){var _0x4e08ed=_[_0x7326('0x7')](os[_0x7326('0x14')]()[_0x7326('0x15')](function(_0x3d7185){return _0x3d7185[_0x7326('0x16')];}))[_0x7326('0x17')](':');return crypto['createHash'](_0x7326('0x18'))[_0x7326('0x19')](_0x4e08ed)['digest']('hex');}exports['getUuid']=function(){var _0xce3dbe=os[_0x7326('0x1a')]();var _0x52f716=/[0-9a-f-]{36}/;if(config[_0x7326('0x1b')]&&_0x52f716['test'](config[_0x7326('0x1b')])){return config[_0x7326('0x1b')];}else if(_0xce3dbe===_0x7326('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x7326('0x1d')})[_0x7326('0x1e')]('\x0d\x0a','');}else{var _0xd50d38=getFirstInterface();var _0x18baf2=getCPUhash();var _0x3183ba=_0x18baf2+'|'+os[_0x7326('0x1f')]()+'|'+_0xd50d38[_0x7326('0x20')]+'|'+_0xd50d38['ipAddress'];var _0x262d56=crypto['createHash'](_0x7326('0x18'))[_0x7326('0x19')](_0x3183ba)['digest'](_0x7326('0x21'));return _0x262d56[_0x7326('0x22')](0x0,0x8)+'-'+_0x262d56[_0x7326('0x22')](0x8,0xc)+'-'+_0x262d56[_0x7326('0x22')](0xc,0x10)+'-'+_0x262d56[_0x7326('0x22')](0x10,0x14)+'-'+_0x262d56['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ba16d39..28adde1 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 _0xe563=['encryptString','diff','decryptString','days','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm'];(function(_0x1af046,_0x218baa){var _0x479abf=function(_0x250048){while(--_0x250048){_0x1af046['push'](_0x1af046['shift']());}};_0x479abf(++_0x218baa);}(_0xe563,0x1ed));var _0x3e56=function(_0x11cbda,_0x617ff8){_0x11cbda=_0x11cbda-0x0;var _0x10922b=_0xe563[_0x11cbda];return _0x10922b;};'use strict';var util=require('util');var moment=require(_0x3e56('0x0'));var rp=require(_0x3e56('0x1'));var BPromise=require(_0x3e56('0x2'));var pkginfo=require(_0x3e56('0x3'))(module,_0x3e56('0x4'));var db=require(_0x3e56('0x5'))['db'];var encryptor=require(_0x3e56('0x6'));var hardware=require(_0x3e56('0x7'));var logger=require(_0x3e56('0x8'))(_0x3e56('0x9'));var HOST=_0x3e56('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xcc24f7){return new BPromise(function(_0x46437b,_0x58119f){var _0x2d32cd=util[_0x3e56('0xb')](_0x3e56('0xc'),HOST,_0xcc24f7,module[_0x3e56('0xd')][_0x3e56('0x4')]);if(oldToken){_0x2d32cd=util[_0x3e56('0xb')](_0x3e56('0xe'),HOST,_0xcc24f7,module[_0x3e56('0xd')][_0x3e56('0x4')],oldToken);}var _0x156a71={'uri':_0x2d32cd,'method':_0x3e56('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x156a71)['then'](function(_0x1998f0){_0x46437b(_0x1998f0);})['catch'](function(_0x528744){_0x58119f(_0x528744);});});}function manageLicense(_0x37a6fb,_0x5a44ee){var _0x50d9df=_0x5a44ee[_0x3e56('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x50d9df[_0x3e56('0x11')]!==_0x37a6fb&&!_0x50d9df[_0x3e56('0x12')]){oldToken=_0x50d9df['data1'];}httpRequest(_0x37a6fb)[_0x3e56('0x13')](function(_0x2ecb7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2ecb7[_0x3e56('0x14')]){isOldTokenSent=![];if(!_0x50d9df[_0x3e56('0x9')]&&_0x50d9df[_0x3e56('0x9')]!=_0x2ecb7[_0x3e56('0x9')]||_0x50d9df[_0x3e56('0x9')]&&_0x50d9df['data2']){logger[_0x3e56('0x15')](_0x3e56('0x16'));}if(_0x50d9df[_0x3e56('0x9')]&&!_0x50d9df[_0x3e56('0x12')]&&_0x50d9df['license']!=_0x2ecb7[_0x3e56('0x9')]){logger[_0x3e56('0x15')](_0x3e56('0x17'));}if(_0x50d9df[_0x3e56('0x9')]&&!_0x50d9df['data2']&&_0x50d9df[_0x3e56('0x9')]==_0x2ecb7[_0x3e56('0x9')]){return _0x5a44ee;}return _0x5a44ee['update']({'data1':_0x37a6fb,'data2':null,'license':_0x2ecb7['license']});}else{if(_0x2ecb7[_0x3e56('0x9')]||_0x50d9df[_0x3e56('0x9')]){if(!_0x50d9df[_0x3e56('0x12')]){if(_0x50d9df[_0x3e56('0x11')]==_0x37a6fb){GRAY_PERIOD_REASON='Disabled';logger[_0x3e56('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x3e56('0x15')](_0x3e56('0x18'),_0x50d9df[_0x3e56('0x11')],_0x37a6fb);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x3e56('0x19')](),moment()[_0x3e56('0xb')](_0x3e56('0x1a')));return _0x5a44ee['update']({'data2':encryptor[_0x3e56('0x1b')](moment()[_0x3e56('0xb')](_0x3e56('0x1a')))});}else{if(moment()[_0x3e56('0x1c')](encryptor[_0x3e56('0x1d')](_0x50d9df[_0x3e56('0x12')]),_0x3e56('0x1e'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x3e56('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x5a44ee['update']({'data1':_0x37a6fb,'data2':null,'license':null});}}}else{if(_0x50d9df[_0x3e56('0x11')]!=_0x37a6fb){logger[_0x3e56('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x50d9df[_0x3e56('0x11')],_0x37a6fb);return _0x5a44ee['update']({'data1':_0x37a6fb,'data2':null,'license':null});}}}return _0x5a44ee;})[_0x3e56('0x13')](function(_0x2ab813){_0x5a44ee=_0x2ab813;})[_0x3e56('0x1f')](function(_0x107d18){logger[_0x3e56('0x20')](_0x107d18[_0x3e56('0x21')]);})[_0x3e56('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x3e56('0x23')](),_0x5a44ee);},TIME);});}function defaultLicense(){var _0x5243d8=hardware[_0x3e56('0x23')]();if(_0x5243d8){return db[_0x3e56('0x24')][_0x3e56('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x5243d8}})[_0x3e56('0x26')](function(_0x210b14,_0x1ba067){logger[_0x3e56('0x15')](_0x3e56('0x27'),_0x5243d8);manageLicense(_0x5243d8,_0x210b14);})[_0x3e56('0x1f')](function(_0x40c581){logger[_0x3e56('0x20')](_0x40c581[_0x3e56('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x4050=['pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Changed','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','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','moment'];(function(_0x4b3d12,_0x1d4133){var _0x104e8c=function(_0x55db69){while(--_0x55db69){_0x4b3d12['push'](_0x4b3d12['shift']());}};_0x104e8c(++_0x1d4133);}(_0x4050,0x1ac));var _0x0405=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x4050[_0x99868f];return _0x27a71b;};'use strict';var util=require('util');var moment=require(_0x0405('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x0405('0x1'))(module,_0x0405('0x2'));var db=require(_0x0405('0x3'))['db'];var encryptor=require(_0x0405('0x4'));var hardware=require(_0x0405('0x5'));var logger=require(_0x0405('0x6'))(_0x0405('0x7'));var HOST=_0x0405('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x30450f){return new BPromise(function(_0x1f2a2d,_0xa5ac8a){var _0x177edc=util[_0x0405('0x9')](_0x0405('0xa'),HOST,_0x30450f,module[_0x0405('0xb')][_0x0405('0x2')]);if(oldToken){_0x177edc=util['format'](_0x0405('0xc'),HOST,_0x30450f,module[_0x0405('0xb')][_0x0405('0x2')],oldToken);}var _0x5c425e={'uri':_0x177edc,'method':_0x0405('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5c425e)[_0x0405('0xe')](function(_0x3fbb09){_0x1f2a2d(_0x3fbb09);})[_0x0405('0xf')](function(_0x1c70ed){_0xa5ac8a(_0x1c70ed);});});}function manageLicense(_0x50e4eb,_0x5f5268){var _0x4e4cc4=_0x5f5268[_0x0405('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x4e4cc4['data1']!==_0x50e4eb&&!_0x4e4cc4[_0x0405('0x11')]){oldToken=_0x4e4cc4[_0x0405('0x12')];}httpRequest(_0x50e4eb)['then'](function(_0x227445){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x227445[_0x0405('0x13')]){isOldTokenSent=![];if(!_0x4e4cc4[_0x0405('0x7')]&&_0x4e4cc4['license']!=_0x227445[_0x0405('0x7')]||_0x4e4cc4['license']&&_0x4e4cc4[_0x0405('0x11')]){logger[_0x0405('0x14')](_0x0405('0x15'));}if(_0x4e4cc4[_0x0405('0x7')]&&!_0x4e4cc4[_0x0405('0x11')]&&_0x4e4cc4[_0x0405('0x7')]!=_0x227445[_0x0405('0x7')]){logger['info'](_0x0405('0x16'));}if(_0x4e4cc4[_0x0405('0x7')]&&!_0x4e4cc4[_0x0405('0x11')]&&_0x4e4cc4[_0x0405('0x7')]==_0x227445[_0x0405('0x7')]){return _0x5f5268;}return _0x5f5268[_0x0405('0x17')]({'data1':_0x50e4eb,'data2':null,'license':_0x227445['license']});}else{if(_0x227445[_0x0405('0x7')]||_0x4e4cc4[_0x0405('0x7')]){if(!_0x4e4cc4['data2']){if(_0x4e4cc4[_0x0405('0x12')]==_0x50e4eb){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x0405('0x18');logger[_0x0405('0x14')](_0x0405('0x19'),_0x4e4cc4[_0x0405('0x12')],_0x50e4eb);}logger[_0x0405('0x14')](_0x0405('0x1a'),GRAY_PERIOD_REASON[_0x0405('0x1b')](),moment()[_0x0405('0x9')](_0x0405('0x1c')));return _0x5f5268[_0x0405('0x17')]({'data2':encryptor['encryptString'](moment()[_0x0405('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x0405('0x1d')](encryptor[_0x0405('0x1e')](_0x4e4cc4[_0x0405('0x11')]),_0x0405('0x1f'))>DAYS){logger[_0x0405('0x14')](_0x0405('0x20'),moment()[_0x0405('0x9')](_0x0405('0x1c')));isOldTokenSent=![];return _0x5f5268[_0x0405('0x17')]({'data1':_0x50e4eb,'data2':null,'license':null});}}}else{if(_0x4e4cc4[_0x0405('0x12')]!=_0x50e4eb){logger[_0x0405('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4e4cc4[_0x0405('0x12')],_0x50e4eb);return _0x5f5268[_0x0405('0x17')]({'data1':_0x50e4eb,'data2':null,'license':null});}}}return _0x5f5268;})[_0x0405('0xe')](function(_0x31b707){_0x5f5268=_0x31b707;})[_0x0405('0xf')](function(_0x248e7c){logger['error'](_0x248e7c['message']);})[_0x0405('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x0405('0x22')](),_0x5f5268);},TIME);});}function defaultLicense(){var _0x2cc7a2=hardware['getUuid']();if(_0x2cc7a2){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2cc7a2}})[_0x0405('0x23')](function(_0x3eeb5b,_0x3d356e){logger[_0x0405('0x14')](_0x0405('0x24'),_0x2cc7a2);manageLicense(_0x2cc7a2,_0x3eeb5b);})[_0x0405('0xf')](function(_0x5efea8){logger[_0x0405('0x25')](_0x5efea8[_0x0405('0x26')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5e3864a..423dc66 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 _0xac39=['format','parse','demo','machineUuid','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','pick','countBy','user','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xac39,0x1e7));var _0x9ac3=function(_0x56a333,_0x58dec6){_0x56a333=_0x56a333-0x0;var _0x19d101=_0xac39[_0x56a333];return _0x19d101;};'use strict';var util=require(_0x9ac3('0x0'));var _=require(_0x9ac3('0x1'));var moment=require('moment');var BPromise=require(_0x9ac3('0x2'));var hardware=require(_0x9ac3('0x3'));var encryptor=require(_0x9ac3('0x4'));var db=require(_0x9ac3('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':_0x9ac3('0x6'),'machineUuid':hardware[_0x9ac3('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x51eb4a){return new BPromise(function(_0x300911,_0x20c713){return db[_0x9ac3('0x8')][_0x9ac3('0x9')](_[_0x9ac3('0xa')](_0x51eb4a,{'raw':!![],'where':{'id':0x1}}))[_0x9ac3('0xb')](function(_0x5b45d9){return checkLicense(_0x5b45d9,null);})[_0x9ac3('0xb')](function(_0x1d7c9c){_0x300911(_0x1d7c9c);return;})[_0x9ac3('0xc')](function(_0x5accfa){_0x20c713(_0x5accfa);});});}function checkLicense(_0x599bdc,_0x53ebfb){if(!_0x599bdc){demoLicense[_0x9ac3('0xd')]=_0x599bdc[_0x9ac3('0xe')];return demoLicense;}try{var _0x4e2c53=_0x53ebfb||_0x599bdc[_0x9ac3('0xf')];if(_['isEmpty'](_0x4e2c53)){throw new Error(_0x9ac3('0x10'));}var _0x32aa00=_0x599bdc[_0x9ac3('0xe')];var _0x4d1ff9=_0x599bdc[_0x9ac3('0x11')];var _0xc47c2=_0x32aa00['split']('-')[0x4];var _0x597372=_0x32aa00[_0x9ac3('0x12')]('-')[0x0];var _0x5e3aa2=encryptor['decryptString'](_0x4e2c53,util[_0x9ac3('0x13')]('%s:%s:%s',_0xc47c2,_0x32aa00,_0x597372));var _0x3e2458=JSON[_0x9ac3('0x14')](_0x5e3aa2);_0x3e2458[_0x9ac3('0x15')]=![];_0x3e2458[_0x9ac3('0xd')]=_0x32aa00;_0x3e2458[_0x9ac3('0x16')]=hardware['getUuid']();if(_0x4d1ff9){var _0xc1cd95=encryptor['decryptString'](_0x4d1ff9);_0x3e2458[_0x9ac3('0x17')]=_0xc1cd95;_0x3e2458[_0x9ac3('0x18')]=moment(_0xc1cd95)[_0x9ac3('0x19')](0x7,_0x9ac3('0x1a'))[_0x9ac3('0x13')]();_0x3e2458[_0x9ac3('0x1b')]=_0x3e2458[_0x9ac3('0xd')]!=_0x3e2458[_0x9ac3('0x16')]?'changed':_0x9ac3('0x1c');}return _0x3e2458;}catch(_0x2da0b2){breakingLicense['uuid']=_0x599bdc[_0x9ac3('0xe')];breakingLicense[_0x9ac3('0x1d')]=_0x2da0b2[_0x9ac3('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4d0306,_0x2ba4b4){getLicense()[_0x9ac3('0xb')](function(_0x190ef2){return db[_0x9ac3('0x1e')][_0x9ac3('0x1f')]({'attributes':[_0x9ac3('0x20'),[db[_0x9ac3('0x21')]['fn'](_0x9ac3('0x22'),db[_0x9ac3('0x21')][_0x9ac3('0x23')](_0x9ac3('0x20'))),_0x9ac3('0x24')]],'group':_0x9ac3('0x20'),'where':{'role':{'$or':[_0x9ac3('0x25'),'user',_0x9ac3('0x26')]}},'raw':!![]})['then'](function(_0x2c995b){var _0x1a0f40={'user':_0x190ef2[_0x9ac3('0x27')]||0x0,'telephone':_0x190ef2[_0x9ac3('0x28')]||0x0};_0x2c995b[_0x9ac3('0x29')](function(_0x14317d){var _0x27d688=_0x14317d[_0x9ac3('0x20')]===_0x9ac3('0x25')?'user':_0x14317d[_0x9ac3('0x20')];_0x1a0f40[_0x27d688]-=_0x14317d[_0x9ac3('0x24')];if(_0x1a0f40[_0x27d688]<0x0)_0x1a0f40[_0x27d688]=0x0;});_0x4d0306(_0x1a0f40);return;});})[_0x9ac3('0xc')](function(_0x5d57dc){_0x2ba4b4(_0x5d57dc);});});}function checkUserLimits(_0x314e40){return new BPromise(function(_0x442d33,_0x4e4bf7){getLimits()[_0x9ac3('0xb')](function(_0x27f762){var _0x5ba3d1=_[_0x9ac3('0x2a')](_[_0x9ac3('0x2b')](_0x314e40,_0x9ac3('0x20')),[_0x9ac3('0x25'),'user','telephone']);var _0x2cecb7=(_0x5ba3d1[_0x9ac3('0x25')]||0x0)+(_0x5ba3d1['user']||0x0);var _0x4de14d=_0x5ba3d1[_0x9ac3('0x26')]||0x0;if(_0x2cecb7>_0x27f762[_0x9ac3('0x2c')])return _0x4e4bf7('License\x20limit\x20reached\x20for\x20users');if(_0x4de14d>_0x27f762['telephone'])return _0x4e4bf7('License\x20limit\x20reached\x20for\x20telephones');return _0x442d33();})[_0x9ac3('0xc')](function(_0x18f843){_0x4e4bf7(_0x18f843);});});}module[_0x9ac3('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe56f=['admin','count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','uuid','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','user','telephone','users','telephones'];(function(_0x382808,_0x1926c5){var _0x54df2b=function(_0x5cec83){while(--_0x5cec83){_0x382808['push'](_0x382808['shift']());}};_0x54df2b(++_0x1926c5);}(_0xe56f,0x1dd));var _0xfe56=function(_0x4188c9,_0x10d4d2){_0x4188c9=_0x4188c9-0x0;var _0x54afa9=_0xe56f[_0x4188c9];return _0x54afa9;};'use strict';var util=require(_0xfe56('0x0'));var _=require(_0xfe56('0x1'));var moment=require(_0xfe56('0x2'));var BPromise=require('bluebird');var hardware=require(_0xfe56('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xfe56('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfe56('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xfe56('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xfe56('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xfe56('0x7'),'machineUuid':hardware[_0xfe56('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4fa2ba){return new BPromise(function(_0x22d915,_0x2415b4){return db[_0xfe56('0x8')][_0xfe56('0x9')](_[_0xfe56('0xa')](_0x4fa2ba,{'raw':!![],'where':{'id':0x1}}))[_0xfe56('0xb')](function(_0x32ae02){return checkLicense(_0x32ae02,null);})['then'](function(_0x5f5795){_0x22d915(_0x5f5795);return;})['catch'](function(_0x567cb0){_0x2415b4(_0x567cb0);});});}function checkLicense(_0x3ebd12,_0x27fe69){if(!_0x3ebd12){demoLicense[_0xfe56('0xc')]=_0x3ebd12['data1'];return demoLicense;}try{var _0x186ce7=_0x27fe69||_0x3ebd12[_0xfe56('0xd')];if(_['isEmpty'](_0x186ce7)){throw new Error(_0xfe56('0xe'));}var _0x3a8e8e=_0x3ebd12['data1'];var _0x449d62=_0x3ebd12[_0xfe56('0xf')];var _0x490b1f=_0x3a8e8e['split']('-')[0x4];var _0x4e0b3e=_0x3a8e8e[_0xfe56('0x10')]('-')[0x0];var _0x116872=encryptor[_0xfe56('0x11')](_0x186ce7,util[_0xfe56('0x12')](_0xfe56('0x13'),_0x490b1f,_0x3a8e8e,_0x4e0b3e));var _0x32d933=JSON[_0xfe56('0x14')](_0x116872);_0x32d933[_0xfe56('0x15')]=![];_0x32d933[_0xfe56('0xc')]=_0x3a8e8e;_0x32d933[_0xfe56('0x16')]=hardware[_0xfe56('0x6')]();if(_0x449d62){var _0x1df046=encryptor[_0xfe56('0x11')](_0x449d62);_0x32d933[_0xfe56('0x17')]=_0x1df046;_0x32d933[_0xfe56('0x18')]=moment(_0x1df046)[_0xfe56('0x19')](0x7,_0xfe56('0x1a'))[_0xfe56('0x12')]();_0x32d933['grayReason']=_0x32d933[_0xfe56('0xc')]!=_0x32d933['machineUuid']?_0xfe56('0x1b'):_0xfe56('0x1c');}return _0x32d933;}catch(_0xd5d13){breakingLicense[_0xfe56('0xc')]=_0x3ebd12['data1'];breakingLicense[_0xfe56('0x1d')]=_0xd5d13[_0xfe56('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5c4853,_0x3deabf){getLicense()[_0xfe56('0xb')](function(_0x550dc2){return db[_0xfe56('0x1e')][_0xfe56('0x1f')]({'attributes':[_0xfe56('0x20'),[db[_0xfe56('0x21')]['fn'](_0xfe56('0x22'),db[_0xfe56('0x21')][_0xfe56('0x23')](_0xfe56('0x20'))),'count']],'group':'role','where':{'role':{'$or':['admin',_0xfe56('0x24'),_0xfe56('0x25')]}},'raw':!![]})[_0xfe56('0xb')](function(_0x21072f){var _0x49efca={'user':_0x550dc2[_0xfe56('0x26')]||0x0,'telephone':_0x550dc2[_0xfe56('0x27')]||0x0};_0x21072f['forEach'](function(_0x239181){var _0x10dfc2=_0x239181[_0xfe56('0x20')]===_0xfe56('0x28')?_0xfe56('0x24'):_0x239181[_0xfe56('0x20')];_0x49efca[_0x10dfc2]-=_0x239181[_0xfe56('0x29')];if(_0x49efca[_0x10dfc2]<0x0)_0x49efca[_0x10dfc2]=0x0;});_0x5c4853(_0x49efca);return;});})[_0xfe56('0x2a')](function(_0x3ced63){_0x3deabf(_0x3ced63);});});}function checkUserLimits(_0x1325ed){return new BPromise(function(_0x25e1a2,_0x5b3bb6){getLimits()[_0xfe56('0xb')](function(_0x332404){var _0x440bb2=_[_0xfe56('0x2b')](_[_0xfe56('0x2c')](_0x1325ed,_0xfe56('0x20')),[_0xfe56('0x28'),'user',_0xfe56('0x25')]);var _0x46ebac=(_0x440bb2['admin']||0x0)+(_0x440bb2[_0xfe56('0x24')]||0x0);var _0x55994c=_0x440bb2['telephone']||0x0;if(_0x46ebac>_0x332404['user'])return _0x5b3bb6(_0xfe56('0x2d'));if(_0x55994c>_0x332404[_0xfe56('0x25')])return _0x5b3bb6(_0xfe56('0x2e'));return _0x25e1a2();})[_0xfe56('0x2a')](function(_0x2c9993){_0x5b3bb6(_0x2c9993);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d942368..bbd4954 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 _0x583c=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0xd01aff,_0x54ee5a){var _0x5980ea=function(_0x42445e){while(--_0x42445e){_0xd01aff['push'](_0xd01aff['shift']());}};_0x5980ea(++_0x54ee5a);}(_0x583c,0x12b));var _0xc583=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x583c[_0x1589dd];return _0x1bddd1;};'use strict';module[_0xc583('0x0')]={'DOMAIN':_0xc583('0x1'),'SESSION_SECRET':_0xc583('0x2'),'GOOGLE_ID':_0xc583('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4fc2=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x1eee3d,_0x53201a){var _0x235259=function(_0x26dbec){while(--_0x26dbec){_0x1eee3d['push'](_0x1eee3d['shift']());}};_0x235259(++_0x53201a);}(_0x4fc2,0x111));var _0x24fc=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x4fc2[_0x471a85];return _0x5f2039;};'use strict';module[_0x24fc('0x0')]={'DOMAIN':_0x24fc('0x1'),'SESSION_SECRET':_0x24fc('0x2'),'GOOGLE_ID':_0x24fc('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index c571656..95b10ce 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8751=['../utils/loggers','fileLogger'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x8751,0x8c));var _0x1875=function(_0x3163b6,_0x21b0f0){_0x3163b6=_0x3163b6-0x0;var _0x42fd6a=_0x8751[_0x3163b6];return _0x42fd6a;};'use strict';var fileLogger=require(_0x1875('0x0'))[_0x1875('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x355d=['fileLogger'];(function(_0x14f21c,_0x315b28){var _0x2b509b=function(_0x19ea1f){while(--_0x19ea1f){_0x14f21c['push'](_0x14f21c['shift']());}};_0x2b509b(++_0x315b28);}(_0x355d,0x1a5));var _0xd355=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x355d[_0x3dd15e];return _0x231fd0;};'use strict';var fileLogger=require('../utils/loggers')[_0xd355('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 602f424..c0c4669 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 _0xabfb=['join','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami'];(function(_0xbd18d4,_0x112df4){var _0xec2e4a=function(_0x451491){while(--_0x451491){_0xbd18d4['push'](_0xbd18d4['shift']());}};_0xec2e4a(++_0x112df4);}(_0xabfb,0x15b));var _0xbabf=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xabfb[_0x411add];return _0x238242;};'use strict';var path=require(_0xbabf('0x0'));var os=require('os');var config={'apps':[{'name':_0xbabf('0x1'),'script':path['join'](__dirname,_0xbabf('0x2'))},{'name':_0xbabf('0x3'),'script':path[_0xbabf('0x4')](__dirname,_0xbabf('0x5'))},{'name':_0xbabf('0x6'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xbabf('0x7'),'script':path[_0xbabf('0x4')](__dirname,_0xbabf('0x8'))},{'name':_0xbabf('0x9'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0xbabf('0xa'),'script':path[_0xbabf('0x4')](__dirname,_0xbabf('0xb'))}]};module[_0xbabf('0xc')]=config; \ No newline at end of file +var _0x2bef=['../../services/email/index.js','routing','xdr','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email'];(function(_0x4235bf,_0x23fd34){var _0x360741=function(_0x2121d1){while(--_0x2121d1){_0x4235bf['push'](_0x4235bf['shift']());}};_0x360741(++_0x23fd34);}(_0x2bef,0xe8));var _0xf2be=function(_0x346645,_0x3e9d9c){_0x346645=_0x346645-0x0;var _0x32f590=_0x2bef[_0x346645];return _0x32f590;};'use strict';var path=require(_0xf2be('0x0'));var os=require('os');var config={'apps':[{'name':_0xf2be('0x1'),'script':path[_0xf2be('0x2')](__dirname,_0xf2be('0x3'))},{'name':_0xf2be('0x4'),'script':path[_0xf2be('0x2')](__dirname,_0xf2be('0x5'))},{'name':_0xf2be('0x6'),'script':path[_0xf2be('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0xf2be('0x7'),'script':path[_0xf2be('0x2')](__dirname,_0xf2be('0x8'))},{'name':_0xf2be('0x9'),'script':path[_0xf2be('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0xf2be('0xa'),'script':path[_0xf2be('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xf2be('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e8ef5fb..47c2014 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 _0x5f4a=['pm2','bluebird','./config','connect','connected','start','then','disconnect','restart','list','describe','delete','dump','saved'];(function(_0x480e4d,_0x5901bf){var _0x168203=function(_0xef82cd){while(--_0xef82cd){_0x480e4d['push'](_0x480e4d['shift']());}};_0x168203(++_0x5901bf);}(_0x5f4a,0x126));var _0xa5f4=function(_0x45c9ab,_0xa3a62d){_0x45c9ab=_0x45c9ab-0x0;var _0x458ed5=_0x5f4a[_0x45c9ab];return _0x458ed5;};'use strict';var pm2=require(_0xa5f4('0x0'));var BPromise=require(_0xa5f4('0x1'));var config=require(_0xa5f4('0x2'));function connect(){return new BPromise(function(_0x195e49,_0xf422e5){return pm2[_0xa5f4('0x3')](function(_0x2955ad){if(_0x2955ad){return _0xf422e5(_0x2955ad);}return _0x195e49(_0xa5f4('0x4'));});});};exports[_0xa5f4('0x5')]=function(_0x3c202){return connect()[_0xa5f4('0x6')](function(){return new BPromise(function(_0x1393bc,_0xdfce51){return pm2[_0xa5f4('0x5')](_0x3c202,function(_0x4e6cf9,_0x235205){if(_0x4e6cf9){return _0xdfce51(_0x4e6cf9);}pm2[_0xa5f4('0x7')]();return _0x1393bc(_0x235205);});});});};exports['stop']=function(_0x524e5a){return connect()[_0xa5f4('0x6')](function(){return new BPromise(function(_0x2fc5e4,_0x467434){return pm2['stop'](_0x524e5a,function(_0x32a8fe,_0x5c8f46){if(_0x32a8fe){return _0x467434(_0x32a8fe);}pm2[_0xa5f4('0x7')]();return _0x2fc5e4(_0x5c8f46);});});});};exports['restart']=function(_0x54c517){return connect()[_0xa5f4('0x6')](function(){return new BPromise(function(_0x311e27,_0x3c5865){return pm2[_0xa5f4('0x8')](_0x54c517,function(_0x5a39ae,_0x1e085a){if(_0x5a39ae){return _0x3c5865(_0x5a39ae);}pm2[_0xa5f4('0x7')]();return _0x311e27(_0x1e085a);});});});};exports[_0xa5f4('0x9')]=function(){return connect()[_0xa5f4('0x6')](function(){return new BPromise(function(_0x3f7cfb,_0x15d85b){return pm2[_0xa5f4('0x9')](function(_0x248e31,_0x56a070){if(_0x248e31){return _0x15d85b(_0x248e31);}pm2['disconnect']();return _0x3f7cfb(_0x56a070);});});});};exports[_0xa5f4('0xa')]=function(_0x14c056){return connect()[_0xa5f4('0x6')](function(){return new BPromise(function(_0xb14efe,_0x25213c){return pm2[_0xa5f4('0xa')](_0x14c056,function(_0x3bcfb6,_0xba0a09){if(_0x3bcfb6){return _0x25213c(_0x3bcfb6);}pm2[_0xa5f4('0x7')]();return _0xb14efe(_0xba0a09);});});});};exports['delete']=function(_0x5e3b74){return connect()[_0xa5f4('0x6')](function(){return new BPromise(function(_0x39348f,_0x267ace){return pm2[_0xa5f4('0xb')](_0x5e3b74,function(_0x4648b0,_0x34f137){if(_0x4648b0){return _0x267ace(_0x4648b0);}pm2['disconnect']();return _0x39348f(_0x34f137);});});});};exports[_0xa5f4('0xc')]=function(){return connect()[_0xa5f4('0x6')](function(){return new BPromise(function(_0x56eb31,_0x238228){return pm2[_0xa5f4('0xc')](function(_0x1f3d24){if(_0x1f3d24){return _0x238228(_0x1f3d24);}return _0x56eb31(_0xa5f4('0xd'));});});});}; \ No newline at end of file +var _0x9a44=['start','disconnect','stop','restart','describe','then','delete','dump','saved','bluebird','connect'];(function(_0x3b51f0,_0x2fab1a){var _0x544893=function(_0x486b4c){while(--_0x486b4c){_0x3b51f0['push'](_0x3b51f0['shift']());}};_0x544893(++_0x2fab1a);}(_0x9a44,0x127));var _0x49a4=function(_0x196508,_0x366093){_0x196508=_0x196508-0x0;var _0x3666c2=_0x9a44[_0x196508];return _0x3666c2;};'use strict';var pm2=require('pm2');var BPromise=require(_0x49a4('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x1aee57,_0x3304d0){return pm2[_0x49a4('0x1')](function(_0x34c34a){if(_0x34c34a){return _0x3304d0(_0x34c34a);}return _0x1aee57('connected');});});};exports['start']=function(_0x211b79){return connect()['then'](function(){return new BPromise(function(_0x4ef398,_0x369319){return pm2[_0x49a4('0x2')](_0x211b79,function(_0x1dfa15,_0x568691){if(_0x1dfa15){return _0x369319(_0x1dfa15);}pm2[_0x49a4('0x3')]();return _0x4ef398(_0x568691);});});});};exports['stop']=function(_0x2f99b8){return connect()['then'](function(){return new BPromise(function(_0x222c02,_0x23a9f2){return pm2[_0x49a4('0x4')](_0x2f99b8,function(_0x3db829,_0x1e3cdf){if(_0x3db829){return _0x23a9f2(_0x3db829);}pm2[_0x49a4('0x3')]();return _0x222c02(_0x1e3cdf);});});});};exports[_0x49a4('0x5')]=function(_0x1beb1c){return connect()['then'](function(){return new BPromise(function(_0x1ce55d,_0x352108){return pm2[_0x49a4('0x5')](_0x1beb1c,function(_0x1d6901,_0x3fc24a){if(_0x1d6901){return _0x352108(_0x1d6901);}pm2['disconnect']();return _0x1ce55d(_0x3fc24a);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x1bd0bd,_0x4fe3d4){return pm2['list'](function(_0x348add,_0x5487ec){if(_0x348add){return _0x4fe3d4(_0x348add);}pm2[_0x49a4('0x3')]();return _0x1bd0bd(_0x5487ec);});});});};exports[_0x49a4('0x6')]=function(_0x2c170c){return connect()[_0x49a4('0x7')](function(){return new BPromise(function(_0x2f6426,_0x2913dd){return pm2[_0x49a4('0x6')](_0x2c170c,function(_0x32e84e,_0x26a054){if(_0x32e84e){return _0x2913dd(_0x32e84e);}pm2[_0x49a4('0x3')]();return _0x2f6426(_0x26a054);});});});};exports['delete']=function(_0x486e31){return connect()[_0x49a4('0x7')](function(){return new BPromise(function(_0x5662b0,_0x507160){return pm2[_0x49a4('0x8')](_0x486e31,function(_0x5a04b7,_0x6334a0){if(_0x5a04b7){return _0x507160(_0x5a04b7);}pm2[_0x49a4('0x3')]();return _0x5662b0(_0x6334a0);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x574b64,_0x2e090d){return pm2[_0x49a4('0x9')](function(_0x3995a9){if(_0x3995a9){return _0x2e090d(_0x3995a9);}return _0x574b64(_0x49a4('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e409141..d3b9909 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 _0xdce8=['schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','findAll','lastMsgAt','subtract','map','info','ChatInteraction','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','../../mysqldb','../logger'];(function(_0x5e68c5,_0x2bdc7c){var _0x1e910e=function(_0x386118){while(--_0x386118){_0x5e68c5['push'](_0x5e68c5['shift']());}};_0x1e910e(++_0x2bdc7c);}(_0xdce8,0x19e));var _0x8dce=function(_0x1d33da,_0x10de87){_0x1d33da=_0x1d33da-0x0;var _0x3addbc=_0xdce8[_0x1d33da];return _0x3addbc;};'use strict';var _=require(_0x8dce('0x0'));var moment=require(_0x8dce('0x1'));var Redis=require('ioredis');var util=require(_0x8dce('0x2'));var config=require(_0x8dce('0x3'));var db=require(_0x8dce('0x4'))['db'];var logger=require(_0x8dce('0x5'))(_0x8dce('0x6'));config[_0x8dce('0x7')]=_[_0x8dce('0x8')](config[_0x8dce('0x7')],{'host':_0x8dce('0x9'),'port':0x18eb});var io=require(_0x8dce('0xa'))(new Redis(config[_0x8dce('0x7')]));function closeInteractions(){var _0x4ecb12=0x0;var _0x7c5547=[];return db['Setting'][_0x8dce('0xb')]({'raw':!![],'attributes':['id',_0x8dce('0xc')],'where':{'id':0x1}})[_0x8dce('0xd')](function(_0x5b6064){_0x4ecb12=_0x5b6064[_0x8dce('0xc')];if(_0x4ecb12){return db['ChatInteraction'][_0x8dce('0xe')]({'raw':!![],'attributes':['id',_0x8dce('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8dce('0x10')](_0x5b6064[_0x8dce('0xc')],'minutes')}}});}else{return[];}})[_0x8dce('0xd')](function(_0xfdd18){if(_0xfdd18&&_0xfdd18['length']){_0x7c5547=_[_0x8dce('0x11')](_0xfdd18||[],'id');logger[_0x8dce('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x7c5547['join']());return db[_0x8dce('0x13')]['update']({'closeReason':_0x8dce('0x14'),'disposition':_0x8dce('0x15'),'closed':!![],'closedAt':moment()[_0x8dce('0x16')](_0x8dce('0x17'))},{'where':{'id':_0x7c5547}});}})[_0x8dce('0xd')](function(){if(_0x7c5547&&_0x7c5547[_0x8dce('0x18')]){logger['info'](_0x8dce('0x19'),_0x7c5547[_0x8dce('0x1a')]());for(var _0x1b6220=0x0;_0x1b6220<_0x7c5547[_0x8dce('0x18')];_0x1b6220++){io['emit'](_0x8dce('0x1b'),{'id':_0x7c5547[_0x1b6220],'closed':!![]});}}})['catch'](function(_0x21bd2a){logger['error'](_0x8dce('0x1c'),_0x21bd2a?util[_0x8dce('0x1d')](_0x21bd2a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x4215=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','length','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4215,0x161));var _0x5421=function(_0xcd4be7,_0x4e5dcc){_0xcd4be7=_0xcd4be7-0x0;var _0x1011e8=_0x4215[_0xcd4be7];return _0x1011e8;};'use strict';var _=require(_0x5421('0x0'));var moment=require(_0x5421('0x1'));var Redis=require('ioredis');var util=require(_0x5421('0x2'));var config=require(_0x5421('0x3'));var db=require(_0x5421('0x4'))['db'];var logger=require(_0x5421('0x5'))(_0x5421('0x6'));config[_0x5421('0x7')]=_[_0x5421('0x8')](config['redis'],{'host':_0x5421('0x9'),'port':0x18eb});var io=require(_0x5421('0xa'))(new Redis(config[_0x5421('0x7')]));function closeInteractions(){var _0x1762a8=0x0;var _0x3032e5=[];return db['Setting'][_0x5421('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x5421('0xc')](function(_0x5dbe3e){_0x1762a8=_0x5dbe3e[_0x5421('0xd')];if(_0x1762a8){return db[_0x5421('0xe')][_0x5421('0xf')]({'raw':!![],'attributes':['id',_0x5421('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5421('0x11')](_0x5dbe3e[_0x5421('0xd')],'minutes')}}});}else{return[];}})[_0x5421('0xc')](function(_0x1c3a21){if(_0x1c3a21&&_0x1c3a21[_0x5421('0x12')]){_0x3032e5=_['map'](_0x1c3a21||[],'id');logger['info'](_0x5421('0x13'),_0x3032e5[_0x5421('0x14')]());return db[_0x5421('0xe')][_0x5421('0x15')]({'closeReason':_0x5421('0x16'),'disposition':_0x5421('0x17'),'closed':!![],'closedAt':moment()[_0x5421('0x18')](_0x5421('0x19'))},{'where':{'id':_0x3032e5}});}})[_0x5421('0xc')](function(){if(_0x3032e5&&_0x3032e5[_0x5421('0x12')]){logger[_0x5421('0x1a')](_0x5421('0x1b'),_0x3032e5[_0x5421('0x14')]());for(var _0xb7cf46=0x0;_0xb7cf46<_0x3032e5[_0x5421('0x12')];_0xb7cf46++){io[_0x5421('0x1c')](_0x5421('0x1d'),{'id':_0x3032e5[_0xb7cf46],'closed':!![]});}}})[_0x5421('0x1e')](function(_0x1c32c6){logger[_0x5421('0x1f')](_0x5421('0x20'),_0x1c32c6?util['inspect'](_0x1c32c6,{'showHidden':![],'depth':null}):'');});}exports[_0x5421('0x21')]=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 5203d8d..ae28153 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 _0x1823=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x338e51,_0x24570b){var _0xc54248=function(_0x3282ce){while(--_0x3282ce){_0x338e51['push'](_0x338e51['shift']());}};_0xc54248(++_0x24570b);}(_0x1823,0x1bd));var _0x3182=function(_0x33545b,_0x5b4e3b){_0x33545b=_0x33545b-0x0;var _0x439bf6=_0x1823[_0x33545b];return _0x439bf6;};'use strict';function start(){var _0x323c7e=require(_0x3182('0x0'));return _0x323c7e[_0x3182('0x1')]();}module[_0x3182('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xc0dd=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xc0dd,0x106));var _0xdc0d=function(_0x55d0bc,_0x424c46){_0x55d0bc=_0x55d0bc-0x0;var _0x176de3=_0xc0dd[_0x55d0bc];return _0x176de3;};'use strict';function start(){var _0x476cbc=require(_0xdc0d('0x0'));return _0x476cbc[_0xdc0d('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a361cc8..e20147d 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 _0xb889=['endAt','add','start','add\x20cron','deleteJob','stop\x20cron','active','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','host','Smtp','port','secure','auth','user','pass','format','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','savename','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','intersection','length','exists','stop','delete\x20cron','index','resolve','run\x20job','cron','isBetween','startAt'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0xb889,0x115));var _0x9b88=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xb889[_0x101e7b];return _0x4995c0;};'use strict';var fs=require('fs');var util=require(_0x9b88('0x0'));var path=require(_0x9b88('0x1'));var _=require(_0x9b88('0x2'));var moment=require('moment');var CronJobManager=require(_0x9b88('0x3'));var jayson=require(_0x9b88('0x4'));var BPromise=require(_0x9b88('0x5'));var logger=require(_0x9b88('0x6'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x9b88('0x7'));var analyticDefaultReportController=require(_0x9b88('0x8'));var client=jayson[_0x9b88('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5dffe2,_0x53f237){return function(){logger[_0x9b88('0xa')](_0x9b88('0xb'),_0x5dffe2[_0x9b88('0xc')]);var _0x1dca48=!![];var _0x3b3071={'tls':{'rejectUnauthorized':![]}};if(_0x5dffe2[_0x9b88('0xd')]['Smtp'][_0x9b88('0xe')]){_0x3b3071[_0x9b88('0xe')]=_0x5dffe2[_0x9b88('0xd')]['Smtp'][_0x9b88('0xe')];}else{_0x3b3071[_0x9b88('0xf')]=_0x5dffe2[_0x9b88('0xd')][_0x9b88('0x10')][_0x9b88('0xf')];_0x3b3071[_0x9b88('0x11')]=_0x5dffe2[_0x9b88('0xd')][_0x9b88('0x10')]['port'];_0x3b3071['secure']=_0x5dffe2[_0x9b88('0xd')][_0x9b88('0x10')][_0x9b88('0x12')];}if(_0x5dffe2[_0x9b88('0xd')][_0x9b88('0x10')]['authentication']){_0x3b3071[_0x9b88('0x13')]={'user':_0x5dffe2['MailAccount'][_0x9b88('0x10')][_0x9b88('0x14')],'pass':_0x5dffe2[_0x9b88('0xd')][_0x9b88('0x10')][_0x9b88('0x15')]};}var _0x4b2e48={'account':_0x3b3071,'message':{'from':util[_0x9b88('0x16')]('\x22%s\x22\x20<%s>',_0x5dffe2['MailAccount'][_0x9b88('0x17')],_0x5dffe2['MailAccount'][_0x9b88('0xc')]||_0x5dffe2['MailAccount'][_0x9b88('0x10')][_0x9b88('0x14')]),'to':_0x5dffe2[_0x9b88('0xc')],'cc':_0x5dffe2['cc'],'bcc':_0x5dffe2[_0x9b88('0x18')],'subject':util['format'](_0x9b88('0x19'),_0x53f237[_0x9b88('0x17')],_0x5dffe2[_0x9b88('0x1a')],_0x5dffe2['subtractUnit'])}};var _0x428811=path[_0x9b88('0x1b')](__dirname,'../../files/reports');var _0x3d65d4=_0x53f237[_0x9b88('0x1c')];var _0x4dafb6=util[_0x9b88('0x16')](_0x9b88('0x1d'),path[_0x9b88('0x1e')](_0x53f237[_0x9b88('0x1c')],path[_0x9b88('0x1f')](_0x53f237['savename'])),'zip');var _0x49183e=path[_0x9b88('0x1b')](_0x428811,_0x3d65d4);var _0x73ff4d=path['join'](_0x428811,_0x4dafb6);if(fs[_0x9b88('0x20')](_0x49183e)){_0x53f237[_0x9b88('0x21')]=_0x9b88('0x22');_0x4b2e48[_0x9b88('0x23')][_0x9b88('0x24')]=[{'filename':_0x3d65d4,'path':_0x49183e}];_0x4b2e48['message'][_0x9b88('0x25')]=util[_0x9b88('0x16')](_0x9b88('0x26'),JSON[_0x9b88('0x27')](_0x53f237,null,0x2));}else if(fs[_0x9b88('0x20')](_0x73ff4d)){_0x53f237['status']=_0x9b88('0x22');_0x4b2e48['message'][_0x9b88('0x24')]=[{'filename':_0x4dafb6,'path':_0x73ff4d}];}else{_0x4b2e48[_0x9b88('0x23')][_0x9b88('0x25')]=_0x9b88('0x28');if(!_0x5dffe2[_0x9b88('0x29')]){_0x1dca48=![];logger[_0x9b88('0xa')](_0x9b88('0x2a'));}}if(_0x1dca48){return client['request'](_0x9b88('0x2b'),_0x4b2e48)[_0x9b88('0x2c')](function(_0x57515e){if(_0x57515e[_0x9b88('0x2d')]){return logger[_0x9b88('0x2d')](_0x9b88('0x2e'),JSON[_0x9b88('0x27')](_0x57515e));}return logger[_0x9b88('0xa')]('email\x20sent');})[_0x9b88('0x2f')](function(_0x1eb9c7){return logger['error']('error\x20mail',JSON[_0x9b88('0x27')](_0x1eb9c7));});}};}function handleError(){return function(_0x3ec405){return logger[_0x9b88('0x2d')](JSON[_0x9b88('0x27')](_0x3ec405));};}function handleResult(_0x32cfee){return function(_0x3e01e6){logger[_0x9b88('0xa')](_0x9b88('0x30'),JSON['stringify'](_0x3e01e6));if(_0x32cfee[_0x9b88('0xd')]&&_0x32cfee[_0x9b88('0xd')][_0x9b88('0x10')]&&!_[_0x9b88('0x31')](_0x32cfee[_0x9b88('0xc')])){setTimeout(handleSendEmail(_0x32cfee,_0x3e01e6),0x3c*0x3e8);}};}function handleJob(_0x1d33ef){return function(){try{if(_[_0x9b88('0x31')](_0x1d33ef['subtractNumber'])){return logger[_0x9b88('0xa')](_0x9b88('0x32'));}if(_[_0x9b88('0x31')](_0x1d33ef[_0x9b88('0x33')])){return logger[_0x9b88('0xa')](_0x9b88('0x34'));}var _0xe21b5d={'startDate':moment()['subtract'](_0x1d33ef[_0x9b88('0x1a')],_0x1d33ef[_0x9b88('0x33')])[_0x9b88('0x16')](_0x9b88('0x35')),'endDate':moment()[_0x9b88('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x9b88('0x36'),'output':_0x1d33ef[_0x9b88('0x37')],'name':_0x1d33ef[_0x9b88('0x17')]};if(!_[_0x9b88('0x31')](_0x1d33ef['DefaultReportId'])){logger[_0x9b88('0xa')](_0x9b88('0x38'),_0x1d33ef[_0x9b88('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x1d33ef[_0x9b88('0x39')]},_0xe21b5d)['then'](handleResult(_0x1d33ef))[_0x9b88('0x2f')](handleError());}if(!_[_0x9b88('0x31')](_0x1d33ef[_0x9b88('0x3a')])){logger[_0x9b88('0xa')](_0x9b88('0x3b'),_0x1d33ef['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x1d33ef[_0x9b88('0x3a')]},_0xe21b5d)[_0x9b88('0x2c')](handleResult(_0x1d33ef))[_0x9b88('0x2f')](handleError());}}catch(_0x3aa2bd){logger[_0x9b88('0x2d')](JSON[_0x9b88('0x27')](_0x3aa2bd));}return logger[_0x9b88('0xa')](_0x9b88('0x3c'));};}function getJobs(_0x2f197d){var _0x389a4f={};if(_0x2f197d){_0x389a4f['id']=_0x2f197d;}return db[_0x9b88('0x3d')][_0x9b88('0x3e')]({'where':_0x389a4f,'include':[{'model':db[_0x9b88('0xd')],'attributes':['id',_0x9b88('0x17'),'email'],'include':[{'model':db[_0x9b88('0x3f')],'as':_0x9b88('0x10')}]}]})[_0x9b88('0x2c')](function(_0x22b003){var _0x302ee6=_[_0x9b88('0x40')](manager['jobs']);var _0x24eeea=_[_0x9b88('0x41')](_0x22b003,function(_0x35153d){return _0x35153d['id'][_0x9b88('0x42')]();});var _0x2e681e=_[_0x9b88('0x43')](_0x22b003,function(_0x290130){return _0x290130['id'][_0x9b88('0x42')]();});var _0xff80e8=_0x2f197d?_0x24eeea:_['difference'](_0x24eeea,_0x302ee6);var _0xb89682=_[_0x9b88('0x44')](_0x24eeea,_0x302ee6);var _0x123083=_['difference'](_0x302ee6,_0x24eeea);var _0x4a2a6f;var _0x2dbfcd;for(_0x4a2a6f=0x0;_0x4a2a6f<_0x123083[_0x9b88('0x45')]&&!_0x2f197d;_0x4a2a6f+=0x1){_0x2dbfcd=_0x123083[_0x4a2a6f][_0x9b88('0x42')]();if(manager[_0x9b88('0x46')](_0x2dbfcd)){manager[_0x9b88('0x47')](_0x2dbfcd);manager['deleteJob'](_0x2dbfcd);logger[_0x9b88('0xa')](_0x9b88('0x48'),_0x2dbfcd);}}logger[_0x9b88('0xa')]('toRun',JSON[_0x9b88('0x27')](_0xff80e8));for(_0x4a2a6f=0x0;_0x4a2a6f<_0xff80e8['length'];_0x4a2a6f+=0x1){_0x2dbfcd=_0xff80e8[_0x4a2a6f]['toString']();logger[_0x9b88('0xa')](_0x9b88('0x49'),_0x2dbfcd);if(_0x2f197d){logger[_0x9b88('0xa')]('my\x20id',_0x2f197d);logger['info'](JSON[_0x9b88('0x27')](_0x2e681e[_0x2dbfcd]));BPromise[_0x9b88('0x4a')]()[_0x9b88('0x2c')](handleJob(_0x2e681e[_0x2dbfcd]));logger[_0x9b88('0xa')](_0x9b88('0x4b'),_0x2e681e[_0x2dbfcd][_0x9b88('0x17')],_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')]);}else if(_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')]&&_0x2e681e[_0x2dbfcd]['active']&&moment()[_0x9b88('0x4d')](_0x2e681e[_0x2dbfcd][_0x9b88('0x4e')],_0x2e681e[_0x2dbfcd][_0x9b88('0x4f')])){manager[_0x9b88('0x50')](_0x2dbfcd,_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')],handleJob(_0x2e681e[_0x2dbfcd]));manager[_0x9b88('0x51')](_0x2dbfcd);logger[_0x9b88('0xa')](_0x9b88('0x52'),_0x2e681e[_0x2dbfcd]['name'],_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')]);}else if(manager['exists'](_0x2dbfcd)){manager[_0x9b88('0x47')](_0x2dbfcd);manager[_0x9b88('0x53')](_0x2dbfcd);logger[_0x9b88('0xa')](_0x9b88('0x54'),_0x2e681e[_0x2dbfcd][_0x9b88('0x17')],_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')]);}}for(_0x4a2a6f=0x0,_0x2dbfcd;_0x4a2a6f<_0xb89682[_0x9b88('0x45')]&&!_0x2f197d;_0x4a2a6f+=0x1){_0x2dbfcd=_0xb89682[_0x4a2a6f]['toString']();if(manager[_0x9b88('0x46')](_0x2dbfcd)){if(_0x2e681e[_0x2dbfcd]['cron']&&_0x2e681e[_0x2dbfcd][_0x9b88('0x55')]&&moment()[_0x9b88('0x4d')](_0x2e681e[_0x2dbfcd][_0x9b88('0x4e')],_0x2e681e[_0x2dbfcd]['endAt'])){manager[_0x9b88('0x56')](_0x2dbfcd,_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')],handleJob(_0x2e681e[_0x2dbfcd]));logger[_0x9b88('0xa')](_0x9b88('0x57'),_0x2e681e[_0x2dbfcd][_0x9b88('0x17')],_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')]);}else{manager[_0x9b88('0x47')](_0x2dbfcd);manager[_0x9b88('0x53')](_0x2dbfcd);logger['info'](_0x9b88('0x54'),_0x2e681e[_0x2dbfcd]['name'],_0x2e681e[_0x2dbfcd][_0x9b88('0x4c')]);}}}})[_0x9b88('0x2f')](function(_0x3d176c){logger[_0x9b88('0x2d')](JSON[_0x9b88('0x27')](_0x3d176c));});}exports[_0x9b88('0x58')]=function(_0x10c774){return getJobs(_0x10c774);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x17f5=['difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','email','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','%s.%s','extname','savename','zip','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','then','error','error\x20mail','stringify','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy'];(function(_0x20d88d,_0x480e4f){var _0x193dca=function(_0x11ce27){while(--_0x11ce27){_0x20d88d['push'](_0x20d88d['shift']());}};_0x193dca(++_0x480e4f);}(_0x17f5,0x181));var _0x517f=function(_0x5ae899,_0x236a4f){_0x5ae899=_0x5ae899-0x0;var _0x1cf88e=_0x17f5[_0x5ae899];return _0x1cf88e;};'use strict';var fs=require('fs');var util=require(_0x517f('0x0'));var path=require(_0x517f('0x1'));var _=require(_0x517f('0x2'));var moment=require(_0x517f('0x3'));var CronJobManager=require(_0x517f('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x517f('0x5'))('schedule');var db=require(_0x517f('0x6'))['db'];var analyticCustomReportController=require(_0x517f('0x7'));var analyticDefaultReportController=require(_0x517f('0x8'));var client=jayson['client'][_0x517f('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2428bd,_0x96379a){return function(){logger[_0x517f('0xa')](_0x517f('0xb'),_0x2428bd['email']);var _0x99f69e=!![];var _0x38064e={'tls':{'rejectUnauthorized':![]}};if(_0x2428bd[_0x517f('0xc')][_0x517f('0xd')][_0x517f('0xe')]){_0x38064e[_0x517f('0xe')]=_0x2428bd['MailAccount'][_0x517f('0xd')][_0x517f('0xe')];}else{_0x38064e[_0x517f('0xf')]=_0x2428bd[_0x517f('0xc')][_0x517f('0xd')][_0x517f('0xf')];_0x38064e[_0x517f('0x10')]=_0x2428bd[_0x517f('0xc')][_0x517f('0xd')][_0x517f('0x10')];_0x38064e[_0x517f('0x11')]=_0x2428bd[_0x517f('0xc')][_0x517f('0xd')]['secure'];}if(_0x2428bd[_0x517f('0xc')][_0x517f('0xd')][_0x517f('0x12')]){_0x38064e[_0x517f('0x13')]={'user':_0x2428bd[_0x517f('0xc')][_0x517f('0xd')][_0x517f('0x14')],'pass':_0x2428bd[_0x517f('0xc')][_0x517f('0xd')]['pass']};}var _0x1e5800={'account':_0x38064e,'message':{'from':util[_0x517f('0x15')](_0x517f('0x16'),_0x2428bd[_0x517f('0xc')][_0x517f('0x17')],_0x2428bd[_0x517f('0xc')][_0x517f('0x18')]||_0x2428bd[_0x517f('0xc')]['Smtp'][_0x517f('0x14')]),'to':_0x2428bd[_0x517f('0x18')],'cc':_0x2428bd['cc'],'bcc':_0x2428bd['bcc'],'subject':util[_0x517f('0x15')](_0x517f('0x19'),_0x96379a[_0x517f('0x17')],_0x2428bd['subtractNumber'],_0x2428bd[_0x517f('0x1a')])}};var _0x573711=path[_0x517f('0x1b')](__dirname,_0x517f('0x1c'));var _0x582236=_0x96379a['savename'];var _0x5c570=util[_0x517f('0x15')](_0x517f('0x1d'),path['basename'](_0x96379a['savename'],path[_0x517f('0x1e')](_0x96379a[_0x517f('0x1f')])),_0x517f('0x20'));var _0x464158=path[_0x517f('0x1b')](_0x573711,_0x582236);var _0x23a910=path[_0x517f('0x1b')](_0x573711,_0x5c570);if(fs[_0x517f('0x21')](_0x464158)){_0x96379a[_0x517f('0x22')]='Sent';_0x1e5800[_0x517f('0x23')][_0x517f('0x24')]=[{'filename':_0x582236,'path':_0x464158}];_0x1e5800[_0x517f('0x23')][_0x517f('0x25')]=util[_0x517f('0x15')](_0x517f('0x26'),JSON['stringify'](_0x96379a,null,0x2));}else if(fs[_0x517f('0x21')](_0x23a910)){_0x96379a[_0x517f('0x22')]=_0x517f('0x27');_0x1e5800[_0x517f('0x23')]['attachments']=[{'filename':_0x5c570,'path':_0x23a910}];}else{_0x1e5800[_0x517f('0x23')][_0x517f('0x25')]=_0x517f('0x28');if(!_0x2428bd[_0x517f('0x29')]){_0x99f69e=![];logger[_0x517f('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x99f69e){return client['request']('SendMail',_0x1e5800)[_0x517f('0x2a')](function(_0x1927f9){if(_0x1927f9[_0x517f('0x2b')]){return logger[_0x517f('0x2b')](_0x517f('0x2c'),JSON[_0x517f('0x2d')](_0x1927f9));}return logger[_0x517f('0xa')](_0x517f('0x2e'));})[_0x517f('0x2f')](function(_0xb701cd){return logger[_0x517f('0x2b')](_0x517f('0x2c'),JSON[_0x517f('0x2d')](_0xb701cd));});}};}function handleError(){return function(_0x541b46){return logger[_0x517f('0x2b')](JSON[_0x517f('0x2d')](_0x541b46));};}function handleResult(_0x3f1f67){return function(_0x253068){logger[_0x517f('0xa')](_0x517f('0x30'),JSON[_0x517f('0x2d')](_0x253068));if(_0x3f1f67['MailAccount']&&_0x3f1f67[_0x517f('0xc')][_0x517f('0xd')]&&!_[_0x517f('0x31')](_0x3f1f67['email'])){setTimeout(handleSendEmail(_0x3f1f67,_0x253068),0x3c*0x3e8);}};}function handleJob(_0x18fe88){return function(){try{if(_[_0x517f('0x31')](_0x18fe88[_0x517f('0x32')])){return logger[_0x517f('0xa')](_0x517f('0x33'));}if(_[_0x517f('0x31')](_0x18fe88['subtractUnit'])){return logger[_0x517f('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x7ae4d={'startDate':moment()[_0x517f('0x34')](_0x18fe88[_0x517f('0x32')],_0x18fe88[_0x517f('0x1a')])[_0x517f('0x15')](_0x517f('0x35')),'endDate':moment()[_0x517f('0x15')](_0x517f('0x35')),'type':_0x517f('0x36'),'output':_0x18fe88[_0x517f('0x37')],'name':_0x18fe88[_0x517f('0x17')]};if(!_[_0x517f('0x31')](_0x18fe88[_0x517f('0x38')])){logger[_0x517f('0xa')](_0x517f('0x39'),_0x18fe88[_0x517f('0x38')]);return analyticDefaultReportController[_0x517f('0x3a')]({'id':_0x18fe88['DefaultReportId']},_0x7ae4d)[_0x517f('0x2a')](handleResult(_0x18fe88))[_0x517f('0x2f')](handleError());}if(!_[_0x517f('0x31')](_0x18fe88[_0x517f('0x3b')])){logger[_0x517f('0xa')](_0x517f('0x3c'),_0x18fe88['CustomReportId']);return analyticCustomReportController[_0x517f('0x3a')]({'id':_0x18fe88[_0x517f('0x3b')]},_0x7ae4d)[_0x517f('0x2a')](handleResult(_0x18fe88))[_0x517f('0x2f')](handleError());}}catch(_0x167c15){logger[_0x517f('0x2b')](JSON[_0x517f('0x2d')](_0x167c15));}return logger[_0x517f('0xa')](_0x517f('0x3d'));};}function getJobs(_0x386628){var _0x25886b={};if(_0x386628){_0x25886b['id']=_0x386628;}return db[_0x517f('0x3e')][_0x517f('0x3f')]({'where':_0x25886b,'include':[{'model':db[_0x517f('0xc')],'attributes':['id',_0x517f('0x17'),_0x517f('0x18')],'include':[{'model':db[_0x517f('0x40')],'as':'Smtp'}]}]})[_0x517f('0x2a')](function(_0x299c22){var _0x5d1a28=_[_0x517f('0x41')](manager[_0x517f('0x42')]);var _0x1df3ff=_[_0x517f('0x43')](_0x299c22,function(_0x4a34c8){return _0x4a34c8['id'][_0x517f('0x44')]();});var _0x2709a8=_[_0x517f('0x45')](_0x299c22,function(_0x4f3fc9){return _0x4f3fc9['id'][_0x517f('0x44')]();});var _0x4a04db=_0x386628?_0x1df3ff:_[_0x517f('0x46')](_0x1df3ff,_0x5d1a28);var _0x570050=_[_0x517f('0x47')](_0x1df3ff,_0x5d1a28);var _0x4f8332=_[_0x517f('0x46')](_0x5d1a28,_0x1df3ff);var _0x260559;var _0x1f4926;for(_0x260559=0x0;_0x260559<_0x4f8332[_0x517f('0x48')]&&!_0x386628;_0x260559+=0x1){_0x1f4926=_0x4f8332[_0x260559][_0x517f('0x44')]();if(manager[_0x517f('0x49')](_0x1f4926)){manager['stop'](_0x1f4926);manager[_0x517f('0x4a')](_0x1f4926);logger[_0x517f('0xa')](_0x517f('0x4b'),_0x1f4926);}}logger['info'](_0x517f('0x4c'),JSON['stringify'](_0x4a04db));for(_0x260559=0x0;_0x260559<_0x4a04db[_0x517f('0x48')];_0x260559+=0x1){_0x1f4926=_0x4a04db[_0x260559][_0x517f('0x44')]();logger[_0x517f('0xa')](_0x517f('0x4d'),_0x1f4926);if(_0x386628){logger['info'](_0x517f('0x4e'),_0x386628);logger[_0x517f('0xa')](JSON[_0x517f('0x2d')](_0x2709a8[_0x1f4926]));BPromise['resolve']()[_0x517f('0x2a')](handleJob(_0x2709a8[_0x1f4926]));logger['info']('run\x20job',_0x2709a8[_0x1f4926]['name'],_0x2709a8[_0x1f4926][_0x517f('0x4f')]);}else if(_0x2709a8[_0x1f4926]['cron']&&_0x2709a8[_0x1f4926][_0x517f('0x50')]&&moment()[_0x517f('0x51')](_0x2709a8[_0x1f4926][_0x517f('0x52')],_0x2709a8[_0x1f4926][_0x517f('0x53')])){manager[_0x517f('0x54')](_0x1f4926,_0x2709a8[_0x1f4926][_0x517f('0x4f')],handleJob(_0x2709a8[_0x1f4926]));manager[_0x517f('0x55')](_0x1f4926);logger[_0x517f('0xa')](_0x517f('0x56'),_0x2709a8[_0x1f4926][_0x517f('0x17')],_0x2709a8[_0x1f4926][_0x517f('0x4f')]);}else if(manager[_0x517f('0x49')](_0x1f4926)){manager['stop'](_0x1f4926);manager['deleteJob'](_0x1f4926);logger['info'](_0x517f('0x57'),_0x2709a8[_0x1f4926][_0x517f('0x17')],_0x2709a8[_0x1f4926]['cron']);}}for(_0x260559=0x0,_0x1f4926;_0x260559<_0x570050[_0x517f('0x48')]&&!_0x386628;_0x260559+=0x1){_0x1f4926=_0x570050[_0x260559][_0x517f('0x44')]();if(manager[_0x517f('0x49')](_0x1f4926)){if(_0x2709a8[_0x1f4926]['cron']&&_0x2709a8[_0x1f4926][_0x517f('0x50')]&&moment()[_0x517f('0x51')](_0x2709a8[_0x1f4926][_0x517f('0x52')],_0x2709a8[_0x1f4926][_0x517f('0x53')])){manager[_0x517f('0x58')](_0x1f4926,_0x2709a8[_0x1f4926][_0x517f('0x4f')],handleJob(_0x2709a8[_0x1f4926]));logger[_0x517f('0xa')](_0x517f('0x59'),_0x2709a8[_0x1f4926][_0x517f('0x17')],_0x2709a8[_0x1f4926][_0x517f('0x4f')]);}else{manager['stop'](_0x1f4926);manager['deleteJob'](_0x1f4926);logger[_0x517f('0xa')]('stop\x20cron',_0x2709a8[_0x1f4926][_0x517f('0x17')],_0x2709a8[_0x1f4926][_0x517f('0x4f')]);}}}})['catch'](function(_0x132443){logger[_0x517f('0x2b')](JSON['stringify'](_0x132443));});}exports[_0x517f('0x5a')]=function(_0x37d670){return getJobs(_0x37d670);};exports[_0x517f('0x55')]=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 7cf7473..28e5c6f 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 _0xd5fc=['Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','name','start','lodash','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError'];(function(_0x537f1a,_0x3fc46a){var _0xe3b11e=function(_0x5ce8d6){while(--_0x5ce8d6){_0x537f1a['push'](_0x537f1a['shift']());}};_0xe3b11e(++_0x3fc46a);}(_0xd5fc,0xae));var _0xcd5f=function(_0x1be060,_0x2f56c3){_0x1be060=_0x1be060-0x0;var _0x26f21c=_0xd5fc[_0x1be060];return _0x26f21c;};var _=require(_0xcd5f('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0xcd5f('0x1'));var db=require(_0xcd5f('0x2'))['db'];var logger=require(_0xcd5f('0x3'))(_0xcd5f('0x4'));function getTranscriptionJob(_0x6e2bf6,_0x3757ef,_0x4f29cd,_0x3eeb6b){return new Promise(function(_0x4b4ca8,_0x95b8bb){var _0x159b3f=new AWS['TranscribeService']({'accessKeyId':_0x3757ef,'secretAccessKey':_0x6e2bf6,'region':_0x4f29cd});_0x159b3f['getTranscriptionJob']({'TranscriptionJobName':_0x3eeb6b},function(_0x4e668e,_0x102ce9){if(_0x4e668e){return _0x95b8bb(_0x4e668e);}else{return _0x4b4ca8(_0x102ce9);}});});}function sentiment(_0x4d5141,_0xa1dae3,_0x3e63d4,_0x5e5019,_0x11a3b4){return new Promise(function(_0x56f77c,_0x112554){var _0x515ed4=new AWS[(_0xcd5f('0x5'))]({'accessKeyId':_0xa1dae3,'secretAccessKey':_0x4d5141,'region':_0x3e63d4});_0x515ed4[_0xcd5f('0x6')]({'Text':_0x5e5019,'LanguageCode':_0x11a3b4[_0xcd5f('0x7')](0x0,0x2)},function(_0x1a43e9,_0x53a250){if(_0x1a43e9){return _0x112554(_0x1a43e9);}else{return _0x56f77c(_0x53a250);}});});}function checkTranscribeJob(_0x36951e,_0x2cba91,_0x4f309a){var _0x14125f;return new BPromise(function(_0x2c23a7,_0x2bebdd){logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x36951e['id'],_0x36951e[_0xcd5f('0xa')]));return getTranscriptionJob(_0x4f309a[_0xcd5f('0xb')],_0x4f309a[_0xcd5f('0xc')],_0x2cba91[_0xcd5f('0xd')],_0x36951e[_0xcd5f('0xa')])[_0xcd5f('0xe')](function(_0x29a1c8){logger['info'](util[_0xcd5f('0x9')](_0xcd5f('0xf'),_0x36951e['id'],_0x36951e[_0xcd5f('0xa')],_0x29a1c8[_0xcd5f('0x10')]['TranscriptionJobStatus']));if(!_0x36951e[_0xcd5f('0x11')]){switch(_0x29a1c8['TranscriptionJob'][_0xcd5f('0x12')]){case _0xcd5f('0x13'):var _0x48d5bb={'transcribeStatus':_0x29a1c8[_0xcd5f('0x10')][_0xcd5f('0x12')],'fileUri':_0x29a1c8['TranscriptionJob'][_0xcd5f('0x14')]['TranscriptFileUri']};logger[_0xcd5f('0x8')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x36951e['id']));return rp({'uri':_0x29a1c8[_0xcd5f('0x10')]['Transcript']['TranscriptFileUri'],'json':!![]})['then'](function(_0x408e30){logger['info'](util[_0xcd5f('0x9')](_0xcd5f('0x15'),_0x36951e['id']));if(_0x408e30&&_0x408e30[_0xcd5f('0x16')]&&_0x408e30[_0xcd5f('0x16')][_0xcd5f('0x17')]&&_0x408e30['results'][_0xcd5f('0x17')][_0xcd5f('0x18')]){_0x48d5bb[_0xcd5f('0x11')]='';for(var _0xba8e2e=0x0;_0xba8e2e<_0x408e30[_0xcd5f('0x16')][_0xcd5f('0x17')][_0xcd5f('0x18')];_0xba8e2e++){_0x48d5bb[_0xcd5f('0x11')]+=_0x408e30[_0xcd5f('0x16')][_0xcd5f('0x17')][_0xba8e2e][_0xcd5f('0x19')]+'';}}return _0x36951e[_0xcd5f('0x1a')](_0x48d5bb);})[_0xcd5f('0xe')](function(){logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')](_0xcd5f('0x1b'),_0x36951e['id']));if(!_0x36951e[_0xcd5f('0x1c')]){throw new db['Sequelize'][(_0xcd5f('0x1d'))](_0xcd5f('0x1e'));}if(!_0x2cba91['sentiment']||!_0x2cba91[_0xcd5f('0x1f')]||!_0x2cba91['sentimentRegion']||!_0x2cba91[_0xcd5f('0x20')]||!_0x2cba91[_0xcd5f('0x21')]){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))](_0xcd5f('0x23'));}if(!_0x48d5bb[_0xcd5f('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x2cba91['sentimentAccountId']===_0x4f309a['id']){return _0x4f309a;}else{return db[_0xcd5f('0x24')][_0xcd5f('0x25')]({'where':{'id':_settings[_0xcd5f('0x1f')]}});}})[_0xcd5f('0xe')](function(_0x101aa1){if(!_0x101aa1){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x101aa1[_0xcd5f('0xb')]||!_0x101aa1[_0xcd5f('0xc')]){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x14125f=_0x101aa1;logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')](_0xcd5f('0x26'),_0x36951e['id']));return sentiment(_0x14125f['data1'],_0x14125f[_0xcd5f('0xc')],_0x2cba91[_0xcd5f('0x27')],_0x48d5bb[_0xcd5f('0x11')],_0x2cba91[_0xcd5f('0x20')]);})[_0xcd5f('0xe')](function(_0x391bd2){logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x36951e['id']));return _0x36951e['update']({'sentiment':_0x391bd2[_0xcd5f('0x28')],'sPositive':_0x391bd2['SentimentScore'][_0xcd5f('0x29')],'sNegative':_0x391bd2[_0xcd5f('0x2a')][_0xcd5f('0x2b')],'sMixed':_0x391bd2['SentimentScore'][_0xcd5f('0x2c')],'sNeutral':_0x391bd2[_0xcd5f('0x2a')][_0xcd5f('0x2d')]});})[_0xcd5f('0xe')](function(){logger['info'](util[_0xcd5f('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x36951e['id']));_0x2c23a7();});case _0xcd5f('0x2e'):return _0x36951e[_0xcd5f('0x1a')]({'transcribeStatus':_0xcd5f('0x2e'),'failureReason':_0x29a1c8[_0xcd5f('0x10')][_0xcd5f('0x2f')]})[_0xcd5f('0xe')](function(){logger['info'](util[_0xcd5f('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x36951e['id']));_0x2c23a7();});default:logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')](_0xcd5f('0x30'),_0x36951e['id']));break;}}else{return BPromise['resolve']()[_0xcd5f('0xe')](function(){if(!_0x36951e[_0xcd5f('0x1c')]){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))](_0xcd5f('0x1e'));}if(!_0x2cba91[_0xcd5f('0x31')]||!_0x2cba91[_0xcd5f('0x1f')]||!_0x2cba91['sentimentRegion']||!_0x2cba91[_0xcd5f('0x20')]||!_0x2cba91[_0xcd5f('0x21')]){throw new db[(_0xcd5f('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x36951e[_0xcd5f('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x2cba91[_0xcd5f('0x1f')]===_0x4f309a['id']){return _0x4f309a;}else{return db[_0xcd5f('0x24')][_0xcd5f('0x25')]({'where':{'id':_settings[_0xcd5f('0x1f')]}});}})['then'](function(_0x14a474){if(!_0x14a474){throw new db['Sequelize'][(_0xcd5f('0x1d'))](_0xcd5f('0x32'));}if(!_0x14a474[_0xcd5f('0xb')]||!_0x14a474['data2']){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))](_0xcd5f('0x33'));}_0x14125f=_0x14a474;logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')](_0xcd5f('0x26'),_0x36951e['id']));return sentiment(_0x14125f[_0xcd5f('0xb')],_0x14125f[_0xcd5f('0xc')],_0x2cba91[_0xcd5f('0x27')],_0x36951e[_0xcd5f('0x11')],_0x2cba91['language']);})['then'](function(_0x1ced20){logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')](_0xcd5f('0x34'),_0x36951e['id']));return _0x36951e['update']({'sentiment':_0x1ced20[_0xcd5f('0x28')],'sPositive':_0x1ced20['SentimentScore'][_0xcd5f('0x29')],'sNegative':_0x1ced20[_0xcd5f('0x2a')][_0xcd5f('0x2b')],'sMixed':_0x1ced20['SentimentScore']['Mixed'],'sNeutral':_0x1ced20[_0xcd5f('0x2a')][_0xcd5f('0x2d')],'transcribeStatus':_0xcd5f('0x13')});})[_0xcd5f('0xe')](function(){logger[_0xcd5f('0x8')](util[_0xcd5f('0x9')](_0xcd5f('0x1b'),_0x36951e['id']));_0x2c23a7();});}})[_0xcd5f('0x35')](function(_0x1df321){if(_0x1df321){if(!_0x1df321['name']||_0x1df321['name']!==_0xcd5f('0x36')){logger[_0xcd5f('0x37')](util[_0xcd5f('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x36951e['id']),util[_0xcd5f('0x38')](_0x1df321,{'showHidden':![],'depth':null}));}}_0x2c23a7();});});}function checkTranscribe(){var _0x4384df;var _0x1027a5;var _0x21e87c;return db[_0xcd5f('0x39')]['findAll']({'where':{'transcribeStatus':_0xcd5f('0x3a')}})[_0xcd5f('0xe')](function(_0x3eb53b){if(!_0x3eb53b||!_0x3eb53b[_0xcd5f('0x18')]){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))](_0xcd5f('0x3b'));}_0x4384df=_0x3eb53b;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xcd5f('0xe')](function(_0x5dfca6){if(!_0x5dfca6){throw new db[(_0xcd5f('0x22'))]['ValidationError'](_0xcd5f('0x3c'));}_0x1027a5=_0x5dfca6;if(!_0x1027a5[_0xcd5f('0x4')]||!_0x1027a5[_0xcd5f('0x3d')]||!_0x1027a5[_0xcd5f('0xd')]||!_0x1027a5[_0xcd5f('0x20')]||!_0x1027a5['bucket']){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))](_0xcd5f('0x3e'));}return db[_0xcd5f('0x24')][_0xcd5f('0x25')]({'where':{'id':_0x1027a5['transcribeAccountId']}});})[_0xcd5f('0xe')](function(_0x2b47c9){if(!_0x2b47c9){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))](_0xcd5f('0x32'));}if(!_0x2b47c9[_0xcd5f('0xb')]||!_0x2b47c9['data2']){throw new db[(_0xcd5f('0x22'))][(_0xcd5f('0x1d'))](_0xcd5f('0x33'));}_0x21e87c=_0x2b47c9;var _0x8bc8d1=[];_0x4384df[_0xcd5f('0x3f')](function(_0x1f8cc7){_0x8bc8d1[_0xcd5f('0x40')](checkTranscribeJob(_0x1f8cc7,_0x1027a5,_0x21e87c));});return BPromise[_0xcd5f('0x41')](_0x8bc8d1);})[_0xcd5f('0x35')](function(_0x59bb18){if(_0x59bb18){if(!_0x59bb18[_0xcd5f('0x42')]||_0x59bb18[_0xcd5f('0x42')]!==_0xcd5f('0x36')){logger['error'](util['inspect'](_0x59bb18,{'showHidden':![],'depth':null}));}}});}exports[_0xcd5f('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1219=['catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','transcribe','bucket','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','COMPLETED'];(function(_0x3955f0,_0x1b7306){var _0x36d5f4=function(_0x3bac38){while(--_0x3bac38){_0x3955f0['push'](_0x3955f0['shift']());}};_0x36d5f4(++_0x1b7306);}(_0x1219,0x17c));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};var _=require(_0x9121('0x0'));var AWS=require(_0x9121('0x1'));var rp=require(_0x9121('0x2'));var util=require(_0x9121('0x3'));var BPromise=require(_0x9121('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x9121('0x5'))('transcribe');function getTranscriptionJob(_0x43b625,_0x11a39a,_0x19e49c,_0x149218){return new Promise(function(_0x420b62,_0x430583){var _0x437bac=new AWS[(_0x9121('0x6'))]({'accessKeyId':_0x11a39a,'secretAccessKey':_0x43b625,'region':_0x19e49c});_0x437bac[_0x9121('0x7')]({'TranscriptionJobName':_0x149218},function(_0x409a74,_0x2c55eb){if(_0x409a74){return _0x430583(_0x409a74);}else{return _0x420b62(_0x2c55eb);}});});}function sentiment(_0x5f2d77,_0xf84121,_0x2bf1d6,_0x1730c1,_0x99934c){return new Promise(function(_0x5dc11b,_0x3fe766){var _0x2c3e89=new AWS[(_0x9121('0x8'))]({'accessKeyId':_0xf84121,'secretAccessKey':_0x5f2d77,'region':_0x2bf1d6});_0x2c3e89[_0x9121('0x9')]({'Text':_0x1730c1,'LanguageCode':_0x99934c[_0x9121('0xa')](0x0,0x2)},function(_0x33d693,_0x3f9781){if(_0x33d693){return _0x3fe766(_0x33d693);}else{return _0x5dc11b(_0x3f9781);}});});}function checkTranscribeJob(_0xeb7986,_0x4470d0,_0x8a3dd1){var _0x3e54fc;return new BPromise(function(_0x20734e,_0x4526ed){logger[_0x9121('0xb')](util[_0x9121('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xeb7986['id'],_0xeb7986[_0x9121('0xd')]));return getTranscriptionJob(_0x8a3dd1[_0x9121('0xe')],_0x8a3dd1[_0x9121('0xf')],_0x4470d0[_0x9121('0x10')],_0xeb7986[_0x9121('0xd')])[_0x9121('0x11')](function(_0x49c6aa){logger['info'](util[_0x9121('0xc')](_0x9121('0x12'),_0xeb7986['id'],_0xeb7986[_0x9121('0xd')],_0x49c6aa[_0x9121('0x13')]['TranscriptionJobStatus']));if(!_0xeb7986['fileText']){switch(_0x49c6aa[_0x9121('0x13')][_0x9121('0x14')]){case'COMPLETED':var _0xd13632={'transcribeStatus':_0x49c6aa[_0x9121('0x13')][_0x9121('0x14')],'fileUri':_0x49c6aa[_0x9121('0x13')]['Transcript'][_0x9121('0x15')]};logger['info'](util[_0x9121('0xc')](_0x9121('0x16'),_0xeb7986['id']));return rp({'uri':_0x49c6aa[_0x9121('0x13')][_0x9121('0x17')][_0x9121('0x15')],'json':!![]})[_0x9121('0x11')](function(_0x4d568e){logger[_0x9121('0xb')](util[_0x9121('0xc')](_0x9121('0x18'),_0xeb7986['id']));if(_0x4d568e&&_0x4d568e[_0x9121('0x19')]&&_0x4d568e['results']['transcripts']&&_0x4d568e[_0x9121('0x19')][_0x9121('0x1a')][_0x9121('0x1b')]){_0xd13632['fileText']='';for(var _0x34d48d=0x0;_0x34d48d<_0x4d568e[_0x9121('0x19')]['transcripts'][_0x9121('0x1b')];_0x34d48d++){_0xd13632[_0x9121('0x1c')]+=_0x4d568e[_0x9121('0x19')][_0x9121('0x1a')][_0x34d48d][_0x9121('0x1d')]+'';}}return _0xeb7986[_0x9121('0x1e')](_0xd13632);})[_0x9121('0x11')](function(){logger[_0x9121('0xb')](util[_0x9121('0xc')](_0x9121('0x1f'),_0xeb7986['id']));if(!_0xeb7986[_0x9121('0x20')]){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))](_0x9121('0x23'));}if(!_0x4470d0[_0x9121('0x24')]||!_0x4470d0[_0x9121('0x25')]||!_0x4470d0[_0x9121('0x26')]||!_0x4470d0['language']||!_0x4470d0['bucket']){throw new db[(_0x9121('0x21'))]['ValidationError'](_0x9121('0x27'));}if(!_0xd13632[_0x9121('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x4470d0[_0x9121('0x25')]===_0x8a3dd1['id']){return _0x8a3dd1;}else{return db[_0x9121('0x28')][_0x9121('0x29')]({'where':{'id':_settings[_0x9121('0x25')]}});}})[_0x9121('0x11')](function(_0x52ea6b){if(!_0x52ea6b){throw new db['Sequelize']['ValidationError'](_0x9121('0x2a'));}if(!_0x52ea6b[_0x9121('0xe')]||!_0x52ea6b['data2']){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))](_0x9121('0x2b'));}_0x3e54fc=_0x52ea6b;logger['info'](util[_0x9121('0xc')](_0x9121('0x2c'),_0xeb7986['id']));return sentiment(_0x3e54fc[_0x9121('0xe')],_0x3e54fc[_0x9121('0xf')],_0x4470d0[_0x9121('0x26')],_0xd13632[_0x9121('0x1c')],_0x4470d0[_0x9121('0x2d')]);})[_0x9121('0x11')](function(_0x3db305){logger[_0x9121('0xb')](util[_0x9121('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xeb7986['id']));return _0xeb7986[_0x9121('0x1e')]({'sentiment':_0x3db305[_0x9121('0x2e')],'sPositive':_0x3db305[_0x9121('0x2f')][_0x9121('0x30')],'sNegative':_0x3db305[_0x9121('0x2f')][_0x9121('0x31')],'sMixed':_0x3db305['SentimentScore']['Mixed'],'sNeutral':_0x3db305['SentimentScore'][_0x9121('0x32')]});})[_0x9121('0x11')](function(){logger[_0x9121('0xb')](util[_0x9121('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xeb7986['id']));_0x20734e();});case'FAILED':return _0xeb7986[_0x9121('0x1e')]({'transcribeStatus':_0x9121('0x33'),'failureReason':_0x49c6aa[_0x9121('0x13')][_0x9121('0x34')]})['then'](function(){logger[_0x9121('0xb')](util[_0x9121('0xc')](_0x9121('0x1f'),_0xeb7986['id']));_0x20734e();});default:logger['info'](util[_0x9121('0xc')](_0x9121('0x35'),_0xeb7986['id']));break;}}else{return BPromise[_0x9121('0x36')]()['then'](function(){if(!_0xeb7986[_0x9121('0x20')]){throw new db['Sequelize'][(_0x9121('0x22'))](_0x9121('0x23'));}if(!_0x4470d0[_0x9121('0x24')]||!_0x4470d0[_0x9121('0x25')]||!_0x4470d0[_0x9121('0x26')]||!_0x4470d0[_0x9121('0x2d')]||!_0x4470d0['bucket']){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))](_0x9121('0x27'));}if(!_0xeb7986[_0x9121('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x4470d0[_0x9121('0x25')]===_0x8a3dd1['id']){return _0x8a3dd1;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x9121('0x25')]}});}})['then'](function(_0x4664db){if(!_0x4664db){throw new db['Sequelize']['ValidationError'](_0x9121('0x2a'));}if(!_0x4664db['data1']||!_0x4664db[_0x9121('0xf')]){throw new db['Sequelize'][(_0x9121('0x22'))](_0x9121('0x2b'));}_0x3e54fc=_0x4664db;logger[_0x9121('0xb')](util[_0x9121('0xc')](_0x9121('0x2c'),_0xeb7986['id']));return sentiment(_0x3e54fc[_0x9121('0xe')],_0x3e54fc[_0x9121('0xf')],_0x4470d0['sentimentRegion'],_0xeb7986[_0x9121('0x1c')],_0x4470d0[_0x9121('0x2d')]);})[_0x9121('0x11')](function(_0x5a6adf){logger[_0x9121('0xb')](util[_0x9121('0xc')](_0x9121('0x37'),_0xeb7986['id']));return _0xeb7986[_0x9121('0x1e')]({'sentiment':_0x5a6adf[_0x9121('0x2e')],'sPositive':_0x5a6adf[_0x9121('0x2f')][_0x9121('0x30')],'sNegative':_0x5a6adf[_0x9121('0x2f')][_0x9121('0x31')],'sMixed':_0x5a6adf['SentimentScore'][_0x9121('0x38')],'sNeutral':_0x5a6adf[_0x9121('0x2f')][_0x9121('0x32')],'transcribeStatus':_0x9121('0x39')});})[_0x9121('0x11')](function(){logger[_0x9121('0xb')](util[_0x9121('0xc')](_0x9121('0x1f'),_0xeb7986['id']));_0x20734e();});}})[_0x9121('0x3a')](function(_0x4c7f39){if(_0x4c7f39){if(!_0x4c7f39[_0x9121('0x3b')]||_0x4c7f39[_0x9121('0x3b')]!==_0x9121('0x3c')){logger['error'](util[_0x9121('0xc')](_0x9121('0x3d'),_0xeb7986['id']),util[_0x9121('0x3e')](_0x4c7f39,{'showHidden':![],'depth':null}));}}_0x20734e();});});}function checkTranscribe(){var _0x1a4c20;var _0x34a54e;var _0x471de8;return db[_0x9121('0x3f')][_0x9121('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x9121('0x11')](function(_0xc71b4c){if(!_0xc71b4c||!_0xc71b4c['length']){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1a4c20=_0xc71b4c;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x9121('0x11')](function(_0x4ddc77){if(!_0x4ddc77){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))](_0x9121('0x41'));}_0x34a54e=_0x4ddc77;if(!_0x34a54e[_0x9121('0x42')]||!_0x34a54e['transcribeAccountId']||!_0x34a54e[_0x9121('0x10')]||!_0x34a54e['language']||!_0x34a54e[_0x9121('0x43')]){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))](_0x9121('0x44'));}return db[_0x9121('0x28')][_0x9121('0x29')]({'where':{'id':_0x34a54e['transcribeAccountId']}});})['then'](function(_0x4c8a53){if(!_0x4c8a53){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))](_0x9121('0x2a'));}if(!_0x4c8a53[_0x9121('0xe')]||!_0x4c8a53[_0x9121('0xf')]){throw new db[(_0x9121('0x21'))][(_0x9121('0x22'))](_0x9121('0x2b'));}_0x471de8=_0x4c8a53;var _0x392fae=[];_0x1a4c20[_0x9121('0x45')](function(_0x54ae41){_0x392fae[_0x9121('0x46')](checkTranscribeJob(_0x54ae41,_0x34a54e,_0x471de8));});return BPromise[_0x9121('0x47')](_0x392fae);})[_0x9121('0x3a')](function(_0x466110){if(_0x466110){if(!_0x466110['name']||_0x466110[_0x9121('0x3b')]!==_0x9121('0x3c')){logger['error'](util['inspect'](_0x466110,{'showHidden':![],'depth':null}));}}});}exports[_0x9121('0x48')]=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 ea3bd93..d6c9aa1 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 _0x49eb=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','../../config/environment','../logger','redis','localhost','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format'];(function(_0x215775,_0x15bc76){var _0x2c189d=function(_0x287040){while(--_0x287040){_0x215775['push'](_0x215775['shift']());}};_0x2c189d(++_0x15bc76);}(_0x49eb,0xdf));var _0xb49e=function(_0x377196,_0x3dfc99){_0x377196=_0x377196-0x0;var _0x463fe1=_0x49eb[_0x377196];return _0x463fe1;};'use strict';var _=require('lodash');var moment=require(_0xb49e('0x0'));var Redis=require(_0xb49e('0x1'));var util=require('util');var config=require(_0xb49e('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb49e('0x3'))('schedule');config[_0xb49e('0x4')]=_['defaults'](config['redis'],{'host':_0xb49e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x84fd0e=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xb49e('0x6'))}}})[_0xb49e('0x7')](function(_0x38d1a5){if(_0x38d1a5&&_0x38d1a5[_0xb49e('0x8')]){_0x84fd0e=_['map'](_0x38d1a5||[],'id');logger[_0xb49e('0x9')](_0xb49e('0xa'),_0x84fd0e[_0xb49e('0xb')]());return db[_0xb49e('0xc')][_0xb49e('0xd')]({'closeReason':_0xb49e('0xe'),'disposition':_0xb49e('0xf'),'closed':!![],'closedAt':moment()[_0xb49e('0x10')](_0xb49e('0x11'))},{'where':{'id':_0x84fd0e}});}})['then'](function(){if(_0x84fd0e&&_0x84fd0e[_0xb49e('0x8')]){logger['info'](_0xb49e('0x12'),_0x84fd0e['join']());for(var _0x289f95=0x0;_0x289f95<_0x84fd0e[_0xb49e('0x8')];_0x289f95++){io[_0xb49e('0x13')](_0xb49e('0x14'),{'id':_0x84fd0e[_0x289f95],'closed':!![]});}}})['catch'](function(_0x1d507e){logger[_0xb49e('0x15')](_0xb49e('0x16'),_0x1d507e?util['inspect'](_0x1d507e,{'showHidden':![],'depth':null}):'');});}exports[_0xb49e('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x57e8=['redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x1b60de,_0x541ec6){var _0x5842fe=function(_0x35e674){while(--_0x35e674){_0x1b60de['push'](_0x1b60de['shift']());}};_0x5842fe(++_0x541ec6);}(_0x57e8,0xf8));var _0x857e=function(_0x794ebc,_0x4c07de){_0x794ebc=_0x794ebc-0x0;var _0x3e5970=_0x57e8[_0x794ebc];return _0x3e5970;};'use strict';var _=require(_0x857e('0x0'));var moment=require(_0x857e('0x1'));var Redis=require(_0x857e('0x2'));var util=require(_0x857e('0x3'));var config=require(_0x857e('0x4'));var db=require(_0x857e('0x5'))['db'];var logger=require(_0x857e('0x6'))(_0x857e('0x7'));config[_0x857e('0x8')]=_[_0x857e('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x857e('0xa'))(new Redis(config[_0x857e('0x8')]));function closeInteractions(){var _0x504c4a=[];return db[_0x857e('0xb')][_0x857e('0xc')]({'raw':!![],'attributes':['id',_0x857e('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x857e('0xe')](0x18,_0x857e('0xf'))}}})[_0x857e('0x10')](function(_0xe6d3d5){if(_0xe6d3d5&&_0xe6d3d5[_0x857e('0x11')]){_0x504c4a=_[_0x857e('0x12')](_0xe6d3d5||[],'id');logger[_0x857e('0x13')](_0x857e('0x14'),_0x504c4a[_0x857e('0x15')]());return db['WhatsappInteraction'][_0x857e('0x16')]({'closeReason':'system','disposition':_0x857e('0x17'),'closed':!![],'closedAt':moment()[_0x857e('0x18')](_0x857e('0x19'))},{'where':{'id':_0x504c4a}});}})[_0x857e('0x10')](function(){if(_0x504c4a&&_0x504c4a[_0x857e('0x11')]){logger[_0x857e('0x13')](_0x857e('0x1a'),_0x504c4a['join']());for(var _0x1c4c39=0x0;_0x1c4c39<_0x504c4a[_0x857e('0x11')];_0x1c4c39++){io[_0x857e('0x1b')]('whatsappInteraction:update',{'id':_0x504c4a[_0x1c4c39],'closed':!![]});}}})[_0x857e('0x1c')](function(_0x306ed7){logger[_0x857e('0x1d')](_0x857e('0x1e'),_0x306ed7?util['inspect'](_0x306ed7,{'showHidden':![],'depth':null}):'');});}exports[_0x857e('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index dbeb31e..a6bceec 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f35=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate'];(function(_0x4c27,_0x672b6b){var _0x4aee29=function(_0x5c95ca){while(--_0x5c95ca){_0x4c27['push'](_0x4c27['shift']());}};_0x4aee29(++_0x672b6b);}(_0x2f35,0x10c));var _0x52f3=function(_0x4c217f,_0x82a1ae){_0x4c217f=_0x4c217f-0x0;var _0x4033b2=_0x2f35[_0x4c217f];return _0x4033b2;};'use strict';var util=require(_0x52f3('0x0'));var db=require(_0x52f3('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x52f3('0x2')]({'id':i,'firstName':_0x52f3('0x3')+i,'lastName':_0x52f3('0x4')+i,'phone':0xf879fb460+i,'email':_0x52f3('0x5')+i+_0x52f3('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x52f3('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x52f3('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x52f3('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x52f3('0x2')]({'id':i,'firstName':_0x52f3('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x52f3('0x5')+i+_0x52f3('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x52f3('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x52f3('0x8')][_0x52f3('0x9')]({'where':{}})[_0x52f3('0xa')](function(){return db[_0x52f3('0x8')][_0x52f3('0xb')](contacts);})[_0x52f3('0xa')](function(){console[_0x52f3('0xc')](_0x52f3('0xd'),_0x52f3('0xe'));return db[_0x52f3('0xf')]['destroy']({'where':{}});})[_0x52f3('0xa')](function(){return db[_0x52f3('0xf')]['bulkCreate'](hopper);})[_0x52f3('0xa')](function(){console[_0x52f3('0xc')](_0x52f3('0xd'),_0x52f3('0x10'));return db['CmContact'][_0x52f3('0xb')](contacts2);})['then'](function(){console[_0x52f3('0xc')](_0x52f3('0xd'),_0x52f3('0x11'));return db[_0x52f3('0xf')]['bulkCreate'](hopper2);})['then'](function(){console[_0x52f3('0xc')](_0x52f3('0xd'),_0x52f3('0x12'));})[_0x52f3('0x13')](function(_0x394449){console['log'](_0x394449);}); \ No newline at end of file +var _0x894d=['log','finished\x20populating','hopper1','contacts2','catch','util','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','destroy','then','CmContact','contacts1','CmHopper','bulkCreate'];(function(_0x446b17,_0x3d0e8b){var _0x4c97a8=function(_0x10cf58){while(--_0x10cf58){_0x446b17['push'](_0x446b17['shift']());}};_0x4c97a8(++_0x3d0e8b);}(_0x894d,0xb9));var _0xd894=function(_0x48477b,_0x4b4a4d){_0x48477b=_0x48477b-0x0;var _0x422010=_0x894d[_0x48477b];return _0x422010;};'use strict';var util=require(_0xd894('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd894('0x1')]({'id':i,'firstName':_0xd894('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xd894('0x3')+i+_0xd894('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd894('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xd894('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd894('0x1')]({'id':i,'firstName':_0xd894('0x2')+i,'lastName':_0xd894('0x6')+i,'phone':0xf879fb460+i,'email':_0xd894('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd894('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd894('0x5')](),'updatedAt':Date[_0xd894('0x5')]()});}db['CmContact'][_0xd894('0x7')]({'where':{}})[_0xd894('0x8')](function(){return db[_0xd894('0x9')]['bulkCreate'](contacts);})['then'](function(){console['log']('finished\x20populating',_0xd894('0xa'));return db[_0xd894('0xb')]['destroy']({'where':{}});})['then'](function(){return db[_0xd894('0xb')][_0xd894('0xc')](hopper);})[_0xd894('0x8')](function(){console[_0xd894('0xd')](_0xd894('0xe'),_0xd894('0xf'));return db[_0xd894('0x9')][_0xd894('0xc')](contacts2);})[_0xd894('0x8')](function(){console[_0xd894('0xd')]('finished\x20populating',_0xd894('0x10'));return db[_0xd894('0xb')][_0xd894('0xc')](hopper2);})[_0xd894('0x8')](function(){console[_0xd894('0xd')](_0xd894('0xe'),'hopper2');})[_0xd894('0x11')](function(_0x2abb1b){console['log'](_0x2abb1b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 40363be..a17255e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9f1=['all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss'];(function(_0x34ddee,_0x4ba642){var _0x256bb9=function(_0x497071){while(--_0x497071){_0x34ddee['push'](_0x34ddee['shift']());}};_0x256bb9(++_0x4ba642);}(_0xd9f1,0x108));var _0x1d9f=function(_0x424584,_0x46ae3b){_0x424584=_0x424584-0x0;var _0xc835e1=_0xd9f1[_0x424584];return _0xc835e1;};'use strict';var util=require(_0x1d9f('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1d9f('0x1')]({'name':util[_0x1d9f('0x2')](_0x1d9f('0x3'),_0x1d9f('0x4'),i),'fullname':util['format'](_0x1d9f('0x3'),_0x1d9f('0x4'),i),'email':util[_0x1d9f('0x2')](_0x1d9f('0x5'),_0x1d9f('0x4'),i),'role':_0x1d9f('0x4'),'password':_0x1d9f('0x6'),'internal':0xfa0+i,'type':_0x1d9f('0x7'),'transport':['udp','ws',_0x1d9f('0x8')],'disallow':[_0x1d9f('0x9')],'allow':[_0x1d9f('0xa')],'defaultuser':util[_0x1d9f('0x2')](_0x1d9f('0x3'),_0x1d9f('0x4'),i),'encryption':_0x1d9f('0xb'),'avpf':_0x1d9f('0xb'),'force_avp':_0x1d9f('0xb'),'icesupport':_0x1d9f('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x1d9f('0xc'),'dtlsprivatekey':_0x1d9f('0xd'),'dtlssetup':_0x1d9f('0xe'),'callerid':util[_0x1d9f('0x2')]('\x22%s\x22\x20<%s>',util[_0x1d9f('0x2')](_0x1d9f('0x3'),_0x1d9f('0x4'),i),0xfa0+i)});}db[_0x1d9f('0xf')][_0x1d9f('0x10')](users)[_0x1d9f('0x11')](function(){console[_0x1d9f('0x12')](_0x1d9f('0x13'));})[_0x1d9f('0x14')](function(_0x10102d){console[_0x1d9f('0x12')](_0x10102d);}); \ No newline at end of file +var _0x8a9f=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','wss','yes'];(function(_0x3ae06b,_0x9f7d1f){var _0x440a6c=function(_0x518ded){while(--_0x518ded){_0x3ae06b['push'](_0x3ae06b['shift']());}};_0x440a6c(++_0x9f7d1f);}(_0x8a9f,0xf6));var _0xf8a9=function(_0x21aea9,_0x4cc2c3){_0x21aea9=_0x21aea9-0x0;var _0x233ea8=_0x8a9f[_0x21aea9];return _0x233ea8;};'use strict';var util=require(_0xf8a9('0x0'));var db=require(_0xf8a9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf8a9('0x2')]({'name':util[_0xf8a9('0x3')]('%s%s','agent',i),'fullname':util[_0xf8a9('0x3')](_0xf8a9('0x4'),_0xf8a9('0x5'),i),'email':util[_0xf8a9('0x3')](_0xf8a9('0x6'),_0xf8a9('0x5'),i),'role':_0xf8a9('0x5'),'password':_0xf8a9('0x7'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0xf8a9('0x8')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0xf8a9('0x4'),_0xf8a9('0x5'),i),'encryption':'yes','avpf':_0xf8a9('0x9'),'force_avp':_0xf8a9('0x9'),'icesupport':'yes','dtlsenable':_0xf8a9('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf8a9('0xa'),'dtlssetup':_0xf8a9('0xb'),'callerid':util['format'](_0xf8a9('0xc'),util[_0xf8a9('0x3')](_0xf8a9('0x4'),_0xf8a9('0x5'),i),0xfa0+i)});}db['User'][_0xf8a9('0xd')](users)[_0xf8a9('0xe')](function(){console[_0xf8a9('0xf')]('add\x20user');})['catch'](function(_0x919721){console['log'](_0x919721);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b311e34..1a6d94b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f35=['getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','SocketIO\x20','nsp','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','agent','telephone','type','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','MailQueues','findAll','Trunks','UserProfileResource','resourceId','map','User','role','Campaign','ivr','format','%s:queue:%s','user:%s','handshake','query','find','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','include','ChatQueue','push','FaxQueue','MailQueue','OpenchannelQueue','Trunk','voice:outbound','userProfileId','SmsQueues','SmsQueue','WhatsappQueues','WhatsappQueue','Telephones','IvrCampaigns'];(function(_0x278321,_0x482c67){var _0x36b70b=function(_0x3453fe){while(--_0x3453fe){_0x278321['push'](_0x278321['shift']());}};_0x36b70b(++_0x482c67);}(_0x3f35,0x1ae));var _0x53f3=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x3f35[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var BPromise=require(_0x53f3('0x2'));var db=require(_0x53f3('0x3'))['db'];var config=require(_0x53f3('0x4'));var queryQueues={'attributes':['id',_0x53f3('0x5')],'include':[{'as':_0x53f3('0x6'),'model':db['User'],'attributes':['id',_0x53f3('0x5'),'role'],'raw':!![],'where':{'role':_0x53f3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x53f3('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x53f3('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x53f3('0x5')],'where':{'role':_0x53f3('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x53f3('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4f4671,_0x4f4d45,_0x10a75b){return db[_0x53f3('0xa')][_0x53f3('0xb')]({'where':{'name':_0x4f4671,'userProfileId':_0x4f4d45},'raw':!![]})[_0x53f3('0xc')](function(_0x5ed51a){if(_0x5ed51a){if(_0x5ed51a['autoAssociation']){switch(_0x4f4671){case _0x53f3('0xd'):case _0x53f3('0xe'):case'FaxQueues':case'SmsQueues':case _0x53f3('0xf'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x10a75b][_0x53f3('0x10')](queryQueues);case'Telephones':return db[_0x10a75b]['findAll'](queryTelephones);case _0x53f3('0x11'):return db[_0x10a75b][_0x53f3('0x10')](queryTrunks);case'IvrCampaigns':return db[_0x10a75b]['findAll'](queryCampaigns);}}else{return db[_0x53f3('0x12')]['findAll']({'attributes':[_0x53f3('0x13')],'where':{'sectionId':_0x5ed51a['id']},'raw':!![]})[_0x53f3('0xc')](function(_0x27db9a){if(_0x27db9a){var _0x2319cd={'where':{'id':_[_0x53f3('0x14')](_0x27db9a,_0x53f3('0x13'))},'raw':!![]};switch(_0x10a75b){case _0x53f3('0x15'):_0x2319cd['where'][_0x53f3('0x16')]=_0x53f3('0x8');break;case _0x53f3('0x17'):_0x2319cd['where']['type']=_0x53f3('0x18');break;}return db[_0x10a75b]['findAll'](_0x2319cd);}else{return[];}});}}else{return[];}})[_0x53f3('0xc')](function(_0x276e0c){return _0x276e0c;});}function joinOrLeaveQueues(_0x58c850,_0x317d06,_0x40b26c,_0x5a4ebe){_0x58c850[_0x317d06](util[_0x53f3('0x19')](_0x53f3('0x1a'),_0x40b26c,_0x5a4ebe[_0x53f3('0x5')]));if(_0x5a4ebe[_0x53f3('0x6')]){for(var _0x36e191=0x0;_0x36e191<_0x5a4ebe[_0x53f3('0x6')]['length'];_0x36e191+=0x1){_0x58c850[_0x317d06](util[_0x53f3('0x19')](_0x53f3('0x1b'),_0x5a4ebe[_0x53f3('0x6')][_0x36e191][_0x53f3('0x5')]));}}}function joinOrLeave(_0x3dd4cb,_0x5055ce,_0x1ab104){var _0x41be9b;if(_0x3dd4cb[_0x53f3('0x1c')][_0x53f3('0x1d')]['id']){db[_0x53f3('0x15')][_0x53f3('0x1e')]({'attributes':['id','name',_0x53f3('0x16'),'userProfileId'],'where':{'id':_0x3dd4cb['handshake'][_0x53f3('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x53f3('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x20')],'as':_0x53f3('0x21'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x22')],'as':_0x53f3('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x24')],'as':_0x53f3('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x53f3('0xc')](function(_0x1ccd36){if(_0x1ccd36){_0x41be9b=_0x1ccd36;_0x3dd4cb[_0x5055ce](util[_0x53f3('0x19')](_0x53f3('0x1b'),_0x1ccd36['name']));var _0xdaa8f0=[];switch(_0x1ccd36[_0x53f3('0x16')]){case'admin':_0x3dd4cb[_0x5055ce](_0x53f3('0x27'));_0x3dd4cb[_0x5055ce]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x53f3('0x28'))){delete queryQueues[_0x53f3('0x28')];}_0xdaa8f0['push'](db['VoiceQueue'][_0x53f3('0x10')](queryQueues));_0xdaa8f0['push'](db[_0x53f3('0x29')][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db[_0x53f3('0x2b')][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db['SmsQueue']['findAll'](queryQueues));_0xdaa8f0['push'](db[_0x53f3('0x2c')][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db[_0x53f3('0x2d')]['findAll'](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db['WhatsappQueue'][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db[_0x53f3('0x15')][_0x53f3('0x10')](queryTelephones));_0xdaa8f0['push'](db[_0x53f3('0x2e')]['findAll'](queryTrunks));_0xdaa8f0[_0x53f3('0x2a')](db['Campaign']['findAll'](queryCampaigns));_0xdaa8f0['push'](db[_0x53f3('0x15')][_0x53f3('0x10')](queryAgents));break;case'user':_0x3dd4cb[_0x5055ce]('voice:inbound');_0x3dd4cb[_0x5055ce](_0x53f3('0x2f'));_0xdaa8f0['push'](getAssociatedResources(_0x53f3('0xd'),_0x1ccd36['userProfileId'],'VoiceQueue'));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources('ChatQueues',_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x29')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources('FaxQueues',_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x2b')));_0xdaa8f0['push'](getAssociatedResources(_0x53f3('0x31'),_0x1ccd36['userProfileId'],_0x53f3('0x32')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0xf'),_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x2c')));_0xdaa8f0['push'](getAssociatedResources('OpenchannelQueues',_0x1ccd36[_0x53f3('0x30')],'OpenchannelQueue'));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x33'),_0x1ccd36['userProfileId'],_0x53f3('0x34')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x35'),_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x15')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x11'),_0x1ccd36['userProfileId'],_0x53f3('0x2e')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x36'),_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x17')));_0xdaa8f0['push'](db[_0x53f3('0x15')][_0x53f3('0x10')](queryAgents));break;case _0x53f3('0x7'):_0x3dd4cb[_0x5055ce]('voice:inbound');_0x3dd4cb[_0x5055ce]('voice:outbound');_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x37')]({'attributes':['id','name']}));_0xdaa8f0['push'](_0x1ccd36[_0x53f3('0x38')]({'attributes':['id','name']}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x39')]({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x3a')]({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x3b')]({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36['getOpenchannelQueues']({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x3c')]({'attributes':['id',_0x53f3('0x5')]}));break;}return BPromise[_0x53f3('0x3d')](_0xdaa8f0);}})[_0x53f3('0xc')](function(_0x5e12aa){if(_0x5e12aa&&_0x5e12aa['length']){for(var _0x5cff13=0x0;_0x5cff13<_0x5e12aa['length'];_0x5cff13+=0x1){for(var _0xce0421=0x0;_0xce0421<_0x5e12aa[_0x5cff13][_0x53f3('0x3e')];_0xce0421+=0x1){switch(_0x5cff13){case 0x0:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x3f'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x1:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x40'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x2:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x41'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x3:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x42'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x4:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x43'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x5:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x44'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x6:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x45'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x7:if(_0x41be9b[_0x53f3('0x16')]!==_0x53f3('0x7'))_0x3dd4cb[_0x5055ce](util['format']('telephone:%s',_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;case 0x8:if(_0x41be9b[_0x53f3('0x16')]!==_0x53f3('0x7'))_0x3dd4cb[_0x5055ce](util[_0x53f3('0x19')](_0x53f3('0x46'),_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;case 0x9:if(_0x41be9b[_0x53f3('0x16')]!==_0x53f3('0x7'))_0x3dd4cb[_0x5055ce](util[_0x53f3('0x19')](_0x53f3('0x47'),_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x9')],_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;case 0xa:_0x3dd4cb[_0x5055ce](util['format'](_0x53f3('0x1b'),_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;}}}}})[_0x53f3('0xc')](function(){if(_0x5055ce==='leave'){var _0xfc6fa2=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x1f')],'id');return _0x41be9b['removeChatInteractions'](_0xfc6fa2)[_0x53f3('0xc')](function(){for(var _0x15f728=0x0;_0x15f728<_0xfc6fa2[_0x53f3('0x3e')];_0x15f728+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x49'),{'ChatInteractionId':Number(_0xfc6fa2[_0x15f728]),'UserId':Number(_0x41be9b['id'])});}});}})['then'](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0x492a17=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x21')],'id');return _0x41be9b[_0x53f3('0x4b')](_0x492a17)[_0x53f3('0xc')](function(){for(var _0x28427d=0x0;_0x28427d<_0x492a17['length'];_0x28427d+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x4c'),{'MailInteractionId':Number(_0x492a17[_0x28427d]),'UserId':Number(_0x41be9b['id'])});}});}})['then'](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0x4112bd=_['map'](_0x41be9b[_0x53f3('0x4d')],'id');return _0x41be9b[_0x53f3('0x4e')](_0x4112bd)[_0x53f3('0xc')](function(){for(var _0x1ff394=0x0;_0x1ff394<_0x4112bd[_0x53f3('0x3e')];_0x1ff394+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x4f'),{'FaxInteractionId':Number(_0x4112bd[_0x1ff394]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0xc')](function(){if(_0x5055ce==='leave'){var _0x7f773e=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x23')],'id');return _0x41be9b[_0x53f3('0x50')](_0x7f773e)[_0x53f3('0xc')](function(){for(var _0x187e56=0x0;_0x187e56<_0x7f773e[_0x53f3('0x3e')];_0x187e56+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x51'),{'SmsInteractionId':Number(_0x7f773e[_0x187e56]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0xc')](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0xe691f3=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x25')],'id');return _0x41be9b[_0x53f3('0x52')](_0xe691f3)[_0x53f3('0xc')](function(){for(var _0x23c362=0x0;_0x23c362<_0xe691f3[_0x53f3('0x3e')];_0x23c362+=0x1){_0x1ab104['emit'](_0x53f3('0x53'),{'OpenchannelInteractionId':Number(_0xe691f3[_0x23c362]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0xc')](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0x406dba=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x54')],'id');return _0x41be9b[_0x53f3('0x55')](_0x406dba)['then'](function(){for(var _0x22d7f6=0x0;_0x22d7f6<_0x406dba[_0x53f3('0x3e')];_0x22d7f6+=0x1){_0x1ab104['emit'](_0x53f3('0x56'),{'WhatsappInteractionId':Number(_0x406dba[_0x22d7f6]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0x57')](function(_0x14909d){_0x3dd4cb[_0x53f3('0x58')](_0x14909d);});}}function onDisconnect(_0x3feb9,_0x26a3f0){joinOrLeave(_0x3feb9,_0x53f3('0x4a'),_0x26a3f0);}function onConnect(_0x532648){joinOrLeave(_0x532648,_0x53f3('0x59'));}exports['default']=function(_0x1802cd){_0x1802cd['on'](_0x53f3('0x5a'),function(_0x32de53){_0x32de53['setMaxListeners'](0x0);_0x32de53[_0x53f3('0x5b')]=_0x32de53[_0x53f3('0x5c')]['connection'][_0x53f3('0x5d')]+':'+_0x32de53[_0x53f3('0x5c')][_0x53f3('0x5a')]['remotePort'];_0x32de53['connectedAt']=new Date();_0x32de53[_0x53f3('0x58')]=function(_0x2e0b07){console[_0x53f3('0x58')](_0x53f3('0x5e')+_0x32de53[_0x53f3('0x5f')][_0x53f3('0x5')]+'['+_0x32de53[_0x53f3('0x5b')]+']',_0x2e0b07);};_0x32de53['on']('disconnect',function(){onDisconnect(_0x32de53,_0x1802cd);_0x32de53['log'](_0x53f3('0x60'));});onConnect(_0x32de53);_0x32de53[_0x53f3('0x58')]('CONNECTED');});}; \ No newline at end of file +var _0xae6e=['%s:queue:%s','length','format','user:%s','query','find','userProfileId','handshake','ChatInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','WhatsappQueues','Telephones','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','map','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','name','telephone','agent','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','User','where','role','Campaign','type','ivr'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xae6e,0x1e5));var _0xeae6=function(_0x28ff9a,_0x1dec75){_0x28ff9a=_0x28ff9a-0x0;var _0x39d3f8=_0xae6e[_0x28ff9a];return _0x39d3f8;};'use strict';var _=require(_0xeae6('0x0'));var util=require(_0xeae6('0x1'));var BPromise=require(_0xeae6('0x2'));var db=require(_0xeae6('0x3'))['db'];var config=require(_0xeae6('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xeae6('0x5'),'model':db['User'],'attributes':['id',_0xeae6('0x6'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xeae6('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xeae6('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xeae6('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xeae6('0x6'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x26e909,_0x1cbf45,_0x2bb3e0){return db[_0xeae6('0x9')][_0xeae6('0xa')]({'where':{'name':_0x26e909,'userProfileId':_0x1cbf45},'raw':!![]})['then'](function(_0x23d043){if(_0x23d043){if(_0x23d043[_0xeae6('0xb')]){switch(_0x26e909){case _0xeae6('0xc'):case _0xeae6('0xd'):case _0xeae6('0xe'):case _0xeae6('0xf'):case _0xeae6('0x10'):case _0xeae6('0x11'):case'WhatsappQueues':return db[_0x2bb3e0][_0xeae6('0x12')](queryQueues);case'Telephones':return db[_0x2bb3e0]['findAll'](queryTelephones);case _0xeae6('0x13'):return db[_0x2bb3e0][_0xeae6('0x12')](queryTrunks);case _0xeae6('0x14'):return db[_0x2bb3e0][_0xeae6('0x12')](queryCampaigns);}}else{return db[_0xeae6('0x15')][_0xeae6('0x12')]({'attributes':[_0xeae6('0x16')],'where':{'sectionId':_0x23d043['id']},'raw':!![]})[_0xeae6('0x17')](function(_0x34a0e5){if(_0x34a0e5){var _0x5e5f55={'where':{'id':_['map'](_0x34a0e5,_0xeae6('0x16'))},'raw':!![]};switch(_0x2bb3e0){case _0xeae6('0x18'):_0x5e5f55[_0xeae6('0x19')][_0xeae6('0x1a')]='telephone';break;case _0xeae6('0x1b'):_0x5e5f55[_0xeae6('0x19')][_0xeae6('0x1c')]=_0xeae6('0x1d');break;}return db[_0x2bb3e0][_0xeae6('0x12')](_0x5e5f55);}else{return[];}});}}else{return[];}})[_0xeae6('0x17')](function(_0x34234d){return _0x34234d;});}function joinOrLeaveQueues(_0x120e29,_0x4d3b6c,_0x4c4a71,_0x161f81){_0x120e29[_0x4d3b6c](util['format'](_0xeae6('0x1e'),_0x4c4a71,_0x161f81[_0xeae6('0x6')]));if(_0x161f81[_0xeae6('0x5')]){for(var _0x48843c=0x0;_0x48843c<_0x161f81[_0xeae6('0x5')][_0xeae6('0x1f')];_0x48843c+=0x1){_0x120e29[_0x4d3b6c](util[_0xeae6('0x20')](_0xeae6('0x21'),_0x161f81[_0xeae6('0x5')][_0x48843c][_0xeae6('0x6')]));}}}function joinOrLeave(_0x3c4089,_0x1ed263,_0x4b8886){var _0x47c8a0;if(_0x3c4089['handshake'][_0xeae6('0x22')]['id']){db[_0xeae6('0x18')][_0xeae6('0x23')]({'attributes':['id',_0xeae6('0x6'),_0xeae6('0x1a'),_0xeae6('0x24')],'where':{'id':_0x3c4089[_0xeae6('0x25')]['query']['id']},'include':[{'model':db[_0xeae6('0x26')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xeae6('0x27')],'as':_0xeae6('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xeae6('0x29')],'as':_0xeae6('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xeae6('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xeae6('0x17')](function(_0x1f702a){if(_0x1f702a){_0x47c8a0=_0x1f702a;_0x3c4089[_0x1ed263](util['format'](_0xeae6('0x21'),_0x1f702a[_0xeae6('0x6')]));var _0x44b053=[];switch(_0x1f702a['role']){case'admin':_0x3c4089[_0x1ed263](_0xeae6('0x2c'));_0x3c4089[_0x1ed263](_0xeae6('0x2d'));if(queryQueues[_0xeae6('0x2e')](_0xeae6('0x2f'))){delete queryQueues[_0xeae6('0x2f')];}_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x31')][_0xeae6('0x12')](queryQueues));_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x32')][_0xeae6('0x12')](queryQueues));_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x33')]['findAll'](queryQueues));_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x34')][_0xeae6('0x12')](queryQueues));_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x35')][_0xeae6('0x12')](queryQueues));_0x44b053['push'](db[_0xeae6('0x36')][_0xeae6('0x12')](queryQueues));_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x37')][_0xeae6('0x12')](queryQueues));_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x18')][_0xeae6('0x12')](queryTelephones));_0x44b053[_0xeae6('0x30')](db['Trunk'][_0xeae6('0x12')](queryTrunks));_0x44b053[_0xeae6('0x30')](db[_0xeae6('0x1b')][_0xeae6('0x12')](queryCampaigns));_0x44b053['push'](db[_0xeae6('0x18')][_0xeae6('0x12')](queryAgents));break;case _0xeae6('0x38'):_0x3c4089[_0x1ed263]('voice:inbound');_0x3c4089[_0x1ed263](_0xeae6('0x2d'));_0x44b053['push'](getAssociatedResources(_0xeae6('0xc'),_0x1f702a['userProfileId'],_0xeae6('0x31')));_0x44b053[_0xeae6('0x30')](getAssociatedResources('ChatQueues',_0x1f702a[_0xeae6('0x24')],'ChatQueue'));_0x44b053['push'](getAssociatedResources(_0xeae6('0xe'),_0x1f702a[_0xeae6('0x24')],'FaxQueue'));_0x44b053[_0xeae6('0x30')](getAssociatedResources(_0xeae6('0xf'),_0x1f702a[_0xeae6('0x24')],_0xeae6('0x34')));_0x44b053[_0xeae6('0x30')](getAssociatedResources('MailQueues',_0x1f702a[_0xeae6('0x24')],_0xeae6('0x35')));_0x44b053[_0xeae6('0x30')](getAssociatedResources('OpenchannelQueues',_0x1f702a['userProfileId'],_0xeae6('0x36')));_0x44b053['push'](getAssociatedResources(_0xeae6('0x39'),_0x1f702a['userProfileId'],_0xeae6('0x37')));_0x44b053[_0xeae6('0x30')](getAssociatedResources(_0xeae6('0x3a'),_0x1f702a['userProfileId'],'User'));_0x44b053['push'](getAssociatedResources(_0xeae6('0x13'),_0x1f702a['userProfileId'],_0xeae6('0x3b')));_0x44b053[_0xeae6('0x30')](getAssociatedResources('IvrCampaigns',_0x1f702a[_0xeae6('0x24')],_0xeae6('0x1b')));_0x44b053['push'](db['User'][_0xeae6('0x12')](queryAgents));break;case'agent':_0x3c4089[_0x1ed263]('voice:inbound');_0x3c4089[_0x1ed263](_0xeae6('0x2d'));_0x44b053[_0xeae6('0x30')](_0x1f702a['getVoiceQueues']({'attributes':['id',_0xeae6('0x6')]}));_0x44b053[_0xeae6('0x30')](_0x1f702a[_0xeae6('0x3c')]({'attributes':['id',_0xeae6('0x6')]}));_0x44b053[_0xeae6('0x30')](_0x1f702a[_0xeae6('0x3d')]({'attributes':['id',_0xeae6('0x6')]}));_0x44b053[_0xeae6('0x30')](_0x1f702a[_0xeae6('0x3e')]({'attributes':['id',_0xeae6('0x6')]}));_0x44b053['push'](_0x1f702a[_0xeae6('0x3f')]({'attributes':['id',_0xeae6('0x6')]}));_0x44b053['push'](_0x1f702a[_0xeae6('0x40')]({'attributes':['id',_0xeae6('0x6')]}));_0x44b053['push'](_0x1f702a[_0xeae6('0x41')]({'attributes':['id',_0xeae6('0x6')]}));break;}return BPromise['all'](_0x44b053);}})[_0xeae6('0x17')](function(_0x5783fd){if(_0x5783fd&&_0x5783fd['length']){for(var _0x200620=0x0;_0x200620<_0x5783fd['length'];_0x200620+=0x1){for(var _0x40bd12=0x0;_0x40bd12<_0x5783fd[_0x200620][_0xeae6('0x1f')];_0x40bd12+=0x1){switch(_0x200620){case 0x0:joinOrLeaveQueues(_0x3c4089,_0x1ed263,_0xeae6('0x42'),_0x5783fd[_0x200620][_0x40bd12]);break;case 0x1:joinOrLeaveQueues(_0x3c4089,_0x1ed263,_0xeae6('0x43'),_0x5783fd[_0x200620][_0x40bd12]);break;case 0x2:joinOrLeaveQueues(_0x3c4089,_0x1ed263,_0xeae6('0x44'),_0x5783fd[_0x200620][_0x40bd12]);break;case 0x3:joinOrLeaveQueues(_0x3c4089,_0x1ed263,_0xeae6('0x45'),_0x5783fd[_0x200620][_0x40bd12]);break;case 0x4:joinOrLeaveQueues(_0x3c4089,_0x1ed263,'mail',_0x5783fd[_0x200620][_0x40bd12]);break;case 0x5:joinOrLeaveQueues(_0x3c4089,_0x1ed263,_0xeae6('0x46'),_0x5783fd[_0x200620][_0x40bd12]);break;case 0x6:joinOrLeaveQueues(_0x3c4089,_0x1ed263,_0xeae6('0x47'),_0x5783fd[_0x200620][_0x40bd12]);break;case 0x7:if(_0x47c8a0[_0xeae6('0x1a')]!=='agent')_0x3c4089[_0x1ed263](util['format'](_0xeae6('0x48'),_0x5783fd[_0x200620][_0x40bd12]['name']));break;case 0x8:if(_0x47c8a0[_0xeae6('0x1a')]!==_0xeae6('0x8'))_0x3c4089[_0x1ed263](util['format']('trunk:%s',_0x5783fd[_0x200620][_0x40bd12]['name']));break;case 0x9:if(_0x47c8a0[_0xeae6('0x1a')]!=='agent')_0x3c4089[_0x1ed263](util[_0xeae6('0x20')](_0xeae6('0x49'),_0x5783fd[_0x200620][_0x40bd12]['type'],_0x5783fd[_0x200620][_0x40bd12][_0xeae6('0x6')]));break;case 0xa:_0x3c4089[_0x1ed263](util['format'](_0xeae6('0x21'),_0x5783fd[_0x200620][_0x40bd12][_0xeae6('0x6')]));break;}}}}})[_0xeae6('0x17')](function(){if(_0x1ed263===_0xeae6('0x4a')){var _0x3bee3a=_['map'](_0x47c8a0[_0xeae6('0x4b')],'id');return _0x47c8a0[_0xeae6('0x4c')](_0x3bee3a)[_0xeae6('0x17')](function(){for(var _0x13ffe2=0x0;_0x13ffe2<_0x3bee3a[_0xeae6('0x1f')];_0x13ffe2+=0x1){_0x4b8886[_0xeae6('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3bee3a[_0x13ffe2]),'UserId':Number(_0x47c8a0['id'])});}});}})[_0xeae6('0x17')](function(){if(_0x1ed263===_0xeae6('0x4a')){var _0x227aee=_[_0xeae6('0x4e')](_0x47c8a0[_0xeae6('0x4f')],'id');return _0x47c8a0[_0xeae6('0x50')](_0x227aee)[_0xeae6('0x17')](function(){for(var _0x1d0547=0x0;_0x1d0547<_0x227aee[_0xeae6('0x1f')];_0x1d0547+=0x1){_0x4b8886[_0xeae6('0x4d')](_0xeae6('0x51'),{'MailInteractionId':Number(_0x227aee[_0x1d0547]),'UserId':Number(_0x47c8a0['id'])});}});}})['then'](function(){if(_0x1ed263===_0xeae6('0x4a')){var _0x430865=_[_0xeae6('0x4e')](_0x47c8a0[_0xeae6('0x28')],'id');return _0x47c8a0['removeFaxInteractions'](_0x430865)[_0xeae6('0x17')](function(){for(var _0x450d06=0x0;_0x450d06<_0x430865[_0xeae6('0x1f')];_0x450d06+=0x1){_0x4b8886[_0xeae6('0x4d')](_0xeae6('0x52'),{'FaxInteractionId':Number(_0x430865[_0x450d06]),'UserId':Number(_0x47c8a0['id'])});}});}})['then'](function(){if(_0x1ed263===_0xeae6('0x4a')){var _0x297419=_[_0xeae6('0x4e')](_0x47c8a0[_0xeae6('0x2a')],'id');return _0x47c8a0[_0xeae6('0x53')](_0x297419)[_0xeae6('0x17')](function(){for(var _0xffa3d4=0x0;_0xffa3d4<_0x297419[_0xeae6('0x1f')];_0xffa3d4+=0x1){_0x4b8886[_0xeae6('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x297419[_0xffa3d4]),'UserId':Number(_0x47c8a0['id'])});}});}})[_0xeae6('0x17')](function(){if(_0x1ed263===_0xeae6('0x4a')){var _0x39d0aa=_[_0xeae6('0x4e')](_0x47c8a0[_0xeae6('0x54')],'id');return _0x47c8a0[_0xeae6('0x55')](_0x39d0aa)[_0xeae6('0x17')](function(){for(var _0x287b30=0x0;_0x287b30<_0x39d0aa[_0xeae6('0x1f')];_0x287b30+=0x1){_0x4b8886['emit'](_0xeae6('0x56'),{'OpenchannelInteractionId':Number(_0x39d0aa[_0x287b30]),'UserId':Number(_0x47c8a0['id'])});}});}})['then'](function(){if(_0x1ed263===_0xeae6('0x4a')){var _0x53df66=_['map'](_0x47c8a0['WhatsappInteractions'],'id');return _0x47c8a0[_0xeae6('0x57')](_0x53df66)[_0xeae6('0x17')](function(){for(var _0xfd8606=0x0;_0xfd8606<_0x53df66[_0xeae6('0x1f')];_0xfd8606+=0x1){_0x4b8886[_0xeae6('0x4d')](_0xeae6('0x58'),{'WhatsappInteractionId':Number(_0x53df66[_0xfd8606]),'UserId':Number(_0x47c8a0['id'])});}});}})[_0xeae6('0x59')](function(_0x59f8c3){_0x3c4089[_0xeae6('0x5a')](_0x59f8c3);});}}function onDisconnect(_0x3b6709,_0x271202){joinOrLeave(_0x3b6709,_0xeae6('0x4a'),_0x271202);}function onConnect(_0x317660){joinOrLeave(_0x317660,_0xeae6('0x5b'));}exports[_0xeae6('0x5c')]=function(_0x233a08){_0x233a08['on'](_0xeae6('0x5d'),function(_0x46bc3a){_0x46bc3a['setMaxListeners'](0x0);_0x46bc3a[_0xeae6('0x5e')]=_0x46bc3a[_0xeae6('0x5f')][_0xeae6('0x5d')][_0xeae6('0x60')]+':'+_0x46bc3a[_0xeae6('0x5f')][_0xeae6('0x5d')][_0xeae6('0x61')];_0x46bc3a[_0xeae6('0x62')]=new Date();_0x46bc3a[_0xeae6('0x5a')]=function(_0x5a7916){console['log'](_0xeae6('0x63')+_0x46bc3a[_0xeae6('0x64')][_0xeae6('0x6')]+'['+_0x46bc3a['address']+']',_0x5a7916);};_0x46bc3a['on'](_0xeae6('0x65'),function(){onDisconnect(_0x46bc3a,_0x233a08);_0x46bc3a[_0xeae6('0x5a')](_0xeae6('0x66'));});onConnect(_0x46bc3a);_0x46bc3a[_0xeae6('0x5a')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f36def7..9b890f1 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 _0xaba9=['motionChannel','event','direction','resolve','then','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','undefined','interface','format','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','contact','AfterCreate','changed','closed','substatus','AfterUpdate','find','internal','hasOwnProperty','model','callback','condition','util','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','Sms','newinteraction','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','get'];(function(_0x30b8b5,_0x290adc){var _0x5e1369=function(_0x5c7c53){while(--_0x5c7c53){_0x30b8b5['push'](_0x30b8b5['shift']());}};_0x5e1369(++_0x290adc);}(_0xaba9,0x1d5));var _0x9aba=function(_0x592cc7,_0x5849b5){_0x592cc7=_0x592cc7-0x0;var _0x4f2d52=_0xaba9[_0x592cc7];return _0x4f2d52;};'use strict';var util=require(_0x9aba('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x9aba('0x1'));var logger=require(_0x9aba('0x2'))(_0x9aba('0x3'));var client=jayson[_0x9aba('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x9aba('0x5'),'model':_0x9aba('0x6'),'event':_0x9aba('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9aba('0x5'),'model':'ChatInteraction','event':_0x9aba('0x8'),'condition':_0x9aba('0x9'),'callback':afterUpdate},{'channel':_0x9aba('0x5'),'model':'ChatMessage','event':_0x9aba('0x7'),'condition':_0x9aba('0xa'),'callback':afterCreateMessage},{'channel':_0x9aba('0x5'),'model':_0x9aba('0xb'),'event':_0x9aba('0x7'),'condition':_0x9aba('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x9aba('0xc'),'model':'SmsInteraction','event':_0x9aba('0x7'),'condition':_0x9aba('0xd'),'callback':afterCreate},{'channel':_0x9aba('0xc'),'model':_0x9aba('0xe'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9aba('0xc'),'model':_0x9aba('0xf'),'event':_0x9aba('0x7'),'condition':_0x9aba('0xa'),'callback':afterCreateMessage},{'channel':_0x9aba('0x10'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0x9aba('0xd'),'callback':afterCreate},{'channel':_0x9aba('0x10'),'model':_0x9aba('0x11'),'event':_0x9aba('0x8'),'condition':_0x9aba('0x9'),'callback':afterUpdate},{'channel':_0x9aba('0x10'),'model':_0x9aba('0x12'),'event':_0x9aba('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9aba('0x13'),'model':'FaxInteraction','event':_0x9aba('0x7'),'condition':_0x9aba('0xd'),'callback':afterCreate},{'channel':_0x9aba('0x13'),'model':'FaxInteraction','event':_0x9aba('0x8'),'condition':_0x9aba('0x9'),'callback':afterUpdate},{'channel':_0x9aba('0x13'),'model':_0x9aba('0x14'),'event':_0x9aba('0x7'),'condition':_0x9aba('0xa'),'callback':afterCreateMessage},{'channel':_0x9aba('0x15'),'model':'MailInteraction','event':_0x9aba('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9aba('0x15'),'model':_0x9aba('0x16'),'event':_0x9aba('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9aba('0x15'),'model':_0x9aba('0x17'),'event':_0x9aba('0x7'),'condition':_0x9aba('0xa'),'callback':afterCreateMessage},{'channel':_0x9aba('0x18'),'model':_0x9aba('0x19'),'event':'afterCreate','condition':_0x9aba('0xd'),'callback':afterCreate},{'channel':'Openchannel','model':_0x9aba('0x19'),'event':_0x9aba('0x8'),'condition':_0x9aba('0x9'),'callback':afterUpdate},{'channel':_0x9aba('0x18'),'model':_0x9aba('0x1a'),'event':_0x9aba('0x7'),'condition':_0x9aba('0xa'),'callback':afterCreateMessage}];function request(_0x5f3a41){return client[_0x9aba('0x1b')](_0x9aba('0x1c'),_0x5f3a41)['then'](function(_0x3bfe2a){logger[_0x9aba('0x1d')](_0x9aba('0x1e'),_0x9aba('0x1c'),_0x3bfe2a);if(_0x3bfe2a[_0x9aba('0x1f')]){if(_0x3bfe2a['error'][_0x9aba('0x20')]===0x1f4){logger[_0x9aba('0x1f')](_0x9aba('0x1e'),'EventManager',_0x3bfe2a[_0x9aba('0x1f')]);}}})[_0x9aba('0x21')](function(_0x1994c7){logger[_0x9aba('0x1f')](_0x9aba('0x1e'),_0x9aba('0x1c'),_0x1994c7);});}function afterCreateMessage(_0x40490f){return function(_0x18c84a){_0x18c84a=_0x18c84a[_0x9aba('0x22')]({'plain':!![]});_0x18c84a['channel']=_0x40490f;_0x18c84a[_0x9aba('0x23')]=_0x40490f;_0x18c84a[_0x9aba('0x24')]=_0x18c84a[_0x9aba('0x25')];Promise[_0x9aba('0x26')]()[_0x9aba('0x27')](function(){if(typeof _0x18c84a[_0x9aba('0x28')]==='undefined')return null;var _0x10f3cd=_0x9aba('0x29')+_0x18c84a[_0x9aba('0x28')];return db[_0x9aba('0x2a')][_0x9aba('0x2b')](_0x10f3cd,{'type':db[_0x9aba('0x2c')][_0x9aba('0x2d')][_0x9aba('0x2e')],'raw':!![]});})['then'](function(_0x87cfa0){if(_0x87cfa0){_0x18c84a['contact']=_0x87cfa0[0x0];}if(typeof _0x18c84a[_0x9aba('0x2f')]===_0x9aba('0x30'))return;return getAgent(_0x18c84a['UserId']);})[_0x9aba('0x27')](function(_0x1d1433){if(_0x1d1433){_0x18c84a[_0x9aba('0x31')]=util[_0x9aba('0x32')](_0x9aba('0x33'),_0x1d1433[_0x9aba('0x34')]);_0x18c84a[_0x9aba('0x35')]=_0x1d1433;_0x18c84a[_0x9aba('0x36')]=_0x40490f;return request({'event':_0x9aba('0x37'),'message':_0x18c84a});}else{return request({'event':_0x9aba('0x38'),'message':_0x18c84a});}})[_0x9aba('0x21')](function(_0x3c9868){logger[_0x9aba('0x1f')](_0x9aba('0x1e'),_0x9aba('0x39'),_0x3c9868);});};}function afterCreateOfflineMessage(_0x5057cc){return function(_0x229ea7){_0x229ea7=_0x229ea7['get']({'plain':!![]});_0x229ea7[_0x9aba('0x36')]=_0x5057cc;_0x229ea7['motionChannel']=_0x5057cc;_0x229ea7[_0x9aba('0x24')]=_0x9aba('0x3a');return request({'event':_0x229ea7[_0x9aba('0x24')],'message':_0x229ea7});};}function afterCreate(_0x2004c0,_0x258d27){return function(_0x26df75){_0x26df75=_0x26df75['get']({'plain':!![]});_0x26df75[_0x9aba('0x36')]=_0x2004c0;_0x26df75[_0x9aba('0x23')]=_0x2004c0;_0x26df75[_0x9aba('0x24')]=_0x9aba('0x3b');Promise[_0x9aba('0x26')]()['then'](function(){var _0x5f0164=_0x9aba('0x29')+_0x26df75[_0x9aba('0x28')];return db['sequelize'][_0x9aba('0x2b')](_0x5f0164,{'type':db[_0x9aba('0x2c')][_0x9aba('0x2d')][_0x9aba('0x2e')],'raw':!![]});})[_0x9aba('0x27')](function(_0x79f3bf){if(_0x79f3bf){_0x26df75[_0x9aba('0x3c')]=_0x79f3bf[0x0];}if(typeof _0x26df75[_0x9aba('0x2f')]===_0x9aba('0x30'))return;return getAgent(_0x26df75[_0x9aba('0x2f')]);})['then'](function(_0x4a0917){if(_0x4a0917){_0x26df75['interface']=util[_0x9aba('0x32')](_0x9aba('0x33'),_0x4a0917[_0x9aba('0x34')]);_0x26df75[_0x9aba('0x35')]=_0x4a0917;}return request({'event':_0x258d27,'message':_0x26df75});})[_0x9aba('0x21')](function(_0x3180a9){logger['error'](_0x9aba('0x1e'),_0x9aba('0x3d'),_0x3180a9);});};}function afterUpdate(_0x37512e){return function(_0x3c7544){var _0x1edd8a=_0x3c7544[_0x9aba('0x3e')](_0x9aba('0x3f'))&&_0x3c7544[_0x9aba('0x3f')];var _0x14feab=_0x3c7544['changed']('substatus');if(_0x1edd8a||_0x14feab){var _0x4da97a=_0x1edd8a?_0x9aba('0x9'):'substatus';var _0x4bc24c=_0x3c7544[_0x9aba('0x22')]({'plain':!![]});_0x4bc24c[_0x9aba('0x36')]=_0x37512e;_0x4bc24c[_0x9aba('0x23')]=_0x37512e;_0x4bc24c[_0x9aba('0x24')]=_0x1edd8a?_0x9aba('0x3f'):_0x9aba('0x40');var _0x3aa7f8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4bc24c[_0x9aba('0x28')];return db[_0x9aba('0x2a')][_0x9aba('0x2b')](_0x3aa7f8,{'type':db[_0x9aba('0x2c')][_0x9aba('0x2d')][_0x9aba('0x2e')],'raw':!![]})[_0x9aba('0x27')](function(_0x5dc170){if(_0x5dc170){_0x4bc24c[_0x9aba('0x3c')]=_0x5dc170[0x0];}if(typeof _0x4bc24c[_0x9aba('0x2f')]===_0x9aba('0x30'))return;return getAgent(_0x4bc24c[_0x9aba('0x2f')]);})[_0x9aba('0x27')](function(_0x132994){if(_0x132994){_0x4bc24c[_0x9aba('0x31')]=util[_0x9aba('0x32')](_0x9aba('0x33'),_0x132994[_0x9aba('0x34')]);_0x4bc24c[_0x9aba('0x35')]=_0x132994;}return request({'event':_0x4da97a,'message':_0x4bc24c});})[_0x9aba('0x21')](function(_0x211807){logger['error'](_0x9aba('0x1e'),_0x9aba('0x41'),_0x211807);});}};}function getAgent(_0x4cf08d){return db['User'][_0x9aba('0x42')]({'where':{'id':_0x4cf08d},'attributes':['id',_0x9aba('0x34'),'fullname','email',_0x9aba('0x43')],'raw':!![]})[_0x9aba('0x27')](function(_0x1a8cef){return _0x1a8cef;});}exports['default']=function(){for(var _0x30e539=0x0;_0x30e539=_0x36f857[_0x7717('0x14')]){throw Error(_0x7717('0x15'));}_0x408027(_0x3098b5);})[_0x7717('0x16')](function(_0x2ef7bc){_0x2346c3(_0x2ef7bc);});});}; \ No newline at end of file +var _0x4bbd=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User'];(function(_0x3db2ef,_0xa75d3b){var _0x1ddf8a=function(_0x567c8f){while(--_0x567c8f){_0x3db2ef['push'](_0x3db2ef['shift']());}};_0x1ddf8a(++_0xa75d3b);}(_0x4bbd,0x101));var _0xd4bb=function(_0x5a5b5b,_0x115077){_0x5a5b5b=_0x5a5b5b-0x0;var _0xc27395=_0x4bbd[_0x5a5b5b];return _0xc27395;};'use strict';var _=require('lodash');var BPromise=require(_0xd4bb('0x0'));var db=require(_0xd4bb('0x1'))['db'];var util=require(_0xd4bb('0x2'));var channels=[_0xd4bb('0x3'),_0xd4bb('0x4'),_0xd4bb('0x5'),_0xd4bb('0x6'),_0xd4bb('0x7'),'whatsapp',_0xd4bb('0x8')];exports['getChannels']=function(){return channels;};exports[_0xd4bb('0x9')]=function(_0x352cc9){_0x352cc9=_0x352cc9[_0xd4bb('0xa')]();return _[_0xd4bb('0xb')](channels,_0x352cc9);};exports[_0xd4bb('0xc')]=function(_0x2c9c89,_0x479f57,_0x1b60b6,_0x3db21d){var _0x1eaff0={'loginAttempts':_0x479f57,'blocked':_0x1b60b6};if(!_[_0xd4bb('0xd')](_0x3db21d)){_0x1eaff0[_0xd4bb('0xe')]=_0x3db21d;}return _0x2c9c89[_0xd4bb('0xf')](_0x1eaff0);};exports[_0xd4bb('0x10')]=function(_0x1e84fc){return new BPromise(function(_0x54ee20,_0x2965f5){var _0xc464e=0x0;if(_0x1e84fc['role']!==_0xd4bb('0x11')){_0x54ee20(_0x1e84fc);}db[_0xd4bb('0x12')][_0xd4bb('0x13')]({'where':{'role':_0xd4bb('0x11'),'online':!![],'id':{'$ne':_0x1e84fc['id']}}})[_0xd4bb('0x14')](function(_0x3ea5a7){_0xc464e=_0x3ea5a7;return util[_0xd4bb('0x10')]();})[_0xd4bb('0x14')](function(_0xedd2cd){if(_0xedd2cd&&_0xedd2cd['agents']&&_0xc464e>=_0xedd2cd[_0xd4bb('0x15')]){throw Error(_0xd4bb('0x16'));}_0x54ee20(_0x1e84fc);})['catch'](function(_0x239a67){_0x2965f5(_0x239a67);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 01123cb..0ce1700 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf44f=['render','json','exports','404','status'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf44f,0x138));var _0xff44=function(_0x5967d0,_0x29d201){_0x5967d0=_0x5967d0-0x0;var _0x28c4fa=_0xf44f[_0x5967d0];return _0x28c4fa;};'use strict';module[_0xff44('0x0')][0x194]=function pageNotFound(_0x254414,_0x348df8){var _0x66d672=_0xff44('0x1');var _0x37716d=0x194;var _0x4e0e8a={'status':_0x37716d};_0x348df8[_0xff44('0x2')](_0x4e0e8a[_0xff44('0x2')]);_0x348df8[_0xff44('0x3')](_0x66d672,{},function(_0x3c4e99,_0x54019b){if(_0x3c4e99){return _0x348df8[_0xff44('0x2')](_0x4e0e8a[_0xff44('0x2')])[_0xff44('0x4')](_0x4e0e8a);}_0x348df8['send'](_0x54019b);});}; \ No newline at end of file +var _0x662c=['404','render','status','send'];(function(_0x24487f,_0x9b3ea0){var _0x456456=function(_0x2ba373){while(--_0x2ba373){_0x24487f['push'](_0x24487f['shift']());}};_0x456456(++_0x9b3ea0);}(_0x662c,0x1e4));var _0xc662=function(_0x176e3b,_0x3a3e71){_0x176e3b=_0x176e3b-0x0;var _0x4a05bf=_0x662c[_0x176e3b];return _0x4a05bf;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1e1cb8,_0x372d36){var _0x46e32c=_0xc662('0x0');var _0x39effa=0x194;var _0xa1387d={'status':_0x39effa};_0x372d36['status'](_0xa1387d['status']);_0x372d36[_0xc662('0x1')](_0x46e32c,{},function(_0xac1676,_0x537d7a){if(_0xac1676){return _0x372d36[_0xc662('0x2')](_0xa1387d[_0xc662('0x2')])['json'](_0xa1387d);}_0x372d36[_0xc662('0x3')](_0x537d7a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3f5e28f..d25b449 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f09=['user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueue','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Messages','TemplateId','team_has_mail_queues','Teams','MailMessage','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachment','Attachments','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','List','ListId','Items','FaxAccountId','Interactions','Exntensions','FaxMessage','Agents','user_has_fax_accounts','fax_interaction_has_tags','Tags','FaxInteractionId','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','Interaction','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','HopperHistories','Company','CompanyId','cm_contact_has_tags','Queue','CampaignId','Automation','Condition','All','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','AllConditions','TriggerAllId','AnyCondition','TriggerId','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','SalesforceField','Descriptions','DescriptionId','FieldId','SubjectId','Description','Field','VariableId','SugarcrmField','Subject','DeskConfiguration','ZohoConfiguration','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','FromId','ToId','SessionId','ProjectId','MailQueues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappAccount','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','name','utf8','utf8_general_ci','sequelizeHistory','mysql','utf8mb4','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','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','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','UserId','userSetting','VoiceRecording','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','ChatGroup','Groups','chat_group_has_users','belongsToMany','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x7f09,0xd4));var _0x97f0=function(_0x2c38c6,_0x40d959){_0x2c38c6=_0x2c38c6-0x0;var _0x5b61b8=_0x7f09[_0x2c38c6];return _0x5b61b8;};'use strict';var config=require(_0x97f0('0x0'));var Sequelize=require(_0x97f0('0x1'));var _=require(_0x97f0('0x2'));var jstz=require(_0x97f0('0x3'));var timezone=jstz[_0x97f0('0x4')]();config['sequelize']=_[_0x97f0('0x5')](config[_0x97f0('0x1')],{'database':_0x97f0('0x6'),'username':_0x97f0('0x7'),'password':_0x97f0('0x8'),'options':{'host':_0x97f0('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x97f0('0xa')](),'define':{'charset':_0x97f0('0xb'),'collate':_0x97f0('0xc')}}});config[_0x97f0('0xd')]=_[_0x97f0('0x5')](config[_0x97f0('0xd')],{'database':_0x97f0('0x6'),'username':_0x97f0('0x7'),'password':_0x97f0('0x8'),'options':{'host':_0x97f0('0x9'),'port':0xcea,'dialect':_0x97f0('0xe'),'dialectOptions':{'charset':_0x97f0('0xf')},'logging':![],'timezone':timezone[_0x97f0('0xa')](),'define':{'charset':_0x97f0('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x97f0('0x1')][_0x97f0('0x10')],config[_0x97f0('0x1')][_0x97f0('0x11')],config['sequelize'][_0x97f0('0x12')],config[_0x97f0('0x1')][_0x97f0('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x97f0('0xd')]['database'],config[_0x97f0('0xd')][_0x97f0('0x11')],config[_0x97f0('0xd')]['password'],config[_0x97f0('0xd')][_0x97f0('0x13')])};db[_0x97f0('0x14')]=db[_0x97f0('0x1')]['import']('../api/user/user.model');db[_0x97f0('0x15')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x17'));db[_0x97f0('0x18')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x19'));db[_0x97f0('0x1a')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x1b'));db[_0x97f0('0x1c')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x97f0('0x1d')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x1e'));db['VoiceRecording']=db[_0x97f0('0x1')]['import'](_0x97f0('0x1f'));db['ScreenRecording']=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x20'));db['VoiceMailMessage']=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x97f0('0x21')]=db[_0x97f0('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x97f0('0x22')]=db['sequelize'][_0x97f0('0x16')]('../api/voiceDialReport/voiceDialReport.model');db[_0x97f0('0x23')]=db['sequelize']['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x97f0('0x24')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x25'));db[_0x97f0('0x26')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x27'));db[_0x97f0('0x28')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x29'));db[_0x97f0('0x2a')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x2b'));db[_0x97f0('0x2c')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x2d'));db[_0x97f0('0x2e')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x2f'));db[_0x97f0('0x30')]=db['sequelize'][_0x97f0('0x16')]('../api/userChatQueue/userChatQueue.model');db[_0x97f0('0x31')]=db['sequelize'][_0x97f0('0x16')]('../api/userMailQueue/userMailQueue.model');db[_0x97f0('0x32')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x33'));db[_0x97f0('0x34')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x35'));db[_0x97f0('0x36')]=db['sequelize'][_0x97f0('0x16')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0x97f0('0x1')]['import'](_0x97f0('0x37'));db[_0x97f0('0x38')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x39'));db[_0x97f0('0x3a')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x3b'));db['MailAccount']=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x3c'));db[_0x97f0('0x3d')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x3e'));db['MailSubstatus']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x3f'));db[_0x97f0('0x40')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x41'));db['MailMessage']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x42'));db[_0x97f0('0x43')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x44'));db[_0x97f0('0x45')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x46'));db[_0x97f0('0x47')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x48'));db[_0x97f0('0x49')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/dashboardItem/dashboardItem.model');db[_0x97f0('0x4a')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x4b'));db[_0x97f0('0x4c')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x4d'));db[_0x97f0('0x4e')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/faxMessage/faxMessage.model');db[_0x97f0('0x4f')]=db[_0x97f0('0x1')]['import']('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x50'));db[_0x97f0('0x51')]=db[_0x97f0('0x1')]['import']('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x97f0('0x1')]['import'](_0x97f0('0x52'));db[_0x97f0('0x53')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x54'));db[_0x97f0('0x55')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x56'));db[_0x97f0('0x57')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x58'));db[_0x97f0('0x59')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x5a'));db['OpenchannelInteraction']=db['sequelize']['import'](_0x97f0('0x5b'));db[_0x97f0('0x5c')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x5d'));db[_0x97f0('0x5e')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x5f'));db[_0x97f0('0x60')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x61'));db[_0x97f0('0x62')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x63'));db[_0x97f0('0x64')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x65'));db['ChatInteraction']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x66'));db[_0x97f0('0x67')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x68'));db['ChatOfflineMessage']=db['sequelize'][_0x97f0('0x16')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/chatGroup/chatGroup.model');db[_0x97f0('0x69')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x6a'));db[_0x97f0('0x6b')]=db[_0x97f0('0x1')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/cmContact/cmContact.model');db[_0x97f0('0x6c')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x6d'));db['CmHopperBlack']=db['sequelize'][_0x97f0('0x16')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x97f0('0x6e')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x6f'));db[_0x97f0('0x70')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x71'));db[_0x97f0('0x72')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x97f0('0x73')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x74'));db[_0x97f0('0x75')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x76'));db['Automation']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x77'));db[_0x97f0('0x78')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x79'));db[_0x97f0('0x7a')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x7b'));db['Condition']=db[_0x97f0('0x1')]['import'](_0x97f0('0x7c'));db[_0x97f0('0x7d')]=db['sequelize']['import'](_0x97f0('0x7e'));db['Pause']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x7f'));db[_0x97f0('0x80')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/cdr/cdr.model');db[_0x97f0('0x81')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x82'));db[_0x97f0('0x83')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x84'));db[_0x97f0('0x85')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/sound/sound.model');db[_0x97f0('0x86')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/tag/tag.model');db[_0x97f0('0x87')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x88'));db[_0x97f0('0x89')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x8a'));db[_0x97f0('0x8b')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x8c'));db['Integration']=db[_0x97f0('0x1')]['import'](_0x97f0('0x8d'));db[_0x97f0('0x8e')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x8f'));db[_0x97f0('0x90')]=db['sequelize'][_0x97f0('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x97f0('0x91')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x92'));db[_0x97f0('0x93')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x97f0('0x94')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/analyticMetric/analyticMetric.model');db[_0x97f0('0x95')]=db[_0x97f0('0x1')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x97f0('0x96')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x97f0('0x97')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x98'));db[_0x97f0('0x99')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x9a'));db['SalesforceField']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x9b'));db[_0x97f0('0x9c')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x9d'));db[_0x97f0('0x9e')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x9f'));db['SugarcrmField']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xa0'));db[_0x97f0('0xa1')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xa2'));db['DeskConfiguration']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xa3'));db[_0x97f0('0xa4')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xa5'));db[_0x97f0('0xa6')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xa7'));db[_0x97f0('0xa8')]=db['sequelize']['import']('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xa9'));db[_0x97f0('0xaa')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xab'));db[_0x97f0('0xac')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xad'));db[_0x97f0('0xae')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x97f0('0xaf')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xb0'));db[_0x97f0('0xb1')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xb2'));db['VtigerAccount']=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xb3'));db[_0x97f0('0xb4')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xb5'));db['VtigerField']=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xb6'));db[_0x97f0('0xb7')]=db[_0x97f0('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x97f0('0xb8')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xb9'));db[_0x97f0('0xba')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xbb'));db[_0x97f0('0xbc')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xbd'));db[_0x97f0('0xbe')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xbf'));db[_0x97f0('0xc0')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xc1'));db[_0x97f0('0xc2')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xc3'));db[_0x97f0('0xc4')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xc5'));db[_0x97f0('0xc6')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xc7'));db[_0x97f0('0xc8')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x8d'));db[_0x97f0('0xc9')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xca'));db[_0x97f0('0xcb')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xcc'));db[_0x97f0('0xcd')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xce'));db[_0x97f0('0xcf')]=db[_0x97f0('0x1')]['import'](_0x97f0('0xd0'));db[_0x97f0('0xd1')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xd2'));db[_0x97f0('0xd3')]=db[_0x97f0('0x1')]['import'](_0x97f0('0xd4'));db[_0x97f0('0xd5')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xd6'));db[_0x97f0('0xd7')]=db['sequelize']['import'](_0x97f0('0xd8'));db[_0x97f0('0xd9')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xda'));db[_0x97f0('0xdb')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xdc'));db[_0x97f0('0xdd')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xde'));db[_0x97f0('0xdf')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/squareOdbc/squareOdbc.model');db[_0x97f0('0xe0')]=db[_0x97f0('0x1')]['import'](_0x97f0('0xe1'));db[_0x97f0('0xe2')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xe3'));db[_0x97f0('0xe4')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xe5'));db['Team']=db[_0x97f0('0x1')]['import'](_0x97f0('0xe6'));db[_0x97f0('0xe7')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/license/license.model');db[_0x97f0('0xe8')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xe9'));db['Migration']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xea'));db['Attachment']=db['sequelize'][_0x97f0('0x16')]('../api/attachment/attachment.model');db['Plugin']=db['sequelize'][_0x97f0('0x16')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize']['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xeb'));db[_0x97f0('0xec')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xed'));db[_0x97f0('0xee')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x97f0('0xef')]=db['sequelize']['import'](_0x97f0('0xf0'));db[_0x97f0('0xf1')]=db[_0x97f0('0x1')]['import'](_0x97f0('0xf2'));db[_0x97f0('0xf3')]=db['sequelize'][_0x97f0('0x16')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xf4'));db['UserProfileSection']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xf5'));db['UserProfileResource']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xf6'));db['UserNotification']=db[_0x97f0('0x1')]['import'](_0x97f0('0xf7'));db['WhatsappAccount']=db[_0x97f0('0x1')]['import'](_0x97f0('0xf8'));db['WhatsappApplication']=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xf9'));db[_0x97f0('0xfa')]=db[_0x97f0('0x1')][_0x97f0('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x97f0('0xfb')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0xfc'));db[_0x97f0('0xfd')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0xfe'));db[_0x97f0('0xff')]=db[_0x97f0('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x100'));db[_0x97f0('0x101')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x102'));db[_0x97f0('0x103')]=db['sequelize'][_0x97f0('0x16')](_0x97f0('0x104'));db[_0x97f0('0x105')]=db[_0x97f0('0x1')]['import'](_0x97f0('0x106'));db[_0x97f0('0x107')]=db['sequelize']['import'](_0x97f0('0x108'));db[_0x97f0('0x109')]=db[_0x97f0('0x1')][_0x97f0('0x16')](_0x97f0('0x10a'));db['User'][_0x97f0('0x10b')](db[_0x97f0('0x10c')],{'as':_0x97f0('0x10c'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x10b')](db[_0x97f0('0x109')],{'as':_0x97f0('0x10f'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')]['hasMany'](db[_0x97f0('0x110')],{'as':_0x97f0('0x111'),'foreignKey':_0x97f0('0x10e')});db['User'][_0x97f0('0x112')](db['UserVoiceQueueRt'],{'as':_0x97f0('0x113'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db[_0x97f0('0x1a')],{'as':_0x97f0('0x114'),'onDelete':_0x97f0('0x10d'),'hooks':!![]});db[_0x97f0('0x14')][_0x97f0('0x112')](db[_0x97f0('0x6e')],{'as':_0x97f0('0x115'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')]['hasMany'](db[_0x97f0('0x70')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x97f0('0x14')][_0x97f0('0x112')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db[_0x97f0('0x116')],{'as':_0x97f0('0x117'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db[_0x97f0('0x118')],{'as':_0x97f0('0x119'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db[_0x97f0('0x53')],{'as':_0x97f0('0x11a'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db['WhatsappInteraction'],{'as':_0x97f0('0x11b'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x14')][_0x97f0('0x112')](db['UserNotification'],{'as':_0x97f0('0x11c'),'foreignKey':_0x97f0('0x11d')});db[_0x97f0('0x14')][_0x97f0('0x11e')](db[_0x97f0('0x11f')],{'as':_0x97f0('0x11f'),'foreignKey':'userProfileId'});db['User']['belongsToMany'](db[_0x97f0('0x120')],{'as':_0x97f0('0x121'),'through':_0x97f0('0x122')});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x124')],{'as':_0x97f0('0x125'),'through':_0x97f0('0x126')});db[_0x97f0('0x14')]['belongsToMany'](db[_0x97f0('0xf1')],{'as':_0x97f0('0x127'),'through':_0x97f0('0x128')});db['User'][_0x97f0('0x123')](db[_0x97f0('0x129')],{'through':_0x97f0('0x12a')});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x40')],{'as':_0x97f0('0x12b'),'through':_0x97f0('0x12c')});db[_0x97f0('0x14')][_0x97f0('0x123')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x97f0('0x12d')});db[_0x97f0('0x14')][_0x97f0('0x123')](db['FaxInteraction'],{'as':_0x97f0('0x12e'),'through':_0x97f0('0x12f')});db['User'][_0x97f0('0x123')](db['SmsInteraction'],{'as':_0x97f0('0x11a'),'through':_0x97f0('0x130')});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x116')],{'as':_0x97f0('0x117'),'through':'user_has_openchannel_interactions'});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0xfa')],{'as':_0x97f0('0x11b'),'through':_0x97f0('0x131')});db[_0x97f0('0x14')][_0x97f0('0x123')](db['VoiceQueue'],{'as':_0x97f0('0x132'),'through':'UserVoiceQueue','required':![]});db[_0x97f0('0x14')]['belongsToMany'](db[_0x97f0('0xf3')],{'as':_0x97f0('0x133'),'through':_0x97f0('0x107'),'required':![]});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x3d')],{'as':'MailQueues','through':_0x97f0('0x31'),'required':![]});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x134')],{'as':_0x97f0('0x135'),'through':_0x97f0('0x30'),'required':![],'hooks':!![]});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x4f')],{'as':_0x97f0('0x136'),'through':'UserFaxQueue','required':![]});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x137')],{'as':_0x97f0('0x138'),'through':_0x97f0('0x34'),'required':![]});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x5e')],{'as':_0x97f0('0x139'),'through':'UserOpenchannelQueue','required':![]});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x13a')],{'as':_0x97f0('0x13b'),'through':_0x97f0('0x13c'),'required':![]});db[_0x97f0('0x14')][_0x97f0('0x123')](db['CmList'],{'through':_0x97f0('0x128')});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x60')],{'as':'ChatWebsites','through':_0x97f0('0x13d')});db['User'][_0x97f0('0x123')](db[_0x97f0('0x4a')],{'as':_0x97f0('0x13e'),'through':'user_has_fax_accounts'});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x13f')],{'as':_0x97f0('0x140'),'through':_0x97f0('0x141')});db[_0x97f0('0x14')][_0x97f0('0x123')](db[_0x97f0('0x57')],{'as':_0x97f0('0x142'),'through':_0x97f0('0x143')});db['User'][_0x97f0('0x123')](db[_0x97f0('0x51')],{'as':_0x97f0('0x144'),'through':_0x97f0('0x145')});db[_0x97f0('0x14')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x97f0('0x146'),'through':_0x97f0('0x147')});db[_0x97f0('0x14')]['belongsToMany'](db[_0x97f0('0xe0')],{'as':_0x97f0('0x148'),'through':_0x97f0('0x149')});db[_0x97f0('0x15')][_0x97f0('0x112')](db[_0x97f0('0x1a')],{'as':'SpiedAgents','onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x14a')});db[_0x97f0('0x18')][_0x97f0('0x112')](db[_0x97f0('0x1a')],{'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x1a')][_0x97f0('0x112')](db['VoiceExtension'],{'as':_0x97f0('0x14b'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x1c')][_0x97f0('0x123')](db[_0x97f0('0x85')],{'as':_0x97f0('0x14c'),'through':_0x97f0('0x14d')});db[_0x97f0('0x1d')][_0x97f0('0x112')](db[_0x97f0('0x2c')],{'as':_0x97f0('0x14e'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x97f0('0x112')](db[_0x97f0('0x6c')],{'as':_0x97f0('0x14f'),'foreignKey':'VoiceQueueId'});db[_0x97f0('0x1d')][_0x97f0('0x112')](db[_0x97f0('0x6e')],{'as':_0x97f0('0x115'),'foreignKey':_0x97f0('0x150')});db['VoiceQueue'][_0x97f0('0x112')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x97f0('0x150')});db[_0x97f0('0x1d')][_0x97f0('0x112')](db[_0x97f0('0x72')],{'as':_0x97f0('0x72'),'foreignKey':_0x97f0('0x150')});db[_0x97f0('0x1d')][_0x97f0('0x112')](db[_0x97f0('0x151')],{'as':_0x97f0('0x152'),'foreignKey':_0x97f0('0x150')});db['VoiceQueue'][_0x97f0('0x112')](db[_0x97f0('0xd3')],{'as':_0x97f0('0x153'),'foreignKey':_0x97f0('0x150')});db[_0x97f0('0x1d')][_0x97f0('0x11e')](db[_0x97f0('0x28')],{'as':_0x97f0('0x28'),'foreignKey':_0x97f0('0x154')});db['VoiceQueue'][_0x97f0('0x11e')](db[_0x97f0('0x28')],{'as':'TrunkBackup','foreignKey':_0x97f0('0x155')});db[_0x97f0('0x1d')][_0x97f0('0x11e')](db[_0x97f0('0x7d')],{'as':_0x97f0('0x7d'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0x1d')][_0x97f0('0x11e')](db[_0x97f0('0x157')],{'as':_0x97f0('0x158'),'foreignKey':_0x97f0('0x159')});db[_0x97f0('0x1d')][_0x97f0('0x123')](db['CmList'],{'as':_0x97f0('0x127'),'through':_0x97f0('0x15a')});db[_0x97f0('0x1d')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x97f0('0x1d')][_0x97f0('0x123')](db[_0x97f0('0x129')],{'as':'Teams','through':_0x97f0('0x103')});db['VoiceQueue'][_0x97f0('0x123')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x15b'),'through':_0x97f0('0x15c')});db[_0x97f0('0x110')]['belongsTo'](db[_0x97f0('0x14')],{'as':_0x97f0('0x14'),'foreignKey':'UserId'});db[_0x97f0('0x15d')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x14'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x10c')][_0x97f0('0x112')](db[_0x97f0('0x15e')],{'as':'Messages','onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x15f'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0x97f0('0x15f'),'targetKey':_0x97f0('0x160')});db['VoiceCallReport']['hasMany'](db[_0x97f0('0x24')],{'as':_0x97f0('0x161'),'foreignKey':_0x97f0('0x162'),'constraints':![]});db[_0x97f0('0x21')][_0x97f0('0x112')](db['VoiceAgentReport'],{'as':_0x97f0('0x163'),'foreignKey':_0x97f0('0x162'),'constraints':![]});db[_0x97f0('0x21')][_0x97f0('0x11e')](db['User'],{'as':_0x97f0('0x14'),'foreignKey':'UserId'});db[_0x97f0('0x21')][_0x97f0('0x11e')](db['CmContact'],{'as':_0x97f0('0x164'),'foreignKey':'ContactId'});db[_0x97f0('0x38')][_0x97f0('0x11e')](db[_0x97f0('0x13f')],{'as':'MailAccount','foreignKey':_0x97f0('0x165')});db[_0x97f0('0x38')][_0x97f0('0x11e')](db['CloudProvider'],{'as':_0x97f0('0x101'),'foreignKey':_0x97f0('0x166'),'onDelete':_0x97f0('0x167')});db['MailServerOut'][_0x97f0('0x11e')](db[_0x97f0('0x13f')],{'as':_0x97f0('0x13f'),'foreignKey':_0x97f0('0x165')});db[_0x97f0('0x3a')][_0x97f0('0x11e')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x97f0('0x166'),'onDelete':'restrict'});db[_0x97f0('0x13f')][_0x97f0('0x10b')](db[_0x97f0('0x38')],{'as':_0x97f0('0x168'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x13f')]['hasOne'](db[_0x97f0('0x3a')],{'as':_0x97f0('0x169'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db['Disposition'],{'as':_0x97f0('0x16a'),'foreignKey':_0x97f0('0x165'),'onDelete':'cascade'});db[_0x97f0('0x13f')][_0x97f0('0x112')](db[_0x97f0('0x78')],{'as':_0x97f0('0x16b'),'foreignKey':'MailAccountId'});db[_0x97f0('0x13f')][_0x97f0('0x112')](db['MailMessage'],{'as':_0x97f0('0x16c'),'foreignKey':'MailAccountId'});db[_0x97f0('0x13f')]['hasMany'](db[_0x97f0('0x40')],{'as':'Interactions'});db[_0x97f0('0x13f')][_0x97f0('0x112')](db[_0x97f0('0x43')],{'as':_0x97f0('0x14b')});db['MailAccount'][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':'List','foreignKey':'ListId'});db[_0x97f0('0x13f')]['belongsTo'](db['Template'],{'as':_0x97f0('0x87'),'foreignKey':_0x97f0('0x16d')});db['MailAccount'][_0x97f0('0x11e')](db[_0x97f0('0x157')],{'as':'mandatoryDispositionPause','foreignKey':_0x97f0('0x159')});db[_0x97f0('0x13f')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':'Agents','through':_0x97f0('0x141')});db['MailQueue'][_0x97f0('0x123')](db['User'],{'as':'Agents','through':_0x97f0('0x31')});db[_0x97f0('0x3d')][_0x97f0('0x123')](db[_0x97f0('0x129')],{'through':_0x97f0('0x16e'),'as':_0x97f0('0x16f')});db[_0x97f0('0x40')]['hasMany'](db[_0x97f0('0x170')],{'as':_0x97f0('0x16c'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x171')});db[_0x97f0('0x40')]['belongsTo'](db[_0x97f0('0x13f')],{'as':_0x97f0('0x172'),'foreignKey':'MailAccountId'});db[_0x97f0('0x40')][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'as':'Contact','foreignKey':_0x97f0('0x173')});db[_0x97f0('0x40')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x174'),'foreignKey':'UserId'});db[_0x97f0('0x40')][_0x97f0('0x123')](db['Tag'],{'through':_0x97f0('0x175'),'as':'Tags'});db[_0x97f0('0x40')][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':_0x97f0('0x175'),'as':_0x97f0('0x176')});db[_0x97f0('0x40')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x177'),'through':_0x97f0('0x12c'),'foreignKey':_0x97f0('0x171')});db['MailMessage'][_0x97f0('0x112')](db[_0x97f0('0x178')],{'as':_0x97f0('0x179'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x170')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x14')});db[_0x97f0('0x170')][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x164')});db[_0x97f0('0x170')][_0x97f0('0x11e')](db[_0x97f0('0x40')],{'as':'Interaction','foreignKey':_0x97f0('0x171')});db[_0x97f0('0x170')][_0x97f0('0x11e')](db[_0x97f0('0x13f')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x165')});db[_0x97f0('0x170')][_0x97f0('0x11e')](db[_0x97f0('0x60')],{'as':_0x97f0('0x60'),'foreignKey':_0x97f0('0x17a')});db[_0x97f0('0x170')][_0x97f0('0x11e')](db[_0x97f0('0x17b')],{'as':_0x97f0('0x17b'),'foreignKey':_0x97f0('0x17c')});db[_0x97f0('0x43')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':_0x97f0('0x167')});db['MailApplication']['belongsTo'](db[_0x97f0('0x3d')],{'onDelete':_0x97f0('0x167')});db['MailApplication'][_0x97f0('0x11e')](db[_0x97f0('0x13f')],{'onDelete':_0x97f0('0x167')});db[_0x97f0('0x43')]['belongsTo'](db[_0x97f0('0x7d')],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0x43')][_0x97f0('0x11e')](db[_0x97f0('0x86')],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x17d')});db['MailQueueReport'][_0x97f0('0x11e')](db['MailAccount'],{});db[_0x97f0('0x45')]['belongsTo'](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f')});db[_0x97f0('0x45')]['belongsTo'](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':'ContactId'});db[_0x97f0('0x45')][_0x97f0('0x11e')](db[_0x97f0('0x40')],{});db[_0x97f0('0x45')]['belongsTo'](db['MailMessage'],{});db[_0x97f0('0x45')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{});db[_0x97f0('0x45')][_0x97f0('0x11e')](db[_0x97f0('0x3d')],{});db['Dashboard']['hasMany'](db[_0x97f0('0x49')],{'as':_0x97f0('0x180'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x4a')][_0x97f0('0x112')](db[_0x97f0('0x7a')],{'as':_0x97f0('0x16a'),'foreignKey':_0x97f0('0x181'),'onDelete':'cascade'});db['FaxAccount'][_0x97f0('0x112')](db[_0x97f0('0x78')],{'as':_0x97f0('0x16b'),'foreignKey':_0x97f0('0x181')});db['FaxAccount'][_0x97f0('0x112')](db[_0x97f0('0x4e')],{'as':_0x97f0('0x182')});db['FaxAccount'][_0x97f0('0x112')](db[_0x97f0('0x4c')],{'as':_0x97f0('0x14b')});db[_0x97f0('0x4a')][_0x97f0('0x112')](db[_0x97f0('0x1a')],{'as':_0x97f0('0x183'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x4a')][_0x97f0('0x112')](db[_0x97f0('0x184')],{'as':_0x97f0('0x16c')});db[_0x97f0('0x4a')][_0x97f0('0x11e')](db[_0x97f0('0x28')],{'as':_0x97f0('0x28')});db[_0x97f0('0x4a')][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':'ListId'});db[_0x97f0('0x4a')][_0x97f0('0x11e')](db[_0x97f0('0x157')],{'as':_0x97f0('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x97f0('0x4a')]['belongsToMany'](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':_0x97f0('0x186')});db[_0x97f0('0x4c')][_0x97f0('0x11e')](db['User'],{'onDelete':_0x97f0('0x167')});db['FaxApplication']['belongsTo'](db[_0x97f0('0x4f')],{'onDelete':_0x97f0('0x167')});db[_0x97f0('0x4c')][_0x97f0('0x11e')](db[_0x97f0('0x4a')],{'onDelete':_0x97f0('0x167')});db[_0x97f0('0x4c')]['belongsTo'](db[_0x97f0('0x86')],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x17d')});db[_0x97f0('0x4e')][_0x97f0('0x112')](db['FaxMessage'],{'as':_0x97f0('0x16c'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0x97f0('0x4e')][_0x97f0('0x11e')](db['FaxAccount'],{'as':_0x97f0('0x172'),'foreignKey':'FaxAccountId'});db[_0x97f0('0x4e')][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db[_0x97f0('0x4e')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x174'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x4e')][_0x97f0('0x123')](db['Tag'],{'through':_0x97f0('0x187'),'as':_0x97f0('0x188')});db['FaxInteraction'][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':'fax_interaction_has_tags','as':_0x97f0('0x176')});db[_0x97f0('0x4e')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x177'),'through':'user_has_fax_interactions','foreignKey':_0x97f0('0x189')});db[_0x97f0('0x184')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x14')});db[_0x97f0('0x184')][_0x97f0('0x11e')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x97f0('0x184')]['belongsTo'](db['CmContact'],{'onDelete':_0x97f0('0x10d'),'as':'Contact'});db['FaxMessage'][_0x97f0('0x11e')](db['Attachment'],{'as':'Attachment','foreignKey':_0x97f0('0x18a')});db['FaxMessage']['belongsTo'](db[_0x97f0('0x4a')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x181')});db[_0x97f0('0x4f')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':_0x97f0('0x32')});db[_0x97f0('0x4f')]['belongsToMany'](db[_0x97f0('0x129')],{'through':_0x97f0('0x18b'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x97f0('0x4a')],{});db['FaxQueueReport'][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':'List','foreignKey':_0x97f0('0x17f')});db[_0x97f0('0x18c')]['belongsTo'](db[_0x97f0('0x124')],{'as':'Contact','foreignKey':_0x97f0('0x173')});db[_0x97f0('0x18c')]['belongsTo'](db[_0x97f0('0x4e')],{});db[_0x97f0('0x18c')][_0x97f0('0x11e')](db[_0x97f0('0x184')],{});db[_0x97f0('0x18c')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{});db[_0x97f0('0x18c')]['belongsTo'](db[_0x97f0('0x4f')],{});db[_0x97f0('0x51')][_0x97f0('0x112')](db['Disposition'],{'as':_0x97f0('0x16a'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x97f0('0x51')][_0x97f0('0x112')](db[_0x97f0('0x78')],{'as':_0x97f0('0x16b'),'foreignKey':'SmsAccountId'});db[_0x97f0('0x51')]['hasMany'](db['SmsMessage'],{'as':'Messages','foreignKey':_0x97f0('0x18d')});db[_0x97f0('0x51')]['hasMany'](db['SmsInteraction'],{'as':_0x97f0('0x182')});db['SmsAccount'][_0x97f0('0x112')](db[_0x97f0('0x18e')],{'as':_0x97f0('0x14b')});db[_0x97f0('0x51')][_0x97f0('0x11e')](db['CmList'],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f')});db[_0x97f0('0x51')][_0x97f0('0x11e')](db[_0x97f0('0x157')],{'as':'mandatoryDispositionPause','foreignKey':_0x97f0('0x159')});db[_0x97f0('0x51')][_0x97f0('0x123')](db['User'],{'as':_0x97f0('0x185'),'through':_0x97f0('0x145')});db[_0x97f0('0x18e')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':_0x97f0('0x167')});db[_0x97f0('0x18e')]['belongsTo'](db[_0x97f0('0x137')],{'onDelete':_0x97f0('0x167')});db['SmsApplication'][_0x97f0('0x11e')](db[_0x97f0('0x51')],{'onDelete':'restrict'});db[_0x97f0('0x18e')][_0x97f0('0x11e')](db[_0x97f0('0x7d')],{'onDelete':_0x97f0('0x167'),'foreignKey':'IntervalId'});db[_0x97f0('0x18e')]['belongsTo'](db[_0x97f0('0x86')],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x17d')});db[_0x97f0('0x53')]['hasMany'](db['SmsMessage'],{'as':_0x97f0('0x16c'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x18f')});db[_0x97f0('0x53')][_0x97f0('0x11e')](db[_0x97f0('0x51')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x18d')});db[_0x97f0('0x53')]['belongsTo'](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db['SmsInteraction'][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x174'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x53')][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':_0x97f0('0x190'),'as':'Tags'});db[_0x97f0('0x53')][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x97f0('0x53')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x177'),'through':_0x97f0('0x130'),'foreignKey':_0x97f0('0x18f')});db[_0x97f0('0x55')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':'User'});db[_0x97f0('0x55')]['belongsTo'](db[_0x97f0('0x124')],{'onDelete':'cascade','as':_0x97f0('0x164')});db[_0x97f0('0x55')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x191'),'foreignKey':_0x97f0('0x18f')});db['SmsMessage'][_0x97f0('0x11e')](db[_0x97f0('0x51')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x18d')});db[_0x97f0('0x137')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':_0x97f0('0x34'),'foreignKey':'SmsQueueId'});db[_0x97f0('0x137')][_0x97f0('0x123')](db['Team'],{'through':_0x97f0('0x192'),'as':_0x97f0('0x16f')});db[_0x97f0('0x57')]['hasMany'](db[_0x97f0('0x7a')],{'as':_0x97f0('0x16a'),'foreignKey':_0x97f0('0x193'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x57')][_0x97f0('0x112')](db[_0x97f0('0x78')],{'as':_0x97f0('0x16b'),'foreignKey':_0x97f0('0x193')});db[_0x97f0('0x57')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x97f0('0x112')](db[_0x97f0('0x5c')],{'as':_0x97f0('0x16c'),'foreignKey':_0x97f0('0x193')});db[_0x97f0('0x57')][_0x97f0('0x112')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x97f0('0x193')});db[_0x97f0('0x57')]['belongsTo'](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f')});db[_0x97f0('0x57')]['belongsTo'](db['Pause'],{'as':_0x97f0('0x158'),'foreignKey':_0x97f0('0x159')});db['OpenchannelAccount'][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':'user_has_openchannel_accounts'});db[_0x97f0('0x59')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':'restrict'});db[_0x97f0('0x59')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x194')});db[_0x97f0('0x59')]['belongsTo'](db[_0x97f0('0x57')],{'onDelete':_0x97f0('0x167'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x97f0('0x11e')](db[_0x97f0('0x7d')],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0x59')][_0x97f0('0x11e')](db[_0x97f0('0x86')],{'onDelete':_0x97f0('0x167'),'foreignKey':'TagId'});db[_0x97f0('0x116')][_0x97f0('0x112')](db[_0x97f0('0x5c')],{'as':_0x97f0('0x16c'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x195')});db[_0x97f0('0x116')][_0x97f0('0x11e')](db[_0x97f0('0x57')],{'as':'Account','foreignKey':_0x97f0('0x193')});db[_0x97f0('0x116')][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'as':'Contact','foreignKey':_0x97f0('0x173')});db[_0x97f0('0x116')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x174'),'foreignKey':_0x97f0('0x10e')});db['OpenchannelInteraction'][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':_0x97f0('0x196'),'as':_0x97f0('0x188')});db[_0x97f0('0x116')][_0x97f0('0x123')](db['Tag'],{'through':_0x97f0('0x196'),'as':_0x97f0('0x176')});db[_0x97f0('0x116')]['belongsToMany'](db['User'],{'as':_0x97f0('0x177'),'through':_0x97f0('0x197'),'foreignKey':'OpenchannelInteractionId'});db[_0x97f0('0x5c')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x14')});db[_0x97f0('0x5c')][_0x97f0('0x11e')](db['CmContact'],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x164')});db[_0x97f0('0x5c')][_0x97f0('0x11e')](db[_0x97f0('0x116')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x191'),'foreignKey':_0x97f0('0x195')});db[_0x97f0('0x5c')]['belongsTo'](db[_0x97f0('0x178')],{'as':'Attachment','foreignKey':_0x97f0('0x18a')});db[_0x97f0('0x5c')]['belongsTo'](db[_0x97f0('0x57')],{'as':'Account','foreignKey':_0x97f0('0x193')});db[_0x97f0('0x5e')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':_0x97f0('0x36'),'foreignKey':_0x97f0('0x194')});db[_0x97f0('0x5e')][_0x97f0('0x123')](db[_0x97f0('0x129')],{'through':_0x97f0('0x198'),'as':_0x97f0('0x16f')});db[_0x97f0('0x60')][_0x97f0('0x112')](db[_0x97f0('0x7a')],{'as':_0x97f0('0x16a'),'foreignKey':'ChatWebsiteId','onDelete':_0x97f0('0x10d')});db[_0x97f0('0x60')]['hasMany'](db[_0x97f0('0x78')],{'as':_0x97f0('0x16b'),'foreignKey':_0x97f0('0x17a')});db[_0x97f0('0x60')][_0x97f0('0x112')](db['ChatProactiveAction'],{'as':_0x97f0('0x199')});db[_0x97f0('0x60')][_0x97f0('0x112')](db[_0x97f0('0x118')],{'as':_0x97f0('0x182')});db['ChatWebsite'][_0x97f0('0x112')](db[_0x97f0('0x64')],{'as':_0x97f0('0x14b')});db[_0x97f0('0x60')][_0x97f0('0x112')](db[_0x97f0('0x67')],{'as':_0x97f0('0x16c')});db[_0x97f0('0x60')][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f')});db['ChatWebsite'][_0x97f0('0x11e')](db[_0x97f0('0x7d')],{'as':'Interval','foreignKey':_0x97f0('0x156')});db['ChatWebsite'][_0x97f0('0x11e')](db[_0x97f0('0x13f')],{'as':_0x97f0('0x13f'),'foreignKey':_0x97f0('0x165')});db[_0x97f0('0x60')][_0x97f0('0x11e')](db[_0x97f0('0x157')],{'as':_0x97f0('0x158'),'foreignKey':_0x97f0('0x159')});db[_0x97f0('0x60')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':_0x97f0('0x13d')});db[_0x97f0('0x62')]['belongsTo'](db[_0x97f0('0x57')],{});db[_0x97f0('0x62')][_0x97f0('0x11e')](db['CmList'],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f')});db['OpenchannelQueueReport'][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db[_0x97f0('0x62')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x97f0('0x62')][_0x97f0('0x11e')](db[_0x97f0('0x5c')],{});db[_0x97f0('0x62')][_0x97f0('0x11e')](db['User'],{});db[_0x97f0('0x62')][_0x97f0('0x11e')](db[_0x97f0('0x5e')],{});db['ChatApplication'][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x19a'),'foreignKey':'UserId','onDelete':_0x97f0('0x167')});db[_0x97f0('0x64')]['belongsTo'](db[_0x97f0('0x134')],{'as':'Queue','foreignKey':_0x97f0('0x19b'),'onDelete':_0x97f0('0x167')});db['ChatApplication'][_0x97f0('0x11e')](db[_0x97f0('0x60')],{'as':_0x97f0('0x19c'),'foreignKey':_0x97f0('0x17a'),'onDelete':_0x97f0('0x167')});db[_0x97f0('0x64')][_0x97f0('0x11e')](db['Tag'],{'onDelete':_0x97f0('0x167'),'foreignKey':'TagId'});db[_0x97f0('0x118')][_0x97f0('0x112')](db[_0x97f0('0x67')],{'as':'Messages','onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x19d')});db[_0x97f0('0x118')][_0x97f0('0x11e')](db['ChatWebsite'],{'as':_0x97f0('0x172'),'foreignKey':'ChatWebsiteId'});db[_0x97f0('0x118')]['belongsTo'](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db[_0x97f0('0x118')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x174'),'foreignKey':_0x97f0('0x10e')});db['ChatInteraction'][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':_0x97f0('0x19e'),'as':'Tags'});db[_0x97f0('0x118')][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':'chat_interaction_has_tags','as':_0x97f0('0x176')});db[_0x97f0('0x118')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x177'),'through':_0x97f0('0x12d'),'foreignKey':_0x97f0('0x19d')});db[_0x97f0('0x67')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x14')});db[_0x97f0('0x67')]['belongsTo'](db[_0x97f0('0x124')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db['ChatMessage'][_0x97f0('0x11e')](db[_0x97f0('0x118')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x191'),'foreignKey':_0x97f0('0x19d')});db[_0x97f0('0x67')][_0x97f0('0x11e')](db[_0x97f0('0x178')],{'as':_0x97f0('0x178'),'foreignKey':_0x97f0('0x18a')});db[_0x97f0('0x67')]['belongsTo'](db[_0x97f0('0x60')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x17a')});db[_0x97f0('0x17b')][_0x97f0('0x112')](db[_0x97f0('0x178')],{'as':_0x97f0('0x179'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x97f0('0x10d'),'hooks':!![]});db['ChatOfflineMessage'][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db['ChatOfflineMessage'][_0x97f0('0x11e')](db[_0x97f0('0x60')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x17a')});db[_0x97f0('0x134')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':_0x97f0('0x30'),'hooks':!![]});db[_0x97f0('0x134')][_0x97f0('0x123')](db[_0x97f0('0x129')],{'through':_0x97f0('0x19f'),'as':_0x97f0('0x16f')});db[_0x97f0('0x120')]['hasMany'](db[_0x97f0('0xcd')],{'as':'Messages','foreignKey':_0x97f0('0x1a0'),'onDelete':_0x97f0('0x10d')});db['ChatGroup'][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x14e'),'through':_0x97f0('0x122')});db[_0x97f0('0x69')]['belongsTo'](db[_0x97f0('0x60')],{'as':_0x97f0('0x19c'),'foreignKey':_0x97f0('0x17a')});db[_0x97f0('0x6b')][_0x97f0('0x112')](db[_0x97f0('0x124')],{'as':_0x97f0('0x125'),'foreignKey':'CompanyId'});db[_0x97f0('0x124')]['hasMany'](db['CmHopper'],{'as':_0x97f0('0x14f'),'foreignKey':'ContactId'});db[_0x97f0('0x124')]['hasMany'](db[_0x97f0('0x6e')],{'as':_0x97f0('0x115'),'foreignKey':_0x97f0('0x173')});db['CmContact'][_0x97f0('0x112')](db[_0x97f0('0x70')],{'as':_0x97f0('0x1a1'),'foreignKey':_0x97f0('0x173')});db[_0x97f0('0x124')][_0x97f0('0x112')](db[_0x97f0('0x72')],{'as':_0x97f0('0x72'),'foreignKey':_0x97f0('0x173')});db[_0x97f0('0x124')][_0x97f0('0x112')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x97f0('0x124')][_0x97f0('0x112')](db[_0x97f0('0x116')],{'as':_0x97f0('0x117'),'foreignKey':_0x97f0('0x173'),'onDelete':'restrict'});db[_0x97f0('0x124')][_0x97f0('0x112')](db[_0x97f0('0x118')],{'as':'ChatInteractions','foreignKey':_0x97f0('0x173'),'onDelete':'restrict'});db[_0x97f0('0x124')][_0x97f0('0x112')](db[_0x97f0('0x53')],{'as':_0x97f0('0x11a'),'foreignKey':_0x97f0('0x173'),'onDelete':_0x97f0('0x167')});db['CmContact'][_0x97f0('0x112')](db[_0x97f0('0x4e')],{'as':_0x97f0('0x12e'),'foreignKey':_0x97f0('0x173'),'onDelete':_0x97f0('0x167')});db[_0x97f0('0x124')]['hasMany'](db[_0x97f0('0x40')],{'as':'MailInteractions','foreignKey':_0x97f0('0x173'),'onDelete':'restrict'});db[_0x97f0('0x124')][_0x97f0('0x11e')](db['CmCompany'],{'as':_0x97f0('0x1a2'),'foreignKey':_0x97f0('0x1a3')});db[_0x97f0('0x124')][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f'),'onDelete':'cascade'});db[_0x97f0('0x124')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x177'),'through':_0x97f0('0x126')});db[_0x97f0('0x124')][_0x97f0('0x123')](db['Tag'],{'as':_0x97f0('0x188'),'through':_0x97f0('0x1a4')});db['CmContact'][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':_0x97f0('0x1a4'),'as':'ThroughTags'});db[_0x97f0('0x6c')][_0x97f0('0x11e')](db['CmContact'],{'as':'Contact','foreignKey':_0x97f0('0x173'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x6c')][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f'),'onDelete':'cascade'});db[_0x97f0('0x6c')][_0x97f0('0x11e')](db['User'],{'as':_0x97f0('0x19a'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0x6c')]['belongsTo'](db[_0x97f0('0x1d')],{'as':_0x97f0('0x1a5'),'foreignKey':_0x97f0('0x150'),'onDelete':_0x97f0('0x10d')});db['CmHopper'][_0x97f0('0x11e')](db['Campaign'],{'as':_0x97f0('0xe8'),'foreignKey':_0x97f0('0x1a6'),'onDelete':_0x97f0('0x10d')});db['CmHopper'][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':_0x97f0('0x174'),'foreignKey':'OwnerId'});db[_0x97f0('0x151')][_0x97f0('0x11e')](db['CmContact'],{'as':'Contact','foreignKey':_0x97f0('0x173'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x151')][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f'),'onDelete':_0x97f0('0x10d')});db['CmHopperBlack'][_0x97f0('0x11e')](db[_0x97f0('0x1d')],{'as':_0x97f0('0x1a5'),'foreignKey':_0x97f0('0x150'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x151')][_0x97f0('0x11e')](db[_0x97f0('0xe8')],{'as':_0x97f0('0xe8'),'foreignKey':_0x97f0('0x1a6'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x1a7')][_0x97f0('0x112')](db[_0x97f0('0x1a8')],{'as':{'plural':_0x97f0('0x1a9'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x97f0('0x10d'),'hooks':!![]});db[_0x97f0('0x1a7')][_0x97f0('0x112')](db[_0x97f0('0x1a8')],{'as':{'plural':'Any','singular':_0x97f0('0x1aa')},'foreignKey':_0x97f0('0x1ab'),'onDelete':_0x97f0('0x10d'),'hooks':!![]});db[_0x97f0('0x1a7')]['hasMany'](db[_0x97f0('0x75')],{'as':_0x97f0('0x1ac'),'foreignKey':_0x97f0('0x1ad'),'onDelete':_0x97f0('0x10d'),'hooks':!![]});db[_0x97f0('0x7a')][_0x97f0('0x112')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x97f0('0x1ae'),'onDelete':'cascade'});db['Interval'][_0x97f0('0x112')](db[_0x97f0('0x7d')],{'as':_0x97f0('0x1af'),'foreignKey':'IntervalId','onDelete':_0x97f0('0x10d'),'hooks':!![],'required':![]});db[_0x97f0('0x7d')][_0x97f0('0x112')](db['VoiceExtension'],{'as':_0x97f0('0x114'),'foreignKey':_0x97f0('0x156'),'onDelete':_0x97f0('0x167')});db[_0x97f0('0x7d')][_0x97f0('0x112')](db[_0x97f0('0x43')],{'as':_0x97f0('0x1b0'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0x7d')][_0x97f0('0x112')](db[_0x97f0('0x64')],{'as':'ChatApplications','foreignKey':_0x97f0('0x156')});db['Interval'][_0x97f0('0x112')](db[_0x97f0('0x4c')],{'as':_0x97f0('0x1b1'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0x7d')][_0x97f0('0x112')](db[_0x97f0('0x18e')],{'as':_0x97f0('0x1b2'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0x83')][_0x97f0('0x11e')](db['MailAccount'],{});db[_0x97f0('0x83')][_0x97f0('0x11e')](db[_0x97f0('0x91')],{'foreignKey':_0x97f0('0x1b3')});db[_0x97f0('0x83')][_0x97f0('0x11e')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x97f0('0x85')][_0x97f0('0x123')](db[_0x97f0('0x1c')],{'as':'Mohs','through':_0x97f0('0x14d'),'onDelete':_0x97f0('0x167')});db['Tag'][_0x97f0('0x123')](db['CmContact'],{'through':_0x97f0('0x1a4')});db['Tag'][_0x97f0('0x123')](db[_0x97f0('0x118')],{'through':_0x97f0('0x19e')});db[_0x97f0('0x86')][_0x97f0('0x123')](db[_0x97f0('0x40')],{'through':'mail_interaction_has_tags'});db[_0x97f0('0x86')]['belongsToMany'](db[_0x97f0('0x53')],{'through':_0x97f0('0x190')});db[_0x97f0('0x86')][_0x97f0('0x123')](db[_0x97f0('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x97f0('0x86')][_0x97f0('0x123')](db[_0x97f0('0x116')],{'through':_0x97f0('0x196')});db[_0x97f0('0x86')][_0x97f0('0x123')](db[_0x97f0('0xfa')],{'through':'whatsapp_interaction_has_tags'});db[_0x97f0('0x89')][_0x97f0('0x112')](db[_0x97f0('0x1a8')],{'as':{'plural':_0x97f0('0x1b4'),'singular':'AllCondition'},'foreignKey':_0x97f0('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0x97f0('0x89')][_0x97f0('0x112')](db[_0x97f0('0x1a8')],{'as':{'plural':'AnyConditions','singular':_0x97f0('0x1b6')},'foreignKey':'TriggerAnyId','onDelete':_0x97f0('0x10d'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0x97f0('0x1b7'),'onDelete':_0x97f0('0x10d'),'hooks':!![]});db[_0x97f0('0x90')]['hasMany'](db[_0x97f0('0x95')],{'as':_0x97f0('0x1b8'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1b9'),'hooks':!![]});db[_0x97f0('0x91')][_0x97f0('0x112')](db[_0x97f0('0x95')],{'as':_0x97f0('0x1b8'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1b3')});db['AnalyticMetric'][_0x97f0('0x112')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x97f0('0x10d'),'foreignKey':'MetricId'});db[_0x97f0('0x95')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x97f0('0x1ba')});db[_0x97f0('0x97')][_0x97f0('0x112')](db[_0x97f0('0x99')],{'as':_0x97f0('0x1bb'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0x99')]['hasMany'](db['SalesforceField'],{'as':_0x97f0('0x1bd'),'onDelete':_0x97f0('0x10d'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x97f0('0x112')](db[_0x97f0('0x1be')],{'as':_0x97f0('0x1bf'),'onDelete':'cascade','foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0x99')]['hasMany'](db[_0x97f0('0x1be')],{'as':_0x97f0('0x1b8'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0x99')][_0x97f0('0x11e')](db['SalesforceAccount'],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0x1be')][_0x97f0('0x112')](db[_0x97f0('0x1be')],{'as':'Subject','foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0x1be')][_0x97f0('0x112')](db['SalesforceField'],{'as':_0x97f0('0x1c3'),'foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0x1be')][_0x97f0('0x112')](db['SalesforceField'],{'as':_0x97f0('0x1c4'),'foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0x1be')][_0x97f0('0x11e')](db[_0x97f0('0x8b')],{'as':'Variable','foreignKey':_0x97f0('0x1c5')});db[_0x97f0('0x9c')][_0x97f0('0x112')](db[_0x97f0('0x9e')],{'as':_0x97f0('0x1bb'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0x9e')][_0x97f0('0x112')](db['SugarcrmField'],{'as':_0x97f0('0x1bd'),'onDelete':_0x97f0('0x10d'),'foreignKey':'SubjectId'});db[_0x97f0('0x9e')][_0x97f0('0x112')](db['SugarcrmField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration']['hasMany'](db[_0x97f0('0x1c6')],{'as':_0x97f0('0x1b8'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0x9e')][_0x97f0('0x11e')](db[_0x97f0('0x9c')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0x1c6')][_0x97f0('0x112')](db[_0x97f0('0x1c6')],{'as':_0x97f0('0x1c7'),'foreignKey':_0x97f0('0x1c2')});db['SugarcrmField']['hasMany'](db[_0x97f0('0x1c6')],{'as':_0x97f0('0x1c3'),'foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0x1c6')]['hasMany'](db['SugarcrmField'],{'as':_0x97f0('0x1c4'),'foreignKey':'FieldId'});db[_0x97f0('0x1c6')][_0x97f0('0x11e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x97f0('0xa1')][_0x97f0('0x112')](db[_0x97f0('0x1c8')],{'as':_0x97f0('0x1bb'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1bc')});db['DeskConfiguration'][_0x97f0('0x112')](db[_0x97f0('0xa4')],{'as':_0x97f0('0x1bd'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0x1c8')]['hasMany'](db[_0x97f0('0xa4')],{'as':_0x97f0('0x1bf'),'onDelete':_0x97f0('0x10d'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db[_0x97f0('0xa4')],{'as':'Fields','onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c1')});db['DeskConfiguration']['belongsTo'](db[_0x97f0('0xa1')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0x1c8')][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':'int_desk_configuration_has_tags'});db[_0x97f0('0xa4')][_0x97f0('0x112')](db[_0x97f0('0xa4')],{'as':_0x97f0('0x1c7'),'foreignKey':'SubjectId'});db[_0x97f0('0xa4')][_0x97f0('0x112')](db[_0x97f0('0xa4')],{'as':'Description','foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0xa4')][_0x97f0('0x112')](db[_0x97f0('0xa4')],{'as':_0x97f0('0x1c4'),'foreignKey':_0x97f0('0x1c1')});db['DeskField'][_0x97f0('0x11e')](db['Variable'],{'as':_0x97f0('0x8b'),'foreignKey':_0x97f0('0x1c5')});db['ZohoAccount'][_0x97f0('0x112')](db[_0x97f0('0x1c9')],{'as':_0x97f0('0x1bb'),'onDelete':'cascade','foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0x1c9')][_0x97f0('0x112')](db[_0x97f0('0xa8')],{'as':_0x97f0('0x1bd'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0x1c9')][_0x97f0('0x112')](db[_0x97f0('0xa8')],{'as':_0x97f0('0x1bf'),'onDelete':'cascade','foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0x1c9')][_0x97f0('0x112')](db['ZohoField'],{'as':_0x97f0('0x1b8'),'onDelete':'cascade','foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0x97f0('0xa6')],{'as':_0x97f0('0x172'),'foreignKey':'AccountId'});db[_0x97f0('0xa8')][_0x97f0('0x112')](db[_0x97f0('0xa8')],{'as':_0x97f0('0x1c7'),'foreignKey':_0x97f0('0x1c2')});db['ZohoField']['hasMany'](db[_0x97f0('0xa8')],{'as':_0x97f0('0x1c3'),'foreignKey':_0x97f0('0x1c0')});db['ZohoField'][_0x97f0('0x112')](db[_0x97f0('0xa8')],{'as':_0x97f0('0x1c4'),'foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0xa8')][_0x97f0('0x11e')](db['Variable'],{'as':_0x97f0('0x8b'),'foreignKey':_0x97f0('0x1c5')});db[_0x97f0('0x1ca')]['hasMany'](db[_0x97f0('0xaa')],{'as':'Configurations','onDelete':_0x97f0('0x10d'),'foreignKey':'AccountId'});db[_0x97f0('0xaa')]['hasMany'](db[_0x97f0('0xac')],{'as':'Subjects','foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x97f0('0x112')](db['ZendeskField'],{'as':_0x97f0('0x1bf'),'foreignKey':'DescriptionId'});db[_0x97f0('0xaa')][_0x97f0('0x112')](db[_0x97f0('0xac')],{'as':'Fields','foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0xaa')][_0x97f0('0x11e')](db[_0x97f0('0x1ca')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0xaa')][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':'int_zendesk_configuration_has_tags'});db[_0x97f0('0xac')][_0x97f0('0x112')](db[_0x97f0('0xac')],{'as':_0x97f0('0x1c7'),'foreignKey':_0x97f0('0x1c2')});db['ZendeskField'][_0x97f0('0x112')](db[_0x97f0('0xac')],{'as':_0x97f0('0x1c3'),'foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0xac')][_0x97f0('0x112')](db[_0x97f0('0xac')],{'as':_0x97f0('0x1c4'),'foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0xac')][_0x97f0('0x11e')](db[_0x97f0('0x8b')],{'as':_0x97f0('0x8b'),'foreignKey':_0x97f0('0x1c5')});db['FreshdeskAccount']['hasMany'](db[_0x97f0('0xaf')],{'as':_0x97f0('0x1bb'),'onDelete':_0x97f0('0x10d'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x97f0('0x112')](db[_0x97f0('0xb1')],{'as':_0x97f0('0x1bd'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0xaf')][_0x97f0('0x112')](db[_0x97f0('0xb1')],{'as':'Descriptions','onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0xaf')][_0x97f0('0x112')](db[_0x97f0('0xb1')],{'as':_0x97f0('0x1b8'),'onDelete':'cascade','foreignKey':_0x97f0('0x1c1')});db['FreshdeskConfiguration'][_0x97f0('0x11e')](db[_0x97f0('0xae')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0xaf')]['belongsToMany'](db[_0x97f0('0x86')],{'through':_0x97f0('0x1cb')});db[_0x97f0('0xb1')][_0x97f0('0x112')](db[_0x97f0('0xb1')],{'as':_0x97f0('0x1c7'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0xb1')][_0x97f0('0x112')](db['FreshdeskField'],{'as':_0x97f0('0x1c3'),'foreignKey':'DescriptionId'});db[_0x97f0('0xb1')]['hasMany'](db['FreshdeskField'],{'as':_0x97f0('0x1c4'),'foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0xb1')][_0x97f0('0x11e')](db[_0x97f0('0x8b')],{'as':_0x97f0('0x8b'),'foreignKey':_0x97f0('0x1c5')});db[_0x97f0('0x1cc')][_0x97f0('0x112')](db['VtigerConfiguration'],{'as':_0x97f0('0x1bb'),'onDelete':'cascade','foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0xb4')]['hasMany'](db[_0x97f0('0x1cd')],{'as':_0x97f0('0x1bd'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0xb4')][_0x97f0('0x112')](db[_0x97f0('0x1cd')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x97f0('0xb4')]['hasMany'](db[_0x97f0('0x1cd')],{'as':_0x97f0('0x1b8'),'foreignKey':_0x97f0('0x1c1')});db['VtigerConfiguration'][_0x97f0('0x11e')](db[_0x97f0('0x1cc')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0x1cd')][_0x97f0('0x112')](db[_0x97f0('0x1cd')],{'as':_0x97f0('0x1c7'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0x1cd')][_0x97f0('0x112')](db[_0x97f0('0x1cd')],{'as':_0x97f0('0x1c3'),'foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0x1cd')]['hasMany'](db[_0x97f0('0x1cd')],{'as':_0x97f0('0x1c4'),'foreignKey':'FieldId'});db['VtigerField'][_0x97f0('0x11e')](db[_0x97f0('0x8b')],{'as':_0x97f0('0x8b'),'foreignKey':_0x97f0('0x1c5')});db['ServicenowAccount'][_0x97f0('0x112')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0xb8')][_0x97f0('0x112')](db['ServicenowField'],{'as':_0x97f0('0x1bd'),'foreignKey':_0x97f0('0x1c2')});db['ServicenowConfiguration'][_0x97f0('0x112')](db['ServicenowField'],{'as':_0x97f0('0x1bf'),'foreignKey':'DescriptionId'});db[_0x97f0('0xb8')][_0x97f0('0x112')](db[_0x97f0('0xba')],{'as':_0x97f0('0x1b8'),'foreignKey':_0x97f0('0x1c1')});db['ServicenowConfiguration'][_0x97f0('0x11e')](db[_0x97f0('0xb7')],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x97f0('0x1c7'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0xba')][_0x97f0('0x112')](db[_0x97f0('0xba')],{'as':'Description','foreignKey':_0x97f0('0x1c0')});db['ServicenowField'][_0x97f0('0x112')](db[_0x97f0('0xba')],{'as':'Field','foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0xba')][_0x97f0('0x11e')](db[_0x97f0('0x8b')],{'as':_0x97f0('0x8b'),'foreignKey':_0x97f0('0x1c5')});db[_0x97f0('0xbc')]['hasMany'](db[_0x97f0('0xbe')],{'as':_0x97f0('0x1bb'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1bc')});db['Dynamics365Account'][_0x97f0('0x11e')](db['CloudProvider'],{'as':_0x97f0('0x101'),'foreignKey':_0x97f0('0x166')});db[_0x97f0('0xbe')][_0x97f0('0x112')](db['Dynamics365Field'],{'as':_0x97f0('0x1bd'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0xbe')]['hasMany'](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0x97f0('0x10d'),'foreignKey':'DescriptionId'});db[_0x97f0('0xbe')][_0x97f0('0x112')](db[_0x97f0('0xc0')],{'as':'Fields','onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1c1')});db['Dynamics365Configuration'][_0x97f0('0x11e')](db['Dynamics365Account'],{'as':_0x97f0('0x172'),'foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0xc0')][_0x97f0('0x112')](db[_0x97f0('0xc0')],{'as':'Subject','foreignKey':_0x97f0('0x1c2')});db[_0x97f0('0xc0')][_0x97f0('0x112')](db[_0x97f0('0xc0')],{'as':_0x97f0('0x1c3'),'foreignKey':'DescriptionId'});db[_0x97f0('0xc0')][_0x97f0('0x112')](db[_0x97f0('0xc0')],{'as':_0x97f0('0x1c4'),'foreignKey':_0x97f0('0x1c1')});db['Dynamics365Field'][_0x97f0('0x11e')](db[_0x97f0('0x8b')],{'as':_0x97f0('0x8b'),'foreignKey':_0x97f0('0x1c5')});db['FreshsalesAccount'][_0x97f0('0x112')](db['FreshsalesConfiguration'],{'as':_0x97f0('0x1bb'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x1bc')});db['FreshsalesConfiguration'][_0x97f0('0x112')](db[_0x97f0('0xc6')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x97f0('0xc4')]['hasMany'](db['FreshsalesField'],{'as':_0x97f0('0x1bf'),'foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0xc4')][_0x97f0('0x112')](db[_0x97f0('0xc6')],{'as':_0x97f0('0x1b8'),'foreignKey':_0x97f0('0x1c1')});db[_0x97f0('0xc4')][_0x97f0('0x11e')](db[_0x97f0('0xc2')],{'as':'Account','foreignKey':_0x97f0('0x1bc')});db[_0x97f0('0xc6')][_0x97f0('0x112')](db['FreshsalesField'],{'as':_0x97f0('0x1c7'),'foreignKey':_0x97f0('0x1c2')});db['FreshsalesField']['hasMany'](db[_0x97f0('0xc6')],{'as':_0x97f0('0x1c3'),'foreignKey':_0x97f0('0x1c0')});db[_0x97f0('0xc6')][_0x97f0('0x112')](db[_0x97f0('0xc6')],{'as':_0x97f0('0x1c4'),'foreignKey':'FieldId'});db[_0x97f0('0xc6')]['belongsTo'](db[_0x97f0('0x8b')],{'as':'Variable','foreignKey':_0x97f0('0x1c5')});db[_0x97f0('0xcb')][_0x97f0('0x11e')](db[_0x97f0('0x60')],{});db[_0x97f0('0xcb')]['belongsTo'](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'as':'Contact','foreignKey':_0x97f0('0x173')});db[_0x97f0('0xcb')]['belongsTo'](db['ChatInteraction'],{});db[_0x97f0('0xcb')][_0x97f0('0x11e')](db['ChatMessage'],{});db[_0x97f0('0xcb')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{});db[_0x97f0('0xcb')][_0x97f0('0x11e')](db[_0x97f0('0x134')],{});db[_0x97f0('0xcd')]['belongsTo'](db[_0x97f0('0x14')],{'onDelete':'cascade','foreignKey':_0x97f0('0x1ce')});db[_0x97f0('0xcd')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':'cascade','foreignKey':_0x97f0('0x1cf')});db[_0x97f0('0xd3')][_0x97f0('0x112')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x97f0('0x10d')});db[_0x97f0('0xd3')][_0x97f0('0x112')](db['JscriptyAnswerReport'],{'foreignKey':_0x97f0('0x1d0'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0xd5')]['belongsTo'](db['SmsAccount'],{});db[_0x97f0('0xd5')][_0x97f0('0x11e')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x17e'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':'ContactId'});db[_0x97f0('0xd5')][_0x97f0('0x11e')](db[_0x97f0('0x53')],{});db['SmsQueueReport'][_0x97f0('0x11e')](db['SmsMessage'],{});db['SmsQueueReport'][_0x97f0('0x11e')](db['User'],{});db['SmsQueueReport'][_0x97f0('0x11e')](db[_0x97f0('0x137')],{});db['JscriptyProject']['hasMany'](db[_0x97f0('0xd3')],{'foreignKey':_0x97f0('0x1d1')});db[_0x97f0('0xdb')][_0x97f0('0x112')](db['JscriptyQuestionReport'],{'foreignKey':_0x97f0('0x1d1')});db[_0x97f0('0xdb')]['hasMany'](db[_0x97f0('0xcf')],{'foreignKey':_0x97f0('0x1d1')});db[_0x97f0('0xe0')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x177'),'through':'user_has_square_projects'});db[_0x97f0('0x129')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':'user_has_teams'});db[_0x97f0('0x129')][_0x97f0('0x123')](db[_0x97f0('0x1d')],{'through':_0x97f0('0x103'),'as':_0x97f0('0x132')});db[_0x97f0('0x129')][_0x97f0('0x123')](db[_0x97f0('0x3d')],{'through':_0x97f0('0x16e'),'as':_0x97f0('0x1d2')});db['Team'][_0x97f0('0x123')](db['ChatQueue'],{'through':_0x97f0('0x19f'),'as':_0x97f0('0x135')});db['Team']['belongsToMany'](db[_0x97f0('0x4f')],{'through':_0x97f0('0x18b'),'as':'FaxQueues'});db[_0x97f0('0x129')][_0x97f0('0x123')](db[_0x97f0('0x137')],{'through':'team_has_sms_queues','as':_0x97f0('0x138')});db[_0x97f0('0x129')][_0x97f0('0x123')](db[_0x97f0('0x5e')],{'through':_0x97f0('0x198'),'as':'OpenchannelQueues'});db[_0x97f0('0x129')]['belongsToMany'](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x97f0('0x129')][_0x97f0('0x123')](db['VoicePrefix'],{'through':_0x97f0('0x105'),'as':_0x97f0('0x133')});db[_0x97f0('0xe8')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x97f0('0x1a6')});db[_0x97f0('0xe8')][_0x97f0('0x112')](db[_0x97f0('0x6e')],{'as':_0x97f0('0x115'),'foreignKey':_0x97f0('0x1a6')});db[_0x97f0('0xe8')][_0x97f0('0x112')](db[_0x97f0('0x70')],{'as':_0x97f0('0x1a1'),'foreignKey':_0x97f0('0x1a6')});db[_0x97f0('0xe8')][_0x97f0('0x112')](db[_0x97f0('0x151')],{'as':_0x97f0('0x152'),'foreignKey':_0x97f0('0x1a6')});db[_0x97f0('0xe8')][_0x97f0('0x11e')](db[_0x97f0('0x28')],{'as':_0x97f0('0x28'),'foreignKey':_0x97f0('0x154')});db[_0x97f0('0xe8')][_0x97f0('0x11e')](db[_0x97f0('0x28')],{'as':_0x97f0('0x1d3'),'foreignKey':_0x97f0('0x155')});db[_0x97f0('0xe8')][_0x97f0('0x11e')](db[_0x97f0('0x7d')],{'as':_0x97f0('0x7d'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0xe8')][_0x97f0('0x11e')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x97f0('0x1d4')});db['Campaign'][_0x97f0('0x123')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x127'),'through':_0x97f0('0x1d5')});db[_0x97f0('0xe8')][_0x97f0('0x123')](db[_0x97f0('0xf1')],{'as':_0x97f0('0x15b'),'through':_0x97f0('0x1d6')});db[_0x97f0('0x178')][_0x97f0('0x11e')](db[_0x97f0('0x17b')],{'as':_0x97f0('0x17b'),'foreignKey':_0x97f0('0x17c')});db['MailTransferReport'][_0x97f0('0x11e')](db[_0x97f0('0x170')],{});db[_0x97f0('0x1d7')][_0x97f0('0x11e')](db[_0x97f0('0x40')],{});db[_0x97f0('0x1d7')][_0x97f0('0x11e')](db[_0x97f0('0x13f')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x97f0('0x1d7')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1d8'),'as':_0x97f0('0x1d9')});db['MailTransferReport'][_0x97f0('0x11e')](db['User'],{'foreignKey':_0x97f0('0x1da'),'as':'ToAgent'});db[_0x97f0('0x1d7')][_0x97f0('0x11e')](db[_0x97f0('0x3d')],{'foreignKey':_0x97f0('0x1db'),'as':_0x97f0('0x1dc')});db[_0x97f0('0x1d7')]['belongsTo'](db[_0x97f0('0x13f')],{'foreignKey':_0x97f0('0x1dd'),'as':_0x97f0('0x1de')});db[_0x97f0('0x1df')][_0x97f0('0x11e')](db[_0x97f0('0x67')],{});db[_0x97f0('0x1df')][_0x97f0('0x11e')](db[_0x97f0('0x118')],{});db[_0x97f0('0x1df')][_0x97f0('0x11e')](db[_0x97f0('0x60')],{'foreignKey':_0x97f0('0x1e0'),'as':_0x97f0('0x1e1')});db[_0x97f0('0x1df')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1d8'),'as':'FromAgent'});db[_0x97f0('0x1df')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1da'),'as':_0x97f0('0x1e2')});db['ChatTransferReport'][_0x97f0('0x11e')](db[_0x97f0('0x134')],{'foreignKey':_0x97f0('0x1e3'),'as':_0x97f0('0x1dc')});db[_0x97f0('0x1df')][_0x97f0('0x11e')](db['ChatWebsite'],{'foreignKey':_0x97f0('0x1e4'),'as':_0x97f0('0x1de')});db[_0x97f0('0xec')]['belongsTo'](db[_0x97f0('0x184')],{});db['FaxTransferReport'][_0x97f0('0x11e')](db['FaxInteraction'],{});db[_0x97f0('0xec')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x97f0('0x1e5'),'as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1d8'),'as':_0x97f0('0x1d9')});db[_0x97f0('0xec')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1da'),'as':'ToAgent'});db['FaxTransferReport'][_0x97f0('0x11e')](db[_0x97f0('0x4f')],{'foreignKey':_0x97f0('0x1e6'),'as':_0x97f0('0x1dc')});db['FaxTransferReport']['belongsTo'](db[_0x97f0('0x4a')],{'foreignKey':_0x97f0('0x1e7'),'as':_0x97f0('0x1de')});db[_0x97f0('0xee')]['belongsTo'](db[_0x97f0('0x5c')],{});db[_0x97f0('0xee')][_0x97f0('0x11e')](db[_0x97f0('0x116')],{});db[_0x97f0('0xee')][_0x97f0('0x11e')](db[_0x97f0('0x57')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x97f0('0xee')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1d8'),'as':_0x97f0('0x1d9')});db['OpenchannelTransferReport'][_0x97f0('0x11e')](db['User'],{'foreignKey':_0x97f0('0x1da'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x97f0('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0x97f0('0x1e8'),'as':_0x97f0('0x1dc')});db['OpenchannelTransferReport']['belongsTo'](db[_0x97f0('0x57')],{'foreignKey':_0x97f0('0x1e9'),'as':_0x97f0('0x1de')});db[_0x97f0('0xef')][_0x97f0('0x11e')](db[_0x97f0('0x55')],{});db['SmsTransferReport'][_0x97f0('0x11e')](db[_0x97f0('0x53')],{});db[_0x97f0('0xef')][_0x97f0('0x11e')](db['SmsAccount'],{'foreignKey':_0x97f0('0x1ea'),'as':_0x97f0('0x1e1')});db[_0x97f0('0xef')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1d8'),'as':'FromAgent'});db[_0x97f0('0xef')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1da'),'as':_0x97f0('0x1e2')});db[_0x97f0('0xef')][_0x97f0('0x11e')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x97f0('0x1dc')});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0x97f0('0x1eb'),'as':'ToAccount'});db[_0x97f0('0xf1')][_0x97f0('0x112')](db[_0x97f0('0x7a')],{'as':'Dispositions','foreignKey':_0x97f0('0x17f'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0xf1')][_0x97f0('0x112')](db[_0x97f0('0x73')],{'as':_0x97f0('0x1ec'),'foreignKey':_0x97f0('0x17f')});db[_0x97f0('0xf1')][_0x97f0('0x112')](db[_0x97f0('0x124')],{'as':_0x97f0('0x125'),'onDelete':_0x97f0('0x10d'),'foreignKey':_0x97f0('0x17f')});db['CmList'][_0x97f0('0x112')](db[_0x97f0('0x6e')],{'as':'HopperFinals','foreignKey':_0x97f0('0x17f')});db[_0x97f0('0xf1')][_0x97f0('0x112')](db[_0x97f0('0x70')],{'as':_0x97f0('0x1ed'),'foreignKey':_0x97f0('0x17f')});db[_0x97f0('0xf1')][_0x97f0('0x112')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x97f0('0x17f')});db[_0x97f0('0xf1')][_0x97f0('0x123')](db[_0x97f0('0x1d')],{'as':'Queues','through':_0x97f0('0x15a')});db[_0x97f0('0xf1')][_0x97f0('0x123')](db['User'],{'as':'Agents','through':_0x97f0('0x128')});db[_0x97f0('0xf3')][_0x97f0('0x112')](db['VoiceExtension'],{'as':_0x97f0('0x114'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0xf3')][_0x97f0('0x123')](db['User'],{'as':_0x97f0('0x185'),'through':_0x97f0('0x107')});db['VoicePrefix'][_0x97f0('0x123')](db[_0x97f0('0x129')],{'through':_0x97f0('0x105'),'as':'Teams'});db[_0x97f0('0x11f')]['hasMany'](db['User'],{'as':_0x97f0('0x177'),'foreignKey':'userProfileId'});db[_0x97f0('0x11f')]['hasMany'](db[_0x97f0('0x1ee')],{'as':_0x97f0('0x1ef'),'foreignKey':'userProfileId','onDelete':_0x97f0('0x10d')});db['UserProfileSection'][_0x97f0('0x112')](db[_0x97f0('0x1f0')],{'as':_0x97f0('0x1f1'),'foreignKey':_0x97f0('0x1f2'),'onDelete':_0x97f0('0x10d')});db['WhatsappAccount'][_0x97f0('0x112')](db[_0x97f0('0x7a')],{'as':_0x97f0('0x16a'),'foreignKey':_0x97f0('0x1f3'),'onDelete':_0x97f0('0x10d')});db[_0x97f0('0x1f4')]['hasMany'](db[_0x97f0('0x78')],{'as':_0x97f0('0x16b'),'foreignKey':'WhatsappAccountId'});db[_0x97f0('0x1f4')][_0x97f0('0x112')](db[_0x97f0('0xfb')],{'as':_0x97f0('0x16c'),'foreignKey':_0x97f0('0x1f3')});db[_0x97f0('0x1f4')][_0x97f0('0x112')](db[_0x97f0('0xfa')],{'as':_0x97f0('0x182')});db['WhatsappAccount'][_0x97f0('0x112')](db[_0x97f0('0x1f5')],{'as':_0x97f0('0x14b')});db[_0x97f0('0x1f4')][_0x97f0('0x11e')](db['CmList'],{'as':'List','foreignKey':_0x97f0('0x17f')});db[_0x97f0('0x1f4')][_0x97f0('0x11e')](db[_0x97f0('0x157')],{'as':'mandatoryDispositionPause','foreignKey':_0x97f0('0x159')});db[_0x97f0('0x1f4')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':_0x97f0('0x147')});db[_0x97f0('0x1f5')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'onDelete':'restrict'});db[_0x97f0('0x1f5')]['belongsTo'](db[_0x97f0('0x13a')],{'onDelete':_0x97f0('0x167')});db[_0x97f0('0x1f5')][_0x97f0('0x11e')](db[_0x97f0('0x1f4')],{'onDelete':_0x97f0('0x167')});db[_0x97f0('0x1f5')][_0x97f0('0x11e')](db['Interval'],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x156')});db[_0x97f0('0x1f5')][_0x97f0('0x11e')](db['Tag'],{'onDelete':_0x97f0('0x167'),'foreignKey':_0x97f0('0x17d')});db[_0x97f0('0xfa')][_0x97f0('0x112')](db[_0x97f0('0xfb')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x97f0('0x1f6')});db[_0x97f0('0xfa')][_0x97f0('0x11e')](db[_0x97f0('0x1f4')],{'as':'Account','foreignKey':_0x97f0('0x1f3')});db[_0x97f0('0xfa')]['belongsTo'](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db[_0x97f0('0xfa')]['belongsTo'](db[_0x97f0('0x14')],{'as':_0x97f0('0x174'),'foreignKey':_0x97f0('0x10e')});db[_0x97f0('0xfa')][_0x97f0('0x123')](db[_0x97f0('0x86')],{'through':_0x97f0('0x1f7'),'as':_0x97f0('0x188')});db['WhatsappInteraction'][_0x97f0('0x123')](db['Tag'],{'through':_0x97f0('0x1f7'),'as':'ThroughTags'});db[_0x97f0('0xfa')][_0x97f0('0x123')](db[_0x97f0('0x14')],{'as':_0x97f0('0x177'),'through':_0x97f0('0x131'),'foreignKey':_0x97f0('0x1f6')});db['WhatsappMessage'][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':'User'});db[_0x97f0('0xfb')][_0x97f0('0x11e')](db[_0x97f0('0x124')],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x164')});db['WhatsappMessage'][_0x97f0('0x11e')](db['WhatsappInteraction'],{'onDelete':_0x97f0('0x10d'),'as':_0x97f0('0x191'),'foreignKey':_0x97f0('0x1f6')});db['WhatsappMessage'][_0x97f0('0x11e')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x97f0('0x1f3')});db[_0x97f0('0xfd')]['belongsTo'](db[_0x97f0('0x1f4')],{});db[_0x97f0('0xfd')][_0x97f0('0x11e')](db['CmList'],{'as':_0x97f0('0x17e'),'foreignKey':_0x97f0('0x17f')});db[_0x97f0('0xfd')]['belongsTo'](db[_0x97f0('0x124')],{'as':_0x97f0('0x164'),'foreignKey':_0x97f0('0x173')});db[_0x97f0('0xfd')][_0x97f0('0x11e')](db[_0x97f0('0xfa')],{});db[_0x97f0('0xfd')][_0x97f0('0x11e')](db['WhatsappQueue'],{});db[_0x97f0('0xfd')][_0x97f0('0x11e')](db['WhatsappMessage'],{});db[_0x97f0('0xfd')]['belongsTo'](db[_0x97f0('0x14')],{});db[_0x97f0('0xff')][_0x97f0('0x11e')](db['WhatsappMessage'],{});db[_0x97f0('0xff')][_0x97f0('0x11e')](db[_0x97f0('0xfa')],{});db[_0x97f0('0xff')][_0x97f0('0x11e')](db['WhatsappAccount'],{'foreignKey':_0x97f0('0x1f8'),'as':_0x97f0('0x1e1')});db[_0x97f0('0xff')]['belongsTo'](db[_0x97f0('0x1f4')],{'foreignKey':_0x97f0('0x1f9'),'as':_0x97f0('0x1de')});db[_0x97f0('0xff')][_0x97f0('0x11e')](db[_0x97f0('0x13a')],{'foreignKey':_0x97f0('0x1fa'),'as':_0x97f0('0x1dc')});db['WhatsappTransferReport']['belongsTo'](db[_0x97f0('0x14')],{'foreignKey':_0x97f0('0x1d8'),'as':_0x97f0('0x1d9')});db[_0x97f0('0xff')][_0x97f0('0x11e')](db['User'],{'foreignKey':_0x97f0('0x1da'),'as':_0x97f0('0x1e2')});db[_0x97f0('0x13a')]['belongsToMany'](db[_0x97f0('0x14')],{'as':_0x97f0('0x185'),'through':'UserWhatsappQueue','foreignKey':_0x97f0('0x1fb')});db[_0x97f0('0x13a')][_0x97f0('0x123')](db[_0x97f0('0x129')],{'through':_0x97f0('0x1fc'),'as':'Teams'});db[_0x97f0('0x109')][_0x97f0('0x11e')](db[_0x97f0('0x14')],{'as':'user','foreignKey':_0x97f0('0x10e'),'onDelete':_0x97f0('0x10d'),'hooks':!![]});db[_0x97f0('0x101')][_0x97f0('0x10b')](db[_0x97f0('0xbc')],{'as':_0x97f0('0xbc'),'onDelete':_0x97f0('0x167')});db['CloudProvider']['hasOne'](db[_0x97f0('0x38')],{'as':_0x97f0('0x168'),'onDelete':_0x97f0('0x167')});db[_0x97f0('0x101')][_0x97f0('0x10b')](db[_0x97f0('0x3a')],{'as':'Smtp','onDelete':_0x97f0('0x167')});module[_0x97f0('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3693=['../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteraction','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueue','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','VoiceChanSpy','ChanSpyId','VoiceContext','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CloudProvider','CloudProviderId','restrict','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','TemplateId','team_has_mail_queues','MailInteractionId','Account','Contact','ContactId','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Attachments','ChatWebsite','ChatOfflineMessageId','IntervalId','TagId','List','ListId','DashboardItem','Items','FaxAccountId','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','Users','Interaction','AttachmentId','UserFaxQueue','SmsAccount','SmsAccountId','SmsMessage','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','user_has_chat_websites','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','Members','CompanyId','JscriptySessionReport','Company','cm_contact_has_tags','Campaign','CampaignId','Condition','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','FaxApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','Fields','DefaultReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','DescriptionId','Field','Variable','DeskConfiguration','int_desk_configuration_has_tags','VariableId','int_zendesk_configuration_has_tags','FreshdeskField','ServicenowConfiguration','ServicenowField','Dynamics365Field','ToId','JscriptyProject','ProjectId','user_has_square_projects','team_has_fax_queues','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','TeamVoicePrefix','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','WhatsappMessage','FromWhatsappAccountId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','../config/environment','lodash','determine','sequelize','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Interval'];(function(_0x4d5376,_0x1b9fec){var _0x414948=function(_0x2ea7b5){while(--_0x2ea7b5){_0x4d5376['push'](_0x4d5376['shift']());}};_0x414948(++_0x1b9fec);}(_0x3693,0x167));var _0x3369=function(_0x2ffa79,_0x5e8de){_0x2ffa79=_0x2ffa79-0x0;var _0xc1de54=_0x3693[_0x2ffa79];return _0xc1de54;};'use strict';var config=require(_0x3369('0x0'));var Sequelize=require('sequelize');var _=require(_0x3369('0x1'));var jstz=require('jstz');var timezone=jstz[_0x3369('0x2')]();config[_0x3369('0x3')]=_[_0x3369('0x4')](config[_0x3369('0x3')],{'database':'motion2','username':'xcall','password':_0x3369('0x5'),'options':{'host':_0x3369('0x6'),'port':0xcea,'dialect':_0x3369('0x7'),'dialectOptions':{'charset':_0x3369('0x8')},'logging':![],'timezone':timezone[_0x3369('0x9')](),'define':{'charset':_0x3369('0xa'),'collate':_0x3369('0xb')}}});config['sequelizeHistory']=_[_0x3369('0x4')](config[_0x3369('0xc')],{'database':_0x3369('0xd'),'username':_0x3369('0xe'),'password':_0x3369('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3369('0x7'),'dialectOptions':{'charset':_0x3369('0x8')},'logging':![],'timezone':timezone[_0x3369('0x9')](),'define':{'charset':_0x3369('0xa'),'collate':_0x3369('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3369('0x3')][_0x3369('0xf')],config[_0x3369('0x3')][_0x3369('0x10')],config[_0x3369('0x3')][_0x3369('0x11')],config[_0x3369('0x3')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3369('0xc')][_0x3369('0xf')],config[_0x3369('0xc')][_0x3369('0x10')],config[_0x3369('0xc')][_0x3369('0x11')],config[_0x3369('0xc')][_0x3369('0x12')])};db[_0x3369('0x13')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x15'));db['VoiceChanSpy']=db[_0x3369('0x3')]['import'](_0x3369('0x16'));db['VoiceContext']=db[_0x3369('0x3')][_0x3369('0x14')]('../api/voiceContext/voiceContext.model');db[_0x3369('0x17')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x18'));db['VoiceMusicOnHold']=db[_0x3369('0x3')]['import'](_0x3369('0x19'));db['VoiceQueue']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x1a'));db[_0x3369('0x1b')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x1c'));db[_0x3369('0x1d')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x1e'));db[_0x3369('0x1f')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x20'));db[_0x3369('0x21')]=db[_0x3369('0x3')]['import'](_0x3369('0x22'));db[_0x3369('0x23')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x24'));db[_0x3369('0x25')]=db[_0x3369('0x3')]['import'](_0x3369('0x26'));db[_0x3369('0x27')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x28'));db['VoiceQueueReport']=db['sequelize'][_0x3369('0x14')](_0x3369('0x29'));db['MemberReport']=db['sequelize']['import'](_0x3369('0x2a'));db[_0x3369('0x2b')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x2c'));db['VoiceTransferReport']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x2d'));db[_0x3369('0x2e')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x2f'));db[_0x3369('0x30')]=db[_0x3369('0x3')]['import'](_0x3369('0x31'));db[_0x3369('0x32')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x33'));db[_0x3369('0x34')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x35'));db['UserFaxQueue']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x36'));db[_0x3369('0x37')]=db['sequelize'][_0x3369('0x14')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x3369('0x3')]['import'](_0x3369('0x38'));db[_0x3369('0x39')]=db[_0x3369('0x3')]['import'](_0x3369('0x3a'));db[_0x3369('0x3b')]=db[_0x3369('0x3')]['import'](_0x3369('0x3c'));db[_0x3369('0x3d')]=db[_0x3369('0x3')]['import']('../api/mailServerOut/mailServerOut.model');db[_0x3369('0x3e')]=db['sequelize']['import'](_0x3369('0x3f'));db[_0x3369('0x40')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x41'));db[_0x3369('0x42')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3369('0x43')]=db['sequelize']['import']('../api/mailInteraction/mailInteraction.model');db[_0x3369('0x44')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x45'));db[_0x3369('0x46')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x47'));db[_0x3369('0x48')]=db[_0x3369('0x3')]['import'](_0x3369('0x49'));db[_0x3369('0x4a')]=db['sequelize'][_0x3369('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x4b'));db[_0x3369('0x4c')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x4d'));db[_0x3369('0x4e')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x4f'));db[_0x3369('0x50')]=db[_0x3369('0x3')]['import'](_0x3369('0x51'));db[_0x3369('0x52')]=db['sequelize']['import'](_0x3369('0x53'));db[_0x3369('0x54')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/faxQueue/faxQueue.model');db[_0x3369('0x55')]=db[_0x3369('0x3')]['import']('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x56'));db[_0x3369('0x57')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x58'));db[_0x3369('0x59')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x5a'));db['SmsMessage']=db[_0x3369('0x3')][_0x3369('0x14')]('../api/smsMessage/smsMessage.model');db[_0x3369('0x5b')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x5c'));db['OpenchannelAccount']=db['sequelize'][_0x3369('0x14')](_0x3369('0x5d'));db['OpenchannelApplication']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x5e'));db[_0x3369('0x5f')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x3369('0x60')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x61'));db[_0x3369('0x62')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x63'));db['ChatWebsite']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x64'));db[_0x3369('0x65')]=db[_0x3369('0x3')]['import'](_0x3369('0x66'));db[_0x3369('0x67')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/chatApplication/chatApplication.model');db[_0x3369('0x68')]=db[_0x3369('0x3')]['import'](_0x3369('0x69'));db[_0x3369('0x6a')]=db['sequelize']['import'](_0x3369('0x6b'));db[_0x3369('0x6c')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x6d'));db[_0x3369('0x6e')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x6f'));db['ChatGroup']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x70'));db[_0x3369('0x71')]=db[_0x3369('0x3')]['import'](_0x3369('0x72'));db[_0x3369('0x73')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x74'));db['CmContact']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x75'));db['CmHopper']=db[_0x3369('0x3')]['import'](_0x3369('0x76'));db[_0x3369('0x77')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x3369('0x78')]=db[_0x3369('0x3')]['import'](_0x3369('0x79'));db['CmHopperHistory']=db['sequelize'][_0x3369('0x14')](_0x3369('0x7a'));db[_0x3369('0x7b')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x3369('0x7c')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x7d'));db[_0x3369('0x7e')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x7f'));db[_0x3369('0x80')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/automation/automation.model');db[_0x3369('0x81')]=db[_0x3369('0x3')]['import'](_0x3369('0x82'));db[_0x3369('0x83')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/disposition/disposition.model');db['Condition']=db[_0x3369('0x3')]['import']('../api/condition/condition.model');db[_0x3369('0x84')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x85'));db[_0x3369('0x86')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x87'));db[_0x3369('0x88')]=db[_0x3369('0x3')]['import'](_0x3369('0x89'));db[_0x3369('0x8a')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x8b'));db[_0x3369('0x8c')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x8d'));db[_0x3369('0x8e')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x8f'));db[_0x3369('0x90')]=db['sequelize']['import'](_0x3369('0x91'));db[_0x3369('0x92')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/template/template.model');db[_0x3369('0x93')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x94'));db['Variable']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x95'));db[_0x3369('0x96')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x97'));db[_0x3369('0x98')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x99'));db[_0x3369('0x9a')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x9b'));db[_0x3369('0x9c')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x9d'));db['AnalyticExtractedReport']=db[_0x3369('0x3')][_0x3369('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x3369('0x3')]['import'](_0x3369('0x9e'));db[_0x3369('0x9f')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xa0'));db[_0x3369('0xa1')]=db[_0x3369('0x3')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x3369('0xa2')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x3369('0xa3')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x3369('0xa4')]=db['sequelize'][_0x3369('0x14')](_0x3369('0xa5'));db['SugarcrmAccount']=db[_0x3369('0x3')][_0x3369('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x3369('0xa6')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xa7'));db[_0x3369('0xa8')]=db['sequelize'][_0x3369('0x14')](_0x3369('0xa9'));db[_0x3369('0xaa')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xab'));db[_0x3369('0xac')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xad'));db[_0x3369('0xae')]=db['sequelize'][_0x3369('0x14')](_0x3369('0xaf'));db[_0x3369('0xb0')]=db['sequelize']['import'](_0x3369('0xb1'));db[_0x3369('0xb2')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xb3'));db[_0x3369('0xb4')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x3369('0xb5')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xb6'));db[_0x3369('0xb7')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/intZendeskField/intZendeskField.model');db[_0x3369('0xb8')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xb9'));db[_0x3369('0xba')]=db[_0x3369('0x3')]['import'](_0x3369('0xbb'));db['FreshdeskField']=db[_0x3369('0x3')]['import'](_0x3369('0xbc'));db[_0x3369('0xbd')]=db[_0x3369('0x3')]['import'](_0x3369('0xbe'));db[_0x3369('0xbf')]=db['sequelize'][_0x3369('0x14')](_0x3369('0xc0'));db[_0x3369('0xc1')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x3369('0xc2')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xc3'));db['ServicenowConfiguration']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xc4'));db['ServicenowField']=db['sequelize'][_0x3369('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0x3369('0xc5')]=db['sequelize'][_0x3369('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x3369('0xc6')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xc7'));db['Dynamics365Field']=db[_0x3369('0x3')]['import'](_0x3369('0xc8'));db[_0x3369('0xc9')]=db['sequelize'][_0x3369('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x3369('0xca')]=db[_0x3369('0x3')]['import'](_0x3369('0xcb'));db[_0x3369('0xcc')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xcd'));db['Integration']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x97'));db['Network']=db['sequelize'][_0x3369('0x14')](_0x3369('0xce'));db[_0x3369('0xcf')]=db[_0x3369('0x3')]['import'](_0x3369('0xd0'));db['ChatInternalMessage']=db[_0x3369('0x3')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x3369('0xd1')]=db['sequelize'][_0x3369('0x14')](_0x3369('0xd2'));db[_0x3369('0xd3')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xd4'));db['JscriptySessionReport']=db[_0x3369('0x3')]['import'](_0x3369('0xd5'));db[_0x3369('0xd6')]=db['sequelize'][_0x3369('0x14')](_0x3369('0xd7'));db['SquareReport']=db['sequelize'][_0x3369('0x14')](_0x3369('0xd8'));db[_0x3369('0xd9')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xda'));db['JscriptyProject']=db[_0x3369('0x3')][_0x3369('0x14')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x3369('0x3')]['import'](_0x3369('0xdb'));db[_0x3369('0xdc')]=db[_0x3369('0x3')]['import'](_0x3369('0xdd'));db[_0x3369('0xde')]=db[_0x3369('0x3')]['import'](_0x3369('0xdf'));db[_0x3369('0xe0')]=db['sequelize'][_0x3369('0x14')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xe1'));db[_0x3369('0xe2')]=db[_0x3369('0x3')]['import']('../api/team/team.model');db['License']=db[_0x3369('0x3')][_0x3369('0x14')]('../api/license/license.model');db['Campaign']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xe3'));db[_0x3369('0xe4')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xe5'));db[_0x3369('0xe6')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/attachment/attachment.model');db[_0x3369('0xe7')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xe8'));db[_0x3369('0xe9')]=db['sequelize'][_0x3369('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x3369('0xea')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x3369('0xeb')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xec'));db[_0x3369('0xed')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xee'));db[_0x3369('0xef')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xf0'));db[_0x3369('0xf1')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xf2'));db[_0x3369('0xf3')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x3369('0xf4')]=db[_0x3369('0x3')]['import'](_0x3369('0xf5'));db[_0x3369('0xf6')]=db['sequelize']['import'](_0x3369('0xf7'));db[_0x3369('0xf8')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xf9'));db[_0x3369('0xfa')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xfb'));db[_0x3369('0xfc')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0xfd'));db[_0x3369('0xfe')]=db[_0x3369('0x3')][_0x3369('0x14')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x3369('0x3')][_0x3369('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x3369('0x3')]['import'](_0x3369('0xff'));db[_0x3369('0x100')]=db['sequelize']['import'](_0x3369('0x101'));db[_0x3369('0x102')]=db['sequelize'][_0x3369('0x14')](_0x3369('0x103'));db[_0x3369('0x104')]=db[_0x3369('0x3')]['import'](_0x3369('0x105'));db['CloudProvider']=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x106'));db[_0x3369('0x107')]=db[_0x3369('0x3')]['import'](_0x3369('0x108'));db['TeamVoicePrefix']=db[_0x3369('0x3')]['import'](_0x3369('0x109'));db[_0x3369('0x10a')]=db[_0x3369('0x3')][_0x3369('0x14')](_0x3369('0x10b'));db[_0x3369('0x10c')]=db[_0x3369('0x3')]['import'](_0x3369('0x10d'));db[_0x3369('0x13')][_0x3369('0x10e')](db[_0x3369('0x1f')],{'as':_0x3369('0x1f'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x13')]['hasOne'](db[_0x3369('0x10c')],{'as':'userSetting','onDelete':_0x3369('0x10f'),'foreignKey':'UserId'});db[_0x3369('0x13')]['hasMany'](db[_0x3369('0x1b')],{'as':_0x3369('0x111'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x13')][_0x3369('0x112')](db[_0x3369('0x2e')],{'as':_0x3369('0x113'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x13')][_0x3369('0x112')](db[_0x3369('0x17')],{'as':_0x3369('0x114'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db[_0x3369('0x13')][_0x3369('0x112')](db[_0x3369('0x78')],{'as':_0x3369('0x115'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x13')][_0x3369('0x112')](db[_0x3369('0x116')],{'as':_0x3369('0x117'),'foreignKey':'UserId'});db[_0x3369('0x13')][_0x3369('0x112')](db['ReportAgentPreview'],{'as':_0x3369('0x7b'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x13')]['hasMany'](db[_0x3369('0x5f')],{'as':'OpenchannelInteractions','foreignKey':_0x3369('0x110')});db[_0x3369('0x13')]['hasMany'](db[_0x3369('0x68')],{'as':_0x3369('0x118'),'foreignKey':'UserId'});db[_0x3369('0x13')][_0x3369('0x112')](db['SmsInteraction'],{'as':_0x3369('0x119'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x13')][_0x3369('0x112')](db['FaxInteraction'],{'as':_0x3369('0x11a'),'foreignKey':'UserId'});db[_0x3369('0x13')][_0x3369('0x112')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x3369('0x13')][_0x3369('0x112')](db[_0x3369('0x11b')],{'as':'WhatsappInteractions','foreignKey':_0x3369('0x110')});db[_0x3369('0x13')][_0x3369('0x112')](db[_0x3369('0xfa')],{'as':_0x3369('0x11c'),'foreignKey':_0x3369('0x11d')});db[_0x3369('0x13')][_0x3369('0x11e')](db[_0x3369('0xf4')],{'as':_0x3369('0xf4'),'foreignKey':_0x3369('0x11f')});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x121')],{'as':_0x3369('0x122'),'through':_0x3369('0x123')});db['User']['belongsToMany'](db[_0x3369('0x124')],{'as':_0x3369('0x125'),'through':_0x3369('0x126')});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0xf1')],{'as':'Lists','through':_0x3369('0x127')});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0xe2')],{'through':_0x3369('0x128')});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x43')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x3369('0x13')][_0x3369('0x120')](db['ChatInteraction'],{'as':_0x3369('0x118'),'through':_0x3369('0x129')});db[_0x3369('0x13')]['belongsToMany'](db[_0x3369('0x50')],{'as':_0x3369('0x11a'),'through':_0x3369('0x12a')});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x59')],{'as':_0x3369('0x119'),'through':_0x3369('0x12b')});db['User'][_0x3369('0x120')](db[_0x3369('0x5f')],{'as':_0x3369('0x12c'),'through':_0x3369('0x12d')});db['User'][_0x3369('0x120')](db[_0x3369('0x11b')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x12e')],{'as':'VoiceQueues','through':_0x3369('0x30'),'required':![]});db[_0x3369('0x13')][_0x3369('0x120')](db['VoicePrefix'],{'as':_0x3369('0x12f'),'through':_0x3369('0x10a'),'required':![]});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x40')],{'as':_0x3369('0x130'),'through':_0x3369('0x34'),'required':![]});db['User'][_0x3369('0x120')](db[_0x3369('0x6e')],{'as':_0x3369('0x131'),'through':_0x3369('0x32'),'required':![],'hooks':!![]});db['User'][_0x3369('0x120')](db[_0x3369('0x54')],{'as':_0x3369('0x132'),'through':'UserFaxQueue','required':![]});db[_0x3369('0x13')][_0x3369('0x120')](db['SmsQueue'],{'as':'SmsQueues','through':_0x3369('0x37'),'required':![]});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x62')],{'as':_0x3369('0x133'),'through':_0x3369('0x134'),'required':![]});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x104')],{'as':_0x3369('0x135'),'through':_0x3369('0x39'),'required':![]});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0xf1')],{'through':_0x3369('0x127')});db['User'][_0x3369('0x120')](db['ChatWebsite'],{'as':_0x3369('0x136'),'through':'user_has_chat_websites'});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x4c')],{'as':'FaxAccounts','through':_0x3369('0x137')});db['User'][_0x3369('0x120')](db[_0x3369('0x3e')],{'as':_0x3369('0x138'),'through':_0x3369('0x139')});db[_0x3369('0x13')][_0x3369('0x120')](db[_0x3369('0x13a')],{'as':_0x3369('0x13b'),'through':_0x3369('0x13c')});db[_0x3369('0x13')][_0x3369('0x120')](db['SmsAccount'],{'as':_0x3369('0x13d'),'through':'user_has_sms_accounts'});db[_0x3369('0x13')][_0x3369('0x120')](db['WhatsappAccount'],{'as':_0x3369('0x13e'),'through':_0x3369('0x13f')});db['User'][_0x3369('0x120')](db[_0x3369('0xde')],{'as':_0x3369('0x140'),'through':'user_has_square_projects'});db[_0x3369('0x141')]['hasMany'](db[_0x3369('0x17')],{'as':'SpiedAgents','onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x142')});db[_0x3369('0x143')][_0x3369('0x112')](db[_0x3369('0x17')],{'onDelete':_0x3369('0x10f')});db['VoiceExtension'][_0x3369('0x112')](db[_0x3369('0x17')],{'as':_0x3369('0x144'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x145')][_0x3369('0x120')](db['Sound'],{'as':_0x3369('0x146'),'through':_0x3369('0x147')});db[_0x3369('0x12e')]['hasMany'](db[_0x3369('0x2e')],{'as':'Members','foreignKey':_0x3369('0x148')});db[_0x3369('0x12e')][_0x3369('0x112')](db[_0x3369('0x149')],{'as':_0x3369('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x3369('0x12e')][_0x3369('0x112')](db['CmHopperFinal'],{'as':_0x3369('0x115'),'foreignKey':'VoiceQueueId'});db[_0x3369('0x12e')][_0x3369('0x112')](db[_0x3369('0x116')],{'as':_0x3369('0x14b'),'foreignKey':_0x3369('0x148')});db[_0x3369('0x12e')][_0x3369('0x112')](db['ReportAgentPreview'],{'as':_0x3369('0x7b'),'foreignKey':_0x3369('0x148')});db['VoiceQueue'][_0x3369('0x112')](db[_0x3369('0x77')],{'as':_0x3369('0x14c'),'foreignKey':_0x3369('0x148')});db[_0x3369('0x12e')][_0x3369('0x112')](db['JscriptySessionReport'],{'as':_0x3369('0x14d'),'foreignKey':_0x3369('0x148')});db[_0x3369('0x12e')][_0x3369('0x11e')](db[_0x3369('0x2b')],{'as':_0x3369('0x2b'),'foreignKey':_0x3369('0x14e')});db[_0x3369('0x12e')][_0x3369('0x11e')](db['Trunk'],{'as':_0x3369('0x14f'),'foreignKey':_0x3369('0x150')});db['VoiceQueue'][_0x3369('0x11e')](db[_0x3369('0x84')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x3369('0x12e')][_0x3369('0x11e')](db[_0x3369('0x86')],{'as':_0x3369('0x151'),'foreignKey':_0x3369('0x152')});db[_0x3369('0x12e')]['belongsToMany'](db['CmList'],{'as':_0x3369('0x153'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x30')});db[_0x3369('0x12e')][_0x3369('0x120')](db[_0x3369('0xe2')],{'as':_0x3369('0x155'),'through':_0x3369('0x107')});db['VoiceQueue'][_0x3369('0x120')](db[_0x3369('0xf1')],{'as':'BlackLists','through':_0x3369('0x156')});db[_0x3369('0x1b')][_0x3369('0x11e')](db['User'],{'as':'User','foreignKey':'UserId'});db['ScreenRecording'][_0x3369('0x11e')](db[_0x3369('0x13')],{'as':_0x3369('0x13'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x1f')][_0x3369('0x112')](db[_0x3369('0x21')],{'as':_0x3369('0x157'),'onDelete':_0x3369('0x10f'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x3369('0x21')][_0x3369('0x11e')](db[_0x3369('0x1f')],{'foreignKey':_0x3369('0x158'),'targetKey':_0x3369('0x159')});db[_0x3369('0x23')][_0x3369('0x112')](db['VoiceQueueReport'],{'as':_0x3369('0x15a'),'foreignKey':_0x3369('0x15b'),'constraints':![]});db[_0x3369('0x23')][_0x3369('0x112')](db[_0x3369('0x27')],{'as':_0x3369('0x15c'),'foreignKey':_0x3369('0x15b'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x3369('0x13')],{'as':'User','foreignKey':'UserId'});db[_0x3369('0x23')]['belongsTo'](db[_0x3369('0x124')],{'as':'Contact','foreignKey':'ContactId'});db[_0x3369('0x3b')]['belongsTo'](db[_0x3369('0x3e')],{'as':_0x3369('0x3e'),'foreignKey':'MailAccountId'});db[_0x3369('0x3b')][_0x3369('0x11e')](db[_0x3369('0x15d')],{'as':'CloudProvider','foreignKey':_0x3369('0x15e'),'onDelete':_0x3369('0x15f')});db[_0x3369('0x3d')][_0x3369('0x11e')](db[_0x3369('0x3e')],{'as':_0x3369('0x3e'),'foreignKey':_0x3369('0x160')});db[_0x3369('0x3d')][_0x3369('0x11e')](db['CloudProvider'],{'as':_0x3369('0x15d'),'foreignKey':_0x3369('0x15e'),'onDelete':_0x3369('0x15f')});db[_0x3369('0x3e')][_0x3369('0x10e')](db[_0x3369('0x3b')],{'as':_0x3369('0x161'),'onDelete':'cascade'});db[_0x3369('0x3e')][_0x3369('0x10e')](db[_0x3369('0x3d')],{'as':_0x3369('0x162'),'onDelete':'cascade'});db['MailAccount'][_0x3369('0x112')](db[_0x3369('0x83')],{'as':_0x3369('0x163'),'foreignKey':_0x3369('0x160'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x3e')]['hasMany'](db[_0x3369('0x81')],{'as':_0x3369('0x164'),'foreignKey':'MailAccountId'});db[_0x3369('0x3e')][_0x3369('0x112')](db[_0x3369('0x44')],{'as':_0x3369('0x157'),'foreignKey':_0x3369('0x160')});db['MailAccount'][_0x3369('0x112')](db['MailInteraction'],{'as':_0x3369('0x165')});db[_0x3369('0x3e')]['hasMany'](db[_0x3369('0x46')],{'as':'Applications'});db[_0x3369('0x3e')]['belongsTo'](db[_0x3369('0xf1')],{'as':'List','foreignKey':'ListId'});db[_0x3369('0x3e')][_0x3369('0x11e')](db[_0x3369('0x92')],{'as':_0x3369('0x92'),'foreignKey':_0x3369('0x166')});db[_0x3369('0x3e')][_0x3369('0x11e')](db[_0x3369('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x3369('0x152')});db[_0x3369('0x3e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x3369('0x139')});db[_0x3369('0x40')]['belongsToMany'](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x34')});db['MailQueue'][_0x3369('0x120')](db[_0x3369('0xe2')],{'through':_0x3369('0x167'),'as':_0x3369('0x155')});db['MailInteraction']['hasMany'](db[_0x3369('0x44')],{'as':_0x3369('0x157'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x168')});db[_0x3369('0x43')][_0x3369('0x11e')](db[_0x3369('0x3e')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x160')});db[_0x3369('0x43')][_0x3369('0x11e')](db['CmContact'],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x43')]['belongsTo'](db[_0x3369('0x13')],{'as':'Owner','foreignKey':_0x3369('0x110')});db[_0x3369('0x43')]['belongsToMany'](db[_0x3369('0x90')],{'through':_0x3369('0x16c'),'as':_0x3369('0x16d')});db[_0x3369('0x43')][_0x3369('0x120')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x3369('0x16e')});db[_0x3369('0x43')]['belongsToMany'](db[_0x3369('0x13')],{'as':'Users','through':_0x3369('0x16f'),'foreignKey':_0x3369('0x168')});db[_0x3369('0x44')]['hasMany'](db[_0x3369('0xe6')],{'as':_0x3369('0x170'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x44')][_0x3369('0x11e')](db['User'],{'as':'User'});db[_0x3369('0x44')][_0x3369('0x11e')](db[_0x3369('0x124')],{'onDelete':_0x3369('0x10f'),'as':_0x3369('0x16a')});db['MailMessage'][_0x3369('0x11e')](db[_0x3369('0x43')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x3369('0x44')][_0x3369('0x11e')](db[_0x3369('0x3e')],{'as':'Account','foreignKey':_0x3369('0x160')});db[_0x3369('0x44')]['belongsTo'](db[_0x3369('0x171')],{'as':_0x3369('0x171'),'foreignKey':'ChatWebsiteId'});db['MailMessage']['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x3369('0x172')});db['MailApplication'][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':_0x3369('0x15f')});db[_0x3369('0x46')]['belongsTo'](db[_0x3369('0x40')],{'onDelete':_0x3369('0x15f')});db['MailApplication']['belongsTo'](db[_0x3369('0x3e')],{'onDelete':'restrict'});db[_0x3369('0x46')][_0x3369('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x3369('0x173')});db['MailApplication']['belongsTo'](db[_0x3369('0x90')],{'onDelete':_0x3369('0x15f'),'foreignKey':_0x3369('0x174')});db['MailQueueReport'][_0x3369('0x11e')](db[_0x3369('0x3e')],{});db[_0x3369('0x48')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':_0x3369('0x175'),'foreignKey':_0x3369('0x176')});db['MailQueueReport'][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':'Contact','foreignKey':_0x3369('0x16b')});db[_0x3369('0x48')][_0x3369('0x11e')](db[_0x3369('0x43')],{});db[_0x3369('0x48')]['belongsTo'](db[_0x3369('0x44')],{});db[_0x3369('0x48')][_0x3369('0x11e')](db['User'],{});db[_0x3369('0x48')][_0x3369('0x11e')](db[_0x3369('0x40')],{});db[_0x3369('0x4a')][_0x3369('0x112')](db[_0x3369('0x177')],{'as':_0x3369('0x178'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x4c')][_0x3369('0x112')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x3369('0x179'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x4c')][_0x3369('0x112')](db[_0x3369('0x81')],{'as':_0x3369('0x164'),'foreignKey':_0x3369('0x179')});db['FaxAccount']['hasMany'](db[_0x3369('0x50')],{'as':_0x3369('0x165')});db[_0x3369('0x4c')][_0x3369('0x112')](db['FaxApplication'],{'as':_0x3369('0x144')});db[_0x3369('0x4c')][_0x3369('0x112')](db[_0x3369('0x17')],{'as':_0x3369('0x17a'),'onDelete':'cascade'});db[_0x3369('0x4c')][_0x3369('0x112')](db[_0x3369('0x52')],{'as':'Messages'});db['FaxAccount'][_0x3369('0x11e')](db['Trunk'],{'as':_0x3369('0x2b')});db[_0x3369('0x4c')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':_0x3369('0x175'),'foreignKey':'ListId'});db['FaxAccount'][_0x3369('0x11e')](db[_0x3369('0x86')],{'as':_0x3369('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':'user_has_fax_accounts'});db[_0x3369('0x4e')]['belongsTo'](db['User'],{'onDelete':_0x3369('0x15f')});db['FaxApplication'][_0x3369('0x11e')](db[_0x3369('0x54')],{'onDelete':_0x3369('0x15f')});db['FaxApplication'][_0x3369('0x11e')](db[_0x3369('0x4c')],{'onDelete':_0x3369('0x15f')});db[_0x3369('0x4e')]['belongsTo'](db[_0x3369('0x90')],{'onDelete':_0x3369('0x15f'),'foreignKey':'TagId'});db[_0x3369('0x50')][_0x3369('0x112')](db[_0x3369('0x52')],{'as':_0x3369('0x157'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x17b')});db['FaxInteraction'][_0x3369('0x11e')](db[_0x3369('0x4c')],{'as':'Account','foreignKey':_0x3369('0x179')});db['FaxInteraction'][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x50')][_0x3369('0x11e')](db[_0x3369('0x13')],{'as':_0x3369('0x17c'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x50')][_0x3369('0x120')](db[_0x3369('0x90')],{'through':_0x3369('0x17d'),'as':_0x3369('0x16d')});db['FaxInteraction'][_0x3369('0x120')](db['Tag'],{'through':_0x3369('0x17d'),'as':_0x3369('0x16e')});db[_0x3369('0x50')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x17e'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x3369('0x52')][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':'cascade','as':_0x3369('0x13')});db[_0x3369('0x52')]['belongsTo'](db[_0x3369('0x50')],{'as':_0x3369('0x17f'),'foreignKey':_0x3369('0x17b')});db[_0x3369('0x52')][_0x3369('0x11e')](db['CmContact'],{'onDelete':_0x3369('0x10f'),'as':_0x3369('0x16a')});db[_0x3369('0x52')][_0x3369('0x11e')](db[_0x3369('0xe6')],{'as':_0x3369('0xe6'),'foreignKey':_0x3369('0x180')});db['FaxMessage'][_0x3369('0x11e')](db[_0x3369('0x4c')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x179')});db[_0x3369('0x54')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x181')});db[_0x3369('0x54')][_0x3369('0x120')](db[_0x3369('0xe2')],{'through':'team_has_fax_queues','as':_0x3369('0x155')});db['FaxQueueReport']['belongsTo'](db['FaxAccount'],{});db[_0x3369('0x55')]['belongsTo'](db['CmList'],{'as':_0x3369('0x175'),'foreignKey':_0x3369('0x176')});db[_0x3369('0x55')][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x55')]['belongsTo'](db[_0x3369('0x50')],{});db['FaxQueueReport'][_0x3369('0x11e')](db['FaxMessage'],{});db['FaxQueueReport']['belongsTo'](db[_0x3369('0x13')],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0x3369('0x182')][_0x3369('0x112')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x3369('0x183'),'onDelete':'cascade'});db['SmsAccount'][_0x3369('0x112')](db[_0x3369('0x81')],{'as':'Answers','foreignKey':_0x3369('0x183')});db['SmsAccount'][_0x3369('0x112')](db[_0x3369('0x184')],{'as':_0x3369('0x157'),'foreignKey':'SmsAccountId'});db[_0x3369('0x182')][_0x3369('0x112')](db[_0x3369('0x59')],{'as':_0x3369('0x165')});db[_0x3369('0x182')]['hasMany'](db[_0x3369('0x57')],{'as':_0x3369('0x144')});db[_0x3369('0x182')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':_0x3369('0x175'),'foreignKey':_0x3369('0x176')});db[_0x3369('0x182')][_0x3369('0x11e')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x3369('0x182')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':'Agents','through':_0x3369('0x185')});db[_0x3369('0x57')][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':_0x3369('0x15f')});db[_0x3369('0x57')][_0x3369('0x11e')](db[_0x3369('0x5b')],{'onDelete':_0x3369('0x15f')});db[_0x3369('0x57')][_0x3369('0x11e')](db[_0x3369('0x182')],{'onDelete':_0x3369('0x15f')});db[_0x3369('0x57')][_0x3369('0x11e')](db[_0x3369('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x3369('0x57')][_0x3369('0x11e')](db[_0x3369('0x90')],{'onDelete':_0x3369('0x15f'),'foreignKey':_0x3369('0x174')});db[_0x3369('0x59')][_0x3369('0x112')](db[_0x3369('0x184')],{'as':_0x3369('0x157'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x186')});db['SmsInteraction'][_0x3369('0x11e')](db[_0x3369('0x182')],{'as':'Account','foreignKey':_0x3369('0x183')});db[_0x3369('0x59')]['belongsTo'](db[_0x3369('0x124')],{'as':'Contact','foreignKey':_0x3369('0x16b')});db[_0x3369('0x59')][_0x3369('0x11e')](db[_0x3369('0x13')],{'as':'Owner','foreignKey':_0x3369('0x110')});db[_0x3369('0x59')][_0x3369('0x120')](db[_0x3369('0x90')],{'through':_0x3369('0x187'),'as':'Tags'});db[_0x3369('0x59')][_0x3369('0x120')](db['Tag'],{'through':_0x3369('0x187'),'as':_0x3369('0x16e')});db[_0x3369('0x59')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':'Users','through':_0x3369('0x12b'),'foreignKey':_0x3369('0x186')});db[_0x3369('0x184')][_0x3369('0x11e')](db[_0x3369('0x13')],{'as':_0x3369('0x13')});db[_0x3369('0x184')][_0x3369('0x11e')](db[_0x3369('0x124')],{'onDelete':_0x3369('0x10f'),'as':_0x3369('0x16a')});db[_0x3369('0x184')][_0x3369('0x11e')](db[_0x3369('0x59')],{'onDelete':_0x3369('0x10f'),'as':_0x3369('0x17f'),'foreignKey':_0x3369('0x186')});db[_0x3369('0x184')][_0x3369('0x11e')](db[_0x3369('0x182')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x183')});db[_0x3369('0x5b')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x37'),'foreignKey':_0x3369('0x188')});db[_0x3369('0x5b')][_0x3369('0x120')](db['Team'],{'through':_0x3369('0x189'),'as':_0x3369('0x155')});db['OpenchannelAccount'][_0x3369('0x112')](db[_0x3369('0x83')],{'as':_0x3369('0x163'),'foreignKey':'OpenchannelAccountId','onDelete':_0x3369('0x10f')});db[_0x3369('0x13a')][_0x3369('0x112')](db['CannedAnswer'],{'as':_0x3369('0x164'),'foreignKey':'OpenchannelAccountId'});db[_0x3369('0x13a')]['hasMany'](db[_0x3369('0x5f')],{'as':_0x3369('0x165'),'foreignKey':_0x3369('0x18a')});db[_0x3369('0x13a')][_0x3369('0x112')](db[_0x3369('0x60')],{'as':_0x3369('0x157'),'foreignKey':_0x3369('0x18a')});db[_0x3369('0x13a')][_0x3369('0x112')](db[_0x3369('0x18b')],{'as':_0x3369('0x144'),'foreignKey':'OpenchannelAccountId'});db[_0x3369('0x13a')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':_0x3369('0x175'),'foreignKey':_0x3369('0x176')});db['OpenchannelAccount'][_0x3369('0x11e')](db[_0x3369('0x86')],{'as':_0x3369('0x151'),'foreignKey':_0x3369('0x152')});db[_0x3369('0x13a')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x3369('0x18b')][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':_0x3369('0x15f')});db[_0x3369('0x18b')][_0x3369('0x11e')](db[_0x3369('0x62')],{'onDelete':_0x3369('0x15f'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x3369('0x11e')](db[_0x3369('0x13a')],{'onDelete':_0x3369('0x15f'),'foreignKey':_0x3369('0x18a')});db['OpenchannelApplication'][_0x3369('0x11e')](db[_0x3369('0x84')],{'onDelete':'restrict','foreignKey':_0x3369('0x173')});db['OpenchannelApplication'][_0x3369('0x11e')](db[_0x3369('0x90')],{'onDelete':_0x3369('0x15f'),'foreignKey':_0x3369('0x174')});db[_0x3369('0x5f')][_0x3369('0x112')](db[_0x3369('0x60')],{'as':_0x3369('0x157'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x18c')});db[_0x3369('0x5f')][_0x3369('0x11e')](db[_0x3369('0x13a')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x18a')});db['OpenchannelInteraction'][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x5f')]['belongsTo'](db[_0x3369('0x13')],{'as':_0x3369('0x17c'),'foreignKey':'UserId'});db[_0x3369('0x5f')][_0x3369('0x120')](db['Tag'],{'through':_0x3369('0x18d'),'as':'Tags'});db[_0x3369('0x5f')][_0x3369('0x120')](db['Tag'],{'through':_0x3369('0x18d'),'as':_0x3369('0x16e')});db['OpenchannelInteraction'][_0x3369('0x120')](db[_0x3369('0x13')],{'as':'Users','through':_0x3369('0x12d'),'foreignKey':_0x3369('0x18c')});db[_0x3369('0x60')][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':'cascade','as':_0x3369('0x13')});db['OpenchannelMessage'][_0x3369('0x11e')](db[_0x3369('0x124')],{'onDelete':'cascade','as':'Contact'});db[_0x3369('0x60')][_0x3369('0x11e')](db[_0x3369('0x5f')],{'onDelete':_0x3369('0x10f'),'as':_0x3369('0x17f'),'foreignKey':_0x3369('0x18c')});db[_0x3369('0x60')]['belongsTo'](db['Attachment'],{'as':_0x3369('0xe6'),'foreignKey':_0x3369('0x180')});db[_0x3369('0x60')][_0x3369('0x11e')](db[_0x3369('0x13a')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x18a')});db['OpenchannelQueue'][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':'UserOpenchannelQueue','foreignKey':_0x3369('0x18e')});db[_0x3369('0x62')][_0x3369('0x120')](db['Team'],{'through':_0x3369('0x18f'),'as':_0x3369('0x155')});db[_0x3369('0x171')][_0x3369('0x112')](db[_0x3369('0x83')],{'as':_0x3369('0x163'),'foreignKey':'ChatWebsiteId','onDelete':_0x3369('0x10f')});db[_0x3369('0x171')][_0x3369('0x112')](db[_0x3369('0x81')],{'as':_0x3369('0x164'),'foreignKey':_0x3369('0x190')});db[_0x3369('0x171')][_0x3369('0x112')](db[_0x3369('0x71')],{'as':'ProactiveActions'});db[_0x3369('0x171')][_0x3369('0x112')](db['ChatInteraction'],{'as':_0x3369('0x165')});db['ChatWebsite']['hasMany'](db[_0x3369('0x67')],{'as':_0x3369('0x144')});db['ChatWebsite']['hasMany'](db[_0x3369('0x6a')],{'as':_0x3369('0x157')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':_0x3369('0x175'),'foreignKey':'ListId'});db[_0x3369('0x171')][_0x3369('0x11e')](db[_0x3369('0x84')],{'as':_0x3369('0x84'),'foreignKey':'IntervalId'});db[_0x3369('0x171')]['belongsTo'](db['MailAccount'],{'as':_0x3369('0x3e'),'foreignKey':_0x3369('0x160')});db[_0x3369('0x171')][_0x3369('0x11e')](db[_0x3369('0x86')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x3369('0x171')]['belongsToMany'](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x191')});db['OpenchannelQueueReport'][_0x3369('0x11e')](db[_0x3369('0x13a')],{});db[_0x3369('0x65')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':_0x3369('0x175'),'foreignKey':_0x3369('0x176')});db[_0x3369('0x65')][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x65')][_0x3369('0x11e')](db[_0x3369('0x5f')],{});db[_0x3369('0x65')][_0x3369('0x11e')](db[_0x3369('0x60')],{});db[_0x3369('0x65')][_0x3369('0x11e')](db['User'],{});db['OpenchannelQueueReport'][_0x3369('0x11e')](db[_0x3369('0x62')],{});db[_0x3369('0x67')][_0x3369('0x11e')](db[_0x3369('0x13')],{'as':'Agent','foreignKey':_0x3369('0x110'),'onDelete':'restrict'});db[_0x3369('0x67')][_0x3369('0x11e')](db[_0x3369('0x6e')],{'as':_0x3369('0x192'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0x3369('0x11e')](db[_0x3369('0x171')],{'as':_0x3369('0x193'),'foreignKey':_0x3369('0x190'),'onDelete':_0x3369('0x15f')});db[_0x3369('0x67')][_0x3369('0x11e')](db[_0x3369('0x90')],{'onDelete':_0x3369('0x15f'),'foreignKey':'TagId'});db['ChatInteraction'][_0x3369('0x112')](db[_0x3369('0x6a')],{'as':_0x3369('0x157'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x194')});db['ChatInteraction'][_0x3369('0x11e')](db[_0x3369('0x171')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x190')});db[_0x3369('0x68')][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x68')][_0x3369('0x11e')](db[_0x3369('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x3369('0x68')][_0x3369('0x120')](db['Tag'],{'through':_0x3369('0x195'),'as':_0x3369('0x16d')});db['ChatInteraction']['belongsToMany'](db[_0x3369('0x90')],{'through':_0x3369('0x195'),'as':_0x3369('0x16e')});db['ChatInteraction'][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x17e'),'through':_0x3369('0x129'),'foreignKey':_0x3369('0x194')});db[_0x3369('0x6a')][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':_0x3369('0x10f'),'as':_0x3369('0x13')});db[_0x3369('0x6a')][_0x3369('0x11e')](db[_0x3369('0x124')],{'onDelete':_0x3369('0x10f'),'as':'Contact','foreignKey':_0x3369('0x16b')});db['ChatMessage'][_0x3369('0x11e')](db[_0x3369('0x68')],{'onDelete':_0x3369('0x10f'),'as':'Interaction','foreignKey':_0x3369('0x194')});db[_0x3369('0x6a')][_0x3369('0x11e')](db[_0x3369('0xe6')],{'as':_0x3369('0xe6'),'foreignKey':_0x3369('0x180')});db[_0x3369('0x6a')][_0x3369('0x11e')](db[_0x3369('0x171')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x190')});db[_0x3369('0x6c')]['hasMany'](db['Attachment'],{'as':_0x3369('0x170'),'foreignKey':_0x3369('0x172'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db[_0x3369('0x6c')][_0x3369('0x11e')](db[_0x3369('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x3369('0x16b')});db[_0x3369('0x6c')][_0x3369('0x11e')](db[_0x3369('0x171')],{'as':'Account','foreignKey':_0x3369('0x190')});db[_0x3369('0x6e')]['belongsToMany'](db['User'],{'as':_0x3369('0x154'),'through':_0x3369('0x32'),'hooks':!![]});db[_0x3369('0x6e')][_0x3369('0x120')](db['Team'],{'through':_0x3369('0x196'),'as':_0x3369('0x155')});db[_0x3369('0x121')][_0x3369('0x112')](db[_0x3369('0x197')],{'as':_0x3369('0x157'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x3369('0x121')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x198'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0x3369('0x11e')](db['ChatWebsite'],{'as':_0x3369('0x193'),'foreignKey':_0x3369('0x190')});db[_0x3369('0x73')][_0x3369('0x112')](db['CmContact'],{'as':_0x3369('0x125'),'foreignKey':_0x3369('0x199')});db['CmContact'][_0x3369('0x112')](db[_0x3369('0x149')],{'as':_0x3369('0x14a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x124')][_0x3369('0x112')](db[_0x3369('0x78')],{'as':'HopperFinals','foreignKey':_0x3369('0x16b')});db[_0x3369('0x124')][_0x3369('0x112')](db[_0x3369('0x116')],{'as':_0x3369('0x14b'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x124')][_0x3369('0x112')](db['ReportAgentPreview'],{'as':_0x3369('0x7b'),'foreignKey':'ContactId'});db[_0x3369('0x124')]['hasMany'](db[_0x3369('0x19a')],{'as':_0x3369('0x14d'),'foreignKey':'ContactId'});db[_0x3369('0x124')][_0x3369('0x112')](db[_0x3369('0x5f')],{'as':_0x3369('0x12c'),'foreignKey':_0x3369('0x16b'),'onDelete':'restrict'});db[_0x3369('0x124')][_0x3369('0x112')](db[_0x3369('0x68')],{'as':_0x3369('0x118'),'foreignKey':_0x3369('0x16b'),'onDelete':_0x3369('0x15f')});db[_0x3369('0x124')][_0x3369('0x112')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x3369('0x16b'),'onDelete':'restrict'});db[_0x3369('0x124')][_0x3369('0x112')](db[_0x3369('0x50')],{'as':_0x3369('0x11a'),'foreignKey':_0x3369('0x16b'),'onDelete':'restrict'});db['CmContact'][_0x3369('0x112')](db[_0x3369('0x43')],{'as':'MailInteractions','foreignKey':_0x3369('0x16b'),'onDelete':_0x3369('0x15f')});db['CmContact'][_0x3369('0x11e')](db[_0x3369('0x73')],{'as':_0x3369('0x19b'),'foreignKey':'CompanyId'});db['CmContact'][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':'List','foreignKey':_0x3369('0x176'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x124')]['belongsToMany'](db[_0x3369('0x13')],{'as':_0x3369('0x17e'),'through':_0x3369('0x126')});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0x3369('0x16d'),'through':_0x3369('0x19c')});db[_0x3369('0x124')]['belongsToMany'](db[_0x3369('0x90')],{'through':_0x3369('0x19c'),'as':_0x3369('0x16e')});db['CmHopper'][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':'Contact','foreignKey':_0x3369('0x16b'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x149')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':'List','foreignKey':_0x3369('0x176'),'onDelete':'cascade'});db['CmHopper'][_0x3369('0x11e')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x3369('0x149')][_0x3369('0x11e')](db[_0x3369('0x12e')],{'as':_0x3369('0x192'),'foreignKey':_0x3369('0x148'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x149')][_0x3369('0x11e')](db['Campaign'],{'as':_0x3369('0x19d'),'foreignKey':_0x3369('0x19e'),'onDelete':'cascade'});db[_0x3369('0x149')]['belongsTo'](db[_0x3369('0x13')],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0x3369('0x77')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':'List','foreignKey':_0x3369('0x176'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x77')][_0x3369('0x11e')](db['VoiceQueue'],{'as':_0x3369('0x192'),'foreignKey':_0x3369('0x148'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x77')]['belongsTo'](db[_0x3369('0x19d')],{'as':_0x3369('0x19d'),'foreignKey':_0x3369('0x19e'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x80')][_0x3369('0x112')](db[_0x3369('0x19f')],{'as':{'plural':_0x3369('0x1a0'),'singular':_0x3369('0x1a1')},'foreignKey':_0x3369('0x1a2'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db[_0x3369('0x80')][_0x3369('0x112')](db[_0x3369('0x19f')],{'as':{'plural':_0x3369('0x1a3'),'singular':_0x3369('0x1a4')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x3369('0x80')][_0x3369('0x112')](db[_0x3369('0x7e')],{'as':_0x3369('0x1a5'),'foreignKey':_0x3369('0x1a6'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db[_0x3369('0x83')]['hasMany'](db[_0x3369('0x83')],{'as':_0x3369('0x163'),'foreignKey':_0x3369('0x1a7'),'onDelete':_0x3369('0x10f')});db[_0x3369('0x84')][_0x3369('0x112')](db[_0x3369('0x84')],{'as':_0x3369('0x1a8'),'foreignKey':_0x3369('0x173'),'onDelete':_0x3369('0x10f'),'hooks':!![],'required':![]});db[_0x3369('0x84')][_0x3369('0x112')](db['VoiceExtension'],{'as':_0x3369('0x114'),'foreignKey':_0x3369('0x173'),'onDelete':_0x3369('0x15f')});db[_0x3369('0x84')][_0x3369('0x112')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x3369('0x173')});db[_0x3369('0x84')]['hasMany'](db[_0x3369('0x67')],{'as':'ChatApplications','foreignKey':_0x3369('0x173')});db[_0x3369('0x84')][_0x3369('0x112')](db[_0x3369('0x4e')],{'as':_0x3369('0x1a9'),'foreignKey':_0x3369('0x173')});db['Interval'][_0x3369('0x112')](db['SmsApplication'],{'as':_0x3369('0x1aa'),'foreignKey':_0x3369('0x173')});db[_0x3369('0x8c')][_0x3369('0x11e')](db['MailAccount'],{});db[_0x3369('0x8c')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0x3369('0x9a')],{'foreignKey':_0x3369('0x1ab')});db['Sound'][_0x3369('0x120')](db[_0x3369('0x145')],{'as':_0x3369('0x1ac'),'through':'moh_has_sounds','onDelete':_0x3369('0x15f')});db[_0x3369('0x90')][_0x3369('0x120')](db[_0x3369('0x124')],{'through':'cm_contact_has_tags'});db[_0x3369('0x90')][_0x3369('0x120')](db[_0x3369('0x68')],{'through':_0x3369('0x195')});db[_0x3369('0x90')][_0x3369('0x120')](db[_0x3369('0x43')],{'through':_0x3369('0x16c')});db[_0x3369('0x90')][_0x3369('0x120')](db[_0x3369('0x59')],{'through':'sms_interaction_has_tags'});db[_0x3369('0x90')][_0x3369('0x120')](db[_0x3369('0x50')],{'through':_0x3369('0x17d')});db['Tag']['belongsToMany'](db[_0x3369('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0x3369('0x90')][_0x3369('0x120')](db[_0x3369('0x11b')],{'through':_0x3369('0x1ad')});db['Trigger'][_0x3369('0x112')](db[_0x3369('0x19f')],{'as':{'plural':'AllConditions','singular':_0x3369('0x1ae')},'foreignKey':_0x3369('0x1af'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db[_0x3369('0x93')][_0x3369('0x112')](db[_0x3369('0x19f')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x3369('0x1b0'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db['Trigger'][_0x3369('0x112')](db[_0x3369('0x7e')],{'as':_0x3369('0x1a5'),'foreignKey':_0x3369('0x1b1'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db[_0x3369('0x9a')]['hasMany'](db[_0x3369('0x9f')],{'as':_0x3369('0x1b2'),'onDelete':_0x3369('0x10f'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x3369('0x9c')][_0x3369('0x112')](db[_0x3369('0x9f')],{'as':_0x3369('0x1b2'),'onDelete':'cascade','foreignKey':_0x3369('0x1b3')});db[_0x3369('0x1b4')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x3369('0x1b2'),'onDelete':_0x3369('0x10f'),'foreignKey':'MetricId'});db[_0x3369('0x9f')][_0x3369('0x11e')](db[_0x3369('0x1b4')],{'foreignKey':_0x3369('0x1b5')});db[_0x3369('0xa2')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0xa3')][_0x3369('0x112')](db['SalesforceField'],{'as':_0x3369('0x1b8'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0xa3')][_0x3369('0x112')](db[_0x3369('0xa4')],{'as':_0x3369('0x1ba'),'onDelete':_0x3369('0x10f'),'foreignKey':'DescriptionId'});db[_0x3369('0xa3')][_0x3369('0x112')](db['SalesforceField'],{'as':_0x3369('0x1b2'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xa3')][_0x3369('0x11e')](db[_0x3369('0xa2')],{'as':_0x3369('0x169'),'foreignKey':'AccountId'});db[_0x3369('0xa4')][_0x3369('0x112')](db[_0x3369('0xa4')],{'as':_0x3369('0x1bc'),'foreignKey':_0x3369('0x1b9')});db['SalesforceField']['hasMany'](db[_0x3369('0xa4')],{'as':_0x3369('0x1bd'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0xa4')][_0x3369('0x112')](db[_0x3369('0xa4')],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xa4')][_0x3369('0x11e')](db[_0x3369('0x1c0')],{'as':_0x3369('0x1c0'),'foreignKey':'VariableId'});db['SugarcrmAccount']['hasMany'](db[_0x3369('0xa6')],{'as':'Configurations','onDelete':_0x3369('0x10f'),'foreignKey':'AccountId'});db['SugarcrmConfiguration']['hasMany'](db[_0x3369('0xa8')],{'as':'Subjects','onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0xa6')][_0x3369('0x112')](db['SugarcrmField'],{'as':_0x3369('0x1ba'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0xa6')]['hasMany'](db['SugarcrmField'],{'as':_0x3369('0x1b2'),'onDelete':_0x3369('0x10f'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x3369('0x11e')](db['SugarcrmAccount'],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x1b7')});db['SugarcrmField'][_0x3369('0x112')](db[_0x3369('0xa8')],{'as':_0x3369('0x1bc'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0xa8')][_0x3369('0x112')](db[_0x3369('0xa8')],{'as':'Description','foreignKey':_0x3369('0x1be')});db[_0x3369('0xa8')][_0x3369('0x112')](db[_0x3369('0xa8')],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xa8')]['belongsTo'](db[_0x3369('0x1c0')],{'as':_0x3369('0x1c0'),'foreignKey':'VariableId'});db['DeskAccount'][_0x3369('0x112')](db[_0x3369('0x1c1')],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0x1c1')]['hasMany'](db[_0x3369('0xac')],{'as':_0x3369('0x1b8'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0x1c1')][_0x3369('0x112')](db['DeskField'],{'as':'Descriptions','onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0x1c1')][_0x3369('0x112')](db[_0x3369('0xac')],{'as':'Fields','onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0x1c1')]['belongsTo'](db['DeskAccount'],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0x1c1')]['belongsToMany'](db['Tag'],{'through':_0x3369('0x1c2')});db[_0x3369('0xac')][_0x3369('0x112')](db['DeskField'],{'as':_0x3369('0x1bc'),'foreignKey':_0x3369('0x1b9')});db['DeskField'][_0x3369('0x112')](db[_0x3369('0xac')],{'as':_0x3369('0x1bd'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0xac')]['hasMany'](db[_0x3369('0xac')],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xac')][_0x3369('0x11e')](db[_0x3369('0x1c0')],{'as':_0x3369('0x1c0'),'foreignKey':_0x3369('0x1c3')});db['ZohoAccount'][_0x3369('0x112')](db[_0x3369('0xb0')],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':'AccountId'});db[_0x3369('0xb0')][_0x3369('0x112')](db[_0x3369('0xb2')],{'as':_0x3369('0x1b8'),'onDelete':'cascade','foreignKey':_0x3369('0x1b9')});db[_0x3369('0xb0')][_0x3369('0x112')](db[_0x3369('0xb2')],{'as':_0x3369('0x1ba'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0xb0')][_0x3369('0x112')](db[_0x3369('0xb2')],{'as':_0x3369('0x1b2'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xb0')][_0x3369('0x11e')](db[_0x3369('0xae')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0xb2')][_0x3369('0x112')](db[_0x3369('0xb2')],{'as':_0x3369('0x1bc'),'foreignKey':_0x3369('0x1b9')});db['ZohoField'][_0x3369('0x112')](db['ZohoField'],{'as':_0x3369('0x1bd'),'foreignKey':_0x3369('0x1be')});db['ZohoField'][_0x3369('0x112')](db[_0x3369('0xb2')],{'as':'Field','foreignKey':_0x3369('0x1bb')});db[_0x3369('0xb2')][_0x3369('0x11e')](db[_0x3369('0x1c0')],{'as':_0x3369('0x1c0'),'foreignKey':_0x3369('0x1c3')});db[_0x3369('0xb4')][_0x3369('0x112')](db[_0x3369('0xb5')],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b7')});db['ZendeskConfiguration'][_0x3369('0x112')](db[_0x3369('0xb7')],{'as':_0x3369('0x1b8'),'foreignKey':_0x3369('0x1b9')});db['ZendeskConfiguration'][_0x3369('0x112')](db[_0x3369('0xb7')],{'as':_0x3369('0x1ba'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0xb5')]['hasMany'](db[_0x3369('0xb7')],{'as':_0x3369('0x1b2'),'foreignKey':_0x3369('0x1bb')});db['ZendeskConfiguration']['belongsTo'](db[_0x3369('0xb4')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0xb5')]['belongsToMany'](db[_0x3369('0x90')],{'through':_0x3369('0x1c4')});db[_0x3369('0xb7')][_0x3369('0x112')](db[_0x3369('0xb7')],{'as':_0x3369('0x1bc'),'foreignKey':_0x3369('0x1b9')});db['ZendeskField'][_0x3369('0x112')](db[_0x3369('0xb7')],{'as':'Description','foreignKey':_0x3369('0x1be')});db[_0x3369('0xb7')][_0x3369('0x112')](db[_0x3369('0xb7')],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xb7')]['belongsTo'](db[_0x3369('0x1c0')],{'as':'Variable','foreignKey':_0x3369('0x1c3')});db[_0x3369('0xb8')][_0x3369('0x112')](db[_0x3369('0xba')],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0xba')][_0x3369('0x112')](db['FreshdeskField'],{'as':_0x3369('0x1b8'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0xba')][_0x3369('0x112')](db[_0x3369('0x1c5')],{'as':_0x3369('0x1ba'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0xba')][_0x3369('0x112')](db[_0x3369('0x1c5')],{'as':_0x3369('0x1b2'),'onDelete':_0x3369('0x10f'),'foreignKey':'FieldId'});db[_0x3369('0xba')][_0x3369('0x11e')](db[_0x3369('0xb8')],{'as':_0x3369('0x169'),'foreignKey':'AccountId'});db[_0x3369('0xba')]['belongsToMany'](db[_0x3369('0x90')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x3369('0x1c5')]['hasMany'](db[_0x3369('0x1c5')],{'as':_0x3369('0x1bc'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x3369('0x1bd'),'foreignKey':'DescriptionId'});db[_0x3369('0x1c5')][_0x3369('0x112')](db[_0x3369('0x1c5')],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0x1c5')][_0x3369('0x11e')](db['Variable'],{'as':_0x3369('0x1c0'),'foreignKey':_0x3369('0x1c3')});db[_0x3369('0xbd')][_0x3369('0x112')](db[_0x3369('0xbf')],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b7')});db['VtigerConfiguration'][_0x3369('0x112')](db[_0x3369('0xc1')],{'as':_0x3369('0x1b8'),'foreignKey':_0x3369('0x1b9')});db['VtigerConfiguration'][_0x3369('0x112')](db[_0x3369('0xc1')],{'as':'Descriptions','foreignKey':_0x3369('0x1be')});db[_0x3369('0xbf')][_0x3369('0x112')](db[_0x3369('0xc1')],{'as':'Fields','foreignKey':_0x3369('0x1bb')});db[_0x3369('0xbf')][_0x3369('0x11e')](db[_0x3369('0xbd')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0xc1')][_0x3369('0x112')](db[_0x3369('0xc1')],{'as':_0x3369('0x1bc'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0xc1')][_0x3369('0x112')](db['VtigerField'],{'as':_0x3369('0x1bd'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0xc1')][_0x3369('0x112')](db[_0x3369('0xc1')],{'as':'Field','foreignKey':_0x3369('0x1bb')});db[_0x3369('0xc1')][_0x3369('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0x3369('0x1c3')});db['ServicenowAccount']['hasMany'](db[_0x3369('0x1c6')],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0x1c6')][_0x3369('0x112')](db[_0x3369('0x1c7')],{'as':_0x3369('0x1b8'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0x1c6')][_0x3369('0x112')](db['ServicenowField'],{'as':_0x3369('0x1ba'),'foreignKey':_0x3369('0x1be')});db['ServicenowConfiguration']['hasMany'](db[_0x3369('0x1c7')],{'as':_0x3369('0x1b2'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0x1c6')][_0x3369('0x11e')](db[_0x3369('0xc2')],{'as':_0x3369('0x169'),'foreignKey':'AccountId'});db[_0x3369('0x1c7')]['hasMany'](db['ServicenowField'],{'as':_0x3369('0x1bc'),'foreignKey':'SubjectId'});db[_0x3369('0x1c7')]['hasMany'](db[_0x3369('0x1c7')],{'as':_0x3369('0x1bd'),'foreignKey':_0x3369('0x1be')});db[_0x3369('0x1c7')]['hasMany'](db[_0x3369('0x1c7')],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0x1c7')]['belongsTo'](db[_0x3369('0x1c0')],{'as':'Variable','foreignKey':_0x3369('0x1c3')});db[_0x3369('0xc5')][_0x3369('0x112')](db[_0x3369('0xc6')],{'as':_0x3369('0x1b6'),'onDelete':'cascade','foreignKey':_0x3369('0x1b7')});db['Dynamics365Account'][_0x3369('0x11e')](db[_0x3369('0x15d')],{'as':_0x3369('0x15d'),'foreignKey':_0x3369('0x15e')});db[_0x3369('0xc6')][_0x3369('0x112')](db[_0x3369('0x1c8')],{'as':_0x3369('0x1b8'),'onDelete':'cascade','foreignKey':_0x3369('0x1b9')});db[_0x3369('0xc6')][_0x3369('0x112')](db[_0x3369('0x1c8')],{'as':_0x3369('0x1ba'),'onDelete':_0x3369('0x10f'),'foreignKey':'DescriptionId'});db[_0x3369('0xc6')][_0x3369('0x112')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xc6')][_0x3369('0x11e')](db[_0x3369('0xc5')],{'as':'Account','foreignKey':_0x3369('0x1b7')});db[_0x3369('0x1c8')][_0x3369('0x112')](db['Dynamics365Field'],{'as':_0x3369('0x1bc'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0x1c8')][_0x3369('0x112')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x3369('0x1be')});db[_0x3369('0x1c8')][_0x3369('0x112')](db['Dynamics365Field'],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0x1c8')][_0x3369('0x11e')](db[_0x3369('0x1c0')],{'as':'Variable','foreignKey':'VariableId'});db['FreshsalesAccount'][_0x3369('0x112')](db[_0x3369('0xca')],{'as':_0x3369('0x1b6'),'onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0xca')][_0x3369('0x112')](db['FreshsalesField'],{'as':_0x3369('0x1b8'),'foreignKey':_0x3369('0x1b9')});db[_0x3369('0xca')][_0x3369('0x112')](db[_0x3369('0xcc')],{'as':_0x3369('0x1ba'),'foreignKey':'DescriptionId'});db[_0x3369('0xca')]['hasMany'](db[_0x3369('0xcc')],{'as':_0x3369('0x1b2'),'foreignKey':_0x3369('0x1bb')});db[_0x3369('0xca')][_0x3369('0x11e')](db[_0x3369('0xc9')],{'as':_0x3369('0x169'),'foreignKey':_0x3369('0x1b7')});db[_0x3369('0xcc')][_0x3369('0x112')](db[_0x3369('0xcc')],{'as':'Subject','foreignKey':_0x3369('0x1b9')});db[_0x3369('0xcc')][_0x3369('0x112')](db[_0x3369('0xcc')],{'as':'Description','foreignKey':_0x3369('0x1be')});db[_0x3369('0xcc')][_0x3369('0x112')](db[_0x3369('0xcc')],{'as':_0x3369('0x1bf'),'foreignKey':_0x3369('0x1bb')});db['FreshsalesField'][_0x3369('0x11e')](db[_0x3369('0x1c0')],{'as':'Variable','foreignKey':_0x3369('0x1c3')});db[_0x3369('0xcf')]['belongsTo'](db[_0x3369('0x171')],{});db[_0x3369('0xcf')]['belongsTo'](db[_0x3369('0xf1')],{'as':'List','foreignKey':'ListId'});db[_0x3369('0xcf')][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0xcf')][_0x3369('0x11e')](db[_0x3369('0x68')],{});db['ChatQueueReport'][_0x3369('0x11e')](db[_0x3369('0x6a')],{});db[_0x3369('0xcf')][_0x3369('0x11e')](db[_0x3369('0x13')],{});db['ChatQueueReport'][_0x3369('0x11e')](db[_0x3369('0x6e')],{});db[_0x3369('0x197')][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':_0x3369('0x10f'),'foreignKey':'FromId'});db[_0x3369('0x197')][_0x3369('0x11e')](db[_0x3369('0x13')],{'onDelete':'cascade','foreignKey':_0x3369('0x1c9')});db[_0x3369('0x19a')][_0x3369('0x112')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x3369('0x10f')});db['JscriptySessionReport'][_0x3369('0x112')](db[_0x3369('0xd1')],{'foreignKey':'SessionId','onDelete':_0x3369('0x10f')});db[_0x3369('0xd6')][_0x3369('0x11e')](db[_0x3369('0x182')],{});db[_0x3369('0xd6')][_0x3369('0x11e')](db['CmList'],{'as':_0x3369('0x175'),'foreignKey':_0x3369('0x176')});db['SmsQueueReport']['belongsTo'](db[_0x3369('0x124')],{'as':'Contact','foreignKey':_0x3369('0x16b')});db[_0x3369('0xd6')][_0x3369('0x11e')](db[_0x3369('0x59')],{});db['SmsQueueReport'][_0x3369('0x11e')](db['SmsMessage'],{});db[_0x3369('0xd6')][_0x3369('0x11e')](db[_0x3369('0x13')],{});db[_0x3369('0xd6')][_0x3369('0x11e')](db[_0x3369('0x5b')],{});db[_0x3369('0x1ca')][_0x3369('0x112')](db[_0x3369('0x19a')],{'foreignKey':_0x3369('0x1cb')});db['JscriptyProject'][_0x3369('0x112')](db[_0x3369('0xd3')],{'foreignKey':_0x3369('0x1cb')});db[_0x3369('0x1ca')][_0x3369('0x112')](db[_0x3369('0xd1')],{'foreignKey':_0x3369('0x1cb')});db[_0x3369('0xde')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x17e'),'through':_0x3369('0x1cc')});db[_0x3369('0xe2')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':'user_has_teams'});db[_0x3369('0xe2')]['belongsToMany'](db['VoiceQueue'],{'through':_0x3369('0x107'),'as':'VoiceQueues'});db[_0x3369('0xe2')][_0x3369('0x120')](db['MailQueue'],{'through':_0x3369('0x167'),'as':_0x3369('0x130')});db['Team']['belongsToMany'](db[_0x3369('0x6e')],{'through':'team_has_chat_queues','as':_0x3369('0x131')});db[_0x3369('0xe2')][_0x3369('0x120')](db[_0x3369('0x54')],{'through':_0x3369('0x1cd'),'as':_0x3369('0x132')});db['Team'][_0x3369('0x120')](db[_0x3369('0x5b')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x3369('0xe2')][_0x3369('0x120')](db[_0x3369('0x62')],{'through':_0x3369('0x18f'),'as':_0x3369('0x133')});db[_0x3369('0xe2')]['belongsToMany'](db[_0x3369('0x104')],{'through':'team_has_whatsapp_queues','as':_0x3369('0x135')});db[_0x3369('0xe2')][_0x3369('0x120')](db[_0x3369('0xf3')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x3369('0x19d')]['hasMany'](db[_0x3369('0x149')],{'as':'Hoppers','foreignKey':_0x3369('0x19e')});db[_0x3369('0x19d')][_0x3369('0x112')](db[_0x3369('0x78')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x3369('0x19d')]['hasMany'](db[_0x3369('0x116')],{'as':_0x3369('0x14b'),'foreignKey':_0x3369('0x19e')});db[_0x3369('0x19d')]['hasMany'](db[_0x3369('0x77')],{'as':_0x3369('0x14c'),'foreignKey':_0x3369('0x19e')});db['Campaign'][_0x3369('0x11e')](db['Trunk'],{'as':_0x3369('0x2b'),'foreignKey':'TrunkId'});db[_0x3369('0x19d')]['belongsTo'](db[_0x3369('0x2b')],{'as':_0x3369('0x14f'),'foreignKey':_0x3369('0x150')});db[_0x3369('0x19d')]['belongsTo'](db[_0x3369('0x84')],{'as':_0x3369('0x84'),'foreignKey':'IntervalId'});db['Campaign'][_0x3369('0x11e')](db['SquareProject'],{'as':_0x3369('0xde'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x3369('0x120')](db[_0x3369('0xf1')],{'as':_0x3369('0x153'),'through':'campaigns_has_cm_lists'});db[_0x3369('0x19d')][_0x3369('0x120')](db[_0x3369('0xf1')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['Attachment']['belongsTo'](db[_0x3369('0x6c')],{'as':'ChatOfflineMessage','foreignKey':_0x3369('0x172')});db[_0x3369('0xe9')][_0x3369('0x11e')](db[_0x3369('0x44')],{});db[_0x3369('0xe9')][_0x3369('0x11e')](db[_0x3369('0x43')],{});db[_0x3369('0xe9')][_0x3369('0x11e')](db[_0x3369('0x3e')],{'foreignKey':_0x3369('0x1ce'),'as':_0x3369('0x1cf')});db[_0x3369('0xe9')][_0x3369('0x11e')](db[_0x3369('0x13')],{'foreignKey':_0x3369('0x1d0'),'as':_0x3369('0x1d1')});db[_0x3369('0xe9')]['belongsTo'](db[_0x3369('0x13')],{'foreignKey':_0x3369('0x1d2'),'as':_0x3369('0x1d3')});db[_0x3369('0xe9')][_0x3369('0x11e')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x3369('0x1d4')});db['MailTransferReport'][_0x3369('0x11e')](db[_0x3369('0x3e')],{'foreignKey':_0x3369('0x1d5'),'as':_0x3369('0x1d6')});db[_0x3369('0xea')][_0x3369('0x11e')](db[_0x3369('0x6a')],{});db['ChatTransferReport'][_0x3369('0x11e')](db[_0x3369('0x68')],{});db[_0x3369('0xea')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x3369('0x1d7'),'as':_0x3369('0x1cf')});db[_0x3369('0xea')][_0x3369('0x11e')](db[_0x3369('0x13')],{'foreignKey':_0x3369('0x1d0'),'as':_0x3369('0x1d1')});db[_0x3369('0xea')]['belongsTo'](db[_0x3369('0x13')],{'foreignKey':_0x3369('0x1d2'),'as':_0x3369('0x1d3')});db[_0x3369('0xea')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x3369('0x1d8'),'as':_0x3369('0x1d4')});db[_0x3369('0xea')][_0x3369('0x11e')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x3369('0x1d6')});db['FaxTransferReport'][_0x3369('0x11e')](db[_0x3369('0x52')],{});db[_0x3369('0xeb')][_0x3369('0x11e')](db[_0x3369('0x50')],{});db[_0x3369('0xeb')][_0x3369('0x11e')](db[_0x3369('0x4c')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x3369('0xeb')][_0x3369('0x11e')](db[_0x3369('0x13')],{'foreignKey':_0x3369('0x1d0'),'as':'FromAgent'});db[_0x3369('0xeb')][_0x3369('0x11e')](db['User'],{'foreignKey':_0x3369('0x1d2'),'as':_0x3369('0x1d3')});db[_0x3369('0xeb')][_0x3369('0x11e')](db[_0x3369('0x54')],{'foreignKey':_0x3369('0x1d9'),'as':_0x3369('0x1d4')});db[_0x3369('0xeb')]['belongsTo'](db[_0x3369('0x4c')],{'foreignKey':'ToFaxAccountId','as':_0x3369('0x1d6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x3369('0x60')],{});db['OpenchannelTransferReport'][_0x3369('0x11e')](db[_0x3369('0x5f')],{});db[_0x3369('0xed')]['belongsTo'](db[_0x3369('0x13a')],{'foreignKey':_0x3369('0x1da'),'as':'FromAccount'});db[_0x3369('0xed')][_0x3369('0x11e')](db['User'],{'foreignKey':'FromUserId','as':_0x3369('0x1d1')});db[_0x3369('0xed')][_0x3369('0x11e')](db['User'],{'foreignKey':_0x3369('0x1d2'),'as':_0x3369('0x1d3')});db['OpenchannelTransferReport'][_0x3369('0x11e')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x3369('0x1d4')});db[_0x3369('0xed')][_0x3369('0x11e')](db[_0x3369('0x13a')],{'foreignKey':_0x3369('0x1db'),'as':_0x3369('0x1d6')});db['SmsTransferReport'][_0x3369('0x11e')](db[_0x3369('0x184')],{});db['SmsTransferReport'][_0x3369('0x11e')](db[_0x3369('0x59')],{});db[_0x3369('0xef')]['belongsTo'](db[_0x3369('0x182')],{'foreignKey':_0x3369('0x1dc'),'as':_0x3369('0x1cf')});db[_0x3369('0xef')][_0x3369('0x11e')](db[_0x3369('0x13')],{'foreignKey':_0x3369('0x1d0'),'as':'FromAgent'});db[_0x3369('0xef')][_0x3369('0x11e')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport'][_0x3369('0x11e')](db[_0x3369('0x5b')],{'foreignKey':'ToSmsQueueId','as':_0x3369('0x1d4')});db[_0x3369('0xef')][_0x3369('0x11e')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x3369('0x83')],{'as':_0x3369('0x163'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x3369('0xf1')][_0x3369('0x112')](db[_0x3369('0x7c')],{'as':_0x3369('0x1dd'),'foreignKey':_0x3369('0x176')});db[_0x3369('0xf1')][_0x3369('0x112')](db['CmContact'],{'as':'Contacts','onDelete':_0x3369('0x10f'),'foreignKey':_0x3369('0x176')});db[_0x3369('0xf1')][_0x3369('0x112')](db[_0x3369('0x78')],{'as':_0x3369('0x115'),'foreignKey':_0x3369('0x176')});db['CmList'][_0x3369('0x112')](db[_0x3369('0x116')],{'as':_0x3369('0x117'),'foreignKey':_0x3369('0x176')});db[_0x3369('0xf1')][_0x3369('0x112')](db[_0x3369('0x7b')],{'as':_0x3369('0x7b'),'foreignKey':_0x3369('0x176')});db['CmList'][_0x3369('0x120')](db[_0x3369('0x12e')],{'as':_0x3369('0x1de'),'through':_0x3369('0x1df')});db[_0x3369('0xf1')]['belongsToMany'](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x127')});db[_0x3369('0xf3')][_0x3369('0x112')](db[_0x3369('0x17')],{'as':'Extensions','onDelete':_0x3369('0x10f')});db[_0x3369('0xf3')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x3369('0x10a')});db[_0x3369('0xf3')][_0x3369('0x120')](db[_0x3369('0xe2')],{'through':_0x3369('0x1e0'),'as':'Teams'});db['UserProfile'][_0x3369('0x112')](db[_0x3369('0x13')],{'as':_0x3369('0x17e'),'foreignKey':_0x3369('0x11f')});db[_0x3369('0xf4')][_0x3369('0x112')](db[_0x3369('0xf6')],{'as':_0x3369('0x1e1'),'foreignKey':_0x3369('0x11f'),'onDelete':'cascade'});db[_0x3369('0xf6')]['hasMany'](db[_0x3369('0xf8')],{'as':_0x3369('0x1e2'),'foreignKey':'sectionId','onDelete':_0x3369('0x10f')});db['WhatsappAccount'][_0x3369('0x112')](db['Disposition'],{'as':_0x3369('0x163'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x3369('0xfc')][_0x3369('0x112')](db[_0x3369('0x81')],{'as':'Answers','foreignKey':_0x3369('0x1e3')});db['WhatsappAccount'][_0x3369('0x112')](db['WhatsappMessage'],{'as':_0x3369('0x157'),'foreignKey':_0x3369('0x1e3')});db[_0x3369('0xfc')][_0x3369('0x112')](db[_0x3369('0x11b')],{'as':'Interactions'});db[_0x3369('0xfc')][_0x3369('0x112')](db[_0x3369('0xfe')],{'as':_0x3369('0x144')});db[_0x3369('0xfc')][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':_0x3369('0x175'),'foreignKey':'ListId'});db[_0x3369('0xfc')][_0x3369('0x11e')](db[_0x3369('0x86')],{'as':_0x3369('0x151'),'foreignKey':_0x3369('0x152')});db[_0x3369('0xfc')][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x13f')});db[_0x3369('0xfe')][_0x3369('0x11e')](db['User'],{'onDelete':'restrict'});db[_0x3369('0xfe')][_0x3369('0x11e')](db[_0x3369('0x104')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x3369('0x11e')](db['WhatsappAccount'],{'onDelete':_0x3369('0x15f')});db[_0x3369('0xfe')][_0x3369('0x11e')](db['Interval'],{'onDelete':_0x3369('0x15f'),'foreignKey':_0x3369('0x173')});db['WhatsappApplication'][_0x3369('0x11e')](db[_0x3369('0x90')],{'onDelete':_0x3369('0x15f'),'foreignKey':_0x3369('0x174')});db[_0x3369('0x11b')][_0x3369('0x112')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x3369('0x10f'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0x3369('0x11e')](db[_0x3369('0xfc')],{'as':'Account','foreignKey':_0x3369('0x1e3')});db[_0x3369('0x11b')][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':'ContactId'});db[_0x3369('0x11b')][_0x3369('0x11e')](db['User'],{'as':_0x3369('0x17c'),'foreignKey':_0x3369('0x110')});db[_0x3369('0x11b')][_0x3369('0x120')](db[_0x3369('0x90')],{'through':_0x3369('0x1ad'),'as':_0x3369('0x16d')});db[_0x3369('0x11b')][_0x3369('0x120')](db[_0x3369('0x90')],{'through':_0x3369('0x1ad'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x17e'),'through':_0x3369('0x1e4'),'foreignKey':_0x3369('0x1e5')});db[_0x3369('0x1e6')][_0x3369('0x11e')](db[_0x3369('0x13')],{'as':_0x3369('0x13')});db[_0x3369('0x1e6')]['belongsTo'](db[_0x3369('0x124')],{'onDelete':_0x3369('0x10f'),'as':'Contact'});db[_0x3369('0x1e6')][_0x3369('0x11e')](db[_0x3369('0x11b')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x3369('0x1e5')});db[_0x3369('0x1e6')][_0x3369('0x11e')](db[_0x3369('0xfc')],{'as':_0x3369('0x169'),'foreignKey':'WhatsappAccountId'});db[_0x3369('0x100')]['belongsTo'](db[_0x3369('0xfc')],{});db['WhatsappQueueReport'][_0x3369('0x11e')](db[_0x3369('0xf1')],{'as':_0x3369('0x175'),'foreignKey':'ListId'});db[_0x3369('0x100')][_0x3369('0x11e')](db[_0x3369('0x124')],{'as':_0x3369('0x16a'),'foreignKey':_0x3369('0x16b')});db[_0x3369('0x100')][_0x3369('0x11e')](db[_0x3369('0x11b')],{});db[_0x3369('0x100')]['belongsTo'](db[_0x3369('0x104')],{});db[_0x3369('0x100')][_0x3369('0x11e')](db[_0x3369('0x1e6')],{});db[_0x3369('0x100')][_0x3369('0x11e')](db[_0x3369('0x13')],{});db['WhatsappTransferReport'][_0x3369('0x11e')](db[_0x3369('0x1e6')],{});db[_0x3369('0x102')]['belongsTo'](db[_0x3369('0x11b')],{});db[_0x3369('0x102')][_0x3369('0x11e')](db[_0x3369('0xfc')],{'foreignKey':_0x3369('0x1e7'),'as':_0x3369('0x1cf')});db[_0x3369('0x102')]['belongsTo'](db[_0x3369('0xfc')],{'foreignKey':'ToWhatsappAccountId','as':_0x3369('0x1d6')});db[_0x3369('0x102')][_0x3369('0x11e')](db[_0x3369('0x104')],{'foreignKey':'ToQueueId','as':_0x3369('0x1d4')});db[_0x3369('0x102')][_0x3369('0x11e')](db[_0x3369('0x13')],{'foreignKey':'FromUserId','as':_0x3369('0x1d1')});db[_0x3369('0x102')]['belongsTo'](db['User'],{'foreignKey':_0x3369('0x1d2'),'as':'ToAgent'});db['WhatsappQueue'][_0x3369('0x120')](db[_0x3369('0x13')],{'as':_0x3369('0x154'),'through':_0x3369('0x39'),'foreignKey':_0x3369('0x1e8')});db['WhatsappQueue'][_0x3369('0x120')](db[_0x3369('0xe2')],{'through':_0x3369('0x1e9'),'as':_0x3369('0x155')});db['UserSetting'][_0x3369('0x11e')](db['User'],{'as':_0x3369('0x1ea'),'foreignKey':_0x3369('0x110'),'onDelete':_0x3369('0x10f'),'hooks':!![]});db['CloudProvider'][_0x3369('0x10e')](db[_0x3369('0xc5')],{'as':_0x3369('0xc5'),'onDelete':'restrict'});db['CloudProvider'][_0x3369('0x10e')](db[_0x3369('0x3b')],{'as':_0x3369('0x161'),'onDelete':'restrict'});db[_0x3369('0x15d')]['hasOne'](db[_0x3369('0x3d')],{'as':_0x3369('0x162'),'onDelete':'restrict'});module[_0x3369('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 30d2f82..eb3143c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f47=['/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/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/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','express','./errors','./utils/client-side-logger','./api/client-side-logs','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/interactions','./api/openchannelInteraction'];(function(_0x514991,_0x319f52){var _0x158640=function(_0xbea5af){while(--_0xbea5af){_0x514991['push'](_0x514991['shift']());}};_0x158640(++_0x319f52);}(_0x6f47,0xc7));var _0x76f4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x6f47[_0xf50820];return _0x2a9b10;};'use strict';var path=require('path');var express=require(_0x76f4('0x0'));var errors=require(_0x76f4('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x76f4('0x2'))['setupLoggers'];var clientSideLogs=require(_0x76f4('0x3'));exports['default']=function(_0xe214ad){return setupLoggers(_0xe214ad)[_0x76f4('0x4')](function(){_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6'),require('./api/user'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7'),require(_0x76f4('0x8')));_0xe214ad['use'](_0x76f4('0x9'),require(_0x76f4('0xa')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb'),require(_0x76f4('0xc')));_0xe214ad['use']('/api/voice/mohs',require(_0x76f4('0xd')));_0xe214ad[_0x76f4('0x5')]('/api/voice/queues',require('./api/voiceQueue'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe'),require(_0x76f4('0xf')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x10'),require(_0x76f4('0x11')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x12'),require(_0x76f4('0x13')));_0xe214ad['use'](_0x76f4('0x14'),require(_0x76f4('0x15')));_0xe214ad['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x16'),require(_0x76f4('0x17')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x18'),require(_0x76f4('0x19')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1a'),require(_0x76f4('0x1b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1c'),require(_0x76f4('0x1d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x1e'),require(_0x76f4('0x1f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x20'),require(_0x76f4('0x21')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x22'),require(_0x76f4('0x23')));_0xe214ad[_0x76f4('0x5')]('/api/mail/accounts',require(_0x76f4('0x24')));_0xe214ad['use'](_0x76f4('0x25'),require(_0x76f4('0x26')));_0xe214ad[_0x76f4('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0xe214ad['use'](_0x76f4('0x27'),require(_0x76f4('0x28')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x29'),require(_0x76f4('0x2a')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2b'),require('./api/mailApplication'));_0xe214ad['use'](_0x76f4('0x2c'),require('./api/mailQueueReport'));_0xe214ad[_0x76f4('0x5')]('/api/dashboards',require('./api/dashboard'));_0xe214ad['use'](_0x76f4('0x2d'),require(_0x76f4('0x2e')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x2f'),require(_0x76f4('0x30')));_0xe214ad[_0x76f4('0x5')]('/api/fax/applications',require(_0x76f4('0x31')));_0xe214ad['use']('/api/fax/interactions',require('./api/faxInteraction'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x32'),require(_0x76f4('0x33')));_0xe214ad[_0x76f4('0x5')]('/api/fax/queues',require(_0x76f4('0x34')));_0xe214ad['use'](_0x76f4('0x35'),require(_0x76f4('0x36')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x37'),require(_0x76f4('0x38')));_0xe214ad['use']('/api/sms/applications',require(_0x76f4('0x39')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3a'),require(_0x76f4('0x3b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3c'),require(_0x76f4('0x3d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x3e'),require(_0x76f4('0x3f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x40'),require('./api/openchannelAccount'));_0xe214ad['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x41'),require(_0x76f4('0x42')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x43'),require('./api/openchannelMessage'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x44'),require(_0x76f4('0x45')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x46'),require(_0x76f4('0x47')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x48'),require(_0x76f4('0x49')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4a'),require(_0x76f4('0x4b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4c'),require(_0x76f4('0x4d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x4e'),require(_0x76f4('0x4f')));_0xe214ad['use'](_0x76f4('0x50'),require(_0x76f4('0x51')));_0xe214ad[_0x76f4('0x5')]('/api/chat/queues',require('./api/chatQueue'));_0xe214ad[_0x76f4('0x5')]('/api/chat/groups',require(_0x76f4('0x52')));_0xe214ad['use'](_0x76f4('0x53'),require(_0x76f4('0x54')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x55'),require(_0x76f4('0x56')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x57'),require(_0x76f4('0x58')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x59'),require('./api/cmHopper'));_0xe214ad['use'](_0x76f4('0x5a'),require(_0x76f4('0x5b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5c'),require(_0x76f4('0x5d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x5e'),require(_0x76f4('0x5f')));_0xe214ad[_0x76f4('0x5')]('/api/cm/custom_fields',require(_0x76f4('0x60')));_0xe214ad[_0x76f4('0x5')]('/api/actions',require('./api/action'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x61'),require(_0x76f4('0x62')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x63'),require('./api/cannedAnswer'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x64'),require(_0x76f4('0x65')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x66'),require(_0x76f4('0x67')));_0xe214ad['use'](_0x76f4('0x68'),require(_0x76f4('0x69')));_0xe214ad[_0x76f4('0x5')]('/api/pauses',require('./api/pause'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6a'),require(_0x76f4('0x6b')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6c'),require('./api/voiceQueuesLog'));_0xe214ad['use'](_0x76f4('0x6d'),require('./api/schedule'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x6e'),require('./api/sound'));_0xe214ad['use'](_0x76f4('0x6f'),require(_0x76f4('0x70')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x71'),require('./api/template'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x72'),require(_0x76f4('0x73')));_0xe214ad['use'](_0x76f4('0x74'),require(_0x76f4('0x75')));_0xe214ad['use']('/api/integrations',require(_0x76f4('0x76')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x77'),require(_0x76f4('0x78')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/custom_reports',require(_0x76f4('0x79')));_0xe214ad['use'](_0x76f4('0x7a'),require(_0x76f4('0x7b')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/extracted_reports',require(_0x76f4('0x7c')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/metrics',require(_0x76f4('0x7d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x7e'),require(_0x76f4('0x7f')));_0xe214ad[_0x76f4('0x5')]('/api/analytics/tree_reports',require(_0x76f4('0x80')));_0xe214ad['use'](_0x76f4('0x81'),require(_0x76f4('0x82')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/salesforce/configurations',require(_0x76f4('0x83')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x84'),require(_0x76f4('0x85')));_0xe214ad['use'](_0x76f4('0x86'),require(_0x76f4('0x87')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x88'),require('./api/intSugarcrmConfiguration'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/sugarcrm/fields',require(_0x76f4('0x89')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8a'),require(_0x76f4('0x8b')));_0xe214ad['use'](_0x76f4('0x8c'),require(_0x76f4('0x8d')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x8e'),require('./api/intZohoConfiguration'));_0xe214ad['use'](_0x76f4('0x8f'),require(_0x76f4('0x90')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x91'),require(_0x76f4('0x92')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x93'),require(_0x76f4('0x94')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0xe214ad['use'](_0x76f4('0x95'),require(_0x76f4('0x96')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x97'),require('./api/intFreshdeskConfiguration'));_0xe214ad['use'](_0x76f4('0x98'),require('./api/intFreshdeskField'));_0xe214ad[_0x76f4('0x5')]('/api/integrations/vtiger/accounts',require(_0x76f4('0x99')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9a'),require(_0x76f4('0x9b')));_0xe214ad['use'](_0x76f4('0x9c'),require(_0x76f4('0x9d')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x9e'),require(_0x76f4('0x9f')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa0'),require('./api/intServicenowConfiguration'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa1'),require(_0x76f4('0xa2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa3'),require(_0x76f4('0xa4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xa5'),require('./api/intDynamics365Configuration'));_0xe214ad['use'](_0x76f4('0xa6'),require(_0x76f4('0xa7')));_0xe214ad[_0x76f4('0x5')]('/api/integrations/freshsales/accounts',require(_0x76f4('0xa8')));_0xe214ad['use'](_0x76f4('0xa9'),require(_0x76f4('0xaa')));_0xe214ad['use'](_0x76f4('0xab'),require(_0x76f4('0xac')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xad'),require(_0x76f4('0xae')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xaf'),require(_0x76f4('0xb0')));_0xe214ad[_0x76f4('0x5')]('/api/chat/internal/messages',require(_0x76f4('0xb1')));_0xe214ad['use'](_0x76f4('0xb2'),require(_0x76f4('0xb3')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb4'),require(_0x76f4('0xb5')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb6'),require(_0x76f4('0xb7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb8'),require('./api/smsQueueReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xb9'),require('./api/squareReport'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xba'),require(_0x76f4('0xbb')));_0xe214ad['use'](_0x76f4('0xbc'),require(_0x76f4('0xbd')));_0xe214ad[_0x76f4('0x5')]('/api/settings',require(_0x76f4('0xbe')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xbf'),require(_0x76f4('0xc0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc1'),require(_0x76f4('0xc2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc3'),require('./api/squareRecording'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc4'),require(_0x76f4('0xc5')));_0xe214ad[_0x76f4('0x5')]('/api/teams',require(_0x76f4('0xc6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc7'),require('./api/license'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xc8'),require(_0x76f4('0xc9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xca'),require('./api/migration'));_0xe214ad[_0x76f4('0x5')]('/api/attachments',require(_0x76f4('0xcb')));_0xe214ad[_0x76f4('0x5')]('/api/plugins',require('./api/plugin'));_0xe214ad['use'](_0x76f4('0xcc'),require(_0x76f4('0xcd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xce'),require(_0x76f4('0xcf')));_0xe214ad[_0x76f4('0x5')]('/api/fax/reports/transfer',require(_0x76f4('0xd0')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd1'),require(_0x76f4('0xd2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd3'),require(_0x76f4('0xd4')));_0xe214ad[_0x76f4('0x5')]('/api/cm/lists',require(_0x76f4('0xd5')));_0xe214ad['use'](_0x76f4('0xd6'),require(_0x76f4('0xd7')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xd8'),require(_0x76f4('0xd9')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xda'),require(_0x76f4('0xdb')));_0xe214ad['use'](_0x76f4('0xdc'),require('./api/userProfileResource'));_0xe214ad['use']('/api/userNotifications',require(_0x76f4('0xdd')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xde'),require(_0x76f4('0xdf')));_0xe214ad['use'](_0x76f4('0xe0'),require(_0x76f4('0xe1')));_0xe214ad[_0x76f4('0x5')]('/api/whatsapp/interactions',require(_0x76f4('0xe2')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe3'),require(_0x76f4('0xe4')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xe5'),require(_0x76f4('0xe6')));_0xe214ad['use'](_0x76f4('0xe7'),require(_0x76f4('0xe8')));_0xe214ad['use'](_0x76f4('0xe9'),require(_0x76f4('0xea')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xeb'),require(_0x76f4('0xec')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xed'),require(_0x76f4('0xee')));_0xe214ad[_0x76f4('0x5')]('/api/user-settings',require(_0x76f4('0xef')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf0'),require(_0x76f4('0xf1')));_0xe214ad['use'](_0x76f4('0xf2'),require('./api/authGoogle'));_0xe214ad[_0x76f4('0x5')]('/api/auth/activedirectory',require(_0x76f4('0xf3')));_0xe214ad[_0x76f4('0x5')]('/api/jira',require('./api/jira'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf4'),require(_0x76f4('0xf5')));_0xe214ad['use']('/api/version',require(_0x76f4('0xf6')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf7'),require(_0x76f4('0xf8')));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xf9'),require(_0x76f4('0xfa')));_0xe214ad[_0x76f4('0x5')]('/api/webbar',require('./api/webbar'));_0xe214ad[_0x76f4('0x5')](_0x76f4('0xfb'),clientSideLogs);_0xe214ad[_0x76f4('0x5')]('/apidoc',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0xff'))));_0xe214ad[_0x76f4('0x5')](_0x76f4('0x100'),express[_0x76f4('0xfc')](path['join'](config[_0x76f4('0xfe')],_0x76f4('0x100'))));_0xe214ad[_0x76f4('0x5')]('/demo',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],_0x76f4('0x101'))));_0xe214ad['use'](_0x76f4('0x102'),express['static'](path[_0x76f4('0xfd')](config['root'],_0x76f4('0x103'),_0x76f4('0x104'))));_0xe214ad[_0x76f4('0x5')]('/plugins',express[_0x76f4('0xfc')](path[_0x76f4('0xfd')](config[_0x76f4('0xfe')],'/server/files/plugins')));_0xe214ad[_0x76f4('0x105')](_0x76f4('0x106'))['get'](errors[0x194]);_0xe214ad['route']('/*')[_0x76f4('0x107')](function(_0x39afa3,_0x515cfe){_0x515cfe['sendFile'](path[_0x76f4('0x108')](_0xe214ad[_0x76f4('0x107')]('appPath')+_0x76f4('0x109')));});return _0xe214ad;});}; \ No newline at end of file +var _0x24ca=['/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/logs','join','/www','static','root','/demo','snippet','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','/index.html','path','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x24ca,0x1bc));var _0xa24c=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0x24ca[_0x325501];return _0x2c1626;};'use strict';var path=require(_0xa24c('0x0'));var express=require('express');var errors=require(_0xa24c('0x1'));var config=require(_0xa24c('0x2'));var setupLoggers=require(_0xa24c('0x3'))['setupLoggers'];var clientSideLogs=require(_0xa24c('0x4'));exports[_0xa24c('0x5')]=function(_0x195e60){return setupLoggers(_0x195e60)[_0xa24c('0x6')](function(){_0x195e60[_0xa24c('0x7')](_0xa24c('0x8'),require(_0xa24c('0x9')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xa'),require(_0xa24c('0xb')));_0x195e60[_0xa24c('0x7')]('/api/voice/contexts',require(_0xa24c('0xc')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xd'),require('./api/voiceExtension'));_0x195e60[_0xa24c('0x7')](_0xa24c('0xe'),require(_0xa24c('0xf')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x10'),require(_0xa24c('0x11')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x12'),require(_0xa24c('0x13')));_0x195e60['use'](_0xa24c('0x14'),require(_0xa24c('0x15')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x16'),require('./api/voiceMail'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x17'),require(_0xa24c('0x18')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x19'),require(_0xa24c('0x1a')));_0x195e60[_0xa24c('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x1b'),require('./api/voiceAgentReport'));_0x195e60['use'](_0xa24c('0x1c'),require(_0xa24c('0x1d')));_0x195e60['use'](_0xa24c('0x1e'),require('./api/memberReport'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x1f'),require(_0xa24c('0x20')));_0x195e60[_0xa24c('0x7')]('/api/voice/transfers/reports',require(_0xa24c('0x21')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x22'),require('./api/mailServerOut'));_0x195e60['use']('/api/mail/accounts',require('./api/mailAccount'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x23'),require(_0xa24c('0x24')));_0x195e60[_0xa24c('0x7')]('/api/mail/substatuses',require(_0xa24c('0x25')));_0x195e60['use'](_0xa24c('0x26'),require(_0xa24c('0x27')));_0x195e60['use'](_0xa24c('0x28'),require(_0xa24c('0x29')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x2a'),require(_0xa24c('0x2b')));_0x195e60['use'](_0xa24c('0x2c'),require('./api/mailQueueReport'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x2d'),require(_0xa24c('0x2e')));_0x195e60['use'](_0xa24c('0x2f'),require(_0xa24c('0x30')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x31'),require(_0xa24c('0x32')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x33'),require('./api/faxApplication'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x34'),require(_0xa24c('0x35')));_0x195e60[_0xa24c('0x7')]('/api/fax/messages',require(_0xa24c('0x36')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x37'),require('./api/faxQueue'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x38'),require(_0xa24c('0x39')));_0x195e60['use'](_0xa24c('0x3a'),require('./api/smsAccount'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x3b'),require(_0xa24c('0x3c')));_0x195e60['use'](_0xa24c('0x3d'),require(_0xa24c('0x3e')));_0x195e60[_0xa24c('0x7')]('/api/sms/messages',require(_0xa24c('0x3f')));_0x195e60['use'](_0xa24c('0x40'),require(_0xa24c('0x41')));_0x195e60['use']('/api/openchannel/accounts',require(_0xa24c('0x42')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x43'),require(_0xa24c('0x44')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x45'),require(_0xa24c('0x46')));_0x195e60['use'](_0xa24c('0x47'),require(_0xa24c('0x48')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x49'),require(_0xa24c('0x4a')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x4b'),require(_0xa24c('0x4c')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x4d'),require('./api/openchannelQueueReport'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x4e'),require(_0xa24c('0x4f')));_0x195e60[_0xa24c('0x7')]('/api/chat/interactions',require('./api/chatInteraction'));_0x195e60[_0xa24c('0x7')]('/api/chat/messages',require(_0xa24c('0x50')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x51'),require(_0xa24c('0x52')));_0x195e60[_0xa24c('0x7')]('/api/chat/queues',require('./api/chatQueue'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x53'),require(_0xa24c('0x54')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x55'),require(_0xa24c('0x56')));_0x195e60['use']('/api/cm/companies',require(_0xa24c('0x57')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x58'),require(_0xa24c('0x59')));_0x195e60[_0xa24c('0x7')]('/api/cm/hopper',require(_0xa24c('0x5a')));_0x195e60[_0xa24c('0x7')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x5b'),require(_0xa24c('0x5c')));_0x195e60['use']('/api/cm/hopper_history',require(_0xa24c('0x5d')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x5e'),require(_0xa24c('0x5f')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x60'),require(_0xa24c('0x61')));_0x195e60[_0xa24c('0x7')]('/api/automations',require('./api/automation'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x62'),require(_0xa24c('0x63')));_0x195e60['use'](_0xa24c('0x64'),require(_0xa24c('0x65')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x66'),require(_0xa24c('0x67')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x68'),require(_0xa24c('0x69')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x6a'),require('./api/pause'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x6b'),require(_0xa24c('0x6c')));_0x195e60['use'](_0xa24c('0x6d'),require(_0xa24c('0x6e')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x6f'),require(_0xa24c('0x70')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x71'),require(_0xa24c('0x72')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x73'),require(_0xa24c('0x74')));_0x195e60['use'](_0xa24c('0x75'),require(_0xa24c('0x76')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x77'),require(_0xa24c('0x78')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x79'),require(_0xa24c('0x7a')));_0x195e60[_0xa24c('0x7')]('/api/integrations',require('./api/integration'));_0x195e60[_0xa24c('0x7')]('/api/integrations/reports',require(_0xa24c('0x7b')));_0x195e60[_0xa24c('0x7')]('/api/analytics/custom_reports',require(_0xa24c('0x7c')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x7d'),require('./api/analyticDefaultReport'));_0x195e60['use'](_0xa24c('0x7e'),require('./api/analyticExtractedReport'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x7f'),require(_0xa24c('0x80')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x81'),require(_0xa24c('0x82')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x83'),require(_0xa24c('0x84')));_0x195e60[_0xa24c('0x7')]('/api/integrations/salesforce/accounts',require(_0xa24c('0x85')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x86'),require('./api/intSalesforceConfiguration'));_0x195e60['use']('/api/integrations/salesforce/fields',require(_0xa24c('0x87')));_0x195e60['use'](_0xa24c('0x88'),require(_0xa24c('0x89')));_0x195e60['use'](_0xa24c('0x8a'),require(_0xa24c('0x8b')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x8c'),require(_0xa24c('0x8d')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x8e'),require(_0xa24c('0x8f')));_0x195e60['use'](_0xa24c('0x90'),require('./api/intDeskConfiguration'));_0x195e60['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x195e60['use'](_0xa24c('0x91'),require('./api/intZohoAccount'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x92'),require(_0xa24c('0x93')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x94'),require(_0xa24c('0x95')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x96'),require(_0xa24c('0x97')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x98'),require(_0xa24c('0x99')));_0x195e60[_0xa24c('0x7')](_0xa24c('0x9a'),require(_0xa24c('0x9b')));_0x195e60['use'](_0xa24c('0x9c'),require(_0xa24c('0x9d')));_0x195e60['use'](_0xa24c('0x9e'),require(_0xa24c('0x9f')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xa0'),require('./api/intFreshdeskField'));_0x195e60['use'](_0xa24c('0xa1'),require('./api/intVtigerAccount'));_0x195e60['use'](_0xa24c('0xa2'),require(_0xa24c('0xa3')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xa4'),require('./api/intVtigerField'));_0x195e60['use'](_0xa24c('0xa5'),require('./api/intServicenowAccount'));_0x195e60['use'](_0xa24c('0xa6'),require(_0xa24c('0xa7')));_0x195e60[_0xa24c('0x7')]('/api/integrations/servicenow/fields',require(_0xa24c('0xa8')));_0x195e60[_0xa24c('0x7')]('/api/integrations/dynamics365/accounts',require(_0xa24c('0xa9')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xaa'),require('./api/intDynamics365Configuration'));_0x195e60[_0xa24c('0x7')](_0xa24c('0xab'),require(_0xa24c('0xac')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xad'),require('./api/intFreshsalesAccount'));_0x195e60[_0xa24c('0x7')](_0xa24c('0xae'),require(_0xa24c('0xaf')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xb0'),require(_0xa24c('0xb1')));_0x195e60[_0xa24c('0x7')]('/api/networks',require(_0xa24c('0xb2')));_0x195e60[_0xa24c('0x7')]('/api/chat/reports/queue',require(_0xa24c('0xb3')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xb4'),require(_0xa24c('0xb5')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xb6'),require(_0xa24c('0xb7')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xb8'),require(_0xa24c('0xb9')));_0x195e60['use'](_0xa24c('0xba'),require(_0xa24c('0xbb')));_0x195e60[_0xa24c('0x7')]('/api/sms/reports/queue',require(_0xa24c('0xbc')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xbd'),require('./api/squareReport'));_0x195e60[_0xa24c('0x7')](_0xa24c('0xbe'),require(_0xa24c('0xbf')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xc0'),require(_0xa24c('0xc1')));_0x195e60['use']('/api/settings',require(_0xa24c('0xc2')));_0x195e60['use'](_0xa24c('0xc3'),require(_0xa24c('0xc4')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xc5'),require(_0xa24c('0xc6')));_0x195e60['use'](_0xa24c('0xc7'),require(_0xa24c('0xc8')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xc9'),require(_0xa24c('0xca')));_0x195e60[_0xa24c('0x7')]('/api/teams',require(_0xa24c('0xcb')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xcc'),require(_0xa24c('0xcd')));_0x195e60['use'](_0xa24c('0xce'),require('./api/campaign'));_0x195e60[_0xa24c('0x7')](_0xa24c('0xcf'),require(_0xa24c('0xd0')));_0x195e60[_0xa24c('0x7')]('/api/attachments',require(_0xa24c('0xd1')));_0x195e60[_0xa24c('0x7')]('/api/plugins',require(_0xa24c('0xd2')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xd3'),require(_0xa24c('0xd4')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xd5'),require(_0xa24c('0xd6')));_0x195e60[_0xa24c('0x7')]('/api/fax/reports/transfer',require(_0xa24c('0xd7')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xd8'),require(_0xa24c('0xd9')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xda'),require(_0xa24c('0xdb')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xdc'),require(_0xa24c('0xdd')));_0x195e60[_0xa24c('0x7')]('/api/voice/prefixes',require(_0xa24c('0xde')));_0x195e60[_0xa24c('0x7')]('/api/userProfiles',require(_0xa24c('0xdf')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xe0'),require('./api/userProfileSection'));_0x195e60['use'](_0xa24c('0xe1'),require(_0xa24c('0xe2')));_0x195e60['use'](_0xa24c('0xe3'),require(_0xa24c('0xe4')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xe5'),require(_0xa24c('0xe6')));_0x195e60[_0xa24c('0x7')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x195e60['use'](_0xa24c('0xe7'),require('./api/whatsappInteraction'));_0x195e60['use'](_0xa24c('0xe8'),require(_0xa24c('0xe9')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xea'),require(_0xa24c('0xeb')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xec'),require(_0xa24c('0xed')));_0x195e60[_0xa24c('0x7')]('/api/whatsapp/queues',require(_0xa24c('0xee')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xef'),require(_0xa24c('0xf0')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xf1'),require(_0xa24c('0xf2')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xf3'),require(_0xa24c('0xf4')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xf5'),require('./api/authLocal'));_0x195e60[_0xa24c('0x7')](_0xa24c('0xf6'),require('./api/authGoogle'));_0x195e60[_0xa24c('0x7')](_0xa24c('0xf7'),require(_0xa24c('0xf8')));_0x195e60['use'](_0xa24c('0xf9'),require(_0xa24c('0xfa')));_0x195e60['use'](_0xa24c('0xfb'),require(_0xa24c('0xfc')));_0x195e60['use']('/api/version',require(_0xa24c('0xfd')));_0x195e60[_0xa24c('0x7')](_0xa24c('0xfe'),require(_0xa24c('0xff')));_0x195e60['use'](_0xa24c('0x100'),require(_0xa24c('0x101')));_0x195e60[_0xa24c('0x7')]('/api/webbar',require('./api/webbar'));_0x195e60[_0xa24c('0x7')](_0xa24c('0x102'),clientSideLogs);_0x195e60[_0xa24c('0x7')]('/apidoc',express['static'](path[_0xa24c('0x103')](config['root'],'/apidoc')));_0x195e60['use'](_0xa24c('0x104'),express[_0xa24c('0x105')](path[_0xa24c('0x103')](config[_0xa24c('0x106')],_0xa24c('0x104'))));_0x195e60[_0xa24c('0x7')](_0xa24c('0x107'),express[_0xa24c('0x105')](path[_0xa24c('0x103')](config[_0xa24c('0x106')],_0xa24c('0x107'))));_0x195e60[_0xa24c('0x7')]('/snippet',express[_0xa24c('0x105')](path[_0xa24c('0x103')](config['root'],_0xa24c('0x108'),'3.0.0')));_0x195e60['use']('/plugins',express[_0xa24c('0x105')](path['join'](config[_0xa24c('0x106')],'/server/files/plugins')));_0x195e60[_0xa24c('0x109')](_0xa24c('0x10a'))['get'](errors[0x194]);_0x195e60[_0xa24c('0x109')]('/*')['get'](function(_0x3cc886,_0x45d419){_0x45d419[_0xa24c('0x10b')](path[_0xa24c('0x10c')](_0x195e60[_0xa24c('0x10d')]('appPath')+_0xa24c('0x10e')));});return _0x195e60;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 36f60c8..12ed769 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d27=['../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.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/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','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc'];(function(_0x2bd454,_0x8126a6){var _0x51187b=function(_0x71bb2d){while(--_0x71bb2d){_0x2bd454['push'](_0x2bd454['shift']());}};_0x51187b(++_0x8126a6);}(_0x2d27,0x115));var _0x72d2=function(_0x2e5111,_0x5b8f9e){_0x2e5111=_0x2e5111-0x0;var _0x1174ec=_0x2d27[_0x2e5111];return _0x1174ec;};'use strict';var jayson=require(_0x72d2('0x0'));var _=require(_0x72d2('0x1'));var config=require('../config/environment');exports[_0x72d2('0x2')]=function(){return new Promise(function(_0x47ce68,_0x9403df){var _0x4f064d={};_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x4')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x5')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x6')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/voiceRecording/voiceRecording.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x7')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x8')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x9')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0xa')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/trunk/trunk.rpc'));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0xb')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0xc')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0xd')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0xe')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0xf')));_0x4f064d=_['merge'](_0x4f064d,require('../api/mailMessage/mailMessage.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/mailApplication/mailApplication.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x10')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x11')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x12')));_0x4f064d=_['merge'](_0x4f064d,require('../api/faxInteraction/faxInteraction.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x13')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x14')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x15')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/smsAccount/smsAccount.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x16')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x17')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x18')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x19')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x1a')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x1b')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x1c')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x1d')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/chatMessage/chatMessage.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x1e')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x1f')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x20')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x21')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x22')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x23')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x24')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x25')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x26')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x27')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/template/template.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x28')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x29')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x2a')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x2b')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x2c')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x2d')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x2e')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x2f')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x30')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x31')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x32')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4f064d=_['merge'](_0x4f064d,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x33')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x34')));_0x4f064d=_['merge'](_0x4f064d,require(_0x72d2('0x35')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x36')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/squareOdbc/squareOdbc.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/squareProject/squareProject.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x37')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x38')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/campaign/campaign.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x39')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x3a')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x3b')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x3c')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x3d')));_0x4f064d=_[_0x72d2('0x3')](_0x4f064d,require(_0x72d2('0x3e')));var _0xacb55b=jayson[_0x72d2('0x3f')](_0x4f064d)[_0x72d2('0x40')]();var _0x1534ab=config['rpc'][_0x72d2('0x41')]||config[_0x72d2('0x41')]+0x1;var _0x4dca30=config['rpc']['ip']||_0x72d2('0x42');_0xacb55b['on'](_0x72d2('0x43'),function(_0x49171a){return _0x9403df(_0x49171a);});_0xacb55b['listen'](_0x1534ab,_0x4dca30,function(){console[_0x72d2('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4dca30,_0x1534ab);require(_0x72d2('0x45'))[_0x72d2('0x46')]();return _0x47ce68(_0x72d2('0x47')+_0x4dca30+':'+_0x1534ab);});});}; \ No newline at end of file +var _0xb1eb=['../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/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','port','rpc','localhost','error','listen','log','../config/triggers','default','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc'];(function(_0x27d34c,_0x3ad80e){var _0x2dee51=function(_0x41db92){while(--_0x41db92){_0x27d34c['push'](_0x27d34c['shift']());}};_0x2dee51(++_0x3ad80e);}(_0xb1eb,0x159));var _0xbb1e=function(_0x13c995,_0x485107){_0x13c995=_0x13c995-0x0;var _0x251f2b=_0xb1eb[_0x13c995];return _0x251f2b;};'use strict';var jayson=require('jayson/promise');var _=require(_0xbb1e('0x0'));var config=require(_0xbb1e('0x1'));exports['listen']=function(){return new Promise(function(_0x1887d2,_0x35f7c3){var _0x162e13={};_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/user/user.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x3')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/voiceQueue/voiceQueue.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/voiceRecording/voiceRecording.rpc'));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x4')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x5')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x6')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x7')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x8')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x9')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0xa')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0xb')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0xc')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0xd')));_0x162e13=_['merge'](_0x162e13,require('../api/mailQueue/mailQueue.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0xe')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0xf')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x10')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x11')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x12')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x13')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x14')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x15')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x16')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x17')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x18')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x19')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x1a')));_0x162e13=_['merge'](_0x162e13,require('../api/smsQueue/smsQueue.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x1b')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x1c')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x1d')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x1e')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x1f')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/chatInteraction/chatInteraction.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/chatMessage/chatMessage.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/chatQueue/chatQueue.rpc'));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x20')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/cmHopper/cmHopper.rpc'));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x21')));_0x162e13=_['merge'](_0x162e13,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x22')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x23')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x24')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x25')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x26')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x27')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x28')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x29')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x2a')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x2b')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x2c')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x2d')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x2e')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x2f')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x30')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x31')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x32')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x33')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x34')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x35')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x36')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x37')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x38')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/squareRecording/squareRecording.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x39')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/campaign/campaign.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x3a')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/plugin/plugin.rpc'));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x3b')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x3c')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require(_0xbb1e('0x3d')));_0x162e13=_['merge'](_0x162e13,require(_0xbb1e('0x3e')));_0x162e13=_[_0xbb1e('0x2')](_0x162e13,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x47e365=jayson[_0xbb1e('0x3f')](_0x162e13)[_0xbb1e('0x40')]();var _0xb2c14d=config['rpc']['port']||config[_0xbb1e('0x41')]+0x1;var _0x56ecfb=config[_0xbb1e('0x42')]['ip']||_0xbb1e('0x43');_0x47e365['on'](_0xbb1e('0x44'),function(_0x1d97d6){return _0x35f7c3(_0x1d97d6);});_0x47e365[_0xbb1e('0x45')](_0xb2c14d,_0x56ecfb,function(){console[_0xbb1e('0x46')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x56ecfb,_0xb2c14d);require(_0xbb1e('0x47'))[_0xbb1e('0x48')]();return _0x1887d2('RPC\x20listening\x20on\x20'+_0x56ecfb+':'+_0xb2c14d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b9fe61d..67ac029 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 _0xcb04=['./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','command','sync','prototype','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','agi','exec','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x4cb0('0x0'));var _=require(_0x4cb0('0x1'));var EventEmitter=require(_0x4cb0('0x2'))[_0x4cb0('0x3')];var AGIReply=require(_0x4cb0('0x4'));var AGIError=require(_0x4cb0('0x5'));function AGIChannel(_0x241f6e){var _0x2f1690=this,_0x392bd7=new AGIReply(),_0x3939b4=![],_0x47aae7={};EventEmitter[_0x4cb0('0x6')](_0x2f1690);_0x241f6e[_0x4cb0('0x7')](_0x4cb0('0x8'));_0x241f6e[_0x4cb0('0x9')](0x8*0x3c*0x3c*0x3e8);_0x392bd7[_0x4cb0('0x7')](_0x4cb0('0x8'));_0x392bd7['on'](_0x4cb0('0xa'),function(_0x3c5793){for(var _0x248569 in _0x3c5793){_0x2f1690[_0x248569]=_0x3c5793[_0x248569];}_0x2f1690[_0x4cb0('0xb')](_0x4cb0('0xc'));});_0x392bd7['on'](_0x4cb0('0xd'),function(_0x442a53){if(_0x442a53[_0x4cb0('0xe')]()==_0x4cb0('0xf')){_0x2f1690[_0x4cb0('0xb')](_0x4cb0('0xf'));return;}if(_0x442a53[_0x4cb0('0x10')](0x0,0xb)=='520-Invalid'){_0x3939b4=!![];}if(_0x3939b4){_0x47aae7['rx']+=_0x442a53+'\x0a';if(_0x442a53[_0x4cb0('0x11')](_0x4cb0('0x12'))!=-0x1){_0x3939b4=![];}}else{_0x47aae7['rx']=_0x442a53;}if(_0x3939b4){return;}if(typeof _0x47aae7['cb']==_0x4cb0('0x13')){var _0x15fab9=_0x47aae7['rx'][_0x4cb0('0x10')](0x0,0x3),_0x5cad20=null,_0x14157f=null;_0x15fab9=parseInt(_0x15fab9);if(isNaN(_0x15fab9)){_0x47aae7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4cb0('0x14')});return;}if(_0x15fab9!=0xc8){_0x47aae7['cb'](null,{'code':_0x15fab9,'result':-0x1,'extra':'KO'});return;}_0x5cad20=_0x47aae7['rx'][_0x4cb0('0x10')](0x4)[_0x4cb0('0x15')](_0x4cb0('0x16'),'');if(_0x5cad20[_0x4cb0('0x17')]('\x20')!=-0x1){_0x5cad20=_0x5cad20[_0x4cb0('0x18')](0x0,_0x5cad20[_0x4cb0('0x17')]('\x20'));}if(_['startsWith'](_0x5cad20,'-1')){_0x5cad20=parseInt(_0x5cad20);}_0x14157f=_0x47aae7['rx'][_0x4cb0('0x19')]('\x20');if(_0x14157f[_0x4cb0('0x1a')]==0x3){_0x14157f=_0x14157f[0x2][_0x4cb0('0x10')](0x1,_0x14157f[0x2][_0x4cb0('0x1a')]-0x1);}else if(_0x14157f['length']>0x3){var _0x5a7295=/\((.+)\)/;var _0x1c67e8=_0x47aae7['rx'][_0x4cb0('0x1b')](_0x5a7295);if(_0x1c67e8){_0x14157f=_0x1c67e8[0x1];}else{_0x14157f=null;}}else{_0x14157f=null;}_0x47aae7['cb'](null,{'code':_0x15fab9,'result':_0x5cad20,'extra':_0x14157f});}});_0x241f6e['on'](_0x4cb0('0x1c'),function(_0x91d3b){_0x2f1690[_0x4cb0('0xb')](_0x4cb0('0x1c'),new AGIError(_0x4cb0('0x1d'),_0x91d3b['code']));});_0x241f6e['on']('close',function(){_0x2f1690[_0x4cb0('0xb')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x241f6e['on'](_0x4cb0('0x1e'),function(){_0x2f1690[_0x4cb0('0xb')]('timeout',new AGIError(_0x4cb0('0x1f')));_0x241f6e[_0x4cb0('0x20')]();});_0x241f6e[_0x4cb0('0x21')](_0x392bd7);this['command']=function(_0x2bb0f9,_0x4ba67d){var _0x2bb0f9=_0x2bb0f9||'',_0x4ba67d=typeof _0x4ba67d==_0x4cb0('0x13')?_0x4ba67d:new Function();_0x47aae7={'tx':_0x2bb0f9,'rx':'','cb':_0x4ba67d};_0x241f6e[_0x4cb0('0x22')](_0x2bb0f9+'\x0a');},this['close']=function(){_0x241f6e[_0x4cb0('0x20')]();};}util[_0x4cb0('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x3456ef){return this[_0x4cb0('0x24')][_0x4cb0('0x25')](this,_0x3456ef);};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x27')]=function(){return this[_0x4cb0('0x28')](_0x4cb0('0x29'));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x2a')]=function(_0x3e28c0,_0x331f3c,_0xde2bd9){_0x3e28c0=_0x3e28c0===undefined?'beep':_0x3e28c0;_0x331f3c=_0x331f3c===undefined?'5':_0x331f3c;_0xde2bd9=_0xde2bd9===undefined?'1':_0xde2bd9;return this[_0x4cb0('0x28')](util[_0x4cb0('0x2b')](_0x4cb0('0x2c'),_0x3e28c0,_0x331f3c*0x3e8,_0xde2bd9));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x2d')]=function(_0x5333c3){_0x5333c3=_0x5333c3||_0x4cb0('0x2e');return this['sendRequest'](util[_0x4cb0('0x2b')](_0x4cb0('0x2f'),_0x5333c3));};AGIChannel[_0x4cb0('0x26')]['exec']=function(_0x2182bc,_0xf1bdc1){if(_[_0x4cb0('0x30')](_0xf1bdc1)){return this[_0x4cb0('0x28')](util['format'](_0x4cb0('0x31'),_0x2182bc,_0xf1bdc1['join'](',')));}return this['sendRequest'](util[_0x4cb0('0x2b')](_0x4cb0('0x31'),_0x2182bc,_0xf1bdc1));};AGIChannel['prototype'][_0x4cb0('0x32')]=function(_0x499eb6){return this[_0x4cb0('0x28')](util[_0x4cb0('0x2b')](_0x4cb0('0x33'),_0x499eb6));};AGIChannel[_0x4cb0('0x26')]['setExtension']=function(_0x69bbbc){return this[_0x4cb0('0x28')](util[_0x4cb0('0x2b')](_0x4cb0('0x34'),_0x69bbbc));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x35')]=function(_0x10b37b){return this['sendRequest'](util[_0x4cb0('0x2b')](_0x4cb0('0x36'),_0x10b37b));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0xf')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x4cb0('0x26')]['setVariable']=function(_0x11369a,_0xd31fc6){var _0x5f36b4=_[_0x4cb0('0x37')](_0xd31fc6)||_['isNumber'](_0xd31fc6)?_0xd31fc6[_0x4cb0('0x38')]():_0xd31fc6;return this[_0x4cb0('0x28')](util[_0x4cb0('0x2b')](_0x4cb0('0x39'),_0x11369a,_0x5f36b4?_0x5f36b4['toString']()[_0x4cb0('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x3a')]=function(_0x1f676f,_0x2ebad0){return this[_0x4cb0('0x28')](util[_0x4cb0('0x2b')](_0x4cb0('0x3b'),_0x1f676f,_0x2ebad0));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x3c')]=function(_0x5ce21b,_0x55459d){return this[_0x4cb0('0x28')](util['format'](_0x4cb0('0x3d'),_0x5ce21b,_0x55459d));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x3e')]=function(_0x47c17a,_0xe936a9){return this[_0x4cb0('0x28')](util[_0x4cb0('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x47c17a,_0xe936a9));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x3f')]=function(_0x250220,_0x2698ee,_0x4b82af){_0x2698ee=_0x2698ee||this[_0x4cb0('0x40')];_0x4b82af=_0x4b82af||0x1;this[_0x4cb0('0x32')](_0x250220);this[_0x4cb0('0x41')](_0x2698ee);this[_0x4cb0('0x35')](_0x4b82af);return this[_0x4cb0('0x2d')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x250220,_0x2698ee,_0x4b82af));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x42')]=function(_0xcee280){return this['sendRequest'](util['format'](_0x4cb0('0x43'),_0xcee280));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x44')]=function(_0x9447b7,_0x483e28,_0x3cfee6,_0x3f9cf2,_0x33d29d,_0x46e820){_0x483e28=_0x483e28||_0x4cb0('0x45');_0x3cfee6=_0x3cfee6||'';_0x3f9cf2=_0x3f9cf2===undefined?-0x1:_0x3f9cf2==='-1'?-0x1:_0x3f9cf2*0x3e8;_0x33d29d=_0x33d29d===undefined?'':'s='+_0x33d29d;_0x46e820=_0x46e820?_0x4cb0('0x46'):'';return this[_0x4cb0('0x28')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x9447b7,_0x483e28,_0x3cfee6,_0x3f9cf2,_0x46e820,_0x33d29d));};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x47')]=function(_0x3b7028,_0x509a66){_0x509a66=_0x509a66||'';return this[_0x4cb0('0x28')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3b7028,_0x509a66));};AGIChannel['prototype'][_0x4cb0('0x48')]=function(_0x332a73){return this[_0x4cb0('0x49')](_0x4cb0('0x4a'),_0x332a73);};AGIChannel[_0x4cb0('0x26')][_0x4cb0('0x4b')]=function(_0x534f0b){return this[_0x4cb0('0x49')](_0x4cb0('0x4c'),_0x534f0b);};AGIChannel[_0x4cb0('0x26')]['error']=function(_0x1cdaa3,_0x588b51){this[_0x4cb0('0x2d')](util[_0x4cb0('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1cdaa3['id'],_0x1cdaa3[_0x4cb0('0x4d')],_0x588b51));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4cb0('0x4e')]=AGIChannel; \ No newline at end of file +var _0xa143=['prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','agi','AGI','wait','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','search','function','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command'];(function(_0x3dfe4b,_0x2bcfa9){var _0x579aff=function(_0x4fe39e){while(--_0x4fe39e){_0x3dfe4b['push'](_0x3dfe4b['shift']());}};_0x579aff(++_0x2bcfa9);}(_0xa143,0x115));var _0x3a14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa143[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x3a14('0x0'));var _=require(_0x3a14('0x1'));var EventEmitter=require(_0x3a14('0x2'))[_0x3a14('0x3')];var AGIReply=require(_0x3a14('0x4'));var AGIError=require(_0x3a14('0x5'));function AGIChannel(_0x6b4ea9){var _0x363b10=this,_0x3c6622=new AGIReply(),_0x238839=![],_0x446a1c={};EventEmitter[_0x3a14('0x6')](_0x363b10);_0x6b4ea9['setEncoding'](_0x3a14('0x7'));_0x6b4ea9[_0x3a14('0x8')](0x8*0x3c*0x3c*0x3e8);_0x3c6622[_0x3a14('0x9')](_0x3a14('0x7'));_0x3c6622['on'](_0x3a14('0xa'),function(_0x2fafa0){for(var _0x35bc74 in _0x2fafa0){_0x363b10[_0x35bc74]=_0x2fafa0[_0x35bc74];}_0x363b10[_0x3a14('0xb')](_0x3a14('0xc'));});_0x3c6622['on'](_0x3a14('0xd'),function(_0x36bdfe){if(_0x36bdfe[_0x3a14('0xe')]()==_0x3a14('0xf')){_0x363b10['emit'](_0x3a14('0xf'));return;}if(_0x36bdfe[_0x3a14('0x10')](0x0,0xb)=='520-Invalid'){_0x238839=!![];}if(_0x238839){_0x446a1c['rx']+=_0x36bdfe+'\x0a';if(_0x36bdfe[_0x3a14('0x11')]('520\x20End\x20of\x20proper')!=-0x1){_0x238839=![];}}else{_0x446a1c['rx']=_0x36bdfe;}if(_0x238839){return;}if(typeof _0x446a1c['cb']==_0x3a14('0x12')){var _0x1c5d6f=_0x446a1c['rx'][_0x3a14('0x10')](0x0,0x3),_0x374b4d=null,_0x175b44=null;_0x1c5d6f=parseInt(_0x1c5d6f);if(isNaN(_0x1c5d6f)){_0x446a1c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x1c5d6f!=0xc8){_0x446a1c['cb'](null,{'code':_0x1c5d6f,'result':-0x1,'extra':'KO'});return;}_0x374b4d=_0x446a1c['rx'][_0x3a14('0x10')](0x4)[_0x3a14('0x13')](_0x3a14('0x14'),'');if(_0x374b4d[_0x3a14('0x15')]('\x20')!=-0x1){_0x374b4d=_0x374b4d[_0x3a14('0x16')](0x0,_0x374b4d[_0x3a14('0x15')]('\x20'));}if(_[_0x3a14('0x17')](_0x374b4d,'-1')){_0x374b4d=parseInt(_0x374b4d);}_0x175b44=_0x446a1c['rx'][_0x3a14('0x18')]('\x20');if(_0x175b44['length']==0x3){_0x175b44=_0x175b44[0x2][_0x3a14('0x10')](0x1,_0x175b44[0x2]['length']-0x1);}else if(_0x175b44[_0x3a14('0x19')]>0x3){var _0x34ede5=/\((.+)\)/;var _0x5686fb=_0x446a1c['rx']['match'](_0x34ede5);if(_0x5686fb){_0x175b44=_0x5686fb[0x1];}else{_0x175b44=null;}}else{_0x175b44=null;}_0x446a1c['cb'](null,{'code':_0x1c5d6f,'result':_0x374b4d,'extra':_0x175b44});}});_0x6b4ea9['on']('error',function(_0x5da55b){_0x363b10['emit'](_0x3a14('0x1a'),new AGIError(_0x3a14('0x1b'),_0x5da55b[_0x3a14('0x1c')]));});_0x6b4ea9['on'](_0x3a14('0x1d'),function(){_0x363b10['emit'](_0x3a14('0x1d'),new AGIError(_0x3a14('0x1e')));});_0x6b4ea9['on'](_0x3a14('0x1f'),function(){_0x363b10[_0x3a14('0xb')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x6b4ea9[_0x3a14('0x20')]();});_0x6b4ea9[_0x3a14('0x21')](_0x3c6622);this[_0x3a14('0x22')]=function(_0x5a6fd4,_0x40fde7){var _0x5a6fd4=_0x5a6fd4||'',_0x40fde7=typeof _0x40fde7=='function'?_0x40fde7:new Function();_0x446a1c={'tx':_0x5a6fd4,'rx':'','cb':_0x40fde7};_0x6b4ea9['write'](_0x5a6fd4+'\x0a');},this[_0x3a14('0x1d')]=function(){_0x6b4ea9[_0x3a14('0x20')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x3a14('0x23')][_0x3a14('0x24')]=function(_0x3e05d7){return this[_0x3a14('0x22')][_0x3a14('0x25')](this,_0x3e05d7);};AGIChannel[_0x3a14('0x23')]['answer']=function(){return this[_0x3a14('0x24')](_0x3a14('0x26'));};AGIChannel['prototype'][_0x3a14('0x27')]=function(_0x5427d0,_0x25dbce,_0xfd3f78){_0x5427d0=_0x5427d0===undefined?_0x3a14('0x28'):_0x5427d0;_0x25dbce=_0x25dbce===undefined?'5':_0x25dbce;_0xfd3f78=_0xfd3f78===undefined?'1':_0xfd3f78;return this[_0x3a14('0x24')](util[_0x3a14('0x29')](_0x3a14('0x2a'),_0x5427d0,_0x25dbce*0x3e8,_0xfd3f78));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x2b')]=function(_0x3ef850){_0x3ef850=_0x3ef850||_0x3a14('0x2c');return this[_0x3a14('0x24')](util[_0x3a14('0x29')](_0x3a14('0x2d'),_0x3ef850));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x2e')]=function(_0x52e7ce,_0x22d375){if(_[_0x3a14('0x2f')](_0x22d375)){return this['sendRequest'](util[_0x3a14('0x29')]('EXEC\x20%s\x20%s',_0x52e7ce,_0x22d375[_0x3a14('0x30')](',')));}return this[_0x3a14('0x24')](util['format'](_0x3a14('0x31'),_0x52e7ce,_0x22d375));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x32')]=function(_0x317abd){return this[_0x3a14('0x24')](util[_0x3a14('0x29')]('SET\x20CONTEXT\x20%s',_0x317abd));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x33')]=function(_0x97958){return this[_0x3a14('0x24')](util[_0x3a14('0x29')](_0x3a14('0x34'),_0x97958));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x35')]=function(_0x16a792){return this['sendRequest'](util['format'](_0x3a14('0x36'),_0x16a792));};AGIChannel[_0x3a14('0x23')][_0x3a14('0xf')]=function(){return this[_0x3a14('0x24')](_0x3a14('0x37'));};AGIChannel['prototype'][_0x3a14('0x38')]=function(_0x495712,_0x4bd909){var _0x4294e1=_['isBoolean'](_0x4bd909)||_['isNumber'](_0x4bd909)?_0x4bd909[_0x3a14('0x39')]():_0x4bd909;return this[_0x3a14('0x24')](util[_0x3a14('0x29')](_0x3a14('0x3a'),_0x495712,_0x4294e1?_0x4294e1[_0x3a14('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x3a14('0x3b')]=function(_0x3d674b,_0x1ef59b){return this[_0x3a14('0x24')](util[_0x3a14('0x29')](_0x3a14('0x3c'),_0x3d674b,_0x1ef59b));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x3d')]=function(_0x2f3b1a,_0x19dcdf){return this[_0x3a14('0x24')](util[_0x3a14('0x29')](_0x3a14('0x3e'),_0x2f3b1a,_0x19dcdf));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x3f')]=function(_0x1a1278,_0x588d58){return this[_0x3a14('0x24')](util[_0x3a14('0x29')](_0x3a14('0x40'),_0x1a1278,_0x588d58));};AGIChannel['prototype'][_0x3a14('0x41')]=function(_0x230123,_0x4315fb,_0x2606a6){_0x4315fb=_0x4315fb||this[_0x3a14('0x42')];_0x2606a6=_0x2606a6||0x1;this[_0x3a14('0x32')](_0x230123);this[_0x3a14('0x33')](_0x4315fb);this['setPriority'](_0x2606a6);return this[_0x3a14('0x2b')](util[_0x3a14('0x29')](_0x3a14('0x43'),_0x230123,_0x4315fb,_0x2606a6));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x44')]=function(_0x113d9f){return this['sendRequest'](util['format'](_0x3a14('0x45'),_0x113d9f));};AGIChannel[_0x3a14('0x23')][_0x3a14('0x46')]=function(_0x457b3d,_0x1f17e8,_0x35e0e8,_0x678907,_0x55edac,_0x497266){_0x1f17e8=_0x1f17e8||'wav';_0x35e0e8=_0x35e0e8||'';_0x678907=_0x678907===undefined?-0x1:_0x678907==='-1'?-0x1:_0x678907*0x3e8;_0x55edac=_0x55edac===undefined?'':'s='+_0x55edac;_0x497266=_0x497266?_0x3a14('0x47'):'';return this[_0x3a14('0x24')](util[_0x3a14('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x457b3d,_0x1f17e8,_0x35e0e8,_0x678907,_0x497266,_0x55edac));};AGIChannel['prototype'][_0x3a14('0x48')]=function(_0x37c913,_0x92126a){_0x92126a=_0x92126a||'';return this[_0x3a14('0x24')](util[_0x3a14('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x37c913,_0x92126a));};AGIChannel['prototype'][_0x3a14('0x49')]=function(_0x4d787c){return this[_0x3a14('0x2e')](_0x3a14('0x4a'),_0x4d787c);};AGIChannel[_0x3a14('0x23')][_0x3a14('0x4b')]=function(_0x1b93f4){return this[_0x3a14('0x2e')]('WAIT',_0x1b93f4);};AGIChannel[_0x3a14('0x23')][_0x3a14('0x1a')]=function(_0x3e4d4d,_0x4a6b83){this[_0x3a14('0x2b')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3e4d4d['id'],_0x3e4d4d[_0x3a14('0x4c')],_0x4a6b83));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3a14('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3e901a4..052920e 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 _0x09a6=['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.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x09a6,0x1ee));var _0x609a=function(_0x23b85e,_0x39b209){_0x23b85e=_0x23b85e-0x0;var _0x329756=_0x09a6[_0x23b85e];return _0x329756;};'use strict';var util=require(_0x609a('0x0'));var error={'E_AGI_UNDEFINED':_0x609a('0x1'),'E_AGI_ARGUMENT_PORT':_0x609a('0x2'),'E_AGI_SERVER_ERROR':_0x609a('0x3'),'E_AGI_SERVER_CLOSE':_0x609a('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x609a('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x609a('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x609a('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x609a('0x8'),'E_AGI_IVR_ENTRY':_0x609a('0x9')};function AGIError(_0x1ba983){var _0x1ba983=_0x1ba983||null,_0x179732=_0x179732||[],_0x481551=0x1,_0x5bdb69='';if(!error[_0x1ba983]){_0x1ba983='E_AGI_UNDEFINED';}_0x179732[_0x609a('0xa')](error[_0x1ba983]);while(arguments[_0x481551]){_0x179732[_0x609a('0xa')](arguments[_0x481551]);_0x481551++;}_0x5bdb69=util[_0x609a('0xb')][_0x609a('0xc')](util,_0x179732);this[_0x609a('0xd')]=_0x5bdb69;this[_0x609a('0xe')]=_0x1ba983;}module[_0x609a('0xf')]=AGIError; \ No newline at end of file +var _0xc0cf=['name','exports','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc0cf,0x1de));var _0xfc0c=function(_0x133ff0,_0x476308){_0x133ff0=_0x133ff0-0x0;var _0x42a234=_0xc0cf[_0x133ff0];return _0x42a234;};'use strict';var util=require(_0xfc0c('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xfc0c('0x1'),'E_AGI_SERVER_CLOSE':_0xfc0c('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xfc0c('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xfc0c('0x4'),'E_AGI_SOCKET_ERROR':_0xfc0c('0x5'),'E_AGI_SOCKET_CLOSE':_0xfc0c('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xfc0c('0x7'),'E_AGI_COMMAND_EMPTY':_0xfc0c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfc0c('0x9'),'E_AGI_IVR_ENTRY':_0xfc0c('0xa')};function AGIError(_0x3cbfda){var _0x3cbfda=_0x3cbfda||null,_0x15c804=_0x15c804||[],_0x22e6c9=0x1,_0x547dbc='';if(!error[_0x3cbfda]){_0x3cbfda=_0xfc0c('0xb');}_0x15c804[_0xfc0c('0xc')](error[_0x3cbfda]);while(arguments[_0x22e6c9]){_0x15c804['push'](arguments[_0x22e6c9]);_0x22e6c9++;}_0x547dbc=util[_0xfc0c('0xd')]['apply'](util,_0x15c804);this[_0xfc0c('0xe')]=_0x547dbc;this[_0xfc0c('0xf')]=_0x3cbfda;}module[_0xfc0c('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 13652ec..6bfe968 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 _0x2232=['edges','numberOfEdges','prototype','addVertex','push','size','relations','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices'];(function(_0x32d298,_0x3a61e7){var _0x44650b=function(_0x5649ee){while(--_0x5649ee){_0x32d298['push'](_0x32d298['shift']());}};_0x44650b(++_0x3a61e7);}(_0x2232,0xd2));var _0x2223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2232[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2223('0x0'));var logger=require(_0x2223('0x1'))(_0x2223('0x2'));var verticesWithRetry=[_0x2223('0x3'),_0x2223('0x4'),_0x2223('0x5')];var Graph=function(){this[_0x2223('0x6')]={};this[_0x2223('0x7')]={};this[_0x2223('0x8')]=0x0;};Graph[_0x2223('0x9')][_0x2223('0xa')]=function(_0x487801){this[_0x2223('0x6')][_0x487801['id']]=_0x487801;this[_0x2223('0x7')][_0x487801['id']]=[];};Graph[_0x2223('0x9')]['addEdge']=function(_0x56dc04,_0xf7e897,_0xd4de39){this['edges'][_0x56dc04][_0x2223('0xb')]({'target':_0xf7e897,'condition':_0xd4de39});this[_0x2223('0x8')]+=0x1;};Graph[_0x2223('0x9')][_0x2223('0xc')]=function(){return _['size'](this[_0x2223('0x6')]);};Graph['prototype'][_0x2223('0xd')]=function(){return this[_0x2223('0x8')];};Graph['prototype']['getVertex']=function(_0x5f4bbf){return this[_0x2223('0x6')][_0x5f4bbf];};Graph['prototype'][_0x2223('0xe')]=function(_0x488f7a,_0x2b844c){if(!this['vertices'][_0x488f7a]){return logger[_0x2223('0xf')](_0x2223('0x10'));}var _0x1c677a=_0x2b844c(this['vertices'][_0x488f7a]);if(!_0x1c677a){return logger['info']('stop\x20traverse');}if(this[_0x2223('0x7')][_0x488f7a]['length']===0x0){return logger[_0x2223('0xf')](_0x2223('0x11'));}for(var _0x2323a2=0x0,_0x467e16=[],_0x106920=![];_0x2323a2\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','length','value','then','catch','agi_','inspect','debug','variables','close','timeout','hangup','sync','production','root','stringify','joinAt','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./graph'];(function(_0x2e2cdd,_0x5e583c){var _0x4c1a55=function(_0x2d7624){while(--_0x2d7624){_0x2e2cdd['push'](_0x2e2cdd['shift']());}};_0x4c1a55(++_0x5e583c);}(_0x705e,0xf0));var _0xe705=function(_0x1c89e1,_0x4e4f6e){_0x1c89e1=_0x1c89e1-0x0;var _0x4df70d=_0x705e[_0x1c89e1];return _0x4df70d;};'use strict';var parser=require(_0xe705('0x0'));var _=require('lodash');var syncho=require(_0xe705('0x1'));var util=require(_0xe705('0x2'));var moment=require(_0xe705('0x3'));var config=require(_0xe705('0x4'));var logger=require(_0xe705('0x5'))('agi');var utilLicense=require(_0xe705('0x6'));var rpc=require(_0xe705('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0xe705('0x8'));var Vertices=require(_0xe705('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xe705('0xa')](config[_0xe705('0xb')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x3ac686){process[_0xe705('0xc')](function(){syncho(function(){try{setChannelVariables(_0x3ac686);agiHandler(_0x3ac686);}catch(_0x455acd){logger['error'](_0x455acd[_0xe705('0xd')]);}});});}function listeningHandler(){console[_0xe705('0xe')](_0xe705('0xf'),config[_0xe705('0xb')][_0xe705('0x10')]);logger[_0xe705('0x11')](util[_0xe705('0x12')](_0xe705('0x13'),config[_0xe705('0xb')]['ip'],config['agi'][_0xe705('0x10')]));}function errorHandler(_0x7a08e6){if(_0x7a08e6&&_0x7a08e6[_0xe705('0x14')]&&_0x7a08e6[_0xe705('0x15')]){logger[_0xe705('0x16')](util[_0xe705('0x12')](_0xe705('0x17'),_0x7a08e6['name'],_0x7a08e6[_0xe705('0x15')]));}else{logger['error'](util[_0xe705('0x12')]('[ERROR]\x20%s',_0x7a08e6[_0xe705('0xd')]));}}function closeHandler(){logger[_0xe705('0x11')](util[_0xe705('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe705('0x18')],this[_0xe705('0x19')],this[_0xe705('0x1a')],this[_0xe705('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1089e5){logger[_0xe705('0x16')](_0x1089e5[_0xe705('0xd')]);}}function timeoutHandler(){logger['info'](util[_0xe705('0x12')](_0xe705('0x1c'),this[_0xe705('0x18')],this[_0xe705('0x19')],this[_0xe705('0x1a')],this[_0xe705('0x1b')],this[_0xe705('0x1d')]));}function hangupHandler(){logger[_0xe705('0x11')](util['format'](_0xe705('0x1e'),this[_0xe705('0x18')],this[_0xe705('0x19')],this[_0xe705('0x1a')],this[_0xe705('0x1b')],this['uniqueid']));this[_0xe705('0x1f')]=!![];}function getRoot(_0x4a40e3){return parser[_0xe705('0x20')](_0x4a40e3,{'object':!![]})[_0xe705('0x21')]['root'];}function addVertex(_0x25a1fd,_0x4089b0,_0x5ee706){_0x4089b0[_0xe705('0x22')]=_0x5ee706;if(_0x4089b0[_0xe705('0x23')](_0xe705('0x24'))){_0x4089b0[_0xe705('0x25')]=parseInt(_0x4089b0[_0xe705('0x24')],0xa);}_0x25a1fd[_0xe705('0x26')](_['omit'](_0x4089b0,'mxCell'));}function initGraph(_0x1b4fe8,_0x58548d){var _0x166d94=new Graph();for(var _0x1608cd in _0x1b4fe8){if(_0x1b4fe8['hasOwnProperty'](_0x1608cd)){if(_['isArray'](_0x1b4fe8[_0x1608cd])){for(var _0x4f94c6=0x0;_0x4f94c6<_0x1b4fe8[_0x1608cd][_0xe705('0x27')];_0x4f94c6+=0x1){addVertex(_0x166d94,_0x1b4fe8[_0x1608cd][_0x4f94c6],_0x1608cd);}}else{addVertex(_0x166d94,_0x1b4fe8[_0x1608cd],_0x1608cd);}}}for(var _0x1de9d4=0x0;_0x1de9d4<_0x58548d[_0xe705('0x27')];_0x1de9d4+=0x1){if(_0x58548d[_0x1de9d4]['source']&&_0x58548d[_0x1de9d4]['target']){_0x166d94['addEdge'](_0x58548d[_0x1de9d4]['source'],_0x58548d[_0x1de9d4]['target'],_0x58548d[_0x1de9d4][_0xe705('0x28')]);}}return _0x166d94;}function getSquareProject(_0x4874df,_0x409429){rpc['getSquareProject'](_0x4874df)[_0xe705('0x29')](function(_0x1ee9c5){_0x409429(null,_0x1ee9c5);})[_0xe705('0x2a')](function(_0x423312){_0x409429(null,_0x423312);});}function createSquareReport(_0x15cc2b,_0x383d8f){rpc['createSquareReport'](_0x15cc2b)[_0xe705('0x29')](function(_0x1cf68b){if(_0x383d8f){_0x383d8f(null,_0x1cf68b);}})[_0xe705('0x2a')](function(_0x3ce907){if(_0x383d8f){_0x383d8f(null,_0x3ce907);}});}function setChannelVariables(_0x3289eb){for(var _0x464ba0 in _0x3289eb){if(_0x3289eb[_0xe705('0x23')](_0x464ba0)){if(_0x464ba0['indexOf'](_0xe705('0x2b'))===0x0){_0x3289eb[_0x464ba0['substring'](0x4)]=_0x3289eb[_0x464ba0];delete _0x3289eb[_0x464ba0];}}}}function getLogFromObject(_0x5c612a){return util[_0xe705('0x2c')](_0x5c612a,{'showHidden':![],'depth':null});}function agiHandler(_0x2bf44f){var _0x2b340c,_0x468e78,_0x38928a,_0xd50b05,_0x129b85;logger[_0xe705('0x2d')](_0xe705('0x2e'),JSON['stringify'](_0x2bf44f,null,0x2));logger[_0xe705('0x11')](util[_0xe705('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2bf44f[_0xe705('0x18')],_0x2bf44f[_0xe705('0x19')],_0x2bf44f[_0xe705('0x1a')],_0x2bf44f[_0xe705('0x1b')],_0x2bf44f['uniqueid']));_0x2bf44f['on']('error',errorHandler);_0x2bf44f['on'](_0xe705('0x2f'),closeHandler);_0x2bf44f['on'](_0xe705('0x30'),timeoutHandler);_0x2bf44f['evtHangup']=![];_0x2bf44f['on'](_0xe705('0x31'),hangupHandler);var _0xf66f77=getSquareProject[_0xe705('0x32')](null,_0x2bf44f['arg_1']);if(_0xf66f77){if(_0xf66f77[_0xe705('0x33')]){_0x2b340c=getRoot(_0xf66f77['production']);if(_0x2b340c&&_0x2b340c['start']){logger[_0xe705('0x2d')](_0xe705('0x34'),JSON[_0xe705('0x35')](_0x2b340c,null,0x2));_0x2bf44f[_0xe705('0x36')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x468e78=initGraph(_[_0xe705('0x37')](_0x2b340c,'mxCell'),_0x2b340c[_0xe705('0x38')]);_0x38928a=new Vertices(_0x2bf44f,rpc,mailRpc);logger[_0xe705('0x11')](util[_0xe705('0x12')](_0xe705('0x39'),_0x2bf44f['arg_1'],_0x2bf44f[_0xe705('0x19')],_0x2bf44f['callerid'],_0x2bf44f[_0xe705('0x1b')],_0x2bf44f[_0xe705('0x1d')]));_0x468e78[_0xe705('0x3a')](_0x2b340c[_0xe705('0x3b')]['id'],function(_0x3fb1fe){try{_0x3fb1fe=_0x38928a['clear'](_0x3fb1fe);logger[_0xe705('0x2d')](_0xe705('0x3c'),JSON[_0xe705('0x35')](_0x3fb1fe,null,0x2));if(_0x3fb1fe['agicommand']==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2bf44f['context']=_0x3fb1fe[_0xe705('0x3d')]||_0x2bf44f[_0xe705('0x3d')];_0x2bf44f['extension']=_0x3fb1fe[_0xe705('0x3e')];_0x2bf44f[_0xe705('0x3f')]=_0x3fb1fe[_0xe705('0x3f')]?_0x3fb1fe[_0xe705('0x3f')]-0x1:0x1;return null;}else if(_0x3fb1fe&&_0x38928a[_0x3fb1fe[_0xe705('0x22')]]){_0x129b85=_0x38928a[_0x3fb1fe['agicommand']](_0x3fb1fe);logger[_0xe705('0x11')](_0xe705('0x40'),JSON['stringify'](_0x129b85,null,0x2));if(_0x129b85&&_0x129b85[_0xe705('0x41')]===AGI_CODE_SUCCESS&&_0x129b85[_0xe705('0x42')]!==AGI_RESULT_ERROR&&!_0x2bf44f[_0xe705('0x1f')]){logger[_0xe705('0x2d')](_0xe705('0x40'),getLogFromObject(_0x129b85));return _[_0xe705('0x43')](_0x129b85[_0xe705('0x42')])?null:_0x129b85['result'][_0xe705('0x44')]();}else{logger[_0xe705('0x16')](_0xe705('0x40'),getLogFromObject(_0x129b85));return null;}}else{logger[_0xe705('0x16')](_0xe705('0x45'));return null;}}catch(_0x2b9022){logger['error'](_0x2b9022[_0xe705('0xd')]);return null;}});if(_0x2b340c[_0xe705('0x46')]){logger[_0xe705('0x11')](util[_0xe705('0x12')](_0xe705('0x47'),_0x2bf44f[_0xe705('0x18')],_0x2bf44f[_0xe705('0x19')],_0x2bf44f[_0xe705('0x1a')],_0x2bf44f[_0xe705('0x1b')],_0x2bf44f[_0xe705('0x1d')]));_0x468e78['traverseBFS'](_0x2b340c[_0xe705('0x46')]['id'],function(_0x5bc3d5){try{_0x5bc3d5=_0x38928a[_0xe705('0x48')](_0x5bc3d5);logger[_0xe705('0x2d')](_0xe705('0x3c'),JSON['stringify'](_0x5bc3d5,null,0x2));if(_0x5bc3d5&&_0x38928a[_0x5bc3d5[_0xe705('0x22')]]){_0x129b85=_0x38928a[_0x5bc3d5[_0xe705('0x22')]](_0x5bc3d5);if(_0x129b85){logger[_0xe705('0x2d')](_0xe705('0x40'),getLogFromObject(_0x129b85));return _[_0xe705('0x43')](_0x129b85[_0xe705('0x42')])?null:_0x129b85[_0xe705('0x42')][_0xe705('0x44')]();}else{logger['error'](_0xe705('0x40'),getLogFromObject(_0x129b85));return null;}}else{logger[_0xe705('0x16')](_0xe705('0x45'));return null;}}catch(_0xe7e1fe){logger['error'](_0xe7e1fe[_0xe705('0xd')]);return null;}});}logger[_0xe705('0x11')](util[_0xe705('0x12')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2bf44f[_0xe705('0x18')],_0x2bf44f[_0xe705('0x19')],_0x2bf44f[_0xe705('0x1a')],_0x2bf44f[_0xe705('0x1b')],_0x2bf44f[_0xe705('0x1d')]));logger['info'](util['format'](_0xe705('0x49'),_0x2bf44f[_0xe705('0x3d')],_0x2bf44f[_0xe705('0x3e')],parseInt(_0x2bf44f[_0xe705('0x3f')],0xa)+0x1));_0x2bf44f[_0xe705('0x4a')](_0x2bf44f[_0xe705('0x3d')],_0x2bf44f[_0xe705('0x3e')],parseInt(_0x2bf44f[_0xe705('0x3f')],0xa)+0x1);_0x2bf44f['close']();}}else{logger[_0xe705('0x16')](util['format']('Project\x20%s\x20not\x20published',_0x2bf44f[_0xe705('0x18')]));_0x2bf44f[_0xe705('0x4a')](_0x2bf44f[_0xe705('0x3d')],_0x2bf44f[_0xe705('0x3e')],parseInt(_0x2bf44f['priority'],0xa)+0x1);_0x2bf44f[_0xe705('0x2f')]();}}else{logger['error'](util[_0xe705('0x12')]('Project\x20%s\x20not\x20found',_0x2bf44f['arg_1']));_0x2bf44f[_0xe705('0x4a')](_0x2bf44f[_0xe705('0x3d')],_0x2bf44f[_0xe705('0x3e')],parseInt(_0x2bf44f[_0xe705('0x3f')],0xa)+0x1);_0x2bf44f['close']();}}function main(){var _0x46f505;return utilLicense['getLicense']()['then'](function(_0xeded9a){if(_0xeded9a){if(_0xeded9a[_0xe705('0x4b')]){if(_0xeded9a[_0xe705('0x4c')]&&_0xeded9a[_0xe705('0x4c')]>0x0){logger[_0xe705('0x11')](util[_0xe705('0x12')](_0xe705('0x4d'),_0xeded9a[_0xe705('0x4c')]));_0x46f505=_0xeded9a[_0xe705('0x4c')];}else{logger[_0xe705('0x11')](_0xe705('0x4e'));}}else{logger['info'](_0xe705('0x4f'));_0x46f505=-0x1;}}})[_0xe705('0x2a')](function(_0x10053b){logger[_0xe705('0x16')]('[LICENSE]',_0x10053b[_0xe705('0xd')]);})[_0xe705('0x46')](function(){var _0x44a4c3=require(_0xe705('0x50'))(config[_0xe705('0xb')][_0xe705('0x10')],config['agi']['ip'],_0x46f505);_0x44a4c3['on'](_0xe705('0x16'),errorHandler);_0x44a4c3['on'](_0xe705('0x51'),listeningHandler);_0x44a4c3['on'](_0xe705('0x52'),connectionHandler);_0x44a4c3['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x10d9=['sync','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','start','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','./server','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','error','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','length','source','target','addEdge','value','then','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout'];(function(_0x526818,_0x30c916){var _0x44c7e3=function(_0x364d90){while(--_0x364d90){_0x526818['push'](_0x526818['shift']());}};_0x44c7e3(++_0x30c916);}(_0x10d9,0xda));var _0x910d=function(_0x421027,_0x13ce4a){_0x421027=_0x421027-0x0;var _0x3055d7=_0x10d9[_0x421027];return _0x3055d7;};'use strict';var parser=require(_0x910d('0x0'));var _=require(_0x910d('0x1'));var syncho=require(_0x910d('0x2'));var util=require(_0x910d('0x3'));var moment=require(_0x910d('0x4'));var config=require(_0x910d('0x5'));var logger=require(_0x910d('0x6'))(_0x910d('0x7'));var utilLicense=require(_0x910d('0x8'));var rpc=require('./rpc');var mailRpc=require(_0x910d('0x9'));var Graph=require('./graph');var Vertices=require(_0x910d('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x910d('0xb')](config[_0x910d('0x7')],{'ip':_0x910d('0xc'),'port':0x11dd});function connectionHandler(_0x3e0d48){process[_0x910d('0xd')](function(){syncho(function(){try{setChannelVariables(_0x3e0d48);agiHandler(_0x3e0d48);}catch(_0x4243bb){logger['error'](_0x4243bb[_0x910d('0xe')]);}});});}function listeningHandler(){console[_0x910d('0xf')](_0x910d('0x10'),config['agi'][_0x910d('0x11')]);logger[_0x910d('0x12')](util[_0x910d('0x13')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x910d('0x7')]['ip'],config[_0x910d('0x7')][_0x910d('0x11')]));}function errorHandler(_0x159f35){if(_0x159f35&&_0x159f35[_0x910d('0x14')]&&_0x159f35['message']){logger[_0x910d('0x15')](util[_0x910d('0x13')]('[%s]\x20%s',_0x159f35[_0x910d('0x14')],_0x159f35[_0x910d('0x16')]));}else{logger[_0x910d('0x15')](util[_0x910d('0x13')](_0x910d('0x17'),_0x159f35[_0x910d('0xe')]));}}function closeHandler(){logger['info'](util[_0x910d('0x13')](_0x910d('0x18'),this[_0x910d('0x19')],this[_0x910d('0x1a')],this[_0x910d('0x1b')],this['dnid'],this[_0x910d('0x1c')]));try{createSquareReport(this);}catch(_0x4c0482){logger[_0x910d('0x15')](_0x4c0482[_0x910d('0xe')]);}}function timeoutHandler(){logger[_0x910d('0x12')](util[_0x910d('0x13')](_0x910d('0x1d'),this[_0x910d('0x19')],this['calleridname'],this[_0x910d('0x1b')],this[_0x910d('0x1e')],this['uniqueid']));}function hangupHandler(){logger[_0x910d('0x12')](util[_0x910d('0x13')](_0x910d('0x1f'),this[_0x910d('0x19')],this[_0x910d('0x1a')],this[_0x910d('0x1b')],this['dnid'],this['uniqueid']));this[_0x910d('0x20')]=!![];}function getRoot(_0xd6c64c){return parser[_0x910d('0x21')](_0xd6c64c,{'object':!![]})[_0x910d('0x22')][_0x910d('0x23')];}function addVertex(_0xe7f876,_0x5243c8,_0x194aab){_0x5243c8[_0x910d('0x24')]=_0x194aab;if(_0x5243c8[_0x910d('0x25')](_0x910d('0x26'))){_0x5243c8[_0x910d('0x27')]=parseInt(_0x5243c8['retry'],0xa);}_0xe7f876[_0x910d('0x28')](_['omit'](_0x5243c8,'mxCell'));}function initGraph(_0xd3d5b1,_0x39505e){var _0xed8750=new Graph();for(var _0xa5d8a8 in _0xd3d5b1){if(_0xd3d5b1[_0x910d('0x25')](_0xa5d8a8)){if(_['isArray'](_0xd3d5b1[_0xa5d8a8])){for(var _0x44df8b=0x0;_0x44df8b<_0xd3d5b1[_0xa5d8a8][_0x910d('0x29')];_0x44df8b+=0x1){addVertex(_0xed8750,_0xd3d5b1[_0xa5d8a8][_0x44df8b],_0xa5d8a8);}}else{addVertex(_0xed8750,_0xd3d5b1[_0xa5d8a8],_0xa5d8a8);}}}for(var _0x369029=0x0;_0x369029<_0x39505e['length'];_0x369029+=0x1){if(_0x39505e[_0x369029][_0x910d('0x2a')]&&_0x39505e[_0x369029][_0x910d('0x2b')]){_0xed8750[_0x910d('0x2c')](_0x39505e[_0x369029][_0x910d('0x2a')],_0x39505e[_0x369029][_0x910d('0x2b')],_0x39505e[_0x369029][_0x910d('0x2d')]);}}return _0xed8750;}function getSquareProject(_0x45a33b,_0x15c8e1){rpc['getSquareProject'](_0x45a33b)[_0x910d('0x2e')](function(_0x5c0776){_0x15c8e1(null,_0x5c0776);})['catch'](function(_0x48c849){_0x15c8e1(null,_0x48c849);});}function createSquareReport(_0x34ca13,_0x4730a2){rpc[_0x910d('0x2f')](_0x34ca13)['then'](function(_0x3026a6){if(_0x4730a2){_0x4730a2(null,_0x3026a6);}})['catch'](function(_0x24e1f6){if(_0x4730a2){_0x4730a2(null,_0x24e1f6);}});}function setChannelVariables(_0x588622){for(var _0x462efd in _0x588622){if(_0x588622[_0x910d('0x25')](_0x462efd)){if(_0x462efd[_0x910d('0x30')](_0x910d('0x31'))===0x0){_0x588622[_0x462efd[_0x910d('0x32')](0x4)]=_0x588622[_0x462efd];delete _0x588622[_0x462efd];}}}}function getLogFromObject(_0x322250){return util[_0x910d('0x33')](_0x322250,{'showHidden':![],'depth':null});}function agiHandler(_0x50d592){var _0x2436d5,_0x4ef035,_0x145c36,_0x351955,_0xb206c7;logger[_0x910d('0x34')](_0x910d('0x35'),JSON[_0x910d('0x36')](_0x50d592,null,0x2));logger['info'](util['format'](_0x910d('0x37'),_0x50d592[_0x910d('0x19')],_0x50d592[_0x910d('0x1a')],_0x50d592[_0x910d('0x1b')],_0x50d592[_0x910d('0x1e')],_0x50d592[_0x910d('0x1c')]));_0x50d592['on']('error',errorHandler);_0x50d592['on'](_0x910d('0x38'),closeHandler);_0x50d592['on'](_0x910d('0x39'),timeoutHandler);_0x50d592[_0x910d('0x20')]=![];_0x50d592['on']('hangup',hangupHandler);var _0x40cc25=getSquareProject[_0x910d('0x3a')](null,_0x50d592[_0x910d('0x19')]);if(_0x40cc25){if(_0x40cc25[_0x910d('0x3b')]){_0x2436d5=getRoot(_0x40cc25['production']);if(_0x2436d5&&_0x2436d5['start']){logger[_0x910d('0x34')](_0x910d('0x23'),JSON[_0x910d('0x36')](_0x2436d5,null,0x2));_0x50d592[_0x910d('0x3c')]=moment()[_0x910d('0x13')](_0x910d('0x3d'));_0x4ef035=initGraph(_[_0x910d('0x3e')](_0x2436d5,_0x910d('0x3f')),_0x2436d5['mxCell']);_0x145c36=new Vertices(_0x50d592,rpc,mailRpc);logger['info'](util[_0x910d('0x13')](_0x910d('0x40'),_0x50d592[_0x910d('0x19')],_0x50d592['calleridname'],_0x50d592[_0x910d('0x1b')],_0x50d592[_0x910d('0x1e')],_0x50d592['uniqueid']));_0x4ef035['traverseBFS'](_0x2436d5[_0x910d('0x41')]['id'],function(_0x5da500){try{_0x5da500=_0x145c36['clear'](_0x5da500);logger[_0x910d('0x34')]('vertex',JSON[_0x910d('0x36')](_0x5da500,null,0x2));if(_0x5da500[_0x910d('0x24')]==='gotoc'){logger['info'](_0x910d('0x42'));_0x50d592['context']=_0x5da500[_0x910d('0x43')]||_0x50d592[_0x910d('0x43')];_0x50d592['extension']=_0x5da500[_0x910d('0x44')];_0x50d592[_0x910d('0x45')]=_0x5da500['priority']?_0x5da500[_0x910d('0x45')]-0x1:0x1;return null;}else if(_0x5da500&&_0x145c36[_0x5da500['agicommand']]){_0xb206c7=_0x145c36[_0x5da500['agicommand']](_0x5da500);logger[_0x910d('0x12')]('response',JSON[_0x910d('0x36')](_0xb206c7,null,0x2));if(_0xb206c7&&_0xb206c7[_0x910d('0x46')]===AGI_CODE_SUCCESS&&_0xb206c7[_0x910d('0x47')]!==AGI_RESULT_ERROR&&!_0x50d592[_0x910d('0x20')]){logger[_0x910d('0x34')](_0x910d('0x48'),getLogFromObject(_0xb206c7));return _[_0x910d('0x49')](_0xb206c7[_0x910d('0x47')])?null:_0xb206c7[_0x910d('0x47')][_0x910d('0x4a')]();}else{logger[_0x910d('0x15')](_0x910d('0x48'),getLogFromObject(_0xb206c7));return null;}}else{logger[_0x910d('0x15')](_0x910d('0x4b'));return null;}}catch(_0x4e6654){logger[_0x910d('0x15')](_0x4e6654[_0x910d('0xe')]);return null;}});if(_0x2436d5[_0x910d('0x4c')]){logger['info'](util[_0x910d('0x13')](_0x910d('0x4d'),_0x50d592['arg_1'],_0x50d592['calleridname'],_0x50d592[_0x910d('0x1b')],_0x50d592['dnid'],_0x50d592[_0x910d('0x1c')]));_0x4ef035[_0x910d('0x4e')](_0x2436d5[_0x910d('0x4c')]['id'],function(_0x4ab2fb){try{_0x4ab2fb=_0x145c36['clear'](_0x4ab2fb);logger[_0x910d('0x34')](_0x910d('0x4f'),JSON['stringify'](_0x4ab2fb,null,0x2));if(_0x4ab2fb&&_0x145c36[_0x4ab2fb['agicommand']]){_0xb206c7=_0x145c36[_0x4ab2fb[_0x910d('0x24')]](_0x4ab2fb);if(_0xb206c7){logger[_0x910d('0x34')]('response',getLogFromObject(_0xb206c7));return _['isUndefined'](_0xb206c7[_0x910d('0x47')])?null:_0xb206c7['result'][_0x910d('0x4a')]();}else{logger[_0x910d('0x15')](_0x910d('0x48'),getLogFromObject(_0xb206c7));return null;}}else{logger[_0x910d('0x15')](_0x910d('0x4b'));return null;}}catch(_0x37f7f3){logger[_0x910d('0x15')](_0x37f7f3[_0x910d('0xe')]);return null;}});}logger[_0x910d('0x12')](util[_0x910d('0x13')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x50d592['arg_1'],_0x50d592[_0x910d('0x1a')],_0x50d592[_0x910d('0x1b')],_0x50d592[_0x910d('0x1e')],_0x50d592['uniqueid']));logger['info'](util[_0x910d('0x13')](_0x910d('0x50'),_0x50d592[_0x910d('0x43')],_0x50d592[_0x910d('0x44')],parseInt(_0x50d592[_0x910d('0x45')],0xa)+0x1));_0x50d592[_0x910d('0x51')](_0x50d592[_0x910d('0x43')],_0x50d592[_0x910d('0x44')],parseInt(_0x50d592[_0x910d('0x45')],0xa)+0x1);_0x50d592['close']();}}else{logger[_0x910d('0x15')](util[_0x910d('0x13')](_0x910d('0x52'),_0x50d592[_0x910d('0x19')]));_0x50d592['continueAt'](_0x50d592[_0x910d('0x43')],_0x50d592[_0x910d('0x44')],parseInt(_0x50d592[_0x910d('0x45')],0xa)+0x1);_0x50d592[_0x910d('0x38')]();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x50d592[_0x910d('0x19')]));_0x50d592[_0x910d('0x51')](_0x50d592[_0x910d('0x43')],_0x50d592[_0x910d('0x44')],parseInt(_0x50d592[_0x910d('0x45')],0xa)+0x1);_0x50d592['close']();}}function main(){var _0x25dc6b;return utilLicense[_0x910d('0x53')]()[_0x910d('0x2e')](function(_0x4ef50b){if(_0x4ef50b){if(_0x4ef50b[_0x910d('0x54')]){if(_0x4ef50b[_0x910d('0x55')]&&_0x4ef50b[_0x910d('0x55')]>0x0){logger[_0x910d('0x12')](util['format'](_0x910d('0x56'),_0x4ef50b[_0x910d('0x55')]));_0x25dc6b=_0x4ef50b[_0x910d('0x55')];}else{logger[_0x910d('0x12')](_0x910d('0x57'));}}else{logger[_0x910d('0x12')](_0x910d('0x58'));_0x25dc6b=-0x1;}}})[_0x910d('0x59')](function(_0x5c749a){logger['error']('[LICENSE]',_0x5c749a[_0x910d('0xe')]);})['finally'](function(){var _0x2bc1ad=require(_0x910d('0x5a'))(config[_0x910d('0x7')][_0x910d('0x11')],config[_0x910d('0x7')]['ip'],_0x25dc6b);_0x2bc1ad['on'](_0x910d('0x15'),errorHandler);_0x2bc1ad['on'](_0x910d('0x5b'),listeningHandler);_0x2bc1ad['on']('connection',connectionHandler);_0x2bc1ad['on'](_0x910d('0x38'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index b8d8bab..31aa6e2 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 _0x929d=['error','message','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x2ad456,_0x2735a5){var _0x641f62=function(_0x37d51c){while(--_0x37d51c){_0x2ad456['push'](_0x2ad456['shift']());}};_0x641f62(++_0x2735a5);}(_0x929d,0xaf));var _0xd929=function(_0x513bfb,_0x1983d7){_0x513bfb=_0x513bfb-0x0;var _0x1f98b3=_0x929d[_0x513bfb];return _0x1f98b3;};'use strict';var BPromise=require(_0xd929('0x0'));var jayson=require(_0xd929('0x1'));var client=jayson[_0xd929('0x2')][_0xd929('0x3')]({'port':0x232b});function request(_0x30cc15,_0x40f7ca){return new BPromise(function(_0x4f29e1,_0x49f30c){return client[_0xd929('0x4')](_0x30cc15,_0x40f7ca)['then'](function(_0x5d88c6){if(_0x5d88c6[_0xd929('0x5')]){return _0x49f30c(_0x5d88c6['error'][_0xd929('0x6')]);}else{return _0x4f29e1(_0x5d88c6['result']);}})['catch'](function(_0x1318d1){return _0x49f30c(_0x1318d1);});});}exports[_0xd929('0x7')]=function(_0x4082a2,_0x36c5f4){return request(_0xd929('0x8'),{'account':_0x4082a2,'message':_0x36c5f4});}; \ No newline at end of file +var _0x57ee=['SendMail','jayson/promise','client','then','error','message','result','catch','sendMailMessage'];(function(_0x151d6b,_0x5ac914){var _0x180832=function(_0x21086e){while(--_0x21086e){_0x151d6b['push'](_0x151d6b['shift']());}};_0x180832(++_0x5ac914);}(_0x57ee,0xbe));var _0xe57e=function(_0x867f1,_0x132028){_0x867f1=_0x867f1-0x0;var _0x2e9f5a=_0x57ee[_0x867f1];return _0x2e9f5a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xe57e('0x0'));var client=jayson[_0xe57e('0x1')]['http']({'port':0x232b});function request(_0x2a33bb,_0x4ef116){return new BPromise(function(_0x5d6b24,_0x4cdb15){return client['request'](_0x2a33bb,_0x4ef116)[_0xe57e('0x2')](function(_0xb111f5){if(_0xb111f5[_0xe57e('0x3')]){return _0x4cdb15(_0xb111f5[_0xe57e('0x3')][_0xe57e('0x4')]);}else{return _0x5d6b24(_0xb111f5[_0xe57e('0x5')]);}})[_0xe57e('0x6')](function(_0x4a436e){return _0x4cdb15(_0x4a436e);});});}exports[_0xe57e('0x7')]=function(_0x1f3382,_0x3aaa11){return request(_0xe57e('0x8'),{'account':_0x1f3382,'message':_0x3aaa11});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 7e56752..30dbda1 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 _0xb4d3=['line','util','stream','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','split','trim','slice','emit','headers'];(function(_0x42fe0c,_0xc5aa9b){var _0x360e5f=function(_0xba9838){while(--_0xba9838){_0x42fe0c['push'](_0x42fe0c['shift']());}};_0x360e5f(++_0xc5aa9b);}(_0xb4d3,0x199));var _0x3b4d=function(_0xe775be,_0x4822af){_0xe775be=_0xe775be-0x0;var _0x49e73c=_0xb4d3[_0xe775be];return _0x49e73c;};'use strict';var util=require(_0x3b4d('0x0'));var Transform=require(_0x3b4d('0x1'))['Transform'];function AGIReply(_0x43c3c2){Transform['call'](this,_0x43c3c2);this['_localBuffer']='';this[_0x3b4d('0x2')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x3b4d('0x3')][_0x3b4d('0x4')]=function(_0x9ba500,_0x403426,_0x7f62c6){var _0x587d2b='\x0a',_0xc75b22=['\x0a\x0a',_0x3b4d('0x5')],_0x49159e=-0x1,_0x46b6cf=-0x1,_0x2e9ec4='',_0x3b64f6=0x0,_0x163096='',_0x1c7440='';this[_0x3b4d('0x6')]+=_0x9ba500[_0x3b4d('0x7')]();_0x163096=this['_localBuffer'];if(!this[_0x3b4d('0x2')]){_0x3b64f6=0x0;while(_0xc75b22[_0x3b64f6]){while((_0x46b6cf=_0x163096[_0x3b4d('0x8')](_0xc75b22[_0x3b64f6]))!=-0x1){_0x2e9ec4=_0xc75b22[_0x3b64f6];_0x1c7440=_0x163096[_0x3b4d('0x9')](0x0,_0x46b6cf);_0x163096=_0x163096['substring'](_0x46b6cf+_0x2e9ec4[_0x3b4d('0xa')]);var _0x14298e=_0x1c7440[_0x3b4d('0xb')](_0x587d2b),_0x5108d4=0x0,_0x4c30bd={},_0x4aedfd='',_0x2de391='',_0x277f89=-0x1;while(_0x14298e[_0x5108d4]){_0x277f89=_0x14298e[_0x5108d4][_0x3b4d('0x8')](':');if(_0x277f89!=-0x1){_0x4aedfd=_0x14298e[_0x5108d4]['slice'](0x0,_0x277f89)[_0x3b4d('0xc')]();_0x2de391=_0x14298e[_0x5108d4][_0x3b4d('0xd')](_0x277f89+0x1)[_0x3b4d('0xc')]();if(_0x4aedfd[_0x3b4d('0xa')]>0x0){_0x4c30bd[_0x4aedfd]=_0x2de391;}}else{}_0x5108d4++;}this[_0x3b4d('0xe')](_0x3b4d('0xf'),_0x4c30bd);this[_0x3b4d('0x2')]=!![];}_0x3b64f6++;}this[_0x3b4d('0x6')]=_0x163096;}else{while((_0x49159e=_0x163096[_0x3b4d('0x8')](_0x587d2b))!=-0x1){_0x1c7440=_0x163096[_0x3b4d('0x9')](0x0,_0x49159e);this[_0x3b4d('0xe')](_0x3b4d('0x10'),_0x1c7440);_0x163096=_0x163096[_0x3b4d('0x9')](_0x49159e+_0x587d2b['length']);}this[_0x3b4d('0x6')]=_0x163096;}_0x7f62c6();};module['exports']=AGIReply; \ No newline at end of file +var _0xab75=['emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','trim','slice','length','headers'];(function(_0x394df8,_0x502f5c){var _0x1f484a=function(_0x27f2ea){while(--_0x27f2ea){_0x394df8['push'](_0x394df8['shift']());}};_0x1f484a(++_0x502f5c);}(_0xab75,0xe7));var _0x5ab7=function(_0x366b74,_0xd27e97){_0x366b74=_0x366b74-0x0;var _0x481aa2=_0xab75[_0x366b74];return _0x481aa2;};'use strict';var util=require(_0x5ab7('0x0'));var Transform=require(_0x5ab7('0x1'))[_0x5ab7('0x2')];function AGIReply(_0x579cd3){Transform[_0x5ab7('0x3')](this,_0x579cd3);this[_0x5ab7('0x4')]='';this[_0x5ab7('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x5ab7('0x6')]['_transform']=function(_0x4eb4aa,_0x2a9ab7,_0x293ab8){var _0x537788='\x0a',_0xc30ae1=['\x0a\x0a',_0x5ab7('0x7')],_0x2a91d2=-0x1,_0x26284b=-0x1,_0x5aa8e8='',_0x52b7b6=0x0,_0x438c96='',_0x4f1635='';this[_0x5ab7('0x4')]+=_0x4eb4aa[_0x5ab7('0x8')]();_0x438c96=this[_0x5ab7('0x4')];if(!this[_0x5ab7('0x5')]){_0x52b7b6=0x0;while(_0xc30ae1[_0x52b7b6]){while((_0x26284b=_0x438c96[_0x5ab7('0x9')](_0xc30ae1[_0x52b7b6]))!=-0x1){_0x5aa8e8=_0xc30ae1[_0x52b7b6];_0x4f1635=_0x438c96['substring'](0x0,_0x26284b);_0x438c96=_0x438c96[_0x5ab7('0xa')](_0x26284b+_0x5aa8e8['length']);var _0x606bda=_0x4f1635[_0x5ab7('0xb')](_0x537788),_0x1390c0=0x0,_0x4b2008={},_0x297585='',_0x235a7d='',_0x3e7f38=-0x1;while(_0x606bda[_0x1390c0]){_0x3e7f38=_0x606bda[_0x1390c0][_0x5ab7('0x9')](':');if(_0x3e7f38!=-0x1){_0x297585=_0x606bda[_0x1390c0]['slice'](0x0,_0x3e7f38)[_0x5ab7('0xc')]();_0x235a7d=_0x606bda[_0x1390c0][_0x5ab7('0xd')](_0x3e7f38+0x1)[_0x5ab7('0xc')]();if(_0x297585[_0x5ab7('0xe')]>0x0){_0x4b2008[_0x297585]=_0x235a7d;}}else{}_0x1390c0++;}this['emit'](_0x5ab7('0xf'),_0x4b2008);this[_0x5ab7('0x5')]=!![];}_0x52b7b6++;}this[_0x5ab7('0x4')]=_0x438c96;}else{while((_0x2a91d2=_0x438c96['indexOf'](_0x537788))!=-0x1){_0x4f1635=_0x438c96[_0x5ab7('0xa')](0x0,_0x2a91d2);this[_0x5ab7('0x10')](_0x5ab7('0x11'),_0x4f1635);_0x438c96=_0x438c96['substring'](_0x2a91d2+_0x537788[_0x5ab7('0xe')]);}this[_0x5ab7('0x4')]=_0x438c96;}_0x293ab8();};module[_0x5ab7('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b2dd9b8..92b8214 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 _0x0d64=['getPauseById','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','util','client','http','request','then','error','message','result','catch','ShowSquareProject','getMailAccountById','MailServerOut','name','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact'];(function(_0x5c9733,_0x270f20){var _0x239458=function(_0x2bcd9a){while(--_0x2bcd9a){_0x5c9733['push'](_0x5c9733['shift']());}};_0x239458(++_0x270f20);}(_0x0d64,0x77));var _0x40d6=function(_0x30066f,_0x5891c9){_0x30066f=_0x30066f-0x0;var _0x1ad673=_0x0d64[_0x30066f];return _0x1ad673;};'use strict';var BPromise=require(_0x40d6('0x0'));var moment=require('moment');var _=require(_0x40d6('0x1'));var util=require(_0x40d6('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x40d6('0x3')][_0x40d6('0x4')]({'port':0x2329});function request(_0x59340b,_0x1c9abe){return new BPromise(function(_0xa5722b,_0x1b6003){return client[_0x40d6('0x5')](_0x59340b,_0x1c9abe)[_0x40d6('0x6')](function(_0x2b8aae){if(_0x2b8aae[_0x40d6('0x7')]){return _0x1b6003(_0x2b8aae[_0x40d6('0x7')][_0x40d6('0x8')]);}else{return _0xa5722b(_0x2b8aae[_0x40d6('0x9')]);}})[_0x40d6('0xa')](function(_0x46987b){return _0x1b6003(_0x46987b);});});}exports['getSquareProject']=function(_0x591bd4){return request(_0x40d6('0xb'),{'options':{'raw':![],'where':{'name':_0x591bd4},'attributes':['production']}});};exports[_0x40d6('0xc')]=function(_0x1af8f2){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1af8f2},'include':[{'model':_0x40d6('0xd'),'as':'Smtp'}],'attributes':['id',_0x40d6('0xe'),'email']}});};exports['getSquareProjectById']=function(_0x51786d){return request(_0x40d6('0xb'),{'options':{'where':{'id':_0x51786d},'attributes':[_0x40d6('0xe')]}});};exports[_0x40d6('0xf')]=function(_0x2d5fb7){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2d5fb7},'attributes':[_0x40d6('0xe')]}});};exports[_0x40d6('0x10')]=function(_0x44ae12){return request(_0x40d6('0x11'),{'options':{'where':{'id':_0x44ae12},'attributes':['name']}});};exports[_0x40d6('0x12')]=function(_0x29392b){return request(_0x40d6('0x13'),{'options':{'where':{'id':_0x29392b},'attributes':[_0x40d6('0x14')]}});};exports[_0x40d6('0x15')]=function(_0x3577bf){return request(_0x40d6('0x16'),{'options':{'where':{'id':_0x3577bf},'attributes':[_0x40d6('0xe')]}});};exports[_0x40d6('0x17')]=function(_0x5866e9){return request(_0x40d6('0x18'),{'options':{'where':{'phone':_0x5866e9[_0x40d6('0x19')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1118ee){return request(_0x40d6('0x1a'),{'options':{'where':{'id':_0x1118ee},'attributes':[_0x40d6('0xe')]}});};exports[_0x40d6('0x1b')]=function(_0x41a0f3){return request(_0x40d6('0x1c'),{'options':{'where':{'id':_0x41a0f3},'attributes':['save_name']}});};exports[_0x40d6('0x1d')]=function(_0x495e33){return request(_0x40d6('0x1e'),{'options':{'raw':![],'where':{'id':_0x495e33},'include':[{'model':_0x40d6('0x1f'),'as':_0x40d6('0x20')}]}});};exports[_0x40d6('0x21')]=function(_0x24b137){return request(_0x40d6('0x22'),{'options':{'where':{'id':_0x24b137},'attributes':['id','name']}});};exports[_0x40d6('0x23')]=function(_0x3dfbab){return request('CreateSmsMessage',{'body':_0x3dfbab});};exports['createSquareDetailsReport']=function(_0x4fa4f2){return request(_0x40d6('0x24'),{'body':_0x4fa4f2});};exports[_0x40d6('0x25')]=function(_0x3357ba){return request('CreateSquareReport',{'body':_[_0x40d6('0x26')](_0x3357ba,{'project_name':_0x3357ba[_0x40d6('0x27')],'prev_project_name':_0x3357ba[_0x40d6('0x28')]||'','is_subproject':_0x3357ba[_0x40d6('0x28')]?!![]:![],'leaveAt':moment()[_0x40d6('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x40d6('0x2a')]=function(_0x2ddc43){return request(_0x40d6('0x2b'),{'body':_0x2ddc43});};exports[_0x40d6('0x2c')]=function(_0xefff2d){return request(_0x40d6('0x2d'),{'body':_0xefff2d});};exports['createCmContact']=function(_0x4b619e){return request(_0x40d6('0x2e'),{'options':{'raw':![],'where':{'phone':_0x4b619e[_0x40d6('0x19')],'ListId':_0x4b619e[_0x40d6('0x2f')]}}})[_0x40d6('0x6')](function(_0x21fec7){if(_0x21fec7){return _0x21fec7;}return request(_0x40d6('0x30'),{'body':_0x4b619e});});};exports[_0x40d6('0x31')]=function(_0x545df0){return request('ShowPause',{'options':{'where':{'id':_0x545df0},'attributes':[_0x40d6('0xe')]}});};exports['agentLogin']=function(_0x5f303a,_0x45c95d){return request(_0x40d6('0x32'),{'body':{'interface':_0x45c95d},'options':{'where':_0x5f303a}});};exports['agentPause']=function(_0x5274dc,_0x21759e,_0x155384){return request(_0x40d6('0x33'),{'body':{'type':_0x21759e,'uniqueid':_0x155384},'options':{'where':_0x5274dc}});};exports[_0x40d6('0x34')]=function(_0x52fc71){return request(_0x40d6('0x35'),{'body':{},'options':{'where':_0x52fc71}});};exports[_0x40d6('0x36')]=function(_0x1e9b50){return request(_0x40d6('0x37'),{'body':{},'options':{'where':_0x1e9b50}});}; \ No newline at end of file +var _0xb957=['message','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentLogout','lodash','jayson/promise','client','http','request','then','error'];(function(_0x7f677f,_0x5f2c1c){var _0x5acea1=function(_0x21e95e){while(--_0x21e95e){_0x7f677f['push'](_0x7f677f['shift']());}};_0x5acea1(++_0x5f2c1c);}(_0xb957,0x6d));var _0x7b95=function(_0x2e9606,_0x3fae6a){_0x2e9606=_0x2e9606-0x0;var _0x4662ca=_0xb957[_0x2e9606];return _0x4662ca;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x7b95('0x0'));var util=require('util');var jayson=require(_0x7b95('0x1'));var client=jayson[_0x7b95('0x2')][_0x7b95('0x3')]({'port':0x2329});function request(_0x583b12,_0x45db17){return new BPromise(function(_0x2c8a4d,_0x3fe0b3){return client[_0x7b95('0x4')](_0x583b12,_0x45db17)[_0x7b95('0x5')](function(_0x518099){if(_0x518099[_0x7b95('0x6')]){return _0x3fe0b3(_0x518099[_0x7b95('0x6')][_0x7b95('0x7')]);}else{return _0x2c8a4d(_0x518099['result']);}})['catch'](function(_0x37e526){return _0x3fe0b3(_0x37e526);});});}exports[_0x7b95('0x8')]=function(_0x2e82e6){return request(_0x7b95('0x9'),{'options':{'raw':![],'where':{'name':_0x2e82e6},'attributes':['production']}});};exports['getMailAccountById']=function(_0x509a65){return request(_0x7b95('0xa'),{'options':{'raw':![],'where':{'id':_0x509a65},'include':[{'model':_0x7b95('0xb'),'as':'Smtp'}],'attributes':['id','name',_0x7b95('0xc')]}});};exports[_0x7b95('0xd')]=function(_0xaf6e2f){return request('ShowSquareProject',{'options':{'where':{'id':_0xaf6e2f},'attributes':['name']}});};exports[_0x7b95('0xe')]=function(_0x48fcb0){return request(_0x7b95('0xf'),{'options':{'where':{'id':_0x48fcb0},'attributes':[_0x7b95('0x10')]}});};exports[_0x7b95('0x11')]=function(_0x3818bd){return request('ShowVariable',{'options':{'where':{'id':_0x3818bd},'attributes':['name']}});};exports[_0x7b95('0x12')]=function(_0x1fd4e5){return request(_0x7b95('0x13'),{'options':{'where':{'id':_0x1fd4e5},'attributes':[_0x7b95('0x14')]}});};exports[_0x7b95('0x15')]=function(_0x2ee847){return request(_0x7b95('0x16'),{'options':{'where':{'id':_0x2ee847},'attributes':[_0x7b95('0x10')]}});};exports[_0x7b95('0x17')]=function(_0x4251d5){return request(_0x7b95('0x18'),{'options':{'where':{'phone':_0x4251d5['phone']},'attributes':['id']}});};exports[_0x7b95('0x19')]=function(_0xed383){return request(_0x7b95('0x1a'),{'options':{'where':{'id':_0xed383},'attributes':[_0x7b95('0x10')]}});};exports[_0x7b95('0x1b')]=function(_0xc26a6e){return request(_0x7b95('0x1c'),{'options':{'where':{'id':_0xc26a6e},'attributes':[_0x7b95('0x1d')]}});};exports['getIntervalById']=function(_0x2b8912){return request(_0x7b95('0x1e'),{'options':{'raw':![],'where':{'id':_0x2b8912},'include':[{'model':_0x7b95('0x1f'),'as':_0x7b95('0x20')}]}});};exports[_0x7b95('0x21')]=function(_0x7bdedd){return request(_0x7b95('0x22'),{'options':{'where':{'id':_0x7bdedd},'attributes':['id',_0x7b95('0x10')]}});};exports[_0x7b95('0x23')]=function(_0x3deae3){return request(_0x7b95('0x24'),{'body':_0x3deae3});};exports[_0x7b95('0x25')]=function(_0x20c0d9){return request(_0x7b95('0x26'),{'body':_0x20c0d9});};exports['createSquareReport']=function(_0x1c0a41){return request(_0x7b95('0x27'),{'body':_['merge'](_0x1c0a41,{'project_name':_0x1c0a41[_0x7b95('0x28')],'prev_project_name':_0x1c0a41[_0x7b95('0x29')]||'','is_subproject':_0x1c0a41[_0x7b95('0x29')]?!![]:![],'leaveAt':moment()[_0x7b95('0x2a')](_0x7b95('0x2b'))})});};exports[_0x7b95('0x2c')]=function(_0x3b9d60){return request('CreateSquareRecording',{'body':_0x3b9d60});};exports[_0x7b95('0x2d')]=function(_0x58ea1d){return request(_0x7b95('0x2e'),{'body':_0x58ea1d});};exports[_0x7b95('0x2f')]=function(_0x1b6e6b){return request(_0x7b95('0x30'),{'options':{'raw':![],'where':{'phone':_0x1b6e6b[_0x7b95('0x31')],'ListId':_0x1b6e6b[_0x7b95('0x32')]}}})['then'](function(_0x2b3571){if(_0x2b3571){return _0x2b3571;}return request(_0x7b95('0x33'),{'body':_0x1b6e6b});});};exports['getPauseById']=function(_0x3a771c){return request(_0x7b95('0x34'),{'options':{'where':{'id':_0x3a771c},'attributes':[_0x7b95('0x10')]}});};exports[_0x7b95('0x35')]=function(_0x4bcd35,_0x3be0ae){return request(_0x7b95('0x36'),{'body':{'interface':_0x3be0ae},'options':{'where':_0x4bcd35}});};exports[_0x7b95('0x37')]=function(_0x5a9488,_0x4fe17e,_0x57def4){return request(_0x7b95('0x38'),{'body':{'type':_0x4fe17e,'uniqueid':_0x57def4},'options':{'where':_0x5a9488}});};exports['agentUnpause']=function(_0x324f02){return request('UnpauseUser',{'body':{},'options':{'where':_0x324f02}});};exports[_0x7b95('0x39')]=function(_0x2209a4){return request('LogoutUser',{'body':{},'options':{'where':_0x2209a4}});}; \ 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 49667a8..d6278df 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 _0x77a9=['./polly','exports'];(function(_0x1c28e2,_0xa04e08){var _0x1d7504=function(_0x4c5252){while(--_0x4c5252){_0x1c28e2['push'](_0x1c28e2['shift']());}};_0x1d7504(++_0xa04e08);}(_0x77a9,0x19e));var _0x977a=function(_0x2ffafd,_0xb60bbd){_0x2ffafd=_0x2ffafd-0x0;var _0x10164d=_0x77a9[_0x2ffafd];return _0x10164d;};var polly=require(_0x977a('0x0'));var lex=require('./lex');module[_0x977a('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc1fa=['./lex','exports','./polly'];(function(_0x2e0816,_0x38d9b8){var _0x3e3580=function(_0x5bc0df){while(--_0x5bc0df){_0x2e0816['push'](_0x2e0816['shift']());}};_0x3e3580(++_0x38d9b8);}(_0xc1fa,0x83));var _0xac1f=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xc1fa[_0x2bf888];return _0x3038d6;};var polly=require(_0xac1f('0x0'));var lex=require(_0xac1f('0x1'));module[_0xac1f('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index dc69333..b925ad5 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 _0x70e0=['exports','./lib/api'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x70e0,0x17b));var _0x070e=function(_0xdde685,_0x357eed){_0xdde685=_0xdde685-0x0;var _0x446a60=_0x70e0[_0xdde685];return _0x446a60;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f){return lex(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f);}; \ 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 b4ba2de..a46ab9d 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(_0xc67294,_0xd60598){var _0x5dc479=function(_0x59ac2e){while(--_0x59ac2e){_0xc67294['push'](_0xc67294['shift']());}};_0x5dc479(++_0xd60598);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x185f1a,_0x397ea9){var _0x163dff=function(_0x34b4bb){while(--_0x34b4bb){_0x185f1a['push'](_0x185f1a['shift']());}};_0x163dff(++_0x397ea9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 7d10d32..7d7a25c 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b49=['exports'];(function(_0x5df2b4,_0xebbff7){var _0x1e51f5=function(_0x3bf5df){while(--_0x3bf5df){_0x5df2b4['push'](_0x5df2b4['shift']());}};_0x1e51f5(++_0xebbff7);}(_0x8b49,0x64));var _0x98b4=function(_0x5a1cf3,_0x161eca){_0x5a1cf3=_0x5a1cf3-0x0;var _0x24d3cc=_0x8b49[_0x5a1cf3];return _0x24d3cc;};'use strict';var polly=require('./lib/api');module[_0x98b4('0x0')]=function(_0x49b01e,_0x4327f0,_0x12d179,_0x2467d6,_0x5244c9,_0x206deb,_0x3ea223){return polly(_0x49b01e,_0x4327f0,_0x12d179,_0x2467d6,_0x5244c9,_0x206deb,_0x3ea223);}; \ No newline at end of file +var _0xe17e=['exports','./lib/api'];(function(_0xb3e41b,_0x473fa0){var _0x2cf08c=function(_0x3a45fe){while(--_0x3a45fe){_0xb3e41b['push'](_0xb3e41b['shift']());}};_0x2cf08c(++_0x473fa0);}(_0xe17e,0x179));var _0xee17=function(_0x5b1527,_0x16973e){_0x5b1527=_0x5b1527-0x0;var _0x58651d=_0xe17e[_0x5b1527];return _0x58651d;};'use strict';var polly=require(_0xee17('0x0'));module[_0xee17('0x1')]=function(_0x2bac02,_0x1ab7a3,_0x3ae428,_0x2c389a,_0x26b97d,_0x62eaf6,_0x213049){return polly(_0x2bac02,_0x1ab7a3,_0x3ae428,_0x2c389a,_0x26b97d,_0x62eaf6,_0x213049);}; \ 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 13d409d..f8e7143 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 _0xfc1b=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','randomstring','aws-sdk','writeFile'];(function(_0xffaa8a,_0x3902f8){var _0x336455=function(_0x5d6087){while(--_0x5d6087){_0xffaa8a['push'](_0xffaa8a['shift']());}};_0x336455(++_0x3902f8);}(_0xfc1b,0xcf));var _0xbfc1=function(_0x2a340c,_0x5144cc){_0x2a340c=_0x2a340c-0x0;var _0x53d29b=_0xfc1b[_0x2a340c];return _0x53d29b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0xbfc1('0x0'));var AWS=require(_0xbfc1('0x1'));function pollyResult(_0x33909a,_0x2b2609,_0x579355){return new BPromise(function(_0x8cc5a5,_0x5cbb0c){_0x33909a['synthesizeSpeech'](_0x2b2609,function(_0x2615a1,_0x1dad37){if(_0x2615a1){_0x5cbb0c(_0x2615a1);}else if(_0x1dad37){if(_0x1dad37['AudioStream']instanceof Buffer){fs[_0xbfc1('0x2')](_0x579355,_0x1dad37['AudioStream'],function(_0xb41c9c){if(_0xb41c9c){_0x5cbb0c(_0xb41c9c);}else{_0x8cc5a5();}});}else{_0x5cbb0c(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5cbb0c(new Error(_0xbfc1('0x3')));}});});}module[_0xbfc1('0x4')]=function(_0x46b7e7,_0x45c2d0,_0x47801d,_0x6c2ccb,_0x630050,_0x116b77,_0x2020ee){var _0xb8269=new AWS[(_0xbfc1('0x5'))]({'accessKeyId':_0x46b7e7,'secretAccessKey':_0x45c2d0,'region':_0x47801d});var _0x34ae61={'Text':_0x630050,'TextType':_0x116b77||_0xbfc1('0x6'),'OutputFormat':'mp3','VoiceId':_0x6c2ccb};return pollyResult(_0xb8269,_0x34ae61,_0x2020ee);}; \ No newline at end of file +var _0x8e13=['No\x20data\x20response\x20from\x20aws\x20Polly!','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8e13,0x89));var _0x38e1=function(_0x200c0b,_0x40eafa){_0x200c0b=_0x200c0b-0x0;var _0x4c48ff=_0x8e13[_0x200c0b];return _0x4c48ff;};'use strict';var fs=require('fs');var path=require(_0x38e1('0x0'));var BPromise=require(_0x38e1('0x1'));var rs=require(_0x38e1('0x2'));var AWS=require(_0x38e1('0x3'));function pollyResult(_0x45ee0b,_0x43b297,_0x4d8ff5){return new BPromise(function(_0x361c43,_0x17b01a){_0x45ee0b[_0x38e1('0x4')](_0x43b297,function(_0x57d766,_0xcd35a7){if(_0x57d766){_0x17b01a(_0x57d766);}else if(_0xcd35a7){if(_0xcd35a7['AudioStream']instanceof Buffer){fs[_0x38e1('0x5')](_0x4d8ff5,_0xcd35a7[_0x38e1('0x6')],function(_0x642169){if(_0x642169){_0x17b01a(_0x642169);}else{_0x361c43();}});}else{_0x17b01a(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x17b01a(new Error(_0x38e1('0x7')));}});});}module['exports']=function(_0x288b88,_0xf1e4ff,_0x56aed3,_0x88843,_0x4e7482,_0x388501,_0x3df268){var _0x114f0d=new AWS['Polly']({'accessKeyId':_0x288b88,'secretAccessKey':_0xf1e4ff,'region':_0x56aed3});var _0x57dfd8={'Text':_0x4e7482,'TextType':_0x388501||'text','OutputFormat':_0x38e1('0x8'),'VoiceId':_0x88843};return pollyResult(_0x114f0d,_0x57dfd8,_0x3df268);}; \ 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 6de3570..0ec537b 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 _0xec5e=['./lib/api'];(function(_0x1c351a,_0x238ecc){var _0x17c7a2=function(_0x38a885){while(--_0x38a885){_0x1c351a['push'](_0x1c351a['shift']());}};_0x17c7a2(++_0x238ecc);}(_0xec5e,0x8d));var _0xeec5=function(_0x16f48e,_0x2d2d97){_0x16f48e=_0x16f48e-0x0;var _0x11524f=_0xec5e[_0x16f48e];return _0x11524f;};'use strict';var asr=require(_0xeec5('0x0'));module['exports']=function(_0x55e494,_0x2bd648,_0x5e9f6e,_0x3a650d){return asr(_0x55e494,_0x2bd648,_0x5e9f6e);}; \ No newline at end of file +var _0xfe8c=['exports','./lib/api'];(function(_0x335c02,_0x368cf4){var _0x555a00=function(_0x858304){while(--_0x858304){_0x335c02['push'](_0x335c02['shift']());}};_0x555a00(++_0x368cf4);}(_0xfe8c,0x1c1));var _0xcfe8=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0xfe8c[_0x3e0b8f];return _0x22f742;};'use strict';var asr=require(_0xcfe8('0x0'));module[_0xcfe8('0x1')]=function(_0x32337c,_0x52cfc3,_0x142513,_0x456efe){return asr(_0x32337c,_0x52cfc3,_0x142513);}; \ 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 797128f..8c52d0f 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 _0x34e8=['string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x2e0681,_0x12f666){var _0x594eed=function(_0x5a89b3){while(--_0x5a89b3){_0x2e0681['push'](_0x2e0681['shift']());}};_0x594eed(++_0x12f666);}(_0x34e8,0x12c));var _0x834e=function(_0x1c0da1,_0x5d2573){_0x1c0da1=_0x1c0da1-0x0;var _0x493c72=_0x34e8[_0x1c0da1];return _0x493c72;};'use strict';var url=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var fs=require('fs');var host=_0x834e('0x2');module[_0x834e('0x3')]=function(_0x530939,_0x832422,_0x21e2e0){return new BPromise(function(_0x472111,_0x31bf20){var _0x289ef2;if(typeof _0x530939!==_0x834e('0x4')||_0x530939[_0x834e('0x5')]===0x0){return _0x31bf20('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x832422!==_0x834e('0x4')||_0x832422['length']===0x0){return _0x31bf20(_0x834e('0x6'));}if(typeof _0x21e2e0!==_0x834e('0x7')&&(typeof _0x21e2e0!==_0x834e('0x4')||_0x21e2e0[_0x834e('0x5')]===0x0)){return _0x31bf20(_0x834e('0x8'));}try{_0x289ef2=fs[_0x834e('0x9')](_0x530939)[_0x834e('0xa')](_0x834e('0xb'));}catch(_0x3bdda9){return _0x31bf20(_0x3bdda9);}return _0x472111({'method':_0x834e('0xc'),'uri':host+_0x834e('0xd')+_0x832422,'body':{'config':{'encoding':_0x834e('0xe'),'sampleRateHertz':_0x834e('0xf'),'languageCode':_0x21e2e0},'audio':{'content':_0x289ef2}},'json':!![]});});}; \ No newline at end of file +var _0x87f8=['length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key=','LINEAR16','exports','string'];(function(_0x12a17c,_0x54d2c1){var _0x2b5648=function(_0x378afb){while(--_0x378afb){_0x12a17c['push'](_0x12a17c['shift']());}};_0x2b5648(++_0x54d2c1);}(_0x87f8,0x152));var _0x887f=function(_0x4639c6,_0x3de40){_0x4639c6=_0x4639c6-0x0;var _0x31e5aa=_0x87f8[_0x4639c6];return _0x31e5aa;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x887f('0x0')]=function(_0x13309f,_0x5be12b,_0x28ce3c){return new BPromise(function(_0x591ca0,_0x46a51e){var _0x3ce88c;if(typeof _0x13309f!==_0x887f('0x1')||_0x13309f[_0x887f('0x2')]===0x0){return _0x46a51e('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5be12b!==_0x887f('0x1')||_0x5be12b[_0x887f('0x2')]===0x0){return _0x46a51e(_0x887f('0x3'));}if(typeof _0x28ce3c!==_0x887f('0x4')&&(typeof _0x28ce3c!==_0x887f('0x1')||_0x28ce3c[_0x887f('0x2')]===0x0)){return _0x46a51e(_0x887f('0x5'));}try{_0x3ce88c=fs['readFileSync'](_0x13309f)[_0x887f('0x6')]('base64');}catch(_0x130293){return _0x46a51e(_0x130293);}return _0x591ca0({'method':_0x887f('0x7'),'uri':host+_0x887f('0x8')+_0x5be12b,'body':{'config':{'encoding':_0x887f('0x9'),'sampleRateHertz':'8000','languageCode':_0x28ce3c},'audio':{'content':_0x3ce88c}},'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 99c6840..2a8cec4 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 _0xba04=['./asr','exports'];(function(_0x4837a2,_0x1977e2){var _0x10fa24=function(_0x156ca3){while(--_0x156ca3){_0x4837a2['push'](_0x4837a2['shift']());}};_0x10fa24(++_0x1977e2);}(_0xba04,0x1b0));var _0x4ba0=function(_0x234cea,_0x47f64c){_0x234cea=_0x234cea-0x0;var _0xd80367=_0xba04[_0x234cea];return _0xd80367;};var asr=require(_0x4ba0('0x0'));module[_0x4ba0('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7a17=['exports'];(function(_0x187826,_0x357251){var _0x2c22f5=function(_0x19159e){while(--_0x19159e){_0x187826['push'](_0x187826['shift']());}};_0x2c22f5(++_0x357251);}(_0x7a17,0x114));var _0x77a1=function(_0x1ba54d,_0x20e2c0){_0x1ba54d=_0x1ba54d-0x0;var _0x3075e2=_0x7a17[_0x1ba54d];return _0x3075e2;};var asr=require('./asr');module[_0x77a1('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 0fcb362..a33f4af 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 _0xfc0b=['https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','finish','info','close','pipe','data','end','transcode','wav','error\x20convert','start','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','readFileSync','toString','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','POST','.mp3','from','audioContent','writeFile','tmp','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','speech','status','code','metadata','isFallbackIntent','SessionsClient','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','awsLex','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','model=%s','freeform=3','sestekNDA','nda','channelData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','md5','request-promise','randomstring','sox','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi'];(function(_0x2f216e,_0x49fe17){var _0x39d475=function(_0x2f6eb6){while(--_0x2f6eb6){_0x2f216e['push'](_0x2f216e['shift']());}};_0x39d475(++_0x49fe17);}(_0xfc0b,0xfa));var _0xbfc0=function(_0x2b6831,_0x2c4264){_0x2b6831=_0x2b6831-0x0;var _0x4b702d=_0xfc0b[_0x2b6831];return _0x4b702d;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xbfc0('0x0'));var fs=require('fs');var http=require(_0xbfc0('0x1'));var https=require('https');var md5=require(_0xbfc0('0x2'));var path=require('path');var querystring=require('querystring');var rp=require(_0xbfc0('0x3'));var rs=require(_0xbfc0('0x4'));var sox=require(_0xbfc0('0x5'));var tts=require('google-tts-api');var urlParse=require(_0xbfc0('0x6'))[_0xbfc0('0x7')];var util=require(_0xbfc0('0x8'));var aws=require('./aws');var google=require(_0xbfc0('0x9'));var sestek=require(_0xbfc0('0xa'));var tilde=require(_0xbfc0('0xb'));var logger=require(_0xbfc0('0xc'))(_0xbfc0('0xd'));var ISPEECH_API=_0xbfc0('0xe');function downloadFile(_0x561c62,_0x189b5c){return new BPromise(function(_0x5a82ab,_0x4a780b){var _0xfb5f8c=urlParse(_0x561c62);var _0x1f5c7d=_0xfb5f8c[_0xbfc0('0xf')]===_0xbfc0('0x10')?https:http;var _0x1b4652={'host':_0xfb5f8c[_0xbfc0('0x11')],'path':_0xfb5f8c['path'],'headers':{'user-agent':_0xbfc0('0x12')}};_0x1f5c7d[_0xbfc0('0x13')](_0x1b4652,function(_0x22b977){if(_0x22b977['statusCode']!==0xc8){logger[_0xbfc0('0x14')](_0xbfc0('0x15')+_0x561c62+_0xbfc0('0x16')+_0x22b977['statusCode']+'\x20('+_0x22b977[_0xbfc0('0x17')]+')');_0x4a780b(new Error(_0xbfc0('0x15')+_0x561c62+'\x20failed,\x20status\x20code\x20=\x20'+_0x22b977[_0xbfc0('0x18')]+'\x20('+_0x22b977[_0xbfc0('0x17')]+')'));return;}var _0x9ee22b=fs['createWriteStream'](_0x189b5c);_0x9ee22b['on'](_0xbfc0('0x19'),function(){logger[_0xbfc0('0x1a')]('finish\x20download\x20file');_0x9ee22b[_0xbfc0('0x1b')](_0x5a82ab);});_0x9ee22b['on']('error',function(_0x367452){fs['unlink'](_0x189b5c);logger[_0xbfc0('0x14')]('download\x20error',_0x367452);_0x4a780b(_0x367452);});_0x22b977[_0xbfc0('0x1c')](_0x9ee22b);})['on'](_0xbfc0('0x14'),function(_0x1835da){logger[_0xbfc0('0x14')](_0x1835da);_0x4a780b(_0x1835da);})['end']();});}function uploadFile(_0x358598){return new BPromise(function(_0x4db783,_0x14bb5e){var _0xfcd4ef=urlParse(_0x358598);var _0x285c7f=_0xfcd4ef[_0xbfc0('0xf')]===_0xbfc0('0x10')?https:http;var _0x9296f4={'host':_0xfcd4ef[_0xbfc0('0x11')],'path':_0xfcd4ef['path'],'headers':{'user-agent':_0xbfc0('0x12')}};_0x285c7f[_0xbfc0('0x13')](_0x9296f4,function(_0x1372e1){if(_0x1372e1['statusCode']!==0xc8){_0x14bb5e(new Error('request\x20to\x20'+_0x358598+'\x20failed,\x20status\x20code\x20=\x20'+_0x1372e1[_0xbfc0('0x18')]+'\x20('+_0x1372e1[_0xbfc0('0x17')]+')'));return;}var _0x2d0ee8='';_0x1372e1['on'](_0xbfc0('0x1d'),function(_0x3b4344){_0x2d0ee8+=_0x3b4344;});_0x1372e1['on'](_0xbfc0('0x1e'),function(){_0x4db783(_0x2d0ee8);});})['on']('error',function(_0x1582b7){_0x14bb5e(_0x1582b7);})['end']();});}function convertFile(_0x3ae86c,_0xd7676a){return new BPromise(function(_0x4908b8,_0x12b883){var _0x3227f8=sox[_0xbfc0('0x1f')](_0x3ae86c,_0xd7676a,{'sampleRate':0x1f40,'format':_0xbfc0('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3227f8['on'](_0xbfc0('0x14'),function(_0x82fd34){logger['error'](_0xbfc0('0x21'),_0x82fd34);_0x12b883(_0x82fd34);});_0x3227f8['on'](_0xbfc0('0x1e'),function(){logger[_0xbfc0('0x1a')]('finish\x20to\x20convert');_0x4908b8();});_0x3227f8[_0xbfc0('0x22')]();});}function base64Decode(_0x5d15d4,_0x6d2b98){var _0x46406e=path[_0xbfc0('0x23')](__dirname,'tmp',rs[_0xbfc0('0x24')](0x4)+_0xbfc0('0x25'));fs[_0xbfc0('0x26')](_0x46406e,_0x5d15d4,_0xbfc0('0x27'));return convertFile(_0x46406e,_0x6d2b98)[_0xbfc0('0x28')](function(){try{fs[_0xbfc0('0x29')](_0x46406e);fs[_0xbfc0('0x2a')](_0x6d2b98,_0xbfc0('0x2b'));}catch(_0x64c02e){logger[_0xbfc0('0x14')](_0x64c02e);}return _0x6d2b98['split']('.')[0x0];});}function base64Encode(_0x23e9d3){var _0x30b40d=fs[_0xbfc0('0x2c')](_0x23e9d3);return new Buffer(_0x30b40d)[_0xbfc0('0x2d')](_0xbfc0('0x27'));}exports[_0xbfc0('0x2e')]=function(_0x1cf3e1,_0xaf98e4,_0x5a72ed,_0x2b669e,_0x205d36,_0xfa7343){var _0x27909b,_0x58f891;var _0x5a734d='https://texttospeech.googleapis.com/v1/';var _0x418c28=_0xbfc0('0x2f')+_0x1cf3e1;var _0x15154a={};if(_0xaf98e4===_0xbfc0('0x30')){_0x15154a[_0xbfc0('0x31')]={'ssml':_0x5a72ed};}else{_0x15154a[_0xbfc0('0x31')]={'text':_0x5a72ed};};_0x15154a['voice']={'languageCode':_0x2b669e,'ssmlGender':_0x205d36};_0x15154a[_0xbfc0('0x32')]={'audioEncoding':_0xbfc0('0x33'),'sampleRateHertz':0x1f40};var _0x5b1363={'url':_0x5a734d+'text:synthesize'+_0x418c28,'method':_0xbfc0('0x34'),'json':!![],'body':_0x15154a};return rp(_0x5b1363)[_0xbfc0('0x28')](function(_0xd40ac1){return new BPromise(function(_0xcf5973,_0x3f2dcb){_0x27909b=path['resolve'](__dirname,'tmp',rs[_0xbfc0('0x24')](0x4)+_0xbfc0('0x35'));var _0x3563d9=Buffer[_0xbfc0('0x36')](_0xd40ac1[_0xbfc0('0x37')],_0xbfc0('0x27'));return fs[_0xbfc0('0x38')](_0x27909b,_0x3563d9,function(_0x364721){_0x3f2dcb(_0x364721);},function(_0x23477b){fs[_0xbfc0('0x2a')](_0x27909b,_0xbfc0('0x2b'));_0xcf5973(_0x23477b);});});})['then'](function(_0x5a9b6b){_0x58f891=path[_0xbfc0('0x23')](__dirname,_0xbfc0('0x39'),rs['generate'](0x4)+_0xbfc0('0x25'));return convertFile(_0x27909b,_0x58f891);})[_0xbfc0('0x28')](function(){try{fs[_0xbfc0('0x29')](_0x27909b);fs[_0xbfc0('0x2a')](_0x58f891,_0xbfc0('0x2b'));}catch(_0x4a2c6b){logger['error'](_0x4a2c6b);}logger[_0xbfc0('0x1a')](_0xbfc0('0x3a'),_0x58f891[_0xbfc0('0x3b')]('.')[0x0]);return _0x58f891[_0xbfc0('0x3b')]('.')[0x0];});};exports[_0xbfc0('0x3c')]=function(_0x57f5f4,_0x218840){var _0x1d7e61=_0xbfc0('0x3d');var _0x3c4794,_0x126316;var _0x3f79a6;var _0x449444={'encoding':_0xbfc0('0x3e'),'method':_0xbfc0('0x34'),'timeout':0x2710,'url':_0x1d7e61,'headers':{'Content-Type':_0xbfc0('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0xbfc0('0x40')]([[[_0xbfc0('0x41'),JSON[_0xbfc0('0x40')]([_0x57f5f4,_0x218840||'en',![],'null']),null,_0xbfc0('0x42')]]]))};return rp(_0x449444)[_0xbfc0('0x28')](function(_0x2f3464){try{_0x3f79a6=eval(_0x2f3464[_0xbfc0('0x43')](0x5))[0x0][0x2];}catch(_0x3b83e3){throw new Error(_0xbfc0('0x44')+_0x2f3464['data']);}if(!_0x3f79a6){if(_0x57f5f4['length']>0xc8){throw new Error(_0xbfc0('0x45'));}else{throw new Error('lang\x20\x22'+_0x218840+_0xbfc0('0x46'));}}try{_0x3f79a6=eval(_0x3f79a6)[0x0];}catch(_0x3439fe){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xbfc0('0x1d')]);}const _0x1aca89=_0x3f79a6;_0x3c4794=path[_0xbfc0('0x23')](__dirname,_0xbfc0('0x39'),rs[_0xbfc0('0x24')](0x4)+_0xbfc0('0x35'));fs[_0xbfc0('0x26')](_0x3c4794,_0x3f79a6,{'encoding':_0xbfc0('0x27')});_0x126316=path[_0xbfc0('0x23')](__dirname,_0xbfc0('0x39'),rs[_0xbfc0('0x24')](0x4)+_0xbfc0('0x25'));return convertFile(_0x3c4794,_0x126316);})[_0xbfc0('0x28')](function(){try{fs[_0xbfc0('0x29')](_0x3c4794);fs[_0xbfc0('0x2a')](_0x126316,_0xbfc0('0x2b'));}catch(_0x1a41ce){logger[_0xbfc0('0x14')](_0x1a41ce);}logger[_0xbfc0('0x1a')](_0xbfc0('0x47'),_0x126316[_0xbfc0('0x3b')]('.')[0x0]);return _0x126316[_0xbfc0('0x3b')]('.')[0x0];});};exports['googleASR']=function(_0x42e2e9,_0x2ed9b6,_0x3a8961){return google[_0xbfc0('0x48')](_0x42e2e9,_0x2ed9b6,_0x3a8961)[_0xbfc0('0x28')](function(_0xd900a9){logger[_0xbfc0('0x1a')](_0xd900a9[_0xbfc0('0x49')]);return rp(_0xd900a9);})[_0xbfc0('0x28')](function(_0x14678d){var _0x323d5='';var _0x20cfe8=0x0;try{fs[_0xbfc0('0x29')](_0x42e2e9);}catch(_0x3f1f8f){logger['error'](_0x3f1f8f);}if(_0x14678d&&_0x14678d[_0xbfc0('0x4a')]){_0x323d5=_0x14678d[_0xbfc0('0x4a')][_0xbfc0('0x4b')](function(_0x318d94){return _0x318d94&&_0x318d94[_0xbfc0('0x4c')][0x0]&&_0x318d94[_0xbfc0('0x4c')][0x0][_0xbfc0('0x4d')]?_0x318d94['alternatives'][0x0][_0xbfc0('0x4d')]:'';})['join']('\x0a');_0x20cfe8=_0x14678d[_0xbfc0('0x4a')][_0xbfc0('0x4b')](function(_0x618c7f){return _0x618c7f&&_0x618c7f['alternatives'][0x0]&&_0x618c7f[_0xbfc0('0x4c')][0x0][_0xbfc0('0x4e')]?_0x618c7f[_0xbfc0('0x4c')][0x0][_0xbfc0('0x4e')]:0x0;})[_0xbfc0('0x4f')]('\x0a');}logger[_0xbfc0('0x1a')](_0xbfc0('0x50'),_0x323d5);logger[_0xbfc0('0x1a')](_0xbfc0('0x51'),_0x20cfe8);return{'transcript':_0x323d5,'confidence':_0x20cfe8};})[_0xbfc0('0x52')](function(_0x3749e8){logger[_0xbfc0('0x14')](_0xbfc0('0x53'),_0x3749e8['statusCode'],_0x3749e8[_0xbfc0('0x54')],_0x3749e8[_0xbfc0('0x55')]);});};exports[_0xbfc0('0x56')]=function(_0x21388c,_0x2b9dac,_0x360841,_0x2d18ff){var _0x459865=apiai(_0x2b9dac,{'language':_0x2d18ff||'en'});return _0x459865['textRequest'](_0x360841,{'sessionId':md5(_0x21388c)})['then'](function(_0x3e2af7){logger[_0xbfc0('0x1a')](JSON[_0xbfc0('0x40')](_0x3e2af7));return{'source':_0x3e2af7[_0xbfc0('0x57')][_0xbfc0('0x58')],'resolvedQuery':_0x3e2af7['result'][_0xbfc0('0x59')],'action':_0x3e2af7[_0xbfc0('0x57')][_0xbfc0('0x5a')],'actionIncomplete':_0x3e2af7[_0xbfc0('0x57')]['actionIncomplete'],'speech':_0x3e2af7[_0xbfc0('0x57')]['fulfillment'][_0xbfc0('0x5b')],'score':_0x3e2af7[_0xbfc0('0x57')]['score'],'statusCode':_0x3e2af7[_0xbfc0('0x5c')][_0xbfc0('0x5d')],'endConversation':_0x3e2af7[_0xbfc0('0x57')][_0xbfc0('0x5e')]['endConversation']||![],'isFallbackIntent':_0x3e2af7[_0xbfc0('0x57')]['metadata'][_0xbfc0('0x5f')]};});};exports['googleDialogflowV2']=function(_0x368474,_0x4dff51,_0x5f53c8,_0x4188b7,_0x4599f5,_0x358e3a){var _0x3e618c=_0x4188b7['replace'](/\\n/g,'\x0a');var _0x3ed6a9={'credentials':{'private_key':_0x3e618c,'client_email':_0x5f53c8}};var _0x3d53f4=new dialogflow[(_0xbfc0('0x60'))](_0x3ed6a9);var _0x301610=_0x3d53f4['sessionPath'](_0x4dff51,md5(_0x368474));var _0xcab648={'session':_0x301610,'queryInput':{'text':{'text':_0x4599f5,'languageCode':_0x358e3a}}};return _0x3d53f4['detectIntent'](_0xcab648)['then'](function(_0x1ce230){if(_0x1ce230&&_0x1ce230[_0xbfc0('0x61')]){logger[_0xbfc0('0x1a')](_0xbfc0('0x62'),JSON['stringify'](_0x1ce230));var _0x1961ff=_0x1ce230[0x0];if(_0x1961ff){var _0x799474={'action':_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x5a')],'allRequiredParamsPresent':_0x1961ff['queryResult'][_0xbfc0('0x64')],'endConversation':_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x65')]&&_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x65')]['fields']?_0x1961ff['queryResult'][_0xbfc0('0x65')][_0xbfc0('0x66')][_0xbfc0('0x67')][_0xbfc0('0x68')]:![],'fulfillmentText':_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x69')],'intentName':_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x6a')][_0xbfc0('0x54')],'intentDisplayName':_0x1961ff[_0xbfc0('0x63')]['intent'][_0xbfc0('0x6b')],'isFallbackIntent':_0x1961ff[_0xbfc0('0x63')]['intent'][_0xbfc0('0x6c')],'languageCode':_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x6d')],'queryText':_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x6e')],'responseId':_0x1961ff[_0xbfc0('0x6f')],'score':_0x1961ff[_0xbfc0('0x63')][_0xbfc0('0x70')],'speech':_0x1961ff['queryResult'][_0xbfc0('0x69')],'providerResponse':JSON[_0xbfc0('0x40')](_0x1ce230)};return _0x799474;}}});};exports[_0xbfc0('0x71')]=function(_0x436d5a,_0x5e1de4,_0x2a1d1e,_0x31cf07){return tilde[_0xbfc0('0x48')](_0x436d5a,_0x5e1de4,_0x2a1d1e,_0x31cf07)['then'](function(_0x541bb7){try{fs[_0xbfc0('0x29')](_0x436d5a);}catch(_0x1decdd){logger[_0xbfc0('0x14')](_0x1decdd);}logger[_0xbfc0('0x1a')](_0xbfc0('0x72'),_0x541bb7['transcript']);logger[_0xbfc0('0x1a')]('Tilde\x20ASR\x20confidence',_0x541bb7[_0xbfc0('0x4e')]);return _0x541bb7;});};exports['awsPolly']=function(_0x4aa66d,_0x4ef640,_0xc6c0ee,_0xe9a2b4,_0x582357,_0x378d2b){var _0x3fa061=path[_0xbfc0('0x23')](__dirname,_0xbfc0('0x39'),rs['generate'](0x4)+_0xbfc0('0x35'));var _0x1702f2;return aws[_0xbfc0('0x73')](_0x4aa66d,_0x4ef640,_0xc6c0ee,_0xe9a2b4,_0x582357,_0x378d2b,_0x3fa061)['then'](function(){_0x1702f2=path[_0xbfc0('0x23')](__dirname,'tmp',rs[_0xbfc0('0x24')](0x4)+_0xbfc0('0x25'));return convertFile(_0x3fa061,_0x1702f2);})[_0xbfc0('0x28')](function(){try{fs['unlink'](_0x3fa061);fs[_0xbfc0('0x2a')](_0x1702f2,_0xbfc0('0x2b'));}catch(_0x40780b){logger[_0xbfc0('0x14')](_0x40780b);}return _0x1702f2[_0xbfc0('0x3b')]('.')[0x0];});};exports[_0xbfc0('0x74')]=function(_0x458d1b,_0x584e65,_0x1a8025,_0x2e630c,_0xfacda7,_0x44e069){return aws[_0xbfc0('0x75')](_0x458d1b,_0x584e65,_0x1a8025,_0x2e630c,_0xfacda7,_0x44e069)['then'](function(_0x36ce61){logger[_0xbfc0('0x1a')](JSON[_0xbfc0('0x40')](_0x36ce61));return _0x36ce61;});};exports[_0xbfc0('0x76')]=function(_0x198a2f,_0x5c4000,_0xf90974,_0xc1dd99){var _0x4f40ac=util[_0xbfc0('0x77')](_0xbfc0('0x78'),ISPEECH_API,_0x198a2f,encodeURIComponent(_0x5c4000),_0xf90974,_0xc1dd99);var _0x35663c=path[_0xbfc0('0x23')](__dirname,_0xbfc0('0x39'),rs['generate'](0x4)+_0xbfc0('0x35'));var _0x15c693;return downloadFile(_0x4f40ac,_0x35663c)[_0xbfc0('0x28')](function(){_0x15c693=path[_0xbfc0('0x23')](__dirname,'tmp',rs[_0xbfc0('0x24')](0x4)+'.wav');return convertFile(_0x35663c,_0x15c693);})[_0xbfc0('0x28')](function(){try{fs['unlink'](_0x35663c);fs['chmodSync'](_0x15c693,_0xbfc0('0x2b'));}catch(_0x93b912){logger['error'](_0x93b912);}return _0x15c693['split']('.')[0x0];});};exports[_0xbfc0('0x79')]=function(_0x57066d,_0xc1dcc1,_0x257d57,_0x56f5a2){var _0x1fc90c=util['format'](_0xbfc0('0x7a'),ISPEECH_API,_0xc1dcc1,_0x257d57,base64Encode(_0x57066d),_0x56f5a2?util[_0xbfc0('0x77')](_0xbfc0('0x7b'),encodeURIComponent(_0x56f5a2)):_0xbfc0('0x7c'));return uploadFile(_0x1fc90c)[_0xbfc0('0x28')](function(_0xcd4607){return querystring[_0xbfc0('0x7')](_0xcd4607);});};exports[_0xbfc0('0x7d')]=function(_0x2918af,_0x4a0d63){return sestek[_0xbfc0('0x7e')](_0x2918af,_0x4a0d63)[_0xbfc0('0x28')](function(_0x100aa8){logger[_0xbfc0('0x1a')](JSON[_0xbfc0('0x40')](_0x100aa8));var _0x3d414={'speech':_0x100aa8['text'],'action':_0x100aa8[_0xbfc0('0x7f')]?_0x100aa8[_0xbfc0('0x7f')]['CustomAction']:undefined,'actiondata':_0x100aa8[_0xbfc0('0x7f')]?_0x100aa8[_0xbfc0('0x7f')]['CustomActionData']:undefined};if(_0x100aa8[_0xbfc0('0x7f')]&&_0x100aa8[_0xbfc0('0x7f')][_0xbfc0('0x80')]){return base64Decode(_0x100aa8[_0xbfc0('0x7f')]['AudioFromTts'][_0xbfc0('0x81')],path['resolve'](__dirname,_0xbfc0('0x39'),rs[_0xbfc0('0x24')](0x4)+_0xbfc0('0x25')))[_0xbfc0('0x28')](function(_0x4c9a15){_0x3d414[_0xbfc0('0x82')]=_0x4c9a15;return _0x3d414;});}return _0x3d414;});};exports[_0xbfc0('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0x9091=['textRequest','source','resolvedQuery','result','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','Dialogflow\x20V2\x20response:','action','queryResult','diagnosticInfo','end_conversation','fulfillmentText','intent','displayName','languageCode','queryText','responseId','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','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','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./google','./tilde','../../../config/logger','agi','https:','host','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','transcode','wav','finish\x20to\x20convert','resolve','tmp','generate','writeFileSync','base64','then','777','readFileSync','toString','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','POST','.mp3','from','audioContent','writeFile','.wav','unlink','chmodSync','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','data','googleASR','asr','uri','results','alternatives','transcript','join','map','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow'];(function(_0x7c3c27,_0x16c034){var _0x4a2c4b=function(_0x293b82){while(--_0x293b82){_0x7c3c27['push'](_0x7c3c27['shift']());}};_0x4a2c4b(++_0x16c034);}(_0x9091,0x144));var _0x1909=function(_0x4957c4,_0x362153){_0x4957c4=_0x4957c4-0x0;var _0x40b55e=_0x9091[_0x4957c4];return _0x40b55e;};'use strict';var apiai=require(_0x1909('0x0'));var BPromise=require(_0x1909('0x1'));var dialogflow=require(_0x1909('0x2'));var fs=require('fs');var http=require(_0x1909('0x3'));var https=require(_0x1909('0x4'));var md5=require(_0x1909('0x5'));var path=require(_0x1909('0x6'));var querystring=require(_0x1909('0x7'));var rp=require(_0x1909('0x8'));var rs=require(_0x1909('0x9'));var sox=require(_0x1909('0xa'));var tts=require(_0x1909('0xb'));var urlParse=require(_0x1909('0xc'))['parse'];var util=require(_0x1909('0xd'));var aws=require('./aws');var google=require(_0x1909('0xe'));var sestek=require('./sestek');var tilde=require(_0x1909('0xf'));var logger=require(_0x1909('0x10'))(_0x1909('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1fb42b,_0x4afc23){return new BPromise(function(_0x39a543,_0x16262c){var _0x4ff0c3=urlParse(_0x1fb42b);var _0x3854a1=_0x4ff0c3['protocol']===_0x1909('0x12')?https:http;var _0x2e772b={'host':_0x4ff0c3[_0x1909('0x13')],'path':_0x4ff0c3[_0x1909('0x6')],'headers':{'user-agent':_0x1909('0x14')}};_0x3854a1[_0x1909('0x15')](_0x2e772b,function(_0x1ed029){if(_0x1ed029['statusCode']!==0xc8){logger[_0x1909('0x16')](_0x1909('0x17')+_0x1fb42b+'\x20failed,\x20status\x20code\x20=\x20'+_0x1ed029[_0x1909('0x18')]+'\x20('+_0x1ed029[_0x1909('0x19')]+')');_0x16262c(new Error(_0x1909('0x17')+_0x1fb42b+'\x20failed,\x20status\x20code\x20=\x20'+_0x1ed029[_0x1909('0x18')]+'\x20('+_0x1ed029[_0x1909('0x19')]+')'));return;}var _0x2e1c55=fs[_0x1909('0x1a')](_0x4afc23);_0x2e1c55['on'](_0x1909('0x1b'),function(){logger[_0x1909('0x1c')](_0x1909('0x1d'));_0x2e1c55[_0x1909('0x1e')](_0x39a543);});_0x2e1c55['on'](_0x1909('0x16'),function(_0x5f3f16){fs['unlink'](_0x4afc23);logger[_0x1909('0x16')](_0x1909('0x1f'),_0x5f3f16);_0x16262c(_0x5f3f16);});_0x1ed029[_0x1909('0x20')](_0x2e1c55);})['on'](_0x1909('0x16'),function(_0x193205){logger[_0x1909('0x16')](_0x193205);_0x16262c(_0x193205);})[_0x1909('0x21')]();});}function uploadFile(_0x2aa683){return new BPromise(function(_0x1140c8,_0x429fab){var _0x13f6ed=urlParse(_0x2aa683);var _0x38d571=_0x13f6ed['protocol']===_0x1909('0x12')?https:http;var _0x4fd357={'host':_0x13f6ed[_0x1909('0x13')],'path':_0x13f6ed[_0x1909('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0x38d571[_0x1909('0x15')](_0x4fd357,function(_0x277068){if(_0x277068[_0x1909('0x18')]!==0xc8){_0x429fab(new Error(_0x1909('0x17')+_0x2aa683+'\x20failed,\x20status\x20code\x20=\x20'+_0x277068[_0x1909('0x18')]+'\x20('+_0x277068['statusMessage']+')'));return;}var _0x3a9497='';_0x277068['on']('data',function(_0x4b34d6){_0x3a9497+=_0x4b34d6;});_0x277068['on'](_0x1909('0x21'),function(){_0x1140c8(_0x3a9497);});})['on'](_0x1909('0x16'),function(_0x422f8b){_0x429fab(_0x422f8b);})['end']();});}function convertFile(_0x59e05e,_0x5a698d){return new BPromise(function(_0x3b2580,_0x450de7){var _0x579a56=sox[_0x1909('0x22')](_0x59e05e,_0x5a698d,{'sampleRate':0x1f40,'format':_0x1909('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x579a56['on'](_0x1909('0x16'),function(_0x348e57){logger[_0x1909('0x16')]('error\x20convert',_0x348e57);_0x450de7(_0x348e57);});_0x579a56['on'](_0x1909('0x21'),function(){logger[_0x1909('0x1c')](_0x1909('0x24'));_0x3b2580();});_0x579a56['start']();});}function base64Decode(_0x5757e5,_0x120382){var _0x5ee01d=path[_0x1909('0x25')](__dirname,_0x1909('0x26'),rs[_0x1909('0x27')](0x4)+'.wav');fs[_0x1909('0x28')](_0x5ee01d,_0x5757e5,_0x1909('0x29'));return convertFile(_0x5ee01d,_0x120382)[_0x1909('0x2a')](function(){try{fs['unlink'](_0x5ee01d);fs['chmodSync'](_0x120382,_0x1909('0x2b'));}catch(_0x26b193){logger[_0x1909('0x16')](_0x26b193);}return _0x120382['split']('.')[0x0];});}function base64Encode(_0x45f605){var _0x4efacd=fs[_0x1909('0x2c')](_0x45f605);return new Buffer(_0x4efacd)[_0x1909('0x2d')](_0x1909('0x29'));}exports['googleCloudTTS']=function(_0x5ad6d8,_0x5223cd,_0x2bdf45,_0x392215,_0x1c4968,_0x120f07){var _0x624960,_0x351224;var _0x450c96=_0x1909('0x2e');var _0x52e1a0='?key='+_0x5ad6d8;var _0x54060c={};if(_0x5223cd===_0x1909('0x2f')){_0x54060c[_0x1909('0x30')]={'ssml':_0x2bdf45};}else{_0x54060c[_0x1909('0x30')]={'text':_0x2bdf45};};_0x54060c[_0x1909('0x31')]={'languageCode':_0x392215,'ssmlGender':_0x1c4968};_0x54060c[_0x1909('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x57cc56={'url':_0x450c96+'text:synthesize'+_0x52e1a0,'method':_0x1909('0x33'),'json':!![],'body':_0x54060c};return rp(_0x57cc56)[_0x1909('0x2a')](function(_0x3955c5){return new BPromise(function(_0xcabb5,_0x148fa3){_0x624960=path[_0x1909('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x1909('0x34'));var _0x224fe6=Buffer[_0x1909('0x35')](_0x3955c5[_0x1909('0x36')],'base64');return fs[_0x1909('0x37')](_0x624960,_0x224fe6,function(_0x4b88b4){_0x148fa3(_0x4b88b4);},function(_0x4950b8){fs['chmodSync'](_0x624960,'777');_0xcabb5(_0x4950b8);});});})['then'](function(_0x317b48){_0x351224=path[_0x1909('0x25')](__dirname,_0x1909('0x26'),rs['generate'](0x4)+_0x1909('0x38'));return convertFile(_0x624960,_0x351224);})[_0x1909('0x2a')](function(){try{fs[_0x1909('0x39')](_0x624960);fs[_0x1909('0x3a')](_0x351224,_0x1909('0x2b'));}catch(_0x522b39){logger['error'](_0x522b39);}logger[_0x1909('0x1c')](_0x1909('0x3b'),_0x351224[_0x1909('0x3c')]('.')[0x0]);return _0x351224[_0x1909('0x3c')]('.')[0x0];});};exports[_0x1909('0x3d')]=function(_0x1b7abe,_0x3e7b42){var _0x226086=_0x1909('0x3e');var _0x3923b3,_0x3edbf;var _0x5a73e7;var _0x54d07a={'encoding':_0x1909('0x3f'),'method':'POST','timeout':0x2710,'url':_0x226086,'headers':{'Content-Type':_0x1909('0x40')},'body':_0x1909('0x41')+encodeURIComponent(JSON[_0x1909('0x42')]([[['jQ1olc',JSON['stringify']([_0x1b7abe,_0x3e7b42||'en',![],'null']),null,_0x1909('0x43')]]]))};return rp(_0x54d07a)[_0x1909('0x2a')](function(_0x494bff){try{_0x5a73e7=eval(_0x494bff[_0x1909('0x44')](0x5))[0x0][0x2];}catch(_0xd817ee){throw new Error(_0x1909('0x45')+_0x494bff['data']);}if(!_0x5a73e7){if(_0x1b7abe[_0x1909('0x46')]>0xc8){throw new Error(_0x1909('0x47'));}else{throw new Error('lang\x20\x22'+_0x3e7b42+_0x1909('0x48'));}}try{_0x5a73e7=eval(_0x5a73e7)[0x0];}catch(_0x10e724){throw new Error(_0x1909('0x45')+res[_0x1909('0x49')]);}const _0x7cf425=_0x5a73e7;_0x3923b3=path['resolve'](__dirname,_0x1909('0x26'),rs[_0x1909('0x27')](0x4)+_0x1909('0x34'));fs['writeFileSync'](_0x3923b3,_0x5a73e7,{'encoding':_0x1909('0x29')});_0x3edbf=path[_0x1909('0x25')](__dirname,_0x1909('0x26'),rs[_0x1909('0x27')](0x4)+_0x1909('0x38'));return convertFile(_0x3923b3,_0x3edbf);})[_0x1909('0x2a')](function(){try{fs[_0x1909('0x39')](_0x3923b3);fs[_0x1909('0x3a')](_0x3edbf,_0x1909('0x2b'));}catch(_0x725c2c){logger[_0x1909('0x16')](_0x725c2c);}logger['info']('goggleTTS\x20path',_0x3edbf['split']('.')[0x0]);return _0x3edbf[_0x1909('0x3c')]('.')[0x0];});};exports[_0x1909('0x4a')]=function(_0x19be96,_0x285240,_0x31836f){return google[_0x1909('0x4b')](_0x19be96,_0x285240,_0x31836f)[_0x1909('0x2a')](function(_0x697e98){logger['info'](_0x697e98[_0x1909('0x4c')]);return rp(_0x697e98);})[_0x1909('0x2a')](function(_0x1e7f9f){var _0x1fdda1='';var _0x92430f=0x0;try{fs[_0x1909('0x39')](_0x19be96);}catch(_0xc65707){logger[_0x1909('0x16')](_0xc65707);}if(_0x1e7f9f&&_0x1e7f9f[_0x1909('0x4d')]){_0x1fdda1=_0x1e7f9f[_0x1909('0x4d')]['map'](function(_0x2c397b){return _0x2c397b&&_0x2c397b[_0x1909('0x4e')][0x0]&&_0x2c397b[_0x1909('0x4e')][0x0][_0x1909('0x4f')]?_0x2c397b['alternatives'][0x0]['transcript']:'';})[_0x1909('0x50')]('\x0a');_0x92430f=_0x1e7f9f[_0x1909('0x4d')][_0x1909('0x51')](function(_0x1cf35d){return _0x1cf35d&&_0x1cf35d['alternatives'][0x0]&&_0x1cf35d[_0x1909('0x4e')][0x0]['confidence']?_0x1cf35d['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x1909('0x1c')](_0x1909('0x52'),_0x1fdda1);logger['info']('googleASR\x20confidence',_0x92430f);return{'transcript':_0x1fdda1,'confidence':_0x92430f};})['catch'](function(_0x10ead0){logger[_0x1909('0x16')](_0x1909('0x53'),_0x10ead0[_0x1909('0x18')],_0x10ead0[_0x1909('0x54')],_0x10ead0[_0x1909('0x55')]);});};exports[_0x1909('0x56')]=function(_0x3bcb68,_0x5a8748,_0x1130db,_0x404dae){var _0x1f3eb4=apiai(_0x5a8748,{'language':_0x404dae||'en'});return _0x1f3eb4[_0x1909('0x57')](_0x1130db,{'sessionId':md5(_0x3bcb68)})['then'](function(_0x2e9aa3){logger[_0x1909('0x1c')](JSON[_0x1909('0x42')](_0x2e9aa3));return{'source':_0x2e9aa3['result'][_0x1909('0x58')],'resolvedQuery':_0x2e9aa3['result'][_0x1909('0x59')],'action':_0x2e9aa3[_0x1909('0x5a')]['action'],'actionIncomplete':_0x2e9aa3[_0x1909('0x5a')][_0x1909('0x5b')],'speech':_0x2e9aa3[_0x1909('0x5a')][_0x1909('0x5c')][_0x1909('0x5d')],'score':_0x2e9aa3[_0x1909('0x5a')][_0x1909('0x5e')],'statusCode':_0x2e9aa3[_0x1909('0x5f')][_0x1909('0x60')],'endConversation':_0x2e9aa3[_0x1909('0x5a')][_0x1909('0x61')][_0x1909('0x62')]||![],'isFallbackIntent':_0x2e9aa3['result'][_0x1909('0x61')][_0x1909('0x63')]};});};exports[_0x1909('0x64')]=function(_0x70a017,_0x34fc81,_0x1c96c5,_0x46d203,_0x50ea9c,_0x34a5fb){var _0x31bc60=_0x46d203[_0x1909('0x65')](/\\n/g,'\x0a');var _0x51fbe3={'credentials':{'private_key':_0x31bc60,'client_email':_0x1c96c5}};var _0x2a0764=new dialogflow['SessionsClient'](_0x51fbe3);var _0x488e2a=_0x2a0764[_0x1909('0x66')](_0x34fc81,md5(_0x70a017));var _0x1b5931={'session':_0x488e2a,'queryInput':{'text':{'text':_0x50ea9c,'languageCode':_0x34a5fb}}};return _0x2a0764['detectIntent'](_0x1b5931)[_0x1909('0x2a')](function(_0x26666b){if(_0x26666b&&_0x26666b[_0x1909('0x46')]){logger['info'](_0x1909('0x67'),JSON[_0x1909('0x42')](_0x26666b));var _0x51b133=_0x26666b[0x0];if(_0x51b133){var _0x534e42={'action':_0x51b133['queryResult'][_0x1909('0x68')],'allRequiredParamsPresent':_0x51b133['queryResult']['allRequiredParamsPresent'],'endConversation':_0x51b133[_0x1909('0x69')]['diagnosticInfo']&&_0x51b133[_0x1909('0x69')][_0x1909('0x6a')]['fields']?_0x51b133[_0x1909('0x69')][_0x1909('0x6a')]['fields'][_0x1909('0x6b')]['boolValue']:![],'fulfillmentText':_0x51b133['queryResult'][_0x1909('0x6c')],'intentName':_0x51b133['queryResult'][_0x1909('0x6d')][_0x1909('0x54')],'intentDisplayName':_0x51b133['queryResult'][_0x1909('0x6d')][_0x1909('0x6e')],'isFallbackIntent':_0x51b133[_0x1909('0x69')][_0x1909('0x6d')]['isFallback'],'languageCode':_0x51b133['queryResult'][_0x1909('0x6f')],'queryText':_0x51b133[_0x1909('0x69')][_0x1909('0x70')],'responseId':_0x51b133[_0x1909('0x71')],'score':_0x51b133['queryResult']['intentDetectionConfidence'],'speech':_0x51b133['queryResult']['fulfillmentText'],'providerResponse':JSON['stringify'](_0x26666b)};return _0x534e42;}}});};exports['tildeASR']=function(_0x5aa8e4,_0x36a8db,_0x3fb8d6,_0x61e6f0){return tilde[_0x1909('0x4b')](_0x5aa8e4,_0x36a8db,_0x3fb8d6,_0x61e6f0)[_0x1909('0x2a')](function(_0x40fb1){try{fs[_0x1909('0x39')](_0x5aa8e4);}catch(_0x715149){logger[_0x1909('0x16')](_0x715149);}logger[_0x1909('0x1c')]('Tilde\x20ASR\x20transcription',_0x40fb1[_0x1909('0x4f')]);logger[_0x1909('0x1c')](_0x1909('0x72'),_0x40fb1[_0x1909('0x73')]);return _0x40fb1;});};exports[_0x1909('0x74')]=function(_0x48415e,_0x2359bb,_0x33b5c5,_0x167e0b,_0x13843a,_0x568f95){var _0x44a1ab=path[_0x1909('0x25')](__dirname,_0x1909('0x26'),rs[_0x1909('0x27')](0x4)+_0x1909('0x34'));var _0x5ae182;return aws[_0x1909('0x75')](_0x48415e,_0x2359bb,_0x33b5c5,_0x167e0b,_0x13843a,_0x568f95,_0x44a1ab)[_0x1909('0x2a')](function(){_0x5ae182=path[_0x1909('0x25')](__dirname,_0x1909('0x26'),rs[_0x1909('0x27')](0x4)+_0x1909('0x38'));return convertFile(_0x44a1ab,_0x5ae182);})[_0x1909('0x2a')](function(){try{fs[_0x1909('0x39')](_0x44a1ab);fs[_0x1909('0x3a')](_0x5ae182,_0x1909('0x2b'));}catch(_0x376efa){logger[_0x1909('0x16')](_0x376efa);}return _0x5ae182[_0x1909('0x3c')]('.')[0x0];});};exports[_0x1909('0x76')]=function(_0x228ff9,_0x5ce06a,_0x13e4d9,_0x5abf04,_0x1c78cb,_0x1a2ba6){return aws[_0x1909('0x77')](_0x228ff9,_0x5ce06a,_0x13e4d9,_0x5abf04,_0x1c78cb,_0x1a2ba6)[_0x1909('0x2a')](function(_0x166a85){logger[_0x1909('0x1c')](JSON['stringify'](_0x166a85));return _0x166a85;});};exports[_0x1909('0x78')]=function(_0x1c61be,_0x8dcd22,_0x587a74,_0x3905b9){var _0x589911=util[_0x1909('0x79')](_0x1909('0x7a'),ISPEECH_API,_0x1c61be,encodeURIComponent(_0x8dcd22),_0x587a74,_0x3905b9);var _0x25cccf=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x1909('0x34'));var _0x1affc1;return downloadFile(_0x589911,_0x25cccf)[_0x1909('0x2a')](function(){_0x1affc1=path[_0x1909('0x25')](__dirname,_0x1909('0x26'),rs[_0x1909('0x27')](0x4)+_0x1909('0x38'));return convertFile(_0x25cccf,_0x1affc1);})[_0x1909('0x2a')](function(){try{fs[_0x1909('0x39')](_0x25cccf);fs[_0x1909('0x3a')](_0x1affc1,_0x1909('0x2b'));}catch(_0x3358b5){logger[_0x1909('0x16')](_0x3358b5);}return _0x1affc1[_0x1909('0x3c')]('.')[0x0];});};exports[_0x1909('0x7b')]=function(_0x40a90d,_0x5e1e02,_0x4030,_0xfb2294){var _0x5d88e9=util[_0x1909('0x79')](_0x1909('0x7c'),ISPEECH_API,_0x5e1e02,_0x4030,base64Encode(_0x40a90d),_0xfb2294?util[_0x1909('0x79')]('model=%s',encodeURIComponent(_0xfb2294)):_0x1909('0x7d'));return uploadFile(_0x5d88e9)[_0x1909('0x2a')](function(_0x3c1217){return querystring[_0x1909('0x7e')](_0x3c1217);});};exports[_0x1909('0x7f')]=function(_0x515a8a,_0x4addb1){return sestek[_0x1909('0x80')](_0x515a8a,_0x4addb1)[_0x1909('0x2a')](function(_0x27e7da){logger['info'](JSON[_0x1909('0x42')](_0x27e7da));var _0x3d962e={'speech':_0x27e7da[_0x1909('0x81')],'action':_0x27e7da[_0x1909('0x82')]?_0x27e7da[_0x1909('0x82')][_0x1909('0x83')]:undefined,'actiondata':_0x27e7da[_0x1909('0x82')]?_0x27e7da[_0x1909('0x82')][_0x1909('0x84')]:undefined};if(_0x27e7da['channelData']&&_0x27e7da[_0x1909('0x82')][_0x1909('0x85')]){return base64Decode(_0x27e7da[_0x1909('0x82')]['AudioFromTts'][_0x1909('0x86')],path['resolve'](__dirname,_0x1909('0x26'),rs['generate'](0x4)+_0x1909('0x38')))['then'](function(_0x3f285c){_0x3d962e[_0x1909('0x87')]=_0x3f285c;return _0x3d962e;});}return _0x3d962e;});};exports[_0x1909('0x88')]=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 7b26be9..a095a93 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 _0x4e3b=['./nda'];(function(_0xea9bac,_0x1ba775){var _0x434187=function(_0x569388){while(--_0x569388){_0xea9bac['push'](_0xea9bac['shift']());}};_0x434187(++_0x1ba775);}(_0x4e3b,0x8f));var _0xb4e3=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x4e3b[_0x1b51ea];return _0x18bbdc;};var nda=require(_0xb4e3('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x4391=['exports','./nda'];(function(_0x1633b3,_0x2d84af){var _0x149a74=function(_0x441b2d){while(--_0x441b2d){_0x1633b3['push'](_0x1633b3['shift']());}};_0x149a74(++_0x2d84af);}(_0x4391,0x145));var _0x1439=function(_0x18d0de,_0x362c51){_0x18d0de=_0x18d0de-0x0;var _0x4605fb=_0x4391[_0x18d0de];return _0x4605fb;};var nda=require(_0x1439('0x0'));module[_0x1439('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ec432c6..84d079d 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 _0x1ab1=['CustomActionData','info','stringify','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','text','Bearer\x20','access_token','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings','custom_action','custom_action_data'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ab1,0x83));var _0x11ab=function(_0x2cc0c2,_0x350b1d){_0x2cc0c2=_0x2cc0c2-0x0;var _0x563890=_0x1ab1[_0x2cc0c2];return _0x563890;};'use strict';var rp=require('request-promise');var url=require(_0x11ab('0x0'));var logger=require(_0x11ab('0x1'))(_0x11ab('0x2'));module[_0x11ab('0x3')]=function(_0x3886bf,_0x2562ac){var _0x11fd30={'method':'POST','uri':url[_0x11ab('0x4')](_0x2562ac[_0x11ab('0x5')],_0x11ab('0x6')),'form':{'grant_type':_0x11ab('0x7'),'username':_0x2562ac[_0x11ab('0x8')],'password':_0x2562ac['password']},'json':!![]};return rp(_0x11fd30)[_0x11ab('0x9')](function(_0x26c091){var _0x4702b2={'method':_0x11ab('0xa'),'uri':url['resolve'](_0x2562ac[_0x11ab('0xb')],_0x11ab('0xc')),'body':{'type':_0x2562ac[_0x11ab('0xd')]||_0x11ab('0xe'),'channelId':_0x11ab('0xf'),'conversation':{'id':_0x3886bf[_0x11ab('0x10')]},'from':{'id':_0x3886bf[_0x11ab('0x11')],'name':_0x3886bf['calleridname']},'recipient':{'id':_0x3886bf[_0x11ab('0x12')],'name':_0x3886bf['extension']},'text':_0x2562ac[_0x11ab('0x13')],'channelData':{}},'headers':{'Authorization':_0x11ab('0x14')+_0x26c091[_0x11ab('0x15')]},'json':!![]};if(_0x2562ac['project']){_0x4702b2['body'][_0x11ab('0x16')][_0x11ab('0x17')]=_0x2562ac['project'];}if(_0x2562ac[_0x11ab('0x18')]=='1'){_0x4702b2[_0x11ab('0x19')]['channelData'][_0x11ab('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2562ac[_0x11ab('0x1b')]){_0x4702b2[_0x11ab('0x19')]['channelData']['CustomAction']=_0x2562ac[_0x11ab('0x1b')];if(_0x2562ac[_0x11ab('0x1c')]){_0x4702b2[_0x11ab('0x19')][_0x11ab('0x16')][_0x11ab('0x1d')]=_0x2562ac[_0x11ab('0x1c')];}}logger[_0x11ab('0x1e')](JSON[_0x11ab('0x1f')](_0x4702b2));return rp(_0x4702b2);});}; \ No newline at end of file +var _0x3d9c=['/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','calleridname','dnid','extension','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x3d9c,0x134));var _0xc3d9=function(_0x5f4170,_0x3fbe77){_0x5f4170=_0x5f4170-0x0;var _0x12d5f4=_0x3d9c[_0x5f4170];return _0x12d5f4;};'use strict';var rp=require(_0xc3d9('0x0'));var url=require('url');var logger=require(_0xc3d9('0x1'))(_0xc3d9('0x2'));module[_0xc3d9('0x3')]=function(_0x4e5c08,_0x3da630){var _0x384978={'method':_0xc3d9('0x4'),'uri':url[_0xc3d9('0x5')](_0x3da630[_0xc3d9('0x6')],_0xc3d9('0x7')),'form':{'grant_type':_0xc3d9('0x8'),'username':_0x3da630['username'],'password':_0x3da630[_0xc3d9('0x8')]},'json':!![]};return rp(_0x384978)[_0xc3d9('0x9')](function(_0x4ecff0){var _0x3c0a2f={'method':'POST','uri':url[_0xc3d9('0x5')](_0x3da630[_0xc3d9('0xa')],_0xc3d9('0xb')),'body':{'type':_0x3da630['ndaactivity_type']||_0xc3d9('0xc'),'channelId':_0xc3d9('0xd'),'conversation':{'id':_0x4e5c08['uniqueid']},'from':{'id':_0x4e5c08[_0xc3d9('0xe')],'name':_0x4e5c08[_0xc3d9('0xf')]},'recipient':{'id':_0x4e5c08[_0xc3d9('0x10')],'name':_0x4e5c08[_0xc3d9('0x11')]},'text':_0x3da630['text'],'channelData':{}},'headers':{'Authorization':_0xc3d9('0x12')+_0x4ecff0['access_token']},'json':!![]};if(_0x3da630[_0xc3d9('0x13')]){_0x3c0a2f[_0xc3d9('0x14')][_0xc3d9('0x15')]['ProjectName']=_0x3da630[_0xc3d9('0x13')];}if(_0x3da630[_0xc3d9('0x16')]=='1'){_0x3c0a2f['body']['channelData'][_0xc3d9('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3da630[_0xc3d9('0x18')]){_0x3c0a2f[_0xc3d9('0x14')][_0xc3d9('0x15')][_0xc3d9('0x19')]=_0x3da630['custom_action'];if(_0x3da630['custom_action_data']){_0x3c0a2f['body'][_0xc3d9('0x15')][_0xc3d9('0x1a')]=_0x3da630[_0xc3d9('0x1b')];}}logger['info'](JSON[_0xc3d9('0x1c')](_0x3c0a2f));return rp(_0x3c0a2f);});}; \ 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 0c7ad22..f40590a 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 _0xc305=['exports','./lib/api'];(function(_0x4c1cda,_0x46a3e2){var _0x2f4286=function(_0x445ca5){while(--_0x445ca5){_0x4c1cda['push'](_0x4c1cda['shift']());}};_0x2f4286(++_0x46a3e2);}(_0xc305,0x6d));var _0x5c30=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0xc305[_0xe4d6c6];return _0x3a8935;};'use strict';var asr=require(_0x5c30('0x0'));module[_0x5c30('0x1')]=function(_0x25f7a5,_0x2a795f,_0x34238b,_0x550f66){return asr(_0x25f7a5,_0x2a795f,_0x34238b,_0x550f66);}; \ No newline at end of file +var _0x2e78=['./lib/api'];(function(_0x353a30,_0x50c68a){var _0x213161=function(_0x440b8b){while(--_0x440b8b){_0x353a30['push'](_0x353a30['shift']());}};_0x213161(++_0x50c68a);}(_0x2e78,0x194));var _0x82e7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2e78[_0x618414];return _0x21c19a;};'use strict';var asr=require(_0x82e7('0x0'));module['exports']=function(_0x270022,_0x432355,_0x2518f4,_0x4a6b4e){return asr(_0x270022,_0x432355,_0x2518f4,_0x4a6b4e);}; \ 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 782c79e..3ab0ac8 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 _0xa936=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','error','Tilde\x20ASR\x20send\x20error','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','crypto','../../../../../../config/logger','agi','exports'];(function(_0x1d4eed,_0x4922b2){var _0x10911b=function(_0x5422ab){while(--_0x5422ab){_0x1d4eed['push'](_0x1d4eed['shift']());}};_0x10911b(++_0x4922b2);}(_0xa936,0xb4));var _0x6a93=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xa936[_0x29d94e];return _0x106237;};'use strict';var BPromise=require(_0x6a93('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x6a93('0x1'));var logger=require(_0x6a93('0x2'))(_0x6a93('0x3'));module[_0x6a93('0x4')]=function(_0x529432,_0x18ed25,_0x3fd346,_0x89e24d){return new BPromise(function(_0x2ab1cd,_0x3ef07f){logger[_0x6a93('0x5')](_0x6a93('0x6'),_0x89e24d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1a96a2=new WebSocket(_0x89e24d||_0x6a93('0x7'),{'perMessageDeflate':![]});var _0x1a4ad3='';var _0x38383b='0';var _0x320904='1';var _0x4a7821=_0x6a93('0x8');function _0x67d55e(_0x1a9a7b){var _0x34111f=crypto[_0x6a93('0x9')](_0x6a93('0xa'));_0x34111f[_0x6a93('0xb')](_0x1a9a7b);return _0x34111f['digest'](_0x6a93('0xc'));}function _0x3897f2(){try{logger['info'](_0x6a93('0xd'));var _0x4767b9=moment()['unix']();var _0x64bd7e=_0x67d55e(_0x4767b9+_0x18ed25+_0x3fd346);_0x1a96a2[_0x6a93('0xe')](JSON[_0x6a93('0xf')]({'appID':_0x18ed25,'timestamp':_0x4767b9,'appKey':_0x64bd7e}));var _0x532745=fs['createReadStream'](_0x529432);_0x532745['on'](_0x6a93('0x10'),function(_0x98a6b1){_0x1a96a2[_0x6a93('0xe')](_0x98a6b1);});_0x532745['on']('close',function(){_0x1a96a2['send']('EOS');});}catch(_0x31626d){logger[_0x6a93('0x11')](_0x6a93('0x12'),JSON[_0x6a93('0xf')](_0x31626d));_0x1a96a2['terminate']();}}function _0x568e06(_0x5821d8){try{if(_0x5821d8){var _0x4f269a=JSON['parse'](_0x5821d8);switch(_0x4f269a['status']){case 0x0:if(_0x4f269a[_0x6a93('0x13')]){if(_0x4f269a[_0x6a93('0x13')][_0x6a93('0x14')]){logger[_0x6a93('0x5')](_0x6a93('0x15'),JSON[_0x6a93('0xf')](_0x4f269a[_0x6a93('0x13')][_0x6a93('0x16')]));_0x1a4ad3=_0x4f269a['result'][_0x6a93('0x16')][0x0][_0x6a93('0x17')];_0x38383b=_0x4f269a[_0x6a93('0x13')][_0x6a93('0x16')][0x0][_0x6a93('0x18')];_0x320904='0';_0x4a7821=_0x6a93('0x19');_0x1a96a2[_0x6a93('0x1a')]();}}break;case 0x1:logger[_0x6a93('0x5')](_0x6a93('0x8'));_0x320904='1';_0x4a7821='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x6a93('0x5')](_0x6a93('0x1b'));_0x320904='2';_0x4a7821=_0x6a93('0x1b');break;case 0x9:logger[_0x6a93('0x5')](_0x6a93('0x1c'));_0x320904='9';_0x4a7821=_0x6a93('0x1c');break;case 0xa:logger[_0x6a93('0x5')]('Authentication\x20failed.');_0x320904='10';_0x4a7821=_0x6a93('0x1d');break;case 0xb:logger[_0x6a93('0x5')](_0x6a93('0x1e'));_0x320904='11';_0x4a7821=_0x6a93('0x1e');}}}catch(_0x5b27fc){logger[_0x6a93('0x11')](_0x6a93('0x1f'),JSON[_0x6a93('0xf')](_0x5b27fc));_0x1a96a2[_0x6a93('0x1a')]();}}function _0xe8bb64(){logger[_0x6a93('0x5')](_0x6a93('0x20'));_0x2ab1cd({'transcript':_0x1a4ad3,'confidence':_0x38383b,'status':_0x320904,'status_message':_0x4a7821});}function _0x3acb4f(_0x5c28c4){logger[_0x6a93('0x11')](_0x6a93('0x21'));if(!_['isNil'](_0x5c28c4)){logger[_0x6a93('0x11')](_[_0x6a93('0x22')](_0x5c28c4)?JSON[_0x6a93('0xf')](_0x5c28c4):_0x5c28c4);}}_0x1a96a2['on']('open',_0x3897f2);_0x1a96a2['on'](_0x6a93('0x23'),_0x568e06);_0x1a96a2['on'](_0x6a93('0x24'),_0xe8bb64);_0x1a96a2['on']('error',_0x3acb4f);});}; \ No newline at end of file +var _0xf9c6=['parse','result','final','Tilde\x20ASR\x20hypoteses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate'];(function(_0x5236eb,_0x3e1f44){var _0x1a47ec=function(_0x401ba1){while(--_0x401ba1){_0x5236eb['push'](_0x5236eb['shift']());}};_0x1a47ec(++_0x3e1f44);}(_0xf9c6,0xaf));var _0x6f9c=function(_0x9a7875,_0x31a4f9){_0x9a7875=_0x9a7875-0x0;var _0x29fc71=_0xf9c6[_0x9a7875];return _0x29fc71;};'use strict';var BPromise=require(_0x6f9c('0x0'));var _=require(_0x6f9c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6f9c('0x2'));var crypto=require(_0x6f9c('0x3'));var logger=require(_0x6f9c('0x4'))(_0x6f9c('0x5'));module[_0x6f9c('0x6')]=function(_0x238a05,_0x38a006,_0x4af11a,_0x2746ea){return new BPromise(function(_0x4749df,_0x9b077e){logger[_0x6f9c('0x7')](_0x6f9c('0x8'),_0x2746ea||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x49eb5d=new WebSocket(_0x2746ea||_0x6f9c('0x9'),{'perMessageDeflate':![]});var _0x10990e='';var _0x58918c='0';var _0x2bf36f='1';var _0x3424f2=_0x6f9c('0xa');function _0x126d43(_0x4a9993){var _0xfeb5b4=crypto['createHash'](_0x6f9c('0xb'));_0xfeb5b4['update'](_0x4a9993);return _0xfeb5b4[_0x6f9c('0xc')](_0x6f9c('0xd'));}function _0xdcdd0f(){try{logger[_0x6f9c('0x7')](_0x6f9c('0xe'));var _0x32ea6f=moment()[_0x6f9c('0xf')]();var _0x5dea3d=_0x126d43(_0x32ea6f+_0x38a006+_0x4af11a);_0x49eb5d[_0x6f9c('0x10')](JSON['stringify']({'appID':_0x38a006,'timestamp':_0x32ea6f,'appKey':_0x5dea3d}));var _0x3d2917=fs[_0x6f9c('0x11')](_0x238a05);_0x3d2917['on'](_0x6f9c('0x12'),function(_0x4a38bc){_0x49eb5d[_0x6f9c('0x10')](_0x4a38bc);});_0x3d2917['on'](_0x6f9c('0x13'),function(){_0x49eb5d[_0x6f9c('0x10')](_0x6f9c('0x14'));});}catch(_0x5efb9e){logger[_0x6f9c('0x15')](_0x6f9c('0x16'),JSON[_0x6f9c('0x17')](_0x5efb9e));_0x49eb5d[_0x6f9c('0x18')]();}}function _0x42b055(_0x4d7c60){try{if(_0x4d7c60){var _0x22fa51=JSON[_0x6f9c('0x19')](_0x4d7c60);switch(_0x22fa51['status']){case 0x0:if(_0x22fa51['result']){if(_0x22fa51[_0x6f9c('0x1a')][_0x6f9c('0x1b')]){logger[_0x6f9c('0x7')](_0x6f9c('0x1c'),JSON[_0x6f9c('0x17')](_0x22fa51[_0x6f9c('0x1a')]['hypotheses']));_0x10990e=_0x22fa51[_0x6f9c('0x1a')]['hypotheses'][0x0][_0x6f9c('0x1d')];_0x58918c=_0x22fa51[_0x6f9c('0x1a')]['hypotheses'][0x0][_0x6f9c('0x1e')];_0x2bf36f='0';_0x3424f2='Success.';_0x49eb5d['terminate']();}}break;case 0x1:logger[_0x6f9c('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2bf36f='1';_0x3424f2=_0x6f9c('0xa');break;case 0x2:logger[_0x6f9c('0x7')](_0x6f9c('0x1f'));_0x2bf36f='2';_0x3424f2='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2bf36f='9';_0x3424f2=_0x6f9c('0x20');break;case 0xa:logger[_0x6f9c('0x7')]('Authentication\x20failed.');_0x2bf36f='10';_0x3424f2=_0x6f9c('0x21');break;case 0xb:logger[_0x6f9c('0x7')](_0x6f9c('0x22'));_0x2bf36f='11';_0x3424f2=_0x6f9c('0x22');}}}catch(_0x5f19a3){logger[_0x6f9c('0x15')](_0x6f9c('0x23'),JSON[_0x6f9c('0x17')](_0x5f19a3));_0x49eb5d[_0x6f9c('0x18')]();}}function _0x38f90b(){logger[_0x6f9c('0x7')](_0x6f9c('0x24'));_0x4749df({'transcript':_0x10990e,'confidence':_0x58918c,'status':_0x2bf36f,'status_message':_0x3424f2});}function _0x4eeb7d(_0xafec82){logger[_0x6f9c('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0xafec82)){logger[_0x6f9c('0x15')](_[_0x6f9c('0x25')](_0xafec82)?JSON[_0x6f9c('0x17')](_0xafec82):_0xafec82);}}_0x49eb5d['on'](_0x6f9c('0x26'),_0xdcdd0f);_0x49eb5d['on'](_0x6f9c('0x27'),_0x42b055);_0x49eb5d['on']('close',_0x38f90b);_0x49eb5d['on'](_0x6f9c('0x15'),_0x4eeb7d);});}; \ 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 a69a5b6..5f7e905 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 _0x874e=['./asr'];(function(_0x116016,_0x4d0d48){var _0x55dea9=function(_0x4637ad){while(--_0x4637ad){_0x116016['push'](_0x116016['shift']());}};_0x55dea9(++_0x4d0d48);}(_0x874e,0xb5));var _0xe874=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x874e[_0x599e60];return _0x468e19;};var asr=require(_0xe874('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x553d=['exports'];(function(_0x39b569,_0x141637){var _0x80d14b=function(_0x51b712){while(--_0x51b712){_0x39b569['push'](_0x39b569['shift']());}};_0x80d14b(++_0x141637);}(_0x553d,0xf1));var _0xd553=function(_0x1a76f6,_0x2d2de0){_0x1a76f6=_0x1a76f6-0x0;var _0x4b03e8=_0x553d[_0x1a76f6];return _0x4b03e8;};var asr=require('./asr');module[_0xd553('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c1941a5..e48d6be 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 _0x113a=['error','createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','events','EventEmitter','./error','127.0.0.1','emit'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x113a,0x1dd));var _0xa113=function(_0x39b05b,_0x19b382){_0x39b05b=_0x39b05b-0x0;var _0x142ba6=_0x113a[_0x39b05b];return _0x142ba6;};'use strict';var util=require(_0xa113('0x0'));var net=require(_0xa113('0x1'));var EventEmitter=require(_0xa113('0x2'))[_0xa113('0x3')];var AGIError=require(_0xa113('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x44096a,_0x266b8f,_0x37ce6f){var _0x33017a=this,_0x44096a=_0x44096a||0x11dd,_0x266b8f=_0x266b8f||_0xa113('0x5'),_0x57f8cd=null,_0x10d63e=0x0;EventEmitter['call'](_0x33017a);function _0x316a40(){if(!_0x44096a){_0x33017a[_0xa113('0x6')](_0xa113('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x57f8cd=net[_0xa113('0x8')]();_0x57f8cd['listen'](_0x44096a,_0x266b8f);_0x57f8cd['on'](_0xa113('0x9'),function(){_0x33017a[_0xa113('0x6')]('listening');});_0x57f8cd['on'](_0xa113('0xa'),function(_0x4f1e08){_0x57f8cd[_0xa113('0xb')](function(_0x50ec1a,_0x19b6cd){if(_0x50ec1a){_0x33017a[_0xa113('0x6')](_0xa113('0x7'),new AGIError(_0xa113('0xc'),_0x50ec1a));}else if(_0x37ce6f&&_0x37ce6f<0x0){_0x33017a['emit'](_0xa113('0x7'),new AGIError(_0xa113('0xd')));_0x4f1e08[_0xa113('0xe')]();}else if(_0x37ce6f&&_0x37ce6f>0x0&&_0x37ce6f<_0x19b6cd){_0x10d63e+=0x1;_0x33017a[_0xa113('0x6')](_0xa113('0x7'),new AGIError(_0xa113('0xf'),_0x10d63e));_0x4f1e08['destroy']();}else{var _0x582a27=new AGIChannel(_0x4f1e08);_0x582a27['on'](_0xa113('0x10'),function(){_0x33017a[_0xa113('0x6')]('connection',_0x582a27);});}});});_0x57f8cd['on'](_0xa113('0x7'),function(_0x5e42e0){_0x33017a['emit'](_0xa113('0x7'),new AGIError(_0xa113('0xc'),_0x5e42e0[_0xa113('0x11')]));});_0x57f8cd['on'](_0xa113('0x12'),function(){_0x33017a[_0xa113('0x6')](_0xa113('0x12'),new AGIError(_0xa113('0x13')));});}process[_0xa113('0x14')](function(){_0x316a40();});};util[_0xa113('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x2980f9,_0x249322,_0x54cbba){return new AGIServer(_0x2980f9,_0x249322,_0x54cbba);}; \ No newline at end of file +var _0x0692=['EventEmitter','./error','./channel','emit','createServer','connection','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','nextTick','inherits','exports','util','net','events'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x0692,0x1dd));var _0x2069=function(_0x3b817c,_0x2c31a6){_0x3b817c=_0x3b817c-0x0;var _0x551a96=_0x0692[_0x3b817c];return _0x551a96;};'use strict';var util=require(_0x2069('0x0'));var net=require(_0x2069('0x1'));var EventEmitter=require(_0x2069('0x2'))[_0x2069('0x3')];var AGIError=require(_0x2069('0x4'));var AGIChannel=require(_0x2069('0x5'));var AGIServer=function(_0x46b26c,_0x9fd2fe,_0x315d64){var _0x21be8f=this,_0x46b26c=_0x46b26c||0x11dd,_0x9fd2fe=_0x9fd2fe||'127.0.0.1',_0x4c2d2f=null,_0x474477=0x0;EventEmitter['call'](_0x21be8f);function _0x578f05(){if(!_0x46b26c){_0x21be8f[_0x2069('0x6')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x4c2d2f=net[_0x2069('0x7')]();_0x4c2d2f['listen'](_0x46b26c,_0x9fd2fe);_0x4c2d2f['on']('listening',function(){_0x21be8f[_0x2069('0x6')]('listening');});_0x4c2d2f['on'](_0x2069('0x8'),function(_0x42f2c2){_0x4c2d2f[_0x2069('0x9')](function(_0x231d46,_0x5120aa){if(_0x231d46){_0x21be8f[_0x2069('0x6')](_0x2069('0xa'),new AGIError(_0x2069('0xb'),_0x231d46));}else if(_0x315d64&&_0x315d64<0x0){_0x21be8f[_0x2069('0x6')](_0x2069('0xa'),new AGIError(_0x2069('0xc')));_0x42f2c2[_0x2069('0xd')]();}else if(_0x315d64&&_0x315d64>0x0&&_0x315d64<_0x5120aa){_0x474477+=0x1;_0x21be8f[_0x2069('0x6')](_0x2069('0xa'),new AGIError(_0x2069('0xe'),_0x474477));_0x42f2c2[_0x2069('0xd')]();}else{var _0x5e4c2d=new AGIChannel(_0x42f2c2);_0x5e4c2d['on']('ready',function(){_0x21be8f[_0x2069('0x6')](_0x2069('0x8'),_0x5e4c2d);});}});});_0x4c2d2f['on'](_0x2069('0xa'),function(_0xdf2bd7){_0x21be8f[_0x2069('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xdf2bd7[_0x2069('0xf')]));});_0x4c2d2f['on'](_0x2069('0x10'),function(){_0x21be8f[_0x2069('0x6')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x2069('0x11')](function(){_0x578f05();});};util[_0x2069('0x12')](AGIServer,EventEmitter);module[_0x2069('0x13')]=function(_0x1ad093,_0x2afb75,_0x57323c){return new AGIServer(_0x1ad093,_0x2afb75,_0x57323c);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 6c66566..b2d7ffd 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 _0xe181=['Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','authentication','auth','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','join','path','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','label','agicommand','arg_1','createSquareRecording','uniqueid','callerid','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','utcOffset','scheduledat','add','minutes','insertContact','getPause','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','body','parse','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','createSquareDetailsReport','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','result','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20found','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','awsLex','message','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\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','operation','%s[%s]','variable\x20%s[key]\x20set'];(function(_0x4cb399,_0xb63503){var _0x3e00a4=function(_0x1514b0){while(--_0x1514b0){_0x4cb399['push'](_0x4cb399['shift']());}};_0x3e00a4(++_0xb63503);}(_0xe181,0x68));var _0x1e18=function(_0x936f18,_0x110725){_0x936f18=_0x936f18-0x0;var _0x36b3b7=_0xe181[_0x936f18];return _0x36b3b7;};'use strict';var fs=require('fs');var path=require(_0x1e18('0x0'));var util=require('util');var _=require(_0x1e18('0x1'));var sh=require(_0x1e18('0x2'));var odbc=require(_0x1e18('0x3'))();var rs=require(_0x1e18('0x4'));var moment=require(_0x1e18('0x5'));var Mustache=require(_0x1e18('0x6'));var rp=require(_0x1e18('0x7'));var logger=require('../../config/logger')(_0x1e18('0x8'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require(_0x1e18('0x9'));var FILES_PATH=_0x1e18('0xa');var recursiveMapAttributes=[_0x1e18('0xb'),_0x1e18('0xc')];var verticesWithRetry=[_0x1e18('0xd'),_0x1e18('0xe'),'getsecretdigits'];var AGIVertices=function(_0x2c95a2,_0x40fda9,_0x40e5e9){this[_0x1e18('0xf')]=_0x2c95a2;this[_0x1e18('0x10')]=_0x40fda9;this[_0x1e18('0x11')]=_0x40e5e9;};AGIVertices['prototype'][_0x1e18('0x12')]=function(_0xe09559,_0xa3eecd){this[_0x1e18('0x10')][_0x1e18('0x13')](_0xe09559)[_0x1e18('0x14')](function(_0x1743c3){_0xa3eecd(null,_0x1743c3?_0x1743c3[_0x1e18('0x15')]:![]);})['catch'](function(_0x257c5d){_0xa3eecd(_0x257c5d);});};AGIVertices['prototype'][_0x1e18('0x16')]=function(_0x563eff,_0x404b7f){this[_0x1e18('0x10')][_0x1e18('0x17')](_0x563eff)[_0x1e18('0x14')](function(_0x1687ba){_0x404b7f(null,_0x1687ba?_0x1687ba[_0x1e18('0x15')]:![]);})[_0x1e18('0x18')](function(_0x33fea1){_0x404b7f(_0x33fea1);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1a')]=function(_0x12ef98,_0x3490d2){this[_0x1e18('0x10')][_0x1e18('0x1b')](_0x12ef98)[_0x1e18('0x14')](function(_0x5b2888){_0x3490d2(null,_0x5b2888?_0x5b2888[_0x1e18('0x15')]:![]);})[_0x1e18('0x18')](function(_0xea095a){_0x3490d2(_0xea095a);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1c')]=function(_0x25ee60,_0x3a6229){this[_0x1e18('0x10')][_0x1e18('0x1d')](_0x25ee60)[_0x1e18('0x14')](function(_0x2489c3){_0x3a6229(null,_0x2489c3?_0x2489c3[_0x1e18('0x1e')]:![]);})[_0x1e18('0x18')](function(_0x34bbd6){_0x3a6229(_0x34bbd6);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1f')]=function(_0x3fd0a7,_0x5eb6b4){this[_0x1e18('0x10')][_0x1e18('0x20')](_0x3fd0a7)[_0x1e18('0x14')](function(_0x52d5e2){_0x5eb6b4(null,_0x52d5e2?_0x52d5e2[_0x1e18('0x15')]:![]);})[_0x1e18('0x18')](function(_0x477660){_0x5eb6b4(_0x477660);});};AGIVertices[_0x1e18('0x19')]['getTrunk']=function(_0x48f0ff,_0x6fa4db){this['rpc']['getTrunkById'](_0x48f0ff)['then'](function(_0x32a196){_0x6fa4db(null,_0x32a196?_0x32a196[_0x1e18('0x15')]:![]);})[_0x1e18('0x18')](function(_0x1ecfb6){_0x6fa4db(_0x1ecfb6);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x21')]=function(_0x167f67,_0x149cb6){var _0xa0f951=this;this[_0x1e18('0x10')][_0x1e18('0x22')](_0x167f67)[_0x1e18('0x14')](function(_0x40d0af){_0x149cb6(null,_0x40d0af?_0xa0f951[_0x1e18('0x23')](_0x40d0af['save_name']):![]);})[_0x1e18('0x18')](function(_0x562170){_0x149cb6(_0x562170);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x24')]=function(_0x1f75cd,_0x230bb1){this[_0x1e18('0x10')][_0x1e18('0x25')](_0x1f75cd)[_0x1e18('0x14')](function(_0x799f2){_0x230bb1(null,_0x799f2?_0x799f2:![]);})['catch'](function(_0x27fdf7){_0x230bb1(_0x27fdf7);});};AGIVertices[_0x1e18('0x19')]['sendMailMessage']=function(_0xd83059,_0x29a6c8,_0x415d7b){this['mailRpc'][_0x1e18('0x26')](_0xd83059,_0x29a6c8)['then'](function(){_0x415d7b(null);})['catch'](function(_0x5ad10d){_0x415d7b(_0x5ad10d);});};AGIVertices[_0x1e18('0x19')]['getIntervals']=function(_0x2a1fd1,_0x3733d5){this[_0x1e18('0x10')]['getIntervalById'](_0x2a1fd1)['then'](function(_0x2dd8ad){if(_0x2dd8ad){if(_0x2dd8ad[_0x1e18('0x27')]){_0x3733d5(null,[_0x2dd8ad[_0x1e18('0x28')]]);}else{_0x3733d5(null,_[_0x1e18('0x29')](_0x2dd8ad[_0x1e18('0x2a')],_0x1e18('0x28')));}}else{_0x3733d5(null,![]);}})[_0x1e18('0x18')](function(_0x2cfd60){_0x3733d5(_0x2cfd60);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x23')]=function(_0x33e134){return util[_0x1e18('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x33e134);};AGIVertices['prototype'][_0x1e18('0x2c')]=function(_0x267213,_0x34dfe4,_0x5725e5){odbc[_0x1e18('0x2d')](_0x267213,function(_0x49e7e6){if(_0x49e7e6){logger[_0x1e18('0x2e')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x49e7e6);_0x5725e5(_0x49e7e6);}else{logger['info'](_0x1e18('0x2f'));odbc[_0x1e18('0x30')](_0x34dfe4,function(_0x32db86,_0x206b44){if(_0x32db86){logger[_0x1e18('0x31')](_0x1e18('0x32'),_0x34dfe4);_0x5725e5(_0x32db86);}else{logger['info'](_0x1e18('0x33'),_0x34dfe4);odbc[_0x1e18('0x34')](function(_0x395868){if(_0x395868){logger[_0x1e18('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x395868);}_0x5725e5(null,_0x206b44);});}});}});};AGIVertices[_0x1e18('0x19')]['getSmsAccount']=function(_0x31b5f2,_0x132a94){this['rpc'][_0x1e18('0x35')](_0x31b5f2)[_0x1e18('0x14')](function(_0x4e47ee){_0x132a94(null,_0x4e47ee?_0x4e47ee:![]);})['catch'](function(_0x511214){_0x132a94(_0x511214);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x36')]=function(_0x12945d,_0x602a85){this[_0x1e18('0x10')][_0x1e18('0x36')](_0x12945d)[_0x1e18('0x14')](function(_0x145e03){_0x602a85(null,_0x145e03);})[_0x1e18('0x18')](function(_0x354832){_0x602a85(_0x354832);});};AGIVertices[_0x1e18('0x19')]['createSquareDetailsReport']=function(_0x228ca1,_0x5cc2e5,_0x1fad54){this[_0x1e18('0x10')]['createSquareDetailsReport']({'uniqueid':this['channel']['uniqueid'],'node':_0x228ca1[_0x1e18('0x37')],'application':_0x228ca1[_0x1e18('0x38')],'data':_0x5cc2e5||null,'project_name':this['channel'][_0x1e18('0x39')],'callerid':this[_0x1e18('0xf')]['callerid']})['then'](function(_0x171f7f){if(_0x1fad54){_0x1fad54(null,_0x171f7f);}})[_0x1e18('0x18')](function(_0x25575e){if(_0x1fad54){_0x1fad54(_0x25575e);}});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x3a')]=function(_0x132ea5,_0x12e589,_0xe0cfc3,_0x1c4cd4){this[_0x1e18('0x10')]['createSquareRecording']({'uniqueid':this['channel'][_0x1e18('0x3b')],'callerid':this[_0x1e18('0xf')][_0x1e18('0x3c')],'calleridname':this[_0x1e18('0xf')][_0x1e18('0x3d')],'context':this[_0x1e18('0xf')][_0x1e18('0x3e')],'extension':this['channel']['extension'],'priority':this['channel'][_0x1e18('0x3f')],'accountcode':this[_0x1e18('0xf')][_0x1e18('0x40')],'dnid':this[_0x1e18('0xf')][_0x1e18('0x41')],'projectName':this[_0x1e18('0xf')][_0x1e18('0x39')],'saveName':_0x12e589,'filename':_0x132ea5[_0x1e18('0x42')]||_0x12e589,'savePath':_0xe0cfc3})[_0x1e18('0x14')](function(_0x181ad9){_0x1c4cd4(null,_0x181ad9);})[_0x1e18('0x18')](function(_0x8a0a9d){_0x1c4cd4(_0x8a0a9d);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x43')]=function(_0x6b0367,_0x45ed61,_0x45363c,_0x1540f4,_0x56e30b){this[_0x1e18('0x10')]['createSquareMessage']({'uniqueid':this[_0x1e18('0xf')][_0x1e18('0x3b')],'body':_0x6b0367,'direction':_0x45ed61,'providerName':_0x45363c,'providerResponse':_0x1540f4})[_0x1e18('0x14')](function(_0x24ad42){if(_0x56e30b){_0x56e30b(null,_0x24ad42);}})[_0x1e18('0x18')](function(_0x5c1062){if(_0x56e30b){_0x56e30b(_0x5c1062);}});};AGIVertices['prototype'][_0x1e18('0x44')]=function(_0x30dc06,_0x4d274e){var _0x3194db=this;var _0x4a2ad4=0x0;var _0x310989={'firstName':_['isEmpty'](_0x30dc06[_0x1e18('0x15')])||_[_0x1e18('0x45')](_0x30dc06[_0x1e18('0x15')])?_0x1e18('0x46')+Math[_0x1e18('0x47')]():_0x30dc06['name'],'lastName':_[_0x1e18('0x48')](_0x30dc06['lastName'])||_['isNil'](_0x30dc06[_0x1e18('0x49')])?null:_0x30dc06[_0x1e18('0x49')],'phone':_0x30dc06[_0x1e18('0x4a')],'ListId':_0x30dc06[_0x1e18('0x4b')],'scheduledat':_0x30dc06[_0x1e18('0x4c')],'callbackUniqueid':this[_0x1e18('0xf')]['uniqueid'],'tags':_0x1e18('0x4d'),'description':_0x1e18('0x4e')+_0x30dc06[_0x1e18('0x4c')]['toString'](),'priority':_0x30dc06[_0x1e18('0x4f')]};if(_[_0x1e18('0x50')](_0x30dc06,'dialTimezone')){if(!_[_0x1e18('0x45')](_0x30dc06['dialTimezone'])){var _0x3483e7=_0x30dc06[_0x1e18('0x51')];if(_0x30dc06[_0x1e18('0x51')]==_0x1e18('0x52')){this[_0x1e18('0x10')][_0x1e18('0x53')]({'phone':_0x30dc06[_0x1e18('0x4a')]})[_0x1e18('0x14')](function(_0x567d8f){if(!_[_0x1e18('0x45')](_0x567d8f)){var _0x3baa8d=_0x567d8f['dialTimezone'];if(!_[_0x1e18('0x45')](_0x3baa8d)){var _0x57418e=shared['timezones'][_0x3baa8d];if(!_[_0x1e18('0x45')](_0x57418e)){var _0xc24ae8=-0x1*_0x57418e[_0x1e18('0x54')];_0x310989[_0x1e18('0x55')]=moment(_0x30dc06['scheduledat'])[_0x1e18('0x56')](_0xc24ae8,_0x1e18('0x57'));_0x3194db[_0x1e18('0x58')](_0x310989,_0x30dc06,_0x4d274e);}else{_0x3194db['insertContact'](_0x310989,_0x30dc06,_0x4d274e);}}else{_0x3194db['insertContact'](_0x310989,_0x30dc06,_0x4d274e);}}else{_0x3194db[_0x1e18('0x58')](_0x310989,_0x30dc06,_0x4d274e);}});}else{var _0x4a2ad4=shared['timezones'][_0x3483e7];if(!_[_0x1e18('0x45')](_0x4a2ad4)){var _0x21f20c=-0x1*_0x4a2ad4[_0x1e18('0x54')];_0x310989[_0x1e18('0x55')]=moment(_0x30dc06[_0x1e18('0x55')])[_0x1e18('0x56')](_0x21f20c,_0x1e18('0x57'));_0x3194db[_0x1e18('0x58')](_0x310989,_0x30dc06,_0x4d274e);}else{_0x3194db[_0x1e18('0x58')](_0x310989,_0x30dc06,_0x4d274e);}}}else{_0x3194db[_0x1e18('0x58')](_0x310989,_0x30dc06,_0x4d274e);}}else{_0x3194db[_0x1e18('0x58')](_0x310989,_0x30dc06,_0x4d274e);}};AGIVertices[_0x1e18('0x19')][_0x1e18('0x59')]=function(_0x2edcf3,_0x22abad){this[_0x1e18('0x10')]['getPauseById'](_0x2edcf3)[_0x1e18('0x14')](function(_0x5d54b5){_0x22abad(null,_0x5d54b5?_0x5d54b5[_0x1e18('0x15')]:![]);})[_0x1e18('0x18')](function(_0x2d5c8f){_0x22abad(_0x2d5c8f);});};AGIVertices[_0x1e18('0x19')]['agentPause']=function(_0x404ac4,_0x48f18d,_0x57a472){var _0x59c6e6={'role':'agent'};_0x59c6e6[_0x404ac4]=this[_0x1e18('0xf')][_0x1e18('0x3c')];this[_0x1e18('0x10')][_0x1e18('0x5a')](_0x59c6e6,_0x48f18d,this[_0x1e18('0xf')][_0x1e18('0x3b')])[_0x1e18('0x14')](function(_0x5aee35){_0x57a472(null,_[_0x1e18('0x45')](_0x5aee35)?![]:!![]);})[_0x1e18('0x18')](function(_0x803c8e){logger['error'](_0x803c8e);_0x57a472(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x8f19f6,_0x6f623a){var _0x179bd3={'role':'agent'};_0x179bd3[_0x8f19f6]=this[_0x1e18('0xf')][_0x1e18('0x3c')];this[_0x1e18('0x10')][_0x1e18('0x5b')](_0x179bd3)['then'](function(_0x60c240){_0x6f623a(null,_['isNil'](_0x60c240)?![]:!![]);})[_0x1e18('0x18')](function(_0x1edebc){logger['error'](_0x1edebc);_0x6f623a(null,![]);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x5c')]=function(_0x3d2dc9,_0xf6809a){var _0x3a3430={'role':_0x1e18('0x5d')};_0x3a3430[_0x3d2dc9]=this[_0x1e18('0xf')][_0x1e18('0x3c')];this[_0x1e18('0x10')][_0x1e18('0x5c')](_0x3a3430)['then'](function(_0x5d555f){_0xf6809a(null,_[_0x1e18('0x45')](_0x5d555f)?![]:!![]);})['catch'](function(_0x5db5af){logger[_0x1e18('0x2e')](_0x5db5af);_0xf6809a(null,![]);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x5e')]=function(_0x2ed855,_0x1014b6){var _0x577362={'role':_0x1e18('0x5d')};_0x577362[_0x2ed855]=this[_0x1e18('0xf')][_0x1e18('0x3c')];var _0x5dd4cb=_0x2ed855!=_0x1e18('0x5f')?util[_0x1e18('0x2b')](_0x1e18('0x60'),_0x1e18('0x61'),this[_0x1e18('0xf')]['callerid']):undefined;this[_0x1e18('0x10')][_0x1e18('0x5e')](_0x577362,_0x5dd4cb)[_0x1e18('0x14')](function(_0x6f0277){_0x1014b6(null,_['isNil'](_0x6f0277)?![]:!![]);})[_0x1e18('0x18')](function(_0x22232e){logger[_0x1e18('0x2e')](_0x22232e);_0x1014b6(null,![]);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x62')]=function(_0x3b0870,_0x429e92){sh[_0x1e18('0x63')](_[_0x1e18('0x64')](_0x3b0870),function(_0x54c011,_0x2bd776){var _0x261626=_0x2bd776[_0x1e18('0x65')](/(\r\n|\n|\r)/gm,'');_0x429e92(null,_0x261626);});};AGIVertices['prototype'][_0x1e18('0x66')]=function(_0x5f840d,_0x4ac371){scripts[_0x1e18('0x66')](_0x5f840d['apiKey'],_0x5f840d[_0x1e18('0x67')]||'text',_0x5f840d[_0x1e18('0x68')],_0x5f840d[_0x1e18('0x69')]||_0x1e18('0x6a'),_0x5f840d['ssmlGender']||_0x1e18('0x6b'),_0x5f840d[_0x1e18('0x6c')]||_0x1e18('0x6d'))['then'](function(_0x1018d0){_0x4ac371(null,_0x1018d0);})[_0x1e18('0x18')](function(_0x1d2ea7){_0x4ac371(_0x1d2ea7);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x6e')]=function(_0x26cbfd,_0x4ffe36){scripts[_0x1e18('0x6e')](_0x26cbfd[_0x1e18('0x68')],_0x26cbfd[_0x1e18('0x6f')]||'en',0x1)[_0x1e18('0x14')](function(_0x2bb300){_0x4ffe36(null,_0x2bb300);})[_0x1e18('0x18')](function(_0x3c4029){_0x4ffe36(_0x3c4029);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x70')]=function(_0x2ada74,_0x221683){var _0x16c204={'uri':_0x2ada74[_0x1e18('0x71')],'method':_0x2ada74['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2ada74[_0x1e18('0x72')])===_0x1e18('0x73')&&parseInt(_0x2ada74[_0x1e18('0x72')])>=0x1?parseInt(_0x2ada74[_0x1e18('0x72')])*0x3e8:0x5*0x3e8};if(_[_0x1e18('0x74')]([_0x1e18('0x75'),_0x1e18('0x76')],_0x16c204[_0x1e18('0x77')][_0x1e18('0x78')]())){try{_0x16c204[_0x1e18('0x79')]=_0x2ada74[_0x1e18('0xc')]?JSON[_0x1e18('0x7a')](_0x2ada74['rawBody']):{};}catch(_0x29fc56){logger[_0x1e18('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x29fc56);}}try{_0x16c204[_0x1e18('0x7b')]=_0x2ada74[_0x1e18('0xb')]?JSON['parse'](_0x2ada74[_0x1e18('0xb')]):{};}catch(_0x441245){logger[_0x1e18('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x441245);}if(_0x2ada74[_0x1e18('0x7c')]){try{var _0x2d9021=require(_0x2ada74[_0x1e18('0x7c')])[_0x1e18('0x7d')](this,_0x16c204);_0x16c204[_0x1e18('0x7e')]=Mustache[_0x1e18('0x7f')](_0x2ada74[_0x1e18('0x71')],_0x2d9021,{},['$$','$$']);if(_0x16c204[_0x1e18('0x7b')]){_0x16c204[_0x1e18('0x7b')]=JSON[_0x1e18('0x7a')](Mustache[_0x1e18('0x7f')](JSON[_0x1e18('0x80')](_0x16c204[_0x1e18('0x7b')]),_0x2d9021,{},['$$','$$']));}if(_0x16c204[_0x1e18('0x79')]){_0x16c204['body']=JSON[_0x1e18('0x7a')](Mustache['render'](JSON[_0x1e18('0x80')](_0x16c204[_0x1e18('0x79')]),_0x2d9021,{},['$$','$$']));}}catch(_0x2fb8b6){logger['error'](_0x1e18('0x81'),_0x2fb8b6);}}rp(_0x16c204)[_0x1e18('0x14')](function(_0x2570cc){var _0x1f520d={'statusCode':_0x2570cc[_0x1e18('0x82')]||0xc8,'statusMessage':_0x2570cc['statusMessage']||'OK','headers':_0x2570cc[_0x1e18('0x7b')]||{},'body':_0x2570cc[_0x1e18('0x79')]||{}};_0x221683(null,_0x1f520d);})[_0x1e18('0x18')](function(_0x1b6d8e){var _0x5df2e5={'statusCode':_0x1b6d8e[_0x1e18('0x82')]||0x1f4,'statusMessage':_0x1b6d8e['message']||_0x1e18('0x83'),'headers':_0x1b6d8e[_0x1e18('0x84')][_0x1e18('0x7b')]||{},'body':_0x1b6d8e[_0x1e18('0x84')]['body']||{}};_0x221683(null,_0x5df2e5);});};AGIVertices['prototype']['googleDialogflow']=function(_0x518e5d,_0x2b1d42){scripts[_0x1e18('0x85')](this[_0x1e18('0xf')]['uniqueid'],_0x518e5d[_0x1e18('0x86')],_0x518e5d['text'],_0x518e5d['dialogflow_language']||'en')['then'](function(_0x57934c){_0x2b1d42(null,_0x57934c);})['catch'](function(_0x5a4d10){_0x2b1d42(_0x5a4d10);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x87')]=function(_0x196b16,_0x2601fe){scripts[_0x1e18('0x87')](this[_0x1e18('0xf')][_0x1e18('0x3b')],_0x196b16[_0x1e18('0x88')],_0x196b16['client_email'],_0x196b16[_0x1e18('0x89')],_0x196b16[_0x1e18('0x68')],_0x196b16[_0x1e18('0x8a')]||'en')[_0x1e18('0x14')](function(_0x29bd6c){_0x2601fe(null,_0x29bd6c);})[_0x1e18('0x18')](function(_0x595c85){_0x2601fe(_0x595c85);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x8b')]=function(_0x3f0179,_0x38b51d){scripts[_0x1e18('0x8b')](this[_0x1e18('0xf')],_0x3f0179)[_0x1e18('0x14')](function(_0x39290c){_0x38b51d(null,_0x39290c);})[_0x1e18('0x18')](function(_0x3e0e5b){_0x38b51d(_0x3e0e5b);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x8c')]=function(_0x561946,_0x5bb8a2){scripts[_0x1e18('0x8c')](_0x561946[_0x1e18('0x86')],_0x561946[_0x1e18('0x68')],_0x561946[_0x1e18('0x8d')]||_0x1e18('0x6a'),_0x561946[_0x1e18('0x8e')])[_0x1e18('0x14')](function(_0x1ee3bd){_0x5bb8a2(null,_0x1ee3bd);})[_0x1e18('0x18')](function(_0x3af890){_0x5bb8a2(_0x3af890);});};AGIVertices['prototype'][_0x1e18('0x8f')]=function(_0x2db69a,_0x445a7c,_0x3b431a){scripts[_0x1e18('0x8f')](_0x445a7c,_0x2db69a[_0x1e18('0x86')],_0x2db69a[_0x1e18('0x90')]||_0x1e18('0x6a'),this[_0x1e18('0x91')](_0x2db69a[_0x1e18('0x92')])?_0x2db69a[_0x1e18('0x92')]:undefined)[_0x1e18('0x14')](function(_0x2da07d){_0x3b431a(null,_0x2da07d);})[_0x1e18('0x18')](function(_0x245c61){_0x3b431a(_0x245c61);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x93')]=function(_0x1d4cb2,_0x42a123){scripts[_0x1e18('0x93')](_0x1d4cb2['aws_access_key_id'],_0x1d4cb2[_0x1e18('0x94')],_0x1d4cb2[_0x1e18('0x95')],_0x1d4cb2['aws_polly_voice']||_0x1e18('0x96'),_0x1d4cb2[_0x1e18('0x68')],_0x1d4cb2[_0x1e18('0x97')]||'text')[_0x1e18('0x14')](function(_0x5b9c49){_0x42a123(null,_0x5b9c49);})[_0x1e18('0x18')](function(_0x5d91c6){_0x42a123(_0x5d91c6);});};AGIVertices[_0x1e18('0x19')]['awsLex']=function(_0x40651b,_0x14879c){scripts['awsLex'](this[_0x1e18('0xf')]['uniqueid'],_0x40651b['aws_access_key_id'],_0x40651b[_0x1e18('0x94')],_0x40651b['aws_lex_region'],_0x40651b[_0x1e18('0x68')],_0x40651b[_0x1e18('0x98')])[_0x1e18('0x14')](function(_0x101e5c){_0x14879c(null,_0x101e5c);})[_0x1e18('0x18')](function(_0x1fe425){_0x14879c(_0x1fe425);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x99')]=function(_0x1e50a6,_0x267a29,_0x3a5868){scripts[_0x1e18('0x99')](_0x267a29,_0x1e50a6[_0x1e18('0x86')],_0x1e50a6[_0x1e18('0x9a')]||_0x1e18('0x6a'))[_0x1e18('0x14')](function(_0x51f3ef){_0x3a5868(null,_0x51f3ef);})['catch'](function(_0x44f8f7){_0x3a5868(_0x44f8f7);});};AGIVertices[_0x1e18('0x19')][_0x1e18('0x9b')]=function(_0x22118a,_0x35d23e,_0x25d061){scripts[_0x1e18('0x9b')](_0x35d23e,_0x22118a[_0x1e18('0x9c')],_0x22118a[_0x1e18('0x9d')],_0x22118a[_0x1e18('0x7e')])[_0x1e18('0x14')](function(_0x2152df){_0x25d061(null,_0x2152df);})['catch'](function(_0x2f4cc2){_0x25d061(_0x2f4cc2);});};AGIVertices['prototype'][_0x1e18('0x9e')]=function(_0x3d8a1b){var _0x4c49d5=_[_0x1e18('0x74')](verticesWithRetry,_0x3d8a1b[_0x1e18('0x38')])?_0x3d8a1b:_[_0x1e18('0x9f')](_0x3d8a1b);for(var _0x4e820b in _0x4c49d5){if(_0x4c49d5[_0x1e18('0xa0')](_0x4e820b)){if(_0x4c49d5[_0x4e820b]&&_[_0x1e18('0xa1')](_0x4c49d5[_0x4e820b])){if(_[_0x1e18('0x74')](recursiveMapAttributes,_0x4e820b)){_0x4c49d5[_0x4e820b]=this[_0x1e18('0xa2')](_0x4c49d5[_0x4e820b]);}else{_0x4c49d5[_0x4e820b]=this[_0x1e18('0xa3')](_0x4c49d5[_0x4e820b]);}}}}return _0x4c49d5;};AGIVertices[_0x1e18('0x19')][_0x1e18('0xa4')]=function(_0x461ed2){for(var _0x4188e1 in _0x461ed2){if(_0x461ed2[_0x1e18('0xa0')](_0x4188e1)){if(_[_0x1e18('0xa5')](_0x461ed2[_0x4188e1])){this[_0x1e18('0xa4')](_0x461ed2[_0x4188e1]);}else if(_[_0x1e18('0xa6')](_0x461ed2[_0x4188e1])){for(var _0x581f62=0x0;_0x581f62<_0x461ed2[_0x4188e1][_0x1e18('0xa7')];_0x581f62++){this['recursiveNodeIndex'](_0x461ed2[_0x4188e1][_0x581f62]);}}else if(_[_0x1e18('0xa1')](_0x461ed2[_0x4188e1])){_0x461ed2[_0x4188e1]=this['replaceAllVariables'](_0x461ed2[_0x4188e1]);}}}};AGIVertices['prototype'][_0x1e18('0xa8')]=function(_0x341327,_0x46877c){for(var _0x1e1a6b in _0x341327){if(_0x341327[_0x1e18('0xa0')](_0x1e1a6b)){if(_[_0x1e18('0xa5')](_0x341327[_0x1e1a6b])){if(!_[_0x1e18('0x48')](_0x341327[_0x1e1a6b])){this['saveRestApiResult'](_0x341327[_0x1e1a6b],util['format'](_0x1e18('0xa9'),_0x46877c,_0x1e1a6b));}}else if(_[_0x1e18('0xa6')](_0x341327[_0x1e1a6b])){for(var _0x1b0d38=0x0;_0x1b0d38<_0x341327[_0x1e1a6b][_0x1e18('0xa7')];_0x1b0d38++){this[_0x1e18('0xa8')](_0x341327[_0x1e1a6b][_0x1b0d38],util[_0x1e18('0x2b')](_0x1e18('0xa9'),_0x46877c,_0x1e1a6b+'['+_0x1b0d38+']'));}}else{if(!_[_0x1e18('0x45')](_0x341327[_0x1e1a6b])){this[_0x1e18('0xf')][_0x1e18('0xaa')](util[_0x1e18('0x2b')](_0x1e18('0xa9'),_0x46877c,_0x1e1a6b),_0x341327[_0x1e1a6b]);}}}}};AGIVertices[_0x1e18('0x19')]['replaceObjectAllVariables']=function(_0x845a5c){try{var _0xfa8419=JSON[_0x1e18('0x7a')](_0x845a5c);this['recursiveNodeIndex'](_0xfa8419);return JSON['stringify'](_0xfa8419);}catch(_0x31fe71){return this['replaceAllVariables'](_0x845a5c);}};AGIVertices[_0x1e18('0x19')][_0x1e18('0xa3')]=function(_0x333064){var _0x1dd8d7=_0x333064[_0x1e18('0xab')]('{');for(var _0x52f953=0x1;_0x52f953<_0x1dd8d7[_0x1e18('0xa7')];_0x52f953+=0x1){var _0x2071d0=_0x1dd8d7[_0x52f953]['split']('}');if(_0x2071d0[_0x1e18('0xa7')]>0x1){_0x333064=_0x333064[_0x1e18('0xac')]('{'+_0x2071d0[0x0]+'}',this[_0x1e18('0xf')][_0x1e18('0x12')](_0x2071d0[0x0])['extra']||_0x2071d0[0x0]);}}if(_0x1dd8d7[_0x1e18('0xa7')]===0x1){return _0x333064[_0x1e18('0xad')]();}return this[_0x1e18('0xa3')](_0x333064);};AGIVertices[_0x1e18('0x19')]['getAndSetVariable']=function(_0x833d27,_0x23a54b){var _0xfcd573=this[_0x1e18('0xf')]['getVariable'](_0x833d27);if(_0xfcd573['result']===-0x1){return _0xfcd573;}logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0xae'),_0x23a54b,_0xfcd573['extra']));return this[_0x1e18('0xf')][_0x1e18('0xaa')](_0x23a54b,_0xfcd573[_0x1e18('0xaf')]);};AGIVertices[_0x1e18('0x19')][_0x1e18('0x91')]=function(_0x1b90fc){return _0x1b90fc&&_0x1b90fc!=='0'&&_0x1b90fc!=='-1'&&_0x1b90fc!=='';};AGIVertices[_0x1e18('0x19')][_0x1e18('0xb0')]=function(_0x598dcb){this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0x598dcb,'-');_0x598dcb['retry']=_0x598dcb[_0x1e18('0xb0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1e18('0x19')]['mrcpsynth']=function(_0x57b789){logger[_0x1e18('0x31')](util['format'](_0x1e18('0xb2'),_0x57b789[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x57b789['text'])){return this[_0x1e18('0xf')][_0x1e18('0xb3')]('no\x20text\x20configured');}var _0x320a79='\x22'+_0x57b789[_0x1e18('0x68')]+'\x22';if(this[_0x1e18('0x91')](_0x57b789[_0x1e18('0x84')])){_0x320a79+=','+_0x57b789[_0x1e18('0x84')];}var _0x28a19f=this['channel']['exec'](_0x1e18('0xb4'),_0x320a79);if(_0x28a19f['result']===-0x1){return _0x28a19f;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x320a79));};AGIVertices[_0x1e18('0x19')]['mrcprecog']=function(_0xab4354){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0xb5'),_0xab4354[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0xab4354['grammar'])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xb6'));}var _0xf7e7d3=_0xab4354[_0x1e18('0xb7')];if(this[_0x1e18('0x91')](_0xab4354[_0x1e18('0x84')])){_0xf7e7d3+=','+_0xab4354['options'];}var _0x14e2a0=this[_0x1e18('0xf')][_0x1e18('0x63')](_0x1e18('0xb8'),_0xf7e7d3);if(_0x14e2a0[_0x1e18('0xb9')]===-0x1){return _0x14e2a0;}var _0x347035=this[_0x1e18('0xba')](_0x1e18('0xbb'),_0x1e18('0xbc'));if(_0x347035[_0x1e18('0xb9')]===-0x1){return _0x347035;}var _0x1220d3=this[_0x1e18('0xba')](_0x1e18('0xbd'),'MRCP_RECOG_TRANSCRIPT');if(_0x1220d3[_0x1e18('0xb9')]===-0x1){return _0x1220d3;}var _0x581e70=this[_0x1e18('0xba')](_0x1e18('0xbe'),_0x1e18('0xbf'));if(_0x581e70[_0x1e18('0xb9')]===-0x1){return _0x581e70;}return this['channel']['noop'](util['format'](_0x1e18('0xc0'),_0xf7e7d3));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x8')]=function(_0x32b251){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0xc1'),_0x32b251[_0x1e18('0x37')]));return this[_0x1e18('0xf')][_0x1e18('0x8')]([_0x32b251[_0x1e18('0xc2')],_0x32b251[_0x1e18('0xc3')]]);};AGIVertices['prototype'][_0x1e18('0xc4')]=function(_0x45e533){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0xc5'),_0x45e533[_0x1e18('0x37')]));if(this[_0x1e18('0x91')](_0x45e533[_0x1e18('0x72')])){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0xc6'),_0x45e533['timeout']));var _0x557aff=this[_0x1e18('0xf')][_0x1e18('0xc7')](_0x45e533['timeout']);if(_0x557aff[_0x1e18('0xb9')]===-0x1){return _0x557aff;}}return this['channel'][_0x1e18('0xc4')]();};AGIVertices[_0x1e18('0x19')]['callback']=function(_0x50c6a4){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0xc8'),_0x50c6a4[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x50c6a4[_0x1e18('0x4b')])){return this['channel'][_0x1e18('0x2e')](_0x50c6a4,_0x1e18('0xc9'));}_0x50c6a4[_0x1e18('0x4c')]=moment();if(this['isConfigured'](_0x50c6a4['delay'])){_0x50c6a4[_0x1e18('0x4c')]=moment()[_0x1e18('0x56')](_0x50c6a4[_0x1e18('0xca')],'minutes');}if(!this[_0x1e18('0x91')](_0x50c6a4['callback_priority'])){_0x50c6a4[_0x1e18('0x4f')]=0x2;}this['createCmContact']['sync'](this,_0x50c6a4);return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x50c6a4[_0x1e18('0x4a')],_0x50c6a4[_0x1e18('0x4b')],_0x50c6a4[_0x1e18('0x4c')]));};AGIVertices[_0x1e18('0x19')][_0x1e18('0xcb')]=function(_0x45d32a){logger[_0x1e18('0x31')](util['format'](_0x1e18('0xcc'),_0x45d32a['label']));var _0x3c7124=this[_0x1e18('0xf')]['exec'](_0x45d32a['application'],_0x45d32a[_0x1e18('0x84')]);if(_0x3c7124[_0x1e18('0xb9')]===-0x1){return _0x3c7124;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xcd'),_0x45d32a['application'],_0x45d32a[_0x1e18('0x84')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x3c8049){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0xce'),_0x3c8049[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x3c8049[_0x1e18('0x68')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xcf'));}var _0xfa1b62='\x22'+_0x3c8049['text']+'\x22';if(this[_0x1e18('0x91')](_0x3c8049['options'])){_0xfa1b62+=','+_0x3c8049['options'];}var _0x5d6fa0=this[_0x1e18('0xf')]['exec']('MRCPSynth',_0xfa1b62);if(_0x5d6fa0[_0x1e18('0xb9')]===-0x1){return _0x5d6fa0;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xd0'),_0xfa1b62));};AGIVertices['prototype'][_0x1e18('0xd1')]=function(_0x51280a){logger[_0x1e18('0x31')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x51280a[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x51280a[_0x1e18('0x68')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')]('no\x20text\x20configured');}var _0x4f3df2='\x22'+_0x51280a[_0x1e18('0x68')]+'\x22';if(this[_0x1e18('0x91')](_0x51280a['options'])){_0x4f3df2+=','+_0x51280a[_0x1e18('0x84')];}var _0x2466f8=this[_0x1e18('0xf')][_0x1e18('0x63')]('MRCPSynth',_0x4f3df2);if(_0x2466f8[_0x1e18('0xb9')]===-0x1){return _0x2466f8;}return this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4f3df2));};AGIVertices[_0x1e18('0x19')]['lumenvoxasr']=function(_0xfd9af4){logger['info'](util['format'](_0x1e18('0xd2'),_0xfd9af4[_0x1e18('0x37')]));if(!this['isConfigured'](_0xfd9af4['grammar'])){return this[_0x1e18('0xf')]['noop']('no\x20grammar\x20configured');}var _0x29062e=_0xfd9af4[_0x1e18('0xb7')];if(this[_0x1e18('0x91')](_0xfd9af4[_0x1e18('0x84')])){_0x29062e+=','+_0xfd9af4[_0x1e18('0x84')];}var _0x550f31=this[_0x1e18('0xf')]['exec']('MRCPRecog',_0x29062e);if(_0x550f31[_0x1e18('0xb9')]===-0x1){return _0x550f31;}var _0x1456fc=this[_0x1e18('0xba')](_0x1e18('0xbb'),_0x1e18('0xd3'));if(_0x1456fc[_0x1e18('0xb9')]===-0x1){return _0x1456fc;}var _0x517fdf=this[_0x1e18('0xba')](_0x1e18('0xbd'),_0x1e18('0xd4'));if(_0x517fdf['result']===-0x1){return _0x517fdf;}var _0xbbe998=this['getAndSetVariable'](_0x1e18('0xbe'),_0x1e18('0xd5'));if(_0xbbe998['result']===-0x1){return _0xbbe998;}return this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0xc0'),_0x29062e));};AGIVertices[_0x1e18('0x19')]['sestekasr']=function(_0x134c83){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x134c83[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x134c83[_0x1e18('0xb7')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xb6'));}var _0x164fcf=_0x134c83[_0x1e18('0xb7')];if(this[_0x1e18('0x91')](_0x134c83['options'])){_0x164fcf+=','+_0x134c83[_0x1e18('0x84')];}var _0x5aedcc=this['channel'][_0x1e18('0x63')](_0x1e18('0xb8'),_0x164fcf);if(_0x5aedcc['result']===-0x1){return _0x5aedcc;}var _0x4921dd=this[_0x1e18('0xba')](_0x1e18('0xbb'),_0x1e18('0xd6'));if(_0x4921dd[_0x1e18('0xb9')]===-0x1){return _0x4921dd;}var _0x276ff3=this['getAndSetVariable']('RECOG_INPUT()',_0x1e18('0xd7'));if(_0x276ff3[_0x1e18('0xb9')]===-0x1){return _0x276ff3;}var _0x301778=this[_0x1e18('0xba')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x301778[_0x1e18('0xb9')]===-0x1){return _0x301778;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util['format'](_0x1e18('0xc0'),_0x164fcf));};AGIVertices[_0x1e18('0x19')]['database']=function(_0x46625a){logger[_0x1e18('0x31')](util['format'](_0x1e18('0xd8'),_0x46625a[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x46625a[_0x1e18('0xd9')])){return this['channel']['error'](_0x46625a,'no\x20database\x20selected');}var _0x567f11=this[_0x1e18('0x1c')][_0x1e18('0x7d')](this,_0x46625a['odbc_id']);if(!_0x567f11){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x46625a,'no\x20odbc\x20database\x20found');}if(!this[_0x1e18('0x91')](_0x46625a['query'])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x46625a,_0x1e18('0xda'));}var _0x1590ad=_0x46625a[_0x1e18('0x30')][_0x1e18('0x65')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0xdb'),_0x1590ad));var _0x4f6d51=this[_0x1e18('0x2c')][_0x1e18('0x7d')](this,_0x567f11,_0x1590ad);this[_0x1e18('0xb1')]['sync'](this,_0x46625a,_0x1590ad);if(!this[_0x1e18('0x91')](_0x46625a['variable_id'])){return this['channel'][_0x1e18('0xb3')](_0x1e18('0xdc'));}var _0xe7035b=this[_0x1e18('0x12')]['sync'](this,_0x46625a[_0x1e18('0xdd')]);if(!_0xe7035b){return this[_0x1e18('0xf')]['error'](_0x46625a,_0x1e18('0xde'));}var _0x322ab6=this;_0x4f6d51[_0x1e18('0xdf')](function(_0x21a78c,_0x430cdd){Object[_0x1e18('0xe0')](_0x21a78c)[_0x1e18('0xdf')](function(_0x152ead){_0x322ab6[_0x1e18('0xf')]['setVariable'](util[_0x1e18('0x2b')]('%s[%s][%s]',_0xe7035b,_0x430cdd,_0x152ead),_0x21a78c[_0x152ead]);});});this[_0x1e18('0xf')][_0x1e18('0xaa')](util[_0x1e18('0x2b')](_0x1e18('0xe1'),_0xe7035b),_0x4f6d51['length']);return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xe2'),_0xe7035b));};AGIVertices['prototype'][_0x1e18('0xe3')]=function(_0x53c42f){logger['debug'](util[_0x1e18('0x2b')](_0x1e18('0xe4'),_0x53c42f[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x53c42f['sip_id'])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x53c42f,_0x1e18('0xe5'));}var _0x2da286=this['getUser']['sync'](this,_0x53c42f['sip_id']);if(!_0x2da286){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x53c42f,_0x1e18('0xe6'));}var _0x5d008b=this[_0x1e18('0xf')][_0x1e18('0x63')](_0x1e18('0xe7'),[util[_0x1e18('0x2b')](_0x1e18('0xe8'),_0x2da286),_0x53c42f[_0x1e18('0x72')],_0x53c42f[_0x1e18('0xe9')],_0x53c42f[_0x1e18('0x71')]]);if(_0x5d008b[_0x1e18('0xb9')]===-0x1){return _0x5d008b;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xea'),_0x1e18('0xe7')));};AGIVertices[_0x1e18('0x19')]['dialogflow']=function(_0x41b68f){logger[_0x1e18('0x31')](util['format'](_0x1e18('0xeb'),_0x41b68f[_0x1e18('0x37')]));if(!this['isConfigured'](_0x41b68f[_0x1e18('0x86')])){return this[_0x1e18('0xf')]['noop'](_0x1e18('0xec'));}if(!this[_0x1e18('0x91')](_0x41b68f[_0x1e18('0x68')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xcf'));}this['channel'][_0x1e18('0xed')]=!![];this[_0x1e18('0xb1')](_0x41b68f);this[_0x1e18('0x43')](_0x41b68f[_0x1e18('0x68')],'in','','');this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xee'),_0x41b68f[_0x1e18('0x68')]));var _0x2dc15f=this[_0x1e18('0x85')]['sync'](this,_0x41b68f);if(_0x2dc15f){for(var _0x50714b in _0x2dc15f){if(_0x2dc15f[_0x1e18('0xa0')](_0x50714b)){this[_0x1e18('0xf')]['setVariable'](util[_0x1e18('0x2b')](_0x1e18('0xef'),_0x50714b[_0x1e18('0x78')]()),_0x2dc15f[_0x50714b]);}}this[_0x1e18('0x43')](_0x2dc15f[_0x1e18('0xf0')],_0x1e18('0xf1'),_0x1e18('0xf2'),'');return this['channel'][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xf3'),_0x2dc15f[_0x1e18('0xf0')]));}return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x41b68f,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0x1e18('0xf4')]=function(_0x5ca1d8){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0xf5'),_0x5ca1d8[_0x1e18('0x37')]));if(!this['isConfigured'](_0x5ca1d8[_0x1e18('0x88')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x5ca1d8[_0x1e18('0xf6')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xf7'));}if(!this[_0x1e18('0x91')](_0x5ca1d8[_0x1e18('0x89')])){return this['channel'][_0x1e18('0xb3')]('no\x20private_key\x20configured');}if(!this[_0x1e18('0x91')](_0x5ca1d8[_0x1e18('0x8a')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xf8'));}if(!this[_0x1e18('0x91')](_0x5ca1d8[_0x1e18('0x68')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xcf'));}this[_0x1e18('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x5ca1d8);this['createSquareMessage'](_0x5ca1d8['text'],'in','','');this[_0x1e18('0xf')][_0x1e18('0xb3')](util['format'](_0x1e18('0xf9'),_0x5ca1d8[_0x1e18('0x68')]));var _0x4106ef=this['googleDialogflowV2'][_0x1e18('0x7d')](this,_0x5ca1d8);if(_0x4106ef){for(var _0x5e5a0c in _0x4106ef){if(_0x4106ef[_0x1e18('0xa0')](_0x5e5a0c)){if(_0x5e5a0c!==_0x1e18('0xfa')){this[_0x1e18('0xf')][_0x1e18('0xaa')](util[_0x1e18('0x2b')](_0x1e18('0xef'),_0x5e5a0c['toUpperCase']()),_0x4106ef[_0x5e5a0c]);}}}this[_0x1e18('0x43')](_0x4106ef[_0x1e18('0xf0')],_0x1e18('0xf1'),'dialogflowV2',_0x4106ef['providerResponse']);return this[_0x1e18('0xf')]['noop'](util['format'](_0x1e18('0xfb'),_0x4106ef['speech']));}return this[_0x1e18('0xf')]['error'](_0x5ca1d8,_0x1e18('0xfc'));};AGIVertices[_0x1e18('0x19')][_0x1e18('0xfd')]=function(_0x96ccfd){logger[_0x1e18('0x31')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x96ccfd[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x96ccfd[_0x1e18('0xfe')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xff'));}if(!this['isConfigured'](_0x96ccfd[_0x1e18('0x100')])){return this['channel']['noop'](_0x1e18('0x101'));}if(!this['isConfigured'](_0x96ccfd[_0x1e18('0x102')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0x103'));}if(!this[_0x1e18('0x91')](_0x96ccfd[_0x1e18('0x104')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xcf'));}this[_0x1e18('0xf')][_0x1e18('0xed')]=!![];this[_0x1e18('0xb1')](_0x96ccfd);this['createSquareMessage'](_0x96ccfd[_0x1e18('0x68')],'in','','');this[_0x1e18('0xf')]['noop'](util['format'](_0x1e18('0x105'),_0x96ccfd[_0x1e18('0x68')]));var _0x2a7f0b=this['sestekNDA'][_0x1e18('0x7d')](this,_0x96ccfd);if(_0x2a7f0b){for(var _0x2c9016 in _0x2a7f0b){if(_0x2a7f0b[_0x1e18('0xa0')](_0x2c9016)){this[_0x1e18('0xf')][_0x1e18('0xaa')](util[_0x1e18('0x2b')](_0x1e18('0x106'),_0x2c9016[_0x1e18('0x78')]()),_0x2a7f0b[_0x2c9016]);}}this[_0x1e18('0x43')](_0x2a7f0b[_0x1e18('0xf0')],_0x1e18('0xf1'),_0x1e18('0xfd'),'');if(_0x2a7f0b[_0x1e18('0x107')]){this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x108'),_0x2a7f0b['audiofile']));var _0x582918=this[_0x1e18('0xf')][_0x1e18('0x109')](_0x2a7f0b[_0x1e18('0x107')]);try{fs[_0x1e18('0x10a')](_0x2a7f0b[_0x1e18('0x107')]+_0x1e18('0x10b'));}catch(_0x60db7e){logger['error'](_0x60db7e);}return _0x582918;}else{return this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x10c'),_0x2a7f0b['speech']));}}return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x96ccfd,_0x1e18('0x10d'));};AGIVertices[_0x1e18('0x19')]['end']=function(_0x52df08){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x10e'),_0x52df08[_0x1e18('0x37')]));return this['channel'][_0x1e18('0xb3')](_0x1e18('0x10f'));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x110')]=function(_0x5302f8){logger[_0x1e18('0x31')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5302f8[_0x1e18('0x37')]));var _0x3de49d='';if(_0x5302f8[_0x1e18('0x111')]){if(!this['isConfigured'](_0x5302f8[_0x1e18('0x111')])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x5302f8,_0x1e18('0x112'));}else{var _0x1f3ce2=parseInt(_0x5302f8['trunk_id'],0xa);if(isNaN(_0x1f3ce2)){_0x3de49d=_0x5302f8['trunk_id'];}else{_0x3de49d=this['getTrunk'][_0x1e18('0x7d')](this,_0x5302f8[_0x1e18('0x111')]);if(!_0x3de49d){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x5302f8,_0x1e18('0x113'));}}}}else if(_0x5302f8[_0x1e18('0x114')]){_0x3de49d=_0x5302f8['trunk_name'];}else{return this['channel'][_0x1e18('0x2e')](_0x5302f8,_0x1e18('0x112'));}var _0x1128ee=this[_0x1e18('0xf')][_0x1e18('0x63')](_0x1e18('0xe7'),[util['format'](_0x1e18('0x115'),_0x3de49d,_0x5302f8[_0x1e18('0x4a')]),_0x5302f8[_0x1e18('0x72')],_0x5302f8[_0x1e18('0xe9')],_0x5302f8['url']]);if(_0x1128ee[_0x1e18('0xb9')]===-0x1){return _0x1128ee;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xea'),_0x1e18('0xe7')));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x116')]=function(_0x46ec22){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x117'),_0x46ec22[_0x1e18('0x37')]));return this['channel'][_0x1e18('0xb3')]('finally');};AGIVertices[_0x1e18('0x19')][_0x1e18('0xe')]=function(_0x57cb21){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x118'),_0x57cb21[_0x1e18('0x37')]));if(_0x57cb21['retry']===0x0){return this[_0x1e18('0xb0')](_0x57cb21);}_0x57cb21[_0x1e18('0x119')]-=0x1;if(!this[_0x1e18('0x91')](_0x57cb21['file_id'])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x57cb21,'no\x20file\x20audio\x20selected');}var _0x49d7d6=this[_0x1e18('0x21')][_0x1e18('0x7d')](this,_0x57cb21['file_id']);if(!_0x49d7d6){return this[_0x1e18('0xf')]['error'](_0x57cb21,_0x1e18('0x11a'));}if(!this[_0x1e18('0x91')](_0x57cb21[_0x1e18('0xdd')])){return this[_0x1e18('0xf')]['error'](_0x1e18('0xdc'));}var _0x28b22b=this[_0x1e18('0xf')]['getData'](_0x49d7d6,_0x57cb21[_0x1e18('0x11b')],_0x57cb21['maxdigit']);var _0x3145e1=_0x28b22b[_0x1e18('0xb9')]?_0x28b22b[_0x1e18('0xb9')][_0x1e18('0xad')]():'';logger['info'](_0x1e18('0x11c'),JSON[_0x1e18('0x80')](_0x28b22b));if(_0x28b22b[_0x1e18('0xb9')]===-0x1){this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0x57cb21,_0x3145e1);return _0x28b22b;}else if(_0x28b22b['extra']===_0x1e18('0x72')){_0x28b22b[_0x1e18('0xb9')]=_0x3145e1[_0x1e18('0xa7')]>=parseInt(_0x57cb21[_0x1e18('0x11d')])?'x':'i';}else{_0x28b22b['result']=_0x3145e1['length']>=parseInt(_0x57cb21[_0x1e18('0x11d')])&&_0x3145e1[_0x1e18('0xa7')]<=parseInt(_0x57cb21[_0x1e18('0x11e')])?'x':'i';}var _0x12d39a=this['getVariable']['sync'](this,_0x57cb21[_0x1e18('0xdd')]);if(!_0x12d39a){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x57cb21,_0x1e18('0xde'));}this['channel'][_0x1e18('0xaa')](_0x12d39a,_0x3145e1);if(this['isConfigured'](_0x57cb21['hiddendigitsnum'])){var _0x3f88a1=parseInt(_0x57cb21[_0x1e18('0x11f')],0xa);var _0xad69ff=rs[_0x1e18('0x120')]({'charset':'*','length':_0x3f88a1});var _0x59981c=_0x3145e1[_0x1e18('0xa7')];if(_0x59981c>0x0){if(_0x59981c>_0x3f88a1){this[_0x1e18('0xb1')]['sync'](this,_0x57cb21,_0x57cb21[_0x1e18('0x121')]===_0x1e18('0x122')?_0xad69ff+_0x3145e1[_0x1e18('0x123')](_0x3f88a1):_0x3145e1['substr'](0x0,_0x59981c-_0x3f88a1)+_0xad69ff);}else{this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0x57cb21,rs[_0x1e18('0x120')]({'charset':'*','length':_0x59981c}));}}else{this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0x57cb21,'');}}else{this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0x57cb21,_0x3145e1);}return _0x28b22b;};AGIVertices[_0x1e18('0x19')]['getsecretdigits']=function(_0x4beb6f){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x124'),_0x4beb6f['label']));return this[_0x1e18('0xe')](_0x4beb6f);};AGIVertices[_0x1e18('0x19')][_0x1e18('0x125')]=function(_0x256f3f){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x256f3f['label']));this[_0x1e18('0xb1')]['sync'](this,_0x256f3f,_0x256f3f[_0x1e18('0x126')]);return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x127'),_0x256f3f[_0x1e18('0x126')]));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x128')]=function(_0x1bbb38){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x1bbb38[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x1bbb38['aws_access_key_id'])||!this[_0x1e18('0x91')](_0x1bbb38[_0x1e18('0x94')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0x129'));}if(!this['isConfigured'](_0x1bbb38[_0x1e18('0x68')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xcf'));}this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x12a'),_0x1bbb38[_0x1e18('0x68')]));var _0x19ae6a=this[_0x1e18('0x93')]['sync'](this,_0x1bbb38);if(_0x19ae6a){this[_0x1e18('0xf')]['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x19ae6a));var _0x85fed6=this['channel'][_0x1e18('0x109')](_0x19ae6a);try{fs[_0x1e18('0x10a')](_0x19ae6a+_0x1e18('0x10b'));}catch(_0x325b2a){logger['error'](_0x325b2a);}return _0x85fed6;}return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x1bbb38,_0x1e18('0x12b'));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x12c')]=function(_0x596a1b){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x12d'),_0x596a1b[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x596a1b['aws_access_key_id'])||!this['isConfigured'](_0x596a1b[_0x1e18('0x94')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0x129'));}if(!this[_0x1e18('0x91')](_0x596a1b['aws_bot_name'])){return this[_0x1e18('0xf')]['noop'](_0x1e18('0x12e'));}if(!this[_0x1e18('0x91')](_0x596a1b[_0x1e18('0x68')])){return this['channel'][_0x1e18('0xb3')](_0x1e18('0xcf'));}this[_0x1e18('0xf')][_0x1e18('0xed')]=!![];this[_0x1e18('0xb1')](_0x596a1b);this[_0x1e18('0x43')](_0x596a1b[_0x1e18('0x68')],'in','','');this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x596a1b[_0x1e18('0x68')]));var _0x2e1613=this[_0x1e18('0x12f')][_0x1e18('0x7d')](this,_0x596a1b);if(_0x2e1613){for(var _0x4ba9fd in _0x2e1613){if(_0x2e1613[_0x1e18('0xa0')](_0x4ba9fd)&&_['isString'](_0x2e1613[_0x4ba9fd])){this['channel'][_0x1e18('0xaa')](util['format']('AWS_LEX_%s',_0x4ba9fd[_0x1e18('0x78')]()),_0x2e1613[_0x4ba9fd]);}}if(_[_0x1e18('0x45')](_0x2e1613[_0x1e18('0x130')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x1e18('0x43')](_0x2e1613['message'],_0x1e18('0xf1'),'amazonlex','');return this['channel'][_0x1e18('0xb3')](util['format'](_0x1e18('0x131'),_0x2e1613[_0x1e18('0x130')]));}}return this['channel'][_0x1e18('0x2e')](_0x596a1b,_0x1e18('0x132'));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x133')]=function(_0x5c45ef){logger[_0x1e18('0x31')](util['format'](_0x1e18('0x134'),_0x5c45ef[_0x1e18('0x37')],_0x5c45ef['timeout']));if(!this[_0x1e18('0x91')](_0x5c45ef[_0x1e18('0x86')])){return this['channel']['noop'](_0x1e18('0xec'));}var _0x315318=_0x1e18('0x135');var _0x44486a=util[_0x1e18('0x2b')](_0x1e18('0x136'),FILES_PATH,rs[_0x1e18('0x120')](0x4));var _0x7f7049=util[_0x1e18('0x2b')](_0x1e18('0xa9'),_0x44486a,_0x315318);var _0x380027=!![];if(_0x5c45ef[_0x1e18('0x137')]===_0x1e18('0x138')){_0x380027=![];}var _0x3a6773=this[_0x1e18('0xf')][_0x1e18('0x139')](_0x44486a,_0x315318,_0x5c45ef[_0x1e18('0x13a')],_0x5c45ef[_0x1e18('0x72')],undefined,_0x380027);if(_0x3a6773[_0x1e18('0xb9')]!==-0x1){this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x13b'),_0x7f7049));var _0x3be594=this['googleASR'][_0x1e18('0x7d')](this,_0x5c45ef,_0x7f7049);if(_0x3be594){for(var _0x111fab in _0x3be594){if(_0x3be594[_0x1e18('0xa0')](_0x111fab)){this['channel'][_0x1e18('0xaa')](util[_0x1e18('0x2b')](_0x1e18('0x13c'),_0x111fab['toUpperCase']()),_0x3be594[_0x111fab]);}}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x13d'),JSON[_0x1e18('0x80')](_0x3be594)));}}return _0x3a6773;};AGIVertices['prototype'][_0x1e18('0x13e')]=function(_0x273b88){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x13f'),_0x273b88[_0x1e18('0x37')]));if(!this['isConfigured'](_0x273b88[_0x1e18('0x9c')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0x140'));}if(!this[_0x1e18('0x91')](_0x273b88[_0x1e18('0x9d')])){return this['channel'][_0x1e18('0xb3')](_0x1e18('0x141'));}var _0x104164=_0x1e18('0x135');var _0x1398af=util[_0x1e18('0x2b')](_0x1e18('0x136'),FILES_PATH,rs[_0x1e18('0x120')](0x4));var _0x456efd=util[_0x1e18('0x2b')](_0x1e18('0xa9'),_0x1398af,_0x104164);var _0x1be1de=!![];if(_0x273b88['beep']==='NOBEEP'){_0x1be1de=![];}var _0x29d4d2=this[_0x1e18('0xf')][_0x1e18('0x139')](_0x1398af,_0x104164,_0x273b88['intKey'],_0x273b88[_0x1e18('0x72')],undefined,_0x1be1de);if(_0x29d4d2[_0x1e18('0xb9')]!==-0x1){this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')]('tilde\x20%s\x20file\x20created',_0x456efd));var _0x3c9c15=this[_0x1e18('0x9b')][_0x1e18('0x7d')](this,_0x273b88,_0x456efd);if(_0x3c9c15){for(var _0x2b84fd in _0x3c9c15){if(_0x3c9c15[_0x1e18('0xa0')](_0x2b84fd)){this['channel'][_0x1e18('0xaa')](util[_0x1e18('0x2b')]('TILDE_ASR_%s',_0x2b84fd['toUpperCase']()),_0x3c9c15[_0x2b84fd]);}}return this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x3c9c15)));}}return _0x29d4d2;};AGIVertices[_0x1e18('0x19')][_0x1e18('0x142')]=function(_0x47d65a){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x143'),_0x47d65a[_0x1e18('0x37')]));return this[_0x1e18('0xf')][_0x1e18('0x144')](_0x47d65a['context'],_0x47d65a[_0x1e18('0x145')],_0x47d65a[_0x1e18('0x3f')]);};AGIVertices[_0x1e18('0x19')][_0x1e18('0x146')]=function(_0x407c85){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x147'),_0x407c85['label']));if(!this[_0x1e18('0x91')](_0x407c85[_0x1e18('0x148')])){return this['channel']['error'](_0x407c85,_0x1e18('0x149'));}try{var _0xe34197=eval(_0x407c85['condition'])?_0x1e18('0x14a'):_0x1e18('0x14b');this['channel'][_0x1e18('0xb3')](util['format'](_0x1e18('0x14c'),_0x407c85[_0x1e18('0x148')],_0xe34197));return{'code':0xc8,'result':_0xe34197};}catch(_0x42affb){return{'code':0xc8,'result':_0x1e18('0x14b')};}};AGIVertices[_0x1e18('0x19')][_0x1e18('0x14d')]=function(_0x4e17d3){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x14e'),_0x4e17d3['label']));if(!this[_0x1e18('0x91')](_0x4e17d3[_0x1e18('0x14f')])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x4e17d3,_0x1e18('0x150'));}var _0x5cd318=this[_0x1e18('0x151')][_0x1e18('0x7d')](this,_0x4e17d3['interval_id']);if(!_0x5cd318){return this['channel'][_0x1e18('0x2e')](_0x4e17d3,_0x1e18('0x152'));}for(var _0x40b836=0x0;_0x40b836<_0x5cd318[_0x1e18('0xa7')];_0x40b836+=0x1){var _0x3d8433=this[_0x1e18('0xf')][_0x1e18('0x12')](util['format'](_0x1e18('0x153'),_0x5cd318[_0x40b836]));if(_0x3d8433[_0x1e18('0xb9')]===-0x1){return _0x3d8433;}logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x154'),_0x5cd318[_0x40b836],_0x3d8433['extra']));if(_0x3d8433['extra']===_0x1e18('0x14a')){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x154'),_0x5cd318[_0x40b836],_0x1e18('0x14a')));this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x154'),_0x5cd318[_0x40b836],_0x1e18('0x14a')));return{'code':0xc8,'result':_0x1e18('0x14a')};}else{logger[_0x1e18('0x31')](util['format']('IFTIME\x20%s\x20%s',_0x5cd318[_0x40b836],'false'));this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x154'),_0x5cd318[_0x40b836],_0x1e18('0x14b')));}}return{'code':0xc8,'result':_0x1e18('0x14b')};};AGIVertices[_0x1e18('0x19')][_0x1e18('0x155')]=function(_0x3d0ae7){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x156'),_0x3d0ae7[_0x1e18('0x37')]));return this[_0x1e18('0xf')][_0x1e18('0x155')]();};AGIVertices['prototype'][_0x1e18('0x157')]=function(_0x43d321){logger[_0x1e18('0x31')](util['format'](_0x1e18('0x158'),_0x43d321[_0x1e18('0x37')]));if(!this['isConfigured'](_0x43d321['key'])){return this[_0x1e18('0xf')][_0x1e18('0xb3')]('no\x20key\x20configured');}var _0x2e43be='wav';var _0x3584c8=util[_0x1e18('0x2b')](_0x1e18('0x136'),FILES_PATH,rs[_0x1e18('0x120')](0x4));var _0x546098=util[_0x1e18('0x2b')](_0x1e18('0xa9'),_0x3584c8,_0x2e43be);var _0x168717=!![];if(_0x43d321[_0x1e18('0x137')]==='NOBEEP'){_0x168717=![];}var _0x270788=this[_0x1e18('0xf')][_0x1e18('0x139')](_0x3584c8,_0x2e43be,_0x43d321[_0x1e18('0x13a')],_0x43d321['timeout'],undefined,_0x168717);if(_0x270788[_0x1e18('0xb9')]!==-0x1){this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x159'),_0x546098));var _0x4222a3=this['ispeechASR'][_0x1e18('0x7d')](this,_0x43d321,_0x546098);if(_0x4222a3){for(var _0x129a66 in _0x4222a3){if(_0x4222a3[_0x1e18('0xa0')](_0x129a66)){this['channel'][_0x1e18('0xaa')](util[_0x1e18('0x2b')]('ISPEECH_ASR_%s',_0x129a66[_0x1e18('0x78')]()),_0x4222a3[_0x129a66]);}}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util['format'](_0x1e18('0x15a'),JSON['stringify'](_0x4222a3)));}}return _0x270788;};AGIVertices[_0x1e18('0x19')]['ispeechtts']=function(_0x5476e2){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x15b'),_0x5476e2[_0x1e18('0x37')]));if(!this['isConfigured'](_0x5476e2[_0x1e18('0x86')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xec'));}if(!this[_0x1e18('0x91')](_0x5476e2[_0x1e18('0x68')])){return this['channel'][_0x1e18('0xb3')](_0x1e18('0xcf'));}this[_0x1e18('0xf')][_0x1e18('0xb3')](util['format'](_0x1e18('0x15c'),_0x5476e2['text']));var _0x32435e=this['ispeechTTS'][_0x1e18('0x7d')](this,_0x5476e2);if(_0x32435e){this[_0x1e18('0xf')][_0x1e18('0xb3')](util['format']('ispeech\x20%s\x20file\x20created',_0x32435e));var _0x4e0689=this[_0x1e18('0xf')][_0x1e18('0x109')](_0x32435e,_0x5476e2[_0x1e18('0x13a')]);try{fs[_0x1e18('0x10a')](_0x32435e+_0x1e18('0x10b'));}catch(_0xa2df92){logger['error'](_0xa2df92);}return _0x4e0689;}return this[_0x1e18('0xf')]['error'](_0x5476e2,_0x1e18('0x15d'));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x15e')]=function(_0x46f39c){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x15f'),_0x46f39c[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x46f39c[_0x1e18('0x160')])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x46f39c,_0x1e18('0x161'));}logger['info'](util[_0x1e18('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x46f39c['findBy']));var _0x1362bc=this[_0x1e18('0x5e')][_0x1e18('0x7d')](this,_0x46f39c['findBy']);if(_0x1362bc){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x162'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x46f39c[_0x1e18('0x160')]));this['channel'][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x162'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x46f39c['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x163'),this['channel']['callerid'],_0x46f39c['findBy']));this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x163'),this[_0x1e18('0xf')]['callerid'],_0x46f39c[_0x1e18('0x160')]));return{'code':0xc8,'result':_0x1e18('0x164')};}};AGIVertices['prototype'][_0x1e18('0x165')]=function(_0x4c44d6){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x166'),_0x4c44d6[_0x1e18('0x37')]));if(!this['isConfigured'](_0x4c44d6[_0x1e18('0x160')])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x4c44d6,_0x1e18('0x161'));}logger['info'](util['format'](_0x1e18('0x167'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4c44d6['findBy']));var _0x171bfb=this[_0x1e18('0x5c')]['sync'](this,_0x4c44d6[_0x1e18('0x160')]);if(_0x171bfb){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x162'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4c44d6['findBy']));this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x162'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4c44d6[_0x1e18('0x160')]));return{'code':0xc8,'result':_0x1e18('0x168')};}else{logger[_0x1e18('0x31')](util['format'](_0x1e18('0x163'),this['channel'][_0x1e18('0x3c')],_0x4c44d6[_0x1e18('0x160')]));this['channel'][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x163'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4c44d6[_0x1e18('0x160')]));return{'code':0xc8,'result':_0x1e18('0x164')};}};AGIVertices[_0x1e18('0x19')][_0x1e18('0x169')]=function(_0x4a17ec){logger['info'](util[_0x1e18('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4a17ec[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x4a17ec['operation'])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x4a17ec,'no\x20operation\x20configured');}this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')]('math\x20%s',_0x4a17ec[_0x1e18('0x16a')]));var _0x565d38=eval(_0x4a17ec[_0x1e18('0x16a')]);if(!this['isConfigured'](_0x4a17ec[_0x1e18('0xdd')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xdc'));}var _0x209fe1=this[_0x1e18('0x12')]['sync'](this,_0x4a17ec['variable_id']);if(!_0x209fe1){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x4a17ec,_0x1e18('0xde'));}if(_[_0x1e18('0xa6')](_0x565d38)){var _0x13b2d7=this;_0x565d38[_0x1e18('0xdf')](function(_0x1167ee,_0x55b388){_0x13b2d7[_0x1e18('0xf')][_0x1e18('0xaa')](util[_0x1e18('0x2b')](_0x1e18('0x16b'),_0x209fe1,_0x55b388),_0x1167ee);});return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x16c'),_0x209fe1));}else{return this[_0x1e18('0xf')]['setVariable'](_0x209fe1,_0x565d38);}};AGIVertices['prototype'][_0x1e18('0xd')]=function(_0x8a0322){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x16d'),_0x8a0322[_0x1e18('0x37')]));if(_0x8a0322[_0x1e18('0x119')]===0x0){return this[_0x1e18('0xb0')](_0x8a0322);}_0x8a0322[_0x1e18('0x119')]-=0x1;if(!this[_0x1e18('0x91')](_0x8a0322['file_id'])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x8a0322,_0x1e18('0x16e'));}var _0x37e1f4=this[_0x1e18('0x21')]['sync'](this,_0x8a0322[_0x1e18('0x16f')]);if(!_0x37e1f4){return this[_0x1e18('0xf')]['error'](_0x8a0322,_0x1e18('0x11a'));}var _0x133243=this[_0x1e18('0xf')][_0x1e18('0x170')](_0x37e1f4,_0x8a0322[_0x1e18('0x11b')],_0x8a0322[_0x1e18('0x171')]);var _0x1aa78c=_0x133243[_0x1e18('0xb9')];if(_0x133243['result']===-0x1){this[_0x1e18('0xb1')]['sync'](this,_0x8a0322,'-1');return _0x133243;}else if(_0x133243[_0x1e18('0xaf')]===_0x1e18('0x72')){_0x133243[_0x1e18('0xb9')]=_0x133243[_0x1e18('0xb9')][_0x1e18('0xa7')]>0x0?_0x133243[_0x1e18('0xb9')]:'t';}else if(_[_0x1e18('0x48')](_0x133243[_0x1e18('0xb9')])){_0x133243['result']='#';_0x1aa78c='#';}if(!this['isConfigured'](_0x8a0322[_0x1e18('0xdd')])){this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0xdc'));}else{var _0x39ab4e=this['getVariable'][_0x1e18('0x7d')](this,_0x8a0322[_0x1e18('0xdd')]);if(!_0x39ab4e){return this['channel'][_0x1e18('0x2e')](_0x8a0322,_0x1e18('0xde'));}this[_0x1e18('0xf')][_0x1e18('0xaa')](_0x39ab4e,_0x1aa78c);}this['createSquareDetailsReport']['sync'](this,_0x8a0322,_0x1aa78c);return _0x133243;};AGIVertices[_0x1e18('0x19')][_0x1e18('0xb3')]=function(_0x387f1b){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x172'),_0x387f1b[_0x1e18('0x37')]));return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x387f1b[_0x1e18('0x173')]||_0x387f1b[_0x1e18('0x37')]);};AGIVertices[_0x1e18('0x19')][_0x1e18('0x174')]=function(_0x1bb346){logger['info'](util['format'](_0x1e18('0x175'),_0x1bb346[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x1bb346[_0x1e18('0x160')])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x1bb346,'no\x20find\x20by\x20configured');}logger['info'](util[_0x1e18('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x1e18('0x3c')],_0x1bb346[_0x1e18('0x160')]));var _0x1c5c09=this['getPause']['sync'](this,_0x1bb346['pause_id']);var _0xd6fab=this[_0x1e18('0x5a')][_0x1e18('0x7d')](this,_0x1bb346['findBy'],_0x1c5c09);if(_0xd6fab){logger[_0x1e18('0x31')](util['format'](_0x1e18('0x162'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x1bb346['findBy']));this['channel']['noop'](util[_0x1e18('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x1bb346['findBy']));return{'code':0xc8,'result':_0x1e18('0x168')};}else{logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x163'),this[_0x1e18('0xf')]['callerid'],_0x1bb346[_0x1e18('0x160')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1e18('0x3c')],_0x1bb346[_0x1e18('0x160')]));return{'code':0xc8,'result':_0x1e18('0x164')};}};AGIVertices[_0x1e18('0x19')]['playback']=function(_0x13fc37){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x13fc37['label']));if(!this[_0x1e18('0x91')](_0x13fc37[_0x1e18('0x16f')])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x13fc37,'no\x20file\x20audio\x20selected');}var _0xf2ffb2=this[_0x1e18('0x21')][_0x1e18('0x7d')](this,_0x13fc37[_0x1e18('0x16f')]);if(!_0xf2ffb2){return this[_0x1e18('0xf')]['error'](_0x13fc37,_0x1e18('0x11a'));}var _0x3ac6e3=this[_0x1e18('0xf')]['exec'](_0x1e18('0x176'),[_0xf2ffb2,_0x13fc37[_0x1e18('0xe9')]]);if(_0x3ac6e3['result']===-0x1){return _0x3ac6e3;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xcd'),_0x1e18('0x176'),_0xf2ffb2));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x177')]=function(_0x3617d0){logger[_0x1e18('0x31')](util['format'](_0x1e18('0x178'),_0x3617d0['label']));if(!this[_0x1e18('0x91')](_0x3617d0[_0x1e18('0x179')])){return this[_0x1e18('0xf')]['error'](_0x3617d0,_0x1e18('0x17a'));}var _0x350294='';var _0x58f4d3=parseInt(_0x3617d0[_0x1e18('0x179')],0xa);if(isNaN(_0x58f4d3)){_0x350294=_0x3617d0[_0x1e18('0x179')];}else{_0x350294=this[_0x1e18('0x16')][_0x1e18('0x7d')](this,_0x3617d0[_0x1e18('0x179')]);if(!_0x350294){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x3617d0,_0x1e18('0x17b'));}}var _0x3a4825='';if(this[_0x1e18('0x91')](_0x3617d0[_0x1e18('0x16f')])){var _0x468663=this[_0x1e18('0x21')][_0x1e18('0x7d')](this,_0x3617d0[_0x1e18('0x16f')]);if(_0x468663){_0x3a4825=_0x468663;}}this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0x3617d0,_0x350294);if(_0x3617d0['opts'][_0x1e18('0x17c')]('x')<0x0){_0x3617d0[_0x1e18('0xe9')]+='x';}if(_0x3617d0['opts'][_0x1e18('0x17c')]('X')<0x0){_0x3617d0['opts']+='X';}this[_0x1e18('0xf')][_0x1e18('0xaa')](_0x1e18('0x17d'),_0x350294?_0x350294[_0x1e18('0x17e')]():'');var _0x2cb3d8=this[_0x1e18('0xf')][_0x1e18('0x63')](_0x1e18('0x17f'),[_0x350294,_0x3617d0[_0x1e18('0xe9')],_0x3617d0[_0x1e18('0x71')],_0x3a4825,_0x3617d0[_0x1e18('0x72')],_0x3617d0['agi'],_0x3617d0[_0x1e18('0x180')],_0x3617d0[_0x1e18('0x181')],'',_0x3617d0['position']]);if(_0x2cb3d8[_0x1e18('0xb9')]===-0x1){return _0x2cb3d8;}return this[_0x1e18('0xf')]['noop'](util['format'](_0x1e18('0xcd'),_0x1e18('0x17f'),_0x350294));};AGIVertices[_0x1e18('0x19')]['record']=function(_0x1870b0){logger['info'](util[_0x1e18('0x2b')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1870b0[_0x1e18('0x37')]));var _0x3826c1=_0x1870b0[_0x1e18('0x182')]||_0x1e18('0x135');var _0xc1b1ba=util[_0x1e18('0x2b')]('%s_%s',this[_0x1e18('0xf')][_0x1e18('0x3b')],rs[_0x1e18('0x120')](0x5));var _0x5e1c6a=util[_0x1e18('0x2b')](_0x1e18('0x183'),FILES_PATH,_0xc1b1ba,_0x3826c1);var _0x2bf9c6=util[_0x1e18('0x2b')]('%s/recordings/%s',FILES_PATH,_0xc1b1ba);this[_0x1e18('0x3a')][_0x1e18('0x7d')](this,_0x1870b0,_0xc1b1ba,_0x5e1c6a);this[_0x1e18('0xf')]['setVariable']('RECORDING_SAVENAME',_0xc1b1ba);logger[_0x1e18('0x31')](_0x1e18('0x184'),_0x2bf9c6,_0x3826c1,_0x1870b0[_0x1e18('0x185')],_0x1870b0[_0x1e18('0x72')]);return this[_0x1e18('0xf')][_0x1e18('0x139')](_0x2bf9c6,_0x3826c1,_0x1870b0[_0x1e18('0x185')],_0x1870b0[_0x1e18('0x72')],undefined,!![]);};AGIVertices[_0x1e18('0x19')][_0x1e18('0x186')]=function(_0x251ef1){logger['info'](util[_0x1e18('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x251ef1[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x251ef1[_0x1e18('0x71')])){return this[_0x1e18('0xf')]['noop'](_0x1e18('0x187'));}var _0x4ce297=this[_0x1e18('0x70')][_0x1e18('0x7d')](this,_0x251ef1);logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x188'),util[_0x1e18('0x189')](_0x4ce297,{'showHidden':![],'depth':null})));if(!this[_0x1e18('0x91')](_0x251ef1[_0x1e18('0xdd')])){return this[_0x1e18('0xf')][_0x1e18('0xb3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x401212=this[_0x1e18('0x12')][_0x1e18('0x7d')](this,_0x251ef1[_0x1e18('0xdd')]);if(!_0x401212){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x251ef1,_0x1e18('0xde'));}this[_0x1e18('0xf')][_0x1e18('0xaa')](util[_0x1e18('0x2b')](_0x1e18('0x18a'),_0x401212),_0x4ce297[_0x1e18('0x82')]?_0x4ce297[_0x1e18('0x82')]:_0x1e18('0x18b'));this['channel'][_0x1e18('0xaa')](util['format'](_0x1e18('0x18c'),_0x401212),_0x4ce297[_0x1e18('0x18d')]?_0x4ce297[_0x1e18('0x18d')]:'OK');if(_0x4ce297['body']){try{this['saveRestApiResult'](_0x4ce297['body'],_0x401212);}catch(_0x1e3c3b){logger[_0x1e18('0x2e')](util[_0x1e18('0x2b')](_0x1e18('0x18e'),_0x401212));}}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xe2'),_0x401212));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x18f')]=function(_0x21fbd8){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x21fbd8[_0x1e18('0x37')]));return this[_0x1e18('0xf')][_0x1e18('0x190')](_0x21fbd8['digits'][_0x1e18('0x65')](/\s+/g,''),_0x21fbd8[_0x1e18('0x185')]);};AGIVertices[_0x1e18('0x19')][_0x1e18('0x191')]=function(_0x790f8f){logger['info'](util['format'](_0x1e18('0x192'),_0x790f8f[_0x1e18('0x37')]));return this['channel'][_0x1e18('0x193')](_0x790f8f['number'][_0x1e18('0x65')](/\s+/g,''),_0x790f8f[_0x1e18('0x185')]);};AGIVertices['prototype']['sayphonetic']=function(_0x4cfcec){logger['info'](util['format'](_0x1e18('0x194'),_0x4cfcec[_0x1e18('0x37')]));return this[_0x1e18('0xf')][_0x1e18('0x195')](_0x4cfcec[_0x1e18('0x68')],_0x4cfcec[_0x1e18('0x185')]);};AGIVertices[_0x1e18('0x19')]['sendMail']=function(_0x5cdb30){logger[_0x1e18('0x31')](util['format'](_0x1e18('0x196'),_0x5cdb30['label']));if(!this[_0x1e18('0x91')](_0x5cdb30['account_id'])){return this['channel'][_0x1e18('0xb3')](_0x1e18('0x197'));}var _0x3e65b4=this['getMailAccount']['sync'](this,_0x5cdb30[_0x1e18('0x198')]);if(!_0x3e65b4||!_0x3e65b4[_0x1e18('0x199')]){return this[_0x1e18('0xf')]['error'](_0x5cdb30,_0x1e18('0x19a'));}var _0x2a1006={'from':util[_0x1e18('0x2b')](_0x1e18('0x19b'),_0x3e65b4[_0x1e18('0x15')],_0x3e65b4[_0x1e18('0x19c')]||_0x3e65b4[_0x1e18('0x199')][_0x1e18('0x19d')]),'to':_0x5cdb30['to']||'','cc':_0x5cdb30['cc']||'','bcc':_0x5cdb30[_0x1e18('0x19e')]||'','subject':_0x5cdb30[_0x1e18('0x19f')],'html':_0x5cdb30[_0x1e18('0x68')],'text':_0x5cdb30[_0x1e18('0x68')]};var _0x281915={'tls':{'rejectUnauthorized':![]}};if(_0x3e65b4[_0x1e18('0x199')][_0x1e18('0x1a0')]){_0x281915[_0x1e18('0x1a0')]=_0x3e65b4[_0x1e18('0x199')][_0x1e18('0x1a0')];}else{_0x281915[_0x1e18('0x1a1')]=_0x3e65b4[_0x1e18('0x199')]['host'];_0x281915[_0x1e18('0x1a2')]=_0x3e65b4['Smtp'][_0x1e18('0x1a2')];_0x281915['secure']=_0x3e65b4[_0x1e18('0x199')]['secure'];}if(_0x3e65b4[_0x1e18('0x199')][_0x1e18('0x1a3')]){_0x281915[_0x1e18('0x1a4')]={'user':_0x3e65b4['Smtp'][_0x1e18('0x19d')],'pass':_0x3e65b4[_0x1e18('0x199')]['pass']};}if(this[_0x1e18('0x91')](_0x5cdb30['template_id'])){}logger[_0x1e18('0x1a5')](_0x1e18('0x1a6'),JSON[_0x1e18('0x80')](_0x2a1006));this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0x5cdb30,_0x5cdb30[_0x1e18('0x198')]);this['channel'][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x1a7'),_0x3e65b4[_0x1e18('0x15')]));this[_0x1e18('0x26')][_0x1e18('0x7d')](this,_0x281915,_0x2a1006);return this['channel'][_0x1e18('0xb3')](_0x1e18('0x1a8'));};AGIVertices[_0x1e18('0x19')]['sendFax']=function(_0x2e3863){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x1a9'),_0x2e3863[_0x1e18('0x37')]));return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0x1aa'));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1ab')]=function(_0x4e2edf){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x1ac'),_0x4e2edf[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x4e2edf['sms_account_id'])){return this['channel'][_0x1e18('0xb3')](_0x1e18('0x1ad'));}var _0x2c6f15=this[_0x1e18('0x1ae')]['sync'](this,_0x4e2edf['sms_account_id']);if(!_0x2c6f15){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x4e2edf,_0x1e18('0x1af'));}var _0x7d9492={'body':_0x4e2edf[_0x1e18('0x1b0')],'phone':_0x4e2edf['to']||'','SmsAccountId':_0x2c6f15['id']};logger['debug'](_0x1e18('0x1b1'),JSON[_0x1e18('0x80')](_0x7d9492));this[_0x1e18('0xb1')]['sync'](this,_0x4e2edf,_0x4e2edf[_0x1e18('0x1b2')]);this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x1b3'),_0x2c6f15[_0x1e18('0x15')]));this[_0x1e18('0x36')][_0x1e18('0x7d')](this,_0x7d9492);return this[_0x1e18('0xf')][_0x1e18('0xb3')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1b4')]=function(_0x41e91f){logger[_0x1e18('0x31')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x41e91f['label']));if(!this['isConfigured'](_0x41e91f[_0x1e18('0xdd')])){return this[_0x1e18('0xf')]['error'](_0x41e91f,_0x1e18('0x1b5'));}var _0x40d7a8=this[_0x1e18('0x12')][_0x1e18('0x7d')](this,_0x41e91f[_0x1e18('0xdd')]);if(!_0x40d7a8){return this[_0x1e18('0xf')]['error'](_0x41e91f,_0x1e18('0xde'));}return this[_0x1e18('0xf')]['setVariable'](_0x40d7a8,_0x41e91f['variable_value']);};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1b6')]=function(_0x37cb46){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x37cb46['label']));this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0x1b7'));if(_0x37cb46[_0x1e18('0xc4')]===_0x1e18('0x1b8')){this['channel'][_0x1e18('0xb3')](_0x1e18('0x1b9'));return this['channel'][_0x1e18('0xc4')]();}return this['channel'][_0x1e18('0xb3')](_0x1e18('0x1ba'));};AGIVertices[_0x1e18('0x19')]['subproject']=function(_0xc8b60b){logger['info'](util['format'](_0x1e18('0x1bb'),_0xc8b60b[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0xc8b60b[_0x1e18('0x1bc')])){return this['channel'][_0x1e18('0x2e')](_0xc8b60b,'no\x20subproject\x20selected');}var _0x1cc3b5=this[_0x1e18('0x1a')][_0x1e18('0x7d')](this,_0xc8b60b[_0x1e18('0x1bc')]);if(!this[_0x1e18('0x91')](_0x1cc3b5)){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0xc8b60b,util[_0x1e18('0x2b')](_0x1e18('0x1bd'),_0xc8b60b['project_id']));}if(_0x1cc3b5===this['channel'][_0x1e18('0x39')]){return this[_0x1e18('0xf')]['error'](_0xc8b60b,_0x1e18('0x1be'));}this[_0x1e18('0xb1')][_0x1e18('0x7d')](this,_0xc8b60b,_0x1cc3b5);var _0x30d0be=this['channel'][_0x1e18('0x63')]('AGI',util[_0x1e18('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x1e18('0x8')][_0x1e18('0x1a1')]||_0x1e18('0x1bf'),_0x1cc3b5,this[_0x1e18('0xf')][_0x1e18('0x39')]));if(_0x30d0be[_0x1e18('0xb9')]===-0x1){return _0x30d0be;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0xcd'),_0x1e18('0x1c0'),_0x1cc3b5));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1c1')]=function(_0x19e791){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x1c2'),_0x19e791[_0x1e18('0x37')]));var _0x48c65b=this[_0x1e18('0x62')][_0x1e18('0x7d')](this,_0x19e791[_0x1e18('0xc2')]);this['createSquareDetailsReport'][_0x1e18('0x7d')](this,_0x19e791,_0x19e791[_0x1e18('0xc2')]);if(this['isConfigured'](_0x19e791['variable_id'])){var _0x94b383=this[_0x1e18('0x12')][_0x1e18('0x7d')](this,_0x19e791['variable_id']);if(_0x94b383){this[_0x1e18('0xf')][_0x1e18('0xaa')](_0x94b383,_0x48c65b);return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x1c3'),_0x19e791['command'],_0x94b383));}}return this['channel'][_0x1e18('0xb3')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x19e791[_0x1e18('0xc2')]));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1c4')]=function(_0x362be0){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x1c5'),_0x362be0[_0x1e18('0x37')]));_0x362be0[_0x1e18('0x68')]=_0x362be0['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1e18('0x91')](_0x362be0['apiKey'])){return this[_0x1e18('0xf')][_0x1e18('0xb3')](_0x1e18('0x1c6'));}if(!this[_0x1e18('0x91')](_0x362be0[_0x1e18('0x68')])){return this['channel'][_0x1e18('0xb3')](_0x1e18('0xcf'));}this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x1c7'),_0x362be0[_0x1e18('0x68')]));var _0xb135a0=this[_0x1e18('0x66')][_0x1e18('0x7d')](this,_0x362be0);if(_0xb135a0){this['channel'][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x1c8'),_0xb135a0));var _0x4c124d=this['channel']['streamFile'](_0xb135a0);try{fs[_0x1e18('0x10a')](_0xb135a0+_0x1e18('0x10b'));}catch(_0x3a3291){logger[_0x1e18('0x2e')](_0x3a3291);}return _0x4c124d;}return this[_0x1e18('0xf')]['error'](_0x362be0,_0x1e18('0x1c9'));};AGIVertices[_0x1e18('0x19')]['tts']=function(_0x1bc21b){logger[_0x1e18('0x31')](util['format'](_0x1e18('0x1ca'),_0x1bc21b[_0x1e18('0x37')]));_0x1bc21b[_0x1e18('0x68')]=_0x1bc21b['text'][_0x1e18('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1e18('0x91')](_0x1bc21b['text'])){return this[_0x1e18('0xf')]['noop'](_0x1e18('0xcf'));}this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x1cb'),_0x1bc21b['text']));var _0x143e9b=this[_0x1e18('0x6e')]['sync'](this,_0x1bc21b);if(_0x143e9b){this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x1cc'),_0x143e9b));var _0x194281=this[_0x1e18('0xf')][_0x1e18('0x109')](_0x143e9b);try{fs[_0x1e18('0x10a')](_0x143e9b+_0x1e18('0x10b'));}catch(_0x5b3eb2){logger['error'](_0x5b3eb2);}return _0x194281;}return this['channel'][_0x1e18('0x2e')](_0x1bc21b,_0x1e18('0x1cd'));};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1ce')]=function(_0x4fe1cd){logger['info'](util['format'](_0x1e18('0x1cf'),_0x4fe1cd[_0x1e18('0x37')]));if(!this[_0x1e18('0x91')](_0x4fe1cd[_0x1e18('0x160')])){return this[_0x1e18('0xf')][_0x1e18('0x2e')](_0x4fe1cd,_0x1e18('0x161'));}logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x167'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4fe1cd[_0x1e18('0x160')]));var _0x2cdf99=this['agentUnpause']['sync'](this,_0x4fe1cd[_0x1e18('0x160')]);if(_0x2cdf99){logger[_0x1e18('0x31')](util[_0x1e18('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4fe1cd['findBy']));this['channel'][_0x1e18('0xb3')](util[_0x1e18('0x2b')](_0x1e18('0x162'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4fe1cd[_0x1e18('0x160')]));return{'code':0xc8,'result':_0x1e18('0x168')};}else{logger[_0x1e18('0x31')](util[_0x1e18('0x2b')](_0x1e18('0x163'),this['channel'][_0x1e18('0x3c')],_0x4fe1cd['findBy']));this[_0x1e18('0xf')]['noop'](util[_0x1e18('0x2b')](_0x1e18('0x163'),this[_0x1e18('0xf')][_0x1e18('0x3c')],_0x4fe1cd[_0x1e18('0x160')]));return{'code':0xc8,'result':_0x1e18('0x164')};}};AGIVertices[_0x1e18('0x19')][_0x1e18('0x1d0')]=function(_0x3f5d5e){logger['info'](util[_0x1e18('0x2b')](_0x1e18('0x1d1'),_0x3f5d5e[_0x1e18('0x37')]));var _0x3ae53d=this[_0x1e18('0xf')][_0x1e18('0x63')]('VOICEMAIL',[_0x3f5d5e[_0x1e18('0x1d2')],_0x3f5d5e['options']]);if(_0x3ae53d[_0x1e18('0xb9')]===-0x1){return _0x3ae53d;}return this[_0x1e18('0xf')][_0x1e18('0xb3')](util[_0x1e18('0x2b')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3f5d5e[_0x1e18('0x1d2')]));};AGIVertices['prototype'][_0x1e18('0x1d3')]=function(_0x22b820){logger['info'](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x22b820['label']));if(!this[_0x1e18('0x91')](_0x22b820[_0x1e18('0xdd')])){return this[_0x1e18('0xf')]['error'](_0x22b820,'no\x20variable\x20selected');}var _0x2aca5d=this['getVariable']['sync'](this,_0x22b820[_0x1e18('0xdd')]);if(!_0x2aca5d){return this[_0x1e18('0xf')]['error'](_0x22b820,_0x1e18('0xde'));}var _0x24318f=this[_0x1e18('0xf')]['getVariable'](_0x2aca5d);return{'code':0xc8,'result':_0x24318f['extra']?_0x24318f['extra']:'-'};};String[_0x1e18('0x19')][_0x1e18('0xac')]=function(_0x1e756a,_0x3aecaf){return this[_0x1e18('0xab')](_0x1e756a)[_0x1e18('0x1d4')](_0x3aecaf);};module['exports']=AGIVertices; \ No newline at end of file +var _0x851c=['callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','getContactByPhone','scheduledat','add','insertContact','timezones','utcOffset','minutes','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','LOCAL','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MALE','googleTTS','restAPI','url','method','timeout','includes','POST','PUT','body','rawBody','headers','rawHeaders','parse','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','googleASR','tildeASR','appsecret','clear','clone','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','hasOwnProperty','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','RECOG_INPUT()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20private_key\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','toUpperCase','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','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','streamFile','aws\x20Polly\x20is\x20unreachable','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','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','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','no\x20key\x20configured','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','shellCommand','command','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\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','menu','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0x851c,0x19d));var _0xc851=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x851c[_0x501510];return _0x1e6ee5;};'use strict';var fs=require('fs');var path=require(_0xc851('0x0'));var util=require(_0xc851('0x1'));var _=require(_0xc851('0x2'));var sh=require(_0xc851('0x3'));var odbc=require(_0xc851('0x4'))();var rs=require(_0xc851('0x5'));var moment=require(_0xc851('0x6'));var Mustache=require('mustache');var rp=require(_0xc851('0x7'));var logger=require(_0xc851('0x8'))('agi');var config=require(_0xc851('0x9'));var shared=require(_0xc851('0xa'));var scripts=require('./scripts');var FILES_PATH=_0xc851('0xb');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xc851('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x34b779,_0xdc942b,_0x3b4e80){this[_0xc851('0xd')]=_0x34b779;this[_0xc851('0xe')]=_0xdc942b;this[_0xc851('0xf')]=_0x3b4e80;};AGIVertices[_0xc851('0x10')][_0xc851('0x11')]=function(_0x4cb360,_0x3a1ce8){this[_0xc851('0xe')][_0xc851('0x12')](_0x4cb360)[_0xc851('0x13')](function(_0x46227a){_0x3a1ce8(null,_0x46227a?_0x46227a[_0xc851('0x14')]:![]);})[_0xc851('0x15')](function(_0xd619c3){_0x3a1ce8(_0xd619c3);});};AGIVertices[_0xc851('0x10')][_0xc851('0x16')]=function(_0x24d83a,_0x3fddbe){this[_0xc851('0xe')][_0xc851('0x17')](_0x24d83a)[_0xc851('0x13')](function(_0x458951){_0x3fddbe(null,_0x458951?_0x458951['name']:![]);})[_0xc851('0x15')](function(_0x5ad5e1){_0x3fddbe(_0x5ad5e1);});};AGIVertices[_0xc851('0x10')]['getSquareProject']=function(_0x110261,_0x25a49c){this[_0xc851('0xe')][_0xc851('0x18')](_0x110261)[_0xc851('0x13')](function(_0x1c9efb){_0x25a49c(null,_0x1c9efb?_0x1c9efb[_0xc851('0x14')]:![]);})['catch'](function(_0x27c098){_0x25a49c(_0x27c098);});};AGIVertices[_0xc851('0x10')]['getSquareOdbc']=function(_0x95bec4,_0x628458){this[_0xc851('0xe')][_0xc851('0x19')](_0x95bec4)['then'](function(_0x28fb91){_0x628458(null,_0x28fb91?_0x28fb91[_0xc851('0x1a')]:![]);})[_0xc851('0x15')](function(_0x4678f6){_0x628458(_0x4678f6);});};AGIVertices[_0xc851('0x10')]['getUser']=function(_0x5ad1b1,_0x442271){this[_0xc851('0xe')][_0xc851('0x1b')](_0x5ad1b1)[_0xc851('0x13')](function(_0x2c4cb4){_0x442271(null,_0x2c4cb4?_0x2c4cb4[_0xc851('0x14')]:![]);})['catch'](function(_0x3f95d5){_0x442271(_0x3f95d5);});};AGIVertices['prototype']['getTrunk']=function(_0x7a59cd,_0x1d6bc4){this['rpc'][_0xc851('0x1c')](_0x7a59cd)[_0xc851('0x13')](function(_0x1a0330){_0x1d6bc4(null,_0x1a0330?_0x1a0330['name']:![]);})[_0xc851('0x15')](function(_0x4407a6){_0x1d6bc4(_0x4407a6);});};AGIVertices[_0xc851('0x10')][_0xc851('0x1d')]=function(_0x1a08a8,_0x2fc8f1){var _0x3ebd7b=this;this[_0xc851('0xe')][_0xc851('0x1e')](_0x1a08a8)[_0xc851('0x13')](function(_0x279a40){_0x2fc8f1(null,_0x279a40?_0x3ebd7b[_0xc851('0x1f')](_0x279a40['save_name']):![]);})[_0xc851('0x15')](function(_0x170e54){_0x2fc8f1(_0x170e54);});};AGIVertices['prototype'][_0xc851('0x20')]=function(_0x482e0d,_0x56cedb){this['rpc'][_0xc851('0x21')](_0x482e0d)['then'](function(_0x26311d){_0x56cedb(null,_0x26311d?_0x26311d:![]);})['catch'](function(_0x233a73){_0x56cedb(_0x233a73);});};AGIVertices[_0xc851('0x10')][_0xc851('0x22')]=function(_0x34b7e4,_0x3eb4b3,_0x107ff7){this[_0xc851('0xf')][_0xc851('0x22')](_0x34b7e4,_0x3eb4b3)[_0xc851('0x13')](function(){_0x107ff7(null);})[_0xc851('0x15')](function(_0x4282d1){_0x107ff7(_0x4282d1);});};AGIVertices['prototype'][_0xc851('0x23')]=function(_0x530806,_0xcf908){this[_0xc851('0xe')][_0xc851('0x24')](_0x530806)[_0xc851('0x13')](function(_0x38281d){if(_0x38281d){if(_0x38281d[_0xc851('0x25')]){_0xcf908(null,[_0x38281d[_0xc851('0x26')]]);}else{_0xcf908(null,_['map'](_0x38281d['Intervals'],_0xc851('0x26')));}}else{_0xcf908(null,![]);}})[_0xc851('0x15')](function(_0x533fc4){_0xcf908(_0x533fc4);});};AGIVertices['prototype'][_0xc851('0x1f')]=function(_0x38b626){return util[_0xc851('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x38b626);};AGIVertices[_0xc851('0x10')][_0xc851('0x28')]=function(_0x4477d9,_0x33a1e0,_0x28a98e){odbc[_0xc851('0x29')](_0x4477d9,function(_0xb3fe3){if(_0xb3fe3){logger['error'](_0xc851('0x2a'),_0xb3fe3);_0x28a98e(_0xb3fe3);}else{logger[_0xc851('0x2b')](_0xc851('0x2c'));odbc[_0xc851('0x2d')](_0x33a1e0,function(_0xc42d16,_0x4e57a1){if(_0xc42d16){logger[_0xc851('0x2b')](_0xc851('0x2e'),_0x33a1e0);_0x28a98e(_0xc42d16);}else{logger[_0xc851('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x33a1e0);odbc[_0xc851('0x2f')](function(_0x4edf14){if(_0x4edf14){logger[_0xc851('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x4edf14);}_0x28a98e(null,_0x4e57a1);});}});}});};AGIVertices[_0xc851('0x10')]['getSmsAccount']=function(_0x2cb740,_0x23b53d){this[_0xc851('0xe')]['getSmsAccountById'](_0x2cb740)[_0xc851('0x13')](function(_0x6a80c2){_0x23b53d(null,_0x6a80c2?_0x6a80c2:![]);})[_0xc851('0x15')](function(_0x31c8ba){_0x23b53d(_0x31c8ba);});};AGIVertices['prototype'][_0xc851('0x31')]=function(_0x337047,_0x471f3d){this['rpc']['createSmsMessage'](_0x337047)[_0xc851('0x13')](function(_0x5e664a){_0x471f3d(null,_0x5e664a);})['catch'](function(_0x536954){_0x471f3d(_0x536954);});};AGIVertices['prototype'][_0xc851('0x32')]=function(_0x8b039a,_0x1016d1,_0x1be8c4){this[_0xc851('0xe')][_0xc851('0x32')]({'uniqueid':this[_0xc851('0xd')][_0xc851('0x33')],'node':_0x8b039a[_0xc851('0x34')],'application':_0x8b039a[_0xc851('0x35')],'data':_0x1016d1||null,'project_name':this[_0xc851('0xd')][_0xc851('0x36')],'callerid':this[_0xc851('0xd')][_0xc851('0x37')]})['then'](function(_0x59205a){if(_0x1be8c4){_0x1be8c4(null,_0x59205a);}})[_0xc851('0x15')](function(_0x5e44c8){if(_0x1be8c4){_0x1be8c4(_0x5e44c8);}});};AGIVertices['prototype'][_0xc851('0x38')]=function(_0x14fd74,_0x47cef2,_0x5ea5ed,_0xd9596b){this[_0xc851('0xe')]['createSquareRecording']({'uniqueid':this[_0xc851('0xd')][_0xc851('0x33')],'callerid':this['channel'][_0xc851('0x37')],'calleridname':this[_0xc851('0xd')][_0xc851('0x39')],'context':this[_0xc851('0xd')][_0xc851('0x3a')],'extension':this['channel'][_0xc851('0x3b')],'priority':this[_0xc851('0xd')][_0xc851('0x3c')],'accountcode':this['channel'][_0xc851('0x3d')],'dnid':this[_0xc851('0xd')][_0xc851('0x3e')],'projectName':this['channel']['arg_1'],'saveName':_0x47cef2,'filename':_0x14fd74[_0xc851('0x3f')]||_0x47cef2,'savePath':_0x5ea5ed})[_0xc851('0x13')](function(_0x33c187){_0xd9596b(null,_0x33c187);})['catch'](function(_0x229052){_0xd9596b(_0x229052);});};AGIVertices['prototype'][_0xc851('0x40')]=function(_0x2b7fab,_0x35ac48,_0x163605,_0x493f89,_0x220ab4){this[_0xc851('0xe')][_0xc851('0x40')]({'uniqueid':this['channel'][_0xc851('0x33')],'body':_0x2b7fab,'direction':_0x35ac48,'providerName':_0x163605,'providerResponse':_0x493f89})[_0xc851('0x13')](function(_0x47b1ff){if(_0x220ab4){_0x220ab4(null,_0x47b1ff);}})[_0xc851('0x15')](function(_0x3da51b){if(_0x220ab4){_0x220ab4(_0x3da51b);}});};AGIVertices[_0xc851('0x10')][_0xc851('0x41')]=function(_0x5ccb21,_0x4c924c){var _0x3a262f=this;var _0x44f8c0=0x0;var _0x3f00f5={'firstName':_['isEmpty'](_0x5ccb21[_0xc851('0x14')])||_[_0xc851('0x42')](_0x5ccb21[_0xc851('0x14')])?_0xc851('0x43')+Math[_0xc851('0x44')]():_0x5ccb21['name'],'lastName':_[_0xc851('0x45')](_0x5ccb21['lastName'])||_[_0xc851('0x42')](_0x5ccb21['lastName'])?null:_0x5ccb21[_0xc851('0x46')],'phone':_0x5ccb21[_0xc851('0x47')],'ListId':_0x5ccb21[_0xc851('0x48')],'scheduledat':_0x5ccb21[_0xc851('0x49')],'callbackUniqueid':this[_0xc851('0xd')]['uniqueid'],'tags':_0xc851('0x4a'),'description':_0xc851('0x4b')+_0x5ccb21[_0xc851('0x49')][_0xc851('0x4c')](),'priority':_0x5ccb21[_0xc851('0x4d')]};if(_[_0xc851('0x4e')](_0x5ccb21,_0xc851('0x4f'))){if(!_[_0xc851('0x42')](_0x5ccb21[_0xc851('0x4f')])){var _0xe71347=_0x5ccb21[_0xc851('0x4f')];if(_0x5ccb21[_0xc851('0x4f')]=='CALLERID(dialTimezone)'){this[_0xc851('0xe')][_0xc851('0x50')]({'phone':_0x5ccb21[_0xc851('0x47')]})[_0xc851('0x13')](function(_0x38940d){if(!_[_0xc851('0x42')](_0x38940d)){var _0x555f26=_0x38940d[_0xc851('0x4f')];if(!_['isNil'](_0x555f26)){var _0x25746d=shared['timezones'][_0x555f26];if(!_['isNil'](_0x25746d)){var _0x438cdb=-0x1*_0x25746d['utcOffset'];_0x3f00f5[_0xc851('0x51')]=moment(_0x5ccb21[_0xc851('0x51')])[_0xc851('0x52')](_0x438cdb,'minutes');_0x3a262f[_0xc851('0x53')](_0x3f00f5,_0x5ccb21,_0x4c924c);}else{_0x3a262f[_0xc851('0x53')](_0x3f00f5,_0x5ccb21,_0x4c924c);}}else{_0x3a262f[_0xc851('0x53')](_0x3f00f5,_0x5ccb21,_0x4c924c);}}else{_0x3a262f[_0xc851('0x53')](_0x3f00f5,_0x5ccb21,_0x4c924c);}});}else{var _0x44f8c0=shared[_0xc851('0x54')][_0xe71347];if(!_['isNil'](_0x44f8c0)){var _0x336b29=-0x1*_0x44f8c0[_0xc851('0x55')];_0x3f00f5[_0xc851('0x51')]=moment(_0x5ccb21['scheduledat'])[_0xc851('0x52')](_0x336b29,_0xc851('0x56'));_0x3a262f['insertContact'](_0x3f00f5,_0x5ccb21,_0x4c924c);}else{_0x3a262f[_0xc851('0x53')](_0x3f00f5,_0x5ccb21,_0x4c924c);}}}else{_0x3a262f[_0xc851('0x53')](_0x3f00f5,_0x5ccb21,_0x4c924c);}}else{_0x3a262f[_0xc851('0x53')](_0x3f00f5,_0x5ccb21,_0x4c924c);}};AGIVertices[_0xc851('0x10')]['getPause']=function(_0x595682,_0x55faa7){this['rpc'][_0xc851('0x57')](_0x595682)[_0xc851('0x13')](function(_0x200e68){_0x55faa7(null,_0x200e68?_0x200e68[_0xc851('0x14')]:![]);})[_0xc851('0x15')](function(_0x2e6766){_0x55faa7(_0x2e6766);});};AGIVertices['prototype'][_0xc851('0x58')]=function(_0x4d67b6,_0x567977,_0x3a6a48){var _0x3c32ea={'role':'agent'};_0x3c32ea[_0x4d67b6]=this[_0xc851('0xd')][_0xc851('0x37')];this['rpc'][_0xc851('0x58')](_0x3c32ea,_0x567977,this[_0xc851('0xd')][_0xc851('0x33')])['then'](function(_0x56c221){_0x3a6a48(null,_['isNil'](_0x56c221)?![]:!![]);})[_0xc851('0x15')](function(_0x13517f){logger['error'](_0x13517f);_0x3a6a48(null,![]);});};AGIVertices[_0xc851('0x10')][_0xc851('0x59')]=function(_0x31e25c,_0x368d3a){var _0x252919={'role':_0xc851('0x5a')};_0x252919[_0x31e25c]=this[_0xc851('0xd')][_0xc851('0x37')];this[_0xc851('0xe')][_0xc851('0x59')](_0x252919)[_0xc851('0x13')](function(_0x1b53f0){_0x368d3a(null,_[_0xc851('0x42')](_0x1b53f0)?![]:!![]);})['catch'](function(_0xc32cca){logger[_0xc851('0x30')](_0xc32cca);_0x368d3a(null,![]);});};AGIVertices['prototype'][_0xc851('0x5b')]=function(_0x4cff02,_0x3926cb){var _0x41054c={'role':_0xc851('0x5a')};_0x41054c[_0x4cff02]=this[_0xc851('0xd')]['callerid'];this['rpc'][_0xc851('0x5b')](_0x41054c)['then'](function(_0x26ded7){_0x3926cb(null,_['isNil'](_0x26ded7)?![]:!![]);})[_0xc851('0x15')](function(_0x5bdcf0){logger[_0xc851('0x30')](_0x5bdcf0);_0x3926cb(null,![]);});};AGIVertices[_0xc851('0x10')][_0xc851('0x5c')]=function(_0x587366,_0x5a36bc){var _0x532efe={'role':_0xc851('0x5a')};_0x532efe[_0x587366]=this['channel'][_0xc851('0x37')];var _0x2d3c11=_0x587366!='internal'?util['format']('%s/%s@from-sip/n',_0xc851('0x5d'),this[_0xc851('0xd')][_0xc851('0x37')]):undefined;this[_0xc851('0xe')][_0xc851('0x5c')](_0x532efe,_0x2d3c11)['then'](function(_0x4d1b69){_0x5a36bc(null,_[_0xc851('0x42')](_0x4d1b69)?![]:!![]);})[_0xc851('0x15')](function(_0x818020){logger['error'](_0x818020);_0x5a36bc(null,![]);});};AGIVertices[_0xc851('0x10')]['shellCommand']=function(_0x55f71b,_0x35b256){sh['exec'](_['trim'](_0x55f71b),function(_0x48cae8,_0x460296){var _0x191fb0=_0x460296[_0xc851('0x5e')](/(\r\n|\n|\r)/gm,'');_0x35b256(null,_0x191fb0);});};AGIVertices[_0xc851('0x10')]['googleCloudTTS']=function(_0xcf7da4,_0x2e68ce){scripts[_0xc851('0x5f')](_0xcf7da4[_0xc851('0x60')],_0xcf7da4[_0xc851('0x61')]||_0xc851('0x62'),_0xcf7da4[_0xc851('0x62')],_0xcf7da4['languageCode']||'en-US',_0xcf7da4[_0xc851('0x63')]||_0xc851('0x64'),_0xcf7da4['audioEncoding']||'MP3')[_0xc851('0x13')](function(_0x2102f7){_0x2e68ce(null,_0x2102f7);})[_0xc851('0x15')](function(_0x16b27b){_0x2e68ce(_0x16b27b);});};AGIVertices[_0xc851('0x10')]['googleTTS']=function(_0x4012f1,_0x1177eb){scripts[_0xc851('0x65')](_0x4012f1[_0xc851('0x62')],_0x4012f1['google_tts_language']||'en',0x1)[_0xc851('0x13')](function(_0x435e76){_0x1177eb(null,_0x435e76);})[_0xc851('0x15')](function(_0x59acc1){_0x1177eb(_0x59acc1);});};AGIVertices['prototype'][_0xc851('0x66')]=function(_0x12cc8b,_0x5b84ed){var _0x22b43e={'uri':_0x12cc8b[_0xc851('0x67')],'method':_0x12cc8b[_0xc851('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x12cc8b[_0xc851('0x69')])==='number'&&parseInt(_0x12cc8b[_0xc851('0x69')])>=0x1?parseInt(_0x12cc8b[_0xc851('0x69')])*0x3e8:0x5*0x3e8};if(_[_0xc851('0x6a')]([_0xc851('0x6b'),_0xc851('0x6c')],_0x22b43e[_0xc851('0x68')]['toUpperCase']())){try{_0x22b43e[_0xc851('0x6d')]=_0x12cc8b[_0xc851('0x6e')]?JSON['parse'](_0x12cc8b[_0xc851('0x6e')]):{};}catch(_0x5cd2fa){logger[_0xc851('0x30')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5cd2fa);}}try{_0x22b43e[_0xc851('0x6f')]=_0x12cc8b[_0xc851('0x70')]?JSON[_0xc851('0x71')](_0x12cc8b['rawHeaders']):{};}catch(_0x5c3626){logger[_0xc851('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5c3626);}if(_0x12cc8b[_0xc851('0x72')]){try{var _0x272f48=require(_0x12cc8b[_0xc851('0x72')])[_0xc851('0x73')](this,_0x22b43e);_0x22b43e[_0xc851('0x74')]=Mustache[_0xc851('0x75')](_0x12cc8b['url'],_0x272f48,{},['$$','$$']);if(_0x22b43e[_0xc851('0x6f')]){_0x22b43e['headers']=JSON['parse'](Mustache[_0xc851('0x75')](JSON[_0xc851('0x76')](_0x22b43e[_0xc851('0x6f')]),_0x272f48,{},['$$','$$']));}if(_0x22b43e['body']){_0x22b43e['body']=JSON[_0xc851('0x71')](Mustache['render'](JSON['stringify'](_0x22b43e[_0xc851('0x6d')]),_0x272f48,{},['$$','$$']));}}catch(_0x482323){logger[_0xc851('0x30')](_0xc851('0x77'),_0x482323);}}rp(_0x22b43e)[_0xc851('0x13')](function(_0x538ff7){var _0x27be67={'statusCode':_0x538ff7[_0xc851('0x78')]||0xc8,'statusMessage':_0x538ff7[_0xc851('0x79')]||'OK','headers':_0x538ff7[_0xc851('0x6f')]||{},'body':_0x538ff7[_0xc851('0x6d')]||{}};_0x5b84ed(null,_0x27be67);})[_0xc851('0x15')](function(_0x48718c){var _0x1a27da={'statusCode':_0x48718c['statusCode']||0x1f4,'statusMessage':_0x48718c[_0xc851('0x7a')]||_0xc851('0x7b'),'headers':_0x48718c[_0xc851('0x7c')][_0xc851('0x6f')]||{},'body':_0x48718c[_0xc851('0x7c')][_0xc851('0x6d')]||{}};_0x5b84ed(null,_0x1a27da);});};AGIVertices[_0xc851('0x10')][_0xc851('0x7d')]=function(_0x2ee0a5,_0x21f1e3){scripts[_0xc851('0x7d')](this[_0xc851('0xd')][_0xc851('0x33')],_0x2ee0a5[_0xc851('0x7e')],_0x2ee0a5[_0xc851('0x62')],_0x2ee0a5[_0xc851('0x7f')]||'en')['then'](function(_0x2face4){_0x21f1e3(null,_0x2face4);})[_0xc851('0x15')](function(_0x15e6d9){_0x21f1e3(_0x15e6d9);});};AGIVertices[_0xc851('0x10')][_0xc851('0x80')]=function(_0x38d732,_0x2110b9){scripts[_0xc851('0x80')](this[_0xc851('0xd')][_0xc851('0x33')],_0x38d732[_0xc851('0x81')],_0x38d732['client_email'],_0x38d732[_0xc851('0x82')],_0x38d732[_0xc851('0x62')],_0x38d732[_0xc851('0x83')]||'en')[_0xc851('0x13')](function(_0x219fe2){_0x2110b9(null,_0x219fe2);})['catch'](function(_0x45243e){_0x2110b9(_0x45243e);});};AGIVertices[_0xc851('0x10')][_0xc851('0x84')]=function(_0x1905b5,_0x28f4ce){scripts['sestekNDA'](this[_0xc851('0xd')],_0x1905b5)['then'](function(_0x50e4f8){_0x28f4ce(null,_0x50e4f8);})[_0xc851('0x15')](function(_0x10e66e){_0x28f4ce(_0x10e66e);});};AGIVertices[_0xc851('0x10')][_0xc851('0x85')]=function(_0xb4349e,_0x539b57){scripts[_0xc851('0x85')](_0xb4349e[_0xc851('0x7e')],_0xb4349e[_0xc851('0x62')],_0xb4349e[_0xc851('0x86')]||_0xc851('0x87'),_0xb4349e[_0xc851('0x88')])[_0xc851('0x13')](function(_0x41c009){_0x539b57(null,_0x41c009);})['catch'](function(_0x24a5be){_0x539b57(_0x24a5be);});};AGIVertices[_0xc851('0x10')][_0xc851('0x89')]=function(_0xc520a6,_0x1b4b01,_0x323361){scripts['ispeechASR'](_0x1b4b01,_0xc520a6[_0xc851('0x7e')],_0xc520a6['ispeech_asr_language']||_0xc851('0x87'),this[_0xc851('0x8a')](_0xc520a6[_0xc851('0x8b')])?_0xc520a6[_0xc851('0x8b')]:undefined)['then'](function(_0x6d4f45){_0x323361(null,_0x6d4f45);})[_0xc851('0x15')](function(_0x5aacae){_0x323361(_0x5aacae);});};AGIVertices[_0xc851('0x10')]['awsPolly']=function(_0x3f3a03,_0x911924){scripts[_0xc851('0x8c')](_0x3f3a03['aws_access_key_id'],_0x3f3a03['aws_secret_access_key'],_0x3f3a03[_0xc851('0x8d')],_0x3f3a03[_0xc851('0x8e')]||_0xc851('0x8f'),_0x3f3a03['text'],_0x3f3a03[_0xc851('0x90')]||_0xc851('0x62'))[_0xc851('0x13')](function(_0x13d07b){_0x911924(null,_0x13d07b);})[_0xc851('0x15')](function(_0x3cbc46){_0x911924(_0x3cbc46);});};AGIVertices[_0xc851('0x10')][_0xc851('0x91')]=function(_0x3d7e70,_0x4005e1){scripts[_0xc851('0x91')](this[_0xc851('0xd')]['uniqueid'],_0x3d7e70[_0xc851('0x92')],_0x3d7e70[_0xc851('0x93')],_0x3d7e70[_0xc851('0x94')],_0x3d7e70[_0xc851('0x62')],_0x3d7e70['aws_bot_name'])['then'](function(_0x87df0a){_0x4005e1(null,_0x87df0a);})[_0xc851('0x15')](function(_0x47cf78){_0x4005e1(_0x47cf78);});};AGIVertices[_0xc851('0x10')][_0xc851('0x95')]=function(_0x4fad3a,_0x2e3fda,_0x138804){scripts[_0xc851('0x95')](_0x2e3fda,_0x4fad3a['key'],_0x4fad3a['google_asr_language']||_0xc851('0x87'))['then'](function(_0x26dddc){_0x138804(null,_0x26dddc);})['catch'](function(_0xe020b2){_0x138804(_0xe020b2);});};AGIVertices[_0xc851('0x10')][_0xc851('0x96')]=function(_0x4720b6,_0x5522f8,_0x444444){scripts[_0xc851('0x96')](_0x5522f8,_0x4720b6['appid'],_0x4720b6[_0xc851('0x97')],_0x4720b6['uri'])[_0xc851('0x13')](function(_0x1068f8){_0x444444(null,_0x1068f8);})[_0xc851('0x15')](function(_0x367444){_0x444444(_0x367444);});};AGIVertices['prototype'][_0xc851('0x98')]=function(_0x3fa06b){var _0x48366c=_[_0xc851('0x6a')](verticesWithRetry,_0x3fa06b[_0xc851('0x35')])?_0x3fa06b:_[_0xc851('0x99')](_0x3fa06b);for(var _0x5e9d99 in _0x48366c){if(_0x48366c['hasOwnProperty'](_0x5e9d99)){if(_0x48366c[_0x5e9d99]&&_['isString'](_0x48366c[_0x5e9d99])){if(_['includes'](recursiveMapAttributes,_0x5e9d99)){_0x48366c[_0x5e9d99]=this[_0xc851('0x9a')](_0x48366c[_0x5e9d99]);}else{_0x48366c[_0x5e9d99]=this[_0xc851('0x9b')](_0x48366c[_0x5e9d99]);}}}}return _0x48366c;};AGIVertices[_0xc851('0x10')][_0xc851('0x9c')]=function(_0x388aef){for(var _0x45e8e7 in _0x388aef){if(_0x388aef['hasOwnProperty'](_0x45e8e7)){if(_[_0xc851('0x9d')](_0x388aef[_0x45e8e7])){this[_0xc851('0x9c')](_0x388aef[_0x45e8e7]);}else if(_[_0xc851('0x9e')](_0x388aef[_0x45e8e7])){for(var _0x69ecb=0x0;_0x69ecb<_0x388aef[_0x45e8e7]['length'];_0x69ecb++){this[_0xc851('0x9c')](_0x388aef[_0x45e8e7][_0x69ecb]);}}else if(_[_0xc851('0x9f')](_0x388aef[_0x45e8e7])){_0x388aef[_0x45e8e7]=this['replaceAllVariables'](_0x388aef[_0x45e8e7]);}}}};AGIVertices['prototype'][_0xc851('0xa0')]=function(_0x249074,_0x12954b){for(var _0x21a5d7 in _0x249074){if(_0x249074[_0xc851('0xa1')](_0x21a5d7)){if(_[_0xc851('0x9d')](_0x249074[_0x21a5d7])){if(!_[_0xc851('0x45')](_0x249074[_0x21a5d7])){this[_0xc851('0xa0')](_0x249074[_0x21a5d7],util['format'](_0xc851('0xa2'),_0x12954b,_0x21a5d7));}}else if(_[_0xc851('0x9e')](_0x249074[_0x21a5d7])){for(var _0x147d60=0x0;_0x147d60<_0x249074[_0x21a5d7][_0xc851('0xa3')];_0x147d60++){this[_0xc851('0xa0')](_0x249074[_0x21a5d7][_0x147d60],util[_0xc851('0x27')](_0xc851('0xa2'),_0x12954b,_0x21a5d7+'['+_0x147d60+']'));}}else{if(!_[_0xc851('0x42')](_0x249074[_0x21a5d7])){this[_0xc851('0xd')][_0xc851('0xa4')](util[_0xc851('0x27')](_0xc851('0xa2'),_0x12954b,_0x21a5d7),_0x249074[_0x21a5d7]);}}}}};AGIVertices[_0xc851('0x10')]['replaceObjectAllVariables']=function(_0x1a1de7){try{var _0x22967b=JSON['parse'](_0x1a1de7);this[_0xc851('0x9c')](_0x22967b);return JSON[_0xc851('0x76')](_0x22967b);}catch(_0x205f70){return this[_0xc851('0x9b')](_0x1a1de7);}};AGIVertices[_0xc851('0x10')]['replaceAllVariables']=function(_0x790cfe){var _0x6a7cc3=_0x790cfe['split']('{');for(var _0x438029=0x1;_0x438029<_0x6a7cc3[_0xc851('0xa3')];_0x438029+=0x1){var _0x54564d=_0x6a7cc3[_0x438029][_0xc851('0xa5')]('}');if(_0x54564d[_0xc851('0xa3')]>0x1){_0x790cfe=_0x790cfe[_0xc851('0xa6')]('{'+_0x54564d[0x0]+'}',this[_0xc851('0xd')][_0xc851('0x11')](_0x54564d[0x0])[_0xc851('0xa7')]||_0x54564d[0x0]);}}if(_0x6a7cc3[_0xc851('0xa3')]===0x1){return _0x790cfe[_0xc851('0x4c')]();}return this[_0xc851('0x9b')](_0x790cfe);};AGIVertices[_0xc851('0x10')][_0xc851('0xa8')]=function(_0x2d9d0d,_0x15d056){var _0x524ee5=this[_0xc851('0xd')][_0xc851('0x11')](_0x2d9d0d);if(_0x524ee5[_0xc851('0xa9')]===-0x1){return _0x524ee5;}logger['info'](util[_0xc851('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x15d056,_0x524ee5[_0xc851('0xa7')]));return this['channel'][_0xc851('0xa4')](_0x15d056,_0x524ee5['extra']);};AGIVertices[_0xc851('0x10')][_0xc851('0x8a')]=function(_0xfc58c4){return _0xfc58c4&&_0xfc58c4!=='0'&&_0xfc58c4!=='-1'&&_0xfc58c4!=='';};AGIVertices[_0xc851('0x10')]['maxRetry']=function(_0x540150){this[_0xc851('0x32')][_0xc851('0x73')](this,_0x540150,'-');_0x540150['retry']=_0x540150[_0xc851('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc851('0x10')][_0xc851('0xab')]=function(_0x570144){logger['info'](util[_0xc851('0x27')](_0xc851('0xac'),_0x570144[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x570144[_0xc851('0x62')])){return this[_0xc851('0xd')][_0xc851('0xad')]('no\x20text\x20configured');}var _0x19c283='\x22'+_0x570144[_0xc851('0x62')]+'\x22';if(this[_0xc851('0x8a')](_0x570144[_0xc851('0x7c')])){_0x19c283+=','+_0x570144[_0xc851('0x7c')];}var _0x5a91d2=this[_0xc851('0xd')][_0xc851('0xae')](_0xc851('0xaf'),_0x19c283);if(_0x5a91d2['result']===-0x1){return _0x5a91d2;}return this[_0xc851('0xd')][_0xc851('0xad')](util['format'](_0xc851('0xb0'),_0x19c283));};AGIVertices[_0xc851('0x10')][_0xc851('0xb1')]=function(_0x18f496){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xb2'),_0x18f496['label']));if(!this['isConfigured'](_0x18f496['grammar'])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x41e91e=_0x18f496[_0xc851('0xb3')];if(this['isConfigured'](_0x18f496[_0xc851('0x7c')])){_0x41e91e+=','+_0x18f496[_0xc851('0x7c')];}var _0xb7a647=this[_0xc851('0xd')][_0xc851('0xae')]('MRCPRecog',_0x41e91e);if(_0xb7a647[_0xc851('0xa9')]===-0x1){return _0xb7a647;}var _0xebc64d=this[_0xc851('0xa8')](_0xc851('0xb4'),_0xc851('0xb5'));if(_0xebc64d[_0xc851('0xa9')]===-0x1){return _0xebc64d;}var _0x1ae60c=this[_0xc851('0xa8')]('RECOG_INPUT()',_0xc851('0xb6'));if(_0x1ae60c[_0xc851('0xa9')]===-0x1){return _0x1ae60c;}var _0x3f94df=this['getAndSetVariable'](_0xc851('0xb7'),_0xc851('0xb8'));if(_0x3f94df['result']===-0x1){return _0x3f94df;}return this[_0xc851('0xd')][_0xc851('0xad')](util['format'](_0xc851('0xb9'),_0x41e91e));};AGIVertices[_0xc851('0x10')]['agi']=function(_0x176cea){logger[_0xc851('0x2b')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x176cea[_0xc851('0x34')]));return this[_0xc851('0xd')][_0xc851('0xba')]([_0x176cea['command'],_0x176cea['args']]);};AGIVertices[_0xc851('0x10')][_0xc851('0xbb')]=function(_0x267cad){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xbc'),_0x267cad[_0xc851('0x34')]));if(this['isConfigured'](_0x267cad[_0xc851('0x69')])){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xbd'),_0x267cad['timeout']));var _0x56f812=this['channel'][_0xc851('0xbe')](_0x267cad[_0xc851('0x69')]);if(_0x56f812[_0xc851('0xa9')]===-0x1){return _0x56f812;}}return this[_0xc851('0xd')][_0xc851('0xbb')]();};AGIVertices[_0xc851('0x10')][_0xc851('0x4a')]=function(_0x562eda){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xbf'),_0x562eda[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x562eda[_0xc851('0x48')])){return this['channel'][_0xc851('0x30')](_0x562eda,_0xc851('0xc0'));}_0x562eda[_0xc851('0x49')]=moment();if(this[_0xc851('0x8a')](_0x562eda[_0xc851('0xc1')])){_0x562eda[_0xc851('0x49')]=moment()[_0xc851('0x52')](_0x562eda[_0xc851('0xc1')],_0xc851('0x56'));}if(!this[_0xc851('0x8a')](_0x562eda[_0xc851('0x4d')])){_0x562eda[_0xc851('0x4d')]=0x2;}this[_0xc851('0x41')][_0xc851('0x73')](this,_0x562eda);return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xc2'),_0x562eda[_0xc851('0x47')],_0x562eda[_0xc851('0x48')],_0x562eda[_0xc851('0x49')]));};AGIVertices[_0xc851('0x10')][_0xc851('0xc3')]=function(_0x3348d8){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xc4'),_0x3348d8[_0xc851('0x34')]));var _0x5b89c4=this['channel'][_0xc851('0xae')](_0x3348d8[_0xc851('0xc5')],_0x3348d8[_0xc851('0x7c')]);if(_0x5b89c4['result']===-0x1){return _0x5b89c4;}return this[_0xc851('0xd')]['noop'](util[_0xc851('0x27')]('Executed\x20command\x20%s\x20%s',_0x3348d8['application'],_0x3348d8[_0xc851('0x7c')]));};AGIVertices[_0xc851('0x10')][_0xc851('0xc6')]=function(_0x42a15f){logger[_0xc851('0x2b')](util['format'](_0xc851('0xc7'),_0x42a15f[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x42a15f[_0xc851('0x62')])){return this['channel'][_0xc851('0xad')](_0xc851('0xc8'));}var _0x355de3='\x22'+_0x42a15f[_0xc851('0x62')]+'\x22';if(this[_0xc851('0x8a')](_0x42a15f['options'])){_0x355de3+=','+_0x42a15f[_0xc851('0x7c')];}var _0x189c0f=this['channel']['exec']('MRCPSynth',_0x355de3);if(_0x189c0f[_0xc851('0xa9')]===-0x1){return _0x189c0f;}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xb0'),_0x355de3));};AGIVertices[_0xc851('0x10')]['sestektts']=function(_0x4bb9a5){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xc9'),_0x4bb9a5[_0xc851('0x34')]));if(!this['isConfigured'](_0x4bb9a5[_0xc851('0x62')])){return this['channel'][_0xc851('0xad')](_0xc851('0xc8'));}var _0x382708='\x22'+_0x4bb9a5[_0xc851('0x62')]+'\x22';if(this[_0xc851('0x8a')](_0x4bb9a5[_0xc851('0x7c')])){_0x382708+=','+_0x4bb9a5[_0xc851('0x7c')];}var _0xdbf3f6=this[_0xc851('0xd')][_0xc851('0xae')](_0xc851('0xaf'),_0x382708);if(_0xdbf3f6[_0xc851('0xa9')]===-0x1){return _0xdbf3f6;}return this['channel']['noop'](util['format'](_0xc851('0xb0'),_0x382708));};AGIVertices['prototype'][_0xc851('0xca')]=function(_0x363fff){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xcb'),_0x363fff[_0xc851('0x34')]));if(!this['isConfigured'](_0x363fff['grammar'])){return this[_0xc851('0xd')]['noop']('no\x20grammar\x20configured');}var _0x3203fb=_0x363fff[_0xc851('0xb3')];if(this[_0xc851('0x8a')](_0x363fff['options'])){_0x3203fb+=','+_0x363fff[_0xc851('0x7c')];}var _0x4448e9=this[_0xc851('0xd')]['exec'](_0xc851('0xcc'),_0x3203fb);if(_0x4448e9[_0xc851('0xa9')]===-0x1){return _0x4448e9;}var _0x27b32a=this[_0xc851('0xa8')](_0xc851('0xb4'),_0xc851('0xcd'));if(_0x27b32a[_0xc851('0xa9')]===-0x1){return _0x27b32a;}var _0x119858=this[_0xc851('0xa8')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x119858[_0xc851('0xa9')]===-0x1){return _0x119858;}var _0x399855=this[_0xc851('0xa8')]('RECOG_INSTANCE()',_0xc851('0xce'));if(_0x399855['result']===-0x1){return _0x399855;}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xb9'),_0x3203fb));};AGIVertices[_0xc851('0x10')]['sestekasr']=function(_0x26fda5){logger[_0xc851('0x2b')](util[_0xc851('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x26fda5[_0xc851('0x34')]));if(!this['isConfigured'](_0x26fda5[_0xc851('0xb3')])){return this[_0xc851('0xd')][_0xc851('0xad')]('no\x20grammar\x20configured');}var _0x1a4733=_0x26fda5[_0xc851('0xb3')];if(this[_0xc851('0x8a')](_0x26fda5['options'])){_0x1a4733+=','+_0x26fda5[_0xc851('0x7c')];}var _0x5dfb52=this[_0xc851('0xd')][_0xc851('0xae')](_0xc851('0xcc'),_0x1a4733);if(_0x5dfb52[_0xc851('0xa9')]===-0x1){return _0x5dfb52;}var _0x1cf153=this[_0xc851('0xa8')](_0xc851('0xb4'),'SESTEK_ASR_CONFIDENCE');if(_0x1cf153[_0xc851('0xa9')]===-0x1){return _0x1cf153;}var _0x5d0d28=this[_0xc851('0xa8')](_0xc851('0xcf'),'SESTEK_ASR_TRANSCRIPT');if(_0x5d0d28[_0xc851('0xa9')]===-0x1){return _0x5d0d28;}var _0x3cec5a=this['getAndSetVariable'](_0xc851('0xb7'),_0xc851('0xd0'));if(_0x3cec5a[_0xc851('0xa9')]===-0x1){return _0x3cec5a;}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xb9'),_0x1a4733));};AGIVertices['prototype'][_0xc851('0xd1')]=function(_0xe49c1){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xd2'),_0xe49c1[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0xe49c1['odbc_id'])){return this['channel'][_0xc851('0x30')](_0xe49c1,_0xc851('0xd3'));}var _0x16986e=this[_0xc851('0xd4')]['sync'](this,_0xe49c1[_0xc851('0xd5')]);if(!_0x16986e){return this[_0xc851('0xd')][_0xc851('0x30')](_0xe49c1,_0xc851('0xd6'));}if(!this[_0xc851('0x8a')](_0xe49c1[_0xc851('0x2d')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0xe49c1,_0xc851('0xd7'));}var _0x116cec=_0xe49c1[_0xc851('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xd8'),_0x116cec));var _0x2a80cd=this[_0xc851('0x28')]['sync'](this,_0x16986e,_0x116cec);this['createSquareDetailsReport'][_0xc851('0x73')](this,_0xe49c1,_0x116cec);if(!this[_0xc851('0x8a')](_0xe49c1[_0xc851('0xd9')])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0xda'));}var _0x27e77b=this[_0xc851('0x11')][_0xc851('0x73')](this,_0xe49c1[_0xc851('0xd9')]);if(!_0x27e77b){return this[_0xc851('0xd')][_0xc851('0x30')](_0xe49c1,_0xc851('0xdb'));}var _0x296296=this;_0x2a80cd[_0xc851('0xdc')](function(_0x131850,_0x2aba2c){Object[_0xc851('0xdd')](_0x131850)['forEach'](function(_0x26fe11){_0x296296['channel'][_0xc851('0xa4')](util[_0xc851('0x27')](_0xc851('0xde'),_0x27e77b,_0x2aba2c,_0x26fe11),_0x131850[_0x26fe11]);});});this[_0xc851('0xd')]['setVariable'](util['format'](_0xc851('0xdf'),_0x27e77b),_0x2a80cd[_0xc851('0xa3')]);return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xe0'),_0x27e77b));};AGIVertices[_0xc851('0x10')][_0xc851('0xe1')]=function(_0x285298){logger[_0xc851('0xe2')](util[_0xc851('0x27')](_0xc851('0xe3'),_0x285298[_0xc851('0x34')]));if(!this['isConfigured'](_0x285298[_0xc851('0xe4')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x285298,'no\x20user\x20selected');}var _0x4546fd=this[_0xc851('0xe5')]['sync'](this,_0x285298[_0xc851('0xe4')]);if(!_0x4546fd){return this[_0xc851('0xd')][_0xc851('0x30')](_0x285298,'no\x20user\x20found');}var _0x2ec6d8=this[_0xc851('0xd')]['exec'](_0xc851('0xe6'),[util[_0xc851('0x27')](_0xc851('0xe7'),_0x4546fd),_0x285298[_0xc851('0x69')],_0x285298['opts'],_0x285298[_0xc851('0x67')]]);if(_0x2ec6d8[_0xc851('0xa9')]===-0x1){return _0x2ec6d8;}return this[_0xc851('0xd')]['noop'](util['format'](_0xc851('0xe8'),_0xc851('0xe6')));};AGIVertices[_0xc851('0x10')][_0xc851('0xe9')]=function(_0x177c30){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xea'),_0x177c30[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x177c30['key'])){return this[_0xc851('0xd')]['noop']('no\x20key\x20configured');}if(!this[_0xc851('0x8a')](_0x177c30[_0xc851('0x62')])){return this[_0xc851('0xd')]['noop']('no\x20text\x20configured');}this[_0xc851('0xd')][_0xc851('0xeb')]=!![];this[_0xc851('0x32')](_0x177c30);this[_0xc851('0x40')](_0x177c30['text'],'in','','');this['channel'][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xec'),_0x177c30[_0xc851('0x62')]));var _0x3a86e6=this['googleDialogflow'][_0xc851('0x73')](this,_0x177c30);if(_0x3a86e6){for(var _0x59f572 in _0x3a86e6){if(_0x3a86e6['hasOwnProperty'](_0x59f572)){this['channel'][_0xc851('0xa4')](util['format'](_0xc851('0xed'),_0x59f572['toUpperCase']()),_0x3a86e6[_0x59f572]);}}this[_0xc851('0x40')](_0x3a86e6[_0xc851('0xee')],_0xc851('0xef'),_0xc851('0xe9'),'');return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xf0'),_0x3a86e6[_0xc851('0xee')]));}return this[_0xc851('0xd')][_0xc851('0x30')](_0x177c30,_0xc851('0xf1'));};AGIVertices[_0xc851('0x10')][_0xc851('0xf2')]=function(_0x2943ac){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0xf3'),_0x2943ac[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x2943ac[_0xc851('0x81')])){return this[_0xc851('0xd')]['noop']('no\x20project_id\x20configured');}if(!this[_0xc851('0x8a')](_0x2943ac[_0xc851('0xf4')])){return this[_0xc851('0xd')][_0xc851('0xad')]('no\x20client_email\x20configured');}if(!this[_0xc851('0x8a')](_0x2943ac['private_key'])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0xf5'));}if(!this[_0xc851('0x8a')](_0x2943ac[_0xc851('0x83')])){return this['channel'][_0xc851('0xad')]('no\x20anguage\x20configured');}if(!this[_0xc851('0x8a')](_0x2943ac[_0xc851('0x62')])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0xc8'));}this[_0xc851('0xd')][_0xc851('0xeb')]=!![];this[_0xc851('0x32')](_0x2943ac);this[_0xc851('0x40')](_0x2943ac[_0xc851('0x62')],'in','','');this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('Trying\x20DialogflowV2:\x20%s',_0x2943ac[_0xc851('0x62')]));var _0xca12f=this[_0xc851('0x80')]['sync'](this,_0x2943ac);if(_0xca12f){for(var _0x4388e3 in _0xca12f){if(_0xca12f[_0xc851('0xa1')](_0x4388e3)){if(_0x4388e3!==_0xc851('0xf6')){this['channel'][_0xc851('0xa4')](util['format'](_0xc851('0xed'),_0x4388e3['toUpperCase']()),_0xca12f[_0x4388e3]);}}}this[_0xc851('0x40')](_0xca12f['speech'],_0xc851('0xef'),_0xc851('0xf2'),_0xca12f[_0xc851('0xf6')]);return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xf7'),_0xca12f[_0xc851('0xee')]));}return this[_0xc851('0xd')][_0xc851('0x30')](_0x2943ac,_0xc851('0xf8'));};AGIVertices['prototype']['sesteknda']=function(_0x5ab91c){logger['info'](util[_0xc851('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x5ab91c[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x5ab91c[_0xc851('0xf9')])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0xfa'));}if(!this[_0xc851('0x8a')](_0x5ab91c[_0xc851('0xfb')])){return this['channel'][_0xc851('0xad')]('no\x20username\x20configured');}if(!this[_0xc851('0x8a')](_0x5ab91c[_0xc851('0xfc')])){return this[_0xc851('0xd')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x5ab91c[_0xc851('0xfd')])){return this[_0xc851('0xd')][_0xc851('0xad')]('no\x20text\x20configured');}this['channel'][_0xc851('0xeb')]=!![];this[_0xc851('0x32')](_0x5ab91c);this['createSquareMessage'](_0x5ab91c[_0xc851('0x62')],'in','','');this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xfe'),_0x5ab91c[_0xc851('0x62')]));var _0x4f7218=this[_0xc851('0x84')][_0xc851('0x73')](this,_0x5ab91c);if(_0x4f7218){for(var _0x177b9e in _0x4f7218){if(_0x4f7218[_0xc851('0xa1')](_0x177b9e)){this['channel']['setVariable'](util['format'](_0xc851('0xff'),_0x177b9e[_0xc851('0x100')]()),_0x4f7218[_0x177b9e]);}}this[_0xc851('0x40')](_0x4f7218['speech'],_0xc851('0xef'),'sesteknda','');if(_0x4f7218['audiofile']){this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x4f7218[_0xc851('0x101')]));var _0x4a8d0e=this[_0xc851('0xd')]['streamFile'](_0x4f7218['audiofile']);try{fs[_0xc851('0x102')](_0x4f7218[_0xc851('0x101')]+_0xc851('0x103'));}catch(_0x28b399){logger[_0xc851('0x30')](_0x28b399);}return _0x4a8d0e;}else{return this[_0xc851('0xd')]['noop'](util[_0xc851('0x27')](_0xc851('0x104'),_0x4f7218['speech']));}}return this['channel'][_0xc851('0x30')](_0x5ab91c,_0xc851('0x105'));};AGIVertices[_0xc851('0x10')][_0xc851('0x106')]=function(_0x6aecf2){logger[_0xc851('0x2b')](util[_0xc851('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0x6aecf2[_0xc851('0x34')]));return this[_0xc851('0xd')]['noop'](_0xc851('0x106'));};AGIVertices[_0xc851('0x10')][_0xc851('0x107')]=function(_0x54a474){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x108'),_0x54a474[_0xc851('0x34')]));var _0x3f5bee='';if(_0x54a474[_0xc851('0x109')]){if(!this[_0xc851('0x8a')](_0x54a474[_0xc851('0x109')])){return this['channel']['error'](_0x54a474,_0xc851('0x10a'));}else{var _0x378537=parseInt(_0x54a474[_0xc851('0x109')],0xa);if(isNaN(_0x378537)){_0x3f5bee=_0x54a474[_0xc851('0x109')];}else{_0x3f5bee=this[_0xc851('0x10b')][_0xc851('0x73')](this,_0x54a474[_0xc851('0x109')]);if(!_0x3f5bee){return this[_0xc851('0xd')][_0xc851('0x30')](_0x54a474,_0xc851('0x10c'));}}}}else if(_0x54a474[_0xc851('0x10d')]){_0x3f5bee=_0x54a474[_0xc851('0x10d')];}else{return this['channel'][_0xc851('0x30')](_0x54a474,_0xc851('0x10a'));}var _0x29e0b4=this['channel']['exec'](_0xc851('0xe6'),[util[_0xc851('0x27')](_0xc851('0x10e'),_0x3f5bee,_0x54a474['phone']),_0x54a474[_0xc851('0x69')],_0x54a474['opts'],_0x54a474[_0xc851('0x67')]]);if(_0x29e0b4[_0xc851('0xa9')]===-0x1){return _0x29e0b4;}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xe8'),'DIAL'));};AGIVertices[_0xc851('0x10')][_0xc851('0x10f')]=function(_0x33f350){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x110'),_0x33f350[_0xc851('0x34')]));return this['channel'][_0xc851('0xad')](_0xc851('0x10f'));};AGIVertices[_0xc851('0x10')][_0xc851('0x111')]=function(_0x656a75){logger[_0xc851('0x2b')](util[_0xc851('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x656a75[_0xc851('0x34')]));if(_0x656a75[_0xc851('0x112')]===0x0){return this[_0xc851('0xaa')](_0x656a75);}_0x656a75[_0xc851('0x112')]-=0x1;if(!this[_0xc851('0x8a')](_0x656a75[_0xc851('0x113')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x656a75,_0xc851('0x114'));}var _0x117583=this[_0xc851('0x1d')][_0xc851('0x73')](this,_0x656a75[_0xc851('0x113')]);if(!_0x117583){return this[_0xc851('0xd')][_0xc851('0x30')](_0x656a75,_0xc851('0x115'));}if(!this['isConfigured'](_0x656a75[_0xc851('0xd9')])){return this[_0xc851('0xd')][_0xc851('0x30')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x196bfd=this[_0xc851('0xd')]['getData'](_0x117583,_0x656a75[_0xc851('0x116')],_0x656a75['maxdigit']);var _0x534faf=_0x196bfd[_0xc851('0xa9')]?_0x196bfd[_0xc851('0xa9')][_0xc851('0x4c')]():'';logger[_0xc851('0x2b')](_0xc851('0x117'),JSON['stringify'](_0x196bfd));if(_0x196bfd[_0xc851('0xa9')]===-0x1){this[_0xc851('0x32')][_0xc851('0x73')](this,_0x656a75,_0x534faf);return _0x196bfd;}else if(_0x196bfd[_0xc851('0xa7')]===_0xc851('0x69')){_0x196bfd['result']=_0x534faf[_0xc851('0xa3')]>=parseInt(_0x656a75[_0xc851('0x118')])?'x':'i';}else{_0x196bfd[_0xc851('0xa9')]=_0x534faf[_0xc851('0xa3')]>=parseInt(_0x656a75[_0xc851('0x118')])&&_0x534faf[_0xc851('0xa3')]<=parseInt(_0x656a75['maxdigit'])?'x':'i';}var _0x3b46bc=this[_0xc851('0x11')][_0xc851('0x73')](this,_0x656a75[_0xc851('0xd9')]);if(!_0x3b46bc){return this[_0xc851('0xd')][_0xc851('0x30')](_0x656a75,_0xc851('0xdb'));}this[_0xc851('0xd')][_0xc851('0xa4')](_0x3b46bc,_0x534faf);if(this['isConfigured'](_0x656a75[_0xc851('0x119')])){var _0x42d68d=parseInt(_0x656a75['hiddendigitsnum'],0xa);var _0x3050c3=rs[_0xc851('0x11a')]({'charset':'*','length':_0x42d68d});var _0x4671fe=_0x534faf[_0xc851('0xa3')];if(_0x4671fe>0x0){if(_0x4671fe>_0x42d68d){this[_0xc851('0x32')][_0xc851('0x73')](this,_0x656a75,_0x656a75[_0xc851('0x11b')]===_0xc851('0x11c')?_0x3050c3+_0x534faf[_0xc851('0x11d')](_0x42d68d):_0x534faf[_0xc851('0x11d')](0x0,_0x4671fe-_0x42d68d)+_0x3050c3);}else{this[_0xc851('0x32')][_0xc851('0x73')](this,_0x656a75,rs[_0xc851('0x11a')]({'charset':'*','length':_0x4671fe}));}}else{this[_0xc851('0x32')]['sync'](this,_0x656a75,'');}}else{this['createSquareDetailsReport'][_0xc851('0x73')](this,_0x656a75,_0x534faf);}return _0x196bfd;};AGIVertices[_0xc851('0x10')][_0xc851('0x11e')]=function(_0x7b0ab4){logger[_0xc851('0x2b')](util[_0xc851('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x7b0ab4[_0xc851('0x34')]));return this[_0xc851('0x111')](_0x7b0ab4);};AGIVertices[_0xc851('0x10')][_0xc851('0x11f')]=function(_0x41ed98){logger[_0xc851('0x2b')](util['format'](_0xc851('0x120'),_0x41ed98[_0xc851('0x34')]));this[_0xc851('0x32')][_0xc851('0x73')](this,_0x41ed98,_0x41ed98[_0xc851('0x121')]);return this[_0xc851('0xd')][_0xc851('0xad')](util['format'](_0xc851('0x122'),_0x41ed98[_0xc851('0x121')]));};AGIVertices[_0xc851('0x10')][_0xc851('0x123')]=function(_0x1b0497){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x124'),_0x1b0497[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x1b0497[_0xc851('0x92')])||!this[_0xc851('0x8a')](_0x1b0497[_0xc851('0x93')])){return this[_0xc851('0xd')]['noop'](_0xc851('0x125'));}if(!this[_0xc851('0x8a')](_0x1b0497[_0xc851('0x62')])){return this[_0xc851('0xd')]['noop'](_0xc851('0xc8'));}this[_0xc851('0xd')]['noop'](util[_0xc851('0x27')](_0xc851('0x126'),_0x1b0497[_0xc851('0x62')]));var _0xfafc14=this[_0xc851('0x8c')][_0xc851('0x73')](this,_0x1b0497);if(_0xfafc14){this[_0xc851('0xd')][_0xc851('0xad')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0xfafc14));var _0x48f60d=this[_0xc851('0xd')][_0xc851('0x127')](_0xfafc14);try{fs[_0xc851('0x102')](_0xfafc14+_0xc851('0x103'));}catch(_0x5f0694){logger[_0xc851('0x30')](_0x5f0694);}return _0x48f60d;}return this[_0xc851('0xd')][_0xc851('0x30')](_0x1b0497,_0xc851('0x128'));};AGIVertices[_0xc851('0x10')]['awslex']=function(_0x5394a1){logger[_0xc851('0x2b')](util[_0xc851('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5394a1['label']));if(!this[_0xc851('0x8a')](_0x5394a1[_0xc851('0x92')])||!this['isConfigured'](_0x5394a1[_0xc851('0x93')])){return this['channel'][_0xc851('0xad')](_0xc851('0x125'));}if(!this[_0xc851('0x8a')](_0x5394a1[_0xc851('0x129')])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0x12a'));}if(!this[_0xc851('0x8a')](_0x5394a1[_0xc851('0x62')])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0xc8'));}this[_0xc851('0xd')][_0xc851('0xeb')]=!![];this['createSquareDetailsReport'](_0x5394a1);this[_0xc851('0x40')](_0x5394a1[_0xc851('0x62')],'in','','');this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x12b'),_0x5394a1[_0xc851('0x62')]));var _0xf2c3be=this['awsLex']['sync'](this,_0x5394a1);if(_0xf2c3be){for(var _0x568ba7 in _0xf2c3be){if(_0xf2c3be[_0xc851('0xa1')](_0x568ba7)&&_['isString'](_0xf2c3be[_0x568ba7])){this[_0xc851('0xd')]['setVariable'](util[_0xc851('0x27')]('AWS_LEX_%s',_0x568ba7[_0xc851('0x100')]()),_0xf2c3be[_0x568ba7]);}}if(_['isNil'](_0xf2c3be[_0xc851('0x7a')])){return this[_0xc851('0xd')]['noop'](_0xc851('0x12c'));}else{this[_0xc851('0x40')](_0xf2c3be[_0xc851('0x7a')],_0xc851('0xef'),_0xc851('0x12d'),'');return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x12e'),_0xf2c3be[_0xc851('0x7a')]));}}return this[_0xc851('0xd')]['error'](_0x5394a1,_0xc851('0x12f'));};AGIVertices[_0xc851('0x10')][_0xc851('0x130')]=function(_0x141b0c){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x131'),_0x141b0c[_0xc851('0x34')],_0x141b0c['timeout']));if(!this['isConfigured'](_0x141b0c[_0xc851('0x7e')])){return this[_0xc851('0xd')][_0xc851('0xad')]('no\x20key\x20configured');}var _0x26c2f7=_0xc851('0x132');var _0x1b7d7b=util['format'](_0xc851('0x133'),FILES_PATH,rs[_0xc851('0x11a')](0x4));var _0x48fa0a=util[_0xc851('0x27')](_0xc851('0xa2'),_0x1b7d7b,_0x26c2f7);var _0x5b2d07=!![];if(_0x141b0c[_0xc851('0x134')]===_0xc851('0x135')){_0x5b2d07=![];}var _0x3e55b2=this[_0xc851('0xd')][_0xc851('0x136')](_0x1b7d7b,_0x26c2f7,_0x141b0c['intKey'],_0x141b0c[_0xc851('0x69')],undefined,_0x5b2d07);if(_0x3e55b2[_0xc851('0xa9')]!==-0x1){this['channel'][_0xc851('0xad')](util[_0xc851('0x27')]('google\x20%s\x20file\x20created',_0x48fa0a));var _0x544ad1=this[_0xc851('0x95')][_0xc851('0x73')](this,_0x141b0c,_0x48fa0a);if(_0x544ad1){for(var _0x511c7 in _0x544ad1){if(_0x544ad1[_0xc851('0xa1')](_0x511c7)){this[_0xc851('0xd')]['setVariable'](util[_0xc851('0x27')]('GOOGLE_ASR_%s',_0x511c7[_0xc851('0x100')]()),_0x544ad1[_0x511c7]);}}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('GoogleASR\x20Result\x20%s',JSON[_0xc851('0x76')](_0x544ad1)));}}return _0x3e55b2;};AGIVertices[_0xc851('0x10')]['tildeasr']=function(_0x4c8564){logger['info'](util[_0xc851('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4c8564[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x4c8564[_0xc851('0x137')])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0x138'));}if(!this[_0xc851('0x8a')](_0x4c8564[_0xc851('0x97')])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0x139'));}var _0x37d972=_0xc851('0x132');var _0x4278fc=util[_0xc851('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4ad2d3=util[_0xc851('0x27')](_0xc851('0xa2'),_0x4278fc,_0x37d972);var _0x4c47e7=!![];if(_0x4c8564[_0xc851('0x134')]==='NOBEEP'){_0x4c47e7=![];}var _0x5c5bce=this[_0xc851('0xd')][_0xc851('0x136')](_0x4278fc,_0x37d972,_0x4c8564[_0xc851('0x13a')],_0x4c8564[_0xc851('0x69')],undefined,_0x4c47e7);if(_0x5c5bce[_0xc851('0xa9')]!==-0x1){this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x13b'),_0x4ad2d3));var _0x2154ba=this['tildeASR'][_0xc851('0x73')](this,_0x4c8564,_0x4ad2d3);if(_0x2154ba){for(var _0xe56b4d in _0x2154ba){if(_0x2154ba[_0xc851('0xa1')](_0xe56b4d)){this[_0xc851('0xd')][_0xc851('0xa4')](util['format'](_0xc851('0x13c'),_0xe56b4d[_0xc851('0x100')]()),_0x2154ba[_0xe56b4d]);}}return this[_0xc851('0xd')]['noop'](util[_0xc851('0x27')](_0xc851('0x13d'),JSON['stringify'](_0x2154ba)));}}return _0x5c5bce;};AGIVertices[_0xc851('0x10')][_0xc851('0x13e')]=function(_0x39e984){logger['info'](util[_0xc851('0x27')](_0xc851('0x13f'),_0x39e984[_0xc851('0x34')]));return this[_0xc851('0xd')]['continueAt'](_0x39e984['context'],_0x39e984['extension'],_0x39e984[_0xc851('0x3c')]);};AGIVertices[_0xc851('0x10')][_0xc851('0x140')]=function(_0x372904){logger[_0xc851('0x2b')](util['format'](_0xc851('0x141'),_0x372904[_0xc851('0x34')]));if(!this['isConfigured'](_0x372904[_0xc851('0x142')])){return this['channel'][_0xc851('0x30')](_0x372904,_0xc851('0x143'));}try{var _0x362ddc=eval(_0x372904['condition'])?_0xc851('0x144'):_0xc851('0x145');this['channel'][_0xc851('0xad')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x372904[_0xc851('0x142')],_0x362ddc));return{'code':0xc8,'result':_0x362ddc};}catch(_0x153bc3){return{'code':0xc8,'result':_0xc851('0x145')};}};AGIVertices['prototype'][_0xc851('0x146')]=function(_0x12ca38){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x147'),_0x12ca38[_0xc851('0x34')]));if(!this['isConfigured'](_0x12ca38['interval_id'])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x12ca38,_0xc851('0x148'));}var _0x305712=this[_0xc851('0x23')][_0xc851('0x73')](this,_0x12ca38[_0xc851('0x149')]);if(!_0x305712){return this[_0xc851('0xd')][_0xc851('0x30')](_0x12ca38,_0xc851('0x14a'));}for(var _0xed4ef4=0x0;_0xed4ef4<_0x305712[_0xc851('0xa3')];_0xed4ef4+=0x1){var _0x26bbbf=this[_0xc851('0xd')]['getVariable'](util[_0xc851('0x27')](_0xc851('0x14b'),_0x305712[_0xed4ef4]));if(_0x26bbbf[_0xc851('0xa9')]===-0x1){return _0x26bbbf;}logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x14c'),_0x305712[_0xed4ef4],_0x26bbbf[_0xc851('0xa7')]));if(_0x26bbbf[_0xc851('0xa7')]==='true'){logger['info'](util[_0xc851('0x27')](_0xc851('0x14c'),_0x305712[_0xed4ef4],'true'));this[_0xc851('0xd')]['noop'](util[_0xc851('0x27')](_0xc851('0x14c'),_0x305712[_0xed4ef4],_0xc851('0x144')));return{'code':0xc8,'result':'true'};}else{logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x14c'),_0x305712[_0xed4ef4],_0xc851('0x145')));this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x14c'),_0x305712[_0xed4ef4],_0xc851('0x145')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xc851('0x14d')]=function(_0x2741b5){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x14e'),_0x2741b5[_0xc851('0x34')]));return this[_0xc851('0xd')][_0xc851('0x14d')]();};AGIVertices[_0xc851('0x10')]['ispeechasr']=function(_0x58f0da){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x14f'),_0x58f0da[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x58f0da[_0xc851('0x7e')])){return this[_0xc851('0xd')][_0xc851('0xad')]('no\x20key\x20configured');}var _0x41dc07=_0xc851('0x132');var _0x23c820=util[_0xc851('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xc851('0x11a')](0x4));var _0x1c68ce=util[_0xc851('0x27')](_0xc851('0xa2'),_0x23c820,_0x41dc07);var _0x5875f0=!![];if(_0x58f0da['beep']===_0xc851('0x135')){_0x5875f0=![];}var _0x1d0127=this[_0xc851('0xd')][_0xc851('0x136')](_0x23c820,_0x41dc07,_0x58f0da[_0xc851('0x13a')],_0x58f0da[_0xc851('0x69')],undefined,_0x5875f0);if(_0x1d0127['result']!==-0x1){this['channel'][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x150'),_0x1c68ce));var _0x314b03=this[_0xc851('0x89')][_0xc851('0x73')](this,_0x58f0da,_0x1c68ce);if(_0x314b03){for(var _0x19df76 in _0x314b03){if(_0x314b03['hasOwnProperty'](_0x19df76)){this[_0xc851('0xd')][_0xc851('0xa4')](util[_0xc851('0x27')]('ISPEECH_ASR_%s',_0x19df76[_0xc851('0x100')]()),_0x314b03[_0x19df76]);}}return this['channel'][_0xc851('0xad')](util[_0xc851('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0xc851('0x76')](_0x314b03)));}}return _0x1d0127;};AGIVertices[_0xc851('0x10')][_0xc851('0x151')]=function(_0x539770){logger[_0xc851('0x2b')](util[_0xc851('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x539770['label']));if(!this[_0xc851('0x8a')](_0x539770['key'])){return this[_0xc851('0xd')]['noop'](_0xc851('0x152'));}if(!this['isConfigured'](_0x539770[_0xc851('0x62')])){return this[_0xc851('0xd')][_0xc851('0xad')]('no\x20text\x20configured');}this[_0xc851('0xd')]['noop'](util['format'](_0xc851('0x153'),_0x539770['text']));var _0x3a8301=this[_0xc851('0x85')][_0xc851('0x73')](this,_0x539770);if(_0x3a8301){this[_0xc851('0xd')]['noop'](util[_0xc851('0x27')](_0xc851('0x150'),_0x3a8301));var _0x46228e=this[_0xc851('0xd')][_0xc851('0x127')](_0x3a8301,_0x539770[_0xc851('0x13a')]);try{fs['unlink'](_0x3a8301+_0xc851('0x103'));}catch(_0x46d420){logger['error'](_0x46d420);}return _0x46228e;}return this[_0xc851('0xd')]['error'](_0x539770,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc851('0x10')][_0xc851('0x154')]=function(_0x152092){logger['info'](util[_0xc851('0x27')](_0xc851('0x155'),_0x152092[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x152092[_0xc851('0x156')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x152092,_0xc851('0x157'));}logger[_0xc851('0x2b')](util['format'](_0xc851('0x158'),this['channel'][_0xc851('0x37')],_0x152092[_0xc851('0x156')]));var _0x4b0017=this[_0xc851('0x5c')][_0xc851('0x73')](this,_0x152092[_0xc851('0x156')]);if(_0x4b0017){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x159'),this[_0xc851('0xd')][_0xc851('0x37')],_0x152092[_0xc851('0x156')]));this['channel']['noop'](util[_0xc851('0x27')](_0xc851('0x159'),this[_0xc851('0xd')]['callerid'],_0x152092[_0xc851('0x156')]));return{'code':0xc8,'result':_0xc851('0x15a')};}else{logger[_0xc851('0x2b')](util[_0xc851('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc851('0xd')][_0xc851('0x37')],_0x152092['findBy']));this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x15b'),this['channel'][_0xc851('0x37')],_0x152092[_0xc851('0x156')]));return{'code':0xc8,'result':_0xc851('0x15c')};}};AGIVertices[_0xc851('0x10')][_0xc851('0x15d')]=function(_0x5ca3c0){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x15e'),_0x5ca3c0[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x5ca3c0['findBy'])){return this['channel']['error'](_0x5ca3c0,_0xc851('0x157'));}logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x158'),this[_0xc851('0xd')][_0xc851('0x37')],_0x5ca3c0[_0xc851('0x156')]));var _0x148577=this[_0xc851('0x5b')][_0xc851('0x73')](this,_0x5ca3c0['findBy']);if(_0x148577){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x159'),this[_0xc851('0xd')]['callerid'],_0x5ca3c0[_0xc851('0x156')]));this[_0xc851('0xd')][_0xc851('0xad')](util['format'](_0xc851('0x159'),this['channel'][_0xc851('0x37')],_0x5ca3c0[_0xc851('0x156')]));return{'code':0xc8,'result':_0xc851('0x15a')};}else{logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x15b'),this[_0xc851('0xd')][_0xc851('0x37')],_0x5ca3c0[_0xc851('0x156')]));this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x15b'),this[_0xc851('0xd')]['callerid'],_0x5ca3c0['findBy']));return{'code':0xc8,'result':_0xc851('0x15c')};}};AGIVertices[_0xc851('0x10')][_0xc851('0x15f')]=function(_0x4ae2f2){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x160'),_0x4ae2f2[_0xc851('0x34')]));if(!this['isConfigured'](_0x4ae2f2['operation'])){return this['channel'][_0xc851('0x30')](_0x4ae2f2,_0xc851('0x161'));}this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x162'),_0x4ae2f2[_0xc851('0x163')]));var _0x4b6c52=eval(_0x4ae2f2['operation']);if(!this[_0xc851('0x8a')](_0x4ae2f2[_0xc851('0xd9')])){return this['channel']['noop'](_0xc851('0xda'));}var _0x230aa5=this[_0xc851('0x11')][_0xc851('0x73')](this,_0x4ae2f2['variable_id']);if(!_0x230aa5){return this['channel'][_0xc851('0x30')](_0x4ae2f2,_0xc851('0xdb'));}if(_['isArray'](_0x4b6c52)){var _0x4fafea=this;_0x4b6c52['forEach'](function(_0x5f16cb,_0x9be480){_0x4fafea['channel'][_0xc851('0xa4')](util['format'](_0xc851('0x164'),_0x230aa5,_0x9be480),_0x5f16cb);});return this[_0xc851('0xd')]['noop'](util['format'](_0xc851('0x165'),_0x230aa5));}else{return this[_0xc851('0xd')]['setVariable'](_0x230aa5,_0x4b6c52);}};AGIVertices[_0xc851('0x10')][_0xc851('0xc')]=function(_0x550c71){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x166'),_0x550c71[_0xc851('0x34')]));if(_0x550c71[_0xc851('0x112')]===0x0){return this['maxRetry'](_0x550c71);}_0x550c71[_0xc851('0x112')]-=0x1;if(!this[_0xc851('0x8a')](_0x550c71[_0xc851('0x113')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x550c71,_0xc851('0x114'));}var _0xbd244d=this[_0xc851('0x1d')][_0xc851('0x73')](this,_0x550c71['file_id']);if(!_0xbd244d){return this[_0xc851('0xd')]['error'](_0x550c71,_0xc851('0x115'));}var _0xb081a8=this[_0xc851('0xd')][_0xc851('0x167')](_0xbd244d,_0x550c71[_0xc851('0x116')],_0x550c71[_0xc851('0x168')]);var _0xa482ce=_0xb081a8[_0xc851('0xa9')];if(_0xb081a8[_0xc851('0xa9')]===-0x1){this[_0xc851('0x32')]['sync'](this,_0x550c71,'-1');return _0xb081a8;}else if(_0xb081a8['extra']===_0xc851('0x69')){_0xb081a8[_0xc851('0xa9')]=_0xb081a8[_0xc851('0xa9')][_0xc851('0xa3')]>0x0?_0xb081a8['result']:'t';}else if(_['isEmpty'](_0xb081a8[_0xc851('0xa9')])){_0xb081a8['result']='#';_0xa482ce='#';}if(!this[_0xc851('0x8a')](_0x550c71['variable_id'])){this[_0xc851('0xd')]['noop'](_0xc851('0xda'));}else{var _0x4d20b5=this[_0xc851('0x11')][_0xc851('0x73')](this,_0x550c71[_0xc851('0xd9')]);if(!_0x4d20b5){return this[_0xc851('0xd')][_0xc851('0x30')](_0x550c71,_0xc851('0xdb'));}this['channel'][_0xc851('0xa4')](_0x4d20b5,_0xa482ce);}this[_0xc851('0x32')][_0xc851('0x73')](this,_0x550c71,_0xa482ce);return _0xb081a8;};AGIVertices[_0xc851('0x10')][_0xc851('0xad')]=function(_0xdb74e7){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x169'),_0xdb74e7[_0xc851('0x34')]));return this[_0xc851('0xd')][_0xc851('0xad')](_0xdb74e7[_0xc851('0x16a')]||_0xdb74e7[_0xc851('0x34')]);};AGIVertices[_0xc851('0x10')][_0xc851('0x16b')]=function(_0x38fb13){logger['info'](util[_0xc851('0x27')](_0xc851('0x16c'),_0x38fb13[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x38fb13[_0xc851('0x156')])){return this[_0xc851('0xd')]['error'](_0x38fb13,_0xc851('0x157'));}logger['info'](util[_0xc851('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xc851('0x37')],_0x38fb13[_0xc851('0x156')]));var _0x5027c9=this[_0xc851('0x16d')]['sync'](this,_0x38fb13[_0xc851('0x16e')]);var _0x297d55=this['agentPause'][_0xc851('0x73')](this,_0x38fb13[_0xc851('0x156')],_0x5027c9);if(_0x297d55){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x159'),this[_0xc851('0xd')][_0xc851('0x37')],_0x38fb13[_0xc851('0x156')]));this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x159'),this[_0xc851('0xd')][_0xc851('0x37')],_0x38fb13[_0xc851('0x156')]));return{'code':0xc8,'result':_0xc851('0x15a')};}else{logger[_0xc851('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc851('0xd')]['callerid'],_0x38fb13[_0xc851('0x156')]));this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x159'),this['channel'][_0xc851('0x37')],_0x38fb13[_0xc851('0x156')]));return{'code':0xc8,'result':_0xc851('0x15c')};}};AGIVertices['prototype'][_0xc851('0x16f')]=function(_0xc75192){logger['info'](util[_0xc851('0x27')](_0xc851('0x170'),_0xc75192[_0xc851('0x34')]));if(!this['isConfigured'](_0xc75192[_0xc851('0x113')])){return this['channel']['error'](_0xc75192,_0xc851('0x114'));}var _0x289ed7=this[_0xc851('0x1d')][_0xc851('0x73')](this,_0xc75192[_0xc851('0x113')]);if(!_0x289ed7){return this[_0xc851('0xd')]['error'](_0xc75192,_0xc851('0x115'));}var _0x5e720d=this[_0xc851('0xd')]['exec'](_0xc851('0x171'),[_0x289ed7,_0xc75192[_0xc851('0x172')]]);if(_0x5e720d[_0xc851('0xa9')]===-0x1){return _0x5e720d;}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('Executed\x20command\x20%s\x20%s',_0xc851('0x171'),_0x289ed7));};AGIVertices[_0xc851('0x10')]['queue']=function(_0x2e472f){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x173'),_0x2e472f[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x2e472f['queue_id'])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x2e472f,_0xc851('0x174'));}var _0x179629='';var _0x1ebf7c=parseInt(_0x2e472f[_0xc851('0x175')],0xa);if(isNaN(_0x1ebf7c)){_0x179629=_0x2e472f[_0xc851('0x175')];}else{_0x179629=this[_0xc851('0x16')][_0xc851('0x73')](this,_0x2e472f['queue_id']);if(!_0x179629){return this[_0xc851('0xd')][_0xc851('0x30')](_0x2e472f,'no\x20queue\x20found');}}var _0x5cf330='';if(this[_0xc851('0x8a')](_0x2e472f[_0xc851('0x113')])){var _0xc4632b=this[_0xc851('0x1d')][_0xc851('0x73')](this,_0x2e472f[_0xc851('0x113')]);if(_0xc4632b){_0x5cf330=_0xc4632b;}}this[_0xc851('0x32')][_0xc851('0x73')](this,_0x2e472f,_0x179629);if(_0x2e472f[_0xc851('0x172')]['indexOf']('x')<0x0){_0x2e472f[_0xc851('0x172')]+='x';}if(_0x2e472f[_0xc851('0x172')][_0xc851('0x176')]('X')<0x0){_0x2e472f[_0xc851('0x172')]+='X';}this[_0xc851('0xd')][_0xc851('0xa4')](_0xc851('0x177'),_0x179629?_0x179629[_0xc851('0x178')]():'');var _0x8f27cd=this[_0xc851('0xd')]['exec'](_0xc851('0x179'),[_0x179629,_0x2e472f['opts'],_0x2e472f['url'],_0x5cf330,_0x2e472f[_0xc851('0x69')],_0x2e472f[_0xc851('0xba')],_0x2e472f[_0xc851('0x17a')],_0x2e472f['gosub'],'',_0x2e472f[_0xc851('0x17b')]]);if(_0x8f27cd[_0xc851('0xa9')]===-0x1){return _0x8f27cd;}return this['channel']['noop'](util[_0xc851('0x27')](_0xc851('0x17c'),_0xc851('0x179'),_0x179629));};AGIVertices['prototype'][_0xc851('0x17d')]=function(_0x55068b){logger['info'](util['format'](_0xc851('0x17e'),_0x55068b['label']));var _0x191aeb=_0x55068b['recordingFormat']||_0xc851('0x132');var _0x418e49=util[_0xc851('0x27')](_0xc851('0x17f'),this[_0xc851('0xd')][_0xc851('0x33')],rs[_0xc851('0x11a')](0x5));var _0x13eed7=util['format'](_0xc851('0x180'),FILES_PATH,_0x418e49,_0x191aeb);var _0x550eb9=util[_0xc851('0x27')](_0xc851('0x133'),FILES_PATH,_0x418e49);this[_0xc851('0x38')][_0xc851('0x73')](this,_0x55068b,_0x418e49,_0x13eed7);this[_0xc851('0xd')]['setVariable'](_0xc851('0x181'),_0x418e49);logger[_0xc851('0x2b')](_0xc851('0x182'),_0x550eb9,_0x191aeb,_0x55068b[_0xc851('0x183')],_0x55068b['timeout']);return this[_0xc851('0xd')]['recordFile'](_0x550eb9,_0x191aeb,_0x55068b['escape_digits'],_0x55068b[_0xc851('0x69')],undefined,!![]);};AGIVertices[_0xc851('0x10')]['restapi']=function(_0x2e8761){logger[_0xc851('0x2b')](util['format'](_0xc851('0x184'),_0x2e8761[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x2e8761[_0xc851('0x67')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x4f9f54=this[_0xc851('0x66')]['sync'](this,_0x2e8761);logger[_0xc851('0x2b')](util['format']('Response:',util[_0xc851('0x185')](_0x4f9f54,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2e8761['variable_id'])){return this['channel'][_0xc851('0xad')](_0xc851('0x186'));}var _0x4c9864=this[_0xc851('0x11')]['sync'](this,_0x2e8761[_0xc851('0xd9')]);if(!_0x4c9864){return this[_0xc851('0xd')][_0xc851('0x30')](_0x2e8761,_0xc851('0xdb'));}this['channel']['setVariable'](util[_0xc851('0x27')](_0xc851('0x187'),_0x4c9864),_0x4f9f54[_0xc851('0x78')]?_0x4f9f54[_0xc851('0x78')]:_0xc851('0x188'));this[_0xc851('0xd')][_0xc851('0xa4')](util[_0xc851('0x27')](_0xc851('0x189'),_0x4c9864),_0x4f9f54['statusMessage']?_0x4f9f54[_0xc851('0x79')]:'OK');if(_0x4f9f54[_0xc851('0x6d')]){try{this[_0xc851('0xa0')](_0x4f9f54[_0xc851('0x6d')],_0x4c9864);}catch(_0x5a8d99){logger[_0xc851('0x30')](util[_0xc851('0x27')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4c9864));}}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0xe0'),_0x4c9864));};AGIVertices['prototype'][_0xc851('0x18a')]=function(_0xbbd149){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x18b'),_0xbbd149[_0xc851('0x34')]));return this[_0xc851('0xd')][_0xc851('0x18c')](_0xbbd149[_0xc851('0x18d')][_0xc851('0x5e')](/\s+/g,''),_0xbbd149[_0xc851('0x183')]);};AGIVertices['prototype'][_0xc851('0x18e')]=function(_0x1b53f7){logger[_0xc851('0x2b')](util['format'](_0xc851('0x18f'),_0x1b53f7[_0xc851('0x34')]));return this[_0xc851('0xd')]['sayNumber'](_0x1b53f7[_0xc851('0x190')]['replace'](/\s+/g,''),_0x1b53f7[_0xc851('0x183')]);};AGIVertices[_0xc851('0x10')][_0xc851('0x191')]=function(_0x1b3064){logger['info'](util[_0xc851('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1b3064['label']));return this['channel'][_0xc851('0x192')](_0x1b3064[_0xc851('0x62')],_0x1b3064[_0xc851('0x183')]);};AGIVertices[_0xc851('0x10')][_0xc851('0x193')]=function(_0xa4b50c){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x194'),_0xa4b50c[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0xa4b50c[_0xc851('0x195')])){return this[_0xc851('0xd')]['noop']('no\x20mail\x20account\x20configured');}var _0x1134c3=this[_0xc851('0x20')]['sync'](this,_0xa4b50c[_0xc851('0x195')]);if(!_0x1134c3||!_0x1134c3[_0xc851('0x196')]){return this[_0xc851('0xd')][_0xc851('0x30')](_0xa4b50c,_0xc851('0x197'));}var _0x3ec942={'from':util['format'](_0xc851('0x198'),_0x1134c3['name'],_0x1134c3[_0xc851('0x199')]||_0x1134c3[_0xc851('0x196')][_0xc851('0x19a')]),'to':_0xa4b50c['to']||'','cc':_0xa4b50c['cc']||'','bcc':_0xa4b50c[_0xc851('0x19b')]||'','subject':_0xa4b50c[_0xc851('0x19c')],'html':_0xa4b50c[_0xc851('0x62')],'text':_0xa4b50c[_0xc851('0x62')]};var _0x2be4a7={'tls':{'rejectUnauthorized':![]}};if(_0x1134c3[_0xc851('0x196')][_0xc851('0x19d')]){_0x2be4a7[_0xc851('0x19d')]=_0x1134c3[_0xc851('0x196')][_0xc851('0x19d')];}else{_0x2be4a7[_0xc851('0x19e')]=_0x1134c3['Smtp'][_0xc851('0x19e')];_0x2be4a7[_0xc851('0x19f')]=_0x1134c3['Smtp']['port'];_0x2be4a7[_0xc851('0x1a0')]=_0x1134c3[_0xc851('0x196')][_0xc851('0x1a0')];}if(_0x1134c3['Smtp'][_0xc851('0x1a1')]){_0x2be4a7[_0xc851('0x1a2')]={'user':_0x1134c3[_0xc851('0x196')][_0xc851('0x19a')],'pass':_0x1134c3[_0xc851('0x196')][_0xc851('0x1a3')]};}if(this[_0xc851('0x8a')](_0xa4b50c[_0xc851('0x1a4')])){}logger[_0xc851('0xe2')](_0xc851('0x1a5'),JSON[_0xc851('0x76')](_0x3ec942));this['createSquareDetailsReport'][_0xc851('0x73')](this,_0xa4b50c,_0xa4b50c[_0xc851('0x195')]);this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x1a6'),_0x1134c3['name']));this[_0xc851('0x22')]['sync'](this,_0x2be4a7,_0x3ec942);return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0x1a7'));};AGIVertices[_0xc851('0x10')][_0xc851('0x1a8')]=function(_0x249407){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x1a9'),_0x249407[_0xc851('0x34')]));return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0x1aa'));};AGIVertices['prototype'][_0xc851('0x1ab')]=function(_0x4888ce){logger['info'](util[_0xc851('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4888ce[_0xc851('0x34')]));if(!this['isConfigured'](_0x4888ce[_0xc851('0x1ac')])){return this[_0xc851('0xd')]['noop'](_0xc851('0x1ad'));}var _0x5a9d09=this[_0xc851('0x1ae')]['sync'](this,_0x4888ce['sms_account_id']);if(!_0x5a9d09){return this[_0xc851('0xd')][_0xc851('0x30')](_0x4888ce,_0xc851('0x1af'));}var _0x3b24e2={'body':_0x4888ce['sms_text'],'phone':_0x4888ce['to']||'','SmsAccountId':_0x5a9d09['id']};logger['debug'](_0xc851('0x1b0'),JSON[_0xc851('0x76')](_0x3b24e2));this[_0xc851('0x32')]['sync'](this,_0x4888ce,_0x4888ce['sms_account_id']);this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5a9d09[_0xc851('0x14')]));this[_0xc851('0x31')][_0xc851('0x73')](this,_0x3b24e2);return this['channel'][_0xc851('0xad')](_0xc851('0x1b1'));};AGIVertices[_0xc851('0x10')]['set']=function(_0x14850f){logger['info'](util['format'](_0xc851('0x1b2'),_0x14850f[_0xc851('0x34')]));if(!this[_0xc851('0x8a')](_0x14850f[_0xc851('0xd9')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x14850f,_0xc851('0x1b3'));}var _0x544616=this[_0xc851('0x11')]['sync'](this,_0x14850f[_0xc851('0xd9')]);if(!_0x544616){return this[_0xc851('0xd')][_0xc851('0x30')](_0x14850f,_0xc851('0xdb'));}return this[_0xc851('0xd')][_0xc851('0xa4')](_0x544616,_0x14850f[_0xc851('0x1b4')]);};AGIVertices['prototype'][_0xc851('0x1b5')]=function(_0x309e){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x1b6'),_0x309e[_0xc851('0x34')]));this['channel'][_0xc851('0xad')](_0xc851('0x1b7'));if(_0x309e[_0xc851('0xbb')]==='yes'){this[_0xc851('0xd')]['noop'](_0xc851('0x1b8'));return this[_0xc851('0xd')][_0xc851('0xbb')]();}return this['channel'][_0xc851('0xad')]('Skipped\x20Answer');};AGIVertices[_0xc851('0x10')][_0xc851('0x1b9')]=function(_0x53d220){logger['info'](util[_0xc851('0x27')](_0xc851('0x1ba'),_0x53d220[_0xc851('0x34')]));if(!this['isConfigured'](_0x53d220[_0xc851('0x1bb')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x53d220,_0xc851('0x1bc'));}var _0x4e788f=this[_0xc851('0x1bd')][_0xc851('0x73')](this,_0x53d220[_0xc851('0x1bb')]);if(!this[_0xc851('0x8a')](_0x4e788f)){return this['channel'][_0xc851('0x30')](_0x53d220,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x53d220[_0xc851('0x1bb')]));}if(_0x4e788f===this[_0xc851('0xd')][_0xc851('0x36')]){return this['channel'][_0xc851('0x30')](_0x53d220,_0xc851('0x1be'));}this[_0xc851('0x32')]['sync'](this,_0x53d220,_0x4e788f);var _0xf8ebeb=this[_0xc851('0xd')][_0xc851('0xae')](_0xc851('0x1bf'),util[_0xc851('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xc851('0xba')][_0xc851('0x19e')]||_0xc851('0x1c0'),_0x4e788f,this[_0xc851('0xd')][_0xc851('0x36')]));if(_0xf8ebeb['result']===-0x1){return _0xf8ebeb;}return this[_0xc851('0xd')]['noop'](util['format'](_0xc851('0x17c'),_0xc851('0x1bf'),_0x4e788f));};AGIVertices[_0xc851('0x10')]['system']=function(_0x70f5dc){logger[_0xc851('0x2b')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x70f5dc[_0xc851('0x34')]));var _0x2b87b6=this[_0xc851('0x1c1')][_0xc851('0x73')](this,_0x70f5dc['command']);this['createSquareDetailsReport'][_0xc851('0x73')](this,_0x70f5dc,_0x70f5dc[_0xc851('0x1c2')]);if(this[_0xc851('0x8a')](_0x70f5dc[_0xc851('0xd9')])){var _0x416e39=this[_0xc851('0x11')][_0xc851('0x73')](this,_0x70f5dc[_0xc851('0xd9')]);if(_0x416e39){this[_0xc851('0xd')][_0xc851('0xa4')](_0x416e39,_0x2b87b6);return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x70f5dc['command'],_0x416e39));}}return this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x1c3'),_0x70f5dc[_0xc851('0x1c2')]));};AGIVertices[_0xc851('0x10')][_0xc851('0x1c4')]=function(_0x47dcd1){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x1c5'),_0x47dcd1[_0xc851('0x34')]));_0x47dcd1[_0xc851('0x62')]=_0x47dcd1[_0xc851('0x62')][_0xc851('0x5e')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x47dcd1[_0xc851('0x60')])){return this['channel']['noop'](_0xc851('0x1c6'));}if(!this['isConfigured'](_0x47dcd1['text'])){return this[_0xc851('0xd')][_0xc851('0xad')](_0xc851('0xc8'));}this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x1c7'),_0x47dcd1['text']));var _0x222a69=this[_0xc851('0x5f')][_0xc851('0x73')](this,_0x47dcd1);if(_0x222a69){this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x222a69));var _0x34908c=this[_0xc851('0xd')][_0xc851('0x127')](_0x222a69);try{fs[_0xc851('0x102')](_0x222a69+_0xc851('0x103'));}catch(_0x1c2148){logger['error'](_0x1c2148);}return _0x34908c;}return this[_0xc851('0xd')][_0xc851('0x30')](_0x47dcd1,_0xc851('0x1c8'));};AGIVertices['prototype'][_0xc851('0x1c9')]=function(_0x4b7d58){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x1ca'),_0x4b7d58['label']));_0x4b7d58[_0xc851('0x62')]=_0x4b7d58['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc851('0x8a')](_0x4b7d58[_0xc851('0x62')])){return this[_0xc851('0xd')]['noop'](_0xc851('0xc8'));}this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x1cb'),_0x4b7d58[_0xc851('0x62')]));var _0x51a80d=this[_0xc851('0x65')]['sync'](this,_0x4b7d58);if(_0x51a80d){this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x1cc'),_0x51a80d));var _0x3bb5e1=this['channel'][_0xc851('0x127')](_0x51a80d);try{fs[_0xc851('0x102')](_0x51a80d+'.wav');}catch(_0x346bcf){logger[_0xc851('0x30')](_0x346bcf);}return _0x3bb5e1;}return this[_0xc851('0xd')][_0xc851('0x30')](_0x4b7d58,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc851('0x10')][_0xc851('0x1cd')]=function(_0x5599ed){logger[_0xc851('0x2b')](util[_0xc851('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x5599ed['label']));if(!this[_0xc851('0x8a')](_0x5599ed[_0xc851('0x156')])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x5599ed,_0xc851('0x157'));}logger[_0xc851('0x2b')](util[_0xc851('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc851('0xd')][_0xc851('0x37')],_0x5599ed['findBy']));var _0x449b55=this['agentUnpause'][_0xc851('0x73')](this,_0x5599ed[_0xc851('0x156')]);if(_0x449b55){logger[_0xc851('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc851('0xd')][_0xc851('0x37')],_0x5599ed['findBy']));this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc851('0x37')],_0x5599ed[_0xc851('0x156')]));return{'code':0xc8,'result':_0xc851('0x15a')};}else{logger[_0xc851('0x2b')](util[_0xc851('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc851('0xd')]['callerid'],_0x5599ed[_0xc851('0x156')]));this[_0xc851('0xd')][_0xc851('0xad')](util[_0xc851('0x27')](_0xc851('0x15b'),this['channel'][_0xc851('0x37')],_0x5599ed['findBy']));return{'code':0xc8,'result':_0xc851('0x15c')};}};AGIVertices[_0xc851('0x10')]['voicemail']=function(_0xccf817){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x1ce'),_0xccf817[_0xc851('0x34')]));var _0x4aa074=this[_0xc851('0xd')][_0xc851('0xae')](_0xc851('0x1cf'),[_0xccf817['mailbox'],_0xccf817[_0xc851('0x7c')]]);if(_0x4aa074[_0xc851('0xa9')]===-0x1){return _0x4aa074;}return this['channel']['noop'](util['format'](_0xc851('0x17c'),'VOICEMAIL',_0xccf817['mailbox']));};AGIVertices[_0xc851('0x10')][_0xc851('0x1d0')]=function(_0x1209d3){logger[_0xc851('0x2b')](util[_0xc851('0x27')](_0xc851('0x1d1'),_0x1209d3['label']));if(!this['isConfigured'](_0x1209d3['variable_id'])){return this[_0xc851('0xd')][_0xc851('0x30')](_0x1209d3,'no\x20variable\x20selected');}var _0x577a10=this[_0xc851('0x11')][_0xc851('0x73')](this,_0x1209d3['variable_id']);if(!_0x577a10){return this[_0xc851('0xd')][_0xc851('0x30')](_0x1209d3,_0xc851('0xdb'));}var _0x74988f=this[_0xc851('0xd')]['getVariable'](_0x577a10);return{'code':0xc8,'result':_0x74988f[_0xc851('0xa7')]?_0x74988f[_0xc851('0xa7')]:'-'};};String['prototype'][_0xc851('0xa6')]=function(_0x3d5e7f,_0x404d2f){return this[_0xc851('0xa5')](_0x3d5e7f)[_0xc851('0x1d2')](_0x404d2f);};module[_0xc851('0x1d3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index f322386..672f195 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 _0x4862=['origtransfereruniqueid','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','agents','then','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','error','[%s][UPDATE][ERRORS:%s]','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','acwTimeout','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x51114b,_0x3f864e){var _0x5a837a=function(_0x469e6f){while(--_0x469e6f){_0x51114b['push'](_0x51114b['shift']());}};_0x5a837a(++_0x3f864e);}(_0x4862,0xb2));var _0x2486=function(_0x476b3b,_0x5e27ec){_0x476b3b=_0x476b3b-0x0;var _0x147935=_0x4862[_0x476b3b];return _0x147935;};'use strict';var util=require(_0x2486('0x0'));var _=require(_0x2486('0x1'));var moment=require(_0x2486('0x2'));var ami=require(_0x2486('0x3'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x2486('0x4'));var RpcVoiceAgentReport=require(_0x2486('0x5'));function Acw(_0x20a123){this[_0x2486('0x6')]=_0x20a123[_0x2486('0x6')];this['agents']=_0x20a123['agents'];this[_0x2486('0x7')]=_0x20a123[_0x2486('0x7')];this[_0x2486('0x8')]={};ami['on']('agentconnect',this[_0x2486('0x9')]['bind'](this));ami['on'](_0x2486('0xa'),this[_0x2486('0xb')][_0x2486('0xc')](this));ami['on'](_0x2486('0xd'),this[_0x2486('0xe')][_0x2486('0xc')](this));ami['on']('agentringnoanswer',this[_0x2486('0xf')][_0x2486('0xc')](this));ami['on'](_0x2486('0x10'),this[_0x2486('0x11')][_0x2486('0xc')](this));ami['on'](_0x2486('0x12'),this[_0x2486('0x13')][_0x2486('0xc')](this));ami['on'](_0x2486('0x14'),this[_0x2486('0x15')][_0x2486('0xc')](this));}function getDiff(_0x543552){var _0x370b78=moment()['milliseconds'](0x0);var _0x11cee8=moment(_0x543552)[_0x2486('0x16')](0x0);return _0x370b78[_0x2486('0x17')](_0x11cee8,_0x2486('0x18'));}Acw[_0x2486('0x19')][_0x2486('0x1a')]=function(_0x42399e){try{var _0x13cb00=this;var _0x350901=this[_0x2486('0x8')][_0x42399e][_0x2486('0x1b')];var _0x274625=this[_0x2486('0x8')][_0x42399e][_0x2486('0x1c')];var _0x58f5db=this['voiceQueues'][_0x274625];var _0x4870f8=![];var _0x93426b=_0x2486('0x1d');if(_0x58f5db[_0x2486('0x1e')]){if(_0x58f5db[_0x2486('0x1f')]['name']){_0x4870f8=!![];_0x93426b=_0x58f5db[_0x2486('0x1f')][_0x2486('0x20')];}}ami[_0x2486('0x21')]({'action':'QueuePause','interface':_0x350901,'paused':!![],'reason':_0x93426b})['then'](function(_0x3cd4d6){if(_0x13cb00['agents'][_0x350901]){return RpcUser['getAgent'](_0x13cb00[_0x2486('0x22')][_0x350901]['id'])[_0x2486('0x23')](function(_0x221b6c){if(_0x221b6c&&!_0x221b6c['voicePause']){logger['info'](_0x2486('0x24'),_0x42399e,_0x350901,_0x274625);var _0x21a372=_0x13cb00['channels'][_0x42399e][_0x2486('0x25')]&&_0x13cb00['channels'][_0x42399e][_0x2486('0x26')]?_0x13cb00[_0x2486('0x8')][_0x42399e][_0x2486('0x26')]:_0x42399e;return RpcUser[_0x2486('0x27')](_0x13cb00['agents'][_0x350901],_0x93426b,_0x21a372)['then'](function(_0x5a10b7){if(!_0x4870f8){_0x13cb00['timers'][_0x350901]={};logger['info'](_0x2486('0x28'),_0x42399e,_0x13cb00[_0x2486('0x6')][_0x274625]['acwTimeout'],_0x350901,_0x274625);_0x13cb00['timers'][_0x350901][_0x2486('0x29')]=setTimeout(_0x13cb00[_0x2486('0x2a')][_0x2486('0xc')](_0x13cb00,_0x350901),_0x13cb00[_0x2486('0x6')][_0x274625]['acwTimeout']*0x3e8);_0x13cb00[_0x2486('0x7')][_0x350901][_0x2486('0x2b')]=moment()[_0x2486('0x2c')](_0x2486('0x2d'));_0x13cb00[_0x2486('0x7')][_0x350901][_0x2486('0x2e')]=_0x42399e;_0x13cb00[_0x2486('0x7')][_0x350901][_0x2486('0x1c')]=_0x274625;_0x13cb00[_0x2486('0x7')][_0x350901][_0x2486('0x2f')]=function(){var _0x3036cf=getDiff(_0x13cb00[_0x2486('0x7')][_0x350901][_0x2486('0x2b')]);clearTimeout(_0x13cb00[_0x2486('0x7')][_0x350901][_0x2486('0x29')]);_0x13cb00[_0x2486('0x7')][_0x350901]['timer']=![];RpcVoiceAgentReport[_0x2486('0x30')]({'acwtime':_0x3036cf},_0x13cb00[_0x2486('0x7')][_0x350901]['uniqueid'],_0x350901)[_0x2486('0x23')](function(_0x102096){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x42399e,_0x3036cf,_0x102096);})['catch'](function(_0x38f262){logger[_0x2486('0x31')](_0x2486('0x32'),_0x42399e,_0x38f262);});delete _0x13cb00[_0x2486('0x7')][_0x350901];};}});}else{logger[_0x2486('0x33')](_0x2486('0x34'),_0x42399e,_0x350901,_0x274625);}});}})[_0x2486('0x35')](function(_0x16b802){logger[_0x2486('0x31')](_0x2486('0x28'),_0x42399e,_0x13cb00[_0x2486('0x6')][_0x274625][_0x2486('0x36')],_0x350901,_0x274625);})[_0x2486('0x37')](function(){delete _0x13cb00[_0x2486('0x8')][_0x42399e];});}catch(_0x45d898){logger['error'](_0x2486('0x38'),_0x45d898['message']);}};Acw[_0x2486('0x19')]['stopAcw']=function(_0x92c563){try{var _0x2f5a51=this;if(_0x2f5a51['timers'][_0x92c563]){_0x2f5a51[_0x2486('0x7')][_0x92c563][_0x2486('0x29')]=![];var _0xa13b17=_0x2f5a51[_0x2486('0x7')][_0x92c563][_0x2486('0x2e')];var _0x20d1ed=_0x2f5a51[_0x2486('0x7')][_0x92c563][_0x2486('0x1c')];var _0x13d1e8=_0x2f5a51[_0x2486('0x6')][_0x20d1ed][_0x2486('0x36')];logger[_0x2486('0x33')](_0x2486('0x39'),_0xa13b17,_0x92c563);RpcUser[_0x2486('0x3a')](this['agents'][_0x92c563]);RpcVoiceAgentReport[_0x2486('0x30')]({'acwtime':_0x13d1e8,'agentacw':!![]},_0xa13b17,_0x92c563)['then'](function(_0x31175f){logger[_0x2486('0x33')](_0x2486('0x3b'),_0xa13b17,_0x13d1e8,_0x31175f);})[_0x2486('0x35')](function(_0x521c3d){logger[_0x2486('0x31')](_0x2486('0x32'),_0xa13b17,_0x521c3d);});}else{logger[_0x2486('0x31')](_0x2486('0x3c'),_0x92c563);if(_0x2f5a51['timers']){logger[_0x2486('0x33')]('[ACW][TIMERS]',JSON[_0x2486('0x3d')](_0x2f5a51['timers']));}}}catch(_0x2ce65d){logger['error'](_0x2486('0x3e'),_0x2ce65d[_0x2486('0x3f')]);}};Acw[_0x2486('0x19')][_0x2486('0x9')]=function(_0x35e7e8){try{if(this[_0x2486('0x6')][_0x35e7e8['queue']]&&(this['voiceQueues'][_0x35e7e8['queue']]['acw']||this[_0x2486('0x6')][_0x35e7e8['queue']]['mandatoryDisposition'])){if(this[_0x2486('0x22')][_0x35e7e8[_0x2486('0x1b')]]){this[_0x2486('0x8')][_0x35e7e8[_0x2486('0x2e')]]={'queue':_0x35e7e8[_0x2486('0x1c')],'interface':_0x35e7e8['interface'],'destlinkedid':_0x35e7e8[_0x2486('0x26')]};}}}catch(_0x3869ad){logger[_0x2486('0x31')](_0x2486('0x40'),_0x3869ad['message']);}};Acw[_0x2486('0x19')][_0x2486('0x15')]=function(_0x31bcdc){try{if(this[_0x2486('0x6')][_0x31bcdc[_0x2486('0x1c')]]&&(this[_0x2486('0x6')][_0x31bcdc[_0x2486('0x1c')]][_0x2486('0x41')]||this['voiceQueues'][_0x31bcdc[_0x2486('0x1c')]][_0x2486('0x1e')])){if(this[_0x2486('0x22')][_0x31bcdc[_0x2486('0x1b')]]){this[_0x2486('0x8')][_0x31bcdc[_0x2486('0x2e')]]={'queue':_0x31bcdc[_0x2486('0x1c')],'interface':_0x31bcdc[_0x2486('0x1b')]};}}}catch(_0x28233e){logger['error'](_0x2486('0x42'),_0x28233e[_0x2486('0x3f')]);}};Acw[_0x2486('0x19')]['syncHangupRequest']=function(_0x44c6a3){try{if(this[_0x2486('0x8')][_0x44c6a3[_0x2486('0x2e')]]&&_[_0x2486('0x43')](this[_0x2486('0x8')][_0x44c6a3[_0x2486('0x2e')]][_0x2486('0x25')])){logger[_0x2486('0x33')](_0x2486('0x44'),_0x44c6a3[_0x2486('0x2e')]);this['startAcw'](_0x44c6a3['uniqueid']);}else if(this[_0x2486('0x8')][_0x44c6a3[_0x2486('0x45')]]&&_[_0x2486('0x43')](this[_0x2486('0x8')][_0x44c6a3[_0x2486('0x45')]]['attended'])){logger[_0x2486('0x33')](_0x2486('0x46'),_0x44c6a3[_0x2486('0x45')]);this[_0x2486('0x1a')](_0x44c6a3[_0x2486('0x45')]);}}catch(_0x2717a1){logger[_0x2486('0x31')](_0x2486('0x47'),_0x2717a1[_0x2486('0x3f')]);}};Acw['prototype'][_0x2486('0xe')]=function(_0x5875bd){try{if(this['channels'][_0x5875bd[_0x2486('0x2e')]]&&this[_0x2486('0x8')][_0x5875bd[_0x2486('0x2e')]][_0x2486('0x25')]){logger[_0x2486('0x33')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5875bd['uniqueid']);this['startAcw'](_0x5875bd[_0x2486('0x2e')]);}else if(this['channels'][_0x5875bd[_0x2486('0x45')]]&&this[_0x2486('0x8')][_0x5875bd[_0x2486('0x45')]][_0x2486('0x25')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5875bd[_0x2486('0x45')]);this[_0x2486('0x1a')](_0x5875bd[_0x2486('0x45')]);}}catch(_0x3ecea1){logger[_0x2486('0x31')](_0x2486('0x48'),_0x3ecea1[_0x2486('0x3f')]);}};Acw[_0x2486('0x19')][_0x2486('0x11')]=function(_0x32a087){try{if(!_[_0x2486('0x49')](this[_0x2486('0x8')][_0x32a087[_0x2486('0x4a')]])){this[_0x2486('0x1a')](_0x32a087[_0x2486('0x4a')]);if(this[_0x2486('0x8')][_0x32a087['secondtransfereruniqueid']]){this[_0x2486('0x8')][_0x32a087[_0x2486('0x4b')]]['attended']=!![];this[_0x2486('0x8')][_0x32a087['transfertargetuniqueid']]=this[_0x2486('0x8')][_0x32a087[_0x2486('0x4b')]];delete this[_0x2486('0x8')][_0x32a087[_0x2486('0x4b')]];}}else if(!_[_0x2486('0x49')](this[_0x2486('0x8')][_0x32a087[_0x2486('0x4c')]])){this['startAcw'](_0x32a087['transfertargetuniqueid']);if(this['channels'][_0x32a087[_0x2486('0x4d')]]){this['channels'][_0x32a087[_0x2486('0x4d')]]['attended']=!![];this['channels'][_0x32a087[_0x2486('0x4a')]]=this['channels'][_0x32a087[_0x2486('0x4d')]];delete this[_0x2486('0x8')][_0x32a087[_0x2486('0x4d')]];}}}catch(_0x338219){logger[_0x2486('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0x338219[_0x2486('0x3f')]);}};Acw['prototype'][_0x2486('0x13')]=function(_0xbcd34e){try{if(this['channels'][_0xbcd34e[_0x2486('0x4e')]]){logger[_0x2486('0x33')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0xbcd34e[_0x2486('0x4e')]));this[_0x2486('0x1a')](_0xbcd34e[_0x2486('0x4e')]);}else if(this[_0x2486('0x8')][_0xbcd34e[_0x2486('0x4f')]]){logger[_0x2486('0x33')](_0x2486('0x50'),JSON['stringify'](_0xbcd34e[_0x2486('0x4f')]));this['startAcw'](_0xbcd34e[_0x2486('0x4f')]);}}catch(_0x4d838e){logger[_0x2486('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x4d838e['message']);}};Acw[_0x2486('0x19')][_0x2486('0xf')]=function(_0x1517bc){try{if(this[_0x2486('0x6')][_0x1517bc[_0x2486('0x1c')]]&&this[_0x2486('0x6')][_0x1517bc[_0x2486('0x1c')]][_0x2486('0x51')]==='all'){if(this[_0x2486('0x22')][_0x1517bc['interface']]){logger[_0x2486('0x33')](_0x2486('0x52'),_0x1517bc[_0x2486('0x2e')],_0x1517bc['interface'],_0x1517bc[_0x2486('0x1c')]);return RpcUser['savePause'](this[_0x2486('0x22')][_0x1517bc['interface']],'Auto-Pause',_0x1517bc['uniqueid']);}}}catch(_0x23af40){logger['error'](_0x2486('0x53'),_0x23af40[_0x2486('0x3f')]);}};module[_0x2486('0x54')]=Acw; \ No newline at end of file +var _0x3e0f=['[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','interface','ACW','name','mandatoryDispositionPause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause'];(function(_0x22d54e,_0x18e6aa){var _0x3fb554=function(_0x6dbfb3){while(--_0x6dbfb3){_0x22d54e['push'](_0x22d54e['shift']());}};_0x3fb554(++_0x18e6aa);}(_0x3e0f,0x192));var _0xf3e0=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x3e0f[_0x173441];return _0x2423a8;};'use strict';var util=require(_0xf3e0('0x0'));var _=require('lodash');var moment=require(_0xf3e0('0x1'));var ami=require(_0xf3e0('0x2'));var logger=require('../../../config/logger')(_0xf3e0('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xf3e0('0x4'));function Acw(_0x261235){this['voiceQueues']=_0x261235[_0xf3e0('0x5')];this[_0xf3e0('0x6')]=_0x261235[_0xf3e0('0x6')];this['timers']=_0x261235[_0xf3e0('0x7')];this[_0xf3e0('0x8')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xf3e0('0x9')](this));ami['on']('hanguprequest',this[_0xf3e0('0xa')][_0xf3e0('0x9')](this));ami['on'](_0xf3e0('0xb'),this[_0xf3e0('0xc')][_0xf3e0('0x9')](this));ami['on'](_0xf3e0('0xd'),this[_0xf3e0('0xe')][_0xf3e0('0x9')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xf3e0('0x9')](this));ami['on'](_0xf3e0('0xf'),this['syncBlindTransfer'][_0xf3e0('0x9')](this));ami['on'](_0xf3e0('0x10'),this[_0xf3e0('0x11')][_0xf3e0('0x9')](this));}function getDiff(_0x1f7d52){var _0x37b9cc=moment()[_0xf3e0('0x12')](0x0);var _0x19cb37=moment(_0x1f7d52)[_0xf3e0('0x12')](0x0);return _0x37b9cc[_0xf3e0('0x13')](_0x19cb37,'seconds');}Acw[_0xf3e0('0x14')]['startAcw']=function(_0xae28eb){try{var _0x1cd677=this;var _0x38880e=this[_0xf3e0('0x8')][_0xae28eb][_0xf3e0('0x15')];var _0x2b913c=this[_0xf3e0('0x8')][_0xae28eb]['queue'];var _0x388e48=this['voiceQueues'][_0x2b913c];var _0xe16edc=![];var _0x48f41e=_0xf3e0('0x16');if(_0x388e48['mandatoryDisposition']){if(_0x388e48['mandatoryDispositionPause'][_0xf3e0('0x17')]){_0xe16edc=!![];_0x48f41e=_0x388e48[_0xf3e0('0x18')]['name'];}}ami['Action']({'action':'QueuePause','interface':_0x38880e,'paused':!![],'reason':_0x48f41e})[_0xf3e0('0x19')](function(_0x5cb712){if(_0x1cd677[_0xf3e0('0x6')][_0x38880e]){return RpcUser[_0xf3e0('0x1a')](_0x1cd677[_0xf3e0('0x6')][_0x38880e]['id'])['then'](function(_0xa042dc){if(_0xa042dc&&!_0xa042dc[_0xf3e0('0x1b')]){logger[_0xf3e0('0x1c')](_0xf3e0('0x1d'),_0xae28eb,_0x38880e,_0x2b913c);var _0x1580ca=_0x1cd677[_0xf3e0('0x8')][_0xae28eb][_0xf3e0('0x1e')]&&_0x1cd677[_0xf3e0('0x8')][_0xae28eb][_0xf3e0('0x1f')]?_0x1cd677[_0xf3e0('0x8')][_0xae28eb]['destlinkedid']:_0xae28eb;return RpcUser[_0xf3e0('0x20')](_0x1cd677[_0xf3e0('0x6')][_0x38880e],_0x48f41e,_0x1580ca)[_0xf3e0('0x19')](function(_0x3e20f8){if(!_0xe16edc){_0x1cd677[_0xf3e0('0x7')][_0x38880e]={};logger[_0xf3e0('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xae28eb,_0x1cd677[_0xf3e0('0x5')][_0x2b913c][_0xf3e0('0x21')],_0x38880e,_0x2b913c);_0x1cd677[_0xf3e0('0x7')][_0x38880e][_0xf3e0('0x22')]=setTimeout(_0x1cd677[_0xf3e0('0x23')]['bind'](_0x1cd677,_0x38880e),_0x1cd677[_0xf3e0('0x5')][_0x2b913c][_0xf3e0('0x21')]*0x3e8);_0x1cd677['timers'][_0x38880e][_0xf3e0('0x24')]=moment()[_0xf3e0('0x25')](_0xf3e0('0x26'));_0x1cd677[_0xf3e0('0x7')][_0x38880e]['uniqueid']=_0xae28eb;_0x1cd677[_0xf3e0('0x7')][_0x38880e][_0xf3e0('0x27')]=_0x2b913c;_0x1cd677['timers'][_0x38880e]['updateAcw']=function(){var _0x507431=getDiff(_0x1cd677[_0xf3e0('0x7')][_0x38880e]['lastPauseAt']);clearTimeout(_0x1cd677[_0xf3e0('0x7')][_0x38880e]['timer']);_0x1cd677[_0xf3e0('0x7')][_0x38880e]['timer']=![];RpcVoiceAgentReport[_0xf3e0('0x28')]({'acwtime':_0x507431},_0x1cd677['timers'][_0x38880e][_0xf3e0('0x29')],_0x38880e)['then'](function(_0x29e359){logger[_0xf3e0('0x1c')](_0xf3e0('0x2a'),_0xae28eb,_0x507431,_0x29e359);})[_0xf3e0('0x2b')](function(_0x2d7edb){logger[_0xf3e0('0x2c')](_0xf3e0('0x2d'),_0xae28eb,_0x2d7edb);});delete _0x1cd677['timers'][_0x38880e];};}});}else{logger['info'](_0xf3e0('0x2e'),_0xae28eb,_0x38880e,_0x2b913c);}});}})[_0xf3e0('0x2b')](function(_0x5d4d87){logger[_0xf3e0('0x2c')](_0xf3e0('0x2f'),_0xae28eb,_0x1cd677[_0xf3e0('0x5')][_0x2b913c][_0xf3e0('0x21')],_0x38880e,_0x2b913c);})['finally'](function(){delete _0x1cd677['channels'][_0xae28eb];});}catch(_0x3a11b1){logger[_0xf3e0('0x2c')]('[ACW][START]\x20%s',_0x3a11b1[_0xf3e0('0x30')]);}};Acw[_0xf3e0('0x14')][_0xf3e0('0x23')]=function(_0x156957){try{var _0x43cbb2=this;if(_0x43cbb2[_0xf3e0('0x7')][_0x156957]){_0x43cbb2[_0xf3e0('0x7')][_0x156957][_0xf3e0('0x22')]=![];var _0x5f253b=_0x43cbb2[_0xf3e0('0x7')][_0x156957][_0xf3e0('0x29')];var _0x402db9=_0x43cbb2[_0xf3e0('0x7')][_0x156957][_0xf3e0('0x27')];var _0x19188c=_0x43cbb2[_0xf3e0('0x5')][_0x402db9][_0xf3e0('0x21')];logger[_0xf3e0('0x1c')](_0xf3e0('0x31'),_0x5f253b,_0x156957);RpcUser[_0xf3e0('0x32')](this['agents'][_0x156957]);RpcVoiceAgentReport['update']({'acwtime':_0x19188c,'agentacw':!![]},_0x5f253b,_0x156957)[_0xf3e0('0x19')](function(_0x56b1fb){logger[_0xf3e0('0x1c')](_0xf3e0('0x2a'),_0x5f253b,_0x19188c,_0x56b1fb);})['catch'](function(_0x567c9c){logger[_0xf3e0('0x2c')](_0xf3e0('0x2d'),_0x5f253b,_0x567c9c);});}else{logger[_0xf3e0('0x2c')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x156957);if(_0x43cbb2[_0xf3e0('0x7')]){logger[_0xf3e0('0x1c')](_0xf3e0('0x33'),JSON['stringify'](_0x43cbb2['timers']));}}}catch(_0x1d308d){logger['error'](_0xf3e0('0x34'),_0x1d308d[_0xf3e0('0x30')]);}};Acw['prototype'][_0xf3e0('0x35')]=function(_0x5d5dc0){try{if(this[_0xf3e0('0x5')][_0x5d5dc0[_0xf3e0('0x27')]]&&(this[_0xf3e0('0x5')][_0x5d5dc0['queue']]['acw']||this[_0xf3e0('0x5')][_0x5d5dc0[_0xf3e0('0x27')]][_0xf3e0('0x36')])){if(this[_0xf3e0('0x6')][_0x5d5dc0[_0xf3e0('0x15')]]){this[_0xf3e0('0x8')][_0x5d5dc0[_0xf3e0('0x29')]]={'queue':_0x5d5dc0[_0xf3e0('0x27')],'interface':_0x5d5dc0[_0xf3e0('0x15')],'destlinkedid':_0x5d5dc0[_0xf3e0('0x1f')]};}}}catch(_0x5b8c90){logger[_0xf3e0('0x2c')]('[ACW][syncAgentConnect]\x20%s',_0x5b8c90[_0xf3e0('0x30')]);}};Acw['prototype'][_0xf3e0('0x11')]=function(_0x3206e9){try{if(this[_0xf3e0('0x5')][_0x3206e9['queue']]&&(this[_0xf3e0('0x5')][_0x3206e9[_0xf3e0('0x27')]][_0xf3e0('0x3')]||this[_0xf3e0('0x5')][_0x3206e9['queue']]['mandatoryDisposition'])){if(this[_0xf3e0('0x6')][_0x3206e9[_0xf3e0('0x15')]]){this['channels'][_0x3206e9[_0xf3e0('0x29')]]={'queue':_0x3206e9['queue'],'interface':_0x3206e9['interface']};}}}catch(_0x4e56a7){logger[_0xf3e0('0x2c')](_0xf3e0('0x37'),_0x4e56a7[_0xf3e0('0x30')]);}};Acw[_0xf3e0('0x14')][_0xf3e0('0xa')]=function(_0x446e60){try{if(this[_0xf3e0('0x8')][_0x446e60[_0xf3e0('0x29')]]&&_[_0xf3e0('0x38')](this['channels'][_0x446e60[_0xf3e0('0x29')]][_0xf3e0('0x1e')])){logger[_0xf3e0('0x1c')]('[%s][HANGUP:UNIQUEID]',_0x446e60[_0xf3e0('0x29')]);this[_0xf3e0('0x39')](_0x446e60['uniqueid']);}else if(this[_0xf3e0('0x8')][_0x446e60[_0xf3e0('0x3a')]]&&_[_0xf3e0('0x38')](this[_0xf3e0('0x8')][_0x446e60[_0xf3e0('0x3a')]][_0xf3e0('0x1e')])){logger[_0xf3e0('0x1c')](_0xf3e0('0x3b'),_0x446e60['linkedid']);this[_0xf3e0('0x39')](_0x446e60['linkedid']);}}catch(_0x43d36a){logger[_0xf3e0('0x2c')](_0xf3e0('0x3c'),_0x43d36a[_0xf3e0('0x30')]);}};Acw[_0xf3e0('0x14')]['syncHangup']=function(_0x30410c){try{if(this[_0xf3e0('0x8')][_0x30410c[_0xf3e0('0x29')]]&&this['channels'][_0x30410c['uniqueid']][_0xf3e0('0x1e')]){logger[_0xf3e0('0x1c')](_0xf3e0('0x3d'),_0x30410c[_0xf3e0('0x29')]);this[_0xf3e0('0x39')](_0x30410c[_0xf3e0('0x29')]);}else if(this[_0xf3e0('0x8')][_0x30410c['linkedid']]&&this[_0xf3e0('0x8')][_0x30410c[_0xf3e0('0x3a')]][_0xf3e0('0x1e')]){logger[_0xf3e0('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x30410c['linkedid']);this[_0xf3e0('0x39')](_0x30410c[_0xf3e0('0x3a')]);}}catch(_0x3fad8f){logger[_0xf3e0('0x2c')](_0xf3e0('0x3e'),_0x3fad8f[_0xf3e0('0x30')]);}};Acw[_0xf3e0('0x14')][_0xf3e0('0x3f')]=function(_0x2e45cc){try{if(!_['isNil'](this['channels'][_0x2e45cc[_0xf3e0('0x40')]])){this[_0xf3e0('0x39')](_0x2e45cc['transfereeuniqueid']);if(this['channels'][_0x2e45cc[_0xf3e0('0x41')]]){this[_0xf3e0('0x8')][_0x2e45cc[_0xf3e0('0x41')]]['attended']=!![];this[_0xf3e0('0x8')][_0x2e45cc[_0xf3e0('0x42')]]=this[_0xf3e0('0x8')][_0x2e45cc['secondtransfereruniqueid']];delete this[_0xf3e0('0x8')][_0x2e45cc['secondtransfereruniqueid']];}}else if(!_[_0xf3e0('0x43')](this[_0xf3e0('0x8')][_0x2e45cc['transfertargetuniqueid']])){this[_0xf3e0('0x39')](_0x2e45cc['transfertargetuniqueid']);if(this[_0xf3e0('0x8')][_0x2e45cc['origtransfereruniqueid']]){this[_0xf3e0('0x8')][_0x2e45cc[_0xf3e0('0x44')]][_0xf3e0('0x1e')]=!![];this[_0xf3e0('0x8')][_0x2e45cc['transfereeuniqueid']]=this[_0xf3e0('0x8')][_0x2e45cc[_0xf3e0('0x44')]];delete this[_0xf3e0('0x8')][_0x2e45cc[_0xf3e0('0x44')]];}}}catch(_0x3b8679){logger[_0xf3e0('0x2c')](_0xf3e0('0x45'),_0x3b8679[_0xf3e0('0x30')]);}};Acw[_0xf3e0('0x14')][_0xf3e0('0x46')]=function(_0x301297){try{if(this[_0xf3e0('0x8')][_0x301297[_0xf3e0('0x47')]]){logger[_0xf3e0('0x1c')](_0xf3e0('0x48'),JSON[_0xf3e0('0x49')](_0x301297[_0xf3e0('0x47')]));this[_0xf3e0('0x39')](_0x301297[_0xf3e0('0x47')]);}else if(this[_0xf3e0('0x8')][_0x301297[_0xf3e0('0x4a')]]){logger[_0xf3e0('0x1c')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x301297[_0xf3e0('0x4a')]));this[_0xf3e0('0x39')](_0x301297[_0xf3e0('0x4a')]);}}catch(_0x59acc8){logger['error'](_0xf3e0('0x4b'),_0x59acc8[_0xf3e0('0x30')]);}};Acw[_0xf3e0('0x14')][_0xf3e0('0xe')]=function(_0x1d7897){try{if(this['voiceQueues'][_0x1d7897[_0xf3e0('0x27')]]&&this[_0xf3e0('0x5')][_0x1d7897[_0xf3e0('0x27')]][_0xf3e0('0x4c')]==='all'){if(this['agents'][_0x1d7897['interface']]){logger[_0xf3e0('0x1c')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1d7897[_0xf3e0('0x29')],_0x1d7897[_0xf3e0('0x15')],_0x1d7897[_0xf3e0('0x27')]);return RpcUser[_0xf3e0('0x20')](this[_0xf3e0('0x6')][_0x1d7897[_0xf3e0('0x15')]],_0xf3e0('0x4d'),_0x1d7897[_0xf3e0('0x29')]);}}}catch(_0x973b){logger['error'](_0xf3e0('0x4e'),_0x973b[_0xf3e0('0x30')]);}};module[_0xf3e0('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 3184866..146ec05 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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x118f60,_0xe8650a){_0x118f60=_0x118f60-0x0;var _0xeeb9b4=_0x2032[_0x118f60];return _0xeeb9b4;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x408313,_0x30cfb2){var _0x26405=function(_0x4a58f2){while(--_0x4a58f2){_0x408313['push'](_0x408313['shift']());}};_0x26405(++_0x30cfb2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x41ed37,_0xbcd1d4){_0x41ed37=_0x41ed37-0x0;var _0x13f7ea=_0x0b0e[_0x41ed37];return _0x13f7ea;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 740ae93..d4baf8f 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 _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x46987e,_0x33fe12){var _0x1bdc48=function(_0x200cb7){while(--_0x200cb7){_0x46987e['push'](_0x46987e['shift']());}};_0x1bdc48(++_0x33fe12);}(_0xaa88,0x137));var _0x8aa8=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xaa88[_0x4b2863];return _0x567d67;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x33bd8f,_0xa85473){_0x33bd8f=_0x33bd8f-0x0;var _0x690e18=_0x9bde[_0x33bd8f];return _0x690e18;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 738cde8..1085b7a 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x001b=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','name','dialCutDigit','number','substring','getQueue','util','lodash','moment','string','isNil','voiceQueue','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x37b3db,_0x1bd6c2){var _0x1a0326=function(_0x231527){while(--_0x231527){_0x37b3db['push'](_0x37b3db['shift']());}};_0x1a0326(++_0x1bd6c2);}(_0x001b,0xf1));var _0xb001=function(_0x5dc731,_0x4e81c7){_0x5dc731=_0x5dc731-0x0;var _0x47eb85=_0x001b[_0x5dc731];return _0x47eb85;};'use strict';var util=require(_0xb001('0x0'));var _=require(_0xb001('0x1'));var moment=require(_0xb001('0x2'));function checkNameSurname(_0x4b1548,_0x4481af,_0x411a0f){var _0x28a10f='';if(!_['isNil'](_0x4481af)&&_0xb001('0x3')===typeof _0x4481af){_0x28a10f+=_0x4481af;}if(!_[_0xb001('0x4')](_0x411a0f)&&'string'===typeof _0x411a0f){_0x28a10f+='\x20'+_0x411a0f;}if(_0x28a10f!==''){return _0x28a10f;}return _0x4b1548;}function Action(_0x2749d3,_0x148cf1,_0x56b3ee){this[_0xb001('0x5')]=_0x2749d3;this['uniqueid']=_0x56b3ee||undefined;this['name']=checkNameSurname(_0x148cf1[_0xb001('0x6')][_0xb001('0x7')],_0x148cf1[_0xb001('0x6')][_0xb001('0x8')],_0x148cf1[_0xb001('0x6')][_0xb001('0x9')]);this['number']=_0x148cf1[_0xb001('0x6')]['phone'];this[_0xb001('0xa')]=_0x2749d3['name'];this[_0xb001('0xb')]=_0x148cf1[_0xb001('0xb')]||![];this[_0xb001('0xc')]=_0x2749d3['type'];this['dialQueueTimeout']=_0x2749d3[_0xb001('0xd')]||0x3;this[_0xb001('0xe')]=_0x148cf1[_0xb001('0xe')];this[_0xb001('0xf')]=_0x148cf1['countbusyretry'];this[_0xb001('0x10')]=_0x148cf1[_0xb001('0x10')];this[_0xb001('0x11')]=_0x148cf1['countnoanswerretry'];this[_0xb001('0x12')]=_0x148cf1['countnosuchnumberretry'];this[_0xb001('0x13')]=_0x148cf1[_0xb001('0x13')];this[_0xb001('0x14')]=_0x148cf1[_0xb001('0x14')];this[_0xb001('0x15')]=_0x148cf1[_0xb001('0x15')];this[_0xb001('0x16')]=_0x148cf1[_0xb001('0x16')];this[_0xb001('0x17')]=_0x148cf1[_0xb001('0x17')];this['ListId']=_0x148cf1[_0xb001('0x18')];this[_0xb001('0x19')]=_0x148cf1[_0xb001('0x19')];this[_0xb001('0x1a')]=_0x148cf1[_0xb001('0x1a')];this['CampaignId']=_0x148cf1[_0xb001('0x1b')];this[_0xb001('0x1c')]=_0x148cf1['id'];this[_0xb001('0x1d')]=_0x148cf1['Contact'][_0xb001('0x8')]||'';this[_0xb001('0x1e')]=moment()['format'](_0xb001('0x1f'));this[_0xb001('0x20')]=_0x148cf1[_0xb001('0x20')];this['callbackuniqueid']=_0x148cf1['callbackuniqueid'];this[_0xb001('0x21')]=_0x148cf1['callbackat'];this[_0xb001('0x22')]=_0x148cf1[_0xb001('0x22')];this['originatecalleridnum']='';this[_0xb001('0x23')]='';}Action[_0xb001('0x24')]['getCaller']=function(){return util[_0xb001('0x25')](_0xb001('0x26'),this[_0xb001('0x27')],this[_0xb001('0x5')][_0xb001('0x28')]>0x0?this[_0xb001('0x29')][_0xb001('0x2a')](this['voiceQueue']['dialCutDigit']):this[_0xb001('0x29')]);};Action[_0xb001('0x24')][_0xb001('0x2b')]=function(){return this[_0xb001('0xa')];};module['exports']=Action; \ No newline at end of file +var _0x8e60=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','voiceQueue','substring','getQueue','exports','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x25fcec,_0xae58ba){var _0x168439=function(_0x5eca3c){while(--_0x5eca3c){_0x25fcec['push'](_0x25fcec['shift']());}};_0x168439(++_0xae58ba);}(_0x8e60,0x1d4));var _0x08e6=function(_0x49f2a1,_0x2623e0){_0x49f2a1=_0x49f2a1-0x0;var _0x1d0ad3=_0x8e60[_0x49f2a1];return _0x1d0ad3;};'use strict';var util=require('util');var _=require(_0x08e6('0x0'));var moment=require(_0x08e6('0x1'));function checkNameSurname(_0xd6aaa,_0x6de79c,_0x3a45b0){var _0x2490f0='';if(!_[_0x08e6('0x2')](_0x6de79c)&&_0x08e6('0x3')===typeof _0x6de79c){_0x2490f0+=_0x6de79c;}if(!_[_0x08e6('0x2')](_0x3a45b0)&&_0x08e6('0x3')===typeof _0x3a45b0){_0x2490f0+='\x20'+_0x3a45b0;}if(_0x2490f0!==''){return _0x2490f0;}return _0xd6aaa;}function Action(_0x3cfdce,_0x6496f8,_0x411112){this['voiceQueue']=_0x3cfdce;this[_0x08e6('0x4')]=_0x411112||undefined;this[_0x08e6('0x5')]=checkNameSurname(_0x6496f8[_0x08e6('0x6')][_0x08e6('0x7')],_0x6496f8[_0x08e6('0x6')][_0x08e6('0x8')],_0x6496f8['Contact'][_0x08e6('0x9')]);this[_0x08e6('0xa')]=_0x6496f8[_0x08e6('0x6')][_0x08e6('0x7')];this[_0x08e6('0xb')]=_0x3cfdce[_0x08e6('0x5')];this[_0x08e6('0xc')]=_0x6496f8[_0x08e6('0xc')]||![];this['type']=_0x3cfdce[_0x08e6('0xd')];this[_0x08e6('0xe')]=_0x3cfdce[_0x08e6('0xe')]||0x3;this[_0x08e6('0xf')]=_0x6496f8[_0x08e6('0xf')];this[_0x08e6('0x10')]=_0x6496f8[_0x08e6('0x10')];this[_0x08e6('0x11')]=_0x6496f8[_0x08e6('0x11')];this[_0x08e6('0x12')]=_0x6496f8['countnoanswerretry'];this[_0x08e6('0x13')]=_0x6496f8[_0x08e6('0x13')];this[_0x08e6('0x14')]=_0x6496f8[_0x08e6('0x14')];this[_0x08e6('0x15')]=_0x6496f8[_0x08e6('0x15')];this[_0x08e6('0x16')]=_0x6496f8[_0x08e6('0x16')];this[_0x08e6('0x17')]=_0x6496f8[_0x08e6('0x17')];this[_0x08e6('0x18')]=_0x6496f8['ContactId'];this[_0x08e6('0x19')]=_0x6496f8[_0x08e6('0x19')];this[_0x08e6('0x1a')]=_0x6496f8[_0x08e6('0x1a')];this[_0x08e6('0x1b')]=_0x6496f8[_0x08e6('0x1b')];this['CampaignId']=_0x6496f8[_0x08e6('0x1c')];this[_0x08e6('0x1d')]=_0x6496f8['id'];this[_0x08e6('0x1e')]=_0x6496f8[_0x08e6('0x6')]['firstName']||'';this['starttime']=moment()['format'](_0x08e6('0x1f'));this[_0x08e6('0x20')]=_0x6496f8[_0x08e6('0x20')];this[_0x08e6('0x21')]=_0x6496f8[_0x08e6('0x21')];this[_0x08e6('0x22')]=_0x6496f8['callbackat'];this[_0x08e6('0x23')]=_0x6496f8['recallme'];this[_0x08e6('0x24')]='';this['originatecalleridname']='';}Action[_0x08e6('0x25')][_0x08e6('0x26')]=function(){return util[_0x08e6('0x27')](_0x08e6('0x28'),this[_0x08e6('0x5')],this[_0x08e6('0x29')]['dialCutDigit']>0x0?this['number'][_0x08e6('0x2a')](this[_0x08e6('0x29')]['dialCutDigit']):this[_0x08e6('0xa')]);};Action['prototype'][_0x08e6('0x2b')]=function(){return this[_0x08e6('0xb')];};module[_0x08e6('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 85971ea..380f2cb 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ffc=['state','statedesc','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds'];(function(_0x5cb444,_0x3307f7){var _0x4791fc=function(_0x15214c){while(--_0x15214c){_0x5cb444['push'](_0x5cb444['shift']());}};_0x4791fc(++_0x3307f7);}(_0x8ffc,0x143));var _0xc8ff=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x8ffc[_0x44268d];return _0x4be92d;};'use strict';var util=require(_0xc8ff('0x0'));var _=require(_0xc8ff('0x1'));var moment=require(_0xc8ff('0x2'));function getSeconds(_0x8cdf5f,_0x5039da){var _0x1ad0bc=moment(_0x8cdf5f)[_0xc8ff('0x3')](0x0);var _0x575c12=moment(_0x5039da)['milliseconds'](0x0);return _0x1ad0bc[_0xc8ff('0x4')](_0x575c12,_0xc8ff('0x5'));}function AgentComplete(_0x4eb101,_0x2b0a4b){this[_0xc8ff('0x6')]=0x4;this[_0xc8ff('0x7')]='Answer';this[_0xc8ff('0x8')]=_0x4eb101[_0xc8ff('0x8')];this['type']=_0x4eb101['type'];this[_0xc8ff('0x9')]=_0x4eb101[_0xc8ff('0xa')]===_0xc8ff('0xb')?_0xc8ff('0xc'):_0x4eb101[_0xc8ff('0xa')];this[_0xc8ff('0xd')]=_0x4eb101[_0xc8ff('0xd')];this[_0xc8ff('0xe')]=_0x4eb101[_0xc8ff('0xe')];this[_0xc8ff('0xf')]=_0x4eb101[_0xc8ff('0xf')];this[_0xc8ff('0x10')]=_0x4eb101[_0xc8ff('0xd')]+_0x4eb101[_0xc8ff('0xe')]+_0x4eb101['countnoanswerretry']+_0x4eb101[_0xc8ff('0x11')]+_0x4eb101[_0xc8ff('0x12')]+_0x4eb101[_0xc8ff('0x13')]+_0x4eb101[_0xc8ff('0x14')]+_0x4eb101['countagentrejectretry'];this[_0xc8ff('0x11')]=_0x4eb101[_0xc8ff('0x11')];this['countdropretry']=_0x4eb101[_0xc8ff('0x12')];this[_0xc8ff('0x13')]=_0x4eb101[_0xc8ff('0x13')];this[_0xc8ff('0x14')]=_0x4eb101['countmachineretry'];this[_0xc8ff('0x15')]=_0x4eb101[_0xc8ff('0x15')];this[_0xc8ff('0x16')]=_0x2b0a4b[_0xc8ff('0x16')];this['calleridname']=_0x4eb101[_0xc8ff('0x17')];this[_0xc8ff('0x18')]=_0x4eb101['number'];this[_0xc8ff('0x19')]=_0x4eb101[_0xc8ff('0x19')];this[_0xc8ff('0x1a')]=_0x4eb101[_0xc8ff('0x1a')];this[_0xc8ff('0x1b')]=_0x4eb101[_0xc8ff('0x1b')];this[_0xc8ff('0x1c')]=moment()[_0xc8ff('0x1d')](_0xc8ff('0x1e'));this['ringtime']=getSeconds(_0x4eb101[_0xc8ff('0x1a')],_0x4eb101[_0xc8ff('0x19')]);this[_0xc8ff('0x1f')]=getSeconds(_0x4eb101[_0xc8ff('0x1b')],_0x4eb101[_0xc8ff('0x1a')]);this[_0xc8ff('0x20')]=getSeconds(this[_0xc8ff('0x1c')],_0x4eb101[_0xc8ff('0x1b')]);this[_0xc8ff('0xc')]=_0x2b0a4b[_0xc8ff('0xc')];this[_0xc8ff('0x21')]=_0x2b0a4b[_0xc8ff('0x21')];this[_0xc8ff('0x22')]=_0x2b0a4b['reason'];this[_0xc8ff('0x23')]=_0x4eb101[_0xc8ff('0x23')];this['callbackuniqueid']=_0x4eb101[_0xc8ff('0x24')];this[_0xc8ff('0x25')]=_0x4eb101[_0xc8ff('0x25')];this[_0xc8ff('0x26')]=_0x4eb101['recallme'];this[_0xc8ff('0x27')]=_0x4eb101['ContactId'];this[_0xc8ff('0x28')]=_0x4eb101[_0xc8ff('0x28')];this[_0xc8ff('0x29')]=_0x4eb101[_0xc8ff('0x29')];this[_0xc8ff('0x2a')]=_0x4eb101[_0xc8ff('0x2a')];this[_0xc8ff('0x2b')]=_0x4eb101[_0xc8ff('0x2b')];this[_0xc8ff('0x2c')]=_0x4eb101['originatecalleridnum']||'';this[_0xc8ff('0x2d')]=_0x4eb101[_0xc8ff('0x2d')]||'';}module[_0xc8ff('0x2e')]=AgentComplete; \ No newline at end of file +var _0xcbbf=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type'];(function(_0x9ca5b8,_0x5307a9){var _0x412bf6=function(_0x5a1921){while(--_0x5a1921){_0x9ca5b8['push'](_0x9ca5b8['shift']());}};_0x412bf6(++_0x5307a9);}(_0xcbbf,0x14e));var _0xfcbb=function(_0x62c6da,_0x1b76f8){_0x62c6da=_0x62c6da-0x0;var _0x1109f7=_0xcbbf[_0x62c6da];return _0x1109f7;};'use strict';var util=require(_0xfcbb('0x0'));var _=require(_0xfcbb('0x1'));var moment=require(_0xfcbb('0x2'));function getSeconds(_0x1f627e,_0x20d028){var _0x5c610e=moment(_0x1f627e)[_0xfcbb('0x3')](0x0);var _0x1aa788=moment(_0x20d028)[_0xfcbb('0x3')](0x0);return _0x5c610e[_0xfcbb('0x4')](_0x1aa788,_0xfcbb('0x5'));}function AgentComplete(_0x3e66e3,_0x1cb4ec){this[_0xfcbb('0x6')]=0x4;this['statedesc']=_0xfcbb('0x7');this[_0xfcbb('0x8')]=_0x3e66e3[_0xfcbb('0x8')];this[_0xfcbb('0x9')]=_0x3e66e3[_0xfcbb('0x9')];this[_0xfcbb('0xa')]=_0x3e66e3[_0xfcbb('0x9')]===_0xfcbb('0xb')?_0xfcbb('0xc'):_0x3e66e3[_0xfcbb('0x9')];this[_0xfcbb('0xd')]=_0x3e66e3[_0xfcbb('0xd')];this[_0xfcbb('0xe')]=_0x3e66e3[_0xfcbb('0xe')];this[_0xfcbb('0xf')]=_0x3e66e3[_0xfcbb('0xf')];this['countglobal']=_0x3e66e3[_0xfcbb('0xd')]+_0x3e66e3[_0xfcbb('0xe')]+_0x3e66e3[_0xfcbb('0xf')]+_0x3e66e3[_0xfcbb('0x10')]+_0x3e66e3[_0xfcbb('0x11')]+_0x3e66e3[_0xfcbb('0x12')]+_0x3e66e3[_0xfcbb('0x13')]+_0x3e66e3['countagentrejectretry'];this[_0xfcbb('0x10')]=_0x3e66e3[_0xfcbb('0x10')];this[_0xfcbb('0x11')]=_0x3e66e3[_0xfcbb('0x11')];this[_0xfcbb('0x12')]=_0x3e66e3[_0xfcbb('0x12')];this[_0xfcbb('0x13')]=_0x3e66e3['countmachineretry'];this[_0xfcbb('0x14')]=_0x3e66e3['countagentrejectretry'];this[_0xfcbb('0x15')]=_0x1cb4ec[_0xfcbb('0x15')];this[_0xfcbb('0x16')]=_0x3e66e3['name'];this[_0xfcbb('0x17')]=_0x3e66e3[_0xfcbb('0x18')];this[_0xfcbb('0x19')]=_0x3e66e3[_0xfcbb('0x19')];this['responsetime']=_0x3e66e3[_0xfcbb('0x1a')];this[_0xfcbb('0x1b')]=_0x3e66e3[_0xfcbb('0x1b')];this['endtime']=moment()[_0xfcbb('0x1c')](_0xfcbb('0x1d'));this[_0xfcbb('0x1e')]=getSeconds(_0x3e66e3[_0xfcbb('0x1a')],_0x3e66e3[_0xfcbb('0x19')]);this[_0xfcbb('0x1f')]=getSeconds(_0x3e66e3[_0xfcbb('0x1b')],_0x3e66e3[_0xfcbb('0x1a')]);this['talktime']=getSeconds(this['endtime'],_0x3e66e3['answertime']);this['queue']=_0x1cb4ec['queue'];this['membername']=_0x1cb4ec['membername'];this[_0xfcbb('0x20')]=_0x1cb4ec[_0xfcbb('0x20')];this[_0xfcbb('0x21')]=_0x3e66e3[_0xfcbb('0x21')];this[_0xfcbb('0x22')]=_0x3e66e3[_0xfcbb('0x22')];this[_0xfcbb('0x23')]=_0x3e66e3[_0xfcbb('0x23')];this[_0xfcbb('0x24')]=_0x3e66e3['recallme'];this['ContactId']=_0x3e66e3['ContactId'];this['ListId']=_0x3e66e3[_0xfcbb('0x25')];this['UserId']=_0x3e66e3[_0xfcbb('0x26')];this[_0xfcbb('0x27')]=_0x3e66e3[_0xfcbb('0x27')];this[_0xfcbb('0x28')]=_0x3e66e3[_0xfcbb('0x28')];this[_0xfcbb('0x29')]=_0x3e66e3['originatecalleridnum']||'';this['originatecalleridname']=_0x3e66e3[_0xfcbb('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 0e1081a..61d2cb6 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29d4=['moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x21bb59,_0xbeb614){var _0xcb360=function(_0x572955){while(--_0x572955){_0x21bb59['push'](_0x21bb59['shift']());}};_0xcb360(++_0xbeb614);}(_0x29d4,0x1a1));var _0x429d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x29d4[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0x429d('0x0'));var _=require('lodash');var moment=require(_0x429d('0x1'));function getSeconds(_0x40881e,_0x16ce75){var _0x472fc9=moment(_0x40881e)[_0x429d('0x2')](0x0);var _0x4e287b=moment(_0x16ce75)[_0x429d('0x2')](0x0);return _0x472fc9[_0x429d('0x3')](_0x4e287b,_0x429d('0x4'));}function Final(_0x5e2a9c){this[_0x429d('0x5')]=_0x5e2a9c[_0x429d('0x5')];this[_0x429d('0x6')]=_0x5e2a9c[_0x429d('0x6')];this['type']=_0x5e2a9c[_0x429d('0x7')];this['campaigntype']=_0x5e2a9c[_0x429d('0x7')]===_0x429d('0x8')?_0x429d('0x9'):_0x5e2a9c['type'];this[_0x429d('0xa')]=_0x5e2a9c[_0x429d('0xa')];this['countcongestionretry']=_0x5e2a9c[_0x429d('0xb')];this[_0x429d('0xc')]=_0x5e2a9c[_0x429d('0xc')];this['countglobal']=_0x5e2a9c[_0x429d('0xa')]+_0x5e2a9c[_0x429d('0xb')]+_0x5e2a9c[_0x429d('0xc')]+_0x5e2a9c[_0x429d('0xd')]+_0x5e2a9c['countdropretry']+_0x5e2a9c[_0x429d('0xe')]+_0x5e2a9c[_0x429d('0xf')]+_0x5e2a9c[_0x429d('0x10')];this['countnosuchnumberretry']=_0x5e2a9c[_0x429d('0xd')];this[_0x429d('0x11')]=_0x5e2a9c['countdropretry'];this[_0x429d('0xe')]=_0x5e2a9c[_0x429d('0xe')];this[_0x429d('0xf')]=_0x5e2a9c[_0x429d('0xf')];this[_0x429d('0x10')]=_0x5e2a9c[_0x429d('0x10')];this['queue']=_0x5e2a9c[_0x429d('0x9')];this['calleridname']=_0x5e2a9c[_0x429d('0x12')];this[_0x429d('0x13')]=_0x5e2a9c[_0x429d('0x13')];this[_0x429d('0x14')]=_0x5e2a9c['starttime'];this[_0x429d('0x15')]=_0x5e2a9c[_0x429d('0x15')];this[_0x429d('0x16')]=_0x5e2a9c['responsetime'];this[_0x429d('0x17')]=_0x5e2a9c[_0x429d('0x17')]||0x0;this[_0x429d('0x18')]=_0x5e2a9c[_0x429d('0x18')]||0x0;this[_0x429d('0x19')]=_0x5e2a9c[_0x429d('0x19')]||0x0;this['callback']=_0x5e2a9c[_0x429d('0x1a')];this[_0x429d('0x1b')]=_0x5e2a9c[_0x429d('0x1b')];this['callbackat']=_0x5e2a9c[_0x429d('0x1c')];this[_0x429d('0x1d')]=_0x5e2a9c[_0x429d('0x1d')];this[_0x429d('0x1e')]=_0x5e2a9c[_0x429d('0x1e')];this[_0x429d('0x1f')]=_0x5e2a9c['ListId'];this[_0x429d('0x20')]=_0x5e2a9c[_0x429d('0x20')];this['VoiceQueueId']=_0x5e2a9c[_0x429d('0x21')];this[_0x429d('0x22')]=_0x5e2a9c[_0x429d('0x22')];this[_0x429d('0x23')]=_0x5e2a9c['originatecalleridnum']||'';this[_0x429d('0x24')]=_0x5e2a9c[_0x429d('0x24')]||'';}module[_0x429d('0x25')]=Final; \ No newline at end of file +var _0x7217=['countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x23f313,_0x1e7157){var _0x4f9063=function(_0x91f620){while(--_0x91f620){_0x23f313['push'](_0x23f313['shift']());}};_0x4f9063(++_0x1e7157);}(_0x7217,0x19e));var _0x7721=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7217[_0x46aff0];return _0x9d78cf;};'use strict';var util=require(_0x7721('0x0'));var _=require('lodash');var moment=require(_0x7721('0x1'));function getSeconds(_0x4170dd,_0x1de988){var _0x2a78d8=moment(_0x4170dd)[_0x7721('0x2')](0x0);var _0x4d6446=moment(_0x1de988)['milliseconds'](0x0);return _0x2a78d8[_0x7721('0x3')](_0x4d6446,_0x7721('0x4'));}function Final(_0x46415c){this[_0x7721('0x5')]=_0x46415c[_0x7721('0x5')];this[_0x7721('0x6')]=_0x46415c[_0x7721('0x6')];this[_0x7721('0x7')]=_0x46415c[_0x7721('0x7')];this[_0x7721('0x8')]=_0x46415c[_0x7721('0x7')]===_0x7721('0x9')?_0x7721('0xa'):_0x46415c[_0x7721('0x7')];this[_0x7721('0xb')]=_0x46415c['countbusyretry'];this[_0x7721('0xc')]=_0x46415c[_0x7721('0xc')];this[_0x7721('0xd')]=_0x46415c[_0x7721('0xd')];this[_0x7721('0xe')]=_0x46415c[_0x7721('0xb')]+_0x46415c[_0x7721('0xc')]+_0x46415c[_0x7721('0xd')]+_0x46415c['countnosuchnumberretry']+_0x46415c[_0x7721('0xf')]+_0x46415c[_0x7721('0x10')]+_0x46415c['countmachineretry']+_0x46415c[_0x7721('0x11')];this[_0x7721('0x12')]=_0x46415c[_0x7721('0x12')];this[_0x7721('0xf')]=_0x46415c['countdropretry'];this[_0x7721('0x10')]=_0x46415c[_0x7721('0x10')];this['countmachineretry']=_0x46415c['countmachineretry'];this['countagentrejectretry']=_0x46415c[_0x7721('0x11')];this[_0x7721('0xa')]=_0x46415c[_0x7721('0xa')];this[_0x7721('0x13')]=_0x46415c['calleridname'];this[_0x7721('0x14')]=_0x46415c['calleridnum'];this[_0x7721('0x15')]=_0x46415c['starttime'];this[_0x7721('0x16')]=_0x46415c[_0x7721('0x16')];this[_0x7721('0x17')]=_0x46415c[_0x7721('0x16')];this[_0x7721('0x18')]=_0x46415c[_0x7721('0x18')]||0x0;this[_0x7721('0x19')]=_0x46415c[_0x7721('0x19')]||0x0;this[_0x7721('0x1a')]=_0x46415c[_0x7721('0x1a')]||0x0;this['callback']=_0x46415c[_0x7721('0x1b')];this[_0x7721('0x1c')]=_0x46415c[_0x7721('0x1c')];this[_0x7721('0x1d')]=_0x46415c['callbackat'];this[_0x7721('0x1e')]=_0x46415c['recallme'];this[_0x7721('0x1f')]=_0x46415c[_0x7721('0x1f')];this[_0x7721('0x20')]=_0x46415c[_0x7721('0x20')];this[_0x7721('0x21')]=_0x46415c[_0x7721('0x21')];this[_0x7721('0x22')]=_0x46415c['VoiceQueueId'];this[_0x7721('0x23')]=_0x46415c[_0x7721('0x23')];this[_0x7721('0x24')]=_0x46415c[_0x7721('0x24')]||'';this[_0x7721('0x25')]=_0x46415c[_0x7721('0x25')]||'';}module[_0x7721('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index ac56393..71ee5e7 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2122=['starttime','responsetime','endtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','campaigntype','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number'];(function(_0x3174d6,_0x3c7c82){var _0x304de5=function(_0x55496c){while(--_0x55496c){_0x3174d6['push'](_0x3174d6['shift']());}};_0x304de5(++_0x3c7c82);}(_0x2122,0x161));var _0x2212=function(_0x39eeea,_0x49d05f){_0x39eeea=_0x39eeea-0x0;var _0x2ad830=_0x2122[_0x39eeea];return _0x2ad830;};'use strict';var util=require(_0x2212('0x0'));var _=require(_0x2212('0x1'));var moment=require(_0x2212('0x2'));function getSeconds(_0x1d2ecc,_0x3c59a4){var _0x4cd8c7=moment(_0x1d2ecc)[_0x2212('0x3')](0x0);var _0x10391a=moment(_0x3c59a4)[_0x2212('0x3')](0x0);return _0x4cd8c7[_0x2212('0x4')](_0x10391a,_0x2212('0x5'));}function Hangup(_0x23a324,_0x18d600){this[_0x2212('0x6')]=0x4;this[_0x2212('0x7')]='Answer';this['scheduledat']=_0x23a324[_0x2212('0x8')];this['type']=_0x23a324['type'];this[_0x2212('0x9')]=_0x23a324[_0x2212('0xa')]==='outbound'?_0x2212('0xb'):_0x23a324['type'];this[_0x2212('0xc')]=_0x23a324[_0x2212('0xc')];this[_0x2212('0xd')]=_0x23a324[_0x2212('0xd')];this[_0x2212('0xe')]=_0x23a324[_0x2212('0xe')];this[_0x2212('0xf')]=_0x23a324[_0x2212('0xc')]+_0x23a324[_0x2212('0xd')]+_0x23a324[_0x2212('0xe')]+_0x23a324[_0x2212('0x10')]+_0x23a324[_0x2212('0x11')]+_0x23a324['countabandonedretry']+_0x23a324['countmachineretry']+_0x23a324[_0x2212('0x12')];this[_0x2212('0x10')]=_0x23a324[_0x2212('0x10')];this['countdropretry']=_0x23a324[_0x2212('0x11')];this[_0x2212('0x13')]=_0x23a324['countabandonedretry'];this[_0x2212('0x14')]=_0x23a324[_0x2212('0x14')];this[_0x2212('0x12')]=_0x23a324['countagentrejectretry'];this[_0x2212('0x15')]=_0x18d600[_0x2212('0x15')];this[_0x2212('0x16')]=_0x23a324['name'];this[_0x2212('0x17')]=_0x23a324[_0x2212('0x18')];this[_0x2212('0x19')]=_0x23a324[_0x2212('0x19')];this[_0x2212('0x1a')]=_0x23a324[_0x2212('0x1a')];this[_0x2212('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x23a324[_0x2212('0x1a')],_0x23a324[_0x2212('0x19')]);this[_0x2212('0x1c')]=0x0;this[_0x2212('0x1d')]=getSeconds(this[_0x2212('0x1b')],_0x23a324[_0x2212('0x1a')]);this[_0x2212('0xb')]=_0x23a324[_0x2212('0xb')];this['membername']=_0x2212('0x1e');this[_0x2212('0x1f')]=_0x18d600[_0x2212('0x20')];this[_0x2212('0x21')]=_0x23a324['callback'];this[_0x2212('0x22')]=_0x23a324[_0x2212('0x22')];this['callbackat']=_0x23a324['callbackat'];this[_0x2212('0x23')]=_0x23a324[_0x2212('0x23')];this[_0x2212('0x24')]=_0x23a324[_0x2212('0x24')];this[_0x2212('0x25')]=_0x23a324[_0x2212('0x25')];this['UserId']=_0x23a324[_0x2212('0x26')];this[_0x2212('0x27')]=_0x23a324[_0x2212('0x27')];this['CampaignId']=_0x23a324[_0x2212('0x28')];}module[_0x2212('0x29')]=Hangup; \ No newline at end of file +var _0xc386=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callback'];(function(_0x3a55ac,_0x92b33e){var _0x346704=function(_0x14913d){while(--_0x14913d){_0x3a55ac['push'](_0x3a55ac['shift']());}};_0x346704(++_0x92b33e);}(_0xc386,0x92));var _0x6c38=function(_0x159304,_0xdc4d){_0x159304=_0x159304-0x0;var _0x241b5c=_0xc386[_0x159304];return _0x241b5c;};'use strict';var util=require(_0x6c38('0x0'));var _=require(_0x6c38('0x1'));var moment=require('moment');function getSeconds(_0x298c3e,_0x4ec9e6){var _0x403956=moment(_0x298c3e)[_0x6c38('0x2')](0x0);var _0x25f43a=moment(_0x4ec9e6)[_0x6c38('0x2')](0x0);return _0x403956[_0x6c38('0x3')](_0x25f43a,_0x6c38('0x4'));}function Hangup(_0x5acd71,_0x3beb2d){this[_0x6c38('0x5')]=0x4;this[_0x6c38('0x6')]=_0x6c38('0x7');this[_0x6c38('0x8')]=_0x5acd71[_0x6c38('0x8')];this[_0x6c38('0x9')]=_0x5acd71[_0x6c38('0x9')];this['campaigntype']=_0x5acd71[_0x6c38('0x9')]===_0x6c38('0xa')?'queue':_0x5acd71[_0x6c38('0x9')];this[_0x6c38('0xb')]=_0x5acd71[_0x6c38('0xb')];this[_0x6c38('0xc')]=_0x5acd71['countcongestionretry'];this[_0x6c38('0xd')]=_0x5acd71[_0x6c38('0xd')];this[_0x6c38('0xe')]=_0x5acd71['countbusyretry']+_0x5acd71[_0x6c38('0xc')]+_0x5acd71['countnoanswerretry']+_0x5acd71['countnosuchnumberretry']+_0x5acd71[_0x6c38('0xf')]+_0x5acd71['countabandonedretry']+_0x5acd71['countmachineretry']+_0x5acd71[_0x6c38('0x10')];this[_0x6c38('0x11')]=_0x5acd71[_0x6c38('0x11')];this[_0x6c38('0xf')]=_0x5acd71[_0x6c38('0xf')];this[_0x6c38('0x12')]=_0x5acd71[_0x6c38('0x12')];this[_0x6c38('0x13')]=_0x5acd71['countmachineretry'];this['countagentrejectretry']=_0x5acd71[_0x6c38('0x10')];this[_0x6c38('0x14')]=_0x3beb2d['uniqueid'];this[_0x6c38('0x15')]=_0x5acd71[_0x6c38('0x16')];this[_0x6c38('0x17')]=_0x5acd71[_0x6c38('0x18')];this[_0x6c38('0x19')]=_0x5acd71[_0x6c38('0x19')];this[_0x6c38('0x1a')]=_0x5acd71['responsetime'];this[_0x6c38('0x1b')]=moment()['format'](_0x6c38('0x1c'));this[_0x6c38('0x1d')]=getSeconds(_0x5acd71[_0x6c38('0x1a')],_0x5acd71[_0x6c38('0x19')]);this[_0x6c38('0x1e')]=0x0;this[_0x6c38('0x1f')]=getSeconds(this[_0x6c38('0x1b')],_0x5acd71[_0x6c38('0x1a')]);this[_0x6c38('0x20')]=_0x5acd71[_0x6c38('0x20')];this[_0x6c38('0x21')]=_0x6c38('0x22');this[_0x6c38('0x23')]=_0x3beb2d[_0x6c38('0x24')];this['callback']=_0x5acd71[_0x6c38('0x25')];this[_0x6c38('0x26')]=_0x5acd71['callbackuniqueid'];this['callbackat']=_0x5acd71[_0x6c38('0x27')];this[_0x6c38('0x28')]=_0x5acd71[_0x6c38('0x28')];this[_0x6c38('0x29')]=_0x5acd71['ContactId'];this[_0x6c38('0x2a')]=_0x5acd71['ListId'];this[_0x6c38('0x2b')]=_0x5acd71['UserId'];this[_0x6c38('0x2c')]=_0x5acd71[_0x6c38('0x2c')];this['CampaignId']=_0x5acd71['CampaignId'];}module[_0x6c38('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e1d3789..1548759 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8a4=['originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','queue','calleridname','name','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x35fd92,_0x4f593e){var _0x1d85e4=function(_0x14ca59){while(--_0x14ca59){_0x35fd92['push'](_0x35fd92['shift']());}};_0x1d85e4(++_0x4f593e);}(_0xe8a4,0x74));var _0x4e8a=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xe8a4[_0x1eda20];return _0x31b953;};'use strict';var util=require(_0x4e8a('0x0'));var _=require('lodash');var moment=require(_0x4e8a('0x1'));function getSeconds(_0xe5f778,_0x23f3dd){var _0x308eb5=moment(_0xe5f778)[_0x4e8a('0x2')](0x0);var _0x24ec76=moment(_0x23f3dd)['milliseconds'](0x0);return _0x308eb5[_0x4e8a('0x3')](_0x24ec76,_0x4e8a('0x4'));}function History(_0x43033d){this['uniqueid']=_0x43033d[_0x4e8a('0x5')];this[_0x4e8a('0x6')]=_0x43033d[_0x4e8a('0x6')]||undefined;this[_0x4e8a('0x7')]=_0x43033d[_0x4e8a('0x7')];this['campaigntype']=_0x43033d[_0x4e8a('0x7')]===_0x4e8a('0x8')?'queue':_0x43033d[_0x4e8a('0x7')];this[_0x4e8a('0x9')]=_0x43033d[_0x4e8a('0x9')];this[_0x4e8a('0xa')]=_0x43033d['countcongestionretry'];this['countnoanswerretry']=_0x43033d[_0x4e8a('0xb')];this[_0x4e8a('0xc')]=_0x43033d[_0x4e8a('0x9')]+_0x43033d[_0x4e8a('0xa')]+_0x43033d[_0x4e8a('0xb')]+_0x43033d['countnosuchnumberretry']+_0x43033d[_0x4e8a('0xd')]+_0x43033d[_0x4e8a('0xe')]+_0x43033d['countmachineretry']+_0x43033d[_0x4e8a('0xf')];this['countnosuchnumberretry']=_0x43033d[_0x4e8a('0x10')];this['countdropretry']=_0x43033d[_0x4e8a('0xd')];this[_0x4e8a('0xe')]=_0x43033d[_0x4e8a('0xe')];this['countmachineretry']=_0x43033d[_0x4e8a('0x11')];this['countagentrejectretry']=_0x43033d[_0x4e8a('0xf')];this[_0x4e8a('0x12')]=_0x43033d[_0x4e8a('0x12')];this[_0x4e8a('0x13')]=_0x43033d[_0x4e8a('0x14')];this['calleridnum']=_0x43033d['number'];this[_0x4e8a('0x15')]=_0x43033d['starttime'];this['responsetime']=_0x43033d[_0x4e8a('0x16')];this[_0x4e8a('0x17')]=_0x43033d[_0x4e8a('0x16')];this[_0x4e8a('0x18')]=getSeconds(_0x43033d[_0x4e8a('0x16')],_0x43033d[_0x4e8a('0x15')]);this[_0x4e8a('0x19')]=0x0;this[_0x4e8a('0x1a')]=0x0;this['callback']=_0x43033d[_0x4e8a('0x1b')];this[_0x4e8a('0x1c')]=_0x43033d[_0x4e8a('0x1c')];this['callbackat']=_0x43033d[_0x4e8a('0x1d')];this[_0x4e8a('0x1e')]=_0x43033d[_0x4e8a('0x1e')];this[_0x4e8a('0x1f')]=_0x43033d[_0x4e8a('0x1f')];this[_0x4e8a('0x20')]=_0x43033d['ListId'];this['UserId']=_0x43033d[_0x4e8a('0x21')];this[_0x4e8a('0x22')]=_0x43033d[_0x4e8a('0x22')];this[_0x4e8a('0x23')]=_0x43033d[_0x4e8a('0x23')];this[_0x4e8a('0x24')]=_0x43033d[_0x4e8a('0x24')]||'';this['originatecalleridname']=_0x43033d[_0x4e8a('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0x7d89=['originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId'];(function(_0x29bc47,_0x5cfe6b){var _0x37fdf3=function(_0x4ea8a3){while(--_0x4ea8a3){_0x29bc47['push'](_0x29bc47['shift']());}};_0x37fdf3(++_0x5cfe6b);}(_0x7d89,0x158));var _0x97d8=function(_0x12ad4b,_0x50d483){_0x12ad4b=_0x12ad4b-0x0;var _0x5208c1=_0x7d89[_0x12ad4b];return _0x5208c1;};'use strict';var util=require(_0x97d8('0x0'));var _=require(_0x97d8('0x1'));var moment=require(_0x97d8('0x2'));function getSeconds(_0x4717e4,_0x174e49){var _0x9f09bd=moment(_0x4717e4)['milliseconds'](0x0);var _0x24dd17=moment(_0x174e49)[_0x97d8('0x3')](0x0);return _0x9f09bd['diff'](_0x24dd17,_0x97d8('0x4'));}function History(_0x514179){this['uniqueid']=_0x514179[_0x97d8('0x5')];this[_0x97d8('0x6')]=_0x514179[_0x97d8('0x6')]||undefined;this[_0x97d8('0x7')]=_0x514179[_0x97d8('0x7')];this['campaigntype']=_0x514179['type']===_0x97d8('0x8')?_0x97d8('0x9'):_0x514179[_0x97d8('0x7')];this[_0x97d8('0xa')]=_0x514179[_0x97d8('0xa')];this[_0x97d8('0xb')]=_0x514179[_0x97d8('0xb')];this[_0x97d8('0xc')]=_0x514179[_0x97d8('0xc')];this[_0x97d8('0xd')]=_0x514179[_0x97d8('0xa')]+_0x514179[_0x97d8('0xb')]+_0x514179[_0x97d8('0xc')]+_0x514179['countnosuchnumberretry']+_0x514179[_0x97d8('0xe')]+_0x514179['countabandonedretry']+_0x514179['countmachineretry']+_0x514179[_0x97d8('0xf')];this[_0x97d8('0x10')]=_0x514179['countnosuchnumberretry'];this[_0x97d8('0xe')]=_0x514179['countdropretry'];this[_0x97d8('0x11')]=_0x514179['countabandonedretry'];this[_0x97d8('0x12')]=_0x514179[_0x97d8('0x12')];this[_0x97d8('0xf')]=_0x514179[_0x97d8('0xf')];this[_0x97d8('0x9')]=_0x514179[_0x97d8('0x9')];this[_0x97d8('0x13')]=_0x514179[_0x97d8('0x14')];this[_0x97d8('0x15')]=_0x514179[_0x97d8('0x16')];this[_0x97d8('0x17')]=_0x514179[_0x97d8('0x17')];this[_0x97d8('0x18')]=_0x514179['responsetime'];this[_0x97d8('0x19')]=_0x514179[_0x97d8('0x18')];this['ringtime']=getSeconds(_0x514179[_0x97d8('0x18')],_0x514179[_0x97d8('0x17')]);this[_0x97d8('0x1a')]=0x0;this[_0x97d8('0x1b')]=0x0;this[_0x97d8('0x1c')]=_0x514179[_0x97d8('0x1c')];this['callbackuniqueid']=_0x514179[_0x97d8('0x1d')];this['callbackat']=_0x514179[_0x97d8('0x1e')];this[_0x97d8('0x1f')]=_0x514179[_0x97d8('0x1f')];this[_0x97d8('0x20')]=_0x514179[_0x97d8('0x20')];this['ListId']=_0x514179['ListId'];this['UserId']=_0x514179[_0x97d8('0x21')];this[_0x97d8('0x22')]=_0x514179[_0x97d8('0x22')];this[_0x97d8('0x23')]=_0x514179[_0x97d8('0x23')];this[_0x97d8('0x24')]=_0x514179['originatecalleridnum']||'';this[_0x97d8('0x25')]=_0x514179['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 8c9d51c..ab135bd 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 _0xea01=['[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','checkRetriveMax','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','abandonmentRate','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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]','Ts\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/voiceQueueRt','../rpc/setting','./history','./agentComplete','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','message','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','unmanaged','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','statedesc','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isTrunkReachable','reachable','status','saveInDb','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','state','membername','AMD','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','emit','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','createStateFinal','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','starttime','calleridname','calleridnum','predictiveIntervalDroppedCallsCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','timezones','TIMEZONE_UNKNOW','push','command','iftime\x20%s,%s','interval','indexOf','true','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','dialMethod','progressive','power','handlePower','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','user:%s','user:dialPreviewRecallReminder','dialActive','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','dialGlobalInterval','[syncCampaigns]','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','tags','createdAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]'];(function(_0x3236ae,_0x24e711){var _0x55b266=function(_0x134703){while(--_0x134703){_0x3236ae['push'](_0x3236ae['shift']());}};_0x55b266(++_0x24e711);}(_0xea01,0x79));var _0x1ea0=function(_0x2951b7,_0x2e35c1){_0x2951b7=_0x2951b7-0x0;var _0x3f7328=_0xea01[_0x2951b7];return _0x3f7328;};'use strict';var util=require('util');var _=require(_0x1ea0('0x0'));var BPromise=require(_0x1ea0('0x1'));var uuid=require(_0x1ea0('0x2'));var moment=require(_0x1ea0('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x1ea0('0x4'));var ut=require(_0x1ea0('0x5'));var config=require(_0x1ea0('0x6'));var logger=require(_0x1ea0('0x7'))('dialer');var loggerBooked=require('../../../config/logger')(_0x1ea0('0x8'));var loggerPredictive=require('../../../config/logger')(_0x1ea0('0x9'));var loggerPredictiveCalls=require(_0x1ea0('0x7'))(_0x1ea0('0xa'));var loggerSyncQueueSummary=require(_0x1ea0('0x7'))(_0x1ea0('0xb'));var ami=require(_0x1ea0('0xc'));config['redis']=_[_0x1ea0('0xd')](config[_0x1ea0('0xe')],{'host':_0x1ea0('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1ea0('0x10'));var RpcSetting=require(_0x1ea0('0x11'));var Action=require('./action');var History=require(_0x1ea0('0x12'));var Final=require('./final');var AgentComplete=require(_0x1ea0('0x13'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x1ea0('0x14'));var ipAgi=process[_0x1ea0('0x15')]['XCALLY_IP_AGI']||_0x1ea0('0x16');var strategy={'rrmemory':_0x1ea0('0x17'),'roundrobin':_0x1ea0('0x18')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1ea0('0x19')][_0x1ea0('0x1a')]=function(_0x158cf4){this[_0x1ea0('0x1b')]=this['tail']?this[_0x1ea0('0x1b')][_0x1ea0('0x1c')](_0x158cf4):_0x158cf4();};function Dialer(_0x13dc1f,_0x128dbc){this[_0x1ea0('0x1d')]=new Sequence();this[_0x1ea0('0x1e')]=_0x128dbc;this[_0x1ea0('0x1f')]=_0x13dc1f['voiceQueues'];this['campaigns']=_0x13dc1f[_0x1ea0('0x20')];this[_0x1ea0('0x21')]=_0x13dc1f[_0x1ea0('0x21')];this[_0x1ea0('0x22')]=_0x13dc1f[_0x1ea0('0x22')];this[_0x1ea0('0x23')]=config[_0x1ea0('0x23')]||0x2;this[_0x1ea0('0x24')]={};this[_0x1ea0('0x25')]={};this[_0x1ea0('0x26')]={};this[_0x1ea0('0x27')]={};this['optionPredictive']={};this[_0x1ea0('0x28')]={};this[_0x1ea0('0x29')]={};this[_0x1ea0('0x2a')]={};this[_0x1ea0('0x2b')]={};this[_0x1ea0('0x2c')]={};ami['on']('agentconnect',this[_0x1ea0('0x2d')][_0x1ea0('0x2e')](this));ami['on'](_0x1ea0('0x2f'),this[_0x1ea0('0x30')][_0x1ea0('0x2e')](this));ami['on'](_0x1ea0('0x31'),this[_0x1ea0('0x32')][_0x1ea0('0x2e')](this));ami['on'](_0x1ea0('0x33'),this[_0x1ea0('0x34')][_0x1ea0('0x2e')](this));ami['on'](_0x1ea0('0x35'),this[_0x1ea0('0xb')][_0x1ea0('0x2e')](this));ami['on'](_0x1ea0('0x36'),this[_0x1ea0('0x37')][_0x1ea0('0x2e')](this));ami['on'](_0x1ea0('0x38'),this[_0x1ea0('0x39')][_0x1ea0('0x2e')](this));ami['on']('varset',this[_0x1ea0('0x3a')]['bind'](this));ami['on'](_0x1ea0('0x3b'),this[_0x1ea0('0x3c')]['bind'](this));ami['on'](_0x1ea0('0x3d'),this['syncQueueStatusComplete'][_0x1ea0('0x2e')](this));this[_0x1ea0('0x3e')]();this[_0x1ea0('0x3f')]();RpcSetting['getSettings']()['then'](function(_0x224052){previewRecallmeReminderInterval=_0x224052[_0x1ea0('0x40')];});}function isNotNull(_0x660c9d){return _0x660c9d!==null&&!_[_0x1ea0('0x41')](_0x660c9d);}function checkIsLoggedIn(_0xdeee5c,_0x5ed38f){return function(){if(_0x5ed38f<=0x0){_0xdeee5c[_0x1ea0('0x42')]='AGENTS_NOT_LOGGED';throw _0xdeee5c[_0x1ea0('0x43')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3a8f0a){return _0x3a8f0a;}function checkIsActive(_0x1a31be,_0x631451){return function(){if(!isActive(_0x631451)){_0x1a31be[_0x1ea0('0x42')]=_0x1ea0('0x44');throw _0x1a31be[_0x1ea0('0x43')]+_0x1ea0('0x45');}};}function checkInterval(_0x27e6fc){return function(){if(!isNotNull(_0x27e6fc[_0x1ea0('0x46')])){_0x27e6fc[_0x1ea0('0x42')]=_0x1ea0('0x47');throw _0x27e6fc[_0x1ea0('0x43')]+_0x1ea0('0x48');}if(!isNotNull(_0x27e6fc[_0x1ea0('0x46')][_0x1ea0('0x49')])){_0x27e6fc[_0x1ea0('0x42')]=_0x1ea0('0x47');throw _0x27e6fc[_0x1ea0('0x43')]+_0x1ea0('0x48');}if(!isNotNull(_[_0x1ea0('0x4a')](_0x27e6fc[_0x1ea0('0x46')][_0x1ea0('0x49')]))){_0x27e6fc[_0x1ea0('0x42')]=_0x1ea0('0x47');throw _0x27e6fc[_0x1ea0('0x43')]+_0x1ea0('0x48');}};}function msgResponse(_0x235683,_0x53840f,_0xecbaae){return{'action':_0x235683,'response':_0x53840f,'message':_0xecbaae,'stack':_0xecbaae};}function myreject(_0x30e145){return function(_0x52dfc1){return _0x30e145(msgResponse(_0x1ea0('0x4b'),_0x1ea0('0x4c'),JSON[_0x1ea0('0x4d')](_0x52dfc1)));};}function getSeconds(_0x2a4f1c,_0x250e96){var _0x284f9a=moment(_0x2a4f1c)[_0x1ea0('0x4e')](0x0);var _0xbe82a=moment(_0x250e96)[_0x1ea0('0x4e')](0x0);return _0x284f9a[_0x1ea0('0x4f')](_0xbe82a,_0x1ea0('0x50'));}function emit(_0x347b28,_0x596bb2,_0x2e8161){io['to'](_0x347b28)['emit'](_0x596bb2,_0x2e8161);}function emitVoiceQueueSummary(_0x4f7143){if(_0x4f7143[_0x1ea0('0x51')]===_0x1ea0('0x52')){var _0xd8af87={'id':_0x4f7143['id'],'name':_0x4f7143[_0x1ea0('0x43')],'strategy':_0x4f7143[_0x1ea0('0x53')],'answered':_0x4f7143[_0x1ea0('0x54')],'available':_0x4f7143[_0x1ea0('0x55')],'loggedIn':_0x4f7143[_0x1ea0('0x56')],'pTalking':_0x4f7143['pTalking'],'sumBillable':_0x4f7143[_0x1ea0('0x57')],'sumDuration':_0x4f7143['sumDuration'],'sumHoldTime':_0x4f7143[_0x1ea0('0x58')]||0x0,'talking':_0x4f7143[_0x1ea0('0x59')],'total':_0x4f7143['total'],'type':_0x4f7143[_0x1ea0('0x51')],'unmanaged':_0x4f7143[_0x1ea0('0x5a')],'abandoned':_0x4f7143['abandoned'],'waiting':_0x4f7143['waiting'],'loggedInDb':_0x4f7143[_0x1ea0('0x5b')],'dialActive':_0x4f7143['dialActive'],'dialMethod':_0x4f7143['dialMethod'],'dialOriginateCallerIdName':_0x4f7143['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4f7143[_0x1ea0('0x5c')],'dialOriginateTimeout':_0x4f7143[_0x1ea0('0x5d')],'dialPrefix':_0x4f7143[_0x1ea0('0x5e')],'outboundAnswerAgiCallsDay':_0x4f7143[_0x1ea0('0x5f')],'outboundAnswerCallsDay':_0x4f7143[_0x1ea0('0x60')],'outboundBlacklistCallsDay':_0x4f7143['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4f7143[_0x1ea0('0x61')],'outboundCongestionCallsDay':_0x4f7143[_0x1ea0('0x62')],'outboundDropCallsDayACS':_0x4f7143['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4f7143[_0x1ea0('0x63')],'outboundDropCallsDayTimeout':_0x4f7143[_0x1ea0('0x64')],'outboundNoAnswerCallsDay':_0x4f7143[_0x1ea0('0x65')],'outboundNoSuchCallsDay':_0x4f7143['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4f7143['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4f7143['outboundReCallsDay'],'outboundRejectCallsDay':_0x4f7143[_0x1ea0('0x66')],'outboundUnknownCallsDay':_0x4f7143[_0x1ea0('0x67')],'predictiveIntervalAnsweredCalls':_0x4f7143[_0x1ea0('0x68')],'predictiveIntervalAvgHoldtime':_0x4f7143[_0x1ea0('0x69')],'predictiveIntervalAvgTalktime':_0x4f7143['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4f7143['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4f7143[_0x1ea0('0x6a')],'predictiveIntervalErlangCalls':_0x4f7143[_0x1ea0('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x4f7143[_0x1ea0('0x6c')],'predictiveIntervalHitRate':_0x4f7143['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4f7143[_0x1ea0('0x6d')],'predictiveIntervalPauses':_0x4f7143[_0x1ea0('0x6e')],'predictiveIntervalAvailable':_0x4f7143['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4f7143[_0x1ea0('0x6f')],'message':_0x4f7143[_0x1ea0('0x42')],'originated':_0x4f7143['originated'],'erlangCalls':_0x4f7143[_0x1ea0('0x70')],'erlangCallToSecond':_0x4f7143['erlangCallToSecond'],'erlangAbandonmentRate':_0x4f7143[_0x1ea0('0x71')],'erlangBusyFactor':_0x4f7143[_0x1ea0('0x72')],'startPredictive':_0x4f7143[_0x1ea0('0x28')],'startProgressive':_0x4f7143[_0x1ea0('0x29')]};if(_0x4f7143[_0x1ea0('0x73')]){_0xd8af87[_0x1ea0('0x73')]={'id':_0x4f7143['Trunk']['id'],'name':_0x4f7143[_0x1ea0('0x73')][_0x1ea0('0x43')],'active':_0x4f7143['Trunk'][_0x1ea0('0x74')],'callerid':_0x4f7143[_0x1ea0('0x73')][_0x1ea0('0x75')]};}if(_0x4f7143[_0x1ea0('0x46')]){_0xd8af87[_0x1ea0('0x46')]={'id':_0x4f7143[_0x1ea0('0x46')]['id'],'name':_0x4f7143[_0x1ea0('0x46')]['name']};}var _0x4afc2e=md5(JSON[_0x1ea0('0x4d')](_0xd8af87));if(_0x4f7143[_0x1ea0('0x76')]!==_0x4afc2e){_0x4f7143[_0x1ea0('0x76')]=_0x4afc2e;emit(util[_0x1ea0('0x77')](_0x1ea0('0x78'),_0xd8af87[_0x1ea0('0x43')]),_0x1ea0('0x79'),_0xd8af87);}}}function emitCampaignSummary(_0x1b29e0){if(_0x1b29e0[_0x1ea0('0x51')]==='ivr'){emit(util['format'](_0x1ea0('0x7a'),_0x1b29e0[_0x1ea0('0x43')]),_0x1ea0('0x7b'),_0x1b29e0);}}function checkGetDataPredictive(_0x182bd7){if(isNotNull(_0x182bd7)&&!_[_0x1ea0('0x4a')](_0x182bd7)){loggerPredictive[_0x1ea0('0x7c')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x7d'),_0x182bd7['predictiveIntervalTotalCalls']);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x7e'),_0x182bd7[_0x1ea0('0x68')]);loggerPredictive['info'](_0x1ea0('0x7f'),_0x182bd7[_0x1ea0('0x6a')]);loggerPredictive['info'](_0x1ea0('0x80'),_0x182bd7['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x81'),_0x182bd7['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x1ea0('0x82'),_0x182bd7['predictiveIntervalAvgTalktime']);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x83'));if(_0x182bd7[_0x1ea0('0x6f')]>0x0){if(!_['isUndefined'](_0x182bd7[_0x1ea0('0x84')])&&_0x182bd7[_0x1ea0('0x84')]>0x0){return!![];}loggerPredictive[_0x1ea0('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x182bd7['predictiveIntervalAvgHoldtime'])&&_0x182bd7[_0x1ea0('0x69')]>0x0){return!![];}loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x85'));}else{loggerPredictive['info'](_0x1ea0('0x86'));}}else{loggerPredictive['info'](_0x1ea0('0x87'));}return![];}function mergeDataErlangB(_0x1fc836){return function(_0x1f941c){loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x88'));loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x89'),_0x1f941c['erlangCalls']);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x8a'),_0x1f941c[_0x1ea0('0x8b')]);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x8c'),_0x1f941c[_0x1ea0('0x71')]);loggerPredictive[_0x1ea0('0x7c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f941c[_0x1ea0('0x72')]);loggerPredictive['info'](_0x1ea0('0x8c'),_0x1f941c[_0x1ea0('0x71')]);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x83'));_[_0x1ea0('0x8d')](_0x1fc836,_0x1f941c);};}function getDiff(_0x256a40){var _0x267b2e=moment()['milliseconds'](0x0);var _0x3be636=moment(_0x256a40)[_0x1ea0('0x4e')](0x0);return _0x267b2e[_0x1ea0('0x4f')](_0x3be636,_0x1ea0('0x50'));}function ifInterval(_0x54efc6,_0x364dc9){if(_[_0x1ea0('0x41')](_0x364dc9)){return![];}return getDiff(_0x364dc9)<_0x54efc6*0x3c;}function freeVariablesPredictive(_0x4cd545){if(isNotNull(_0x4cd545)){if(!_[_0x1ea0('0x41')](_0x4cd545[_0x1ea0('0x29')])){_0x4cd545[_0x1ea0('0x29')]=undefined;loggerPredictive[_0x1ea0('0x7c')](_0x4cd545[_0x1ea0('0x43')],_0x1ea0('0x8e'));}if(!_['isUndefined'](_0x4cd545['startPredictive'])){_0x4cd545[_0x1ea0('0x28')]=undefined;loggerPredictive[_0x1ea0('0x7c')](_0x4cd545[_0x1ea0('0x43')],_0x1ea0('0x8f'));}if(!_[_0x1ea0('0x41')](_0x4cd545[_0x1ea0('0x90')])){clearInterval(_0x4cd545[_0x1ea0('0x90')]);_0x4cd545[_0x1ea0('0x90')]=undefined;loggerPredictive[_0x1ea0('0x7c')](_0x4cd545[_0x1ea0('0x43')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x2581ce,_0x18b1de){if(_0x18b1de===0x0){return 0x0;}var _0x3e1b64=0x1;for(var _0x1d325a=0x1;_0x1d325a<=_0x18b1de;_0x1d325a+=0x1){_0x3e1b64=0x1+_0x3e1b64*_0x1d325a/_0x2581ce;}return 0x1/_0x3e1b64;}function isVoiceQueueOutbound(_0x3d2120){return _0x3d2120==='outbound';}function isNotPreview(_0x221a5c){return _0x221a5c!==_0x1ea0('0x1e');}function isCampaignIvr(_0x29ea7e){return _0x29ea7e===_0x1ea0('0x91');}function getCallerId(_0x4684ba,_0x58379a,_0x3826f7){if(!_['isUndefined'](_0x3826f7)&&typeof _0x3826f7===_0x1ea0('0x92')&&!_[_0x1ea0('0x4a')](_0x3826f7)){if(!_[_0x1ea0('0x41')](_0x58379a)&&typeof _0x58379a===_0x1ea0('0x92')&&!_[_0x1ea0('0x4a')](_0x58379a)){return util[_0x1ea0('0x77')](_0x1ea0('0x93'),_0x58379a,_0x3826f7);}return util[_0x1ea0('0x77')]('\x22%s\x22\x20<%s>',_0x3826f7,_0x3826f7);}if(!_[_0x1ea0('0x41')](_0x4684ba)&&typeof _0x4684ba===_0x1ea0('0x92')&&!_[_0x1ea0('0x4a')](_0x4684ba)){return _0x4684ba;}return _0x1ea0('0x94');}function loggerCatchQueueSummary(_0x47f4d4,_0x882b0a){return function(_0x8555a4){freeVariablesPredictive(_0x882b0a);emitVoiceQueueSummary(_0x882b0a);emitCampaignSummary(_0x882b0a);loggerSyncQueueSummary[_0x1ea0('0x95')](_0x47f4d4,util[_0x1ea0('0x96')](_0x8555a4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x459860,_0x113995){return function(_0xb92f20){loggerPredictive[_0x1ea0('0x95')](_0x113995[_0x1ea0('0x43')],_0x459860);loggerPredictive[_0x1ea0('0x95')](_0xb92f20[_0x1ea0('0x97')]);freeVariablesPredictive(_0x113995);};}function loggerCatch(_0x154c91){return function(_0x15cd65){logger[_0x1ea0('0x95')](_0x154c91,util[_0x1ea0('0x96')](_0x15cd65,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x306d95){return _0x306d95&&!_['isUndefined'](_0x306d95)&&_0x306d95[_0x1ea0('0x98')]>0x0;}function decremetOriginate(_0x2c65c1){if(!_[_0x1ea0('0x41')](_0x2c65c1)&&_0x2c65c1!==null){if(typeof _0x2c65c1[_0x1ea0('0x99')]!==_0x1ea0('0x9a')){if(_0x2c65c1['originated']>0x0){_0x2c65c1[_0x1ea0('0x99')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1ea0('0x95')](_0x1ea0('0x9b'));}}function checkContactLowerLimitOriginate(_0xcbe248,_0x58546d,_0x14fa34){if(_0x58546d>_0x14fa34){for(var _0x462781=0x0;_0x462781<_0x58546d-_0x14fa34;_0x462781+=0x1){decremetOriginate(_0xcbe248);}}}function loggerGetContactDialer(_0x3eb17c,_0x9c78a6,_0x533338){return function(_0x231497){checkContactLowerLimitOriginate(_0x9c78a6,_0x533338,0x0);logger[_0x1ea0('0x95')](_0x3eb17c,util[_0x1ea0('0x96')](_0x231497,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x39e788){return function(_0x18aa16){if(isNotNull(_0x18aa16)&&isNotNull(_0x18aa16[0x0])){if(_0x18aa16[0x0][_0x1ea0('0x9c')]>0x0){_0x39e788[_0x1ea0('0x42')]=_0x1ea0('0x9d');logger['info'](_0x1ea0('0x9e')+_0x39e788['name'],_0x18aa16[0x0][_0x1ea0('0x9c')],_0x1ea0('0x9f'));}else{_0x39e788[_0x1ea0('0x42')]=_0x1ea0('0xa0');logger[_0x1ea0('0x7c')](_0x1ea0('0xa1')+_0x39e788['name']);}}};}function notSendMessagesQueue(_0xd5d806){if(_0xd5d806['sendMessageOneNotActive']){freeVariablesPredictive(_0xd5d806);if(_0xd5d806[_0x1ea0('0x99')]===0x0&&_0xd5d806['talking']===0x0&&_0xd5d806['waiting']===0x0&&(_0xd5d806[_0x1ea0('0xa2')]||0x0)===0x0){_0xd5d806['sendMessageOneNotActive']=![];_0xd5d806[_0x1ea0('0x55')]=0x0;_0xd5d806[_0x1ea0('0x42')]=_0x1ea0('0x44');loggerSyncQueueSummary['error'](_0x1ea0('0xa3'),_0xd5d806[_0x1ea0('0x43')],_0x1ea0('0xa4'));}else{_0xd5d806[_0x1ea0('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x1ea0('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xd5d806[_0x1ea0('0x43')],_0x1ea0('0xa5'));}emitVoiceQueueSummary(_0xd5d806);}}function notSendMessagesCampaign(_0x4f7822){if(_0x4f7822[_0x1ea0('0xa6')]){if(_0x4f7822[_0x1ea0('0x99')]===0x0){_0x4f7822[_0x1ea0('0xa6')]=![];_0x4f7822['message']=_0x1ea0('0x44');loggerSyncQueueSummary[_0x1ea0('0x95')](_0x1ea0('0xa7'),_0x4f7822[_0x1ea0('0x43')],_0x1ea0('0xa4'));}else{_0x4f7822['message']=_0x1ea0('0xa8');loggerSyncQueueSummary[_0x1ea0('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4f7822[_0x1ea0('0x43')],_0x1ea0('0xa5'));}emitCampaignSummary(_0x4f7822);}}function createObjHistory(_0x374730,_0x39229b,_0xbecd55,_0x484185,_0x55fac2){_0x374730[_0x1ea0('0x42')]=_0xbecd55;var _0x194b89=new Action(_0x374730,_0x39229b);var _0x2e5e48=new History(_0x194b89);_0x2e5e48['state']=_0x484185;_0x2e5e48[_0x1ea0('0xa9')]=_0x55fac2;_0x2e5e48['endtime']=_0x194b89['starttime'];return _0x2e5e48;}Dialer[_0x1ea0('0x19')]['loopClearZombieChannels']=function(){var _0x1e12db=this;setInterval(function(){_0x1e12db[_0x1ea0('0xaa')](_0x1e12db[_0x1ea0('0x27')],_0x1ea0('0xab'));_0x1e12db[_0x1ea0('0xaa')](_0x1e12db['actions'],_0x1ea0('0xac'));},0x32c8);};Dialer[_0x1ea0('0x19')][_0x1ea0('0xaa')]=function(_0x30d07c,_0x118fa6){var _0x250fac=this;for(var _0x10717b in _0x30d07c){if(typeof _0x30d07c[_0x10717b]!==_0x1ea0('0x9a')){this[_0x1ea0('0x1d')]['enqueue'](function(){if(!_[_0x1ea0('0xad')](_0x30d07c[_0x10717b])){return ami[_0x1ea0('0xae')]({'action':'status','channel':_0x30d07c[_0x10717b][_0x1ea0('0xaf')]})[_0x1ea0('0xb0')](function(_0x50cbc3){if(_0x50cbc3[_0x1ea0('0x42')]===_0x1ea0('0xb1')){setTimeout(function(){if(_0x30d07c[_0x10717b]&&_0x30d07c[_0x10717b][_0x1ea0('0x51')]!==_0x1ea0('0x91')){_0x250fac[_0x1ea0('0xb2')](_0x250fac[_0x1ea0('0x1f')][_0x30d07c[_0x10717b][_0x1ea0('0xb3')]]);logger['error'](_0x1ea0('0xb4'),_0x118fa6,_0x10717b,_0x30d07c[_0x10717b]['queue']);delete _0x30d07c[_0x10717b];}if(_0x30d07c[_0x10717b]&&_0x30d07c[_0x10717b][_0x1ea0('0x51')]===_0x1ea0('0x91')){_0x250fac[_0x1ea0('0xb2')](_0x250fac['campaigns'][_0x30d07c[_0x10717b][_0x1ea0('0xb3')]]);logger[_0x1ea0('0x95')](_0x1ea0('0xb5'),_0x118fa6,_0x10717b,_0x30d07c[_0x10717b][_0x1ea0('0xb3')]);delete _0x30d07c[_0x10717b];}},0x2328);}});}});}}};Dialer[_0x1ea0('0x19')][_0x1ea0('0xb6')]=function(_0x3516b7){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopper[_0x1ea0('0xb6')](_0x3516b7))[_0x1ea0('0xb0')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x1ea0('0xb9')]=function(_0x3cef62){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopperBlack['checkIsBlackList'](_0x3cef62))['catch'](loggerCatch(_0x1ea0('0xba')));};Dialer[_0x1ea0('0x19')][_0x1ea0('0xbb')]=function(_0xd4c7f){return BPromise['resolve']()[_0x1ea0('0xb8')](cmHopperBlack[_0x1ea0('0xbb')](_0xd4c7f))['catch'](loggerCatch(_0x1ea0('0xbc')));};Dialer[_0x1ea0('0x19')][_0x1ea0('0xbd')]=function(_0x2833a6){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopperHistory['avgHandleTime'](_0x2833a6))['catch'](loggerCatch(_0x1ea0('0xbe')));};Dialer[_0x1ea0('0x19')][_0x1ea0('0xbf')]=function(_0x4ccc65){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopper[_0x1ea0('0xbf')](_0x4ccc65))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype']['unlockContact']=function(_0x5f27e6,_0x5bd068,_0x3b5657){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopper[_0x1ea0('0xc0')](_0x5f27e6,_0x5bd068,_0x3b5657))['catch'](loggerCatch(_0x1ea0('0xc1')));};Dialer['prototype'][_0x1ea0('0xc2')]=function(_0x38ab58,_0x599940,_0x4f2093,_0xfa920c,_0x5748b1){return BPromise['resolve']()[_0x1ea0('0xb8')](cmHopper[_0x1ea0('0xc2')](_0x38ab58,_0x599940,_0x4f2093,_0xfa920c))[_0x1ea0('0xb0')](function(_0x2440a0){_0x5748b1['temp']-=_0x4f2093;_0x5748b1[_0x1ea0('0xc3')]=_0x5748b1[_0x1ea0('0xc3')]>0x0?_0x5748b1[_0x1ea0('0xc3')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x2440a0);});};Dialer[_0x1ea0('0x19')][_0x1ea0('0xc4')]=function(_0x2a3a9b,_0x3a4a13,_0x437208,_0x4ec7d7){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopper[_0x1ea0('0xc4')](_0x2a3a9b,_0x3a4a13,_0x437208))['catch'](function(_0x419cc2){_0x4ec7d7[_0x1ea0('0xc3')]-=_0x3a4a13;_0x4ec7d7['temp']=_0x4ec7d7[_0x1ea0('0xc3')]>0x0?_0x4ec7d7[_0x1ea0('0xc3')]:0x0;loggerCatch(_0x1ea0('0xc5'))(_0x419cc2);});};Dialer['prototype'][_0x1ea0('0xc6')]=function(_0x5c5d3e){return BPromise['resolve']()['then'](voiceQueueRt[_0x1ea0('0xc6')](_0x5c5d3e))[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0xc7')));};Dialer[_0x1ea0('0x19')][_0x1ea0('0xc8')]=function(_0x361dab){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopper[_0x1ea0('0xc8')](_0x361dab))[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0xc9')));};Dialer[_0x1ea0('0x19')][_0x1ea0('0xca')]=function(_0x2f83ff){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopperHistory[_0x1ea0('0xca')](_0x2f83ff))[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0xcb')));};Dialer[_0x1ea0('0x19')][_0x1ea0('0xb2')]=function(_0x30cde7){if(!_['isUndefined'](_0x30cde7)&&_0x30cde7!==null){if(typeof _0x30cde7[_0x1ea0('0x99')]!==_0x1ea0('0x9a')){if(_0x30cde7[_0x1ea0('0x99')]>0x0){_0x30cde7[_0x1ea0('0x99')]-=0x1;}else{logger[_0x1ea0('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1ea0('0x95')](_0x1ea0('0xcc'));}};Dialer[_0x1ea0('0x19')][_0x1ea0('0xcd')]=function(_0x129ce4,_0x5a19e6){var _0x438781=this;return function(_0x2008b8){_0x438781[_0x1ea0('0xb2')](_0x5a19e6);logger['error'](_0x129ce4,util[_0x1ea0('0x96')](_0x2008b8,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x1ea0('0xce')]=function(_0x8827d4,_0x4f3e46,_0x31dba0){var _0x100250={'state':0x19,'statedesc':'notFound'};this[_0x1ea0('0xb2')](_0x4f3e46);this['saveInDb'](_[_0x1ea0('0x8d')](_0x100250,_[_0x1ea0('0xcf')](_0x31dba0,['ContactId',_0x1ea0('0xd0'),'UserId',_0x1ea0('0xd1'),_0x1ea0('0xd2')])),_0x1ea0('0xd3'),'[emptyContact]');logger[_0x1ea0('0x95')](_0x8827d4);};Dialer[_0x1ea0('0x19')]['isSuccess']=function(_0x4e3632){return _0x4e3632==='Success';};Dialer['prototype'][_0x1ea0('0xd4')]=function(_0x4402c4){return!_[_0x1ea0('0x41')](_0x4402c4)&&_0x4402c4&&!_[_0x1ea0('0x41')](_0x4402c4['name'])&&!_[_0x1ea0('0x41')](_0x4402c4[_0x1ea0('0x74')])&&_0x4402c4[_0x1ea0('0x74')]&&(this[_0x1ea0('0x22')][util[_0x1ea0('0x77')]('SIP/%s',_0x4402c4[_0x1ea0('0x43')])]['status']===_0x1ea0('0xd5')||this[_0x1ea0('0x22')][util['format']('SIP/%s',_0x4402c4[_0x1ea0('0x43')])][_0x1ea0('0xd6')]==='unmonitored');};Dialer[_0x1ea0('0x19')][_0x1ea0('0xd7')]=function(_0x1bd9b2,_0x5a11a4,_0x1c7fea){this[_0x1ea0('0xca')](_0x1bd9b2)['catch'](loggerCatch(_0x5a11a4));this['moveContactManagedDialer'](_0x1bd9b2)[_0x1ea0('0xb0')](loggerCatch(_0x1c7fea));};Dialer['prototype'][_0x1ea0('0x3a')]=function(_0x5282e8){var _0x39339e=this[_0x1ea0('0x27')][_0x5282e8[_0x1ea0('0xd8')]];var _0x2b307f;if(!_[_0x1ea0('0xad')](_0x5282e8)&&!_[_0x1ea0('0xad')](_0x5282e8[_0x1ea0('0xd9')])&&!_[_0x1ea0('0xad')](_0x5282e8[_0x1ea0('0xd9')][_0x1ea0('0xda')])&&_0x5282e8[_0x1ea0('0xdb')]===_0x1ea0('0xdc')&&_0x39339e){if(_0x39339e['type']!==_0x1ea0('0x91')&&this[_0x1ea0('0x1f')][_0x39339e[_0x1ea0('0xb3')]][_0x1ea0('0xdd')]&&_0x5282e8[_0x1ea0('0xde')]==='HANGUP'){delete this[_0x1ea0('0x27')][_0x5282e8[_0x1ea0('0xd8')]];this['updateOriginated'](this[_0x1ea0('0x1f')][_0x39339e[_0x1ea0('0xb3')]]);this[_0x1ea0('0x1f')][_0x39339e['queue']][_0x1ea0('0x60')]+=0x1;this[_0x1ea0('0x1f')][_0x39339e[_0x1ea0('0xb3')]][_0x1ea0('0x5f')]+=0x1;_0x2b307f=new Hangup(_0x39339e,_0x5282e8);_0x2b307f[_0x1ea0('0xdf')]=0x12;_0x2b307f['statedesc']='HangupInAMD';_0x2b307f[_0x1ea0('0xe0')]=_0x1ea0('0xe1');ami['emit']('custom:amd',ut[_0x1ea0('0xe2')](_0x2b307f,'amd'));this[_0x1ea0('0xd7')](_0x2b307f,_0x1ea0('0xe3'),_0x1ea0('0xe4'));}if(_0x39339e['type']!==_0x1ea0('0x91')&&this[_0x1ea0('0x1f')][_0x39339e['queue']][_0x1ea0('0xdd')]&&_0x5282e8[_0x1ea0('0xde')]===_0x1ea0('0xe5')){var _0x23fd64=this;return new BPromise(function(_0x47ced9,_0x5755ab){delete _0x23fd64[_0x1ea0('0x27')][_0x5282e8[_0x1ea0('0xd8')]];_0x23fd64['updateOriginated'](_0x23fd64[_0x1ea0('0x1f')][_0x39339e['queue']]);_0x23fd64[_0x1ea0('0x1f')][_0x39339e[_0x1ea0('0xb3')]][_0x1ea0('0x60')]+=0x1;_0x23fd64[_0x1ea0('0x1f')][_0x39339e[_0x1ea0('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xeb4ab6=_0x23fd64[_0x1ea0('0x1f')][_0x39339e[_0x1ea0('0xb3')]];var _0x3b6ce3=new Hangup(_0x39339e,_0x5282e8);_0x3b6ce3[_0x1ea0('0xdf')]=0x13;_0x3b6ce3[_0x1ea0('0xa9')]=_0x1ea0('0xe6');_0x3b6ce3[_0x1ea0('0xe0')]=_0x1ea0('0xe1');_0x3b6ce3[_0x1ea0('0xe7')]+=0x1;_0x3b6ce3[_0x1ea0('0xe8')]+=0x1;_0x3b6ce3[_0x1ea0('0xe9')]=!![];ami[_0x1ea0('0xea')](_0x1ea0('0xeb'),ut[_0x1ea0('0xe2')](_0x3b6ce3,_0x1ea0('0xe9')));_0x23fd64[_0x1ea0('0xca')](_0x3b6ce3)['catch'](loggerCatch(_0x1ea0('0xec')));if(_0x3b6ce3[_0x1ea0('0xed')]+_0x3b6ce3['countcongestionretry']+_0x3b6ce3[_0x1ea0('0xee')]+_0x3b6ce3[_0x1ea0('0xef')]+_0x3b6ce3[_0x1ea0('0xf0')]+_0x3b6ce3[_0x1ea0('0xf1')]+_0x3b6ce3[_0x1ea0('0xe7')]+_0x3b6ce3[_0x1ea0('0xf2')]>=_0xeb4ab6[_0x1ea0('0xf3')]){_0x23fd64[_0x1ea0('0xf4')](_0x3b6ce3,_0x47ced9,_0x5755ab,_0x1ea0('0xf5'));}else{if(_0x3b6ce3['countmachineretry']>=_0xeb4ab6['dialMachineMaxRetry']){_0x23fd64['createStateFinal'](_0x3b6ce3,_0x47ced9,_0x5755ab,_0x1ea0('0xf6'));}else{_0x23fd64[_0x1ea0('0xbf')]({'active':![],'countmachineretry':_0x3b6ce3[_0x1ea0('0xe7')],'scheduledat':moment()[_0x1ea0('0xf7')](_0xeb4ab6[_0x1ea0('0xf8')],_0x1ea0('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b6ce3['ContactId'],'ListId':_0x3b6ce3[_0x1ea0('0xd0')],'VoiceQueueId':_0x3b6ce3[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x3b6ce3[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0xfa')));_0x47ced9({'reschedule':0x1});}}});}if(_0x39339e[_0x1ea0('0x51')]===_0x1ea0('0x91')&&this[_0x1ea0('0x20')][_0x39339e['queue']]['dialAMDActive']&&_0x5282e8['value']===_0x1ea0('0xfb')){delete this['uniqueId'][_0x5282e8[_0x1ea0('0xd8')]];this['updateOriginated'](this[_0x1ea0('0x20')][_0x39339e[_0x1ea0('0xb3')]]);_0x2b307f=new Hangup(_0x39339e,_0x5282e8);_0x2b307f['state']=0x12;_0x2b307f[_0x1ea0('0xa9')]='HangupInAMD';_0x2b307f[_0x1ea0('0xe0')]=_0x1ea0('0xe1');ami['emit'](_0x1ea0('0xeb'),ut[_0x1ea0('0xe2')](_0x2b307f,'amd'));this[_0x1ea0('0xd7')](_0x2b307f,'[syncHangupInAMDIvr][createHistory]',_0x1ea0('0xfc'));}if(_0x39339e[_0x1ea0('0x51')]===_0x1ea0('0x91')&&this[_0x1ea0('0x20')][_0x39339e[_0x1ea0('0xb3')]][_0x1ea0('0xdd')]&&_0x5282e8[_0x1ea0('0xde')]===_0x1ea0('0xe5')){var _0x23fd64=this;return new BPromise(function(_0x187c0a,_0x37688a){delete _0x23fd64[_0x1ea0('0x27')][_0x5282e8['uniqueid']];_0x23fd64[_0x1ea0('0xb2')](_0x23fd64[_0x1ea0('0x20')][_0x39339e['queue']]);_0x23fd64['campaigns'][_0x39339e[_0x1ea0('0xb3')]][_0x1ea0('0x60')]+=0x1;_0x23fd64[_0x1ea0('0x20')][_0x39339e[_0x1ea0('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x32756c=_0x23fd64[_0x1ea0('0x20')][_0x39339e[_0x1ea0('0xb3')]];var _0x414819=new Hangup(_0x39339e,_0x5282e8);_0x414819[_0x1ea0('0xdf')]=0x13;_0x414819[_0x1ea0('0xa9')]=_0x1ea0('0xe6');_0x414819['membername']=_0x1ea0('0xe1');_0x414819[_0x1ea0('0xe7')]+=0x1;_0x414819[_0x1ea0('0xe8')]+=0x1;_0x414819['amd']=!![];ami[_0x1ea0('0xea')](_0x1ea0('0xeb'),ut['buildObj'](_0x414819,'amd'));_0x23fd64[_0x1ea0('0xca')](_0x414819)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0xec')));if(_0x414819[_0x1ea0('0xed')]+_0x414819['countcongestionretry']+_0x414819['countnoanswerretry']+_0x414819['countnosuchnumberretry']+_0x414819[_0x1ea0('0xf0')]+_0x414819['countabandonedretry']+_0x414819[_0x1ea0('0xe7')]+_0x414819['countagentrejectretry']>=_0x32756c[_0x1ea0('0xf3')]){_0x23fd64['stateGlobal'](_0x414819,_0x187c0a,_0x37688a,_0x1ea0('0xf5'));}else{if(_0x414819[_0x1ea0('0xe7')]>=_0x32756c['dialMachineMaxRetry']){_0x23fd64[_0x1ea0('0xfd')](_0x414819,_0x187c0a,_0x37688a,_0x1ea0('0xf6'));}else{_0x23fd64[_0x1ea0('0xbf')]({'active':![],'countmachineretry':_0x414819[_0x1ea0('0xe7')],'scheduledat':moment()[_0x1ea0('0xf7')](_0x32756c[_0x1ea0('0xf8')],_0x1ea0('0xf9'))[_0x1ea0('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x414819[_0x1ea0('0xfe')],'ListId':_0x414819[_0x1ea0('0xd0')],'VoiceQueueId':_0x414819[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x414819['CampaignId']||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0xfa')));_0x187c0a({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x59e27e){var _0x218693=this[_0x1ea0('0x27')][_0x59e27e['uniqueid']];var _0x2a2876=this;var _0x33ce3b;if(_0x218693&&_0x218693[_0x1ea0('0x51')]===_0x1ea0('0x91')){delete this[_0x1ea0('0x27')][_0x59e27e[_0x1ea0('0xd8')]];this['updateOriginated'](this[_0x1ea0('0x20')][_0x218693['queue']]);this[_0x1ea0('0x20')][_0x218693[_0x1ea0('0xb3')]][_0x1ea0('0xff')]+=0x1;_0x33ce3b=new Hangup(_0x218693,_0x59e27e);this['createHistory'](_0x33ce3b)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x100')));this[_0x1ea0('0xc8')](_0x33ce3b)['catch'](loggerCatch(_0x1ea0('0x101')));}if(_0x218693&&_0x218693['type']!==_0x1ea0('0x91')&&isNotNull(this[_0x1ea0('0x1f')][_0x218693[_0x1ea0('0xb3')]][_0x1ea0('0x102')])){delete this[_0x1ea0('0x27')][_0x59e27e[_0x1ea0('0xd8')]];this[_0x1ea0('0xb2')](this[_0x1ea0('0x1f')][_0x218693[_0x1ea0('0xb3')]]);this[_0x1ea0('0x1f')][_0x218693[_0x1ea0('0xb3')]][_0x1ea0('0x60')]+=0x1;this[_0x1ea0('0x1f')][_0x218693[_0x1ea0('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x33ce3b=new Hangup(_0x218693,_0x59e27e);_0x33ce3b['state']=0x10;_0x33ce3b[_0x1ea0('0xa9')]=_0x1ea0('0x103');_0x33ce3b[_0x1ea0('0xe0')]=_0x1ea0('0x104');this[_0x1ea0('0xca')](_0x33ce3b)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x100')));this[_0x1ea0('0xc8')](_0x33ce3b)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x101')));}if(_0x218693&&_0x218693[_0x1ea0('0x51')]!==_0x1ea0('0x91')&&!isNotNull(this['voiceQueues'][_0x218693[_0x1ea0('0xb3')]][_0x1ea0('0x102')])){delete this[_0x1ea0('0x27')][_0x59e27e['uniqueid']];this[_0x1ea0('0xb2')](this[_0x1ea0('0x1f')][_0x218693[_0x1ea0('0xb3')]]);this[_0x1ea0('0x1f')][_0x218693['queue']]['outboundUnknownCallsDay']+=0x1;_0x33ce3b=new Hangup(_0x218693,_0x59e27e);_0x33ce3b['state']=0xc;_0x33ce3b['statedesc']=_0x59e27e['cause-txt'];_0x33ce3b[_0x1ea0('0xe0')]='Unknow';this[_0x1ea0('0xca')](_0x33ce3b)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x100')));this[_0x1ea0('0xc8')](_0x33ce3b)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x101')));}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x34')]=function(_0x542708){var _0x583abd=this['uniqueId'][_0x542708[_0x1ea0('0xd8')]];var _0xdf171f=this;if(this[_0x1ea0('0x1f')][_0x542708['queue']]){if(_0x583abd&&_0x583abd['type']!==_0x1ea0('0x91')){delete this[_0x1ea0('0x27')][_0x542708[_0x1ea0('0xd8')]];this[_0x1ea0('0x1f')][_0x542708['queue']][_0x1ea0('0x60')]+=0x1;var _0x3ac570=new AgentComplete(_0x583abd,_0x542708);if(_0x542708[_0x1ea0('0x105')]===_0x1ea0('0x106')){_0x3ac570[_0x1ea0('0x107')]=this[_0x1ea0('0x1f')][_0x542708[_0x1ea0('0xb3')]][_0x1ea0('0x108')]&&this['voiceQueues'][_0x542708[_0x1ea0('0xb3')]][_0x1ea0('0x109')]?moment()[_0x1ea0('0x77')](_0x1ea0('0x10a')):undefined;}this[_0x1ea0('0xca')](_0x3ac570)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x10b')));this[_0x1ea0('0xc8')](_0x3ac570)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x10c')));}}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x2d')]=function(_0x13090e){if(this[_0x1ea0('0x1f')][_0x13090e[_0x1ea0('0xb3')]]){if(this[_0x1ea0('0x27')][_0x13090e['uniqueid']]&&this['uniqueId'][_0x13090e['uniqueid']]['type']!=='ivr'){this[_0x1ea0('0xb2')](this['voiceQueues'][_0x13090e[_0x1ea0('0xb3')]]);this[_0x1ea0('0x27')][_0x13090e[_0x1ea0('0xd8')]][_0x1ea0('0x10d')]=moment()[_0x1ea0('0x77')](_0x1ea0('0x10a'));}}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x10e')]=function(_0x33af1e){this[_0x1ea0('0xca')](_0x33af1e)['catch'](loggerCatch(_0x1ea0('0x10b')));this[_0x1ea0('0xc8')](_0x33af1e)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x10f')));};Dialer[_0x1ea0('0x19')][_0x1ea0('0x30')]=function(_0x200cac){var _0x4eeb0f=this[_0x1ea0('0x27')][_0x200cac['uniqueid']];var _0x3f22a6=this;if(this[_0x1ea0('0x1f')][_0x200cac[_0x1ea0('0xb3')]]){if(_0x4eeb0f&&_0x4eeb0f['type']!==_0x1ea0('0x91')){delete this[_0x1ea0('0x27')][_0x200cac[_0x1ea0('0xd8')]];this[_0x1ea0('0xb2')](this['voiceQueues'][_0x200cac[_0x1ea0('0xb3')]]);_0x4eeb0f[_0x1ea0('0x110')]=moment()[_0x1ea0('0x77')](_0x1ea0('0x10a'));var _0x3fb39d=new QueueCallerAbandon(_0x4eeb0f,_0x200cac);if(getSeconds(_0x4eeb0f[_0x1ea0('0x110')],_0x4eeb0f['responsetime'])>=_0x4eeb0f[_0x1ea0('0x111')]){this[_0x1ea0('0x1f')][_0x200cac[_0x1ea0('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x1ea0('0x1f')][_0x200cac[_0x1ea0('0xb3')]][_0x1ea0('0x64')]+=0x1;this[_0x1ea0('0x1f')][_0x200cac['queue']][_0x1ea0('0x6c')]+=0x1;_0x3fb39d[_0x1ea0('0xdf')]=0xa;_0x3fb39d[_0x1ea0('0xa9')]=_0x1ea0('0x112');_0x3fb39d[_0x1ea0('0x113')]=_0x1ea0('0x114');_0x3fb39d[_0x1ea0('0x107')]=this['voiceQueues'][_0x200cac['queue']][_0x1ea0('0x108')]?moment()['format'](_0x1ea0('0x10a')):undefined;_0x3fb39d['countdropretry']+=0x1;_0x3fb39d[_0x1ea0('0xe8')]+=0x1;if(_0x3fb39d[_0x1ea0('0xf0')]>=this['voiceQueues'][_0x200cac[_0x1ea0('0xb3')]][_0x1ea0('0x115')]){this[_0x1ea0('0x10e')](_0x3fb39d);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3fb39d[_0x1ea0('0xf0')],'scheduledat':moment()['add'](this['voiceQueues'][_0x200cac[_0x1ea0('0xb3')]][_0x1ea0('0x116')],_0x1ea0('0xf9'))[_0x1ea0('0x77')](_0x1ea0('0x10a')),'ContactId':_0x4eeb0f[_0x1ea0('0xfe')],'ListId':_0x4eeb0f['ListId'],'VoiceQueueId':_0x4eeb0f[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x4eeb0f[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x117')));var _0x4f15f1=new History(_0x3fb39d);_0x4f15f1[_0x1ea0('0xdf')]=0xa;_0x4f15f1[_0x1ea0('0xa9')]=_0x1ea0('0x112');_0x4f15f1['starttime']=moment()[_0x1ea0('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f15f1[_0x1ea0('0x118')]=_0x4f15f1[_0x1ea0('0x119')];_0x4f15f1[_0x1ea0('0x11a')]=_0x3fb39d['calleridname'];_0x4f15f1[_0x1ea0('0x11b')]=_0x3fb39d[_0x1ea0('0x11b')];this[_0x1ea0('0xca')](_0x4f15f1)[_0x1ea0('0xb0')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x1ea0('0x1f')][_0x200cac[_0x1ea0('0xb3')]][_0x1ea0('0x11c')]+=0x1;this[_0x1ea0('0x1f')][_0x200cac[_0x1ea0('0xb3')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3fb39d['state']=0xb;_0x3fb39d[_0x1ea0('0xa9')]=_0x1ea0('0x11d');_0x3fb39d[_0x1ea0('0x113')]=_0x1ea0('0x11e');_0x3fb39d[_0x1ea0('0xf1')]+=0x1;_0x3fb39d[_0x1ea0('0xe8')]+=0x1;if(_0x3fb39d['countabandonedretry']>=this[_0x1ea0('0x1f')][_0x200cac['queue']][_0x1ea0('0x11f')]){this[_0x1ea0('0x10e')](_0x3fb39d);}else{this[_0x1ea0('0xbf')]({'active':![],'countabandonedretry':_0x3fb39d[_0x1ea0('0xf1')],'scheduledat':moment()[_0x1ea0('0xf7')](this['voiceQueues'][_0x200cac[_0x1ea0('0xb3')]][_0x1ea0('0x120')],'minutes')['format'](_0x1ea0('0x10a')),'ContactId':_0x4eeb0f[_0x1ea0('0xfe')],'ListId':_0x4eeb0f[_0x1ea0('0xd0')],'VoiceQueueId':_0x4eeb0f[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x4eeb0f[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x121')));var _0x4f15f1=new History(_0x3fb39d);_0x4f15f1[_0x1ea0('0xdf')]=0xb;_0x4f15f1[_0x1ea0('0xa9')]='Abandoned';_0x4f15f1[_0x1ea0('0x119')]=moment()['format'](_0x1ea0('0x10a'));_0x4f15f1[_0x1ea0('0x118')]=_0x4f15f1['starttime'];_0x4f15f1[_0x1ea0('0x11a')]=_0x3fb39d['calleridname'];_0x4f15f1[_0x1ea0('0x11b')]=_0x3fb39d[_0x1ea0('0x11b')];this[_0x1ea0('0xca')](_0x4f15f1)[_0x1ea0('0xb0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x39')]=function(_0x21517f){if(this[_0x1ea0('0x25')][_0x21517f['uniqueid']]){this[_0x1ea0('0x25')][_0x21517f[_0x1ea0('0xd8')]][_0x1ea0('0xaf')]=_0x21517f['channel'];}if(this[_0x1ea0('0x27')][_0x21517f[_0x1ea0('0xd8')]]){this[_0x1ea0('0x27')][_0x21517f[_0x1ea0('0xd8')]][_0x1ea0('0xaf')]=_0x21517f[_0x1ea0('0xaf')];}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x3c')]=function(_0x22d838){if(strategy[this['voiceQueues'][this[_0x1ea0('0x25')][_0x22d838[_0x1ea0('0x122')]]['queue']]['strategy']]==='roundrobin'){if(this['actions'][_0x22d838[_0x1ea0('0x122')]]&&_[_0x1ea0('0xad')](this['actions'][_0x22d838['actionid']][_0x1ea0('0x123')])&&_0x22d838['status']==='1'&&_0x22d838[_0x1ea0('0x124')]==='0'){if(this[_0x1ea0('0x21')][_0x22d838[_0x1ea0('0x125')]]){if(!this[_0x1ea0('0x21')][_0x22d838[_0x1ea0('0x125')]]['locked']){this['agents'][_0x22d838[_0x1ea0('0x125')]][_0x1ea0('0x123')]=!![];this[_0x1ea0('0x25')][_0x22d838['actionid']][_0x1ea0('0x123')]=!![];this['actions'][_0x22d838[_0x1ea0('0x122')]][_0x1ea0('0x125')]=_0x22d838[_0x1ea0('0x125')];}}}}else if((strategy[this[_0x1ea0('0x1f')][this[_0x1ea0('0x25')][_0x22d838[_0x1ea0('0x122')]][_0x1ea0('0xb3')]][_0x1ea0('0x53')]]||_0x1ea0('0x17'))==='rrmemory'){if(this[_0x1ea0('0x25')][_0x22d838[_0x1ea0('0x122')]]){if(this[_0x1ea0('0x21')][_0x22d838[_0x1ea0('0x125')]]){this['actions'][_0x22d838[_0x1ea0('0x122')]]['stateinterface']=_0x22d838[_0x1ea0('0x125')];if(_[_0x1ea0('0xad')](this[_0x1ea0('0x2b')][this[_0x1ea0('0x25')][_0x22d838['actionid']]['queue']])){this[_0x1ea0('0x2b')][this[_0x1ea0('0x25')][_0x22d838[_0x1ea0('0x122')]][_0x1ea0('0xb3')]]=[];}this[_0x1ea0('0x2b')][this[_0x1ea0('0x25')][_0x22d838['actionid']][_0x1ea0('0xb3')]]['push'](_[_0x1ea0('0x8d')](_[_0x1ea0('0xcf')](this[_0x1ea0('0x25')][_0x22d838[_0x1ea0('0x122')]],[_0x1ea0('0x126'),_0x1ea0('0x125')]),{'status':_0x22d838[_0x1ea0('0xd6')],'paused':_0x22d838['paused']}));}}}};function unlockQueueStatus(_0x51c6fd,_0x8e64b7){setTimeout(function(){if(_[_0x1ea0('0x41')](_0x51c6fd[_0x1ea0('0x127')])){loggerBooked[_0x1ea0('0x95')]('[unlockQueueStatus][undefined]',_0x8e64b7);}_0x51c6fd[_0x1ea0('0x127')]=!![];loggerBooked[_0x1ea0('0x7c')](_0x1ea0('0x128'),_0x8e64b7,JSON[_0x1ea0('0x4d')](_['pick'](_0x51c6fd,[_0x1ea0('0x43'),_0x1ea0('0x127')])));},0x1f3);}Dialer['prototype'][_0x1ea0('0x129')]=function(_0x117dbf){var _0x251f10=this;var _0x5cd4ae=_0x251f10[_0x1ea0('0x1f')][_0x251f10[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]]['queue']];if(strategy[this[_0x1ea0('0x1f')][this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xb3')]][_0x1ea0('0x53')]]===_0x1ea0('0x18')){if(this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]]&&this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0x125')]){this[_0x1ea0('0x1e')][_0x1ea0('0x12a')](this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0x126')],this['actions'][_0x117dbf['actionid']][_0x1ea0('0x125')])[_0x1ea0('0xb0')](function(_0xa2eb3c){logger[_0x1ea0('0x95')](_0x1ea0('0x12b'),util['inspect'](_0xa2eb3c,{'showHidden':![],'depth':null}));})['finally'](function(){_0x251f10[_0x1ea0('0xb2')](_0x251f10['voiceQueues'][_0x251f10[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]]['queue']]);_0x251f10[_0x1ea0('0x21')][_0x251f10[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0x125')]][_0x1ea0('0x123')]=![];delete _0x251f10[_0x1ea0('0x25')][_0x117dbf['actionid']];unlockQueueStatus(_0x5cd4ae);});}else{this[_0x1ea0('0xb2')](this[_0x1ea0('0x1f')][this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xb3')]]);this[_0x1ea0('0xbf')]({'active':![],'ContactId':this['actions'][_0x117dbf['actionid']][_0x1ea0('0xfe')],'ListId':this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xd0')],'VoiceQueueId':this['actions'][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xd1')]||undefined,'CampaignId':this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x12c')));delete this[_0x1ea0('0x25')][_0x117dbf['actionid']];unlockQueueStatus(_0x5cd4ae);}}else if((strategy[this['voiceQueues'][this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xb3')]][_0x1ea0('0x53')]]||'rrmemory')===_0x1ea0('0x17')){var _0x10c67c;if(this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]]&&!_[_0x1ea0('0x4a')](this[_0x1ea0('0x2b')][this[_0x1ea0('0x25')][_0x117dbf['actionid']]['queue']])){if(this[_0x1ea0('0x2c')][_0x251f10['actions'][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xb3')]]){this['queueBookedRR'][_0x251f10['actions'][_0x117dbf['actionid']][_0x1ea0('0xb3')]]=this[_0x1ea0('0x2c')][this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]]['queue']]?this[_0x1ea0('0x2c')][this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xb3')]]:this[_0x1ea0('0x2b')][this[_0x1ea0('0x25')][_0x117dbf[_0x1ea0('0x122')]][_0x1ea0('0xb3')]]?this[_0x1ea0('0x2b')][this[_0x1ea0('0x25')][_0x117dbf['actionid']][_0x1ea0('0xb3')]][_0x1ea0('0x12d')]||0x0:0x0;}this['queueBooked'][this[_0x1ea0('0x25')][_0x117dbf['actionid']][_0x1ea0('0xb3')]][_0x1ea0('0x12d')]=this['queueBookedRR'][this['actions'][_0x117dbf[_0x1ea0('0x122')]]['queue']];for(var _0x25abf8=0x0;_0x25abf8=0x0;})['catch'](myreject(_0x2f1e8e)));}}else{_0x168f5a['push'](ami[_0x1ea0('0xae')]({'action':'command','command':util[_0x1ea0('0x77')](_0x1ea0('0x147'),_0x254351,!_[_0x1ea0('0x41')](config['timezones'][_0x1a27d7])?_0x1a27d7:'')})[_0x1ea0('0xb8')](function(_0xf3de2c){return _0xf3de2c[_0x1ea0('0x14b')][_0x1ea0('0x149')](_0x1ea0('0x14a'))>=0x0;})[_0x1ea0('0xb0')](myreject(_0x2f1e8e)));}BPromise[_0x1ea0('0x14c')](_0x168f5a)['then'](function(_0x12726b){var _0x22cf14=_[_0x1ea0('0x14d')](_0x12726b);if(_0x22cf14){return _0x109829(_0x22cf14);}else{_0x323cbc[_0x1ea0('0x42')]=_0x98cd6e?_0x1ea0('0x14e'):'INTERVAL_IS_OVERTIME';return _0x2f1e8e(msgResponse(_0x1ea0('0x14f'),'Failure','Global:\x20'+_0x98cd6e+'\x20'+_0x2e3020+_0x1ea0('0x150')+util['inspect'](_0x254351,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1a27d7));}})['catch'](function(_0x50056b){return _0x2f1e8e(msgResponse(_0x1ea0('0x13f'),_0x1ea0('0x142'),JSON[_0x1ea0('0x4d')](_0x50056b)));});});};Dialer[_0x1ea0('0x19')][_0x1ea0('0x151')]=function(_0x78ec76){var _0x37fe6a=this;return function(){switch(_0x78ec76[_0x1ea0('0x152')]){case _0x1ea0('0x153'):freeVariablesPredictive(_0x78ec76);_0x37fe6a['handlePower'](_0x78ec76,0x1);break;case _0x1ea0('0x154'):freeVariablesPredictive(_0x78ec76);_0x37fe6a[_0x1ea0('0x155')](_0x78ec76,_0x78ec76['dialPowerLevel']);break;case _0x1ea0('0x9'):_0x37fe6a[_0x1ea0('0x9')](_0x78ec76);break;case _0x1ea0('0x8'):freeVariablesPredictive(_0x78ec76);_0x37fe6a[_0x1ea0('0x155')](_0x78ec76,0x1);break;default:freeVariablesPredictive(_0x78ec76);logger['error'](_0x1ea0('0x156'),_0x78ec76[_0x1ea0('0x43')],_0x1ea0('0x157'));}};};Dialer[_0x1ea0('0x19')][_0x1ea0('0x158')]=function(_0x4a8643){return BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](cmHopper['handlePreviewRecallNotifications'](_0x4a8643['id'],previewRecallmeReminderInterval))['then'](function(_0x49cfdb){for(var _0x249a89=0x0;_0x249a89<_0x49cfdb[_0x1ea0('0x98')];_0x249a89++){var _0x3efe64=_0x49cfdb[_0x249a89][_0x1ea0('0x159')]['name'];if(_0x3efe64)io['to'](util[_0x1ea0('0x77')](_0x1ea0('0x15a'),_0x3efe64))[_0x1ea0('0xea')](_0x1ea0('0x15b'),{'hopper':_0x49cfdb[_0x249a89]});}})[_0x1ea0('0xb0')](function(_0x7004a2){});};Dialer[_0x1ea0('0x19')]['launchHandleIvr']=function(_0x378255){var _0x4347eb=this;return function(){_0x4347eb['handleIvr'](_0x378255);};};Dialer[_0x1ea0('0x19')][_0x1ea0('0xb')]=function(_0x1cc5d4){var _0x2171af=this;if(isNotPreview(_0x1cc5d4[_0x1ea0('0x152')])){if(isVoiceQueueOutbound(_0x1cc5d4[_0x1ea0('0x51')])&&isActive(_0x1cc5d4['dialActive'])){_0x1cc5d4[_0x1ea0('0xa6')]=!![];BPromise[_0x1ea0('0xb7')]()[_0x1ea0('0xb8')](checkIsLoggedIn(_0x1cc5d4,_0x1cc5d4['loggedIn']))[_0x1ea0('0xb8')](checkIsActive(_0x1cc5d4,_0x1cc5d4[_0x1ea0('0x15c')]))['then'](checkInterval(_0x1cc5d4))[_0x1ea0('0xb8')](_0x2171af[_0x1ea0('0x139')](_0x1cc5d4))[_0x1ea0('0xb8')](_0x2171af[_0x1ea0('0x13d')](_0x1cc5d4['dialGlobalInterval'],_0x1cc5d4[_0x1ea0('0x15d')],_0x1cc5d4[_0x1ea0('0x43')],_0x1cc5d4))[_0x1ea0('0xb8')](_0x2171af[_0x1ea0('0x13e')](_0x1cc5d4['Interval'],_0x1cc5d4[_0x1ea0('0x15d')],_0x1cc5d4[_0x1ea0('0x43')],_0x1cc5d4))['then'](_0x2171af[_0x1ea0('0x151')](_0x1cc5d4))['catch'](loggerCatchQueueSummary(_0x1ea0('0x15e'),_0x1cc5d4));}else{notSendMessagesQueue(_0x1cc5d4);}}else{freeVariablesPredictive(_0x1cc5d4);if(_0x1cc5d4[_0x1ea0('0x15f')]){_0x2171af[_0x1ea0('0x158')](_0x1cc5d4);}}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x138')]=function(){var _0x116a29=this;var _0x6c0433;for(var _0x1dfb7a in this[_0x1ea0('0x20')]){if(typeof this[_0x1ea0('0x20')][_0x1dfb7a]!==_0x1ea0('0x9a')){_0x6c0433=this[_0x1ea0('0x20')][_0x1dfb7a];if(isCampaignIvr(_0x6c0433[_0x1ea0('0x51')])&&isActive(_0x6c0433[_0x1ea0('0x74')])){_0x6c0433[_0x1ea0('0xa6')]=!![];BPromise[_0x1ea0('0xb7')]()['then'](checkIsActive(_0x6c0433,_0x6c0433[_0x1ea0('0x74')]))[_0x1ea0('0xb8')](checkInterval(_0x6c0433))[_0x1ea0('0xb8')](_0x116a29[_0x1ea0('0x139')](_0x6c0433))[_0x1ea0('0xb8')](_0x116a29[_0x1ea0('0x13d')](_0x6c0433[_0x1ea0('0x160')],_0x6c0433[_0x1ea0('0x15d')],_0x6c0433[_0x1ea0('0x43')],_0x6c0433))['then'](_0x116a29['checkIfTimeIntervals'](_0x6c0433['Interval'],_0x6c0433['dialTimezone'],_0x6c0433[_0x1ea0('0x43')],_0x6c0433))['then'](_0x116a29['launchHandleIvr'](_0x6c0433))[_0x1ea0('0xb0')](loggerCatchQueueSummary(_0x1ea0('0x161'),_0x6c0433));}else{notSendMessagesCampaign(_0x6c0433);}}}};function getCallerIdRandom(_0x240a30,_0x2e8b54){var _0x4c09f3;var _0x4e8030;var _0x5b49f3;if(_0x2e8b54<=0x0){_0x2e8b54=0x1;}_0x4c09f3=new RegExp('\x5cw{0,'+_0x2e8b54+'}$');_0x4e8030=Math['pow'](0xa,_0x2e8b54-0x1);_0x5b49f3=Math['pow'](0xa,_0x2e8b54)-0x1;return util[_0x1ea0('0x77')]('%s',_['replace'](_0x240a30,_0x4c09f3,_[_0x1ea0('0x162')](_0x4e8030,_0x5b49f3)));}function extractCalleridName(_0x51470c){var _0x42e05e=_0x51470c[_0x1ea0('0x163')](/"(.*?)"/);return _0x42e05e?_0x42e05e[0x1]:_0x51470c;}function extractCalleridNumber(_0x291d2c){var _0x3fe422=_0x291d2c[_0x1ea0('0x163')](/<(.*?)>/);return _0x3fe422?_0x3fe422[0x1]:_0x291d2c;}Dialer['prototype'][_0x1ea0('0x164')]=function(_0x2d71bf,_0x88d0be){var _0x360802=this;var _0x49ca49=uuid['v4']();this[_0x1ea0('0x25')][_0x49ca49]=new Action(_0x2d71bf,_0x88d0be,_0x49ca49);return new BPromise(function(_0x313ce0,_0x142dc8){if(_[_0x1ea0('0x41')](_0x2d71bf)&&typeof _0x2d71bf!==_0x1ea0('0x165')){return _0x142dc8(msgResponse('originate','Failure',_0x1ea0('0x166')));}if(_[_0x1ea0('0x41')](_0x88d0be[_0x1ea0('0x167')][_0x1ea0('0x168')])||_0x88d0be[_0x1ea0('0x167')][_0x1ea0('0x168')]===null){return _0x142dc8(msgResponse(_0x1ea0('0x169'),_0x1ea0('0x142'),_0x1ea0('0x16a')));}var _0x187680={'XMD-CALLERID':_0x360802[_0x1ea0('0x25')][_0x49ca49][_0x1ea0('0x16b')](),'XMD-AGI':_0x2d71bf[_0x1ea0('0x102')]?util['format'](_0x1ea0('0x16c'),ipAgi,_0x2d71bf[_0x1ea0('0x102')]):_0x1ea0('0x16d'),'XMD-AGIAFTER':_0x2d71bf[_0x1ea0('0x108')]?util[_0x1ea0('0x77')](_0x1ea0('0x16c'),ipAgi,_0x2d71bf['dialQueueProject2']):'NONE','XMD-QUEUE':_0x2d71bf['type']==='outbound'?util[_0x1ea0('0x77')](_0x1ea0('0x16e'),_0x2d71bf[_0x1ea0('0x43')],_0x2d71bf[_0x1ea0('0x16f')]||'',_0x2d71bf[_0x1ea0('0x109')]?'c':'',_0x2d71bf[_0x1ea0('0x111')]||0x3):_0x1ea0('0x16d'),'XMD-CONTACTID':_0x88d0be['ContactId'],'XMD-CDRTYPE':_0x1ea0('0x170'),'CALLERID(all)':_0x360802[_0x1ea0('0x25')][_0x49ca49][_0x1ea0('0x16b')](),'XMD-AMD':_0x2d71bf[_0x1ea0('0xdd')]?_0x1ea0('0x171'):_0x1ea0('0x16d'),'XMD-DESTINATION':_0x1ea0('0xdc')};if(_0x2d71bf[_0x1ea0('0xdd')]){_0x187680[_0x1ea0('0x172')]=_0x2d71bf[_0x1ea0('0x173')]||0x9c4;_0x187680['XMD-AMDGREETING']=_0x2d71bf[_0x1ea0('0x174')]||0x5dc;_0x187680[_0x1ea0('0x175')]=_0x2d71bf[_0x1ea0('0x176')]||0x320;_0x187680[_0x1ea0('0x177')]=_0x2d71bf[_0x1ea0('0x178')]||0x1388;_0x187680['XMD-AMDMINWORDLENGTH']=_0x2d71bf[_0x1ea0('0x179')]||0x64;_0x187680[_0x1ea0('0x17a')]=_0x2d71bf[_0x1ea0('0x17b')]||0x32;_0x187680['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2d71bf[_0x1ea0('0x17c')]||0x3;_0x187680['XMD-AMDSILENCETHRESHOLD']=_0x2d71bf[_0x1ea0('0x17d')]||0x100;_0x187680['XMD-AMDMAXIMUMWORDLENGTH']=_0x2d71bf[_0x1ea0('0x17e')]||0x1388;}if(_0x2d71bf[_0x1ea0('0x51')]===_0x1ea0('0x52')){_0x187680['XMD-VOICEQUEUEID']=_0x88d0be[_0x1ea0('0xd1')];}else{_0x187680['XMD-CAMPAIGNID']=_0x88d0be['CampaignId'];}for(var _0x31b98b in _0x88d0be[_0x1ea0('0x167')]){if(typeof _0x88d0be[_0x1ea0('0x167')][_0x31b98b]!=='undefined'){if(isNotNull(_0x88d0be[_0x1ea0('0x167')][_0x31b98b])&&_0x31b98b!=='id'&&_0x31b98b!==_0x1ea0('0x17f')&&_0x31b98b!==_0x1ea0('0x180')&&_0x31b98b!=='updatedAt'){_0x187680[util[_0x1ea0('0x77')](_0x1ea0('0x181'),_0x1ea0('0x182'),_[_0x1ea0('0x183')](_0x31b98b))]=_0x88d0be['Contact'][_0x31b98b];}}}var _0x15704f=_0x360802['isTrunkReachable'](_0x2d71bf[_0x1ea0('0x73')])?getCallerId(_0x2d71bf['Trunk']['callerid'],_0x2d71bf[_0x1ea0('0x184')],_0x2d71bf[_0x1ea0('0x185')]>0x0?getCallerIdRandom(_0x2d71bf[_0x1ea0('0x5c')],_0x2d71bf[_0x1ea0('0x185')]):_0x2d71bf['dialOriginateCallerIdNumber']):getCallerId(_[_0x1ea0('0xad')](_0x2d71bf['TrunkBackup'])?_0x2d71bf[_0x1ea0('0x73')][_0x1ea0('0x75')]:_0x2d71bf[_0x1ea0('0x13a')][_0x1ea0('0x75')],_0x2d71bf[_0x1ea0('0x184')],_0x2d71bf[_0x1ea0('0x185')]>0x0?getCallerIdRandom(_0x2d71bf[_0x1ea0('0x5c')],_0x2d71bf[_0x1ea0('0x185')]):_0x2d71bf['dialOriginateCallerIdNumber']);if(_0x15704f){_0x187680[_0x1ea0('0x186')]=_0x360802[_0x1ea0('0x25')][_0x49ca49][_0x1ea0('0x187')]=extractCalleridName(_0x15704f);_0x187680['XMD-ORIGINATECALLERIDNUM']=_0x360802[_0x1ea0('0x25')][_0x49ca49]['originatecalleridnum']=extractCalleridNumber(_0x15704f);}return ami[_0x1ea0('0xae')]({'actionid':_0x49ca49,'action':_0x1ea0('0x169'),'channel':_0x360802[_0x1ea0('0xd4')](_0x2d71bf[_0x1ea0('0x73')])?util[_0x1ea0('0x77')]('SIP/%s/%s%s',_0x2d71bf[_0x1ea0('0x73')]['name'],isNotNull(_0x2d71bf[_0x1ea0('0x5e')])?_0x2d71bf[_0x1ea0('0x5e')][_0x1ea0('0x188')]()||'':'',_0x2d71bf[_0x1ea0('0x189')]>0x0?_0x88d0be[_0x1ea0('0x167')][_0x1ea0('0x168')][_0x1ea0('0x18a')](_0x2d71bf[_0x1ea0('0x189')]):_0x88d0be[_0x1ea0('0x167')][_0x1ea0('0x168')]):util[_0x1ea0('0x77')]('SIP/%s/%s%s',_[_0x1ea0('0xad')](_0x2d71bf['TrunkBackup'])?_0x2d71bf[_0x1ea0('0x73')][_0x1ea0('0x43')]:_0x2d71bf[_0x1ea0('0x13a')]['name'],isNotNull(_0x2d71bf[_0x1ea0('0x5e')])?_0x2d71bf['dialPrefix'][_0x1ea0('0x188')]()||'':'',_0x2d71bf[_0x1ea0('0x189')]>0x0?_0x88d0be[_0x1ea0('0x167')][_0x1ea0('0x168')][_0x1ea0('0x18a')](_0x2d71bf['dialCutDigit']):_0x88d0be[_0x1ea0('0x167')][_0x1ea0('0x168')]),'callerid':_0x15704f,'Exten':'xcally-motion-dialer','Context':_0x1ea0('0x18b'),'Priority':'1','variable':_0x187680,'timeout':(_0x2d71bf[_0x1ea0('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x49ca49})['then'](function(_0x49120a){return _0x313ce0(_0x49120a);})[_0x1ea0('0xb0')](function(_0x3184e7){_0x2d71bf[_0x1ea0('0x18c')]+=0x1;var _0x38331b=new History(_0x360802['actions'][_0x49ca49]);logger[_0x1ea0('0x95')](util[_0x1ea0('0x77')](_0x1ea0('0x18d'),JSON[_0x1ea0('0x4d')](_0x3184e7)));_0x38331b['state']=0xe;_0x38331b[_0x1ea0('0xa9')]='OriginateError';_0x38331b[_0x1ea0('0x119')]=moment()[_0x1ea0('0x77')](_0x1ea0('0x10a'));_0x38331b['endtime']=_0x38331b[_0x1ea0('0x119')];_0x360802[_0x1ea0('0xca')](_0x38331b)[_0x1ea0('0xb0')](loggerCatch('[originate][error]'));_0x360802[_0x1ea0('0xc8')](_0x38331b)['catch'](loggerCatch(_0x1ea0('0x18e')))['finally'](function(){delete _0x360802[_0x1ea0('0x25')][_0x49ca49];return _0x142dc8(msgResponse(_0x1ea0('0x169'),_0x1ea0('0x4c'),_0x1ea0('0x18f')));});});});};Dialer[_0x1ea0('0x19')][_0x1ea0('0x32')]=function(_0x4b0163){var _0x1d9380=this[_0x1ea0('0x25')][_0x4b0163[_0x1ea0('0x122')]];if(_0x1d9380){delete this[_0x1ea0('0x25')][_0x4b0163[_0x1ea0('0x122')]];_0x1d9380[_0x1ea0('0x190')]=moment()[_0x1ea0('0x77')](_0x1ea0('0x10a'));var _0x3c78fd=_0x1d9380[_0x1ea0('0x51')]===_0x1ea0('0x91')?this[_0x1ea0('0x20')][_0x1d9380[_0x1ea0('0xb3')]]:this['voiceQueues'][_0x1d9380[_0x1ea0('0x191')]()];if(!this[_0x1ea0('0x192')](_0x4b0163[_0x1ea0('0x193')])){this[_0x1ea0('0xb2')](_0x3c78fd);return this[_0x1ea0('0x194')](_0x1d9380,_0x3c78fd,_0x4b0163)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x195')));}this[_0x1ea0('0x27')][_0x4b0163[_0x1ea0('0xd8')]]=_0x1d9380;}};Dialer['prototype']['checkRetriveMax']=function(_0x3f1c24,_0x1fcf2b,_0x404f85){var _0x3d8fbe=new History(_0x1fcf2b);if(_0x3d8fbe['countbusyretry']+_0x3d8fbe[_0x1ea0('0x196')]+_0x3d8fbe['countnoanswerretry']+_0x3d8fbe[_0x1ea0('0xef')]+_0x3d8fbe[_0x1ea0('0xf0')]+_0x3d8fbe[_0x1ea0('0xf1')]+_0x3d8fbe[_0x1ea0('0xe7')]+_0x3d8fbe[_0x1ea0('0xf2')]>=_0x404f85[_0x1ea0('0xf3')]-0x1){return!![];}switch(_0x3f1c24){case 0x3:if(_0x3d8fbe[_0x1ea0('0xee')]>=_0x404f85[_0x1ea0('0x197')]-0x1){return!![];}this[_0x1ea0('0xbf')]({'active':![],'countnoanswerretry':_0x3d8fbe['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x404f85[_0x1ea0('0x198')],_0x1ea0('0xf9'))[_0x1ea0('0x77')](_0x1ea0('0x10a')),'ContactId':_0x3d8fbe[_0x1ea0('0xfe')],'ListId':_0x3d8fbe[_0x1ea0('0xd0')],'VoiceQueueId':_0x3d8fbe[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x3d8fbe['CampaignId']||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x199')));break;case 0x5:if(_0x3d8fbe[_0x1ea0('0xed')]>=_0x404f85[_0x1ea0('0x19a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3d8fbe[_0x1ea0('0xed')]+=0x1,'scheduledat':moment()[_0x1ea0('0xf7')](_0x404f85[_0x1ea0('0x19b')],'minutes')[_0x1ea0('0x77')](_0x1ea0('0x10a')),'ContactId':_0x3d8fbe[_0x1ea0('0xfe')],'ListId':_0x3d8fbe[_0x1ea0('0xd0')],'VoiceQueueId':_0x3d8fbe['VoiceQueueId']||undefined,'CampaignId':_0x3d8fbe[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3d8fbe[_0x1ea0('0x196')]>=_0x404f85['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x3d8fbe[_0x1ea0('0x196')]+=0x1,'scheduledat':moment()[_0x1ea0('0xf7')](_0x404f85[_0x1ea0('0x19c')],'minutes')[_0x1ea0('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3d8fbe[_0x1ea0('0xfe')],'ListId':_0x3d8fbe['ListId'],'VoiceQueueId':_0x3d8fbe[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x3d8fbe['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3d8fbe['countnosuchnumberretry']>=_0x404f85['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x1ea0('0xbf')]({'active':![],'countnosuchnumberretry':_0x3d8fbe[_0x1ea0('0xef')]+=0x1,'scheduledat':moment()[_0x1ea0('0xf7')](_0x404f85[_0x1ea0('0x19d')],_0x1ea0('0xf9'))[_0x1ea0('0x77')](_0x1ea0('0x10a')),'ContactId':_0x3d8fbe[_0x1ea0('0xfe')],'ListId':_0x3d8fbe[_0x1ea0('0xd0')],'VoiceQueueId':_0x3d8fbe['VoiceQueueId']||undefined,'CampaignId':_0x3d8fbe[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x19e')));}break;case 0xa:if(_0x3d8fbe['countdropretry']>=_0x404f85[_0x1ea0('0x115')]-0x1){return!![];}this[_0x1ea0('0xbf')]({'active':![],'countdropretry':_0x3d8fbe[_0x1ea0('0xf0')]+=0x1,'scheduledat':moment()[_0x1ea0('0xf7')](_0x404f85['dialDropRetryFrequency'],'minutes')[_0x1ea0('0x77')](_0x1ea0('0x10a')),'ContactId':_0x3d8fbe[_0x1ea0('0xfe')],'ListId':_0x3d8fbe[_0x1ea0('0xd0')],'VoiceQueueId':_0x3d8fbe[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x3d8fbe[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x117')));break;case 0xb:if(_0x3d8fbe[_0x1ea0('0xf1')]>=_0x404f85[_0x1ea0('0x11f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x3d8fbe['countabandonedretry']+=0x1,'scheduledat':moment()[_0x1ea0('0xf7')](_0x404f85[_0x1ea0('0x120')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3d8fbe[_0x1ea0('0xfe')],'ListId':_0x3d8fbe[_0x1ea0('0xd0')],'VoiceQueueId':_0x3d8fbe['VoiceQueueId']||undefined,'CampaignId':_0x3d8fbe[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x121')));break;case 0x13:if(_0x3d8fbe[_0x1ea0('0xe7')]>=_0x404f85[_0x1ea0('0x19f')]-0x1){return!![];}this[_0x1ea0('0xbf')]({'active':![],'countmachineretry':_0x3d8fbe[_0x1ea0('0xe7')]+=0x1,'scheduledat':moment()[_0x1ea0('0xf7')](_0x404f85[_0x1ea0('0xf8')],_0x1ea0('0xf9'))[_0x1ea0('0x77')](_0x1ea0('0x10a')),'ContactId':_0x3d8fbe[_0x1ea0('0xfe')],'ListId':_0x3d8fbe[_0x1ea0('0xd0')],'VoiceQueueId':_0x3d8fbe[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x3d8fbe[_0x1ea0('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3d8fbe[_0x1ea0('0xf2')]>=_0x404f85[_0x1ea0('0x1a0')]-0x1){return!![];}this[_0x1ea0('0xbf')]({'active':![],'countagentrejectretry':_0x3d8fbe[_0x1ea0('0xf2')]+=0x1,'scheduledat':moment()[_0x1ea0('0xf7')](_0x404f85[_0x1ea0('0x1a1')],_0x1ea0('0xf9'))[_0x1ea0('0x77')](_0x1ea0('0x10a')),'ContactId':_0x3d8fbe['ContactId'],'ListId':_0x3d8fbe['ListId'],'VoiceQueueId':_0x3d8fbe[_0x1ea0('0xd1')]||undefined,'CampaignId':_0x3d8fbe[_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1a2')));break;default:return!![];}};Dialer[_0x1ea0('0x19')]['callProgressDetecting']=function(_0x3001ec,_0x41be5e,_0x438ed9){var _0x25bd5f=this;var _0x249ec2=new History(_0x3001ec);return new BPromise(function(_0x493e9c,_0x599bbf){if(_[_0x1ea0('0x41')](_0x41be5e)&&typeof _0x41be5e!==_0x1ea0('0x165')){return _0x599bbf(msgResponse(_0x1ea0('0x1a3'),_0x1ea0('0x142'),_0x1ea0('0x1a4')));}if(_[_0x1ea0('0x41')](_0x438ed9)&&typeof _0x438ed9!==_0x1ea0('0x165')){return _0x599bbf(msgResponse(_0x1ea0('0x1a3'),_0x1ea0('0x142'),_0x1ea0('0x1a5')));}switch(_0x438ed9[_0x1ea0('0x105')]){case'0':_0x41be5e[_0x1ea0('0x1a6')]+=0x1;_0x249ec2[_0x1ea0('0xdf')]=0x0;_0x249ec2[_0x1ea0('0xa9')]=_0x1ea0('0x1a7');_0x249ec2[_0x1ea0('0xef')]+=0x1;_0x249ec2[_0x1ea0('0xe8')]+=0x1;ami[_0x1ea0('0xea')](_0x1ea0('0x1a8'),ut[_0x1ea0('0xe2')](_0x3001ec,_0x1ea0('0x1a9')));_0x25bd5f[_0x1ea0('0xca')](_0x249ec2)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0xec')));if(_0x25bd5f['checkRetriveMax'](0x0,_0x3001ec,_0x41be5e)){if(_0x249ec2[_0x1ea0('0xef')]>=_0x41be5e[_0x1ea0('0x1aa')]){_0x25bd5f[_0x1ea0('0xfd')](_0x249ec2,_0x493e9c,_0x599bbf,'reason\x200\x20no\x20such\x20number....');}else{_0x25bd5f[_0x1ea0('0xf4')](_0x249ec2,_0x493e9c,_0x599bbf,_0x1ea0('0x1ab'));}}break;case'3':_0x41be5e[_0x1ea0('0x65')]+=0x1;_0x249ec2[_0x1ea0('0xdf')]=0x3;_0x249ec2[_0x1ea0('0xa9')]=_0x1ea0('0x1ac');_0x249ec2[_0x1ea0('0xee')]+=0x1;_0x249ec2['countglobal']+=0x1;ami[_0x1ea0('0xea')]('custom:agentnoanswer',ut[_0x1ea0('0xe2')](_0x3001ec,_0x1ea0('0x1ad')));_0x25bd5f[_0x1ea0('0xca')](_0x249ec2)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1ae')));if(_0x25bd5f['checkRetriveMax'](0x3,_0x3001ec,_0x41be5e)){if(_0x249ec2[_0x1ea0('0xee')]>=_0x41be5e['dialNoAnswerMaxRetry']){_0x25bd5f['createStateFinal'](_0x249ec2,_0x493e9c,_0x599bbf,'reason\x203\x20ringing\x20no\x20answer');}else{_0x25bd5f[_0x1ea0('0xf4')](_0x249ec2,_0x493e9c,_0x599bbf,_0x1ea0('0x1af'));}}break;case'5':_0x41be5e['outboundBusyCallsDay']+=0x1;_0x249ec2[_0x1ea0('0xdf')]=0x5;_0x249ec2['statedesc']=_0x1ea0('0x1b0');_0x249ec2[_0x1ea0('0xed')]+=0x1;_0x249ec2['countglobal']+=0x1;ami[_0x1ea0('0xea')]('custom:agentbusy',ut[_0x1ea0('0xe2')](_0x3001ec,'busy'));_0x25bd5f[_0x1ea0('0xca')](_0x249ec2)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1b1')));if(_0x25bd5f[_0x1ea0('0x1b2')](0x5,_0x3001ec,_0x41be5e)){if(_0x249ec2[_0x1ea0('0xed')]>=_0x41be5e['dialBusyMaxRetry']){_0x25bd5f['createStateFinal'](_0x249ec2,_0x493e9c,_0x599bbf,'reason\x205\x20busy');}else{_0x25bd5f[_0x1ea0('0xf4')](_0x249ec2,_0x493e9c,_0x599bbf,'reason\x205\x20busy');}}break;case'8':_0x41be5e[_0x1ea0('0x62')]+=0x1;_0x249ec2['state']=0x8;_0x249ec2[_0x1ea0('0xa9')]=_0x1ea0('0x1b3');_0x249ec2[_0x1ea0('0x196')]+=0x1;_0x249ec2[_0x1ea0('0xe8')]+=0x1;ami[_0x1ea0('0xea')](_0x1ea0('0x1b4'),ut[_0x1ea0('0xe2')](_0x3001ec,_0x1ea0('0x1b5')));_0x25bd5f[_0x1ea0('0xca')](_0x249ec2)[_0x1ea0('0xb0')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x25bd5f['checkRetriveMax'](0x8,_0x3001ec,_0x41be5e)){if(_0x249ec2[_0x1ea0('0x196')]>=_0x41be5e[_0x1ea0('0x1b6')]){_0x25bd5f[_0x1ea0('0xfd')](_0x249ec2,_0x493e9c,_0x599bbf,'reason\x208\x20congestion');}else{_0x25bd5f['stateGlobal'](_0x249ec2,_0x493e9c,_0x599bbf,_0x1ea0('0x1b7'));}}break;case'11':_0x41be5e[_0x1ea0('0x1b8')]+=0x1;_0x249ec2[_0x1ea0('0xdf')]=0xb;_0x249ec2[_0x1ea0('0xa9')]=_0x1ea0('0x11d');_0x249ec2['countabandonedretry']+=0x1;_0x249ec2['countglobal']+=0x1;_0x25bd5f[_0x1ea0('0xca')](_0x249ec2)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1b9')));if(_0x25bd5f[_0x1ea0('0x1b2')](0xb,_0x3001ec,_0x41be5e)){if(_0x249ec2[_0x1ea0('0xf1')]>=_0x41be5e[_0x1ea0('0x11f')]){_0x25bd5f[_0x1ea0('0xfd')](_0x249ec2,_0x493e9c,_0x599bbf,_0x1ea0('0x1ba'));}else{_0x25bd5f['stateGlobal'](_0x249ec2,_0x493e9c,_0x599bbf,_0x1ea0('0x1ba'));}}break;case'20':_0x41be5e[_0x1ea0('0x66')]+=0x1;_0x249ec2[_0x1ea0('0xdf')]=0x14;_0x249ec2['statedesc']=_0x1ea0('0x1bb');_0x249ec2[_0x1ea0('0xf2')]+=0x1;_0x249ec2[_0x1ea0('0xe8')]+=0x1;ami['emit'](_0x1ea0('0x1bc'),ut[_0x1ea0('0xe2')](_0x3001ec,_0x1ea0('0x1bd')));_0x25bd5f[_0x1ea0('0xca')](_0x249ec2)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1be')));if(_0x25bd5f['checkRetriveMax'](0x14,_0x3001ec,_0x41be5e)){if(_0x249ec2[_0x1ea0('0xf2')]>=_0x41be5e['dialAgentRejectMaxRetry']){_0x25bd5f[_0x1ea0('0xfd')](_0x249ec2,_0x493e9c,_0x599bbf,_0x1ea0('0x1bf'));}else{_0x25bd5f[_0x1ea0('0xf4')](_0x249ec2,_0x493e9c,_0x599bbf,_0x1ea0('0x1bf'));}}break;default:_0x41be5e[_0x1ea0('0x67')]+=0x1;_0x249ec2[_0x1ea0('0xdf')]=0xc;_0x249ec2[_0x1ea0('0xa9')]=_0x438ed9[_0x1ea0('0x105')];_0x25bd5f[_0x1ea0('0xca')](_0x249ec2)[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1c0')));if(_0x25bd5f[_0x1ea0('0x1b2')](_0x438ed9[_0x1ea0('0x105')],_0x3001ec,_0x41be5e)){if(_0x249ec2['countbusyretry']+_0x249ec2[_0x1ea0('0x196')]+_0x249ec2[_0x1ea0('0xee')]+_0x249ec2[_0x1ea0('0xef')]+_0x249ec2[_0x1ea0('0xf0')]+_0x249ec2[_0x1ea0('0xf1')]+_0x249ec2[_0x1ea0('0xe7')]+_0x249ec2[_0x1ea0('0xf2')]>=_0x41be5e[_0x1ea0('0xf3')]){_0x25bd5f[_0x1ea0('0xf4')](_0x249ec2,_0x493e9c,_0x599bbf,_0x438ed9[_0x1ea0('0x105')]);}else{_0x25bd5f['createStateFinal'](_0x249ec2,_0x493e9c,_0x599bbf,_0x438ed9[_0x1ea0('0x105')]);}}}});};Dialer[_0x1ea0('0x19')][_0x1ea0('0xf4')]=function(_0x528f83,_0x4f4e3b,_0x372286,_0x1e41f7){var _0x23e482=new Final(_0x528f83);_0x23e482[_0x1ea0('0xdf')]=0xf;_0x23e482[_0x1ea0('0xa9')]=_0x1ea0('0x1c1');this[_0x1ea0('0xfd')](_0x23e482,_0x4f4e3b,_0x372286,_0x1e41f7);};Dialer[_0x1ea0('0x19')][_0x1ea0('0xfd')]=function(_0x39a45c,_0x449002,_0x9ec65f,_0xa0755d){this[_0x1ea0('0xc8')](_0x39a45c)[_0x1ea0('0xb8')](function(){return _0x449002(msgResponse(_0x1ea0('0x1a3'),'Success',_0xa0755d));})[_0x1ea0('0xb0')](function(){return _0x9ec65f(msgResponse('[moveContactManagedDialer][0]','Failure',_0x1ea0('0x1c2')));});};Dialer[_0x1ea0('0x19')]['predictive']=function(_0x3fb2a8){var _0x2be4bd=_0x3fb2a8[_0x1ea0('0x1c3')]/0x64;var _0x594072=_0x3fb2a8['outboundDropCallsDayTimeout']/(_0x3fb2a8['outboundDropCallsDayTimeout']+_0x3fb2a8[_0x1ea0('0x60')]);var _0x1d73cc=Math[_0x1ea0('0x1c4')](_0x3fb2a8[_0x1ea0('0x1c5')]*(_0x3fb2a8[_0x1ea0('0x1c6')]/0x64));var _0x4e7c2f=Math[_0x1ea0('0x1c4')](_0x3fb2a8['predictiveIntervalAvailable']*(_0x3fb2a8[_0x1ea0('0x1c7')]/0x64));var _0x794deb=_0x3fb2a8[_0x1ea0('0x55')]+_0x3fb2a8[_0x1ea0('0x59')];var _0x5b9710=Math['floor'](_0x3fb2a8[_0x1ea0('0x70')]*_0x3fb2a8[_0x1ea0('0x71')]*_0x3fb2a8[_0x1ea0('0x1c8')]*_0x3fb2a8[_0x1ea0('0x6d')]);if(_[_0x1ea0('0x41')](_0x3fb2a8[_0x1ea0('0x29')])){if(!_['isUndefined'](_0x3fb2a8[_0x1ea0('0x28')])){_0x3fb2a8[_0x1ea0('0x28')]=undefined;loggerPredictive[_0x1ea0('0x95')](_0x1ea0('0x1c9'),_0x1ea0('0x1ca'));}if(!_[_0x1ea0('0x41')](_0x3fb2a8[_0x1ea0('0x90')])){loggerPredictive[_0x1ea0('0x95')]('[startMethodPredictive][StartProgressive]',_0x1ea0('0x1cb'));clearInterval(_0x3fb2a8[_0x1ea0('0x90')]);_0x3fb2a8[_0x1ea0('0x90')]=undefined;}_0x3fb2a8[_0x1ea0('0x29')]=moment()[_0x1ea0('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3fb2a8[_0x1ea0('0x43')],_0x1ea0('0x1cc'),_0x3fb2a8[_0x1ea0('0x29')]);this[_0x1ea0('0x155')](_0x3fb2a8,0x1);}else if(ifInterval(_0x3fb2a8[_0x1ea0('0x1cd')],_0x3fb2a8[_0x1ea0('0x29')])){this['handlePower'](_0x3fb2a8,0x1);loggerPredictiveCalls[_0x1ea0('0x7c')](_0x1ea0('0x1ce'),_0x3fb2a8[_0x1ea0('0x29')],_0x3fb2a8['name']);_0x3fb2a8[_0x1ea0('0x70')]=0x0;_0x3fb2a8[_0x1ea0('0x6c')]=0x0;}else if(_0x2be4bd<_0x594072&&_0x3fb2a8['dialPredictiveOptimization']===_0x1ea0('0x1cf')){freeVariablesPredictive(_0x3fb2a8);loggerPredictive['info'](_0x1ea0('0x1d0'),_0x1ea0('0x1d1'),_0x594072,_0x1ea0('0x29'),_0x3fb2a8[_0x1ea0('0x43')]);}else if(_0x5b9710<_0x3fb2a8[_0x1ea0('0x6c')]&&_0x3fb2a8[_0x1ea0('0x1d2')]==='dropRate'){freeVariablesPredictive(_0x3fb2a8);loggerPredictive['info'](_0x1ea0('0x1d3'),_0x1ea0('0x1d4'),_0x5b9710,_0x1ea0('0x1d5'),_0x3fb2a8[_0x1ea0('0x6c')],_0x1ea0('0x29'),_0x3fb2a8[_0x1ea0('0x43')]);}else if(!ifInterval(_0x3fb2a8[_0x1ea0('0x1cd')],_0x3fb2a8[_0x1ea0('0x29')])&&_[_0x1ea0('0x41')](_0x3fb2a8[_0x1ea0('0x28')])&&!_[_0x1ea0('0x41')](_0x3fb2a8[_0x1ea0('0x29')])){_0x3fb2a8[_0x1ea0('0x28')]=moment()[_0x1ea0('0x77')](_0x1ea0('0x10a'));loggerPredictive['info'](_0x3fb2a8[_0x1ea0('0x43')],_0x1ea0('0x1d6'),_0x3fb2a8[_0x1ea0('0x28')]);this['averageHandleTime'](_0x3fb2a8[_0x1ea0('0x1cd')])[_0x1ea0('0xb8')](this[_0x1ea0('0x1d7')](_0x3fb2a8))[_0x1ea0('0xb8')](mergeDataErlangB(_0x3fb2a8))[_0x1ea0('0xb8')](this['startMethodPredictive'](_0x3fb2a8))[_0x1ea0('0xb0')](loggerCatchPredictive(_0x1ea0('0x1d8'),_0x3fb2a8));}else if(!ifInterval(_0x3fb2a8['dialPredictiveInterval'],_0x3fb2a8['startPredictive'])){_0x3fb2a8[_0x1ea0('0x6c')]=0x0;_0x3fb2a8[_0x1ea0('0x28')]=moment()[_0x1ea0('0x77')](_0x1ea0('0x10a'));loggerPredictive[_0x1ea0('0x7c')](_0x3fb2a8['name'],_0x1ea0('0x1d9'),_0x3fb2a8['startPredictive']);clearInterval(_0x3fb2a8[_0x1ea0('0x90')]);_0x3fb2a8['handlePredictive']=undefined;this[_0x1ea0('0xbd')](_0x3fb2a8[_0x1ea0('0x1cd')])[_0x1ea0('0xb8')](this[_0x1ea0('0x1d7')](_0x3fb2a8))[_0x1ea0('0xb8')](mergeDataErlangB(_0x3fb2a8))[_0x1ea0('0xb8')](this[_0x1ea0('0x1da')](_0x3fb2a8))[_0x1ea0('0xb0')](loggerCatchPredictive(_0x1ea0('0x1db'),_0x3fb2a8));}else if(_0x3fb2a8[_0x1ea0('0x1c5')]&&_0x794deb<_0x3fb2a8['predictiveIntervalAvailable']-_0x4e7c2f){freeVariablesPredictive(_0x3fb2a8);loggerPredictive[_0x1ea0('0x7c')](_0x3fb2a8[_0x1ea0('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x794deb,')\x20are\x20less\x20than\x20threshold\x20(',_0x3fb2a8[_0x1ea0('0x1c5')],'-',_0x4e7c2f,'=',_0x3fb2a8[_0x1ea0('0x1c5')]-_0x4e7c2f,')');}else if(_0x3fb2a8[_0x1ea0('0x1c5')]&&_0x794deb>_0x3fb2a8[_0x1ea0('0x1c5')]+_0x1d73cc){freeVariablesPredictive(_0x3fb2a8);loggerPredictive[_0x1ea0('0x7c')](_0x3fb2a8['name'],_0x1ea0('0x1dc'),_0x794deb,_0x1ea0('0x1dd'),_0x3fb2a8[_0x1ea0('0x1c5')],'+',_0x1d73cc,'=',_0x3fb2a8['predictiveIntervalAvailable']+_0x1d73cc,')');}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x1d7')]=function(_0x4e8903){var _0x352099=this;return function(_0x383abc){return new BPromise(function(_0x247cc5,_0x343c5d){_['merge'](_0x4e8903,_0x383abc[0x0]);if(checkGetDataPredictive(_0x383abc[0x0])){var _0x32c7d6=_0x4e8903[_0x1ea0('0x1c5')]=_0x4e8903[_0x1ea0('0x59')]+_0x4e8903['available'];var _0x89f422=_0x4e8903[_0x1ea0('0x1cd')]*0x3c;var _0x422522=_0x383abc[0x0]['predictiveIntervalAvgTalktime']+_0x383abc[0x0][_0x1ea0('0x69')];var _0x194b73=(_0x383abc[0x0][_0x1ea0('0x68')]+_0x383abc[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x383abc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x383abc[0x0][_0x1ea0('0x6f')];_0x4e8903[_0x1ea0('0x1c8')]=_0x194b73>0x0?_0x194b73:0x1;switch(_0x4e8903[_0x1ea0('0x1d2')]){case _0x1ea0('0x1cf'):var _0x148327=_0x4e8903[_0x1ea0('0x1c3')]/0x64;return _0x352099['abandonmentRate'](_0x32c7d6,_0x89f422,_0x422522,_0x194b73,_0x148327)['then'](function(_0x526b28){return _0x247cc5(_0x526b28);});case _0x1ea0('0x1de'):var _0x1cfb58=_0x4e8903[_0x1ea0('0x1c3')]/0x64;return _0x352099['busyFactor'](_0x32c7d6,_0x89f422,_0x422522,_0x194b73,_0x1cfb58)[_0x1ea0('0xb8')](function(_0x43e91c){return _0x247cc5(_0x43e91c);});default:return _0x343c5d(msgResponse(_0x1ea0('0x1df'),_0x1ea0('0x142'),_0x1ea0('0x1e0')));}}else{return _0x343c5d(msgResponse(_0x1ea0('0x1df'),_0x1ea0('0x142'),_0x1ea0('0x1e1')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x29bc61){var _0xb25f35=this;return function(_0x22773b){return new BPromise(function(_0x490c57,_0xd83d7a){_['merge'](_0x29bc61,_0x22773b[0x0]);if(checkGetDataPredictive(_0x22773b[0x0])){loggerPredictive[_0x1ea0('0x7c')](JSON[_0x1ea0('0x4d')](_0x22773b[0x0]));if(_0x29bc61[_0x1ea0('0x1d2')]===_0x1ea0('0x1cf')){return _0xb25f35['getVoiceQueueRtPauses'](_0x29bc61['id'])[_0x1ea0('0xb8')](function(_0x2cd9af){var _0x4ba1d3=_0x29bc61[_0x1ea0('0x56')]-_0x2cd9af[0x0]['outboundQueuePauses'];var _0x163e4e=_0x29bc61[_0x1ea0('0x1cd')]*0x3c;var _0x372292=_0x22773b[0x0][_0x1ea0('0x84')]+_0x22773b[0x0]['predictiveIntervalAvgHoldtime'];var _0xf66fcc=(_0x22773b[0x0][_0x1ea0('0x68')]+_0x22773b[0x0][_0x1ea0('0x6a')]+_0x22773b[0x0][_0x1ea0('0x11c')])/_0x22773b[0x0]['predictiveIntervalTotalCalls'];var _0x4db88f=_0x29bc61['dialPredictiveOptimizationPercentage']/0x64;_0x29bc61['predictiveIntervalPauses']=_0x2cd9af[0x0][_0x1ea0('0x1e2')]||0x0;_0x29bc61[_0x1ea0('0x1c8')]=_0xf66fcc>0x0?_0xf66fcc:0x1;return _0xb25f35[_0x1ea0('0x1e3')](_0x4ba1d3,_0x163e4e,_0x372292,_0xf66fcc,_0x4db88f);})[_0x1ea0('0xb8')](function(_0x31a921){return _0x490c57(_0x31a921);})['catch'](function(_0x821c17){return _0xd83d7a(msgResponse(_0x1ea0('0x1e4'),'Failure',JSON[_0x1ea0('0x4d')](_0x821c17)));});}if(_0x29bc61[_0x1ea0('0x1d2')]===_0x1ea0('0x1de')){return _0xb25f35['getVoiceQueueRtPauses'](_0x29bc61['id'])['then'](function(_0x5705f2){var _0x720e=_0x29bc61['loggedIn']-_0x5705f2[0x0]['outboundQueuePauses'];var _0x4b0edd=_0x29bc61['dialPredictiveInterval']*0x3c;var _0x4d75c1=_0x22773b[0x0][_0x1ea0('0x84')]+_0x22773b[0x0][_0x1ea0('0x69')];var _0x325e3b=(_0x22773b[0x0][_0x1ea0('0x68')]+_0x22773b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x22773b[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x22773b[0x0][_0x1ea0('0x6f')];var _0x299796=_0x29bc61[_0x1ea0('0x1c3')]/0x64;_0x29bc61['predictiveIntervalPauses']=_0x5705f2[0x0]['outboundQueuePauses']||0x0;_0x29bc61[_0x1ea0('0x1c8')]=_0x325e3b>0x0?_0x325e3b:0x1;return _0xb25f35['busyFactor'](_0x720e,_0x4b0edd,_0x4d75c1,_0x325e3b,_0x299796);})[_0x1ea0('0xb8')](function(_0x1d0ef6){return _0x490c57(_0x1d0ef6);})[_0x1ea0('0xb0')](function(_0x18153c){return _0xd83d7a(msgResponse(_0x1ea0('0x1e4'),_0x1ea0('0x142'),JSON[_0x1ea0('0x4d')](_0x18153c)));});}}else{return _0xd83d7a(msgResponse(_0x1ea0('0x1df'),_0x1ea0('0x142'),'check\x20failure'));}});};};Dialer[_0x1ea0('0x19')][_0x1ea0('0x1da')]=function(_0x4aa1b5){var _0x10d0c7=this;return function(){var _0x4a8a83=0x0;var _0x4165e4=Math[_0x1ea0('0x1e5')](_0x4aa1b5[_0x1ea0('0x8b')]*0x3e8);if(_0x4165e4>0x0){_0x4165e4=_0x4165e4<0x64?0x64:_0x4165e4;loggerPredictive[_0x1ea0('0x7c')](_0x4aa1b5[_0x1ea0('0x43')],_0x1ea0('0x1e6'),_0x4165e4,_0x1ea0('0x4e'));_0x4aa1b5[_0x1ea0('0x90')]=setInterval(function(){_0x10d0c7[_0x1ea0('0x90')](_0x4aa1b5);loggerPredictiveCalls[_0x1ea0('0x7c')](_0x1ea0('0x1e7'),_0x4a8a83+=0x1);},_0x4165e4);}else{loggerPredictive[_0x1ea0('0x7c')](_0x4aa1b5['name'],_0x1ea0('0x1e8'));}};};Dialer['prototype']['checkContactBlack']=function(_0x319fde,_0x3f6849){var _0x1069de=this;return function(_0x4d583b){if(_[_0x1ea0('0x4a')](_0x4d583b)){if(_[_0x1ea0('0xad')](_0x3f6849[_0x1ea0('0x1e9')])||!_0x3f6849['recallme']){if(_0x319fde[_0x1ea0('0x152')]===_0x1ea0('0x8')){_0x319fde[_0x1ea0('0x127')]=_[_0x1ea0('0x41')](_0x319fde[_0x1ea0('0x127')])?!![]:_0x319fde[_0x1ea0('0x127')];var _0x541126=uuid['v4']();_0x1069de['actions'][_0x541126]=new Action(_0x319fde,_0x3f6849,_0x541126);loggerBooked['info'](_0x1ea0('0x1ea'),_0x541126,_0x1ea0('0x1eb'),JSON['stringify'](_0x319fde[_0x1ea0('0x127')]),_0x1ea0('0x1ec'),_0x319fde[_0x1ea0('0x43')]);if(_0x319fde[_0x1ea0('0x127')]){_0x319fde[_0x1ea0('0x127')]=![];_0x1069de[_0x1ea0('0x2b')][_0x1069de[_0x1ea0('0x25')][_0x541126][_0x1ea0('0xb3')]]=[];ami['Action']({'actionid':_0x541126,'action':'queuestatus','queue':_0x319fde[_0x1ea0('0x43')]})[_0x1ea0('0xb0')](function(){_0x1069de['updateOriginated'](_0x319fde);_0x1069de[_0x1ea0('0xbf')]({'active':![],'ContactId':_0x1069de['actions'][_0x541126][_0x1ea0('0xfe')],'ListId':_0x1069de[_0x1ea0('0x25')][_0x541126]['ListId'],'VoiceQueueId':_0x1069de['actions'][_0x541126][_0x1ea0('0xd1')]||undefined,'CampaignId':_0x1069de[_0x1ea0('0x25')][_0x541126]['CampaignId']||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1ed')));delete _0x1069de[_0x1ea0('0x25')][_0x541126];});}else{loggerBooked[_0x1ea0('0x7c')]('[booked][checkContactBlack][else]',JSON[_0x1ea0('0x4d')](_0x319fde[_0x1ea0('0x127')]),_0x1ea0('0x1ec'),_0x319fde['name']);_0x1069de[_0x1ea0('0xb2')](_0x319fde);_0x1069de[_0x1ea0('0xbf')]({'active':![],'ContactId':_0x1069de['actions'][_0x541126]['ContactId'],'ListId':_0x1069de[_0x1ea0('0x25')][_0x541126]['ListId'],'VoiceQueueId':_0x1069de['actions'][_0x541126][_0x1ea0('0xd1')]||undefined,'CampaignId':_0x1069de['actions'][_0x541126][_0x1ea0('0xd2')]||undefined})[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1ed')));delete _0x1069de[_0x1ea0('0x25')][_0x541126];}}else{return _0x1069de[_0x1ea0('0x164')](_0x319fde,_0x3f6849);}}else{if(getDiff(_0x3f6849[_0x1ea0('0x1ee')])<_0x319fde[_0x1ea0('0x1ef')]*0x3c){if(_0x3f6849[_0x1ea0('0x159')]&&!_0x3f6849[_0x1ea0('0x159')][_0x1ea0('0x1f0')]){_0x1069de[_0x1ea0('0x1e')][_0x1ea0('0x12a')](_0x3f6849['id'])['finally'](function(){_0x1069de['updateOriginated'](_0x319fde);});}else{_0x1069de['unlockContact']({'active':![]},_0x3f6849['id'],0x1)['finally'](function(){_0x1069de['updateOriginated'](_0x319fde);});}}else{_0x319fde['outboundReCallsDay']+=0x1;_0x1069de[_0x1ea0('0xb2')](_0x319fde);if(_0x319fde['dialRecallInQueue']){_0x1069de[_0x1ea0('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3f6849[_0x1ea0('0xfe')],'ListId':_0x3f6849[_0x1ea0('0xd0')],'VoiceQueueId':_0x3f6849['VoiceQueueId']||undefined,'CampaignId':_0x3f6849['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1069de[_0x1ea0('0xca')](createObjHistory(_0x319fde,_0x3f6849,_0x1ea0('0x1f1'),0x17,_0x1ea0('0x1f2')))[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x1f3')));}else{_0x1069de[_0x1ea0('0xd7')](createObjHistory(_0x319fde,_0x3f6849,_0x1ea0('0x1f4'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x319fde['outboundBlacklistCallsDay']+=0x1;_0x1069de[_0x1ea0('0xd7')](createObjHistory(_0x319fde,_0x3f6849,_0x1ea0('0x1f5'),0xd,_0x1ea0('0x1f6')),_0x1ea0('0x1f7'),_0x1ea0('0x1f8'));throw _0x1ea0('0x1f9');}};};Dialer[_0x1ea0('0x19')][_0x1ea0('0x1fa')]=function(_0x5b86c8){var _0x54917a=this;var _0x50a7e2=_0x5b86c8[_0x1ea0('0x1fb')]-_0x5b86c8[_0x1ea0('0x99')]-_0x5b86c8[_0x1ea0('0xc3')];emitCampaignSummary(_0x5b86c8);if(_0x50a7e2>0x0){if(_0x50a7e2>this['maxNumberOriginate']){_0x50a7e2=this['maxNumberOriginate'];}_0x5b86c8[_0x1ea0('0xc3')]+=_0x50a7e2;this[_0x1ea0('0xc4')](_0x5b86c8['id'],_0x50a7e2,_0x5b86c8[_0x1ea0('0x1fc')],_0x5b86c8)[_0x1ea0('0xb8')](function(_0x228c3e){_0x5b86c8[_0x1ea0('0xc3')]-=_0x50a7e2;_0x5b86c8[_0x1ea0('0xc3')]=_0x5b86c8['temp']>0x0?_0x5b86c8[_0x1ea0('0xc3')]:0x0;if(!checkContactEmpty(_0x228c3e)){_0x5b86c8[_0x1ea0('0x42')]=_0x1ea0('0xa0');logger[_0x1ea0('0x7c')](_0x1ea0('0x1fd')+_0x5b86c8['name']);}else{_0x5b86c8['originated']+=_0x228c3e[_0x1ea0('0x98')];_0x5b86c8[_0x1ea0('0x42')]=_0x1ea0('0x1fe');for(var _0x36f127=0x0;_0x36f127<_0x228c3e[_0x1ea0('0x98')];_0x36f127+=0x1){_0x5b86c8['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x228c3e[_0x36f127])||_['isNil'](_0x228c3e[_0x36f127][_0x1ea0('0x167')])||_['isNil'](_0x228c3e[_0x36f127][_0x1ea0('0x167')][_0x1ea0('0x168')])){_0x54917a[_0x1ea0('0xce')](_0x1ea0('0x1ff'),_0x5b86c8,_0x228c3e[_0x36f127]);}else{_0x54917a[_0x1ea0('0xbb')](_[_0x1ea0('0xcf')](_0x228c3e[_0x36f127],[_0x1ea0('0xd2'),_0x1ea0('0x200')]))[_0x1ea0('0xb8')](_0x54917a[_0x1ea0('0x201')](_0x5b86c8,_0x228c3e[_0x36f127]))[_0x1ea0('0xb0')](_0x54917a[_0x1ea0('0xcd')](_0x1ea0('0x202'),_0x5b86c8));}}}})[_0x1ea0('0xb0')](loggerGetContactDialer(_0x1ea0('0x203'),_0x5b86c8,_0x50a7e2));}};Dialer['prototype'][_0x1ea0('0x155')]=function(_0x1ab099,_0x39de41){var _0x422dfa=this;var _0x4329b2=[];var _0x5ca4ae=_0x39de41>=0x1?_0x39de41:0x1;if(_0x1ab099[_0x1ea0('0x152')]===_0x1ea0('0x8')){_0x5ca4ae=0x1;}var _0x590b34=Math['floor'](_0x1ab099[_0x1ea0('0x55')]*_0x5ca4ae)-_0x1ab099['originated']-_0x1ab099[_0x1ea0('0xc3')];emitVoiceQueueSummary(_0x1ab099);if(_0x1ab099[_0x1ea0('0x204')]>0x0){var _0x4ce096=_0x1ab099['dialLimitQueue']-_0x1ab099[_0x1ea0('0x99')]-_0x1ab099[_0x1ea0('0x59')]-_0x1ab099[_0x1ea0('0xc3')]-_0x1ab099[_0x1ea0('0xa2')];if(_0x590b34>_0x4ce096){_0x590b34=_0x4ce096;}}if(_0x590b34>0x0){if(_0x1ab099[_0x1ea0('0x152')]===_0x1ea0('0x8')){_0x590b34=0x1;}if(_0x590b34>this['maxNumberOriginate']){_0x590b34=this['maxNumberOriginate'];}_0x1ab099[_0x1ea0('0xc3')]+=_0x590b34;for(var _0xd38c3 in this[_0x1ea0('0x21')]){if(typeof this[_0x1ea0('0x21')][_0xd38c3]!==_0x1ea0('0x9a')){if(this[_0x1ea0('0x21')][_0xd38c3][_0x1ea0('0xdf')]===_0x1ea0('0x205')&&this['agents'][_0xd38c3]['status']==='reachable'){_0x4329b2['push'](this['agents'][_0xd38c3]['id']);}}}this['getContactDialer'](_0x1ab099['id'],_0x4329b2,_0x590b34,_0x1ab099[_0x1ea0('0x1fc')],_0x1ab099)[_0x1ea0('0xb8')](function(_0x49e4fa){_0x1ab099['temp']-=_0x590b34;_0x1ab099[_0x1ea0('0xc3')]=_0x1ab099['temp']>0x0?_0x1ab099[_0x1ea0('0xc3')]:0x0;if(!checkContactEmpty(_0x49e4fa)){_0x422dfa[_0x1ea0('0xb6')](_0x1ab099)[_0x1ea0('0xb8')](sendMessageReschedule(_0x1ab099))[_0x1ea0('0xb0')](loggerCatch(_0x1ea0('0x206')));}else{_0x1ab099[_0x1ea0('0x99')]+=_0x49e4fa[_0x1ea0('0x98')];_0x1ab099['message']=_0x1ab099[_0x1ea0('0x152')]===_0x1ea0('0x8')?'ACTIVE':'RUNNING';for(var _0x6af2a3=0x0;_0x6af2a3<_0x49e4fa['length'];_0x6af2a3+=0x1){if(_[_0x1ea0('0xad')](_0x49e4fa[_0x6af2a3])||_[_0x1ea0('0xad')](_0x49e4fa[_0x6af2a3][_0x1ea0('0x167')])||_[_0x1ea0('0xad')](_0x49e4fa[_0x6af2a3][_0x1ea0('0x167')][_0x1ea0('0x168')])){_0x422dfa[_0x1ea0('0xce')](_0x1ea0('0x1ff'),_0x1ab099,_0x49e4fa[_0x6af2a3]);}else{_0x422dfa[_0x1ea0('0xb9')](_['pick'](_0x49e4fa[_0x6af2a3],[_0x1ea0('0xd1'),_0x1ea0('0x200')]))[_0x1ea0('0xb8')](_0x422dfa[_0x1ea0('0x201')](_0x1ab099,_0x49e4fa[_0x6af2a3]))[_0x1ea0('0xb0')](_0x422dfa['loggerHandler']('[actionOriginate]\x20',_0x1ab099));}}}})[_0x1ea0('0xb0')](loggerGetContactDialer(_0x1ea0('0x207'),_0x1ab099,_0x590b34));}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x90')]=function(_0x1ef098){if(_0x1ef098['dialLimitQueue']>0x0){var _0x205733=_0x1ef098[_0x1ea0('0x204')]-_0x1ef098[_0x1ea0('0x99')]-_0x1ef098[_0x1ea0('0x59')];if(_0x205733>0x0){this[_0x1ea0('0x208')](_0x1ef098);}else{loggerPredictiveCalls[_0x1ea0('0x7c')](_0x1ea0('0x209'));}}else{this[_0x1ea0('0x208')](_0x1ef098);}};Dialer[_0x1ea0('0x19')][_0x1ea0('0x208')]=function(_0xd61bf5){var _0x27a2cd=this;var _0x35f619=[];_0xd61bf5[_0x1ea0('0x99')]+=0x1;for(var _0x19fa88 in this['agents']){if(typeof this[_0x1ea0('0x21')][_0x19fa88]!==_0x1ea0('0x9a')){if(this['agents'][_0x19fa88][_0x1ea0('0xdf')]===_0x1ea0('0x205')&&this['agents'][_0x19fa88][_0x1ea0('0xd6')]===_0x1ea0('0xd5')){_0x35f619['push'](this[_0x1ea0('0x21')][_0x19fa88]['id']);}}}this[_0x1ea0('0xc2')](_0xd61bf5['id'],_0x35f619,0x1,_0xd61bf5['dialOrderByScheduledAt'],_0xd61bf5)['then'](function(_0xba0d84){if(!checkContactEmpty(_0xba0d84)){checkContactLowerLimitOriginate(_0xd61bf5,0x1,0x0);_0x27a2cd['countReScheduled'](_0xd61bf5)['then'](sendMessageReschedule(_0xd61bf5))[_0x1ea0('0xb0')](loggerCatch('[countReScheduled]\x20'));}else{_0xd61bf5[_0x1ea0('0x42')]=_0x1ea0('0x1fe');if(_[_0x1ea0('0xad')](_0xba0d84[0x0])||_['isNil'](_0xba0d84[0x0]['Contact'])||_[_0x1ea0('0xad')](_0xba0d84[0x0]['Contact']['phone'])){_0x27a2cd[_0x1ea0('0xce')](_0x1ea0('0x1ff'),_0xd61bf5,_0xba0d84[0x0]);}else{_0x27a2cd['checkIsBlackList'](_[_0x1ea0('0xcf')](_0xba0d84[0x0],[_0x1ea0('0xd1'),_0x1ea0('0x200')]))['then'](_0x27a2cd['checkContactBlack'](_0xd61bf5,_0xba0d84[0x0]))[_0x1ea0('0xb0')](_0x27a2cd[_0x1ea0('0xcd')](_0x1ea0('0x20a'),_0xd61bf5));}}})[_0x1ea0('0xb0')](loggerGetContactDialer(_0x1ea0('0x20b'),_0xd61bf5,0x1));emitVoiceQueueSummary(_0xd61bf5);};Dialer['prototype'][_0x1ea0('0x1e3')]=function(_0x2b3e9c,_0x502922,_0xb5f474,_0x5db988,_0x5ad325,_0x55fe64){loggerPredictive['info'](_0x1ea0('0x20c'));loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x20d'),_0x2b3e9c);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x20e'),_0x502922);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x20f'),_0xb5f474);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x210'),_0x5db988);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x211'),_0x5ad325);loggerPredictive['info'](_0x1ea0('0x83'));return new BPromise(function(_0x2f5792,_0x1713a7){if(_0x2b3e9c<=0x0||isNaN(_0x2b3e9c)){return _0x1713a7(msgResponse(_0x1ea0('0x212'),_0x1ea0('0x4c'),'m\x20=\x20'+_0x2b3e9c));}if(_0xb5f474<=0x0||isNaN(_0xb5f474)){return _0x1713a7(msgResponse('[abandonmentRate]',_0x1ea0('0x4c'),_0x1ea0('0x213')+_0xb5f474));}if(_0x5db988<=0x0||isNaN(_0x5db988)){return _0x1713a7(msgResponse('[abandonmentRate]',_0x1ea0('0x4c'),'p\x20=\x20'+_0x5db988));}if(_0x502922<=0x0||isNaN(_0x502922)){return _0x1713a7(msgResponse(_0x1ea0('0x212'),_0x1ea0('0x4c'),'interval\x20=\x20'+_0x502922));}if(_0x5ad325<=0x0||isNaN(_0x5ad325)){return _0x1713a7(msgResponse(_0x1ea0('0x212'),'Error','Amax\x20=\x20'+_0x5ad325));}_0x55fe64=_0x55fe64||0x0;var _0x440279=0x1/_0xb5f474;var _0x544a5b=0x0;var _0x4a5fce=0x0;var _0x4c2a21=0x0;var _0x55c4fa=0x0;for(var _0x2e090b=0x0;_0x4c2a21<_0x5ad325;_0x2e090b+=0x1){_0x4a5fce=_0x2e090b/_0x502922;_0x544a5b=(_0x5db988*_0x4a5fce+_0x55fe64)/_0x440279;_0x4c2a21=erlangb(_0x544a5b,_0x2b3e9c);_0x55c4fa=_0x544a5b/_0x2b3e9c*(0x1-erlangb(_0x544a5b,_0x2b3e9c));}return _0x2f5792({'erlangCalls':_0x2e090b,'erlangCallToSecond':_0x502922/_0x2e090b,'erlangAbandonmentRate':_0x4c2a21,'erlangBusyFactor':_0x55c4fa});});};Dialer[_0x1ea0('0x19')]['busyFactor']=function(_0x5ae4c8,_0x4de474,_0x344718,_0x4176b1,_0x47a97,_0x2ec616){loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x214'));loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x20d'),_0x5ae4c8);loggerPredictive['info'](_0x1ea0('0x20e'),_0x4de474);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x20f'),_0x344718);loggerPredictive[_0x1ea0('0x7c')]('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',_0x4176b1);loggerPredictive[_0x1ea0('0x7c')](_0x1ea0('0x215'),_0x47a97);loggerPredictive[_0x1ea0('0x7c')]('---------------------------');return new BPromise(function(_0x2a7db9,_0x1d06af){if(_0x5ae4c8<=0x0||isNaN(_0x5ae4c8)){return _0x1d06af(msgResponse(_0x1ea0('0x216'),'Error',_0x1ea0('0x217')+_0x5ae4c8));}if(_0x344718<=0x0||isNaN(_0x344718)){return _0x1d06af(msgResponse(_0x1ea0('0x216'),_0x1ea0('0x4c'),'Ts\x20=\x20'+_0x344718));}if(_0x4176b1<=0x0||isNaN(_0x4176b1)){return _0x1d06af(msgResponse(_0x1ea0('0x216'),_0x1ea0('0x4c'),_0x1ea0('0x218')+_0x4176b1));}if(_0x4de474<=0x0||isNaN(_0x4de474)){return _0x1d06af(msgResponse(_0x1ea0('0x216'),'Error',_0x1ea0('0x219')+_0x4de474));}if(_0x47a97<=0x0||isNaN(_0x47a97)){return _0x1d06af(msgResponse(_0x1ea0('0x216'),_0x1ea0('0x4c'),_0x1ea0('0x21a')+_0x47a97));}_0x2ec616=_0x2ec616||0x0;var _0x3eb205=0x1/_0x344718;var _0x3b4934=0x0;var _0x36e483=0x0;var _0x145466=0x0;var _0xb095e6=0x0;for(var _0x4a06f2=0x0;_0xb095e6<_0x47a97;_0x4a06f2+=0x1){_0x36e483=_0x4a06f2/_0x4de474;_0x3b4934=(_0x4176b1*_0x36e483+_0x2ec616)/_0x3eb205;_0x145466=erlangb(_0x3b4934,_0x5ae4c8);_0xb095e6=_0x3b4934/_0x5ae4c8*(0x1-erlangb(_0x3b4934,_0x5ae4c8));}return _0x2a7db9({'erlangCalls':_0x4a06f2,'erlangCallToSecond':_0x4de474/_0x4a06f2,'erlangAbandonmentRate':_0x145466,'erlangBusyFactor':_0xb095e6});});};module[_0x1ea0('0x21b')]=Dialer; \ No newline at end of file +var _0xaa79=['XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectRetryFrequency','callProgressDetecting','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','abandonmentRate','[CatchErlangB]','erlangCallToSecond','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','emptyContact','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','[handlePredictive][limitChannel]','not_inuse','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','127.0.0.1','roundrobin','prototype','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startProgressive','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummary','hangup','syncHangup','newexten','varset','syncVarSet','loopClearZombieChannels','then','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','pTalking','sumBillable','talking','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','Trunk','active','callerid','md5','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','info','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\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','seconds','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','sequence','enqueue','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','saveInDb','merge','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','custom:amd','amd','[syncHangupInAMD][createHistory]','MACHINE','membername','AMD','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','CampaignId','[syncHangupInAMDIvr][createHistory]','Machine','countbusyretry','dialGlobalMaxRetry','add','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','Unknow','[syncHangupIvr]','reason','agent','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','countglobal','dialDropMaxRetry','[rescheduleContact][Drop]','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','paused','stateinterface','rrmemory','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','iftime\x20%s,%s','interval','indexOf','command','content','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','Queue','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','loggedIn','checkIsTrunkReachable','dialTimezone','dialPreviewRecallmeReminder','syncCampaigns','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialer','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH'];(function(_0x50ca5c,_0x4d5407){var _0x52af0c=function(_0x2d55cd){while(--_0x2d55cd){_0x50ca5c['push'](_0x50ca5c['shift']());}};_0x52af0c(++_0x4d5407);}(_0xaa79,0x9a));var _0x9aa7=function(_0x5b545c,_0xf20df1){_0x5b545c=_0x5b545c-0x0;var _0x182d72=_0xaa79[_0x5b545c];return _0x182d72;};'use strict';var util=require(_0x9aa7('0x0'));var _=require(_0x9aa7('0x1'));var BPromise=require(_0x9aa7('0x2'));var uuid=require(_0x9aa7('0x3'));var moment=require(_0x9aa7('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x9aa7('0x5'));var config=require(_0x9aa7('0x6'));var logger=require(_0x9aa7('0x7'))('dialer');var loggerBooked=require(_0x9aa7('0x7'))(_0x9aa7('0x8'));var loggerPredictive=require(_0x9aa7('0x7'))(_0x9aa7('0x9'));var loggerPredictiveCalls=require(_0x9aa7('0x7'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x9aa7('0x7'))('syncQueueSummary');var ami=require(_0x9aa7('0xa'));config[_0x9aa7('0xb')]=_[_0x9aa7('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x9aa7('0xd'));var cmHopperHistory=require(_0x9aa7('0xe'));var cmHopperBlack=require(_0x9aa7('0xf'));var voiceQueueRt=require(_0x9aa7('0x10'));var RpcSetting=require(_0x9aa7('0x11'));var Action=require(_0x9aa7('0x12'));var History=require(_0x9aa7('0x13'));var Final=require(_0x9aa7('0x14'));var AgentComplete=require(_0x9aa7('0x15'));var QueueCallerAbandon=require(_0x9aa7('0x16'));var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x9aa7('0x17');var strategy={'rrmemory':'rrmemory','roundrobin':_0x9aa7('0x18')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9aa7('0x19')]['enqueue']=function(_0x204340){this[_0x9aa7('0x1a')]=this[_0x9aa7('0x1a')]?this[_0x9aa7('0x1a')]['finally'](_0x204340):_0x204340();};function Dialer(_0x2b8ca0,_0x5b08a2){this['sequence']=new Sequence();this[_0x9aa7('0x1b')]=_0x5b08a2;this[_0x9aa7('0x1c')]=_0x2b8ca0['voiceQueues'];this[_0x9aa7('0x1d')]=_0x2b8ca0[_0x9aa7('0x1d')];this[_0x9aa7('0x1e')]=_0x2b8ca0['agents'];this['trunks']=_0x2b8ca0[_0x9aa7('0x1f')];this['maxNumberOriginate']=config[_0x9aa7('0x20')]||0x2;this[_0x9aa7('0x21')]={};this[_0x9aa7('0x22')]={};this['contactsId']={};this[_0x9aa7('0x23')]={};this[_0x9aa7('0x24')]={};this['startPredictive']={};this[_0x9aa7('0x25')]={};this['ivrOriginated']={};this[_0x9aa7('0x26')]={};this[_0x9aa7('0x27')]={};ami['on']('agentconnect',this[_0x9aa7('0x28')][_0x9aa7('0x29')](this));ami['on'](_0x9aa7('0x2a'),this[_0x9aa7('0x2b')][_0x9aa7('0x29')](this));ami['on'](_0x9aa7('0x2c'),this[_0x9aa7('0x2d')][_0x9aa7('0x29')](this));ami['on'](_0x9aa7('0x2e'),this[_0x9aa7('0x2f')][_0x9aa7('0x29')](this));ami['on']('custom:queuesummary',this[_0x9aa7('0x30')][_0x9aa7('0x29')](this));ami['on'](_0x9aa7('0x31'),this[_0x9aa7('0x32')][_0x9aa7('0x29')](this));ami['on'](_0x9aa7('0x33'),this['syncNewExten'][_0x9aa7('0x29')](this));ami['on'](_0x9aa7('0x34'),this[_0x9aa7('0x35')][_0x9aa7('0x29')](this));ami['on']('queuemember',this['syncQueueMember'][_0x9aa7('0x29')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this[_0x9aa7('0x36')]();RpcSetting['getSettings']()[_0x9aa7('0x37')](function(_0x33504a){previewRecallmeReminderInterval=_0x33504a['previewRecallmeReminderInterval'];});}function isNotNull(_0x1987b8){return _0x1987b8!==null&&!_[_0x9aa7('0x38')](_0x1987b8);}function checkIsLoggedIn(_0x20e687,_0x364469){return function(){if(_0x364469<=0x0){_0x20e687[_0x9aa7('0x39')]=_0x9aa7('0x3a');throw _0x20e687[_0x9aa7('0x3b')]+_0x9aa7('0x3c');}};}function isActive(_0x3178c6){return _0x3178c6;}function checkIsActive(_0x143767,_0x5624a2){return function(){if(!isActive(_0x5624a2)){_0x143767['message']='NOT_ACTIVE';throw _0x143767[_0x9aa7('0x3b')]+_0x9aa7('0x3d');}};}function checkInterval(_0x370170){return function(){if(!isNotNull(_0x370170[_0x9aa7('0x3e')])){_0x370170['message']='INTERVAL_IS_NULL';throw _0x370170[_0x9aa7('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x370170['Interval'][_0x9aa7('0x3f')])){_0x370170[_0x9aa7('0x39')]=_0x9aa7('0x40');throw _0x370170['name']+_0x9aa7('0x41');}if(!isNotNull(_[_0x9aa7('0x42')](_0x370170[_0x9aa7('0x3e')][_0x9aa7('0x3f')]))){_0x370170[_0x9aa7('0x39')]=_0x9aa7('0x40');throw _0x370170[_0x9aa7('0x3b')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x2af68a,_0x38f2b9,_0x34ff1f){return{'action':_0x2af68a,'response':_0x38f2b9,'message':_0x34ff1f,'stack':_0x34ff1f};}function myreject(_0x4e61b5){return function(_0x586725){return _0x4e61b5(msgResponse(_0x9aa7('0x43'),_0x9aa7('0x44'),JSON[_0x9aa7('0x45')](_0x586725)));};}function getSeconds(_0x404de1,_0x3f9e37){var _0x25ea6f=moment(_0x404de1)[_0x9aa7('0x46')](0x0);var _0x120423=moment(_0x3f9e37)['milliseconds'](0x0);return _0x25ea6f[_0x9aa7('0x47')](_0x120423,'seconds');}function emit(_0x20773b,_0x31a839,_0x5b6272){io['to'](_0x20773b)[_0x9aa7('0x48')](_0x31a839,_0x5b6272);}function emitVoiceQueueSummary(_0x1028e5){if(_0x1028e5[_0x9aa7('0x49')]===_0x9aa7('0x4a')){var _0x34ad51={'id':_0x1028e5['id'],'name':_0x1028e5[_0x9aa7('0x3b')],'strategy':_0x1028e5[_0x9aa7('0x4b')],'answered':_0x1028e5[_0x9aa7('0x4c')],'available':_0x1028e5[_0x9aa7('0x4d')],'loggedIn':_0x1028e5['loggedIn'],'pTalking':_0x1028e5[_0x9aa7('0x4e')],'sumBillable':_0x1028e5[_0x9aa7('0x4f')],'sumDuration':_0x1028e5['sumDuration'],'sumHoldTime':_0x1028e5['sumHoldTime']||0x0,'talking':_0x1028e5[_0x9aa7('0x50')],'total':_0x1028e5['total'],'type':_0x1028e5['type'],'unmanaged':_0x1028e5['unmanaged'],'abandoned':_0x1028e5['abandoned'],'waiting':_0x1028e5[_0x9aa7('0x51')],'loggedInDb':_0x1028e5[_0x9aa7('0x52')],'dialActive':_0x1028e5[_0x9aa7('0x53')],'dialMethod':_0x1028e5['dialMethod'],'dialOriginateCallerIdName':_0x1028e5['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1028e5[_0x9aa7('0x54')],'dialOriginateTimeout':_0x1028e5[_0x9aa7('0x55')],'dialPrefix':_0x1028e5[_0x9aa7('0x56')],'outboundAnswerAgiCallsDay':_0x1028e5[_0x9aa7('0x57')],'outboundAnswerCallsDay':_0x1028e5[_0x9aa7('0x58')],'outboundBlacklistCallsDay':_0x1028e5[_0x9aa7('0x59')],'outboundBusyCallsDay':_0x1028e5[_0x9aa7('0x5a')],'outboundCongestionCallsDay':_0x1028e5[_0x9aa7('0x5b')],'outboundDropCallsDayACS':_0x1028e5['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1028e5[_0x9aa7('0x5c')],'outboundDropCallsDayTimeout':_0x1028e5[_0x9aa7('0x5d')],'outboundNoAnswerCallsDay':_0x1028e5['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1028e5[_0x9aa7('0x5e')],'outboundOriginateFailureCallsDay':_0x1028e5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1028e5[_0x9aa7('0x5f')],'outboundRejectCallsDay':_0x1028e5[_0x9aa7('0x60')],'outboundUnknownCallsDay':_0x1028e5[_0x9aa7('0x61')],'predictiveIntervalAnsweredCalls':_0x1028e5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1028e5[_0x9aa7('0x62')],'predictiveIntervalAvgTalktime':_0x1028e5[_0x9aa7('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0x1028e5[_0x9aa7('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x1028e5[_0x9aa7('0x65')],'predictiveIntervalErlangCalls':_0x1028e5[_0x9aa7('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x1028e5[_0x9aa7('0x67')],'predictiveIntervalHitRate':_0x1028e5[_0x9aa7('0x68')],'predictiveIntervalMultiplicativeFactor':_0x1028e5['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1028e5['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1028e5[_0x9aa7('0x69')],'predictiveIntervalTotalCalls':_0x1028e5[_0x9aa7('0x6a')],'message':_0x1028e5[_0x9aa7('0x39')],'originated':_0x1028e5[_0x9aa7('0x6b')],'erlangCalls':_0x1028e5['erlangCalls'],'erlangCallToSecond':_0x1028e5['erlangCallToSecond'],'erlangAbandonmentRate':_0x1028e5[_0x9aa7('0x6c')],'erlangBusyFactor':_0x1028e5['erlangBusyFactor'],'startPredictive':_0x1028e5['startPredictive'],'startProgressive':_0x1028e5[_0x9aa7('0x25')]};if(_0x1028e5[_0x9aa7('0x6d')]){_0x34ad51[_0x9aa7('0x6d')]={'id':_0x1028e5[_0x9aa7('0x6d')]['id'],'name':_0x1028e5[_0x9aa7('0x6d')][_0x9aa7('0x3b')],'active':_0x1028e5[_0x9aa7('0x6d')][_0x9aa7('0x6e')],'callerid':_0x1028e5[_0x9aa7('0x6d')][_0x9aa7('0x6f')]};}if(_0x1028e5[_0x9aa7('0x3e')]){_0x34ad51[_0x9aa7('0x3e')]={'id':_0x1028e5[_0x9aa7('0x3e')]['id'],'name':_0x1028e5['Interval'][_0x9aa7('0x3b')]};}var _0xbac9cb=md5(JSON[_0x9aa7('0x45')](_0x34ad51));if(_0x1028e5[_0x9aa7('0x70')]!==_0xbac9cb){_0x1028e5[_0x9aa7('0x70')]=_0xbac9cb;emit(util[_0x9aa7('0x71')]('voice:queue:%s',_0x34ad51[_0x9aa7('0x3b')]),_0x9aa7('0x72'),_0x34ad51);}}}function emitCampaignSummary(_0x395f93){if(_0x395f93[_0x9aa7('0x49')]===_0x9aa7('0x73')){emit(util['format'](_0x9aa7('0x74'),_0x395f93[_0x9aa7('0x3b')]),_0x9aa7('0x75'),_0x395f93);}}function checkGetDataPredictive(_0x68bca6){if(isNotNull(_0x68bca6)&&!_[_0x9aa7('0x42')](_0x68bca6)){loggerPredictive['info'](_0x9aa7('0x76'));loggerPredictive['info'](_0x9aa7('0x77'),_0x68bca6['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x68bca6[_0x9aa7('0x78')]);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x7a'),_0x68bca6['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x7b'),_0x68bca6[_0x9aa7('0x64')]);loggerPredictive[_0x9aa7('0x79')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x68bca6['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x9aa7('0x7c'),_0x68bca6['predictiveIntervalAvgTalktime']);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x7d'));if(_0x68bca6[_0x9aa7('0x6a')]>0x0){if(!_[_0x9aa7('0x38')](_0x68bca6[_0x9aa7('0x63')])&&_0x68bca6[_0x9aa7('0x63')]>0x0){return!![];}loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x7e'));if(!_['isUndefined'](_0x68bca6['predictiveIntervalAvgHoldtime'])&&_0x68bca6[_0x9aa7('0x62')]>0x0){return!![];}loggerPredictive['info'](_0x9aa7('0x7f'));}else{loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x80'));}}else{loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x81'));}return![];}function mergeDataErlangB(_0x517f6f){return function(_0x3e8ca7){loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x82'));loggerPredictive['info'](_0x9aa7('0x83'),_0x3e8ca7[_0x9aa7('0x84')]);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x85'),_0x3e8ca7['erlangCallToSecond']);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x86'),_0x3e8ca7['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e8ca7[_0x9aa7('0x87')]);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x86'),_0x3e8ca7['erlangAbandonmentRate']);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x7d'));_['merge'](_0x517f6f,_0x3e8ca7);};}function getDiff(_0x2aa000){var _0x1eb370=moment()['milliseconds'](0x0);var _0x5a6806=moment(_0x2aa000)[_0x9aa7('0x46')](0x0);return _0x1eb370[_0x9aa7('0x47')](_0x5a6806,_0x9aa7('0x88'));}function ifInterval(_0x3187ad,_0x2b59e0){if(_[_0x9aa7('0x38')](_0x2b59e0)){return![];}return getDiff(_0x2b59e0)<_0x3187ad*0x3c;}function freeVariablesPredictive(_0x42a33c){if(isNotNull(_0x42a33c)){if(!_[_0x9aa7('0x38')](_0x42a33c[_0x9aa7('0x25')])){_0x42a33c[_0x9aa7('0x25')]=undefined;loggerPredictive[_0x9aa7('0x79')](_0x42a33c[_0x9aa7('0x3b')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x9aa7('0x38')](_0x42a33c[_0x9aa7('0x89')])){_0x42a33c[_0x9aa7('0x89')]=undefined;loggerPredictive[_0x9aa7('0x79')](_0x42a33c['name'],_0x9aa7('0x8a'));}if(!_[_0x9aa7('0x38')](_0x42a33c['handlePredictive'])){clearInterval(_0x42a33c[_0x9aa7('0x8b')]);_0x42a33c[_0x9aa7('0x8b')]=undefined;loggerPredictive['info'](_0x42a33c[_0x9aa7('0x3b')],_0x9aa7('0x8c'));}}}function erlangb(_0x46cb6b,_0x533898){if(_0x533898===0x0){return 0x0;}var _0xff0039=0x1;for(var _0x48b824=0x1;_0x48b824<=_0x533898;_0x48b824+=0x1){_0xff0039=0x1+_0xff0039*_0x48b824/_0x46cb6b;}return 0x1/_0xff0039;}function isVoiceQueueOutbound(_0x251a96){return _0x251a96===_0x9aa7('0x4a');}function isNotPreview(_0x317dd1){return _0x317dd1!=='preview';}function isCampaignIvr(_0x17c0a7){return _0x17c0a7===_0x9aa7('0x73');}function getCallerId(_0x3aec63,_0x23c6cf,_0x330454){if(!_[_0x9aa7('0x38')](_0x330454)&&typeof _0x330454===_0x9aa7('0x8d')&&!_[_0x9aa7('0x42')](_0x330454)){if(!_[_0x9aa7('0x38')](_0x23c6cf)&&typeof _0x23c6cf===_0x9aa7('0x8d')&&!_[_0x9aa7('0x42')](_0x23c6cf)){return util[_0x9aa7('0x71')]('\x22%s\x22\x20<%s>',_0x23c6cf,_0x330454);}return util['format'](_0x9aa7('0x8e'),_0x330454,_0x330454);}if(!_['isUndefined'](_0x3aec63)&&typeof _0x3aec63===_0x9aa7('0x8d')&&!_[_0x9aa7('0x42')](_0x3aec63)){return _0x3aec63;}return _0x9aa7('0x8f');}function loggerCatchQueueSummary(_0x135aa4,_0x530fd3){return function(_0x3855bb){freeVariablesPredictive(_0x530fd3);emitVoiceQueueSummary(_0x530fd3);emitCampaignSummary(_0x530fd3);loggerSyncQueueSummary['error'](_0x135aa4,util[_0x9aa7('0x90')](_0x3855bb,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x471096,_0x4d5996){return function(_0x47031d){loggerPredictive[_0x9aa7('0x91')](_0x4d5996[_0x9aa7('0x3b')],_0x471096);loggerPredictive['error'](_0x47031d[_0x9aa7('0x92')]);freeVariablesPredictive(_0x4d5996);};}function loggerCatch(_0x57e3d9){return function(_0x8e691c){logger['error'](_0x57e3d9,util['inspect'](_0x8e691c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1c2de0){return _0x1c2de0&&!_['isUndefined'](_0x1c2de0)&&_0x1c2de0[_0x9aa7('0x93')]>0x0;}function decremetOriginate(_0x15ab9e){if(!_[_0x9aa7('0x38')](_0x15ab9e)&&_0x15ab9e!==null){if(typeof _0x15ab9e['originated']!=='undefined'){if(_0x15ab9e['originated']>0x0){_0x15ab9e[_0x9aa7('0x6b')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x9aa7('0x91')](_0x9aa7('0x94'));}}function checkContactLowerLimitOriginate(_0x1ed9a5,_0x23f686,_0x331915){if(_0x23f686>_0x331915){for(var _0x434ace=0x0;_0x434ace<_0x23f686-_0x331915;_0x434ace+=0x1){decremetOriginate(_0x1ed9a5);}}}function loggerGetContactDialer(_0x1119c5,_0x5dc01c,_0xf9b165){return function(_0x2430fb){checkContactLowerLimitOriginate(_0x5dc01c,_0xf9b165,0x0);logger[_0x9aa7('0x91')](_0x1119c5,util[_0x9aa7('0x90')](_0x2430fb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x44e89e){return function(_0x41955c){if(isNotNull(_0x41955c)&&isNotNull(_0x41955c[0x0])){if(_0x41955c[0x0][_0x9aa7('0x95')]>0x0){_0x44e89e[_0x9aa7('0x39')]=_0x9aa7('0x96');logger[_0x9aa7('0x79')]('[getContactDialer2][ReScheduled]'+_0x44e89e['name'],_0x41955c[0x0][_0x9aa7('0x95')],_0x9aa7('0x97'));}else{_0x44e89e[_0x9aa7('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x9aa7('0x79')](_0x9aa7('0x98')+_0x44e89e[_0x9aa7('0x3b')]);}}};}function notSendMessagesQueue(_0x53a66e){if(_0x53a66e[_0x9aa7('0x99')]){freeVariablesPredictive(_0x53a66e);if(_0x53a66e[_0x9aa7('0x6b')]===0x0&&_0x53a66e[_0x9aa7('0x50')]===0x0&&_0x53a66e[_0x9aa7('0x51')]===0x0&&(_0x53a66e[_0x9aa7('0x4e')]||0x0)===0x0){_0x53a66e['sendMessageOneNotActive']=![];_0x53a66e[_0x9aa7('0x4d')]=0x0;_0x53a66e[_0x9aa7('0x39')]=_0x9aa7('0x9a');loggerSyncQueueSummary['error'](_0x9aa7('0x9b'),_0x53a66e[_0x9aa7('0x3b')],_0x9aa7('0x9c'));}else{_0x53a66e['message']=_0x9aa7('0x9d');loggerSyncQueueSummary[_0x9aa7('0x91')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x53a66e['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x53a66e);}}function notSendMessagesCampaign(_0x1309c2){if(_0x1309c2[_0x9aa7('0x99')]){if(_0x1309c2[_0x9aa7('0x6b')]===0x0){_0x1309c2['sendMessageOneNotActive']=![];_0x1309c2[_0x9aa7('0x39')]=_0x9aa7('0x9a');loggerSyncQueueSummary[_0x9aa7('0x91')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1309c2[_0x9aa7('0x3b')],_0x9aa7('0x9c'));}else{_0x1309c2[_0x9aa7('0x39')]=_0x9aa7('0x9d');loggerSyncQueueSummary[_0x9aa7('0x91')](_0x9aa7('0x9e'),_0x1309c2[_0x9aa7('0x3b')],_0x9aa7('0x9f'));}emitCampaignSummary(_0x1309c2);}}function createObjHistory(_0x569f3f,_0x5c1b9b,_0xe7bc27,_0x53be6b,_0x1583b2){_0x569f3f[_0x9aa7('0x39')]=_0xe7bc27;var _0x51be2a=new Action(_0x569f3f,_0x5c1b9b);var _0x15b09f=new History(_0x51be2a);_0x15b09f[_0x9aa7('0xa0')]=_0x53be6b;_0x15b09f[_0x9aa7('0xa1')]=_0x1583b2;_0x15b09f[_0x9aa7('0xa2')]=_0x51be2a[_0x9aa7('0xa3')];return _0x15b09f;}Dialer[_0x9aa7('0x19')]['loopClearZombieChannels']=function(){var _0x32faae=this;setInterval(function(){_0x32faae[_0x9aa7('0xa4')](_0x32faae[_0x9aa7('0x23')],_0x9aa7('0xa5'));_0x32faae[_0x9aa7('0xa4')](_0x32faae[_0x9aa7('0x22')],_0x9aa7('0xa6'));},0x32c8);};Dialer['prototype'][_0x9aa7('0xa4')]=function(_0x3bcf03,_0x5ce4ff){var _0x3c73b0=this;for(var _0x54e5a4 in _0x3bcf03){if(typeof _0x3bcf03[_0x54e5a4]!==_0x9aa7('0xa7')){this[_0x9aa7('0xa8')][_0x9aa7('0xa9')](function(){if(!_[_0x9aa7('0xaa')](_0x3bcf03[_0x54e5a4])){return ami[_0x9aa7('0xab')]({'action':_0x9aa7('0xac'),'channel':_0x3bcf03[_0x54e5a4][_0x9aa7('0xad')]})['catch'](function(_0x215ab5){if(_0x215ab5[_0x9aa7('0x39')]===_0x9aa7('0xae')){setTimeout(function(){if(_0x3bcf03[_0x54e5a4]&&_0x3bcf03[_0x54e5a4][_0x9aa7('0x49')]!=='ivr'){_0x3c73b0[_0x9aa7('0xaf')](_0x3c73b0[_0x9aa7('0x1c')][_0x3bcf03[_0x54e5a4][_0x9aa7('0xb0')]]);logger[_0x9aa7('0x91')]('[Dialer][checkChannel]',_0x5ce4ff,_0x54e5a4,_0x3bcf03[_0x54e5a4][_0x9aa7('0xb0')]);delete _0x3bcf03[_0x54e5a4];}if(_0x3bcf03[_0x54e5a4]&&_0x3bcf03[_0x54e5a4][_0x9aa7('0x49')]===_0x9aa7('0x73')){_0x3c73b0[_0x9aa7('0xaf')](_0x3c73b0[_0x9aa7('0x1d')][_0x3bcf03[_0x54e5a4][_0x9aa7('0xb0')]]);logger['error'](_0x9aa7('0xb1'),_0x5ce4ff,_0x54e5a4,_0x3bcf03[_0x54e5a4]['queue']);delete _0x3bcf03[_0x54e5a4];}},0x2328);}});}});}}};Dialer[_0x9aa7('0x19')][_0x9aa7('0xb2')]=function(_0x3aa0ca){return BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](cmHopper['countReScheduled'](_0x3aa0ca))['catch'](loggerCatch(_0x9aa7('0xb4')));};Dialer[_0x9aa7('0x19')]['checkIsBlackList']=function(_0x34d71f){return BPromise['resolve']()[_0x9aa7('0x37')](cmHopperBlack[_0x9aa7('0xb5')](_0x34d71f))[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xb7')));};Dialer[_0x9aa7('0x19')][_0x9aa7('0xb8')]=function(_0x5cee60){return BPromise[_0x9aa7('0xb3')]()['then'](cmHopperBlack[_0x9aa7('0xb8')](_0x5cee60))[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xb9')));};Dialer[_0x9aa7('0x19')][_0x9aa7('0xba')]=function(_0x8e70c1){return BPromise[_0x9aa7('0xb3')]()['then'](cmHopperHistory['avgHandleTime'](_0x8e70c1))[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xbb')));};Dialer[_0x9aa7('0x19')][_0x9aa7('0xbc')]=function(_0xa966e4){return BPromise['resolve']()[_0x9aa7('0x37')](cmHopper[_0x9aa7('0xbc')](_0xa966e4))[_0x9aa7('0xb6')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x9aa7('0x19')][_0x9aa7('0xbd')]=function(_0x524d93,_0x37d089,_0x15d393){return BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](cmHopper[_0x9aa7('0xbd')](_0x524d93,_0x37d089,_0x15d393))[_0x9aa7('0xb6')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x9aa7('0x19')][_0x9aa7('0xbe')]=function(_0x2faa1a,_0x5325f4,_0x475049,_0x3f87ce,_0xea6b9a){return BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](cmHopper[_0x9aa7('0xbe')](_0x2faa1a,_0x5325f4,_0x475049,_0x3f87ce))['catch'](function(_0x4ff67b){_0xea6b9a[_0x9aa7('0xbf')]-=_0x475049;_0xea6b9a[_0x9aa7('0xbf')]=_0xea6b9a[_0x9aa7('0xbf')]>0x0?_0xea6b9a[_0x9aa7('0xbf')]:0x0;loggerCatch(_0x9aa7('0xc0'))(_0x4ff67b);});};Dialer[_0x9aa7('0x19')][_0x9aa7('0xc1')]=function(_0x37edcb,_0x4ddac1,_0x542e6e,_0xa95213){return BPromise[_0x9aa7('0xb3')]()['then'](cmHopper['getContactDialerIvr'](_0x37edcb,_0x4ddac1,_0x542e6e))[_0x9aa7('0xb6')](function(_0x595142){_0xa95213[_0x9aa7('0xbf')]-=_0x4ddac1;_0xa95213[_0x9aa7('0xbf')]=_0xa95213[_0x9aa7('0xbf')]>0x0?_0xa95213[_0x9aa7('0xbf')]:0x0;loggerCatch(_0x9aa7('0xc2'))(_0x595142);});};Dialer[_0x9aa7('0x19')]['getVoiceQueueRtPauses']=function(_0x456a8c){return BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](voiceQueueRt[_0x9aa7('0xc3')](_0x456a8c))[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xc4')));};Dialer[_0x9aa7('0x19')][_0x9aa7('0xc5')]=function(_0x2020fa){return BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](cmHopper['moveContactManagedDialer'](_0x2020fa))['catch'](loggerCatch(_0x9aa7('0xc6')));};Dialer[_0x9aa7('0x19')]['createHistory']=function(_0x5af21c){return BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](cmHopperHistory[_0x9aa7('0xc7')](_0x5af21c))[_0x9aa7('0xb6')](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x9aa7('0xaf')]=function(_0x1f6aac){if(!_[_0x9aa7('0x38')](_0x1f6aac)&&_0x1f6aac!==null){if(typeof _0x1f6aac['originated']!==_0x9aa7('0xa7')){if(_0x1f6aac[_0x9aa7('0x6b')]>0x0){_0x1f6aac[_0x9aa7('0x6b')]-=0x1;}else{logger[_0x9aa7('0x91')](_0x9aa7('0xc8'));}}}else{logger[_0x9aa7('0x91')](_0x9aa7('0xc9'));}};Dialer[_0x9aa7('0x19')]['loggerHandler']=function(_0x44bd3e,_0x440cc6){var _0x33e5c1=this;return function(_0x38a358){_0x33e5c1[_0x9aa7('0xaf')](_0x440cc6);logger['error'](_0x44bd3e,util[_0x9aa7('0x90')](_0x38a358,{'showHidden':![],'depth':null}));};};Dialer[_0x9aa7('0x19')]['emptyContact']=function(_0x6aae66,_0x2b16d8,_0x3354e7){var _0x25105b={'state':0x19,'statedesc':_0x9aa7('0xca')};this[_0x9aa7('0xaf')](_0x2b16d8);this[_0x9aa7('0xcb')](_[_0x9aa7('0xcc')](_0x25105b,_['pick'](_0x3354e7,['ContactId',_0x9aa7('0xcd'),_0x9aa7('0xce'),_0x9aa7('0xcf'),'CampaignId'])),_0x9aa7('0xd0'),'[emptyContact]');logger[_0x9aa7('0x91')](_0x6aae66);};Dialer[_0x9aa7('0x19')][_0x9aa7('0xd1')]=function(_0x2c0426){return _0x2c0426===_0x9aa7('0xd2');};Dialer['prototype']['isTrunkReachable']=function(_0x4c111b){return!_[_0x9aa7('0x38')](_0x4c111b)&&_0x4c111b&&!_['isUndefined'](_0x4c111b['name'])&&!_['isUndefined'](_0x4c111b[_0x9aa7('0x6e')])&&_0x4c111b[_0x9aa7('0x6e')]&&(this['trunks'][util[_0x9aa7('0x71')](_0x9aa7('0xd3'),_0x4c111b[_0x9aa7('0x3b')])][_0x9aa7('0xac')]===_0x9aa7('0xd4')||this[_0x9aa7('0x1f')][util[_0x9aa7('0x71')]('SIP/%s',_0x4c111b[_0x9aa7('0x3b')])]['status']===_0x9aa7('0xd5'));};Dialer['prototype'][_0x9aa7('0xcb')]=function(_0x3008ea,_0x2c92bb,_0x230647){this[_0x9aa7('0xc7')](_0x3008ea)[_0x9aa7('0xb6')](loggerCatch(_0x2c92bb));this['moveContactManagedDialer'](_0x3008ea)[_0x9aa7('0xb6')](loggerCatch(_0x230647));};Dialer[_0x9aa7('0x19')][_0x9aa7('0x35')]=function(_0x104d15){var _0x3de1b5=this['uniqueId'][_0x104d15[_0x9aa7('0xd6')]];var _0x5043b4;if(!_['isNil'](_0x104d15)&&!_[_0x9aa7('0xaa')](_0x104d15['variable'])&&!_[_0x9aa7('0xaa')](_0x104d15[_0x9aa7('0xd7')]['amdstatus'])&&_0x104d15[_0x9aa7('0xd8')]===_0x9aa7('0xd9')&&_0x3de1b5){if(_0x3de1b5[_0x9aa7('0x49')]!==_0x9aa7('0x73')&&this[_0x9aa7('0x1c')][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0xda')]&&_0x104d15[_0x9aa7('0xdb')]===_0x9aa7('0xdc')){delete this[_0x9aa7('0x23')][_0x104d15[_0x9aa7('0xd6')]];this[_0x9aa7('0xaf')](this[_0x9aa7('0x1c')][_0x3de1b5['queue']]);this[_0x9aa7('0x1c')][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0x58')]+=0x1;this[_0x9aa7('0x1c')][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0x57')]+=0x1;_0x5043b4=new Hangup(_0x3de1b5,_0x104d15);_0x5043b4[_0x9aa7('0xa0')]=0x12;_0x5043b4[_0x9aa7('0xa1')]=_0x9aa7('0xdd');_0x5043b4['membername']='AMD';ami[_0x9aa7('0x48')](_0x9aa7('0xde'),ut['buildObj'](_0x5043b4,_0x9aa7('0xdf')));this[_0x9aa7('0xcb')](_0x5043b4,_0x9aa7('0xe0'),'[syncHangupInAMD]');}if(_0x3de1b5[_0x9aa7('0x49')]!==_0x9aa7('0x73')&&this[_0x9aa7('0x1c')][_0x3de1b5['queue']]['dialAMDActive']&&_0x104d15[_0x9aa7('0xdb')]===_0x9aa7('0xe1')){var _0x1dfe51=this;return new BPromise(function(_0x1b8141,_0x5bcc4f){delete _0x1dfe51[_0x9aa7('0x23')][_0x104d15[_0x9aa7('0xd6')]];_0x1dfe51[_0x9aa7('0xaf')](_0x1dfe51[_0x9aa7('0x1c')][_0x3de1b5[_0x9aa7('0xb0')]]);_0x1dfe51[_0x9aa7('0x1c')][_0x3de1b5[_0x9aa7('0xb0')]]['outboundAnswerCallsDay']+=0x1;_0x1dfe51[_0x9aa7('0x1c')][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0x57')]+=0x1;var _0x1445b7=_0x1dfe51[_0x9aa7('0x1c')][_0x3de1b5[_0x9aa7('0xb0')]];var _0xbf165f=new Hangup(_0x3de1b5,_0x104d15);_0xbf165f[_0x9aa7('0xa0')]=0x13;_0xbf165f['statedesc']='Machine';_0xbf165f[_0x9aa7('0xe2')]=_0x9aa7('0xe3');_0xbf165f[_0x9aa7('0xe4')]+=0x1;_0xbf165f['countglobal']+=0x1;_0xbf165f[_0x9aa7('0xdf')]=!![];ami[_0x9aa7('0x48')](_0x9aa7('0xde'),ut[_0x9aa7('0xe5')](_0xbf165f,_0x9aa7('0xdf')));_0x1dfe51['createHistory'](_0xbf165f)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xe6')));if(_0xbf165f['countbusyretry']+_0xbf165f[_0x9aa7('0xe7')]+_0xbf165f[_0x9aa7('0xe8')]+_0xbf165f[_0x9aa7('0xe9')]+_0xbf165f[_0x9aa7('0xea')]+_0xbf165f[_0x9aa7('0xeb')]+_0xbf165f[_0x9aa7('0xe4')]+_0xbf165f[_0x9aa7('0xec')]>=_0x1445b7['dialGlobalMaxRetry']){_0x1dfe51[_0x9aa7('0xed')](_0xbf165f,_0x1b8141,_0x5bcc4f,'reason19\x20machine....');}else{if(_0xbf165f[_0x9aa7('0xe4')]>=_0x1445b7[_0x9aa7('0xee')]){_0x1dfe51[_0x9aa7('0xef')](_0xbf165f,_0x1b8141,_0x5bcc4f,_0x9aa7('0xf0'));}else{_0x1dfe51[_0x9aa7('0xbc')]({'active':![],'countmachineretry':_0xbf165f[_0x9aa7('0xe4')],'scheduledat':moment()['add'](_0x1445b7['dialMachineRetryFrequency'],_0x9aa7('0xf1'))[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0xbf165f[_0x9aa7('0xf3')],'ListId':_0xbf165f[_0x9aa7('0xcd')],'VoiceQueueId':_0xbf165f[_0x9aa7('0xcf')]||undefined,'CampaignId':_0xbf165f[_0x9aa7('0xf4')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x1b8141({'reschedule':0x1});}}});}if(_0x3de1b5['type']===_0x9aa7('0x73')&&this[_0x9aa7('0x1d')][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0xda')]&&_0x104d15['value']===_0x9aa7('0xdc')){delete this[_0x9aa7('0x23')][_0x104d15[_0x9aa7('0xd6')]];this['updateOriginated'](this['campaigns'][_0x3de1b5[_0x9aa7('0xb0')]]);_0x5043b4=new Hangup(_0x3de1b5,_0x104d15);_0x5043b4[_0x9aa7('0xa0')]=0x12;_0x5043b4['statedesc']=_0x9aa7('0xdd');_0x5043b4[_0x9aa7('0xe2')]=_0x9aa7('0xe3');ami[_0x9aa7('0x48')](_0x9aa7('0xde'),ut[_0x9aa7('0xe5')](_0x5043b4,'amd'));this[_0x9aa7('0xcb')](_0x5043b4,_0x9aa7('0xf5'),'[syncHangupInAMDIvr]');}if(_0x3de1b5[_0x9aa7('0x49')]===_0x9aa7('0x73')&&this[_0x9aa7('0x1d')][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0xda')]&&_0x104d15['value']===_0x9aa7('0xe1')){var _0x1dfe51=this;return new BPromise(function(_0x36f764,_0x489898){delete _0x1dfe51['uniqueId'][_0x104d15[_0x9aa7('0xd6')]];_0x1dfe51[_0x9aa7('0xaf')](_0x1dfe51[_0x9aa7('0x1d')][_0x3de1b5[_0x9aa7('0xb0')]]);_0x1dfe51['campaigns'][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0x58')]+=0x1;_0x1dfe51[_0x9aa7('0x1d')][_0x3de1b5[_0x9aa7('0xb0')]][_0x9aa7('0x57')]+=0x1;var _0x5d798a=_0x1dfe51['campaigns'][_0x3de1b5[_0x9aa7('0xb0')]];var _0x1f40d2=new Hangup(_0x3de1b5,_0x104d15);_0x1f40d2['state']=0x13;_0x1f40d2[_0x9aa7('0xa1')]=_0x9aa7('0xf6');_0x1f40d2[_0x9aa7('0xe2')]='AMD';_0x1f40d2[_0x9aa7('0xe4')]+=0x1;_0x1f40d2['countglobal']+=0x1;_0x1f40d2[_0x9aa7('0xdf')]=!![];ami['emit'](_0x9aa7('0xde'),ut[_0x9aa7('0xe5')](_0x1f40d2,_0x9aa7('0xdf')));_0x1dfe51[_0x9aa7('0xc7')](_0x1f40d2)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xe6')));if(_0x1f40d2[_0x9aa7('0xf7')]+_0x1f40d2[_0x9aa7('0xe7')]+_0x1f40d2[_0x9aa7('0xe8')]+_0x1f40d2[_0x9aa7('0xe9')]+_0x1f40d2['countdropretry']+_0x1f40d2[_0x9aa7('0xeb')]+_0x1f40d2['countmachineretry']+_0x1f40d2[_0x9aa7('0xec')]>=_0x5d798a[_0x9aa7('0xf8')]){_0x1dfe51[_0x9aa7('0xed')](_0x1f40d2,_0x36f764,_0x489898,'reason19\x20machine....');}else{if(_0x1f40d2[_0x9aa7('0xe4')]>=_0x5d798a[_0x9aa7('0xee')]){_0x1dfe51['createStateFinal'](_0x1f40d2,_0x36f764,_0x489898,_0x9aa7('0xf0'));}else{_0x1dfe51[_0x9aa7('0xbc')]({'active':![],'countmachineretry':_0x1f40d2[_0x9aa7('0xe4')],'scheduledat':moment()[_0x9aa7('0xf9')](_0x5d798a['dialMachineRetryFrequency'],_0x9aa7('0xf1'))[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0x1f40d2[_0x9aa7('0xf3')],'ListId':_0x1f40d2[_0x9aa7('0xcd')],'VoiceQueueId':_0x1f40d2['VoiceQueueId']||undefined,'CampaignId':_0x1f40d2[_0x9aa7('0xf4')]||undefined})[_0x9aa7('0xb6')](loggerCatch('[rescheduleContact][Machine]'));_0x36f764({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x9aa7('0x32')]=function(_0x4fbe32){var _0x5790ff=this[_0x9aa7('0x23')][_0x4fbe32['uniqueid']];var _0x2b621a=this;var _0x9f1ae9;if(_0x5790ff&&_0x5790ff[_0x9aa7('0x49')]==='ivr'){delete this[_0x9aa7('0x23')][_0x4fbe32['uniqueid']];this[_0x9aa7('0xaf')](this[_0x9aa7('0x1d')][_0x5790ff[_0x9aa7('0xb0')]]);this[_0x9aa7('0x1d')][_0x5790ff[_0x9aa7('0xb0')]]['ivrAnswerCallsDay']+=0x1;_0x9f1ae9=new Hangup(_0x5790ff,_0x4fbe32);this[_0x9aa7('0xc7')](_0x9f1ae9)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xfa')));this['moveContactManagedDialer'](_0x9f1ae9)[_0x9aa7('0xb6')](loggerCatch('[syncHangupIvr]'));}if(_0x5790ff&&_0x5790ff[_0x9aa7('0x49')]!==_0x9aa7('0x73')&&isNotNull(this[_0x9aa7('0x1c')][_0x5790ff[_0x9aa7('0xb0')]][_0x9aa7('0xfb')])){delete this[_0x9aa7('0x23')][_0x4fbe32['uniqueid']];this[_0x9aa7('0xaf')](this['voiceQueues'][_0x5790ff[_0x9aa7('0xb0')]]);this[_0x9aa7('0x1c')][_0x5790ff[_0x9aa7('0xb0')]][_0x9aa7('0x58')]+=0x1;this['voiceQueues'][_0x5790ff[_0x9aa7('0xb0')]][_0x9aa7('0x57')]+=0x1;_0x9f1ae9=new Hangup(_0x5790ff,_0x4fbe32);_0x9f1ae9['state']=0x10;_0x9f1ae9[_0x9aa7('0xa1')]=_0x9aa7('0xfc');_0x9f1ae9[_0x9aa7('0xe2')]=_0x9aa7('0xfd');this[_0x9aa7('0xc7')](_0x9f1ae9)[_0x9aa7('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x9f1ae9)[_0x9aa7('0xb6')](loggerCatch('[syncHangupIvr]'));}if(_0x5790ff&&_0x5790ff['type']!=='ivr'&&!isNotNull(this['voiceQueues'][_0x5790ff['queue']][_0x9aa7('0xfb')])){delete this['uniqueId'][_0x4fbe32[_0x9aa7('0xd6')]];this[_0x9aa7('0xaf')](this[_0x9aa7('0x1c')][_0x5790ff[_0x9aa7('0xb0')]]);this[_0x9aa7('0x1c')][_0x5790ff[_0x9aa7('0xb0')]]['outboundUnknownCallsDay']+=0x1;_0x9f1ae9=new Hangup(_0x5790ff,_0x4fbe32);_0x9f1ae9['state']=0xc;_0x9f1ae9[_0x9aa7('0xa1')]=_0x4fbe32['cause-txt'];_0x9f1ae9['membername']=_0x9aa7('0xfe');this[_0x9aa7('0xc7')](_0x9f1ae9)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xfa')));this[_0x9aa7('0xc5')](_0x9f1ae9)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xff')));}};Dialer['prototype'][_0x9aa7('0x2f')]=function(_0x11f523){var _0x4c1c49=this[_0x9aa7('0x23')][_0x11f523[_0x9aa7('0xd6')]];var _0x109190=this;if(this['voiceQueues'][_0x11f523[_0x9aa7('0xb0')]]){if(_0x4c1c49&&_0x4c1c49[_0x9aa7('0x49')]!==_0x9aa7('0x73')){delete this['uniqueId'][_0x11f523[_0x9aa7('0xd6')]];this[_0x9aa7('0x1c')][_0x11f523['queue']][_0x9aa7('0x58')]+=0x1;var _0xc700c5=new AgentComplete(_0x4c1c49,_0x11f523);if(_0x11f523[_0x9aa7('0x100')]===_0x9aa7('0x101')){_0xc700c5['agiafterat']=this[_0x9aa7('0x1c')][_0x11f523[_0x9aa7('0xb0')]][_0x9aa7('0x102')]&&this[_0x9aa7('0x1c')][_0x11f523[_0x9aa7('0xb0')]]['dialAgiAfterHangupAgent']?moment()[_0x9aa7('0x71')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x9aa7('0xc7')](_0xc700c5)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x103')));this[_0x9aa7('0xc5')](_0xc700c5)['catch'](loggerCatch(_0x9aa7('0x104')));}}};Dialer[_0x9aa7('0x19')]['syncAgentConnect']=function(_0xd2b3b){if(this[_0x9aa7('0x1c')][_0xd2b3b['queue']]){if(this['uniqueId'][_0xd2b3b[_0x9aa7('0xd6')]]&&this[_0x9aa7('0x23')][_0xd2b3b[_0x9aa7('0xd6')]]['type']!==_0x9aa7('0x73')){this['updateOriginated'](this[_0x9aa7('0x1c')][_0xd2b3b[_0x9aa7('0xb0')]]);this['uniqueId'][_0xd2b3b[_0x9aa7('0xd6')]][_0x9aa7('0x105')]=moment()[_0x9aa7('0x71')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x9aa7('0x19')][_0x9aa7('0x106')]=function(_0x1bd38f){this[_0x9aa7('0xc7')](_0x1bd38f)['catch'](loggerCatch(_0x9aa7('0x103')));this[_0x9aa7('0xc5')](_0x1bd38f)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x107')));};Dialer[_0x9aa7('0x19')][_0x9aa7('0x2b')]=function(_0x579cb4){var _0x284e20=this['uniqueId'][_0x579cb4[_0x9aa7('0xd6')]];var _0x40b1c2=this;if(this['voiceQueues'][_0x579cb4['queue']]){if(_0x284e20&&_0x284e20['type']!==_0x9aa7('0x73')){delete this[_0x9aa7('0x23')][_0x579cb4['uniqueid']];this[_0x9aa7('0xaf')](this[_0x9aa7('0x1c')][_0x579cb4['queue']]);_0x284e20[_0x9aa7('0x108')]=moment()[_0x9aa7('0x71')](_0x9aa7('0xf2'));var _0x434474=new QueueCallerAbandon(_0x284e20,_0x579cb4);if(getSeconds(_0x284e20[_0x9aa7('0x108')],_0x284e20[_0x9aa7('0x109')])>=_0x284e20[_0x9aa7('0x10a')]){this[_0x9aa7('0x1c')][_0x579cb4[_0x9aa7('0xb0')]][_0x9aa7('0x65')]+=0x1;this['voiceQueues'][_0x579cb4['queue']][_0x9aa7('0x5d')]+=0x1;this[_0x9aa7('0x1c')][_0x579cb4['queue']][_0x9aa7('0x67')]+=0x1;_0x434474[_0x9aa7('0xa0')]=0xa;_0x434474[_0x9aa7('0xa1')]=_0x9aa7('0x10b');_0x434474[_0x9aa7('0x10c')]=_0x9aa7('0x10d');_0x434474[_0x9aa7('0x10e')]=this[_0x9aa7('0x1c')][_0x579cb4[_0x9aa7('0xb0')]][_0x9aa7('0x102')]?moment()[_0x9aa7('0x71')](_0x9aa7('0xf2')):undefined;_0x434474[_0x9aa7('0xea')]+=0x1;_0x434474[_0x9aa7('0x10f')]+=0x1;if(_0x434474[_0x9aa7('0xea')]>=this[_0x9aa7('0x1c')][_0x579cb4[_0x9aa7('0xb0')]][_0x9aa7('0x110')]){this[_0x9aa7('0x106')](_0x434474);}else{this[_0x9aa7('0xbc')]({'active':![],'countdropretry':_0x434474[_0x9aa7('0xea')],'scheduledat':moment()[_0x9aa7('0xf9')](this[_0x9aa7('0x1c')][_0x579cb4[_0x9aa7('0xb0')]]['dialDropRetryFrequency'],_0x9aa7('0xf1'))['format'](_0x9aa7('0xf2')),'ContactId':_0x284e20[_0x9aa7('0xf3')],'ListId':_0x284e20['ListId'],'VoiceQueueId':_0x284e20[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x284e20[_0x9aa7('0xf4')]||undefined})['catch'](loggerCatch(_0x9aa7('0x111')));var _0x56fe2f=new History(_0x434474);_0x56fe2f['state']=0xa;_0x56fe2f[_0x9aa7('0xa1')]='Drop';_0x56fe2f[_0x9aa7('0xa3')]=moment()[_0x9aa7('0x71')](_0x9aa7('0xf2'));_0x56fe2f['endtime']=_0x56fe2f[_0x9aa7('0xa3')];_0x56fe2f['calleridname']=_0x434474['calleridname'];_0x56fe2f[_0x9aa7('0x112')]=_0x434474[_0x9aa7('0x112')];this[_0x9aa7('0xc7')](_0x56fe2f)[_0x9aa7('0xb6')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x9aa7('0x1c')][_0x579cb4[_0x9aa7('0xb0')]][_0x9aa7('0x64')]+=0x1;this[_0x9aa7('0x1c')][_0x579cb4[_0x9aa7('0xb0')]]['outboundDropCallsDayCallersExit']+=0x1;_0x434474[_0x9aa7('0xa0')]=0xb;_0x434474['statedesc']=_0x9aa7('0x113');_0x434474[_0x9aa7('0x10c')]=_0x9aa7('0x114');_0x434474[_0x9aa7('0xeb')]+=0x1;_0x434474['countglobal']+=0x1;if(_0x434474[_0x9aa7('0xeb')]>=this[_0x9aa7('0x1c')][_0x579cb4['queue']][_0x9aa7('0x115')]){this[_0x9aa7('0x106')](_0x434474);}else{this[_0x9aa7('0xbc')]({'active':![],'countabandonedretry':_0x434474[_0x9aa7('0xeb')],'scheduledat':moment()[_0x9aa7('0xf9')](this[_0x9aa7('0x1c')][_0x579cb4[_0x9aa7('0xb0')]][_0x9aa7('0x116')],_0x9aa7('0xf1'))[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0x284e20[_0x9aa7('0xf3')],'ListId':_0x284e20['ListId'],'VoiceQueueId':_0x284e20[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x284e20[_0x9aa7('0xf4')]||undefined})[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x117')));var _0x56fe2f=new History(_0x434474);_0x56fe2f[_0x9aa7('0xa0')]=0xb;_0x56fe2f[_0x9aa7('0xa1')]=_0x9aa7('0x113');_0x56fe2f['starttime']=moment()['format'](_0x9aa7('0xf2'));_0x56fe2f[_0x9aa7('0xa2')]=_0x56fe2f[_0x9aa7('0xa3')];_0x56fe2f[_0x9aa7('0x118')]=_0x434474[_0x9aa7('0x118')];_0x56fe2f[_0x9aa7('0x112')]=_0x434474[_0x9aa7('0x112')];this[_0x9aa7('0xc7')](_0x56fe2f)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x119')));}}}}};Dialer[_0x9aa7('0x19')][_0x9aa7('0x11a')]=function(_0x201173){if(this[_0x9aa7('0x22')][_0x201173[_0x9aa7('0xd6')]]){this[_0x9aa7('0x22')][_0x201173['uniqueid']][_0x9aa7('0xad')]=_0x201173[_0x9aa7('0xad')];}if(this[_0x9aa7('0x23')][_0x201173[_0x9aa7('0xd6')]]){this[_0x9aa7('0x23')][_0x201173['uniqueid']][_0x9aa7('0xad')]=_0x201173[_0x9aa7('0xad')];}};Dialer[_0x9aa7('0x19')]['syncQueueMember']=function(_0x37b476){if(strategy[this[_0x9aa7('0x1c')][this[_0x9aa7('0x22')][_0x37b476['actionid']]['queue']]['strategy']]===_0x9aa7('0x18')){if(this[_0x9aa7('0x22')][_0x37b476[_0x9aa7('0x11b')]]&&_[_0x9aa7('0xaa')](this[_0x9aa7('0x22')][_0x37b476['actionid']][_0x9aa7('0x11c')])&&_0x37b476[_0x9aa7('0xac')]==='1'&&_0x37b476[_0x9aa7('0x11d')]==='0'){if(this[_0x9aa7('0x1e')][_0x37b476[_0x9aa7('0x11e')]]){if(!this[_0x9aa7('0x1e')][_0x37b476['stateinterface']][_0x9aa7('0x11c')]){this[_0x9aa7('0x1e')][_0x37b476[_0x9aa7('0x11e')]][_0x9aa7('0x11c')]=!![];this['actions'][_0x37b476['actionid']][_0x9aa7('0x11c')]=!![];this['actions'][_0x37b476[_0x9aa7('0x11b')]][_0x9aa7('0x11e')]=_0x37b476['stateinterface'];}}}}else if((strategy[this[_0x9aa7('0x1c')][this[_0x9aa7('0x22')][_0x37b476[_0x9aa7('0x11b')]]['queue']][_0x9aa7('0x4b')]]||_0x9aa7('0x11f'))===_0x9aa7('0x11f')){if(this[_0x9aa7('0x22')][_0x37b476[_0x9aa7('0x11b')]]){if(this['agents'][_0x37b476[_0x9aa7('0x11e')]]){this['actions'][_0x37b476[_0x9aa7('0x11b')]][_0x9aa7('0x11e')]=_0x37b476[_0x9aa7('0x11e')];if(_[_0x9aa7('0xaa')](this[_0x9aa7('0x26')][this[_0x9aa7('0x22')][_0x37b476['actionid']][_0x9aa7('0xb0')]])){this['queueBooked'][this[_0x9aa7('0x22')][_0x37b476[_0x9aa7('0x11b')]][_0x9aa7('0xb0')]]=[];}this[_0x9aa7('0x26')][this['actions'][_0x37b476['actionid']][_0x9aa7('0xb0')]][_0x9aa7('0x120')](_['merge'](_[_0x9aa7('0x121')](this['actions'][_0x37b476[_0x9aa7('0x11b')]],[_0x9aa7('0x122'),_0x9aa7('0x11e')]),{'status':_0x37b476['status'],'paused':_0x37b476['paused']}));}}}};function unlockQueueStatus(_0x26ec88,_0x4f74e2){setTimeout(function(){if(_[_0x9aa7('0x38')](_0x26ec88[_0x9aa7('0x123')])){loggerBooked[_0x9aa7('0x91')](_0x9aa7('0x124'),_0x4f74e2);}_0x26ec88[_0x9aa7('0x123')]=!![];loggerBooked[_0x9aa7('0x79')](_0x9aa7('0x125'),_0x4f74e2,JSON['stringify'](_[_0x9aa7('0x121')](_0x26ec88,[_0x9aa7('0x3b'),_0x9aa7('0x123')])));},0x1f3);}Dialer[_0x9aa7('0x19')][_0x9aa7('0x126')]=function(_0x201272){var _0x1ab757=this;var _0x459dd6=_0x1ab757['voiceQueues'][_0x1ab757[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]]['queue']];if(strategy[this[_0x9aa7('0x1c')][this[_0x9aa7('0x22')][_0x201272['actionid']][_0x9aa7('0xb0')]]['strategy']]===_0x9aa7('0x18')){if(this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]]&&this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0x11e')]){this['preview'][_0x9aa7('0x127')](this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0x122')],this['actions'][_0x201272['actionid']][_0x9aa7('0x11e')])[_0x9aa7('0xb6')](function(_0x4a45f4){logger[_0x9aa7('0x91')](_0x9aa7('0x128'),util[_0x9aa7('0x90')](_0x4a45f4,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1ab757[_0x9aa7('0xaf')](_0x1ab757[_0x9aa7('0x1c')][_0x1ab757[_0x9aa7('0x22')][_0x201272['actionid']][_0x9aa7('0xb0')]]);_0x1ab757[_0x9aa7('0x1e')][_0x1ab757[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0x11e')]][_0x9aa7('0x11c')]=![];delete _0x1ab757[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]];unlockQueueStatus(_0x459dd6);});}else{this[_0x9aa7('0xaf')](this[_0x9aa7('0x1c')][this['actions'][_0x201272['actionid']][_0x9aa7('0xb0')]]);this[_0x9aa7('0xbc')]({'active':![],'ContactId':this['actions'][_0x201272['actionid']][_0x9aa7('0xf3')],'ListId':this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0xcd')],'VoiceQueueId':this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0xcf')]||undefined,'CampaignId':this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]]['CampaignId']||undefined})[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x129')));delete this['actions'][_0x201272[_0x9aa7('0x11b')]];unlockQueueStatus(_0x459dd6);}}else if((strategy[this['voiceQueues'][this['actions'][_0x201272['actionid']][_0x9aa7('0xb0')]]['strategy']]||_0x9aa7('0x11f'))===_0x9aa7('0x11f')){var _0x22df40;if(this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]]&&!_['isEmpty'](this[_0x9aa7('0x26')][this['actions'][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0xb0')]])){if(this[_0x9aa7('0x27')][_0x1ab757['actions'][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0xb0')]]){this[_0x9aa7('0x27')][_0x1ab757[_0x9aa7('0x22')][_0x201272['actionid']][_0x9aa7('0xb0')]]=this['queueBookedRR'][this[_0x9aa7('0x22')][_0x201272['actionid']][_0x9aa7('0xb0')]]?this[_0x9aa7('0x27')][this[_0x9aa7('0x22')][_0x201272['actionid']][_0x9aa7('0xb0')]]:this[_0x9aa7('0x26')][this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0xb0')]]?this[_0x9aa7('0x26')][this[_0x9aa7('0x22')][_0x201272[_0x9aa7('0x11b')]][_0x9aa7('0xb0')]]['_rr']||0x0:0x0;}this[_0x9aa7('0x26')][this['actions'][_0x201272['actionid']][_0x9aa7('0xb0')]][_0x9aa7('0x12a')]=this[_0x9aa7('0x27')][this[_0x9aa7('0x22')][_0x201272['actionid']][_0x9aa7('0xb0')]];for(var _0x296512=0x0;_0x296512=0x0;})[_0x9aa7('0xb6')](myreject(_0x18aaef)));}}else{_0x4cb37d[_0x9aa7('0x120')](ami[_0x9aa7('0xab')]({'action':_0x9aa7('0x144'),'command':util[_0x9aa7('0x71')]('iftime\x20%s,%s',_0xc12ec9,!_['isUndefined'](config[_0x9aa7('0x13e')][_0x54b065])?_0x54b065:'')})['then'](function(_0x1bacb2){return _0x1bacb2[_0x9aa7('0x145')]['indexOf'](_0x9aa7('0x146'))>=0x0;})[_0x9aa7('0xb6')](myreject(_0x18aaef)));}BPromise[_0x9aa7('0x147')](_0x4cb37d)[_0x9aa7('0x37')](function(_0x3fc142){var _0x4d6d82=_['some'](_0x3fc142);if(_0x4d6d82){return _0x4bb83e(_0x4d6d82);}else{_0x4188cf[_0x9aa7('0x39')]=_0x14772e?_0x9aa7('0x148'):_0x9aa7('0x149');return _0x18aaef(msgResponse(_0x9aa7('0x14a'),_0x9aa7('0x13b'),_0x9aa7('0x14b')+_0x14772e+'\x20'+_0x49919e+_0x9aa7('0x14c')+util[_0x9aa7('0x90')](_0xc12ec9,{'showHidden':![],'depth':null})+_0x9aa7('0x14d')+_0x54b065));}})[_0x9aa7('0xb6')](function(_0x32d9df){return _0x18aaef(msgResponse(_0x9aa7('0x139'),'Failure',JSON[_0x9aa7('0x45')](_0x32d9df)));});});};Dialer[_0x9aa7('0x19')][_0x9aa7('0x14e')]=function(_0x5acd0c){var _0x52286c=this;return function(){switch(_0x5acd0c[_0x9aa7('0x14f')]){case'progressive':freeVariablesPredictive(_0x5acd0c);_0x52286c[_0x9aa7('0x150')](_0x5acd0c,0x1);break;case _0x9aa7('0x151'):freeVariablesPredictive(_0x5acd0c);_0x52286c[_0x9aa7('0x150')](_0x5acd0c,_0x5acd0c[_0x9aa7('0x152')]);break;case _0x9aa7('0x9'):_0x52286c[_0x9aa7('0x9')](_0x5acd0c);break;case _0x9aa7('0x8'):freeVariablesPredictive(_0x5acd0c);_0x52286c[_0x9aa7('0x150')](_0x5acd0c,0x1);break;default:freeVariablesPredictive(_0x5acd0c);logger[_0x9aa7('0x91')](_0x9aa7('0x153'),_0x5acd0c[_0x9aa7('0x3b')],'method\x20not\x20recognized');}};};Dialer[_0x9aa7('0x19')][_0x9aa7('0x154')]=function(_0x3f84ef){return BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](cmHopper[_0x9aa7('0x155')](_0x3f84ef['id'],previewRecallmeReminderInterval))['then'](function(_0x48787a){for(var _0x51b7d3=0x0;_0x51b7d3<_0x48787a[_0x9aa7('0x93')];_0x51b7d3++){var _0x158867=_0x48787a[_0x51b7d3][_0x9aa7('0x156')][_0x9aa7('0x3b')];if(_0x158867)io['to'](util['format'](_0x9aa7('0x157'),_0x158867))['emit'](_0x9aa7('0x158'),{'hopper':_0x48787a[_0x51b7d3]});}})['catch'](function(_0x4f02be){});};Dialer[_0x9aa7('0x19')]['launchHandleIvr']=function(_0x3c30ee){var _0x1bf2a6=this;return function(){_0x1bf2a6[_0x9aa7('0x159')](_0x3c30ee);};};Dialer[_0x9aa7('0x19')][_0x9aa7('0x30')]=function(_0x29b690){var _0xf78322=this;if(isNotPreview(_0x29b690[_0x9aa7('0x14f')])){if(isVoiceQueueOutbound(_0x29b690['type'])&&isActive(_0x29b690[_0x9aa7('0x53')])){_0x29b690['sendMessageOneNotActive']=!![];BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](checkIsLoggedIn(_0x29b690,_0x29b690[_0x9aa7('0x15a')]))[_0x9aa7('0x37')](checkIsActive(_0x29b690,_0x29b690[_0x9aa7('0x53')]))['then'](checkInterval(_0x29b690))[_0x9aa7('0x37')](_0xf78322[_0x9aa7('0x15b')](_0x29b690))[_0x9aa7('0x37')](_0xf78322[_0x9aa7('0x138')](_0x29b690['dialGlobalInterval'],_0x29b690[_0x9aa7('0x15c')],_0x29b690[_0x9aa7('0x3b')],_0x29b690))[_0x9aa7('0x37')](_0xf78322[_0x9aa7('0x13a')](_0x29b690[_0x9aa7('0x3e')],_0x29b690[_0x9aa7('0x15c')],_0x29b690[_0x9aa7('0x3b')],_0x29b690))[_0x9aa7('0x37')](_0xf78322[_0x9aa7('0x14e')](_0x29b690))[_0x9aa7('0xb6')](loggerCatchQueueSummary('[syncQueueSummary]',_0x29b690));}else{notSendMessagesQueue(_0x29b690);}}else{freeVariablesPredictive(_0x29b690);if(_0x29b690[_0x9aa7('0x15d')]){_0xf78322[_0x9aa7('0x154')](_0x29b690);}}};Dialer['prototype'][_0x9aa7('0x15e')]=function(){var _0x96e19c=this;var _0x1f4fa0;for(var _0x4b51d3 in this['campaigns']){if(typeof this['campaigns'][_0x4b51d3]!==_0x9aa7('0xa7')){_0x1f4fa0=this['campaigns'][_0x4b51d3];if(isCampaignIvr(_0x1f4fa0['type'])&&isActive(_0x1f4fa0[_0x9aa7('0x6e')])){_0x1f4fa0['sendMessageOneNotActive']=!![];BPromise[_0x9aa7('0xb3')]()[_0x9aa7('0x37')](checkIsActive(_0x1f4fa0,_0x1f4fa0[_0x9aa7('0x6e')]))['then'](checkInterval(_0x1f4fa0))[_0x9aa7('0x37')](_0x96e19c[_0x9aa7('0x15b')](_0x1f4fa0))[_0x9aa7('0x37')](_0x96e19c[_0x9aa7('0x138')](_0x1f4fa0[_0x9aa7('0x15f')],_0x1f4fa0[_0x9aa7('0x15c')],_0x1f4fa0[_0x9aa7('0x3b')],_0x1f4fa0))[_0x9aa7('0x37')](_0x96e19c['checkIfTimeIntervals'](_0x1f4fa0[_0x9aa7('0x3e')],_0x1f4fa0[_0x9aa7('0x15c')],_0x1f4fa0[_0x9aa7('0x3b')],_0x1f4fa0))[_0x9aa7('0x37')](_0x96e19c[_0x9aa7('0x160')](_0x1f4fa0))[_0x9aa7('0xb6')](loggerCatchQueueSummary(_0x9aa7('0x161'),_0x1f4fa0));}else{notSendMessagesCampaign(_0x1f4fa0);}}}};function getCallerIdRandom(_0x58fd21,_0x35b1b8){var _0x3047b8;var _0x4a1005;var _0x32726a;if(_0x35b1b8<=0x0){_0x35b1b8=0x1;}_0x3047b8=new RegExp(_0x9aa7('0x162')+_0x35b1b8+'}$');_0x4a1005=Math[_0x9aa7('0x163')](0xa,_0x35b1b8-0x1);_0x32726a=Math[_0x9aa7('0x163')](0xa,_0x35b1b8)-0x1;return util['format']('%s',_[_0x9aa7('0x164')](_0x58fd21,_0x3047b8,_[_0x9aa7('0x165')](_0x4a1005,_0x32726a)));}function extractCalleridName(_0x151b65){var _0x5ee714=_0x151b65[_0x9aa7('0x166')](/"(.*?)"/);return _0x5ee714?_0x5ee714[0x1]:_0x151b65;}function extractCalleridNumber(_0x5e1db6){var _0x1758f8=_0x5e1db6[_0x9aa7('0x166')](/<(.*?)>/);return _0x1758f8?_0x1758f8[0x1]:_0x5e1db6;}Dialer[_0x9aa7('0x19')][_0x9aa7('0x167')]=function(_0x34cf18,_0x3c8712){var _0x44f0ac=this;var _0x4333f7=uuid['v4']();this[_0x9aa7('0x22')][_0x4333f7]=new Action(_0x34cf18,_0x3c8712,_0x4333f7);return new BPromise(function(_0x1483d2,_0x5a96c2){if(_[_0x9aa7('0x38')](_0x34cf18)&&typeof _0x34cf18!==_0x9aa7('0x168')){return _0x5a96c2(msgResponse(_0x9aa7('0x169'),'Failure',_0x9aa7('0x16a')));}if(_[_0x9aa7('0x38')](_0x3c8712['Contact'][_0x9aa7('0x16b')])||_0x3c8712['Contact'][_0x9aa7('0x16b')]===null){return _0x5a96c2(msgResponse(_0x9aa7('0x169'),_0x9aa7('0x13b'),_0x9aa7('0x16c')));}var _0x493f8b={'XMD-CALLERID':_0x44f0ac['actions'][_0x4333f7]['getCaller'](),'XMD-AGI':_0x34cf18[_0x9aa7('0xfb')]?util[_0x9aa7('0x71')](_0x9aa7('0x16d'),ipAgi,_0x34cf18[_0x9aa7('0xfb')]):_0x9aa7('0x16e'),'XMD-AGIAFTER':_0x34cf18[_0x9aa7('0x102')]?util[_0x9aa7('0x71')](_0x9aa7('0x16d'),ipAgi,_0x34cf18['dialQueueProject2']):_0x9aa7('0x16e'),'XMD-QUEUE':_0x34cf18[_0x9aa7('0x49')]===_0x9aa7('0x4a')?util[_0x9aa7('0x71')](_0x9aa7('0x16f'),_0x34cf18[_0x9aa7('0x3b')],_0x34cf18[_0x9aa7('0x170')]||'',_0x34cf18[_0x9aa7('0x171')]?'c':'',_0x34cf18[_0x9aa7('0x10a')]||0x3):_0x9aa7('0x16e'),'XMD-CONTACTID':_0x3c8712[_0x9aa7('0xf3')],'XMD-CDRTYPE':_0x9aa7('0x172'),'CALLERID(all)':_0x44f0ac[_0x9aa7('0x22')][_0x4333f7]['getCaller'](),'XMD-AMD':_0x34cf18[_0x9aa7('0xda')]?_0x9aa7('0x173'):_0x9aa7('0x16e'),'XMD-DESTINATION':_0x9aa7('0xd9')};if(_0x34cf18[_0x9aa7('0xda')]){_0x493f8b['XMD-AMDINITIALSILENCE']=_0x34cf18[_0x9aa7('0x174')]||0x9c4;_0x493f8b['XMD-AMDGREETING']=_0x34cf18[_0x9aa7('0x175')]||0x5dc;_0x493f8b['XMD-AMDAFTERGREETINGSILENCE']=_0x34cf18['dialAMDAfterGreetingSilence']||0x320;_0x493f8b[_0x9aa7('0x176')]=_0x34cf18[_0x9aa7('0x177')]||0x1388;_0x493f8b['XMD-AMDMINWORDLENGTH']=_0x34cf18[_0x9aa7('0x178')]||0x64;_0x493f8b[_0x9aa7('0x179')]=_0x34cf18[_0x9aa7('0x17a')]||0x32;_0x493f8b['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x34cf18[_0x9aa7('0x17b')]||0x3;_0x493f8b[_0x9aa7('0x17c')]=_0x34cf18[_0x9aa7('0x17d')]||0x100;_0x493f8b[_0x9aa7('0x17e')]=_0x34cf18['dialAMDMaximumWordLength']||0x1388;}if(_0x34cf18[_0x9aa7('0x49')]===_0x9aa7('0x4a')){_0x493f8b[_0x9aa7('0x17f')]=_0x3c8712[_0x9aa7('0xcf')];}else{_0x493f8b[_0x9aa7('0x180')]=_0x3c8712['CampaignId'];}for(var _0x4e1a03 in _0x3c8712[_0x9aa7('0x181')]){if(typeof _0x3c8712[_0x9aa7('0x181')][_0x4e1a03]!==_0x9aa7('0xa7')){if(isNotNull(_0x3c8712[_0x9aa7('0x181')][_0x4e1a03])&&_0x4e1a03!=='id'&&_0x4e1a03!==_0x9aa7('0x182')&&_0x4e1a03!=='createdAt'&&_0x4e1a03!==_0x9aa7('0x183')){_0x493f8b[util['format'](_0x9aa7('0x184'),'XMD-',_['toUpper'](_0x4e1a03))]=_0x3c8712[_0x9aa7('0x181')][_0x4e1a03];}}}var _0x46ec1d=_0x44f0ac[_0x9aa7('0x136')](_0x34cf18[_0x9aa7('0x6d')])?getCallerId(_0x34cf18[_0x9aa7('0x6d')][_0x9aa7('0x6f')],_0x34cf18['dialOriginateCallerIdName'],_0x34cf18[_0x9aa7('0x185')]>0x0?getCallerIdRandom(_0x34cf18['dialOriginateCallerIdNumber'],_0x34cf18['dialRandomLastDigitCallerIdNumber']):_0x34cf18[_0x9aa7('0x54')]):getCallerId(_[_0x9aa7('0xaa')](_0x34cf18[_0x9aa7('0x186')])?_0x34cf18[_0x9aa7('0x6d')][_0x9aa7('0x6f')]:_0x34cf18[_0x9aa7('0x186')][_0x9aa7('0x6f')],_0x34cf18['dialOriginateCallerIdName'],_0x34cf18['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x34cf18['dialOriginateCallerIdNumber'],_0x34cf18[_0x9aa7('0x185')]):_0x34cf18['dialOriginateCallerIdNumber']);if(_0x46ec1d){_0x493f8b[_0x9aa7('0x187')]=_0x44f0ac['actions'][_0x4333f7][_0x9aa7('0x188')]=extractCalleridName(_0x46ec1d);_0x493f8b[_0x9aa7('0x189')]=_0x44f0ac[_0x9aa7('0x22')][_0x4333f7][_0x9aa7('0x18a')]=extractCalleridNumber(_0x46ec1d);}return ami['Action']({'actionid':_0x4333f7,'action':_0x9aa7('0x169'),'channel':_0x44f0ac['isTrunkReachable'](_0x34cf18[_0x9aa7('0x6d')])?util[_0x9aa7('0x71')]('SIP/%s/%s%s',_0x34cf18['Trunk']['name'],isNotNull(_0x34cf18['dialPrefix'])?_0x34cf18['dialPrefix'][_0x9aa7('0x18b')]()||'':'',_0x34cf18[_0x9aa7('0x18c')]>0x0?_0x3c8712[_0x9aa7('0x181')][_0x9aa7('0x16b')][_0x9aa7('0x18d')](_0x34cf18['dialCutDigit']):_0x3c8712[_0x9aa7('0x181')]['phone']):util[_0x9aa7('0x71')](_0x9aa7('0x18e'),_['isNil'](_0x34cf18[_0x9aa7('0x186')])?_0x34cf18['Trunk']['name']:_0x34cf18[_0x9aa7('0x186')][_0x9aa7('0x3b')],isNotNull(_0x34cf18[_0x9aa7('0x56')])?_0x34cf18['dialPrefix'][_0x9aa7('0x18b')]()||'':'',_0x34cf18[_0x9aa7('0x18c')]>0x0?_0x3c8712[_0x9aa7('0x181')]['phone'][_0x9aa7('0x18d')](_0x34cf18['dialCutDigit']):_0x3c8712['Contact'][_0x9aa7('0x16b')]),'callerid':_0x46ec1d,'Exten':_0x9aa7('0xd9'),'Context':_0x9aa7('0x18f'),'Priority':'1','variable':_0x493f8b,'timeout':(_0x34cf18['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4333f7})[_0x9aa7('0x37')](function(_0x31c9b6){return _0x1483d2(_0x31c9b6);})[_0x9aa7('0xb6')](function(_0x3eb04b){_0x34cf18[_0x9aa7('0x190')]+=0x1;var _0x52012d=new History(_0x44f0ac[_0x9aa7('0x22')][_0x4333f7]);logger[_0x9aa7('0x91')](util[_0x9aa7('0x71')](_0x9aa7('0x191'),JSON[_0x9aa7('0x45')](_0x3eb04b)));_0x52012d['state']=0xe;_0x52012d[_0x9aa7('0xa1')]=_0x9aa7('0x192');_0x52012d[_0x9aa7('0xa3')]=moment()[_0x9aa7('0x71')](_0x9aa7('0xf2'));_0x52012d[_0x9aa7('0xa2')]=_0x52012d[_0x9aa7('0xa3')];_0x44f0ac['createHistory'](_0x52012d)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x193')));_0x44f0ac['moveContactManagedDialer'](_0x52012d)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x193')))[_0x9aa7('0x12e')](function(){delete _0x44f0ac[_0x9aa7('0x22')][_0x4333f7];return _0x5a96c2(msgResponse(_0x9aa7('0x169'),_0x9aa7('0x44'),'originate\x20action\x20Error'));});});});};Dialer[_0x9aa7('0x19')][_0x9aa7('0x2d')]=function(_0x56ff03){var _0x4977a1=this['actions'][_0x56ff03[_0x9aa7('0x11b')]];if(_0x4977a1){delete this[_0x9aa7('0x22')][_0x56ff03[_0x9aa7('0x11b')]];_0x4977a1['responsetime']=moment()[_0x9aa7('0x71')](_0x9aa7('0xf2'));var _0x160397=_0x4977a1[_0x9aa7('0x49')]==='ivr'?this[_0x9aa7('0x1d')][_0x4977a1[_0x9aa7('0xb0')]]:this[_0x9aa7('0x1c')][_0x4977a1[_0x9aa7('0x194')]()];if(!this[_0x9aa7('0xd1')](_0x56ff03['response'])){this[_0x9aa7('0xaf')](_0x160397);return this['callProgressDetecting'](_0x4977a1,_0x160397,_0x56ff03)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x195')));}this[_0x9aa7('0x23')][_0x56ff03[_0x9aa7('0xd6')]]=_0x4977a1;}};Dialer[_0x9aa7('0x19')][_0x9aa7('0x196')]=function(_0x44b0c4,_0x159ac2,_0x239017){var _0x13882d=new History(_0x159ac2);if(_0x13882d[_0x9aa7('0xf7')]+_0x13882d[_0x9aa7('0xe7')]+_0x13882d[_0x9aa7('0xe8')]+_0x13882d[_0x9aa7('0xe9')]+_0x13882d[_0x9aa7('0xea')]+_0x13882d[_0x9aa7('0xeb')]+_0x13882d[_0x9aa7('0xe4')]+_0x13882d['countagentrejectretry']>=_0x239017['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x44b0c4){case 0x3:if(_0x13882d[_0x9aa7('0xe8')]>=_0x239017[_0x9aa7('0x197')]-0x1){return!![];}this[_0x9aa7('0xbc')]({'active':![],'countnoanswerretry':_0x13882d[_0x9aa7('0xe8')]+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017[_0x9aa7('0x198')],_0x9aa7('0xf1'))[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0x13882d[_0x9aa7('0xf3')],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d['VoiceQueueId']||undefined,'CampaignId':_0x13882d[_0x9aa7('0xf4')]||undefined})[_0x9aa7('0xb6')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x13882d[_0x9aa7('0xf7')]>=_0x239017[_0x9aa7('0x199')]-0x1){return!![];}this[_0x9aa7('0xbc')]({'active':![],'countbusyretry':_0x13882d['countbusyretry']+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017[_0x9aa7('0x19a')],_0x9aa7('0xf1'))[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0x13882d[_0x9aa7('0xf3')],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x13882d['CampaignId']||undefined})[_0x9aa7('0xb6')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x13882d[_0x9aa7('0xe7')]>=_0x239017[_0x9aa7('0x19b')]-0x1){return!![];}this[_0x9aa7('0xbc')]({'active':![],'countcongestionretry':_0x13882d['countcongestionretry']+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017['dialCongestionRetryFrequency'],_0x9aa7('0xf1'))['format'](_0x9aa7('0xf2')),'ContactId':_0x13882d[_0x9aa7('0xf3')],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x13882d[_0x9aa7('0xf4')]||undefined})['catch'](loggerCatch(_0x9aa7('0x19c')));break;case 0x0:if(_0x13882d[_0x9aa7('0xe9')]>=_0x239017[_0x9aa7('0x19d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x13882d[_0x9aa7('0xe9')]+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017[_0x9aa7('0x19e')],_0x9aa7('0xf1'))[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0x13882d[_0x9aa7('0xf3')],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x13882d['CampaignId']||undefined})[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x19f')));}break;case 0xa:if(_0x13882d[_0x9aa7('0xea')]>=_0x239017[_0x9aa7('0x110')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x13882d['countdropretry']+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017[_0x9aa7('0x1a0')],_0x9aa7('0xf1'))[_0x9aa7('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13882d['ContactId'],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x13882d[_0x9aa7('0xf4')]||undefined})[_0x9aa7('0xb6')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x13882d[_0x9aa7('0xeb')]>=_0x239017[_0x9aa7('0x115')]-0x1){return!![];}this[_0x9aa7('0xbc')]({'active':![],'countabandonedretry':_0x13882d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017[_0x9aa7('0x116')],'minutes')[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0x13882d[_0x9aa7('0xf3')],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x13882d['CampaignId']||undefined})[_0x9aa7('0xb6')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x13882d[_0x9aa7('0xe4')]>=_0x239017['dialMachineMaxRetry']-0x1){return!![];}this[_0x9aa7('0xbc')]({'active':![],'countmachineretry':_0x13882d[_0x9aa7('0xe4')]+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017['dialMachineRetryFrequency'],_0x9aa7('0xf1'))['format'](_0x9aa7('0xf2')),'ContactId':_0x13882d[_0x9aa7('0xf3')],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d['VoiceQueueId']||undefined,'CampaignId':_0x13882d[_0x9aa7('0xf4')]||undefined})[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x1a1')));break;case 0x14:if(_0x13882d[_0x9aa7('0xec')]>=_0x239017['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x9aa7('0xbc')]({'active':![],'countagentrejectretry':_0x13882d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x9aa7('0xf9')](_0x239017[_0x9aa7('0x1a2')],_0x9aa7('0xf1'))[_0x9aa7('0x71')](_0x9aa7('0xf2')),'ContactId':_0x13882d['ContactId'],'ListId':_0x13882d[_0x9aa7('0xcd')],'VoiceQueueId':_0x13882d[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x13882d[_0x9aa7('0xf4')]||undefined})[_0x9aa7('0xb6')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x9aa7('0x1a3')]=function(_0x495154,_0x16e1b4,_0x336459){var _0x50a300=this;var _0x593e6f=new History(_0x495154);return new BPromise(function(_0x4bb020,_0x42c1b4){if(_[_0x9aa7('0x38')](_0x16e1b4)&&typeof _0x16e1b4!==_0x9aa7('0x168')){return _0x42c1b4(msgResponse('[callProgressDetecting]',_0x9aa7('0x13b'),_0x9aa7('0x1a4')));}if(_[_0x9aa7('0x38')](_0x336459)&&typeof _0x336459!=='object'){return _0x42c1b4(msgResponse(_0x9aa7('0x1a5'),_0x9aa7('0x13b'),_0x9aa7('0x1a6')));}switch(_0x336459[_0x9aa7('0x100')]){case'0':_0x16e1b4['outboundNoSuchCallsDay']+=0x1;_0x593e6f[_0x9aa7('0xa0')]=0x0;_0x593e6f['statedesc']=_0x9aa7('0x1a7');_0x593e6f[_0x9aa7('0xe9')]+=0x1;_0x593e6f['countglobal']+=0x1;ami[_0x9aa7('0x48')](_0x9aa7('0x1a8'),ut['buildObj'](_0x495154,_0x9aa7('0x1a9')));_0x50a300['createHistory'](_0x593e6f)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0xe6')));if(_0x50a300['checkRetriveMax'](0x0,_0x495154,_0x16e1b4)){if(_0x593e6f[_0x9aa7('0xe9')]>=_0x16e1b4[_0x9aa7('0x19d')]){_0x50a300[_0x9aa7('0xef')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1aa'));}else{_0x50a300['stateGlobal'](_0x593e6f,_0x4bb020,_0x42c1b4,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x16e1b4[_0x9aa7('0x1ab')]+=0x1;_0x593e6f[_0x9aa7('0xa0')]=0x3;_0x593e6f[_0x9aa7('0xa1')]=_0x9aa7('0x1ac');_0x593e6f[_0x9aa7('0xe8')]+=0x1;_0x593e6f['countglobal']+=0x1;ami[_0x9aa7('0x48')](_0x9aa7('0x1ad'),ut[_0x9aa7('0xe5')](_0x495154,_0x9aa7('0x1ae')));_0x50a300[_0x9aa7('0xc7')](_0x593e6f)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x50a300[_0x9aa7('0x196')](0x3,_0x495154,_0x16e1b4)){if(_0x593e6f[_0x9aa7('0xe8')]>=_0x16e1b4['dialNoAnswerMaxRetry']){_0x50a300['createStateFinal'](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1af'));}else{_0x50a300[_0x9aa7('0xed')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1af'));}}break;case'5':_0x16e1b4[_0x9aa7('0x5a')]+=0x1;_0x593e6f['state']=0x5;_0x593e6f['statedesc']=_0x9aa7('0x1b0');_0x593e6f[_0x9aa7('0xf7')]+=0x1;_0x593e6f[_0x9aa7('0x10f')]+=0x1;ami[_0x9aa7('0x48')](_0x9aa7('0x1b1'),ut[_0x9aa7('0xe5')](_0x495154,_0x9aa7('0x1b2')));_0x50a300[_0x9aa7('0xc7')](_0x593e6f)[_0x9aa7('0xb6')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x50a300[_0x9aa7('0x196')](0x5,_0x495154,_0x16e1b4)){if(_0x593e6f['countbusyretry']>=_0x16e1b4[_0x9aa7('0x199')]){_0x50a300['createStateFinal'](_0x593e6f,_0x4bb020,_0x42c1b4,'reason\x205\x20busy');}else{_0x50a300[_0x9aa7('0xed')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1b3'));}}break;case'8':_0x16e1b4[_0x9aa7('0x5b')]+=0x1;_0x593e6f['state']=0x8;_0x593e6f[_0x9aa7('0xa1')]=_0x9aa7('0x1b4');_0x593e6f[_0x9aa7('0xe7')]+=0x1;_0x593e6f[_0x9aa7('0x10f')]+=0x1;ami[_0x9aa7('0x48')]('custom:agentcongestion',ut[_0x9aa7('0xe5')](_0x495154,'congestion'));_0x50a300[_0x9aa7('0xc7')](_0x593e6f)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x1b5')));if(_0x50a300[_0x9aa7('0x196')](0x8,_0x495154,_0x16e1b4)){if(_0x593e6f[_0x9aa7('0xe7')]>=_0x16e1b4[_0x9aa7('0x19b')]){_0x50a300['createStateFinal'](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1b6'));}else{_0x50a300[_0x9aa7('0xed')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1b6'));}}break;case'11':_0x16e1b4['outboundAbandonedCallsDay']+=0x1;_0x593e6f[_0x9aa7('0xa0')]=0xb;_0x593e6f['statedesc']=_0x9aa7('0x113');_0x593e6f['countabandonedretry']+=0x1;_0x593e6f[_0x9aa7('0x10f')]+=0x1;_0x50a300[_0x9aa7('0xc7')](_0x593e6f)['catch'](loggerCatch(_0x9aa7('0x119')));if(_0x50a300[_0x9aa7('0x196')](0xb,_0x495154,_0x16e1b4)){if(_0x593e6f[_0x9aa7('0xeb')]>=_0x16e1b4[_0x9aa7('0x115')]){_0x50a300[_0x9aa7('0xef')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1b7'));}else{_0x50a300[_0x9aa7('0xed')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1b7'));}}break;case'20':_0x16e1b4[_0x9aa7('0x60')]+=0x1;_0x593e6f[_0x9aa7('0xa0')]=0x14;_0x593e6f[_0x9aa7('0xa1')]=_0x9aa7('0x1b8');_0x593e6f[_0x9aa7('0xec')]+=0x1;_0x593e6f[_0x9aa7('0x10f')]+=0x1;ami[_0x9aa7('0x48')]('custom:agentreject',ut[_0x9aa7('0xe5')](_0x495154,_0x9aa7('0x1b9')));_0x50a300[_0x9aa7('0xc7')](_0x593e6f)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x1ba')));if(_0x50a300['checkRetriveMax'](0x14,_0x495154,_0x16e1b4)){if(_0x593e6f[_0x9aa7('0xec')]>=_0x16e1b4['dialAgentRejectMaxRetry']){_0x50a300[_0x9aa7('0xef')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x9aa7('0x1bb'));}else{_0x50a300[_0x9aa7('0xed')](_0x593e6f,_0x4bb020,_0x42c1b4,'reason\x2020\x20agentreject');}}break;default:_0x16e1b4[_0x9aa7('0x61')]+=0x1;_0x593e6f[_0x9aa7('0xa0')]=0xc;_0x593e6f[_0x9aa7('0xa1')]=_0x336459[_0x9aa7('0x100')];_0x50a300[_0x9aa7('0xc7')](_0x593e6f)[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x1bc')));if(_0x50a300[_0x9aa7('0x196')](_0x336459[_0x9aa7('0x100')],_0x495154,_0x16e1b4)){if(_0x593e6f[_0x9aa7('0xf7')]+_0x593e6f[_0x9aa7('0xe7')]+_0x593e6f[_0x9aa7('0xe8')]+_0x593e6f[_0x9aa7('0xe9')]+_0x593e6f[_0x9aa7('0xea')]+_0x593e6f[_0x9aa7('0xeb')]+_0x593e6f[_0x9aa7('0xe4')]+_0x593e6f[_0x9aa7('0xec')]>=_0x16e1b4[_0x9aa7('0xf8')]){_0x50a300[_0x9aa7('0xed')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x336459['reason']);}else{_0x50a300[_0x9aa7('0xef')](_0x593e6f,_0x4bb020,_0x42c1b4,_0x336459['reason']);}}}});};Dialer[_0x9aa7('0x19')][_0x9aa7('0xed')]=function(_0x420495,_0x32b0d9,_0x289fa9,_0x48ac95){var _0x3d07a9=new Final(_0x420495);_0x3d07a9[_0x9aa7('0xa0')]=0xf;_0x3d07a9[_0x9aa7('0xa1')]=_0x9aa7('0x1bd');this[_0x9aa7('0xef')](_0x3d07a9,_0x32b0d9,_0x289fa9,_0x48ac95);};Dialer[_0x9aa7('0x19')][_0x9aa7('0xef')]=function(_0x1357ef,_0x440491,_0x54264b,_0x4b33a9){this[_0x9aa7('0xc5')](_0x1357ef)[_0x9aa7('0x37')](function(){return _0x440491(msgResponse(_0x9aa7('0x1a5'),_0x9aa7('0xd2'),_0x4b33a9));})[_0x9aa7('0xb6')](function(){return _0x54264b(msgResponse(_0x9aa7('0x1be'),'Failure',_0x9aa7('0x1bf')));});};Dialer['prototype'][_0x9aa7('0x9')]=function(_0x5afd49){var _0x5457ae=_0x5afd49[_0x9aa7('0x1c0')]/0x64;var _0x52411a=_0x5afd49[_0x9aa7('0x5d')]/(_0x5afd49[_0x9aa7('0x5d')]+_0x5afd49[_0x9aa7('0x58')]);var _0x3d14e7=Math[_0x9aa7('0x1c1')](_0x5afd49[_0x9aa7('0x69')]*(_0x5afd49[_0x9aa7('0x1c2')]/0x64));var _0x3737e5=Math[_0x9aa7('0x1c1')](_0x5afd49['predictiveIntervalAvailable']*(_0x5afd49[_0x9aa7('0x1c3')]/0x64));var _0x3fdc91=_0x5afd49[_0x9aa7('0x4d')]+_0x5afd49[_0x9aa7('0x50')];var _0x2a306c=Math[_0x9aa7('0x1c4')](_0x5afd49[_0x9aa7('0x84')]*_0x5afd49[_0x9aa7('0x6c')]*_0x5afd49['predictiveIntervalHitRate']*_0x5afd49['predictiveIntervalMultiplicativeFactor']);if(_[_0x9aa7('0x38')](_0x5afd49[_0x9aa7('0x25')])){if(!_['isUndefined'](_0x5afd49[_0x9aa7('0x89')])){_0x5afd49[_0x9aa7('0x89')]=undefined;loggerPredictive[_0x9aa7('0x91')](_0x9aa7('0x1c5'),_0x9aa7('0x1c6'));}if(!_['isUndefined'](_0x5afd49[_0x9aa7('0x8b')])){loggerPredictive[_0x9aa7('0x91')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5afd49['handlePredictive']);_0x5afd49[_0x9aa7('0x8b')]=undefined;}_0x5afd49[_0x9aa7('0x25')]=moment()[_0x9aa7('0x71')](_0x9aa7('0xf2'));loggerPredictive[_0x9aa7('0x79')](_0x5afd49[_0x9aa7('0x3b')],_0x9aa7('0x1c7'),_0x5afd49[_0x9aa7('0x25')]);this[_0x9aa7('0x150')](_0x5afd49,0x1);}else if(ifInterval(_0x5afd49[_0x9aa7('0x1c8')],_0x5afd49['startProgressive'])){this[_0x9aa7('0x150')](_0x5afd49,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x5afd49[_0x9aa7('0x25')],_0x5afd49['name']);_0x5afd49[_0x9aa7('0x84')]=0x0;_0x5afd49[_0x9aa7('0x67')]=0x0;}else if(_0x5457ae<_0x52411a&&_0x5afd49[_0x9aa7('0x1c9')]===_0x9aa7('0x1ca')){freeVariablesPredictive(_0x5afd49);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x1cb'),_0x9aa7('0x1cc'),_0x52411a,_0x9aa7('0x25'),_0x5afd49[_0x9aa7('0x3b')]);}else if(_0x2a306c<_0x5afd49[_0x9aa7('0x67')]&&_0x5afd49[_0x9aa7('0x1c9')]===_0x9aa7('0x1ca')){freeVariablesPredictive(_0x5afd49);loggerPredictive['info'](_0x9aa7('0x1cd'),_0x9aa7('0x1ce'),_0x2a306c,_0x9aa7('0x1cf'),_0x5afd49[_0x9aa7('0x67')],'startProgressive',_0x5afd49[_0x9aa7('0x3b')]);}else if(!ifInterval(_0x5afd49[_0x9aa7('0x1c8')],_0x5afd49[_0x9aa7('0x25')])&&_[_0x9aa7('0x38')](_0x5afd49[_0x9aa7('0x89')])&&!_[_0x9aa7('0x38')](_0x5afd49[_0x9aa7('0x25')])){_0x5afd49['startPredictive']=moment()[_0x9aa7('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x9aa7('0x79')](_0x5afd49['name'],_0x9aa7('0x1d0'),_0x5afd49['startPredictive']);this[_0x9aa7('0xba')](_0x5afd49[_0x9aa7('0x1c8')])[_0x9aa7('0x37')](this[_0x9aa7('0x1d1')](_0x5afd49))[_0x9aa7('0x37')](mergeDataErlangB(_0x5afd49))[_0x9aa7('0x37')](this[_0x9aa7('0x1d2')](_0x5afd49))[_0x9aa7('0xb6')](loggerCatchPredictive(_0x9aa7('0x1d3'),_0x5afd49));}else if(!ifInterval(_0x5afd49[_0x9aa7('0x1c8')],_0x5afd49['startPredictive'])){_0x5afd49[_0x9aa7('0x67')]=0x0;_0x5afd49['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x9aa7('0x79')](_0x5afd49[_0x9aa7('0x3b')],_0x9aa7('0x1d4'),_0x5afd49[_0x9aa7('0x89')]);clearInterval(_0x5afd49[_0x9aa7('0x8b')]);_0x5afd49[_0x9aa7('0x8b')]=undefined;this['averageHandleTime'](_0x5afd49[_0x9aa7('0x1c8')])['then'](this['getDataPredictive'](_0x5afd49))['then'](mergeDataErlangB(_0x5afd49))[_0x9aa7('0x37')](this[_0x9aa7('0x1d2')](_0x5afd49))[_0x9aa7('0xb6')](loggerCatchPredictive(_0x9aa7('0x1d5'),_0x5afd49));}else if(_0x5afd49[_0x9aa7('0x69')]&&_0x3fdc91<_0x5afd49[_0x9aa7('0x69')]-_0x3737e5){freeVariablesPredictive(_0x5afd49);loggerPredictive[_0x9aa7('0x79')](_0x5afd49['name'],_0x9aa7('0x1d6'),_0x3fdc91,_0x9aa7('0x1d7'),_0x5afd49[_0x9aa7('0x69')],'-',_0x3737e5,'=',_0x5afd49['predictiveIntervalAvailable']-_0x3737e5,')');}else if(_0x5afd49[_0x9aa7('0x69')]&&_0x3fdc91>_0x5afd49['predictiveIntervalAvailable']+_0x3d14e7){freeVariablesPredictive(_0x5afd49);loggerPredictive[_0x9aa7('0x79')](_0x5afd49[_0x9aa7('0x3b')],_0x9aa7('0x1d6'),_0x3fdc91,_0x9aa7('0x1d8'),_0x5afd49[_0x9aa7('0x69')],'+',_0x3d14e7,'=',_0x5afd49[_0x9aa7('0x69')]+_0x3d14e7,')');}};Dialer[_0x9aa7('0x19')][_0x9aa7('0x1d1')]=function(_0x3ea0d8){var _0x2d0c81=this;return function(_0x1d31d0){return new BPromise(function(_0x23b7f9,_0x2e79c1){_[_0x9aa7('0xcc')](_0x3ea0d8,_0x1d31d0[0x0]);if(checkGetDataPredictive(_0x1d31d0[0x0])){var _0x443996=_0x3ea0d8[_0x9aa7('0x69')]=_0x3ea0d8[_0x9aa7('0x50')]+_0x3ea0d8[_0x9aa7('0x4d')];var _0x18a6b4=_0x3ea0d8[_0x9aa7('0x1c8')]*0x3c;var _0x44fbc2=_0x1d31d0[0x0][_0x9aa7('0x63')]+_0x1d31d0[0x0][_0x9aa7('0x62')];var _0x42a865=(_0x1d31d0[0x0]['predictiveIntervalAnsweredCalls']+_0x1d31d0[0x0][_0x9aa7('0x65')]+_0x1d31d0[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1d31d0[0x0][_0x9aa7('0x6a')];_0x3ea0d8['predictiveIntervalHitRate']=_0x42a865>0x0?_0x42a865:0x1;switch(_0x3ea0d8[_0x9aa7('0x1c9')]){case _0x9aa7('0x1ca'):var _0x5001a5=_0x3ea0d8[_0x9aa7('0x1c0')]/0x64;return _0x2d0c81['abandonmentRate'](_0x443996,_0x18a6b4,_0x44fbc2,_0x42a865,_0x5001a5)[_0x9aa7('0x37')](function(_0x5bde43){return _0x23b7f9(_0x5bde43);});case _0x9aa7('0x1d9'):var _0x33b57e=_0x3ea0d8[_0x9aa7('0x1c0')]/0x64;return _0x2d0c81[_0x9aa7('0x1da')](_0x443996,_0x18a6b4,_0x44fbc2,_0x42a865,_0x33b57e)[_0x9aa7('0x37')](function(_0x38f382){return _0x23b7f9(_0x38f382);});default:return _0x2e79c1(msgResponse(_0x9aa7('0x1db'),_0x9aa7('0x13b'),_0x9aa7('0x1dc')));}}else{return _0x2e79c1(msgResponse(_0x9aa7('0x1db'),_0x9aa7('0x13b'),_0x9aa7('0x1dd')));}});};};Dialer[_0x9aa7('0x19')][_0x9aa7('0x1de')]=function(_0xe198bf){var _0x47ef35=this;return function(_0x428444){return new BPromise(function(_0x56586b,_0x17cefc){_['merge'](_0xe198bf,_0x428444[0x0]);if(checkGetDataPredictive(_0x428444[0x0])){loggerPredictive[_0x9aa7('0x79')](JSON[_0x9aa7('0x45')](_0x428444[0x0]));if(_0xe198bf[_0x9aa7('0x1c9')]==='dropRate'){return _0x47ef35[_0x9aa7('0xc3')](_0xe198bf['id'])[_0x9aa7('0x37')](function(_0x2c22a7){var _0x18688d=_0xe198bf['loggedIn']-_0x2c22a7[0x0]['outboundQueuePauses'];var _0x13428f=_0xe198bf[_0x9aa7('0x1c8')]*0x3c;var _0x30c757=_0x428444[0x0][_0x9aa7('0x63')]+_0x428444[0x0][_0x9aa7('0x62')];var _0x2ea736=(_0x428444[0x0][_0x9aa7('0x78')]+_0x428444[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x428444[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x428444[0x0][_0x9aa7('0x6a')];var _0x1592c7=_0xe198bf[_0x9aa7('0x1c0')]/0x64;_0xe198bf[_0x9aa7('0x1df')]=_0x2c22a7[0x0][_0x9aa7('0x1e0')]||0x0;_0xe198bf[_0x9aa7('0x68')]=_0x2ea736>0x0?_0x2ea736:0x1;return _0x47ef35[_0x9aa7('0x1e1')](_0x18688d,_0x13428f,_0x30c757,_0x2ea736,_0x1592c7);})['then'](function(_0x5a1d7b){return _0x56586b(_0x5a1d7b);})[_0x9aa7('0xb6')](function(_0x35a078){return _0x17cefc(msgResponse(_0x9aa7('0x1e2'),_0x9aa7('0x13b'),JSON[_0x9aa7('0x45')](_0x35a078)));});}if(_0xe198bf[_0x9aa7('0x1c9')]===_0x9aa7('0x1d9')){return _0x47ef35[_0x9aa7('0xc3')](_0xe198bf['id'])[_0x9aa7('0x37')](function(_0x16a2db){var _0x2a753e=_0xe198bf[_0x9aa7('0x15a')]-_0x16a2db[0x0][_0x9aa7('0x1e0')];var _0xa8e063=_0xe198bf['dialPredictiveInterval']*0x3c;var _0x2663a1=_0x428444[0x0]['predictiveIntervalAvgTalktime']+_0x428444[0x0][_0x9aa7('0x62')];var _0x24319a=(_0x428444[0x0][_0x9aa7('0x78')]+_0x428444[0x0][_0x9aa7('0x65')]+_0x428444[0x0][_0x9aa7('0x64')])/_0x428444[0x0]['predictiveIntervalTotalCalls'];var _0x521a8d=_0xe198bf[_0x9aa7('0x1c0')]/0x64;_0xe198bf[_0x9aa7('0x1df')]=_0x16a2db[0x0]['outboundQueuePauses']||0x0;_0xe198bf[_0x9aa7('0x68')]=_0x24319a>0x0?_0x24319a:0x1;return _0x47ef35[_0x9aa7('0x1da')](_0x2a753e,_0xa8e063,_0x2663a1,_0x24319a,_0x521a8d);})[_0x9aa7('0x37')](function(_0x121f3a){return _0x56586b(_0x121f3a);})[_0x9aa7('0xb6')](function(_0x5a0e28){return _0x17cefc(msgResponse(_0x9aa7('0x1e2'),_0x9aa7('0x13b'),JSON[_0x9aa7('0x45')](_0x5a0e28)));});}}else{return _0x17cefc(msgResponse('[getDataPredictive]',_0x9aa7('0x13b'),_0x9aa7('0x1dd')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x2f53e0){var _0x102613=this;return function(){var _0xdd724e=0x0;var _0x398ce1=Math[_0x9aa7('0x1c4')](_0x2f53e0[_0x9aa7('0x1e3')]*0x3e8);if(_0x398ce1>0x0){_0x398ce1=_0x398ce1<0x64?0x64:_0x398ce1;loggerPredictive[_0x9aa7('0x79')](_0x2f53e0[_0x9aa7('0x3b')],'one\x20call\x20every:',_0x398ce1,_0x9aa7('0x46'));_0x2f53e0['handlePredictive']=setInterval(function(){_0x102613[_0x9aa7('0x8b')](_0x2f53e0);loggerPredictiveCalls[_0x9aa7('0x79')](_0x9aa7('0x1e4'),_0xdd724e+=0x1);},_0x398ce1);}else{loggerPredictive['info'](_0x2f53e0[_0x9aa7('0x3b')],_0x9aa7('0x1e5'));}};};Dialer[_0x9aa7('0x19')][_0x9aa7('0x1e6')]=function(_0x19f62c,_0x3ac22d){var _0x1cb786=this;return function(_0x389596){if(_[_0x9aa7('0x42')](_0x389596)){if(_[_0x9aa7('0xaa')](_0x3ac22d['UserId'])||!_0x3ac22d[_0x9aa7('0x1e7')]){if(_0x19f62c[_0x9aa7('0x14f')]==='booked'){_0x19f62c[_0x9aa7('0x123')]=_[_0x9aa7('0x38')](_0x19f62c[_0x9aa7('0x123')])?!![]:_0x19f62c[_0x9aa7('0x123')];var _0x4ef66e=uuid['v4']();_0x1cb786[_0x9aa7('0x22')][_0x4ef66e]=new Action(_0x19f62c,_0x3ac22d,_0x4ef66e);loggerBooked[_0x9aa7('0x79')]('[booked][checkContactBlack]',_0x4ef66e,'queueStatusComplete:\x20',JSON[_0x9aa7('0x45')](_0x19f62c['queueStatusComplete']),_0x9aa7('0x1e8'),_0x19f62c['name']);if(_0x19f62c[_0x9aa7('0x123')]){_0x19f62c[_0x9aa7('0x123')]=![];_0x1cb786[_0x9aa7('0x26')][_0x1cb786['actions'][_0x4ef66e][_0x9aa7('0xb0')]]=[];ami[_0x9aa7('0xab')]({'actionid':_0x4ef66e,'action':_0x9aa7('0x1e9'),'queue':_0x19f62c[_0x9aa7('0x3b')]})[_0x9aa7('0xb6')](function(){_0x1cb786[_0x9aa7('0xaf')](_0x19f62c);_0x1cb786[_0x9aa7('0xbc')]({'active':![],'ContactId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e]['ContactId'],'ListId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e][_0x9aa7('0xcd')],'VoiceQueueId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e][_0x9aa7('0xcf')]||undefined,'CampaignId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e][_0x9aa7('0xf4')]||undefined})['catch'](loggerCatch(_0x9aa7('0x1ea')));delete _0x1cb786[_0x9aa7('0x22')][_0x4ef66e];});}else{loggerBooked['info'](_0x9aa7('0x1eb'),JSON[_0x9aa7('0x45')](_0x19f62c['queueStatusComplete']),_0x9aa7('0x1e8'),_0x19f62c[_0x9aa7('0x3b')]);_0x1cb786[_0x9aa7('0xaf')](_0x19f62c);_0x1cb786['rescheduleContact']({'active':![],'ContactId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e][_0x9aa7('0xf3')],'ListId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e][_0x9aa7('0xcd')],'VoiceQueueId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e]['VoiceQueueId']||undefined,'CampaignId':_0x1cb786[_0x9aa7('0x22')][_0x4ef66e][_0x9aa7('0xf4')]||undefined})['catch'](loggerCatch(_0x9aa7('0x1ea')));delete _0x1cb786[_0x9aa7('0x22')][_0x4ef66e];}}else{return _0x1cb786[_0x9aa7('0x167')](_0x19f62c,_0x3ac22d);}}else{if(getDiff(_0x3ac22d[_0x9aa7('0x1ec')])<_0x19f62c['dialRecallMeTimeout']*0x3c){if(_0x3ac22d[_0x9aa7('0x156')]&&!_0x3ac22d[_0x9aa7('0x156')][_0x9aa7('0x1ed')]){_0x1cb786['preview']['run'](_0x3ac22d['id'])[_0x9aa7('0x12e')](function(){_0x1cb786[_0x9aa7('0xaf')](_0x19f62c);});}else{_0x1cb786['unlockContact']({'active':![]},_0x3ac22d['id'],0x1)[_0x9aa7('0x12e')](function(){_0x1cb786[_0x9aa7('0xaf')](_0x19f62c);});}}else{_0x19f62c['outboundReCallsDay']+=0x1;_0x1cb786[_0x9aa7('0xaf')](_0x19f62c);if(_0x19f62c[_0x9aa7('0x1ee')]){_0x1cb786[_0x9aa7('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ac22d['ContactId'],'ListId':_0x3ac22d[_0x9aa7('0xcd')],'VoiceQueueId':_0x3ac22d[_0x9aa7('0xcf')]||undefined,'CampaignId':_0x3ac22d[_0x9aa7('0xf4')]||undefined})[_0x9aa7('0xb6')](loggerCatch(_0x9aa7('0x1ef')));_0x1cb786[_0x9aa7('0xc7')](createObjHistory(_0x19f62c,_0x3ac22d,_0x9aa7('0x1f0'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x9aa7('0x1f1')));}else{_0x1cb786['saveInDb'](createObjHistory(_0x19f62c,_0x3ac22d,_0x9aa7('0x1f2'),0x16,_0x9aa7('0x1f3')),_0x9aa7('0x1f4'),'[Originate][HistoryRecallClose]');}}}}else{_0x19f62c[_0x9aa7('0x59')]+=0x1;_0x1cb786['saveInDb'](createObjHistory(_0x19f62c,_0x3ac22d,_0x9aa7('0x1f5'),0xd,_0x9aa7('0x1f6')),_0x9aa7('0x1f7'),_0x9aa7('0x1f8'));throw _0x9aa7('0x1f9');}};};Dialer[_0x9aa7('0x19')][_0x9aa7('0x159')]=function(_0x390bcb){var _0x5ea72f=this;var _0x1d3744=_0x390bcb[_0x9aa7('0x1fa')]-_0x390bcb[_0x9aa7('0x6b')]-_0x390bcb['temp'];emitCampaignSummary(_0x390bcb);if(_0x1d3744>0x0){if(_0x1d3744>this['maxNumberOriginate']){_0x1d3744=this['maxNumberOriginate'];}_0x390bcb[_0x9aa7('0xbf')]+=_0x1d3744;this['getContactDialerIvr'](_0x390bcb['id'],_0x1d3744,_0x390bcb[_0x9aa7('0x1fb')],_0x390bcb)[_0x9aa7('0x37')](function(_0x54c23c){_0x390bcb[_0x9aa7('0xbf')]-=_0x1d3744;_0x390bcb[_0x9aa7('0xbf')]=_0x390bcb[_0x9aa7('0xbf')]>0x0?_0x390bcb[_0x9aa7('0xbf')]:0x0;if(!checkContactEmpty(_0x54c23c)){_0x390bcb[_0x9aa7('0x39')]=_0x9aa7('0x1fc');logger[_0x9aa7('0x79')]('[getContactCampaign2][Empty]'+_0x390bcb[_0x9aa7('0x3b')]);}else{_0x390bcb[_0x9aa7('0x6b')]+=_0x54c23c[_0x9aa7('0x93')];_0x390bcb['message']=_0x9aa7('0x1fd');for(var _0x2e9112=0x0;_0x2e9112<_0x54c23c[_0x9aa7('0x93')];_0x2e9112+=0x1){_0x390bcb['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x54c23c[_0x2e9112])||_['isNil'](_0x54c23c[_0x2e9112][_0x9aa7('0x181')])||_['isNil'](_0x54c23c[_0x2e9112][_0x9aa7('0x181')][_0x9aa7('0x16b')])){_0x5ea72f[_0x9aa7('0x1fe')](_0x9aa7('0x1ff'),_0x390bcb,_0x54c23c[_0x2e9112]);}else{_0x5ea72f[_0x9aa7('0xb8')](_['pick'](_0x54c23c[_0x2e9112],[_0x9aa7('0xf4'),_0x9aa7('0x200')]))[_0x9aa7('0x37')](_0x5ea72f[_0x9aa7('0x1e6')](_0x390bcb,_0x54c23c[_0x2e9112]))[_0x9aa7('0xb6')](_0x5ea72f[_0x9aa7('0x201')](_0x9aa7('0x202'),_0x390bcb));}}}})['catch'](loggerGetContactDialer(_0x9aa7('0x203'),_0x390bcb,_0x1d3744));}};Dialer['prototype'][_0x9aa7('0x150')]=function(_0x3dd728,_0x4d19d2){var _0x1aea47=this;var _0x17bedb=[];var _0x435594=_0x4d19d2>=0x1?_0x4d19d2:0x1;if(_0x3dd728[_0x9aa7('0x14f')]===_0x9aa7('0x8')){_0x435594=0x1;}var _0x59d40a=Math['floor'](_0x3dd728['available']*_0x435594)-_0x3dd728[_0x9aa7('0x6b')]-_0x3dd728['temp'];emitVoiceQueueSummary(_0x3dd728);if(_0x3dd728[_0x9aa7('0x204')]>0x0){var _0x71e994=_0x3dd728[_0x9aa7('0x204')]-_0x3dd728[_0x9aa7('0x6b')]-_0x3dd728['talking']-_0x3dd728[_0x9aa7('0xbf')]-_0x3dd728[_0x9aa7('0x4e')];if(_0x59d40a>_0x71e994){_0x59d40a=_0x71e994;}}if(_0x59d40a>0x0){if(_0x3dd728[_0x9aa7('0x14f')]===_0x9aa7('0x8')){_0x59d40a=0x1;}if(_0x59d40a>this['maxNumberOriginate']){_0x59d40a=this[_0x9aa7('0x20')];}_0x3dd728[_0x9aa7('0xbf')]+=_0x59d40a;for(var _0x115ce6 in this[_0x9aa7('0x1e')]){if(typeof this[_0x9aa7('0x1e')][_0x115ce6]!==_0x9aa7('0xa7')){if(this['agents'][_0x115ce6][_0x9aa7('0xa0')]==='not_inuse'&&this['agents'][_0x115ce6]['status']==='reachable'){_0x17bedb[_0x9aa7('0x120')](this['agents'][_0x115ce6]['id']);}}}this[_0x9aa7('0xbe')](_0x3dd728['id'],_0x17bedb,_0x59d40a,_0x3dd728['dialOrderByScheduledAt'],_0x3dd728)[_0x9aa7('0x37')](function(_0xcc9e36){_0x3dd728['temp']-=_0x59d40a;_0x3dd728['temp']=_0x3dd728[_0x9aa7('0xbf')]>0x0?_0x3dd728[_0x9aa7('0xbf')]:0x0;if(!checkContactEmpty(_0xcc9e36)){_0x1aea47['countReScheduled'](_0x3dd728)['then'](sendMessageReschedule(_0x3dd728))['catch'](loggerCatch(_0x9aa7('0xb4')));}else{_0x3dd728[_0x9aa7('0x6b')]+=_0xcc9e36[_0x9aa7('0x93')];_0x3dd728[_0x9aa7('0x39')]=_0x3dd728[_0x9aa7('0x14f')]==='booked'?'ACTIVE':'RUNNING';for(var _0x2f8440=0x0;_0x2f8440<_0xcc9e36[_0x9aa7('0x93')];_0x2f8440+=0x1){if(_[_0x9aa7('0xaa')](_0xcc9e36[_0x2f8440])||_[_0x9aa7('0xaa')](_0xcc9e36[_0x2f8440][_0x9aa7('0x181')])||_[_0x9aa7('0xaa')](_0xcc9e36[_0x2f8440][_0x9aa7('0x181')][_0x9aa7('0x16b')])){_0x1aea47[_0x9aa7('0x1fe')](_0x9aa7('0x1ff'),_0x3dd728,_0xcc9e36[_0x2f8440]);}else{_0x1aea47[_0x9aa7('0xb5')](_['pick'](_0xcc9e36[_0x2f8440],[_0x9aa7('0xcf'),'Contact.phone']))[_0x9aa7('0x37')](_0x1aea47[_0x9aa7('0x1e6')](_0x3dd728,_0xcc9e36[_0x2f8440]))[_0x9aa7('0xb6')](_0x1aea47[_0x9aa7('0x201')](_0x9aa7('0x1ff'),_0x3dd728));}}}})[_0x9aa7('0xb6')](loggerGetContactDialer(_0x9aa7('0x205'),_0x3dd728,_0x59d40a));}};Dialer[_0x9aa7('0x19')][_0x9aa7('0x8b')]=function(_0x1e9940){if(_0x1e9940['dialLimitQueue']>0x0){var _0x409777=_0x1e9940[_0x9aa7('0x204')]-_0x1e9940[_0x9aa7('0x6b')]-_0x1e9940[_0x9aa7('0x50')];if(_0x409777>0x0){this['tryOriginatePredictive'](_0x1e9940);}else{loggerPredictiveCalls[_0x9aa7('0x79')](_0x9aa7('0x206'));}}else{this['tryOriginatePredictive'](_0x1e9940);}};Dialer[_0x9aa7('0x19')]['tryOriginatePredictive']=function(_0x10d3f7){var _0x4ea8b7=this;var _0x4b9bac=[];_0x10d3f7[_0x9aa7('0x6b')]+=0x1;for(var _0x183446 in this[_0x9aa7('0x1e')]){if(typeof this[_0x9aa7('0x1e')][_0x183446]!==_0x9aa7('0xa7')){if(this['agents'][_0x183446][_0x9aa7('0xa0')]===_0x9aa7('0x207')&&this['agents'][_0x183446][_0x9aa7('0xac')]==='reachable'){_0x4b9bac[_0x9aa7('0x120')](this[_0x9aa7('0x1e')][_0x183446]['id']);}}}this[_0x9aa7('0xbe')](_0x10d3f7['id'],_0x4b9bac,0x1,_0x10d3f7['dialOrderByScheduledAt'],_0x10d3f7)['then'](function(_0x38f669){if(!checkContactEmpty(_0x38f669)){checkContactLowerLimitOriginate(_0x10d3f7,0x1,0x0);_0x4ea8b7[_0x9aa7('0xb2')](_0x10d3f7)[_0x9aa7('0x37')](sendMessageReschedule(_0x10d3f7))[_0x9aa7('0xb6')](loggerCatch('[countReScheduled]\x20'));}else{_0x10d3f7[_0x9aa7('0x39')]=_0x9aa7('0x1fd');if(_[_0x9aa7('0xaa')](_0x38f669[0x0])||_[_0x9aa7('0xaa')](_0x38f669[0x0]['Contact'])||_[_0x9aa7('0xaa')](_0x38f669[0x0][_0x9aa7('0x181')][_0x9aa7('0x16b')])){_0x4ea8b7[_0x9aa7('0x1fe')](_0x9aa7('0x1ff'),_0x10d3f7,_0x38f669[0x0]);}else{_0x4ea8b7['checkIsBlackList'](_[_0x9aa7('0x121')](_0x38f669[0x0],[_0x9aa7('0xcf'),'Contact.phone']))['then'](_0x4ea8b7['checkContactBlack'](_0x10d3f7,_0x38f669[0x0]))[_0x9aa7('0xb6')](_0x4ea8b7[_0x9aa7('0x201')]('[actionOriginatePredictive]\x20',_0x10d3f7));}}})[_0x9aa7('0xb6')](loggerGetContactDialer(_0x9aa7('0x208'),_0x10d3f7,0x1));emitVoiceQueueSummary(_0x10d3f7);};Dialer[_0x9aa7('0x19')][_0x9aa7('0x1e1')]=function(_0x30a4de,_0x5dc472,_0x5590a1,_0x2420ad,_0x207244,_0x5537f4){loggerPredictive[_0x9aa7('0x79')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x209'),_0x30a4de);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x20a'),_0x5dc472);loggerPredictive[_0x9aa7('0x79')]('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',_0x5590a1);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x20b'),_0x2420ad);loggerPredictive['info'](_0x9aa7('0x20c'),_0x207244);loggerPredictive['info'](_0x9aa7('0x7d'));return new BPromise(function(_0x40bbba,_0x3e3306){if(_0x30a4de<=0x0||isNaN(_0x30a4de)){return _0x3e3306(msgResponse(_0x9aa7('0x20d'),'Error',_0x9aa7('0x20e')+_0x30a4de));}if(_0x5590a1<=0x0||isNaN(_0x5590a1)){return _0x3e3306(msgResponse('[abandonmentRate]',_0x9aa7('0x44'),_0x9aa7('0x20f')+_0x5590a1));}if(_0x2420ad<=0x0||isNaN(_0x2420ad)){return _0x3e3306(msgResponse('[abandonmentRate]',_0x9aa7('0x44'),_0x9aa7('0x210')+_0x2420ad));}if(_0x5dc472<=0x0||isNaN(_0x5dc472)){return _0x3e3306(msgResponse(_0x9aa7('0x20d'),'Error',_0x9aa7('0x211')+_0x5dc472));}if(_0x207244<=0x0||isNaN(_0x207244)){return _0x3e3306(msgResponse('[abandonmentRate]',_0x9aa7('0x44'),_0x9aa7('0x212')+_0x207244));}_0x5537f4=_0x5537f4||0x0;var _0x1d42f4=0x1/_0x5590a1;var _0x1af2e0=0x0;var _0x343124=0x0;var _0x45fd62=0x0;var _0x5e1c72=0x0;for(var _0x370abe=0x0;_0x45fd62<_0x207244;_0x370abe+=0x1){_0x343124=_0x370abe/_0x5dc472;_0x1af2e0=(_0x2420ad*_0x343124+_0x5537f4)/_0x1d42f4;_0x45fd62=erlangb(_0x1af2e0,_0x30a4de);_0x5e1c72=_0x1af2e0/_0x30a4de*(0x1-erlangb(_0x1af2e0,_0x30a4de));}return _0x40bbba({'erlangCalls':_0x370abe,'erlangCallToSecond':_0x5dc472/_0x370abe,'erlangAbandonmentRate':_0x45fd62,'erlangBusyFactor':_0x5e1c72});});};Dialer[_0x9aa7('0x19')][_0x9aa7('0x1da')]=function(_0x4cd499,_0x18a3d8,_0x54b613,_0x3e7d48,_0x350369,_0x2c2ff4){loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x213'));loggerPredictive['info'](_0x9aa7('0x209'),_0x4cd499);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x20a'),_0x18a3d8);loggerPredictive['info'](_0x9aa7('0x214'),_0x54b613);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x20b'),_0x3e7d48);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x215'),_0x350369);loggerPredictive[_0x9aa7('0x79')](_0x9aa7('0x7d'));return new BPromise(function(_0x2de193,_0x3bd765){if(_0x4cd499<=0x0||isNaN(_0x4cd499)){return _0x3bd765(msgResponse(_0x9aa7('0x216'),_0x9aa7('0x44'),'m\x20=\x20'+_0x4cd499));}if(_0x54b613<=0x0||isNaN(_0x54b613)){return _0x3bd765(msgResponse(_0x9aa7('0x216'),_0x9aa7('0x44'),_0x9aa7('0x20f')+_0x54b613));}if(_0x3e7d48<=0x0||isNaN(_0x3e7d48)){return _0x3bd765(msgResponse(_0x9aa7('0x216'),_0x9aa7('0x44'),'p\x20=\x20'+_0x3e7d48));}if(_0x18a3d8<=0x0||isNaN(_0x18a3d8)){return _0x3bd765(msgResponse(_0x9aa7('0x216'),'Error',_0x9aa7('0x211')+_0x18a3d8));}if(_0x350369<=0x0||isNaN(_0x350369)){return _0x3bd765(msgResponse(_0x9aa7('0x216'),_0x9aa7('0x44'),_0x9aa7('0x217')+_0x350369));}_0x2c2ff4=_0x2c2ff4||0x0;var _0x119023=0x1/_0x54b613;var _0x1a2ff7=0x0;var _0x6c5c97=0x0;var _0x3f2011=0x0;var _0x5419e7=0x0;for(var _0x4d4e12=0x0;_0x5419e7<_0x350369;_0x4d4e12+=0x1){_0x6c5c97=_0x4d4e12/_0x18a3d8;_0x1a2ff7=(_0x3e7d48*_0x6c5c97+_0x2c2ff4)/_0x119023;_0x3f2011=erlangb(_0x1a2ff7,_0x4cd499);_0x5419e7=_0x1a2ff7/_0x4cd499*(0x1-erlangb(_0x1a2ff7,_0x4cd499));}return _0x2de193({'erlangCalls':_0x4d4e12,'erlangCallToSecond':_0x18a3d8/_0x4d4e12,'erlangAbandonmentRate':_0x3f2011,'erlangBusyFactor':_0x5419e7});});};module[_0x9aa7('0x218')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 2168fc5..fb7e5c7 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe998=['number','starttime','responsetime','droptime','endtime','ringtime','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum'];(function(_0x80b9b8,_0x2a2163){var _0xb7fe18=function(_0x4db660){while(--_0x4db660){_0x80b9b8['push'](_0x80b9b8['shift']());}};_0xb7fe18(++_0x2a2163);}(_0xe998,0x87));var _0x8e99=function(_0x2fbc21,_0x25065e){_0x2fbc21=_0x2fbc21-0x0;var _0x178491=_0xe998[_0x2fbc21];return _0x178491;};'use strict';var util=require('util');var _=require(_0x8e99('0x0'));var moment=require(_0x8e99('0x1'));function getSeconds(_0x6a5f30,_0x290d3d){var _0x5dd216=moment(_0x6a5f30)['milliseconds'](0x0);var _0x5deb95=moment(_0x290d3d)['milliseconds'](0x0);return _0x5dd216[_0x8e99('0x2')](_0x5deb95,_0x8e99('0x3'));}function QueueCallerAbandon(_0x52ea33,_0xf0800b){this['scheduledat']=_0x52ea33[_0x8e99('0x4')];this[_0x8e99('0x5')]=_0x52ea33[_0x8e99('0x5')];this[_0x8e99('0x6')]=_0x52ea33[_0x8e99('0x5')]===_0x8e99('0x7')?_0x8e99('0x8'):_0x52ea33[_0x8e99('0x5')];this[_0x8e99('0x9')]=_0x52ea33['countbusyretry'];this[_0x8e99('0xa')]=_0x52ea33[_0x8e99('0xa')];this[_0x8e99('0xb')]=_0x52ea33[_0x8e99('0xb')];this['countglobal']=_0x52ea33['countbusyretry']+_0x52ea33[_0x8e99('0xa')]+_0x52ea33[_0x8e99('0xb')]+_0x52ea33[_0x8e99('0xc')]+_0x52ea33[_0x8e99('0xd')]+_0x52ea33['countabandonedretry']+_0x52ea33[_0x8e99('0xe')]+_0x52ea33['countagentrejectretry'];this[_0x8e99('0xc')]=_0x52ea33['countnosuchnumberretry'];this[_0x8e99('0xd')]=_0x52ea33['countdropretry'];this[_0x8e99('0xf')]=_0x52ea33[_0x8e99('0xf')];this['countmachineretry']=_0x52ea33[_0x8e99('0xe')];this[_0x8e99('0x10')]=_0x52ea33['countagentrejectretry'];this[_0x8e99('0x11')]=_0xf0800b[_0x8e99('0x11')];this[_0x8e99('0x12')]=_0x52ea33[_0x8e99('0x13')];this[_0x8e99('0x14')]=_0x52ea33[_0x8e99('0x15')];this['starttime']=_0x52ea33[_0x8e99('0x16')];this[_0x8e99('0x17')]=_0x52ea33[_0x8e99('0x17')];this[_0x8e99('0x18')]=_0x52ea33[_0x8e99('0x18')];this[_0x8e99('0x19')]=this[_0x8e99('0x18')];this[_0x8e99('0x1a')]=getSeconds(_0x52ea33[_0x8e99('0x17')],_0x52ea33[_0x8e99('0x16')]);this[_0x8e99('0x1b')]=getSeconds(this[_0x8e99('0x18')],_0x52ea33[_0x8e99('0x17')]);this['talktime']=0x0;this[_0x8e99('0x8')]=_0xf0800b['queue'];this['membername']=_0xf0800b['connectedlinename'];this[_0x8e99('0x1c')]=_0xf0800b[_0x8e99('0x1c')];this[_0x8e99('0x1d')]=_0x52ea33[_0x8e99('0x1d')];this['callbackuniqueid']=_0x52ea33[_0x8e99('0x1e')];this[_0x8e99('0x1f')]=_0x52ea33[_0x8e99('0x1f')];this[_0x8e99('0x20')]=_0x52ea33[_0x8e99('0x20')];this['ContactId']=_0x52ea33['ContactId'];this[_0x8e99('0x21')]=_0x52ea33[_0x8e99('0x21')];this[_0x8e99('0x22')]=_0x52ea33[_0x8e99('0x22')];this[_0x8e99('0x23')]=_0x52ea33['VoiceQueueId'];this['CampaignId']=_0x52ea33[_0x8e99('0x24')];this[_0x8e99('0x25')]=_0x52ea33[_0x8e99('0x25')]||'';this[_0x8e99('0x26')]=_0x52ea33['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xe8bb=['talktime','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','responsetime','droptime','endtime','ringtime'];(function(_0x38fbd7,_0x4e8223){var _0x4e5ebc=function(_0x522aba){while(--_0x522aba){_0x38fbd7['push'](_0x38fbd7['shift']());}};_0x4e5ebc(++_0x4e8223);}(_0xe8bb,0xfe));var _0xbe8b=function(_0x3ff853,_0x1ed201){_0x3ff853=_0x3ff853-0x0;var _0x38dbed=_0xe8bb[_0x3ff853];return _0x38dbed;};'use strict';var util=require(_0xbe8b('0x0'));var _=require(_0xbe8b('0x1'));var moment=require(_0xbe8b('0x2'));function getSeconds(_0x52b8ff,_0x664b8){var _0x47a65b=moment(_0x52b8ff)['milliseconds'](0x0);var _0x44f6bd=moment(_0x664b8)[_0xbe8b('0x3')](0x0);return _0x47a65b[_0xbe8b('0x4')](_0x44f6bd,'seconds');}function QueueCallerAbandon(_0x3c5768,_0x1aec40){this['scheduledat']=_0x3c5768[_0xbe8b('0x5')];this[_0xbe8b('0x6')]=_0x3c5768[_0xbe8b('0x6')];this[_0xbe8b('0x7')]=_0x3c5768['type']==='outbound'?_0xbe8b('0x8'):_0x3c5768[_0xbe8b('0x6')];this['countbusyretry']=_0x3c5768[_0xbe8b('0x9')];this['countcongestionretry']=_0x3c5768['countcongestionretry'];this['countnoanswerretry']=_0x3c5768[_0xbe8b('0xa')];this[_0xbe8b('0xb')]=_0x3c5768[_0xbe8b('0x9')]+_0x3c5768[_0xbe8b('0xc')]+_0x3c5768[_0xbe8b('0xa')]+_0x3c5768[_0xbe8b('0xd')]+_0x3c5768[_0xbe8b('0xe')]+_0x3c5768[_0xbe8b('0xf')]+_0x3c5768[_0xbe8b('0x10')]+_0x3c5768[_0xbe8b('0x11')];this[_0xbe8b('0xd')]=_0x3c5768[_0xbe8b('0xd')];this[_0xbe8b('0xe')]=_0x3c5768[_0xbe8b('0xe')];this['countabandonedretry']=_0x3c5768[_0xbe8b('0xf')];this[_0xbe8b('0x10')]=_0x3c5768['countmachineretry'];this[_0xbe8b('0x11')]=_0x3c5768['countagentrejectretry'];this[_0xbe8b('0x12')]=_0x1aec40[_0xbe8b('0x12')];this[_0xbe8b('0x13')]=_0x3c5768['name'];this[_0xbe8b('0x14')]=_0x3c5768[_0xbe8b('0x15')];this['starttime']=_0x3c5768['starttime'];this[_0xbe8b('0x16')]=_0x3c5768['responsetime'];this[_0xbe8b('0x17')]=_0x3c5768['droptime'];this[_0xbe8b('0x18')]=this[_0xbe8b('0x17')];this[_0xbe8b('0x19')]=getSeconds(_0x3c5768[_0xbe8b('0x16')],_0x3c5768['starttime']);this['holdtime']=getSeconds(this[_0xbe8b('0x17')],_0x3c5768[_0xbe8b('0x16')]);this[_0xbe8b('0x1a')]=0x0;this[_0xbe8b('0x8')]=_0x1aec40[_0xbe8b('0x8')];this['membername']=_0x1aec40[_0xbe8b('0x1b')];this[_0xbe8b('0x1c')]=_0x1aec40[_0xbe8b('0x1c')];this[_0xbe8b('0x1d')]=_0x3c5768[_0xbe8b('0x1d')];this['callbackuniqueid']=_0x3c5768['callbackuniqueid'];this[_0xbe8b('0x1e')]=_0x3c5768['callbackat'];this[_0xbe8b('0x1f')]=_0x3c5768['recallme'];this[_0xbe8b('0x20')]=_0x3c5768[_0xbe8b('0x20')];this[_0xbe8b('0x21')]=_0x3c5768[_0xbe8b('0x21')];this['UserId']=_0x3c5768[_0xbe8b('0x22')];this[_0xbe8b('0x23')]=_0x3c5768[_0xbe8b('0x23')];this[_0xbe8b('0x24')]=_0x3c5768[_0xbe8b('0x24')];this[_0xbe8b('0x25')]=_0x3c5768[_0xbe8b('0x25')]||'';this[_0xbe8b('0x26')]=_0x3c5768[_0xbe8b('0x26')]||'';}module[_0xbe8b('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 46ad9c9..f140671 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(_0x3b695a,_0x4780b7){var _0x3e3254=function(_0x585974){while(--_0x585974){_0x3b695a['push'](_0x3b695a['shift']());}};_0x3e3254(++_0x4780b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x56461f,_0x4d08fc){var _0x6894f7=function(_0x27ffe1){while(--_0x27ffe1){_0x56461f['push'](_0x56461f['shift']());}};_0x6894f7(++_0x4d08fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 0e94c3c..9f676c7 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 _0xeb74=['syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten'];(function(_0x3a831f,_0x31c8a4){var _0x26786c=function(_0x33cbdf){while(--_0x33cbdf){_0x3a831f['push'](_0x3a831f['shift']());}};_0x26786c(++_0x31c8a4);}(_0xeb74,0xe3));var _0x4eb7=function(_0x5b9299,_0x188c23){_0x5b9299=_0x5b9299-0x0;var _0x48ae1a=_0xeb74[_0x5b9299];return _0x48ae1a;};'use strict';var util=require(_0x4eb7('0x0'));var _=require(_0x4eb7('0x1'));var BPromise=require(_0x4eb7('0x2'));var uuid=require(_0x4eb7('0x3'));var moment=require(_0x4eb7('0x4'));var path=require(_0x4eb7('0x5'));var tiff2pdf=require(_0x4eb7('0x6'));var gs=require('./util/gs');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var ami=require(_0x4eb7('0x9'));var rpcDb=require(_0x4eb7('0xa'));var Channel=require(_0x4eb7('0xb'));var ut=require('./util/util');var Action=require(_0x4eb7('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4eb7('0xd'));var faxMessage=require(_0x4eb7('0xe'));function Fax(_0x588a1c){this['channels']={};this[_0x4eb7('0xf')]=_0x588a1c[_0x4eb7('0xf')];this['trunks']=_0x588a1c[_0x4eb7('0x10')];this['actions']={};ami['on'](_0x4eb7('0x11'),this[_0x4eb7('0x12')][_0x4eb7('0x13')](this));ami['on']('varset',this[_0x4eb7('0x14')][_0x4eb7('0x13')](this));ami['on'](_0x4eb7('0x15'),this[_0x4eb7('0x16')][_0x4eb7('0x13')](this));ami['on'](_0x4eb7('0x17'),this[_0x4eb7('0x18')]['bind'](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x4eb7('0x13')](this));ami['on']('receivefax',this[_0x4eb7('0x19')][_0x4eb7('0x13')](this));ami['on'](_0x4eb7('0x1a'),this[_0x4eb7('0x1b')][_0x4eb7('0x13')](this));ami['on'](_0x4eb7('0x1c'),this[_0x4eb7('0x1d')][_0x4eb7('0x13')](this));}Fax[_0x4eb7('0x1e')][_0x4eb7('0x12')]=function(_0x5f1711){if(_0x5f1711[_0x4eb7('0x1f')]===_0x4eb7('0x20')){for(var _0x3b6d41 in this[_0x4eb7('0xf')]){if(this[_0x4eb7('0xf')][_0x4eb7('0x21')](_0x3b6d41)){if(_0x5f1711[_0x4eb7('0x22')]===this[_0x4eb7('0xf')][_0x3b6d41]['localstationid']){this[_0x4eb7('0x23')][_0x5f1711[_0x4eb7('0x24')]]={};this[_0x4eb7('0x23')][_0x5f1711[_0x4eb7('0x24')]][_0x4eb7('0x25')]=_0x5f1711[_0x4eb7('0x25')];this[_0x4eb7('0x23')][_0x5f1711['uniqueid']]['id']=this[_0x4eb7('0xf')][_0x3b6d41]['id'];this[_0x4eb7('0x23')][_0x5f1711[_0x4eb7('0x24')]][_0x4eb7('0x26')]=this[_0x4eb7('0xf')][_0x3b6d41][_0x4eb7('0x26')];logger[_0x4eb7('0x27')](_0x5f1711[_0x4eb7('0x24')],_0x4eb7('0x28'));}}}}if(this[_0x4eb7('0x29')][_0x5f1711['uniqueid']]){this[_0x4eb7('0x23')][_0x5f1711[_0x4eb7('0x24')]]={};this[_0x4eb7('0x23')][_0x5f1711[_0x4eb7('0x24')]][_0x4eb7('0x25')]=_0x5f1711[_0x4eb7('0x25')];logger[_0x4eb7('0x27')](_0x5f1711[_0x4eb7('0x24')],_0x4eb7('0x28'));}};Fax[_0x4eb7('0x1e')][_0x4eb7('0x14')]=function(_0x2984b2){if(this[_0x4eb7('0x23')][_0x2984b2[_0x4eb7('0x24')]]){for(var _0x433794 in _0x2984b2[_0x4eb7('0x2a')]){if(_0x2984b2[_0x4eb7('0x2a')][_0x4eb7('0x21')](_0x433794)){this[_0x4eb7('0x23')][_0x2984b2[_0x4eb7('0x24')]][_0x433794]=_0x2984b2[_0x4eb7('0x2b')];}}}};Fax[_0x4eb7('0x1e')][_0x4eb7('0x16')]=function(_0x50209d){if(this[_0x4eb7('0x23')][_0x50209d['uniqueid']]){this[_0x4eb7('0x23')][_0x50209d[_0x4eb7('0x24')]][_0x4eb7('0x2c')]=_0x50209d[_0x4eb7('0x2c')];this[_0x4eb7('0x23')][_0x50209d[_0x4eb7('0x24')]][_0x4eb7('0x2d')]=_0x50209d[_0x4eb7('0x2d')];}};Fax[_0x4eb7('0x1e')]['syncNewExten']=function(_0x437964){if(this['channels'][_0x437964[_0x4eb7('0x24')]]){for(var _0x3f86b7 in _0x437964['variable']){if(_0x437964['variable'][_0x4eb7('0x21')](_0x3f86b7)){this[_0x4eb7('0x23')][_0x437964[_0x4eb7('0x24')]][_0x3f86b7]=_0x437964[_0x4eb7('0x2b')];}}}};Fax['prototype'][_0x4eb7('0x2e')]=function(_0x31b51d){if(this[_0x4eb7('0x23')][_0x31b51d[_0x4eb7('0x24')]]){this[_0x4eb7('0x23')][_0x31b51d['uniqueid']][_0x4eb7('0x2f')]=_0x31b51d[_0x4eb7('0x2f')];this[_0x4eb7('0x23')][_0x31b51d['uniqueid']][_0x4eb7('0x30')]=_0x31b51d[_0x4eb7('0x30')];this[_0x4eb7('0x23')][_0x31b51d['uniqueid']][_0x4eb7('0x31')]=_0x31b51d['localstationid'];this[_0x4eb7('0x23')][_0x31b51d[_0x4eb7('0x24')]][_0x4eb7('0x32')]=_0x31b51d[_0x4eb7('0x32')];logger['info'](_0x31b51d[_0x4eb7('0x24')],_0x4eb7('0x33'));}};Fax[_0x4eb7('0x1e')][_0x4eb7('0x19')]=function(_0x4f0cce){var _0x51a44b=this;if(this['channels'][_0x4f0cce[_0x4eb7('0x24')]]){var _0x398f63=this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]]['id'];this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]][_0x4eb7('0x34')]=_0x4f0cce[_0x4eb7('0x34')];this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]]['pagestransferred']=_0x4f0cce[_0x4eb7('0x35')];this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]][_0x4eb7('0x31')]=_0x4f0cce[_0x4eb7('0x31')];this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]][_0x4eb7('0x36')]=_0x4f0cce[_0x4eb7('0x36')];this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]][_0x4eb7('0x37')]=_0x4f0cce[_0x4eb7('0x37')];this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]][_0x4eb7('0x32')]=_0x4f0cce[_0x4eb7('0x32')];this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]][_0x4eb7('0x38')]=_0x4f0cce['calleridnum'];if(this[_0x4eb7('0x23')][_0x4f0cce[_0x4eb7('0x24')]][_0x4eb7('0x35')]>0x0){tiff2pdf(_0x4f0cce[_0x4eb7('0x32')],_0x4eb7('0x39'),function(_0x1c7bf1){logger[_0x4eb7('0x27')](_0x4f0cce[_0x4eb7('0x24')],_0x4eb7('0x3a'),_0x1c7bf1['message']);attachment[_0x4eb7('0x3b')]({'name':path['parse'](_0x4f0cce[_0x4eb7('0x32')])[_0x4eb7('0x26')],'basename':path[_0x4eb7('0x3c')](_0x4f0cce['filename'])[_0x4eb7('0x26')]+_0x4eb7('0x3d'),'type':_0x4eb7('0x3e')})[_0x4eb7('0x3f')](function(_0x489df6){faxAccount[_0x4eb7('0x40')](_0x398f63,{'from':_0x4f0cce['calleridnum'],'mapKey':_0x4eb7('0x8'),'body':path[_0x4eb7('0x3c')](_0x4f0cce[_0x4eb7('0x32')])[_0x4eb7('0x26')]+_0x4eb7('0x3d'),'AttachmentId':_0x489df6['id']})['catch'](function(_0x582ffb){logger[_0x4eb7('0x41')](_0x4f0cce[_0x4eb7('0x24')],_0x4eb7('0x42'),JSON[_0x4eb7('0x43')](_0x582ffb));});})[_0x4eb7('0x44')](function(_0x59f70e){logger[_0x4eb7('0x41')](_0x4f0cce[_0x4eb7('0x24')],'\x20receiveFax\x20',JSON[_0x4eb7('0x43')](_0x59f70e));});});}logger[_0x4eb7('0x27')](_0x4f0cce['uniqueid'],_0x4eb7('0x45'));}};Fax[_0x4eb7('0x1e')][_0x4eb7('0x1d')]=function(_0x5774d5){if(this[_0x4eb7('0x29')][_0x5774d5['uniqueid']]){_['merge'](this[_0x4eb7('0x23')][_0x5774d5[_0x4eb7('0x24')]],_[_0x4eb7('0x46')](_0x5774d5,[_0x4eb7('0x47'),_0x4eb7('0x48')]));}};function updateStatus(_0x2ca2c8){if(_0x2ca2c8[_0x4eb7('0x49')]){faxMessage[_0x4eb7('0x4a')](_0x2ca2c8[_0x4eb7('0x49')],{'failMessage':_0x4eb7('0x4b')})[_0x4eb7('0x3f')](function(_0x3c1ce0){ut[_0x4eb7('0x4c')](_0x4eb7('0x4d'),_0x3c1ce0);})[_0x4eb7('0x44')](function(_0x2e3105){ut[_0x4eb7('0x4c')](_0x4eb7('0x4e'),_0x2e3105);});}else{ut[_0x4eb7('0x4c')](_0x4eb7('0x4f'));}}Fax['prototype'][_0x4eb7('0x50')]=function(_0x550888,_0x4db5f7,_0x3f3a5f){var _0xa62776=this;var _0x1b7c76={};if(_0x4db5f7){_0x1b7c76={'read':_0x4db5f7};}else{_0x1b7c76={'failMessage':_0x3f3a5f};}if(this[_0x4eb7('0x29')][_0x550888][_0x4eb7('0x49')]){faxMessage['update'](this['actions'][_0x550888][_0x4eb7('0x49')],_0x1b7c76)['then'](function(_0x2f68a8){ut[_0x4eb7('0x4c')](_0x4eb7('0x51'),_0x2f68a8);})[_0x4eb7('0x44')](function(_0x5304e5){ut[_0x4eb7('0x4c')](_0x4eb7('0x52'),_0x5304e5);})[_0x4eb7('0x53')](function(){delete _0xa62776[_0x4eb7('0x23')][_0x550888];delete _0xa62776['actions'][_0x550888];});}else{ut[_0x4eb7('0x4c')](_0x4eb7('0x54'));delete this['channels'][_0x550888];delete this[_0x4eb7('0x29')][_0x550888];}};Fax[_0x4eb7('0x1e')]['syncHangup']=function(_0x24f36c){var _0x5058ef=this;if(this[_0x4eb7('0x23')][_0x24f36c['uniqueid']]){if(this[_0x4eb7('0x29')][_0x24f36c[_0x4eb7('0x24')]]){this[_0x4eb7('0x23')][_0x24f36c[_0x4eb7('0x24')]]['id']=this[_0x4eb7('0x29')][_0x24f36c[_0x4eb7('0x24')]]['id'];this['channels'][_0x24f36c['uniqueid']][_0x4eb7('0x26')]=this[_0x4eb7('0x29')][_0x24f36c[_0x4eb7('0x24')]][_0x4eb7('0x26')];}logger['info'](_0x24f36c[_0x4eb7('0x24')],this[_0x4eb7('0x29')][_0x24f36c['uniqueid']]?_0x4eb7('0x55'):_0x4eb7('0x56'),JSON[_0x4eb7('0x43')](this[_0x4eb7('0x23')][_0x24f36c[_0x4eb7('0x24')]]));if(this[_0x4eb7('0x29')][_0x24f36c[_0x4eb7('0x24')]]){if(this['channels'][_0x24f36c['uniqueid']][_0x4eb7('0x57')]>0x0&&this['channels'][_0x24f36c[_0x4eb7('0x24')]]['faxstatus']===_0x4eb7('0x58')){this['updateStatus'](_0x24f36c['uniqueid'],!![]);}else{this[_0x4eb7('0x50')](_0x24f36c[_0x4eb7('0x24')],![],this['channels'][_0x24f36c[_0x4eb7('0x24')]]['faxstatusstring']?_0x4eb7('0x59')+this[_0x4eb7('0x23')][_0x24f36c['uniqueid']][_0x4eb7('0x5a')]:_0x4eb7('0x5b'));}}}};Fax['prototype']['send']=function(_0x5c8d45){var _0x59e2f2=this;return new BPromise(function(_0xe2dfc9,_0x560ffc){_0x59e2f2[_0x4eb7('0x5c')](_0x5c8d45,_0x59e2f2[_0x4eb7('0xf')][_0x5c8d45['FaxAccountId']])[_0x4eb7('0x3f')](function(_0x4172cc){ut[_0x4eb7('0x4c')](_0x4eb7('0x5d'),_0x4172cc);_0xe2dfc9(ut[_0x4eb7('0x5e')](_0x4eb7('0x5f')));})['catch'](function(_0x4df132){ut['logger'](_0x4eb7('0x60'),_0x4df132);updateStatus(_0x5c8d45);_0x560ffc(ut[_0x4eb7('0x5e')](_0x4eb7('0x61')));});});};Fax[_0x4eb7('0x1e')][_0x4eb7('0x62')]=function(_0x4b0140){var _0x4be9e2=this;return new BPromise(function(_0x438fc2,_0x20c32e){var _0x3b0074=_0x4be9e2[_0x4eb7('0x63')](_0x4be9e2[_0x4eb7('0xf')][_0x4b0140['FaxAccountId']][_0x4eb7('0x64')],_0x4b0140);if(_0x3b0074[_0x4eb7('0x65')]){_0x438fc2(ut[_0x4eb7('0x5e')](_0x4eb7('0x66')));}else{_0x20c32e(ut['message'](_0x3b0074['message']));}});};function originate(_0x3bcbd1,_0x3883f3,_0x4e8125){return new BPromise(function(_0x1911ad,_0x4b698b){if(_0x4e8125){var _0x251aee=util[_0x4eb7('0x67')](_0x4eb7('0x68'),path[_0x4eb7('0x3c')](_0x3bcbd1['path'])[_0x4eb7('0x26')],_0x3bcbd1[_0x4eb7('0x5')]);gs[_0x4eb7('0x69')](_0x251aee)[_0x4eb7('0x3f')](function(){_0x3bcbd1[_0x4eb7('0x5')]=util[_0x4eb7('0x67')](_0x4eb7('0x6a'),path[_0x4eb7('0x3c')](_0x3bcbd1[_0x4eb7('0x5')])[_0x4eb7('0x6b')],path[_0x4eb7('0x3c')](_0x3bcbd1[_0x4eb7('0x5')])[_0x4eb7('0x26')]);_0x3883f3[_0x4eb7('0x6c')]=_0x3bcbd1[_0x4eb7('0x5')];ut[_0x4eb7('0x4c')](_0x4eb7('0x6d'),'');ami[_0x4eb7('0x6e')](ut[_0x4eb7('0x6f')](_0x3bcbd1,_0x3883f3))['then'](function(_0x51ce74){_0x1911ad(_0x51ce74);})[_0x4eb7('0x44')](function(_0x3a23c8){_0x4b698b(_0x3a23c8);});})[_0x4eb7('0x44')](function(_0x10099a){_0x4b698b(_0x10099a);});}else{ami[_0x4eb7('0x6e')](ut[_0x4eb7('0x6f')](_0x3bcbd1,_0x3883f3))[_0x4eb7('0x3f')](function(_0x2740e9){_0x1911ad(_0x2740e9);})['catch'](function(_0x3590a4){_0x4b698b(_0x3590a4);});}});}Fax[_0x4eb7('0x1e')][_0x4eb7('0x5c')]=function(_0x4e2f7c,_0x4f0874){var _0x1e34cc=this;return new BPromise(function(_0x47055e,_0xc4aa8b){var _0x48dc6f=uuid['v4']();var _0x4d0ac8=ut[_0x4eb7('0x70')](_0x4e2f7c,_0x4f0874);_0x1e34cc[_0x4eb7('0x29')][_0x48dc6f]=new Action(_0x48dc6f,_0x4f0874,_0x4e2f7c);var _0x4778f9=_0x1e34cc[_0x4eb7('0x29')][_0x48dc6f];if(path[_0x4eb7('0x3c')](_0x4e2f7c[_0x4eb7('0x5')])[_0x4eb7('0x71')]===_0x4eb7('0x3d')){originate(_0x4778f9,_0x4d0ac8,!![])[_0x4eb7('0x3f')](function(_0x2e531e){_0x47055e(_0x2e531e);})[_0x4eb7('0x44')](function(_0xd5f211){_0xc4aa8b(_0xd5f211);});}else{originate(_0x4778f9,_0x4d0ac8,![])['then'](function(_0x4bfc21){_0x47055e(_0x4bfc21);})[_0x4eb7('0x44')](function(_0x1ab17a){_0xc4aa8b(_0x1ab17a);});}});};Fax[_0x4eb7('0x1e')][_0x4eb7('0x72')]=function(_0x400b45){return!_[_0x4eb7('0x73')](_0x400b45)&&!_['isNil'](_0x400b45['name'])&&!_[_0x4eb7('0x73')](_0x400b45[_0x4eb7('0x74')])&&_0x400b45[_0x4eb7('0x74')]&&!_[_0x4eb7('0x73')](this[_0x4eb7('0x10')][util[_0x4eb7('0x67')](_0x4eb7('0x75'),_0x400b45[_0x4eb7('0x26')])])&&!_[_0x4eb7('0x73')](this[_0x4eb7('0x10')][util[_0x4eb7('0x67')](_0x4eb7('0x75'),_0x400b45[_0x4eb7('0x26')])][_0x4eb7('0x30')])&&(this['trunks'][util[_0x4eb7('0x67')](_0x4eb7('0x75'),_0x400b45[_0x4eb7('0x26')])][_0x4eb7('0x30')]==='reachable'||this[_0x4eb7('0x10')][util[_0x4eb7('0x67')]('SIP/%s',_0x400b45[_0x4eb7('0x26')])][_0x4eb7('0x30')]===_0x4eb7('0x76'));};Fax['prototype'][_0x4eb7('0x63')]=function(_0x36b121,_0x3e3831){if(!this['isTrunkReachable'](_0x36b121)){ut[_0x4eb7('0x4c')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x36b121)?'':_0x36b121[_0x4eb7('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4eb7('0x77')};}if(_['isNil'](_0x3e3831[_0x4eb7('0x8')])){ut[_0x4eb7('0x4c')](_0x4eb7('0x78'),JSON[_0x4eb7('0x43')](_0x3e3831));return{'isValid':![],'message':_0x4eb7('0x79')};}if(_[_0x4eb7('0x73')](_0x3e3831['path'])){ut[_0x4eb7('0x4c')](_0x4eb7('0x7a'),JSON[_0x4eb7('0x43')](_0x3e3831));return{'isValid':![],'message':_0x4eb7('0x7b')};}return{'isValid':!![],'message':_0x4eb7('0x7c')};};module[_0x4eb7('0x7d')]=Fax; \ No newline at end of file +var _0x4483=['catch','error','\x20notify\x20','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax'];(function(_0x338030,_0xa9177b){var _0xa6a557=function(_0x433669){while(--_0x433669){_0x338030['push'](_0x338030['shift']());}};_0xa6a557(++_0xa9177b);}(_0x4483,0x1a3));var _0x3448=function(_0x5e4cc1,_0x2b44bc){_0x5e4cc1=_0x5e4cc1-0x0;var _0x5a5365=_0x4483[_0x5e4cc1];return _0x5a5365;};'use strict';var util=require(_0x3448('0x0'));var _=require(_0x3448('0x1'));var BPromise=require(_0x3448('0x2'));var uuid=require('uuid');var moment=require(_0x3448('0x3'));var path=require(_0x3448('0x4'));var tiff2pdf=require(_0x3448('0x5'));var gs=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('fax');var ami=require(_0x3448('0x8'));var rpcDb=require(_0x3448('0x9'));var Channel=require(_0x3448('0xa'));var ut=require(_0x3448('0xb'));var Action=require(_0x3448('0xc'));var faxAccount=require(_0x3448('0xd'));var attachment=require(_0x3448('0xe'));var faxMessage=require(_0x3448('0xf'));function Fax(_0x5923ee){this['channels']={};this[_0x3448('0x10')]=_0x5923ee[_0x3448('0x10')];this[_0x3448('0x11')]=_0x5923ee[_0x3448('0x11')];this[_0x3448('0x12')]={};ami['on'](_0x3448('0x13'),this[_0x3448('0x14')][_0x3448('0x15')](this));ami['on'](_0x3448('0x16'),this[_0x3448('0x17')][_0x3448('0x15')](this));ami['on']('newstate',this['syncNewState'][_0x3448('0x15')](this));ami['on'](_0x3448('0x18'),this['syncNewExten'][_0x3448('0x15')](this));ami['on'](_0x3448('0x19'),this[_0x3448('0x1a')]['bind'](this));ami['on'](_0x3448('0x1b'),this[_0x3448('0x1c')]['bind'](this));ami['on'](_0x3448('0x1d'),this[_0x3448('0x1e')][_0x3448('0x15')](this));ami['on']('originateresponse',this[_0x3448('0x1f')][_0x3448('0x15')](this));}Fax[_0x3448('0x20')][_0x3448('0x14')]=function(_0x400af8){if(_0x400af8[_0x3448('0x21')]===_0x3448('0x22')){for(var _0x425514 in this['faxAccounts']){if(this[_0x3448('0x10')]['hasOwnProperty'](_0x425514)){if(_0x400af8['exten']===this['faxAccounts'][_0x425514][_0x3448('0x23')]){this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]={};this['channels'][_0x400af8[_0x3448('0x25')]][_0x3448('0x26')]=_0x400af8[_0x3448('0x26')];this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]['id']=this[_0x3448('0x10')][_0x425514]['id'];this['channels'][_0x400af8['uniqueid']]['name']=this[_0x3448('0x10')][_0x425514][_0x3448('0x27')];logger['info'](_0x400af8['uniqueid'],_0x3448('0x28'));}}}}if(this[_0x3448('0x12')][_0x400af8[_0x3448('0x25')]]){this[_0x3448('0x24')][_0x400af8[_0x3448('0x25')]]={};this['channels'][_0x400af8[_0x3448('0x25')]][_0x3448('0x26')]=_0x400af8[_0x3448('0x26')];logger[_0x3448('0x29')](_0x400af8[_0x3448('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x3448('0x20')][_0x3448('0x17')]=function(_0x52c163){if(this[_0x3448('0x24')][_0x52c163[_0x3448('0x25')]]){for(var _0x310912 in _0x52c163[_0x3448('0x2a')]){if(_0x52c163[_0x3448('0x2a')][_0x3448('0x2b')](_0x310912)){this[_0x3448('0x24')][_0x52c163[_0x3448('0x25')]][_0x310912]=_0x52c163['value'];}}}};Fax[_0x3448('0x20')][_0x3448('0x2c')]=function(_0xcfdc5){if(this['channels'][_0xcfdc5[_0x3448('0x25')]]){this['channels'][_0xcfdc5['uniqueid']]['channelstate']=_0xcfdc5[_0x3448('0x2d')];this[_0x3448('0x24')][_0xcfdc5['uniqueid']]['channelstatedesc']=_0xcfdc5[_0x3448('0x2e')];}};Fax[_0x3448('0x20')][_0x3448('0x2f')]=function(_0x1e99ff){if(this['channels'][_0x1e99ff[_0x3448('0x25')]]){for(var _0x3b6ff9 in _0x1e99ff[_0x3448('0x2a')]){if(_0x1e99ff['variable'][_0x3448('0x2b')](_0x3b6ff9)){this[_0x3448('0x24')][_0x1e99ff['uniqueid']][_0x3b6ff9]=_0x1e99ff['value'];}}}};Fax[_0x3448('0x20')][_0x3448('0x1a')]=function(_0x3c7eb1){if(this[_0x3448('0x24')][_0x3c7eb1['uniqueid']]){this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x30')]=_0x3c7eb1[_0x3448('0x30')];this['channels'][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x31')]=_0x3c7eb1['status'];this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x23')]=_0x3c7eb1[_0x3448('0x23')];this[_0x3448('0x24')][_0x3c7eb1[_0x3448('0x25')]][_0x3448('0x32')]=_0x3c7eb1[_0x3448('0x32')];logger[_0x3448('0x29')](_0x3c7eb1['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x3448('0x20')]['syncReceiveFax']=function(_0x22bb31){var _0x3048fa=this;if(this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]){var _0x5af6cd=this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['id'];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x33')]=_0x22bb31[_0x3448('0x33')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x34')]=_0x22bb31['pagestransferred'];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x23')]=_0x22bb31[_0x3448('0x23')];this[_0x3448('0x24')][_0x22bb31['uniqueid']][_0x3448('0x35')]=_0x22bb31[_0x3448('0x35')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x36')]=_0x22bb31[_0x3448('0x36')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['filename']=_0x22bb31[_0x3448('0x32')];this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]]['calleridnum']=_0x22bb31[_0x3448('0x37')];if(this[_0x3448('0x24')][_0x22bb31[_0x3448('0x25')]][_0x3448('0x34')]>0x0){tiff2pdf(_0x22bb31[_0x3448('0x32')],_0x3448('0x38'),function(_0x213065){logger['info'](_0x22bb31[_0x3448('0x25')],_0x3448('0x39'),_0x213065[_0x3448('0x3a')]);attachment[_0x3448('0x3b')]({'name':path[_0x3448('0x3c')](_0x22bb31[_0x3448('0x32')])['name'],'basename':path[_0x3448('0x3c')](_0x22bb31['filename'])['name']+_0x3448('0x3d'),'type':_0x3448('0x3e')})['then'](function(_0x3a700f){faxAccount[_0x3448('0x3f')](_0x5af6cd,{'from':_0x22bb31['calleridnum'],'mapKey':_0x3448('0x40'),'body':path[_0x3448('0x3c')](_0x22bb31['filename'])[_0x3448('0x27')]+_0x3448('0x3d'),'AttachmentId':_0x3a700f['id']})[_0x3448('0x41')](function(_0x2be597){logger[_0x3448('0x42')](_0x22bb31[_0x3448('0x25')],_0x3448('0x43'),JSON['stringify'](_0x2be597));});})['catch'](function(_0x38aca7){logger[_0x3448('0x42')](_0x22bb31[_0x3448('0x25')],_0x3448('0x44'),JSON['stringify'](_0x38aca7));});});}logger[_0x3448('0x29')](_0x22bb31[_0x3448('0x25')],_0x3448('0x44'));}};Fax[_0x3448('0x20')][_0x3448('0x1f')]=function(_0x5d942b){if(this[_0x3448('0x12')][_0x5d942b['uniqueid']]){_[_0x3448('0x45')](this[_0x3448('0x24')][_0x5d942b['uniqueid']],_[_0x3448('0x46')](_0x5d942b,[_0x3448('0x47'),_0x3448('0x48')]));}};function updateStatus(_0x19c283){if(_0x19c283[_0x3448('0x49')]){faxMessage[_0x3448('0x4a')](_0x19c283[_0x3448('0x49')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x3448('0x4b')](function(_0x9fbee8){ut['logger']('[Fax][Message][Error][Updated]',_0x9fbee8);})[_0x3448('0x41')](function(_0x3d6598){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x3d6598);});}else{ut[_0x3448('0x4c')](_0x3448('0x4d'));}}Fax[_0x3448('0x20')][_0x3448('0x4e')]=function(_0x176e60,_0x39db50,_0x2aea70){var _0x4c0053=this;var _0x5ee303={};if(_0x39db50){_0x5ee303={'read':_0x39db50};}else{_0x5ee303={'failMessage':_0x2aea70};}if(this['actions'][_0x176e60][_0x3448('0x49')]){faxMessage[_0x3448('0x4a')](this['actions'][_0x176e60][_0x3448('0x49')],_0x5ee303)[_0x3448('0x4b')](function(_0x5a4cde){ut[_0x3448('0x4c')](_0x3448('0x4f'),_0x5a4cde);})['catch'](function(_0x2afe2a){ut[_0x3448('0x4c')](_0x3448('0x50'),_0x2afe2a);})[_0x3448('0x51')](function(){delete _0x4c0053[_0x3448('0x24')][_0x176e60];delete _0x4c0053[_0x3448('0x12')][_0x176e60];});}else{ut[_0x3448('0x4c')](_0x3448('0x52'));delete this[_0x3448('0x24')][_0x176e60];delete this['actions'][_0x176e60];}};Fax[_0x3448('0x20')]['syncHangup']=function(_0x2991e8){var _0x108b99=this;if(this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]]){if(this[_0x3448('0x12')][_0x2991e8[_0x3448('0x25')]]){this['channels'][_0x2991e8[_0x3448('0x25')]]['id']=this['actions'][_0x2991e8[_0x3448('0x25')]]['id'];this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x27')]=this[_0x3448('0x12')][_0x2991e8['uniqueid']]['name'];}logger[_0x3448('0x29')](_0x2991e8[_0x3448('0x25')],this[_0x3448('0x12')][_0x2991e8['uniqueid']]?_0x3448('0x53'):_0x3448('0x54'),JSON[_0x3448('0x55')](this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]]));if(this[_0x3448('0x12')][_0x2991e8[_0x3448('0x25')]]){if(this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x56')]>0x0&&this[_0x3448('0x24')][_0x2991e8[_0x3448('0x25')]][_0x3448('0x19')]===_0x3448('0x57')){this[_0x3448('0x4e')](_0x2991e8[_0x3448('0x25')],!![]);}else{this[_0x3448('0x4e')](_0x2991e8[_0x3448('0x25')],![],this['channels'][_0x2991e8[_0x3448('0x25')]]['faxstatusstring']?_0x3448('0x58')+this['channels'][_0x2991e8[_0x3448('0x25')]][_0x3448('0x59')]:'SENDING\x20FAILED');}}}};Fax[_0x3448('0x20')][_0x3448('0x5a')]=function(_0x54cddd){var _0x4f6902=this;return new BPromise(function(_0x599350,_0x4864ae){_0x4f6902['execOriginate'](_0x54cddd,_0x4f6902[_0x3448('0x10')][_0x54cddd[_0x3448('0x5b')]])['then'](function(_0x5e1cbf){ut[_0x3448('0x4c')](_0x3448('0x5c'),_0x5e1cbf);_0x599350(ut[_0x3448('0x3a')](_0x3448('0x5d')));})[_0x3448('0x41')](function(_0x27003f){ut[_0x3448('0x4c')](_0x3448('0x5e'),_0x27003f);updateStatus(_0x54cddd);_0x4864ae(ut[_0x3448('0x3a')](_0x3448('0x5f')));});});};Fax[_0x3448('0x20')][_0x3448('0x60')]=function(_0x41f84c){var _0x387ab2=this;return new BPromise(function(_0x5476dd,_0x18c449){var _0x2dcf50=_0x387ab2['checkTrunk'](_0x387ab2[_0x3448('0x10')][_0x41f84c[_0x3448('0x5b')]]['Trunk'],_0x41f84c);if(_0x2dcf50[_0x3448('0x61')]){_0x5476dd(ut[_0x3448('0x3a')](_0x3448('0x62')));}else{_0x18c449(ut['message'](_0x2dcf50['message']));}});};function originate(_0x41d459,_0x489b70,_0x31dfc5){return new BPromise(function(_0x42c146,_0x5d952a){if(_0x31dfc5){var _0x50b81b=util[_0x3448('0x63')](_0x3448('0x64'),path[_0x3448('0x3c')](_0x41d459['path'])['name'],_0x41d459[_0x3448('0x4')]);gs[_0x3448('0x65')](_0x50b81b)[_0x3448('0x4b')](function(){_0x41d459[_0x3448('0x4')]=util[_0x3448('0x63')](_0x3448('0x66'),path['parse'](_0x41d459[_0x3448('0x4')])['dir'],path[_0x3448('0x3c')](_0x41d459[_0x3448('0x4')])['name']);_0x489b70[_0x3448('0x67')]=_0x41d459[_0x3448('0x4')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x3448('0x68')](ut[_0x3448('0x69')](_0x41d459,_0x489b70))[_0x3448('0x4b')](function(_0x392874){_0x42c146(_0x392874);})[_0x3448('0x41')](function(_0xfdd159){_0x5d952a(_0xfdd159);});})[_0x3448('0x41')](function(_0x29f39b){_0x5d952a(_0x29f39b);});}else{ami[_0x3448('0x68')](ut[_0x3448('0x69')](_0x41d459,_0x489b70))[_0x3448('0x4b')](function(_0xc0d8f1){_0x42c146(_0xc0d8f1);})[_0x3448('0x41')](function(_0x11d62f){_0x5d952a(_0x11d62f);});}});}Fax[_0x3448('0x20')][_0x3448('0x6a')]=function(_0x4cfab2,_0x4efd6c){var _0x42ac4f=this;return new BPromise(function(_0x4d2af5,_0x223a6b){var _0x155ee2=uuid['v4']();var _0x584229=ut[_0x3448('0x6b')](_0x4cfab2,_0x4efd6c);_0x42ac4f['actions'][_0x155ee2]=new Action(_0x155ee2,_0x4efd6c,_0x4cfab2);var _0x15d898=_0x42ac4f[_0x3448('0x12')][_0x155ee2];if(path[_0x3448('0x3c')](_0x4cfab2[_0x3448('0x4')])[_0x3448('0x6c')]==='.pdf'){originate(_0x15d898,_0x584229,!![])[_0x3448('0x4b')](function(_0x2e2b73){_0x4d2af5(_0x2e2b73);})[_0x3448('0x41')](function(_0x4aad6d){_0x223a6b(_0x4aad6d);});}else{originate(_0x15d898,_0x584229,![])[_0x3448('0x4b')](function(_0x15a3b2){_0x4d2af5(_0x15a3b2);})[_0x3448('0x41')](function(_0x5d14ac){_0x223a6b(_0x5d14ac);});}});};Fax[_0x3448('0x20')]['isTrunkReachable']=function(_0x48d320){return!_[_0x3448('0x6d')](_0x48d320)&&!_['isNil'](_0x48d320[_0x3448('0x27')])&&!_['isNil'](_0x48d320[_0x3448('0x6e')])&&_0x48d320[_0x3448('0x6e')]&&!_['isNil'](this['trunks'][util[_0x3448('0x63')](_0x3448('0x6f'),_0x48d320['name'])])&&!_[_0x3448('0x6d')](this[_0x3448('0x11')][util['format'](_0x3448('0x6f'),_0x48d320[_0x3448('0x27')])][_0x3448('0x31')])&&(this[_0x3448('0x11')][util['format'](_0x3448('0x6f'),_0x48d320['name'])][_0x3448('0x31')]==='reachable'||this[_0x3448('0x11')][util[_0x3448('0x63')](_0x3448('0x6f'),_0x48d320['name'])][_0x3448('0x31')]===_0x3448('0x70'));};Fax['prototype'][_0x3448('0x71')]=function(_0x51f6b0,_0x520950){if(!this[_0x3448('0x72')](_0x51f6b0)){ut['logger'](_0x3448('0x73'),_[_0x3448('0x6d')](_0x51f6b0)?'':_0x51f6b0[_0x3448('0x27')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x3448('0x74')};}if(_[_0x3448('0x6d')](_0x520950[_0x3448('0x40')])){ut[_0x3448('0x4c')](_0x3448('0x75'),JSON[_0x3448('0x55')](_0x520950));return{'isValid':![],'message':_0x3448('0x76')};}if(_[_0x3448('0x6d')](_0x520950[_0x3448('0x4')])){ut[_0x3448('0x4c')](_0x3448('0x77'),JSON[_0x3448('0x55')](_0x520950));return{'isValid':![],'message':_0x3448('0x78')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a208da4..79b5e3e 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 _0xe70c=['catch','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe70c,0x169));var _0xce70=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe70c[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xce70('0x0'));var BPromise=require('bluebird');var logger=require(_0xce70('0x1'))(_0xce70('0x2'));var _=require(_0xce70('0x3'));var faxAccount=require(_0xce70('0x4'));function loggerCatch(_0x574718){return function(_0x42adfe){logger[_0xce70('0x5')](_0x574718,util[_0xce70('0x6')](_0x42adfe,{'showHidden':![],'depth':null}));};}exports[_0xce70('0x7')]=function(_0x2cd623,_0x5799ff){return BPromise['resolve']()[_0xce70('0x8')](faxAccount[_0xce70('0x7')](_0x2cd623,_0x5799ff))[_0xce70('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xc840=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','error','inspect','notify','resolve'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xc840,0xac));var _0x0c84=function(_0x503068,_0x48513c){_0x503068=_0x503068-0x0;var _0xf5766c=_0xc840[_0x503068];return _0xf5766c;};'use strict';var util=require(_0x0c84('0x0'));var BPromise=require(_0x0c84('0x1'));var logger=require(_0x0c84('0x2'))(_0x0c84('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x428a5d){return function(_0x37ad10){logger[_0x0c84('0x4')](_0x428a5d,util[_0x0c84('0x5')](_0x37ad10,{'showHidden':![],'depth':null}));};}exports[_0x0c84('0x6')]=function(_0x3ac30b,_0x3280a7){return BPromise[_0x0c84('0x7')]()['then'](faxAccount[_0x0c84('0x6')](_0x3ac30b,_0x3280a7))[_0x0c84('0x8')](loggerCatch(_0x0c84('0x9')));}; \ 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 bae198f..baac089 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 _0xacad=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','info'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xacad,0x17f));var _0xdaca=function(_0x345252,_0x2b04f2){_0x345252=_0x345252-0x0;var _0x1ca41f=_0xacad[_0x345252];return _0x1ca41f;};'use strict';var util=require(_0xdaca('0x0'));var logger=require(_0xdaca('0x1'))(_0xdaca('0x2'));var BPromise=require(_0xdaca('0x3'));var exec=require(_0xdaca('0x4'))[_0xdaca('0x5')];exports['execute']=function(_0x5379b3){return new BPromise(function(_0x1bf86c,_0x4d071c){exec(_0x5379b3,function(_0x5d73e5,_0x3c4cdc,_0x230b8a){logger[_0xdaca('0x6')](_0xdaca('0x7'),_0x3c4cdc);if(_0x5d73e5){logger[_0xdaca('0x6')](_0xdaca('0x7'),_0xdaca('0x8'),util[_0xdaca('0x9')](_0x5d73e5,{'showHidden':![],'depth':null}),_0x3c4cdc,_0x230b8a);_0x4d071c(_0x5d73e5);}_0x1bf86c(_0x3c4cdc);});});}; \ No newline at end of file +var _0xcc28=['\x20Error\x20:','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc28,0x89));var _0x8cc2=function(_0x226546,_0x2131d1){_0x226546=_0x226546-0x0;var _0x2bb552=_0xcc28[_0x226546];return _0x2bb552;};'use strict';var util=require('util');var logger=require(_0x8cc2('0x0'))(_0x8cc2('0x1'));var BPromise=require(_0x8cc2('0x2'));var exec=require(_0x8cc2('0x3'))['exec'];exports[_0x8cc2('0x4')]=function(_0x32baad){return new BPromise(function(_0xd035f4,_0x2d158b){exec(_0x32baad,function(_0x27139e,_0x548828,_0x33b864){logger[_0x8cc2('0x5')](_0x8cc2('0x6'),_0x548828);if(_0x27139e){logger[_0x8cc2('0x5')](_0x8cc2('0x6'),_0x8cc2('0x7'),util['inspect'](_0x27139e,{'showHidden':![],'depth':null}),_0x548828,_0x33b864);_0x2d158b(_0x27139e);}_0xd035f4(_0x548828);});});}; \ 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 ec9ed3c..200cc55 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 _0xebe1=['from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','variablesAction','uniqueid','xcally-motion-fax'];(function(_0x202829,_0x4a90eb){var _0x3a9609=function(_0x541800){while(--_0x541800){_0x202829['push'](_0x202829['shift']());}};_0x3a9609(++_0x4a90eb);}(_0xebe1,0xf2));var _0x1ebe=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0xebe1[_0x5e77db];return _0x34b675;};'use strict';var util=require(_0x1ebe('0x0'));var _=require(_0x1ebe('0x1'));var moment=require(_0x1ebe('0x2'));var logger=require(_0x1ebe('0x3'))('fax');exports['message']=function(_0x3531c1){return{'message':_0x3531c1};};exports['logger']=function(_0x2d2394,_0xb499e4){logger['info'](_0x2d2394,util[_0x1ebe('0x4')](_0xb499e4,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x47e3ac,_0x2bac29){var _0x289817={'XMF-ECM':_0x2bac29[_0x1ebe('0x5')],'XMF-HEADERINFO':_0x2bac29[_0x1ebe('0x6')],'XMF-MINRATE':_0x2bac29[_0x1ebe('0x7')],'XMF-MAXRATE':_0x2bac29[_0x1ebe('0x8')],'XMF-MODEM':util[_0x1ebe('0x9')](_0x1ebe('0xa'),_0x2bac29[_0x1ebe('0xb')]),'XMF-GATEWAY':_0x2bac29[_0x1ebe('0xc')],'XMF-FAXDETECT':_0x2bac29['faxdetect'],'XMF-T38TIMEOUT':_0x2bac29[_0x1ebe('0xd')],'XMF-LOCALSTATIONID':_0x2bac29[_0x1ebe('0xe')],'XMF-PATH':_0x47e3ac['path']};return _0x289817;};exports[_0x1ebe('0xf')]=function(_0x15f2ea,_0x26dd88){return{'actionid':_0x15f2ea[_0x1ebe('0x10')],'action':'originate','channel':_0x15f2ea['channel'],'Exten':_0x1ebe('0x11'),'Context':_0x1ebe('0x12'),'Priority':'1','callerid':util[_0x1ebe('0x9')](_0x1ebe('0x13'),_0x15f2ea[_0x1ebe('0x6')]?_0x15f2ea[_0x1ebe('0x6')]:'',_0x15f2ea[_0x1ebe('0xe')]),'variable':_0x26dd88,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x15f2ea[_0x1ebe('0x10')]};}; \ No newline at end of file +var _0xe199=['logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','fax','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe199,0x10f));var _0x9e19=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0xe199[_0x54fbff];return _0x5cf619;};'use strict';var util=require('util');var _=require(_0x9e19('0x0'));var moment=require(_0x9e19('0x1'));var logger=require('../../../../config/logger')(_0x9e19('0x2'));exports[_0x9e19('0x3')]=function(_0x2fd464){return{'message':_0x2fd464};};exports[_0x9e19('0x4')]=function(_0x248799,_0x246dbc){logger[_0x9e19('0x5')](_0x248799,util[_0x9e19('0x6')](_0x246dbc,{'showHidden':![],'depth':null}));};exports[_0x9e19('0x7')]=function(_0x23782f,_0x21930a){var _0x4a38ad={'XMF-ECM':_0x21930a[_0x9e19('0x8')],'XMF-HEADERINFO':_0x21930a[_0x9e19('0x9')],'XMF-MINRATE':_0x21930a[_0x9e19('0xa')],'XMF-MAXRATE':_0x21930a[_0x9e19('0xb')],'XMF-MODEM':util[_0x9e19('0xc')](_0x9e19('0xd'),_0x21930a[_0x9e19('0xe')]),'XMF-GATEWAY':_0x21930a[_0x9e19('0xf')],'XMF-FAXDETECT':_0x21930a['faxdetect'],'XMF-T38TIMEOUT':_0x21930a[_0x9e19('0x10')],'XMF-LOCALSTATIONID':_0x21930a[_0x9e19('0x11')],'XMF-PATH':_0x23782f[_0x9e19('0x12')]};return _0x4a38ad;};exports[_0x9e19('0x13')]=function(_0x4b7549,_0x5aa3b2){return{'actionid':_0x4b7549[_0x9e19('0x14')],'action':_0x9e19('0x15'),'channel':_0x4b7549['channel'],'Exten':_0x9e19('0x16'),'Context':_0x9e19('0x17'),'Priority':'1','callerid':util['format'](_0x9e19('0x18'),_0x4b7549[_0x9e19('0x9')]?_0x4b7549[_0x9e19('0x9')]:'',_0x4b7549['localstationid']),'variable':_0x5aa3b2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4b7549['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index eda6ad1..dd4370e 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 _0xaec2=['getVoiceCallReports','catch','inspect','listen','error','bluebird','util','./server','./realtime','./report','./acw','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory'];(function(_0xfbb757,_0x1eea0b){var _0x12972=function(_0x342eac){while(--_0x342eac){_0xfbb757['push'](_0xfbb757['shift']());}};_0x12972(++_0x1eea0b);}(_0xaec2,0x145));var _0x2aec=function(_0x3c0e33,_0x4e9903){_0x3c0e33=_0x3c0e33-0x0;var _0x48d10c=_0xaec2[_0x3c0e33];return _0x48d10c;};'use strict';var BPromise=require(_0x2aec('0x0'));var util=require(_0x2aec('0x1'));var moment=require('moment');var server=require(_0x2aec('0x2'));var Realtime=require(_0x2aec('0x3'));var Report=require(_0x2aec('0x4'));var Acw=require(_0x2aec('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x2aec('0x6'));var Preview=require('./preview');var Fax=require(_0x2aec('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x2aec('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x2aec('0x9'));var trunk=require(_0x2aec('0xa'));var trigger=require(_0x2aec('0xb'));var template=require(_0x2aec('0xc'));var cmHopperHistory=require(_0x2aec('0xd'));var campaign=require(_0x2aec('0xe'));var voiceExtension=require(_0x2aec('0xf'));var faxAccount=require(_0x2aec('0x10'));var zendesk=require(_0x2aec('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x2aec('0x12'));var freshdesk=require(_0x2aec('0x13'));var desk=require(_0x2aec('0x14'));var zoho=require(_0x2aec('0x15'));var vtiger=require(_0x2aec('0x16'));var freshsales=require(_0x2aec('0x17'));var servicenow=require(_0x2aec('0x18'));var dynamics365=require(_0x2aec('0x19'));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(_0x2aec('0x1a'))(_0x2aec('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2aec('0x1c')](_0x2aec('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2aec('0x1c')](_0x2aec('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x2aec('0x1e')]()[_0x2aec('0x1f')](user['getAgents']())[_0x2aec('0x1f')](realtime['initAgents']())[_0x2aec('0x1f')](user['getTelephones']())[_0x2aec('0x1f')](realtime['initTelephones']())[_0x2aec('0x1f')](trunk[_0x2aec('0x20')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x21')]())[_0x2aec('0x1f')](voiceQueue[_0x2aec('0x22')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x23')]())[_0x2aec('0x1f')](trigger['getTriggers']())[_0x2aec('0x1f')](realtime[_0x2aec('0x24')]())[_0x2aec('0x1f')](template[_0x2aec('0x25')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x26')]())[_0x2aec('0x1f')](zendesk['getZendeskAccounts']())[_0x2aec('0x1f')](realtime[_0x2aec('0x27')]())['then'](salesforce[_0x2aec('0x28')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x29')]())[_0x2aec('0x1f')](sugarcrm['getSugarcrmAccounts']())[_0x2aec('0x1f')](realtime['initSugarcrmAccounts']())[_0x2aec('0x1f')](freshdesk[_0x2aec('0x2a')]())['then'](realtime['initFreshdeskAccounts']())[_0x2aec('0x1f')](desk[_0x2aec('0x2b')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x2c')]())['then'](zoho['getZohoAccounts']())[_0x2aec('0x1f')](realtime[_0x2aec('0x2d')]())[_0x2aec('0x1f')](vtiger['getVtigerAccounts']())[_0x2aec('0x1f')](realtime[_0x2aec('0x2e')]())['then'](freshsales[_0x2aec('0x2f')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x30')]())['then'](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())[_0x2aec('0x1f')](dynamics365[_0x2aec('0x31')]())['then'](realtime[_0x2aec('0x32')]())['then'](campaign['getCampaigns']())[_0x2aec('0x1f')](realtime[_0x2aec('0x33')]())[_0x2aec('0x1f')](voiceExtension[_0x2aec('0x34')]())[_0x2aec('0x1f')](realtime['initVoiceExtensions']())[_0x2aec('0x1f')](faxAccount[_0x2aec('0x35')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x36')]())[_0x2aec('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x2aec('0x1e')]()[_0x2aec('0x1f')](voiceQueueReport[_0x2aec('0x37')]())[_0x2aec('0x1f')](realtime[_0x2aec('0x38')]())['then'](cmHopperHistory[_0x2aec('0x39')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x2aec('0x1f')](cmHopperHistory['getCampaignHopperHistory']())[_0x2aec('0x1f')](realtime[_0x2aec('0x3a')]())[_0x2aec('0x1f')](voiceCallReport[_0x2aec('0x3b')]())[_0x2aec('0x1f')](realtime['initVoiceCallReports']())[_0x2aec('0x3c')](function(_0x269a05){logger['error']('[index.js][initParams]',util[_0x2aec('0x3d')](_0x269a05,{'showHidden':![],'depth':null}));});}function main(){return server[_0x2aec('0x3e')](realtime,preview,fax)[_0x2aec('0x1f')](function(_0x279bf0){return initRealtime();})['then'](function(){return initParams();})[_0x2aec('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x2aec('0x3c')](function(_0x4b7b29){logger[_0x2aec('0x3f')]('[index.js][main]',util[_0x2aec('0x3d')](_0x4b7b29,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x4a5c=['getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','inspect','sync','catch','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x4a5c,0x1c5));var _0xc4a5=function(_0x4aca28,_0x4ab42c){_0x4aca28=_0x4aca28-0x0;var _0x1946a0=_0x4a5c[_0x4aca28];return _0x1946a0;};'use strict';var BPromise=require('bluebird');var util=require(_0xc4a5('0x0'));var moment=require(_0xc4a5('0x1'));var server=require(_0xc4a5('0x2'));var Realtime=require(_0xc4a5('0x3'));var Report=require(_0xc4a5('0x4'));var Acw=require(_0xc4a5('0x5'));var Trigger=require(_0xc4a5('0x6'));var Dialer=require(_0xc4a5('0x7'));var Preview=require(_0xc4a5('0x8'));var Fax=require('./fax');var user=require(_0xc4a5('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc4a5('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xc4a5('0xb'));var template=require(_0xc4a5('0xc'));var cmHopperHistory=require(_0xc4a5('0xd'));var campaign=require(_0xc4a5('0xe'));var voiceExtension=require(_0xc4a5('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xc4a5('0x10'));var salesforce=require(_0xc4a5('0x11'));var sugarcrm=require(_0xc4a5('0x12'));var freshdesk=require(_0xc4a5('0x13'));var desk=require(_0xc4a5('0x14'));var zoho=require(_0xc4a5('0x15'));var vtiger=require(_0xc4a5('0x16'));var freshsales=require(_0xc4a5('0x17'));var servicenow=require(_0xc4a5('0x18'));var dynamics365=require(_0xc4a5('0x19'));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(_0xc4a5('0x1a'))(_0xc4a5('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc4a5('0x1c')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc4a5('0x1c')](_0xc4a5('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0xc4a5('0x1e')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x20')]())[_0xc4a5('0x1f')](user[_0xc4a5('0x21')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x22')]())[_0xc4a5('0x1f')](trunk[_0xc4a5('0x23')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x24')]())[_0xc4a5('0x1f')](voiceQueue[_0xc4a5('0x25')]())['then'](realtime[_0xc4a5('0x26')]())['then'](trigger[_0xc4a5('0x27')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x28')]())[_0xc4a5('0x1f')](template[_0xc4a5('0x29')]())[_0xc4a5('0x1f')](realtime['initTemplates']())[_0xc4a5('0x1f')](zendesk[_0xc4a5('0x2a')]())['then'](realtime['initZendeskAccounts']())[_0xc4a5('0x1f')](salesforce[_0xc4a5('0x2b')]())[_0xc4a5('0x1f')](realtime['initSalesforceAccounts']())[_0xc4a5('0x1f')](sugarcrm[_0xc4a5('0x2c')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x2d')]())[_0xc4a5('0x1f')](freshdesk['getFreshdeskAccounts']())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x2e')]())[_0xc4a5('0x1f')](desk[_0xc4a5('0x2f')]())[_0xc4a5('0x1f')](realtime['initDeskAccounts']())[_0xc4a5('0x1f')](zoho[_0xc4a5('0x30')]())['then'](realtime[_0xc4a5('0x31')]())['then'](vtiger[_0xc4a5('0x32')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x33')]())['then'](freshsales[_0xc4a5('0x34')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x35')]())[_0xc4a5('0x1f')](servicenow[_0xc4a5('0x36')]())[_0xc4a5('0x1f')](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x37')]())[_0xc4a5('0x1f')](campaign['getCampaigns']())['then'](realtime[_0xc4a5('0x38')]())[_0xc4a5('0x1f')](voiceExtension['getVoiceExtensions']())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x39')]())[_0xc4a5('0x1f')](faxAccount[_0xc4a5('0x3a')]())['then'](realtime[_0xc4a5('0x3b')]())[_0xc4a5('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0xc4a5('0x3c')]()['then'](voiceQueueReport[_0xc4a5('0x3d')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x3e')]())[_0xc4a5('0x1f')](cmHopperHistory[_0xc4a5('0x3f')]())[_0xc4a5('0x1f')](realtime[_0xc4a5('0x40')]())[_0xc4a5('0x1f')](cmHopperHistory[_0xc4a5('0x41')]())['then'](realtime[_0xc4a5('0x42')]())[_0xc4a5('0x1f')](voiceCallReport[_0xc4a5('0x43')]())[_0xc4a5('0x1f')](realtime['initVoiceCallReports']())['catch'](function(_0xbf752d){logger[_0xc4a5('0x44')](_0xc4a5('0x45'),util[_0xc4a5('0x46')](_0xbf752d,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x487320){return initRealtime();})[_0xc4a5('0x1f')](function(){return initParams();})[_0xc4a5('0x1f')](function(){report[_0xc4a5('0x47')]();setInterval(initRealtime,0x1388);})[_0xc4a5('0x48')](function(_0x442bdd){logger[_0xc4a5('0x44')](_0xc4a5('0x49'),util[_0xc4a5('0x46')](_0x442bdd,{'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 b8f5c5c..6422f3b 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x38ae4f,_0x1d3180){var _0x1e92db=function(_0x1a1cb9){while(--_0x1a1cb9){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x1e92db(++_0x1d3180);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x174282,_0x5437f1){var _0x572032=function(_0x598bbb){while(--_0x598bbb){_0x174282['push'](_0x174282['shift']());}};_0x572032(++_0x5437f1);}(_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 md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('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 0ce02f1..0a511ab 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 _0x3b68=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x3c0874,_0x5c2663){var _0x402eb6=function(_0xde5972){while(--_0xde5972){_0x3c0874['push'](_0x3c0874['shift']());}};_0x402eb6(++_0x5c2663);}(_0x3b68,0x18e));var _0x83b6=function(_0x4d22a4,_0x4e4ada){_0x4d22a4=_0x4d22a4-0x0;var _0x52ccf0=_0x3b68[_0x4d22a4];return _0x52ccf0;};'use strict';function Campaign(_0x166d6d){this['id']=_0x166d6d['id']||0x0;this[_0x83b6('0x0')]=_0x166d6d[_0x83b6('0x0')]||'';this['type']=_0x166d6d[_0x83b6('0x1')]||_0x83b6('0x2');this[_0x83b6('0x3')]=0x0;this[_0x83b6('0x4')]=0x0;this[_0x83b6('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x83b6('0x6')]=!![];this[_0x83b6('0x7')]=_0x166d6d['active'];this[_0x83b6('0x8')]=_0x166d6d[_0x83b6('0x8')];this[_0x83b6('0x9')]=_0x166d6d['dialTimezone']||null;this[_0x83b6('0xa')]=_0x166d6d[_0x83b6('0xa')]?_0x166d6d[_0x83b6('0xa')]:null;this[_0x83b6('0xb')]=_0x166d6d['dialOriginateCallerIdName'];this[_0x83b6('0xc')]=_0x166d6d[_0x83b6('0xc')];this[_0x83b6('0xd')]=_0x166d6d[_0x83b6('0xd')]||0x1e;this[_0x83b6('0xe')]=_0x166d6d[_0x83b6('0xe')];this[_0x83b6('0xf')]=_0x166d6d['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x166d6d[_0x83b6('0x10')];this[_0x83b6('0x11')]=_0x166d6d['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x166d6d[_0x83b6('0x12')];this[_0x83b6('0x13')]=_0x166d6d[_0x83b6('0x13')];this['dialGlobalMaxRetry']=_0x166d6d[_0x83b6('0x14')];this[_0x83b6('0x15')]=_0x166d6d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x166d6d[_0x83b6('0x16')]||0x96;this[_0x83b6('0x17')]=_0x166d6d[_0x83b6('0x17')]||0x3;this[_0x83b6('0x18')]=_0x166d6d['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x166d6d['dialAbandonedMaxRetry']||0x3;this[_0x83b6('0x19')]=_0x166d6d['dialAbandonedRetryFrequency']||0x96;this[_0x83b6('0x1a')]=_0x166d6d[_0x83b6('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x166d6d['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x166d6d[_0x83b6('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x166d6d['dialAgentRejectRetryFrequency']||0x96;this[_0x83b6('0x1c')]=_0x166d6d[_0x83b6('0x1c')]||_0x83b6('0x1d');this['dialPrefix']=_0x166d6d[_0x83b6('0x1e')]||undefined;this[_0x83b6('0x1f')]=_0x166d6d[_0x83b6('0x1f')]||undefined;this[_0x83b6('0x20')]=_0x166d6d[_0x83b6('0x20')]||undefined;this[_0x83b6('0x21')]=_0x166d6d[_0x83b6('0x21')]?_0x166d6d['TrunkBackup']:undefined;this['Trunk']=_0x166d6d['Trunk']?_0x166d6d[_0x83b6('0x22')]:undefined;this[_0x83b6('0x23')]=_0x166d6d['Interval']?_0x166d6d['Interval']:undefined;this[_0x83b6('0x24')]=_0x166d6d[_0x83b6('0x24')]?_0x166d6d[_0x83b6('0x24')]:undefined;this[_0x83b6('0x25')]=_0x166d6d[_0x83b6('0x24')]?_0x166d6d[_0x83b6('0x24')][_0x83b6('0x0')]:undefined;this[_0x83b6('0x26')]=_0x166d6d[_0x83b6('0x26')]||![];this[_0x83b6('0x27')]=_0x166d6d[_0x83b6('0x27')];this[_0x83b6('0x28')]=_0x166d6d[_0x83b6('0x28')];this[_0x83b6('0x29')]=_0x166d6d[_0x83b6('0x29')];this['dialAMDTotalAnalysisTime']=_0x166d6d[_0x83b6('0x2a')];this[_0x83b6('0x2b')]=_0x166d6d[_0x83b6('0x2b')];this[_0x83b6('0x2c')]=_0x166d6d[_0x83b6('0x2c')];this[_0x83b6('0x2d')]=_0x166d6d[_0x83b6('0x2d')];this[_0x83b6('0x2e')]=_0x166d6d[_0x83b6('0x2e')];this[_0x83b6('0x2f')]=_0x166d6d[_0x83b6('0x2f')];}module[_0x83b6('0x30')]=Campaign; \ No newline at end of file +var _0x8e67=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x1ab683,_0x27030b){var _0x357546=function(_0x29a6b0){while(--_0x29a6b0){_0x1ab683['push'](_0x1ab683['shift']());}};_0x357546(++_0x27030b);}(_0x8e67,0x19b));var _0x78e6=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x8e67[_0x2ae2ad];return _0x26dbd7;};'use strict';function Campaign(_0x189d38){this['id']=_0x189d38['id']||0x0;this[_0x78e6('0x0')]=_0x189d38[_0x78e6('0x0')]||'';this['type']=_0x189d38['type']||_0x78e6('0x1');this['originated']=0x0;this[_0x78e6('0x2')]=0x0;this[_0x78e6('0x3')]=0x0;this[_0x78e6('0x4')]=0x0;this[_0x78e6('0x5')]='';this[_0x78e6('0x6')]=!![];this[_0x78e6('0x7')]=_0x189d38[_0x78e6('0x7')];this[_0x78e6('0x8')]=_0x189d38['limitCalls'];this[_0x78e6('0x9')]=_0x189d38[_0x78e6('0x9')]||null;this['dialGlobalInterval']=_0x189d38['dialGlobalInterval']?_0x189d38[_0x78e6('0xa')]:null;this[_0x78e6('0xb')]=_0x189d38['dialOriginateCallerIdName'];this[_0x78e6('0xc')]=_0x189d38[_0x78e6('0xc')];this[_0x78e6('0xd')]=_0x189d38['dialOriginateTimeout']||0x1e;this[_0x78e6('0xe')]=_0x189d38[_0x78e6('0xe')];this[_0x78e6('0xf')]=_0x189d38['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x189d38[_0x78e6('0x10')];this[_0x78e6('0x11')]=_0x189d38[_0x78e6('0x11')];this['dialNoAnswerMaxRetry']=_0x189d38[_0x78e6('0x12')];this[_0x78e6('0x13')]=_0x189d38[_0x78e6('0x13')];this[_0x78e6('0x14')]=_0x189d38['dialGlobalMaxRetry'];this[_0x78e6('0x15')]=_0x189d38[_0x78e6('0x15')]||0x3;this[_0x78e6('0x16')]=_0x189d38[_0x78e6('0x16')]||0x96;this['dialDropMaxRetry']=_0x189d38[_0x78e6('0x17')]||0x3;this[_0x78e6('0x18')]=_0x189d38[_0x78e6('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x189d38['dialAbandonedMaxRetry']||0x3;this[_0x78e6('0x19')]=_0x189d38[_0x78e6('0x19')]||0x96;this[_0x78e6('0x1a')]=_0x189d38['dialMachineMaxRetry']||0x3;this[_0x78e6('0x1b')]=_0x189d38['dialMachineRetryFrequency']||0x96;this[_0x78e6('0x1c')]=_0x189d38[_0x78e6('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x189d38['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x189d38['dialOrderByScheduledAt']||'DESC';this[_0x78e6('0x1d')]=_0x189d38[_0x78e6('0x1d')]||undefined;this[_0x78e6('0x1e')]=_0x189d38['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x189d38[_0x78e6('0x1f')]||undefined;this[_0x78e6('0x20')]=_0x189d38[_0x78e6('0x20')]?_0x189d38[_0x78e6('0x20')]:undefined;this[_0x78e6('0x21')]=_0x189d38[_0x78e6('0x21')]?_0x189d38[_0x78e6('0x21')]:undefined;this[_0x78e6('0x22')]=_0x189d38[_0x78e6('0x22')]?_0x189d38[_0x78e6('0x22')]:undefined;this[_0x78e6('0x23')]=_0x189d38['SquareProject']?_0x189d38[_0x78e6('0x23')]:undefined;this[_0x78e6('0x24')]=_0x189d38[_0x78e6('0x23')]?_0x189d38[_0x78e6('0x23')]['name']:undefined;this[_0x78e6('0x25')]=_0x189d38['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x189d38[_0x78e6('0x26')];this[_0x78e6('0x27')]=_0x189d38['dialAMDGreeting'];this[_0x78e6('0x28')]=_0x189d38[_0x78e6('0x28')];this[_0x78e6('0x29')]=_0x189d38[_0x78e6('0x29')];this[_0x78e6('0x2a')]=_0x189d38['dialAMDMinWordLength'];this[_0x78e6('0x2b')]=_0x189d38[_0x78e6('0x2b')];this[_0x78e6('0x2c')]=_0x189d38['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x189d38[_0x78e6('0x2d')];this['dialAMDMaximumWordLength']=_0x189d38[_0x78e6('0x2e')];}module[_0x78e6('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f47b504..eedcb0d 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 _0x6200=['context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','type','tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','starttime','channel','calleridnum','connectedlinenum','connectedlinename','accountcode'];(function(_0x3a0f09,_0x4f981b){var _0x46c463=function(_0x478914){while(--_0x478914){_0x3a0f09['push'](_0x3a0f09['shift']());}};_0x46c463(++_0x4f981b);}(_0x6200,0x192));var _0x0620=function(_0x2cefc5,_0x108d4e){_0x2cefc5=_0x2cefc5-0x0;var _0x5f39ce=_0x6200[_0x2cefc5];return _0x5f39ce;};'use strict';function Channel(){this[_0x0620('0x0')]=null;this[_0x0620('0x1')]='';this['destinationchannel']='';this[_0x0620('0x2')]=0x0;this['calleridname']='';this[_0x0620('0x3')]=undefined;this[_0x0620('0x4')]=undefined;this[_0x0620('0x5')]=0x0;this[_0x0620('0x6')]='';this[_0x0620('0x7')]=0x0;this['linkedid']=0x0;this[_0x0620('0x8')]=0x0;this[_0x0620('0x9')]=![];this['answertime']=null;this[_0x0620('0xa')]=null;this[_0x0620('0xb')]=![];this[_0x0620('0xc')]=![];this[_0x0620('0xd')]='';this[_0x0620('0xe')]='';this[_0x0620('0xf')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x0620('0x10')]=null;this[_0x0620('0x11')]=null;this[_0x0620('0x12')]=null;this[_0x0620('0x13')]=![];this['monitorFilename']=null;this[_0x0620('0x14')]=null;this['monitors']=[];this[_0x0620('0x15')]=undefined;this[_0x0620('0x16')]=undefined;this[_0x0620('0x17')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x87bc=['answertime','endtime','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferType','mohtime','exports','starttime','channel','calleridnum','connectedlinename','context','answered'];(function(_0x2fce12,_0x2ecfcb){var _0x2d6be6=function(_0xf3835){while(--_0xf3835){_0x2fce12['push'](_0x2fce12['shift']());}};_0x2d6be6(++_0x2ecfcb);}(_0x87bc,0x189));var _0xc87b=function(_0x5e9119,_0x6b51cb){_0x5e9119=_0x5e9119-0x0;var _0x2b0797=_0x87bc[_0x5e9119];return _0x2b0797;};'use strict';function Channel(){this[_0xc87b('0x0')]=null;this[_0xc87b('0x1')]='';this['destinationchannel']='';this[_0xc87b('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xc87b('0x3')]=undefined;this['accountcode']=0x0;this[_0xc87b('0x4')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0xc87b('0x5')]=![];this[_0xc87b('0x6')]=null;this[_0xc87b('0x7')]=null;this['unmanaged']=![];this['abandoned']=![];this['lastapplication']='';this[_0xc87b('0x8')]='';this[_0xc87b('0x9')]=0x0;this[_0xc87b('0xa')]=0x0;this[_0xc87b('0xb')]=0x0;this[_0xc87b('0xc')]=null;this[_0xc87b('0xd')]=null;this[_0xc87b('0xe')]=null;this[_0xc87b('0xf')]=![];this[_0xc87b('0x10')]=null;this['queue']=null;this['monitors']=[];this[_0xc87b('0x11')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc87b('0x12')]=undefined;this[_0xc87b('0x13')]=0x0;}module[_0xc87b('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 6e864b9..5a5af1a 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 _0xa53b=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x5dea3e,_0x222ecd){var _0x2e0c7e=function(_0x364dcb){while(--_0x364dcb){_0x5dea3e['push'](_0x5dea3e['shift']());}};_0x2e0c7e(++_0x222ecd);}(_0xa53b,0x160));var _0xba53=function(_0x26e04a,_0x46e75e){_0x26e04a=_0x26e04a-0x0;var _0x59d643=_0xa53b[_0x26e04a];return _0x59d643;};'use strict';function DeskAccount(_0x5a1ec3){this['id']=_0x5a1ec3['id']||0x0;this[_0xba53('0x0')]=_0x5a1ec3[_0xba53('0x0')]||'';this[_0xba53('0x1')]=_0x5a1ec3[_0xba53('0x1')]||'';this[_0xba53('0x2')]=_0x5a1ec3[_0xba53('0x2')]||'';this[_0xba53('0x3')]=_0x5a1ec3[_0xba53('0x3')]||'';this[_0xba53('0x4')]=_0x5a1ec3['password']||'';this[_0xba53('0x5')]=_0x5a1ec3[_0xba53('0x5')]||'';this[_0xba53('0x6')]=_0x5a1ec3['consumerSecret']||'';this[_0xba53('0x7')]=_0x5a1ec3[_0xba53('0x7')]||'';this[_0xba53('0x8')]=_0x5a1ec3['tokenSecret']||'';this[_0xba53('0x9')]=_0x5a1ec3['type']||'';this[_0xba53('0xa')]=_0x5a1ec3[_0xba53('0xa')]||'';this[_0xba53('0xb')]=_0x5a1ec3['Configurations']||{};}module[_0xba53('0xc')]=DeskAccount; \ No newline at end of file +var _0x94c2=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x37d077,_0x3ca085){var _0x4c76ec=function(_0xe70c75){while(--_0xe70c75){_0x37d077['push'](_0x37d077['shift']());}};_0x4c76ec(++_0x3ca085);}(_0x94c2,0x118));var _0x294c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x94c2[_0x4b369d];return _0x571a98;};'use strict';function DeskAccount(_0x3c9232){this['id']=_0x3c9232['id']||0x0;this[_0x294c('0x0')]=_0x3c9232[_0x294c('0x0')]||'';this['username']=_0x3c9232[_0x294c('0x1')]||'';this[_0x294c('0x2')]=_0x3c9232[_0x294c('0x2')]||'';this[_0x294c('0x3')]=_0x3c9232[_0x294c('0x3')]||'';this[_0x294c('0x4')]=_0x3c9232[_0x294c('0x4')]||'';this['consumerKey']=_0x3c9232[_0x294c('0x5')]||'';this[_0x294c('0x6')]=_0x3c9232[_0x294c('0x6')]||'';this['token']=_0x3c9232[_0x294c('0x7')]||'';this[_0x294c('0x8')]=_0x3c9232['tokenSecret']||'';this['type']=_0x3c9232[_0x294c('0x9')]||'';this[_0x294c('0xa')]=_0x3c9232['serverUrl']||'';this[_0x294c('0xb')]=_0x3c9232[_0x294c('0xb')]||{};}module[_0x294c('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 35f7eb0..2510152 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 _0x5516=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x5516,0x1d4));var _0x6551=function(_0x2b01a2,_0x3b4040){_0x2b01a2=_0x2b01a2-0x0;var _0xcce4ab=_0x5516[_0x2b01a2];return _0xcce4ab;};'use strict';function Dynamics365Account(_0x5ae2bd){this['id']=_0x5ae2bd['id']||0x0;this[_0x6551('0x0')]=_0x5ae2bd[_0x6551('0x0')]||'';this[_0x6551('0x1')]=_0x5ae2bd['username']||'';this[_0x6551('0x2')]=_0x5ae2bd[_0x6551('0x2')]||'';this['remoteUri']=_0x5ae2bd[_0x6551('0x3')]||'';this[_0x6551('0x4')]=_0x5ae2bd[_0x6551('0x4')]||'';this[_0x6551('0x5')]=_0x5ae2bd['clientId']||'';this['clientSecret']=_0x5ae2bd[_0x6551('0x6')]||{};this[_0x6551('0x7')]=_0x5ae2bd[_0x6551('0x7')]||'';this['modernAuthentication']=_0x5ae2bd[_0x6551('0x8')]||![];this[_0x6551('0x9')]=_0x5ae2bd[_0x6551('0x9')]||{};this[_0x6551('0xa')]=_0x5ae2bd[_0x6551('0xa')]||{};}module[_0x6551('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x256c=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x256c,0x1b7));var _0xc256=function(_0x56d7a4,_0x4a57d8){_0x56d7a4=_0x56d7a4-0x0;var _0x57e39d=_0x256c[_0x56d7a4];return _0x57e39d;};'use strict';function Dynamics365Account(_0x499ba1){this['id']=_0x499ba1['id']||0x0;this['name']=_0x499ba1[_0xc256('0x0')]||'';this['username']=_0x499ba1['username']||'';this[_0xc256('0x1')]=_0x499ba1['password']||'';this[_0xc256('0x2')]=_0x499ba1[_0xc256('0x2')]||'';this[_0xc256('0x3')]=_0x499ba1[_0xc256('0x3')]||'';this[_0xc256('0x4')]=_0x499ba1[_0xc256('0x4')]||'';this['clientSecret']=_0x499ba1[_0xc256('0x5')]||{};this['serverUrl']=_0x499ba1[_0xc256('0x6')]||'';this[_0xc256('0x7')]=_0x499ba1[_0xc256('0x7')]||![];this[_0xc256('0x8')]=_0x499ba1[_0xc256('0x8')]||{};this['CloudProvider']=_0x499ba1[_0xc256('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 9a6f1c5..d63cb24 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 _0x579b=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x5137f8,_0x5ef5e6){var _0x383ffd=function(_0x314edc){while(--_0x314edc){_0x5137f8['push'](_0x5137f8['shift']());}};_0x383ffd(++_0x5ef5e6);}(_0x579b,0x78));var _0xb579=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x579b[_0x595bd1];return _0xd0344f;};'use strict';function FaxAccount(_0x2de5c6){this['id']=_0x2de5c6['id']||0x0;this[_0xb579('0x0')]=_0x2de5c6['name']||'';this[_0xb579('0x1')]=_0x2de5c6[_0xb579('0x1')];this[_0xb579('0x2')]=_0x2de5c6[_0xb579('0x2')];this[_0xb579('0x3')]=_0x2de5c6[_0xb579('0x3')];this[_0xb579('0x4')]=_0x2de5c6['localstationid'];this[_0xb579('0x5')]=_0x2de5c6['minrate']||0x960;this['maxrate']=_0x2de5c6[_0xb579('0x6')]||0x3840;this[_0xb579('0x7')]=_0x2de5c6[_0xb579('0x7')]||_0xb579('0x8');this[_0xb579('0x9')]=_0x2de5c6[_0xb579('0x9')]||'no';this[_0xb579('0xa')]=_0x2de5c6[_0xb579('0xa')]||'no';this[_0xb579('0xb')]=_0x2de5c6[_0xb579('0xb')]||0x1388;this['tech']=_0x2de5c6[_0xb579('0xc')]||'SIP';this[_0xb579('0xd')]=_0x2de5c6['Trunk']?_0x2de5c6[_0xb579('0xd')]:undefined;this['ListId']=_0x2de5c6[_0xb579('0xe')];this[_0xb579('0xf')]=_0x2de5c6[_0xb579('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xaa0f=['key','exports','name','description','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','ListId'];(function(_0x4fb965,_0x351a71){var _0x138a27=function(_0x3f2e2f){while(--_0x3f2e2f){_0x4fb965['push'](_0x4fb965['shift']());}};_0x138a27(++_0x351a71);}(_0xaa0f,0x11f));var _0xfaa0=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0xaa0f[_0xe719ec];return _0x4842a1;};'use strict';function FaxAccount(_0x3e2733){this['id']=_0x3e2733['id']||0x0;this['name']=_0x3e2733[_0xfaa0('0x0')]||'';this[_0xfaa0('0x1')]=_0x3e2733[_0xfaa0('0x1')];this['ecm']=_0x3e2733['ecm'];this[_0xfaa0('0x2')]=_0x3e2733['headerinfo'];this['localstationid']=_0x3e2733['localstationid'];this[_0xfaa0('0x3')]=_0x3e2733['minrate']||0x960;this[_0xfaa0('0x4')]=_0x3e2733[_0xfaa0('0x4')]||0x3840;this[_0xfaa0('0x5')]=_0x3e2733[_0xfaa0('0x5')]||_0xfaa0('0x6');this[_0xfaa0('0x7')]=_0x3e2733[_0xfaa0('0x7')]||'no';this[_0xfaa0('0x8')]=_0x3e2733[_0xfaa0('0x8')]||'no';this['t38timeout']=_0x3e2733[_0xfaa0('0x9')]||0x1388;this[_0xfaa0('0xa')]=_0x3e2733[_0xfaa0('0xa')]||_0xfaa0('0xb');this['Trunk']=_0x3e2733['Trunk']?_0x3e2733['Trunk']:undefined;this[_0xfaa0('0xc')]=_0x3e2733[_0xfaa0('0xc')];this['key']=_0x3e2733[_0xfaa0('0xd')];}module[_0xfaa0('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 bb059ed..28fd262 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 _0xe444=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe444,0x15e));var _0x4e44=function(_0x183e91,_0x5de088){_0x183e91=_0x183e91-0x0;var _0x1a6d4b=_0xe444[_0x183e91];return _0x1a6d4b;};'use strict';function FreshdeskAccount(_0x18040a){this['id']=_0x18040a['id']||0x0;this[_0x4e44('0x0')]=_0x18040a[_0x4e44('0x0')]||'';this[_0x4e44('0x1')]=_0x18040a[_0x4e44('0x1')]||'';this['apiKey']=_0x18040a[_0x4e44('0x2')]||'';this[_0x4e44('0x3')]=_0x18040a['remoteUri']||'';this[_0x4e44('0x4')]=_0x18040a[_0x4e44('0x4')]||'';this[_0x4e44('0x5')]=_0x18040a[_0x4e44('0x5')]||{};}module[_0x4e44('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xbc27=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x23ca80,_0x7eb650){var _0x116854=function(_0x1295f6){while(--_0x1295f6){_0x23ca80['push'](_0x23ca80['shift']());}};_0x116854(++_0x7eb650);}(_0xbc27,0x1d7));var _0x7bc2=function(_0x548ff7,_0x1e348d){_0x548ff7=_0x548ff7-0x0;var _0x4bdae7=_0xbc27[_0x548ff7];return _0x4bdae7;};'use strict';function FreshdeskAccount(_0x5e1aca){this['id']=_0x5e1aca['id']||0x0;this[_0x7bc2('0x0')]=_0x5e1aca[_0x7bc2('0x0')]||'';this[_0x7bc2('0x1')]=_0x5e1aca[_0x7bc2('0x1')]||'';this[_0x7bc2('0x2')]=_0x5e1aca['token']||'';this[_0x7bc2('0x3')]=_0x5e1aca[_0x7bc2('0x3')]||'';this[_0x7bc2('0x4')]=_0x5e1aca[_0x7bc2('0x4')]||'';this[_0x7bc2('0x5')]=_0x5e1aca[_0x7bc2('0x5')]||{};}module[_0x7bc2('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 91a42fc..9bf5fe2 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 _0x5b7f=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x2d0d4b,_0x2e4c34){var _0x55a5dd=function(_0x429201){while(--_0x429201){_0x2d0d4b['push'](_0x2d0d4b['shift']());}};_0x55a5dd(++_0x2e4c34);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x5135fd,_0x99caa){_0x5135fd=_0x5135fd-0x0;var _0x9c9048=_0x5b7f[_0x5135fd];return _0x9c9048;};'use strict';function FreshsalesAccount(_0x3e2d40){this['id']=_0x3e2d40['id']||0x0;this[_0xf5b7('0x0')]=_0x3e2d40[_0xf5b7('0x0')]||'';this[_0xf5b7('0x1')]=_0x3e2d40[_0xf5b7('0x1')]||'';this[_0xf5b7('0x2')]=_0x3e2d40[_0xf5b7('0x3')]||'';this[_0xf5b7('0x4')]=_0x3e2d40[_0xf5b7('0x4')]||'';this[_0xf5b7('0x5')]=_0x3e2d40[_0xf5b7('0x5')]||'';this[_0xf5b7('0x6')]=_0x3e2d40[_0xf5b7('0x6')]||{};}module[_0xf5b7('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xb957=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x3201eb,_0x32d7fe){var _0x1fd250=function(_0x3af620){while(--_0x3af620){_0x3201eb['push'](_0x3201eb['shift']());}};_0x1fd250(++_0x32d7fe);}(_0xb957,0x6d));var _0x7b95=function(_0x569e90,_0x2b68d1){_0x569e90=_0x569e90-0x0;var _0x2c646e=_0xb957[_0x569e90];return _0x2c646e;};'use strict';function FreshsalesAccount(_0x3b637e){this['id']=_0x3b637e['id']||0x0;this['name']=_0x3b637e[_0x7b95('0x0')]||'';this['username']=_0x3b637e[_0x7b95('0x1')]||'';this[_0x7b95('0x2')]=_0x3b637e[_0x7b95('0x3')]||'';this['remoteUri']=_0x3b637e[_0x7b95('0x4')]||'';this[_0x7b95('0x5')]=_0x3b637e[_0x7b95('0x5')]||'';this[_0x7b95('0x6')]=_0x3b637e[_0x7b95('0x6')]||{};}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 81537d8..bce964b 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 _0x3077=['inbound','uniqueid','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','mohtime','exports'];(function(_0x5bb764,_0x8b809a){var _0x3e4a50=function(_0x4c5b08){while(--_0x4c5b08){_0x5bb764['push'](_0x5bb764['shift']());}};_0x3e4a50(++_0x8b809a);}(_0x3077,0x1db));var _0x7307=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x3077[_0x139a3c];return _0x2b375b;};'use strict';function QueueReport(){this['type']=_0x7307('0x0');this[_0x7307('0x1')]='';this['calleridnum']='';this[_0x7307('0x2')]='';this[_0x7307('0x3')]='';this['queuecallerjoinAt']=null;this[_0x7307('0x4')]=null;this[_0x7307('0x5')]=0x1;this[_0x7307('0x6')]=0x1;this[_0x7307('0x7')]=![];this[_0x7307('0x8')]=null;this[_0x7307('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x7307('0xa')]=![];this[_0x7307('0xb')]=null;this[_0x7307('0xc')]=0x1;this[_0x7307('0xd')]='';this[_0x7307('0xe')]='';this[_0x7307('0xf')]='';this[_0x7307('0x10')]='';this[_0x7307('0x11')]='';this[_0x7307('0x12')]='';this[_0x7307('0x13')]='';this[_0x7307('0x14')]=0x0;this[_0x7307('0x15')]=![];this['lastAssignedTo']='';this[_0x7307('0x16')]='voice';this[_0x7307('0x17')]=0x0;this['variables']={};}module[_0x7307('0x18')]=QueueReport; \ No newline at end of file +var _0xf9fc=['accountcode','context','exten','priority','assigned','lastAssignedTo','voice','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','originalposition','channel','connectedlinename'];(function(_0x50a945,_0x4becc0){var _0x1edd6c=function(_0x263882){while(--_0x263882){_0x50a945['push'](_0x50a945['shift']());}};_0x1edd6c(++_0x4becc0);}(_0xf9fc,0x69));var _0xcf9f=function(_0xdc2e1,_0x3db07b){_0xdc2e1=_0xdc2e1-0x0;var _0x41fc0e=_0xf9fc[_0xdc2e1];return _0x41fc0e;};'use strict';function QueueReport(){this[_0xcf9f('0x0')]='inbound';this[_0xcf9f('0x1')]='';this[_0xcf9f('0x2')]='';this[_0xcf9f('0x3')]='';this[_0xcf9f('0x4')]='';this[_0xcf9f('0x5')]=null;this[_0xcf9f('0x6')]=null;this[_0xcf9f('0x7')]=0x1;this[_0xcf9f('0x8')]=0x1;this[_0xcf9f('0x9')]=![];this[_0xcf9f('0xa')]=null;this['queuecallercomplete']=![];this[_0xcf9f('0xb')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xcf9f('0xc')]=0x1;this[_0xcf9f('0xd')]='';this['connectedlinenum']='';this[_0xcf9f('0xe')]='';this[_0xcf9f('0xf')]='';this[_0xcf9f('0x10')]='';this[_0xcf9f('0x11')]='';this[_0xcf9f('0x12')]='';this['holdtime']=0x0;this[_0xcf9f('0x13')]=![];this[_0xcf9f('0x14')]='';this['motionChannel']=_0xcf9f('0x15');this['mohtime']=0x0;this[_0xcf9f('0x16')]={};}module[_0xcf9f('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ed9ec73..0e7bef5 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 _0xcdb4=['remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','username'];(function(_0x23fcec,_0x48ec4c){var _0x447567=function(_0x4781bb){while(--_0x4781bb){_0x23fcec['push'](_0x23fcec['shift']());}};_0x447567(++_0x48ec4c);}(_0xcdb4,0x1f3));var _0x4cdb=function(_0x3caf1d,_0x7d04a8){_0x3caf1d=_0x3caf1d-0x0;var _0x4c1bad=_0xcdb4[_0x3caf1d];return _0x4c1bad;};'use strict';function SalesforceAccount(_0x49db56){this['id']=_0x49db56['id']||0x0;this['name']=_0x49db56['name']||'';this['username']=_0x49db56[_0x4cdb('0x0')]||'';this[_0x4cdb('0x1')]=_0x49db56[_0x4cdb('0x1')]||'';this[_0x4cdb('0x2')]=_0x49db56[_0x4cdb('0x2')]||'';this[_0x4cdb('0x3')]=_0x49db56[_0x4cdb('0x3')]||'';this[_0x4cdb('0x4')]=_0x49db56['clientSecret']||'';this['securityToken']=_0x49db56['securityToken']||'';this[_0x4cdb('0x5')]=_0x49db56['type']||_0x4cdb('0x6');this['serverUrl']=_0x49db56[_0x4cdb('0x7')]||'';this[_0x4cdb('0x8')]=_0x49db56[_0x4cdb('0x8')]||{};}module[_0x4cdb('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xeb07=['password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0xeb07,0x17e));var _0x7eb0=function(_0x5c1751,_0x3a994b){_0x5c1751=_0x5c1751-0x0;var _0x4bb35e=_0xeb07[_0x5c1751];return _0x4bb35e;};'use strict';function SalesforceAccount(_0xb14a29){this['id']=_0xb14a29['id']||0x0;this[_0x7eb0('0x0')]=_0xb14a29[_0x7eb0('0x0')]||'';this[_0x7eb0('0x1')]=_0xb14a29['username']||'';this[_0x7eb0('0x2')]=_0xb14a29['remoteUri']||'';this['password']=_0xb14a29[_0x7eb0('0x3')]||'';this[_0x7eb0('0x4')]=_0xb14a29[_0x7eb0('0x4')]||'';this[_0x7eb0('0x5')]=_0xb14a29[_0x7eb0('0x5')]||'';this[_0x7eb0('0x6')]=_0xb14a29['securityToken']||'';this['type']=_0xb14a29[_0x7eb0('0x7')]||'integrationTab';this[_0x7eb0('0x8')]=_0xb14a29[_0x7eb0('0x8')]||'';this[_0x7eb0('0x9')]=_0xb14a29[_0x7eb0('0x9')]||{};}module[_0x7eb0('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 46c1f69..188220a 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 _0xccaa=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xccaa,0x84));var _0xacca=function(_0x31ddba,_0x28ec26){_0x31ddba=_0x31ddba-0x0;var _0x3f014c=_0xccaa[_0x31ddba];return _0x3f014c;};'use strict';function ServicenowAccount(_0x238f31){this['id']=_0x238f31['id']||0x0;this[_0xacca('0x0')]=_0x238f31[_0xacca('0x0')]||'';this['username']=_0x238f31[_0xacca('0x1')]||'';this[_0xacca('0x2')]=_0x238f31[_0xacca('0x2')]||'';this['remoteUri']=_0x238f31[_0xacca('0x3')]||'';this[_0xacca('0x4')]=_0x238f31[_0xacca('0x4')]||'';this[_0xacca('0x5')]=_0x238f31[_0xacca('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x897b=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x320da1,_0x31e289){var _0x1a9db5=function(_0xe83b30){while(--_0xe83b30){_0x320da1['push'](_0x320da1['shift']());}};_0x1a9db5(++_0x31e289);}(_0x897b,0xe1));var _0xb897=function(_0x545144,_0x405d74){_0x545144=_0x545144-0x0;var _0x3b463c=_0x897b[_0x545144];return _0x3b463c;};'use strict';function ServicenowAccount(_0x427034){this['id']=_0x427034['id']||0x0;this[_0xb897('0x0')]=_0x427034[_0xb897('0x0')]||'';this[_0xb897('0x1')]=_0x427034[_0xb897('0x1')]||'';this[_0xb897('0x2')]=_0x427034[_0xb897('0x2')]||'';this['remoteUri']=_0x427034[_0xb897('0x3')]||'';this['serverUrl']=_0x427034[_0xb897('0x4')]||'';this[_0xb897('0x5')]=_0x427034['Configurations']||{};}module[_0xb897('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d258fd3..02aab2d 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 _0x225c=['password','serverUrl','Configurations','exports','name','username'];(function(_0x3922c5,_0x3f2b1b){var _0x5c5b19=function(_0x2d52b0){while(--_0x2d52b0){_0x3922c5['push'](_0x3922c5['shift']());}};_0x5c5b19(++_0x3f2b1b);}(_0x225c,0xc4));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';function SugarcrmAccount(_0x443c1d){this['id']=_0x443c1d['id']||0x0;this[_0xc225('0x0')]=_0x443c1d[_0xc225('0x0')]||'';this[_0xc225('0x1')]=_0x443c1d[_0xc225('0x1')]||'';this[_0xc225('0x2')]=_0x443c1d[_0xc225('0x2')]||'';this['remoteUri']=_0x443c1d['remoteUri']||'';this[_0xc225('0x3')]=_0x443c1d[_0xc225('0x3')]||'';this[_0xc225('0x4')]=_0x443c1d[_0xc225('0x4')]||{};}module[_0xc225('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x2a07=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2ddcc4,_0x2cd57c){var _0x2de975=function(_0x56667a){while(--_0x56667a){_0x2ddcc4['push'](_0x2ddcc4['shift']());}};_0x2de975(++_0x2cd57c);}(_0x2a07,0x78));var _0x72a0=function(_0x17499b,_0x1b2ffd){_0x17499b=_0x17499b-0x0;var _0x5d2b45=_0x2a07[_0x17499b];return _0x5d2b45;};'use strict';function SugarcrmAccount(_0xfbda08){this['id']=_0xfbda08['id']||0x0;this['name']=_0xfbda08[_0x72a0('0x0')]||'';this[_0x72a0('0x1')]=_0xfbda08['username']||'';this[_0x72a0('0x2')]=_0xfbda08[_0x72a0('0x2')]||'';this['remoteUri']=_0xfbda08[_0x72a0('0x3')]||'';this[_0x72a0('0x4')]=_0xfbda08[_0x72a0('0x4')]||'';this['Configurations']=_0xfbda08[_0x72a0('0x5')]||{};}module[_0x72a0('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 ba5aebf..da7e68f 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 _0x726f=['exports','name','accountcode','unknown','stateTime','status','address'];(function(_0x1c99d2,_0x4ff3b4){var _0x155484=function(_0xa1dea9){while(--_0xa1dea9){_0x1c99d2['push'](_0x1c99d2['shift']());}};_0x155484(++_0x4ff3b4);}(_0x726f,0xa2));var _0xf726=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x726f[_0x4b369d];return _0x571a98;};'use strict';function Telephone(_0x1408a5){this['id']=_0x1408a5['id']||0x0;this[_0xf726('0x0')]=_0x1408a5['name']||'';this[_0xf726('0x1')]=_0x1408a5['accountcode']||'';this['state']=_0xf726('0x2');this[_0xf726('0x3')]=0x0;this[_0xf726('0x4')]=_0xf726('0x2');this[_0xf726('0x5')]='';}module[_0xf726('0x6')]=Telephone; \ No newline at end of file +var _0x87a2=['name','accountcode','state','unknown','stateTime','status'];(function(_0x4edbe8,_0x37b2bf){var _0xa9f985=function(_0x132c1b){while(--_0x132c1b){_0x4edbe8['push'](_0x4edbe8['shift']());}};_0xa9f985(++_0x37b2bf);}(_0x87a2,0x14a));var _0x287a=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x87a2[_0x10d0f0];return _0x93e308;};'use strict';function Telephone(_0x3e6b8f){this['id']=_0x3e6b8f['id']||0x0;this[_0x287a('0x0')]=_0x3e6b8f[_0x287a('0x0')]||'';this['accountcode']=_0x3e6b8f[_0x287a('0x1')]||'';this[_0x287a('0x2')]=_0x287a('0x3');this[_0x287a('0x4')]=0x0;this[_0x287a('0x5')]=_0x287a('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index cc77c58..c1912cd 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(_0x5e8023,_0x3443dd){var _0x1a5639=function(_0x417f31){while(--_0x417f31){_0x5e8023['push'](_0x5e8023['shift']());}};_0x1a5639(++_0x3443dd);}(_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 _0xb10b=['name','html'];(function(_0x41dcd5,_0x1f9f01){var _0x2938d5=function(_0x213e35){while(--_0x213e35){_0x41dcd5['push'](_0x41dcd5['shift']());}};_0x2938d5(++_0x1f9f01);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0xb10b[_0x2d48fa];return _0x4645b7;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index e43130c..769fa75 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 _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x41e64c,_0x55f858){var _0x46cc5e=function(_0x555426){while(--_0x555426){_0x41e64c['push'](_0x41e64c['shift']());}};_0x46cc5e(++_0x55f858);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2e0930,_0xccab29){_0x2e0930=_0x2e0930-0x0;var _0x44a4c8=_0x9ffd[_0x2e0930];return _0x44a4c8;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1a85,0x178));var _0x51a8=function(_0x3031e5,_0x2a73a9){_0x3031e5=_0x3031e5-0x0;var _0x2e48b4=_0x1a85[_0x3031e5];return _0x2e48b4;};'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 d0728e3..1064331 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 _0xa974=['name','state','stateTime','status','unknown','registry','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active'];(function(_0x211a02,_0x3b5362){var _0x13d91c=function(_0x559b49){while(--_0x559b49){_0x211a02['push'](_0x211a02['shift']());}};_0x13d91c(++_0x3b5362);}(_0xa974,0xff));var _0x4a97=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0xa974[_0x1a8f86];return _0x20d876;};'use strict';function Trunk(_0x4c4bb0){this['id']=_0x4c4bb0['id']||0x0;this[_0x4a97('0x0')]=_0x4c4bb0['active']||![];this[_0x4a97('0x1')]=_0x4c4bb0[_0x4a97('0x1')]||'';this[_0x4a97('0x2')]='unknown';this[_0x4a97('0x3')]=0x0;this[_0x4a97('0x4')]=_0x4a97('0x5');this[_0x4a97('0x6')]=_0x4c4bb0[_0x4a97('0x6')]&&_0x4c4bb0[_0x4a97('0x6')]['indexOf'](':')?_0x4c4bb0[_0x4a97('0x6')]['split'](':')[0x0]:'';this[_0x4a97('0x7')]='';this[_0x4a97('0x8')]='';this[_0x4a97('0x9')]='';this[_0x4a97('0xa')]='';this[_0x4a97('0xb')]='';this[_0x4a97('0xc')]=_0x4a97('0x5');this['registrationtime']='';this[_0x4a97('0xd')]='';this[_0x4a97('0xe')]=_0x4c4bb0['defaultuser']||'';}module[_0x4a97('0xf')]=Trunk; \ No newline at end of file +var _0x80f7=['status','registry','split','host','port','domainport','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x80f7,0x6c));var _0x780f=function(_0x16af01,_0x9c623c){_0x16af01=_0x16af01-0x0;var _0x4d4b9a=_0x80f7[_0x16af01];return _0x4d4b9a;};'use strict';function Trunk(_0x1de6ed){this['id']=_0x1de6ed['id']||0x0;this[_0x780f('0x0')]=_0x1de6ed[_0x780f('0x0')]||![];this[_0x780f('0x1')]=_0x1de6ed[_0x780f('0x1')]||'';this[_0x780f('0x2')]=_0x780f('0x3');this['stateTime']=0x0;this[_0x780f('0x4')]=_0x780f('0x3');this['registry']=_0x1de6ed[_0x780f('0x5')]&&_0x1de6ed['registry']['indexOf'](':')?_0x1de6ed['registry'][_0x780f('0x6')](':')[0x0]:'';this[_0x780f('0x7')]='';this[_0x780f('0x8')]='';this['domain']='';this[_0x780f('0x9')]='';this['refresh']='';this[_0x780f('0xa')]=_0x780f('0x3');this[_0x780f('0xb')]='';this[_0x780f('0xc')]='';this['defaultuser']=_0x1de6ed[_0x780f('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4a9e01d..88ff1aa 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 _0x8302=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x5bc98f,_0x2c579e){var _0x178a1e=function(_0x2f4438){while(--_0x2f4438){_0x5bc98f['push'](_0x5bc98f['shift']());}};_0x178a1e(++_0x2c579e);}(_0x8302,0x114));var _0x2830=function(_0x490b05,_0x7f0934){_0x490b05=_0x490b05-0x0;var _0x37ad3c=_0x8302[_0x490b05];return _0x37ad3c;};'use strict';function voiceExtension(_0x114787){this['id']=_0x114787['id']||0x0;this[_0x2830('0x0')]=_0x114787[_0x2830('0x0')]||'';this[_0x2830('0x1')]=_0x114787['recordingFormat']||'none';this[_0x2830('0x2')]=_0x114787[_0x2830('0x2')]||![];}module[_0x2830('0x3')]=voiceExtension; \ No newline at end of file +var _0xce0b=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x59b883,_0x5b9937){var _0x109f90=function(_0x16107d){while(--_0x16107d){_0x59b883['push'](_0x59b883['shift']());}};_0x109f90(++_0x5b9937);}(_0xce0b,0xb6));var _0xbce0=function(_0x59f479,_0x40c738){_0x59f479=_0x59f479-0x0;var _0x560306=_0xce0b[_0x59f479];return _0x560306;};'use strict';function voiceExtension(_0x44ea31){this['id']=_0x44ea31['id']||0x0;this[_0xbce0('0x0')]=_0x44ea31[_0xbce0('0x0')]||'';this[_0xbce0('0x1')]=_0x44ea31[_0xbce0('0x1')]||_0xbce0('0x2');this[_0xbce0('0x3')]=_0x44ea31[_0xbce0('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 b80cf9c..275c974 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 _0xe474=['total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','onhold','wav49','rrmemory','roundrobin','name','monitor_format','waiting','talking'];(function(_0x10eb11,_0x1c2aaa){var _0x1aad42=function(_0x2192f6){while(--_0x2192f6){_0x10eb11['push'](_0x10eb11['shift']());}};_0x1aad42(++_0x1c2aaa);}(_0xe474,0xee));var _0x4e47=function(_0x35ad97,_0x54ca39){_0x35ad97=_0x35ad97-0x0;var _0x5af841=_0xe474[_0x35ad97];return _0x5af841;};'use strict';var statusDesc=[_0x4e47('0x0'),_0x4e47('0x1'),'inuse',_0x4e47('0x2'),_0x4e47('0x3'),_0x4e47('0x4'),_0x4e47('0x5'),'ringinuse',_0x4e47('0x6')];var monitorFormat={'wav':'wav','wav49':_0x4e47('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x4e47('0x8'),'roundrobin':_0x4e47('0x9')};function VoiceQueue(_0x3d3f9a){this['id']=_0x3d3f9a['id']||0x0;this[_0x4e47('0xa')]=_0x3d3f9a[_0x4e47('0xa')]||'';this[_0x4e47('0xb')]=_0x3d3f9a[_0x4e47('0xb')]||'';this['type']=_0x3d3f9a['type']||'inbound';this[_0x4e47('0xc')]=0x0;this[_0x4e47('0xd')]=0x0;this[_0x4e47('0xe')]=0x0;this['answered']=0x0;this[_0x4e47('0xf')]=0x0;this[_0x4e47('0x10')]=0x0;this[_0x4e47('0x11')]=0x0;this[_0x4e47('0x12')]=0x0;this[_0x4e47('0x13')]=0x0;this[_0x4e47('0x14')]=0x0;this[_0x4e47('0x15')]=0x0;this[_0x4e47('0x16')]=_0x3d3f9a[_0x4e47('0x16')]||![];this[_0x4e47('0x17')]=_0x3d3f9a['acwTimeout']||0xa;this[_0x4e47('0x18')]=_0x3d3f9a[_0x4e47('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x4e47('0x19')]='';this[_0x4e47('0x1a')]=0x0;this['temp']=0x0;this[_0x4e47('0x1b')]=_0x3d3f9a[_0x4e47('0x1b')]||null;this['dialGlobalInterval']=_0x3d3f9a[_0x4e47('0x1c')]?_0x3d3f9a['dialGlobalInterval']:null;this[_0x4e47('0x1d')]=_0x3d3f9a['dialActive'];this[_0x4e47('0x1e')]=_0x3d3f9a[_0x4e47('0x1e')]||_0x4e47('0x1f');this[_0x4e47('0x20')]=_0x3d3f9a[_0x4e47('0x20')]||0x0;this['dialLimitQueue']=_0x3d3f9a[_0x4e47('0x21')]||0x0;this[_0x4e47('0x22')]=_0x3d3f9a['dialPowerLevel']||0x1;this[_0x4e47('0x23')]=_0x3d3f9a[_0x4e47('0x23')]||_0x4e47('0x24');this[_0x4e47('0x25')]=_0x3d3f9a['dialPredictiveOptimizationPercentage']||0.03;this[_0x4e47('0x26')]=_0x3d3f9a[_0x4e47('0x26')]||0x258;this[_0x4e47('0x27')]=_0x3d3f9a[_0x4e47('0x27')]||_0x4e47('0x28');this[_0x4e47('0x29')]=_0x3d3f9a[_0x4e47('0x29')]||_0x4e47('0x28');this['dialOriginateTimeout']=_0x3d3f9a[_0x4e47('0x2a')]||0x1e;this[_0x4e47('0x2b')]=_0x3d3f9a[_0x4e47('0x2b')]||_0x4e47('0x2c');this[_0x4e47('0x2d')]=_0x3d3f9a['dialQueueTimeout']||0x3;this[_0x4e47('0x2e')]=_0x3d3f9a[_0x4e47('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x3d3f9a[_0x4e47('0x2f')]||0x3;this['dialCongestionRetryFrequency']=_0x3d3f9a[_0x4e47('0x30')]||0x96;this['dialBusyMaxRetry']=_0x3d3f9a[_0x4e47('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x3d3f9a[_0x4e47('0x32')]||0x96;this[_0x4e47('0x33')]=_0x3d3f9a[_0x4e47('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x3d3f9a[_0x4e47('0x34')]||0x96;this[_0x4e47('0x35')]=_0x3d3f9a[_0x4e47('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3d3f9a['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x3d3f9a[_0x4e47('0x36')]||0x3;this['dialDropRetryFrequency']=_0x3d3f9a[_0x4e47('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x3d3f9a[_0x4e47('0x38')]||0x3;this[_0x4e47('0x39')]=_0x3d3f9a[_0x4e47('0x39')]||0x96;this[_0x4e47('0x3a')]=_0x3d3f9a[_0x4e47('0x3a')]||0x3;this[_0x4e47('0x3b')]=_0x3d3f9a[_0x4e47('0x3b')]||0x96;this[_0x4e47('0x3c')]=_0x3d3f9a[_0x4e47('0x3c')]||0x3;this[_0x4e47('0x3d')]=_0x3d3f9a[_0x4e47('0x3d')]||0x96;this[_0x4e47('0x3e')]=_0x3d3f9a[_0x4e47('0x3e')]||0x4;this['Trunk']=_0x3d3f9a[_0x4e47('0x3f')]?_0x3d3f9a[_0x4e47('0x3f')]:undefined;this[_0x4e47('0x40')]=_0x3d3f9a[_0x4e47('0x40')]?_0x3d3f9a[_0x4e47('0x40')]:undefined;this['dialPrefix']=_0x3d3f9a[_0x4e47('0x41')]||undefined;this[_0x4e47('0x42')]=_0x3d3f9a['Interval']?_0x3d3f9a[_0x4e47('0x42')]:undefined;this[_0x4e47('0x43')]=_0x3d3f9a[_0x4e47('0x43')]||_0x4e47('0x44');this[_0x4e47('0x45')]=_0x3d3f9a[_0x4e47('0x45')]||undefined;this['dialCutDigit']=_0x3d3f9a['dialCutDigit']||undefined;this['strategy']=strategy[_0x3d3f9a[_0x4e47('0x46')]]||_0x4e47('0x8');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x3d3f9a['dialAMDActive']||![];this[_0x4e47('0x47')]=_0x3d3f9a[_0x4e47('0x47')];this[_0x4e47('0x48')]=_0x3d3f9a[_0x4e47('0x48')];this[_0x4e47('0x49')]=_0x3d3f9a['dialAMDAfterGreetingSilence'];this[_0x4e47('0x4a')]=_0x3d3f9a[_0x4e47('0x4a')];this['dialAMDMinWordLength']=_0x3d3f9a[_0x4e47('0x4b')];this[_0x4e47('0x4c')]=_0x3d3f9a[_0x4e47('0x4c')];this[_0x4e47('0x4d')]=_0x3d3f9a[_0x4e47('0x4d')];this[_0x4e47('0x4e')]=_0x3d3f9a[_0x4e47('0x4e')];this[_0x4e47('0x4f')]=_0x3d3f9a[_0x4e47('0x4f')];this[_0x4e47('0x50')]=0x0;this[_0x4e47('0x51')]=0x0;this[_0x4e47('0x52')]=_0x3d3f9a[_0x4e47('0x52')];this[_0x4e47('0x53')]=0x0;this[_0x4e47('0x54')]=0x0;this[_0x4e47('0x55')]=0x0;this[_0x4e47('0x56')]=0x0;this[_0x4e47('0x57')]=0x0;this[_0x4e47('0x58')]=0x0;this[_0x4e47('0x59')]=0x0;this[_0x4e47('0x5a')]=0x0;this[_0x4e47('0x5b')]=0x0;this[_0x4e47('0x5c')]=0x0;this[_0x4e47('0x5d')]=0x0;this[_0x4e47('0x5e')]=0x0;this[_0x4e47('0x5f')]=0x0;this[_0x4e47('0x60')]=0x0;this[_0x4e47('0x61')]=undefined;this[_0x4e47('0x62')]=undefined;this[_0x4e47('0x63')]=undefined;this[_0x4e47('0x64')]=1.05;this[_0x4e47('0x65')]=0x0;this[_0x4e47('0x66')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x4e47('0x67')]=0x0;this[_0x4e47('0x68')]=0x0;this[_0x4e47('0x69')]=0x0;this[_0x4e47('0x6a')]=0x0;this[_0x4e47('0x6b')]=0x0;this[_0x4e47('0x6c')]=_0x3d3f9a[_0x4e47('0x6d')]||0x14;this[_0x4e47('0x6e')]=_0x3d3f9a[_0x4e47('0x6d')]||0xa;this[_0x4e47('0x6f')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x4e47('0x70')]=0x1;this[_0x4e47('0x71')]=0x0;this[_0x4e47('0x72')]=0x0;this[_0x4e47('0x73')]=0x0;this['erlangBusyFactor']=0x0;this[_0x4e47('0x74')]=_0x3d3f9a['dialRecallMeTimeout']||0x1e;this[_0x4e47('0x75')]=_0x3d3f9a['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x3d3f9a[_0x4e47('0x76')]||![];this[_0x4e47('0x77')]=!!_0x3d3f9a[_0x4e47('0x77')]||![];this[_0x4e47('0x78')]=_0x3d3f9a[_0x4e47('0x78')]||undefined;this[_0x4e47('0x79')]=_0x3d3f9a[_0x4e47('0x79')]||![];this[_0x4e47('0x7a')]=_0x3d3f9a[_0x4e47('0x7a')]||![];this[_0x4e47('0xb')]=monitorFormat[_0x3d3f9a[_0x4e47('0xb')]]?monitorFormat[_0x3d3f9a[_0x4e47('0xb')]]:undefined;this[_0x4e47('0x7b')]=_0x3d3f9a[_0x4e47('0x7b')]||![];this['mandatoryDispositionPause']=_0x3d3f9a['mandatoryDispositionPause']?_0x3d3f9a[_0x4e47('0x7c')]:undefined;}module[_0x4e47('0x7d')]=VoiceQueue; \ No newline at end of file +var _0x6689=['outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay'];(function(_0x4c677c,_0x31c8e9){var _0x4f5d0c=function(_0x26be6c){while(--_0x26be6c){_0x4c677c['push'](_0x4c677c['shift']());}};_0x4f5d0c(++_0x31c8e9);}(_0x6689,0x97));var _0x9668=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6689[_0x3dd15e];return _0x231fd0;};'use strict';var statusDesc=[_0x9668('0x0'),_0x9668('0x1'),_0x9668('0x2'),'busy',_0x9668('0x3'),_0x9668('0x4'),_0x9668('0x5'),_0x9668('0x6'),'onhold'];var monitorFormat={'wav':_0x9668('0x7'),'wav49':_0x9668('0x8'),'gsm':_0x9668('0x9')};var strategy={'rrmemory':_0x9668('0xa'),'roundrobin':_0x9668('0xb')};function VoiceQueue(_0x274309){this['id']=_0x274309['id']||0x0;this[_0x9668('0xc')]=_0x274309['name']||'';this['monitor_format']=_0x274309[_0x9668('0xd')]||'';this[_0x9668('0xe')]=_0x274309[_0x9668('0xe')]||_0x9668('0xf');this[_0x9668('0x10')]=0x0;this[_0x9668('0x11')]=0x0;this[_0x9668('0x12')]=0x0;this[_0x9668('0x13')]=0x0;this[_0x9668('0x14')]=0x0;this['sumHoldTime']=0x0;this[_0x9668('0x15')]=0x0;this[_0x9668('0x16')]=0x0;this[_0x9668('0x17')]=0x0;this[_0x9668('0x18')]=0x0;this['available']=0x0;this[_0x9668('0x19')]=_0x274309[_0x9668('0x19')]||![];this[_0x9668('0x1a')]=_0x274309['acwTimeout']||0xa;this[_0x9668('0x1b')]=_0x274309[_0x9668('0x1b')]||'no';this[_0x9668('0x1c')]=!![];this['message']='';this[_0x9668('0x1d')]=0x0;this[_0x9668('0x1e')]=0x0;this[_0x9668('0x1f')]=_0x274309[_0x9668('0x1f')]||null;this[_0x9668('0x20')]=_0x274309['dialGlobalInterval']?_0x274309[_0x9668('0x20')]:null;this[_0x9668('0x21')]=_0x274309[_0x9668('0x21')];this[_0x9668('0x22')]=_0x274309[_0x9668('0x22')]||_0x9668('0x23');this[_0x9668('0x24')]=_0x274309[_0x9668('0x24')]||0x0;this[_0x9668('0x25')]=_0x274309[_0x9668('0x25')]||0x0;this['dialPowerLevel']=_0x274309[_0x9668('0x26')]||0x1;this[_0x9668('0x27')]=_0x274309[_0x9668('0x27')]||_0x9668('0x28');this[_0x9668('0x29')]=_0x274309[_0x9668('0x29')]||0.03;this['dialPredictiveInterval']=_0x274309[_0x9668('0x2a')]||0x258;this[_0x9668('0x2b')]=_0x274309[_0x9668('0x2b')]||_0x9668('0x2c');this[_0x9668('0x2d')]=_0x274309[_0x9668('0x2d')]||'anonymous';this['dialOriginateTimeout']=_0x274309[_0x9668('0x2e')]||0x1e;this[_0x9668('0x2f')]=_0x274309[_0x9668('0x2f')]||_0x9668('0x30');this[_0x9668('0x31')]=_0x274309[_0x9668('0x31')]||0x3;this['dialQueueProject']=_0x274309[_0x9668('0x32')]||undefined;this[_0x9668('0x33')]=_0x274309['dialCongestionMaxRetry']||0x3;this[_0x9668('0x34')]=_0x274309[_0x9668('0x34')]||0x96;this[_0x9668('0x35')]=_0x274309[_0x9668('0x35')]||0x3;this['dialBusyRetryFrequency']=_0x274309[_0x9668('0x36')]||0x96;this[_0x9668('0x37')]=_0x274309[_0x9668('0x37')]||0x3;this[_0x9668('0x38')]=_0x274309['dialNoAnswerRetryFrequency']||0x96;this[_0x9668('0x39')]=_0x274309[_0x9668('0x39')]||0x3;this[_0x9668('0x3a')]=_0x274309[_0x9668('0x3a')]||0x96;this[_0x9668('0x3b')]=_0x274309[_0x9668('0x3b')]||0x3;this[_0x9668('0x3c')]=_0x274309[_0x9668('0x3c')]||0x96;this[_0x9668('0x3d')]=_0x274309['dialAbandonedMaxRetry']||0x3;this[_0x9668('0x3e')]=_0x274309[_0x9668('0x3e')]||0x96;this['dialMachineMaxRetry']=_0x274309['dialMachineMaxRetry']||0x3;this[_0x9668('0x3f')]=_0x274309[_0x9668('0x3f')]||0x96;this[_0x9668('0x40')]=_0x274309[_0x9668('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x274309[_0x9668('0x41')]||0x96;this['dialGlobalMaxRetry']=_0x274309[_0x9668('0x42')]||0x4;this['Trunk']=_0x274309['Trunk']?_0x274309[_0x9668('0x43')]:undefined;this[_0x9668('0x44')]=_0x274309[_0x9668('0x44')]?_0x274309[_0x9668('0x44')]:undefined;this[_0x9668('0x45')]=_0x274309[_0x9668('0x45')]||undefined;this[_0x9668('0x46')]=_0x274309[_0x9668('0x46')]?_0x274309[_0x9668('0x46')]:undefined;this[_0x9668('0x47')]=_0x274309['dialOrderByScheduledAt']||_0x9668('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x274309[_0x9668('0x49')]||undefined;this[_0x9668('0x4a')]=_0x274309[_0x9668('0x4a')]||undefined;this[_0x9668('0x4b')]=strategy[_0x274309[_0x9668('0x4b')]]||'rrmemory';this[_0x9668('0x4c')]=!![];this[_0x9668('0x4d')]=_0x274309[_0x9668('0x4d')]||![];this[_0x9668('0x4e')]=_0x274309[_0x9668('0x4e')];this[_0x9668('0x4f')]=_0x274309[_0x9668('0x4f')];this['dialAMDAfterGreetingSilence']=_0x274309[_0x9668('0x50')];this[_0x9668('0x51')]=_0x274309[_0x9668('0x51')];this[_0x9668('0x52')]=_0x274309['dialAMDMinWordLength'];this[_0x9668('0x53')]=_0x274309[_0x9668('0x53')];this['dialAMDMaximumNumberOfWords']=_0x274309[_0x9668('0x54')];this['dialAMDSilenceThreshold']=_0x274309[_0x9668('0x55')];this[_0x9668('0x56')]=_0x274309[_0x9668('0x56')];this[_0x9668('0x57')]=0x0;this[_0x9668('0x58')]=0x0;this[_0x9668('0x59')]=_0x274309[_0x9668('0x59')];this[_0x9668('0x5a')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x9668('0x5b')]=0x0;this[_0x9668('0x5c')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x9668('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x9668('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this[_0x9668('0x5f')]=0x0;this[_0x9668('0x60')]=undefined;this[_0x9668('0x61')]=undefined;this[_0x9668('0x62')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x9668('0x63')]=0x0;this[_0x9668('0x64')]=0x0;this[_0x9668('0x65')]=0x0;this[_0x9668('0x66')]=0x0;this[_0x9668('0x67')]=0x0;this[_0x9668('0x68')]=0x0;this[_0x9668('0x69')]=0x0;this[_0x9668('0x6a')]=0x0;this[_0x9668('0x6b')]=_0x274309['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x9668('0x6c')]=_0x274309[_0x9668('0x6d')]||0xa;this[_0x9668('0x6e')]=0x0;this[_0x9668('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x9668('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x9668('0x71')]=_0x274309[_0x9668('0x71')]||0x1e;this['dialRecallInQueue']=_0x274309[_0x9668('0x72')]||![];this[_0x9668('0x73')]=!!_0x274309['dialPreviewAutoRecallMe']||![];this[_0x9668('0x74')]=!!_0x274309['dialPreviewRecallmeReminder']||![];this[_0x9668('0x75')]=_0x274309[_0x9668('0x75')]||undefined;this[_0x9668('0x76')]=_0x274309[_0x9668('0x76')]||![];this['dialAgiAfterHangupAgent']=_0x274309[_0x9668('0x77')]||![];this[_0x9668('0xd')]=monitorFormat[_0x274309['monitor_format']]?monitorFormat[_0x274309[_0x9668('0xd')]]:undefined;this[_0x9668('0x78')]=_0x274309[_0x9668('0x78')]||![];this[_0x9668('0x79')]=_0x274309[_0x9668('0x79')]?_0x274309[_0x9668('0x79')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e523afa..466dbff 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 _0x06d2=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x06d2,0x138));var _0x206d=function(_0x25e470,_0x566149){_0x25e470=_0x25e470-0x0;var _0x155d19=_0x06d2[_0x25e470];return _0x155d19;};'use strict';function VtigerAccount(_0x49173a){this['id']=_0x49173a['id']||0x0;this[_0x206d('0x0')]=_0x49173a['name']||'';this['username']=_0x49173a[_0x206d('0x1')]||'';this[_0x206d('0x2')]=_0x49173a[_0x206d('0x2')]||'';this[_0x206d('0x3')]=_0x49173a[_0x206d('0x3')]||'';this['serverUrl']=_0x49173a[_0x206d('0x4')]||'';this[_0x206d('0x5')]=_0x49173a[_0x206d('0x5')]||{};}module[_0x206d('0x6')]=VtigerAccount; \ No newline at end of file +var _0xa1f7=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0xfcc030,_0x3ec053){var _0x5caa66=function(_0xf2e6d2){while(--_0xf2e6d2){_0xfcc030['push'](_0xfcc030['shift']());}};_0x5caa66(++_0x3ec053);}(_0xa1f7,0xda));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x2d6749){this['id']=_0x2d6749['id']||0x0;this['name']=_0x2d6749[_0x7a1f('0x0')]||'';this[_0x7a1f('0x1')]=_0x2d6749[_0x7a1f('0x1')]||'';this['accessKey']=_0x2d6749[_0x7a1f('0x2')]||'';this[_0x7a1f('0x3')]=_0x2d6749[_0x7a1f('0x3')]||'';this[_0x7a1f('0x4')]=_0x2d6749[_0x7a1f('0x4')]||'';this[_0x7a1f('0x5')]=_0x2d6749[_0x7a1f('0x5')]||{};}module[_0x7a1f('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 64f91e8..84cefbe 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 _0xac4e=['username','password','token','remoteUri','authType','type','serverUrl','Configurations','name'];(function(_0x450277,_0x526af2){var _0x9e7e8c=function(_0x411cb6){while(--_0x411cb6){_0x450277['push'](_0x450277['shift']());}};_0x9e7e8c(++_0x526af2);}(_0xac4e,0x8f));var _0xeac4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xac4e[_0x501510];return _0x1e6ee5;};'use strict';function ZendeskAccount(_0x3e7c02){this['id']=_0x3e7c02['id']||0x0;this[_0xeac4('0x0')]=_0x3e7c02[_0xeac4('0x0')]||'';this[_0xeac4('0x1')]=_0x3e7c02['username']||'';this[_0xeac4('0x2')]=_0x3e7c02[_0xeac4('0x2')]||'';this[_0xeac4('0x3')]=_0x3e7c02[_0xeac4('0x3')]||'';this[_0xeac4('0x4')]=_0x3e7c02[_0xeac4('0x4')]||'';this[_0xeac4('0x5')]=_0x3e7c02[_0xeac4('0x5')]||'';this[_0xeac4('0x6')]=_0x3e7c02[_0xeac4('0x6')]||'integrationTab';this[_0xeac4('0x7')]=_0x3e7c02[_0xeac4('0x7')]||'';this[_0xeac4('0x8')]=_0x3e7c02[_0xeac4('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xb757=['exports','name','username','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x7b79de,_0x5a425d){var _0x403674=function(_0x33801c){while(--_0x33801c){_0x7b79de['push'](_0x7b79de['shift']());}};_0x403674(++_0x5a425d);}(_0xb757,0x196));var _0x7b75=function(_0xd87418,_0x2a340e){_0xd87418=_0xd87418-0x0;var _0x4794ed=_0xb757[_0xd87418];return _0x4794ed;};'use strict';function ZendeskAccount(_0x1b5edc){this['id']=_0x1b5edc['id']||0x0;this['name']=_0x1b5edc[_0x7b75('0x0')]||'';this['username']=_0x1b5edc[_0x7b75('0x1')]||'';this['password']=_0x1b5edc['password']||'';this[_0x7b75('0x2')]=_0x1b5edc[_0x7b75('0x2')]||'';this[_0x7b75('0x3')]=_0x1b5edc[_0x7b75('0x3')]||'';this['authType']=_0x1b5edc[_0x7b75('0x4')]||'';this[_0x7b75('0x5')]=_0x1b5edc['type']||'integrationTab';this[_0x7b75('0x6')]=_0x1b5edc[_0x7b75('0x6')]||'';this[_0x7b75('0x7')]=_0x1b5edc[_0x7b75('0x7')]||{};}module[_0x7b75('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4316f8c..3cecb0d 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 _0x3ddd=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0xfa716b,_0x1fa236){var _0xe946ab=function(_0x495c2e){while(--_0x495c2e){_0xfa716b['push'](_0xfa716b['shift']());}};_0xe946ab(++_0x1fa236);}(_0x3ddd,0xcf));var _0xd3dd=function(_0x5f54ee,_0xbedc2f){_0x5f54ee=_0x5f54ee-0x0;var _0x559180=_0x3ddd[_0x5f54ee];return _0x559180;};'use strict';function ZohoAccount(_0x189a98){this['id']=_0x189a98['id']||0x0;this['name']=_0x189a98[_0xd3dd('0x0')]||'';this['description']=_0x189a98[_0xd3dd('0x1')]||'';this[_0xd3dd('0x2')]=_0x189a98[_0xd3dd('0x2')]||'';this[_0xd3dd('0x3')]=_0x189a98[_0xd3dd('0x3')]||'';this[_0xd3dd('0x4')]=_0x189a98[_0xd3dd('0x4')]||'';this[_0xd3dd('0x5')]=_0x189a98[_0xd3dd('0x5')]||'';this['serverUrl']=_0x189a98[_0xd3dd('0x6')]||'';this[_0xd3dd('0x7')]=_0x189a98[_0xd3dd('0x7')]||'';this[_0xd3dd('0x8')]=_0x189a98[_0xd3dd('0x8')]||'';this[_0xd3dd('0x9')]=_0x189a98['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xfb6f=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x3de9ad,_0x2a0d99){var _0x3b7676=function(_0x541c88){while(--_0x541c88){_0x3de9ad['push'](_0x3de9ad['shift']());}};_0x3b7676(++_0x2a0d99);}(_0xfb6f,0xb9));var _0xffb6=function(_0x1fbb72,_0x5f2391){_0x1fbb72=_0x1fbb72-0x0;var _0x481193=_0xfb6f[_0x1fbb72];return _0x481193;};'use strict';function ZohoAccount(_0x5e3217){this['id']=_0x5e3217['id']||0x0;this[_0xffb6('0x0')]=_0x5e3217[_0xffb6('0x0')]||'';this[_0xffb6('0x1')]=_0x5e3217[_0xffb6('0x1')]||'';this['host']=_0x5e3217[_0xffb6('0x2')]||'';this[_0xffb6('0x3')]=_0x5e3217[_0xffb6('0x3')]||'';this[_0xffb6('0x4')]=_0x5e3217[_0xffb6('0x4')]||'';this['clientSecret']=_0x5e3217[_0xffb6('0x5')]||'';this[_0xffb6('0x6')]=_0x5e3217['serverUrl']||'';this[_0xffb6('0x7')]=_0x5e3217[_0xffb6('0x7')]||'';this[_0xffb6('0x8')]=_0x5e3217['refreshToken']||'';this[_0xffb6('0x9')]=_0x5e3217['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 95bfc9b..ea5359b 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 _0xd131=['VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','calleridname','number','util','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xd131,0x194));var _0x1d13=function(_0x1d227e,_0x361094){_0x1d227e=_0x1d227e-0x0;var _0x7ccf13=_0xd131[_0x1d227e];return _0x7ccf13;};'use strict';var util=require(_0x1d13('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x1ce74a,_0x28d4b8,_0x234095){var _0x214211='';if(!_[_0x1d13('0x1')](_0x28d4b8)&&_0x1d13('0x2')===typeof _0x28d4b8){_0x214211+=_0x28d4b8;}if(!_[_0x1d13('0x1')](_0x234095)&&'string'===typeof _0x234095){_0x214211+='\x20'+_0x234095;}if(_0x214211!==''){return _0x214211;}return _0x1ce74a;}function Action(_0x5d8986,_0x1c14a9,_0x1a3091,_0x254fad,_0x4aef86){this[_0x1d13('0x3')]=_0x1a3091||undefined;this[_0x1d13('0x4')]=_0x5d8986['id'];this[_0x1d13('0x5')]=_0x1c14a9[_0x1d13('0x6')];this['type']=_0x1c14a9[_0x1d13('0x7')];this[_0x1d13('0x8')]=_0x1d13('0x5');this[_0x1d13('0x9')]=![];this[_0x1d13('0xa')]=_[_0x1d13('0x1')](_0x5d8986[_0x1d13('0xb')])?undefined:_0x5d8986[_0x1d13('0xb')][_0x1d13('0x6')];this[_0x1d13('0xc')]=this[_0x1d13('0xa')]?util['format'](_0x1d13('0xd'),this[_0x1d13('0xa')]):_0x254fad||undefined;this['calleridname']=checkNameSurname(_0x5d8986[_0x1d13('0xe')][_0x1d13('0xf')],_0x5d8986[_0x1d13('0xe')]['firstName'],_0x5d8986['Contact'][_0x1d13('0x10')]);this[_0x1d13('0x11')]=_0x5d8986['active']||![];this[_0x1d13('0x12')]=_0x5d8986[_0x1d13('0xe')][_0x1d13('0xf')];this[_0x1d13('0x13')]=_0x5d8986[_0x1d13('0x13')];this[_0x1d13('0x14')]=_0x5d8986['countbusyretry']||0x0;this[_0x1d13('0x15')]=_0x5d8986[_0x1d13('0x15')]||0x0;this[_0x1d13('0x16')]=_0x5d8986[_0x1d13('0x16')]||0x0;this[_0x1d13('0x17')]=(_0x5d8986[_0x1d13('0x14')]||0x0)+(_0x5d8986['countcongestionretry']||0x0)+(_0x5d8986[_0x1d13('0x16')]||0x0)+(_0x5d8986['countnosuchnumberretry']||0x0)+(_0x5d8986[_0x1d13('0x18')]||0x0)+(_0x5d8986[_0x1d13('0x19')]||0x0)+(_0x5d8986[_0x1d13('0x1a')]||0x0)+(_0x5d8986[_0x1d13('0x1b')]||0x0);this[_0x1d13('0x1c')]=_0x5d8986[_0x1d13('0x1c')]||0x0;this[_0x1d13('0x18')]=_0x5d8986['countdropretry']||0x0;this[_0x1d13('0x19')]=_0x5d8986[_0x1d13('0x19')]||0x0;this['countmachineretry']=_0x5d8986[_0x1d13('0x1a')]||0x0;this[_0x1d13('0x1b')]=_0x5d8986[_0x1d13('0x1b')]||0x0;this['callback']=_0x5d8986[_0x1d13('0x1d')];this[_0x1d13('0x1e')]=_0x5d8986['callbackuniqueid'];this[_0x1d13('0x1f')]=_0x5d8986[_0x1d13('0x1f')];this[_0x1d13('0x20')]=_0x5d8986[_0x1d13('0x20')];this[_0x1d13('0x21')]=_0x5d8986[_0x1d13('0x21')];this[_0x1d13('0x22')]=_0x5d8986[_0x1d13('0x22')];this['UserId']=_[_0x1d13('0x1')](_0x5d8986[_0x1d13('0xb')])?_0x5d8986[_0x1d13('0x23')]:_0x5d8986[_0x1d13('0xb')]['id'];this['VoiceQueueId']=_0x5d8986[_0x1d13('0x24')];this[_0x1d13('0x25')]='';this[_0x1d13('0x26')]='';}Action['prototype'][_0x1d13('0x27')]=function(){return util[_0x1d13('0x28')](_0x1d13('0x29'),this[_0x1d13('0x2a')],this[_0x1d13('0x2b')]);};module['exports']=Action; \ No newline at end of file +var _0xe681=['countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','util','isNil','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','active','calleridnum','phone','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry'];(function(_0x503ac6,_0x5ef9f5){var _0x3aa041=function(_0xd5fb4c){while(--_0xd5fb4c){_0x503ac6['push'](_0x503ac6['shift']());}};_0x3aa041(++_0x5ef9f5);}(_0xe681,0x128));var _0x1e68=function(_0x5ecc8d,_0x7b7f49){_0x5ecc8d=_0x5ecc8d-0x0;var _0x5c123a=_0xe681[_0x5ecc8d];return _0x5c123a;};'use strict';var util=require(_0x1e68('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x8e4e1c,_0x57a9fe,_0x5c8666){var _0x529924='';if(!_[_0x1e68('0x1')](_0x57a9fe)&&'string'===typeof _0x57a9fe){_0x529924+=_0x57a9fe;}if(!_[_0x1e68('0x1')](_0x5c8666)&&'string'===typeof _0x5c8666){_0x529924+='\x20'+_0x5c8666;}if(_0x529924!==''){return _0x529924;}return _0x8e4e1c;}function Action(_0x2cd961,_0x3e6f71,_0x3d3b2f,_0x42bfe3,_0x32747e){this['uniqueid']=_0x3d3b2f||undefined;this[_0x1e68('0x2')]=_0x2cd961['id'];this[_0x1e68('0x3')]=_0x3e6f71[_0x1e68('0x4')];this[_0x1e68('0x5')]=_0x3e6f71[_0x1e68('0x5')];this[_0x1e68('0x6')]=_0x1e68('0x3');this['dialAnswer']=![];this[_0x1e68('0x7')]=_[_0x1e68('0x1')](_0x2cd961['Agent'])?undefined:_0x2cd961[_0x1e68('0x8')][_0x1e68('0x4')];this[_0x1e68('0x9')]=this[_0x1e68('0x7')]?util[_0x1e68('0xa')](_0x1e68('0xb'),this[_0x1e68('0x7')]):_0x42bfe3||undefined;this[_0x1e68('0xc')]=checkNameSurname(_0x2cd961[_0x1e68('0xd')]['phone'],_0x2cd961['Contact']['firstName'],_0x2cd961[_0x1e68('0xd')]['lastName']);this['active']=_0x2cd961[_0x1e68('0xe')]||![];this[_0x1e68('0xf')]=_0x2cd961[_0x1e68('0xd')][_0x1e68('0x10')];this[_0x1e68('0x11')]=_0x2cd961['scheduledat'];this['countbusyretry']=_0x2cd961['countbusyretry']||0x0;this[_0x1e68('0x12')]=_0x2cd961['countcongestionretry']||0x0;this['countnoanswerretry']=_0x2cd961[_0x1e68('0x13')]||0x0;this[_0x1e68('0x14')]=(_0x2cd961[_0x1e68('0x15')]||0x0)+(_0x2cd961[_0x1e68('0x12')]||0x0)+(_0x2cd961[_0x1e68('0x13')]||0x0)+(_0x2cd961[_0x1e68('0x16')]||0x0)+(_0x2cd961[_0x1e68('0x17')]||0x0)+(_0x2cd961[_0x1e68('0x18')]||0x0)+(_0x2cd961['countmachineretry']||0x0)+(_0x2cd961[_0x1e68('0x19')]||0x0);this[_0x1e68('0x16')]=_0x2cd961[_0x1e68('0x16')]||0x0;this[_0x1e68('0x17')]=_0x2cd961[_0x1e68('0x17')]||0x0;this['countabandonedretry']=_0x2cd961[_0x1e68('0x18')]||0x0;this[_0x1e68('0x1a')]=_0x2cd961[_0x1e68('0x1a')]||0x0;this['countagentrejectretry']=_0x2cd961[_0x1e68('0x19')]||0x0;this[_0x1e68('0x1b')]=_0x2cd961['callback'];this[_0x1e68('0x1c')]=_0x2cd961[_0x1e68('0x1c')];this[_0x1e68('0x1d')]=_0x2cd961[_0x1e68('0x1d')];this[_0x1e68('0x1e')]=_0x2cd961[_0x1e68('0x1e')];this[_0x1e68('0x1f')]=_0x2cd961[_0x1e68('0x1f')];this[_0x1e68('0x20')]=_0x2cd961[_0x1e68('0x20')];this[_0x1e68('0x21')]=_['isNil'](_0x2cd961['Agent'])?_0x2cd961[_0x1e68('0x21')]:_0x2cd961['Agent']['id'];this[_0x1e68('0x22')]=_0x2cd961['VoiceQueueId'];this[_0x1e68('0x23')]='';this[_0x1e68('0x24')]='';}Action['prototype'][_0x1e68('0x25')]=function(){return util[_0x1e68('0xa')](_0x1e68('0x26'),this['calleridname'],this[_0x1e68('0x27')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 99d6415..d24411b 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 _0xe5b3=['syncNewExten','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','[clearZombieChannels][talking]','queue','pTalking:\x20','pTalking','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','recallMe','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','catch','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','uniqueid','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','total','logCustomer','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','linkedid','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Queue','lookAgent','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','addVariables','merge','toLowerVariables','variablesAction','syncOriginateResponse','actionid','logLookAgent','response','custom:agentringnoanswer','starttime','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','hangup','syncHangup','bind','syncHangupRequest','syncDialEnd'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3cd2c6,_0x33890a){_0x3cd2c6=_0x3cd2c6-0x0;var _0x407bdb=_0xe5b3[_0x3cd2c6];return _0x407bdb;};'use strict';var util=require('util');var _=require(_0x3e5b('0x0'));var BPromise=require(_0x3e5b('0x1'));var uuid=require(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var md5=require(_0x3e5b('0x4'));var Redis=require(_0x3e5b('0x5'));var config=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var loggerAction=require(_0x3e5b('0x7'))(_0x3e5b('0x9'));var ami=require('../ami');var rpcDb=require(_0x3e5b('0xa'));var Action=require(_0x3e5b('0xb'));var ut=require('./util/util');config[_0x3e5b('0xc')]=_[_0x3e5b('0xd')](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x3e5b('0xf')][_0x3e5b('0x10')]=function(_0x22fc1a){this[_0x3e5b('0x11')]=this[_0x3e5b('0x11')]?this['tail'][_0x3e5b('0x12')](_0x22fc1a):_0x22fc1a();};function Preview(_0x52efbd){this[_0x3e5b('0x13')]=new Sequence();this[_0x3e5b('0x14')]=_0x52efbd[_0x3e5b('0x15')];this[_0x3e5b('0x16')]=_0x52efbd[_0x3e5b('0x16')];this[_0x3e5b('0x17')]={};this[_0x3e5b('0x18')]=_0x52efbd['agents'];this[_0x3e5b('0x19')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x3e5b('0x1a'),this[_0x3e5b('0x1b')][_0x3e5b('0x1c')](this));ami['on']('hanguprequest',this[_0x3e5b('0x1d')]['bind'](this));ami['on']('dialend',this[_0x3e5b('0x1e')][_0x3e5b('0x1c')](this));ami['on']('newexten',this[_0x3e5b('0x1f')][_0x3e5b('0x1c')](this));ami['on']('varset',this[_0x3e5b('0x20')][_0x3e5b('0x1c')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x3e5b('0x1c')](this));ami['on'](_0x3e5b('0x21'),this[_0x3e5b('0x22')][_0x3e5b('0x1c')](this));this[_0x3e5b('0x23')](this[_0x3e5b('0x14')]);}function emit(_0x447d36,_0x21fc32,_0x36c988){io['to'](_0x447d36)[_0x3e5b('0x24')](_0x21fc32,_0x36c988);}function emitCampaignPreview(_0x2b977c){if(_0x2b977c[_0x3e5b('0x25')]===_0x3e5b('0x26')){var _0x402873={'id':_0x2b977c['id'],'name':_0x2b977c['name'],'strategy':_0x2b977c[_0x3e5b('0x27')],'answered':_0x2b977c[_0x3e5b('0x28')],'available':_0x2b977c[_0x3e5b('0x29')],'loggedIn':_0x2b977c[_0x3e5b('0x2a')],'pTalking':_0x2b977c['pTalking'],'sumBillable':_0x2b977c[_0x3e5b('0x2b')],'sumDuration':_0x2b977c['sumDuration'],'sumHoldTime':_0x2b977c[_0x3e5b('0x2c')]||0x0,'talking':_0x2b977c[_0x3e5b('0x2d')],'total':_0x2b977c['total'],'type':_0x2b977c[_0x3e5b('0x25')],'unmanaged':_0x2b977c[_0x3e5b('0x2e')],'abandoned':_0x2b977c[_0x3e5b('0x2f')],'waiting':_0x2b977c[_0x3e5b('0x30')],'loggedInDb':_0x2b977c[_0x3e5b('0x31')],'dialActive':_0x2b977c[_0x3e5b('0x32')],'dialMethod':_0x2b977c[_0x3e5b('0x33')],'dialOriginateCallerIdName':_0x2b977c[_0x3e5b('0x34')],'dialOriginateCallerIdNumber':_0x2b977c['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x2b977c[_0x3e5b('0x35')],'dialPrefix':_0x2b977c['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2b977c[_0x3e5b('0x36')],'outboundAnswerCallsDay':_0x2b977c['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2b977c[_0x3e5b('0x37')],'outboundBusyCallsDay':_0x2b977c[_0x3e5b('0x38')],'outboundCongestionCallsDay':_0x2b977c[_0x3e5b('0x39')],'outboundDropCallsDayACS':_0x2b977c[_0x3e5b('0x3a')],'outboundDropCallsDayCallersExit':_0x2b977c[_0x3e5b('0x3b')],'outboundDropCallsDayTimeout':_0x2b977c[_0x3e5b('0x3c')],'outboundNoAnswerCallsDay':_0x2b977c[_0x3e5b('0x3d')],'outboundNoSuchCallsDay':_0x2b977c[_0x3e5b('0x3e')],'outboundOriginateFailureCallsDay':_0x2b977c[_0x3e5b('0x3f')],'outboundReCallsDay':_0x2b977c[_0x3e5b('0x40')],'outboundRejectCallsDay':_0x2b977c[_0x3e5b('0x41')],'outboundUnknownCallsDay':_0x2b977c['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x2b977c[_0x3e5b('0x42')],'predictiveIntervalAnsweredCalls':_0x2b977c[_0x3e5b('0x43')],'predictiveIntervalAvgHoldtime':_0x2b977c[_0x3e5b('0x44')],'predictiveIntervalAvgTalktime':_0x2b977c[_0x3e5b('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x2b977c[_0x3e5b('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x2b977c[_0x3e5b('0x47')],'predictiveIntervalErlangCalls':_0x2b977c[_0x3e5b('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x2b977c['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2b977c[_0x3e5b('0x49')],'predictiveIntervalMultiplicativeFactor':_0x2b977c['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2b977c['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2b977c[_0x3e5b('0x4a')],'predictiveIntervalTotalCalls':_0x2b977c[_0x3e5b('0x4b')],'message':_0x2b977c['message'],'originated':_0x2b977c[_0x3e5b('0x4c')],'erlangCalls':_0x2b977c[_0x3e5b('0x4d')],'erlangCallToSecond':_0x2b977c[_0x3e5b('0x4e')],'erlangAbandonmentRate':_0x2b977c[_0x3e5b('0x4f')],'erlangBusyFactor':_0x2b977c[_0x3e5b('0x50')],'startPredictive':_0x2b977c[_0x3e5b('0x51')],'startProgressive':_0x2b977c[_0x3e5b('0x52')]};if(_0x2b977c[_0x3e5b('0x53')]){_0x402873[_0x3e5b('0x53')]={'id':_0x2b977c[_0x3e5b('0x53')]['id'],'name':_0x2b977c[_0x3e5b('0x53')][_0x3e5b('0x54')],'active':_0x2b977c['Trunk'][_0x3e5b('0x55')],'callerid':_0x2b977c[_0x3e5b('0x53')]['callerid']};}if(_0x2b977c['Interval']){_0x402873[_0x3e5b('0x56')]={'id':_0x2b977c['Interval']['id'],'name':_0x2b977c[_0x3e5b('0x56')][_0x3e5b('0x54')]};}var _0xb2349c=md5(JSON[_0x3e5b('0x57')](_0x402873));if(_0x2b977c['md5']!==_0xb2349c){_0x2b977c[_0x3e5b('0x4')]=_0xb2349c;emit(util['format'](_0x3e5b('0x58'),_0x402873['name']),'voice_queue:save',_0x402873);}}}function emitVoiceQueueChannelRemove(_0x48f414){logger[_0x3e5b('0x59')](_0x3e5b('0x5a'),JSON[_0x3e5b('0x57')](_0x48f414));emit(util[_0x3e5b('0x5b')](_0x3e5b('0x58'),_0x48f414[_0x3e5b('0x54')]),'voice_queue_channel:remove',_0x48f414);io['emit']('voice_queue_presence:remove',_0x48f414);}function notSendMessagesQueue(_0x565319){if(_0x565319['sendMessageOneNotActive']){if(_0x565319['originated']===0x0&&_0x565319['pTalking']===0x0){_0x565319[_0x3e5b('0x5c')]=![];_0x565319[_0x3e5b('0x29')]=0x0;_0x565319[_0x3e5b('0x5d')]=0x0;_0x565319[_0x3e5b('0x5e')]=_0x3e5b('0x5f');ut[_0x3e5b('0x60')](_0x3e5b('0x61'),_0x565319[_0x3e5b('0x54')]+_0x3e5b('0x62'));}else{_0x565319[_0x3e5b('0x5e')]=_0x3e5b('0x63');ut['logger'](_0x3e5b('0x61'),_0x565319[_0x3e5b('0x54')]+_0x3e5b('0x64'));}emitCampaignPreview(_0x565319);}}Preview[_0x3e5b('0xf')][_0x3e5b('0x23')]=function(){var _0xc69499=this;setInterval(function(){_0xc69499[_0x3e5b('0x65')]();},0x7cf);};Preview[_0x3e5b('0xf')][_0x3e5b('0x65')]=function(){var _0x39da3f=this[_0x3e5b('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x598ab4 in _0x39da3f){if(_0x39da3f['hasOwnProperty'](_0x598ab4)&&(_0x39da3f[_0x598ab4]['dialMethod']===_0x3e5b('0x8')||_0x39da3f[_0x598ab4][_0x3e5b('0x33')]===_0x3e5b('0x66'))&&_0x39da3f[_0x598ab4][_0x3e5b('0x25')]===_0x3e5b('0x26')){if(this[_0x3e5b('0x19')]>0x7){this[_0x3e5b('0x19')]=0x0;this[_0x3e5b('0x67')]();}}if(_0x39da3f[_0x3e5b('0x68')](_0x598ab4)&&_0x39da3f[_0x598ab4][_0x3e5b('0x33')]==='preview'&&_0x39da3f[_0x598ab4][_0x3e5b('0x25')]===_0x3e5b('0x26')){if(_0x39da3f[_0x598ab4][_0x3e5b('0x32')]){this[_0x3e5b('0x69')](_0x39da3f[_0x598ab4]);if(_0x39da3f[_0x598ab4][_0x3e5b('0x6a')])this['recallMe'](_0x39da3f[_0x598ab4]);}else{notSendMessagesQueue(_0x39da3f[_0x598ab4]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x1fbd87){var _0x20af6a=this;this[_0x3e5b('0x13')]['enqueue'](function(){if(!_['isNil'](_0x20af6a[_0x3e5b('0x17')][_0x1fbd87])){loggerAction[_0x3e5b('0x59')](_0x3e5b('0x6b'),_0x1fbd87,'Queue',_0x20af6a['actions'][_0x1fbd87][_0x3e5b('0x6c')],'originated:\x20',JSON[_0x3e5b('0x57')](_0x20af6a[_0x3e5b('0x14')][_0x20af6a[_0x3e5b('0x17')][_0x1fbd87][_0x3e5b('0x6c')]][_0x3e5b('0x4c')]),_0x3e5b('0x6d'),JSON[_0x3e5b('0x57')](_0x20af6a[_0x3e5b('0x14')][_0x20af6a[_0x3e5b('0x17')][_0x1fbd87]['queue']][_0x3e5b('0x6e')]),JSON['stringify'](_0x20af6a[_0x3e5b('0x17')][_0x1fbd87][_0x3e5b('0x6f')]),JSON[_0x3e5b('0x57')](_[_0x3e5b('0x70')](_0x20af6a[_0x3e5b('0x17')][_0x1fbd87],[_0x3e5b('0x71'),_0x3e5b('0x72'),_0x3e5b('0x73'),_0x3e5b('0x74')])));return ami[_0x3e5b('0x75')]({'action':_0x3e5b('0x76'),'channel':_0x20af6a[_0x3e5b('0x17')][_0x1fbd87][_0x3e5b('0x77')]})['catch'](function(_0x6104b0){if(_0x6104b0[_0x3e5b('0x5e')]===_0x3e5b('0x78')){setTimeout(function(){if(_0x20af6a[_0x3e5b('0x17')][_0x1fbd87]){ut[_0x3e5b('0x79')](_0x20af6a[_0x3e5b('0x14')][_0x20af6a['actions'][_0x1fbd87][_0x3e5b('0x6c')]],_0x3e5b('0x7a'));if(_0x20af6a[_0x3e5b('0x17')][_0x1fbd87][_0x3e5b('0x6f')]===!![]){ut[_0x3e5b('0x7b')](_0x20af6a[_0x3e5b('0x14')][_0x20af6a[_0x3e5b('0x17')][_0x1fbd87][_0x3e5b('0x6c')]],'[clearZombieChannel]');ut[_0x3e5b('0x7c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1fbd87,_0x20af6a['actions'][_0x1fbd87][_0x3e5b('0x6c')]);}ut['loggerError'](_0x3e5b('0x7d')+_0x1fbd87,_0x20af6a[_0x3e5b('0x17')][_0x1fbd87][_0x3e5b('0x6c')]);delete _0x20af6a[_0x3e5b('0x17')][_0x1fbd87];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x545712=this;loggerAction['info'](_0x3e5b('0x7e'),_[_0x3e5b('0x7f')](this[_0x3e5b('0x17')]));for(var _0x4149c8 in this[_0x3e5b('0x17')]){if(_0x545712['actions']['hasOwnProperty'](_0x4149c8)){_0x545712[_0x3e5b('0x80')](_0x4149c8);}}};Preview[_0x3e5b('0xf')][_0x3e5b('0x81')]=function(_0x325f7b){var _0x3db8bd=this;rpcDb['getContactRecallMe'](_0x325f7b['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x3563b0){if(!_[_0x3e5b('0x82')](_0x3563b0)){for(var _0x3088d4=0x0;_0x3088d4<_0x3563b0[_0x3e5b('0x83')];_0x3088d4+=0x1){if(ut[_0x3e5b('0x84')](_0x3563b0[_0x3088d4][_0x3e5b('0x85')])<_0x325f7b[_0x3e5b('0x86')]*0x3c){if(_0x3563b0[_0x3088d4][_0x3e5b('0x87')]&&!_0x3563b0[_0x3088d4]['Agent'][_0x3e5b('0x88')]){_0x3db8bd[_0x3e5b('0x89')](_0x3563b0[_0x3088d4]['id'])[_0x3e5b('0x8a')](ut[_0x3e5b('0x8b')](_0x3e5b('0x8c')))['catch'](ut[_0x3e5b('0x8b')]('[RecallMe]'));}else{rpcDb[_0x3e5b('0x8d')](_0x3563b0[_0x3088d4]['id']);}}else{var _0x1fd40c=new Action(_0x3563b0[_0x3088d4],_0x325f7b);_0x1fd40c['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x325f7b[_0x3e5b('0x40')]+=0x1;ut['logCustomer'](_0x1fd40c,0x17,_0x3e5b('0x8e'));if(_0x325f7b[_0x3e5b('0x8f')]){rpcDb[_0x3e5b('0x90')](ut[_0x3e5b('0x91')](_0x3563b0[_0x3088d4]));rpcDb[_0x3e5b('0x92')](_0x1fd40c,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x1fd40c,0x16,_0x3e5b('0x93'));rpcDb[_0x3e5b('0x92')](_0x1fd40c,_0x3e5b('0x94'));rpcDb['createCustomerFinal'](_0x1fd40c,_0x3e5b('0x94'));}}}}})[_0x3e5b('0x95')](ut[_0x3e5b('0x8b')](_0x3e5b('0x96')));};Preview[_0x3e5b('0xf')][_0x3e5b('0x69')]=function(_0x455594){_0x455594[_0x3e5b('0x5c')]=!![];if(ut[_0x3e5b('0x97')](_0x455594[_0x3e5b('0x2a')])){_0x455594[_0x3e5b('0x5e')]=_0x3e5b('0x98');}else if(!ut[_0x3e5b('0x99')](_0x455594[_0x3e5b('0x32')])){_0x455594[_0x3e5b('0x5e')]=_0x3e5b('0x5f');}else if(!this[_0x3e5b('0x9a')](_0x455594[_0x3e5b('0x53')])){if(!this['isTrunkReachable'](_0x455594[_0x3e5b('0x9b')])){_0x455594[_0x3e5b('0x5e')]='TRUNK_IS_NOT_REACHABLE';}else{_0x455594[_0x3e5b('0x5e')]=_0x3e5b('0x9c');}}else{_0x455594['message']='ACTIVE';}emitCampaignPreview(_0x455594);};Preview['prototype'][_0x3e5b('0x9d')]=function(_0x465826,_0x498e6d,_0x2929ba){var _0x1f3a1e=this;var _0x47b810=this[_0x3e5b('0x17')][_0x498e6d];var _0x17f60f=this[_0x3e5b('0x14')][_0x47b810[_0x3e5b('0x6c')]];var _0x35ec82;if(_0x17f60f){switch(_0x2929ba){case'1':_0x17f60f[_0x3e5b('0x3e')]+=0x1;_0x47b810[_0x3e5b('0x9e')]+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut['logCustomer'](_0x47b810,0x0,_0x3e5b('0xa1'));ami[_0x3e5b('0x24')](_0x3e5b('0xa2'),ut[_0x3e5b('0xa3')](_0x47b810,_0x3e5b('0xa4')));rpcDb[_0x3e5b('0x92')](_0x47b810,_0x3e5b('0xa5'));if(ut['totalGlobal'](_0x47b810)>=_0x17f60f['dialGlobalMaxRetry']){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb['createCustomerFinal'](_0x35ec82,_0x3e5b('0xa8'));}else{if(_0x47b810[_0x3e5b('0x9e')]>=_0x17f60f[_0x3e5b('0xa9')]){rpcDb[_0x3e5b('0xaa')](_0x47b810,_0x3e5b('0xa8'));}else{rpcDb[_0x3e5b('0xab')](ut[_0x3e5b('0xac')](_0x47b810,'countnosuchnumberretry',_0x17f60f[_0x3e5b('0xad')]),_0x47b810[_0x3e5b('0xae')],_0x47b810['activeContact']);}}delete this['actions'][_0x465826['linkedid']];break;case _0x3e5b('0xaf'):var _0x141393=moment()[_0x3e5b('0x5b')](_0x3e5b('0xb0'));_0x47b810[_0x3e5b('0xb1')]=_0x141393;_0x47b810[_0x3e5b('0xb2')]=_0x141393;_0x47b810['dialAnswer']=!![];_0x17f60f[_0x3e5b('0x6e')]+=0x1;logger[_0x3e5b('0x59')]('[syncHangup][talking][increment]',_0x47b810[_0x3e5b('0xb3')],'\x20Queue',_0x17f60f['name'],_0x3e5b('0x6d'),_0x17f60f[_0x3e5b('0x6e')]);ami['emit'](_0x3e5b('0xb4'),ut[_0x3e5b('0xa3')](_0x47b810,'connect',this[_0x3e5b('0x14')][_0x47b810[_0x3e5b('0x6c')]]));if(_0x17f60f[_0x3e5b('0xb5')]){ami[_0x3e5b('0x24')](_0x3e5b('0xb6'),ut[_0x3e5b('0xb7')](_0x47b810));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x3e5b('0xa3')](_0x47b810,'complete',this['campaignsPreview'][_0x47b810[_0x3e5b('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0x3e5b('0xa3')](_0x47b810,_0x3e5b('0xb8')));_0x17f60f['outboundAnswerCallsDay']+=0x1;_0x17f60f[_0x3e5b('0xb9')]+=0x1;_0x17f60f['answered']+=0x1;ut[_0x3e5b('0x7b')](_0x17f60f,'[16]');_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut[_0x3e5b('0xba')](_0x47b810,0x4,_0x3e5b('0xbb'));rpcDb['createCustomerHistory'](_0x47b810,_0x3e5b('0xbc'));rpcDb['createCustomerFinal'](_0x47b810,_0x3e5b('0xbd'));rpcDb[_0x3e5b('0xbe')](_0x47b810);_0x17f60f['sumDuration']+=_0x47b810[_0x3e5b('0xbf')];_0x17f60f[_0x3e5b('0x2b')]+=_0x47b810[_0x3e5b('0xbf')];logger['info'](_0x3e5b('0xc0'),_0x47b810[_0x3e5b('0xb3')],_0x3e5b('0xc1'),_0x17f60f['name'],_0x3e5b('0x6d'),_0x17f60f[_0x3e5b('0x6e')]);delete this['actions'][_0x465826[_0x3e5b('0xc2')]];break;case _0x3e5b('0xc3'):_0x17f60f[_0x3e5b('0x38')]+=0x1;_0x47b810['countbusyretry']+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut[_0x3e5b('0xba')](_0x47b810,0x5,_0x3e5b('0xc4'));ami['emit'](_0x3e5b('0xc5'),ut['buildObj'](_0x47b810,_0x3e5b('0xc6')));rpcDb['createCustomerHistory'](_0x47b810,_0x3e5b('0xc7'));if(ut[_0x3e5b('0xa0')](_0x47b810)>=_0x17f60f['dialGlobalMaxRetry']){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb['createCustomerFinal'](_0x35ec82,_0x3e5b('0xc8'));}else{if(_0x47b810[_0x3e5b('0xc9')]>=_0x17f60f[_0x3e5b('0xca')]){rpcDb[_0x3e5b('0xaa')](_0x47b810,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x3e5b('0xac')](_0x47b810,_0x3e5b('0xc9'),_0x17f60f[_0x3e5b('0xcb')]),_0x47b810[_0x3e5b('0xae')],_0x47b810[_0x3e5b('0xcc')]);}}break;case _0x3e5b('0xcd'):_0x17f60f['outboundNoAnswerCallsDay']+=0x1;_0x47b810['countnoanswerretry']+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut[_0x3e5b('0xba')](_0x47b810,0x3,_0x3e5b('0xce'));ami[_0x3e5b('0x24')](_0x3e5b('0xcf'),ut[_0x3e5b('0xa3')](_0x47b810,_0x3e5b('0xd0')));rpcDb['createCustomerHistory'](_0x47b810,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x3e5b('0xa0')](_0x47b810)>=_0x17f60f['dialGlobalMaxRetry']){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb[_0x3e5b('0xaa')](_0x35ec82,_0x3e5b('0xd1'));}else{if(_0x47b810[_0x3e5b('0xd2')]>=_0x17f60f[_0x3e5b('0xd3')]){rpcDb[_0x3e5b('0xaa')](_0x47b810,_0x3e5b('0xd4'));}else{rpcDb[_0x3e5b('0xab')](ut[_0x3e5b('0xac')](_0x47b810,_0x3e5b('0xd2'),_0x17f60f[_0x3e5b('0xd5')]),_0x47b810[_0x3e5b('0xae')],_0x47b810['activeContact']);}}break;case'CONGESTION':_0x17f60f[_0x3e5b('0x39')]+=0x1;_0x47b810[_0x3e5b('0xd6')]+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut['logCustomer'](_0x47b810,0x8,_0x3e5b('0xd7'));ami['emit'](_0x3e5b('0xd8'),ut['buildObj'](_0x47b810,_0x3e5b('0xd9')));rpcDb[_0x3e5b('0x92')](_0x47b810,_0x3e5b('0xda'));if(ut[_0x3e5b('0xa0')](_0x47b810)>=_0x17f60f[_0x3e5b('0xdb')]){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb[_0x3e5b('0xaa')](_0x35ec82,_0x3e5b('0xdc'));}else{if(_0x47b810['countcongestionretry']>=_0x17f60f[_0x3e5b('0xdd')]){rpcDb[_0x3e5b('0xaa')](_0x47b810,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x3e5b('0xab')](ut[_0x3e5b('0xac')](_0x47b810,_0x3e5b('0xd6'),_0x17f60f[_0x3e5b('0xcb')]),_0x47b810[_0x3e5b('0xae')],_0x47b810[_0x3e5b('0xcc')]);}}break;case _0x3e5b('0xde'):_0x17f60f[_0x3e5b('0x41')]+=0x1;_0x47b810[_0x3e5b('0xdf')]+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut[_0x3e5b('0xba')](_0x47b810,0x14,'AgentReject');ami[_0x3e5b('0x24')](_0x3e5b('0xe0'),ut['buildObj'](_0x47b810,'agentreject'));rpcDb[_0x3e5b('0x92')](_0x47b810,_0x3e5b('0xe1'));if(ut[_0x3e5b('0xa0')](_0x47b810)>=_0x17f60f[_0x3e5b('0xdb')]){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0x14,'AgentReject');rpcDb[_0x3e5b('0xaa')](_0x35ec82,_0x3e5b('0xe2'));}else{if(_0x47b810['countagentrejectretry']>=_0x17f60f['dialAgentRejectMaxRetry']){rpcDb[_0x3e5b('0xaa')](_0x47b810,_0x3e5b('0xe2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x47b810,_0x3e5b('0xdf'),_0x17f60f[_0x3e5b('0xe3')]),_0x47b810['unlockAgent'],_0x47b810[_0x3e5b('0xcc')]);}}break;case _0x3e5b('0xe4'):_0x17f60f[_0x3e5b('0x42')]+=0x1;_0x47b810[_0x3e5b('0xe5')]+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut['totalGlobal'](_0x47b810);ut['logCustomer'](_0x47b810,0xb,_0x3e5b('0xe6'));rpcDb[_0x3e5b('0x92')](_0x47b810,_0x3e5b('0xe7'));if(ut[_0x3e5b('0xa0')](_0x47b810)>=_0x17f60f[_0x3e5b('0xdb')]){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb[_0x3e5b('0xaa')](_0x35ec82,_0x3e5b('0xe7'));}else{if(_0x47b810[_0x3e5b('0xe8')]>=_0x17f60f[_0x3e5b('0xe9')]){rpcDb[_0x3e5b('0xaa')](_0x47b810,_0x3e5b('0xe7'));}else{rpcDb[_0x3e5b('0xab')](ut[_0x3e5b('0xac')](_0x47b810,_0x3e5b('0xe5'),_0x17f60f[_0x3e5b('0xea')]),_0x47b810[_0x3e5b('0xae')],_0x47b810[_0x3e5b('0xcc')]);}}break;case'18':_0x17f60f[_0x3e5b('0xeb')]+=0x1;_0x47b810[_0x3e5b('0xec')]+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut[_0x3e5b('0xba')](_0x47b810,0x12,_0x465826[_0x3e5b('0xed')]||_0x465826['dialstatus']);ami['emit'](_0x3e5b('0xee'),ut[_0x3e5b('0xa3')](_0x47b810,_0x3e5b('0xef')));rpcDb[_0x3e5b('0x92')](_0x47b810,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x3e5b('0xa0')](_0x47b810)>=_0x17f60f['dialGlobalMaxRetry']){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb[_0x3e5b('0xaa')](_0x35ec82,_0x3e5b('0xf0'));}else{rpcDb[_0x3e5b('0xaa')](_0x47b810,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x3e5b('0x17')][_0x465826[_0x3e5b('0xc2')]];break;case'19':_0x17f60f[_0x3e5b('0xeb')]+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut[_0x3e5b('0xba')](_0x47b810,0x13,_0x465826['cause-txt']||_0x465826['dialstatus']);ami[_0x3e5b('0x24')]('custom:amd',ut[_0x3e5b('0xa3')](_0x47b810,_0x3e5b('0xef')));rpcDb[_0x3e5b('0x92')](_0x47b810,_0x3e5b('0xf1'));if(ut['totalGlobal'](_0x47b810)>=_0x17f60f['dialGlobalMaxRetry']){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb[_0x3e5b('0xaa')](_0x35ec82,_0x3e5b('0xf1'));}else{rpcDb[_0x3e5b('0xaa')](_0x47b810,_0x3e5b('0xf1'));}delete this['actions'][_0x465826['linkedid']];break;default:if(_0x47b810[_0x3e5b('0x6f')]){ut[_0x3e5b('0x7b')](_0x17f60f,_0x3e5b('0xf2'));ut[_0x3e5b('0x7c')](_0x3e5b('0xf3')+_0x17f60f[_0x3e5b('0x54')],_0x465826);}_0x17f60f[_0x3e5b('0xeb')]+=0x1;_0x47b810[_0x3e5b('0x9f')]=ut[_0x3e5b('0xa0')](_0x47b810);ut[_0x3e5b('0xba')](_0x47b810,0xc,_0x465826[_0x3e5b('0xed')]||_0x465826[_0x3e5b('0xf4')]);rpcDb[_0x3e5b('0x92')](_0x47b810,_0x3e5b('0xf5'));if(ut[_0x3e5b('0xa0')](_0x47b810)>=_0x17f60f['dialGlobalMaxRetry']){_0x35ec82=ut[_0x3e5b('0xa6')](_0x47b810,0xf,_0x3e5b('0xa7'));rpcDb[_0x3e5b('0xaa')](_0x35ec82,_0x3e5b('0xf6'));}else{rpcDb[_0x3e5b('0xaa')](_0x47b810,_0x3e5b('0xf6'));}delete this[_0x3e5b('0x17')][_0x465826['linkedid']];}if(!(_0x47b810[_0x3e5b('0x6f')]&&_0x2929ba==='16')){ut[_0x3e5b('0x79')](_0x17f60f,_0x3e5b('0xf7'));logger[_0x3e5b('0x59')]('[originated][decrement][callProgressDetectingCustomer]',_0x47b810[_0x3e5b('0xb3')],_0x3e5b('0xc1'),_0x17f60f[_0x3e5b('0x54')],_0x3e5b('0xf8'),_0x17f60f[_0x3e5b('0x4c')]);}if(_0x2929ba!==_0x3e5b('0xaf')){delete this[_0x3e5b('0x17')][_0x465826[_0x3e5b('0xc2')]];delete this[_0x3e5b('0x17')][_0x465826[_0x3e5b('0xf9')]];}}};Preview[_0x3e5b('0xf')][_0x3e5b('0xfa')]=function(_0x4c8209,_0x22820d,_0x2231f2){if(_[_0x3e5b('0xfb')](_0x22820d)&&_0x3e5b('0xfc')!==typeof _0x22820d){return;}if(_[_0x3e5b('0xfb')](_0x2231f2)&&_0x3e5b('0xfc')!==typeof _0x2231f2){return;}switch(_0x2231f2[_0x3e5b('0xfd')]){case'0':ut[_0x3e5b('0xfe')](_0x4c8209,0x0,_0x3e5b('0xa1'));rpcDb['createAgentHistory'](_0x4c8209,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3e5b('0xfe')](_0x4c8209,0x3,_0x3e5b('0xce'));rpcDb[_0x3e5b('0xff')](_0x4c8209,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x3e5b('0xfe')](_0x4c8209,0x5,_0x3e5b('0xc4'));rpcDb['createAgentHistory'](_0x4c8209,_0x3e5b('0x100'));break;case'8':ut[_0x3e5b('0xfe')](_0x4c8209,0x8,_0x3e5b('0xd7'));rpcDb[_0x3e5b('0xff')](_0x4c8209,_0x3e5b('0x101'));break;case'22':ut[_0x3e5b('0xfe')](_0x4c8209,0x16,_0x3e5b('0x102'));rpcDb[_0x3e5b('0xff')](_0x4c8209,_0x3e5b('0x103'));break;default:ut[_0x3e5b('0xfe')](_0x4c8209,0xc,_0x2231f2['reason']);rpcDb[_0x3e5b('0xff')](_0x4c8209,'[callProgressDetectingAgent][logCongestion]');}ut[_0x3e5b('0x79')](_0x22820d,_0x3e5b('0x104'));logger[_0x3e5b('0x59')](_0x3e5b('0x105'),_0x4c8209[_0x3e5b('0xb3')],'\x20Queue',_0x22820d[_0x3e5b('0x54')],_0x3e5b('0xf8'),_0x22820d[_0x3e5b('0x4c')]);delete this[_0x3e5b('0x17')][_0x4c8209[_0x3e5b('0xb3')]];};Preview[_0x3e5b('0xf')][_0x3e5b('0x106')]=function(_0x5d41f4,_0xef28e4,_0x36e032,_0x5027ef,_0x376672){var _0xa93df2=this;return new BPromise(function(_0x4fe9ed,_0x50290f){if(_['isNil'](_0xef28e4)||_[_0x3e5b('0x82')](_0xef28e4[_0x3e5b('0x107')])||_[_0x3e5b('0x82')](_0xef28e4['Contact']['phone'])||_[_0x3e5b('0x82')](_0xef28e4[_0x3e5b('0x73')])){_0x50290f(ut['message']('Contact\x20is\x20undefined',_0x5027ef,_0x376672));return;}var _0x59b97e=uuid['v4']();var _0x374c7a=_0xa93df2[_0x3e5b('0x14')][_0xef28e4[_0x3e5b('0x108')][_0x3e5b('0x54')]];var _0x543d09=_0x36e032?_0xa93df2[_0x3e5b('0x18')][_0x36e032]['id']:undefined;_0xa93df2[_0x3e5b('0x17')][_0x59b97e]=new Action(_0xef28e4,_0x374c7a,_0x59b97e,_0x36e032,_0x543d09);var _0x6dc9ea=_0xa93df2['actions'][_0x59b97e];_0x6dc9ea[_0x3e5b('0xae')]=_0x5027ef;_0x6dc9ea[_0x3e5b('0xcc')]=_0x376672;_0x6dc9ea[_0x3e5b('0x109')]=_0x36e032;if(_['isEmpty'](_0x5d41f4)){_0xa93df2['execCall'](_0x6dc9ea,_0x374c7a,_0xef28e4,_0x36e032)[_0x3e5b('0x8a')](function(_0xab370e){logger[_0x3e5b('0x59')](_0x3e5b('0x10a'),_0x3e5b('0x10b')+_0x6dc9ea['queue']+_0x3e5b('0x10c')+_0x6dc9ea[_0x3e5b('0x10d')],JSON[_0x3e5b('0x57')](_0xab370e));ami[_0x3e5b('0x24')](_0x3e5b('0x10e'),ut[_0x3e5b('0xa3')](_0x6dc9ea,'called',_0xa93df2[_0x3e5b('0x14')][_0x6dc9ea[_0x3e5b('0x6c')]]));_0x4fe9ed(ut[_0x3e5b('0x5e')]('Calling'));})[_0x3e5b('0x95')](function(_0x2dd452){ut[_0x3e5b('0x60')](_0x3e5b('0x10f'),_0x2dd452);_0x50290f(ut[_0x3e5b('0x5e')]('Call\x20failed',_0x5027ef,_0x376672));});}else{_0x374c7a['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x6dc9ea);rpcDb['createHistory'](_0x6dc9ea,'[Blacklist][error]');delete _0xa93df2[_0x3e5b('0x17')][_0x59b97e];_0x50290f(ut[_0x3e5b('0x5e')](_0x3e5b('0x110'),_0x5027ef,_0x376672));}});};Preview['prototype'][_0x3e5b('0x9a')]=function(_0x5548d3){return!_['isNil'](_0x5548d3)&&!_[_0x3e5b('0x82')](_0x5548d3[_0x3e5b('0x54')])&&!_['isNil'](_0x5548d3[_0x3e5b('0x55')])&&_0x5548d3['active']&&!_[_0x3e5b('0x82')](this['trunks'][util[_0x3e5b('0x5b')](_0x3e5b('0x111'),_0x5548d3[_0x3e5b('0x54')])])&&!_[_0x3e5b('0x82')](this['trunks'][util[_0x3e5b('0x5b')](_0x3e5b('0x111'),_0x5548d3[_0x3e5b('0x54')])][_0x3e5b('0x76')])&&(this[_0x3e5b('0x16')][util['format'](_0x3e5b('0x111'),_0x5548d3[_0x3e5b('0x54')])]['status']===_0x3e5b('0x112')||this['trunks'][util[_0x3e5b('0x5b')](_0x3e5b('0x111'),_0x5548d3[_0x3e5b('0x54')])]['status']==='unmonitored');};Preview['prototype']['run']=function(_0x814ed6,_0x3b06ea){var _0x93aa1b=this;return new BPromise(function(_0x5515d0,_0x4f6767){_0x93aa1b['execRun'](_0x814ed6,_0x3b06ea)['then'](function(_0x296438){_0x5515d0(_[_0x3e5b('0x70')](_0x296438,[_0x3e5b('0x5e')]));})['catch'](function(_0xed66d7){if(_0xed66d7[_0x3e5b('0x113')]){rpcDb[_0x3e5b('0x114')](_0x814ed6);}if(_0xed66d7['active']){rpcDb[_0x3e5b('0x8d')](_0x814ed6);}_0x4f6767(_['pick'](_0xed66d7,[_0x3e5b('0x5e')]));});});};Preview['prototype'][_0x3e5b('0x115')]=function(_0x3b4b70,_0x408741){var _0x414b50=this;return new BPromise(function(_0x10fc88,_0x127d75){var _0x370c16,_0x558409;rpcDb[_0x3e5b('0x116')](_0x3b4b70)['then'](function(_0x259c6d){if(!_['isNil'](_0x259c6d[0x0])){_0x558409=_0x259c6d[0x0][_0x3e5b('0x117')]?![]:!![];_0x370c16=_0x259c6d[0x0]['recallme']?!![]:![];_0x370c16=_0x408741?!![]:_0x370c16;}var _0x39d52e=_0x414b50[_0x3e5b('0x118')](_0x259c6d);if(_0x39d52e[_0x3e5b('0x119')]){rpcDb[_0x3e5b('0x11a')](_[_0x3e5b('0x70')](_0x259c6d[0x0],[_0x3e5b('0x73'),_0x3e5b('0x11b')]))['then'](function(_0x48ae5b){_0x414b50[_0x3e5b('0x106')](_0x48ae5b,_0x259c6d[0x0],_0x408741,_0x558409,_0x370c16)[_0x3e5b('0x8a')](function(_0x21a2a6){_0x10fc88(_0x21a2a6);})['catch'](function(_0x4a1cba){_0x127d75(_0x4a1cba);});})[_0x3e5b('0x95')](function(_0x559ab2){ut[_0x3e5b('0x60')](_0x3e5b('0x11c'),_0x559ab2);_0x127d75(ut[_0x3e5b('0x5e')](_0x3e5b('0x11d'),_0x558409,_0x370c16));});}else{_0x127d75(ut[_0x3e5b('0x5e')](_0x39d52e[_0x3e5b('0x5e')],_0x558409,_0x370c16));}})[_0x3e5b('0x95')](function(_0x410b7f){ut[_0x3e5b('0x60')]('[Preview][getContactPreview]',_0x410b7f);_0x127d75(ut[_0x3e5b('0x5e')](_0x3e5b('0x11d'),![],!![]));});});};Preview['prototype'][_0x3e5b('0x118')]=function(_0x1d273f){if(_['isNil'](_0x1d273f)||_[_0x3e5b('0x11e')](_0x1d273f)||!_[_0x3e5b('0x82')](_0x1d273f[0x0]['Agent'])&&_[_0x3e5b('0x82')](_0x1d273f[0x0]['Agent'][_0x3e5b('0x54')])){ut['logger'](_0x3e5b('0x11f'),_0x1d273f);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1fb82d=this[_0x3e5b('0x14')][_0x1d273f[0x0][_0x3e5b('0x108')][_0x3e5b('0x54')]];_0x1fb82d[_0x3e5b('0x5e')]=_0x3e5b('0x9c');if(_[_0x3e5b('0x82')](_0x1fb82d)){ut['logger'](_0x3e5b('0x120'),_0x1fb82d);return{'isValid':![],'message':_0x3e5b('0x121')};}if(!this[_0x3e5b('0x9a')](_0x1fb82d[_0x3e5b('0x53')])){ut[_0x3e5b('0x60')](_0x3e5b('0x122'),_0x3e5b('0x123')+_0x1fb82d[_0x3e5b('0x54')]+_0x3e5b('0x124'));if(!this[_0x3e5b('0x9a')](_0x1fb82d[_0x3e5b('0x9b')])){ut[_0x3e5b('0x60')](_0x3e5b('0x122'),_0x1fb82d['name']+_0x3e5b('0x125'));return{'isValid':![],'message':_0x3e5b('0x126')};}}if(!ut[_0x3e5b('0x99')](_0x1fb82d[_0x3e5b('0x32')])){ut[_0x3e5b('0x60')](_0x3e5b('0x127'),_0x1fb82d[_0x3e5b('0x54')]+_0x3e5b('0x128'));return{'isValid':![],'message':_0x3e5b('0x123')+_0x1fb82d[_0x3e5b('0x54')]+_0x3e5b('0x128')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0xb291c3,_0x34bcd8,_0x1c05c5,_0x438fca){var _0x2f96b7=this;return new BPromise(function(_0x268453,_0x285820){var _0x156c73=_0xb291c3['uniqueid'];var _0x1b4d1b=_0x2f96b7[_0x3e5b('0x9a')](_0x34bcd8[_0x3e5b('0x53')])?util[_0x3e5b('0x5b')](_0x3e5b('0x129'),_0x34bcd8[_0x3e5b('0x53')][_0x3e5b('0x54')],_[_0x3e5b('0x82')](_0x34bcd8[_0x3e5b('0x12a')])?'':_0x34bcd8[_0x3e5b('0x12a')][_0x3e5b('0x12b')]()||'',_0x34bcd8[_0x3e5b('0x12c')]>0x0?_0x1c05c5[_0x3e5b('0x107')][_0x3e5b('0x12d')]['substring'](_0x34bcd8[_0x3e5b('0x12c')]):_0x1c05c5[_0x3e5b('0x107')][_0x3e5b('0x12d')]):util[_0x3e5b('0x5b')](_0x3e5b('0x129'),_[_0x3e5b('0x82')](_0x34bcd8[_0x3e5b('0x9b')])?_0x34bcd8['Trunk'][_0x3e5b('0x54')]:_0x34bcd8[_0x3e5b('0x9b')]['name'],_['isNil'](_0x34bcd8[_0x3e5b('0x12a')])?'':_0x34bcd8[_0x3e5b('0x12a')][_0x3e5b('0x12b')]()||'',_0x34bcd8[_0x3e5b('0x12c')]>0x0?_0x1c05c5[_0x3e5b('0x107')]['phone'][_0x3e5b('0x12e')](_0x34bcd8[_0x3e5b('0x12c')]):_0x1c05c5[_0x3e5b('0x107')]['phone']);var _0x5195e2=_0x2f96b7[_0x3e5b('0x9a')](_0x34bcd8[_0x3e5b('0x53')])?ut[_0x3e5b('0x12f')](_0x34bcd8['Trunk'][_0x3e5b('0x130')],_0x34bcd8[_0x3e5b('0x34')],_0x34bcd8['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x3e5b('0x131')](_0x34bcd8[_0x3e5b('0x132')],_0x34bcd8[_0x3e5b('0x133')]):_0x34bcd8[_0x3e5b('0x132')]):ut[_0x3e5b('0x12f')](_['isNil'](_0x34bcd8[_0x3e5b('0x9b')])?_0x34bcd8[_0x3e5b('0x53')][_0x3e5b('0x130')]:_0x34bcd8['TrunkBackup'][_0x3e5b('0x130')],_0x34bcd8[_0x3e5b('0x34')],_0x34bcd8['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x34bcd8[_0x3e5b('0x132')],_0x34bcd8[_0x3e5b('0x133')]):_0x34bcd8['dialOriginateCallerIdNumber']);if(_0x5195e2){_0xb291c3[_0x3e5b('0x134')]=ut['extractCalleridName'](_0x5195e2);_0xb291c3['originatecalleridnum']=ut['extractCalleridNumber'](_0x5195e2);}var _0x284dec=ut[_0x3e5b('0x135')](_0x34bcd8,_0x1c05c5,_0x1b4d1b,_0x5195e2,_0x156c73,_0xb291c3);_[_0x3e5b('0x136')](_0xb291c3,ut[_0x3e5b('0x137')](_0x284dec));_0xb291c3['starttime']=moment()['format'](_0x3e5b('0xb0'));ami[_0x3e5b('0x75')](ut[_0x3e5b('0x138')](_0xb291c3,_0x34bcd8,_0x284dec,_0xb291c3[_0x3e5b('0xcc')],_0x438fca))['then'](function(_0x2d8008){_0x34bcd8['originated']+=0x1;logger[_0x3e5b('0x59')]('[originated][increment]',_0x156c73,'\x20Queue',_0x34bcd8[_0x3e5b('0x54')],'originated:\x20',_0x34bcd8[_0x3e5b('0x4c')]);_0x268453(_0x2d8008);})[_0x3e5b('0x95')](function(_0x204732){ut['logAgent'](_0xb291c3,0xe,'OriginateError');rpcDb['createAgentHistory'](_0xb291c3,'[originateFailure][logOriginateFailure]');_0x285820(_0x204732);});});};Preview['prototype'][_0x3e5b('0x1f')]=function(_0x300696){if(this[_0x3e5b('0x17')][_0x300696[_0x3e5b('0xc2')]]){this['actions'][_0x300696[_0x3e5b('0xc2')]][_0x3e5b('0x77')]=_0x300696[_0x3e5b('0x77')];}};Preview[_0x3e5b('0xf')][_0x3e5b('0x139')]=function(_0x27a5e2){var _0x4803f2=this;var _0x373066=this[_0x3e5b('0x17')][_0x27a5e2[_0x3e5b('0x13a')]];if(_0x373066){if(_0x373066[_0x3e5b('0x109')]&&this[_0x3e5b('0x18')][_0x373066['lookAgent']]){ut[_0x3e5b('0x13b')](_0x373066,this[_0x3e5b('0x18')][_0x373066['lookAgent']][_0x3e5b('0x54')],this[_0x3e5b('0x18')][_0x373066[_0x3e5b('0x109')]]['id']);}var _0x34c414=_['clone'](_0x373066);_0x34c414['responsetime']=moment()[_0x3e5b('0x5b')](_0x3e5b('0xb0'));var _0x5881d2=_0x4803f2['campaignsPreview'][_0x373066['queue']];if(ut['isFailure'](_0x27a5e2[_0x3e5b('0x13c')])){if(_0x373066[_0x3e5b('0xae')]){rpcDb['unlockContact'](_0x373066[_0x3e5b('0x10d')]);}if(_0x373066['activeContact']){rpcDb[_0x3e5b('0x8d')](_0x373066[_0x3e5b('0x10d')]);}ami[_0x3e5b('0x24')](_0x3e5b('0x13d'),ut[_0x3e5b('0xa3')](_0x373066,'rejected',this['campaignsPreview'][_0x373066[_0x3e5b('0x6c')]]));this['callProgressDetectingAgent'](_0x34c414,_0x5881d2,_0x27a5e2);}else{_0x373066[_0x3e5b('0x13e')]=moment()[_0x3e5b('0x5b')](_0x3e5b('0xb0'));ut['logAgent'](_0x34c414,0x4,_0x3e5b('0xbb'));rpcDb[_0x3e5b('0xff')](_0x34c414,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype'][_0x3e5b('0x1b')]=function(_0x5315d1){var _0x592a35=this;var _0xba0c16=this[_0x3e5b('0x17')][_0x5315d1[_0x3e5b('0xc2')]];var _0x26b692;if(_0xba0c16){_0x26b692=this[_0x3e5b('0x14')][_0xba0c16[_0x3e5b('0x6c')]];logger[_0x3e5b('0x59')](_0x3e5b('0x13f'),_0x5315d1['linkedid'],'\x20Queue',_0x26b692[_0x3e5b('0x54')],'pTalking:\x20',_0x26b692['pTalking']);}if(this[_0x3e5b('0x17')][_0x5315d1['linkedid']]&&_0x5315d1[_0x3e5b('0xc2')]!==_0x5315d1[_0x3e5b('0xb3')]){if(_0x5315d1[_0x3e5b('0x140')]==='16'&&this[_0x3e5b('0x17')][_0x5315d1[_0x3e5b('0xc2')]][_0x3e5b('0x6f')]){this[_0x3e5b('0x9d')](_0x5315d1,_0x5315d1[_0x3e5b('0xc2')],_0x5315d1[_0x3e5b('0x140')]);}else if(this[_0x3e5b('0x17')][_0x5315d1['linkedid']][_0x3e5b('0x6f')]){logger['info']('[syncHangup][talking][cause]',_0x5315d1[_0x3e5b('0xc2')],_0x5315d1[_0x3e5b('0x140')],'\x20Queue',_0x26b692[_0x3e5b('0x54')],_0x3e5b('0x6d'),_0x26b692[_0x3e5b('0x6e')]);this[_0x3e5b('0x9d')](_0x5315d1,_0x5315d1['linkedid'],_0x5315d1[_0x3e5b('0x140')]);}}else if(_0xba0c16&&_['isNil'](_0xba0c16[_0x3e5b('0x141')])&&_0x26b692[_0x3e5b('0x142')]&&_0x5315d1[_0x3e5b('0xc2')]===_0x5315d1[_0x3e5b('0xb3')]&&_['isNil'](_0x5315d1[_0x3e5b('0xfd')])&&_0x5315d1[_0x3e5b('0x140')]==='16'&&_0x5315d1[_0x3e5b('0x143')]==='6'&&_[_0x3e5b('0xfb')](_0xba0c16[_0x3e5b('0x144')])){if(_0xba0c16['unlockAgent']){rpcDb[_0x3e5b('0x114')](_0xba0c16[_0x3e5b('0x10d')]);}if(_0xba0c16[_0x3e5b('0xcc')]){rpcDb[_0x3e5b('0x8d')](_0xba0c16['idContact']);}_0x5315d1['reason']='22';this[_0x3e5b('0xfa')](_0xba0c16,_0x26b692,_0x5315d1);}else if(_0xba0c16&&_0xba0c16[_0x3e5b('0x144')]){if(_0x5315d1[_0x3e5b('0x140')]==='16'&&this[_0x3e5b('0x17')][_0x5315d1['linkedid']][_0x3e5b('0x6f')]){logger['info'](_0x3e5b('0x145'),_0x5315d1['linkedid'],_0x5315d1[_0x3e5b('0x140')],_0x3e5b('0xc1'),_0x26b692[_0x3e5b('0x54')],_0x3e5b('0x6d'),_0x26b692[_0x3e5b('0x6e')]);this[_0x3e5b('0x9d')](_0x5315d1,_0x5315d1[_0x3e5b('0xc2')],_0x5315d1[_0x3e5b('0x140')]);}else if(this[_0x3e5b('0x17')][_0x5315d1[_0x3e5b('0xc2')]][_0x3e5b('0x6f')]){logger[_0x3e5b('0x59')](_0x3e5b('0x146'),_0x5315d1[_0x3e5b('0xc2')],_0x5315d1[_0x3e5b('0x140')],_0x3e5b('0xc1'),_0x26b692['name'],'pTalking:\x20',_0x26b692['pTalking']);this[_0x3e5b('0x9d')](_0x5315d1,_0x5315d1[_0x3e5b('0xc2')],_0x5315d1[_0x3e5b('0x140')]);}}};Preview['prototype'][_0x3e5b('0x1e')]=function(_0x16bb54){if(this[_0x3e5b('0x17')][_0x16bb54[_0x3e5b('0xf9')]]&&_0x16bb54[_0x3e5b('0xf9')]!==_0x16bb54[_0x3e5b('0x147')]){this[_0x3e5b('0x9d')](_0x16bb54,_0x16bb54[_0x3e5b('0xf9')],_0x16bb54[_0x3e5b('0xf4')]);}};Preview[_0x3e5b('0xf')]['syncHangupRequest']=function(_0x395e42){if(this[_0x3e5b('0x17')][_0x395e42['linkedid']]&&_0x395e42[_0x3e5b('0xc2')]!==_0x395e42[_0x3e5b('0xb3')]&&!this[_0x3e5b('0x17')][_0x395e42[_0x3e5b('0xc2')]]['dialAnswer']){if(_0x395e42[_0x3e5b('0x140')]==='1'){this['callProgressDetectingCustomer'](_0x395e42,_0x395e42[_0x3e5b('0xc2')],_0x395e42[_0x3e5b('0x140')]);}}};Preview['prototype'][_0x3e5b('0x148')]=function(_0x22208f,_0x5044e0,_0x5bc879){if(this['actions'][_0x22208f]){if(_[_0x3e5b('0x82')](this[_0x3e5b('0x17')][_0x22208f][_0x3e5b('0x149')])){this[_0x3e5b('0x17')][_0x22208f][_0x3e5b('0x149')]={};}this[_0x3e5b('0x17')][_0x22208f][_0x3e5b('0x149')][_0x5044e0]=_0x5bc879;}};Preview[_0x3e5b('0xf')][_0x3e5b('0x20')]=function(_0x13583c){try{if(!_[_0x3e5b('0x82')](_0x13583c)){if(ut[_0x3e5b('0x14a')](_[_0x3e5b('0x14b')](_0x13583c['variable'])[0x0])){this[_0x3e5b('0x148')](_0x13583c[_0x3e5b('0xb3')],_['keys'](_0x13583c['variable'])[0x0],_0x13583c['value']);}}}catch(_0x245a95){logger['error'](_0x3e5b('0x14c'),util[_0x3e5b('0x14d')](_0x245a95,{'showHidden':![],'depth':null}));}};Preview[_0x3e5b('0xf')][_0x3e5b('0x14e')]=function(_0x4f07eb){if(_0x4f07eb){if(this['actions'][_0x4f07eb[_0x3e5b('0x14f')]]){this[_0x3e5b('0x17')][_0x4f07eb[_0x3e5b('0x14f')]][_0x3e5b('0x144')]=!![];}}};Preview[_0x3e5b('0xf')][_0x3e5b('0x22')]=function(_0x50d495){if(_0x50d495){if(this['actions'][_0x50d495[_0x3e5b('0x150')]]){this[_0x3e5b('0x17')][_0x50d495['transfererlinkedid']]['transfer']=!![];}}};module[_0x3e5b('0x151')]=Preview; \ No newline at end of file +var _0x950a=['outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','Interval','stringify','format','info','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','message','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','clearZombieChannels','outbound','recallMe','clearZombieChannel','enqueue','isNil','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','catch','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','\x20Queue','isUndefined','reason','logAgent','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','\x20IdHopper:\x20','idContact','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','unmonitored','run','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','dialCutDigit','SIP/%s/%s%s','trim','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','callProgressDetectingAgent','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','variable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','./rpcDb','./action','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','type','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x4654b9,_0x5bdf78){var _0x6ee7ba=function(_0x52fb8c){while(--_0x52fb8c){_0x4654b9['push'](_0x4654b9['shift']());}};_0x6ee7ba(++_0x5bdf78);}(_0x950a,0x111));var _0xa950=function(_0x438927,_0x18ec8b){_0x438927=_0x438927-0x0;var _0x41f65b=_0x950a[_0x438927];return _0x41f65b;};'use strict';var util=require(_0xa950('0x0'));var _=require(_0xa950('0x1'));var BPromise=require(_0xa950('0x2'));var uuid=require(_0xa950('0x3'));var moment=require('moment');var md5=require(_0xa950('0x4'));var Redis=require(_0xa950('0x5'));var config=require(_0xa950('0x6'));var logger=require(_0xa950('0x7'))('preview');var loggerAction=require(_0xa950('0x7'))(_0xa950('0x8'));var ami=require('../ami');var rpcDb=require(_0xa950('0x9'));var Action=require(_0xa950('0xa'));var ut=require('./util/util');config['redis']=_[_0xa950('0xb')](config[_0xa950('0xc')],{'host':_0xa950('0xd'),'port':0x18eb});var io=require(_0xa950('0xe'))(new Redis(config[_0xa950('0xc')]));var Sequence=function(){};Sequence[_0xa950('0xf')]['enqueue']=function(_0x523f3c){this['tail']=this[_0xa950('0x10')]?this['tail'][_0xa950('0x11')](_0x523f3c):_0x523f3c();};function Preview(_0x3c66c7){this[_0xa950('0x12')]=new Sequence();this['campaignsPreview']=_0x3c66c7[_0xa950('0x13')];this['trunks']=_0x3c66c7[_0xa950('0x14')];this[_0xa950('0x15')]={};this[_0xa950('0x16')]=_0x3c66c7['agents'];this[_0xa950('0x17')]=0x0;ami['on'](_0xa950('0x18'),this[_0xa950('0x19')]['bind'](this));ami['on'](_0xa950('0x1a'),this[_0xa950('0x1b')][_0xa950('0x1c')](this));ami['on']('hanguprequest',this[_0xa950('0x1d')][_0xa950('0x1c')](this));ami['on'](_0xa950('0x1e'),this['syncDialEnd'][_0xa950('0x1c')](this));ami['on'](_0xa950('0x1f'),this[_0xa950('0x20')][_0xa950('0x1c')](this));ami['on'](_0xa950('0x21'),this[_0xa950('0x22')][_0xa950('0x1c')](this));ami['on'](_0xa950('0x23'),this[_0xa950('0x24')][_0xa950('0x1c')](this));ami['on'](_0xa950('0x25'),this[_0xa950('0x26')][_0xa950('0x1c')](this));this['loopCampaigns'](this[_0xa950('0x27')]);}function emit(_0x1a10fe,_0x50abe1,_0x1f9894){io['to'](_0x1a10fe)[_0xa950('0x28')](_0x50abe1,_0x1f9894);}function emitCampaignPreview(_0x53a657){if(_0x53a657[_0xa950('0x29')]==='outbound'){var _0x2eda79={'id':_0x53a657['id'],'name':_0x53a657[_0xa950('0x2a')],'strategy':_0x53a657[_0xa950('0x2b')],'answered':_0x53a657[_0xa950('0x2c')],'available':_0x53a657['available'],'loggedIn':_0x53a657[_0xa950('0x2d')],'pTalking':_0x53a657[_0xa950('0x2e')],'sumBillable':_0x53a657[_0xa950('0x2f')],'sumDuration':_0x53a657[_0xa950('0x30')],'sumHoldTime':_0x53a657[_0xa950('0x31')]||0x0,'talking':_0x53a657[_0xa950('0x32')],'total':_0x53a657[_0xa950('0x33')],'type':_0x53a657[_0xa950('0x29')],'unmanaged':_0x53a657[_0xa950('0x34')],'abandoned':_0x53a657[_0xa950('0x35')],'waiting':_0x53a657[_0xa950('0x36')],'loggedInDb':_0x53a657[_0xa950('0x37')],'dialActive':_0x53a657[_0xa950('0x38')],'dialMethod':_0x53a657['dialMethod'],'dialOriginateCallerIdName':_0x53a657[_0xa950('0x39')],'dialOriginateCallerIdNumber':_0x53a657[_0xa950('0x3a')],'dialOriginateTimeout':_0x53a657[_0xa950('0x3b')],'dialPrefix':_0x53a657[_0xa950('0x3c')],'outboundAnswerAgiCallsDay':_0x53a657[_0xa950('0x3d')],'outboundAnswerCallsDay':_0x53a657[_0xa950('0x3e')],'outboundBlacklistCallsDay':_0x53a657[_0xa950('0x3f')],'outboundBusyCallsDay':_0x53a657['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x53a657[_0xa950('0x40')],'outboundDropCallsDayACS':_0x53a657[_0xa950('0x41')],'outboundDropCallsDayCallersExit':_0x53a657['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x53a657[_0xa950('0x42')],'outboundNoAnswerCallsDay':_0x53a657[_0xa950('0x43')],'outboundNoSuchCallsDay':_0x53a657[_0xa950('0x44')],'outboundOriginateFailureCallsDay':_0x53a657[_0xa950('0x45')],'outboundReCallsDay':_0x53a657[_0xa950('0x46')],'outboundRejectCallsDay':_0x53a657[_0xa950('0x47')],'outboundUnknownCallsDay':_0x53a657[_0xa950('0x48')],'outboundAbandonedCallsDay':_0x53a657[_0xa950('0x49')],'predictiveIntervalAnsweredCalls':_0x53a657[_0xa950('0x4a')],'predictiveIntervalAvgHoldtime':_0x53a657[_0xa950('0x4b')],'predictiveIntervalAvgTalktime':_0x53a657['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x53a657[_0xa950('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x53a657['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x53a657['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x53a657[_0xa950('0x4d')],'predictiveIntervalHitRate':_0x53a657['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x53a657[_0xa950('0x4e')],'predictiveIntervalPauses':_0x53a657[_0xa950('0x4f')],'predictiveIntervalAvailable':_0x53a657[_0xa950('0x50')],'predictiveIntervalTotalCalls':_0x53a657[_0xa950('0x51')],'message':_0x53a657['message'],'originated':_0x53a657[_0xa950('0x52')],'erlangCalls':_0x53a657['erlangCalls'],'erlangCallToSecond':_0x53a657[_0xa950('0x53')],'erlangAbandonmentRate':_0x53a657[_0xa950('0x54')],'erlangBusyFactor':_0x53a657['erlangBusyFactor'],'startPredictive':_0x53a657['startPredictive'],'startProgressive':_0x53a657[_0xa950('0x55')]};if(_0x53a657[_0xa950('0x56')]){_0x2eda79[_0xa950('0x56')]={'id':_0x53a657[_0xa950('0x56')]['id'],'name':_0x53a657[_0xa950('0x56')][_0xa950('0x2a')],'active':_0x53a657['Trunk']['active'],'callerid':_0x53a657[_0xa950('0x56')]['callerid']};}if(_0x53a657[_0xa950('0x57')]){_0x2eda79[_0xa950('0x57')]={'id':_0x53a657[_0xa950('0x57')]['id'],'name':_0x53a657[_0xa950('0x57')][_0xa950('0x2a')]};}var _0xe3aeb=md5(JSON[_0xa950('0x58')](_0x2eda79));if(_0x53a657[_0xa950('0x4')]!==_0xe3aeb){_0x53a657[_0xa950('0x4')]=_0xe3aeb;emit(util[_0xa950('0x59')]('voice:queue:%s',_0x2eda79[_0xa950('0x2a')]),'voice_queue:save',_0x2eda79);}}}function emitVoiceQueueChannelRemove(_0x371091){logger[_0xa950('0x5a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x371091));emit(util[_0xa950('0x59')](_0xa950('0x5b'),_0x371091['name']),_0xa950('0x5c'),_0x371091);io[_0xa950('0x28')]('voice_queue_presence:remove',_0x371091);}function notSendMessagesQueue(_0x213a58){if(_0x213a58[_0xa950('0x5d')]){if(_0x213a58[_0xa950('0x52')]===0x0&&_0x213a58[_0xa950('0x2e')]===0x0){_0x213a58[_0xa950('0x5d')]=![];_0x213a58[_0xa950('0x5e')]=0x0;_0x213a58[_0xa950('0x5f')]=0x0;_0x213a58[_0xa950('0x60')]='NOT_ACTIVE';ut[_0xa950('0x61')](_0xa950('0x62'),_0x213a58['name']+_0xa950('0x63'));}else{_0x213a58[_0xa950('0x60')]=_0xa950('0x64');ut['logger'](_0xa950('0x62'),_0x213a58[_0xa950('0x2a')]+_0xa950('0x65'));}emitCampaignPreview(_0x213a58);}}Preview['prototype']['loopCampaigns']=function(){var _0x3d5f95=this;setInterval(function(){_0x3d5f95[_0xa950('0x66')]();},0x7cf);};Preview[_0xa950('0xf')]['syncCampaigns']=function(){var _0x49a235=this['campaignsPreview'];this[_0xa950('0x17')]+=0x1;for(var _0x413f5e in _0x49a235){if(_0x49a235[_0xa950('0x67')](_0x413f5e)&&(_0x49a235[_0x413f5e][_0xa950('0x68')]===_0xa950('0x69')||_0x49a235[_0x413f5e]['dialMethod']===_0xa950('0x6a'))&&_0x49a235[_0x413f5e][_0xa950('0x29')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xa950('0x17')]=0x0;this[_0xa950('0x6b')]();}}if(_0x49a235['hasOwnProperty'](_0x413f5e)&&_0x49a235[_0x413f5e]['dialMethod']==='preview'&&_0x49a235[_0x413f5e]['type']===_0xa950('0x6c')){if(_0x49a235[_0x413f5e][_0xa950('0x38')]){this['setMessage'](_0x49a235[_0x413f5e]);if(_0x49a235[_0x413f5e]['dialPreviewAutoRecallMe'])this[_0xa950('0x6d')](_0x49a235[_0x413f5e]);}else{notSendMessagesQueue(_0x49a235[_0x413f5e]);}}}};Preview['prototype'][_0xa950('0x6e')]=function(_0x3cbd16){var _0x1fdb52=this;this[_0xa950('0x12')][_0xa950('0x6f')](function(){if(!_[_0xa950('0x70')](_0x1fdb52[_0xa950('0x15')][_0x3cbd16])){loggerAction[_0xa950('0x5a')]('[clearZombieChannels][talking]',_0x3cbd16,_0xa950('0x71'),_0x1fdb52['actions'][_0x3cbd16][_0xa950('0x72')],_0xa950('0x73'),JSON[_0xa950('0x58')](_0x1fdb52[_0xa950('0x27')][_0x1fdb52[_0xa950('0x15')][_0x3cbd16][_0xa950('0x72')]][_0xa950('0x52')]),_0xa950('0x74'),JSON[_0xa950('0x58')](_0x1fdb52['campaignsPreview'][_0x1fdb52[_0xa950('0x15')][_0x3cbd16][_0xa950('0x72')]][_0xa950('0x2e')]),JSON[_0xa950('0x58')](_0x1fdb52[_0xa950('0x15')][_0x3cbd16]['dialAnswer']),JSON[_0xa950('0x58')](_[_0xa950('0x75')](_0x1fdb52[_0xa950('0x15')][_0x3cbd16],[_0xa950('0x76'),_0xa950('0x77'),_0xa950('0x78'),_0xa950('0x79')])));return ami['Action']({'action':_0xa950('0x7a'),'channel':_0x1fdb52[_0xa950('0x15')][_0x3cbd16][_0xa950('0x7b')]})['catch'](function(_0x54c917){if(_0x54c917[_0xa950('0x60')]===_0xa950('0x7c')){setTimeout(function(){if(_0x1fdb52[_0xa950('0x15')][_0x3cbd16]){ut[_0xa950('0x7d')](_0x1fdb52[_0xa950('0x27')][_0x1fdb52[_0xa950('0x15')][_0x3cbd16][_0xa950('0x72')]],_0xa950('0x7e'));if(_0x1fdb52['actions'][_0x3cbd16][_0xa950('0x7f')]===!![]){ut[_0xa950('0x80')](_0x1fdb52[_0xa950('0x27')][_0x1fdb52[_0xa950('0x15')][_0x3cbd16][_0xa950('0x72')]],'[clearZombieChannel]');ut[_0xa950('0x81')]('[Dialer][checkChannel][pTalking][Preview]'+_0x3cbd16,_0x1fdb52[_0xa950('0x15')][_0x3cbd16][_0xa950('0x72')]);}ut[_0xa950('0x81')](_0xa950('0x82')+_0x3cbd16,_0x1fdb52[_0xa950('0x15')][_0x3cbd16][_0xa950('0x72')]);delete _0x1fdb52['actions'][_0x3cbd16];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x41e086=this;loggerAction[_0xa950('0x5a')](_0xa950('0x83'),_[_0xa950('0x84')](this[_0xa950('0x15')]));for(var _0x34220e in this[_0xa950('0x15')]){if(_0x41e086[_0xa950('0x15')]['hasOwnProperty'](_0x34220e)){_0x41e086[_0xa950('0x6e')](_0x34220e);}}};Preview['prototype'][_0xa950('0x6d')]=function(_0x4e0fdc){var _0x3dddea=this;rpcDb['getContactRecallMe'](_0x4e0fdc['id'],ut[_0xa950('0x85')](this['agents']))[_0xa950('0x86')](function(_0x3e536e){if(!_[_0xa950('0x70')](_0x3e536e)){for(var _0x3d6e1b=0x0;_0x3d6e1b<_0x3e536e[_0xa950('0x87')];_0x3d6e1b+=0x1){if(ut['getDiff'](_0x3e536e[_0x3d6e1b][_0xa950('0x88')])<_0x4e0fdc[_0xa950('0x89')]*0x3c){if(_0x3e536e[_0x3d6e1b][_0xa950('0x8a')]&&!_0x3e536e[_0x3d6e1b][_0xa950('0x8a')][_0xa950('0x8b')]){_0x3dddea['run'](_0x3e536e[_0x3d6e1b]['id'])[_0xa950('0x86')](ut[_0xa950('0x8c')](_0xa950('0x8d')))[_0xa950('0x8e')](ut[_0xa950('0x8c')]('[RecallMe]'));}else{rpcDb[_0xa950('0x8f')](_0x3e536e[_0x3d6e1b]['id']);}}else{var _0x4b9c8d=new Action(_0x3e536e[_0x3d6e1b],_0x4e0fdc);_0x4b9c8d['starttime']=moment()[_0xa950('0x59')](_0xa950('0x90'));_0x4e0fdc[_0xa950('0x46')]+=0x1;ut[_0xa950('0x91')](_0x4b9c8d,0x17,'RecallInQueue');if(_0x4e0fdc['dialRecallInQueue']){rpcDb[_0xa950('0x92')](ut[_0xa950('0x93')](_0x3e536e[_0x3d6e1b]));rpcDb[_0xa950('0x94')](_0x4b9c8d,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xa950('0x91')](_0x4b9c8d,0x16,_0xa950('0x95'));rpcDb[_0xa950('0x94')](_0x4b9c8d,_0xa950('0x96'));rpcDb[_0xa950('0x97')](_0x4b9c8d,_0xa950('0x96'));}}}}})[_0xa950('0x8e')](ut[_0xa950('0x8c')](_0xa950('0x98')));};Preview['prototype'][_0xa950('0x99')]=function(_0x57a070){_0x57a070[_0xa950('0x5d')]=!![];if(ut[_0xa950('0x9a')](_0x57a070[_0xa950('0x2d')])){_0x57a070[_0xa950('0x60')]=_0xa950('0x9b');}else if(!ut[_0xa950('0x9c')](_0x57a070[_0xa950('0x38')])){_0x57a070[_0xa950('0x60')]=_0xa950('0x9d');}else if(!this[_0xa950('0x9e')](_0x57a070[_0xa950('0x56')])){if(!this[_0xa950('0x9e')](_0x57a070[_0xa950('0x9f')])){_0x57a070['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x57a070[_0xa950('0x60')]=_0xa950('0xa0');}}else{_0x57a070[_0xa950('0x60')]=_0xa950('0xa0');}emitCampaignPreview(_0x57a070);};Preview[_0xa950('0xf')][_0xa950('0xa1')]=function(_0x22efe1,_0x513341,_0x3e7805){var _0x411e90=this;var _0x297be4=this[_0xa950('0x15')][_0x513341];var _0x6e253a=this[_0xa950('0x27')][_0x297be4[_0xa950('0x72')]];var _0x3df858;if(_0x6e253a){switch(_0x3e7805){case'1':_0x6e253a['outboundNoSuchCallsDay']+=0x1;_0x297be4[_0xa950('0xa2')]+=0x1;_0x297be4[_0xa950('0xa3')]=ut[_0xa950('0xa4')](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0x0,_0xa950('0xa5'));ami['emit'](_0xa950('0xa6'),ut[_0xa950('0xa7')](_0x297be4,_0xa950('0xa8')));rpcDb[_0xa950('0x94')](_0x297be4,_0xa950('0xa9'));if(ut['totalGlobal'](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut[_0xa950('0xab')](_0x297be4,0xf,_0xa950('0xac'));rpcDb['createCustomerFinal'](_0x3df858,_0xa950('0xad'));}else{if(_0x297be4[_0xa950('0xa2')]>=_0x6e253a[_0xa950('0xae')]){rpcDb[_0xa950('0x97')](_0x297be4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xa950('0xaf')](ut[_0xa950('0xb0')](_0x297be4,'countnosuchnumberretry',_0x6e253a[_0xa950('0xb1')]),_0x297be4[_0xa950('0xb2')],_0x297be4[_0xa950('0xb3')]);}}delete this[_0xa950('0x15')][_0x22efe1[_0xa950('0xb4')]];break;case _0xa950('0xb5'):var _0x17b60c=moment()[_0xa950('0x59')](_0xa950('0x90'));_0x297be4[_0xa950('0xb6')]=_0x17b60c;_0x297be4[_0xa950('0xb7')]=_0x17b60c;_0x297be4[_0xa950('0x7f')]=!![];_0x6e253a[_0xa950('0x2e')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x297be4['uniqueid'],'\x20Queue',_0x6e253a[_0xa950('0x2a')],_0xa950('0x74'),_0x6e253a[_0xa950('0x2e')]);ami['emit'](_0xa950('0xb8'),ut[_0xa950('0xa7')](_0x297be4,_0xa950('0xb9'),this[_0xa950('0x27')][_0x297be4[_0xa950('0x72')]]));if(_0x6e253a[_0xa950('0xba')]){ami[_0xa950('0x28')]('custom:agentConnectPreview',ut[_0xa950('0xbb')](_0x297be4));}break;case'16':ami[_0xa950('0x28')](_0xa950('0xbc'),ut[_0xa950('0xa7')](_0x297be4,_0xa950('0xbd'),this[_0xa950('0x27')][_0x297be4[_0xa950('0x72')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x297be4,_0xa950('0xbd')));_0x6e253a[_0xa950('0x3e')]+=0x1;_0x6e253a['total']+=0x1;_0x6e253a[_0xa950('0x2c')]+=0x1;ut[_0xa950('0x80')](_0x6e253a,_0xa950('0xbe'));_0x297be4[_0xa950('0xa3')]=ut[_0xa950('0xa4')](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0x4,_0xa950('0xbf'));rpcDb['createCustomerHistory'](_0x297be4,_0xa950('0xc0'));rpcDb[_0xa950('0x97')](_0x297be4,_0xa950('0xc1'));rpcDb[_0xa950('0xc2')](_0x297be4);_0x6e253a[_0xa950('0x30')]+=_0x297be4[_0xa950('0xc3')];_0x6e253a['sumBillable']+=_0x297be4[_0xa950('0xc3')];logger[_0xa950('0x5a')]('[syncHangup][talking][decrement]',_0x297be4['uniqueid'],'\x20Queue',_0x6e253a['name'],_0xa950('0x74'),_0x6e253a[_0xa950('0x2e')]);delete this['actions'][_0x22efe1[_0xa950('0xb4')]];break;case _0xa950('0xc4'):_0x6e253a['outboundBusyCallsDay']+=0x1;_0x297be4[_0xa950('0xc5')]+=0x1;_0x297be4[_0xa950('0xa3')]=ut[_0xa950('0xa4')](_0x297be4);ut['logCustomer'](_0x297be4,0x5,'Busy');ami[_0xa950('0x28')](_0xa950('0xc6'),ut[_0xa950('0xa7')](_0x297be4,_0xa950('0xc7')));rpcDb[_0xa950('0x94')](_0x297be4,_0xa950('0xc8'));if(ut[_0xa950('0xa4')](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut[_0xa950('0xab')](_0x297be4,0xf,_0xa950('0xac'));rpcDb[_0xa950('0x97')](_0x3df858,_0xa950('0xc9'));}else{if(_0x297be4['countbusyretry']>=_0x6e253a[_0xa950('0xca')]){rpcDb['createCustomerFinal'](_0x297be4,_0xa950('0xc8'));}else{rpcDb[_0xa950('0xaf')](ut['scheduledAt'](_0x297be4,_0xa950('0xc5'),_0x6e253a[_0xa950('0xcb')]),_0x297be4['unlockAgent'],_0x297be4[_0xa950('0xb3')]);}}break;case _0xa950('0xcc'):_0x6e253a['outboundNoAnswerCallsDay']+=0x1;_0x297be4[_0xa950('0xcd')]+=0x1;_0x297be4['countglobal']=ut[_0xa950('0xa4')](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0x3,'NoAnswer');ami[_0xa950('0x28')](_0xa950('0xce'),ut[_0xa950('0xa7')](_0x297be4,_0xa950('0xcf')));rpcDb[_0xa950('0x94')](_0x297be4,_0xa950('0xd0'));if(ut[_0xa950('0xa4')](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut['cloneAction'](_0x297be4,0xf,_0xa950('0xac'));rpcDb[_0xa950('0x97')](_0x3df858,_0xa950('0xd1'));}else{if(_0x297be4[_0xa950('0xcd')]>=_0x6e253a[_0xa950('0xd2')]){rpcDb[_0xa950('0x97')](_0x297be4,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xa950('0xaf')](ut[_0xa950('0xb0')](_0x297be4,'countnoanswerretry',_0x6e253a['dialNoAnswerRetryFrequency']),_0x297be4[_0xa950('0xb2')],_0x297be4[_0xa950('0xb3')]);}}break;case _0xa950('0xd3'):_0x6e253a[_0xa950('0x40')]+=0x1;_0x297be4['countcongestionretry']+=0x1;_0x297be4['countglobal']=ut[_0xa950('0xa4')](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0x8,_0xa950('0xd4'));ami[_0xa950('0x28')](_0xa950('0xd5'),ut[_0xa950('0xa7')](_0x297be4,_0xa950('0xd6')));rpcDb[_0xa950('0x94')](_0x297be4,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xa950('0xa4')](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut['cloneAction'](_0x297be4,0xf,_0xa950('0xac'));rpcDb[_0xa950('0x97')](_0x3df858,_0xa950('0xd7'));}else{if(_0x297be4[_0xa950('0xd8')]>=_0x6e253a[_0xa950('0xd9')]){rpcDb['createCustomerFinal'](_0x297be4,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xa950('0xaf')](ut[_0xa950('0xb0')](_0x297be4,'countcongestionretry',_0x6e253a[_0xa950('0xcb')]),_0x297be4['unlockAgent'],_0x297be4[_0xa950('0xb3')]);}}break;case _0xa950('0xda'):_0x6e253a[_0xa950('0x47')]+=0x1;_0x297be4['countagentrejectretry']+=0x1;_0x297be4['countglobal']=ut[_0xa950('0xa4')](_0x297be4);ut['logCustomer'](_0x297be4,0x14,_0xa950('0xdb'));ami[_0xa950('0x28')](_0xa950('0xdc'),ut[_0xa950('0xa7')](_0x297be4,'agentreject'));rpcDb[_0xa950('0x94')](_0x297be4,'[syncHangupRequest][logAgentReject]');if(ut[_0xa950('0xa4')](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut['cloneAction'](_0x297be4,0x14,_0xa950('0xdb'));rpcDb['createCustomerFinal'](_0x3df858,_0xa950('0xdd'));}else{if(_0x297be4[_0xa950('0xde')]>=_0x6e253a['dialAgentRejectMaxRetry']){rpcDb[_0xa950('0x97')](_0x297be4,_0xa950('0xdd'));}else{rpcDb[_0xa950('0xaf')](ut[_0xa950('0xb0')](_0x297be4,'countagentrejectretry',_0x6e253a['dialAgentRejectRetryFrequency']),_0x297be4[_0xa950('0xb2')],_0x297be4[_0xa950('0xb3')]);}}break;case _0xa950('0xdf'):_0x6e253a[_0xa950('0x49')]+=0x1;_0x297be4[_0xa950('0xe0')]+=0x1;_0x297be4[_0xa950('0xa3')]=ut[_0xa950('0xa4')](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x297be4,_0xa950('0xe1'));if(ut[_0xa950('0xa4')](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut[_0xa950('0xab')](_0x297be4,0xf,'Global');rpcDb[_0xa950('0x97')](_0x3df858,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x297be4[_0xa950('0xe2')]>=_0x6e253a[_0xa950('0xe3')]){rpcDb['createCustomerFinal'](_0x297be4,_0xa950('0xe1'));}else{rpcDb['rescheduleContact'](ut[_0xa950('0xb0')](_0x297be4,_0xa950('0xe0'),_0x6e253a[_0xa950('0xe4')]),_0x297be4[_0xa950('0xb2')],_0x297be4['activeContact']);}}break;case'18':_0x6e253a[_0xa950('0x48')]+=0x1;_0x297be4[_0xa950('0xe5')]+=0x1;_0x297be4['countglobal']=ut[_0xa950('0xa4')](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0x12,_0x22efe1[_0xa950('0xe6')]||_0x22efe1[_0xa950('0xe7')]);ami[_0xa950('0x28')]('custom:amd',ut[_0xa950('0xa7')](_0x297be4,_0xa950('0xe8')));rpcDb[_0xa950('0x94')](_0x297be4,_0xa950('0xe9'));if(ut['totalGlobal'](_0x297be4)>=_0x6e253a['dialGlobalMaxRetry']){_0x3df858=ut[_0xa950('0xab')](_0x297be4,0xf,'Global');rpcDb['createCustomerFinal'](_0x3df858,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xa950('0x97')](_0x297be4,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xa950('0x15')][_0x22efe1[_0xa950('0xb4')]];break;case'19':_0x6e253a['outboundUnknownCallsDay']+=0x1;_0x297be4[_0xa950('0xa3')]=ut['totalGlobal'](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0x13,_0x22efe1[_0xa950('0xe6')]||_0x22efe1[_0xa950('0xe7')]);ami[_0xa950('0x28')](_0xa950('0xea'),ut['buildObj'](_0x297be4,_0xa950('0xe8')));rpcDb[_0xa950('0x94')](_0x297be4,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut[_0xa950('0xab')](_0x297be4,0xf,'Global');rpcDb['createCustomerFinal'](_0x3df858,_0xa950('0xeb'));}else{rpcDb['createCustomerFinal'](_0x297be4,_0xa950('0xeb'));}delete this['actions'][_0x22efe1[_0xa950('0xb4')]];break;default:if(_0x297be4[_0xa950('0x7f')]){ut[_0xa950('0x80')](_0x6e253a,_0xa950('0xec'));ut[_0xa950('0x81')](_0xa950('0xed')+_0x6e253a['name'],_0x22efe1);}_0x6e253a[_0xa950('0x48')]+=0x1;_0x297be4[_0xa950('0xa3')]=ut[_0xa950('0xa4')](_0x297be4);ut[_0xa950('0x91')](_0x297be4,0xc,_0x22efe1[_0xa950('0xe6')]||_0x22efe1[_0xa950('0xe7')]);rpcDb[_0xa950('0x94')](_0x297be4,_0xa950('0xee'));if(ut['totalGlobal'](_0x297be4)>=_0x6e253a[_0xa950('0xaa')]){_0x3df858=ut['cloneAction'](_0x297be4,0xf,'Global');rpcDb[_0xa950('0x97')](_0x3df858,_0xa950('0xef'));}else{rpcDb[_0xa950('0x97')](_0x297be4,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xa950('0x15')][_0x22efe1[_0xa950('0xb4')]];}if(!(_0x297be4['dialAnswer']&&_0x3e7805==='16')){ut[_0xa950('0x7d')](_0x6e253a,'[callProgressDetectingCustomer]');logger[_0xa950('0x5a')](_0xa950('0xf0'),_0x297be4[_0xa950('0xf1')],_0xa950('0xf2'),_0x6e253a['name'],_0xa950('0x73'),_0x6e253a['originated']);}if(_0x3e7805!=='ANSWER'){delete this[_0xa950('0x15')][_0x22efe1[_0xa950('0xb4')]];delete this['actions'][_0x22efe1['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x26db29,_0x54fdd9,_0x61869a){if(_['isUndefined'](_0x54fdd9)&&'object'!==typeof _0x54fdd9){return;}if(_[_0xa950('0xf3')](_0x61869a)&&'object'!==typeof _0x61869a){return;}switch(_0x61869a[_0xa950('0xf4')]){case'0':ut[_0xa950('0xf5')](_0x26db29,0x0,_0xa950('0xa5'));rpcDb[_0xa950('0xf6')](_0x26db29,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xa950('0xf5')](_0x26db29,0x3,_0xa950('0xf7'));rpcDb['createAgentHistory'](_0x26db29,_0xa950('0xf8'));break;case'5':ut[_0xa950('0xf5')](_0x26db29,0x5,_0xa950('0xf9'));rpcDb[_0xa950('0xf6')](_0x26db29,_0xa950('0xfa'));break;case'8':ut['logAgent'](_0x26db29,0x8,_0xa950('0xd4'));rpcDb[_0xa950('0xf6')](_0x26db29,_0xa950('0xfb'));break;case'22':ut[_0xa950('0xf5')](_0x26db29,0x16,_0xa950('0xfc'));rpcDb[_0xa950('0xf6')](_0x26db29,_0xa950('0xfd'));break;default:ut[_0xa950('0xf5')](_0x26db29,0xc,_0x61869a['reason']);rpcDb[_0xa950('0xf6')](_0x26db29,_0xa950('0xfb'));}ut[_0xa950('0x7d')](_0x54fdd9,_0xa950('0xfe'));logger[_0xa950('0x5a')](_0xa950('0xff'),_0x26db29[_0xa950('0xf1')],_0xa950('0xf2'),_0x54fdd9[_0xa950('0x2a')],_0xa950('0x73'),_0x54fdd9[_0xa950('0x52')]);delete this[_0xa950('0x15')][_0x26db29[_0xa950('0xf1')]];};Preview[_0xa950('0xf')][_0xa950('0x100')]=function(_0x5b213b,_0x2ffb5c,_0x55cee6,_0x445c0c,_0x4ccc64){var _0x2ee7b4=this;return new BPromise(function(_0x5e7fec,_0x4a684f){if(_[_0xa950('0x70')](_0x2ffb5c)||_[_0xa950('0x70')](_0x2ffb5c[_0xa950('0x101')])||_[_0xa950('0x70')](_0x2ffb5c['Contact'][_0xa950('0x102')])||_['isNil'](_0x2ffb5c['VoiceQueueId'])){_0x4a684f(ut[_0xa950('0x60')]('Contact\x20is\x20undefined',_0x445c0c,_0x4ccc64));return;}var _0x34d520=uuid['v4']();var _0x567b27=_0x2ee7b4['campaignsPreview'][_0x2ffb5c['Queue'][_0xa950('0x2a')]];var _0x1d5cd5=_0x55cee6?_0x2ee7b4[_0xa950('0x16')][_0x55cee6]['id']:undefined;_0x2ee7b4['actions'][_0x34d520]=new Action(_0x2ffb5c,_0x567b27,_0x34d520,_0x55cee6,_0x1d5cd5);var _0x3a4378=_0x2ee7b4['actions'][_0x34d520];_0x3a4378[_0xa950('0xb2')]=_0x445c0c;_0x3a4378[_0xa950('0xb3')]=_0x4ccc64;_0x3a4378[_0xa950('0x103')]=_0x55cee6;if(_[_0xa950('0x104')](_0x5b213b)){_0x2ee7b4['execCall'](_0x3a4378,_0x567b27,_0x2ffb5c,_0x55cee6)[_0xa950('0x86')](function(_0x1425ae){logger[_0xa950('0x5a')]('[Preview][execCall][success]','Queue:\x20'+_0x3a4378['queue']+_0xa950('0x105')+_0x3a4378[_0xa950('0x106')],JSON[_0xa950('0x58')](_0x1425ae));ami[_0xa950('0x28')](_0xa950('0x107'),ut[_0xa950('0xa7')](_0x3a4378,_0xa950('0x108'),_0x2ee7b4[_0xa950('0x27')][_0x3a4378[_0xa950('0x72')]]));_0x5e7fec(ut[_0xa950('0x60')]('Calling'));})[_0xa950('0x8e')](function(_0x1ba837){ut[_0xa950('0x61')](_0xa950('0x109'),_0x1ba837);_0x4a684f(ut[_0xa950('0x60')](_0xa950('0x10a'),_0x445c0c,_0x4ccc64));});}else{_0x567b27[_0xa950('0x3f')]+=0x1;ut[_0xa950('0x10b')](_0x3a4378);rpcDb[_0xa950('0x10c')](_0x3a4378,_0xa950('0x10d'));delete _0x2ee7b4[_0xa950('0x15')][_0x34d520];_0x4a684f(ut[_0xa950('0x60')]('Contact\x20in\x20black\x20List',_0x445c0c,_0x4ccc64));}});};Preview[_0xa950('0xf')]['isTrunkReachable']=function(_0x5600d3){return!_[_0xa950('0x70')](_0x5600d3)&&!_[_0xa950('0x70')](_0x5600d3[_0xa950('0x2a')])&&!_['isNil'](_0x5600d3[_0xa950('0x10e')])&&_0x5600d3[_0xa950('0x10e')]&&!_[_0xa950('0x70')](this[_0xa950('0x14')][util[_0xa950('0x59')](_0xa950('0x10f'),_0x5600d3[_0xa950('0x2a')])])&&!_[_0xa950('0x70')](this[_0xa950('0x14')][util['format']('SIP/%s',_0x5600d3[_0xa950('0x2a')])][_0xa950('0x7a')])&&(this[_0xa950('0x14')][util[_0xa950('0x59')](_0xa950('0x10f'),_0x5600d3[_0xa950('0x2a')])][_0xa950('0x7a')]==='reachable'||this[_0xa950('0x14')][util[_0xa950('0x59')](_0xa950('0x10f'),_0x5600d3['name'])][_0xa950('0x7a')]===_0xa950('0x110'));};Preview['prototype'][_0xa950('0x111')]=function(_0xcb37d7,_0x3e7476){var _0x3a35d8=this;return new BPromise(function(_0x2a1a0e,_0x26f847){_0x3a35d8[_0xa950('0x112')](_0xcb37d7,_0x3e7476)[_0xa950('0x86')](function(_0x3a81a8){_0x2a1a0e(_[_0xa950('0x75')](_0x3a81a8,[_0xa950('0x60')]));})['catch'](function(_0x201856){if(_0x201856[_0xa950('0x113')]){rpcDb['unlockContact'](_0xcb37d7);}if(_0x201856['active']){rpcDb[_0xa950('0x8f')](_0xcb37d7);}_0x26f847(_['pick'](_0x201856,['message']));});});};Preview[_0xa950('0xf')][_0xa950('0x112')]=function(_0x1dc1b4,_0x1b8342){var _0x23b787=this;return new BPromise(function(_0x53dfee,_0x415b38){var _0x28e96e,_0x269109;rpcDb[_0xa950('0x114')](_0x1dc1b4)[_0xa950('0x86')](function(_0xdb368b){if(!_[_0xa950('0x70')](_0xdb368b[0x0])){_0x269109=_0xdb368b[0x0][_0xa950('0x115')]?![]:!![];_0x28e96e=_0xdb368b[0x0][_0xa950('0x115')]?!![]:![];_0x28e96e=_0x1b8342?!![]:_0x28e96e;}var _0x2b6f53=_0x23b787[_0xa950('0x116')](_0xdb368b);if(_0x2b6f53[_0xa950('0x117')]){rpcDb[_0xa950('0x118')](_[_0xa950('0x75')](_0xdb368b[0x0],['VoiceQueueId',_0xa950('0x119')]))[_0xa950('0x86')](function(_0x39b406){_0x23b787[_0xa950('0x100')](_0x39b406,_0xdb368b[0x0],_0x1b8342,_0x269109,_0x28e96e)[_0xa950('0x86')](function(_0x3eb493){_0x53dfee(_0x3eb493);})[_0xa950('0x8e')](function(_0x56dc97){_0x415b38(_0x56dc97);});})[_0xa950('0x8e')](function(_0x52f2fb){ut['logger']('[Preview][checkIsBlackList]',_0x52f2fb);_0x415b38(ut[_0xa950('0x60')](_0xa950('0x11a'),_0x269109,_0x28e96e));});}else{_0x415b38(ut[_0xa950('0x60')](_0x2b6f53['message'],_0x269109,_0x28e96e));}})[_0xa950('0x8e')](function(_0xf0d4f9){ut['logger'](_0xa950('0x11b'),_0xf0d4f9);_0x415b38(ut[_0xa950('0x60')](_0xa950('0x11a'),![],!![]));});});};Preview[_0xa950('0xf')][_0xa950('0x116')]=function(_0x20612c){if(_['isNil'](_0x20612c)||_[_0xa950('0x104')](_0x20612c)||!_[_0xa950('0x70')](_0x20612c[0x0][_0xa950('0x8a')])&&_[_0xa950('0x70')](_0x20612c[0x0][_0xa950('0x8a')][_0xa950('0x2a')])){ut[_0xa950('0x61')](_0xa950('0x11c'),_0x20612c);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2df1e3=this[_0xa950('0x27')][_0x20612c[0x0][_0xa950('0x71')][_0xa950('0x2a')]];_0x2df1e3['message']='ACTIVE';if(_[_0xa950('0x70')](_0x2df1e3)){ut[_0xa950('0x61')]('[Preview][validateContact][Empty\x20Campaign]',_0x2df1e3);return{'isValid':![],'message':_0xa950('0x11d')};}if(!this['isTrunkReachable'](_0x2df1e3[_0xa950('0x56')])){ut[_0xa950('0x61')](_0xa950('0x11e'),'campaign\x20Name:\x20'+_0x2df1e3[_0xa950('0x2a')]+_0xa950('0x11f'));if(!this[_0xa950('0x9e')](_0x2df1e3[_0xa950('0x9f')])){ut[_0xa950('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x2df1e3[_0xa950('0x2a')]+_0xa950('0x120'));return{'isValid':![],'message':_0xa950('0x121')};}}if(!ut[_0xa950('0x9c')](_0x2df1e3[_0xa950('0x38')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x2df1e3[_0xa950('0x2a')]+_0xa950('0x122'));return{'isValid':![],'message':_0xa950('0x123')+_0x2df1e3['name']+_0xa950('0x122')};}return{'isValid':!![],'message':_0xa950('0x124')};};Preview[_0xa950('0xf')][_0xa950('0x125')]=function(_0xb49ce0,_0x3972f2,_0x3c4d4e,_0x3c17fd){var _0x6a0dfa=this;return new BPromise(function(_0x37cd61,_0x4ecc18){var _0x588c0c=_0xb49ce0[_0xa950('0xf1')];var _0x12bd1f=_0x6a0dfa[_0xa950('0x9e')](_0x3972f2[_0xa950('0x56')])?util[_0xa950('0x59')]('SIP/%s/%s%s',_0x3972f2[_0xa950('0x56')]['name'],_[_0xa950('0x70')](_0x3972f2['dialPrefix'])?'':_0x3972f2[_0xa950('0x3c')]['trim']()||'',_0x3972f2['dialCutDigit']>0x0?_0x3c4d4e[_0xa950('0x101')][_0xa950('0x102')]['substring'](_0x3972f2[_0xa950('0x126')]):_0x3c4d4e[_0xa950('0x101')]['phone']):util[_0xa950('0x59')](_0xa950('0x127'),_[_0xa950('0x70')](_0x3972f2[_0xa950('0x9f')])?_0x3972f2[_0xa950('0x56')]['name']:_0x3972f2[_0xa950('0x9f')][_0xa950('0x2a')],_[_0xa950('0x70')](_0x3972f2[_0xa950('0x3c')])?'':_0x3972f2[_0xa950('0x3c')][_0xa950('0x128')]()||'',_0x3972f2[_0xa950('0x126')]>0x0?_0x3c4d4e[_0xa950('0x101')]['phone'][_0xa950('0x129')](_0x3972f2[_0xa950('0x126')]):_0x3c4d4e[_0xa950('0x101')][_0xa950('0x102')]);var _0xd873c6=_0x6a0dfa[_0xa950('0x9e')](_0x3972f2[_0xa950('0x56')])?ut[_0xa950('0x12a')](_0x3972f2[_0xa950('0x56')][_0xa950('0x12b')],_0x3972f2[_0xa950('0x39')],_0x3972f2[_0xa950('0x12c')]>0x0?ut[_0xa950('0x12d')](_0x3972f2['dialOriginateCallerIdNumber'],_0x3972f2[_0xa950('0x12c')]):_0x3972f2[_0xa950('0x3a')]):ut[_0xa950('0x12a')](_[_0xa950('0x70')](_0x3972f2[_0xa950('0x9f')])?_0x3972f2[_0xa950('0x56')][_0xa950('0x12b')]:_0x3972f2[_0xa950('0x9f')][_0xa950('0x12b')],_0x3972f2[_0xa950('0x39')],_0x3972f2[_0xa950('0x12c')]>0x0?ut['getCallerIdRandom'](_0x3972f2[_0xa950('0x3a')],_0x3972f2['dialRandomLastDigitCallerIdNumber']):_0x3972f2[_0xa950('0x3a')]);if(_0xd873c6){_0xb49ce0[_0xa950('0x12e')]=ut['extractCalleridName'](_0xd873c6);_0xb49ce0['originatecalleridnum']=ut[_0xa950('0x12f')](_0xd873c6);}var _0x4de2b0=ut[_0xa950('0x130')](_0x3972f2,_0x3c4d4e,_0x12bd1f,_0xd873c6,_0x588c0c,_0xb49ce0);_[_0xa950('0x131')](_0xb49ce0,ut[_0xa950('0x132')](_0x4de2b0));_0xb49ce0[_0xa950('0x133')]=moment()[_0xa950('0x59')](_0xa950('0x90'));ami[_0xa950('0x134')](ut[_0xa950('0x135')](_0xb49ce0,_0x3972f2,_0x4de2b0,_0xb49ce0['activeContact'],_0x3c17fd))[_0xa950('0x86')](function(_0xaeddb6){_0x3972f2['originated']+=0x1;logger[_0xa950('0x5a')](_0xa950('0x136'),_0x588c0c,_0xa950('0xf2'),_0x3972f2[_0xa950('0x2a')],'originated:\x20',_0x3972f2['originated']);_0x37cd61(_0xaeddb6);})[_0xa950('0x8e')](function(_0x5450e6){ut[_0xa950('0xf5')](_0xb49ce0,0xe,_0xa950('0x137'));rpcDb[_0xa950('0xf6')](_0xb49ce0,_0xa950('0x138'));_0x4ecc18(_0x5450e6);});});};Preview[_0xa950('0xf')]['syncNewExten']=function(_0x244fc7){if(this[_0xa950('0x15')][_0x244fc7['linkedid']]){this[_0xa950('0x15')][_0x244fc7[_0xa950('0xb4')]][_0xa950('0x7b')]=_0x244fc7['channel'];}};Preview[_0xa950('0xf')][_0xa950('0x19')]=function(_0x14360d){var _0x3113ec=this;var _0x4450b2=this[_0xa950('0x15')][_0x14360d[_0xa950('0x139')]];if(_0x4450b2){if(_0x4450b2[_0xa950('0x103')]&&this[_0xa950('0x16')][_0x4450b2[_0xa950('0x103')]]){ut[_0xa950('0x13a')](_0x4450b2,this[_0xa950('0x16')][_0x4450b2[_0xa950('0x103')]]['name'],this[_0xa950('0x16')][_0x4450b2['lookAgent']]['id']);}var _0x436b5=_[_0xa950('0x13b')](_0x4450b2);_0x436b5[_0xa950('0xb6')]=moment()[_0xa950('0x59')](_0xa950('0x90'));var _0x105344=_0x3113ec['campaignsPreview'][_0x4450b2[_0xa950('0x72')]];if(ut[_0xa950('0x13c')](_0x14360d[_0xa950('0x13d')])){if(_0x4450b2[_0xa950('0xb2')]){rpcDb['unlockContact'](_0x4450b2[_0xa950('0x106')]);}if(_0x4450b2['activeContact']){rpcDb[_0xa950('0x8f')](_0x4450b2[_0xa950('0x106')]);}ami[_0xa950('0x28')]('custom:agentringnoanswer',ut[_0xa950('0xa7')](_0x4450b2,_0xa950('0x13e'),this[_0xa950('0x27')][_0x4450b2[_0xa950('0x72')]]));this['callProgressDetectingAgent'](_0x436b5,_0x105344,_0x14360d);}else{_0x4450b2[_0xa950('0x133')]=moment()[_0xa950('0x59')](_0xa950('0x90'));ut[_0xa950('0xf5')](_0x436b5,0x4,_0xa950('0xbf'));rpcDb[_0xa950('0xf6')](_0x436b5,_0xa950('0x13f'));}}};Preview['prototype'][_0xa950('0x1b')]=function(_0x1cea0f){var _0x554377=this;var _0x4fda9e=this[_0xa950('0x15')][_0x1cea0f[_0xa950('0xb4')]];var _0x37d86c;if(_0x4fda9e){_0x37d86c=this['campaignsPreview'][_0x4fda9e[_0xa950('0x72')]];logger[_0xa950('0x5a')]('[syncHangup][talking]',_0x1cea0f[_0xa950('0xb4')],'\x20Queue',_0x37d86c[_0xa950('0x2a')],_0xa950('0x74'),_0x37d86c['pTalking']);}if(this[_0xa950('0x15')][_0x1cea0f[_0xa950('0xb4')]]&&_0x1cea0f[_0xa950('0xb4')]!==_0x1cea0f[_0xa950('0xf1')]){if(_0x1cea0f[_0xa950('0x140')]==='16'&&this[_0xa950('0x15')][_0x1cea0f[_0xa950('0xb4')]][_0xa950('0x7f')]){this[_0xa950('0xa1')](_0x1cea0f,_0x1cea0f[_0xa950('0xb4')],_0x1cea0f['cause']);}else if(this[_0xa950('0x15')][_0x1cea0f[_0xa950('0xb4')]][_0xa950('0x7f')]){logger[_0xa950('0x5a')](_0xa950('0x141'),_0x1cea0f[_0xa950('0xb4')],_0x1cea0f[_0xa950('0x140')],'\x20Queue',_0x37d86c['name'],_0xa950('0x74'),_0x37d86c[_0xa950('0x2e')]);this['callProgressDetectingCustomer'](_0x1cea0f,_0x1cea0f['linkedid'],_0x1cea0f[_0xa950('0x140')]);}}else if(_0x4fda9e&&_[_0xa950('0x70')](_0x4fda9e[_0xa950('0x142')])&&_0x37d86c[_0xa950('0x143')]&&_0x1cea0f[_0xa950('0xb4')]===_0x1cea0f['uniqueid']&&_[_0xa950('0x70')](_0x1cea0f['reason'])&&_0x1cea0f['cause']==='16'&&_0x1cea0f[_0xa950('0x144')]==='6'&&_[_0xa950('0xf3')](_0x4fda9e[_0xa950('0x145')])){if(_0x4fda9e['unlockAgent']){rpcDb['unlockContact'](_0x4fda9e[_0xa950('0x106')]);}if(_0x4fda9e[_0xa950('0xb3')]){rpcDb[_0xa950('0x8f')](_0x4fda9e['idContact']);}_0x1cea0f[_0xa950('0xf4')]='22';this[_0xa950('0x146')](_0x4fda9e,_0x37d86c,_0x1cea0f);}else if(_0x4fda9e&&_0x4fda9e[_0xa950('0x145')]){if(_0x1cea0f[_0xa950('0x140')]==='16'&&this[_0xa950('0x15')][_0x1cea0f[_0xa950('0xb4')]]['dialAnswer']){logger[_0xa950('0x5a')](_0xa950('0x147'),_0x1cea0f[_0xa950('0xb4')],_0x1cea0f[_0xa950('0x140')],_0xa950('0xf2'),_0x37d86c['name'],_0xa950('0x74'),_0x37d86c['pTalking']);this[_0xa950('0xa1')](_0x1cea0f,_0x1cea0f[_0xa950('0xb4')],_0x1cea0f[_0xa950('0x140')]);}else if(this[_0xa950('0x15')][_0x1cea0f[_0xa950('0xb4')]]['dialAnswer']){logger['info'](_0xa950('0x141'),_0x1cea0f[_0xa950('0xb4')],_0x1cea0f[_0xa950('0x140')],'\x20Queue',_0x37d86c[_0xa950('0x2a')],_0xa950('0x74'),_0x37d86c[_0xa950('0x2e')]);this[_0xa950('0xa1')](_0x1cea0f,_0x1cea0f[_0xa950('0xb4')],_0x1cea0f['cause']);}}};Preview[_0xa950('0xf')]['syncDialEnd']=function(_0x3d1823){if(this[_0xa950('0x15')][_0x3d1823[_0xa950('0x148')]]&&_0x3d1823[_0xa950('0x148')]!==_0x3d1823[_0xa950('0x149')]){this[_0xa950('0xa1')](_0x3d1823,_0x3d1823[_0xa950('0x148')],_0x3d1823[_0xa950('0xe7')]);}};Preview['prototype'][_0xa950('0x1d')]=function(_0x106a95){if(this[_0xa950('0x15')][_0x106a95[_0xa950('0xb4')]]&&_0x106a95[_0xa950('0xb4')]!==_0x106a95[_0xa950('0xf1')]&&!this['actions'][_0x106a95['linkedid']]['dialAnswer']){if(_0x106a95[_0xa950('0x140')]==='1'){this[_0xa950('0xa1')](_0x106a95,_0x106a95[_0xa950('0xb4')],_0x106a95[_0xa950('0x140')]);}}};Preview[_0xa950('0xf')][_0xa950('0x14a')]=function(_0x537aca,_0x4f520f,_0x4dc9b4){if(this['actions'][_0x537aca]){if(_[_0xa950('0x70')](this[_0xa950('0x15')][_0x537aca][_0xa950('0x14b')])){this[_0xa950('0x15')][_0x537aca][_0xa950('0x14b')]={};}this[_0xa950('0x15')][_0x537aca]['variables'][_0x4f520f]=_0x4dc9b4;}};Preview[_0xa950('0xf')][_0xa950('0x22')]=function(_0x3401a5){try{if(!_[_0xa950('0x70')](_0x3401a5)){if(ut['filterKey'](_['keys'](_0x3401a5[_0xa950('0x14c')])[0x0])){this['addVariable'](_0x3401a5[_0xa950('0xf1')],_[_0xa950('0x14d')](_0x3401a5['variable'])[0x0],_0x3401a5[_0xa950('0x14e')]);}}}catch(_0x3f1b38){logger['error'](_0xa950('0x14f'),util[_0xa950('0x150')](_0x3f1b38,{'showHidden':![],'depth':null}));}};Preview[_0xa950('0xf')][_0xa950('0x24')]=function(_0x34ff3d){if(_0x34ff3d){if(this['actions'][_0x34ff3d['transfertargetlinkedid']]){this[_0xa950('0x15')][_0x34ff3d[_0xa950('0x151')]][_0xa950('0x145')]=!![];}}};Preview[_0xa950('0xf')][_0xa950('0x26')]=function(_0x12405f){if(_0x12405f){if(this[_0xa950('0x15')][_0x12405f['transfererlinkedid']]){this[_0xa950('0x15')][_0x12405f[_0xa950('0x152')]][_0xa950('0x145')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index e6a5245..8059532 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 _0xfe26=['assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','holdtime'];(function(_0x45ab95,_0x1be9c1){var _0x6b9ff9=function(_0x37235e){while(--_0x37235e){_0x45ab95['push'](_0x45ab95['shift']());}};_0x6b9ff9(++_0x1be9c1);}(_0xfe26,0x1cb));var _0x6fe2=function(_0x4e9ac0,_0x23f5f2){_0x4e9ac0=_0x4e9ac0-0x0;var _0x31a1c=_0xfe26[_0x4e9ac0];return _0x31a1c;};'use strict';var util=require(_0x6fe2('0x0'));var BPromise=require(_0x6fe2('0x1'));var logger=require(_0x6fe2('0x2'))('preview');var _=require('lodash');var cmHopper=require(_0x6fe2('0x3'));var cmHopperFinal=require(_0x6fe2('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6fe2('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x6fe2('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4f7e08){return function(_0x32529e){logger[_0x6fe2('0x7')](_0x4f7e08,util[_0x6fe2('0x8')](_0x32529e,{'showHidden':![],'depth':null}));};}function create(_0x78c6b0){return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](cmHopperHistory['createHistory'](_0x78c6b0))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0xc')));}function createAgent(_0x44cc4b){return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](agentReportPreview['createHistory'](_0x44cc4b))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0xc')));}function moveContact(_0x7791f){return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](cmHopper[_0x6fe2('0xd')](_0x7791f,!![]))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0xe')));}exports['checkIsBlackList']=function(_0xe924cf){return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](cmHopperBlack[_0x6fe2('0xf')](_0xe924cf))['catch'](loggerCatch(_0x6fe2('0x10')));};exports['getContactPreview']=function(_0xffc68c){return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](cmHopper['getContactPreview'](_0xffc68c))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0x11')));};exports[_0x6fe2('0x12')]=function(_0x55d362,_0x12e5be){create(_0x55d362)[_0x6fe2('0xb')](loggerCatch(_0x12e5be));moveContact(_0x55d362)[_0x6fe2('0xb')](loggerCatch(_0x12e5be));};exports[_0x6fe2('0x13')]=function(_0x230d12,_0x1b8fdc){createAgent(_0x230d12)['catch'](loggerCatch(_0x1b8fdc));};exports[_0x6fe2('0x14')]=function(_0x4d45c6,_0x216377){create(_0x4d45c6)['catch'](loggerCatch(_0x216377));};exports[_0x6fe2('0x15')]=function(_0xdcbf90,_0x4fd8d0){moveContact(_0xdcbf90)[_0x6fe2('0xb')](loggerCatch(_0x4fd8d0));};exports['rescheduleContact']=function(_0x3e1162,_0x418fd3,_0x16a18d){if(_0x418fd3){_0x3e1162[_0x6fe2('0x16')]=null;}if(_0x16a18d){_0x3e1162[_0x6fe2('0x17')]=![];}return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](cmHopper['rescheduleContact'](_0x3e1162))['catch'](loggerCatch(_0x6fe2('0x18')));};exports[_0x6fe2('0x19')]=function(_0x393ecd){return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](cmHopper['countReScheduled'](_0x393ecd))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0x1a')));};exports['unlockContact']=function(_0x2c8624){return BPromise['resolve']()[_0x6fe2('0xa')](cmHopper['unlockContact']({'UserId':null},_0x2c8624,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x6fe2('0x1b')]=function(_0x2dace2){return BPromise['resolve']()[_0x6fe2('0xa')](cmHopper[_0x6fe2('0x1c')]({'active':![]},_0x2dace2,0x1))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0x1d')));};exports[_0x6fe2('0x1e')]=function(_0x262a6b){var _0x44c671={};_0x44c671[_0x6fe2('0x1f')]=_0x262a6b[_0x6fe2('0x1f')];_0x44c671[_0x6fe2('0x20')]=_0x262a6b[_0x6fe2('0x20')];_0x44c671[_0x6fe2('0x21')]=_0x262a6b[_0x6fe2('0x21')];_0x44c671['calleridname']=_0x262a6b[_0x6fe2('0x22')];_0x44c671[_0x6fe2('0x23')]=_0x262a6b[_0x6fe2('0x23')];_0x44c671[_0x6fe2('0x24')]=_0x262a6b[_0x6fe2('0x25')];_0x44c671['queuecallerleaveAt']=_0x262a6b[_0x6fe2('0x25')];_0x44c671[_0x6fe2('0x26')]=0x1;_0x44c671[_0x6fe2('0x27')]=_0x262a6b['endtime'];_0x44c671[_0x6fe2('0x28')]=_0x262a6b[_0x6fe2('0x29')];_0x44c671['context']=_0x6fe2('0x2a');_0x44c671[_0x6fe2('0x2b')]='xcally-motion-preview';_0x44c671[_0x6fe2('0x2c')]=0x0;_0x44c671[_0x6fe2('0x2d')]=0x1;_0x44c671[_0x6fe2('0x2e')]=_0x262a6b[_0x6fe2('0x29')];_0x44c671[_0x6fe2('0x2f')]=_0x6fe2('0x30');return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](voiceQueueReport[_0x6fe2('0x31')](_0x44c671))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0x32')));};exports[_0x6fe2('0x33')]=function(_0x1c60f5,_0x1dccee){return BPromise['resolve']()['then'](cmHopper[_0x6fe2('0x33')](_0x1c60f5,_0x1dccee))['catch'](loggerCatch(_0x6fe2('0x34')));};exports[_0x6fe2('0x35')]=function(_0x4343e6){return BPromise[_0x6fe2('0x9')]()[_0x6fe2('0xa')](cmHopper[_0x6fe2('0x36')](_0x4343e6,!![],!![]))[_0x6fe2('0xb')](loggerCatch(_0x6fe2('0x37')));}; \ No newline at end of file +var _0x5fa6=['assigned','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','inspect','then','[createHistory]\x20','createHistory','catch','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime'];(function(_0x2f911f,_0x165511){var _0x31f4ab=function(_0x70f98c){while(--_0x70f98c){_0x2f911f['push'](_0x2f911f['shift']());}};_0x31f4ab(++_0x165511);}(_0x5fa6,0x1db));var _0x65fa=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0x5fa6[_0x57fda8];return _0x11c895;};'use strict';var util=require(_0x65fa('0x0'));var BPromise=require(_0x65fa('0x1'));var logger=require(_0x65fa('0x2'))(_0x65fa('0x3'));var _=require(_0x65fa('0x4'));var cmHopper=require(_0x65fa('0x5'));var cmHopperFinal=require(_0x65fa('0x6'));var cmHopperHistory=require(_0x65fa('0x7'));var cmHopperBlack=require(_0x65fa('0x8'));var voiceQueueRt=require(_0x65fa('0x9'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1de399){return function(_0x3bcfd7){logger[_0x65fa('0xa')](_0x1de399,util[_0x65fa('0xb')](_0x3bcfd7,{'showHidden':![],'depth':null}));};}function create(_0x5826d4){return BPromise['resolve']()[_0x65fa('0xc')](cmHopperHistory['createHistory'](_0x5826d4))['catch'](loggerCatch(_0x65fa('0xd')));}function createAgent(_0xdd3bec){return BPromise['resolve']()[_0x65fa('0xc')](agentReportPreview[_0x65fa('0xe')](_0xdd3bec))[_0x65fa('0xf')](loggerCatch(_0x65fa('0xd')));}function moveContact(_0x13630e){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopper[_0x65fa('0x11')](_0x13630e,!![]))[_0x65fa('0xf')](loggerCatch(_0x65fa('0x12')));}exports[_0x65fa('0x13')]=function(_0x1d330b){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopperBlack[_0x65fa('0x13')](_0x1d330b))['catch'](loggerCatch(_0x65fa('0x14')));};exports['getContactPreview']=function(_0x799f39){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopper['getContactPreview'](_0x799f39))[_0x65fa('0xf')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x39d2d0,_0x5137fe){create(_0x39d2d0)[_0x65fa('0xf')](loggerCatch(_0x5137fe));moveContact(_0x39d2d0)[_0x65fa('0xf')](loggerCatch(_0x5137fe));};exports[_0x65fa('0x15')]=function(_0x441bac,_0x125651){createAgent(_0x441bac)[_0x65fa('0xf')](loggerCatch(_0x125651));};exports[_0x65fa('0x16')]=function(_0x570f7a,_0x4d7b3a){create(_0x570f7a)['catch'](loggerCatch(_0x4d7b3a));};exports['createCustomerFinal']=function(_0x2380aa,_0x24a7ed){moveContact(_0x2380aa)[_0x65fa('0xf')](loggerCatch(_0x24a7ed));};exports[_0x65fa('0x17')]=function(_0x6c9a2b,_0x43a3d2,_0x400f33){if(_0x43a3d2){_0x6c9a2b['UserId']=null;}if(_0x400f33){_0x6c9a2b[_0x65fa('0x18')]=![];}return BPromise[_0x65fa('0x10')]()['then'](cmHopper[_0x65fa('0x17')](_0x6c9a2b))[_0x65fa('0xf')](loggerCatch(_0x65fa('0x19')));};exports[_0x65fa('0x1a')]=function(_0x5437a3){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopper[_0x65fa('0x1a')](_0x5437a3))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x65fa('0x1b')]=function(_0x280e65){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopper[_0x65fa('0x1b')]({'UserId':null},_0x280e65,0x1))['catch'](loggerCatch(_0x65fa('0x1c')));};exports['disableContact']=function(_0x290771){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopper[_0x65fa('0x1b')]({'active':![]},_0x290771,0x1))[_0x65fa('0xf')](loggerCatch(_0x65fa('0x1d')));};exports[_0x65fa('0x1e')]=function(_0x48020a){var _0x4c339a={};_0x4c339a['type']=_0x48020a[_0x65fa('0x1f')];_0x4c339a[_0x65fa('0x20')]=_0x48020a[_0x65fa('0x20')];_0x4c339a['calleridnum']=_0x48020a[_0x65fa('0x21')];_0x4c339a[_0x65fa('0x22')]=_0x48020a[_0x65fa('0x22')];_0x4c339a['queue']=_0x48020a[_0x65fa('0x23')];_0x4c339a[_0x65fa('0x24')]=_0x48020a[_0x65fa('0x25')];_0x4c339a['queuecallerleaveAt']=_0x48020a[_0x65fa('0x25')];_0x4c339a['queuecallercomplete']=0x1;_0x4c339a[_0x65fa('0x26')]=_0x48020a['endtime'];_0x4c339a[_0x65fa('0x27')]=_0x48020a[_0x65fa('0x28')];_0x4c339a[_0x65fa('0x29')]=_0x65fa('0x2a');_0x4c339a['exten']=_0x65fa('0x2b');_0x4c339a[_0x65fa('0x2c')]=0x0;_0x4c339a[_0x65fa('0x2d')]=0x1;_0x4c339a['lastAssignedTo']=_0x48020a[_0x65fa('0x28')];_0x4c339a[_0x65fa('0x2e')]=_0x65fa('0x2f');return BPromise[_0x65fa('0x10')]()['then'](voiceQueueReport[_0x65fa('0x30')](_0x4c339a))[_0x65fa('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x65fa('0x31')]=function(_0x26c0d6,_0x14094d){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopper[_0x65fa('0x31')](_0x26c0d6,_0x14094d))[_0x65fa('0xf')](loggerCatch(_0x65fa('0x32')));};exports['rescheduleContactInQueue']=function(_0x345990){return BPromise[_0x65fa('0x10')]()[_0x65fa('0xc')](cmHopper[_0x65fa('0x17')](_0x345990,!![],!![]))[_0x65fa('0xf')](loggerCatch(_0x65fa('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 4ae899c..f135bac 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 _0xc6d9=['scheduledAt','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','status','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','extractCalleridNumber','match','util','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','loggerCatch','inspect','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','starttime','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone'];(function(_0x1104dc,_0x47239c){var _0x4a0bce=function(_0x3cc0cc){while(--_0x3cc0cc){_0x1104dc['push'](_0x1104dc['shift']());}};_0x4a0bce(++_0x47239c);}(_0xc6d9,0x1da));var _0x9c6d=function(_0x40d52a,_0x2e2ac2){_0x40d52a=_0x40d52a-0x0;var _0xebe304=_0xc6d9[_0x40d52a];return _0xebe304;};'use strict';var util=require(_0x9c6d('0x0'));var _=require('lodash');var moment=require(_0x9c6d('0x1'));var logger=require(_0x9c6d('0x2'))(_0x9c6d('0x3'));var ipAgi=process[_0x9c6d('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x3aed3a,_0x341cee){var _0x5258af=moment(_0x3aed3a)[_0x9c6d('0x5')](0x0);var _0x343d02=moment(_0x341cee)['milliseconds'](0x0);return _0x5258af[_0x9c6d('0x6')](_0x343d02,_0x9c6d('0x7'));}exports[_0x9c6d('0x8')]=function(_0x5b57b9){return function(_0x924f54){logger['error'](_0x5b57b9,util[_0x9c6d('0x9')](_0x924f54,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x405a63,_0x1dcffa){logger[_0x9c6d('0xa')](_0x405a63,util['inspect'](_0x1dcffa,{'showHidden':![],'depth':null}));};exports[_0x9c6d('0xb')]=function(_0x125d61,_0x54da72){logger['error'](_0x125d61,util[_0x9c6d('0x9')](_0x54da72,{'showHidden':![],'depth':null}));};exports[_0x9c6d('0xc')]=function(_0x524eba){return function(_0x2ea898){logger[_0x9c6d('0xa')](_0x524eba,util[_0x9c6d('0x9')](_0x2ea898,{'showHidden':![],'depth':null}));};};exports[_0x9c6d('0xd')]=function(_0x18ab88,_0x507183,_0x116342){return{'message':_0x18ab88,'unlock':_0x507183,'active':_0x116342};};exports['getCallerId']=function(_0x28e6df,_0x9733ae,_0x54a038){if(!_[_0x9c6d('0xe')](_0x54a038)&&_0x9c6d('0xf')===typeof _0x54a038&&!_[_0x9c6d('0x10')](_0x54a038)){if(!_[_0x9c6d('0xe')](_0x9733ae)&&_0x9c6d('0xf')===typeof _0x9733ae&&!_[_0x9c6d('0x10')](_0x9733ae)){return util[_0x9c6d('0x11')](_0x9c6d('0x12'),_0x9733ae,_0x54a038);}return util[_0x9c6d('0x11')](_0x9c6d('0x12'),_0x54a038,_0x54a038);}if(!_[_0x9c6d('0xe')](_0x28e6df)&&_0x9c6d('0xf')===typeof _0x28e6df&&!_[_0x9c6d('0x10')](_0x28e6df)){return _0x28e6df;}return _0x9c6d('0x13');};exports['isActive']=function(_0x3c2068){if(_[_0x9c6d('0x14')](_0x3c2068)){return![];}return _0x3c2068;};exports[_0x9c6d('0x15')]=function(_0x2d3c7f,_0x1c4f98,_0xc08645,_0x2eb99f,_0x174002,_0x2fda0b){var _0x2374cb={'XMD-QUEUE':_0x1c4f98[_0x9c6d('0x16')]?_0x1c4f98[_0x9c6d('0x16')][_0x9c6d('0x17')]:'','XMD-CALLERID':_0x2eb99f,'XMD-CALLERID-PREVIEW':_0x2fda0b?util[_0x9c6d('0x11')](_0x9c6d('0x12'),_0x2fda0b[_0x9c6d('0x18')],_0x2fda0b[_0x9c6d('0x19')]):_0x2eb99f,'XMD-DIALID':_0x174002,'XMD-CONTACTID':_0x1c4f98['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2eb99f,'XMD-VOICEQUEUEID':_0x1c4f98[_0x9c6d('0x1a')],'XMD-DIALCHANNEL':_0xc08645,'XMD-DIALTIMEOUT':_0x2d3c7f[_0x9c6d('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x9c6d('0x1c'),_0x2d3c7f['dialQueueProject2']?'g':'',_[_0x9c6d('0x10')](_0x2d3c7f['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2d3c7f['dialPreviewUrl']||'','XMD-AGI':_0x2d3c7f[_0x9c6d('0x1d')]?util['format'](_0x9c6d('0x1e'),ipAgi,_0x2d3c7f[_0x9c6d('0x1d')]):_0x9c6d('0x1f'),'XMD-AGIAFTER':_0x2d3c7f[_0x9c6d('0x20')]?util[_0x9c6d('0x11')](_0x9c6d('0x1e'),ipAgi,_0x2d3c7f[_0x9c6d('0x20')]):_0x9c6d('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x2fda0b?_0x2fda0b[_0x9c6d('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x2fda0b?_0x2fda0b['originatecalleridname']:'','XMD-DESTINATION':_0x9c6d('0x22'),'SIPADDHEADER':_0x9c6d('0x23')};if(!_['isEmpty'](_0x2d3c7f['monitor_format'])){_0x2374cb[util[_0x9c6d('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2d3c7f[_0x9c6d('0x24')];_0x2374cb[util[_0x9c6d('0x11')]('%s',_0x9c6d('0x25'))]=_0x174002;}if(_0x1c4f98&&_0x1c4f98[_0x9c6d('0x26')]){for(var _0x9cfc42 in _0x1c4f98[_0x9c6d('0x26')]){if(_0x1c4f98[_0x9c6d('0x26')][_0x9c6d('0x27')](_0x9cfc42)){if(!_[_0x9c6d('0x14')](_0x1c4f98[_0x9c6d('0x26')][_0x9cfc42])&&_0x9cfc42!=='id'&&_0x9cfc42!==_0x9c6d('0x28')&&_0x9cfc42!==_0x9c6d('0x29')&&_0x9cfc42!==_0x9c6d('0x2a')){_0x2374cb[util[_0x9c6d('0x11')](_0x9c6d('0x2b'),_0x9c6d('0x2c'),_[_0x9c6d('0x2d')](_0x9cfc42))]=_0x1c4f98[_0x9c6d('0x26')][_0x9cfc42];}}}}return _0x2374cb;};exports[_0x9c6d('0x2e')]=function(_0x2dfd81){var _0x5b21df={};for(var _0x52e5ec in _0x2dfd81){if(_0x2dfd81['hasOwnProperty'](_0x52e5ec)){_0x5b21df[util['format']('%s',_[_0x9c6d('0x2f')](_0x52e5ec))]=_0x2dfd81[_0x52e5ec];}}return{'variables':_0x5b21df};};exports[_0x9c6d('0x30')]=function(_0x20858e,_0x5c26dd){if(!_['isNil'](_0x20858e)){if(_0x20858e[_0x9c6d('0x27')]('originated')){if(_0x20858e[_0x9c6d('0x31')]>0x0){_0x20858e[_0x9c6d('0x31')]-=0x1;}else{logger[_0x9c6d('0x32')](_0x9c6d('0x33'),_0x5c26dd);}}}else{logger['error'](_0x9c6d('0x34'),_0x5c26dd);}};exports[_0x9c6d('0x35')]=function(_0x22cf9b){var _0x288b06=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x22cf9b[_0x9c6d('0x36')]=0xd;_0x22cf9b[_0x9c6d('0x37')]='Blacklist';_0x22cf9b['starttime']=_0x288b06;_0x22cf9b[_0x9c6d('0x38')]=_0x288b06;_0x22cf9b[_0x9c6d('0x39')]=_0x288b06;};exports[_0x9c6d('0x3a')]=function(_0x47464b,_0x5aaf8a,_0x2c6661){var _0x11cba9=moment()[_0x9c6d('0x11')](_0x9c6d('0x3b'));_0x47464b[_0x9c6d('0x36')]=_0x5aaf8a;_0x47464b[_0x9c6d('0x37')]=_0x2c6661;_0x47464b[_0x9c6d('0x38')]=_0x11cba9;_0x47464b['ringtime']=getSeconds(_0x47464b[_0x9c6d('0x38')],_0x47464b[_0x9c6d('0x3c')]);};exports[_0x9c6d('0x3d')]=function(_0x10503d,_0x2a8c79,_0xbf6040){_0x10503d[_0x9c6d('0x3e')]=_0x2a8c79;_0x10503d[_0x9c6d('0x3f')]=_0xbf6040;};exports[_0x9c6d('0x40')]=function(_0x7f16c7,_0x4c96d5,_0x550c6f){var _0x15da04=moment()[_0x9c6d('0x11')](_0x9c6d('0x3b'));_0x7f16c7['state']=_0x4c96d5;_0x7f16c7[_0x9c6d('0x37')]=_0x550c6f;_0x7f16c7[_0x9c6d('0x38')]=_0x7f16c7[_0x9c6d('0x38')]?_0x7f16c7['responsetime']:_0x15da04;_0x7f16c7[_0x9c6d('0x39')]=_0x7f16c7[_0x9c6d('0x39')]?_0x7f16c7['endtime']:_0x15da04;_0x7f16c7[_0x9c6d('0x41')]=getSeconds(_0x7f16c7[_0x9c6d('0x38')]||0x0,_0x7f16c7['starttime']||0x0);_0x7f16c7[_0x9c6d('0x42')]=_0x7f16c7[_0x9c6d('0x43')]?getSeconds(_0x7f16c7[_0x9c6d('0x39')],_0x7f16c7[_0x9c6d('0x43')]):0x0;};exports[_0x9c6d('0x44')]=function(_0x22e7fa){return _0x22e7fa==='Failure';};exports['variablesAction']=function(_0x5cf1b2,_0x37dcc6,_0x1918de,_0x105c08,_0xf4b007){var _0x1c783e=_0x105c08?'RECALL':_0x5cf1b2[_0x9c6d('0x18')];_0x1c783e=_0xf4b007?_0x9c6d('0x45'):_0x1c783e;return{'actionid':_0x5cf1b2[_0x9c6d('0x46')],'action':_0x9c6d('0x47'),'channel':_0x5cf1b2[_0x9c6d('0x48')],'callerid':util[_0x9c6d('0x11')](_0x9c6d('0x12'),_0x1c783e,_0x5cf1b2[_0x9c6d('0x19')]),'Exten':_0x9c6d('0x22'),'Context':_0x9c6d('0x49'),'Priority':'1','variable':_0x1918de,'timeout':(_0x37dcc6[_0x9c6d('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5cf1b2[_0x9c6d('0x46')]};};exports[_0x9c6d('0x4b')]=function(_0x458d0d){return _0x458d0d[_0x9c6d('0x4c')]+_0x458d0d['countcongestionretry']+_0x458d0d[_0x9c6d('0x4d')]+_0x458d0d[_0x9c6d('0x4e')]+_0x458d0d[_0x9c6d('0x4f')];};exports[_0x9c6d('0x50')]=function(_0x2f7645){var _0x3432bc=_[_0x9c6d('0x51')](_0x2f7645);_0x3432bc[_0x9c6d('0x36')]=0xf;_0x3432bc[_0x9c6d('0x37')]='Global';return _0x3432bc;};exports[_0x9c6d('0x52')]=function(_0x1ec61b,_0x49d8d0,_0x3a407d){var _0x29e830={};_0x29e830[_0x49d8d0]=_0x1ec61b[_0x49d8d0];_0x29e830[_0x9c6d('0x53')]=![];_0x29e830[_0x9c6d('0x54')]=moment()[_0x9c6d('0x55')](_0x3a407d,'minutes')[_0x9c6d('0x11')](_0x9c6d('0x3b'));_0x29e830[_0x9c6d('0x56')]=_0x1ec61b['ContactId'];_0x29e830['ListId']=_0x1ec61b[_0x9c6d('0x57')];_0x29e830[_0x9c6d('0x1a')]=_0x1ec61b['VoiceQueueId']||undefined;return _0x29e830;};exports[_0x9c6d('0x58')]=function(_0x42e9a5,_0x1b4ec9){if(!_[_0x9c6d('0x14')](_0x42e9a5)){if(_0x42e9a5[_0x9c6d('0x59')]>0x0){_0x42e9a5[_0x9c6d('0x59')]-=0x1;}else{logger[_0x9c6d('0x32')](_0x1b4ec9,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x9c6d('0x32')](_0x1b4ec9,_0x9c6d('0x5a'));}};exports[_0x9c6d('0x5b')]=function(_0x2cf69f){if(_0x2cf69f<=0x0){return!![];}return![];};exports[_0x9c6d('0x5c')]=function(_0x351d86,_0x23670d,_0x523901){_0x351d86['lastevent']=_0x23670d;_0x351d86[_0x9c6d('0x17')]=_0x351d86[_0x9c6d('0x5d')];_0x351d86[_0x9c6d('0x5e')]=_0x351d86[_0x9c6d('0x48')];_0x351d86[_0x9c6d('0x5f')]=_0x9c6d('0x60');if(_0x523901){_0x351d86[_0x9c6d('0x61')]=_0x523901[_0x9c6d('0x61')];}return _0x351d86;};exports[_0x9c6d('0x62')]=function(_0x1459b9){var _0xc4f95e={};_0xc4f95e[_0x9c6d('0x5d')]=_0x1459b9[_0x9c6d('0x5d')];_0xc4f95e[_0x9c6d('0x5e')]=_0x1459b9['channelAgent'];_0xc4f95e[_0x9c6d('0x46')]=_0x1459b9[_0x9c6d('0x46')];return _0xc4f95e;};exports['agentReadyId']=function(_0x151a39){var _0xd00521=[];for(var _0x4fd5f0 in _0x151a39){if(_0x151a39[_0x9c6d('0x27')](_0x4fd5f0)){if(!_[_0x9c6d('0x14')](_0x151a39[_0x4fd5f0])&&_0x151a39[_0x4fd5f0]['state']==='not_inuse'&&_0x151a39[_0x4fd5f0][_0x9c6d('0x63')]==='reachable'){_0xd00521[_0x9c6d('0x64')](_0x151a39[_0x4fd5f0]['id']);}}}return _0xd00521;};exports[_0x9c6d('0x65')]=function(_0x22a60c){var _0x131acd=moment()[_0x9c6d('0x5')](0x0);var _0x141683=moment(_0x22a60c)[_0x9c6d('0x5')](0x0);return _0x131acd[_0x9c6d('0x6')](_0x141683,_0x9c6d('0x7'));};exports['createBody']=function(_0x58949f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58949f[_0x9c6d('0x56')],'ListId':_0x58949f[_0x9c6d('0x57')],'VoiceQueueId':_0x58949f[_0x9c6d('0x1a')]||undefined,'CampaignId':_0x58949f[_0x9c6d('0x66')]||undefined};};exports[_0x9c6d('0x67')]=function(_0x388c73){if(_0x388c73===_0x9c6d('0x46')||_0x388c73===_0x9c6d('0x68')||_0x388c73===_0x9c6d('0x5d')||_0x388c73===_0x9c6d('0x69')||_0x388c73===_0x9c6d('0x6a')||_0x388c73===_0x9c6d('0x6b')||_0x388c73==='membername'||_0x388c73===_0x9c6d('0x48')||_0x388c73===_0x9c6d('0x18')||_0x388c73===_0x9c6d('0x53')||_0x388c73==='calleridnum'||_0x388c73===_0x9c6d('0x54')||_0x388c73===_0x9c6d('0x4c')||_0x388c73==='countcongestionretry'||_0x388c73===_0x9c6d('0x4d')||_0x388c73==='countglobal'||_0x388c73===_0x9c6d('0x6c')||_0x388c73===_0x9c6d('0x6d')||_0x388c73==='callbackat'||_0x388c73===_0x9c6d('0x6e')||_0x388c73===_0x9c6d('0x56')||_0x388c73==='ListId'||_0x388c73===_0x9c6d('0x3f')||_0x388c73==='VoiceQueueId'||_0x388c73==='sipcallid'||_0x388c73===_0x9c6d('0x6f')||_0x388c73===_0x9c6d('0x70')||_0x388c73===_0x9c6d('0x71')||_0x388c73===_0x9c6d('0x72')||_0x388c73===_0x9c6d('0x73')||_0x388c73===_0x9c6d('0x74')||_0x388c73===_0x9c6d('0x75')||_0x388c73==='xmd-dialid'||_0x388c73===_0x9c6d('0x76')||_0x388c73===_0x9c6d('0x77')||_0x388c73===_0x9c6d('0x78')||_0x388c73==='xmd-callerid'||_0x388c73===_0x9c6d('0x79')||_0x388c73==='xmd-agi'||_0x388c73===_0x9c6d('0x7a')||_0x388c73===_0x9c6d('0x7b')||_0x388c73===_0x9c6d('0x7c')||_0x388c73===_0x9c6d('0x7d')||_0x388c73===_0x9c6d('0x7e')||_0x388c73===_0x9c6d('0x7f')||_0x388c73===_0x9c6d('0x80')||_0x388c73===_0x9c6d('0x81')||_0x388c73===_0x9c6d('0x7a')||_0x388c73===_0x9c6d('0x7b')||_0x388c73===_0x9c6d('0x7c')||_0x388c73==='rtpaudioqosjitterbridged'||_0x388c73===_0x9c6d('0x7e')||_0x388c73===_0x9c6d('0x7f')||_0x388c73===_0x9c6d('0x80')||_0x388c73==='rtpaudioqosrttbridged'||_0x388c73===_0x9c6d('0x82')||_0x388c73===_0x9c6d('0x83')||_0x388c73==='state'||_0x388c73===_0x9c6d('0x37')){return![];}return!![];};exports[_0x9c6d('0x84')]=function(_0x561229,_0xba2109){var _0x5e6592,_0x8a60ef,_0x5164eb;if(_0xba2109<=0x0){_0xba2109=0x1;}_0x5e6592=new RegExp(_0x9c6d('0x85')+_0xba2109+'}$');_0x8a60ef=Math[_0x9c6d('0x86')](0xa,_0xba2109-0x1);_0x5164eb=Math[_0x9c6d('0x86')](0xa,_0xba2109)-0x1;return util['format']('%s',_['replace'](_0x561229,_0x5e6592,_[_0x9c6d('0x87')](_0x8a60ef,_0x5164eb)));};exports[_0x9c6d('0x88')]=function(_0x456b6b){var _0x178616=_0x456b6b['match'](/"(.*?)"/);return _0x178616?_0x178616[0x1]:_0x456b6b;};exports[_0x9c6d('0x89')]=function(_0x3ff0e4){var _0xfdef67=_0x3ff0e4[_0x9c6d('0x8a')](/<(.*?)>/);return _0xfdef67?_0xfdef67[0x1]:_0x3ff0e4;}; \ No newline at end of file +var _0x2fa7=['pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','name','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','getDiff','idContact','type','campaigntype','membername','countnoanswerretry','callback','callbackuniqueid','recallme','sipcallid','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','\x5cw{0,','pow','replace','extractCalleridName','match','util','lodash','moment','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','isEmpty','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','uniqueid','channelAgent','from-sip','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink'];(function(_0x24adf8,_0x132dd1){var _0x440306=function(_0x5805f8){while(--_0x5805f8){_0x24adf8['push'](_0x24adf8['shift']());}};_0x440306(++_0x132dd1);}(_0x2fa7,0x134));var _0x72fa=function(_0x14b7ec,_0x744364){_0x14b7ec=_0x14b7ec-0x0;var _0x37a6eb=_0x2fa7[_0x14b7ec];return _0x37a6eb;};'use strict';var util=require(_0x72fa('0x0'));var _=require(_0x72fa('0x1'));var moment=require(_0x72fa('0x2'));var logger=require('../../../../config/logger')(_0x72fa('0x3'));var ipAgi=process[_0x72fa('0x4')]['XCALLY_IP_AGI']||_0x72fa('0x5');function getSeconds(_0x235188,_0x230df3){var _0x353bce=moment(_0x235188)[_0x72fa('0x6')](0x0);var _0x337c2b=moment(_0x230df3)[_0x72fa('0x6')](0x0);return _0x353bce[_0x72fa('0x7')](_0x337c2b,_0x72fa('0x8'));}exports[_0x72fa('0x9')]=function(_0x370f8c){return function(_0x6e32ed){logger[_0x72fa('0xa')](_0x370f8c,util[_0x72fa('0xb')](_0x6e32ed,{'showHidden':![],'depth':null}));};};exports[_0x72fa('0xc')]=function(_0x559273,_0x343b7c){logger[_0x72fa('0xd')](_0x559273,util['inspect'](_0x343b7c,{'showHidden':![],'depth':null}));};exports[_0x72fa('0xe')]=function(_0x1aa494,_0x3e440c){logger['error'](_0x1aa494,util[_0x72fa('0xb')](_0x3e440c,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x482112){return function(_0x5e8367){logger['info'](_0x482112,util['inspect'](_0x5e8367,{'showHidden':![],'depth':null}));};};exports[_0x72fa('0xf')]=function(_0x453c3f,_0x4cbeb2,_0x2bcc0e){return{'message':_0x453c3f,'unlock':_0x4cbeb2,'active':_0x2bcc0e};};exports[_0x72fa('0x10')]=function(_0x25990b,_0xf4d90f,_0x2e3acf){if(!_[_0x72fa('0x11')](_0x2e3acf)&&_0x72fa('0x12')===typeof _0x2e3acf&&!_['isEmpty'](_0x2e3acf)){if(!_[_0x72fa('0x11')](_0xf4d90f)&&_0x72fa('0x12')===typeof _0xf4d90f&&!_['isEmpty'](_0xf4d90f)){return util[_0x72fa('0x13')](_0x72fa('0x14'),_0xf4d90f,_0x2e3acf);}return util[_0x72fa('0x13')](_0x72fa('0x14'),_0x2e3acf,_0x2e3acf);}if(!_[_0x72fa('0x11')](_0x25990b)&&_0x72fa('0x12')===typeof _0x25990b&&!_['isEmpty'](_0x25990b)){return _0x25990b;}return _0x72fa('0x15');};exports[_0x72fa('0x16')]=function(_0x42cd4b){if(_[_0x72fa('0x17')](_0x42cd4b)){return![];}return _0x42cd4b;};exports[_0x72fa('0x18')]=function(_0x49c5fb,_0x415d73,_0x5d87d5,_0x38b660,_0x498359,_0x2820c3){var _0x25fbac={'XMD-QUEUE':_0x415d73[_0x72fa('0x19')]?_0x415d73[_0x72fa('0x19')]['name']:'','XMD-CALLERID':_0x38b660,'XMD-CALLERID-PREVIEW':_0x2820c3?util[_0x72fa('0x13')](_0x72fa('0x14'),_0x2820c3['calleridname'],_0x2820c3[_0x72fa('0x1a')]):_0x38b660,'XMD-DIALID':_0x498359,'XMD-CONTACTID':_0x415d73[_0x72fa('0x1b')],'XMD-CDRTYPE':_0x72fa('0x1c'),'CALLERID(all)':_0x38b660,'XMD-VOICEQUEUEID':_0x415d73[_0x72fa('0x1d')],'XMD-DIALCHANNEL':_0x5d87d5,'XMD-DIALTIMEOUT':_0x49c5fb[_0x72fa('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x72fa('0x13')]('\x22rtTxX%s%s\x22',_0x49c5fb[_0x72fa('0x1f')]?'g':'',_['isEmpty'](_0x49c5fb['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x49c5fb[_0x72fa('0x20')]||'','XMD-AGI':_0x49c5fb[_0x72fa('0x21')]?util[_0x72fa('0x13')](_0x72fa('0x22'),ipAgi,_0x49c5fb[_0x72fa('0x21')]):_0x72fa('0x23'),'XMD-AGIAFTER':_0x49c5fb[_0x72fa('0x1f')]?util[_0x72fa('0x13')](_0x72fa('0x22'),ipAgi,_0x49c5fb['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2820c3?_0x2820c3[_0x72fa('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x2820c3?_0x2820c3[_0x72fa('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x72fa('0x26')](_0x49c5fb[_0x72fa('0x27')])){_0x25fbac[util[_0x72fa('0x13')]('%s',_0x72fa('0x28'))]=_0x49c5fb[_0x72fa('0x27')];_0x25fbac[util[_0x72fa('0x13')]('%s',_0x72fa('0x29'))]=_0x498359;}if(_0x415d73&&_0x415d73[_0x72fa('0x2a')]){for(var _0x4ac9ab in _0x415d73['Contact']){if(_0x415d73['Contact'][_0x72fa('0x2b')](_0x4ac9ab)){if(!_['isNil'](_0x415d73[_0x72fa('0x2a')][_0x4ac9ab])&&_0x4ac9ab!=='id'&&_0x4ac9ab!=='tags'&&_0x4ac9ab!==_0x72fa('0x2c')&&_0x4ac9ab!==_0x72fa('0x2d')){_0x25fbac[util[_0x72fa('0x13')]('%s%s',_0x72fa('0x2e'),_[_0x72fa('0x2f')](_0x4ac9ab))]=_0x415d73[_0x72fa('0x2a')][_0x4ac9ab];}}}}return _0x25fbac;};exports['toLowerVariables']=function(_0x3af31e){var _0x1fae96={};for(var _0x1b41ee in _0x3af31e){if(_0x3af31e[_0x72fa('0x2b')](_0x1b41ee)){_0x1fae96[util[_0x72fa('0x13')]('%s',_[_0x72fa('0x30')](_0x1b41ee))]=_0x3af31e[_0x1b41ee];}}return{'variables':_0x1fae96};};exports['updateOriginated']=function(_0x5bf01d,_0x5d1541){if(!_[_0x72fa('0x17')](_0x5bf01d)){if(_0x5bf01d[_0x72fa('0x2b')](_0x72fa('0x31'))){if(_0x5bf01d[_0x72fa('0x31')]>0x0){_0x5bf01d[_0x72fa('0x31')]-=0x1;}else{logger[_0x72fa('0xa')](_0x72fa('0x32'),_0x5d1541);}}}else{logger[_0x72fa('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5d1541);}};exports[_0x72fa('0x33')]=function(_0x267c38){var _0x1966f9=moment()['format'](_0x72fa('0x34'));_0x267c38[_0x72fa('0x35')]=0xd;_0x267c38[_0x72fa('0x36')]=_0x72fa('0x37');_0x267c38[_0x72fa('0x38')]=_0x1966f9;_0x267c38[_0x72fa('0x39')]=_0x1966f9;_0x267c38['endtime']=_0x1966f9;};exports[_0x72fa('0x3a')]=function(_0x39af2b,_0xebc267,_0xd074a7){var _0x2efe11=moment()[_0x72fa('0x13')](_0x72fa('0x34'));_0x39af2b[_0x72fa('0x35')]=_0xebc267;_0x39af2b[_0x72fa('0x36')]=_0xd074a7;_0x39af2b[_0x72fa('0x39')]=_0x2efe11;_0x39af2b[_0x72fa('0x3b')]=getSeconds(_0x39af2b[_0x72fa('0x39')],_0x39af2b[_0x72fa('0x38')]);};exports[_0x72fa('0x3c')]=function(_0x275c50,_0x45080e,_0x5cfb02){_0x275c50['membername']=_0x45080e;_0x275c50[_0x72fa('0x3d')]=_0x5cfb02;};exports[_0x72fa('0x3e')]=function(_0x5cf833,_0x41c816,_0x3dfebf){var _0x2c69c7=moment()['format'](_0x72fa('0x34'));_0x5cf833[_0x72fa('0x35')]=_0x41c816;_0x5cf833[_0x72fa('0x36')]=_0x3dfebf;_0x5cf833[_0x72fa('0x39')]=_0x5cf833[_0x72fa('0x39')]?_0x5cf833['responsetime']:_0x2c69c7;_0x5cf833[_0x72fa('0x3f')]=_0x5cf833['endtime']?_0x5cf833[_0x72fa('0x3f')]:_0x2c69c7;_0x5cf833['ringtime']=getSeconds(_0x5cf833['responsetime']||0x0,_0x5cf833['starttime']||0x0);_0x5cf833[_0x72fa('0x40')]=_0x5cf833[_0x72fa('0x41')]?getSeconds(_0x5cf833[_0x72fa('0x3f')],_0x5cf833[_0x72fa('0x41')]):0x0;};exports[_0x72fa('0x42')]=function(_0xf75851){return _0xf75851==='Failure';};exports[_0x72fa('0x43')]=function(_0x7cd53f,_0x5c0c33,_0x55a095,_0x3a7491,_0x44bc11){var _0x28d430=_0x3a7491?_0x72fa('0x44'):_0x7cd53f[_0x72fa('0x45')];_0x28d430=_0x44bc11?'BOOKED':_0x28d430;return{'actionid':_0x7cd53f[_0x72fa('0x46')],'action':'originate','channel':_0x7cd53f[_0x72fa('0x47')],'callerid':util[_0x72fa('0x13')](_0x72fa('0x14'),_0x28d430,_0x7cd53f[_0x72fa('0x1a')]),'Exten':'xcally-motion-preview','Context':_0x72fa('0x48'),'Priority':'1','variable':_0x55a095,'timeout':(_0x5c0c33['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x7cd53f[_0x72fa('0x46')]};};exports['totalGlobal']=function(_0x47f562){return _0x47f562[_0x72fa('0x49')]+_0x47f562[_0x72fa('0x4a')]+_0x47f562['countnoanswerretry']+_0x47f562[_0x72fa('0x4b')]+_0x47f562['countnosuchnumberretry'];};exports[_0x72fa('0x4c')]=function(_0x5d7ac2){var _0xbdabaf=_['clone'](_0x5d7ac2);_0xbdabaf[_0x72fa('0x35')]=0xf;_0xbdabaf[_0x72fa('0x36')]=_0x72fa('0x4d');return _0xbdabaf;};exports[_0x72fa('0x4e')]=function(_0x2c9f1e,_0xe388ed,_0x1a52c8){var _0x1c8b0e={};_0x1c8b0e[_0xe388ed]=_0x2c9f1e[_0xe388ed];_0x1c8b0e[_0x72fa('0x4f')]=![];_0x1c8b0e[_0x72fa('0x50')]=moment()[_0x72fa('0x51')](_0x1a52c8,_0x72fa('0x52'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1c8b0e['ContactId']=_0x2c9f1e[_0x72fa('0x1b')];_0x1c8b0e[_0x72fa('0x53')]=_0x2c9f1e[_0x72fa('0x53')];_0x1c8b0e[_0x72fa('0x1d')]=_0x2c9f1e['VoiceQueueId']||undefined;return _0x1c8b0e;};exports[_0x72fa('0x54')]=function(_0x11edc5,_0x2d553c){if(!_['isNil'](_0x11edc5)){if(_0x11edc5[_0x72fa('0x55')]>0x0){_0x11edc5['pTalking']-=0x1;}else{logger[_0x72fa('0xa')](_0x2d553c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x72fa('0xa')](_0x2d553c,_0x72fa('0x56'));}};exports[_0x72fa('0x57')]=function(_0x586339){if(_0x586339<=0x0){return!![];}return![];};exports[_0x72fa('0x58')]=function(_0x3866cf,_0x1394d4,_0x2f9306){_0x3866cf['lastevent']=_0x1394d4;_0x3866cf[_0x72fa('0x59')]=_0x3866cf[_0x72fa('0x5a')];_0x3866cf[_0x72fa('0x5b')]=_0x3866cf[_0x72fa('0x47')];_0x3866cf['motionChannel']=_0x72fa('0x5c');if(_0x2f9306){_0x3866cf[_0x72fa('0x5d')]=_0x2f9306[_0x72fa('0x5d')];}return _0x3866cf;};exports[_0x72fa('0x5e')]=function(_0x398d6a){var _0x20cca3={};_0x20cca3[_0x72fa('0x5a')]=_0x398d6a[_0x72fa('0x5a')];_0x20cca3['interface']=_0x398d6a[_0x72fa('0x47')];_0x20cca3[_0x72fa('0x46')]=_0x398d6a[_0x72fa('0x46')];return _0x20cca3;};exports[_0x72fa('0x5f')]=function(_0x32833e){var _0x342fc0=[];for(var _0x3119af in _0x32833e){if(_0x32833e[_0x72fa('0x2b')](_0x3119af)){if(!_[_0x72fa('0x17')](_0x32833e[_0x3119af])&&_0x32833e[_0x3119af][_0x72fa('0x35')]===_0x72fa('0x60')&&_0x32833e[_0x3119af][_0x72fa('0x61')]==='reachable'){_0x342fc0[_0x72fa('0x62')](_0x32833e[_0x3119af]['id']);}}}return _0x342fc0;};exports[_0x72fa('0x63')]=function(_0x1a7728){var _0x11ebbc=moment()[_0x72fa('0x6')](0x0);var _0x2da160=moment(_0x1a7728)[_0x72fa('0x6')](0x0);return _0x11ebbc[_0x72fa('0x7')](_0x2da160,_0x72fa('0x8'));};exports['createBody']=function(_0x573900){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x573900['ContactId'],'ListId':_0x573900['ListId'],'VoiceQueueId':_0x573900[_0x72fa('0x1d')]||undefined,'CampaignId':_0x573900['CampaignId']||undefined};};exports['filterKey']=function(_0x49cda3){if(_0x49cda3==='uniqueid'||_0x49cda3===_0x72fa('0x64')||_0x49cda3===_0x72fa('0x5a')||_0x49cda3===_0x72fa('0x65')||_0x49cda3===_0x72fa('0x66')||_0x49cda3==='dialAnswer'||_0x49cda3===_0x72fa('0x67')||_0x49cda3===_0x72fa('0x47')||_0x49cda3===_0x72fa('0x45')||_0x49cda3===_0x72fa('0x4f')||_0x49cda3==='calleridnum'||_0x49cda3===_0x72fa('0x50')||_0x49cda3==='countbusyretry'||_0x49cda3==='countcongestionretry'||_0x49cda3===_0x72fa('0x68')||_0x49cda3==='countglobal'||_0x49cda3===_0x72fa('0x69')||_0x49cda3===_0x72fa('0x6a')||_0x49cda3==='callbackat'||_0x49cda3===_0x72fa('0x6b')||_0x49cda3===_0x72fa('0x1b')||_0x49cda3===_0x72fa('0x53')||_0x49cda3===_0x72fa('0x3d')||_0x49cda3===_0x72fa('0x1d')||_0x49cda3===_0x72fa('0x6c')||_0x49cda3==='xmd-voicequeueid'||_0x49cda3==='xmd-queue'||_0x49cda3===_0x72fa('0x6d')||_0x49cda3===_0x72fa('0x6e')||_0x49cda3==='xmd-dialurl'||_0x49cda3==='xmd-dialtimeout'||_0x49cda3===_0x72fa('0x6f')||_0x49cda3===_0x72fa('0x70')||_0x49cda3==='xmd-dialchannel'||_0x49cda3===_0x72fa('0x71')||_0x49cda3===_0x72fa('0x72')||_0x49cda3==='xmd-callerid'||_0x49cda3===_0x72fa('0x73')||_0x49cda3===_0x72fa('0x74')||_0x49cda3===_0x72fa('0x75')||_0x49cda3===_0x72fa('0x76')||_0x49cda3===_0x72fa('0x77')||_0x49cda3===_0x72fa('0x78')||_0x49cda3===_0x72fa('0x79')||_0x49cda3===_0x72fa('0x7a')||_0x49cda3===_0x72fa('0x7b')||_0x49cda3===_0x72fa('0x7c')||_0x49cda3===_0x72fa('0x75')||_0x49cda3==='rtpaudioqosbridged'||_0x49cda3===_0x72fa('0x77')||_0x49cda3===_0x72fa('0x78')||_0x49cda3===_0x72fa('0x79')||_0x49cda3===_0x72fa('0x7a')||_0x49cda3===_0x72fa('0x7b')||_0x49cda3===_0x72fa('0x7c')||_0x49cda3===_0x72fa('0x7d')||_0x49cda3==='bridgepvtcallid'||_0x49cda3===_0x72fa('0x35')||_0x49cda3===_0x72fa('0x36')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3607ab,_0x2f7ae7){var _0x4cd56f,_0x2faf7a,_0x5001b4;if(_0x2f7ae7<=0x0){_0x2f7ae7=0x1;}_0x4cd56f=new RegExp(_0x72fa('0x7e')+_0x2f7ae7+'}$');_0x2faf7a=Math[_0x72fa('0x7f')](0xa,_0x2f7ae7-0x1);_0x5001b4=Math['pow'](0xa,_0x2f7ae7)-0x1;return util[_0x72fa('0x13')]('%s',_[_0x72fa('0x80')](_0x3607ab,_0x4cd56f,_['random'](_0x2faf7a,_0x5001b4)));};exports[_0x72fa('0x81')]=function(_0x5406f1){var _0x2d35cc=_0x5406f1[_0x72fa('0x82')](/"(.*?)"/);return _0x2d35cc?_0x2d35cc[0x1]:_0x5406f1;};exports['extractCalleridNumber']=function(_0x2a1bb8){var _0x49e984=_0x2a1bb8['match'](/<(.*?)>/);return _0x49e984?_0x49e984[0x1]:_0x2a1bb8;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 065a81f..2355798 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 _0xda1e=['queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x334b0e,_0x2f4ec0){var _0x47f2b0=function(_0x2132b7){while(--_0x2132b7){_0x334b0e['push'](_0x334b0e['shift']());}};_0x47f2b0(++_0x2f4ec0);}(_0xda1e,0xeb));var _0xeda1=function(_0x255b94,_0x352b45){_0x255b94=_0x255b94-0x0;var _0xc5806b=_0xda1e[_0x255b94];return _0xc5806b;};'use strict';exports[_0xeda1('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xeda1('0x1'),'required':!![]},'membername':{'type':_0xeda1('0x1'),'required':!![]},'penalty':{'type':_0xeda1('0x2'),'required':![]},'paused':{'type':_0xeda1('0x3'),'required':![]}};exports[_0xeda1('0x4')]={'queue':{'type':_0xeda1('0x1'),'required':!![]},'interface':{'type':_0xeda1('0x1'),'required':!![]}};exports[_0xeda1('0x5')]={'interface':{'type':_0xeda1('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xeda1('0x1'),'required':![]}};exports[_0xeda1('0x6')]={'module':{'type':_0xeda1('0x1'),'required':![]}};exports[_0xeda1('0x7')]={'uniqueid':{'type':_0xeda1('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xeda1('0x1')},'mixmonitorid':{'type':_0xeda1('0x1')}};exports[_0xeda1('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xeda1('0x9')]={'uniqueid':{'type':_0xeda1('0x1'),'required':!![]},'exten':{'type':_0xeda1('0x1'),'required':!![]},'context':{'type':_0xeda1('0x1')}}; \ No newline at end of file +var _0x8344=['queueremove','boolean','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x3a4564,_0x2f661c){var _0x1bafdb=function(_0x284c91){while(--_0x284c91){_0x3a4564['push'](_0x3a4564['shift']());}};_0x1bafdb(++_0x2f661c);}(_0x8344,0xd5));var _0x4834=function(_0x2b21e6,_0x4d3720){_0x2b21e6=_0x2b21e6-0x0;var _0x275a45=_0x8344[_0x2b21e6];return _0x275a45;};'use strict';exports[_0x4834('0x0')]={'queue':{'type':_0x4834('0x1'),'required':!![]},'interface':{'type':_0x4834('0x1'),'required':!![]},'membername':{'type':_0x4834('0x1'),'required':!![]},'penalty':{'type':_0x4834('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x4834('0x3')]={'queue':{'type':_0x4834('0x1'),'required':!![]},'interface':{'type':_0x4834('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x4834('0x4')},'reason':{'type':_0x4834('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x4834('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x4834('0x1'),'required':!![]}};exports[_0x4834('0x5')]={'uniqueid':{'type':_0x4834('0x1'),'required':!![]},'filename':{'type':_0x4834('0x1')},'format':{'type':_0x4834('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x4834('0x6')]={'uniqueid':{'type':_0x4834('0x1'),'required':!![]}};exports[_0x4834('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x4834('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 5178883..ec0300f 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 _0x1956=['initCampaignHopperHistory','initFaxAccounts','exports','bluebird','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','format','SIP/%s','name','hasOwnProperty','mapKeys','isNil','interface','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks','voiceQueues','initTriggers','triggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts','servicenowAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','total','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions'];(function(_0x51fb3c,_0x28a763){var _0x941d96=function(_0x91294c){while(--_0x91294c){_0x51fb3c['push'](_0x51fb3c['shift']());}};_0x941d96(++_0x28a763);}(_0x1956,0x19b));var _0x6195=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x1956[_0x41d432];return _0x1650f9;};'use strict';var BPromise=require(_0x6195('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x6195('0x1'));var Agent=require(_0x6195('0x2'));var Telephone=require(_0x6195('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x6195('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x6195('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x6195('0x6'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x6195('0x7'));var SugarcrmAccount=require(_0x6195('0x8'));var ZohoAccount=require(_0x6195('0x9'));var DeskAccount=require(_0x6195('0xa'));var VtigerAccount=require(_0x6195('0xb'));var ServicenowAccount=require(_0x6195('0xc'));var Dynamics365Account=require(_0x6195('0xd'));var FreshsalesAccount=require(_0x6195('0xe'));var FaxAccount=require(_0x6195('0xf'));var Realtime=function(){this[_0x6195('0x10')]={};this[_0x6195('0x11')]={};this[_0x6195('0x12')]={};this['voiceQueues']={};this['triggers']={};this[_0x6195('0x13')]={};this[_0x6195('0x14')]={};this[_0x6195('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6195('0x16')]={};this[_0x6195('0x17')]={};this[_0x6195('0x18')]={};this[_0x6195('0x19')]={};this[_0x6195('0x1a')]={};this['settings']={};this[_0x6195('0x1b')]={};this[_0x6195('0x1c')]={};this['sugarcrmAccounts']={};this[_0x6195('0x1d')]={};this['zohoAccounts']={};this[_0x6195('0x1e')]={};this[_0x6195('0x1f')]={};this['servicenowAccounts']={};this[_0x6195('0x20')]={};this[_0x6195('0x21')]={};this[_0x6195('0x22')]={};};function freeIsNotKey(_0x421c05,_0xfa0e5b,_0x23ec53){var _0x23dbea=_['mapKeys'](_0x421c05,function(_0x1efeb2,_0x2f6b71){return _0x1efeb2[_0x23ec53];});for(var _0x5aa534 in _0xfa0e5b){if(_0xfa0e5b['hasOwnProperty'](_0x5aa534)){if(!_0x23dbea[_0x5aa534]){delete _0xfa0e5b[_0x5aa534];}}}}function freeIsNotKeySip(_0x130a56,_0x370ead){var _0x1f5997=_['mapKeys'](_0x130a56,function(_0xd7ab5f,_0x3423bb){return util[_0x6195('0x23')](_0x6195('0x24'),_0xd7ab5f[_0x6195('0x25')]);});for(var _0x352b27 in _0x370ead){if(_0x370ead[_0x6195('0x26')](_0x352b27)){if(!_0x1f5997[_0x352b27]){delete _0x370ead[_0x352b27];}}}}function freeIsNotKeyAgent(_0x1ce294,_0x409d58){var _0xe43425=_[_0x6195('0x27')](_0x1ce294,function(_0x17d610,_0x5517bc){var _0x36ed44=_[_0x6195('0x28')](_0x17d610[_0x6195('0x29')])?util[_0x6195('0x23')]('SIP/%s',_0x17d610['name']):_0x17d610[_0x6195('0x29')];return _0x36ed44;});for(var _0x5523c0 in _0x409d58){if(_0x409d58[_0x6195('0x26')](_0x5523c0)){if(!_0xe43425[_0x5523c0]){delete _0x409d58[_0x5523c0];}}}}function clearVoiceCallReports(_0x3e5817){_0x3e5817['total']=0x0;_0x3e5817[_0x6195('0x2a')]=0x0;_0x3e5817[_0x6195('0x2b')]=0x0;_0x3e5817[_0x6195('0x2c')]=0x0;_0x3e5817[_0x6195('0x2d')]=0x0;}function clearCampaigns(_0x30704b){if(!_[_0x6195('0x2e')](_0x30704b)){for(var _0x3e151c in _0x30704b){if(_0x30704b['hasOwnProperty'](_0x3e151c)){_0x30704b[_0x3e151c][_0x6195('0x2f')]=0x0;_0x30704b[_0x3e151c][_0x6195('0x30')]=0x0;}}}}function clearVoiceQueues(_0x304c50){if(!_['isEmpty'](_0x304c50)){for(var _0x63290c in _0x304c50){if(_0x304c50[_0x6195('0x26')](_0x63290c)){_0x304c50[_0x63290c]['total']=0x0;_0x304c50[_0x63290c][_0x6195('0x2a')]=0x0;_0x304c50[_0x63290c][_0x6195('0x31')]=0x0;_0x304c50[_0x63290c][_0x6195('0x32')]=0x0;_0x304c50[_0x63290c]['sumHoldTime']=0x0;_0x304c50[_0x63290c][_0x6195('0x2c')]=0x0;_0x304c50[_0x63290c][_0x6195('0x2d')]=0x0;_0x304c50[_0x63290c]['outboundAnswerAgiCallsDay']=0x0;_0x304c50[_0x63290c]['outboundNoAnswerCallsDay']=0x0;_0x304c50[_0x63290c][_0x6195('0x33')]=0x0;_0x304c50[_0x63290c][_0x6195('0x34')]=0x0;_0x304c50[_0x63290c]['outboundNoSuchCallsDay']=0x0;_0x304c50[_0x63290c]['outboundUnknownCallsDay']=0x0;_0x304c50[_0x63290c][_0x6195('0x35')]=0x0;_0x304c50[_0x63290c]['outboundDropCallsDayCallersExit']=0x0;_0x304c50[_0x63290c]['outboundBlacklistCallsDay']=0x0;_0x304c50[_0x63290c][_0x6195('0x36')]=0x0;_0x304c50[_0x63290c]['outboundRejectCallsDay']=0x0;_0x304c50[_0x63290c][_0x6195('0x37')]=0x0;_0x304c50[_0x63290c][_0x6195('0x38')]=0x0;_0x304c50[_0x63290c][_0x6195('0x39')]=0x0;_0x304c50[_0x63290c][_0x6195('0x3a')]=!![];}}}}Realtime[_0x6195('0x3b')]['mergeFromDatabase']=function(_0x3ee42a,_0x83e5e1){for(var _0x4dd166 in _0x83e5e1){if(_0x3ee42a[_0x6195('0x26')](_0x4dd166)){_0x3ee42a[_0x4dd166]=_0x83e5e1[_0x4dd166];}}};Realtime[_0x6195('0x3b')][_0x6195('0x3c')]=function(){var _0x56e328=this;return function(_0x2efd88){if(_0x2efd88){freeIsNotKeyAgent(_0x2efd88,_0x56e328['agents']);for(var _0x12d22f=0x0,_0x42882a={},_0xf85adf={};_0x12d22f<_0x2efd88[_0x6195('0x3d')];_0x12d22f+=0x1){_0x42882a=_0x2efd88[_0x12d22f];var _0x1afa6c=_[_0x6195('0x28')](_0x42882a[_0x6195('0x29')])?util[_0x6195('0x23')](_0x6195('0x24'),_0x42882a[_0x6195('0x25')]):_0x42882a['interface'];if(_[_0x6195('0x3e')](_0x56e328[_0x6195('0x10')][_0x1afa6c])){_0x56e328[_0x6195('0x10')][_0x1afa6c]=new Agent(_0x42882a);}else{_0x56e328[_0x6195('0x3f')](_0x56e328[_0x6195('0x10')][_0x1afa6c],_0x42882a);}}}return _0x56e328['agents'];};};Realtime[_0x6195('0x3b')][_0x6195('0x40')]=function(){var _0x471101=this;return function(_0x165a5d){if(_0x165a5d){freeIsNotKeySip(_0x165a5d,_0x471101[_0x6195('0x11')]);for(var _0xc225c3=0x0,_0x45d346={},_0x580437={};_0xc225c3<_0x165a5d['length'];_0xc225c3+=0x1){_0x45d346=_0x165a5d[_0xc225c3];if(_['isUndefined'](_0x471101[_0x6195('0x11')][util['format'](_0x6195('0x24'),_0x45d346[_0x6195('0x25')])])){_0x471101[_0x6195('0x11')][util[_0x6195('0x23')](_0x6195('0x24'),_0x45d346[_0x6195('0x25')])]=new Telephone(_0x45d346);}else{_0x471101[_0x6195('0x3f')](_0x471101[_0x6195('0x11')][util[_0x6195('0x23')](_0x6195('0x24'),_0x45d346[_0x6195('0x25')])],_0x45d346);}}}return _0x471101[_0x6195('0x11')];};};Realtime['prototype'][_0x6195('0x41')]=function(){var _0x5316cc=this;return function(_0x3541d1){if(_0x3541d1){freeIsNotKeySip(_0x3541d1,_0x5316cc['trunks']);for(var _0x3996ce=0x0,_0x626e51={},_0x184873={};_0x3996ce<_0x3541d1[_0x6195('0x3d')];_0x3996ce+=0x1){_0x626e51=_0x3541d1[_0x3996ce];if(_[_0x6195('0x3e')](_0x5316cc[_0x6195('0x12')][util[_0x6195('0x23')](_0x6195('0x24'),_0x626e51['name'])])){_0x5316cc[_0x6195('0x12')][util['format'](_0x6195('0x24'),_0x626e51[_0x6195('0x25')])]=new Trunk(_0x626e51);}else{_0x5316cc[_0x6195('0x3f')](_0x5316cc[_0x6195('0x12')][util['format']('SIP/%s',_0x626e51[_0x6195('0x25')])],_0x626e51);}}}return _0x5316cc[_0x6195('0x12')];};};Realtime[_0x6195('0x3b')]['initVoiceQueues']=function(){var _0x26be40=this;return function(_0x5f4e84){if(_0x5f4e84){freeIsNotKey(_0x5f4e84,_0x26be40[_0x6195('0x42')],_0x6195('0x25'));for(var _0x352cae=0x0,_0x11b447={},_0x1865a1={};_0x352cae<_0x5f4e84[_0x6195('0x3d')];_0x352cae+=0x1){_0x11b447=_0x5f4e84[_0x352cae];if(_['isUndefined'](_0x26be40[_0x6195('0x42')][_0x11b447[_0x6195('0x25')]])){_0x26be40[_0x6195('0x42')][_0x11b447['name']]=new VoiceQueue(_0x11b447);}else{_0x26be40[_0x6195('0x3f')](_0x26be40[_0x6195('0x42')][_0x11b447[_0x6195('0x25')]],_0x11b447);}}}return _0x26be40[_0x6195('0x42')];};};Realtime[_0x6195('0x3b')][_0x6195('0x43')]=function(){var _0x809be5=this;return function(_0xd842f2){if(_0xd842f2){freeIsNotKey(_0xd842f2,_0x809be5['triggers'],'id');for(var _0x24b0d7=0x0,_0x808d3a={},_0x147d7e={};_0x24b0d7<_0xd842f2['length'];_0x24b0d7+=0x1){_0x808d3a=_0xd842f2[_0x24b0d7];if(_[_0x6195('0x3e')](_0x809be5[_0x6195('0x44')][_0x808d3a['id']])){_0x809be5[_0x6195('0x44')][_0x808d3a['id']]=new Trigger(_0x808d3a);}else{_0x809be5[_0x6195('0x3f')](_0x809be5[_0x6195('0x44')][_0x808d3a['id']],_0x808d3a);}}}return _0x809be5[_0x6195('0x44')];};};Realtime[_0x6195('0x3b')]['initTemplates']=function(){var _0x43e079=this;return function(_0x98a4dc){if(_0x98a4dc){freeIsNotKey(_0x98a4dc,_0x43e079[_0x6195('0x14')],'id');for(var _0x1f11e1=0x0,_0x52ba46={},_0x4eb423={};_0x1f11e1<_0x98a4dc[_0x6195('0x3d')];_0x1f11e1+=0x1){_0x52ba46=_0x98a4dc[_0x1f11e1];if(_[_0x6195('0x3e')](_0x43e079[_0x6195('0x14')][_0x52ba46['id']])){_0x43e079[_0x6195('0x14')][_0x52ba46['id']]=new Template(_0x52ba46);}else{_0x43e079[_0x6195('0x3f')](_0x43e079['templates'][_0x52ba46['id']],_0x52ba46);}}}return _0x43e079['templates'];};};Realtime[_0x6195('0x3b')][_0x6195('0x45')]=function(){var _0x38c25d=this;return function(_0xf6d6a3){if(_0xf6d6a3){freeIsNotKey(_0xf6d6a3,_0x38c25d['zendeskAccounts'],'id');for(var _0x1a865e=0x0,_0x346387={},_0x2b8373={};_0x1a865e<_0xf6d6a3[_0x6195('0x3d')];_0x1a865e+=0x1){_0x346387=_0xf6d6a3[_0x1a865e];if(_[_0x6195('0x3e')](_0x38c25d['zendeskAccounts'][_0x346387['id']])){_0x38c25d[_0x6195('0x1b')][_0x346387['id']]=new ZendeskAccount(_0x346387);}else{_0x38c25d[_0x6195('0x3f')](_0x38c25d[_0x6195('0x1b')][_0x346387['id']],_0x346387);}}}return _0x38c25d['zendeskAccounts'];};};Realtime[_0x6195('0x3b')][_0x6195('0x46')]=function(){var _0x2207d0=this;return function(_0x5617f1){if(_0x5617f1){freeIsNotKey(_0x5617f1,_0x2207d0['salesforceAccounts'],'id');for(var _0x1fc34f=0x0,_0x8b4f46={},_0x3d74e3={};_0x1fc34f<_0x5617f1[_0x6195('0x3d')];_0x1fc34f+=0x1){_0x8b4f46=_0x5617f1[_0x1fc34f];if(_[_0x6195('0x3e')](_0x2207d0[_0x6195('0x1c')][_0x8b4f46['id']])){_0x2207d0[_0x6195('0x1c')][_0x8b4f46['id']]=new SalesforceAccount(_0x8b4f46);}else{_0x2207d0[_0x6195('0x3f')](_0x2207d0[_0x6195('0x1c')][_0x8b4f46['id']],_0x8b4f46);}}}return _0x2207d0[_0x6195('0x1c')];};};Realtime[_0x6195('0x3b')][_0x6195('0x47')]=function(){var _0x335df0=this;return function(_0x78d3e4){if(_0x78d3e4){freeIsNotKey(_0x78d3e4,_0x335df0[_0x6195('0x1d')],'id');for(var _0x3a9e9e=0x0,_0x2f801b={},_0x58d0fc={};_0x3a9e9e<_0x78d3e4[_0x6195('0x3d')];_0x3a9e9e+=0x1){_0x2f801b=_0x78d3e4[_0x3a9e9e];if(_[_0x6195('0x3e')](_0x335df0[_0x6195('0x1d')][_0x2f801b['id']])){_0x335df0[_0x6195('0x1d')][_0x2f801b['id']]=new FreshdeskAccount(_0x2f801b);}else{_0x335df0['mergeFromDatabase'](_0x335df0[_0x6195('0x1d')][_0x2f801b['id']],_0x2f801b);}}}return _0x335df0['freshdeskAccounts'];};};Realtime[_0x6195('0x3b')][_0x6195('0x48')]=function(){var _0x5d5f85=this;return function(_0x41baa4){if(_0x41baa4){freeIsNotKey(_0x41baa4,_0x5d5f85['zohoAccounts'],'id');for(var _0x3f1eab=0x0,_0x482ace={},_0x3072f7={};_0x3f1eab<_0x41baa4[_0x6195('0x3d')];_0x3f1eab+=0x1){_0x482ace=_0x41baa4[_0x3f1eab];if(_[_0x6195('0x3e')](_0x5d5f85[_0x6195('0x49')][_0x482ace['id']])){_0x5d5f85[_0x6195('0x49')][_0x482ace['id']]=new ZohoAccount(_0x482ace);}else{_0x5d5f85[_0x6195('0x3f')](_0x5d5f85[_0x6195('0x49')][_0x482ace['id']],_0x482ace);}}}return _0x5d5f85[_0x6195('0x49')];};};Realtime[_0x6195('0x3b')][_0x6195('0x4a')]=function(){var _0x248b15=this;return function(_0x1fe34b){if(_0x1fe34b){freeIsNotKey(_0x1fe34b,_0x248b15[_0x6195('0x1e')],'id');for(var _0x6fb5c5=0x0,_0x1942ae={},_0x3f056c={};_0x6fb5c5<_0x1fe34b[_0x6195('0x3d')];_0x6fb5c5+=0x1){_0x1942ae=_0x1fe34b[_0x6fb5c5];if(_[_0x6195('0x3e')](_0x248b15[_0x6195('0x1e')][_0x1942ae['id']])){_0x248b15[_0x6195('0x1e')][_0x1942ae['id']]=new DeskAccount(_0x1942ae);}else{_0x248b15[_0x6195('0x3f')](_0x248b15[_0x6195('0x1e')][_0x1942ae['id']],_0x1942ae);}}}return _0x248b15[_0x6195('0x1e')];};};Realtime['prototype'][_0x6195('0x4b')]=function(){var _0x290957=this;return function(_0xefb226){if(_0xefb226){freeIsNotKey(_0xefb226,_0x290957[_0x6195('0x4c')],'id');for(var _0x444403=0x0,_0x3f9e8d={},_0x658d99={};_0x444403<_0xefb226[_0x6195('0x3d')];_0x444403+=0x1){_0x3f9e8d=_0xefb226[_0x444403];if(_['isUndefined'](_0x290957[_0x6195('0x4c')][_0x3f9e8d['id']])){_0x290957[_0x6195('0x4c')][_0x3f9e8d['id']]=new SugarcrmAccount(_0x3f9e8d);}else{_0x290957['mergeFromDatabase'](_0x290957[_0x6195('0x4c')][_0x3f9e8d['id']],_0x3f9e8d);}}}return _0x290957[_0x6195('0x4c')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x56bad8=this;return function(_0x43d3c6){if(_0x43d3c6){freeIsNotKey(_0x43d3c6,_0x56bad8[_0x6195('0x1f')],'id');for(var _0x214e1c=0x0,_0x389375={},_0x4073f2={};_0x214e1c<_0x43d3c6[_0x6195('0x3d')];_0x214e1c+=0x1){_0x389375=_0x43d3c6[_0x214e1c];if(_['isUndefined'](_0x56bad8['vtigerAccounts'][_0x389375['id']])){_0x56bad8[_0x6195('0x1f')][_0x389375['id']]=new VtigerAccount(_0x389375);}else{_0x56bad8[_0x6195('0x3f')](_0x56bad8['vtigerAccounts'][_0x389375['id']],_0x389375);}}}return _0x56bad8[_0x6195('0x1f')];};};Realtime[_0x6195('0x3b')][_0x6195('0x4d')]=function(){var _0x5bfa3f=this;return function(_0xd08cb1){if(_0xd08cb1){freeIsNotKey(_0xd08cb1,_0x5bfa3f[_0x6195('0x4e')],'id');for(var _0x186c53=0x0,_0x1ad3ba={},_0x47f39e={};_0x186c53<_0xd08cb1[_0x6195('0x3d')];_0x186c53+=0x1){_0x1ad3ba=_0xd08cb1[_0x186c53];if(_[_0x6195('0x3e')](_0x5bfa3f[_0x6195('0x4e')][_0x1ad3ba['id']])){_0x5bfa3f[_0x6195('0x4e')][_0x1ad3ba['id']]=new ServicenowAccount(_0x1ad3ba);}else{_0x5bfa3f[_0x6195('0x3f')](_0x5bfa3f[_0x6195('0x4e')][_0x1ad3ba['id']],_0x1ad3ba);}}}return _0x5bfa3f['servicenowAccounts'];};};Realtime[_0x6195('0x3b')]['initDynamics365Accounts']=function(){var _0x9e82b2=this;return function(_0x4b7ef8){if(_0x4b7ef8){freeIsNotKey(_0x4b7ef8,_0x9e82b2['dynamics365Accounts'],'id');for(var _0x269430=0x0,_0x450285={},_0x1fb585={};_0x269430<_0x4b7ef8[_0x6195('0x3d')];_0x269430+=0x1){_0x450285=_0x4b7ef8[_0x269430];if(_[_0x6195('0x3e')](_0x9e82b2[_0x6195('0x20')][_0x450285['id']])){_0x9e82b2[_0x6195('0x20')][_0x450285['id']]=new Dynamics365Account(_0x450285);}else{_0x9e82b2[_0x6195('0x3f')](_0x9e82b2[_0x6195('0x20')][_0x450285['id']],_0x450285);}}}return _0x9e82b2['dynamics365Accounts'];};};Realtime[_0x6195('0x3b')]['initFreshsalesAccounts']=function(){var _0x7c9ec2=this;return function(_0x3e177b){if(_0x3e177b){freeIsNotKey(_0x3e177b,_0x7c9ec2[_0x6195('0x21')],'id');for(var _0x586339=0x0,_0x1a605a={},_0x376be3={};_0x586339<_0x3e177b['length'];_0x586339+=0x1){_0x1a605a=_0x3e177b[_0x586339];if(_[_0x6195('0x3e')](_0x7c9ec2[_0x6195('0x21')][_0x1a605a['id']])){_0x7c9ec2[_0x6195('0x21')][_0x1a605a['id']]=new FreshsalesAccount(_0x1a605a);}else{_0x7c9ec2['mergeFromDatabase'](_0x7c9ec2[_0x6195('0x21')][_0x1a605a['id']],_0x1a605a);}}}return _0x7c9ec2[_0x6195('0x21')];};};Realtime[_0x6195('0x3b')]['initVoiceQueueHopperHistory']=function(){var _0x4fbbbb=this;return function(_0x5afb5b){for(var _0xaa1001=0x0;_0xaa1001<_0x5afb5b[_0x6195('0x3d')];_0xaa1001+=0x1){_[_0x6195('0x4f')](_0x4fbbbb[_0x6195('0x42')][_0x5afb5b[_0xaa1001][_0x6195('0x25')]],_0x5afb5b[_0xaa1001]);}return _0x4fbbbb['voiceQueues'];};};Realtime['prototype'][_0x6195('0x50')]=function(){var _0x20ccdf=this;return function(_0xbc79dd){clearVoiceQueues(_0x20ccdf[_0x6195('0x42')]);if(_0xbc79dd){_0xbc79dd=_[_0x6195('0x51')](_0xbc79dd,_0x6195('0x52'));for(var _0x24884a in _0xbc79dd){if(_0xbc79dd[_0x6195('0x26')](_0x24884a)){var _0x5470a6={};for(var _0x2b7bbd=0x0;_0x2b7bbd<_0xbc79dd[_0x24884a][_0x6195('0x3d')];_0x2b7bbd+=0x1){var _0x2f815f=_0xbc79dd[_0x24884a][_0x2b7bbd][_0x6195('0x53')];if(_0x20ccdf[_0x6195('0x42')][_0x2f815f]){if(_0xbc79dd[_0x24884a][_0x2b7bbd]['queuecallerexit']){_0x20ccdf[_0x6195('0x42')][_0x2f815f][_0x6195('0x31')]+=0x1;}if(_0xbc79dd[_0x24884a][_0x2b7bbd][_0x6195('0x54')]){_0x20ccdf['voiceQueues'][_0x2f815f]['abandoned']+=0x1;}_0x20ccdf[_0x6195('0x42')][_0x2f815f][_0x6195('0x2b')]+=moment(_0xbc79dd[_0x24884a][_0x2b7bbd]['queuecallerleaveAt'])[_0x6195('0x55')](moment(_0xbc79dd[_0x24884a][_0x2b7bbd][_0x6195('0x56')]),_0x6195('0x57'))||0x0;if(_0x2b7bbd===_0xbc79dd[_0x24884a]['length']-0x1){_0x20ccdf['voiceQueues'][_0x2f815f]['sumDuration']+=moment(_0xbc79dd[_0x24884a][_0x2b7bbd]['queuecallercompleteAt']||_0xbc79dd[_0x24884a][_0x2b7bbd][_0x6195('0x58')]||_0xbc79dd[_0x24884a][_0x2b7bbd][_0x6195('0x59')])[_0x6195('0x55')](moment(_0xbc79dd[_0x24884a][_0x2b7bbd][_0x6195('0x56')]),_0x6195('0x57'))||0x0;_0x20ccdf[_0x6195('0x42')][_0x2f815f][_0x6195('0x5a')]+=0x1;if(_0xbc79dd[_0x24884a][_0x2b7bbd]['queuecallercomplete']){_0x20ccdf[_0x6195('0x42')][_0x2f815f][_0x6195('0x2a')]+=0x1;_0x20ccdf[_0x6195('0x42')][_0x2f815f][_0x6195('0x2d')]+=moment(_0xbc79dd[_0x24884a][_0x2b7bbd]['queuecallercompleteAt'])['diff'](moment(_0xbc79dd[_0x24884a][_0x2b7bbd]['queuecallerleaveAt']),_0x6195('0x57'))||0x0;}}else{_0x20ccdf[_0x6195('0x42')][_0x2f815f][_0x6195('0x2c')]+=_0x20ccdf[_0x6195('0x42')][_0x2f815f][_0x6195('0x2b')]||0x0;}}}}}}return _0x20ccdf['voiceQueues'];};};Realtime[_0x6195('0x3b')][_0x6195('0x5b')]=function(){var _0x4fe5a9=this;return function(_0x436e90){clearVoiceCallReports(_0x4fe5a9[_0x6195('0x15')]);if(_0x436e90){for(var _0xa541b7=0x0;_0xa541b7<_0x436e90[_0x6195('0x3d')];_0xa541b7+=0x1){_0x4fe5a9['outbound'][_0x6195('0x5a')]+=0x1;_0x4fe5a9[_0x6195('0x15')][_0x6195('0x2c')]+=_0x436e90[_0xa541b7][_0x6195('0x5c')];if(_0x436e90[_0xa541b7][_0x6195('0x5d')]===_0x6195('0x5e')){_0x4fe5a9[_0x6195('0x15')][_0x6195('0x2a')]+=0x1;_0x4fe5a9[_0x6195('0x15')]['sumHoldTime']+=_0x436e90[_0xa541b7][_0x6195('0x5c')]-_0x436e90[_0xa541b7][_0x6195('0x5f')]||0x0;_0x4fe5a9['outbound'][_0x6195('0x2d')]+=_0x436e90[_0xa541b7]['billableseconds'];}}}return _0x4fe5a9[_0x6195('0x15')];};};Realtime[_0x6195('0x3b')]['initCampaigns']=function(){var _0x736d6a=this;return function(_0x24aee2){if(_0x24aee2){freeIsNotKey(_0x24aee2,_0x736d6a[_0x6195('0x13')],_0x6195('0x25'));for(var _0x1d9f39=0x0,_0x5146f7={};_0x1d9f39<_0x24aee2['length'];_0x1d9f39+=0x1){_0x5146f7=_0x24aee2[_0x1d9f39];if(_[_0x6195('0x3e')](_0x736d6a[_0x6195('0x13')][_0x5146f7[_0x6195('0x25')]])){_0x736d6a[_0x6195('0x13')][_0x5146f7[_0x6195('0x25')]]=new Campaign(_0x5146f7);}else{_0x736d6a[_0x6195('0x3f')](_0x736d6a[_0x6195('0x13')][_0x5146f7[_0x6195('0x25')]],_0x5146f7);_0x736d6a['campaigns'][_0x5146f7[_0x6195('0x25')]][_0x6195('0x60')]=_0x5146f7['SquareProject']?_0x5146f7[_0x6195('0x61')][_0x6195('0x25')]:undefined;}}}return _0x736d6a[_0x6195('0x13')];};};Realtime[_0x6195('0x3b')][_0x6195('0x62')]=function(){var _0x410e52=this;return function(_0x11c303){if(_0x11c303){freeIsNotKey(_0x11c303,_0x410e52[_0x6195('0x16')],'id');for(var _0x223bd3=0x0,_0x31e10e={};_0x223bd3<_0x11c303[_0x6195('0x3d')];_0x223bd3+=0x1){_0x31e10e=_0x11c303[_0x223bd3];if(_[_0x6195('0x3e')](_0x410e52[_0x6195('0x16')][_0x31e10e['id']])){_0x410e52[_0x6195('0x16')][_0x31e10e['id']]=new VoiceExtension(_0x31e10e);}else{_0x410e52[_0x6195('0x3f')](_0x410e52[_0x6195('0x16')][_0x31e10e['id']],_0x31e10e);}}}return _0x410e52[_0x6195('0x16')];};};Realtime[_0x6195('0x3b')][_0x6195('0x63')]=function(){var _0x112faf=this;return function(_0x4c372f){clearCampaigns(_0x112faf[_0x6195('0x13')]);for(var _0x4866c6=0x0;_0x4866c6<_0x4c372f[_0x6195('0x3d')];_0x4866c6+=0x1){_[_0x6195('0x4f')](_0x112faf[_0x6195('0x13')][_0x4c372f[_0x4866c6][_0x6195('0x25')]],_0x4c372f[_0x4866c6]);}return _0x112faf['campaigns'];};};Realtime[_0x6195('0x3b')][_0x6195('0x64')]=function(){var _0x3f3181=this;return function(_0x1288d1){if(_0x1288d1){freeIsNotKey(_0x1288d1,_0x3f3181[_0x6195('0x22')],'id');for(var _0x5c3e03=0x0,_0x213d23={},_0x37939a={};_0x5c3e03<_0x1288d1[_0x6195('0x3d')];_0x5c3e03+=0x1){_0x213d23=_0x1288d1[_0x5c3e03];if(_[_0x6195('0x3e')](_0x3f3181[_0x6195('0x22')][_0x213d23['id']])){_0x3f3181['faxAccounts'][_0x213d23['id']]=new FaxAccount(_0x213d23);}else{_0x3f3181[_0x6195('0x3f')](_0x3f3181[_0x6195('0x22')][_0x213d23['id']],_0x213d23);}}}return _0x3f3181[_0x6195('0x22')];};};module[_0x6195('0x65')]=Realtime; \ No newline at end of file +var _0x388e=['format','name','hasOwnProperty','isNil','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','length','SIP/%s','isUndefined','agents','mergeFromDatabase','initTelephones','initTrunks','initVoiceQueues','initTriggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','sugarcrmAccounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','merge','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','exports','util','lodash','moment','../model/telephone','../model/voiceQueue','../model/trigger','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','mapKeys'];(function(_0x2913c9,_0x40213d){var _0x39d430=function(_0x3364e1){while(--_0x3364e1){_0x2913c9['push'](_0x2913c9['shift']());}};_0x39d430(++_0x40213d);}(_0x388e,0x162));var _0xe388=function(_0x368ccb,_0xe3c608){_0x368ccb=_0x368ccb-0x0;var _0x2f720d=_0x388e[_0x368ccb];return _0x2f720d;};'use strict';var BPromise=require('bluebird');var util=require(_0xe388('0x0'));var _=require(_0xe388('0x1'));var moment=require(_0xe388('0x2'));var Agent=require('../model/agent');var Telephone=require(_0xe388('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xe388('0x4'));var Trigger=require(_0xe388('0x5'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xe388('0x6'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xe388('0x7'));var ZohoAccount=require(_0xe388('0x8'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe388('0x9'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xe388('0xa'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0xe388('0xb')]={};this[_0xe388('0xc')]={};this[_0xe388('0xd')]={};this[_0xe388('0xe')]={};this['campaigns']={};this[_0xe388('0xf')]={};this[_0xe388('0x10')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe388('0x11')]={};this['channels']={};this[_0xe388('0x12')]={};this[_0xe388('0x13')]={};this[_0xe388('0x14')]={};this[_0xe388('0x15')]={};this[_0xe388('0x16')]={};this[_0xe388('0x17')]={};this['sugarcrmAccounts']={};this[_0xe388('0x18')]={};this[_0xe388('0x19')]={};this[_0xe388('0x1a')]={};this[_0xe388('0x1b')]={};this[_0xe388('0x1c')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x335cab,_0x3a386d,_0x2569d4){var _0x10ba2=_[_0xe388('0x1d')](_0x335cab,function(_0x158b76,_0x2fe7d7){return _0x158b76[_0x2569d4];});for(var _0x5bb566 in _0x3a386d){if(_0x3a386d['hasOwnProperty'](_0x5bb566)){if(!_0x10ba2[_0x5bb566]){delete _0x3a386d[_0x5bb566];}}}}function freeIsNotKeySip(_0x47d84f,_0x1d72db){var _0x1842a3=_[_0xe388('0x1d')](_0x47d84f,function(_0x33563f,_0x3c7cc6){return util[_0xe388('0x1e')]('SIP/%s',_0x33563f[_0xe388('0x1f')]);});for(var _0x268286 in _0x1d72db){if(_0x1d72db[_0xe388('0x20')](_0x268286)){if(!_0x1842a3[_0x268286]){delete _0x1d72db[_0x268286];}}}}function freeIsNotKeyAgent(_0x420451,_0xf5fb8c){var _0x2bb2d8=_[_0xe388('0x1d')](_0x420451,function(_0x20a9a6,_0x480040){var _0x329501=_[_0xe388('0x21')](_0x20a9a6['interface'])?util[_0xe388('0x1e')]('SIP/%s',_0x20a9a6[_0xe388('0x1f')]):_0x20a9a6['interface'];return _0x329501;});for(var _0x50af8e in _0xf5fb8c){if(_0xf5fb8c[_0xe388('0x20')](_0x50af8e)){if(!_0x2bb2d8[_0x50af8e]){delete _0xf5fb8c[_0x50af8e];}}}}function clearVoiceCallReports(_0x409a79){_0x409a79[_0xe388('0x22')]=0x0;_0x409a79[_0xe388('0x23')]=0x0;_0x409a79['sumHoldTime']=0x0;_0x409a79[_0xe388('0x24')]=0x0;_0x409a79[_0xe388('0x25')]=0x0;}function clearCampaigns(_0x28cb89){if(!_[_0xe388('0x26')](_0x28cb89)){for(var _0x334132 in _0x28cb89){if(_0x28cb89[_0xe388('0x20')](_0x334132)){_0x28cb89[_0x334132][_0xe388('0x27')]=0x0;_0x28cb89[_0x334132][_0xe388('0x28')]=0x0;}}}}function clearVoiceQueues(_0x2bf4fe){if(!_[_0xe388('0x26')](_0x2bf4fe)){for(var _0x3e0dbb in _0x2bf4fe){if(_0x2bf4fe[_0xe388('0x20')](_0x3e0dbb)){_0x2bf4fe[_0x3e0dbb][_0xe388('0x22')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x23')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x29')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x2a')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x2b')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x24')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x25')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x2c')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x2d')]=0x0;_0x2bf4fe[_0x3e0dbb]['outboundBusyCallsDay']=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x2e')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x2f')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x30')]=0x0;_0x2bf4fe[_0x3e0dbb]['outboundDropCallsDayTimeout']=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x31')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x32')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x33')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x34')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x35')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x2c')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x36')]=0x0;_0x2bf4fe[_0x3e0dbb][_0xe388('0x37')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x28ac0f,_0x6337a2){for(var _0x20df00 in _0x6337a2){if(_0x28ac0f[_0xe388('0x20')](_0x20df00)){_0x28ac0f[_0x20df00]=_0x6337a2[_0x20df00];}}};Realtime[_0xe388('0x38')]['initAgents']=function(){var _0x1dee06=this;return function(_0x33b6a8){if(_0x33b6a8){freeIsNotKeyAgent(_0x33b6a8,_0x1dee06['agents']);for(var _0x5e2024=0x0,_0x20292d={},_0x9c53ab={};_0x5e2024<_0x33b6a8[_0xe388('0x39')];_0x5e2024+=0x1){_0x20292d=_0x33b6a8[_0x5e2024];var _0xa918e6=_[_0xe388('0x21')](_0x20292d['interface'])?util[_0xe388('0x1e')](_0xe388('0x3a'),_0x20292d[_0xe388('0x1f')]):_0x20292d['interface'];if(_[_0xe388('0x3b')](_0x1dee06['agents'][_0xa918e6])){_0x1dee06[_0xe388('0x3c')][_0xa918e6]=new Agent(_0x20292d);}else{_0x1dee06[_0xe388('0x3d')](_0x1dee06['agents'][_0xa918e6],_0x20292d);}}}return _0x1dee06[_0xe388('0x3c')];};};Realtime[_0xe388('0x38')][_0xe388('0x3e')]=function(){var _0x414255=this;return function(_0x3382dc){if(_0x3382dc){freeIsNotKeySip(_0x3382dc,_0x414255[_0xe388('0xb')]);for(var _0x36865f=0x0,_0x166ae8={},_0x1c681a={};_0x36865f<_0x3382dc[_0xe388('0x39')];_0x36865f+=0x1){_0x166ae8=_0x3382dc[_0x36865f];if(_['isUndefined'](_0x414255[_0xe388('0xb')][util[_0xe388('0x1e')](_0xe388('0x3a'),_0x166ae8['name'])])){_0x414255[_0xe388('0xb')][util[_0xe388('0x1e')](_0xe388('0x3a'),_0x166ae8[_0xe388('0x1f')])]=new Telephone(_0x166ae8);}else{_0x414255[_0xe388('0x3d')](_0x414255[_0xe388('0xb')][util[_0xe388('0x1e')](_0xe388('0x3a'),_0x166ae8['name'])],_0x166ae8);}}}return _0x414255['telephones'];};};Realtime['prototype'][_0xe388('0x3f')]=function(){var _0x2215e2=this;return function(_0x713008){if(_0x713008){freeIsNotKeySip(_0x713008,_0x2215e2[_0xe388('0xc')]);for(var _0x19dcdf=0x0,_0x44498b={},_0x4af958={};_0x19dcdf<_0x713008[_0xe388('0x39')];_0x19dcdf+=0x1){_0x44498b=_0x713008[_0x19dcdf];if(_[_0xe388('0x3b')](_0x2215e2[_0xe388('0xc')][util[_0xe388('0x1e')](_0xe388('0x3a'),_0x44498b[_0xe388('0x1f')])])){_0x2215e2[_0xe388('0xc')][util['format']('SIP/%s',_0x44498b[_0xe388('0x1f')])]=new Trunk(_0x44498b);}else{_0x2215e2[_0xe388('0x3d')](_0x2215e2['trunks'][util[_0xe388('0x1e')]('SIP/%s',_0x44498b[_0xe388('0x1f')])],_0x44498b);}}}return _0x2215e2[_0xe388('0xc')];};};Realtime[_0xe388('0x38')][_0xe388('0x40')]=function(){var _0x17064d=this;return function(_0x15fa06){if(_0x15fa06){freeIsNotKey(_0x15fa06,_0x17064d['voiceQueues'],_0xe388('0x1f'));for(var _0x18e2a3=0x0,_0x177a7c={},_0xf8c4dc={};_0x18e2a3<_0x15fa06['length'];_0x18e2a3+=0x1){_0x177a7c=_0x15fa06[_0x18e2a3];if(_[_0xe388('0x3b')](_0x17064d[_0xe388('0xd')][_0x177a7c[_0xe388('0x1f')]])){_0x17064d['voiceQueues'][_0x177a7c[_0xe388('0x1f')]]=new VoiceQueue(_0x177a7c);}else{_0x17064d['mergeFromDatabase'](_0x17064d[_0xe388('0xd')][_0x177a7c['name']],_0x177a7c);}}}return _0x17064d[_0xe388('0xd')];};};Realtime['prototype'][_0xe388('0x41')]=function(){var _0x378b73=this;return function(_0x193a85){if(_0x193a85){freeIsNotKey(_0x193a85,_0x378b73[_0xe388('0xe')],'id');for(var _0x5cca55=0x0,_0x4a2d9b={},_0x305f29={};_0x5cca55<_0x193a85[_0xe388('0x39')];_0x5cca55+=0x1){_0x4a2d9b=_0x193a85[_0x5cca55];if(_[_0xe388('0x3b')](_0x378b73[_0xe388('0xe')][_0x4a2d9b['id']])){_0x378b73['triggers'][_0x4a2d9b['id']]=new Trigger(_0x4a2d9b);}else{_0x378b73['mergeFromDatabase'](_0x378b73[_0xe388('0xe')][_0x4a2d9b['id']],_0x4a2d9b);}}}return _0x378b73['triggers'];};};Realtime[_0xe388('0x38')]['initTemplates']=function(){var _0x53a51c=this;return function(_0x254a7c){if(_0x254a7c){freeIsNotKey(_0x254a7c,_0x53a51c[_0xe388('0xf')],'id');for(var _0x4a373a=0x0,_0x163b9b={},_0x1a5139={};_0x4a373a<_0x254a7c['length'];_0x4a373a+=0x1){_0x163b9b=_0x254a7c[_0x4a373a];if(_[_0xe388('0x3b')](_0x53a51c[_0xe388('0xf')][_0x163b9b['id']])){_0x53a51c[_0xe388('0xf')][_0x163b9b['id']]=new Template(_0x163b9b);}else{_0x53a51c[_0xe388('0x3d')](_0x53a51c['templates'][_0x163b9b['id']],_0x163b9b);}}}return _0x53a51c[_0xe388('0xf')];};};Realtime[_0xe388('0x38')][_0xe388('0x42')]=function(){var _0x25810d=this;return function(_0x2c99a8){if(_0x2c99a8){freeIsNotKey(_0x2c99a8,_0x25810d[_0xe388('0x16')],'id');for(var _0x18ffa5=0x0,_0x44ace5={},_0x56d6ed={};_0x18ffa5<_0x2c99a8['length'];_0x18ffa5+=0x1){_0x44ace5=_0x2c99a8[_0x18ffa5];if(_[_0xe388('0x3b')](_0x25810d[_0xe388('0x16')][_0x44ace5['id']])){_0x25810d['zendeskAccounts'][_0x44ace5['id']]=new ZendeskAccount(_0x44ace5);}else{_0x25810d[_0xe388('0x3d')](_0x25810d[_0xe388('0x16')][_0x44ace5['id']],_0x44ace5);}}}return _0x25810d['zendeskAccounts'];};};Realtime[_0xe388('0x38')][_0xe388('0x43')]=function(){var _0x590d8c=this;return function(_0x530d5b){if(_0x530d5b){freeIsNotKey(_0x530d5b,_0x590d8c[_0xe388('0x17')],'id');for(var _0x26bd84=0x0,_0x446898={},_0x5066c9={};_0x26bd84<_0x530d5b[_0xe388('0x39')];_0x26bd84+=0x1){_0x446898=_0x530d5b[_0x26bd84];if(_['isUndefined'](_0x590d8c[_0xe388('0x17')][_0x446898['id']])){_0x590d8c['salesforceAccounts'][_0x446898['id']]=new SalesforceAccount(_0x446898);}else{_0x590d8c['mergeFromDatabase'](_0x590d8c['salesforceAccounts'][_0x446898['id']],_0x446898);}}}return _0x590d8c[_0xe388('0x17')];};};Realtime[_0xe388('0x38')][_0xe388('0x44')]=function(){var _0x53e38b=this;return function(_0x119654){if(_0x119654){freeIsNotKey(_0x119654,_0x53e38b[_0xe388('0x18')],'id');for(var _0x23e9c0=0x0,_0x38be40={},_0x14ade9={};_0x23e9c0<_0x119654[_0xe388('0x39')];_0x23e9c0+=0x1){_0x38be40=_0x119654[_0x23e9c0];if(_['isUndefined'](_0x53e38b['freshdeskAccounts'][_0x38be40['id']])){_0x53e38b[_0xe388('0x18')][_0x38be40['id']]=new FreshdeskAccount(_0x38be40);}else{_0x53e38b[_0xe388('0x3d')](_0x53e38b['freshdeskAccounts'][_0x38be40['id']],_0x38be40);}}}return _0x53e38b[_0xe388('0x18')];};};Realtime[_0xe388('0x38')]['initZohoAccounts']=function(){var _0x14ef25=this;return function(_0x394540){if(_0x394540){freeIsNotKey(_0x394540,_0x14ef25['zohoAccounts'],'id');for(var _0x5057c8=0x0,_0x1896b2={},_0x2ca107={};_0x5057c8<_0x394540[_0xe388('0x39')];_0x5057c8+=0x1){_0x1896b2=_0x394540[_0x5057c8];if(_[_0xe388('0x3b')](_0x14ef25['zohoAccounts'][_0x1896b2['id']])){_0x14ef25[_0xe388('0x19')][_0x1896b2['id']]=new ZohoAccount(_0x1896b2);}else{_0x14ef25[_0xe388('0x3d')](_0x14ef25[_0xe388('0x19')][_0x1896b2['id']],_0x1896b2);}}}return _0x14ef25[_0xe388('0x19')];};};Realtime[_0xe388('0x38')]['initDeskAccounts']=function(){var _0x5956cb=this;return function(_0x3a8936){if(_0x3a8936){freeIsNotKey(_0x3a8936,_0x5956cb[_0xe388('0x1a')],'id');for(var _0x2a55f5=0x0,_0x5726fb={},_0x23ae2d={};_0x2a55f5<_0x3a8936[_0xe388('0x39')];_0x2a55f5+=0x1){_0x5726fb=_0x3a8936[_0x2a55f5];if(_['isUndefined'](_0x5956cb[_0xe388('0x1a')][_0x5726fb['id']])){_0x5956cb[_0xe388('0x1a')][_0x5726fb['id']]=new DeskAccount(_0x5726fb);}else{_0x5956cb[_0xe388('0x3d')](_0x5956cb[_0xe388('0x1a')][_0x5726fb['id']],_0x5726fb);}}}return _0x5956cb[_0xe388('0x1a')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x504172=this;return function(_0x38df68){if(_0x38df68){freeIsNotKey(_0x38df68,_0x504172[_0xe388('0x45')],'id');for(var _0x426af3=0x0,_0x11452a={},_0x5e7f1b={};_0x426af3<_0x38df68[_0xe388('0x39')];_0x426af3+=0x1){_0x11452a=_0x38df68[_0x426af3];if(_['isUndefined'](_0x504172['sugarcrmAccounts'][_0x11452a['id']])){_0x504172[_0xe388('0x45')][_0x11452a['id']]=new SugarcrmAccount(_0x11452a);}else{_0x504172[_0xe388('0x3d')](_0x504172[_0xe388('0x45')][_0x11452a['id']],_0x11452a);}}}return _0x504172[_0xe388('0x45')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x53df47=this;return function(_0x307f09){if(_0x307f09){freeIsNotKey(_0x307f09,_0x53df47[_0xe388('0x1b')],'id');for(var _0x474bf5=0x0,_0x59cf03={},_0x55ae2d={};_0x474bf5<_0x307f09[_0xe388('0x39')];_0x474bf5+=0x1){_0x59cf03=_0x307f09[_0x474bf5];if(_['isUndefined'](_0x53df47[_0xe388('0x1b')][_0x59cf03['id']])){_0x53df47[_0xe388('0x1b')][_0x59cf03['id']]=new VtigerAccount(_0x59cf03);}else{_0x53df47['mergeFromDatabase'](_0x53df47[_0xe388('0x1b')][_0x59cf03['id']],_0x59cf03);}}}return _0x53df47[_0xe388('0x1b')];};};Realtime[_0xe388('0x38')]['initServicenowAccounts']=function(){var _0x4e452e=this;return function(_0x399175){if(_0x399175){freeIsNotKey(_0x399175,_0x4e452e[_0xe388('0x1c')],'id');for(var _0x433f3b=0x0,_0x3b8939={},_0x531ab7={};_0x433f3b<_0x399175[_0xe388('0x39')];_0x433f3b+=0x1){_0x3b8939=_0x399175[_0x433f3b];if(_['isUndefined'](_0x4e452e[_0xe388('0x1c')][_0x3b8939['id']])){_0x4e452e[_0xe388('0x1c')][_0x3b8939['id']]=new ServicenowAccount(_0x3b8939);}else{_0x4e452e[_0xe388('0x3d')](_0x4e452e[_0xe388('0x1c')][_0x3b8939['id']],_0x3b8939);}}}return _0x4e452e[_0xe388('0x1c')];};};Realtime[_0xe388('0x38')]['initDynamics365Accounts']=function(){var _0xb9569b=this;return function(_0x52c8f1){if(_0x52c8f1){freeIsNotKey(_0x52c8f1,_0xb9569b[_0xe388('0x46')],'id');for(var _0x792287=0x0,_0x49d4cb={},_0x5debf4={};_0x792287<_0x52c8f1[_0xe388('0x39')];_0x792287+=0x1){_0x49d4cb=_0x52c8f1[_0x792287];if(_['isUndefined'](_0xb9569b[_0xe388('0x46')][_0x49d4cb['id']])){_0xb9569b['dynamics365Accounts'][_0x49d4cb['id']]=new Dynamics365Account(_0x49d4cb);}else{_0xb9569b[_0xe388('0x3d')](_0xb9569b[_0xe388('0x46')][_0x49d4cb['id']],_0x49d4cb);}}}return _0xb9569b[_0xe388('0x46')];};};Realtime[_0xe388('0x38')][_0xe388('0x47')]=function(){var _0x57da37=this;return function(_0x2cbdd5){if(_0x2cbdd5){freeIsNotKey(_0x2cbdd5,_0x57da37['freshsalesAccounts'],'id');for(var _0x23c7bc=0x0,_0x57acca={},_0x2306e2={};_0x23c7bc<_0x2cbdd5[_0xe388('0x39')];_0x23c7bc+=0x1){_0x57acca=_0x2cbdd5[_0x23c7bc];if(_[_0xe388('0x3b')](_0x57da37['freshsalesAccounts'][_0x57acca['id']])){_0x57da37['freshsalesAccounts'][_0x57acca['id']]=new FreshsalesAccount(_0x57acca);}else{_0x57da37[_0xe388('0x3d')](_0x57da37[_0xe388('0x48')][_0x57acca['id']],_0x57acca);}}}return _0x57da37[_0xe388('0x48')];};};Realtime[_0xe388('0x38')]['initVoiceQueueHopperHistory']=function(){var _0x397b75=this;return function(_0x5ca91d){for(var _0x351125=0x0;_0x351125<_0x5ca91d[_0xe388('0x39')];_0x351125+=0x1){_[_0xe388('0x49')](_0x397b75[_0xe388('0xd')][_0x5ca91d[_0x351125][_0xe388('0x1f')]],_0x5ca91d[_0x351125]);}return _0x397b75[_0xe388('0xd')];};};Realtime[_0xe388('0x38')]['initVoiceQueueReports']=function(){var _0x4199f9=this;return function(_0x4d8541){clearVoiceQueues(_0x4199f9[_0xe388('0xd')]);if(_0x4d8541){_0x4d8541=_[_0xe388('0x4a')](_0x4d8541,_0xe388('0x4b'));for(var _0x353a12 in _0x4d8541){if(_0x4d8541[_0xe388('0x20')](_0x353a12)){var _0x2b1732={};for(var _0x2ee3eb=0x0;_0x2ee3eb<_0x4d8541[_0x353a12][_0xe388('0x39')];_0x2ee3eb+=0x1){var _0x47ea34=_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x4c')];if(_0x4199f9['voiceQueues'][_0x47ea34]){if(_0x4d8541[_0x353a12][_0x2ee3eb]['queuecallerexit']){_0x4199f9['voiceQueues'][_0x47ea34][_0xe388('0x29')]+=0x1;}if(_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x4d')]){_0x4199f9[_0xe388('0xd')][_0x47ea34][_0xe388('0x2a')]+=0x1;}_0x4199f9[_0xe388('0xd')][_0x47ea34][_0xe388('0x2b')]+=moment(_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x4e')])[_0xe388('0x4f')](moment(_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x50')]),_0xe388('0x51'))||0x0;if(_0x2ee3eb===_0x4d8541[_0x353a12][_0xe388('0x39')]-0x1){_0x4199f9[_0xe388('0xd')][_0x47ea34]['sumDuration']+=moment(_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x52')]||_0x4d8541[_0x353a12][_0x2ee3eb]['queuecallerabandonAt']||_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x53')])['diff'](moment(_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x50')]),_0xe388('0x51'))||0x0;_0x4199f9[_0xe388('0xd')][_0x47ea34][_0xe388('0x22')]+=0x1;if(_0x4d8541[_0x353a12][_0x2ee3eb]['queuecallercomplete']){_0x4199f9[_0xe388('0xd')][_0x47ea34][_0xe388('0x23')]+=0x1;_0x4199f9['voiceQueues'][_0x47ea34][_0xe388('0x25')]+=moment(_0x4d8541[_0x353a12][_0x2ee3eb][_0xe388('0x52')])[_0xe388('0x4f')](moment(_0x4d8541[_0x353a12][_0x2ee3eb]['queuecallerleaveAt']),_0xe388('0x51'))||0x0;}}else{_0x4199f9[_0xe388('0xd')][_0x47ea34][_0xe388('0x24')]+=_0x4199f9[_0xe388('0xd')][_0x47ea34][_0xe388('0x2b')]||0x0;}}}}}}return _0x4199f9[_0xe388('0xd')];};};Realtime[_0xe388('0x38')][_0xe388('0x54')]=function(){var _0xabee45=this;return function(_0x2fadd8){clearVoiceCallReports(_0xabee45[_0xe388('0x10')]);if(_0x2fadd8){for(var _0x4af327=0x0;_0x4af327<_0x2fadd8['length'];_0x4af327+=0x1){_0xabee45[_0xe388('0x10')][_0xe388('0x22')]+=0x1;_0xabee45['outbound'][_0xe388('0x24')]+=_0x2fadd8[_0x4af327]['duration'];if(_0x2fadd8[_0x4af327][_0xe388('0x55')]===_0xe388('0x56')){_0xabee45[_0xe388('0x10')][_0xe388('0x23')]+=0x1;_0xabee45[_0xe388('0x10')][_0xe388('0x2b')]+=_0x2fadd8[_0x4af327][_0xe388('0x57')]-_0x2fadd8[_0x4af327]['billableseconds']||0x0;_0xabee45[_0xe388('0x10')][_0xe388('0x25')]+=_0x2fadd8[_0x4af327][_0xe388('0x58')];}}}return _0xabee45[_0xe388('0x10')];};};Realtime['prototype'][_0xe388('0x59')]=function(){var _0x9d7030=this;return function(_0x55191f){if(_0x55191f){freeIsNotKey(_0x55191f,_0x9d7030[_0xe388('0x5a')],'name');for(var _0x34dccb=0x0,_0xe6dbbc={};_0x34dccb<_0x55191f[_0xe388('0x39')];_0x34dccb+=0x1){_0xe6dbbc=_0x55191f[_0x34dccb];if(_['isUndefined'](_0x9d7030['campaigns'][_0xe6dbbc['name']])){_0x9d7030['campaigns'][_0xe6dbbc[_0xe388('0x1f')]]=new Campaign(_0xe6dbbc);}else{_0x9d7030[_0xe388('0x3d')](_0x9d7030[_0xe388('0x5a')][_0xe6dbbc[_0xe388('0x1f')]],_0xe6dbbc);_0x9d7030[_0xe388('0x5a')][_0xe6dbbc['name']][_0xe388('0x5b')]=_0xe6dbbc['SquareProject']?_0xe6dbbc['SquareProject'][_0xe388('0x1f')]:undefined;}}}return _0x9d7030[_0xe388('0x5a')];};};Realtime[_0xe388('0x38')][_0xe388('0x5c')]=function(){var _0x15b51d=this;return function(_0x23782a){if(_0x23782a){freeIsNotKey(_0x23782a,_0x15b51d['voiceExtensions'],'id');for(var _0xe2393a=0x0,_0x39dbc6={};_0xe2393a<_0x23782a[_0xe388('0x39')];_0xe2393a+=0x1){_0x39dbc6=_0x23782a[_0xe2393a];if(_[_0xe388('0x3b')](_0x15b51d[_0xe388('0x11')][_0x39dbc6['id']])){_0x15b51d['voiceExtensions'][_0x39dbc6['id']]=new VoiceExtension(_0x39dbc6);}else{_0x15b51d['mergeFromDatabase'](_0x15b51d[_0xe388('0x11')][_0x39dbc6['id']],_0x39dbc6);}}}return _0x15b51d[_0xe388('0x11')];};};Realtime[_0xe388('0x38')][_0xe388('0x5d')]=function(){var _0x346495=this;return function(_0x49885a){clearCampaigns(_0x346495[_0xe388('0x5a')]);for(var _0x349047=0x0;_0x349047<_0x49885a[_0xe388('0x39')];_0x349047+=0x1){_[_0xe388('0x49')](_0x346495[_0xe388('0x5a')][_0x49885a[_0x349047][_0xe388('0x1f')]],_0x49885a[_0x349047]);}return _0x346495[_0xe388('0x5a')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x13109e=this;return function(_0x1e0c93){if(_0x1e0c93){freeIsNotKey(_0x1e0c93,_0x13109e[_0xe388('0x5e')],'id');for(var _0x19d1fe=0x0,_0x42ea98={},_0xaf712b={};_0x19d1fe<_0x1e0c93[_0xe388('0x39')];_0x19d1fe+=0x1){_0x42ea98=_0x1e0c93[_0x19d1fe];if(_[_0xe388('0x3b')](_0x13109e['faxAccounts'][_0x42ea98['id']])){_0x13109e[_0xe388('0x5e')][_0x42ea98['id']]=new FaxAccount(_0x42ea98);}else{_0x13109e[_0xe388('0x3d')](_0x13109e[_0xe388('0x5e')][_0x42ea98['id']],_0x42ea98);}}}return _0x13109e[_0xe388('0x5e')];};};module[_0xe388('0x5f')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 57b8d6c..d99fa37 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 _0xc197=['format','SIP/%s','connectedlinenum','accountcode','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','length','keys','getCallType','channel','split','outbound','internal','destination','exten','dialer','lastapplication','lastdata','context','from-voip-provider','callerid','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfers','transfereelinkedid','type','UserId','membername','monitorFilename','monitors','filename','createdAt','calleridname','connectedlinename','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc197,0x96));var _0x7c19=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xc197[_0x133277];return _0x5b4a22;};'use strict';var _=require(_0x7c19('0x0'));var moment=require(_0x7c19('0x1'));var util=require(_0x7c19('0x2'));var config=require(_0x7c19('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x7c19('0x4'));var RpcVoiceCallReport=require(_0x7c19('0x5'));var RpcVoiceDialReport=require(_0x7c19('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x7c19('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x7c19('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7c19('0x9'));var UserReport=require(_0x7c19('0xa'));function Report(_0x1dca76){this[_0x7c19('0xb')]=_0x1dca76;this[_0x7c19('0xc')]=_0x1dca76[_0x7c19('0xc')];this[_0x7c19('0xd')]=_0x1dca76[_0x7c19('0xd')];}Report[_0x7c19('0xe')][_0x7c19('0xf')]=function(_0x13474b){var _0x2df1e3=new VoiceQueueReport(this[_0x7c19('0xb')]);var _0x919407=new VoiceAgentReport(this['realtime']);var _0x2a0f5d=new VoiceDialReport(this[_0x7c19('0xb')]);var _0x42de9f=new VoiceCallReport(this[_0x7c19('0xb')]);var _0x112591=new UserReport(this[_0x7c19('0xb')]);if(config[_0x7c19('0x10')]&&config['xdr']['disabled']){ami['on']('custom:voiceQueueReport',this[_0x7c19('0x11')][_0x7c19('0x12')](this));ami['on']('custom:voiceCallReport',this[_0x7c19('0x13')][_0x7c19('0x12')](this));ami['on'](_0x7c19('0x14'),this[_0x7c19('0x15')][_0x7c19('0x12')](this));ami['on'](_0x7c19('0x16'),this[_0x7c19('0x17')][_0x7c19('0x12')](this));ami['on'](_0x7c19('0x18'),this[_0x7c19('0x19')][_0x7c19('0x12')](this));ami['on'](_0x7c19('0x1a'),this[_0x7c19('0x1b')][_0x7c19('0x12')](this));}};Report[_0x7c19('0xe')][_0x7c19('0x1c')]=function(_0x6c5bc2){var _0xc6e47c;_0xc6e47c=_[_0x7c19('0x1d')](this[_0x7c19('0xc')],function(_0x15f5b4){return _0x15f5b4['accountcode']==_0x6c5bc2||_0x15f5b4['name']==_0x6c5bc2;});if(_[_0x7c19('0x1e')](_0xc6e47c)){var _0x37dcbf=_[_0x7c19('0x1d')](this[_0x7c19('0xd')],function(_0x4a3311){return _0x4a3311['accountcode']==_0x6c5bc2||_0x4a3311[_0x7c19('0x1f')]==_0x6c5bc2;});if(_0x37dcbf){_0xc6e47c=_[_0x7c19('0x1d')](this[_0x7c19('0xc')],function(_0x4532aa){return _0x4532aa['interface']==util[_0x7c19('0x20')](_0x7c19('0x21'),_0x37dcbf[_0x7c19('0x1f')]);});}}return _0xc6e47c;};Report[_0x7c19('0xe')]['voiceQueueReport']=function(_0x466b33){for(var _0x317c21=0x0;_0x317c21<_0x466b33['length'];_0x317c21+=0x1){var _0x5cc31a=this['findAgent'](_0x466b33[_0x317c21][_0x7c19('0x22')]);if(_0x5cc31a){_0x466b33[_0x317c21][_0x7c19('0x23')]=_0x5cc31a[_0x7c19('0x23')];_0x466b33[_0x317c21][_0x7c19('0x24')]=!![];_0x466b33[_0x317c21][_0x7c19('0x25')]=_0x5cc31a['name'];_0x466b33[_0x317c21]['interface']=_[_0x7c19('0x1e')](_0x5cc31a['interface'])?util[_0x7c19('0x20')](_0x7c19('0x21'),_0x5cc31a['name']):_0x5cc31a[_0x7c19('0x26')];if(_0x466b33[_0x317c21][_0x7c19('0x27')]){_0x466b33[_0x317c21][_0x7c19('0x28')]=moment()[_0x7c19('0x20')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x466b33[_0x317c21][_0x7c19('0x29')]){_0x466b33[_0x317c21][_0x7c19('0x2a')]=moment()[_0x7c19('0x20')](_0x7c19('0x2b'));}RpcMemberReport[_0x7c19('0x11')](_0x466b33[_0x317c21]);}RpcVoiceQueueReport[_0x7c19('0x2c')](_0x466b33[_0x317c21]);}};function extractCalleridNumber(_0x11cf19){var _0x23eb70=_0x11cf19[_0x7c19('0x2d')](/<(.*?)>/);return _0x23eb70?_0x23eb70[0x1]:_0x11cf19;}Report[_0x7c19('0xe')][_0x7c19('0x2e')]=function(_0xcb092a){for(var _0x373007=0x0;_0x373007','calleridname','linkedid','transfers','UserId','split','membername','create','monitor','monitors','monitorFilename','createdAt','connectedlinename','isArray','forEach','startsWith','indexOf','mobile','phone','substring','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','findAgent','find','agents','name','isNil','telephones','interface','format','SIP/%s','connectedlinenum','accountcode','assigned','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','keys','length','getCallType','channel','getAgentByInternal','calleridnum','outbound','internal','destination'];(function(_0xb57c38,_0x3f7e7b){var _0x54affa=function(_0x28bcd4){while(--_0x28bcd4){_0xb57c38['push'](_0xb57c38['shift']());}};_0x54affa(++_0x3f7e7b);}(_0xdfde,0x1f0));var _0xedfd=function(_0x4a7e98,_0x250137){_0x4a7e98=_0x4a7e98-0x0;var _0x27d10d=_0xdfde[_0x4a7e98];return _0x27d10d;};'use strict';var _=require(_0xedfd('0x0'));var moment=require(_0xedfd('0x1'));var util=require('util');var config=require(_0xedfd('0x2'));var ami=require(_0xedfd('0x3'));var RpcVoiceAgentReport=require(_0xedfd('0x4'));var RpcVoiceCallReport=require(_0xedfd('0x5'));var RpcVoiceDialReport=require(_0xedfd('0x6'));var RpcMemberReport=require(_0xedfd('0x7'));var RpcVoiceQueueReport=require(_0xedfd('0x8'));var RpcVoiceRecording=require(_0xedfd('0x9'));var RpcVoiceTransferReport=require(_0xedfd('0xa'));var VoiceQueueReport=require(_0xedfd('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xedfd('0xc'));var VoiceDialReport=require(_0xedfd('0xd'));var UserReport=require(_0xedfd('0xe'));function Report(_0x3de45a){this['realtime']=_0x3de45a;this['agents']=_0x3de45a['agents'];this['telephones']=_0x3de45a['telephones'];}Report['prototype']['sync']=function(_0x5230d1){var _0x42a616=new VoiceQueueReport(this['realtime']);var _0xaa1d77=new VoiceAgentReport(this[_0xedfd('0xf')]);var _0x5577f9=new VoiceDialReport(this[_0xedfd('0xf')]);var _0x30773e=new VoiceCallReport(this['realtime']);var _0x52b24a=new UserReport(this['realtime']);if(config[_0xedfd('0x10')]&&config[_0xedfd('0x10')][_0xedfd('0x11')]){ami['on'](_0xedfd('0x12'),this[_0xedfd('0x13')][_0xedfd('0x14')](this));ami['on'](_0xedfd('0x15'),this[_0xedfd('0x16')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xedfd('0x17')][_0xedfd('0x14')](this));ami['on'](_0xedfd('0x18'),this[_0xedfd('0x19')][_0xedfd('0x14')](this));ami['on'](_0xedfd('0x1a'),this[_0xedfd('0x1b')][_0xedfd('0x14')](this));ami['on']('attendedtransfer',this[_0xedfd('0x1c')][_0xedfd('0x14')](this));}};Report[_0xedfd('0x1d')][_0xedfd('0x1e')]=function(_0x58e601){var _0x338b6e;_0x338b6e=_[_0xedfd('0x1f')](this[_0xedfd('0x20')],function(_0x5477b1){return _0x5477b1['accountcode']==_0x58e601||_0x5477b1[_0xedfd('0x21')]==_0x58e601;});if(_[_0xedfd('0x22')](_0x338b6e)){var _0x4b5544=_[_0xedfd('0x1f')](this[_0xedfd('0x23')],function(_0xc7777d){return _0xc7777d['accountcode']==_0x58e601||_0xc7777d[_0xedfd('0x21')]==_0x58e601;});if(_0x4b5544){_0x338b6e=_['find'](this['agents'],function(_0x140072){return _0x140072[_0xedfd('0x24')]==util[_0xedfd('0x25')](_0xedfd('0x26'),_0x4b5544['name']);});}}return _0x338b6e;};Report['prototype'][_0xedfd('0x13')]=function(_0x20f0d5){for(var _0x4ea3cc=0x0;_0x4ea3cc<_0x20f0d5['length'];_0x4ea3cc+=0x1){var _0x5cef67=this['findAgent'](_0x20f0d5[_0x4ea3cc][_0xedfd('0x27')]);if(_0x5cef67){_0x20f0d5[_0x4ea3cc]['accountcode']=_0x5cef67[_0xedfd('0x28')];_0x20f0d5[_0x4ea3cc][_0xedfd('0x29')]=!![];_0x20f0d5[_0x4ea3cc]['lastAssignedTo']=_0x5cef67[_0xedfd('0x21')];_0x20f0d5[_0x4ea3cc][_0xedfd('0x24')]=_[_0xedfd('0x22')](_0x5cef67[_0xedfd('0x24')])?util[_0xedfd('0x25')](_0xedfd('0x26'),_0x5cef67[_0xedfd('0x21')]):_0x5cef67['interface'];if(_0x20f0d5[_0x4ea3cc][_0xedfd('0x2a')]){_0x20f0d5[_0x4ea3cc]['queuecallercompleteAt']=moment()['format'](_0xedfd('0x2b'));}if(_0x20f0d5[_0x4ea3cc][_0xedfd('0x2c')]){_0x20f0d5[_0x4ea3cc][_0xedfd('0x2d')]=moment()[_0xedfd('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xedfd('0x13')](_0x20f0d5[_0x4ea3cc]);}RpcVoiceQueueReport['create'](_0x20f0d5[_0x4ea3cc]);}};function extractCalleridNumber(_0x4a1153){var _0xdd74ed=_0x4a1153[_0xedfd('0x2e')](/<(.*?)>/);return _0xdd74ed?_0xdd74ed[0x1]:_0x4a1153;}Report['prototype']['getAgentByInternal']=function(_0x24a1eb){for(var _0x248c95=0x0;_0x248c950x0?_0x38c4ae:0x0;this[_0xad59('0x13')][_0x54414f[_0xad59('0x66')]][_0xad59('0x30')]=this[_0xad59('0x13')][_0x54414f['queue']][_0xad59('0x30')]>_[_0xad59('0x6c')](_0x54414f[_0xad59('0x6d')])?_[_0xad59('0x6c')](_0x54414f['loggedin']):this[_0xad59('0x13')][_0x54414f[_0xad59('0x66')]][_0xad59('0x30')];this[_0xad59('0x4e')](this[_0xad59('0x13')][_0x54414f['queue']],_0xad59('0x64'));}logger[_0xad59('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xad59('0x3d')](this[_0xad59('0x13')][_0x54414f[_0xad59('0x66')]],{'showHidden':![],'depth':null}));ami[_0xad59('0x42')](_0xad59('0x6f'),this['voiceQueues'][_0x54414f[_0xad59('0x66')]]);}}}catch(_0xad4ae5){logger[_0xad59('0x3b')](_0xad59('0x70'),util[_0xad59('0x3d')](_0xad4ae5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xad59('0x33')]['syncQueueSummaryComplete']=function(_0x378b73){logger[_0xad59('0x44')](_0xad59('0x71'),util[_0xad59('0x3d')](_0x378b73,{'showHidden':![],'depth':null}));this[_0xad59('0x14')]=!![];};VoiceQueueReport[_0xad59('0x33')][_0xad59('0x1c')]=function(_0x41c80d){try{if(this[_0xad59('0x60')](_0x41c80d)){logger[_0xad59('0x44')]('[%s][voiceQueueReport][queuecallerjoin]',_0x41c80d[_0xad59('0x49')],util[_0xad59('0x3d')](_0x41c80d,{'showHidden':![],'depth':null}));if(_[_0xad59('0x61')](this[_0xad59('0xf')][_0x41c80d['uniqueid']]))this[_0xad59('0xf')][_0x41c80d[_0xad59('0x49')]]=[];if(_[_0xad59('0x61')](this['channels'][_0x41c80d[_0xad59('0x49')]]))this['channels'][_0x41c80d['uniqueid']]={};var _0x39d109=new QueueReport();_0x39d109[_0xad59('0x4c')]=_0x41c80d[_0xad59('0x66')];_0x39d109[_0xad59('0x4f')]=this['voiceQueues'][_0x39d109[_0xad59('0x4c')]]&&this[_0xad59('0x13')][_0x39d109[_0xad59('0x4c')]][_0xad59('0x4f')]?this[_0xad59('0x13')][_0x39d109[_0xad59('0x4c')]]['type']||_0xad59('0x50'):_0xad59('0x50');_0x39d109[_0xad59('0x66')]=_0x41c80d[_0xad59('0x66')];_0x39d109['queuecallerjoinAt']=moment()[_0xad59('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x39d109[_0xad59('0x72')]=_0x41c80d[_0xad59('0x72')];_0x39d109[_0xad59('0x73')]=_0x41c80d[_0xad59('0x73')];_0x39d109[_0xad59('0x49')]=_0x41c80d[_0xad59('0x49')];_0x39d109['routealias']=this[_0xad59('0x11')][_0x41c80d['uniqueid']][_0xad59('0x74')];logger[_0xad59('0x68')](_0xad59('0x75'),_0x39d109[_0xad59('0x4c')],_0x39d109['type']);_[_0xad59('0x76')](_0x39d109,_['pick'](_0x41c80d,_[_0xad59('0x77')](_0x39d109)));this[_0xad59('0xf')][_0x41c80d[_0xad59('0x49')]][_0xad59('0x78')](_0x39d109);this[_0xad59('0x11')][_0x41c80d[_0xad59('0x49')]]=_0x39d109;this[_0xad59('0x43')](_0x39d109,_0xad59('0x1b'));}}catch(_0x5b857d){logger[_0xad59('0x3b')](_0xad59('0x79'),_0x41c80d['uniqueid'],util[_0xad59('0x3d')](_0x5b857d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xad59('0x33')][_0xad59('0x7a')]=function(_0x103d87){try{if(this[_0xad59('0x60')](_0x103d87)){logger[_0xad59('0x44')](_0xad59('0x7b'),_0x103d87[_0xad59('0x49')],util[_0xad59('0x3d')](_0x103d87,{'showHidden':![],'depth':null}));if(this[_0xad59('0xf')][_0x103d87[_0xad59('0x49')]]){var _0x106d55=_[_0xad59('0x7c')](this[_0xad59('0xf')][_0x103d87['uniqueid']]);_0x106d55[_0xad59('0x7d')]=![];_0x106d55[_0xad59('0x7e')]=null;_0x106d55[_0xad59('0x7f')]=_0x103d87[_0xad59('0x7f')];_0x106d55[_0xad59('0x80')]=_0x103d87['originalposition'];_0x106d55[_0xad59('0x1d')]=!![];_0x106d55[_0xad59('0x81')]=moment()[_0xad59('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x106d55[_0xad59('0x4a')]=_0xad59('0x82');_0x106d55['lastAssignedTo']=null;logger[_0xad59('0x68')](_0xad59('0x83'),_0x106d55[_0xad59('0x4c')],_0x106d55[_0xad59('0x4f')]);this[_0xad59('0x11')][_0x103d87[_0xad59('0x49')]]=_0x106d55;this[_0xad59('0x40')](_0x106d55,_0xad59('0x1d'));}}}catch(_0x3dba16){logger[_0xad59('0x3b')](_0xad59('0x7b'),_0x103d87[_0xad59('0x49')],util[_0xad59('0x3d')](_0x3dba16,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xad59('0x33')][_0xad59('0x1e')]=function(_0x185195){try{if(this[_0xad59('0x60')](_0x185195)){logger['debug'](_0xad59('0x84'),_0x185195[_0xad59('0x49')],util['inspect'](_0x185195,{'showHidden':![],'depth':null}));if(this[_0xad59('0xf')][_0x185195[_0xad59('0x49')]]){var _0x46ae60=_[_0xad59('0x7c')](this[_0xad59('0xf')][_0x185195[_0xad59('0x49')]]);_0x46ae60[_0xad59('0x85')]=moment()[_0xad59('0x47')](_0xad59('0x86'));_0x46ae60[_0xad59('0x87')]=_0x185195['connectedlinenum'];_0x46ae60[_0xad59('0x88')]=_0x185195['connectedlinename'];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x46ae60[_0xad59('0x4c')],_0x46ae60[_0xad59('0x4f')],_0x185195[_0xad59('0x87')],_0x185195[_0xad59('0x88')]);this['channels'][_0x185195[_0xad59('0x49')]]=_0x46ae60;this[_0xad59('0x43')](_0x46ae60,_0xad59('0x89'));}}}catch(_0x929478){logger[_0xad59('0x3b')](_0xad59('0x84'),_0x185195[_0xad59('0x49')],util[_0xad59('0x3d')](_0x929478,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x4aeccc){try{if(this['isNotNull'](_0x4aeccc)){logger[_0xad59('0x44')](_0xad59('0x8a'),_0x4aeccc[_0xad59('0x49')],util['inspect'](_0x4aeccc,{'showHidden':![],'depth':null}));if(this[_0xad59('0xf')][_0x4aeccc['uniqueid']]){var _0x1472d4=_[_0xad59('0x7c')](this[_0xad59('0xf')][_0x4aeccc[_0xad59('0x49')]]);_0x1472d4['queuecallercomplete']=!![];_0x1472d4['queuecallerexitreason']=_0xad59('0x8b');logger['info'](_0xad59('0x8c'),_0x1472d4[_0xad59('0x4c')],_0x1472d4[_0xad59('0x4f')]);}}}catch(_0x18d0d2){logger[_0xad59('0x3b')](_0xad59('0x8a'),_0x4aeccc[_0xad59('0x49')],util[_0xad59('0x3d')](_0x18d0d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xad59('0x33')]['syncAgentComplete']=function(_0x54877b){try{if(this[_0xad59('0x60')](_0x54877b)){logger['debug'](_0xad59('0x8d'),_0x54877b['uniqueid'],util[_0xad59('0x3d')](_0x54877b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x54877b['uniqueid']]){var _0x19b1b2=_[_0xad59('0x7c')](this[_0xad59('0xf')][_0x54877b[_0xad59('0x49')]]);_0x19b1b2['queuecallerabandon']=![];_0x19b1b2[_0xad59('0x81')]=null;_0x19b1b2[_0xad59('0x8e')]=!![];_0x19b1b2[_0xad59('0x8f')]=_0x54877b[_0xad59('0x90')];_0x19b1b2[_0xad59('0x7f')]=_0x54877b['holdtime'];_0x19b1b2[_0xad59('0x7d')]=!![];_0x19b1b2[_0xad59('0x91')]=![];_0x19b1b2[_0xad59('0x92')]=null;if(!_0x19b1b2[_0xad59('0x93')]){if(_0x54877b[_0xad59('0x94')]==_0xad59('0x93')){_0x19b1b2['queuecallerexitreason']='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x19b1b2[_0xad59('0x4c')],_0x19b1b2['type']);}else{if(_['startsWith'](_0x54877b[_0xad59('0x38')][_0xad59('0x95')](),'local/')){if(this[_0xad59('0xf')][_0x54877b[_0xad59('0x96')]]){var _0xf27ad9=_[_0xad59('0x7c')](this[_0xad59('0xf')][_0x54877b['linkedid']]);_0xf27ad9[_0xad59('0x7d')]=![];_0xf27ad9[_0xad59('0x91')]=!![];_0xf27ad9[_0xad59('0x92')]=moment(_0x19b1b2[_0xad59('0x97')])['add'](_0x54877b['holdtime'],'seconds')[_0xad59('0x47')](_0xad59('0x86'));_0xf27ad9[_0xad59('0x4a')]='FORWARDTRANSFER';_0xf27ad9['transfer']=!![];_0xf27ad9[_0xad59('0x98')]='FORWARD';_0xf27ad9[_0xad59('0x99')]=_0x54877b[_0xad59('0x9a')];_0xf27ad9[_0xad59('0x9b')]=_0x54877b[_0xad59('0x49')];logger[_0xad59('0x68')](_0xad59('0x9c'),_0xf27ad9[_0xad59('0x4c')],_0xf27ad9['type']);var _0x44c4ec=this[_0xad59('0xf')][_0x54877b[_0xad59('0x96')]];this['queueReports'][_0x54877b[_0xad59('0x96')]]=this['queueReports'][_0x54877b[_0xad59('0x49')]];this[_0xad59('0xf')][_0x54877b[_0xad59('0x49')]]=_0x44c4ec;}}else{_0x19b1b2[_0xad59('0x4a')]=_0xad59('0x9d')+_0x54877b[_0xad59('0x94')][_0xad59('0x9e')]();logger[_0xad59('0x68')](_0xad59('0x9f'),_0x19b1b2[_0xad59('0x4c')],_0x19b1b2['type'],_0x19b1b2[_0xad59('0x4a')]);}}}this[_0xad59('0x11')][_0x54877b[_0xad59('0x49')]]=_0x19b1b2;this[_0xad59('0x40')](_0x19b1b2,_0xad59('0x1f'));}}}catch(_0x5c9a4a){logger[_0xad59('0x3b')](_0xad59('0x8d'),_0x54877b['uniqueid'],util[_0xad59('0x3d')](_0x5c9a4a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xad59('0x33')][_0xad59('0xa0')]=function(_0x4d18e2){try{if(this[_0xad59('0x60')](_0x4d18e2)){logger[_0xad59('0x44')]('[%s][voiceQueueReport][varset]',_0x4d18e2[_0xad59('0x49')],util[_0xad59('0x3d')](_0x4d18e2,{'showHidden':![],'depth':null}));this[_0xad59('0xa1')](_0x4d18e2[_0xad59('0x49')],_[_0xad59('0x77')](_0x4d18e2[_0xad59('0xa2')])[0x0],_0x4d18e2[_0xad59('0xa3')]);if(this['queueReports'][_0x4d18e2[_0xad59('0x49')]]){var _0x5ef32b=_[_0xad59('0x7c')](this[_0xad59('0xf')][_0x4d18e2[_0xad59('0x49')]]);if(_0x5ef32b){if(this['isNotNull'](_0x4d18e2[_0xad59('0xa2')])&&this['isNotNull'](_0x4d18e2[_0xad59('0xa2')][_0xad59('0xa4')])){switch(_0x4d18e2['value']){case _0xad59('0xa5'):_0x5ef32b['queuecallerexit']=![];_0x5ef32b['queuecallerexitAt']=null;break;case _0xad59('0xa6'):_0x5ef32b['lastevent']=_0xad59('0xa7');_0x5ef32b['queuecallerexit']=!![];_0x5ef32b['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5ef32b[_0xad59('0x85')]=moment()[_0xad59('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xad59('0x44')](_0xad59('0xa8'),_0x4d18e2[_0xad59('0x49')],util[_0xad59('0x3d')](_0x5ef32b,{'showHidden':![],'depth':null}));ami['emit'](_0xad59('0xa9'),_0x5ef32b);break;default:_0x5ef32b[_0xad59('0x91')]=!![];_0x5ef32b[_0xad59('0x92')]=moment()['format'](_0xad59('0x86'));_0x5ef32b[_0xad59('0x85')]=moment()[_0xad59('0x47')](_0xad59('0x86'));}_0x5ef32b[_0xad59('0x1d')]=![];_0x5ef32b[_0xad59('0x81')]=null;_0x5ef32b[_0xad59('0x4a')]=_0x4d18e2[_0xad59('0xa3')];this[_0xad59('0x11')][_0x4d18e2[_0xad59('0x49')]]=_0x5ef32b;this[_0xad59('0x40')](_0x5ef32b,_0xad59('0xaa'));}else if(this[_0xad59('0x60')](_0x4d18e2[_0xad59('0xa2')])&&this[_0xad59('0x60')](_0x4d18e2[_0xad59('0xa2')][_0xad59('0xab')])){if(!_0x5ef32b[_0xad59('0x1d')]){_0x5ef32b[_0xad59('0x91')]=!![];_0x5ef32b[_0xad59('0x92')]=moment()[_0xad59('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ef32b[_0xad59('0x4a')]=_0xad59('0xac');_0x5ef32b[_0xad59('0x85')]=moment()[_0xad59('0x47')](_0xad59('0x86'));this[_0xad59('0x11')][_0x4d18e2[_0xad59('0x49')]]=_0x5ef32b;}}logger['info'](_0xad59('0xad'),_0x4d18e2['uniqueid'],_0x5ef32b['name'],_0x5ef32b[_0xad59('0x4f')],_['keys'](_0x4d18e2[_0xad59('0xa2')])[0x0],_0x4d18e2[_0xad59('0xa3')]);_0x5ef32b['variables']=this['variables'][_0x4d18e2[_0xad59('0x49')]];}}}}catch(_0x4aa676){logger[_0xad59('0x3b')](_0xad59('0xae'),_0x4d18e2[_0xad59('0x49')],util[_0xad59('0x3d')](_0x4aa676,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xad59('0x33')][_0xad59('0xa1')]=function(_0x9eb3cf,_0x30dde0,_0x5d1254){var _0x1649ce=[_0xad59('0xaf'),_0xad59('0xb0'),_0xad59('0xb1'),_0xad59('0xb2'),_0xad59('0xb3'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0xad59('0xb4'),'sipuri',_0xad59('0xb5'),'bridgepvtcallid','membercalls',_0xad59('0xb6'),'memberinterface',_0xad59('0xb7'),'membername','memberpenalty',_0xad59('0xb8')];if(!_['isNil'](_0x30dde0)&&!_[_0xad59('0xb9')](_0x1649ce,_0x30dde0)){if(_[_0xad59('0x61')](this[_0xad59('0x16')][_0x9eb3cf])){this[_0xad59('0x16')][_0x9eb3cf]={};}this[_0xad59('0x16')][_0x9eb3cf][_0x30dde0]=_0x5d1254;}};VoiceQueueReport[_0xad59('0x33')]['syncHangup']=function(_0x2d2fc1){try{if(this['isNotNull'](_0x2d2fc1)){logger[_0xad59('0x44')](_0xad59('0xba'),_0x2d2fc1[_0xad59('0x49')],util[_0xad59('0x3d')](_0x2d2fc1,{'showHidden':![],'depth':null}));if(this[_0xad59('0xf')][_0x2d2fc1[_0xad59('0x49')]]){for(var _0x149bed=0x0,_0x3663ef={};_0x149bed0x0?_0x4ad63a:0x0;this[_0x16e3('0x12')][_0x562bee[_0x16e3('0x6e')]][_0x16e3('0x5e')]=this['voiceQueues'][_0x562bee[_0x16e3('0x6e')]][_0x16e3('0x5e')]>_[_0x16e3('0x72')](_0x562bee[_0x16e3('0x73')])?_[_0x16e3('0x72')](_0x562bee[_0x16e3('0x73')]):this['voiceQueues'][_0x562bee[_0x16e3('0x6e')]]['talking'];this[_0x16e3('0x74')](this[_0x16e3('0x12')][_0x562bee[_0x16e3('0x6e')]],_0x16e3('0x16'));}logger[_0x16e3('0x4b')](_0x16e3('0x75'),util[_0x16e3('0x40')](this[_0x16e3('0x12')][_0x562bee[_0x16e3('0x6e')]],{'showHidden':![],'depth':null}));ami[_0x16e3('0x49')]('custom:queuesummary',this[_0x16e3('0x12')][_0x562bee['queue']]);}}}catch(_0x303b19){logger['error'](_0x16e3('0x6c'),util[_0x16e3('0x40')](_0x303b19,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16e3('0x76')]=function(_0x186cea){logger[_0x16e3('0x4b')](_0x16e3('0x77'),util[_0x16e3('0x40')](_0x186cea,{'showHidden':![],'depth':null}));this[_0x16e3('0x13')]=!![];};VoiceQueueReport[_0x16e3('0xb')][_0x16e3('0x1b')]=function(_0x3e926d){try{if(this[_0x16e3('0x6d')](_0x3e926d)){logger['debug'](_0x16e3('0x78'),_0x3e926d[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x3e926d,{'showHidden':![],'depth':null}));if(_[_0x16e3('0x69')](this[_0x16e3('0x41')][_0x3e926d[_0x16e3('0x4e')]]))this['queueReports'][_0x3e926d[_0x16e3('0x4e')]]=[];if(_[_0x16e3('0x69')](this[_0x16e3('0x10')][_0x3e926d[_0x16e3('0x4e')]]))this[_0x16e3('0x10')][_0x3e926d[_0x16e3('0x4e')]]={};var _0x1752c0=new QueueReport();_0x1752c0[_0x16e3('0x64')]=_0x3e926d['queue'];_0x1752c0[_0x16e3('0x57')]=this['voiceQueues'][_0x1752c0[_0x16e3('0x64')]]&&this[_0x16e3('0x12')][_0x1752c0[_0x16e3('0x64')]]['type']?this[_0x16e3('0x12')][_0x1752c0[_0x16e3('0x64')]][_0x16e3('0x57')]||_0x16e3('0x58'):_0x16e3('0x58');_0x1752c0['queue']=_0x3e926d[_0x16e3('0x6e')];_0x1752c0[_0x16e3('0x79')]=moment()[_0x16e3('0x4f')](_0x16e3('0x7a'));_0x1752c0[_0x16e3('0x7b')]=_0x3e926d['position'];_0x1752c0[_0x16e3('0x7c')]=_0x3e926d[_0x16e3('0x7c')];_0x1752c0[_0x16e3('0x4e')]=_0x3e926d[_0x16e3('0x4e')];_0x1752c0['routealias']=this[_0x16e3('0x10')][_0x3e926d['uniqueid']][_0x16e3('0x7d')];logger['info'](_0x16e3('0x7e'),_0x1752c0[_0x16e3('0x64')],_0x1752c0[_0x16e3('0x57')]);_[_0x16e3('0x7f')](_0x1752c0,_[_0x16e3('0x80')](_0x3e926d,_[_0x16e3('0x81')](_0x1752c0)));this[_0x16e3('0x41')][_0x3e926d[_0x16e3('0x4e')]][_0x16e3('0x82')](_0x1752c0);this[_0x16e3('0x10')][_0x3e926d[_0x16e3('0x4e')]]=_0x1752c0;this[_0x16e3('0x4a')](_0x1752c0,'queuecallerjoin');}}catch(_0x835eb3){logger[_0x16e3('0x3e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3e926d[_0x16e3('0x4e')],util['inspect'](_0x835eb3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x73a24d){try{if(this['isNotNull'](_0x73a24d)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x73a24d[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x73a24d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x73a24d[_0x16e3('0x4e')]]){var _0x64563b=_[_0x16e3('0x83')](this[_0x16e3('0x41')][_0x73a24d['uniqueid']]);_0x64563b[_0x16e3('0x84')]=![];_0x64563b[_0x16e3('0x85')]=null;_0x64563b[_0x16e3('0x86')]=_0x73a24d[_0x16e3('0x86')];_0x64563b[_0x16e3('0x87')]=_0x73a24d[_0x16e3('0x87')];_0x64563b['queuecallerabandon']=!![];_0x64563b['queuecallerabandonAt']=moment()[_0x16e3('0x4f')](_0x16e3('0x7a'));_0x64563b[_0x16e3('0x53')]=_0x16e3('0x88');_0x64563b['lastAssignedTo']=null;logger[_0x16e3('0x89')](_0x16e3('0x8a'),_0x64563b['name'],_0x64563b['type']);this[_0x16e3('0x10')][_0x73a24d[_0x16e3('0x4e')]]=_0x64563b;this['emitVoiceQueueChannelRemove'](_0x64563b,_0x16e3('0x1c'));}}}catch(_0x27ce33){logger[_0x16e3('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x73a24d[_0x16e3('0x4e')],util['inspect'](_0x27ce33,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16e3('0x1f')]=function(_0x140f0e){try{if(this['isNotNull'](_0x140f0e)){logger[_0x16e3('0x4b')](_0x16e3('0x8b'),_0x140f0e[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x140f0e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x140f0e[_0x16e3('0x4e')]]){var _0x4b7f3c=_[_0x16e3('0x83')](this[_0x16e3('0x41')][_0x140f0e[_0x16e3('0x4e')]]);_0x4b7f3c[_0x16e3('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4b7f3c[_0x16e3('0x8d')]=_0x140f0e['connectedlinenum'];_0x4b7f3c[_0x16e3('0x8e')]=_0x140f0e[_0x16e3('0x8e')];logger[_0x16e3('0x89')](_0x16e3('0x8f'),_0x4b7f3c['name'],_0x4b7f3c[_0x16e3('0x57')],_0x140f0e[_0x16e3('0x8d')],_0x140f0e['connectedlinename']);this['channels'][_0x140f0e[_0x16e3('0x4e')]]=_0x4b7f3c;this[_0x16e3('0x4a')](_0x4b7f3c,_0x16e3('0x1e'));}}}catch(_0x4e5c07){logger['error'](_0x16e3('0x8b'),_0x140f0e[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x4e5c07,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16e3('0x23')]=function(_0x275969){try{if(this[_0x16e3('0x6d')](_0x275969)){logger['debug'](_0x16e3('0x90'),_0x275969[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x275969,{'showHidden':![],'depth':null}));if(this[_0x16e3('0x41')][_0x275969[_0x16e3('0x4e')]]){var _0x2f9111=_['last'](this[_0x16e3('0x41')][_0x275969[_0x16e3('0x4e')]]);_0x2f9111[_0x16e3('0x84')]=!![];_0x2f9111[_0x16e3('0x53')]=_0x16e3('0x91');logger[_0x16e3('0x89')](_0x16e3('0x92'),_0x2f9111[_0x16e3('0x64')],_0x2f9111[_0x16e3('0x57')]);}}}catch(_0x39c48b){logger[_0x16e3('0x3e')](_0x16e3('0x90'),_0x275969[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x39c48b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16e3('0xb')][_0x16e3('0x21')]=function(_0x43898b){try{if(this['isNotNull'](_0x43898b)){logger[_0x16e3('0x4b')](_0x16e3('0x93'),_0x43898b['uniqueid'],util[_0x16e3('0x40')](_0x43898b,{'showHidden':![],'depth':null}));if(this[_0x16e3('0x41')][_0x43898b['uniqueid']]){var _0x1d9b66=_[_0x16e3('0x83')](this[_0x16e3('0x41')][_0x43898b[_0x16e3('0x4e')]]);_0x1d9b66[_0x16e3('0x1c')]=![];_0x1d9b66['queuecallerabandonAt']=null;_0x1d9b66[_0x16e3('0x94')]=!![];_0x1d9b66['lastAssignedTo']=_0x43898b[_0x16e3('0x95')];_0x1d9b66[_0x16e3('0x86')]=_0x43898b['holdtime'];_0x1d9b66[_0x16e3('0x84')]=!![];_0x1d9b66[_0x16e3('0x96')]=![];_0x1d9b66['queuecallerexitAt']=null;if(!_0x1d9b66[_0x16e3('0x97')]){if(_0x43898b['reason']==_0x16e3('0x97')){_0x1d9b66[_0x16e3('0x53')]=_0x16e3('0x98');logger[_0x16e3('0x89')](_0x16e3('0x99'),_0x1d9b66[_0x16e3('0x64')],_0x1d9b66['type']);}else{if(_['startsWith'](_0x43898b[_0x16e3('0x3b')]['toLowerCase'](),'local/')){if(this[_0x16e3('0x41')][_0x43898b[_0x16e3('0x9a')]]){var _0x372c62=_[_0x16e3('0x83')](this[_0x16e3('0x41')][_0x43898b['linkedid']]);_0x372c62['queuecallercomplete']=![];_0x372c62[_0x16e3('0x96')]=!![];_0x372c62[_0x16e3('0x9b')]=moment(_0x1d9b66[_0x16e3('0x79')])[_0x16e3('0x9c')](_0x43898b[_0x16e3('0x86')],_0x16e3('0x9d'))[_0x16e3('0x4f')](_0x16e3('0x7a'));_0x372c62['queuecallerexitreason']=_0x16e3('0x9e');_0x372c62['transfer']=!![];_0x372c62[_0x16e3('0x9f')]='FORWARD';_0x372c62[_0x16e3('0xa0')]=_0x43898b['destexten'];_0x372c62[_0x16e3('0xa1')]=_0x43898b['uniqueid'];logger[_0x16e3('0x89')](_0x16e3('0xa2'),_0x372c62[_0x16e3('0x64')],_0x372c62[_0x16e3('0x57')]);var _0x248b53=this[_0x16e3('0x41')][_0x43898b['linkedid']];this[_0x16e3('0x41')][_0x43898b['linkedid']]=this['queueReports'][_0x43898b[_0x16e3('0x4e')]];this[_0x16e3('0x41')][_0x43898b[_0x16e3('0x4e')]]=_0x248b53;}}else{_0x1d9b66[_0x16e3('0x53')]=_0x16e3('0xa3')+_0x43898b[_0x16e3('0xa4')]['toUpperCase']();logger[_0x16e3('0x89')](_0x16e3('0xa5'),_0x1d9b66[_0x16e3('0x64')],_0x1d9b66[_0x16e3('0x57')],_0x1d9b66[_0x16e3('0x53')]);}}}this[_0x16e3('0x10')][_0x43898b[_0x16e3('0x4e')]]=_0x1d9b66;this[_0x16e3('0x47')](_0x1d9b66,_0x16e3('0x20'));}}}catch(_0x51ca94){logger[_0x16e3('0x3e')](_0x16e3('0x93'),_0x43898b[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x51ca94,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x16e3('0xb')]['syncVarSet']=function(_0x3acb98){try{if(this[_0x16e3('0x6d')](_0x3acb98)){logger[_0x16e3('0x4b')](_0x16e3('0xa6'),_0x3acb98[_0x16e3('0x4e')],util[_0x16e3('0x40')](_0x3acb98,{'showHidden':![],'depth':null}));this[_0x16e3('0xa7')](_0x3acb98[_0x16e3('0x4e')],_[_0x16e3('0x81')](_0x3acb98[_0x16e3('0xa8')])[0x0],_0x3acb98['value']);if(this[_0x16e3('0x41')][_0x3acb98[_0x16e3('0x4e')]]){var _0x13c946=_['last'](this[_0x16e3('0x41')][_0x3acb98['uniqueid']]);if(_0x13c946){if(this[_0x16e3('0x6d')](_0x3acb98[_0x16e3('0xa8')])&&this[_0x16e3('0x6d')](_0x3acb98[_0x16e3('0xa8')][_0x16e3('0xa9')])){switch(_0x3acb98[_0x16e3('0xaa')]){case'CONTINUE':_0x13c946['queuecallerexit']=![];_0x13c946[_0x16e3('0x9b')]=null;break;case'TIMEOUT':_0x13c946[_0x16e3('0xab')]=_0x16e3('0xac');_0x13c946[_0x16e3('0x96')]=!![];_0x13c946[_0x16e3('0x9b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x13c946['queuecallerleaveAt']=moment()[_0x16e3('0x4f')](_0x16e3('0x7a'));logger[_0x16e3('0x4b')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3acb98[_0x16e3('0x4e')],util['inspect'](_0x13c946,{'showHidden':![],'depth':null}));ami[_0x16e3('0x49')](_0x16e3('0xad'),_0x13c946);break;default:_0x13c946[_0x16e3('0x96')]=!![];_0x13c946[_0x16e3('0x9b')]=moment()[_0x16e3('0x4f')](_0x16e3('0x7a'));_0x13c946[_0x16e3('0x8c')]=moment()[_0x16e3('0x4f')](_0x16e3('0x7a'));}_0x13c946[_0x16e3('0x1c')]=![];_0x13c946[_0x16e3('0xae')]=null;_0x13c946[_0x16e3('0x53')]=_0x3acb98['value'];this['channels'][_0x3acb98[_0x16e3('0x4e')]]=_0x13c946;this[_0x16e3('0x47')](_0x13c946,'varset');}else if(this[_0x16e3('0x6d')](_0x3acb98[_0x16e3('0xa8')])&&this[_0x16e3('0x6d')](_0x3acb98[_0x16e3('0xa8')][_0x16e3('0xaf')])){if(!_0x13c946['queuecallerabandon']){_0x13c946[_0x16e3('0x96')]=!![];_0x13c946[_0x16e3('0x9b')]=moment()[_0x16e3('0x4f')](_0x16e3('0x7a'));_0x13c946[_0x16e3('0x53')]=_0x16e3('0xb0');_0x13c946['queuecallerleaveAt']=moment()[_0x16e3('0x4f')](_0x16e3('0x7a'));this[_0x16e3('0x10')][_0x3acb98['uniqueid']]=_0x13c946;}}logger[_0x16e3('0x89')](_0x16e3('0xb1'),_0x3acb98[_0x16e3('0x4e')],_0x13c946[_0x16e3('0x64')],_0x13c946[_0x16e3('0x57')],_['keys'](_0x3acb98['variable'])[0x0],_0x3acb98[_0x16e3('0xaa')]);_0x13c946[_0x16e3('0x15')]=this['variables'][_0x3acb98[_0x16e3('0x4e')]];}}}}catch(_0x17ccda){logger['error'](_0x16e3('0xa6'),_0x3acb98['uniqueid'],util[_0x16e3('0x40')](_0x17ccda,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x16e3('0xa7')]=function(_0x18e4a0,_0x4badc7,_0x84aa81){var _0x12cb49=[_0x16e3('0xb2'),_0x16e3('0xb3'),_0x16e3('0xb4'),_0x16e3('0xb5'),_0x16e3('0xb6'),_0x16e3('0xb7'),_0x16e3('0xb8'),'rtpaudioqosrttbridged',_0x16e3('0xb9'),'sipuri',_0x16e3('0xba'),_0x16e3('0xbb'),_0x16e3('0xbc'),'memberdynamic',_0x16e3('0xbd'),'memberlastcall',_0x16e3('0x95'),_0x16e3('0xbe'),_0x16e3('0xbf')];if(!_[_0x16e3('0x38')](_0x4badc7)&&!_[_0x16e3('0xc0')](_0x12cb49,_0x4badc7)){if(_[_0x16e3('0x69')](this[_0x16e3('0x15')][_0x18e4a0])){this[_0x16e3('0x15')][_0x18e4a0]={};}this[_0x16e3('0x15')][_0x18e4a0][_0x4badc7]=_0x84aa81;}};VoiceQueueReport[_0x16e3('0xb')][_0x16e3('0xc1')]=function(_0x439893){try{if(this['isNotNull'](_0x439893)){logger[_0x16e3('0x4b')](_0x16e3('0xc2'),_0x439893[_0x16e3('0x4e')],util['inspect'](_0x439893,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x439893[_0x16e3('0x4e')]]){for(var _0x5228df=0x0,_0x17bdf8={};_0x5228df=0x0?moment(_0x3931b1['endtime'])[_0x192a('0x1a')](_0x3931b1['starttime'],_0x192a('0xf')):null,'data1':'outbound','data2':_0x3931b1[_0x192a('0x14')],'data3':_0x3931b1[_0x192a('0x12')],'data4':_0x3931b1['dialstring']||null,'role':'agent','internal':_0x3931b1[_0x192a('0x14')]?_[_0x192a('0x1b')](_0x3931b1[_0x192a('0x14')]):undefined,'uniqueid':_0x3931b1[_0x192a('0x15')]},'log':_0x192a('0x7')});}; \ No newline at end of file +var _0xe49e=['isNil','interface','format','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','toNumber','uniqueid','CreateMemberReport','voiceDialReport','starttime','endtime','diff','accountcode','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','voice','lastAssignedTo'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe49e,0x157));var _0xee49=function(_0x15e555,_0x43ea81){_0x15e555=_0x15e555-0x0;var _0x4a72b5=_0xe49e[_0x15e555];return _0x4a72b5;};'use strict';var moment=require('moment');var _=require(_0xee49('0x0'));var util=require(_0xee49('0x1'));var client=require(_0xee49('0x2'));exports[_0xee49('0x3')]=function(_0x522799){var _0xf0bbe9=_0x522799[_0xee49('0x4')]||_0x522799['queuecallerexitAt'];return client[_0xee49('0x5')]('CreateMemberReport',{'body':{'channel':_0xee49('0x6'),'membername':_0x522799[_0xee49('0x7')],'interface':_[_0xee49('0x8')](_0x522799[_0xee49('0x9')])?util[_0xee49('0xa')]('SIP/%s',_0x522799[_0xee49('0x7')]):_0x522799[_0xee49('0x9')],'type':_0xee49('0xb'),'enterAt':_0x522799[_0xee49('0xc')],'exitAt':_0xf0bbe9,'duration':moment(_0xf0bbe9)['diff'](_0x522799[_0xee49('0xc')],_0xee49('0xd')),'data1':_0xee49('0xe'),'data2':_0x522799[_0xee49('0xf')],'data3':_0x522799[_0xee49('0x10')],'data4':null,'data5':_0x522799[_0xee49('0x11')],'role':_0xee49('0x12'),'internal':_0x522799['accountcode']?_[_0xee49('0x13')](_0x522799['accountcode']):undefined,'uniqueid':_0x522799[_0xee49('0x14')]},'log':_0xee49('0x15')});};exports[_0xee49('0x16')]=function(_0x33529e){return client[_0xee49('0x5')](_0xee49('0x15'),{'body':{'channel':_0xee49('0x6'),'membername':_0x33529e['membername'],'interface':_0x33529e[_0xee49('0x9')],'type':_0xee49('0xb'),'enterAt':_0x33529e[_0xee49('0x17')],'exitAt':_0x33529e[_0xee49('0x18')],'duration':moment(_0x33529e['endtime'])[_0xee49('0x19')](_0x33529e[_0xee49('0x17')],_0xee49('0xd'))>=0x0?moment(_0x33529e[_0xee49('0x18')])['diff'](_0x33529e[_0xee49('0x17')],'seconds'):null,'data1':'outbound','data2':_0x33529e['accountcode'],'data3':_0x33529e['exten'],'data4':_0x33529e['dialstring']||null,'role':'agent','internal':_0x33529e[_0xee49('0x1a')]?_[_0xee49('0x13')](_0x33529e[_0xee49('0x1a')]):undefined,'uniqueid':_0x33529e['uniqueid']},'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 fb48226..69313a4 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 _0x02a7=['previewRecallmeReminderInterval','GetSettings','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x561271,_0x48c96a){var _0x5edcc4=function(_0xc82e3c){while(--_0xc82e3c){_0x561271['push'](_0x561271['shift']());}};_0x5edcc4(++_0x48c96a);}(_0x02a7,0x1a6));var _0x702a=function(_0x1e66b8,_0x4c43aa){_0x1e66b8=_0x1e66b8-0x0;var _0x5eae97=_0x02a7[_0x1e66b8];return _0x5eae97;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x702a('0x3'),_0x702a('0x4')]},'log':_0x702a('0x5')});}; \ No newline at end of file +var _0xefda=['stopRecordingOnTransfer','GetSettings','../client','ShowSetting'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xefda,0x96));var _0xaefd=function(_0x1fc065,_0x21899d){_0x1fc065=_0x1fc065-0x0;var _0x8af1b6=_0xefda[_0x1fc065];return _0x8af1b6;};'use strict';var client=require(_0xaefd('0x0'));exports['getSettings']=function(){return client['Request'](_0xaefd('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xaefd('0x2'),'previewRecallmeReminderInterval']},'log':_0xaefd('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index cd75b25..9a29f6c 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 _0x0aa8=['GetTemplate','name','../client','getTemplates'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x0aa8,0xae));var _0x80aa=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x0aa8[_0x240261];return _0x45c332;};'use strict';var client=require(_0x80aa('0x0'));exports[_0x80aa('0x1')]=function(_0x2a469d){return function(_0x7c0106){return client['Request'](_0x80aa('0x2'),{'options':{'raw':!![],'attributes':['id',_0x80aa('0x3'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xb346=['Request','GetTemplate','name','../client','getTemplates'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb346,0xcb));var _0x6b34=function(_0x1ab850,_0x22997d){_0x1ab850=_0x1ab850-0x0;var _0x435d58=_0xb346[_0x1ab850];return _0x435d58;};'use strict';var client=require(_0x6b34('0x0'));exports[_0x6b34('0x1')]=function(_0x596b5a){return function(_0x428564){return client[_0x6b34('0x2')](_0x6b34('0x3'),{'options':{'raw':!![],'attributes':['id',_0x6b34('0x4'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 68b148b..a5a187d 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 _0x732a=['data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','status','field','operator','value','Condition','AnyConditions','Action','Actions','action','data1','data2'];(function(_0x294c92,_0x30f2cf){var _0x2282e1=function(_0x38f8c5){while(--_0x38f8c5){_0x294c92['push'](_0x294c92['shift']());}};_0x2282e1(++_0x30f2cf);}(_0x732a,0x1d3));var _0xa732=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x732a[_0x525c7b];return _0x27b33e;};'use strict';var client=require(_0xa732('0x0'));exports[_0xa732('0x1')]=function(_0x56fd7d){return function(_0x12c3d1){return client[_0xa732('0x2')](_0xa732('0x3'),{'options':{'raw':![],'attributes':['id',_0xa732('0x4'),'channel',_0xa732('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xa732('0x6'),_0xa732('0x7'),_0xa732('0x8')]},{'model':_0xa732('0x9'),'as':_0xa732('0xa'),'attributes':['id','field',_0xa732('0x7'),_0xa732('0x8')]},{'model':_0xa732('0xb'),'as':_0xa732('0xc'),'attributes':['id',_0xa732('0xd'),_0xa732('0xe'),_0xa732('0xf'),_0xa732('0x10'),_0xa732('0x11'),_0xa732('0x12'),_0xa732('0x13'),_0xa732('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x4259=['../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','Actions','data1','data2','data4','data5','data6'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x4259,0x144));var _0x9425=function(_0x216c10,_0xd83344){_0x216c10=_0x216c10-0x0;var _0x53cfca=_0x4259[_0x216c10];return _0x53cfca;};'use strict';var client=require(_0x9425('0x0'));exports[_0x9425('0x1')]=function(_0x3b0695){return function(_0x2778d1){return client[_0x9425('0x2')](_0x9425('0x3'),{'options':{'raw':![],'attributes':['id',_0x9425('0x4'),_0x9425('0x5'),_0x9425('0x6')],'include':[{'model':_0x9425('0x7'),'as':_0x9425('0x8'),'attributes':['id','field',_0x9425('0x9'),_0x9425('0xa')]},{'model':_0x9425('0x7'),'as':_0x9425('0xb'),'attributes':['id','field',_0x9425('0x9'),_0x9425('0xa')]},{'model':'Action','as':_0x9425('0xc'),'attributes':['id','action',_0x9425('0xd'),_0x9425('0xe'),'data3',_0x9425('0xf'),_0x9425('0x10'),_0x9425('0x11'),'data7']}]},'log':_0x9425('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 533d829..d3bff23 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 _0xf5a7=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf5a7,0x133));var _0x7f5a=function(_0x43adc7,_0x2f72eb){_0x43adc7=_0x43adc7-0x0;var _0x538133=_0xf5a7[_0x43adc7];return _0x538133;};'use strict';var client=require(_0x7f5a('0x0'));exports[_0x7f5a('0x1')]=function(_0x4c61ce){return function(_0x2cfb15){return client[_0x7f5a('0x2')](_0x7f5a('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7f5a('0x4'),_0x7f5a('0x5'),_0x7f5a('0x6')]},'log':_0x7f5a('0x3')});};}; \ No newline at end of file +var _0x70e2=['name','registry','defaultuser','../client','getTrunks','GetTrunk'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x70e2,0xc3));var _0x270e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x70e2[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x270e('0x0'));exports[_0x270e('0x1')]=function(_0x376c9c){return function(_0x25bcc4){return client['Request'](_0x270e('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x270e('0x3'),_0x270e('0x4'),_0x270e('0x5')]},'log':_0x270e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 1120613..9df74fc 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0xeaaff1,_0x38ec67){var _0x289e87=function(_0x1d051e){while(--_0x1d051e){_0xeaaff1['push'](_0xeaaff1['shift']());}};_0x289e87(++_0x38ec67);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xcb91[_0x309d93];return _0x2dd61d;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x2269e9,_0x42b0c5){var _0x3df100=function(_0x1d41a0){while(--_0x1d41a0){_0x2269e9['push'](_0x2269e9['shift']());}};_0x3df100(++_0x42b0c5);}(_0xedd9,0xfc));var _0x9edd=function(_0x2af250,_0x587b7a){_0x2af250=_0x2af250-0x0;var _0x28d7fd=_0xedd9[_0x2af250];return _0x28d7fd;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index acd6d61..668c7f8 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 _0x26e1=['../client','create','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x282377,_0x3b9593){var _0x52cc5a=function(_0x19d61f){while(--_0x19d61f){_0x282377['push'](_0x282377['shift']());}};_0x52cc5a(++_0x3b9593);}(_0x26e1,0x127));var _0x126e=function(_0x1fbd90,_0x21d6ad){_0x1fbd90=_0x1fbd90-0x0;var _0x50d543=_0x26e1[_0x1fbd90];return _0x50d543;};'use strict';var client=require(_0x126e('0x0'));exports[_0x126e('0x1')]=function(_0x37fee5){return client[_0x126e('0x2')](_0x126e('0x3'),{'body':_0x37fee5,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x2b7cfb,_0x7eda55,_0x4d6424){return client['Request'](_0x126e('0x4'),{'body':_0x2b7cfb,'options':{'where':{'uniqueid':_0x7eda55,'interface':_0x4d6424,'agentcomplete':!![]}},'log':_0x126e('0x4')});}; \ No newline at end of file +var _0xf109=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x1c0f4e,_0x584dd8){var _0x1e9f23=function(_0x2a4e60){while(--_0x2a4e60){_0x1c0f4e['push'](_0x1c0f4e['shift']());}};_0x1e9f23(++_0x584dd8);}(_0xf109,0x95));var _0x9f10=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xf109[_0x565ed7];return _0x183ad7;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0xb1953d){return client[_0x9f10('0x2')](_0x9f10('0x3'),{'body':_0xb1953d,'log':_0x9f10('0x3')});};exports[_0x9f10('0x4')]=function(_0x41c8ad,_0x10facc,_0x4651a4){return client[_0x9f10('0x2')](_0x9f10('0x5'),{'body':_0x41c8ad,'options':{'where':{'uniqueid':_0x10facc,'interface':_0x4651a4,'agentcomplete':!![]}},'log':_0x9f10('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7407a73..a95d8a2 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 _0x8471=['calleridnum','callerid','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','duration','GetVoiceCallReports','moment','lodash','../client','create','Request','merge'];(function(_0x51efce,_0x120f9a){var _0xb0c8ab=function(_0x3be922){while(--_0x3be922){_0x51efce['push'](_0x51efce['shift']());}};_0xb0c8ab(++_0x120f9a);}(_0x8471,0x15a));var _0x1847=function(_0x132fa6,_0x8878db){_0x132fa6=_0x132fa6-0x0;var _0x11db97=_0x8471[_0x132fa6];return _0x11db97;};'use strict';var moment=require(_0x1847('0x0'));var util=require('util');var _=require(_0x1847('0x1'));var client=require(_0x1847('0x2'));exports[_0x1847('0x3')]=function(_0x161526){return client[_0x1847('0x4')]('CreateVoiceCallReport',{'body':_[_0x1847('0x5')](_0x161526,{'source':_0x161526[_0x1847('0x6')],'destinationcontext':_0x161526['context'],'callerid':_0x161526[_0x1847('0x7')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x1847('0x8')]=function(){return function(){return client[_0x1847('0x4')](_0x1847('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x1847('0xa')](_0x1847('0xb'))[_0x1847('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x1847('0xb'))[_0x1847('0xc')](_0x1847('0xd'))]}},'attributes':['type','disposition',_0x1847('0xe'),'billableseconds']},'log':_0x1847('0xf')});};}; \ No newline at end of file +var _0x00b6=['Request','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','moment','util','create'];(function(_0x554541,_0x15d6f6){var _0x4f095e=function(_0x1ddf65){while(--_0x1ddf65){_0x554541['push'](_0x554541['shift']());}};_0x4f095e(++_0x15d6f6);}(_0x00b6,0x1c5));var _0x600b=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x00b6[_0x39c734];return _0xb2a2f9;};'use strict';var moment=require(_0x600b('0x0'));var util=require(_0x600b('0x1'));var _=require('lodash');var client=require('../client');exports[_0x600b('0x2')]=function(_0x5b7549){return client[_0x600b('0x3')]('CreateVoiceCallReport',{'body':_['merge'](_0x5b7549,{'source':_0x5b7549[_0x600b('0x4')],'destinationcontext':_0x5b7549[_0x600b('0x5')],'callerid':_0x5b7549[_0x600b('0x6')],'amaflags':_0x600b('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0x600b('0x8')]=function(){return function(){return client[_0x600b('0x3')](_0x600b('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x600b('0xa')](_0x600b('0xb'))[_0x600b('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x600b('0xd')](_0x600b('0xb'))['format'](_0x600b('0xe'))]}},'attributes':[_0x600b('0xf'),_0x600b('0x10'),'duration',_0x600b('0x11')]},'log':_0x600b('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index ea7dcfa..3656190 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 _0x762b=['CreateVoiceDialReport','create','Request'];(function(_0x3af0d0,_0xee84f9){var _0x5533a7=function(_0xe0d1c7){while(--_0xe0d1c7){_0x3af0d0['push'](_0x3af0d0['shift']());}};_0x5533a7(++_0xee84f9);}(_0x762b,0x8b));var _0xb762=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x762b[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports[_0xb762('0x0')]=function(_0x462641){return client[_0xb762('0x1')](_0xb762('0x2'),{'body':_0x462641,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x3ba7=['Request','CreateVoiceDialReport','create'];(function(_0x56198f,_0x720f60){var _0x1e091d=function(_0x546dde){while(--_0x546dde){_0x56198f['push'](_0x56198f['shift']());}};_0x1e091d(++_0x720f60);}(_0x3ba7,0xad));var _0x73ba=function(_0x26a94a,_0x4e7929){_0x26a94a=_0x26a94a-0x0;var _0x24da7f=_0x3ba7[_0x26a94a];return _0x24da7f;};'use strict';var client=require('../client');exports[_0x73ba('0x0')]=function(_0x3e2b07){return client[_0x73ba('0x1')](_0x73ba('0x2'),{'body':_0x3e2b07,'log':_0x73ba('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 9880107..5419fac 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 _0xb677=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client'];(function(_0x445dc3,_0x33cbb1){var _0x4d80dc=function(_0x4db738){while(--_0x4db738){_0x445dc3['push'](_0x445dc3['shift']());}};_0x4d80dc(++_0x33cbb1);}(_0xb677,0x119));var _0x7b67=function(_0x1ee133,_0x108cca){_0x1ee133=_0x1ee133-0x0;var _0x28ec56=_0xb677[_0x1ee133];return _0x28ec56;};'use strict';var client=require(_0x7b67('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x7b67('0x1')](_0x7b67('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7b67('0x3'),_0x7b67('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x7b67('0x5')});};}; \ No newline at end of file +var _0x702d=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x702d,0x147));var _0xd702=function(_0x398c17,_0x135be6){_0x398c17=_0x398c17-0x0;var _0x52b702=_0x702d[_0x398c17];return _0x52b702;};'use strict';var client=require(_0xd702('0x0'));exports[_0xd702('0x1')]=function(){return function(){return client[_0xd702('0x2')](_0xd702('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd702('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xd702('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 15e6398..4da6ae6 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 _0x40d2=['dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','name','acwTimeout','autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions'];(function(_0x39900c,_0x4023e3){var _0x2590f4=function(_0x36306f){while(--_0x36306f){_0x39900c['push'](_0x39900c['shift']());}};_0x2590f4(++_0x4023e3);}(_0x40d2,0x13d));var _0x240d=function(_0x4f749a,_0x541f4f){_0x4f749a=_0x4f749a-0x0;var _0x1152b7=_0x40d2[_0x4f749a];return _0x1152b7;};'use strict';var client=require(_0x240d('0x0'));exports[_0x240d('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x240d('0x2'),'acw',_0x240d('0x3'),_0x240d('0x4'),_0x240d('0x5'),'type','dialActive',_0x240d('0x6'),_0x240d('0x7'),_0x240d('0x8'),_0x240d('0x9'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x240d('0xa'),'dialOriginateCallerIdNumber',_0x240d('0xb'),_0x240d('0xc'),_0x240d('0xd'),_0x240d('0xe'),_0x240d('0xf'),'dialCongestionRetryFrequency',_0x240d('0x10'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x240d('0x11'),_0x240d('0x12'),_0x240d('0x13'),_0x240d('0x14'),'dialPrefix','dialCheckDuplicateType',_0x240d('0x15'),_0x240d('0x16'),_0x240d('0x17'),_0x240d('0x18'),_0x240d('0x19'),_0x240d('0x1a'),_0x240d('0x1b'),_0x240d('0x1c'),'dialAMDSilenceThreshold',_0x240d('0x1d'),_0x240d('0x1e'),_0x240d('0x1f'),_0x240d('0x20'),_0x240d('0x21'),_0x240d('0x22'),_0x240d('0x23'),_0x240d('0x24'),_0x240d('0x5'),_0x240d('0x25'),'dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x240d('0x26'),_0x240d('0x27'),'dialAbandonedRetryFrequency',_0x240d('0x28'),_0x240d('0x29'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x240d('0x2a'),_0x240d('0x2b'),_0x240d('0x2c'),_0x240d('0x2d'),_0x240d('0x2e')],'include':[{'model':_0x240d('0x2f'),'as':'Trunk','attributes':['id','name',_0x240d('0x30'),_0x240d('0x31')]},{'model':'Pause','as':_0x240d('0x32'),'attributes':['id',_0x240d('0x2')]},{'model':_0x240d('0x2f'),'as':_0x240d('0x33'),'attributes':['id',_0x240d('0x2'),_0x240d('0x30'),_0x240d('0x31')]},{'model':_0x240d('0x34'),'as':_0x240d('0x34'),'attributes':['id',_0x240d('0x2')],'include':[{'model':_0x240d('0x34'),'as':_0x240d('0x35'),'attributes':['id',_0x240d('0x2'),_0x240d('0x36')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x29a5=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x1e8219,_0x31b4a0){var _0x37d537=function(_0x242ae3){while(--_0x242ae3){_0x1e8219['push'](_0x1e8219['shift']());}};_0x37d537(++_0x31b4a0);}(_0x29a5,0x99));var _0x529a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x29a5[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0x529a('0x0'));exports[_0x529a('0x1')]=function(){return function(){return client[_0x529a('0x2')](_0x529a('0x3'),{'options':{'raw':![],'attributes':['id',_0x529a('0x4'),_0x529a('0x5'),'acwTimeout',_0x529a('0x6'),_0x529a('0x7'),_0x529a('0x8'),_0x529a('0x9'),'dialMethod','dialLimitChannel',_0x529a('0xa'),'dialPowerLevel',_0x529a('0xb'),_0x529a('0xc'),_0x529a('0xd'),_0x529a('0xe'),_0x529a('0xf'),_0x529a('0x10'),_0x529a('0x11'),_0x529a('0x12'),_0x529a('0x13'),_0x529a('0x14'),_0x529a('0x15'),_0x529a('0x16'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x529a('0x17'),'dialGlobalMaxRetry',_0x529a('0x18'),_0x529a('0x19'),_0x529a('0x1a'),'dialCheckDuplicateType','dialAMDActive',_0x529a('0x1b'),_0x529a('0x1c'),_0x529a('0x1d'),_0x529a('0x1e'),_0x529a('0x1f'),_0x529a('0x20'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x529a('0x21'),'timeout',_0x529a('0x22'),_0x529a('0x23'),_0x529a('0x24'),_0x529a('0x25'),_0x529a('0x26'),_0x529a('0x27'),_0x529a('0x7'),_0x529a('0x28'),_0x529a('0x29'),'dialCutDigit',_0x529a('0x2a'),'dialNoSuchNumberRetryFrequency',_0x529a('0x2b'),_0x529a('0x2c'),_0x529a('0x2d'),_0x529a('0x2e'),_0x529a('0x2f'),_0x529a('0x30'),_0x529a('0x31'),_0x529a('0x32'),'mandatoryDisposition',_0x529a('0x33'),_0x529a('0x34'),_0x529a('0x35'),_0x529a('0x36')],'include':[{'model':_0x529a('0x37'),'as':'Trunk','attributes':['id',_0x529a('0x4'),_0x529a('0x38'),_0x529a('0x39')]},{'model':_0x529a('0x3a'),'as':'mandatoryDispositionPause','attributes':['id',_0x529a('0x4')]},{'model':'Trunk','as':_0x529a('0x3b'),'attributes':['id',_0x529a('0x4'),_0x529a('0x38'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0x529a('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name',_0x529a('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4aecefa..dc60e2c 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(_0x20aec2,_0x3bde52){var _0x3cf3ee=function(_0x429018){while(--_0x429018){_0x20aec2['push'](_0x20aec2['shift']());}};_0x3cf3ee(++_0x3bde52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x51f21e,_0x4a22a1){var _0x388d20=function(_0x119e6f){while(--_0x119e6f){_0x51f21e['push'](_0x51f21e['shift']());}};_0x388d20(++_0x4a22a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 ee6e448..0ac4f2c 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 _0xf320=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf320,0x1b8));var _0x0f32=function(_0x4a325a,_0x2c154c){_0x4a325a=_0x4a325a-0x0;var _0x2597a1=_0xf320[_0x4a325a];return _0x2597a1;};'use strict';var client=require('../client');exports[_0x0f32('0x0')]=function(_0x4b8be5){return function(){return client[_0x0f32('0x1')](_0x0f32('0x2'),{'options':{'where':{'VoiceQueueId':_0x4b8be5,'paused':!![]},'raw':!![]},'log':_0x0f32('0x0')});};}; \ No newline at end of file +var _0xe7db=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x56ee6d,_0x195268){var _0x4f6357=function(_0x406775){while(--_0x406775){_0x56ee6d['push'](_0x56ee6d['shift']());}};_0x4f6357(++_0x195268);}(_0xe7db,0xcd));var _0xbe7d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xe7db[_0x8c43de];return _0xa6591b;};'use strict';var client=require('../client');exports[_0xbe7d('0x0')]=function(_0x5cd711){return function(){return client[_0xbe7d('0x1')](_0xbe7d('0x2'),{'options':{'where':{'VoiceQueueId':_0x5cd711,'paused':!![]},'raw':!![]},'log':_0xbe7d('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index dbbc372..ac0abfa 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2f1281,_0x5297b5){var _0x56a8ce=function(_0x28b0e4){while(--_0x28b0e4){_0x2f1281['push'](_0x2f1281['shift']());}};_0x56a8ce(++_0x5297b5);}(_0x7a54,0x106));var _0x47a5=function(_0x4ff897,_0x59b34e){_0x4ff897=_0x4ff897-0x0;var _0x40445f=_0x7a54[_0x4ff897];return _0x40445f;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x46d8a2,_0x12dbc1){var _0x56fa5a=function(_0x73b320){while(--_0x73b320){_0x46d8a2['push'](_0x46d8a2['shift']());}};_0x56fa5a(++_0x12dbc1);}(_0x7a54,0x106));var _0x47a5=function(_0x17c6db,_0x5436ce){_0x17c6db=_0x17c6db-0x0;var _0x2b6f79=_0x7a54[_0x17c6db];return _0x2b6f79;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 12fbea9..d342264 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 _0x4d6a=['origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal'];(function(_0x1b020e,_0x53b292){var _0x9df1f=function(_0x1678b6){while(--_0x1678b6){_0x1b020e['push'](_0x1b020e['shift']());}};_0x9df1f(++_0x53b292);}(_0x4d6a,0xcb));var _0xa4d6=function(_0x26e1c7,_0x4c8ae5){_0x26e1c7=_0x26e1c7-0x0;var _0x399b1c=_0x4d6a[_0x26e1c7];return _0x399b1c;};'use strict';var client=require(_0xa4d6('0x0'));exports[_0xa4d6('0x1')]={};exports[_0xa4d6('0x2')]=function(_0x2fa6f0){return client['Request'](_0xa4d6('0x3'),{'body':{'result':_0x2fa6f0[_0xa4d6('0x4')],'transfererchannel':_0x2fa6f0[_0xa4d6('0x5')],'transferercalleridnum':_0x2fa6f0[_0xa4d6('0x6')],'transferercalleridname':_0x2fa6f0[_0xa4d6('0x7')],'transfererconnectedlinenum':_0x2fa6f0['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2fa6f0[_0xa4d6('0x8')],'transfereraccountcode':_0x2fa6f0[_0xa4d6('0x9')],'transferercontext':_0x2fa6f0[_0xa4d6('0xa')],'transfererexten':_0x2fa6f0['transfererexten'],'transfererlinkedid':_0x2fa6f0['transfererlinkedid'],'transfereechannel':_0x2fa6f0[_0xa4d6('0xb')],'transfereecalleridnum':_0x2fa6f0['transfereecalleridnum'],'transfereecalleridname':_0x2fa6f0['transfereecalleridname'],'transfereeconnectedlinenum':_0x2fa6f0['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2fa6f0[_0xa4d6('0xc')],'transfereeaccountcode':_0x2fa6f0[_0xa4d6('0xd')],'transfereecontext':_0x2fa6f0[_0xa4d6('0xe')],'transfereeexten':_0x2fa6f0[_0xa4d6('0xf')],'transfereelinkedid':_0x2fa6f0[_0xa4d6('0x10')],'isexternal':_0x2fa6f0['isexternal'],'context':_0x2fa6f0['context'],'extension':_0x2fa6f0[_0xa4d6('0x11')],'type':_0xa4d6('0x12')},'log':_0xa4d6('0x3')});};exports[_0xa4d6('0x13')]=function(_0xcd6d69){return client[_0xa4d6('0x14')]('CreateVoiceTransferReport',{'body':{'result':_0xcd6d69['result'],'transfererchannel':_0xcd6d69[_0xa4d6('0x15')],'transferercalleridnum':_0xcd6d69[_0xa4d6('0x16')],'transferercalleridname':_0xcd6d69[_0xa4d6('0x17')],'transfererconnectedlinenum':_0xcd6d69[_0xa4d6('0x18')],'transfererconnectedlinename':_0xcd6d69[_0xa4d6('0x19')],'transfereraccountcode':_0xcd6d69[_0xa4d6('0x1a')],'transferercontext':_0xcd6d69[_0xa4d6('0x1b')],'transfererexten':_0xcd6d69[_0xa4d6('0x1c')],'transfererlinkedid':_0xcd6d69[_0xa4d6('0x1d')],'transfereechannel':_0xcd6d69['transfertargetchannel'],'transfereecalleridnum':_0xcd6d69[_0xa4d6('0x1e')],'transfereecalleridname':_0xcd6d69['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xcd6d69[_0xa4d6('0x1f')],'transfereeconnectedlinename':_0xcd6d69[_0xa4d6('0x20')],'transfereeaccountcode':_0xcd6d69[_0xa4d6('0x21')],'transfereecontext':_0xcd6d69['transfertargetcontext'],'transfereeexten':_0xcd6d69[_0xa4d6('0x22')],'transfereelinkedid':_0xcd6d69[_0xa4d6('0x23')],'isexternal':_0xcd6d69[_0xa4d6('0x24')],'context':_0xcd6d69[_0xa4d6('0x25')],'extension':_0xcd6d69[_0xa4d6('0x26')],'type':_0xa4d6('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x3b45=['transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','transfers','Request','result','transferercalleridnum','transferercalleridname'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3b45,0xa2));var _0x53b4=function(_0x578c86,_0x491716){_0x578c86=_0x578c86-0x0;var _0xdef2da=_0x3b45[_0x578c86];return _0xdef2da;};'use strict';var client=require(_0x53b4('0x0'));exports[_0x53b4('0x1')]={};exports['blindTransfer']=function(_0x194eb6){return client[_0x53b4('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x194eb6[_0x53b4('0x3')],'transfererchannel':_0x194eb6['transfererchannel'],'transferercalleridnum':_0x194eb6[_0x53b4('0x4')],'transferercalleridname':_0x194eb6[_0x53b4('0x5')],'transfererconnectedlinenum':_0x194eb6[_0x53b4('0x6')],'transfererconnectedlinename':_0x194eb6['transfererconnectedlinename'],'transfereraccountcode':_0x194eb6[_0x53b4('0x7')],'transferercontext':_0x194eb6[_0x53b4('0x8')],'transfererexten':_0x194eb6[_0x53b4('0x9')],'transfererlinkedid':_0x194eb6[_0x53b4('0xa')],'transfereechannel':_0x194eb6[_0x53b4('0xb')],'transfereecalleridnum':_0x194eb6[_0x53b4('0xc')],'transfereecalleridname':_0x194eb6[_0x53b4('0xd')],'transfereeconnectedlinenum':_0x194eb6[_0x53b4('0xe')],'transfereeconnectedlinename':_0x194eb6[_0x53b4('0xf')],'transfereeaccountcode':_0x194eb6[_0x53b4('0x10')],'transfereecontext':_0x194eb6[_0x53b4('0x11')],'transfereeexten':_0x194eb6['transfereeexten'],'transfereelinkedid':_0x194eb6[_0x53b4('0x12')],'isexternal':_0x194eb6[_0x53b4('0x13')],'context':_0x194eb6[_0x53b4('0x14')],'extension':_0x194eb6[_0x53b4('0x15')],'type':_0x53b4('0x16')},'log':_0x53b4('0x17')});};exports[_0x53b4('0x18')]=function(_0x390a98){return client[_0x53b4('0x2')](_0x53b4('0x17'),{'body':{'result':_0x390a98[_0x53b4('0x3')],'transfererchannel':_0x390a98[_0x53b4('0x19')],'transferercalleridnum':_0x390a98[_0x53b4('0x1a')],'transferercalleridname':_0x390a98['origtransferercalleridname'],'transfererconnectedlinenum':_0x390a98['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x390a98[_0x53b4('0x1b')],'transfereraccountcode':_0x390a98[_0x53b4('0x1c')],'transferercontext':_0x390a98[_0x53b4('0x1d')],'transfererexten':_0x390a98[_0x53b4('0x1e')],'transfererlinkedid':_0x390a98[_0x53b4('0x1f')],'transfereechannel':_0x390a98[_0x53b4('0x20')],'transfereecalleridnum':_0x390a98[_0x53b4('0x21')],'transfereecalleridname':_0x390a98[_0x53b4('0x22')],'transfereeconnectedlinenum':_0x390a98[_0x53b4('0x23')],'transfereeconnectedlinename':_0x390a98[_0x53b4('0x24')],'transfereeaccountcode':_0x390a98[_0x53b4('0x25')],'transfereecontext':_0x390a98[_0x53b4('0x26')],'transfereeexten':_0x390a98[_0x53b4('0x27')],'transfereelinkedid':_0x390a98[_0x53b4('0x28')],'isexternal':_0x390a98[_0x53b4('0x13')],'context':_0x390a98['origtransferercontext'],'extension':_0x390a98['origtransfererexten'],'type':_0x53b4('0x29')},'log':_0x53b4('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 33a521d..5bc6ef9 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 _0xc9c3=['exten','context','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','join','pick','module','then','message','catch','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','find','omit','undefined','values','channels','length','isConnected','voicechannel','validate','map','uniqueid','channel','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','%s.%s','filename','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Redirect'];(function(_0x57b092,_0x33cc77){var _0x4a15b0=function(_0x316c74){while(--_0x316c74){_0x57b092['push'](_0x57b092['shift']());}};_0x4a15b0(++_0x33cc77);}(_0xc9c3,0x96));var _0x3c9c=function(_0x5dda3a,_0x3bd96f){_0x5dda3a=_0x5dda3a-0x0;var _0x1e915d=_0xc9c3[_0x5dda3a];return _0x1e915d;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x3c9c('0x0'));var schema=require('validate');var BPromise=require(_0x3c9c('0x1'));var moment=require(_0x3c9c('0x2'));var config=require(_0x3c9c('0x3'));var properties=require(_0x3c9c('0x4'));var ami=require(_0x3c9c('0x5'));exports[_0x3c9c('0x6')]=function(_0x143bfe,_0x512e80,_0x48b219){return new BPromise(function(_0x5c86bd,_0x5a2836){var _0x3ca0ce={'QueuePause':function(_0xc35e75){return new Promise(function(_0x2eb946,_0x3e5ccb){var _0x355ef3=util[_0x3c9c('0x7')](_0x3c9c('0x8'),_0x3c9c('0x9'),_0xc35e75[_0x3c9c('0xa')]);if(_0x143bfe['timers']&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['timer']){_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['updateAcw']();}if(_0x143bfe[_0x3c9c('0xc')][_0x355ef3]){_0x143bfe[_0x3c9c('0xc')][_0x355ef3][_0x3c9c('0xd')]({'statePause':_0xc35e75[_0x3c9c('0xe')]?!![]:![]});}_0x2eb946({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x50cf96){var _0x4a60d9=this;return new Promise(function(_0x857b1f,_0x59bbc6){if(ami['isConnected']()==![]){return _0x59bbc6(_0x4a60d9['error'](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x50cf96=_[_0x3c9c('0x13')](_0x50cf96,_['keys'](properties[_0x3c9c('0x14')]));_0x50cf96['action']='Reload';return ami['Action'](_0x50cf96)[_0x3c9c('0x15')](function(_0x32d94a){_0x857b1f({'code':0xc8,'message':_0x32d94a[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x3e63e0){_0x59bbc6(_0x4a60d9[_0x3c9c('0x18')](0x1f5,_0x3e63e0[_0x3c9c('0x16')]));});});},'Command':function(_0x56fa79){var _0x15a90a=this;return new Promise(function(_0x4c7122,_0x461711){if(ami['isConnected']()==![]){return _0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x56fa79=_['pick'](_0x56fa79,_0x3c9c('0x19'));_0x56fa79[_0x3c9c('0x1a')]=_0x3c9c('0x1b');return ami[_0x3c9c('0x1c')](_0x56fa79)[_0x3c9c('0x15')](function(_0x3bc5c4){_0x4c7122({'code':0xc8,'message':_0x3bc5c4[_0x3c9c('0x1d')]});})[_0x3c9c('0x17')](function(_0x509bf7){_0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f5,_0x509bf7['message']));});});},'VoiceQueues':function(_0x497145){return new Promise(function(_0xe04fca,_0x4ca078){var _0x527bb9=[];for(var _0x379880 in _0x143bfe[_0x3c9c('0x1e')]){if(_0x143bfe[_0x3c9c('0x1e')][_0x3c9c('0x1f')](_0x379880)){var _0x4c283d=_0x143bfe[_0x3c9c('0x1e')][_0x379880];var _0x65b831={'id':_0x4c283d['id'],'name':_0x4c283d['name'],'strategy':_0x4c283d[_0x3c9c('0x20')],'answered':_0x4c283d['answered'],'available':_0x4c283d['available'],'loggedIn':_0x4c283d[_0x3c9c('0x21')],'pTalking':_0x4c283d[_0x3c9c('0x22')],'sumBillable':_0x4c283d[_0x3c9c('0x23')],'sumDuration':_0x4c283d[_0x3c9c('0x24')],'sumHoldTime':_0x4c283d[_0x3c9c('0x25')]||0x0,'talking':_0x4c283d['talking'],'total':_0x4c283d[_0x3c9c('0x26')],'type':_0x4c283d['type'],'unmanaged':_0x4c283d[_0x3c9c('0x27')],'abandoned':_0x4c283d[_0x3c9c('0x28')],'waiting':_0x4c283d[_0x3c9c('0x29')],'loggedInDb':_0x4c283d[_0x3c9c('0x2a')]};if(_0x4c283d['type']===_0x3c9c('0x2b')){_0x65b831[_0x3c9c('0x2c')]=_0x4c283d[_0x3c9c('0x2c')];_0x65b831[_0x3c9c('0x2d')]=_0x4c283d[_0x3c9c('0x2d')];_0x65b831[_0x3c9c('0x2e')]=_0x4c283d[_0x3c9c('0x2e')];_0x65b831[_0x3c9c('0x2f')]=_0x4c283d['dialOriginateCallerIdNumber'];_0x65b831[_0x3c9c('0x30')]=_0x4c283d[_0x3c9c('0x30')];_0x65b831[_0x3c9c('0x31')]=_0x4c283d[_0x3c9c('0x31')];_0x65b831[_0x3c9c('0x32')]=_0x4c283d[_0x3c9c('0x32')];_0x65b831[_0x3c9c('0x33')]=_0x4c283d[_0x3c9c('0x33')];_0x65b831[_0x3c9c('0x34')]=_0x4c283d[_0x3c9c('0x34')];_0x65b831[_0x3c9c('0x35')]=_0x4c283d[_0x3c9c('0x35')];_0x65b831[_0x3c9c('0x36')]=_0x4c283d[_0x3c9c('0x36')];_0x65b831['outboundCongestionCallsDay']=_0x4c283d[_0x3c9c('0x37')];_0x65b831[_0x3c9c('0x38')]=_0x4c283d[_0x3c9c('0x38')];_0x65b831['outboundDropCallsDayCallersExit']=_0x4c283d[_0x3c9c('0x39')];_0x65b831[_0x3c9c('0x3a')]=_0x4c283d[_0x3c9c('0x3a')];_0x65b831[_0x3c9c('0x3b')]=_0x4c283d['outboundNoAnswerCallsDay'];_0x65b831['outboundNoSuchCallsDay']=_0x4c283d[_0x3c9c('0x3c')];_0x65b831[_0x3c9c('0x3d')]=_0x4c283d[_0x3c9c('0x3d')];_0x65b831['outboundReCallsDay']=_0x4c283d['outboundReCallsDay'];_0x65b831[_0x3c9c('0x3e')]=_0x4c283d['outboundRejectCallsDay'];_0x65b831['outboundUnknownCallsDay']=_0x4c283d[_0x3c9c('0x3f')];_0x65b831[_0x3c9c('0x40')]=_0x4c283d[_0x3c9c('0x40')];_0x65b831['predictiveIntervalAvgHoldtime']=_0x4c283d[_0x3c9c('0x41')];_0x65b831[_0x3c9c('0x42')]=_0x4c283d[_0x3c9c('0x42')];_0x65b831['predictiveIntervalDroppedCallsCallersExit']=_0x4c283d['predictiveIntervalDroppedCallsCallersExit'];_0x65b831['predictiveIntervalDroppedCallsTimeout']=_0x4c283d[_0x3c9c('0x43')];_0x65b831[_0x3c9c('0x44')]=_0x4c283d[_0x3c9c('0x44')];_0x65b831[_0x3c9c('0x45')]=_0x4c283d[_0x3c9c('0x45')];_0x65b831[_0x3c9c('0x46')]=_0x4c283d['predictiveIntervalHitRate'];_0x65b831['predictiveIntervalMultiplicativeFactor']=_0x4c283d[_0x3c9c('0x47')];_0x65b831[_0x3c9c('0x48')]=_0x4c283d[_0x3c9c('0x48')];_0x65b831['predictiveIntervalAvailable']=_0x4c283d[_0x3c9c('0x49')];_0x65b831[_0x3c9c('0x4a')]=_0x4c283d[_0x3c9c('0x4a')];_0x65b831['message']=_0x4c283d['message'];_0x65b831[_0x3c9c('0x4b')]=_0x4c283d[_0x3c9c('0x4b')];_0x65b831[_0x3c9c('0x4c')]=_0x4c283d['erlangCalls'];_0x65b831[_0x3c9c('0x4d')]=_0x4c283d[_0x3c9c('0x4d')];_0x65b831[_0x3c9c('0x4e')]=_0x4c283d[_0x3c9c('0x4e')];_0x65b831['erlangBusyFactor']=_0x4c283d[_0x3c9c('0x4f')];_0x65b831[_0x3c9c('0x50')]=_0x4c283d['startPredictive'];_0x65b831['startProgressive']=_0x4c283d[_0x3c9c('0x51')];}if(_0x4c283d[_0x3c9c('0x52')]){_0x65b831['Trunk']={'id':_0x4c283d[_0x3c9c('0x52')]['id'],'name':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0xa')],'active':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0x53')],'callerid':_0x4c283d[_0x3c9c('0x52')]['callerid']};}if(_0x4c283d[_0x3c9c('0x54')]){_0x65b831[_0x3c9c('0x54')]={'id':_0x4c283d[_0x3c9c('0x54')]['id'],'name':_0x4c283d[_0x3c9c('0x54')][_0x3c9c('0xa')]};}_0x527bb9['push'](_0x65b831);}}_0xe04fca({'count':_0x527bb9['length'],'rows':_0x527bb9});});},'UpdateVoiceQueue':function(_0x55a6ba){return new Promise(function(_0x3ff47a,_0x1da3e7){var _0x25285d=_[_0x3c9c('0x55')](_0x143bfe['voiceQueues'],{'id':parseInt(_0x55a6ba['id'])});var _0x798651=_[_0x3c9c('0x56')](_0x55a6ba,['id']);if(_0x25285d){for(var _0x27a013 in _0x798651){if(typeof _0x798651[_0x27a013]!==_0x3c9c('0x57')&&typeof _0x25285d[_0x27a013]!==_0x3c9c('0x57')){_0x25285d[_0x27a013]=_0x798651[_0x27a013];}}_0x3ff47a(_0x25285d);}else{_0x1da3e7();}});},'VoiceChannels':function(_0x58f6b7){return new Promise(function(_0x184c22,_0x1177b3){var _0x1804e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x59')]);_0x184c22({'count':_0x1804e3[_0x3c9c('0x5a')],'rows':_0x1804e3});});},'VoiceChannelMixMonitor':function(_0x475fd6){var _0x5a74ce=this;return new Promise(function(_0x260d3b,_0x3a59f9){if(ami[_0x3c9c('0x5b')]()==![]){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}var _0x2b0691=schema(properties[_0x3c9c('0x5c')])[_0x3c9c('0x5d')](_0x475fd6);if(_0x2b0691[_0x3c9c('0x5a')]>0x0){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x2b0691,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x39b9d8=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x475fd6[_0x3c9c('0x5f')]});if(_0x39b9d8&&_0x39b9d8[_0x3c9c('0x60')]){var _0x2b022f=util['format']('%s.%s',_0x475fd6['filename']||_0x475fd6[_0x3c9c('0x5f')],_0x475fd6[_0x3c9c('0x7')]||_0x3c9c('0x61'));return ami[_0x3c9c('0x1c')]({'action':'MixMonitor','channel':_0x39b9d8[_0x3c9c('0x60')],'file':_0x2b022f,'options':'ai(mixmonitorid)'})['then'](function(_0x34cd84){var _0x2849c6=_[_0x3c9c('0x55')](_0x39b9d8[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x2b022f[_0x3c9c('0x64')]()});if(_[_0x3c9c('0x65')](_0x2849c6)){_0x39b9d8[_0x3c9c('0x62')][_0x3c9c('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2b022f[_0x3c9c('0x64')](),'createdAt':moment()[_0x3c9c('0x7')](_0x3c9c('0x67')),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')],'status':_0x3c9c('0x69')});}else{_0x2849c6[_0x3c9c('0x68')]=_0x34cd84[_0x3c9c('0x68')];_0x2849c6['status']='rec';}_0x260d3b({'code':0xc8,'message':[_0x475fd6[_0x3c9c('0x5f')],_0x3c9c('0x6a'),_0x34cd84[_0x3c9c('0x68')]][_0x3c9c('0x12')]('\x20'),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')]});})[_0x3c9c('0x17')](function(_0x287ca1){_0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,[_0x475fd6[_0x3c9c('0x5f')],_0x287ca1[_0x3c9c('0x16')][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x581523){var _0x423891=this;return new Promise(function(_0x4306fe,_0x1b6f0a){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x1d810d=schema(properties[_0x3c9c('0x5c')])['validate'](_0x581523);if(_0x1d810d[_0x3c9c('0x5a')]>0x0){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x1d810d,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x2264b7=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x581523[_0x3c9c('0x5f')]});if(_0x2264b7){return BPromise[_0x3c9c('0x6c')]()[_0x3c9c('0x15')](function(){if(_0x2264b7['channel']){return ami[_0x3c9c('0x1c')]({'action':'StopMixMonitor','channel':_0x2264b7['channel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x1a1485){});}})[_0x3c9c('0x15')](function(){if(_0x2264b7[_0x3c9c('0x6d')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x6e'),'channel':_0x2264b7['destinationchannel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x31fb57){});}})[_0x3c9c('0x15')](function(_0x1cfaea){var _0x4fb887=_['find'](_0x2264b7[_0x3c9c('0x62')],{'mixmonitorid':_0x581523[_0x3c9c('0x68')]});if(_0x4fb887){_0x4fb887[_0x3c9c('0x6f')]=_0x3c9c('0x70');}})[_0x3c9c('0x15')](function(){var _0x990934=util[_0x3c9c('0x7')](_0x3c9c('0x71'),_0x581523[_0x3c9c('0x72')]||_0x581523[_0x3c9c('0x5f')],_0x581523[_0x3c9c('0x7')]||_0x3c9c('0x61'));var _0x4311c0=_[_0x3c9c('0x55')](_0x2264b7[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x990934[_0x3c9c('0x64')]()});if(_0x4311c0){_0x4311c0['status']=_0x3c9c('0x70');}})['then'](function(){_0x4306fe({'code':0xc8,'message':[_0x581523['uniqueid'],_0x3c9c('0x73')][_0x3c9c('0x12')]('\x20')});})[_0x3c9c('0x17')](function(_0x4b1b16){_0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f5,[_0x581523[_0x3c9c('0x5f')],_0x4b1b16['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x1b6f0a(_0x423891['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e4146){return new Promise(function(_0x1e93d7,_0x2fc65b){var _0xbc5b78=_[_0x3c9c('0x58')](_0x143bfe['queueChannels']);_0x1e93d7({'count':_0xbc5b78['length'],'rows':_0xbc5b78});});},'VoiceQueuesChannel':function(_0x2f2628){var _0x2dc609=this;return new Promise(function(_0x260a90,_0x94bc44){var _0x4342a9=schema(properties[_0x3c9c('0x74')])[_0x3c9c('0x5d')](_0x2f2628);if(_0x4342a9[_0x3c9c('0x5a')]>0x0){return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f4,_['map'](_0x4342a9,'message')[_0x3c9c('0x12')](',\x20')));}var _0x5cf82a=_['find'](_0x143bfe['queueChannels'],{'uniqueid':_0x2f2628[_0x3c9c('0x5f')]});if(_0x5cf82a){_0x260a90(_0x5cf82a);}else{return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x56effa){var _0x53ccaf=this;return new Promise(function(_0x482612,_0x77afb5){if(ami['isConnected']()==![]){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x5ca292=schema(properties[_0x3c9c('0x75')])[_0x3c9c('0x5d')](_0x56effa);if(_0x5ca292[_0x3c9c('0x5a')]>0x0){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,_['map'](_0x5ca292,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x5c1a13=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x76')],{'uniqueid':_0x56effa['uniqueid']});if(_0x5c1a13&&_0x5c1a13[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':'Hangup','channel':_0x5c1a13[_0x3c9c('0x60')]})[_0x3c9c('0x15')](function(_0xab562a){_0x482612({'code':0xc8,'message':[_0x56effa['uniqueid'],_0xab562a['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')});})['catch'](function(_0x386197){_0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f5,[_0x56effa[_0x3c9c('0x5f')],_0x386197['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x77afb5(_0x53ccaf['error'](0x1f5,_0x3c9c('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x2cb21d){var _0xc4b7c9=this;return new Promise(function(_0x3caddb,_0x1ecabd){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x150a27=schema(properties['voicequeuechannelredirect'])[_0x3c9c('0x5d')](_0x2cb21d);if(_0x150a27[_0x3c9c('0x5a')]>0x0){return _0x1ecabd(_0xc4b7c9['error'](0x1f4,_[_0x3c9c('0x5e')](_0x150a27,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x17d23e=_[_0x3c9c('0x55')](_0x143bfe['queueChannels'],{'uniqueid':_0x2cb21d[_0x3c9c('0x5f')]});if(_0x17d23e&&_0x17d23e[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x77'),'channel':_0x17d23e[_0x3c9c('0x60')],'exten':_0x2cb21d[_0x3c9c('0x78')],'context':_0x2cb21d[_0x3c9c('0x79')]||_0x17d23e[_0x3c9c('0x79')],'priority':0x1})[_0x3c9c('0x15')](function(_0x36018f){_0x3caddb({'code':0xc8,'message':[_0x2cb21d[_0x3c9c('0x5f')],_0x36018f[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')});})[_0x3c9c('0x17')](function(_0x296e46){_0x1ecabd(_0xc4b7c9['error'](0x1f5,[_0x2cb21d[_0x3c9c('0x5f')],_0x296e46[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')));});}else{return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'Agents':function(_0x21c7c3){return new Promise(function(_0x285ebc,_0x478572){var _0x773eea=_['values'](_0x143bfe[_0x3c9c('0xc')]);_0x285ebc({'count':_0x773eea['length'],'rows':_0x773eea});});},'Telephones':function(_0x2265e8){return new Promise(function(_0x48a57f,_0x4950c3){var _0x263270=_['values'](_0x143bfe['telephones']);_0x48a57f({'count':_0x263270[_0x3c9c('0x5a')],'rows':_0x263270});});},'Trunks':function(_0x2f3a98){return new Promise(function(_0x14ccbc,_0x9b3118){var _0x2f4e79=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x7a')]);_0x14ccbc({'count':_0x2f4e79[_0x3c9c('0x5a')],'rows':_0x2f4e79});});},'OutboundChannels':function(_0x2e6b96){return new Promise(function(_0x13e236,_0x1528a6){var _0x570ae6=_['values'](_0x143bfe[_0x3c9c('0x7b')]);_0x13e236({'count':_0x570ae6['length'],'rows':_0x570ae6});});},'Outbound':function(_0x552ec1){return new Promise(function(_0x3bb0c1,_0x1838d7){_0x3bb0c1(_0x143bfe[_0x3c9c('0x2b')]);});},'Campaigns':function(_0x1748c7){return new Promise(function(_0x2dec50,_0x57746d){var _0x105e67=_[_0x3c9c('0x58')](_0x143bfe['campaigns']);_0x2dec50({'count':_0x105e67['length'],'rows':_0x105e67});});},'VoiceQueuesPreview':function(_0x308a24){var _0x5f42c1=this;return new Promise(function(_0x2e3cab,_0x1ceaa3){_0x512e80[_0x3c9c('0x7c')](_0x308a24['id'])[_0x3c9c('0x15')](function(_0x327e63){_0x2e3cab({'code':0xc8,'message':_0x327e63[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x18012e){_0x1ceaa3(_0x5f42c1[_0x3c9c('0x18')](0x1f4,_0x18012e[_0x3c9c('0x16')]));});});},'EventManager':function(_0x52af3a){var _0x32690f=this;return new Promise(function(_0x2f5738,_0xf6f1ea){if(!_0x52af3a[_0x3c9c('0x7d')]){return _0xf6f1ea(_0x32690f['error'](0x1f4,_0x3c9c('0x7e')));}ami['emit'](_0x3c9c('0x7f')+_0x52af3a[_0x3c9c('0x7d')],_0x52af3a['message']);_0x2f5738({'code':0xc8,'message':_0x52af3a});});},'FaxAccounts':function(_0x22d2bd){return new Promise(function(_0x4cd7b9,_0x49559f){var _0x3d34e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x80')]);_0x4cd7b9({'count':_0x3d34e3[_0x3c9c('0x5a')],'rows':_0x3d34e3});});},'SendFax':function(_0x17e5ce){var _0x5c96ad=this;return new Promise(function(_0x3e2f73,_0x48c11d){_0x48b219[_0x3c9c('0x81')](_0x17e5ce)['then'](function(_0x12bb7b){_0x3e2f73({'code':0xc8,'message':_0x12bb7b[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x19db8a){_0x48c11d(_0x5c96ad[_0x3c9c('0x18')](0x1f4,_0x19db8a[_0x3c9c('0x16')]));});});},'CheckAfterSend':function(_0x1fe080){var _0x41c07b=this;return new Promise(function(_0x557dc6,_0xa1de30){_0x48b219[_0x3c9c('0x82')](_0x1fe080)[_0x3c9c('0x15')](function(_0x5614df){_0x557dc6({'code':0xc8,'message':_0x5614df[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x37d2b6){_0xa1de30(_0x41c07b[_0x3c9c('0x18')](0x1f4,_0x37d2b6[_0x3c9c('0x16')]));});});}};var _0xdfe4f7=jayson['server'](_0x3ca0ce)[_0x3c9c('0x83')]();_0xdfe4f7['on'](_0x3c9c('0x18'),function(_0x2e158c){return _0x5a2836(_0x2e158c);});_0xdfe4f7[_0x3c9c('0x6')](0x232a,'127.0.0.1',function(){console[_0x3c9c('0x84')](_0x3c9c('0x85'),0x232a);return _0x5c86bd(_0x3c9c('0x86')+0x232a);});});}; \ No newline at end of file +var _0xbff5=['/var/spool/asterisk/monitor/','isNil','monitors','push','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','status','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','%s/%s','name','timers','agents','pause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','Reload','Action','then','message','catch','error','join','command','Command','content','voiceQueues','hasOwnProperty','answered','available','pTalking','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','length','omit','undefined','values','voicechannel','map','find','channels','uniqueid','channel','%s.%s','filename','format','wav','MixMonitor','ai(mixmonitorid)'];(function(_0x2176de,_0x405d5f){var _0x15dbd7=function(_0x593091){while(--_0x593091){_0x2176de['push'](_0x2176de['shift']());}};_0x15dbd7(++_0x405d5f);}(_0xbff5,0x1bc));var _0x5bff=function(_0x18608b,_0x3586f9){_0x18608b=_0x18608b-0x0;var _0x112372=_0xbff5[_0x18608b];return _0x112372;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var jayson=require(_0x5bff('0x2'));var schema=require(_0x5bff('0x3'));var BPromise=require(_0x5bff('0x4'));var moment=require(_0x5bff('0x5'));var config=require(_0x5bff('0x6'));var properties=require('../properties');var ami=require(_0x5bff('0x7'));exports['listen']=function(_0x4c567d,_0x16ed7b,_0x1d8650){return new BPromise(function(_0x151add,_0xa54c57){var _0x43605a={'QueuePause':function(_0xd4b9dc){return new Promise(function(_0x1acb49,_0x139c99){var _0x3eb6f9=util['format'](_0x5bff('0x8'),'SIP',_0xd4b9dc[_0x5bff('0x9')]);if(_0x4c567d[_0x5bff('0xa')]&&_0x4c567d['timers'][_0x3eb6f9]&&_0x4c567d[_0x5bff('0xa')][_0x3eb6f9]['timer']){_0x4c567d[_0x5bff('0xa')][_0x3eb6f9]['updateAcw']();}if(_0x4c567d[_0x5bff('0xb')][_0x3eb6f9]){_0x4c567d[_0x5bff('0xb')][_0x3eb6f9]['updateStatusRealtime']({'statePause':_0xd4b9dc[_0x5bff('0xc')]?!![]:![]});}_0x1acb49({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x335e78){var _0x635926=this;return new Promise(function(_0x548128,_0xa0dced){if(ami[_0x5bff('0xd')]()==![]){return _0xa0dced(_0x635926['error'](0x1f4,[config['asterisk']['ip'],config[_0x5bff('0xe')][_0x5bff('0xf')],_0x5bff('0x10')]['join']('\x20')));}_0x335e78=_[_0x5bff('0x11')](_0x335e78,_[_0x5bff('0x12')](properties[_0x5bff('0x13')]));_0x335e78['action']=_0x5bff('0x14');return ami[_0x5bff('0x15')](_0x335e78)[_0x5bff('0x16')](function(_0x546351){_0x548128({'code':0xc8,'message':_0x546351[_0x5bff('0x17')]});})[_0x5bff('0x18')](function(_0x36653b){_0xa0dced(_0x635926[_0x5bff('0x19')](0x1f5,_0x36653b['message']));});});},'Command':function(_0x3065c1){var _0x5357d4=this;return new Promise(function(_0x878040,_0x4d0111){if(ami[_0x5bff('0xd')]()==![]){return _0x4d0111(_0x5357d4[_0x5bff('0x19')](0x1f4,[config[_0x5bff('0xe')]['ip'],config[_0x5bff('0xe')][_0x5bff('0xf')],_0x5bff('0x10')][_0x5bff('0x1a')]('\x20')));}_0x3065c1=_[_0x5bff('0x11')](_0x3065c1,_0x5bff('0x1b'));_0x3065c1['action']=_0x5bff('0x1c');return ami[_0x5bff('0x15')](_0x3065c1)[_0x5bff('0x16')](function(_0x1e7f8a){_0x878040({'code':0xc8,'message':_0x1e7f8a[_0x5bff('0x1d')]});})[_0x5bff('0x18')](function(_0x3913fd){_0x4d0111(_0x5357d4[_0x5bff('0x19')](0x1f5,_0x3913fd['message']));});});},'VoiceQueues':function(_0x5741d9){return new Promise(function(_0x9a69de,_0x53bd97){var _0x220c8f=[];for(var _0xcc091d in _0x4c567d[_0x5bff('0x1e')]){if(_0x4c567d[_0x5bff('0x1e')][_0x5bff('0x1f')](_0xcc091d)){var _0x1140eb=_0x4c567d[_0x5bff('0x1e')][_0xcc091d];var _0xedba9d={'id':_0x1140eb['id'],'name':_0x1140eb['name'],'strategy':_0x1140eb['strategy'],'answered':_0x1140eb[_0x5bff('0x20')],'available':_0x1140eb[_0x5bff('0x21')],'loggedIn':_0x1140eb['loggedIn'],'pTalking':_0x1140eb[_0x5bff('0x22')],'sumBillable':_0x1140eb['sumBillable'],'sumDuration':_0x1140eb['sumDuration'],'sumHoldTime':_0x1140eb[_0x5bff('0x23')]||0x0,'talking':_0x1140eb['talking'],'total':_0x1140eb[_0x5bff('0x24')],'type':_0x1140eb[_0x5bff('0x25')],'unmanaged':_0x1140eb[_0x5bff('0x26')],'abandoned':_0x1140eb[_0x5bff('0x27')],'waiting':_0x1140eb['waiting'],'loggedInDb':_0x1140eb[_0x5bff('0x28')]};if(_0x1140eb['type']===_0x5bff('0x29')){_0xedba9d['dialActive']=_0x1140eb[_0x5bff('0x2a')];_0xedba9d[_0x5bff('0x2b')]=_0x1140eb[_0x5bff('0x2b')];_0xedba9d[_0x5bff('0x2c')]=_0x1140eb[_0x5bff('0x2c')];_0xedba9d[_0x5bff('0x2d')]=_0x1140eb['dialOriginateCallerIdNumber'];_0xedba9d[_0x5bff('0x2e')]=_0x1140eb[_0x5bff('0x2e')];_0xedba9d[_0x5bff('0x2f')]=_0x1140eb[_0x5bff('0x2f')];_0xedba9d[_0x5bff('0x30')]=_0x1140eb[_0x5bff('0x30')];_0xedba9d[_0x5bff('0x31')]=_0x1140eb[_0x5bff('0x31')];_0xedba9d['outboundAnswerCallsDay']=_0x1140eb[_0x5bff('0x32')];_0xedba9d[_0x5bff('0x33')]=_0x1140eb[_0x5bff('0x33')];_0xedba9d[_0x5bff('0x34')]=_0x1140eb['outboundBusyCallsDay'];_0xedba9d[_0x5bff('0x35')]=_0x1140eb[_0x5bff('0x35')];_0xedba9d['outboundDropCallsDayACS']=_0x1140eb[_0x5bff('0x36')];_0xedba9d[_0x5bff('0x37')]=_0x1140eb[_0x5bff('0x37')];_0xedba9d[_0x5bff('0x38')]=_0x1140eb['outboundDropCallsDayTimeout'];_0xedba9d[_0x5bff('0x39')]=_0x1140eb[_0x5bff('0x39')];_0xedba9d[_0x5bff('0x3a')]=_0x1140eb['outboundNoSuchCallsDay'];_0xedba9d[_0x5bff('0x3b')]=_0x1140eb['outboundOriginateFailureCallsDay'];_0xedba9d[_0x5bff('0x3c')]=_0x1140eb[_0x5bff('0x3c')];_0xedba9d[_0x5bff('0x3d')]=_0x1140eb['outboundRejectCallsDay'];_0xedba9d[_0x5bff('0x3e')]=_0x1140eb[_0x5bff('0x3e')];_0xedba9d[_0x5bff('0x3f')]=_0x1140eb['predictiveIntervalAnsweredCalls'];_0xedba9d[_0x5bff('0x40')]=_0x1140eb[_0x5bff('0x40')];_0xedba9d['predictiveIntervalAvgTalktime']=_0x1140eb[_0x5bff('0x41')];_0xedba9d[_0x5bff('0x42')]=_0x1140eb[_0x5bff('0x42')];_0xedba9d[_0x5bff('0x43')]=_0x1140eb[_0x5bff('0x43')];_0xedba9d['predictiveIntervalErlangCalls']=_0x1140eb[_0x5bff('0x44')];_0xedba9d['predictiveIntervalErlangCallsDroppedCalls']=_0x1140eb[_0x5bff('0x45')];_0xedba9d[_0x5bff('0x46')]=_0x1140eb[_0x5bff('0x46')];_0xedba9d[_0x5bff('0x47')]=_0x1140eb[_0x5bff('0x47')];_0xedba9d[_0x5bff('0x48')]=_0x1140eb[_0x5bff('0x48')];_0xedba9d['predictiveIntervalAvailable']=_0x1140eb['predictiveIntervalAvailable'];_0xedba9d[_0x5bff('0x49')]=_0x1140eb[_0x5bff('0x49')];_0xedba9d[_0x5bff('0x17')]=_0x1140eb[_0x5bff('0x17')];_0xedba9d[_0x5bff('0x4a')]=_0x1140eb[_0x5bff('0x4a')];_0xedba9d[_0x5bff('0x4b')]=_0x1140eb[_0x5bff('0x4b')];_0xedba9d['erlangCallToSecond']=_0x1140eb[_0x5bff('0x4c')];_0xedba9d['erlangAbandonmentRate']=_0x1140eb[_0x5bff('0x4d')];_0xedba9d[_0x5bff('0x4e')]=_0x1140eb['erlangBusyFactor'];_0xedba9d[_0x5bff('0x4f')]=_0x1140eb[_0x5bff('0x4f')];_0xedba9d['startProgressive']=_0x1140eb[_0x5bff('0x50')];}if(_0x1140eb[_0x5bff('0x51')]){_0xedba9d[_0x5bff('0x51')]={'id':_0x1140eb['Trunk']['id'],'name':_0x1140eb[_0x5bff('0x51')][_0x5bff('0x9')],'active':_0x1140eb[_0x5bff('0x51')]['active'],'callerid':_0x1140eb[_0x5bff('0x51')][_0x5bff('0x52')]};}if(_0x1140eb[_0x5bff('0x53')]){_0xedba9d[_0x5bff('0x53')]={'id':_0x1140eb['Interval']['id'],'name':_0x1140eb[_0x5bff('0x53')]['name']};}_0x220c8f['push'](_0xedba9d);}}_0x9a69de({'count':_0x220c8f[_0x5bff('0x54')],'rows':_0x220c8f});});},'UpdateVoiceQueue':function(_0x95cf00){return new Promise(function(_0x564bc5,_0x2132bf){var _0xbebf66=_['find'](_0x4c567d[_0x5bff('0x1e')],{'id':parseInt(_0x95cf00['id'])});var _0x3e56c3=_[_0x5bff('0x55')](_0x95cf00,['id']);if(_0xbebf66){for(var _0x39c90f in _0x3e56c3){if(typeof _0x3e56c3[_0x39c90f]!=='undefined'&&typeof _0xbebf66[_0x39c90f]!==_0x5bff('0x56')){_0xbebf66[_0x39c90f]=_0x3e56c3[_0x39c90f];}}_0x564bc5(_0xbebf66);}else{_0x2132bf();}});},'VoiceChannels':function(_0x22f0b6){return new Promise(function(_0x44a34a,_0x738700){var _0x1e94c5=_[_0x5bff('0x57')](_0x4c567d['channels']);_0x44a34a({'count':_0x1e94c5[_0x5bff('0x54')],'rows':_0x1e94c5});});},'VoiceChannelMixMonitor':function(_0x14f4d4){var _0x5d5b1f=this;return new Promise(function(_0x2487f6,_0x5c59c0){if(ami['isConnected']()==![]){return _0x5c59c0(_0x5d5b1f['error'](0x1f4,[config[_0x5bff('0xe')]['ip'],config[_0x5bff('0xe')]['username'],_0x5bff('0x10')][_0x5bff('0x1a')]('\x20')));}var _0x3360d8=schema(properties[_0x5bff('0x58')])[_0x5bff('0x3')](_0x14f4d4);if(_0x3360d8['length']>0x0){return _0x5c59c0(_0x5d5b1f[_0x5bff('0x19')](0x1f4,_[_0x5bff('0x59')](_0x3360d8,'message')[_0x5bff('0x1a')](',\x20')));}var _0x48feaa=_[_0x5bff('0x5a')](_0x4c567d[_0x5bff('0x5b')],{'uniqueid':_0x14f4d4[_0x5bff('0x5c')]});if(_0x48feaa&&_0x48feaa[_0x5bff('0x5d')]){var _0x29f7dc=util['format'](_0x5bff('0x5e'),_0x14f4d4[_0x5bff('0x5f')]||_0x14f4d4['uniqueid'],_0x14f4d4[_0x5bff('0x60')]||_0x5bff('0x61'));return ami['Action']({'action':_0x5bff('0x62'),'channel':_0x48feaa[_0x5bff('0x5d')],'file':_0x29f7dc,'options':_0x5bff('0x63')})[_0x5bff('0x16')](function(_0x24ad0f){var _0x1be6eb=_['find'](_0x48feaa['monitors'],{'filename':_0x5bff('0x64')+_0x29f7dc['toLowerCase']()});if(_[_0x5bff('0x65')](_0x1be6eb)){_0x48feaa[_0x5bff('0x66')][_0x5bff('0x67')]({'filename':_0x5bff('0x64')+_0x29f7dc[_0x5bff('0x68')](),'createdAt':moment()[_0x5bff('0x60')](_0x5bff('0x69')),'mixmonitorid':_0x24ad0f[_0x5bff('0x6a')],'status':_0x5bff('0x6b')});}else{_0x1be6eb[_0x5bff('0x6a')]=_0x24ad0f[_0x5bff('0x6a')];_0x1be6eb['status']='rec';}_0x2487f6({'code':0xc8,'message':[_0x14f4d4[_0x5bff('0x5c')],'MixMonitor\x20Success',_0x24ad0f[_0x5bff('0x6a')]]['join']('\x20'),'mixmonitorid':_0x24ad0f[_0x5bff('0x6a')]});})[_0x5bff('0x18')](function(_0xb20434){_0x5c59c0(_0x5d5b1f[_0x5bff('0x19')](0x1f5,[_0x14f4d4[_0x5bff('0x5c')],_0xb20434[_0x5bff('0x17')][_0x5bff('0x68')]()][_0x5bff('0x1a')]('\x20')));});}else{return _0x5c59c0(_0x5d5b1f[_0x5bff('0x19')](0x1f5,_0x5bff('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x1470bc){var _0x57053a=this;return new Promise(function(_0x142854,_0x56eff2){if(ami['isConnected']()==![]){return _0x56eff2(_0x57053a['error'](0x1f4,[config[_0x5bff('0xe')]['ip'],config['asterisk'][_0x5bff('0xf')],_0x5bff('0x10')][_0x5bff('0x1a')]('\x20')));}var _0x3192cb=schema(properties['voicechannel'])['validate'](_0x1470bc);if(_0x3192cb['length']>0x0){return _0x56eff2(_0x57053a[_0x5bff('0x19')](0x1f4,_[_0x5bff('0x59')](_0x3192cb,'message')[_0x5bff('0x1a')](',\x20')));}var _0x3bb787=_[_0x5bff('0x5a')](_0x4c567d[_0x5bff('0x5b')],{'uniqueid':_0x1470bc[_0x5bff('0x5c')]});if(_0x3bb787){return BPromise[_0x5bff('0x6d')]()[_0x5bff('0x16')](function(){if(_0x3bb787[_0x5bff('0x5d')]){return ami[_0x5bff('0x15')]({'action':_0x5bff('0x6e'),'channel':_0x3bb787[_0x5bff('0x5d')],'mixmonitorid':_0x1470bc[_0x5bff('0x6a')]})[_0x5bff('0x18')](function(_0x33464a){});}})['then'](function(){if(_0x3bb787[_0x5bff('0x6f')]){return ami[_0x5bff('0x15')]({'action':_0x5bff('0x6e'),'channel':_0x3bb787[_0x5bff('0x6f')],'mixmonitorid':_0x1470bc[_0x5bff('0x6a')]})[_0x5bff('0x18')](function(_0x24916c){});}})[_0x5bff('0x16')](function(_0x2522bd){var _0x257410=_[_0x5bff('0x5a')](_0x3bb787[_0x5bff('0x66')],{'mixmonitorid':_0x1470bc[_0x5bff('0x6a')]});if(_0x257410){_0x257410['status']=_0x5bff('0x70');}})[_0x5bff('0x16')](function(){var _0x24df6b=util[_0x5bff('0x60')](_0x5bff('0x5e'),_0x1470bc['filename']||_0x1470bc[_0x5bff('0x5c')],_0x1470bc[_0x5bff('0x60')]||'wav');var _0x1b35ae=_[_0x5bff('0x5a')](_0x3bb787[_0x5bff('0x66')],{'filename':'/var/spool/asterisk/monitor/'+_0x24df6b[_0x5bff('0x68')]()});if(_0x1b35ae){_0x1b35ae[_0x5bff('0x71')]=_0x5bff('0x70');}})[_0x5bff('0x16')](function(){_0x142854({'code':0xc8,'message':[_0x1470bc[_0x5bff('0x5c')],_0x5bff('0x72')][_0x5bff('0x1a')]('\x20')});})[_0x5bff('0x18')](function(_0x23f021){_0x56eff2(_0x57053a[_0x5bff('0x19')](0x1f5,[_0x1470bc[_0x5bff('0x5c')],_0x23f021[_0x5bff('0x17')]['toLowerCase']()]['join']('\x20')));});}else{return _0x56eff2(_0x57053a[_0x5bff('0x19')](0x1f5,_0x5bff('0x6c')));}});},'VoiceQueuesChannels':function(_0x1bed0d){return new Promise(function(_0x597eea,_0x26899a){var _0x5cc8ce=_['values'](_0x4c567d[_0x5bff('0x73')]);_0x597eea({'count':_0x5cc8ce['length'],'rows':_0x5cc8ce});});},'VoiceQueuesChannel':function(_0x536fee){var _0x12bb42=this;return new Promise(function(_0x227723,_0x4d6cc5){var _0x29ed8d=schema(properties[_0x5bff('0x74')])[_0x5bff('0x3')](_0x536fee);if(_0x29ed8d[_0x5bff('0x54')]>0x0){return _0x4d6cc5(_0x12bb42[_0x5bff('0x19')](0x1f4,_[_0x5bff('0x59')](_0x29ed8d,_0x5bff('0x17'))[_0x5bff('0x1a')](',\x20')));}var _0x1c3fbf=_[_0x5bff('0x5a')](_0x4c567d[_0x5bff('0x73')],{'uniqueid':_0x536fee[_0x5bff('0x5c')]});if(_0x1c3fbf){_0x227723(_0x1c3fbf);}else{return _0x4d6cc5(_0x12bb42[_0x5bff('0x19')](0x1f5,_0x5bff('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x16d5d4){var _0x8851=this;return new Promise(function(_0x39bc4e,_0x1df78d){if(ami[_0x5bff('0xd')]()==![]){return _0x1df78d(_0x8851[_0x5bff('0x19')](0x1f4,[config[_0x5bff('0xe')]['ip'],config['asterisk'][_0x5bff('0xf')],_0x5bff('0x10')]['join']('\x20')));}var _0x29d02a=schema(properties['voicequeuechannelhangup'])[_0x5bff('0x3')](_0x16d5d4);if(_0x29d02a[_0x5bff('0x54')]>0x0){return _0x1df78d(_0x8851['error'](0x1f4,_[_0x5bff('0x59')](_0x29d02a,_0x5bff('0x17'))[_0x5bff('0x1a')](',\x20')));}var _0x341d5a=_[_0x5bff('0x5a')](_0x4c567d[_0x5bff('0x73')],{'uniqueid':_0x16d5d4[_0x5bff('0x5c')]});if(_0x341d5a&&_0x341d5a[_0x5bff('0x5d')]){return ami[_0x5bff('0x15')]({'action':_0x5bff('0x75'),'channel':_0x341d5a[_0x5bff('0x5d')]})['then'](function(_0x20bc69){_0x39bc4e({'code':0xc8,'message':[_0x16d5d4[_0x5bff('0x5c')],_0x20bc69['message'][_0x5bff('0x68')]()][_0x5bff('0x1a')]('\x20')});})[_0x5bff('0x18')](function(_0x49d3db){_0x1df78d(_0x8851[_0x5bff('0x19')](0x1f5,[_0x16d5d4[_0x5bff('0x5c')],_0x49d3db[_0x5bff('0x17')][_0x5bff('0x68')]()]['join']('\x20')));});}else{return _0x1df78d(_0x8851['error'](0x1f5,_0x5bff('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x59e996){var _0xd9f5e5=this;return new Promise(function(_0x40bd5d,_0x3834c8){if(ami['isConnected']()==![]){return _0x3834c8(_0xd9f5e5[_0x5bff('0x19')](0x1f4,[config[_0x5bff('0xe')]['ip'],config[_0x5bff('0xe')][_0x5bff('0xf')],_0x5bff('0x10')][_0x5bff('0x1a')]('\x20')));}var _0x4b40c5=schema(properties[_0x5bff('0x76')])[_0x5bff('0x3')](_0x59e996);if(_0x4b40c5[_0x5bff('0x54')]>0x0){return _0x3834c8(_0xd9f5e5[_0x5bff('0x19')](0x1f4,_['map'](_0x4b40c5,_0x5bff('0x17'))['join'](',\x20')));}var _0x14f5c0=_[_0x5bff('0x5a')](_0x4c567d[_0x5bff('0x73')],{'uniqueid':_0x59e996[_0x5bff('0x5c')]});if(_0x14f5c0&&_0x14f5c0[_0x5bff('0x5d')]){return ami[_0x5bff('0x15')]({'action':_0x5bff('0x77'),'channel':_0x14f5c0['channel'],'exten':_0x59e996[_0x5bff('0x78')],'context':_0x59e996['context']||_0x14f5c0['context'],'priority':0x1})[_0x5bff('0x16')](function(_0x377bc7){_0x40bd5d({'code':0xc8,'message':[_0x59e996['uniqueid'],_0x377bc7['message'][_0x5bff('0x68')]()][_0x5bff('0x1a')]('\x20')});})[_0x5bff('0x18')](function(_0xe95398){_0x3834c8(_0xd9f5e5['error'](0x1f5,[_0x59e996[_0x5bff('0x5c')],_0xe95398['message'][_0x5bff('0x68')]()][_0x5bff('0x1a')]('\x20')));});}else{return _0x3834c8(_0xd9f5e5[_0x5bff('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2e8cb2){return new Promise(function(_0x5a5e97,_0x382be1){var _0x406c7c=_[_0x5bff('0x57')](_0x4c567d['agents']);_0x5a5e97({'count':_0x406c7c['length'],'rows':_0x406c7c});});},'Telephones':function(_0x28aee9){return new Promise(function(_0x3b0bb1,_0x2b8ec5){var _0x2bfdbc=_[_0x5bff('0x57')](_0x4c567d[_0x5bff('0x79')]);_0x3b0bb1({'count':_0x2bfdbc[_0x5bff('0x54')],'rows':_0x2bfdbc});});},'Trunks':function(_0x315aba){return new Promise(function(_0x1b6a75,_0x59efd7){var _0x435076=_[_0x5bff('0x57')](_0x4c567d[_0x5bff('0x7a')]);_0x1b6a75({'count':_0x435076['length'],'rows':_0x435076});});},'OutboundChannels':function(_0x5877a0){return new Promise(function(_0x2bba31,_0xd30d2f){var _0x4b216f=_['values'](_0x4c567d[_0x5bff('0x7b')]);_0x2bba31({'count':_0x4b216f['length'],'rows':_0x4b216f});});},'Outbound':function(_0x391b56){return new Promise(function(_0xc0fcc2,_0x2efdb9){_0xc0fcc2(_0x4c567d[_0x5bff('0x29')]);});},'Campaigns':function(_0x5804f2){return new Promise(function(_0x7f29e1,_0x574d38){var _0x155bf3=_[_0x5bff('0x57')](_0x4c567d[_0x5bff('0x7c')]);_0x7f29e1({'count':_0x155bf3[_0x5bff('0x54')],'rows':_0x155bf3});});},'VoiceQueuesPreview':function(_0x63b716){var _0x551d39=this;return new Promise(function(_0x46d12e,_0x320109){_0x16ed7b['run'](_0x63b716['id'])[_0x5bff('0x16')](function(_0x494872){_0x46d12e({'code':0xc8,'message':_0x494872[_0x5bff('0x17')]});})[_0x5bff('0x18')](function(_0x2c6f32){_0x320109(_0x551d39['error'](0x1f4,_0x2c6f32[_0x5bff('0x17')]));});});},'EventManager':function(_0x3033de){var _0x3977d3=this;return new Promise(function(_0x223c6f,_0x701e08){if(!_0x3033de[_0x5bff('0x7d')]){return _0x701e08(_0x3977d3['error'](0x1f4,_0x5bff('0x7e')));}ami['emit'](_0x5bff('0x7f')+_0x3033de[_0x5bff('0x7d')],_0x3033de[_0x5bff('0x17')]);_0x223c6f({'code':0xc8,'message':_0x3033de});});},'FaxAccounts':function(_0x3b240f){return new Promise(function(_0x2efeb0,_0x70fdf2){var _0x331810=_[_0x5bff('0x57')](_0x4c567d[_0x5bff('0x80')]);_0x2efeb0({'count':_0x331810[_0x5bff('0x54')],'rows':_0x331810});});},'SendFax':function(_0x429263){var _0x995f09=this;return new Promise(function(_0x40de11,_0x4cfb5b){_0x1d8650['send'](_0x429263)[_0x5bff('0x16')](function(_0x2e45e4){_0x40de11({'code':0xc8,'message':_0x2e45e4[_0x5bff('0x17')]});})[_0x5bff('0x18')](function(_0x406b88){_0x4cfb5b(_0x995f09['error'](0x1f4,_0x406b88[_0x5bff('0x17')]));});});},'CheckAfterSend':function(_0x31eae5){var _0x1d5599=this;return new Promise(function(_0x5a6b0f,_0x2f1f80){_0x1d8650['checkAfterSend'](_0x31eae5)[_0x5bff('0x16')](function(_0x51c0a1){_0x5a6b0f({'code':0xc8,'message':_0x51c0a1[_0x5bff('0x17')]});})['catch'](function(_0xe39373){_0x2f1f80(_0x1d5599[_0x5bff('0x19')](0x1f4,_0xe39373[_0x5bff('0x17')]));});});}};var _0x560d5d=jayson[_0x5bff('0x81')](_0x43605a)[_0x5bff('0x82')]();_0x560d5d['on'](_0x5bff('0x19'),function(_0x3dbb53){return _0xa54c57(_0x3dbb53);});_0x560d5d[_0x5bff('0x83')](0x232a,_0x5bff('0x84'),function(){console[_0x5bff('0x85')](_0x5bff('0x86'),0x232a);return _0x151add(_0x5bff('0x87')+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 9211809..a754f6a 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 _0x7bae=['data5','xmd-contactid','ListId','data3','map','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','routeId','','calleridname','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridnum','format','user:%s','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil'];(function(_0x569f33,_0x29a859){var _0x37fa6e=function(_0x3b5c65){while(--_0x3b5c65){_0x569f33['push'](_0x569f33['shift']());}};_0x37fa6e(++_0x29a859);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x7bae[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xe7ba('0x0'));var util=require(_0xe7ba('0x1'));var config=require('../../../../config/environment');var logger=require(_0xe7ba('0x2'))('trigger');var cmContactRpc=require(_0xe7ba('0x3'));config[_0xe7ba('0x4')]=_[_0xe7ba('0x5')](config[_0xe7ba('0x4')],{'host':_0xe7ba('0x6'),'port':0x18eb});var io=require(_0xe7ba('0x7'))(new Redis(config[_0xe7ba('0x4')]));function emit(_0x3c5e59,_0x10b307,_0x34fb18,_0x160565,_0x27b1d5){logger[_0xe7ba('0x8')](_0xe7ba('0x9'),_0x3c5e59,_0x10b307['id'],_0x34fb18,_0x160565,JSON['stringify'](_0x27b1d5));io['to'](_0x34fb18)[_0xe7ba('0xa')](_0x160565,_0x27b1d5);}exports[_0xe7ba('0xb')]=function(_0x375ebb,_0x276bc3,_0x15083a,_0x1672f0){var _0x99a86f,_0x448bcc;var _0x194447={};var _0x4b6597=Number(_0x15083a[_0xe7ba('0xc')]);var _0x588c8b=_0x15083a[_0xe7ba('0xd')]?Boolean(Number(_0x15083a[_0xe7ba('0xd')])):![];var _0x390596;var _0x17e4e6=![];if(!_[_0xe7ba('0xe')](_0x15083a[_0xe7ba('0xf')])){if(_0x15083a['data5']=='1')_0x17e4e6=!![];}if(!_0x17e4e6){if(_0x1672f0['xmd-contactid']){_0x194447['id']=_0x1672f0[_0xe7ba('0x10')];}}if(!_0x194447['id']){_0x194447[_0xe7ba('0x11')]=_0x4b6597;_0x390596=_0x15083a[_0xe7ba('0x12')]&&_0x15083a['data3']!=='0'?_0x15083a[_0xe7ba('0x12')]['split'](','):['phone'];_0x194447['$or']=_[_0xe7ba('0x13')](_0x390596,function(_0x4e87f5){var _0x41a773={};_0x41a773[_0x4e87f5]=_0x1672f0['routeId']?_0x1672f0['destcalleridnum']:_0x1672f0['calleridnum'];return _0x41a773;});}var _0x3f326a=['id',_0xe7ba('0x14'),_0xe7ba('0x15'),_0xe7ba('0x16'),_0xe7ba('0x17'),'fax',_0xe7ba('0x11'),_0xe7ba('0x18'),_0xe7ba('0x19'),_0xe7ba('0x1a')];var _0x4aaf35=_[_0xe7ba('0x1b')](_0x3f326a,_0x390596);BPromise[_0xe7ba('0x1c')]()['then'](cmContactRpc[_0xe7ba('0x1d')]({'attributes':_0x4aaf35,'where':_0x194447}))[_0xe7ba('0x1e')](function(_0x27c882){_0x448bcc=_0x27c882;if(!_[_0xe7ba('0x1f')](_0x448bcc)){if(_0x448bcc[_0xe7ba('0x20')]===0x1){_0x99a86f=_0x448bcc[0x0];logger[_0xe7ba('0x8')](_0xe7ba('0x21'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id'],_0x99a86f['id']);}else{logger[_0xe7ba('0x8')](_0xe7ba('0x23'),_0x1672f0['uniqueid'],_0x276bc3['id'],_['map'](_0x448bcc,'id')['join'](','));}return;}else{logger['info'](_0xe7ba('0x24'),_0x1672f0['uniqueid'],_0x276bc3['id']);var _0x4ecc0d={'ListId':_0x4b6597};var _0x5ece11=_0x15083a[_0xe7ba('0x25')]&&_0x15083a[_0xe7ba('0x25')]!=='0'?_0x15083a[_0xe7ba('0x25')]:_0xe7ba('0x16');if(_0x588c8b){logger[_0xe7ba('0x8')](_0xe7ba('0x26'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id']);_0x4ecc0d[_0x5ece11]=_[_0xe7ba('0xe')](_0x1672f0['routeId'])?_0x1672f0[_0xe7ba('0x27')]:_0x1672f0['destcalleridnum'];if(_[_0xe7ba('0xe')](_0x1672f0[_0xe7ba('0x28')])){_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0['calleridname']&&_0x1672f0['calleridname']!==_0xe7ba('0x29')?_0x1672f0[_0xe7ba('0x2a')]:_0xe7ba('0x2b');}else{_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0[_0xe7ba('0x2c')]&&_0x1672f0['destcalleridname']!==_0xe7ba('0x29')?_0x1672f0[_0xe7ba('0x2c')]:'Unknown';}return BPromise[_0xe7ba('0x1c')]()['then'](cmContactRpc['createContact'](_0x4ecc0d))[_0xe7ba('0x1e')](function(_0x134f21){_0x99a86f=_0x134f21;_0x448bcc[_0xe7ba('0x2d')](_0x134f21);if(_0x99a86f){logger['info'](_0xe7ba('0x2e'),_0x1672f0['uniqueid'],_0x276bc3['id'],_0x99a86f['id']);}return;});}else{logger[_0xe7ba('0x8')](_0xe7ba('0x2f'),_0x1672f0[_0xe7ba('0x22')],_0x276bc3['id']);_0x4ecc0d[_0x5ece11]=_[_0xe7ba('0xe')](_0x1672f0[_0xe7ba('0x28')])?_0x1672f0['calleridnum']:_0x1672f0[_0xe7ba('0x30')];if(_[_0xe7ba('0xe')](_0x1672f0['routeId'])){_0x4ecc0d[_0xe7ba('0x14')]=_0x1672f0[_0xe7ba('0x2a')]&&_0x1672f0[_0xe7ba('0x2a')]!==''?_0x1672f0[_0xe7ba('0x2a')]:_0xe7ba('0x2b');}else{_0x4ecc0d['firstName']=_0x1672f0[_0xe7ba('0x2c')]&&_0x1672f0[_0xe7ba('0x2c')]!==_0xe7ba('0x29')?_0x1672f0['destcalleridname']:_0xe7ba('0x2b');}_0x99a86f=_0x4ecc0d;_0x448bcc[_0xe7ba('0x2d')](_0x4ecc0d);return;}}})['then'](function(){if(_0x375ebb){emit(_0x1672f0[_0xe7ba('0x22')],_0x276bc3,util[_0xe7ba('0x31')](_0xe7ba('0x32'),_0x375ebb['name']),util['format'](_0xe7ba('0x33'),_0x15083a[_0xe7ba('0x34')][_0xe7ba('0x35')]()),{'evt':_[_0xe7ba('0x36')](_0x1672f0,{'autoCreate':_0x588c8b}),'contact':_0x99a86f===undefined?{}:_0x99a86f,'contacts':_0x448bcc[_0xe7ba('0x20')]===0x0?undefined:_0x448bcc});}});}; \ No newline at end of file +var _0x668b=['join','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','calleridnum','format','user:%s','action','lodash','bluebird','util','../../../../config/environment','trigger','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','firstName','fax','createdAt','scheduledAt','union','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map'];(function(_0xc21192,_0xef8257){var _0x5dce1b=function(_0x5aaa5c){while(--_0x5aaa5c){_0xc21192['push'](_0xc21192['shift']());}};_0x5dce1b(++_0xef8257);}(_0x668b,0x140));var _0xb668=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x668b[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xb668('0x0'));var BPromise=require(_0xb668('0x1'));var Redis=require('ioredis');var util=require(_0xb668('0x2'));var config=require(_0xb668('0x3'));var logger=require('../../../../config/logger')(_0xb668('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0xb668('0x5')]=_[_0xb668('0x6')](config[_0xb668('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xb668('0x7'))(new Redis(config[_0xb668('0x5')]));function emit(_0x3be92e,_0x2778e9,_0x20b749,_0x3f01bc,_0x517fc5){logger[_0xb668('0x8')](_0xb668('0x9'),_0x3be92e,_0x2778e9['id'],_0x20b749,_0x3f01bc,JSON[_0xb668('0xa')](_0x517fc5));io['to'](_0x20b749)[_0xb668('0xb')](_0x3f01bc,_0x517fc5);}exports[_0xb668('0xc')]=function(_0x3606a7,_0x45bc39,_0x3616e9,_0x567ea9){var _0x3b15a6,_0x27dbf7;var _0x27de15={};var _0x2ea5fc=Number(_0x3616e9[_0xb668('0xd')]);var _0x167057=_0x3616e9[_0xb668('0xe')]?Boolean(Number(_0x3616e9[_0xb668('0xe')])):![];var _0x3e5be0;var _0x25c5c5=![];if(!_[_0xb668('0xf')](_0x3616e9[_0xb668('0x10')])){if(_0x3616e9[_0xb668('0x10')]=='1')_0x25c5c5=!![];}if(!_0x25c5c5){if(_0x567ea9[_0xb668('0x11')]){_0x27de15['id']=_0x567ea9[_0xb668('0x11')];}}if(!_0x27de15['id']){_0x27de15[_0xb668('0x12')]=_0x2ea5fc;_0x3e5be0=_0x3616e9[_0xb668('0x13')]&&_0x3616e9[_0xb668('0x13')]!=='0'?_0x3616e9[_0xb668('0x13')][_0xb668('0x14')](','):[_0xb668('0x15')];_0x27de15[_0xb668('0x16')]=_['map'](_0x3e5be0,function(_0x13ee71){var _0x567ad7={};_0x567ad7[_0x13ee71]=_0x567ea9[_0xb668('0x17')]?_0x567ea9[_0xb668('0x18')]:_0x567ea9['calleridnum'];return _0x567ad7;});}var _0x38595d=['id',_0xb668('0x19'),'lastName',_0xb668('0x15'),'mobile',_0xb668('0x1a'),_0xb668('0x12'),_0xb668('0x1b'),_0xb668('0x1c'),'updatedAt'];var _0x2b7f96=_[_0xb668('0x1d')](_0x38595d,_0x3e5be0);BPromise[_0xb668('0x1e')]()['then'](cmContactRpc['getContacts']({'attributes':_0x2b7f96,'where':_0x27de15}))[_0xb668('0x1f')](function(_0x1e5620){_0x27dbf7=_0x1e5620;if(!_['isEmpty'](_0x27dbf7)){if(_0x27dbf7[_0xb668('0x20')]===0x1){_0x3b15a6=_0x27dbf7[0x0];logger['info'](_0xb668('0x21'),_0x567ea9['uniqueid'],_0x45bc39['id'],_0x3b15a6['id']);}else{logger[_0xb668('0x8')](_0xb668('0x22'),_0x567ea9[_0xb668('0x23')],_0x45bc39['id'],_[_0xb668('0x24')](_0x27dbf7,'id')[_0xb668('0x25')](','));}return;}else{logger[_0xb668('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x567ea9[_0xb668('0x23')],_0x45bc39['id']);var _0x10d767={'ListId':_0x2ea5fc};var _0x2ab8c2=_0x3616e9['data4']&&_0x3616e9['data4']!=='0'?_0x3616e9[_0xb668('0x26')]:_0xb668('0x15');if(_0x167057){logger[_0xb668('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x567ea9[_0xb668('0x23')],_0x45bc39['id']);_0x10d767[_0x2ab8c2]=_[_0xb668('0xf')](_0x567ea9[_0xb668('0x17')])?_0x567ea9['calleridnum']:_0x567ea9['destcalleridnum'];if(_[_0xb668('0xf')](_0x567ea9[_0xb668('0x17')])){_0x10d767['firstName']=_0x567ea9[_0xb668('0x27')]&&_0x567ea9[_0xb668('0x27')]!==_0xb668('0x28')?_0x567ea9[_0xb668('0x27')]:_0xb668('0x29');}else{_0x10d767['firstName']=_0x567ea9[_0xb668('0x2a')]&&_0x567ea9[_0xb668('0x2a')]!==''?_0x567ea9[_0xb668('0x2a')]:'Unknown';}return BPromise[_0xb668('0x1e')]()[_0xb668('0x1f')](cmContactRpc[_0xb668('0x2b')](_0x10d767))[_0xb668('0x1f')](function(_0x2e40dd){_0x3b15a6=_0x2e40dd;_0x27dbf7[_0xb668('0x2c')](_0x2e40dd);if(_0x3b15a6){logger[_0xb668('0x8')](_0xb668('0x2d'),_0x567ea9[_0xb668('0x23')],_0x45bc39['id'],_0x3b15a6['id']);}return;});}else{logger['info'](_0xb668('0x2e'),_0x567ea9[_0xb668('0x23')],_0x45bc39['id']);_0x10d767[_0x2ab8c2]=_[_0xb668('0xf')](_0x567ea9['routeId'])?_0x567ea9[_0xb668('0x2f')]:_0x567ea9[_0xb668('0x18')];if(_[_0xb668('0xf')](_0x567ea9[_0xb668('0x17')])){_0x10d767['firstName']=_0x567ea9[_0xb668('0x27')]&&_0x567ea9[_0xb668('0x27')]!==_0xb668('0x28')?_0x567ea9[_0xb668('0x27')]:_0xb668('0x29');}else{_0x10d767[_0xb668('0x19')]=_0x567ea9[_0xb668('0x2a')]&&_0x567ea9['destcalleridname']!==_0xb668('0x28')?_0x567ea9[_0xb668('0x2a')]:'Unknown';}_0x3b15a6=_0x10d767;_0x27dbf7[_0xb668('0x2c')](_0x10d767);return;}}})['then'](function(){if(_0x3606a7){emit(_0x567ea9['uniqueid'],_0x45bc39,util[_0xb668('0x30')](_0xb668('0x31'),_0x3606a7['name']),util[_0xb668('0x30')]('trigger:%s',_0x3616e9[_0xb668('0x32')]['toLowerCase']()),{'evt':_['merge'](_0x567ea9,{'autoCreate':_0x167057}),'contact':_0x3b15a6===undefined?{}:_0x3b15a6,'contacts':_0x27dbf7[_0xb668('0x20')]===0x0?undefined:_0x27dbf7});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 26e8b3d..057f1c4 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 _0x2581=['custom:incomingmessage','custom:outgoingmessage','prototype','emit','info','stringify','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','variables','Actions','length','action','toLowerCase','motionbar','browser','data1','popup','TemplateId','data2','render','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','windowHeight','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','contactmanager','exec','integration','queue','urlforward','script','parse','query','search','channel','AllConditions','every','some','AnyConditions','checkConditions','account','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','equals','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:closedinteraction'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x2581,0xcb));var _0x1258=function(_0x54920c,_0x1a9dea){_0x54920c=_0x54920c-0x0;var _0x4beeba=_0x2581[_0x54920c];return _0x4beeba;};'use strict';var util=require(_0x1258('0x0'));var _=require(_0x1258('0x1'));var url=require(_0x1258('0x2'));var Mustache=require(_0x1258('0x3'));var Redis=require(_0x1258('0x4'));var urlforward=require('./urlforward');var integration=require(_0x1258('0x5'));var cmContact=require(_0x1258('0x6'));var script=require(_0x1258('0x7'));var config=require(_0x1258('0x8'));var logger=require(_0x1258('0x9'))(_0x1258('0xa'));var ami=require(_0x1258('0xb'));config[_0x1258('0xc')]=_['defaults'](config[_0x1258('0xc')],{'host':_0x1258('0xd'),'port':0x18eb});var io=require(_0x1258('0xe'))(new Redis(config[_0x1258('0xc')]));var operators={'equals':function(_0x44be2b,_0x19d690){return _0x44be2b==_0x19d690;},'not_equals':function(_0x429efc,_0x5b5d76){return _0x429efc!=_0x5b5d76;}};var barAndWebActions=['popup',_0x1258('0x2'),_0x1258('0xf')];function Trigger(_0x15eea2){this[_0x1258('0x10')]=_0x15eea2['triggers'];this[_0x1258('0x11')]=_0x15eea2[_0x1258('0x11')];this[_0x1258('0x12')]=_0x15eea2[_0x1258('0x12')];this['templates']=_0x15eea2[_0x1258('0x13')];this[_0x1258('0x14')]=_0x15eea2[_0x1258('0x14')];this[_0x1258('0x15')]=_0x15eea2[_0x1258('0x15')];this[_0x1258('0x16')]=_0x15eea2[_0x1258('0x16')];this['salesforceAccounts']=_0x15eea2[_0x1258('0x17')];this['sugarcrmAccounts']=_0x15eea2[_0x1258('0x18')];this[_0x1258('0x19')]=_0x15eea2[_0x1258('0x19')];this[_0x1258('0x1a')]=_0x15eea2[_0x1258('0x1a')];this['vtigerAccounts']=_0x15eea2[_0x1258('0x1b')];this[_0x1258('0x1c')]=_0x15eea2[_0x1258('0x1c')];this['dynamics365Accounts']=_0x15eea2[_0x1258('0x1d')];this[_0x1258('0x1e')]=_0x15eea2['freshsalesAccounts'];this[_0x1258('0x1f')]={'zendesk':this[_0x1258('0x15')],'salesforce':this[_0x1258('0x17')],'freshdesk':this[_0x1258('0x16')],'sugarcrm':this[_0x1258('0x18')],'zoho':this[_0x1258('0x19')],'desk':this[_0x1258('0x1a')],'vtiger':this[_0x1258('0x1b')],'dynamics365':this[_0x1258('0x1d')],'freshsales':this[_0x1258('0x1e')],'servicenow':this[_0x1258('0x1c')]};ami['on'](_0x1258('0x20'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x23'),this['syncCustomEvent'][_0x1258('0x22')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0x1258('0x22')](this));ami['on'](_0x1258('0x24'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x25'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on']('custom:agentnoanswer',this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x26'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x27'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x28'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x29'),this[_0x1258('0x21')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x1258('0x21')]['bind'](this));ami['on'](_0x1258('0x2a'),this[_0x1258('0x21')]['bind'](this));ami['on'](_0x1258('0x2b'),this[_0x1258('0x2c')][_0x1258('0x22')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x1258('0x22')](this));ami['on'](_0x1258('0x2d'),this['syncAgentDial'][_0x1258('0x22')](this));ami['on']('custom:newinteraction',this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x2e'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0x1258('0x22')](this));ami['on'](_0x1258('0x2f'),this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on'](_0x1258('0x30'),this[_0x1258('0x21')]['bind'](this));ami['on']('custom:acceptmessage',this[_0x1258('0x21')][_0x1258('0x22')](this));ami['on']('custom:rejectmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:offlineMessage',this[_0x1258('0x21')][_0x1258('0x22')](this));}Trigger[_0x1258('0x31')][_0x1258('0x32')]=function(_0x228203,_0x36d91c,_0x3d95ec){logger[_0x1258('0x33')](_0x228203,_0x36d91c,JSON[_0x1258('0x34')](_0x3d95ec));io['to'](_0x228203)['emit'](_0x36d91c,_0x3d95ec);};Trigger['prototype'][_0x1258('0x21')]=function(_0x4d2bc3){var _0x2d2183=_['clone'](_0x4d2bc3);if(typeof _0x2d2183[_0x1258('0x35')]===_0x1258('0x36')){_0x2d2183[_0x1258('0x35')]=_0x1258('0x37');}this[_0x1258('0x38')](_0x2d2183);};Trigger[_0x1258('0x31')][_0x1258('0x2c')]=function(_0x2a5181){if(this['agents'][_0x2a5181[_0x1258('0x39')]]){this[_0x1258('0x21')](_0x2a5181);}};Trigger[_0x1258('0x31')][_0x1258('0x38')]=function(_0x461c69){var _0x463409;for(var _0x5e7e41 in this['triggers']){if(this[_0x1258('0x10')][_0x1258('0x3a')](_0x5e7e41)){if(this[_0x1258('0x10')][_0x5e7e41]['status']){_0x463409=this[_0x1258('0x3b')](this['triggers'][_0x5e7e41],_0x461c69);if(_0x463409){_['merge'](_0x461c69,_0x461c69[_0x1258('0x3c')]);for(var _0x109b06=0x0,_0x25d975,_0x3f8e87,_0x2139d4;_0x109b060x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x326f,0xd1));var _0xf326=function(_0x4242ea,_0x2ed50d){_0x4242ea=_0x4242ea-0x0;var _0x22bb57=_0x326f[_0x4242ea];return _0x22bb57;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 9563d73..076a265 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 _0x41d0=['4.0','headers','substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','callDirection','queue','phonecalls','Fields','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','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','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data5','POST','clientId','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','Bearer\x20','value','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','username','userId','toLowerCase','outbound','calleridnum','/systemusers('];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41d0,0x1eb));var _0x041d=function(_0x2872c5,_0x362506){_0x2872c5=_0x2872c5-0x0;var _0x5a3d07=_0x41d0[_0x2872c5];return _0x5a3d07;};'use strict';var _=require(_0x041d('0x0'));var rp=require(_0x041d('0x1'));var util=require('util');var intUtil=require(_0x041d('0x2'));var md5=require(_0x041d('0x3'));var Redis=require(_0x041d('0x4'));var logger=require(_0x041d('0x5'))(_0x041d('0x6'));var config=require(_0x041d('0x7'));config[_0x041d('0x8')]=_[_0x041d('0x9')](config[_0x041d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x041d('0xa'))(new Redis(config[_0x041d('0x8')]));function getAuthToken(_0x291b31,_0xa67bfb,_0x5627a4){if(_0x291b31[_0x041d('0xb')]){_0x291b31[_0x041d('0xc')]=_0x291b31[_0x041d('0xd')]['data7'];_0x291b31[_0x041d('0xe')]=_0x291b31['CloudProvider']['data2'];return Promise['resolve'](_0x291b31[_0x041d('0xd')][_0x041d('0xf')]);}var _0x14c4c1={'method':_0x041d('0x10'),'uri':_0xa67bfb,'form':{'client_id':_0x291b31[_0x041d('0x11')],'resource':_0x291b31[_0x041d('0xc')],'username':_0x291b31['username'],'password':_0x291b31['password'],'grant_type':_0x041d('0x12'),'client_secret':_0x291b31[_0x041d('0x13')]},'json':!![]};return rp(_0x14c4c1)['then'](function(_0x55fa71){return _0x55fa71[_0x041d('0x14')];})[_0x041d('0x15')](function(_0x59ad88){logger[_0x041d('0x16')]('['+[_0x5627a4[_0x041d('0x17')]()]+_0x041d('0x18'));return _0x59ad88[_0x041d('0x19')];});}function getUser(_0x4f285e,_0x3d168c,_0x3ca06d,_0x5e4e46,_0x42ac1d,_0x4aa6e1){return new Promise(function(_0x5f03bf,_0x3dfc19){return getAuthToken(_0x3d168c,_0x5e4e46,_0x4aa6e1)[_0x041d('0x1a')](function(_0x1fd62e){var _0x46a42d={'method':_0x041d('0x1b'),'uri':_0x42ac1d+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x041d('0x1c')+_0x1fd62e,'OData-Version':'4.0'},'json':!![]};return rp(_0x46a42d);})['then'](function(_0x38190e){var _0x49d422=_0x38190e[_0x041d('0x1d')];var _0x14718d=![];var _0x493406=null;if(!_['isNil'](_0x3ca06d)){if(intUtil[_0x041d('0x1e')](_0x3ca06d[_0x041d('0x1f')])){_0x4f285e[_0x041d('0x20')]=_0x3ca06d[_0x041d('0x1f')];for(_0x493406=0x0;_0x493406<_0x49d422[_0x041d('0x21')];_0x493406++){if(_0x49d422[_0x493406][_0x041d('0x22')]===_0x3ca06d['email']&&!_0x49d422[_0x493406]['isdisabled']){_0x14718d=!![];logger[_0x041d('0x23')]('['+[_0x4aa6e1['toUpperCase']()]+_0x041d('0x24')+_0x49d422[_0x493406][_0x041d('0x25')]+'!');_0x4f285e['userId']=_0x49d422[_0x493406][_0x041d('0x25')];}}}}if(!_0x14718d){logger[_0x041d('0x23')]('['+[_0x4aa6e1['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4f285e[_0x041d('0x20')]=_0x3d168c[_0x041d('0x26')];for(_0x493406=0x0;_0x493406<_0x49d422['length'];_0x493406++){if(_0x49d422[_0x493406][_0x041d('0x22')]===_0x3d168c[_0x041d('0x26')]){_0x4f285e[_0x041d('0x27')]=_0x49d422[_0x493406][_0x041d('0x25')];}}}_0x5f03bf(_0x4f285e);})[_0x041d('0x15')](function(_0x57a338){_0x3dfc19(_0x57a338[_0x041d('0x19')]);});});}function createEndUser(_0x2ffe34,_0x3a27aa,_0x177083,_0x10bf5f,_0x54e443,_0x124d37){return new Promise(function(_0x577890,_0xda2f80){return getAuthToken(_0x3a27aa,_0x177083,_0x124d37)[_0x041d('0x1a')](function(_0x7c7fa8){var _0x2c0304=_0x124d37[_0x041d('0x28')]()===_0x041d('0x29')?_0x54e443['destcalleridnum']:_0x54e443[_0x041d('0x2a')];var _0x174162={'method':_0x041d('0x10'),'uri':_0x10bf5f+'contacts','body':{'telephone1':_0x2c0304,'fullname':_0x2c0304,'firstname':_0x2c0304,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x041d('0x2b')+_0x2ffe34['userId']+')'},'headers':{'Authorization':_0x041d('0x1c')+_0x7c7fa8,'OData-Version':_0x041d('0x2c')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x174162);})['then'](function(_0xd391f7){var _0x3804b0=_0xd391f7[_0x041d('0x2d')]['odata-entityid'];var _0x4a11fd=_0x3804b0[_0x041d('0x2e')](_0x3804b0[_0x041d('0x2f')]('(')+0x1,_0x3804b0[_0x041d('0x2f')](')'));_0x2ffe34[_0x041d('0x30')]=_0x4a11fd;_0x577890(_0x2ffe34);})['catch'](function(_0x1c5667){_0xda2f80(_0x1c5667[_0x041d('0x19')]);});});}function getEndUser(_0x3f40bc,_0x5485bc,_0x29723b,_0x4259ea,_0x7c4ba8,_0x60b5fa,_0x796044){var _0xecee83=_0x60b5fa[_0x041d('0x28')]()===_0x041d('0x29')?_0x7c4ba8[_0x041d('0x31')]:_0x7c4ba8[_0x041d('0x2a')];return getAuthToken(_0x5485bc,_0x29723b,_0x60b5fa)['then'](function(_0x5e8074){var _0x43e727={'method':_0x041d('0x1b'),'uri':_0x4259ea+_0x041d('0x32')+_0xecee83[_0x041d('0x33')]('+',_0x041d('0x34'))+'\x27','headers':{'Authorization':_0x041d('0x1c')+_0x5e8074,'If-None-Match':null,'OData-Version':_0x041d('0x2c')},'json':!![]};return rp(_0x43e727);})['then'](function(_0x1ac753){var _0x12593e=![];if(!_0x1ac753)return _0x12593e;var _0x475baf=_0x1ac753[_0x041d('0x1d')];for(var _0x1c19bc=0x0;_0x1c19bc<_0x475baf[_0x041d('0x21')];_0x1c19bc++){if(_0x475baf[_0x1c19bc][_0x041d('0x35')]===_0xecee83){_0x12593e=!![];_0x3f40bc[_0x041d('0x30')]=_0x475baf[_0x1c19bc][_0x041d('0x36')];}}return _0x12593e;})[_0x041d('0x1a')](function(_0xc3525c){if(_0xc3525c)return _0x3f40bc;if(_0x796044===_0x041d('0x37')){logger[_0x041d('0x23')]('['+[_0x60b5fa[_0x041d('0x17')]()]+_0x041d('0x38'));return _0x3f40bc;}return createEndUser(_0x3f40bc,_0x5485bc,_0x29723b,_0x4259ea,_0x7c4ba8,_0x60b5fa)['then'](function(_0x3b5d45){logger[_0x041d('0x23')]('['+[_0x60b5fa[_0x041d('0x17')]()]+_0x041d('0x39'),_0x3b5d45[_0x041d('0x30')]);return _0x3b5d45;});});}function getCustomFields(_0x306011,_0x4e9c20,_0x4d0bad){var _0x216a27={};if(_0x306011['length']>0x0){_[_0x041d('0x3a')](_0x306011,function(_0x2f7d43){if(_[_0x041d('0x3b')]([_0x041d('0x3c'),_0x041d('0x3d')],_0x2f7d43[_0x041d('0x3e')])&&_0x2f7d43[_0x041d('0x3f')]&&!_0x2f7d43[_0x041d('0x40')]){var _0x1a3c02=_0x2f7d43[_0x041d('0x41')][_0x041d('0x28')]();var _0x21d3f8=_0x1a3c02[_0x041d('0x2e')](0x0,_0x1a3c02['indexOf']('_'));var _0x1b8623=_0x1a3c02[_0x041d('0x2e')](_0x1a3c02[_0x041d('0x42')]('_')+0x1);if(_0x21d3f8===_0x4d0bad){_0x216a27[_0x1b8623]=_0x2f7d43['content'];}}});}return _0x216a27;}function getTicket(_0x552668,_0x2f6017,_0xe1bce5,_0x1d5d0e,_0x515bb2,_0x1d1750,_0x5c8ce5){return new Promise(function(_0xcf2e3e,_0x328819){var _0x57309d;return getAuthToken(_0x2f6017,_0xe1bce5,_0x5c8ce5)[_0x041d('0x1a')](function(_0x298af0){if(_0x1d1750[_0x041d('0x43')]==='incident'){_0x57309d={'method':_0x041d('0x10'),'uri':_0x1d5d0e+_0x041d('0x44'),'body':Object[_0x041d('0x45')]({},{'title':intUtil[_0x041d('0x46')](_0x1d1750[_0x041d('0x47')],_0x515bb2,'\x20'),'description':intUtil[_0x041d('0x46')](_0x1d1750[_0x041d('0x48')],_0x515bb2,'\x0a'),'customerid_contact@odata.bind':_0x552668[_0x041d('0x30')]?_0x041d('0x49')+_0x552668[_0x041d('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x552668[_0x041d('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x1d1750['Fields'],_0x515bb2,_0x1d1750[_0x041d('0x43')])),'headers':{'Authorization':_0x041d('0x1c')+_0x298af0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1d1750[_0x041d('0x43')]==='phonecall'){var _0x3635c7=_0x552668[_0x041d('0x30')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x552668['userId']+')','participationtypemask':_0x552668[_0x041d('0x4a')]===_0x041d('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x041d('0x49')+_0x552668[_0x041d('0x30')]+')','participationtypemask':_0x552668[_0x041d('0x4a')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x552668['userId']+')','participationtypemask':_0x552668[_0x041d('0x4a')]==='queue'?0x2:0x1}];_0x57309d={'method':_0x041d('0x10'),'uri':_0x1d5d0e+_0x041d('0x4c'),'body':Object['assign']({},{'subject':intUtil[_0x041d('0x46')](_0x1d1750[_0x041d('0x47')],_0x515bb2,'\x20'),'phonenumber':String(_0x515bb2[_0x041d('0x2a')]),'description':intUtil['getString'](_0x1d1750[_0x041d('0x48')],_0x515bb2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x552668[_0x041d('0x30')]?'/contacts('+_0x552668[_0x041d('0x30')]+')':undefined,'ownerid@odata.bind':_0x041d('0x2b')+_0x552668[_0x041d('0x27')]+')','directioncode':_0x552668[_0x041d('0x4a')]===_0x041d('0x4b')?![]:!![],'phonecall_activity_parties':_0x3635c7},getCustomFields(_0x1d1750[_0x041d('0x4d')],_0x515bb2,_0x1d1750[_0x041d('0x43')])),'headers':{'Authorization':_0x041d('0x1c')+_0x298af0,'OData-Version':_0x041d('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x57309d);})[_0x041d('0x1a')](function(_0x2b7e1b){var _0x309ed5=_0x2b7e1b['headers'][_0x041d('0x4e')];var _0x403102=_0x309ed5[_0x041d('0x2e')](_0x309ed5[_0x041d('0x2f')]('(')+0x1,_0x309ed5[_0x041d('0x2f')](')'));_0x552668[_0x041d('0x4f')]=_0x403102;_0xcf2e3e(_0x552668);})[_0x041d('0x15')](function(_0x276ce3){_0x328819(_0x276ce3[_0x041d('0x19')]);});});}function emit(_0x461302,_0x47b287,_0x5b7bc7,_0x1affeb){var _0x130d40={'uri':util['format'](_0x041d('0x50'),_0x461302,_0x5b7bc7,_0x1affeb)};io['to'](util[_0x041d('0x51')](_0x041d('0x52'),_0x47b287))[_0x041d('0x53')]('trigger:browser:url',_0x130d40);}exports['cs']=function(_0x1dfddd,_0x292b4f,_0xe7a21c,_0xd32f6b,_0x378520,_0x1536b6,_0xd26d13,_0x521aaa){var _0x320a96={};_0x1536b6[_0x041d('0xc')]=_0x1536b6[_0x041d('0xb')]?intUtil[_0x041d('0x54')](_0x1536b6[_0x041d('0xd')][_0x041d('0x55')]):intUtil['stripTrailingSlash'](_0x1536b6['remoteUri']);_0x1536b6[_0x041d('0x56')]=intUtil['stripTrailingSlash'](_0x1536b6[_0x041d('0x56')]);_0x320a96['callDirection']=_0x521aaa===_0x041d('0x4b')||_0x521aaa===_0x041d('0x57')?_0x041d('0x4b'):_0x041d('0x29');var _0x563fad=_0x1536b6[_0x041d('0xb')]?util[_0x041d('0x51')](_0x041d('0x58'),_0x1536b6[_0x041d('0xd')][_0x041d('0x55')]):util[_0x041d('0x51')](_0x041d('0x58'),_0x1536b6['remoteUri']);var _0x22f6a2=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x1536b6[_0x041d('0xe')]);var _0x3924a9=util[_0x041d('0x51')](_0x041d('0x59'),_0x1536b6[_0x041d('0x56')],_0x292b4f[_0x041d('0x5a')],md5(_0x292b4f['uniqueid']));if(_0x378520&&_0x378520[_0x041d('0x5b')]){logger[_0x041d('0x23')](_0x041d('0x5c'),_0x041d('0x5d'));_0x292b4f['recordingURL']=_0x3924a9;}else if(_0xd26d13&&_0xd26d13[_0x041d('0x5e')]&&_0xd26d13[_0x041d('0x5e')]!==_0x041d('0x5f')){logger[_0x041d('0x23')](_0x041d('0x60'),_0x041d('0x5d'));_0x292b4f[_0x041d('0x61')]=_0x3924a9;}else{_0x292b4f['recordingURL']='';}return getUser(_0x320a96,_0x1536b6,_0xd32f6b,_0x22f6a2,_0x563fad,_0x521aaa)[_0x041d('0x1a')](function(_0x593444){logger[_0x041d('0x23')]('['+_0x521aaa[_0x041d('0x17')]()+_0x041d('0x62'),_0x593444[_0x041d('0x27')]);logger[_0x041d('0x23')]('['+_0x521aaa[_0x041d('0x17')]()+_0x041d('0x63'),_0x593444[_0x041d('0x20')]);return getEndUser(_0x593444,_0x1536b6,_0x22f6a2,_0x563fad,_0x292b4f,_0x521aaa,_0xe7a21c[_0x041d('0x64')]);})[_0x041d('0x1a')](function(_0x4387e5){logger['info']('['+_0x521aaa[_0x041d('0x17')]()+_0x041d('0x65'),_0x4387e5[_0x041d('0x30')]);logger[_0x041d('0x23')]('['+_0x521aaa[_0x041d('0x17')]()+_0x041d('0x66'),_0x292b4f[_0x041d('0x2a')]);return getTicket(_0x4387e5,_0x1536b6,_0x22f6a2,_0x563fad,_0x292b4f,_0xe7a21c,_0x521aaa);})[_0x041d('0x1a')](function(_0x164f31){logger[_0x041d('0x23')](util['format']('['+_0x521aaa['toUpperCase']()+_0x041d('0x67'),_0xe7a21c[_0x041d('0x43')],_0x164f31['ticketId']));logger['info'](util[_0x041d('0x51')]('['+_0x521aaa['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x521aaa));if(_0x521aaa!==_0x041d('0x57')){logger['info']('['+_0x521aaa[_0x041d('0x17')]()+']',_0x041d('0x68'));emit(_0x1536b6['remoteUri'],_0xd32f6b[_0x041d('0x69')],_0xe7a21c['ticketType'],_0x164f31[_0x041d('0x4f')]);}})[_0x041d('0x15')](function(_0x2d2c19){logger[_0x041d('0x16')]('['+_0x521aaa[_0x041d('0x17')]()+_0x041d('0x6a'),_0x2d2c19[_0x041d('0x19')]);});}; \ No newline at end of file +var _0xfbae=['queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','../../../../config/logger','redis','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','data5','POST','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase','then','GET','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','userId','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','telephone1','contactid','nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','/systemusers(','callDirection'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xfbae,0x87));var _0xefba=function(_0x3972b7,_0x8a836e){_0x3972b7=_0x3972b7-0x0;var _0xbc4c8a=_0xfbae[_0x3972b7];return _0xbc4c8a;};'use strict';var _=require('lodash');var rp=require(_0xefba('0x0'));var util=require(_0xefba('0x1'));var intUtil=require(_0xefba('0x2'));var md5=require(_0xefba('0x3'));var Redis=require('ioredis');var logger=require(_0xefba('0x4'))('dynamics365');var config=require('../../../../config/environment');config[_0xefba('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xefba('0x5')]));function getAuthToken(_0xcf40a3,_0x429973,_0x2c44ea){if(_0xcf40a3[_0xefba('0x6')]){_0xcf40a3[_0xefba('0x7')]=_0xcf40a3[_0xefba('0x8')]['data7'];_0xcf40a3[_0xefba('0x9')]=_0xcf40a3[_0xefba('0x8')][_0xefba('0xa')];return Promise['resolve'](_0xcf40a3['CloudProvider'][_0xefba('0xb')]);}var _0x369c62={'method':_0xefba('0xc'),'uri':_0x429973,'form':{'client_id':_0xcf40a3[_0xefba('0xd')],'resource':_0xcf40a3[_0xefba('0x7')],'username':_0xcf40a3[_0xefba('0xe')],'password':_0xcf40a3[_0xefba('0xf')],'grant_type':_0xefba('0xf'),'client_secret':_0xcf40a3[_0xefba('0x10')]},'json':!![]};return rp(_0x369c62)['then'](function(_0x2884b2){return _0x2884b2[_0xefba('0x11')];})[_0xefba('0x12')](function(_0x12c87b){logger[_0xefba('0x13')]('['+[_0x2c44ea[_0xefba('0x14')]()]+']\x20Wrong\x20credentials!');return _0x12c87b['message'];});}function getUser(_0x561b14,_0x59a6a7,_0x56098e,_0x29e4bb,_0x58159c,_0x4d03b3){return new Promise(function(_0x41eb09,_0xf89b1f){return getAuthToken(_0x59a6a7,_0x29e4bb,_0x4d03b3)[_0xefba('0x15')](function(_0x5ba215){var _0x559965={'method':_0xefba('0x16'),'uri':_0x58159c+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xefba('0x17')+_0x5ba215,'OData-Version':_0xefba('0x18')},'json':!![]};return rp(_0x559965);})[_0xefba('0x15')](function(_0x58a19b){var _0x5d4567=_0x58a19b[_0xefba('0x19')];var _0x2de7fd=![];var _0x15d9b4=null;if(!_[_0xefba('0x1a')](_0x56098e)){if(intUtil['validateEmail'](_0x56098e[_0xefba('0x1b')])){_0x561b14[_0xefba('0x1c')]=_0x56098e[_0xefba('0x1b')];for(_0x15d9b4=0x0;_0x15d9b4<_0x5d4567[_0xefba('0x1d')];_0x15d9b4++){if(_0x5d4567[_0x15d9b4][_0xefba('0x1e')]===_0x56098e['email']&&!_0x5d4567[_0x15d9b4][_0xefba('0x1f')]){_0x2de7fd=!![];logger['info']('['+[_0x4d03b3[_0xefba('0x14')]()]+_0xefba('0x20')+_0x5d4567[_0x15d9b4][_0xefba('0x21')]+'!');_0x561b14['userId']=_0x5d4567[_0x15d9b4][_0xefba('0x21')];}}}}if(!_0x2de7fd){logger[_0xefba('0x22')]('['+[_0x4d03b3[_0xefba('0x14')]()]+_0xefba('0x23'));_0x561b14['userEmail']=_0x59a6a7[_0xefba('0xe')];for(_0x15d9b4=0x0;_0x15d9b4<_0x5d4567[_0xefba('0x1d')];_0x15d9b4++){if(_0x5d4567[_0x15d9b4][_0xefba('0x1e')]===_0x59a6a7[_0xefba('0xe')]){_0x561b14['userId']=_0x5d4567[_0x15d9b4]['systemuserid'];}}}_0x41eb09(_0x561b14);})['catch'](function(_0x3350b9){_0xf89b1f(_0x3350b9[_0xefba('0x24')]);});});}function createEndUser(_0x3e89e1,_0xb01a03,_0x34c5a6,_0x24eef5,_0x24c16f,_0x5e24b4){return new Promise(function(_0x1602a0,_0x1a2594){return getAuthToken(_0xb01a03,_0x34c5a6,_0x5e24b4)['then'](function(_0x606915){var _0x3a86e0=_0x5e24b4[_0xefba('0x25')]()===_0xefba('0x26')?_0x24c16f[_0xefba('0x27')]:_0x24c16f[_0xefba('0x28')];var _0x4cc5df={'method':_0xefba('0xc'),'uri':_0x24eef5+_0xefba('0x29'),'body':{'telephone1':_0x3a86e0,'fullname':_0x3a86e0,'firstname':_0x3a86e0,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3e89e1[_0xefba('0x2a')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x606915,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4cc5df);})[_0xefba('0x15')](function(_0x6d2ce7){var _0x4dd817=_0x6d2ce7[_0xefba('0x2b')][_0xefba('0x2c')];var _0x547a7d=_0x4dd817[_0xefba('0x2d')](_0x4dd817[_0xefba('0x2e')]('(')+0x1,_0x4dd817['lastIndexOf'](')'));_0x3e89e1[_0xefba('0x2f')]=_0x547a7d;_0x1602a0(_0x3e89e1);})[_0xefba('0x12')](function(_0x43e527){_0x1a2594(_0x43e527[_0xefba('0x24')]);});});}function getEndUser(_0x3f0db7,_0x3b2b3d,_0x221b2c,_0x210e3e,_0x1bc188,_0x46e185,_0x332c29){var _0x22190a=_0x46e185['toLowerCase']()==='outbound'?_0x1bc188[_0xefba('0x27')]:_0x1bc188['calleridnum'];return getAuthToken(_0x3b2b3d,_0x221b2c,_0x46e185)[_0xefba('0x15')](function(_0x142d77){var _0x29641a={'method':_0xefba('0x16'),'uri':_0x210e3e+_0xefba('0x30')+_0x22190a[_0xefba('0x31')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x142d77,'If-None-Match':null,'OData-Version':_0xefba('0x18')},'json':!![]};return rp(_0x29641a);})[_0xefba('0x15')](function(_0x24ad6e){var _0x3bf4fe=![];if(!_0x24ad6e)return _0x3bf4fe;var _0x378d7b=_0x24ad6e[_0xefba('0x19')];for(var _0xc996f4=0x0;_0xc996f4<_0x378d7b[_0xefba('0x1d')];_0xc996f4++){if(_0x378d7b[_0xc996f4][_0xefba('0x32')]===_0x22190a){_0x3bf4fe=!![];_0x3f0db7['enduserId']=_0x378d7b[_0xc996f4][_0xefba('0x33')];}}return _0x3bf4fe;})[_0xefba('0x15')](function(_0x4adab3){if(_0x4adab3)return _0x3f0db7;if(_0x332c29===_0xefba('0x34')){logger[_0xefba('0x22')]('['+[_0x46e185['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x3f0db7;}return createEndUser(_0x3f0db7,_0x3b2b3d,_0x221b2c,_0x210e3e,_0x1bc188,_0x46e185)['then'](function(_0x212325){logger[_0xefba('0x22')]('['+[_0x46e185[_0xefba('0x14')]()]+_0xefba('0x35'),_0x212325[_0xefba('0x2f')]);return _0x212325;});});}function getCustomFields(_0x4a3ed3,_0x3f416e,_0x46486e){var _0x138876={};if(_0x4a3ed3[_0xefba('0x1d')]>0x0){_[_0xefba('0x36')](_0x4a3ed3,function(_0x17822b){if(_[_0xefba('0x37')]([_0xefba('0x38'),_0xefba('0x39')],_0x17822b[_0xefba('0x3a')])&&_0x17822b[_0xefba('0x3b')]&&!_0x17822b['customField']){var _0x5201e6=_0x17822b[_0xefba('0x3c')][_0xefba('0x25')]();var _0x1e61e4=_0x5201e6[_0xefba('0x2d')](0x0,_0x5201e6[_0xefba('0x3d')]('_'));var _0x2b3491=_0x5201e6[_0xefba('0x2d')](_0x5201e6[_0xefba('0x3d')]('_')+0x1);if(_0x1e61e4===_0x46486e){_0x138876[_0x2b3491]=_0x17822b[_0xefba('0x3e')];}}});}return _0x138876;}function getTicket(_0x974636,_0x30a3c9,_0x4fdff6,_0x2ad67d,_0x2f45f1,_0x4dd0ab,_0x577319){return new Promise(function(_0x1fa1f5,_0x3d517d){var _0xcf0f71;return getAuthToken(_0x30a3c9,_0x4fdff6,_0x577319)[_0xefba('0x15')](function(_0x45369e){if(_0x4dd0ab[_0xefba('0x3f')]===_0xefba('0x40')){_0xcf0f71={'method':_0xefba('0xc'),'uri':_0x2ad67d+_0xefba('0x41'),'body':Object[_0xefba('0x42')]({},{'title':intUtil[_0xefba('0x43')](_0x4dd0ab[_0xefba('0x44')],_0x2f45f1,'\x20'),'description':intUtil[_0xefba('0x43')](_0x4dd0ab[_0xefba('0x45')],_0x2f45f1,'\x0a'),'customerid_contact@odata.bind':_0x974636[_0xefba('0x2f')]?_0xefba('0x46')+_0x974636['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x974636[_0xefba('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x4dd0ab[_0xefba('0x47')],_0x2f45f1,_0x4dd0ab['ticketType'])),'headers':{'Authorization':_0xefba('0x17')+_0x45369e,'OData-Version':_0xefba('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4dd0ab[_0xefba('0x3f')]===_0xefba('0x48')){var _0x1e3214=_0x974636['enduserId']?[{'partyid_systemuser@odata.bind':_0xefba('0x49')+_0x974636[_0xefba('0x2a')]+')','participationtypemask':_0x974636[_0xefba('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xefba('0x46')+_0x974636[_0xefba('0x2f')]+')','participationtypemask':_0x974636[_0xefba('0x4a')]===_0xefba('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xefba('0x49')+_0x974636[_0xefba('0x2a')]+')','participationtypemask':_0x974636[_0xefba('0x4a')]===_0xefba('0x4b')?0x2:0x1}];_0xcf0f71={'method':'POST','uri':_0x2ad67d+_0xefba('0x4c'),'body':Object[_0xefba('0x42')]({},{'subject':intUtil['getString'](_0x4dd0ab[_0xefba('0x44')],_0x2f45f1,'\x20'),'phonenumber':String(_0x2f45f1[_0xefba('0x28')]),'description':intUtil['getString'](_0x4dd0ab[_0xefba('0x45')],_0x2f45f1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x974636[_0xefba('0x2f')]?'/contacts('+_0x974636[_0xefba('0x2f')]+')':undefined,'ownerid@odata.bind':_0xefba('0x49')+_0x974636['userId']+')','directioncode':_0x974636['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x1e3214},getCustomFields(_0x4dd0ab[_0xefba('0x47')],_0x2f45f1,_0x4dd0ab[_0xefba('0x3f')])),'headers':{'Authorization':'Bearer\x20'+_0x45369e,'OData-Version':_0xefba('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xcf0f71);})['then'](function(_0x22e42b){var _0x2bc98c=_0x22e42b['headers'][_0xefba('0x2c')];var _0xf213ac=_0x2bc98c[_0xefba('0x2d')](_0x2bc98c[_0xefba('0x2e')]('(')+0x1,_0x2bc98c[_0xefba('0x2e')](')'));_0x974636['ticketId']=_0xf213ac;_0x1fa1f5(_0x974636);})[_0xefba('0x12')](function(_0x7f77a9){_0x3d517d(_0x7f77a9['message']);});});}function emit(_0x39f203,_0x3bd969,_0x4de2a,_0x383d3c){var _0x45db68={'uri':util[_0xefba('0x4d')](_0xefba('0x4e'),_0x39f203,_0x4de2a,_0x383d3c)};io['to'](util[_0xefba('0x4d')]('user:%s',_0x3bd969))[_0xefba('0x4f')](_0xefba('0x50'),_0x45db68);}exports['cs']=function(_0x1d4b69,_0x21dc11,_0x471aca,_0x21a743,_0x2fb899,_0x2e72ae,_0x10e4c5,_0x5cd1ca){var _0x18c111={};_0x2e72ae['remoteUri']=_0x2e72ae[_0xefba('0x6')]?intUtil['stripTrailingSlash'](_0x2e72ae[_0xefba('0x8')]['data7']):intUtil[_0xefba('0x51')](_0x2e72ae[_0xefba('0x7')]);_0x2e72ae['serverUrl']=intUtil[_0xefba('0x51')](_0x2e72ae[_0xefba('0x52')]);_0x18c111[_0xefba('0x4a')]=_0x5cd1ca===_0xefba('0x4b')||_0x5cd1ca===_0xefba('0x53')?_0xefba('0x4b'):_0xefba('0x26');var _0x334b9b=_0x2e72ae[_0xefba('0x6')]?util['format'](_0xefba('0x54'),_0x2e72ae['CloudProvider'][_0xefba('0x55')]):util['format'](_0xefba('0x54'),_0x2e72ae[_0xefba('0x7')]);var _0x4a828b=util[_0xefba('0x4d')](_0xefba('0x56'),_0x2e72ae[_0xefba('0x9')]);var _0x38ad6f=util['format'](_0xefba('0x57'),_0x2e72ae[_0xefba('0x52')],_0x21dc11[_0xefba('0x58')],md5(_0x21dc11[_0xefba('0x58')]));if(_0x2fb899&&_0x2fb899[_0xefba('0x59')]){logger['info'](_0xefba('0x5a'),'Recording\x20is\x20enabled!');_0x21dc11[_0xefba('0x5b')]=_0x38ad6f;}else if(_0x10e4c5&&_0x10e4c5[_0xefba('0x5c')]&&_0x10e4c5[_0xefba('0x5c')]!==_0xefba('0x5d')){logger[_0xefba('0x22')](_0xefba('0x5e'),_0xefba('0x5f'));_0x21dc11['recordingURL']=_0x38ad6f;}else{_0x21dc11[_0xefba('0x5b')]='';}return getUser(_0x18c111,_0x2e72ae,_0x21a743,_0x4a828b,_0x334b9b,_0x5cd1ca)[_0xefba('0x15')](function(_0x1aaf49){logger[_0xefba('0x22')]('['+_0x5cd1ca[_0xefba('0x14')]()+']\x20The\x20User\x20ID\x20is:',_0x1aaf49[_0xefba('0x2a')]);logger[_0xefba('0x22')]('['+_0x5cd1ca[_0xefba('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x1aaf49['userEmail']);return getEndUser(_0x1aaf49,_0x2e72ae,_0x4a828b,_0x334b9b,_0x21dc11,_0x5cd1ca,_0x471aca[_0xefba('0x60')]);})[_0xefba('0x15')](function(_0x8f1faa){logger[_0xefba('0x22')]('['+_0x5cd1ca[_0xefba('0x14')]()+_0xefba('0x61'),_0x8f1faa[_0xefba('0x2f')]);logger[_0xefba('0x22')]('['+_0x5cd1ca[_0xefba('0x14')]()+_0xefba('0x62'),_0x21dc11['calleridnum']);return getTicket(_0x8f1faa,_0x2e72ae,_0x4a828b,_0x334b9b,_0x21dc11,_0x471aca,_0x5cd1ca);})[_0xefba('0x15')](function(_0x23d754){logger['info'](util[_0xefba('0x4d')]('['+_0x5cd1ca[_0xefba('0x14')]()+_0xefba('0x63'),_0x471aca[_0xefba('0x3f')],_0x23d754[_0xefba('0x64')]));logger[_0xefba('0x22')](util[_0xefba('0x4d')]('['+_0x5cd1ca[_0xefba('0x14')]()+_0xefba('0x65'),_0x5cd1ca));if(_0x5cd1ca!==_0xefba('0x53')){logger[_0xefba('0x22')]('['+_0x5cd1ca['toUpperCase']()+']',_0xefba('0x66'));emit(_0x2e72ae['remoteUri'],_0x21a743[_0xefba('0x67')],_0x471aca[_0xefba('0x3f')],_0x23d754['ticketId']);}})['catch'](function(_0x21dd40){logger['error']('['+_0x5cd1ca[_0xefba('0x14')]()+_0xefba('0x68'),_0x21dd40[_0xefba('0x24')]);});}; \ 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 94e7988..0ac5b4f 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 _0x1f52=['name','Fields','mapValues','keyBy','custom_fields','value','format','remoteUri','then','Ticket\x20created!','validateEmail','length','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','forEach','includes','string','picklist','nameField','customField','content','type','idField','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','stringify','unmanaged','monitor_format','lastevent','toUpperCase','recordingURL','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1f52,0xf9));var _0x21f5=function(_0x2509be,_0x5c9173){_0x2509be=_0x2509be-0x0;var _0x2f2f00=_0x1f52[_0x2509be];return _0x2f2f00;};'use strict';var _=require(_0x21f5('0x0'));var rp=require(_0x21f5('0x1'));var md5=require(_0x21f5('0x2'));var util=require(_0x21f5('0x3'));var Redis=require(_0x21f5('0x4'));var intUtil=require('./util');var config=require(_0x21f5('0x5'));var logger=require('../../../../config/logger')(_0x21f5('0x6'));config[_0x21f5('0x7')]=_[_0x21f5('0x8')](config[_0x21f5('0x7')],{'host':_0x21f5('0x9'),'port':0x18eb});var io=require(_0x21f5('0xa'))(new Redis(config[_0x21f5('0x7')]));var headers={'Content-Type':_0x21f5('0xb'),'Accept':_0x21f5('0xb')};function emit(_0x4ce1b6,_0x4aaf73,_0x3ba8de){io['to'](_0x4ce1b6)['emit'](_0x4aaf73,_0x3ba8de);}function getTicket(_0x39b637,_0x19a46d,_0x57e76b,_0x58e76a,_0x39cceb){logger[_0x21f5('0xc')](_0x21f5('0xd'));var _0x2fe2e1=_[_0x21f5('0xe')]({'responder_id':_0x19a46d['id'],'requester_id':_0x57e76b['id'],'name':util['format'](_0x21f5('0xf'),_0x39cceb[_0x21f5('0x10')]),'phone':_0x39cceb[_0x21f5('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x58e76a['Subjects'],_0x39cceb,'\x20'),'description':intUtil[_0x21f5('0x12')](_0x58e76a[_0x21f5('0x13')],_0x39cceb,_0x21f5('0x14')),'tags':getTags(_0x58e76a['Tags'],_0x21f5('0x15'))},getCustomFields(_0x58e76a[_0x21f5('0x16')],_0x39cceb));_0x2fe2e1['custom_fields']=_[_0x21f5('0x17')](_[_0x21f5('0x18')](_0x2fe2e1[_0x21f5('0x19')],'id'),_0x21f5('0x1a'));return request({'uri':util[_0x21f5('0x1b')]('%s/api/v2/tickets',_0x39b637[_0x21f5('0x1c')]),'method':'POST','body':_0x2fe2e1})[_0x21f5('0x1d')](function(_0x14e993){logger[_0x21f5('0xc')](_0x21f5('0x1e'));return _0x14e993;});}function getUser(_0x3f4bc3,_0x1c6a94){if(intUtil[_0x21f5('0x1f')](_0x1c6a94)){return request({'uri':util[_0x21f5('0x1b')]('%s/api/v2/agents',_0x3f4bc3[_0x21f5('0x1c')]),'qs':{'email':_0x1c6a94}})['then'](function(_0x14abd4){if(_0x14abd4[_0x21f5('0x20')]){logger[_0x21f5('0xc')]('Agent\x20found!');return _[_0x21f5('0x21')](_0x14abd4,function(_0x3033b6){return _0x3033b6[_0x21f5('0x22')][_0x21f5('0x23')]===_0x1c6a94;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x21f5('0x1b')](_0x21f5('0x24'),_0x3f4bc3[_0x21f5('0x1c')])})[_0x21f5('0x1d')](function(_0x250801){logger[_0x21f5('0xc')](_0x21f5('0x25'));return _0x250801;});}});}else{logger[_0x21f5('0xc')](_0x21f5('0x26'));return request({'uri':util[_0x21f5('0x1b')](_0x21f5('0x24'),_0x3f4bc3['remoteUri'])})[_0x21f5('0x1d')](function(_0x1db8d2){logger[_0x21f5('0xc')](_0x21f5('0x25'));return _0x1db8d2;});}}function getEndUser(_0x1ea397,_0x5364d1,_0x32a8a1){logger[_0x21f5('0xc')]('Searching\x20enduser\x20with\x20phone',_0x32a8a1);return request({'uri':util[_0x21f5('0x1b')](_0x21f5('0x27'),_0x1ea397['remoteUri']),'qs':{'phone':_0x32a8a1}})[_0x21f5('0x1d')](function(_0xed4a10){if(_0xed4a10[_0x21f5('0x20')]){logger['info'](_0x21f5('0x28'));return _[_0x21f5('0x21')](_0xed4a10,{'phone':_0x32a8a1});}else{logger[_0x21f5('0xc')](_0x21f5('0x29'));return request({'uri':util['format'](_0x21f5('0x27'),_0x1ea397[_0x21f5('0x1c')]),'method':_0x21f5('0x2a'),'body':{'name':_0x5364d1,'phone':_0x32a8a1}})[_0x21f5('0x1d')](function(_0x143407){logger[_0x21f5('0xc')]('Enduser\x20created.');return _0x143407;});}});}function getAuth(_0x8f759b){return util[_0x21f5('0x1b')](_0x21f5('0x2b'),new Buffer(_0x8f759b[_0x21f5('0x2c')]+':X')[_0x21f5('0x2d')](_0x21f5('0x2e')));}function request(_0x25e84b){logger[_0x21f5('0x2f')](_0x21f5('0x30'),JSON['stringify'](_0x25e84b));return rp(_[_0x21f5('0x8')](_0x25e84b,{'method':_0x21f5('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x18504e,_0x12d071){var _0x1e11ec=[];if(_0x18504e&&_0x18504e[_0x21f5('0x20')]>0x0){_0x1e11ec=_['map'](_0x18504e,_0x12d071);}return _0x1e11ec;}function getCustomFields(_0x1ff412,_0x1ba62c){var _0x462f66=[];var _0x43dec1={'custom_fields':[]};if(_0x1ff412[_0x21f5('0x20')]>0x0){_[_0x21f5('0x32')](_0x1ff412,function(_0x1cae35){if(_[_0x21f5('0x33')]([_0x21f5('0x34'),_0x21f5('0x35')],_0x1cae35['type'])&&_0x1cae35[_0x21f5('0x36')]&&!_0x1cae35[_0x21f5('0x37')]){_0x43dec1[_0x1cae35[_0x21f5('0x36')]['toLowerCase']()]=_0x1cae35[_0x21f5('0x38')]['toString']();}else if(_[_0x21f5('0x33')](['string',_0x21f5('0x35')],_0x1cae35[_0x21f5('0x39')])&&_0x1cae35[_0x21f5('0x3a')]&&_0x1cae35[_0x21f5('0x37')]){_0x43dec1[_0x21f5('0x19')][_0x21f5('0x3b')]({'id':_0x1cae35[_0x21f5('0x3a')],'value':_0x1cae35[_0x21f5('0x38')][_0x21f5('0x2d')]()});}else if(_0x1cae35[_0x21f5('0x39')]===_0x21f5('0x3c')&&_0x1cae35[_0x21f5('0x3d')]&&_0x1cae35['idField']&&_0x1cae35[_0x21f5('0x37')]){_0x1ba62c[_0x1cae35[_0x21f5('0x3d')]]&&_0x43dec1[_0x21f5('0x19')][_0x21f5('0x3b')]({'id':_0x1cae35[_0x21f5('0x3a')],'value':_0x1ba62c[_0x1cae35[_0x21f5('0x3d')]][_0x21f5('0x2d')]()});}else if(_0x1cae35[_0x21f5('0x39')]==='customVariable'&&_0x1cae35[_0x21f5('0x3e')]&&_0x1cae35['Variable'][_0x21f5('0x15')]&&_0x1cae35[_0x21f5('0x3a')]&&_0x1cae35[_0x21f5('0x37')]){_0x1ba62c[_0x1cae35['Variable']['name'][_0x21f5('0x3f')]()]&&_0x43dec1[_0x21f5('0x19')][_0x21f5('0x3b')]({'id':_0x1cae35[_0x21f5('0x3a')],'value':_0x1ba62c[_0x1cae35[_0x21f5('0x3e')][_0x21f5('0x15')][_0x21f5('0x3f')]()][_0x21f5('0x2d')]()});}});}return _0x43dec1;}exports[_0x21f5('0x40')]=function(_0x1de4eb,_0x1f7e85,_0x13d270,_0x33545b,_0x109632,_0x1e39d1){var _0x48470e,_0x495fe4;_0x1e39d1[_0x21f5('0x1c')]=intUtil[_0x21f5('0x41')](_0x1e39d1['remoteUri']);_0x1e39d1[_0x21f5('0x42')]=intUtil[_0x21f5('0x41')](_0x1e39d1[_0x21f5('0x42')]);if(_0x109632&&_0x109632['monitor_format']){logger[_0x21f5('0xc')]('[QUEUE]',_0x21f5('0x43'));_0x1f7e85['recordingURL']=util[_0x21f5('0x1b')](_0x21f5('0x44'),_0x1e39d1[_0x21f5('0x42')],_0x1f7e85['uniqueid'],md5(_0x1f7e85[_0x21f5('0x45')]));}else{_0x1f7e85['recordingURL']='';}headers[_0x21f5('0x46')]=getAuth(_0x1e39d1);return getUser(_0x1e39d1,_0x33545b[_0x21f5('0x23')])[_0x21f5('0x1d')](function(_0x3cce38){_0x48470e=_0x3cce38;logger[_0x21f5('0xc')](_0x21f5('0x47'),_0x48470e['id']);return getEndUser(_0x1e39d1,_0x1f7e85[_0x21f5('0x10')],_0x1f7e85[_0x21f5('0x11')]);})[_0x21f5('0x1d')](function(_0x522f26){_0x495fe4=_0x522f26;logger[_0x21f5('0xc')](_0x21f5('0x48'),_0x495fe4['id']);return getTicket(_0x1e39d1,_0x48470e,_0x495fe4,_0x13d270,_0x1f7e85);})['then'](function(_0x456507){if(_0x456507&&_0x456507['id']){logger['info'](_0x21f5('0x1e'));logger[_0x21f5('0xc')](_0x21f5('0x49'),_0x456507['id']);logger[_0x21f5('0xc')](_0x21f5('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x21f5('0x1b')](_0x21f5('0x4b'),_0x33545b['name']),_0x21f5('0x4c'),{'uri':util['format'](_0x21f5('0x4d'),_0x1e39d1[_0x21f5('0x1c')],_0x456507['id'])});}})[_0x21f5('0x4e')](function(_0x149d08){logger[_0x21f5('0x4f')](_0x21f5('0x4a'),JSON['stringify'](_0x149d08));});};exports['outbound']=function(_0x19cf3f,_0x36547f,_0x155553,_0x3672ce,_0x3d6750,_0x48b44b,_0x57901b){var _0x5b07b2,_0x56b449;_0x48b44b[_0x21f5('0x1c')]=intUtil[_0x21f5('0x41')](_0x48b44b[_0x21f5('0x1c')]);_0x48b44b[_0x21f5('0x42')]=intUtil[_0x21f5('0x41')](_0x48b44b[_0x21f5('0x42')]);if(_0x57901b&&_0x57901b['recordingFormat']&&_0x57901b[_0x21f5('0x50')]!==_0x21f5('0x51')){logger[_0x21f5('0xc')](_0x21f5('0x52'),'Recording\x20is\x20enabled!');_0x36547f['recordingURL']=util[_0x21f5('0x1b')](_0x21f5('0x44'),_0x48b44b[_0x21f5('0x42')],_0x36547f['uniqueid'],md5(_0x36547f['uniqueid']));}headers[_0x21f5('0x46')]=getAuth(_0x48b44b);return getUser(_0x48b44b,_0x3672ce[_0x21f5('0x23')])[_0x21f5('0x1d')](function(_0x127d3e){_0x5b07b2=_0x127d3e;logger['info']('The\x20User\x20ID\x20is:',_0x5b07b2['id']);return getEndUser(_0x48b44b,_0x36547f[_0x21f5('0x53')],_0x36547f['destcalleridnum']);})[_0x21f5('0x1d')](function(_0x414216){_0x56b449=_0x414216;logger['info'](_0x21f5('0x48'),_0x56b449['id']);return getTicket(_0x48b44b,_0x5b07b2,_0x56b449,_0x155553,_0x36547f);})[_0x21f5('0x1d')](function(_0x45d8ac){if(_0x45d8ac&&_0x45d8ac['id']){logger[_0x21f5('0xc')](_0x21f5('0x1e'));logger['info'](_0x21f5('0x49'),_0x45d8ac['id']);logger['info'](_0x21f5('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x21f5('0x1b')](_0x21f5('0x4b'),_0x3672ce[_0x21f5('0x15')]),_0x21f5('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x48b44b[_0x21f5('0x1c')],_0x45d8ac['id'])});}})['catch'](function(_0x55d195){logger[_0x21f5('0x4f')]('[OUTBOUND]',JSON[_0x21f5('0x54')](_0x55d195));});};exports[_0x21f5('0x55')]=function(_0x34ec14,_0x4b83df,_0x51ad2c,_0x17801c,_0x407812,_0x18efcc){var _0x594974,_0x46d623;_0x18efcc[_0x21f5('0x1c')]=intUtil['stripTrailingSlash'](_0x18efcc[_0x21f5('0x1c')]);_0x18efcc[_0x21f5('0x42')]=intUtil['stripTrailingSlash'](_0x18efcc[_0x21f5('0x42')]);if(_0x407812&&_0x407812[_0x21f5('0x56')]){logger[_0x21f5('0xc')]('['+_0x4b83df[_0x21f5('0x57')][_0x21f5('0x58')]()+']','Recording\x20is\x20enabled!');_0x4b83df[_0x21f5('0x59')]=util['format'](_0x21f5('0x44'),_0x18efcc[_0x21f5('0x42')],_0x4b83df[_0x21f5('0x45')],md5(_0x4b83df[_0x21f5('0x45')]));}else{_0x4b83df[_0x21f5('0x59')]='';}headers[_0x21f5('0x46')]=getAuth(_0x18efcc);return getUser(_0x18efcc,'')[_0x21f5('0x1d')](function(_0x5b0f8c){_0x594974=_0x5b0f8c;logger[_0x21f5('0xc')]('The\x20User\x20ID\x20is:',_0x594974['id']);return getEndUser(_0x18efcc,_0x4b83df['calleridname'],_0x4b83df[_0x21f5('0x11')]);})[_0x21f5('0x1d')](function(_0x5ec974){_0x46d623=_0x5ec974;logger[_0x21f5('0xc')](_0x21f5('0x48'),_0x46d623['id']);return getTicket(_0x18efcc,_0x594974,_0x46d623,_0x51ad2c,_0x4b83df);})[_0x21f5('0x1d')](function(_0x18ddd6){if(_0x18ddd6){logger[_0x21f5('0xc')]('Ticket\x20created!');logger[_0x21f5('0xc')](_0x21f5('0x49'),_0x18ddd6['id']);}})[_0x21f5('0x4e')](function(_0x4fd27d){logger['error']('['+_0x4b83df[_0x21f5('0x57')][_0x21f5('0x58')]()+']',JSON[_0x21f5('0x54')](_0x4fd27d));});}; \ No newline at end of file +var _0x73f2=['debug','[HTTP]','GET','map','includes','string','type','toLowerCase','picklist','idField','customField','push','content','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','stringify','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','user:%s','error','unmanaged','toUpperCase','lastevent','lodash','md5','util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','Ticket\x20created!','validateEmail','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','toString'];(function(_0xd8f7bd,_0x45dc8c){var _0x1bd5ee=function(_0x20498e){while(--_0x20498e){_0xd8f7bd['push'](_0xd8f7bd['shift']());}};_0x1bd5ee(++_0x45dc8c);}(_0x73f2,0x128));var _0x273f=function(_0x47d1a8,_0x58fd59){_0x47d1a8=_0x47d1a8-0x0;var _0x5807f9=_0x73f2[_0x47d1a8];return _0x5807f9;};'use strict';var _=require(_0x273f('0x0'));var rp=require('request-promise');var md5=require(_0x273f('0x1'));var util=require(_0x273f('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x273f('0x3'));var logger=require(_0x273f('0x4'))('freshdesk');config['redis']=_[_0x273f('0x5')](config[_0x273f('0x6')],{'host':_0x273f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x273f('0x6')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0xaee0ae,_0x45b425,_0x356c41){io['to'](_0xaee0ae)['emit'](_0x45b425,_0x356c41);}function getTicket(_0x5e9bfd,_0x5bca67,_0x4c25d2,_0x24f0e5,_0x9fde01){logger[_0x273f('0x8')](_0x273f('0x9'));var _0x5a01f2=_[_0x273f('0xa')]({'responder_id':_0x5bca67['id'],'requester_id':_0x4c25d2['id'],'name':util[_0x273f('0xb')]('Caller\x20-\x20%s',_0x9fde01[_0x273f('0xc')]),'phone':_0x9fde01[_0x273f('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x273f('0xe')](_0x24f0e5[_0x273f('0xf')],_0x9fde01,'\x20'),'description':intUtil[_0x273f('0xe')](_0x24f0e5[_0x273f('0x10')],_0x9fde01,_0x273f('0x11')),'tags':getTags(_0x24f0e5[_0x273f('0x12')],_0x273f('0x13'))},getCustomFields(_0x24f0e5[_0x273f('0x14')],_0x9fde01));_0x5a01f2[_0x273f('0x15')]=_[_0x273f('0x16')](_[_0x273f('0x17')](_0x5a01f2[_0x273f('0x15')],'id'),_0x273f('0x18'));return request({'uri':util[_0x273f('0xb')]('%s/api/v2/tickets',_0x5e9bfd[_0x273f('0x19')]),'method':_0x273f('0x1a'),'body':_0x5a01f2})['then'](function(_0x342954){logger['info'](_0x273f('0x1b'));return _0x342954;});}function getUser(_0x27a23c,_0x2c32e6){if(intUtil[_0x273f('0x1c')](_0x2c32e6)){return request({'uri':util['format']('%s/api/v2/agents',_0x27a23c['remoteUri']),'qs':{'email':_0x2c32e6}})['then'](function(_0x2e6c35){if(_0x2e6c35[_0x273f('0x1d')]){logger[_0x273f('0x8')]('Agent\x20found!');return _[_0x273f('0x1e')](_0x2e6c35,function(_0x61a2e8){return _0x61a2e8['contact'][_0x273f('0x1f')]===_0x2c32e6;});}else{logger[_0x273f('0x8')](_0x273f('0x20'));return request({'uri':util[_0x273f('0xb')](_0x273f('0x21'),_0x27a23c['remoteUri'])})[_0x273f('0x22')](function(_0x2d335a){logger[_0x273f('0x8')](_0x273f('0x23'));return _0x2d335a;});}});}else{logger[_0x273f('0x8')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x273f('0x21'),_0x27a23c['remoteUri'])})[_0x273f('0x22')](function(_0x34d9ef){logger['info'](_0x273f('0x23'));return _0x34d9ef;});}}function getEndUser(_0x15f082,_0x17fed7,_0x2c7005){logger[_0x273f('0x8')](_0x273f('0x24'),_0x2c7005);return request({'uri':util[_0x273f('0xb')](_0x273f('0x25'),_0x15f082['remoteUri']),'qs':{'phone':_0x2c7005}})[_0x273f('0x22')](function(_0x17574a){if(_0x17574a[_0x273f('0x1d')]){logger[_0x273f('0x8')]('Enduser\x20found!');return _[_0x273f('0x1e')](_0x17574a,{'phone':_0x2c7005});}else{logger[_0x273f('0x8')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x273f('0xb')]('%s/api/v2/contacts',_0x15f082['remoteUri']),'method':'POST','body':{'name':_0x17fed7,'phone':_0x2c7005}})[_0x273f('0x22')](function(_0x23d609){logger[_0x273f('0x8')](_0x273f('0x26'));return _0x23d609;});}});}function getAuth(_0x684872){return util[_0x273f('0xb')]('Basic\x20%s',new Buffer(_0x684872['apiKey']+':X')[_0x273f('0x27')]('base64'));}function request(_0x36ec9e){logger[_0x273f('0x28')](_0x273f('0x29'),JSON['stringify'](_0x36ec9e));return rp(_[_0x273f('0x5')](_0x36ec9e,{'method':_0x273f('0x2a'),'headers':headers,'json':!![]}));}function getTags(_0x335fa6,_0x2a228c){var _0x37cbe7=[];if(_0x335fa6&&_0x335fa6[_0x273f('0x1d')]>0x0){_0x37cbe7=_[_0x273f('0x2b')](_0x335fa6,_0x2a228c);}return _0x37cbe7;}function getCustomFields(_0x19d181,_0x3dc1b4){var _0x4b75ef=[];var _0x57b654={'custom_fields':[]};if(_0x19d181[_0x273f('0x1d')]>0x0){_['forEach'](_0x19d181,function(_0x16e483){if(_[_0x273f('0x2c')]([_0x273f('0x2d'),'picklist'],_0x16e483[_0x273f('0x2e')])&&_0x16e483['nameField']&&!_0x16e483['customField']){_0x57b654[_0x16e483['nameField'][_0x273f('0x2f')]()]=_0x16e483['content'][_0x273f('0x27')]();}else if(_['includes']([_0x273f('0x2d'),_0x273f('0x30')],_0x16e483['type'])&&_0x16e483[_0x273f('0x31')]&&_0x16e483[_0x273f('0x32')]){_0x57b654['custom_fields'][_0x273f('0x33')]({'id':_0x16e483['idField'],'value':_0x16e483[_0x273f('0x34')]['toString']()});}else if(_0x16e483[_0x273f('0x2e')]==='variable'&&_0x16e483[_0x273f('0x35')]&&_0x16e483['idField']&&_0x16e483[_0x273f('0x32')]){_0x3dc1b4[_0x16e483[_0x273f('0x35')]]&&_0x57b654['custom_fields']['push']({'id':_0x16e483[_0x273f('0x31')],'value':_0x3dc1b4[_0x16e483[_0x273f('0x35')]]['toString']()});}else if(_0x16e483[_0x273f('0x2e')]===_0x273f('0x36')&&_0x16e483['Variable']&&_0x16e483[_0x273f('0x37')]['name']&&_0x16e483[_0x273f('0x31')]&&_0x16e483[_0x273f('0x32')]){_0x3dc1b4[_0x16e483[_0x273f('0x37')]['name'][_0x273f('0x2f')]()]&&_0x57b654[_0x273f('0x15')][_0x273f('0x33')]({'id':_0x16e483[_0x273f('0x31')],'value':_0x3dc1b4[_0x16e483[_0x273f('0x37')][_0x273f('0x13')]['toLowerCase']()][_0x273f('0x27')]()});}});}return _0x57b654;}exports[_0x273f('0x38')]=function(_0x5b5d14,_0xb5b677,_0x5dd509,_0x4d8a38,_0x1b6525,_0x27c4d3){var _0x2ef82d,_0x4f25ac;_0x27c4d3[_0x273f('0x19')]=intUtil[_0x273f('0x39')](_0x27c4d3[_0x273f('0x19')]);_0x27c4d3[_0x273f('0x3a')]=intUtil[_0x273f('0x39')](_0x27c4d3[_0x273f('0x3a')]);if(_0x1b6525&&_0x1b6525[_0x273f('0x3b')]){logger[_0x273f('0x8')]('[QUEUE]','Recording\x20is\x20enabled!');_0xb5b677['recordingURL']=util[_0x273f('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27c4d3[_0x273f('0x3a')],_0xb5b677['uniqueid'],md5(_0xb5b677['uniqueid']));}else{_0xb5b677['recordingURL']='';}headers[_0x273f('0x3c')]=getAuth(_0x27c4d3);return getUser(_0x27c4d3,_0x4d8a38[_0x273f('0x1f')])[_0x273f('0x22')](function(_0xb222a2){_0x2ef82d=_0xb222a2;logger['info'](_0x273f('0x3d'),_0x2ef82d['id']);return getEndUser(_0x27c4d3,_0xb5b677[_0x273f('0xc')],_0xb5b677[_0x273f('0xd')]);})[_0x273f('0x22')](function(_0x907800){_0x4f25ac=_0x907800;logger['info'](_0x273f('0x3e'),_0x4f25ac['id']);return getTicket(_0x27c4d3,_0x2ef82d,_0x4f25ac,_0x5dd509,_0xb5b677);})['then'](function(_0x6760f6){if(_0x6760f6&&_0x6760f6['id']){logger[_0x273f('0x8')](_0x273f('0x1b'));logger[_0x273f('0x8')](_0x273f('0x3f'),_0x6760f6['id']);logger[_0x273f('0x8')](_0x273f('0x40'),_0x273f('0x41'));emit(util['format']('user:%s',_0x4d8a38['name']),_0x273f('0x42'),{'uri':util[_0x273f('0xb')](_0x273f('0x43'),_0x27c4d3[_0x273f('0x19')],_0x6760f6['id'])});}})[_0x273f('0x44')](function(_0x4aa4fa){logger['error'](_0x273f('0x40'),JSON[_0x273f('0x45')](_0x4aa4fa));});};exports['outbound']=function(_0x56d333,_0x52a702,_0x51d0da,_0x4e957e,_0x3ad663,_0xfb7198,_0xb77824){var _0x2b7eb0,_0x40bf88;_0xfb7198['remoteUri']=intUtil['stripTrailingSlash'](_0xfb7198[_0x273f('0x19')]);_0xfb7198[_0x273f('0x3a')]=intUtil[_0x273f('0x39')](_0xfb7198[_0x273f('0x3a')]);if(_0xb77824&&_0xb77824[_0x273f('0x46')]&&_0xb77824[_0x273f('0x46')]!==_0x273f('0x47')){logger[_0x273f('0x8')](_0x273f('0x48'),_0x273f('0x49'));_0x52a702[_0x273f('0x4a')]=util[_0x273f('0xb')](_0x273f('0x4b'),_0xfb7198[_0x273f('0x3a')],_0x52a702[_0x273f('0x4c')],md5(_0x52a702[_0x273f('0x4c')]));}headers[_0x273f('0x3c')]=getAuth(_0xfb7198);return getUser(_0xfb7198,_0x4e957e['email'])[_0x273f('0x22')](function(_0x576655){_0x2b7eb0=_0x576655;logger[_0x273f('0x8')]('The\x20User\x20ID\x20is:',_0x2b7eb0['id']);return getEndUser(_0xfb7198,_0x52a702[_0x273f('0x4d')],_0x52a702[_0x273f('0x4e')]);})[_0x273f('0x22')](function(_0x4b189b){_0x40bf88=_0x4b189b;logger['info'](_0x273f('0x3e'),_0x40bf88['id']);return getTicket(_0xfb7198,_0x2b7eb0,_0x40bf88,_0x51d0da,_0x52a702);})[_0x273f('0x22')](function(_0x290910){if(_0x290910&&_0x290910['id']){logger[_0x273f('0x8')](_0x273f('0x1b'));logger[_0x273f('0x8')]('The\x20Ticket\x20ID\x20is:',_0x290910['id']);logger[_0x273f('0x8')](_0x273f('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x273f('0x4f'),_0x4e957e[_0x273f('0x13')]),'trigger:browser:url',{'uri':util[_0x273f('0xb')](_0x273f('0x43'),_0xfb7198[_0x273f('0x19')],_0x290910['id'])});}})[_0x273f('0x44')](function(_0x221023){logger[_0x273f('0x50')](_0x273f('0x48'),JSON[_0x273f('0x45')](_0x221023));});};exports[_0x273f('0x51')]=function(_0x57fed5,_0x2ce2b3,_0x5e5180,_0x30a974,_0x558191,_0x1a797f){var _0x308228,_0x9e5ada;_0x1a797f[_0x273f('0x19')]=intUtil[_0x273f('0x39')](_0x1a797f[_0x273f('0x19')]);_0x1a797f[_0x273f('0x3a')]=intUtil[_0x273f('0x39')](_0x1a797f[_0x273f('0x3a')]);if(_0x558191&&_0x558191[_0x273f('0x3b')]){logger['info']('['+_0x2ce2b3['lastevent'][_0x273f('0x52')]()+']','Recording\x20is\x20enabled!');_0x2ce2b3[_0x273f('0x4a')]=util[_0x273f('0xb')](_0x273f('0x4b'),_0x1a797f[_0x273f('0x3a')],_0x2ce2b3[_0x273f('0x4c')],md5(_0x2ce2b3['uniqueid']));}else{_0x2ce2b3[_0x273f('0x4a')]='';}headers[_0x273f('0x3c')]=getAuth(_0x1a797f);return getUser(_0x1a797f,'')[_0x273f('0x22')](function(_0x45cc48){_0x308228=_0x45cc48;logger[_0x273f('0x8')]('The\x20User\x20ID\x20is:',_0x308228['id']);return getEndUser(_0x1a797f,_0x2ce2b3['calleridname'],_0x2ce2b3['calleridnum']);})[_0x273f('0x22')](function(_0x161d3f){_0x9e5ada=_0x161d3f;logger[_0x273f('0x8')](_0x273f('0x3e'),_0x9e5ada['id']);return getTicket(_0x1a797f,_0x308228,_0x9e5ada,_0x5e5180,_0x2ce2b3);})[_0x273f('0x22')](function(_0x5d2b02){if(_0x5d2b02){logger[_0x273f('0x8')](_0x273f('0x1b'));logger[_0x273f('0x8')]('The\x20Ticket\x20ID\x20is:',_0x5d2b02['id']);}})[_0x273f('0x44')](function(_0x4274a1){logger['error']('['+_0x2ce2b3[_0x273f('0x53')][_0x273f('0x52')]()+']',JSON['stringify'](_0x4274a1));});}; \ 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 c5aed77..413ed1a 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 _0xd452=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','headers','info','Getting\x20admin\x20information','users','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','/api/selector/owners','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','userId','User\x20found:','Admin\x20selected','adminEmail','catch','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','ticketId','user:%s','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x6a9f10,_0x3b8d00){var _0x128e42=function(_0x4ec97b){while(--_0x4ec97b){_0x6a9f10['push'](_0x6a9f10['shift']());}};_0x128e42(++_0x3b8d00);}(_0xd452,0x150));var _0x2d45=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0xd452[_0x19e928];return _0x4e941f;};'use strict';var _=require('lodash');var rp=require(_0x2d45('0x0'));var md5=require('md5');var util=require('util');var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x2d45('0x1'));var config=require(_0x2d45('0x2'));var logger=require('../../../../config/logger')('freshsales');config[_0x2d45('0x3')]=_[_0x2d45('0x4')](config[_0x2d45('0x3')],{'host':_0x2d45('0x5'),'port':0x18eb});var io=require(_0x2d45('0x6'))(new Redis(config[_0x2d45('0x3')]));function getAdminId(_0x2b4393,_0x4a191c,_0x91df6,_0x2d7f41){return new Promise(function(_0x3b57f6,_0x322085){var _0x1931aa=![];var _0x5aef01={'method':'GET','uri':_0x2d7f41+'/api/selector/owners','json':!![]};_0x5aef01[_0x2d45('0x7')]=_0x91df6;logger[_0x2d45('0x8')](_0x2d45('0x9'));return rp(_0x5aef01)['then'](function(_0x4bd14d){if(_0x4bd14d){var _0xe27b28=_0x4bd14d[_0x2d45('0xa')];var _0x2d9f55=null;for(_0x2d9f55=0x0;_0x2d9f55<_0xe27b28[_0x2d45('0xb')];_0x2d9f55++){if(_0xe27b28[_0x2d9f55]['email']===_0x2b4393['adminEmail']){_0x2b4393[_0x2d45('0xc')]=_0xe27b28[_0x2d9f55]['id'];_0x1931aa=!![];}}if(_0x1931aa){logger[_0x2d45('0x8')](_0x2d45('0xd'),_0x2b4393[_0x2d45('0xc')]);_0x3b57f6(_0x2b4393);}else{_0x322085({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x322085({'statusCode':0x194,'message':_0x2d45('0xe')});}})['catch'](function(_0x28e17f){logger[_0x2d45('0xf')]('['+[_0x4a191c[_0x2d45('0x10')]()]+']',_0x28e17f[_0x2d45('0x11')]);_0x322085(_0x28e17f);});});}function getUser(_0x48c0be,_0x1d0b99,_0x2b204d){return function(_0x46dcf8){return new Promise(function(_0x1904a9,_0x3a5f22){var _0x5c542a={'method':_0x2d45('0x12'),'uri':_0x2b204d+_0x2d45('0x13'),'json':!![]};_0x5c542a['headers']=_0x1d0b99;logger[_0x2d45('0x8')](_0x2d45('0x14'));return rp(_0x5c542a)[_0x2d45('0x15')](function(_0x14e93b){if(_0x14e93b){var _0x10271d=_0x14e93b[_0x2d45('0xa')];var _0x1465d4=![];var _0x548dda=null;if(_0x46dcf8['agentEmail']!==null){logger['info'](_0x2d45('0x16'),_0x46dcf8[_0x2d45('0x17')]);_0x46dcf8[_0x2d45('0x18')]=_0x46dcf8[_0x2d45('0x17')];for(_0x548dda=0x0;_0x548dda<_0x10271d[_0x2d45('0xb')];_0x548dda++){if(_0x10271d[_0x548dda][_0x2d45('0x19')]===_0x46dcf8[_0x2d45('0x17')]){_0x1465d4=!![];_0x46dcf8[_0x2d45('0x1a')]=_0x10271d[_0x548dda]['id'];logger[_0x2d45('0x8')](_0x2d45('0x1b'),_0x46dcf8[_0x2d45('0x1a')]);}}}if(!_0x1465d4){logger['info'](_0x2d45('0x1c'));_0x46dcf8['userEmail']=_0x46dcf8[_0x2d45('0x1d')];_0x46dcf8['userId']=_0x46dcf8[_0x2d45('0xc')];_0x1465d4=!![];}if(_0x1465d4){_0x1904a9(_0x46dcf8);}else{_0x3a5f22({'statusCode':0x194,'message':_0x2d45('0xe')});}}else{_0x3a5f22({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x2d45('0x1e')](function(_0xcb7be7){logger['error']('['+[_0x48c0be[_0x2d45('0x10')]()]+']',_0xcb7be7['message']);_0x3a5f22(_0xcb7be7);});});};}function searchContact(_0x1182c5,_0x15ed90,_0x394113,_0x11c7b5){return new Promise(function(_0x195a42,_0x1f9ee6){var _0x49e7df={'method':'GET','headers':_0x15ed90,'uri':_0x1182c5+'/api/lookup?q='+_0x11c7b5+'&f='+_0x394113+_0x2d45('0x1f'),'json':!![]};rp(_0x49e7df)[_0x2d45('0x15')](function(_0x11bc5f){var _0x4d1eef=_[_0x2d45('0x20')](_0x11bc5f[_0x2d45('0x21')][_0x2d45('0x21')],[_0x394113,_0x11c7b5]);_0x195a42(_0x4d1eef);})[_0x2d45('0x1e')](function(_0x28c474){_0x1f9ee6(_0x28c474);});});}function getEndUser(_0x467a19,_0x37aba0,_0x34bc2f){return function(_0x46077d){return new Promise(function(_0x30d539,_0xb730aa){logger[_0x2d45('0x8')](util[_0x2d45('0x22')](_0x2d45('0x23'),_0x46077d['contactNumber']));searchContact(_0x34bc2f,_0x37aba0,'mobile_number',_0x46077d[_0x2d45('0x24')])['then'](function(_0x465114){if(_0x465114){_0x46077d[_0x2d45('0x25')]=_0x465114['id'];logger[_0x2d45('0x8')]('Contact\x20found\x20mobile_number:',_0x46077d[_0x2d45('0x25')]);return _0x30d539(_0x46077d);}searchContact(_0x34bc2f,_0x37aba0,_0x2d45('0x26'),_0x46077d[_0x2d45('0x24')])['then'](function(_0xd1890a){if(_0xd1890a){_0x46077d[_0x2d45('0x25')]=_0xd1890a['id'];logger[_0x2d45('0x8')](_0x2d45('0x27'),_0x46077d[_0x2d45('0x25')]);return _0x30d539(_0x46077d);}createEndUser(_0x46077d,_0x467a19,_0x37aba0,_0x34bc2f)[_0x2d45('0x15')](function(_0x3c056e){logger['info']('Contact\x20created:',_0x3c056e['endUserId']);return _0x30d539(_0x3c056e);});});})['catch'](function(_0xbfd395){_0xb730aa(_0xbfd395);});});};}function createEndUser(_0x20b093,_0xbfd152,_0x3030b0,_0x447fcf){return new Promise(function(_0x3ee269,_0x3b64d9){var _0x3d246d=moment();var _0x45860f={'method':_0x2d45('0x28'),'uri':_0x447fcf+_0x2d45('0x29'),'body':{'contact':{'last_name':_0x20b093[_0x2d45('0x24')],'work_number':_0x20b093[_0x2d45('0x24')],'mobile_number':_0x20b093['contactNumber'],'owner_id':_0x20b093['userId'],'created_at':_0x3d246d[_0x2d45('0x22')](_0x2d45('0x2a'))}},'json':!![]};_0x45860f[_0x2d45('0x7')]=_0x3030b0;logger['info'](_0x2d45('0x2b'));return rp(_0x45860f)['then'](function(_0x13b857){_0x20b093[_0x2d45('0x25')]=_0x13b857[_0x2d45('0x2c')]['id'];_0x3ee269(_0x20b093);})['catch'](function(_0x48c013){logger[_0x2d45('0xf')]('['+[_0xbfd152[_0x2d45('0x10')]()]+']',_0x48c013['message']);_0x3b64d9(_0x48c013[_0x2d45('0x11')]);});});}function getTicket(_0x28598f,_0x56becb,_0x446121,_0x1e0acb,_0x4b221b){return function(_0x2d7988){logger[_0x2d45('0x8')](_0x2d45('0x2d'));return new Promise(function(_0x45cc30,_0x1ad149){var _0x3a8237=moment();var _0x1fcaa0={'method':_0x2d45('0x28'),'uri':_0x446121+_0x2d45('0x2e'),'body':{'title':intUtil[_0x2d45('0x2f')](_0x1e0acb[_0x2d45('0x30')],_0x4b221b,'\x20'),'description':intUtil['getString'](_0x1e0acb[_0x2d45('0x31')],_0x4b221b,'\x0a'),'owner_id':_0x2d7988[_0x2d45('0x1a')],'creater_id':_0x2d7988[_0x2d45('0xc')],'targetable_id':_0x2d7988['endUserId'],'targetable_type':_0x2d45('0x32'),'created_at':_0x3a8237[_0x2d45('0x22')](_0x2d45('0x2a')),'due_date':_0x3a8237[_0x2d45('0x33')](0x1e,'m')[_0x2d45('0x22')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1fcaa0[_0x2d45('0x7')]=_0x56becb;return rp(_0x1fcaa0)['then'](function(_0x1e2183){_0x2d7988['ticketId']=_0x1e2183[_0x2d45('0x34')]['id'];logger[_0x2d45('0x8')]('Task\x20created:',_0x2d7988[_0x2d45('0x35')]);_0x45cc30(_0x2d7988);})[_0x2d45('0x1e')](function(_0x2f9d2b){logger[_0x2d45('0xf')]('['+[_0x28598f[_0x2d45('0x10')]()]+']',_0x2f9d2b[_0x2d45('0x11')]);_0x1ad149(_0x2f9d2b['message']);});});};}function emit(_0x49cca3,_0x367ad8,_0x5a63e9){var _0x1efb94={'uri':_0x49cca3+'/contacts/'+_0x5a63e9};io['to'](util[_0x2d45('0x22')](_0x2d45('0x36'),_0x367ad8))['emit'](_0x2d45('0x37'),_0x1efb94);}exports['cs']=function(_0x1ef7cb,_0x34e4bf,_0x49e766,_0x4d5f50,_0x3fbfa,_0x2ce872,_0x28e25e,_0x3a1388){var _0x9df242={};var _0x148c58={'Authorization':'Token\x20token='+_0x2ce872[_0x2d45('0x38')]};_0x2ce872[_0x2d45('0x39')]=intUtil[_0x2d45('0x3a')](_0x2ce872[_0x2d45('0x39')]);_0x2ce872['serverUrl']=intUtil[_0x2d45('0x3a')](_0x2ce872[_0x2d45('0x3b')]);var _0x233446=_0x2ce872[_0x2d45('0x39')];_0x9df242[_0x2d45('0x1d')]=_0x2ce872[_0x2d45('0x3c')];_0x9df242['contactNumber']=_0x3a1388[_0x2d45('0x3d')]()==='outbound'?_0x34e4bf[_0x2d45('0x3e')]:_0x34e4bf[_0x2d45('0x3f')];_0x9df242[_0x2d45('0x40')]=_0x3a1388===_0x2d45('0x41')||_0x3a1388===_0x2d45('0x42')?_0x2d45('0x41'):'outbound';if(_0x4d5f50){_0x9df242[_0x2d45('0x17')]=_0x4d5f50[_0x2d45('0x19')];}var _0x1b287f=util[_0x2d45('0x22')](_0x2d45('0x43'),_0x2ce872[_0x2d45('0x3b')],_0x34e4bf[_0x2d45('0x44')],md5(_0x34e4bf['uniqueid']));if(_0x3fbfa&&_0x3fbfa[_0x2d45('0x45')]){logger[_0x2d45('0x8')](_0x2d45('0x46'),_0x2d45('0x47'));_0x34e4bf[_0x2d45('0x48')]=_0x1b287f;}else if(_0x28e25e&&_0x28e25e[_0x2d45('0x49')]&&_0x28e25e[_0x2d45('0x49')]!==_0x2d45('0x4a')){logger[_0x2d45('0x8')](_0x2d45('0x4b'),_0x2d45('0x47'));_0x34e4bf[_0x2d45('0x48')]=_0x1b287f;}else{_0x34e4bf[_0x2d45('0x48')]='';}return getAdminId(_0x9df242,_0x3a1388,_0x148c58,_0x233446)[_0x2d45('0x15')](getUser(_0x3a1388,_0x148c58,_0x233446))[_0x2d45('0x15')](getEndUser(_0x3a1388,_0x148c58,_0x233446))[_0x2d45('0x15')](getTicket(_0x3a1388,_0x148c58,_0x233446,_0x49e766,_0x34e4bf))[_0x2d45('0x15')](function(_0x19ad59){logger[_0x2d45('0x8')](util[_0x2d45('0x22')](_0x2d45('0x4c'),_0x19ad59[_0x2d45('0x35')]));if(_0x3a1388!==_0x2d45('0x42')){logger[_0x2d45('0x8')]('['+[_0x3a1388[_0x2d45('0x10')]()]+']',_0x2d45('0x4d'));emit(_0x233446,_0x4d5f50[_0x2d45('0x4e')],_0x19ad59['endUserId']);}})['catch'](function(_0x5d16f0){logger[_0x2d45('0xf')]('['+[_0x3a1388[_0x2d45('0x10')]()]+_0x2d45('0x4f'),util[_0x2d45('0x50')](_0x5d16f0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x89dd=['ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','adminEmail','message','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','task','Task\x20created:'];(function(_0x4f9baf,_0x17a0a1){var _0x5dd2dd=function(_0xc553ed){while(--_0xc553ed){_0x4f9baf['push'](_0x4f9baf['shift']());}};_0x5dd2dd(++_0x17a0a1);}(_0x89dd,0x11b));var _0xd89d=function(_0x549f45,_0x2bec9d){_0x549f45=_0x549f45-0x0;var _0x5b009e=_0x89dd[_0x549f45];return _0x5b009e;};'use strict';var _=require(_0xd89d('0x0'));var rp=require('request-promise');var md5=require(_0xd89d('0x1'));var util=require(_0xd89d('0x2'));var moment=require('moment');var Promise=require(_0xd89d('0x3'));var Redis=require(_0xd89d('0x4'));var intUtil=require(_0xd89d('0x5'));var config=require(_0xd89d('0x6'));var logger=require(_0xd89d('0x7'))(_0xd89d('0x8'));config[_0xd89d('0x9')]=_[_0xd89d('0xa')](config[_0xd89d('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xd89d('0xb'))(new Redis(config[_0xd89d('0x9')]));function getAdminId(_0x56d1ad,_0x24465b,_0x11025b,_0x1c0d5a){return new Promise(function(_0x137638,_0x83cdd4){var _0x2f18c7=![];var _0x3e2e07={'method':'GET','uri':_0x1c0d5a+_0xd89d('0xc'),'json':!![]};_0x3e2e07[_0xd89d('0xd')]=_0x11025b;logger[_0xd89d('0xe')](_0xd89d('0xf'));return rp(_0x3e2e07)[_0xd89d('0x10')](function(_0x1bb124){if(_0x1bb124){var _0x231eb5=_0x1bb124['users'];var _0x5409a7=null;for(_0x5409a7=0x0;_0x5409a7<_0x231eb5[_0xd89d('0x11')];_0x5409a7++){if(_0x231eb5[_0x5409a7][_0xd89d('0x12')]===_0x56d1ad['adminEmail']){_0x56d1ad['adminId']=_0x231eb5[_0x5409a7]['id'];_0x2f18c7=!![];}}if(_0x2f18c7){logger[_0xd89d('0xe')]('Admin\x20found:',_0x56d1ad[_0xd89d('0x13')]);_0x137638(_0x56d1ad);}else{_0x83cdd4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x83cdd4({'statusCode':0x194,'message':_0xd89d('0x14')});}})[_0xd89d('0x15')](function(_0xf32677){logger[_0xd89d('0x16')]('['+[_0x24465b[_0xd89d('0x17')]()]+']',_0xf32677['message']);_0x83cdd4(_0xf32677);});});}function getUser(_0x2b3bd3,_0x2f83ca,_0x1a6577){return function(_0x55503a){return new Promise(function(_0x1af748,_0xa8dea1){var _0x54435f={'method':_0xd89d('0x18'),'uri':_0x1a6577+_0xd89d('0xc'),'json':!![]};_0x54435f[_0xd89d('0xd')]=_0x2f83ca;logger[_0xd89d('0xe')]('Getting\x20user\x20list');return rp(_0x54435f)[_0xd89d('0x10')](function(_0x491d1a){if(_0x491d1a){var _0x50e371=_0x491d1a[_0xd89d('0x19')];var _0x1249d3=![];var _0x2db0b6=null;if(_0x55503a[_0xd89d('0x1a')]!==null){logger[_0xd89d('0xe')](_0xd89d('0x1b'),_0x55503a['agentEmail']);_0x55503a[_0xd89d('0x1c')]=_0x55503a['agentEmail'];for(_0x2db0b6=0x0;_0x2db0b6<_0x50e371['length'];_0x2db0b6++){if(_0x50e371[_0x2db0b6][_0xd89d('0x12')]===_0x55503a[_0xd89d('0x1a')]){_0x1249d3=!![];_0x55503a[_0xd89d('0x1d')]=_0x50e371[_0x2db0b6]['id'];logger['info'](_0xd89d('0x1e'),_0x55503a[_0xd89d('0x1d')]);}}}if(!_0x1249d3){logger[_0xd89d('0xe')]('Admin\x20selected');_0x55503a[_0xd89d('0x1c')]=_0x55503a[_0xd89d('0x1f')];_0x55503a[_0xd89d('0x1d')]=_0x55503a['adminId'];_0x1249d3=!![];}if(_0x1249d3){_0x1af748(_0x55503a);}else{_0xa8dea1({'statusCode':0x194,'message':_0xd89d('0x14')});}}else{_0xa8dea1({'statusCode':0x194,'message':_0xd89d('0x14')});}})['catch'](function(_0x934c6e){logger[_0xd89d('0x16')]('['+[_0x2b3bd3[_0xd89d('0x17')]()]+']',_0x934c6e[_0xd89d('0x20')]);_0xa8dea1(_0x934c6e);});});};}function searchContact(_0x5e6dd4,_0x3bbb1d,_0x53a30b,_0xc95514){return new Promise(function(_0x155130,_0x3d76fd){var _0xb75dc2={'method':'GET','headers':_0x3bbb1d,'uri':_0x5e6dd4+'/api/lookup?q='+_0xc95514+_0xd89d('0x21')+_0x53a30b+_0xd89d('0x22'),'json':!![]};rp(_0xb75dc2)[_0xd89d('0x10')](function(_0x5a4bba){var _0x5418e6=_[_0xd89d('0x23')](_0x5a4bba[_0xd89d('0x24')][_0xd89d('0x24')],[_0x53a30b,_0xc95514]);_0x155130(_0x5418e6);})[_0xd89d('0x15')](function(_0x33208f){_0x3d76fd(_0x33208f);});});}function getEndUser(_0x104c21,_0x108e3a,_0x29f44b){return function(_0x3967dd){return new Promise(function(_0x2394cb,_0x2b3b94){logger['info'](util['format'](_0xd89d('0x25'),_0x3967dd['contactNumber']));searchContact(_0x29f44b,_0x108e3a,'mobile_number',_0x3967dd[_0xd89d('0x26')])['then'](function(_0x548340){if(_0x548340){_0x3967dd[_0xd89d('0x27')]=_0x548340['id'];logger[_0xd89d('0xe')](_0xd89d('0x28'),_0x3967dd[_0xd89d('0x27')]);return _0x2394cb(_0x3967dd);}searchContact(_0x29f44b,_0x108e3a,_0xd89d('0x29'),_0x3967dd[_0xd89d('0x26')])[_0xd89d('0x10')](function(_0x5be12e){if(_0x5be12e){_0x3967dd[_0xd89d('0x27')]=_0x5be12e['id'];logger[_0xd89d('0xe')](_0xd89d('0x2a'),_0x3967dd[_0xd89d('0x27')]);return _0x2394cb(_0x3967dd);}createEndUser(_0x3967dd,_0x104c21,_0x108e3a,_0x29f44b)['then'](function(_0x163ef1){logger['info'](_0xd89d('0x2b'),_0x163ef1[_0xd89d('0x27')]);return _0x2394cb(_0x163ef1);});});})[_0xd89d('0x15')](function(_0x51eaeb){_0x2b3b94(_0x51eaeb);});});};}function createEndUser(_0x3f49e1,_0x1786c4,_0x5082f,_0x46270d){return new Promise(function(_0x39e8c6,_0x365cbe){var _0x3598ca=moment();var _0x3620db={'method':'POST','uri':_0x46270d+_0xd89d('0x2c'),'body':{'contact':{'last_name':_0x3f49e1[_0xd89d('0x26')],'work_number':_0x3f49e1['contactNumber'],'mobile_number':_0x3f49e1[_0xd89d('0x26')],'owner_id':_0x3f49e1[_0xd89d('0x1d')],'created_at':_0x3598ca[_0xd89d('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x3620db['headers']=_0x5082f;logger['info'](_0xd89d('0x2e'));return rp(_0x3620db)['then'](function(_0xcc16c6){_0x3f49e1[_0xd89d('0x27')]=_0xcc16c6['contact']['id'];_0x39e8c6(_0x3f49e1);})[_0xd89d('0x15')](function(_0x426a65){logger[_0xd89d('0x16')]('['+[_0x1786c4['toUpperCase']()]+']',_0x426a65[_0xd89d('0x20')]);_0x365cbe(_0x426a65['message']);});});}function getTicket(_0x592174,_0x2704df,_0x1003a2,_0xcc3416,_0x588603){return function(_0x2a897b){logger[_0xd89d('0xe')](_0xd89d('0x2f'));return new Promise(function(_0xb7e987,_0x2e32d0){var _0x50d82c=moment();var _0x463235={'method':_0xd89d('0x30'),'uri':_0x1003a2+_0xd89d('0x31'),'body':{'title':intUtil[_0xd89d('0x32')](_0xcc3416['Subjects'],_0x588603,'\x20'),'description':intUtil[_0xd89d('0x32')](_0xcc3416[_0xd89d('0x33')],_0x588603,'\x0a'),'owner_id':_0x2a897b[_0xd89d('0x1d')],'creater_id':_0x2a897b[_0xd89d('0x13')],'targetable_id':_0x2a897b[_0xd89d('0x27')],'targetable_type':_0xd89d('0x34'),'created_at':_0x50d82c[_0xd89d('0x2d')](_0xd89d('0x35')),'due_date':_0x50d82c[_0xd89d('0x36')](0x1e,'m')[_0xd89d('0x2d')](_0xd89d('0x35'))},'json':!![]};_0x463235['headers']=_0x2704df;return rp(_0x463235)[_0xd89d('0x10')](function(_0xde0688){_0x2a897b['ticketId']=_0xde0688[_0xd89d('0x37')]['id'];logger[_0xd89d('0xe')](_0xd89d('0x38'),_0x2a897b[_0xd89d('0x39')]);_0xb7e987(_0x2a897b);})[_0xd89d('0x15')](function(_0x3725fe){logger[_0xd89d('0x16')]('['+[_0x592174[_0xd89d('0x17')]()]+']',_0x3725fe['message']);_0x2e32d0(_0x3725fe['message']);});});};}function emit(_0x53eee8,_0x40e1c3,_0x4a64e2){var _0x245538={'uri':_0x53eee8+_0xd89d('0x3a')+_0x4a64e2};io['to'](util[_0xd89d('0x2d')](_0xd89d('0x3b'),_0x40e1c3))[_0xd89d('0x3c')](_0xd89d('0x3d'),_0x245538);}exports['cs']=function(_0xb335a1,_0x71f349,_0x3dfa2d,_0x4103b6,_0x22b251,_0x309d89,_0x451479,_0x3629de){var _0x545542={};var _0x413e69={'Authorization':_0xd89d('0x3e')+_0x309d89['apiKey']};_0x309d89[_0xd89d('0x3f')]=intUtil[_0xd89d('0x40')](_0x309d89[_0xd89d('0x3f')]);_0x309d89[_0xd89d('0x41')]=intUtil[_0xd89d('0x40')](_0x309d89[_0xd89d('0x41')]);var _0x279ed3=_0x309d89[_0xd89d('0x3f')];_0x545542[_0xd89d('0x1f')]=_0x309d89[_0xd89d('0x42')];_0x545542[_0xd89d('0x26')]=_0x3629de[_0xd89d('0x43')]()===_0xd89d('0x44')?_0x71f349[_0xd89d('0x45')]:_0x71f349[_0xd89d('0x46')];_0x545542['callDirection']=_0x3629de===_0xd89d('0x47')||_0x3629de===_0xd89d('0x48')?'queue':_0xd89d('0x44');if(_0x4103b6){_0x545542['agentEmail']=_0x4103b6[_0xd89d('0x12')];}var _0x4f0978=util['format'](_0xd89d('0x49'),_0x309d89[_0xd89d('0x41')],_0x71f349['uniqueid'],md5(_0x71f349[_0xd89d('0x4a')]));if(_0x22b251&&_0x22b251[_0xd89d('0x4b')]){logger[_0xd89d('0xe')]('[QUEUE]',_0xd89d('0x4c'));_0x71f349['recordingURL']=_0x4f0978;}else if(_0x451479&&_0x451479[_0xd89d('0x4d')]&&_0x451479[_0xd89d('0x4d')]!==_0xd89d('0x4e')){logger['info'](_0xd89d('0x4f'),'Recording\x20is\x20enabled!');_0x71f349['recordingURL']=_0x4f0978;}else{_0x71f349[_0xd89d('0x50')]='';}return getAdminId(_0x545542,_0x3629de,_0x413e69,_0x279ed3)['then'](getUser(_0x3629de,_0x413e69,_0x279ed3))[_0xd89d('0x10')](getEndUser(_0x3629de,_0x413e69,_0x279ed3))[_0xd89d('0x10')](getTicket(_0x3629de,_0x413e69,_0x279ed3,_0x3dfa2d,_0x71f349))['then'](function(_0x143935){logger[_0xd89d('0xe')](util[_0xd89d('0x2d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x143935[_0xd89d('0x39')]));if(_0x3629de!==_0xd89d('0x48')){logger[_0xd89d('0xe')]('['+[_0x3629de[_0xd89d('0x17')]()]+']',_0xd89d('0x51'));emit(_0x279ed3,_0x4103b6[_0xd89d('0x52')],_0x143935[_0xd89d('0x27')]);}})[_0xd89d('0x15')](function(_0x3132ea){logger[_0xd89d('0x16')]('['+[_0x3629de[_0xd89d('0x17')]()]+_0xd89d('0x53'),util[_0xd89d('0x54')](_0x3132ea,{'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 7b50695..4737ba8 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 _0xa313=['includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','servicenow','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','exec'];(function(_0xea4792,_0x3195d7){var _0x8243ee=function(_0x439fd5){while(--_0x439fd5){_0xea4792['push'](_0xea4792['shift']());}};_0x8243ee(++_0x3195d7);}(_0xa313,0x1af));var _0x3a31=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xa313[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0x3a31('0x0'));var util=require(_0x3a31('0x1'));var zendesk=require(_0x3a31('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x3a31('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x3a31('0x4'));var desk=require(_0x3a31('0x5'));var vtiger=require(_0x3a31('0x6'));var servicenow=require(_0x3a31('0x7'));var dynamics365=require(_0x3a31('0x8'));var freshsales=require(_0x3a31('0x9'));var integrations=[_0x3a31('0xa'),_0x3a31('0xb'),_0x3a31('0xc'),_0x3a31('0xd'),_0x3a31('0xe'),_0x3a31('0xf'),_0x3a31('0x10'),_0x3a31('0x11'),_0x3a31('0x12'),'servicenow'];exports[_0x3a31('0x13')]=function(_0xdb2e24,_0x22ad26,_0x208ac0,_0x266ac8,_0x3a05ce,_0x207fa7){if(_0x208ac0){if(_[_0x3a31('0x14')](integrations,_0xdb2e24[_0x3a31('0x15')][_0x3a31('0x16')]())){try{var _0xb2a72f=null;var _0x15a8cf='';var _0x2a1cf6=_0x208ac0[_0xdb2e24[_0x3a31('0x15')][_0x3a31('0x16')]()];if(_0x2a1cf6){var _0x19a587=_0x2a1cf6[_0xdb2e24['data2']];if(_0x19a587){var _0x3982f3=_[_0x3a31('0x17')](_0x19a587[_0x3a31('0x18')],{'id':parseInt(_0xdb2e24[_0x3a31('0x19')],0xa)});if(_0x3982f3){if(_0x266ac8){if(_0x3a05ce&&_0x22ad26[_0x3a31('0x1a')]){_0x15a8cf='queue';}else if(_0x22ad26[_0x3a31('0x1b')]){_0x15a8cf=_0x3a31('0x1c');}else{console['log'](_0x3a31('0x1d'),_0x22ad26);}}else{_0x15a8cf=_0x3a31('0x1e');}switch(_0xdb2e24[_0x3a31('0x15')][_0x3a31('0x16')]()){case _0x3a31('0xa'):zendesk[_0x15a8cf](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7);break;case _0x3a31('0xb'):salesforce[_0x15a8cf](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7);break;case'sugarcrm':sugarcrm[_0x15a8cf](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7);break;case _0x3a31('0xd'):freshdesk[_0x15a8cf](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7);break;case _0x3a31('0xe'):zoho[_0x15a8cf](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7);break;case _0x3a31('0xf'):desk[_0x15a8cf](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7);break;case _0x3a31('0x10'):vtiger[_0x15a8cf](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7);break;case _0x3a31('0x12'):freshsales['cs'](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7,_0x15a8cf);break;case _0x3a31('0x1f'):servicenow['cs'](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7,_0x15a8cf);break;case _0x3a31('0x11'):dynamics365['cs'](_0xdb2e24,_0x22ad26,_0x3982f3,_0x266ac8,_0x3a05ce,_0x19a587,_0x207fa7,_0x15a8cf);break;default:console[_0x3a31('0x20')](_0x3a31('0x21'));}}else{_0xb2a72f=require(_0x3a31('0x22'))(_0xdb2e24[_0x3a31('0x15')][_0x3a31('0x16')]());_0xb2a72f[_0x3a31('0x23')](_0x3a31('0x24'),util[_0x3a31('0x25')](_0x3a31('0x26'),_0xdb2e24[_0x3a31('0x15')]['toLowerCase'](),_0xdb2e24[_0x3a31('0x19')]));}}else{_0xb2a72f=require(_0x3a31('0x22'))(_0xdb2e24[_0x3a31('0x15')][_0x3a31('0x16')]());_0xb2a72f['error'](_0x3a31('0x24'),util[_0x3a31('0x25')](_0x3a31('0x27'),_0xdb2e24[_0x3a31('0x15')][_0x3a31('0x16')](),_0xdb2e24[_0x3a31('0x28')]));}}else{}}catch(_0x3c6dff){console[_0x3a31('0x23')](_0x3c6dff);}}}}; \ No newline at end of file +var _0xbafb=['error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','dynamics365','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','salesforce','vtiger','freshsales','unknown\x20integration','../../../../config/logger'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xbafb,0x71));var _0xbbaf=function(_0x2c071c,_0x29d82d){_0x2c071c=_0x2c071c-0x0;var _0x573e12=_0xbafb[_0x2c071c];return _0x573e12;};'use strict';var _=require(_0xbbaf('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xbbaf('0x1'));var sugarcrm=require(_0xbbaf('0x2'));var freshdesk=require(_0xbbaf('0x3'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xbbaf('0x4'));var servicenow=require(_0xbbaf('0x5'));var dynamics365=require(_0xbbaf('0x6'));var freshsales=require(_0xbbaf('0x7'));var integrations=[_0xbbaf('0x8'),'salesforce','sugarcrm',_0xbbaf('0x9'),_0xbbaf('0xa'),_0xbbaf('0xb'),'vtiger',_0xbbaf('0xc'),'freshsales',_0xbbaf('0xd')];exports['exec']=function(_0x267375,_0x15cc14,_0x1039b3,_0xb2346b,_0x2b9477,_0x157e71){if(_0x1039b3){if(_[_0xbbaf('0xe')](integrations,_0x267375[_0xbbaf('0xf')][_0xbbaf('0x10')]())){try{var _0x3502a1=null;var _0x6a10d8='';var _0x11d19b=_0x1039b3[_0x267375[_0xbbaf('0xf')][_0xbbaf('0x10')]()];if(_0x11d19b){var _0x153597=_0x11d19b[_0x267375[_0xbbaf('0x11')]];if(_0x153597){var _0x505863=_[_0xbbaf('0x12')](_0x153597[_0xbbaf('0x13')],{'id':parseInt(_0x267375[_0xbbaf('0x14')],0xa)});if(_0x505863){if(_0xb2346b){if(_0x2b9477&&_0x15cc14[_0xbbaf('0x15')]){_0x6a10d8='queue';}else if(_0x15cc14[_0xbbaf('0x16')]){_0x6a10d8=_0xbbaf('0x17');}else{console[_0xbbaf('0x18')](_0xbbaf('0x19'),_0x15cc14);}}else{_0x6a10d8='unmanaged';}switch(_0x267375[_0xbbaf('0xf')][_0xbbaf('0x10')]()){case'zendesk':zendesk[_0x6a10d8](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71);break;case _0xbbaf('0x1a'):salesforce[_0x6a10d8](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71);break;case'sugarcrm':sugarcrm[_0x6a10d8](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71);break;case _0xbbaf('0x9'):freshdesk[_0x6a10d8](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71);break;case _0xbbaf('0xa'):zoho[_0x6a10d8](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71);break;case _0xbbaf('0xb'):desk[_0x6a10d8](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71);break;case _0xbbaf('0x1b'):vtiger[_0x6a10d8](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71);break;case _0xbbaf('0x1c'):freshsales['cs'](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71,_0x6a10d8);break;case _0xbbaf('0xd'):servicenow['cs'](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71,_0x6a10d8);break;case _0xbbaf('0xc'):dynamics365['cs'](_0x267375,_0x15cc14,_0x505863,_0xb2346b,_0x2b9477,_0x153597,_0x157e71,_0x6a10d8);break;default:console[_0xbbaf('0x18')](_0xbbaf('0x1d'));}}else{_0x3502a1=require(_0xbbaf('0x1e'))(_0x267375[_0xbbaf('0xf')][_0xbbaf('0x10')]());_0x3502a1[_0xbbaf('0x1f')](_0xbbaf('0x20'),util[_0xbbaf('0x21')](_0xbbaf('0x22'),_0x267375[_0xbbaf('0xf')][_0xbbaf('0x10')](),_0x267375[_0xbbaf('0x14')]));}}else{_0x3502a1=require(_0xbbaf('0x1e'))(_0x267375[_0xbbaf('0xf')]['toLowerCase']());_0x3502a1[_0xbbaf('0x1f')](_0xbbaf('0x20'),util[_0xbbaf('0x21')](_0xbbaf('0x23'),_0x267375[_0xbbaf('0xf')][_0xbbaf('0x10')](),_0x267375[_0xbbaf('0x11')]));}}else{}}catch(_0x476dd7){console[_0xbbaf('0x1f')](_0x476dd7);}}}}; \ 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 152ccd8..4a21a5f 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 _0x876f=['Caller\x20-\x20%s','No\x20Company','forEach','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','sobject','create','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','account_contact_lead','additionalSearchAccount','Account','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','LastName','','format'];(function(_0x1acdb3,_0x11e2ea){var _0x437af0=function(_0x30853f){while(--_0x30853f){_0x1acdb3['push'](_0x1acdb3['shift']());}};_0x437af0(++_0x11e2ea);}(_0x876f,0x1b6));var _0xf876=function(_0xca21b9,_0x547db7){_0xca21b9=_0xca21b9-0x0;var _0x430f1d=_0x876f[_0xca21b9];return _0x430f1d;};'use strict';var _=require(_0xf876('0x0'));var rp=require('request-promise');var moment=require(_0xf876('0x1'));var BPromise=require(_0xf876('0x2'));var md5=require(_0xf876('0x3'));var jsforce=require(_0xf876('0x4'));var util=require(_0xf876('0x5'));var Redis=require(_0xf876('0x6'));var intUtil=require(_0xf876('0x7'));var config=require('../../../../config/environment');var logger=require(_0xf876('0x8'))(_0xf876('0x9'));config[_0xf876('0xa')]=_[_0xf876('0xb')](config[_0xf876('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf876('0xc'))(new Redis(config[_0xf876('0xa')]));function emit(_0x14e862,_0x3bd0cb,_0x41a50f){io['to'](_0x14e862)['emit'](_0x3bd0cb,_0x41a50f);}function getTicket(_0x1c2392,_0x56451d,_0x510c95,_0x403e85,_0x1d711b,_0x4a19a5,_0x2c4e47,_0x2f2e02){var _0x44b609=Object[_0xf876('0xd')]({},{'OwnerId':_0x56451d['id'],'Subject':intUtil[_0xf876('0xe')](_0x403e85[_0xf876('0xf')],_0x1d711b,'\x20'),'Description':intUtil[_0xf876('0xe')](_0x403e85[_0xf876('0x10')],_0x1d711b,'\x0a')},getCustomFields(_0x4a19a5,_0x1d711b));if(_0x510c95){if(_0x403e85[_0xf876('0x11')]===_0xf876('0x12')){_0x44b609[_0xf876('0x13')]=moment[_0xf876('0x14')]();_0x44b609[_0xf876('0x15')]=![];_0x44b609['IsRecurrence']=![];if(_0x510c95[_0xf876('0x16')]===_0xf876('0x17')||_0x510c95[_0xf876('0x16')]===_0xf876('0x18')){_0x44b609[_0xf876('0x19')]=_0x510c95['id'];}else if(_0x510c95[_0xf876('0x16')]===_0xf876('0x1a')){_0x44b609[_0xf876('0x1b')]=_0x510c95['id'];}}else if(_0x403e85[_0xf876('0x11')]===_0xf876('0x1c')){if(_0x510c95[_0xf876('0x16')]==='contact'){_0x44b609[_0xf876('0x1d')]=_0x510c95['id'];}else if(_0x510c95[_0xf876('0x16')]===_0xf876('0x1a')){_0x44b609[_0xf876('0x1e')]=_0x510c95['id'];}else if(_0x510c95['endUserType']==='lead'&&_0x403e85[_0xf876('0x1f')]){_0x44b609[_0x403e85[_0xf876('0x1f')]]=_0x510c95['id'];}else{logger[_0xf876('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2c4e47[_0xf876('0x21')](_0x403e85[_0xf876('0x11')])[_0xf876('0x22')](_0x44b609);}function getUser(_0x152f65,_0x16bdf4,_0x4aeedd){if(!_[_0xf876('0x23')](_0x16bdf4)&&intUtil[_0xf876('0x24')](_0x16bdf4)){var _0x4cda11={'Email':_0x16bdf4};var _0x428243={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4aeedd[_0xf876('0x21')](_0xf876('0x25'))[_0xf876('0x26')](_0x4cda11,_0x428243)[_0xf876('0x27')]()['then'](function(_0x36d953){if(_0x36d953[_0xf876('0x28')]){var _0x3532a7=_[_0xf876('0x26')](_0x36d953,function(_0x51e50f){return _0x51e50f[_0xf876('0x29')]===_0x16bdf4;});if(_0x3532a7){logger[_0xf876('0x20')](_0xf876('0x2a'),_0x16bdf4);return BPromise[_0xf876('0x2b')]({'id':_0x3532a7['Id'],'name':_0x3532a7[_0xf876('0x2c')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x16bdf4);return _0x4aeedd[_0xf876('0x2d')]()[_0xf876('0x2e')](function(_0x2fd3c5){return BPromise[_0xf876('0x2b')]({'id':_0x2fd3c5[_0xf876('0x2f')],'name':_0x2fd3c5[_0xf876('0x30')]});});}});}else{logger[_0xf876('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x16bdf4);return _0x4aeedd[_0xf876('0x2d')]()[_0xf876('0x2e')](function(_0x5d736a){return BPromise[_0xf876('0x2b')]({'id':_0x5d736a[_0xf876('0x2f')],'name':_0x5d736a['display_name']});});}}function getEndUser(_0x3cb8e3,_0x31eddd,_0x439888,_0x386140,_0x45f065){var _0x230977={'$or':{'Phone':_0x386140}};var _0x2f6a4f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf876('0x2b')]()['then'](function(){logger[_0xf876('0x20')](_0xf876('0x31'),_0x386140,_0x31eddd[_0xf876('0x32')]);switch(_0x31eddd[_0xf876('0x32')]){case _0xf876('0x33'):var _0x503d89=_[_0xf876('0x34')](_0x230977);if(_0x31eddd[_0xf876('0x35')]){var _0x372830={};_0x372830[_0x31eddd[_0xf876('0x35')]]=_0x386140;_['merge'](_0x503d89[_0xf876('0x36')],_0x372830);}return _0x45f065[_0xf876('0x21')](_0xf876('0x37'))[_0xf876('0x26')](_0x503d89,_0x2f6a4f)[_0xf876('0x27')]()[_0xf876('0x2e')](function(_0x22c221){if(_0x22c221&&_0x22c221[_0xf876('0x28')]){return _0x22c221;}else{var _0x1182aa=_['cloneDeep'](_0x230977);if(_0x31eddd[_0xf876('0x38')]){var _0x1945b2={};_0x1945b2[_0x31eddd['additionalSearchLead']]=_0x386140;_[_0xf876('0x39')](_0x1182aa[_0xf876('0x36')],_0x1945b2);}return _0x45f065[_0xf876('0x21')]('Lead')[_0xf876('0x26')](_0x1182aa,_0x2f6a4f);}});case _0xf876('0x3a'):var _0x3c216a=_['cloneDeep'](_0x230977);if(_0x31eddd['additionalSearchAccount']){var _0x372830={};_0x372830[_0x31eddd[_0xf876('0x3b')]]=_0x386140;_['merge'](_0x3c216a['$or'],_0x372830);}return _0x45f065['sobject'](_0xf876('0x3c'))['find'](_0x3c216a,_0x2f6a4f)[_0xf876('0x27')]()['then'](function(_0x70c9a){if(_0x70c9a&&_0x70c9a[_0xf876('0x28')]){return _0x70c9a;}else{var _0x2f05fc=_[_0xf876('0x34')](_0x230977);if(_0x31eddd[_0xf876('0x35')]){var _0x18a544={};_0x18a544[_0x31eddd[_0xf876('0x35')]]=_0x386140;_[_0xf876('0x39')](_0x2f05fc[_0xf876('0x36')],_0x18a544);}return _0x45f065[_0xf876('0x21')]('Contact')[_0xf876('0x26')](_0x2f05fc,_0x2f6a4f)['then'](function(_0xc6bd1d){if(_0xc6bd1d&&_0xc6bd1d[_0xf876('0x28')]){return _0xc6bd1d;}else{var _0x211315=_[_0xf876('0x34')](_0x230977);if(_0x31eddd[_0xf876('0x38')]){var _0x66777e={};_0x66777e[_0x31eddd['additionalSearchLead']]=_0x386140;_[_0xf876('0x39')](_0x211315[_0xf876('0x36')],_0x66777e);}return _0x45f065[_0xf876('0x21')]('Lead')[_0xf876('0x26')](_0x211315,_0x2f6a4f);}});}});case _0xf876('0x17'):var _0x503d89=_['cloneDeep'](_0x230977);if(_0x31eddd['additionalSearchContact']){var _0x372830={};_0x372830[_0x31eddd['additionalSearchContact']]=_0x386140;_[_0xf876('0x39')](_0x503d89['$or'],_0x372830);}return _0x45f065[_0xf876('0x21')](_0xf876('0x37'))['find'](_0x503d89,_0x2f6a4f)[_0xf876('0x27')]();case _0xf876('0x18'):var _0x5c904e=_[_0xf876('0x34')](_0x230977);if(_0x31eddd['additionalSearchLead']){var _0x372830={};_0x372830[_0x31eddd[_0xf876('0x38')]]=_0x386140;_['merge'](_0x5c904e[_0xf876('0x36')],_0x372830);}return _0x45f065[_0xf876('0x21')](_0xf876('0x3d'))[_0xf876('0x26')](_0x5c904e,_0x2f6a4f);case _0xf876('0x1a'):var _0x3c216a=_['cloneDeep'](_0x230977);if(_0x31eddd[_0xf876('0x3b')]){var _0x372830={};_0x372830[_0x31eddd['additionalSearchAccount']]=_0x386140;_['merge'](_0x3c216a[_0xf876('0x36')],_0x372830);}return _0x45f065['sobject'](_0xf876('0x3c'))[_0xf876('0x26')](_0x3c216a,_0x2f6a4f);default:return null;}})[_0xf876('0x2e')](function(_0x426581){if(_0x426581&&_0x426581['length']){var _0x80a6e3=_[_0xf876('0x3e')](_0x426581);if(_0x80a6e3){return BPromise[_0xf876('0x2b')]({'id':_0x80a6e3['Id'],'name':_0x80a6e3[_0xf876('0x2c')],'phone':_0x80a6e3[_0xf876('0x3f')],'endUserType':_0x80a6e3[_0xf876('0x40')][_0xf876('0x41')][_0xf876('0x42')]()});}}})[_0xf876('0x2e')](function(_0x2981ad){if(_0x2981ad){logger['info'](_0xf876('0x43'),_0x2981ad[_0xf876('0x16')],_0x386140);return BPromise[_0xf876('0x2b')](_0x2981ad);}else{logger['info'](_0xf876('0x44'),_0x386140);var _0x3c8485={'Phone':_0x386140};if(_0x31eddd['moduleCreate']){if(_0x31eddd['moduleCreate']===_0xf876('0x17')){logger['info'](_0xf876('0x45'),_0x386140,_0x31eddd[_0xf876('0x46')]);_0x3c8485[_0xf876('0x47')]=_0x439888!==_0xf876('0x48')?_0x439888:util[_0xf876('0x49')](_0xf876('0x4a'),_0x386140);}else if(_0x31eddd[_0xf876('0x46')]==='lead'){logger[_0xf876('0x20')](_0xf876('0x45'),_0x386140,_0x31eddd[_0xf876('0x46')]);_0x3c8485[_0xf876('0x47')]=_0x439888!==_0xf876('0x48')?_0x439888:util[_0xf876('0x49')](_0xf876('0x4a'),_0x386140);_0x3c8485['Company']=_0xf876('0x4b');}else if(_0x31eddd[_0xf876('0x46')]===_0xf876('0x1a')){logger[_0xf876('0x20')](_0xf876('0x45'),_0x386140,_0x31eddd[_0xf876('0x46')]);_0x3c8485[_0xf876('0x2c')]=_0x439888!==_0xf876('0x48')?_0x439888:util[_0xf876('0x49')](_0xf876('0x4a'),_0x386140);}else{return null;}}return _0x45f065[_0xf876('0x21')](_['upperFirst'](_0x31eddd[_0xf876('0x46')]))['create'](_0x3c8485)[_0xf876('0x2e')](function(_0x1a4e27){return BPromise[_0xf876('0x2b')]({'id':_0x1a4e27['id'],'endUserType':_0x31eddd['moduleCreate']});});}});}function getCustomFields(_0x5f006b,_0x225193){var _0x3124e5={};if(_0x5f006b[_0xf876('0x28')]>0x0){_[_0xf876('0x4c')](_0x5f006b,function(_0x1e6507){if(_['includes']([_0xf876('0x4d'),_0xf876('0x4e')],_0x1e6507[_0xf876('0x41')])&&_0x1e6507[_0xf876('0x4f')]){_0x3124e5[_0x1e6507[_0xf876('0x4f')]]=_0x1e6507[_0xf876('0x50')][_0xf876('0x51')]();}else if(_0x1e6507[_0xf876('0x41')]==='variable'&&_0x1e6507[_0xf876('0x52')]&&_0x1e6507[_0xf876('0x4f')]){_0x225193[_0x1e6507[_0xf876('0x52')]]&&(_0x3124e5[_0x1e6507[_0xf876('0x4f')]]=_0x225193[_0x1e6507[_0xf876('0x52')]]['toString']());}else if(_0x1e6507[_0xf876('0x41')]===_0xf876('0x53')&&_0x1e6507[_0xf876('0x54')]&&_0x1e6507[_0xf876('0x54')][_0xf876('0x55')]&&_0x1e6507[_0xf876('0x4f')]){_0x225193[_0x1e6507[_0xf876('0x54')]['name'][_0xf876('0x42')]()]&&(_0x3124e5[_0x1e6507[_0xf876('0x4f')]]=_0x225193[_0x1e6507['Variable'][_0xf876('0x55')][_0xf876('0x42')]()][_0xf876('0x51')]());}});}return _0x3124e5;}function getConnection(_0x12fa6c){var _0x5a4855=_0x12fa6c['password']['concat'](_0x12fa6c[_0xf876('0x56')]);var _0x118547=new jsforce[(_0xf876('0x57'))]({'oauth2':{'loginUrl':_0x12fa6c['remoteUri']||_0xf876('0x58'),'clientId':_0x12fa6c[_0xf876('0x59')],'clientSecret':_0x12fa6c[_0xf876('0x5a')]}});return _0x118547['login'](_0x12fa6c[_0xf876('0x5b')],_0x5a4855)[_0xf876('0x2e')](function(){logger[_0xf876('0x20')](_0xf876('0x5c'));return _0x118547;});}exports['queue']=function(_0x4fd93e,_0x18aa48,_0x57283d,_0x149e4a,_0xca099a,_0x54789b){var _0x33d4c3,_0x388885,_0x16acd5,_0x27b19f;_0x54789b[_0xf876('0x5d')]=intUtil[_0xf876('0x5e')](_0x54789b['serverUrl']);_0x54789b[_0xf876('0x5f')]=intUtil[_0xf876('0x5e')](_0x54789b['remoteUri']);if(_0xca099a&&_0xca099a[_0xf876('0x60')]){logger['info'](_0xf876('0x61'),_0xf876('0x62'));_0x18aa48[_0xf876('0x63')]=util[_0xf876('0x49')](_0xf876('0x64'),_0x54789b[_0xf876('0x5d')],_0x18aa48[_0xf876('0x65')],md5(_0x18aa48[_0xf876('0x65')]));}else{_0x18aa48[_0xf876('0x63')]='';}return getConnection(_0x54789b)[_0xf876('0x2e')](function(_0x3c4133){_0x27b19f=_0x3c4133;return getUser(_0x54789b,_0x149e4a[_0xf876('0x66')],_0x27b19f);})[_0xf876('0x2e')](function(_0x59a509){_0x33d4c3=_0x59a509;return getEndUser(_0x54789b,_0x57283d,_0x18aa48[_0xf876('0x67')],_0x18aa48['calleridnum'],_0x27b19f);})[_0xf876('0x2e')](function(_0x3e44a9){_0x388885=_0x3e44a9;return getTicket(_0x54789b,_0x33d4c3,_0x388885,_0x57283d,_0x18aa48,_0x57283d[_0xf876('0x68')],_0x27b19f,_0xf876('0x69'));})[_0xf876('0x2e')](function(_0x33adbe){_0x16acd5=_0x33adbe;logger['info'](_0xf876('0x6a'),_0x16acd5['id']);logger[_0xf876('0x20')](_0xf876('0x6b'),_0x16acd5['id'],_0x149e4a[_0xf876('0x55')],_0x54789b[_0xf876('0x41')]);switch(_0x54789b[_0xf876('0x41')]){case _0xf876('0x6c'):emit(util[_0xf876('0x49')](_0xf876('0x6d'),_0x149e4a[_0xf876('0x55')]),'trigger:salesforce:display',{'recordId':_0x16acd5['id']});break;case'newTab':emit(util['format'](_0xf876('0x6d'),_0x149e4a['name']),_0xf876('0x6e'),{'uri':util[_0xf876('0x49')]('%s/%s/e',_0x27b19f[_0xf876('0x6f')],_0x16acd5['id'])});break;default:logger['error'](_0xf876('0x70'));}})[_0xf876('0x71')](function(_0x494788){logger[_0xf876('0x72')](_0xf876('0x61'),_0x494788);});};exports[_0xf876('0x73')]=function(_0x21c75c,_0x2ccd89,_0x20646f,_0x4d1cb7,_0x5a48dc,_0x158884,_0xd725f6){var _0x23aabe,_0x32d9b1,_0x229212,_0x9f4606;_0x158884[_0xf876('0x5d')]=intUtil['stripTrailingSlash'](_0x158884[_0xf876('0x5d')]);_0x158884[_0xf876('0x5f')]=intUtil[_0xf876('0x5e')](_0x158884[_0xf876('0x5f')]);if(_0xd725f6&&_0xd725f6[_0xf876('0x74')]&&_0xd725f6['recordingFormat']!==_0xf876('0x75')){logger[_0xf876('0x20')](_0xf876('0x76'),_0xf876('0x62'));_0x2ccd89[_0xf876('0x63')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x158884[_0xf876('0x5d')],_0x2ccd89[_0xf876('0x65')],md5(_0x2ccd89['uniqueid']));}return getConnection(_0x158884)[_0xf876('0x2e')](function(_0x2d5516){_0x9f4606=_0x2d5516;return getUser(_0x158884,_0x4d1cb7[_0xf876('0x66')],_0x9f4606);})[_0xf876('0x2e')](function(_0x2a6eb2){_0x23aabe=_0x2a6eb2;return getEndUser(_0x158884,_0x20646f,_0x2ccd89[_0xf876('0x77')],_0x2ccd89[_0xf876('0x78')],_0x9f4606);})[_0xf876('0x2e')](function(_0x5406f7){_0x32d9b1=_0x5406f7;return getTicket(_0x158884,_0x23aabe,_0x32d9b1,_0x20646f,_0x2ccd89,_0x20646f[_0xf876('0x68')],_0x9f4606,_0xf876('0x73'));})[_0xf876('0x2e')](function(_0x30dfd4){_0x229212=_0x30dfd4;logger[_0xf876('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x229212['id']);logger['info'](_0xf876('0x79'),_0x229212['id'],_0x4d1cb7[_0xf876('0x55')],_0x158884[_0xf876('0x41')]);switch(_0x158884[_0xf876('0x41')]){case _0xf876('0x6c'):emit(util['format'](_0xf876('0x6d'),_0x4d1cb7[_0xf876('0x55')]),_0xf876('0x7a'),{'recordId':_0x229212['id']});break;case'newTab':emit(util[_0xf876('0x49')](_0xf876('0x6d'),_0x4d1cb7['name']),_0xf876('0x6e'),{'uri':util[_0xf876('0x49')](_0xf876('0x7b'),_0x9f4606[_0xf876('0x6f')],_0x229212['id'])});break;default:logger[_0xf876('0x72')](_0xf876('0x76'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x286ec7){logger[_0xf876('0x72')]('[OUTBOUND]',_0x286ec7);});};exports['unmanaged']=function(_0x441184,_0x7ab898,_0x4feb37,_0x58a3af,_0x54cde9,_0x1a42a4){var _0x562239,_0x3192b1,_0x51d98f,_0x1fd364;_0x1a42a4[_0xf876('0x5d')]=intUtil[_0xf876('0x5e')](_0x1a42a4[_0xf876('0x5d')]);_0x1a42a4[_0xf876('0x5f')]=intUtil[_0xf876('0x5e')](_0x1a42a4['remoteUri']);if(_0x54cde9&&_0x54cde9[_0xf876('0x60')]){logger[_0xf876('0x20')]('['+_0x7ab898[_0xf876('0x7c')]['toUpperCase']()+']',_0xf876('0x62'));_0x7ab898[_0xf876('0x63')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1a42a4[_0xf876('0x5d')],_0x7ab898[_0xf876('0x65')],md5(_0x7ab898[_0xf876('0x65')]));}else{_0x7ab898[_0xf876('0x63')]='';}return getConnection(_0x1a42a4)[_0xf876('0x2e')](function(_0x4f3d9d){_0x1fd364=_0x4f3d9d;if(!_[_0xf876('0x23')](_0x58a3af)){return getUser(_0x1a42a4,_0x58a3af['name'],_0x1fd364);}else{return getUser(_0x1a42a4,null,_0x1fd364);}})['then'](function(_0x12701b){_0x562239=_0x12701b;return getEndUser(_0x1a42a4,_0x4feb37,_0x7ab898[_0xf876('0x67')],_0x7ab898['calleridnum'],_0x1fd364);})[_0xf876('0x2e')](function(_0x4e4718){_0x3192b1=_0x4e4718;return getTicket(_0x1a42a4,_0x562239,_0x3192b1,_0x4feb37,_0x7ab898,_0x4feb37[_0xf876('0x68')],_0x1fd364);})[_0xf876('0x2e')](function(_0x160e43){_0x51d98f=_0x160e43;logger[_0xf876('0x20')]('['+_0x7ab898[_0xf876('0x7c')][_0xf876('0x7d')]()+_0xf876('0x7e'),_0x51d98f['id']);logger['info']('['+_0x7ab898[_0xf876('0x7c')]['toUpperCase']()+_0xf876('0x7f'),_0x1a42a4[_0xf876('0x41')]);})[_0xf876('0x71')](function(_0xcd4d1e){logger[_0xf876('0x72')]('['+_0x7ab898['lastevent'][_0xf876('0x7d')]()+']',_0xcd4d1e);});}; \ No newline at end of file +var _0xcc79=['email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','Case','contact','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','Email','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','display_name','identity','user_id','then','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','length','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','lead','Company','Name','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x4209e4,_0x19f259){var _0x5d368d=function(_0x2db6a2){while(--_0x2db6a2){_0x4209e4['push'](_0x4209e4['shift']());}};_0x5d368d(++_0x19f259);}(_0xcc79,0x11e));var _0x9cc7=function(_0x2a8fe6,_0x3bb1ff){_0x2a8fe6=_0x2a8fe6-0x0;var _0x2927af=_0xcc79[_0x2a8fe6];return _0x2927af;};'use strict';var _=require(_0x9cc7('0x0'));var rp=require(_0x9cc7('0x1'));var moment=require(_0x9cc7('0x2'));var BPromise=require(_0x9cc7('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x9cc7('0x4'));var Redis=require(_0x9cc7('0x5'));var intUtil=require(_0x9cc7('0x6'));var config=require(_0x9cc7('0x7'));var logger=require('../../../../config/logger')(_0x9cc7('0x8'));config[_0x9cc7('0x9')]=_[_0x9cc7('0xa')](config[_0x9cc7('0x9')],{'host':_0x9cc7('0xb'),'port':0x18eb});var io=require(_0x9cc7('0xc'))(new Redis(config[_0x9cc7('0x9')]));function emit(_0x589569,_0x392244,_0xfb05fd){io['to'](_0x589569)[_0x9cc7('0xd')](_0x392244,_0xfb05fd);}function getTicket(_0x40e39f,_0x1945b4,_0xd1a8cc,_0x1923e7,_0x5026ad,_0x405dce,_0x2fca68,_0x4156b1){var _0x39870e=Object['assign']({},{'OwnerId':_0x1945b4['id'],'Subject':intUtil['getString'](_0x1923e7['Subjects'],_0x5026ad,'\x20'),'Description':intUtil[_0x9cc7('0xe')](_0x1923e7[_0x9cc7('0xf')],_0x5026ad,'\x0a')},getCustomFields(_0x405dce,_0x5026ad));if(_0xd1a8cc){if(_0x1923e7[_0x9cc7('0x10')]==='Task'){_0x39870e['ActivityDate']=moment[_0x9cc7('0x11')]();_0x39870e[_0x9cc7('0x12')]=![];_0x39870e[_0x9cc7('0x13')]=![];if(_0xd1a8cc[_0x9cc7('0x14')]==='contact'||_0xd1a8cc[_0x9cc7('0x14')]==='lead'){_0x39870e[_0x9cc7('0x15')]=_0xd1a8cc['id'];}else if(_0xd1a8cc[_0x9cc7('0x14')]===_0x9cc7('0x16')){_0x39870e['WhatId']=_0xd1a8cc['id'];}}else if(_0x1923e7['ticketType']===_0x9cc7('0x17')){if(_0xd1a8cc['endUserType']===_0x9cc7('0x18')){_0x39870e['ContactId']=_0xd1a8cc['id'];}else if(_0xd1a8cc[_0x9cc7('0x14')]===_0x9cc7('0x16')){_0x39870e['AccountId']=_0xd1a8cc['id'];}else if(_0xd1a8cc['endUserType']==='lead'&&_0x1923e7[_0x9cc7('0x19')]){_0x39870e[_0x1923e7['leadId']]=_0xd1a8cc['id'];}else{logger[_0x9cc7('0x1a')](_0x9cc7('0x1b'));}}}return _0x2fca68['sobject'](_0x1923e7[_0x9cc7('0x10')])[_0x9cc7('0x1c')](_0x39870e);}function getUser(_0x463061,_0x4de7b0,_0x14933f){if(!_[_0x9cc7('0x1d')](_0x4de7b0)&&intUtil[_0x9cc7('0x1e')](_0x4de7b0)){var _0x1bf749={'Email':_0x4de7b0};var _0x447753={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x14933f[_0x9cc7('0x1f')](_0x9cc7('0x20'))[_0x9cc7('0x21')](_0x1bf749,_0x447753)['execute']()['then'](function(_0x398887){if(_0x398887['length']){var _0x98ac08=_['find'](_0x398887,function(_0x16ea96){return _0x16ea96[_0x9cc7('0x22')]===_0x4de7b0;});if(_0x98ac08){logger['info'](_0x9cc7('0x23'),_0x4de7b0);return BPromise['resolve']({'id':_0x98ac08['Id'],'name':_0x98ac08['Name']});}}else{logger[_0x9cc7('0x1a')](_0x9cc7('0x24'),_0x4de7b0);return _0x14933f['identity']()['then'](function(_0x17e5ce){return BPromise[_0x9cc7('0x25')]({'id':_0x17e5ce['user_id'],'name':_0x17e5ce[_0x9cc7('0x26')]});});}});}else{logger[_0x9cc7('0x1a')](_0x9cc7('0x24'),_0x4de7b0);return _0x14933f[_0x9cc7('0x27')]()['then'](function(_0x3e3c8d){return BPromise['resolve']({'id':_0x3e3c8d[_0x9cc7('0x28')],'name':_0x3e3c8d[_0x9cc7('0x26')]});});}}function getEndUser(_0x199614,_0x132962,_0x6968,_0x5a24fd,_0x357992){var _0x3fa505={'$or':{'Phone':_0x5a24fd}};var _0xe1b701={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9cc7('0x25')]()[_0x9cc7('0x29')](function(){logger[_0x9cc7('0x1a')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5a24fd,_0x132962['moduleSearch']);switch(_0x132962[_0x9cc7('0x2a')]){case _0x9cc7('0x2b'):var _0xe292f7=_[_0x9cc7('0x2c')](_0x3fa505);if(_0x132962[_0x9cc7('0x2d')]){var _0x4a2623={};_0x4a2623[_0x132962[_0x9cc7('0x2d')]]=_0x5a24fd;_['merge'](_0xe292f7[_0x9cc7('0x2e')],_0x4a2623);}return _0x357992[_0x9cc7('0x1f')](_0x9cc7('0x2f'))[_0x9cc7('0x21')](_0xe292f7,_0xe1b701)[_0x9cc7('0x30')]()[_0x9cc7('0x29')](function(_0x4ace83){if(_0x4ace83&&_0x4ace83['length']){return _0x4ace83;}else{var _0x2e37fb=_[_0x9cc7('0x2c')](_0x3fa505);if(_0x132962['additionalSearchLead']){var _0x22b6e6={};_0x22b6e6[_0x132962[_0x9cc7('0x31')]]=_0x5a24fd;_[_0x9cc7('0x32')](_0x2e37fb[_0x9cc7('0x2e')],_0x22b6e6);}return _0x357992[_0x9cc7('0x1f')](_0x9cc7('0x33'))[_0x9cc7('0x21')](_0x2e37fb,_0xe1b701);}});case _0x9cc7('0x34'):var _0x38675a=_['cloneDeep'](_0x3fa505);if(_0x132962[_0x9cc7('0x35')]){var _0x4a2623={};_0x4a2623[_0x132962['additionalSearchAccount']]=_0x5a24fd;_[_0x9cc7('0x32')](_0x38675a[_0x9cc7('0x2e')],_0x4a2623);}return _0x357992[_0x9cc7('0x1f')](_0x9cc7('0x36'))[_0x9cc7('0x21')](_0x38675a,_0xe1b701)[_0x9cc7('0x30')]()[_0x9cc7('0x29')](function(_0x1098e8){if(_0x1098e8&&_0x1098e8[_0x9cc7('0x37')]){return _0x1098e8;}else{var _0x5250c7=_['cloneDeep'](_0x3fa505);if(_0x132962[_0x9cc7('0x2d')]){var _0x455acf={};_0x455acf[_0x132962[_0x9cc7('0x2d')]]=_0x5a24fd;_['merge'](_0x5250c7[_0x9cc7('0x2e')],_0x455acf);}return _0x357992[_0x9cc7('0x1f')](_0x9cc7('0x2f'))['find'](_0x5250c7,_0xe1b701)[_0x9cc7('0x29')](function(_0x33a1e4){if(_0x33a1e4&&_0x33a1e4['length']){return _0x33a1e4;}else{var _0x3fa700=_['cloneDeep'](_0x3fa505);if(_0x132962[_0x9cc7('0x31')]){var _0x559977={};_0x559977[_0x132962[_0x9cc7('0x31')]]=_0x5a24fd;_[_0x9cc7('0x32')](_0x3fa700[_0x9cc7('0x2e')],_0x559977);}return _0x357992[_0x9cc7('0x1f')](_0x9cc7('0x33'))['find'](_0x3fa700,_0xe1b701);}});}});case _0x9cc7('0x18'):var _0xe292f7=_[_0x9cc7('0x2c')](_0x3fa505);if(_0x132962[_0x9cc7('0x2d')]){var _0x4a2623={};_0x4a2623[_0x132962[_0x9cc7('0x2d')]]=_0x5a24fd;_[_0x9cc7('0x32')](_0xe292f7['$or'],_0x4a2623);}return _0x357992[_0x9cc7('0x1f')](_0x9cc7('0x2f'))['find'](_0xe292f7,_0xe1b701)['execute']();case'lead':var _0x5b7f39=_['cloneDeep'](_0x3fa505);if(_0x132962[_0x9cc7('0x31')]){var _0x4a2623={};_0x4a2623[_0x132962['additionalSearchLead']]=_0x5a24fd;_[_0x9cc7('0x32')](_0x5b7f39[_0x9cc7('0x2e')],_0x4a2623);}return _0x357992[_0x9cc7('0x1f')](_0x9cc7('0x33'))[_0x9cc7('0x21')](_0x5b7f39,_0xe1b701);case'account':var _0x38675a=_['cloneDeep'](_0x3fa505);if(_0x132962['additionalSearchAccount']){var _0x4a2623={};_0x4a2623[_0x132962['additionalSearchAccount']]=_0x5a24fd;_[_0x9cc7('0x32')](_0x38675a[_0x9cc7('0x2e')],_0x4a2623);}return _0x357992['sobject'](_0x9cc7('0x36'))[_0x9cc7('0x21')](_0x38675a,_0xe1b701);default:return null;}})['then'](function(_0x4d3746){if(_0x4d3746&&_0x4d3746[_0x9cc7('0x37')]){var _0x85b5c1=_[_0x9cc7('0x38')](_0x4d3746);if(_0x85b5c1){return BPromise[_0x9cc7('0x25')]({'id':_0x85b5c1['Id'],'name':_0x85b5c1['Name'],'phone':_0x85b5c1[_0x9cc7('0x39')],'endUserType':_0x85b5c1[_0x9cc7('0x3a')][_0x9cc7('0x3b')][_0x9cc7('0x3c')]()});}}})['then'](function(_0x34ef31){if(_0x34ef31){logger[_0x9cc7('0x1a')](_0x9cc7('0x3d'),_0x34ef31[_0x9cc7('0x14')],_0x5a24fd);return BPromise[_0x9cc7('0x25')](_0x34ef31);}else{logger[_0x9cc7('0x1a')](_0x9cc7('0x3e'),_0x5a24fd);var _0x585929={'Phone':_0x5a24fd};if(_0x132962[_0x9cc7('0x3f')]){if(_0x132962[_0x9cc7('0x3f')]===_0x9cc7('0x18')){logger[_0x9cc7('0x1a')](_0x9cc7('0x40'),_0x5a24fd,_0x132962['moduleCreate']);_0x585929[_0x9cc7('0x41')]=_0x6968!==_0x9cc7('0x42')?_0x6968:util[_0x9cc7('0x43')](_0x9cc7('0x44'),_0x5a24fd);}else if(_0x132962[_0x9cc7('0x3f')]===_0x9cc7('0x45')){logger[_0x9cc7('0x1a')](_0x9cc7('0x40'),_0x5a24fd,_0x132962[_0x9cc7('0x3f')]);_0x585929[_0x9cc7('0x41')]=_0x6968!==_0x9cc7('0x42')?_0x6968:util[_0x9cc7('0x43')](_0x9cc7('0x44'),_0x5a24fd);_0x585929[_0x9cc7('0x46')]='No\x20Company';}else if(_0x132962['moduleCreate']===_0x9cc7('0x16')){logger[_0x9cc7('0x1a')](_0x9cc7('0x40'),_0x5a24fd,_0x132962['moduleCreate']);_0x585929[_0x9cc7('0x47')]=_0x6968!==_0x9cc7('0x42')?_0x6968:util['format'](_0x9cc7('0x44'),_0x5a24fd);}else{return null;}}return _0x357992[_0x9cc7('0x1f')](_[_0x9cc7('0x48')](_0x132962[_0x9cc7('0x3f')]))[_0x9cc7('0x1c')](_0x585929)[_0x9cc7('0x29')](function(_0x3c510c){return BPromise[_0x9cc7('0x25')]({'id':_0x3c510c['id'],'endUserType':_0x132962[_0x9cc7('0x3f')]});});}});}function getCustomFields(_0x2ea0ab,_0xf78392){var _0x96ecdb={};if(_0x2ea0ab[_0x9cc7('0x37')]>0x0){_[_0x9cc7('0x49')](_0x2ea0ab,function(_0xad1dcb){if(_[_0x9cc7('0x4a')]([_0x9cc7('0x4b'),'picklist'],_0xad1dcb[_0x9cc7('0x3b')])&&_0xad1dcb[_0x9cc7('0x4c')]){_0x96ecdb[_0xad1dcb[_0x9cc7('0x4c')]]=_0xad1dcb[_0x9cc7('0x4d')][_0x9cc7('0x4e')]();}else if(_0xad1dcb[_0x9cc7('0x3b')]===_0x9cc7('0x4f')&&_0xad1dcb[_0x9cc7('0x50')]&&_0xad1dcb[_0x9cc7('0x4c')]){_0xf78392[_0xad1dcb[_0x9cc7('0x50')]]&&(_0x96ecdb[_0xad1dcb[_0x9cc7('0x4c')]]=_0xf78392[_0xad1dcb[_0x9cc7('0x50')]][_0x9cc7('0x4e')]());}else if(_0xad1dcb[_0x9cc7('0x3b')]===_0x9cc7('0x51')&&_0xad1dcb['Variable']&&_0xad1dcb[_0x9cc7('0x52')][_0x9cc7('0x53')]&&_0xad1dcb[_0x9cc7('0x4c')]){_0xf78392[_0xad1dcb[_0x9cc7('0x52')][_0x9cc7('0x53')][_0x9cc7('0x3c')]()]&&(_0x96ecdb[_0xad1dcb[_0x9cc7('0x4c')]]=_0xf78392[_0xad1dcb[_0x9cc7('0x52')]['name'][_0x9cc7('0x3c')]()][_0x9cc7('0x4e')]());}});}return _0x96ecdb;}function getConnection(_0x8becc1){var _0x4ce2df=_0x8becc1[_0x9cc7('0x54')][_0x9cc7('0x55')](_0x8becc1[_0x9cc7('0x56')]);var _0x38e001=new jsforce['Connection']({'oauth2':{'loginUrl':_0x8becc1[_0x9cc7('0x57')]||'https://login.salesforce.com','clientId':_0x8becc1[_0x9cc7('0x58')],'clientSecret':_0x8becc1[_0x9cc7('0x59')]}});return _0x38e001[_0x9cc7('0x5a')](_0x8becc1[_0x9cc7('0x5b')],_0x4ce2df)[_0x9cc7('0x29')](function(){logger[_0x9cc7('0x1a')](_0x9cc7('0x5c'));return _0x38e001;});}exports['queue']=function(_0x546c1a,_0x2c0d65,_0x9af129,_0x42fcd8,_0x1fa38a,_0x34a344){var _0x145868,_0x284f4d,_0x5cc76a,_0x3ccbf8;_0x34a344['serverUrl']=intUtil[_0x9cc7('0x5d')](_0x34a344[_0x9cc7('0x5e')]);_0x34a344['remoteUri']=intUtil[_0x9cc7('0x5d')](_0x34a344['remoteUri']);if(_0x1fa38a&&_0x1fa38a[_0x9cc7('0x5f')]){logger['info'](_0x9cc7('0x60'),_0x9cc7('0x61'));_0x2c0d65[_0x9cc7('0x62')]=util[_0x9cc7('0x43')](_0x9cc7('0x63'),_0x34a344[_0x9cc7('0x5e')],_0x2c0d65[_0x9cc7('0x64')],md5(_0x2c0d65[_0x9cc7('0x64')]));}else{_0x2c0d65[_0x9cc7('0x62')]='';}return getConnection(_0x34a344)[_0x9cc7('0x29')](function(_0x11df7a){_0x3ccbf8=_0x11df7a;return getUser(_0x34a344,_0x42fcd8[_0x9cc7('0x65')],_0x3ccbf8);})[_0x9cc7('0x29')](function(_0x3a2d40){_0x145868=_0x3a2d40;return getEndUser(_0x34a344,_0x9af129,_0x2c0d65['calleridname'],_0x2c0d65[_0x9cc7('0x66')],_0x3ccbf8);})[_0x9cc7('0x29')](function(_0x450c03){_0x284f4d=_0x450c03;return getTicket(_0x34a344,_0x145868,_0x284f4d,_0x9af129,_0x2c0d65,_0x9af129[_0x9cc7('0x67')],_0x3ccbf8,_0x9cc7('0x68'));})[_0x9cc7('0x29')](function(_0x50258e){_0x5cc76a=_0x50258e;logger[_0x9cc7('0x1a')](_0x9cc7('0x69'),_0x5cc76a['id']);logger[_0x9cc7('0x1a')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5cc76a['id'],_0x42fcd8['name'],_0x34a344[_0x9cc7('0x3b')]);switch(_0x34a344['type']){case'integrationTab':emit(util['format'](_0x9cc7('0x6a'),_0x42fcd8[_0x9cc7('0x53')]),_0x9cc7('0x6b'),{'recordId':_0x5cc76a['id']});break;case _0x9cc7('0x6c'):emit(util[_0x9cc7('0x43')](_0x9cc7('0x6a'),_0x42fcd8[_0x9cc7('0x53')]),_0x9cc7('0x6d'),{'uri':util[_0x9cc7('0x43')](_0x9cc7('0x6e'),_0x3ccbf8['instanceUrl'],_0x5cc76a['id'])});break;default:logger[_0x9cc7('0x6f')](_0x9cc7('0x70'));}})[_0x9cc7('0x71')](function(_0xf8f5f9){logger[_0x9cc7('0x6f')](_0x9cc7('0x60'),_0xf8f5f9);});};exports['outbound']=function(_0x444993,_0x4234fb,_0x4c4b98,_0x4438ce,_0x14941c,_0x391e4e,_0x17dea6){var _0x1ced04,_0x9270b0,_0x50bed9,_0x595bf2;_0x391e4e[_0x9cc7('0x5e')]=intUtil['stripTrailingSlash'](_0x391e4e[_0x9cc7('0x5e')]);_0x391e4e[_0x9cc7('0x57')]=intUtil['stripTrailingSlash'](_0x391e4e[_0x9cc7('0x57')]);if(_0x17dea6&&_0x17dea6[_0x9cc7('0x72')]&&_0x17dea6[_0x9cc7('0x72')]!=='none'){logger[_0x9cc7('0x1a')](_0x9cc7('0x73'),'Recording\x20is\x20enabled!');_0x4234fb[_0x9cc7('0x62')]=util[_0x9cc7('0x43')](_0x9cc7('0x63'),_0x391e4e['serverUrl'],_0x4234fb['uniqueid'],md5(_0x4234fb[_0x9cc7('0x64')]));}return getConnection(_0x391e4e)[_0x9cc7('0x29')](function(_0x4d4005){_0x595bf2=_0x4d4005;return getUser(_0x391e4e,_0x4438ce[_0x9cc7('0x65')],_0x595bf2);})['then'](function(_0xda3bf9){_0x1ced04=_0xda3bf9;return getEndUser(_0x391e4e,_0x4c4b98,_0x4234fb[_0x9cc7('0x74')],_0x4234fb[_0x9cc7('0x75')],_0x595bf2);})['then'](function(_0x57471d){_0x9270b0=_0x57471d;return getTicket(_0x391e4e,_0x1ced04,_0x9270b0,_0x4c4b98,_0x4234fb,_0x4c4b98[_0x9cc7('0x67')],_0x595bf2,_0x9cc7('0x76'));})['then'](function(_0x6da3fe){_0x50bed9=_0x6da3fe;logger[_0x9cc7('0x1a')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x50bed9['id']);logger['info'](_0x9cc7('0x77'),_0x50bed9['id'],_0x4438ce['name'],_0x391e4e[_0x9cc7('0x3b')]);switch(_0x391e4e[_0x9cc7('0x3b')]){case _0x9cc7('0x78'):emit(util[_0x9cc7('0x43')](_0x9cc7('0x6a'),_0x4438ce[_0x9cc7('0x53')]),_0x9cc7('0x6b'),{'recordId':_0x50bed9['id']});break;case _0x9cc7('0x6c'):emit(util[_0x9cc7('0x43')]('user:%s',_0x4438ce['name']),_0x9cc7('0x6d'),{'uri':util[_0x9cc7('0x43')](_0x9cc7('0x6e'),_0x595bf2[_0x9cc7('0x79')],_0x50bed9['id'])});break;default:logger['error']('[OUTBOUND]',_0x9cc7('0x7a'));}})[_0x9cc7('0x71')](function(_0x58304d){logger['error'](_0x9cc7('0x73'),_0x58304d);});};exports[_0x9cc7('0x7b')]=function(_0x5c5606,_0x422cf0,_0x33856c,_0x3e628c,_0xa924e6,_0x34962e){var _0x34048c,_0x4d5404,_0x14033d,_0x389537;_0x34962e[_0x9cc7('0x5e')]=intUtil[_0x9cc7('0x5d')](_0x34962e[_0x9cc7('0x5e')]);_0x34962e['remoteUri']=intUtil[_0x9cc7('0x5d')](_0x34962e[_0x9cc7('0x57')]);if(_0xa924e6&&_0xa924e6[_0x9cc7('0x5f')]){logger[_0x9cc7('0x1a')]('['+_0x422cf0[_0x9cc7('0x7c')][_0x9cc7('0x7d')]()+']','Recording\x20is\x20enabled!');_0x422cf0[_0x9cc7('0x62')]=util[_0x9cc7('0x43')](_0x9cc7('0x63'),_0x34962e['serverUrl'],_0x422cf0[_0x9cc7('0x64')],md5(_0x422cf0[_0x9cc7('0x64')]));}else{_0x422cf0[_0x9cc7('0x62')]='';}return getConnection(_0x34962e)[_0x9cc7('0x29')](function(_0x3b5771){_0x389537=_0x3b5771;if(!_['isNil'](_0x3e628c)){return getUser(_0x34962e,_0x3e628c[_0x9cc7('0x53')],_0x389537);}else{return getUser(_0x34962e,null,_0x389537);}})[_0x9cc7('0x29')](function(_0x1ee0dd){_0x34048c=_0x1ee0dd;return getEndUser(_0x34962e,_0x33856c,_0x422cf0[_0x9cc7('0x7e')],_0x422cf0[_0x9cc7('0x66')],_0x389537);})[_0x9cc7('0x29')](function(_0x6c77a8){_0x4d5404=_0x6c77a8;return getTicket(_0x34962e,_0x34048c,_0x4d5404,_0x33856c,_0x422cf0,_0x33856c[_0x9cc7('0x67')],_0x389537);})[_0x9cc7('0x29')](function(_0x1f23ff){_0x14033d=_0x1f23ff;logger[_0x9cc7('0x1a')]('['+_0x422cf0[_0x9cc7('0x7c')][_0x9cc7('0x7d')]()+_0x9cc7('0x7f'),_0x14033d['id']);logger['info']('['+_0x422cf0[_0x9cc7('0x7c')]['toUpperCase']()+_0x9cc7('0x80'),_0x34962e[_0x9cc7('0x3b')]);})[_0x9cc7('0x71')](function(_0x4063a9){logger['error']('['+_0x422cf0[_0x9cc7('0x7c')][_0x9cc7('0x7d')]()+']',_0x4063a9);});}; \ 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 27b6871..1109685 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 _0x0473=['servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','sys_user?','endUserNumber','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','picklist','type','nameField','content','toString','string','idField','customField','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/environment','../../../../config/logger'];(function(_0xe29334,_0x475ff1){var _0x255ca1=function(_0x472a31){while(--_0x472a31){_0xe29334['push'](_0xe29334['shift']());}};_0x255ca1(++_0x475ff1);}(_0x0473,0x66));var _0x3047=function(_0x1960f9,_0x1edb2a){_0x1960f9=_0x1960f9-0x0;var _0x5bb364=_0x0473[_0x1960f9];return _0x5bb364;};'use strict';var _=require(_0x3047('0x0'));var Promise=require(_0x3047('0x1'));var rp=require(_0x3047('0x2'));var util=require(_0x3047('0x3'));var md5=require(_0x3047('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3047('0x5'));var logger=require(_0x3047('0x6'))(_0x3047('0x7'));config[_0x3047('0x8')]=_['defaults'](config[_0x3047('0x8')],{'host':_0x3047('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3047('0x8')]));function getAdminUser(_0xe0270b,_0x1daa18,_0x55ffb9,_0xc34658,_0x25327a,_0x1de345){return new Promise(function(_0x529c5e,_0x588f46){var _0x294202={'method':_0x3047('0xa'),'uri':_0xc34658+_0x3047('0xb')+'&'+_0x25327a+'&'+_0x1de345,'auth':_0x1daa18,'json':!![]};return rp(_0x294202)[_0x3047('0xc')](function(_0xdf9977){if(_0xdf9977[_0x3047('0xd')][_0x3047('0xe')]>0x0){_0x55ffb9[_0x3047('0xf')]=_0xdf9977[_0x3047('0xd')][0x0]['sys_id'];}logger[_0x3047('0x10')]('['+[_0xe0270b[_0x3047('0x11')]()]+_0x3047('0x12'),_0x55ffb9);_0x529c5e(_0x55ffb9);})[_0x3047('0x13')](function(_0x30e09c){logger[_0x3047('0x14')]('['+[_0xe0270b['toUpperCase']()]+']',_0x30e09c[_0x3047('0x15')]);_0x588f46(_0x30e09c['message']);});});}function getUser(_0x406def,_0x348983,_0xf8916f,_0x1784fe,_0x4aa391){return function(_0x2c4ebe){logger['info']('['+[_0x406def[_0x3047('0x11')]()]+_0x3047('0x16'),_0x2c4ebe);return new Promise(function(_0x267d82,_0x2a7ae4){if(intUtil[_0x3047('0x17')](_0x2c4ebe[_0x3047('0x18')])){var _0x55e401={'method':_0x3047('0xa'),'uri':_0xf8916f+_0x3047('0x19')+_0x2c4ebe[_0x3047('0x18')]+'&'+_0x1784fe+'&'+_0x4aa391,'auth':_0x348983,'json':!![]};logger[_0x3047('0x10')]('['+[_0x406def[_0x3047('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x55e401);return rp(_0x55e401)[_0x3047('0xc')](function(_0x36b6ae){logger[_0x3047('0x10')]('['+[_0x406def[_0x3047('0x11')]()]+_0x3047('0x1a'),_0x36b6ae);if(_0x36b6ae[_0x3047('0xd')][_0x3047('0xe')]>0x0&&String(_0x36b6ae[_0x3047('0xd')][0x0][_0x3047('0x1b')])===_0x3047('0x1c')){_0x2c4ebe[_0x3047('0x1d')]=_0x36b6ae[_0x3047('0xd')][0x0][_0x3047('0x1e')];}else{_0x2c4ebe['userId']=_0x2c4ebe['adminId'];_0x2c4ebe[_0x3047('0x18')]=_0x2c4ebe['adminEmail'];}logger[_0x3047('0x10')]('['+[_0x406def[_0x3047('0x11')]()]+_0x3047('0x1f'),_0x2c4ebe);_0x267d82(_0x2c4ebe);})[_0x3047('0x13')](function(_0x1a9f8e){logger[_0x3047('0x14')]('['+[_0x406def[_0x3047('0x11')]()]+']',_0x1a9f8e['message']);_0x2a7ae4(_0x1a9f8e[_0x3047('0x15')]);});}else{logger['info']('['+[_0x406def[_0x3047('0x11')]()]+_0x3047('0x20'));_0x2c4ebe[_0x3047('0x1d')]=_0x2c4ebe['adminId'];_0x2c4ebe[_0x3047('0x18')]=_0x2c4ebe[_0x3047('0x21')];_0x267d82(_0x2c4ebe);}});};}function createEndUser(_0x3b8a4b,_0x1fb917,_0x17c310,_0x1ca233,_0x48558e){logger['info']('['+[_0x3b8a4b['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x17c310);return new Promise(function(_0x32fb35,_0x1502a7){var _0xf50b8b={'method':'POST','uri':_0x1ca233+_0x3047('0x22')+_0x48558e,'body':{'user_name':_0x17c310[_0x3047('0x23')],'roles':'user','first_name':_0x17c310[_0x3047('0x23')],'active':_0x3047('0x1c'),'date_format':_0x3047('0x24'),'phone':_0x17c310['endUserNumber']},'auth':_0x1fb917,'json':!![]};return rp(_0xf50b8b)[_0x3047('0xc')](function(_0x3f76c3){logger[_0x3047('0x10')]('['+[_0x3b8a4b[_0x3047('0x11')]()]+'],\x20EndUser\x20schema',_0x3f76c3[_0x3047('0xd')]);_0x17c310[_0x3047('0x25')]=_0x3f76c3['result']['sys_id'];_0x32fb35(_0x17c310);})[_0x3047('0x13')](function(_0x1db12d){logger[_0x3047('0x14')]('['+[_0x3b8a4b['toUpperCase']()]+']',_0x1db12d[_0x3047('0x15')]);_0x1502a7(_0x1db12d[_0x3047('0x15')]);});});}function getEndUser(_0x2b806c,_0x337518,_0x277c68,_0x2b8a8c,_0x233246){return function(_0xc9d1f0){logger[_0x3047('0x10')]('['+[_0x2b806c[_0x3047('0x11')]()]+_0x3047('0x26'),_0xc9d1f0);return new Promise(function(_0x44d81e,_0x3364ee){var _0x47d684={'method':_0x3047('0xa'),'uri':_0x277c68+_0x3047('0x27')+_0xc9d1f0[_0x3047('0x23')]+'&'+_0x2b8a8c+'&'+_0x233246,'auth':_0x337518,'json':!![]};return rp(_0x47d684)['then'](function(_0x2245b4){if(_0x2245b4[_0x3047('0xd')][_0x3047('0xe')]>0x0){_0xc9d1f0[_0x3047('0x25')]=_0x2245b4[_0x3047('0xd')][0x0][_0x3047('0x1e')];logger[_0x3047('0x10')]('['+[_0x2b806c['toUpperCase']()]+'],\x20getEndUser\x20crm',_0xc9d1f0);_0x44d81e(_0xc9d1f0);}else{return createEndUser(_0x2b806c,_0x337518,_0xc9d1f0,_0x277c68,_0x2b8a8c)[_0x3047('0xc')](function(_0xc0e617){logger[_0x3047('0x10')]('['+[_0x2b806c[_0x3047('0x11')]()]+'],\x20createEndUser\x20crm',_0xc0e617);_0x44d81e(_0xc0e617);});}})[_0x3047('0x13')](function(_0x945c3e){logger[_0x3047('0x14')]('['+[_0x2b806c[_0x3047('0x11')]()]+']',_0x945c3e['message']);_0x3364ee(_0x945c3e[_0x3047('0x15')]);});});};}function getCustomFields(_0x13350e,_0x47a21f){var _0x3719d9={};if(_0x13350e[_0x3047('0xe')]>0x0){_[_0x3047('0x28')](_0x13350e,function(_0x4abfc9){if(_[_0x3047('0x29')](['string',_0x3047('0x2a')],_0x4abfc9[_0x3047('0x2b')])&&_0x4abfc9[_0x3047('0x2c')]&&!_0x4abfc9['customField']){_0x3719d9[_0x4abfc9[_0x3047('0x2c')]['toLowerCase']()]=_0x4abfc9[_0x3047('0x2d')][_0x3047('0x2e')]();}else if(_[_0x3047('0x29')]([_0x3047('0x2f'),_0x3047('0x2a')],_0x4abfc9['type'])&&_0x4abfc9[_0x3047('0x30')]&&_0x4abfc9[_0x3047('0x31')]){_0x3719d9[_0x4abfc9[_0x3047('0x30')][_0x3047('0x32')]()]=_0x4abfc9[_0x3047('0x2d')][_0x3047('0x2e')]();}else if(_0x4abfc9[_0x3047('0x2b')]===_0x3047('0x33')&&_0x4abfc9[_0x3047('0x34')]&&_0x4abfc9[_0x3047('0x30')]&&_0x4abfc9[_0x3047('0x31')]){_0x3719d9[_0x4abfc9[_0x3047('0x30')][_0x3047('0x32')]()]=_0x47a21f[_0x4abfc9[_0x3047('0x34')]][_0x3047('0x2e')]();}else if(_0x4abfc9['type']===_0x3047('0x35')&&_0x4abfc9['Variable']&&_0x4abfc9[_0x3047('0x36')][_0x3047('0x37')]&&_0x4abfc9[_0x3047('0x30')]&&_0x4abfc9[_0x3047('0x31')]){_0x3719d9[_0x4abfc9[_0x3047('0x30')][_0x3047('0x32')]()]=_0x47a21f[_0x4abfc9[_0x3047('0x36')][_0x3047('0x37')]['toLowerCase']()]['toString']();}});}return _0x3719d9;}function getTicket(_0x116600,_0x82195c,_0x5cb363,_0x371ccf,_0x44bd99,_0x29c407){return function(_0x332a32){logger[_0x3047('0x10')]('['+[_0x116600[_0x3047('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x332a32);return new Promise(function(_0x16a60d,_0x5811a8){var _0x329ae0=_0x116600['toLowerCase']()===_0x3047('0x38')?_0x332a32[_0x3047('0x1d')]:_0x332a32[_0x3047('0x25')];var _0x3103bb={'method':'POST','uri':_0x5cb363+_0x3047('0x39')+'?'+_0x29c407,'body':Object[_0x3047('0x3a')]({},{'active':'true','caller_id':_0x329ae0,'assigned_to':_0x332a32['userId'],'short_description':intUtil[_0x3047('0x3b')](_0x371ccf['Subjects'],_0x44bd99,'\x20'),'description':intUtil['getString'](_0x371ccf[_0x3047('0x3c')],_0x44bd99,'\x0a')},getCustomFields(_0x371ccf[_0x3047('0x3d')],_0x44bd99)),'auth':_0x82195c,'json':!![]};return rp(_0x3103bb)[_0x3047('0xc')](function(_0x197287){logger['info']('['+[_0x116600[_0x3047('0x11')]()]+_0x3047('0x3e'),_0x197287[_0x3047('0xd')]);_0x332a32[_0x3047('0x3f')]=_0x197287[_0x3047('0xd')]['sys_id'];_0x332a32[_0x3047('0x40')]=_0x197287[_0x3047('0xd')][_0x3047('0x41')];logger[_0x3047('0x10')]('['+[_0x116600[_0x3047('0x11')]()]+_0x3047('0x42'),_0x332a32);_0x16a60d(_0x332a32);})['catch'](function(_0x23951a){logger['error']('['+[_0x116600['toUpperCase']()]+']',_0x23951a[_0x3047('0x15')]);_0x5811a8(_0x23951a[_0x3047('0x15')]);});});};}function createRemoteTag(_0xd9c6e,_0xe794ea,_0x147584,_0x4b97c3){return new Promise(function(_0x4c43c3,_0x3d02c6){var _0x5c3ec8={'method':'POST','uri':_0x147584+'label'+'?'+_0x4b97c3,'body':{'short_description':_0xd9c6e,'global':!![],'active':!![],'name':_0xd9c6e},'auth':_0xe794ea,'json':!![]};return rp(_0x5c3ec8)[_0x3047('0xc')](function(_0x40dbff){var _0x50358e=_0x40dbff['result'][_0x3047('0x1e')];_0x4c43c3(_0x50358e);});});}function getRemoteTag(_0x5496f0,_0x4e1d03,_0x4e1da0,_0x56ca05,_0x145727){return new Promise(function(_0x304c12,_0x2e5004){var _0x51167a={'method':_0x3047('0xa'),'uri':_0x4e1da0+_0x3047('0x43')+_0x3047('0x44')+_0x5496f0+'&'+_0x56ca05,'auth':_0x4e1d03,'json':!![]};return rp(_0x51167a)[_0x3047('0xc')](function(_0x23985f){if(_0x23985f[_0x3047('0xd')][_0x3047('0xe')]>0x0){var _0x42d9b7=_0x23985f[_0x3047('0xd')][0x0]['sys_id'];_0x304c12(_0x42d9b7);}else{return createRemoteTag(_0x5496f0,_0x4e1d03,_0x4e1da0,_0x56ca05)['then'](function(_0x5c2f03){_0x304c12(_0x5c2f03);});}});});}function assignTagToIncident(_0xd4c9e4,_0xd5e47a,_0x289d42,_0x1a1b35,_0x568078){return new Promise(function(_0x4b7928,_0xdedb5a){var _0x586b8e={'method':'POST','uri':_0x289d42+_0x3047('0x45')+'?'+_0x568078,'body':{'label':_0xd4c9e4,'table':_0x3047('0x39'),'id_type':_0x3047('0x46'),'table_key':_0x1a1b35[_0x3047('0x3f')],'title':_0x3047('0x47')+_0x1a1b35['ticketNumber'],'id_display':_0x1a1b35[_0x3047('0x40')]},'auth':_0xd5e47a,'json':!![]};return rp(_0x586b8e)[_0x3047('0xc')](function(_0x3a4e9c){_0x4b7928();})[_0x3047('0x13')](function(){_0x4b7928();});});}function manageTags(_0xacfec7,_0x5f5af9,_0x136d9a,_0x41a404,_0x1c4ea5,_0x5dcd0c,_0x8b8a0d){return new Promise(function(_0x16c46a,_0x2a63eb){var _0x3931bb=[];_0x5f5af9[_0x3047('0x28')](function(_0x40679f){_0x3931bb[_0x3047('0x48')](getRemoteTag(_0x40679f,_0x136d9a,_0x41a404,_0x5dcd0c,_0x8b8a0d));});return Promise['all'](_0x3931bb)['then'](function(_0x3da9f2){if(_0x3da9f2[_0x3047('0xe')]){logger[_0x3047('0x10')]('['+[_0xacfec7['toUpperCase']()]+_0x3047('0x49'),_0x3da9f2);var _0x5823ca=[];_0x3da9f2['forEach'](function(_0x20316d){_0x5823ca['push'](assignTagToIncident(_0x20316d,_0x136d9a,_0x41a404,_0x1c4ea5,_0x5dcd0c));});return Promise[_0x3047('0x4a')](_0x5823ca)[_0x3047('0xc')](function(){_0x16c46a();})['catch'](function(){_0x16c46a();});}else{_0x16c46a();}});});}function getTags(_0x204b2b,_0x5327d3,_0x58e98e,_0x59b146,_0xa3c683,_0x1f30e4){return function(_0x137b4e){return new Promise(function(_0x5199fd,_0x40e67b){var _0x51d9d3=[];var _0xdfad1d=_0x59b146['Tags'];if(_0xdfad1d&&_0xdfad1d[_0x3047('0xe')]>0x0){_0x51d9d3=_[_0x3047('0x4b')](_0xdfad1d,_0x3047('0x37'));}if(_0x51d9d3[_0x3047('0xe')]>0x0){return manageTags(_0x204b2b,_0x51d9d3,_0x5327d3,_0x58e98e,_0x137b4e,_0xa3c683,_0x1f30e4)[_0x3047('0xc')](function(){_0x5199fd(_0x137b4e);});}else{_0x5199fd(_0x137b4e);}});};}function emit(_0x34f736,_0x47d216,_0x5f3e8e){var _0x232cec=_0x3047('0x4c')+_0x3047('0x4d')+_0x3047('0x4e')+_0x3047('0x4f');var _0x1486d2={'uri':_0x34f736+_0x3047('0x50')+_0x5f3e8e+_0x232cec};io['to'](util[_0x3047('0x51')]('user:%s',_0x47d216))[_0x3047('0x52')](_0x3047('0x53'),_0x1486d2);}exports['cs']=function(_0x45b986,_0x2f41b4,_0x2bfbbb,_0x11f7ba,_0x543548,_0x17f9dd,_0x1b62d7,_0x527044){var _0x45c555={};var _0x5aaff0={'user':_0x17f9dd[_0x3047('0x54')],'pass':_0x17f9dd[_0x3047('0x55')]};var _0x390cf0=_0x3047('0x56');var _0x485689=_0x3047('0x57');_0x17f9dd[_0x3047('0x58')]=intUtil['stripTrailingSlash'](_0x17f9dd[_0x3047('0x58')]);_0x17f9dd[_0x3047('0x59')]=intUtil[_0x3047('0x5a')](_0x17f9dd[_0x3047('0x59')]);var _0x5a6c61=util[_0x3047('0x51')](_0x3047('0x5b'),_0x17f9dd['remoteUri']);_0x45c555[_0x3047('0x18')]=!_[_0x3047('0x5c')](_0x11f7ba)?_0x11f7ba[_0x3047('0x5d')]:null;_0x45c555[_0x3047('0x21')]=_0x17f9dd[_0x3047('0x5d')];_0x45c555[_0x3047('0x23')]=_0x527044[_0x3047('0x32')]()===_0x3047('0x38')?_0x2f41b4[_0x3047('0x5e')]:_0x2f41b4[_0x3047('0x5f')];_0x45c555[_0x3047('0x60')]=_0x527044===_0x3047('0x61')||_0x527044==='unmanaged'?_0x3047('0x61'):_0x3047('0x38');var _0x8a4c1b=util[_0x3047('0x51')](_0x3047('0x62'),_0x17f9dd[_0x3047('0x59')],_0x2f41b4[_0x3047('0x63')],md5(_0x2f41b4[_0x3047('0x63')]));if(_0x543548&&_0x543548[_0x3047('0x64')]){logger[_0x3047('0x10')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2f41b4[_0x3047('0x65')]=_0x8a4c1b;}else if(_0x1b62d7&&_0x1b62d7[_0x3047('0x66')]&&_0x1b62d7['recordingFormat']!==_0x3047('0x67')){logger['info'](_0x3047('0x68'),_0x3047('0x69'));_0x2f41b4[_0x3047('0x65')]=_0x8a4c1b;}else{_0x2f41b4[_0x3047('0x65')]='';}return getAdminUser(_0x527044,_0x5aaff0,_0x45c555,_0x5a6c61,_0x485689,_0x390cf0)[_0x3047('0xc')](getUser(_0x527044,_0x5aaff0,_0x5a6c61,_0x485689,_0x390cf0))['then'](getEndUser(_0x527044,_0x5aaff0,_0x5a6c61,_0x485689,_0x390cf0))[_0x3047('0xc')](getTicket(_0x527044,_0x5aaff0,_0x5a6c61,_0x2bfbbb,_0x2f41b4,_0x485689))[_0x3047('0xc')](function(_0x21cd79){logger[_0x3047('0x10')](util[_0x3047('0x51')](_0x3047('0x6a'),_0x21cd79[_0x3047('0x3f')]));logger[_0x3047('0x10')](util['format']('call\x20direction:\x20%s',_0x527044));if(_0x527044!==_0x3047('0x6b')){logger[_0x3047('0x10')]('['+[_0x527044['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x17f9dd[_0x3047('0x58')],_0x11f7ba[_0x3047('0x37')],_0x21cd79[_0x3047('0x3f')]);}})[_0x3047('0x13')](function(_0x4634aa){logger[_0x3047('0x14')]('['+[_0x527044['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x3047('0x6c')](_0x4634aa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x46e9=['toString','picklist','idField','variable','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','GET','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','content'];(function(_0x60b4a3,_0xa77f5d){var _0x2263bc=function(_0x2e9191){while(--_0x2e9191){_0x60b4a3['push'](_0x60b4a3['shift']());}};_0x2263bc(++_0xa77f5d);}(_0x46e9,0xa8));var _0x946e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x46e9[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x946e('0x0'));var Promise=require(_0x946e('0x1'));var rp=require(_0x946e('0x2'));var util=require('util');var md5=require(_0x946e('0x3'));var Redis=require(_0x946e('0x4'));var intUtil=require(_0x946e('0x5'));var config=require(_0x946e('0x6'));var logger=require(_0x946e('0x7'))(_0x946e('0x8'));config['redis']=_[_0x946e('0x9')](config[_0x946e('0xa')],{'host':_0x946e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x946e('0xa')]));function getAdminUser(_0x194ef5,_0x27bb9a,_0x2f45b2,_0x28425c,_0x42256b,_0x25c3fa){return new Promise(function(_0x51353b,_0x50626e){var _0x15094f={'method':_0x946e('0xc'),'uri':_0x28425c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x42256b+'&'+_0x25c3fa,'auth':_0x27bb9a,'json':!![]};return rp(_0x15094f)[_0x946e('0xd')](function(_0x322aba){if(_0x322aba[_0x946e('0xe')][_0x946e('0xf')]>0x0){_0x2f45b2[_0x946e('0x10')]=_0x322aba[_0x946e('0xe')][0x0][_0x946e('0x11')];}logger[_0x946e('0x12')]('['+[_0x194ef5[_0x946e('0x13')]()]+_0x946e('0x14'),_0x2f45b2);_0x51353b(_0x2f45b2);})['catch'](function(_0x2a02de){logger[_0x946e('0x15')]('['+[_0x194ef5['toUpperCase']()]+']',_0x2a02de['message']);_0x50626e(_0x2a02de[_0x946e('0x16')]);});});}function getUser(_0x5c5aa8,_0x583e3c,_0x396b65,_0x542d96,_0x53368c){return function(_0x3d0e8e){logger[_0x946e('0x12')]('['+[_0x5c5aa8[_0x946e('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x3d0e8e);return new Promise(function(_0x3c8e65,_0x3b9fab){if(intUtil[_0x946e('0x17')](_0x3d0e8e[_0x946e('0x18')])){var _0x18159d={'method':_0x946e('0xc'),'uri':_0x396b65+_0x946e('0x19')+_0x3d0e8e[_0x946e('0x18')]+'&'+_0x542d96+'&'+_0x53368c,'auth':_0x583e3c,'json':!![]};logger[_0x946e('0x12')]('['+[_0x5c5aa8[_0x946e('0x13')]()]+_0x946e('0x1a'),_0x18159d);return rp(_0x18159d)['then'](function(_0x5eca44){logger['info']('['+[_0x5c5aa8[_0x946e('0x13')]()]+_0x946e('0x1b'),_0x5eca44);if(_0x5eca44[_0x946e('0xe')][_0x946e('0xf')]>0x0&&String(_0x5eca44[_0x946e('0xe')][0x0][_0x946e('0x1c')])===_0x946e('0x1d')){_0x3d0e8e[_0x946e('0x1e')]=_0x5eca44[_0x946e('0xe')][0x0]['sys_id'];}else{_0x3d0e8e['userId']=_0x3d0e8e[_0x946e('0x10')];_0x3d0e8e[_0x946e('0x18')]=_0x3d0e8e[_0x946e('0x1f')];}logger[_0x946e('0x12')]('['+[_0x5c5aa8['toUpperCase']()]+_0x946e('0x20'),_0x3d0e8e);_0x3c8e65(_0x3d0e8e);})[_0x946e('0x21')](function(_0x5f5c98){logger['error']('['+[_0x5c5aa8[_0x946e('0x13')]()]+']',_0x5f5c98['message']);_0x3b9fab(_0x5f5c98[_0x946e('0x16')]);});}else{logger[_0x946e('0x12')]('['+[_0x5c5aa8['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x3d0e8e[_0x946e('0x1e')]=_0x3d0e8e[_0x946e('0x10')];_0x3d0e8e['userEmail']=_0x3d0e8e[_0x946e('0x1f')];_0x3c8e65(_0x3d0e8e);}});};}function createEndUser(_0x370a2a,_0x199028,_0x8b1df5,_0x4d8559,_0x116ce6){logger[_0x946e('0x12')]('['+[_0x370a2a[_0x946e('0x13')]()]+_0x946e('0x22'),_0x8b1df5);return new Promise(function(_0x413b17,_0xd49b95){var _0x4b92fa={'method':_0x946e('0x23'),'uri':_0x4d8559+_0x946e('0x24')+_0x116ce6,'body':{'user_name':_0x8b1df5['endUserNumber'],'roles':_0x946e('0x25'),'first_name':_0x8b1df5[_0x946e('0x26')],'active':_0x946e('0x1d'),'date_format':_0x946e('0x27'),'phone':_0x8b1df5[_0x946e('0x26')]},'auth':_0x199028,'json':!![]};return rp(_0x4b92fa)[_0x946e('0xd')](function(_0x2dfeaa){logger[_0x946e('0x12')]('['+[_0x370a2a[_0x946e('0x13')]()]+_0x946e('0x28'),_0x2dfeaa[_0x946e('0xe')]);_0x8b1df5[_0x946e('0x29')]=_0x2dfeaa[_0x946e('0xe')][_0x946e('0x11')];_0x413b17(_0x8b1df5);})[_0x946e('0x21')](function(_0x24fa7b){logger['error']('['+[_0x370a2a[_0x946e('0x13')]()]+']',_0x24fa7b['message']);_0xd49b95(_0x24fa7b[_0x946e('0x16')]);});});}function getEndUser(_0x1e5167,_0x4ed40c,_0x977dcf,_0x44f8d1,_0x5a1797){return function(_0x3bdeb7){logger[_0x946e('0x12')]('['+[_0x1e5167[_0x946e('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x3bdeb7);return new Promise(function(_0x73e0b,_0x54a821){var _0x29685c={'method':_0x946e('0xc'),'uri':_0x977dcf+'sys_user?sysparm_query=phone%3D'+_0x3bdeb7[_0x946e('0x26')]+'&'+_0x44f8d1+'&'+_0x5a1797,'auth':_0x4ed40c,'json':!![]};return rp(_0x29685c)['then'](function(_0x407886){if(_0x407886['result'][_0x946e('0xf')]>0x0){_0x3bdeb7[_0x946e('0x29')]=_0x407886[_0x946e('0xe')][0x0][_0x946e('0x11')];logger[_0x946e('0x12')]('['+[_0x1e5167[_0x946e('0x13')]()]+_0x946e('0x2a'),_0x3bdeb7);_0x73e0b(_0x3bdeb7);}else{return createEndUser(_0x1e5167,_0x4ed40c,_0x3bdeb7,_0x977dcf,_0x44f8d1)[_0x946e('0xd')](function(_0x287008){logger[_0x946e('0x12')]('['+[_0x1e5167['toUpperCase']()]+_0x946e('0x2b'),_0x287008);_0x73e0b(_0x287008);});}})[_0x946e('0x21')](function(_0x445e40){logger[_0x946e('0x15')]('['+[_0x1e5167[_0x946e('0x13')]()]+']',_0x445e40[_0x946e('0x16')]);_0x54a821(_0x445e40[_0x946e('0x16')]);});});};}function getCustomFields(_0x511169,_0x2255b1){var _0x55b0d5={};if(_0x511169[_0x946e('0xf')]>0x0){_[_0x946e('0x2c')](_0x511169,function(_0x1eae70){if(_[_0x946e('0x2d')]([_0x946e('0x2e'),'picklist'],_0x1eae70[_0x946e('0x2f')])&&_0x1eae70[_0x946e('0x30')]&&!_0x1eae70[_0x946e('0x31')]){_0x55b0d5[_0x1eae70[_0x946e('0x30')][_0x946e('0x32')]()]=_0x1eae70[_0x946e('0x33')][_0x946e('0x34')]();}else if(_[_0x946e('0x2d')](['string',_0x946e('0x35')],_0x1eae70[_0x946e('0x2f')])&&_0x1eae70[_0x946e('0x36')]&&_0x1eae70[_0x946e('0x31')]){_0x55b0d5[_0x1eae70[_0x946e('0x36')]['toLowerCase']()]=_0x1eae70[_0x946e('0x33')][_0x946e('0x34')]();}else if(_0x1eae70[_0x946e('0x2f')]===_0x946e('0x37')&&_0x1eae70[_0x946e('0x38')]&&_0x1eae70[_0x946e('0x36')]&&_0x1eae70['customField']){_0x55b0d5[_0x1eae70[_0x946e('0x36')][_0x946e('0x32')]()]=_0x2255b1[_0x1eae70[_0x946e('0x38')]][_0x946e('0x34')]();}else if(_0x1eae70['type']===_0x946e('0x39')&&_0x1eae70['Variable']&&_0x1eae70[_0x946e('0x3a')][_0x946e('0x3b')]&&_0x1eae70[_0x946e('0x36')]&&_0x1eae70[_0x946e('0x31')]){_0x55b0d5[_0x1eae70[_0x946e('0x36')]['toLowerCase']()]=_0x2255b1[_0x1eae70[_0x946e('0x3a')][_0x946e('0x3b')][_0x946e('0x32')]()][_0x946e('0x34')]();}});}return _0x55b0d5;}function getTicket(_0xd5c2d7,_0x4d7e79,_0x43264f,_0x14d68f,_0x200b4c,_0x111ea3){return function(_0xace625){logger['info']('['+[_0xd5c2d7[_0x946e('0x13')]()]+']\x20getTicket\x20input\x20crm',_0xace625);return new Promise(function(_0x4cda03,_0x1c7ba5){var _0x5b8964=_0xd5c2d7[_0x946e('0x32')]()===_0x946e('0x3c')?_0xace625[_0x946e('0x1e')]:_0xace625['endUserId'];var _0x973281={'method':_0x946e('0x23'),'uri':_0x43264f+_0x946e('0x3d')+'?'+_0x111ea3,'body':Object[_0x946e('0x3e')]({},{'active':_0x946e('0x1d'),'caller_id':_0x5b8964,'assigned_to':_0xace625[_0x946e('0x1e')],'short_description':intUtil['getString'](_0x14d68f[_0x946e('0x3f')],_0x200b4c,'\x20'),'description':intUtil[_0x946e('0x40')](_0x14d68f['Descriptions'],_0x200b4c,'\x0a')},getCustomFields(_0x14d68f[_0x946e('0x41')],_0x200b4c)),'auth':_0x4d7e79,'json':!![]};return rp(_0x973281)[_0x946e('0xd')](function(_0x44c4b8){logger[_0x946e('0x12')]('['+[_0xd5c2d7[_0x946e('0x13')]()]+_0x946e('0x42'),_0x44c4b8[_0x946e('0xe')]);_0xace625[_0x946e('0x43')]=_0x44c4b8[_0x946e('0xe')][_0x946e('0x11')];_0xace625['ticketNumber']=_0x44c4b8['result'][_0x946e('0x44')];logger['info']('['+[_0xd5c2d7[_0x946e('0x13')]()]+']\x20getTicket\x20crm',_0xace625);_0x4cda03(_0xace625);})[_0x946e('0x21')](function(_0x470684){logger[_0x946e('0x15')]('['+[_0xd5c2d7[_0x946e('0x13')]()]+']',_0x470684[_0x946e('0x16')]);_0x1c7ba5(_0x470684[_0x946e('0x16')]);});});};}function createRemoteTag(_0x368c63,_0x457c22,_0xc6e320,_0xec5408){return new Promise(function(_0xe0f5a,_0x1f6b12){var _0x46ee70={'method':_0x946e('0x23'),'uri':_0xc6e320+_0x946e('0x45')+'?'+_0xec5408,'body':{'short_description':_0x368c63,'global':!![],'active':!![],'name':_0x368c63},'auth':_0x457c22,'json':!![]};return rp(_0x46ee70)[_0x946e('0xd')](function(_0x21a56c){var _0x541b10=_0x21a56c[_0x946e('0xe')]['sys_id'];_0xe0f5a(_0x541b10);});});}function getRemoteTag(_0x4e0615,_0x2ccf33,_0x3949d3,_0x2256eb,_0x23e8dd){return new Promise(function(_0x59822f,_0x4242c7){var _0x59bc09={'method':_0x946e('0xc'),'uri':_0x3949d3+'label'+_0x946e('0x46')+_0x4e0615+'&'+_0x2256eb,'auth':_0x2ccf33,'json':!![]};return rp(_0x59bc09)[_0x946e('0xd')](function(_0x55c7e4){if(_0x55c7e4[_0x946e('0xe')][_0x946e('0xf')]>0x0){var _0x56497a=_0x55c7e4[_0x946e('0xe')][0x0][_0x946e('0x11')];_0x59822f(_0x56497a);}else{return createRemoteTag(_0x4e0615,_0x2ccf33,_0x3949d3,_0x2256eb)['then'](function(_0x4b8fea){_0x59822f(_0x4b8fea);});}});});}function assignTagToIncident(_0x133b22,_0x19a441,_0xf9e1b3,_0x39b480,_0x2b2716){return new Promise(function(_0x3221c3,_0x5237af){var _0x35aab8={'method':'POST','uri':_0xf9e1b3+_0x946e('0x47')+'?'+_0x2b2716,'body':{'label':_0x133b22,'table':_0x946e('0x3d'),'id_type':_0x946e('0x48'),'table_key':_0x39b480['ticketId'],'title':_0x946e('0x49')+_0x39b480[_0x946e('0x4a')],'id_display':_0x39b480[_0x946e('0x4a')]},'auth':_0x19a441,'json':!![]};return rp(_0x35aab8)[_0x946e('0xd')](function(_0x693f5d){_0x3221c3();})[_0x946e('0x21')](function(){_0x3221c3();});});}function manageTags(_0x52dba2,_0x3a121d,_0x4480e0,_0x5e5d4e,_0x2be06f,_0x411c7c,_0x2e5052){return new Promise(function(_0x27d6f3,_0x39714a){var _0x3701a5=[];_0x3a121d[_0x946e('0x2c')](function(_0x9730a6){_0x3701a5['push'](getRemoteTag(_0x9730a6,_0x4480e0,_0x5e5d4e,_0x411c7c,_0x2e5052));});return Promise['all'](_0x3701a5)[_0x946e('0xd')](function(_0x18f779){if(_0x18f779['length']){logger[_0x946e('0x12')]('['+[_0x52dba2['toUpperCase']()]+_0x946e('0x4b'),_0x18f779);var _0x5e4839=[];_0x18f779[_0x946e('0x2c')](function(_0x4793c5){_0x5e4839['push'](assignTagToIncident(_0x4793c5,_0x4480e0,_0x5e5d4e,_0x2be06f,_0x411c7c));});return Promise[_0x946e('0x4c')](_0x5e4839)[_0x946e('0xd')](function(){_0x27d6f3();})[_0x946e('0x21')](function(){_0x27d6f3();});}else{_0x27d6f3();}});});}function getTags(_0xfb4416,_0x35ebd2,_0x3ae0aa,_0x58ae07,_0x46b7f9,_0x17d8a6){return function(_0x284b80){return new Promise(function(_0x5230c8,_0x42f7f9){var _0x3839d3=[];var _0x5eac16=_0x58ae07['Tags'];if(_0x5eac16&&_0x5eac16[_0x946e('0xf')]>0x0){_0x3839d3=_[_0x946e('0x4d')](_0x5eac16,_0x946e('0x3b'));}if(_0x3839d3['length']>0x0){return manageTags(_0xfb4416,_0x3839d3,_0x35ebd2,_0x3ae0aa,_0x284b80,_0x46b7f9,_0x17d8a6)[_0x946e('0xd')](function(){_0x5230c8(_0x284b80);});}else{_0x5230c8(_0x284b80);}});};}function emit(_0x1f0a53,_0x231e90,_0x24e171){var _0x3889ad=_0x946e('0x4e')+_0x946e('0x4f')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x946e('0x50');var _0x48a729={'uri':_0x1f0a53+_0x946e('0x51')+_0x24e171+_0x3889ad};io['to'](util['format']('user:%s',_0x231e90))[_0x946e('0x52')](_0x946e('0x53'),_0x48a729);}exports['cs']=function(_0xa32e66,_0x2dad76,_0x30cbcf,_0x3f35ab,_0x3fa121,_0x3ad6ef,_0x43f044,_0x13f9bd){var _0x3c4c1f={};var _0x4504fd={'user':_0x3ad6ef[_0x946e('0x54')],'pass':_0x3ad6ef[_0x946e('0x55')]};var _0x21d0c4=_0x946e('0x56');var _0x99cc36=_0x946e('0x57');_0x3ad6ef[_0x946e('0x58')]=intUtil[_0x946e('0x59')](_0x3ad6ef['remoteUri']);_0x3ad6ef['serverUrl']=intUtil[_0x946e('0x59')](_0x3ad6ef[_0x946e('0x5a')]);var _0x2c807f=util[_0x946e('0x5b')](_0x946e('0x5c'),_0x3ad6ef[_0x946e('0x58')]);_0x3c4c1f[_0x946e('0x18')]=!_[_0x946e('0x5d')](_0x3f35ab)?_0x3f35ab[_0x946e('0x5e')]:null;_0x3c4c1f[_0x946e('0x1f')]=_0x3ad6ef[_0x946e('0x5e')];_0x3c4c1f[_0x946e('0x26')]=_0x13f9bd[_0x946e('0x32')]()==='outbound'?_0x2dad76[_0x946e('0x5f')]:_0x2dad76[_0x946e('0x60')];_0x3c4c1f[_0x946e('0x61')]=_0x13f9bd===_0x946e('0x62')||_0x13f9bd===_0x946e('0x63')?'queue':_0x946e('0x3c');var _0x41b2c0=util[_0x946e('0x5b')](_0x946e('0x64'),_0x3ad6ef[_0x946e('0x5a')],_0x2dad76['uniqueid'],md5(_0x2dad76['uniqueid']));if(_0x3fa121&&_0x3fa121['monitor_format']){logger[_0x946e('0x12')]('[QUEUE]',_0x946e('0x65'));_0x2dad76[_0x946e('0x66')]=_0x41b2c0;}else if(_0x43f044&&_0x43f044['recordingFormat']&&_0x43f044[_0x946e('0x67')]!==_0x946e('0x68')){logger[_0x946e('0x12')](_0x946e('0x69'),_0x946e('0x65'));_0x2dad76[_0x946e('0x66')]=_0x41b2c0;}else{_0x2dad76['recordingURL']='';}return getAdminUser(_0x13f9bd,_0x4504fd,_0x3c4c1f,_0x2c807f,_0x99cc36,_0x21d0c4)[_0x946e('0xd')](getUser(_0x13f9bd,_0x4504fd,_0x2c807f,_0x99cc36,_0x21d0c4))[_0x946e('0xd')](getEndUser(_0x13f9bd,_0x4504fd,_0x2c807f,_0x99cc36,_0x21d0c4))['then'](getTicket(_0x13f9bd,_0x4504fd,_0x2c807f,_0x30cbcf,_0x2dad76,_0x99cc36))[_0x946e('0xd')](function(_0x4b2a77){logger[_0x946e('0x12')](util[_0x946e('0x5b')](_0x946e('0x6a'),_0x4b2a77[_0x946e('0x43')]));logger[_0x946e('0x12')](util[_0x946e('0x5b')]('call\x20direction:\x20%s',_0x13f9bd));if(_0x13f9bd!==_0x946e('0x63')){logger['info']('['+[_0x13f9bd[_0x946e('0x13')]()]+']',_0x946e('0x6b'));emit(_0x3ad6ef[_0x946e('0x58')],_0x3f35ab[_0x946e('0x3b')],_0x4b2a77[_0x946e('0x43')]);}})[_0x946e('0x21')](function(_0x443f07){logger[_0x946e('0x15')]('['+[_0x13f9bd[_0x946e('0x13')]()]+_0x946e('0x6c'),util[_0x946e('0x6d')](_0x443f07,{'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 174dbc1..29775f5 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 _0x0a86=['variable','customVariable','Variable','POST','login','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','stripTrailingSlash','%s/service/v4_1/rest.php','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','users','contacts','version','[OUTBOUND]','unmanaged','toUpperCase','error','lastevent','lodash','request-promise','bluebird','md5','util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','info','Creating\x20new\x20ticket...','name','getString','created_by','description','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','length','push','idField','variableName','JSON','stringify','format','toString','base64','isNil','get_entry_list','Employees','user_name','entry_list','find','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','content','custom_fields','type'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x0a86,0xaa));var _0x60a8=function(_0x57c601,_0x3293a2){_0x57c601=_0x57c601-0x0;var _0x10d301=_0x0a86[_0x57c601];return _0x10d301;};'use strict';var _=require(_0x60a8('0x0'));var rp=require(_0x60a8('0x1'));var BPromise=require(_0x60a8('0x2'));var md5=require(_0x60a8('0x3'));var util=require(_0x60a8('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x60a8('0x5'));var logger=require(_0x60a8('0x6'))('sugarcrm');config[_0x60a8('0x7')]=_[_0x60a8('0x8')](config[_0x60a8('0x7')],{'host':_0x60a8('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x52f143,_0x44aaad,_0xa7295a){io['to'](_0x52f143)['emit'](_0x44aaad,_0xa7295a);}function getTicket(_0x254e0a,_0x4ec869,_0x5b19ab,_0x304a8a,_0x160e47,_0x1710a1,_0x28075a,_0x5a84d9){logger[_0x60a8('0xa')](_0x60a8('0xb'));var _0x3a6a7d=new Date();var _0x272622=[{'name':_0x60a8('0xc'),'value':intUtil[_0x60a8('0xd')](_0x304a8a['Subjects'],_0x160e47,'\x20')},{'name':'assigned_user_id','value':_0x4ec869['id']},{'name':_0x60a8('0xe'),'value':_0x4ec869['id']},{'name':_0x60a8('0xf'),'value':intUtil[_0x60a8('0xd')](_0x304a8a['Descriptions'],_0x160e47,'\x0a')},{'name':_0x60a8('0x10'),'value':_0x3a6a7d['toISOString']()[_0x60a8('0x11')](0x0,0x13)[_0x60a8('0x12')]('T','\x20')},{'name':_0x60a8('0x13'),'value':'0'},{'name':_0x60a8('0x14'),'value':'15'},{'name':_0x60a8('0x15'),'value':_0x5b19ab['id']},{'name':_0x60a8('0x16'),'value':'Contacts'},{'name':_0x60a8('0x17'),'value':_0x5b19ab['name']},{'name':_0x60a8('0x18'),'value':_0x5a84d9}];if(_0x1710a1[_0x60a8('0x19')]){_['forEach'](_0x1710a1,function(_0x4d5636){if(_0x160e47[_0x4d5636['variableName']]){_0x272622[_0x60a8('0x1a')]({'name':_0x4d5636[_0x60a8('0x1b')],'value':_0x160e47[_0x4d5636[_0x60a8('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x60a8('0x1d'),'response_type':_0x60a8('0x1d'),'rest_data':JSON[_0x60a8('0x1e')]({'session':_0x28075a['id'],'module_name':'Calls','name_value_list':_0x272622})}});}function getAuth(_0x2639e8){return util[_0x60a8('0x1f')]('Basic\x20%s',new Buffer(_0x2639e8['apiKey']+':X')[_0x60a8('0x20')](_0x60a8('0x21')));}function getServerInfo(_0x2e5fc1){return request({'form':{'method':'get_server_info','input_type':_0x60a8('0x1d'),'response_type':_0x60a8('0x1d'),'rest_data':JSON[_0x60a8('0x1e')]({'session':_0x2e5fc1['id']})}});}function getUser(_0x3ee243,_0x5f223d,_0x693632){if(!_[_0x60a8('0x22')](_0x5f223d)){logger[_0x60a8('0xa')]('Getting\x20agent\x20with\x20name',_0x5f223d);return request({'form':{'method':_0x60a8('0x23'),'input_type':_0x60a8('0x1d'),'response_type':_0x60a8('0x1d'),'rest_data':JSON[_0x60a8('0x1e')]({'session':_0x693632['id'],'module_name':_0x60a8('0x24'),'query':util[_0x60a8('0x1f')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5f223d),'order_by':'','offset':'0','select_fields':['id','name',_0x60a8('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x293580){if(_0x293580[_0x60a8('0x26')][_0x60a8('0x19')]){var _0x534474=_[_0x60a8('0x27')](_0x293580[_0x60a8('0x26')],function(_0x2e8942){return _0x2e8942['name_value_list'][_0x60a8('0x25')][_0x60a8('0x28')]===_0x5f223d;});if(_0x534474){logger[_0x60a8('0xa')](_0x60a8('0x29'));return BPromise['resolve']({'id':_0x534474[_0x60a8('0x2a')]['id']['value'],'name':_0x534474[_0x60a8('0x2a')][_0x60a8('0xc')][_0x60a8('0x28')]});}}logger[_0x60a8('0xa')](_0x60a8('0x2b'));return BPromise[_0x60a8('0x2c')]({'id':_0x693632['name_value_list'][_0x60a8('0x2d')][_0x60a8('0x28')],'name':_0x693632[_0x60a8('0x2a')]['user_name']['value']});});}else{logger[_0x60a8('0xa')](_0x60a8('0x2e'));return BPromise[_0x60a8('0x2c')]({'id':_0x693632['name_value_list'][_0x60a8('0x2d')][_0x60a8('0x28')],'name':_0x693632[_0x60a8('0x2a')][_0x60a8('0x25')][_0x60a8('0x28')]});}}function getEndUser(_0x367022,_0x96db53,_0x5e426a,_0x425a64){logger['info'](_0x60a8('0x2f'),_0x5e426a);return request({'form':{'method':_0x60a8('0x23'),'input_type':_0x60a8('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x425a64['id'],'module_name':_0x60a8('0x30'),'query':util[_0x60a8('0x1f')](_0x60a8('0x31'),_0x5e426a),'order_by':'','offset':'0','select_fields':['id',_0x60a8('0xc'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x60a8('0x32')](function(_0x5c468b){if(_0x5c468b['entry_list'][_0x60a8('0x19')]){var _0x5d98e7=_['find'](_0x5c468b[_0x60a8('0x26')],function(_0x493d52){return _0x493d52[_0x60a8('0x2a')][_0x60a8('0x33')][_0x60a8('0x28')]===_0x5e426a;});if(_0x5d98e7){logger[_0x60a8('0xa')](_0x60a8('0x34'));return BPromise['resolve']({'id':_0x5d98e7['name_value_list']['id'][_0x60a8('0x28')],'name':_0x5d98e7['name_value_list']['name']['value'],'phone':_0x5d98e7[_0x60a8('0x2a')][_0x60a8('0x33')][_0x60a8('0x28')]});}}else{logger[_0x60a8('0xa')](_0x60a8('0x35'));return request({'form':{'method':'set_entry','input_type':_0x60a8('0x1d'),'response_type':_0x60a8('0x1d'),'rest_data':JSON[_0x60a8('0x1e')]({'session':_0x425a64['id'],'module_name':_0x60a8('0x30'),'name_value_list':[{'name':_0x60a8('0x36'),'value':_0x96db53!==_0x60a8('0x37')?_0x96db53:util[_0x60a8('0x1f')](_0x60a8('0x38'),_0x5e426a)},{'name':_0x60a8('0x33'),'value':_0x5e426a}]})}})['then'](function(_0x34ccd0){logger[_0x60a8('0xa')](_0x60a8('0x39'));return BPromise[_0x60a8('0x2c')]({'id':_0x34ccd0['id'],'name':_0x34ccd0[_0x60a8('0x26')][_0x60a8('0x36')][_0x60a8('0x28')],'phone':_0x34ccd0[_0x60a8('0x26')][_0x60a8('0x33')][_0x60a8('0x28')]});});}});}function request(_0x54e677){logger[_0x60a8('0x3a')](_0x60a8('0x3b'),JSON['stringify'](_0x54e677));return rp(_[_0x60a8('0x3c')](def,_0x54e677));}function getTags(_0x1e0c6c,_0x9943d9){var _0xacd0b1=[];if(_0x1e0c6c&&_0x1e0c6c[_0x60a8('0x19')]>0x0){_0xacd0b1=_[_0x60a8('0x3d')](_0x1e0c6c,_0x9943d9);}return _0xacd0b1;}function getCustomFields(_0x4b2f5e,_0x16b716){var _0x2f1b6f=[];var _0x46e42c={'custom_fields':[]};if(_0x4b2f5e[_0x60a8('0x19')]>0x0){_[_0x60a8('0x3e')](_0x4b2f5e,function(_0x16134a){if(_0x16134a['type']===_0x60a8('0x3f')&&_0x16134a[_0x60a8('0x40')]&&!_0x16134a[_0x60a8('0x41')]){_0x46e42c[_0x16134a[_0x60a8('0x40')][_0x60a8('0x42')]()]=_0x16134a[_0x60a8('0x43')][_0x60a8('0x20')]();}else if(_0x16134a['type']===_0x60a8('0x3f')&&_0x16134a[_0x60a8('0x1b')]&&_0x16134a[_0x60a8('0x41')]){_0x46e42c[_0x60a8('0x44')][_0x60a8('0x1a')]({'id':_0x16134a[_0x60a8('0x1b')],'value':_0x16134a[_0x60a8('0x43')][_0x60a8('0x20')]()});}else if(_0x16134a[_0x60a8('0x45')]===_0x60a8('0x46')&&_0x16134a[_0x60a8('0x1c')]&&_0x16134a[_0x60a8('0x1b')]&&_0x16134a[_0x60a8('0x41')]){_0x16b716[_0x16134a[_0x60a8('0x1c')]]&&_0x46e42c[_0x60a8('0x44')]['push']({'id':_0x16134a['idField'],'value':_0x16b716[_0x16134a[_0x60a8('0x1c')]]['toString']()});}else if(_0x16134a[_0x60a8('0x45')]===_0x60a8('0x47')&&_0x16134a[_0x60a8('0x48')]&&_0x16134a[_0x60a8('0x48')][_0x60a8('0xc')]&&_0x16134a[_0x60a8('0x1b')]&&_0x16134a['customField']){_0x16b716[_0x16134a[_0x60a8('0x48')][_0x60a8('0xc')]['toLowerCase']()]&&_0x46e42c[_0x60a8('0x44')][_0x60a8('0x1a')]({'id':_0x16134a['idField'],'value':_0x16b716[_0x16134a[_0x60a8('0x48')]['name'][_0x60a8('0x42')]()][_0x60a8('0x20')]()});}});}return _0x46e42c;}function getConnection(_0x5a0bce){return request({'method':_0x60a8('0x49'),'form':{'method':_0x60a8('0x4a'),'input_type':_0x60a8('0x1d'),'response_type':'JSON','rest_data':JSON[_0x60a8('0x1e')]({'user_auth':{'user_name':_0x5a0bce['username'],'password':_0x5a0bce['password'],'encryption':_0x60a8('0x4b')},'application':_0x60a8('0x4c')})}})[_0x60a8('0x32')](function(_0x45973b){var _0x3e0314=_0x45973b;if(_0x3e0314['id']){def[_0x60a8('0x4d')]=_0x3e0314['id'];return BPromise[_0x60a8('0x2c')](_0x3e0314);}else{throw new Error(util['format'](_0x60a8('0x4e'),_0x5a0bce['id']));}});}function setRelationship(_0x127cf2,_0x2f55f9,_0x7f1f56,_0x2b61c1){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x60a8('0x1d'),'rest_data':JSON[_0x60a8('0x1e')]({'session':_0x127cf2['id'],'module_name':_0x60a8('0x4f'),'module_id':_0x7f1f56['id'],'link_field_name':_0x2b61c1,'related_ids':[_0x2f55f9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x60a8('0x50')]=function(_0x423e8a,_0x17b325,_0x3592bb,_0x15c60c,_0x13b867,_0x293d62){var _0x323353,_0x1f4b7d,_0x40f8d7,_0x218454;_0x293d62[_0x60a8('0x51')]=intUtil['stripTrailingSlash'](_0x293d62[_0x60a8('0x51')]);_0x293d62[_0x60a8('0x52')]=intUtil['stripTrailingSlash'](_0x293d62[_0x60a8('0x52')]);def[_0x60a8('0x53')]=util[_0x60a8('0x1f')]('%s/service/v4_1/rest.php',_0x293d62[_0x60a8('0x51')]);if(_0x13b867&&_0x13b867[_0x60a8('0x54')]){logger[_0x60a8('0xa')](_0x60a8('0x55'),_0x60a8('0x56'));_0x17b325[_0x60a8('0x57')]=util[_0x60a8('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x293d62[_0x60a8('0x52')],_0x17b325[_0x60a8('0x58')],md5(_0x17b325['uniqueid']));}else{_0x17b325[_0x60a8('0x57')]='';}return getConnection(_0x293d62)['then'](function(_0x5beafd){_0x218454=_0x5beafd;return getUser(_0x293d62,_0x15c60c[_0x60a8('0xc')],_0x218454);})[_0x60a8('0x32')](function(_0xdb3dbe){_0x323353=_0xdb3dbe;logger[_0x60a8('0xa')]('The\x20User\x20ID\x20is:',_0x323353['id']);return getEndUser(_0x293d62,_0x17b325[_0x60a8('0x59')],_0x17b325[_0x60a8('0x5a')],_0x218454);})[_0x60a8('0x32')](function(_0x2139f2){_0x1f4b7d=_0x2139f2;logger[_0x60a8('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1f4b7d['id']);return getTicket(_0x293d62,_0x323353,_0x1f4b7d,_0x3592bb,_0x17b325,_0x3592bb[_0x60a8('0x5b')],_0x218454,_0x60a8('0x5c'));})[_0x60a8('0x32')](function(_0x59f85b){_0x40f8d7=_0x59f85b;logger[_0x60a8('0xa')](_0x60a8('0x5d'));logger[_0x60a8('0xa')](_0x60a8('0x5e'),_0x40f8d7['id']);return setRelationship(_0x218454,_0x323353,_0x40f8d7,'users');})['then'](function(){return setRelationship(_0x218454,_0x1f4b7d,_0x40f8d7,'contacts');})['then'](function(){return getServerInfo(_0x218454);})[_0x60a8('0x32')](function(_0x4498b4){var _0x5948ec=parseInt(_0x4498b4['version'][_0x60a8('0x5f')](0x0));var _0x4df23f=util[_0x60a8('0x1f')](_0x60a8('0x60'),_0x293d62[_0x60a8('0x51')],_0x40f8d7['id']);if(_0x5948ec>0x6){_0x4df23f=util[_0x60a8('0x1f')](_0x60a8('0x61'),_0x293d62[_0x60a8('0x51')],_0x40f8d7['id']);}logger[_0x60a8('0xa')](_0x60a8('0x55'),_0x60a8('0x62'));emit(util[_0x60a8('0x1f')](_0x60a8('0x63'),_0x15c60c['name']),_0x60a8('0x64'),{'uri':_0x4df23f});})[_0x60a8('0x65')](function(_0x13d62d){logger['error'](_0x60a8('0x55'),JSON[_0x60a8('0x1e')](_0x13d62d));});};exports[_0x60a8('0x66')]=function(_0x1e8789,_0x1220ed,_0x5d8b98,_0x72a97c,_0x395f95,_0x326411,_0x2b515d){var _0x4e1f06,_0x45793b,_0x3cb6ac,_0x593822;_0x326411['remoteUri']=intUtil['stripTrailingSlash'](_0x326411[_0x60a8('0x51')]);_0x326411[_0x60a8('0x52')]=intUtil[_0x60a8('0x67')](_0x326411['serverUrl']);def['uri']=util[_0x60a8('0x1f')](_0x60a8('0x68'),_0x326411[_0x60a8('0x51')]);if(_0x2b515d&&_0x2b515d[_0x60a8('0x69')]&&_0x2b515d['recordingFormat']!==_0x60a8('0x6a')){logger[_0x60a8('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1220ed[_0x60a8('0x57')]=util[_0x60a8('0x1f')](_0x60a8('0x6b'),_0x326411['serverUrl'],_0x1220ed[_0x60a8('0x58')],md5(_0x1220ed[_0x60a8('0x58')]));}return getConnection(_0x326411)['then'](function(_0x48aba1){_0x593822=_0x48aba1;return getUser(_0x326411,_0x72a97c[_0x60a8('0xc')],_0x593822);})[_0x60a8('0x32')](function(_0x404544){_0x4e1f06=_0x404544;logger['info'](_0x60a8('0x6c'),_0x4e1f06['id']);return getEndUser(_0x326411,_0x1220ed[_0x60a8('0x6d')],_0x1220ed[_0x60a8('0x6e')],_0x593822);})[_0x60a8('0x32')](function(_0x5e4023){_0x45793b=_0x5e4023;logger[_0x60a8('0xa')](_0x60a8('0x6f'),_0x45793b['id']);return getTicket(_0x326411,_0x4e1f06,_0x45793b,_0x5d8b98,_0x1220ed,_0x5d8b98[_0x60a8('0x5b')],_0x593822,'Outbound');})['then'](function(_0x531446){_0x3cb6ac=_0x531446;logger[_0x60a8('0xa')]('Ticket\x20created!');logger[_0x60a8('0xa')](_0x60a8('0x5e'),_0x3cb6ac['id']);return setRelationship(_0x593822,_0x4e1f06,_0x3cb6ac,_0x60a8('0x70'));})[_0x60a8('0x32')](function(){return setRelationship(_0x593822,_0x45793b,_0x3cb6ac,_0x60a8('0x71'));})[_0x60a8('0x32')](function(){return getServerInfo(_0x593822);})[_0x60a8('0x32')](function(_0x314f1e){var _0x490ee4=parseInt(_0x314f1e[_0x60a8('0x72')]['charAt'](0x0));var _0x4eaf74=util[_0x60a8('0x1f')](_0x60a8('0x60'),_0x326411['remoteUri'],_0x3cb6ac['id']);if(_0x490ee4>0x6){_0x4eaf74=util[_0x60a8('0x1f')](_0x60a8('0x61'),_0x326411[_0x60a8('0x51')],_0x3cb6ac['id']);}logger['info']('[OUTBOUND]',_0x60a8('0x62'));emit(util['format'](_0x60a8('0x63'),_0x72a97c['name']),_0x60a8('0x64'),{'uri':_0x4eaf74});})['catch'](function(_0x51578e){logger['error'](_0x60a8('0x73'),JSON[_0x60a8('0x1e')](_0x51578e));});};exports[_0x60a8('0x74')]=function(_0x911a13,_0xd648a5,_0x30b656,_0x234b0d,_0x2c44c6,_0xce695){var _0x5633bf,_0x5a2394,_0x1ae826,_0x4a1f5e;_0xce695[_0x60a8('0x51')]=intUtil[_0x60a8('0x67')](_0xce695[_0x60a8('0x51')]);_0xce695[_0x60a8('0x52')]=intUtil[_0x60a8('0x67')](_0xce695[_0x60a8('0x52')]);def['uri']=util[_0x60a8('0x1f')](_0x60a8('0x68'),_0xce695[_0x60a8('0x51')]);if(_0x2c44c6&&_0x2c44c6[_0x60a8('0x54')]){logger[_0x60a8('0xa')]('['+_0xd648a5['lastevent'][_0x60a8('0x75')]()+']',_0x60a8('0x56'));_0xd648a5[_0x60a8('0x57')]=util[_0x60a8('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xce695[_0x60a8('0x52')],_0xd648a5['uniqueid'],md5(_0xd648a5[_0x60a8('0x58')]));}else{_0xd648a5[_0x60a8('0x57')]='';}return getConnection(_0xce695)[_0x60a8('0x32')](function(_0xaba4a){_0x4a1f5e=_0xaba4a;if(!_[_0x60a8('0x22')](_0x234b0d)){return getUser(_0xce695,_0x234b0d[_0x60a8('0xc')],_0x4a1f5e);}else{return getUser(_0xce695,null,_0x4a1f5e);}})['then'](function(_0x2a09fc){_0x5633bf=_0x2a09fc;logger['info'](_0x60a8('0x6c'),_0x5633bf['id']);return getEndUser(_0xce695,_0xd648a5[_0x60a8('0x59')],_0xd648a5[_0x60a8('0x5a')],_0x4a1f5e);})['then'](function(_0x3e7fbe){_0x5a2394=_0x3e7fbe;logger[_0x60a8('0xa')](_0x60a8('0x6f'),_0x5a2394['id']);return getTicket(_0xce695,_0x5633bf,_0x5a2394,_0x30b656,_0xd648a5,_0x30b656[_0x60a8('0x5b')],_0x4a1f5e,_0x60a8('0x5c'));})[_0x60a8('0x32')](function(_0x4015b4){_0x1ae826=_0x4015b4;logger[_0x60a8('0xa')](_0x60a8('0x5d'));logger[_0x60a8('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1ae826['id']);return setRelationship(_0x4a1f5e,_0x5633bf,_0x1ae826,'users');})[_0x60a8('0x32')](function(){return setRelationship(_0x4a1f5e,_0x5a2394,_0x1ae826,_0x60a8('0x71'));})[_0x60a8('0x32')](function(){return getServerInfo(_0x4a1f5e);})[_0x60a8('0x65')](function(_0x576fe9){logger[_0x60a8('0x76')]('['+_0xd648a5[_0x60a8('0x77')]['toUpperCase']()+']',JSON[_0x60a8('0x1e')](_0x576fe9));});}; \ No newline at end of file +var _0x62d0=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','lastevent','toUpperCase','isNil','calleridname','lodash','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','get_server_info','Getting\x20agent\x20with\x20name','user_name','then','find','entry_list','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','toString','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x1fefe3,_0x302099){var _0x52b9a3=function(_0x31aa3e){while(--_0x31aa3e){_0x1fefe3['push'](_0x1fefe3['shift']());}};_0x52b9a3(++_0x302099);}(_0x62d0,0x99));var _0x062d=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x62d0[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x062d('0x0'));var rp=require('request-promise');var BPromise=require(_0x062d('0x1'));var md5=require('md5');var util=require(_0x062d('0x2'));var Redis=require(_0x062d('0x3'));var intUtil=require(_0x062d('0x4'));var config=require(_0x062d('0x5'));var logger=require(_0x062d('0x6'))(_0x062d('0x7'));config[_0x062d('0x8')]=_['defaults'](config[_0x062d('0x8')],{'host':_0x062d('0x9'),'port':0x18eb});var io=require(_0x062d('0xa'))(new Redis(config[_0x062d('0x8')]));var def={'method':_0x062d('0xb'),'json':!![]};function emit(_0x37a76d,_0x450a9a,_0x53538c){io['to'](_0x37a76d)[_0x062d('0xc')](_0x450a9a,_0x53538c);}function getTicket(_0x1dc76c,_0x30b0da,_0x842150,_0x342981,_0x5d8812,_0xe91f5d,_0x1446d1,_0x4f2f80){logger[_0x062d('0xd')]('Creating\x20new\x20ticket...');var _0x6e6809=new Date();var _0xeff873=[{'name':_0x062d('0xe'),'value':intUtil[_0x062d('0xf')](_0x342981[_0x062d('0x10')],_0x5d8812,'\x20')},{'name':'assigned_user_id','value':_0x30b0da['id']},{'name':_0x062d('0x11'),'value':_0x30b0da['id']},{'name':_0x062d('0x12'),'value':intUtil[_0x062d('0xf')](_0x342981[_0x062d('0x13')],_0x5d8812,'\x0a')},{'name':_0x062d('0x14'),'value':_0x6e6809[_0x062d('0x15')]()[_0x062d('0x16')](0x0,0x13)[_0x062d('0x17')]('T','\x20')},{'name':_0x062d('0x18'),'value':'0'},{'name':_0x062d('0x19'),'value':'15'},{'name':_0x062d('0x1a'),'value':_0x842150['id']},{'name':_0x062d('0x1b'),'value':_0x062d('0x1c')},{'name':'parent_name','value':_0x842150[_0x062d('0xe')]},{'name':_0x062d('0x1d'),'value':_0x4f2f80}];if(_0xe91f5d[_0x062d('0x1e')]){_[_0x062d('0x1f')](_0xe91f5d,function(_0x50ea34){if(_0x5d8812[_0x50ea34[_0x062d('0x20')]]){_0xeff873[_0x062d('0x21')]({'name':_0x50ea34[_0x062d('0x22')],'value':_0x5d8812[_0x50ea34[_0x062d('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x062d('0x23'),'response_type':_0x062d('0x23'),'rest_data':JSON[_0x062d('0x24')]({'session':_0x1446d1['id'],'module_name':'Calls','name_value_list':_0xeff873})}});}function getAuth(_0x1b4e12){return util[_0x062d('0x25')](_0x062d('0x26'),new Buffer(_0x1b4e12[_0x062d('0x27')]+':X')['toString']('base64'));}function getServerInfo(_0x38a4c9){return request({'form':{'method':_0x062d('0x28'),'input_type':_0x062d('0x23'),'response_type':_0x062d('0x23'),'rest_data':JSON[_0x062d('0x24')]({'session':_0x38a4c9['id']})}});}function getUser(_0x198d77,_0x5e671f,_0x3e7e9e){if(!_['isNil'](_0x5e671f)){logger[_0x062d('0xd')](_0x062d('0x29'),_0x5e671f);return request({'form':{'method':'get_entry_list','input_type':_0x062d('0x23'),'response_type':_0x062d('0x23'),'rest_data':JSON[_0x062d('0x24')]({'session':_0x3e7e9e['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5e671f),'order_by':'','offset':'0','select_fields':['id',_0x062d('0xe'),_0x062d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x062d('0x2b')](function(_0x52b74d){if(_0x52b74d['entry_list'][_0x062d('0x1e')]){var _0x50185c=_[_0x062d('0x2c')](_0x52b74d[_0x062d('0x2d')],function(_0x10b561){return _0x10b561['name_value_list'][_0x062d('0x2a')][_0x062d('0x2e')]===_0x5e671f;});if(_0x50185c){logger[_0x062d('0xd')]('Agent\x20found!');return BPromise[_0x062d('0x2f')]({'id':_0x50185c['name_value_list']['id'][_0x062d('0x2e')],'name':_0x50185c[_0x062d('0x30')][_0x062d('0xe')][_0x062d('0x2e')]});}}logger[_0x062d('0xd')](_0x062d('0x31'));return BPromise['resolve']({'id':_0x3e7e9e['name_value_list']['user_id'][_0x062d('0x2e')],'name':_0x3e7e9e[_0x062d('0x30')]['user_name'][_0x062d('0x2e')]});});}else{logger['info'](_0x062d('0x32'));return BPromise[_0x062d('0x2f')]({'id':_0x3e7e9e[_0x062d('0x30')]['user_id'][_0x062d('0x2e')],'name':_0x3e7e9e['name_value_list'][_0x062d('0x2a')][_0x062d('0x2e')]});}}function getEndUser(_0x4e4c15,_0x1458c0,_0x2d437c,_0x4866de){logger[_0x062d('0xd')](_0x062d('0x33'),_0x2d437c);return request({'form':{'method':_0x062d('0x34'),'input_type':_0x062d('0x23'),'response_type':_0x062d('0x23'),'rest_data':JSON['stringify']({'session':_0x4866de['id'],'module_name':'Contacts','query':util['format'](_0x062d('0x35'),_0x2d437c),'order_by':'','offset':'0','select_fields':['id','name',_0x062d('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x062d('0x2b')](function(_0x34a6ba){if(_0x34a6ba[_0x062d('0x2d')]['length']){var _0x276007=_[_0x062d('0x2c')](_0x34a6ba['entry_list'],function(_0x55d434){return _0x55d434[_0x062d('0x30')][_0x062d('0x36')][_0x062d('0x2e')]===_0x2d437c;});if(_0x276007){logger[_0x062d('0xd')](_0x062d('0x37'));return BPromise[_0x062d('0x2f')]({'id':_0x276007[_0x062d('0x30')]['id'][_0x062d('0x2e')],'name':_0x276007[_0x062d('0x30')][_0x062d('0xe')]['value'],'phone':_0x276007[_0x062d('0x30')][_0x062d('0x36')][_0x062d('0x2e')]});}}else{logger[_0x062d('0xd')](_0x062d('0x38'));return request({'form':{'method':_0x062d('0x39'),'input_type':'JSON','response_type':_0x062d('0x23'),'rest_data':JSON[_0x062d('0x24')]({'session':_0x4866de['id'],'module_name':_0x062d('0x1c'),'name_value_list':[{'name':_0x062d('0x3a'),'value':_0x1458c0!==_0x062d('0x3b')?_0x1458c0:util[_0x062d('0x25')](_0x062d('0x3c'),_0x2d437c)},{'name':_0x062d('0x36'),'value':_0x2d437c}]})}})[_0x062d('0x2b')](function(_0x474791){logger[_0x062d('0xd')]('Enduser\x20created.');return BPromise[_0x062d('0x2f')]({'id':_0x474791['id'],'name':_0x474791[_0x062d('0x2d')][_0x062d('0x3a')][_0x062d('0x2e')],'phone':_0x474791[_0x062d('0x2d')][_0x062d('0x36')][_0x062d('0x2e')]});});}});}function request(_0x1c5132){logger[_0x062d('0x3d')](_0x062d('0x3e'),JSON[_0x062d('0x24')](_0x1c5132));return rp(_['merge'](def,_0x1c5132));}function getTags(_0x16ec9e,_0x20e525){var _0x144060=[];if(_0x16ec9e&&_0x16ec9e[_0x062d('0x1e')]>0x0){_0x144060=_[_0x062d('0x3f')](_0x16ec9e,_0x20e525);}return _0x144060;}function getCustomFields(_0x3a60e0,_0x1168d0){var _0xe99ebb=[];var _0x4e7aba={'custom_fields':[]};if(_0x3a60e0['length']>0x0){_['forEach'](_0x3a60e0,function(_0x3e3512){if(_0x3e3512[_0x062d('0x40')]===_0x062d('0x41')&&_0x3e3512[_0x062d('0x42')]&&!_0x3e3512[_0x062d('0x43')]){_0x4e7aba[_0x3e3512['nameField'][_0x062d('0x44')]()]=_0x3e3512[_0x062d('0x45')][_0x062d('0x46')]();}else if(_0x3e3512[_0x062d('0x40')]===_0x062d('0x41')&&_0x3e3512[_0x062d('0x22')]&&_0x3e3512['customField']){_0x4e7aba['custom_fields'][_0x062d('0x21')]({'id':_0x3e3512[_0x062d('0x22')],'value':_0x3e3512[_0x062d('0x45')][_0x062d('0x46')]()});}else if(_0x3e3512['type']===_0x062d('0x47')&&_0x3e3512[_0x062d('0x20')]&&_0x3e3512[_0x062d('0x22')]&&_0x3e3512[_0x062d('0x43')]){_0x1168d0[_0x3e3512[_0x062d('0x20')]]&&_0x4e7aba[_0x062d('0x48')][_0x062d('0x21')]({'id':_0x3e3512[_0x062d('0x22')],'value':_0x1168d0[_0x3e3512['variableName']]['toString']()});}else if(_0x3e3512[_0x062d('0x40')]===_0x062d('0x49')&&_0x3e3512[_0x062d('0x4a')]&&_0x3e3512['Variable'][_0x062d('0xe')]&&_0x3e3512[_0x062d('0x22')]&&_0x3e3512[_0x062d('0x43')]){_0x1168d0[_0x3e3512['Variable'][_0x062d('0xe')]['toLowerCase']()]&&_0x4e7aba[_0x062d('0x48')][_0x062d('0x21')]({'id':_0x3e3512['idField'],'value':_0x1168d0[_0x3e3512['Variable'][_0x062d('0xe')]['toLowerCase']()][_0x062d('0x46')]()});}});}return _0x4e7aba;}function getConnection(_0x3e0a41){return request({'method':'POST','form':{'method':_0x062d('0x4b'),'input_type':_0x062d('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3e0a41[_0x062d('0x4c')],'password':_0x3e0a41[_0x062d('0x4d')],'encryption':_0x062d('0x4e')},'application':_0x062d('0x4f')})}})['then'](function(_0x3c796){var _0x955a6a=_0x3c796;if(_0x955a6a['id']){def[_0x062d('0x50')]=_0x955a6a['id'];return BPromise[_0x062d('0x2f')](_0x955a6a);}else{throw new Error(util[_0x062d('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0x3e0a41['id']));}});}function setRelationship(_0x354f62,_0x1fd5c5,_0x541b07,_0x374d62){return request({'form':{'method':_0x062d('0x51'),'input_type':'JSON','response_type':_0x062d('0x23'),'rest_data':JSON['stringify']({'session':_0x354f62['id'],'module_name':_0x062d('0x52'),'module_id':_0x541b07['id'],'link_field_name':_0x374d62,'related_ids':[_0x1fd5c5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x062d('0x53')]=function(_0x483b96,_0x5ca005,_0x4bdb17,_0x3c03e9,_0xaf1d27,_0x47e672){var _0x4f8a64,_0x55d59e,_0x598574,_0x31001a;_0x47e672['remoteUri']=intUtil[_0x062d('0x54')](_0x47e672[_0x062d('0x55')]);_0x47e672[_0x062d('0x56')]=intUtil[_0x062d('0x54')](_0x47e672['serverUrl']);def[_0x062d('0x57')]=util['format'](_0x062d('0x58'),_0x47e672[_0x062d('0x55')]);if(_0xaf1d27&&_0xaf1d27[_0x062d('0x59')]){logger[_0x062d('0xd')](_0x062d('0x5a'),_0x062d('0x5b'));_0x5ca005[_0x062d('0x5c')]=util[_0x062d('0x25')](_0x062d('0x5d'),_0x47e672[_0x062d('0x56')],_0x5ca005[_0x062d('0x5e')],md5(_0x5ca005[_0x062d('0x5e')]));}else{_0x5ca005[_0x062d('0x5c')]='';}return getConnection(_0x47e672)[_0x062d('0x2b')](function(_0x4f728a){_0x31001a=_0x4f728a;return getUser(_0x47e672,_0x3c03e9[_0x062d('0xe')],_0x31001a);})['then'](function(_0x8cf98f){_0x4f8a64=_0x8cf98f;logger[_0x062d('0xd')]('The\x20User\x20ID\x20is:',_0x4f8a64['id']);return getEndUser(_0x47e672,_0x5ca005['calleridname'],_0x5ca005[_0x062d('0x5f')],_0x31001a);})[_0x062d('0x2b')](function(_0x1dbb7b){_0x55d59e=_0x1dbb7b;logger[_0x062d('0xd')](_0x062d('0x60'),_0x55d59e['id']);return getTicket(_0x47e672,_0x4f8a64,_0x55d59e,_0x4bdb17,_0x5ca005,_0x4bdb17[_0x062d('0x61')],_0x31001a,'Inbound');})['then'](function(_0x2bb84c){_0x598574=_0x2bb84c;logger['info'](_0x062d('0x62'));logger[_0x062d('0xd')](_0x062d('0x63'),_0x598574['id']);return setRelationship(_0x31001a,_0x4f8a64,_0x598574,_0x062d('0x64'));})[_0x062d('0x2b')](function(){return setRelationship(_0x31001a,_0x55d59e,_0x598574,_0x062d('0x65'));})[_0x062d('0x2b')](function(){return getServerInfo(_0x31001a);})['then'](function(_0x131fa0){var _0x225a8c=parseInt(_0x131fa0[_0x062d('0x66')]['charAt'](0x0));var _0x376c51=util['format'](_0x062d('0x67'),_0x47e672['remoteUri'],_0x598574['id']);if(_0x225a8c>0x6){_0x376c51=util[_0x062d('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x47e672[_0x062d('0x55')],_0x598574['id']);}logger[_0x062d('0xd')](_0x062d('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x062d('0x25')](_0x062d('0x68'),_0x3c03e9[_0x062d('0xe')]),_0x062d('0x69'),{'uri':_0x376c51});})['catch'](function(_0x9d3a8f){logger[_0x062d('0x6a')](_0x062d('0x5a'),JSON[_0x062d('0x24')](_0x9d3a8f));});};exports[_0x062d('0x6b')]=function(_0x2dc588,_0x4a4939,_0x44aebc,_0x57e086,_0xd479f9,_0x5809af,_0x359eda){var _0x2efe20,_0x3fb02c,_0x42ac9c,_0x37fde5;_0x5809af['remoteUri']=intUtil['stripTrailingSlash'](_0x5809af['remoteUri']);_0x5809af[_0x062d('0x56')]=intUtil[_0x062d('0x54')](_0x5809af[_0x062d('0x56')]);def[_0x062d('0x57')]=util[_0x062d('0x25')](_0x062d('0x58'),_0x5809af[_0x062d('0x55')]);if(_0x359eda&&_0x359eda[_0x062d('0x6c')]&&_0x359eda[_0x062d('0x6c')]!==_0x062d('0x6d')){logger[_0x062d('0xd')](_0x062d('0x6e'),'Recording\x20is\x20enabled!');_0x4a4939[_0x062d('0x5c')]=util['format'](_0x062d('0x5d'),_0x5809af['serverUrl'],_0x4a4939['uniqueid'],md5(_0x4a4939[_0x062d('0x5e')]));}return getConnection(_0x5809af)[_0x062d('0x2b')](function(_0x38973e){_0x37fde5=_0x38973e;return getUser(_0x5809af,_0x57e086[_0x062d('0xe')],_0x37fde5);})[_0x062d('0x2b')](function(_0x526a8d){_0x2efe20=_0x526a8d;logger[_0x062d('0xd')](_0x062d('0x6f'),_0x2efe20['id']);return getEndUser(_0x5809af,_0x4a4939[_0x062d('0x70')],_0x4a4939[_0x062d('0x71')],_0x37fde5);})[_0x062d('0x2b')](function(_0x300999){_0x3fb02c=_0x300999;logger[_0x062d('0xd')](_0x062d('0x60'),_0x3fb02c['id']);return getTicket(_0x5809af,_0x2efe20,_0x3fb02c,_0x44aebc,_0x4a4939,_0x44aebc[_0x062d('0x61')],_0x37fde5,_0x062d('0x72'));})[_0x062d('0x2b')](function(_0x173040){_0x42ac9c=_0x173040;logger[_0x062d('0xd')](_0x062d('0x62'));logger[_0x062d('0xd')]('The\x20Ticket\x20ID\x20is:',_0x42ac9c['id']);return setRelationship(_0x37fde5,_0x2efe20,_0x42ac9c,'users');})[_0x062d('0x2b')](function(){return setRelationship(_0x37fde5,_0x3fb02c,_0x42ac9c,_0x062d('0x65'));})['then'](function(){return getServerInfo(_0x37fde5);})[_0x062d('0x2b')](function(_0x114340){var _0x48c4d7=parseInt(_0x114340[_0x062d('0x66')][_0x062d('0x73')](0x0));var _0x5da67c=util[_0x062d('0x25')](_0x062d('0x67'),_0x5809af[_0x062d('0x55')],_0x42ac9c['id']);if(_0x48c4d7>0x6){_0x5da67c=util[_0x062d('0x25')](_0x062d('0x74'),_0x5809af[_0x062d('0x55')],_0x42ac9c['id']);}logger[_0x062d('0xd')](_0x062d('0x6e'),_0x062d('0x75'));emit(util[_0x062d('0x25')](_0x062d('0x68'),_0x57e086[_0x062d('0xe')]),'trigger:browser:url',{'uri':_0x5da67c});})[_0x062d('0x76')](function(_0x264dae){logger[_0x062d('0x6a')](_0x062d('0x6e'),JSON[_0x062d('0x24')](_0x264dae));});};exports['unmanaged']=function(_0x185ffa,_0x114e91,_0x359bd1,_0x2f543c,_0x1a5171,_0xbb269b){var _0x3b31c1,_0x433fd8,_0x1ec255,_0x30d90b;_0xbb269b[_0x062d('0x55')]=intUtil[_0x062d('0x54')](_0xbb269b[_0x062d('0x55')]);_0xbb269b['serverUrl']=intUtil[_0x062d('0x54')](_0xbb269b['serverUrl']);def['uri']=util[_0x062d('0x25')]('%s/service/v4_1/rest.php',_0xbb269b[_0x062d('0x55')]);if(_0x1a5171&&_0x1a5171['monitor_format']){logger[_0x062d('0xd')]('['+_0x114e91[_0x062d('0x77')][_0x062d('0x78')]()+']',_0x062d('0x5b'));_0x114e91['recordingURL']=util[_0x062d('0x25')](_0x062d('0x5d'),_0xbb269b['serverUrl'],_0x114e91[_0x062d('0x5e')],md5(_0x114e91[_0x062d('0x5e')]));}else{_0x114e91[_0x062d('0x5c')]='';}return getConnection(_0xbb269b)[_0x062d('0x2b')](function(_0x3e884a){_0x30d90b=_0x3e884a;if(!_[_0x062d('0x79')](_0x2f543c)){return getUser(_0xbb269b,_0x2f543c[_0x062d('0xe')],_0x30d90b);}else{return getUser(_0xbb269b,null,_0x30d90b);}})['then'](function(_0xae936a){_0x3b31c1=_0xae936a;logger['info']('The\x20User\x20ID\x20is:',_0x3b31c1['id']);return getEndUser(_0xbb269b,_0x114e91[_0x062d('0x7a')],_0x114e91[_0x062d('0x5f')],_0x30d90b);})[_0x062d('0x2b')](function(_0x3e9dae){_0x433fd8=_0x3e9dae;logger[_0x062d('0xd')](_0x062d('0x60'),_0x433fd8['id']);return getTicket(_0xbb269b,_0x3b31c1,_0x433fd8,_0x359bd1,_0x114e91,_0x359bd1['Fields'],_0x30d90b,'Inbound');})[_0x062d('0x2b')](function(_0x567cb2){_0x1ec255=_0x567cb2;logger[_0x062d('0xd')](_0x062d('0x62'));logger['info'](_0x062d('0x63'),_0x1ec255['id']);return setRelationship(_0x30d90b,_0x3b31c1,_0x1ec255,_0x062d('0x64'));})[_0x062d('0x2b')](function(){return setRelationship(_0x30d90b,_0x433fd8,_0x1ec255,'contacts');})[_0x062d('0x2b')](function(){return getServerInfo(_0x30d90b);})[_0x062d('0x76')](function(_0x149c9c){logger[_0x062d('0x6a')]('['+_0x114e91['lastevent'][_0x062d('0x78')]()+']',JSON[_0x062d('0x24')](_0x149c9c));});}; \ 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 d13526c..07de020 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 _0x721f=['name','toLowerCase','keyType','format','%s:\x20%s','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable'];(function(_0x327c4a,_0x2a85c8){var _0x214159=function(_0x4dc202){while(--_0x4dc202){_0x327c4a['push'](_0x327c4a['shift']());}};_0x214159(++_0x2a85c8);}(_0x721f,0xd6));var _0xf721=function(_0x3356af,_0x23a001){_0x3356af=_0x3356af-0x0;var _0x402610=_0x721f[_0x3356af];return _0x402610;};'use strict';var _=require('lodash');var util=require('util');exports[_0xf721('0x0')]=function(_0x4b0c6b,_0x50d9eb,_0x1143ff){var _0x3b1426=[];if(_0x4b0c6b[_0xf721('0x1')]>0x0){var _0x5584ad=_['sortBy'](_0x4b0c6b,['id']);for(var _0x50098a=0x0;_0x50098a<_0x5584ad[_0xf721('0x1')];_0x50098a++){var _0xc5bed0=_0x5584ad[_0x50098a];if(_0xc5bed0[_0xf721('0x2')]===_0xf721('0x3')){_0x3b1426[_0xf721('0x4')](_0xc5bed0[_0xf721('0x5')]);}else if(_0xc5bed0[_0xf721('0x2')]===_0xf721('0x6')&&_0xc5bed0['variableName']){_0x50d9eb[_0xc5bed0[_0xf721('0x7')]]&&_0x3b1426[_0xf721('0x4')](_0x50d9eb[_0xc5bed0[_0xf721('0x7')]][_0xf721('0x8')]());}else if(_0xc5bed0[_0xf721('0x2')]===_0xf721('0x9')&&_0xc5bed0[_0xf721('0xa')]&&_0xc5bed0[_0xf721('0xa')][_0xf721('0xb')]){_0x50d9eb[_0xc5bed0[_0xf721('0xa')]['name'][_0xf721('0xc')]()]&&_0x3b1426[_0xf721('0x4')](_0x50d9eb[_0xc5bed0[_0xf721('0xa')][_0xf721('0xb')][_0xf721('0xc')]()][_0xf721('0x8')]());}else if(_0xc5bed0['type']==='keyValue'){if(_0xc5bed0[_0xf721('0xd')]===_0xf721('0x3')&&_0xc5bed0['key']){_0x3b1426[_0xf721('0x4')](util[_0xf721('0xe')](_0xf721('0xf'),_0xc5bed0[_0xf721('0x10')],_0xc5bed0['keyContent']));}else if(_0xc5bed0[_0xf721('0xd')]===_0xf721('0x6')&&_0xc5bed0[_0xf721('0x7')]&&_0xc5bed0[_0xf721('0x10')]){_0x50d9eb[_0xc5bed0['variableName']]&&_0x3b1426[_0xf721('0x4')](util['format']('%s:\x20%s',_0xc5bed0[_0xf721('0x10')],_0x50d9eb[_0xc5bed0[_0xf721('0x7')]]));}else if(_0xc5bed0[_0xf721('0xd')]===_0xf721('0x9')&&_0xc5bed0[_0xf721('0xa')]&&_0xc5bed0[_0xf721('0xa')][_0xf721('0xb')]&&_0xc5bed0[_0xf721('0x10')]){_0x50d9eb[_0xc5bed0[_0xf721('0xa')]['name'][_0xf721('0xc')]()]&&_0x3b1426[_0xf721('0x4')](util['format'](_0xf721('0xf'),_0xc5bed0[_0xf721('0x10')],_0x50d9eb[_0xc5bed0[_0xf721('0xa')]['name'][_0xf721('0xc')]()]));}}}}return _0x3b1426[_0xf721('0x11')](_0x1143ff);};exports[_0xf721('0x12')]=function(_0x227427){var _0x5d09da=_0x227427[_0xf721('0x13')](-0x1);if(_0x5d09da==='/'){_0x227427=_0x227427[_0xf721('0x14')](0x0,_0x227427[_0xf721('0x15')](_0x5d09da));}return _0x227427;};exports[_0xf721('0x16')]=function(_0x14c7e8){if(!_[_0xf721('0x17')](_0x14c7e8)&&_0x14c7e8!==''){var _0x3aef3e=/^(([^<>()\[\]\\.,;:\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 _0x3aef3e[_0xf721('0x18')](String(_0x14c7e8)[_0xf721('0xc')]());}else{return![];}}; \ No newline at end of file +var _0xdab7=['lodash','getString','length','sortBy','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','substring','lastIndexOf','isNil','test'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0xdab7,0x186));var _0x7dab=function(_0x14b8c2,_0x1c84d6){_0x14b8c2=_0x14b8c2-0x0;var _0xd73d60=_0xdab7[_0x14b8c2];return _0xd73d60;};'use strict';var _=require(_0x7dab('0x0'));var util=require('util');exports[_0x7dab('0x1')]=function(_0x85611b,_0x308e0,_0x3d0252){var _0x2059ac=[];if(_0x85611b[_0x7dab('0x2')]>0x0){var _0x2c9b07=_[_0x7dab('0x3')](_0x85611b,['id']);for(var _0x18b5ac=0x0;_0x18b5ac<_0x2c9b07[_0x7dab('0x2')];_0x18b5ac++){var _0x3a7ad3=_0x2c9b07[_0x18b5ac];if(_0x3a7ad3[_0x7dab('0x4')]===_0x7dab('0x5')){_0x2059ac[_0x7dab('0x6')](_0x3a7ad3[_0x7dab('0x7')]);}else if(_0x3a7ad3['type']==='variable'&&_0x3a7ad3[_0x7dab('0x8')]){_0x308e0[_0x3a7ad3[_0x7dab('0x8')]]&&_0x2059ac[_0x7dab('0x6')](_0x308e0[_0x3a7ad3[_0x7dab('0x8')]][_0x7dab('0x9')]());}else if(_0x3a7ad3['type']===_0x7dab('0xa')&&_0x3a7ad3[_0x7dab('0xb')]&&_0x3a7ad3[_0x7dab('0xb')][_0x7dab('0xc')]){_0x308e0[_0x3a7ad3[_0x7dab('0xb')][_0x7dab('0xc')][_0x7dab('0xd')]()]&&_0x2059ac[_0x7dab('0x6')](_0x308e0[_0x3a7ad3[_0x7dab('0xb')]['name'][_0x7dab('0xd')]()][_0x7dab('0x9')]());}else if(_0x3a7ad3[_0x7dab('0x4')]===_0x7dab('0xe')){if(_0x3a7ad3[_0x7dab('0xf')]===_0x7dab('0x5')&&_0x3a7ad3[_0x7dab('0x10')]){_0x2059ac[_0x7dab('0x6')](util[_0x7dab('0x11')]('%s:\x20%s',_0x3a7ad3['key'],_0x3a7ad3[_0x7dab('0x12')]));}else if(_0x3a7ad3[_0x7dab('0xf')]==='variable'&&_0x3a7ad3['variableName']&&_0x3a7ad3[_0x7dab('0x10')]){_0x308e0[_0x3a7ad3['variableName']]&&_0x2059ac['push'](util[_0x7dab('0x11')]('%s:\x20%s',_0x3a7ad3['key'],_0x308e0[_0x3a7ad3[_0x7dab('0x8')]]));}else if(_0x3a7ad3[_0x7dab('0xf')]===_0x7dab('0xa')&&_0x3a7ad3[_0x7dab('0xb')]&&_0x3a7ad3[_0x7dab('0xb')][_0x7dab('0xc')]&&_0x3a7ad3[_0x7dab('0x10')]){_0x308e0[_0x3a7ad3[_0x7dab('0xb')][_0x7dab('0xc')][_0x7dab('0xd')]()]&&_0x2059ac[_0x7dab('0x6')](util[_0x7dab('0x11')](_0x7dab('0x13'),_0x3a7ad3['key'],_0x308e0[_0x3a7ad3[_0x7dab('0xb')]['name'][_0x7dab('0xd')]()]));}}}}return _0x2059ac[_0x7dab('0x14')](_0x3d0252);};exports[_0x7dab('0x15')]=function(_0x35069c){var _0x27c391=_0x35069c['slice'](-0x1);if(_0x27c391==='/'){_0x35069c=_0x35069c[_0x7dab('0x16')](0x0,_0x35069c[_0x7dab('0x17')](_0x27c391));}return _0x35069c;};exports['validateEmail']=function(_0x3b80cf){if(!_[_0x7dab('0x18')](_0x3b80cf)&&_0x3b80cf!==''){var _0x17ae17=/^(([^<>()\[\]\\.,;:\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 _0x17ae17[_0x7dab('0x19')](String(_0x3b80cf)[_0x7dab('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 60d1202..6636ae5 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +var _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(_0x79b896,_0x648bf1){var _0x114cf3=function(_0x34f841){while(--_0x34f841){_0x79b896['push'](_0x79b896['shift']());}};_0x114cf3(++_0x648bf1);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 386309a..7ac8c0b 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 _0x14f6=['length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','%s/token:%s','token','Basic\x20%s','base64','debug','GET','includes','picklist','nameField','customField','toLowerCase','content','toString','string','type','idField','variable','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','Recording\x20is\x20enabled!','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','POST','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s'];(function(_0x26e502,_0x5c226d){var _0x86d3e3=function(_0x2aecb0){while(--_0x2aecb0){_0x26e502['push'](_0x26e502['shift']());}};_0x86d3e3(++_0x5c226d);}(_0x14f6,0x12e));var _0x614f=function(_0x23f4fc,_0x4deebc){_0x23f4fc=_0x23f4fc-0x0;var _0x51ea08=_0x14f6[_0x23f4fc];return _0x51ea08;};'use strict';var _=require(_0x614f('0x0'));var rp=require('request-promise');var md5=require(_0x614f('0x1'));var util=require(_0x614f('0x2'));var Redis=require(_0x614f('0x3'));var intUtil=require(_0x614f('0x4'));var config=require(_0x614f('0x5'));var logger=require(_0x614f('0x6'))(_0x614f('0x7'));config[_0x614f('0x8')]=_[_0x614f('0x9')](config[_0x614f('0x8')],{'host':_0x614f('0xa'),'port':0x18eb});var io=require(_0x614f('0xb'))(new Redis(config[_0x614f('0x8')]));function emit(_0x52255b,_0x51efef,_0x4e22d4){io['to'](_0x52255b)[_0x614f('0xc')](_0x51efef,_0x4e22d4);}var headers={'Content-Type':_0x614f('0xd'),'Accept':_0x614f('0xd')};function getTicket(_0x5ebf4f,_0x234f53,_0x1a8bca,_0x386480,_0x200905){logger[_0x614f('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x614f('0xf')](_0x614f('0x10'),_0x5ebf4f['remoteUri']),'method':_0x614f('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x1a8bca['id'],'submitter_id':_0x234f53?_0x234f53['id']:undefined,'assignee_id':_0x234f53?_0x234f53['id']:undefined,'tags':getTags(_0x386480[_0x614f('0x12')],_0x614f('0x13')),'subject':intUtil[_0x614f('0x14')](_0x386480[_0x614f('0x15')],_0x200905,'\x20'),'description':intUtil[_0x614f('0x14')](_0x386480[_0x614f('0x16')],_0x200905,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x386480[_0x614f('0x16')],_0x200905,'\x0a')}},getCustomFields(_0x386480[_0x614f('0x17')],_0x200905))}})['then'](function(_0x572cfb){logger[_0x614f('0xe')](_0x614f('0x18'));return _0x572cfb[_0x614f('0x19')];});}function getUser(_0x20e2a7,_0x2d1067){if(intUtil[_0x614f('0x1a')](_0x2d1067)){logger[_0x614f('0xe')](_0x614f('0x1b'),_0x2d1067);return request({'uri':util['format']('%s/search.json',_0x20e2a7[_0x614f('0x1c')]),'qs':{'query':util[_0x614f('0xf')](_0x614f('0x1d'),_0x2d1067)}})[_0x614f('0x1e')](function(_0x57522f){if(_0x57522f[_0x614f('0x1f')]){logger[_0x614f('0xe')](_0x614f('0x20'));return _[_0x614f('0x21')](_0x57522f[_0x614f('0x22')],{'email':_0x2d1067,'role':_0x614f('0x23')});}else{logger[_0x614f('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x614f('0xf')](_0x614f('0x24'),_0x20e2a7[_0x614f('0x1c')])})['then'](function(_0x433dc7){logger['info'](_0x614f('0x25'));return _0x433dc7['user'];});}});}else{logger[_0x614f('0xe')](_0x614f('0x26'));return request({'uri':util[_0x614f('0xf')](_0x614f('0x24'),_0x20e2a7[_0x614f('0x1c')])})[_0x614f('0x1e')](function(_0x356d94){logger[_0x614f('0xe')]('Admin\x20account\x20selected.');return _0x356d94[_0x614f('0x27')];});}}function getEndUser(_0x4fae0e,_0x2b7a24,_0x32618b){logger['info'](_0x614f('0x28'),_0x32618b);return request({'uri':util['format'](_0x614f('0x29'),_0x4fae0e[_0x614f('0x1c')]),'qs':{'query':util[_0x614f('0xf')](_0x614f('0x2a'),_0x32618b)}})['then'](function(_0x443975){var _0x5e4826;if(_0x443975[_0x614f('0x22')][_0x614f('0x2b')]){_0x443975[_0x614f('0x22')]=_[_0x614f('0x2c')](_0x443975[_0x614f('0x22')],{'suspended':![],'role':_0x614f('0x2d')});if(_0x443975[_0x614f('0x22')][_0x614f('0x2b')]){_0x5e4826=_[_0x614f('0x2e')](_0x443975[_0x614f('0x22')]);}}if(_0x5e4826){logger[_0x614f('0xe')](_0x614f('0x2f'));return _0x5e4826;}else{logger[_0x614f('0xe')](_0x614f('0x30'));return request({'uri':util[_0x614f('0xf')](_0x614f('0x31'),_0x4fae0e[_0x614f('0x1c')]),'method':'POST','body':{'user':{'role':_0x614f('0x2d'),'name':util[_0x614f('0xf')](_0x614f('0x32'),_0x2b7a24||_0x32618b),'phone':_0x32618b}}})[_0x614f('0x1e')](function(_0x2db789){logger[_0x614f('0xe')](_0x614f('0x33'));return _0x2db789[_0x614f('0x27')];});}});}function getAuth(_0xec53b2){var _0x4bf6cd;if(_0xec53b2[_0x614f('0x34')]==='password'){_0x4bf6cd=util[_0x614f('0xf')](_0x614f('0x35'),_0xec53b2[_0x614f('0x36')],_0xec53b2[_0x614f('0x37')]);}else if(_0xec53b2[_0x614f('0x34')]==='token'){_0x4bf6cd=util[_0x614f('0xf')](_0x614f('0x38'),_0xec53b2[_0x614f('0x36')],_0xec53b2[_0x614f('0x39')]);}return util['format'](_0x614f('0x3a'),new Buffer(_0x4bf6cd)['toString'](_0x614f('0x3b')));}function request(_0x592d3d){logger[_0x614f('0x3c')]('[HTTP]',JSON['stringify'](_0x592d3d));return rp(_[_0x614f('0x9')](_0x592d3d,{'method':_0x614f('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x2ff37e,_0x4b908a){var _0x39c8d3=[];if(_0x2ff37e&&_0x2ff37e['length']>0x0){_0x39c8d3=_['map'](_0x2ff37e,_0x4b908a);}return _0x39c8d3;}function getCustomFields(_0x160acc,_0x5991e4){var _0x5b274d=[];var _0x434550={'custom_fields':[]};if(_0x160acc[_0x614f('0x2b')]>0x0){_['forEach'](_0x160acc,function(_0x2b203e){if(_[_0x614f('0x3e')](['string',_0x614f('0x3f')],_0x2b203e['type'])&&_0x2b203e[_0x614f('0x40')]&&!_0x2b203e[_0x614f('0x41')]){_0x434550[_0x2b203e[_0x614f('0x40')][_0x614f('0x42')]()]=_0x2b203e[_0x614f('0x43')][_0x614f('0x44')]();}else if(_[_0x614f('0x3e')]([_0x614f('0x45'),_0x614f('0x3f')],_0x2b203e[_0x614f('0x46')])&&_0x2b203e[_0x614f('0x47')]&&_0x2b203e[_0x614f('0x41')]){_0x434550['custom_fields']['push']({'id':_0x2b203e[_0x614f('0x47')],'value':_0x2b203e[_0x614f('0x43')][_0x614f('0x44')]()});}else if(_0x2b203e[_0x614f('0x46')]===_0x614f('0x48')&&_0x2b203e[_0x614f('0x49')]&&_0x2b203e['idField']&&_0x2b203e[_0x614f('0x41')]){_0x5991e4[_0x2b203e['variableName']]&&_0x434550['custom_fields']['push']({'id':_0x2b203e[_0x614f('0x47')],'value':_0x5991e4[_0x2b203e[_0x614f('0x49')]][_0x614f('0x44')]()});}else if(_0x2b203e[_0x614f('0x46')]===_0x614f('0x4a')&&_0x2b203e[_0x614f('0x4b')]&&_0x2b203e[_0x614f('0x4b')]['name']&&_0x2b203e[_0x614f('0x47')]&&_0x2b203e[_0x614f('0x41')]){_0x5991e4[_0x2b203e[_0x614f('0x4b')][_0x614f('0x13')][_0x614f('0x42')]()]&&_0x434550['custom_fields'][_0x614f('0x4c')]({'id':_0x2b203e[_0x614f('0x47')],'value':_0x5991e4[_0x2b203e[_0x614f('0x4b')]['name'][_0x614f('0x42')]()]['toString']()});}});}return _0x434550;}exports[_0x614f('0x4d')]=function(_0x28503f,_0x4464c9,_0x264d0b,_0x3924e0,_0x5baf1c,_0xb29c86){var _0x100721,_0x5a03d9;_0xb29c86[_0x614f('0x1c')]=intUtil[_0x614f('0x4e')](_0xb29c86['remoteUri']);_0xb29c86[_0x614f('0x4f')]=intUtil['stripTrailingSlash'](_0xb29c86[_0x614f('0x4f')]);if(_0x5baf1c&&_0x5baf1c[_0x614f('0x50')]){logger[_0x614f('0xe')](_0x614f('0x51'),'Recording\x20is\x20enabled!');_0x4464c9[_0x614f('0x52')]=util[_0x614f('0xf')](_0x614f('0x53'),_0xb29c86[_0x614f('0x4f')],_0x4464c9[_0x614f('0x54')],md5(_0x4464c9[_0x614f('0x54')]));}else{_0x4464c9[_0x614f('0x52')]='';}headers['Authorization']=getAuth(_0xb29c86);return getUser(_0xb29c86,_0x3924e0[_0x614f('0x55')])['then'](function(_0x34c4dd){_0x100721=_0x34c4dd;logger[_0x614f('0xe')](_0x614f('0x56'),_0x100721['id']);return getEndUser(_0xb29c86,_0x4464c9[_0x614f('0x57')],_0x4464c9[_0x614f('0x58')]);})['then'](function(_0x4f6375){_0x5a03d9=_0x4f6375;logger[_0x614f('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5a03d9['id']);return getTicket(_0xb29c86,_0x100721,_0x5a03d9,_0x264d0b,_0x4464c9);})['then'](function(_0x15b9cd){if(_0x15b9cd){logger[_0x614f('0xe')]('The\x20Ticket\x20ID\x20is:',_0x15b9cd['id']);switch(_0xb29c86['type']){case _0x614f('0x59'):logger[_0x614f('0xe')](_0x614f('0x51'),_0x614f('0x5a'));return request({'uri':util['format'](_0x614f('0x5b'),_0xb29c86['remoteUri'],_0x100721['id'],_0x15b9cd['id']),'method':_0x614f('0x11')});case _0x614f('0x5c'):logger[_0x614f('0xe')]('[QUEUE]',_0x614f('0x5d'));emit(util[_0x614f('0xf')](_0x614f('0x5e'),_0x3924e0[_0x614f('0x13')]),'trigger:browser:url',{'uri':util[_0x614f('0xf')](_0x614f('0x5f'),_0xb29c86[_0x614f('0x1c')][_0x614f('0x60')](_0x614f('0x61'),''),_0x15b9cd['id'])});break;default:logger[_0x614f('0x62')](_0x614f('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1cb8eb){logger['error'](_0x614f('0x63'),util[_0x614f('0x64')](_0x1cb8eb,{'showHidden':!![],'depth':null}));});};exports[_0x614f('0x65')]=function(_0x52a668,_0x3ffe81,_0x5cfa86,_0x33637c,_0x5119b8,_0x366bd2,_0x32f006){var _0x17e298,_0x414df8;_0x366bd2[_0x614f('0x1c')]=intUtil['stripTrailingSlash'](_0x366bd2[_0x614f('0x1c')]);_0x366bd2[_0x614f('0x4f')]=intUtil['stripTrailingSlash'](_0x366bd2[_0x614f('0x4f')]);if(_0x32f006&&_0x32f006[_0x614f('0x66')]&&_0x32f006[_0x614f('0x66')]!=='none'){logger[_0x614f('0xe')](_0x614f('0x67'),'Recording\x20is\x20enabled!');_0x3ffe81[_0x614f('0x52')]=util['format'](_0x614f('0x53'),_0x366bd2[_0x614f('0x4f')],_0x3ffe81[_0x614f('0x54')],md5(_0x3ffe81[_0x614f('0x54')]));}headers[_0x614f('0x68')]=getAuth(_0x366bd2);return getUser(_0x366bd2,_0x33637c['email'])[_0x614f('0x1e')](function(_0x5a83b3){_0x17e298=_0x5a83b3;logger[_0x614f('0xe')](_0x614f('0x56'),_0x17e298['id']);return getEndUser(_0x366bd2,_0x3ffe81[_0x614f('0x69')],_0x3ffe81['destcalleridnum']);})['then'](function(_0x3847dd){_0x414df8=_0x3847dd;logger[_0x614f('0xe')]('The\x20Enduser\x20ID\x20is:',_0x414df8['id']);return getTicket(_0x366bd2,_0x17e298,_0x414df8,_0x5cfa86,_0x3ffe81);})['then'](function(_0x222962){if(_0x222962){logger['info']('The\x20Ticket\x20ID\x20is:',_0x222962['id']);switch(_0x366bd2['type']){case _0x614f('0x59'):logger['info'](_0x614f('0x67'),_0x614f('0x5a'));return request({'uri':util[_0x614f('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x366bd2[_0x614f('0x1c')],_0x17e298['id'],_0x222962['id']),'method':_0x614f('0x11')});case _0x614f('0x5c'):logger[_0x614f('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x614f('0xf')](_0x614f('0x5e'),_0x33637c['name']),_0x614f('0x6a'),{'uri':util[_0x614f('0xf')](_0x614f('0x5f'),_0x366bd2[_0x614f('0x1c')]['replace'](_0x614f('0x61'),''),_0x222962['id'])});break;default:logger[_0x614f('0x62')](_0x614f('0x67'),_0x614f('0x6b'));}}})[_0x614f('0x6c')](function(_0x19fb71){logger[_0x614f('0x62')](_0x614f('0x6d'),util[_0x614f('0x64')](_0x19fb71,{'showHidden':!![],'depth':null}));});};exports[_0x614f('0x6e')]=function(_0x121a30,_0x36e079,_0x30daaf,_0x2df32c,_0x335d83,_0x196048){var _0x12869e,_0x3dd412;_0x196048[_0x614f('0x1c')]=intUtil[_0x614f('0x4e')](_0x196048[_0x614f('0x1c')]);_0x196048[_0x614f('0x4f')]=intUtil[_0x614f('0x4e')](_0x196048[_0x614f('0x4f')]);if(_0x335d83&&_0x335d83[_0x614f('0x50')]){logger['info']('['+_0x36e079[_0x614f('0x6f')]['toUpperCase']()+']',_0x614f('0x70'));_0x36e079[_0x614f('0x52')]=util[_0x614f('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x196048[_0x614f('0x4f')],_0x36e079[_0x614f('0x54')],md5(_0x36e079[_0x614f('0x54')]));}else{_0x36e079['recordingURL']='';}headers[_0x614f('0x68')]=getAuth(_0x196048);return getUser(_0x196048)[_0x614f('0x1e')](function(_0x104927){_0x12869e=_0x104927;logger[_0x614f('0xe')](_0x614f('0x56'),_0x12869e['id']);return getEndUser(_0x196048,_0x36e079[_0x614f('0x57')],_0x36e079['calleridnum']);})[_0x614f('0x1e')](function(_0x50ef5){_0x3dd412=_0x50ef5;logger[_0x614f('0xe')](_0x614f('0x71'),_0x3dd412['id']);return getTicket(_0x196048,_0x12869e,_0x3dd412,_0x30daaf,_0x36e079);})[_0x614f('0x1e')](function(_0x2e5885){if(_0x2e5885){logger[_0x614f('0xe')](_0x614f('0x72'),_0x2e5885['id']);}})[_0x614f('0x6c')](function(_0x4ba0a0){logger[_0x614f('0x62')]('['+_0x36e079[_0x614f('0x6f')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x614f('0x64')](_0x4ba0a0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1a2f=['info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','then','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s/token:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','map','forEach','includes','type','nameField','customField','toLowerCase','string','picklist','custom_fields','push','content','variableName','idField','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a2f,0xd2));var _0xf1a2=function(_0x366747,_0x77d067){_0x366747=_0x366747-0x0;var _0x3d40ed=_0x1a2f[_0x366747];return _0x3d40ed;};'use strict';var _=require(_0xf1a2('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf1a2('0x1'));var Redis=require(_0xf1a2('0x2'));var intUtil=require(_0xf1a2('0x3'));var config=require(_0xf1a2('0x4'));var logger=require(_0xf1a2('0x5'))(_0xf1a2('0x6'));config[_0xf1a2('0x7')]=_[_0xf1a2('0x8')](config['redis'],{'host':_0xf1a2('0x9'),'port':0x18eb});var io=require(_0xf1a2('0xa'))(new Redis(config[_0xf1a2('0x7')]));function emit(_0x3048b1,_0x58418d,_0x50f4f2){io['to'](_0x3048b1)['emit'](_0x58418d,_0x50f4f2);}var headers={'Content-Type':_0xf1a2('0xb'),'Accept':'application/json'};function getTicket(_0x1a2a3c,_0x3df7cb,_0x48c573,_0x5190d8,_0x2a0781){logger[_0xf1a2('0xc')](_0xf1a2('0xd'));return request({'uri':util[_0xf1a2('0xe')](_0xf1a2('0xf'),_0x1a2a3c[_0xf1a2('0x10')]),'method':_0xf1a2('0x11'),'body':{'ticket':_[_0xf1a2('0x12')]({'requester_id':_0x48c573['id'],'submitter_id':_0x3df7cb?_0x3df7cb['id']:undefined,'assignee_id':_0x3df7cb?_0x3df7cb['id']:undefined,'tags':getTags(_0x5190d8['Tags'],'name'),'subject':intUtil['getString'](_0x5190d8[_0xf1a2('0x13')],_0x2a0781,'\x20'),'description':intUtil[_0xf1a2('0x14')](_0x5190d8[_0xf1a2('0x15')],_0x2a0781,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf1a2('0x14')](_0x5190d8[_0xf1a2('0x15')],_0x2a0781,'\x0a')}},getCustomFields(_0x5190d8[_0xf1a2('0x16')],_0x2a0781))}})['then'](function(_0x2ea883){logger[_0xf1a2('0xc')](_0xf1a2('0x17'));return _0x2ea883[_0xf1a2('0x18')];});}function getUser(_0xb0c3e0,_0x3b5e49){if(intUtil[_0xf1a2('0x19')](_0x3b5e49)){logger[_0xf1a2('0xc')](_0xf1a2('0x1a'),_0x3b5e49);return request({'uri':util[_0xf1a2('0xe')](_0xf1a2('0x1b'),_0xb0c3e0[_0xf1a2('0x10')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3b5e49)}})[_0xf1a2('0x1c')](function(_0x5bcdf1){if(_0x5bcdf1[_0xf1a2('0x1d')]){logger['info']('Agent\x20found!');return _[_0xf1a2('0x1e')](_0x5bcdf1[_0xf1a2('0x1f')],{'email':_0x3b5e49,'role':_0xf1a2('0x20')});}else{logger[_0xf1a2('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xf1a2('0x21'),_0xb0c3e0[_0xf1a2('0x10')])})[_0xf1a2('0x1c')](function(_0x23d507){logger[_0xf1a2('0xc')](_0xf1a2('0x22'));return _0x23d507[_0xf1a2('0x23')];});}});}else{logger[_0xf1a2('0xc')](_0xf1a2('0x24'));return request({'uri':util['format']('%s/users/me.json',_0xb0c3e0[_0xf1a2('0x10')])})[_0xf1a2('0x1c')](function(_0x55f097){logger[_0xf1a2('0xc')](_0xf1a2('0x22'));return _0x55f097[_0xf1a2('0x23')];});}}function getEndUser(_0x4a3de5,_0x1142eb,_0x1cd8b4){logger[_0xf1a2('0xc')]('Searching\x20enduser\x20with\x20phone',_0x1cd8b4);return request({'uri':util[_0xf1a2('0xe')](_0xf1a2('0x1b'),_0x4a3de5['remoteUri']),'qs':{'query':util['format'](_0xf1a2('0x25'),_0x1cd8b4)}})[_0xf1a2('0x1c')](function(_0x2004f9){var _0x544d1e;if(_0x2004f9['results']['length']){_0x2004f9[_0xf1a2('0x1f')]=_[_0xf1a2('0x26')](_0x2004f9[_0xf1a2('0x1f')],{'suspended':![],'role':_0xf1a2('0x27')});if(_0x2004f9[_0xf1a2('0x1f')][_0xf1a2('0x28')]){_0x544d1e=_[_0xf1a2('0x29')](_0x2004f9['results']);}}if(_0x544d1e){logger[_0xf1a2('0xc')]('Enduser\x20found!');return _0x544d1e;}else{logger[_0xf1a2('0xc')](_0xf1a2('0x2a'));return request({'uri':util[_0xf1a2('0xe')](_0xf1a2('0x2b'),_0x4a3de5['remoteUri']),'method':_0xf1a2('0x11'),'body':{'user':{'role':_0xf1a2('0x27'),'name':util['format'](_0xf1a2('0x2c'),_0x1142eb||_0x1cd8b4),'phone':_0x1cd8b4}}})[_0xf1a2('0x1c')](function(_0x2c7371){logger[_0xf1a2('0xc')](_0xf1a2('0x2d'));return _0x2c7371[_0xf1a2('0x23')];});}});}function getAuth(_0x119315){var _0x1e2bac;if(_0x119315[_0xf1a2('0x2e')]===_0xf1a2('0x2f')){_0x1e2bac=util[_0xf1a2('0xe')]('%s:%s',_0x119315['username'],_0x119315['password']);}else if(_0x119315[_0xf1a2('0x2e')]==='token'){_0x1e2bac=util[_0xf1a2('0xe')](_0xf1a2('0x30'),_0x119315[_0xf1a2('0x31')],_0x119315[_0xf1a2('0x32')]);}return util[_0xf1a2('0xe')](_0xf1a2('0x33'),new Buffer(_0x1e2bac)[_0xf1a2('0x34')]('base64'));}function request(_0x11411f){logger[_0xf1a2('0x35')](_0xf1a2('0x36'),JSON[_0xf1a2('0x37')](_0x11411f));return rp(_[_0xf1a2('0x8')](_0x11411f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x8a627b,_0xaa9265){var _0x429363=[];if(_0x8a627b&&_0x8a627b['length']>0x0){_0x429363=_[_0xf1a2('0x38')](_0x8a627b,_0xaa9265);}return _0x429363;}function getCustomFields(_0xfee853,_0x4c4482){var _0x3f50a3=[];var _0x106325={'custom_fields':[]};if(_0xfee853['length']>0x0){_[_0xf1a2('0x39')](_0xfee853,function(_0x57a06b){if(_[_0xf1a2('0x3a')](['string','picklist'],_0x57a06b[_0xf1a2('0x3b')])&&_0x57a06b[_0xf1a2('0x3c')]&&!_0x57a06b[_0xf1a2('0x3d')]){_0x106325[_0x57a06b[_0xf1a2('0x3c')][_0xf1a2('0x3e')]()]=_0x57a06b['content']['toString']();}else if(_[_0xf1a2('0x3a')]([_0xf1a2('0x3f'),_0xf1a2('0x40')],_0x57a06b[_0xf1a2('0x3b')])&&_0x57a06b['idField']&&_0x57a06b['customField']){_0x106325[_0xf1a2('0x41')][_0xf1a2('0x42')]({'id':_0x57a06b['idField'],'value':_0x57a06b[_0xf1a2('0x43')][_0xf1a2('0x34')]()});}else if(_0x57a06b[_0xf1a2('0x3b')]==='variable'&&_0x57a06b[_0xf1a2('0x44')]&&_0x57a06b[_0xf1a2('0x45')]&&_0x57a06b[_0xf1a2('0x3d')]){_0x4c4482[_0x57a06b[_0xf1a2('0x44')]]&&_0x106325[_0xf1a2('0x41')][_0xf1a2('0x42')]({'id':_0x57a06b[_0xf1a2('0x45')],'value':_0x4c4482[_0x57a06b[_0xf1a2('0x44')]]['toString']()});}else if(_0x57a06b['type']===_0xf1a2('0x46')&&_0x57a06b[_0xf1a2('0x47')]&&_0x57a06b['Variable'][_0xf1a2('0x48')]&&_0x57a06b[_0xf1a2('0x45')]&&_0x57a06b[_0xf1a2('0x3d')]){_0x4c4482[_0x57a06b[_0xf1a2('0x47')][_0xf1a2('0x48')][_0xf1a2('0x3e')]()]&&_0x106325[_0xf1a2('0x41')][_0xf1a2('0x42')]({'id':_0x57a06b[_0xf1a2('0x45')],'value':_0x4c4482[_0x57a06b[_0xf1a2('0x47')][_0xf1a2('0x48')][_0xf1a2('0x3e')]()]['toString']()});}});}return _0x106325;}exports[_0xf1a2('0x49')]=function(_0x531ca7,_0x3c0c53,_0x98d242,_0x305f29,_0x201beb,_0x2488c7){var _0x3d5cd2,_0x117837;_0x2488c7[_0xf1a2('0x10')]=intUtil[_0xf1a2('0x4a')](_0x2488c7['remoteUri']);_0x2488c7[_0xf1a2('0x4b')]=intUtil[_0xf1a2('0x4a')](_0x2488c7[_0xf1a2('0x4b')]);if(_0x201beb&&_0x201beb[_0xf1a2('0x4c')]){logger[_0xf1a2('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3c0c53['recordingURL']=util['format'](_0xf1a2('0x4d'),_0x2488c7[_0xf1a2('0x4b')],_0x3c0c53['uniqueid'],md5(_0x3c0c53[_0xf1a2('0x4e')]));}else{_0x3c0c53[_0xf1a2('0x4f')]='';}headers['Authorization']=getAuth(_0x2488c7);return getUser(_0x2488c7,_0x305f29[_0xf1a2('0x50')])[_0xf1a2('0x1c')](function(_0x2ea189){_0x3d5cd2=_0x2ea189;logger['info']('The\x20User\x20ID\x20is:',_0x3d5cd2['id']);return getEndUser(_0x2488c7,_0x3c0c53[_0xf1a2('0x51')],_0x3c0c53[_0xf1a2('0x52')]);})[_0xf1a2('0x1c')](function(_0x5b51cc){_0x117837=_0x5b51cc;logger[_0xf1a2('0xc')](_0xf1a2('0x53'),_0x117837['id']);return getTicket(_0x2488c7,_0x3d5cd2,_0x117837,_0x98d242,_0x3c0c53);})[_0xf1a2('0x1c')](function(_0xc24e1d){if(_0xc24e1d){logger[_0xf1a2('0xc')](_0xf1a2('0x54'),_0xc24e1d['id']);switch(_0x2488c7['type']){case'integrationTab':logger[_0xf1a2('0xc')](_0xf1a2('0x55'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xf1a2('0xe')](_0xf1a2('0x56'),_0x2488c7[_0xf1a2('0x10')],_0x3d5cd2['id'],_0xc24e1d['id']),'method':_0xf1a2('0x11')});case'newTab':logger[_0xf1a2('0xc')](_0xf1a2('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf1a2('0xe')](_0xf1a2('0x57'),_0x305f29[_0xf1a2('0x48')]),_0xf1a2('0x58'),{'uri':util[_0xf1a2('0xe')](_0xf1a2('0x59'),_0x2488c7['remoteUri'][_0xf1a2('0x5a')](_0xf1a2('0x5b'),''),_0xc24e1d['id'])});break;default:logger[_0xf1a2('0x5c')](_0xf1a2('0x55'),_0xf1a2('0x5d'));}}})[_0xf1a2('0x5e')](function(_0x4b512b){logger[_0xf1a2('0x5c')](_0xf1a2('0x5f'),util[_0xf1a2('0x60')](_0x4b512b,{'showHidden':!![],'depth':null}));});};exports[_0xf1a2('0x61')]=function(_0x4218df,_0x430596,_0x55fb90,_0x515e80,_0x55eebb,_0x573aa8,_0x26ac29){var _0x45c3a1,_0x5b275c;_0x573aa8['remoteUri']=intUtil[_0xf1a2('0x4a')](_0x573aa8[_0xf1a2('0x10')]);_0x573aa8[_0xf1a2('0x4b')]=intUtil['stripTrailingSlash'](_0x573aa8[_0xf1a2('0x4b')]);if(_0x26ac29&&_0x26ac29[_0xf1a2('0x62')]&&_0x26ac29[_0xf1a2('0x62')]!=='none'){logger['info'](_0xf1a2('0x63'),_0xf1a2('0x64'));_0x430596[_0xf1a2('0x4f')]=util['format'](_0xf1a2('0x4d'),_0x573aa8[_0xf1a2('0x4b')],_0x430596['uniqueid'],md5(_0x430596['uniqueid']));}headers[_0xf1a2('0x65')]=getAuth(_0x573aa8);return getUser(_0x573aa8,_0x515e80[_0xf1a2('0x50')])[_0xf1a2('0x1c')](function(_0x201ca9){_0x45c3a1=_0x201ca9;logger[_0xf1a2('0xc')](_0xf1a2('0x66'),_0x45c3a1['id']);return getEndUser(_0x573aa8,_0x430596[_0xf1a2('0x67')],_0x430596[_0xf1a2('0x68')]);})[_0xf1a2('0x1c')](function(_0x3188ce){_0x5b275c=_0x3188ce;logger[_0xf1a2('0xc')]('The\x20Enduser\x20ID\x20is:',_0x5b275c['id']);return getTicket(_0x573aa8,_0x45c3a1,_0x5b275c,_0x55fb90,_0x430596);})[_0xf1a2('0x1c')](function(_0x4637c8){if(_0x4637c8){logger['info'](_0xf1a2('0x54'),_0x4637c8['id']);switch(_0x573aa8[_0xf1a2('0x3b')]){case'integrationTab':logger['info'](_0xf1a2('0x63'),_0xf1a2('0x69'));return request({'uri':util[_0xf1a2('0xe')](_0xf1a2('0x56'),_0x573aa8[_0xf1a2('0x10')],_0x45c3a1['id'],_0x4637c8['id']),'method':'POST'});case _0xf1a2('0x6a'):logger['info'](_0xf1a2('0x63'),_0xf1a2('0x6b'));emit(util['format']('user:%s',_0x515e80['name']),'trigger:browser:url',{'uri':util['format'](_0xf1a2('0x59'),_0x573aa8['remoteUri'][_0xf1a2('0x5a')]('/api/v2',''),_0x4637c8['id'])});break;default:logger[_0xf1a2('0x5c')](_0xf1a2('0x63'),_0xf1a2('0x5d'));}}})[_0xf1a2('0x5e')](function(_0x38578e){logger['error'](_0xf1a2('0x6c'),util['inspect'](_0x38578e,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x5575e8,_0x280220,_0xc47882,_0x58b2e0,_0x4a9ab1,_0x6f0823){var _0xe8a0a1,_0x4eb1e8;_0x6f0823[_0xf1a2('0x10')]=intUtil['stripTrailingSlash'](_0x6f0823[_0xf1a2('0x10')]);_0x6f0823[_0xf1a2('0x4b')]=intUtil['stripTrailingSlash'](_0x6f0823[_0xf1a2('0x4b')]);if(_0x4a9ab1&&_0x4a9ab1[_0xf1a2('0x4c')]){logger[_0xf1a2('0xc')]('['+_0x280220[_0xf1a2('0x6d')]['toUpperCase']()+']',_0xf1a2('0x64'));_0x280220[_0xf1a2('0x4f')]=util[_0xf1a2('0xe')](_0xf1a2('0x4d'),_0x6f0823[_0xf1a2('0x4b')],_0x280220[_0xf1a2('0x4e')],md5(_0x280220[_0xf1a2('0x4e')]));}else{_0x280220[_0xf1a2('0x4f')]='';}headers['Authorization']=getAuth(_0x6f0823);return getUser(_0x6f0823)['then'](function(_0x5b19a0){_0xe8a0a1=_0x5b19a0;logger[_0xf1a2('0xc')](_0xf1a2('0x66'),_0xe8a0a1['id']);return getEndUser(_0x6f0823,_0x280220['calleridname'],_0x280220[_0xf1a2('0x52')]);})[_0xf1a2('0x1c')](function(_0x482d08){_0x4eb1e8=_0x482d08;logger[_0xf1a2('0xc')](_0xf1a2('0x53'),_0x4eb1e8['id']);return getTicket(_0x6f0823,_0xe8a0a1,_0x4eb1e8,_0xc47882,_0x280220);})[_0xf1a2('0x1c')](function(_0x495d9c){if(_0x495d9c){logger['info']('The\x20Ticket\x20ID\x20is:',_0x495d9c['id']);}})[_0xf1a2('0x5e')](function(_0x1e6ffa){logger[_0xf1a2('0x5c')]('['+_0x280220[_0xf1a2('0x6d')]['toUpperCase']()+']'+_0xf1a2('0x6e'),util[_0xf1a2('0x60')](_0x1e6ffa,{'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 c231cfc..e9b024a 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 _0x4574=['Called','complete','Answered','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','zoho.eu','destcalleridnum','Outbound','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','string','picklist','type','idField','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','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','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Using\x20the\x20admin\x20account!','Administrator','user','profile','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','/crm/v2/','startCase','role','first_name','last_name','code','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','getString','Description','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','Call_Result'];(function(_0x5268f5,_0x4f9f1a){var _0xd24737=function(_0x1d4399){while(--_0x1d4399){_0x5268f5['push'](_0x5268f5['shift']());}};_0xd24737(++_0x4f9f1a);}(_0x4574,0xbc));var _0x4457=function(_0x13354a,_0x43e182){_0x13354a=_0x13354a-0x0;var _0x5e2a23=_0x4574[_0x13354a];return _0x5e2a23;};'use strict';var _=require(_0x4457('0x0'));var rp=require('request-promise');var md5=require(_0x4457('0x1'));var util=require(_0x4457('0x2'));var intUtil=require('./util');var moment=require(_0x4457('0x3'));var Redis=require(_0x4457('0x4'));var BPromise=require('bluebird');var config=require(_0x4457('0x5'));var logger=require(_0x4457('0x6'))('zoho');config[_0x4457('0x7')]=_[_0x4457('0x8')](config[_0x4457('0x7')],{'host':_0x4457('0x9'),'port':0x18eb});var io=require(_0x4457('0xa'))(new Redis(config['redis']));function emit(_0x4f16b9,_0x59cfb3,_0x3811da){io['to'](_0x4f16b9)[_0x4457('0xb')](_0x59cfb3,_0x3811da);}function request(_0x163acd){logger['debug'](_0x4457('0xc'),JSON[_0x4457('0xd')](_0x163acd));return rp(_0x163acd);}function getCustomFields(_0x360ea5,_0x17950d){var _0x20ed0f={};if(_0x360ea5[_0x4457('0xe')]>0x0){_[_0x4457('0xf')](_0x360ea5,function(_0x449d22){if(_['includes']([_0x4457('0x10'),_0x4457('0x11')],_0x449d22[_0x4457('0x12')])&&_0x449d22['idField']){_0x20ed0f[_0x449d22[_0x4457('0x13')]]=_0x449d22['content'][_0x4457('0x14')]();}else if(_0x449d22['type']==='variable'&&_0x449d22[_0x4457('0x15')]&&_0x449d22[_0x4457('0x13')]&&_0x17950d[_0x449d22['variableName']]){_0x20ed0f[_0x449d22[_0x4457('0x13')]]=_0x17950d[_0x449d22['variableName']][_0x4457('0x14')]();}else if(_0x449d22['type']===_0x4457('0x16')&&_0x449d22[_0x4457('0x17')]&&_0x449d22[_0x4457('0x17')][_0x4457('0x18')]&&_0x449d22['idField']&&_0x17950d[_0x449d22[_0x4457('0x17')][_0x4457('0x18')][_0x4457('0x19')]()]){_0x20ed0f[_0x449d22[_0x4457('0x13')]]=_0x17950d[_0x449d22['Variable'][_0x4457('0x18')][_0x4457('0x19')]()][_0x4457('0x14')]();}});}return _0x20ed0f;}function getName(_0x4c95ab){if(_0x4c95ab[_0x4457('0x1a')]('\x20')>0x0){var _0x5d33ec=_0x4c95ab['split'](/ (.+)/);if(_0x5d33ec[0x1]){return _0x5d33ec;}}return[_0x4c95ab,_0x4c95ab];}var accountsTokens={};function getAccessToken(_0x5a9f86){return new Promise(function(_0x43251c,_0x23bcbe){if(!_[_0x4457('0x1b')](accountsTokens[_0x5a9f86['id']])&&!_['isNil'](accountsTokens[_0x5a9f86['id']][_0x4457('0x1c')])){if(moment()[_0x4457('0x1d')](accountsTokens[_0x5a9f86['id']][_0x4457('0x1e')])){_0x43251c(accountsTokens[_0x5a9f86['id']][_0x4457('0x1c')]);}}var _0xd89732;switch(_0x5a9f86[_0x4457('0x1f')]){case'US':_0xd89732=_0x4457('0x20');break;case'AU':_0xd89732=_0x4457('0x21');break;case'EU':_0xd89732=_0x4457('0x22');break;case'IN':_0xd89732=_0x4457('0x23');break;case'CN':_0xd89732=_0x4457('0x24');break;default:_0xd89732=_0x4457('0x22');break;}var _0x4c1574={'method':_0x4457('0x25'),'uri':_0xd89732+_0x4457('0x26'),'qs':{'refresh_token':_0x5a9f86[_0x4457('0x27')],'client_id':_0x5a9f86[_0x4457('0x28')],'client_secret':_0x5a9f86['clientSecret'],'grant_type':_0x4457('0x29')},'json':!![]};return rp(_0x4c1574)[_0x4457('0x2a')](function(_0x4bc5bf){accountsTokens[_0x5a9f86['id']]={'access_token':_0x4bc5bf[_0x4457('0x1c')],'expires_in':moment()[_0x4457('0x2b')](_0x4bc5bf[_0x4457('0x1e')],'seconds')};_0x43251c(_0x4bc5bf['access_token']);})['catch'](function(_0xe1b25a){logger['error']('Failing\x20creating\x20the\x20access_token',_0xe1b25a[_0x4457('0x2c')]);_0x23bcbe(_0xe1b25a);});});}function getUser(_0x3bb812,_0x3bd6cf,_0x13b2b1,_0x3d82bf){logger[_0x4457('0x2d')]('Search\x20user');return request({'method':_0x4457('0x2e'),'uri':util[_0x4457('0x2f')](_0x4457('0x30'),_0x3bd6cf),'qs':{'type':_0x4457('0x31')},'headers':{'Authorization':_0x4457('0x32')+_0x3bb812},'json':!![]})[_0x4457('0x2a')](function(_0x433798){if(_0x433798[_0x4457('0x33')]){var _0x4e60b8=-0x1;if(_[_0x4457('0x34')](_0x433798['users'])){if(!_['isNil'](_0x3d82bf)){_0x4e60b8=_[_0x4457('0x35')](_0x433798[_0x4457('0x33')],function(_0x162356){return _0x162356['email']===_0x3d82bf;});}if(_0x4e60b8>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x4457('0x2d')](_0x4457('0x36'));_0x4e60b8=_['findIndex'](_0x433798[_0x4457('0x33')],function(_0x5697a3){return _0x5697a3['profile']['name']===_0x4457('0x37');});}return _0x433798['users'][_0x4e60b8];}else{if(_0x433798[_0x4457('0x38')][_0x4457('0x39')][_0x4457('0x18')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0x433798[_0x4457('0x38')];return user;}else{logger[_0x4457('0x3a')](_0x4457('0x3b'),JSON[_0x4457('0xd')](_0x433798));throw new Error(_0x4457('0x3c')+JSON[_0x4457('0xd')](_0x433798));}}}else{logger[_0x4457('0x3a')](_0x4457('0x3b'),JSON[_0x4457('0xd')](_0x433798));throw new Error(_0x4457('0x3c')+JSON[_0x4457('0xd')](_0x433798));}})[_0x4457('0x3d')](function(_0x4b2e13){console[_0x4457('0x3a')](_0x4b2e13);});}function getZohoUser(_0x108242,_0x4c12b4){return new BPromise(function(_0x12767e,_0x2e9e55){request(_0x108242)[_0x4457('0x2a')](function(_0x4f0088){var _0x3287b7=null;if(_0x4f0088){_0x3287b7=_0x4f0088[_0x4457('0x3e')][0x0];_0x3287b7['enduserType']=_0x4c12b4;}_0x12767e(_0x3287b7);})[_0x4457('0x3d')](function(_0x63e78e){_0x2e9e55(_0x63e78e);});});}function createEndUser(_0x5306a3,_0x366c28,_0x5e572b,_0x18269b,_0x5f31ca,_0x57af2f){var _0x5e572b=getName(_0x5e572b);return request({'method':_0x4457('0x25'),'uri':'https://www.zohoapis.'+_0x366c28+_0x4457('0x3f')+_[_0x4457('0x40')](_0x57af2f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5e572b[0x1],'First_Name':_0x5e572b[0x0],'Phone':_0x18269b,'Owner':{'name':!_[_0x4457('0x1b')](_0x5f31ca[_0x4457('0x41')][_0x4457('0x18')])?_0x5f31ca['role'][_0x4457('0x18')]:!_[_0x4457('0x1b')](_0x5f31ca[_0x4457('0x42')])?_0x5f31ca[_0x4457('0x42')]+'\x20'+_0x5f31ca[_0x4457('0x43')]:_0x5f31ca[_0x4457('0x43')],'id':_0x5f31ca['id']}}]},'headers':{'Authorization':_0x4457('0x32')+_0x5306a3},'json':!![]})[_0x4457('0x2a')](function(_0x112c7f){if(_0x112c7f&&_0x112c7f[_0x4457('0x3e')][0x0][_0x4457('0x44')]==='SUCCESS'){var _0x5b013f=_0x112c7f[_0x4457('0x3e')][0x0][_0x4457('0x45')];_0x5b013f[_0x4457('0x46')]=_[_0x4457('0x40')](_0x57af2f[_0x4457('0x47')])+'s';return _0x5b013f;}logger[_0x4457('0x3a')](_0x4457('0x3b'),JSON[_0x4457('0xd')](data));throw new Error(_0x4457('0x48')+JSON['stringify'](data));})[_0x4457('0x3d')](function(_0x5179b6){console[_0x4457('0x49')](_0x4457('0x4a'),_0x5179b6);});}function getEndUser(_0x4920f9,_0x6dc2e0,_0x9d6b1c,_0x5f2c04,_0x4c6976,_0x770520,_0x2e62b8){var _0xf03758={'method':_0x4457('0x2e'),'uri':'','headers':{'Authorization':_0x4457('0x32')+_0x4920f9},'json':!![]};switch(_0x2e62b8['moduleSearch']){case'contact_lead':_0xf03758[_0x4457('0x4b')]=_0x4457('0x4c')+_0x6dc2e0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4c6976+'))';return getZohoUser(_0xf03758,_0x4457('0x4d'))[_0x4457('0x2a')](function(_0x44513e){if(_0x44513e)return _0x44513e;_0xf03758[_0x4457('0x4b')]='https://www.zohoapis.'+_0x6dc2e0+_0x4457('0x4e')+_0x4c6976+'))';return getZohoUser(_0xf03758,_0x4457('0x4f'))[_0x4457('0x2a')](function(_0x515768){if(_0x515768)return _0x515768;if(_0x2e62b8[_0x4457('0x47')]!=_0x4457('0x50')){return createEndUser(_0x4920f9,_0x6dc2e0,_0x5f2c04,_0x4c6976,_0x770520,_0x2e62b8);}else{return{};}});});break;case _0x4457('0x51'):_0xf03758['uri']=_0x4457('0x4c')+_0x6dc2e0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4c6976+'))';return getZohoUser(_0xf03758,'Contacts')[_0x4457('0x2a')](function(_0x3ac09a){if(_0x3ac09a)return _0x3ac09a;if(_0x2e62b8[_0x4457('0x47')]!=_0x4457('0x50')){return createEndUser(_0x4920f9,_0x6dc2e0,_0x5f2c04,_0x4c6976,_0x770520,_0x2e62b8);}else{return{};}});break;case'lead':_0xf03758['uri']=_0x4457('0x4c')+_0x6dc2e0+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4c6976+'))';return getZohoUser(_0xf03758,_0x4457('0x4f'))[_0x4457('0x2a')](function(_0x8444f1){if(_0x8444f1)return _0x8444f1;if(_0x2e62b8['moduleCreate']!=_0x4457('0x50')){return createEndUser(_0x4920f9,_0x6dc2e0,_0x5f2c04,_0x4c6976,_0x770520,_0x2e62b8);}else{return{};}});break;}}function getCall(_0x1ee158,_0x135c8a,_0x5be477,_0x579a64,_0x351a9e,_0x1af603,_0x180f4d,_0x4226c5){logger[_0x4457('0x2d')](_0x4457('0x52'));var _0x4e0668={};_0x4e0668[_0x4457('0x53')]={'name':!_[_0x4457('0x1b')](_0x579a64[_0x4457('0x41')]['name'])&&!_[_0x4457('0x1b')](_0x579a64[_0x4457('0x39')]['name'])&&_0x579a64[_0x4457('0x39')][_0x4457('0x18')]===_0x4457('0x54')?_0x579a64[_0x4457('0x41')][_0x4457('0x18')]:!_[_0x4457('0x1b')](_0x579a64[_0x4457('0x42')])?_0x579a64[_0x4457('0x42')]+'\x20'+_0x579a64[_0x4457('0x43')]:_0x579a64[_0x4457('0x43')],'id':_0x579a64['id']};_0x4e0668['Subject']=intUtil[_0x4457('0x55')](_0x1af603['Subjects'],_0x180f4d,'\x20');_0x4e0668[_0x4457('0x56')]=intUtil[_0x4457('0x55')](_0x1af603['Descriptions'],_0x180f4d,'\x0a');if(_0x351a9e[_0x4457('0x46')]===_0x4457('0x4d')){_0x4e0668['Who_Id']={'name':!_[_0x4457('0x1b')](_0x351a9e[_0x4457('0x57')])?_0x351a9e['Full_Name']:!_[_0x4457('0x1b')](_0x351a9e[_0x4457('0x58')])?_0x351a9e[_0x4457('0x58')]+'\x20'+_0x351a9e[_0x4457('0x59')]:_0x351a9e[_0x4457('0x59')],'id':_0x351a9e['id']};}if(_0x351a9e[_0x4457('0x46')]===_0x4457('0x4f')){_0x4e0668[_0x4457('0x5a')]={'name':!_[_0x4457('0x1b')](_0x351a9e[_0x4457('0x57')])?_0x351a9e[_0x4457('0x57')]:!_[_0x4457('0x1b')](_0x351a9e[_0x4457('0x58')])?_0x351a9e[_0x4457('0x58')]+'\x20'+_0x351a9e[_0x4457('0x59')]:_0x351a9e[_0x4457('0x59')],'id':_0x351a9e['id']};_0x4e0668[_0x4457('0x5b')]=_[_0x4457('0x40')](_0x351a9e[_0x4457('0x46')]);}if(_0x180f4d[_0x4457('0x5c')]){_0x4e0668[_0x4457('0x5d')]=moment[_0x4457('0x5e')](parseInt(_0x180f4d[_0x4457('0x5c')])*0x3e8)['format'](_0x4457('0x5f'));}else if(_0x180f4d[_0x4457('0x60')]&&_0x180f4d[_0x4457('0x61')]){_0x4e0668[_0x4457('0x5d')]=moment['utc'](moment(_0x180f4d['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x4457('0x62')](moment(_0x180f4d[_0x4457('0x63')],_0x4457('0x64'))))['format'](_0x4457('0x5f'));}switch(_0x180f4d['lastevent']){case'called':_0x4e0668[_0x4457('0x65')]=_0x4457('0x66');break;case _0x4457('0x67'):case'connect':_0x4e0668[_0x4457('0x65')]=_0x4457('0x68');break;case'rejected':_0x4e0668[_0x4457('0x65')]='Rejected';break;case _0x4457('0x69'):_0x4e0668[_0x4457('0x65')]=_0x4457('0x6a');break;case _0x4457('0x6b'):_0x4e0668['Call_Result']=_0x4457('0x6c');default:}_0x4e0668[_0x4457('0x6d')]=(_0x4226c5===_0x4457('0x6e')?moment(_0x180f4d[_0x4457('0x63')])['format'](_0x4457('0x64')):moment(_0x180f4d[_0x4457('0x6f')])[_0x4457('0x2f')](_0x4457('0x64')))||moment()['format'](_0x4457('0x64'));_0x4e0668['Call_Type']=_0x4226c5||_0x4457('0x70');_0x4e0668=_['merge'](_0x4e0668,getCustomFields(_0x1af603['Fields'],_0x180f4d));return request({'method':_0x4457('0x25'),'uri':_0x4457('0x4c')+_0x135c8a+_0x4457('0x71'),'headers':{'Authorization':_0x4457('0x32')+_0x1ee158},'body':{'data':[_0x4e0668]},'json':!![]})[_0x4457('0x2a')](function(_0x368ef2){if(_0x368ef2&&_0x368ef2[_0x4457('0x3e')][0x0][_0x4457('0x44')]===_0x4457('0x72')){logger[_0x4457('0x2d')](_0x4457('0x73'));return{'id':_0x368ef2[_0x4457('0x3e')][0x0][_0x4457('0x45')]['id']};}})[_0x4457('0x3d')](function(_0x2a31ad){logger[_0x4457('0x2d')](_0x4457('0x74'),_0x2a31ad[_0x4457('0x2c')]);console[_0x4457('0x49')](_0x4457('0x74'),_0x2a31ad);});}exports[_0x4457('0x75')]=function(_0x541622,_0x2d156a,_0x430c7b,_0x41ce67,_0x22406d,_0x44a7a9){var _0x4b7364,_0x43e790,_0x19a163;_0x44a7a9[_0x4457('0x76')]=intUtil[_0x4457('0x77')](_0x44a7a9['host']);_0x44a7a9[_0x4457('0x78')]=intUtil[_0x4457('0x77')](_0x44a7a9[_0x4457('0x78')]);if(_0x22406d&&_0x22406d['monitor_format']){logger[_0x4457('0x2d')](_0x4457('0x79'),_0x4457('0x7a'));_0x2d156a[_0x4457('0x7b')]=_0x44a7a9['serverUrl']+_0x4457('0x7c')+_0x2d156a[_0x4457('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x2d156a[_0x4457('0x7d')]);}else{_0x2d156a[_0x4457('0x7b')]='';}var _0x2bb1bf=_0x44a7a9[_0x4457('0x76')]==='zoho.eu'?'eu':_0x4457('0x7e');return getAccessToken(_0x44a7a9)[_0x4457('0x2a')](function(_0x4f66c4){_0x19a163=_0x4f66c4;return getUser(_0x19a163,_0x2bb1bf,_0x44a7a9,_0x41ce67['email']);})[_0x4457('0x2a')](function(_0x123bbc){_0x4b7364=_0x123bbc;logger[_0x4457('0x2d')](_0x4457('0x7f'),_0x4b7364['id']);return getEndUser(_0x19a163,_0x2bb1bf,_0x44a7a9,_0x2d156a['calleridname'],_0x2d156a['calleridnum'],_0x4b7364,_0x430c7b);})['then'](function(_0x3bf9b8){_0x43e790=_0x3bf9b8;return getCall(_0x19a163,_0x2bb1bf,_0x44a7a9,_0x4b7364,_0x43e790,_0x430c7b,_0x2d156a,_0x4457('0x70'));})[_0x4457('0x2a')](function(_0x1f7e93){if(_0x1f7e93){logger['info'](_0x4457('0x80'),_0x1f7e93['id']);logger[_0x4457('0x2d')](_0x4457('0x79'),_0x4457('0x81'));emit(util[_0x4457('0x2f')](_0x4457('0x82'),_0x41ce67[_0x4457('0x18')]),_0x4457('0x83'),{'uri':_0x4457('0x84')+_0x44a7a9[_0x4457('0x76')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1f7e93['id']});}})[_0x4457('0x3d')](function(_0xeda7dd){logger['error'](_0x4457('0x79'),JSON[_0x4457('0xd')](_0xeda7dd));});};exports[_0x4457('0x6e')]=function(_0xcb9961,_0x5aef0b,_0x12d6d7,_0x59f0d5,_0x100a61,_0x2850a3,_0x754f89){var _0x40185a,_0x202d71,_0xc19add;_0x2850a3[_0x4457('0x76')]=intUtil[_0x4457('0x77')](_0x2850a3[_0x4457('0x76')]);_0x2850a3[_0x4457('0x78')]=intUtil[_0x4457('0x77')](_0x2850a3['serverUrl']);if(_0x754f89&&_0x754f89[_0x4457('0x85')]&&_0x754f89['recordingFormat']!==_0x4457('0x86')){logger[_0x4457('0x2d')](_0x4457('0x87'),_0x4457('0x7a'));_0x5aef0b['recordingURL']=_0x2850a3['serverUrl']+_0x4457('0x7c')+_0x5aef0b[_0x4457('0x7d')]+_0x4457('0x88')+md5(_0x5aef0b['uniqueid']);}var _0xf68754=_0x2850a3[_0x4457('0x76')]===_0x4457('0x89')?'eu':_0x4457('0x7e');return getAccessToken(_0x2850a3)[_0x4457('0x2a')](function(_0x1f4d6d){_0xc19add=_0x1f4d6d;return getUser(_0xc19add,_0xf68754,_0x2850a3,_0x59f0d5['email']);})[_0x4457('0x2a')](function(_0x2c4374){_0x40185a=_0x2c4374;logger[_0x4457('0x2d')]('The\x20User\x20ID\x20is:',_0x40185a['id']);return getEndUser(_0xc19add,_0xf68754,_0x2850a3,_0x5aef0b['destcalleridname'],_0x5aef0b[_0x4457('0x8a')],_0x40185a,_0x12d6d7);})['then'](function(_0x1fd204){_0x202d71=_0x1fd204;return getCall(_0xc19add,_0xf68754,_0x2850a3,_0x40185a,_0x202d71,_0x12d6d7,_0x5aef0b,_0x4457('0x8b'));})[_0x4457('0x2a')](function(_0x314ab9){if(_0x314ab9){logger[_0x4457('0x2d')](_0x4457('0x80'),_0x314ab9['id']);logger[_0x4457('0x2d')](_0x4457('0x87'),_0x4457('0x81'));emit(util[_0x4457('0x2f')]('user:%s',_0x59f0d5['name']),_0x4457('0x83'),{'uri':_0x4457('0x84')+_0x2850a3[_0x4457('0x76')]+'/crm/EntityInfo.do?module=Calls&id='+_0x314ab9['id']});}})['catch'](function(_0x36cf8b){logger[_0x4457('0x3a')](_0x4457('0x87'),JSON[_0x4457('0xd')](_0x36cf8b));});};exports[_0x4457('0x8c')]=function(_0x1f701f,_0x92d344,_0x5ad208,_0x2a1ede,_0x7ad718,_0x19f42f){var _0x449f26,_0x273c85,_0x241e21;_0x19f42f[_0x4457('0x76')]=intUtil[_0x4457('0x77')](_0x19f42f[_0x4457('0x76')]);_0x19f42f[_0x4457('0x78')]=intUtil[_0x4457('0x77')](_0x19f42f[_0x4457('0x78')]);if(_0x7ad718&&_0x7ad718[_0x4457('0x8d')]){logger['info']('['+_0x92d344[_0x4457('0x8e')][_0x4457('0x8f')]()+']',_0x4457('0x7a'));_0x92d344['recordingURL']=_0x19f42f[_0x4457('0x78')]+'/api/voice/recordings/'+_0x92d344[_0x4457('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x92d344[_0x4457('0x7d')]);}else{_0x92d344[_0x4457('0x7b')]='';}var _0x84e2f4=_0x19f42f[_0x4457('0x76')]==='zoho.eu'?'eu':_0x4457('0x7e');return getAccessToken(_0x19f42f)[_0x4457('0x2a')](function(_0x2834ea){_0x241e21=_0x2834ea;return getUser(_0x241e21,_0x84e2f4,_0x19f42f);})[_0x4457('0x2a')](function(_0x440e05){_0x449f26=_0x440e05;logger['info'](_0x4457('0x7f'),_0x449f26['id']);return getEndUser(_0x241e21,_0x84e2f4,_0x19f42f,_0x92d344['calleridname'],_0x92d344[_0x4457('0x90')],_0x449f26,_0x5ad208);})['then'](function(_0x20a165){_0x273c85=_0x20a165;return getCall(_0x241e21,_0x84e2f4,_0x19f42f,_0x449f26,_0x273c85,_0x5ad208,_0x92d344,'Inbound');})[_0x4457('0x2a')](function(_0x7d647e){if(_0x7d647e){logger[_0x4457('0x2d')](_0x4457('0x80'),_0x7d647e['id']);}})[_0x4457('0x3d')](function(_0x3e6396){logger['error']('['+_0x92d344[_0x4457('0x8e')]['toUpperCase']()+']',JSON[_0x4457('0xd')](_0x3e6396));});}; \ No newline at end of file +var _0x0baf=['POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','findIndex','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','CREATE\x20ERROR','moduleSearch','Contacts','uri','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Owner','profile','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','enduserType','What_Id','talktime','utc','mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','serverUrl','recordingFormat','[OUTBOUND]','com','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','/api/voice/recordings/','calleridnum','lastevent','md5','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','stringify','length','includes','string','type','idField','content','variable','variableName','toString','name','Variable','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x0baf,0x73));var _0xf0ba=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x0baf[_0x65c0bb];return _0x320bd5;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf0ba('0x0'));var util=require('util');var intUtil=require(_0xf0ba('0x1'));var moment=require(_0xf0ba('0x2'));var Redis=require(_0xf0ba('0x3'));var BPromise=require(_0xf0ba('0x4'));var config=require('../../../../config/environment');var logger=require(_0xf0ba('0x5'))(_0xf0ba('0x6'));config[_0xf0ba('0x7')]=_[_0xf0ba('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf0ba('0x9'))(new Redis(config[_0xf0ba('0x7')]));function emit(_0x274f5c,_0x4767f8,_0x1a6727){io['to'](_0x274f5c)[_0xf0ba('0xa')](_0x4767f8,_0x1a6727);}function request(_0x38a6af){logger['debug']('[HTTP]',JSON[_0xf0ba('0xb')](_0x38a6af));return rp(_0x38a6af);}function getCustomFields(_0x390740,_0x6a930b){var _0x27b2e9={};if(_0x390740[_0xf0ba('0xc')]>0x0){_['forEach'](_0x390740,function(_0x34b4ba){if(_[_0xf0ba('0xd')]([_0xf0ba('0xe'),'picklist'],_0x34b4ba[_0xf0ba('0xf')])&&_0x34b4ba[_0xf0ba('0x10')]){_0x27b2e9[_0x34b4ba['idField']]=_0x34b4ba[_0xf0ba('0x11')]['toString']();}else if(_0x34b4ba['type']===_0xf0ba('0x12')&&_0x34b4ba[_0xf0ba('0x13')]&&_0x34b4ba[_0xf0ba('0x10')]&&_0x6a930b[_0x34b4ba[_0xf0ba('0x13')]]){_0x27b2e9[_0x34b4ba[_0xf0ba('0x10')]]=_0x6a930b[_0x34b4ba[_0xf0ba('0x13')]][_0xf0ba('0x14')]();}else if(_0x34b4ba['type']==='customVariable'&&_0x34b4ba['Variable']&&_0x34b4ba['Variable'][_0xf0ba('0x15')]&&_0x34b4ba[_0xf0ba('0x10')]&&_0x6a930b[_0x34b4ba[_0xf0ba('0x16')]['name']['toLowerCase']()]){_0x27b2e9[_0x34b4ba[_0xf0ba('0x10')]]=_0x6a930b[_0x34b4ba[_0xf0ba('0x16')][_0xf0ba('0x15')]['toLowerCase']()][_0xf0ba('0x14')]();}});}return _0x27b2e9;}function getName(_0x2b0703){if(_0x2b0703[_0xf0ba('0x17')]('\x20')>0x0){var _0x5b2660=_0x2b0703[_0xf0ba('0x18')](/ (.+)/);if(_0x5b2660[0x1]){return _0x5b2660;}}return[_0x2b0703,_0x2b0703];}var accountsTokens={};function getAccessToken(_0x363a82){return new Promise(function(_0xbd5eef,_0x18bfb4){if(!_[_0xf0ba('0x19')](accountsTokens[_0x363a82['id']])&&!_[_0xf0ba('0x19')](accountsTokens[_0x363a82['id']][_0xf0ba('0x1a')])){if(moment()[_0xf0ba('0x1b')](accountsTokens[_0x363a82['id']][_0xf0ba('0x1c')])){_0xbd5eef(accountsTokens[_0x363a82['id']][_0xf0ba('0x1a')]);}}var _0x6b45b7;switch(_0x363a82[_0xf0ba('0x1d')]){case'US':_0x6b45b7=_0xf0ba('0x1e');break;case'AU':_0x6b45b7=_0xf0ba('0x1f');break;case'EU':_0x6b45b7=_0xf0ba('0x20');break;case'IN':_0x6b45b7='https://accounts.zoho.in';break;case'CN':_0x6b45b7=_0xf0ba('0x21');break;default:_0x6b45b7=_0xf0ba('0x20');break;}var _0x5026dc={'method':_0xf0ba('0x22'),'uri':_0x6b45b7+_0xf0ba('0x23'),'qs':{'refresh_token':_0x363a82['refreshToken'],'client_id':_0x363a82[_0xf0ba('0x24')],'client_secret':_0x363a82[_0xf0ba('0x25')],'grant_type':_0xf0ba('0x26')},'json':!![]};return rp(_0x5026dc)[_0xf0ba('0x27')](function(_0x519d3b){accountsTokens[_0x363a82['id']]={'access_token':_0x519d3b[_0xf0ba('0x1a')],'expires_in':moment()[_0xf0ba('0x28')](_0x519d3b[_0xf0ba('0x1c')],_0xf0ba('0x29'))};_0xbd5eef(_0x519d3b[_0xf0ba('0x1a')]);})[_0xf0ba('0x2a')](function(_0x43cc5f){logger[_0xf0ba('0x2b')](_0xf0ba('0x2c'),_0x43cc5f[_0xf0ba('0x2d')]);_0x18bfb4(_0x43cc5f);});});}function getUser(_0x5f5ff8,_0x4a6597,_0x18abad,_0x3687b7){logger[_0xf0ba('0x2e')](_0xf0ba('0x2f'));return request({'method':_0xf0ba('0x30'),'uri':util[_0xf0ba('0x31')](_0xf0ba('0x32'),_0x4a6597),'qs':{'type':_0xf0ba('0x33')},'headers':{'Authorization':_0xf0ba('0x34')+_0x5f5ff8},'json':!![]})[_0xf0ba('0x27')](function(_0x1a9040){if(_0x1a9040['users']){var _0x516137=-0x1;if(_['isArrayLikeObject'](_0x1a9040['users'])){if(!_[_0xf0ba('0x19')](_0x3687b7)){_0x516137=_[_0xf0ba('0x35')](_0x1a9040[_0xf0ba('0x36')],function(_0x2db1bc){return _0x2db1bc[_0xf0ba('0x37')]===_0x3687b7;});}if(_0x516137>=0x0){logger[_0xf0ba('0x2e')](_0xf0ba('0x38'));}else{logger[_0xf0ba('0x2e')](_0xf0ba('0x39'));_0x516137=_[_0xf0ba('0x35')](_0x1a9040[_0xf0ba('0x36')],function(_0x353309){return _0x353309['profile'][_0xf0ba('0x15')]===_0xf0ba('0x3a');});}return _0x1a9040[_0xf0ba('0x36')][_0x516137];}else{if(_0x1a9040[_0xf0ba('0x3b')]['profile'][_0xf0ba('0x15')]===_0xf0ba('0x3a')){logger['info'](_0xf0ba('0x39'));user=_0x1a9040[_0xf0ba('0x3b')];return user;}else{logger[_0xf0ba('0x2b')](_0xf0ba('0x3c'),JSON[_0xf0ba('0xb')](_0x1a9040));throw new Error(_0xf0ba('0x3d')+JSON['stringify'](_0x1a9040));}}}else{logger[_0xf0ba('0x2b')](_0xf0ba('0x3c'),JSON[_0xf0ba('0xb')](_0x1a9040));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x1a9040));}})[_0xf0ba('0x2a')](function(_0x299f04){console[_0xf0ba('0x2b')](_0x299f04);});}function getZohoUser(_0x5359b3,_0x2aa0bb){return new BPromise(function(_0x55c243,_0x3ce876){request(_0x5359b3)[_0xf0ba('0x27')](function(_0x33384f){var _0x39708f=null;if(_0x33384f){_0x39708f=_0x33384f[_0xf0ba('0x3e')][0x0];_0x39708f['enduserType']=_0x2aa0bb;}_0x55c243(_0x39708f);})[_0xf0ba('0x2a')](function(_0x1cfe97){_0x3ce876(_0x1cfe97);});});}function createEndUser(_0x27c252,_0x41a7e5,_0x237398,_0x112425,_0x3941ca,_0x4c5f99){var _0x237398=getName(_0x237398);return request({'method':_0xf0ba('0x22'),'uri':'https://www.zohoapis.'+_0x41a7e5+'/crm/v2/'+_[_0xf0ba('0x3f')](_0x4c5f99[_0xf0ba('0x40')])+'s','body':{'data':[{'Last_Name':_0x237398[0x1],'First_Name':_0x237398[0x0],'Phone':_0x112425,'Owner':{'name':!_[_0xf0ba('0x19')](_0x3941ca[_0xf0ba('0x41')][_0xf0ba('0x15')])?_0x3941ca[_0xf0ba('0x41')][_0xf0ba('0x15')]:!_[_0xf0ba('0x19')](_0x3941ca['first_name'])?_0x3941ca[_0xf0ba('0x42')]+'\x20'+_0x3941ca[_0xf0ba('0x43')]:_0x3941ca[_0xf0ba('0x43')],'id':_0x3941ca['id']}}]},'headers':{'Authorization':_0xf0ba('0x34')+_0x27c252},'json':!![]})[_0xf0ba('0x27')](function(_0x371d3d){if(_0x371d3d&&_0x371d3d[_0xf0ba('0x3e')][0x0][_0xf0ba('0x44')]===_0xf0ba('0x45')){var _0xfb5672=_0x371d3d[_0xf0ba('0x3e')][0x0][_0xf0ba('0x46')];_0xfb5672['enduserType']=_[_0xf0ba('0x3f')](_0x4c5f99[_0xf0ba('0x40')])+'s';return _0xfb5672;}logger[_0xf0ba('0x2b')](_0xf0ba('0x3c'),JSON[_0xf0ba('0xb')](data));throw new Error('Error:\x20'+JSON[_0xf0ba('0xb')](data));})[_0xf0ba('0x2a')](function(_0xeef1db){console['log'](_0xf0ba('0x47'),_0xeef1db);});}function getEndUser(_0x563e39,_0x14b575,_0x110506,_0x16782a,_0x504673,_0x56ac22,_0x2be550){var _0x1863f8={'method':_0xf0ba('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x563e39},'json':!![]};switch(_0x2be550[_0xf0ba('0x48')]){case'contact_lead':_0x1863f8['uri']='https://www.zohoapis.'+_0x14b575+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x504673+'))';return getZohoUser(_0x1863f8,_0xf0ba('0x49'))[_0xf0ba('0x27')](function(_0x24ab07){if(_0x24ab07)return _0x24ab07;_0x1863f8[_0xf0ba('0x4a')]=_0xf0ba('0x4b')+_0x14b575+_0xf0ba('0x4c')+_0x504673+'))';return getZohoUser(_0x1863f8,_0xf0ba('0x4d'))[_0xf0ba('0x27')](function(_0x50a1c){if(_0x50a1c)return _0x50a1c;if(_0x2be550[_0xf0ba('0x40')]!=_0xf0ba('0x4e')){return createEndUser(_0x563e39,_0x14b575,_0x16782a,_0x504673,_0x56ac22,_0x2be550);}else{return{};}});});break;case'contact':_0x1863f8[_0xf0ba('0x4a')]=_0xf0ba('0x4b')+_0x14b575+_0xf0ba('0x4f')+_0x504673+'))';return getZohoUser(_0x1863f8,_0xf0ba('0x49'))[_0xf0ba('0x27')](function(_0x56139e){if(_0x56139e)return _0x56139e;if(_0x2be550[_0xf0ba('0x40')]!='nothing'){return createEndUser(_0x563e39,_0x14b575,_0x16782a,_0x504673,_0x56ac22,_0x2be550);}else{return{};}});break;case _0xf0ba('0x50'):_0x1863f8[_0xf0ba('0x4a')]='https://www.zohoapis.'+_0x14b575+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x504673+'))';return getZohoUser(_0x1863f8,_0xf0ba('0x4d'))['then'](function(_0x1c63ea){if(_0x1c63ea)return _0x1c63ea;if(_0x2be550[_0xf0ba('0x40')]!='nothing'){return createEndUser(_0x563e39,_0x14b575,_0x16782a,_0x504673,_0x56ac22,_0x2be550);}else{return{};}});break;}}function getCall(_0x5dd90e,_0x3d36db,_0x531dae,_0x312317,_0x2f966b,_0x58cd85,_0x2401af,_0x4185c3){logger[_0xf0ba('0x2e')]('Creating\x20new\x20call...');var _0x5121b0={};_0x5121b0[_0xf0ba('0x51')]={'name':!_['isNil'](_0x312317[_0xf0ba('0x41')]['name'])&&!_['isNil'](_0x312317[_0xf0ba('0x52')]['name'])&&_0x312317['profile'][_0xf0ba('0x15')]===_0xf0ba('0x53')?_0x312317['role'][_0xf0ba('0x15')]:!_[_0xf0ba('0x19')](_0x312317['first_name'])?_0x312317[_0xf0ba('0x42')]+'\x20'+_0x312317['last_name']:_0x312317[_0xf0ba('0x43')],'id':_0x312317['id']};_0x5121b0['Subject']=intUtil[_0xf0ba('0x54')](_0x58cd85[_0xf0ba('0x55')],_0x2401af,'\x20');_0x5121b0[_0xf0ba('0x56')]=intUtil[_0xf0ba('0x54')](_0x58cd85[_0xf0ba('0x57')],_0x2401af,'\x0a');if(_0x2f966b['enduserType']==='Contacts'){_0x5121b0[_0xf0ba('0x58')]={'name':!_[_0xf0ba('0x19')](_0x2f966b[_0xf0ba('0x59')])?_0x2f966b[_0xf0ba('0x59')]:!_[_0xf0ba('0x19')](_0x2f966b[_0xf0ba('0x5a')])?_0x2f966b[_0xf0ba('0x5a')]+'\x20'+_0x2f966b['Last_Name']:_0x2f966b[_0xf0ba('0x5b')],'id':_0x2f966b['id']};}if(_0x2f966b[_0xf0ba('0x5c')]===_0xf0ba('0x4d')){_0x5121b0[_0xf0ba('0x5d')]={'name':!_['isNil'](_0x2f966b[_0xf0ba('0x59')])?_0x2f966b[_0xf0ba('0x59')]:!_[_0xf0ba('0x19')](_0x2f966b[_0xf0ba('0x5a')])?_0x2f966b[_0xf0ba('0x5a')]+'\x20'+_0x2f966b['Last_Name']:_0x2f966b[_0xf0ba('0x5b')],'id':_0x2f966b['id']};_0x5121b0['$se_module']=_[_0xf0ba('0x3f')](_0x2f966b[_0xf0ba('0x5c')]);}if(_0x2401af[_0xf0ba('0x5e')]){_0x5121b0['Call_Duration']=moment[_0xf0ba('0x5f')](parseInt(_0x2401af[_0xf0ba('0x5e')])*0x3e8)[_0xf0ba('0x31')](_0xf0ba('0x60'));}else if(_0x2401af['answertime']&&_0x2401af[_0xf0ba('0x61')]){_0x5121b0[_0xf0ba('0x62')]=moment[_0xf0ba('0x5f')](moment(_0x2401af[_0xf0ba('0x61')],_0xf0ba('0x63'))[_0xf0ba('0x64')](moment(_0x2401af[_0xf0ba('0x65')],_0xf0ba('0x63'))))[_0xf0ba('0x31')]('mm:ss');}switch(_0x2401af['lastevent']){case'called':_0x5121b0[_0xf0ba('0x66')]=_0xf0ba('0x67');break;case _0xf0ba('0x68'):case _0xf0ba('0x69'):_0x5121b0['Call_Result']=_0xf0ba('0x6a');break;case _0xf0ba('0x6b'):_0x5121b0['Call_Result']=_0xf0ba('0x6c');break;case _0xf0ba('0x6d'):_0x5121b0[_0xf0ba('0x66')]=_0xf0ba('0x6e');break;case _0xf0ba('0x6f'):_0x5121b0[_0xf0ba('0x66')]=_0xf0ba('0x70');default:}_0x5121b0[_0xf0ba('0x71')]=(_0x4185c3===_0xf0ba('0x72')?moment(_0x2401af[_0xf0ba('0x65')])[_0xf0ba('0x31')](_0xf0ba('0x63')):moment(_0x2401af[_0xf0ba('0x73')])[_0xf0ba('0x31')](_0xf0ba('0x63')))||moment()[_0xf0ba('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x5121b0['Call_Type']=_0x4185c3||_0xf0ba('0x74');_0x5121b0=_['merge'](_0x5121b0,getCustomFields(_0x58cd85[_0xf0ba('0x75')],_0x2401af));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x3d36db+'/crm/v2/Calls','headers':{'Authorization':_0xf0ba('0x34')+_0x5dd90e},'body':{'data':[_0x5121b0]},'json':!![]})[_0xf0ba('0x27')](function(_0x5e0d1e){if(_0x5e0d1e&&_0x5e0d1e[_0xf0ba('0x3e')][0x0][_0xf0ba('0x44')]===_0xf0ba('0x45')){logger[_0xf0ba('0x2e')](_0xf0ba('0x76'));return{'id':_0x5e0d1e['data'][0x0]['details']['id']};}})[_0xf0ba('0x2a')](function(_0x35eb64){logger[_0xf0ba('0x2e')]('err',_0x35eb64[_0xf0ba('0x2d')]);console['log'](_0xf0ba('0x77'),_0x35eb64);});}exports[_0xf0ba('0x78')]=function(_0x319862,_0x4ce7d9,_0x187df7,_0x51e467,_0x2629c2,_0x513d24){var _0x38b389,_0x32b1bf,_0x1f0c57;_0x513d24[_0xf0ba('0x79')]=intUtil[_0xf0ba('0x7a')](_0x513d24[_0xf0ba('0x79')]);_0x513d24['serverUrl']=intUtil[_0xf0ba('0x7a')](_0x513d24['serverUrl']);if(_0x2629c2&&_0x2629c2[_0xf0ba('0x7b')]){logger[_0xf0ba('0x2e')](_0xf0ba('0x7c'),_0xf0ba('0x7d'));_0x4ce7d9[_0xf0ba('0x7e')]=_0x513d24['serverUrl']+'/api/voice/recordings/'+_0x4ce7d9[_0xf0ba('0x7f')]+_0xf0ba('0x80')+md5(_0x4ce7d9[_0xf0ba('0x7f')]);}else{_0x4ce7d9[_0xf0ba('0x7e')]='';}var _0x2144ef=_0x513d24[_0xf0ba('0x79')]===_0xf0ba('0x81')?'eu':'com';return getAccessToken(_0x513d24)[_0xf0ba('0x27')](function(_0x2fd830){_0x1f0c57=_0x2fd830;return getUser(_0x1f0c57,_0x2144ef,_0x513d24,_0x51e467[_0xf0ba('0x37')]);})[_0xf0ba('0x27')](function(_0x52596a){_0x38b389=_0x52596a;logger[_0xf0ba('0x2e')](_0xf0ba('0x82'),_0x38b389['id']);return getEndUser(_0x1f0c57,_0x2144ef,_0x513d24,_0x4ce7d9[_0xf0ba('0x83')],_0x4ce7d9['calleridnum'],_0x38b389,_0x187df7);})['then'](function(_0x22d1ab){_0x32b1bf=_0x22d1ab;return getCall(_0x1f0c57,_0x2144ef,_0x513d24,_0x38b389,_0x32b1bf,_0x187df7,_0x4ce7d9,_0xf0ba('0x74'));})[_0xf0ba('0x27')](function(_0x26ac32){if(_0x26ac32){logger[_0xf0ba('0x2e')]('The\x20Call\x20ID\x20is:',_0x26ac32['id']);logger[_0xf0ba('0x2e')](_0xf0ba('0x7c'),_0xf0ba('0x84'));emit(util[_0xf0ba('0x31')](_0xf0ba('0x85'),_0x51e467[_0xf0ba('0x15')]),_0xf0ba('0x86'),{'uri':_0xf0ba('0x87')+_0x513d24[_0xf0ba('0x79')]+_0xf0ba('0x88')+_0x26ac32['id']});}})['catch'](function(_0x46282c){logger[_0xf0ba('0x2b')](_0xf0ba('0x7c'),JSON[_0xf0ba('0xb')](_0x46282c));});};exports[_0xf0ba('0x72')]=function(_0x52e5a6,_0x417fad,_0x3b101e,_0x459231,_0x29e0d8,_0x2d17db,_0x2396aa){var _0x4de101,_0x415e6e,_0x304eb8;_0x2d17db[_0xf0ba('0x79')]=intUtil[_0xf0ba('0x7a')](_0x2d17db[_0xf0ba('0x79')]);_0x2d17db['serverUrl']=intUtil[_0xf0ba('0x7a')](_0x2d17db[_0xf0ba('0x89')]);if(_0x2396aa&&_0x2396aa[_0xf0ba('0x8a')]&&_0x2396aa['recordingFormat']!=='none'){logger['info'](_0xf0ba('0x8b'),_0xf0ba('0x7d'));_0x417fad[_0xf0ba('0x7e')]=_0x2d17db[_0xf0ba('0x89')]+'/api/voice/recordings/'+_0x417fad['uniqueid']+_0xf0ba('0x80')+md5(_0x417fad[_0xf0ba('0x7f')]);}var _0x111d72=_0x2d17db[_0xf0ba('0x79')]==='zoho.eu'?'eu':_0xf0ba('0x8c');return getAccessToken(_0x2d17db)['then'](function(_0x5ec847){_0x304eb8=_0x5ec847;return getUser(_0x304eb8,_0x111d72,_0x2d17db,_0x459231[_0xf0ba('0x37')]);})[_0xf0ba('0x27')](function(_0x45c6ee){_0x4de101=_0x45c6ee;logger[_0xf0ba('0x2e')]('The\x20User\x20ID\x20is:',_0x4de101['id']);return getEndUser(_0x304eb8,_0x111d72,_0x2d17db,_0x417fad['destcalleridname'],_0x417fad[_0xf0ba('0x8d')],_0x4de101,_0x3b101e);})[_0xf0ba('0x27')](function(_0x2484a7){_0x415e6e=_0x2484a7;return getCall(_0x304eb8,_0x111d72,_0x2d17db,_0x4de101,_0x415e6e,_0x3b101e,_0x417fad,_0xf0ba('0x8e'));})[_0xf0ba('0x27')](function(_0x5c904d){if(_0x5c904d){logger[_0xf0ba('0x2e')](_0xf0ba('0x8f'),_0x5c904d['id']);logger[_0xf0ba('0x2e')]('[OUTBOUND]',_0xf0ba('0x84'));emit(util['format'](_0xf0ba('0x85'),_0x459231[_0xf0ba('0x15')]),_0xf0ba('0x86'),{'uri':_0xf0ba('0x87')+_0x2d17db[_0xf0ba('0x79')]+_0xf0ba('0x88')+_0x5c904d['id']});}})[_0xf0ba('0x2a')](function(_0x2e7c82){logger[_0xf0ba('0x2b')](_0xf0ba('0x8b'),JSON[_0xf0ba('0xb')](_0x2e7c82));});};exports[_0xf0ba('0x90')]=function(_0x4acca8,_0x2af5b7,_0x39f9cf,_0x21429e,_0x50c391,_0x9b1b24){var _0x51cc8b,_0x917745,_0x1f72b8;_0x9b1b24['host']=intUtil[_0xf0ba('0x7a')](_0x9b1b24[_0xf0ba('0x79')]);_0x9b1b24['serverUrl']=intUtil['stripTrailingSlash'](_0x9b1b24[_0xf0ba('0x89')]);if(_0x50c391&&_0x50c391[_0xf0ba('0x7b')]){logger['info']('['+_0x2af5b7['lastevent'][_0xf0ba('0x91')]()+']','Recording\x20is\x20enabled!');_0x2af5b7['recordingURL']=_0x9b1b24[_0xf0ba('0x89')]+_0xf0ba('0x92')+_0x2af5b7[_0xf0ba('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x2af5b7[_0xf0ba('0x7f')]);}else{_0x2af5b7[_0xf0ba('0x7e')]='';}var _0xb3257d=_0x9b1b24[_0xf0ba('0x79')]===_0xf0ba('0x81')?'eu':_0xf0ba('0x8c');return getAccessToken(_0x9b1b24)[_0xf0ba('0x27')](function(_0x3958a7){_0x1f72b8=_0x3958a7;return getUser(_0x1f72b8,_0xb3257d,_0x9b1b24);})['then'](function(_0x5b882e){_0x51cc8b=_0x5b882e;logger[_0xf0ba('0x2e')](_0xf0ba('0x82'),_0x51cc8b['id']);return getEndUser(_0x1f72b8,_0xb3257d,_0x9b1b24,_0x2af5b7['calleridname'],_0x2af5b7[_0xf0ba('0x93')],_0x51cc8b,_0x39f9cf);})[_0xf0ba('0x27')](function(_0x42b135){_0x917745=_0x42b135;return getCall(_0x1f72b8,_0xb3257d,_0x9b1b24,_0x51cc8b,_0x917745,_0x39f9cf,_0x2af5b7,'Inbound');})[_0xf0ba('0x27')](function(_0x7b294e){if(_0x7b294e){logger[_0xf0ba('0x2e')](_0xf0ba('0x8f'),_0x7b294e['id']);}})[_0xf0ba('0x2a')](function(_0x2199d9){logger[_0xf0ba('0x2b')]('['+_0x2af5b7[_0xf0ba('0x94')][_0xf0ba('0x91')]()+']',JSON[_0xf0ba('0xb')](_0x2199d9));});}; \ 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 97c512a..5f3a32b 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 _0x5996=['data2','Script','data3','render','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x361183,_0x255e48){var _0x577ef4=function(_0x38ed77){while(--_0x38ed77){_0x361183['push'](_0x361183['shift']());}};_0x577ef4(++_0x255e48);}(_0x5996,0x11a));var _0x6599=function(_0x559677,_0x1680d7){_0x559677=_0x559677-0x0;var _0x3e1132=_0x5996[_0x559677];return _0x3e1132;};'use strict';var util=require(_0x6599('0x0'));var sh=require(_0x6599('0x1'));var Mustache=require(_0x6599('0x2'));var logger=require(_0x6599('0x3'))(_0x6599('0x4'));exports[_0x6599('0x5')]=function(_0x4be1a8,_0x5e9990){var _0x33884a=_0x4be1a8['data2']?_0x4be1a8[_0x6599('0x6')]:_0x6599('0x7');var _0x4c4a11=_0x4be1a8[_0x6599('0x8')]?Mustache[_0x6599('0x9')](_0x4be1a8[_0x6599('0x8')],_0x5e9990):_0x5e9990;sh['exec'](_0x4c4a11,function(_0x371011,_0x4de5e8,_0x45a2fa){if(_0x371011!==0x0){logger['error'](util['format'](_0x6599('0xa'),_0x33884a,_0x4c4a11,_0x371011,_0x45a2fa));}else{logger[_0x6599('0xb')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x33884a,_0x4c4a11,_0x4de5e8));}});}; \ No newline at end of file +var _0xcc91=['error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','data2','Script','render','data3'];(function(_0x137459,_0x19eea2){var _0x2031d2=function(_0x5e4f72){while(--_0x5e4f72){_0x137459['push'](_0x137459['shift']());}};_0x2031d2(++_0x19eea2);}(_0xcc91,0x171));var _0x1cc9=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0xcc91[_0x39bfb6];return _0x23fef9;};'use strict';var util=require(_0x1cc9('0x0'));var sh=require(_0x1cc9('0x1'));var Mustache=require(_0x1cc9('0x2'));var logger=require(_0x1cc9('0x3'))('trigger');exports['exec']=function(_0x508051,_0x27582c){var _0x43857a=_0x508051[_0x1cc9('0x4')]?_0x508051[_0x1cc9('0x4')]:_0x1cc9('0x5');var _0x3fb64d=_0x508051['data3']?Mustache[_0x1cc9('0x6')](_0x508051[_0x1cc9('0x7')],_0x27582c):_0x27582c;sh['exec'](_0x3fb64d,function(_0x24eb09,_0x25cebc,_0x4cab37){if(_0x24eb09!==0x0){logger[_0x1cc9('0x8')](util[_0x1cc9('0x9')](_0x1cc9('0xa'),_0x43857a,_0x3fb64d,_0x24eb09,_0x4cab37));}else{logger[_0x1cc9('0xb')](util[_0x1cc9('0x9')](_0x1cc9('0xc'),_0x43857a,_0x3fb64d,_0x25cebc));}});}; \ 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 fbb2682..5d036b8 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 _0x3b55=['isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','lodash','mustache','../../../../config/logger','exec','data1','render','data5','headers','data6','parse','error','stack','toUpperCase','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then'];(function(_0x1bda6c,_0x5440b1){var _0x501a86=function(_0x1de54c){while(--_0x1de54c){_0x1bda6c['push'](_0x1bda6c['shift']());}};_0x501a86(++_0x5440b1);}(_0x3b55,0xce));var _0x53b5=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0x3b55[_0x5d6270];return _0x168f26;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x53b5('0x0'));var Mustache=require(_0x53b5('0x1'));var logger=require(_0x53b5('0x2'))('trigger');exports[_0x53b5('0x3')]=function(_0x541a5f,_0x2bdd0d){var _0x4039ec,_0x650d8b;var _0x526a69={'method':_0x541a5f[_0x53b5('0x4')]['toUpperCase'](),'uri':Mustache[_0x53b5('0x5')](_0x541a5f['data2'],_0x2bdd0d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x541a5f[_0x53b5('0x6')])==='number'&&parseInt(_0x541a5f[_0x53b5('0x6')])>=0x1&&parseInt(_0x541a5f[_0x53b5('0x6')])<=0xa?parseInt(_0x541a5f['data5'])*0x3e8:0x5*0x3e8};try{_0x526a69[_0x53b5('0x7')]=_0x541a5f[_0x53b5('0x8')]?JSON[_0x53b5('0x9')](Mustache[_0x53b5('0x5')](_0x541a5f[_0x53b5('0x8')],_0x2bdd0d)):{};}catch(_0x340dba){logger[_0x53b5('0xa')](_0x340dba[_0x53b5('0xb')]);}switch(_0x541a5f[_0x53b5('0x4')][_0x53b5('0xc')]()){case'GET':case _0x53b5('0xd'):_0x4039ec=null;_0x526a69['qs']=_0x2bdd0d;break;case _0x53b5('0xe'):case _0x53b5('0xf'):if(_0x541a5f[_0x53b5('0x10')]){try{_0x4039ec=JSON[_0x53b5('0x9')](Mustache[_0x53b5('0x5')](_0x541a5f[_0x53b5('0x10')],_0x2bdd0d));_0x526a69[_0x53b5('0x11')]=_0x4039ec;}catch(_0x358e1a){logger[_0x53b5('0xa')](_0x358e1a[_0x53b5('0xb')]);logger['error'](_0x53b5('0x12'));}}else{_0x4039ec=_0x2bdd0d;_0x526a69[_0x53b5('0x11')]=_0x4039ec;}break;}logger[_0x53b5('0x13')](util[_0x53b5('0x14')](_0x53b5('0x15'),_0x541a5f[_0x53b5('0x4')],_0x541a5f[_0x53b5('0x16')],JSON[_0x53b5('0x17')](_0x526a69)));rp(_0x526a69)[_0x53b5('0x18')](function(_0x2c1562){_0x4039ec=!_[_0x53b5('0x19')](_0x4039ec)?_0x53b5('0x1a')+_0x4039ec:'';_0x650d8b=typeof _0x2c1562['body']==='object'?JSON[_0x53b5('0x17')](_0x2c1562[_0x53b5('0x11')]):_0x2c1562[_0x53b5('0x11')];logger[_0x53b5('0x13')](util['format'](_0x53b5('0x1b'),_0x541a5f['data1'],_0x541a5f['data2'],_0x2c1562[_0x53b5('0x1c')],_0x650d8b));})[_0x53b5('0x1d')](function(_0x499cf1){logger[_0x53b5('0xa')](util[_0x53b5('0x14')](_0x53b5('0x1e'),_0x541a5f[_0x53b5('0x4')],_0x541a5f[_0x53b5('0x16')],_0x499cf1[_0x53b5('0x1c')],_0x499cf1[_0x53b5('0x1f')],_0x499cf1[_0x53b5('0x20')]));});}; \ No newline at end of file +var _0x66b1=['format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','render','data2','data5','number','data6','parse','error','data1','toUpperCase','GET','POST','data7','body','stack','info'];(function(_0x15b932,_0x39ba3f){var _0x28fa64=function(_0x479c8a){while(--_0x479c8a){_0x15b932['push'](_0x15b932['shift']());}};_0x28fa64(++_0x39ba3f);}(_0x66b1,0x102));var _0x166b=function(_0x3640d2,_0x3383f9){_0x3640d2=_0x3640d2-0x0;var _0x2909a8=_0x66b1[_0x3640d2];return _0x2909a8;};'use strict';var rp=require(_0x166b('0x0'));var util=require(_0x166b('0x1'));var _=require(_0x166b('0x2'));var Mustache=require(_0x166b('0x3'));var logger=require(_0x166b('0x4'))('trigger');exports[_0x166b('0x5')]=function(_0x453463,_0x4210e0){var _0x355b56,_0x272d63;var _0x595504={'method':_0x453463['data1']['toUpperCase'](),'uri':Mustache[_0x166b('0x6')](_0x453463[_0x166b('0x7')],_0x4210e0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x453463[_0x166b('0x8')])===_0x166b('0x9')&&parseInt(_0x453463[_0x166b('0x8')])>=0x1&&parseInt(_0x453463[_0x166b('0x8')])<=0xa?parseInt(_0x453463[_0x166b('0x8')])*0x3e8:0x5*0x3e8};try{_0x595504['headers']=_0x453463[_0x166b('0xa')]?JSON[_0x166b('0xb')](Mustache['render'](_0x453463[_0x166b('0xa')],_0x4210e0)):{};}catch(_0x1e37d3){logger[_0x166b('0xc')](_0x1e37d3['stack']);}switch(_0x453463[_0x166b('0xd')][_0x166b('0xe')]()){case _0x166b('0xf'):case'DELETE':_0x355b56=null;_0x595504['qs']=_0x4210e0;break;case _0x166b('0x10'):case'PUT':if(_0x453463[_0x166b('0x11')]){try{_0x355b56=JSON[_0x166b('0xb')](Mustache[_0x166b('0x6')](_0x453463[_0x166b('0x11')],_0x4210e0));_0x595504[_0x166b('0x12')]=_0x355b56;}catch(_0x485779){logger[_0x166b('0xc')](_0x485779[_0x166b('0x13')]);logger[_0x166b('0xc')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x355b56=_0x4210e0;_0x595504[_0x166b('0x12')]=_0x355b56;}break;}logger[_0x166b('0x14')](util[_0x166b('0x15')](_0x166b('0x16'),_0x453463[_0x166b('0xd')],_0x453463[_0x166b('0x7')],JSON[_0x166b('0x17')](_0x595504)));rp(_0x595504)['then'](function(_0x4735af){_0x355b56=!_['isNil'](_0x355b56)?',\x20request\x20body:\x20'+_0x355b56:'';_0x272d63=typeof _0x4735af[_0x166b('0x12')]===_0x166b('0x18')?JSON[_0x166b('0x17')](_0x4735af[_0x166b('0x12')]):_0x4735af[_0x166b('0x12')];logger[_0x166b('0x14')](util[_0x166b('0x15')](_0x166b('0x19'),_0x453463['data1'],_0x453463[_0x166b('0x7')],_0x4735af[_0x166b('0x1a')],_0x272d63));})[_0x166b('0x1b')](function(_0x1fc086){logger[_0x166b('0xc')](util[_0x166b('0x15')](_0x166b('0x1c'),_0x453463[_0x166b('0xd')],_0x453463['data2'],_0x1fc086['statusCode'],_0x1fc086[_0x166b('0x1d')],_0x1fc086[_0x166b('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c742134..ea54a11 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 _0x4023=['debug','rpc','error','message','catch','exports','routing','client','http','Request','request'];(function(_0x1900a3,_0x5c9e62){var _0x434e6e=function(_0x36ee8e){while(--_0x36ee8e){_0x1900a3['push'](_0x1900a3['shift']());}};_0x434e6e(++_0x5c9e62);}(_0x4023,0xc1));var _0x3402=function(_0x438baf,_0x3c3210){_0x438baf=_0x438baf-0x0;var _0x5c4171=_0x4023[_0x438baf];return _0x5c4171;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x3402('0x0'));var client=jayson[_0x3402('0x1')][_0x3402('0x2')]({'port':0x2329});client[_0x3402('0x3')]=function(_0x8f9bc5,_0x5a24bb){return new BPromise(function(_0x175015,_0x4da1c1){return client[_0x3402('0x4')](_0x8f9bc5,_0x5a24bb)['then'](function(_0x4b8d1d){logger[_0x3402('0x5')](_0x3402('0x6'),_0x3402('0x0'),_0x8f9bc5,_0x5a24bb,_0x4b8d1d);if(_0x4b8d1d[_0x3402('0x7')]){logger[_0x3402('0x7')](_0x3402('0x6'),_0x3402('0x0'),_0x8f9bc5,_0x4b8d1d[_0x3402('0x7')][_0x3402('0x8')],_0x5a24bb);return _0x4da1c1(_0x4b8d1d[_0x3402('0x7')]['message']);}else{return _0x175015(_0x4b8d1d['result']);}})[_0x3402('0x9')](function(_0x4de04e){logger[_0x3402('0x7')](_0x3402('0x6'),'routing',_0x8f9bc5,_0x4de04e,_0x5a24bb);return _0x4da1c1(_0x4de04e);});});};module[_0x3402('0xa')]=client; \ No newline at end of file +var _0x9913=['message','catch','exports','jayson/promise','routing','client','http','Request','request','then','debug','rpc','error'];(function(_0x8119ff,_0x337705){var _0x537249=function(_0xc4bb85){while(--_0xc4bb85){_0x8119ff['push'](_0x8119ff['shift']());}};_0x537249(++_0x337705);}(_0x9913,0x12e));var _0x3991=function(_0x256684,_0x529c1e){_0x256684=_0x256684-0x0;var _0x37a0c9=_0x9913[_0x256684];return _0x37a0c9;};'use strict';var jayson=require(_0x3991('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x3991('0x1'));var client=jayson[_0x3991('0x2')][_0x3991('0x3')]({'port':0x2329});client[_0x3991('0x4')]=function(_0x1ea46d,_0x291678){return new BPromise(function(_0x4aa4f4,_0x2e30e1){return client[_0x3991('0x5')](_0x1ea46d,_0x291678)[_0x3991('0x6')](function(_0x476bb6){logger[_0x3991('0x7')](_0x3991('0x8'),'routing',_0x1ea46d,_0x291678,_0x476bb6);if(_0x476bb6[_0x3991('0x9')]){logger['error'](_0x3991('0x8'),'routing',_0x1ea46d,_0x476bb6[_0x3991('0x9')][_0x3991('0xa')],_0x291678);return _0x2e30e1(_0x476bb6[_0x3991('0x9')][_0x3991('0xa')]);}else{return _0x4aa4f4(_0x476bb6['result']);}})[_0x3991('0xb')](function(_0x585a18){logger[_0x3991('0x9')](_0x3991('0x8'),_0x3991('0x1'),_0x1ea46d,_0x585a18,_0x291678);return _0x2e30e1(_0x585a18);});});};module[_0x3991('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5628063..3682fea 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 _0xa662=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch'];(function(_0x5128ef,_0x4834cf){var _0x56b8a3=function(_0x103f93){while(--_0x103f93){_0x5128ef['push'](_0x5128ef['shift']());}};_0x56b8a3(++_0x4834cf);}(_0xa662,0xa4));var _0x2a66=function(_0x3c4a17,_0x4bb957){_0x3c4a17=_0x3c4a17-0x0;var _0x2d0d6e=_0xa662[_0x3c4a17];return _0x2d0d6e;};'use strict';var server=require(_0x2a66('0x0'));var Realtime=require(_0x2a66('0x1'));var EmailChannel=require(_0x2a66('0x2'));var mailAccount=require(_0x2a66('0x3'));var setting=require(_0x2a66('0x4'));var logger=require(_0x2a66('0x5'))(_0x2a66('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x2a66('0x7')](mailAccount[_0x2a66('0x8')]())[_0x2a66('0x7')](realtime[_0x2a66('0x9')]())[_0x2a66('0x7')](function(){email[_0x2a66('0xa')](realtime[_0x2a66('0xb')]);return realtime;});}function main(){return server[_0x2a66('0xc')](realtime,email)[_0x2a66('0x7')](function(){return initRealtime();})[_0x2a66('0x7')](function(){return setting[_0x2a66('0xd')]();})[_0x2a66('0x7')](function(_0x796446){return setInterval(initRealtime,_0x796446[_0x2a66('0xe')]*0x3e8);})[_0x2a66('0xf')](function(_0x2ab17f){logger[_0x2a66('0x10')](_0x2a66('0x11'),_0x2ab17f);});}main(); \ No newline at end of file +var _0x1b07=['./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x58db35,_0xf0eaa5){var _0x79e108=function(_0x10480a){while(--_0x10480a){_0x58db35['push'](_0x58db35['shift']());}};_0x79e108(++_0xf0eaa5);}(_0x1b07,0x162));var _0x71b0=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0x1b07[_0x42020e];return _0x561551;};'use strict';var server=require(_0x71b0('0x0'));var Realtime=require(_0x71b0('0x1'));var EmailChannel=require(_0x71b0('0x2'));var mailAccount=require(_0x71b0('0x3'));var setting=require(_0x71b0('0x4'));var logger=require(_0x71b0('0x5'))(_0x71b0('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x71b0('0x7')](mailAccount[_0x71b0('0x8')]())[_0x71b0('0x7')](realtime[_0x71b0('0x9')]())[_0x71b0('0x7')](function(){email[_0x71b0('0xa')](realtime[_0x71b0('0xb')]);return realtime;});}function main(){return server[_0x71b0('0xc')](realtime,email)[_0x71b0('0x7')](function(){return initRealtime();})[_0x71b0('0x7')](function(){return setting[_0x71b0('0xd')]();})[_0x71b0('0x7')](function(_0x5aedf3){return setInterval(initRealtime,_0x5aedf3[_0x71b0('0xe')]*0x3e8);})['catch'](function(_0x50f1ba){logger[_0x71b0('0xf')](_0x71b0('0x10'),_0x50f1ba);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 21f25bb..8aa382a 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 _0x47e7=['sendMail','verifySmtp','Smtp','smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','key','active','Imap','messageStatus','total','isNil','refresh','hasOwnProperty','service','provider','custom','email','box','handleImapBox','handleImapEmail','handleImapEnd','bind','error','status','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','handleImapError'];(function(_0x4c29f9,_0x5bddd4){var _0x4e17b8=function(_0x12e055){while(--_0x12e055){_0x4c29f9['push'](_0x4c29f9['shift']());}};_0x4e17b8(++_0x5bddd4);}(_0x47e7,0x1cf));var _0x747e=function(_0x518510,_0x55246e){_0x518510=_0x518510-0x0;var _0x281fa0=_0x47e7[_0x518510];return _0x281fa0;};'use strict';var _=require(_0x747e('0x0'));var moment=require(_0x747e('0x1'));var BPromise=require(_0x747e('0x2'));var md5=require(_0x747e('0x3'));var Redis=require(_0x747e('0x4'));var config=require(_0x747e('0x5'));var logger=require(_0x747e('0x6'))('email');config[_0x747e('0x7')]=_[_0x747e('0x8')](config[_0x747e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x747e('0x9'))(new Redis(config[_0x747e('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x747e('0xa'));var mailAccount=require(_0x747e('0xb'));var md5Accounts={};function EmailChannel(_0x84fa4d){logger[_0x747e('0xc')](_0x747e('0xd'));this['mailAccounts']=_0x84fa4d[_0x747e('0xe')];this[_0x747e('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x747e('0x10')][_0x747e('0x11')]=function(_0x51a4d7){var _0x1fe788=this[_0x747e('0xe')][_0x51a4d7];var _0x1eedca={'id':_0x1fe788['id'],'name':_0x1fe788['name'],'key':_0x1fe788[_0x747e('0x12')],'active':_0x1fe788[_0x747e('0x13')],'Imap':{'status':_0x1fe788[_0x747e('0x14')]['status'],'messageStatus':_0x1fe788[_0x747e('0x14')][_0x747e('0x15')],'total':_0x1fe788[_0x747e('0x14')][_0x747e('0x16')]}};if(_[_0x747e('0x17')](md5Accounts[_0x51a4d7])){md5Accounts[_0x51a4d7]={};}var _0x897cf7=md5(JSON['stringify'](_0x1eedca));if(md5Accounts[_0x51a4d7][_0x747e('0x3')]!==_0x897cf7){md5Accounts[_0x51a4d7][_0x747e('0x3')]=_0x897cf7;io['emit']('mailAccount:update',_0x1eedca);}};EmailChannel[_0x747e('0x10')][_0x747e('0x18')]=function(_0x14eb53){for(var _0x436eac in _0x14eb53){if(_0x14eb53[_0x747e('0x19')](_0x436eac)){if(_0x14eb53[_0x436eac][_0x747e('0x14')]&&_0x14eb53[_0x436eac][_0x747e('0x13')]){var _0x3b95f4=_0x14eb53[_0x436eac][_0x747e('0x14')];if(!_0x3b95f4[_0x747e('0x1a')]&&_0x14eb53[_0x436eac][_0x747e('0x1b')]!==_0x747e('0x1c'))_0x3b95f4[_0x747e('0x1a')]=_0x14eb53[_0x436eac][_0x747e('0x1b')];if(!this[_0x747e('0xf')]['hasOwnProperty'](_0x3b95f4['id'])){this[_0x747e('0xf')][_0x3b95f4['id']]=new EmailImap(_0x3b95f4,_0x14eb53[_0x436eac][_0x747e('0x1d')]);this['imapAccounts'][_0x3b95f4['id']]['on'](_0x747e('0x1e'),this[_0x747e('0x1f')]['bind'](this,_0x436eac));this['imapAccounts'][_0x3b95f4['id']]['on'](_0x747e('0x1d'),this[_0x747e('0x20')]['bind'](this,_0x436eac));this[_0x747e('0xf')][_0x3b95f4['id']]['on']('end',this[_0x747e('0x21')][_0x747e('0x22')](this,_0x436eac));this['imapAccounts'][_0x3b95f4['id']]['on'](_0x747e('0x23'),this['handleImapError'][_0x747e('0x22')](this,_0x436eac));}}else{if(_[_0x747e('0x17')](this[_0x747e('0xe')][_0x436eac][_0x747e('0x14')])){this[_0x747e('0xe')][_0x436eac][_0x747e('0x14')]={};}this[_0x747e('0xe')][_0x436eac]['Imap'][_0x747e('0x24')]='disabled';this[_0x747e('0xe')][_0x436eac]['Imap']['messageStatus']='';this[_0x747e('0x11')](_0x436eac);}}}};EmailChannel[_0x747e('0x10')][_0x747e('0x1f')]=function(_0x56365d,_0x1e898e){if(this[_0x747e('0xe')][_0x56365d]){this['mailAccounts'][_0x56365d]['Imap'][_0x747e('0x24')]=_0x747e('0x25');this[_0x747e('0xe')][_0x56365d][_0x747e('0x14')]['messageStatus']=_0x1e898e[_0x747e('0x26')];if(_0x1e898e['messages']){this[_0x747e('0xe')][_0x56365d][_0x747e('0x14')][_0x747e('0x16')]=_0x1e898e[_0x747e('0x27')][_0x747e('0x16')];}return this['emit'](_0x56365d);}};EmailChannel[_0x747e('0x10')][_0x747e('0x20')]=function(_0x267719,_0x47af2a){logger[_0x747e('0xc')](_0x747e('0x28'),_0x47af2a['firstName'],_0x47af2a[_0x747e('0x29')],_0x47af2a[_0x747e('0x2a')],_0x267719);if(this[_0x747e('0xe')][_0x267719]){return mailAccount[_0x747e('0x2b')](_0x267719,_0x47af2a)[_0x747e('0x2c')](function(_0x31aa6f){if(_0x31aa6f){logger[_0x747e('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x747e('0x2d')](function(_0x4b5c84){logger[_0x747e('0x23')](_0x747e('0x2e'),JSON[_0x747e('0x2f')](_0x4b5c84));});}};EmailChannel[_0x747e('0x10')]['handleImapEnd']=function(_0x20764c){if(this[_0x747e('0xe')][_0x20764c]&&this[_0x747e('0xe')][_0x20764c][_0x747e('0x14')]){if(this[_0x747e('0xf')][this[_0x747e('0xe')][_0x20764c]['Imap']['id']]){delete this[_0x747e('0xf')][this['mailAccounts'][_0x20764c][_0x747e('0x14')]['id']];}this[_0x747e('0xe')][_0x20764c]['Imap'][_0x747e('0x30')]=moment();this[_0x747e('0x11')](_0x20764c);}};EmailChannel[_0x747e('0x10')][_0x747e('0x31')]=function(_0x550bb5,_0xe58534){if(this['mailAccounts'][_0x550bb5]){this[_0x747e('0xe')][_0x550bb5][_0x747e('0x14')]['status']='error';this['mailAccounts'][_0x550bb5][_0x747e('0x14')]['messageStatus']=_0xe58534;return this[_0x747e('0x11')](_0x550bb5);}};EmailChannel[_0x747e('0x10')][_0x747e('0x32')]=function(_0x3941ba,_0x19d426){return this['smtp']['send'](_0x3941ba,_0x19d426);};EmailChannel['prototype'][_0x747e('0x33')]=function(_0x4fcae9){var _0x20fbd4=this;if(this[_0x747e('0xe')][_0x4fcae9['id']]){if(_[_0x747e('0x17')](this[_0x747e('0xe')][_0x4fcae9['id']][_0x747e('0x34')])){this[_0x747e('0xe')][_0x4fcae9['id']][_0x747e('0x34')]={};}this[_0x747e('0xe')][_0x4fcae9['id']]['Smtp'][_0x747e('0x30')]=moment();return new BPromise(function(_0x212707,_0x34cf09){return _0x20fbd4[_0x747e('0x35')][_0x747e('0x36')](_0x4fcae9)[_0x747e('0x2c')](function(_0x7b551a){_0x20fbd4[_0x747e('0xe')][_0x4fcae9['id']][_0x747e('0x34')]['status']=_0x747e('0x37');_0x20fbd4[_0x747e('0xe')][_0x4fcae9['id']][_0x747e('0x34')]['messageStatus']='';_0x20fbd4[_0x747e('0x11')](_0x4fcae9['id']);_0x212707(_0x7b551a);})['catch'](function(_0x34b736){_0x20fbd4[_0x747e('0xe')][_0x4fcae9['id']][_0x747e('0x34')]['status']=_0x747e('0x23');_0x20fbd4[_0x747e('0xe')][_0x4fcae9['id']][_0x747e('0x34')][_0x747e('0x15')]=_0x34b736;_0x20fbd4[_0x747e('0x11')](_0x4fcae9['id']);_0x34cf09(_0x34b736);});});}return this[_0x747e('0x35')][_0x747e('0x36')](_0x4fcae9);};module[_0x747e('0x38')]=EmailChannel; \ No newline at end of file +var _0x8d86=['provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','status','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','stringify','mailAccount:update','hasOwnProperty','service'];(function(_0x47db99,_0x94df68){var _0x5c6781=function(_0x269233){while(--_0x269233){_0x47db99['push'](_0x47db99['shift']());}};_0x5c6781(++_0x94df68);}(_0x8d86,0x13b));var _0x68d8=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x8d86[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x68d8('0x0'));var moment=require(_0x68d8('0x1'));var BPromise=require(_0x68d8('0x2'));var md5=require(_0x68d8('0x3'));var Redis=require('ioredis');var config=require(_0x68d8('0x4'));var logger=require(_0x68d8('0x5'))(_0x68d8('0x6'));config['redis']=_['defaults'](config[_0x68d8('0x7')],{'host':_0x68d8('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x68d8('0x7')]));var EmailImap=require(_0x68d8('0x9'));var EmailSmtp=require(_0x68d8('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1f6536){logger['info'](_0x68d8('0xb'));this['mailAccounts']=_0x1f6536[_0x68d8('0xc')];this[_0x68d8('0xd')]={};this[_0x68d8('0xe')]=new EmailSmtp();}EmailChannel[_0x68d8('0xf')][_0x68d8('0x10')]=function(_0x30e7be){var _0x5d4659=this[_0x68d8('0xc')][_0x30e7be];var _0x1214d7={'id':_0x5d4659['id'],'name':_0x5d4659[_0x68d8('0x11')],'key':_0x5d4659[_0x68d8('0x12')],'active':_0x5d4659[_0x68d8('0x13')],'Imap':{'status':_0x5d4659[_0x68d8('0x14')]['status'],'messageStatus':_0x5d4659[_0x68d8('0x14')][_0x68d8('0x15')],'total':_0x5d4659[_0x68d8('0x14')][_0x68d8('0x16')]}};if(_['isNil'](md5Accounts[_0x30e7be])){md5Accounts[_0x30e7be]={};}var _0xfa5c87=md5(JSON[_0x68d8('0x17')](_0x1214d7));if(md5Accounts[_0x30e7be][_0x68d8('0x3')]!==_0xfa5c87){md5Accounts[_0x30e7be][_0x68d8('0x3')]=_0xfa5c87;io[_0x68d8('0x10')](_0x68d8('0x18'),_0x1214d7);}};EmailChannel['prototype']['refresh']=function(_0x19803f){for(var _0x65d9ca in _0x19803f){if(_0x19803f[_0x68d8('0x19')](_0x65d9ca)){if(_0x19803f[_0x65d9ca][_0x68d8('0x14')]&&_0x19803f[_0x65d9ca][_0x68d8('0x13')]){var _0xccd4f9=_0x19803f[_0x65d9ca][_0x68d8('0x14')];if(!_0xccd4f9[_0x68d8('0x1a')]&&_0x19803f[_0x65d9ca][_0x68d8('0x1b')]!=='custom')_0xccd4f9[_0x68d8('0x1a')]=_0x19803f[_0x65d9ca][_0x68d8('0x1b')];if(!this[_0x68d8('0xd')]['hasOwnProperty'](_0xccd4f9['id'])){this[_0x68d8('0xd')][_0xccd4f9['id']]=new EmailImap(_0xccd4f9,_0x19803f[_0x65d9ca][_0x68d8('0x6')]);this['imapAccounts'][_0xccd4f9['id']]['on'](_0x68d8('0x1c'),this[_0x68d8('0x1d')][_0x68d8('0x1e')](this,_0x65d9ca));this[_0x68d8('0xd')][_0xccd4f9['id']]['on'](_0x68d8('0x6'),this[_0x68d8('0x1f')][_0x68d8('0x1e')](this,_0x65d9ca));this[_0x68d8('0xd')][_0xccd4f9['id']]['on'](_0x68d8('0x20'),this[_0x68d8('0x21')][_0x68d8('0x1e')](this,_0x65d9ca));this[_0x68d8('0xd')][_0xccd4f9['id']]['on'](_0x68d8('0x22'),this[_0x68d8('0x23')]['bind'](this,_0x65d9ca));}}else{if(_[_0x68d8('0x24')](this['mailAccounts'][_0x65d9ca]['Imap'])){this['mailAccounts'][_0x65d9ca]['Imap']={};}this[_0x68d8('0xc')][_0x65d9ca][_0x68d8('0x14')]['status']=_0x68d8('0x25');this[_0x68d8('0xc')][_0x65d9ca][_0x68d8('0x14')]['messageStatus']='';this[_0x68d8('0x10')](_0x65d9ca);}}}};EmailChannel[_0x68d8('0xf')][_0x68d8('0x1d')]=function(_0x20e432,_0x49983b){if(this[_0x68d8('0xc')][_0x20e432]){this['mailAccounts'][_0x20e432]['Imap'][_0x68d8('0x26')]=_0x68d8('0x27');this[_0x68d8('0xc')][_0x20e432]['Imap'][_0x68d8('0x15')]=_0x49983b[_0x68d8('0x11')];if(_0x49983b[_0x68d8('0x28')]){this[_0x68d8('0xc')][_0x20e432][_0x68d8('0x14')]['total']=_0x49983b[_0x68d8('0x28')]['total'];}return this[_0x68d8('0x10')](_0x20e432);}};EmailChannel[_0x68d8('0xf')][_0x68d8('0x1f')]=function(_0x332731,_0x1ce7fe){logger[_0x68d8('0x29')](_0x68d8('0x2a'),_0x1ce7fe[_0x68d8('0x2b')],_0x1ce7fe['lastName'],_0x1ce7fe[_0x68d8('0x2c')],_0x332731);if(this[_0x68d8('0xc')][_0x332731]){return mailAccount[_0x68d8('0x2d')](_0x332731,_0x1ce7fe)[_0x68d8('0x2e')](function(_0x18af63){if(_0x18af63){logger['info'](_0x68d8('0x2f'));}})[_0x68d8('0x30')](function(_0x20afd3){logger[_0x68d8('0x22')](_0x68d8('0x31'),JSON['stringify'](_0x20afd3));});}};EmailChannel[_0x68d8('0xf')][_0x68d8('0x21')]=function(_0x37ae1f){if(this[_0x68d8('0xc')][_0x37ae1f]&&this[_0x68d8('0xc')][_0x37ae1f][_0x68d8('0x14')]){if(this[_0x68d8('0xd')][this['mailAccounts'][_0x37ae1f][_0x68d8('0x14')]['id']]){delete this[_0x68d8('0xd')][this[_0x68d8('0xc')][_0x37ae1f][_0x68d8('0x14')]['id']];}this['mailAccounts'][_0x37ae1f][_0x68d8('0x14')][_0x68d8('0x32')]=moment();this[_0x68d8('0x10')](_0x37ae1f);}};EmailChannel[_0x68d8('0xf')][_0x68d8('0x23')]=function(_0x5b7819,_0x5a59da){if(this[_0x68d8('0xc')][_0x5b7819]){this['mailAccounts'][_0x5b7819]['Imap'][_0x68d8('0x26')]=_0x68d8('0x22');this[_0x68d8('0xc')][_0x5b7819][_0x68d8('0x14')][_0x68d8('0x15')]=_0x5a59da;return this[_0x68d8('0x10')](_0x5b7819);}};EmailChannel[_0x68d8('0xf')][_0x68d8('0x33')]=function(_0xa03b27,_0x5b7172){return this[_0x68d8('0xe')][_0x68d8('0x34')](_0xa03b27,_0x5b7172);};EmailChannel[_0x68d8('0xf')][_0x68d8('0x35')]=function(_0x32ad2a){var _0x1ff877=this;if(this['mailAccounts'][_0x32ad2a['id']]){if(_[_0x68d8('0x24')](this[_0x68d8('0xc')][_0x32ad2a['id']][_0x68d8('0x36')])){this[_0x68d8('0xc')][_0x32ad2a['id']][_0x68d8('0x36')]={};}this[_0x68d8('0xc')][_0x32ad2a['id']][_0x68d8('0x36')][_0x68d8('0x32')]=moment();return new BPromise(function(_0x3777ae,_0x14626a){return _0x1ff877[_0x68d8('0xe')][_0x68d8('0x37')](_0x32ad2a)['then'](function(_0x5b29e0){_0x1ff877[_0x68d8('0xc')][_0x32ad2a['id']][_0x68d8('0x36')]['status']='verified';_0x1ff877[_0x68d8('0xc')][_0x32ad2a['id']][_0x68d8('0x36')][_0x68d8('0x15')]='';_0x1ff877[_0x68d8('0x10')](_0x32ad2a['id']);_0x3777ae(_0x5b29e0);})[_0x68d8('0x30')](function(_0x50ae8d){_0x1ff877[_0x68d8('0xc')][_0x32ad2a['id']][_0x68d8('0x36')][_0x68d8('0x26')]=_0x68d8('0x22');_0x1ff877[_0x68d8('0xc')][_0x32ad2a['id']][_0x68d8('0x36')][_0x68d8('0x15')]=_0x50ae8d;_0x1ff877[_0x68d8('0x10')](_0x32ad2a['id']);_0x14626a(_0x50ae8d);});});}return this[_0x68d8('0xe')][_0x68d8('0x37')](_0x32ad2a);};module[_0x68d8('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 768f625..2f51494 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 _0x814b=['search','handleReadUnseen','length','fetch','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchEnd','handleCloseBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','end','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','autotls','xoauth2','generateXOAuth2Token','CloudProvider','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen'];(function(_0x247fd1,_0x326676){var _0x21379a=function(_0x87f7de){while(--_0x87f7de){_0x247fd1['push'](_0x247fd1['shift']());}};_0x21379a(++_0x326676);}(_0x814b,0x1a2));var _0xb814=function(_0xfbe06e,_0x2fb7ab){_0xfbe06e=_0xfbe06e-0x0;var _0x24e5b6=_0x814b[_0xfbe06e];return _0x24e5b6;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var Imap=require(_0xb814('0x2'));var simpleParser=require(_0xb814('0x3'))[_0xb814('0x4')];var Iconv=require(_0xb814('0x5'))['Iconv'];var EventEmitter=require(_0xb814('0x6'))[_0xb814('0x7')];var utils=require(_0xb814('0x8'));var logger=require(_0xb814('0x9'))(_0xb814('0xa'));function EmailImap(_0x322a70,_0x53e507){this[_0xb814('0xb')]=_0xb814('0xc');this['account']=this[_0xb814('0xd')](_0x322a70,_0x53e507);this[_0xb814('0x2')]=new Imap(this[_0xb814('0xe')]);this[_0xb814('0x2')][_0xb814('0xf')](_0xb814('0x10'),this[_0xb814('0x11')][_0xb814('0x12')](this));this[_0xb814('0x2')][_0xb814('0xf')](_0xb814('0x13'),this['handleEnd'][_0xb814('0x12')](this));this['imap']['on'](_0xb814('0x14'),this[_0xb814('0x15')][_0xb814('0x12')](this));this[_0xb814('0x2')][_0xb814('0x16')]();}util[_0xb814('0x17')](EmailImap,EventEmitter);EmailImap[_0xb814('0x18')][_0xb814('0xd')]=function(_0xa0a2e5,_0x2ab627){var _0x3f4881={'connTimeout':_0xa0a2e5[_0xb814('0x19')]?_0xa0a2e5[_0xb814('0x19')]*0x3e8:0x2710,'authTimeout':_0xa0a2e5[_0xb814('0x1a')]?_0xa0a2e5[_0xb814('0x1a')]*0x3e8:0x1388};if(_[_0xb814('0x1b')](_0xa0a2e5[_0xb814('0x1c')])){if(_0xa0a2e5[_0xb814('0x1d')]){_0x3f4881[_0xb814('0x1e')]=_0xa0a2e5[_0xb814('0x1e')];_0x3f4881[_0xb814('0x1f')]=_0xa0a2e5['password'];}_0x3f4881[_0xb814('0x20')]=_0xa0a2e5['host'];_0x3f4881[_0xb814('0x21')]=_0xa0a2e5[_0xb814('0x21')]||0x3e1;if(_0xa0a2e5['tls']){_0x3f4881['tls']=!![];}else{_0x3f4881['tls']=![];_0x3f4881[_0xb814('0x22')]='required';}}else{if(_0xa0a2e5['modernAuthentication']){_0x3f4881[_0xb814('0x23')]=utils[_0xb814('0x24')](_0xa0a2e5[_0xb814('0x25')]['data5'],_0xa0a2e5[_0xb814('0x1e')]);_0x3f4881['user']=_0xa0a2e5[_0xb814('0x1e')];}else{_0x3f4881[_0xb814('0x1e')]=_0xa0a2e5[_0xb814('0x1e')];_0x3f4881[_0xb814('0x1f')]=_0xa0a2e5[_0xb814('0x1f')];}_0x3f4881[_0xb814('0x20')]=utils[_0xb814('0x26')](_0xa0a2e5['service']);_0x3f4881[_0xb814('0x21')]=0x3e1;_0x3f4881['tls']=!![];}_0x3f4881[_0xb814('0xa')]=_0x2ab627||_0xa0a2e5[_0xb814('0x1e')]||_0xb814('0x27');return _0x3f4881;};EmailImap[_0xb814('0x18')][_0xb814('0x11')]=function(){this[_0xb814('0x2')][_0xb814('0x28')](this['mailbox'],![],this[_0xb814('0x29')][_0xb814('0x12')](this));};EmailImap[_0xb814('0x18')][_0xb814('0x29')]=function(_0x32ed56,_0x1d5965){if(_0x32ed56){this[_0xb814('0x15')](_0x32ed56,!![]);}else{this[_0xb814('0x2a')]('box',_0x1d5965);this[_0xb814('0x2b')]();}};EmailImap[_0xb814('0x18')]['handleCloseBox']=function(_0x9008b2){if(_0x9008b2){this[_0xb814('0x15')](_0x9008b2,!![]);}else{this[_0xb814('0x2')]['end']();}};EmailImap[_0xb814('0x18')][_0xb814('0x2b')]=function(){this['imap'][_0xb814('0x2c')](['UNSEEN'],this[_0xb814('0x2d')]['bind'](this));};EmailImap['prototype'][_0xb814('0x2d')]=function(_0x4a4f27,_0x2431e2){if(_0x4a4f27){this[_0xb814('0x15')](_0x4a4f27,!![]);}else{if(_0x2431e2[_0xb814('0x2e')]){try{var _0x599f9f=this['imap'][_0xb814('0x2f')](_0x2431e2,{'bodies':'','markSeen':!![]});_0x599f9f['on'](_0xb814('0x30'),this['handleFetchMessage'][_0xb814('0x12')](this));_0x599f9f[_0xb814('0xf')](_0xb814('0x14'),this[_0xb814('0x31')][_0xb814('0x12')](this));_0x599f9f[_0xb814('0xf')](_0xb814('0x13'),this['handleFetchEnd'][_0xb814('0x12')](this));}catch(_0x2263f6){logger[_0xb814('0x14')](_0x2263f6);}}else{this[_0xb814('0x2')][_0xb814('0x32')](!![],this['handleCloseBox'][_0xb814('0x12')](this));}}};EmailImap['prototype'][_0xb814('0x33')]=function(_0x16e21c){_0x16e21c['on'](_0xb814('0x34'),this['handleMessageBody'][_0xb814('0x12')](this));_0x16e21c[_0xb814('0xf')]('attributes',this[_0xb814('0x35')][_0xb814('0x12')](this));_0x16e21c[_0xb814('0xf')](_0xb814('0x13'),this[_0xb814('0x36')][_0xb814('0x12')](this));};EmailImap['prototype'][_0xb814('0x37')]=function(_0x4e4684){simpleParser(_0x4e4684,{'Iconv':Iconv},this[_0xb814('0x38')]['bind'](this));};EmailImap[_0xb814('0x18')]['handleMessageAttributes']=function(){};EmailImap[_0xb814('0x18')][_0xb814('0x36')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x5dd6bc,_0x57b379){if(_0x5dd6bc){logger[_0xb814('0x14')](_0x5dd6bc);}else{var _0x262a0b=this;utils[_0xb814('0x39')](this[_0xb814('0xe')],_0x57b379,function(_0x51cdba){_0x262a0b['emit'](_0xb814('0xa'),_0x51cdba);});}};EmailImap['prototype'][_0xb814('0x3a')]=function(){this[_0xb814('0x2')][_0xb814('0x32')](!![],this[_0xb814('0x3b')][_0xb814('0x12')](this));};EmailImap[_0xb814('0x18')][_0xb814('0x31')]=function(_0x28b2b4){this[_0xb814('0x15')](_0x28b2b4);this['imap']['closeBox'](!![],this['handleCloseBox'][_0xb814('0x12')](this));};EmailImap['prototype'][_0xb814('0x3c')]=function(){this['emit'](_0xb814('0x13'));};EmailImap[_0xb814('0x18')][_0xb814('0x15')]=function(_0x2e97cc,_0x4fae23){logger[_0xb814('0x14')](_0xb814('0x15'),this[_0xb814('0xe')][_0xb814('0xa')],JSON[_0xb814('0x3d')](_0x2e97cc));var _0x450a08='';if(_0x2e97cc){if(_0x2e97cc['textCode']){_0x450a08=_0x2e97cc[_0xb814('0x3e')];}else{for(var _0x3c21b1 in _0x2e97cc){if(_0x2e97cc[_0xb814('0x3f')](_0x3c21b1)){_0x450a08+=_[_0xb814('0x40')](_0x3c21b1)+':\x20'+_0x2e97cc[_0x3c21b1]+'\x0a';}}}}if(_0x4fae23){this[_0xb814('0x2')][_0xb814('0x13')]();}else{this[_0xb814('0x2a')]('error',_0x450a08);this['emit'](_0xb814('0x13'));}};module[_0xb814('0x41')]=EmailImap; \ No newline at end of file +var _0x4975=['upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','handleCloseBox','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','hasOwnProperty'];(function(_0x11de83,_0x49e1c1){var _0x45bdb0=function(_0x51041e){while(--_0x51041e){_0x11de83['push'](_0x11de83['shift']());}};_0x45bdb0(++_0x49e1c1);}(_0x4975,0x86));var _0x5497=function(_0x1d2a6c,_0x4523a9){_0x1d2a6c=_0x1d2a6c-0x0;var _0x30e0c9=_0x4975[_0x1d2a6c];return _0x30e0c9;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var Imap=require(_0x5497('0x1'));var simpleParser=require(_0x5497('0x2'))[_0x5497('0x3')];var Iconv=require(_0x5497('0x4'))[_0x5497('0x5')];var EventEmitter=require(_0x5497('0x6'))[_0x5497('0x7')];var utils=require(_0x5497('0x8'));var logger=require(_0x5497('0x9'))(_0x5497('0xa'));function EmailImap(_0x539a27,_0x37e48d){this['mailbox']=_0x5497('0xb');this[_0x5497('0xc')]=this[_0x5497('0xd')](_0x539a27,_0x37e48d);this['imap']=new Imap(this[_0x5497('0xc')]);this['imap'][_0x5497('0xe')](_0x5497('0xf'),this[_0x5497('0x10')][_0x5497('0x11')](this));this[_0x5497('0x1')][_0x5497('0xe')](_0x5497('0x12'),this[_0x5497('0x13')]['bind'](this));this['imap']['on']('error',this[_0x5497('0x14')][_0x5497('0x11')](this));this[_0x5497('0x1')][_0x5497('0x15')]();}util[_0x5497('0x16')](EmailImap,EventEmitter);EmailImap[_0x5497('0x17')][_0x5497('0xd')]=function(_0xaca97d,_0x363a5b){var _0x1a4c74={'connTimeout':_0xaca97d['connTimeout']?_0xaca97d[_0x5497('0x18')]*0x3e8:0x2710,'authTimeout':_0xaca97d['authTimeout']?_0xaca97d[_0x5497('0x19')]*0x3e8:0x1388};if(_[_0x5497('0x1a')](_0xaca97d[_0x5497('0x1b')])){if(_0xaca97d[_0x5497('0x1c')]){_0x1a4c74[_0x5497('0x1d')]=_0xaca97d[_0x5497('0x1d')];_0x1a4c74[_0x5497('0x1e')]=_0xaca97d['password'];}_0x1a4c74['host']=_0xaca97d[_0x5497('0x1f')];_0x1a4c74[_0x5497('0x20')]=_0xaca97d[_0x5497('0x20')]||0x3e1;if(_0xaca97d['tls']){_0x1a4c74[_0x5497('0x21')]=!![];}else{_0x1a4c74[_0x5497('0x21')]=![];_0x1a4c74[_0x5497('0x22')]=_0x5497('0x23');}}else{if(_0xaca97d[_0x5497('0x24')]){_0x1a4c74[_0x5497('0x25')]=utils[_0x5497('0x26')](_0xaca97d[_0x5497('0x27')][_0x5497('0x28')],_0xaca97d[_0x5497('0x1d')]);_0x1a4c74[_0x5497('0x1d')]=_0xaca97d['user'];}else{_0x1a4c74[_0x5497('0x1d')]=_0xaca97d['user'];_0x1a4c74[_0x5497('0x1e')]=_0xaca97d[_0x5497('0x1e')];}_0x1a4c74[_0x5497('0x1f')]=utils[_0x5497('0x29')](_0xaca97d[_0x5497('0x1b')]);_0x1a4c74[_0x5497('0x20')]=0x3e1;_0x1a4c74['tls']=!![];}_0x1a4c74['email']=_0x363a5b||_0xaca97d[_0x5497('0x1d')]||_0x5497('0x2a');return _0x1a4c74;};EmailImap[_0x5497('0x17')][_0x5497('0x10')]=function(){this['imap'][_0x5497('0x2b')](this['mailbox'],![],this[_0x5497('0x2c')][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x2c')]=function(_0x163a30,_0x31cd01){if(_0x163a30){this['handleError'](_0x163a30,!![]);}else{this[_0x5497('0x2d')]('box',_0x31cd01);this['readUnseen']();}};EmailImap['prototype'][_0x5497('0x2e')]=function(_0x48d146){if(_0x48d146){this['handleError'](_0x48d146,!![]);}else{this[_0x5497('0x1')][_0x5497('0x12')]();}};EmailImap[_0x5497('0x17')]['readUnseen']=function(){this['imap']['search']([_0x5497('0x2f')],this[_0x5497('0x30')][_0x5497('0x11')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x594866,_0xa28dd8){if(_0x594866){this['handleError'](_0x594866,!![]);}else{if(_0xa28dd8[_0x5497('0x31')]){try{var _0x258c2d=this[_0x5497('0x1')]['fetch'](_0xa28dd8,{'bodies':'','markSeen':!![]});_0x258c2d['on'](_0x5497('0x32'),this[_0x5497('0x33')]['bind'](this));_0x258c2d[_0x5497('0xe')](_0x5497('0x34'),this[_0x5497('0x35')]['bind'](this));_0x258c2d[_0x5497('0xe')](_0x5497('0x12'),this[_0x5497('0x36')][_0x5497('0x11')](this));}catch(_0x412f5b){logger['error'](_0x412f5b);}}else{this[_0x5497('0x1')][_0x5497('0x37')](!![],this['handleCloseBox'][_0x5497('0x11')](this));}}};EmailImap[_0x5497('0x17')][_0x5497('0x33')]=function(_0x1b9cd8){_0x1b9cd8['on'](_0x5497('0x38'),this[_0x5497('0x39')]['bind'](this));_0x1b9cd8[_0x5497('0xe')]('attributes',this[_0x5497('0x3a')][_0x5497('0x11')](this));_0x1b9cd8[_0x5497('0xe')]('end',this['handleMessageEnd'][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x39')]=function(_0x429cbf){simpleParser(_0x429cbf,{'Iconv':Iconv},this[_0x5497('0x3b')][_0x5497('0x11')](this));};EmailImap['prototype'][_0x5497('0x3a')]=function(){};EmailImap[_0x5497('0x17')][_0x5497('0x3c')]=function(){};EmailImap[_0x5497('0x17')][_0x5497('0x3b')]=function(_0x468902,_0x1e3b6a){if(_0x468902){logger[_0x5497('0x34')](_0x468902);}else{var _0x59627b=this;utils['parser'](this[_0x5497('0xc')],_0x1e3b6a,function(_0x32fa2b){_0x59627b[_0x5497('0x2d')](_0x5497('0xa'),_0x32fa2b);});}};EmailImap[_0x5497('0x17')][_0x5497('0x36')]=function(){this[_0x5497('0x1')]['closeBox'](!![],this[_0x5497('0x2e')][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x35')]=function(_0x1b251b){this[_0x5497('0x14')](_0x1b251b);this[_0x5497('0x1')]['closeBox'](!![],this[_0x5497('0x2e')][_0x5497('0x11')](this));};EmailImap[_0x5497('0x17')][_0x5497('0x13')]=function(){this[_0x5497('0x2d')](_0x5497('0x12'));};EmailImap[_0x5497('0x17')][_0x5497('0x14')]=function(_0x2021ae,_0x28d6cb){logger['error'](_0x5497('0x14'),this['account'][_0x5497('0xa')],JSON[_0x5497('0x3d')](_0x2021ae));var _0x26ef01='';if(_0x2021ae){if(_0x2021ae[_0x5497('0x3e')]){_0x26ef01=_0x2021ae[_0x5497('0x3e')];}else{for(var _0x510cfd in _0x2021ae){if(_0x2021ae[_0x5497('0x3f')](_0x510cfd)){_0x26ef01+=_[_0x5497('0x40')](_0x510cfd)+':\x20'+_0x2021ae[_0x510cfd]+'\x0a';}}}}if(_0x28d6cb){this['imap'][_0x5497('0x12')]();}else{this['emit'](_0x5497('0x34'),_0x26ef01);this['emit'](_0x5497('0x12'));}};module[_0x5497('0x41')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c01b38e..ecac7ad 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 _0x28e1=['Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','send','createTransport','use','compile','toString','prototype','verify'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x28e1,0x173));var _0x128e=function(_0x62d51c,_0x134298){_0x62d51c=_0x62d51c-0x0;var _0x4787b5=_0x28e1[_0x62d51c];return _0x4787b5;};'use strict';var nodemailer=require(_0x128e('0x0'));var inlineBase64=require(_0x128e('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x128e('0x2')]=function(_0x116646,_0xbf83a4){return new Promise(function(_0x47da70,_0x4b214d){var _0x1fe345=nodemailer[_0x128e('0x3')](_0x116646);_0x1fe345[_0x128e('0x4')](_0x128e('0x5'),inlineBase64());_0x1fe345['sendMail'](_0xbf83a4,function(_0x47a685,_0xc52027){if(_0x47a685){_0x4b214d(_0x47a685[_0x128e('0x6')]());}else{_0x47da70(_0xc52027);}});});};EmailSmtp[_0x128e('0x7')][_0x128e('0x8')]=function(_0x5edae2){return new Promise(function(_0x3285e2,_0x2dc670){var _0xafd81e=nodemailer[_0x128e('0x3')](_0x5edae2);_0xafd81e[_0x128e('0x8')](function(_0xe8faa5,_0x2adc89){if(_0xe8faa5){_0x2dc670(_0xe8faa5[_0x128e('0x6')]());}else{if(_0x2adc89){_0x3285e2(_0x2adc89);}else{_0x2dc670(_0x128e('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xd561=['createTransport','use','compile','toString','prototype','verify','Not\x20verifired','exports','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd561,0xfb));var _0x1d56=function(_0x5dd50b,_0x58e8ea){_0x5dd50b=_0x5dd50b-0x0;var _0xde960c=_0xd561[_0x5dd50b];return _0xde960c;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype'][_0x1d56('0x0')]=function(_0x2be957,_0x6d2b97){return new Promise(function(_0x23d965,_0x49155b){var _0x591805=nodemailer[_0x1d56('0x1')](_0x2be957);_0x591805[_0x1d56('0x2')](_0x1d56('0x3'),inlineBase64());_0x591805['sendMail'](_0x6d2b97,function(_0x8f06e2,_0x29d68d){if(_0x8f06e2){_0x49155b(_0x8f06e2[_0x1d56('0x4')]());}else{_0x23d965(_0x29d68d);}});});};EmailSmtp[_0x1d56('0x5')]['verify']=function(_0x5df35b){return new Promise(function(_0x148272,_0xcfc894){var _0x26fee4=nodemailer[_0x1d56('0x1')](_0x5df35b);_0x26fee4[_0x1d56('0x6')](function(_0x486f9,_0x52d6cf){if(_0x486f9){_0xcfc894(_0x486f9[_0x1d56('0x4')]());}else{if(_0x52d6cf){_0x148272(_0x52d6cf);}else{_0xcfc894(_0x1d56('0x7'));}}});});};module[_0x1d56('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 0efa075..4c1912c 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 _0xbcb0=['test','html','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','gmail','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','user=','base64','lodash','moment','path','util','node-tnef','../../../config/logger','email','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','length','slice','join','Anonymous','split','pop','isEmpty'];(function(_0x768ab5,_0x321eaa){var _0x29001c=function(_0x453c7c){while(--_0x453c7c){_0x768ab5['push'](_0x768ab5['shift']());}};_0x29001c(++_0x321eaa);}(_0xbcb0,0x1a5));var _0x0bcb=function(_0x843ea0,_0x1e859d){_0x843ea0=_0x843ea0-0x0;var _0x300e54=_0xbcb0[_0x843ea0];return _0x300e54;};'use strict';var _=require(_0x0bcb('0x0'));var moment=require(_0x0bcb('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x0bcb('0x2'));var util=require(_0x0bcb('0x3'));var tnef=require(_0x0bcb('0x4'));var logger=require(_0x0bcb('0x5'))(_0x0bcb('0x6'));var config=require('../../../config/environment');function getAddress(_0x5097e5){var _0x21cccd=_['head'](_0x5097e5[_0x0bcb('0x7')]);return _0x21cccd&&_0x21cccd[_0x0bcb('0x8')]?_0x21cccd[_0x0bcb('0x8')]:_0x0bcb('0x9')+random[_0x0bcb('0xa')](0x6)+_0x0bcb('0xb');}function getFirstName(_0x12fa20){var _0x1e98a2=_[_0x0bcb('0xc')](_0x12fa20['value']);if(_0x1e98a2&&_0x1e98a2['name']){if(_0x1e98a2[_0x0bcb('0xd')]==_0x1e98a2[_0x0bcb('0x8')]){return _0x1e98a2[_0x0bcb('0xd')][_0x0bcb('0xe')](0x0,_0x1e98a2[_0x0bcb('0xd')][_0x0bcb('0xf')]('@'));}var _0x505b56=_0x1e98a2[_0x0bcb('0xd')]['split'](/\s+/);return _0x505b56[_0x0bcb('0x10')]>0x1?_0x505b56[_0x0bcb('0x11')](0x0,-0x1)[_0x0bcb('0x12')]('\x20'):_0x1e98a2[_0x0bcb('0xd')];}return _0x0bcb('0x13');}function getLastName(_0x3d6fc3){var _0x35c8be=_[_0x0bcb('0xc')](_0x3d6fc3['value']);if(_0x35c8be&&_0x35c8be[_0x0bcb('0xd')]){var _0x8e2a47=_0x35c8be[_0x0bcb('0xd')][_0x0bcb('0x14')](/\s+/);return _0x8e2a47[_0x0bcb('0x10')]>0x1?_0x8e2a47[_0x0bcb('0x15')]():'';}return'';}function getMails(_0x1f6e16,_0x26d8c3){var _0x3ed9c8='';for(var _0x453818=0x0;_0x453818<_0x26d8c3['value'][_0x0bcb('0x10')];_0x453818+=0x1){if(_0x26d8c3['value'][_0x453818][_0x0bcb('0x8')]!==_0x1f6e16){if(!_[_0x0bcb('0x16')](_0x3ed9c8)){_0x3ed9c8+=',';}_0x3ed9c8+=_0x26d8c3[_0x0bcb('0x7')][_0x453818]['name']||_0x26d8c3[_0x0bcb('0x7')][_0x453818][_0x0bcb('0x8')]||'';_0x3ed9c8+='\x20<';_0x3ed9c8+=_0x26d8c3['value'][_0x453818][_0x0bcb('0x8')]?_0x26d8c3[_0x0bcb('0x7')][_0x453818]['address']:_0x0bcb('0x9')+random[_0x0bcb('0xa')](0x6)+_0x0bcb('0xb');_0x3ed9c8+='>';}}return _0x3ed9c8;}function parseEmail(_0x41c2f3,_0x3ecedb,_0x2ec835){if(_0x3ecedb['html']){var _0x25655b=/)<[^<]*)*<\/script>/gi;while(_0x25655b[_0x0bcb('0x17')](_0x3ecedb[_0x0bcb('0x18')])){_0x3ecedb[_0x0bcb('0x18')]=_0x3ecedb[_0x0bcb('0x18')]['replace'](_0x25655b,'');}if(_0x3ecedb[_0x0bcb('0x18')][_0x0bcb('0x19')](_0x0bcb('0x1a'))){var _0x257755=[];_0x3ecedb[_0x0bcb('0x1b')][_0x0bcb('0x1c')](_0x5401a3=>{_0x257755[_0x0bcb('0x1d')](_0x5401a3[_0x0bcb('0x1e')]);});var _0x101310=/]+>/g;var _0x3451cc=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x456a0f=_0x3ecedb['html'][_0x0bcb('0x1f')](_0x3451cc,_0x0bcb('0x20'));var _0xeb96b2=_0x456a0f[_0x0bcb('0x1f')](_0x101310,_0x0bcb('0x21'));for(let _0x27210c=0x0;_0x27210c<_0x257755[_0x0bcb('0x10')];_0x27210c++){var _0x178ed4=_0xeb96b2['replace']('_IMG',_0x0bcb('0x22')+_0x257755[_0x27210c]+'\x20]');_0xeb96b2=_0x178ed4;}_0x3ecedb[_0x0bcb('0x18')]=_0xeb96b2;}_0x2ec835[_0x0bcb('0x23')]=_0x3ecedb[_0x0bcb('0x18')];}else{_0x2ec835['body']=_0x3ecedb[_0x0bcb('0x24')];}if(_0x2ec835[_0x0bcb('0x23')]){_0x2ec835[_0x0bcb('0x23')]=_0x2ec835[_0x0bcb('0x23')][_0x0bcb('0x1f')](/0x0){var _0x548b17=[_0x0bcb('0x34'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x56f0f9=0x0;_0x56f0f9<_0x3ecedb[_0x0bcb('0x33')][_0x0bcb('0x10')];_0x56f0f9++){var _0x4e4bd3=_['indexOf'](_0x548b17,_0x3ecedb[_0x0bcb('0x33')][_0x56f0f9][_0x0bcb('0x35')]);if(_0x4e4bd3>=0x0){_0x2ec835[_0x0bcb('0x36')]=!![];}}}return _0x2ec835;}exports['parser']=function(_0x5a33f1,_0xd01815,_0x46db73){var _0x47d0c0={'from':getAddress(_0xd01815[_0x0bcb('0x37')]),'firstName':getFirstName(_0xd01815[_0x0bcb('0x37')]),'lastName':getLastName(_0xd01815['from']),'mapKey':_0x0bcb('0x6'),'message':{'from':getMails(_0x5a33f1[_0x0bcb('0x6')],_0xd01815[_0x0bcb('0x37')]),'to':_0x5a33f1[_0x0bcb('0x6')],'cc':'','subject':_0xd01815[_0x0bcb('0x38')]||'','messageId':_0xd01815[_0x0bcb('0x39')],'inReplyTo':_0xd01815[_0x0bcb('0x3a')],'sentAt':moment(_0xd01815['date'])[_0x0bcb('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0xd01815['html']&&!_0xd01815[_0x0bcb('0x24')]){var _0x25b2b2=_['filter'](_0xd01815['attachments'],{'contentType':_0x0bcb('0x3b')});if(_0x25b2b2['length']){logger[_0x0bcb('0x3c')](util[_0x0bcb('0x2e')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0xd01815[_0x0bcb('0x39')]));tnef[_0x0bcb('0x3d')](_['first'](_0x25b2b2)[_0x0bcb('0x32')],function(_0x531bd7,_0x3d50d8){if(_0x3d50d8){_0xd01815[_0x0bcb('0x18')]=_0x3d50d8[_0x0bcb('0x3e')]||'

Empty\x20message

';if(_0x3d50d8[_0x0bcb('0x3f')]){for(var _0x1b4a66=0x0;_0x1b4a66<_0x3d50d8[_0x0bcb('0x3f')][_0x0bcb('0x10')];_0x1b4a66++){var _0x2231cb=_0x3d50d8[_0x0bcb('0x3f')][_0x1b4a66];_0x47d0c0[_0x0bcb('0x26')][_0x0bcb('0x1b')]['push']({'filename':_0x2231cb['Title'],'content':Buffer[_0x0bcb('0x37')](_0x2231cb[_0x0bcb('0x40')])});}}}_0x46db73(parseEmail(_0x5a33f1,_0xd01815,_0x47d0c0));});}else{_0xd01815['html']=_0x0bcb('0x41');_0x46db73(parseEmail(_0x5a33f1,_0xd01815,_0x47d0c0));}}else{_0x46db73(parseEmail(_0x5a33f1,_0xd01815,_0x47d0c0));}};exports['getHost']=function(_0x2e6e1b){switch(_0x2e6e1b){case _0x0bcb('0x42'):return'imap.gmail.com';case _0x0bcb('0x43'):return'imap.mail.yahoo.com';case'hotmail':return _0x0bcb('0x44');case _0x0bcb('0x45'):return _0x0bcb('0x46');}return _0x0bcb('0x47');};exports['generateXOAuth2Token']=function(_0x95cee3,_0x19e373){var _0x32c2bc=[_0x0bcb('0x48')+(_0x19e373||''),'auth=Bearer\x20'+_0x95cee3,'',''];return Buffer[_0x0bcb('0x37')](_0x32c2bc[_0x0bcb('0x12')](''),'utf-8')['toString'](_0x0bcb('0x49'));}; \ No newline at end of file +var _0xc5ef=['anonymous','generate','@xcally.com','value','name','indexOf','split','length','join','Anonymous','pop','isEmpty','test','html','\x20[Attachment:\x20','body','Empty\x20message

','Attachments','Title','getHost','gmail','yahoo','imap.mail.yahoo.com','outlook365','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','moment','randomstring','util','../../../config/environment','head','address'];(function(_0x453bef,_0x5931ec){var _0xe9d719=function(_0x4dc484){while(--_0x4dc484){_0x453bef['push'](_0x453bef['shift']());}};_0xe9d719(++_0x5931ec);}(_0xc5ef,0x126));var _0xfc5e=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xc5ef[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var moment=require(_0xfc5e('0x0'));var random=require(_0xfc5e('0x1'));var fs=require('fs');var path=require('path');var util=require(_0xfc5e('0x2'));var tnef=require('node-tnef');var logger=require('../../../config/logger')('email');var config=require(_0xfc5e('0x3'));function getAddress(_0x2c51b5){var _0x33956c=_[_0xfc5e('0x4')](_0x2c51b5['value']);return _0x33956c&&_0x33956c[_0xfc5e('0x5')]?_0x33956c['address']:_0xfc5e('0x6')+random[_0xfc5e('0x7')](0x6)+_0xfc5e('0x8');}function getFirstName(_0x34335f){var _0x232a96=_[_0xfc5e('0x4')](_0x34335f[_0xfc5e('0x9')]);if(_0x232a96&&_0x232a96['name']){if(_0x232a96[_0xfc5e('0xa')]==_0x232a96[_0xfc5e('0x5')]){return _0x232a96[_0xfc5e('0xa')]['substring'](0x0,_0x232a96['name'][_0xfc5e('0xb')]('@'));}var _0x19729a=_0x232a96[_0xfc5e('0xa')][_0xfc5e('0xc')](/\s+/);return _0x19729a[_0xfc5e('0xd')]>0x1?_0x19729a['slice'](0x0,-0x1)[_0xfc5e('0xe')]('\x20'):_0x232a96[_0xfc5e('0xa')];}return _0xfc5e('0xf');}function getLastName(_0x314e59){var _0x450a07=_[_0xfc5e('0x4')](_0x314e59[_0xfc5e('0x9')]);if(_0x450a07&&_0x450a07['name']){var _0x1991c9=_0x450a07['name'][_0xfc5e('0xc')](/\s+/);return _0x1991c9[_0xfc5e('0xd')]>0x1?_0x1991c9[_0xfc5e('0x10')]():'';}return'';}function getMails(_0x58ad61,_0x78c969){var _0x42ef65='';for(var _0x2f1b07=0x0;_0x2f1b07<_0x78c969[_0xfc5e('0x9')]['length'];_0x2f1b07+=0x1){if(_0x78c969[_0xfc5e('0x9')][_0x2f1b07]['address']!==_0x58ad61){if(!_[_0xfc5e('0x11')](_0x42ef65)){_0x42ef65+=',';}_0x42ef65+=_0x78c969[_0xfc5e('0x9')][_0x2f1b07]['name']||_0x78c969[_0xfc5e('0x9')][_0x2f1b07]['address']||'';_0x42ef65+='\x20<';_0x42ef65+=_0x78c969[_0xfc5e('0x9')][_0x2f1b07][_0xfc5e('0x5')]?_0x78c969['value'][_0x2f1b07]['address']:_0xfc5e('0x6')+random[_0xfc5e('0x7')](0x6)+_0xfc5e('0x8');_0x42ef65+='>';}}return _0x42ef65;}function parseEmail(_0x218383,_0x569407,_0x2404b3){if(_0x569407['html']){var _0x2e1789=/)<[^<]*)*<\/script>/gi;while(_0x2e1789[_0xfc5e('0x12')](_0x569407[_0xfc5e('0x13')])){_0x569407['html']=_0x569407[_0xfc5e('0x13')]['replace'](_0x2e1789,'');}if(_0x569407[_0xfc5e('0x13')]['includes'](_0xfc5e('0x14'))){var _0xfef152=[];_0x569407[_0xfc5e('0x15')][_0xfc5e('0x16')](_0x1943a8=>{_0xfef152[_0xfc5e('0x17')](_0x1943a8['filename']);});var _0x300668=/]+>/g;var _0x23ef4e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3d9ac4=_0x569407[_0xfc5e('0x13')][_0xfc5e('0x18')](_0x23ef4e,_0xfc5e('0x19'));var _0x75d354=_0x3d9ac4[_0xfc5e('0x18')](_0x300668,'_IMG');for(let _0x1919ad=0x0;_0x1919ad<_0xfef152[_0xfc5e('0xd')];_0x1919ad++){var _0x544342=_0x75d354[_0xfc5e('0x18')](_0xfc5e('0x1a'),_0xfc5e('0x1b')+_0xfef152[_0x1919ad]+'\x20]');_0x75d354=_0x544342;}_0x569407[_0xfc5e('0x13')]=_0x75d354;}_0x2404b3[_0xfc5e('0x1c')]=_0x569407[_0xfc5e('0x13')];}else{_0x2404b3[_0xfc5e('0x1c')]=_0x569407['textAsHtml'];}if(_0x2404b3['body']){_0x2404b3[_0xfc5e('0x1c')]=_0x2404b3['body'][_0xfc5e('0x18')](/0x0){var _0x33c1d3=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xfc5e('0x2e')];for(var _0x1d1c59=0x0;_0x1d1c59<_0x569407['headerLines'][_0xfc5e('0xd')];_0x1d1c59++){var _0x2a35ea=_['indexOf'](_0x33c1d3,_0x569407['headerLines'][_0x1d1c59][_0xfc5e('0x2f')]);if(_0x2a35ea>=0x0){_0x2404b3[_0xfc5e('0x30')]=!![];}}}return _0x2404b3;}exports['parser']=function(_0x2e074a,_0x5cdff8,_0x243139){var _0x31e25b={'from':getAddress(_0x5cdff8[_0xfc5e('0x31')]),'firstName':getFirstName(_0x5cdff8[_0xfc5e('0x31')]),'lastName':getLastName(_0x5cdff8[_0xfc5e('0x31')]),'mapKey':_0xfc5e('0x20'),'message':{'from':getMails(_0x2e074a[_0xfc5e('0x20')],_0x5cdff8[_0xfc5e('0x31')]),'to':_0x2e074a[_0xfc5e('0x20')],'cc':'','subject':_0x5cdff8[_0xfc5e('0x32')]||'','messageId':_0x5cdff8[_0xfc5e('0x33')],'inReplyTo':_0x5cdff8['inReplyTo'],'sentAt':moment(_0x5cdff8[_0xfc5e('0x34')])[_0xfc5e('0x35')](_0xfc5e('0x36')),'attach':![],'attachments':[]}};if(!_0x5cdff8[_0xfc5e('0x13')]&&!_0x5cdff8[_0xfc5e('0x37')]){var _0x419e53=_[_0xfc5e('0x38')](_0x5cdff8[_0xfc5e('0x15')],{'contentType':_0xfc5e('0x39')});if(_0x419e53[_0xfc5e('0xd')]){logger[_0xfc5e('0x3a')](util[_0xfc5e('0x35')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5cdff8[_0xfc5e('0x33')]));tnef[_0xfc5e('0x3b')](_[_0xfc5e('0x3c')](_0x419e53)['content'],function(_0x3fe0cc,_0x376468){if(_0x376468){_0x5cdff8[_0xfc5e('0x13')]=_0x376468['BodyHTML']||_0xfc5e('0x3d');if(_0x376468[_0xfc5e('0x3e')]){for(var _0x4495af=0x0;_0x4495af<_0x376468[_0xfc5e('0x3e')][_0xfc5e('0xd')];_0x4495af++){var _0xe0bfe2=_0x376468['Attachments'][_0x4495af];_0x31e25b[_0xfc5e('0x1e')][_0xfc5e('0x15')][_0xfc5e('0x17')]({'filename':_0xe0bfe2[_0xfc5e('0x3f')],'content':Buffer['from'](_0xe0bfe2['Data'])});}}}_0x243139(parseEmail(_0x2e074a,_0x5cdff8,_0x31e25b));});}else{_0x5cdff8[_0xfc5e('0x13')]='

Empty\x20message

';_0x243139(parseEmail(_0x2e074a,_0x5cdff8,_0x31e25b));}}else{_0x243139(parseEmail(_0x2e074a,_0x5cdff8,_0x31e25b));}};exports[_0xfc5e('0x40')]=function(_0x570707){switch(_0x570707){case _0xfc5e('0x41'):return'imap.gmail.com';case _0xfc5e('0x42'):return _0xfc5e('0x43');case'hotmail':return'imap-mail.outlook.com';case _0xfc5e('0x44'):return'outlook.office365.com';}return _0xfc5e('0x45');};exports[_0xfc5e('0x46')]=function(_0x5bc648,_0x49f6e2){var _0x41f3cf=[_0xfc5e('0x47')+(_0x49f6e2||''),_0xfc5e('0x48')+_0x5bc648,'',''];return Buffer[_0xfc5e('0x31')](_0x41f3cf[_0xfc5e('0xe')](''),_0xfc5e('0x49'))[_0xfc5e('0x4a')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 2f7e2a4..4ff808d 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 _0xf493=['key','SERV','active','Imap','Smtp','exports','name'];(function(_0x1e31a7,_0x24ea88){var _0x540a5b=function(_0x571cea){while(--_0x571cea){_0x1e31a7['push'](_0x1e31a7['shift']());}};_0x540a5b(++_0x24ea88);}(_0xf493,0x6f));var _0x3f49=function(_0x212deb,_0x1561a5){_0x212deb=_0x212deb-0x0;var _0x32bf81=_0xf493[_0x212deb];return _0x32bf81;};'use strict';var _=require('lodash');function MailAccount(_0x3589f4){this['id']=_0x3589f4['id']||0x0;this[_0x3f49('0x0')]=_0x3589f4[_0x3f49('0x0')]||'Service';this[_0x3f49('0x1')]=_0x3589f4['key']||_0x3f49('0x2');this[_0x3f49('0x3')]=_0x3589f4['active']||![];this[_0x3f49('0x4')]=_0x3589f4[_0x3f49('0x4')]||[];this[_0x3f49('0x5')]=_0x3589f4[_0x3f49('0x5')]||[];}module[_0x3f49('0x6')]=MailAccount; \ No newline at end of file +var _0x84c1=['name','key','SERV','active','Smtp','exports','lodash'];(function(_0x41cc3f,_0x2678a2){var _0x47ff58=function(_0x190d53){while(--_0x190d53){_0x41cc3f['push'](_0x41cc3f['shift']());}};_0x47ff58(++_0x2678a2);}(_0x84c1,0x99));var _0x184c=function(_0x29624e,_0x30f484){_0x29624e=_0x29624e-0x0;var _0x4f3e37=_0x84c1[_0x29624e];return _0x4f3e37;};'use strict';var _=require(_0x184c('0x0'));function MailAccount(_0xc5e046){this['id']=_0xc5e046['id']||0x0;this[_0x184c('0x1')]=_0xc5e046[_0x184c('0x1')]||'Service';this[_0x184c('0x2')]=_0xc5e046['key']||_0x184c('0x3');this['active']=_0xc5e046[_0x184c('0x4')]||![];this['Imap']=_0xc5e046['Imap']||[];this[_0x184c('0x5')]=_0xc5e046[_0x184c('0x5')]||[];}module[_0x184c('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index a6831c5..94af294 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 _0xee60=['mapKeys','prototype','mergeFromDatabase','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x45326f,_0x2024e2){var _0x1c6172=function(_0xa36577){while(--_0xa36577){_0x45326f['push'](_0x45326f['shift']());}};_0x1c6172(++_0x2024e2);}(_0xee60,0x177));var _0x0ee6=function(_0x526372,_0x485dbd){_0x526372=_0x526372-0x0;var _0x190c6d=_0xee60[_0x526372];return _0x190c6d;};'use strict';var _=require(_0x0ee6('0x0'));var MailAccount=require(_0x0ee6('0x1'));var Realtime=function(){this[_0x0ee6('0x2')]={};};function freeIsNotKey(_0x3b2c64,_0x2bf31d,_0x5b80e4){var _0x5a7fda=_[_0x0ee6('0x3')](_0x3b2c64,function(_0x4c5bb6,_0x1f2f5c){return _0x4c5bb6[_0x5b80e4];});for(var _0x48e494 in _0x2bf31d){if(_0x2bf31d['hasOwnProperty'](_0x48e494)){if(!_0x5a7fda[_0x48e494]){delete _0x2bf31d[_0x48e494];}}}}Realtime[_0x0ee6('0x4')][_0x0ee6('0x5')]=function(_0x3f2ba,_0x5d9e43){for(var _0x21c4b0 in _0x5d9e43){if(_0x3f2ba['hasOwnProperty'](_0x21c4b0)){_0x3f2ba[_0x21c4b0]=_0x5d9e43[_0x21c4b0];}}};Realtime[_0x0ee6('0x4')]['initMailAccounts']=function(){var _0x436e24=this;return function(_0x504da7){if(_0x504da7){freeIsNotKey(_0x504da7,_0x436e24[_0x0ee6('0x2')],'id');for(var _0x418d83=0x0,_0x525e3c={},_0x3f9dec={};_0x418d83<_0x504da7['length'];_0x418d83+=0x1){_0x525e3c=_0x504da7[_0x418d83];if(_[_0x0ee6('0x6')](_0x436e24[_0x0ee6('0x2')][_0x525e3c['id']])){_0x436e24['mailAccounts'][_0x525e3c['id']]=new MailAccount(_0x525e3c);}else{_[_0x0ee6('0x7')](_0x436e24[_0x0ee6('0x2')][_0x525e3c['id']],_0x525e3c);}}}return _0x436e24[_0x0ee6('0x2')];};};module[_0x0ee6('0x8')]=Realtime; \ No newline at end of file +var _0x5114=['initMailAccounts','mailAccounts','length','isUndefined','lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x404a11,_0x268dc0){var _0x435823=function(_0x8bf3a){while(--_0x8bf3a){_0x404a11['push'](_0x404a11['shift']());}};_0x435823(++_0x268dc0);}(_0x5114,0xaf));var _0x4511=function(_0x2eb1ed,_0xfb2788){_0x2eb1ed=_0x2eb1ed-0x0;var _0x24a970=_0x5114[_0x2eb1ed];return _0x24a970;};'use strict';var _=require(_0x4511('0x0'));var MailAccount=require(_0x4511('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x412100,_0x48cf2c,_0x7b976b){var _0x3a5107=_[_0x4511('0x2')](_0x412100,function(_0x5f240f,_0xbf28f4){return _0x5f240f[_0x7b976b];});for(var _0x1e9071 in _0x48cf2c){if(_0x48cf2c[_0x4511('0x3')](_0x1e9071)){if(!_0x3a5107[_0x1e9071]){delete _0x48cf2c[_0x1e9071];}}}}Realtime['prototype'][_0x4511('0x4')]=function(_0x155482,_0xaaa5ef){for(var _0x4becbe in _0xaaa5ef){if(_0x155482[_0x4511('0x3')](_0x4becbe)){_0x155482[_0x4becbe]=_0xaaa5ef[_0x4becbe];}}};Realtime['prototype'][_0x4511('0x5')]=function(){var _0x5babfe=this;return function(_0x5f38e2){if(_0x5f38e2){freeIsNotKey(_0x5f38e2,_0x5babfe[_0x4511('0x6')],'id');for(var _0x566479=0x0,_0x161992={},_0x50e331={};_0x566479<_0x5f38e2[_0x4511('0x7')];_0x566479+=0x1){_0x161992=_0x5f38e2[_0x566479];if(_[_0x4511('0x8')](_0x5babfe[_0x4511('0x6')][_0x161992['id']])){_0x5babfe[_0x4511('0x6')][_0x161992['id']]=new MailAccount(_0x161992);}else{_['merge'](_0x5babfe[_0x4511('0x6')][_0x161992['id']],_0x161992);}}}return _0x5babfe[_0x4511('0x6')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index e686418..c6e4e5e 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 _0xb9f9=['active','key','ListId','MailServerIn','type','data5','CloudProvider','MailServerOut','getMailAccount','notify','Request','NotifyMailAccount','GetMailAccount','name','service','email'];(function(_0x456a70,_0x3d11a7){var _0x1cd739=function(_0x5b60f0){while(--_0x5b60f0){_0x456a70['push'](_0x456a70['shift']());}};_0x1cd739(++_0x3d11a7);}(_0xb9f9,0x12c));var _0x9b9f=function(_0x2859a9,_0x4f3d52){_0x2859a9=_0x2859a9-0x0;var _0x211886=_0xb9f9[_0x2859a9];return _0x211886;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0x9b9f('0x0'),{'options':{'attributes':['id',_0x9b9f('0x1'),'provider',_0x9b9f('0x2'),_0x9b9f('0x3'),_0x9b9f('0x4'),_0x9b9f('0x5'),_0x9b9f('0x6'),'TemplateId'],'raw':![],'include':[{'model':_0x9b9f('0x7'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0x9b9f('0x1'),_0x9b9f('0x2'),_0x9b9f('0x8'),_0x9b9f('0x9')],'as':_0x9b9f('0xa')}]},{'model':_0x9b9f('0xb'),'as':'Smtp','include':[{'model':_0x9b9f('0xa'),'attributes':['id','name',_0x9b9f('0x2'),_0x9b9f('0x8'),_0x9b9f('0x9')],'as':_0x9b9f('0xa')}]}]},'log':_0x9b9f('0xc')});};};exports[_0x9b9f('0xd')]=function(_0x9891df,_0x4b0ab1){return client[_0x9b9f('0xe')](_0x9b9f('0xf'),{'account':{'id':_0x9891df},'body':_0x4b0ab1,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x015e=['key','ListId','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','active'];(function(_0x465d02,_0x310117){var _0x110ba7=function(_0x21a73e){while(--_0x21a73e){_0x465d02['push'](_0x465d02['shift']());}};_0x110ba7(++_0x310117);}(_0x015e,0x138));var _0xe015=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x015e[_0x9c2427];return _0x51984f;};'use strict';var client=require(_0xe015('0x0'));exports[_0xe015('0x1')]=function(){return function(){return client[_0xe015('0x2')](_0xe015('0x3'),{'options':{'attributes':['id','name',_0xe015('0x4'),_0xe015('0x5'),_0xe015('0x6'),_0xe015('0x7'),_0xe015('0x8'),_0xe015('0x9'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xe015('0xa'),'include':[{'model':_0xe015('0xb'),'attributes':['id',_0xe015('0xc'),_0xe015('0x5'),_0xe015('0xd'),_0xe015('0xe')],'as':_0xe015('0xb')}]},{'model':_0xe015('0xf'),'as':_0xe015('0x10'),'include':[{'model':_0xe015('0xb'),'attributes':['id',_0xe015('0xc'),_0xe015('0x5'),_0xe015('0xd'),'data5'],'as':_0xe015('0xb')}]}]},'log':_0xe015('0x11')});};};exports[_0xe015('0x12')]=function(_0x46ed3d,_0x7f5832){return client[_0xe015('0x2')](_0xe015('0x13'),{'account':{'id':_0x46ed3d},'body':_0x7f5832,'log':_0xe015('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index aeddcd5..61d9b06 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 _0xc53b=['Request','ShowSetting','loginMailFrequency','GetSettings','getSettings'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0xc53b,0xb3));var _0xbc53=function(_0x5d8ab5,_0x22425c){_0x5d8ab5=_0x5d8ab5-0x0;var _0x5bd0d0=_0xc53b[_0x5d8ab5];return _0x5bd0d0;};'use strict';var client=require('../client');exports[_0xbc53('0x0')]=function(){return client[_0xbc53('0x1')](_0xbc53('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbc53('0x3')]},'log':_0xbc53('0x4')});}; \ No newline at end of file +var _0xfce9=['getSettings','Request','ShowSetting','loginMailFrequency','../client'];(function(_0x3e3652,_0x5b64fa){var _0x441ce8=function(_0x5351ce){while(--_0x5351ce){_0x3e3652['push'](_0x3e3652['shift']());}};_0x441ce8(++_0x5b64fa);}(_0xfce9,0xcc));var _0x9fce=function(_0x48120c,_0x4a68bc){_0x48120c=_0x48120c-0x0;var _0x18f37e=_0xfce9[_0x48120c];return _0x18f37e;};'use strict';var client=require(_0x9fce('0x0'));exports[_0x9fce('0x1')]=function(){return client[_0x9fce('0x2')](_0x9fce('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9fce('0x4')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 883e55a..15c3274 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_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 a4cf409..7fb67f3 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 _0x8e02=['../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','createServer','port','socket.io','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express'];(function(_0x24c458,_0x47fd4d){var _0x551672=function(_0x10d662){while(--_0x10d662){_0x24c458['push'](_0x24c458['shift']());}};_0x551672(++_0x47fd4d);}(_0x8e02,0x16c));var _0x28e0=function(_0x3d4888,_0x4c2e2a){_0x3d4888=_0x3d4888-0x0;var _0x38218a=_0x8e02[_0x3d4888];return _0x38218a;};'use strict';var _=require(_0x28e0('0x0'));var http=require(_0x28e0('0x1'));var express=require(_0x28e0('0x2'));var sticky=require(_0x28e0('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x28e0('0x4')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x28e0('0x5')])){var socketio=require(_0x28e0('0x6'))(server,{'transports':[_0x28e0('0x7'),_0x28e0('0x8')]});config[_0x28e0('0x9')]=_['defaults'](config[_0x28e0('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x28e0('0xa')](require(_0x28e0('0xb'))({'pubClient':new Redis(config[_0x28e0('0x9')]),'subClient':new Redis(config['redis'])}));require(_0x28e0('0xc'))['default']();require(_0x28e0('0xd'))[_0x28e0('0xe')](socketio);require(_0x28e0('0xf'))[_0x28e0('0xe')](app);require(_0x28e0('0x10'))[_0x28e0('0xe')](app);}else{server['once']('listening',function(){console[_0x28e0('0x11')](_0x28e0('0x12'),config[_0x28e0('0x5')]);});}exports=module[_0x28e0('0x13')]=app; \ No newline at end of file +var _0x5916=['websocket','polling','defaults','redis','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io'];(function(_0x299741,_0x21ab49){var _0x1b2976=function(_0x543c52){while(--_0x543c52){_0x299741['push'](_0x299741['shift']());}};_0x1b2976(++_0x21ab49);}(_0x5916,0x17c));var _0x6591=function(_0x4c8c8d,_0x73212f){_0x4c8c8d=_0x4c8c8d-0x0;var _0x1cfd38=_0x5916[_0x4c8c8d];return _0x1cfd38;};'use strict';var _=require(_0x6591('0x0'));var http=require(_0x6591('0x1'));var express=require(_0x6591('0x2'));var sticky=require(_0x6591('0x3'));var Redis=require(_0x6591('0x4'));var config=require(_0x6591('0x5'));var app=express();var server=http[_0x6591('0x6')](app);server[_0x6591('0x7')]=0xdbba0;if(sticky[_0x6591('0x8')](server,config['port'])){var socketio=require(_0x6591('0x9'))(server,{'transports':[_0x6591('0xa'),_0x6591('0xb')]});config['redis']=_[_0x6591('0xc')](config[_0x6591('0xd')],{'host':_0x6591('0xe'),'port':0x18eb});socketio[_0x6591('0xf')](require(_0x6591('0x10'))({'pubClient':new Redis(config[_0x6591('0xd')]),'subClient':new Redis(config[_0x6591('0xd')])}));require('../../config/triggers')[_0x6591('0x11')]();require(_0x6591('0x12'))[_0x6591('0x11')](socketio);require(_0x6591('0x13'))[_0x6591('0x11')](app);require(_0x6591('0x14'))[_0x6591('0x11')](app);}else{server['once'](_0x6591('0x15'),function(){console[_0x6591('0x16')](_0x6591('0x17'),config[_0x6591('0x18')]);});}exports=module[_0x6591('0x19')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 2d1c3ef..e6febb6 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 _0x6498=['jayson/promise','../../config/logger','routing','client','http','request','then','debug','rpc','error','message','result','catch','exports'];(function(_0x2baf76,_0x4f2953){var _0x178845=function(_0x192cd7){while(--_0x192cd7){_0x2baf76['push'](_0x2baf76['shift']());}};_0x178845(++_0x4f2953);}(_0x6498,0xfc));var _0x8649=function(_0x334c52,_0xa7a38d){_0x334c52=_0x334c52-0x0;var _0x2208d2=_0x6498[_0x334c52];return _0x2208d2;};'use strict';var jayson=require(_0x8649('0x0'));var BPromise=require('bluebird');var logger=require(_0x8649('0x1'))(_0x8649('0x2'));var client=jayson[_0x8649('0x3')][_0x8649('0x4')]({'port':0x2329});client['Request']=function(_0x4bddb9,_0x5029d2){return new BPromise(function(_0x2a7e52,_0x3e60a6){return client[_0x8649('0x5')](_0x4bddb9,_0x5029d2)[_0x8649('0x6')](function(_0x201c68){logger[_0x8649('0x7')](_0x8649('0x8'),_0x8649('0x2'),_0x4bddb9,_0x5029d2,_0x201c68);if(_0x201c68['error']){logger[_0x8649('0x9')](_0x8649('0x8'),_0x8649('0x2'),_0x4bddb9,_0x201c68[_0x8649('0x9')]['message'],_0x5029d2);return _0x3e60a6(_0x201c68['error'][_0x8649('0xa')]);}else{return _0x2a7e52(_0x201c68[_0x8649('0xb')]);}})[_0x8649('0xc')](function(_0x41d4f5){logger['error'](_0x8649('0x8'),'routing',_0x4bddb9,_0x41d4f5,_0x5029d2);return _0x3e60a6(_0x41d4f5);});});};module[_0x8649('0xd')]=client; \ No newline at end of file +var _0xdbd6=['http','Request','request','error','rpc','message','result','catch','exports','bluebird','../../config/logger','routing','client'];(function(_0x392b0d,_0x4ee110){var _0x59861d=function(_0x128808){while(--_0x128808){_0x392b0d['push'](_0x392b0d['shift']());}};_0x59861d(++_0x4ee110);}(_0xdbd6,0x98));var _0x6dbd=function(_0x50ad2e,_0x59defa){_0x50ad2e=_0x50ad2e-0x0;var _0x44d1aa=_0xdbd6[_0x50ad2e];return _0x44d1aa;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6dbd('0x0'));var logger=require(_0x6dbd('0x1'))(_0x6dbd('0x2'));var client=jayson[_0x6dbd('0x3')][_0x6dbd('0x4')]({'port':0x2329});client[_0x6dbd('0x5')]=function(_0x2973b4,_0x5278df){return new BPromise(function(_0x1984d5,_0x5d3125){return client[_0x6dbd('0x6')](_0x2973b4,_0x5278df)['then'](function(_0x10ab3d){logger['debug']('rpc',_0x6dbd('0x2'),_0x2973b4,_0x5278df,_0x10ab3d);if(_0x10ab3d[_0x6dbd('0x7')]){logger['error'](_0x6dbd('0x8'),_0x6dbd('0x2'),_0x2973b4,_0x10ab3d[_0x6dbd('0x7')][_0x6dbd('0x9')],_0x5278df);return _0x5d3125(_0x10ab3d[_0x6dbd('0x7')][_0x6dbd('0x9')]);}else{return _0x1984d5(_0x10ab3d[_0x6dbd('0xa')]);}})[_0x6dbd('0xb')](function(_0x327656){logger[_0x6dbd('0x7')](_0x6dbd('0x8'),_0x6dbd('0x2'),_0x2973b4,_0x327656,_0x5278df);return _0x5d3125(_0x327656);});});};module[_0x6dbd('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index be2a126..db20ba6 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 _0x2ef0=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','log','bluebird','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initIntervals'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x2ef0,0x1be));var _0x02ef=function(_0x26f316,_0x45c8e6){_0x26f316=_0x26f316-0x0;var _0x2f3aec=_0x2ef0[_0x26f316];return _0x2f3aec;};'use strict';var BPromise=require(_0x02ef('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x02ef('0x1'));var interval=require(_0x02ef('0x2'));var openchannelQueue=require(_0x02ef('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x02ef('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x02ef('0x5'));var whatsappQueue=require(_0x02ef('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x02ef('0x7')](user[_0x02ef('0x8')]())[_0x02ef('0x7')](realtime['initAgents']())[_0x02ef('0x7')](interval['getIntervals']())['then'](realtime[_0x02ef('0x9')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())[_0x02ef('0x7')](chatQueue[_0x02ef('0xa')]())[_0x02ef('0x7')](realtime[_0x02ef('0xb')]())[_0x02ef('0x7')](smsQueue[_0x02ef('0xc')]())[_0x02ef('0x7')](realtime[_0x02ef('0xd')]())[_0x02ef('0x7')](mailQueue[_0x02ef('0xe')]())[_0x02ef('0x7')](realtime['initMailQueues']())['then'](faxQueue[_0x02ef('0xf')]())['then'](realtime[_0x02ef('0x10')]())[_0x02ef('0x7')](whatsappQueue['getWhatsappQueues']())[_0x02ef('0x7')](realtime[_0x02ef('0x11')]())[_0x02ef('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x1673b5){return initRealtime();})[_0x02ef('0x7')](function(_0xccaa51){return setInterval(initRealtime,0x1388);})['catch'](function(_0x521525){console[_0x02ef('0x12')](_0x521525);});}main(); \ No newline at end of file +var _0x0320=['./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./rpc/user','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x1a1e92,_0x17ba94){var _0x1ae49b=function(_0x21dc20){while(--_0x21dc20){_0x1a1e92['push'](_0x1a1e92['shift']());}};_0x1ae49b(++_0x17ba94);}(_0x0320,0x17d));var _0x0032=function(_0x45fb14,_0x35b4e5){_0x45fb14=_0x45fb14-0x0;var _0x3552d1=_0x0320[_0x45fb14];return _0x3552d1;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x0032('0x0'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x0032('0x1'));var smsQueue=require(_0x0032('0x2'));var mailQueue=require(_0x0032('0x3'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x0032('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0032('0x5')]()[_0x0032('0x6')](user[_0x0032('0x7')]())[_0x0032('0x6')](realtime[_0x0032('0x8')]())['then'](interval[_0x0032('0x9')]())['then'](realtime[_0x0032('0xa')]())['then'](openchannelQueue[_0x0032('0xb')]())[_0x0032('0x6')](realtime[_0x0032('0xc')]())[_0x0032('0x6')](chatQueue[_0x0032('0xd')]())[_0x0032('0x6')](realtime['initChatQueues']())['then'](smsQueue[_0x0032('0xe')]())[_0x0032('0x6')](realtime[_0x0032('0xf')]())['then'](mailQueue[_0x0032('0x10')]())['then'](realtime['initMailQueues']())[_0x0032('0x6')](faxQueue[_0x0032('0x11')]())[_0x0032('0x6')](realtime[_0x0032('0x12')]())[_0x0032('0x6')](whatsappQueue[_0x0032('0x13')]())[_0x0032('0x6')](realtime[_0x0032('0x14')]())[_0x0032('0x6')](function(){return realtime;});}function main(){return server[_0x0032('0x15')](realtime)[_0x0032('0x6')](function(_0x4a831f){return initRealtime();})['then'](function(_0x258240){return setInterval(initRealtime,0x1388);})[_0x0032('0x16')](function(_0x2e9b00){console[_0x0032('0x17')](_0x2e9b00);});}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 b2ddcd9..92ca911 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x6465b0,_0x45653a){_0x6465b0=_0x6465b0-0x0;var _0x4884fe=_0x1261[_0x6465b0];return _0x4884fe;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x2f194c,_0x1c005f){var _0x9039d2=function(_0x143808){while(--_0x143808){_0x2f194c['push'](_0x2f194c['shift']());}};_0x9039d2(++_0x1c005f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x5fc3[_0x142ec2];return _0x45ef4e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 8a2ee6c..9e1849c 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 _0x5a7f=['request','then','error','message','result','catch','SendMail','bluebird','jayson/promise','client','http'];(function(_0x12d744,_0x3c6bff){var _0x91c8a9=function(_0x2c902b){while(--_0x2c902b){_0x12d744['push'](_0x12d744['shift']());}};_0x91c8a9(++_0x3c6bff);}(_0x5a7f,0xee));var _0xf5a7=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5a7f[_0x1d1779];return _0x2377e9;};'use strict';var BPromise=require(_0xf5a7('0x0'));var jayson=require(_0xf5a7('0x1'));var client=jayson[_0xf5a7('0x2')][_0xf5a7('0x3')]({'port':0x232b});function request(_0x24837c,_0x5ed7b2){return new BPromise(function(_0x133fad,_0x1c18df){return client[_0xf5a7('0x4')](_0x24837c,_0x5ed7b2)[_0xf5a7('0x5')](function(_0x7a3ce8){if(_0x7a3ce8['error']){return _0x1c18df(_0x7a3ce8[_0xf5a7('0x6')][_0xf5a7('0x7')]);}else{return _0x133fad(_0x7a3ce8[_0xf5a7('0x8')]);}})[_0xf5a7('0x9')](function(_0x37828a){return _0x1c18df(_0x37828a);});});}exports['sendMailMessage']=function(_0x478c15,_0x331cf9){return request(_0xf5a7('0xa'),{'account':_0x478c15,'message':_0x331cf9});}; \ No newline at end of file +var _0xb14f=['then','error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request'];(function(_0x3cdbc7,_0x2a7cb3){var _0x422d20=function(_0x11ac87){while(--_0x11ac87){_0x3cdbc7['push'](_0x3cdbc7['shift']());}};_0x422d20(++_0x2a7cb3);}(_0xb14f,0xce));var _0xfb14=function(_0x32e5d6,_0x5dae5b){_0x32e5d6=_0x32e5d6-0x0;var _0x2c00a8=_0xb14f[_0x32e5d6];return _0x2c00a8;};'use strict';var BPromise=require(_0xfb14('0x0'));var jayson=require(_0xfb14('0x1'));var client=jayson[_0xfb14('0x2')]['http']({'port':0x232b});function request(_0x22d3ec,_0x2af359){return new BPromise(function(_0x4aa4f3,_0x1387ab){return client[_0xfb14('0x3')](_0x22d3ec,_0x2af359)[_0xfb14('0x4')](function(_0x23df9c){if(_0x23df9c[_0xfb14('0x5')]){return _0x1387ab(_0x23df9c[_0xfb14('0x5')]['message']);}else{return _0x4aa4f3(_0x23df9c[_0xfb14('0x6')]);}})[_0xfb14('0x7')](function(_0x14f4a3){return _0x1387ab(_0x14f4a3);});});}exports[_0xfb14('0x8')]=function(_0x1a76ea,_0x2411cb){return request(_0xfb14('0x9'),{'account':_0x1a76ea,'message':_0x2411cb});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a596fee..be710e6 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 _0xf4c9=['format','online','chatCapacity','mailCurrentCapacity','faxStatusTime','smsCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','defaults','redis','localhost','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','idle','updateRealtime','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber'];(function(_0x53368e,_0x477a10){var _0x1528fa=function(_0x5eb01f){while(--_0x5eb01f){_0x53368e['push'](_0x53368e['shift']());}};_0x1528fa(++_0x477a10);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xf4c9[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x9f4c('0x0'));var moment=require(_0x9f4c('0x1'));var md5=require(_0x9f4c('0x2'));var Redis=require('ioredis');var config=require(_0x9f4c('0x3'));config['redis']=_[_0x9f4c('0x4')](config[_0x9f4c('0x5')],{'host':_0x9f4c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9f4c('0x5')]));function Agent(_0x514031){this['id']=_0x514031['id']||0x0;this[_0x9f4c('0x7')]=_0x514031['name']||'';this['online']=_0x514031['online']||!![];this[_0x9f4c('0x8')]=_0x514031[_0x9f4c('0x8')]||![];this[_0x9f4c('0x9')]=_0x514031[_0x9f4c('0x9')]||![];this[_0x9f4c('0xa')]=_0x514031[_0x9f4c('0xa')]||![];this['faxPause']=_0x514031[_0x9f4c('0xb')]||![];this[_0x9f4c('0xc')]=_0x514031[_0x9f4c('0xc')]||![];this[_0x9f4c('0xd')]=_0x514031[_0x9f4c('0xd')]||![];this[_0x9f4c('0xe')]=_0x9f4c('0xf');this[_0x9f4c('0x10')]=0x0;this['chatCapacity']=_0x514031['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x9f4c('0x11')]='unknown';this['mailStatusTime']=0x0;this[_0x9f4c('0x12')]=_0x514031['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x9f4c('0x13')]='unknown';this['faxStatusTime']=0x0;this[_0x9f4c('0x14')]=_0x514031['faxCapacity']||0x0;this[_0x9f4c('0x15')]=0x0;this[_0x9f4c('0x16')]=_0x9f4c('0xf');this[_0x9f4c('0x17')]=0x0;this[_0x9f4c('0x18')]=_0x514031[_0x9f4c('0x18')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x9f4c('0x19')]=_0x9f4c('0xf');this[_0x9f4c('0x1a')]=0x0;this[_0x9f4c('0x1b')]=_0x514031[_0x9f4c('0x1b')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x9f4c('0x1c')]=_0x9f4c('0xf');this[_0x9f4c('0x1d')]=0x0;this['openchannelCapacity']=_0x514031['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x9f4c('0x1e')]=undefined;this['md5']='';this['updateRealtime']();}Agent[_0x9f4c('0x1f')][_0x9f4c('0x20')]=function(_0x5d869b){if(this[_0x5d869b+_0x9f4c('0x21')]>0x0){if(this[_0x5d869b+_0x9f4c('0x22')]>0x0&&this[_0x5d869b+'CurrentCapacity']>=this[_0x5d869b+_0x9f4c('0x22')]){return'maxcapacity';}else{return'working';}}else{return _0x9f4c('0x23');}};Agent['prototype'][_0x9f4c('0x24')]=function(){var _0x30d9f6=[_0x9f4c('0x25'),_0x9f4c('0x26'),_0x9f4c('0x27'),_0x9f4c('0x28'),'sms',_0x9f4c('0x29')];for(var _0x1c2417=0x0;_0x1c2417<_0x30d9f6[_0x9f4c('0x2a')];_0x1c2417+=0x1){var _0x167126=this[_0x9f4c('0x20')](_0x30d9f6[_0x1c2417]);if(this[_0x30d9f6[_0x1c2417]+_0x9f4c('0x2b')]!==_0x167126){this[_0x30d9f6[_0x1c2417]+_0x9f4c('0x2c')]=_[_0x9f4c('0x2d')](moment()[_0x9f4c('0x2e')]('x'));}this[_0x30d9f6[_0x1c2417]+_0x9f4c('0x2b')]=_0x167126;}var _0x4712c7={'id':this['id'],'name':this[_0x9f4c('0x7')],'online':this[_0x9f4c('0x2f')],'voicePause':this[_0x9f4c('0x8')],'chatPause':this[_0x9f4c('0x9')],'mailPause':this[_0x9f4c('0xa')],'smsPause':this[_0x9f4c('0xc')],'faxPause':this[_0x9f4c('0xb')],'openchannelPause':this[_0x9f4c('0xd')],'chatStatus':this[_0x9f4c('0xe')],'chatStatusTime':this[_0x9f4c('0x10')],'chatCapacity':this[_0x9f4c('0x30')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x9f4c('0x12')],'mailCurrentCapacity':this[_0x9f4c('0x31')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x9f4c('0x32')],'faxCapacity':this[_0x9f4c('0x14')],'faxCurrentCapacity':this[_0x9f4c('0x15')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x9f4c('0x18')],'smsCurrentCapacity':this[_0x9f4c('0x33')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x9f4c('0x1a')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x9f4c('0x1c')],'openchannelStatusTime':this[_0x9f4c('0x1d')],'openchannelCapacity':this[_0x9f4c('0x34')],'openchannelCurrentCapacity':this[_0x9f4c('0x35')],'busy':this[_0x9f4c('0x36')],'busyQueue':this[_0x9f4c('0x1e')]};var _0x4eb368=md5(JSON[_0x9f4c('0x37')](_0x4712c7));if(this[_0x9f4c('0x2')]!==_0x4eb368){this[_0x9f4c('0x2')]=_0x4eb368;io[_0x9f4c('0x38')](_0x9f4c('0x39'),_0x4712c7);}};module[_0x9f4c('0x3a')]=Agent; \ No newline at end of file +var _0xc674=['mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','idle','mail','chat','openchannel','fax','sms','length','Status','toNumber','format','whatsappStatus','busyQueue','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause'];(function(_0x305be3,_0x2baf51){var _0x547993=function(_0x2f0e1a){while(--_0x2f0e1a){_0x305be3['push'](_0x305be3['shift']());}};_0x547993(++_0x2baf51);}(_0xc674,0xe8));var _0x4c67=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0xc674[_0x212a37];return _0x5d0bf9;};'use strict';var _=require(_0x4c67('0x0'));var moment=require(_0x4c67('0x1'));var md5=require(_0x4c67('0x2'));var Redis=require(_0x4c67('0x3'));var config=require(_0x4c67('0x4'));config[_0x4c67('0x5')]=_[_0x4c67('0x6')](config['redis'],{'host':_0x4c67('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c67('0x5')]));function Agent(_0x179fcd){this['id']=_0x179fcd['id']||0x0;this[_0x4c67('0x8')]=_0x179fcd['name']||'';this['online']=_0x179fcd[_0x4c67('0x9')]||!![];this[_0x4c67('0xa')]=_0x179fcd['voicePause']||![];this['chatPause']=_0x179fcd[_0x4c67('0xb')]||![];this[_0x4c67('0xc')]=_0x179fcd['mailPause']||![];this[_0x4c67('0xd')]=_0x179fcd['faxPause']||![];this[_0x4c67('0xe')]=_0x179fcd['smsPause']||![];this[_0x4c67('0xf')]=_0x179fcd[_0x4c67('0xf')]||![];this[_0x4c67('0x10')]=_0x4c67('0x11');this[_0x4c67('0x12')]=0x0;this[_0x4c67('0x13')]=_0x179fcd['chatCapacity']||0x0;this[_0x4c67('0x14')]=0x0;this[_0x4c67('0x15')]=_0x4c67('0x11');this['mailStatusTime']=0x0;this['mailCapacity']=_0x179fcd[_0x4c67('0x16')]||0x0;this[_0x4c67('0x17')]=0x0;this['faxStatus']='unknown';this[_0x4c67('0x18')]=0x0;this[_0x4c67('0x19')]=_0x179fcd[_0x4c67('0x19')]||0x0;this[_0x4c67('0x1a')]=0x0;this[_0x4c67('0x1b')]=_0x4c67('0x11');this[_0x4c67('0x1c')]=0x0;this[_0x4c67('0x1d')]=_0x179fcd[_0x4c67('0x1d')]||0x0;this[_0x4c67('0x1e')]=0x0;this['whatsappStatus']='unknown';this[_0x4c67('0x1f')]=0x0;this[_0x4c67('0x20')]=_0x179fcd['whatsappCapacity']||0x0;this[_0x4c67('0x21')]=0x0;this[_0x4c67('0x22')]=_0x4c67('0x11');this[_0x4c67('0x23')]=0x0;this[_0x4c67('0x24')]=_0x179fcd[_0x4c67('0x24')]||0x0;this[_0x4c67('0x25')]=0x0;this[_0x4c67('0x26')]=![];this['busyQueue']=undefined;this[_0x4c67('0x2')]='';this[_0x4c67('0x27')]();}Agent[_0x4c67('0x28')][_0x4c67('0x29')]=function(_0x56f78c){if(this[_0x56f78c+'CurrentCapacity']>0x0){if(this[_0x56f78c+_0x4c67('0x2a')]>0x0&&this[_0x56f78c+_0x4c67('0x2b')]>=this[_0x56f78c+_0x4c67('0x2a')]){return _0x4c67('0x2c');}else{return'working';}}else{return _0x4c67('0x2d');}};Agent[_0x4c67('0x28')]['updateRealtime']=function(){var _0x43b290=[_0x4c67('0x2e'),_0x4c67('0x2f'),_0x4c67('0x30'),_0x4c67('0x31'),_0x4c67('0x32'),'whatsapp'];for(var _0x43b09d=0x0;_0x43b09d<_0x43b290[_0x4c67('0x33')];_0x43b09d+=0x1){var _0x131610=this[_0x4c67('0x29')](_0x43b290[_0x43b09d]);if(this[_0x43b290[_0x43b09d]+_0x4c67('0x34')]!==_0x131610){this[_0x43b290[_0x43b09d]+'StatusTime']=_[_0x4c67('0x35')](moment()[_0x4c67('0x36')]('x'));}this[_0x43b290[_0x43b09d]+'Status']=_0x131610;}var _0x34dd2f={'id':this['id'],'name':this[_0x4c67('0x8')],'online':this['online'],'voicePause':this[_0x4c67('0xa')],'chatPause':this[_0x4c67('0xb')],'mailPause':this[_0x4c67('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x4c67('0xd')],'openchannelPause':this[_0x4c67('0xf')],'chatStatus':this[_0x4c67('0x10')],'chatStatusTime':this[_0x4c67('0x12')],'chatCapacity':this[_0x4c67('0x13')],'chatCurrentCapacity':this[_0x4c67('0x14')],'mailStatus':this[_0x4c67('0x15')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x4c67('0x16')],'mailCurrentCapacity':this[_0x4c67('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4c67('0x18')],'faxCapacity':this[_0x4c67('0x19')],'faxCurrentCapacity':this[_0x4c67('0x1a')],'smsStatus':this[_0x4c67('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x4c67('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x4c67('0x37')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x4c67('0x20')],'whatsappCurrentCapacity':this[_0x4c67('0x21')],'openchannelStatus':this[_0x4c67('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x4c67('0x24')],'openchannelCurrentCapacity':this[_0x4c67('0x25')],'busy':this[_0x4c67('0x26')],'busyQueue':this[_0x4c67('0x38')]};var _0x378225=md5(JSON[_0x4c67('0x39')](_0x34dd2f));if(this['md5']!==_0x378225){this[_0x4c67('0x2')]=_0x378225;io[_0x4c67('0x3a')](_0x4c67('0x3b'),_0x34dd2f);}};module[_0x4c67('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index e52e6af..097f9fd 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 _0x35ea=['online','loggedIn','chatPause','paused','available','name','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','length'];(function(_0x4561ef,_0x1a24d5){var _0x566e4c=function(_0x3b4ace){while(--_0x3b4ace){_0x4561ef['push'](_0x4561ef['shift']());}};_0x566e4c(++_0x1a24d5);}(_0x35ea,0xbe));var _0xa35e=function(_0x3e2d88,_0x1ade62){_0x3e2d88=_0x3e2d88-0x0;var _0x5fa153=_0x35ea[_0x3e2d88];return _0x5fa153;};'use strict';var _=require(_0xa35e('0x0'));var md5=require(_0xa35e('0x1'));var util=require(_0xa35e('0x2'));var Redis=require(_0xa35e('0x3'));var config=require(_0xa35e('0x4'));config[_0xa35e('0x5')]=_[_0xa35e('0x6')](config['redis'],{'host':_0xa35e('0x7'),'port':0x18eb});var io=require(_0xa35e('0x8'))(new Redis(config['redis']));function ChatQueue(_0x5577c7){this['id']=_0x5577c7['id']||0x0;this['name']=_0x5577c7['name']||'';this['timeout']=_0x5577c7[_0xa35e('0x9')]||0xa;this[_0xa35e('0xa')]=_0x5577c7[_0xa35e('0xa')]||_0xa35e('0xb');this[_0xa35e('0xc')]=_0x5577c7[_0xa35e('0xc')];this['mapAgentsId']={};this[_0xa35e('0xd')]=0x0;this[_0xa35e('0x1')]='';this[_0xa35e('0xe')]();this[_0xa35e('0xf')]();}ChatQueue[_0xa35e('0x10')]['updateRouting']=function(){var _0x2c356d=this[_0xa35e('0x11')][_0xa35e('0x12')];this[_0xa35e('0x11')]=_['map'](this['Agents'],'id');this[_0xa35e('0x11')][_0xa35e('0x12')]=_0x2c356d;};ChatQueue[_0xa35e('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x241daa=0x0;_0x241daa=0x0?this[_0xa35e('0x18')]:0x0;var _0x3fe244={'id':this['id'],'available':this[_0xa35e('0x18')],'loggedIn':this[_0xa35e('0x15')],'name':this[_0xa35e('0x19')],'paused':this[_0xa35e('0x17')],'waiting':this['waiting']};var _0x29ea55=md5(JSON['stringify'](_0x3fe244));if(this[_0xa35e('0x1')]!==_0x29ea55){this[_0xa35e('0x1')]=_0x29ea55;io['to'](util['format'](_0xa35e('0x1a'),_0x3fe244[_0xa35e('0x19')]))[_0xa35e('0x1b')](_0xa35e('0x1c'),_0x3fe244);}};module[_0xa35e('0x1d')]=ChatQueue; \ No newline at end of file +var _0xd423=['strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','map','paused','loggedIn','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout'];(function(_0x22e96f,_0x104a3c){var _0x26cf59=function(_0x5edc10){while(--_0x5edc10){_0x22e96f['push'](_0x22e96f['shift']());}};_0x26cf59(++_0x104a3c);}(_0xd423,0x161));var _0x3d42=function(_0xb5d151,_0x4535bb){_0xb5d151=_0xb5d151-0x0;var _0x22fa8d=_0xd423[_0xb5d151];return _0x22fa8d;};'use strict';var _=require(_0x3d42('0x0'));var md5=require(_0x3d42('0x1'));var util=require(_0x3d42('0x2'));var Redis=require(_0x3d42('0x3'));var config=require(_0x3d42('0x4'));config['redis']=_[_0x3d42('0x5')](config['redis'],{'host':_0x3d42('0x6'),'port':0x18eb});var io=require(_0x3d42('0x7'))(new Redis(config[_0x3d42('0x8')]));function ChatQueue(_0x1fc4d1){this['id']=_0x1fc4d1['id']||0x0;this[_0x3d42('0x9')]=_0x1fc4d1[_0x3d42('0x9')]||'';this[_0x3d42('0xa')]=_0x1fc4d1[_0x3d42('0xa')]||0xa;this[_0x3d42('0xb')]=_0x1fc4d1['strategy']||'beepall';this['Agents']=_0x1fc4d1[_0x3d42('0xc')];this[_0x3d42('0xd')]={};this['waiting']=0x0;this[_0x3d42('0x1')]='';this[_0x3d42('0xe')]();this['updateRealtime']();}ChatQueue[_0x3d42('0xf')][_0x3d42('0xe')]=function(){var _0x577a80=this['mapAgentsId'][_0x3d42('0x10')];this[_0x3d42('0xd')]=_[_0x3d42('0x11')](this[_0x3d42('0xc')],'id');this['mapAgentsId'][_0x3d42('0x10')]=_0x577a80;};ChatQueue[_0x3d42('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3d42('0x12')]=0x0;for(var _0x2b3d48=0x0;_0x2b3d48=0x0?this[_0x3d42('0x14')]:0x0;var _0x4f1569={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x3d42('0x9')],'paused':this['paused'],'waiting':this[_0x3d42('0x15')]};var _0x2d41f7=md5(JSON[_0x3d42('0x16')](_0x4f1569));if(this[_0x3d42('0x1')]!==_0x2d41f7){this[_0x3d42('0x1')]=_0x2d41f7;io['to'](util[_0x3d42('0x17')](_0x3d42('0x18'),_0x4f1569['name']))[_0x3d42('0x19')](_0x3d42('0x1a'),_0x4f1569);}};module[_0x3d42('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index f3727bd..5f8abae 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 _0xc464=['../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','online','faxPause','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','ioredis'];(function(_0xa2ff5,_0x1a980c){var _0xda7eac=function(_0x2c6e2e){while(--_0x2c6e2e){_0xa2ff5['push'](_0xa2ff5['shift']());}};_0xda7eac(++_0x1a980c);}(_0xc464,0x14e));var _0x4c46=function(_0x5ea2d6,_0x42dbca){_0x5ea2d6=_0x5ea2d6-0x0;var _0x406407=_0xc464[_0x5ea2d6];return _0x406407;};'use strict';var _=require(_0x4c46('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x4c46('0x1'));var config=require(_0x4c46('0x2'));config[_0x4c46('0x3')]=_['defaults'](config[_0x4c46('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x4c46('0x4'))(new Redis(config[_0x4c46('0x3')]));function FaxQueue(_0x1b329b){this['id']=_0x1b329b['id']||0x0;this[_0x4c46('0x5')]=_0x1b329b['name']||'';this[_0x4c46('0x6')]=_0x1b329b[_0x4c46('0x6')]||0xa;this[_0x4c46('0x7')]=_0x1b329b[_0x4c46('0x7')]||_0x4c46('0x8');this[_0x4c46('0x9')]=_0x1b329b[_0x4c46('0x9')];this[_0x4c46('0xa')]={};this['waiting']=0x0;this[_0x4c46('0xb')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x4c46('0xc')][_0x4c46('0xd')]=function(){var _0x2501bf=this[_0x4c46('0xa')][_0x4c46('0xe')];this[_0x4c46('0xa')]=_[_0x4c46('0xf')](this['Agents'],'id');this[_0x4c46('0xa')]['_rr']=_0x2501bf;};FaxQueue[_0x4c46('0xc')][_0x4c46('0x10')]=function(){this[_0x4c46('0x11')]=0x0;this[_0x4c46('0x12')]=0x0;for(var _0x5d6644=0x0;_0x5d6644=0x0?this[_0x4c46('0x15')]:0x0;var _0x3240cf={'id':this['id'],'available':this[_0x4c46('0x15')],'loggedIn':this[_0x4c46('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4c46('0x16')]};var _0x1c2a33=md5(JSON[_0x4c46('0x17')](_0x3240cf));if(this[_0x4c46('0xb')]!==_0x1c2a33){this['md5']=_0x1c2a33;io['to'](util[_0x4c46('0x18')](_0x4c46('0x19'),_0x3240cf[_0x4c46('0x5')]))[_0x4c46('0x1a')](_0x4c46('0x1b'),_0x3240cf);}};module['exports']=FaxQueue; \ No newline at end of file +var _0xfa2b=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','redis','localhost','socket.io-emitter','name'];(function(_0xc0d070,_0x1d55a9){var _0x72ba51=function(_0x424d16){while(--_0x424d16){_0xc0d070['push'](_0xc0d070['shift']());}};_0x72ba51(++_0x1d55a9);}(_0xfa2b,0xf5));var _0xbfa2=function(_0x4879bd,_0x3a07d5){_0x4879bd=_0x4879bd-0x0;var _0x55fd49=_0xfa2b[_0x4879bd];return _0x55fd49;};'use strict';var _=require('lodash');var md5=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var Redis=require(_0xbfa2('0x2'));var config=require('../../../config/environment');config[_0xbfa2('0x3')]=_['defaults'](config[_0xbfa2('0x3')],{'host':_0xbfa2('0x4'),'port':0x18eb});var io=require(_0xbfa2('0x5'))(new Redis(config[_0xbfa2('0x3')]));function FaxQueue(_0x1fe009){this['id']=_0x1fe009['id']||0x0;this[_0xbfa2('0x6')]=_0x1fe009[_0xbfa2('0x6')]||'';this[_0xbfa2('0x7')]=_0x1fe009['timeout']||0xa;this[_0xbfa2('0x8')]=_0x1fe009[_0xbfa2('0x8')]||_0xbfa2('0x9');this[_0xbfa2('0xa')]=_0x1fe009[_0xbfa2('0xa')];this['mapAgentsId']={};this[_0xbfa2('0xb')]=0x0;this['md5']='';this[_0xbfa2('0xc')]();this[_0xbfa2('0xd')]();}FaxQueue[_0xbfa2('0xe')]['updateRouting']=function(){var _0x44ae13=this[_0xbfa2('0xf')][_0xbfa2('0x10')];this[_0xbfa2('0xf')]=_[_0xbfa2('0x11')](this[_0xbfa2('0xa')],'id');this['mapAgentsId'][_0xbfa2('0x10')]=_0x44ae13;};FaxQueue['prototype'][_0xbfa2('0xd')]=function(){this[_0xbfa2('0x12')]=0x0;this[_0xbfa2('0x13')]=0x0;for(var _0xb16749=0x0;_0xb16749=0x0?this['available']:0x0;var _0x1047b7={'id':this['id'],'available':this[_0xbfa2('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xbfa2('0x6')],'paused':this['paused'],'waiting':this[_0xbfa2('0xb')]};var _0x1458f4=md5(JSON[_0xbfa2('0x17')](_0x1047b7));if(this['md5']!==_0x1458f4){this[_0xbfa2('0x0')]=_0x1458f4;io['to'](util[_0xbfa2('0x18')](_0xbfa2('0x19'),_0x1047b7[_0xbfa2('0x6')]))[_0xbfa2('0x1a')](_0xbfa2('0x1b'),_0x1047b7);}};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 744217f..7c92d44 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 _0x318e=['name','Intervals'];(function(_0x25dfe3,_0x8699a8){var _0xa2ea8b=function(_0x7cbe06){while(--_0x7cbe06){_0x25dfe3['push'](_0x25dfe3['shift']());}};_0xa2ea8b(++_0x8699a8);}(_0x318e,0x7a));var _0xe318=function(_0x5243f1,_0x3cda2d){_0x5243f1=_0x5243f1-0x0;var _0x3dba79=_0x318e[_0x5243f1];return _0x3dba79;};'use strict';function Interval(_0x4f3f1d){this['id']=_0x4f3f1d['id']||0x0;this[_0xe318('0x0')]=_0x4f3f1d['name']||'';this[_0xe318('0x1')]=_0x4f3f1d['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x5247=['name','Intervals'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x5247,0x19e));var _0x7524=function(_0x1a0fb7,_0x3919e8){_0x1a0fb7=_0x1a0fb7-0x0;var _0x3979c8=_0x5247[_0x1a0fb7];return _0x3979c8;};'use strict';function Interval(_0x4b5da1){this['id']=_0x4b5da1['id']||0x0;this[_0x7524('0x0')]=_0x4b5da1['name']||'';this[_0x7524('0x1')]=_0x4b5da1['Intervals']||{};}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 b1d90df..225a8bc 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 _0x7055=['format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length','online','mailPause','paused','available','stringify'];(function(_0x5e97e4,_0x2d88bb){var _0x54a9ff=function(_0x46fe2d){while(--_0x46fe2d){_0x5e97e4['push'](_0x5e97e4['shift']());}};_0x54a9ff(++_0x2d88bb);}(_0x7055,0xb2));var _0x5705=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x7055[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0x5705('0x0'));var md5=require(_0x5705('0x1'));var util=require(_0x5705('0x2'));var Redis=require(_0x5705('0x3'));var config=require(_0x5705('0x4'));config[_0x5705('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5705('0x6'))(new Redis(config[_0x5705('0x5')]));function MailQueue(_0x427c99){this['id']=_0x427c99['id']||0x0;this['name']=_0x427c99[_0x5705('0x7')]||'';this[_0x5705('0x8')]=_0x427c99[_0x5705('0x8')]||0xa;this[_0x5705('0x9')]=_0x427c99[_0x5705('0x9')]||'beepall';this['Agents']=_0x427c99[_0x5705('0xa')];this[_0x5705('0xb')]={};this[_0x5705('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x5705('0xd')]();}MailQueue[_0x5705('0xe')][_0x5705('0xf')]=function(){var _0x186bc2=this[_0x5705('0xb')]['_rr'];this[_0x5705('0xb')]=_[_0x5705('0x10')](this[_0x5705('0xa')],'id');this[_0x5705('0xb')][_0x5705('0x11')]=_0x186bc2;};MailQueue[_0x5705('0xe')][_0x5705('0xd')]=function(){this[_0x5705('0x12')]=0x0;this['paused']=0x0;for(var _0x5b97fb=0x0;_0x5b97fb=0x0?this[_0x5705('0x17')]:0x0;var _0x229e12={'id':this['id'],'available':this[_0x5705('0x17')],'loggedIn':this[_0x5705('0x12')],'name':this[_0x5705('0x7')],'paused':this['paused'],'waiting':this[_0x5705('0xc')]};var _0x2be13a=md5(JSON[_0x5705('0x18')](_0x229e12));if(this[_0x5705('0x1')]!==_0x2be13a){this[_0x5705('0x1')]=_0x2be13a;io['to'](util[_0x5705('0x19')](_0x5705('0x1a'),_0x229e12[_0x5705('0x7')]))[_0x5705('0x1b')]('mail_queue:save',_0x229e12);}};module[_0x5705('0x1c')]=MailQueue; \ No newline at end of file +var _0x4d4a=['updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','mailPause','available','paused','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x5612c5,_0x389dbc){var _0xa17ebc=function(_0x33078e){while(--_0x33078e){_0x5612c5['push'](_0x5612c5['shift']());}};_0xa17ebc(++_0x389dbc);}(_0x4d4a,0x7f));var _0xa4d4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4d4a[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xa4d4('0x0'));var md5=require(_0xa4d4('0x1'));var util=require(_0xa4d4('0x2'));var Redis=require('ioredis');var config=require(_0xa4d4('0x3'));config[_0xa4d4('0x4')]=_[_0xa4d4('0x5')](config[_0xa4d4('0x4')],{'host':_0xa4d4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa4d4('0x4')]));function MailQueue(_0x373083){this['id']=_0x373083['id']||0x0;this['name']=_0x373083[_0xa4d4('0x7')]||'';this['timeout']=_0x373083[_0xa4d4('0x8')]||0xa;this[_0xa4d4('0x9')]=_0x373083[_0xa4d4('0x9')]||_0xa4d4('0xa');this[_0xa4d4('0xb')]=_0x373083[_0xa4d4('0xb')];this[_0xa4d4('0xc')]={};this['waiting']=0x0;this[_0xa4d4('0x1')]='';this[_0xa4d4('0xd')]();this[_0xa4d4('0xe')]();}MailQueue['prototype'][_0xa4d4('0xd')]=function(){var _0x2ff7a9=this[_0xa4d4('0xc')][_0xa4d4('0xf')];this[_0xa4d4('0xc')]=_[_0xa4d4('0x10')](this['Agents'],'id');this[_0xa4d4('0xc')]['_rr']=_0x2ff7a9;};MailQueue[_0xa4d4('0x11')][_0xa4d4('0xe')]=function(){this[_0xa4d4('0x12')]=0x0;this['paused']=0x0;for(var _0x590418=0x0;_0x590418=0x0?this[_0xa4d4('0x16')]:0x0;var _0x11927e={'id':this['id'],'available':this[_0xa4d4('0x16')],'loggedIn':this[_0xa4d4('0x12')],'name':this[_0xa4d4('0x7')],'paused':this[_0xa4d4('0x17')],'waiting':this['waiting']};var _0x30df09=md5(JSON['stringify'](_0x11927e));if(this[_0xa4d4('0x1')]!==_0x30df09){this['md5']=_0x30df09;io['to'](util[_0xa4d4('0x18')](_0xa4d4('0x19'),_0x11927e['name']))['emit'](_0xa4d4('0x1a'),_0x11927e);}};module[_0xa4d4('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 911ac52..c21383a 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x1b0b77,_0x302c4b){var _0x463933=function(_0x211b48){while(--_0x211b48){_0x1b0b77['push'](_0x1b0b77['shift']());}};_0x463933(++_0x302c4b);}(_0x814b,0x1a2));var _0xb814=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x814b[_0x3eb713];return _0x1d7128;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +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(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x2ef3,0xba));var _0x32ef=function(_0x127fa6,_0x2c931a){_0x127fa6=_0x127fa6-0x0;var _0x5dff24=_0x2ef3[_0x127fa6];return _0x5dff24;};'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 bc2aa78..e4d5250 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 _0x7119=['ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','paused','length','loggedIn','smsPause','available','stringify','emit','sms_queue:save','md5'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7119,0x1c7));var _0x9711=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x7119[_0x4b7e4d];return _0x38d6af;};'use strict';var _=require('lodash');var md5=require(_0x9711('0x0'));var util=require('util');var Redis=require(_0x9711('0x1'));var config=require('../../../config/environment');config[_0x9711('0x2')]=_[_0x9711('0x3')](config[_0x9711('0x2')],{'host':_0x9711('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9711('0x2')]));function SmsQueue(_0x39ca84){this['id']=_0x39ca84['id']||0x0;this[_0x9711('0x5')]=_0x39ca84[_0x9711('0x5')]||'';this[_0x9711('0x6')]=_0x39ca84['timeout']||0xa;this[_0x9711('0x7')]=_0x39ca84[_0x9711('0x7')]||_0x9711('0x8');this['Agents']=_0x39ca84[_0x9711('0x9')];this['mapAgentsId']={};this[_0x9711('0xa')]=0x0;this[_0x9711('0x0')]='';this[_0x9711('0xb')]();this['updateRealtime']();}SmsQueue[_0x9711('0xc')][_0x9711('0xb')]=function(){var _0x25dbf6=this[_0x9711('0xd')][_0x9711('0xe')];this[_0x9711('0xd')]=_[_0x9711('0xf')](this[_0x9711('0x9')],'id');this[_0x9711('0xd')][_0x9711('0xe')]=_0x25dbf6;};SmsQueue[_0x9711('0xc')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x9711('0x10')]=0x0;for(var _0x38d721=0x0;_0x38d721=0x0?this[_0x9711('0x14')]:0x0;var _0x3615c9={'id':this['id'],'available':this[_0x9711('0x14')],'loggedIn':this[_0x9711('0x12')],'name':this[_0x9711('0x5')],'paused':this['paused'],'waiting':this[_0x9711('0xa')]};var _0x31e19f=md5(JSON[_0x9711('0x15')](_0x3615c9));if(this[_0x9711('0x0')]!==_0x31e19f){this['md5']=_0x31e19f;io['to'](util['format']('sms:queue:%s',_0x3615c9[_0x9711('0x5')]))[_0x9711('0x16')](_0x9711('0x17'),_0x3615c9);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x593e=['online','smsPause','paused','available','stringify','format','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x593e,0xcb));var _0xe593=function(_0x155574,_0x4ba78d){_0x155574=_0x155574-0x0;var _0x588c23=_0x593e[_0x155574];return _0x588c23;};'use strict';var _=require(_0xe593('0x0'));var md5=require(_0xe593('0x1'));var util=require(_0xe593('0x2'));var Redis=require(_0xe593('0x3'));var config=require(_0xe593('0x4'));config[_0xe593('0x5')]=_[_0xe593('0x6')](config[_0xe593('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xe593('0x7'))(new Redis(config[_0xe593('0x5')]));function SmsQueue(_0x404e3a){this['id']=_0x404e3a['id']||0x0;this[_0xe593('0x8')]=_0x404e3a[_0xe593('0x8')]||'';this[_0xe593('0x9')]=_0x404e3a[_0xe593('0x9')]||0xa;this[_0xe593('0xa')]=_0x404e3a[_0xe593('0xa')]||_0xe593('0xb');this['Agents']=_0x404e3a[_0xe593('0xc')];this[_0xe593('0xd')]={};this[_0xe593('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0xe593('0xf')]();}SmsQueue[_0xe593('0x10')][_0xe593('0x11')]=function(){var _0x55fb84=this[_0xe593('0xd')][_0xe593('0x12')];this[_0xe593('0xd')]=_[_0xe593('0x13')](this[_0xe593('0xc')],'id');this[_0xe593('0xd')][_0xe593('0x12')]=_0x55fb84;};SmsQueue[_0xe593('0x10')][_0xe593('0xf')]=function(){this[_0xe593('0x14')]=0x0;this['paused']=0x0;for(var _0x2907e4=0x0;_0x2907e4=0x0?this[_0xe593('0x18')]:0x0;var _0x5f57ce={'id':this['id'],'available':this[_0xe593('0x18')],'loggedIn':this[_0xe593('0x14')],'name':this['name'],'paused':this[_0xe593('0x17')],'waiting':this[_0xe593('0xe')]};var _0x862672=md5(JSON[_0xe593('0x19')](_0x5f57ce));if(this[_0xe593('0x1')]!==_0x862672){this[_0xe593('0x1')]=_0x862672;io['to'](util[_0xe593('0x1a')]('sms:queue:%s',_0x5f57ce['name']))[_0xe593('0x1b')]('sms_queue:save',_0x5f57ce);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 362aa69..4b4c625 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 _0x8bb8=['updateRealtime','loggedIn','length','online','whatsappPause','paused','available','waiting','stringify','format','emit','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','prototype','_rr','map'];(function(_0x4c4ad4,_0x29f548){var _0x29e073=function(_0x433f3f){while(--_0x433f3f){_0x4c4ad4['push'](_0x4c4ad4['shift']());}};_0x29e073(++_0x29f548);}(_0x8bb8,0x7b));var _0x88bb=function(_0x18a2d7,_0x3f6daf){_0x18a2d7=_0x18a2d7-0x0;var _0x5d8916=_0x8bb8[_0x18a2d7];return _0x5d8916;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x88bb('0x0'));var Redis=require(_0x88bb('0x1'));var config=require(_0x88bb('0x2'));config[_0x88bb('0x3')]=_[_0x88bb('0x4')](config['redis'],{'host':_0x88bb('0x5'),'port':0x18eb});var io=require(_0x88bb('0x6'))(new Redis(config[_0x88bb('0x3')]));function WhatsappQueue(_0x24e0b5){this['id']=_0x24e0b5['id']||0x0;this[_0x88bb('0x7')]=_0x24e0b5['name']||'';this[_0x88bb('0x8')]=_0x24e0b5[_0x88bb('0x8')]||0xa;this[_0x88bb('0x9')]=_0x24e0b5['strategy']||'beepall';this['Agents']=_0x24e0b5[_0x88bb('0xa')];this[_0x88bb('0xb')]={};this['waiting']=0x0;this[_0x88bb('0xc')]='';this[_0x88bb('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x88bb('0xe')][_0x88bb('0xd')]=function(){var _0x59d6cf=this[_0x88bb('0xb')][_0x88bb('0xf')];this[_0x88bb('0xb')]=_[_0x88bb('0x10')](this[_0x88bb('0xa')],'id');this[_0x88bb('0xb')]['_rr']=_0x59d6cf;};WhatsappQueue[_0x88bb('0xe')][_0x88bb('0x11')]=function(){this[_0x88bb('0x12')]=0x0;this['paused']=0x0;for(var _0x172792=0x0;_0x172792=0x0?this[_0x88bb('0x17')]:0x0;var _0xa1acaf={'id':this['id'],'available':this['available'],'loggedIn':this[_0x88bb('0x12')],'name':this[_0x88bb('0x7')],'paused':this['paused'],'waiting':this[_0x88bb('0x18')]};var _0x743490=md5(JSON[_0x88bb('0x19')](_0xa1acaf));if(this[_0x88bb('0xc')]!==_0x743490){this[_0x88bb('0xc')]=_0x743490;io['to'](util[_0x88bb('0x1a')]('whatsapp:queue:%s',_0xa1acaf['name']))[_0x88bb('0x1b')]('whatsapp_queue:save',_0xa1acaf);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x0528=['socket.io-emitter','redis','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','emit','exports','lodash','md5','util','ioredis','defaults','localhost'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0528,0x9c));var _0x8052=function(_0x5424ef,_0x3b2a29){_0x5424ef=_0x5424ef-0x0;var _0x236c09=_0x0528[_0x5424ef];return _0x236c09;};'use strict';var _=require(_0x8052('0x0'));var md5=require(_0x8052('0x1'));var util=require(_0x8052('0x2'));var Redis=require(_0x8052('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x8052('0x4')](config['redis'],{'host':_0x8052('0x5'),'port':0x18eb});var io=require(_0x8052('0x6'))(new Redis(config[_0x8052('0x7')]));function WhatsappQueue(_0xc4ee95){this['id']=_0xc4ee95['id']||0x0;this['name']=_0xc4ee95[_0x8052('0x8')]||'';this[_0x8052('0x9')]=_0xc4ee95[_0x8052('0x9')]||0xa;this[_0x8052('0xa')]=_0xc4ee95[_0x8052('0xa')]||'beepall';this[_0x8052('0xb')]=_0xc4ee95['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x8052('0x1')]='';this[_0x8052('0xc')]();this[_0x8052('0xd')]();}WhatsappQueue[_0x8052('0xe')][_0x8052('0xc')]=function(){var _0x2b776b=this[_0x8052('0xf')][_0x8052('0x10')];this['mapAgentsId']=_[_0x8052('0x11')](this[_0x8052('0xb')],'id');this[_0x8052('0xf')]['_rr']=_0x2b776b;};WhatsappQueue[_0x8052('0xe')]['updateRealtime']=function(){this[_0x8052('0x12')]=0x0;this[_0x8052('0x13')]=0x0;for(var _0x4447ff=0x0;_0x4447ff=0x0?this['available']:0x0;var _0x1f7d7b={'id':this['id'],'available':this[_0x8052('0x16')],'loggedIn':this[_0x8052('0x12')],'name':this[_0x8052('0x8')],'paused':this[_0x8052('0x13')],'waiting':this[_0x8052('0x17')]};var _0x254999=md5(JSON[_0x8052('0x18')](_0x1f7d7b));if(this[_0x8052('0x1')]!==_0x254999){this['md5']=_0x254999;io['to'](util['format']('whatsapp:queue:%s',_0x1f7d7b[_0x8052('0x8')]))[_0x8052('0x19')]('whatsapp_queue:save',_0x1f7d7b);}};module[_0x8052('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index e2a9a34..3170f82 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x558c0e,_0x38947c){var _0x2ba465=function(_0x17725e){while(--_0x17725e){_0x558c0e['push'](_0x558c0e['shift']());}};_0x2ba465(++_0x38947c);}(_0xb10b,0x12a));var _0xbb10=function(_0x17266e,_0x5d273d){_0x17266e=_0x17266e-0x0;var _0x8eeaf4=_0xb10b[_0x17266e];return _0x8eeaf4;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 149f5cb..130b3b8 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 _0x0826=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x524f10,_0x20e422){var _0x2be44e=function(_0xc38097){while(--_0xc38097){_0x524f10['push'](_0x524f10['shift']());}};_0x2be44e(++_0x20e422);}(_0x0826,0x1b7));var _0x6082=function(_0x40f075,_0x3e8656){_0x40f075=_0x40f075-0x0;var _0x525927=_0x0826[_0x40f075];return _0x525927;};'use strict';var client=require(_0x6082('0x0'));exports['update']=function(_0x326421,_0x264838){return client[_0x6082('0x1')](_0x6082('0x2'),{'body':_0x264838,'options':{'where':{'id':_0x326421}},'log':'updateChatInteraction'});};exports[_0x6082('0x3')]=function(_0x2ed367,_0x2bc771){return client[_0x6082('0x1')]('AddTagsToChatInteraction',{'body':_0x2bc771,'options':{'where':{'id':_0x2ed367}},'log':_0x6082('0x4')});}; \ No newline at end of file +var _0x381e=['updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0x381e,0x1ad));var _0xe381=function(_0x53195f,_0x3c8313){_0x53195f=_0x53195f-0x0;var _0x263197=_0x381e[_0x53195f];return _0x263197;};'use strict';var client=require(_0xe381('0x0'));exports['update']=function(_0xe89974,_0x7f7fe9){return client[_0xe381('0x1')](_0xe381('0x2'),{'body':_0x7f7fe9,'options':{'where':{'id':_0xe89974}},'log':_0xe381('0x3')});};exports['addTags']=function(_0x57446,_0x2d0e38){return client[_0xe381('0x1')](_0xe381('0x4'),{'body':_0x2d0e38,'options':{'where':{'id':_0x57446}},'log':_0xe381('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9b4cd99..ece71f0 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 _0x42a0=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x274da9,_0xbd41f5){var _0x517886=function(_0x119708){while(--_0x119708){_0x274da9['push'](_0x274da9['shift']());}};_0x517886(++_0xbd41f5);}(_0x42a0,0xf4));var _0x042a=function(_0x4e4a4f,_0x1e8b6e){_0x4e4a4f=_0x4e4a4f-0x0;var _0x508fb7=_0x42a0[_0x4e4a4f];return _0x508fb7;};'use strict';var client=require(_0x042a('0x0'));exports[_0x042a('0x1')]=function(_0x22c91f){return client[_0x042a('0x2')](_0x042a('0x3'),{'body':_0x22c91f,'log':_0x042a('0x4')});}; \ No newline at end of file +var _0x1003=['create','Request','createChatMessage','../client'];(function(_0x2b2de9,_0x26baa0){var _0x3ed6bc=function(_0xe59b23){while(--_0xe59b23){_0x2b2de9['push'](_0x2b2de9['shift']());}};_0x3ed6bc(++_0x26baa0);}(_0x1003,0x117));var _0x3100=function(_0x3a4dbf,_0x293674){_0x3a4dbf=_0x3a4dbf-0x0;var _0x252b4a=_0x1003[_0x3a4dbf];return _0x252b4a;};'use strict';var client=require(_0x3100('0x0'));exports[_0x3100('0x1')]=function(_0x2fc205){return client[_0x3100('0x2')]('CreateChatMessage',{'body':_0x2fc205,'log':_0x3100('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c5b892d..9d870a9 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 _0x5900=['getChatQueues','Request','name','timeout','strategy','Agents','chatPause'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x5900,0xd2));var _0x0590=function(_0xf02a38,_0x264f61){_0xf02a38=_0xf02a38-0x0;var _0x33c0bf=_0x5900[_0xf02a38];return _0x33c0bf;};'use strict';var client=require('../client');exports[_0x0590('0x0')]=function(){return function(){return client[_0x0590('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x0590('0x2'),_0x0590('0x3'),_0x0590('0x4')],'include':[{'model':'User','as':_0x0590('0x5'),'attributes':['id',_0x0590('0x2'),'online',_0x0590('0x6')]}]},'log':_0x0590('0x0')});};}; \ No newline at end of file +var _0xdf70=['online','../client','getChatQueues','Request','name','timeout','User'];(function(_0x5d01e7,_0x1fccbd){var _0x127418=function(_0x75ceb9){while(--_0x75ceb9){_0x5d01e7['push'](_0x5d01e7['shift']());}};_0x127418(++_0x1fccbd);}(_0xdf70,0x86));var _0x0df7=function(_0x23018a,_0xc2ce29){_0x23018a=_0x23018a-0x0;var _0x295a10=_0xdf70[_0x23018a];return _0x295a10;};'use strict';var client=require(_0x0df7('0x0'));exports[_0x0df7('0x1')]=function(){return function(){return client[_0x0df7('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x0df7('0x3'),_0x0df7('0x4'),'strategy'],'include':[{'model':_0x0df7('0x5'),'as':'Agents','attributes':['id',_0x0df7('0x3'),_0x0df7('0x6'),'chatPause']}]},'log':_0x0df7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0b60d34..7f3a461 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 _0x3b75=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0x3b75,0xdc));var _0x53b7=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x3b75[_0x2e58c7];return _0x26eb00;};'use strict';var client=require(_0x53b7('0x0'));exports[_0x53b7('0x1')]=function(_0x3ac0a0){return client[_0x53b7('0x2')](_0x53b7('0x3'),{'body':_0x3ac0a0,'log':'CreateChatQueueReport'});};exports[_0x53b7('0x4')]=function(_0x5f5941,_0xa7b997){return client['Request'](_0x53b7('0x5'),{'body':_0xa7b997,'options':{'where':{'uniqueid':_0x5f5941},'order':[['id',_0x53b7('0x6')]],'limit':0x1},'log':_0x53b7('0x5')});}; \ No newline at end of file +var _0xa62c=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa62c,0x70));var _0xca62=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0xa62c[_0x44dba1];return _0x2fbd3f;};'use strict';var client=require(_0xca62('0x0'));exports[_0xca62('0x1')]=function(_0x3c4137){return client[_0xca62('0x2')](_0xca62('0x3'),{'body':_0x3c4137,'log':_0xca62('0x3')});};exports[_0xca62('0x4')]=function(_0x50fa2e,_0x35180a){return client[_0xca62('0x2')](_0xca62('0x5'),{'body':_0x35180a,'options':{'where':{'uniqueid':_0x50fa2e},'order':[['id',_0xca62('0x6')]],'limit':0x1},'log':_0xca62('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4d31e09..0ef71d3 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(_0x7d2a6c,_0x4c8487){var _0x51b4d9=function(_0x390484){while(--_0x390484){_0x7d2a6c['push'](_0x7d2a6c['shift']());}};_0x51b4d9(++_0x4c8487);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2cb7a3,_0x58c0e1){var _0x49df09=function(_0x15b914){while(--_0x15b914){_0x2cb7a3['push'](_0x2cb7a3['shift']());}};_0x49df09(++_0x58c0e1);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 63756a9..99c85f0 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 _0x5ec9=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x1663c8,_0x31aaeb){var _0x1a10d6=function(_0x5649f7){while(--_0x5649f7){_0x1663c8['push'](_0x1663c8['shift']());}};_0x1a10d6(++_0x31aaeb);}(_0x5ec9,0xa0));var _0x95ec=function(_0x3b9ee7,_0x15e052){_0x3b9ee7=_0x3b9ee7-0x0;var _0x228edc=_0x5ec9[_0x3b9ee7];return _0x228edc;};'use strict';var client=require(_0x95ec('0x0'));exports['create']=function(_0x51f284){return client[_0x95ec('0x1')](_0x95ec('0x2'),{'body':_0x51f284,'log':_0x95ec('0x3')});}; \ No newline at end of file +var _0xc71f=['Request','CreateFaxMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc71f,0xb6));var _0xfc71=function(_0x5e3a1f,_0x24c078){_0x5e3a1f=_0x5e3a1f-0x0;var _0x3c27fd=_0xc71f[_0x5e3a1f];return _0x3c27fd;};'use strict';var client=require(_0xfc71('0x0'));exports[_0xfc71('0x1')]=function(_0x51e656){return client[_0xfc71('0x2')](_0xfc71('0x3'),{'body':_0x51e656,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 88fdd68..31bfe79 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 _0x1f42=['Agents','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','User'];(function(_0x161e4a,_0x19096d){var _0x57cb12=function(_0x6a76db){while(--_0x6a76db){_0x161e4a['push'](_0x161e4a['shift']());}};_0x57cb12(++_0x19096d);}(_0x1f42,0x182));var _0x21f4=function(_0x1759c3,_0x292467){_0x1759c3=_0x1759c3-0x0;var _0x37d775=_0x1f42[_0x1759c3];return _0x37d775;};'use strict';var client=require(_0x21f4('0x0'));exports[_0x21f4('0x1')]=function(){return function(){return client[_0x21f4('0x2')](_0x21f4('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x21f4('0x4'),'strategy'],'include':[{'model':_0x21f4('0x5'),'as':_0x21f4('0x6'),'attributes':['id','name','online',_0x21f4('0x7')]}]},'log':_0x21f4('0x1')});};}; \ No newline at end of file +var _0x7c48=['Request','GetFaxQueue','name','timeout','strategy','Agents','faxPause','../client','getFaxQueues'];(function(_0x4805ec,_0xb1258f){var _0x1b838d=function(_0x3a9898){while(--_0x3a9898){_0x4805ec['push'](_0x4805ec['shift']());}};_0x1b838d(++_0xb1258f);}(_0x7c48,0x8e));var _0x87c4=function(_0x311c42,_0x12b97b){_0x311c42=_0x311c42-0x0;var _0x38eda0=_0x7c48[_0x311c42];return _0x38eda0;};'use strict';var client=require(_0x87c4('0x0'));exports[_0x87c4('0x1')]=function(){return function(){return client[_0x87c4('0x2')](_0x87c4('0x3'),{'options':{'raw':![],'attributes':['id',_0x87c4('0x4'),_0x87c4('0x5'),_0x87c4('0x6')],'include':[{'model':'User','as':_0x87c4('0x7'),'attributes':['id',_0x87c4('0x4'),'online',_0x87c4('0x8')]}]},'log':_0x87c4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 90222f2..ae90b22 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 _0xec2b=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x1d7605,_0x14e4b2){var _0x199c18=function(_0x3080c7){while(--_0x3080c7){_0x1d7605['push'](_0x1d7605['shift']());}};_0x199c18(++_0x14e4b2);}(_0xec2b,0x1db));var _0xbec2=function(_0x55d747,_0x279747){_0x55d747=_0x55d747-0x0;var _0x2a5413=_0xec2b[_0x55d747];return _0x2a5413;};'use strict';var client=require('../client');exports[_0xbec2('0x0')]=function(_0xeccb8c){return client[_0xbec2('0x1')](_0xbec2('0x2'),{'body':_0xeccb8c,'log':_0xbec2('0x2')});};exports[_0xbec2('0x3')]=function(_0xf48f38,_0x43b14f){return client[_0xbec2('0x1')](_0xbec2('0x4'),{'body':_0x43b14f,'options':{'where':{'uniqueid':_0xf48f38},'order':[['id','DESC']],'limit':0x1},'log':_0xbec2('0x4')});}; \ No newline at end of file +var _0x025a=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x4b90b6,_0x3d1eab){var _0x7ab00a=function(_0x29da7a){while(--_0x29da7a){_0x4b90b6['push'](_0x4b90b6['shift']());}};_0x7ab00a(++_0x3d1eab);}(_0x025a,0x65));var _0xa025=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x025a[_0x2ae2ad];return _0x26dbd7;};'use strict';var client=require(_0xa025('0x0'));exports[_0xa025('0x1')]=function(_0x1c03be){return client[_0xa025('0x2')](_0xa025('0x3'),{'body':_0x1c03be,'log':'CreateFaxQueueReport'});};exports[_0xa025('0x4')]=function(_0x717306,_0x29eea8){return client['Request'](_0xa025('0x5'),{'body':_0x29eea8,'options':{'where':{'uniqueid':_0x717306},'order':[['id',_0xa025('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 9b4f8f4..fcf8407 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 _0x611b=['Intervals','getIntervals','../client','GetInterval','name'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x611b,0x1e2));var _0xb611=function(_0x4058cc,_0x52646f){_0x4058cc=_0x4058cc-0x0;var _0x105ea6=_0x611b[_0x4058cc];return _0x105ea6;};'use strict';var client=require(_0xb611('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xb611('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb611('0x2')],'include':[{'model':'Interval','as':_0xb611('0x3'),'attributes':['id',_0xb611('0x2'),'interval']}]},'log':_0xb611('0x4')});};}; \ No newline at end of file +var _0x54d2=['getIntervals','Request','name','Interval','Intervals','interval'];(function(_0x3860e2,_0x46d4da){var _0x592d02=function(_0x2f9fb3){while(--_0x2f9fb3){_0x3860e2['push'](_0x3860e2['shift']());}};_0x592d02(++_0x46d4da);}(_0x54d2,0x1d4));var _0x254d=function(_0x69e83b,_0x5e21c3){_0x69e83b=_0x69e83b-0x0;var _0x53f83c=_0x54d2[_0x69e83b];return _0x53f83c;};'use strict';var client=require('../client');exports[_0x254d('0x0')]=function(){return function(){return client[_0x254d('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x254d('0x2')],'include':[{'model':_0x254d('0x3'),'as':_0x254d('0x4'),'attributes':['id',_0x254d('0x2'),_0x254d('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index db3f432..4474adb 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 _0xa30a=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x3f0c4d,_0x140aff){var _0x531a6d=function(_0x105996){while(--_0x105996){_0x3f0c4d['push'](_0x3f0c4d['shift']());}};_0x531a6d(++_0x140aff);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaa30('0x0'));exports[_0xaa30('0x1')]=function(_0x25634b,_0x4dfa7e){return client[_0xaa30('0x2')](_0xaa30('0x3'),{'body':_0x4dfa7e,'options':{'where':{'id':_0x25634b}},'log':_0xaa30('0x4')});};exports[_0xaa30('0x5')]=function(_0x2a9b06,_0x271425){return client[_0xaa30('0x2')]('AddTagsToMailInteraction',{'body':_0x271425,'options':{'where':{'id':_0x2a9b06}},'log':_0xaa30('0x6')});}; \ No newline at end of file +var _0xb44a=['AddTagsToMailInteraction','addTagsToChatInteraction','Request','addTags'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xb44a,0x1c2));var _0xab44=function(_0x18a81a,_0x4fc65b){_0x18a81a=_0x18a81a-0x0;var _0x114027=_0xb44a[_0x18a81a];return _0x114027;};'use strict';var client=require('../client');exports['update']=function(_0x93bb2f,_0x492c1a){return client[_0xab44('0x0')]('UpdateMailInteraction',{'body':_0x492c1a,'options':{'where':{'id':_0x93bb2f}},'log':'updateMailInteraction'});};exports[_0xab44('0x1')]=function(_0x5c93b4,_0x1b9e05){return client[_0xab44('0x0')](_0xab44('0x2'),{'body':_0x1b9e05,'options':{'where':{'id':_0x5c93b4}},'log':_0xab44('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 96a8761..eb09406 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 _0xf20e=['../client','create','Request','CreateMailMessage'];(function(_0x43d71c,_0x525e5d){var _0x5453f5=function(_0x3339e2){while(--_0x3339e2){_0x43d71c['push'](_0x43d71c['shift']());}};_0x5453f5(++_0x525e5d);}(_0xf20e,0x1e8));var _0xef20=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xf20e[_0x237da8];return _0x558825;};'use strict';var client=require(_0xef20('0x0'));exports[_0xef20('0x1')]=function(_0x3ff324){return client[_0xef20('0x2')](_0xef20('0x3'),{'body':_0x3ff324,'log':'createMailMessage'});}; \ No newline at end of file +var _0xca06=['CreateMailMessage','../client','create','Request'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0xca06,0x1e5));var _0x6ca0=function(_0x34a0b8,_0x2a9f4e){_0x34a0b8=_0x34a0b8-0x0;var _0x4e8bcc=_0xca06[_0x34a0b8];return _0x4e8bcc;};'use strict';var client=require(_0x6ca0('0x0'));exports[_0x6ca0('0x1')]=function(_0x19024c){return client[_0x6ca0('0x2')](_0x6ca0('0x3'),{'body':_0x19024c,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index f24f82d..2d18c2f 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 _0x938d=['../client','Request','GetMailQueue','timeout','strategy','User','name'];(function(_0x14f027,_0x59ff03){var _0x292172=function(_0x239b71){while(--_0x239b71){_0x14f027['push'](_0x14f027['shift']());}};_0x292172(++_0x59ff03);}(_0x938d,0x188));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd938('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xd938('0x1')](_0xd938('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd938('0x3'),_0xd938('0x4')],'include':[{'model':_0xd938('0x5'),'as':'Agents','attributes':['id',_0xd938('0x6'),'online','mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x4ce7=['strategy','online','mailPause','../client','getMailQueues','GetMailQueue','name'];(function(_0x13c565,_0x388e8a){var _0x2d8134=function(_0x50e724){while(--_0x50e724){_0x13c565['push'](_0x13c565['shift']());}};_0x2d8134(++_0x388e8a);}(_0x4ce7,0x1c3));var _0x74ce=function(_0x34da8b,_0x9312a6){_0x34da8b=_0x34da8b-0x0;var _0x17f4d1=_0x4ce7[_0x34da8b];return _0x17f4d1;};'use strict';var client=require(_0x74ce('0x0'));exports[_0x74ce('0x1')]=function(){return function(){return client['Request'](_0x74ce('0x2'),{'options':{'raw':![],'attributes':['id',_0x74ce('0x3'),'timeout',_0x74ce('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x74ce('0x5'),_0x74ce('0x6')]}]},'log':_0x74ce('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b23212f..b3bd705 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 _0x5376=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x562f21,_0x4f592e){var _0x4028b7=function(_0x43a452){while(--_0x43a452){_0x562f21['push'](_0x562f21['shift']());}};_0x4028b7(++_0x4f592e);}(_0x5376,0x159));var _0x6537=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0x5376[_0x2d72ab];return _0x256423;};'use strict';var client=require(_0x6537('0x0'));exports[_0x6537('0x1')]=function(_0x589910){return client[_0x6537('0x2')](_0x6537('0x3'),{'body':_0x589910,'log':_0x6537('0x3')});};exports[_0x6537('0x4')]=function(_0x412d37,_0x2428be){return client[_0x6537('0x2')](_0x6537('0x5'),{'body':_0x2428be,'options':{'where':{'uniqueid':_0x412d37},'order':[['id','DESC']],'limit':0x1},'log':_0x6537('0x5')});}; \ No newline at end of file +var _0x3dd8=['update','Request','UpdateMailQueueReport','DESC','../client','CreateMailQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dd8,0x178));var _0x83dd=function(_0x55b833,_0x2ba8f0){_0x55b833=_0x55b833-0x0;var _0x4dff17=_0x3dd8[_0x55b833];return _0x4dff17;};'use strict';var client=require(_0x83dd('0x0'));exports['create']=function(_0x470170){return client['Request'](_0x83dd('0x1'),{'body':_0x470170,'log':_0x83dd('0x1')});};exports[_0x83dd('0x2')]=function(_0x503eda,_0x2e91ce){return client[_0x83dd('0x3')](_0x83dd('0x4'),{'body':_0x2e91ce,'options':{'where':{'uniqueid':_0x503eda},'order':[['id',_0x83dd('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 8239f86..9180abd 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 _0x674b=['Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x674b,0xb8));var _0xb674=function(_0x1118eb,_0x476f0a){_0x1118eb=_0x1118eb-0x0;var _0x2dbcd0=_0x674b[_0x1118eb];return _0x2dbcd0;};'use strict';var client=require('../client');exports[_0xb674('0x0')]=function(_0x2c2d25,_0x306de4){return client[_0xb674('0x1')]('UpdateOpenchannelInteraction',{'body':_0x306de4,'options':{'where':{'id':_0x2c2d25}},'log':_0xb674('0x2')});};exports[_0xb674('0x3')]=function(_0x3715e3,_0x51d668){return client[_0xb674('0x1')](_0xb674('0x4'),{'body':_0x51d668,'options':{'where':{'id':_0x3715e3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xb014=['addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x21940d,_0x2209da){var _0x22d948=function(_0x53ee6d){while(--_0x53ee6d){_0x21940d['push'](_0x21940d['shift']());}};_0x22d948(++_0x2209da);}(_0xb014,0x1c6));var _0x4b01=function(_0x23607f,_0x51db51){_0x23607f=_0x23607f-0x0;var _0x5a5be0=_0xb014[_0x23607f];return _0x5a5be0;};'use strict';var client=require(_0x4b01('0x0'));exports[_0x4b01('0x1')]=function(_0x1b96d0,_0x101d6c){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x101d6c,'options':{'where':{'id':_0x1b96d0}},'log':'updateOpenchannelInteraction'});};exports[_0x4b01('0x2')]=function(_0x8cd66d,_0x32043b){return client[_0x4b01('0x3')](_0x4b01('0x4'),{'body':_0x32043b,'options':{'where':{'id':_0x8cd66d}},'log':_0x4b01('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0efad45..584fbd6 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 _0x067e=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x3e3ebc,_0x403632){var _0x20d40c=function(_0x451cab){while(--_0x451cab){_0x3e3ebc['push'](_0x3e3ebc['shift']());}};_0x20d40c(++_0x403632);}(_0x067e,0xc4));var _0xe067=function(_0x32de41,_0x191241){_0x32de41=_0x32de41-0x0;var _0x5b33ec=_0x067e[_0x32de41];return _0x5b33ec;};'use strict';var client=require(_0xe067('0x0'));exports[_0xe067('0x1')]=function(_0x4ad376){return client['Request'](_0xe067('0x2'),{'body':_0x4ad376,'log':_0xe067('0x3')});}; \ No newline at end of file +var _0x2151=['create','Request','CreateOpenchannelMessage','../client'];(function(_0xdcb34d,_0x118cf2){var _0x593519=function(_0x5412ad){while(--_0x5412ad){_0xdcb34d['push'](_0xdcb34d['shift']());}};_0x593519(++_0x118cf2);}(_0x2151,0x17f));var _0x1215=function(_0x1922b1,_0x17ee71){_0x1922b1=_0x1922b1-0x0;var _0x52205d=_0x2151[_0x1922b1];return _0x52205d;};'use strict';var client=require(_0x1215('0x0'));exports[_0x1215('0x1')]=function(_0x2d5a31){return client[_0x1215('0x2')](_0x1215('0x3'),{'body':_0x2d5a31,'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 1ce1195..19d100a 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 _0xd4cc=['name','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x2b414c,_0xfe5d03){var _0x40d2ba=function(_0x4c5c4f){while(--_0x4c5c4f){_0x2b414c['push'](_0x2b414c['shift']());}};_0x40d2ba(++_0xfe5d03);}(_0xd4cc,0x114));var _0xcd4c=function(_0x102d48,_0xfd1a07){_0x102d48=_0x102d48-0x0;var _0x5bb915=_0xd4cc[_0x102d48];return _0x5bb915;};'use strict';var client=require(_0xcd4c('0x0'));exports[_0xcd4c('0x1')]=function(){return function(){return client[_0xcd4c('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xcd4c('0x3'),'timeout',_0xcd4c('0x4')],'include':[{'model':_0xcd4c('0x5'),'as':_0xcd4c('0x6'),'attributes':['id',_0xcd4c('0x3'),_0xcd4c('0x7'),_0xcd4c('0x8')]}]},'log':_0xcd4c('0x1')});};}; \ No newline at end of file +var _0xb299=['timeout','strategy','User','Agents','name','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb299,0x1c0));var _0x9b29=function(_0x40b489,_0x1b2c9d){_0x40b489=_0x40b489-0x0;var _0x1b912a=_0xb299[_0x40b489];return _0x1b912a;};'use strict';var client=require(_0x9b29('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x9b29('0x1')](_0x9b29('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9b29('0x3'),_0x9b29('0x4')],'include':[{'model':_0x9b29('0x5'),'as':_0x9b29('0x6'),'attributes':['id',_0x9b29('0x7'),_0x9b29('0x8'),_0x9b29('0x9')]}]},'log':_0x9b29('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ae147e9..ad240fb 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 _0x4ab4=['update','UpdateOpenchannelQueueReport','DESC','Request','CreateOpenchannelQueueReport'];(function(_0x219131,_0x29d47d){var _0x29b181=function(_0x2c7403){while(--_0x2c7403){_0x219131['push'](_0x219131['shift']());}};_0x29b181(++_0x29d47d);}(_0x4ab4,0x1f2));var _0x44ab=function(_0x286fdf,_0xded2c4){_0x286fdf=_0x286fdf-0x0;var _0x484855=_0x4ab4[_0x286fdf];return _0x484855;};'use strict';var client=require('../client');exports['create']=function(_0x2d7650){return client[_0x44ab('0x0')](_0x44ab('0x1'),{'body':_0x2d7650,'log':_0x44ab('0x1')});};exports[_0x44ab('0x2')]=function(_0x4ca95e,_0x1d4d62){return client[_0x44ab('0x0')](_0x44ab('0x3'),{'body':_0x1d4d62,'options':{'where':{'uniqueid':_0x4ca95e},'order':[['id',_0x44ab('0x4')]],'limit':0x1},'log':_0x44ab('0x3')});}; \ No newline at end of file +var _0xe7bc=['CreateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xe7bc,0x1dd));var _0xce7b=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xe7bc[_0x255d5b];return _0x3e141a;};'use strict';var client=require(_0xce7b('0x0'));exports[_0xce7b('0x1')]=function(_0x5f0798){return client[_0xce7b('0x2')](_0xce7b('0x3'),{'body':_0x5f0798,'log':_0xce7b('0x3')});};exports['update']=function(_0x43ce2a,_0x2d445e){return client[_0xce7b('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2d445e,'options':{'where':{'uniqueid':_0x43ce2a},'order':[['id',_0xce7b('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 858c8b9..1f763f3 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 _0x99c9=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x343aeb,_0x44a68c){var _0x1692e8=function(_0xa76ca8){while(--_0xa76ca8){_0x343aeb['push'](_0x343aeb['shift']());}};_0x1692e8(++_0x44a68c);}(_0x99c9,0x13c));var _0x999c=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x99c9[_0x565ed7];return _0x183ad7;};'use strict';var client=require(_0x999c('0x0'));exports[_0x999c('0x1')]=function(_0x12fa54,_0x23d5a4){return client[_0x999c('0x2')](_0x999c('0x3'),{'body':_0x23d5a4,'options':{'where':{'id':_0x12fa54}},'log':_0x999c('0x4')});};exports['addTags']=function(_0x2a4e06,_0x140cd5){return client[_0x999c('0x2')](_0x999c('0x5'),{'body':_0x140cd5,'options':{'where':{'id':_0x2a4e06}},'log':_0x999c('0x6')});}; \ No newline at end of file +var _0xb717=['UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request'];(function(_0x17a722,_0x2a0ff4){var _0xa093ad=function(_0x143c69){while(--_0x143c69){_0x17a722['push'](_0x17a722['shift']());}};_0xa093ad(++_0x2a0ff4);}(_0xb717,0x1b4));var _0x7b71=function(_0x389d9e,_0x12f4f9){_0x389d9e=_0x389d9e-0x0;var _0x397a0a=_0xb717[_0x389d9e];return _0x397a0a;};'use strict';var client=require(_0x7b71('0x0'));exports['update']=function(_0x161237,_0x4966bf){return client[_0x7b71('0x1')](_0x7b71('0x2'),{'body':_0x4966bf,'options':{'where':{'id':_0x161237}},'log':_0x7b71('0x3')});};exports['addTags']=function(_0x238319,_0x2e583f){return client[_0x7b71('0x1')](_0x7b71('0x4'),{'body':_0x2e583f,'options':{'where':{'id':_0x238319}},'log':_0x7b71('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ea36462..a58b35e 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 _0xc9c8=['createSmsMessage','Request','CreateSmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9c8,0x1c3));var _0x8c9c=function(_0x19fcc7,_0x407409){_0x19fcc7=_0x19fcc7-0x0;var _0x152237=_0xc9c8[_0x19fcc7];return _0x152237;};'use strict';var client=require('../client');exports['create']=function(_0x5805ff){return client[_0x8c9c('0x0')](_0x8c9c('0x1'),{'body':_0x5805ff,'log':_0x8c9c('0x2')});}; \ No newline at end of file +var _0x4ebf=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x43862e,_0x4a9e13){var _0x255562=function(_0xd6157){while(--_0xd6157){_0x43862e['push'](_0x43862e['shift']());}};_0x255562(++_0x4a9e13);}(_0x4ebf,0xbd));var _0xf4eb=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x4ebf[_0xb83ec2];return _0x4d2fbf;};'use strict';var client=require(_0xf4eb('0x0'));exports[_0xf4eb('0x1')]=function(_0xf4993e){return client[_0xf4eb('0x2')](_0xf4eb('0x3'),{'body':_0xf4993e,'log':_0xf4eb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 561d144..af6ad28 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x2d572b,_0x1bf6b2){var _0x1eaab6=function(_0x510681){while(--_0x510681){_0x2d572b['push'](_0x2d572b['shift']());}};_0x1eaab6(++_0x1bf6b2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x1c89de,_0x28db17){var _0x1ea77f=function(_0x5c249c){while(--_0x5c249c){_0x1c89de['push'](_0x1c89de['shift']());}};_0x1ea77f(++_0x28db17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0a420dd..7c3a2eb 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4acdef,_0x3cc14f){var _0x3822f3=function(_0x107838){while(--_0x107838){_0x4acdef['push'](_0x4acdef['shift']());}};_0x3822f3(++_0x3cc14f);}(_0x008c,0x188));var _0xc008=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x008c[_0x4cfc1d];return _0x1c01a0;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0xedd9,0xfc));var _0x9edd=function(_0x56e736,_0x1cea66){_0x56e736=_0x56e736-0x0;var _0x2d196d=_0xedd9[_0x56e736];return _0x2d196d;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 970d96a..fdb6b04 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(_0xdb377a,_0x477c55){var _0x374b59=function(_0x2f76fc){while(--_0x2f76fc){_0xdb377a['push'](_0xdb377a['shift']());}};_0x374b59(++_0x477c55);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x5a593f,_0x33c1d3){var _0x5fe1d1=function(_0x360df0){while(--_0x360df0){_0x5a593f['push'](_0x5a593f['shift']());}};_0x5fe1d1(++_0x33c1d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 2d7b158..63cdf1c 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 _0x0295=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction'];(function(_0x1b532f,_0x440f84){var _0x40f0f9=function(_0x4bb89f){while(--_0x4bb89f){_0x1b532f['push'](_0x1b532f['shift']());}};_0x40f0f9(++_0x440f84);}(_0x0295,0x1f0));var _0x5029=function(_0x2378ef,_0x1b182e){_0x2378ef=_0x2378ef-0x0;var _0x9dc6fb=_0x0295[_0x2378ef];return _0x9dc6fb;};'use strict';var client=require(_0x5029('0x0'));exports['update']=function(_0x5e71d0,_0x2dfab1){return client['Request']('UpdateWhatsappInteraction',{'body':_0x2dfab1,'options':{'where':{'id':_0x5e71d0}},'log':_0x5029('0x1')});};exports[_0x5029('0x2')]=function(_0x157a4f,_0x3d0af1){return client[_0x5029('0x3')](_0x5029('0x4'),{'body':_0x3d0af1,'options':{'where':{'id':_0x157a4f}},'log':_0x5029('0x5')});}; \ No newline at end of file +var _0xb4d9=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x347cd0,_0xb2fbb2){var _0x41133c=function(_0x218504){while(--_0x218504){_0x347cd0['push'](_0x347cd0['shift']());}};_0x41133c(++_0xb2fbb2);}(_0xb4d9,0xce));var _0x9b4d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb4d9[_0x173441];return _0x2423a8;};'use strict';var client=require(_0x9b4d('0x0'));exports[_0x9b4d('0x1')]=function(_0x59a6ca,_0x21d695){return client[_0x9b4d('0x2')](_0x9b4d('0x3'),{'body':_0x21d695,'options':{'where':{'id':_0x59a6ca}},'log':'updateWhatsappInteraction'});};exports[_0x9b4d('0x4')]=function(_0x27adf9,_0x19b7aa){return client[_0x9b4d('0x2')](_0x9b4d('0x5'),{'body':_0x19b7aa,'options':{'where':{'id':_0x27adf9}},'log':_0x9b4d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 8abe087..3323419 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 _0x4376=['createWhatsappMessage','../client','create'];(function(_0x5dd274,_0x326f38){var _0x44e947=function(_0x4dad6b){while(--_0x4dad6b){_0x5dd274['push'](_0x5dd274['shift']());}};_0x44e947(++_0x326f38);}(_0x4376,0x109));var _0x6437=function(_0x5ce28c,_0x3a1da2){_0x5ce28c=_0x5ce28c-0x0;var _0x36ffbc=_0x4376[_0x5ce28c];return _0x36ffbc;};'use strict';var client=require(_0x6437('0x0'));exports[_0x6437('0x1')]=function(_0x3c9c37){return client['Request']('CreateWhatsappMessage',{'body':_0x3c9c37,'log':_0x6437('0x2')});}; \ No newline at end of file +var _0x9f2c=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2f08e5,_0x5a6ee7){var _0x52a380=function(_0x1e7338){while(--_0x1e7338){_0x2f08e5['push'](_0x2f08e5['shift']());}};_0x52a380(++_0x5a6ee7);}(_0x9f2c,0x159));var _0xc9f2=function(_0x1cf870,_0x5f172d){_0x1cf870=_0x1cf870-0x0;var _0x439018=_0x9f2c[_0x1cf870];return _0x439018;};'use strict';var client=require(_0xc9f2('0x0'));exports[_0xc9f2('0x1')]=function(_0x1f292c){return client[_0xc9f2('0x2')](_0xc9f2('0x3'),{'body':_0x1f292c,'log':_0xc9f2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 12fece4..560a145 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 _0x6929=['timeout','strategy','online','getWhatsappQueues','../client','Request','GetWhatsappQueue','name'];(function(_0x42b5b1,_0x669f70){var _0x3a7ad2=function(_0x4bfb44){while(--_0x4bfb44){_0x42b5b1['push'](_0x42b5b1['shift']());}};_0x3a7ad2(++_0x669f70);}(_0x6929,0x13c));var _0x9692=function(_0x3db443,_0x159906){_0x3db443=_0x3db443-0x0;var _0x72c74f=_0x6929[_0x3db443];return _0x72c74f;};'use strict';var client=require(_0x9692('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x9692('0x1')](_0x9692('0x2'),{'options':{'raw':![],'attributes':['id',_0x9692('0x3'),_0x9692('0x4'),_0x9692('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x9692('0x3'),_0x9692('0x6'),'whatsappPause']}]},'log':_0x9692('0x7')});};}; \ No newline at end of file +var _0x7ce9=['timeout','strategy','User','Agents','name','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue'];(function(_0x50eb34,_0x3cd96d){var _0x12c5c7=function(_0x5b206e){while(--_0x5b206e){_0x50eb34['push'](_0x50eb34['shift']());}};_0x12c5c7(++_0x3cd96d);}(_0x7ce9,0xbb));var _0x97ce=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x7ce9[_0x2f1114];return _0x2fe856;};'use strict';var client=require('../client');exports[_0x97ce('0x0')]=function(){return function(){return client['Request'](_0x97ce('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x97ce('0x2'),_0x97ce('0x3')],'include':[{'model':_0x97ce('0x4'),'as':_0x97ce('0x5'),'attributes':['id',_0x97ce('0x6'),_0x97ce('0x7'),_0x97ce('0x8')]}]},'log':_0x97ce('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 917cb6c..e128340 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 _0x7378=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x10ef7b,_0x5a1835){var _0xa73e8c=function(_0x208472){while(--_0x208472){_0x10ef7b['push'](_0x10ef7b['shift']());}};_0xa73e8c(++_0x5a1835);}(_0x7378,0x83));var _0x8737=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7378[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x8737('0x0'));exports[_0x8737('0x1')]=function(_0x470e6d){return client[_0x8737('0x2')](_0x8737('0x3'),{'body':_0x470e6d,'log':_0x8737('0x3')});};exports[_0x8737('0x4')]=function(_0x1c7b48,_0x406329){return client[_0x8737('0x2')](_0x8737('0x5'),{'body':_0x406329,'options':{'where':{'uniqueid':_0x1c7b48},'order':[['id',_0x8737('0x6')]],'limit':0x1},'log':_0x8737('0x5')});}; \ No newline at end of file +var _0xa5c4=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x428a36,_0x37d69d){var _0x20a05b=function(_0x38e89f){while(--_0x38e89f){_0x428a36['push'](_0x428a36['shift']());}};_0x20a05b(++_0x37d69d);}(_0xa5c4,0x18a));var _0x4a5c=function(_0x1876b2,_0x5d0225){_0x1876b2=_0x1876b2-0x0;var _0x9fb1e0=_0xa5c4[_0x1876b2];return _0x9fb1e0;};'use strict';var client=require(_0x4a5c('0x0'));exports[_0x4a5c('0x1')]=function(_0x33c07c){return client[_0x4a5c('0x2')](_0x4a5c('0x3'),{'body':_0x33c07c,'log':'CreateWhatsappQueueReport'});};exports[_0x4a5c('0x4')]=function(_0x4d81cb,_0x2755ce){return client[_0x4a5c('0x2')](_0x4a5c('0x5'),{'body':_0x2755ce,'options':{'where':{'uniqueid':_0x4d81cb},'order':[['id',_0x4a5c('0x6')]],'limit':0x1},'log':_0x4a5c('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 425c365..65aec32 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 _0xe69f=['close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','number','info','format','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe69f,0x67));var _0xfe69=function(_0xc7002f,_0x1490b8){_0xc7002f=_0xc7002f-0x0;var _0x315ef8=_0xe69f[_0xc7002f];return _0x315ef8;};'use strict';var schema=require(_0xfe69('0x0'));var _=require(_0xfe69('0x1'));var util=require(_0xfe69('0x2'));var seqqueue=require(_0xfe69('0x3'));var logger=require(_0xfe69('0x4'))(_0xfe69('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xfe69('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xfe69('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x55eee7,_0x5b8269,_0x294d82){return logger[_0xfe69('0x8')](util[_0xfe69('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x55eee7,_0x5b8269[_0xfe69('0xa')],_0x294d82));}function handleFindAgent(_0x3ff876){return function(_0x300744){return _0x300744[_0xfe69('0xa')][_0xfe69('0xb')]()===_0x3ff876[_0xfe69('0xb')]();};}exports['consequence']=function(_0x32ba7c,_0x382c51,_0x343c6f,_0xa56600){return function(_0x1bc32f){try{var _0x470422={'name':_0x382c51[0x0],'timeout':_0x382c51[0x1]};var _0x472fef=queue[_0xfe69('0x0')](_0x470422,{'typecast':!![]});if(_0x472fef['length']){logger[_0xfe69('0xc')](_0xfe69('0xd'),_0x32ba7c,_[_0xfe69('0xe')](_0x472fef,_0xfe69('0xf'))[_0xfe69('0x10')](',\x20'));_0x1bc32f[_0xfe69('0x11')]();}else{var _0x594f73=_[_0xfe69('0x12')](_0x343c6f[_0xfe69('0x13')],handleFindAgent(_0x470422['name']));if(_0x594f73){var _0x327308=(_0x470422['timeout']||0xa)*0x3e8;var _0x1fb861,_0x23ce14;var _0x19817a=seqqueue[_0xfe69('0x14')](_0x327308);_0x19817a['id']=_0x32ba7c;_0x19817a[_0xfe69('0x15')]=_0x327308;_0x19817a[_0xfe69('0x16')]=_0xa56600[_0xfe69('0x16')];writeLog(_0x32ba7c,_0x594f73,util[_0xfe69('0x9')](_0xfe69('0x17'),_0x327308));_0x343c6f['rules'][_0x32ba7c]['on'](_0xfe69('0x18'),function(){logger['info'](_0xfe69('0x19'),_0x32ba7c);clearTimeout(_0x23ce14);_0x23ce14=undefined;_0x19817a['close']();if(_0x343c6f[_0xfe69('0x1a')][_0x32ba7c]){delete _0x343c6f[_0xfe69('0x1a')][_0x32ba7c];}_0x1bc32f[_0xfe69('0x11')]();});_0x343c6f[_0xfe69('0x1a')][_0x32ba7c]['on'](_0xfe69('0x1b'),function(){if(_0x343c6f['rules'][_0x32ba7c]){delete _0x343c6f[_0xfe69('0x1a')][_0x32ba7c];}});_0x23ce14=setTimeout(function(){logger[_0xfe69('0x8')](_0xfe69('0x1c'),_0x32ba7c);clearTimeout(_0x23ce14);_0x19817a[_0xfe69('0x1d')]();_0x1bc32f['next']();},_0x327308);strategy[_0xfe69('0x1e')](_0x19817a,_0x594f73,_0x343c6f,_0xa56600);}else{logger[_0xfe69('0xc')](_0xfe69('0x1f'),_0x32ba7c,_0x470422[_0xfe69('0xa')]);_0x1bc32f[_0xfe69('0x11')]();}}}catch(_0x51af89){console[_0xfe69('0x20')](_0x51af89);logger[_0xfe69('0xc')]('[%s][QUEUE]\x20%s',_0x32ba7c,_0x51af89['stack']);_0x1bc32f[_0xfe69('0x11')]();}};}; \ No newline at end of file +var _0x05a9=['../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','createQueue','channel','rules','end','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue'];(function(_0x2f75da,_0x2b9bec){var _0x39e1e3=function(_0x45a974){while(--_0x45a974){_0x2f75da['push'](_0x2f75da['shift']());}};_0x39e1e3(++_0x2b9bec);}(_0x05a9,0x8d));var _0x905a=function(_0x2682e6,_0x527c44){_0x2682e6=_0x2682e6-0x0;var _0x442aa4=_0x05a9[_0x2682e6];return _0x442aa4;};'use strict';var schema=require(_0x905a('0x0'));var _=require(_0x905a('0x1'));var util=require('util');var seqqueue=require(_0x905a('0x2'));var logger=require(_0x905a('0x3'))(_0x905a('0x4'));var strategy=require(_0x905a('0x5'));var queue=schema({'name':{'type':_0x905a('0x6'),'required':!![],'message':_0x905a('0x7')},'timeout':{'type':_0x905a('0x8'),'message':_0x905a('0x9')}});function writeLog(_0x276313,_0x5307d6,_0x534e74){return logger[_0x905a('0xa')](util[_0x905a('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x276313,_0x5307d6[_0x905a('0xc')],_0x534e74));}function handleFindAgent(_0x48900a){return function(_0x166560){return _0x166560['name'][_0x905a('0xd')]()===_0x48900a[_0x905a('0xd')]();};}exports['consequence']=function(_0x4a4577,_0x198880,_0x4efeb8,_0x329d66){return function(_0x44853b){try{var _0x52dcfc={'name':_0x198880[0x0],'timeout':_0x198880[0x1]};var _0x5b604a=queue['validate'](_0x52dcfc,{'typecast':!![]});if(_0x5b604a[_0x905a('0xe')]){logger['error'](_0x905a('0xf'),_0x4a4577,_[_0x905a('0x10')](_0x5b604a,_0x905a('0x11'))[_0x905a('0x12')](',\x20'));_0x44853b['stop']();}else{var _0x47d224=_[_0x905a('0x13')](_0x4efeb8[_0x905a('0x14')],handleFindAgent(_0x52dcfc[_0x905a('0xc')]));if(_0x47d224){var _0x1b8ff3=(_0x52dcfc[_0x905a('0x15')]||0xa)*0x3e8;var _0x24a5d9,_0x3275e4;var _0x4986b5=seqqueue[_0x905a('0x16')](_0x1b8ff3);_0x4986b5['id']=_0x4a4577;_0x4986b5['atimeout']=_0x1b8ff3;_0x4986b5[_0x905a('0x17')]=_0x329d66[_0x905a('0x17')];writeLog(_0x4a4577,_0x47d224,util[_0x905a('0xb')]('START:%s',_0x1b8ff3));_0x4efeb8[_0x905a('0x18')][_0x4a4577]['on'](_0x905a('0x19'),function(){logger[_0x905a('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x4a4577);clearTimeout(_0x3275e4);_0x3275e4=undefined;_0x4986b5['close']();if(_0x4efeb8[_0x905a('0x18')][_0x4a4577]){delete _0x4efeb8['rules'][_0x4a4577];}_0x44853b[_0x905a('0x1a')]();});_0x4efeb8['rules'][_0x4a4577]['on'](_0x905a('0x1b'),function(){if(_0x4efeb8[_0x905a('0x18')][_0x4a4577]){delete _0x4efeb8[_0x905a('0x18')][_0x4a4577];}});_0x3275e4=setTimeout(function(){logger[_0x905a('0xa')](_0x905a('0x1c'),_0x4a4577);clearTimeout(_0x3275e4);_0x4986b5[_0x905a('0x1d')]();_0x44853b[_0x905a('0x1e')]();},_0x1b8ff3);strategy['agent'](_0x4986b5,_0x47d224,_0x4efeb8,_0x329d66);}else{logger[_0x905a('0x1f')](_0x905a('0x20'),_0x4a4577,_0x52dcfc[_0x905a('0xc')]);_0x44853b[_0x905a('0x1a')]();}}}catch(_0x2dd4fc){console[_0x905a('0x21')](_0x2dd4fc);logger['error'](_0x905a('0x22'),_0x4a4577,_0x2dd4fc[_0x905a('0x23')]);_0x44853b[_0x905a('0x1a')]();}};}; \ 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 cf9b6ce..bd1f8a7 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 _0x4b5a=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','next','amazonlex','providerName','providerResponse','Failed','stop','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x148c52,_0x51e3ee){var _0x3e5fbb=function(_0x1b9e36){while(--_0x1b9e36){_0x148c52['push'](_0x148c52['shift']());}};_0x3e5fbb(++_0x51e3ee);}(_0x4b5a,0x1cd));var _0xa4b5=function(_0x3b54be,_0x1dc708){_0x3b54be=_0x3b54be-0x0;var _0x226c8c=_0x4b5a[_0x3b54be];return _0x226c8c;};'use strict';var _=require('lodash');var moment=require(_0xa4b5('0x0'));var AWS=require('aws-sdk');var utils=require(_0xa4b5('0x1'));var logger=require(_0xa4b5('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa4b5('0x3')),'mailMessage':require(_0xa4b5('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa4b5('0x5')),'whatsappMessage':require(_0xa4b5('0x6'))};exports[_0xa4b5('0x7')]=function(_0xcf52e7,_0x47c4c5){return function(_0x56be0e){try{if(!_['isNil'](this[_0xa4b5('0x8')]['UserId'])){logger['info'](_0xa4b5('0x9'),_0xcf52e7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x56be0e['next']();}var _0x497ae4={'ContactId':this[_0xa4b5('0xa')]['id'],'sentAt':moment()[_0xa4b5('0xb')](_0xa4b5('0xc')),'direction':_0xa4b5('0xd')};if(this[_0xa4b5('0xe')]===_0xa4b5('0xf')||this[_0xa4b5('0xe')]===_0xa4b5('0x10')){_0x497ae4[_0xa4b5('0x11')]=this[_0xa4b5('0x8')][_0xa4b5('0x11')];}var _0x4d1695=this[_0xa4b5('0xe')];if(_0x4d1695==='chat'){_0x497ae4[_0xa4b5('0x12')]=this[_0xa4b5('0x13')]['id'];}else{_0x497ae4[_['upperFirst'](_0x4d1695)+'AccountId']=this[_0xa4b5('0x13')]['id'];}_0x497ae4[_['upperFirst'](_0x4d1695)+_0xa4b5('0x14')]=this[_0xa4b5('0x8')]['id'];if(this['interaction'][_0xa4b5('0x15')]){var _0x443ad6=_0x47c4c5[0x4];if(!_[_0xa4b5('0x16')](_0x443ad6)){_0x497ae4[_0xa4b5('0x17')]=utils[_0xa4b5('0x18')](_0x443ad6,this);return rpc[_0x4d1695+_0xa4b5('0x19')][_0xa4b5('0x1a')](_0x497ae4)[_0xa4b5('0x1b')](function(_0x13c4fb){logger[_0xa4b5('0x1c')](_0xa4b5('0x9'),_0xcf52e7,_0x497ae4[_0xa4b5('0x17')]);})[_0xa4b5('0x1d')](function(_0x499d75){logger[_0xa4b5('0x1e')](_0xa4b5('0x9'),_0xcf52e7,JSON[_0xa4b5('0x1f')](_0x499d75));})[_0xa4b5('0x20')](function(){logger[_0xa4b5('0x1c')](_0xa4b5('0x21'),_0xcf52e7);_0x56be0e['stop']();});}else{logger[_0xa4b5('0x1c')](_0xa4b5('0x22'),_0xcf52e7);_0x56be0e['stop']();}}else{var _0x498433=this;var _0x4c9d9a=new AWS[(_0xa4b5('0x23'))]({'accessKeyId':_0x47c4c5[0x0],'secretAccessKey':_0x47c4c5[0x1],'region':_0x47c4c5[0x2]});var _0x22d39a={'botAlias':_0xa4b5('0x24'),'botName':_0x47c4c5[0x3],'inputText':this[_0xa4b5('0x25')][_0xa4b5('0x17')],'userId':this['channel']+':'+this['interaction']['id'][_0xa4b5('0x26')]()};_0x4c9d9a['postText'](_0x22d39a,function(_0x21278a,_0x312170){if(_0x21278a){logger[_0xa4b5('0x1e')]('[%s][AMAZONLEX]\x20%s',_0xcf52e7,_0x21278a[_0xa4b5('0x25')]);_0x56be0e[_0xa4b5('0x27')]();}else if(_0x312170&&_0x312170[_0xa4b5('0x25')]){_0x498433['body'][_0xa4b5('0x28')]=_0x312170;_0x497ae4[_0xa4b5('0x17')]=_0x312170[_0xa4b5('0x25')];_0x497ae4[_0xa4b5('0x29')]='amazonlex';_0x497ae4[_0xa4b5('0x2a')]=JSON[_0xa4b5('0x1f')](_0x312170);return rpc[_0x4d1695+_0xa4b5('0x19')][_0xa4b5('0x1a')](_0x497ae4)[_0xa4b5('0x1b')](function(_0x40b3be){logger[_0xa4b5('0x1c')](_0xa4b5('0x9'),_0xcf52e7,_0x497ae4[_0xa4b5('0x17')]);if(_0x312170['dialogState']==_0xa4b5('0x2b')){_0x56be0e[_0xa4b5('0x27')]();}else{_0x56be0e[_0xa4b5('0x2c')]();}})['catch'](function(_0x4abe37){logger[_0xa4b5('0x1e')](_0xa4b5('0x9'),_0xcf52e7,JSON[_0xa4b5('0x1f')](_0x4abe37));_0x56be0e[_0xa4b5('0x27')]();});}else{_0x56be0e['next']();}});}}catch(_0x1e5b9e){logger[_0xa4b5('0x1e')](_0xa4b5('0x9'),_0xcf52e7,JSON['stringify'](_0x1e5b9e));_0x56be0e[_0xa4b5('0x2c')]();}};}; \ No newline at end of file +var _0x5e55=['amazonlex','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','interaction','created','isEmpty','body','Message','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','stop','LexRuntime','$LATEST','message','toString','postText','providerName'];(function(_0x5dadee,_0x27e8e5){var _0x2bd044=function(_0x518ce5){while(--_0x518ce5){_0x5dadee['push'](_0x5dadee['shift']());}};_0x2bd044(++_0x27e8e5);}(_0x5e55,0x1e2));var _0x55e5=function(_0x1098e8,_0x987ada){_0x1098e8=_0x1098e8-0x0;var _0x309a43=_0x5e55[_0x1098e8];return _0x309a43;};'use strict';var _=require(_0x55e5('0x0'));var moment=require(_0x55e5('0x1'));var AWS=require(_0x55e5('0x2'));var utils=require(_0x55e5('0x3'));var logger=require(_0x55e5('0x4'))(_0x55e5('0x5'));var rpc={'chatMessage':require(_0x55e5('0x6')),'openchannelMessage':require(_0x55e5('0x7')),'mailMessage':require(_0x55e5('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x55e5('0x9'))};exports[_0x55e5('0xa')]=function(_0x1f449b,_0x4a7398){return function(_0xed14ee){try{if(!_[_0x55e5('0xb')](this['interaction'][_0x55e5('0xc')])){logger[_0x55e5('0xd')]('[%s][AMAZONLEX]\x20%s',_0x1f449b,_0x55e5('0xe'));return _0xed14ee[_0x55e5('0xf')]();}var _0x1c62a3={'ContactId':this[_0x55e5('0x10')]['id'],'sentAt':moment()[_0x55e5('0x11')](_0x55e5('0x12')),'direction':_0x55e5('0x13')};if(this[_0x55e5('0x14')]===_0x55e5('0x15')||this[_0x55e5('0x14')]===_0x55e5('0x16')){_0x1c62a3[_0x55e5('0x17')]=this['interaction'][_0x55e5('0x17')];}var _0x1683e7=this['channel'];if(_0x1683e7==='chat'){_0x1c62a3[_0x55e5('0x18')]=this['account']['id'];}else{_0x1c62a3[_[_0x55e5('0x19')](_0x1683e7)+_0x55e5('0x1a')]=this[_0x55e5('0x1b')]['id'];}_0x1c62a3[_['upperFirst'](_0x1683e7)+'InteractionId']=this[_0x55e5('0x1c')]['id'];if(this[_0x55e5('0x1c')][_0x55e5('0x1d')]){var _0x30580e=_0x4a7398[0x4];if(!_[_0x55e5('0x1e')](_0x30580e)){_0x1c62a3[_0x55e5('0x1f')]=utils['getMustacheRender'](_0x30580e,this);return rpc[_0x1683e7+_0x55e5('0x20')]['create'](_0x1c62a3)[_0x55e5('0x21')](function(_0x51cbed){logger[_0x55e5('0xd')](_0x55e5('0x22'),_0x1f449b,_0x1c62a3[_0x55e5('0x1f')]);})[_0x55e5('0x23')](function(_0x1d1c6f){logger[_0x55e5('0x24')](_0x55e5('0x22'),_0x1f449b,JSON[_0x55e5('0x25')](_0x1d1c6f));})[_0x55e5('0x26')](function(){logger[_0x55e5('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1f449b);_0xed14ee[_0x55e5('0x27')]();});}else{logger[_0x55e5('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1f449b);_0xed14ee[_0x55e5('0x27')]();}}else{var _0x1fe81f=this;var _0x2e81b3=new AWS[(_0x55e5('0x28'))]({'accessKeyId':_0x4a7398[0x0],'secretAccessKey':_0x4a7398[0x1],'region':_0x4a7398[0x2]});var _0x57ed29={'botAlias':_0x55e5('0x29'),'botName':_0x4a7398[0x3],'inputText':this[_0x55e5('0x2a')]['body'],'userId':this[_0x55e5('0x14')]+':'+this[_0x55e5('0x1c')]['id'][_0x55e5('0x2b')]()};_0x2e81b3[_0x55e5('0x2c')](_0x57ed29,function(_0x286066,_0x1248fa){if(_0x286066){logger['error'](_0x55e5('0x22'),_0x1f449b,_0x286066[_0x55e5('0x2a')]);_0xed14ee[_0x55e5('0xf')]();}else if(_0x1248fa&&_0x1248fa[_0x55e5('0x2a')]){_0x1fe81f[_0x55e5('0x1f')]['amazonlex']=_0x1248fa;_0x1c62a3[_0x55e5('0x1f')]=_0x1248fa[_0x55e5('0x2a')];_0x1c62a3[_0x55e5('0x2d')]=_0x55e5('0x2e');_0x1c62a3['providerResponse']=JSON[_0x55e5('0x25')](_0x1248fa);return rpc[_0x1683e7+_0x55e5('0x20')]['create'](_0x1c62a3)[_0x55e5('0x21')](function(_0xcc6960){logger[_0x55e5('0xd')](_0x55e5('0x22'),_0x1f449b,_0x1c62a3[_0x55e5('0x1f')]);if(_0x1248fa[_0x55e5('0x2f')]=='Failed'){_0xed14ee[_0x55e5('0xf')]();}else{_0xed14ee[_0x55e5('0x27')]();}})[_0x55e5('0x23')](function(_0x510cf2){logger[_0x55e5('0x24')](_0x55e5('0x22'),_0x1f449b,JSON[_0x55e5('0x25')](_0x510cf2));_0xed14ee[_0x55e5('0xf')]();});}else{_0xed14ee[_0x55e5('0xf')]();}});}}catch(_0x1145a4){logger[_0x55e5('0x24')](_0x55e5('0x22'),_0x1f449b,JSON['stringify'](_0x1145a4));_0xed14ee[_0x55e5('0x27')]();}};}; \ 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 fcf7b8d..8d66087 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 _0x65f1=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','inReplyTo','messageId','html','','headers','All','auto_reply','sendMailMessage','then','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','catch','finally','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x65f1,0x1bc));var _0x165f=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0x65f1[_0x149a9b];return _0x2c2bf6;};'use strict';var _=require(_0x165f('0x0'));var moment=require(_0x165f('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x165f('0x2'));var rpc={'chatMessage':require(_0x165f('0x3')),'openchannelMessage':require(_0x165f('0x4')),'mailMessage':require(_0x165f('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x165f('0x6')),'whatsappMessage':require(_0x165f('0x7')),'chatInteraction':require(_0x165f('0x8')),'openchannelInteraction':require(_0x165f('0x9')),'mailInteraction':require(_0x165f('0xa')),'smsInteraction':require(_0x165f('0xb')),'faxInteraction':require(_0x165f('0xc')),'whatsappInteraction':require(_0x165f('0xd'))};var mailRpc=require(_0x165f('0xe'));exports[_0x165f('0xf')]=function(_0x2a95bc,_0x4f00bc,_0x529649,_0x7a2888){return function(_0x28e9eb){try{var _0x12cf51=this['channel'];if(_0x12cf51===_0x165f('0x10')&&_0x7a2888[_0x165f('0x11')][_0x165f('0x12')]){logger[_0x165f('0x13')]('[%s][AUTOREPLY]\x20%s',_0x2a95bc,_0x165f('0x14'));return _0x28e9eb[_0x165f('0x15')]();}if(_0x4f00bc[0x0]==='1'&&(_[_0x165f('0x16')](this[_0x165f('0x17')][_0x165f('0x18')])||!this['interaction'][_0x165f('0x18')])){logger[_0x165f('0x13')](_0x165f('0x19'),_0x2a95bc,'Autoreply\x20already\x20sent');return _0x28e9eb[_0x165f('0x15')]();}if(_0x4f00bc[0x0]==='2'&&this[_0x165f('0x17')][_0x165f('0x1a')]){logger[_0x165f('0x13')](_0x165f('0x1b'),_0x2a95bc,_0x165f('0x1c'));return _0x28e9eb[_0x165f('0x15')]();}var _0x531908={'ContactId':this[_0x165f('0x1d')]['id'],'sentAt':moment()[_0x165f('0x1e')](_0x165f('0x1f')),'direction':_0x165f('0x20')};if(this[_0x165f('0x21')]===_0x165f('0x10')){_0x531908[_0x165f('0x11')]=utils['getMustacheRender'](_0x4f00bc[0x2],this);}else{_0x531908['body']=utils[_0x165f('0x22')](_0x4f00bc[0x1],this);}if(this[_0x165f('0x23')]){_0x531908['to']=this[_0x165f('0x23')][_0x165f('0x24')]||'';if(this[_0x165f('0x21')]==='mail'&&_0x4f00bc[0x1]==='1'){_0x531908['cc']=this['message']['cc']||'';}_0x531908[_0x165f('0x24')]=this[_0x165f('0x23')]['to']||'';_0x531908[_0x165f('0x25')]=this[_0x165f('0x23')][_0x165f('0x25')]||'';_0x531908['read']=!![];if(this[_0x165f('0x23')][_0x165f('0x26')]){_0x531908[_0x165f('0x26')]='';_0x531908['subject']+=_[_0x165f('0x27')](this[_0x165f('0x23')]['subject'],_0x165f('0x28'))?'':'Re:\x20';_0x531908[_0x165f('0x26')]+=this[_0x165f('0x23')][_0x165f('0x26')];}}if(this[_0x165f('0x21')]==='chat'){_0x531908[_0x165f('0x29')]=this[_0x165f('0x2a')]['id'];}else{_0x531908[_[_0x165f('0x2b')](this[_0x165f('0x21')])+_0x165f('0x2c')]=this[_0x165f('0x2a')]['id'];}_0x531908[_[_0x165f('0x2b')](this[_0x165f('0x21')])+_0x165f('0x2d')]=this['interaction']['id'];var _0x487245=this[_0x165f('0x17')];if(rpc[this[_0x165f('0x21')]+_0x165f('0x2e')]){if(this['channel']===_0x165f('0x10')){var _0x1bfadf={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x165f('0x2f')][_0x165f('0x30')]){_0x1bfadf[_0x165f('0x30')]=this[_0x165f('0x2a')][_0x165f('0x2f')][_0x165f('0x30')];}else{_0x1bfadf[_0x165f('0x31')]=this[_0x165f('0x2a')][_0x165f('0x2f')][_0x165f('0x31')];_0x1bfadf[_0x165f('0x32')]=this['account'][_0x165f('0x2f')]['port'];_0x1bfadf[_0x165f('0x33')]=this[_0x165f('0x2a')][_0x165f('0x2f')][_0x165f('0x33')];}if(this[_0x165f('0x2a')]['Smtp'][_0x165f('0x34')]){_0x1bfadf[_0x165f('0x35')]={'user':this[_0x165f('0x2a')]['Smtp'][_0x165f('0x36')],'pass':this['account'][_0x165f('0x2f')]['pass']};}_0x531908[_0x165f('0x37')]=this['message'][_0x165f('0x38')];_0x531908[_0x165f('0x39')]=''+_['replace'](_0x531908[_0x165f('0x11')],_0x165f('0x3a'),'','headers','auto-replied','All','auto_reply','then','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','isAutoreply','info','isNil','interaction','created','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','mail','getMustacheRender','message','from','phone','subject','Re:','Re:\x20','ChatWebsiteId','upperFirst','AccountId','account','InteractionId'];(function(_0x168fd3,_0x11fbbd){var _0x47f2b7=function(_0x5971ed){while(--_0x5971ed){_0x168fd3['push'](_0x168fd3['shift']());}};_0x47f2b7(++_0x11fbbd);}(_0x208f,0x6d));var _0xf208=function(_0x46ed3a,_0x35b0b3){_0x46ed3a=_0x46ed3a-0x0;var _0x3caeb8=_0x208f[_0x46ed3a];return _0x3caeb8;};'use strict';var _=require(_0xf208('0x0'));var moment=require(_0xf208('0x1'));var utils=require(_0xf208('0x2'));var logger=require(_0xf208('0x3'))(_0xf208('0x4'));var rpc={'chatMessage':require(_0xf208('0x5')),'openchannelMessage':require(_0xf208('0x6')),'mailMessage':require(_0xf208('0x7')),'smsMessage':require(_0xf208('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf208('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf208('0xa')),'mailInteraction':require(_0xf208('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xf208('0xc')),'whatsappInteraction':require(_0xf208('0xd'))};var mailRpc=require(_0xf208('0xe'));exports[_0xf208('0xf')]=function(_0x505dff,_0x49bb78,_0x208f1f,_0x1bd1b8){return function(_0xf0738c){try{var _0xf76ff1=this[_0xf208('0x10')];if(_0xf76ff1==='mail'&&_0x1bd1b8[_0xf208('0x11')][_0xf208('0x12')]){logger[_0xf208('0x13')]('[%s][AUTOREPLY]\x20%s',_0x505dff,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0xf0738c['next']();}if(_0x49bb78[0x0]==='1'&&(_[_0xf208('0x14')](this[_0xf208('0x15')][_0xf208('0x16')])||!this[_0xf208('0x15')][_0xf208('0x16')])){logger[_0xf208('0x13')]('[%s][AUTOREPLY]\x20%s',_0x505dff,_0xf208('0x17'));return _0xf0738c[_0xf208('0x18')]();}if(_0x49bb78[0x0]==='2'&&this[_0xf208('0x15')]['autoreplyExecuted']){logger[_0xf208('0x13')](_0xf208('0x19'),_0x505dff,_0xf208('0x1a'));return _0xf0738c['next']();}var _0x46a65c={'ContactId':this[_0xf208('0x1b')]['id'],'sentAt':moment()[_0xf208('0x1c')](_0xf208('0x1d')),'direction':'out'};if(this['channel']===_0xf208('0x1e')){_0x46a65c[_0xf208('0x11')]=utils[_0xf208('0x1f')](_0x49bb78[0x2],this);}else{_0x46a65c[_0xf208('0x11')]=utils[_0xf208('0x1f')](_0x49bb78[0x1],this);}if(this[_0xf208('0x20')]){_0x46a65c['to']=this[_0xf208('0x20')][_0xf208('0x21')]||'';if(this[_0xf208('0x10')]==='mail'&&_0x49bb78[0x1]==='1'){_0x46a65c['cc']=this[_0xf208('0x20')]['cc']||'';}_0x46a65c[_0xf208('0x21')]=this[_0xf208('0x20')]['to']||'';_0x46a65c[_0xf208('0x22')]=this[_0xf208('0x20')][_0xf208('0x22')]||'';_0x46a65c['read']=!![];if(this[_0xf208('0x20')][_0xf208('0x23')]){_0x46a65c[_0xf208('0x23')]='';_0x46a65c[_0xf208('0x23')]+=_['startsWith'](this[_0xf208('0x20')][_0xf208('0x23')],_0xf208('0x24'))?'':_0xf208('0x25');_0x46a65c['subject']+=this[_0xf208('0x20')][_0xf208('0x23')];}}if(this[_0xf208('0x10')]==='chat'){_0x46a65c[_0xf208('0x26')]=this['account']['id'];}else{_0x46a65c[_[_0xf208('0x27')](this[_0xf208('0x10')])+_0xf208('0x28')]=this[_0xf208('0x29')]['id'];}_0x46a65c[_[_0xf208('0x27')](this[_0xf208('0x10')])+_0xf208('0x2a')]=this[_0xf208('0x15')]['id'];var _0x4e80d6=this[_0xf208('0x15')];if(rpc[this[_0xf208('0x10')]+_0xf208('0x2b')]){if(this[_0xf208('0x10')]===_0xf208('0x1e')){var _0x3061c3={'tls':{'rejectUnauthorized':![]}};if(this[_0xf208('0x29')]['Smtp'][_0xf208('0x2c')]){_0x3061c3[_0xf208('0x2c')]=this['account'][_0xf208('0x2d')][_0xf208('0x2c')];}else{_0x3061c3[_0xf208('0x2e')]=this[_0xf208('0x29')][_0xf208('0x2d')][_0xf208('0x2e')];_0x3061c3[_0xf208('0x2f')]=this['account'][_0xf208('0x2d')][_0xf208('0x2f')];_0x3061c3[_0xf208('0x30')]=this[_0xf208('0x29')]['Smtp'][_0xf208('0x30')];}if(this[_0xf208('0x29')][_0xf208('0x2d')]['authentication']){_0x3061c3[_0xf208('0x31')]={'user':this[_0xf208('0x29')]['Smtp'][_0xf208('0x32')],'pass':this['account'][_0xf208('0x2d')][_0xf208('0x33')]};}_0x46a65c[_0xf208('0x34')]=this[_0xf208('0x20')][_0xf208('0x35')];_0x46a65c[_0xf208('0x36')]=''+_[_0xf208('0x37')](_0x46a65c[_0xf208('0x11')],']+(>|$)/g,''),'priorityTrue':_0x4277a9[0x1],'priorityFalse':_0x4277a9[0x2]};var _0x58b69d=gotoif['validate'](_0x46a10d,{'typecast':!![]});if(_0x58b69d[_0x6a8f('0xb')]){logger['error'](_0x6a8f('0xc'),_0x5e59f2,_[_0x6a8f('0xd')](_0x58b69d,_0x6a8f('0xe'))[_0x6a8f('0xf')](',\x20'));_0x26f5ff[_0x6a8f('0x10')]();}else{try{var _0x255687=eval('('+_0x46a10d['condition']+')');var _0x53d7e8=_0x255687?_0x46a10d[_0x6a8f('0x11')]:_0x46a10d[_0x6a8f('0x12')];logger[_0x6a8f('0x13')](_0x6a8f('0x14'),_0x5e59f2,_0x46a10d[_0x6a8f('0x15')],_0x255687,_0x53d7e8||_0x6a8f('0x16'));if(_0x53d7e8){var _0x394b7f=_['findIndex'](_0x26f5ff['rules'](),{'p':_0x53d7e8});if(_0x394b7f>=0x0){logger[_0x6a8f('0x13')](_0x6a8f('0x17'),_0x5e59f2,_0x53d7e8||_0x6a8f('0x16'),_0x394b7f);_0x26f5ff['next'](_0x394b7f);}else{logger[_0x6a8f('0x13')](_0x6a8f('0x18'),_0x5e59f2,_0x53d7e8||_0x6a8f('0x16'));_0x26f5ff['stop']();}}else{_0x26f5ff['next']();}}catch(_0x37c177){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x5e59f2,_0x37c177[_0x6a8f('0xe')]);_0x26f5ff[_0x6a8f('0x10')]();}}}catch(_0xe5b19){logger[_0x6a8f('0x19')](_0x6a8f('0xc'),_0x5e59f2,JSON[_0x6a8f('0x1a')](_0xe5b19));_0x26f5ff[_0x6a8f('0x10')]();}};}; \ No newline at end of file +var _0x2bab=['findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','map','message','join','condition','priorityTrue','priorityFalse','next'];(function(_0x16a281,_0xaf109e){var _0x20f5b5=function(_0x13961e){while(--_0x13961e){_0x16a281['push'](_0x16a281['shift']());}};_0x20f5b5(++_0xaf109e);}(_0x2bab,0x1e9));var _0xb2ba=function(_0x264896,_0x37ffdf){_0x264896=_0x264896-0x0;var _0x46c49b=_0x2bab[_0x264896];return _0x46c49b;};'use strict';var schema=require(_0xb2ba('0x0'));var _=require(_0xb2ba('0x1'));var htmlToText=require(_0xb2ba('0x2'));var utils=require(_0xb2ba('0x3'));var logger=require(_0xb2ba('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xb2ba('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xb2ba('0x6'),'message':_0xb2ba('0x7')},'priorityFalse':{'type':_0xb2ba('0x6'),'message':_0xb2ba('0x8')}});exports[_0xb2ba('0x9')]=function(_0x1a29f6,_0x13a296){return function(_0x42dc70){try{var _0x38a744={'condition':htmlToText[_0xb2ba('0xa')](utils[_0xb2ba('0xb')](_0x13a296[0x0],this),{'wordwrap':![]})[_0xb2ba('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x13a296[0x1],'priorityFalse':_0x13a296[0x2]};var _0x166128=gotoif['validate'](_0x38a744,{'typecast':!![]});if(_0x166128[_0xb2ba('0xd')]){logger['error']('[%s][GOTOIF]\x20%s',_0x1a29f6,_[_0xb2ba('0xe')](_0x166128,_0xb2ba('0xf'))[_0xb2ba('0x10')](',\x20'));_0x42dc70['stop']();}else{try{var _0x41161d=eval('('+_0x38a744[_0xb2ba('0x11')]+')');var _0x2e1cec=_0x41161d?_0x38a744[_0xb2ba('0x12')]:_0x38a744[_0xb2ba('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1a29f6,_0x38a744[_0xb2ba('0x11')],_0x41161d,_0x2e1cec||_0xb2ba('0x14'));if(_0x2e1cec){var _0x233e5f=_[_0xb2ba('0x15')](_0x42dc70['rules'](),{'p':_0x2e1cec});if(_0x233e5f>=0x0){logger['info'](_0xb2ba('0x16'),_0x1a29f6,_0x2e1cec||_0xb2ba('0x14'),_0x233e5f);_0x42dc70['next'](_0x233e5f);}else{logger[_0xb2ba('0x17')](_0xb2ba('0x18'),_0x1a29f6,_0x2e1cec||_0xb2ba('0x14'));_0x42dc70[_0xb2ba('0x19')]();}}else{_0x42dc70['next']();}}catch(_0x49bc7d){logger[_0xb2ba('0x1a')](_0xb2ba('0x1b'),_0x1a29f6,_0x49bc7d['message']);_0x42dc70[_0xb2ba('0x19')]();}}}catch(_0x1e489c){logger[_0xb2ba('0x1a')](_0xb2ba('0x1c'),_0x1a29f6,JSON[_0xb2ba('0x1d')](_0x1e489c));_0x42dc70['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 f1a63ff..278cc7a 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 _0x9f48=['info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','stop'];(function(_0xf9534b,_0xa83eb4){var _0x5cd9ac=function(_0x4eaab5){while(--_0x4eaab5){_0xf9534b['push'](_0xf9534b['shift']());}};_0x5cd9ac(++_0xa83eb4);}(_0x9f48,0x1ee));var _0x89f4=function(_0x3db285,_0x2ce3dc){_0x3db285=_0x3db285-0x0;var _0x287478=_0x9f48[_0x3db285];return _0x287478;};'use strict';var schema=require(_0x89f4('0x0'));var _=require(_0x89f4('0x1'));var logger=require(_0x89f4('0x2'))('routing');var gotop=schema({'priority':{'type':_0x89f4('0x3'),'required':!![],'message':_0x89f4('0x4')}});exports[_0x89f4('0x5')]=function(_0x4a3e74,_0x18cb67){return function(_0x5f4054){try{var _0x18c3c1={'priority':_0x18cb67[0x0]};var _0x3685c6=gotop[_0x89f4('0x0')](_0x18c3c1,{'typecast':!![]});if(_0x3685c6[_0x89f4('0x6')]){logger[_0x89f4('0x7')](_0x89f4('0x8'),_0x4a3e74,_['map'](_0x3685c6,'message')['join'](',\x20'));_0x5f4054[_0x89f4('0x9')]();}else{logger[_0x89f4('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x4a3e74,_0x18c3c1[_0x89f4('0xb')]);if(_0x18c3c1['priority']){var _0x43a292=_[_0x89f4('0xc')](_0x5f4054[_0x89f4('0xd')](),{'p':_0x18c3c1[_0x89f4('0xb')]});if(_0x43a292>=0x0){logger[_0x89f4('0xa')](_0x89f4('0xe'),_0x4a3e74,_0x18c3c1['priority']||'next',_0x43a292);_0x5f4054[_0x89f4('0xf')](_0x43a292);}else{logger[_0x89f4('0xa')](_0x89f4('0x10'),_0x4a3e74,_0x18c3c1[_0x89f4('0xb')]||_0x89f4('0xf'));_0x5f4054[_0x89f4('0x9')]();}}else{_0x5f4054[_0x89f4('0xf')]();}}}catch(_0x327dcb){logger[_0x89f4('0x7')](_0x89f4('0x8'),_0x4a3e74,JSON[_0x89f4('0x11')](_0x327dcb));_0x5f4054[_0x89f4('0x9')]();}};}; \ No newline at end of file +var _0x6b20=['consequence','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6b20,0x117));var _0x06b2=function(_0x56aa03,_0x214b05){_0x56aa03=_0x56aa03-0x0;var _0x1d68d1=_0x6b20[_0x56aa03];return _0x1d68d1;};'use strict';var schema=require(_0x06b2('0x0'));var _=require(_0x06b2('0x1'));var logger=require(_0x06b2('0x2'))(_0x06b2('0x3'));var gotop=schema({'priority':{'type':_0x06b2('0x4'),'required':!![],'message':_0x06b2('0x5')}});exports[_0x06b2('0x6')]=function(_0x486481,_0x11961e){return function(_0x3e5e9f){try{var _0x52c8d1={'priority':_0x11961e[0x0]};var _0x105318=gotop[_0x06b2('0x0')](_0x52c8d1,{'typecast':!![]});if(_0x105318['length']){logger['error'](_0x06b2('0x7'),_0x486481,_[_0x06b2('0x8')](_0x105318,_0x06b2('0x9'))['join'](',\x20'));_0x3e5e9f[_0x06b2('0xa')]();}else{logger[_0x06b2('0xb')](_0x06b2('0xc'),_0x486481,_0x52c8d1[_0x06b2('0xd')]);if(_0x52c8d1[_0x06b2('0xd')]){var _0x5f4773=_[_0x06b2('0xe')](_0x3e5e9f[_0x06b2('0xf')](),{'p':_0x52c8d1[_0x06b2('0xd')]});if(_0x5f4773>=0x0){logger['info'](_0x06b2('0x10'),_0x486481,_0x52c8d1['priority']||_0x06b2('0x11'),_0x5f4773);_0x3e5e9f[_0x06b2('0x11')](_0x5f4773);}else{logger[_0x06b2('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x486481,_0x52c8d1[_0x06b2('0xd')]||'next');_0x3e5e9f[_0x06b2('0xa')]();}}else{_0x3e5e9f['next']();}}}catch(_0x42948b){logger[_0x06b2('0x12')](_0x06b2('0x7'),_0x486481,JSON['stringify'](_0x42948b));_0x3e5e9f[_0x06b2('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 376c396..a62c90f 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 _0xf0ba=['consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0xf0cf28,_0x1a5fe2){var _0x2d367d=function(_0x57362f){while(--_0x57362f){_0xf0cf28['push'](_0xf0cf28['shift']());}};_0x2d367d(++_0x1a5fe2);}(_0xf0ba,0x7a));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaf0b('0x0'));var utils=require(_0xaf0b('0x1'));var logger=require(_0xaf0b('0x2'))(_0xaf0b('0x3'));var rpc={'chatMessage':require(_0xaf0b('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xaf0b('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaf0b('0x6')),'whatsappMessage':require(_0xaf0b('0x7'))};exports[_0xaf0b('0x8')]=function(_0x29bd6f,_0x2fc169){return function(_0x2fb7b7){try{var _0x284ed6={'body':utils[_0xaf0b('0x9')](_0x2fc169[0x0],this),'ContactId':this[_0xaf0b('0xa')]['id']};if(this[_0xaf0b('0xb')]===_0xaf0b('0xc')){_0x284ed6[_0xaf0b('0xd')]=this[_0xaf0b('0xe')]['id'];}else{_0x284ed6[_[_0xaf0b('0xf')](this[_0xaf0b('0xb')])+_0xaf0b('0x10')]=this[_0xaf0b('0xe')]['id'];}_0x284ed6[_[_0xaf0b('0xf')](this[_0xaf0b('0xb')])+'InteractionId']=this[_0xaf0b('0x11')]['id'];if(rpc[this['channel']+_0xaf0b('0x12')]){return rpc[this[_0xaf0b('0xb')]+'Message'][_0xaf0b('0x13')](_0x284ed6)[_0xaf0b('0x14')](function(_0x1688c7){logger[_0xaf0b('0x15')](_0xaf0b('0x16'),_0x29bd6f,_0x284ed6[_0xaf0b('0x17')]);_0x2fb7b7['next']();})['catch'](function(_0x5a273c){logger['error'](_0xaf0b('0x16'),_0x29bd6f,JSON[_0xaf0b('0x18')](_0x5a273c));_0x2fb7b7[_0xaf0b('0x19')]();});}}catch(_0x3169e9){logger['error'](_0xaf0b('0x16'),_0x29bd6f,JSON['stringify'](_0x3169e9));_0x2fb7b7['stop']();}};}; \ No newline at end of file +var _0x33d2=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','chat','ChatWebsiteId','account','channel','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger'];(function(_0x3825a5,_0x5f073c){var _0x5856c5=function(_0x251128){while(--_0x251128){_0x3825a5['push'](_0x3825a5['shift']());}};_0x5856c5(++_0x5f073c);}(_0x33d2,0x7f));var _0x233d=function(_0x27b3df,_0x34a01a){_0x27b3df=_0x27b3df-0x0;var _0x275390=_0x33d2[_0x27b3df];return _0x275390;};'use strict';var _=require(_0x233d('0x0'));var utils=require(_0x233d('0x1'));var logger=require(_0x233d('0x2'))('routing');var rpc={'chatMessage':require(_0x233d('0x3')),'openchannelMessage':require(_0x233d('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x233d('0x5')),'faxMessage':require(_0x233d('0x6')),'whatsappMessage':require(_0x233d('0x7'))};exports[_0x233d('0x8')]=function(_0xc0ab48,_0x3f311b){return function(_0x15ba43){try{var _0x15bb45={'body':utils['getMustacheRender'](_0x3f311b[0x0],this),'ContactId':this[_0x233d('0x9')]['id']};if(this['channel']===_0x233d('0xa')){_0x15bb45[_0x233d('0xb')]=this[_0x233d('0xc')]['id'];}else{_0x15bb45[_['upperFirst'](this[_0x233d('0xd')])+'AccountId']=this[_0x233d('0xc')]['id'];}_0x15bb45[_['upperFirst'](this[_0x233d('0xd')])+_0x233d('0xe')]=this[_0x233d('0xf')]['id'];if(rpc[this['channel']+_0x233d('0x10')]){return rpc[this[_0x233d('0xd')]+'Message'][_0x233d('0x11')](_0x15bb45)[_0x233d('0x12')](function(_0x51c461){logger[_0x233d('0x13')](_0x233d('0x14'),_0xc0ab48,_0x15bb45[_0x233d('0x15')]);_0x15ba43['next']();})[_0x233d('0x16')](function(_0x294703){logger[_0x233d('0x17')](_0x233d('0x14'),_0xc0ab48,JSON[_0x233d('0x18')](_0x294703));_0x15ba43['stop']();});}}catch(_0xd7624c){logger['error'](_0x233d('0x14'),_0xc0ab48,JSON[_0x233d('0x18')](_0xd7624c));_0x15ba43[_0x233d('0x19')]();}};}; \ 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 13ff1fd..f90e860 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 _0x89dd=['[%s][NOOP]\x20%s','error','stringify','stop','../../../../config/logger','routing','consequence','info'];(function(_0x282a7c,_0xa32033){var _0x4366fa=function(_0x2e4829){while(--_0x2e4829){_0x282a7c['push'](_0x282a7c['shift']());}};_0x4366fa(++_0xa32033);}(_0x89dd,0x1bc));var _0xd89d=function(_0x2a53ea,_0x103efd){_0x2a53ea=_0x2a53ea-0x0;var _0x4c744b=_0x89dd[_0x2a53ea];return _0x4c744b;};'use strict';var utils=require('./utils');var logger=require(_0xd89d('0x0'))(_0xd89d('0x1'));exports[_0xd89d('0x2')]=function(_0x2560c4,_0x22b966){return function(_0x30330e){try{logger[_0xd89d('0x3')](_0xd89d('0x4'),_0x2560c4,utils['getMustacheRender'](_0x22b966[0x0],this));_0x30330e['next']();}catch(_0xc288a6){logger[_0xd89d('0x5')](_0xd89d('0x4'),_0x2560c4,JSON[_0xd89d('0x6')](_0xc288a6));_0x30330e[_0xd89d('0x7')]();}};}; \ No newline at end of file +var _0x41ff=['info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','./utils','../../../../config/logger','routing','consequence'];(function(_0x19d254,_0x19177a){var _0x4b52f9=function(_0x52dcad){while(--_0x52dcad){_0x19d254['push'](_0x19d254['shift']());}};_0x4b52f9(++_0x19177a);}(_0x41ff,0x68));var _0xf41f=function(_0x4cf026,_0x1e065d){_0x4cf026=_0x4cf026-0x0;var _0x181fc5=_0x41ff[_0x4cf026];return _0x181fc5;};'use strict';var utils=require(_0xf41f('0x0'));var logger=require(_0xf41f('0x1'))(_0xf41f('0x2'));exports[_0xf41f('0x3')]=function(_0x1168ac,_0x58d4de){return function(_0x12ca47){try{logger[_0xf41f('0x4')]('[%s][NOOP]\x20%s',_0x1168ac,utils[_0xf41f('0x5')](_0x58d4de[0x0],this));_0x12ca47['next']();}catch(_0x514443){logger[_0xf41f('0x6')](_0xf41f('0x7'),_0x1168ac,JSON[_0xf41f('0x8')](_0x514443));_0x12ca47['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 9a71fed..c7464ed 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 _0xd5e1=['name','QueueReport','create','catch','error','accepted','update','update\x20queue\x20report','timeout','toLowerCase','consequence','length','map','join','stop','find','Queues','createQueue','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','ioredis','../../../../config/environment','redis','defaults','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','info','[%s][START:QUEUE][NAME:%s]'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xd5e1,0xf6));var _0x1d5e=function(_0x43b5a1,_0x6f0e4f){_0x43b5a1=_0x43b5a1-0x0;var _0x409509=_0xd5e1[_0x43b5a1];return _0x409509;};'use strict';var schema=require(_0x1d5e('0x0'));var _=require(_0x1d5e('0x1'));var util=require(_0x1d5e('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x1d5e('0x3'));var config=require(_0x1d5e('0x4'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');config[_0x1d5e('0x5')]=_[_0x1d5e('0x6')](config[_0x1d5e('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1d5e('0x5')]));var attributes=['id','queue_id',_0x1d5e('0x7'),_0x1d5e('0x8'),_0x1d5e('0x9'),_0x1d5e('0xa')];function emit(_0x8a0675,_0x33af8c,_0x26897b){io['to'](_0x8a0675)[_0x1d5e('0xb')](_0x33af8c,_0x26897b);}function emitChannelQueueInteraction(_0x4009da,_0x5d47a7,_0x4bf039,_0x54e723,_0x325a46,_0x389006,_0x2c41b1,_0x58fe4f){var _0xcad75d=_[_0x1d5e('0xc')](_0x4bf039);_0xcad75d['queue_id']=_0x58fe4f;_0xcad75d['queue']=_0x5d47a7;_0xcad75d[_0x1d5e('0x7')]=_0x54e723;_0xcad75d['id']=_0x325a46;if(_0x389006){_0x2c41b1[util['format'](_0x1d5e('0xd'),_0x4009da)][_0x325a46]=_[_0x1d5e('0xe')](_0xcad75d,attributes);}else{delete _0x2c41b1[util['format']('%sQueuesWaitingInteractions',_0x4009da)][_0x325a46];}emit(util[_0x1d5e('0xf')](_0x1d5e('0x10'),_0x4009da,_0x5d47a7),util[_0x1d5e('0xf')](_0x1d5e('0x11'),_0x4009da,_0x389006?_0x1d5e('0x12'):_0x1d5e('0x13')),_['pick'](_0xcad75d,attributes));}var rpc={'openchannelQueueReport':require(_0x1d5e('0x14')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x1d5e('0x15')),'smsQueueReport':require(_0x1d5e('0x16')),'faxQueueReport':require(_0x1d5e('0x17')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x1d5e('0x18'),'required':!![],'message':_0x1d5e('0x19')},'timeout':{'type':'number','message':_0x1d5e('0x1a')}});function startRouting(_0x2d787d,_0x15cdd6,_0x575d07,_0x499f23){if(_0x2d787d&&_0x15cdd6&&_0x575d07){_0x15cdd6[_0x1d5e('0x1b')]+=0x1;var _0x639b16={'uniqueid':_0x2d787d,'from':_0x575d07[_0x1d5e('0x1c')]?_0x575d07[_0x1d5e('0x1c')][_0x1d5e('0x9')]:'','joinAt':moment()['format'](_0x1d5e('0x1d')),'ContactId':_0x575d07[_0x1d5e('0x1e')]?_0x575d07[_0x1d5e('0x1e')]['id']:null,'ListId':_0x575d07[_0x1d5e('0x1f')]?_0x575d07[_0x1d5e('0x1f')]['id']:null};_0x639b16[_[_0x1d5e('0x20')](_0x575d07[_0x1d5e('0x21')])+_0x1d5e('0x22')]=_0x15cdd6['id']||null;_0x639b16[_[_0x1d5e('0x20')](_0x575d07[_0x1d5e('0x21')])+_0x1d5e('0x23')]=_0x575d07[_0x1d5e('0x24')]?_0x575d07[_0x1d5e('0x24')]['id']:null;_0x639b16[_[_0x1d5e('0x20')](_0x575d07[_0x1d5e('0x21')])+_0x1d5e('0x25')]=_0x575d07[_0x1d5e('0x26')]?_0x575d07[_0x1d5e('0x26')]['id']:null;_0x639b16[_[_0x1d5e('0x20')](_0x575d07[_0x1d5e('0x21')])+(_0x575d07[_0x1d5e('0x21')]!=='chat'?_0x1d5e('0x27'):'WebsiteId')]=_0x575d07[_0x1d5e('0x7')]?_0x575d07['account']['id']:null;logger[_0x1d5e('0x28')](util[_0x1d5e('0xf')](_0x1d5e('0x29'),_0x2d787d,_0x15cdd6[_0x1d5e('0x2a')]));emitChannelQueueInteraction(_0x575d07[_0x1d5e('0x21')],_0x15cdd6['name'],_0x639b16,_0x575d07[_0x1d5e('0x7')][_0x1d5e('0x2a')],_0x575d07['message']['id'],!![],_0x499f23,_0x15cdd6['id']);if(rpc[_0x575d07[_0x1d5e('0x21')]+_0x1d5e('0x2b')]){return rpc[_0x575d07[_0x1d5e('0x21')]+_0x1d5e('0x2b')][_0x1d5e('0x2c')](_0x639b16)[_0x1d5e('0x2d')](function(_0x578f9c){logger[_0x1d5e('0x2e')]('create\x20queue\x20report');});}}}function stopRouting(_0x5bf4b8,_0x3d1be1,_0x1a7900,_0x9a417){if(_0x5bf4b8&&_0x3d1be1){_0x3d1be1[_0x1d5e('0x1b')]-=0x1;var _0x5d0697={'leaveAt':moment()[_0x1d5e('0xf')](_0x1d5e('0x1d')),'acceptAt':moment()[_0x1d5e('0xf')](_0x1d5e('0x1d')),'reason':_0x1d5e('0x2f')};logger[_0x1d5e('0x28')](util[_0x1d5e('0xf')]('[%s][STOP:QUEUE][NAME:%s]',_0x5bf4b8,_0x3d1be1[_0x1d5e('0x2a')]));emitChannelQueueInteraction(_0x1a7900[_0x1d5e('0x21')],_0x3d1be1[_0x1d5e('0x2a')],_0x1a7900['body'],_0x1a7900[_0x1d5e('0x7')][_0x1d5e('0x2a')],_0x1a7900['message']['id'],![],_0x9a417,_0x3d1be1['id']);if(rpc[_0x1a7900['channel']+'QueueReport']){return rpc[_0x1a7900[_0x1d5e('0x21')]+_0x1d5e('0x2b')][_0x1d5e('0x30')](_0x5bf4b8,_0x5d0697)[_0x1d5e('0x2d')](function(_0x5894a9){logger[_0x1d5e('0x2e')](_0x1d5e('0x31'));});}}}function endRouting(_0x29c5ef,_0x1a2ca6,_0x502d9c,_0x421051){if(_0x29c5ef&&_0x1a2ca6){_0x1a2ca6[_0x1d5e('0x1b')]-=0x1;var _0x3905a1={'leaveAt':moment()[_0x1d5e('0xf')](_0x1d5e('0x1d')),'exitAt':moment()[_0x1d5e('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1d5e('0x32')};logger['info'](util[_0x1d5e('0xf')]('[%s][END:QUEUE][NAME:%s]',_0x29c5ef,_0x1a2ca6['name']));emitChannelQueueInteraction(_0x502d9c[_0x1d5e('0x21')],_0x1a2ca6[_0x1d5e('0x2a')],_0x502d9c[_0x1d5e('0x1c')],_0x502d9c[_0x1d5e('0x7')]['name'],_0x502d9c[_0x1d5e('0x26')]['id'],![],_0x421051);if(rpc[_0x502d9c[_0x1d5e('0x21')]+'QueueReport']){return rpc[_0x502d9c['channel']+_0x1d5e('0x2b')][_0x1d5e('0x30')](_0x29c5ef,_0x3905a1)[_0x1d5e('0x2d')](function(_0x2c7adb){logger[_0x1d5e('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x1f8f3b){return function(_0x2b64b2){return _0x2b64b2[_0x1d5e('0x2a')][_0x1d5e('0x33')]()===_0x1f8f3b[_0x1d5e('0x33')]();};}exports[_0x1d5e('0x34')]=function(_0x43ad3b,_0x309618,_0x4b366c,_0x11a5bb){return function(_0x27dc87){try{var _0x51e51a={'name':_0x309618[0x0],'timeout':_0x309618[0x1]};var _0xbbda46=queue[_0x1d5e('0x0')](_0x51e51a,{'typecast':!![]});if(_0xbbda46[_0x1d5e('0x35')]){logger['error']('[%s][QUEUE]\x20%s',_0x43ad3b,_[_0x1d5e('0x36')](_0xbbda46,_0x1d5e('0x26'))[_0x1d5e('0x37')](',\x20'));_0x27dc87[_0x1d5e('0x38')]();}else{var _0x1524a5=_[_0x1d5e('0x39')](_0x4b366c[_0x11a5bb[_0x1d5e('0x21')]+_0x1d5e('0x3a')],handleFindQueue(_0x51e51a[_0x1d5e('0x2a')]));if(_0x1524a5){startRouting(_0x43ad3b,_0x1524a5,_0x11a5bb,_0x4b366c);var _0x1a6049=(_0x1524a5[_0x1d5e('0x32')]||0xa)*0x3e8;var _0x204396=(_0x51e51a[_0x1d5e('0x32')]||0x14)*0x3e8;var _0x4e5e93,_0x1cbefb;if(_0x1a6049>_0x204396){_0x204396=_0x1a6049;}var _0x204479=seqqueue[_0x1d5e('0x3b')](_0x1a6049);_0x204479['id']=_0x43ad3b;_0x204479['atimeout']=_0x1a6049;_0x204479['qtimeout']=_0x204396;_0x204479[_0x1d5e('0x21')]=_0x11a5bb['channel'];_0x4b366c[_0x1d5e('0x3c')][_0x43ad3b]['on']('end',function(){logger[_0x1d5e('0x28')](_0x1d5e('0x3d'),_0x43ad3b);stopRouting(_0x43ad3b,_0x1524a5,_0x11a5bb,_0x4b366c);clearTimeout(_0x4e5e93);_0x4e5e93=undefined;_0x204479['close'](!![]);if(_0x4b366c[_0x1d5e('0x3c')][_0x43ad3b]){delete _0x4b366c[_0x1d5e('0x3c')][_0x43ad3b];}_0x27dc87['stop']();});_0x4b366c[_0x1d5e('0x3c')][_0x43ad3b]['on']('complete',function(){if(_0x4b366c[_0x1d5e('0x3c')][_0x43ad3b]){delete _0x4b366c[_0x1d5e('0x3c')][_0x43ad3b];}});_0x4e5e93=setTimeout(function(){logger['info'](_0x1d5e('0x3e'),_0x43ad3b);endRouting(_0x43ad3b,_0x1524a5,_0x11a5bb,_0x4b366c);clearTimeout(_0x4e5e93);_0x204479[_0x1d5e('0x3f')](!![]);_0x27dc87[_0x1d5e('0x40')]();},_0x204396);switch(_0x1524a5[_0x1d5e('0x41')]){case _0x1d5e('0x42'):strategy[_0x1d5e('0x42')](_0x204479,_0x1524a5,_0x4b366c,_0x11a5bb);break;default:strategy[_0x1d5e('0x43')](_0x204479,_0x1524a5,_0x4b366c,_0x11a5bb);}}else{logger[_0x1d5e('0x2e')](_0x1d5e('0x44'),_0x43ad3b,_0x51e51a[_0x1d5e('0x2a')]);_0x27dc87[_0x1d5e('0x38')]();}}}catch(_0x343476){console[_0x1d5e('0x45')](_0x343476);logger['error'](_0x1d5e('0x46'),_0x43ad3b,_0x343476[_0x1d5e('0x47')]);_0x27dc87[_0x1d5e('0x38')]();}};}; \ No newline at end of file +var _0xf249=['emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','WebsiteId','info','name','QueueReport','create','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','join','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','seq-queue','moment','../../../../config/environment','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','queue','from'];(function(_0x596a99,_0x584f86){var _0x2af192=function(_0x3c66bb){while(--_0x3c66bb){_0x596a99['push'](_0x596a99['shift']());}};_0x2af192(++_0x584f86);}(_0xf249,0x8c));var _0x9f24=function(_0x311d8d,_0x7bbd63){_0x311d8d=_0x311d8d-0x0;var _0x1b1734=_0xf249[_0x311d8d];return _0x1b1734;};'use strict';var schema=require(_0x9f24('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x9f24('0x1'));var moment=require(_0x9f24('0x2'));var Redis=require('ioredis');var config=require(_0x9f24('0x3'));var logger=require('../../../../config/logger')(_0x9f24('0x4'));var strategy=require(_0x9f24('0x5'));config[_0x9f24('0x6')]=_[_0x9f24('0x7')](config[_0x9f24('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9f24('0x8'))(new Redis(config['redis']));var attributes=['id',_0x9f24('0x9'),'account',_0x9f24('0xa'),_0x9f24('0xb'),'joinAt'];function emit(_0x2e12df,_0x529036,_0x2bb653){io['to'](_0x2e12df)[_0x9f24('0xc')](_0x529036,_0x2bb653);}function emitChannelQueueInteraction(_0x2717f6,_0x59abf1,_0x4dda5a,_0x508751,_0x2719bd,_0x4fcd36,_0x47af64,_0x33dc69){var _0x1dbe87=_[_0x9f24('0xd')](_0x4dda5a);_0x1dbe87[_0x9f24('0x9')]=_0x33dc69;_0x1dbe87[_0x9f24('0xa')]=_0x59abf1;_0x1dbe87[_0x9f24('0xe')]=_0x508751;_0x1dbe87['id']=_0x2719bd;if(_0x4fcd36){_0x47af64[util[_0x9f24('0xf')](_0x9f24('0x10'),_0x2717f6)][_0x2719bd]=_[_0x9f24('0x11')](_0x1dbe87,attributes);}else{delete _0x47af64[util['format'](_0x9f24('0x10'),_0x2717f6)][_0x2719bd];}emit(util[_0x9f24('0xf')](_0x9f24('0x12'),_0x2717f6,_0x59abf1),util[_0x9f24('0xf')]('%s_queue_waiting_interaction:%s',_0x2717f6,_0x4fcd36?_0x9f24('0x13'):'remove'),_[_0x9f24('0x11')](_0x1dbe87,attributes));}var rpc={'openchannelQueueReport':require(_0x9f24('0x14')),'mailQueueReport':require(_0x9f24('0x15')),'chatQueueReport':require(_0x9f24('0x16')),'smsQueueReport':require(_0x9f24('0x17')),'faxQueueReport':require(_0x9f24('0x18')),'whatsappQueueReport':require(_0x9f24('0x19'))};var queue=schema({'name':{'type':_0x9f24('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9f24('0x1b'),'message':_0x9f24('0x1c')}});function startRouting(_0x15a1f4,_0x49f54e,_0x65081b,_0x59b58d){if(_0x15a1f4&&_0x49f54e&&_0x65081b){_0x49f54e[_0x9f24('0x1d')]+=0x1;var _0x4911ea={'uniqueid':_0x15a1f4,'from':_0x65081b[_0x9f24('0x1e')]?_0x65081b['body']['from']:'','joinAt':moment()['format'](_0x9f24('0x1f')),'ContactId':_0x65081b[_0x9f24('0x20')]?_0x65081b[_0x9f24('0x20')]['id']:null,'ListId':_0x65081b[_0x9f24('0x21')]?_0x65081b['list']['id']:null};_0x4911ea[_[_0x9f24('0x22')](_0x65081b[_0x9f24('0x23')])+_0x9f24('0x24')]=_0x49f54e['id']||null;_0x4911ea[_['upperFirst'](_0x65081b['channel'])+'InteractionId']=_0x65081b[_0x9f24('0x25')]?_0x65081b[_0x9f24('0x25')]['id']:null;_0x4911ea[_[_0x9f24('0x22')](_0x65081b[_0x9f24('0x23')])+'MessageId']=_0x65081b[_0x9f24('0x26')]?_0x65081b[_0x9f24('0x26')]['id']:null;_0x4911ea[_[_0x9f24('0x22')](_0x65081b[_0x9f24('0x23')])+(_0x65081b['channel']!==_0x9f24('0x27')?'AccountId':_0x9f24('0x28'))]=_0x65081b[_0x9f24('0xe')]?_0x65081b[_0x9f24('0xe')]['id']:null;logger[_0x9f24('0x29')](util[_0x9f24('0xf')]('[%s][START:QUEUE][NAME:%s]',_0x15a1f4,_0x49f54e[_0x9f24('0x2a')]));emitChannelQueueInteraction(_0x65081b[_0x9f24('0x23')],_0x49f54e[_0x9f24('0x2a')],_0x4911ea,_0x65081b[_0x9f24('0xe')][_0x9f24('0x2a')],_0x65081b['message']['id'],!![],_0x59b58d,_0x49f54e['id']);if(rpc[_0x65081b[_0x9f24('0x23')]+_0x9f24('0x2b')]){return rpc[_0x65081b[_0x9f24('0x23')]+'QueueReport'][_0x9f24('0x2c')](_0x4911ea)['catch'](function(_0x4926e6){logger[_0x9f24('0x2d')](_0x9f24('0x2e'));});}}}function stopRouting(_0x4c46ea,_0x457f35,_0x15ae6c,_0x973a8c){if(_0x4c46ea&&_0x457f35){_0x457f35[_0x9f24('0x1d')]-=0x1;var _0x2e1bf7={'leaveAt':moment()[_0x9f24('0xf')](_0x9f24('0x1f')),'acceptAt':moment()['format'](_0x9f24('0x1f')),'reason':'accepted'};logger[_0x9f24('0x29')](util['format'](_0x9f24('0x2f'),_0x4c46ea,_0x457f35[_0x9f24('0x2a')]));emitChannelQueueInteraction(_0x15ae6c[_0x9f24('0x23')],_0x457f35[_0x9f24('0x2a')],_0x15ae6c[_0x9f24('0x1e')],_0x15ae6c[_0x9f24('0xe')][_0x9f24('0x2a')],_0x15ae6c[_0x9f24('0x26')]['id'],![],_0x973a8c,_0x457f35['id']);if(rpc[_0x15ae6c[_0x9f24('0x23')]+_0x9f24('0x2b')]){return rpc[_0x15ae6c['channel']+_0x9f24('0x2b')]['update'](_0x4c46ea,_0x2e1bf7)[_0x9f24('0x30')](function(_0x23bc64){logger['error'](_0x9f24('0x31'));});}}}function endRouting(_0xc657dd,_0x4c536b,_0x39f911,_0x2cfca9){if(_0xc657dd&&_0x4c536b){_0x4c536b[_0x9f24('0x1d')]-=0x1;var _0x3e5038={'leaveAt':moment()['format'](_0x9f24('0x1f')),'exitAt':moment()[_0x9f24('0xf')](_0x9f24('0x1f')),'reason':'timeout'};logger[_0x9f24('0x29')](util[_0x9f24('0xf')](_0x9f24('0x32'),_0xc657dd,_0x4c536b[_0x9f24('0x2a')]));emitChannelQueueInteraction(_0x39f911[_0x9f24('0x23')],_0x4c536b['name'],_0x39f911['body'],_0x39f911[_0x9f24('0xe')][_0x9f24('0x2a')],_0x39f911['message']['id'],![],_0x2cfca9);if(rpc[_0x39f911['channel']+_0x9f24('0x2b')]){return rpc[_0x39f911[_0x9f24('0x23')]+_0x9f24('0x2b')][_0x9f24('0x33')](_0xc657dd,_0x3e5038)[_0x9f24('0x30')](function(_0x1c81d2){logger['error'](_0x9f24('0x31'));});}}}function handleFindQueue(_0x3a1ff8){return function(_0x63ef18){return _0x63ef18[_0x9f24('0x2a')][_0x9f24('0x34')]()===_0x3a1ff8[_0x9f24('0x34')]();};}exports[_0x9f24('0x35')]=function(_0x84bd8d,_0x3f6beb,_0x103cb5,_0x50fadd){return function(_0x524bf3){try{var _0x54907d={'name':_0x3f6beb[0x0],'timeout':_0x3f6beb[0x1]};var _0x40c0d0=queue[_0x9f24('0x0')](_0x54907d,{'typecast':!![]});if(_0x40c0d0[_0x9f24('0x36')]){logger[_0x9f24('0x2d')]('[%s][QUEUE]\x20%s',_0x84bd8d,_['map'](_0x40c0d0,_0x9f24('0x26'))[_0x9f24('0x37')](',\x20'));_0x524bf3['stop']();}else{var _0x4c39be=_[_0x9f24('0x38')](_0x103cb5[_0x50fadd[_0x9f24('0x23')]+_0x9f24('0x39')],handleFindQueue(_0x54907d[_0x9f24('0x2a')]));if(_0x4c39be){startRouting(_0x84bd8d,_0x4c39be,_0x50fadd,_0x103cb5);var _0xc6ff1d=(_0x4c39be['timeout']||0xa)*0x3e8;var _0x4386ff=(_0x54907d[_0x9f24('0x3a')]||0x14)*0x3e8;var _0x5acc4c,_0x3344ff;if(_0xc6ff1d>_0x4386ff){_0x4386ff=_0xc6ff1d;}var _0x4ba788=seqqueue[_0x9f24('0x3b')](_0xc6ff1d);_0x4ba788['id']=_0x84bd8d;_0x4ba788[_0x9f24('0x3c')]=_0xc6ff1d;_0x4ba788[_0x9f24('0x3d')]=_0x4386ff;_0x4ba788[_0x9f24('0x23')]=_0x50fadd['channel'];_0x103cb5[_0x9f24('0x3e')][_0x84bd8d]['on'](_0x9f24('0x3f'),function(){logger[_0x9f24('0x29')](_0x9f24('0x40'),_0x84bd8d);stopRouting(_0x84bd8d,_0x4c39be,_0x50fadd,_0x103cb5);clearTimeout(_0x5acc4c);_0x5acc4c=undefined;_0x4ba788['close'](!![]);if(_0x103cb5[_0x9f24('0x3e')][_0x84bd8d]){delete _0x103cb5[_0x9f24('0x3e')][_0x84bd8d];}_0x524bf3[_0x9f24('0x41')]();});_0x103cb5[_0x9f24('0x3e')][_0x84bd8d]['on'](_0x9f24('0x42'),function(){if(_0x103cb5['rules'][_0x84bd8d]){delete _0x103cb5[_0x9f24('0x3e')][_0x84bd8d];}});_0x5acc4c=setTimeout(function(){logger[_0x9f24('0x29')](_0x9f24('0x43'),_0x84bd8d);endRouting(_0x84bd8d,_0x4c39be,_0x50fadd,_0x103cb5);clearTimeout(_0x5acc4c);_0x4ba788['close'](!![]);_0x524bf3[_0x9f24('0x44')]();},_0x4386ff);switch(_0x4c39be[_0x9f24('0x45')]){case'rrmemory':strategy[_0x9f24('0x46')](_0x4ba788,_0x4c39be,_0x103cb5,_0x50fadd);break;default:strategy[_0x9f24('0x47')](_0x4ba788,_0x4c39be,_0x103cb5,_0x50fadd);}}else{logger['error'](_0x9f24('0x48'),_0x84bd8d,_0x54907d['name']);_0x524bf3[_0x9f24('0x41')]();}}}catch(_0x177394){console[_0x9f24('0x49')](_0x177394);logger[_0x9f24('0x2d')](_0x9f24('0x4a'),_0x84bd8d,_0x177394[_0x9f24('0x4b')]);_0x524bf3[_0x9f24('0x41')]();}};}; \ 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 7259a7e..583c83d 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 _0x89a1=['writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','busyQueue'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x89a1,0x1ca));var _0x189a=function(_0x3f65bf,_0x50517c){_0x3f65bf=_0x3f65bf-0x0;var _0x3a4c7d=_0x89a1[_0x3f65bf];return _0x3a4c7d;};'use strict';var _=require(_0x189a('0x0'));var uuid=require(_0x189a('0x1'));var util=require(_0x189a('0x2'));var logger=require('../../../../../config/logger')(_0x189a('0x3'));var Agent=function(_0x41ca2e,_0x33128b,_0x13b0e7,_0x3f92fc){this[_0x189a('0x4')]=uuid['v4']();this[_0x189a('0x5')]=_0x41ca2e;this[_0x189a('0x6')]=_0x33128b;this[_0x189a('0x7')]=_0x13b0e7;this[_0x189a('0x3')]=_0x3f92fc;this['squeue'][_0x189a('0x8')](this[_0x189a('0x9')][_0x189a('0xa')](this),this[_0x189a('0xb')][_0x189a('0xa')](this));this[_0x189a('0x5')]['on'](_0x189a('0xc'),this[_0x189a('0xb')][_0x189a('0xa')](this));this['squeue']['on'](_0x189a('0xd'),this[_0x189a('0xe')]['bind'](this));};Agent[_0x189a('0xf')][_0x189a('0x8')]=function(){this[_0x189a('0x5')][_0x189a('0x8')](this['handleRun'][_0x189a('0xa')](this),this[_0x189a('0xb')][_0x189a('0xa')](this));};Agent[_0x189a('0xf')][_0x189a('0xe')]=function(){this['handleTimeout'](!![]);};Agent['prototype']['handleRun']=function(_0x131fe4){logger[_0x189a('0x10')](_0x189a('0x11'),this[_0x189a('0x5')]['id'],this[_0x189a('0x6')]['id']);if(_['isNil'](this[_0x189a('0x7')]['agents'][this[_0x189a('0x6')]['id']])){logger['info'](_0x189a('0x12'),this[_0x189a('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x189a('0x8')]['bind'](this),0x3e8);}else{if(this[_0x189a('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x189a('0x5')]['id'],this[_0x189a('0x7')][_0x189a('0x13')][this['agent']['id']],this['squeue'][_0x189a('0x14')],![])){this[_0x189a('0x7')][_0x189a('0x13')][this[_0x189a('0x6')]['id']]['busy']=!![];this[_0x189a('0x7')][_0x189a('0x13')][this[_0x189a('0x6')]['id']][_0x189a('0x15')]=undefined;util['showNotification'](this[_0x189a('0x4')],this[_0x189a('0x5')]['id'],this[_0x189a('0x7')][_0x189a('0x13')][this[_0x189a('0x6')]['id']],null,this[_0x189a('0x3')]);util[_0x189a('0x16')](this[_0x189a('0x5')]['id'],this[_0x189a('0x7')][_0x189a('0x13')][this['agent']['id']],_0x189a('0x17')+(this[_0x189a('0x3')]['forcedOwnership']?_0x189a('0x18'):''));}else{logger[_0x189a('0x10')](_0x189a('0x19'),this['squeue']['id'],this[_0x189a('0x6')]['id']);setTimeout(this[_0x189a('0x8')][_0x189a('0xa')](this),0x3e8);}}};Agent[_0x189a('0xf')]['handleTimeout']=function(_0x657374){if(_[_0x189a('0x1a')](this[_0x189a('0x7')][_0x189a('0x13')][this[_0x189a('0x6')]['id']])){return logger[_0x189a('0x10')](_0x189a('0x12'),this[_0x189a('0x5')]['id'],this[_0x189a('0x6')]['id']);}else{logger[_0x189a('0x10')](_0x189a('0x1b'),this[_0x189a('0x5')]['id'],this[_0x189a('0x6')]['id']);util[_0x189a('0x1c')](this[_0x189a('0x4')],this[_0x189a('0x5')]['id'],this[_0x189a('0x7')]['agents'][this[_0x189a('0x6')]['id']],null,this[_0x189a('0x3')]);this[_0x189a('0x7')][_0x189a('0x13')][this[_0x189a('0x6')]['id']][_0x189a('0x1d')]=![];this[_0x189a('0x7')][_0x189a('0x13')][this[_0x189a('0x6')]['id']][_0x189a('0x15')]=undefined;util['writeLog'](this[_0x189a('0x5')]['id'],this[_0x189a('0x7')]['agents'][this[_0x189a('0x6')]['id']],_0x657374?_0x189a('0x1e'):_0x189a('0x1f'));}if(!_0x657374){setTimeout(this[_0x189a('0x8')][_0x189a('0xa')](this),0x3e8);}};function agent(_0x1024bf,_0x1129d4,_0x2f63aa,_0x37a762){return new Agent(_0x1024bf,_0x1129d4,_0x2f63aa,_0x37a762);}module['exports']=agent; \ No newline at end of file +var _0xbad7=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','push','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','busyQueue','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x11b243,_0x2683f2){var _0x176c5c=function(_0x2d15cc){while(--_0x2d15cc){_0x11b243['push'](_0x11b243['shift']());}};_0x176c5c(++_0x2683f2);}(_0xbad7,0x1b1));var _0x7bad=function(_0x36f102,_0x212728){_0x36f102=_0x36f102-0x0;var _0x3d860c=_0xbad7[_0x36f102];return _0x3d860c;};'use strict';var _=require(_0x7bad('0x0'));var uuid=require(_0x7bad('0x1'));var util=require(_0x7bad('0x2'));var logger=require('../../../../../config/logger')(_0x7bad('0x3'));var Agent=function(_0x54364f,_0x3b6652,_0xdb9073,_0x17eb60){this[_0x7bad('0x4')]=uuid['v4']();this[_0x7bad('0x5')]=_0x54364f;this[_0x7bad('0x6')]=_0x3b6652;this[_0x7bad('0x7')]=_0xdb9073;this[_0x7bad('0x3')]=_0x17eb60;this['squeue']['push'](this[_0x7bad('0x8')][_0x7bad('0x9')](this),this[_0x7bad('0xa')][_0x7bad('0x9')](this));this[_0x7bad('0x5')]['on'](_0x7bad('0xb'),this['handleTimeout']['bind'](this));this[_0x7bad('0x5')]['on'](_0x7bad('0xc'),this[_0x7bad('0xd')][_0x7bad('0x9')](this));};Agent['prototype'][_0x7bad('0xe')]=function(){this[_0x7bad('0x5')][_0x7bad('0xe')](this['handleRun'][_0x7bad('0x9')](this),this[_0x7bad('0xa')][_0x7bad('0x9')](this));};Agent['prototype'][_0x7bad('0xd')]=function(){this[_0x7bad('0xa')](!![]);};Agent[_0x7bad('0xf')]['handleRun']=function(_0x32645f){logger['info'](_0x7bad('0x10'),this[_0x7bad('0x5')]['id'],this[_0x7bad('0x6')]['id']);if(_[_0x7bad('0x11')](this[_0x7bad('0x7')]['agents'][this['agent']['id']])){logger[_0x7bad('0x12')](_0x7bad('0x13'),this['squeue']['id'],this[_0x7bad('0x6')]['id']);setTimeout(this[_0x7bad('0xe')][_0x7bad('0x9')](this),0x3e8);}else{if(this[_0x7bad('0x3')]['forcedOwnership']||util[_0x7bad('0x14')](this[_0x7bad('0x5')]['id'],this['realtime'][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']],this[_0x7bad('0x5')][_0x7bad('0x16')],![])){this[_0x7bad('0x7')][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']]['busy']=!![];this['realtime'][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']][_0x7bad('0x17')]=undefined;util['showNotification'](this[_0x7bad('0x4')],this[_0x7bad('0x5')]['id'],this[_0x7bad('0x7')][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']],null,this[_0x7bad('0x3')]);util[_0x7bad('0x18')](this[_0x7bad('0x5')]['id'],this[_0x7bad('0x7')][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']],_0x7bad('0x19')+(this['routing'][_0x7bad('0x1a')]?_0x7bad('0x1b'):''));}else{logger[_0x7bad('0x12')](_0x7bad('0x1c'),this[_0x7bad('0x5')]['id'],this[_0x7bad('0x6')]['id']);setTimeout(this[_0x7bad('0xe')][_0x7bad('0x9')](this),0x3e8);}}};Agent[_0x7bad('0xf')][_0x7bad('0xa')]=function(_0x4fe9db){if(_['isNil'](this[_0x7bad('0x7')]['agents'][this[_0x7bad('0x6')]['id']])){return logger[_0x7bad('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7bad('0x5')]['id'],this['agent']['id']);}else{logger['info'](_0x7bad('0x1d'),this[_0x7bad('0x5')]['id'],this[_0x7bad('0x6')]['id']);util[_0x7bad('0x1e')](this[_0x7bad('0x4')],this[_0x7bad('0x5')]['id'],this[_0x7bad('0x7')][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']],null,this[_0x7bad('0x3')]);this['realtime'][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']][_0x7bad('0x1f')]=![];this[_0x7bad('0x7')][_0x7bad('0x15')][this['agent']['id']][_0x7bad('0x17')]=undefined;util['writeLog'](this['squeue']['id'],this[_0x7bad('0x7')][_0x7bad('0x15')][this[_0x7bad('0x6')]['id']],_0x4fe9db?'STOP':'TIMEOUT');}if(!_0x4fe9db){setTimeout(this[_0x7bad('0xe')][_0x7bad('0x9')](this),0x3e8);}};function agent(_0xa46a03,_0x19b535,_0x10f9b7,_0x2e0064){return new Agent(_0xa46a03,_0x19b535,_0x10f9b7,_0x2e0064);}module[_0x7bad('0x20')]=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 581d164..eaa344e 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 _0xc01b=['prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x55bc68,_0x4913cc){var _0x27c174=function(_0x13f177){while(--_0x13f177){_0x55bc68['push'](_0x55bc68['shift']());}};_0x27c174(++_0x4913cc);}(_0xc01b,0x74));var _0xbc01=function(_0x203391,_0x13397b){_0x203391=_0x203391-0x0;var _0x1db778=_0xc01b[_0x203391];return _0x1db778;};'use strict';var _=require(_0xbc01('0x0'));var uuid=require(_0xbc01('0x1'));var util=require(_0xbc01('0x2'));var logger=require(_0xbc01('0x3'))(_0xbc01('0x4'));var Beepall=function(_0x16a6ae,_0x2fa563,_0x5ede59,_0x2c35d0){this[_0xbc01('0x5')]=uuid['v4']();this[_0xbc01('0x6')]=_0x16a6ae;this[_0xbc01('0x7')]=_0x2fa563;this[_0xbc01('0x8')]=_0x5ede59;this[_0xbc01('0x4')]=_0x2c35d0;this[_0xbc01('0x6')][_0xbc01('0x9')](this[_0xbc01('0xa')][_0xbc01('0xb')](this),this[_0xbc01('0xc')]['bind'](this));this['squeue']['on'](_0xbc01('0xd'),this[_0xbc01('0xc')][_0xbc01('0xb')](this));this[_0xbc01('0x6')]['on'](_0xbc01('0xe'),this[_0xbc01('0xf')][_0xbc01('0xb')](this));};Beepall['prototype'][_0xbc01('0x9')]=function(){this[_0xbc01('0x6')][_0xbc01('0x9')](this['handleRun'][_0xbc01('0xb')](this),this[_0xbc01('0xc')][_0xbc01('0xb')](this));};Beepall['prototype']['handleDrained']=function(_0x5b3eaf){this[_0xbc01('0xc')](!![]);};Beepall[_0xbc01('0x10')][_0xbc01('0xa')]=function(_0x166fa5){var _0x53019e=!![];if(!_[_0xbc01('0x11')](this[_0xbc01('0x7')])&&!_[_0xbc01('0x11')](this[_0xbc01('0x7')][_0xbc01('0x12')])&&this[_0xbc01('0x7')][_0xbc01('0x12')][_0xbc01('0x13')]>0x0){for(var _0x1e3105=0x0,_0x4af959;_0x1e31050x0){for(var _0x4571f5=0x0,_0x184652;_0x4571f50x0&&_0x502c2e[_0x18680f+'CurrentCapacity']>=_0x502c2e[_0x18680f+'Capacity']){writeLog(_0x379cbd,_0x502c2e,_0x18680f[_0x5645('0x27')]()+_0x5645('0x28'));return![];}}return!![];};exports[_0x5645('0x29')]=function(_0x308991,_0x3a5c61,_0x351cbb,_0x3b9d8e,_0xc585f3){return sendNotification(!![],_0x308991,_0x3a5c61,_0x351cbb,_0x3b9d8e,_0xc585f3);};exports[_0x5645('0x2a')]=function(_0x30a5d0,_0x1c0aa2,_0x2154a7,_0x406782,_0xa2a4a1){return sendNotification(![],_0x30a5d0,_0x1c0aa2,_0x2154a7,_0x406782,_0xa2a4a1);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x32f4=['../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','name','user:save','split','\x20interaction','notificationSound','account','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','emit','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','../utils','mustache'];(function(_0xa4710c,_0x221e72){var _0x410ab8=function(_0x479101){while(--_0x479101){_0xa4710c['push'](_0xa4710c['shift']());}};_0x410ab8(++_0x221e72);}(_0x32f4,0x154));var _0x432f=function(_0x1d5610,_0x152b31){_0x1d5610=_0x1d5610-0x0;var _0x3b75cd=_0x32f4[_0x1d5610];return _0x3b75cd;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var utils=require(_0x432f('0x2'));var Mustache=require(_0x432f('0x3'));var Redis=require('ioredis');var config=require(_0x432f('0x4'));var logger=require(_0x432f('0x5'))('routing');config[_0x432f('0x6')]=_[_0x432f('0x7')](config[_0x432f('0x6')],{'host':_0x432f('0x8'),'port':0x18eb});var io=require(_0x432f('0x9'))(new Redis(config['redis']));function emit(_0x5b5f08,_0x2f66fd,_0x32b062){io['to'](_0x5b5f08)['emit'](_0x2f66fd,_0x32b062);}function sendNotification(_0x2a2ef6,_0x5aaf1a,_0x1cdcfd,_0x340fe9,_0x3a0d4b,_0x13369a){io['to'](util[_0x432f('0xa')]('user:%s',_0x340fe9[_0x432f('0xb')]))['emit'](_0x432f('0xc'),_0x340fe9);var _0x4b6c02=_0x13369a||{};var _0x138967=_0x1cdcfd[_0x432f('0xd')]('.');var _0x53459c={'uniqueid':_0x5aaf1a,'channel':_0x138967[0x0],'id':_0x138967[0x1],'title':_0x138967[0x0]+_0x432f('0xe'),'interactionId':_0x138967[0x2],'queue':_0x3a0d4b?_0x3a0d4b[_0x432f('0xb')]:null,'sound':_0x4b6c02['account'][_0x432f('0xf')],'shake':_0x4b6c02[_0x432f('0x10')]['notificationShake']};try{if(!_0x4b6c02['body']){_0x4b6c02[_0x432f('0x11')]={};}if(_0x3a0d4b){_0x4b6c02[_0x432f('0x11')][_0x432f('0x12')]=_0x3a0d4b;}else if(_0x4b6c02[_0x432f('0x11')][_0x432f('0x12')]){delete _0x4b6c02['body'][_0x432f('0x12')];}_0x53459c[_0x432f('0x13')]=utils[_0x432f('0x14')](_0x4b6c02[_0x432f('0x10')]['notificationTemplate'],_0x4b6c02);}catch(_0xdd0293){_0x53459c[_0x432f('0x13')]=_0x432f('0x15');logger[_0x432f('0x16')](util[_0x432f('0xa')](_0x432f('0x17'),_0x5aaf1a,_0xdd0293['message']));}io['to'](util[_0x432f('0xa')]('user:%s',_0x340fe9[_0x432f('0xb')]))[_0x432f('0x18')](util[_0x432f('0xa')](_0x432f('0x19'),_0x2a2ef6?_0x432f('0x1a'):_0x432f('0x1b')),_0x53459c);}function writeLog(_0x10f39b,_0x1899e6,_0x693eb3){return logger[_0x432f('0x1c')](util[_0x432f('0xa')](_0x432f('0x1d'),_0x10f39b,_0x1899e6['name'],_0x693eb3));}exports['isAgentAvailable']=function(_0x343d13,_0x5c4deb,_0x28968e,_0x5b9c70){if(_0x5c4deb[_0x432f('0x1e')]){writeLog(_0x343d13,_0x5c4deb,_0x432f('0x1f'));return![];}if(!_0x5c4deb[_0x432f('0x20')]){writeLog(_0x343d13,_0x5c4deb,_0x432f('0x21'));return![];}if(_0x5c4deb[_0x28968e+_0x432f('0x22')]){writeLog(_0x343d13,_0x5c4deb,_0x432f('0x23'));return![];}if(_0x5b9c70&&_0x5c4deb['hasOwnProperty'](_0x28968e+_0x432f('0x24'))&&_0x5c4deb[_0x432f('0x25')](_0x28968e+'CurrentCapacity')){if(_0x5c4deb[_0x28968e+_0x432f('0x24')]>0x0&&_0x5c4deb[_0x28968e+_0x432f('0x26')]>=_0x5c4deb[_0x28968e+_0x432f('0x24')]){writeLog(_0x343d13,_0x5c4deb,_0x28968e[_0x432f('0x27')]()+_0x432f('0x28'));return![];}}return!![];};exports[_0x432f('0x29')]=function(_0x138a6a,_0x5a3d18,_0x294bfe,_0x4eeae1,_0x1f1fdd){return sendNotification(!![],_0x138a6a,_0x5a3d18,_0x294bfe,_0x4eeae1,_0x1f1fdd);};exports['hideNotification']=function(_0x20404d,_0x5a2c14,_0x3f768b,_0x489ba6,_0x325a9c){return sendNotification(![],_0x20404d,_0x5a2c14,_0x3f768b,_0x489ba6,_0x325a9c);};exports[_0x432f('0x2a')]=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 3069633..3e42c1f 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 _0x8ece=['join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','validate','shelljs','lodash','./utils','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x582826,_0x4baa25){var _0x2a5def=function(_0x52a2e2){while(--_0x52a2e2){_0x582826['push'](_0x582826['shift']());}};_0x2a5def(++_0x4baa25);}(_0x8ece,0x195));var _0xe8ec=function(_0x48ad4e,_0x2b0e9f){_0x48ad4e=_0x48ad4e-0x0;var _0x505b15=_0x8ece[_0x48ad4e];return _0x505b15;};'use strict';var schema=require(_0xe8ec('0x0'));var sh=require(_0xe8ec('0x1'));var _=require(_0xe8ec('0x2'));var utils=require(_0xe8ec('0x3'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0xe8ec('0x4'),'required':!![],'message':_0xe8ec('0x5')}});exports[_0xe8ec('0x6')]=function(_0x433734,_0x79f756){return function(_0x4f2e7f){try{var _0x346577={'command':_0x79f756[0x0]};var _0x23fa35=system[_0xe8ec('0x0')](_0x346577,{'typecast':!![]});if(_0x23fa35[_0xe8ec('0x7')]){logger[_0xe8ec('0x8')](_0xe8ec('0x9'),_0x433734,_[_0xe8ec('0xa')](_0x23fa35,'message')[_0xe8ec('0xb')](',\x20'));logger['info'](_0xe8ec('0xc'),_0x433734);_0x4f2e7f['next']();}else{var _0x1b0a84=this;var _0x278f86=utils[_0xe8ec('0xd')](_0x79f756[0x0],this);logger[_0xe8ec('0xe')](_0xe8ec('0xf'),_0x433734,_0x278f86);sh[_0xe8ec('0x10')](_[_0xe8ec('0x11')](_0x278f86),function(_0x33cf9b,_0x4f361f){logger[_0xe8ec('0xe')](_0xe8ec('0x12'),_0x433734,_0x33cf9b);if(_0x33cf9b==0x0){var _0x153203=_0x4f361f[_0xe8ec('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x79f756[0x1])||_[_0xe8ec('0x14')](_0x79f756[0x1])){logger[_0xe8ec('0xe')](_0xe8ec('0x15'),_0x433734);_0x1b0a84[_0xe8ec('0x16')][_0x79f756[0x1]]=_0x153203;}else{logger[_0xe8ec('0xe')](_0xe8ec('0x17'),_0x433734,_0x79f756[0x1],_0x153203);_0x1b0a84[_0xe8ec('0x16')][_0x79f756[0x1]]=_0x153203;}}_0x4f2e7f[_0xe8ec('0x18')]();});}}catch(_0x531f69){logger[_0xe8ec('0x8')](_0xe8ec('0x9'),_0x433734,_[_0xe8ec('0x19')](_0x531f69)?JSON['stringify'](_0x531f69):_0x531f69);logger[_0xe8ec('0xe')](_0xe8ec('0xc'),_0x433734);_0x4f2e7f[_0xe8ec('0x18')]();}};}; \ No newline at end of file +var _0x9d5b=['error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length'];(function(_0x458a6e,_0xc6a2ec){var _0x3ad477=function(_0x4d9589){while(--_0x4d9589){_0x458a6e['push'](_0x458a6e['shift']());}};_0x3ad477(++_0xc6a2ec);}(_0x9d5b,0x71));var _0xb9d5=function(_0x56364e,_0x38bdf1){_0x56364e=_0x56364e-0x0;var _0x4ec8cf=_0x9d5b[_0x56364e];return _0x4ec8cf;};'use strict';var schema=require(_0xb9d5('0x0'));var sh=require('shelljs');var _=require(_0xb9d5('0x1'));var utils=require(_0xb9d5('0x2'));var logger=require(_0xb9d5('0x3'))('routing');var system=schema({'command':{'type':_0xb9d5('0x4'),'required':!![],'message':_0xb9d5('0x5')}});exports['consequence']=function(_0x241166,_0x3fbcbf){return function(_0xbddd22){try{var _0x450d40={'command':_0x3fbcbf[0x0]};var _0x858576=system[_0xb9d5('0x0')](_0x450d40,{'typecast':!![]});if(_0x858576[_0xb9d5('0x6')]){logger[_0xb9d5('0x7')]('[%s][SYSTEM]\x20%s',_0x241166,_[_0xb9d5('0x8')](_0x858576,_0xb9d5('0x9'))[_0xb9d5('0xa')](',\x20'));logger[_0xb9d5('0xb')](_0xb9d5('0xc'),_0x241166);_0xbddd22[_0xb9d5('0xd')]();}else{var _0xfb89d0=this;var _0x1c2091=utils[_0xb9d5('0xe')](_0x3fbcbf[0x0],this);logger[_0xb9d5('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x241166,_0x1c2091);sh[_0xb9d5('0xf')](_[_0xb9d5('0x10')](_0x1c2091),function(_0xddc836,_0x3d5678){logger[_0xb9d5('0xb')](_0xb9d5('0x11'),_0x241166,_0xddc836);if(_0xddc836==0x0){var _0x2769f8=_0x3d5678[_0xb9d5('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xb9d5('0x13')](_0x3fbcbf[0x1])||_['isEmpty'](_0x3fbcbf[0x1])){logger['info'](_0xb9d5('0x14'),_0x241166);_0xfb89d0[_0xb9d5('0x15')][_0x3fbcbf[0x1]]=_0x2769f8;}else{logger[_0xb9d5('0xb')](_0xb9d5('0x16'),_0x241166,_0x3fbcbf[0x1],_0x2769f8);_0xfb89d0[_0xb9d5('0x15')][_0x3fbcbf[0x1]]=_0x2769f8;}}_0xbddd22['next']();});}}catch(_0x3bff18){logger[_0xb9d5('0x7')]('[%s][SYSTEM]\x20%s',_0x241166,_[_0xb9d5('0x17')](_0x3bff18)?JSON['stringify'](_0x3bff18):_0x3bff18);logger[_0xb9d5('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x241166);_0xbddd22[_0xb9d5('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 8e02d72..1b0ced9 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 _0x6617=['stringify','finally','next','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x34f270,_0x26851b){var _0x172825=function(_0x12b1a1){while(--_0x12b1a1){_0x34f270['push'](_0x34f270['shift']());}};_0x172825(++_0x26851b);}(_0x6617,0x157));var _0x7661=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x6617[_0x43a37c];return _0x5d1d40;};'use strict';var schema=require(_0x7661('0x0'));var _=require(_0x7661('0x1'));var rpc={'chatInteraction':require(_0x7661('0x2')),'openchannelInteraction':require(_0x7661('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7661('0x4')),'faxInteraction':require(_0x7661('0x5')),'whatsappInteraction':require(_0x7661('0x6'))};var logger=require('../../../../config/logger')(_0x7661('0x7'));var tag=schema({'tag':{'type':_0x7661('0x8'),'required':!![],'message':_0x7661('0x9')}});exports[_0x7661('0xa')]=function(_0x191658,_0x4be046,_0x5bd8a4,_0xb4046d){return function(_0x59cc50){try{var _0x26f961={'tag':_0x4be046[0x0]};var _0x2a7668=tag[_0x7661('0x0')](_0x26f961,{'typecast':!![]});if(_0x2a7668[_0x7661('0xb')]){logger[_0x7661('0xc')]('[%s][TAG]\x20%s',_0x191658,_[_0x7661('0xd')](_0x2a7668,_0x7661('0xe'))['join'](',\x20'));logger[_0x7661('0xf')](_0x7661('0x10'),_0x191658);_0x59cc50['next']();}else{var _0x3bb9cd={'ids':[_0x4be046[0x0]]};if(rpc[_0xb4046d['channel']+_0x7661('0x11')]){rpc[_0xb4046d[_0x7661('0x12')]+_0x7661('0x11')]['addTags'](_0xb4046d[_0x7661('0x13')]['id'],_0x3bb9cd)['then'](function(_0x361dfc){logger['info'](_0x7661('0x14'),_0x191658,_0x4be046[0x1],_0xb4046d['channel'],_0xb4046d[_0x7661('0x13')]['id']);})['catch'](function(_0x8f4fa7){logger['error']('[%s][TAG]\x20%s',_0x191658,JSON[_0x7661('0x15')](_0x8f4fa7));logger[_0x7661('0xf')](_0x7661('0x10'),_0x191658);})[_0x7661('0x16')](function(){_0x59cc50[_0x7661('0x17')]();});}}}catch(_0x2fa02a){logger[_0x7661('0xc')](_0x7661('0x18'),_0x191658,_[_0x7661('0x19')](_0x2fa02a)?JSON[_0x7661('0x15')](_0x2fa02a):_0x2fa02a);logger[_0x7661('0xf')](_0x7661('0x10'),_0x191658);_0x59cc50[_0x7661('0x17')]();}};}; \ No newline at end of file +var _0xb745=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb745,0x74));var _0x5b74=function(_0x549a09,_0x2fe584){_0x549a09=_0x549a09-0x0;var _0x3ef978=_0xb745[_0x549a09];return _0x3ef978;};'use strict';var schema=require(_0x5b74('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x5b74('0x1')),'openchannelInteraction':require(_0x5b74('0x2')),'smsInteraction':require(_0x5b74('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x5b74('0x4'))('routing');var tag=schema({'tag':{'type':_0x5b74('0x5'),'required':!![],'message':_0x5b74('0x6')}});exports[_0x5b74('0x7')]=function(_0x404643,_0x415942,_0x259178,_0x49a626){return function(_0x331335){try{var _0x421467={'tag':_0x415942[0x0]};var _0x1a01eb=tag[_0x5b74('0x0')](_0x421467,{'typecast':!![]});if(_0x1a01eb[_0x5b74('0x8')]){logger[_0x5b74('0x9')](_0x5b74('0xa'),_0x404643,_[_0x5b74('0xb')](_0x1a01eb,_0x5b74('0xc'))[_0x5b74('0xd')](',\x20'));logger[_0x5b74('0xe')](_0x5b74('0xf'),_0x404643);_0x331335['next']();}else{var _0x1da2f9={'ids':[_0x415942[0x0]]};if(rpc[_0x49a626[_0x5b74('0x10')]+_0x5b74('0x11')]){rpc[_0x49a626[_0x5b74('0x10')]+'Interaction'][_0x5b74('0x12')](_0x49a626[_0x5b74('0x13')]['id'],_0x1da2f9)[_0x5b74('0x14')](function(_0x3e2415){logger[_0x5b74('0xe')](_0x5b74('0x15'),_0x404643,_0x415942[0x1],_0x49a626[_0x5b74('0x10')],_0x49a626[_0x5b74('0x13')]['id']);})[_0x5b74('0x16')](function(_0x26fb3a){logger[_0x5b74('0x9')](_0x5b74('0xa'),_0x404643,JSON[_0x5b74('0x17')](_0x26fb3a));logger[_0x5b74('0xe')](_0x5b74('0xf'),_0x404643);})[_0x5b74('0x18')](function(){_0x331335[_0x5b74('0x19')]();});}}}catch(_0x2c96a9){logger['error'](_0x5b74('0xa'),_0x404643,_[_0x5b74('0x1a')](_0x2c96a9)?JSON[_0x5b74('0x17')](_0x2c96a9):_0x2c96a9);logger['info'](_0x5b74('0xf'),_0x404643);_0x331335['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 60ec063..b7a24ca 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 _0x3d48=['stringify','POST','parse','result','&serviceId=','&sessionId=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','routing','consequence','replace','\x20-\x20','includes','push','urlOnRing','title','jsonrpc','method','params'];(function(_0x5d92c6,_0x314ed2){var _0xd47311=function(_0x11f7e6){while(--_0x11f7e6){_0x5d92c6['push'](_0x5d92c6['shift']());}};_0xd47311(++_0x314ed2);}(_0x3d48,0xa4));var _0x83d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3d48[_0x4565bf];return _0x5610ba;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0x83d4('0x0'));var _=require('lodash');var arr=[];exports[_0x83d4('0x1')]=function(_0xdeda4c,_0x3f667d){return function(_0x4ee4bd){var _0x43a39b=_0x3f667d[0xa];var _0x5b506f=_0x3f667d[0xb];var _0x6a6d80=_0x3f667d[0xc];var _0x5364c7=_0x3f667d[0xd];var _0x5e16c3=_0x3f667d[0xe];var _0x59861d=_0x3f667d[0xf][_0x83d4('0x2')](/\n/g,_0x83d4('0x3'));var _0x4285f8=_0x3f667d[0x10][_0x83d4('0x2')](/\n/g,'\x20');if(!arr[_0x83d4('0x4')](_0x5b506f)){arr[_0x83d4('0x5')](_0x5b506f);var _0x2a0d8f=_0x3f667d[0x3];var _0x158a5f=_0x3f667d[0x4];var _0x5214c1=_0x3f667d[0x1];var _0x3a8896=_0x3f667d[0x0];var _0x42632f={};_0x42632f['urlOnAnswer']=_0x3f667d[0x8]+'?params='+_0x6a6d80+'|'+_0x43a39b+'|'+_0x5364c7+'|'+_0x5b506f+'|'+_0x5e16c3;_0x42632f[_0x83d4('0x6')]=_0x3f667d[0x7]+'?params='+_0x6a6d80+'|'+_0x43a39b+'|'+_0x5364c7+'|'+_0x5b506f+'|'+_0x5e16c3+'|'+_0x59861d+'|'+_0x4285f8;_0x42632f[_0x83d4('0x7')]=_0x3f667d[0x9];var _0x39bc7e={};_0x39bc7e[_0x83d4('0x8')]='2.0';_0x39bc7e[_0x83d4('0x9')]='login';var _0x1036b6=[];_0x1036b6[_0x83d4('0x5')](_0x3f667d[0x2]);_0x1036b6[_0x83d4('0x5')](_0x3f667d[0x5]);_0x1036b6[_0x83d4('0x5')](_0x3f667d[0x6]);_0x39bc7e[_0x83d4('0xa')]=_0x1036b6;_0x39bc7e['id']=0x1;var _0x48a7a3=JSON[_0x83d4('0xb')](_0x39bc7e);var _0x24d8ba={'encoding':'utf8','method':_0x83d4('0xc'),'timeout':0x2710,'url':_0x2a0d8f,'headers':{'Content-Type':'application/json-rpc'},'body':_0x48a7a3};return rp(_0x24d8ba)['then'](function(_0x5f1ecd){const _0x13ac92=JSON[_0x83d4('0xd')](_0x5f1ecd);if(!_0x13ac92[_0x83d4('0xe')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x38f862=_0x5b506f;var _0x4124e0='channelId='+_0x5214c1+_0x83d4('0xf')+_0x3a8896+_0x83d4('0x10')+_0x38f862+'&data='+JSON[_0x83d4('0xb')](_0x42632f);var _0x16c44e=_0x158a5f+'?'+_0x4124e0;return rp(_0x16c44e);})[_0x83d4('0x11')](function(_0x1976fc){logger['info'](_0x83d4('0x12'),_0xdeda4c,_0x1976fc);_0x4ee4bd[_0x83d4('0x13')]();})['catch'](function(_0x1e993a){logger[_0x83d4('0x14')](_0x83d4('0x15'),_0xdeda4c,_['isObject'](_0x1e993a)?JSON['stringify'](_0x1e993a):_0x1e993a);_0x4ee4bd['stop']();});}else{logger[_0x83d4('0x16')](_0x83d4('0x17'),_0xdeda4c);_0x4ee4bd[_0x83d4('0x18')]();}};}; \ No newline at end of file +var _0x74b9=['includes','push','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace'];(function(_0x30ff16,_0x9b3593){var _0x3b8d36=function(_0xe59d95){while(--_0xe59d95){_0x30ff16['push'](_0x30ff16['shift']());}};_0x3b8d36(++_0x9b3593);}(_0x74b9,0x161));var _0x974b=function(_0x45bb2b,_0x517c5d){_0x45bb2b=_0x45bb2b-0x0;var _0x494536=_0x74b9[_0x45bb2b];return _0x494536;};'use strict';var rp=require(_0x974b('0x0'));var logger=require(_0x974b('0x1'))(_0x974b('0x2'));var _=require(_0x974b('0x3'));var arr=[];exports[_0x974b('0x4')]=function(_0x11280a,_0x44a46f){return function(_0x555b92){var _0x1af0e3=_0x44a46f[0xa];var _0x19ec9f=_0x44a46f[0xb];var _0x51e37e=_0x44a46f[0xc];var _0x2c420d=_0x44a46f[0xd];var _0x4b5a35=_0x44a46f[0xe];var _0x3c40f9=_0x44a46f[0xf]['replace'](/\n/g,_0x974b('0x5'));var _0x340ce5=_0x44a46f[0x10][_0x974b('0x6')](/\n/g,'\x20');if(!arr[_0x974b('0x7')](_0x19ec9f)){arr[_0x974b('0x8')](_0x19ec9f);var _0x3620be=_0x44a46f[0x3];var _0x2597d5=_0x44a46f[0x4];var _0x16f6dc=_0x44a46f[0x1];var _0x24e1f7=_0x44a46f[0x0];var _0x96f30e={};_0x96f30e['urlOnAnswer']=_0x44a46f[0x8]+_0x974b('0x9')+_0x51e37e+'|'+_0x1af0e3+'|'+_0x2c420d+'|'+_0x19ec9f+'|'+_0x4b5a35;_0x96f30e[_0x974b('0xa')]=_0x44a46f[0x7]+_0x974b('0x9')+_0x51e37e+'|'+_0x1af0e3+'|'+_0x2c420d+'|'+_0x19ec9f+'|'+_0x4b5a35+'|'+_0x3c40f9+'|'+_0x340ce5;_0x96f30e[_0x974b('0xb')]=_0x44a46f[0x9];var _0x5c0b69={};_0x5c0b69[_0x974b('0xc')]=_0x974b('0xd');_0x5c0b69[_0x974b('0xe')]=_0x974b('0xf');var _0x42a7c0=[];_0x42a7c0[_0x974b('0x8')](_0x44a46f[0x2]);_0x42a7c0['push'](_0x44a46f[0x5]);_0x42a7c0[_0x974b('0x8')](_0x44a46f[0x6]);_0x5c0b69[_0x974b('0x10')]=_0x42a7c0;_0x5c0b69['id']=0x1;var _0x38a4c8=JSON[_0x974b('0x11')](_0x5c0b69);var _0x56f487={'encoding':'utf8','method':_0x974b('0x12'),'timeout':0x2710,'url':_0x3620be,'headers':{'Content-Type':_0x974b('0x13')},'body':_0x38a4c8};return rp(_0x56f487)[_0x974b('0x14')](function(_0x2d164e){const _0x861122=JSON[_0x974b('0x15')](_0x2d164e);if(!_0x861122[_0x974b('0x16')][_0x974b('0x17')]){throw new Error(_0x974b('0x18'));}var _0x584e36=_0x19ec9f;var _0xd8d137=_0x974b('0x19')+_0x16f6dc+_0x974b('0x1a')+_0x24e1f7+_0x974b('0x1b')+_0x584e36+_0x974b('0x1c')+JSON[_0x974b('0x11')](_0x96f30e);var _0xda1bb1=_0x2597d5+'?'+_0xd8d137;return rp(_0xda1bb1);})[_0x974b('0x14')](function(_0x2144c2){logger[_0x974b('0x1d')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x11280a,_0x2144c2);_0x555b92[_0x974b('0x1e')]();})['catch'](function(_0x24570f){logger[_0x974b('0x1f')](_0x974b('0x20'),_0x11280a,_[_0x974b('0x21')](_0x24570f)?JSON['stringify'](_0x24570f):_0x24570f);_0x555b92['stop']();});}else{logger[_0x974b('0x1d')](_0x974b('0x22'),_0x11280a);_0x555b92[_0x974b('0x23')]();}};}; \ 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 0375ffe..d1f2438 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x2d165d,_0x1f5f25){var _0x37ea9a=function(_0x1eb9c9){while(--_0x1eb9c9){_0x2d165d['push'](_0x2d165d['shift']());}};_0x37ea9a(++_0x1f5f25);}(_0xe706,0xa3));var _0x6e70=function(_0x40c62b,_0x2c2efe){_0x40c62b=_0x40c62b-0x0;var _0x568cf0=_0xe706[_0x40c62b];return _0x568cf0;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1bf8c2,_0x45cb8d){var _0x5d3a31=function(_0x4a3a8a){while(--_0x4a3a8a){_0x1bf8c2['push'](_0x1bf8c2['shift']());}};_0x5d3a31(++_0x45cb8d);}(_0xe706,0xa3));var _0x6e70=function(_0x3c1a4e,_0x36dabf){_0x3c1a4e=_0x3c1a4e-0x0;var _0x155a91=_0xe706[_0x3c1a4e];return _0x155a91;};'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 2af8c66..9e6545b 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 _0x8164=['rules','channel','message','applications','isArray','length','existsSync','app','.js','autoreply','mail','push','slice','join','dialogflow','split','dialogflowv2','appdata','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','interaction','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','emit','complete','info','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','stringify','log','lodash','util','path','bluebird','uuid','../../../config/environment','routing','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','interval','listen'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8164,0x170));var _0x4816=function(_0x489250,_0x5e9468){_0x489250=_0x489250-0x0;var _0x1283e5=_0x8164[_0x489250];return _0x1283e5;};'use strict';var _=require(_0x4816('0x0'));var util=require(_0x4816('0x1'));var path=require(_0x4816('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x4816('0x3'));var uuid=require(_0x4816('0x4'));var utils=require('./applications/utils');var config=require(_0x4816('0x5'));var logger=require('../../../config/logger')(_0x4816('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x4816('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x4816('0x8'))};var RuleEngine=require(_0x4816('0x9'));function getId(_0x170e7a,_0x383974,_0x2421e1){return util[_0x4816('0xa')](_0x4816('0xb'),_0x170e7a,_0x383974||0x0,_0x2421e1||0x0);}function getIntervals(_0x1e0118,_0x23d125){var _0x520153=[];if(!_[_0x4816('0xc')](_0x23d125['IntervalId'])&&!_[_0x4816('0xc')](_0x1e0118[_0x23d125[_0x4816('0xd')]])&&!_['isNil'](_0x1e0118[_0x23d125[_0x4816('0xd')]]['Intervals'])){_0x520153=_['map'](_0x1e0118[_0x23d125[_0x4816('0xd')]]['Intervals'],'interval');}else if(!_[_0x4816('0xc')](_0x23d125['interval'])){_0x520153=[_0x23d125[_0x4816('0xe')]];}return _0x520153;}exports[_0x4816('0xf')]=function(_0x13a685){_0x13a685[_0x4816('0x10')]={};return new BPromise(function(_0x42fc52,_0x248163){var _0x1eb683={'Start':function(_0x2a58b7){var _0x45c006=this;return new Promise(function(_0x21354c,_0x1ce1fb){if(_0x2a58b7){try{var _0x4678a9=[];var _0x6119f=getId(_0x2a58b7[_0x4816('0x11')],_0x2a58b7[_0x4816('0x12')]?_0x2a58b7[_0x4816('0x12')]['id']:0x0,_0x2a58b7['interaction']?_0x2a58b7['interaction']['id']:0x0);if(_0x2a58b7[_0x4816('0x13')]&&_[_0x4816('0x14')](_0x2a58b7[_0x4816('0x13')])&&_0x2a58b7[_0x4816('0x13')][_0x4816('0x15')]){for(var _0x37effd=0x0;_0x37effd<_0x2a58b7[_0x4816('0x13')][_0x4816('0x15')];_0x37effd+=0x1){var _0x3df423=_0x2a58b7['applications'][_0x37effd];if(fs[_0x4816('0x16')](path['join'](__dirname,'applications',_0x3df423[_0x4816('0x17')]+_0x4816('0x18')))){var _0x5de184=[];switch(_0x3df423[_0x4816('0x17')]['toLowerCase']()){case _0x4816('0x19'):var _0x41d7f0=_0x3df423['appdata']['split'](',');if(_0x2a58b7[_0x4816('0x11')]===_0x4816('0x1a')){_0x5de184[_0x4816('0x1b')](_0x41d7f0[0x0]);_0x5de184['push'](_0x41d7f0[0x1]);_0x5de184[_0x4816('0x1b')](_0x41d7f0[_0x4816('0x1c')](0x2,_0x41d7f0[_0x4816('0x15')])[_0x4816('0x1d')](','));}else{_0x5de184['push'](_0x41d7f0[0x0]);_0x5de184['push'](_0x41d7f0[_0x4816('0x1c')](0x1,_0x41d7f0[_0x4816('0x15')])['join'](','));}break;case _0x4816('0x1e'):var _0x4f9386=_0x3df423['appdata'][_0x4816('0x1f')](',');_0x5de184[_0x4816('0x1b')](_0x4f9386[0x0]);_0x5de184[_0x4816('0x1b')](_0x4f9386[0x1]);_0x5de184['push'](_0x4f9386[_0x4816('0x1c')](0x2,_0x4f9386['length'])[_0x4816('0x1d')](','));break;case _0x4816('0x20'):var _0x49c337=_0x3df423[_0x4816('0x21')][_0x4816('0x1f')](',');_0x5de184[_0x4816('0x1b')](_0x49c337[0x0]);_0x5de184[_0x4816('0x1b')](_0x49c337[0x1]);_0x5de184[_0x4816('0x1b')](_0x49c337[0x2]);_0x5de184[_0x4816('0x1b')](_0x49c337[0x3]);_0x5de184[_0x4816('0x1b')](_0x49c337[_0x4816('0x1c')](0x4,_0x49c337[_0x4816('0x15')])['join'](','));break;case _0x4816('0x22'):var _0x902962=_0x3df423['appdata']['split'](',');_0x5de184[_0x4816('0x1b')](_0x902962[0x0]);_0x5de184[_0x4816('0x1b')](_0x902962[0x1]);_0x5de184[_0x4816('0x1b')](_0x902962[0x2]);_0x5de184[_0x4816('0x1b')](_0x902962[0x3]);_0x5de184[_0x4816('0x1b')](_0x902962['slice'](0x4,_0x902962['length'])['join'](','));break;case _0x4816('0x12'):_0x5de184[_0x4816('0x1b')](_0x3df423[_0x4816('0x21')]);break;case _0x4816('0x23'):_0x5de184[_0x4816('0x1b')](_0x3df423[_0x4816('0x24')]);_0x5de184['push'](_0x3df423[_0x4816('0x21')]);break;case'tvox':var _0xc92865=utils[_0x4816('0x25')](_0x2a58b7[_0x4816('0x26')][_0x4816('0x27')],_0x2a58b7);var _0x192476=_0x3df423['appdata'][_0x4816('0x1f')](',');_0x5de184['push'](_0x192476[0x0]);_0x5de184['push'](_0x192476[0x1]);_0x5de184[_0x4816('0x1b')](_0x192476[0x2]);_0x5de184['push'](_0x192476[0x3]);_0x5de184['push'](_0x192476[0x4]);_0x5de184['push'](_0x192476[0x5]);_0x5de184['push'](_0x192476[0x6]);_0x5de184[_0x4816('0x1b')](_0x192476[0x7]);_0x5de184[_0x4816('0x1b')](_0x192476[0x8]);_0x5de184['push'](_0x192476[0x9]);_0x5de184[_0x4816('0x1b')](_0x192476[0xa]);_0x5de184[_0x4816('0x1b')](_0x2a58b7['interaction']['id']);_0x5de184[_0x4816('0x1b')](_0x2a58b7[_0x4816('0x12')]['id']);_0x5de184[_0x4816('0x1b')](_0x3df423[_0x4816('0x28')]);_0x5de184['push'](_0x2a58b7[_0x4816('0x29')][_0x4816('0x2a')]);_0x5de184[_0x4816('0x1b')](_0x2a58b7[_0x4816('0x2b')][_0x4816('0x2b')]);_0x5de184[_0x4816('0x1b')](_0xc92865);break;default:_0x5de184=_[_0x4816('0xc')](_0x3df423[_0x4816('0x21')])?[]:_0x3df423[_0x4816('0x21')][_0x4816('0x1f')](',');}var _0xcbded0={'id':util[_0x4816('0xa')](_0x4816('0x2c'),_0x6119f,_0x3df423['id'],_0x3df423['app']),'condition':require(_0x4816('0x2d'))[_0x4816('0x2e')](_0x6119f,getIntervals(_0x13a685[_0x4816('0x2f')],_0x3df423),_0x13a685),'consequence':require(_0x4816('0x30')+_0x3df423[_0x4816('0x17')])[_0x4816('0x31')](_0x6119f,_0x5de184,_0x13a685,_0x2a58b7),'p':_0x3df423[_0x4816('0x32')]||0x0};logger['info'](_0x4816('0x33'),_0xcbded0['id'],'on\x20interval',getIntervals(_0x13a685['intervals'],_0x3df423)[_0x4816('0x1d')](_0x4816('0x34')));_0x4678a9['push'](_0xcbded0);}else{logger[_0x4816('0x35')](_0x4816('0x36'),path[_0x4816('0x1d')](__dirname,'applications',_0x3df423[_0x4816('0x17')]+_0x4816('0x18')));}}_0x13a685[_0x4816('0x10')][_0x6119f]=new RuleEngine(_0x4678a9);_0x13a685[_0x4816('0x10')][_0x6119f][_0x4816('0x37')](_0x2a58b7,function(_0x39c713){logger['info'](_0x4816('0x38'),JSON['stringify'](_0x39c713['matchPath']));if(_0x13a685['rules'][_0x6119f]){_0x13a685[_0x4816('0x10')][_0x6119f][_0x4816('0x39')](_0x4816('0x3a'));}});return _0x21354c({'code':0xc8,'message':_0x2a58b7});}else{logger[_0x4816('0x3b')](_0x4816('0x3c'));return _0x21354c({'code':0xc8,'message':_0x2a58b7});}}catch(_0x22d8d3){logger[_0x4816('0x35')](_0x22d8d3[_0x4816('0x3d')]);return _0x1ce1fb(_0x45c006[_0x4816('0x35')](0x1f4,_0x22d8d3));}}return _0x1ce1fb(_0x4816('0x3e'));});},'AcceptMessage':function(_0x5e24bf){var _0x4ffae3=this;return new Promise(function(_0x258f5f,_0x374d25){if(_0x5e24bf[_0x4816('0x3f')]&&_0x5e24bf[_0x4816('0x3f')]['id']){if(_0x13a685[_0x4816('0x40')][_0x5e24bf[_0x4816('0x3f')]['id']]){_0x13a685[_0x4816('0x40')][_0x5e24bf[_0x4816('0x3f')]['id']]['busy']=![];_0x13a685[_0x4816('0x40')][_0x5e24bf[_0x4816('0x3f')]['id']][_0x4816('0x41')]=undefined;}}if(_0x5e24bf['message']&&_0x5e24bf['message']['id']){try{var _0x2ad19b=getId(_0x5e24bf[_0x4816('0x11')],_0x5e24bf[_0x4816('0x12')]?_0x5e24bf['message']['id']:0x0,_0x5e24bf[_0x4816('0x29')]?_0x5e24bf[_0x4816('0x29')]['id']:0x0);if(_0x13a685[_0x4816('0x10')][_0x2ad19b]){_0x13a685[_0x4816('0x10')][_0x2ad19b][_0x4816('0x39')](_0x4816('0x42'));if(rpc[_0x5e24bf[_0x4816('0x11')]+'QueueReport']){rpc[_0x5e24bf[_0x4816('0x11')]+_0x4816('0x43')][_0x4816('0x44')](_0x2ad19b,{'UserId':_0x5e24bf[_0x4816('0x12')][_0x4816('0x45')]})[_0x4816('0x46')](function(_0x309778){logger[_0x4816('0x35')](_0x4816('0x47'));});}}return _0x258f5f({'code':0xc8,'message':_0x5e24bf});}catch(_0x443d0d){logger[_0x4816('0x35')](_0x443d0d[_0x4816('0x3d')]);return _0x374d25(_0x4ffae3[_0x4816('0x35')](0x1f4,_0x443d0d));}}logger[_0x4816('0x35')](_0x4816('0x48'));return _0x374d25(_0x4ffae3[_0x4816('0x35')](0x1f4,_0x4816('0x48')));});},'RejectMessage':function(_0x11272b){var _0x2e619f=this;return new Promise(function(_0x56321c,_0x1702bf){if(_0x11272b[_0x4816('0x3f')]&&_0x11272b['agent']['id']){try{if(_0x13a685[_0x4816('0x40')][_0x11272b[_0x4816('0x3f')]['id']]){_0x13a685['agents'][_0x11272b[_0x4816('0x3f')]['id']][_0x4816('0x49')]=![];_0x13a685[_0x4816('0x40')][_0x11272b[_0x4816('0x3f')]['id']][_0x4816('0x41')]=undefined;}return _0x56321c({'code':0xc8,'message':_0x11272b});}catch(_0x3f6bf2){logger[_0x4816('0x35')](_0x3f6bf2[_0x4816('0x3d')]);return _0x1702bf(_0x2e619f[_0x4816('0x35')](0x1f4,_0x3f6bf2));}}logger[_0x4816('0x35')]('message\x20is\x20empty');return _0x1702bf(_0x2e619f[_0x4816('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x440ba5){var _0x199363=this;return new Promise(function(_0x57d72e,_0x157ee3){if(_0x440ba5[_0x4816('0x11')]&&_0x440ba5[_0x4816('0x29')]&&_0x440ba5[_0x4816('0x29')]['id']){try{var _0x170c23=getId(_0x440ba5['channel'],_0x440ba5[_0x4816('0x12')]?_0x440ba5[_0x4816('0x12')]['id']:0x0,_0x440ba5[_0x4816('0x29')]?_0x440ba5[_0x4816('0x29')]['id']:0x0);if(_0x13a685[_0x4816('0x10')][_0x170c23]){_0x13a685[_0x4816('0x10')][_0x170c23]['emit'](_0x4816('0x42'));}return _0x57d72e({'code':0xc8,'message':_0x440ba5});}catch(_0x43c287){logger[_0x4816('0x35')](_0x43c287['stack']);return _0x157ee3(_0x199363[_0x4816('0x35')](0x1f4,_0x43c287));}}logger[_0x4816('0x35')](_0x4816('0x48'));return _0x157ee3(_0x199363['error'](0x1f4,_0x4816('0x48')));});},'AgentCapacity':function(_0x1f790b){var _0xa67f45=this;return new Promise(function(_0xfb9e4a,_0x56d223){if(_0x13a685[_0x4816('0x40')][_0x4816('0x4a')](_0x1f790b['id'])){for(var _0x5210d2 in _0x1f790b['capacity']){if(_0x1f790b['capacity'][_0x4816('0x4a')](_0x5210d2)){if(_0x13a685[_0x4816('0x40')][_0x1f790b['id']][_0x4816('0x4a')](_0x5210d2+_0x4816('0x4b'))){_0x13a685[_0x4816('0x40')][_0x1f790b['id']][_0x5210d2+_0x4816('0x4b')]=parseInt(_0x1f790b[_0x4816('0x4c')][_0x5210d2],0xa);}}}_0x13a685['agents'][_0x1f790b['id']][_0x4816('0x4d')]();return _0xfb9e4a({'code':0xc8,'message':_0x13a685[_0x4816('0x40')][_0x1f790b['id']]});}else{return _0x56d223(_0xa67f45[_0x4816('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x356878){return new Promise(function(_0x27392e,_0xcc9277){var _0x2c2a8c=_[_0x4816('0x4e')](_0x13a685[_0x4816('0x40')]);_0x27392e({'count':_0x2c2a8c[_0x4816('0x15')],'rows':_0x2c2a8c});});},'ChatQueues':function(_0x52cf85){return new Promise(function(_0x171c2b,_0x11e6f9){var _0x11b12a=[];for(var _0x4a3cf9 in _0x13a685[_0x4816('0x4f')]){if(_0x13a685[_0x4816('0x4f')]['hasOwnProperty'](_0x4a3cf9)){var _0x3a1cf7=_0x13a685[_0x4816('0x4f')][_0x4a3cf9];var _0x211a2b={'id':_0x3a1cf7['id'],'available':_0x3a1cf7[_0x4816('0x50')],'loggedIn':_0x3a1cf7[_0x4816('0x51')],'name':_0x3a1cf7[_0x4816('0x52')],'paused':_0x3a1cf7[_0x4816('0x53')],'waiting':_0x3a1cf7['waiting']};_0x11b12a[_0x4816('0x1b')](_0x211a2b);}}_0x171c2b({'count':_0x11b12a['length'],'rows':_0x11b12a});});},'MailQueues':function(_0x483ad3){return new Promise(function(_0x4f357f,_0x4b3a3c){var _0x553093=[];for(var _0x15649e in _0x13a685[_0x4816('0x54')]){if(_0x13a685[_0x4816('0x54')]['hasOwnProperty'](_0x15649e)){var _0x3d6908=_0x13a685[_0x4816('0x54')][_0x15649e];var _0x115dc8={'id':_0x3d6908['id'],'available':_0x3d6908[_0x4816('0x50')],'loggedIn':_0x3d6908[_0x4816('0x51')],'name':_0x3d6908[_0x4816('0x52')],'paused':_0x3d6908[_0x4816('0x53')],'waiting':_0x3d6908['waiting']};_0x553093[_0x4816('0x1b')](_0x115dc8);}}_0x4f357f({'count':_0x553093['length'],'rows':_0x553093});});},'OpenchannelQueues':function(_0x44c2ec){return new Promise(function(_0x2cbc59,_0x5277dc){var _0x3002b7=[];for(var _0x9165c8 in _0x13a685[_0x4816('0x55')]){if(_0x13a685['openchannelQueues'][_0x4816('0x4a')](_0x9165c8)){var _0xd5d3b0=_0x13a685[_0x4816('0x55')][_0x9165c8];var _0x56b799={'id':_0xd5d3b0['id'],'available':_0xd5d3b0[_0x4816('0x50')],'loggedIn':_0xd5d3b0[_0x4816('0x51')],'name':_0xd5d3b0[_0x4816('0x52')],'paused':_0xd5d3b0['paused'],'waiting':_0xd5d3b0[_0x4816('0x56')]};_0x3002b7[_0x4816('0x1b')](_0x56b799);}}_0x2cbc59({'count':_0x3002b7[_0x4816('0x15')],'rows':_0x3002b7});});},'SmsQueues':function(_0x391329){return new Promise(function(_0x1c7fb4,_0x3d7d8b){var _0x23cfc4=[];for(var _0x5b7156 in _0x13a685[_0x4816('0x57')]){if(_0x13a685[_0x4816('0x57')][_0x4816('0x4a')](_0x5b7156)){var _0x24b0d5=_0x13a685[_0x4816('0x57')][_0x5b7156];var _0x24df14={'id':_0x24b0d5['id'],'available':_0x24b0d5[_0x4816('0x50')],'loggedIn':_0x24b0d5['loggedIn'],'name':_0x24b0d5[_0x4816('0x52')],'paused':_0x24b0d5[_0x4816('0x53')],'waiting':_0x24b0d5[_0x4816('0x56')]};_0x23cfc4[_0x4816('0x1b')](_0x24df14);}}_0x1c7fb4({'count':_0x23cfc4['length'],'rows':_0x23cfc4});});},'FaxQueues':function(_0x1e0bab){return new Promise(function(_0x1af0dc,_0x46f5f4){var _0xbb9848=[];for(var _0x12de01 in _0x13a685[_0x4816('0x58')]){if(_0x13a685[_0x4816('0x58')][_0x4816('0x4a')](_0x12de01)){var _0x28419c=_0x13a685[_0x4816('0x58')][_0x12de01];var _0x436d35={'id':_0x28419c['id'],'available':_0x28419c[_0x4816('0x50')],'loggedIn':_0x28419c[_0x4816('0x51')],'name':_0x28419c['name'],'paused':_0x28419c[_0x4816('0x53')],'waiting':_0x28419c[_0x4816('0x56')]};_0xbb9848[_0x4816('0x1b')](_0x436d35);}}_0x1af0dc({'count':_0xbb9848[_0x4816('0x15')],'rows':_0xbb9848});});},'WhatsappQueues':function(_0x21fe50){return new Promise(function(_0x35093e,_0x12d58f){var _0x619070=[];for(var _0x202d18 in _0x13a685[_0x4816('0x59')]){if(_0x13a685[_0x4816('0x59')][_0x4816('0x4a')](_0x202d18)){var _0xf439b3=_0x13a685['whatsappQueues'][_0x202d18];var _0xf05f49={'id':_0xf439b3['id'],'available':_0xf439b3[_0x4816('0x50')],'loggedIn':_0xf439b3[_0x4816('0x51')],'name':_0xf439b3['name'],'paused':_0xf439b3['paused'],'waiting':_0xf439b3[_0x4816('0x56')]};_0x619070[_0x4816('0x1b')](_0xf05f49);}}_0x35093e({'count':_0x619070['length'],'rows':_0x619070});});},'ChatQueuesWaitingInteractions':function(_0x1e2ead){return new Promise(function(_0x192832,_0x357800){var _0x317f3f=_['values'](_0x13a685[_0x4816('0x5a')]);_0x192832({'count':_0x317f3f[_0x4816('0x15')],'rows':_0x317f3f});});},'MailQueuesWaitingInteractions':function(_0x5f391e){return new Promise(function(_0x370439,_0x32ced6){var _0x4957e6=_[_0x4816('0x4e')](_0x13a685['mailQueuesWaitingInteractions']);_0x370439({'count':_0x4957e6[_0x4816('0x15')],'rows':_0x4957e6});});},'OpenchannelQueuesWaitingInteractions':function(_0x485505){return new Promise(function(_0x27ff4f,_0xa7f23c){var _0x30a190=_[_0x4816('0x4e')](_0x13a685['openchannelQueuesWaitingInteractions']);_0x27ff4f({'count':_0x30a190[_0x4816('0x15')],'rows':_0x30a190});});},'SmsQueuesWaitingInteractions':function(_0x4194f6){return new Promise(function(_0x1d0192,_0x2246b3){var _0x5e0b7e=_[_0x4816('0x4e')](_0x13a685[_0x4816('0x5b')]);_0x1d0192({'count':_0x5e0b7e[_0x4816('0x15')],'rows':_0x5e0b7e});});},'FaxQueuesWaitingInteractions':function(_0x1f0f2a){return new Promise(function(_0x5c68cc,_0xc1f850){var _0x37c2a1=_[_0x4816('0x4e')](_0x13a685[_0x4816('0x5c')]);_0x5c68cc({'count':_0x37c2a1[_0x4816('0x15')],'rows':_0x37c2a1});});},'WhatsappQueuesWaitingInteractions':function(_0x4a4e89){return new Promise(function(_0x2765ae,_0x4f43eb){var _0x1c0799=_[_0x4816('0x4e')](_0x13a685['whatsappQueuesWaitingInteractions']);_0x2765ae({'count':_0x1c0799[_0x4816('0x15')],'rows':_0x1c0799});});}};var _0x205cf1=jayson[_0x4816('0x5d')](_0x1eb683)['http']();_0x205cf1['on'](_0x4816('0x35'),function(_0x33eabd){logger['error'](JSON[_0x4816('0x5e')](_0x33eabd));return _0x248163(_0x33eabd);});_0x205cf1[_0x4816('0xf')](0x232c,'127.0.0.1',function(){console[_0x4816('0x5f')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x42fc52('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xe28e=['Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','QueueReport','update','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','values','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','split','mail','push','slice','dialogflowv2','appdata','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','error'];(function(_0x135a07,_0x1acd28){var _0x2ac828=function(_0x5d8dd6){while(--_0x5d8dd6){_0x135a07['push'](_0x135a07['shift']());}};_0x2ac828(++_0x1acd28);}(_0xe28e,0x1ba));var _0xee28=function(_0x1e8bf2,_0x7e32fc){_0x1e8bf2=_0x1e8bf2-0x0;var _0x36d85e=_0xe28e[_0x1e8bf2];return _0x36d85e;};'use strict';var _=require(_0xee28('0x0'));var util=require(_0xee28('0x1'));var path=require(_0xee28('0x2'));var fs=require('fs');var jayson=require(_0xee28('0x3'));var BPromise=require(_0xee28('0x4'));var uuid=require(_0xee28('0x5'));var utils=require(_0xee28('0x6'));var config=require(_0xee28('0x7'));var logger=require(_0xee28('0x8'))(_0xee28('0x9'));var rpc={'openchannelQueueReport':require(_0xee28('0xa')),'mailQueueReport':require(_0xee28('0xb')),'chatQueueReport':require(_0xee28('0xc')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xee28('0xd')),'whatsappQueueReport':require(_0xee28('0xe'))};var RuleEngine=require(_0xee28('0xf'));function getId(_0x66d0b6,_0x156aad,_0x478b02){return util[_0xee28('0x10')]('%s.%s.%s',_0x66d0b6,_0x156aad||0x0,_0x478b02||0x0);}function getIntervals(_0x5afe44,_0x561fe4){var _0x31bc22=[];if(!_[_0xee28('0x11')](_0x561fe4['IntervalId'])&&!_[_0xee28('0x11')](_0x5afe44[_0x561fe4[_0xee28('0x12')]])&&!_['isNil'](_0x5afe44[_0x561fe4[_0xee28('0x12')]][_0xee28('0x13')])){_0x31bc22=_[_0xee28('0x14')](_0x5afe44[_0x561fe4[_0xee28('0x12')]][_0xee28('0x13')],_0xee28('0x15'));}else if(!_[_0xee28('0x11')](_0x561fe4['interval'])){_0x31bc22=[_0x561fe4[_0xee28('0x15')]];}return _0x31bc22;}exports[_0xee28('0x16')]=function(_0x555b9c){_0x555b9c[_0xee28('0x17')]={};return new BPromise(function(_0x2ae3e0,_0x5b510a){var _0x11ac93={'Start':function(_0x17c99a){var _0x3d3a5c=this;return new Promise(function(_0x343358,_0x1ff99e){if(_0x17c99a){try{var _0x11c95d=[];var _0x4c0eb9=getId(_0x17c99a[_0xee28('0x18')],_0x17c99a['message']?_0x17c99a[_0xee28('0x19')]['id']:0x0,_0x17c99a[_0xee28('0x1a')]?_0x17c99a['interaction']['id']:0x0);if(_0x17c99a[_0xee28('0x1b')]&&_['isArray'](_0x17c99a[_0xee28('0x1b')])&&_0x17c99a['applications'][_0xee28('0x1c')]){for(var _0x577332=0x0;_0x577332<_0x17c99a[_0xee28('0x1b')]['length'];_0x577332+=0x1){var _0x2fdf11=_0x17c99a[_0xee28('0x1b')][_0x577332];if(fs[_0xee28('0x1d')](path[_0xee28('0x1e')](__dirname,_0xee28('0x1b'),_0x2fdf11[_0xee28('0x1f')]+_0xee28('0x20')))){var _0x4bda53=[];switch(_0x2fdf11[_0xee28('0x1f')][_0xee28('0x21')]()){case _0xee28('0x22'):var _0x5a46cd=_0x2fdf11['appdata'][_0xee28('0x23')](',');if(_0x17c99a[_0xee28('0x18')]===_0xee28('0x24')){_0x4bda53[_0xee28('0x25')](_0x5a46cd[0x0]);_0x4bda53[_0xee28('0x25')](_0x5a46cd[0x1]);_0x4bda53[_0xee28('0x25')](_0x5a46cd[_0xee28('0x26')](0x2,_0x5a46cd[_0xee28('0x1c')])[_0xee28('0x1e')](','));}else{_0x4bda53[_0xee28('0x25')](_0x5a46cd[0x0]);_0x4bda53[_0xee28('0x25')](_0x5a46cd['slice'](0x1,_0x5a46cd[_0xee28('0x1c')])['join'](','));}break;case'dialogflow':var _0x54528b=_0x2fdf11['appdata']['split'](',');_0x4bda53[_0xee28('0x25')](_0x54528b[0x0]);_0x4bda53[_0xee28('0x25')](_0x54528b[0x1]);_0x4bda53[_0xee28('0x25')](_0x54528b[_0xee28('0x26')](0x2,_0x54528b[_0xee28('0x1c')])[_0xee28('0x1e')](','));break;case _0xee28('0x27'):var _0x4fcc8f=_0x2fdf11[_0xee28('0x28')][_0xee28('0x23')](',');_0x4bda53[_0xee28('0x25')](_0x4fcc8f[0x0]);_0x4bda53['push'](_0x4fcc8f[0x1]);_0x4bda53[_0xee28('0x25')](_0x4fcc8f[0x2]);_0x4bda53[_0xee28('0x25')](_0x4fcc8f[0x3]);_0x4bda53[_0xee28('0x25')](_0x4fcc8f[_0xee28('0x26')](0x4,_0x4fcc8f[_0xee28('0x1c')])[_0xee28('0x1e')](','));break;case _0xee28('0x29'):var _0x5d2a9d=_0x2fdf11[_0xee28('0x28')][_0xee28('0x23')](',');_0x4bda53['push'](_0x5d2a9d[0x0]);_0x4bda53[_0xee28('0x25')](_0x5d2a9d[0x1]);_0x4bda53[_0xee28('0x25')](_0x5d2a9d[0x2]);_0x4bda53[_0xee28('0x25')](_0x5d2a9d[0x3]);_0x4bda53[_0xee28('0x25')](_0x5d2a9d[_0xee28('0x26')](0x4,_0x5d2a9d[_0xee28('0x1c')])[_0xee28('0x1e')](','));break;case'message':_0x4bda53['push'](_0x2fdf11['appdata']);break;case _0xee28('0x2a'):_0x4bda53[_0xee28('0x25')](_0x2fdf11[_0xee28('0x2b')]);_0x4bda53[_0xee28('0x25')](_0x2fdf11[_0xee28('0x28')]);break;case _0xee28('0x2c'):var _0x5b0c20=utils[_0xee28('0x2d')](_0x17c99a[_0xee28('0x2e')]['notificationTemplate'],_0x17c99a);var _0x51b28d=_0x2fdf11[_0xee28('0x28')][_0xee28('0x23')](',');_0x4bda53['push'](_0x51b28d[0x0]);_0x4bda53['push'](_0x51b28d[0x1]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0x2]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0x3]);_0x4bda53['push'](_0x51b28d[0x4]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0x5]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0x6]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0x7]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0x8]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0x9]);_0x4bda53[_0xee28('0x25')](_0x51b28d[0xa]);_0x4bda53[_0xee28('0x25')](_0x17c99a[_0xee28('0x1a')]['id']);_0x4bda53[_0xee28('0x25')](_0x17c99a[_0xee28('0x19')]['id']);_0x4bda53[_0xee28('0x25')](_0x2fdf11[_0xee28('0x2f')]);_0x4bda53['push'](_0x17c99a[_0xee28('0x1a')]['ContactId']);_0x4bda53['push'](_0x17c99a[_0xee28('0x30')]['body']);_0x4bda53[_0xee28('0x25')](_0x5b0c20);break;default:_0x4bda53=_['isNil'](_0x2fdf11[_0xee28('0x28')])?[]:_0x2fdf11['appdata'][_0xee28('0x23')](',');}var _0x211345={'id':util[_0xee28('0x10')](_0xee28('0x31'),_0x4c0eb9,_0x2fdf11['id'],_0x2fdf11['app']),'condition':require(_0xee28('0x32'))['condition'](_0x4c0eb9,getIntervals(_0x555b9c[_0xee28('0x33')],_0x2fdf11),_0x555b9c),'consequence':require(_0xee28('0x34')+_0x2fdf11[_0xee28('0x1f')])[_0xee28('0x35')](_0x4c0eb9,_0x4bda53,_0x555b9c,_0x17c99a),'p':_0x2fdf11[_0xee28('0x36')]||0x0};logger[_0xee28('0x37')](_0xee28('0x38'),_0x211345['id'],'on\x20interval',getIntervals(_0x555b9c['intervals'],_0x2fdf11)[_0xee28('0x1e')]('\x20|\x20'));_0x11c95d['push'](_0x211345);}else{logger[_0xee28('0x39')](_0xee28('0x3a'),path['join'](__dirname,_0xee28('0x1b'),_0x2fdf11[_0xee28('0x1f')]+_0xee28('0x20')));}}_0x555b9c[_0xee28('0x17')][_0x4c0eb9]=new RuleEngine(_0x11c95d);_0x555b9c[_0xee28('0x17')][_0x4c0eb9][_0xee28('0x3b')](_0x17c99a,function(_0x1735a9){logger['info'](_0xee28('0x3c'),JSON[_0xee28('0x3d')](_0x1735a9[_0xee28('0x3e')]));if(_0x555b9c[_0xee28('0x17')][_0x4c0eb9]){_0x555b9c[_0xee28('0x17')][_0x4c0eb9]['emit'](_0xee28('0x3f'));}});return _0x343358({'code':0xc8,'message':_0x17c99a});}else{logger[_0xee28('0x37')]('No\x20applications\x20to\x20execute');return _0x343358({'code':0xc8,'message':_0x17c99a});}}catch(_0xb12ba){logger[_0xee28('0x39')](_0xb12ba[_0xee28('0x40')]);return _0x1ff99e(_0x3d3a5c[_0xee28('0x39')](0x1f4,_0xb12ba));}}return _0x1ff99e(_0xee28('0x41'));});},'AcceptMessage':function(_0x1ce54f){var _0x54ab7b=this;return new Promise(function(_0x36e5bb,_0x48e801){if(_0x1ce54f['agent']&&_0x1ce54f[_0xee28('0x42')]['id']){if(_0x555b9c[_0xee28('0x43')][_0x1ce54f['agent']['id']]){_0x555b9c[_0xee28('0x43')][_0x1ce54f[_0xee28('0x42')]['id']][_0xee28('0x44')]=![];_0x555b9c['agents'][_0x1ce54f['agent']['id']][_0xee28('0x45')]=undefined;}}if(_0x1ce54f[_0xee28('0x19')]&&_0x1ce54f[_0xee28('0x19')]['id']){try{var _0x3b7fb7=getId(_0x1ce54f[_0xee28('0x18')],_0x1ce54f[_0xee28('0x19')]?_0x1ce54f[_0xee28('0x19')]['id']:0x0,_0x1ce54f[_0xee28('0x1a')]?_0x1ce54f[_0xee28('0x1a')]['id']:0x0);if(_0x555b9c[_0xee28('0x17')][_0x3b7fb7]){_0x555b9c['rules'][_0x3b7fb7][_0xee28('0x46')]('end');if(rpc[_0x1ce54f[_0xee28('0x18')]+_0xee28('0x47')]){rpc[_0x1ce54f[_0xee28('0x18')]+_0xee28('0x47')][_0xee28('0x48')](_0x3b7fb7,{'UserId':_0x1ce54f['message']['UserId']})['catch'](function(_0x1b15a4){logger['error']('error\x20update\x20queue\x20report');});}}return _0x36e5bb({'code':0xc8,'message':_0x1ce54f});}catch(_0x659fc4){logger['error'](_0x659fc4[_0xee28('0x40')]);return _0x48e801(_0x54ab7b[_0xee28('0x39')](0x1f4,_0x659fc4));}}logger[_0xee28('0x39')](_0xee28('0x49'));return _0x48e801(_0x54ab7b[_0xee28('0x39')](0x1f4,_0xee28('0x49')));});},'RejectMessage':function(_0x326c85){var _0xc1bdba=this;return new Promise(function(_0x44402a,_0x10d393){if(_0x326c85['agent']&&_0x326c85[_0xee28('0x42')]['id']){try{if(_0x555b9c[_0xee28('0x43')][_0x326c85[_0xee28('0x42')]['id']]){_0x555b9c['agents'][_0x326c85['agent']['id']]['busy']=![];_0x555b9c['agents'][_0x326c85[_0xee28('0x42')]['id']][_0xee28('0x45')]=undefined;}return _0x44402a({'code':0xc8,'message':_0x326c85});}catch(_0x186306){logger['error'](_0x186306[_0xee28('0x40')]);return _0x10d393(_0xc1bdba[_0xee28('0x39')](0x1f4,_0x186306));}}logger[_0xee28('0x39')](_0xee28('0x49'));return _0x10d393(_0xc1bdba[_0xee28('0x39')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2a5da9){var _0x1c6696=this;return new Promise(function(_0x105b48,_0x4bbf41){if(_0x2a5da9[_0xee28('0x18')]&&_0x2a5da9[_0xee28('0x1a')]&&_0x2a5da9[_0xee28('0x1a')]['id']){try{var _0x47794a=getId(_0x2a5da9[_0xee28('0x18')],_0x2a5da9[_0xee28('0x19')]?_0x2a5da9[_0xee28('0x19')]['id']:0x0,_0x2a5da9['interaction']?_0x2a5da9[_0xee28('0x1a')]['id']:0x0);if(_0x555b9c['rules'][_0x47794a]){_0x555b9c['rules'][_0x47794a]['emit'](_0xee28('0x4a'));}return _0x105b48({'code':0xc8,'message':_0x2a5da9});}catch(_0x7c51d5){logger[_0xee28('0x39')](_0x7c51d5[_0xee28('0x40')]);return _0x4bbf41(_0x1c6696[_0xee28('0x39')](0x1f4,_0x7c51d5));}}logger[_0xee28('0x39')](_0xee28('0x49'));return _0x4bbf41(_0x1c6696[_0xee28('0x39')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3f23ad){var _0x386e24=this;return new Promise(function(_0x32c06f,_0x2b8252){if(_0x555b9c[_0xee28('0x43')][_0xee28('0x4b')](_0x3f23ad['id'])){for(var _0x16da79 in _0x3f23ad['capacity']){if(_0x3f23ad[_0xee28('0x4c')]['hasOwnProperty'](_0x16da79)){if(_0x555b9c[_0xee28('0x43')][_0x3f23ad['id']][_0xee28('0x4b')](_0x16da79+'CurrentCapacity')){_0x555b9c[_0xee28('0x43')][_0x3f23ad['id']][_0x16da79+_0xee28('0x4d')]=parseInt(_0x3f23ad[_0xee28('0x4c')][_0x16da79],0xa);}}}_0x555b9c[_0xee28('0x43')][_0x3f23ad['id']]['updateRealtime']();return _0x32c06f({'code':0xc8,'message':_0x555b9c[_0xee28('0x43')][_0x3f23ad['id']]});}else{return _0x2b8252(_0x386e24[_0xee28('0x39')](0x1f4,_0xee28('0x4e')));}});},'Agents':function(_0x2247cd){return new Promise(function(_0xd20b0e,_0x68b65e){var _0xf3416b=_['values'](_0x555b9c[_0xee28('0x43')]);_0xd20b0e({'count':_0xf3416b['length'],'rows':_0xf3416b});});},'ChatQueues':function(_0x1aa19f){return new Promise(function(_0x152331,_0x48ad2b){var _0x4b222a=[];for(var _0x14bc7a in _0x555b9c['chatQueues']){if(_0x555b9c[_0xee28('0x4f')][_0xee28('0x4b')](_0x14bc7a)){var _0x19f81a=_0x555b9c[_0xee28('0x4f')][_0x14bc7a];var _0x6e5bab={'id':_0x19f81a['id'],'available':_0x19f81a[_0xee28('0x50')],'loggedIn':_0x19f81a[_0xee28('0x51')],'name':_0x19f81a['name'],'paused':_0x19f81a[_0xee28('0x52')],'waiting':_0x19f81a[_0xee28('0x53')]};_0x4b222a[_0xee28('0x25')](_0x6e5bab);}}_0x152331({'count':_0x4b222a['length'],'rows':_0x4b222a});});},'MailQueues':function(_0x44d67d){return new Promise(function(_0x40b1a6,_0x1e190f){var _0x3d9926=[];for(var _0x354dc0 in _0x555b9c[_0xee28('0x54')]){if(_0x555b9c['mailQueues'][_0xee28('0x4b')](_0x354dc0)){var _0x56edf3=_0x555b9c[_0xee28('0x54')][_0x354dc0];var _0x3e9e94={'id':_0x56edf3['id'],'available':_0x56edf3[_0xee28('0x50')],'loggedIn':_0x56edf3[_0xee28('0x51')],'name':_0x56edf3['name'],'paused':_0x56edf3[_0xee28('0x52')],'waiting':_0x56edf3[_0xee28('0x53')]};_0x3d9926['push'](_0x3e9e94);}}_0x40b1a6({'count':_0x3d9926['length'],'rows':_0x3d9926});});},'OpenchannelQueues':function(_0x48221c){return new Promise(function(_0x57f6d6,_0x149959){var _0x56949a=[];for(var _0x24bc85 in _0x555b9c[_0xee28('0x55')]){if(_0x555b9c[_0xee28('0x55')]['hasOwnProperty'](_0x24bc85)){var _0x3a3894=_0x555b9c[_0xee28('0x55')][_0x24bc85];var _0x15d969={'id':_0x3a3894['id'],'available':_0x3a3894[_0xee28('0x50')],'loggedIn':_0x3a3894['loggedIn'],'name':_0x3a3894[_0xee28('0x56')],'paused':_0x3a3894['paused'],'waiting':_0x3a3894[_0xee28('0x53')]};_0x56949a[_0xee28('0x25')](_0x15d969);}}_0x57f6d6({'count':_0x56949a[_0xee28('0x1c')],'rows':_0x56949a});});},'SmsQueues':function(_0x547188){return new Promise(function(_0x3a7567,_0x204f05){var _0x28ab60=[];for(var _0x38d97f in _0x555b9c['smsQueues']){if(_0x555b9c[_0xee28('0x57')]['hasOwnProperty'](_0x38d97f)){var _0x3e698d=_0x555b9c[_0xee28('0x57')][_0x38d97f];var _0x1afe29={'id':_0x3e698d['id'],'available':_0x3e698d[_0xee28('0x50')],'loggedIn':_0x3e698d['loggedIn'],'name':_0x3e698d[_0xee28('0x56')],'paused':_0x3e698d[_0xee28('0x52')],'waiting':_0x3e698d[_0xee28('0x53')]};_0x28ab60['push'](_0x1afe29);}}_0x3a7567({'count':_0x28ab60[_0xee28('0x1c')],'rows':_0x28ab60});});},'FaxQueues':function(_0x533e3f){return new Promise(function(_0x243028,_0x3cf3be){var _0x3a3509=[];for(var _0x303d6f in _0x555b9c[_0xee28('0x58')]){if(_0x555b9c[_0xee28('0x58')]['hasOwnProperty'](_0x303d6f)){var _0x4e0260=_0x555b9c[_0xee28('0x58')][_0x303d6f];var _0x269511={'id':_0x4e0260['id'],'available':_0x4e0260[_0xee28('0x50')],'loggedIn':_0x4e0260[_0xee28('0x51')],'name':_0x4e0260[_0xee28('0x56')],'paused':_0x4e0260[_0xee28('0x52')],'waiting':_0x4e0260['waiting']};_0x3a3509[_0xee28('0x25')](_0x269511);}}_0x243028({'count':_0x3a3509[_0xee28('0x1c')],'rows':_0x3a3509});});},'WhatsappQueues':function(_0x14cae0){return new Promise(function(_0x3b8aea,_0x22013a){var _0x412c50=[];for(var _0x10083d in _0x555b9c[_0xee28('0x59')]){if(_0x555b9c[_0xee28('0x59')][_0xee28('0x4b')](_0x10083d)){var _0x186ad0=_0x555b9c[_0xee28('0x59')][_0x10083d];var _0x3d78c5={'id':_0x186ad0['id'],'available':_0x186ad0[_0xee28('0x50')],'loggedIn':_0x186ad0[_0xee28('0x51')],'name':_0x186ad0[_0xee28('0x56')],'paused':_0x186ad0[_0xee28('0x52')],'waiting':_0x186ad0['waiting']};_0x412c50[_0xee28('0x25')](_0x3d78c5);}}_0x3b8aea({'count':_0x412c50[_0xee28('0x1c')],'rows':_0x412c50});});},'ChatQueuesWaitingInteractions':function(_0x3134e4){return new Promise(function(_0x3dd294,_0x2e95d7){var _0x23f5b9=_['values'](_0x555b9c[_0xee28('0x5a')]);_0x3dd294({'count':_0x23f5b9['length'],'rows':_0x23f5b9});});},'MailQueuesWaitingInteractions':function(_0xf96360){return new Promise(function(_0x2ddca1,_0x10e2c8){var _0x2696e2=_['values'](_0x555b9c[_0xee28('0x5b')]);_0x2ddca1({'count':_0x2696e2['length'],'rows':_0x2696e2});});},'OpenchannelQueuesWaitingInteractions':function(_0x3474f3){return new Promise(function(_0x318125,_0xf84996){var _0x228246=_[_0xee28('0x5c')](_0x555b9c[_0xee28('0x5d')]);_0x318125({'count':_0x228246[_0xee28('0x1c')],'rows':_0x228246});});},'SmsQueuesWaitingInteractions':function(_0x125a66){return new Promise(function(_0x4c7e2b,_0x427d44){var _0x46426c=_[_0xee28('0x5c')](_0x555b9c[_0xee28('0x5e')]);_0x4c7e2b({'count':_0x46426c[_0xee28('0x1c')],'rows':_0x46426c});});},'FaxQueuesWaitingInteractions':function(_0x4b7d3d){return new Promise(function(_0x2d1fae,_0x5bb1d4){var _0x41a4df=_[_0xee28('0x5c')](_0x555b9c[_0xee28('0x5f')]);_0x2d1fae({'count':_0x41a4df[_0xee28('0x1c')],'rows':_0x41a4df});});},'WhatsappQueuesWaitingInteractions':function(_0x382554){return new Promise(function(_0x259d78,_0x1cbf13){var _0x51721c=_[_0xee28('0x5c')](_0x555b9c['whatsappQueuesWaitingInteractions']);_0x259d78({'count':_0x51721c[_0xee28('0x1c')],'rows':_0x51721c});});}};var _0x380f98=jayson[_0xee28('0x60')](_0x11ac93)[_0xee28('0x61')]();_0x380f98['on'](_0xee28('0x39'),function(_0x34b978){logger[_0xee28('0x39')](JSON[_0xee28('0x3d')](_0x34b978));return _0x5b510a(_0x34b978);});_0x380f98[_0xee28('0x16')](0x232c,_0xee28('0x62'),function(){console[_0xee28('0x63')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2ae3e0('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4f5e560..7b871fd 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 _0x8145=['Command','format','indexOf','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','lodash','routing','http','then','error','message','result','catch','condition','rules','info','stop','length','push'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8145,0xa7));var _0x5814=function(_0x42cce6,_0x88baf4){_0x42cce6=_0x42cce6-0x0;var _0x408ca9=_0x8145[_0x42cce6];return _0x408ca9;};'use strict';var util=require(_0x5814('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x5814('0x1'));var logger=require('../../../config/logger')(_0x5814('0x2'));var client=jayson['client'][_0x5814('0x3')]({'port':0x232a});function request(_0x5ea275,_0x1d0d91){return new BPromise(function(_0x54966b,_0x3121f3){return client['request'](_0x5ea275,_0x1d0d91)[_0x5814('0x4')](function(_0x358019){if(_0x358019[_0x5814('0x5')]){return _0x3121f3(_0x358019[_0x5814('0x5')][_0x5814('0x6')]);}else{return _0x54966b(_0x358019[_0x5814('0x7')]);}})[_0x5814('0x8')](function(_0x4ad565){return _0x3121f3(_0x4ad565);});});}exports[_0x5814('0x9')]=function(_0x2b033c,_0x4cb50a,_0x432ec4){return function(_0x4af164){if(_0x432ec4[_0x5814('0xa')]&&!_0x432ec4[_0x5814('0xa')][_0x2b033c]){logger[_0x5814('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x2b033c);return _0x4af164[_0x5814('0xc')]();}var _0x51c29b=[];for(var _0x3d2faf=0x0;_0x3d2faf<_0x4cb50a[_0x5814('0xd')];_0x3d2faf+=0x1){_0x51c29b[_0x5814('0xe')](request(_0x5814('0xf'),{'command':util[_0x5814('0x10')]('iftime\x20%s',_0x4cb50a[_0x3d2faf])})[_0x5814('0x4')](function(_0x4cba48){return _0x4cba48&&_0x4cba48[_0x5814('0x6')]&&_0x4cba48['message'][_0x5814('0x11')]('true')>=0x0?!![]:![];})[_0x5814('0x8')](function(_0x5cf2c2){logger[_0x5814('0x5')](_0x5814('0x12'),_0x2b033c,_0x4cb50a[_0x3d2faf]);}));}BPromise['all'](_0x51c29b)[_0x5814('0x4')](function(_0x1915d1){var _0x332a52=_[_0x5814('0x13')](_0x1915d1);logger[_0x5814('0xb')](_0x5814('0x14'),_0x2b033c,_0x4cb50a[_0x5814('0x15')](_0x5814('0x16')),_0x332a52);_0x4af164[_0x5814('0x17')](_0x332a52);})['catch'](function(_0x48dca9){console[_0x5814('0x18')](_0x48dca9);logger[_0x5814('0x5')](_0x5814('0x14'),_0x2b033c,_0x4cb50a[_0x5814('0x15')](_0x5814('0x16')),_0x48dca9[_0x5814('0x19')]);_0x4af164[_0x5814('0xc')]();});};}; \ No newline at end of file +var _0x7b41=['catch','condition','rules','info','stop','length','push','Command','format','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','util','bluebird','routing','client','then','error','result'];(function(_0x322bd2,_0x48512b){var _0x466e3f=function(_0x48255d){while(--_0x48255d){_0x322bd2['push'](_0x322bd2['shift']());}};_0x466e3f(++_0x48512b);}(_0x7b41,0x173));var _0x17b4=function(_0x438882,_0x148680){_0x438882=_0x438882-0x0;var _0x14026f=_0x7b41[_0x438882];return _0x14026f;};'use strict';var util=require(_0x17b4('0x0'));var BPromise=require(_0x17b4('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x17b4('0x2'));var client=jayson[_0x17b4('0x3')]['http']({'port':0x232a});function request(_0x263bff,_0x586c3c){return new BPromise(function(_0x16fb15,_0x2f4a7a){return client['request'](_0x263bff,_0x586c3c)[_0x17b4('0x4')](function(_0x257797){if(_0x257797['error']){return _0x2f4a7a(_0x257797[_0x17b4('0x5')]['message']);}else{return _0x16fb15(_0x257797[_0x17b4('0x6')]);}})[_0x17b4('0x7')](function(_0x4dd049){return _0x2f4a7a(_0x4dd049);});});}exports[_0x17b4('0x8')]=function(_0x31a0e9,_0x588b2c,_0x410906){return function(_0x792489){if(_0x410906[_0x17b4('0x9')]&&!_0x410906[_0x17b4('0x9')][_0x31a0e9]){logger[_0x17b4('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x31a0e9);return _0x792489[_0x17b4('0xb')]();}var _0x3241e0=[];for(var _0x53a70a=0x0;_0x53a70a<_0x588b2c[_0x17b4('0xc')];_0x53a70a+=0x1){_0x3241e0[_0x17b4('0xd')](request(_0x17b4('0xe'),{'command':util[_0x17b4('0xf')]('iftime\x20%s',_0x588b2c[_0x53a70a])})[_0x17b4('0x4')](function(_0x4184e2){return _0x4184e2&&_0x4184e2[_0x17b4('0x10')]&&_0x4184e2[_0x17b4('0x10')][_0x17b4('0x11')](_0x17b4('0x12'))>=0x0?!![]:![];})[_0x17b4('0x7')](function(_0x3534e5){logger[_0x17b4('0x5')](_0x17b4('0x13'),_0x31a0e9,_0x588b2c[_0x53a70a]);}));}BPromise[_0x17b4('0x14')](_0x3241e0)[_0x17b4('0x4')](function(_0x327b02){var _0x3ae926=_[_0x17b4('0x15')](_0x327b02);logger[_0x17b4('0xa')](_0x17b4('0x16'),_0x31a0e9,_0x588b2c['join'](_0x17b4('0x17')),_0x3ae926);_0x792489[_0x17b4('0x18')](_0x3ae926);})[_0x17b4('0x7')](function(_0x5d6baf){console[_0x17b4('0x19')](_0x5d6baf);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x31a0e9,_0x588b2c[_0x17b4('0x1a')]('\x20|\x20'),_0x5d6baf['stack']);_0x792489[_0x17b4('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 47e2626..0c6b91c 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 _0x6f7a=['indexOf','splice','agent','complete','diffTime','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','error','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcomplete','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x48119e,_0x44dbe2){_0x48119e=_0x48119e-0x0;var _0x57861c=_0x6f7a[_0x48119e];return _0x57861c;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var utils=require(_0xa6f7('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x982062,_0x4dd99d){utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')](_0xa6f7('0x5'),_0x982062[_0xa6f7('0x6')],_0x982062[_0xa6f7('0x7')],_0x982062[_0xa6f7('0x8')],_0x982062[_0xa6f7('0x9')],_0x982062[_0xa6f7('0xa')],_0x982062[_0xa6f7('0xb')],_0x982062[_0xa6f7('0xc')],_0x982062[_0xa6f7('0xd')]));if(_0x982062['queue']){utils['getVoiceQueueByName'](_0x982062[_0xa6f7('0x8')])[_0xa6f7('0xe')](function(_0x397020){if(_0x397020){_0x982062[_0xa6f7('0xf')]=_0x397020[_0xa6f7('0xf')];_0x982062['agentacw']=_0x982062['agentcomplete']?_0x397020[_0xa6f7('0x10')]:![];_0x982062[_0xa6f7('0x11')]=_0x982062['agentacw']?_0x397020[_0xa6f7('0x12')]:0x0;}utils['request'](_0xa6f7('0x13'),_0x982062);});}else{utils[_0xa6f7('0x14')](_0xa6f7('0x13'),_0x982062);}if(_0x4dd99d){delete transfers[_0x982062[_0xa6f7('0x6')]];}else{delete agents[_0x982062['destuniqueid']];}}exports[_0xa6f7('0x15')]=function(_0x532352){try{utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')](_0xa6f7('0x17'),_0x532352['uniqueid']),_0x532352);agents[_0x532352[_0xa6f7('0x18')]]=_0x532352;agents[_0x532352['destuniqueid']][_0xa6f7('0x19')]=utils['now']();agents[_0x532352[_0xa6f7('0x18')]][_0xa6f7('0xd')]=_0xa6f7('0x1a');agents[_0x532352['destuniqueid']][_0xa6f7('0xc')]=null;agents[_0x532352[_0xa6f7('0x18')]][_0xa6f7('0x1b')]=null;utils[_0xa6f7('0x3')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x532352[_0xa6f7('0x6')],agents[_0x532352['destuniqueid']][_0xa6f7('0x9')],_0x532352[_0xa6f7('0x18')]));}catch(_0x5d16d0){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x17'),_0x532352[_0xa6f7('0x6')]),_0x5d16d0);}};exports[_0xa6f7('0x1d')]=function(_0x1aa8dc){try{if(!_['isNil'](agents[_0x1aa8dc[_0xa6f7('0x18')]])){utils[_0xa6f7('0x16')](util['format']('[%s][agents][agentringnoanswer]',_0x1aa8dc['uniqueid']),_0x1aa8dc);utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1aa8dc['uniqueid'],agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0x9')],_0x1aa8dc[_0xa6f7('0x18')]));agents[_0x1aa8dc[_0xa6f7('0x18')]]['agentringnoanswer']=!![];agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0x1e')]=utils['now']();agents[_0x1aa8dc['destuniqueid']][_0xa6f7('0xd')]='timeout';agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x1f')]=_0xa6f7('0x20');agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x21')]=_0x1aa8dc['ringtime']?parseInt(_0x1aa8dc['ringtime'])/0x3e8:0x0;agents[_0x1aa8dc[_0xa6f7('0x18')]][_0xa6f7('0x22')]=0x0;unanswered['push'](_0x1aa8dc[_0xa6f7('0x18')]);}}catch(_0x27babb){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x23'),_0x1aa8dc[_0xa6f7('0x6')]),_0x27babb);}};exports[_0xa6f7('0x24')]=function(_0x54f72c){try{_[_0xa6f7('0x25')](agents,function(_0x3dee2e,_0x40b0f8){if(_0x3dee2e[_0xa6f7('0x6')]==_0x54f72c['uniqueid']&&!_[_0xa6f7('0x26')](unanswered,_0x3dee2e[_0xa6f7('0x18')])){utils['debug'](util[_0xa6f7('0x4')](_0xa6f7('0x27'),_0x54f72c['uniqueid']),_0x54f72c);utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x28'),_0x54f72c[_0xa6f7('0x6')],_0x3dee2e[_0xa6f7('0x9')],_0x3dee2e[_0xa6f7('0x18')]));_0x3dee2e['agentringnoanswer']=!![];_0x3dee2e['agentringnoanswerAt']=utils[_0xa6f7('0x29')]();_0x3dee2e['lastevent']=_0xa6f7('0x2a');_0x3dee2e[_0xa6f7('0x1f')]=_0xa6f7('0x2a');_0x3dee2e[_0xa6f7('0x21')]=_0x54f72c[_0xa6f7('0x21')];_0x3dee2e[_0xa6f7('0x22')]=0x0;writeDB(_0x3dee2e);}});}catch(_0x4d2d38){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x27'),_0x54f72c['uniqueid']),_0x4d2d38);}};exports[_0xa6f7('0x2b')]=function(_0x5ab03d){try{if(agents[_0x5ab03d[_0xa6f7('0x18')]]){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][agentconnect]',_0x5ab03d[_0xa6f7('0x6')]),_0x5ab03d);utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')](_0xa6f7('0x2c'),_0x5ab03d[_0xa6f7('0x6')],agents[_0x5ab03d[_0xa6f7('0x18')]]['membername'],_0x5ab03d[_0xa6f7('0x18')]));agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0x2d')]=utils[_0xa6f7('0x29')]();agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0xc')]=_0x5ab03d[_0xa6f7('0xc')];agents[_0x5ab03d[_0xa6f7('0x18')]]['connectedlinename']=_0x5ab03d[_0xa6f7('0x1b')];agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0x21')]=_0x5ab03d['ringtime'];agents[_0x5ab03d[_0xa6f7('0x18')]][_0xa6f7('0xd')]='connect';_[_0xa6f7('0x25')](agents,function(_0x13c7c4,_0x3ecb88){if(_0x13c7c4[_0xa6f7('0x18')]!=_0x5ab03d[_0xa6f7('0x18')]&&_0x13c7c4['uniqueid']==_0x5ab03d[_0xa6f7('0x6')]){_0x13c7c4[_0xa6f7('0x22')]=0x0;_0x13c7c4[_0xa6f7('0x21')]=_0x5ab03d[_0xa6f7('0x2e')];_0x13c7c4[_0xa6f7('0x1d')]=!![];_0x13c7c4[_0xa6f7('0x1e')]=utils[_0xa6f7('0x29')]();_0x13c7c4[_0xa6f7('0xd')]='answered_elsewhere';_0x13c7c4['reason']=_0xa6f7('0x2f');_0x13c7c4[_0xa6f7('0x30')]=_0x5ab03d[_0xa6f7('0x18')];_0x13c7c4[_0xa6f7('0x31')]=_0x5ab03d[_0xa6f7('0x9')];writeDB(_0x13c7c4);}});}}catch(_0x387714){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x32'),_0x5ab03d[_0xa6f7('0x6')]),_0x387714);}};exports['agentcomplete']=function(_0x41917c){try{if(!_[_0xa6f7('0x33')](agents[_0x41917c['destuniqueid']])){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')](_0xa6f7('0x34'),_0x41917c[_0xa6f7('0x6')]),_0x41917c);utils['info'](util[_0xa6f7('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x41917c['uniqueid'],agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x9')],_0x41917c[_0xa6f7('0x18')]));agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x35')]=!![];agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x36')]=utils['now']();agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x22')]=utils['diffTime'](agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0x36')],agents[_0x41917c[_0xa6f7('0x18')]]['agentconnectAt']);agents[_0x41917c[_0xa6f7('0x18')]]['reason']=_0x41917c[_0xa6f7('0x1f')];agents[_0x41917c[_0xa6f7('0x18')]][_0xa6f7('0xd')]='complete';writeDB(agents[_0x41917c['destuniqueid']]);}}catch(_0x2b06b5){utils['error'](util[_0xa6f7('0x4')]('[%s][agents][agentcomplete]',_0x41917c['uniqueid']),_0x2b06b5);}};exports[_0xa6f7('0x37')]=function(_0x2e3a04){try{if(!_[_0xa6f7('0x33')](agents[_0x2e3a04[_0xa6f7('0x38')]])){utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][blindtransfer]',_0x2e3a04[_0xa6f7('0x6')]),_0x2e3a04);utils[_0xa6f7('0x3')](util['format'](_0xa6f7('0x39'),_0x2e3a04['uniqueid'],agents[_0x2e3a04[_0xa6f7('0x38')]]['membername'],agents[_0x2e3a04['transfereruniqueid']][_0xa6f7('0x6')]));agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3a')]=!![];agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3b')]='blind';agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x3c')]=_0x2e3a04['extension'];agents[_0x2e3a04[_0xa6f7('0x38')]]['transferuniqueid']=agents[_0x2e3a04[_0xa6f7('0x38')]][_0xa6f7('0x6')];}}catch(_0x134dd7){utils['error'](util[_0xa6f7('0x4')]('[%s][agents][blindtransfer]',_0x2e3a04[_0xa6f7('0x6')]),_0x134dd7);}};exports[_0xa6f7('0x3d')]=function(_0x236372){try{utils[_0xa6f7('0x16')](util[_0xa6f7('0x4')]('[%s][agents][attendedtransfer]',_0x236372['origtransfereruniqueid']),_0x236372);if(_0x236372[_0xa6f7('0x3e')]==_0x236372[_0xa6f7('0x3f')]){if(!_[_0xa6f7('0x33')](agents[_0x236372[_0xa6f7('0x40')]])){utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x41'),_0x236372[_0xa6f7('0x3e')],agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x9')]));agents[_0x236372[_0xa6f7('0x40')]]['transfer']=!![];agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x3b')]=_0xa6f7('0x42');agents[_0x236372['secondtransfereruniqueid']][_0xa6f7('0x3c')]=_0x236372[_0xa6f7('0x43')];agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x44')]=_0x236372['origtransfereruniqueid'];}if(_0x236372['transfereeuniqueid']&&agents[_0x236372[_0xa6f7('0x45')]]){agents[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x46')]=0x1;transfers[_0x236372[_0xa6f7('0x45')]]=_[_0xa6f7('0x47')](agents[_0x236372[_0xa6f7('0x45')]]);transfers[_0x236372[_0xa6f7('0x45')]]['calleridnum']=agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0xb')];transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x48')]=agents[_0x236372[_0xa6f7('0x40')]][_0xa6f7('0x48')];transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x19')]=utils[_0xa6f7('0x29')]();transfers[_0x236372[_0xa6f7('0x45')]][_0xa6f7('0x2d')]=utils['now']();transfers[_0x236372[_0xa6f7('0x45')]]['holdtime']=0x0;transfers[_0x236372[_0xa6f7('0x45')]]['agententerreason']=0x2;}}else if(_0x236372[_0xa6f7('0x40')]==_0x236372[_0xa6f7('0x49')]){if(!_['isNil'](agents[_0x236372[_0xa6f7('0x3e')]])){utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x236372[_0xa6f7('0x3e')],agents[_0x236372['origtransfereruniqueid']][_0xa6f7('0x9')]));agents[_0x236372[_0xa6f7('0x3e')]]['transfer']=!![];agents[_0x236372[_0xa6f7('0x3e')]]['transfertype']=_0xa6f7('0x42');agents[_0x236372['origtransfereruniqueid']][_0xa6f7('0x3c')]=_0x236372[_0xa6f7('0x4a')];agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0x44')]=_0x236372[_0xa6f7('0x40')];}if(_0x236372[_0xa6f7('0x4b')]&&agents[_0x236372[_0xa6f7('0x4b')]]){agents[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x46')]=0x1;transfers[_0x236372[_0xa6f7('0x4b')]]=_[_0xa6f7('0x47')](agents[_0x236372[_0xa6f7('0x4b')]]);transfers[_0x236372['transfertargetuniqueid']][_0xa6f7('0xb')]=agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0xb')];transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x48')]=agents[_0x236372[_0xa6f7('0x3e')]][_0xa6f7('0x48')];transfers[_0x236372[_0xa6f7('0x4b')]]['agentcalledAt']=utils[_0xa6f7('0x29')]();transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x2d')]=utils['now']();transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x21')]=0x0;transfers[_0x236372[_0xa6f7('0x4b')]][_0xa6f7('0x46')]=0x2;}}}catch(_0x1a1055){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')](_0xa6f7('0x4c'),_0x236372['origtransfereruniqueid']),_0x1a1055);}};exports['hangup']=function(_0x265194){try{utils[_0xa6f7('0x16')](util['format'](_0xa6f7('0x4d'),_0x265194[_0xa6f7('0x6')]),_0x265194);if(agents[_0x265194[_0xa6f7('0x6')]]&&agents[_0x265194['uniqueid']][_0xa6f7('0x1f')]==='timeout'){if(_0x265194['cause']==='21'){agents[_0x265194['uniqueid']]['reason']='rejected';agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]=_0xa6f7('0x4e');}utils['info'](util[_0xa6f7('0x4')](_0xa6f7('0x4f'),_0x265194[_0xa6f7('0x6')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]));writeDB(agents[_0x265194[_0xa6f7('0x6')]]);var _0x55ad6b=unanswered[_0xa6f7('0x50')](_0x265194[_0xa6f7('0x6')]);if(_0x55ad6b>-0x1){unanswered[_0xa6f7('0x51')](_0x55ad6b,0x1);}}if(transfers[_0x265194[_0xa6f7('0x6')]]){transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x35')]=!![];transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x36')]=utils[_0xa6f7('0x29')]();transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x22')]=utils['diffTime'](transfers[_0x265194['uniqueid']][_0xa6f7('0x36')],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]);transfers[_0x265194['uniqueid']][_0xa6f7('0x1f')]=_0xa6f7('0x52');transfers[_0x265194['uniqueid']][_0xa6f7('0xd')]=_0xa6f7('0x53');utils['info'](util['format'](_0xa6f7('0x4f'),_0x265194['uniqueid'],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],transfers[_0x265194['uniqueid']]['reason'],transfers[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]));writeDB(transfers[_0x265194[_0xa6f7('0x6')]],!![]);}if(agents[_0x265194['uniqueid']]&&agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]){agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x35')]=!![];agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x36')]=utils[_0xa6f7('0x29')]();agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x22')]=utils[_0xa6f7('0x54')](agents[_0x265194[_0xa6f7('0x6')]]['agentcompleteAt'],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x2d')]);agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')]=agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x3a')]?'transfer':_0xa6f7('0x52');agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0xd')]=_0xa6f7('0x53');utils[_0xa6f7('0x3')](util[_0xa6f7('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x265194['uniqueid'],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x9')],agents[_0x265194[_0xa6f7('0x6')]][_0xa6f7('0x1f')],agents[_0x265194[_0xa6f7('0x6')]]['lastevent']));writeDB(agents[_0x265194[_0xa6f7('0x6')]]);}}catch(_0x4c7383){utils[_0xa6f7('0x1c')](util[_0xa6f7('0x4')]('[%s][agents][hangup]',_0x265194['uniqueid']),_0x4c7383);}}; \ No newline at end of file +var _0x702d=['error','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','info'];(function(_0x2f7253,_0x5988b8){var _0x3eb604=function(_0x1bf900){while(--_0x1bf900){_0x2f7253['push'](_0x2f7253['shift']());}};_0x3eb604(++_0x5988b8);}(_0x702d,0x147));var _0xd702=function(_0x802437,_0xd4cc4b){_0x802437=_0x802437-0x0;var _0x122941=_0x702d[_0x802437];return _0x122941;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var utils=require(_0xd702('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x33e7c5,_0x37ed5c){utils['info'](util[_0xd702('0x3')](_0xd702('0x4'),_0x33e7c5[_0xd702('0x5')],_0x33e7c5[_0xd702('0x6')],_0x33e7c5['queue'],_0x33e7c5[_0xd702('0x7')],_0x33e7c5['interface'],_0x33e7c5[_0xd702('0x8')],_0x33e7c5[_0xd702('0x9')],_0x33e7c5[_0xd702('0xa')]));if(_0x33e7c5['queue']){utils[_0xd702('0xb')](_0x33e7c5['queue'])[_0xd702('0xc')](function(_0x25423f){if(_0x25423f){_0x33e7c5[_0xd702('0xd')]=_0x25423f[_0xd702('0xd')];_0x33e7c5[_0xd702('0xe')]=_0x33e7c5[_0xd702('0xf')]?_0x25423f[_0xd702('0x10')]:![];_0x33e7c5[_0xd702('0x11')]=_0x33e7c5[_0xd702('0xe')]?_0x25423f[_0xd702('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x33e7c5);});}else{utils[_0xd702('0x13')](_0xd702('0x14'),_0x33e7c5);}if(_0x37ed5c){delete transfers[_0x33e7c5[_0xd702('0x5')]];}else{delete agents[_0x33e7c5['destuniqueid']];}}exports[_0xd702('0x15')]=function(_0x128add){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x128add);agents[_0x128add['destuniqueid']]=_0x128add;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x19')]=utils['now']();agents[_0x128add[_0xd702('0x18')]]['lastevent']=_0xd702('0x1a');agents[_0x128add[_0xd702('0x18')]]['connectedlinenum']=null;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x1b')]=null;utils[_0xd702('0x1c')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x128add[_0xd702('0x5')],agents[_0x128add['destuniqueid']][_0xd702('0x7')],_0x128add[_0xd702('0x18')]));}catch(_0x37267c){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x37267c);}};exports['agentringnoanswer']=function(_0x4be140){try{if(!_['isNil'](agents[_0x4be140[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x4be140);utils[_0xd702('0x1c')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4be140['uniqueid'],agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x7')],_0x4be140[_0xd702('0x18')]));agents[_0x4be140['destuniqueid']][_0xd702('0x1f')]=!![];agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x20')]=utils[_0xd702('0x21')]();agents[_0x4be140[_0xd702('0x18')]][_0xd702('0xa')]=_0xd702('0x22');agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x23')]='timeout';agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x24')]=_0x4be140[_0xd702('0x25')]?parseInt(_0x4be140[_0xd702('0x25')])/0x3e8:0x0;agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x26')]=0x0;unanswered[_0xd702('0x27')](_0x4be140[_0xd702('0x18')]);}}catch(_0x5f1084){utils['error'](util[_0xd702('0x3')](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x5f1084);}};exports[_0xd702('0x28')]=function(_0xee8bf1){try{_[_0xd702('0x29')](agents,function(_0x2946ae,_0x56e9cd){if(_0x2946ae[_0xd702('0x5')]==_0xee8bf1[_0xd702('0x5')]&&!_[_0xd702('0x2a')](unanswered,_0x2946ae[_0xd702('0x18')])){utils[_0xd702('0x16')](util['format'](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xee8bf1);utils[_0xd702('0x1c')](util['format'](_0xd702('0x2c'),_0xee8bf1['uniqueid'],_0x2946ae['membername'],_0x2946ae[_0xd702('0x18')]));_0x2946ae[_0xd702('0x1f')]=!![];_0x2946ae[_0xd702('0x20')]=utils['now']();_0x2946ae[_0xd702('0xa')]=_0xd702('0x2d');_0x2946ae['reason']=_0xd702('0x2d');_0x2946ae[_0xd702('0x24')]=_0xee8bf1[_0xd702('0x24')];_0x2946ae[_0xd702('0x26')]=0x0;writeDB(_0x2946ae);}});}catch(_0xa6b40a){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xa6b40a);}};exports[_0xd702('0x2e')]=function(_0x9f458b){try{if(agents[_0x9f458b[_0xd702('0x18')]]){utils[_0xd702('0x16')](util['format'](_0xd702('0x2f'),_0x9f458b[_0xd702('0x5')]),_0x9f458b);utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x30'),_0x9f458b[_0xd702('0x5')],agents[_0x9f458b[_0xd702('0x18')]]['membername'],_0x9f458b['destuniqueid']));agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0x31')]=utils['now']();agents[_0x9f458b['destuniqueid']][_0xd702('0x9')]=_0x9f458b[_0xd702('0x9')];agents[_0x9f458b['destuniqueid']][_0xd702('0x1b')]=_0x9f458b[_0xd702('0x1b')];agents[_0x9f458b[_0xd702('0x18')]]['holdtime']=_0x9f458b[_0xd702('0x25')];agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0xa')]='connect';_[_0xd702('0x29')](agents,function(_0x512854,_0x359bbd){if(_0x512854[_0xd702('0x18')]!=_0x9f458b[_0xd702('0x18')]&&_0x512854[_0xd702('0x5')]==_0x9f458b[_0xd702('0x5')]){_0x512854[_0xd702('0x26')]=0x0;_0x512854[_0xd702('0x24')]=_0x9f458b[_0xd702('0x25')];_0x512854['agentringnoanswer']=!![];_0x512854[_0xd702('0x20')]=utils[_0xd702('0x21')]();_0x512854[_0xd702('0xa')]=_0xd702('0x32');_0x512854[_0xd702('0x23')]='answered_elsewhere';_0x512854[_0xd702('0x33')]=_0x9f458b[_0xd702('0x18')];_0x512854[_0xd702('0x34')]=_0x9f458b['membername'];writeDB(_0x512854);}});}}catch(_0xd48ad0){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2f'),_0x9f458b['uniqueid']),_0xd48ad0);}};exports[_0xd702('0xf')]=function(_0xfa5e9){try{if(!_[_0xd702('0x35')](agents[_0xfa5e9[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x36'),_0xfa5e9[_0xd702('0x5')]),_0xfa5e9);utils['info'](util['format'](_0xd702('0x37'),_0xfa5e9[_0xd702('0x5')],agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x7')],_0xfa5e9[_0xd702('0x18')]));agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0xf')]=!![];agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x38')]=utils['now']();agents[_0xfa5e9['destuniqueid']][_0xd702('0x26')]=utils['diffTime'](agents[_0xfa5e9[_0xd702('0x18')]]['agentcompleteAt'],agents[_0xfa5e9[_0xd702('0x18')]]['agentconnectAt']);agents[_0xfa5e9[_0xd702('0x18')]]['reason']=_0xfa5e9[_0xd702('0x23')];agents[_0xfa5e9[_0xd702('0x18')]]['lastevent']=_0xd702('0x39');writeDB(agents[_0xfa5e9[_0xd702('0x18')]]);}}catch(_0x2c0528){utils[_0xd702('0x1d')](util[_0xd702('0x3')]('[%s][agents][agentcomplete]',_0xfa5e9[_0xd702('0x5')]),_0x2c0528);}};exports[_0xd702('0x3a')]=function(_0x2d09be){try{if(!_['isNil'](agents[_0x2d09be[_0xd702('0x3b')]])){utils['debug'](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x2d09be);utils['info'](util['format'](_0xd702('0x3d'),_0x2d09be[_0xd702('0x5')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x7')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x5')]));agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3e')]=!![];agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3f')]='blind';agents[_0x2d09be['transfereruniqueid']][_0xd702('0x40')]=_0x2d09be[_0xd702('0x41')];agents[_0x2d09be[_0xd702('0x3b')]]['transferuniqueid']=agents[_0x2d09be['transfereruniqueid']][_0xd702('0x5')];}}catch(_0x54c7e2){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x54c7e2);}};exports[_0xd702('0x42')]=function(_0x3cd4c1){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1['origtransfereruniqueid']),_0x3cd4c1);if(_0x3cd4c1[_0xd702('0x44')]==_0x3cd4c1[_0xd702('0x45')]){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x46')]])){utils['info'](util[_0xd702('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1['secondtransfereruniqueid']]['membername']));agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3e')]=!![];agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1[_0xd702('0x46')]]['transferexten']=_0x3cd4c1[_0xd702('0x48')];agents[_0x3cd4c1[_0xd702('0x46')]]['transferuniqueid']=_0x3cd4c1[_0xd702('0x44')];}if(_0x3cd4c1[_0xd702('0x49')]&&agents[_0x3cd4c1[_0xd702('0x49')]]){agents[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1[_0xd702('0x49')]]=_['clone'](agents[_0x3cd4c1[_0xd702('0x49')]]);transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x8')];transfers[_0x3cd4c1['transfereeuniqueid']]['calleridname']=agents[_0x3cd4c1[_0xd702('0x46')]]['calleridname'];transfers[_0x3cd4c1['transfereeuniqueid']][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x31')]=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x49')]]['holdtime']=0x0;transfers[_0x3cd4c1[_0xd702('0x49')]]['agententerreason']=0x2;}}else if(_0x3cd4c1[_0xd702('0x46')]==_0x3cd4c1['secondtransfererlinkedid']){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x44')]])){utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x4b'),_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1[_0xd702('0x44')]]['membername']));agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3e')]=!![];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x40')]=_0x3cd4c1[_0xd702('0x4c')];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x4d')]=_0x3cd4c1['secondtransfereruniqueid'];}if(_0x3cd4c1[_0xd702('0x4e')]&&agents[_0x3cd4c1[_0xd702('0x4e')]]){agents[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1['transfertargetuniqueid']]=_[_0xd702('0x4f')](agents[_0x3cd4c1[_0xd702('0x4e')]]);transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x44')]]['calleridnum'];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x50')]=agents[_0x3cd4c1[_0xd702('0x44')]][_0xd702('0x50')];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x4e')]]['agentconnectAt']=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x24')]=0x0;transfers[_0x3cd4c1[_0xd702('0x4e')]]['agententerreason']=0x2;}}}catch(_0x3e99ff){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1[_0xd702('0x44')]),_0x3e99ff);}};exports['hangup']=function(_0x5bc3dd){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x5bc3dd);if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]===_0xd702('0x22')){if(_0x5bc3dd[_0xd702('0x52')]==='21'){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x53');agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]=_0xd702('0x53');}utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd['uniqueid']][_0xd702('0x7')],agents[_0x5bc3dd['uniqueid']][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);var _0x472e5a=unanswered[_0xd702('0x55')](_0x5bc3dd[_0xd702('0x5')]);if(_0x472e5a>-0x1){unanswered[_0xd702('0x56')](_0x472e5a,0x1);}}if(transfers[_0x5bc3dd[_0xd702('0x5')]]){transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x26')]=utils[_0xd702('0x57')](transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0x31')]);transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x58');transfers[_0x5bc3dd[_0xd702('0x5')]]['lastevent']=_0xd702('0x39');utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd[_0xd702('0x5')],transfers[_0x5bc3dd[_0xd702('0x5')]]['membername'],transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0xa')]));writeDB(transfers[_0x5bc3dd[_0xd702('0x5')]],!![]);}if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();agents[_0x5bc3dd[_0xd702('0x5')]]['talktime']=utils[_0xd702('0x57')](agents[_0x5bc3dd[_0xd702('0x5')]]['agentcompleteAt'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]);agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=agents[_0x5bc3dd[_0xd702('0x5')]]['transfer']?'transfer':_0xd702('0x58');agents[_0x5bc3dd['uniqueid']][_0xd702('0xa')]=_0xd702('0x39');utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd[_0xd702('0x5')]]['membername'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);}}catch(_0x1ea077){utils['error'](util['format'](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x1ea077);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b5e4105..59398d3 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 _0xdf62=['substring','lastIndexOf','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','systemanswertime','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfereruniqueid','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split'];(function(_0x48baec,_0x3f9c47){var _0x4454ac=function(_0xfc751){while(--_0xfc751){_0x48baec['push'](_0x48baec['shift']());}};_0x4454ac(++_0x3f9c47);}(_0xdf62,0x151));var _0x2df6=function(_0x3e3ff0,_0x22148d){_0x3e3ff0=_0x3e3ff0-0x0;var _0x3c3bc3=_0xdf62[_0x3e3ff0];return _0x3c3bc3;};'use strict';var _=require(_0x2df6('0x0'));var util=require(_0x2df6('0x1'));var utils=require(_0x2df6('0x2'));var transfers=require(_0x2df6('0x3'));var dispositions=[_0x2df6('0x4'),_0x2df6('0x5'),'FAILED','NO\x20ANSWER',_0x2df6('0x4'),_0x2df6('0x4'),_0x2df6('0x6'),_0x2df6('0x7'),_0x2df6('0x5'),_0x2df6('0x5'),_0x2df6('0x5')];var channels={};function writeDB(_0x5059ec){var _0x8acc33;if(transfers['blinds'][_0x5059ec[_0x2df6('0x8')]]){_0x8acc33=_0x5059ec[_0x2df6('0x8')];_0x5059ec[_0x2df6('0x8')]=transfers[_0x2df6('0x9')][_0x5059ec['uniqueid']]['transfereeuniqueid'];}utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0xc'),_0x5059ec[_0x2df6('0x8')],_0x5059ec['channel'],_0x5059ec[_0x2df6('0xd')],_0x5059ec[_0x2df6('0xe')],_0x5059ec['interface'],_0x5059ec[_0x2df6('0xf')],_0x5059ec[_0x2df6('0x10')],_0x5059ec[_0x2df6('0x11')]));if(_0x5059ec[_0x2df6('0x12')]){utils[_0x2df6('0x13')](_0x5059ec['accountcode'])[_0x2df6('0x14')](function(_0x2bd59c){if(_0x2bd59c){_0x5059ec[_0x2df6('0x15')]=_0x2bd59c['id'];}utils[_0x2df6('0x16')](_0x2df6('0x17'),_0x5059ec);});}else{utils['request'](_0x2df6('0x17'),_0x5059ec);}if(channels[_0x5059ec[_0x2df6('0x8')]]){delete channels[_0x5059ec[_0x2df6('0x8')]];}else if(_0x8acc33&&channels[_0x8acc33]){if(!transfers[_0x2df6('0x9')][_0x8acc33][_0x2df6('0x18')])delete transfers['blinds'][_0x8acc33];delete channels[_0x8acc33];}}exports[_0x2df6('0x19')]=function(_0x207189){try{utils[_0x2df6('0x1a')](util[_0x2df6('0xb')](_0x2df6('0x1b'),_0x207189['uniqueid']),_0x207189);if(_0x207189[_0x2df6('0x8')]==_0x207189[_0x2df6('0x1c')]&&_0x207189[_0x2df6('0x1d')]!=_0x2df6('0x1e')){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x1f'),_0x207189['uniqueid'],_0x207189[_0x2df6('0x20')],_0x207189[_0x2df6('0x21')]));channels[_0x207189[_0x2df6('0x8')]]={'uniqueid':_0x207189['uniqueid'],'accountcode':_0x207189[_0x2df6('0x12')],'source':_0x207189[_0x2df6('0xf')],'destination':_0x207189[_0x2df6('0x21')],'destinationcontext':_0x207189['context'],'channel':_0x207189[_0x2df6('0x1d')],'starttime':utils[_0x2df6('0x22')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2df6('0x4'),'amaflags':_0x2df6('0x23')};}}catch(_0x2a59db){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x1b'),_0x207189[_0x2df6('0x8')]),_0x2a59db);}};exports[_0x2df6('0x25')]=function(_0x42aa51){try{utils[_0x2df6('0x1a')](util['format']('[%s][calls][newstate]',_0x42aa51[_0x2df6('0x8')]),_0x42aa51);if(!_[_0x2df6('0x26')](channels[_0x42aa51[_0x2df6('0x8')]])&&_0x42aa51['channelstate']==0x6){utils[_0x2df6('0xa')](util[_0x2df6('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x42aa51[_0x2df6('0x8')],_0x42aa51['context'],_0x42aa51[_0x2df6('0x1d')]));if(_['isNil'](channels[_0x42aa51[_0x2df6('0x8')]]['systemanswertime'])){channels[_0x42aa51[_0x2df6('0x8')]][_0x2df6('0x27')]=utils[_0x2df6('0x22')]();}}else if(!_[_0x2df6('0x26')](channels[_0x42aa51['linkedid']])&&_0x42aa51[_0x2df6('0x28')]==0x6&&_0x42aa51['context']!='transfer'){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x29'),_0x42aa51['uniqueid'],_0x42aa51[_0x2df6('0x1c')],_0x42aa51[_0x2df6('0x20')],_0x42aa51[_0x2df6('0x1d')]));channels[_0x42aa51[_0x2df6('0x1c')]][_0x2df6('0x12')]=_0x42aa51[_0x2df6('0x12')];channels[_0x42aa51[_0x2df6('0x1c')]]['destinationchannel']=_0x42aa51[_0x2df6('0x1d')];if(_[_0x2df6('0x26')](channels[_0x42aa51[_0x2df6('0x1c')]][_0x2df6('0x2a')])){channels[_0x42aa51['linkedid']][_0x2df6('0x2a')]=utils['now']();}channels[_0x42aa51['linkedid']][_0x2df6('0x2b')]=dispositions[_[_0x2df6('0x2c')](_0x42aa51[_0x2df6('0x28')])]||_0x2df6('0x6');}}catch(_0x52f913){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x2d'),_0x42aa51[_0x2df6('0x8')]),_0x52f913);}};exports[_0x2df6('0x2e')]=function(_0x18d63f){try{if(!_['isNil'](channels[_0x18d63f[_0x2df6('0x8')]])){utils[_0x2df6('0x1a')](util['format'](_0x2df6('0x2f'),_0x18d63f[_0x2df6('0x8')]),_0x18d63f);if(_[_0x2df6('0x26')](channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x30')])){channels[_0x18d63f[_0x2df6('0x8')]]['callerid']=_0x18d63f[_0x2df6('0x31')]+'\x20<'+_0x18d63f[_0x2df6('0xf')]+'>';}utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x32'),_0x18d63f[_0x2df6('0x8')],channels[_0x18d63f['uniqueid']]['callerid'],_0x18d63f[_0x2df6('0x33')]));channels[_0x18d63f['uniqueid']]['endtime']=utils['now']();channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x34')]=utils['diffTime'](channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x35')],channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x36')]);channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x37')]=channels[_0x18d63f['uniqueid']]['answertime']?utils['diffTime'](channels[_0x18d63f[_0x2df6('0x8')]][_0x2df6('0x35')],channels[_0x18d63f['uniqueid']][_0x2df6('0x2a')]):0x0;writeDB(channels[_0x18d63f[_0x2df6('0x8')]]);}}catch(_0xe34b55){utils['error'](util[_0x2df6('0xb')](_0x2df6('0x2f'),_0x18d63f[_0x2df6('0x8')]),_0xe34b55);}};exports[_0x2df6('0x38')]=function(_0x509418){try{if(!_[_0x2df6('0x26')](channels[_0x509418[_0x2df6('0x39')]])){utils[_0x2df6('0x1a')](util[_0x2df6('0xb')](_0x2df6('0x3a'),_0x509418['origtransfereruniqueid']),_0x509418);if(channels[_0x509418[_0x2df6('0x39')]][_0x2df6('0x1d')]==_0x509418[_0x2df6('0x3b')]){utils['info'](util[_0x2df6('0xb')](_0x2df6('0x3c'),_0x509418['origtransfereruniqueid'],_0x509418[_0x2df6('0x39')],_0x509418[_0x2df6('0x3d')]));channels[_0x509418[_0x2df6('0x39')]][_0x2df6('0x3e')]=_0x509418[_0x2df6('0x3d')];channels[_0x509418[_0x2df6('0x39')]][_0x2df6('0x3f')]=_0x2df6('0x40');}else if(channels[_0x509418['localtwolinkedid']][_0x2df6('0x1d')]=_0x509418['transfertargetchannel']){utils['info'](util[_0x2df6('0xb')](_0x2df6('0x3c'),_0x509418[_0x2df6('0x41')],_0x509418[_0x2df6('0x39')],_0x509418[_0x2df6('0x42')]));channels[_0x509418['localtwolinkedid']]['destinationchannel']=_0x509418[_0x2df6('0x42')];channels[_0x509418['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x20c032){utils[_0x2df6('0x24')](util['format'](_0x2df6('0x3a'),_0x509418[_0x2df6('0x41')]),_0x20c032);}};exports['musiconholdstart']=function(_0x4fc2c0){try{if(!_[_0x2df6('0x26')](channels[_0x4fc2c0[_0x2df6('0x8')]])){utils[_0x2df6('0x1a')](util['format'](_0x2df6('0x43'),_0x4fc2c0[_0x2df6('0x8')]),_0x4fc2c0);channels[_0x4fc2c0[_0x2df6('0x8')]][_0x2df6('0x44')]=utils[_0x2df6('0x22')]();utils['info'](util[_0x2df6('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4fc2c0[_0x2df6('0x8')],channels[_0x4fc2c0[_0x2df6('0x8')]][_0x2df6('0x44')]));}}catch(_0x4dfaea){utils[_0x2df6('0x24')](util['format'](_0x2df6('0x43'),_0x4fc2c0[_0x2df6('0x8')]),_0x4dfaea);}};exports[_0x2df6('0x45')]=function(_0x290834){try{if(!_['isNil'](channels[_0x290834['uniqueid']])){utils[_0x2df6('0x1a')](util[_0x2df6('0xb')](_0x2df6('0x46'),_0x290834[_0x2df6('0x8')]),_0x290834);if(!_[_0x2df6('0x26')](channels[_0x290834['uniqueid']]['musiconholdstartAt'])){channels[_0x290834[_0x2df6('0x8')]][_0x2df6('0x47')]+=utils['diffTime'](utils['now'](),channels[_0x290834['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x2df6('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x290834[_0x2df6('0x8')],channels[_0x290834[_0x2df6('0x8')]][_0x2df6('0x47')]));delete channels[_0x290834[_0x2df6('0x8')]][_0x2df6('0x44')];}}}catch(_0x6283a7){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x46'),_0x290834['uniqueid']),_0x6283a7);}};exports[_0x2df6('0x48')]=function(_0x1d97e8){try{if(!_[_0x2df6('0x26')](channels[_0x1d97e8[_0x2df6('0x8')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x1d97e8[_0x2df6('0x8')]),_0x1d97e8);if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')]['xmd-originatecalleridnum'])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x4a'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x4c')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x4d')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x4e'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8['uniqueid']]['destination']=_0x1d97e8[_0x2df6('0x4b')];channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x30')]='\x22'+_0x1d97e8[_0x2df6('0x4b')]+_0x2df6('0x4f')+_0x1d97e8[_0x2df6('0x4b')]+'>';}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x50')])||!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x51')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x52'),_0x1d97e8[_0x2df6('0x8')],!_['isNil'](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x50')])?_0x2df6('0x50'):_0x2df6('0x51'),_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x30')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x53')])||!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x54')])){utils[_0x2df6('0xa')](util['format'](_0x2df6('0x52'),_0x1d97e8['uniqueid'],!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x53')])?_0x2df6('0x53'):_0x2df6('0x54'),_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x55')]=_0x2df6('0x56');channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x57')]=_0x1d97e8['value'];channels[_0x1d97e8['uniqueid']][_0x2df6('0xd')]=!![];}if(!_[_0x2df6('0x26')](_0x1d97e8['variable'][_0x2df6('0x58')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x59'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8['value']));channels[_0x1d97e8[_0x2df6('0x8')]]['ContactId']=_0x1d97e8[_0x2df6('0x4b')];}if(!_[_0x2df6('0x26')](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x5a')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x5b'),_0x1d97e8['uniqueid'],_0x1d97e8['value']));channels[_0x1d97e8['uniqueid']][_0x2df6('0x5c')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_['isNil'](_0x1d97e8['variable'][_0x2df6('0x5d')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x5e'),_0x1d97e8[_0x2df6('0x8')],_0x1d97e8[_0x2df6('0x4b')]));channels[_0x1d97e8[_0x2df6('0x8')]][_0x2df6('0x5f')]=_0x1d97e8[_0x2df6('0x4b')];}if(!_['isNil'](_0x1d97e8[_0x2df6('0x49')][_0x2df6('0x60')])){utils[_0x2df6('0xa')](util[_0x2df6('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1d97e8[_0x2df6('0x8')],_0x1d97e8['value']));channels[_0x1d97e8[_0x2df6('0x8')]]['sipcallid']=_0x1d97e8[_0x2df6('0x4b')];}}}catch(_0x692bb5){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x61'),_0x1d97e8['uniqueid']),_0x692bb5);}};exports[_0x2df6('0x62')]=function(_0x5e0a5a){try{if(!_[_0x2df6('0x26')](channels[_0x5e0a5a[_0x2df6('0x8')]])){utils['debug'](util[_0x2df6('0xb')]('[%s][calls][newexten]',_0x5e0a5a['uniqueid']),_0x5e0a5a);utils[_0x2df6('0xa')](util[_0x2df6('0xb')](_0x2df6('0x63'),_0x5e0a5a[_0x2df6('0x8')],_0x5e0a5a[_0x2df6('0x64')],_0x5e0a5a['appdata']));if(_0x5e0a5a[_0x2df6('0x64')][_0x2df6('0x65')]()==_0x2df6('0x66')&&_[_0x2df6('0x67')](_0x5e0a5a[_0x2df6('0x68')][_0x2df6('0x65')](),_0x2df6('0x69'))){var _0x55cd18=_0x5e0a5a[_0x2df6('0x68')][_0x2df6('0x6a')]('=');var _0x80a461=_0x55cd18[0x0][_0x2df6('0x6b')](_0x55cd18[0x0]['lastIndexOf']('(')+0x1,_0x55cd18[0x0][_0x2df6('0x6c')](')'));var _0xd99c6d=_0x55cd18[0x1];channels[_0x5e0a5a[_0x2df6('0x8')]][_0x80a461]=_0xd99c6d;}if(!_['includes']([_0x2df6('0x2e'),'noop','execif',_0x2df6('0x66'),_0x2df6('0x6d')],_0x5e0a5a[_0x2df6('0x64')][_0x2df6('0x65')]())){channels[_0x5e0a5a[_0x2df6('0x8')]][_0x2df6('0x55')]=_0x5e0a5a[_0x2df6('0x64')];channels[_0x5e0a5a['uniqueid']][_0x2df6('0x57')]=_0x5e0a5a[_0x2df6('0x68')];}}}catch(_0x1e2e32){utils[_0x2df6('0x24')](util[_0x2df6('0xb')](_0x2df6('0x6e'),_0x5e0a5a['uniqueid']),_0x1e2e32);}}; \ No newline at end of file +var _0x3912=['calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','starttime','billableseconds','diffTime','endtime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','destination','\x22\x20<','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3912,0xa9));var _0x2391=function(_0x1ce2ac,_0x46c458){_0x1ce2ac=_0x1ce2ac-0x0;var _0x7719bc=_0x3912[_0x1ce2ac];return _0x7719bc;};'use strict';var _=require(_0x2391('0x0'));var util=require(_0x2391('0x1'));var utils=require('./utils');var transfers=require(_0x2391('0x2'));var dispositions=[_0x2391('0x3'),_0x2391('0x4'),_0x2391('0x4'),_0x2391('0x3'),_0x2391('0x3'),_0x2391('0x3'),_0x2391('0x5'),_0x2391('0x6'),_0x2391('0x4'),_0x2391('0x4'),_0x2391('0x4')];var channels={};function writeDB(_0x463e84){var _0x256290;if(transfers[_0x2391('0x7')][_0x463e84[_0x2391('0x8')]]){_0x256290=_0x463e84[_0x2391('0x8')];_0x463e84[_0x2391('0x8')]=transfers[_0x2391('0x7')][_0x463e84[_0x2391('0x8')]][_0x2391('0x9')];}utils['info'](util[_0x2391('0xa')](_0x2391('0xb'),_0x463e84[_0x2391('0x8')],_0x463e84[_0x2391('0xc')],_0x463e84[_0x2391('0xd')],_0x463e84[_0x2391('0xe')],_0x463e84[_0x2391('0xf')],_0x463e84[_0x2391('0x10')],_0x463e84[_0x2391('0x11')],_0x463e84['lastevent']));if(_0x463e84[_0x2391('0x12')]){utils['getUserByInternal'](_0x463e84[_0x2391('0x12')])[_0x2391('0x13')](function(_0x1b5851){if(_0x1b5851){_0x463e84[_0x2391('0x14')]=_0x1b5851['id'];}utils['request']('CreateVoiceCallReport',_0x463e84);});}else{utils[_0x2391('0x15')](_0x2391('0x16'),_0x463e84);}if(channels[_0x463e84['uniqueid']]){delete channels[_0x463e84[_0x2391('0x8')]];}else if(_0x256290&&channels[_0x256290]){if(!transfers[_0x2391('0x7')][_0x256290]['recording'])delete transfers[_0x2391('0x7')][_0x256290];delete channels[_0x256290];}}exports[_0x2391('0x17')]=function(_0x58f710){try{utils['debug'](util[_0x2391('0xa')](_0x2391('0x18'),_0x58f710[_0x2391('0x8')]),_0x58f710);if(_0x58f710['uniqueid']==_0x58f710[_0x2391('0x19')]&&_0x58f710['channel']!=_0x2391('0x1a')){utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x1c'),_0x58f710['uniqueid'],_0x58f710[_0x2391('0x1d')],_0x58f710['exten']));channels[_0x58f710[_0x2391('0x8')]]={'uniqueid':_0x58f710[_0x2391('0x8')],'accountcode':_0x58f710[_0x2391('0x12')],'source':_0x58f710['calleridnum'],'destination':_0x58f710['exten'],'destinationcontext':_0x58f710[_0x2391('0x1d')],'channel':_0x58f710[_0x2391('0xc')],'starttime':utils[_0x2391('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2391('0x3'),'amaflags':_0x2391('0x1f')};}}catch(_0x2dd6fd){utils['error'](util[_0x2391('0xa')](_0x2391('0x18'),_0x58f710['uniqueid']),_0x2dd6fd);}};exports[_0x2391('0x20')]=function(_0x15572f){try{utils[_0x2391('0x21')](util['format'](_0x2391('0x22'),_0x15572f[_0x2391('0x8')]),_0x15572f);if(!_[_0x2391('0x23')](channels[_0x15572f['uniqueid']])&&_0x15572f[_0x2391('0x24')]==0x6){utils[_0x2391('0x1b')](util[_0x2391('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x15572f[_0x2391('0x8')],_0x15572f['context'],_0x15572f[_0x2391('0xc')]));if(_[_0x2391('0x23')](channels[_0x15572f[_0x2391('0x8')]][_0x2391('0x25')])){channels[_0x15572f[_0x2391('0x8')]][_0x2391('0x25')]=utils[_0x2391('0x1e')]();}}else if(!_[_0x2391('0x23')](channels[_0x15572f[_0x2391('0x19')]])&&_0x15572f[_0x2391('0x24')]==0x6&&_0x15572f[_0x2391('0x1d')]!=_0x2391('0x26')){utils['info'](util[_0x2391('0xa')](_0x2391('0x27'),_0x15572f[_0x2391('0x8')],_0x15572f[_0x2391('0x19')],_0x15572f[_0x2391('0x1d')],_0x15572f[_0x2391('0xc')]));channels[_0x15572f['linkedid']]['accountcode']=_0x15572f[_0x2391('0x12')];channels[_0x15572f['linkedid']]['destinationchannel']=_0x15572f[_0x2391('0xc')];if(_[_0x2391('0x23')](channels[_0x15572f[_0x2391('0x19')]][_0x2391('0x28')])){channels[_0x15572f[_0x2391('0x19')]][_0x2391('0x28')]=utils['now']();}channels[_0x15572f[_0x2391('0x19')]][_0x2391('0x29')]=dispositions[_[_0x2391('0x2a')](_0x15572f[_0x2391('0x24')])]||_0x2391('0x5');}}catch(_0xf8e11c){utils[_0x2391('0x2b')](util[_0x2391('0xa')](_0x2391('0x22'),_0x15572f[_0x2391('0x8')]),_0xf8e11c);}};exports[_0x2391('0x2c')]=function(_0x5a4dd5){try{if(!_[_0x2391('0x23')](channels[_0x5a4dd5[_0x2391('0x8')]])){utils['debug'](util[_0x2391('0xa')](_0x2391('0x2d'),_0x5a4dd5[_0x2391('0x8')]),_0x5a4dd5);if(_['isNil'](channels[_0x5a4dd5['uniqueid']][_0x2391('0x2e')])){channels[_0x5a4dd5['uniqueid']][_0x2391('0x2e')]=_0x5a4dd5[_0x2391('0x2f')]+'\x20<'+_0x5a4dd5['calleridnum']+'>';}utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x30'),_0x5a4dd5[_0x2391('0x8')],channels[_0x5a4dd5['uniqueid']][_0x2391('0x2e')],_0x5a4dd5['cause-txt']));channels[_0x5a4dd5[_0x2391('0x8')]]['endtime']=utils[_0x2391('0x1e')]();channels[_0x5a4dd5[_0x2391('0x8')]]['duration']=utils['diffTime'](channels[_0x5a4dd5[_0x2391('0x8')]]['endtime'],channels[_0x5a4dd5[_0x2391('0x8')]][_0x2391('0x31')]);channels[_0x5a4dd5[_0x2391('0x8')]][_0x2391('0x32')]=channels[_0x5a4dd5[_0x2391('0x8')]][_0x2391('0x28')]?utils[_0x2391('0x33')](channels[_0x5a4dd5[_0x2391('0x8')]][_0x2391('0x34')],channels[_0x5a4dd5[_0x2391('0x8')]]['answertime']):0x0;writeDB(channels[_0x5a4dd5[_0x2391('0x8')]]);}}catch(_0x41365a){utils[_0x2391('0x2b')](util[_0x2391('0xa')]('[%s][calls][hangup]',_0x5a4dd5[_0x2391('0x8')]),_0x41365a);}};exports[_0x2391('0x35')]=function(_0x543b08){try{if(!_['isNil'](channels[_0x543b08[_0x2391('0x36')]])){utils['debug'](util[_0x2391('0xa')](_0x2391('0x37'),_0x543b08['origtransfereruniqueid']),_0x543b08);if(channels[_0x543b08[_0x2391('0x36')]][_0x2391('0xc')]==_0x543b08[_0x2391('0x38')]){utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x39'),_0x543b08[_0x2391('0x3a')],_0x543b08[_0x2391('0x36')],_0x543b08[_0x2391('0x3b')]));channels[_0x543b08[_0x2391('0x36')]][_0x2391('0x3c')]=_0x543b08[_0x2391('0x3b')];channels[_0x543b08[_0x2391('0x36')]][_0x2391('0x3d')]=_0x2391('0x3e');}else if(channels[_0x543b08[_0x2391('0x36')]][_0x2391('0xc')]=_0x543b08['transfertargetchannel']){utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x39'),_0x543b08[_0x2391('0x3a')],_0x543b08['localtwolinkedid'],_0x543b08[_0x2391('0x3f')]));channels[_0x543b08['localtwolinkedid']]['destinationchannel']=_0x543b08[_0x2391('0x3f')];channels[_0x543b08['localtwolinkedid']][_0x2391('0x3d')]=_0x2391('0x3e');}}}catch(_0x455e5c){utils[_0x2391('0x2b')](util[_0x2391('0xa')](_0x2391('0x37'),_0x543b08[_0x2391('0x3a')]),_0x455e5c);}};exports[_0x2391('0x40')]=function(_0x5ad09f){try{if(!_[_0x2391('0x23')](channels[_0x5ad09f['uniqueid']])){utils['debug'](util[_0x2391('0xa')](_0x2391('0x41'),_0x5ad09f[_0x2391('0x8')]),_0x5ad09f);channels[_0x5ad09f[_0x2391('0x8')]]['musiconholdstartAt']=utils['now']();utils['info'](util[_0x2391('0xa')](_0x2391('0x42'),_0x5ad09f[_0x2391('0x8')],channels[_0x5ad09f[_0x2391('0x8')]][_0x2391('0x43')]));}}catch(_0x218dbe){utils[_0x2391('0x2b')](util[_0x2391('0xa')](_0x2391('0x41'),_0x5ad09f[_0x2391('0x8')]),_0x218dbe);}};exports[_0x2391('0x44')]=function(_0x4523c2){try{if(!_[_0x2391('0x23')](channels[_0x4523c2['uniqueid']])){utils[_0x2391('0x21')](util['format'](_0x2391('0x45'),_0x4523c2[_0x2391('0x8')]),_0x4523c2);if(!_[_0x2391('0x23')](channels[_0x4523c2[_0x2391('0x8')]]['musiconholdstartAt'])){channels[_0x4523c2[_0x2391('0x8')]][_0x2391('0x46')]+=utils[_0x2391('0x33')](utils[_0x2391('0x1e')](),channels[_0x4523c2[_0x2391('0x8')]][_0x2391('0x43')]);utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x47'),_0x4523c2[_0x2391('0x8')],channels[_0x4523c2[_0x2391('0x8')]]['mohtime']));delete channels[_0x4523c2[_0x2391('0x8')]]['musiconholdstartAt'];}}}catch(_0xfec1dd){utils['error'](util[_0x2391('0xa')]('[%s][calls][musiconholdstop]',_0x4523c2[_0x2391('0x8')]),_0xfec1dd);}};exports['varset']=function(_0x4c9590){try{if(!_[_0x2391('0x23')](channels[_0x4c9590[_0x2391('0x8')]])){utils[_0x2391('0x21')](util[_0x2391('0xa')]('[%s][calls][varset]',_0x4c9590[_0x2391('0x8')]),_0x4c9590);if(!_['isNil'](_0x4c9590['variable']['xmd-originatecalleridnum'])){utils['info'](util[_0x2391('0xa')](_0x2391('0x48'),_0x4c9590['uniqueid'],_0x4c9590[_0x2391('0x49')]));channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x4a')]=_0x4c9590[_0x2391('0x49')];}if(!_['isNil'](_0x4c9590[_0x2391('0x4b')][_0x2391('0x4c')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4c9590[_0x2391('0x8')],_0x4c9590[_0x2391('0x49')]));channels[_0x4c9590['uniqueid']][_0x2391('0x4d')]=_0x4c9590[_0x2391('0x49')];channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x2e')]='\x22'+_0x4c9590[_0x2391('0x49')]+_0x2391('0x4e')+_0x4c9590[_0x2391('0x49')]+'>';}if(!_[_0x2391('0x23')](_0x4c9590[_0x2391('0x4b')]['xmd-callerid-preview'])||!_['isNil'](_0x4c9590['variable']['xmd-callerid'])){utils['info'](util[_0x2391('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4c9590[_0x2391('0x8')],!_[_0x2391('0x23')](_0x4c9590['variable']['xmd-callerid-preview'])?'xmd-callerid-preview':_0x2391('0x4f'),_0x4c9590['value']));channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x2e')]=_0x4c9590[_0x2391('0x49')];}if(!_[_0x2391('0x23')](_0x4c9590[_0x2391('0x4b')]['xmd-queue'])||!_[_0x2391('0x23')](_0x4c9590['variable'][_0x2391('0x50')])){utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x51'),_0x4c9590['uniqueid'],!_[_0x2391('0x23')](_0x4c9590[_0x2391('0x4b')]['xmd-queue'])?_0x2391('0x52'):_0x2391('0x50'),_0x4c9590[_0x2391('0x49')]));channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x53')]=_0x2391('0x54');channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x55')]=_0x4c9590[_0x2391('0x49')];channels[_0x4c9590['uniqueid']][_0x2391('0xd')]=!![];}if(!_['isNil'](_0x4c9590['variable']['xmd-contactid'])){utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x56'),_0x4c9590[_0x2391('0x8')],_0x4c9590[_0x2391('0x49')]));channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x57')]=_0x4c9590[_0x2391('0x49')];}if(!_[_0x2391('0x23')](_0x4c9590[_0x2391('0x4b')]['xmd-cdrtype'])){utils[_0x2391('0x1b')](util[_0x2391('0xa')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4c9590[_0x2391('0x8')],_0x4c9590['value']));channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x58')]=_0x4c9590[_0x2391('0x49')];}if(!_[_0x2391('0x23')](_0x4c9590[_0x2391('0x4b')][_0x2391('0x59')])){utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x5a'),_0x4c9590[_0x2391('0x8')],_0x4c9590[_0x2391('0x49')]));channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x5b')]=_0x4c9590[_0x2391('0x49')];}if(!_['isNil'](_0x4c9590['variable'][_0x2391('0x5c')])){utils['info'](util[_0x2391('0xa')](_0x2391('0x5d'),_0x4c9590[_0x2391('0x8')],_0x4c9590['value']));channels[_0x4c9590[_0x2391('0x8')]][_0x2391('0x5c')]=_0x4c9590[_0x2391('0x49')];}}}catch(_0x2821bc){utils[_0x2391('0x2b')](util[_0x2391('0xa')](_0x2391('0x5e'),_0x4c9590[_0x2391('0x8')]),_0x2821bc);}};exports['newexten']=function(_0x79fd4c){try{if(!_['isNil'](channels[_0x79fd4c['uniqueid']])){utils[_0x2391('0x21')](util['format']('[%s][calls][newexten]',_0x79fd4c[_0x2391('0x8')]),_0x79fd4c);utils[_0x2391('0x1b')](util[_0x2391('0xa')](_0x2391('0x5f'),_0x79fd4c[_0x2391('0x8')],_0x79fd4c['application'],_0x79fd4c['appdata']));if(_0x79fd4c[_0x2391('0x60')][_0x2391('0x61')]()=='set'&&_[_0x2391('0x62')](_0x79fd4c[_0x2391('0x63')][_0x2391('0x61')](),_0x2391('0x64'))){var _0x2164b5=_0x79fd4c[_0x2391('0x63')]['split']('=');var _0x3aea4e=_0x2164b5[0x0][_0x2391('0x65')](_0x2164b5[0x0][_0x2391('0x66')]('(')+0x1,_0x2164b5[0x0][_0x2391('0x66')](')'));var _0x44e6c7=_0x2164b5[0x1];channels[_0x79fd4c[_0x2391('0x8')]][_0x3aea4e]=_0x44e6c7;}if(!_[_0x2391('0x67')]([_0x2391('0x2c'),_0x2391('0x68'),_0x2391('0x69'),_0x2391('0x6a'),_0x2391('0x6b')],_0x79fd4c[_0x2391('0x60')][_0x2391('0x61')]())){channels[_0x79fd4c[_0x2391('0x8')]][_0x2391('0x53')]=_0x79fd4c[_0x2391('0x60')];channels[_0x79fd4c[_0x2391('0x8')]]['lastdata']=_0x79fd4c[_0x2391('0x63')];}}}catch(_0x393785){utils[_0x2391('0x2b')](util['format']('[%s][calls][newexten]',_0x79fd4c['uniqueid']),_0x393785);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 638d51d..67239bc 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 _0x0b3a=['fullybooted','error','[core]\x20error','close','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x433d42,_0x36cf0f){var _0x50dc5=function(_0x9330c3){while(--_0x9330c3){_0x433d42['push'](_0x433d42['shift']());}};_0x50dc5(++_0x36cf0f);}(_0x0b3a,0x9a));var _0xa0b3=function(_0x5806c3,_0x5105d8){_0x5806c3=_0x5806c3-0x0;var _0x48ac77=_0x0b3a[_0x5806c3];return _0x48ac77;};'use strict';var utils=require(_0xa0b3('0x0'));exports[_0xa0b3('0x1')]=function(){utils[_0xa0b3('0x2')](_0xa0b3('0x3'));};exports[_0xa0b3('0x4')]=function(){utils['info'](_0xa0b3('0x5'));};exports[_0xa0b3('0x6')]=function(){utils[_0xa0b3('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x396a5d){utils[_0xa0b3('0x7')](_0xa0b3('0x8'),_0x396a5d);};exports[_0xa0b3('0x9')]=function(){utils[_0xa0b3('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x1f34f1){}; \ No newline at end of file +var _0x44ff=['close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error'];(function(_0x5d5a75,_0x3a1456){var _0xb40a02=function(_0x4fa8e1){while(--_0x4fa8e1){_0x5d5a75['push'](_0x5d5a75['shift']());}};_0xb40a02(++_0x3a1456);}(_0x44ff,0x116));var _0xf44f=function(_0x13ff97,_0x2f1e42){_0x13ff97=_0x13ff97-0x0;var _0x182ae7=_0x44ff[_0x13ff97];return _0x182ae7;};'use strict';var utils=require(_0xf44f('0x0'));exports['connect']=function(){utils[_0xf44f('0x1')](_0xf44f('0x2'));};exports[_0xf44f('0x3')]=function(){utils['info'](_0xf44f('0x4'));};exports[_0xf44f('0x5')]=function(){utils[_0xf44f('0x1')]('[core]\x20fullybooted');};exports[_0xf44f('0x6')]=function(_0x3ab82f){utils[_0xf44f('0x6')](_0xf44f('0x7'),_0x3ab82f);};exports[_0xf44f('0x8')]=function(){utils[_0xf44f('0x1')](_0xf44f('0x9'));};exports[_0xf44f('0xa')]=function(_0x47ee9e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index f705ea6..fa053ae 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 _0xb94e=['[%s][dials][newexten]','varset','debug','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','isNil','[%s][dials][hangup]','calleridnum','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','split','error'];(function(_0x519869,_0x5e9535){var _0x26f819=function(_0x4a83bd){while(--_0x4a83bd){_0x519869['push'](_0x519869['shift']());}};_0x26f819(++_0x5e9535);}(_0xb94e,0x1d8));var _0xeb94=function(_0x426258,_0x22e200){_0x426258=_0x426258-0x0;var _0x40f83f=_0xb94e[_0x426258];return _0x40f83f;};'use strict';var _=require(_0xeb94('0x0'));var util=require(_0xeb94('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x59fd4b){utils[_0xeb94('0x2')](util[_0xeb94('0x3')](_0xeb94('0x4'),_0x59fd4b[_0xeb94('0x5')],_0x59fd4b[_0xeb94('0x6')],_0x59fd4b[_0xeb94('0x7')],_0x59fd4b['calleridnum'],_0x59fd4b[_0xeb94('0x8')],_0x59fd4b[_0xeb94('0x9')]));utils['request'](_0xeb94('0xa'),_0x59fd4b);delete dials[_0x59fd4b[_0xeb94('0x5')]];}exports[_0xeb94('0xb')]=function(_0x2b31b2){try{utils['debug'](util[_0xeb94('0x3')]('[%s][dials][newexten]',_0x2b31b2[_0xeb94('0x5')]),_0x2b31b2);utils['info'](util['format'](_0xeb94('0xc'),_0x2b31b2[_0xeb94('0x5')],_0x2b31b2[_0xeb94('0xd')],_0x2b31b2[_0xeb94('0xe')]));if(_0x2b31b2[_0xeb94('0xd')]['toLowerCase']()=='set'&&_['startsWith'](_0x2b31b2['appdata'][_0xeb94('0xf')](),'cdr(routeid)')){var _0x5740b9=_0x2b31b2[_0xeb94('0xe')][_0xeb94('0x10')]('=');dials[_0x2b31b2[_0xeb94('0x5')]]={'routeId':_0x5740b9[0x1]};}}catch(_0x4e39f4){utils[_0xeb94('0x11')](util[_0xeb94('0x3')](_0xeb94('0x12'),_0x2b31b2[_0xeb94('0x5')]),_0x4e39f4);}};exports[_0xeb94('0x13')]=function(_0x5721e9){try{utils[_0xeb94('0x14')](util[_0xeb94('0x3')]('[%s][dials][varset]',_0x5721e9[_0xeb94('0x5')]),_0x5721e9);if(!_['isNil'](_0x5721e9['variable'][_0xeb94('0x15')])){utils[_0xeb94('0x2')](util['format'](_0xeb94('0x16'),_0x5721e9[_0xeb94('0x5')],_0x5721e9[_0xeb94('0x17')]));dials[_0x5721e9['uniqueid']]={'routeId':_0x5721e9[_0xeb94('0x17')]};}}catch(_0x579798){utils[_0xeb94('0x11')](util[_0xeb94('0x3')]('[%s][dials][varset]',_0x5721e9[_0xeb94('0x5')]),_0x579798);}};exports[_0xeb94('0x18')]=function(_0x41099b){try{if(!_['isNil'](dials[_0x41099b[_0xeb94('0x5')]])){utils[_0xeb94('0x14')](util[_0xeb94('0x3')](_0xeb94('0x19'),_0x41099b[_0xeb94('0x5')]),_0x41099b);dials[_0x41099b[_0xeb94('0x5')]]=_['assign'](dials[_0x41099b['uniqueid']],_0x41099b);dials[_0x41099b['uniqueid']][_0xeb94('0x1a')]=utils[_0xeb94('0x1b')]();dials[_0x41099b['uniqueid']][_0xeb94('0x1c')]='called';utils[_0xeb94('0x2')](util[_0xeb94('0x3')](_0xeb94('0x1d'),_0x41099b[_0xeb94('0x5')],dials[_0x41099b[_0xeb94('0x5')]][_0xeb94('0x1a')]));}}catch(_0x46f546){utils['error'](util[_0xeb94('0x3')]('[%s][dials][dialbegin]',_0x41099b[_0xeb94('0x5')]),_0x46f546);}};exports['dialend']=function(_0x373a8b){try{if(!_['isNil'](dials[_0x373a8b['uniqueid']])){utils[_0xeb94('0x14')](util['format'](_0xeb94('0x1e'),_0x373a8b['uniqueid']),_0x373a8b);dials[_0x373a8b[_0xeb94('0x5')]][_0xeb94('0x9')]=_0x373a8b[_0xeb94('0x9')];if(_0x373a8b[_0xeb94('0x9')]==_0xeb94('0x1f')){dials[_0x373a8b[_0xeb94('0x5')]]=_[_0xeb94('0x20')](dials[_0x373a8b[_0xeb94('0x5')]],_0x373a8b);dials[_0x373a8b[_0xeb94('0x5')]][_0xeb94('0x21')]=utils['now']();dials[_0x373a8b[_0xeb94('0x5')]][_0xeb94('0x1c')]=_0xeb94('0x22');utils[_0xeb94('0x2')](util[_0xeb94('0x3')](_0xeb94('0x23'),_0x373a8b[_0xeb94('0x5')],_0x373a8b[_0xeb94('0x9')],dials[_0x373a8b['uniqueid']][_0xeb94('0x21')]));}else{utils[_0xeb94('0x2')](util[_0xeb94('0x3')](_0xeb94('0x24'),_0x373a8b[_0xeb94('0x5')],_0x373a8b[_0xeb94('0x9')]));}}}catch(_0x1a4318){utils[_0xeb94('0x11')](util[_0xeb94('0x3')](_0xeb94('0x1e'),_0x373a8b[_0xeb94('0x5')]),_0x1a4318);}};exports[_0xeb94('0x25')]=function(_0x2c8cbc){try{if(!_[_0xeb94('0x26')](dials[_0x2c8cbc[_0xeb94('0x5')]])){utils[_0xeb94('0x14')](util[_0xeb94('0x3')](_0xeb94('0x27'),_0x2c8cbc[_0xeb94('0x5')]),_0x2c8cbc);utils[_0xeb94('0x2')](util[_0xeb94('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2c8cbc[_0xeb94('0x5')],_0x2c8cbc[_0xeb94('0x28')],_0x2c8cbc[_0xeb94('0x29')],_0x2c8cbc[_0xeb94('0x2a')]));dials[_0x2c8cbc[_0xeb94('0x5')]]=_[_0xeb94('0x20')](dials[_0x2c8cbc[_0xeb94('0x5')]],{'endtime':utils['now'](),'lastevent':_0xeb94('0x2b')});dials[_0x2c8cbc[_0xeb94('0x5')]][_0xeb94('0x2c')]=utils['diffTime'](dials[_0x2c8cbc[_0xeb94('0x5')]][_0xeb94('0x2d')],dials[_0x2c8cbc['uniqueid']][_0xeb94('0x1a')]);dials[_0x2c8cbc[_0xeb94('0x5')]][_0xeb94('0x2e')]=utils[_0xeb94('0x2f')](dials[_0x2c8cbc[_0xeb94('0x5')]][_0xeb94('0x21')]||dials[_0x2c8cbc[_0xeb94('0x5')]]['endtime'],dials[_0x2c8cbc['uniqueid']][_0xeb94('0x1a')]);dials[_0x2c8cbc['uniqueid']][_0xeb94('0x30')]=dials[_0x2c8cbc[_0xeb94('0x5')]][_0xeb94('0x21')]?utils['diffTime'](dials[_0x2c8cbc[_0xeb94('0x5')]][_0xeb94('0x2d')],dials[_0x2c8cbc[_0xeb94('0x5')]][_0xeb94('0x21')]):0x0;writeDB(dials[_0x2c8cbc[_0xeb94('0x5')]]);}}catch(_0x1ab865){utils[_0xeb94('0x11')](util['format'](_0xeb94('0x27'),_0x2c8cbc[_0xeb94('0x5')]),_0x1ab865);}}; \ No newline at end of file +var _0x2e9c=['dialstring','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','[%s][dials][dialend]','answertime','connect','[%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','calleridnum','cause-txt','duration','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel'];(function(_0x445d19,_0x3481d5){var _0x1953b7=function(_0x50d335){while(--_0x50d335){_0x445d19['push'](_0x445d19['shift']());}};_0x1953b7(++_0x3481d5);}(_0x2e9c,0x130));var _0xc2e9=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x2e9c[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xc2e9('0x0'));var util=require(_0xc2e9('0x1'));var utils=require(_0xc2e9('0x2'));var dials={};function writeDB(_0x167007){utils[_0xc2e9('0x3')](util[_0xc2e9('0x4')](_0xc2e9('0x5'),_0x167007[_0xc2e9('0x6')],_0x167007[_0xc2e9('0x7')],_0x167007[_0xc2e9('0x8')],_0x167007['calleridnum'],_0x167007[_0xc2e9('0x9')],_0x167007[_0xc2e9('0xa')]));utils[_0xc2e9('0xb')]('CreateVoiceDialReport',_0x167007);delete dials[_0x167007[_0xc2e9('0x6')]];}exports[_0xc2e9('0xc')]=function(_0x59221e){try{utils[_0xc2e9('0xd')](util['format'](_0xc2e9('0xe'),_0x59221e[_0xc2e9('0x6')]),_0x59221e);utils[_0xc2e9('0x3')](util[_0xc2e9('0x4')](_0xc2e9('0xf'),_0x59221e[_0xc2e9('0x6')],_0x59221e[_0xc2e9('0x10')],_0x59221e[_0xc2e9('0x11')]));if(_0x59221e[_0xc2e9('0x10')][_0xc2e9('0x12')]()=='set'&&_[_0xc2e9('0x13')](_0x59221e['appdata'][_0xc2e9('0x12')](),_0xc2e9('0x14'))){var _0x365368=_0x59221e[_0xc2e9('0x11')][_0xc2e9('0x15')]('=');dials[_0x59221e[_0xc2e9('0x6')]]={'routeId':_0x365368[0x1]};}}catch(_0x3e5cb3){utils['error'](util[_0xc2e9('0x4')](_0xc2e9('0xe'),_0x59221e[_0xc2e9('0x6')]),_0x3e5cb3);}};exports[_0xc2e9('0x16')]=function(_0x1c39eb){try{utils[_0xc2e9('0xd')](util[_0xc2e9('0x4')](_0xc2e9('0x17'),_0x1c39eb[_0xc2e9('0x6')]),_0x1c39eb);if(!_[_0xc2e9('0x18')](_0x1c39eb[_0xc2e9('0x19')][_0xc2e9('0x1a')])){utils['info'](util[_0xc2e9('0x4')](_0xc2e9('0x1b'),_0x1c39eb[_0xc2e9('0x6')],_0x1c39eb[_0xc2e9('0x1c')]));dials[_0x1c39eb[_0xc2e9('0x6')]]={'routeId':_0x1c39eb[_0xc2e9('0x1c')]};}}catch(_0x2deb6a){utils[_0xc2e9('0x1d')](util[_0xc2e9('0x4')](_0xc2e9('0x17'),_0x1c39eb[_0xc2e9('0x6')]),_0x2deb6a);}};exports[_0xc2e9('0x1e')]=function(_0x13583e){try{if(!_[_0xc2e9('0x18')](dials[_0x13583e[_0xc2e9('0x6')]])){utils[_0xc2e9('0xd')](util[_0xc2e9('0x4')]('[%s][dials][dialbegin]',_0x13583e[_0xc2e9('0x6')]),_0x13583e);dials[_0x13583e['uniqueid']]=_[_0xc2e9('0x1f')](dials[_0x13583e['uniqueid']],_0x13583e);dials[_0x13583e[_0xc2e9('0x6')]][_0xc2e9('0x20')]=utils[_0xc2e9('0x21')]();dials[_0x13583e[_0xc2e9('0x6')]][_0xc2e9('0x22')]=_0xc2e9('0x23');utils[_0xc2e9('0x3')](util[_0xc2e9('0x4')](_0xc2e9('0x24'),_0x13583e[_0xc2e9('0x6')],dials[_0x13583e[_0xc2e9('0x6')]][_0xc2e9('0x20')]));}}catch(_0x15b92f){utils[_0xc2e9('0x1d')](util['format'](_0xc2e9('0x25'),_0x13583e[_0xc2e9('0x6')]),_0x15b92f);}};exports['dialend']=function(_0x25a883){try{if(!_[_0xc2e9('0x18')](dials[_0x25a883[_0xc2e9('0x6')]])){utils[_0xc2e9('0xd')](util[_0xc2e9('0x4')](_0xc2e9('0x26'),_0x25a883[_0xc2e9('0x6')]),_0x25a883);dials[_0x25a883[_0xc2e9('0x6')]][_0xc2e9('0xa')]=_0x25a883[_0xc2e9('0xa')];if(_0x25a883['dialstatus']=='ANSWER'){dials[_0x25a883[_0xc2e9('0x6')]]=_[_0xc2e9('0x1f')](dials[_0x25a883['uniqueid']],_0x25a883);dials[_0x25a883['uniqueid']][_0xc2e9('0x27')]=utils[_0xc2e9('0x21')]();dials[_0x25a883[_0xc2e9('0x6')]][_0xc2e9('0x22')]=_0xc2e9('0x28');utils[_0xc2e9('0x3')](util[_0xc2e9('0x4')](_0xc2e9('0x29'),_0x25a883[_0xc2e9('0x6')],_0x25a883[_0xc2e9('0xa')],dials[_0x25a883[_0xc2e9('0x6')]][_0xc2e9('0x27')]));}else{utils[_0xc2e9('0x3')](util['format'](_0xc2e9('0x2a'),_0x25a883[_0xc2e9('0x6')],_0x25a883[_0xc2e9('0xa')]));}}}catch(_0x564076){utils[_0xc2e9('0x1d')](util['format'](_0xc2e9('0x26'),_0x25a883[_0xc2e9('0x6')]),_0x564076);}};exports[_0xc2e9('0x2b')]=function(_0x1e6deb){try{if(!_[_0xc2e9('0x18')](dials[_0x1e6deb['uniqueid']])){utils[_0xc2e9('0xd')](util[_0xc2e9('0x4')](_0xc2e9('0x2c'),_0x1e6deb[_0xc2e9('0x6')]),_0x1e6deb);utils['info'](util[_0xc2e9('0x4')](_0xc2e9('0x2d'),_0x1e6deb[_0xc2e9('0x6')],_0x1e6deb[_0xc2e9('0x2e')],_0x1e6deb['calleridname'],_0x1e6deb[_0xc2e9('0x2f')]));dials[_0x1e6deb[_0xc2e9('0x6')]]=_[_0xc2e9('0x1f')](dials[_0x1e6deb['uniqueid']],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x1e6deb[_0xc2e9('0x6')]][_0xc2e9('0x30')]=utils['diffTime'](dials[_0x1e6deb[_0xc2e9('0x6')]][_0xc2e9('0x31')],dials[_0x1e6deb[_0xc2e9('0x6')]]['starttime']);dials[_0x1e6deb[_0xc2e9('0x6')]][_0xc2e9('0x32')]=utils['diffTime'](dials[_0x1e6deb['uniqueid']][_0xc2e9('0x27')]||dials[_0x1e6deb['uniqueid']]['endtime'],dials[_0x1e6deb['uniqueid']][_0xc2e9('0x20')]);dials[_0x1e6deb['uniqueid']][_0xc2e9('0x33')]=dials[_0x1e6deb[_0xc2e9('0x6')]][_0xc2e9('0x27')]?utils['diffTime'](dials[_0x1e6deb[_0xc2e9('0x6')]][_0xc2e9('0x31')],dials[_0x1e6deb[_0xc2e9('0x6')]]['answertime']):0x0;writeDB(dials[_0x1e6deb[_0xc2e9('0x6')]]);}}catch(_0x974ed8){utils[_0xc2e9('0x1d')](util[_0xc2e9('0x4')](_0xc2e9('0x2c'),_0x1e6deb[_0xc2e9('0x6')]),_0x974ed8);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 5e7d739..e01325e 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 _0x04e7=['username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','uniqueid','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk'];(function(_0x3858db,_0x868e2b){var _0x4103d7=function(_0x3eeb01){while(--_0x3eeb01){_0x3858db['push'](_0x3858db['shift']());}};_0x4103d7(++_0x868e2b);}(_0x04e7,0x121));var _0x704e=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x04e7[_0x2074db];return _0x27324c;};var AsteriskManager=require(_0x704e('0x0'));var config=require(_0x704e('0x1'));var utils=require(_0x704e('0x2'));var util=require(_0x704e('0x3'));var isXDREnabled=config[_0x704e('0x4')]&&!config[_0x704e('0x4')][_0x704e('0x5')];var isProduction=config[_0x704e('0x6')]===_0x704e('0x7')||![];var isLocalAsterisk=config[_0x704e('0x4')]&&config[_0x704e('0x4')][_0x704e('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x704e('0x9')],config[_0x704e('0xa')]['ip'],config[_0x704e('0xa')][_0x704e('0xb')],config[_0x704e('0xa')][_0x704e('0xc')],!![]);ami[_0x704e('0xd')]();if(!isXDREnabled){utils[_0x704e('0xe')](_0x704e('0xf'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x704e('0xe')](_0x704e('0x10'));}else{var agents=require(_0x704e('0x11'));var calls=require('./calls.controller');var queues=require(_0x704e('0x12'));var recordings=require(_0x704e('0x13'));var members=require(_0x704e('0x14'));var dials=require(_0x704e('0x15'));var transfers=require(_0x704e('0x16'));var core=require(_0x704e('0x17'));ami['on'](_0x704e('0x18'),core['connect']);ami['on']('shutdown',core[_0x704e('0x19')]);ami['on'](_0x704e('0x1a'),core[_0x704e('0x1a')]);ami['on'](_0x704e('0x1b'),core[_0x704e('0x1b')]);ami['on'](_0x704e('0x1c'),core[_0x704e('0x1c')]);ami['on'](_0x704e('0x1d'),core['managerevent']);ami['on'](_0x704e('0x1e'),function(_0x93d58a){try{utils[_0x704e('0x1f')](util['format'](_0x704e('0x20'),_0x93d58a[_0x704e('0x21')]),_0x93d58a);members[_0x704e('0x1e')](_0x93d58a);}catch(_0x5d1e9e){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x20'),_0x93d58a[_0x704e('0x21')]),_0x5d1e9e);}});ami['on'](_0x704e('0x23'),function(_0x554c09){try{utils[_0x704e('0x1f')](util['format'](_0x704e('0x24'),_0x554c09['uniqueid']),_0x554c09);agents['agentcalled'](_0x554c09);}catch(_0x5bd786){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x24'),_0x554c09['uniqueid']),_0x5bd786);}});ami['on']('agentringnoanswer',function(_0x2f56b5){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')](_0x704e('0x25'),_0x2f56b5[_0x704e('0x26')]),_0x2f56b5);agents[_0x704e('0x27')](_0x2f56b5);}catch(_0x30a391){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x25'),_0x2f56b5[_0x704e('0x26')]),_0x30a391);}});ami['on']('agentconnect',function(_0x5cae04){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')](_0x704e('0x28'),_0x5cae04[_0x704e('0x26')]),_0x5cae04);agents[_0x704e('0x29')](_0x5cae04);queues[_0x704e('0x29')](_0x5cae04);}catch(_0xa6a751){utils[_0x704e('0x1b')](util['format'](_0x704e('0x28'),_0x5cae04[_0x704e('0x26')]),_0xa6a751);}});ami['on'](_0x704e('0x2a'),function(_0x50d3ab){try{utils[_0x704e('0x1f')](util['format'](_0x704e('0x2b'),_0x50d3ab[_0x704e('0x26')]),_0x50d3ab);agents[_0x704e('0x2a')](_0x50d3ab);queues[_0x704e('0x2a')](_0x50d3ab);members['agentcomplete'](_0x50d3ab);}catch(_0x56573a){utils[_0x704e('0x1b')](util['format']('[%s][index][agentcomplete]',_0x50d3ab[_0x704e('0x26')]),_0x56573a);}});ami['on'](_0x704e('0x2c'),function(_0x31a04b){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')]('[%s][index][queuecallerabandon]',_0x31a04b['uniqueid']),_0x31a04b);agents[_0x704e('0x2c')](_0x31a04b);queues['queuecallerabandon'](_0x31a04b);}catch(_0x4b3a42){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x2d'),_0x31a04b[_0x704e('0x26')]),_0x4b3a42);}});ami['on'](_0x704e('0x2e'),function(_0xc8260e){try{utils[_0x704e('0x1f')](util['format'](_0x704e('0x2f'),_0xc8260e['uniqueid']),_0xc8260e);queues[_0x704e('0x2e')](_0xc8260e);recordings['queuecallerjoin'](_0xc8260e);}catch(_0x18823d){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x2f'),_0xc8260e[_0x704e('0x26')]),_0x18823d);}});ami['on'](_0x704e('0x30'),function(_0x307275){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')]('[%s][index][queuecallerleave]',_0x307275[_0x704e('0x26')]),_0x307275);queues['queuecallerleave'](_0x307275);}catch(_0x35a677){utils['error'](util['format'](_0x704e('0x31'),_0x307275[_0x704e('0x26')]),_0x35a677);}});ami['on']('musiconholdstart',function(_0x1dee62){try{utils['debug'](util[_0x704e('0x22')](_0x704e('0x32'),_0x1dee62[_0x704e('0x26')]),_0x1dee62);queues['musiconholdstart'](_0x1dee62);calls[_0x704e('0x33')](_0x1dee62);}catch(_0x43cb85){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x32'),_0x1dee62[_0x704e('0x26')]),_0x43cb85);}});ami['on'](_0x704e('0x34'),function(_0x2b68d5){try{utils[_0x704e('0x1f')](util['format']('[%s][index][musiconholdstop]',_0x2b68d5[_0x704e('0x26')]),_0x2b68d5);queues[_0x704e('0x34')](_0x2b68d5);calls[_0x704e('0x34')](_0x2b68d5);}catch(_0x4be584){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x35'),_0x2b68d5[_0x704e('0x26')]),_0x4be584);}});ami['on'](_0x704e('0x36'),function(_0x18b3dc){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')]('[%s][index][newstate]',_0x18b3dc[_0x704e('0x26')]),_0x18b3dc);calls[_0x704e('0x36')](_0x18b3dc);recordings[_0x704e('0x36')](_0x18b3dc);}catch(_0x52f640){utils['error'](util[_0x704e('0x22')](_0x704e('0x37'),_0x18b3dc[_0x704e('0x26')]),_0x52f640);}});ami['on'](_0x704e('0x38'),function(_0x3f3890){try{utils['debug'](util[_0x704e('0x22')]('[%s][index][hangup]',_0x3f3890['uniqueid']),_0x3f3890);calls['hangup'](_0x3f3890);recordings[_0x704e('0x38')](_0x3f3890);dials[_0x704e('0x38')](_0x3f3890);agents['hangup'](_0x3f3890);queues[_0x704e('0x38')](_0x3f3890);}catch(_0xf2bfdb){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x39'),_0x3f3890[_0x704e('0x26')]),_0xf2bfdb);}});ami['on']('cdr',function(_0x41169e){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')](_0x704e('0x3a'),_0x41169e[_0x704e('0x26')]),_0x41169e);members[_0x704e('0x3b')](_0x41169e);}catch(_0x3e1a75){utils[_0x704e('0x1b')](util['format'](_0x704e('0x3a'),_0x41169e[_0x704e('0x26')]),_0x3e1a75);}});ami['on']('blindtransfer',function(_0x19cc97){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')](_0x704e('0x3c'),_0x19cc97[_0x704e('0x26')]),_0x19cc97);queues[_0x704e('0x3d')](_0x19cc97);agents[_0x704e('0x3d')](_0x19cc97);transfers[_0x704e('0x3d')](_0x19cc97);recordings['blindtransfer'](_0x19cc97);}catch(_0x54560d){utils[_0x704e('0x1b')](util[_0x704e('0x22')]('[%s][index][blindtransfer]',_0x19cc97['uniqueid']),_0x54560d);}});ami['on'](_0x704e('0x3e'),function(_0x3c05b9){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')](_0x704e('0x3f'),_0x3c05b9[_0x704e('0x40')]),_0x3c05b9);queues['attendedtransfer'](_0x3c05b9);transfers[_0x704e('0x3e')](_0x3c05b9);agents[_0x704e('0x3e')](_0x3c05b9);calls['attendedtransfer'](_0x3c05b9);}catch(_0x9098f2){utils['error'](util['format'](_0x704e('0x3f'),_0x3c05b9[_0x704e('0x40')]),_0x9098f2);}});ami['on']('varset',function(_0x1ba5ec){try{utils[_0x704e('0x1f')](util['format'](_0x704e('0x41'),_0x1ba5ec[_0x704e('0x26')]),_0x1ba5ec);queues[_0x704e('0x42')](_0x1ba5ec);recordings[_0x704e('0x42')](_0x1ba5ec);calls[_0x704e('0x42')](_0x1ba5ec);dials[_0x704e('0x42')](_0x1ba5ec);}catch(_0x5bd80d){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x41'),_0x1ba5ec[_0x704e('0x26')]),_0x5bd80d);}});ami['on']('newexten',function(_0x26660d){try{utils[_0x704e('0x1f')](util['format'](_0x704e('0x43'),_0x26660d[_0x704e('0x26')]),_0x26660d);calls[_0x704e('0x44')](_0x26660d);recordings[_0x704e('0x44')](_0x26660d);dials['newexten'](_0x26660d);}catch(_0x4b4a5a){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x43'),_0x26660d['uniqueid']),_0x4b4a5a);}});ami['on']('newchannel',function(_0x1f41b5){try{utils['debug'](util[_0x704e('0x22')]('[%s][index][newchannel]',_0x1f41b5[_0x704e('0x26')]),_0x1f41b5);calls['newchannel'](_0x1f41b5);recordings[_0x704e('0x45')](_0x1f41b5);}catch(_0x409706){utils[_0x704e('0x1b')](util['format'](_0x704e('0x46'),_0x1f41b5['uniqueid']),_0x409706);}});ami['on']('dialbegin',function(_0x37f8b7){try{utils['debug'](util[_0x704e('0x22')](_0x704e('0x47'),_0x37f8b7['uniqueid']),_0x37f8b7);dials['dialbegin'](_0x37f8b7);}catch(_0x13b79f){utils[_0x704e('0x1b')](util[_0x704e('0x22')](_0x704e('0x48'),_0x37f8b7[_0x704e('0x26')]),_0x13b79f);}});ami['on'](_0x704e('0x49'),function(_0x3412ea){try{utils[_0x704e('0x1f')](util[_0x704e('0x22')]('[%s][index][dialend]',_0x3412ea[_0x704e('0x26')]),_0x3412ea);dials['dialend'](_0x3412ea);}catch(_0x1f9a5e){utils['error'](util['format'](_0x704e('0x4a'),_0x3412ea['uniqueid']),_0x1f9a5e);}});} \ No newline at end of file +var _0x202d=['XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','production','local','asterisk','port','username','password','info'];(function(_0x263edc,_0xd4ad76){var _0x70041=function(_0xbe33c2){while(--_0xbe33c2){_0x263edc['push'](_0x263edc['shift']());}};_0x70041(++_0xd4ad76);}(_0x202d,0x105));var _0xd202=function(_0x2e151a,_0x61339a){_0x2e151a=_0x2e151a-0x0;var _0x3ac736=_0x202d[_0x2e151a];return _0x3ac736;};var AsteriskManager=require(_0xd202('0x0'));var config=require(_0xd202('0x1'));var utils=require(_0xd202('0x2'));var util=require('util');var isXDREnabled=config['xdr']&&config[_0xd202('0x3')]['disabled']?!config[_0xd202('0x3')]['disabled']:!![];var isProduction=config['env']===_0xd202('0x4')||![];var isLocalAsterisk=config[_0xd202('0x3')]&&config[_0xd202('0x3')][_0xd202('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xd202('0x6')][_0xd202('0x7')],config[_0xd202('0x6')]['ip'],config[_0xd202('0x6')][_0xd202('0x8')],config[_0xd202('0x6')][_0xd202('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xd202('0xa')](_0xd202('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xd202('0xa')](_0xd202('0xc'));}else{var agents=require(_0xd202('0xd'));var calls=require('./calls.controller');var queues=require(_0xd202('0xe'));var recordings=require('./recordings.controller');var members=require(_0xd202('0xf'));var dials=require(_0xd202('0x10'));var transfers=require(_0xd202('0x11'));var core=require(_0xd202('0x12'));ami['on'](_0xd202('0x13'),core['connect']);ami['on']('shutdown',core[_0xd202('0x14')]);ami['on'](_0xd202('0x15'),core['fullybooted']);ami['on'](_0xd202('0x16'),core['error']);ami['on']('close',core['close']);ami['on']('managerevent',core[_0xd202('0x17')]);ami['on'](_0xd202('0x18'),function(_0x28cfd9){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x1b'),_0x28cfd9['device']),_0x28cfd9);members[_0xd202('0x18')](_0x28cfd9);}catch(_0x442ede){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x1b'),_0x28cfd9[_0xd202('0x1c')]),_0x442ede);}});ami['on'](_0xd202('0x1d'),function(_0x312b6b){try{utils['debug'](util[_0xd202('0x1a')]('[%s][index][agentcalled]',_0x312b6b[_0xd202('0x1e')]),_0x312b6b);agents['agentcalled'](_0x312b6b);}catch(_0x577ef0){utils['error'](util[_0xd202('0x1a')](_0xd202('0x1f'),_0x312b6b['uniqueid']),_0x577ef0);}});ami['on'](_0xd202('0x20'),function(_0x44972a){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x21'),_0x44972a['uniqueid']),_0x44972a);agents[_0xd202('0x20')](_0x44972a);}catch(_0x38f822){utils[_0xd202('0x16')](util['format'](_0xd202('0x21'),_0x44972a['uniqueid']),_0x38f822);}});ami['on'](_0xd202('0x22'),function(_0x213b42){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x23'),_0x213b42[_0xd202('0x1e')]),_0x213b42);agents[_0xd202('0x22')](_0x213b42);queues['agentconnect'](_0x213b42);}catch(_0x52a12c){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x23'),_0x213b42[_0xd202('0x1e')]),_0x52a12c);}});ami['on'](_0xd202('0x24'),function(_0x34603e){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x25'),_0x34603e[_0xd202('0x1e')]),_0x34603e);agents['agentcomplete'](_0x34603e);queues['agentcomplete'](_0x34603e);members[_0xd202('0x24')](_0x34603e);}catch(_0x356b81){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x25'),_0x34603e[_0xd202('0x1e')]),_0x356b81);}});ami['on']('queuecallerabandon',function(_0x18a83a){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x26'),_0x18a83a['uniqueid']),_0x18a83a);agents['queuecallerabandon'](_0x18a83a);queues[_0xd202('0x27')](_0x18a83a);}catch(_0x3d5b36){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x26'),_0x18a83a[_0xd202('0x1e')]),_0x3d5b36);}});ami['on'](_0xd202('0x28'),function(_0x3e5e75){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x29'),_0x3e5e75[_0xd202('0x1e')]),_0x3e5e75);queues[_0xd202('0x28')](_0x3e5e75);recordings[_0xd202('0x28')](_0x3e5e75);}catch(_0x128f7f){utils['error'](util['format'](_0xd202('0x29'),_0x3e5e75['uniqueid']),_0x128f7f);}});ami['on'](_0xd202('0x2a'),function(_0x116773){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')]('[%s][index][queuecallerleave]',_0x116773['uniqueid']),_0x116773);queues[_0xd202('0x2a')](_0x116773);}catch(_0x30aa5a){utils[_0xd202('0x16')](util[_0xd202('0x1a')]('[%s][index][queuecallerleave]',_0x116773[_0xd202('0x1e')]),_0x30aa5a);}});ami['on'](_0xd202('0x2b'),function(_0x464b5f){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x2c'),_0x464b5f[_0xd202('0x1e')]),_0x464b5f);queues[_0xd202('0x2b')](_0x464b5f);calls[_0xd202('0x2b')](_0x464b5f);}catch(_0x2b6ccd){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x2c'),_0x464b5f[_0xd202('0x1e')]),_0x2b6ccd);}});ami['on'](_0xd202('0x2d'),function(_0x2c1f55){try{utils['debug'](util[_0xd202('0x1a')](_0xd202('0x2e'),_0x2c1f55[_0xd202('0x1e')]),_0x2c1f55);queues[_0xd202('0x2d')](_0x2c1f55);calls[_0xd202('0x2d')](_0x2c1f55);}catch(_0x356309){utils[_0xd202('0x16')](util[_0xd202('0x1a')]('[%s][index][musiconholdstop]',_0x2c1f55['uniqueid']),_0x356309);}});ami['on'](_0xd202('0x2f'),function(_0x4dba72){try{utils['debug'](util['format'](_0xd202('0x30'),_0x4dba72[_0xd202('0x1e')]),_0x4dba72);calls['newstate'](_0x4dba72);recordings['newstate'](_0x4dba72);}catch(_0x51ffe4){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x30'),_0x4dba72[_0xd202('0x1e')]),_0x51ffe4);}});ami['on'](_0xd202('0x31'),function(_0x1417d6){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x32'),_0x1417d6[_0xd202('0x1e')]),_0x1417d6);calls[_0xd202('0x31')](_0x1417d6);recordings[_0xd202('0x31')](_0x1417d6);dials[_0xd202('0x31')](_0x1417d6);agents['hangup'](_0x1417d6);queues['hangup'](_0x1417d6);}catch(_0x17f555){utils[_0xd202('0x16')](util['format'](_0xd202('0x32'),_0x1417d6[_0xd202('0x1e')]),_0x17f555);}});ami['on']('cdr',function(_0x167cec){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x33'),_0x167cec[_0xd202('0x1e')]),_0x167cec);members[_0xd202('0x34')](_0x167cec);}catch(_0x4ffeba){utils[_0xd202('0x16')](util['format'](_0xd202('0x33'),_0x167cec[_0xd202('0x1e')]),_0x4ffeba);}});ami['on'](_0xd202('0x35'),function(_0x1877c5){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x36'),_0x1877c5['uniqueid']),_0x1877c5);queues[_0xd202('0x35')](_0x1877c5);agents[_0xd202('0x35')](_0x1877c5);transfers[_0xd202('0x35')](_0x1877c5);recordings[_0xd202('0x35')](_0x1877c5);}catch(_0x48aeb8){utils[_0xd202('0x16')](util['format'](_0xd202('0x36'),_0x1877c5[_0xd202('0x1e')]),_0x48aeb8);}});ami['on']('attendedtransfer',function(_0xc20a24){try{utils[_0xd202('0x19')](util['format'](_0xd202('0x37'),_0xc20a24[_0xd202('0x38')]),_0xc20a24);queues[_0xd202('0x39')](_0xc20a24);transfers['attendedtransfer'](_0xc20a24);agents[_0xd202('0x39')](_0xc20a24);calls[_0xd202('0x39')](_0xc20a24);}catch(_0xc35302){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x37'),_0xc20a24[_0xd202('0x38')]),_0xc35302);}});ami['on'](_0xd202('0x3a'),function(_0xd8746e){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x3b'),_0xd8746e[_0xd202('0x1e')]),_0xd8746e);queues['varset'](_0xd8746e);recordings['varset'](_0xd8746e);calls[_0xd202('0x3a')](_0xd8746e);dials['varset'](_0xd8746e);}catch(_0x39be76){utils[_0xd202('0x16')](util['format'](_0xd202('0x3b'),_0xd8746e[_0xd202('0x1e')]),_0x39be76);}});ami['on'](_0xd202('0x3c'),function(_0x2a9d8c){try{utils[_0xd202('0x19')](util['format'](_0xd202('0x3d'),_0x2a9d8c[_0xd202('0x1e')]),_0x2a9d8c);calls['newexten'](_0x2a9d8c);recordings[_0xd202('0x3c')](_0x2a9d8c);dials[_0xd202('0x3c')](_0x2a9d8c);}catch(_0xe95b94){utils['error'](util[_0xd202('0x1a')](_0xd202('0x3d'),_0x2a9d8c[_0xd202('0x1e')]),_0xe95b94);}});ami['on']('newchannel',function(_0x5c6b83){try{utils[_0xd202('0x19')](util['format'](_0xd202('0x3e'),_0x5c6b83['uniqueid']),_0x5c6b83);calls[_0xd202('0x3f')](_0x5c6b83);recordings['newchannel'](_0x5c6b83);}catch(_0x1e8ffd){utils[_0xd202('0x16')](util['format'](_0xd202('0x3e'),_0x5c6b83['uniqueid']),_0x1e8ffd);}});ami['on']('dialbegin',function(_0x1d0d28){try{utils[_0xd202('0x19')](util['format'](_0xd202('0x40'),_0x1d0d28['uniqueid']),_0x1d0d28);dials[_0xd202('0x41')](_0x1d0d28);}catch(_0x3d0cbc){utils[_0xd202('0x16')](util['format'](_0xd202('0x42'),_0x1d0d28[_0xd202('0x1e')]),_0x3d0cbc);}});ami['on']('dialend',function(_0x4212e5){try{utils[_0xd202('0x19')](util[_0xd202('0x1a')](_0xd202('0x43'),_0x4212e5[_0xd202('0x1e')]),_0x4212e5);dials['dialend'](_0x4212e5);}catch(_0x3a0549){utils[_0xd202('0x16')](util[_0xd202('0x1a')](_0xd202('0x43'),_0x4212e5[_0xd202('0x1e')]),_0x3a0549);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index bd6cc1a..36525ac 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 _0xc734=['debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','split','data1','type','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','catch','error','some','startsWith'];(function(_0x37de50,_0x27f82a){var _0x2c37dc=function(_0x325186){while(--_0x325186){_0x37de50['push'](_0x37de50['shift']());}};_0x2c37dc(++_0x27f82a);}(_0xc734,0x1ca));var _0x4c73=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0xc734[_0x5a27e8];return _0x4e38f7;};'use strict';var _=require('lodash');var util=require(_0x4c73('0x0'));var utils=require('./utils');var members={};var exclude=[_0x4c73('0x1'),_0x4c73('0x2')];function writeDB(_0x191b8c){utils[_0x4c73('0x3')](util[_0x4c73('0x4')](_0x4c73('0x5'),_0x191b8c[_0x4c73('0x6')],_0x191b8c[_0x4c73('0x7')],_0x191b8c['channel'],_0x191b8c['data2'],_0x191b8c[_0x4c73('0x8')],_0x191b8c['type']));if(_0x191b8c[_0x4c73('0x7')]){utils[_0x4c73('0x9')](_0x191b8c[_0x4c73('0x7')])[_0x4c73('0xa')](function(_0x6baed2){if(_0x6baed2){_0x191b8c['membername']=_0x6baed2[_0x4c73('0xb')];_0x191b8c[_0x4c73('0xc')]=_0x6baed2['internal'];utils[_0x4c73('0xd')]('CreateMemberReport',_0x191b8c);}else{utils['getUserByName'](_0x191b8c[_0x4c73('0x7')]['split']('/')[0x1])[_0x4c73('0xa')](function(_0x63d6fc){if(_0x63d6fc){_0x191b8c[_0x4c73('0x8')]=_0x63d6fc[_0x4c73('0xb')];_0x191b8c[_0x4c73('0xc')]=_0x63d6fc[_0x4c73('0xc')];utils[_0x4c73('0xd')](_0x4c73('0xe'),_0x191b8c);}});}})[_0x4c73('0xf')](function(_0x24623d){utils[_0x4c73('0x10')](util[_0x4c73('0x4')]('[%s][members][writeDB]',_0x191b8c['uniqueid']),_0x24623d);});}delete members[_0x191b8c[_0x4c73('0x7')]];}function startsWith(_0x4f466b,_0x39e3e1){return _[_0x4c73('0x11')](_0x4f466b,function(_0x3a7e2c){return _[_0x4c73('0x12')](_0x39e3e1,_0x3a7e2c);});}exports['devicestatechange']=function(_0x16b876){try{utils[_0x4c73('0x13')](util[_0x4c73('0x4')](_0x4c73('0x14'),members[_0x16b876['device']]?members[_0x16b876[_0x4c73('0x15')]][_0x4c73('0x6')]:_0x16b876['device']),_0x16b876);utils['info'](util['format'](_0x4c73('0x16'),members[_0x16b876['device']]?members[_0x16b876[_0x4c73('0x15')]][_0x4c73('0x6')]:_0x16b876[_0x4c73('0x15')],_0x16b876[_0x4c73('0x17')],_0x16b876['device']));switch(_0x16b876[_0x4c73('0x17')]){case _0x4c73('0x18'):case _0x4c73('0x19'):if(!startsWith(exclude,_0x16b876[_0x4c73('0x15')])){members[_0x16b876['device']]={'channel':_0x4c73('0x1a'),'interface':_0x16b876['device'],'type':_0x4c73('0x1b'),'enterAt':utils[_0x4c73('0x1c')](),'role':_0x4c73('0x1d')};}break;case _0x4c73('0x1e'):if(!_[_0x4c73('0x1f')](members[_0x16b876[_0x4c73('0x15')]])){members[_0x16b876[_0x4c73('0x15')]][_0x4c73('0x20')]=utils[_0x4c73('0x1c')]();members[_0x16b876[_0x4c73('0x15')]][_0x4c73('0x21')]=utils[_0x4c73('0x22')](members[_0x16b876[_0x4c73('0x15')]][_0x4c73('0x20')],members[_0x16b876[_0x4c73('0x15')]][_0x4c73('0x23')]);if(members[_0x16b876['device']][_0x4c73('0x6')]){writeDB(members[_0x16b876[_0x4c73('0x15')]]);}}break;default:break;}}catch(_0x438df6){utils[_0x4c73('0x10')](util[_0x4c73('0x4')](_0x4c73('0x14'),members[_0x16b876[_0x4c73('0x15')]]?members[_0x16b876['device']]['uniqueid']:_0x16b876[_0x4c73('0x15')]),_0x438df6);}};exports[_0x4c73('0x24')]=function(_0x2bf0e1){try{if(!_[_0x4c73('0x1f')](members[_0x2bf0e1[_0x4c73('0x7')]])){utils[_0x4c73('0x13')](util[_0x4c73('0x4')](_0x4c73('0x25'),_0x2bf0e1[_0x4c73('0x6')]),_0x2bf0e1);utils[_0x4c73('0x3')](util['format'](_0x4c73('0x26'),_0x2bf0e1[_0x4c73('0x6')],_0x2bf0e1['interface'],_0x2bf0e1[_0x4c73('0x27')]));members[_0x2bf0e1['interface']]=_[_0x4c73('0x28')](members[_0x2bf0e1['interface']],{'data4':_0x2bf0e1[_0x4c73('0x27')],'uniqueid':_0x2bf0e1[_0x4c73('0x6')]});}}catch(_0x2c11f1){utils['error'](util['format'](_0x4c73('0x25'),_0x2bf0e1[_0x4c73('0x6')]),_0x2c11f1);}};exports[_0x4c73('0x29')]=function(_0x1add9e){try{utils[_0x4c73('0x13')](util['format'](_0x4c73('0x2a'),_0x1add9e['uniqueid']),_0x1add9e);if(_0x1add9e[_0x4c73('0x2b')]){var _0x4c6c61=_0x1add9e[_0x4c73('0x2b')][_0x4c73('0x2c')]('-')[0x0];if(!_[_0x4c73('0x1f')](members[_0x4c6c61])){members[_0x4c6c61]=_[_0x4c73('0x28')](members[_0x4c6c61],{'data1':members[_0x4c6c61][_0x4c73('0x2d')]||_0x1add9e[_0x4c73('0x2e')],'data2':members[_0x4c6c61][_0x4c73('0x2f')]||_0x1add9e[_0x4c73('0x30')],'data3':members[_0x4c6c61][_0x4c73('0x31')]||_0x1add9e['destination'],'uniqueid':members[_0x4c6c61][_0x4c73('0x6')]||_0x1add9e[_0x4c73('0x6')]});utils[_0x4c73('0x3')](util[_0x4c73('0x4')](_0x4c73('0x32'),_0x1add9e['uniqueid'],members[_0x4c6c61][_0x4c73('0x2d')],members[_0x4c6c61][_0x4c73('0x2f')],members[_0x4c6c61][_0x4c73('0x31')]));if(members[_0x4c6c61][_0x4c73('0x20')]){writeDB(members[_0x4c6c61]);}}}if(_0x1add9e[_0x4c73('0x33')]){var _0x121425=_0x1add9e['destinationchannel'][_0x4c73('0x2c')]('-')[0x0];if(!_['isNil'](members[_0x121425])){members[_0x121425]=_[_0x4c73('0x28')](members[_0x121425],{'data1':members[_0x121425][_0x4c73('0x2d')]||_0x1add9e[_0x4c73('0x2e')],'data2':members[_0x121425][_0x4c73('0x2f')]||_0x1add9e['source'],'data3':members[_0x121425][_0x4c73('0x31')]||_0x1add9e[_0x4c73('0x34')],'uniqueid':members[_0x121425][_0x4c73('0x6')]||_0x1add9e[_0x4c73('0x6')]});utils[_0x4c73('0x3')](util['format'](_0x4c73('0x32'),_0x1add9e[_0x4c73('0x6')],members[_0x121425][_0x4c73('0x2d')],members[_0x121425][_0x4c73('0x2f')],members[_0x121425][_0x4c73('0x31')]));if(members[_0x121425][_0x4c73('0x20')]){writeDB(members[_0x121425]);}}}}catch(_0x2b4992){utils[_0x4c73('0x10')](util[_0x4c73('0x4')](_0x4c73('0x2a'),_0x1add9e[_0x4c73('0x6')]),_0x2b4992);}}; \ No newline at end of file +var _0x79d3=['data1','data3','destination','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','then','internal','CreateMemberReport','getUserByName','split','catch','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','[%s][members][cdr]'];(function(_0x592aa3,_0x264935){var _0x4e7bfd=function(_0x481373){while(--_0x481373){_0x592aa3['push'](_0x592aa3['shift']());}};_0x4e7bfd(++_0x264935);}(_0x79d3,0x179));var _0x379d=function(_0x52d7df,_0x5d5742){_0x52d7df=_0x52d7df-0x0;var _0x6163fc=_0x79d3[_0x52d7df];return _0x6163fc;};'use strict';var _=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var utils=require(_0x379d('0x2'));var members={};var exclude=[_0x379d('0x3'),_0x379d('0x4')];function writeDB(_0x144c36){utils['info'](util[_0x379d('0x5')](_0x379d('0x6'),_0x144c36['uniqueid'],_0x144c36['interface'],_0x144c36[_0x379d('0x7')],_0x144c36[_0x379d('0x8')],_0x144c36[_0x379d('0x9')],_0x144c36[_0x379d('0xa')]));if(_0x144c36[_0x379d('0xb')]){utils['getUserByInterface'](_0x144c36[_0x379d('0xb')])[_0x379d('0xc')](function(_0x22c7d8){if(_0x22c7d8){_0x144c36['membername']=_0x22c7d8['name'];_0x144c36[_0x379d('0xd')]=_0x22c7d8[_0x379d('0xd')];utils['request'](_0x379d('0xe'),_0x144c36);}else{utils[_0x379d('0xf')](_0x144c36[_0x379d('0xb')][_0x379d('0x10')]('/')[0x1])['then'](function(_0x410adb){if(_0x410adb){_0x144c36[_0x379d('0x9')]=_0x410adb['name'];_0x144c36[_0x379d('0xd')]=_0x410adb[_0x379d('0xd')];utils['request']('CreateMemberReport',_0x144c36);}});}})[_0x379d('0x11')](function(_0x54a43b){utils['error'](util[_0x379d('0x5')]('[%s][members][writeDB]',_0x144c36[_0x379d('0x12')]),_0x54a43b);});}delete members[_0x144c36['interface']];}function startsWith(_0x2957c8,_0x4150a1){return _[_0x379d('0x13')](_0x2957c8,function(_0x3e7fee){return _[_0x379d('0x14')](_0x4150a1,_0x3e7fee);});}exports[_0x379d('0x15')]=function(_0x18f0fb){try{utils[_0x379d('0x16')](util[_0x379d('0x5')](_0x379d('0x17'),members[_0x18f0fb['device']]?members[_0x18f0fb['device']][_0x379d('0x12')]:_0x18f0fb[_0x379d('0x18')]),_0x18f0fb);utils[_0x379d('0x19')](util[_0x379d('0x5')](_0x379d('0x1a'),members[_0x18f0fb[_0x379d('0x18')]]?members[_0x18f0fb['device']][_0x379d('0x12')]:_0x18f0fb[_0x379d('0x18')],_0x18f0fb[_0x379d('0x1b')],_0x18f0fb[_0x379d('0x18')]));switch(_0x18f0fb[_0x379d('0x1b')]){case _0x379d('0x1c'):case _0x379d('0x1d'):if(!startsWith(exclude,_0x18f0fb[_0x379d('0x18')])){members[_0x18f0fb[_0x379d('0x18')]]={'channel':_0x379d('0x1e'),'interface':_0x18f0fb[_0x379d('0x18')],'type':_0x379d('0x1f'),'enterAt':utils[_0x379d('0x20')](),'role':_0x379d('0x21')};}break;case _0x379d('0x22'):if(!_[_0x379d('0x23')](members[_0x18f0fb[_0x379d('0x18')]])){members[_0x18f0fb[_0x379d('0x18')]][_0x379d('0x24')]=utils['now']();members[_0x18f0fb[_0x379d('0x18')]]['duration']=utils[_0x379d('0x25')](members[_0x18f0fb[_0x379d('0x18')]][_0x379d('0x24')],members[_0x18f0fb[_0x379d('0x18')]][_0x379d('0x26')]);if(members[_0x18f0fb[_0x379d('0x18')]][_0x379d('0x12')]){writeDB(members[_0x18f0fb[_0x379d('0x18')]]);}}break;default:break;}}catch(_0x215c85){utils['error'](util['format'](_0x379d('0x17'),members[_0x18f0fb[_0x379d('0x18')]]?members[_0x18f0fb[_0x379d('0x18')]][_0x379d('0x12')]:_0x18f0fb[_0x379d('0x18')]),_0x215c85);}};exports[_0x379d('0x27')]=function(_0x3d527d){try{if(!_[_0x379d('0x23')](members[_0x3d527d['interface']])){utils[_0x379d('0x16')](util['format'](_0x379d('0x28'),_0x3d527d[_0x379d('0x12')]),_0x3d527d);utils[_0x379d('0x19')](util[_0x379d('0x5')](_0x379d('0x29'),_0x3d527d[_0x379d('0x12')],_0x3d527d['interface'],_0x3d527d[_0x379d('0x2a')]));members[_0x3d527d[_0x379d('0xb')]]=_[_0x379d('0x2b')](members[_0x3d527d[_0x379d('0xb')]],{'data4':_0x3d527d[_0x379d('0x2a')],'uniqueid':_0x3d527d['uniqueid']});}}catch(_0x12e1c4){utils[_0x379d('0x2c')](util[_0x379d('0x5')]('[%s][members][agentcomplete]',_0x3d527d[_0x379d('0x12')]),_0x12e1c4);}};exports[_0x379d('0x2d')]=function(_0x5ef81c){try{utils['debug'](util[_0x379d('0x5')](_0x379d('0x2e'),_0x5ef81c[_0x379d('0x12')]),_0x5ef81c);if(_0x5ef81c[_0x379d('0x7')]){var _0xd6bb2d=_0x5ef81c['channel'][_0x379d('0x10')]('-')[0x0];if(!_['isNil'](members[_0xd6bb2d])){members[_0xd6bb2d]=_[_0x379d('0x2b')](members[_0xd6bb2d],{'data1':members[_0xd6bb2d][_0x379d('0x2f')]||_0x5ef81c[_0x379d('0xa')],'data2':members[_0xd6bb2d]['data2']||_0x5ef81c['source'],'data3':members[_0xd6bb2d][_0x379d('0x30')]||_0x5ef81c[_0x379d('0x31')],'uniqueid':members[_0xd6bb2d]['uniqueid']||_0x5ef81c[_0x379d('0x12')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x5ef81c[_0x379d('0x12')],members[_0xd6bb2d][_0x379d('0x2f')],members[_0xd6bb2d][_0x379d('0x8')],members[_0xd6bb2d][_0x379d('0x30')]));if(members[_0xd6bb2d][_0x379d('0x24')]){writeDB(members[_0xd6bb2d]);}}}if(_0x5ef81c[_0x379d('0x32')]){var _0x18a4e1=_0x5ef81c[_0x379d('0x32')]['split']('-')[0x0];if(!_[_0x379d('0x23')](members[_0x18a4e1])){members[_0x18a4e1]=_[_0x379d('0x2b')](members[_0x18a4e1],{'data1':members[_0x18a4e1]['data1']||_0x5ef81c[_0x379d('0xa')],'data2':members[_0x18a4e1][_0x379d('0x8')]||_0x5ef81c[_0x379d('0x33')],'data3':members[_0x18a4e1]['data3']||_0x5ef81c[_0x379d('0x31')],'uniqueid':members[_0x18a4e1][_0x379d('0x12')]||_0x5ef81c[_0x379d('0x12')]});utils[_0x379d('0x19')](util[_0x379d('0x5')](_0x379d('0x34'),_0x5ef81c[_0x379d('0x12')],members[_0x18a4e1]['data1'],members[_0x18a4e1][_0x379d('0x8')],members[_0x18a4e1][_0x379d('0x30')]));if(members[_0x18a4e1]['exitAt']){writeDB(members[_0x18a4e1]);}}}}catch(_0xe7b071){utils['error'](util[_0x379d('0x5')](_0x379d('0x2e'),_0x5ef81c[_0x379d('0x12')]),_0xe7b071);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2f6a409..b00e238 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 _0xfd02=['ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transferuniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','util','./utils','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','assign','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','variable','queuestatus','toUpperCase','queuecallerabandonAt','value','[%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','error','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten'];(function(_0x4145f6,_0xe5d514){var _0x38cbcf=function(_0x17866b){while(--_0x17866b){_0x4145f6['push'](_0x4145f6['shift']());}};_0x38cbcf(++_0xe5d514);}(_0xfd02,0xe0));var _0x2fd0=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xfd02[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require('lodash');var util=require(_0x2fd0('0x0'));var utils=require(_0x2fd0('0x1'));var queues={};function writeDB(_0x355094){utils['info'](util[_0x2fd0('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x355094[_0x2fd0('0x3')],_0x355094[_0x2fd0('0x4')],_0x355094[_0x2fd0('0x5')],_0x355094[_0x2fd0('0x6')],_0x355094[_0x2fd0('0x7')],_0x355094['accountcode'],_0x355094[_0x2fd0('0x8')]));if(_0x355094[_0x2fd0('0x5')]){utils[_0x2fd0('0x9')](_0x355094[_0x2fd0('0x5')])[_0x2fd0('0xa')](function(_0x1823d0){if(_0x1823d0){_0x355094['type']=_0x1823d0[_0x2fd0('0xb')];}utils[_0x2fd0('0xc')]('CreateVoiceQueueReport',_0x355094);});}else{utils[_0x2fd0('0xc')](_0x2fd0('0xd'),_0x355094);}if(_0x355094[_0x2fd0('0xe')]){delete queues[_0x355094[_0x2fd0('0xe')]];}else{delete queues[_0x355094[_0x2fd0('0x3')]];}}exports[_0x2fd0('0xf')]=function(_0x3b3aa8){try{utils['debug'](util[_0x2fd0('0x2')](_0x2fd0('0x10'),_0x3b3aa8['uniqueid']),_0x3b3aa8);utils['info'](util[_0x2fd0('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3b3aa8[_0x2fd0('0x3')],_0x3b3aa8['queue'],_0x3b3aa8['position']));queues[_0x3b3aa8[_0x2fd0('0x3')]]=_[_0x2fd0('0x11')](_0x3b3aa8,{'originalposition':_0x3b3aa8['position'],'queuecallerjoinAt':utils[_0x2fd0('0x12')](),'mohtime':0x0});}catch(_0x52568a){utils['error'](util[_0x2fd0('0x2')](_0x2fd0('0x10'),_0x3b3aa8['uniqueid']),_0x52568a);}};exports[_0x2fd0('0x13')]=function(_0x257378){try{if(!_[_0x2fd0('0x14')](queues[_0x257378[_0x2fd0('0x3')]])){utils[_0x2fd0('0x15')](util[_0x2fd0('0x2')](_0x2fd0('0x16'),_0x257378[_0x2fd0('0x3')]),_0x257378);if(queues[_0x257378[_0x2fd0('0x3')]]['queuecallerleaveAt']){if(!queues[_0x257378[_0x2fd0('0x3')]][_0x2fd0('0x17')]&&!queues[_0x257378['uniqueid']][_0x2fd0('0x18')]){queues[_0x257378[_0x2fd0('0x3')]]['queuecallercomplete']=!![];queues[_0x257378['uniqueid']][_0x2fd0('0x19')]=utils[_0x2fd0('0x12')]();queues[_0x257378['uniqueid']]['queuecallerexitreason']=_0x2fd0('0x1a');}utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x257378['uniqueid'],queues[_0x257378[_0x2fd0('0x3')]]['name'],queues[_0x257378[_0x2fd0('0x3')]][_0x2fd0('0x8')]));writeDB(queues[_0x257378['uniqueid']]);}else if(queues[_0x257378[_0x2fd0('0x3')]][_0x2fd0('0xe')]){utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')](_0x2fd0('0x1c'),_0x257378[_0x2fd0('0x3')],queues[_0x257378[_0x2fd0('0x3')]][_0x2fd0('0x1d')],queues[_0x257378['uniqueid']][_0x2fd0('0xe')]));queues[queues[_0x257378[_0x2fd0('0x3')]][_0x2fd0('0xe')]]=queues[_0x257378[_0x2fd0('0x3')]];queues[queues[_0x257378[_0x2fd0('0x3')]][_0x2fd0('0xe')]][_0x2fd0('0x1e')]=0x2;delete queues[_0x257378[_0x2fd0('0x3')]];}}}catch(_0x580d10){utils['error'](util['format']('[%s][queues][hangup]',_0x257378['uniqueid']),_0x580d10);}};exports[_0x2fd0('0x1f')]=function(_0x2afb39){try{utils['debug'](util['format']('[%s][queues][varset]',_0x2afb39[_0x2fd0('0x3')]),_0x2afb39);if(!_['isNil'](_0x2afb39[_0x2fd0('0x20')][_0x2fd0('0x21')])&&_0x2afb39['value'][_0x2fd0('0x22')]()!=='CONTINUE'){if(!_[_0x2fd0('0x14')](queues[_0x2afb39[_0x2fd0('0x3')]])){queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x17')]=![];queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x23')]=null;queues[_0x2afb39['uniqueid']]['queuecallerexit']=!![];queues[_0x2afb39['uniqueid']]['queuecallerexitAt']=utils[_0x2fd0('0x12')]();queues[_0x2afb39['uniqueid']][_0x2fd0('0x8')]=_0x2afb39[_0x2fd0('0x24')][_0x2fd0('0x22')]();utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')](_0x2fd0('0x25'),_0x2afb39[_0x2fd0('0x3')],queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x1d')],_0x2afb39['value'],queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x8')]));writeDB(queues[_0x2afb39[_0x2fd0('0x3')]]);}}else if(!_[_0x2fd0('0x14')](_0x2afb39[_0x2fd0('0x20')][_0x2fd0('0x26')])){if(!_[_0x2fd0('0x14')](queues[_0x2afb39['uniqueid']])&&!queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x17')]){queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x17')]=![];queues[_0x2afb39['uniqueid']][_0x2fd0('0x23')]=null;queues[_0x2afb39['uniqueid']][_0x2fd0('0x18')]=!![];queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x27')]=utils['now']();queues[_0x2afb39[_0x2fd0('0x3')]]['queuecallerexitreason']=_0x2fd0('0x28');utils['info'](util['format'](_0x2fd0('0x29'),_0x2afb39[_0x2fd0('0x3')],queues[_0x2afb39['uniqueid']][_0x2fd0('0x1d')],_0x2afb39[_0x2fd0('0x24')],queues[_0x2afb39[_0x2fd0('0x3')]][_0x2fd0('0x8')]));}}}catch(_0x562749){utils[_0x2fd0('0x2a')](util[_0x2fd0('0x2')](_0x2fd0('0x2b'),_0x2afb39['uniqueid']),_0x562749);}};exports[_0x2fd0('0x17')]=function(_0x2ce39b){try{if(!_['isNil'](queues[_0x2ce39b[_0x2fd0('0x3')]])){utils[_0x2fd0('0x15')](util[_0x2fd0('0x2')](_0x2fd0('0x2c'),_0x2ce39b[_0x2fd0('0x3')]),_0x2ce39b);queues[_0x2ce39b[_0x2fd0('0x3')]][_0x2fd0('0x18')]=![];queues[_0x2ce39b[_0x2fd0('0x3')]][_0x2fd0('0x27')]=null;queues[_0x2ce39b[_0x2fd0('0x3')]][_0x2fd0('0x17')]=!![];queues[_0x2ce39b[_0x2fd0('0x3')]]['queuecallerabandonAt']=utils[_0x2fd0('0x12')]();queues[_0x2ce39b[_0x2fd0('0x3')]][_0x2fd0('0x8')]=_0x2fd0('0x2d');utils[_0x2fd0('0x1b')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x2ce39b[_0x2fd0('0x3')],queues[_0x2ce39b[_0x2fd0('0x3')]]['name'],queues[_0x2ce39b[_0x2fd0('0x3')]][_0x2fd0('0x8')]));}}catch(_0x24d55a){utils[_0x2fd0('0x2a')](util[_0x2fd0('0x2')](_0x2fd0('0x2c'),_0x2ce39b['uniqueid']),_0x24d55a);}};exports[_0x2fd0('0x2e')]=function(_0x5b8b0f){try{if(!_['isNil'](queues[_0x5b8b0f['uniqueid']])){utils[_0x2fd0('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x5b8b0f[_0x2fd0('0x3')]),_0x5b8b0f);utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')](_0x2fd0('0x2f'),_0x5b8b0f[_0x2fd0('0x3')],queues[_0x5b8b0f[_0x2fd0('0x3')]][_0x2fd0('0x1d')],_0x5b8b0f[_0x2fd0('0x30')],_0x5b8b0f[_0x2fd0('0x31')]));queues[_0x5b8b0f[_0x2fd0('0x3')]][_0x2fd0('0x2e')]=!![];queues[_0x5b8b0f[_0x2fd0('0x3')]][_0x2fd0('0x32')]=utils['now']();queues[_0x5b8b0f[_0x2fd0('0x3')]]['holdtime']=utils['diffTime'](queues[_0x5b8b0f['uniqueid']][_0x2fd0('0x32')],queues[_0x5b8b0f[_0x2fd0('0x3')]][_0x2fd0('0x33')]);queues[_0x5b8b0f[_0x2fd0('0x3')]]['position']=_0x5b8b0f['position'];queues[_0x5b8b0f[_0x2fd0('0x3')]][_0x2fd0('0x34')]=_0x5b8b0f[_0x2fd0('0x34')];queues[_0x5b8b0f[_0x2fd0('0x3')]][_0x2fd0('0x30')]=_0x5b8b0f['connectedlinenum'];queues[_0x5b8b0f[_0x2fd0('0x3')]][_0x2fd0('0x31')]=_0x5b8b0f[_0x2fd0('0x31')];}}catch(_0x13a363){utils[_0x2fd0('0x2a')](util[_0x2fd0('0x2')]('[%s][queues][queuecallerleave]',_0x5b8b0f[_0x2fd0('0x3')]),_0x13a363);}};exports[_0x2fd0('0x35')]=function(_0x508075){try{if(!_[_0x2fd0('0x14')](queues[_0x508075[_0x2fd0('0x3')]])){utils[_0x2fd0('0x15')](util[_0x2fd0('0x2')](_0x2fd0('0x36'),_0x508075[_0x2fd0('0x3')]),_0x508075);utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')](_0x2fd0('0x37'),_0x508075[_0x2fd0('0x3')],queues[_0x508075[_0x2fd0('0x3')]][_0x2fd0('0x1d')],_0x508075[_0x2fd0('0x38')],_0x508075['destaccountcode']));queues[_0x508075[_0x2fd0('0x3')]][_0x2fd0('0x17')]=![];queues[_0x508075[_0x2fd0('0x3')]]['queuecallerabandon']=![];queues[_0x508075['uniqueid']][_0x2fd0('0x23')]=null;queues[_0x508075[_0x2fd0('0x3')]][_0x2fd0('0x18')]=![];queues[_0x508075[_0x2fd0('0x3')]][_0x2fd0('0x8')]=null;queues[_0x508075['uniqueid']][_0x2fd0('0x27')]=null;queues[_0x508075['uniqueid']][_0x2fd0('0x39')]=!![];queues[_0x508075[_0x2fd0('0x3')]][_0x2fd0('0x3a')]=_0x508075[_0x2fd0('0x3b')];queues[_0x508075[_0x2fd0('0x3')]][_0x2fd0('0x6')]=_0x508075[_0x2fd0('0x38')];}}catch(_0xc6f64b){utils['error'](util[_0x2fd0('0x2')](_0x2fd0('0x36'),_0x508075[_0x2fd0('0x3')]),_0xc6f64b);}};exports[_0x2fd0('0x3c')]=function(_0x24a713){try{if(!_[_0x2fd0('0x14')](queues[_0x24a713[_0x2fd0('0x3')]])){if(queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x32')]){utils['debug'](util[_0x2fd0('0x2')](_0x2fd0('0x3d'),_0x24a713[_0x2fd0('0x3')]),_0x24a713);queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x17')]=![];queues[_0x24a713[_0x2fd0('0x3')]]['queuecallerabandon']=![];queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x23')]=null;queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x18')]=![];queues[_0x24a713[_0x2fd0('0x3')]]['queuecallerexitAt']=null;queues[_0x24a713[_0x2fd0('0x3')]]['assigned']=!![];queues[_0x24a713['uniqueid']][_0x2fd0('0x6')]=_0x24a713['membername'];queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x3e')]=!![];queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x19')]=utils['now']();if(_0x24a713[_0x2fd0('0x3f')]==_0x2fd0('0x40')){if(!queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x40')]){queues[_0x24a713[_0x2fd0('0x3')]]['queuecallerexitreason']=_0x2fd0('0x41');}}else{queues[_0x24a713['uniqueid']][_0x2fd0('0x8')]=_0x2fd0('0x42')+_0x24a713[_0x2fd0('0x3f')][_0x2fd0('0x22')]();}utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')](_0x2fd0('0x43'),_0x24a713[_0x2fd0('0x3')],queues[_0x24a713[_0x2fd0('0x3')]][_0x2fd0('0x1d')],_0x24a713['membername'],queues[_0x24a713[_0x2fd0('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x24a713['uniqueid']]);}}}catch(_0x166903){utils[_0x2fd0('0x2a')](util[_0x2fd0('0x2')]('[%s][queues][agentcomplete]',_0x24a713[_0x2fd0('0x3')]),_0x166903);}};exports[_0x2fd0('0x44')]=function(_0x591dcb){try{if(!_[_0x2fd0('0x14')](queues[_0x591dcb[_0x2fd0('0x45')]])){utils['debug'](util[_0x2fd0('0x2')](_0x2fd0('0x46'),_0x591dcb[_0x2fd0('0x3')]),_0x591dcb);queues[_0x591dcb['transfereeuniqueid']]['transfer']=!![];queues[_0x591dcb['transfereeuniqueid']][_0x2fd0('0x47')]=_0x2fd0('0x48');queues[_0x591dcb['transfereeuniqueid']][_0x2fd0('0x49')]=_0x591dcb[_0x2fd0('0x4a')];queues[_0x591dcb['transfereeuniqueid']]['transferuniqueid']=_0x591dcb[_0x2fd0('0x45')];queues[_0x591dcb[_0x2fd0('0x45')]][_0x2fd0('0x8')]=_0x2fd0('0x4b');utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x591dcb[_0x2fd0('0x3')],queues[_0x591dcb[_0x2fd0('0x45')]]['name'],_0x591dcb[_0x2fd0('0x45')],_0x591dcb[_0x2fd0('0x4a')]));}}catch(_0x585752){utils['error'](util[_0x2fd0('0x2')](_0x2fd0('0x46'),_0x591dcb[_0x2fd0('0x3')]),_0x585752);}};exports[_0x2fd0('0x4c')]=function(_0x438602){try{utils[_0x2fd0('0x15')](util[_0x2fd0('0x2')](_0x2fd0('0x4d'),_0x438602[_0x2fd0('0x4e')]),_0x438602);if(_0x438602['origtransfereruniqueid']==_0x438602[_0x2fd0('0x4f')]){if(!_['isNil'](queues[_0x438602[_0x2fd0('0x50')]])){utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x438602['origtransfereruniqueid'],queues[_0x438602[_0x2fd0('0x50')]][_0x2fd0('0x1d')],_0x438602[_0x2fd0('0x51')]));queues[_0x438602[_0x2fd0('0x50')]]['transfer']=!![];queues[_0x438602[_0x2fd0('0x50')]][_0x2fd0('0x47')]='ATTENDED';queues[_0x438602[_0x2fd0('0x50')]][_0x2fd0('0x49')]=_0x438602[_0x2fd0('0x51')];queues[_0x438602[_0x2fd0('0x50')]]['transferuniqueid']=_0x438602['origtransfereruniqueid'];queues[_0x438602[_0x2fd0('0x50')]][_0x2fd0('0x8')]=_0x2fd0('0x52');}if(!_[_0x2fd0('0x14')](queues[_0x438602['origtransfererlinkedid']])){if(_0x438602['transfereelinkedid']&&queues[_0x438602[_0x2fd0('0x53')]]){queues[_0x438602['transfereelinkedid']][_0x2fd0('0x1e')]=0x1;queues[_0x438602[_0x2fd0('0x45')]]=_[_0x2fd0('0x54')](queues[_0x438602[_0x2fd0('0x53')]]);queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0xe')]=_0x438602[_0x2fd0('0x55')];queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0x1e')]=0x2;queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0x7')]=queues[_0x438602[_0x2fd0('0x50')]]['calleridnum'];queues[_0x438602['transfereeuniqueid']][_0x2fd0('0x56')]=queues[_0x438602[_0x2fd0('0x50')]][_0x2fd0('0x56')];queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0x33')]=utils[_0x2fd0('0x12')]();queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0x32')]=utils[_0x2fd0('0x12')]();queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0x57')]=0x0;queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0x58')]=0x0;utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x438602[_0x2fd0('0x4e')],queues[_0x438602[_0x2fd0('0x45')]][_0x2fd0('0x1d')],queues[_0x438602[_0x2fd0('0x45')]]['calleridnum'],queues[_0x438602['transfereeuniqueid']][_0x2fd0('0x56')]));}else{utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x438602[_0x2fd0('0x4e')],queues[_0x438602['origtransfererlinkedid']]['name'],_0x438602[_0x2fd0('0x50')]));queues[_0x438602['origtransfererlinkedid']][_0x2fd0('0xe')]=_0x438602[_0x2fd0('0x50')];}}}else if(_0x438602[_0x2fd0('0x59')]==_0x438602[_0x2fd0('0x50')]){if(!_[_0x2fd0('0x14')](queues[_0x438602[_0x2fd0('0x4f')]])){utils[_0x2fd0('0x1b')](util['format'](_0x2fd0('0x5a'),_0x438602[_0x2fd0('0x4e')],queues[_0x438602[_0x2fd0('0x4f')]][_0x2fd0('0x1d')],_0x438602['secondtransfereruniqueid'],_0x438602[_0x2fd0('0x5b')]));queues[_0x438602[_0x2fd0('0x4f')]][_0x2fd0('0x40')]=!![];queues[_0x438602['origtransfererlinkedid']][_0x2fd0('0x47')]=_0x2fd0('0x5c');queues[_0x438602[_0x2fd0('0x4f')]][_0x2fd0('0x49')]=_0x438602[_0x2fd0('0x5b')];queues[_0x438602[_0x2fd0('0x4f')]][_0x2fd0('0x5d')]=_0x438602[_0x2fd0('0x59')];queues[_0x438602[_0x2fd0('0x4f')]][_0x2fd0('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x2fd0('0x14')](queues[_0x438602[_0x2fd0('0x50')]])){if(_0x438602[_0x2fd0('0x5e')]&&queues[_0x438602[_0x2fd0('0x5e')]]){queues[_0x438602['transfertargetlinkedid']][_0x2fd0('0x1e')]=0x1;queues[_0x438602[_0x2fd0('0x55')]]=_[_0x2fd0('0x54')](queues[_0x438602['transfertargetlinkedid']]);queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0xe')]=_0x438602[_0x2fd0('0x55')];queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x1e')]=0x2;queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x7')]=queues[_0x438602[_0x2fd0('0x4f')]]['calleridnum'];queues[_0x438602[_0x2fd0('0x55')]]['calleridname']=queues[_0x438602[_0x2fd0('0x4f')]]['calleridname'];queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x33')]=utils[_0x2fd0('0x12')]();queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x32')]=utils[_0x2fd0('0x12')]();queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x57')]=0x0;queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x58')]=0x0;utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x438602['origtransfereruniqueid'],queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x1d')],queues[_0x438602[_0x2fd0('0x55')]]['transfereduniqueid'],queues[_0x438602[_0x2fd0('0x55')]]['calleridnum'],queues[_0x438602[_0x2fd0('0x55')]][_0x2fd0('0x56')]));}else{utils['info'](util['format'](_0x2fd0('0x5f'),_0x438602[_0x2fd0('0x4e')],queues[_0x438602[_0x2fd0('0x50')]][_0x2fd0('0x1d')],_0x438602[_0x2fd0('0x4f')]));queues[_0x438602['secondtransfererlinkedid']][_0x2fd0('0xe')]=_0x438602[_0x2fd0('0x4f')];}}}}catch(_0x459794){utils['error'](util[_0x2fd0('0x2')](_0x2fd0('0x4d'),_0x438602[_0x2fd0('0x4e')]),_0x459794);}};exports[_0x2fd0('0x60')]=function(_0x5e2921){try{if(!_[_0x2fd0('0x14')](queues[_0x5e2921[_0x2fd0('0x3')]])){utils['debug'](util[_0x2fd0('0x2')](_0x2fd0('0x61'),_0x5e2921[_0x2fd0('0x3')]),_0x5e2921);queues[_0x5e2921[_0x2fd0('0x3')]][_0x2fd0('0x62')]=utils[_0x2fd0('0x12')]();utils['info'](util[_0x2fd0('0x2')](_0x2fd0('0x63'),_0x5e2921[_0x2fd0('0x3')],queues[_0x5e2921[_0x2fd0('0x3')]][_0x2fd0('0x1d')],queues[_0x5e2921[_0x2fd0('0x3')]]['musiconholdstartAt']));}}catch(_0x13a0e9){utils[_0x2fd0('0x2a')](util['format'](_0x2fd0('0x61'),_0x5e2921['uniqueid']),_0x13a0e9);}};exports[_0x2fd0('0x64')]=function(_0x543677){try{if(!_[_0x2fd0('0x14')](queues[_0x543677[_0x2fd0('0x3')]])){if(!_[_0x2fd0('0x14')](queues[_0x543677[_0x2fd0('0x3')]][_0x2fd0('0x62')])){utils[_0x2fd0('0x15')](util['format'](_0x2fd0('0x65'),_0x543677['uniqueid']),_0x543677);queues[_0x543677[_0x2fd0('0x3')]][_0x2fd0('0x58')]+=utils['diffTime'](utils['now'](),queues[_0x543677['uniqueid']]['musiconholdstartAt']);utils[_0x2fd0('0x1b')](util[_0x2fd0('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x543677[_0x2fd0('0x3')],queues[_0x543677[_0x2fd0('0x3')]][_0x2fd0('0x1d')],queues[_0x543677['uniqueid']][_0x2fd0('0x58')]));delete queues[_0x543677['uniqueid']][_0x2fd0('0x62')];}}}catch(_0x595ff5){utils[_0x2fd0('0x2a')](util[_0x2fd0('0x2')](_0x2fd0('0x65'),_0x543677['uniqueid']),_0x595ff5);}}; \ No newline at end of file +var _0xb247=['now','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','value','error','debug','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','queuecallercompleteAt','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','transferuniqueid','BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','position'];(function(_0x24bcc0,_0x5a4fd8){var _0x403a87=function(_0xc062be){while(--_0xc062be){_0x24bcc0['push'](_0x24bcc0['shift']());}};_0x403a87(++_0x5a4fd8);}(_0xb247,0x113));var _0x7b24=function(_0x113945,_0x102a24){_0x113945=_0x113945-0x0;var _0x5836c8=_0xb247[_0x113945];return _0x5836c8;};'use strict';var _=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var utils=require(_0x7b24('0x2'));var queues={};function writeDB(_0x405d2d){utils['info'](util[_0x7b24('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x405d2d[_0x7b24('0x4')],_0x405d2d[_0x7b24('0x5')],_0x405d2d[_0x7b24('0x6')],_0x405d2d[_0x7b24('0x7')],_0x405d2d[_0x7b24('0x8')],_0x405d2d[_0x7b24('0x9')],_0x405d2d['queuecallerexitreason']));if(_0x405d2d[_0x7b24('0x6')]){utils['getVoiceQueueByName'](_0x405d2d[_0x7b24('0x6')])[_0x7b24('0xa')](function(_0x5ad9c9){if(_0x5ad9c9){_0x405d2d[_0x7b24('0xb')]=_0x5ad9c9[_0x7b24('0xb')];}utils[_0x7b24('0xc')]('CreateVoiceQueueReport',_0x405d2d);});}else{utils[_0x7b24('0xc')](_0x7b24('0xd'),_0x405d2d);}if(_0x405d2d[_0x7b24('0xe')]){delete queues[_0x405d2d[_0x7b24('0xe')]];}else{delete queues[_0x405d2d['uniqueid']];}}exports[_0x7b24('0xf')]=function(_0x103f6e){try{utils['debug'](util[_0x7b24('0x3')](_0x7b24('0x10'),_0x103f6e[_0x7b24('0x4')]),_0x103f6e);utils[_0x7b24('0x11')](util[_0x7b24('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x103f6e[_0x7b24('0x4')],_0x103f6e['queue'],_0x103f6e[_0x7b24('0x12')]));queues[_0x103f6e[_0x7b24('0x4')]]=_['assign'](_0x103f6e,{'originalposition':_0x103f6e['position'],'queuecallerjoinAt':utils[_0x7b24('0x13')](),'mohtime':0x0});}catch(_0x4c666f){utils['error'](util[_0x7b24('0x3')](_0x7b24('0x10'),_0x103f6e['uniqueid']),_0x4c666f);}};exports[_0x7b24('0x14')]=function(_0x5f6255){try{if(!_[_0x7b24('0x15')](queues[_0x5f6255[_0x7b24('0x4')]])){utils['debug'](util[_0x7b24('0x3')](_0x7b24('0x16'),_0x5f6255[_0x7b24('0x4')]),_0x5f6255);if(queues[_0x5f6255[_0x7b24('0x4')]]['queuecallerleaveAt']){if(!queues[_0x5f6255[_0x7b24('0x4')]][_0x7b24('0x17')]&&!queues[_0x5f6255[_0x7b24('0x4')]][_0x7b24('0x18')]){queues[_0x5f6255['uniqueid']][_0x7b24('0x19')]=!![];queues[_0x5f6255[_0x7b24('0x4')]]['queuecallercompleteAt']=utils[_0x7b24('0x13')]();queues[_0x5f6255[_0x7b24('0x4')]][_0x7b24('0x1a')]=_0x7b24('0x1b');}utils[_0x7b24('0x11')](util['format'](_0x7b24('0x1c'),_0x5f6255['uniqueid'],queues[_0x5f6255['uniqueid']][_0x7b24('0x1d')],queues[_0x5f6255[_0x7b24('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x5f6255[_0x7b24('0x4')]]);}else if(queues[_0x5f6255[_0x7b24('0x4')]][_0x7b24('0xe')]){utils[_0x7b24('0x11')](util[_0x7b24('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5f6255[_0x7b24('0x4')],queues[_0x5f6255[_0x7b24('0x4')]][_0x7b24('0x1d')],queues[_0x5f6255[_0x7b24('0x4')]][_0x7b24('0xe')]));queues[queues[_0x5f6255['uniqueid']][_0x7b24('0xe')]]=queues[_0x5f6255[_0x7b24('0x4')]];queues[queues[_0x5f6255['uniqueid']][_0x7b24('0xe')]][_0x7b24('0x1e')]=0x2;delete queues[_0x5f6255['uniqueid']];}}}catch(_0xca0357){utils['error'](util['format']('[%s][queues][hangup]',_0x5f6255[_0x7b24('0x4')]),_0xca0357);}};exports[_0x7b24('0x1f')]=function(_0x50af6c){try{utils['debug'](util[_0x7b24('0x3')](_0x7b24('0x20'),_0x50af6c[_0x7b24('0x4')]),_0x50af6c);if(!_[_0x7b24('0x15')](_0x50af6c[_0x7b24('0x21')][_0x7b24('0x22')])&&_0x50af6c['value'][_0x7b24('0x23')]()!==_0x7b24('0x24')){if(!_[_0x7b24('0x15')](queues[_0x50af6c['uniqueid']])){queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x17')]=![];queues[_0x50af6c[_0x7b24('0x4')]]['queuecallerabandonAt']=null;queues[_0x50af6c[_0x7b24('0x4')]]['queuecallerexit']=!![];queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x25')]=utils[_0x7b24('0x13')]();queues[_0x50af6c['uniqueid']]['queuecallerexitreason']=_0x50af6c['value'][_0x7b24('0x23')]();utils[_0x7b24('0x11')](util[_0x7b24('0x3')](_0x7b24('0x26'),_0x50af6c[_0x7b24('0x4')],queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x1d')],_0x50af6c['value'],queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x1a')]));writeDB(queues[_0x50af6c['uniqueid']]);}}else if(!_['isNil'](_0x50af6c[_0x7b24('0x21')][_0x7b24('0x27')])){if(!_[_0x7b24('0x15')](queues[_0x50af6c[_0x7b24('0x4')]])&&!queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x17')]){queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x17')]=![];queues[_0x50af6c['uniqueid']][_0x7b24('0x28')]=null;queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x18')]=!![];queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x25')]=utils[_0x7b24('0x13')]();queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x1a')]='EXITWITHKEY';utils[_0x7b24('0x11')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x50af6c[_0x7b24('0x4')],queues[_0x50af6c[_0x7b24('0x4')]][_0x7b24('0x1d')],_0x50af6c[_0x7b24('0x29')],queues[_0x50af6c['uniqueid']]['queuecallerexitreason']));}}}catch(_0x840bb3){utils[_0x7b24('0x2a')](util['format'](_0x7b24('0x20'),_0x50af6c[_0x7b24('0x4')]),_0x840bb3);}};exports[_0x7b24('0x17')]=function(_0xa751f5){try{if(!_[_0x7b24('0x15')](queues[_0xa751f5[_0x7b24('0x4')]])){utils[_0x7b24('0x2b')](util[_0x7b24('0x3')](_0x7b24('0x2c'),_0xa751f5[_0x7b24('0x4')]),_0xa751f5);queues[_0xa751f5[_0x7b24('0x4')]]['queuecallerexit']=![];queues[_0xa751f5[_0x7b24('0x4')]]['queuecallerexitAt']=null;queues[_0xa751f5['uniqueid']]['queuecallerabandon']=!![];queues[_0xa751f5[_0x7b24('0x4')]][_0x7b24('0x28')]=utils[_0x7b24('0x13')]();queues[_0xa751f5[_0x7b24('0x4')]]['queuecallerexitreason']='ABANDONED';utils[_0x7b24('0x11')](util[_0x7b24('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0xa751f5[_0x7b24('0x4')],queues[_0xa751f5['uniqueid']][_0x7b24('0x1d')],queues[_0xa751f5[_0x7b24('0x4')]]['queuecallerexitreason']));}}catch(_0x3e0202){utils[_0x7b24('0x2a')](util[_0x7b24('0x3')](_0x7b24('0x2c'),_0xa751f5[_0x7b24('0x4')]),_0x3e0202);}};exports[_0x7b24('0x2d')]=function(_0x497488){try{if(!_[_0x7b24('0x15')](queues[_0x497488['uniqueid']])){utils['debug'](util['format'](_0x7b24('0x2e'),_0x497488['uniqueid']),_0x497488);utils[_0x7b24('0x11')](util['format'](_0x7b24('0x2f'),_0x497488[_0x7b24('0x4')],queues[_0x497488[_0x7b24('0x4')]][_0x7b24('0x1d')],_0x497488[_0x7b24('0x30')],_0x497488[_0x7b24('0x31')]));queues[_0x497488[_0x7b24('0x4')]]['queuecallerleave']=!![];queues[_0x497488['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x497488['uniqueid']][_0x7b24('0x32')]=utils[_0x7b24('0x33')](queues[_0x497488[_0x7b24('0x4')]][_0x7b24('0x34')],queues[_0x497488[_0x7b24('0x4')]][_0x7b24('0x35')]);queues[_0x497488['uniqueid']][_0x7b24('0x12')]=_0x497488[_0x7b24('0x12')];queues[_0x497488[_0x7b24('0x4')]]['count']=_0x497488[_0x7b24('0x36')];queues[_0x497488[_0x7b24('0x4')]][_0x7b24('0x30')]=_0x497488['connectedlinenum'];queues[_0x497488['uniqueid']]['connectedlinename']=_0x497488[_0x7b24('0x31')];}}catch(_0x5a486a){utils[_0x7b24('0x2a')](util['format'](_0x7b24('0x2e'),_0x497488[_0x7b24('0x4')]),_0x5a486a);}};exports[_0x7b24('0x37')]=function(_0x452bbd){try{if(!_[_0x7b24('0x15')](queues[_0x452bbd['uniqueid']])){utils[_0x7b24('0x2b')](util[_0x7b24('0x3')](_0x7b24('0x38'),_0x452bbd[_0x7b24('0x4')]),_0x452bbd);utils['info'](util[_0x7b24('0x3')](_0x7b24('0x39'),_0x452bbd[_0x7b24('0x4')],queues[_0x452bbd[_0x7b24('0x4')]]['name'],_0x452bbd[_0x7b24('0x3a')],_0x452bbd[_0x7b24('0x3b')]));queues[_0x452bbd[_0x7b24('0x4')]][_0x7b24('0x17')]=![];queues[_0x452bbd['uniqueid']][_0x7b24('0x17')]=![];queues[_0x452bbd['uniqueid']]['queuecallerabandonAt']=null;queues[_0x452bbd[_0x7b24('0x4')]][_0x7b24('0x18')]=![];queues[_0x452bbd[_0x7b24('0x4')]][_0x7b24('0x1a')]=null;queues[_0x452bbd[_0x7b24('0x4')]][_0x7b24('0x25')]=null;queues[_0x452bbd[_0x7b24('0x4')]][_0x7b24('0x3c')]=!![];queues[_0x452bbd['uniqueid']][_0x7b24('0x9')]=_0x452bbd['destaccountcode'];queues[_0x452bbd['uniqueid']][_0x7b24('0x7')]=_0x452bbd[_0x7b24('0x3a')];}}catch(_0x26e65b){utils[_0x7b24('0x2a')](util[_0x7b24('0x3')](_0x7b24('0x38'),_0x452bbd['uniqueid']),_0x26e65b);}};exports[_0x7b24('0x3d')]=function(_0x12b969){try{if(!_[_0x7b24('0x15')](queues[_0x12b969[_0x7b24('0x4')]])){if(queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x34')]){utils['debug'](util[_0x7b24('0x3')]('[%s][queues][agentcomplete]',_0x12b969[_0x7b24('0x4')]),_0x12b969);queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x17')]=![];queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x17')]=![];queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x28')]=null;queues[_0x12b969['uniqueid']]['queuecallerexit']=![];queues[_0x12b969['uniqueid']][_0x7b24('0x25')]=null;queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x3c')]=!![];queues[_0x12b969[_0x7b24('0x4')]]['lastAssignedTo']=_0x12b969['membername'];queues[_0x12b969['uniqueid']][_0x7b24('0x19')]=!![];queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x3e')]=utils[_0x7b24('0x13')]();if(_0x12b969[_0x7b24('0x3f')]=='transfer'){if(!queues[_0x12b969['uniqueid']][_0x7b24('0x40')]){queues[_0x12b969['uniqueid']][_0x7b24('0x1a')]='TRANSFER';}}else{queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x1a')]=_0x7b24('0x41')+_0x12b969[_0x7b24('0x3f')][_0x7b24('0x23')]();}utils[_0x7b24('0x11')](util[_0x7b24('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x12b969['uniqueid'],queues[_0x12b969[_0x7b24('0x4')]][_0x7b24('0x1d')],_0x12b969[_0x7b24('0x3a')],queues[_0x12b969['uniqueid']][_0x7b24('0x1a')]));writeDB(queues[_0x12b969[_0x7b24('0x4')]]);}}}catch(_0x1104d1){utils['error'](util[_0x7b24('0x3')](_0x7b24('0x42'),_0x12b969[_0x7b24('0x4')]),_0x1104d1);}};exports[_0x7b24('0x43')]=function(_0x440a43){try{if(!_[_0x7b24('0x15')](queues[_0x440a43[_0x7b24('0x44')]])){utils[_0x7b24('0x2b')](util[_0x7b24('0x3')](_0x7b24('0x45'),_0x440a43[_0x7b24('0x4')]),_0x440a43);queues[_0x440a43['transfereeuniqueid']][_0x7b24('0x40')]=!![];queues[_0x440a43[_0x7b24('0x44')]]['transfertype']='BLIND';queues[_0x440a43['transfereeuniqueid']][_0x7b24('0x46')]=_0x440a43['extension'];queues[_0x440a43[_0x7b24('0x44')]][_0x7b24('0x47')]=_0x440a43[_0x7b24('0x44')];queues[_0x440a43[_0x7b24('0x44')]]['queuecallerexitreason']=_0x7b24('0x48');utils[_0x7b24('0x11')](util[_0x7b24('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x440a43[_0x7b24('0x4')],queues[_0x440a43[_0x7b24('0x44')]][_0x7b24('0x1d')],_0x440a43['transfereeuniqueid'],_0x440a43[_0x7b24('0x49')]));}}catch(_0x492046){utils[_0x7b24('0x2a')](util[_0x7b24('0x3')]('[%s][queues][blindtransfer]',_0x440a43[_0x7b24('0x4')]),_0x492046);}};exports[_0x7b24('0x4a')]=function(_0x34a0f1){try{utils[_0x7b24('0x2b')](util[_0x7b24('0x3')](_0x7b24('0x4b'),_0x34a0f1[_0x7b24('0x4c')]),_0x34a0f1);if(_0x34a0f1[_0x7b24('0x4c')]==_0x34a0f1['origtransfererlinkedid']){if(!_[_0x7b24('0x15')](queues[_0x34a0f1['secondtransfererlinkedid']])){utils['info'](util[_0x7b24('0x3')](_0x7b24('0x4d'),_0x34a0f1[_0x7b24('0x4c')],queues[_0x34a0f1[_0x7b24('0x4e')]]['name'],_0x34a0f1[_0x7b24('0x4f')]));queues[_0x34a0f1['secondtransfererlinkedid']]['transfer']=!![];queues[_0x34a0f1['secondtransfererlinkedid']]['transfertype']=_0x7b24('0x50');queues[_0x34a0f1['secondtransfererlinkedid']][_0x7b24('0x46')]=_0x34a0f1['origtransfererexten'];queues[_0x34a0f1[_0x7b24('0x4e')]][_0x7b24('0x47')]=_0x34a0f1['origtransfereruniqueid'];queues[_0x34a0f1[_0x7b24('0x4e')]][_0x7b24('0x1a')]=_0x7b24('0x51');}if(!_[_0x7b24('0x15')](queues[_0x34a0f1[_0x7b24('0x52')]])){if(_0x34a0f1[_0x7b24('0x53')]&&queues[_0x34a0f1['transfereelinkedid']]){queues[_0x34a0f1[_0x7b24('0x53')]][_0x7b24('0x1e')]=0x1;queues[_0x34a0f1[_0x7b24('0x44')]]=_['clone'](queues[_0x34a0f1[_0x7b24('0x53')]]);queues[_0x34a0f1['transfereeuniqueid']][_0x7b24('0xe')]=_0x34a0f1[_0x7b24('0x54')];queues[_0x34a0f1[_0x7b24('0x44')]][_0x7b24('0x1e')]=0x2;queues[_0x34a0f1[_0x7b24('0x44')]][_0x7b24('0x8')]=queues[_0x34a0f1['secondtransfererlinkedid']][_0x7b24('0x8')];queues[_0x34a0f1[_0x7b24('0x44')]][_0x7b24('0x55')]=queues[_0x34a0f1[_0x7b24('0x4e')]]['calleridname'];queues[_0x34a0f1[_0x7b24('0x44')]]['queuecallerjoinAt']=utils[_0x7b24('0x13')]();queues[_0x34a0f1['transfereeuniqueid']][_0x7b24('0x34')]=utils['now']();queues[_0x34a0f1[_0x7b24('0x44')]][_0x7b24('0x32')]=0x0;queues[_0x34a0f1[_0x7b24('0x44')]][_0x7b24('0x56')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x34a0f1[_0x7b24('0x4c')],queues[_0x34a0f1[_0x7b24('0x44')]]['name'],queues[_0x34a0f1[_0x7b24('0x44')]][_0x7b24('0x8')],queues[_0x34a0f1[_0x7b24('0x44')]][_0x7b24('0x55')]));}else{utils[_0x7b24('0x11')](util[_0x7b24('0x3')](_0x7b24('0x57'),_0x34a0f1['origtransfereruniqueid'],queues[_0x34a0f1[_0x7b24('0x52')]][_0x7b24('0x1d')],_0x34a0f1[_0x7b24('0x4e')]));queues[_0x34a0f1[_0x7b24('0x52')]][_0x7b24('0xe')]=_0x34a0f1['secondtransfererlinkedid'];}}}else if(_0x34a0f1[_0x7b24('0x58')]==_0x34a0f1['secondtransfererlinkedid']){if(!_[_0x7b24('0x15')](queues[_0x34a0f1['origtransfererlinkedid']])){utils[_0x7b24('0x11')](util[_0x7b24('0x3')](_0x7b24('0x59'),_0x34a0f1[_0x7b24('0x4c')],queues[_0x34a0f1[_0x7b24('0x52')]]['name'],_0x34a0f1[_0x7b24('0x58')],_0x34a0f1[_0x7b24('0x5a')]));queues[_0x34a0f1[_0x7b24('0x52')]][_0x7b24('0x40')]=!![];queues[_0x34a0f1[_0x7b24('0x52')]][_0x7b24('0x5b')]=_0x7b24('0x50');queues[_0x34a0f1[_0x7b24('0x52')]]['transferexten']=_0x34a0f1[_0x7b24('0x5a')];queues[_0x34a0f1[_0x7b24('0x52')]]['transferuniqueid']=_0x34a0f1[_0x7b24('0x58')];queues[_0x34a0f1[_0x7b24('0x52')]][_0x7b24('0x1a')]=_0x7b24('0x51');}if(!_[_0x7b24('0x15')](queues[_0x34a0f1[_0x7b24('0x4e')]])){if(_0x34a0f1['transfertargetlinkedid']&&queues[_0x34a0f1[_0x7b24('0x5c')]]){queues[_0x34a0f1[_0x7b24('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x34a0f1[_0x7b24('0x54')]]=_['clone'](queues[_0x34a0f1[_0x7b24('0x5c')]]);queues[_0x34a0f1['transfertargetuniqueid']][_0x7b24('0xe')]=_0x34a0f1['transfertargetuniqueid'];queues[_0x34a0f1[_0x7b24('0x54')]]['queuecallerenterreason']=0x2;queues[_0x34a0f1[_0x7b24('0x54')]]['calleridnum']=queues[_0x34a0f1[_0x7b24('0x52')]][_0x7b24('0x8')];queues[_0x34a0f1[_0x7b24('0x54')]][_0x7b24('0x55')]=queues[_0x34a0f1[_0x7b24('0x52')]][_0x7b24('0x55')];queues[_0x34a0f1[_0x7b24('0x54')]]['queuecallerjoinAt']=utils[_0x7b24('0x13')]();queues[_0x34a0f1[_0x7b24('0x54')]][_0x7b24('0x34')]=utils[_0x7b24('0x13')]();queues[_0x34a0f1['transfertargetuniqueid']][_0x7b24('0x32')]=0x0;queues[_0x34a0f1[_0x7b24('0x54')]][_0x7b24('0x56')]=0x0;utils[_0x7b24('0x11')](util[_0x7b24('0x3')](_0x7b24('0x5d'),_0x34a0f1[_0x7b24('0x4c')],queues[_0x34a0f1['transfertargetuniqueid']][_0x7b24('0x1d')],queues[_0x34a0f1[_0x7b24('0x54')]][_0x7b24('0xe')],queues[_0x34a0f1[_0x7b24('0x54')]][_0x7b24('0x8')],queues[_0x34a0f1[_0x7b24('0x54')]]['calleridname']));}else{utils[_0x7b24('0x11')](util[_0x7b24('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x34a0f1[_0x7b24('0x4c')],queues[_0x34a0f1['secondtransfererlinkedid']][_0x7b24('0x1d')],_0x34a0f1[_0x7b24('0x52')]));queues[_0x34a0f1['secondtransfererlinkedid']][_0x7b24('0xe')]=_0x34a0f1[_0x7b24('0x52')];}}}}catch(_0x22c61d){utils[_0x7b24('0x2a')](util[_0x7b24('0x3')]('[%s][queues][attendedtransfer]',_0x34a0f1['origtransfereruniqueid']),_0x22c61d);}};exports['musiconholdstart']=function(_0x4261a9){try{if(!_[_0x7b24('0x15')](queues[_0x4261a9['uniqueid']])){utils['debug'](util[_0x7b24('0x3')]('[%s][queues][musiconholdstart]',_0x4261a9[_0x7b24('0x4')]),_0x4261a9);queues[_0x4261a9[_0x7b24('0x4')]][_0x7b24('0x5e')]=utils[_0x7b24('0x13')]();utils[_0x7b24('0x11')](util[_0x7b24('0x3')](_0x7b24('0x5f'),_0x4261a9[_0x7b24('0x4')],queues[_0x4261a9['uniqueid']][_0x7b24('0x1d')],queues[_0x4261a9[_0x7b24('0x4')]][_0x7b24('0x5e')]));}}catch(_0x4dfc9f){utils[_0x7b24('0x2a')](util[_0x7b24('0x3')]('[%s][queues][musiconholdstart]',_0x4261a9[_0x7b24('0x4')]),_0x4dfc9f);}};exports[_0x7b24('0x60')]=function(_0x5d85ce){try{if(!_[_0x7b24('0x15')](queues[_0x5d85ce[_0x7b24('0x4')]])){if(!_[_0x7b24('0x15')](queues[_0x5d85ce[_0x7b24('0x4')]]['musiconholdstartAt'])){utils['debug'](util[_0x7b24('0x3')]('[%s][queues][musiconholdstop]',_0x5d85ce[_0x7b24('0x4')]),_0x5d85ce);queues[_0x5d85ce[_0x7b24('0x4')]][_0x7b24('0x56')]+=utils[_0x7b24('0x33')](utils[_0x7b24('0x13')](),queues[_0x5d85ce[_0x7b24('0x4')]][_0x7b24('0x5e')]);utils[_0x7b24('0x11')](util['format'](_0x7b24('0x61'),_0x5d85ce['uniqueid'],queues[_0x5d85ce['uniqueid']][_0x7b24('0x1d')],queues[_0x5d85ce[_0x7b24('0x4')]][_0x7b24('0x56')]));delete queues[_0x5d85ce[_0x7b24('0x4')]]['musiconholdstartAt'];}}}catch(_0x580988){utils[_0x7b24('0x2a')](util[_0x7b24('0x3')]('[%s][queues][musiconholdstop]',_0x5d85ce[_0x7b24('0x4')]),_0x580988);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 9b7fbf0..597b6a3 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 _0x31c9=['replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','clone','[%s][recordings][newexten]','application','appdata','startsWith','toLowerCase','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereruniqueid','recording','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','debug','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49'];(function(_0x3038be,_0x425d69){var _0x581d4e=function(_0x1f0731){while(--_0x1f0731){_0x3038be['push'](_0x3038be['shift']());}};_0x581d4e(++_0x425d69);}(_0x31c9,0x6b));var _0x931c=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x31c9[_0x1589dd];return _0x1bddd1;};'use strict';var _=require('lodash');var util=require(_0x931c('0x0'));var utils=require('./utils');var transfers=require(_0x931c('0x1'));var recordings={};function writeDB(_0x223a9f){var _0x514d49;utils[_0x931c('0x2')](util[_0x931c('0x3')](_0x931c('0x4'),_0x223a9f[_0x931c('0x5')]));if(transfers['blinds'][_0x223a9f[_0x931c('0x5')]]){_0x514d49=_0x223a9f[_0x931c('0x5')];_0x223a9f['uniqueid']=transfers[_0x931c('0x6')][_0x223a9f[_0x931c('0x5')]][_0x931c('0x7')];}if(_0x223a9f[_0x931c('0x8')]){utils[_0x931c('0x9')](_0x223a9f[_0x931c('0x8')])[_0x931c('0xa')](function(_0x76ce66){if(_0x76ce66){_0x223a9f[_0x931c('0xb')]=_0x76ce66[_0x931c('0xc')];_0x223a9f[_0x931c('0xd')]=_0x76ce66['id'];}utils[_0x931c('0xe')](_0x931c('0xf'),_0x223a9f);});}else{utils['request'](_0x931c('0xf'),_0x223a9f);}if(_0x514d49)delete transfers['blinds'][_0x514d49];}exports[_0x931c('0x10')]=function(_0x26491a){try{utils['debug'](util[_0x931c('0x3')](_0x931c('0x11'),_0x26491a[_0x931c('0x5')]),_0x26491a);if(_0x26491a[_0x931c('0x5')]==_0x26491a[_0x931c('0x12')]){utils['info'](util[_0x931c('0x3')](_0x931c('0x13'),_0x26491a[_0x931c('0x5')],_0x26491a[_0x931c('0x14')],_0x26491a[_0x931c('0x15')]));recordings[_0x26491a[_0x931c('0x5')]]={'uniqueid':_0x26491a[_0x931c('0x5')],'accountcode':_0x26491a[_0x931c('0x8')],'exten':_0x26491a[_0x931c('0x15')],'context':_0x26491a[_0x931c('0x14')],'channel':_0x26491a[_0x931c('0x16')],'monitors':[]};}}catch(_0x3af474){utils[_0x931c('0x17')](util[_0x931c('0x3')](_0x931c('0x11'),_0x26491a['uniqueid']),_0x3af474);}};exports['newstate']=function(_0x5d2b0f){try{utils[_0x931c('0x18')](util[_0x931c('0x3')]('[%s][recordings][newstate]',_0x5d2b0f[_0x931c('0x5')]),_0x5d2b0f);if(!_['isNil'](recordings[_0x5d2b0f[_0x931c('0x5')]])&&_0x5d2b0f[_0x931c('0x19')]==0x6){utils[_0x931c('0x2')](util[_0x931c('0x3')](_0x931c('0x1a'),_0x5d2b0f['uniqueid'],_0x5d2b0f['context'],_0x5d2b0f['channel']));}else if(!_[_0x931c('0x1b')](recordings[_0x5d2b0f[_0x931c('0x12')]])&&_0x5d2b0f[_0x931c('0x19')]==0x6&&_0x5d2b0f[_0x931c('0x14')]!=_0x931c('0x1c')){utils[_0x931c('0x2')](util[_0x931c('0x3')](_0x931c('0x1d'),_0x5d2b0f[_0x931c('0x5')],_0x5d2b0f['linkedid'],_0x5d2b0f['context'],_0x5d2b0f[_0x931c('0x16')]));recordings[_0x5d2b0f[_0x931c('0x12')]][_0x931c('0x8')]=_0x5d2b0f[_0x931c('0x8')];}}catch(_0x37c6ea){utils[_0x931c('0x17')](util[_0x931c('0x3')](_0x931c('0x1e'),_0x5d2b0f['uniqueid']),_0x37c6ea);}};exports['varset']=function(_0x31cf1d){try{if(!_['isNil'](_0x31cf1d['variable'])&&!_[_0x931c('0x1b')](_0x31cf1d[_0x931c('0x1f')][_0x931c('0x20')])){utils[_0x931c('0x18')](util[_0x931c('0x3')]('[%s][recordings][varset]',_0x31cf1d[_0x931c('0x5')]),_0x31cf1d);utils[_0x931c('0x2')](util[_0x931c('0x3')](_0x931c('0x21'),_0x31cf1d[_0x931c('0x5')],_0x31cf1d[_0x931c('0x1f')],_0x31cf1d[_0x931c('0x22')]));if(_[_0x931c('0x23')](_0x31cf1d['value'],_0x931c('0x24'))){_0x31cf1d[_0x931c('0x22')]=_0x31cf1d['value'][_0x931c('0x25')](_0x931c('0x24'),_0x931c('0x26'));}if(recordings[_0x31cf1d['linkedid']]){var _0x44b162=_[_0x931c('0x27')](recordings[_0x31cf1d[_0x931c('0x12')]][_0x931c('0x28')],{'value':_0x31cf1d[_0x931c('0x22')]});if(_[_0x931c('0x1b')](_0x44b162)){recordings[_0x31cf1d['linkedid']][_0x931c('0x28')][_0x931c('0x29')]({'value':_0x31cf1d[_0x931c('0x22')]});}}}}catch(_0x380d81){utils[_0x931c('0x17')](util[_0x931c('0x3')](_0x931c('0x2a'),_0x31cf1d[_0x931c('0x5')]),_0x380d81);}};exports[_0x931c('0x2b')]=function(_0x2c65bd){try{if(!_[_0x931c('0x1b')](recordings[_0x2c65bd[_0x931c('0x5')]])){utils[_0x931c('0x18')](util[_0x931c('0x3')](_0x931c('0x2c'),_0x2c65bd[_0x931c('0x5')]),_0x2c65bd);utils[_0x931c('0x2')](util['format'](_0x931c('0x2d'),_0x2c65bd[_0x931c('0x5')],_0x2c65bd['calleridnum'],_0x2c65bd['calleridname'],_0x2c65bd[_0x931c('0x2e')]));recordings[_0x2c65bd['uniqueid']][_0x931c('0x2f')]=_0x2c65bd[_0x931c('0x2f')];recordings[_0x2c65bd[_0x931c('0x5')]][_0x931c('0x30')]=_0x2c65bd[_0x931c('0x30')];recordings[_0x2c65bd[_0x931c('0x5')]]['connectedlinenum']=_0x2c65bd[_0x931c('0x31')];recordings[_0x2c65bd[_0x931c('0x5')]][_0x931c('0x32')]=_0x2c65bd[_0x931c('0x32')];if(recordings[_0x2c65bd[_0x931c('0x5')]][_0x931c('0x33')]=='outbound'&&recordings[_0x2c65bd['uniqueid']]['accountcode']){recordings[_0x2c65bd['uniqueid']]['connectedlinenum']=recordings[_0x2c65bd[_0x931c('0x5')]]['accountcode'];recordings[_0x2c65bd[_0x931c('0x5')]][_0x931c('0x32')]='';}recordings[_0x2c65bd[_0x931c('0x5')]]['monitors']['forEach'](function(_0x506afa){var _0x1b784a=_[_0x931c('0x34')](recordings[_0x2c65bd['uniqueid']]);_0x1b784a[_0x931c('0x22')]=_0x506afa[_0x931c('0x22')];writeDB(_0x1b784a);});delete recordings[_0x2c65bd[_0x931c('0x5')]];}}catch(_0x26171e){utils[_0x931c('0x17')](util[_0x931c('0x3')](_0x931c('0x2c'),_0x2c65bd[_0x931c('0x5')]),_0x26171e);}};exports['newexten']=function(_0x4dd672){try{if(!_['isNil'](recordings[_0x4dd672[_0x931c('0x5')]])){utils['debug'](util[_0x931c('0x3')](_0x931c('0x35'),_0x4dd672[_0x931c('0x5')]),_0x4dd672);utils[_0x931c('0x2')](util[_0x931c('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4dd672[_0x931c('0x5')],_0x4dd672[_0x931c('0x36')],_0x4dd672[_0x931c('0x37')]));if(_0x4dd672[_0x931c('0x36')]['toLowerCase']()=='set'&&_[_0x931c('0x38')](_0x4dd672[_0x931c('0x37')][_0x931c('0x39')](),'cdr')){var _0x327dd2=_0x4dd672['appdata'][_0x931c('0x3a')]('=');var _0x5e77e0=_0x327dd2[0x0][_0x931c('0x3b')](_0x327dd2[0x0][_0x931c('0x3c')]('(')+0x1,_0x327dd2[0x0][_0x931c('0x3c')](')'));var _0x3bfd24=_0x327dd2[0x1];recordings[_0x4dd672['uniqueid']][_0x5e77e0]=_0x3bfd24;}}}catch(_0x44bf2e){utils[_0x931c('0x17')](util[_0x931c('0x3')](_0x931c('0x35'),_0x4dd672[_0x931c('0x5')]),_0x44bf2e);}};exports[_0x931c('0x3d')]=function(_0x2c39da){try{if(!_[_0x931c('0x1b')](recordings[_0x2c39da['uniqueid']])){utils[_0x931c('0x18')](util['format']('[%s][recordings][queuecallerjoin]',_0x2c39da[_0x931c('0x5')]),_0x2c39da);utils[_0x931c('0x2')](util[_0x931c('0x3')](_0x931c('0x3e'),_0x2c39da['uniqueid'],_0x2c39da[_0x931c('0x3f')]));recordings[_0x2c39da[_0x931c('0x5')]][_0x931c('0x3f')]=_0x2c39da[_0x931c('0x3f')];}}catch(_0x3f9655){utils[_0x931c('0x17')](util[_0x931c('0x3')](_0x931c('0x40'),_0x2c39da[_0x931c('0x5')]),_0x3f9655);}};exports[_0x931c('0x41')]=function(_0xf33716){try{utils['debug'](util[_0x931c('0x3')](_0x931c('0x42'),_0xf33716[_0x931c('0x5')]),_0xf33716);utils[_0x931c('0x2')](util[_0x931c('0x3')](_0x931c('0x43'),_0xf33716['uniqueid'],_0xf33716[_0x931c('0x44')],_0xf33716['transferercalleridname'],_0xf33716[_0x931c('0x45')],_0xf33716['transfereecalleridname']));if(recordings[_0xf33716[_0x931c('0x46')]]&&transfers[_0x931c('0x6')][_0xf33716[_0x931c('0x46')]]){transfers[_0x931c('0x6')][_0xf33716['transfereruniqueid']][_0x931c('0x47')]=!![];}}catch(_0x403f32){utils[_0x931c('0x17')](util[_0x931c('0x3')](_0x931c('0x42'),_0xf33716[_0x931c('0x5')]),_0x403f32);}}; \ No newline at end of file +var _0xf39e=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable'];(function(_0x11f055,_0x4b38de){var _0x399df3=function(_0x5872a1){while(--_0x5872a1){_0x11f055['push'](_0x11f055['shift']());}};_0x399df3(++_0x4b38de);}(_0xf39e,0x15d));var _0xef39=function(_0x76ed62,_0xc997f8){_0x76ed62=_0x76ed62-0x0;var _0x250683=_0xf39e[_0x76ed62];return _0x250683;};'use strict';var _=require(_0xef39('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0xef39('0x1'));var recordings={};function writeDB(_0x3ce10d){var _0x5c8b2e;utils[_0xef39('0x2')](util[_0xef39('0x3')](_0xef39('0x4'),_0x3ce10d[_0xef39('0x5')]));if(transfers[_0xef39('0x6')][_0x3ce10d[_0xef39('0x5')]]){_0x5c8b2e=_0x3ce10d[_0xef39('0x5')];_0x3ce10d[_0xef39('0x5')]=transfers[_0xef39('0x6')][_0x3ce10d[_0xef39('0x5')]][_0xef39('0x7')];}if(_0x3ce10d[_0xef39('0x8')]){utils[_0xef39('0x9')](_0x3ce10d[_0xef39('0x8')])['then'](function(_0x19df96){if(_0x19df96){_0x3ce10d[_0xef39('0xa')]=_0x19df96[_0xef39('0xb')];_0x3ce10d['UserId']=_0x19df96['id'];}utils['request'](_0xef39('0xc'),_0x3ce10d);});}else{utils['request'](_0xef39('0xc'),_0x3ce10d);}if(_0x5c8b2e)delete transfers['blinds'][_0x5c8b2e];}exports[_0xef39('0xd')]=function(_0x38688e){try{utils[_0xef39('0xe')](util[_0xef39('0x3')](_0xef39('0xf'),_0x38688e['uniqueid']),_0x38688e);if(_0x38688e['uniqueid']==_0x38688e[_0xef39('0x10')]){utils[_0xef39('0x2')](util[_0xef39('0x3')](_0xef39('0x11'),_0x38688e[_0xef39('0x5')],_0x38688e[_0xef39('0x12')],_0x38688e[_0xef39('0x13')]));recordings[_0x38688e['uniqueid']]={'uniqueid':_0x38688e[_0xef39('0x5')],'accountcode':_0x38688e[_0xef39('0x8')],'exten':_0x38688e[_0xef39('0x13')],'context':_0x38688e[_0xef39('0x12')],'channel':_0x38688e[_0xef39('0x14')],'monitors':[]};}}catch(_0x213389){utils[_0xef39('0x15')](util['format']('[%s][recordings][newchannel]',_0x38688e[_0xef39('0x5')]),_0x213389);}};exports[_0xef39('0x16')]=function(_0x3b6dde){try{utils[_0xef39('0xe')](util[_0xef39('0x3')](_0xef39('0x17'),_0x3b6dde['uniqueid']),_0x3b6dde);if(!_[_0xef39('0x18')](recordings[_0x3b6dde[_0xef39('0x5')]])&&_0x3b6dde[_0xef39('0x19')]==0x6){utils[_0xef39('0x2')](util[_0xef39('0x3')](_0xef39('0x1a'),_0x3b6dde[_0xef39('0x5')],_0x3b6dde[_0xef39('0x12')],_0x3b6dde[_0xef39('0x14')]));}else if(!_[_0xef39('0x18')](recordings[_0x3b6dde[_0xef39('0x10')]])&&_0x3b6dde['channelstate']==0x6&&_0x3b6dde[_0xef39('0x12')]!=_0xef39('0x1b')){utils[_0xef39('0x2')](util[_0xef39('0x3')](_0xef39('0x1c'),_0x3b6dde[_0xef39('0x5')],_0x3b6dde[_0xef39('0x10')],_0x3b6dde[_0xef39('0x12')],_0x3b6dde[_0xef39('0x14')]));recordings[_0x3b6dde['linkedid']]['accountcode']=_0x3b6dde[_0xef39('0x8')];}}catch(_0x5bf1ca){utils[_0xef39('0x15')](util[_0xef39('0x3')](_0xef39('0x17'),_0x3b6dde[_0xef39('0x5')]),_0x5bf1ca);}};exports[_0xef39('0x1d')]=function(_0x14c12d){try{if(!_[_0xef39('0x18')](_0x14c12d[_0xef39('0x1e')])&&!_[_0xef39('0x18')](_0x14c12d[_0xef39('0x1e')]['mixmonitor_filename'])){utils[_0xef39('0xe')](util[_0xef39('0x3')]('[%s][recordings][varset]',_0x14c12d[_0xef39('0x5')]),_0x14c12d);utils['info'](util[_0xef39('0x3')](_0xef39('0x1f'),_0x14c12d[_0xef39('0x5')],_0x14c12d[_0xef39('0x1e')],_0x14c12d[_0xef39('0x20')]));if(_['endsWith'](_0x14c12d['value'],_0xef39('0x21'))){_0x14c12d[_0xef39('0x20')]=_0x14c12d[_0xef39('0x20')][_0xef39('0x22')]('.wav49',_0xef39('0x23'));}if(recordings[_0x14c12d['linkedid']]){var _0x148541=_[_0xef39('0x24')](recordings[_0x14c12d[_0xef39('0x10')]][_0xef39('0x25')],{'value':_0x14c12d[_0xef39('0x20')]});if(_[_0xef39('0x18')](_0x148541)){recordings[_0x14c12d[_0xef39('0x10')]][_0xef39('0x25')][_0xef39('0x26')]({'value':_0x14c12d[_0xef39('0x20')]});}}}}catch(_0x41fcf5){utils['error'](util[_0xef39('0x3')](_0xef39('0x27'),_0x14c12d[_0xef39('0x5')]),_0x41fcf5);}};exports[_0xef39('0x28')]=function(_0x5e985a){try{if(!_['isNil'](recordings[_0x5e985a[_0xef39('0x5')]])){utils[_0xef39('0xe')](util[_0xef39('0x3')]('[%s][recordings][hangup]',_0x5e985a[_0xef39('0x5')]),_0x5e985a);utils[_0xef39('0x2')](util[_0xef39('0x3')](_0xef39('0x29'),_0x5e985a[_0xef39('0x5')],_0x5e985a['calleridnum'],_0x5e985a[_0xef39('0x2a')],_0x5e985a[_0xef39('0x2b')]));recordings[_0x5e985a[_0xef39('0x5')]][_0xef39('0x2c')]=_0x5e985a[_0xef39('0x2c')];recordings[_0x5e985a[_0xef39('0x5')]][_0xef39('0x2a')]=_0x5e985a['calleridname'];recordings[_0x5e985a[_0xef39('0x5')]]['connectedlinenum']=_0x5e985a[_0xef39('0x2d')];recordings[_0x5e985a['uniqueid']][_0xef39('0x2e')]=_0x5e985a[_0xef39('0x2e')];if(recordings[_0x5e985a[_0xef39('0x5')]][_0xef39('0x2f')]==_0xef39('0x30')&&recordings[_0x5e985a[_0xef39('0x5')]][_0xef39('0x8')]){recordings[_0x5e985a[_0xef39('0x5')]][_0xef39('0x2d')]=recordings[_0x5e985a[_0xef39('0x5')]][_0xef39('0x8')];recordings[_0x5e985a['uniqueid']][_0xef39('0x2e')]='';}recordings[_0x5e985a[_0xef39('0x5')]][_0xef39('0x25')][_0xef39('0x31')](function(_0x4bbd38){var _0xe904eb=_[_0xef39('0x32')](recordings[_0x5e985a[_0xef39('0x5')]]);_0xe904eb['value']=_0x4bbd38[_0xef39('0x20')];writeDB(_0xe904eb);});delete recordings[_0x5e985a[_0xef39('0x5')]];}}catch(_0x130309){utils[_0xef39('0x15')](util[_0xef39('0x3')](_0xef39('0x33'),_0x5e985a[_0xef39('0x5')]),_0x130309);}};exports[_0xef39('0x34')]=function(_0x4dc216){try{if(!_['isNil'](recordings[_0x4dc216[_0xef39('0x5')]])){utils[_0xef39('0xe')](util[_0xef39('0x3')]('[%s][recordings][newexten]',_0x4dc216[_0xef39('0x5')]),_0x4dc216);utils[_0xef39('0x2')](util[_0xef39('0x3')](_0xef39('0x35'),_0x4dc216[_0xef39('0x5')],_0x4dc216['application'],_0x4dc216[_0xef39('0x36')]));if(_0x4dc216[_0xef39('0x37')][_0xef39('0x38')]()==_0xef39('0x39')&&_[_0xef39('0x3a')](_0x4dc216[_0xef39('0x36')]['toLowerCase'](),_0xef39('0x3b'))){var _0x7f09d3=_0x4dc216[_0xef39('0x36')]['split']('=');var _0x33767e=_0x7f09d3[0x0][_0xef39('0x3c')](_0x7f09d3[0x0][_0xef39('0x3d')]('(')+0x1,_0x7f09d3[0x0][_0xef39('0x3d')](')'));var _0xc6f38e=_0x7f09d3[0x1];recordings[_0x4dc216[_0xef39('0x5')]][_0x33767e]=_0xc6f38e;}}}catch(_0x378e3c){utils[_0xef39('0x15')](util[_0xef39('0x3')](_0xef39('0x3e'),_0x4dc216[_0xef39('0x5')]),_0x378e3c);}};exports[_0xef39('0x3f')]=function(_0x433bb4){try{if(!_[_0xef39('0x18')](recordings[_0x433bb4[_0xef39('0x5')]])){utils['debug'](util[_0xef39('0x3')](_0xef39('0x40'),_0x433bb4[_0xef39('0x5')]),_0x433bb4);utils['info'](util[_0xef39('0x3')](_0xef39('0x41'),_0x433bb4['uniqueid'],_0x433bb4[_0xef39('0x42')]));recordings[_0x433bb4[_0xef39('0x5')]][_0xef39('0x42')]=_0x433bb4[_0xef39('0x42')];}}catch(_0x5dcf86){utils[_0xef39('0x15')](util[_0xef39('0x3')](_0xef39('0x40'),_0x433bb4['uniqueid']),_0x5dcf86);}};exports[_0xef39('0x43')]=function(_0x18f1f4){try{utils[_0xef39('0xe')](util[_0xef39('0x3')](_0xef39('0x44'),_0x18f1f4[_0xef39('0x5')]),_0x18f1f4);utils[_0xef39('0x2')](util[_0xef39('0x3')](_0xef39('0x45'),_0x18f1f4[_0xef39('0x5')],_0x18f1f4[_0xef39('0x46')],_0x18f1f4[_0xef39('0x47')],_0x18f1f4[_0xef39('0x48')],_0x18f1f4[_0xef39('0x49')]));if(recordings[_0x18f1f4[_0xef39('0x4a')]]&&transfers[_0xef39('0x6')][_0x18f1f4[_0xef39('0x4a')]]){transfers['blinds'][_0x18f1f4[_0xef39('0x4a')]][_0xef39('0x4b')]=!![];}}catch(_0x5a2d11){utils[_0xef39('0x15')](util[_0xef39('0x3')]('[%s][recordings][blindtransfer]',_0x18f1f4[_0xef39('0x5')]),_0x5a2d11);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7e8877e..0c7a988 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 _0xf345=['origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','blinds','blindtransfer','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','error','debug','[%s][transfers][attendedtransfer]'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xf345,0x8c));var _0x5f34=function(_0x1fa325,_0x56fafe){_0x1fa325=_0x1fa325-0x0;var _0x3f47cf=_0xf345[_0x1fa325];return _0x3f47cf;};'use strict';var _=require('lodash');var util=require(_0x5f34('0x0'));var utils=require(_0x5f34('0x1'));function writeDB(_0x8419de){utils[_0x5f34('0x2')](util[_0x5f34('0x3')](_0x5f34('0x4'),_0x8419de['type']===_0x5f34('0x5')?_0x8419de[_0x5f34('0x6')]:_0x8419de[_0x5f34('0x7')],_0x8419de[_0x5f34('0x8')]));utils[_0x5f34('0x9')]('CreateVoiceTransferReport',_0x8419de);}exports[_0x5f34('0xa')]={};exports[_0x5f34('0xb')]=function(_0x36c9a7){try{utils['debug'](util[_0x5f34('0x3')](_0x5f34('0xc'),_0x36c9a7[_0x5f34('0x7')]),_0x36c9a7);utils[_0x5f34('0x2')](util[_0x5f34('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x36c9a7[_0x5f34('0x7')],_0x36c9a7[_0x5f34('0xd')],_0x36c9a7[_0x5f34('0xe')],_0x36c9a7['transfereecalleridnum'],_0x36c9a7[_0x5f34('0xf')]));_0x36c9a7['type']='blind';exports[_0x5f34('0xa')][_0x36c9a7[_0x5f34('0x10')]]=_0x36c9a7;writeDB(_0x36c9a7);}catch(_0x2c33a5){utils[_0x5f34('0x11')](util['format'](_0x5f34('0xc'),_0x36c9a7[_0x5f34('0x7')]),_0x2c33a5);}};exports['attendedtransfer']=function(_0x5bf70f){try{utils[_0x5f34('0x12')](util[_0x5f34('0x3')](_0x5f34('0x13'),_0x5bf70f[_0x5f34('0x6')]),_0x5bf70f);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5bf70f[_0x5f34('0x6')],_0x5bf70f[_0x5f34('0x14')],_0x5bf70f[_0x5f34('0x15')],_0x5bf70f[_0x5f34('0x16')],_0x5bf70f[_0x5f34('0x17')]));_0x5bf70f=_[_0x5f34('0x18')](_0x5bf70f,{'transfererchannel':_0x5bf70f[_0x5f34('0x19')],'transferercalleridnum':_0x5bf70f[_0x5f34('0x14')],'transferercalleridname':_0x5bf70f['origtransferercalleridname'],'transfererconnectedlinenum':_0x5bf70f[_0x5f34('0x1a')],'transfererconnectedlinename':_0x5bf70f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5bf70f[_0x5f34('0x1b')],'transferercontext':_0x5bf70f[_0x5f34('0x1c')],'transfererexten':_0x5bf70f[_0x5f34('0x1d')],'transfererlinkedid':_0x5bf70f[_0x5f34('0x1e')],'context':_0x5bf70f[_0x5f34('0x1f')],'extension':_0x5bf70f[_0x5f34('0x20')],'type':_0x5f34('0x5')});if(_[_0x5f34('0x21')](_0x5bf70f['transfereechannel'])){_0x5bf70f=_[_0x5f34('0x18')](_0x5bf70f,{'transfereechannel':_0x5bf70f[_0x5f34('0x22')],'transfereecalleridnum':_0x5bf70f[_0x5f34('0x16')],'transfereecalleridname':_0x5bf70f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5bf70f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5bf70f[_0x5f34('0x23')],'transfereeaccountcode':_0x5bf70f[_0x5f34('0x24')],'transfereecontext':_0x5bf70f[_0x5f34('0x25')],'transfereeexten':_0x5bf70f[_0x5f34('0x26')],'transfereelinkedid':_0x5bf70f[_0x5f34('0x27')]});}writeDB(_0x5bf70f);}catch(_0x294970){utils[_0x5f34('0x11')](util[_0x5f34('0x3')]('[%s][transfers][attendedtransfer]',_0x5bf70f[_0x5f34('0x6')]),_0x294970);}}; \ No newline at end of file +var _0x39e9=['blindtransfer','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','request','CreateVoiceTransferReport','blinds'];(function(_0x37fb92,_0x1ff554){var _0x1e40da=function(_0x43fa50){while(--_0x43fa50){_0x37fb92['push'](_0x37fb92['shift']());}};_0x1e40da(++_0x1ff554);}(_0x39e9,0xff));var _0x939e=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x39e9[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x939e('0x0'));var util=require('util');var utils=require(_0x939e('0x1'));function writeDB(_0x419f25){utils[_0x939e('0x2')](util['format'](_0x939e('0x3'),_0x419f25['type']===_0x939e('0x4')?_0x419f25['origtransfereruniqueid']:_0x419f25[_0x939e('0x5')],_0x419f25['type']));utils[_0x939e('0x6')](_0x939e('0x7'),_0x419f25);}exports[_0x939e('0x8')]={};exports[_0x939e('0x9')]=function(_0x36a86c){try{utils['debug'](util[_0x939e('0xa')](_0x939e('0xb'),_0x36a86c[_0x939e('0x5')]),_0x36a86c);utils['info'](util[_0x939e('0xa')](_0x939e('0xc'),_0x36a86c['uniqueid'],_0x36a86c['transferercalleridnum'],_0x36a86c[_0x939e('0xd')],_0x36a86c[_0x939e('0xe')],_0x36a86c[_0x939e('0xf')]));_0x36a86c[_0x939e('0x10')]=_0x939e('0x11');exports[_0x939e('0x8')][_0x36a86c['transfereruniqueid']]=_0x36a86c;writeDB(_0x36a86c);}catch(_0x3862f5){utils['error'](util[_0x939e('0xa')]('[%s][transfers][blindtransfer]',_0x36a86c['uniqueid']),_0x3862f5);}};exports[_0x939e('0x12')]=function(_0x5c7dbf){try{utils['debug'](util['format'](_0x939e('0x13'),_0x5c7dbf['origtransfereruniqueid']),_0x5c7dbf);utils[_0x939e('0x2')](util['format'](_0x939e('0x14'),_0x5c7dbf[_0x939e('0x15')],_0x5c7dbf[_0x939e('0x16')],_0x5c7dbf[_0x939e('0x17')],_0x5c7dbf[_0x939e('0x18')],_0x5c7dbf[_0x939e('0x19')]));_0x5c7dbf=_['assign'](_0x5c7dbf,{'transfererchannel':_0x5c7dbf['origtransfererchannel'],'transferercalleridnum':_0x5c7dbf[_0x939e('0x16')],'transferercalleridname':_0x5c7dbf['origtransferercalleridname'],'transfererconnectedlinenum':_0x5c7dbf[_0x939e('0x1a')],'transfererconnectedlinename':_0x5c7dbf[_0x939e('0x1b')],'transfereraccountcode':_0x5c7dbf[_0x939e('0x1c')],'transferercontext':_0x5c7dbf[_0x939e('0x1d')],'transfererexten':_0x5c7dbf[_0x939e('0x1e')],'transfererlinkedid':_0x5c7dbf['origtransfererlinkedid'],'context':_0x5c7dbf[_0x939e('0x1f')],'extension':_0x5c7dbf[_0x939e('0x20')],'type':_0x939e('0x4')});if(_[_0x939e('0x21')](_0x5c7dbf[_0x939e('0x22')])){_0x5c7dbf=_[_0x939e('0x23')](_0x5c7dbf,{'transfereechannel':_0x5c7dbf[_0x939e('0x24')],'transfereecalleridnum':_0x5c7dbf[_0x939e('0x18')],'transfereecalleridname':_0x5c7dbf['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5c7dbf[_0x939e('0x25')],'transfereeconnectedlinename':_0x5c7dbf[_0x939e('0x26')],'transfereeaccountcode':_0x5c7dbf[_0x939e('0x27')],'transfereecontext':_0x5c7dbf[_0x939e('0x28')],'transfereeexten':_0x5c7dbf[_0x939e('0x29')],'transfereelinkedid':_0x5c7dbf[_0x939e('0x2a')]});}writeDB(_0x5c7dbf);}catch(_0x97b837){utils[_0x939e('0x2b')](util['format'](_0x939e('0x13'),_0x5c7dbf[_0x939e('0x15')]),_0x97b837);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5af0047..7acd2aa 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 _0x4b8f=['add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','now','format','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','name','interface','then','[utils][getUser]\x20where:%s','stringify','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','addTime'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x4b8f,0x66));var _0xf4b8=function(_0x14bc06,_0x2a1b0e){_0x14bc06=_0x14bc06-0x0;var _0xf0312f=_0x4b8f[_0x14bc06];return _0xf0312f;};'use strict';var BPromise=require(_0xf4b8('0x0'));var jayson=require(_0xf4b8('0x1'));var moment=require(_0xf4b8('0x2'));var util=require(_0xf4b8('0x3'));var client=jayson[_0xf4b8('0x4')][_0xf4b8('0x5')]({'port':0x2329});var logger=require(_0xf4b8('0x6'))(_0xf4b8('0x7'));exports[_0xf4b8('0x8')]=function(_0x9b0572,_0x45623e){logger[_0xf4b8('0x8')](_0x9b0572,_0x45623e?util[_0xf4b8('0x9')](_0x45623e,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x458f42,_0x244958){logger[_0xf4b8('0xa')](_0x458f42,_0x244958?util['inspect'](_0x244958,{'showHidden':![],'depth':null}):'');};exports[_0xf4b8('0xb')]=function(_0x48cc8e,_0x152122){logger['error'](_0x48cc8e,_0x152122?util[_0xf4b8('0x9')](_0x152122,{'showHidden':![],'depth':null}):'');};exports[_0xf4b8('0xc')]=function(_0x4f85d6,_0x1aa0ae){return client[_0xf4b8('0xc')](_0x4f85d6,{'body':_0x1aa0ae})['then'](function(_0x3e5ae4){logger[_0xf4b8('0xa')](_0xf4b8('0xd'),_0x4f85d6,_0x3e5ae4?util[_0xf4b8('0x9')](_0x3e5ae4,{'showHidden':![],'depth':null}):'');})[_0xf4b8('0xe')](function(_0x5394e2){logger['error'](_0xf4b8('0xd'),_0x4f85d6,_0x5394e2?util[_0xf4b8('0x9')](_0x5394e2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x181029){return client['request'](_0xf4b8('0xf'),{'options':{'raw':!![],'attributes':['id','internal',_0xf4b8('0x10'),_0xf4b8('0x11')],'where':_0x181029,'limit':0x1}})[_0xf4b8('0x12')](function(_0x117db4){logger[_0xf4b8('0xa')](_0xf4b8('0x13'),JSON[_0xf4b8('0x14')](_0x181029),_0x117db4?util[_0xf4b8('0x9')](_0x117db4,{'showHidden':![],'depth':null}):'');return _0x117db4['result'][_0xf4b8('0x15')]?_0x117db4['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x49ef2f){return new BPromise(function(_0x3e3c98,_0xf44455){if(_0x49ef2f){return getUser({'internal':_0x49ef2f})[_0xf4b8('0x12')](function(_0x64a3d0){logger['info'](_0xf4b8('0x16'),_0x49ef2f,_0x64a3d0?_0xf4b8('0x17'):_0xf4b8('0x18'));return _0x3e3c98(_0x64a3d0);})['catch'](function(_0x5a13b1){logger[_0xf4b8('0xb')](_0xf4b8('0x19'),_0x5a13b1?util['inspect'](_0x5a13b1,{'showHidden':![],'depth':null}):'');return _0x3e3c98(null);});}return _0x3e3c98(null);});};exports[_0xf4b8('0x1a')]=function(_0x2a43c7){return new BPromise(function(_0x1d9d28,_0xb5304f){if(_0x2a43c7){return getUser({'interface':_0x2a43c7})[_0xf4b8('0x12')](function(_0x3ad985){logger['info'](_0xf4b8('0x1b'),_0x2a43c7,_0x3ad985?'found':'notfound');return _0x1d9d28(_0x3ad985);})['catch'](function(_0x3b1572){logger[_0xf4b8('0xb')](_0xf4b8('0x1c'),_0x3b1572?util[_0xf4b8('0x9')](_0x3b1572,{'showHidden':![],'depth':null}):'');return _0x1d9d28(null);});}return _0x1d9d28(null);});};exports[_0xf4b8('0x1d')]=function(_0x5c5eb3){return new BPromise(function(_0x5828b0,_0x89429d){if(_0x5c5eb3){return getUser({'name':_0x5c5eb3})[_0xf4b8('0x12')](function(_0x5cbfdf){logger[_0xf4b8('0x8')](_0xf4b8('0x1e'),_0x5c5eb3,_0x5cbfdf?_0xf4b8('0x17'):_0xf4b8('0x18'));return _0x5828b0(_0x5cbfdf);})[_0xf4b8('0xe')](function(_0x5279a5){logger[_0xf4b8('0xb')]('[utils][getUserByName]',_0x5279a5?util[_0xf4b8('0x9')](_0x5279a5,{'showHidden':![],'depth':null}):'');return _0x5828b0(null);});}return _0x5828b0(null);});};exports[_0xf4b8('0x1f')]=function(_0x5826ac){return new BPromise(function(_0x5dd159,_0x5633ae){if(_0x5826ac){return client[_0xf4b8('0xc')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name','type','acw','acwTimeout'],'where':{'name':_0x5826ac},'limit':0x1}})[_0xf4b8('0x12')](function(_0x251036){logger[_0xf4b8('0xa')](_0xf4b8('0x20'),_0x5826ac,_0x251036?util[_0xf4b8('0x9')](_0x251036,{'showHidden':![],'depth':null}):'');logger[_0xf4b8('0x8')](_0xf4b8('0x21'),_0x5826ac,_0x251036?_0xf4b8('0x17'):_0xf4b8('0x18'));return _0x5dd159(_0x251036[_0xf4b8('0x22')][_0xf4b8('0x15')]?_0x251036[_0xf4b8('0x22')][0x0]:null);})[_0xf4b8('0xe')](function(_0x203e53){logger[_0xf4b8('0xb')]('[utils][getVoiceQueueByName]',_0x203e53?util['inspect'](_0x203e53,{'showHidden':![],'depth':null}):'');return _0x5dd159(null);});}return _0x5dd159(null);});};exports[_0xf4b8('0x23')]=function(_0x502b8a,_0x1859c9){return moment(_0x502b8a)[_0xf4b8('0x24')](_0x1859c9,_0xf4b8('0x25'))['format'](_0xf4b8('0x26'));};exports['subtractTime']=function(_0x2604b4,_0x488306){return moment(_0x2604b4)[_0xf4b8('0x27')](_0x488306,_0xf4b8('0x25'))['format'](_0xf4b8('0x26'));};exports[_0xf4b8('0x28')]=function(_0x3465f4,_0x1dc047){return moment(_0x3465f4)[_0xf4b8('0x29')](moment(_0x1dc047),_0xf4b8('0x25'));};exports['sumTime']=function(_0x301f58,_0x3b6dc0){return parseInt(_0x301f58,0xa)+parseInt(_0x3b6dc0,0xa);};exports[_0xf4b8('0x2a')]=function(){return moment()[_0xf4b8('0x2b')](_0xf4b8('0x26'));};exports['isAfter']=function(_0x2d18c6,_0x2a91af){if(_0x2a91af){return moment(_0x2d18c6)[_0xf4b8('0x2c')](_0x2a91af);}return!![];};exports[_0xf4b8('0x2d')]=function(_0x5b195d,_0xa8c3ea){if(_0xa8c3ea){return moment(_0x5b195d)[_0xf4b8('0x2d')](_0xa8c3ea);}else if(_0x5b195d){return!![];}return![];}; \ No newline at end of file +var _0xac39=['client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','subtractTime','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0xac39,0x11c));var _0x9ac3=function(_0x4f01f1,_0x41e8f2){_0x4f01f1=_0x4f01f1-0x0;var _0x262c27=_0xac39[_0x4f01f1];return _0x262c27;};'use strict';var BPromise=require(_0x9ac3('0x0'));var jayson=require(_0x9ac3('0x1'));var moment=require(_0x9ac3('0x2'));var util=require(_0x9ac3('0x3'));var client=jayson[_0x9ac3('0x4')][_0x9ac3('0x5')]({'port':0x2329});var logger=require(_0x9ac3('0x6'))(_0x9ac3('0x7'));exports[_0x9ac3('0x8')]=function(_0x4711ea,_0x3066a0){logger[_0x9ac3('0x8')](_0x4711ea,_0x3066a0?util[_0x9ac3('0x9')](_0x3066a0,{'showHidden':![],'depth':null}):'');};exports[_0x9ac3('0xa')]=function(_0x32f7c8,_0x4f5ced){logger[_0x9ac3('0xa')](_0x32f7c8,_0x4f5ced?util[_0x9ac3('0x9')](_0x4f5ced,{'showHidden':![],'depth':null}):'');};exports[_0x9ac3('0xb')]=function(_0x323964,_0x541b78){logger['error'](_0x323964,_0x541b78?util['inspect'](_0x541b78,{'showHidden':![],'depth':null}):'');};exports[_0x9ac3('0xc')]=function(_0x75a3d1,_0x565546){return client['request'](_0x75a3d1,{'body':_0x565546})[_0x9ac3('0xd')](function(_0x2c1301){logger[_0x9ac3('0xa')]('[utils][request]\x20name:%s',_0x75a3d1,_0x2c1301?util[_0x9ac3('0x9')](_0x2c1301,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2a1f6d){logger[_0x9ac3('0xb')]('[utils][request]\x20name:%s',_0x75a3d1,_0x2a1f6d?util[_0x9ac3('0x9')](_0x2a1f6d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4640fc){return client[_0x9ac3('0xc')](_0x9ac3('0xe'),{'options':{'raw':!![],'attributes':['id',_0x9ac3('0xf'),_0x9ac3('0x10'),'interface'],'where':_0x4640fc,'limit':0x1}})['then'](function(_0xde4394){logger['debug'](_0x9ac3('0x11'),JSON[_0x9ac3('0x12')](_0x4640fc),_0xde4394?util['inspect'](_0xde4394,{'showHidden':![],'depth':null}):'');return _0xde4394['result'][_0x9ac3('0x13')]?_0xde4394[_0x9ac3('0x14')][0x0]:null;});}exports[_0x9ac3('0x15')]=function(_0x2681cf){return new BPromise(function(_0x3a0061,_0x2d7693){if(_0x2681cf){return getUser({'internal':_0x2681cf})[_0x9ac3('0xd')](function(_0x3ba2b0){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2681cf,_0x3ba2b0?_0x9ac3('0x16'):_0x9ac3('0x17'));return _0x3a0061(_0x3ba2b0);})['catch'](function(_0x2ed785){logger[_0x9ac3('0xb')](_0x9ac3('0x18'),_0x2ed785?util[_0x9ac3('0x9')](_0x2ed785,{'showHidden':![],'depth':null}):'');return _0x3a0061(null);});}return _0x3a0061(null);});};exports['getUserByInterface']=function(_0x595f5d){return new BPromise(function(_0x3a4865,_0xe09195){if(_0x595f5d){return getUser({'interface':_0x595f5d})[_0x9ac3('0xd')](function(_0x264da1){logger[_0x9ac3('0x8')](_0x9ac3('0x19'),_0x595f5d,_0x264da1?'found':_0x9ac3('0x17'));return _0x3a4865(_0x264da1);})[_0x9ac3('0x1a')](function(_0x98efc){logger[_0x9ac3('0xb')](_0x9ac3('0x1b'),_0x98efc?util[_0x9ac3('0x9')](_0x98efc,{'showHidden':![],'depth':null}):'');return _0x3a4865(null);});}return _0x3a4865(null);});};exports['getUserByName']=function(_0x20d44c){return new BPromise(function(_0x3f3621,_0x31f9b6){if(_0x20d44c){return getUser({'name':_0x20d44c})[_0x9ac3('0xd')](function(_0x389b46){logger['info'](_0x9ac3('0x1c'),_0x20d44c,_0x389b46?_0x9ac3('0x16'):'notfound');return _0x3f3621(_0x389b46);})['catch'](function(_0x18a840){logger[_0x9ac3('0xb')](_0x9ac3('0x1d'),_0x18a840?util[_0x9ac3('0x9')](_0x18a840,{'showHidden':![],'depth':null}):'');return _0x3f3621(null);});}return _0x3f3621(null);});};exports[_0x9ac3('0x1e')]=function(_0x3c87bb){return new BPromise(function(_0x11175e,_0x4ca76c){if(_0x3c87bb){return client['request'](_0x9ac3('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x9ac3('0x10'),_0x9ac3('0x20'),_0x9ac3('0x21'),_0x9ac3('0x22')],'where':{'name':_0x3c87bb},'limit':0x1}})[_0x9ac3('0xd')](function(_0x536540){logger[_0x9ac3('0xa')](_0x9ac3('0x23'),_0x3c87bb,_0x536540?util[_0x9ac3('0x9')](_0x536540,{'showHidden':![],'depth':null}):'');logger[_0x9ac3('0x8')](_0x9ac3('0x24'),_0x3c87bb,_0x536540?'found':'notfound');return _0x11175e(_0x536540[_0x9ac3('0x14')][_0x9ac3('0x13')]?_0x536540[_0x9ac3('0x14')][0x0]:null);})[_0x9ac3('0x1a')](function(_0x4229ca){logger[_0x9ac3('0xb')](_0x9ac3('0x25'),_0x4229ca?util[_0x9ac3('0x9')](_0x4229ca,{'showHidden':![],'depth':null}):'');return _0x11175e(null);});}return _0x11175e(null);});};exports[_0x9ac3('0x26')]=function(_0x30bbed,_0x49d6bc){return moment(_0x30bbed)[_0x9ac3('0x27')](_0x49d6bc,'seconds')[_0x9ac3('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x9ac3('0x29')]=function(_0x3a821d,_0x6458c){return moment(_0x3a821d)['subtract'](_0x6458c,_0x9ac3('0x2a'))[_0x9ac3('0x28')](_0x9ac3('0x2b'));};exports[_0x9ac3('0x2c')]=function(_0x2e24c0,_0x20f32d){return moment(_0x2e24c0)['diff'](moment(_0x20f32d),_0x9ac3('0x2a'));};exports['sumTime']=function(_0x64e3be,_0x415971){return parseInt(_0x64e3be,0xa)+parseInt(_0x415971,0xa);};exports[_0x9ac3('0x2d')]=function(){return moment()[_0x9ac3('0x28')](_0x9ac3('0x2b'));};exports[_0x9ac3('0x2e')]=function(_0x12efd6,_0x3a3edf){if(_0x3a3edf){return moment(_0x12efd6)[_0x9ac3('0x2e')](_0x3a3edf);}return!![];};exports[_0x9ac3('0x2f')]=function(_0x321e9f,_0x3b372b){if(_0x3b372b){return moment(_0x321e9f)[_0x9ac3('0x2f')](_0x3b372b);}else if(_0x321e9f){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 fe002cc..050b6ee 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 _0xe77d=['logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','remoteAddress','statusCode','responseTime','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','agent_id','agent_name','test','url','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','name','ensureDir','then','catch','user','no-user','error','api','auth','set','client-side-logger','use'];(function(_0x346985,_0x47a1d1){var _0xce7940=function(_0x46c6b5){while(--_0x46c6b5){_0x346985['push'](_0x346985['shift']());}};_0xce7940(++_0x47a1d1);}(_0xe77d,0x125));var _0xde77=function(_0xf670f0,_0x353747){_0xf670f0=_0xf670f0-0x0;var _0x3c21c6=_0xe77d[_0xf670f0];return _0x3c21c6;};var fs=require(_0xde77('0x0'));var _=require(_0xde77('0x1'));var ewinston=require(_0xde77('0x2'));var path=require(_0xde77('0x3'));var util=require(_0xde77('0x4'));var fileLogger=require(_0xde77('0x5'))[_0xde77('0x6')];var safeTemplate=require(_0xde77('0x7'))[_0xde77('0x8')];var maskSensitiveData=require(_0xde77('0x9'))[_0xde77('0xa')];function ClientSideLogger(){function _0x51c78c(_0x1cb28f){var _0x540be3=path['join'](_0xde77('0xb'),_0xde77('0xc'),_0xde77('0xd'));var _0x333303=path[_0xde77('0xe')](_0xde77('0xf'),_0x1cb28f[_0xde77('0x10')]+'-'+_0x1cb28f[_0xde77('0x11')]);return fs[_0xde77('0x12')](path['join'](_0x540be3,_0x333303))[_0xde77('0x13')](function(){var _0x506b82=fileLogger('client',path['join'](_0x540be3,_0x333303));return _0x506b82;})[_0xde77('0x14')](function(_0x306835){throw _0x306835;});}this[_0xde77('0xc')]=function(_0x36d46b,_0x561cb1,_0x418f11,_0x1d829b){return _0x51c78c(_0x36d46b[_0xde77('0x15')])['then'](function(_0x496400){var _0x42b0fe=_0x496400[_0x561cb1];return _0x42b0fe;})[_0xde77('0x13')](function(_0x92423a){var _0x412c6d=_0x36d46b[_0xde77('0x15')]?_0x36d46b[_0xde77('0x15')]['id']:_0xde77('0x16');var _0x38d550=_0x1d829b['data'];var _0x27996e=_0x1d829b['timestamp'];var _0x99d008=new Date(Number(_0x27996e));return _0x92423a(_0x412c6d,_0x99d008,_0x418f11,_0x38d550);})[_0xde77('0x14')](function(_0xfedfed){fileLogger(_0xde77('0xf'))[_0xde77('0x17')](_0xfedfed);});};}function setupLoggers(_0x3dd616){return new Promise(function(_0x5b1624){var _0x3c3d4c=new ClientSideLogger();var _0x3f6821=fileLogger(_0xde77('0x18'));var _0x54452e=fileLogger(_0xde77('0x19'));_0x3dd616[_0xde77('0x1a')](_0xde77('0x1b'),_0x3c3d4c);_0x3dd616[_0xde77('0x1c')](ewinston[_0xde77('0x1d')]({'winstonInstance':_0x3f6821,'meta':![],'statusLevels':!![],'msg':function(_0x4b6b5e,_0x511cde){var _0x53d572=_0xde77('0x1e');if(!_[_0xde77('0x1f')](_0x4b6b5e[_0xde77('0x20')])){_0x53d572+='\x20body=%s';var _0x1c52a6=_0x4b6b5e['body'];maskSensitiveData(_0x1c52a6);}return safeTemplate(util[_0xde77('0x21')](_0x53d572,_0x4b6b5e['method'],_0x4b6b5e[_0xde77('0x22')][_0xde77('0x23')]?_0x4b6b5e[_0xde77('0x22')]['x-forwarded-for']:_0x4b6b5e['connection'][_0xde77('0x24')]||_0x4b6b5e['ip'],_0x4b6b5e['url'],_0x511cde[_0xde77('0x25')],_0x511cde[_0xde77('0x26')],_0x4b6b5e[_0xde77('0x15')]?_0x4b6b5e['user']['id']:null,_0x4b6b5e[_0xde77('0x15')]?_0x4b6b5e[_0xde77('0x15')][_0xde77('0x11')]:null,_0x4b6b5e['user']?_0x4b6b5e[_0xde77('0x15')][_0xde77('0x10')]:null,_0x1c52a6?util['inspect'](_0x1c52a6,![],null):''));}}));_0x3dd616['use'](ewinston['logger']({'winstonInstance':_0x54452e,'meta':![],'statusLevels':!![],'msg':function(_0x1874e5,_0x270776){var _0x22b722='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x1874e5['body']&&_0x1874e5[_0xde77('0x20')][_0xde77('0x27')]&&_0x1874e5[_0xde77('0x20')]['agent_id']){_0x22b722=_0xde77('0x28');}return util[_0xde77('0x21')](_0x22b722,_0x1874e5['method'],_0x1874e5['headers'][_0xde77('0x23')]?_0x1874e5['headers'][_0xde77('0x23')]:_0x1874e5[_0xde77('0x29')][_0xde77('0x24')]||_0x1874e5['ip'],_0x1874e5['url'],_0x270776['statusCode'],_0x270776[_0xde77('0x26')],_0x1874e5['user']?_0x1874e5[_0xde77('0x15')]['id']:null,_0x1874e5['user']?_0x1874e5[_0xde77('0x15')][_0xde77('0x11')]:null,_0x1874e5[_0xde77('0x15')]?_0x1874e5[_0xde77('0x15')][_0xde77('0x10')]:null,_0x1874e5[_0xde77('0x20')]&&_0x1874e5[_0xde77('0x20')][_0xde77('0x27')]?_0x1874e5[_0xde77('0x20')]['device']:'other',_0x1874e5[_0xde77('0x20')]&&_0x1874e5[_0xde77('0x20')]['agent_id']?_0x1874e5[_0xde77('0x20')][_0xde77('0x2a')]:'',_0x1874e5[_0xde77('0x20')]&&_0x1874e5[_0xde77('0x20')][_0xde77('0x2b')]?_0x1874e5[_0xde77('0x20')][_0xde77('0x2b')]:'');},'ignoreRoute':function(_0x122778){var _0xb9d2f8=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xb9d2f8[_0xde77('0x2c')](_0x122778[_0xde77('0x2d')]);}}));return _0x5b1624();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x40d4=['fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','role','ensureDir','then','client','catch','log','user','data','timestamp','error','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','url'];(function(_0x52f341,_0x383d4c){var _0x407066=function(_0x1d0f1d){while(--_0x1d0f1d){_0x52f341['push'](_0x52f341['shift']());}};_0x407066(++_0x383d4c);}(_0x40d4,0x8d));var _0x440d=function(_0x43df68,_0x2c34e7){_0x43df68=_0x43df68-0x0;var _0x24b428=_0x40d4[_0x43df68];return _0x24b428;};var fs=require(_0x440d('0x0'));var _=require(_0x440d('0x1'));var ewinston=require(_0x440d('0x2'));var path=require(_0x440d('0x3'));var util=require(_0x440d('0x4'));var fileLogger=require(_0x440d('0x5'))['fileLogger'];var safeTemplate=require(_0x440d('0x6'))[_0x440d('0x7')];var maskSensitiveData=require(_0x440d('0x8'))[_0x440d('0x9')];function ClientSideLogger(){function _0x3019fe(_0x2aa4c2){var _0x39b002=path[_0x440d('0xa')](_0x440d('0xb'),'log',_0x440d('0xc'));var _0x3ca090=path[_0x440d('0xa')]('client',_0x2aa4c2[_0x440d('0xd')]+'-'+_0x2aa4c2['name']);return fs[_0x440d('0xe')](path['join'](_0x39b002,_0x3ca090))[_0x440d('0xf')](function(){var _0x133d55=fileLogger(_0x440d('0x10'),path[_0x440d('0xa')](_0x39b002,_0x3ca090));return _0x133d55;})[_0x440d('0x11')](function(_0x5bd370){throw _0x5bd370;});}this[_0x440d('0x12')]=function(_0x428fe4,_0x29beed,_0x2c394c,_0x528fe0){return _0x3019fe(_0x428fe4[_0x440d('0x13')])[_0x440d('0xf')](function(_0x2fc051){var _0x4b53b0=_0x2fc051[_0x29beed];return _0x4b53b0;})['then'](function(_0x4ea083){var _0x329239=_0x428fe4[_0x440d('0x13')]?_0x428fe4[_0x440d('0x13')]['id']:'no-user';var _0x448e82=_0x528fe0[_0x440d('0x14')];var _0x215d0=_0x528fe0[_0x440d('0x15')];var _0x169c3f=new Date(Number(_0x215d0));return _0x4ea083(_0x329239,_0x169c3f,_0x2c394c,_0x448e82);})['catch'](function(_0x250e6b){fileLogger(_0x440d('0x10'))[_0x440d('0x16')](_0x250e6b);});};}function setupLoggers(_0x1514d4){return new Promise(function(_0x12d0fb){var _0x402244=new ClientSideLogger();var _0x3f8598=fileLogger(_0x440d('0x17'));var _0x9068ae=fileLogger(_0x440d('0x18'));_0x1514d4[_0x440d('0x19')]('client-side-logger',_0x402244);_0x1514d4[_0x440d('0x1a')](ewinston['logger']({'winstonInstance':_0x3f8598,'meta':![],'statusLevels':!![],'msg':function(_0x402e82,_0xf186a8){var _0x1febd9=_0x440d('0x1b');if(!_['isEmpty'](_0x402e82['body'])){_0x1febd9+=_0x440d('0x1c');var _0x5729fd=_0x402e82[_0x440d('0x1d')];maskSensitiveData(_0x5729fd);}return safeTemplate(util[_0x440d('0x1e')](_0x1febd9,_0x402e82['method'],_0x402e82[_0x440d('0x1f')][_0x440d('0x20')]?_0x402e82[_0x440d('0x1f')][_0x440d('0x20')]:_0x402e82[_0x440d('0x21')][_0x440d('0x22')]||_0x402e82['ip'],_0x402e82['url'],_0xf186a8[_0x440d('0x23')],_0xf186a8[_0x440d('0x24')],_0x402e82[_0x440d('0x13')]?_0x402e82[_0x440d('0x13')]['id']:null,_0x402e82[_0x440d('0x13')]?_0x402e82['user']['name']:null,_0x402e82[_0x440d('0x13')]?_0x402e82[_0x440d('0x13')][_0x440d('0xd')]:null,_0x5729fd?util[_0x440d('0x25')](_0x5729fd,![],null):''));}}));_0x1514d4['use'](ewinston[_0x440d('0x26')]({'winstonInstance':_0x9068ae,'meta':![],'statusLevels':!![],'msg':function(_0x5611f7,_0x2b97bb){var _0xbb6715=_0x440d('0x27');if(_0x5611f7[_0x440d('0x1d')]&&_0x5611f7['body'][_0x440d('0x28')]&&_0x5611f7['body'][_0x440d('0x29')]){_0xbb6715=_0x440d('0x2a');}return util[_0x440d('0x1e')](_0xbb6715,_0x5611f7['method'],_0x5611f7['headers'][_0x440d('0x20')]?_0x5611f7[_0x440d('0x1f')]['x-forwarded-for']:_0x5611f7[_0x440d('0x21')][_0x440d('0x22')]||_0x5611f7['ip'],_0x5611f7['url'],_0x2b97bb[_0x440d('0x23')],_0x2b97bb[_0x440d('0x24')],_0x5611f7[_0x440d('0x13')]?_0x5611f7[_0x440d('0x13')]['id']:null,_0x5611f7[_0x440d('0x13')]?_0x5611f7[_0x440d('0x13')]['name']:null,_0x5611f7[_0x440d('0x13')]?_0x5611f7[_0x440d('0x13')][_0x440d('0xd')]:null,_0x5611f7['body']&&_0x5611f7[_0x440d('0x1d')][_0x440d('0x28')]?_0x5611f7[_0x440d('0x1d')][_0x440d('0x28')]:_0x440d('0x2b'),_0x5611f7[_0x440d('0x1d')]&&_0x5611f7[_0x440d('0x1d')][_0x440d('0x29')]?_0x5611f7[_0x440d('0x1d')]['agent_id']:'',_0x5611f7['body']&&_0x5611f7[_0x440d('0x1d')][_0x440d('0x2c')]?_0x5611f7[_0x440d('0x1d')][_0x440d('0x2c')]:'');},'ignoreRoute':function(_0x35f1e4){var _0x1a0962=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a0962[_0x440d('0x2d')](_0x35f1e4[_0x440d('0x2e')]);}}));return _0x12d0fb();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index af3fa35..a793206 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x976f=['moment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','message','{{{','replace','format','}}}','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','fileLogger','path','util'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x976f,0x101));var _0xf976=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0x976f[_0x4b3d13];return _0xf64dd8;};'use strict';var path=require(_0xf976('0x0'));var util=require(_0xf976('0x1'));var moment=require(_0xf976('0x2'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0xf976('0x3')]?config[_0xf976('0x3')][_0xf976('0x4')]():_0xf976('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':_0xf976('0x6'),'error':_0xf976('0x7'),'warn':_0xf976('0x8'),'info':_0xf976('0x9'),'print':'bold\x20white','success':_0xf976('0xa'),'http':'gray','verbose':_0xf976('0xb'),'debug':_0xf976('0xc'),'silly':_0xf976('0xd')};winston[_0xf976('0xe')](XC_LOG_COLORS);function getLogFileName(_0x4233a6,_0x575f52,_0xed3d17){var _0x215ac7=_0x4233a6||_0xf976('0xf');return path[_0xf976('0x10')](_0x215ac7,util['format']('%s-%s.log',_0x575f52,_0xed3d17));}function formatter(_0x234888,_0x1ce1ce){_0x1ce1ce[_0xf976('0x11')]=_0x1ce1ce[_0xf976('0x11')]['replace'](/@@{/g,_0xf976('0x12'))[_0xf976('0x13')](/}@@/g,'}}}')[_0xf976('0x13')](/@{/g,'{{')[_0xf976('0x13')](/}@/g,'}}');return util[_0xf976('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x1ce1ce['level']['toUpperCase'](),_0x234888,_0x1ce1ce[_0xf976('0x11')]);}function fileFormat(_0x3f806b,_0x31a838){_0x31a838['message']=_0x31a838[_0xf976('0x11')]['replace'](/@@{/g,_0xf976('0x12'))[_0xf976('0x13')](/}@@/g,_0xf976('0x15'))[_0xf976('0x13')](/@{/g,'{{')[_0xf976('0x13')](/}@/g,'}}');var _0x4fcb84=_0x31a838[_0xf976('0x16')]&&Object[_0xf976('0x17')](_0x31a838[_0xf976('0x16')])[_0xf976('0x18')]?'\x0a\x09'+JSON['stringify'](_0x31a838[_0xf976('0x16')]):'';return util[_0xf976('0x14')](_0xf976('0x19'),moment()['format'](_0xf976('0x1a')),_0x31a838[_0xf976('0x1b')][_0xf976('0x1c')](),_0x3f806b,_0x31a838[_0xf976('0x11')],_0x4fcb84);}function consoleLogger(){var _0x259868=new winston[(_0xf976('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf976('0x1e'))][(_0xf976('0x1f'))]({'level':_0xf976('0x20'),'json':![],'formatter':function(_0x108652){return formatter('',_0x108652);}})]});return _0x259868;}function fileLogger(_0x306a05,_0x3a3cb0){var _0x10cc29=new winston[(_0xf976('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xf976('0x21'))]({'name':util[_0xf976('0x14')](_0xf976('0x22'),_0x306a05,'error'),'filename':getLogFileName(_0x3a3cb0,_0x306a05,_0xf976('0x23')),'level':_0xf976('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x12f5f0){return fileFormat(_0x306a05,_0x12f5f0);}}),new winston[(_0xf976('0x1e'))][(_0xf976('0x21'))]({'name':util[_0xf976('0x14')]('%s-%s',_0x306a05,debugLevel),'filename':getLogFileName(_0x3a3cb0,_0x306a05,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x187a77){return fileFormat(_0x306a05,_0x187a77);}}),new winston['transports'][(_0xf976('0x1f'))]({'level':_0xf976('0x20'),'json':![],'formatter':function(_0xb0b7cc){return fileFormat(_0x306a05,_0xb0b7cc);}})]});return _0x10cc29;}exports['consoleLogger']=consoleLogger;exports[_0xf976('0x24')]=fileLogger; \ No newline at end of file +var _0x75f0=['[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','}}}','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{'];(function(_0x371778,_0x50cdae){var _0x2d0e9f=function(_0x77e4a7){while(--_0x77e4a7){_0x371778['push'](_0x371778['shift']());}};_0x2d0e9f(++_0x50cdae);}(_0x75f0,0x1f0));var _0x075f=function(_0xd6601b,_0x19ca00){_0xd6601b=_0xd6601b-0x0;var _0x496db2=_0x75f0[_0xd6601b];return _0x496db2;};'use strict';var path=require('path');var util=require(_0x075f('0x0'));var moment=require(_0x075f('0x1'));var winston=require(_0x075f('0x2'));var config=require(_0x075f('0x3'));var debugLevel=config['debugLevel']?config[_0x075f('0x4')][_0x075f('0x5')]():_0x075f('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':_0x075f('0x7'),'error':_0x075f('0x8'),'warn':_0x075f('0x9'),'info':_0x075f('0xa'),'print':_0x075f('0xb'),'success':_0x075f('0xc'),'http':'gray','verbose':'bold\x20magenta','debug':_0x075f('0xd'),'silly':_0x075f('0xe')};winston[_0x075f('0xf')](XC_LOG_COLORS);function getLogFileName(_0x13bfcd,_0x5ad645,_0x21f50a){var _0x40c2fe=_0x13bfcd||_0x075f('0x10');return path['join'](_0x40c2fe,util[_0x075f('0x11')](_0x075f('0x12'),_0x5ad645,_0x21f50a));}function formatter(_0x2f34c5,_0xc49654){_0xc49654[_0x075f('0x13')]=_0xc49654[_0x075f('0x13')][_0x075f('0x14')](/@@{/g,_0x075f('0x15'))['replace'](/}@@/g,'}}}')[_0x075f('0x14')](/@{/g,'{{')[_0x075f('0x14')](/}@/g,'}}');return util[_0x075f('0x11')](_0x075f('0x16'),moment()['format'](_0x075f('0x17')),_0xc49654[_0x075f('0x18')]['toUpperCase'](),_0x2f34c5,_0xc49654[_0x075f('0x13')]);}function fileFormat(_0xe4302c,_0x59d94b){_0x59d94b[_0x075f('0x13')]=_0x59d94b[_0x075f('0x13')][_0x075f('0x14')](/@@{/g,_0x075f('0x15'))[_0x075f('0x14')](/}@@/g,_0x075f('0x19'))[_0x075f('0x14')](/@{/g,'{{')[_0x075f('0x14')](/}@/g,'}}');var _0x1f2636=_0x59d94b[_0x075f('0x1a')]&&Object[_0x075f('0x1b')](_0x59d94b[_0x075f('0x1a')])['length']?'\x0a\x09'+JSON['stringify'](_0x59d94b[_0x075f('0x1a')]):'';return util[_0x075f('0x11')](_0x075f('0x1c'),moment()[_0x075f('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x59d94b[_0x075f('0x18')]['toUpperCase'](),_0xe4302c,_0x59d94b[_0x075f('0x13')],_0x1f2636);}function consoleLogger(){var _0x5f3837=new winston[(_0x075f('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x075f('0x1e'))][(_0x075f('0x1f'))]({'level':_0x075f('0x20'),'json':![],'formatter':function(_0x1a62d1){return formatter('',_0x1a62d1);}})]});return _0x5f3837;}function fileLogger(_0x5c6f83,_0x42f296){var _0x5a6998=new winston[(_0x075f('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x075f('0x1e'))][(_0x075f('0x21'))]({'name':util['format'](_0x075f('0x22'),_0x5c6f83,_0x075f('0x23')),'filename':getLogFileName(_0x42f296,_0x5c6f83,_0x075f('0x23')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb073a7){return fileFormat(_0x5c6f83,_0xb073a7);}}),new winston['transports'][(_0x075f('0x21'))]({'name':util['format'](_0x075f('0x22'),_0x5c6f83,debugLevel),'filename':getLogFileName(_0x42f296,_0x5c6f83,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3410b0){return fileFormat(_0x5c6f83,_0x3410b0);}}),new winston['transports'][(_0x075f('0x1f'))]({'level':_0x075f('0x20'),'json':![],'formatter':function(_0x231e6f){return fileFormat(_0x5c6f83,_0x231e6f);}})]});return _0x5a6998;}exports[_0x075f('0x24')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index db7fd2a..7493299 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x3310af,_0x56112e){var _0x2ebd5f=function(_0x4bca24){while(--_0x4bca24){_0x3310af['push'](_0x3310af['shift']());}};_0x2ebd5f(++_0x56112e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x0b0e[_0x58e469];return _0x4c01c5;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x57ca,0x108));var _0xa57c=function(_0xd09e9e,_0x3c1130){_0xd09e9e=_0xd09e9e-0x0;var _0x284f1f=_0x57ca[_0xd09e9e];return _0x284f1f;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 978e172..869d5b4 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 _0x0598=['exports','safeTemplate','lodash','\x20}\x20}','string','replace','isPlainObject','keys'];(function(_0x5c5a98,_0x1daa58){var _0x444c84=function(_0x5ba823){while(--_0x5ba823){_0x5c5a98['push'](_0x5c5a98['shift']());}};_0x444c84(++_0x1daa58);}(_0x0598,0x92));var _0x8059=function(_0x488751,_0x1a34e9){_0x488751=_0x488751-0x0;var _0x305d05=_0x0598[_0x488751];return _0x305d05;};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 +var _0xf7b4=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}'];(function(_0x255f25,_0x38c7df){var _0x75aeb7=function(_0x4d4e9a){while(--_0x4d4e9a){_0x255f25['push'](_0x255f25['shift']());}};_0x75aeb7(++_0x38c7df);}(_0xf7b4,0x152));var _0x4f7b=function(_0x35abe4,_0x167d59){_0x35abe4=_0x35abe4-0x0;var _0x143f7d=_0xf7b4[_0x35abe4];return _0x143f7d;};var _=require(_0x4f7b('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5579ed){return _0x5579ed==='{{'?'{\x20{\x20':_0x4f7b('0x1');}function safeTemplate(_0x103165){var _0x50ea23=_0x103165;if(typeof _0x103165==='string'){_0x50ea23=_0x103165[_0x4f7b('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4f7b('0x3')](_0x103165)){_0x50ea23=_0x103165[_0x4f7b('0x4')](function(_0x44f991){return safeTemplate(_0x44f991);});}else if(_[_0x4f7b('0x5')](_0x103165)){_0x50ea23=Object[_0x4f7b('0x6')](_0x103165)[_0x4f7b('0x7')](function(_0x3ad135,_0x173784){_0x3ad135[_0x173784]=safeTemplate(_0x103165[_0x173784]);return _0x3ad135;},{});}return _0x50ea23;}module[_0x4f7b('0x8')][_0x4f7b('0x9')]=safeTemplate; \ No newline at end of file